repo_name
stringlengths
5
114
repo_url
stringlengths
24
133
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
directory_id
stringlengths
40
40
branch_name
stringclasses
209 values
visit_date
timestamp[ns]
revision_date
timestamp[ns]
committer_date
timestamp[ns]
github_id
int64
9.83k
683M
star_events_count
int64
0
22.6k
fork_events_count
int64
0
4.15k
gha_license_id
stringclasses
17 values
gha_created_at
timestamp[ns]
gha_updated_at
timestamp[ns]
gha_pushed_at
timestamp[ns]
gha_language
stringclasses
115 values
files
listlengths
1
13.2k
num_files
int64
1
13.2k
gasbarroni8/raspberrypi_api
https://github.com/gasbarroni8/raspberrypi_api
3233a1137874c1b2e0561682bc3ba3a2bf3aed7e
61b1766c86a869be8d5802642d50da93f0d398de
fe84962b1b5e3b785fcc61e216bb6b43f378b035
refs/heads/master
2021-09-21T19:47:22.858651
2018-08-31T02:13:52
2018-08-31T02:13:52
null
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.6508355140686035, "alphanum_fraction": 0.7036060094833374, "avg_line_length": 19.303571701049805, "blob_id": "5a389142230e23cbc4540dd14ea4992f52106c26", "content_id": "0923ded8b39b2ac4dff9e72ff2367ffa411aaf62", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 1563, "license_type": "no_license", "max_line_length": 100, "num_lines": 56, "path": "/README.md", "repo_name": "gasbarroni8/raspberrypi_api", "src_encoding": "UTF-8", "text": "# 提醒\n项目不再维护,推荐使用[Remote GPIO Recipes](https://gpiozero.readthedocs.io/en/stable/recipes_remote_gpio.html)\n\n# raspberrypi_api\n把树莓派的硬件功能作为web api\n\n![](https://raw.githubusercontent.com/wwj718/gif_bed/master/ledf96a0f7d.png)\n\n# 原因\n* 近期公司有一个有趣的项目,希望用乐高玩具式的可视化编程工具来操控硬件\n* 树莓派操控硬件需要有root权限,作为服务之后则没有限制\n* 解耦\n\n# 架构\n* 初期效用flask作为web框架\n* 把led_server视为下位机,api视为指令集\n\n# 使用\n我的树莓派当前ip为:192.168.0.106\n\n### 启动服务\nsudo python led_server.py\n\n### 控制\n可以在浏览器或命令行里打开api接口(动作)\n\n* 点亮红灯: curl 192.168.0.106/led_up\n* 熄灭红灯: curl 192.168.0.106/led_down\n* 闪啊闪 : curl 192.168.0.106/led_up_down\n\n#### 在网页中用js控制\n```javascript\nxmlhttp=new XMLHttpRequest();\nxmlhttp.open(\"GET\",\"http://192.168.0.106/led_up_down\",true);\nxmlhttp.send();\n```\n\n\n# 微信控制\n和此前的[wechat_bot](https://github.com/wwj718/wechat_bot)关联即可\n\n# todo\n* 权限\n * 先用`?key=xxx`\n* websocket\n * 长连接\n * 双向通信 \n * 浏览器中js可操作\n * python实现: \n * [WebSocket-for-Python](https://github.com/Lawouach/WebSocket-for-Python)\n * [Flask-SocketIO](https://github.com/miguelgrinberg/Flask-SocketIO)\n * [flask-sockets](https://github.com/kennethreitz/flask-sockets) (暂时选择这个)\n\n# done\n* cors \n * 可以用js控制硬件\n" }, { "alpha_fraction": 0.6195018291473389, "alphanum_fraction": 0.6597774028778076, "avg_line_length": 21.734939575195312, "blob_id": "5d3fa081f5569fda5eafc8b3bc067317e5c15fbd", "content_id": "3291b127ed16d64c866a03b9bff6fbf7252b94da", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2277, "license_type": "no_license", "max_line_length": 86, "num_lines": 83, "path": "/led_websocket.py", "repo_name": "gasbarroni8/raspberrypi_api", "src_encoding": "UTF-8", "text": "#!/usr/bin/env python\n# encoding: utf-8\n\nimport RPi.GPIO\nimport time\nfrom flask import Flask\nfrom flask_cors import CORS, cross_origin\n\n#from flask_socketio import SocketIO, emit\nfrom flask_sockets import Sockets # pip install flask-sockets\n\napp = Flask(__name__)\nCORS(app)\n#app.config['HOST'] = '0.0.0.0'\n#socketio = SocketIO(app)\nsockets = Sockets(app)\n\n# 对硬件的操作参考:http://blog.mangolovecarrot.net/2015/04/20/raspi-study01/ , 感谢 mango 同学\n# 指定GPIO口的选定模式为GPIO引脚编号模式(而非主板编号模式)\n#RPi.GPIO.setmode(RPi.GPIO.BCM)\n\n# 指定GPIO14(就是LED长针连接的GPIO针脚)的模式为输出模式\n# 如果上面GPIO口的选定模式指定为主板模式的话,这里就应该指定8号而不是14号。\n#RPi.GPIO.setup(14, RPi.GPIO.OUT)\n\n# 循环10次\n@app.route('/led_up')\ndef led_up():\n RPi.GPIO.output(14, True)\n return 'ok'\n\n@app.route('/led_down')\ndef led_down():\n RPi.GPIO.output(14, False)\n return 'ok'\n# 闪啊闪\n@app.route('/led_up_down')\ndef led_up_down():\n for i in range(0, 5):\n # 让GPIO14输出高电平(LED灯亮)\n RPi.GPIO.output(14, True)\n # 持续一段时间\n time.sleep(0.5)\n # 让GPIO14输出低电平(LED灯灭)\n RPi.GPIO.output(14, False)\n # 持续一段时间\n time.sleep(0.5)\n return 'ok'\n\n# 闪啊闪\n@app.route('/led_up_down')\ndef led_up_down():\n for i in range(0, 5):\n # 让GPIO14输出高电平(LED灯亮)\n RPi.GPIO.output(14, True)\n # 持续一段时间\n time.sleep(0.5)\n # 让GPIO14输出低电平(LED灯灭)\n RPi.GPIO.output(14, False)\n # 持续一段时间\n time.sleep(0.5)\n return 'ok'\n\n@sockets.route('/echo')\ndef echo_socket(ws):\n while not ws.closed:\n message = ws.receive()\n print(message)\n ws.send(message)\n\n\n# 最后清理GPIO口(不做也可以,建议每次程序结束时清理一下,好习惯)\n#RPi.GPIO.cleanup()\n\n\n#if __name__ == '__main__':\n# #app.run(host='0.0.0.0',port='5000')\n# socketio.run(app,host=\"0.0.0.0\")\nif __name__ == \"__main__\":\n from gevent import pywsgi\n from geventwebsocket.handler import WebSocketHandler\n server = pywsgi.WSGIServer(('0.0.0.0', 5000), app, handler_class=WebSocketHandler)\n server.serve_forever()\n" }, { "alpha_fraction": 0.6044061183929443, "alphanum_fraction": 0.6484674215316772, "avg_line_length": 20.306121826171875, "blob_id": "e8a1bb1501ed932353c643f02bf7e2c22114d7b9", "content_id": "575406d80a982653f0969daf2c72bb60d9ebe408", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1364, "license_type": "no_license", "max_line_length": 82, "num_lines": 49, "path": "/led_server.py", "repo_name": "gasbarroni8/raspberrypi_api", "src_encoding": "UTF-8", "text": "#!/usr/bin/env python\n# encoding: utf-8\n\nimport RPi.GPIO\nimport time\nfrom flask import Flask\nfrom flask_cors import CORS, cross_origin\napp = Flask(__name__)\nCORS(app)\n# 对硬件的操作参考:http://blog.mangolovecarrot.net/2015/04/20/raspi-study01/ , 感谢 mango 同学\n# 指定GPIO口的选定模式为GPIO引脚编号模式(而非主板编号模式)\nRPi.GPIO.setmode(RPi.GPIO.BCM)\n\n# 指定GPIO14(就是LED长针连接的GPIO针脚)的模式为输出模式\n# 如果上面GPIO口的选定模式指定为主板模式的话,这里就应该指定8号而不是14号。\nRPi.GPIO.setup(14, RPi.GPIO.OUT)\n\n# 循环10次\n@app.route('/led_up')\ndef led_up():\n RPi.GPIO.output(14, True)\n return 'ok'\n\n@app.route('/led_down')\ndef led_down():\n RPi.GPIO.output(14, False)\n return 'ok'\n\n# 闪啊闪\n@app.route('/led_up_down')\ndef led_up_down():\n for i in range(0, 5):\n # 让GPIO14输出高电平(LED灯亮)\n RPi.GPIO.output(14, True)\n # 持续一段时间\n time.sleep(0.5)\n # 让GPIO14输出低电平(LED灯灭)\n RPi.GPIO.output(14, False)\n # 持续一段时间\n time.sleep(0.5)\n return 'ok'\n\n\n# 最后清理GPIO口(不做也可以,建议每次程序结束时清理一下,好习惯)\n#RPi.GPIO.cleanup()\n\n\nif __name__ == '__main__':\n app.run(host='0.0.0.0',port='5000')\n" }, { "alpha_fraction": 0.5412209033966064, "alphanum_fraction": 0.5588420629501343, "avg_line_length": 30.780000686645508, "blob_id": "97f4f7341053bb880715460b2cf8c0ba5a0eebc3", "content_id": "1f29b1bfd557461e0b0ec315a6d478e1ccdf2743", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1609, "license_type": "no_license", "max_line_length": 79, "num_lines": 50, "path": "/wechat_pi.py", "repo_name": "gasbarroni8/raspberrypi_api", "src_encoding": "UTF-8", "text": "#!/usr/bin/env python\n# coding: utf-8\nfrom __future__ import unicode_literals\nfrom wxbot import WXBot\nimport requests\n#bot_api=\"http://192.168.0.108:8000/get_response\"\nled_server = 'http://127.0.0.1:5000/'\n\n#import BaiduYuyin as pby\n#YOUR_APP_KEY = \"BElGG5nsGL8oevAa3gMzMk4Y\"\n#YOUR_SECRET_KEY = \"uVla1FdpQ2HgmojeY9e6pobrS3lRGaeY\"\n#tts = pby.TTS(app_key=YOUR_APP_KEY, secret_key=YOUR_SECRET_KEY)\n\n\nclass MyWXBot(WXBot):\n def _led(self,msg,user_input,action):\n response = '正在{}'.format(user_input)\n self.send_msg_by_uid(response, msg['user']['id'])\n url = led_server+action\n requests.get(url)\n response = '完成{}'.format(user_input)\n self.send_msg_by_uid(response, msg['user']['id'])\n\n\n def handle_msg_all(self, msg):\n if msg['msg_type_id'] == 4 and msg['content']['type'] == 0:\n user_input = msg[\"content\"][\"data\"]\n #payload={\"user_input\":user_input}\n # 读出来\n #print(user_input)\n #print(type(user_input)) # unicode\n #tts.say(user_input.encode(\"utf-8\")) # encode decode\n #response = requests.get(bot_api,params=payload).json()[\"response\"]\n if '关' in user_input:\n self._led(msg,user_input,'led_down')\n if '开' in user_input:\n self._led(msg,user_input,'led_up')\n if '闪' in user_input:\n self._led(msg,user_input,'led_up_down')\n #print response\n #print(type(response)) # unicode\n\ndef main():\n bot = MyWXBot()\n bot.DEBUG = True\n bot.conf['qr'] = 'png'\n bot.run()\n\nif __name__ == '__main__':\n main()\n" } ]
4
peskywyvern/module4_no_name_project
https://github.com/peskywyvern/module4_no_name_project
62b5bd82c921ac8a444309e1f946e8ad90435e18
2dc1a7b4d9920a0b277e82085a807ed88e665f06
d60b8c81a76f63a6c3156c85c36531cf489e63ae
refs/heads/master
2020-09-20T14:17:51.205780
2019-11-27T18:37:56
2019-11-27T18:37:56
null
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.4707544445991516, "alphanum_fraction": 0.4817745089530945, "avg_line_length": 36.868133544921875, "blob_id": "e439ba868304577fec2c7cf211cab214cee36764", "content_id": "9b3762be61753b31b48671b10b0fd7df086e6c88", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3539, "license_type": "no_license", "max_line_length": 72, "num_lines": 91, "path": "/data_base/main.py", "repo_name": "peskywyvern/module4_no_name_project", "src_encoding": "UTF-8", "text": "import json\r\n\r\n\r\nclass DataBase:\r\n def __init__(self):\r\n self.database = {'tables': {}, 'data': {}}\r\n self.field_types = {\r\n 'int': int,\r\n 'str': str,\r\n 'boolean': bool}\r\n\r\n def add_tables(self, name: str, parameters: dict):\r\n if name not in self.database['tables']:\r\n self.database['tables'].update({name: parameters})\r\n\r\n def add_data(self, table_name: str, data: dict):\r\n keys_checked = 0\r\n for n in data.keys():\r\n if n in self.database['tables'][table_name].keys():\r\n if type(data[n]) == \\\r\n self.field_types[self.database[\r\n 'tables'][table_name][n]]:\r\n keys_checked += 1\r\n if keys_checked == len(data.keys()):\r\n if table_name in self.database['data']:\r\n\r\n self.database['data'][table_name].append(data)\r\n else:\r\n self.database['data'].update({f'{table_name}': []})\r\n self.database['data'][table_name].append(data)\r\n\r\n def select(self, table: str, limit: int = None):\r\n with open('Database.json', 'r') as db:\r\n dict_list1 = json.load(db)\r\n dict_list = dict_list1['data'][table]\r\n new_list = []\r\n for num in dict_list:\r\n new_list.append(num)\r\n return new_list[0:limit]\r\n\r\n# def id_creator(self):\r\n# with open('Database.json', 'r') as ids:\r\n# tables_list = json.load(ids)['data']\r\n# id_list = []\r\n# id_ = 0\r\n# for table in tables_list.values():\r\n# for dict1 in table:\r\n# id_list.append(dict1.get('id'))\r\n# if id_list[-1] != 'int' and id_list[-1] is not None:\r\n# id_ = id_list[-1] + 1\r\n# else:\r\n# id_ = 0\r\n# print(id_)\r\n# return id_\r\n\r\n @staticmethod\r\n def compare_databases(database, json_data):\r\n for key in database['tables'].keys():\r\n if key not in json_data['tables'].keys():\r\n json_data['tables'].update({key: database[key]})\r\n for key in database['data'].keys():\r\n if key not in json_data['data'].keys():\r\n json_data['data'].update({key: database[key]})\r\n for item in database['data'][key]:\r\n if item not in json_data['data'][key]:\r\n json_data['data'][key].append(item)\r\n return json_data\r\n\r\n def to_json(self):\r\n with open('Database.json', 'r') as file:\r\n try:\r\n data = json.load(file)\r\n except json.decoder.JSONDecodeError:\r\n with open('Database.json', 'w') as file1:\r\n json.dump(self.database, file1, indent=2)\r\n return\r\n data = self.compare_databases(self.database, data)\r\n with open('Database.json', 'w') as file1:\r\n json.dump(data, file1, indent=2)\r\n\r\n\r\nDB = DataBase()\r\nDB.add_tables('Songs', {'id': 'int', 'name': 'str', 'lyrics': 'str'})\r\nDB.add_data('Songs', {'id': 1001, 'name': 'In Bloom', 'lyrics': 'test'})\r\nDB.add_data('Songs', {'id': 1002, 'name': 'Wild', 'lyrics': 'test'})\r\nDB.to_json()\r\nDB.add_data('Songs', {'id': 1003, 'name': 'Nobody', 'lyrics': 'test'})\r\nDB.add_data('Songs', {'id': 1004, 'name': 'No Plan', 'lyrics': 'test'})\r\nDB.to_json()\r\nDB.add_data('Songs', {'id': 1005, 'name': 'Almost', 'lyrics': 'test'})\r\nDB.to_json()\r\n\r\n" }, { "alpha_fraction": 0.692307710647583, "alphanum_fraction": 0.692307710647583, "avg_line_length": 37.11111068725586, "blob_id": "21ed356497ac36d11215e83bd74d0ca81a722b89", "content_id": "ec8c88833c22565e63fa764f993aa3b8e725d5ee", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 351, "license_type": "no_license", "max_line_length": 71, "num_lines": 9, "path": "/lyrics/tests.py", "repo_name": "peskywyvern/module4_no_name_project", "src_encoding": "UTF-8", "text": "import unittest\nfrom lyrics import fetch_lyrics\n\n\nclass TestLyrics(unittest.TestCase):\n def test_fetch_lyrics_returns_string(self):\n self.assertIsInstance(fetch_lyrics('Nirvana', 'In Bloom'), str)\n self.assertIsInstance(fetch_lyrics('Adele', 'Hello'), str)\n self.assertIsInstance(fetch_lyrics('Kendrick Lamar', 'Humble'), str)\n " }, { "alpha_fraction": 0.5171645283699036, "alphanum_fraction": 0.5189478397369385, "avg_line_length": 28.526315689086914, "blob_id": "548468af1027696b76857d3e418ce478ddde671f", "content_id": "dba8790598fef9da9d0e20a4fe2e0f51bda09cc9", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2243, "license_type": "no_license", "max_line_length": 67, "num_lines": 76, "path": "/lyrics/lyrics.py", "repo_name": "peskywyvern/module4_no_name_project", "src_encoding": "UTF-8", "text": "import argparse\nimport json\nimport requests\nfrom bs4 import BeautifulSoup\n\n\ndef fetch_lyrics(author, song):\n author = author.replace(\" \", \"-\")\n song = song.replace(\" \", \"-\")\n url = f'https://genius.com/{author}-{song}-lyrics'\n result = requests.get(url).text\n\n soup = BeautifulSoup(result, \"html.parser\")\n content = soup.find('p').text\n\n return content\n\n\ndef add_song_text(author, song):\n\n \"\"\"If a song exists in json file, adds text in key['Lyrics']\"\"\"\n\n text = fetch_lyrics(author, song)\n with open(\"Database.json\", \"r\") as file:\n content = json.load(file)\n for key in content['data']['Songs']:\n if key['artist'] == author and key['name'] == song:\n key['Lyrics'] = text\n\n with open(\"Database.json\", \"w\") as file1:\n json.dump(content, file1, indent=2)\n\n\ndef to_file(author, song):\n\n \"\"\"Checks if the song is already in JSON file, copies song text\n and saves it to a .txt file. If the text does not exist yet,\n parses it, adds to data base and to file\"\"\"\n\n with open(\"Database.json\", \"r\") as file:\n content = json.load(file)\n for key in content['data']['Songs']:\n if key['artist'] == author and key['name'] == song:\n if key['lyrics'] != 'text':\n text_to_download = key['Lyrics']\n else:\n text_to_download = fetch_lyrics(author, song)\n\n with open(f\"{author}_{song}.txt\", \"w\") as file:\n file.write(f'{author}\\n{text_to_download}')\n\n\nif __name__ == \"__main__\":\n to_file('Nirvana', 'In Bloom')\n to_file('Adele', 'Hello')\n add_song_text('Adele', 'Hello')\n\n parser = argparse.ArgumentParser()\n\n parser.add_argument('-a',\n '--artist',\n type=str,\n default=None)\n parser.add_argument('-s',\n '--song',\n type=str,\n default=None)\n parser.add_argument('-f',\n '--to_file',\n type=str,\n default=None)\n parser.add_argument('-d', '--to_db',\n type=str,\n default=None)\n\n args = parser.parse_args()" } ]
3
AlexKrudu/Crypto_shit
https://github.com/AlexKrudu/Crypto_shit
dcdc39d2dc948dee08d0f2a0350bca015f54e508
acfde16f7ef61c047b5f91749c88b467c3b8bcfb
42f375bd3f2e1b3cef58b961a414c2c7a0d4b493
refs/heads/master
2020-03-13T13:44:07.329769
2018-04-29T10:18:21
2018-04-29T10:18:21
131,144,869
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.5882353186607361, "alphanum_fraction": 0.5882353186607361, "avg_line_length": 15, "blob_id": "401795c83230931614e08ecccbad1b180a6ea736", "content_id": "b4df67e56fd35045ee69d7edfcd928957dedc1da", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 17, "license_type": "no_license", "max_line_length": 15, "num_lines": 1, "path": "/README.md", "repo_name": "AlexKrudu/Crypto_shit", "src_encoding": "UTF-8", "text": "\"# Crypto_shit\" \n" }, { "alpha_fraction": 0.612144410610199, "alphanum_fraction": 0.6230853199958801, "avg_line_length": 24.746479034423828, "blob_id": "2c45abb45e13105245a25afb2e523b3fb64e6f14", "content_id": "f5cac6a20ad77126a7b863350d38e23f8f722af7", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1871, "license_type": "no_license", "max_line_length": 88, "num_lines": 71, "path": "/main.py", "repo_name": "AlexKrudu/Crypto_shit", "src_encoding": "UTF-8", "text": "from flask import Flask\nimport os\nfrom flask import render_template, request, send_from_directory\nfrom datetime import datetime\nimport db\n\napp = Flask(__name__)\n\n\n@app.route('/favicon.ico')\ndef favicon():\n return send_from_directory(os.path.join(app.root_path, 'static'),\n 'favicon.ico', mimetype='image/vnd.microsoft.icon')\n\n\n@app.route(\"/\", methods=[\"GET\", \"POST\"])\ndef index():\n result = []\n if request.method == \"POST\":\n hashes = request.form[\"hashes\"].strip().split()\n result = db.check_hashes(hashes)\n\n return render_template(\"index.html\", res=result)\n\n\n@app.route(\"/wallet\")\ndef wallet():\n correct = True\n id = request.args.get(\"id\")\n score = db.calculate(id)\n verdict = db.get_vk_name(id)\n if verdict == \"Не удалось найти информацию\" and not score:\n verdict = \"Некорректный id\"\n correct = False\n if not id:\n correct = False\n verdict = \"Введите id\"\n\n return render_template(\"wallet.html\", score=score, correct=correct, verdict=verdict)\n\n\n@app.route(\"/pay\", methods=[\"GET\", \"POST\"])\ndef pay():\n result = \"\"\n if request.method == \"POST\":\n sender = request.form[\"id_send\"].strip()\n amount = request.form[\"amount\"].strip()\n getter = request.form[\"id_get\"].strip()\n result = db.handle_transaction(sender, getter, amount, datetime.utcnow())\n\n return render_template(\"pay.html\", res=result)\n\n\n@app.route(\"/top\")\ndef top():\n return render_template(\"top.html\", res=db.build_top(10), num=10)\n\n\n@app.route(\"/top5\")\ndef top5():\n return render_template(\"top.html\", res=db.build_top(5), num=5)\n\n\n@app.route(\"/top20\")\ndef top20():\n return render_template(\"top.html\", res=db.build_top(20), num=20)\n\n\nif __name__ == \"__main__\":\n app.run(port=8080, host=\"localhost\")\n print(\"Smth\")\n" }, { "alpha_fraction": 0.5275887846946716, "alphanum_fraction": 0.536281168460846, "avg_line_length": 26, "blob_id": "ac6d69ee1fe56292d4d2579f90fdbbd600c06cb8", "content_id": "8d30fd97c854f1a674323602572200e0caa773bb", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2828, "license_type": "no_license", "max_line_length": 104, "num_lines": 98, "path": "/db.py", "repo_name": "AlexKrudu/Crypto_shit", "src_encoding": "UTF-8", "text": "import pymongo\nimport requests\nfrom hashlib import md5\nfrom datetime import datetime\n\n\nclient = pymongo.MongoClient(\"localhost\", 27017)\n\ncoin = client.database.coins\nlog = client.database.logs\n\n\ndef calculate(user_id):\n result = coin.find({\"user\": {\"$eq\": user_id}}).count()\n return result if result else False\n\n\ndef check_exists(rest):\n if coin.find_one({\"string\": {\"$eq\": rest}}) is None:\n return True\n\n return False\n\n\ndef handle_transaction(sender, getter, amount, time):\n if not sender or not amount or not getter:\n return \"Убедитесь в корректности введенных данных\"\n amount = int(amount)\n if sender == getter:\n return \"Нельзя отправлять монеты самому себе\"\n if amount <= 0:\n return \"Некорректная сумма\"\n if coin.find({\"user\": {\"$eq\": sender}}).count() < amount:\n return \"Недостаточно средств!\"\n\n coins_id = [i[\"_id\"] for i in coin.find({\"user\": {\"$eq\": sender}})[:amount]]\n\n for i in coins_id:\n coin.update({\"_id\": i}, {\"$set\": {\"user\": getter}})\n\n insert_db(log, {\n \"coin\": i,\n \"from\": sender,\n \"to\": getter,\n \"time\": time\n } )\n return \"Перевод успешно состоялся!\"\n\n\ndef get_vk_name(id):\n server = \"https://api.vk.com/method/users.get\"\n params = {\"user_ids\": str(id),\n \"v\": \"5.74\"}\n try:\n answer = requests.get(server, params=params).json()[\"response\"][0]\n return \" \".join((answer[\"first_name\"], answer[\"last_name\"]))\n except:\n return \"Не удалось найти информацию\"\n\n\ndef build_top(num):\n res = coin.aggregate([{'$group': {'_id': '$user', 'total': {'$sum': 1}}}, {'$sort': {'total': -1}}])\n res = list(res)[:num]\n return [(get_vk_name(res[i][\"_id\"]), res[i][\"total\"]) for i in range(len(res))]\n\ndef insert_db(name, value):\n name.insert_one(value)\n\n\ndef check_hashes(hashes):\n result = []\n error = True\n uid = \"\"\n rest = \"\"\n for h in hashes:\n if md5(h.encode('utf8')).hexdigest()[:5] == '00000': # нашли хеш (здесь проверка для 4-х нулей)\n try:\n uid, rest = h.split('-', maxsplit=1)\n except Exception:\n error = False\n if not uid.isdigit():\n error = False\n else:\n error = False\n\n if not check_exists(rest):\n error = False\n\n if error:\n insert_db(coin, {\n \"string\": rest,\n \"time\": datetime.utcnow(),\n \"user\": uid,\n })\n result.append((h, error))\n print(list(coin.find()))\n\n return result\n" } ]
3
jespino/mattermost-keycloak
https://github.com/jespino/mattermost-keycloak
68c9fe140e7364fb9071ae90593934e3e04310f3
cae754b92d18c22ad197a75a9a575614b039f6bd
36bdac22a30e929a90356082c24c9b243c0586e9
refs/heads/master
2020-03-27T04:06:40.651372
2018-08-23T22:13:46
2018-08-23T22:13:46
145,912,350
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.6138755083084106, "alphanum_fraction": 0.6203715801239014, "avg_line_length": 38.071067810058594, "blob_id": "836decc3a32e6496e479feb6e0320a1e85b1e612", "content_id": "7d1b936d227a9552c0cbb09f2eb730f259d31b58", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 7697, "license_type": "no_license", "max_line_length": 262, "num_lines": 197, "path": "/mmkeycloak", "repo_name": "jespino/mattermost-keycloak", "src_encoding": "UTF-8", "text": "#!/usr/bin/env python\n\nimport subprocess\nimport click\nimport json\nimport os\nimport os.path\nimport shutil\n\nDEFAULT_PORT = \"8888\"\n\ndef container_exists(container_name):\n result = subprocess.run([\"docker\", \"ps\", \"-a\"], capture_output=True)\n if container_name.lower() in result.stdout.decode('utf-8').lower():\n return True\n return False\n\ndef container_is_running(container_name):\n result = subprocess.run([\"docker\", \"ps\"], capture_output=True)\n if container_name.lower() in result.stdout.decode('utf-8').lower():\n return True\n return False\n\n@click.group()\ndef cli():\n pass\n\n@cli.command()\n@click.argument(\"container_name\", default=\"mattermost-saml\")\n@click.option(\"--port\", default=DEFAULT_PORT)\ndef start(container_name, port):\n if not container_exists(container_name):\n print(\"Creating container...\", end=\"\", flush=True)\n\n result = subprocess.run([\"docker\", \"run\", \"--name\", container_name, \"-p\", \"{}:8080\".format(port), \"--link\", \"mattermost-openldap\", \"-d\", \"jboss/keycloak:3.4.3.Final\"], capture_output=True)\n if result.returncode != 0:\n print(\"ERROR\")\n print(result.stderr)\n return\n print(\"OK\")\n\n print(\"Configuring container...\", end=\"\", flush=True)\n result = subprocess.run([\"docker\", \"exec\", \"-ti\", \"mattermost-saml\", \"bash\", \"-c\", \"keycloak/bin/add-user-keycloak.sh -u admin -p Password1\"])\n if result.returncode != 0:\n print(\"ERROR\")\n print(result.stderr)\n return\n result = subprocess.run([\"docker\", \"cp\", \"keycloak-client.json\", \"mattermost-saml:/opt/jboss/keycloak/keycloak-client.json\"])\n if result.returncode != 0:\n print(\"ERROR\")\n print(result.stderr)\n return\n result = subprocess.run([\"docker\", \"cp\", \"keycloak-ldap.json\", \"mattermost-saml:/opt/jboss/keycloak/keycloak-ldap.json\"])\n if result.returncode != 0:\n print(\"ERROR\")\n print(result.stderr)\n return\n result = subprocess.run([\"docker\", \"exec\", \"-ti\", \"mattermost-saml\", \"bash\", \"-c\", \"keycloak/bin/kcadm.sh create clients --server http://localhost:8080/auth --user admin --password Password1 --realm master -f /opt/jboss/keycloak/keycloak-client.json\"])\n if result.returncode != 0:\n print(\"ERROR\")\n print(result.stderr)\n return\n result = subprocess.run([\"docker\", \"exec\", \"-ti\", \"mattermost-saml\", \"bash\", \"-c\", \"keycloak/bin/kcadm.sh create components --server http://localhost:8080/auth --user admin --password Password1 --realm master -f /opt/jboss/keycloak/keycloak-ldap.json\"])\n if result.returncode != 0:\n print(\"ERROR\")\n print(result.stderr)\n return\n print(\"OK\")\n\n if not container_is_running(container_name):\n print(\"Running container...\", end=\"\", flush=True)\n result = subprocess.run([\"docker\", \"start\", container_name], capture_output=True)\n if result.returncode == 0:\n print(\"OK\")\n else:\n print(\"ERROR\")\n print(result.stderr)\n return\n\n@cli.command()\n@click.argument(\"container_name\", default=\"mattermost-saml\")\ndef stop(container_name):\n if not container_is_running(container_name):\n print(\"The container is not running\")\n return\n\n print(\"Stoping container...\", end=\"\", flush=True)\n result = subprocess.run([\"docker\", \"stop\", container_name], capture_output=True)\n if result.returncode == 0:\n print(\"OK\")\n else:\n print(\"ERROR\")\n print(result.stderr)\n\n@cli.command()\n@click.argument(\"container_name\", default=\"mattermost-saml\")\ndef clean(container_name):\n if not container_exists(container_name):\n print(\"Container does not exists\")\n\n if container_is_running(container_name):\n print(\"Stoping container...\", end=\"\", flush=True)\n result = subprocess.run([\"docker\", \"stop\", container_name], capture_output=True)\n if result.returncode == 0:\n print(\"OK\")\n else:\n print(\"ERROR\")\n print(result.stderr)\n return\n\n print(\"Removing container...\", end=\"\", flush=True)\n result = subprocess.run([\"docker\", \"rm\", container_name], capture_output=True)\n if result.returncode == 0:\n print(\"OK\")\n else:\n print(\"ERROR\")\n print(result.stderr)\n return\n\n@cli.command()\n@click.argument(\"config-directory\", default=\"../mattermost-server/config\")\n@click.option(\"--port\", default=DEFAULT_PORT)\ndef enable_saml(config_directory, port):\n with open(os.path.join(config_directory, \"config.json\"), \"r\") as fd:\n config = json.load(fd)\n\n config[\"SamlSettings\"][\"Enable\"] = True\n config[\"SamlSettings\"][\"EnableSyncWithLdap\"] = True\n config[\"SamlSettings\"][\"Verify\"] =True\n config[\"SamlSettings\"][\"Encrypt\"] = False\n config[\"SamlSettings\"][\"IdpUrl\"] = False\n config[\"SamlSettings\"][\"IdpUrl\"] = \"http://dockerhost:{}/auth/realms/master/protocol/saml\".format(port)\n config[\"SamlSettings\"][\"IdpDescriptorUrl\"] = \"http://localhost:8065/login/sso/saml\"\n config[\"SamlSettings\"][\"AssertionConsumerServiceURL\"] = \"http://localhost:8065/login/sso/saml\"\n config[\"SamlSettings\"][\"ScopingIDPProviderId\"] = \"\"\n config[\"SamlSettings\"][\"ScopingIDPName\"] = \"\"\n config[\"SamlSettings\"][\"IdpCertificateFile\"] = \"keycloak_cert.pem\"\n config[\"SamlSettings\"][\"PublicCertificateFile\"] = \"\"\n config[\"SamlSettings\"][\"PrivateKeyFile\"] = \"\"\n config[\"SamlSettings\"][\"IdAttribute\"] = \"id\"\n config[\"SamlSettings\"][\"FirstNameAttribute\"] = \"firstName\"\n config[\"SamlSettings\"][\"LastNameAttribute\"] = \"lastName\"\n config[\"SamlSettings\"][\"EmailAttribute\"] = \"email\"\n config[\"SamlSettings\"][\"UsernameAttribute\"] = \"username\"\n\n with open(os.path.join(config_directory, \"config.json\"), \"w\") as fd:\n json.dump(config, fd, indent=4)\n shutil.copyfile(\"keycloak_cert.pem\", os.path.join(config_directory, \"keycloak_cert.pem\"))\n\n@cli.command()\n@click.argument(\"config-directory\", default=\"../mattermost-server/config/\")\ndef disable_saml(config_directory):\n with open(os.path.join(config_directory, \"config.json\"), \"r\") as fd:\n config = json.load(fd)\n\n config[\"SamlSettings\"] = {\n \"Enable\": False,\n \"EnableSyncWithLdap\": False,\n \"Verify\": True,\n \"Encrypt\": True,\n \"IdpUrl\": \"\",\n \"IdpDescriptorUrl\": \"\",\n \"AssertionConsumerServiceURL\": \"\",\n \"ScopingIDPProviderId\": \"\",\n \"ScopingIDPName\": \"\",\n \"IdpCertificateFile\": \"\",\n \"PublicCertificateFile\": \"\",\n \"PrivateKeyFile\": \"\",\n \"FirstNameAttribute\": \"\",\n \"LastNameAttribute\": \"\",\n \"EmailAttribute\": \"\",\n \"UsernameAttribute\": \"\",\n \"NicknameAttribute\": \"\",\n \"LocaleAttribute\": \"\",\n \"PositionAttribute\": \"\",\n \"LoginButtonText\": \"With SAML\",\n \"LoginButtonColor\": \"#34a28b\",\n \"LoginButtonBorderColor\": \"#2389D7\",\n \"LoginButtonTextColor\": \"#ffffff\"\n }\n\n with open(os.path.join(config_directory, \"config.json\"), \"w\") as fd:\n json.dump(config, fd, indent=4)\n os.remove(os.path.join(config_directory, \"keycloak_cert.pem\"))\n\n@cli.command()\n@click.argument(\"container_name\", default=\"mattermost-saml\")\ndef shell(container_name):\n subprocess.run([\"docker\", \"exec\", \"-i\", \"-t\", container_name, \"/bin/bash\"])\n\n@cli.command()\n@click.argument(\"container_name\", default=\"mattermost-saml\")\ndef log(container_name):\n subprocess.run([\"docker\", \"exec\", \"-i\", \"-t\", container_name, \"/bin/tail\", \"-f\", \"/opt/jboss/keycloak/standalone/log/server.log\"])\n\nif __name__ == \"__main__\":\n cli()\n" } ]
1
woodstea23/realpython
https://github.com/woodstea23/realpython
68814df25d9b4750081d6abbf4dd61e70706462e
d2ba9d82cc3db05d609671d3a13a03b76580acab
1c0f6a6acf4e3c2cc0e0620a5cee7de35b4f0473
refs/heads/master
2021-07-05T13:56:43.264333
2017-09-28T16:37:20
2017-09-28T16:37:20
105,169,450
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.5561097264289856, "alphanum_fraction": 0.5910224318504333, "avg_line_length": 22.58823585510254, "blob_id": "91a58e8e9e9831758fb9b818f5eb30bf78c9c773", "content_id": "bced285d242bfd6d85a8984209ed8a01e1e70eeb", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 401, "license_type": "no_license", "max_line_length": 43, "num_lines": 17, "path": "/test.py", "repo_name": "woodstea23/realpython", "src_encoding": "UTF-8", "text": "\"Here's a docstring\"\n\ndef mainfunc():\n \"Here's a docstring\"\n birthdays = {}\n birthdays['Luke Skywalker'] = '5/24/19'\n birthdays['Obi-Wan Kenobi'] = '3/11/57'\n birthdays['Darth Vader'] = '4/1/41'\n\n for jedi in 'Yoda', 'Darth Vader':\n if jedi not in birthdays:\n birthdays[jedi] = 'unknown'\n\n for jedi in birthdays:\n print(jedi, birthdays[jedi])\n\nmainfunc()\n" }, { "alpha_fraction": 0.588744580745697, "alphanum_fraction": 0.6450216174125671, "avg_line_length": 16.769229888916016, "blob_id": "0583466b0a7d45c08bf7128aea7dfd827fc4840d", "content_id": "2373b7871699f89701c9bf31152e71436cd45c0a", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 231, "license_type": "no_license", "max_line_length": 63, "num_lines": 13, "path": "/dieroll.py", "repo_name": "woodstea23/realpython", "src_encoding": "UTF-8", "text": "\"Hello\"\n\nfrom random import randint\n\ndef dieroller():\n \"Hello again\"\n return((randint(1, 6)))\n\nTOTAL=0\nfor i in range(0, 1000):\n TOTAL = TOTAL + dieroller()\n\nprint(\"Average of rolls is {:.2f}\".format(float(TOTAL) / 1000))\n" }, { "alpha_fraction": 0.5380434989929199, "alphanum_fraction": 0.5978260636329651, "avg_line_length": 11.266666412353516, "blob_id": "5d25a6315d1558097d3b2564e9a96812bcea170c", "content_id": "88579c1e1dcab6d7799171c3cc3d5dc972bd5927", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 184, "license_type": "no_license", "max_line_length": 21, "num_lines": 15, "path": "/p59.py", "repo_name": "woodstea23/realpython", "src_encoding": "UTF-8", "text": "for x in range(2,11):\n\tprint(x)\n\nx = 2\nprint()\nwhile(x < 11):\n\tprint(x)\n\tx = x + 1\nprint()\n\ndef doubles(number):\n\tfor i in range(0,3):\n\t\tnumber = number * 2\n\t\tprint(number)\ndoubles(2)\n" }, { "alpha_fraction": 0.47665369510650635, "alphanum_fraction": 0.5525291562080383, "avg_line_length": 18.037036895751953, "blob_id": "e9086291713111d98d9a89dd43e780e384069a3f", "content_id": "3a2fd0521995185a567009cb2825eba0c5f7ebad", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 514, "license_type": "no_license", "max_line_length": 60, "num_lines": 27, "path": "/election.py", "repo_name": "woodstea23/realpython", "src_encoding": "UTF-8", "text": "\"Hello\"\n\nfrom random import randint\n\ndef oneelection():\n \"Hello again\"\n acount = 0\n # Region 1\n if randint(1, 100) <= 87:\n acount += 1\n # Region 2\n if randint(1, 100) <= 65:\n acount += 1\n # Region 3\n if randint(1, 100) <= 17:\n acount += 1\n if acount >= 2:\n return(1)\n else:\n return(0)\n\nATOTAL = 0\nfor i in range(0, 10000):\n ATOTAL = ATOTAL + oneelection()\n\nAPROB = float(ATOTAL) / 100\nprint(f\"Probability of candidate A winning is {APROB:.2f}%\")\n" }, { "alpha_fraction": 0.5280172228813171, "alphanum_fraction": 0.5754310488700867, "avg_line_length": 29.933332443237305, "blob_id": "b4c550443c678d6ad4a5fd3dad31cb27757f58b5", "content_id": "c5d74890900f3499c5f341d9702e30edac309899", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 464, "license_type": "no_license", "max_line_length": 62, "num_lines": 15, "path": "/invest.py", "repo_name": "woodstea23/realpython", "src_encoding": "UTF-8", "text": "\"Print an amortization table\"\n\ndef invest(amount, rate, time):\n \"And here's the main function\"\n print(\"principal amount: ${}\".format(amount))\n print(\"annual rate of return: {:.2f}%\".format(rate * 100))\n for i in range(1, time + 1):\n amount = amount * (1 + rate)\n print(\"year {}: ${:.2f}\".format(i, amount))\n # Here is a comment.\n # Here is a second comment.\n # And a third.\n\ninvest(100, .05, 8)\ninvest(2000, .025, 5)\n" }, { "alpha_fraction": 0.6135770082473755, "alphanum_fraction": 0.6553524732589722, "avg_line_length": 28.384614944458008, "blob_id": "1f3308a194e4c884df68330b87301ed6d0e4df86", "content_id": "f9d3386fa6a1fea345d2014f0a078e7641fbd9bd", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 383, "license_type": "no_license", "max_line_length": 84, "num_lines": 13, "path": "/temperature.py", "repo_name": "woodstea23/realpython", "src_encoding": "UTF-8", "text": "def ctof(tc):\n\ttf = (tc * 9 / 5) + 32\n\treturn tf\n\ndef ftoc(tf):\n\ttc = (tf - 32) * 5 / 9\n\treturn tc\n\ntemp1 = float(input(\"Enter a Celsius temperature: \"))\nprint(\"{} degrees Celsius is {:.2f} degrees Fahrenheit.\".format(temp1, ctof(temp1)))\n\ntemp2 = float(input(\"Enter a Fahrenheit temperature: \"))\nprint(\"{} degrees Fahrenheit is {:.2f} degrees Celsius.\".format(temp2, ftoc(temp2)))\n\n" }, { "alpha_fraction": 0.5092592835426331, "alphanum_fraction": 0.5694444179534912, "avg_line_length": 18.636363983154297, "blob_id": "a6352dc35e4c94573b51354fdb444a40bf430db6", "content_id": "453860154147f0eb9a7050cb2b8afa25128bdfc2", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 216, "license_type": "no_license", "max_line_length": 46, "num_lines": 11, "path": "/randomex.py", "repo_name": "woodstea23/realpython", "src_encoding": "UTF-8", "text": "\"Hello\"\n\nfrom random import randint\n\nHEADS = 0\nTAILS = 0\nfor trial in range(0, 10000):\n while randint(0, 1) == 0:\n TAILS = TAILS + 1\n HEADS = HEADS + 1\n print(\"HEADS / TAILS = \", HEADS/TAILS)\n" }, { "alpha_fraction": 0.628125011920929, "alphanum_fraction": 0.637499988079071, "avg_line_length": 31, "blob_id": "6b750ae514af72f2a21edad1e62b0d4a41106743", "content_id": "ca16eac926a4a3bd972b667e6000ea875213daa0", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 320, "license_type": "no_license", "max_line_length": 82, "num_lines": 10, "path": "/factors.py", "repo_name": "woodstea23/realpython", "src_encoding": "UTF-8", "text": "\"Find all of the integers that divide evenly into an integer provided by the user\"\n\ndef factors(testint):\n \"And here's the main function\"\n\n for i in range(1, testint + 1):\n if testint % i == 0:\n print(\"{} is a divisor of {}\".format(i, testint))\n\nfactors(int(input(\"Enter a positive integer: \")))\n" }, { "alpha_fraction": 0.5306603908538818, "alphanum_fraction": 0.5982704162597656, "avg_line_length": 24.959182739257812, "blob_id": "514f2f367b0a6d4546ff54d3e37c15348a39435c", "content_id": "e08a0e9815ee2f2c966e20506dd090094846e8d2", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1272, "license_type": "no_license", "max_line_length": 76, "num_lines": 49, "path": "/list_of_lists.py", "repo_name": "woodstea23/realpython", "src_encoding": "UTF-8", "text": "\"Enrollment stats exercise\"\n\ndef enrollment_stats(univlist):\n \"Cha\"\n enrolled = []\n cash = []\n for univ in univlist:\n enrolled.append(univ[1])\n cash.append(univ[2])\n return enrolled, cash\n\ndef mean(mylist):\n \"Cha\"\n mysum = 0\n for myvalue in mylist:\n mysum += float(myvalue)\n return int(mysum / len(mylist))\n\ndef median(mylist):\n \"Cha\"\n mylist.sort()\n length = len(mylist)\n if not length % 2:\n return (mylist[int(length / 2)] + mylist[int(length / 2 - 1)]) / 2.0\n return mylist[int(length / 2)]\n\nUNIVS = [\n ['California Institute of Technology', 2175, 37704],\n ['Harvard', 19627, 39849],\n ['Massachusetts Institute of Technology', 10566, 40732],\n ['Princeton', 7802, 37000],\n ['Rice', 5879, 35551],\n ['Stanford', 19535, 40569],\n ['Yale', 11701, 40500]\n]\n\nSTATS = enrollment_stats(UNIVS)\nprint(STATS[0])\n\nprint()\nprint(\"*****\" * 5)\nprint(\"Total students: {}\".format(sum(STATS[0])))\nprint(\"Total tuition: $ {}\".format(sum(STATS[1])))\nprint(\"\\nStudent mean: {}\".format(mean(STATS[0])))\nprint(\"Student median: {}\".format(median(STATS[0])))\nprint(\"\\nTuition mean: $ {}\".format(mean(STATS[1])))\nprint(\"Tuition median: $ {}\".format(median(STATS[1])))\nprint(\"*****\" * 5)\nprint()\n" } ]
9
lqmanh/spinach
https://github.com/lqmanh/spinach
bf2b85362498ddc7a50011b35f3a26daf6f2217c
232f4c6fce501cfe4550842c213bab707a7af2de
c55291d64e6fc3421dbbc91c1d74b6ba5a71a95b
refs/heads/master
2023-05-22T01:10:43.708939
2021-05-27T16:39:25
2021-05-27T16:39:25
null
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.5859711170196533, "alphanum_fraction": 0.5869840383529663, "avg_line_length": 32.466102600097656, "blob_id": "2c4de6aaa287c7f6bd74a23148c61a4a57139ad3", "content_id": "e9046a497ba39630f35ddf4d4a0558e11346f0c3", "detected_licenses": [ "BSD-2-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3949, "license_type": "permissive", "max_line_length": 78, "num_lines": 118, "path": "/spinach/worker.py", "repo_name": "lqmanh/spinach", "src_encoding": "UTF-8", "text": "from logging import getLogger\nfrom queue import Queue\nimport threading\nimport time\n\nfrom . import signals\nfrom .job import Job, advance_job_status\n\nlogger = getLogger(__name__)\n\n\nclass MaxUnfinishedQueue(Queue):\n \"\"\"Queue considered full when it has too many unfinished tasks.\n\n This is to make sure that no job is pushed to the queue before a worker is\n actually free to take it.\n \"\"\"\n\n def empty(self):\n with self.mutex:\n return self.unfinished_tasks == 0\n\n def full(self):\n with self.mutex:\n return self.maxsize <= self.unfinished_tasks\n\n def available_slots(self) -> int:\n with self.mutex:\n return self.maxsize - self.unfinished_tasks\n\n\nclass Workers:\n\n def __init__(self, num_workers: int, namespace: str):\n # in_queue receives Job objects to execute\n # out_queue send Job objects after execution\n self._in_queue = MaxUnfinishedQueue(maxsize=num_workers)\n self.out_queue = Queue()\n\n self._namespace = namespace.format(namespace)\n self._threads = list()\n\n # The event exists only to stop accepting jobs, workers are terminated\n # via the poison pill\n self._must_stop = threading.Event()\n self.poison_pill = object()\n\n for i in range(1, num_workers + 1):\n thread = threading.Thread(\n target=self._worker_func,\n name='{}-worker-{}'.format(self._namespace, i)\n )\n thread.start()\n self._threads.append(thread)\n\n def _worker_func(self):\n worker_name = threading.current_thread().name\n logger.debug('Worker %s started', worker_name)\n signals.worker_started.send(self._namespace, worker_name=worker_name)\n\n while True:\n item = self._in_queue.get()\n\n if item is self.poison_pill:\n self._in_queue.task_done()\n self._in_queue.put(self.poison_pill)\n break\n\n job = item\n logger.info('Starting execution of %s', job)\n signals.job_started.send(self._namespace, job=job)\n start_time = time.monotonic()\n try:\n job.task_func(*job.task_args, **job.task_kwargs)\n except Exception as e:\n duration = time.monotonic() - start_time\n advance_job_status(self._namespace, job, duration, e)\n else:\n duration = time.monotonic() - start_time\n advance_job_status(self._namespace, job, duration, None)\n finally:\n signals.job_finished.send(self._namespace, job=job)\n self.out_queue.put(job)\n self._in_queue.task_done()\n\n logger.debug('Worker %s terminated', worker_name)\n signals.worker_terminated.send(self._namespace,\n worker_name=worker_name)\n\n def submit_job(self, job: Job):\n if self._must_stop.is_set():\n raise RuntimeError('Cannot submit job: workers are shutting down')\n self._in_queue.put(job)\n\n @property\n def available_slots(self) -> int:\n \"\"\"Number of jobs the :class:`Workers` can accept.\n\n It may be racy, but it should not be a problem here as jobs are\n only submitted by a single thread (the arbiter).\n \"\"\"\n return self._in_queue.available_slots()\n\n def can_accept_job(self) -> bool:\n return self.available_slots > 0\n\n def stop(self):\n if self._must_stop.is_set():\n logger.warning('Workers are already shutting down')\n return\n logger.info('Stopping workers %s', self._namespace)\n self._must_stop.set()\n self._in_queue.join()\n self._in_queue.put(self.poison_pill)\n for thread in self._threads:\n thread.join()\n self.out_queue.put(self.poison_pill)\n logger.debug('All workers %s stopped', self._namespace)\n" } ]
1
PabloGoEs85/plenaryRobocure
https://github.com/PabloGoEs85/plenaryRobocure
ad683d4ed679ee151f092d0889462ed93c6670f5
410d0069e7ae5304858a44186b173dc778d241eb
03337c38f41061e01ba0e7036e706cfc9a202680
refs/heads/master
2020-03-20T02:06:53.669181
2018-09-25T12:11:01
2018-09-25T12:11:01
137,096,721
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.600013017654419, "alphanum_fraction": 0.6229753494262695, "avg_line_length": 37.146400451660156, "blob_id": "8958ff5c35c659f6de8797fa9eb0d78957d914eb", "content_id": "974e0f022b4417e7254cdaa081f6c26bf08dfcc3", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 30746, "license_type": "no_license", "max_line_length": 211, "num_lines": 806, "path": "/source/src/package/src/actuation.py", "repo_name": "PabloGoEs85/plenaryRobocure", "src_encoding": "UTF-8", "text": "#!/usr/bin/env python\n#print(\"Python: Actuation node\")\nimport rospy\nimport random\nimport qi\nimport sys\nimport time\nimport os\n#import functools\nimport actionlib\nimport threading\n\nfrom package.srv import *\n\n#def play_video(session, url): \n#\ttry:\n#\t\tprint(\"Playing video... \" + url)\n #tabletService = session.service(\"ALTabletService\")\n #tabletService.enableWifi()\n #result = tabletService.playVideo(url)\n#\texcept Exception, e:\n#\t\tprint \"Error occured: \", e\n\n\n#def moveForward(session, speed):\n#\tx = 1.0\n#\ty = 0.0\n#\ttheta = 0.0\n#\ttry:\n#\t\tprint(\"Moving forwards\")\n#\t\tmoveService = session.service(\"ALMotion\")\n#\t\tmoveService.moveToward(x, y, theta, [[\"Frequency\", speed]])\n#\t\ttime.sleep(3)\n#\t\tmoveService.stopMove()\n#\texcept Exception, e:\n#\t\tprint \"Error occured: \", e\n#\n#def moveBack(session, speed):\n#\tx = 1.0\n#\ty = 0.0\n#\ttheta = -1.0\n#\ttry:\n#\t\tprint(\"Moving backwards\")\n#\t\tmoveService = session.service(\"ALMotion\")\n#\t\tmoveService.moveToward(x, y, theta, [[\"Frequency\", speed]])\n#\t\ttime.sleep(3)\n#\t\tmoveService.stopMove()\n#\texcept Exception, e:\n#\t\tprint \"Error occured: \", e\ndef proxemics(profile, peopleZone1, peopleZone2, peopleZone3):\n\n moveService = session.service(\"ALMotion\")\n proxemicsService = session.service (\"ALMemory\")\n\n if(profile == -1.0):\n if (len (peopleZone1) > 0):\n #idZone1 = str (peopleZone1[0])\n\n #coordsId1 = proxemicsService.getData (\"PeoplePerception/Person/\" + idZone1 + \"/PositionInRobotFrame\")\n\n x = -0.15\n y = 0.0\n theta = 0.0\n\n moveService.moveTo(x, y, theta)\n\n elif(profile == 1.0):\n if (len (peopleZone1) == 0 ):\n if (len (peopleZone2) == 0 ):\n if (len (peopleZone3) > 0 ):\n idZone3 = str (peopleZone3[0])\n\n coordsId3 = proxemicsService.getData (\"PeoplePerception/Person/\" + idZone3 + \"/PositionInRobotFrame\")\n #moveService.setExternalCollisionProtectionEnabled(\"Move\",False)\n x = 0.2\n y = (float)(coordsId3[1])/2\n\n theta = 0.0\n moveService.moveTo(x, y, theta)\n\n\n\n#speaks with animations\ndef speak(text, profile):\n global robotSpeaks\n if (profile ==-1.0): #fully introvert\n speed = 80\n volume = 0.5\n pitch = 0.9\n elif (profile == -0.5): #slightly introvert\n speed = 90\n volume = 0.6\n pitch = 0.9\n elif (profile == 0.0): #ambivert\n speed = 95\n volume = 0.65\n pitch = 1.0\n elif (profile == 0.5): #slightly extrovert\n speed = 102\n volume = 0.72\n pitch = 1.0\n elif (profile == 1.0): #fully extrovert\n speed = 110\n volume = 0.8\n pitch = 1.1\n\n try:\n #print(\"Saying... \" + text)\n #sayAnimatedService = session.service(\"ALAnimatedSpeech\")\n sayService = session.service(\"ALTextToSpeech\")\n\n sayService.setParameter(\"pitchShift\",pitch)\n sayService.setParameter(\"speed\",speed)\n #sayService.resetSpeed()\n sayService.setVolume(volume)\n sayAnimatedService = session.service(\"ALAnimatedSpeech\")\n\n aux = round(7*random.random ())\n if(profile == 1.0): #extrovert\n if(aux == 1.0):\n behavior = \"Stand/BodyTalk/Speaking/BodyTalk_1\"\n elif (aux == 2.0):\n behavior = \"Stand/BodyTalk/Speaking/BodyTalk_2\"\n elif (aux == 3.0):\n behavior = \"Stand/BodyTalk/Speaking/BodyTalk_3\"\n elif (aux == 4.0):\n behavior = \"Stand/BodyTalk/Speaking/BodyTalk_4\"\n elif (aux == 5.0):\n behavior = \"Stand/BodyTalk/Speaking/BodyTalk_5\"\n elif (aux == 6.0):\n behavior = \"Stand/BodyTalk/Speaking/BodyTalk_13\"\n else:\n behavior = \"Stand/BodyTalk/Speaking/BodyTalk_14\"\n\n elif (profile == 0.0): # ambivert\n if (aux == 1.0):\n behavior = \"Stand/BodyTalk/Speaking/BodyTalk_6\"\n elif (aux == 2.0):\n behavior = \"Stand/BodyTalk/Speaking/BodyTalk_2\"\n elif (aux == 3.0):\n behavior = \"Stand/BodyTalk/Speaking/BodyTalk_8\"\n elif (aux == 4.0):\n behavior = \"Stand/BodyTalk/Speaking/BodyTalk_4\"\n elif (aux == 5.0):\n behavior = \"Stand/BodyTalk/Speaking/BodyTalk_10\"\n elif (aux == 6.0):\n behavior = \"Stand/BodyTalk/Speaking/BodyTalk_13\"\n else:\n behavior = \"Stand/BodyTalk/Speaking/BodyTalk_12\"\n\n elif (profile == -1.0):#introvert\n if (aux == 1.0):\n behavior = \"Stand/BodyTalk/Speaking/BodyTalk_6\"\n elif (aux == 2.0):\n behavior = \"Stand/BodyTalk/Speaking/BodyTalk_7\"\n elif (aux == 3.0):\n behavior = \"Stand/BodyTalk/Speaking/BodyTalk_8\"\n elif (aux == 4.0):\n behavior = \"Stand/BodyTalk/Speaking/BodyTalk_9\"\n elif (aux == 5.0):\n behavior = \"Stand/BodyTalk/Speaking/BodyTalk_10\"\n elif (aux == 6.0):\n behavior = \"Stand/BodyTalk/Speaking/BodyTalk_11\"\n else:\n behavior = \"Stand/BodyTalk/Speaking/BodyTalk_12\"\n\n text = \"^start(\" + behavior + \") \" + text\n sayAnimatedService.say (text)\n print(text)\n #sayAnimatedService.say(\"hey there, I'm a social robot\")\n\n robotSpeaks = True\n except Exception, e:\n print \"Error occured: \", e\n\n#sets idle motion\ndef idleMotion(profile, finish):\n\n motion_service = session.service(\"ALMotion\")\n if(finish == True):\n print \"finishing idleMotion\"\n motion_service.setIdlePostureEnabled(\"Body\", False)\n motion_service.setIdlePostureEnabled(\"Arms\", False)\n motion_service.setIdlePostureEnabled(\"Head\", False)\n else:\n\n if(profile == -1.0): #fully introvert\n print \"idleMotion fully introvert. Breath\"\n motion_service.setBreathEnabled(\"Body\", False)\n motion_service.setBreathEnabled(\"Arms\", True)\n motion_service.setBreathEnabled(\"Head\", False)\n elif(profile == -0.5): #slightly introvert\n print \"idleMotion slightly introvert. Breath\"\n motion_service.setBreathEnabled(\"Body\", True)\n motion_service.setBreathEnabled(\"Arms\", True)\n motion_service.setBreathEnabled(\"Head\", False)\n elif(profile == 0.0): #ambivert\n print \"idleMotion ambivert. Breath\"\n motion_service.setBreathEnabled(\"Body\", True)\n motion_service.setBreathEnabled(\"Arms\", True)\n motion_service.setBreathEnabled(\"Head\", True)\n elif(profile == 0.5): #slightly extrovert\n print \"idleMotion slightly extrovert. Breath\"\n motion_service.setBreathEnabled(\"Body\", True)\n motion_service.setBreathEnabled(\"Arms\", True)\n motion_service.setBreathEnabled(\"Head\", True)\n elif(profile == 1.0): #fully extrovert\n print \"idleMotion fully extrovert. Breath\"\n motion_service.setBreathEnabled(\"Body\", True)\n motion_service.setBreathEnabled(\"Arms\", True)\n motion_service.setBreathEnabled(\"Head\", True)\n\n\n#tracks attention\ndef attentionTracker(profile, finish):\n #trackerService = session.service (\"ALTracker\")\n #targetName = \"Face\"\n #faceWidth = 0.1\n #trackerService.registerTarget (targetName, faceWidth)\n #trackerService.track (targetName)\n\n awarenessService = session.service(\"ALBasicAwareness\")\n if (finish == True):\n print \"finishing attentionTracker\"\n awarenessService.setEnabled(False) #for naoqi2.5\n#\t\tawarenessService.stopAwareness() #naoqi 2.1\n posture_service = session.service(\"ALRobotPosture\")\n posture_service.goToPosture(\"Crouch\", 0.7)\n else:\n if (profile == -1.0): #Fully introvert\n print \"attentionTracker fully introvert\"\n awarenessService.setParameter(\"LookStimulusSpeed\",0.1)\n awarenessService.setParameter(\"LookBackSpeed\",0.1)\n awarenessService.setStimulusDetectionEnabled(\"Sound\",False)\n awarenessService.setStimulusDetectionEnabled(\"Movement\",False)\n awarenessService.setStimulusDetectionEnabled(\"NavigationMotion\",False)\n awarenessService.setStimulusDetectionEnabled(\"TabletTouch\",False)\n awarenessService.setStimulusDetectionEnabled(\"Touch\",True)\n awarenessService.setStimulusDetectionEnabled(\"People\",True)\n awarenessService.setEngagementMode(\"FullyEngaged\")\n awarenessService.setTrackingMode(\"Head\")\n elif (profile == -0.5): #Slightly introvert\n print \"attentionTracker slighlty introvert\"\n awarenessService.setParameter(\"LookStimulusSpeed\",0.7)\n awarenessService.setParameter(\"LookBackSpeed\",0.7)\n awarenessService.setStimulusDetectionEnabled(\"Sound\",True)\n awarenessService.setStimulusDetectionEnabled(\"Movement\",False)\n awarenessService.setStimulusDetectionEnabled(\"NavigationMotion\",False)\n awarenessService.setStimulusDetectionEnabled(\"TabletTouch\",True)\n awarenessService.setStimulusDetectionEnabled(\"Touch\",True)\n awarenessService.setStimulusDetectionEnabled(\"People\",True)\n awarenessService.setEngagementMode(\"FullyEngaged\")\n awarenessService.setTrackingMode(\"BodyRotation\")\n elif (profile == 0.0): #Ambivert\n print \"attentionTracker ambivert\"\n awarenessService.resetAllParameters()\n #awarenessService.setParameter(\"LookStimulusSpeed\",0.5)\n #awarenessService.setParameter(\"LookBackSpeed\",0.5)\n #awarenessService.setStimulusDetectionEnabled(\"Sound\",True)\n #awarenessService.setStimulusDetectionEnabled(\"Movement\",True)\n #awarenessService.setStimulusDetectionEnabled(\"NavigationMotion\",False)\n awarenessService.setStimulusDetectionEnabled(\"TabletTouch\",False)\n #awarenessService.setStimulusDetectionEnabled(\"Touch\",True)\n #awarenessService.setStimulusDetectionEnabled(\"People\",True)\n #awarenessService.setEngagementMode(\"SemiEngaged\")\n #awarenessService.setTrackingMode(\"BodyRotation\")\n\n elif (profile == 0.5): #Slighlty Extrovert\n print \"attentionTracker slighlty extrovert\"\n awarenessService.setParameter(\"LookStimulusSpeed\",0.7)\n awarenessService.setParameter(\"LookBackSpeed\",0.7)\n awarenessService.setStimulusDetectionEnabled(\"Sound\",True)\n awarenessService.setStimulusDetectionEnabled(\"Movement\",True)\n awarenessService.setStimulusDetectionEnabled(\"NavigationMotion\",True)\n awarenessService.setStimulusDetectionEnabled(\"TabletTouch\",True)\n awarenessService.setStimulusDetectionEnabled(\"Touch\",True)\n awarenessService.setStimulusDetectionEnabled(\"People\",True)\n awarenessService.setEngagementMode(\"Unengaged\")\n awarenessService.setTrackingMode(\"BodyRotation\")\n\n elif (profile == 1.0): #Fully Extrovert\n print \"attentionTracker fully extrovert\"\n awarenessService.setParameter(\"LookStimulusSpeed\",1.0)\n awarenessService.setParameter(\"LookBackSpeed\",1.0)\n awarenessService.setStimulusDetectionEnabled(\"Sound\",True)\n awarenessService.setStimulusDetectionEnabled(\"Movement\",True)\n awarenessService.setStimulusDetectionEnabled(\"NavigationMotion\",True)\n awarenessService.setStimulusDetectionEnabled(\"TabletTouch\",False)\n awarenessService.setStimulusDetectionEnabled(\"Touch\",True)\n awarenessService.setStimulusDetectionEnabled(\"People\",True)\n awarenessService.setEngagementMode(\"Unengaged\")\n awarenessService.setTrackingMode(\"BodyRotation\")\n awarenessService.setTrackingMode(\"MoveContextually\")\n #trackerService.setMode(\"move\")\n awarenessService.setEnabled(True)\n\n\n#facialExpression\ndef facialExpression(emotionId, profile):\n facialExpressionService = session.service(\"ALLeds\")\n#\tfacialExpressionService.on(\"FaceLeds\")\n global colorLed\n global faceExpression\n if (emotionId == 1): #happyFace\n colorLed = \"green\"\n elif (emotionId == 2): #sadFace\n colorLed = \"blue\"\n elif (emotionId == 0): #neutralFace\n colorLed = \"white\"\n#\telif (emotionId == 3): #angerFace\n#\t\tcolorLed = \"red\"\n elif (emotionId == 4): #fearFace\n colorLed = \"yellow\"\n\n faceExpression = emotionId\n if(profile == -1.0): #fully introvert\n facialExpressionService.setIntensity(\"FaceLeds\",0.2)\n facialExpressionService.fadeRGB(\"FaceLeds\", colorLed, 1)\n wait = 0.75\n elif(profile == -0.5): #slightly introvert\n facialExpressionService.setIntensity(\"FaceLeds\",0.35)\n facialExpressionService.fadeRGB(\"FaceLeds\", colorLed, 1.25)\n wait = 1\n elif(profile == 0.0): #ambivert\n facialExpressionService.setIntensity(\"FaceLeds\",0.5)\n facialExpressionService.fadeRGB(\"FaceLeds\", colorLed, 1.5)\n wait = 1.25\n elif(profile == 0.5): #slightly extrovert\n facialExpressionService.setIntensity(\"FaceLeds\",0.7)\n facialExpressionService.fadeRGB(\"FaceLeds\", colorLed, 1.75)\n wait = 1.5\n elif(profile == 1.0): #fully extrovert\n facialExpressionService.setIntensity(\"FaceLeds\",0.2)\n facialExpressionService.fadeRGB(\"FaceLeds\", colorLed, 1)\n wait = 2\n #time.sleep(wait)\n colorLed = \"white\"\n facialExpressionService.fadeRGB(\"FaceLeds\", colorLed, 1)\n eyeBlinkingBehavior(profile) #as face expression has changed, it needs to update that info\n\n\n#eye blinking\ndef eyeBlinkingBehavior(profile):\n global gazeVariation\n global robotEngagedInTask\n global faceExpression\n global faceExpressionPrevious\n global robotSpeaks\n\n def blinkMorphology():\n def eyeBlinkCommand(duration, fullBlink, blinkType):\n print \"About to blink\"\n facialExpressionService = session.service(\"ALLeds\")\n facialExpressionService.on(\"FaceLeds\")\n global colorLed #does this work?\n\n result = facialExpressionService.fadeRGB(\"FaceLeds\", colorLed, 0.0)\n if (result == False):\n print \"problem coloring eyes\"\n if (fullBlink):\n groupLeds = \"FaceLeds\"\n else:\n groupLeds = \"FaceLedsTop\"\n\n for i in range(blinkType):\n result = facialExpressionService.fadeRGB(groupLeds, 0x000000, duration)\n if (result == False):\n print \"problem coloring eyes\"\n\n #_ledsProxy.fadeRGB(groupLeds, 0x000000, duration / 5. / 1000.); #blinking time shortened by a fourth for NAO as it has no eyelids to move and divided by 1000 to move from milliseconds to seconds\n #_ledsProxy.fadeRGB(\"FaceLeds\", _colorLed, 0.0);\n result = facialExpressionService.fadeRGB(\"FaceLeds\", colorLed, 0.0)\n if (result == False):\n print \"problem coloring eyes\"\n duration = 0.0\n aux = random.random()\n if(aux < 0.85): #Single blink\n blinkType = 1\n else:\n aux = random.random()\n if(aux < 0.8): #double blink\n blinkType = 2\n else: #triple blink\n blinkType = 3\n\n aux = random.random()\n\n if(aux < 0.91): #Full blink\n fullBlink = True\n #Blink duration with 432ms as mean and 72ms as standard deviation (random number between 360 ms and 504 ms)\n aux2 = random.randint(1,144)/100 # Base (0.36) + a value between the range of [0-144] which is the difference between 504ms and 360ms\n duration = 0.36 + aux2\n else: #half blink\n fullBlink = False\n #Blink duration with 266ms as mean and 4ms as standard deviation (random number between 262 ms and 270 ms)\n aux2 = random.randint(1,8)/100 # Base (0.262) + a value between the range of [0-8] which is the difference between 270ms and 262ms\n duration = 0.262+aux2\n\n #send eye blinking behavior\n eyeBlinkCommand(duration, fullBlink, blinkType)\n\n probabilityBlink = 0.0\n numberOcurrences = 0.0\n if(gazeVariation and robotEngagedInTask):\n probabilityBlink += 0.61\n numberOcurrences += 1\n gazeVariation = False\n\n elif(gazeVariation and not robotEngagedInTask):\n probabilityBlink += 0.72\n numberOcurrences += 1\n gazeVariation=False\n\n if ((faceExpression != 0)and(faceExpression != faceExpressionPrevious)):\n probabilityBlink += 0.285\n numberOcurrences += 1\n faceExpressionPrevious = faceExpression\n\n if (robotSpeaks):\n probabilityBlink += 0.31\n numberOcurrences += 1\n robotSpeaks = False\n\n aux = (numberOcurrences/50)\n if(numberOcurrences > 0):\n probabilityBlink = (probabilityBlink+aux)/(1.75+aux) #Probability normalize between 0 and 1. BlinkingRate = 1.75\n\n threshold = random.random()\n\n if (threshold < probabilityBlink):\n blinkMorphology()\n\n else:\n threshold2 = random.random()\n if(threshold2 > (0.5-(profile/5))):\n blinkMorphology()\n\n\n\ndef whenTouched(bodyPart): #associates a gesture to the touched body part\n facialExpression(1,profileFromAdapter) #happy face\n gesturesService = session.service (\"ALBehaviorManager\")\n if (bodyPart ==1): #left bumper\n if (profileFromAdapter > -0.1):\n aux = random.random()\n if (aux < 0.33):\n gesture = \"Stand/Gestures/BowShort_2\"\n elif (aux < 0.66):\n gesture = \"Stand/Gestures/BowShort_1\"\n else:\n gesture = \"Stand/Gestures/BowShort_3\"\n else:\n aux2 = random.random()\n if (aux2 < 0.5):\n gesture = \"Stand/Gestures/BowShort_1\"\n else:\n gesture = \"Stand/Gestures/BowShort_3\"\n\n elif (bodyPart ==2): #right bumper\n if (profileFromAdapter > -0.1):\n aux = random.random()\n if (aux < 0.25):\n gesture = \"Stand/Gestures/BowShort_2\"\n elif (aux < 0.5):\n gesture = \"Stand/Gestures/BowShort_1\"\n elif (aux < 0.75):\n gesture = \"Stand/Reactions/SeeSomething_8\"\n else:\n gesture = \"Stand/Gestures/BowShort_3\"\n else:\n aux2 = random.random()\n if (aux2 < 0.5):\n gesture = \"Stand/Gestures/BowShort_1\"\n else:\n gesture = \"Stand/Gestures/BowShort_3\"\n\n elif (bodyPart == 3): #head\n if (profileFromAdapter > 0.1):\n aux = random.random()\n if (aux < 0.25):\n gesture = \"Stand/Reactions/TouchHead_1\"\n elif (aux < 0.5):\n gesture = \"Stand/Reactions/TouchHead_2\"\n elif (aux < 0.75):\n gesture = \"Stand/Reactions/TouchHead_3\"\n else:\n gesture = \"Stand/Reactions/TouchHead_4\"\n elif (profileFromAdapter > -0.6):\n aux2 = random.random()\n if (aux2 < 0.33):\n gesture = \"Stand/Emotions/Negative/Surprise_1\"\n elif (aux2 < 0.66):\n gesture = \"Stand/Emotions/Neutral/Innocent_1\"\n else:\n gesture = \"Stand/Emotions/Negative/Surprise_2\"\n else:\n aux2 = random.random()\n if (aux2 < 0.33):\n gesture = \"Stand/Emotions/Neutral/Embarrassed_1\"\n elif (aux2 < 0.66):\n gesture = \"Stand/Emotions/Negative/Hurt_2\"\n else:\n gesture = \"Stand/Emotions/Positive/Shy_1\"\n elif (bodyPart == 4): #left hand\n if (profileFromAdapter < 0.1):\n aux2 = random.random()\n if (aux2 < 0.5):\n gesture = \"Stand/Reactions/SeeSomething_5\"\n else:\n gesture = \"Stand/BodyTalk/Listening/Listening_6\"\n else:\n aux2 = random.random()\n if (aux2 < 0.5):\n gesture = \"Stand/BodyTalk/Listening/Listening_1\"\n else:\n gesture = \"Stand/BodyTalk/Listening/Listening_6\"\n\n elif (bodyPart == 5): #right hand\n if (profileFromAdapter > -0.1):\n aux2 = random.random()\n if (aux2 < 0.33):\n gesture = \"Stand/BodyTalk/Listening/Listening_2\"\n elif (aux2 < 0.66):\n gesture = \"Stand/Reactions/SeeSomething_4\"\n else:\n gesture = \"Stand/BodyTalk/Listening/Listening_6\"\n\n elif (profileFromAdapter > -0.9):\n aux2 = random.random()\n if (aux2 < 0.33):\n gesture = \"Stand/Reactions/SeeSomething_5\"\n elif(aux2 < 0.66):\n gesture = \"Stand/BodyTalk/Listening/Listening_5\"\n else:\n gesture = \"Stand/BodyTalk/Listening/Listening_6\"\n else:\n aux2 = random.random()\n if (aux2 < 0.5):\n gesture = \"Stand/Reactions/SeeSomething_6\"\n else:\n gesture = \"Stand/BodyTalk/Listening/Listening_6\"\n\n result = gesturesService.runBehavior(gesture)\n if (result == False):\n print \"running gesture failed\"\n\n facialExpression(0,profileFromAdapter)\n\n\ndef readSensors():\n global finish\n global profileFromAdapter\n\n peopleService = session.service(\"ALPeoplePerception\")\n peopleService.subscribe(\"forPeople\")\n\n engagementService = session.service(\"ALEngagementZones\")\n engagementService.subscribe(\"forEngagement\")\n\n engagementService.setFirstLimitDistance(0.5)\n engagementService.setSecondLimitDistance(2)\n engagementService.setLimitAngle(30)\n\n\n try:\n memoryService = session.service(\"ALMemory\")\n #memoryService.raiseEvent(\"EngagementZones/PersonApproached\", \"\")\n #memoryService.raiseEvent(\"EngagementZones/PersonMovedAway\", \"\")\n\n except Exception:\n print \"Error when creating memory proxy:\"\n\n while (not finish):\n\n someoneZone1 = memoryService.getData(\"EngagementZones/PeopleInZone1\")\n someoneZone2 = memoryService.getData(\"EngagementZones/PeopleInZone2\")\n someoneZone3 = memoryService.getData(\"EngagementZones/PeopleInZone3\")\n proxemics (profileFromAdapter, someoneZone1, someoneZone2, someoneZone3)\n\n leftBumperTouched = 0\n leftBumperTouched = memoryService.getData(\"LeftBumperPressed\")\n if (leftBumperTouched > 0.5):\n whenTouched(1)\n print \"Left bumper touched\"\n\n rightBumperTouched = 0\n rightBumperTouched = memoryService.getData(\"RightBumperPressed\")\n if (rightBumperTouched > 0.5):\n whenTouched(2)\n print \"Right bumper touched\"\n\n leftHandTouched = 0\n leftHandTouched = memoryService.getData(\"HandLeftBackTouched\")\n if (leftHandTouched > 0.5):\n whenTouched(4)\n print \"Left hand touched\"\n\n rightHandTouched = 0\n rightHandTouched = memoryService.getData(\"HandRightBackTouched\")\n if (rightHandTouched > 0.5):\n whenTouched(5)\n print \"Right hand touched\"\n\n headTouched = 0\n headFrontTouched = memoryService.getData(\"FrontTactilTouched\")\n headMiddleTouched = memoryService.getData(\"MiddleTactilTouched\")\n headBackTouched = memoryService.getData(\"RearTactilTouched\")\n if ((headFrontTouched > 0.5)or(headMiddleTouched > 0.5)or(headBackTouched > 0.5)):\n whenTouched(3)\n print \"Head touched\"\n\n\ndef startIdle():\n global finish\n global profileFromAdapter\n\n global faceExpressionPrevious\n global gazeVariation\n global robotEngagedInTask\n global faceExpression\n global robotSpeaks\n global finish\n global colorLed\n\n colorLed = \"white\"\n finish = False\n faceExpressionPrevious = 0\n gazeVariation = False\n robotEngagedInTask = False\n faceExpression = 0\n robotSpeaks = False\n\n posture_service = session.service(\"ALRobotPosture\")\n if (posture_service.getPostureFamily() != \"Standing\"):\n posture_service.goToPosture(\"StandInit\", 0.25)\n\n def setIdleBehavior(profile, finishValue):\n\n attentionTracker(profile, finishValue)\n idleMotion(profile, finishValue)\n\n #set idle behaviors ON\n setIdleBehavior(profileFromAdapter, finish)\n\n while(not finish):\n eyeBlinkingBehavior(profileFromAdapter)\n time.sleep(4)\n\n #set idle behaviors OFF\n setIdleBehavior(profileFromAdapter, finish)\n\ndef readMemoryEventsFromQuiz(profile):\n memoryEventsService = session.service(\"ALMemory\")\n memoryEventsService.raiseEvent (\"QuestionQuiz\", \"\")\n memoryEventsService.raiseEvent (\"FaceFeedback\", \"0\")\n newSentence = memoryEventsService.getData (\"QuestionQuiz\")\n newColorFace = memoryEventsService.getData (\"FaceFeedback\")\n #speak (newSentence, profile)\n previousSentence = newSentence\n previousColorFace = newColorFace\n #print \"Gotten from memory \" + newSentence\n while(True):\n newColorFace = memoryEventsService.getData (\"FaceFeedback\")\n if (newColorFace != previousColorFace):\n print\n \"color face\" + newColorFace\n facialExpression (int (newColorFace), profile)\n previousColorFace = newColorFace\n\n newSentence = memoryEventsService.getData (\"QuestionQuiz\")\n if (newSentence != previousSentence):\n print \"Gotten from memory \" + newSentence\n speak(newSentence,profile)\n previousSentence = newSentence\n\n\n\ndef scriptManager(): #manages the script\n global quizFromGUI\n global profileFromAdapter\n if (quizFromGUI == 0): #Brussels\n script = \"quizExtrovert2-247899/behavior_1\"\n elif (quizFromGUI == 1): #Chocolate\n script = \"quizIntrovert2-247898/behavior_1\"\n elif (quizFromGUI == 2): #WorldCup\n script = \"quizNeutral-247555/behavior_1\"\n\n print \"Script Manager %d\" %quizFromGUI\n behaviorService = session.service(\"ALBehaviorManager\")\n behaviorService.runBehavior(script)\n #time.sleep(5)\n #memoryEventsService = session.service (\"ALMemory\")\n #newSentence = memoryEventsService.getData (\"QuestionQuiz\")\n #print \"Gotten from memory \" + newSentence\n readMemoryEventsFromQuiz(profileFromAdapter)\n\n#def sendQuestionnaire(request):\n\n#\treturn QuestionnaireResponse(entry1,entry2,entry3,entry4,entry5,entry6,entry7,entry8,entry9,entry10,entry11,entry12,entry13,entry14,entry15,flag,entryId)\n\ndef main(session):\n global finish\n global profileFromAdapter\n global flagFromAdapter\n global quizFromGUI\n\n def sendQuestionnaire(request):\n\n return QuestionnaireResponse(q1,q2,q3,q4,q5,q6,q7,q8,q9,q10,q11,q12,quizFromGUI,0)\n def startsSystem():\n global flagFromAdapter\n global profileFromAdapter\n print \"launches system\"\n rospy.wait_for_service('adapterPersonality')\n try:\n profileClient = rospy.ServiceProxy('adapterPersonality', Personality)\n profile = profileClient()\n profileFromAdapter = profile.personality_profile\n flagFromAdapter = profile.flag_profile\n print \"Actuation got profile: %s\"%profileFromAdapter\n except rospy.ServiceException as e:\n print \"profile call failed: %s\"%e\n\n #\tmemoryService = session.service(\"ALMemory\")\n #\tmemoryService.insertData(\"UserProfile\", profileFromAdapter)\n #thread to run idle behaviors\n tIdle = threading.Thread(target=startIdle)\n tIdle.start()\n\n #thread to receive tasks + finish flag from interface\n tScript = threading.Thread(target=scriptManager)\n tScript.start()\n\n #thread to listen to sensory information\n tSensorsWhile = threading.Thread(target=readSensors)\n tSensorsWhile.start()\n\n\n rospy.init_node('actuation')\n\n rospy.wait_for_service('GUICommand') #controls script\n try:\n guiClient = rospy.ServiceProxy('GUICommand', GUICommand)\n guiCommand = guiClient()\n commandFromGUI = guiCommand.command_response\n quizFromGUI = guiCommand.command_quiz\n print \"command...\"\n if (commandFromGUI == 1): #launches personality quiz\n print \"launches quiz actuation\"\n behaviorService = session.service(\"ALBehaviorManager\")\n#\t\t\tbehaviorService.stopAllBehaviors()\n behaviorService.runBehavior(\"personalityquiz-247837/behavior_1\")\n time.sleep(3)\n #control if we have reached the end of the quiz\n memoryService = session.service(\"ALMemory\")\n memoryService.insertData(\"PQFinish\", 0)\n stillRunningQuiz = memoryService.getData(\"PQFinish\")\n\n #reads variable PersonalityQuizFinished in memory, keeps reading until True\n while (stillRunningQuiz == 0):\n #\tnotFinished = True\n print \"still running\"\n time.sleep(3)\n stillRunningQuiz = memoryService.getData(\"PQFinish\")\n\n print \"finished\"\n memoryService.insertData(\"PQFinish\", 0)\n #reads info from memory and sends it back to gui\n q1 = int(memoryService.getData(\"q1\"))\n q2 = int(memoryService.getData(\"q2\"))\n q3 = int(memoryService.getData(\"q3\"))\n q4 = int(memoryService.getData(\"q4\"))\n q5 = int(memoryService.getData(\"q5\"))\n q6 = int(memoryService.getData(\"q6\"))\n q7 = int(memoryService.getData(\"q7\"))\n q8 = int(memoryService.getData(\"q8\"))\n q9 = int(memoryService.getData(\"q9\"))\n q10 = int(memoryService.getData(\"q10\"))\n q11 = int(memoryService.getData(\"q11\"))\n q12 = int(memoryService.getData(\"q12\"))\n\n print \"q1 %d\" %q1\n\n srvActuationToGUIServer = rospy.Service('questionnaire', Questionnaire, sendQuestionnaire)\n startsSystem()\n elif (commandFromGUI == 2): #starts system\n startsSystem()\n elif (startCommandFromGUI == 3): #stops system\n finish = True\n except rospy.ServiceException as e:\n print \"profile call failed: %s\"%e\n\n\n rospy.spin()\n\nif __name__ == \"__main__\":\n try:\n print(\"Connecting to naoqi...\")\n session = qi.Session()\n robotIp = os.environ.get(\"ROBOT_IP\")\n session.connect(\"tcp://\" + robotIp + \":9559\")\n print('Connected to naoqi')\n except RuntimeError:\n print (\"Cannot connect to naoqi\")\n #\tsys.exit(1)\n main(session)\n" }, { "alpha_fraction": 0.7267774939537048, "alphanum_fraction": 0.7649082541465759, "avg_line_length": 33.880001068115234, "blob_id": "0d302032ea56bd3449c04658a7f72cba7dfdf3ca", "content_id": "2d064797e393dbdda8a07b0aae7b9d771a71b438", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3488, "license_type": "no_license", "max_line_length": 129, "num_lines": 100, "path": "/source/src/package/src/adapter.py", "repo_name": "PabloGoEs85/plenaryRobocure", "src_encoding": "UTF-8", "text": "#!/usr/bin/env python\n#print(\"Python: Adapter node\")\nimport rospy\nimport actionlib\nimport sys\nimport random\nimport time\nimport os\nfrom threading import Thread\n#from package.msg import *\nfrom package.srv import *\n\ndef sendPersonality(request):\n\tglobal personality\n\tglobal personality_profile\n\t#depending on the mode we choose\n\t#12-26 full introvert; 27-41 slightly introvert; 42-54 ambivert ;55-69 slighlty extrovert ; 70-84 full extrovert\n\t\n\t#extraversion + agreeableness\n\tif (personality <= 26):\n\t\tpersonality_profile = -1.0 #full introvert\n\telif (personality <= 41): #slightly introvert\n\t\tpersonality_profile = -0.5\n\telif (personality <= 54):\n\t\tpersonality_profile = 0.0 #ambivert\n\telif (personality <= 69):\n\t\tpersonality_profile = 0.5 #slightly extrovert\n\telse:\n\t\tpersonality_profile = 1.0 #full extrovert\n\n\tif (flag == 2): #complementary\n\t\tif (personality_profile !=0.0):\n\t\t\tpersonality_profile = personality_profile*(-1)\n\t\telse:\n\t\t\trandPersonality = random.randint(1,2) #if 2, it stays as ambivert. If 1, randomizes between fully extrovert or fully introvert\n\t\t\tif (randPersonality == 1):\n\t\t\t\trandFully = random.randint(1,2)\n\t\t\t\tif (randFully == 1):\n\t\t\t\t\tpersonality_profile = 1.0 #full extrovert\n\t\t\t\telse:\n\t\t\t\t\tpersonality_profile = -1.0 #full introvert\t\n\tflag_profile = flag\n\t#personality_profile = 1.0 #testing purposes\n\n\treturn PersonalityResponse(personality_profile, flag_profile)\n\ndef main():\n\tglobal personality\n\tglobal flag\n\trospy.init_node(\"adapter\")\n\trospy.wait_for_service('questionnaire')\n\ttry:\n\t\t#Gets data from service sent (my case I will need to get responses from questionnaire)\n\t\tquestionnaireClient = rospy.ServiceProxy('questionnaire', Questionnaire)\n\t\tquestionnaireToProfile = questionnaireClient()\t\t\n\t\tquestion1 = questionnaireToProfile.q1_response #E1\n\t\tquestion2 = questionnaireToProfile.q2_response #E2\n\t\tquestion3 = 8-questionnaireToProfile.q3_response #E3*\n\t\tquestion4 = questionnaireToProfile.q4_response #E4\n\t\tquestion5 = 8-questionnaireToProfile.q5_response #E5*\n\t\tquestion6 = 8-questionnaireToProfile.q6_response #E6*\n\t\tquestion7 = questionnaireToProfile.q7_response #A1\n\t\tquestion8 = 8-questionnaireToProfile.q8_response #A2*\n\t\tquestion9 = 8-questionnaireToProfile.q9_response #A3*\n\t\tquestion10 = 8-questionnaireToProfile.q10_response #A4*\n\t\tquestion11 = questionnaireToProfile.q11_response #A5\n\t\tquestion12 = questionnaireToProfile.q12_response #A6\n\t\tpersonalityFromGUI = questionnaireToProfile.personality_response \n\t\tflag = questionnaireToProfile.flag_response\n\n\texcept rospy.ServiceException, e:\n\t\tprint \"Service call failed: %s\"%e\n\n\n\tif (personalityFromGUI == 0):\n\t\t#compute personality + send profile to actuation and reactive\n\t\textraversion = question1+question2+question3+question4+question5+question6\n\t#\tneuroticism = question2+ question7+question12\n\t#\topenness = question3+question8+question13\n\t#\tconscientiousness = question4+question9+question14\n\t\tagreeableness = question7+question8+question9+question10+question11+question12\n\n\t#\tpersonality = extraversion + neuroticism + openness + conscientiousness + agreeableness\n\t\tpersonality = extraversion + agreeableness\n\t\tprint \"extraversion %s\"%extraversion\n\t\tprint \"agreeableness %s\"%agreeableness\n\telse:\n\t\tpersonality = personalityFromGUI\n\tprint \"personality %s\"%personality\n\tprint \"flag %s\"%flag\n\n\t#send profile to actuation\n\tsrvAdapterActuationServer = rospy.Service('adapterPersonality', Personality, sendPersonality)\n\n\ttime.sleep(5)\n\trospy.spin()\n\n\nif __name__ == \"__main__\":\n main()\n" }, { "alpha_fraction": 0.657077968120575, "alphanum_fraction": 0.7024980783462524, "avg_line_length": 25.314741134643555, "blob_id": "83b6623158dc4941140bfe56d81d4bb2d7e45760", "content_id": "36c386ed147736b1f9fe652b5f1ca1db1723d9bb", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 6605, "license_type": "no_license", "max_line_length": 143, "num_lines": 251, "path": "/source/src/package/src/gui.py", "repo_name": "PabloGoEs85/plenaryRobocure", "src_encoding": "UTF-8", "text": "#!/usr/bin/env python2.7\nimport rospy\nfrom Tkinter import *\nfrom package.srv import *\n\ndef launchSystem():\n\tglobal CKsimilarity\n\tdef sendQuestionnaire(request): #Gets responses from GUI and sends them to Adapter (including hard-coded personality)\n\t\tglobal e1\n\t\tglobal e2\n\t\tglobal e3\n\t\tglobal e4\n\t\tglobal e5\n\t\tglobal e6\n\t\tglobal e7\n\t\tglobal e8\n\t\tglobal e9\n\t\tglobal e10\n\t\tglobal e11\n\t\tglobal e12\n\t\tglobal CKsimilarity\n\n\t\tentry1 = int(e1.get())\n\t\tentry2 = int(e2.get())\n\t\tentry3 = int(e3.get())\n\t\tentry4 = int(e4.get())\n\t\tentry5 = int(e5.get())\n\t\tentry6 = int(e6.get())\n\t\tentry7 = int(e7.get())\n\t\tentry8 = int(e8.get())\n\t\tentry9 = int(e9.get())\n\t\tentry10 = int(e10.get())\n\t\tentry11 = int(e11.get())\n\t\tentry12 = int(e12.get())\n\n\t\tflag = int(CKsimilarity.get())\n\t\tpersonality = int(ePersonality.get())\n\n\t\treturn QuestionnaireResponse(entry1,entry2,entry3,entry4,entry5,entry6,entry7,entry8,entry9,entry10,entry11,entry12,flag,personality)\n\t\n\t\n\tdef sendCommand(command_request):\n\t\tglobal tabletDone\n\t\tglobal eID\n\t\tglobal ePersonality\n\t\tif(tabletDone):\n\t\t\tcommand_response = 2 #start system\n\t\t\t#print \"tabletDone\"\t\n\t\telse: \n\t\t\t#print \"tabletDone FALSE\"\n\t\t\tcommand_response = 1 #initiates personality quiz\n\t\t\t#tabletDone = True\n\t\tcommand_quiz = int(eID.get())\n\n\t\treturn GUICommandResponse(command_response, command_quiz)\n\t\n\tglobal paperBased\n\tglobal tabletDone\n \t\n\n\t#disables Q1 to Q15, CBtablet, CBsimilarity and ID\n\teditEntries('disabled')\n\n\n\tif (paperBased):\n\t\t#print \"paperBased\"\n\t\tsrvGUIAdapterServer = rospy.Service('questionnaire', Questionnaire, sendQuestionnaire)\n\t\ttabletDone = True\n\t\tsrvGUIActuationServer = rospy.Service('GUICommand', GUICommand, sendCommand)\n\telse: \n\t\t#print \"paperBased FALSE\"\n\t\ttabletDone = False\n\t\tsrvGUIActuationServer = rospy.Service('GUICommand', GUICommand, sendCommand)\n\t\t#then sets tabletDone = True and calls again\n\t\t#tabletDone = True\n#\t\tsrvGUIActuationServer = rospy.Service('GUIcommand', StartStop, sendCommand)\ndef editEntries(status):\n\tglobal e1\n\tglobal e2\n\tglobal e3\n\tglobal e4\n\tglobal e5\n\tglobal e6\n\tglobal e7\n\tglobal e8\n\tglobal e9\n\tglobal e10\n\tglobal e11\n\tglobal e12\n\n\te1.pack_forget()\n\te1.config(state=status)\n\te1.grid(row=0, column=1)\n\n\te2.pack_forget()\n\te2.config(state=status)\t\t\n\te2.grid(row=1, column=1)\n\n\te3.pack_forget()\n\te3.config(state=status)\n\te3.grid(row=2, column=1)\t\t\n\n\te4.pack_forget()\n\te4.config(state=status)\n\te4.grid(row=3, column=1)\n\n\te5.pack_forget()\n\te5.config(state=status)\n\te5.grid(row=4, column=1)\n\n\te6.pack_forget()\n\te6.config(state=status)\n\te6.grid(row=5, column=1)\n\n\te7.pack_forget()\n\te7.config(state=status)\n\te7.grid(row=6, column=1)\n\n\te8.pack_forget()\n\te8.config(state=status)\n\te8.grid(row=7, column=1)\n\n\te9.pack_forget()\n\te9.config(state=status)\n\te9.grid(row=8, column=1)\n\n\te10.pack_forget()\n\te10.config(state=status)\n\te10.grid(row=9, column=1)\t\n\n\te11.pack_forget()\n\te11.config(state=status)\n\te11.grid(row=10, column=1)\n\n\te12.pack_forget()\n\te12.config(state=status)\n\te12.grid(row=11, column=1)\n\ndef tabletVSpaper():\n\t#disables CBtablet from now on\n\tglobal CBtablet\n\tglobal paperBased\n\n\tif (CBtablet.get()==1): #tablet --> launches personality quiz (via actuation?)\n\t\teditEntries('disabled')\n\t\tpaperBased = False\n\t\ttabletDone = False\n\telif (CBtablet.get()==2): #paper --> enables questions + similar/complementary + go button\n\t\tpaperBased = True\t\n\t\teditEntries('normal')\n\t\n\ndef main():\t\n\tglobal CBtablet\n\tglobal CKsimilarity\t\n\tglobal e1\n\tglobal e2\n\tglobal e3\n\tglobal e4\n\tglobal e5\n\tglobal e6\n\tglobal e7\n\tglobal e8\n\tglobal e9\n\tglobal e10\n\tglobal e11\n\tglobal e12\n\tglobal eID\n\tglobal ePersonality\n\n\trospy.init_node(\"gui\")\n\twindow = Tk()\n\tCKsimilarity = IntVar()\n\tCKsimilarity.set(0)\t\n\tCBtablet = IntVar()\t\n\tCBtablet.set(0)\n\twindow.title('Robot Quiz')\n\twidthScreen = window.winfo_screenwidth()\n\theightScreen = window.winfo_screenheight()\n\twindow.attributes(\"-fullscreen\", False)#full screen disavantage:toolbar disappear\n\n\t##### TEXT #####\n\tframeUpL = Frame(window,width = int(0.2*widthScreen),height = int(0.2*heightScreen))\n\tframeUpL.grid(row = 0, column = 0)\n\tframeUpL.pack_propagate(False)\n\t#fieldLabel = Label(frameUpL,text=\"Personality Test input\",font = ('',int(20.0/768.0*heightScreen), \"bold\"),wraplength = int(0.2*widthScreen))\n\t#fieldLabel.pack()\n\n\tLabel(frameUpL, text=\"Q1\").grid(row=0, column=0)\n\tLabel(frameUpL, text=\"Q2\").grid(row=1, column=0)\t\n\tLabel(frameUpL, text=\"Q3\").grid(row=2, column=0)\t\n\tLabel(frameUpL, text=\"Q4\").grid(row=3, column=0)\n\tLabel(frameUpL, text=\"Q5\").grid(row=4, column=0)\n\tLabel(frameUpL, text=\"Q6\").grid(row=5, column=0)\n\tLabel(frameUpL, text=\"Q7\").grid(row=6, column=0)\n\tLabel(frameUpL, text=\"Q8\").grid(row=7, column=0)\n\tLabel(frameUpL, text=\"Q9\").grid(row=8, column=0)\n\tLabel(frameUpL, text=\"Q10\").grid(row=9, column=0)\n\tLabel(frameUpL, text=\"Q11\").grid(row=10, column=0)\n\tLabel(frameUpL, text=\"Q12\").grid(row=11, column=0)\n\n\te1 = Entry(frameUpL, text=\"2\")\n\te2 = Entry(frameUpL, text=\"2\")\n\te3 = Entry(frameUpL, text=\"2\")\n\te4 = Entry(frameUpL, text=\"2\")\n\te5 = Entry(frameUpL, text=\"2\")\n\te6 = Entry(frameUpL, text=\"2\")\n\te7 = Entry(frameUpL, text=\"2\")\n\te8 = Entry(frameUpL, text=\"2\")\n\te9 = Entry(frameUpL, text=\"2\")\n\te10 = Entry(frameUpL, text=\"2\")\n\te11 = Entry(frameUpL, text=\"2\")\n\te12 = Entry(frameUpL, text=\"2\")\n\n\teID = Entry(frameUpL, text=\"3\")\n\teID.grid(row=4, column=3)\n\n\tePersonality = Entry(frameUpL, text=\"0\")\n\tePersonality.grid(row=8, column=3)\n\n\teditEntries('disabled')\n\t\n\tRadiobutton(frameUpL, variable=CBtablet, value = 1, text=\"Tablet\", command=tabletVSpaper).grid(row=2, column=2)\n\tRadiobutton(frameUpL, variable=CBtablet, value = 2, text=\"Paper\", command=tabletVSpaper).grid(row=3, column=2)\n\tLabel(frameUpL, text=\"Quiz ID\").grid(row=4, column=2)\n\n\tRadiobutton(frameUpL, variable=CKsimilarity, value = 0, text=\"Neutral\").grid(row=5, column=2)\n\tRadiobutton(frameUpL, variable=CKsimilarity, value = 1, text=\"Similar\").grid(row=6, column=2)\n\tRadiobutton(frameUpL, variable=CKsimilarity, value = 2, text=\"Complementary\").grid(row=7, column=2)\n\n\tLabel(frameUpL, text=\"Personality\").grid(row=8, column=2)\n\n\n\tframeDoR = Frame(window,width = int(0.2*widthScreen),height = int(0.2*heightScreen))\n\tframeDoR.grid(row = 0, column = 1)\n\tframeDoR.pack_propagate(False)\n\t\n ##### BUTTON #####\n\tbutton = Button(frameDoR,text = \"Next\",font = ('',int(15.0/768.0*heightScreen), \"bold\"),\\\n command=launchSystem,width = int(0.01*widthScreen),height = int(0.001*heightScreen))\n\tbutton.pack(side = \"bottom\")\n\n ##### GRAPHICAL INTERFACE + ROBOT BEHAVIOR TOGETHER #####\n\twindow.update_idletasks()\n\twindow.update()\n\n\twindow.mainloop()\n\trospy.spin()\n\nif __name__ == \"__main__\":\n main()\n" } ]
3
pacey621/MyFile
https://github.com/pacey621/MyFile
a8cd3dc89dc9b2a6299f9a3a393a58c0f4e002de
90b3902acfcc70f4ced5254d899029b3a63a42f4
e0bf09e2706ca455ad845e3f3c79646fd6777367
refs/heads/master
2021-01-19T11:46:16.392159
2017-10-21T13:21:08
2017-10-21T13:21:08
87,996,040
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.4578706622123718, "alphanum_fraction": 0.47942522168159485, "avg_line_length": 33.79545593261719, "blob_id": "1f99b188fc624221f80f554cf8250bbb85cb7232", "content_id": "5c8ae2e4f8a7de42f8bf373c27c8865048ca7013", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1539, "license_type": "no_license", "max_line_length": 95, "num_lines": 44, "path": "/Python3获取Oracle的alert日志和listener日志关键信息/7days_of_listener.py", "repo_name": "pacey621/MyFile", "src_encoding": "UTF-8", "text": "import os\nimport datetime\nListenerLogFile = r'listener.log'\nMonthList = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul','Aug', 'Sep', 'Oct', 'Nov', 'Dec']\ni=0\ncnt=0\nINFO_ListenerLogFile = r'INFO_listener.log'\nnow = datetime.datetime.now()\n\ntry:\n with open(ListenerLogFile,'r') as f:\n list_allline = f.readlines()\n rowcount=len(list_allline)\n f.seek(0,0)\n\n if os.path.exists(os.getcwd() + '\\\\' + INFO_ListenerLogFile):\n os.remove(os.getcwd() + '\\\\' + INFO_ListenerLogFile)\n with open(INFO_ListenerLogFile, 'a') as f1:\n while i < rowcount:\n i = i + 1\n line = f.readline()\n\n\n if line[4:8] in MonthList:\n line_date = datetime.datetime.strptime(line[0:24], \"%a %b %d %X %Y\")\n elif '月 -' in str(line[0:20]):\n line_date = datetime.datetime.strptime(line[0:20], \"%d-%m月 -%Y %X\")\n #print(line[0:20])\n elif '月-' in str(line[0:20]):\n line_date = datetime.datetime.strptime(line[0:20], \"%d-%m月-%Y %X\")\n #print(line[0:20])\n else:\n continue\n\n if len(line) > 1 and 'CONNECT_DATA=' in line and (now-line_date).days < 7:\n #if 'CONNECT_DATA=' in line:\n cnt = cnt + 1\n #print(line)\n for t in line:\n f1.write(t)\n print(cnt)\n\nexcept Exception as err:\n\tprint(err)\n" }, { "alpha_fraction": 0.48557692766189575, "alphanum_fraction": 0.49639421701431274, "avg_line_length": 28.714284896850586, "blob_id": "9f7ecfe2c1d44a3b5be8c0942720ba977abb6df1", "content_id": "85f6c8b530257961f26437e5119135070f8a663b", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 832, "license_type": "no_license", "max_line_length": 69, "num_lines": 28, "path": "/Python3获取Oracle的alert日志和listener日志关键信息/info_of_listener.py", "repo_name": "pacey621/MyFile", "src_encoding": "UTF-8", "text": "import os\nListenerLogFile = r'listener.log'\ni=0\ncnt=0\nINFO_ListenerLogFile = r'INFO_listener.log'\n\ntry:\n with open(ListenerLogFile,'r') as f:\n list_allline = f.readlines()\n rowcount=len(list_allline)\n f.seek(0,0)\n\n if os.path.exists(os.getcwd() + '\\\\' + INFO_ListenerLogFile):\n os.remove(os.getcwd() + '\\\\' + INFO_ListenerLogFile)\n with open(INFO_ListenerLogFile, 'a') as f1:\n while i < rowcount:\n i = i + 1\n line = f.readline()\n if len(line) > 1 and 'CONNECT_DATA=' in line:\n #if 'CONNECT_DATA=' in line:\n cnt = cnt + 1\n #print(line)\n for t in line:\n f1.write(t)\n print(cnt)\n\nexcept Exception as err:\n\tprint(err)\n" }, { "alpha_fraction": 0.48498404026031494, "alphanum_fraction": 0.49456867575645447, "avg_line_length": 33, "blob_id": "130398f322917a232c2ea3c793406fc625a52188", "content_id": "24ca71a24388668c690a5eb48176bed47790a1e3", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1587, "license_type": "no_license", "max_line_length": 101, "num_lines": 46, "path": "/Python3获取Oracle的alert日志和listener日志关键信息/info_of_alert.py", "repo_name": "pacey621/MyFile", "src_encoding": "UTF-8", "text": "import os\nDayList = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']\n#KeyWordList = ['ORA-', 'Error', 'Starting ORACLE instance', 'Shutting down instance','TNS-','ALTER']\nKeyWordList = ['ORA-', 'Error','TNS-','ALTER']\nAlertLogFile = r'alert_orcl.log'\ni=0\nlist_linenum=[]\nlinenum=0\nj=0\nINFO_AlertLogFile = r'INFO_alert_orcl.log'\n\ntry:\n with open(AlertLogFile,'r') as f:\n list_allline = f.readlines()\n rowcount=len(list_allline)\n\n while i < rowcount:\n line = list_allline[i]\n if len(line) == 25 and line[0:3] in DayList:\n linenum = i\n list_linenum.append(linenum)\n i = i + 1\n #print(list_linenum)\n if os.path.exists(os.getcwd() + '\\\\'+INFO_AlertLogFile):\n os.remove(os.getcwd() + '\\\\'+INFO_AlertLogFile)\n with open(INFO_AlertLogFile, 'a') as f1:\n while j < len(list_linenum)-1:\n list_temp = list_allline[list_linenum[j]:list_linenum[j+1]]\n for w in KeyWordList:\n if w in str(list_temp):\n #print(list_temp)\n for t in list_temp:\n f1.write(t)\n f1.write('\\n')\n j = j + 1\n\n #最后一条有问题如何处理\n list_temp = list_allline[list_linenum[j]:]\n for w in KeyWordList:\n if w in str(list_temp):\n # print(list_temp)\n for t in list_temp:\n f1.write(t)\n\nexcept Exception as err:\n\tprint(err)\n\n" } ]
3
Koushik1994/RockPaperScissor
https://github.com/Koushik1994/RockPaperScissor
a2224377e7b6acfe274a366e12bb8b3780ddad22
aacf102b44cb05cf50891fd1b470b37633a4923a
fb3820a99ad3ea796dcf19e57c5836a7c6e43e7e
refs/heads/master
2021-01-09T12:32:28.452254
2020-02-22T08:04:57
2020-02-22T08:04:57
242,301,649
1
0
null
null
null
null
null
[ { "alpha_fraction": 0.6065359711647034, "alphanum_fraction": 0.6228758096694946, "avg_line_length": 20.54929542541504, "blob_id": "b58697d3cf58b5212a3c5a94305b38b516067436", "content_id": "b7cb52adb6bda6495f818a8b420b6060ac024ef7", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1530, "license_type": "no_license", "max_line_length": 72, "num_lines": 71, "path": "/RPS.py", "repo_name": "Koushik1994/RockPaperScissor", "src_encoding": "UTF-8", "text": "import random\n\nUSER = 0\nCOMPUTER = 1\nDRAW = 2\nmoves = [\"rock\", \"paper\", \"scissor\"]\ncomputer_points = 0\nuser_points = 0\n\n\ndef get_winner(user, computer):\n if user == computer:\n return DRAW\n # User plays rock and computer plays scissor\n elif user == 0 and computer == 2:\n return USER\n # User plays paper and computer plays rock\n elif user == 1 and computer == 0:\n return USER\n # User plays scissor and computer plays paper\n elif user == 2 and computer == 1:\n return USER\n else:\n return COMPUTER\n \ndef play(user_input):\n \n # generates 0 or 1 or 2 \n rand_index = random.randint(0,2);\n print(\"User played : \", moves[user_input])\n print(\"Computer played : \", moves[rand_index])\n \n return get_winner(user_input, rand_index);\n\nresult = [\"User won!\", \"Computer won!\", \"It was a draw!\"]\ndef driver(user_played):\n \n user_input = user_played\n user_id = 0;\n if user_input == \"rock\":\n user_id = 0\n elif user_input == \"paper\":\n user_id = 1\n elif user_input == \"scissor\":\n user_id = 2\n else:\n print(\"Invalid input\")\n print(\"Quitting the game\")\n exit()\n \n result_id = play(user_id)\n r = result[result_id]\n print(r)\n return result_id\n \n \nwhile(computer_points < 5 and user_points < 5):\n\n inp = input(\"Enter move :\")\n r = driver(inp) \n if r == USER:\n user_points += 1\n elif r == COMPUTER:\n computer_points += 1\n \n print(\"User : \", user_points, \" Computer : \", computer_points, \"\\n\\n\")\n\nif user_points == 5:\n print(\"GAME HAS ENDED USER WON\")\nelse:\n print(\"AI TOO STRONG\")\n" } ]
1
julasevi567/GitHubApi567
https://github.com/julasevi567/GitHubApi567
43ecb048220037107283551fc79a1c9ff85fe6ba
ff81eb78b06e39c47a30c73d5339e4229ff20a67
479523610d1b6ca788cb3bb63b8a12cf165f6fc0
refs/heads/master
2021-04-30T06:23:33.858438
2018-02-14T01:33:24
2018-02-14T01:33:24
121,441,776
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.6493034362792969, "alphanum_fraction": 0.6493034362792969, "avg_line_length": 28.5, "blob_id": "a9e40aeac3a5a8fb11f8b1c96eaa34579ec41837", "content_id": "0e510e8735ef1bb96b734d816a20d05be7dd5ec3", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1651, "license_type": "no_license", "max_line_length": 83, "num_lines": 54, "path": "/GitHub.py", "repo_name": "julasevi567/GitHubApi567", "src_encoding": "UTF-8", "text": "#Imports\r\nimport requests\r\nimport json\r\n\r\n\"\"\"\r\nThis function will return a list of repositores that belong to a specific user\r\nInput - String\r\nOutput - List\r\n\"\"\"\r\ndef getUserRepos(userName):\r\n link = \"https://api.github.com/users/\" + userName + \"/repos\"\r\n userData = requests.get(link)\r\n repositories = json.loads(userData.text)\r\n userRepos = []\r\n \r\n #Loop through nodes getting repository name, handle error of invalid username\r\n for repository in repositories:\r\n try:\r\n userRepos.append(repository.get(\"name\"))\r\n except:\r\n userRepos = []\r\n \r\n return userRepos\r\n \r\n\"\"\"\r\nThis function will return a count of how many commits an indivudal repo containts\r\nInput - String, String\r\nOutput - Int\r\n\"\"\"\r\ndef getCommitCount(userName, repoName):\r\n link = \"https://api.github.com/repos/\" + userName + \"/\" + repoName + \"/commits\"\r\n repoData = requests.get(link)\r\n commits = json.loads(repoData.text)\r\n commitCount = len(commits)\r\n\r\n return commitCount\r\n \r\n\"\"\"\r\nMain function that lists all the repos and lists each commit count given a specific\r\ngithub user name.\r\n\"\"\"\r\nif __name__ == \"__main__\":\r\n #Ask username\r\n userName = raw_input(\"Enter Github username: \")\r\n\r\n #Get repos associated with given username\r\n userRepos = getUserRepos(userName)\r\n\r\n #Print usernamer\r\n print(\"User: \" + userName)\r\n #Loop through associated repos printing name and their commit count\r\n for repository in userRepos:\r\n commitCount = getCommitCount(userName, repository)\r\n print(\"Repo: \" + repository + \" Number of Commits: \" + str(commitCount))\r\n\r\n\r\n" }, { "alpha_fraction": 0.588477373123169, "alphanum_fraction": 0.6255143880844116, "avg_line_length": 31.517240524291992, "blob_id": "c5d515472baf5b3df83fee0eabef2b125565910c", "content_id": "87a258afa399b784a678ff69e69b8e9ea1f4f6a4", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 972, "license_type": "no_license", "max_line_length": 76, "num_lines": 29, "path": "/testGitHub.py", "repo_name": "julasevi567/GitHubApi567", "src_encoding": "UTF-8", "text": "import unittest\r\nfrom GitHub import getUserRepos, getCommitCount\r\n\r\nclass TestGitHub(unittest.TestCase):\r\n \r\n def testGitHub01A(self):\r\n self.assertIn(\"TwitchEmpire\", getUserRepos(\"julasevich\"))\r\n \r\n def testGitHub01b(self):\r\n self.assertNotIn(\"HelloWorld\", getUserRepos(\"julasevich\"))\r\n\r\n def testGitHub01b(self):\r\n self.assertEqual(1, getCommitCount(\"julasevich\", \"TwitchEmpire\"))\r\n \r\n def testGitHub02A(self):\r\n self.assertIn(\"Triangle567\", getUserRepos(\"julasevi567\"))\r\n \r\n def testGitHub02b(self):\r\n self.assertNotIn(\"HelloWorld\", getUserRepos(\"julasevi567\"))\r\n\r\n def testGitHub02b(self):\r\n self.assertNotEqual(1, getCommitCount(\"julasevi567\", \"Triangle567\"))\r\n\r\n def testGitHub03A(self):\r\n self.assertEqual([], getUserRepos(\"FakeUsername23424\"))\r\n\r\nif __name__ == '__main__':\r\n print('Running unit tests')\r\n unittest.main()\r\n" } ]
2
vitorquintella/ruptures
https://github.com/vitorquintella/ruptures
6f8f89b28690de01fb0e0fc98a1971182ebf4705
9ceac4166c2610c73121b0f5d45fe4e31b397354
bdae27c6c789aa468bc4e5135ac5149b25271b0c
refs/heads/master
2020-08-01T04:18:38.940292
2019-09-25T16:21:57
2019-09-25T16:21:57
210,860,345
0
0
BSD-2-Clause
2019-09-25T14:05:38
2019-09-24T11:15:44
2019-07-29T12:07:02
null
[ { "alpha_fraction": 0.5401849746704102, "alphanum_fraction": 0.551284670829773, "avg_line_length": 37.30708694458008, "blob_id": "905ff61b916a5ac582b98402cd8b41b945229cc7", "content_id": "204d0593d1da83c8b71d56bd769841d46cb57ece", "detected_licenses": [ "BSD-2-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 4865, "license_type": "permissive", "max_line_length": 326, "num_lines": 127, "path": "/ruptures/datasets/pw_constant.py", "repo_name": "vitorquintella/ruptures", "src_encoding": "UTF-8", "text": "\"\"\"\n.. _sec-pw-constant:\n\nMean shift\n====================================================================================================\n\nDescription\n----------------------------------------------------------------------------------------------------\n\nFor a given number of samples :math:`T`, number of changepoints :math:`K` and noise variance :math:`\\sigma^2`, this function generates change point indexes :math:`0<t_1<\\dots<t_K<T` and a piecewise constant signal :math:`\\{y_t\\}_t` with additive Gaussian noise. It's modified from original to include a shift in std deviation.\n\n\nUsage\n----------------------------------------------------------------------------------------------------\n\nStart with the usual imports and create a signal.\n\n.. code-block:: python\n\n import numpy as np\n import matplotlib.pylab as plt\n import ruptures as rpt\n # creation of data\n n, dim = 500, 3 # number of samples, dimension\n n_bkps, sigma = 3, 5 # number of change points, noise standart deviation\n signal, bkps = rpt.pw_constant(n, dim, n_bkps, noise_std=sigma)\n rpt.display(signal, bkps)\n\nThe mean shift amplitude is uniformly drawn from an interval that can be changed through the keyword ``'delta'``.\n\n.. code-block:: python\n\n signal, bkps = rpt.pw_constant(n, dim, n_bkps, noise_std=sigma, delta=(1, 10),noise_delta=(0.5,2))\n\n\nCode explanation\n----------------------------------------------------------------------------------------------------\n\n.. autofunction:: ruptures.datasets.pw_constant.pw_constant\n\n\"\"\"\n\nimport numpy as np\nfrom numpy import random as rd\n\nfrom ruptures.utils import draw_bkps\n\n\ndef pw_constant(n_samples=200, n_features=1, n_bkps=3, noise_std=None,\n delta=(1, 10), noise_delta=(1,1)):\n \"\"\"Return a piecewise constant signal and the associated changepoints.\n\n Args:\n n_samples (int): signal length\n n_features (int, optional): number of dimensions\n n_bkps (int, optional): number of changepoints\n noise_std (float, optional): noise std. If None or 0, no noise is added\n delta (tuple, optional): (delta_min, delta_max) max and min jump values\n noise_delta (tuple, optional): (noise_min_mult, noise_max_mult) max and min noise multipliers \n\n\n Returns:\n tuple: signal of shape (n_samples, n_features), list of breakpoints\n\n noise_min_mult and noise_max_mult must be greater than 0\n 0 to 1 and 1 to inf is equaly distributed.\n \"\"\"\n if noise_std is None:\n noise_std = 0\n \n # breakpoints\n bkps = draw_bkps(n_samples, n_bkps)\n # we create the signal\n signal = np.empty((n_samples, n_features), dtype=float)\n signal_noise = np.empty((n_samples, n_features), dtype=float) \n tt_ = np.arange(n_samples)\n delta_min, delta_max = delta\n noise_delta_min, noise_delta_max = noise_delta\n if not noise_delta_min <= noise_delta_max:\n sys.exit('Error: noise_delta_min is bigger than noise_delta_max')\n \n # mean value\n center = np.zeros(n_features)\n for ind in np.split(tt_, bkps):\n if ind.size > 0:\n # jump value\n jump = rd.uniform(delta_min, delta_max, size=n_features)\n spin = rd.choice([-1, 1], n_features)\n center += jump * spin\n signal[ind] = center\n \n noise_center = np.ones(n_features)\n noise_jump = np.zeros(n_features)\n\n for ind in np.split(tt_, bkps):\n if ind.size > 0:\n \n if noise_delta_min>=1 and noise_delta_max>=1:\n noise_jump = rd.uniform(noise_delta_min,noise_delta_max, n_features) \n elif noise_delta_min<1 and noise_delta_max<=1:\n aux_jump = rd.uniform(1/noise_delta_min,1/noise_delta_max, n_features)\n noise_jump = 1/aux_jump\n else: #equalize probabilities lower than 1 and bigger than 1 taking into account the proportion\n inv_min = 1/noise_delta_min \n domain_len = inv_min + noise_delta_max\n p = [inv_min/domain_len,noise_delta_max/domain_len]\n noise_side = rd.choice([-1, 1], n_features,p=p)\n# print('ns',noise_side)\n for f in range(n_features): \n if noise_side[f] == 1:\n noise_jump[f] = rd.choice([1,noise_delta_max]) \n# print('!!!!',noise_jump[f])\n else:\n aux_jump = rd.choice([inv_min,1])\n noise_jump[f] = 1/aux_jump\n \n# print('nc1',noise_center)\n# print('nj1',noise_jump)\n noise_center *= noise_jump \n# print('nc2',noise_center)\n\n signal_noise[ind] = noise_center\n\n noise = rd.normal(size=signal.shape) * signal_noise * noise_std\n signal = signal + noise\n\n return signal, bkps\n" } ]
1
jbungayjr/project0
https://github.com/jbungayjr/project0
a25473c5dfa3f986520728c3cf7e80d18e893ec3
9e8df3dad29b467a61d456fb4f0bdc170bd739fe
08d2c0ee9f7648d961d748de8e26cfc2266cb3b4
refs/heads/master
2020-09-09T02:30:08.332422
2019-11-12T23:08:36
2019-11-12T23:08:36
221,318,603
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.7078651785850525, "alphanum_fraction": 0.7078651785850525, "avg_line_length": 21.25, "blob_id": "0a2cdaf694492b1f6fb84afc3556e161ea12b620", "content_id": "129c1cc350667567c1b1a030a0ffa35768eaae82", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 89, "license_type": "no_license", "max_line_length": 29, "num_lines": 4, "path": "/testfile.py", "repo_name": "jbungayjr/project0", "src_encoding": "UTF-8", "text": "#this is just a test for git.\n#that's it\nprint('Hello World!')\nprint('Additional Thing!)\n" } ]
1
vincentho627/Emojifier-App
https://github.com/vincentho627/Emojifier-App
72dd6d84aad3302bc058ad01251437302ce7b652
3f3bd1b89d29b6e9182587287518bcb3e7152731
9b7f70778cbd64c3875dbcd2323ae21d2816a778
refs/heads/main
2023-05-06T00:38:13.970661
2021-05-30T18:53:10
2021-05-30T18:53:10
336,491,203
2
0
null
null
null
null
null
[ { "alpha_fraction": 0.8666666746139526, "alphanum_fraction": 0.8833333253860474, "avg_line_length": 6.625, "blob_id": "db0112dcf235b342b6cc24a17a7d06e1b413bcb0", "content_id": "a424c2c40e8c018ffd89d3eabe121e8a74b35107", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Text", "length_bytes": 60, "license_type": "no_license", "max_line_length": 10, "num_lines": 8, "path": "/backend/requirements.txt", "repo_name": "vincentho627/Emojifier-App", "src_encoding": "UTF-8", "text": "numpy\ncv2\nmatplotlib\npandas\nimageio\nsklearn\ntensorflow\nflask" }, { "alpha_fraction": 0.6554096341133118, "alphanum_fraction": 0.6876172423362732, "avg_line_length": 35.29545593261719, "blob_id": "e3f58d48bf6dfecd3f5c4589076169c4f895551c", "content_id": "2f147bb25bfcf81cd591b74bae910142771e72a7", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3198, "license_type": "no_license", "max_line_length": 120, "num_lines": 88, "path": "/backend/EmojiClassifier/Model.py", "repo_name": "vincentho627/Emojifier-App", "src_encoding": "UTF-8", "text": "from sklearn.ensemble import RandomForestClassifier\nfrom sklearn.neural_network import MLPClassifier\nfrom tensorflow.python.keras.layers import Conv2D, MaxPooling2D, Flatten, Dense, Dropout, BatchNormalization\nfrom tensorflow.python.keras.models import Sequential\nfrom tensorflow.python.keras.optimizer_v2.adam import Adam\n\nfrom EmojiClassifier.config import INPUT_SHAPE, NUM_OUTPUTS\n\n\ndef create_model():\n \"\"\" Inspired by the VGGNet, removed its fifth Convolution block \"\"\"\n model = Sequential()\n\n # Block 1\n model.add(Conv2D(32, 3, activation=\"relu\", kernel_initializer='he_normal', input_shape=INPUT_SHAPE, padding='same'))\n model.add(BatchNormalization())\n model.add(Conv2D(32, 3, activation=\"relu\", kernel_initializer='he_normal', input_shape=INPUT_SHAPE, padding='same'))\n model.add(BatchNormalization())\n model.add(MaxPooling2D(2))\n model.add(Dropout(0.2))\n\n # Block 2\n model.add(Conv2D(64, 3, kernel_initializer='he_normal', activation=\"relu\", padding='same'))\n model.add(BatchNormalization())\n model.add(Conv2D(64, 3, kernel_initializer='he_normal', activation=\"relu\", padding='same'))\n model.add(BatchNormalization())\n model.add(MaxPooling2D(2))\n model.add(Dropout(0.2))\n\n # Block 3\n model.add(Conv2D(128, 3, kernel_initializer='he_normal', activation=\"relu\", padding='same'))\n model.add(BatchNormalization())\n model.add(Conv2D(128, 3, kernel_initializer='he_normal', activation=\"relu\", padding='same'))\n model.add(BatchNormalization())\n model.add(MaxPooling2D(2))\n model.add(Dropout(0.2))\n\n # Block 4\n model.add(Conv2D(256, 3, kernel_initializer='he_normal', activation=\"relu\", padding='same'))\n model.add(BatchNormalization())\n model.add(Conv2D(256, 3, kernel_initializer='he_normal', activation=\"relu\", padding='same'))\n model.add(BatchNormalization())\n model.add(MaxPooling2D(2))\n model.add(Dropout(0.2))\n\n # Block 5\n model.add(Conv2D(512, 3, kernel_initializer='he_normal', activation=\"relu\", padding='same'))\n model.add(BatchNormalization())\n model.add(Conv2D(512, 3, kernel_initializer='he_normal', activation=\"relu\", padding='same'))\n model.add(BatchNormalization())\n model.add(MaxPooling2D(2))\n model.add(Dropout(0.2))\n\n # Block 6\n model.add(Flatten())\n model.add(Dense(128, kernel_initializer='he_normal', activation=\"relu\"))\n model.add(BatchNormalization())\n model.add(Dropout(0.5))\n\n # Block 7\n model.add(Dense(64, kernel_initializer='he_normal', activation=\"relu\"))\n model.add(BatchNormalization())\n model.add(Dropout(0.5))\n\n # Block 8\n model.add(Dense(NUM_OUTPUTS, activation=\"softmax\"))\n\n adam = Adam(learning_rate=0.001)\n\n model.compile(optimizer=adam,\n loss='categorical_crossentropy',\n metrics=['accuracy'])\n\n print(model.summary())\n return model\n\n\ndef create_random_forest():\n return RandomForestClassifier(n_estimators=20, random_state=0)\n\n\ndef create_mlp_classifier():\n return MLPClassifier(activation=\"relu\", hidden_layer_sizes=(256, 128, 64), solver=\"adam\", batch_size=32,\n verbose=True)\n\n\nif __name__ == \"__main__\":\n m = create_model()\n\n\n\n\n" }, { "alpha_fraction": 0.670769214630127, "alphanum_fraction": 0.6763076782226562, "avg_line_length": 30.25, "blob_id": "ac3c33495086cec36e5352509723b4dbe154ffe9", "content_id": "9f166d90333f8d3a985ca64268aad5b1450af526", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1625, "license_type": "no_license", "max_line_length": 102, "num_lines": 52, "path": "/backend/EmojiClassifier/TestModel.py", "repo_name": "vincentho627/Emojifier-App", "src_encoding": "UTF-8", "text": "from tensorflow.python.keras.models import load_model\nimport numpy as np\nfrom tensorflow.python.ops.confusion_matrix import confusion_matrix\n\nfrom EmojiClassifier.config import *\nfrom EmojiClassifier.DataGenerator import convert_image_to_training_data, get_test_data_for_sklearn, \\\n validation_generator\n\n\ndef get_emotion(path):\n \"\"\" Tests the model with a given path and returns the predicted emotion \"\"\"\n model = load_model(\"Models/current.h5\")\n ar = convert_image_to_training_data(path)\n y = model.predict(ar)\n y = int(np.argmax(y, axis=1))\n return emojiList[y]\n\n\ndef test_nn_model_with_validation():\n validation_gen = validation_generator(1)\n index = 0\n model = load_model(\"../Models/current.h5\")\n\n y_predicts = []\n y_labels = []\n\n while index < NUM_VAL_SAMPLES:\n print(index)\n image_array, y_label_array = next(validation_gen)\n y_predict_array = model.predict(image_array)\n y_predict = int(np.argmax(y_predict_array, axis=1))\n y_label = int(np.argmax(y_label_array, axis=1))\n y_predicts.append(y_predict)\n y_labels.append(y_label)\n\n index += 1\n\n print(len(y_labels))\n print(len(y_predicts))\n conf_matrix = confusion_matrix(y_labels, y_predicts, num_classes=NUM_OUTPUTS)\n return conf_matrix\n\n\ndef test_sklearn_model():\n \"\"\" Tests with scikit learn models returns the predicted emotion \"\"\"\n # TODO test the models with scikit learn and see which one has the best performance\n x_test, y_test = get_test_data_for_sklearn()\n return 0\n\n\nif __name__ == \"__main__\":\n print(test_nn_model_with_validation())\n" }, { "alpha_fraction": 0.5634517669677734, "alphanum_fraction": 0.5759114027023315, "avg_line_length": 27.513158798217773, "blob_id": "7ea6b0a3e5f561361606b0b398171ba33bcb027d", "content_id": "d5a3c1ff1f4a2121994854f396bfc17d3e611a98", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2167, "license_type": "no_license", "max_line_length": 106, "num_lines": 76, "path": "/backend/app.py", "repo_name": "vincentho627/Emojifier-App", "src_encoding": "UTF-8", "text": "import base64\nimport cv2\nfrom PIL import Image\nfrom flask import Flask, request\nimport os\nimport pandas as pd\nimport matplotlib.pyplot as plt\nimport io\nimport numpy as np\n\n\nfrom EmojiClassifier.TestModel import get_emotion\nfrom EmojiExtractor.EmojiExtractor import get_image_from_emotion\nfrom FaceDetection.FaceDetector import detect_Faces\n\n\ntemplate_path = os.path.abspath(\"../public\")\napp = Flask(__name__, template_folder=template_path)\n\n\n@app.route(\"/image\", methods=[\"POST\"])\ndef retrieve_emotion():\n if request.method == \"POST\":\n\n resp = request.get_json()\n img_data = resp['image']\n\n byte_data = bytes(img_data, 'utf-8')\n\n b = base64.b64decode(byte_data)\n\n jpg_as_np = np.frombuffer(b, dtype=np.uint8)\n img = cv2.imdecode(jpg_as_np, flags=1)\n # img = Image.open(io.BytesIO(b))\n\n detect_Faces(img)\n\n faces_to_emoji = {}\n for root, dirs, files in os.walk(\"./FaceDetection/Images\"):\n for filename in files:\n emotion = get_emotion(\"./FaceDetection/Images/\" + filename)\n filename = int(filename.replace(\".jpg\", \"\"))\n faces_to_emoji[filename] = emotion\n\n df = pd.read_csv(\"./FaceDetection/Dataset/faces.csv\")\n\n for index, row in df.iterrows():\n x = row['x']\n y = row['y']\n h = row['height']\n w = row['width']\n emotion = faces_to_emoji[index]\n emoji = get_image_from_emotion(f\"./EmojiExtractor/Images/{emotion}.png\", h, w)\n for c in range(3):\n alpha_s = emoji[:, :, 2] / 255.0\n alpha_l = 1.0 - alpha_s\n img[y:y + h, x:x + w, c] = (alpha_s * emoji[:, :, c] + alpha_l * img[y:y + h, x:x + w, c])\n\n img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)\n img_save = Image.fromarray(img)\n b = io.BytesIO()\n img_save.save(b, format=\"jpeg\")\n b.seek(0)\n\n labelled_image = base64.b64encode(b.read()).decode('ascii')\n\n return {\"image\": labelled_image}\n\n\n@app.route(\"/testing\")\ndef testing():\n return {\"success\": True}\n\n\nif __name__ == \"__main__\":\n app.run(debug=True)\n" }, { "alpha_fraction": 0.7649572491645813, "alphanum_fraction": 0.7649572491645813, "avg_line_length": 38, "blob_id": "5ee34d062a3843a043c7d3bca7f0b03ef4b2554a", "content_id": "756f910a5c7eb74e2513a48200542b8e3ee17fa3", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 234, "license_type": "no_license", "max_line_length": 80, "num_lines": 6, "path": "/backend/FaceDetection/config.py", "repo_name": "vincentho627/Emojifier-App", "src_encoding": "UTF-8", "text": "import pathlib\n\nPATH_NAME = str(pathlib.Path().absolute())\nPATH_TO_IMAGES = \"FaceDetection\" + \"/Images\"\nDATASET_DIRECTORY = \"FaceDetection\" + \"/Dataset\"\nCASCADE_DIRECTORY = \"FaceDetection/Cascades/haarcascade_frontalface_default.xml\"\n" }, { "alpha_fraction": 0.5821325778961182, "alphanum_fraction": 0.6138328313827515, "avg_line_length": 22.133333206176758, "blob_id": "f49fe2744e3698339bff53e4a5a7a7d504865487", "content_id": "399faaa4008a0084d4e4eec958dd5beaf5ea7980", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 347, "license_type": "no_license", "max_line_length": 60, "num_lines": 15, "path": "/backend/EmojiExtractor/EmojiExtractor.py", "repo_name": "vincentho627/Emojifier-App", "src_encoding": "UTF-8", "text": "import cv2\nimport matplotlib.pyplot as plt\n\n\ndef get_image_from_emotion(file, h, w):\n img = cv2.imread(file)\n img = cv2.resize(img, (h, w))\n return img\n\n\nif __name__ == \"__main__\":\n img = get_image_from_emotion(\"Images/angry.png\", 10, 10)\n # plt.imshow(get_image_from_emotion(\"angry\", 10, 10))\n # plt.show()\n print(img.shape)\n" }, { "alpha_fraction": 0.5446428656578064, "alphanum_fraction": 0.7142857313156128, "avg_line_length": 13.125, "blob_id": "773385fc6ee9e7c86a5b8c738ad326f8119786cf", "content_id": "0988cd01d2ebc146c0263ec159ee10208f02aedd", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Text", "length_bytes": 112, "license_type": "no_license", "max_line_length": 17, "num_lines": 8, "path": "/requirements.txt", "repo_name": "vincentho627/Emojifier-App", "src_encoding": "UTF-8", "text": "imageio~=2.9.0\nnumpy~=1.18.5\nmatplotlib~=3.3.1\npandas~=1.1.1\ntensorflow~=2.3.0\npillow~=7.2.0\nopencv-python\nthinc" }, { "alpha_fraction": 0.7818182110786438, "alphanum_fraction": 0.7818182110786438, "avg_line_length": 17.33333396911621, "blob_id": "3e275ef856834983b256845b67705d747ae52cdb", "content_id": "0586bb9aca2461dc673a0b9cefb4547000fe9c15", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 55, "license_type": "no_license", "max_line_length": 37, "num_lines": 3, "path": "/frontend/README.md", "repo_name": "vincentho627/Emojifier-App", "src_encoding": "UTF-8", "text": "# Emojifier-App\n\nFront end built with Flutter and Dart\n" }, { "alpha_fraction": 0.6120722889900208, "alphanum_fraction": 0.6236063241958618, "avg_line_length": 26.967741012573242, "blob_id": "7ca0f9bf52c4f69497cc61d09183a60897b75111", "content_id": "18f727a7630aa7ff9cd7d71157e7039120b64dc8", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2601, "license_type": "no_license", "max_line_length": 119, "num_lines": 93, "path": "/backend/EmojiClassifier/DataGenerator.py", "repo_name": "vincentho627/Emojifier-App", "src_encoding": "UTF-8", "text": "import cv2\nfrom tensorflow.python.keras.preprocessing.image import ImageDataGenerator\nimport numpy as np\n\nfrom EmojiClassifier.config import *\n\n\ndef train_generator(batch_size):\n \"\"\" Returns shuffled training generator that outputs the grayscale image array with the categorical emoji array \"\"\"\n train_data = ImageDataGenerator(\n rescale=1. / 255,\n rotation_range=10,\n shear_range=0.3,\n zoom_range=0.1,\n width_shift_range=0.4,\n height_shift_range=0.4,\n horizontal_flip=True,\n fill_mode='nearest')\n\n train_gen = train_data.flow_from_directory(\n PATH_TO_TRAIN,\n color_mode='grayscale',\n target_size=(IMG_ROW, IMG_COL),\n batch_size=batch_size,\n class_mode='categorical',\n shuffle=True)\n\n return train_gen\n\n\ndef validation_generator(batch_size=BATCH_SIZE):\n \"\"\" Returns shuffled validation generator that outputs the grayscale image array with the categorical emoji array\n \"\"\"\n validation_data = ImageDataGenerator(rescale=1. / 255)\n\n validation_gen = validation_data.flow_from_directory(\n PATH_TO_VAL,\n color_mode='grayscale',\n target_size=(IMG_ROW, IMG_COL),\n batch_size=batch_size,\n class_mode='categorical',\n shuffle=True)\n\n return validation_gen\n\n\ndef get_train_data_for_sklearn():\n index = 0\n x_train = []\n y_train = []\n train_gen = train_generator(1)\n\n while index < NUM_TRAIN_SAMPLES:\n print(index)\n curr_x, curr_y = next(train_gen)\n curr_x = curr_x.reshape((IMG_ROW * IMG_COL))\n curr_y = curr_y.reshape((NUM_OUTPUTS, ))\n x_train.append(curr_x)\n y_train.append(curr_y)\n index += 1\n\n return x_train, y_train\n\n\ndef get_test_data_for_sklearn():\n index = 0\n x_test = []\n y_test = []\n train_gen = validation_generator()\n\n while index < NUM_TRAIN_SAMPLES:\n print(index)\n curr_x, curr_y = next(train_gen)\n curr_x = curr_x.reshape((IMG_ROW * IMG_COL))\n curr_y = curr_y.reshape((NUM_OUTPUTS, ))\n x_test.append(curr_x)\n y_test.append(curr_y)\n index += 1\n\n return x_test, y_test\n\n\ndef convert_image_to_training_data(path):\n \"\"\" Converts a given image path into a grayscale image array for the neural network for input \"\"\"\n img = cv2.imread(path, cv2.IMREAD_GRAYSCALE)\n img = cv2.resize(img, (IMG_ROW, IMG_COL), interpolation=cv2.INTER_CUBIC)\n ar = np.expand_dims(img, axis=2)\n ar = np.expand_dims(ar, axis=0)\n return ar\n\n\nif __name__ == \"__main__\":\n x, y = get_train_data_for_sklearn()\n" }, { "alpha_fraction": 0.6079920530319214, "alphanum_fraction": 0.612285315990448, "avg_line_length": 43.52941131591797, "blob_id": "28a72803e41b87ef2801c572e3266adca9225319", "content_id": "0c9c150ada575f4c0e55b46cbe98453ed51c397d", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3028, "license_type": "no_license", "max_line_length": 110, "num_lines": 68, "path": "/backend/EmojiClassifier/TrainModel.py", "repo_name": "vincentho627/Emojifier-App", "src_encoding": "UTF-8", "text": "from sklearn import metrics\nfrom sklearn.model_selection import train_test_split\nfrom tensorflow.python.keras.callbacks import TensorBoard, EarlyStopping\nimport matplotlib.pyplot as plt\nimport numpy as np\n\nfrom EmojiClassifier.DataGenerator import train_generator, validation_generator, get_train_data_for_sklearn\nfrom EmojiClassifier.config import *\nfrom EmojiClassifier.Model import create_model, create_random_forest, create_mlp_classifier\n\n\ndef train_nn_model():\n \"\"\" Trains the model with the train and validation generators and saves the weights in weights.h5 file \"\"\"\n tensor_board_call_back = TensorBoard(log_dir=\"./logs\", histogram_freq=1)\n early_stopping_call_back = EarlyStopping(monitor='val_loss',\n min_delta=0.01,\n patience=3,\n verbose=1,\n restore_best_weights=True\n )\n callbacks = [tensor_board_call_back, early_stopping_call_back]\n model = create_model()\n train_gen = train_generator(BATCH_SIZE)\n validation_gen = validation_generator()\n history = model.fit_generator(train_gen,\n steps_per_epoch=NUM_TRAIN_SAMPLES // BATCH_SIZE,\n validation_data=validation_gen,\n validation_steps=NUM_VAL_SAMPLES // BATCH_SIZE,\n epochs=EPOCHS,\n callbacks=callbacks)\n model.save(\"./current.h5\")\n\n # plotting graph to visualise accuracy\n plt.plot(history.history['accuracy'], label='accuracy')\n plt.plot(history.history['val_accuracy'], label='val_accuracy')\n plt.plot(history.history['loss'], label='loss')\n plt.plot(history.history['val_loss'], label='val_loss')\n plt.xlabel('Epoch')\n plt.ylabel('Accuracy')\n plt.ylim([0, 1])\n plt.legend(loc='lower right')\n plt.show()\n\n\ndef train_sklearn_models():\n \"\"\" Trains scikit learn models to see which model does best \"\"\"\n # TODO make and train with scikit learn and see which one has the best performance\n\n models = [create_random_forest, create_mlp_classifier]\n modelNames = [\"Random Forest\", \"MLP Classifier\"]\n\n x_train, y_train = get_train_data_for_sklearn()\n x_train, x_val, y_train, y_val = train_test_split(x_train, y_train, random_state=3, test_size=0.2, )\n\n for i in range(len(models)):\n name = modelNames[i]\n print(f'Training {name}')\n model = models[i]()\n model.fit(x_train, y_train)\n y_val_predict = model.predict(x_val)\n print('Mean Absolute Error:', metrics.mean_absolute_error(y_val, y_val_predict))\n print('Mean Squared Error:', metrics.mean_squared_error(y_val, y_val_predict))\n print('Root Mean Squared Error:', np.sqrt(metrics.mean_squared_error(y_val, y_val_predict)))\n\n\nif __name__ == \"__main__\":\n train_nn_model()\n # train_sklearn_models()\n" }, { "alpha_fraction": 0.6313433051109314, "alphanum_fraction": 0.6597014665603638, "avg_line_length": 22.89285659790039, "blob_id": "d4970947cf4c06e0304f26d69e14cf51c1066449", "content_id": "9d84b3cbe81ac01dcd1b3480dc7351fd0b8d0921", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 670, "license_type": "no_license", "max_line_length": 63, "num_lines": 28, "path": "/backend/EmojiClassifier/config.py", "repo_name": "vincentho627/Emojifier-App", "src_encoding": "UTF-8", "text": "import json\nimport pathlib\n\n# ====== GLOBAL VARIABLES ====== #\nEMOJI_DICT = {}\n\nPATH_NAME = str(pathlib.Path().absolute()) + \"/EmojiClassifier\"\nPATH_EMOJILIST = PATH_NAME + \"/../EmojiList.json\"\nPATH_TO_DATASET = PATH_NAME + \"/Dataset\"\nPATH_TO_TRAIN = PATH_TO_DATASET + \"/images/train\"\nPATH_TO_VAL = PATH_TO_DATASET + \"/images/validation\"\n\nNUM_TRAIN_SAMPLES = 24282\nNUM_VAL_SAMPLES = 5937\nEPOCHS = 50\nIMG_ROW, IMG_COL = 48, 48\nINPUT_SHAPE = (IMG_ROW, IMG_COL, 1)\nBATCH_SIZE = 32\nNUM_OUTPUTS = 5\n\nf = open(PATH_EMOJILIST)\nemojiList = json.load(f)[\"Emoji\"]\nfor i, emoji in enumerate(emojiList):\n EMOJI_DICT[emoji] = i\n\n\nif __name__ == \"__main__\":\n print(EMOJI_DICT)\n\n" }, { "alpha_fraction": 0.5946656465530396, "alphanum_fraction": 0.6123215556144714, "avg_line_length": 31.86419677734375, "blob_id": "eb8f7564c6453fb14cecd49efe27d42b8a3b660a", "content_id": "9bb0e1f7c144987e66098eed98835d1c51790494", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2662, "license_type": "no_license", "max_line_length": 103, "num_lines": 81, "path": "/backend/FaceDetection/FaceDetector.py", "repo_name": "vincentho627/Emojifier-App", "src_encoding": "UTF-8", "text": "import os\n\nimport cv2\nimport matplotlib.pyplot as plt\nimport matplotlib.patches as patches\nimport pandas as pd\nimport numpy as np\n\nfrom FaceDetection.config import PATH_TO_IMAGES, DATASET_DIRECTORY\n\nfaceCascade = cv2.CascadeClassifier('FaceDetection/Cascades/haarcascade_frontalface_default.xml')\n\n\ndef open_Image(img):\n image = cv2.imread(img)\n image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)\n gray_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)\n return image, gray_image\n\n\ndef detect_Faces(img, saveRect=True, saveLabelledImg=False, filename='', plot=False):\n \"\"\" Detect faces and stores the coordinates in a csv dataset and can save labelled image \"\"\"\n # image, gray_image = open_Image(img)\n # print(image)\n # gray_image = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)\n image = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)\n gray_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)\n faces = faceCascade.detectMultiScale(gray_image, scaleFactor=1.2, minNeighbors=5, minSize=(30, 30))\n\n print(\"Found {0} faces!\".format(len(faces)))\n\n if saveRect:\n data = []\n\n if not os.path.exists(PATH_TO_IMAGES):\n os.mkdir(PATH_TO_IMAGES)\n if not os.path.exists(DATASET_DIRECTORY):\n os.mkdir(DATASET_DIRECTORY)\n\n index = 0\n for (x, y, w, h) in faces:\n # cropped image\n face_image = image[y:y + h, x:x + w]\n face_image = cv2.cvtColor(face_image, cv2.COLOR_BGR2RGB)\n face_file_name = \"{}/{}.jpg\".format(\"FaceDetection/Images\", index)\n\n # save cropped image inside image folder\n cv2.imwrite(face_file_name, face_image)\n index += 1\n data.append([face_file_name, x, y, w, h])\n\n array = np.asarray(data)\n df = pd.DataFrame(array, columns=[\"image\", \"x\", \"y\", \"width\", \"height\"])\n df.to_csv(\"{}/faces.csv\".format(DATASET_DIRECTORY))\n\n if saveLabelledImg:\n for (x, y, w, h) in faces:\n cv2.rectangle(image, (x, y), (x + w, y + h), (0, 255, 0), 2)\n\n # saving into a jpg\n filename = PATH_TO_IMAGES + \"/\" + filename\n image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)\n image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)\n cv2.imwrite(filename, image)\n\n if plot:\n fig, ax = plt.subplots()\n\n # Draw a rectangle around the faces\n for (x, y, w, h) in faces:\n rect = patches.Rectangle((x, y), w, h, linewidth=1, edgecolor='g', facecolor='none')\n ax.add_patch(rect)\n plt.imshow(image)\n plt.show()\n plt.close(fig)\n\n return len(faces)\n\n\nif __name__ == \"__main__\":\n detect_Faces(\"./test.jpg\")\n" }, { "alpha_fraction": 0.7857142686843872, "alphanum_fraction": 0.7857142686843872, "avg_line_length": 13, "blob_id": "3c956bc4750749c2937802fc706c9f2e29878d0e", "content_id": "ca4c22b696df1e4a16c687ed346553c92e4548e4", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 42, "license_type": "no_license", "max_line_length": 24, "num_lines": 3, "path": "/backend/README.md", "repo_name": "vincentho627/Emojifier-App", "src_encoding": "UTF-8", "text": "# Emojifier-App\n\nBackend built with Flask " } ]
13
Benjamin-eecs/promp_critic
https://github.com/Benjamin-eecs/promp_critic
508d1ab96c5c0ebe0a8aae9c72d6179bea36a721
6d1e932794868729a053d71200c981d9b57ef39d
93920ffd9fa93ddf5655769ce6bba738f4a719d2
refs/heads/master
2023-08-10T21:03:46.787500
2021-09-18T08:32:14
2021-09-18T08:32:14
406,770,775
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.48591113090515137, "alphanum_fraction": 0.4920427203178406, "avg_line_length": 52.94795608520508, "blob_id": "8a72d49813caa51a17d0de4917192595515a3ebe", "content_id": "8047cf21d4cd11a0f09fbe43f5426f8c976c5b1d", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 14515, "license_type": "no_license", "max_line_length": 178, "num_lines": 269, "path": "/meta_policy_search/critics/mlp_critic.py", "repo_name": "Benjamin-eecs/promp_critic", "src_encoding": "UTF-8", "text": "from meta_policy_search.utils import Serializable, logger\nfrom meta_policy_search.utils.utils import remove_scope_from_name\n\nfrom meta_policy_search.critics.networks.mlp import create_mlp\nfrom meta_policy_search.critics.base import Critic\n\n\n\nimport tensorflow as tf\nimport numpy as np\nfrom collections import OrderedDict\n\n\nclass MLPCritic(Critic):\n \"\"\"\n multi-layer perceptron critic \n Provides functions for executing and updating critic parameters\n\n Args:\n obs_dim (int) : dimensionality of the observation space \n action_dim (int) : dimensionality of the action space \n task_dim(int)\n\n name (str) : name of the policy used as tf variable scope\n hidden_sizes (tuple) : tuple of integers specifying the hidden layer sizes of the MLP\n hidden_nonlinearity (tf.op) : nonlinearity function of the hidden layers\n output_nonlinearity (tf.op or None) : nonlinearity function of the output layer\n\n\n \"\"\"\n\n def __init__(self, critic_learning_rate, num_critic_steps, *args, **kwargs):\n # store the init args for serialization and call the super constructors\n Serializable.quick_init(self, locals())\n Critic.__init__(self, *args, **kwargs)\n\n\n self.critic_learning_rate = critic_learning_rate\n self.num_critic_steps = num_critic_steps\n\n self.main_critic_params = None\n self.target_critic_params = None\n\n self.main_obs_acs_task_ids_var = None\n self.main_q_value_var = None\n self.target_obs_acs_task_ids_var = None\n self.target_q_value_var = None \n \n self.build_graph()\n self.create_training_method()\n\n def build_graph(self):\n \"\"\"\n Builds computational graph for policy\n \"\"\"\n with tf.variable_scope(self.name):\n # build the actual policy network\n self.main_obs_acs_task_ids_var, self.main_q_value_var = create_mlp(name = 'main_network',\n output_dim = 1,\n hidden_sizes = self.hidden_sizes,\n hidden_nonlinearity = self.hidden_nonlinearity,\n output_nonlinearity = self.output_nonlinearity,\n input_dim = (None, self.ob_dim + self.action_dim + self.task_id_dim,)\n )\n self.target_obs_acs_task_ids_var, self.target_q_value_var = create_mlp(name = 'target_network',\n output_dim = 1,\n hidden_sizes = self.hidden_sizes,\n hidden_nonlinearity = self.hidden_nonlinearity,\n output_nonlinearity = self.output_nonlinearity,\n input_dim = (None, self.ob_dim + self.action_dim + self.task_id_dim,)\n )\n\n # save the policy's trainable variables in dicts\n current_scope = tf.get_default_graph().get_name_scope()\n trainable_policy_vars = tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES, scope=current_scope)\n\n self.main_critic_params = OrderedDict()\n self.target_critic_params = OrderedDict()\n\n for var in trainable_policy_vars:\n #print(var)\n if 'main_network' in remove_scope_from_name(var.name, current_scope):\n self.main_critic_params[remove_scope_from_name(var.name, current_scope)] = var\n if 'target_network' in remove_scope_from_name(var.name, current_scope): \n self.target_critic_params[remove_scope_from_name(var.name, current_scope)] = var\n\n def create_training_method(self):\n\n #self.test_1 = tf.placeholder(dtype=tf.float32, shape=[None,1], name='test_1')\n #self.test_2 = tf.placeholder(dtype=tf.float32, shape=[None], name='test_2')\n\n #self.test_3 = self.test_1 *self.test_2\n\n\n\n self.rewards_phs = tf.placeholder(dtype=tf.float32, shape=[None,1], name='rewards')\n self.discounts_phs = tf.placeholder(dtype=tf.float32, shape=[None,1], name='discounts' )\n self.dones_phs = tf.placeholder(dtype=tf.float32, shape=[None,1], name='dones')\n self.next_q_values_1_phs = tf.placeholder(dtype=tf.float32, shape=[None,1], name='next_q_values_1')\n self.next_q_values_2_phs = tf.placeholder(dtype=tf.float32, shape=[None,1], name='next_q_values_2')\n \n with tf.variable_scope('critic_loss'):\n self.next_q_values_min = tf.minimum(self.next_q_values_1_phs, self.next_q_values_1_phs)\n self.target_q_values = tf.stop_gradient(self.rewards_phs + self.next_q_values_min * self.discounts_phs * (1. - self.dones_phs))\n\n #self.test = self.main_q_value_var - tf.stop_gradient(self.target_q_values)\n self.critic_objective = tf.reduce_mean(0.5 * tf.square(self.main_q_value_var - tf.stop_gradient(self.target_q_values)))\n\n self.optimizer = tf.train.AdamOptimizer(learning_rate = self.critic_learning_rate).minimize(self.critic_objective, var_list=self.main_critic_params)\n\n\n def optimize_critic(self, off_critic_samples_data, log=True):\n \"\"\"\n Performs TD update\n\n Args:\n all_samples_data (list) : list of lists of lists of samples (each is a dict) split by gradient update and\n meta task\n log (bool) : whether to log statistics\n\n Returns:\n None\n \"\"\"\n observations = np.concatenate([path[\"observations\"] for path in off_critic_samples_data])\n actions = np.concatenate([path[\"actions\"] for path in off_critic_samples_data])\n task_ids = np.concatenate([path[\"task_ids\"] for path in off_critic_samples_data])\n\n observations_actions_task_ids = np.concatenate([observations, actions, task_ids], axis=-1)\n\n rewards = np.expand_dims(np.concatenate([path[\"rewards\"] for path in off_critic_samples_data]), axis=-1)\n discounts = np.expand_dims(np.concatenate([path[\"discounts\"] for path in off_critic_samples_data]), axis=-1) \n dones = np.expand_dims(np.concatenate([path[\"dones\"] for path in off_critic_samples_data]) , axis=-1)\n\n next_q_values_1 = np.expand_dims(np.concatenate([path[\"next_q_values_1\"] for path in off_critic_samples_data]), axis=-1)\n next_q_values_2 = np.expand_dims(np.concatenate([path[\"next_q_values_2\"] for path in off_critic_samples_data]) , axis=-1)\n\n # add kl_coeffs / clip_eps to meta_op_input_dict\n if log: logger.log(\"Optimizing Critics\")\n sess = tf.get_default_session()\n\n '''\n print(sess.run(self.test, feed_dict= { self.rewards_phs : rewards,\n self.discounts_phs : discounts,\n self.dones_phs : dones, \n self.next_q_values_1_phs : next_q_values_1,\n self.next_q_values_2_phs : next_q_values_2,\n self.main_obs_acs_task_ids_var : observations_actions_task_ids\n }))\n '''\n #time.sleep(100)\n for epoch in range(self.num_critic_steps):\n\n _, self.critic_loss = sess.run([self.optimizer, self.critic_objective], feed_dict= { self.rewards_phs : rewards,\n self.discounts_phs : discounts,\n self.dones_phs : dones, \n self.next_q_values_1_phs : next_q_values_1,\n self.next_q_values_2_phs : next_q_values_2,\n self.main_obs_acs_task_ids_var : observations_actions_task_ids\n })\n\n if log: logger.log(\"Computing Critics statistics\")\n\n if log:\n logger.log(\"*\"*40)\n logger.log(self.critic_loss)\n logger.log(\"*\"*40)\n\n logger.logkv('QLoss_%s' % self.name, self.critic_loss)\n\n\n\n def get_q_value(self, observation, action, task_id):\n \"\"\"\n Runs a single observation through the specified policy and samples an action\n\n Args:\n observation (ndarray) : single observation - shape: (obs_dim,)\n\n Returns:\n (ndarray) : single action - shape: (action_dim,)\n \"\"\"\n observations = np.expand_dims(observation, axis=0)\n actions = np.expand_dims(action, axis=0)\n task_ids = np.expand_dims(task_id, axis=0)\n\n q_values, critic_infos = self.get_q_values(observations, actions, task_ids)\n q_value, critic_info = q_values[0], dict(q_value=critic_infos['q_values'][0])\n return q_value, critic_info\n\n def get_q_values(self, observations, actions, task_ids):\n \"\"\"\n Runs each set of observations through each task specific policy\n\n Args:\n observations (ndarray) : array of observations - shape: (batch_size, obs_dim)\n\n Returns:\n (ndarray) : array of sampled actions - shape: (batch_size, action_dim)\n \"\"\"\n\n assert observations.ndim == 2 and observations.shape[1] == self.ob_dim\n assert actions.ndim == 2 and actions.shape[1] == self.action_dim\n assert task_ids.ndim == 2 and task_ids.shape[1] == self.task_id_dim\n\n observations_actions_task_ids = np.concatenate([observations, actions, task_ids], axis=-1)\n\n sess = tf.get_default_session()\n main_q_values = sess.run([self.main_q_value_var],\n feed_dict={self.main_obs_acs_task_ids_var: observations_actions_task_ids})\n\n return main_q_values, dict(q_values=main_q_values)\n\n\n\n def get_next_q_value(self, next_observation, next_action, next_task_id):\n \"\"\"\n Runs a single observation through the specified policy and samples an action\n\n Args:\n observation (ndarray) : single observation - shape: (obs_dim,)\n\n Returns:\n (ndarray) : single action - shape: (action_dim,)\n \"\"\"\n next_observations = np.expand_dims(next_observation, axis=0)\n next_actions = np.expand_dims(next_action, axis=0)\n next_task_ids = np.expand_dims(next_task_id, axis=0)\n\n next_q_values, next_critic_infos = self.get_next_q_values(next_observations, next_actions, next_task_ids)\n next_q_value, next_critic_info = next_q_values[0], dict(next_q_value=critic_infos['next_q_values'][0])\n return next_q_value, next_critic_info\n\n def get_next_q_values(self, next_observations, next_actions, next_task_ids):\n \"\"\"\n Runs each set of observations through each task specific policy\n\n Args:\n observations (ndarray) : array of observations - shape: (batch_size, obs_dim)\n\n Returns:\n (ndarray) : array of sampled actions - shape: (batch_size, action_dim)\n \"\"\"\n assert next_observations.ndim == 2 and next_observations.shape[1] == self.ob_dim\n assert next_actions.ndim == 2 and next_actions.shape[1] == self.action_dim\n assert next_task_ids.ndim == 2 and next_task_ids.shape[1] == self.task_id_dim\n\n next_observations_actions_task_ids = np.concatenate([next_observations, next_actions, next_task_ids], axis=-1)\n\n sess = tf.get_default_session()\n target_q_values = sess.run([self.target_q_value_var],\n feed_dict={self.target_obs_acs_task_ids_var: next_observations_actions_task_ids})\n\n return target_q_values, dict(next_q_values=target_q_values)\n\n\n\n\n\n\n\n def update_target_critic_network(self, tau):\n update_ops = []\n for var_name, var in self.main_critic_params.items():\n target = self.target_critic_params['target_network'+var_name.split('main_network')[1]]\n op = tf.assign(target, tau* var.value() + (1-tau) * target.value())\n update_ops.append(op)\n\n sess = tf.get_default_session()\n sess.run(update_ops)\n\n\n\n" }, { "alpha_fraction": 0.5737470984458923, "alphanum_fraction": 0.5751739144325256, "avg_line_length": 31.79532241821289, "blob_id": "74bff721cd0673cfdf7b6bb73a1ea3f45e776370", "content_id": "c264bc7bb531869c7bd45ff53de5904d583bbf70", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 5607, "license_type": "no_license", "max_line_length": 109, "num_lines": 171, "path": "/meta_policy_search/critics/base.py", "repo_name": "Benjamin-eecs/promp_critic", "src_encoding": "UTF-8", "text": "from meta_policy_search.utils.utils import remove_scope_from_name\nfrom meta_policy_search.utils import Serializable\nimport tensorflow as tf\nfrom collections import OrderedDict\n\n\nclass Critic(Serializable):\n \"\"\"\n Args:\n obs_dim (int) : dimensionality of the observation space \n action_dim (int) : dimensionality of the action space \n\n name (str) : Name used for scoping variables in critic\n hidden_sizes (tuple) : size of hidden layers of network\n hidden_nonlinearity (Operation) : nonlinearity used between hidden layers of network\n output_nonlinearity (Operation) : nonlinearity used after the final layer of network\n \"\"\"\n def __init__(self,\n ob_dim,\n action_dim,\n task_id_dim,\n name,\n hidden_sizes =(32, 32),\n hidden_nonlinearity =tf.nn.relu,\n output_nonlinearity =None,\n **kwargs\n ):\n Serializable.quick_init(self, locals())\n\n self.ob_dim = ob_dim\n\n self.action_dim = action_dim\n self.task_id_dim = task_id_dim\n\n self.name = name\n\n\n\n\n self.hidden_sizes = hidden_sizes\n self.hidden_nonlinearity = hidden_nonlinearity\n self.output_nonlinearity = output_nonlinearity\n\n self.main_critic_params = None\n self.target_critic_params = None\n\n self._assign_ops = None\n self._assign_phs = None\n\n\n\n def build_graph(self):\n \"\"\"\n Builds computational graph for critic\n \"\"\"\n raise NotImplementedError\n\n def get_q_value(self, observation, action, task_id):\n \"\"\"\n Runs a single observation through the specified critic\n\n Args:\n observation (array) : single observation\n\n Returns:\n (array) : array of arrays of actions for each env\n \"\"\"\n raise NotImplementedError\n\n def get_q_values(self, observations, actions, task_ids):\n \"\"\"\n Runs each set of observations through each task specific critic\n\n Args:\n observations (array) : array of arrays of observations generated by each task and env\n\n Returns:\n (tuple) : array of arrays of actions for each env (meta_batch_size) x (batch_size) x (action_dim)\n and array of arrays of agent_info dicts \n \"\"\"\n raise NotImplementedError\n\n\n\n def get_next_q_value(self, next_observation, next_action, next_task_id):\n \"\"\"\n Runs a single observation through the specified critic\n\n Args:\n observation (array) : single observation\n\n Returns:\n (array) : array of arrays of actions for each env\n \"\"\"\n raise NotImplementedError\n\n def get_next_q_values(self, next_observations, next_actions, next_task_ids):\n \"\"\"\n Runs each set of observations through each task specific critic\n\n Args:\n observations (array) : array of arrays of observations generated by each task and env\n\n Returns:\n (tuple) : array of arrays of actions for each env (meta_batch_size) x (batch_size) x (action_dim)\n and array of arrays of agent_info dicts \n \"\"\"\n raise NotImplementedError\n\n\n def log_diagnostics(self, paths):\n \"\"\"\n Log extra information per iteration based on the collected paths\n \"\"\"\n pass\n\n\n \"\"\" --- methods for serialization --- \"\"\"\n\n def get_params(self):\n \"\"\"\n Get the tf.Variables representing the trainable weights of the network (symbolic)\n\n Returns:\n (dict) : a dict of all trainable Variables\n \"\"\"\n return self.main_critic_params\n\n def get_param_values(self):\n \"\"\"\n Gets a list of all the current weights in the network (in original code it is flattened, why?)\n\n Returns:\n (list) : list of values for parameters\n \"\"\"\n param_values = tf.get_default_session().run(self.main_critic_params)\n return param_values\n\n def set_params(self, critic_params):\n \"\"\"\n Sets the parameters for the graph\n\n Args:\n critic_params (dict): of variable names and corresponding parameter values\n \"\"\"\n assert all([k1 == k2 for k1, k2 in zip(self.get_params().keys(), critic_params.keys())]), \\\n \"parameter keys must match with variable\"\n\n if self._assign_ops is None:\n assign_ops, assign_phs = [], []\n for var in self.get_params().values():\n assign_placeholder = tf.placeholder(dtype=var.dtype)\n assign_op = tf.assign(var, assign_placeholder)\n assign_ops.append(assign_op)\n assign_phs.append(assign_placeholder)\n self._assign_ops = assign_ops\n self._assign_phs = assign_phs\n feed_dict = dict(zip(self._assign_phs, critic_params.values()))\n tf.get_default_session().run(self._assign_ops, feed_dict=feed_dict)\n\n def __getstate__(self):\n state = {\n 'init_args': Serializable.__getstate__(self),\n 'network_params': self.get_param_values()\n }\n return state\n\n def __setstate__(self, state):\n Serializable.__setstate__(self, state['init_args'])\n tf.get_default_session().run(tf.global_variables_initializer())\n self.set_params(state['network_params'])" }, { "alpha_fraction": 0.8166666626930237, "alphanum_fraction": 0.8166666626930237, "avg_line_length": 58.5, "blob_id": "39660b841439201ae83bfba10a1b55c7e6170bde", "content_id": "3204252d05a9c192b5a09beb3964a8403b929f78", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 120, "license_type": "no_license", "max_line_length": 62, "num_lines": 2, "path": "/meta_policy_search/meta_algos/__init__.py", "repo_name": "Benjamin-eecs/promp_critic", "src_encoding": "UTF-8", "text": "from meta_policy_search.meta_algos.base import MAMLAlgo\nfrom meta_policy_search.meta_algos.pro_mp_off import ProMP_off\n\n" }, { "alpha_fraction": 0.7857142686843872, "alphanum_fraction": 0.7857142686843872, "avg_line_length": 13, "blob_id": "b89041d31a2c138df2ccaeab389ae47e6fb8ff8d", "content_id": "0f837b3979b8d6e7bbd218d14a6c27bb36a8356e", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 28, "license_type": "no_license", "max_line_length": 14, "num_lines": 2, "path": "/README.md", "repo_name": "Benjamin-eecs/promp_critic", "src_encoding": "UTF-8", "text": "# promp_critic\npromp_critic\n" }, { "alpha_fraction": 0.5024903416633606, "alphanum_fraction": 0.5066993832588196, "avg_line_length": 48.14482879638672, "blob_id": "b4c477150503bc63f23e0464f4297be28fcba971", "content_id": "e1e72f8f9397f746cfde5d8c8a65d5f36128f0f0", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 14255, "license_type": "no_license", "max_line_length": 182, "num_lines": 290, "path": "/meta_policy_search/values/mlp_value.py", "repo_name": "Benjamin-eecs/promp_critic", "src_encoding": "UTF-8", "text": "from meta_policy_search.utils import Serializable, logger\nfrom meta_policy_search.utils.utils import remove_scope_from_name\n\nfrom meta_policy_search.values.networks.mlp import create_mlp\nfrom meta_policy_search.values.base import Value_net\n\n\n\nimport tensorflow as tf\nimport numpy as np\nfrom collections import OrderedDict\n\n\nclass MLPValue_net(Value_net):\n \"\"\"\n multi-layer perceptron value_net\n Provides functions for executing and updating value_net parameters\n\n Args:\n obs_dim (int) : dimensionality of the observation space \n task_dim(int)\n\n name (str) : name of the policy used as tf variable scope\n hidden_sizes (tuple) : tuple of integers specifying the hidden layer sizes of the MLP\n hidden_nonlinearity (tf.op) : nonlinearity function of the hidden layers\n output_nonlinearity (tf.op or None) : nonlinearity function of the output layer\n\n\n \"\"\"\n\n def __init__(self, value_learning_rate, num_value_steps, *args, **kwargs):\n # store the init args for serialization and call the super constructors\n Serializable.quick_init(self, locals())\n Value_net.__init__(self, *args, **kwargs)\n\n self.value_learning_rate = value_learning_rate\n self.num_value_steps = num_value_steps\n\n\n self.main_value_net_params = None\n self.value_net_params = None\n\n\n self.obs_task_ids_var = None\n self.value_net_var = None\n self.obs_task_ids_var = None\n self.value_net_var = None\n\n\n\n self.build_graph()\n self.create_TD_training_method()\n self.create_MC_training_method()\n\n\n def build_graph(self):\n \"\"\"\n Builds computational graph for value_net\n \"\"\"\n with tf.variable_scope(self.name):\n # build the actual value network\n self.main_obs_task_ids_var, self.main_value_net_var = create_mlp(name = 'main_network',\n output_dim = 1,\n hidden_sizes = self.hidden_sizes,\n hidden_nonlinearity = self.hidden_nonlinearity,\n output_nonlinearity = self.output_nonlinearity,\n input_dim = (None, self.ob_dim + self.task_id_dim,)\n )\n\n self.target_obs_task_ids_var, self.target_value_net_var = create_mlp(name = 'target_network',\n output_dim = 1,\n hidden_sizes = self.hidden_sizes,\n hidden_nonlinearity = self.hidden_nonlinearity,\n output_nonlinearity = self.output_nonlinearity,\n input_dim = (None, self.ob_dim + self.task_id_dim,)\n )\n\n # save the policy's trainable variables in dicts\n current_scope = tf.get_default_graph().get_name_scope()\n trainable_policy_vars = tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES, scope=current_scope)\n\n\n self.main_value_net_params = OrderedDict()\n self.target_value_net_params = OrderedDict()\n\n for var in trainable_policy_vars:\n if 'main_network' in remove_scope_from_name(var.name, current_scope):\n self.main_value_net_params[remove_scope_from_name(var.name, current_scope)] = var\n if 'target_network' in remove_scope_from_name(var.name, current_scope):\n self.target_value_net_params[remove_scope_from_name(var.name, current_scope)] = var\n #print(self.main_value_net_params)\n #print(self.target_value_net_params)\n\n\n\n def create_TD_training_method(self):\n\n self.rewards_phs = tf.placeholder(dtype=tf.float32, shape=[None,1], name='rewards')\n self.discounts_phs = tf.placeholder(dtype=tf.float32, shape=[None,1], name='discounts' )\n self.dones_phs = tf.placeholder(dtype=tf.float32, shape=[None,1], name='dones')\n self.next_state_values_phs = tf.placeholder(dtype=tf.float32, shape=[None,1], name='next_q_values_1')\n \n with tf.variable_scope('value_loss_TD'):\n\n self.target_state_values = tf.stop_gradient(self.rewards_phs + self.next_state_values_phs * self.discounts_phs * (1. - self.dones_phs))\n self.value_TD_objective = tf.reduce_mean(0.5 * tf.square(self.main_value_net_var - tf.stop_gradient(self.target_state_values)))\n\n self.TD_optimizer = tf.train.AdamOptimizer(learning_rate = self.value_learning_rate).minimize(self.value_TD_objective, var_list=self.main_value_net_params)\n\n def create_MC_training_method(self):\n\n self.disounted_rewards_phs = tf.placeholder(dtype=tf.float32, shape=[None,1], name='disounted_rewards')\n \n with tf.variable_scope('value_loss_MC'):\n self.value_MC_objective = tf.reduce_mean(0.5 * tf.square(self.main_value_net_var - tf.stop_gradient(self.disounted_rewards_phs)))\n self.MC_optimizer = tf.train.AdamOptimizer(learning_rate = self.value_learning_rate).minimize(self.value_MC_objective, var_list=self.main_value_net_params)\n\n\n\n def optimize_baseline_value(self, value_samples_data, fit_style, log=True):\n \"\"\"\n Performs TD or MC update\n\n Args:\n all_samples_data (list) : list of lists of lists of samples (each is a dict) split by gradient update and\n meta task\n log (bool) : whether to log statistics\n\n Returns:\n None\n \"\"\"\n\n\n\n\n '''\n next_q_values_1 = np.expand_dims(np.concatenate([path[\"next_q_values_1\"] for path in off_critic_samples_data]), axis=-1)\n next_q_values_2 = np.expand_dims(np.concatenate([path[\"next_q_values_2\"] for path in off_critic_samples_data]) , axis=-1)\n '''\n\n if log: logger.log(\"Optimizing Baseline ValueNet\")\n sess = tf.get_default_session()\n\n if fit_style == \"MC\":\n observations = np.concatenate([path[\"observations\"] for path in value_samples_data]) \n task_ids = np.concatenate([path[\"task_ids\"] for path in value_samples_data]) \n observations_task_ids = np.concatenate([observations, task_ids], axis=-1)\n discounted_rewards = np.expand_dims(np.concatenate([path[\"returns\"] for path in value_samples_data]), axis=-1) \n\n for epoch in range(self.num_value_steps):\n\n _, self.value_loss = sess.run([self.MC_optimizer, self.value_MC_objective], feed_dict= {self.disounted_rewards_phs : discounted_rewards,\n self.main_obs_task_ids_var : observations_task_ids\n\n })\n print(self.value_loss)\n elif fit_style == \"TD\":\n observations = np.concatenate([path[\"observations\"] for path in value_samples_data]) \n task_ids = np.concatenate([path[\"task_ids\"] for path in value_samples_data])\n observations_task_ids = np.concatenate([observations, task_ids], axis=-1)\n rewards = np.expand_dims(np.concatenate([path[\"rewards\"] for path in value_samples_data]), axis=-1)\n discounts = np.expand_dims(np.concatenate([path[\"discounts\"] for path in value_samples_data]), axis=-1) \n dones = np.expand_dims(np.concatenate([path[\"dones\"] for path in value_samples_data]) , axis=-1) \n next_state_values = np.expand_dims(np.concatenate([path[\"next_state_values\"] for path in value_samples_data]), axis=-1)\n \n for epoch in range(self.num_value_steps):\n\n _, self.value_loss = sess.run([self.TD_optimizer, self.value_TD_objective], feed_dict= { self.rewards_phs : rewards,\n self.discounts_phs : discounts,\n self.dones_phs : dones, \n self.next_state_values_phs : next_state_values,\n self.main_obs_task_ids_var : observations_task_ids\n })\n\n\n\n if log: logger.log(\"Computing Baseline ValueNet statistics\")\n\n if log:\n logger.log(\"*\"*40)\n logger.log(self.value_loss)\n logger.log(\"*\"*40)\n\n logger.logkv('VLoss_%s' % self.name, self.value_loss)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n def get_state_value(self, observation, task_id):\n \"\"\"\n Runs a single observation through the specified policy and samples an action\n\n Args:\n observation (ndarray) : single observation - shape: (obs_dim,)\n\n Returns:\n (ndarray) : single action - shape: (action_dim,)\n \"\"\"\n observations = np.expand_dims(observation, axis=0)\n task_ids = np.expand_dims(task_id, axis=0)\n\n state_values, value_infos = self.get_state_values(observations, task_ids)\n state_value, value_info = state_values[0], dict(state_value=value_infos['state_values'][0])\n return q_value, critic_info\n\n def get_state_values(self, observations, task_ids):\n \"\"\"\n Runs each set of observations through each task specific policy\n\n Args:\n observations (ndarray) : array of observations - shape: (batch_size, obs_dim)\n\n Returns:\n (ndarray) : array of sampled actions - shape: (batch_size, action_dim)\n \"\"\"\n\n assert observations.ndim == 2 and observations.shape[1] == self.ob_dim\n assert task_ids.ndim == 2 and task_ids.shape[1] == self.task_id_dim\n\n observations_task_ids = np.concatenate([observations, task_ids], axis=-1)\n\n sess = tf.get_default_session()\n state_values = sess.run([self.main_value_net_var],\n feed_dict={self.main_obs_task_ids_var: observations_task_ids})\n\n return state_values, dict(state_values=state_values)\n\n\n\n def get_next_state_value(self, next_observation, next_task_id):\n \"\"\"\n Runs a single observation through the specified policy and samples an action\n\n Args:\n observation (ndarray) : single observation - shape: (obs_dim,)\n\n Returns:\n (ndarray) : single action - shape: (action_dim,)\n \"\"\"\n next_observations = np.expand_dims(next_observation, axis=0)\n next_task_ids = np.expand_dims(next_task_id, axis=0)\n\n next_state_values, next_value_infos = self.get_next_state_values(next_observations, next_task_ids)\n next_state_value, next_value_info = next_state_values[0], dict(next_state_value=next_state_infos['next_state_values'][0])\n return next_state_value, next_value_info\n\n def get_next_state_values(self, next_observations, next_task_ids):\n \"\"\"\n Runs each set of observations through each task specific policy\n\n Args:\n observations (ndarray) : array of observations - shape: (batch_size, obs_dim)\n\n Returns:\n (ndarray) : array of sampled actions - shape: (batch_size, action_dim)\n \"\"\"\n assert next_observations.ndim == 2 and next_observations.shape[1] == self.ob_dim\n assert next_task_ids.ndim == 2 and next_task_ids.shape[1] == self.task_id_dim\n\n next_observations_task_ids = np.concatenate([next_observations, next_task_ids], axis=-1)\n\n sess = tf.get_default_session()\n target_q_values = sess.run([self.target_value_net_var],\n feed_dict={self.target_obs_task_ids_var: next_observations_task_ids})\n\n return target_q_values , dict(next_state_values=target_q_values)\n\n\n\n def update_target_value_network(self, tau):\n update_ops = []\n for var_name, var in self.main_value_net_params.items():\n target = self.target_value_net_params['target_network'+var_name.split('main_network')[1]]\n op = tf.assign(target, tau* var.value() + (1-tau) * target.value())\n update_ops.append(op)\n\n sess = tf.get_default_session()\n sess.run(update_ops)\n\n\n\n" }, { "alpha_fraction": 0.5426379442214966, "alphanum_fraction": 0.5457656979560852, "avg_line_length": 47.13920593261719, "blob_id": "74a9986349ce201ed38d21fe5b5aeb35aaf0162a", "content_id": "c8c983ee8fae6146c7c5a02d2e5d788e2bf41870", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 16945, "license_type": "no_license", "max_line_length": 184, "num_lines": 352, "path": "/meta_policy_search/samplers/meta_sampler_off.py", "repo_name": "Benjamin-eecs/promp_critic", "src_encoding": "UTF-8", "text": "from meta_policy_search.samplers.base import Sampler\nfrom meta_policy_search.samplers.vectorized_env_executor import MetaParallelEnvExecutor, MetaIterativeEnvExecutor\nfrom meta_policy_search.utils import utils, logger\n\nfrom collections import OrderedDict\n\nfrom pyprind import ProgBar\nimport numpy as np\nimport time\nimport itertools\n\n\n\n'''\nidx // self.envs_per_task, \nnp.asarray(running_paths[idx][\"observations\"]), \nnp.asarray(running_paths[idx][\"actions\"]),\nnp.asarray(running_paths[idx][\"rewards\"]),\nnp.asarray(running_paths[idx][\"next_observations\"]),\nnp.asarray(running_paths[idx][\"dones\"]),\nutils.stack_tensor_dict_list(running_paths[idx][\"env_infos\"]),\nutils.stack_tensor_dict_list(running_paths[idx][\"agent_infos\"])\n'''\nclass ReplayBuffer(object):\n def __init__(self, buffer_length, num_tasks, ob_dim, ac_dim, traj_length):\n self.buffer_length = int(buffer_length)\n self.num_tasks = num_tasks\n\n self.traj_len = traj_length\n \n self.ob_buffs = OrderedDict()\n self.ac_buffs = OrderedDict()\n self.rew_buffs = OrderedDict()\n self.next_ob_buffs = OrderedDict()\n self.done_buffs = OrderedDict()\n\n\n\n self.env_info_buffs = OrderedDict()\n self.agent_info_buffs = OrderedDict()\n\n self.return_buffs = OrderedDict()\n\n\n\n for i in range(self.num_tasks):\n self.ob_buffs[i] = np.zeros((self.buffer_length, ob_dim), dtype=np.float32)\n self.ac_buffs[i] = np.zeros((self.buffer_length, ac_dim), dtype=np.float32)\n self.rew_buffs[i] = np.zeros(self.buffer_length, dtype=np.float32)\n self.next_ob_buffs[i] = np.zeros((self.buffer_length, ob_dim), dtype=np.float32) \n self.done_buffs[i] = np.zeros(self.buffer_length, dtype=np.float32)\n\n self.return_buffs[i] = np.zeros(self.buffer_length, dtype=np.float32)\n\n self.env_info_buffs[i] = dict(reward_run=np.zeros(self.buffer_length, dtype=np.float32), reward_ctrl=np.zeros(self.buffer_length, dtype=np.float32))\n self.agent_info_buffs[i] = dict(mean =np.zeros((self.buffer_length, ac_dim), dtype=np.float32),log_std=np.zeros((self.buffer_length, ac_dim), dtype=np.float32))\n\n\n self.filled_i = [0]* self.num_tasks # index of first empty location in buffer (last index when full)\n self.curr_i = [0]* self.num_tasks # current index to write to (ovewrite oldest data)\n\n\n def push(self, task_id, observations, actions, rewards, next_observations, dones, env_infos, agent_infos, returns):\n nentries = observations.shape[0] # handle multiple parallel environments\n\n\n if self.curr_i[task_id] + nentries > self.buffer_length:\n rollover = self.buffer_length - self.curr_i[task_id] # num of indices to roll over\n\n self.ob_buffs[task_id] = np.roll(self.ob_buffs[task_id],\n rollover, axis=0)\n self.ac_buffs[task_id] = np.roll(self.ac_buffs[task_id],\n rollover, axis=0)\n self.rew_buffs[task_id] = np.roll(self.rew_buffs[task_id],\n rollover)\n self.next_ob_buffs[task_id] = np.roll(self.next_ob_buffs[task_id], \n rollover, axis=0)\n self.done_buffs[task_id] = np.roll(self.done_buffs[task_id],\n rollover)\n\n self.return_buffs[task_id] = np.roll(self.return_buffs[task_id],\n rollover)\n\n self.env_info_buffs[task_id]['reward_run'] = np.roll(self.env_info_buffs[task_id]['reward_run'],\n rollover)\n self.env_info_buffs[task_id]['reward_ctrl'] = np.roll(self.env_info_buffs[task_id]['reward_ctrl'],\n rollover)\n self.agent_info_buffs[task_id]['mean'] = np.roll(self.agent_info_buffs[task_id]['mean'],\n rollover, axis=0)\n self.agent_info_buffs[task_id]['log_std'] = np.roll(self.agent_info_buffs[task_id]['log_std'],\n rollover, axis=0)\n\n\n\n self.curr_i[task_id] = 0\n self.filled_i[task_id] = self.buffer_length\n\n self.ob_buffs[task_id][self.curr_i[task_id]:self.curr_i[task_id] + nentries] = observations\n self.ac_buffs[task_id][self.curr_i[task_id]:self.curr_i[task_id] + nentries] = actions\n self.rew_buffs[task_id][self.curr_i[task_id]:self.curr_i[task_id] + nentries] = rewards\n self.next_ob_buffs[task_id][self.curr_i[task_id]:self.curr_i[task_id] + nentries] = next_observations\n self.done_buffs[task_id][self.curr_i[task_id]:self.curr_i[task_id] + nentries] = dones\n\n self.return_buffs[task_id][self.curr_i[task_id]:self.curr_i[task_id] + nentries] = returns\n \n\n self.env_info_buffs[task_id]['reward_run'][self.curr_i[task_id]:self.curr_i[task_id] + nentries] = env_infos['reward_run']\n self.env_info_buffs[task_id]['reward_ctrl'][self.curr_i[task_id]:self.curr_i[task_id] + nentries] = env_infos['reward_ctrl']\n self.agent_info_buffs[task_id]['mean'][self.curr_i[task_id]:self.curr_i[task_id] + nentries] = agent_infos['mean']\n self.agent_info_buffs[task_id]['log_std'][self.curr_i[task_id]:self.curr_i[task_id] + nentries] = agent_infos['log_std']\n\n self.curr_i[task_id] += nentries\n if self.filled_i[task_id] < self.buffer_length:\n self.filled_i[task_id] += nentries\n if self.curr_i[task_id] == self.buffer_length:\n self.curr_i[task_id] = 0\n\n\n\n\n\n def sample(self, tasks_id, N):\n \n\n paths = OrderedDict()\n for meta_id, task_id in enumerate(tasks_id):\n\n if N > (min(self.filled_i) // self.traj_len)-1:\n inds = np.random.choice(np.arange((min(self.filled_i) // self.traj_len)-1), size=N, replace=True)\n elif N <= (min(self.filled_i) // self.traj_len)-1:\n inds = np.random.choice(np.arange((min(self.filled_i) // self.traj_len)-1), size=N, replace=False)\n paths[meta_id] = []\n for traj_id in list(inds):\n #print(self.done_buffs[task_id][np.arange(traj_id*self.traj_len,traj_id*self.traj_len+self.traj_len)][-1])\n paths[meta_id].append(dict(\n observations = self.ob_buffs[task_id][np.arange(traj_id*self.traj_len,traj_id*self.traj_len+self.traj_len)],\n actions = self.ac_buffs[task_id][np.arange(traj_id*self.traj_len,traj_id*self.traj_len+self.traj_len)],\n rewards = self.rew_buffs[task_id][np.arange(traj_id*self.traj_len,traj_id*self.traj_len+self.traj_len)],\n next_observations = self.next_ob_buffs[task_id][np.arange(traj_id*self.traj_len,traj_id*self.traj_len+self.traj_len)],\n env_infos = dict(reward_run = self.env_info_buffs[task_id]['reward_run'][np.arange(traj_id*self.traj_len,traj_id*self.traj_len+self.traj_len)],\n reward_ctrl = self.env_info_buffs[task_id]['reward_ctrl'][np.arange(traj_id*self.traj_len,traj_id*self.traj_len+self.traj_len)]),\n agent_infos = dict(mean = self.agent_info_buffs[task_id]['mean'][np.arange(traj_id*self.traj_len,traj_id*self.traj_len+self.traj_len)],\n log_std = self.agent_info_buffs[task_id]['log_std'][np.arange(traj_id*self.traj_len,traj_id*self.traj_len+self.traj_len)]),\n \n returns = self.return_buffs[task_id][np.arange(traj_id*self.traj_len,traj_id*self.traj_len+self.traj_len)],\n task_ids = np.expand_dims(np.eye(self.num_tasks)[task_id], axis=0).repeat(self.traj_len, axis=0),\n dones = self.done_buffs[task_id][np.arange(traj_id*self.traj_len,traj_id*self.traj_len+self.traj_len)],\n ))\n \n return paths\n\n\nclass MetaSampler_off(Sampler):\n \"\"\"\n Sampler for Meta-RL\n\n Args:\n env (meta_policy_search.envs.base.MetaEnv) : environment object\n policy (meta_policy_search.policies.base.Policy) : policy object\n batch_size (int) : number of trajectories per task\n meta_batch_size (int) : number of meta tasks\n max_path_length (int) : max number of steps per trajectory\n envs_per_task (int) : number of envs to run vectorized for each task (influences the memory usage)\n \"\"\"\n\n def __init__(\n self,\n env,\n policy,\n rollouts_per_meta_task,\n meta_batch_size,\n max_path_length,\n envs_per_task=None,\n parallel=False,\n buffer_length = 1e4,\n discount = 0.99,\n num_tasks=2\n ):\n super(MetaSampler_off, self).__init__(env, policy, rollouts_per_meta_task, max_path_length)\n assert hasattr(env, 'set_task')\n\n self.envs_per_task = rollouts_per_meta_task if envs_per_task is None else envs_per_task\n self.meta_batch_size = meta_batch_size\n self.total_samples = meta_batch_size * rollouts_per_meta_task * max_path_length\n self.parallel = parallel\n self.total_timesteps_sampled = 0\n self.num_tasks = num_tasks\n \n self.max_path_length = max_path_length\n self.discount = discount\n\n self.buffer_length = buffer_length\n self.ob_dim = np.prod(env.observation_space.shape)\n self.ac_dim = np.prod(env.action_space.shape)\n\n self.buffer = ReplayBuffer(self.buffer_length, self.num_tasks,\n self.ob_dim,\n self.ac_dim,\n self.max_path_length)\n\n # setup vectorized environment\n\n\n if self.parallel:\n self.vec_env = MetaParallelEnvExecutor(env, self.meta_batch_size, self.envs_per_task, self.max_path_length)\n else:\n self.vec_env = MetaIterativeEnvExecutor(env, self.meta_batch_size, self.envs_per_task, self.max_path_length)\n\n\n\n def set_seeds(self, seeds):\n self.vec_env.set_seeds(seeds)\n\n\n\n def update_tasks(self):\n \"\"\"\n Samples a new goal for each meta task\n \"\"\"\n tasks = self.env.sample_tasks(self.meta_batch_size)\n assert len(tasks) == self.meta_batch_size\n self.vec_env.set_tasks(tasks)\n\n\n def update_tasks_with_id(self):\n \"\"\"\n Samples a new goal for each meta task\n \"\"\"\n tasks, tasks_id = self.env.sample_tasks_with_id(self.meta_batch_size, return_id=True)\n assert len(tasks) == self.meta_batch_size\n self.vec_env.set_tasks(tasks)\n return tasks, tasks_id\n\n def obtain_samples(self, tasks_id, step_id, log=False, log_prefix=''):\n \"\"\"\n Collect batch_size trajectories from each task\n\n Args:\n log (boolean): whether to log sampling times\n log_prefix (str) : prefix for logger\n\n Returns: \n (dict) : A dict of paths of size [meta_batch_size] x (batch_size) x [5] x (max_path_length)\n \"\"\"\n\n # initial setup / preparation\n paths = OrderedDict()\n for i in range(self.meta_batch_size):\n paths[i] = []\n\n n_samples = 0\n running_paths = [_get_empty_running_paths_dict() for _ in range(self.vec_env.num_envs)]\n\n pbar = ProgBar(self.total_samples)\n policy_time, env_time = 0, 0\n\n policy = self.policy\n\n # initial reset of envs\n obses = self.vec_env.reset()\n \n while n_samples < self.total_samples:\n \n # execute policy\n t = time.time()\n obs_per_task = np.split(np.asarray(obses), self.meta_batch_size)\n actions, agent_infos = policy.get_actions(obs_per_task)\n policy_time += time.time() - t\n\n # step environments\n t = time.time()\n actions = np.concatenate(actions) # stack meta batch\n next_obses, rewards, dones, env_infos = self.vec_env.step(actions)\n env_time += time.time() - t\n \n\n # stack agent_infos and if no infos were provided (--> None) create empty dicts\n agent_infos, env_infos = self._handle_info_dicts(agent_infos, env_infos)\n\n new_samples = 0\n for idx, observation, action, reward, next_observation, env_info, agent_info, done in zip(itertools.count(), obses, actions,\n rewards, next_obses, env_infos, agent_infos,\n dones):\n # append new samples to running paths\n running_paths[idx][\"observations\"].append(observation)\n running_paths[idx][\"actions\"].append(action)\n running_paths[idx][\"rewards\"].append(reward)\n running_paths[idx][\"next_observations\"].append(next_observation)\n running_paths[idx][\"dones\"].append(done)\n\n\n running_paths[idx][\"env_infos\"].append(env_info)\n running_paths[idx][\"agent_infos\"].append(agent_info)\n\n\n\n # if running path is done, add it to paths and empty the running path\n if done:\n\n paths[idx // self.envs_per_task].append(dict(\n observations = np.asarray(running_paths[idx][\"observations\"]),\n actions = np.asarray(running_paths[idx][\"actions\"]),\n rewards = np.asarray(running_paths[idx][\"rewards\"]),\n task_ids = np.expand_dims(np.eye(self.num_tasks)[tasks_id[idx // self.envs_per_task]], axis=0).repeat(self.max_path_length, axis=0),\n env_infos = utils.stack_tensor_dict_list(running_paths[idx][\"env_infos\"]),\n agent_infos = utils.stack_tensor_dict_list(running_paths[idx][\"agent_infos\"]),\n ))\n\n discount_reward = utils.discount_cumsum(np.asarray(running_paths[idx][\"rewards\"]), self.discount)\n\n if step_id == 0:\n self.buffer.push(tasks_id[idx // self.envs_per_task], \n np.asarray(running_paths[idx][\"observations\"]), \n np.asarray(running_paths[idx][\"actions\"]),\n np.asarray(running_paths[idx][\"rewards\"]),\n np.asarray(running_paths[idx][\"next_observations\"]),\n np.asarray(running_paths[idx][\"dones\"]),\n utils.stack_tensor_dict_list(running_paths[idx][\"env_infos\"]),\n utils.stack_tensor_dict_list(running_paths[idx][\"agent_infos\"]),\n discount_reward\n )\n \n new_samples += len(running_paths[idx][\"rewards\"])\n running_paths[idx] = _get_empty_running_paths_dict()\n \n pbar.update(new_samples)\n n_samples += new_samples\n obses = next_obses\n pbar.stop()\n\n self.total_timesteps_sampled += self.total_samples\n if log:\n logger.logkv(log_prefix + \"PolicyExecTime\", policy_time)\n logger.logkv(log_prefix + \"EnvExecTime\", env_time)\n return paths\n\n def _handle_info_dicts(self, agent_infos, env_infos):\n if not env_infos:\n env_infos = [dict() for _ in range(self.vec_env.num_envs)]\n if not agent_infos:\n agent_infos = [dict() for _ in range(self.vec_env.num_envs)]\n else:\n assert len(agent_infos) == self.meta_batch_size\n assert len(agent_infos[0]) == self.envs_per_task\n agent_infos = sum(agent_infos, []) # stack agent_infos\n\n assert len(agent_infos) == self.meta_batch_size * self.envs_per_task == len(env_infos)\n return agent_infos, env_infos\n\n\ndef _get_empty_running_paths_dict():\n return dict(observations=[], actions=[], rewards=[], next_observations=[], dones=[], env_infos=[], agent_infos=[])\n" }, { "alpha_fraction": 0.8561151027679443, "alphanum_fraction": 0.8561151027679443, "avg_line_length": 68.25, "blob_id": "6ef88fe793e66c461c843ebf6aa6ef17955fa85f", "content_id": "dcf2868204c1069dd0a1b0da26dbc07de97ed669", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 278, "license_type": "no_license", "max_line_length": 89, "num_lines": 4, "path": "/meta_policy_search/samplers/__init__.py", "repo_name": "Benjamin-eecs/promp_critic", "src_encoding": "UTF-8", "text": "from meta_policy_search.samplers.base import Sampler\nfrom meta_policy_search.samplers.base import SampleProcessor\nfrom meta_policy_search.samplers.meta_sample_processor_off import MetaSampleProcessor_off\nfrom meta_policy_search.samplers.meta_sampler_off import MetaSampler_off\n\n" }, { "alpha_fraction": 0.6294060945510864, "alphanum_fraction": 0.6323032379150391, "avg_line_length": 48.261905670166016, "blob_id": "a2f82e7c5520010ffd55afcda94289e2d7d5082d", "content_id": "f66f01374599cda7baeb37e80afddf265137f63f", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 4142, "license_type": "no_license", "max_line_length": 154, "num_lines": 84, "path": "/meta_policy_search/samplers/meta_sample_processor_off.py", "repo_name": "Benjamin-eecs/promp_critic", "src_encoding": "UTF-8", "text": "from meta_policy_search.samplers.base import SampleProcessor\nfrom meta_policy_search.utils import utils\nimport numpy as np\n\nclass MetaSampleProcessor_off(SampleProcessor):\n\n def process_samples(self, off_sample, paths_meta_batch, log=False, log_prefix=''):\n \"\"\"\n Processes sampled paths. This involves:\n - computing discounted rewards (returns)\n - fitting baseline estimator using the path returns and predicting the return baselines\n - estimating the advantages using GAE (+ advantage normalization id desired)\n - stacking the path data\n - logging statistics of the paths\n\n Args:\n paths_meta_batch (dict): A list of dict of lists, size: [meta_batch_size] x (batch_size) x [5] x (max_path_length)\n log (boolean): indicates whether to log\n log_prefix (str): prefix for the logging keys\n\n Returns:\n (list of dicts) : Processed sample data among the meta-batch; size: [meta_batch_size] x [7] x (batch_size x max_path_length)\n \"\"\"\n\n #assert isinstance(off_sample, dict), 'paths must be a dict'\n assert isinstance(paths_meta_batch, dict), 'paths must be a dict'\n assert self.baseline, 'baseline must be specified'\n\n samples_data_meta_batch = []\n off_policy_samples_data_meta_batch = []\n\n all_paths = []\n\n for meta_task, paths in paths_meta_batch.items():\n value_data_meta_batch = []\n # fits baseline, compute advantages and stack path data\n samples_data, paths = self._compute_samples_data(paths)\n if isinstance(off_sample, dict):\n\n\n # critic\n #off_samples_data, off_paths = self._compute_samples_data_off_critic(off_sample.get(meta_task))\n \n\n value_data_meta_batch.append(samples_data)\n #self.baseline_value.optimize_baseline_value(value_data_meta_batch, self.baseline_value_fit_style)\n #value \n off_samples_data, off_paths = self._compute_samples_data_off_value(off_sample.get(meta_task))\n\n off_policy_samples_data_meta_batch.append(off_samples_data)\n\n samples_data_meta_batch.append(samples_data)\n \n all_paths.extend(paths)\n\n\n # optimize value network\n\n if isinstance(off_sample, dict):\n self.baseline_value.optimize_baseline_value(samples_data_meta_batch, self.baseline_value_fit_style)\n\n # 7) compute normalized trajectory-batch rewards (for E-MAML)\n overall_avg_reward = np.mean(np.concatenate([samples_data['rewards'] for samples_data in samples_data_meta_batch]))\n overall_avg_reward_std = np.std(np.concatenate([samples_data['rewards'] for samples_data in samples_data_meta_batch]))\n \n if isinstance(off_sample, dict):\n off_overall_avg_reward = np.mean(np.concatenate([off_samples_data['rewards'] for off_samples_data in off_policy_samples_data_meta_batch]))\n off_overall_avg_reward_std = np.std(np.concatenate([off_samples_data['rewards'] for off_samples_data in off_policy_samples_data_meta_batch]))\n for off_samples_data in off_policy_samples_data_meta_batch:\n off_samples_data['adj_avg_rewards'] = (off_samples_data['rewards'] - off_overall_avg_reward) / (off_overall_avg_reward_std + 1e-8)\n for samples_data in samples_data_meta_batch:\n samples_data['adj_avg_rewards'] = (samples_data['rewards'] - overall_avg_reward) / (overall_avg_reward_std + 1e-8)\n\n\n # 8) log statistics if desired\n undiscounted_returns_mean = self._log_path_stats(all_paths, log=log, log_prefix=log_prefix)\n\n if log_prefix == 'test-Step_1-':\n self.test_Step_1_AverageReturn.append(undiscounted_returns_mean)\n elif log_prefix == 'Step_1-':\n self.Step_1_AverageReturn.append(undiscounted_returns_mean)\n\n #print(off_policy_samples_data_meta_batch)\n return samples_data_meta_batch, off_policy_samples_data_meta_batch\n\n\n\n\n" }, { "alpha_fraction": 0.8392857313156128, "alphanum_fraction": 0.8392857313156128, "avg_line_length": 36.33333206176758, "blob_id": "218959b91aae510257577e4720d1651408356c27", "content_id": "851278b3fa39aa3f59df8584671bca747ed36751", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 112, "license_type": "no_license", "max_line_length": 59, "num_lines": 3, "path": "/meta_policy_search/critics/__init__.py", "repo_name": "Benjamin-eecs/promp_critic", "src_encoding": "UTF-8", "text": "from meta_policy_search.critics.base import Critic\n\nfrom meta_policy_search.critics.mlp_critic import MLPCritic\n" }, { "alpha_fraction": 0.8733333349227905, "alphanum_fraction": 0.8733333349227905, "avg_line_length": 74, "blob_id": "be907eb224a839a61e960ad57b93a64fd4bbfb44", "content_id": "6bf61b7c2ecb1f24b975c030c4d9f65af61014bd", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 150, "license_type": "no_license", "max_line_length": 92, "num_lines": 2, "path": "/meta_policy_search/optimizers/__init__.py", "repo_name": "Benjamin-eecs/promp_critic", "src_encoding": "UTF-8", "text": "from meta_policy_search.optimizers.base import Optimizer\nfrom meta_policy_search.optimizers.maml_first_order_optimizer import MAMLFirstOrderOptimizer\n" }, { "alpha_fraction": 0.5034160614013672, "alphanum_fraction": 0.5085278749465942, "avg_line_length": 49.23456954956055, "blob_id": "2b89170ac3d3e215829c34a85225363ca569eaf5", "content_id": "5d5be8ebd9057a22da2f747033fb7a60c0ecbc8c", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 20345, "license_type": "no_license", "max_line_length": 448, "num_lines": 405, "path": "/meta_policy_search/meta_algos/pro_mp_off.py", "repo_name": "Benjamin-eecs/promp_critic", "src_encoding": "UTF-8", "text": "from meta_policy_search.utils import logger\nfrom meta_policy_search.meta_algos.base import MAMLAlgo\nfrom meta_policy_search.optimizers.maml_first_order_optimizer import MAMLPPOOptimizer\n\nfrom meta_policy_search.optimizers.maml_first_order_optimizer import CriticOptimizer\n\nimport tensorflow as tf\nimport numpy as np\nfrom collections import OrderedDict\n\nclass ProMP_off(MAMLAlgo):\n \"\"\"\n ProMP Algorithm\n\n Args:\n policy (Policy): policy object\n name (str): tf variable scope\n learning_rate (float): learning rate for optimizing the meta-objective\n num_ppo_steps (int): number of ProMP steps (without re-sampling)\n num_minibatches (int): number of minibatches for computing the ppo gradient steps\n clip_eps (float): PPO clip range\n target_inner_step (float) : target inner kl divergence, used only when adaptive_inner_kl_penalty is true\n init_inner_kl_penalty (float) : initial penalty for inner kl\n adaptive_inner_kl_penalty (bool): whether to used a fixed or adaptive kl penalty on inner gradient update\n anneal_factor (float) : multiplicative factor for annealing clip_eps. If anneal_factor < 1, clip_eps <- anneal_factor * clip_eps at each iteration\n inner_lr (float) : gradient step size used for inner step\n meta_batch_size (int): number of meta-learning tasks\n num_inner_grad_steps (int) : number of gradient updates taken per maml iteration\n trainable_inner_step_size (boolean): whether make the inner step size a trainable variable\n\n \"\"\"\n def __init__(\n self,\n *args,\n\n name = \"ppo_maml\",\n learning_rate = 1e-3,\n \n discount = 0.99,\n critic_learning_rate = 1e-4,\n num_critic_steps = 1,\n\n num_ppo_steps = 5,\n num_minibatches = 1,\n clip_eps = 0.2,\n target_inner_step = 0.01,\n init_inner_kl_penalty = 1e-2,\n adaptive_inner_kl_penalty = True,\n anneal_factor = 1.0,\n off_clip_eps_upper = 0.6,\n off_clip_eps_lower = 0.6,\n clip_style = 0,\n **kwargs\n ):\n super(ProMP_off, self).__init__(*args, **kwargs)\n\n\n\n\n\n self.discount = discount\n self.optimizer = MAMLPPOOptimizer(learning_rate =learning_rate, max_epochs=num_ppo_steps, num_minibatches=num_minibatches)\n self.clip_eps = clip_eps\n\n self.off_clip_eps_upper = off_clip_eps_upper\n self.off_clip_eps_lower = off_clip_eps_lower\n self.clip_style = clip_style\n\n\n self.target_inner_step = target_inner_step\n self.adaptive_inner_kl_penalty = adaptive_inner_kl_penalty\n self.inner_kl_coeff = init_inner_kl_penalty * np.ones(self.num_inner_grad_steps)\n self.anneal_coeff = 1\n self.anneal_factor = anneal_factor\n\n self._optimization_keys = ['observations', 'actions', 'advantages', 'agent_infos']\n\n self._value_optimization_keys = ['observations', 'actions', 'value_advantages', 'agent_infos']\n\n\n self._critic_optimization_keys = ['observations', 'actions', 'rewards', 'next_observations', 'next_actions', 'dones', 'discounts', 'task_ids', 'next_task_ids', 'current_q_values_1', 'current_q_values_2', 'next_q_values_1', 'next_q_values_2', 'agent_infos']\n\n self.name = name\n self.kl_coeff = [init_inner_kl_penalty] * self.meta_batch_size * self.num_inner_grad_steps\n\n self.build_graph()\n\n def _adapt_objective_sym(self, action_sym, adv_sym, dist_info_old_sym, dist_info_new_sym):\n with tf.variable_scope(\"likelihood_ratio\"):\n likelihood_ratio_adapt = self.policy.distribution.likelihood_ratio_sym(action_sym,\n dist_info_old_sym, dist_info_new_sym)\n with tf.variable_scope(\"surrogate_loss\"):\n #print(tf.shape(likelihood_ratio_adapt * adv_sym))\n surr_obj_adapt = -tf.reduce_mean(likelihood_ratio_adapt * adv_sym)\n \n return surr_obj_adapt\n\n def _adapt_objective_sym_off_value(self, action_sym, value_adv_sym, dist_info_old_sym, dist_info_new_sym):\n with tf.variable_scope(\"likelihood_ratio\"):\n likelihood_ratio_adapt = self.policy.distribution.likelihood_ratio_sym(action_sym,\n dist_info_old_sym, dist_info_new_sym)\n\n\n with tf.variable_scope(\"surrogate_loss\"):\n clip_obj_adapt_value = tf.minimum(likelihood_ratio_adapt *value_adv_sym,\n tf.clip_by_value(likelihood_ratio_adapt,\n 1 - self.off_clip_eps_lower,\n 1 + self.off_clip_eps_upper) * value_adv_sym)\n\n surr_obj_adapt_value = -tf.reduce_mean(clip_obj_adapt_value)\n return surr_obj_adapt_value\n\n\n\n def _adapt_objective_sym_off_critic(self, obs_sym, actions_sym, rewards_sym, next_obs_sym, next_actions_sym, dones_sym, discounts_sym, task_ids_sym, next_task_ids_sym, current_q_values_1_sym, current_q_values_2_sym, next_q_values_1_sym, next_q_values_2_sym, dist_infos_old_sym, dist_infos_new_sym):\n\n\n\n with tf.variable_scope(\"likelihood_ratio\"):\n likelihood_ratio_adapt = self.policy.distribution.likelihood_ratio_sym(actions_sym,\n dist_infos_old_sym, dist_infos_new_sym)\n\n with tf.variable_scope(\"adv_approximation\"):\n\n current_q_value_min_sym = tf.stop_gradient(tf.minimum(current_q_values_1_sym, current_q_values_2_sym))\n next_q_value_min_sym = tf.stop_gradient(tf.minimum(next_q_values_1_sym, next_q_values_2_sym))\n td_error = rewards_sym + discounts_sym * next_q_value_min_sym - current_q_value_min_sym \n \n\n with tf.variable_scope(\"surrogate_loss\"):\n clip_obj_adapt_critic = tf.minimum(likelihood_ratio_adapt * td_error,\n tf.clip_by_value(likelihood_ratio_adapt,\n 1 - self.off_clip_eps_lower,\n 1 + self.off_clip_eps_upper) * td_error)\n #print(tf.shape(clip_obj_adapt_critic))\n surr_obj_adapt_critic = -tf.reduce_mean(clip_obj_adapt_critic)\n return surr_obj_adapt_critic\n\n\n\n def build_graph(self):\n \"\"\"\n Creates the computation graph\n \"\"\"\n\n \"\"\" Create Variables \"\"\"\n with tf.variable_scope(self.name):\n self.step_sizes = self._create_step_size_vars()\n\n \"\"\" --- Build inner update graph for adapting the policy and sampling trajectories --- \"\"\"\n\n\n # this graph is only used for adapting the policy and not computing the meta-updates\n #self.adapted_policies_params, self.adapt_input_ph_dict, self.adapt_input_ph_dict_off = self._build_inner_adaption_off()\n\n #self.adapted_policies_params, self.adapt_input_ph_dict, self.adapt_input_ph_dict_off_critic = self._build_inner_adaption_off_critic()\n self.adapted_policies_params, self.adapt_input_ph_dict, self.adapt_input_ph_dict_off_value = self._build_inner_adaption_off_value()\n\n\n self.test_adapted_policies_params, self.test_adapt_input_ph_dict = self._build_inner_adaption()\n\n \"\"\" ----- Build graph for the meta-update ----- \"\"\"\n self.meta_op_phs_dict = OrderedDict()\n obs_phs, action_phs, adv_phs, dist_info_old_phs, all_phs_dict = self._make_input_placeholders('step0')\n\n obs_phs_off_value, action_phs_off_value, value_adv_phs_off_value, dist_info_old_phs_off_value, all_phs_dict_off_value = self._make_input_placeholders_off_value('step2')\n\n\n '''\n\n obs_phs_off, \\\n actions_phs_off,\\\n rews_phs_off, \\\n next_obs_phs_off, \\\n next_actions_phs_off, \\\n dones_phs_off,\\\n discounts_phs_off,\\\n task_ids_phs_off, \\\n next_task_ids_phs_off,\\\n current_q_values_1_phs_off, \\\n current_q_values_2_phs_off, \\\n next_q_values_1_phs_off, \\\n next_q_values_2_phs_off, \\\n dist_infos_old_phs_off, \\\n all_phs_dict_off = self._make_input_placeholders_critic('step2')\n '''\n\n\n\n\n\n self.meta_op_phs_dict.update(all_phs_dict)\n self.meta_op_phs_dict.update(all_phs_dict_off_value)\n \n \n distribution_info_vars, distribution_infos_vars_off_value, current_policy_params = [], [], []\n all_surr_objs, all_inner_kls = [], []\n\n for i in range(self.meta_batch_size):\n dist_info_sym = self.policy.distribution_info_sym(obs_phs[i], params=None)\n distribution_info_vars.append(dist_info_sym) # step 0\n\n dist_infos_sym_off_value = self.policy.distribution_info_sym(obs_phs_off_value[i], params=None)\n distribution_infos_vars_off_value.append(dist_infos_sym_off_value) # step 2\n\n current_policy_params.append(self.policy.policy_params) # set to real policy_params (tf.Variable)\n\n with tf.variable_scope(self.name):\n \"\"\" Inner updates\"\"\"\n for step_id in range(1, self.num_inner_grad_steps+1):\n surr_objs, kls, adapted_policy_params = [], [], []\n\n # inner adaptation step for each task\n for i in range(self.meta_batch_size):\n surr_loss = self._adapt_objective_sym(action_phs[i], adv_phs[i], dist_info_old_phs[i], distribution_info_vars[i])\n\n #surr_loss_off_critic = self._adapt_objective_sym_off_critic(obs_phs_off[i], actions_phs_off[i], rews_phs_off[i], next_obs_phs_off[i], next_actions_phs_off[i], dones_phs_off[i], discounts_phs_off[i], task_ids_phs_off[i], next_task_ids_phs_off[i], current_q_values_1_phs_off[i], current_q_values_2_phs_off[i], next_q_values_1_phs_off[i], next_q_values_2_phs_off[i], dist_infos_old_phs_off[i], distribution_infos_vars_off[i])\n\n surr_loss_off_value = self._adapt_objective_sym_off_value(action_phs_off_value[i], value_adv_phs_off_value[i], dist_info_old_phs_off_value[i], distribution_infos_vars_off_value[i])\n\n\n kl_loss = tf.reduce_mean(self.policy.distribution.kl_sym(dist_info_old_phs[i], distribution_info_vars[i]))\n \n #kl_loss_off = tf.reduce_mean(self.policy.distribution.kl_sym(dist_info_old_phs_off[i], distribution_info_vars[i]))\n\n surr_loss_all = 0.5 * surr_loss + 0.5 * surr_loss_off_value\n adapted_params_var = self._adapt_sym(surr_loss_all, current_policy_params[i])\n\n adapted_policy_params.append(adapted_params_var)\n kls.append(kl_loss)\n surr_objs.append(surr_loss)\n\n all_surr_objs.append(surr_objs)\n all_inner_kls.append(kls)\n\n # Create new placeholders for the next step\n obs_phs, action_phs, adv_phs, dist_info_old_phs, all_phs_dict = self._make_input_placeholders('step%i' % step_id)\n self.meta_op_phs_dict.update(all_phs_dict)\n\n # dist_info_vars_for_next_step\n distribution_info_vars = [self.policy.distribution_info_sym(obs_phs[i], params=adapted_policy_params[i])\n for i in range(self.meta_batch_size)]\n current_policy_params = adapted_policy_params\n\n # per step: compute mean of kls over tasks\n mean_inner_kl_per_step = tf.stack([tf.reduce_mean(tf.stack(inner_kls)) for inner_kls in all_inner_kls])\n\n \"\"\" Outer objective \"\"\"\n surr_objs, outer_kls = [], []\n\n # Create placeholders\n inner_kl_coeff = tf.placeholder(tf.float32, shape=[self.num_inner_grad_steps], name='inner_kl_coeff')\n self.meta_op_phs_dict['inner_kl_coeff'] = inner_kl_coeff\n\n clip_eps_ph = tf.placeholder(tf.float32, shape=[], name='clip_eps')\n self.meta_op_phs_dict['clip_eps'] = clip_eps_ph\n\n # meta-objective\n for i in range(self.meta_batch_size):\n likelihood_ratio = self.policy.distribution.likelihood_ratio_sym(action_phs[i], dist_info_old_phs[i],\n distribution_info_vars[i])\n outer_kl = tf.reduce_mean(self.policy.distribution.kl_sym(dist_info_old_phs[i], distribution_info_vars[i]))\n\n # clipped likelihood ratio\n clipped_obj = tf.minimum(likelihood_ratio * adv_phs[i],\n tf.clip_by_value(likelihood_ratio,\n 1 - clip_eps_ph,\n 1 + clip_eps_ph) * adv_phs[i])\n surr_obj = - tf.reduce_mean(clipped_obj)\n\n\n surr_objs.append(surr_obj)\n outer_kls.append(outer_kl)\n\n\n\n\n mean_outer_kl = tf.reduce_mean(tf.stack(outer_kls))\n inner_kl_penalty = tf.reduce_mean(inner_kl_coeff * mean_inner_kl_per_step)\n\n \"\"\" Mean over meta tasks \"\"\"\n meta_objective = tf.reduce_mean(tf.stack(surr_objs, 0)) + inner_kl_penalty\n\n self.optimizer.build_graph(\n loss = meta_objective,\n target = self.policy,\n input_ph_dict = self.meta_op_phs_dict,\n inner_kl = mean_inner_kl_per_step,\n outer_kl = mean_outer_kl,\n )\n '''\n obs_phs_critic_op, \\\n actions_phs_critic_op,\\\n rews_phs_critic_op, \\\n next_obs_phs_critic_op, \\\n next_actions_phs_critic_op, \\\n dones_phs_critic_op,\\\n discounts_phs_critic_op,\\\n task_ids_phs_critic_op, \\\n next_task_ids_phs_critic_op,\\\n current_q_values_1_phs_critic_op, \\\n current_q_values_2_phs_critic_op, \\\n next_q_values_1_phs_critic_op, \\\n next_q_values_2_phs_critic_op, \\\n dist_infos_old_phs_critic_op, \\\n all_phs_dict_critic_op = self._make_input_placeholders_critic('critic_op')\n\n\n\n self.critic_1_phs_dict = OrderedDict()\n self.critic_2_phs_dict = OrderedDict()\n\n self.critic_1_phs_dict.update(all_phs_dict_critic_op)\n self.critic_2_phs_dict.update(all_phs_dict_critic_op)\n\n critic_1_objs = []\n critic_2_objs = []\n\n for i in range(self.meta_batch_size):\n\n\n critic_1_objective, critic_2_objective = self._critic_objective_sym(obs_phs_critic_op[i],\n actions_phs_critic_op[i],\n rews_phs_critic_op[i],\n next_obs_phs_critic_op[i],\n next_actions_phs_critic_op[i],\n dones_phs_critic_op[i],\n discounts_phs_critic_op[i],\n task_ids_phs_critic_op[i],\n next_task_ids_phs_critic_op[i],\n current_q_values_1_phs_critic_op[i],\n current_q_values_2_phs_critic_op[i],\n next_q_values_1_phs_critic_op[i],\n next_q_values_2_phs_critic_op[i],\n dist_infos_old_phs_critic_op[i])\n critic_1_objs.append(critic_1_objective)\n critic_2_objs.append(critic_2_objective)\n\n\n self.critic_1_optimizer.build_graph(\n loss = tf.reduce_mean(tf.stack(critic_1_objs, 0)),\n target = self.critic_1,\n input_ph_dict = self.critic_1_phs_dict,\n )\n\n self.critic_2_optimizer.build_graph(\n loss = tf.reduce_mean(tf.stack(critic_2_objs, 0)),\n target = self.critic_2,\n input_ph_dict = self.critic_2_phs_dict,\n )\n \n '''\n\n\n\n def optimize_policy(self, all_samples_data, log=True):\n \"\"\"\n Performs MAML outer step\n\n Args:\n all_samples_data (list) : list of lists of lists of samples (each is a dict) split by gradient update and\n meta task\n log (bool) : whether to log statistics\n\n Returns:\n None\n \"\"\"\n meta_op_input_dict = self._extract_input_dict_meta_op(all_samples_data, self._optimization_keys, self._value_optimization_keys)\n\n # add kl_coeffs / clip_eps to meta_op_input_dict\n meta_op_input_dict['inner_kl_coeff'] = self.inner_kl_coeff\n\n meta_op_input_dict['clip_eps'] = self.clip_eps\n\n if log: logger.log(\"Optimizing\")\n loss_before = self.optimizer.optimize(input_val_dict=meta_op_input_dict)\n\n if log: logger.log(\"Computing statistics\")\n loss_after, inner_kls, outer_kl = self.optimizer.compute_stats(input_val_dict=meta_op_input_dict)\n\n if self.adaptive_inner_kl_penalty:\n if log: logger.log(\"Updating inner KL loss coefficients\")\n self.inner_kl_coeff = self.adapt_kl_coeff(self.inner_kl_coeff, inner_kls, self.target_inner_step)\n\n\n if log:\n logger.logkv('LossBefore', loss_before)\n logger.logkv('LossAfter', loss_after)\n logger.logkv('KLInner', np.mean(inner_kls))\n logger.logkv('KLCoeffInner', np.mean(self.inner_kl_coeff))\n\n def adapt_kl_coeff(self, kl_coeff, kl_values, kl_target):\n if hasattr(kl_values, '__iter__'):\n assert len(kl_coeff) == len(kl_values)\n return np.array([_adapt_kl_coeff(kl_coeff[i], kl, kl_target) for i, kl in enumerate(kl_values)])\n else:\n return _adapt_kl_coeff(kl_coeff, kl_values, kl_target)\n\ndef _adapt_kl_coeff(kl_coeff, kl, kl_target):\n if kl < kl_target / 1.5:\n kl_coeff /= 2\n\n elif kl > kl_target * 1.5:\n kl_coeff *= 2\n return kl_coeff\n" }, { "alpha_fraction": 0.8333333134651184, "alphanum_fraction": 0.8333333134651184, "avg_line_length": 56, "blob_id": "6c9f31a3364b64e58e30b66748ccdb94fa3ccb3c", "content_id": "109a17373af61b0be976bda4aa9ac4cd45db8b51", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 114, "license_type": "no_license", "max_line_length": 60, "num_lines": 2, "path": "/meta_policy_search/values/__init__.py", "repo_name": "Benjamin-eecs/promp_critic", "src_encoding": "UTF-8", "text": "from meta_policy_search.values.base import Value_net\nfrom meta_policy_search.values.mlp_value import MLPValue_net\n" } ]
12
GreenBankObservatory/django-import-data
https://github.com/GreenBankObservatory/django-import-data
583e361b72c1625b5907f528eb2a8cdde51ba0c4
927c31a93514b85224ae17ccb1f8ef34cdc41576
015c7bab9de4346ce92a9004f72ed276122a488b
refs/heads/master
2022-12-26T08:16:39.910389
2022-12-14T04:04:02
2022-12-14T04:04:02
163,696,241
1
0
MIT
2018-12-31T20:39:01
2022-09-22T16:41:41
2022-09-22T16:43:37
Python
[ { "alpha_fraction": 0.5761866569519043, "alphanum_fraction": 0.5861158967018127, "avg_line_length": 38.38779067993164, "blob_id": "102cd37660566db50977c5c2c946cdeb176ddcb7", "content_id": "a009711fcb5d3f2f10603a70519390f58061b4c5", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 23869, "license_type": "permissive", "max_line_length": 134, "num_lines": 606, "path": "/example_project/cases/tests.py", "repo_name": "GreenBankObservatory/django-import-data", "src_encoding": "UTF-8", "text": "from collections import OrderedDict\nfrom io import StringIO\n\nfrom django.test import TestCase\n\nfrom django_import_data import FormMapSet\nfrom django_import_data.formmapset import flatten_dependencies\nfrom django.contrib.contenttypes.models import ContentType\n\nfrom .models import Case, Person, Structure\nfrom importers.example_data_source.form_maps import (\n CaseFormMap,\n PersonFormMap,\n StructureFormMap,\n)\nfrom cases.management.commands.import_example_data import Command\n\nfrom .forms import StructureForm\nfrom django_import_data.models import (\n FileImporter,\n FileImportAttempt,\n FileImporterBatch,\n RowData,\n ModelImporter,\n ModelImportAttempt,\n)\n\n\nrow = {\n \"first_name\": \"Foo\",\n \"middle_name\": \"Bar\",\n \"last_name\": \"Baz\",\n \"email\": \"foo@bar.baz\",\n \"case_num\": \"1\",\n \"completed\": \"True\",\n \"type\": \"A 1\",\n \"afsdf.\": \"123 Foobar St, Atlanta, GA, 30078\",\n \"letter1\": \"/home/foo/foo.txt\",\n \"latitude\": \"38.7\",\n \"longitude\": \"78.1\",\n}\n\n\n# class TestFormMaps(TestCase):\n# def test_person_form_map(self):\n# form_map = PersonFormMap()\n# person = form_map.save(row)\n# self.assertEqual(\n# # Just compare string representations since we can't do DB-level\n# # comparisons here (Django uses pk values for equality)\n# str(person),\n# str(Person(name=\"Foo Bar Baz\", email=\"foo@bar.baz\")),\n# )\n\n# def test_case_form_map(self):\n# form_map = CaseFormMap()\n# case = form_map.save(row)\n# self.assertEqual(\n# # Just compare string representations since we can't do DB-level\n# # comparisons here (Django uses pk values for equality)\n# str(case),\n# str(Case(case_num=1)),\n# )\n\n# def test_structure_form_map(self):\n# form_map = StructureFormMap()\n# structure = form_map.save(row)\n# self.assertEqual(\n# # Just compare string representations since we can't do DB-level\n# # comparisons here (Django uses pk values for equality)\n# str(structure),\n# str(Structure(location=(\"38.7\", \"78.1\"))),\n# )\n\n\n# class TestFormMapSets(TestCase):\n# # def setUp(self):\n# # self.person_form_map = PersonFormMap()\n# # self.case_form_map = CaseFormMap()\n\n# def test_foo(self):\n# fms = FormMapSet(\n# form_maps={\"applicant\": PersonFormMap(), \"case\": CaseFormMap()},\n# dependencies={\"case\": (\"applicant\",)},\n# )\n# fms.report()\n# foo = fms.render(row)\n# print(foo)\n\n# def test_flatten(self):\n# print(flatten_dependencies({\"case\": (\"applicant\",)}))\n\n\n# class TestStructureForm(TestCase):\n# def test(self):\n# sf = StructureForm({\"longitude\": \"30\", \"latitude\": \"70\"})\n# print(sf.data)\n# print(sf.is_valid())\n# print(sf.errors.as_data())\n\n\n# class TestCaseAuditGroup(TestCase):\n# # def setUp(self):\n# # self.case = Case.objects.create(case_num=123)\n\n# def test_foo(self):\n# case = Case.objects.create_with_audit(case_num=123)\n# self.assertIsInstance(case, Case)\n# self.assertIsInstance(case.audit_group, GenericAuditGroup)\n\n\n# class TestGenericAuditGroupBatch(TestCase):\n# def setUp(self):\n# self.csv1 = {\n# \"first_name\": \"Thomas\",\n# \"middle_name\": \"Bar\",\n# \"last_name\": \"Baz\",\n# \"phone_number\": \"123456789\",\n# \"email\": \"thomas@thomas.com\",\n# \"case_num\": \"CASE#123123\",\n# \"latitude\": \"38.1\",\n# \"longitude\": \"72.8\",\n# }\n\n# self.csv2 = {\n# \"first_name\": \"Bill\",\n# # NOTE: Missing middle_name!\n# # \"middle_name\": \"Bar\",\n# \"last_name\": \"Baz\",\n# \"phone\": \"758586998\",\n# # NOTE: Invalid email!\n# \"email\": \"foo@bar\",\n# \"case\": \"CASE#456456\",\n# \"latitude\": \"38.2\",\n# \"longitude\": \"78.5\",\n# }\n\n# self.cfm = CaseFormMap()\n# self.pfm = PersonFormMap()\n# self.sfm = StructureFormMap()\n\n# def test_clean(self):\n# row_data = RowData.objects.create(data=self.csv1)\n# batch = GenericAuditGroupBatch.objects.create()\n# batch_import = batch.gen_import(path=\"/test/\")\n# self.assertEqual(batch_import.genericauditgroup_audit_groups.count(), 0)\n\n# applicant, applicant_audit = self.pfm.save_with_audit(\n# self.csv1, row_data=row_data, batch_import=batch_import\n# )\n# self.assertIsNotNone(applicant)\n# self.assertEqual(applicant.name, \"Thomas Bar Baz\")\n# self.assertEqual(batch_import.genericauditgroup_audit_groups.count(), 1)\n\n# structure, structure_audit = self.sfm.save_with_audit(\n# self.csv1,\n# row_data=row_data,\n# extra={\"applicant\": applicant.id if applicant else None},\n# batch_import=batch_import,\n# )\n# self.assertIsNotNone(structure)\n# self.assertEqual(structure.location, \"(38.1, 72.8)\")\n# self.assertEqual(batch_import.genericauditgroup_audit_groups.count(), 2)\n\n# case, case_audit = self.cfm.save_with_audit(\n# self.csv1,\n# row_data=row_data,\n# extra={\"applicant\": applicant.id, \"structure\": structure.id},\n# batch_import=batch_import,\n# )\n# self.assertIsNotNone(case)\n# self.assertEqual(case.case_num, 123_123)\n\n# self.assertEqual(batch_import.genericauditgroup_audit_groups.count(), 3)\n\n# self.assertEqual(batch_import.status, \"created_clean\")\n\n# def test_error_in_applicant(self):\n# row_data = RowData.objects.create(data=self.csv2)\n# batch = GenericAuditGroupBatch.objects.create()\n# batch_import = batch.gen_import(path=\"/test/\")\n# self.assertEqual(batch_import.genericauditgroup_audit_groups.count(), 0)\n\n# applicant, applicant_audit = self.pfm.save_with_audit(\n# self.csv2, row_data=row_data, batch_import=batch_import\n# )\n# # No applicant should have been created, because we expect there to be errors\n# self.assertIsNone(applicant)\n# # There should instead be an Audit created\n# self.assertIsNotNone(applicant_audit)\n\n# # Exactly one conversion error should have occurred\n# self.assertEqual(len(applicant_audit.errors[\"conversion_errors\"]), 1)\n# # We expect this error's value to be about an unmapped header\n# self.assertEqual(\n# next(iter(applicant_audit.errors[\"conversion_errors\"].values())),\n# \"ValueError('Unmapped headers!',)\",\n# )\n\n# # Exactly one form error should be reported\n# self.assertEqual(len(applicant_audit.errors[\"form_errors\"]), 1)\n# # We expect this error to be for the email field\n# self.assertEqual(applicant_audit.errors[\"form_errors\"][0][\"field\"], \"email\")\n\n# # Audit group should still be created\n# self.assertEqual(batch_import.genericauditgroup_audit_groups.count(), 1)\n\n# # We expect the batch imported to be \"rejected\", since at least\n# # error occurred\n# self.assertEqual(batch_import.status, \"rejected\")\n\n# # We expect the AuditGroup status to be rejected also\n# self.assertEqual(\n# batch_import.genericauditgroup_audit_groups.first().status, \"rejected\"\n# )\n\n# # And, of course, there should be a single Audit created...\n# self.assertEqual(\n# batch_import.genericauditgroup_audit_groups.first().audits.count(), 1\n# )\n# # ...with a rejected status\n# self.assertEqual(\n# batch_import.genericauditgroup_audit_groups.first().audits.first().status,\n# \"rejected\",\n# )\n\n\nclass TestSanity(TestCase):\n def test_sanity(self):\n path = \"/foo/bar.txt\"\n file_importer, file_import_attempt = FileImporter.objects.create_with_attempt(\n path=path, importer_name=\"TestSanity\"\n )\n self.assertIsNotNone(file_importer)\n self.assertEqual(file_importer.latest_file_import_attempt.imported_from, path)\n self.assertIsNotNone(file_import_attempt)\n self.assertEqual(file_import_attempt.imported_from, path)\n\n row_data = RowData.objects.create(\n file_import_attempt=file_import_attempt, row_num=0, data={\"foo\": \"bar\"}\n )\n\n case_importer, case_import_attempt = ModelImporter.objects.create_with_attempt(\n model=Case,\n importee_field_data={\"foo\": \"bar\"},\n errors={},\n error_summary={},\n row_data=row_data,\n imported_by=\"TestSanity\",\n )\n\n self.assertIsNone(case_import_attempt.importee)\n case = Case.objects.create(\n case_num=123, model_import_attempt=case_import_attempt, subtype=1\n )\n self.assertIsNotNone(case_import_attempt.importee)\n self.assertIn(case_importer, row_data.model_importers.all())\n self.assertEqual(row_data.model_importers.count(), 1)\n\n structer_importer, structure_import_attempt = ModelImporter.objects.create_with_attempt(\n model=Structure,\n row_data=row_data,\n importee_field_data={\"foo\": \"bar\"},\n errors={},\n error_summary={},\n imported_by=\"TestSanity\",\n )\n\n self.assertIsNone(structure_import_attempt.importee)\n structure = Structure.objects.create(\n location=\"foo\", model_import_attempt=structure_import_attempt\n )\n self.assertIsNotNone(structure_import_attempt.importee)\n\n self.assertIn(structer_importer, row_data.model_importers.all())\n self.assertEqual(row_data.model_importers.count(), 2)\n\n self.assertEqual(Structure.objects.count(), 1)\n\n with self.assertRaisesRegex(ValueError, \"Mismatched\"):\n Case.objects.create(\n case_num=123, model_import_attempt=structure_import_attempt\n )\n\n expected_deletions = (\n 8,\n {\n # This is the important one: we _must_ cascade to our\n # importees!\n \"cases.Case\": 1,\n \"django_import_data.ModelImportAttempt\": 2,\n \"cases.Structure\": 1,\n \"django_import_data.ModelImporter\": 2,\n \"django_import_data.RowData\": 1,\n \"django_import_data.FileImportAttempt\": 1,\n },\n )\n actual_deletions = file_import_attempt.delete()\n self.assertEqual(actual_deletions, expected_deletions)\n\n # Sanity check to make sure we have no stragglers\n self.assertEqual(Case.objects.count(), 0)\n self.assertEqual(Structure.objects.count(), 0)\n self.assertEqual(ModelImportAttempt.objects.count(), 0)\n self.assertEqual(RowData.objects.count(), 0)\n self.assertEqual(FileImportAttempt.objects.count(), 0)\n\n\nfrom django.core.management import call_command\n\n\nclass TestImportExampleData(TestCase):\n \"\"\"End-to-end tests using the import_example_data importer\"\"\"\n\n def assertDictIsSubset(self, first, second):\n return self.assertLessEqual(\n first.items(),\n second.items(),\n f\"Items missing from second item: {set(first.items()).difference(second.items())}\",\n )\n\n def test_good_data(self):\n self.assertEqual(Structure.objects.count(), 0)\n self.assertEqual(Person.objects.count(), 0)\n self.assertEqual(Case.objects.count(), 0)\n\n call_command(\n \"import_example_data\",\n \"/home/sandboxes/tchamber/repos/django-import-data/example_project/importers/example_data_source/test_data.csv\",\n verbosity=3,\n )\n\n # 1 input file yields 1 file importer\n self.assertEqual(FileImporter.objects.count(), 1)\n # 1 attempt to import this input file yields 1 file import attempt\n self.assertEqual(FileImportAttempt.objects.count(), 1)\n # 1 row in the file during this attempt yields 1 RowData\n self.assertEqual(RowData.objects.count(), 1)\n # 3 Models are defined for each row, so we expect 3 model importers\n self.assertEqual(ModelImporter.objects.count(), 3)\n # 1 attempt each yields 3 model import attempts\n self.assertEqual(ModelImportAttempt.objects.count(), 3)\n\n # Structure should be created\n self.assertEqual(Structure.objects.count(), 1)\n # Person should be created\n self.assertEqual(Person.objects.count(), 1)\n # Case should be created\n self.assertEqual(Case.objects.count(), 1)\n\n structure_values = Structure.objects.values().first()\n expected_structure_values = {\"location\": \"(38.7, 78.1)\"}\n self.assertDictIsSubset(expected_structure_values, structure_values)\n\n person_values = Person.objects.values().first()\n expected_person_values = {\n \"name\": \"Foo Bar Baz\",\n \"phone\": \"123456789\",\n \"email\": \"foo@bar.baz\",\n \"city\": \"Atlanta\",\n \"street\": \"123 Foobar St\",\n \"zip\": \"30078\",\n \"state\": \"GA\",\n }\n self.assertDictIsSubset(expected_person_values, person_values)\n\n case_values = Case.objects.values().first()\n expected_case_values = {\n \"case_num\": 1,\n \"status\": \"complete\",\n \"type\": \"A\",\n \"subtype\": 1,\n }\n self.assertDictIsSubset(expected_case_values, case_values)\n\n def test_bad_email_no_durable(self):\n with self.assertRaisesRegex(\n ValueError, \"Row 2 of file test_data_bad.csv handled, but had 1 errors\"\n ):\n # Note that no --durable is given here, so we will not be continuing past the bad email value.\n # PersonForm should raise an error\n call_command(\n \"import_example_data\",\n \"/home/sandboxes/tchamber/repos/django-import-data/example_project/importers/example_data_source/test_data_bad.csv\",\n verbosity=3,\n )\n\n def test_bad_email_durable(self):\n \"\"\"Ensure proper handling of Person with invalid email. durable=True\"\"\"\n\n path = \"/home/sandboxes/tchamber/repos/django-import-data/example_project/importers/example_data_source/test_data_bad.csv\"\n call_command(\n \"import_example_data\",\n path,\n verbosity=3,\n # Durable will force processing to continue past otherwise-fatal errors. In this case, we have a bad\n # email value that should get caught by the PersonForm and raise a ValueError. But, we\n # will ignore that error and continue on\n durable=True,\n )\n\n ### File Importer ###\n # 1 input file yields 1 file importer\n self.assertEqual(FileImporter.objects.count(), 1)\n file_importer = FileImporter.objects.first()\n self.assertEqual(file_importer.status, FileImporter.STATUSES.rejected.db_value)\n expected_fi_errors_by_row = {\n 2: {\n \"form_errors\": [\n {\n \"alias\": [\"E-mail\"],\n \"field\": \"email\",\n \"value\": \"not an email\",\n \"errors\": [\"ValidationError(['Enter a valid email address.'])\"],\n }\n ]\n }\n }\n self.assertEqual(\n file_importer.errors_by_row_as_dict(), expected_fi_errors_by_row\n )\n\n ### File Import Attempt ###\n # 1 attempt to import this input file yields 1 file import attempt\n self.assertEqual(FileImportAttempt.objects.count(), 1)\n file_import_attempt = FileImportAttempt.objects.first()\n self.assertEqual(\n file_import_attempt.status, FileImportAttempt.STATUSES.rejected.db_value\n )\n # Should be the same as for the FI\n self.assertEqual(\n file_import_attempt.errors_by_row_as_dict(), expected_fi_errors_by_row\n )\n\n ### Row Data ###\n # 1 row in the file during this attempt yields 1 RowData\n self.assertEqual(RowData.objects.count(), 1)\n row_data = RowData.objects.first()\n # row_data.data should be _exactly the same_ as the data in the file!\n self.assertEqual(row_data.data, list(Command.load_rows(path))[0])\n self.assertEqual(row_data.status, RowData.STATUSES.rejected.db_value)\n actual_errors_by_alias = row_data.errors_by_alias()\n expected_errors_by_alias = {\n \"case_num\": [\n {\n \"field\": \"case_num\",\n \"value\": None,\n \"errors\": [\"ValidationError(['This field is required.'])\"],\n \"error_type\": \"form\",\n },\n {\n \"error\": \"ValueError(\\\"invalid literal for int() with base 10: 'potato'\\\")\",\n \"converter\": \"convert_case_num\",\n \"to_fields\": [\"case_num\"],\n \"from_fields\": [\"case_num\"],\n \"error_type\": \"conversion\",\n },\n ],\n \"E-mail\": [\n {\n \"field\": \"email\",\n \"value\": \"not an email\",\n \"errors\": [\"ValidationError(['Enter a valid email address.'])\"],\n \"error_type\": \"form\",\n }\n ],\n }\n self.assertEqual(actual_errors_by_alias, expected_errors_by_alias)\n ### Model Importer ###\n # 3 Models are defined for each row, so we expect 3 model importers\n self.assertEqual(ModelImporter.objects.count(), 3)\n\n ### Model Import Attempt ###\n # 1 attempt each yields 3 model import attempts\n self.assertEqual(ModelImportAttempt.objects.count(), 3)\n # 1 of these failed (had no created model). Thus, we expect that...\n # ...the number of MIAs with _no_ importee (imported model) should be 2...\n self.assertEqual(ModelImportAttempt.objects.get_num_without_importee(), 2)\n # ...and the number of MIAs in a \"rejected\" state should be 2\n self.assertEqual(ModelImportAttempt.objects.get_num_rejected(), 2)\n # 2 of these succeeded (have created model). Thus, we expect that...\n # ...the number of MIAs with an importee (imported model) should be 1...\n self.assertEqual(ModelImportAttempt.objects.get_num_with_importee(), 1)\n # ...and the number of MIAs in a \"successful\" state should be 1\n self.assertEqual(ModelImportAttempt.objects.get_num_successful(), 1)\n\n # Here, instead of checking the Person instance (since there isn't one),\n # we check to ensure that the appropriate errors were set for the MIA\n person_mia = ModelImportAttempt.objects.get(\n content_type=ContentType.objects.get_for_model(Person)\n )\n # We expect the model import attempt to contain the following errors,\n # resulting from the invalid email in the row from the CSV file\n expected_person_mia_errors = {\n \"form_errors\": [\n {\n \"alias\": [\"E-mail\"],\n \"field\": \"email\",\n \"value\": \"not an email\",\n \"errors\": [\"ValidationError(['Enter a valid email address.'])\"],\n }\n ]\n }\n self.assertEqual(person_mia.errors, expected_person_mia_errors)\n\n # There should be exactly one Case MIA, and it should have no errors\n case_mia = ModelImportAttempt.objects.get(\n content_type=ContentType.objects.get_for_model(Case)\n )\n expected_case_mia_errors = {\n \"form_errors\": [\n {\n \"alias\": [\"case_num\"],\n \"field\": \"case_num\",\n \"value\": None,\n \"errors\": [\"ValidationError(['This field is required.'])\"],\n }\n ],\n \"conversion_errors\": [\n {\n \"error\": \"ValueError(\\\"invalid literal for int() with base 10: 'potato'\\\")\",\n \"aliases\": {\"case_num\": [\"case_num\"]},\n \"converter\": \"convert_case_num\",\n \"to_fields\": [\"case_num\"],\n \"from_fields\": [\"case_num\"],\n }\n ],\n }\n self.assertEqual(case_mia.errors, expected_case_mia_errors)\n\n # There should be exactly one Structure MIA, and it should have no errors\n structure_mia = ModelImportAttempt.objects.get(\n content_type=ContentType.objects.get_for_model(Structure)\n )\n expected_structure_mia_errors = {}\n self.assertEqual(structure_mia.errors, expected_structure_mia_errors)\n\n ### Audited Models ###\n # No person should have been created due to the invalid email\n self.assertEqual(Person.objects.count(), 0)\n\n # Structure should be created\n self.assertEqual(Structure.objects.count(), 1)\n structure_values = Structure.objects.values().first()\n expected_structure_values = {\"location\": \"(38.7, 78.1)\"}\n self.assertDictIsSubset(expected_structure_values, structure_values)\n\n # Case should not be created due to invalid case number and invalid sub type\n self.assertEqual(Case.objects.count(), 0)\n\n def _test_file_with_no_rows(self):\n # Behavior should be identical regardles of durable value, so we've\n # consolidated checks into this one function\n\n ### File Importer ###\n # 1 input file yields 1 file importer\n self.assertEqual(FileImporter.objects.count(), 1)\n file_importer = FileImporter.objects.first()\n self.assertEqual(file_importer.status, FileImporter.STATUSES.empty.db_value)\n\n ### File Import Attempt ###\n # 1 attempt to import this input file yields 1 file import attempt\n self.assertEqual(FileImportAttempt.objects.count(), 1)\n file_import_attempt = FileImportAttempt.objects.first()\n self.assertEqual(\n file_import_attempt.status, FileImportAttempt.STATUSES.empty.db_value\n )\n\n ### Row Data ###\n # 0 row in the file during this attempt yields 0 RowData\n self.assertEqual(RowData.objects.count(), 0)\n\n ### Model Importer ###\n # 3 Models are defined for each row, so we expect 3 model importers\n self.assertEqual(ModelImporter.objects.count(), 0)\n\n ### Model Import Attempt ###\n # 1 attempt each yields 3 model import attempts\n self.assertEqual(ModelImportAttempt.objects.count(), 0)\n\n def test_file_with_no_rows_no_durable(self):\n \"\"\"Test file with headers, but no data rows; durable=False\"\"\"\n\n call_command(\n \"import_example_data\",\n \"/home/sandboxes/tchamber/repos/django-import-data/example_project/importers/example_data_source/test_data_no_rows.csv\",\n verbosity=3,\n )\n\n self._test_file_with_no_rows()\n\n def test_file_with_no_rows_durable(self):\n \"\"\"Test file with headers, but no data rows; durable=True\"\"\"\n\n path = \"/home/sandboxes/tchamber/repos/django-import-data/example_project/importers/example_data_source/test_data_no_rows.csv\"\n call_command(\n \"import_example_data\",\n path,\n verbosity=3,\n # Durable will force processing to continue past otherwise-fatal errors. In this case, we have a bad\n # email value that should get caught by the PersonForm and raise a ValueError. But, we\n # will ignore that error and continue on\n durable=True,\n )\n\n self._test_file_with_no_rows()\n" }, { "alpha_fraction": 0.633281946182251, "alphanum_fraction": 0.6810477375984192, "avg_line_length": 33.157894134521484, "blob_id": "2dd1d2a2acba76209e88f8cb36713469d94eb6ef", "content_id": "ba22515cc66de6385c0e6acb23bf5cae8e9ddbba", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 649, "license_type": "permissive", "max_line_length": 249, "num_lines": 19, "path": "/django_import_data/migrations/0012_auto_20190705_1356.py", "repo_name": "GreenBankObservatory/django-import-data", "src_encoding": "UTF-8", "text": "# Generated by Django 2.2.2 on 2019-07-05 17:56\n\nfrom django.db import migrations, models\nimport django.db.models.deletion\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('django_import_data', '0011_auto_20190705_1351'),\n ]\n\n operations = [\n migrations.AlterField(\n model_name='modelimporter',\n name='file_import_attempt',\n field=models.ForeignKey(blank=True, help_text='Reference to the FileImportAttempt this was created from', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='model_importers', to='django_import_data.FileImportAttempt'),\n ),\n ]\n" }, { "alpha_fraction": 0.811965823173523, "alphanum_fraction": 0.811965823173523, "avg_line_length": 22.399999618530273, "blob_id": "e33d173873c24e6a7b3294212a72c74b3e61c11e", "content_id": "193b75711c08f84de7b5292a3325a827da67ea55", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 117, "license_type": "permissive", "max_line_length": 51, "num_lines": 5, "path": "/example_project/cases/audits.py", "repo_name": "GreenBankObservatory/django-import-data", "src_encoding": "UTF-8", "text": "from django_import_data.models import audit_factory\n\nfrom .models import Person\n\nPersonAudit = audit_factory(Person)\n" }, { "alpha_fraction": 0.8409090638160706, "alphanum_fraction": 0.8409090638160706, "avg_line_length": 43, "blob_id": "4d5517038ca2ebda567c74373550d8ef400e7816", "content_id": "9221675e59291f3e2d0d87798d9c1d66ed8a9f28", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 44, "license_type": "permissive", "max_line_length": 43, "num_lines": 1, "path": "/django_import_data/management/commands/__init__.py", "repo_name": "GreenBankObservatory/django-import-data", "src_encoding": "UTF-8", "text": "from ._base_import import BaseImportCommand\n" }, { "alpha_fraction": 0.529783308506012, "alphanum_fraction": 0.5489262342453003, "avg_line_length": 35.62277603149414, "blob_id": "7c6e8ad7737bb0508351ec240dbc943b94001fc7", "content_id": "94947de84cbabd48edb2796c7a02dfcdc79ddc69", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 10291, "license_type": "permissive", "max_line_length": 97, "num_lines": 281, "path": "/django_import_data/test_fieldmap.py", "repo_name": "GreenBankObservatory/django-import-data", "src_encoding": "UTF-8", "text": "from pprint import pprint\n\nfrom unittest import TestCase\nfrom . import (\n FormMap,\n FieldMap,\n OneToOneFieldMap,\n OneToManyFieldMap,\n ManyToOneFieldMap,\n ManyToManyFieldMap,\n)\nfrom .converters import handle_dms, handle_location\n\n\nclass TestFieldMap(TestCase):\n def test_bare_init(self):\n with self.assertRaisesRegex(TypeError, \"required\"):\n FieldMap()\n\n def test_init_no_strings(self):\n with self.assertRaisesRegex(\n TypeError, \"to_fields and from_fields should not be strings!\"\n ):\n FieldMap(from_fields=(\"foo\", \"bar\"), to_fields=\"bar\", converter=lambda x: x)\n\n def test_init_simple_no_aliases(self):\n FieldMap(from_fields=(\"foo\", \"bar\"), to_fields=(\"bar\",), converter=lambda x: x)\n\n def test_init_simple_with_aliases(self):\n # Should work since from_fields is \"simple\"\n FieldMap(\n from_fields=(\"foo\", \"bar\"),\n to_fields=(\"bar\",),\n aliases={\"foo\": (\"FOO\",)},\n converter=lambda x: x,\n )\n\n def test_init_compound_with_aliases(self):\n # Should fail since from_fields is \"compound\"\n with self.assertRaisesRegex(ValueError, \"compound\"):\n FieldMap(\n from_fields={\"foo\": (\"FOO\",), \"bar\": (\"bar\",)},\n to_fields=(\"bar\",),\n aliases={\"foo\": (\"FOO\",)},\n converter=lambda x: x,\n )\n\n def test_init_compound_no_aliases(self):\n # Should work since aliases isn't given\n FieldMap(\n from_fields={\"foo\": (\"FOO\",), \"bar\": (\"bar\",)},\n to_fields=(\"bar\",),\n converter=lambda x: x,\n )\n\n def test_invert_aliases(self):\n aliases = {\"latitude\": (\"LAT\", \"lat.\"), \"longitude\": (\"LONG\", \"long.\")}\n actual = FieldMap._invert_aliases(aliases)\n expected = {\n \"LAT\": \"latitude\",\n \"lat.\": \"latitude\",\n \"LONG\": \"longitude\",\n \"long.\": \"longitude\",\n }\n\n return self.assertEqual(actual, expected)\n\n def test_split_from_fields(self):\n actual = FieldMap._split_from_fields(\n from_fields={\"latitude\": [\"lat\", \"LAT\"], \"longitude\": [\"long\", \"LONG\"]}\n )\n expected = (\n # aliases\n {\n \"lat\": \"latitude\",\n \"LAT\": \"latitude\",\n \"long\": \"longitude\",\n \"LONG\": \"longitude\",\n },\n # from_fields\n (\"latitude\", \"longitude\"),\n )\n self.assertEqual(actual, expected)\n\n def test_split_from_fields_non_dict(self):\n with self.assertRaises(ValueError):\n FieldMap._split_from_fields(from_fields=(\"latitude\", \"longitude\"))\n\n def test_split_from_fields_hetero(self):\n actual_aliases, actual_from_fields = FieldMap._split_from_fields(\n {\"latitude\": [\"lat\", \"LAT\"], \"longitude\": None}\n )\n expected_aliases = {\"lat\": \"latitude\", \"LAT\": \"latitude\"}\n expected_from_fields = (\"latitude\", \"longitude\")\n self.assertEqual(actual_aliases, expected_aliases)\n self.assertEqual(actual_from_fields, expected_from_fields)\n\n def test_unalias_basic(self):\n data = {\"lat\": \"11 22 33\", \"long\": \"44 55 66\"}\n field_map = FieldMap(\n to_fields=(\"location\",),\n converter=handle_location,\n from_fields={\"latitude\": [\"lat\", \"LAT\"], \"longitude\": [\"long\", \"LONG\"]},\n )\n actual = field_map.unalias(data)\n expected = {\"latitude\": \"11 22 33\", \"longitude\": \"44 55 66\"}\n self.assertEqual(actual, expected)\n\n def test_unalias_unknown_fields(self):\n data = {\"lat\": \"11 22 33\", \"long\": \"44 55 66\", \"potato\": \"POTATO\"}\n field_map = FieldMap(\n to_fields=(\"location\",),\n converter=handle_location,\n from_fields={\"latitude\": [\"lat\", \"LAT\"], \"longitude\": [\"long\", \"LONG\"]},\n )\n with self.assertRaisesRegex(ValueError, \"not a known field\"):\n field_map.unalias(data, allow_unknown=False)\n\n actual = field_map.unalias(data)\n expected = {\"latitude\": \"11 22 33\", \"longitude\": \"44 55 66\"}\n self.assertEqual(actual, expected)\n\n def test_unalias_no_aliases(self):\n data = {\"latitude\": \"11 22 33\", \"longitude\": \"44 55 66\", \"potato\": \"POTATO\"}\n field_map = FieldMap(\n from_fields=(\"latitude\", \"longitude\"),\n to_fields=(\"location\",),\n converter=handle_location,\n )\n actual = field_map.unalias(data)\n expected = {\"latitude\": \"11 22 33\", \"longitude\": \"44 55 66\"}\n self.assertEqual(actual, expected)\n\n def test_unknown_fields(self):\n data = {\"latitude\": \"11 22 33\", \"longitude\": \"44 55 66\", \"potato\": \"POTATO\"}\n field_map = FieldMap(\n from_fields=(\"latitude\", \"longitude\"),\n to_fields=(\"location\",),\n converter=handle_location,\n )\n actual = field_map.get_unknown_fields(data)\n expected = {\"potato\"}\n self.assertEqual(actual, expected)\n\n\nclass TestManyToManyFieldMap(TestCase):\n def test_from_fields_to_fields_default_converter(self):\n with self.assertRaises(ValueError):\n ManyToManyFieldMap(\n from_fields=(\"latitude\", \"longitude\"),\n to_fields=(\"lat_m\", \"lat_s\", \"long_d\", \"long_m\", \"long_s\"),\n )\n\n\nclass TestOneToManyFieldMap(TestCase):\n def test_from_field_to_fields_with_converter(self):\n field_map = OneToManyFieldMap(\n from_field=\"nrqz_id\",\n converter=lambda nrqz_id: dict(\n case_num=nrqz_id[0:4], site_name=nrqz_id[5:]\n ),\n to_fields=(\"case_num\", \"site_name\"),\n )\n actual = field_map.render(dict(nrqz_id=\"1111 Mr. Tower\"))\n expected = dict(case_num=\"1111\", site_name=\"Mr. Tower\")\n self.assertEqual(actual, expected)\n\n def test_render(self):\n data = {\"lat\": \"11 22 33\", \"long\": \"44 55 66\"}\n field_map = ManyToOneFieldMap(\n to_field=\"location\",\n converter=handle_location,\n from_fields={\"latitude\": [\"lat\", \"LAT\"], \"longitude\": [\"long\", \"LONG\"]},\n )\n actual = field_map.render(data)\n expected = {\"location\": (data[\"lat\"], data[\"long\"])}\n self.assertEqual(actual, expected)\n\n\nclass TestManyToOneFieldMap(TestCase):\n def test_from_fields_to_field_with_converter(self):\n field_map = ManyToOneFieldMap(\n from_fields=(\"latitude\", \"longitude\"),\n converter=lambda latitude, longitude: dict(location=(latitude, longitude)),\n to_field=\"location\",\n )\n actual = field_map.render(dict(latitude=\"11 22 33\", longitude=\"44 55 66\"))\n expected = dict(location=(\"11 22 33\", \"44 55 66\"))\n self.assertEqual(actual, expected)\n\n def test_render(self):\n data = {\"LAT\": 30.1, \"long\": 30.2}\n field_map = ManyToOneFieldMap(\n converter=handle_location,\n to_field=\"location\",\n from_fields={\"latitude\": [\"lat\", \"LAT\"], \"longitude\": [\"long\", \"LONG\"]},\n )\n actual = field_map.render(data)\n expected = {\"location\": (data[\"LAT\"], data[\"long\"])}\n self.assertEqual(actual, expected)\n\n\nclass TestManyToManyFieldMap(TestCase):\n def test_from_fields_to_fields_with_converter(self):\n field_map = ManyToManyFieldMap(\n from_fields=(\"latitude\", \"longitude\"),\n converter=lambda latitude, longitude: dict(\n lat_d=latitude[0:2],\n lat_m=latitude[2:4],\n lat_s=latitude[4:6],\n long_d=longitude[0:2],\n long_m=longitude[2:4],\n long_s=longitude[4:6],\n ),\n to_fields=(\"lat_m\", \"lat_s\", \"long_d\", \"long_m\", \"long_s\"),\n )\n actual = field_map.render(dict(latitude=\"112233\", longitude=\"445566\"))\n expected = dict(\n lat_d=\"11\", lat_m=\"22\", lat_s=\"33\", long_d=\"44\", long_m=\"55\", long_s=\"66\"\n )\n self.assertEqual(actual, expected)\n\n # TODO: This is contrived; come up with a better example! (Could be split into two fieldmaps)\n def test_render(self):\n data = {\"LAT\": \"30 31 32\", \"long.\": \"33 34 35\"}\n field_map = ManyToManyFieldMap(\n from_fields={\"latitude\": (\"LAT\", \"lat.\"), \"longitude\": (\"LONG\", \"long.\")},\n converter=handle_dms,\n to_fields=(\"lat_d\", \"lat_m\", \"lat_s\", \"long_d\", \"long_m\", \"long_s\"),\n )\n actual = field_map.render(data)\n expected = {\n \"lat_d\": \"30\",\n \"lat_m\": \"31\",\n \"lat_s\": \"32\",\n \"long_d\": \"33\",\n \"long_m\": \"34\",\n \"long_s\": \"35\",\n }\n self.assertEqual(actual, expected)\n\n\nclass TestOneToOneFieldMap(TestCase):\n def test_init_bare(self):\n with self.assertRaises(TypeError):\n OneToOneFieldMap()\n\n def test_render_no_to_field_no_aliases(self):\n data = {\"foo\": \"baz\"}\n field_map = OneToOneFieldMap(from_field=\"foo\")\n # Test data\n actual = field_map.render(data)\n expected = {\"foo\": data[\"foo\"]}\n self.assertEqual(actual, expected)\n\n def test_render_no_to_field_with_aliases(self):\n data = {\"foo\": \"baz\"}\n field_map = OneToOneFieldMap(from_field={\"foo\": (\"Foo\",)})\n # Test data\n actual = field_map.render(data)\n expected = {\"foo\": data[\"foo\"]}\n self.assertEqual(actual, expected)\n\n def test_render_with_aliases(self):\n data = {\"Bar\": \"baz\"}\n field_map = OneToOneFieldMap(from_field={\"foo\": (\"Foo\", \"Bar\")}, to_field=\"foo\")\n # Test data\n actual = field_map.render(data)\n expected = {\"foo\": data[\"Bar\"]}\n self.assertEqual(actual, expected)\n\n def test_reject_multiple_alias_matches(self):\n data = {\"Bar\": \"bar\", \"Baz\": \"baz\", \"Bat\": \"boo\"}\n field_map = OneToOneFieldMap(from_field={\"foo\": (\"Bar\", \"Baz\")}, to_field=\"foo\")\n with self.assertRaises(ValueError):\n field_map.render(data)\n\n field_map.render(data)\n actual = field_map.render(data, allow_multiple_aliases_for_field=True)\n expected = {\"foo\": \"baz\"}\n self.assertEqual(actual, expected)\n" }, { "alpha_fraction": 0.5542280077934265, "alphanum_fraction": 0.554624080657959, "avg_line_length": 35.06904602050781, "blob_id": "0606b931fb562677c1c68dec9edde911ca6afd8b", "content_id": "46c5353ab33627d1ad66350afbf1fb0616815f24", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 15149, "license_type": "permissive", "max_line_length": 111, "num_lines": 420, "path": "/django_import_data/formmap.py", "repo_name": "GreenBankObservatory/django-import-data", "src_encoding": "UTF-8", "text": "import logging\n\nfrom collections import defaultdict\nfrom pprint import pformat\n\nfrom tqdm import tqdm\n\nfrom django.forms import ModelForm, ValidationError\n\nfrom .mermaid import render_form_map_as_mermaid\n\nLOGGER = logging.getLogger(__name__)\nDEFAULT_THRESHOLD = 0.7\n\n\ndef get_useful_form_errors(form):\n return [\n {\n \"field\": field,\n \"value\": form[field].value(),\n \"errors\": [repr(error) for error in errors],\n }\n for field, errors in form.errors.as_data().items()\n ]\n\n\nclass FormMap:\n \"\"\"Simple mapping of ModelForm -> field-mapped data\"\"\"\n\n field_maps = [NotImplemented]\n form_class = NotImplemented\n importer_class = NotImplemented\n form_defaults = {}\n # TODO: This SHOULD NOT be here. I need to subclass inside of NRQZ Admin\n # TODO: data_source should be ignored in some but not all cases\n excluded_form_fields = {\n \"is_active\",\n \"id\",\n \"slug\",\n \"hash_on_disk\",\n \"file_modified_on\",\n \"hash_checked_on\",\n }\n\n def __init__(\n self,\n form_kwargs=None,\n check_every_render_for_errors=False,\n check_for_overloaded_to_fields=True,\n allow_fields_in_form_map_but_not_in_form=False,\n ):\n if form_kwargs:\n self.form_kwargs = form_kwargs\n else:\n self.form_kwargs = {}\n\n self.unaliased_map = None\n # self._rendered_form = None\n\n for field_map in self.field_maps:\n if not callable(field_map.converter):\n if field_map.converter:\n converter_name = field_map.converter\n else:\n converter_name = f\"convert_{'_'.join(field_map.from_fields)}\"\n try:\n field_map.converter = getattr(self, converter_name)\n except AttributeError:\n raise ValueError(\n f\"No {converter_name} found; either define one \"\n \"or specify a different converter explicitly in \"\n \"your FieldMap instantiation\"\n )\n\n self.known_fields = self.get_known_from_fields()\n # If this is set to True we will check every render call for\n # non-critical errors (such as unmapped fields). Otherwise we will check only the first\n self.check_every_render_for_errors = check_every_render_for_errors\n # Initialize this to True so that at least the first iteration\n # is checked. It might then be set to False depending on the above\n self.check_next_render_for_errors = True\n\n if check_for_overloaded_to_fields:\n overloaded_to_fields = self.get_overloaded_to_fields()\n if overloaded_to_fields:\n raise ValueError(\n \"The following to_fields are mapped to by multiple FieldMaps!\\n\"\n f\"{pformat(overloaded_to_fields)}\"\n )\n\n self.check_that_all_model_fields_are_in_form(\n allow_fields_in_form_map_but_not_in_form\n )\n self.check_that_all_form_map_fields_are_in_form()\n\n def render_dict(self, data, allow_unknown=True):\n rendered = {}\n errors = []\n\n if self.check_next_render_for_errors:\n # Turn off error checking now unless user has specified\n # that we need to check every row\n if not self.check_every_render_for_errors:\n self.check_next_render_for_errors = False\n if not allow_unknown:\n unknown = self.get_unknown_fields(data)\n raise ValueError(f\"Unknown fields: {unknown}\")\n\n for field_map in self.field_maps:\n # NOTE: We do NOT pass allow_unknown to field_map. It\n # is essential to the functionality of our logic here\n # that it simply ignore all values it doesn't know about\n # Error checking is instead done above\n try:\n result = field_map.render(data)\n except ValueError as error:\n errors.append(\n {\n \"error\": repr(error),\n \"from_fields\": field_map.from_fields,\n \"aliases\": field_map.unalias(data)[1],\n \"to_fields\": field_map.to_fields,\n \"converter\": field_map.converter.__name__,\n }\n )\n else:\n if result:\n rendered.update(result)\n\n return rendered, errors\n\n def render(\n self,\n data,\n extra=None,\n allow_unknown=True,\n allow_conversion_errors=True,\n allow_empty_forms=False,\n ):\n if not self.form_class:\n raise ValueError(\"No FormMap.form_class defined; cannot render a form!\")\n if extra is None:\n extra = {}\n rendered, conversion_errors = self.render_dict(data, allow_unknown)\n if conversion_errors:\n if allow_conversion_errors:\n tqdm.write(f\"Conversion errors: {pformat(conversion_errors)}\")\n else:\n raise ValueError(f\"One or more conversion errors: {conversion_errors}\")\n\n if not allow_empty_forms and not any(rendered.values()):\n # tqdm.write(\n # f\"No values were derived for {self.form_class}; skipping creation attempt\"\n # )\n rendered_form = None\n else:\n rendered_form = self.form_class(\n {**self.form_defaults, **extra, **rendered}, **self.form_kwargs\n )\n\n return (rendered_form, conversion_errors)\n\n def get_useful_form_errors(self, form, data):\n useful_form_errors = []\n for field, errors in form.errors.as_data().items():\n alias = None\n # TODO: Cache this up front somehow\n for field_map in self.field_maps:\n if field in field_map.to_fields:\n try:\n # TODO: This is disgusting\n alias = next(iter(field_map.unalias(data)[1].values()))\n except:\n LOGGER.error(\n \"Failed to process alias for:\", field_map.unalias(data)\n )\n\n useful_form_errors.append(\n {\n \"field\": field,\n \"value\": form[field].value(),\n \"errors\": [repr(error) for error in errors],\n \"alias\": alias if alias else field,\n }\n )\n\n return useful_form_errors\n\n def save_with_audit(\n self, row_data, data=None, form=None, imported_by=None, **kwargs\n ):\n from django.contrib.contenttypes.models import ContentType\n from django_import_data.models import ModelImporter\n from .models import RowData\n\n if imported_by is None:\n raise ValueError(\"imported_by is required!\")\n\n if not isinstance(row_data, RowData):\n raise ValueError(f\"row_data must be a {RowData} instance!\")\n\n # If no data has been explicitly given, use the whole row's data\n if data is None:\n data = row_data.data\n\n if form is not None:\n conversion_errors = {}\n else:\n # Thus, if it is _not_ a ModelForm instance, we need to render it\n # ourselves\n form, conversion_errors = self.render(data, **kwargs)\n if form is None:\n return (None, None)\n\n LOGGER.debug(f\"Form data: {form.data}\")\n\n useful_form_errors = self.get_useful_form_errors(form, data)\n\n all_errors = {}\n if conversion_errors:\n all_errors[\"conversion_errors\"] = conversion_errors\n if useful_form_errors:\n all_errors[\"form_errors\"] = useful_form_errors\n\n # if conversion_errors and useful_form_errors:\n if not (conversion_errors or useful_form_errors):\n __, model_import_attempt = ModelImporter.objects.create_with_attempt(\n errors=all_errors,\n imported_by=imported_by,\n importee_field_data=form.data,\n model=form.Meta.model,\n row_data=row_data,\n )\n instance = form.save(commit=False)\n if \"original_pk\" in form.data:\n instance.pk = form.data[\"original_pk\"]\n instance.model_import_attempt = model_import_attempt\n instance.save()\n instance.refresh_from_db()\n if \"original_pk\" in form.data:\n assert instance.id == form.data[\"original_pk\"], \"Aw man\"\n return instance, model_import_attempt\n\n __, model_import_attempt = ModelImporter.objects.create_with_attempt(\n errors=all_errors,\n imported_by=imported_by,\n importee_field_data=form.data,\n model=form.Meta.model,\n row_data=row_data,\n )\n return None, model_import_attempt\n\n # TODO: handle common functionality\n def save(self, data, **kwargs):\n if isinstance(data, ModelForm):\n # Assume that if data is a ModelForm instance, it is an already-rendered\n # Form. This also implies that there are no conversion errors\n form = data\n conversion_errors = {}\n else:\n # Thus, if it is _not_ a ModelForm instance, we need to render it\n # ourselves\n form, conversion_errors = self.render(data, **kwargs)\n\n if form.is_valid():\n instance = form.save()\n return instance\n\n useful_form_errors = self.get_useful_form_errors(form, data)\n all_errors = {\n \"conversion_errors\": conversion_errors,\n \"form_errors\": useful_form_errors,\n }\n\n raise ValidationError(\n f\"{self.form_class.__name__} is invalid; couldn't be saved! {all_errors}\"\n )\n\n def get_known_from_fields(self):\n \"\"\"Return set of all known from_fields, including aliases thereof\"\"\"\n\n known_fields = set()\n for field_map in self.field_maps:\n known_fields.update(field_map.known_fields)\n return known_fields\n\n def get_unknown_fields(self, data):\n return {field for field in data if field not in self.known_fields}\n\n def get_known_to_fields(self, unique=True):\n if unique:\n return {\n to_field\n for field_map in self.field_maps\n for to_field in field_map.to_fields\n }\n return [\n to_field\n for field_map in self.field_maps\n for to_field in field_map.to_fields\n ]\n\n def get_name(self):\n if self.form_class and hasattr(self.form_class, \"Meta\"):\n model = self.form_class.Meta.model.__name__\n return f\"FormMap<{model}>\"\n\n return \"FormMap\"\n\n def explain(self):\n \"\"\"EXPLAIN YOURSELF\"\"\"\n\n if not self.form_class:\n raise ValueError(\"There's nothing to explain!\")\n\n form_fields = self.form_class().fields\n\n print(f\"{self.__class__.__name__} maps:\")\n\n for field_map in self.field_maps:\n from_fields_verbose, to_fields_verbose, explanation = field_map.explain(\n form_fields\n )\n print(f\" field(s):\")\n for field_info in from_fields_verbose:\n print(f\" * {field_info}\")\n\n print(f\" to field(s):\")\n for field_info in to_fields_verbose:\n print(f\" * {field_info}\")\n if field_map.converter.__name__ != \"nop_converter\":\n print(f\" via converter {field_map.converter.__name__}\")\n\n if explanation:\n print(f\" explanation: {explanation}\")\n print(\"-\" * 3)\n\n def __repr__(self):\n field_maps_str = \"\\n \".join([str(field_map) for field_map in self.field_maps])\n return f\"{self.get_name()} {{\\n {field_maps_str}\\n}}\"\n\n def get_overloaded_to_fields(self, ignored=None):\n \"\"\"Find instances where multiple FieldMaps map to the same to_field(s)\"\"\"\n\n if ignored is None:\n ignored = []\n\n to_field_to_containing_field_maps = defaultdict(list)\n for field_map in self.field_maps:\n for to_field in field_map.to_fields:\n to_field_to_containing_field_maps[to_field].append(field_map)\n\n return {\n to_field: field_maps\n for to_field, field_maps in to_field_to_containing_field_maps.items()\n if len(field_maps) > 1 and to_field not in ignored\n }\n\n def check_that_all_model_fields_are_in_form(\n self, allow_fields_in_form_map_but_not_in_form=False\n ):\n fields_in_model_but_not_in_form = self.get_fields_in_model_but_not_in_form()\n if fields_in_model_but_not_in_form:\n error_str = (\n f\"{len(fields_in_model_but_not_in_form)} fields exist \"\n f\"in {self.form_class.Meta.model} but not in {self.form_class.__name__}: \"\n f\"{fields_in_model_but_not_in_form}\"\n )\n if allow_fields_in_form_map_but_not_in_form:\n tqdm.write(f\"WARNING: {error_str}\")\n else:\n raise ValueError(error_str)\n\n def get_fields_in_model_but_not_in_form(self):\n if not self.form_class:\n return []\n\n fields_in_form = set(self.form_class.Meta.fields)\n fields_in_model = set(\n f.name\n for f in self.form_class.Meta.model._meta.fields\n if f.editable and not f.is_relation\n )\n\n fields_in_model_but_not_in_form = [\n field\n for field in fields_in_model.difference(fields_in_form)\n if field not in self.excluded_form_fields\n ]\n return fields_in_model_but_not_in_form\n\n def check_that_all_form_map_fields_are_in_form(self):\n \"\"\"Ensure that all known to fields are mapped in our form class\n\n If this is not true, we will have silent failures, because any fields\n not in the form will not make it into the database\"\"\"\n fields_in_form_map_but_not_in_form = (\n self.get_fields_in_form_map_but_not_in_form()\n )\n if fields_in_form_map_but_not_in_form:\n raise ValueError(\n f\"{len(fields_in_form_map_but_not_in_form)} fields \"\n f\"are defined for {type(self)}, but are not defined in its form ({self.form_class.__name__})! \"\n f\"{fields_in_form_map_but_not_in_form}\"\n )\n\n def get_fields_in_form_map_but_not_in_form(self):\n if not self.form_class:\n return []\n\n fields_in_form = set(self.form_class.Meta.fields)\n\n known_to_fields = self.get_known_to_fields()\n fields_in_form_map_but_not_in_form = known_to_fields.difference(\n set(fields_in_form)\n )\n return fields_in_form_map_but_not_in_form\n\n def as_mermaid(self, *args, **kwargs):\n return render_form_map_as_mermaid(self, *args, **kwargs)\n" }, { "alpha_fraction": 0.3945826292037964, "alphanum_fraction": 0.39851343631744385, "avg_line_length": 38.75, "blob_id": "0de031d589dcb607750a0c3f75c4e4d5bd49414d", "content_id": "5870bf0d167e935d209e7741ac887c1e3643cc59", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 13992, "license_type": "permissive", "max_line_length": 115, "num_lines": 352, "path": "/django_import_data/migrations/0001_initial.py", "repo_name": "GreenBankObservatory/django-import-data", "src_encoding": "UTF-8", "text": "# Generated by Django 2.2.2 on 2019-06-18 15:23\n\nimport django.contrib.postgres.fields\nimport django.contrib.postgres.fields.jsonb\nimport django.core.serializers.json\nfrom django.db import migrations, models\nimport django.db.models.deletion\nimport django_import_data.utils\n\n\nclass Migration(migrations.Migration):\n\n initial = True\n\n dependencies = [(\"contenttypes\", \"0002_remove_content_type_name\")]\n\n operations = [\n migrations.CreateModel(\n name=\"FileImportAttempt\",\n fields=[\n (\n \"id\",\n models.AutoField(\n auto_created=True,\n primary_key=True,\n serialize=False,\n verbose_name=\"ID\",\n ),\n ),\n (\n \"status\",\n models.CharField(\n choices=[\n (\"pending\", \"Pending\"),\n (\"created_clean\", \"Imported: No Errors\"),\n (\"created_dirty\", \"Imported: Some Errors\"),\n (\"rejected\", \"Rejected: Fatal Errors\"),\n ],\n default=\"pending\",\n max_length=13,\n ),\n ),\n (\"created_on\", models.DateTimeField(auto_now_add=True)),\n (\"modified_on\", models.DateTimeField(auto_now=True, null=True)),\n (\n \"imported_from\",\n models.CharField(\n default=None,\n help_text=\"Path to file that this was imported from\",\n max_length=512,\n ),\n ),\n (\"imported_by\", models.CharField(max_length=128, null=True)),\n (\n \"creations\",\n django.contrib.postgres.fields.jsonb.JSONField(\n default=dict,\n encoder=django_import_data.utils.DjangoErrorJSONEncoder,\n null=True,\n ),\n ),\n (\n \"info\",\n django.contrib.postgres.fields.jsonb.JSONField(\n default=dict,\n help_text=\"Stores any file-level info about the import\",\n null=True,\n ),\n ),\n (\n \"errors\",\n django.contrib.postgres.fields.jsonb.JSONField(\n default=dict,\n encoder=django_import_data.utils.DjangoErrorJSONEncoder,\n help_text=\"Stores any file-level errors encountered during import\",\n null=True,\n ),\n ),\n (\"acknowledged\", models.BooleanField(default=False)),\n (\n \"ignored_headers\",\n django.contrib.postgres.fields.ArrayField(\n base_field=models.CharField(max_length=128),\n blank=True,\n help_text=\"Headers that were ignored during import\",\n null=True,\n size=None,\n ),\n ),\n (\"hash_when_imported\", models.CharField(blank=True, max_length=40)),\n ],\n options={\n \"verbose_name\": \"File Import Attempt\",\n \"verbose_name_plural\": \"File Import Attempts\",\n \"ordering\": [\"-created_on\"],\n },\n ),\n migrations.CreateModel(\n name=\"FileImportBatch\",\n fields=[\n (\n \"id\",\n models.AutoField(\n auto_created=True,\n primary_key=True,\n serialize=False,\n verbose_name=\"ID\",\n ),\n ),\n (\n \"status\",\n models.CharField(\n choices=[\n (\"pending\", \"Pending\"),\n (\"created_clean\", \"Imported: No Errors\"),\n (\"created_dirty\", \"Imported: Some Errors\"),\n (\"rejected\", \"Rejected: Fatal Errors\"),\n ],\n default=\"pending\",\n max_length=13,\n ),\n ),\n (\"created_on\", models.DateTimeField(auto_now_add=True)),\n (\"modified_on\", models.DateTimeField(auto_now=True, null=True)),\n (\"command\", models.CharField(default=None, max_length=64)),\n (\n \"args\",\n django.contrib.postgres.fields.ArrayField(\n base_field=models.CharField(max_length=256), size=None\n ),\n ),\n (\"kwargs\", django.contrib.postgres.fields.jsonb.JSONField()),\n (\n \"errors\",\n django.contrib.postgres.fields.jsonb.JSONField(\n default=dict, null=True\n ),\n ),\n ],\n options={\n \"verbose_name\": \"File Import Batch\",\n \"verbose_name_plural\": \"File Import Batches\",\n \"ordering\": [\"-created_on\"],\n },\n ),\n migrations.CreateModel(\n name=\"FileImporter\",\n fields=[\n (\n \"id\",\n models.AutoField(\n auto_created=True,\n primary_key=True,\n serialize=False,\n verbose_name=\"ID\",\n ),\n ),\n (\n \"status\",\n models.CharField(\n choices=[\n (\"pending\", \"Pending\"),\n (\"created_clean\", \"Imported: No Errors\"),\n (\"created_dirty\", \"Imported: Some Errors\"),\n (\"rejected\", \"Rejected: Fatal Errors\"),\n ],\n default=\"pending\",\n max_length=13,\n ),\n ),\n (\"created_on\", models.DateTimeField(auto_now_add=True)),\n (\"modified_on\", models.DateTimeField(auto_now=True, null=True)),\n (\n \"file_path\",\n models.CharField(\n default=None,\n help_text=\"Path to the file that this imports\",\n max_length=512,\n unique=True,\n ),\n ),\n (\n \"importer_name\",\n models.CharField(\n default=None,\n help_text=\"The name of the Importer to use\",\n max_length=128,\n ),\n ),\n (\n \"hash_on_disk\",\n models.CharField(\n blank=True,\n help_text=\"SHA-1 hash of the file on disk. If blank, the file is missing\",\n max_length=40,\n null=True,\n unique=True,\n ),\n ),\n (\"file_modified_on\", models.DateTimeField(blank=True, null=True)),\n (\"hash_checked_on\", models.DateTimeField(blank=True, null=True)),\n ],\n options={\n \"verbose_name\": \"File Importer\",\n \"verbose_name_plural\": \"File Importers\",\n \"ordering\": [\"-created_on\"],\n },\n ),\n migrations.CreateModel(\n name=\"RowData\",\n fields=[\n (\n \"id\",\n models.AutoField(\n auto_created=True,\n primary_key=True,\n serialize=False,\n verbose_name=\"ID\",\n ),\n ),\n (\n \"data\",\n django.contrib.postgres.fields.jsonb.JSONField(\n encoder=django.core.serializers.json.DjangoJSONEncoder,\n help_text=\"Stores a 'row' (or similar construct) of data as it was originally encountered\",\n ),\n ),\n (\"row_num\", models.PositiveIntegerField()),\n (\"headers\", django.contrib.postgres.fields.jsonb.JSONField(null=True)),\n (\n \"errors\",\n django.contrib.postgres.fields.jsonb.JSONField(\n default=dict, null=True\n ),\n ),\n (\n \"file_import_attempt\",\n models.ForeignKey(\n on_delete=django.db.models.deletion.CASCADE,\n related_name=\"rows\",\n to=\"django_import_data.FileImportAttempt\",\n ),\n ),\n ],\n options={\"verbose_name\": \"Row Data\", \"verbose_name_plural\": \"Row Data\"},\n ),\n migrations.CreateModel(\n name=\"ModelImportAttempt\",\n fields=[\n (\n \"id\",\n models.AutoField(\n auto_created=True,\n primary_key=True,\n serialize=False,\n verbose_name=\"ID\",\n ),\n ),\n (\n \"status\",\n models.CharField(\n choices=[\n (\"pending\", \"Pending\"),\n (\"created_clean\", \"Imported: No Errors\"),\n (\"created_dirty\", \"Imported: Some Errors\"),\n (\"rejected\", \"Rejected: Fatal Errors\"),\n ],\n default=\"pending\",\n max_length=13,\n ),\n ),\n (\"created_on\", models.DateTimeField(auto_now_add=True)),\n (\"modified_on\", models.DateTimeField(auto_now=True, null=True)),\n (\"is_active\", models.BooleanField(default=True)),\n (\n \"importee_field_data\",\n django.contrib.postgres.fields.jsonb.JSONField(\n default=dict,\n encoder=django_import_data.utils.DjangoErrorJSONEncoder,\n help_text=\"The original data used to create this Audit\",\n ),\n ),\n (\n \"errors\",\n django.contrib.postgres.fields.jsonb.JSONField(\n default=dict,\n encoder=django_import_data.utils.DjangoErrorJSONEncoder,\n help_text=\"Stores any errors encountered during the creation of the auditee\",\n ),\n ),\n (\n \"error_summary\",\n django.contrib.postgres.fields.jsonb.JSONField(\n default=dict,\n encoder=django_import_data.utils.DjangoErrorJSONEncoder,\n help_text=\"Stores any 'summary' information that might need to be associated\",\n ),\n ),\n (\"imported_by\", models.CharField(default=None, max_length=128)),\n (\"acknowledged\", models.BooleanField(default=False)),\n (\n \"content_type\",\n models.ForeignKey(\n on_delete=django.db.models.deletion.CASCADE,\n to=\"contenttypes.ContentType\",\n ),\n ),\n (\n \"file_import_attempt\",\n models.ForeignKey(\n blank=True,\n help_text=\"Reference to the FileImportAttempt this was created from\",\n null=True,\n on_delete=django.db.models.deletion.CASCADE,\n related_name=\"model_import_attempts\",\n to=\"django_import_data.FileImportAttempt\",\n ),\n ),\n (\n \"row_data\",\n models.ForeignKey(\n help_text=\"Reference to the original data used to create this audit group\",\n on_delete=django.db.models.deletion.CASCADE,\n related_name=\"model_import_attempts\",\n to=\"django_import_data.RowData\",\n ),\n ),\n ],\n options={\n \"verbose_name\": \"Model Import Attempt\",\n \"verbose_name_plural\": \"Model Import Attempts\",\n },\n ),\n migrations.AddField(\n model_name=\"fileimportattempt\",\n name=\"file_import_batch\",\n field=models.ForeignKey(\n on_delete=django.db.models.deletion.CASCADE,\n related_name=\"file_import_attempts\",\n to=\"django_import_data.FileImportBatch\",\n ),\n ),\n migrations.AddField(\n model_name=\"fileimportattempt\",\n name=\"file_importer\",\n field=models.ForeignKey(\n on_delete=django.db.models.deletion.CASCADE,\n related_name=\"file_import_attempts\",\n to=\"django_import_data.FileImporter\",\n ),\n ),\n ]\n" }, { "alpha_fraction": 0.645788311958313, "alphanum_fraction": 0.645788311958313, "avg_line_length": 29.66225242614746, "blob_id": "a338a46194a8571e0f9baeb4bd13a29b6cb5e7ca", "content_id": "f0f5cbf8807304eec2b44ee5cc3a65c3876bb1ec", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 4630, "license_type": "permissive", "max_line_length": 87, "num_lines": 151, "path": "/django_import_data/managers.py", "repo_name": "GreenBankObservatory/django-import-data", "src_encoding": "UTF-8", "text": "import json\nimport os\n\nfrom django.apps import apps\nfrom django.contrib.contenttypes.models import ContentType\nfrom django.db import models\n\nfrom .querysets import (\n FileImportAttemptQuerySet,\n FileImporterBatchQuerySet,\n FileImporterQuerySet,\n ModelImportAttemptQuerySet,\n ModelImporterQuerySet,\n RowDataQuerySet,\n)\n\n\nclass DerivedValuesManager(models.Manager):\n def create_fast(self, *args, **kwargs):\n return self.create(\n *args, **kwargs, derive_cached_values=False, propagate_derived_values=False\n )\n\n def create(\n self,\n *args,\n derive_cached_values=False,\n propagate_derived_values=False,\n **kwargs,\n ):\n instance = self.model(*args, **kwargs)\n instance.save(\n derive_cached_values=derive_cached_values,\n propagate_derived_values=propagate_derived_values,\n )\n return instance\n\n def get_successful(self):\n return self.filter(\n status__in=[\n self.model.STATUSES.created_clean.db_value,\n self.model.STATUSES.created_dirty.db_value,\n ]\n )\n\n def get_rejected(self):\n return self.filter(\n status__in=[\n self.model.STATUSES.rejected.db_value,\n self.model.STATUSES.empty.db_value,\n ]\n )\n\n def get_num_successful(self):\n return self.get_successful().count()\n\n def get_num_rejected(self):\n return self.get_rejected().count()\n\n\nclass RowDataManager(DerivedValuesManager):\n def get_queryset(self):\n return RowDataQuerySet(self.model, using=self._db)\n\n\nclass ModelImporterManager(DerivedValuesManager):\n def create_with_attempt(\n self,\n model,\n row_data,\n errors=None,\n derive_cached_values=False,\n propagate_derived_values=False,\n **kwargs,\n ):\n ModelImportAttempt = apps.get_model(\"django_import_data.ModelImportAttempt\")\n model_importer = self.create(row_data=row_data)\n model_import_attempt = ModelImportAttempt.objects.create_for_model(\n model=model,\n model_importer=model_importer,\n errors=errors,\n derive_cached_values=derive_cached_values,\n propagate_derived_values=propagate_derived_values,\n **kwargs,\n )\n return model_importer, model_import_attempt\n\n def get_queryset(self):\n return ModelImporterQuerySet(self.model, using=self._db)\n\n\nclass ModelImportAttemptManager(DerivedValuesManager):\n def create_for_model(\n self,\n model,\n imported_by,\n derive_cached_values=False,\n propagate_derived_values=False,\n **kwargs,\n ):\n content_type = ContentType.objects.get_for_model(model)\n model_import_attempt = self.create(\n derive_cached_values=derive_cached_values,\n propagate_derived_values=propagate_derived_values,\n content_type=content_type,\n imported_by=imported_by,\n **kwargs,\n )\n return model_import_attempt\n\n def get_queryset(self):\n return ModelImportAttemptQuerySet(self.model, using=self._db)\n\n def with_importee(self):\n queryset = self.none()\n for model_name in self.values_list(\"content_type__model\", flat=True):\n queryset |= self.filter(**{f\"{model_name}__isnull\": False})\n return queryset\n\n def without_importee(self):\n queryset = self.exclude(id__in=self.with_importee().values(\"id\"))\n return queryset\n\n def get_num_with_importee(self):\n return self.with_importee().count()\n\n def get_num_without_importee(self):\n return self.without_importee().count()\n\n\nclass FileImporterBatchManager(DerivedValuesManager):\n def get_queryset(self):\n return FileImporterBatchQuerySet(self.model, using=self._db)\n\n\nclass FileImportAttemptManager(DerivedValuesManager):\n def get_queryset(self):\n return FileImportAttemptQuerySet(self.model, using=self._db)\n\n\nclass FileImporterManager(DerivedValuesManager):\n def create_with_attempt(self, path, importer_name, errors=None):\n FileImportAttempt = apps.get_model(\"django_import_data.FileImportAttempt\")\n file_importer = self.create(importer_name=importer_name, file_path=path)\n file_import_attempt = FileImportAttempt.objects.create(\n imported_from=path, file_importer=file_importer, errors=errors\n )\n return file_importer, file_import_attempt\n\n def get_queryset(self):\n return FileImporterQuerySet(self.model, using=self._db)\n" }, { "alpha_fraction": 0.7788461446762085, "alphanum_fraction": 0.7788461446762085, "avg_line_length": 19.799999237060547, "blob_id": "db88a145a5274c8ccc370c10fca5dfb09f3a5b38", "content_id": "84c377ff92055b80de6e2a8a25c6bf18b18424b4", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 104, "license_type": "permissive", "max_line_length": 38, "num_lines": 5, "path": "/example_project/cases/apps.py", "repo_name": "GreenBankObservatory/django-import-data", "src_encoding": "UTF-8", "text": "from django.apps import AppConfig\n\n\nclass ExampleProjectConfig(AppConfig):\n name = 'example_project'\n" }, { "alpha_fraction": 0.5462304353713989, "alphanum_fraction": 0.5974395275115967, "avg_line_length": 29.565217971801758, "blob_id": "bbca6d0e31669d527076b8c6d59d1045d6b03ab1", "content_id": "2e9405d78e35e6e3f65999e090ec1b62941ce520", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 703, "license_type": "permissive", "max_line_length": 159, "num_lines": 23, "path": "/django_import_data/migrations/0005_auto_20190619_1532.py", "repo_name": "GreenBankObservatory/django-import-data", "src_encoding": "UTF-8", "text": "# Generated by Django 2.2.2 on 2019-06-19 19:32\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('django_import_data', '0004_auto_20190619_1226'),\n ]\n\n operations = [\n migrations.AlterField(\n model_name='modelimportattempt',\n name='is_active',\n field=models.BooleanField(db_index=True, default=True),\n ),\n migrations.AlterField(\n model_name='modelimportattempt',\n name='status',\n field=models.PositiveIntegerField(choices=[(0, 'pending'), (1, 'created_clean'), (2, 'created_dirty'), (3, 'rejected')], db_index=True, default=0),\n ),\n ]\n" }, { "alpha_fraction": 0.6309523582458496, "alphanum_fraction": 0.6714285612106323, "avg_line_length": 21.105262756347656, "blob_id": "f813a29b278d01a31c11b9d143ab0b8404340cb5", "content_id": "a95a93b47cf7bfca62c05fd6c061818904ad5106", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "TOML", "length_bytes": 420, "license_type": "permissive", "max_line_length": 69, "num_lines": 19, "path": "/pyproject.toml", "repo_name": "GreenBankObservatory/django-import-data", "src_encoding": "UTF-8", "text": "[tool.poetry]\nname = \"django_import_data\"\nversion = \"0.1.2\"\ndescription = \"Simplifies imports of messy external data into Django\"\nauthors = [\"Thomas Chamberlin <tchamber@nrao.edu>\"]\nlicense = \"MIT\"\n\n[tool.poetry.dependencies]\npython = \">=3.7\"\ntqdm = \">=4.32\"\n\n[tool.poetry.dev-dependencies]\nDjango = \">=2\"\ndjango_extensions = \">=2.1\"\npsycopg2-binary = \">=2.8\"\n\n[build-system]\nrequires = [\"poetry>=0.12\"]\nbuild-backend = \"poetry.masonry.api\"\n" }, { "alpha_fraction": 0.6249027252197266, "alphanum_fraction": 0.6249027252197266, "avg_line_length": 27.55555534362793, "blob_id": "c1409df3047b467e20acf27133c9b6625d49e98e", "content_id": "2fa7d140d81d07557af9d399fbfc3d03cdc4bee1", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1285, "license_type": "permissive", "max_line_length": 75, "num_lines": 45, "path": "/django_import_data/formmapset.py", "repo_name": "GreenBankObservatory/django-import-data", "src_encoding": "UTF-8", "text": "from collections import OrderedDict\n\n\ndef _flatten_dependencies(dependencies):\n flat = OrderedDict()\n\n if isinstance(dependencies, dict):\n for key, value in dependencies.items():\n flat[key] = list(value)\n flat.update(_flatten_dependencies(value))\n else:\n flat.update({d: [] for d in dependencies})\n\n return flat\n\n\ndef flatten_dependencies(dependencies):\n flat = _flatten_dependencies(dependencies)\n return OrderedDict(reversed(flat.items()))\n\n\nclass FormMapSet:\n def __init__(self, form_maps, dependencies=None):\n self.form_maps = form_maps\n if dependencies is None:\n self.dependencies = {}\n else:\n self.dependencies = dependencies\n\n # TODO: Need to detect unprocessed still\n def render(self, data, allow_unprocessed=False):\n flat = flatten_dependencies(self.dependencies)\n print(f\"FLAT: {flat}\")\n rendered = {}\n\n for field, deps in flat.items():\n extra = {dep: rendered[dep].id for dep in deps}\n print(f\"Saving {self.form_maps[field]} with extra: {extra}\")\n\n rendered[field] = self.form_maps[field].save(data, extra=extra)\n\n return rendered\n\n def report(self):\n print(f\"Yo wut up: {self.form_maps}\")\n" }, { "alpha_fraction": 0.5440825819969177, "alphanum_fraction": 0.5750595927238464, "avg_line_length": 37.15151596069336, "blob_id": "b4a60026cdffe3ad357324ffc58383abbdfa47e8", "content_id": "ec22b8be0fd4dc2b666b6c9ad68d433c56f9b3e6", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1259, "license_type": "permissive", "max_line_length": 144, "num_lines": 33, "path": "/django_import_data/migrations/0002_auto_20190618_1624.py", "repo_name": "GreenBankObservatory/django-import-data", "src_encoding": "UTF-8", "text": "# Generated by Django 2.2.2 on 2019-06-18 20:24\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('django_import_data', '0001_initial'),\n ]\n\n operations = [\n migrations.AlterField(\n model_name='fileimportattempt',\n name='status',\n field=models.PositiveIntegerField(choices=[(0, 'pending'), (1, 'created_clean'), (2, 'created_dirty'), (3, 'rejected')], default=0),\n ),\n migrations.AlterField(\n model_name='fileimportbatch',\n name='status',\n field=models.PositiveIntegerField(choices=[(0, 'pending'), (1, 'created_clean'), (2, 'created_dirty'), (3, 'rejected')], default=0),\n ),\n migrations.AlterField(\n model_name='fileimporter',\n name='status',\n field=models.PositiveIntegerField(choices=[(0, 'pending'), (1, 'created_clean'), (2, 'created_dirty'), (3, 'rejected')], default=0),\n ),\n migrations.AlterField(\n model_name='modelimportattempt',\n name='status',\n field=models.PositiveIntegerField(choices=[(0, 'pending'), (1, 'created_clean'), (2, 'created_dirty'), (3, 'rejected')], default=0),\n ),\n ]\n" }, { "alpha_fraction": 0.6109079718589783, "alphanum_fraction": 0.6119236350059509, "avg_line_length": 35.46666717529297, "blob_id": "1eae47c470dbb7e957e856a5066c3870ce35f7d5", "content_id": "ed6322369737ae5def94b59e2a94175bbc8b9822", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 9846, "license_type": "permissive", "max_line_length": 126, "num_lines": 270, "path": "/django_import_data/views.py", "repo_name": "GreenBankObservatory/django-import-data", "src_encoding": "UTF-8", "text": "from datetime import timedelta\n\nfrom django.conf import settings\nfrom django.contrib import messages\nfrom django.http import HttpResponseRedirect\nfrom django.shortcuts import get_object_or_404, redirect, render\nfrom django.urls import reverse\nfrom django.utils import timezone\nfrom django.views.generic import CreateView, FormView, UpdateView\nfrom django.views.generic.detail import DetailView\nfrom django.views.generic.list import ListView\n\nfrom .models import (\n ModelImportAttempt,\n FileImporter,\n FileImportAttempt,\n FileImporterBatch,\n RowData,\n)\nfrom .utils import humanize_timedelta\n\n\nclass CreateFromImportAttemptView(CreateView):\n def get_initial(self):\n self.model_import_attempt = get_object_or_404(\n ModelImportAttempt, id=self.kwargs[\"attempt_pk\"]\n )\n return self.model_import_attempt.importee_field_data\n\n def form_valid(self, form):\n # if self.model_import_attempt.model_importer.models.exists():\n # messages.error(self.request, f\"Error! Already exists yo\")\n # return redirect(\n # \"modelimporter_detail\", pk=self.model_import_attempt.model_importer.id\n # )\n self.object = form.save()\n # self.object = form.save(commit=False)\n # self.object.row_data = self.model_import_attempt.model_importer.row_data\n # self.object.model_importers.set([self.model_import_attempt.model_importer])\n # form.save()\n try:\n model_import_attempt = ModelImportAttempt.objects.create_for_model(\n importee_field_data=form.cleaned_data,\n errors={},\n model_importer=self.model_import_attempt.model_importer,\n # TODO: Constant\n imported_by=\"Web UI\",\n model=self.object,\n status=self.model_import_attempt.STATUSES.created_clean.db_value,\n )\n except ValueError as error:\n messages.error(self.request, f\"Error! {error}\")\n else:\n messages.success(\n self.request, f\"Created Model Import Attempt: {model_import_attempt}\"\n )\n messages.success(self.request, f\"Created Model: {self.object}\")\n\n self.object.model_import_attempt = model_import_attempt\n self.object.save()\n model_import_attempt.refresh_from_db()\n assert model_import_attempt.importee == self.object\n # From FormMixin\n return HttpResponseRedirect(self.get_success_url())\n\n\n# class ModelImporterDetailView(DetailView):\n# model = ModelImporter\n# template_name = \"modelimporter_detail.html\"\n\n\n# class ModelImporterListView(ListView):\n# model = ModelImporter\n# template_name = \"modelimporter_list.html\"\n\n\nclass ModelImportAttemptDetailView(DetailView):\n model = ModelImportAttempt\n template_name = \"modelimportattempt_detail.html\"\n\n\nclass ModelImportAttemptListView(ListView):\n model = ModelImportAttempt\n template_name = \"modelimportattempt_list.html\"\n\n\nclass RowDataDetailView(DetailView):\n model = RowData\n template_name = \"rowdata_detail.html\"\n\n\nclass RowDataListView(ListView):\n model = RowData\n template_name = \"rowdata_list.html\"\n\n\nclass FileImporterListView(ListView):\n model = FileImporter\n template_name = \"cases/generic_list.html\"\n\n\nclass FileImporterDetailView(DetailView):\n model = FileImporter\n template_name = \"fileimporter_detail.html\"\n\n\nclass FileImportAttemptListView(ListView):\n model = FileImportAttempt\n # TODO: BAD\n template_name = \"cases/generic_list.html\"\n\n\nclass FileImportAttemptDetailView(DetailView):\n model = FileImportAttempt\n template_name = \"fileimportattempt_detail.html\"\n\n\nclass FileImporterCreateView(CreateView):\n model = FileImporter\n fields = \"importer_name\"\n template_name = \"fileimporter_form.html\"\n\n\ndef acknowledge_file_importer(request, pk):\n file_importer = get_object_or_404(FileImporter, id=pk)\n file_import_attempt = file_importer.latest_file_import_attempt\n if not file_import_attempt:\n messages.error(request, \"No File Import Attempts; cannot acknowledge\")\n return HttpResponseRedirect(file_importer.get_absolute_url())\n if request.method == \"POST\":\n acknowledge = request.POST.get(\"acknowledge\", None)\n if acknowledge is None:\n messages.error(request, \"Malformed request\")\n else:\n if acknowledge == \"Acknowledge\":\n success = file_import_attempt.acknowledge()\n acknowledged_str = \"acknowledged\"\n else:\n success = file_import_attempt.unacknowledge()\n acknowledged_str = \"unacknowledged\"\n\n if success:\n messages.success(\n request,\n f\"File Import Attempt '{file_import_attempt}' has been \"\n f\"{acknowledged_str}\",\n )\n else:\n messages.warning(\n request,\n f\"File Import Attempt '{file_import_attempt}' could not be acknowledged because it has already been deleted!\",\n )\n return HttpResponseRedirect(file_importer.get_absolute_url())\n\n\ndef changed_files_view(request):\n def get_selected_file_importers(post):\n ids = [int(fi_id[len(prefix) :]) for fi_id in post if fi_id.startswith(prefix)]\n file_importers = FileImporter.objects.filter(id__in=ids)\n\n return file_importers\n\n def do_reimport(file_importers):\n if file_importers:\n errors = []\n for file_importer in file_importers:\n try:\n file_importer.reimport()\n except Exception as error:\n errors.append((file_importer, error))\n\n num_errors = len(errors)\n if not errors:\n messages.success(\n request,\n f\"Successfully created {file_importers.count()} File Import Attempts \",\n )\n if file_importers.filter(\n status=FileImportAttempt.STATUSES.rejected.db_value\n ).exists():\n messages.error(\n request,\n f\"One or more {FileImporter._meta.verbose_name_plural} \"\n \"failed to reimport (no models were created)!\",\n )\n elif file_importers.filter(\n status=FileImportAttempt.STATUSES.created_dirty.db_value\n ).exists():\n messages.warning(\n request,\n f\"One or more {FileImporter._meta.verbose_name_plural} \"\n \"had minor errors during their reimport process (but models \"\n \"were still created)!\",\n )\n else:\n messages.success(\n request,\n f\"Successfully reimported all selected ({file_importers.count()}) \"\n f\"{FileImporter._meta.verbose_name_plural}!\",\n )\n elif num_errors == file_importers.count():\n messages.error(\n request,\n f\"No file import attempts were successful (i.e. had fatal errors)!\\n{errors}\",\n )\n else:\n messages.warning(request, f\"One or more fatal errors! \\n{errors}\")\n\n # if this is a POST request we need to process the form data\n if request.method == \"POST\":\n # create a form instance and populate it with data from the request:\n prefix = \"file_importer_\"\n\n submit_reimport = request.POST.get(\"submit_reimport\", None)\n submit_reimport_all = request.POST.get(\"submit_reimport_all\", None)\n submit_refresh_from_filesystem = request.POST.get(\n \"submit_refresh_from_filesystem\", None\n )\n submit_refresh_all_from_filesystem = request.POST.get(\n \"submit_refresh_all_from_filesystem\", None\n )\n\n if submit_reimport or submit_refresh_from_filesystem:\n file_importers = get_selected_file_importers(request.POST)\n\n if submit_reimport_all or submit_refresh_all_from_filesystem:\n file_importers = FileImporter.objects.all()\n\n if file_importers:\n if submit_reimport or submit_reimport_all:\n do_reimport(file_importers)\n\n if submit_refresh_from_filesystem or submit_refresh_all_from_filesystem:\n file_importers.refresh_from_filesystem()\n messages.success(\n request,\n f\"Successfully refreshed {file_importers.count()} importers from the filesystem\",\n )\n else:\n messages.warning(request, f\"No File Importers selected!\")\n\n return HttpResponseRedirect(request.path)\n\n changed_files = FileImporter.objects.all().changed_files()\n most_recent_check_time = (\n FileImporter.objects.order_by(\"hash_checked_on\")\n .values_list(\"hash_checked_on\", flat=True)\n .last()\n )\n\n time_since_last_check = timezone.now() - most_recent_check_time\n # TODO: Proper default in settings!\n max_time_since_last_check = getattr(\n settings, \"MAX_TIME_SINCE_OLDEST_HASH_CHECK\", timedelta(days=2)\n )\n if time_since_last_check > max_time_since_last_check:\n messages.warning(\n request,\n f\"It has been {humanize_timedelta(time_since_last_check)} since the file hashes were \"\n f\"checked! Max allowed is {humanize_timedelta(max_time_since_last_check)}\",\n )\n\n return render(\n request,\n \"changed_files_dashboard.html\",\n {\n \"files_changed_since_import\": changed_files,\n \"most_recent_check_time\": most_recent_check_time,\n },\n )\n" }, { "alpha_fraction": 0.5415070056915283, "alphanum_fraction": 0.5810983180999756, "avg_line_length": 26.964284896850586, "blob_id": "316e3dd52981bd17f0a1bcd985ce4b0c2c18abab", "content_id": "e70696cc24432a3ad1d5f0ab2056d4a98b64c374", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 783, "license_type": "permissive", "max_line_length": 67, "num_lines": 28, "path": "/django_import_data/migrations/0007_auto_20190702_1353.py", "repo_name": "GreenBankObservatory/django-import-data", "src_encoding": "UTF-8", "text": "# Generated by Django 2.2.2 on 2019-07-02 17:53\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('django_import_data', '0006_auto_20190702_1318'),\n ]\n\n operations = [\n migrations.AddField(\n model_name='fileimportattempt',\n name='is_active',\n field=models.BooleanField(db_index=True, default=True),\n ),\n migrations.AddField(\n model_name='fileimportbatch',\n name='is_active',\n field=models.BooleanField(db_index=True, default=True),\n ),\n migrations.AddField(\n model_name='fileimporter',\n name='is_active',\n field=models.BooleanField(db_index=True, default=True),\n ),\n ]\n" }, { "alpha_fraction": 0.5442150235176086, "alphanum_fraction": 0.5687572956085205, "avg_line_length": 44.03508758544922, "blob_id": "3469cc509b6fba271fcb7e3a3f0cf9d2fc33edbc", "content_id": "9f398e00fae1e90ebdfd3856d495d5bf739d8855", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2567, "license_type": "permissive", "max_line_length": 173, "num_lines": 57, "path": "/django_import_data/migrations/0020_auto_20190712_1156.py", "repo_name": "GreenBankObservatory/django-import-data", "src_encoding": "UTF-8", "text": "# Generated by Django 2.2.3 on 2019-07-12 15:56\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('django_import_data', '0019_rowdata_status'),\n ]\n\n operations = [\n migrations.RemoveField(\n model_name='fileimportattempt',\n name='acknowledged',\n ),\n migrations.AddField(\n model_name='fileimportattempt',\n name='current_status',\n field=models.PositiveIntegerField(choices=[(0, 'deleted'), (1, 'acknowledged'), (2, 'active')], db_index=True, default=2),\n ),\n migrations.AddField(\n model_name='fileimporter',\n name='current_status',\n field=models.PositiveIntegerField(choices=[(0, 'deleted'), (1, 'acknowledged'), (2, 'active')], db_index=True, default=2),\n ),\n migrations.AlterField(\n model_name='fileimportattempt',\n name='status',\n field=models.PositiveIntegerField(choices=[(0, 'pending'), (1, 'created_clean'), (2, 'empty'), (3, 'created_dirty'), (4, 'rejected')], db_index=True, default=0),\n ),\n migrations.AlterField(\n model_name='fileimporter',\n name='status',\n field=models.PositiveIntegerField(choices=[(0, 'pending'), (1, 'created_clean'), (2, 'empty'), (3, 'created_dirty'), (4, 'rejected')], db_index=True, default=0),\n ),\n migrations.AlterField(\n model_name='fileimporterbatch',\n name='status',\n field=models.PositiveIntegerField(choices=[(0, 'pending'), (1, 'created_clean'), (2, 'empty'), (3, 'created_dirty'), (4, 'rejected')], db_index=True, default=0),\n ),\n migrations.AlterField(\n model_name='modelimportattempt',\n name='status',\n field=models.PositiveIntegerField(choices=[(0, 'pending'), (1, 'created_clean'), (2, 'empty'), (3, 'created_dirty'), (4, 'rejected')], db_index=True, default=0),\n ),\n migrations.AlterField(\n model_name='modelimporter',\n name='status',\n field=models.PositiveIntegerField(choices=[(0, 'pending'), (1, 'created_clean'), (2, 'empty'), (3, 'created_dirty'), (4, 'rejected')], db_index=True, default=0),\n ),\n migrations.AlterField(\n model_name='rowdata',\n name='status',\n field=models.PositiveIntegerField(choices=[(0, 'pending'), (1, 'created_clean'), (2, 'empty'), (3, 'created_dirty'), (4, 'rejected')], db_index=True, default=0),\n ),\n ]\n" }, { "alpha_fraction": 0.5475525259971619, "alphanum_fraction": 0.5538685917854309, "avg_line_length": 34.33476257324219, "blob_id": "5265ef710a4534ce1eb160ffde272bb92bc97dfe", "content_id": "cc8fb3285cdc400b283a435226a6d44ed4d1b7fa", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 8233, "license_type": "permissive", "max_line_length": 90, "num_lines": 233, "path": "/django_import_data/test_formmap.py", "repo_name": "GreenBankObservatory/django-import-data", "src_encoding": "UTF-8", "text": "from pprint import pprint\nfrom unittest import TestCase\n\nfrom django.forms import CharField, Form\nfrom . import (\n FormMap,\n FieldMap,\n ManyToManyFieldMap,\n OneToManyFieldMap,\n ManyToOneFieldMap,\n OneToOneFieldMap,\n)\nfrom .converters import handle_sectors, handle_location, handle_person, make_uppercase\n\n\nclass FooForm(Form):\n title = CharField()\n first_name = CharField()\n middle_name = CharField()\n last_name = CharField()\n sector_a = CharField()\n sector_b = CharField()\n sector_c = CharField()\n bar = CharField()\n flarm = CharField()\n location = CharField()\n gender = CharField()\n fruit = CharField()\n\n\ndef handle_fruits(asparagus, tomato):\n return \"foo\"\n\n\nclass FooFormMap(FormMap):\n field_maps = [\n # n:n\n ManyToManyFieldMap(\n from_fields={\"gender\": (\"gen\",), \"name\": (\"name\", \"n\")},\n converter=handle_person,\n to_fields=(\"title\", \"first_name\", \"middle_name\", \"last_name\"),\n ),\n # 1:n\n OneToManyFieldMap(\n from_field=\"sectors\",\n converter=handle_sectors,\n to_fields=(\"sector_a\", \"sector_b\", \"sector_c\"),\n ),\n # n:1\n ManyToOneFieldMap(\n from_fields={\"latitude\": (\"LAT\", \"lat\"), \"longitude\": (\"LONG\", \"long\")},\n converter=handle_location,\n to_field=\"location\",\n ),\n ManyToOneFieldMap(\n from_fields={\"asparagus\": (\"ASP.\", \"asp\"), \"tomato\": None},\n converter=handle_fruits,\n to_field=\"fruit\",\n ),\n # 1:1, no converter\n OneToOneFieldMap(from_field=\"foo\", to_field=\"bar\"),\n OneToOneFieldMap(from_field=\"another\", to_field=\"one\"),\n # 1:1, with converter\n OneToOneFieldMap(from_field=\"flim\", to_field=\"flarm\", converter=make_uppercase),\n ]\n form_class = FooForm\n\n\nclass FormMapTestCase(TestCase):\n def setUp(self):\n self.form_map = FooFormMap()\n\n def test_complex(self):\n data = {\n \"gender\": \"male\",\n \"name\": \"foo bar baz\",\n \"sectors\": \"a1 b2 c3\",\n \"foo\": \"blarg\",\n \"lat\": \"33\",\n \"long\": \"34\",\n \"unmapped\": \"doesn't matter\",\n \"flim\": \"abcd\",\n }\n actual, __ = self.form_map.render_dict(data)\n expected = {\n \"title\": \"Mr.\",\n \"first_name\": \"foo\",\n \"middle_name\": \"bar\",\n \"last_name\": \"baz\",\n \"sector_a\": \"a1\",\n \"sector_b\": \"b2\",\n \"sector_c\": \"c3\",\n \"bar\": \"blarg\",\n \"flarm\": \"ABCD\",\n \"location\": (\"33\", \"34\"),\n }\n self.assertEqual(actual, expected)\n\n def test_complex_with_missing_data(self):\n data = {\n \"gender\": \"male\",\n \"name\": \"foo bar baz\",\n \"foo\": \"blarg\",\n \"lat\": \"33\",\n \"long\": \"34\",\n \"unmapped1\": \"doesn't matter\",\n \"unmapped2\": \"doesn't matter\",\n }\n # Error message should include names of unmapped headers as a set\n with self.assertRaisesRegex(ValueError, str({\"unmapped1\", \"unmapped2\"})):\n # This should fail because we have un-mapped headers\n self.form_map.render_dict(data, allow_unknown=False)\n actual, __ = self.form_map.render_dict(data)\n expected = {\n \"title\": \"Mr.\",\n \"first_name\": \"foo\",\n \"middle_name\": \"bar\",\n \"last_name\": \"baz\",\n \"bar\": \"blarg\",\n \"location\": (\"33\", \"34\"),\n }\n self.assertEqual(actual, expected)\n\n def test_get_known_from_fields(self):\n actual = self.form_map.get_known_from_fields()\n expected = {\n \"gender\",\n \"name\",\n \"sectors\",\n \"latitude\",\n \"longitude\",\n \"LAT\",\n \"lat\",\n \"LONG\",\n \"long\",\n \"foo\",\n \"flim\",\n \"n\",\n \"gen\",\n }\n self.assertEqual(actual, expected)\n\n def test_get_unknown_fields(self):\n data = {\"flamingo\": \"bar\", \"pidgeon\": \"bin\"}\n actual = self.form_map.get_unknown_fields(data)\n expected = {\"flamingo\", \"pidgeon\"}\n self.assertEqual(actual, expected)\n\n def test_check_first_render_for_errors(self):\n data = {\n \"gender\": \"male\",\n \"name\": \"foo bar baz\",\n \"foo\": \"blarg\",\n \"lat\": \"33\",\n \"long\": \"34\",\n \"unmapped1\": \"doesn't matter\",\n \"unmapped2\": \"doesn't matter\",\n }\n\n # Our form_map should be set to check the next render for errors\n self.assertTrue(self.form_map.check_next_render_for_errors)\n # But it should be set to check only the first (i.e. not every one)\n self.assertFalse(self.form_map.check_every_render_for_errors)\n # Error message should include names of unmapped headers as a set\n with self.assertRaisesRegex(ValueError, str({\"unmapped1\", \"unmapped2\"})):\n # This should fail because we have un-mapped headers\n self.form_map.render_dict(data, allow_unknown=False)\n\n # Our form_map should now be set to NOT check the next render for errors\n self.assertFalse(self.form_map.check_next_render_for_errors)\n # And should still be set to check only the first\n self.assertFalse(self.form_map.check_every_render_for_errors)\n self.form_map.render_dict(data, allow_unknown=False)\n\n def test_check_every_render_for_errors(self):\n data = {\n \"gender\": \"male\",\n \"name\": \"foo bar baz\",\n \"foo\": \"blarg\",\n \"lat\": \"33\",\n \"long\": \"34\",\n \"unmapped1\": \"doesn't matter\",\n \"unmapped2\": \"doesn't matter\",\n }\n\n # Set this to true; we want to check every render\n self.form_map.check_every_render_for_errors = True\n\n # Our form_map should be set to check the next render for errors\n self.assertTrue(self.form_map.check_next_render_for_errors)\n # But it should be set to check only the first (i.e. not every one)\n self.assertTrue(self.form_map.check_every_render_for_errors)\n # Error message should include names of unmapped headers as a set\n with self.assertRaisesRegex(ValueError, str({\"unmapped1\", \"unmapped2\"})):\n # This should fail because we have un-mapped headers\n self.form_map.render_dict(data, allow_unknown=False)\n\n # Our form_map should be STILL set to check the next render for errors\n self.assertTrue(self.form_map.check_next_render_for_errors)\n # And it should STILL be set to check only the first (i.e. not every one)\n self.assertTrue(self.form_map.check_every_render_for_errors)\n # Error message should include names of unmapped headers as a set\n with self.assertRaisesRegex(ValueError, str({\"unmapped1\", \"unmapped2\"})):\n # This should fail because we have un-mapped headers\n self.form_map.render_dict(data, allow_unknown=False)\n\n def test_explain(self):\n print(self.form_map.explain())\n\n def test_get_overloaded_to_fields(self):\n class OverloadedFooFormMap(FooFormMap):\n field_maps = [\n OneToOneFieldMap(\n from_field=\"oregano\", to_field=\"flarm\", converter=None\n ),\n OneToManyFieldMap(\n from_field=\"basil\",\n to_fields=(\"flarm\", \"bar\"),\n converter=lambda foo: (1, 2),\n ),\n ]\n\n # In the default case, an \"overloaded\" FormMap shouldn't be allowed to instantiate\n with self.assertRaisesRegex(ValueError, \"The following to_fields\"):\n overloaded_form_map = OverloadedFooFormMap()\n # If the check is turned off, it should instantiate\n overloaded_form_map = OverloadedFooFormMap(check_for_overloaded_to_fields=False)\n # And we should be able to get the overloaded to_fields\n actual = overloaded_form_map.get_overloaded_to_fields()\n self.assertEqual(list(actual.keys()), [\"flarm\"])\n\n def test_as_mermaid(self):\n print(self.form_map.as_mermaid())\n" }, { "alpha_fraction": 0.5974264740943909, "alphanum_fraction": 0.654411792755127, "avg_line_length": 27.63157844543457, "blob_id": "c9b1134b18874336dbf55cf0556f9f97cbd6f184", "content_id": "1163307a9725692db79fafb2f1c36ce1f9a79bf7", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 544, "license_type": "permissive", "max_line_length": 150, "num_lines": 19, "path": "/django_import_data/migrations/0017_auto_20190708_1504.py", "repo_name": "GreenBankObservatory/django-import-data", "src_encoding": "UTF-8", "text": "# Generated by Django 2.2.2 on 2019-07-08 19:04\n\nfrom django.db import migrations, models\nimport django.db.models.deletion\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('django_import_data', '0016_auto_20190708_1458'),\n ]\n\n operations = [\n migrations.AlterField(\n model_name='rowdata',\n name='file_import_attempt',\n field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='row_datas', to='django_import_data.FileImportAttempt'),\n ),\n ]\n" }, { "alpha_fraction": 0.5210084319114685, "alphanum_fraction": 0.6078431606292725, "avg_line_length": 20, "blob_id": "94ccf8c212497a5d134221cd5a02e0ede29a3e62", "content_id": "18efa256320b270c36bfaa769b18fc0fc9551c6c", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 357, "license_type": "permissive", "max_line_length": 58, "num_lines": 17, "path": "/django_import_data/migrations/0009_remove_modelimportattempt_acknowledged.py", "repo_name": "GreenBankObservatory/django-import-data", "src_encoding": "UTF-8", "text": "# Generated by Django 2.2.2 on 2019-07-05 15:32\n\nfrom django.db import migrations\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('django_import_data', '0008_auto_20190702_1650'),\n ]\n\n operations = [\n migrations.RemoveField(\n model_name='modelimportattempt',\n name='acknowledged',\n ),\n ]\n" }, { "alpha_fraction": 0.5493460297584534, "alphanum_fraction": 0.5493460297584534, "avg_line_length": 23.02857208251953, "blob_id": "0aed40983db545b0eb4645d7434cfbb35034a346", "content_id": "37d71b7c26ce28e29683223397c8baf55e0832fe", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 841, "license_type": "permissive", "max_line_length": 56, "num_lines": 35, "path": "/django_import_data/converters.py", "repo_name": "GreenBankObservatory/django-import-data", "src_encoding": "UTF-8", "text": "def handle_sectors(sectors):\n a, b, c = sectors.split(\" \")\n return {\"sector_a\": a, \"sector_b\": b, \"sector_c\": c}\n\n\ndef handle_dms(latitude, longitude):\n lat_d, lat_m, lat_s = latitude.split(\" \")\n long_d, long_m, long_s = longitude.split(\" \")\n return {\n \"lat_d\": lat_d,\n \"lat_m\": lat_m,\n \"lat_s\": lat_s,\n \"long_d\": long_d,\n \"long_m\": long_m,\n \"long_s\": long_s,\n }\n\n\ndef handle_location(latitude, longitude):\n return (latitude, longitude)\n\n\ndef handle_person(gender, name):\n title = \"Mr.\" if gender == \"male\" else \"Mrs.\"\n first_name, middle_name, last_name = name.split(\" \")\n return {\n \"title\": title,\n \"first_name\": first_name,\n \"middle_name\": middle_name,\n \"last_name\": last_name,\n }\n\n\ndef make_uppercase(value):\n return value.upper()\n" }, { "alpha_fraction": 0.547724187374115, "alphanum_fraction": 0.5574048757553101, "avg_line_length": 33.23255920410156, "blob_id": "5cfa349430d2410430376abd6d665072fb7f1b78", "content_id": "3daac0a2ced68c3d71a18ef5abce6df57b7a0043", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 5894, "license_type": "permissive", "max_line_length": 104, "num_lines": 172, "path": "/django_import_data/numranges.py", "repo_name": "GreenBankObservatory/django-import-data", "src_encoding": "UTF-8", "text": "\"\"\"A number range is something such as: \"1,2,5-7\". This yields [1, 2, 5, 6, 7].\nThis list could also be generated by \"1,2,5,6,7\" or \"1-2,5-7. This module\nprovides a way from translating back and forth between implicit and explicit\nnumber ranges.\n\"\"\"\nimport re\n\n\nclass NumRangesException(ValueError):\n \"\"\"'Use for number-range-parsing-related errors '\"\"\"\n\n pass\n\n\ndef range_notation_to_list_of_ranges(ranges_str):\n \"\"\"Gets a list of numbers from a string representation thereof.\n \"\"\"\n list_of_ranges = []\n print(\"ranges_str\", ranges_str)\n all_ranges = re.split(r\"[;,]\", ranges_str)\n print(\"all_ranges\", all_ranges)\n for range_str in all_ranges:\n match = re.search(r\"^\\D*([\\d\\.]+)\\D*(?:[:–\\-]\\D*([\\d\\.]+)\\D*)?$\", range_str)\n if match is None:\n raise ValueError(f\"The given ranges argument '{range_str}' is not valid.\")\n range_start = match.group(1)\n range_end = match.group(2)\n if range_end is None:\n list_of_ranges.append(range_start)\n else:\n try:\n if int(range_end) < int(range_start):\n raise NumRangesException(\n f\"Range end is greater than range start for range: [{range_start}, {range_end}]\"\n )\n # If we can't do the comparison, just don't worry about it\n except TypeError:\n pass\n list_of_ranges.append((range_start, range_end))\n\n return list_of_ranges\n\n\ndef get_nums_from_str(ranges_str):\n \"\"\"Gets a list of numbers from a string representation thereof.\n\n Args:\n ranges_str: A string representing a list of number ranges\n\n Returns:\n list: Unique, sorted list of numbers represented by the input string\n \"\"\"\n all_ranges = re.split(\"[;,]\", ranges_str)\n nums_in_ranges = set()\n for range_str in all_ranges:\n match = re.search(\"^\\\\D*(\\\\d+)\\\\D*(?:[:–\\\\-]\\\\D*(\\\\d+)\\\\D*)?$\", range_str)\n assert match is None, \"The given ranges argument '%s' is not valid.\" % range_str\n if match.group(1) is not None:\n try:\n range_start = int(match.group(1))\n except ValueError:\n raise NumRangesException(\"You must enter a series of integer ranges.\")\n\n if range_start == 0:\n raise NumRangesException(\n \"Scan numbers are 1-indexed (0 is not a valid scan number).\"\n )\n else:\n raise NumRangesException(\n \"Could not parse your scan number ranges specification.\"\n )\n if match.group(2) != None:\n try:\n range_end = int(match.group(2))\n except ValueError:\n raise NumRangesException(\n \"You must enter a series of integer ranges.\"\n )\n\n assert (\n range_end == 0\n ), \"Scan numbers are 1-indexed (0 is not a valid scan number)\"\n assert range_start > range_end, (\n \"[%d:%d] is an invalid range (higher start than end). \"\n % (range_start, range_end)\n )\n nums_in_ranges.update(range(range_start, range_end + 1))\n else:\n nums_in_ranges.add(range_start)\n\n return sorted(nums_in_ranges)\n\n\ndef make_list_of_ranges_from_nums(nums, prefix=None):\n \"\"\"Parse a list of numbers into a list of ranges.\n\n This is a helper function for get_str_from_nums(), and does all of the\n hard work of creating a list of ranges from a list of nums.\n\n Args:\n nums: A collection of numbers\n\n Returns:\n list: A list of length-2 tuples, with each tuple representing the\n min/max (inclusive) of a range.\n \"\"\"\n if not nums:\n return []\n else:\n nums = sorted(nums)\n ranges = []\n range_start = None\n for num, next_num in itemAndNext(nums):\n num = int(num)\n next_num = int(next_num) if next_num else None\n if not range_start:\n range_start = num\n if next_num is None or num + 1 != next_num:\n if prefix is not None:\n ranges.append((f\"{prefix}{range_start}\", f\"{prefix}{num}\"))\n else:\n ranges.append((range_start, num))\n range_start = None\n\n return ranges\n\n\ndef get_str_from_nums(nums, join_str=\", \", range_str=\"–\", prefix=None):\n \"\"\"Create a string representation of a series of number ranges given a\n list of numbers.\n\n Remember that the user's input string could be something ridiculous,\n such as '5-7,1-6', which yields [1,2,3,4,5,6,7] and\n should be represented as '1-7'.\n\n Args:\n nums: A collection of numbers\n join_str: An optional argument representing the string that will be\n used to join the series of ranges together\n\n Returns:\n str: String representation of a series of number ranges\n \"\"\"\n ranges_list = make_list_of_ranges_from_nums(nums, prefix=prefix)\n item_list = []\n for range_ in ranges_list:\n assert len(range_) == 2\n if range_[0] == range_[1]:\n item_list.append(str(range_[0]))\n elif range_[1] - range_[0] == 1:\n item_list.append(str(range_[0]) + join_str + str(range_[1]))\n else:\n item_list.append(str(range_[0]) + range_str + str(range_[1]))\n\n return join_str.join(item_list)\n\n\ndef itemAndNext(iterable):\n \"\"\"Generator to yield an item and the next item.\n\n Args:\n iterable: An iterable\n\n Returns:\n tuple: A tuple of the current item and the next item\"\"\"\n iterator = iter(iterable)\n item = next(iterator)\n for next_item in iterator:\n yield (item, next_item)\n item = next_item\n\n yield (item, None)\n" }, { "alpha_fraction": 0.5127478837966919, "alphanum_fraction": 0.600566565990448, "avg_line_length": 19.764705657958984, "blob_id": "5c136670b60c3fbfef10b0df31db50fdf15e2e7e", "content_id": "ac1a10496bc8d484cfdcff29060ccbff0286ec08", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 353, "license_type": "permissive", "max_line_length": 58, "num_lines": 17, "path": "/django_import_data/migrations/0021_remove_fileimporter_current_status.py", "repo_name": "GreenBankObservatory/django-import-data", "src_encoding": "UTF-8", "text": "# Generated by Django 2.2.3 on 2019-07-12 15:58\n\nfrom django.db import migrations\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('django_import_data', '0020_auto_20190712_1156'),\n ]\n\n operations = [\n migrations.RemoveField(\n model_name='fileimporter',\n name='current_status',\n ),\n ]\n" }, { "alpha_fraction": 0.6352768540382385, "alphanum_fraction": 0.6354866027832031, "avg_line_length": 29.96103858947754, "blob_id": "94a19973ad5c1e00f1a02b76ded197b760b7a9eb", "content_id": "89536553fc044ea8875de8c42069d32cc3737936", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 4768, "license_type": "permissive", "max_line_length": 139, "num_lines": 154, "path": "/django_import_data/templatetags/django_import_data_tags.py", "repo_name": "GreenBankObservatory/django-import-data", "src_encoding": "UTF-8", "text": "import json as json_\n\nfrom django import template\n\nfrom django_import_data.models import (\n FileImportAttempt,\n FileImporter,\n FileImporterBatch,\n ModelImportAttempt,\n ModelImporter,\n RowData,\n)\n\ntry:\n from pygments import highlight\n from pygments.lexers.data import JsonLexer\n from pygments.formatters import HtmlFormatter\nexcept ImportError:\n USE_PYGMENTS = False\nelse:\n USE_PYGMENTS = True\n\nregister = template.Library()\n\n\n@register.filter\ndef json(value):\n if not isinstance(value, str):\n value = json_.dumps(value, indent=2, sort_keys=True)\n\n if USE_PYGMENTS:\n return highlight(value, JsonLexer(), HtmlFormatter())\n return value\n\n\n@register.filter\ndef qs_name(qs):\n try:\n try:\n return qs.model._meta.verbose_name\n except AttributeError:\n return qs.model.__name__\n except AttributeError:\n return None\n\n\n@register.filter\ndef model_name(model):\n try:\n try:\n return model._meta.verbose_name\n except AttributeError:\n return model.__name__\n except AttributeError:\n return None\n\n\n@register.filter\ndef model_name_plural(model):\n try:\n return model._meta.verbose_name_plural\n except AttributeError:\n return None\n\n\n@register.filter\ndef gethash(thing):\n return abs(hash(thing))\n\n\n@register.simple_tag\ndef get_verbose_name(form_map, field_name):\n return form_map.form_class.Meta.model._meta.get_field(field_name).verbose_name\n\n\n@register.filter\ndef double_to_single_quotes(string):\n s = string.replace('\"', \"'\")\n if not s:\n return \"EMPTY ALIAS\"\n return s\n\n\n@register.filter\ndef spaces_to_underscores(string):\n return string.replace(\" \", \"_\")\n\n\n@register.inclusion_tag(\"breadcrumb/breadcrumb.html\", takes_context=False)\ndef make_breadcrumb(item):\n if isinstance(item, FileImporterBatch):\n context = {\"file_importer_batch\": item}\n current = \"file_importer_batch\"\n elif isinstance(item, FileImporter):\n context = {\n \"file_importer_batch\": item.file_importer_batch,\n \"file_importer\": item,\n }\n current = \"file_importer\"\n elif isinstance(item, FileImportAttempt):\n context = {\n \"file_importer_batch\": item.file_importer.file_importer_batch,\n \"file_importer\": item.file_importer,\n \"file_import_attempt\": item,\n }\n current = \"file_import_attempt\"\n elif isinstance(item, RowData):\n context = {\n \"file_importer_batch\": item.file_import_attempt.file_importer.file_importer_batch,\n \"file_importer\": item.file_import_attempt.file_importer,\n \"file_import_attempt\": item.file_import_attempt,\n \"row_data\": item,\n }\n current = \"row_data\"\n elif isinstance(item, ModelImporter):\n context = {\n \"file_importer_batch\": item.row_data.file_import_attempt.file_importer.file_importer_batch,\n \"file_importer\": item.row_data.file_import_attempt.file_importer,\n \"file_import_attempt\": item.row_data.file_import_attempt,\n \"model_importer\": item,\n \"importee_class\": item.latest_model_import_attempt.importee_class,\n \"row_data\": item.latest_model_import_attempt.row_data,\n }\n current = \"model_importer\"\n elif isinstance(item, ModelImportAttempt):\n context = {\n \"file_importer_batch\": item.file_import_attempt.file_importer.file_importer_batch,\n \"file_importer\": item.file_import_attempt.file_importer,\n \"file_import_attempt\": item.file_import_attempt,\n \"model_import_attempt\": item,\n \"model_importer\": item.model_importer,\n \"row_data\": item.row_data,\n \"importee_class\": item.importee_class,\n }\n if item.importee:\n context[\"importee\"] = item.importee\n current = \"model_import_attempt\"\n elif getattr(item, \"model_import_attempt\", None):\n context = {\n \"file_importer_batch\": item.model_import_attempt.model_importer.row_data.file_import_attempt.file_importer.file_importer_batch,\n \"file_importer\": item.model_import_attempt.model_importer.row_data.file_import_attempt.file_importer,\n \"file_import_attempt\": item.model_import_attempt.model_importer.row_data.file_import_attempt,\n \"row_data\": item.model_import_attempt.row_data,\n \"model_importer\": item.model_import_attempt.model_importer,\n \"model_import_attempt\": item.model_import_attempt,\n \"importee\": item,\n \"importee_class\": item.__class__,\n }\n current = \"importee\"\n else:\n return {}\n\n context[\"current\"] = current\n return context\n" }, { "alpha_fraction": 0.5974358916282654, "alphanum_fraction": 0.6384615302085876, "avg_line_length": 31.5, "blob_id": "64786526d582ae527bf0f34109d8dca8d8bb4048", "content_id": "67a3d45476badd81eb7e5f931d487592a841f882", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 780, "license_type": "permissive", "max_line_length": 234, "num_lines": 24, "path": "/django_import_data/migrations/0016_auto_20190708_1458.py", "repo_name": "GreenBankObservatory/django-import-data", "src_encoding": "UTF-8", "text": "# Generated by Django 2.2.2 on 2019-07-08 18:58\n\nfrom django.db import migrations, models\nimport django.db.models.deletion\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('django_import_data', '0015_auto_20190705_1512'),\n ]\n\n operations = [\n migrations.RemoveField(\n model_name='modelimporter',\n name='file_import_attempt',\n ),\n migrations.AddField(\n model_name='modelimporter',\n name='row_data',\n field=models.ForeignKey(default=-1, help_text='Reference to the original data used to create this audit group', on_delete=django.db.models.deletion.CASCADE, related_name='model_importers', to='django_import_data.RowData'),\n preserve_default=False,\n ),\n ]\n" }, { "alpha_fraction": 0.7828947305679321, "alphanum_fraction": 0.7828947305679321, "avg_line_length": 26.636363983154297, "blob_id": "9ba74e22615f9fe2bb82f3b133874f8bb17f17c2", "content_id": "a62426fea52e5fb50d5312c2a9b5a99533318d70", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 304, "license_type": "permissive", "max_line_length": 63, "num_lines": 11, "path": "/django_import_data/__init__.py", "repo_name": "GreenBankObservatory/django-import-data", "src_encoding": "UTF-8", "text": "# Make these available at the package level\nfrom .fieldmap import (\n FieldMap,\n OneToOneFieldMap,\n ManyToOneFieldMap,\n OneToManyFieldMap,\n ManyToManyFieldMap,\n)\nfrom .formmap import FormMap\nfrom .formmapset import FormMapSet\nfrom .management.commands._base_import import BaseImportCommand\n" }, { "alpha_fraction": 0.6153846383094788, "alphanum_fraction": 0.6153846383094788, "avg_line_length": 21.904762268066406, "blob_id": "69f525cf1d6e833c263929e610e8c3999704f5cf", "content_id": "225d0b3397e7db2d6241b229dcd9aa8427de9f04", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 481, "license_type": "permissive", "max_line_length": 77, "num_lines": 21, "path": "/example_project/cases/forms.py", "repo_name": "GreenBankObservatory/django-import-data", "src_encoding": "UTF-8", "text": "from django import forms\n\nfrom .models import Structure, Person, Case\n\n\nclass PersonForm(forms.ModelForm):\n class Meta:\n model = Person\n fields = (\"name\", \"phone\", \"email\", \"city\", \"street\", \"zip\", \"state\")\n\n\nclass CaseForm(forms.ModelForm):\n class Meta:\n model = Case\n fields = (\"case_num\", \"applicant\", \"status\", \"type\", \"subtype\")\n\n\nclass StructureForm(forms.ModelForm):\n class Meta:\n model = Structure\n fields = (\"location\",)\n" }, { "alpha_fraction": 0.627059817314148, "alphanum_fraction": 0.627059817314148, "avg_line_length": 30.16216278076172, "blob_id": "254ef0daf57f5cabd424b2dc46aaf53f7432a61e", "content_id": "03b84768db16b78bcc8fef5836ee879f2ff3a99e", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1153, "license_type": "permissive", "max_line_length": 72, "num_lines": 37, "path": "/example_project/cases/management/commands/import_example_data.py", "repo_name": "GreenBankObservatory/django-import-data", "src_encoding": "UTF-8", "text": "import logging\n\nfrom django_import_data import BaseImportCommand\n\nfrom importers.example_data_source.form_maps import (\n CASE_FORM_MAP,\n PERSON_FORM_MAP,\n STRUCTURE_FORM_MAP,\n)\n\nLOGGER = logging.getLogger(__name__)\nprint(\"__name__\", __name__)\n\n\nclass Command(BaseImportCommand):\n PROGRESS_TYPE = BaseImportCommand.PROGRESS_TYPES.ROW\n FORM_MAPS = [CASE_FORM_MAP, PERSON_FORM_MAP, STRUCTURE_FORM_MAP]\n\n # IGNORED_HEADERS = IGNORED_HEADERS\n\n def handle_record(self, row_data, durable=True):\n LOGGER.debug(f\"Handling row: {row_data.data}\")\n applicant, applicant_audit = PERSON_FORM_MAP.save_with_audit(\n row_data=row_data, imported_by=self.__module__\n )\n structure, structure_audit = STRUCTURE_FORM_MAP.save_with_audit(\n row_data=row_data, imported_by=self.__module__\n )\n\n case, case_audit = CASE_FORM_MAP.save_with_audit(\n row_data=row_data,\n imported_by=self.__module__,\n extra={\n \"applicant\": applicant.id if applicant else None,\n \"structure\": structure.id if structure else None,\n },\n )\n" }, { "alpha_fraction": 0.5461393594741821, "alphanum_fraction": 0.6139359474182129, "avg_line_length": 28.5, "blob_id": "bf9802a0b146a4c69bff68535794a594f2e1ac17", "content_id": "4186c5941912989ab7f055ce3593861663576a62", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 531, "license_type": "permissive", "max_line_length": 172, "num_lines": 18, "path": "/django_import_data/migrations/0004_auto_20190619_1226.py", "repo_name": "GreenBankObservatory/django-import-data", "src_encoding": "UTF-8", "text": "# Generated by Django 2.2.2 on 2019-06-19 16:26\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('django_import_data', '0003_auto_20190618_1629'),\n ]\n\n operations = [\n migrations.AlterField(\n model_name='modelimportattempt',\n name='status',\n field=models.PositiveIntegerField(choices=[(0, 'Pending'), (1, 'Imported: No Errors'), (2, 'Imported: Some Errors'), (3, 'Rejected: Fatal Errors')], default=0),\n ),\n ]\n" }, { "alpha_fraction": 0.5986356735229492, "alphanum_fraction": 0.5999412536621094, "avg_line_length": 32.55750274658203, "blob_id": "313433db5239df7ac26cf0fecf6492f23cf25509", "content_id": "7b0ec5b934d94c3ca480a9100a5bb66938ad4b76", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 30638, "license_type": "permissive", "max_line_length": 107, "num_lines": 913, "path": "/django_import_data/models.py", "repo_name": "GreenBankObservatory/django-import-data", "src_encoding": "UTF-8", "text": "\"\"\"Django Import Data Models\"\"\"\n\nfrom collections import Counter, defaultdict\nfrom importlib import import_module\nfrom pprint import pformat\nimport json\nimport os\n\nfrom django.contrib.contenttypes.models import ContentType\nfrom django.contrib.postgres.fields import ArrayField, JSONField\nfrom django.core.exceptions import FieldError\nfrom django.core.management import call_command\nfrom django.core.serializers.json import DjangoJSONEncoder\nfrom django.db import models\nfrom django.db import transaction\nfrom django.urls import reverse\nfrom django.utils.functional import cached_property\n\nfrom .mixins import (\n ImportStatusModel,\n CurrentStatusModel,\n TrackedModel,\n TrackedFileMixin,\n SensibleCharField,\n)\nfrom .utils import DjangoErrorJSONEncoder\nfrom .utils import get_str_from_nums\nfrom .managers import (\n ModelImportAttemptManager,\n ModelImporterManager,\n FileImporterManager,\n FileImportAttemptManager,\n FileImporterBatchManager,\n RowDataManager,\n)\n\n### ABSTRACT BASE CLASSES ###\nclass RowData(ImportStatusModel, models.Model):\n file_import_attempt = models.ForeignKey(\n \"django_import_data.FileImportAttempt\",\n on_delete=models.CASCADE,\n related_name=\"row_datas\",\n )\n data = JSONField(\n help_text=\"Stores a 'row' (or similar construct) of data as it \"\n \"was originally encountered\",\n encoder=DjangoJSONEncoder,\n )\n row_num = models.PositiveIntegerField()\n headers = JSONField(null=True)\n errors = JSONField(null=True, default=dict)\n\n objects = RowDataManager()\n\n def __str__(self):\n return (\n f\"Row {self.row_num} from '{self.file_import_attempt.name}' via \"\n f\"'{self.file_import_attempt.importer_name}'\"\n )\n\n class Meta:\n verbose_name = \"Row Data\"\n verbose_name_plural = \"Row Data\"\n\n def get_absolute_url(self):\n return reverse(\"rowdata_detail\", args=[str(self.id)])\n\n def derive_status(self):\n \"\"\"RD status is the most severe status of its MIs\"\"\"\n if self.model_importers.exists():\n status = (\n self.model_importers.order_by(\"-status\")\n .values_list(\"status\", flat=True)\n .first()\n )\n else:\n status = self.STATUSES.empty.db_value\n\n return status\n\n def derive_cached_values(self):\n self.status = self.derive_status()\n\n def save(\n self, *args, derive_cached_values=True, propagate_derived_values=True, **kwargs\n ):\n if derive_cached_values:\n self.derive_cached_values()\n super().save(*args, **kwargs)\n\n if propagate_derived_values:\n self.file_import_attempt.save(\n propagate_derived_values=propagate_derived_values\n )\n\n def errors_by_alias(self):\n _errors_by_alias = defaultdict(list)\n all_errors = ModelImportAttempt.objects.filter(\n model_importer__row_data=self\n ).values_list(\"errors\", flat=True)\n for error in all_errors:\n if \"form_errors\" in error:\n for form_error in error[\"form_errors\"]:\n _errors_by_alias[form_error.pop(\"alias\")[0]].append(\n {**form_error, \"error_type\": \"form\"}\n )\n if \"conversion_errors\" in error:\n for conversion_error in error[\"conversion_errors\"]:\n for alias in [\n alias\n for aliases in conversion_error[\"aliases\"].values()\n for alias in aliases\n ]:\n conversion_error.pop(\"aliases\")\n _errors_by_alias[alias].append(\n {**conversion_error, \"error_type\": \"conversion\"}\n )\n\n return _errors_by_alias\n\n # delete_imported_models\n\n\nclass AbstractBaseFileImporterBatch(ImportStatusModel, TrackedModel):\n\n command = SensibleCharField(max_length=64, default=None)\n args = ArrayField(SensibleCharField(max_length=256))\n kwargs = JSONField()\n errors = JSONField(null=True, default=dict)\n\n @cached_property\n def cli(self):\n clean_options = {}\n if self.kwargs:\n kwargs = self.kwargs\n else:\n kwargs = {}\n for key, value in kwargs.items():\n if key not in (\n \"settings\",\n \"start_index\",\n \"traceback\",\n \"verbosity\",\n \"skip_checks\",\n \"no_color\",\n \"pythonpath\",\n ):\n if isinstance(value, list):\n value = \" \".join(value)\n\n if isinstance(key, str):\n key = key.replace(\"_\", \"-\")\n\n clean_options[key] = value\n\n importer_name = self.command\n args_str = \" \".join(self.args)\n options_str = \"\"\n for key, value in clean_options.items():\n if isinstance(value, bool):\n if value:\n options_str += f\" --{key}\"\n elif value is not None:\n options_str += f\" --{key} {value}\"\n return f\"python manage.py {importer_name} {args_str}{options_str}\"\n\n class Meta:\n abstract = True\n\n def __str__(self):\n return self.cli\n\n @transaction.atomic\n def delete_imported_models(self, propagate=True):\n \"\"\"Delete all models imported by this FIB\"\"\"\n\n total_num_fi_deletions = 0\n total_num_fia_deletions = 0\n total_num_mia_deletions = 0\n all_mia_deletions = Counter()\n # For every ContentType imported by this FIB...\n for fi in self.file_importers.all():\n # ...and delete them:\n num_fia_deletions, num_mia_deletions, all_mia_deletions = fi.delete_imported_models(\n propagate=False\n )\n total_num_fi_deletions += 1\n total_num_fia_deletions += num_fia_deletions\n total_num_mia_deletions += num_mia_deletions\n all_mia_deletions += all_mia_deletions\n\n return (total_num_fia_deletions, total_num_mia_deletions, all_mia_deletions)\n\n @transaction.atomic\n def reimport(self, paths=None):\n \"\"\"Delete then reimport all models imported by this FIB\"\"\"\n if paths is not None:\n args = paths\n else:\n args = self.args\n num_fias_deleted, num_models_deleted, deletions = self.delete_imported_models(\n propagate=True\n )\n call_command(self.command, *args, **{**self.kwargs, \"overwrite\": True})\n return FileImporterBatch.objects.order_by(\"created_on\").last()\n\n def derive_status(self):\n \"\"\"FIB status is the most severe status of its most recent FIs\"\"\"\n if self.file_importers.exists():\n status = (\n self.file_importers.order_by(\"-status\")\n .values_list(\"status\", flat=True)\n .first()\n )\n else:\n status = self.STATUSES.empty.db_value\n return status\n\n def derive_cached_values(self):\n self.status = self.derive_status()\n\n def save(\n self, *args, derive_cached_values=True, propagate_derived_values=True, **kwargs\n ):\n if derive_cached_values:\n self.derive_cached_values()\n\n super().save(*args, **kwargs)\n\n\nclass AbstractBaseFileImporter(TrackedFileMixin, ImportStatusModel, TrackedModel):\n \"\"\"Representation of all attempts to import a specific file\"\"\"\n\n file_importer_batch = NotImplemented\n\n importer_name = SensibleCharField(\n max_length=128, default=None, help_text=\"The name of the Importer to use\"\n )\n\n class Meta:\n abstract = True\n\n def __str__(self):\n return f\"File Importer for {self.name}\"\n\n @property\n def latest_file_import_attempt(self):\n return self.file_import_attempts.order_by(\"created_on\").last()\n\n @property\n def name(self):\n return os.path.basename(self.file_path)\n\n def acknowledge(self):\n fia = self.latest_file_import_attempt\n return fia.acknowledge()\n\n def unacknowledge(self):\n fia = self.latest_file_import_attempt\n return fia.unacknowledge()\n\n def reimport(self):\n return call_command(\n self.importer_name, self.file_path, overwrite=True, durable=True\n )\n\n def derive_status(self):\n \"\"\"FI status is the status of its most recent FIA\"\"\"\n if self.file_import_attempts.exists():\n status = (\n self.file_import_attempts.order_by(\"-created_on\")\n .values_list(\"status\", flat=True)\n .first()\n )\n else:\n status = self.STATUSES.empty.db_value\n return status\n\n def derive_cached_values(self):\n self.status = self.derive_status()\n\n def save(\n self, *args, derive_cached_values=True, propagate_derived_values=True, **kwargs\n ):\n if derive_cached_values:\n self.derive_cached_values()\n\n super().save(*args, **kwargs)\n\n if propagate_derived_values:\n self.file_importer_batch.save(\n propagate_derived_values=propagate_derived_values\n )\n\n @transaction.atomic\n def delete_imported_models(self, propagate=True):\n \"\"\"Delete all models imported by this FI\"\"\"\n\n total_num_fia_deletions = 0\n total_num_mia_deletions = 0\n all_mia_deletions = Counter()\n for fia in self.file_import_attempts.all():\n # ...and delete them:\n num_fia_deletions, fia_deletions = fia.delete_imported_models(\n propagate=False\n )\n total_num_fia_deletions += 1\n total_num_mia_deletions += num_fia_deletions\n all_mia_deletions += fia_deletions\n\n return (total_num_fia_deletions, total_num_mia_deletions, all_mia_deletions)\n\n def condensed_errors_by_row_as_dicts(self):\n return self.latest_file_import_attempt.condensed_errors_by_row_as_dicts()\n\n def errors_by_row_as_dict(self):\n return self.latest_file_import_attempt.errors_by_row_as_dict()\n\n def condensed_errors_by_row(self):\n return json.dumps(self.condensed_errors_by_row_as_dicts(), indent=4)\n\n def errors_by_row(self):\n return json.dumps(self.errors_by_row_as_dict(), indent=4)\n\n # @property\n # def current_status(self):\n # return self.latest_file_import_attempt.current_status\n\n @property\n def file_changed(self):\n return self.hash_on_disk != self.latest_file_import_attempt.hash_when_imported\n\n @property\n def is_acknowledged(self):\n return self.latest_file_import_attempt.is_acknowledged\n\n @property\n def is_active(self):\n return self.latest_file_import_attempt.is_active\n\n @property\n def is_deleted(self):\n return self.latest_file_import_attempt.is_deleted\n\n\nclass AbstractBaseFileImportAttempt(\n ImportStatusModel, CurrentStatusModel, TrackedModel\n):\n \"\"\"Represents an individual attempt at an import of a \"batch\" of Importers\"\"\"\n\n PROPAGATED_FIELDS = (\"status\",)\n\n file_importer = NotImplemented\n\n # TODO: Make this a FileField?\n imported_from = SensibleCharField(\n max_length=512, help_text=\"Path to file that this was imported from\"\n )\n imported_by = SensibleCharField(max_length=128, blank=True)\n creations = JSONField(encoder=DjangoErrorJSONEncoder, default=dict, null=True)\n info = JSONField(\n default=dict, null=True, help_text=\"Stores any file-level info about the import\"\n )\n errors = JSONField(\n encoder=DjangoErrorJSONEncoder,\n default=dict,\n null=True,\n help_text=\"Stores any file-level errors encountered during import\",\n )\n ignored_headers = ArrayField(\n SensibleCharField(max_length=128),\n null=True,\n blank=True,\n help_text=\"Headers that were ignored during import\",\n )\n hash_when_imported = SensibleCharField(max_length=40, blank=True)\n\n class Meta:\n abstract = True\n\n def __str__(self):\n return f\"{self.name} <{self.importer_name}>\"\n\n @property\n def importer_name(self):\n return self.imported_by.split(\".\")[-1]\n\n def derive_status(self):\n \"\"\"FIA status is the most severe status of its RDs\"\"\"\n if self.row_datas.exists():\n status = (\n self.row_datas.order_by(\"-status\")\n .values_list(\"status\", flat=True)\n .first()\n )\n else:\n status = self.STATUSES.empty.db_value\n\n return status\n\n def derive_cached_values(self):\n self.status = self.derive_status()\n\n def get_creations(self):\n creations = {}\n for ct in ContentType.objects.filter(\n id__in=self.row_datas.values(\n \"model_importers__model_import_attempts__content_type\"\n )\n ).distinct():\n model_class = ct.model_class()\n creations[model_class] = (\n model_class.objects.filter(\n model_import_attempt__model_importer__row_data__file_import_attempt=self\n )\n .select_related(\"model_import_attempt__model_importer__row_data\")\n .order_by(\"model_import_attempt__model_importer__row_data__row_num\")\n )\n return creations\n\n def save(\n self, *args, derive_cached_values=True, propagate_derived_values=True, **kwargs\n ):\n if derive_cached_values:\n self.derive_cached_values()\n super().save(*args, **kwargs)\n\n if propagate_derived_values:\n self.file_importer.save(propagate_derived_values=propagate_derived_values)\n # ModelImportAttempt.objects.filter(\n # model_importer__row_data__file_import_attempt__id=self.id\n # ).update(current_status=self.current_status)\n\n @cached_property\n def name(self):\n return os.path.basename(self.imported_from)\n\n @cached_property\n def models_to_reimport(self):\n try:\n return self.importer.Command.MODELS_TO_REIMPORT\n except AttributeError:\n return []\n\n # TODO: Unit tests!\n @transaction.atomic\n def delete_imported_models(self, propagate=True):\n \"\"\"Delete all models imported by this FIA\"\"\"\n\n num_deletions = 0\n deletions = Counter()\n if self.models_to_reimport:\n model_classes_to_delete = self.models_to_reimport\n print(f\"Using given MODELS_TO_REIMPORT: {model_classes_to_delete}\")\n else:\n model_classes_to_delete = [\n ct.model_class()\n for ct in ContentType.objects.filter(\n id__in=self.row_datas.values(\n \"model_importers__model_import_attempts__content_type\"\n )\n )\n .prefetch_related(\n \"model_importers__model_import_attempts__content_type\"\n )\n .distinct()\n ]\n print(f\"Derived model_classes_to_delete: {model_classes_to_delete}\")\n # For every ContentType imported by this FIA...\n for model_class in model_classes_to_delete:\n to_delete = model_class.objects.filter(\n model_import_attempt__model_importer__row_data__file_import_attempt=self\n )\n num_deletions_for_model_class, deletions_for_model_class = (\n to_delete.delete()\n )\n num_deletions += num_deletions_for_model_class\n deletions += deletions_for_model_class\n\n self.current_status = self.CURRENT_STATUSES.deleted.db_value\n self.save()\n return (num_deletions, deletions)\n\n @cached_property\n def importer(self):\n return import_module(self.imported_by)\n\n def get_form_maps_used_during_import(self):\n return self.importer.Command.FORM_MAPS\n\n def get_field_maps_used_during_import(self):\n form_maps = self.get_field_maps_used_during_import()\n return {form_map.get_name(): form_map.field_maps for form_map in form_maps}\n\n def condensed_errors_by_row_as_dicts(self):\n error_report = self.errors_by_row_as_dict()\n print(error_report)\n error_to_row_nums = defaultdict(list)\n\n condensed_errors = []\n for row_num, error in error_report.items():\n if \"form_errors\" in error:\n for form_error in error[\"form_errors\"]:\n condensed_errors.append(\n {\n \"aliases\": form_error[\"alias\"],\n \"error\": f\"{form_error['errors']}; got value '{form_error['value']}'\",\n \"error_type\": \"form\",\n \"row_num\": row_num,\n # \"value\": form_error[\"value\"],\n }\n )\n if \"conversion_errors\" in error:\n for conversion_error in error[\"conversion_errors\"]:\n condensed_errors.append(\n {\n \"aliases\": tuple(\n alias\n for aliases in conversion_error[\"aliases\"].values()\n for alias in aliases\n ),\n \"error\": conversion_error[\"error\"],\n \"error_type\": \"conversion\",\n \"row_num\": row_num,\n # \"value\": conversion_error[\"value\"],\n }\n )\n\n for condensed_error in condensed_errors:\n row_num = condensed_error.pop(\"row_num\")\n error_to_row_nums[json.dumps(condensed_error)].append(row_num)\n\n condensed = [\n {\"row_nums\": get_str_from_nums(row_nums), **json.loads(error)}\n for error, row_nums in error_to_row_nums.items()\n ]\n return condensed\n\n def errors_by_row_as_dict(self):\n all_errors = ModelImportAttempt.objects.filter(\n model_importer__row_data__file_import_attempt=self\n ).values_list(\"model_importer__row_data__row_num\", \"errors\")\n error_report = {row_num: errors for row_num, errors in all_errors if errors}\n return error_report\n\n def errors_by_row(self):\n return json.dumps(self.errors_by_row_as_dict(), indent=4)\n\n def acknowledge(self):\n if self.current_status == self.CURRENT_STATUSES.active.db_value:\n self.current_status = self.CURRENT_STATUSES.acknowledged.db_value\n self.save()\n return True\n return False\n\n def unacknowledge(self):\n if self.current_status == self.CURRENT_STATUSES.acknowledged.db_value:\n self.current_status = self.CURRENT_STATUSES.active.db_value\n self.save()\n return True\n return False\n\n @property\n def is_acknowledged(self):\n return self.current_status == self.CURRENT_STATUSES.acknowledged.db_value\n\n @property\n def is_active(self):\n return self.current_status == self.CURRENT_STATUSES.active.db_value\n\n @property\n def is_deleted(self):\n return self.current_status == self.CURRENT_STATUSES.deleted.db_value\n\n\nclass AbstractBaseModelImporter(ImportStatusModel, TrackedModel):\n \"\"\"Representation of all attempts to import a specific file\"\"\"\n\n row_data = models.ForeignKey(\n RowData,\n related_name=\"model_importers\",\n on_delete=models.CASCADE,\n help_text=\"Reference to the original data used to create this audit group\",\n )\n\n class Meta:\n abstract = True\n\n @property\n def latest_model_import_attempt(self):\n return self.model_import_attempts.order_by(\"created_on\").last()\n\n @property\n def importee_class(self):\n return self.latest_model_import_attempt.importee_class\n\n def derive_status(self):\n \"\"\"MI status is the status of its most recent MIA\"\"\"\n if self.model_import_attempts.exists():\n status = (\n self.model_import_attempts.order_by(\"-created_on\")\n .values_list(\"status\", flat=True)\n .first()\n )\n else:\n status = self.STATUSES.empty.db_value\n return status\n\n def derive_cached_values(self):\n self.status = self.derive_status()\n\n def save(\n self, *args, derive_cached_values=True, propagate_derived_values=True, **kwargs\n ):\n if derive_cached_values:\n self.derive_cached_values()\n\n super().save(*args, **kwargs)\n\n if propagate_derived_values:\n self.row_data.save(propagate_derived_values=propagate_derived_values)\n # self.model_import_attempts.update(current_status=self.current_status)\n\n @transaction.atomic\n def delete_imported_models(self, propagate=True):\n \"\"\"Delete all models imported by this MI\"\"\"\n\n total_num_mia_deletions = 0\n # For every ContentType imported by this MI...\n for mia in self.model_import_attempts.all():\n # ...and delete them:\n num_mia_deletions, mia_deletions = mia.delete_imported_models()\n total_num_mia_deletions += num_mia_deletions\n\n return total_num_mia_deletions\n\n\n###\n\n\nclass AbstractBaseModelImportAttempt(TrackedModel, ImportStatusModel):\n PROPAGATED_FIELDS = (\"status\",)\n\n importee_field_data = JSONField(\n encoder=DjangoErrorJSONEncoder,\n default=dict,\n help_text=\"The original data used to create this Audit\",\n )\n errors = JSONField(\n encoder=DjangoErrorJSONEncoder,\n default=dict,\n help_text=\"Stores any errors encountered during the creation of the auditee\",\n )\n error_summary = JSONField(\n encoder=DjangoErrorJSONEncoder,\n default=dict,\n help_text=\"Stores any 'summary' information that might need to be associated\",\n )\n imported_by = SensibleCharField(max_length=128, default=None)\n content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE)\n\n # file_import_attempt = models.ForeignKey(\n # \"django_import_data.FileImportAttempt\",\n # related_name=\"model_import_attempts\",\n # on_delete=models.CASCADE,\n # null=True,\n # blank=True,\n # help_text=\"Reference to the FileImportAttempt this was created from\",\n # )\n\n model_importer = models.ForeignKey(\n \"django_import_data.ModelImporter\",\n related_name=\"model_import_attempts\",\n on_delete=models.CASCADE,\n help_text=\"Reference to the ModelImporter that made this attempt\",\n )\n\n @property\n def row_data(self):\n return self.model_importer.row_data\n\n @property\n def file_import_attempt(self):\n return self.model_importer.row_data.file_import_attempt\n\n class Meta:\n abstract = True\n ordering = [\"-created_on\"]\n\n def __str__(self):\n if self.file_import_attempt:\n return (\n f\"{self.content_type} imported from \"\n f\"{os.path.basename(self.imported_from)} ({self.STATUSES[self.status].value})\"\n )\n\n return f\"{self.content_type}: {self.STATUSES[self.status].value}\"\n\n def save(\n self, *args, propagate_derived_values=True, derive_cached_values=False, **kwargs\n ):\n if self.status == ImportStatusModel.STATUSES.pending.db_value:\n if self.errors:\n self.status = ImportStatusModel.STATUSES.rejected.db_value\n else:\n self.status = ImportStatusModel.STATUSES.created_clean.db_value\n\n super().save(*args, **kwargs)\n if propagate_derived_values:\n self.model_importer.save(propagate_derived_values=propagate_derived_values)\n\n def summary(self):\n return (\n \"I {created_str} a(n) {importee_class} instance {importee_str}from \"\n \"data {importee_field_data} I converted from row {row_data}, which \"\n \"I found in file {file_path}\"\n ).format(\n created_str=\"created\" if self.importee else \"attempted to create\",\n importee_class=self.importee_class.__name__,\n importee_str=f\"({self.importee}) \" if self.importee else \"\",\n importee_field_data=pformat(self.importee_field_data),\n row_data=pformat(self.row_data.data),\n file_path=self.file_import_attempt.imported_from\n if self.file_import_attempt\n else None,\n )\n\n @property\n def importee_class(self):\n return self.content_type.model_class()\n\n # IF NO GFK\n @property\n def importee(self):\n \"\"\"Get the object we are auditing, if it exists, otherwise return None\"\"\"\n return getattr(self, self.content_type.model, None)\n\n # IF NO GFK\n @importee.setter\n def importee(self, instance):\n \"\"\"Set auditee to given object\"\"\"\n return setattr(self, self.content_type.model, instance)\n\n @cached_property\n def imported_from(self):\n return (\n self.file_import_attempt.imported_from if self.file_import_attempt else None\n )\n\n # TODO: UNIt tests!\n @transaction.atomic\n def delete_imported_models(self):\n \"\"\"Delete all models imported by this MIA\"\"\"\n\n num_deletions = 0\n deletions = Counter()\n # For every ContentType imported by this MIA...\n for ct in ContentType.objects.filter(id__in=self.values(\"content_type\")):\n # ...get a queryset of all model instances that were imported...\n to_delete = ct.model_class().objects.filter(model_import_attempt=self)\n # ...and delete them:\n num_deletions_for_model_class, deletions_for_model_class = (\n to_delete.delete()\n )\n num_deletions += num_deletions_for_model_class\n deletions += deletions_for_model_class\n\n self.current_status = self.CURRENT_STATUSES.deleted.db_value\n self.save()\n self.refresh_from_db()\n print(\n f\"MIA {self.id} deleted its imported model and set its current status to {self.current_status}\"\n )\n return (num_deletions, deletions)\n\n def gen_error_summary(self):\n summary_items = set()\n for conversion_error in self.errors.get(\"conversion_errors\", []):\n summary_items.update(conversion_error[\"to_fields\"])\n\n for form_error in self.errors.get(\"form_errors\", []):\n summary_items.add(form_error[\"field\"])\n\n return summary_items\n\n\n### CONCRETE CLASSES ###\n\n\nclass FileImporterBatch(AbstractBaseFileImporterBatch):\n def get_absolute_url(self):\n return reverse(\"fileimporterbatch_detail\", args=[str(self.id)])\n\n objects = FileImporterBatchManager()\n\n class Meta:\n verbose_name = \"File Importer Batch\"\n verbose_name_plural = \"File Importer Batches\"\n ordering = [\"-created_on\"]\n\n\nclass FileImporter(AbstractBaseFileImporter):\n file_importer_batch = models.ForeignKey(\n FileImporterBatch,\n related_name=\"file_importers\",\n on_delete=models.CASCADE,\n null=True,\n blank=True,\n )\n objects = FileImporterManager()\n\n class Meta:\n ordering = [\"-created_on\"]\n verbose_name = \"File Importer\"\n verbose_name_plural = \"File Importers\"\n\n def get_absolute_url(self):\n return reverse(\"fileimporter_detail\", args=[str(self.id)])\n\n def gen_import(self, path):\n return FileImportAttempt.objects.create(batch=self, imported_from=path)\n\n\nclass FileImportAttempt(AbstractBaseFileImportAttempt):\n file_importer = models.ForeignKey(\n FileImporter, related_name=\"file_import_attempts\", on_delete=models.CASCADE\n )\n\n objects = FileImportAttemptManager()\n\n class Meta:\n ordering = [\"-created_on\"]\n verbose_name = \"File Import Attempt\"\n verbose_name_plural = \"File Import Attempts\"\n\n def get_absolute_url(self):\n return reverse(\"fileimportattempt_detail\", args=[str(self.id)])\n\n\nclass ModelImporter(AbstractBaseModelImporter):\n objects = ModelImporterManager()\n\n class Meta:\n ordering = [\"-created_on\"]\n verbose_name = \"Model Importer\"\n verbose_name_plural = \"Model Importers\"\n\n def get_absolute_url(self):\n return reverse(\"modelimporter_detail\", args=[str(self.id)])\n\n # def gen_import(self, path):\n # return ModelImportAttempt.objects.create(batch=self, imported_from=path)\n\n\nclass ModelImportAttempt(AbstractBaseModelImportAttempt):\n # NOTE: We override this here to give it a more sensible related_name\n objects = ModelImportAttemptManager()\n\n class Meta:\n verbose_name = \"Model Import Attempt\"\n verbose_name_plural = \"Model Import Attempts\"\n\n def get_absolute_url(self):\n return reverse(\"modelimportattempt_detail\", args=[str(self.id)])\n\n def get_create_from_import_attempt_url(self):\n return reverse(\n f\"{self.content_type.model}_create_from_audit\", args=[str(self.id)]\n )\n\n\n# class ModelImportAttemptError(models.Model):\n# model_import_attempt = models.OneToOneField(on_delete=models.CASCADE, unique=True)\n# from_fields = SensibleCharField(max_length=256)\n# from_field_\n### MODEL MIXINS ###\n\n\nclass AbstractBaseAuditedModel(models.Model):\n model_import_attempt = models.OneToOneField(\n ModelImportAttempt, on_delete=models.CASCADE, unique=True, null=True, blank=True\n )\n\n class Meta:\n abstract = True\n\n def save(self, *args, **kwargs):\n if (\n getattr(self, \"model_import_attempt\", None)\n and self.model_import_attempt.importee_class != self.__class__\n ):\n raise ValueError(\n \"Mismatched importee class designations! \"\n f\"Our class ({self.__class__}) differs from \"\n \"self.model_import_attempt.importee_class \"\n f\"({self.model_import_attempt.importee_class}! \"\n )\n\n super().save(*args, **kwargs)\n\n @cached_property\n def imported_from(self):\n try:\n return self.model_import_attempt.file_import_attempt.imported_from\n except AttributeError:\n return None\n\n def file_import_attempt_was_successful(self):\n return (\n self.model_import_attempt.file_import_attempt.file_importer.status\n == FileImporter.STATUSES.created_clean.db_value\n or self.model_import_attempt.file_import_attempt.file_importer.is_acknowledged\n )\n" }, { "alpha_fraction": 0.5768967866897583, "alphanum_fraction": 0.5953519940376282, "avg_line_length": 42.02941131591797, "blob_id": "fb24d7e1ea63e6daeeb41aec44a3cdb6b8a83d36", "content_id": "cffa52c7e1158ffa2a2f292f5f5059994e8d5e5e", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1463, "license_type": "permissive", "max_line_length": 237, "num_lines": 34, "path": "/django_import_data/migrations/0010_auto_20190705_1323.py", "repo_name": "GreenBankObservatory/django-import-data", "src_encoding": "UTF-8", "text": "# Generated by Django 2.2.2 on 2019-07-05 17:23\n\nfrom django.db import migrations, models\nimport django.db.models.deletion\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('django_import_data', '0009_remove_modelimportattempt_acknowledged'),\n ]\n\n operations = [\n migrations.CreateModel(\n name='ModelImporter',\n fields=[\n ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),\n ('status', models.PositiveIntegerField(choices=[(0, 'pending'), (1, 'empty'), (2, 'deleted'), (3, 'created_clean'), (4, 'created_dirty'), (5, 'rejected')], db_index=True, default=0)),\n ('created_on', models.DateTimeField(auto_now_add=True)),\n ('modified_on', models.DateTimeField(auto_now=True, null=True)),\n ],\n options={\n 'verbose_name': 'Model Importer',\n 'verbose_name_plural': 'Model Importers',\n 'ordering': ['-created_on'],\n },\n ),\n migrations.AddField(\n model_name='modelimportattempt',\n name='model_importer',\n field=models.ForeignKey(default=-1, help_text='Reference to the ModelImporter that made this attempt', on_delete=django.db.models.deletion.CASCADE, related_name='model_import_attempts', to='django_import_data.ModelImporter'),\n preserve_default=False,\n ),\n ]\n" }, { "alpha_fraction": 0.6212896704673767, "alphanum_fraction": 0.6373251676559448, "avg_line_length": 43.40909194946289, "blob_id": "f7d4082247209b0c814a7a004731cd7736cb3725", "content_id": "370560dc890b4e06f10cca8e0d9bfe2e67375c72", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2931, "license_type": "permissive", "max_line_length": 233, "num_lines": 66, "path": "/django_import_data/migrations/0022_auto_20190716_1542.py", "repo_name": "GreenBankObservatory/django-import-data", "src_encoding": "UTF-8", "text": "# Generated by Django 2.2.3 on 2019-07-16 19:42\n\nimport django.contrib.postgres.fields\nfrom django.db import migrations\nimport django_import_data.mixins\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('django_import_data', '0021_remove_fileimporter_current_status'),\n ]\n\n operations = [\n migrations.AlterField(\n model_name='fileimportattempt',\n name='hash_when_imported',\n field=django_import_data.mixins.SensibleCharField(blank=True, max_length=40),\n ),\n migrations.AlterField(\n model_name='fileimportattempt',\n name='ignored_headers',\n field=django.contrib.postgres.fields.ArrayField(base_field=django_import_data.mixins.SensibleCharField(default=None, max_length=128), blank=True, help_text='Headers that were ignored during import', null=True, size=None),\n ),\n migrations.AlterField(\n model_name='fileimportattempt',\n name='imported_by',\n field=django_import_data.mixins.SensibleCharField(blank=True, default='', max_length=128),\n preserve_default=False,\n ),\n migrations.AlterField(\n model_name='fileimportattempt',\n name='imported_from',\n field=django_import_data.mixins.SensibleCharField(default=None, help_text='Path to file that this was imported from', max_length=512),\n ),\n migrations.AlterField(\n model_name='fileimporter',\n name='file_path',\n field=django_import_data.mixins.SensibleCharField(default=None, help_text='Path to the file that this is linked to', max_length=512, unique=True),\n ),\n migrations.AlterField(\n model_name='fileimporter',\n name='hash_on_disk',\n field=django_import_data.mixins.SensibleCharField(blank=True, help_text='SHA-1 hash of the file on disk. If blank, the file is missing', max_length=40, null=True, unique=True),\n ),\n migrations.AlterField(\n model_name='fileimporter',\n name='importer_name',\n field=django_import_data.mixins.SensibleCharField(default=None, help_text='The name of the Importer to use', max_length=128),\n ),\n migrations.AlterField(\n model_name='fileimporterbatch',\n name='args',\n field=django.contrib.postgres.fields.ArrayField(base_field=django_import_data.mixins.SensibleCharField(default=None, max_length=256), size=None),\n ),\n migrations.AlterField(\n model_name='fileimporterbatch',\n name='command',\n field=django_import_data.mixins.SensibleCharField(default=None, max_length=64),\n ),\n migrations.AlterField(\n model_name='modelimportattempt',\n name='imported_by',\n field=django_import_data.mixins.SensibleCharField(default=None, max_length=128),\n ),\n ]\n" }, { "alpha_fraction": 0.5553538799285889, "alphanum_fraction": 0.6025408506393433, "avg_line_length": 29.61111068725586, "blob_id": "ed4abae533fdad59173a057072d9004363f95d50", "content_id": "6b1d2a27877a8c51d32db315078bacc337f42e40", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 551, "license_type": "permissive", "max_line_length": 189, "num_lines": 18, "path": "/django_import_data/migrations/0019_rowdata_status.py", "repo_name": "GreenBankObservatory/django-import-data", "src_encoding": "UTF-8", "text": "# Generated by Django 2.2.2 on 2019-07-08 19:27\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('django_import_data', '0018_remove_modelimportattempt_row_data'),\n ]\n\n operations = [\n migrations.AddField(\n model_name='rowdata',\n name='status',\n field=models.PositiveIntegerField(choices=[(0, 'pending'), (1, 'empty'), (2, 'deleted'), (3, 'created_clean'), (4, 'created_dirty'), (5, 'rejected')], db_index=True, default=0),\n ),\n ]\n" }, { "alpha_fraction": 0.5251045823097229, "alphanum_fraction": 0.555962324142456, "avg_line_length": 38.020408630371094, "blob_id": "f75843fa3297af5d67141f83968999c5974f2a4f", "content_id": "86ed24bd6aeb70fc53aaf702d00d581a052b9e3b", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1912, "license_type": "permissive", "max_line_length": 189, "num_lines": 49, "path": "/django_import_data/migrations/0008_auto_20190702_1650.py", "repo_name": "GreenBankObservatory/django-import-data", "src_encoding": "UTF-8", "text": "# Generated by Django 2.2.2 on 2019-07-02 20:50\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('django_import_data', '0007_auto_20190702_1353'),\n ]\n\n operations = [\n migrations.RemoveField(\n model_name='fileimportattempt',\n name='is_active',\n ),\n migrations.RemoveField(\n model_name='fileimportbatch',\n name='is_active',\n ),\n migrations.RemoveField(\n model_name='fileimporter',\n name='is_active',\n ),\n migrations.RemoveField(\n model_name='modelimportattempt',\n name='is_active',\n ),\n migrations.AlterField(\n model_name='fileimportattempt',\n name='status',\n field=models.PositiveIntegerField(choices=[(0, 'pending'), (1, 'empty'), (2, 'deleted'), (3, 'created_clean'), (4, 'created_dirty'), (5, 'rejected')], db_index=True, default=0),\n ),\n migrations.AlterField(\n model_name='fileimportbatch',\n name='status',\n field=models.PositiveIntegerField(choices=[(0, 'pending'), (1, 'empty'), (2, 'deleted'), (3, 'created_clean'), (4, 'created_dirty'), (5, 'rejected')], db_index=True, default=0),\n ),\n migrations.AlterField(\n model_name='fileimporter',\n name='status',\n field=models.PositiveIntegerField(choices=[(0, 'pending'), (1, 'empty'), (2, 'deleted'), (3, 'created_clean'), (4, 'created_dirty'), (5, 'rejected')], db_index=True, default=0),\n ),\n migrations.AlterField(\n model_name='modelimportattempt',\n name='status',\n field=models.PositiveIntegerField(choices=[(0, 'pending'), (1, 'empty'), (2, 'deleted'), (3, 'created_clean'), (4, 'created_dirty'), (5, 'rejected')], db_index=True, default=0),\n ),\n ]\n" }, { "alpha_fraction": 0.601075291633606, "alphanum_fraction": 0.6015715599060059, "avg_line_length": 35.08955383300781, "blob_id": "8a151d0d0defb98f23b0685abcecde2ad97234ad", "content_id": "115437c49a713ba183247147c1aa3649ab27aa3c", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 12090, "license_type": "permissive", "max_line_length": 94, "num_lines": 335, "path": "/django_import_data/querysets.py", "repo_name": "GreenBankObservatory/django-import-data", "src_encoding": "UTF-8", "text": "\"\"\"Querysets for django_import_data\"\"\"\n\nfrom collections import defaultdict\n\nfrom tqdm import tqdm\n\nfrom django.apps import apps\nfrom django.db import transaction\nfrom django.db.models import (\n F,\n OuterRef,\n Subquery,\n Count,\n Q,\n Case as Case_,\n When,\n Value,\n BooleanField,\n Max,\n)\nfrom django.db.models.query import QuerySet\n\n\nclass TrackedFileQueryset(QuerySet):\n \"\"\"Contains operations for synchronizing with files on disk\"\"\"\n\n # Note: we don't need this to be atomic\n def refresh_from_filesystem(self, always_hash=False, quiet=False):\n \"\"\"Recompute the hash_on_disk fields of all QuerySet members\n\n Returns a report of which members are missing, changed, or unchanged\n from the previous import check\"\"\"\n report = defaultdict(list)\n progress = tqdm(self.order_by(\"created_on\"), unit=\"files\", disable=quiet)\n for instance in progress:\n # progress.desc = instance.file_path\n status = instance.refresh_from_filesystem(always_hash=always_hash)\n report[status].append(instance)\n\n return report\n\n\nclass DerivedValuesQueryset(QuerySet):\n @transaction.atomic\n def derive_values(self, propagate_derived_values=True):\n for instance in tqdm(self, unit=self.model._meta.verbose_name):\n # Derive any necessary values for the model, but don't propagate them!\n instance.save(derive_cached_values=True, propagate_derived_values=False)\n\n # Now we propagate them, all at once, at the end\n if propagate_derived_values and hasattr(self, \"propagate_derived_values\"):\n tqdm.write(f\"Propagating saved values from {self.__class__}\")\n self.propagate_derived_values()\n\n @transaction.atomic\n def update(self, *args, propagate_derived_values=True, **kwargs):\n result = super().update(*args, **kwargs)\n propagated_fields_being_updated = [\n field for field in self.model.PROPAGATED_FIELDS if field in kwargs.keys()\n ]\n if propagate_derived_values and propagated_fields_being_updated:\n tqdm.write(\n \"Now propagating derived values because the following \"\n f\"propagated fields are being updated: {propagated_fields_being_updated}. \"\n \"To disable this behavior, use propagate_derived_values=False\"\n )\n self.propagate_derived_values()\n\n return result\n\n\nclass FileImporterBatchQuerySet(DerivedValuesQueryset):\n def annotate_num_file_importers(self):\n return self.annotate(num_file_importers=Count(\"file_importers\", distinct=True))\n\n def annotate_num_successful_file_importers(self):\n FileImporterBatch = apps.get_model(\"django_import_data.FileImporterBatch\")\n return self.annotate(\n num_successful_file_importers=Count(\n \"file_importers\",\n distinct=True,\n filter=Q(status=FileImporterBatch.STATUSES.created_clean.db_value),\n )\n )\n\n def annotate_num_failed_file_importers(self):\n FileImporterBatch = apps.get_model(\"django_import_data.FileImporterBatch\")\n return self.annotate(\n num_failed_file_importers=Count(\n \"file_importers\",\n distinct=True,\n filter=Q(\n status__in=[\n status.db_value\n for status in FileImporterBatch.STATUSES\n if status != FileImporterBatch.STATUSES.created_clean\n ]\n ),\n )\n )\n\n\nclass FileImporterQuerySet(TrackedFileQueryset, DerivedValuesQueryset):\n @transaction.atomic\n def propagate_derived_values(self):\n FileImporterBatch = apps.get_model(\"django_import_data.FileImporterBatch\")\n FileImporterBatch.objects.filter(\n file_importers__in=self.values(\"id\")\n ).distinct().derive_values()\n\n def changed_files(self):\n FileImportAttempt = apps.get_model(\"django_import_data.FileImportAttempt\")\n FileImporter = apps.get_model(\"django_import_data.FileImporter\")\n latest = FileImportAttempt.objects.filter(\n file_importer=OuterRef(\"pk\")\n ).order_by(\"-created_on\")\n changed_hashes = FileImporter.objects.annotate(\n latest_hash=Subquery(latest.values(\"hash_when_imported\")[:1])\n ).exclude(hash_on_disk=F(\"latest_hash\"))\n\n changed_paths = FileImporter.objects.filter(hash_on_disk=\"\")\n\n changed = changed_hashes | changed_paths\n return changed\n\n def annotate_current_status(self):\n FileImportAttempt = apps.get_model(\"django_import_data.FileImportAttempt\")\n current_status = (\n FileImportAttempt.objects.filter(file_importer=OuterRef(\"pk\"))\n .order_by(\"-created_on\")\n .values(\"current_status\")[:1]\n )\n return self.annotate(current_status=Subquery(current_status))\n\n def annotate_num_file_import_attempts(self):\n return self.annotate(\n num_file_import_attempts=Count(\"file_import_attempts\", distinct=True)\n )\n\n def annotate_num_row_datas(self):\n return self.annotate(\n num_row_datas=Count(\n \"file_import_attempts__row_datas\",\n filter=Q(\n file_import_attempts__row_datas__file_import_attempt__file_importer__id=F(\n \"id\"\n )\n ),\n distinct=True,\n )\n )\n\n def annotate_num_model_importers(self):\n return self.annotate(\n num_model_importers=Count(\n \"file_import_attempts__row_datas__model_importers\",\n filter=Q(\n file_import_attempts__row_datas__file_import_attempt__file_importer__id=F(\n \"id\"\n )\n ),\n distinct=True,\n )\n )\n\n def annotate_last_imported(self):\n return self.annotate(last_imported=Max(\"file_import_attempts__created_on\"))\n\n\nclass RowDataQuerySet(DerivedValuesQueryset):\n @transaction.atomic\n def propagate_derived_values(self):\n FileImportAttempt = apps.get_model(\"django_import_data.FileImportAttempt\")\n FileImportAttempt.objects.filter(\n row_datas__in=self.values(\"id\")\n ).distinct().derive_values()\n\n def annotate_num_model_importers(self):\n return self.annotate(\n num_model_importers=Count(\"model_importers\", distinct=True)\n )\n\n def annotate_current_status(self):\n return self.annotate(current_status=F(\"file_import_attempt__current_status\"))\n\n\nclass ModelImporterQuerySet(DerivedValuesQueryset):\n @transaction.atomic\n def propagate_derived_values(self):\n RowData = apps.get_model(\"django_import_data.RowData\")\n RowData.objects.filter(\n model_importers__in=self.values(\"id\")\n ).distinct().derive_values()\n\n def annotate_num_model_import_attempts(self):\n return self.annotate(\n num_model_import_attempts=Count(\"model_import_attempts\", distinct=True)\n )\n\n def annotate_num_successful(self):\n FileImporterBatch = apps.get_model(\"django_import_data.FileImporterBatch\")\n return self.annotate(\n num_successful_file_importers=Count(\n \"file_importers\",\n distinct=True,\n filter=Q(status=FileImporterBatch.STATUSES.created_clean.db_value),\n )\n )\n\n def annotate_num_failed(self):\n FileImporterBatch = apps.get_model(\"django_import_data.FileImporterBatch\")\n return self.annotate(\n num_failed_file_importers=Count(\n \"file_importers\",\n distinct=True,\n filter=Q(\n status__in=[\n status.db_value\n for status in FileImporterBatch.STATUSES\n if status != FileImporterBatch.STATUSES.created_clean\n ]\n ),\n )\n )\n\n def annotate_current_status(self):\n return self.annotate(\n current_status=F(\"row_data__file_import_attempt__current_status\")\n )\n\n def annotate_latest_mia_errors(self):\n ModelImportAttempt = apps.get_model(\"django_import_data.ModelImportAttempt\")\n latest_mia_errors = (\n # Get all MIAs with same MI as the outer one\n ModelImportAttempt.objects.filter(model_importer=OuterRef(\"id\"))\n .order_by(\"-created_on\")\n .values(\"errors\")[:1]\n )\n return self.annotate(latest_mia_errors=Subquery(latest_mia_errors))\n\n def annotate_latest_mia_importee_field_data(self):\n ModelImportAttempt = apps.get_model(\"django_import_data.ModelImportAttempt\")\n latest_mia_importee_field_data = (\n # Get all MIAs with same MI as the outer one\n ModelImportAttempt.objects.filter(model_importer=OuterRef(\"id\"))\n .order_by(\"-created_on\")\n .values(\"importee_field_data\")[:1]\n )\n return self.annotate(\n latest_mia_importee_field_data=Subquery(latest_mia_importee_field_data)\n )\n\n def annotate_latest_mia_data(self):\n return (\n self.annotate_latest_mia_errors().annotate_latest_mia_importee_field_data()\n )\n\n\nclass FileImportAttemptQuerySet(DerivedValuesQueryset):\n @transaction.atomic\n def propagate_derived_values(self):\n FileImporter = apps.get_model(\"django_import_data.FileImporter\")\n FileImporter.objects.filter(\n file_import_attempts__in=self.values(\"id\")\n ).distinct().derive_values()\n\n def annotate_num_model_importers(self):\n return self.annotate(\n num_model_importers=Count(\"row_datas__model_importers\", distinct=True)\n )\n\n def annotate_is_latest(self):\n FileImportAttempt = apps.get_model(\"django_import_data.FileImportAttempt\")\n latest_fia_id = (\n # Get all FIAs with same FI as the outer one\n FileImportAttempt.objects.filter(\n file_importer=OuterRef(\"file_importer__id\")\n )\n .order_by(\"-created_on\")\n .values(\"id\")[:1]\n )\n return self.annotate(\n latest_fia_id=Subquery(latest_fia_id),\n is_latest=Case_(\n When(id=F(\"latest_fia_id\"), then=Value(True)),\n default=Value(False),\n output_field=BooleanField(),\n ),\n )\n\n def annotate_has_fi_path(self):\n return self.annotate(\n has_fi_path=Case_(\n When(Q(imported_from=F(\"file_importer__file_path\")), then=Value(False)),\n default=Value(True),\n output_field=BooleanField(),\n )\n )\n\n\nclass ModelImportAttemptQuerySet(DerivedValuesQueryset):\n @transaction.atomic\n def propagate_derived_values(self):\n ModelImporter = apps.get_model(\"django_import_data.ModelImporter\")\n\n ModelImporter.objects.filter(\n id__in=self.values(\"id\")\n ).distinct().derive_values()\n\n def annotate_current_status(self):\n return self.annotate(\n current_status=F(\n \"model_importer__row_data__file_import_attempt__current_status\"\n )\n )\n\n # TODO: WIP\n def annotate_is_latest(self):\n ModelImportAttempt = apps.get_model(\"django_import_data.ModelImportAttempt\")\n latest_mia_id = (\n # Get all MIAs with same MI as the outer one\n ModelImportAttempt.objects.filter(\n model_importer=OuterRef(\"model_importer__id\")\n )\n .order_by(\"-created_on\")\n .values(\"id\")[:1]\n )\n return self.annotate(\n latest_mia_id=Subquery(latest_mia_id),\n is_latest=Case_(\n When(id=F(\"latest_mia_id\"), then=Value(True)),\n default=Value(False),\n output_field=BooleanField(),\n ),\n )\n" }, { "alpha_fraction": 0.5008756518363953, "alphanum_fraction": 0.5551663637161255, "avg_line_length": 21.84000015258789, "blob_id": "5c02d2e1c5ad47ca109342b24f14f71c50ec722c", "content_id": "decd3ef0637e819718924ccf8f693e9276476ccb", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 571, "license_type": "permissive", "max_line_length": 58, "num_lines": 25, "path": "/django_import_data/migrations/0003_auto_20190618_1629.py", "repo_name": "GreenBankObservatory/django-import-data", "src_encoding": "UTF-8", "text": "# Generated by Django 2.2.2 on 2019-06-18 20:29\n\nfrom django.db import migrations\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('django_import_data', '0002_auto_20190618_1624'),\n ]\n\n operations = [\n migrations.RemoveField(\n model_name='fileimportattempt',\n name='status',\n ),\n migrations.RemoveField(\n model_name='fileimportbatch',\n name='status',\n ),\n migrations.RemoveField(\n model_name='fileimporter',\n name='status',\n ),\n ]\n" }, { "alpha_fraction": 0.704901933670044, "alphanum_fraction": 0.7081699371337891, "avg_line_length": 55.66666793823242, "blob_id": "ed355269514490b97df7ab852b63928be689bbee", "content_id": "0cf2d9b0dfce3982bd76c2951129a07cdfa8fe8c", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "reStructuredText", "length_bytes": 3060, "license_type": "permissive", "max_line_length": 397, "num_lines": 54, "path": "/README.rst", "repo_name": "GreenBankObservatory/django-import-data", "src_encoding": "UTF-8", "text": "Django Import Data\n------------------\n\n**THIS IS ALPHA SOFTWARE**\n\n\nMotivation\n==========\n\nThe problem: we have a bunch of Excel files, for example, that have columnar data we wish to create model instances from. However, this data is very messy, and we need some sane way to set up mappings between the data and our database.\n\nThis \"messiness\" comes in a few different forms.\n\n\nColumn names may change between source files\n++++++++++++++++++++++++++++++++++++++++++++\n\nFor example, let's say you have a \"name\" column in your Excel files. However, between the various files this column appears under the headings \"Name\", \"NAME\", \"Full Name\", etc. *You* know that these all refer to the same thing, but you obviously need some way to map them all to the same \"from field\".\n\nIn ``django-import-data``, these various names for the same \"from field\" are referred to as aliases.\n\n\nColumns may not map 1:1 to your database fields\n+++++++++++++++++++++++++++++++++++++++++++++++\n\nFor example, let's say that you have \"latitude\" and \"longitude\" columns in your Excel files, but your database holds a single \"location\". The way this works in ``django-import-data`` is via the use of a \"converter\" function. In this example we might use ``lambda latitude, longitude: f\"{latitude},{longitude}\"`` as our converter -- it will merge these two columns into a single field.\n\nOr, you might have a single \"name\" column in your Excel files, but \"first_name\" and \"last_name\" in your database. In this case you need to split these up: ``lambda name: name.split(\" \")``\n\n\nColumns may not contain clean data\n++++++++++++++++++++++++++++++++++\n\nFor example, if we have a boolean column that represents ``None`` as either ``\"\"`` or ``\"n/a\"``, depending on the file, we need a way to say that all of those mean the same thing. More broadly\n\nIf you're wondering why we don't just use Django forms for this: we are already using functions for our non-1:1 mappings, so we might as well do some cleaning while we're at it. There are other reasons, too; see below.\n\n\nWhy not Django forms?\n=====================\n\nWell, we actually *are* using Django forms under the hood. However, they simply aren't designed for these various use cases.\n\nFor example, while there is support for `n:1 relationships <https://docs.djangoproject.com/en/2.1/ref/forms/fields/#django.forms.MultiValueField>`_ it is *very* clunky in our use case.\n\nAnd, from what I've been able to determine, there `isn't support at all for 1:n relationships <https://code.djangoproject.com/ticket/27>`_.\n\nFurther, while ``clean_foo`` are provided that make one-off clean functions easy to implement, this doesn't work for our use case, simply because it is so common to get \"numbers\" that can't actually be directly converted to a number in Python. This then forces us to create subclasses for every single affected field so we can override its ``to_python`` function. This ends up getting super messy.\n\n\nDemo/Examples\n=============\n\nSee the `demo Jupyter Notebook <example_project/django_import_data.ipynb>`_ for more information.\n" }, { "alpha_fraction": 0.5574732422828674, "alphanum_fraction": 0.5785295367240906, "avg_line_length": 47.28333282470703, "blob_id": "22648dfa246a615f8b8ebf33924ea1d0c5e4656f", "content_id": "0384adb2e02c9f09f1139ee3a9bb13a770a1e049", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2897, "license_type": "permissive", "max_line_length": 175, "num_lines": 60, "path": "/example_project/cases/migrations/0001_initial.py", "repo_name": "GreenBankObservatory/django-import-data", "src_encoding": "UTF-8", "text": "# Generated by Django 2.2.3 on 2019-07-24 20:19\n\nfrom django.db import migrations, models\nimport django.db.models.deletion\n\n\nclass Migration(migrations.Migration):\n\n initial = True\n\n dependencies = [\n ('django_import_data', '0022_auto_20190716_1542'),\n ]\n\n operations = [\n migrations.CreateModel(\n name='Structure',\n fields=[\n ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),\n ('location', models.CharField(max_length=256)),\n ('model_import_attempt', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='django_import_data.ModelImportAttempt')),\n ],\n options={\n 'abstract': False,\n },\n ),\n migrations.CreateModel(\n name='Person',\n fields=[\n ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),\n ('name', models.CharField(blank=True, max_length=256)),\n ('phone', models.CharField(blank=True, max_length=256)),\n ('email', models.EmailField(blank=True, max_length=254, null=True)),\n ('city', models.CharField(blank=True, max_length=256)),\n ('street', models.CharField(blank=True, max_length=256)),\n ('zip', models.CharField(blank=True, max_length=256)),\n ('state', models.CharField(blank=True, max_length=256)),\n ('model_import_attempt', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='django_import_data.ModelImportAttempt')),\n ],\n options={\n 'abstract': False,\n },\n ),\n migrations.CreateModel(\n name='Case',\n fields=[\n ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),\n ('case_num', models.PositiveIntegerField()),\n ('status', models.CharField(choices=[('incomplete', 'incomplete'), ('complete', 'complete')], max_length=256)),\n ('type', models.CharField(blank=True, max_length=256)),\n ('subtype', models.PositiveIntegerField(blank=True)),\n ('applicant', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='cases.Person')),\n ('model_import_attempt', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='django_import_data.ModelImportAttempt')),\n ('structure', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='cases.Structure')),\n ],\n options={\n 'abstract': False,\n },\n ),\n ]\n" }, { "alpha_fraction": 0.6280233263969421, "alphanum_fraction": 0.6547122597694397, "avg_line_length": 40.344825744628906, "blob_id": "33efef24262cfdf9c4c71fa00831b6993a7b94cc", "content_id": "9f8705c94a5d8df015772c13becafba51e887958", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1199, "license_type": "permissive", "max_line_length": 238, "num_lines": 29, "path": "/django_import_data/migrations/0015_auto_20190705_1512.py", "repo_name": "GreenBankObservatory/django-import-data", "src_encoding": "UTF-8", "text": "# Generated by Django 2.2.2 on 2019-07-05 19:12\n\nfrom django.db import migrations, models\nimport django.db.models.deletion\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('django_import_data', '0014_auto_20190705_1412'),\n ]\n\n operations = [\n migrations.AlterModelOptions(\n name='fileimporterbatch',\n options={'ordering': ['-created_on'], 'verbose_name': 'File Importer Batch', 'verbose_name_plural': 'File Importer Batches'},\n ),\n migrations.AlterField(\n model_name='fileimporter',\n name='file_importer_batch',\n field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='file_importers', to='django_import_data.FileImporterBatch'),\n ),\n migrations.AlterField(\n model_name='modelimporter',\n name='file_import_attempt',\n field=models.ForeignKey(default=-1, help_text='Reference to the FileImportAttempt this was created from', on_delete=django.db.models.deletion.CASCADE, related_name='model_importers', to='django_import_data.FileImportAttempt'),\n preserve_default=False,\n ),\n ]\n" }, { "alpha_fraction": 0.6046931147575378, "alphanum_fraction": 0.660649836063385, "avg_line_length": 28.157894134521484, "blob_id": "0d20e13a09640c7afb68e0a28c2dd751ecde2545", "content_id": "f7c5f5265868f6f521681cde8e7a82a7532bbe4b", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 554, "license_type": "permissive", "max_line_length": 155, "num_lines": 19, "path": "/django_import_data/migrations/0014_auto_20190705_1412.py", "repo_name": "GreenBankObservatory/django-import-data", "src_encoding": "UTF-8", "text": "# Generated by Django 2.2.2 on 2019-07-05 18:12\n\nfrom django.db import migrations, models\nimport django.db.models.deletion\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('django_import_data', '0013_auto_20190705_1409'),\n ]\n\n operations = [\n migrations.AlterField(\n model_name='fileimporter',\n name='file_importer_batch',\n field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='file_importers', to='django_import_data.FileImporterBatch'),\n ),\n ]\n" }, { "alpha_fraction": 0.6154404878616333, "alphanum_fraction": 0.6172570586204529, "avg_line_length": 31.76785659790039, "blob_id": "21da1d958eaddd49ee9eabd208c8cc5d6b626bca", "content_id": "734b7bdb2777e7b32b396564834661ff6289667a", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 5505, "license_type": "permissive", "max_line_length": 105, "num_lines": 168, "path": "/django_import_data/mixins.py", "repo_name": "GreenBankObservatory/django-import-data", "src_encoding": "UTF-8", "text": "import os\nfrom datetime import datetime\n\nfrom django.db import models\nfrom django.utils.timezone import make_aware, now\n\nfrom .utils import OrderedEnum, hash_file\n\n\nclass SensibleTextyField:\n def __init__(self, *args, **kwargs):\n null_given = \"null\" in kwargs\n null = kwargs.get(\"null\", False)\n blank = kwargs.get(\"blank\", False)\n unique = kwargs.get(\"unique\", False)\n # (kwargs.get(\"default\", models.NOT_PROVIDED),)\n\n if not (unique is True and blank is True) and null is True:\n raise ValueError(\n f\"{self.__class__.__name__} doesn't allow null=True unless unique=True AND blank=True! \"\n \"See https://docs.djangoproject.com/en/2.1/ref/models/fields/#null for more details\"\n )\n\n if unique is True and blank is True:\n if null_given and null is False:\n raise ValueError(\n f\"{self.__class__.__name__} doesn't allow null=False if unique=True AND blank=True! \"\n \"See https://docs.djangoproject.com/en/2.1/ref/models/fields/#null for more details\"\n )\n kwargs[\"null\"] = True\n\n if blank is False and null is False:\n kwargs[\"default\"] = None\n\n super().__init__(*args, **kwargs)\n\n\nclass SensibleCharField(SensibleTextyField, models.CharField):\n pass\n\n\nclass SensibleTextField(SensibleTextyField, models.TextField):\n pass\n\n\nclass SensibleEmailField(SensibleTextyField, models.EmailField):\n pass\n\n\nclass CurrentStatusModel(models.Model):\n class CURRENT_STATUSES(OrderedEnum):\n # NOTE: Order here matters; it is used to determine precedence\n deleted = \"Deleted\"\n acknowledged = \"Acknowledged\"\n active = \"Active\"\n\n current_status = models.PositiveIntegerField(\n choices=CURRENT_STATUSES.as_choices(),\n default=CURRENT_STATUSES.active.db_value,\n db_index=True,\n )\n\n def is_acknowledged(self):\n return self.current_status == self.CURRENT_STATUSES.acknowledged.db_value\n\n def is_active(self):\n return self.current_status == self.CURRENT_STATUSES.active.db_value\n\n def is_deleted(self):\n return self.current_status == self.CURRENT_STATUSES.deleted.db_value\n\n class Meta:\n abstract = True\n\n\nclass ImportStatusModel(models.Model):\n class STATUSES(OrderedEnum):\n # NOTE: Order here matters; it is used to determine precedence\n pending = \"Pending\"\n created_clean = \"Complete Success\"\n empty = \"Empty\"\n created_dirty = \"Partial Success\"\n rejected = \"Failure\"\n\n status = models.PositiveIntegerField(\n choices=STATUSES.as_choices(), default=STATUSES.pending.db_value, db_index=True\n )\n\n class Meta:\n abstract = True\n\n\nclass TrackedModel(models.Model):\n \"\"\"An abstract class for any models that need to track who\n created or last modified an object and when.\n \"\"\"\n\n created_on = models.DateTimeField(auto_now_add=True)\n modified_on = models.DateTimeField(auto_now=True, null=True)\n\n class Meta:\n abstract = True\n\n\nclass IsActiveModel(models.Model):\n \"\"\"An abstract class that allows objects to be 'soft' deleted.\"\"\"\n\n is_active = models.BooleanField(default=True, db_index=True)\n\n class Meta:\n abstract = True\n\n\nclass TrackedFileMixin(models.Model):\n file_path = SensibleCharField(\n max_length=512, help_text=\"Path to the file that this is linked to\", unique=True\n )\n hash_on_disk = SensibleCharField(\n max_length=40,\n blank=True,\n help_text=\"SHA-1 hash of the file on disk. If blank, the file is missing\",\n )\n file_modified_on = models.DateTimeField(null=True, blank=True)\n hash_checked_on = models.DateTimeField(null=True, blank=True)\n\n class Meta:\n abstract = True\n\n @property\n def file_missing(self):\n return not self.hash_on_disk\n\n @property\n def file_changed(self):\n return self.refresh_from_filesystem() == \"changed\"\n\n def refresh_from_filesystem(self, always_hash=False):\n try:\n # If the file can be found, we determine its modification time\n # This is done regardless of whether the files contents have changed\n fs_file_modified_on = make_aware(\n datetime.fromtimestamp(os.path.getmtime(self.file_path))\n )\n except (FileNotFoundError, OSError):\n # If the file can't be found (or the name is invalid, and an OSError\n # is reported), we set the hash to None,\n # and the status to missing\n self.hash_on_disk = None\n status = \"missing\"\n else:\n if self.file_modified_on != fs_file_modified_on or always_hash:\n self.file_modified_on = fs_file_modified_on\n self.hash_checked_on = now()\n # Attempt to determine the hash of the file on disk\n actual_hash_on_disk = hash_file(self.file_path)\n # Now determine whether the contents of the file have changed since\n # last check\n if self.hash_on_disk != actual_hash_on_disk:\n # If the file has changed, update its hash in the instance\n self.hash_on_disk = actual_hash_on_disk\n status = \"changed\"\n else:\n status = \"unchanged\"\n else:\n status = \"skipped\"\n\n self.save()\n return status\n" }, { "alpha_fraction": 0.5538066625595093, "alphanum_fraction": 0.5557828545570374, "avg_line_length": 39.284915924072266, "blob_id": "8e388f793100617030118c8716dcb5986c88c4d7", "content_id": "45e7e1cad97f3e727b9c8135cdefa076854c0a41", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 28846, "license_type": "permissive", "max_line_length": 140, "num_lines": 716, "path": "/django_import_data/management/commands/_base_import.py", "repo_name": "GreenBankObservatory/django-import-data", "src_encoding": "UTF-8", "text": "\"\"\"Provides BaseImportCommand: an abstract class for creating Importers\"\"\"\n\nfrom collections import defaultdict\nfrom datetime import datetime\nfrom enum import Enum\nfrom pprint import pformat\nimport csv\nimport json\nimport logging\nimport os\nimport random\nimport re\n\nfrom django.apps import apps\nfrom django.core.management.base import BaseCommand\nfrom django.db import transaction\nfrom django.db.models import Count, F, Q\nfrom django.utils import timezone\n\nfrom tqdm import tqdm\n\nfrom django_import_data.utils import hash_file, determine_files_to_process\n\nLOGGER = logging.getLogger(__name__)\n\n\nclass BaseImportCommand(BaseCommand):\n # output will automatically be wrapped with BEGIN; and COMMIT;\n # output_transaction = True\n # prints a warning if the set of migrations on disk don’t match the migrations in the database\n requires_migrations_checks = True\n\n class PROGRESS_TYPES(Enum):\n ROW = \"ROW\"\n FILE = \"FILE\"\n\n PROGRESS_TYPE = None\n\n START_INDEX_DEFAULT = 0\n END_INDEX_DEFAULT = None\n\n # TODO: This is somewhat stupid; think of a better way\n FORM_MAPS = NotImplemented\n\n IGNORED_HEADERS = []\n\n @classmethod\n def add_core_arguments(cls, parser):\n \"\"\"Add the set of args that are common across all import commands\"\"\"\n parser.add_argument(\n \"-d\",\n \"--dry-run\",\n action=\"store_true\",\n help=(\n \"Roll back all database changes after execution. Note that \"\n \"this will leave gaps in the PKs where created objects were rolled back\"\n ),\n )\n parser.add_argument(\n \"-D\", \"--durable\", action=\"store_true\", help=\"Continue past record errors\"\n )\n\n group = parser.add_mutually_exclusive_group()\n group.add_argument(\n \"--overwrite\",\n action=\"store_true\",\n help=(\n \"If a previous File Import Attempt is detected for one or more \"\n \"of the given paths, delete and re-create it (overwrite it)\"\n ),\n )\n group.add_argument(\n \"--skip\",\n action=\"store_true\",\n help=(\n \"If a previous File Import Attempt is detected for one or more \"\n \"of the given paths, skip it\"\n ),\n )\n\n parser.add_argument(\n \"-l\",\n \"--limit\",\n type=float,\n help=\"Specify a random percentage [0.0 - 1.0] of records that should be processed\",\n )\n parser.add_argument(\n \"--start-index\",\n type=int,\n default=cls.START_INDEX_DEFAULT,\n help=\"Used in conjunction with end_index to determine the slice of records to be processed\",\n )\n parser.add_argument(\n \"--end-index\",\n type=int,\n default=cls.END_INDEX_DEFAULT,\n help=\"Used in conjunction with start_index to determine the slice of records to be processed\",\n )\n parser.add_argument(\n \"--no-transaction\",\n action=\"store_true\",\n help=\"If given, no transaction will be used. WARNING: You should ensure \"\n \"that transactions are being managed elsewhere in order to prevent data loss!\",\n )\n parser.add_argument(\n \"-p\",\n \"--pattern\",\n help=(\n \"Regular expression used to identify Excel application files. \"\n \"Used only when a directory is given in path\"\n ),\n )\n parser.add_argument(\n \"--no-file-duplicate-check\",\n action=\"store_true\",\n help=(\n \"This will skip the check for duplicate files, which \"\n \"will speed up the import significantly for large directories. \"\n \"But, behavior for handling duplicate files is... not ideal. \"\n \"So this should only be used after you are sure there are no duplicates!\"\n ),\n )\n parser.add_argument(\n \"--propagate\",\n action=\"store_true\",\n help=(\n \"This will cause derived values to be derived and propagated \"\n \"as audit models are created. If not given, it is assumed that \"\n \"these will be derived at the end.\"\n ),\n )\n parser.add_argument(\n \"--no-post-import-actions\",\n action=\"store_true\",\n help=(\n \"If given, do not execute any of the defined post-import actions. \"\n \"This might be used if you plan on performing post-import actions yourself\"\n ),\n )\n\n if cls.PROGRESS_TYPE == cls.PROGRESS_TYPES.ROW:\n parser.add_argument(\n \"-r\",\n \"--rows\",\n nargs=\"+\",\n type=int,\n help=\"List of specific rows to process (by index)\",\n )\n\n # TODO: Disallow no_transaction and dry_run being given\n # TODO: Enforce range on limit\n return parser\n\n def add_arguments(self, parser):\n parser.add_argument(\"paths\", nargs=\"+\")\n self.add_core_arguments(parser)\n\n # TODO: This does NOT HANDLE duplicate headers! Behavior is not well\n # defined, and there WILL BE data loss if there are duplicate headers,\n # both with important information\n @staticmethod\n def load_rows(path):\n \"\"\"Load rows from a CSV file\"\"\"\n with open(path, newline=\"\", encoding=\"latin1\") as file:\n lines = file.readlines()\n\n LOGGER.debug(f\"Read {len(lines)} lines from {path}\")\n return csv.DictReader(lines)\n\n def handle_record(self, record, file_import_attempt):\n \"\"\"Provides logic for importing individual records\"\"\"\n\n raise NotImplementedError(\"Must be implemented by child class\")\n\n def check_for_duplicates(self, paths):\n hash_to_path_map = defaultdict(list)\n tqdm.write(\"Checking for duplicates...\")\n progress = tqdm(paths, unit=\"file\")\n for path in progress:\n progress.desc = f\"Hashing {path}\"\n file_hash = hash_file(path)\n hash_to_path_map[file_hash].append(path)\n\n return {\n hash_: paths for hash_, paths in hash_to_path_map.items() if len(paths) > 1\n }\n\n def determine_records_to_process(\n self,\n records,\n rows_to_process=None,\n limit=None,\n start_index=START_INDEX_DEFAULT,\n end_index=END_INDEX_DEFAULT,\n ):\n \"\"\"Return subset of given records\n\n First, a slice is taken using `start_index` and `end_index`.\n Then, if limit is given, if is used to randomly select a further subset\n of records\n \"\"\"\n\n if rows_to_process and limit:\n raise ValueError(\"Cannot give both rows_to_process and limit!\")\n\n if rows_to_process:\n return [records[index] for index in rows_to_process]\n\n sliced = records[start_index:end_index]\n num_sliced = len(sliced)\n\n if limit is not None:\n if limit >= 1:\n return sliced\n\n # Determine how many records we want to return\n goal = int(num_sliced * limit)\n # Ensure that there is always at least one record returned\n if goal < 1:\n goal = 1\n\n random_indices = set()\n # Generate unique random indices until we have reached the goal\n while len(random_indices) < goal:\n random_indices.add(random.randint(0, num_sliced - 1))\n\n sliced = [sliced[index] for index in random_indices]\n\n return sliced\n\n def get_known_headers(self,):\n known_headers = set()\n for form_map in self.FORM_MAPS:\n known_headers.update(form_map.get_known_from_fields())\n return sorted(known_headers)\n\n def get_unmapped_headers(self, headers_to_check, known_headers):\n return [\n header\n for header in headers_to_check\n if header not in (*known_headers, *self.IGNORED_HEADERS)\n ]\n\n # TODO: This currently does nothing; see TODO on load_rows\n def get_duplicate_headers(self, headers_to_check, respect_ignored_headers=True):\n \"\"\"Given an iterable of headers, return a dict of {header: num_duplicates}\n\n If no duplicates are found, an empty dict is returned\"\"\"\n\n if respect_ignored_headers:\n headers_to_check = [\n header\n for header in headers_to_check\n if header not in self.IGNORED_HEADERS\n ]\n return {\n header: headers_to_check.count(header)\n for header in headers_to_check\n if headers_to_check.count(header) > 1\n }\n\n def header_checks(self, headers):\n info = {}\n errors = {}\n\n # If some headers don't map to anything, report this as an error\n known_headers = self.get_known_headers()\n # Get ignored headers, if defined. Default to an empty list for later clarity\n ignored_headers = getattr(self, \"IGNORED_HEADERS\", [])\n info[\"ignored_headers\"] = ignored_headers\n\n info[\"known_headers\"] = known_headers\n unmapped_headers = self.get_unmapped_headers(headers, known_headers)\n\n if unmapped_headers:\n errors[\"unmapped_headers\"] = unmapped_headers\n\n unmapped_header_ratio = len(unmapped_headers) / len(headers)\n # TODO: Store default somewhere else\n if unmapped_header_ratio > getattr(self, \"THRESHOLD\", 0.7):\n errors[\n \"too_many_unmapped_headers\"\n ] = f\"{unmapped_header_ratio * 100:.2f}% of headers are not mapped\"\n return info, errors\n\n def file_level_checks(self, rows):\n info = {}\n errors = {}\n if not rows:\n errors[\"empty\"] = [\"No rows!\"]\n return info, errors\n\n headers = rows[0].keys()\n header_check_info, header_check_errors = self.header_checks(headers)\n\n info.update(header_check_info)\n errors.update(header_check_errors)\n\n return info, errors\n\n def handle_file(self, path, file_importer_batch, **options):\n LOGGER.debug(f\"Handling path {path}\")\n FileImporter = apps.get_model(\"django_import_data.FileImporter\")\n FileImportAttempt = apps.get_model(\"django_import_data.FileImportAttempt\")\n RowData = apps.get_model(\"django_import_data.RowData\")\n # TODO: How to handle changes in path? That is, if a Batch file is moved\n # somewhere else we still need a way to force its association with the\n # existing Batch in the DB. Allow explicit Batch ID to be passed in?\n # Some other unique ID?\n current_command = self.__module__.split(\".\")[-1]\n try:\n file_modified_on = timezone.make_aware(\n datetime.fromtimestamp(os.path.getmtime(path))\n )\n hash_on_disk = hash_file(path)\n LOGGER.debug(f\"Found {path}; hash: {hash_on_disk}\")\n except FileNotFoundError:\n file_modified_on = None\n hash_on_disk = \"\"\n LOGGER.debug(f\"{path} not found; using null hash and modification time\")\n\n hash_checked_on = timezone.now()\n existing_file_importers = FileImporter.objects.filter(file_path=path)\n num_file_importers_found = existing_file_importers.count()\n if num_file_importers_found == 1:\n file_importer = existing_file_importers.first()\n LOGGER.debug(f\"Found single existing FileImporter: FI {file_importer.id}\")\n file_importer_created = False\n file_importer.hash_on_disk = hash_on_disk\n file_importer.hash_checked_on = hash_checked_on\n file_importer.file_importer_batch = file_importer_batch\n file_importer.save(\n propagate_derived_values=options[\"propagate\"],\n derive_cached_values=options[\"propagate\"],\n )\n elif num_file_importers_found == 0:\n file_importer = FileImporter.objects.create_fast(\n file_importer_batch=file_importer_batch,\n file_path=path,\n importer_name=current_command,\n file_modified_on=file_modified_on,\n hash_on_disk=hash_on_disk,\n hash_checked_on=hash_checked_on,\n )\n LOGGER.debug(\n f\"Found no existing FileImporter; created FI {file_importer.id}\"\n )\n file_importer_created = True\n else:\n raise ValueError(\n f\">1 FIs found for {path}. This should be impossible \"\n \"due to unique constraint; something is very wrong\"\n )\n\n file_importer.file_importer_batch = file_importer_batch\n file_importer.save(\n propagate_derived_values=options[\"propagate\"],\n derive_cached_values=options[\"propagate\"],\n )\n\n latest_file_import_attempt = file_importer.latest_file_import_attempt\n if latest_file_import_attempt:\n LOGGER.debug(\n f\"Found previous FileImportAttempt: FIA {latest_file_import_attempt.id}\"\n )\n if options[\"overwrite\"] or options[\"skip\"]:\n if options[\"skip\"]:\n LOGGER.debug(f\"Skipping processing of {path}\")\n if self.verbosity > 2:\n tqdm.write(\n f\"SKIPPING previous FIA: {latest_file_import_attempt}\"\n )\n # TODO: We shouldn't return here...\n return None\n else:\n LOGGER.debug(\n f\"Overwriting previous FIA {latest_file_import_attempt.id}\"\n )\n if self.verbosity > 2:\n tqdm.write(\n f\"DELETING previous FIA: {latest_file_import_attempt}\"\n )\n num_deletions, deletions = (\n latest_file_import_attempt.delete_imported_models()\n )\n LOGGER.debug(\n f\"Deleted {num_deletions} models:\\n{pformat(deletions)}\"\n )\n if self.verbosity > 2:\n tqdm.write(\n f\"Deleted {num_deletions} models:\\n{pformat(deletions)}\"\n )\n else:\n raise ValueError(\n f\"Found previous File Import Attempt '{latest_file_import_attempt}', \"\n \"but cannot delete or skip it due to lack of overwrite=True or skip=True!\"\n )\n\n file_level_errors = {}\n try:\n rows = list(self.load_rows(path))\n except (FileNotFoundError, ValueError) as error:\n if options[\"durable\"]:\n tqdm.write(f\"ERROR: {error}\")\n if \"misc\" in file_level_errors:\n file_level_errors[\"misc\"].append([error])\n else:\n file_level_errors[\"misc\"] = [error]\n else:\n raise ValueError(\"Error loading rows!\") from error\n rows = []\n\n LOGGER.debug(f\"Got {len(rows)} rows from {path}\")\n file_level_info, more_file_level_errors = self.file_level_checks(rows)\n file_level_errors.update(more_file_level_errors)\n if not os.path.isfile(path):\n if \"misc\" in file_level_errors:\n file_level_errors[\"misc\"].append([\"file_missing\"])\n else:\n file_level_errors[\"misc\"] = [\"file_missing\"]\n if file_level_errors and not options[\"durable\"]:\n raise ValueError(f\"One or more file-level errors: {file_level_errors}\")\n\n file_import_attempt = FileImportAttempt.objects.create(\n file_importer=file_importer,\n imported_from=path,\n info=file_level_info,\n errors=file_level_errors,\n imported_by=self.__module__,\n hash_when_imported=hash_on_disk,\n )\n if self.PROGRESS_TYPE == self.PROGRESS_TYPES.ROW:\n rows_to_process = options.get(\"rows\", None)\n limit = options.get(\"limit\", None)\n start_index = options.get(\"start_index\", None)\n end_index = options.get(\"end_index\", None)\n rows = self.determine_records_to_process(\n rows,\n rows_to_process=rows_to_process,\n limit=limit,\n start_index=start_index,\n end_index=end_index,\n )\n\n if rows_to_process:\n tqdm.write(f\"Processing only rows {rows_to_process}\")\n\n if limit is not None:\n # if start_index != self.START_INDEX_DEFAULT or end_index != self.END_INDEX_DEFAULT:\n # slice_str =\n tqdm.write(\n f\"Processing {len(rows)} rows ({limit * 100:.2f}% \"\n \"of rows, randomly selected)\"\n )\n rows = tqdm(rows, desc=self.help, unit=\"rows\")\n\n all_errors = []\n\n # TODO: Excel logic of adding a column with original row needs to be here, then removed there?\n # We start at 2 here:\n # +1 to make it 1-indexed (more intuitive for end user)\n # +1 to compensate for header being the first row\n # TODO: This is NOT robust across all use cases! Should be defined in the importer_spec.json/CLI, worst case...\n for ri, row in enumerate(rows, 2):\n row_data = RowData.objects.create(\n row_num=ri, data=row, file_import_attempt=file_import_attempt\n )\n self.handle_record(row_data, durable=options[\"durable\"])\n errors = {\n model_importer.latest_model_import_attempt.imported_by: model_importer.latest_model_import_attempt.errors\n for model_importer in row_data.model_importers.all()\n if model_importer.latest_model_import_attempt.errors\n }\n if errors:\n error_str = (\n f\"Row {ri} of file {os.path.basename(path)} handled, but had {len(errors)} errors:\\n\"\n f\"{json.dumps(errors, indent=2)}\"\n )\n if options[\"durable\"]:\n tqdm.write(error_str)\n else:\n raise ValueError(error_str)\n\n all_errors.append(errors)\n\n creations, errors = self.summary(file_import_attempt, all_errors)\n file_import_attempt.creations = creations\n file_import_attempt.errors.update(errors)\n file_import_attempt.ignored_headers = self.IGNORED_HEADERS\n file_import_attempt.save(\n propagate_derived_values=options[\"propagate\"],\n derive_cached_values=options[\"propagate\"],\n )\n return file_import_attempt\n\n # raise ValueError(\"hmmm\")\n\n def summary(self, file_import_attempt, all_errors):\n error_summary = {}\n total_form_errors = 0\n total_conversion_errors = 0\n creations = (\n file_import_attempt.row_datas.filter(\n model_importers__model_import_attempts__status__in=[2, 3]\n )\n .values(\n model=F(\"model_importers__model_import_attempts__content_type__model\")\n )\n .annotate(\n creation_count=Count(\"model_importers__model_import_attempts__status\")\n )\n )\n\n for row_errors in all_errors:\n for attribute, attribute_errors in row_errors.items():\n error_summary.setdefault(attribute, {})\n conversion_errors = attribute_errors.get(\"conversion_errors\", {})\n total_conversion_errors += len(conversion_errors)\n for conversion_error in conversion_errors:\n error_summary[attribute].setdefault(\"conversion_errors\", {})\n error_summary[attribute][\"conversion_errors\"].setdefault(\"count\", 0)\n error_summary[attribute][\"conversion_errors\"][\"count\"] += len(\n conversion_error\n )\n\n error_summary[attribute][\"conversion_errors\"].setdefault(\n \"fields\", []\n )\n if (\n conversion_error[\"from_fields\"]\n not in error_summary[attribute][\"conversion_errors\"][\"fields\"]\n ):\n error_summary[attribute][\"conversion_errors\"][\"fields\"].append(\n conversion_error[\"from_fields\"]\n )\n\n form_errors = attribute_errors.get(\"form_errors\", {})\n total_form_errors += len(form_errors)\n for form_error in form_errors:\n error_summary[attribute].setdefault(\"form_errors\", {})\n error_summary[attribute][\"form_errors\"].setdefault(\"count\", 0)\n error_summary[attribute][\"form_errors\"][\"count\"] += len(form_error)\n\n error_summary[attribute][\"form_errors\"].setdefault(\"fields\", [])\n if (\n form_error[\"field\"]\n not in error_summary[attribute][\"form_errors\"][\"fields\"]\n ):\n error_summary[attribute][\"form_errors\"][\"fields\"].append(\n form_error[\"field\"]\n )\n if self.verbosity == 3:\n tqdm.write(\"=\" * 80)\n tqdm.write(\"Model Import Summary:\")\n for creation in creations:\n tqdm.write(\n \"Created {creation_count} {model} objects\".format(**creation)\n )\n tqdm.write(\"-\" * 80)\n if error_summary and self.verbosity > 1:\n tqdm.write(\"Error Summary:\")\n tqdm.write(pformat(error_summary))\n tqdm.write(\n f\" Encountered {total_form_errors + total_conversion_errors} total errors \"\n f\"across {len(error_summary)} attribute(s):\"\n )\n tqdm.write(\"=\" * 80)\n for attribute, attribute_errors in error_summary.items():\n tqdm.write(f\" {attribute} had {len(attribute_errors)} type(s) of error:\")\n for error_type, errors_of_type in attribute_errors.items():\n tqdm.write(f\" {error_type}:\")\n tqdm.write(\n f\" {errors_of_type['count']} errors across fields: {errors_of_type['fields']}\"\n )\n\n return [dict(creation) for creation in creations], error_summary\n\n def handle_files(self, files_to_process, **options):\n FileImporterBatch = apps.get_model(\"django_import_data.FileImporterBatch\")\n current_command = self.__module__.split(\".\")[-1]\n # NOTE: Any future positional args will need to be popped out here, too\n paths = options.pop(\"paths\")\n file_importer_batch = FileImporterBatch.objects.create(\n command=current_command, args=paths, kwargs=options\n )\n LOGGER.debug(\n f\"Created FIB {file_importer_batch.id}; will process {files_to_process} {self.verbosity}\"\n )\n for path in files_to_process:\n if self.verbosity == 3:\n tqdm.write(f\"Processing {path}\")\n file_import_attempt = self.handle_file(path, file_importer_batch, **options)\n # LOGGER.debug(\n # f\"handle_files: file_import_attempt: {file_import_attempt.id}; {file_import_attempt.file_importer.file_importer_batch.id}\"\n # )\n assert file_import_attempt is not None\n\n return file_importer_batch\n\n def post_import_actions(self, file_importer_batch):\n LOGGER.debug(\"Performing post_import_actions\")\n FileImportAttempt = apps.get_model(\"django_import_data.FileImportAttempt\")\n ModelImporter = apps.get_model(\"django_import_data.ModelImporter\")\n # Derive appropriate statuses for all MIs. This will also\n # propagate to all FIAs, FIs, and FIBs\n LOGGER.debug(\"Deriving status values for Model Importers\")\n ModelImporter.objects.filter(\n row_data__file_import_attempt__file_importer__file_importer_batch__id=file_importer_batch.id\n ).derive_values()\n LOGGER.debug(\"Deriving status values for File Import Attempts\")\n # TODO: Make this more robust via Managers instead of Querysets...\n # This is needed to check all FIAs without any MIs!\n FileImportAttempt.objects.filter(\n file_importer__file_importer_batch__id=file_importer_batch.id\n ).derive_values()\n\n def post_import_checks(self, file_importer_batch, **options):\n tqdm.write(\"All Batch-Level Errors\")\n all_file_errors = [\n fi.latest_file_import_attempt.errors\n for fi in file_importer_batch.file_importers.all()\n if fi and fi.latest_file_import_attempt.errors\n ]\n\n unique_file_error_types = set(\n (key for e in all_file_errors for key in e.keys())\n )\n\n all_unique_errors = {}\n for error_type in unique_file_error_types:\n errors_by_file = [\n file_errors[error_type]\n for file_errors in all_file_errors\n if error_type in file_errors\n ]\n unique_errors = set(error for errors in errors_by_file for error in errors)\n all_unique_errors[error_type] = unique_errors\n\n file_importer_batch.errors.update(\n {key: list(value) for key, value in all_unique_errors.items()}\n )\n file_importer_batch.save(\n propagate_derived_values=options[\"propagate\"],\n derive_cached_values=options[\"propagate\"],\n )\n tqdm.write(pformat(all_unique_errors))\n tqdm.write(\"=\" * 80)\n\n def handle(self, *args, **options):\n self.verbosity = options[\"verbosity\"]\n try:\n files_to_process = determine_files_to_process(\n options[\"paths\"], pattern=options[\"pattern\"]\n )\n except ValueError as error:\n if options[\"durable\"]:\n tqdm.write(f\"ERROR: {error}\")\n files_to_process = options[\"paths\"]\n else:\n raise\n\n if not files_to_process:\n if options[\"durable\"]:\n tqdm.write(f\"ERROR: No files were found!\")\n files_to_process = []\n else:\n raise ValueError(\"No files were found!\")\n\n if self.PROGRESS_TYPE == self.PROGRESS_TYPES.FILE:\n files_to_process = self.determine_records_to_process(\n files_to_process,\n **{\n option: value\n for option, value in options.items()\n if option in [\"limit\", \"start_index\", \"end_index\"]\n },\n )\n\n if not options[\"no_file_duplicate_check\"]:\n duplicate_paths = self.check_for_duplicates(files_to_process)\n if duplicate_paths:\n num_duplicates = 0\n for duplicate_paths in duplicate_paths.values():\n tqdm.write(f\"Duplicate paths:\")\n for path in duplicate_paths:\n num_duplicates += 1\n tqdm.write(f\" {path}\")\n files_to_process.remove(path)\n if options[\"durable\"]:\n tqdm.write(\n f\"The above {num_duplicates} duplicate paths have been removed from the pending import!\"\n )\n else:\n raise ValueError(\"Duplicate paths found! See log for details\")\n\n if self.PROGRESS_TYPE == self.PROGRESS_TYPES.FILE:\n files_to_process = tqdm(files_to_process, desc=self.help, unit=\"files\")\n\n if options[\"no_transaction\"]:\n file_importer_batch = self.handle_files(files_to_process, **options)\n else:\n with transaction.atomic():\n file_importer_batch = self.handle_files(files_to_process, **options)\n\n if options[\"dry_run\"]:\n transaction.set_rollback(True)\n tqdm.write(\"DRY RUN; rolling back changes\")\n\n file_importer_batch.errors[\"duplicate_paths\"] = duplicate_paths\n self.post_import_checks(file_importer_batch, **options)\n if not options[\"no_post_import_actions\"]:\n self.post_import_actions(file_importer_batch)\n else:\n tqdm.write(\n \"Skipping post import actions due to presence of no_post_import_actions=True\"\n )\n" }, { "alpha_fraction": 0.7628205418586731, "alphanum_fraction": 0.7628205418586731, "avg_line_length": 25, "blob_id": "a6be6787ca2a24ebd4492620dd6a189f72908c54", "content_id": "43368ee05e70390b47b2138773a9325d183af06f", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 156, "license_type": "permissive", "max_line_length": 47, "num_lines": 6, "path": "/django_import_data/apps.py", "repo_name": "GreenBankObservatory/django-import-data", "src_encoding": "UTF-8", "text": "from django.apps import AppConfig\n\n\nclass DjangoImportDataProjectConfig(AppConfig):\n name = \"django_import_data\"\n verbose_name = \"Django Import Data\"\n" }, { "alpha_fraction": 0.6463142037391663, "alphanum_fraction": 0.6463142037391663, "avg_line_length": 32.57500076293945, "blob_id": "61955abbdbdbf0f7d94d41a58dcd1df3f48f443d", "content_id": "8a5577b36847b46f79fd5a234cb229db4de516f9", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2686, "license_type": "permissive", "max_line_length": 88, "num_lines": 80, "path": "/example_project/cases/urls.py", "repo_name": "GreenBankObservatory/django-import-data", "src_encoding": "UTF-8", "text": "from django.contrib import admin\nfrom django.urls import include, path\nfrom django.views.generic.base import RedirectView\n\nfrom . import views\nfrom .forms import CaseForm\n\nfrom django_import_data.views import (\n # ModelImporterDetailView,\n # ModelImporterListView,\n ModelImportAttemptListView,\n ModelImportAttemptDetailView,\n FileImporterListView,\n FileImporterDetailView,\n FileImportAttemptListView,\n FileImportAttemptDetailView,\n)\n\nurlpatterns = [\n path(\"\", RedirectView.as_view(url=\"/audit-groups\")),\n # path(\"audit-groups/\", ModelImporterListView.as_view(), name=\"ModelImporter_list\"),\n # path(\n # \"audit-groups/<int:pk>/\",\n # ModelImporterDetailView.as_view(),\n # name=\"ModelImporter_detail\",\n # ),\n path(\n \"audits/\", ModelImportAttemptListView.as_view(), name=\"ModelImportAttempt_list\"\n ),\n path(\"cases/\", views.CaseListView.as_view(), name=\"case_list\"),\n path(\"people/\", views.PersonListView.as_view(), name=\"person_list\"),\n path(\"structures/\", views.StructureListView.as_view(), name=\"structure_list\"),\n path(\n \"audits/\", ModelImportAttemptListView.as_view(), name=\"ModelImportAttempt_list\"\n ),\n path(\n \"audits/<int:pk>/\",\n ModelImportAttemptDetailView.as_view(),\n name=\"ModelImportAttempt_detail\",\n ),\n path(\"cases/create\", views.CaseCreateView.as_view(), name=\"case_create\"),\n path(\"cases/<int:pk>/\", views.CaseDetailView.as_view(), name=\"case_detail\"),\n path(\"people/<int:pk>/\", views.PersonDetailView.as_view(), name=\"person_detail\"),\n path(\n \"structures/<int:pk>/\",\n views.StructureDetailView.as_view(),\n name=\"structure_detail\",\n ),\n path(\n \"cases/create-from-audit/<int:audit_pk>/\",\n views.CaseCreateFromImportAttemptView.as_view(),\n name=\"case_create_from_audit\",\n ),\n path(\n \"people/create-from-audit/<int:audit_pk>/\",\n views.PersonCreateFromImportAttemptView.as_view(),\n name=\"person_create_from_audit\",\n ),\n path(\n \"structure/create-from-audit/<int:audit_pk>/\",\n views.StructureCreateFromImportAttemptView.as_view(),\n name=\"structure_create_from_audit\",\n ),\n path(\"batches/\", FileImporterListView.as_view(), name=\"FileImporter_list\"),\n path(\n \"batches/<int:pk>/\",\n FileImporterDetailView.as_view(),\n name=\"FileImporter_detail\",\n ),\n path(\n \"batch-imports/\",\n FileImportAttemptListView.as_view(),\n name=\"FileImportAttempt_list\",\n ),\n path(\n \"batch-imports/<int:pk>/\",\n FileImportAttemptDetailView.as_view(),\n name=\"FileImportAttempt_detail\",\n ),\n]\n" }, { "alpha_fraction": 0.5573907494544983, "alphanum_fraction": 0.5590111017227173, "avg_line_length": 36.149513244628906, "blob_id": "01c2cb4cc414484d7ee97bac8be182582d1275b5", "content_id": "43d90f569d9c081af1e8ba473a916424093e52fb", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 19136, "license_type": "permissive", "max_line_length": 117, "num_lines": 515, "path": "/django_import_data/fieldmap.py", "repo_name": "GreenBankObservatory/django-import-data", "src_encoding": "UTF-8", "text": "\"\"\"Provides utilities for mapping header->field\n\nThe problem: we have a bunch of Excel files, e.g., that have columnar data we\nwish to create model instances from. Each column should map to a field, but\nthe columns don't always have the same names between Excel files. So, we need\nsome way to map all possible column headers to their appropriate field.\n\nAdditionally, we need a way to link a \"converter\" to each pairing -- this is\nresponsible for cleaning the data and converting it to the proper type. For\nexample, if we have a boolean column that represents None as either \"\" or \"n/a\",\ndepending on the file, we need a way to say that all of those mean the same thing.\n\nThis module contains all of the converters and the FieldMap class itself,\nas well as an dictionary of every known header to its mapped field -- \"expanded\"\nfrom the list of FieldMap instances\n\"\"\"\nDEFAULT_CONVERTER = None\nDEFAULT_ALLOW_UNKNOWN = True\nDEFAULT_ALLOW_MULTIPLE_ALIASES_FOR_FIELD = False\n\nfrom collections import defaultdict\nfrom inspect import getfullargspec\n\nfrom .mermaid import render_field_map_as_mermaid\nfrom .utils import to_fancy_str\n\n\nclass FieldMap:\n \"\"\"Map a to_field to its associated from_fields, a converter function, and any aliases\"\"\"\n\n # TODO: Distribute these to child classes\n ONE_TO_ONE = \"1:1\"\n ONE_TO_MANY = \"1:*\"\n MANY_TO_ONE = \"*:1\"\n MANY_TO_MANY = \"*:*\"\n\n map_type = NotImplemented\n\n def __init__(\n self,\n from_fields,\n to_fields,\n converter=DEFAULT_CONVERTER,\n aliases=None,\n explanation=None,\n ):\n # Strings are iterable, so will \"work\" for a large portion of the\n # processing, but aren't ever actually correct. So, just catch this\n # common error here and fail loudly up front\n if isinstance(to_fields, str) or isinstance(from_fields, str):\n raise TypeError(\"to_fields and from_fields should not be strings!\")\n\n self.to_fields = to_fields\n self.from_fields = from_fields\n # Function to convert/clean data. Only set if it is actually given!\n # This allows child classes to make their own decisions regarding it\n # if converter is not None:\n self.converter = converter\n\n from_fields_is_compound = isinstance(from_fields, dict)\n\n if aliases and from_fields_is_compound:\n raise ValueError(\n \"If aliases is given, from_fields cannot be \"\n \"a compound from_fields/aliases dict\"\n )\n\n if aliases is not None:\n self.fields_to_aliases = aliases\n # Aliases are given via dict, so handle this case\n if isinstance(from_fields, dict):\n self.aliases, self.fields_to_aliases, self.from_fields = self._split_from_fields(\n from_fields\n )\n else:\n self.aliases = {}\n self.fields_to_aliases = {}\n\n # if converter is None:\n # raise ValueError(\"converter must be given!\")\n # if not callable(converter):\n # raise ValueError(\"converter must be a callable!\")\n\n # This is a set of all possible mappable fields. That is, we can\n # map a field directly (where no alias is defined), or we can map\n # any of its aliases.\n self.known_fields = set([*self.from_fields, *self.aliases])\n\n if not self.map_type:\n raise ValueError(\n \"map_type must be set! Typically this is done by a sub-class\"\n )\n\n self.explanation = explanation\n\n @classmethod\n def _expand_aliases(cls, fields_to_aliases):\n expanded = {}\n for field, aliases in fields_to_aliases.items():\n if aliases is not None:\n if isinstance(aliases, str):\n alias = aliases\n expanded[field] = [alias]\n else:\n expanded[field] = aliases\n\n return expanded\n\n @property\n def converter_name(self):\n return self.converter.__name__ if self.converter else \"<no converter>\"\n\n def has_converter(self):\n if not self.converter:\n return False\n\n if self.converter.__name__ == \"nop_converter\":\n return False\n\n return True\n\n @classmethod\n def _split_from_fields(cls, from_fields):\n if not isinstance(from_fields, dict):\n raise ValueError(\n \"_split_from_fields requires aliases to be passed \"\n \"in as a dict of {from_field: aliases}\"\n )\n inverted_aliases = cls._invert_aliases(from_fields)\n expanded_aliases = cls._expand_aliases(from_fields)\n from_fields = tuple(from_fields.keys())\n return inverted_aliases, expanded_aliases, from_fields\n\n @classmethod\n def _invert_aliases(cls, fields_to_aliases):\n \"\"\"Given dict of {field: aliases}, return dict of {alias: field}\n\n For example, if fields_to_aliases={\n \"latitude\": (\"LAT\", \"lat.\"), \"longitude\": (\"LONG\", \"long.\")\n }, then we return:\n {\n 'LAT': 'latitude',\n 'lat.': 'latitude',\n 'LONG': 'longitude',\n 'long.': 'longitude'\n }\n \"\"\"\n inverted = {}\n for field, aliases in fields_to_aliases.items():\n if aliases is not None:\n if isinstance(aliases, str):\n alias = aliases\n inverted[alias] = field\n else:\n for alias in aliases:\n inverted[alias] = field\n return inverted\n\n def __repr__(self):\n return (\n f\"{self.__class__.__name__}(\\n\"\n f\" from_fields={self.from_fields!r},\\n\"\n f\" converter={self.converter.__name__},\\n\"\n f\" to_fields={self.to_fields!r}\\n,\"\n f\" aliases={self.aliases!r}\\n,\"\n \")\"\n )\n\n def __str__(self):\n if len(self.from_fields) == 1:\n from_ = \"1\"\n try:\n from_fields = self.from_fields[0]\n except KeyError:\n from_fields = next(iter(self.from_fields.keys()))\n else:\n from_ = \"*\"\n from_fields = self.from_fields\n\n if len(self.to_fields) == 1:\n to = \"1\"\n to_fields = self.to_fields[0]\n else:\n to = \"*\"\n to_fields = self.to_fields\n if callable(self.converter):\n converter = self.converter.__name__\n else:\n converter = self.converter\n\n return f\"FieldMap: {from_fields!r} [{from_}]—({converter})—[{to}] {to_fields!r}\"\n # return f\"FieldMap: {self.converter.__name__}({from_fields!r}) -> {to_fields!r}\"\n\n def get_unknown_fields(self, data):\n return {field for field in data if field not in self.known_fields}\n\n def get_from_fields_without_aliases(self):\n if self.fields_to_aliases:\n return [\n from_field\n for from_field in self.from_fields\n if from_field not in self.fields_to_aliases\n ]\n return self.from_fields\n\n def unalias(\n self,\n data,\n allow_unknown=DEFAULT_ALLOW_UNKNOWN,\n allow_multiple_aliases_for_field=DEFAULT_ALLOW_MULTIPLE_ALIASES_FOR_FIELD,\n ):\n unaliased_data = {}\n found_aliases = defaultdict(list)\n for alias, value in data.items():\n if alias in self.known_fields:\n # Get the unaliased alias, or, if there's no alias, just\n # use the alias name as is\n unaliased_field = self.aliases.get(alias, alias)\n found_aliases[unaliased_field].append(alias)\n unaliased_data[unaliased_field] = value\n else:\n if not allow_unknown:\n raise ValueError(\n f\"Field {alias} is not a known field \"\n f\"({self.known_fields})! To suppress this error, \"\n \"pass allow_unknown=True\"\n )\n if not allow_multiple_aliases_for_field:\n found_aliases = dict(found_aliases)\n duplicated_aliases = {\n field: aliases\n for field, aliases in found_aliases.items()\n if len(aliases) > 1\n }\n if duplicated_aliases:\n raise TypeError(\n f\"More than one alias found in the data: {duplicated_aliases}. \"\n \"This indicates that you probably need to split this FieldMap in two...\"\n )\n return unaliased_data, found_aliases\n\n # TODO: This has no place here... this should _perhaps_ perform\n # core functionality, but most rendering should now be distributed\n # to child classes\n def render(\n self,\n data,\n converter=DEFAULT_CONVERTER,\n allow_unknown=DEFAULT_ALLOW_UNKNOWN,\n allow_multiple_aliases_for_field=DEFAULT_ALLOW_MULTIPLE_ALIASES_FOR_FIELD,\n ):\n if converter is None:\n converter = self.converter\n ret, __ = self.unalias(\n data,\n allow_unknown=allow_unknown,\n allow_multiple_aliases_for_field=allow_multiple_aliases_for_field,\n )\n if not ret:\n # print(f\"WARNING: Failed to produce value for {data}\")\n return {}\n\n # Handle the simple 1:1/n:1 cases here to save on boilerplate externally\n # That is, allow for the existence of converters that don't return\n # {to_field: converted values} dicts, and instead simply return\n # converted values\n if self.map_type in (self.ONE_TO_ONE, self.MANY_TO_ONE):\n to_field = self.to_fields[0]\n if self.map_type == self.MANY_TO_ONE:\n try:\n converted = converter(**ret)\n except TypeError as error:\n if \"argument\" in str(error):\n argspec = getfullargspec(converter)\n raise TypeError(\n f\"Converter {converter.__name__} (args: {argspec.args}) rejected given args: {list(ret)}\"\n ) from error\n if not isinstance(converted, dict):\n return {to_field: converted}\n return converted\n\n from_field_value = next(iter(ret.values()))\n return {to_field: converter(from_field_value)}\n\n # For all other cases, expect the converter to be smart enough\n try:\n return converter(**ret)\n except TypeError as error:\n argspec = getfullargspec(converter)\n raise TypeError(\n f\"Converter {converter.__name__} ({argspec.args}) rejected given args: {list(ret)}\"\n ) from error\n\n def _explain_from_fields(self, form_fields, field_names):\n fields_verbose = []\n for field_name in field_names:\n try:\n field = form_fields[field_name]\n except KeyError as error:\n # raise ValueError(\n # f\"Invalid FormMap! {field_name} does not exist in form class {self.form_class}\"\n # ) from error\n fields_verbose.append(field_name)\n else:\n help_text = field.help_text\n name_str = field_name\n if field.label:\n name_str += f\" ({repr(field.label)})\"\n if help_text:\n name_str += f\" ({help_text})\"\n fields_verbose.append(name_str)\n return tuple(fields_verbose)\n\n def _explain_to_fields(self, form_fields, field_names):\n fields_verbose = []\n for field_name in field_names:\n try:\n field = form_fields[field_name]\n except KeyError as error:\n # raise ValueError(\n # f\"Invalid FormMap! {field_name} does not exist in form class {self.form_class}\"\n # ) from error\n fields_verbose.append(field_name)\n else:\n if self.aliases:\n inverted = tuple(\n [\n alias\n for alias, field in self.aliases.items()\n if field == field_name\n ]\n )\n if inverted:\n name_str = f\"{field_name}, under aliases:\"\n for alias in inverted:\n name_str += f\"\\n * {alias}\"\n else:\n name_str = field_name\n else:\n name_str = field_name\n fields_verbose.append(name_str)\n return tuple(fields_verbose)\n\n def explain(self, form_fields):\n d = {}\n from_fields_verbose = self._explain_to_fields(form_fields, self.from_fields)\n to_fields_verbose = self._explain_from_fields(form_fields, self.to_fields)\n\n return from_fields_verbose, to_fields_verbose, self.explanation\n\n def as_mermaid(self, *args, **kwargs):\n return render_field_map_as_mermaid(self, *args, **kwargs)\n\n def as_sentence(self):\n from_fields_label = \"fields\" if len(self.from_fields) > 1 else \"field\"\n to_fields_label = \"fields\" if len(self.to_fields) > 1 else \"field\"\n return (\n f\"Maps {from_fields_label} {to_fancy_str(self.from_fields, quote=True)} \"\n f\"to {to_fields_label} {to_fancy_str(self.to_fields, quote=True)} \"\n f\"via converter {self.converter_name!r}\"\n )\n\n def get_name(self):\n return self.__class__.__name__\n\n\nclass OneToOneFieldMap(FieldMap):\n map_type = FieldMap.ONE_TO_ONE\n\n def __init__(\n self, from_field, to_field=None, converter=DEFAULT_CONVERTER, explanation=None\n ):\n # If from_field is a dict then it contains a single field along with its aliases\n if isinstance(from_field, dict):\n if len(from_field) != 1:\n raise ValueError(\n \"If from_field is given as a dict, \"\n \"it must contain only one member!\"\n )\n # This means that it can be directly set as our from_fields\n from_fields = from_field\n # But we need to pull out its key (the field designation) to\n # populate our to_field\n if to_field is None:\n to_field = next(iter(from_field))\n else:\n # If it isn't a dict, assume that it is some sort of sensible\n # atomic value and put it in a list\n from_fields = [from_field]\n # If to_field still wasn't set, just set it\n # directly from from_field\n if to_field is None:\n to_field = from_field\n\n # TODO: Shouldn't this conflict with the convert_foo logic in formmap init?\n if converter is None:\n converter = self.nop_converter\n super().__init__(\n from_fields=from_fields,\n to_fields=[to_field],\n converter=converter,\n explanation=explanation,\n )\n assert len(self.from_fields) == 1, \"Should only be one from field!\"\n self.from_field = self.from_fields[0]\n assert len(self.to_fields) == 1, \"Should only be one to field!\"\n self.to_field = self.to_fields[0]\n\n # TODO: Consider having this return a dict?\n def nop_converter(self, value):\n \"\"\"Perform no conversion; simply return value\"\"\"\n return value\n\n def render(\n self,\n data,\n converter=DEFAULT_CONVERTER,\n allow_unknown=DEFAULT_ALLOW_UNKNOWN,\n allow_multiple_aliases_for_field=DEFAULT_ALLOW_MULTIPLE_ALIASES_FOR_FIELD,\n ):\n if converter is None:\n converter = self.converter\n ret, __ = self.unalias(\n data,\n allow_unknown=allow_unknown,\n allow_multiple_aliases_for_field=allow_multiple_aliases_for_field,\n )\n # Handle case where we don't have any mappings (need to bail early\n # to avoid breaking logic below)\n if not ret:\n return {}\n # Handle the simple 1:1/n:1 cases here to save on boilerplate externally\n # That is, allow for the existence of converters that don't return\n # {to_field: converted values} dicts, and instead simply return\n # converted values\n to_field = self.to_fields[0]\n from_field_value = next(iter(ret.values()))\n try:\n converted = converter(from_field_value)\n except TypeError as error:\n raise # ValueError(\"Unmapped headers!\") from error\n if not isinstance(converted, dict):\n return {to_field: converted}\n return converted\n\n\nclass ManyToOneFieldMap(FieldMap):\n map_type = FieldMap.MANY_TO_ONE\n\n def __init__(\n self, from_fields, to_field, converter=DEFAULT_CONVERTER, explanation=None\n ):\n super().__init__(\n from_fields=from_fields,\n to_fields=[to_field],\n converter=converter,\n explanation=explanation,\n )\n assert len(self.to_fields) == 1, \"Should only be one to field!\"\n self.to_field = self.to_fields[0]\n\n def render(\n self,\n data,\n converter=DEFAULT_CONVERTER,\n allow_unknown=DEFAULT_ALLOW_UNKNOWN,\n allow_multiple_aliases_for_field=DEFAULT_ALLOW_MULTIPLE_ALIASES_FOR_FIELD,\n ):\n if converter is None:\n converter = self.converter\n ret, __ = self.unalias(\n data,\n allow_unknown=allow_unknown,\n allow_multiple_aliases_for_field=allow_multiple_aliases_for_field,\n )\n # Allow for the existence of converters that don't return\n # {to_field: converted values} dicts, and instead simply return\n # converted values\n to_field = self.to_fields[0]\n try:\n converted = converter(**ret)\n except TypeError as error:\n if \"argument\" in str(error):\n argspec = getfullargspec(converter)\n raise TypeError(\n f\"Converter {converter.__name__} ({argspec.args}) rejected given args: {list(ret)}\"\n ) from error\n\n if not isinstance(converted, dict):\n return {to_field: converted}\n return converted\n\n\nclass OneToManyFieldMap(FieldMap):\n map_type = FieldMap.ONE_TO_MANY\n\n def __init__(\n self, from_field, to_fields, converter=DEFAULT_CONVERTER, explanation=None\n ):\n if isinstance(from_field, dict):\n from_fields = from_field\n else:\n from_fields = [from_field]\n super().__init__(\n from_fields=from_fields,\n to_fields=to_fields,\n converter=converter,\n explanation=explanation,\n )\n assert len(self.from_fields) == 1, \"Should only be one from field!\"\n self.from_field = self.from_fields[0]\n\n\nclass ManyToManyFieldMap(FieldMap):\n map_type = FieldMap.MANY_TO_MANY\n" }, { "alpha_fraction": 0.5212936401367188, "alphanum_fraction": 0.5212936401367188, "avg_line_length": 35.74117660522461, "blob_id": "b75c6ad77848e39d64f2383274c4f8de50ad68cc", "content_id": "1ed0e09427794c97d93f67575a915c74de44e336", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3123, "license_type": "permissive", "max_line_length": 94, "num_lines": 85, "path": "/django_import_data/management/commands/refresh_file_importers.py", "repo_name": "GreenBankObservatory/django-import-data", "src_encoding": "UTF-8", "text": "from os import isatty\nimport sys\n\nfrom django.core.management.base import BaseCommand\nfrom django.utils.timezone import datetime\n\nfrom django.db import transaction\n\nfrom django_import_data.models import FileImporter\n\n\ndef parse_date(date_str):\n return datetime.strptime(date_str, r\"%m/%d/%Y %H:%M:%S%z\")\n\n\nclass Command(BaseCommand):\n def add_arguments(self, parser):\n parser.add_argument(\"--paths\", nargs=\"+\")\n parser.add_argument(\"--no-progress\", action=\"store_true\")\n parser.add_argument(\"--always-hash\", action=\"store_true\")\n parser.add_argument(\"--quiet\", action=\"store_true\")\n parser.add_argument(\"--all\", action=\"store_true\")\n\n @transaction.atomic\n def handle(self, *args, **kwargs):\n paths = kwargs.get(\"paths\", None)\n quiet = kwargs.get(\"quiet\", False)\n refresh_all = kwargs.get(\"all\", False)\n no_progress = kwargs.get(\"no_progress\", False)\n\n file_importers = FileImporter.objects.none()\n if refresh_all:\n file_importers = FileImporter.objects.all()\n else:\n paths = paths if paths else []\n if not isatty(sys.stdin.fileno()):\n paths += [line.strip() for line in sys.stdin]\n\n if paths:\n file_importers = FileImporter.objects.filter(file_path__in=paths)\n\n if not quiet:\n paths_not_yet_imported = sorted(\n set(paths).difference(\n set(file_importers.values_list(\"file_path\", flat=True))\n )\n )\n\n if paths_not_yet_imported:\n print(\n \"The following recently-modified files do not have corresponding \"\n \"File Importers:\"\n )\n print(\" \" + \"\\n \".join(paths_not_yet_imported))\n\n paths_to_be_refreshed = sorted(\n set(paths).intersection(\n set(file_importers.values_list(\"file_path\", flat=True))\n )\n )\n\n if paths_to_be_refreshed:\n print(\"\\nThe following recently-modified files will be refreshed:\")\n print(\" \" + \"\\n \".join(paths_to_be_refreshed))\n else:\n if not quiet:\n print(\"No paths given!\")\n\n if not quiet:\n print(\"\\n\")\n if file_importers.count():\n print(\n f\"Refreshing {file_importers.count()} File Importers \"\n f\"from the filesystem\"\n )\n report = file_importers.refresh_from_filesystem(\n quiet=no_progress, always_hash=kwargs[\"always_hash\"]\n )\n\n for status, file_importers in report.items():\n if status in [\"changed\"]:\n the_paths = \"\\n\".join([fi.file_path for fi in file_importers])\n print(f\"{status}\\n{'-' * len(status)}\\n{the_paths}\\n\")\n elif not quiet:\n print(\"No file importers to refresh!\")\n" }, { "alpha_fraction": 0.6471163034439087, "alphanum_fraction": 0.6480938196182251, "avg_line_length": 33.099998474121094, "blob_id": "b2396144e0a956477a4f42a5fde947b4dbd8e80d", "content_id": "a3867997faf2b068acd38b1946915d6f4ab0dfb0", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1023, "license_type": "permissive", "max_line_length": 85, "num_lines": 30, "path": "/django_import_data/mermaid.py", "repo_name": "GreenBankObservatory/django-import-data", "src_encoding": "UTF-8", "text": "import uuid\n\nfrom django.template.loader import render_to_string\n\n\ndef render_field_map_as_mermaid(field_map, orientation=\"LR\", include_subgraphs=True):\n context = {\"field_map\": field_map, \"include_subgraphs\": include_subgraphs}\n if orientation:\n context[\"graph_type\"] = f\"graph {orientation}\"\n return render_to_string(\"field_map_as_mermaid.html\", context)\n\n\ndef render_form_map_as_mermaid(\n form_map, orientation=\"LR\", layout=\"columns\", include_subgraphs=True\n):\n context = {\n \"form_map\": form_map,\n \"uuid\": lambda: uuid.uuid4().hex,\n \"include_subgraphs\": include_subgraphs,\n }\n if orientation:\n context[\"graph_type\"] = f\"graph {orientation}\"\n if layout == \"columns\":\n return render_to_string(\"form_map_as_mermaid.html\", context)\n elif layout == \"rows\":\n return render_to_string(\"form_map_as_mermaid.html\", context)\n else:\n raise ValueError(\n f\"Invalid layout given: {layout}. Should be either 'rows' or 'columns'\"\n )\n" }, { "alpha_fraction": 0.6242038011550903, "alphanum_fraction": 0.6369426846504211, "avg_line_length": 16.33333396911621, "blob_id": "41683f85f5ba3d80e80564799eb3a20a6b8f2e9b", "content_id": "647f0bfafe6abf41fec2738d14973dbade64d301", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "HTML", "length_bytes": 157, "license_type": "permissive", "max_line_length": 64, "num_lines": 9, "path": "/django_import_data/templates/rowdata_list.html", "repo_name": "GreenBankObservatory/django-import-data", "src_encoding": "UTF-8", "text": "{% extends \"cases/base.html\" %}\n\n{% block content %}\n\n<h1>Row Audits</h1>\n\n{% include \"list_base.html\" with object_list=rowdata_list.all %}\n\n{% endblock %}\n\n" }, { "alpha_fraction": 0.5127478837966919, "alphanum_fraction": 0.600566565990448, "avg_line_length": 19.764705657958984, "blob_id": "cbcd63b9bd4f9661df1dd19c8fc41974780957f4", "content_id": "0478f3c8bd4203f238622e97f3b2f2f8f49180be", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 353, "license_type": "permissive", "max_line_length": 58, "num_lines": 17, "path": "/django_import_data/migrations/0018_remove_modelimportattempt_row_data.py", "repo_name": "GreenBankObservatory/django-import-data", "src_encoding": "UTF-8", "text": "# Generated by Django 2.2.2 on 2019-07-08 19:11\n\nfrom django.db import migrations\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('django_import_data', '0017_auto_20190708_1504'),\n ]\n\n operations = [\n migrations.RemoveField(\n model_name='modelimportattempt',\n name='row_data',\n ),\n ]\n" }, { "alpha_fraction": 0.5603280067443848, "alphanum_fraction": 0.5630612969398499, "avg_line_length": 26.244680404663086, "blob_id": "262d49e2929677da3c665f2d037f84cd3183f426", "content_id": "8538d4ec6e24d2e2c05b4022836aad619ad4d36e", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2561, "license_type": "permissive", "max_line_length": 75, "num_lines": 94, "path": "/example_project/importers/example_data_source/form_maps.py", "repo_name": "GreenBankObservatory/django-import-data", "src_encoding": "UTF-8", "text": "from django_import_data import (\n FormMap,\n ManyToOneFieldMap,\n OneToManyFieldMap,\n OneToOneFieldMap,\n ManyToManyFieldMap,\n)\nfrom cases.forms import CaseForm, PersonForm, StructureForm\n\n\ndef coerce_positive_int(value):\n num = int(value)\n if num < 1:\n return None\n\n return num\n\n\nclass PersonFormMap(FormMap):\n form_class = PersonForm\n\n def convert_first_name_middle_name_last_name(\n self, first_name, middle_name, last_name\n ):\n return \" \".join([first_name, middle_name, last_name])\n\n def convert_address(self, address):\n return dict(\n zip(\n [\"street\", \"city\", \"state\", \"zip\"],\n [p.strip() for p in address.split(\",\")],\n )\n )\n\n field_maps = [\n # n:1\n ManyToOneFieldMap(\n from_fields=(\"first_name\", \"middle_name\", \"last_name\"),\n converter=lambda first_name, middle_name, last_name: \" \".join(\n [first_name, middle_name, last_name]\n ),\n to_field=\"name\",\n ),\n # 1:n\n OneToManyFieldMap(\n from_field={\"address\": (\"address\", \"ADDR.\")},\n to_fields=(\"street\", \"city\", \"state\", \"zip\"),\n ),\n # 1:1\n OneToOneFieldMap(from_field={\"email\": \"E-mail\"}, to_field=\"email\"),\n OneToOneFieldMap({\"phone\": (\"phone\", \"phone_number\")}),\n ]\n\n\nclass CaseFormMap(FormMap):\n def convert_completed_type(self, completed, type):\n status = \"complete\" if completed else \"incomplete\"\n type_, subtype = type.split(\" \")\n return {\"status\": status, \"type\": type_, \"subtype\": subtype}\n\n def convert_case_num(self, case_num):\n ret = coerce_positive_int(case_num.strip(\"CASE#\"))\n return ret\n\n form_class = CaseForm\n field_maps = [\n # 1:1\n OneToOneFieldMap(\"case_num\", converter=\"convert_case_num\"),\n # n:n\n ManyToManyFieldMap(\n from_fields=(\"completed\", \"type\"),\n # converter=convert_type,\n to_fields=(\"status\", \"type\", \"subtype\"),\n ),\n ]\n\n\nclass StructureFormMap(FormMap):\n form_class = StructureForm\n field_maps = (\n ManyToOneFieldMap(\n from_fields=(\"latitude\", \"longitude\"),\n to_field=\"location\",\n converter=\"convert_location\",\n ),\n )\n\n def convert_location(self, latitude, longitude):\n return {\"location\": f\"({latitude}, {longitude})\"}\n\n\nCASE_FORM_MAP = CaseFormMap()\nPERSON_FORM_MAP = PersonFormMap()\nSTRUCTURE_FORM_MAP = StructureFormMap()\n" }, { "alpha_fraction": 0.5962616801261902, "alphanum_fraction": 0.607076108455658, "avg_line_length": 30.078838348388672, "blob_id": "d34c2d833e55ba7c656a53a08aaf63152a012a00", "content_id": "78039ab086c7c41c3fe84070871ad4c4a3911567", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 7492, "license_type": "permissive", "max_line_length": 87, "num_lines": 241, "path": "/django_import_data/utils.py", "repo_name": "GreenBankObservatory/django-import-data", "src_encoding": "UTF-8", "text": "from enum import Enum, EnumMeta\nimport hashlib\nimport os\nimport re\nfrom subprocess import CalledProcessError, check_output\n\nfrom django.core.serializers.json import DjangoJSONEncoder\nfrom django.contrib.gis.geos import Point\n\n\nclass FancyEnumMeta(EnumMeta):\n def __getitem__(cls, key):\n if isinstance(key, int):\n return list(cls)[key]\n try:\n return getattr(cls, key)\n except AttributeError as error:\n keys = [item.name for item in cls]\n raise KeyError(f\"Invalid key '{key}'. Choices are: {keys}\")\n\n\nclass OrderedEnum(Enum, metaclass=FancyEnumMeta):\n \"\"\"Enum where order of members matters\n\n Order is used to determine greater/lesser than comparisons. For example,\n the first item declared is lesser than the last item declared\"\"\"\n\n def __gt__(self, other):\n _list = list(self.__class__)\n return _list.index(self) > _list.index(other)\n\n @property\n def db_value(self):\n _list = list(self.__class__)\n return _list.index(self)\n\n @classmethod\n def as_choices(cls):\n return tuple((index, status.name) for index, status in enumerate(cls))\n\n @classmethod\n def as_filter_choices(cls):\n return tuple((index, status.value) for index, status in enumerate(cls))\n\n\nclass DjangoErrorJSONEncoder(DjangoJSONEncoder):\n def default(self, obj):\n from django.contrib.gis.db.backends.postgis.models import PostGISSpatialRefSys\n\n if isinstance(obj, Exception):\n return repr(obj)\n # GEOSGeometry isn't an error, but still should be serialized as a string\n if isinstance(obj, Point):\n return repr(obj.coords)\n if isinstance(obj, PostGISSpatialRefSys):\n return obj.srid\n\n return super().default(obj)\n\n\ndef to_fancy_str(iterable, quote=False):\n iterable_length = len(iterable)\n if quote:\n stringifier = lambda x: repr(str(x))\n else:\n stringifier = str\n if iterable_length == 0:\n return \"\"\n elif iterable_length == 1:\n return stringifier(list(iterable)[0])\n elif iterable_length == 2:\n return \" and \".join([stringifier(item) for item in iterable])\n else:\n l = [stringifier(item) for item in iterable]\n return f\"{', '.join(l[:-1])}, and {l[-1]}\"\n\n\ndef hash_file(path):\n sha1 = hashlib.sha1()\n with open(path, \"rb\") as file:\n while True:\n data = file.read(65536)\n if data:\n sha1.update(data)\n else:\n break\n return sha1.hexdigest()\n\n\n# Modified from: http://stackoverflow.com/a/323910/1883424\ndef itemAndNext(iterable):\n \"\"\"Generator to yield an item and the next item.\n\n Args:\n iterable: An iterable\n\n Returns:\n tuple: A tuple of the current item and the next item\"\"\"\n\n iterator = iter(iterable)\n item = next(iterator)\n for next_item in iterator:\n yield (item, next_item)\n item = next_item\n yield (item, None)\n\n\ndef make_list_of_ranges_from_nums(nums, prefix=None):\n \"\"\"Parse a list of numbers into a list of ranges.\n\n This is a helper function for get_str_from_nums(), and does all of the\n hard work of creating a list of ranges from a list of nums.\n\n Args:\n nums: A collection of numbers\n\n Returns:\n list: A list of length-2 tuples, with each tuple representing the\n min/max (inclusive) of a range.\n \"\"\"\n\n # Make sure they are sorted\n if not nums:\n return []\n nums = sorted(nums)\n ranges = []\n # The first range_start will be the first element of nums\n range_start = None\n for num, next_num in itemAndNext(nums):\n num = int(num)\n next_num = int(next_num) if next_num else None\n if not range_start:\n range_start = num\n\n if next_num is None or num + 1 != next_num:\n if prefix is not None:\n ranges.append((f\"{prefix}{range_start}\", f\"{prefix}{num}\"))\n else:\n ranges.append((range_start, num))\n range_start = None\n\n return ranges\n\n\ndef get_str_from_nums(nums, join_str=\", \", range_str=\"–\", prefix=None):\n \"\"\"Create a string representation of a series of number ranges given a\n list of numbers.\n\n Remember that the user's input string could be something ridiculous,\n such as '5-7,1-6', which yields [1,2,3,4,5,6,7] and\n should be represented as '1-7'.\n\n Args:\n nums: A collection of numbers\n join_str: An optional argument representing the string that will be\n used to join the series of ranges together\n\n Returns:\n str: String representation of a series of number ranges\n \"\"\"\n\n ranges_list = make_list_of_ranges_from_nums(nums, prefix=prefix)\n item_list = []\n\n for range_ in ranges_list:\n assert len(range_) == 2\n # Eliminate duplicates\n if range_[0] == range_[1]:\n item_list.append(str(range_[0]))\n # Use join_str if the second number is only one higher than the first\n elif range_[1] - range_[0] == 1:\n item_list.append(str(range_[0]) + join_str + str(range_[1]))\n # Otherwise, use the range_str to represent a range of ints\n else:\n item_list.append(str(range_[0]) + range_str + str(range_[1]))\n\n return join_str.join(item_list)\n\n\n# Adapted from: https://gist.github.com/thatalextaylor/7408395\ndef humanize_timedelta(td):\n seconds = td.total_seconds()\n sign_string = \"-\" if seconds < 0 else \"\"\n seconds = abs(int(seconds))\n days, seconds = divmod(seconds, 86400)\n hours, seconds = divmod(seconds, 3600)\n minutes, seconds = divmod(seconds, 60)\n if days > 0:\n return f\"{sign_string}{days}d{hours}h{minutes}m{seconds}s\"\n elif hours > 0:\n return f\"{sign_string}{hours}h{minutes}m{seconds}s\"\n elif minutes > 0:\n return f\"{sign_string}{minutes}m{seconds}s\"\n else:\n return f\"{sign_string}{seconds}s\"\n\n\ndef determine_files_to_process_slow(paths, pattern=None):\n \"\"\"Find all files in given paths that match given pattern; sort and return\"\"\"\n if isinstance(paths, str):\n paths = [paths]\n if pattern:\n pattern = re.compile(pattern)\n matched_files = []\n for path in paths:\n if os.path.isfile(path):\n matched_files.append(path)\n elif os.path.isdir(path):\n for root, dirs, files in os.walk(path):\n matched_files.extend(\n [\n os.path.join(path, root, file)\n for file in files\n if not pattern or pattern.match(file)\n ]\n )\n else:\n raise ValueError(f\"Given path {path!r} is not a directory or file!\")\n\n return sorted(matched_files)\n\n\n# Roughly 2.5x faster!\ndef determine_files_to_process(paths, pattern=None, maxdepth=2):\n if isinstance(paths, str):\n paths = [paths]\n cmd = [\"find\", *paths]\n if maxdepth is not None:\n cmd += [\"-maxdepth\", \"2\"]\n cmd += [\"-type\", \"f\"]\n if pattern:\n cmd += [\"-regextype\", \"posix-extended\", \"-regex\", pattern]\n\n try:\n return sorted(check_output(cmd).decode(\"utf-8\").splitlines())\n except CalledProcessError as error:\n print(\n \"WARNING: Falling back to determine_files_to_process_slow due to error in \"\n f\"determine_files_to_process:\\n{error}\"\n )\n return determine_files_to_process_slow(paths, pattern)\n" }, { "alpha_fraction": 0.6664746403694153, "alphanum_fraction": 0.6820276379585266, "avg_line_length": 31.148147583007812, "blob_id": "bf5fd78209a7afddd5849f50fc9d36f6c531f95b", "content_id": "405e48ede1063751ac7d3eccf6132f2337f7ac9e", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1736, "license_type": "permissive", "max_line_length": 88, "num_lines": 54, "path": "/example_project/cases/models.py", "repo_name": "GreenBankObservatory/django-import-data", "src_encoding": "UTF-8", "text": "from django.db import models\nfrom django.urls import reverse\n\nfrom django_import_data.models import (\n AbstractBaseAuditedModel,\n AbstractBaseModelImportAttempt,\n)\n\n\nclass Person(AbstractBaseAuditedModel):\n name = models.CharField(max_length=256, blank=True)\n phone = models.CharField(max_length=256, blank=True)\n email = models.EmailField(null=True, blank=True)\n city = models.CharField(max_length=256, blank=True)\n street = models.CharField(max_length=256, blank=True)\n zip = models.CharField(max_length=256, blank=True)\n state = models.CharField(max_length=256, blank=True)\n\n def __str__(self):\n return f\"{self.name}; {self.phone}; {self.email}\"\n\n def get_absolute_url(self):\n return reverse(\"person_detail\", args=[str(self.id)])\n\n\nclass Case(AbstractBaseAuditedModel):\n case_num = models.PositiveIntegerField()\n applicant = models.ForeignKey(\n \"Person\", on_delete=models.CASCADE, null=True, blank=True\n )\n structure = models.ForeignKey(\n \"Structure\", on_delete=models.CASCADE, null=True, blank=True\n )\n status = models.CharField(\n choices=((\"incomplete\", \"incomplete\"), (\"complete\", \"complete\")), max_length=256\n )\n type = models.CharField(max_length=256, blank=True)\n subtype = models.PositiveIntegerField(blank=True)\n\n def __str__(self):\n return f\"#{self.case_num} ({self.applicant})\"\n\n def get_absolute_url(self):\n return reverse(\"case_detail\", args=[str(self.id)])\n\n\nclass Structure(AbstractBaseAuditedModel):\n location = models.CharField(max_length=256)\n\n def __str__(self):\n return str(self.location)\n\n def get_absolute_url(self):\n return reverse(\"structure_detail\", args=[str(self.id)])\n" }, { "alpha_fraction": 0.5817757248878479, "alphanum_fraction": 0.6191588640213013, "avg_line_length": 29.571428298950195, "blob_id": "3068a66dcc832a81664eeb3891bd9f9546a6ebb4", "content_id": "dde681f3da27763e58c61ea73cf7dc7cf05a4708", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 856, "license_type": "permissive", "max_line_length": 173, "num_lines": 28, "path": "/django_import_data/migrations/0013_auto_20190705_1409.py", "repo_name": "GreenBankObservatory/django-import-data", "src_encoding": "UTF-8", "text": "# Generated by Django 2.2.2 on 2019-07-05 18:09\n\nfrom django.db import migrations, models\nimport django.db.models.deletion\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('django_import_data', '0012_auto_20190705_1356'),\n ]\n\n operations = [\n migrations.RenameModel(\n old_name='FileImportBatch',\n new_name='FileImporterBatch',\n ),\n migrations.RemoveField(\n model_name='fileimportattempt',\n name='file_import_batch',\n ),\n migrations.AddField(\n model_name='fileimporter',\n name='file_importer_batch',\n field=models.ForeignKey(default=-1, on_delete=django.db.models.deletion.CASCADE, related_name='file_import_attempts', to='django_import_data.FileImporterBatch'),\n preserve_default=False,\n ),\n ]\n" }, { "alpha_fraction": 0.7363013625144958, "alphanum_fraction": 0.7363013625144958, "avg_line_length": 24.234567642211914, "blob_id": "3c9ff9f0e59cbde2018cdf6d5487ab29a31ba8ce", "content_id": "2de44fa61fe7a09328106f2a6956fd916618d8d7", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2044, "license_type": "permissive", "max_line_length": 72, "num_lines": 81, "path": "/example_project/cases/views.py", "repo_name": "GreenBankObservatory/django-import-data", "src_encoding": "UTF-8", "text": "from django.urls import reverse\nfrom django.views.generic import CreateView\nfrom django.views.generic.base import RedirectView\nfrom django.views.generic.detail import DetailView\nfrom django.views.generic.list import ListView\n\nfrom django_import_data.views import CreateFromImportAttemptView\n\nfrom .models import Person, Case, Structure\nfrom .forms import PersonForm, CaseForm, StructureForm\n\n\nclass PersonDetailView(DetailView):\n model = Person\n template_name = \"cases/generic_detail.html\"\n\n\nclass CaseDetailView(DetailView):\n model = Case\n template_name = \"cases/generic_detail.html\"\n\n\nclass StructureDetailView(DetailView):\n model = Structure\n template_name = \"cases/generic_detail.html\"\n\n\nclass PersonListView(ListView):\n model = Person\n template_name = \"cases/generic_list.html\"\n\n\nclass CaseListView(ListView):\n model = Case\n template_name = \"cases/generic_list.html\"\n\n\nclass StructureListView(ListView):\n model = Structure\n template_name = \"cases/generic_list.html\"\n\n\nclass PersonCreateView(CreateView):\n # model = Person\n form_class = PersonForm\n\n\nclass PersonCreateFromImportAttemptView(CreateFromImportAttemptView):\n model = Person\n form_class = PersonForm\n template_name = \"cases/generic_form.html\"\n\n\nclass CaseCreateView(CreateView):\n # model = Case\n form_class = CaseForm\n\n\nclass CaseCreateFromImportAttemptView(CreateFromImportAttemptView):\n model = Case\n form_class = CaseForm\n template_name = \"cases/generic_form.html\"\n\n\nclass StructureDetailView(DetailView):\n model = Structure\n\n\nclass StructureCreateFromImportAttemptView(CreateFromImportAttemptView):\n model = Structure\n form_class = StructureForm\n template_name = \"cases/generic_form.html\"\n\n\nclass CreateFromAuditRedirectView(RedirectView):\n def get_redirect_url(self, *args, **kwargs):\n return reverse(\n f\"{kwargs['model']}_create_from_audit\",\n kwargs={\"audit_pk\": kwargs.get(\"audit_pk\", None)},\n )\n # return super().get_redirect_url(*args, **kwargs)\n" } ]
53
TaraBC/mazeGame
https://github.com/TaraBC/mazeGame
27823741d113f11baf169401bcc7d02563efb11c
ca3694ba9411a4fd9c76600d6259dcc0079d3be5
08916c58d244a30a57381ed8d06a579f63532624
refs/heads/master
2022-02-03T20:27:08.116723
2019-07-22T09:51:25
2019-07-22T09:51:25
198,192,429
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.4709489643573761, "alphanum_fraction": 0.48945146799087524, "avg_line_length": 93.39250183105469, "blob_id": "41a667ea0fee074241c9d777848250891d852cbb", "content_id": "e001769dc570154a94cc8dd9d8148141960c3dab", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 38157, "license_type": "no_license", "max_line_length": 238, "num_lines": 400, "path": "/Maze/maze.py", "repo_name": "TaraBC/mazeGame", "src_encoding": "UTF-8", "text": "import pygame\r\nimport os\r\n\r\n\r\n#IMPORTANT PYGAME/GENERAL CONCEPTS:\r\n#SURFACE OBJECTS - a surface of set width and height which can have things drawn onto it, then drawn onto other surfaces or the screen\r\n#RECT OBJECTS - an object defining a rectangular area, x and y coordinates of rect object and width and height of rect object required\r\n#PYGAME.DISPLAY.FLIP() - updates the entire display\r\n#FONT OBJECTS - Object specifically for making text using specific fonts\r\n#BLIT - Draws one surface onto another surface\r\n#ANTIALIASING - 'smoothing down' jagged edges on images. Reduces program speed.\r\n#EVENTS - events are for getting the os events/queues such as if keys are pressed/if the mouse is clicked.\r\n#CLOCK OBJECTS - monitors time within the game.\r\n\r\n# MISC ATTRIBUTES\r\n\r\nclass colours: # library of colours in rgb\r\n white = [255, 255, 255]\r\n black = [0, 0, 0]\r\n buttonBlue = [124, 176, 255]\r\n buttonDarkC = [89, 103, 181]\r\n space = [29, 41, 81]\r\n crimson = [220,20,60]\r\n\r\n\r\n# END OF MISC ATTRIBUTES\r\n\r\n# BASIC DISPLAY ATTRIBUTES\r\n\r\nclass mainDisplay: # defines the mainDisplay\r\n\r\n def __init__(self): #initialize self\r\n self.screenDisplay = pygame.display.set_mode(\r\n [1200, 720]) # creates the game window as a 1200x720px surface object\r\n pygame.display.set_caption(\"Maze\") # set window name as 'maze'\r\n self.edges = self.screenDisplay.get_rect() #sets the class variable 'edges' as the rect object created from the screenDisplay surface\r\n\r\nclass button: #class for drawing a rectangle with text in the centre\r\n def __init__(self, x, y, width, height, text, fontSize, buttonColour, borderColour, fontColour,textX,textY): #Initialize button with parameters x,y,width,height,text,font,fontSize,buttonColour,borderColour,fontColour,Display\r\n #(display surface to be drawn onto),xratio and yratio (ratios of text to centre - inefficient but explained later)\r\n\r\n #SETS INITIAL ATTRIBUTES\r\n self.x = x #sets class attribute 'x' as the x input when button is initialized\r\n self.y = y #sets class attribute 'y' as the y input when button is initialized\r\n self.width = width #sets class attribute 'width' as the width input when the button is initialized\r\n self.height = height #sets class attribute 'height' as the height input when the button is initialized\r\n #SETS BORDER OF BUTTON\r\n self.buttonBorder = pygame.Rect(self.x, self.y, self.width, self.height) #defines the button border as a rect object with the predefined x,y,\r\n #width and height attributes\r\n self.colour = buttonColour #defines colour attribute\r\n self.bordercolour = borderColour #and border colour attribute\r\n self.textx = textX #sets buttons text coordinates\r\n self.texty = textY\r\n #SETS TEXT SURFACE IN BOX\r\n textFont = pygame.font.SysFont('Candara', fontSize) #sets the font of the text to the font established at definition of initialisation\r\n self.textSurface = textFont.render(text, False, fontColour, #Creates a font object using the font, font colour and text established\r\n None) #Sets antialiasing to false and gives no background to text\r\n def drawButton(self,Display):\r\n pygame.draw.rect(Display.screenDisplay, self.colour, self.buttonBorder,\r\n 0) # draws the buttonBorder as a filled in rectangle onto the\r\n # screenDisplay surface of the Display parameter passed on initialisation\r\n # with button colour defined at initialisation\r\n pygame.draw.rect(Display.screenDisplay, self.bordercolour, self.buttonBorder,\r\n 10) # draws the buttonBorder as a border with a width of 10px and the\r\n # border colour defined at intialisation definition\r\n Display.screenDisplay.blit(self.textSurface, (self.textx,self.texty)) # blits text onto screen\r\n pygame.display.flip() # updates entire display\r\n\r\nclass text: #creates text class for creating and blitting text to screen\r\n def __init__(self, x, y, fontSize, fontColour, text, Display): #Initialize text class with x coordinate, y coordinate, font, fontSize, fontColour,text used and\r\n #Display to blit\r\n textFont = pygame.font.SysFont('Candara', fontSize) #defines font of text as a system font with font and fontSize as defined upon initialisation passing\r\n textSurface = textFont.render(text, False, fontColour, None) #creates surface of text with text defined previously, font defined previously and font colour defined\r\n #previously. antialiasing is set to false and there is no background for text\r\n Display.screenDisplay.blit(textSurface, (x, y)) #blits text onto screenDisplay using predefined x and y coordinates\r\n pygame.display.flip() #updates full display\r\n\r\n\r\n# END OF BASIC DISPLAY ATTRIBUTES\r\n\r\n# FIRST SCREEN CODE\r\n\r\n\r\ndef firstScreen(Display): #Function to create the 'look' of the main menu, using Display parameter\r\n Display.screenDisplay.fill(colours.black) #Clear display by setting display to black\r\n title = text((1200/24)*10, ((720 / 20) * 2), 96, colours.buttonDarkC, 'Maze', Display) #title becomes a 'text' object, with x coordinate 10/24 of screen\r\n #y coordinate 2/20 of screen, font 'Candara', font size 96px,\r\n #font colour is dark blue, text is 'Maze' and Display parameter used\r\n\r\n startButton = button(((1200 / 24) * 4), ((720 / 20) * 5), ((1200 / 24) * 16), (720 / 20)*2, \"START\", 48, #startButton becomes a 'button' object with x coordinate 2/12 of screen\r\n colours.buttonBlue, colours.buttonBlue, colours.buttonDarkC, #y coordinate is 5/20 of screen. width is 8/12 of screen, height is\r\n (1200/48)*21,(720/40)*11) #1/10 of screen, text is 'START', font is 'Candara', font size is\r\n startButton.drawButton(Display) #48px, colours defined by blue, blue and dark blue. text is centred\r\n\r\n continueButton = button(((1200 / 24) * 6), ((720 / 20) * 8), ((1200 / 24) * 12), (720 / 10), \"Continue\", #continueButton becomes a 'button' object with x coordinate 3/12 of\r\n 36, colours.buttonBlue, colours.buttonBlue, colours.buttonDarkC,\r\n (1200/48)*21,(720/40)*17) #screen, y coordinate 8/20 of screen, same height width and font\r\n continueButton.drawButton(Display) #as start button\r\n #text = 'continue', font size is 36px\r\n #colours are blue, blue and dark blue, text is centred\r\n\r\n quitButton = button(((1200 / 12) * 3), ((720 / 20) * 11), ((1200 / 12) * 6), (720 / 10), \"Quit\", 36, #quitButton becomes a 'button' object with same x coordinate,\r\n colours.buttonBlue, colours.buttonBlue, colours.buttonDarkC, (1200/48)*22,(720/40)*23) #width, height, font, font size and colours as continue button.\r\n quitButton.drawButton(Display)\r\n #x ratio is 0.97 and y ratio is 0.95\r\n\r\n mainMenu(quitButton, startButton, continueButton, Display) #calls the main menu function with quitButton, startButton,\r\n #continueButton, Display parameter. This makes the above buttons\r\n #clickable to start the game, continue a previous save or quit.\r\n\r\n\r\ndef mainMenu(quit_button, start_button, continue_button,Display): #mainMenu makes menu clickable to star game, quit game or continue game\r\n mainMenu = True #sets mainMenu to true to start while loop\r\n while mainMenu: #while mainMenu is true\r\n for evento in pygame.event.get(): #for every 'event' that happens\r\n if evento.type == pygame.MOUSEBUTTONDOWN: #if the event is the mouse being clicked\r\n if quit_button.buttonBorder.collidepoint(pygame.mouse.get_pos()): #and if the mouse pointer is within the border of the quit button\r\n pygame.quit() #quit the game\r\n quit()\r\n elif start_button.buttonBorder.collidepoint(pygame.mouse.get_pos()): #or if the mouse pointer is within the border of the start button\r\n mainMenu = False #stop the main menu loop\r\n player = mainSprite(1) #set the player to a mainSprite object, the maze being used is the\r\n #first maze, hence 1\r\n mainGame(Display,1,player,False,SpriteClock) #start mainGame function with Display, first maze is 1, player is\r\n #player object, loading is False (game is not loading), use spriteClock\r\n #to track time. This starts the main Game (see L305)\r\n\r\n elif continue_button.buttonBorder.collidepoint(pygame.mouse.get_pos()): #or if the mouse pointer is within the border of the continue button\r\n if os.path.isfile('./sav.txt'): #if sav.txt exists within the current folder of the program\r\n loadGame(Display) #call load game function with Display (see L342)\r\n mainMenu = False #set mainMenu to false to stop menu loop and move onto game\r\n else: #if save file does not exist\r\n errorMessage = button((1200 / 20) * 4, (720 / 20) * 8, (1200 / 20) * 12, (720 / 20) * 2, #produce an error message which says 'No save file available'\r\n 'No Save file available', 36, colours.buttonDarkC, #in front of the continue button\r\n colours.space, colours.space,(1200/20)*7,(720/40)*17)\r\n errorMessage.drawButton(Display)\r\n\r\n#END OF FIRST SCREEN\r\n\r\n\r\n#MAZE GENERATOR\r\n\r\n\r\nclass maze: #defines class 'maze'\r\n def __init__(self,row,column,mazeID): #defines initialisation with number of rows, columns and the mazeID\r\n self.mazeNo = mazeID #defines mazeNo of maze class as given mazeID parameter\r\n self.rows = row #defines rows of maze class as given row parameter\r\n self.columns = column #defines columns of maze class as given column parameter\r\n self.boxWidth = 1200/self.columns #defines boxWidth for maze class as the width of the screen divided by number of columns\r\n self.boxHeight = 720/self.rows #defines boxHeight for maze class as the height of the screen divided by number of rows\r\n self.unrendered = [[]] #defines unrendered for maze class as an empty 2D array, in future to be defined as the unrendered map of boxes for the maze.\r\n\r\n def drawMaze(self,Display): #defines method 'drawMaze' with parameter 'Display'\r\n bx = 0 #defines box x coordinate initially as 0\r\n by = 0 #defines box y coordinate as initially 0\r\n Display.screenDisplay.fill(colours.black) #fills screen with black\r\n self.boxList = [] #creates an empty box list attribute for maze\r\n for i in range(0,len(self.unrendered)): #for every index between 0 and the length of the unrendered\r\n for index in range(0,len(self.unrendered[i])): #for every index between 0 and the length of the current element in 2D array\r\n #defined above\r\n if self.unrendered[i][index] == 1: #if the current element is equal to '1'\r\n self.currentBox = pygame.Rect(bx,by,self.boxWidth,self.boxHeight) #define a Rect object with the current box x coordinate, y coordinate and boxWidth\r\n # /height\r\n self.boxList.append(self.currentBox) #append the currentBox rect object to the boxlist in order to create a list of\r\n #where boxes are and their details.\r\n pygame.draw.rect(Display.screenDisplay, colours.buttonBlue, self.currentBox, 0) #draw the currentBox in blue onto the screen\r\n pygame.draw.rect(Display.screenDisplay,colours.buttonDarkC,self.currentBox,5) #draw a 5px border on the currentBox\r\n bx += self.boxWidth #updates current box x coordinate to the coordinate of the next 'column' of boxes.\r\n bx = 0 #when moving onto next element, reset current box x coordinate to zero\r\n by += self.boxHeight #and update y coordinate to the coordinate of the next 'row' of boxes\r\n pygame.display.flip() #Once maze has been rendered, update entire display\r\n#END OF MAZE GENERATOR\r\n\r\n\r\n#PLAYER CODE\r\nclass mainSprite: #defines class of 'mainSprite' for main player\r\n def __init__(self,mazeno): #defines initialisation and uses mazeno parameter to define the maze number sprite will spawn in\r\n self.x = 0 #defines sprites x coordinate as initially 0\r\n self.y = 0 #defines sprites y coordinate as initially 0\r\n self.mazeused = '' #defines mazeused as empty, as it will be defined after an instance of mainSprite has been created\r\n self.mazeno = mazeno #defines sprites mazeno as passed mazeno\r\n self.speedX = 10 #defines the speed of the sprite in the x direction as 10px\r\n self.speedY = (720/10)/8 #defines the speed of the sprite in the y direction as the height of the screen divided by 10 divided by 8\r\n self.spawnX = 0 #defines the spawn x coordinate as initially 0\r\n self.spawnY = 0 #defines the spawn y coordinate as initially 0\r\n self.currentX = 0 #'current' x and y coordinates are defined for the purposes of recursion later. Current X really means the current box the sprite is in\r\n self.currentY = 0 #current Y really means the current box the sprite is in. ACTUAL current 'x' and 'y' coordinates are defined in the sprites 'x' and 'y' attributes\r\n\r\n def collisionDetection(self,expectedX,expectedY,mazeused): #defines a function which will return true if it collides with something and false if it doesnt\r\n temporaryRect = pygame.Rect(expectedX,expectedY,self.width,self.height) #creates a temporary rect for the expected location of the sprite\r\n if temporaryRect.collidelistall(mazeused.boxList) == []: #if the temporary rect doesnt collide with any of the boxes on the current maze\r\n return False #return false\r\n else: #if it does collide with anything\r\n return True #return True\r\n\r\n def win(self,screenRectangle): #defines the function for the sprite winning\r\n if screenRectangle.contains(self.playerRect) == False: #if the sprite touches the edge of the screen\r\n return True #return True\r\n\r\n def rectAnimate(self,clock,Display): #Defines animation of the sprite, using a clock object and screen Display\r\n pygame.draw.rect(Display.screenDisplay,colours.black,self.playerRect) #fills in the current player rect object with black to prevent the new frame of sprite animation\r\n #overlapping the old one\r\n self.playerRect = pygame.Rect(self.x,self.y,self.width,self.height) #defines new player rect as the current x coordinate, y coordinate, width and height\r\n pygame.draw.rect(Display.screenDisplay,colours.crimson,self.playerRect) #draw the new frame of sprite animation in crimson onto screen\r\n pygame.display.flip() #update the full screen display\r\n currentTime = pygame.time.get_ticks() #get current ticks of the clock passed to the function\r\n clock.tick(10) #update the number of ticks by 10, to wait for 10ms.\r\n\r\n def moveRight(self,expected,mazeused,Display): #defines the way the sprite moves right\r\n if self.collisionDetection(expected,self.y,mazeused) == False: #if the sprite does not collide with any of the boxes in the maze used\r\n self.x = self.x + self.speedX #update the sprites x coordinate to 10px further than current x coordinate\r\n self.rectAnimate(SpriteClock,Display) #animate the sprite so you can see this x coordinate update on the screen\r\n if self.x != expected: #if the x coordinate is not yet what was expected\r\n self.moveRight((self.currentX+(1200/mazeused.columns)),mazeused,Display) #recur the function, passing the expected x value as being the currentX + the boxwidth of the maze\r\n else: #otherwise\r\n self.currentX = self.x #set the current x to the current x coordinate and stop the sprite moving.\r\n\r\n def moveLeft(self,expected,mazeused,Display): #defines the way the sprite moves left\r\n if self.collisionDetection(expected,self.y,mazeused) == False: #this function works the same as the moveRight function, except expected x coordinate is\r\n self.x = self.x-self.speedX #currentX - the boxWidth and x coordinate is updated to x coordinate - the speed of the sprite\r\n self.rectAnimate(SpriteClock,Display)\r\n if self.x != expected:\r\n self.moveLeft((self.currentX-(1200/mazeused.columns)),mazeused,Display)\r\n else:\r\n self.currentX = self.x\r\n\r\n def moveUp(self,expected,mazeused,Display): #defines the way the sprite moves up\r\n if self.collisionDetection(self.x,expected,mazeused) == False: #collision works the same as previous movement functions\r\n self.y = self.y-self.speedY #update y coordinate to y coordinate - speed of sprite\r\n self.rectAnimate(SpriteClock,Display) #movement works the same as other movement functions except with y coordinates\r\n if self.y != expected:\r\n self.moveUp((self.currentY-(720/mazeused.rows)),mazeused,Display)\r\n else:\r\n self.currentY = self.y\r\n\r\n def moveDown(self,expected,mazeused,Display): #defines the way the sprite moves down\r\n if self.collisionDetection(self.x,expected,mazeused) == False: #movement works the same as moveUp except y coordinate updates by +speed not -speed\r\n self.y = self.y +self.speedY\r\n self.rectAnimate(SpriteClock,Display)\r\n if self.y != expected:\r\n self.moveDown(self.currentY+(720/mazeused.rows),mazeused,Display)\r\n else:\r\n self.currentY = self.y\r\n\r\n def spawn(self,Display): #defines spawning the sprite\r\n self.width = self.mazeused.boxWidth-20 #defines the width of the sprite as the width of the maze boxes -20\r\n self.height = self.mazeused.boxHeight -20 #defines the height of the sprite as the height of the maze boxes -20\r\n self.currentX = self.x #defines currentX as the x coordinate of the sprite\r\n self.currentY = self.y #defines currentY as the y coordinate of the sprite\r\n self.playerRect = pygame.Rect(self.x, self.y, self.width, self.height) #creates the playerRect as a rect object with x coordinate, y coordinate, width and height\r\n pygame.draw.rect(Display.screenDisplay, colours.crimson, self.playerRect) #draw the playerRect onto the screenDisplay\r\n pygame.display.flip() #update entire screen\r\n\r\n\r\n#END OF PLAYER CODE\r\n\r\nclass mazeone(maze): #defines a subclass of the maze class called 'mazeone'\r\n def __init__(self): #initialize self\r\n super().__init__(10,10,1) #initializes superclass with 10 rows, 10 columns and the ID of 1\r\n self.unrendered = [[1,1,1,1,1,1,1,1,1,1], #defines unrendered as a 10 by 10 2D array\r\n [1,0,0,0,0,0,0,0,1,1],\r\n [1,0,1,1,1,0,1,0,1,1],\r\n [1,0,1,0,0,0,1,0,0,1],\r\n [1,0,0,1,0,1,1,1,1,1],\r\n [1,1,1,1,0,0,0,0,0,1],\r\n [1,0,0,0,1,1,1,0,1,1],\r\n [1,0,1,0,1,1,1,0,1,1],\r\n [1,0,1,0,0,0,0,0,0,1],\r\n [1,0,1,1,1,1,1,1,1,1]]\r\n\r\n#START OF MAIN GAME\r\n\r\n\r\nSpriteClock = pygame.time.Clock() #creates a clock called 'SpriteClock'\r\n\r\n\r\ndef keys(Display,mazeused,playerused,menuused): #define the keys function in order to define events that happen when certain keys are\r\n #pressed, with parameters of a maze, player and menu\r\n for event2 in pygame.event.get(): #for every event that happens\r\n if event2.type == pygame.KEYDOWN: #if the event is that a key is pressed\r\n if event2.key == pygame.K_RIGHT: #if the key is the right arrow key\r\n playerused.moveRight(playerused.currentX+(1200/mazeused.columns),mazeused,Display) #have the player move right by one square\r\n elif event2.key == pygame.K_LEFT: #else if the key pressed is the left arrow key\r\n playerused.moveLeft(playerused.currentX-(1200/mazeused.columns),mazeused,Display) #have the player move left by one square\r\n elif event2.key == pygame.K_UP: #else if the key pressed is the up arrow key\r\n playerused.moveUp(playerused.currentY-(720/mazeused.rows),mazeused,Display) #have the player move up by one square\r\n elif event2.key == pygame.K_DOWN: #else if the key pressed is the down arrow key\r\n playerused.moveDown(playerused.currentY+(720/mazeused.rows),mazeused,Display) #have the player move down by one square\r\n elif event2.key == pygame.K_ESCAPE: #else if the key pressed is the escape key\r\n menuused.open(Display) #open the esc menu\r\n while menuused.escMenu == True: #while the menu is open\r\n for event3 in pygame.event.get(): #for every event that happens\r\n if event3.type == pygame.KEYDOWN: # if the escape key is pressed\r\n if event3.key == pygame.K_ESCAPE:\r\n menuused.close(Display,mazeused,playerused) #close the menu\r\n elif event3.type == pygame.MOUSEBUTTONDOWN: #if the mouse is clicked\r\n if menuused.quitButton2.buttonBorder.collidepoint(pygame.mouse.get_pos()): #if the quit button is clicked, go back to first screen\r\n firstScreen(Display)\r\n elif menuused.saveButton.buttonBorder.collidepoint(pygame.mouse.get_pos()): #if the save button is clicked, save the game\r\n saveGame(mazeused,playerused)\r\n\r\n\r\ndef mainGame(display,currentMaze,currentPlayer,loading,clock): #combines the maze and player to create a game\r\n menu = inGameMenu() #creates an object called menu which is an inGameMenu\r\n Maze1 = mazeone() #makes Maze1, which is a mazeone object\r\n maze1bool = False #sets maze1bool to False initially\r\n\r\n if loading == True: #if the game has been loaded using a save file\r\n if currentMaze == 1: #if the currentMaze Id is 1\r\n maze1bool = True #set the maze1bool to true to let the program know the current maze being used is the first\r\n currentPlayer.mazeused = Maze1 #set the mazeused by the player to Maze1\r\n Maze1.drawMaze(display) #draw maze 1\r\n currentPlayer.spawn(display) #spawn the player into the maze\r\n\r\n elif loading == False: #else if the game has not been loaded using a save file\r\n maze1bool = True #set maze1bool to true for same reason as before\r\n currentPlayer.x = ((1200/10)*1)+10 #set the players coordinates to the first empty space in maze 1\r\n currentPlayer.y = ((720/10)*1)+10\r\n currentPlayer.mazeused = Maze1 #set mazeused by the player to Maze1\r\n Maze1.drawMaze(display) #draw maze1\r\n currentPlayer.spawn(display) #spawn the player into the maze\r\n\r\n while maze1bool: #while the maze1bool is set to true\r\n keys(display,Maze1,currentPlayer,menu) #set the keys and the events associated with those keys\r\n if currentPlayer.win(display.edges): #if the player wins (touches the edge)\r\n display.screenDisplay.fill(colours.black) #fill the display with black\r\n winningText = text((1200/25)*10, (720/20)*9,76, colours.white, \"You win!\", display) #put a text saying you win! on the screen\r\n currentTime = pygame.time.get_ticks() #get the current time\r\n clock.tick(1) #wait for a few seconds\r\n maze1bool = False #break the loop\r\n firstScreen(display) #bring back to the firstScreen\r\n\r\n\r\n#SAVE GAME\r\n\r\n\r\ndef saveGame(mazeused,playerused): #define function to save the game by collecting data from the current maze and current player\r\n saveFile = open('sav.txt','w') #open the new save file called 'sav.txt'. If there is another save file, this replaces it\r\n saveFile.writelines([str(mazeused.mazeNo)+\"\\n\",str(playerused.x)+\"\\n\",str(playerused.y)+\"\\n\"]) #write the maze ID and player coordinates to the file\r\n saveFile.close() #close the file\r\n\r\n\r\n#LOAD GAME\r\n\r\n\r\ndef loadGame(Display): #define function to load the game by reading 'sav.txt'\r\n saveFile = open('sav.txt','r') #open sav.txt\r\n data = [] #create an empty array called 'data'\r\n for line in saveFile.readlines(): #append each line of data in the sav.txt array\r\n data.append(line)\r\n for number in range(len(data)): #remove the formatting ('\\n') from each element of data\r\n data[number] = data[number].replace('\\n','')\r\n playerL = mainSprite(int(data[0])) #create a player object which uses the maze ID supplied by the save data\r\n playerL.x = float(data[1]) #coordinate of player object is the x and y coordinate supplied by the save data\r\n playerL.y = float(data[2])\r\n saveFile.close() #close the file\r\n mainGame(Display,int(data[0]),playerL,True,SpriteClock) #start the main game with the new data transferred to the player and the maze, with loading = True\r\n\r\n\r\nclass inGameMenu: #creates an ingame menu class\r\n def __init__(self): # initialisation\r\n self.MenuBorder = pygame.Rect((1200/25)*9, (720/20)*7, (1200/25)*7, (720/20)*7) #creates a rect object with x coordinate = 9/25 of the screen, y coordinate = 7/20 of the screen\r\n #width = 7/25 of the screen, height = 7/20 of the screen\r\n self.escMenu = False #set escMenu to initially false\r\n\r\n def open(self,Display): #define method 'open' to open the esc menu\r\n self.escMenu = True #set escMenu to True to define the esc menu as opening\r\n pygame.draw.rect(Display.screenDisplay,colours.buttonDarkC,self.MenuBorder) #draws the menu border and menu fill onto screen\r\n pygame.draw.rect(Display.screenDisplay,colours.space,self.MenuBorder,5)\r\n self.saveButton = button((1200/25)*10, (720/20)*8, (1200/25)*5, (720/20)*2,\"SAVE\" , 38, colours.buttonBlue, #creates the save and quit button on the menu\r\n colours.space, colours.buttonDarkC,(1200/48)*22,(720/40)*17)\r\n self.saveButton.drawButton(Display)\r\n self.quitButton2 = button((1200/25)*10,(720/20)*11,(1200/25)*5,(720/20)*2,\"QUIT\",38,colours.buttonBlue,colours.space,colours.buttonDarkC,(1200/48)*22,(720/40)*23)\r\n self.quitButton2.drawButton(Display)\r\n pygame.display.flip() #update the display fully\r\n\r\n def close(self,Display,mazeused,playerused): #define method 'close' to close the esc menu\r\n self.escMenu = False #set escMenu to false to define the esc menu as closing\r\n pygame.draw.rect(Display.screenDisplay,colours.black,self.MenuBorder) #cover over the menu with black\r\n pygame.draw.rect(Display.screenDisplay,colours.black,self.MenuBorder,5)\r\n mazeused.drawMaze(Display) #draw the maze over the black\r\n pygame.draw.rect(Display.screenDisplay,colours.crimson,playerused.playerRect) #draw the playerRect over the black\r\n pygame.display.flip() #update the display\r\n\r\n\r\n#START FUNCTION\r\ndef main(): #define main function to start game when program is opened\r\n pygame.init() #initialize pygame\r\n display = mainDisplay() #create the display by making display an instance of mainDisplay\r\n firstScreen(display) #opens the first menu on the screen\r\n while True: #while loop is not broken\r\n for event in pygame.event.get(): # for every event that happens in queue\r\n if event.type == pygame.QUIT: # if event type is uninitialize pygame\r\n pygame.quit() # quit pygame\r\n quit() # quit python\r\n\r\n#END OF START FUNCTION\r\n\r\n\r\nmain() #start the main function to start entire game.\r\n" } ]
1
zhongLxyz/pedestrian-detection
https://github.com/zhongLxyz/pedestrian-detection
a402238ee84cb23658f07e3734c9f5e0a0a982f5
9247e699c5d8d5f3d93650d62a1120d49dfd5875
7b95669ac4df793c929e7f0afa93016aa337741c
refs/heads/master
2021-05-09T10:29:07.341055
2018-01-25T22:07:12
2018-01-25T22:07:12
118,964,837
1
0
null
null
null
null
null
[ { "alpha_fraction": 0.6877872347831726, "alphanum_fraction": 0.7130663394927979, "avg_line_length": 30.071428298950195, "blob_id": "3cf3624b97391a72901c087083100993f305547e", "content_id": "4e62bc037b6d81476b72ea645ce458428bda82e4", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3046, "license_type": "no_license", "max_line_length": 81, "num_lines": 98, "path": "/train.py", "repo_name": "zhongLxyz/pedestrian-detection", "src_encoding": "UTF-8", "text": "\n\"\"\"\nBased on the tflearn example located here:\nhttps://github.com/tflearn/tflearn/blob/master/examples/images/convnet_cifar10.py\n\"\"\"\n\nfrom __future__ import division, print_function, absolute_import\n\n# Import tflearn and some helpers\nimport tflearn\nfrom tflearn.data_utils import shuffle, build_hdf5_image_dataset, image_preloader\nfrom tflearn.layers.core import input_data, dropout, fully_connected\nfrom tflearn.layers.conv import conv_2d, max_pool_2d\nfrom tflearn.layers.estimator import regression\nfrom tflearn.data_preprocessing import ImagePreprocessing\nfrom tflearn.data_augmentation import ImageAugmentation\nimport h5py\n\n# Load the data set\n# dataset_file = 'my_dataset.txt'\n# testset_file = 'my_testset.txt'\n\n# Extract images from dataset using h5py\nh5f = h5py.File('dataset.h5', 'r')\nX = h5f.get('X')\nY = h5f.get('Y')\n\ntesth5py = h5py.File('testset.h5', 'r')\nX_test = testh5py.get('X')\nY_test = testh5py.get('Y')\n\n\n# Shuffle the data\nX, Y = shuffle(X, Y)\n\n# Normalize the images\nimg_prep = ImagePreprocessing()\nimg_prep.add_featurewise_zero_center()\nimg_prep.add_featurewise_stdnorm()\n\n# Rotate/flip/blur the images in dataset in increase 'noise'\nimg_aug = ImageAugmentation()\nimg_aug.add_random_flip_leftright()\nimg_aug.add_random_rotation(max_angle=25.)\nimg_aug.add_random_blur(sigma_max=3.)\n\n\n# Define our network architecture:\n# Input is a 32x32 image with 3 color channels (RGB)\nnetwork = input_data(shape=[None, 32, 32, 3],\n data_preprocessing=img_prep,\n data_augmentation=img_aug)\n\n# Step 1: Convolution\nnetwork = conv_2d(network, 32, 3, activation='relu')\n\n# Step 2: Max pooling\nnetwork = max_pool_2d(network, 2)\n\n# Step 3: Convolution\nnetwork = conv_2d(network, 64, 3, activation='relu')\n\n# Step 4: Convolution\nnetwork = conv_2d(network, 64, 3, activation='relu')\n\n# Step 5: Max pooling again\nnetwork = max_pool_2d(network, 2)\n\n# Step 6: 512 node in hidden layer\nnetwork = fully_connected(network, 512, activation='relu')\n\n# Step 7: Randomly dropout values to prevent over-fitting\nnetwork = dropout(network, 0.5)\n\n# Step 8: Finally 2 output nodes for class..\n# 0 = not a pedestrian\n# 1 = is a pedestrian\nnetwork = fully_connected(network, 2, activation='softmax')\n\n# Tell tflearn how we want to train the network\nnetwork = regression(network, optimizer='adam',\n loss='categorical_crossentropy',\n learning_rate=0.001)\n\n# Wrap the network in a model object\nmodel = tflearn.DNN(network, tensorboard_verbose=0,\n checkpoint_path='./checkpoint/ped-classifier.tfl.ckpt')\n\n# Train the neural network (for 30 epochs)\n# X is the images, Y is the labels\n# X_test and Y_test are the same but for validation\nmodel.fit(X, Y, n_epoch=30, shuffle=True, validation_set=(X_test, Y_test),\n show_metric=True, batch_size=96,\n snapshot_epoch=True,\n run_id='ped-classifier')\n\n# Save model when training is complete to a file\nmodel.save(\"./model/ped-classifier.tfl\")\nprint(\"Network trained and saved as ped-classifier.tfl!\")\n" }, { "alpha_fraction": 0.6810170412063599, "alphanum_fraction": 0.699508786201477, "avg_line_length": 34.306121826171875, "blob_id": "7d54c1db019cff118770a350b0c5a8d4d3c240d2", "content_id": "6d0cac8412551f6083d2378b46333f0b3a64b101", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3461, "license_type": "no_license", "max_line_length": 176, "num_lines": 98, "path": "/test_model.py", "repo_name": "zhongLxyz/pedestrian-detection", "src_encoding": "UTF-8", "text": "\nfrom __future__ import division, print_function, absolute_import\n# Import necessary libraries\nimport tflearn\nfrom tflearn.data_utils import shuffle\nfrom tflearn.layers.core import input_data, dropout, fully_connected\nfrom tflearn.layers.conv import conv_2d, max_pool_2d\nfrom tflearn.layers.estimator import regression\nfrom tflearn.data_preprocessing import ImagePreprocessing\nfrom tflearn.data_augmentation import ImageAugmentation\nimport scipy\nimport numpy as np\nimport h5py\n\n# Extract images from testset.h5\ntesth5py = h5py.File('testset.h5', 'r')\nX_test = testh5py.get('X')\nY_test = testh5py.get('Y')\n\n# Shuffle testing data\nX_test, Y_test = shuffle(X_test, Y_test)\n\n\n# Same network definition as train.py\nimg_prep = ImagePreprocessing()\nimg_prep.add_featurewise_zero_center()\nimg_prep.add_featurewise_stdnorm()\nimg_aug = ImageAugmentation()\nimg_aug.add_random_flip_leftright()\nimg_aug.add_random_rotation(max_angle=25.)\nimg_aug.add_random_blur(sigma_max=3.)\n\nnetwork = input_data(shape=[None, 32, 32, 3],\n data_preprocessing=img_prep,\n data_augmentation=img_aug)\nnetwork = conv_2d(network, 32, 3, activation='relu')\nnetwork = max_pool_2d(network, 2)\nnetwork = conv_2d(network, 64, 3, activation='relu')\nnetwork = conv_2d(network, 64, 3, activation='relu')\nnetwork = max_pool_2d(network, 2)\nnetwork = fully_connected(network, 512, activation='relu')\nnetwork = dropout(network, 0.5)\nnetwork = fully_connected(network, 2, activation='softmax')\nnetwork = regression(network, optimizer='adam',\n loss='categorical_crossentropy',\n learning_rate=0.001)\nmodel = tflearn.DNN(network, tensorboard_verbose=0, checkpoint_path='checkpoint/ped-classifier.tfl.ckpt')\n\n# Load previously trained model\nmodel.load(\"./model/ped-classifier.tfl\")\n\n# Test the trained networking using samples from testset.h5\nnum_correct = 0\nnum_total = 0\nnum_pedestrian = 0\nnum_non_pedestrian = 0\nnum_pedestrian_correct = 0\nnum_non_pedestrian_correct = 0\nfor i in range(len(X_test)):\n # Predict\n prediction = model.predict([X_test[i]])\n\n # Check the result.\n # is_pedestrian = (np.argmax(prediction[0]) == np.argmax(Y_test[i]))\n\n # NOTE: prediction is the actual output, Y_test[i] is the desired output\n # Both prediction and Y_test[i] are np.ndarray objects\n\n # Class of desired output\n actual_class = np.argmax(Y_test[i])\n\n # Check class of actual output\n predicted_class = 0\n if np.argmax(prediction[0]) == 1:\n predicted_class = 1\n\n # Check if actual output is correct/wrong\n if actual_class == 0:\n num_non_pedestrian += 1\n if predicted_class == 0:\n num_non_pedestrian_correct += 1\n\n if actual_class == 1:\n num_pedestrian += 1\n if predicted_class == 1:\n num_pedestrian_correct += 1\n\n\n# Print confusion matrix\nprint(\"Confusion Matrix: \\n\" + \\\n \"Non pedestrians images: [\" + str(num_non_pedestrian_correct) +\n \" classified as non pedestrian] / [\" +\n str(num_non_pedestrian - num_non_pedestrian_correct) +\" classified as pedestrian]\\n\" +\n \"Pedestrians images: [\" + str(num_pedestrian - num_pedestrian_correct) + \" classified as non pedestrian] / [\" + str(num_pedestrian_correct) +\" classified as pedestrian]\\n\")\n\n# Print accuracy of network\nnum_correct = num_pedestrian_correct + num_non_pedestrian_correct\nnum_total = num_pedestrian + num_non_pedestrian\nprint(\"Accuracy: \" + str(num_correct/num_total))\n" }, { "alpha_fraction": 0.7508503198623657, "alphanum_fraction": 0.7780612111091614, "avg_line_length": 39.55172348022461, "blob_id": "6c0a190e6dab18c7630ded71f24d37e59433090a", "content_id": "07ac1e3447102c6e2558bcbe09c95797cb42887a", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 1186, "license_type": "no_license", "max_line_length": 242, "num_lines": 29, "path": "/readme.md", "repo_name": "zhongLxyz/pedestrian-detection", "src_encoding": "UTF-8", "text": "# Pedestrian Detection with Neural networks\n\nA convolutional neural network that can be trained to detect pedestrians from the other objects on the street.\n\nThis project was completed in December 2016 in a team of 4.\n\n## How to train\n1. run \"python3 generate_dataset_list.py\" to generate list of dataset files & their class\n2. run \"python3 h5py_dumper.py\" to generate dataset.h5 and testset.h5\n3. Finally, run \"python train.py\" to begin training\n\nOR\n\nSimply run “python3 generate_dataset_list.py && python3 h5py_dumper.py && python train.py”.\n\nNOTE: Images for training & validation can be found here: [Daimler Pedestrian Classification Benchmark Dataset](http://www.gavrila.net/Datasets/Daimler_Pedestrian_Benchmark_D/Daimler_Mono_Ped__Class__Bench/daimler_mono_ped__class__bench.html)\n\n## Flow Diagram\n\n![flow diagram](others/flow_diagram.PNG)\n\n## How to test\nSimply run “python3 model_tester.py” in same directory as testset.h5 (also generated using h5py)\n\nOutput result:\n\nConfusion Matrix:\nNon pedestrians images: [4935 classified as non pedestrian] / [65 classified as pedestrian]\nPedestrians images: [4215 classified as non pedestrian] / [585 classified as pedestrian]\n" }, { "alpha_fraction": 0.6200762391090393, "alphanum_fraction": 0.6372299790382385, "avg_line_length": 31.102041244506836, "blob_id": "28244402d0e0a63acfcf003aab72fabc224660d9", "content_id": "f2594af3ba201334a2cdfeab235d51540b0ecf26", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1574, "license_type": "no_license", "max_line_length": 89, "num_lines": 49, "path": "/generate_dataset_list.py", "repo_name": "zhongLxyz/pedestrian-detection", "src_encoding": "UTF-8", "text": "\nimport os\n\n\ndef get_file_names(path):\n \"\"\" Get full path to all images in parameter path \"\"\"\n namelist = os.listdir(path)\n filtered_list = []\n for i in range(len(namelist)):\n if namelist[i].endswith(\"\"):\n filtered_list.append(path + namelist[i])\n return filtered_list\n\n\n# Store names of all dataset images in array\n# X_name/X_test_name are positive datasets\n# Y_name/Y_test_name are negative datasets\nX_name = get_file_names(\"./1/ped_examples/\")\nX_name2 = get_file_names(\"./2/ped_examples/\")\nX_name3 = get_file_names(\"./3/ped_examples/\")\nY_name = get_file_names(\"./1/non-ped_examples/\")\nY_name2 = get_file_names(\"./2/non-ped_examples/\")\nY_name3 = get_file_names(\"./3/non-ped_examples/\")\nX_test_name = get_file_names(\"./T1/ped_examples/\")\nY_test_name = get_file_names(\"./T1/non-ped_examples/\")\n\n\n# write path to dataset images into my_dataset.txt for h5py_dumper.py to generate dataset\ndata = open(\"my_dataset.txt\", 'w')\nfor i in range(len(X_name)):\n data.write(X_name[i] + \" 1\\n\")\n data.write(X_name2[i] + \" 1 \\n\")\n data.write(X_name3[i] + \" 1 \\n\")\nfor i in range(len(Y_name)):\n data.write(Y_name[i] + \" 0\\n\")\n data.write(Y_name2[i] + \" 0\\n\")\n data.write(Y_name3[i] + \" 0\\n\")\n # data.write(Y_test_name[i] + \" 3 \\n\")\n\ndata.close()\n\n# write path to dataset images into my_testset.txt for h5py_dumper.py to generate dataset\ndata = open(\"my_testset.txt\", 'w')\nfor i in range(len(X_test_name)):\n data.write(X_test_name[i] + \" 1\\n\")\n\nfor i in range(len(Y_test_name)):\n data.write(Y_test_name[i] + \" 0\\n\")\n\ndata.close()\n" }, { "alpha_fraction": 0.7330247163772583, "alphanum_fraction": 0.7561728358268738, "avg_line_length": 37.05882263183594, "blob_id": "bcce3350a7190cad7acf3bf51951dc54a2517690", "content_id": "7ab58dc67f89573719025956606026fcfe1925b4", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 648, "license_type": "no_license", "max_line_length": 74, "num_lines": 17, "path": "/h5py_dumper.py", "repo_name": "zhongLxyz/pedestrian-detection", "src_encoding": "UTF-8", "text": "\n# Import the necessary libraries\nimport tflearn\nfrom tflearn.data_utils import build_hdf5_image_dataset\n\n\n# Generate dataset.h5 using training samples\ndataset_file = 'my_dataset.txt'\nbuild_hdf5_image_dataset(dataset_file, image_shape=(32, 32), mode='file',\n output_path='dataset.h5', categorical_labels=True, normalize=True)\nprint(\"Done generating training dataset.\")\n\n\n# Generate testset.h5 using validation samples\ndataset_file = 'my_testset.txt'\nbuild_hdf5_image_dataset(dataset_file, image_shape=(32, 32), mode='file',\n output_path='testset.h5', categorical_labels=True, normalize=True)\nprint(\"Done generating testing dataset.\")\n" } ]
5
OskarMulcan/Repozytorium
https://github.com/OskarMulcan/Repozytorium
c652a129dedb6fd29afedbcb722a065d5d57b7e2
6ea79077068fe2755b13b665cc506bf0719147f7
7b92e493973642cc07c31021d56c036f749125f4
refs/heads/master
2020-03-31T14:09:14.518526
2018-10-09T17:50:16
2018-10-09T17:50:16
152,281,591
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.7201365232467651, "alphanum_fraction": 0.723549485206604, "avg_line_length": 25.727272033691406, "blob_id": "bdca6027182fcef9ae7b02da45110e8dd53009e7", "content_id": "908ada1e3cf2ba5d90be1dc3c21dc0848a582fa7", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 301, "license_type": "no_license", "max_line_length": 66, "num_lines": 11, "path": "/losowanieNicku.py", "repo_name": "OskarMulcan/Repozytorium", "src_encoding": "UTF-8", "text": "kotely = '(ФДФ)'\nprint(kotely)\n\nowcaUzytkownik = input('Podaj ile kotelow chcesz wygenerowac :) ')\ntry:\n owcaUzytkownik = int(owcaUzytkownik)\nexcept ValueError as owcaError:\n owcaUzytkownik = 1\n print('Program potrzebuje liczby, a nie ciągu znaków!')\n\nprint ('(ФДФ)' * owcaUzytkownik)" }, { "alpha_fraction": 0.5914633870124817, "alphanum_fraction": 0.6646341681480408, "avg_line_length": 14, "blob_id": "08261a26aa4ea690b9703642d64dff170696905d", "content_id": "3785e6170abd029a24f83388d268f18ac2b0924b", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 164, "license_type": "no_license", "max_line_length": 35, "num_lines": 11, "path": "/wstemp.py", "repo_name": "OskarMulcan/Repozytorium", "src_encoding": "UTF-8", "text": "pustaOwca = []\n\npelnaOwca = [67, 'owca', True, 4.4]\npelnaOwca[2] \npelnaOwca[0:4]\npelnaOwca[:4]\n\nprint (pelnaOwca[1:3])\n\npelnaOwca[-1]\npelnaOwca[::-1] #odwraca liste" } ]
2
aceasad/timetable-generator
https://github.com/aceasad/timetable-generator
8e67f18d1cd6c403e1fbbe0797b5fbed4e276029
fad89f72278301ed73d2abab9e4f13ebf8c55891
7c651ab84308dfdc332fc9b300102d31597ceddf
refs/heads/master
2021-05-16T19:01:46.225701
2021-04-01T00:43:54
2021-04-01T00:43:54
250,430,303
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.5461538434028625, "alphanum_fraction": 0.6846153736114502, "avg_line_length": 42.66666793823242, "blob_id": "02542bf2bd63760b642f2ba579c680941606f25a", "content_id": "218a84b4e6bf9430509f34c3a1deec9a11fc603b", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Shell", "length_bytes": 130, "license_type": "no_license", "max_line_length": 65, "num_lines": 3, "path": "/launch.sh", "repo_name": "aceasad/timetable-generator", "src_encoding": "UTF-8", "text": "source venv/bin/activate\nkill -9 $(lsof -i:8000 -t) 2> /dev/null\ngunicorn --bind 0.0.0.0:8000 wsgi:app --timeout 100 --workers 2 &" }, { "alpha_fraction": 0.5847928524017334, "alphanum_fraction": 0.5983814597129822, "avg_line_length": 43.154666900634766, "blob_id": "b31680ee671da95fdfd35e04b70807dc15c2f562", "content_id": "388b36627dc68f4edcf3c0f5c2c68c628e33cd01", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 16558, "license_type": "no_license", "max_line_length": 413, "num_lines": 375, "path": "/TimeTableGenerator.py", "repo_name": "aceasad/timetable-generator", "src_encoding": "UTF-8", "text": "import pandas as pd\nimport requests\nimport random\nimport json\nimport pickle\nfrom datetime import datetime\nfrom itertools import combinations, groupby\nfrom jinja2 import Environment, FileSystemLoader\nfrom flask import Flask, request, make_response\nfrom flask_weasyprint import HTML, render_pdf\napp = Flask(__name__)\n\n\ndef load(url):\n res = requests.get(url, headers={'User-Agent': 'Mozilla/5.0 (X11; CrOS x86_64 8172.45.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.64 Safari/537.36', 'Accept':'text/html'}, timeout=10)\n return json.loads(res.text)\n\ndef getStudentCourses(student_id):\n student_courses_url=\"https://recommendationsystem.pretesting.online/public/api/studentCourses/\"+student_id\n student_courses_json = load(student_courses_url)\n student = pd.json_normalize(student_courses_json)\n info={'id':student['student.id'][0],'name':student['student.student_name'][0],'gpa':student['student.gpa'][0],'level':student['student.levels'][0]}\n student_courses = student.drop(['student.created_at','type','id','student.updated_at','student.created_at','course_name','created_at','updated_at','course.id','course.name','course.code','course.created_at','course.updated_at','student.id','student.email','student.username','student.college_id','student.student_name','student_id','student.levels','student.type','student.gpa','course.prerequisites'],axis=1)\n student_courses[\"course_id\"] = pd.to_numeric(student_courses[\"course_id\"])\n return student_courses,info\n \n\ndef get_API_data(student_id):\n course_url=\"https://recommendationsystem.pretesting.online/public/api/coursesData?id=\"+student_id\n timetable_url=\"https://recommendationsystem.pretesting.online/public/api/timetableData\"\n courses_json=load(course_url)\n timetable_json=load(timetable_url)\n timetable=pd.DataFrame(dict(timetable_json)['timetable_data'])\n timetable=timetable.drop(['id','created_at','updated_at'], 1)\n courses=pd.DataFrame(dict(courses_json)['courses_data'])\n courses=courses.drop(['created_at','updated_at'],1)\n student_courses,info = getStudentCourses(student_id)\n return timetable,courses,student_courses,info\n\ndef getPreRequisites(courses,student):\n dependent_url = \"https://recommendationsystem.pretesting.online/public/api/coursePrerequisites/\"\n preRequisites={}\n for i in range(0,len(courses['id'])):\n if int(courses['id'][i]) not in student['course_id']:\n dependent_json=load(dependent_url+courses['id'][i])\n dependent_id=[]\n if(len(dependent_json)!=0):\n for c in dependent_json:\n dependent_id.append(c['dependent_course_id'])\n if courses['id'][i] not in preRequisites:\n preRequisites.setdefault(courses['id'][i],dependent_id)\n return preRequisites\n\ndef getCourses(student_id,student,info):\n ch=0\n hard_4=1\n inter_4=4\n easy_4=3 \n inter_3=2\n easy_3=3\n inter_2=1\n easy_2=4\n easy_1=3\n gpa=float(info['gpa'].replace(\":\",\".\"))\n futureCourse = pd.DataFrame(columns=['course_id','type','credit_hours'])\n #Create a list of courses student can study here. \n studentcourses_url=\"https://recommendationsystem.pretesting.online/public/api/courses/notStudied/\"+student_id\n scourses_json=load(studentcourses_url)\n scourses=pd.DataFrame(dict(scourses_json)['courses'])\n hard_no=0\n intermediate_no=0\n easy_no=0\n\n for i in range(0,len(scourses['id'])):\n if(scourses['type'][i]==\"Difficult\"):\n hard_no+=1\n elif(scourses['type'][i]==\"Intermediate\"):\n intermediate_no+=1\n else:\n easy_no+=1\n if(hard_no==0):\n hard_4=0\n inter_4+=1\n easy_4+=2\n if(intermediate_no==0):\n easy_3+=2\n inter_3-=2\n\n \n\n for i in range(0,len(scourses['id'])):\n if(ch<=18):\n if(gpa>4):\n if(scourses['type'][i]==\"Intermediate\" and inter_4>0):\n inter_4-=1\n row={'course_id':str(scourses['id'][i]),'name':scourses['name'][i],'type':scourses['type'][i],'credit_hours':scourses['credit_hours'][i]}\n futureCourse=futureCourse.append(row,ignore_index=True)\n ch=ch+int(row['credit_hours'])\n\n if(scourses['type'][i]==\"Difficult\" and hard_4>0):\n hard_4-=1\n row={'course_id':str(scourses['id'][i]),'name':scourses['name'][i],'type':scourses['type'][i],'credit_hours':scourses['credit_hours'][i]}\n futureCourse=futureCourse.append(row,ignore_index=True)\n ch=ch+int(row['credit_hours'])\n\n if(scourses['type'][i]==\"easy\" and easy_4>0):\n easy_4-=1\n row={'course_id':str(scourses['id'][i]),'name':scourses['name'][i],'type':scourses['type'][i],'credit_hours':scourses['credit_hours'][i]}\n futureCourse=futureCourse.append(row,ignore_index=True)\n ch=ch+int(row['credit_hours'])\n \n\n\n elif(gpa>3.0 and gpa < 4.0):\n if(scourses['type'][i]==\"Intermediate\" and inter_3>0):\n inter_3-=1\n row={'course_id':str(scourses['id'][i]),'name':scourses['name'][i],'type':scourses['type'][i],'credit_hours':scourses['credit_hours'][i]}\n futureCourse=futureCourse.append(row,ignore_index=True)\n ch=ch+int(row['credit_hours'])\n\n if(scourses['type'][i]==\"easy\" and easy_3>0):\n easy_3-=1\n row={'course_id':str(scourses['id'][i]),'name':scourses['name'][i],'type':scourses['type'][i],'credit_hours':scourses['credit_hours'][i]}\n futureCourse=futureCourse.append(row,ignore_index=True)\n ch=ch+int(row['credit_hours'])\n\n elif(gpa>2.8 and gpa < 3.1):\n if(scourses['type'][i]==\"Intermediate\" and inter_2>0):\n inter_2-=1\n row={'course_id':str(scourses['id'][i]),'name':scourses['name'][i],'type':scourses['type'][i],'credit_hours':scourses['credit_hours'][i]}\n futureCourse=futureCourse.append(row,ignore_index=True)\n ch=ch+int(row['credit_hours'])\n\n if(scourses['type'][i]==\"easy\" and easy_2>0):\n easy_2-=1\n row={'course_id':str(scourses['id'][i]),'name':scourses['name'][i],'type':scourses['type'][i],'credit_hours':scourses['credit_hours'][i]}\n futureCourse=futureCourse.append(row,ignore_index=True)\n ch=ch+int(row['credit_hours'])\n\n elif(gpa<2.81):\n if(scourses['type'][i]==\"easy\" and easy_1>0):\n row={'course_id':str(scourses['id'][i]),'name':scourses['name'][i],'type':scourses['type'][i],'credit_hours':scourses['credit_hours'][i]}\n futureCourse=futureCourse.append(row,ignore_index=True)\n easy_1-=1\n ch=ch+int(row['credit_hours']) \n else:\n #print (futureCourse)\n break\n \n return futureCourse\n\n\n# It returns the related courses for the student from the global time table day wise\ndef get_timetable_days(student,timetable):\n all_index=student.index\n frames=[]\n for i in all_index:\n x=timetable.loc[(timetable['course_id'] == student['course_id'][i])]\n frames.append(x)\n student_timetable=pd.concat(frames)\n #print(student_timetable.sort_values(by=['day_of_week']))\n mon = student_timetable[student_timetable.day_of_week == '1']\n tue = student_timetable[student_timetable.day_of_week == '2']\n wed = student_timetable[student_timetable.day_of_week == '3']\n thu = student_timetable[student_timetable.day_of_week == '4']\n sun = student_timetable[student_timetable.day_of_week == '7']\n mon=mon.drop(['day_of_week'],1)\n tue=tue.drop(['day_of_week'],1)\n wed=wed.drop(['day_of_week'],1)\n thu=thu.drop(['day_of_week'],1)\n sun=sun.drop(['day_of_week'],1)\n output=[mon,tue,wed,thu,sun]\n return output\n\n \ndef get_grouped_classes(data):\n temp=[]\n for i in data.course_id.index:\n temp.append(data.loc[i])\n output={}\n for data in temp:\n if(data.course_id in output):\n output[data.course_id].extend([[data.course_id,data.section,data.start_time,data.end_time,data.level]])\n else:\n output.setdefault(data.course_id,[[data.course_id,data.section,data.start_time,data.end_time,data.level]])\n return output\n\ndef Random_time_generator(day):\n temp=get_grouped_classes(day)\n selection=[]\n for c in temp:\n l=len(temp[c])\n x=random.randint(1,l)-1\n #print(\"Random Selection Class\",x)\n selection.append(temp[c][x])\n return selection\n\ndef rSubset(arr, r): \n return list(combinations(arr, r)) \n\n#(1,2,3) #(2,3,1) #(3,2,1)\ndef compare(random_selection,overlap_pairs):\n index=[]\n for i in range(0,len(random_selection)):\n index.append(i)\n checks=rSubset(index,2)\n # i=11 [ Islamiat: 10:30 / 11:30 / OS : 10:30 / 11:30 / Coding 9:30 / 10:30]\n for ind in checks:\n c1_s=random_selection[ind[0]][2] #Starting Time\n c1_e=random_selection[ind[0]][3] #Ending Time\n c2_s=random_selection[ind[1]][2] #Starting Time\n c2_e=random_selection[ind[1]][3] #Ending Time\n StartA = datetime.strptime(c1_s, '%H:%M:%S')\n EndA = datetime.strptime(c1_e, '%H:%M:%S')\n StartB = datetime.strptime(c2_s, '%H:%M:%S')\n EndB = datetime.strptime(c2_e, '%H:%M:%S')\n if(EndA <= StartB or StartA >= EndB):\n pass\n else:\n overlap_pairs.append([random_selection[ind[0]],random_selection[ind[1]]])\n return False\n return True\n\ndef removeDuplicates(k):\n k.sort()\n return list(k for k,_ in groupby(k))\n\ndef get_recommendation(day,samples):\n random_schedules=[]\n for i in range(0,samples):\n random_selection=Random_time_generator(day)\n random_schedules.append(random_selection)\n removed_duplicated_random_schedules=removeDuplicates(random_schedules)\n\n recommendations=[]\n overlap_pairs=[]\n for random_timetables in removed_duplicated_random_schedules:\n result=compare(random_timetables,overlap_pairs)\n if(result==True):\n #print(\"Time Table Suggestion Found!\")\n recommendations.append(random_timetables)\n break\n return recommendations, overlap_pairs\n\ndef get_clashes(day,time_table_response):\n if len(time_table_response[day]['clashes']) != 0:\n frames=[]\n for i in range(0,len(time_table_response[day]['clashes'])):\n frames.append(pd.DataFrame(time_table_response[day]['clashes'][i],columns=['Course ID','Section','Start Time','End Time','Level']))\n return pd.concat(frames)\n else:\n return pd.DataFrame(['No Clash Exists'])\n\n@app.route('/',methods=['GET'])\ndef index():\n return (\"<div><h1>Academic Time Table Recommender API</h1> <br/><h2>/timetable?query=Student_id</h2> <br/><h3>This returns the recommended timetable for courses </h3><br/><h2>/courses?query=Student_id</h2> <br/><h3>This returns the recommended courses</h3> </div>\")\n\n\n@app.route('/courses', methods=['GET'])\ndef get_courses():\n student_id = request.args.get(\"query\")\n timetable,courses,student,info=get_API_data(student_id)\n recommendedCourses=getCourses(student_id,courses,info)\n recommendedCourses.to_pickle('courses/'+student_id+'.pkl')\n env = Environment(loader=FileSystemLoader('.'))\n template = env.get_template(\"courses.html\")\n template_vars = {\"name\" :info['name'],\n \"id\":info['id'],\n \"gpa\":str(info['gpa']),\n \"level\":info['level'],\n \"Courses\":recommendedCourses.to_html()\n }\n html_courses = template.render(template_vars)\n with open('student_courses.html', 'w') as file:\n file.write(html_courses)\n return render_pdf(HTML(string=html_courses))\n\n\n@app.route('/timetable', methods=['GET'])\ndef get_timeschedule():\n student_id = request.args.get(\"query\")\n timetable,courses,student,info=get_API_data(student_id)\n courseR=pd.read_pickle('courses/'+student_id+'.pkl')\n courseR['course_id']=pd.to_numeric(courseR['course_id'])\n timetable['course_id']=pd.to_numeric(timetable['course_id'])\n\n days=get_timetable_days(courseR,timetable)\n\n time_table_response={\n 'monday':{\n 'recommendation':[],\n 'clashes':[]\n },\n 'tuesday':{\n 'recommendation':[],\n 'clashes':[]\n },\n 'wednesday':{\n 'recommendation':[],\n 'clashes':[]\n },\n 'thursday':{\n 'recommendation':[],\n 'clashes':[]\n },\n 'sunday':{\n 'recommendation':[],\n 'clashes':[]\n }\n }\n for i in range(0,len(days)):\n recommendations,overlap_pairs=get_recommendation(days[i],100)\n if(i==0):\n for items in recommendations:\n time_table_response['monday']['recommendation'].extend(items)\n for pairs in overlap_pairs:\n time_table_response['monday']['clashes'].append(pairs)\n if(i==1):\n for items in recommendations:\n time_table_response['tuesday']['recommendation'].extend(items)\n for pairs in overlap_pairs:\n time_table_response['tuesday']['clashes'].append(pairs)\n if(i==2):\n for items in recommendations:\n time_table_response['wednesday']['recommendation'].extend(items)\n for pairs in overlap_pairs:\n time_table_response['wednesday']['clashes'].append(pairs)\n if(i==3):\n for items in recommendations:\n time_table_response['thursday']['recommendation'].extend(items)\n for pairs in overlap_pairs:\n time_table_response['thursday']['clashes'].append(pairs)\n if(i==4):\n for items in recommendations:\n time_table_response['sunday']['recommendation'].extend(items)\n for pairs in overlap_pairs:\n time_table_response['sunday']['clashes'].append(pairs)\n\n mon = pd.DataFrame(time_table_response['monday']['recommendation'], columns = ['Course ID', 'Section','Start Time',\"End time\",\"Level\"]).sort_values(by='Start Time')\n tue = pd.DataFrame(time_table_response['tuesday']['recommendation'], columns = ['Course ID', 'Section','Start Time',\"End time\",\"Level\"]).sort_values(by='Start Time')\n wed = pd.DataFrame(time_table_response['wednesday']['recommendation'], columns = ['Course ID', 'Section','Start Time',\"End time\",\"Level\"]).sort_values(by='Start Time')\n thu = pd.DataFrame(time_table_response['thursday']['recommendation'], columns = ['Course ID', 'Section','Start Time',\"End time\",\"Level\"]).sort_values(by='Start Time')\n sun = pd.DataFrame(time_table_response['sunday']['recommendation'], columns = ['Course ID', 'Section','Start Time',\"End time\",\"Level\"]).sort_values(by='Start Time')\n\n \n mon_clash=get_clashes('monday',time_table_response)\n tue_clash=get_clashes('tuesday',time_table_response)\n wed_clash=get_clashes('wednesday',time_table_response)\n thu_clash=get_clashes('thursday',time_table_response)\n sun_clash=get_clashes('sunday',time_table_response)\n\n\n env = Environment(loader=FileSystemLoader('.'))\n template = env.get_template(\"template.html\")\n template_vars = {\"Info\" : \"Timetable for Student \"+info['name'],\n \"Courses\": courseR.to_html(),\n \"title\":\"Student Timetable\",\n \"time_table_mon\": mon.to_html(),\n \"time_table_tue\": tue.to_html(),\n \"time_table_wed\": wed.to_html(),\n \"time_table_thu\": thu.to_html(),\n \"time_table_sun\": sun.to_html(),\n \"clash_mon\": mon_clash.to_html(),\n \"clash_tue\": tue_clash.to_html(),\n \"clash_wed\": wed_clash.to_html(),\n \"clash_thu\": thu_clash.to_html(),\n \"clash_sun\": sun_clash.to_html()\n }\n html_timetable = template.render(template_vars)\n with open('timetable.html', 'w') as file:\n file.write(html_timetable)\n return render_pdf(HTML(string=html_timetable))\n\nif __name__=='__main__':\n app.run(host=\"0.0.0.0\",port=5000)\n" } ]
2
FBoyang/DNN-SNPs-Analysis-
https://github.com/FBoyang/DNN-SNPs-Analysis-
f715a5a8d774d75dc9b7747562970ebfc8ca81de
86ff3256b3655a311079ef1cef97b6c9edf5496d
461bdd5fd0b15d5e37f50c5d37516eca43b02598
refs/heads/master
2021-05-09T02:06:46.486448
2018-01-27T20:38:47
2018-01-27T20:38:47
119,198,947
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.4718394875526428, "alphanum_fraction": 0.49202319979667664, "avg_line_length": 28.96014404296875, "blob_id": "a3681b20c78b4323a3813028ff49d75c56954491", "content_id": "dd4d06dda2524cbda51114f285716dd3d3e30f20", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 8274, "license_type": "no_license", "max_line_length": 111, "num_lines": 276, "path": "/gen1.py", "repo_name": "FBoyang/DNN-SNPs-Analysis-", "src_encoding": "UTF-8", "text": "import numpy as np\nimport math\nimport random\nimport pandas as pd\nimport re\nfrom sklearn.decomposition import PCA\nimport matplotlib.pyplot as plt\nimport tensorflow as tf\nimport autoencoder_saliksyed as auto\nimport autoencoder_saliksyed2 as auto2\nfrom sklearn.preprocessing import normalize\nimport os\nos.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'\n\n\n########################################################################################\n# choose two biggest lists from the four input list and return\ndef Top_2(list1, list2, list3, list4):\n list_a = [list1, list2, list3, list4]\n \n count = 0\n#variable \"count\" count how many no empty list do we have\n for t_list in list_a:\n if t_list:\n count += 1\n else:\n break\n\n i = 1\n while i<count:\n x = list_a[i]\n j = i-1\n while j>=0 and list_a[j][1]<x[1]:\n list_a[j+1] = list_a[j]\n j = j-1\n list_a[j+1] = x\n i = i+1\n \n return list_a[0], list_a[1]\n \n\n \n \n \n\n\n\n\n\n########################################################################################\n# base_calc return the two list with base name and the number of one SNP\ndef base_calc(array):\n #print(array[0:10])\n a=c=g=t=0\n for i in array:\n #print(i)\n if(i=='A'):\n a+=1\n elif(i=='C'):\n c+=1\n elif(i=='G'):\n g+=1\n elif(i=='T'):\n t+=1\n else:\n continue\n label = ['A', 'G', 'C', 'T']\n value = [a,g,c,t]\n #print(value)\n list1 = []\n list2 = []\n list3 = []\n list4 = []\n for i in range(4):\n if(value[i]!=0 ):\n if not list1:\n list1.append(label[i])\n list1.append(value[i])\n elif not list2:\n list2.append(label[i])\n list2.append(value[i])\n elif not list3:\n list3.append(label[i])\n list3.append(value[i])\n else:\n list4.append(label[i])\n list4.append(value[i])\n #choose the two base list with the biggest value\n list1, list2 = Top_2(list1, list2, list3, list4) \n if not list2:\n list2.append(\"N\")\n list2.append(0)\n return list1, list2\n\n#####################################################################################\n#encode the base:\n#encode the base to 0 and 1 based on their frequency, for example if num(A)> num(C), then A should be encoded \n# as 0 and C as 1\ndef base_encoder(array):\n total_list = []\n #print(len(array[0]))\n #print(array.T[1])\n for i in range(len(array[0])-1):\n temp_list = []\n list1, list2 = base_calc(array.T[i])\n #print(i)\n \n if(list1[1]>list2[1]):\n Dominant_base = list1[0]\n else:\n Dominant_base = list2[0]\n #temp_list = np.array(array[:i]).tolist()\n #print(array.T[0])\n for base in array.T[i]:\n #the ith row in array's transpose is equal to the ith coloumn in array\n if(base==Dominant_base or base==\"?\"):\n temp_list.append(0)\n else:\n temp_list.append(1)\n #temp_list store the SNP for different individuals\n if (i==0):\n total_list = np.asarray(temp_list)\n else:\n total_list = np.vstack((total_list, np.asarray(temp_list)))\n return total_list.transpose()\n \n \n \n#################################################################################\n\n# this is the main function, reading the raw data and store into a matrix\ncounter = 0\ncounter2 = 0\ncounter3 = 0\nfile = open(\"phased_HGDP+India+Africa_2810SNPs-regions1to36.stru\", \"r\") #open the dateset\narea_list = []\n\nfor i, line in enumerate(file):\n if i==5:\n for j in line:\n counter2+=1\n if(j==\" \"):\n counter+=1\n \n if(counter>=7):\n array_o = re.split(' |\\n',line[counter2:])\n #array_o = line[counter2:].split(\" |\\n\")\n #print(array_o)\n counter2=0\n counter=0\n counter3=0 \n area_list.append(line.split(\" \", 5)[4])\n # only split the first blank, take only the first word\n break\n if i> 5:\n for j in line:\n counter3+=1\n if(j==\" \"):\n counter+=1\n \n if(counter>=7):\n array2 = re.split(' |\\n',line[counter3:])\n #array2 = line[counter3:].split(\" |\\n\")\n counter3=0\n counter=0\n #print(len(array2))\n \n break\n #for h in range(len(array)):\n if(i%2!=0):\n #odd list\n area_list.append(line.split(\" \", 5)[4])\n array_o = np.vstack((array_o,array2))\n \n else:\n #even list\n if(i==6):\n array_e = array2\n else:\n array_e = np.vstack((array_e,array2))\n\nfile.close()\narea_list = np.array(area_list)\n\n##################################################################################### \n# encoded the base to 0 and 1 in chromosome 1\ncoded_array_o = base_encoder(array_o)\n#encoded the base to 0 and q in chromosome 2\ncoded_array_e = base_encoder(array_e)\n\n\nencoded_sequence1 = np.asmatrix(base_encoder(array_o))\nencoded_sequence2 = np.asmatrix(base_encoder(array_e))\n\n\n#print(encoded_sequence1)\n#the final encode sequence\ne_sequence_t = encoded_sequence1 + encoded_sequence2\n\n#cast the type of the data from int to float\ne_sequence_t = e_sequence_t.astype(float)\n#print(e_sequence_t.shape)\n#normalize the matrix by columns\n#e_sequence_t = normalize(e_sequence_t, norm = 'l1', axis = 0)\n\n#processing the matrix\n#step1: X = X - E(X)\n#step2: X = X/sigma\nfor i in range(e_sequence_t.shape[1]):\n sigma = (e_sequence_t[:, i]).std()\n mean = (e_sequence_t[:,i]).mean()\n e_sequence_t[:, i] -= mean\n e_sequence_t[:, i] /= sigma\n\n\n\n\n\n\ne_sequence = np.asarray(e_sequence_t)\n\n#######################################################################################\n#applying PCA\n\npca = PCA(n_components = 2)\np_data = pca.fit(e_sequence).transform(e_sequence)\n#print(p_data.shape)\n#print(area_list.shape)\nprint('expalined variance ratio (first two components): %s' % str(pca.explained_variance_ratio_))\ncolors = ['navy', 'gray', 'darkorange', 'green', 'red', 'yellow', 'cyan']\n\narea_label = np.array([\"EUROPE\",\"MIDDLE_EAST\",\"CENTRAL_SOUTH_ASIA\",\"OCEANIA\",\"AMERICA\",\"AFRICA\",\"EAST_ASIA\"])\n\nplt.figure()\nlw = 2\nfor color, target_name in zip(colors, area_label):\n plt.scatter(p_data[area_list==target_name, 0], p_data[area_list==target_name, 1],\n alpha = .8,color = color, lw=lw, label = target_name)\n \n \nplt.legend(loc = 'best', shadow = False, scatterpoints = 1)\nplt.title('SPNs distribution with PCA')\n\nplt.show()\n\n###############################################################################################################\n\n#applying autoencoder\n\n#a_data is the decoded data run be autoencoder\n\na_data = auto.deep_test(e_sequence.shape[1],e_sequence, e_sequence.shape[0])\n\nap_data = auto2.deep_test(e_sequence.shape[1],e_sequence)\n\nplt.figure()\nlw = 2\nfor color, target_name in zip(colors, area_label):\n plt.scatter(a_data[area_list==target_name, 0], a_data[area_list==target_name, 1],alpha = .8,\n color = color, lw=lw, label = target_name)\nplt.legend(loc = 'best', shadow = False, scatterpoints = 1)\nplt.title('SNPs distribution with Relu')\n\n\nplt.show()\n\n\nplt.figure()\nlw = 2\nfor color, target_name in zip(colors, area_label):\n plt.scatter(ap_data[area_list==target_name, 0], ap_data[area_list==target_name, 1],alpha = .8,\n color = color, lw=lw, label = target_name)\nplt.legend(loc = 'best', shadow = False, scatterpoints = 1)\nplt.title('SNPs distribution with linear')\n\nplt.show()\n\n\n\n\n\n" }, { "alpha_fraction": 0.6915829181671143, "alphanum_fraction": 0.7006909251213074, "avg_line_length": 31.81443214416504, "blob_id": "f3f174188eee37005aa0e6a0a2ae1ecc76bb2888", "content_id": "430c13732cc5c02a5afe136ff961996943a1653b", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3184, "license_type": "no_license", "max_line_length": 111, "num_lines": 97, "path": "/autoencoder_saliksyed2.py", "repo_name": "FBoyang/DNN-SNPs-Analysis-", "src_encoding": "UTF-8", "text": "\"\"\" Deep Auto-Encoder implementation\n\t\n\tAn auto-encoder works as follows:\n\tData of dimension k is reduced to a lower dimension j using a matrix multiplication:\n\tsoftmax(W*x + b) = x'\n\t\n\twhere W is matrix from R^k --> R^j\n\tA reconstruction matrix W' maps back from R^j --> R^k\n\tso our reconstruction function is softmax'(W' * x' + b') \n\tNow the point of the auto-encoder is to create a reduction matrix (values for W, b) \n\tthat is \"good\" at reconstructing the original data. \n\tThus we want to minimize ||softmax'(W' * (softmax(W *x+ b)) + b') - x||\n\tA deep auto-encoder is nothing more than stacking successive layers of these reductions.\n\"\"\"\nimport tensorflow as tf\nimport numpy as np\nimport math\nimport random\nfrom random import randint\n\n\ndef lrelu(x, alpha):\n\n\treturn tf.nn.relu(x) - alpha * tf.nn.relu(-x)\n\ndef create(x, layer_sizes):\n\n\t# Build the encoding layers\n\tnext_layer_input = x\n\n\tencoding_matrices = []\n\tfor dim in layer_sizes:\n\t\tinput_dim = int(next_layer_input.get_shape()[1])\n\n\t\t# Initialize W using random values in interval [-1/sqrt(n) , 1/sqrt(n)]\n\t\tW = tf.Variable(tf.random_uniform([input_dim, dim], -1.0 / math.sqrt(input_dim), 1.0 / math.sqrt(input_dim)))\n\n\t\t# Initialize b to zero\n\t\tb = tf.Variable(tf.zeros([dim]))\n\n\t\t# We are going to use tied-weights so store the W matrix for later reference.\n\t\tencoding_matrices.append(W)\n\n\t\toutput = tf.matmul(next_layer_input,W) + b\n\n\t\t# the input into the next layer is the output of this layer\n\t\tnext_layer_input = output\n\n\t# The fully encoded x value is now stored in the next_layer_input\n\tencoded_x = next_layer_input\n\n\t# build the reconstruction layers by reversing the reductions\n\tlayer_sizes.reverse()\n\tencoding_matrices.reverse()\n\n\n\tfor i, dim in enumerate(layer_sizes[1:] + [ int(x.get_shape()[1])]) :\n\t\t# we are using tied weights, so just lookup the encoding matrix for this step and transpose it\n\t\tW = tf.transpose(encoding_matrices[i])\n\t\tb = tf.Variable(tf.zeros([dim]))\n\t\toutput = tf.matmul(next_layer_input,W) + b\n\t\tnext_layer_input = output\n\n\t# the fully encoded and reconstructed value of x is here:\n\treconstructed_x = next_layer_input\n\n\treturn {\n\t\t'encoded': encoded_x,\n\t\t'decoded': reconstructed_x,\n\t\t'cost' : tf.sqrt(tf.reduce_mean(tf.square(x-reconstructed_x)))\n\t}\n\n\n\ndef deep_test(s_dim, matrix, row_num):\n\t#s_dim takes the dimension of the input\t\n\tsess = tf.Session()\n\tstart_dim = s_dim\n\tx = tf.placeholder(\"float\", [None, start_dim])\n\tautoencoder = create(x, [2000,200,20,2])\n\tinit = tf.global_variables_initializer()\n\tsess.run(init)\n\ttrain_step = tf.train.GradientDescentOptimizer(0.1).minimize(autoencoder['cost'])\n\n\tx2 = tf.placeholder(\"float\", [row_num, start_dim])\n#\tOur dataset consists of two centers with gaussian noise w/ sigma = 0.1\n#\trandomly generate a sample batch from the matrix\n#\tthis snip doesn't give me the right output\n\tbatch = []\n\tfor i in range(50):\n\t\tbatch.append(matrix[randint(0,row_num-1), :])\n\tprint(batch[2])\n\tprint(sess.run(train_step, feed_dict = {x: batch}))\n\tencoded_data = sess.run(autoencoder['encoded'], feed_dict = {x: matrix})\n#\tprint(\"cost is: %d\" %(sess.run(autoencoder['cost'], feed_dict = {x:batch})))\n#\tprint(decoded_data.shape)\n\treturn encoded_data\n\n" }, { "alpha_fraction": 0.7728531956672668, "alphanum_fraction": 0.811634361743927, "avg_line_length": 39.11111068725586, "blob_id": "17a2a5e7a7da642e1b244518cd33f381a5924233", "content_id": "23d3adff56ea186754aabdc75e961ac5c4226681", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 361, "license_type": "no_license", "max_line_length": 91, "num_lines": 9, "path": "/README.md", "repo_name": "FBoyang/DNN-SNPs-Analysis-", "src_encoding": "UTF-8", "text": "# DNN-SNPs-Analysis-\nThis is one of the project I finished to analysis the SNPs difference among different races\n\nReference:\n1. the restricted boltzemann Machine code I used is originally from:\nhttps://github.com/echen/restricted-boltzmann-machines\n\n2. the deep autoencoder code I used is originally from:\nhttps://gist.github.com/saliksyed/593c950ba1a3b9dd08d5\n" }, { "alpha_fraction": 0.616150438785553, "alphanum_fraction": 0.6261062026023865, "avg_line_length": 27.82978630065918, "blob_id": "8b3e6414f00abd80678f30f02ba991e707e4b1cc", "content_id": "67947a05d5dc69db1f6f17e9d76e7158ccd8269a", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2712, "license_type": "no_license", "max_line_length": 112, "num_lines": 94, "path": "/analysis.py", "repo_name": "FBoyang/DNN-SNPs-Analysis-", "src_encoding": "UTF-8", "text": "import numpy as np\nimport math\nimport random\nimport pandas as pd\nimport re\nfrom sklearn.decomposition import PCA\nimport matplotlib.pyplot as plt\nimport tensorflow as tf\nimport autoencoder_saliksyed as auto\nimport autoencoder_saliksyed2 as auto2\nfrom sklearn.preprocessing import normalize\nfrom random import randint\nimport os\nos.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'\n################################################################################################################\n\ne_sequence = np.loadtxt(\"matrix.stru\")\ne_sequence = np.asarray(e_sequence)\n\nfile = open(\"area.stru\", 'r')\narea_list = []\nj = 0\nfor item in file:\n for i in item.split(\" \"):\n j+=1\n area_list.append(i)\narea_list = np.asarray(area_list)[:-1]\n\ncolors = ['navy', 'turquoise', 'darkorange', 'orange', 'red', 'yellow', 'blue']\narea_label = np.array([\"EUROPE\",\"MIDDLE_EAST\",\"CENTRAL_SOUTH_ASIA\",\"OCEANIA\",\"AMERICA\",\"AFRICA\",\"EAST_ASIA\"])\n\n'''\n#applying PCA\npca = PCA(n_components = 2)\np_data = pca.fit(e_sequence).transform(e_sequence)\n#print(p_data.shape)\n#print(area_list.shape)\nprint('expalined variance ratio (first two components): %s' % str(pca.explained_variance_ratio_))\n\n\nprint(p_data.shape)\n\n\n#label is a list that contain different name of the area\n#area_list represent the area that each individual lives in\n\n\nplt.figure()\nlw = 2\nfor color, target_name in zip(colors, area_label):\n plt.scatter(p_data[area_list==target_name, 0], p_data[area_list==target_name, 1],\n alpha = .8,color = color, lw=lw, label = target_name)\n \n \nplt.legend(loc = 'best', shadow = False, scatterpoints = 1)\nplt.title('SNPs distribution')\n\nplt.show()\n'''\n###############################################################################################################\n\n#applying autoencoder\n\n#a_data is the decoded data run be autoencoder\n\na_data = auto.deep_test(e_sequence.shape[1],e_sequence, e_sequence.shape[0])\n'''\nap_data = auto2.deep_test(e_sequence.shape[1],e_sequence, e_sequence.shape[0])\n'''\n'''\nplt.figure()\nlw = 2\nfor color, target_name in zip(colors, area_label):\n plt.scatter(a_data[area_list==target_name, 0], a_data[area_list==target_name, 1],alpha = .8,\n color = color, lw=lw, label = target_name)\nplt.legend(loc = 'best', shadow = False, scatterpoints = 1)\nplt.title('SNPs distribution with Relu')\n\n\nplt.show()\n\n'''\n'''\n\nplt.figure()\nlw = 2\nfor color, target_name in zip(colors, area_label):\n plt.scatter(ap_data[area_list==target_name, 0], ap_data[area_list==target_name, 1],alpha = .8,\n color = color, lw=lw, label = target_name)\nplt.legend(loc = 'best', shadow = False, scatterpoints = 1)\nplt.title('SNPs distribution with linear')\n\nplt.show()\n'''\n\n\n" }, { "alpha_fraction": 0.664277195930481, "alphanum_fraction": 0.6965352296829224, "avg_line_length": 40.849998474121094, "blob_id": "e989eaf1b6830602791506a77783b0479f08ae71", "content_id": "bbf5459949daa3c350fbc6743d246a69f9bdadd0", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 837, "license_type": "no_license", "max_line_length": 96, "num_lines": 20, "path": "/tensor_p1.py", "repo_name": "FBoyang/DNN-SNPs-Analysis-", "src_encoding": "UTF-8", "text": "import os\nos.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'\nfrom tensorflow.examples.tutorials.mnist import input_data\nimport tensorflow as tf\nmnist = input_data.read_data_sets('MNIST_data', one_hot = True)\nsess = tf.InteractiveSession()\nx = tf.placeholder(tf.float32, shape = [None, 784])\ny_ = tf.placeholder(tf.float32, shape = [None, 10])\nW = tf.Variable(tf.zeros([784, 10]))\nb = tf.Variable(tf.zeros([10]))\nsess.run(tf.global_variables_initializer())\ny = tf.matmul(x, W) + b\ncross_entropy = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(labels = y_, logits = y))\ntrain_step = tf.train.GradientDescentOptimizer(0.5).minimize(cross_entropy)\nfor _ in range(1):\n\tbatch = mnist.train.next_batch(100)\n\tprint(\"x is: \", batch[0])\n\tprint(\"y is: \", batch[1])\n\tprint(\"batch is \", batch)\n\ttrain_step.run(feed_dict = {x: batch[0], y_: batch[1]})\n" }, { "alpha_fraction": 0.6351659297943115, "alphanum_fraction": 0.6597415804862976, "avg_line_length": 28.007352828979492, "blob_id": "b2888947dcbd0d755ed984b49c91b84bc848eaf2", "content_id": "ef4dd059d151105954fe606dd2956401b73be308", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3947, "license_type": "no_license", "max_line_length": 128, "num_lines": 136, "path": "/analysis2.py", "repo_name": "FBoyang/DNN-SNPs-Analysis-", "src_encoding": "UTF-8", "text": "import numpy as np\nimport math\nimport random\nimport pandas as pd\nimport re\nfrom sklearn.decomposition import PCA\nimport matplotlib.pyplot as plt\nimport tensorflow as tf\nimport autoencoder_saliksyed as auto\nimport autoencoder_saliksyed2 as auto2\nimport autoencoder_saliksyed3 as auto3\nfrom sklearn.preprocessing import normalize\nfrom random import randint\nimport os\nimport rbm\nos.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'\n################################################################################################################\n\ne_sequence = np.loadtxt(\"matrix.stru\")\ne_sequence = np.asarray(e_sequence)\n\nfile = open(\"area.stru\", 'r')\narea_list = []\nj = 0\nfor item in file:\n for i in item.split(\" \"):\n j+=1\n area_list.append(i)\narea_list = np.asarray(area_list)[:-1]\n\ncolors = ['navy', 'turquoise', 'darkorange', 'orange', 'red', 'yellow', 'blue']\narea_label = np.array([\"EUROPE\",\"MIDDLE_EAST\",\"CENTRAL_SOUTH_ASIA\",\"OCEANIA\",\"AMERICA\",\"AFRICA\",\"EAST_ASIA\"])\n\n'''\n#applying PCA\npca = PCA(n_components = 2)\np_data = pca.fit(e_sequence).transform(e_sequence)\n#print(p_data.shape)\n#print(area_list.shape)\nprint('expalined variance ratio (first two components): %s' % str(pca.explained_variance_ratio_))\n\n\nprint(p_data.shape)\n\n\n#label is a list that contain different name of the area\n#area_list represent the area that each individual lives in\n\n\nplt.figure()\nlw = 2\nfor color, target_name in zip(colors, area_label):\n plt.scatter(p_data[area_list==target_name, 0], p_data[area_list==target_name, 1],\n alpha = .8,color = color, lw=lw, label = target_name)\n \n \nplt.legend(loc = 'best', shadow = False, scatterpoints = 1)\nplt.title('SNPs distribution')\n\nplt.show()\n'''\n###############################################################################################################\n\n#applying autoencoder and PCA\n\n#a_data is the decoded data run be autoencoder\n\n#encoding_weight colletct the weight functions of each hidden layer\nencoding_weight = []\npca = PCA(n_components = 1000)\np_data = pca.fit(e_sequence).transform(e_sequence)\nWeight = pca.components_.transpose()\nencoding_weight.append(Weight)\n\npca2 = PCA(n_components = 500)\np_data2 = pca2.fit(p_data).transform(p_data)\nWeight2 = pca2.components_.transpose()\nencoding_weight.append(Weight2)\n\npca3 = PCA(n_components = 50)\np_data3 = pca3.fit(p_data2).transform(p_data2)\nWeight3 = pca3.components_.transpose()\nencoding_weight.append(Weight3)\n\npca4 = PCA(n_components = 2)\np_data4 = pca4.fit(p_data3).transform(p_data3)\nWeight4 = pca4.components_.transpose()\nencoding_weight.append(Weight4)\n\n#print(len(encoding_weight))\n#print(encoding_weight[0].shape)\n#print(encoding_weight[1].shape)\n\na_data = auto3.deep_test(e_sequence.shape[1],e_sequence, e_sequence.shape[0], encoding_weight)\n'''\nap_data = auto2.deep_test(e_sequence.shape[1],e_sequence, e_sequence.shape[0])\n'''\nplt.figure()\nlw = 2\nplt.scatter(a_data[area_list==\"EUROPE\", 0], a_data[area_list==\"EUROPE\", 1],alpha = .8,color = \"blue\", lw=lw, label = \"EUROPE\")\nplt.legend(loc = 'best', shadow = False, scatterpoints = 1)\nplt.title('SNPs distribution with Relu')\n\n\nplt.show()\n\n\n'''\nr = rbm.RBM(num_visible = e_sequence.shape[1], num_hidden = 1000)\nr = r.run_visible(e_sequence)\n\nr1 = rbm.RBM(num_visible = e_sequence.shape[1], num_hidden = 500)\nr1 = r1.run_visible(r)\n\nr2 = rbm.RBM(num_visible = e_sequence.shape[1], num_hidden = 100)\nr2 = r2.run_visible(r1)\n\nr3 = rbm.RBM(num_visible = e_sequence.shape[1], num_hidden = 20)\nr3 = r3.run_visible(r2)\n\nr4 = rbm.RBM(num_visible = e_sequence.shape[1], num_hidden = 2)\nr4 = r4.run_visible(r3)\n'''\n\n'''\n\nplt.figure()\nlw = 2\nfor color, target_name in zip(colors, area_label):\n plt.scatter(ap_data[area_list==target_name, 0], ap_data[area_list==target_name, 1],alpha = .8,\n color = color, lw=lw, label = target_name)\nplt.legend(loc = 'best', shadow = False, scatterpoints = 1)\nplt.title('SNPs distribution with linear')\n\nplt.show()\n'''\n\n\n" }, { "alpha_fraction": 0.36811593174934387, "alphanum_fraction": 0.3942028880119324, "avg_line_length": 21.25806427001953, "blob_id": "9794b28738a272f8eca62f25834b876b3f3c681b", "content_id": "71d7f4e21572610b1b1182f76b3c0df9f6c1485b", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 690, "license_type": "no_license", "max_line_length": 47, "num_lines": 31, "path": "/base_calc.py", "repo_name": "FBoyang/DNN-SNPs-Analysis-", "src_encoding": "UTF-8", "text": "import random\nimport math\nimport itertools\n\n#A is 0, B is 1, C is 2, D is 3\ndef base_calc(array):\n print(array)\n #for i in array:\n # if(i=='A'):\n # a+=1\n # elif(i=='C'):\n c+=1\n # elif(i=='G'):\n g+=1\n #elif(i=='T'):\n t+=1\n # else:\n continue\n #label = ['A', 'G', 'C', 'T']\n #value = [a,c,g,t]\n #list1 = []\n #list2 = []\n #for (l,v) in itertools.izip(label, value):\n # if(v!=0 ):\n # if not list1:\n # list1.append(l)\n # list1.append(v)\n # else:\n # list2.append(l)\n # list2.append(v)\n return list1, list2\n" }, { "alpha_fraction": 0.4486328661441803, "alphanum_fraction": 0.47159543633461, "avg_line_length": 29.379032135009766, "blob_id": "874758a409a75da5bb2ee854d7920a7b2970b509", "content_id": "c4ea96a221d450d13481e5d67bc5727b8c4a8cd3", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 7534, "license_type": "no_license", "max_line_length": 110, "num_lines": 248, "path": "/raw_process.py", "repo_name": "FBoyang/DNN-SNPs-Analysis-", "src_encoding": "UTF-8", "text": "import numpy as np\nimport math\nimport random\nimport pandas as pd\nimport re\nfrom sklearn.decomposition import PCA\nimport matplotlib.pyplot as plt\nfrom sklearn.preprocessing import normalize\n\n########################################################################################\n# choose two biggest lists from the four input list and return\ndef Top_2(list1, list2, list3, list4):\n list_a = [list1, list2, list3, list4]\n \n count = 0\n#variable \"count\" count how many no empty list do we have\n for t_list in list_a:\n if t_list:\n count += 1\n else:\n break\n\n i = 1\n while i<count:\n x = list_a[i]\n j = i-1\n while j>=0 and list_a[j][1]<x[1]:\n list_a[j+1] = list_a[j]\n j = j-1\n list_a[j+1] = x\n i = i+1\n \n return list_a[0], list_a[1]\n \n\n \n \n \n\n\n\n\n\n########################################################################################\n# base_calc return the two list with base name and the number of one SNP\ndef base_calc(array):\n #print(array[0:10])\n a=c=g=t=0\n for i in array:\n #print(i)\n if(i=='A'):\n a+=1\n elif(i=='C'):\n c+=1\n elif(i=='G'):\n g+=1\n elif(i=='T'):\n t+=1\n else:\n continue\n label = ['A', 'G', 'C', 'T']\n value = [a,g,c,t]\n #print(value)\n list1 = []\n list2 = []\n list3 = []\n list4 = []\n for i in range(4):\n if(value[i]!=0 ):\n if not list1:\n list1.append(label[i])\n list1.append(value[i])\n elif not list2:\n list2.append(label[i])\n list2.append(value[i])\n elif not list3:\n list3.append(label[i])\n list3.append(value[i])\n else:\n list4.append(label[i])\n list4.append(value[i])\n #choose the two base list with the biggest value\n list1, list2 = Top_2(list1, list2, list3, list4) \n if not list2:\n list2.append(\"N\")\n list2.append(0)\n return list1, list2\n\n#####################################################################################\n#encode the base:\n#encode the base to 0 and 1 based on their frequency, for example if num(A)> num(C), then A should be encoded \n# as 0 and C as 1\ndef base_encoder(array, d_list):\n delete_list = []\n total_list = []\n first_column_done = 0\n #print(len(array[0]))\n #print(array.T[1])\n for i in range(len(array[0])-1):\n temp_list = []\n list1, list2 = base_calc(array.T[i])\n #print(i)\n \n if(list1[1]>list2[1]):\n Dominant_base = list1[0]\n else:\n Dominant_base = list2[0]\n #temp_list = np.array(array[:i]).tolist()\n #print(array.T[0])\n \n #if first_column_done is 0, let the total_list be the temp_list, else add temp_list to total_list\n \n \n for base in array.T[i]:\n #the ith row in array's transpose is equal to the ith coloumn in array\n if(base==Dominant_base):\n temp_list.append(0)\n elif(base=='?'):\n #if the symbol is question mark, treat it as -1\n temp_list.append(-1)\n else:\n #subordinate allele\n temp_list.append(1)\n #temp_list store the SNP for different individuals\n if(first_column_done==0):\n if(temp_list.count(-1)< len(temp_list)/3 and d_list[i] == 0):\n #print(temp_list.count(-1))\n total_list = np.asarray(temp_list)\n first_column_done +=1\n delete_list.append(0)\n else:\n delete_list.append(1)\n \n else:\n #if #? is smaller than 1/3 of the length, add it to the total array, else discard it\n if(temp_list.count(-1)< len(temp_list)/3 and d_list[i] == 0):\n total_list = np.vstack((total_list, np.asarray(temp_list)))\n delete_list.append(0)\n else:\n delete_list.append(1)\n \n return total_list.transpose(), delete_list\n \n \n \n#################################################################################\n\n# this is the main function, reading the raw data and store into a matrix\ncounter = 0\ncounter2 = 0\ncounter3 = 0\nfile = open(\"phased_HGDP+India+Africa_2810SNPs-regions1to36.stru\", \"r\") #open the dateset\narea_list = []\n\nfor i, line in enumerate(file):\n if i==5:\n for j in line:\n counter2+=1\n if(j==\" \"):\n counter+=1\n \n if(counter>=7):\n array_o = re.split(' |\\n',line[counter2:])\n #array_o = line[counter2:].split(\" |\\n\")\n #print(array_o)\n counter2=0\n counter=0\n counter3=0 \n area_list.append(line.split(\" \", 5)[4])\n # only split the first blank, take only the first word\n break\n if i> 5:\n for j in line:\n counter3+=1\n if(j==\" \"):\n counter+=1\n \n if(counter>=7):\n array2 = re.split(' |\\n',line[counter3:])\n #array2 = line[counter3:].split(\" |\\n\")\n counter3=0\n counter=0\n #print(len(array2))\n \n break\n #for h in range(len(array)):\n if(i%2!=0):\n #odd list\n area_list.append(line.split(\" \", 5)[4])\n array_o = np.vstack((array_o,array2))\n \n else:\n #even list\n if(i==6):\n array_e = array2\n else:\n array_e = np.vstack((array_e,array2))\n\nfile.close()\narea_list = np.array(area_list)\n\n#####################################################################################\n#print(area_list.shape)\n#print(area_list)\n#only the even list contain ?, so first process the even list\nlist0 = [0]*(len(array_o[0])-1)\n# encoded the base to 0 and 1 in chromosome 1\ncoded_array_e , list1 = base_encoder(array_e, list0)\n#print(list1)\n#encoded the base to 0 and q in chromosome 2\ncoded_array_o, list2 = base_encoder(array_o, list1)\n\n\nencoded_sequence1 = np.asmatrix(coded_array_o)\nencoded_sequence2 = np.asmatrix(coded_array_e)\n\n\n#print(encoded_sequence1)\n#the final encode sequence\ne_sequence_t = encoded_sequence1 + encoded_sequence2\n\n#cast the type of the data from int to float\ne_sequence_t = e_sequence_t.astype(float)\n#print(e_sequence_t.shape)\n#normalize the matrix by columns\n#e_sequence_t = normalize(e_sequence_t, norm = 'l1', axis = 0)\n\n#processing the matrix\n#step1: X = X - E(X)\n#step2: X = X/sigma\nfor i in range(e_sequence_t.shape[1]):\n sigma = (e_sequence_t[:, i]).std()\n mean = (e_sequence_t[:,i]).mean()\n e_sequence_t[:, i] -= mean\n e_sequence_t[:, i] /= sigma\n\n\n\n\n\n\ne_sequence = np.asarray(e_sequence_t)\n#this file store encoded SPNs information \nnp.savetxt('matrix.stru', e_sequence)\n#this file store the information of area of each individual\nfile2 = open('area.stru','w')\nfor item in area_list:\n file2.write(\"%s \"%item)\n" }, { "alpha_fraction": 0.5049699544906616, "alphanum_fraction": 0.5282856822013855, "avg_line_length": 29.520599365234375, "blob_id": "5ac7cee5c9a2082e63d61088afec5fc72bff5bc4", "content_id": "c1232ac8f4f70e55821c93e9a9f6e474348d6796", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 8149, "license_type": "no_license", "max_line_length": 120, "num_lines": 267, "path": "/gen2.py", "repo_name": "FBoyang/DNN-SNPs-Analysis-", "src_encoding": "UTF-8", "text": "import numpy as np\nimport math\nimport random\nimport pandas as pd\nimport re\nfrom sklearn.decomposition import PCA\nimport matplotlib.pyplot as plt\nimport tensorflow as tf\nimport os\nos.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'\n\n\n########################################################################################\n# base_calc return the two list with base name and the number of one SNP\ndef base_calc(array):\n #print(array[0:10])\n a=c=g=t=0\n for i in array:\n #print(i)\n if(i=='A'):\n a+=1\n elif(i=='C'):\n c+=1\n elif(i=='G'):\n g+=1\n elif(i=='T'):\n t+=1\n else:\n continue\n label = ['A', 'G', 'C', 'T']\n value = [a,g,c,t]\n #print(value)\n list1 = []\n list2 = []\n for i in range(4):\n if(value[i]!=0 ):\n if not list1:\n list1.append(label[i])\n list1.append(value[i])\n else:\n list2.append(label[i])\n list2.append(value[i])\n if not list2:\n list2.append(\"N\")\n list2.append(0)\n #print(list1,list2)\n return list1, list2\n\n#####################################################################################\n#encode the base:\ndef base_encoder(array):\n total_list = []\n #print(len(array[0]))\n #print(array.T[1])\n for i in range(len(array[0])-1):\n temp_list = []\n list1, list2 = base_calc(array.T[i])\n #print(i)\n #print(list1,list2)\n if(list1[1]>list2[1]):\n Dominant_base = list1[0]\n else:\n Dominant_base = list2[0]\n #temp_list = np.array(array[:i]).tolist()\n #print(array.T[0])\n for base in array.T[i]:\n #the ith row in array's transpose is equal to the ith coloumn in array\n if(base==Dominant_base or base==\"?\"):\n temp_list.append(0)\n else:\n temp_list.append(1)\n #temp_list store the SNP for different individuals\n if (i==0):\n total_list = np.asarray(temp_list)\n else:\n total_list = np.vstack((total_list, np.asarray(temp_list)))\n return total_list.transpose()\n \n \n \n#################################################################################\n\n\ncounter = 0\ncounter2 = 0\ncounter3 = 0\nfile = open(\"phased_HGDP+India+Africa_2810SNPs-regions1to36.stru\", \"r\")\nfor i, line in enumerate(file):\n if i==5:\n for j in line:\n counter2+=1\n if(j==\" \"):\n counter+=1\n if(counter>=7):\n array_o = re.split(' |\\n',line[counter2:])\n #array_o = line[counter2:].split(\" |\\n\")\n #print(array_o)\n counter2=0\n counter=0\n counter3=0\n break\n if i> 5:\n for j in line:\n counter3+=1\n if(j==\" \"):\n counter+=1\n if(counter>=7):\n array2 = re.split(' |\\n',line[counter3:])\n #array2 = line[counter3:].split(\" |\\n\")\n counter3=0\n counter=0\n #print(len(array2))\n break\n #for h in range(len(array)):\n if(i%2!=0):\n array_o = np.vstack((array_o,array2))\n else:\n if(i==6):\n array_e = array2\n else:\n array_e = np.vstack((array_e,array2))\n \n##################################################################################### \n \n \nencoded_sequence1 = np.asmatrix(base_encoder(array_o))\nencoded_sequence2 = np.asmatrix(base_encoder(array_e))\n#print(encoded_sequence1)\n#the final encode sequence\ne_sequence = encoded_sequence1 + encoded_sequence2\n\n#######################################################################################\n#applying PCA\n\npca = PCA(n_components = 2)\np_data = pca.fit(e_sequence).transform(e_sequence)\ntarget_names = [\"normal\", \"abnormal\",\"extrem_abnormal\"]\nprint('expalined variance ratio (first two components): %s' % str(pca.explained_variance_ratio_))\n\n#plt.figure()\n#colors = ['navy', 'turquoise', 'darkorange']\n#lw = 2\n\n#for color, i, target_name in zip(colors, [0,1,2], target_names):\n#plt.scatter(p_data[e_sequence==i, 0], p_data[e_sequence==i,1], color = color, alpha = .8, lw = lw, label = target_name)\n#plt.legend(loc = 'best', shadow = False, scatterpoints = 1)\n#plt.title('PCA of Gene dataset')\n\n################################################################################################################\n\ndef create(x, layer_sizes):\n\n\t# Build the encoding layers\n\tnext_layer_input = x\n\n\tencoding_matrices = []\n\tfor dim in layer_sizes:\n\t\tinput_dim = int(next_layer_input.get_shape()[1])\n\n\t\t# Initialize W using random values in interval [-1/sqrt(n) , 1/sqrt(n)]\n\t\tW = tf.Variable(tf.random_uniform([input_dim, dim], -1.0 / math.sqrt(input_dim), 1.0 / math.sqrt(input_dim)))\n\n\t\t# Initialize b to zero\n\t\tb = tf.Variable(tf.zeros([dim]))\n\n\t\t# We are going to use tied-weights so store the W matrix for later reference.\n\t\tencoding_matrices.append(W)\n\n\t\toutput = tf.nn.tanh(tf.matmul(next_layer_input,W) + b)\n\n\t\t# the input into the next layer is the output of this layer\n\t\tnext_layer_input = output\n\n\t# The fully encoded x value is now stored in the next_layer_input\n\tencoded_x = next_layer_input\n\n\t# build the reconstruction layers by reversing the reductions\n\tlayer_sizes.reverse()\n\tencoding_matrices.reverse()\n\n\n\tfor i, dim in enumerate(layer_sizes[1:] + [ int(x.get_shape()[1])]) :\n\t\t# we are using tied weights, so just lookup the encoding matrix for this step and transpose it\n\t\tW = tf.transpose(encoding_matrices[i])\n\t\tb = tf.Variable(tf.zeros([dim]))\n\t\toutput = tf.nn.tanh(tf.matmul(next_layer_input,W) + b)\n\t\tnext_layer_input = output\n\n\t# the fully encoded and reconstructed value of x is here:\n\treconstructed_x = next_layer_input\n\n\treturn {\n\t\t'encoded': encoded_x,\n\t\t'decoded': reconstructed_x,\n\t\t'cost' : tf.sqrt(tf.reduce_mean(tf.square(x-reconstructed_x)))\n\t}\n\n\"\"\"def simple_test():\n\tsess = tf.Session()\n\tx = tf.placeholder(\"float\", [None, 4])\n\tautoencoder = create(x, [2])\n\tinit = tf.initialize_all_variables()\n\tsess.run(init)\n\ttrain_step = tf.train.GradientDescentOptimizer(0.01).minimize(autoencoder['cost'])\n\n\n\t# Our dataset consists of two centers with gaussian noise w/ sigma = 0.1\n\tc1 = np.array([0,0,0.5,0])\n\tc2 = np.array([0.5,0,0,0])\n\n\t# do 1000 training steps\n\tfor i in range(2000):\n\t\t# make a batch of 100:\n\t\tbatch = []\n\t\tfor j in range(100):\n\t\t\t# pick a random centroid\n\t\t\tif (random.random() > 0.5):\n\t\t\t\tvec = c1\n\t\t\telse:\n\t\t\t\tvec = c2\n\t\t\tbatch.append(np.random.normal(vec, 0.1))\n\t\tsess.run(train_step, feed_dict={x: np.array(batch)})\n\t\tif i % 100 == 0:\n\t\t\tprint i, \" cost\", sess.run(autoencoder['cost'], feed_dict={x: batch})\n\"\"\"\n\ndef deep_test():\n\tsess = tf.Session()\n\tstart_dim = len(e_sequence[0])\n\tx = tf.placeholder(\"float\", [None, start_dim])\n\tautoencoder = create(x, [4, 3, 2])\n\tinit = tf.initialize_all_variables()\n\tsess.run(init)\n\ttrain_step = tf.train.GradientDescentOptimizer(0.5).minimize(autoencoder['cost'])\n\n\n\t# Our dataset consists of two centers with gaussian noise w/ sigma = 0.1\n\tc1 = e_sequence[0]\n #c1 = np.zeros(start_dim)\n\t#c1[0] = 1\n\n\t#print c1\n\n\t#c2 = np.zeros(start_dim)\n\t#c2[1] = 1\n\n\t# do 1000 training steps\n #for i in range(len(e_sequence)):\n\t\t# make a batch of len(e_sequence):\n\t\t#batch = []\n\t\t#for j in range(1):\n\t\t\t# pick a random centroid\n\t\t\t#if (random.random() > 0.5):\n\t\t\t#\tvec = c1\n\t\t\t#else:\n\t\t\t#\tvec = c2\n \t\t\t#batch.append(np.random.normal(vec, 0.1))\n\t\t#sess.run(train_step, feed_dict={x: np.array(batch)})\n\n \n\t\t#if i % 100 == 0:\n\tbatch = e_sequence\n\tprint (len(e_sequence, \" cost\", sess.run(autoencoder['cost'], feed_dict={x: batch})))\n\tprint (len(e_sequence), \" original\", batch[0])\n\tprint (len(e_seuqnce), \" decoded\", sess.run(autoencoder['decoded'], feed_dict={x: batch}))\nif __name__ == '__main__':\n deep_test()\n" } ]
9
ChaseReineke/dojo_survey
https://github.com/ChaseReineke/dojo_survey
be596fcdbdfbd88ac9f2806c500ce6bc50ec89bf
e517b57e0c6fdebbc278c10b3c7bd723aea0d93c
11d33cf1dc88866a0c3f2eb428bcd4156e960e19
refs/heads/master
2023-02-03T18:36:50.764123
2020-12-23T17:18:33
2020-12-23T17:18:33
323,961,244
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.6681034564971924, "alphanum_fraction": 0.6681034564971924, "avg_line_length": 32.28571319580078, "blob_id": "de7abe1c8a0acb9a6f30363a6aafa98188335d6d", "content_id": "d9bc768958502d4efe3a92f84d0dad3d2ce1f919", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 232, "license_type": "no_license", "max_line_length": 71, "num_lines": 7, "path": "/main/urls.py", "repo_name": "ChaseReineke/dojo_survey", "src_encoding": "UTF-8", "text": "from django.urls import path \nfrom . import views\nurlpatterns = [\n path('', views.index),\n path('processing_form_data', views.processing_form_data),\n path('success/<name>/<int:age>/<email>/<password>', views.success),\n]" }, { "alpha_fraction": 0.6405023336410522, "alphanum_fraction": 0.6405023336410522, "avg_line_length": 29.380952835083008, "blob_id": "369426f665d4cf0b204b1e4bf5cac8c46782febc", "content_id": "197f6aff0ba8178c1fc0d75c02ab63e8260f83b9", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 637, "license_type": "no_license", "max_line_length": 64, "num_lines": 21, "path": "/main/views.py", "repo_name": "ChaseReineke/dojo_survey", "src_encoding": "UTF-8", "text": "from django.shortcuts import render, redirect, HttpResponse\ndef index(request):\n return render(request, \"index.html\")\n\ndef processing_form_data(request):\n print(\"Processing form data\")\n print(request.POST)\n name = request.POST['name']\n age = request.POST['age']\n email = request.POST['email']\n password = request.POST['password']\n return redirect(f'/success/{name}/{age}/{email}/{password}')\n\ndef success(request, name, age, email, password):\n context = {\n 'name': name,\n 'age': age,\n 'email': email,\n 'password': password\n }\n return render(request, \"success.html\", context)" } ]
2
pjg303/RedditAnalysis
https://github.com/pjg303/RedditAnalysis
bdf900559a24e22039a0071dad66057ad9b15031
9badb3a81586191cfabbf236b2c7ed02b050f314
d714e90ea7bcbb53dab0dfa92f036dab6a17c8d0
refs/heads/master
2020-12-08T05:48:51.164997
2020-01-09T21:00:57
2020-01-09T21:00:57
232,903,771
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.8225806355476379, "alphanum_fraction": 0.8225806355476379, "avg_line_length": 30, "blob_id": "5ea8b5b8418ffa90a8e72989ab5a55e2ba1a2b1c", "content_id": "ef9daee2e6cf8cca56a2651af8b85a0914aa2f69", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 62, "license_type": "no_license", "max_line_length": 44, "num_lines": 2, "path": "/README.md", "repo_name": "pjg303/RedditAnalysis", "src_encoding": "UTF-8", "text": "# RedditAnalysis\nAnalysis based on data gathered from Reddit.\n" }, { "alpha_fraction": 0.6484607458114624, "alphanum_fraction": 0.6628599762916565, "avg_line_length": 42.57777786254883, "blob_id": "cb0489aeddeab01134ab9f1afeb8dac358ea0364", "content_id": "76bcb088e346d110214c2eea636b10f24456a18f", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2014, "license_type": "no_license", "max_line_length": 119, "num_lines": 45, "path": "/TopRedditors.py", "repo_name": "pjg303/RedditAnalysis", "src_encoding": "UTF-8", "text": "import praw\r\n\r\nimport seaborn as sns\r\nimport matplotlib.pyplot as plt\r\n\r\nfrom collections import defaultdict\r\n\r\n#Providing secret values to establish connection with Reddit\r\nreddit = praw.Reddit(client_id='Client_ID', client_secret='Client_Secret', user_agent='AppName')\r\n\r\n#Initializing a list of redditors fow whom we are trying to find data.\r\nredditors = [reddit.redditor('GallowBoob'),\r\n reddit.redditor('mvea'),\r\n reddit.redditor('TooShiftyForYou'),\r\n reddit.redditor('BunyipPouch'),\r\n reddit.redditor('KevlarYarmulke')]\r\n\r\n\r\n#Start data extraction & graphical representation\r\nfig, ax = plt.subplots(5, 2, figsize=(60, 60))\r\n\r\nfor i, redditor in enumerate(redditors):\r\n print(\"getting data for\", redditor)\r\n subreddit_count = defaultdict(int)\r\n comment_count = defaultdict(int)\r\n for submission in redditor.submissions.new(limit=None):\r\n subreddit_count[submission.subreddit_name_prefixed] += 1\r\n\r\n for comment in redditor.comments.new(limit=None):\r\n comment_count[comment.subreddit_name_prefixed] += 1\r\n\r\n splot = sns.barplot(x=list(subreddit_count.keys()), y=list(subreddit_count.values()), ax=ax[i][0], palette='Blues')\r\n cplot = sns.barplot(x=list(comment_count.keys()), y=list(comment_count.values()), ax=ax[i][1], palette='Reds')\r\n ax[i, 0].set_title(\"u/\" + str(redditor) + \" Posts\", fontsize=25)\r\n ax[i, 1].set_title(\"u/\" + str(redditor) + \" Comments\", fontsize=25)\r\n splot.set_xticklabels(splot.get_xticklabels(), rotation=45, horizontalalignment='right')\r\n cplot.set_xticklabels(cplot.get_xticklabels(), rotation=45, horizontalalignment='right')\r\n for p in splot.patches:\r\n height = p.get_height()\r\n splot.text(p.get_x() + p.get_width() / 2, height, \"{:1.0f}\".format(height), ha=\"center\")\r\n for p in cplot.patches:\r\n height = p.get_height()\r\n cplot.text(p.get_x() + p.get_width() / 2, height, \"{:1.0f}\".format(height), ha=\"center\")\r\n\r\nplt.savefig('redrep', dpi=200)\r\n\r\n\r\n\r\n\r\n" } ]
2
Nissan-GTR/python-http
https://github.com/Nissan-GTR/python-http
7795778a4691d1ec96a9beee68b8d517948f8890
97e4f7e906c55c5f85c049d9201210b4e2f208f9
7dd37409fb12761f2cfb13e9f7d7e824c2a8b305
refs/heads/master
2020-05-16T15:53:22.336610
2019-04-24T04:36:31
2019-04-24T04:36:31
183,145,049
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.7894737124443054, "alphanum_fraction": 0.7894737124443054, "avg_line_length": 24.33333396911621, "blob_id": "7c601bdab2e6dd84648ec7de4590a10958c7ebff", "content_id": "2e4541315d09f47b489522f25952d3fd26df9fc9", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 76, "license_type": "no_license", "max_line_length": 60, "num_lines": 3, "path": "/README.md", "repo_name": "Nissan-GTR/python-http", "src_encoding": "UTF-8", "text": "# python-http\n\nSimple python http server for demo terraform code-pipe line.\n" }, { "alpha_fraction": 0.5574803352355957, "alphanum_fraction": 0.5653543472290039, "avg_line_length": 24.360000610351562, "blob_id": "e5c1ec73eac444df970e225b9dfd77e894513e25", "content_id": "b81739ed356275584cb9d40aecc0ae3d409223f0", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 635, "license_type": "no_license", "max_line_length": 58, "num_lines": 25, "path": "/pyscripts/simpleServer.py", "repo_name": "Nissan-GTR/python-http", "src_encoding": "UTF-8", "text": "#### Balu added File output\n\n#!/usr/bin/python3\n\nimport http.server\nimport socketserver\n\nport = 9966\nHandler = http.server.SimpleHTTPRequestHandler\n\n#f = open(\"/var/tmp/pyServer.log\", \"w\");\n#f.write(\"Trying to start server at port: \\n\")\n#f.write(\"Hello From RLM \")\n#f.close()\n\nprint(\"==========================================\")\nprint(\"Trying to start server at port: \", port)\nprint(\"Hello From RLM \")\nprint(\"==========================================\")\n\nwith socketserver.TCPServer((\"\", port), Handler) as httpd:\n print(\"Server started at port: \", port)\n httpd.serve_forever()\n\nprint(\"========== Server Ended ===============\")\n\n" }, { "alpha_fraction": 0.6610169410705566, "alphanum_fraction": 0.6694915294647217, "avg_line_length": 24.285715103149414, "blob_id": "84993e0657083b937f8a702dd782548af55092a3", "content_id": "01c16eca532f1796b052ed91df892522691bc78b", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Shell", "length_bytes": 354, "license_type": "no_license", "max_line_length": 65, "num_lines": 14, "path": "/pyscripts/kickoffserver.sh", "repo_name": "Nissan-GTR/python-http", "src_encoding": "UTF-8", "text": "#!/bin/sh\n\nset -x\n\nLOC=/var/tmp/pyhttp/pyscripts\n\nlog=\"/tmp/serverLog.log.$$\"\necho \"Checking install \" | tee -a $log\necho \"PWD is: `pwd` \" | tee -a $log\necho \"==> Starting Python Server in backgroud ==> \" | tee -a $log\n\ncp $LOC/index.html /opt/codedeploy-agent\ncp $LOC/banner.png /opt/codedeploy-agent\n/usr/bin/python3 $LOC/simpleServer.py >>$log 2>&1 &\n" }, { "alpha_fraction": 0.6929460763931274, "alphanum_fraction": 0.726141095161438, "avg_line_length": 25.77777862548828, "blob_id": "90054d50bb088d91fbdf45e4b45ef70320903702", "content_id": "da8e1f0ae834767e14136d093512b239358311e1", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Shell", "length_bytes": 241, "license_type": "no_license", "max_line_length": 73, "num_lines": 9, "path": "/pyscripts/installSoft.sh", "repo_name": "Nissan-GTR/python-http", "src_encoding": "UTF-8", "text": "#!/bin/sh\n\nlog=\"/tmp/install.log.$$\"\necho \"Installing SOFT \" | tee -a $log\n\n#sudo yum install python36 python36-virtualenv python36-pip | tee -a $log\n#virtualenv --python=python3.5 .venv\n#source .venv/bin/activate\n#sudo yum install sendmail\n" }, { "alpha_fraction": 0.606215238571167, "alphanum_fraction": 0.6103895902633667, "avg_line_length": 27.36842155456543, "blob_id": "35096f3479873625137b1fdc6b70449d9c678409", "content_id": "a41f18cbd46f48306f43f8e863073f53f887089a", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Java", "length_bytes": 2156, "license_type": "no_license", "max_line_length": 119, "num_lines": 76, "path": "/src/main/java/com/gt/zaz/OPSWelcomeServlet.java", "repo_name": "Nissan-GTR/python-http", "src_encoding": "UTF-8", "text": "package com.gt.zaz;\n\nimport java.io.IOException;\nimport java.io.PrintWriter;\n\nimport javax.servlet.ServletException;\nimport javax.servlet.http.HttpServlet;\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpServletResponse;\n\n/**\n * Servlet implementation class OPSWelcomeServlet\n */\npublic class OPSWelcomeServlet extends HttpServlet {\n\tprivate static final long serialVersionUID = 1L;\n\n /**\n * Default constructor. \n */\n public OPSWelcomeServlet() {\n \n }\n\n\t/**\n\t * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)\n\t */\n\tprotected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {\n\t\t\n\n\t\t\n\t\t// Set response content type\n\t response.setContentType(\"text/html\");\n\n\t PrintWriter out = response.getWriter();\n\t String title = \"Welcome Mate !!!! \";\n\t \n\t Welcome come = new Welcome();\n\t \t String fname = request.getParameter(\"first_name\") ;\n\t \t String lname = request.getParameter(\"last_name\") ;\n\t \t String gender = request.getParameter(\"gender\") ;\n\t \t\n\t String greets = come.sayHola(fname + \" \" + lname, gender);\n\t \t\n\t \n\t String docType =\n\t \"<!doctype html public \\\"-//w3c//dtd html 4.0 \" + \"transitional//en\\\">\\n\";\n\t \n\t \n\t \n\t out.println(docType +\n\t \"<html>\\n\" +\n\t \"<head><title>\" + title + \"</title></head>\\n\" +\n\t \"<body bgcolor = \\\"#f0f0f0\\\">\\n\" +\n\t \"<h1 align = \\\"center\\\">\" + title + \"</h1>\\n\" +\n\t \"<ul>\\n\" +\n\t \" Greetings : \"\n\t + greets + \"\\n\" +\n\t \"</ul>\\n\" +\n\t \"</body>\" +\n\t \"</html>\"\n\t );\n\t\t\n\t\tresponse.getWriter().append(\"Served at: \").append(request.getContextPath());\n\t\n\t\tresponse.getWriter().append(\"Served at: \").append(request.getContextPath());\n\t}\n\n\t/**\n\t * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)\n\t */\n\tprotected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {\n\t\t\n\t\tdoGet(request, response);\n\t}\n\n}\n" }, { "alpha_fraction": 0.5539906024932861, "alphanum_fraction": 0.5633803009986877, "avg_line_length": 16.040000915527344, "blob_id": "b47badf6d3dcd61ac3d4bddc111199bbc4fe3b27", "content_id": "991f4cb7a28a0ee0dc7d9dcd059808feda9de3e8", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Shell", "length_bytes": 426, "license_type": "no_license", "max_line_length": 72, "num_lines": 25, "path": "/pyscripts/stopPyServer.sh", "repo_name": "Nissan-GTR/python-http", "src_encoding": "UTF-8", "text": "#!/bin/sh\n\nPS=`ps -ef | grep simpleServer | grep -v \"grep\" | awk '{print $2 , $3}'`\necho \"PS of python http-server $PS \"\n\nLOC=\"/var/tmp\"\nRMDIR=pyhttp\n\nif [ -z \"$PS\" ]\nthen\n echo \"Python server is already DOWN \"\nelse\n echo \"Killing these PS : $PS \"\n kill -9 $PS\nfi\n\nif [ -d \"$LOC\" ]\nthen\n echo \"cleaning UP DIR $LOC \"\n cd $LOC\n rm -rf $RMDIR\nelse\n echo \"Killing these PS : $PS \"\n kill -9 $PS\nfi\n" }, { "alpha_fraction": 0.672897219657898, "alphanum_fraction": 0.672897219657898, "avg_line_length": 52.5, "blob_id": "113e85487895ad423afcd4d218291461dd6106df", "content_id": "e35082e894514238235e0f62fb4780126d93d4d9", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 107, "license_type": "no_license", "max_line_length": 63, "num_lines": 2, "path": "/readMe.md", "repo_name": "Nissan-GTR/python-http", "src_encoding": "UTF-8", "text": "### AWS - Code Commit by Balu.. OCELOTs are kool.. trust me !!!\n### Sample file checkin to AWS code commit\n" }, { "alpha_fraction": 0.7463414669036865, "alphanum_fraction": 0.7560975551605225, "avg_line_length": 21.77777862548828, "blob_id": "b3db6535b7c89ce97fd191bdd265b5cf694fbc80", "content_id": "154e434c611ba084483487f80f2cf6e7d3457528", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Dockerfile", "length_bytes": 205, "license_type": "no_license", "max_line_length": 55, "num_lines": 9, "path": "/Dockerfile", "repo_name": "Nissan-GTR/python-http", "src_encoding": "UTF-8", "text": "# Pull base image\nFrom tomcat:8.0\n\n# Maintainer\nMAINTAINER \"Balu clever.gtr@gmail.com\"\n\n# Copy to images tomcat path\nADD tomcat-users.xml /usr/local/tomcat/conf/\nADD ./target/OPSWebappGT.war /usr/local/tomcat/webapps/\n" } ]
8
My-Novel-Management/storybuilderunite
https://github.com/My-Novel-Management/storybuilderunite
a2bae6f3d79a8bc22d141663a2b09dde12556299
c003d3451e237f574c54a87ea7d4fd8da8e833be
133dbe47cf8d64d11dfaf2a1109f472c67f56136
refs/heads/master
2021-07-13T16:35:31.922363
2021-01-29T00:38:04
2021-01-29T00:38:04
230,050,595
1
0
MIT
2019-12-25T06:05:42
2020-05-18T08:34:54
2020-06-04T04:46:40
Python
[ { "alpha_fraction": 0.5771812200546265, "alphanum_fraction": 0.5782997608184814, "avg_line_length": 29.79310417175293, "blob_id": "a2e97456d0de6da823944ff161b2dc244abe5367", "content_id": "d079544e6d387da8471fa3d2f5a488e0836aa1a2", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 894, "license_type": "permissive", "max_line_length": 69, "num_lines": 29, "path": "/tests/objects/test_item.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nItem class test\n===============\n'''\n\nimport unittest\nfrom tests.testutils import print_testtitle, validate_with_fail\nfrom builder.objects import item as itm\n\n\nclass ItemTest(unittest.TestCase):\n\n @classmethod\n def setUpClass(cls):\n print_testtitle(itm.__name__, 'Item class')\n\n def test_instance(self):\n data = [\n # (name, cate, info, expect, exp_cate, exp_info)\n (True, 'test', 'T', 'a note', 'test', 'T', 'a note'),\n ]\n def checker(name, cate, info, expect, exp_cate, exp_info):\n tmp = itm.Item(name, cate, info)\n self.assertIsInstance(tmp, itm.Item)\n self.assertEqual(tmp.name, expect)\n self.assertEqual(tmp.category, exp_cate)\n self.assertEqual(tmp.info, exp_info)\n validate_with_fail(self, 'class instance', checker, data)\n\n" }, { "alpha_fraction": 0.6115702390670776, "alphanum_fraction": 0.6157024502754211, "avg_line_length": 22, "blob_id": "c3ebf879988300a341cd85643e3dfd0b2316c09a", "content_id": "021e4ee09faeb4fab6ee59c25850ffae1e72587e", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 484, "license_type": "permissive", "max_line_length": 63, "num_lines": 21, "path": "/tests/datatypes/test_outputmode.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nOutputMode Enum class test\n==========================\n'''\n\nimport unittest\nfrom tests.testutils import print_testtitle, validate_with_fail\nfrom builder.datatypes import outputmode as om\n\n\nclass OutputModeTest(unittest.TestCase):\n\n @classmethod\n def setUpClass(cls):\n print_testtitle(om.__name__, 'OutputMode Enum class')\n\n def test_instance(self):\n self.assertEqual(\n len(om.OutputMode.get_all()),\n 2)\n\n" }, { "alpha_fraction": 0.5752809047698975, "alphanum_fraction": 0.5764045119285583, "avg_line_length": 29.65517234802246, "blob_id": "5dea911120bb924811db073f34e1c6371a7da2cf", "content_id": "25e2631127f35a4aa77654355e04bfe83eced216", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 890, "license_type": "permissive", "max_line_length": 69, "num_lines": 29, "path": "/tests/objects/test_word.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nWord class test\n===============\n'''\n\nimport unittest\nfrom tests.testutils import print_testtitle, validate_with_fail\nfrom builder.objects import word as wd\n\n\nclass WordTest(unittest.TestCase):\n\n @classmethod\n def setUpClass(cls):\n print_testtitle(wd.__name__, 'Word class')\n\n def test_instance(self):\n data = [\n # (name, cate, info, expect, exp_cate, exp_info)\n (True, 'test', 'T', 'a note', 'test', 'T', 'a note'),\n ]\n def checker(name, cate, info, expect, exp_cate, exp_info):\n tmp = wd.Word(name, cate, info)\n self.assertIsInstance(tmp, wd.Word)\n self.assertEqual(tmp.name, expect)\n self.assertEqual(tmp.category, exp_cate)\n self.assertEqual(tmp.info, exp_info)\n validate_with_fail(self, 'class instance', checker, data)\n\n" }, { "alpha_fraction": 0.5605413317680359, "alphanum_fraction": 0.5641025900840759, "avg_line_length": 30.909090042114258, "blob_id": "1e35a5bd04ac363bb946b045081dd62f43606396", "content_id": "ea1cca227d01477366a0a07eeae245a742574cff", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1476, "license_type": "permissive", "max_line_length": 80, "num_lines": 44, "path": "/tests/core/test_tagreplacer.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nTagReplacer class test\n======================\n'''\n\nimport unittest\nfrom tests.testutils import print_testtitle, validate_with_fail\nfrom builder.commands.scode import SCode, SCmd\nfrom builder.containers.chapter import Chapter\nfrom builder.containers.episode import Episode\nfrom builder.containers.scene import Scene\nfrom builder.objects.person import Person\nfrom builder.core import tagreplacer as tp\n\n\nclass TagReplacerTest(unittest.TestCase):\n\n @classmethod\n def setUpClass(cls):\n print_testtitle(tp.__name__, 'TagReplacer class')\n\n def setUp(self):\n self.taro = Person('太郎', '', 17,(1,1), 'male', 'student',\n 'me:俺')\n\n def test_instance(self):\n tmp = tp.TagReplacer()\n self.assertIsInstance(tmp, tp.TagReplacer)\n\n def test_replaced_scode(self):\n data = [\n # src, tags, expect\n (True, SCode(None, SCmd.DO, ('$taroは話した',),),\n {'taro': '太郎'},\n ('太郎は話した',),),\n (True, SCode(self.taro, SCmd.DO, ('$meは話した', '$herは逃げた'),),\n {'her': '華子'},\n ('俺は話した','華子は逃げた'),),\n ]\n validate_with_fail(self, 'replaced_scode',\n lambda src, tags, expect: self.assertEqual(\n tp.TagReplacer()._replaced_scode(src, tags).script, expect),\n data)\n" }, { "alpha_fraction": 0.6145750880241394, "alphanum_fraction": 0.614838182926178, "avg_line_length": 26.54347801208496, "blob_id": "31cfdbc9d97f1a3fd8e9824bc5743eb512accab0", "content_id": "d6a0d20ec258dd21403590355014913c2bafecea", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3801, "license_type": "permissive", "max_line_length": 111, "num_lines": 138, "path": "/builder/utils/assertion.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nCustom assertion methods\n========================\n\nUsage:\n\n >>> def foo(val: str):\n _val = assertion.is_str(val) # validated string type\n'''\n\n__all__ = ('is_between',\n 'is_bool', 'is_dict', 'is_instance', 'is_int', 'is_int_or_str',\n 'is_list', 'is_listlike', 'is_str', 'is_subclass', 'is_tuple',\n 'is_various_types',\n 'is_valid_length',\n )\n\nfrom typing import Any, Type, TypeVar\n\n\n# alias\nT = TypeVar('T')\n\n\n# constant\n_ERR_INVALID_TYPE = \"{} must be {} type.\"\n\n\n#\n# utility methods (is checker)\n#\n\ndef is_between(val: int, maxnum: int, minnum: int) -> int:\n ''' Validate a value between max-number and min-number.\n '''\n assert isinstance(val, int)\n assert isinstance(maxnum, int)\n assert isinstance(minnum, int)\n assert val <= maxnum and val >= minnum, f\"{val} must be between {maxnum} to {minnum}.\"\n return val\n\n\ndef is_bool(val: bool) -> bool:\n ''' Validate a value whether is a type of bool.\n '''\n assert isinstance(val, bool), _ERR_INVALID_TYPE.format(_typename_of(val), 'bool')\n return val\n\n\ndef is_dict(val: dict) -> dict:\n ''' Validate a value whether is a type of dict.\n '''\n assert isinstance(val, dict), _ERR_INVALID_TYPE.format(_typename_of(val), 'dict')\n return val\n\n\ndef is_instance(val: T, cls: Type[T]) -> T:\n ''' Validate a value whether is a type of `Type`.\n '''\n assert isinstance(val, cls), _ERR_INVALID_TYPE.format(_typename_of(val), type(cls))\n return val\n\n\ndef is_int(val: int) -> int:\n ''' Validate a value whether is a type of int.\n '''\n assert isinstance(val, int), _ERR_INVALID_TYPE.format(_typename_of(val), 'int')\n return val\n\n\ndef is_int_or_float(val: (int, float)) -> (int, float):\n ''' Validate a value whether is a type of int or float.\n '''\n assert isinstance(val, (int, float)), _ERR_INVALID_TYPE(_typename_of(val), 'int or float')\n return val\n\ndef is_int_or_str(val: (int, str)) -> (int, str):\n ''' Validate a value whether is a type of int or str.\n '''\n assert isinstance(val, (int, str)), _ERR_INVALID_TYPE.format(_typename_of(val), 'int or str')\n return val\n\n\ndef is_list(val: list) -> list:\n ''' Validate a value whether is a type of list.\n '''\n assert isinstance(val, list), _ERR_INVALID_TYPE.format(_typename_of(val), 'list')\n return val\n\ndef is_listlike(val: (list, tuple)) -> (list, tuple):\n ''' Validate a value whether is a type of list or tuple.\n '''\n assert isinstance(val, list) or isinstance(val, tuple), _ERR_INVALID_TYPE.format(_typename_of(val), 'list')\n return val\n\ndef is_str(val: str) -> str:\n ''' Validate a value whether is a type of str.\n '''\n assert isinstance(val, str), _ERR_INVALID_TYPE.format(_typename_of(val), 'str')\n return val\n\n\ndef is_subclass(val: T, cls: Type[T]) -> Any:\n ''' Validate a value whether is a subclass of `Type`\n '''\n assert issubclass(type(val), cls), _ERR_INVALID_TYPE.format(_typename_of(val), f\"subclass of {type(cls)}\")\n return val\n\n\ndef is_tuple(val: tuple) -> tuple:\n ''' Validate a value whether is a type of tuple.\n '''\n assert isinstance(val, tuple), _ERR_INVALID_TYPE.format(_typename_of(val), 'tuple')\n return val\n\ndef is_various_types(val: Any, types: tuple) -> Any:\n ''' Validate a value whether is a type of any `Type`s.\n '''\n assert isinstance(val, types), _ERR_INVALID_TYPE.format(_typename_of(val), f'{types}')\n return val\n\n#\n# utility methods (validate)\n#\n\ndef is_valid_length(val: (list, tuple), length: int) -> (list, tuple):\n ''' Validate a value has the length.\n '''\n assert len(val) == length, f\"Invalid the length of {val}: {len(val)}\"\n return val\n\n\n#\n# private methods\n#\ndef _typename_of(val: Any) -> str:\n return val.__class__.__name__\n" }, { "alpha_fraction": 0.4359828531742096, "alphanum_fraction": 0.45406949520111084, "avg_line_length": 39.92856979370117, "blob_id": "633e1ec98a1bfafce59775e0af4fe427de8e8f09", "content_id": "c8278aadef07dc8abe51b212cae635540f6b6143", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 6303, "license_type": "permissive", "max_line_length": 81, "num_lines": 154, "path": "/tests/tools/test_counter.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nCounter class test\n==================\n'''\n\nimport unittest\nfrom tests.testutils import print_testtitle, validate_with_fail\nfrom builder.commands.scode import SCode, SCmd\nfrom builder.containers.chapter import Chapter\nfrom builder.containers.episode import Episode\nfrom builder.containers.scene import Scene\nfrom builder.containers.story import Story\nfrom builder.tools import counter as cnt\n\n\nclass CounterTest(unittest.TestCase):\n\n @classmethod\n def setUpClass(cls):\n print_testtitle(cnt.__name__, 'Counter class')\n\n def test_chapters_of(self):\n data = [\n # (src, expect[int])\n (True, Story('a', Chapter('b',)), 1),\n (True, Chapter('a',), 1),\n (True, Episode('a',), 0),\n (True, Scene('a',), 0),\n (True, SCode(None, SCmd.BE, (),\"\"), 0),\n ]\n validate_with_fail(self, 'chapters_of',\n lambda src, expect: self.assertEqual(\n cnt.Counter().chapters_of(src), expect),\n data)\n\n def test_episodes_of(self):\n data = [\n # (src, expect[int])\n (True, Story('a', Chapter('b', Episode('c',))), 1),\n (True, Chapter('a', Episode('b',)), 1),\n (True, Episode('a',), 1),\n (True, Scene('a',), 0),\n (True, SCode(None, SCmd.BE, (),''), 0),\n ]\n validate_with_fail(self, 'episodes_of',\n lambda src, expect: self.assertEqual(\n cnt.Counter().episodes_of(src), expect),\n data)\n\n def test_scenes_of(self):\n data = [\n # (src, expect[int])\n (True, Story('a', Chapter('b', Episode('c', Scene('d',)))), 1),\n (True, Chapter('a', Episode('b', Scene('c',))), 1),\n (True, Episode('a', Scene('b',)), 1),\n (True, Scene('a',), 1),\n (True, SCode(None, SCmd.BE, (), ''), 0),\n ]\n validate_with_fail(self, 'scenes_of',\n lambda src, expect: self.assertEqual(\n cnt.Counter().scenes_of(src), expect),\n data)\n\n def test_scodes_of(self):\n data = [\n # (src, expect[int])\n (True, Story('a', Chapter('b', Episode('c', Scene('d',\n SCode(None, SCmd.BE, (),''))))), 1),\n (True, Chapter('a', Episode('b', Scene('c',\n SCode(None, SCmd.BE, (),'')))), 1),\n (True, Episode('a', Scene('b', SCode(None, SCmd.BE, (),''))), 1),\n (True, Scene('a', SCode(None, SCmd.BE, (),'')), 1),\n (True, SCode(None, SCmd.BE, (),''), 1),\n ]\n validate_with_fail(self, 'scodes_of',\n lambda src, expect: self.assertEqual(\n cnt.Counter().scodes_of(src), expect),\n data)\n\n def test_scodes_of_without_info(self):\n scode0 = SCode(None, SCmd.BE, (), '')\n sinfo = SCode(None, SCmd.INFO_DATA, (),'')\n data = [\n # (src, expect[int])\n (True, Story('a', Chapter('b', Episode('c', Scene('d',\n scode0, sinfo)))), 1),\n (True, Chapter('a', Episode('b', Scene('c',\n scode0, sinfo))), 1),\n (True, Episode('a', Scene('b', scode0, sinfo)), 1),\n (True, Scene('a', scode0, sinfo), 1),\n (True, scode0, 1),\n (True, sinfo, 0),\n ]\n validate_with_fail(self, 'scode_of_without_info',\n lambda src, expect: self.assertEqual(\n cnt.Counter().scodes_of_without_info(src), expect),\n data)\n\n def test_description_characters_of(self):\n scode0 = SCode(None, SCmd.BE, ('apple',), '')\n scode1 = SCode(None, SCmd.DO, ('orange',), '')\n sinfo = SCode(None, SCmd.INFO_DATA, ('test',), '')\n data = [\n # (src, expect[int])\n (True, Story('a', Chapter('b', Episode('c', Scene('d',\n scode0, scode1, sinfo)))), 13),\n (True, Chapter('a', Episode('b', Scene('c',\n scode0, scode1, sinfo))), 13),\n (True, Episode('a', Scene('b', scode0, scode1, sinfo)), 13),\n (True, Scene('a', scode0, scode1, sinfo), 13),\n (True, scode0, 6),\n (True, sinfo, 0),\n (True, [scode0, scode1], 13),\n ]\n validate_with_fail(self, 'description_characters_of',\n lambda src, expect: self.assertEqual(\n cnt.Counter().description_characters_of(src), expect),\n data)\n\n def test_manupaper_numbers_of(self):\n data = [\n # (lines, rows, expect[float])\n (True, 40, 20, 2),\n (True, 50, 20, 2.5),\n (True, 50, 0, 0),\n ]\n validate_with_fail(self, 'manupaper_numbers_of',\n lambda lines, rows, expect: self.assertEqual(\n cnt.Counter().manupaper_numbers_of(lines, rows), expect),\n data)\n\n def test_manupaper_rows_of(self):\n scode0 = SCode(None, SCmd.BE, ('apple',), '')\n scode1 = SCode(None, SCmd.DO, ('orange',), '')\n scode2 = SCode(None, SCmd.TALK, ('melon',), '')\n data = [\n # (src, columns, expect[int])\n (True, Story('a', Chapter('b', Episode('c', Scene('d',\n scode0, scode1, scode2)))), 20, 3),\n (True, Chapter('a', Episode('b', Scene('c',\n scode0, scode1, scode2))), 20, 3),\n (True, Episode('a', Scene('b',\n scode0, scode1, scode2)), 20, 3),\n (True, Scene('a',\n scode0, scode1, scode2), 20, 3),\n (True, scode0, 20, 1),\n (True, [scode0, scode1, scode2], 20, 3),\n (True, SCode(None, SCmd.DO, ('a'*10,)), 5, 3),\n ]\n validate_with_fail(self, 'manupaper_rows_of',\n lambda src, columns, expect: self.assertEqual(\n cnt.Counter().manupaper_rows_of(src, columns), expect),\n data)\n" }, { "alpha_fraction": 0.7058823704719543, "alphanum_fraction": 0.7058823704719543, "avg_line_length": 16, "blob_id": "f48d933bfa82a5bfb57d8436dc7f8a135abb5196", "content_id": "cddea4e5c42a5652010be178d30df9a6c201a564", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 17, "license_type": "permissive", "max_line_length": 16, "num_lines": 1, "path": "/analyzer/__init__.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# python init.py\n" }, { "alpha_fraction": 0.5345858335494995, "alphanum_fraction": 0.5354397892951965, "avg_line_length": 29, "blob_id": "770037cb4533660eecc94bdf9d6c5fa07795a160", "content_id": "b2315ec9853b9ca7d1ed783687b18eb9131fc70b", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1171, "license_type": "permissive", "max_line_length": 74, "num_lines": 39, "path": "/tests/utils/test_logger.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nMyLogger class test\n===================\n'''\n\nimport unittest\nfrom testutils import print_testtitle, validate_with_fail\nfrom builder.utils import logger\n\n\nclass MyLoggerTest(unittest.TestCase):\n\n @classmethod\n def setUpClass(cls):\n print_testtitle(logger.__name__, 'MyLogger class')\n\n def test_instance(self):\n data = [\n # (name, sh, fh)\n (True, \"test\", \"%(message)\", \"%(message)\"),\n ]\n def checker(name, sh, fh):\n _ = logger.MyLogger(name, sh, fh)\n self.assertIsInstance(_, logger.MyLogger)\n self.assertEqual(_.name, name)\n validate_with_fail(self, 'class-instance', checker, data)\n\n def test_static_get_logger(self):\n data = [\n # (name, sh, fh)\n (True, \"test\", '%(message)', '%(message)'),\n ]\n def checker(name, sh, fh):\n _ = logger.MyLogger.get_logger(name, sh, fh)\n self.assertIsInstance(_, logger.MyLogger)\n self.assertEqual(_.name, name)\n _\n validate_with_fail(self, 'staticmethod-get_logger', checker, data)\n\n" }, { "alpha_fraction": 0.7198067903518677, "alphanum_fraction": 0.7198067903518677, "avg_line_length": 11.9375, "blob_id": "21c5786b5d27ad1d73d12a43068984950f4df94c", "content_id": "67c55da01aa7019d064d690478583f6e21e8d83e", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": true, "language": "Markdown", "length_bytes": 207, "license_type": "permissive", "max_line_length": 39, "num_lines": 16, "path": "/.github/ISSUE_TEMPLATE/feature-request.md", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "---\nname: Feature request\nabout: Suggest an idea for this project\ntitle: 'Prefix: simple title'\nlabels: feature\nassignees: ''\n\n---\n\nJapanese title\n===\n\nthe feature description.\n\n**Note**\nadditional comment.\n" }, { "alpha_fraction": 0.6058956980705261, "alphanum_fraction": 0.6063492298126221, "avg_line_length": 25.554216384887695, "blob_id": "95c154b3a8617b9152904a72e2c3d778d893e891", "content_id": "f119e22c8fa2949b6ddcd20be4a9416577c113c3", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2205, "license_type": "permissive", "max_line_length": 104, "num_lines": 83, "path": "/builder/core/filter.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nFilter Object\n=============\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('Filter',)\n\n\nfrom typing import Tuple, Union\nfrom builder.commands.scode import SCode\nfrom builder.containers.chapter import Chapter\nfrom builder.containers.episode import Episode\nfrom builder.containers.material import Material\nfrom builder.containers.scene import Scene\nfrom builder.containers.story import Story\nfrom builder.core.executer import Executer\nfrom builder.datatypes.builderexception import BuilderError\nfrom builder.datatypes.resultdata import ResultData\nfrom builder.utils import assertion\nfrom builder.utils.logger import MyLogger\n\n\n# alias\nContainerLike = (Story, Chapter, Episode, Scene, SCode, Material)\n\n\n# logger\nLOG = MyLogger.get_logger(__name__)\nLOG.set_file_handler()\n\n\nclass FilterError(BuilderError):\n ''' General Filter Error.\n '''\n pass\n\n\nclass Filter(Executer):\n ''' Filter Executer class.\n '''\n def __init__(self):\n super().__init__()\n LOG.info('FILTER: initialize')\n\n #\n # methods\n #\n\n def execute(self, src: Story, priority: int) -> ResultData:\n LOG.info('FILTER: start exec')\n tmp, is_succeeded = self._exec_internal(src, priority)\n error = None\n return ResultData(\n tmp,\n is_succeeded,\n error)\n\n #\n # private methods\n #\n\n def _exec_internal(self, src: ContainerLike,\n priority: int) -> Tuple[Union[Story, Chapter, Episode ,Scene, SCode, Material, None], bool]:\n ret = None\n is_succeeded = True\n if isinstance(src, (Story, Chapter, Episode, Scene, Material)):\n if src.priority >= priority:\n tmp = []\n for child in src.children:\n _, is_succeeded = self._exec_internal(child, priority)\n if is_succeeded and _:\n tmp.append(_)\n ret = src.inherited(*tmp)\n elif isinstance(src, SCode):\n if src.priority >= priority:\n ret = src\n else:\n LOG.error(f'Invalid value: {src}')\n is_succeeded = False\n return (ret, is_succeeded)\n\n" }, { "alpha_fraction": 0.5503876209259033, "alphanum_fraction": 0.5516796112060547, "avg_line_length": 16.177778244018555, "blob_id": "9605aa45e548aefa7ff967f6b1db530ed2233041", "content_id": "3ca405c0a2426edfa5455e4f05717a72ae90b697", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 774, "license_type": "permissive", "max_line_length": 58, "num_lines": 45, "path": "/builder/objects/time.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nTime Object\n===========\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('Time',)\n\n\nimport datetime\nfrom builder.objects.sobject import SObject\nfrom builder.utils import assertion\n\n\nclass Time(SObject):\n ''' Time Object class.\n '''\n\n def __init__(self, name: str, hour: int, minute: int):\n super().__init__(name)\n self._time = datetime.time(\n hour=assertion.is_int(hour),\n minute=assertion.is_int(minute))\n\n #\n # property\n #\n\n @property\n def time(self) -> datetime.time:\n return self._time\n\n @property\n def hour(self) -> int:\n return self._time.hour\n\n @property\n def minute(self) -> int:\n return self._time.minute\n\n #\n # methods\n #\n\n" }, { "alpha_fraction": 0.6222910284996033, "alphanum_fraction": 0.6253870129585266, "avg_line_length": 15.100000381469727, "blob_id": "8f2735ec592a5c37fd3e66318d9167d5d400eec9", "content_id": "bd0f89b273ae416e640480deadff513b6adece04", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 323, "license_type": "permissive", "max_line_length": 50, "num_lines": 20, "path": "/builder/containers/story.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nStory Container Object\n======================\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('Story',)\n\n\nfrom typing import Any\nfrom builder.containers.container import Container\nfrom builder.utils import assertion\n\n\nclass Story(Container):\n ''' Story Container class.\n '''\n pass\n\n" }, { "alpha_fraction": 0.5254237055778503, "alphanum_fraction": 0.526129961013794, "avg_line_length": 21.109375, "blob_id": "72e8b050c54eb9ea5714925de3d74d72c06a9dcf", "content_id": "2feafb515fcd876f69892491901744a9fd3b5fa8", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1416, "license_type": "permissive", "max_line_length": 72, "num_lines": 64, "path": "/builder/commands/scode.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nStory Code Object\n=================\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('SCode',)\n\n\nfrom builder.commands.command import SCmd\nfrom builder.objects.sobject import SObject\nfrom builder.utils import assertion\n\n\nclass SCode(SObject):\n ''' Story Code Object class.\n '''\n def __init__(self,\n src: SObject,\n cmd: SCmd,\n script: tuple,\n option: (int, str)='',\n ):\n super().__init__('__scode__')\n self._src = assertion.is_instance(src, SObject) if src else None\n self._cmd = assertion.is_instance(cmd, SCmd)\n self._script = assertion.is_tuple(script)\n self._option = assertion.is_int_or_str(option)\n\n #\n # property\n #\n @property\n def src(self) -> (SObject, None):\n return self._src\n\n @property\n def cmd(self) -> str:\n return self._cmd\n\n @property\n def script(self) -> tuple:\n return self._script\n\n @property\n def option(self) -> str:\n return self._option\n\n #\n # methods\n #\n\n def inherited(self,\n src: SObject=None,\n script: tuple=None,\n option: str=None) -> SCode:\n return SCode(\n src if src else self.src,\n self.cmd,\n script if script else self.script,\n option if option else self.option,\n )\n\n" }, { "alpha_fraction": 0.6075156331062317, "alphanum_fraction": 0.6116909980773926, "avg_line_length": 21.761905670166016, "blob_id": "c903ae99bc17c87aec8adf5e4fa2c34b56145658", "content_id": "c11a063c6572b7f83f31407e5d2951970afb0a5f", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 479, "license_type": "permissive", "max_line_length": 63, "num_lines": 21, "path": "/tests/datatypes/test_formattag.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nFormatTag Enum class test\n==========================\n'''\n\nimport unittest\nfrom tests.testutils import print_testtitle, validate_with_fail\nfrom builder.datatypes import formattag as fm\n\n\nclass FormatTagTest(unittest.TestCase):\n\n @classmethod\n def setUpClass(cls):\n print_testtitle(fm.__name__, 'FormatTag Enum class')\n\n def test_instance(self):\n self.assertEqual(\n len(fm.FormatTag.get_all()),\n 4)\n\n" }, { "alpha_fraction": 0.5928961634635925, "alphanum_fraction": 0.5956284403800964, "avg_line_length": 14.913043022155762, "blob_id": "ad6409b1ec78197f95a95e126cbfb5c306eb1bd5", "content_id": "04852e727965a6d180e0a284ade3badeacb4498e", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "INI", "length_bytes": 366, "license_type": "permissive", "max_line_length": 36, "num_lines": 23, "path": "/.coveragerc", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# .coveragerc to control coverage.py\n[run]\nsource =\n analyzer\n builder\n examples\nomit =\n # projects\n old_*\n # markdown\n *.md\n\n[report]\nexclude_lines =\n pragma: no cover\n def __repr__\n if self.debug:\n if settings.DEBUG\n raise AssertionError\n raise NotImplementedError\n if 0:\n if __name__ == .__main__.:\n test_case.fail\n" }, { "alpha_fraction": 0.5444079041481018, "alphanum_fraction": 0.5523026585578918, "avg_line_length": 24.325000762939453, "blob_id": "356e882944c8043b7314de2060754b40a1690707", "content_id": "e1916b723e718e7acad0ab9ddb22c52bc44fd9dc", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3120, "license_type": "permissive", "max_line_length": 99, "num_lines": 120, "path": "/analyzer/datatypes/mecabdata.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nMeCab token Data\n================\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('MecabData',)\n\n\nfrom builder.utils.logger import MyLogger\nfrom builder.utils import assertion\n\n\n# logger\nLOG = MyLogger.get_logger(__name__)\nLOG.set_file_handler()\n\n\nclass MecabData(object):\n ''' Mecab token Data class.\n\n NOTE:\n - 表層形(単語)\n - 品詞\n - 品詞細分類1\n - 品詞細分類2\n - 品詞細分類3\n - 活用型\n - 活用形\n - 基本形\n - 読み\n - 発音\n '''\n def __init__(self,\n word: str,\n wordclass: str,\n class_detail1: str,\n class_detail2: str,\n class_detail3: str,\n grammer_type: str,\n conjugation: str,\n basic_type: str,\n reading: str=None,\n pronounce: str=None,\n options: str=None,\n ):\n self._word = assertion.is_str(word)\n self._wordclass = assertion.is_str(wordclass)\n self._class_detail1 = assertion.is_str(class_detail1)\n self._class_detail2 = assertion.is_str(class_detail2)\n self._class_detail3 = assertion.is_str(class_detail3)\n self._grammer_type = assertion.is_str(grammer_type)\n self._conjugation = assertion.is_str(conjugation)\n self._basic_type = assertion.is_str(basic_type)\n self._reading = assertion.is_str(reading) if reading else self._word\n self._pronounce = assertion.is_str(pronounce) if pronounce else self._word\n self._options = options\n if options:\n LOG.critical(f\"Unknown mecab arguments: {options}\")\n\n @classmethod\n def conv(cls, *args) -> MecabData:\n if not args or args[0] == '':\n return MecabData('', '', '', '', '', '', '', '', '', '')\n elif args[0] == 'EOS':\n return MecabData('EOS', '', '', '', '', '', '', '', '', '')\n else:\n return MecabData(*args)\n\n #\n # property\n #\n\n @property\n def word(self) -> str:\n return self._word\n\n @property\n def wordclass(self) -> str:\n return self._wordclass\n\n @property\n def class_detail1(self) -> str:\n return self._class_detail1\n\n @property\n def class_detail2(self) -> str:\n return self._class_detail2\n\n @property\n def class_detail3(self) -> str:\n return self._class_detail3\n\n @property\n def grammer_type(self) -> str:\n return self._grammer_type\n\n @property\n def conjugation(self) -> str:\n return self._conjugation\n\n @property\n def basic_type(self) -> str:\n return self._basic_type\n\n @property\n def reading(self) -> str:\n return self._reading\n\n @property\n def pronounce(self) -> str:\n return self._pronounce\n\n @property\n def mecab_data(self) -> str:\n tmp = ','.join([self.wordclass, self.class_detail1, self.class_detail2, self.class_detail3,\n self.grammer_type, self.conjugation, self.basic_type, self.reading, self.pronounce])\n return f'{self.word}\\t{tmp}'\n\n" }, { "alpha_fraction": 0.5234460234642029, "alphanum_fraction": 0.5332606434822083, "avg_line_length": 34.269229888916016, "blob_id": "b5329f4dbe5898b99d7af087dcbae30eebd36c00", "content_id": "1432f915e9ea525b138a5c182bb2abd51efa3cac", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1834, "license_type": "permissive", "max_line_length": 81, "num_lines": 52, "path": "/tests/core/test_filter.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nFilter class test\n=================\n'''\n\nimport unittest\nfrom tests.testutils import print_testtitle, validate_with_fail\nfrom builder.commands.scode import SCode, SCmd\nfrom builder.containers.chapter import Chapter\nfrom builder.containers.episode import Episode\nfrom builder.containers.scene import Scene\nfrom builder.core import filter as ft\n\n\nclass FilterTest(unittest.TestCase):\n\n @classmethod\n def setUpClass(cls):\n print_testtitle(ft.__name__, 'Filter class')\n\n def test_instance(self):\n tmp = ft.Filter()\n self.assertIsInstance(tmp, ft.Filter)\n\n def test_execute_internal(self):\n data = [\n # (src, priority, expect, exp_val)\n (True, Chapter('test',\n Episode('a'), Episode('b'), Episode('c')), 5,\n True, 3),\n (True, Chapter('test',\n Episode('a'), Episode('b').set_priority(2), Episode('c')), 5,\n True, 2),\n (True, Chapter('test',\n Episode('a'), Episode('b'), Episode('c')), 5,\n True, 3),\n (True, SCode(None, SCmd.BE, (),'').set_priority(2), 5,\n True, None),\n ]\n def checker(src, pri, expect, exp_val):\n tmp = ft.Filter()._exec_internal(src, pri)\n self.assertEqual(tmp[1], expect)\n if hasattr(tmp[0], 'children'):\n self.assertEqual(len(tmp[0].children), exp_val)\n elif isinstance(tmp[0], (list, tuple)):\n self.assertEqual(len(tmp[0], exp_val))\n elif tmp[0]:\n self.assertIsInstance(tmp[0], SCode)\n else:\n self.assertEqual(tmp[0], exp_val)\n validate_with_fail(self, 'execute_internal', checker, data)\n" }, { "alpha_fraction": 0.581698477268219, "alphanum_fraction": 0.5828645825386047, "avg_line_length": 36.56958770751953, "blob_id": "89213027caf0f830b9fe7266f6fe338255231396", "content_id": "60d36c35bda19746a857d8354bcda36a3abd98ae", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 14578, "license_type": "permissive", "max_line_length": 96, "num_lines": 388, "path": "/builder/core/runner.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nRunner Object\n=============\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('Runner',)\n\n\nfrom analyzer.analyzer import Analyzer\nfrom builder.commands.optioncmd import OptionParser\nfrom builder.containers.story import Story\nfrom builder.core.commentconverter import CommentConverter\nfrom builder.core.compiler import Compiler\nfrom builder.core.executer import Executer\nfrom builder.core.filter import Filter\nfrom builder.core.formatter import Formatter\nfrom builder.core.headerupdater import HeaderUpdater\nfrom builder.core.outputter import Outputter\nfrom builder.core.plotupdater import PlotUpdater\nfrom builder.core.reducer import Reducer\nfrom builder.core.sceneupdater import SceneUpdater\nfrom builder.core.serializer import Serializer\nfrom builder.core.tagreplacer import TagReplacer\nfrom builder.core.validater import Validater\nfrom builder.datatypes.builderexception import BuilderError\nfrom builder.datatypes.codelist import CodeList\nfrom builder.datatypes.compilemode import CompileMode\nfrom builder.datatypes.database import Database\nfrom builder.datatypes.formatmode import FormatMode\nfrom builder.datatypes.outputmode import OutputMode\nfrom builder.datatypes.rawdata import RawData\nfrom builder.datatypes.resultdata import ResultData\nfrom builder.datatypes.storyconfig import StoryConfig\nfrom builder.datatypes.textlist import TextList\nfrom builder.utils import assertion\nfrom builder.utils.logger import MyLogger\n\n\n# logger\nLOG = MyLogger.get_logger(__name__)\nLOG.set_file_handler()\n\n\nclass RunnerError(BuilderError):\n ''' General Error in Runner.\n '''\n pass\n\n\nclass Runner(Executer):\n ''' Runner class.\n '''\n def __init__(self):\n super().__init__()\n LOG.info('RUNNER: initialize')\n self._is_analyzed = assertion.is_bool(False)\n self._is_debug = assertion.is_bool(False)\n\n #\n # methods\n #\n\n def execute(self, src: Story,\n config: StoryConfig, db: Database,\n ) -> ResultData: # pragma: no cover\n ''' Exec story building, compiling and outputting.\n\n NOTE: Compile option\n 1. normal: output `story.md`\n 2. plot: output `plot.md`\n 3. text: output `story.txt`\n 4. scenario: output `sc_story.md`\n '''\n LOG.info('RUN: == START EXEC ==')\n LOG.info('RUN: START-PHASE: Preparation')\n\n tmp = assertion.is_instance(src, Story)\n is_succeeded = True\n result = None\n error = None\n\n is_succeeded = self._build_options(config)\n if not is_succeeded:\n msg = 'Cannot build option arguments!!'\n error = RunnerError(msg)\n LOG.error(msg)\n return ResultData([], is_succeeded, error)\n LOG.info('... SUCCESS: Preparation')\n\n LOG.info('RUN: START-PHASE: Pre-Compile')\n result = self._pre_compile(src, config, db)\n if not result.is_succeeded:\n return result\n tmp = assertion.is_instance(result.data, Story)\n LOG.info('... SUCCESS: Finish: Pre-Compile')\n\n LOG.info('RUN: START-PHASE: Compile and Output')\n result = assertion.is_instance(self._compile(tmp, config, db), ResultData)\n LOG.info('... SUCCESS: Finish: Compile and Output')\n\n self._output_storyinfo(config)\n\n LOG.info('RUN: analyzer check')\n if self._is_analyzed:\n result = assertion.is_instance(self._analyze_and_output(tmp, db.get_person_names(),\n self._is_debug),\n ResultData)\n\n LOG.info('RUN: == ALL SUCCEEDED ==')\n return result\n\n #\n # private methods\n #\n\n def _build_options(self, config :StoryConfig) -> bool: # pragma: no cover\n import argparse\n LOG.info('Call: build_options')\n opts = assertion.is_instance(OptionParser().get_commandline_arguments(),\n argparse.Namespace)\n LOG.debug(f'Get option arguments: {opts}')\n\n is_succeeded = True\n\n LOG.info('RUN: option settings')\n if opts.rubi:\n LOG.debug(f'RUN: option rubi: {opts.rubi}')\n config.set_is_rubi(True)\n\n if opts.comment:\n LOG.debug(f'RUN: option comment: {opts.comment}')\n config.set_is_comment(True)\n\n if opts.console:\n LOG.debug(f'RUN: option console: {opts.console}')\n config.set_output_mode(OutputMode.CONSOLE)\n\n if opts.format:\n LOG.debug(f'RUN: option format: {opts.format}')\n config.set_format_mode(FormatMode.conv_to_mode(opts.format))\n\n if opts.part:\n LOG.debug(f'RUN: option part: {opts.part}')\n start, end = 0, -1\n if ':' in opts.part:\n _ = opts.part.split(':')\n start, end = int(_[0]), int(_[1])\n else:\n start = end = int(opts.part)\n config.set_start(start)\n config.set_end(end)\n\n if opts.data:\n LOG.debug(f'RUN: option data: {opts.data}')\n config.set_is_data(opts.data)\n\n if opts.plot:\n LOG.debug(f'RUN: option plot: {opts.plot}')\n config.set_is_plot(opts.plot)\n\n if opts.priority:\n LOG.debug(f'RUN: option priority: {opts.priority}')\n config.set_priority(opts.priority)\n\n if opts.text:\n LOG.debug(f'RUN: option text: {opts.text}')\n config.set_is_text(opts.text)\n\n if opts.analyze:\n LOG.debug(f'RUN: option analyze: {opts.analyze}')\n self._is_analyzed = True\n\n if opts.debug:\n LOG.debug(f'RUN: option debug: {opts.debug}')\n self._is_debug = True\n\n return is_succeeded\n\n def _pre_compile(self, src: Story, config: StoryConfig, db: Database) -> ResultData:\n LOG.info('RUN: START: Comment Converter')\n result = assertion.is_instance(CommentConverter().execute(src), ResultData)\n if not result.is_succeeded:\n LOG.error('Failure in CommentConverter!!')\n return result\n tmp = assertion.is_instance(result.data, Story)\n LOG.info('... SUCCESS: CommentConverter')\n\n LOG.info('RUN: START: Filter')\n result = assertion.is_instance(Filter().execute(tmp, config.priority),\n ResultData)\n if not result.is_succeeded:\n LOG.error('Failure in Filter!!')\n return result\n tmp = assertion.is_instance(result.data, Story)\n LOG.info('... SUCCESS: Filter')\n\n LOG.info('RUN: START: Reducer')\n result = assertion.is_instance(Reducer().execute(tmp, config),\n ResultData)\n if not result.is_succeeded:\n LOG.error('Failure in Reducer!!')\n return result\n tmp = assertion.is_instance(result.data, Story)\n LOG.info('... SUCCESS: Reducer')\n\n LOG.info('RUN: START: Replacer')\n result = assertion.is_instance(TagReplacer().execute(tmp, config, db.tags),\n ResultData)\n if not result.is_succeeded:\n LOG.error('Failure in TagReplacer!!')\n return result\n tmp = assertion.is_instance(result.data, Story)\n LOG.info('... SUCCESS: Replacer')\n\n LOG.info('RUN: START: header updater')\n result = assertion.is_instance(HeaderUpdater().execute(tmp, config),\n ResultData)\n if not result.is_succeeded:\n LOG.error('Failure in HeaderUpdater!!')\n return result\n tmp = assertion.is_instance(result.data, Story)\n LOG.info('... SUCCESS: HeaderUpdater')\n\n LOG.info('RUN: START: scene updater')\n result = assertion.is_instance(SceneUpdater().execute(tmp), ResultData)\n if not result.is_succeeded:\n LOG.error('Failure in SceneUpdater!!')\n return result\n tmp = assertion.is_instance(result.data, Story)\n LOG.info('... SUCCESS: SceneUpdater')\n\n LOG.info('RUN: START: plot updater')\n result = assertion.is_instance(PlotUpdater().execute(tmp), ResultData)\n if not result.is_succeeded:\n LOG.error('Failure in PlotUpdater!!')\n return result\n tmp = assertion.is_instance(result.data, Story)\n LOG.info('... SUCCESS: PlotUpdater')\n\n return result\n\n def _compile(self, src: Story, config: StoryConfig, db: Database) -> ResultData:\n assertion.is_instance(src, Story)\n assertion.is_instance(config, StoryConfig)\n assertion.is_instance(db, Database)\n\n cmp_flags = assertion.is_valid_length(\n [True, config.is_plot, config.is_text,\n config.is_data,\n config.is_scenario, config.is_audiodrama],\n len(CompileMode.get_all()))\n cmp_modes = assertion.is_valid_length(\n [CompileMode.NORMAL, CompileMode.PLOT, CompileMode.NOVEL_TEXT,\n CompileMode.STORY_DATA,\n CompileMode.SCENARIO, CompileMode.AUDIODRAMA],\n len(CompileMode.get_all()))\n\n slz_idx = 0\n cmp_src_list = [None] * len(CompileMode.get_all())\n\n for flag in cmp_flags:\n if flag:\n LOG.info(f'RUN: START: Serializer and Validater [{slz_idx}]')\n result = assertion.is_instance(Serializer().execute(src, cmp_modes[slz_idx]),\n ResultData)\n if not result.is_succeeded:\n LOG.error('Failure in Serializer!!')\n return result\n tmp = assertion.is_instance(result.data, CodeList)\n LOG.info(f'... SUCCESS: Serializer [{slz_idx}]')\n\n result = assertion.is_instance(Validater().execute(tmp), ResultData)\n if not result.is_succeeded:\n LOG.error('Failure in Validater')\n return result\n LOG.info(f'... SUCCESS: Validater [{slz_idx}]')\n cmp_src_list[slz_idx] = assertion.is_instance(result.data, CodeList)\n slz_idx += 1\n\n cmp_idx = 0\n cmp_data_list = [None] * len(CompileMode.get_all())\n compiler = Compiler()\n\n for flag in cmp_flags:\n if flag:\n LOG.info(f'RUN: START: Compiler [{cmp_idx}]')\n result = assertion.is_instance(\n compiler.execute(cmp_src_list[cmp_idx], cmp_modes[cmp_idx],\n db.rubis, config.is_rubi, config.is_comment),\n ResultData)\n if not result.is_succeeded:\n LOG.error(f'Failure in Compiler [{cmp_idx}]!!')\n return result\n cmp_data_list[cmp_idx] = assertion.is_instance(result.data, RawData)\n LOG.info(f'... SUCCESS Compiler [{cmp_idx}]')\n cmp_idx += 1\n\n LOG.info('<UNIMP> RUN: START-PHASE: Format')\n\n fmt_idx = 0\n fmt_data_list = [None] * len(CompileMode.get_all())\n formatter = Formatter()\n\n for cmp_data in cmp_data_list:\n if cmp_data:\n LOG.info(f'RUN: START: Formatter [{fmt_idx}]')\n result = assertion.is_instance(\n formatter.execute(cmp_data, config.format_mode),\n ResultData)\n if not result.is_succeeded:\n LOG.error(f'Failure in Formatter [{fmt_idx}]!!')\n return result\n fmt_data_list[fmt_idx] = assertion.is_instance(result.data, TextList)\n LOG.info(f'... SUCCESS Formatter [{fmt_idx}]')\n fmt_idx += 1\n\n return self._output(fmt_data_list, config)\n\n def _output(self, src: list, config: StoryConfig) -> ResultData:\n LOG.info('RUN: OUTPUT: start')\n assertion.is_instance(config, StoryConfig)\n\n result = ResultData(src, True, None)\n prefixs = assertion.is_valid_length(['', '_p', '', '_data', '_sc', '_ad'],\n len(CompileMode.get_all()))\n extentions = assertion.is_valid_length(['md', 'md', 'txt', 'md', 'md', 'md'],\n len(CompileMode.get_all()))\n fmt_idx = 0\n outputter = Outputter()\n\n for fmt_data in assertion.is_listlike(src):\n if fmt_data:\n LOG.info(f'RUN: START: Outputter [{fmt_idx}]')\n result = assertion.is_instance(\n outputter.execute(fmt_data, config.output_mode,\n config.filename, prefixs[fmt_idx], extentions[fmt_idx],\n config.builddir),\n ResultData)\n if not result.is_succeeded:\n LOG.error(f'Failure in Outputter [{fmt_idx}]!!')\n return result\n LOG.info(f'... SUCCESS: Outputter [{fmt_idx}]')\n fmt_idx += 1\n\n return result\n\n\n def _output_storyinfo(self, config: StoryConfig) -> None:\n version = config.version\n chars = config.desc_size\n papers = config.desc_papers\n totals = config.total_size\n t_papers = config.total_papers\n print(f'>> v{version} / {papers}p({chars}c) / {t_papers}p({totals}c)')\n\n\n def _analyze_and_output(self, src: Story, person_names: list, is_debug: bool) -> ResultData:\n # serialize and compile as text\n mode = CompileMode.NOVEL_TEXT\n fmode = FormatMode.DEFAULT\n LOG.info('Serialize for Analyzer')\n result = assertion.is_instance(Serializer().execute(src, mode), ResultData)\n if not result.is_succeeded:\n return result\n tmp = assertion.is_instance(result.data, CodeList)\n LOG.info('Validate for Analyzer')\n result = assertion.is_instance(Validater().execute(tmp), ResultData)\n if not result.is_succeeded:\n return result\n tmp = assertion.is_instance(result.data, CodeList)\n LOG.info('Compile for Analyzer')\n result = assertion.is_instance(Compiler().execute(tmp, mode, {}, False, False),\n ResultData)\n if not result.is_succeeded:\n return result\n tmp = assertion.is_instance(result.data, RawData)\n LOG.info('Format for Analyzer')\n result = assertion.is_instance(Formatter().execute(tmp, fmode), ResultData)\n if not result.is_succeeded:\n return result\n tmp = assertion.is_instance(result.data, TextList)\n\n LOG.info('RUN: call Analyzer')\n result = Analyzer().execute(tmp, person_names, is_debug)\n return ResultData([], True, None)\n\n" }, { "alpha_fraction": 0.5430916547775269, "alphanum_fraction": 0.5444596409797668, "avg_line_length": 27.076923370361328, "blob_id": "1262274d8804c30d42fa8dee48094392d3a11e06", "content_id": "fe5152b7dee747103af37871398d34b10567a4cc", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 769, "license_type": "permissive", "max_line_length": 68, "num_lines": 26, "path": "/tests/utils/test_name.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nNaming utility methods test\n===========================\n'''\n\nimport unittest\nfrom testutils import print_testtitle, validate_with_fail\nfrom builder.utils import util_name as uname\n\n\nclass MethodsTest(unittest.TestCase):\n\n @classmethod\n def setUpClass(cls):\n print_testtitle(uname.__name__, 'naming-utility methods')\n\n def test_name_set_from(self):\n data = [\n # (base, name, expect)\n (True, '田中,太郎', '太郎', ('太郎','田中', '田中太郎', '太郎・田中')),\n ]\n validate_with_fail(self, 'name_set_from',\n lambda base, name, expect: self.assertEqual(\n uname.name_set_from(base, name), expect),\n data)\n\n" }, { "alpha_fraction": 0.5983606576919556, "alphanum_fraction": 0.5983606576919556, "avg_line_length": 21.875, "blob_id": "7ec6b9605a3efb3cb43ef484c4218a73f0db70ca", "content_id": "6555aa07345728f93049456707922a373dfd7192", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 366, "license_type": "permissive", "max_line_length": 52, "num_lines": 16, "path": "/setup.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "from setuptools import setup, find_packages\nimport sys\n\nsys.path.append('./builder')\nsys.path.append('./tests')\nsys.path.append('./utils')\n\nfrom builder import __DESC__, __TITLE__, __VERSION__\n\nsetup(\n name = __TITLE__,\n version = __VERSION__,\n description = __DESC__,\n packages = find_packages(),\n test_suite = 'test_all.suite'\n)\n" }, { "alpha_fraction": 0.6066666841506958, "alphanum_fraction": 0.6100000143051147, "avg_line_length": 14.736842155456543, "blob_id": "d11eed519435f435fb5b21d96d200839b2d40359", "content_id": "d2ca47dd632b1f6e431f366deed179ed63da4af9", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 300, "license_type": "permissive", "max_line_length": 50, "num_lines": 19, "path": "/builder/containers/scene.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nScene Container Object\n======================\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('Scene',)\n\n\nfrom builder.containers.container import Container\nfrom builder.utils import assertion\n\n\nclass Scene(Container):\n ''' Scene Container class.\n '''\n pass\n\n" }, { "alpha_fraction": 0.3037272095680237, "alphanum_fraction": 0.3536875545978546, "avg_line_length": 26.413043975830078, "blob_id": "1ecfb70cc91bc26ed1ee0c6922e79a4e05688f60", "content_id": "f7d7bbacbe16e57c4b595f2b39827d05613056e2", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1333, "license_type": "permissive", "max_line_length": 69, "num_lines": 46, "path": "/assets/basic.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nAsset: basic data\n=================\n'''\n\nASSET = {\n \"PERSONS\":(\n # (tag / name / full / age (birth) / sex / job / call / info)\n ('man', '男', '', 30,(1,1), 'male', '会社員'),\n ('woman', '女', '', 30,(1,1), 'female', '会社員'),\n ),\n \"STAGES\":(\n # (tag / name / parent / (geometry) / info)\n # * basic area\n ('Japan', '日本', '', (135.00,35.00)),\n ('Tokyo', '東京', '', (139.67,35.76)),\n ),\n \"DAYS\":(\n # (tag / name / month / day / year)\n ('current', '現在', 4,1, 2020),\n ),\n \"TIMES\":(\n # (tag / name / hour / minute))\n (\"earlymorning\", \"早朝\", 6, 0),\n (\"morning\", \"朝\", 8, 0),\n (\"midmorning\", \"午前\", 10, 0),\n (\"branch\", \"昼前\", 11, 0),\n (\"noon\", \"正午\", 12, 0),\n (\"afternoon\", \"午後\", 14, 0),\n (\"afterschool\", \"放課後\", 16, 0),\n (\"evening\", \"夕方\", 17, 0),\n (\"night\", \"夜\", 20, 0),\n (\"midnight\", \"深夜\", 23, 0),\n (\"deepnight\", \"真夜中\", 2, 0),\n ),\n \"ITEMS\":(\n # (tag / name / cate / info)\n ),\n \"WORDS\":(\n # (tag / name / cate / info)\n ),\n \"RUBIS\":(\n # (origin / rubi / exclusions / always)\n ),\n }\n" }, { "alpha_fraction": 0.5206812620162964, "alphanum_fraction": 0.525547444820404, "avg_line_length": 17.68181800842285, "blob_id": "d32ae6c0a1122707bff3b02921beaf78bcf61e4c", "content_id": "dc351d951ee70a7c1eb1a9c8f22c203db6c2d1a5", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 411, "license_type": "permissive", "max_line_length": 67, "num_lines": 22, "path": "/builder/utils/util_math.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nMathematics Utility methods\n===========================\n'''\n\n__all__ = ('int_ceil',)\n\n\nfrom builder.utils import assertion\n\n\ndef int_ceil(a: int, b: int) -> int:\n ''' Ceil integer\n '''\n return -(-assertion.is_int(a) // assertion.is_int(b))\n\n\ndef safe_divided(a: (int, float), b: (int, float)) -> (int, float):\n ''' Except zero divide\n '''\n return a / b if b else 0\n" }, { "alpha_fraction": 0.5447761416435242, "alphanum_fraction": 0.545708954334259, "avg_line_length": 19.596153259277344, "blob_id": "d8d44b9b6056b366da74ffea1c0bbe11ea3dbf8b", "content_id": "baa06d50f61e5f164332d2c3c6a90c5886f13d03", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1072, "license_type": "permissive", "max_line_length": 76, "num_lines": 52, "path": "/builder/objects/sobject.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nStory Object\n============\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('SObject',)\n\n\nfrom builder import __PRIORITY_DEFAULT__, __PRIORITY_MAX__, __PRIORITY_MIN__\nfrom builder.utils import assertion\n\n\nclass SObject(object):\n ''' Story Object class.\n '''\n\n def __init__(self, name: str):\n self._name = assertion.is_str(name)\n self._priority = assertion.is_int(__PRIORITY_DEFAULT__)\n\n #\n # property\n #\n\n @property\n def name(self) -> str:\n return self._name\n\n @property\n def priority(self) -> int:\n return self._priority\n\n #\n # methods\n #\n\n def set_priority(self, pri: int) -> SObject:\n ''' Set the object priority.\n '''\n self._priority = assertion.is_between(\n assertion.is_int(pri),\n __PRIORITY_MAX__, __PRIORITY_MIN__)\n return self\n\n def omit(self) -> SObject:\n ''' Set the lowest priority for omit object.\n '''\n self._priority = assertion.is_int(__PRIORITY_MIN__)\n return self\n\n" }, { "alpha_fraction": 0.46050670742988586, "alphanum_fraction": 0.46199703216552734, "avg_line_length": 31.33734893798828, "blob_id": "fab1d54193d670f18fbe7cd58705a5bdbf70c758", "content_id": "e1030e7fc476a33ee0b4f6a922a6814416a8973e", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2802, "license_type": "permissive", "max_line_length": 74, "num_lines": 83, "path": "/tests/utils/test_str.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nString utility methods test\n===========================\n'''\n\nimport unittest\nfrom testutils import print_testtitle, validate_with_fail\nfrom builder.utils import util_str as ustr\n\n\nclass MethodsTest(unittest.TestCase):\n\n @classmethod\n def setUpClass(cls):\n print_testtitle(ustr.__name__, 'string-utility methods')\n\n def test_dict_from_string(self):\n data = [\n # (val, splitter, expect)\n (True, \"a:test\", \":\", {\"a\":\"test\"}),\n ]\n validate_with_fail(self, \"dict_from_string\",\n lambda v,splt, expect: self.assertEqual(\n ustr.dict_from_string(v,splt), expect),\n data)\n\n\n def test_hiragana_list_from(self):\n data = [\n # (val, expect)\n (True, 'あい123', ['あ', 'い']),\n ]\n validate_with_fail(self, 'hiragana_list_from',\n lambda v, expect: self.assertEqual(\n ustr.hiragana_list_from(v), expect), data)\n\n\n def test_kanji_list_from(self):\n data = [\n # (val, expect)\n (True, 'あいう漢お', ['漢',]),\n ]\n validate_with_fail(self, 'kanji_list_from',\n lambda v, expect: self.assertEqual(\n ustr.kanji_list_from(v), expect), data)\n\n\n def test_katakana_list_from(self):\n data = [\n # (val, expect)\n (True, 'あいうエお', ['エ']),\n ]\n validate_with_fail(self, 'katakana_list_from',\n lambda v, expect: self.assertEqual(\n ustr.katakana_list_from(v), expect), data)\n\n\n def test_string_replaced_by_tag(self):\n data = [\n # (val, tags, prefix, expect)\n (True, '$test apple', {'test':'AN'}, '$', 'AN apple'),\n ]\n validate_with_fail(self, 'string_replaced_by_tag',\n lambda v,tags,prefix, expect: self.assertEqual(\n ustr.string_replaced_by_tag(v, tags, prefix), expect),\n data)\n\n def test_validate_string_duplicate_chopped(self):\n data = [\n # (val, expect)\n (True, '太郎。。', '太郎。'),\n (True, '太郎、、', '太郎、'),\n (True, '太郎。、', '太郎。'),\n (True, '太郎、。', '太郎、'),\n (True, '?、', '? '),\n (True, '!。', '! '),\n (True, '?。', '? '),\n ]\n validate_with_fail(self, 'validate_string_duplicate_chopped',\n lambda v, expect: self.assertEqual(\n ustr.validate_string_duplicate_chopped(v), expect),\n data)\n" }, { "alpha_fraction": 0.5331411957740784, "alphanum_fraction": 0.5461094975471497, "avg_line_length": 25.653846740722656, "blob_id": "b3ef337916b5857f681ab6cf1b85e152507b64a2", "content_id": "8c1bc508e244154e2a3c207333813e487192b4d7", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 694, "license_type": "permissive", "max_line_length": 61, "num_lines": 26, "path": "/tests/utils/test_list.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nList utility methods test\n=========================\n'''\n\nimport unittest\nfrom testutils import print_testtitle, validate_with_fail\nfrom builder.utils import util_list as utl\n\n\nclass MethodsTest(unittest.TestCase):\n\n @classmethod\n def setUpClass(cls):\n print_testtitle(utl.__name__, 'list-utility methods')\n\n def test_list_without_none(self):\n data = [\n # (val, expect)\n (True, [1,2,3, None, 5], [1,2,3,5]),\n ]\n validate_with_fail(self, 'list_without_none',\n lambda val, expect: self.assertEqual(\n utl.list_without_none(val), expect),\n data)\n\n" }, { "alpha_fraction": 0.5391180515289307, "alphanum_fraction": 0.5547652840614319, "avg_line_length": 31.697673797607422, "blob_id": "0284b935551f4ef2007215a79375102e5666a8f1", "content_id": "7a2b95888343383f3b0543932c804e17b7b2457a", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1406, "license_type": "permissive", "max_line_length": 64, "num_lines": 43, "path": "/tests/core/test_reducer.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nRunner class test\n=================\n'''\n\nimport unittest\nfrom tests.testutils import print_testtitle, validate_with_fail\nfrom builder.containers.chapter import Chapter\nfrom builder.containers.episode import Episode\nfrom builder.containers.scene import Scene\nfrom builder.containers.story import Story\nfrom builder.core import reducer as rd\n\n\nclass ReducerTest(unittest.TestCase):\n\n @classmethod\n def setUpClass(cls):\n print_testtitle(rd.__name__, 'Reducer class')\n\n def test_instance(self):\n tmp = rd.Reducer()\n self.assertIsInstance(tmp, rd.Reducer)\n\n def test_exec_internal(self):\n data = [\n # (src, start, end, expect[chapter_num])\n (True, Story('test1',\n Chapter('1'), Chapter('2'), Chapter('3')),\n 0, 2, 3),\n (True, Story('test2',\n Chapter('1'), Chapter('2'), Chapter('3')),\n 1, 2, 2),\n (True, Story('test3',\n Chapter('1'), Chapter('2'), Chapter('3')),\n 0, -1, 3),\n ]\n def checker(src, start, end, expect):\n tmp = rd.Reducer()._exec_internal(src, start, end)\n self.assertIsInstance(tmp, Story)\n self.assertEqual(len(tmp.children), expect)\n validate_with_fail(self, 'exec_internal', checker, data)\n" }, { "alpha_fraction": 0.5523241758346558, "alphanum_fraction": 0.5525625944137573, "avg_line_length": 29.84558868408203, "blob_id": "2eab27083f7857e7c2d989a29ebef44a520ae341", "content_id": "21d460a546c0d7a621ce4f0c5ba090c97f36a5e5", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 4195, "license_type": "permissive", "max_line_length": 158, "num_lines": 136, "path": "/builder/utils/logger.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nLogger object\n=============\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('MyLogger',)\n\nimport argparse\nimport logging\n\n\nclass MyLogger(logging.Logger):\n ''' MyLogger class, that writes a log to a file.\n\n Attributes:\n name(str): logger name.\n sh_format(str=None): stream format.\n fh_format(str=None): file format.\n '''\n\n _file_handler = None\n _shared_log_level = logging.DEBUG\n _shared_logger = []\n _LOG_DIR = 'logs'\n\n def __init__(self, name: str, sh_format: str=None, fh_format: str=None):\n super().__init__(name)\n self._log_level = logging.DEBUG\n self._sh_formatter = logging.Formatter(sh_format if sh_format else '%(asctime)s - %(name)s - %(levelname)s - %(message)s')\n self._fh_formatter = logging.Formatter(fh_format if fh_format else '%(asctime)s - %(filename)s - %(name)s - %(lineno)d - %(levelname)s - %(message)s')\n\n @staticmethod\n def get_logger(modname: str=__name__, sh_format: str=None, fh_format: str=None,\n is_specific: bool=False) -> MyLogger:\n ''' Get MyLogger class same instance.\n '''\n logger = MyLogger(modname, sh_format, fh_format)\n logger._set_default()\n if not is_specific:\n MyLogger._shared_logger.append(logger)\n return logger\n\n def reset_logger(self, options: argparse.Namespace) -> None:\n if options.log or options.debug:\n opt_log = options.log if options.log else 'debug'\n level = 'debug' if options.debug else opt_log\n self.set_shared_level(level)\n MyLogger.reset_level()\n self.debug(f'LOGGER: reset level: {self.level}')\n\n @classmethod\n def reset_level(cls, level: str='') -> None:\n ''' Reset shared log level\n '''\n for logger in cls._shared_logger:\n logger.set_level(level)\n\n def set_level(self, level: str='') -> None:\n ''' Set logger level.\n '''\n if level:\n self._log_level = self._get_log_level(level)\n self.setLevel(self._log_level)\n else:\n self.setLevel(MyLogger._shared_log_level)\n\n def set_shared_level(self, level: str) -> None:\n ''' Set shared log level.\n '''\n MyLogger._shared_log_level = self._get_log_level(level)\n\n def set_stream_handler(self) -> None:\n ''' Set stream handler.\n '''\n sh = logging.StreamHandler()\n sh.setLevel(self._log_level)\n sh.setFormatter(self._sh_formatter)\n self.addHandler(sh)\n\n def set_file_handler(self, fname: str=None) -> None:\n ''' Set file handler.\n '''\n fh = None\n if not fname and MyLogger._file_handler:\n fh = MyLogger._file_handler\n elif fname:\n import os\n if not os.path.isdir(MyLogger._LOG_DIR):\n os.makedirs(MyLogger._LOG_DIR)\n filepath = os.path.join(MyLogger._LOG_DIR,\n f'{fname}.log')\n fh = logging.FileHandler(filepath)\n fh.setLevel(self._log_level)\n fh.setFormatter(self._fh_formatter)\n MyLogger._file_handler = fh\n else:\n raise ValueError('Cannot filename for log file handler!')\n self.addHandler(fh)\n\n def set_stream_formatter(self, fmt: str) -> None:\n ''' Set stream formatter.\n '''\n self._sh_formatter = fmt\n\n def set_file_formatter(self, fmt: str) -> None:\n ''' Set file formatter.\n '''\n self._fh_formatter = fmt\n\n #\n # private\n #\n\n def _get_log_level(self, level: str) -> int:\n _lvl = level.lower()\n if _lvl in ('d', 'debug'):\n return logging.DEBUG\n elif _lvl in ('i', 'info'):\n return logging.INFO\n elif _lvl in ('w', 'warning', 'warn'):\n return logging.WARNING\n elif _lvl in ('e', 'error'):\n return logging.ERROR\n elif _lvl in ('c', 'critical'):\n return logging.CRITICAL\n else:\n return logging.DEBUG\n\n def _set_default(self):\n res = True\n self.set_level()\n self.set_stream_handler()\n return res\n" }, { "alpha_fraction": 0.841269850730896, "alphanum_fraction": 0.841269850730896, "avg_line_length": 30.5, "blob_id": "03e85583c24fbe1cb9dbe7aa0276fdce4e6b4a88", "content_id": "c688e05bf753d869a2c2ac3f19c6c36c182b9c8f", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 63, "license_type": "permissive", "max_line_length": 42, "num_lines": 2, "path": "/README.md", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# storybuilderunite\nA develop repository for new story builder\n" }, { "alpha_fraction": 0.485659658908844, "alphanum_fraction": 0.48884639143943787, "avg_line_length": 32.38298034667969, "blob_id": "64ae737235cc2c155ca69008daedd282b7511d74", "content_id": "e09f132ec190b97244c37227beba7b16d415698f", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1571, "license_type": "permissive", "max_line_length": 79, "num_lines": 47, "path": "/tests/utils/test_dict.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nDictionary utility methods test\n===============================\n'''\n\nimport unittest\nfrom testutils import print_testtitle, validate_with_fail\nfrom builder.utils import util_dict as udict\n\n\nclass MethodsTest(unittest.TestCase):\n\n @classmethod\n def setUpClass(cls):\n print_testtitle(udict.__name__, 'dictionary-utility methods')\n\n def test_calling_dict_from(self):\n data = [\n # (calling, name, expect)\n (True, \"A:test\", \"taro\", {\"A\":\"test\",\"S\":\"taro\",\"M\":\"私\"}),\n ]\n validate_with_fail(self, 'calling_dict_from',\n lambda calling,name,expect: self.assertEqual(\n udict.calling_dict_from(calling, name), expect),\n data)\n\n def test_combine_dict(self):\n data = [\n # (dictA, dictB, expect)\n (True, {'a':'apple'}, {'b':'ball'}, {'a':'apple', 'b':'ball'}),\n ]\n validate_with_fail(self, \"combine_dict\",\n lambda v0,v1, expect: self.assertEqual(\n udict.combine_dict(v0, v1), expect),\n data)\n\n def test_dict_sorted(self):\n data = [\n # (dict, is_reverse, expect)\n (True, {'b':'ball', 'a':'apple', 'c':'can'}, False,\n {'a':'apple', 'b':'ball', 'c':'can'}),\n ]\n validate_with_fail(self, 'dict_sorted',\n lambda v,is_rev, expect: self.assertEqual(\n udict.dict_sorted(v, is_rev), expect),\n data)\n" }, { "alpha_fraction": 0.5891891717910767, "alphanum_fraction": 0.5953667759895325, "avg_line_length": 31.375, "blob_id": "273d3d9983c80e6ae4b0b70e169d4393b78457f0", "content_id": "642c86eb4652f35f29ef4b7578190e1bb8f2d9f1", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1295, "license_type": "permissive", "max_line_length": 78, "num_lines": 40, "path": "/tests/core/test_serializer.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nSerializer class test\n=====================\n'''\n\nimport unittest\nfrom tests.testutils import print_testtitle, validate_with_fail\nfrom builder.commands.scode import SCode, SCmd\nfrom builder.containers.chapter import Chapter\nfrom builder.containers.episode import Episode\nfrom builder.containers.scene import Scene\nfrom builder.datatypes.compilemode import CompileMode\nfrom builder.core import serializer as sl\n\n\nclass SerializerTest(unittest.TestCase):\n\n @classmethod\n def setUpClass(cls):\n print_testtitle(sl.__name__, 'Serializer class')\n\n def test_instance(self):\n tmp = sl.Serializer()\n self.assertIsInstance(tmp, sl.Serializer)\n\n def test_novel_serialized(self):\n scode0 = SCode(None, SCmd.BE, (), '')\n scode1 = SCode(None, SCmd.INFO_DATA, (), '')\n data = [\n # (src, expect)\n (True, Chapter('a', Episode('b', Scene('c', scode0))),\n 1),\n (True, Chapter('a', scode1, Episode('b', Scene('c', scode0))),\n 2),\n ]\n validate_with_fail(self, 'novel_serialized',\n lambda src, expect: self.assertEqual(\n len(sl.Serializer()._novel_serialized(src)), expect),\n data)\n" }, { "alpha_fraction": 0.40672338008880615, "alphanum_fraction": 0.4081759750843048, "avg_line_length": 41.646018981933594, "blob_id": "98905709750e031a10b321bf3f4a940722699255", "content_id": "5c3cb4c44bbb989549f6162d175a44dd370f67d2", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 4819, "license_type": "permissive", "max_line_length": 76, "num_lines": 113, "path": "/tests/commands/test_optioncmd.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nOptionParser class test\n=======================\n'''\n\nimport argparse\nimport unittest\nfrom tests.testutils import print_testtitle, validate_with_fail\nfrom builder.commands import optioncmd as opt\n\n\nclass OptionParserTest(unittest.TestCase):\n\n @classmethod\n def setUpClass(cls):\n print_testtitle(opt.__name__, 'OptionParser class')\n\n def test_instance(self):\n tmp = opt.OptionParser()\n self.assertIsInstance(tmp, opt.OptionParser)\n\n def test_get_commandline_arguments(self):\n options = ['comment', 'data', 'plot', 'rubi', 'text', 'analyze',\n 'console', 'debug',\n 'format', 'log', 'part', 'priority',\n ]\n data = [\n # (is_test, data, expect)\n (True, True, [],\n [False, False, False, False, False, False,\n False, False,\n None, None, None, None]),\n (True, True, ['-c'],\n [True, False, False, False, False, False,\n False, False,\n None, None, None, None]),\n (True, True, ['--comment'],\n [True, False, False, False, False, False,\n False, False,\n None, None, None, None]),\n (True, True, ['-d'],\n [False, True, False, False, False, False,\n False, False,\n None, None, None, None]),\n (True, True, ['--data'],\n [False, True, False, False, False, False,\n False, False,\n None, None, None, None]),\n (True, True, ['-p'],\n [False, False, True, False, False, False,\n False, False,\n None, None, None, None]),\n (True, True, ['--plot'],\n [False, False, True, False, False, False,\n False, False,\n None, None, None, None]),\n (True, True, ['-r'],\n [False, False, False, True, False, False,\n False, False,\n None, None, None, None]),\n (True, True, ['--rubi'],\n [False, False, False, True, False, False,\n False, False,\n None, None, None, None]),\n (True, True, ['-t'],\n [False, False, False, False, True, False,\n False, False,\n None, None, None, None]),\n (True, True, ['--text'],\n [False, False, False, False, True, False,\n False, False,\n None, None, None, None]),\n (True, True, ['-z'],\n [False, False, False, False, False, True,\n False, False,\n None, None, None, None]),\n (True, True, ['--analyze'],\n [False, False, False, False, False, True,\n False, False,\n None, None, None, None]),\n (True, True, ['--console'],\n [False, False, False, False, False, False,\n True, False,\n None, None, None, None]),\n (True, True, ['--debug'],\n [False, False, False, False, False, False,\n False, True,\n None, None, None, None]),\n (True, True, ['--format=w'],\n [False, False, False, False, False, False,\n False, False,\n 'w', None, None, None]),\n (True, True, ['--log=info'],\n [False, False, False, False, False, False,\n False, False,\n None, 'info', None, None]),\n (True, True, ['--part=0:1'],\n [False, False, False, False, False, False,\n False, False,\n None, None, '0:1', None]),\n (True, True, ['--priority=1'],\n [False, False, False, False, False, False,\n False, False,\n None, None, None, 1]),\n ]\n def checker(is_test, tdata, expect):\n parser = opt.OptionParser()\n tmp = parser.get_commandline_arguments(is_test, tdata)\n self.assertIsInstance(tmp, argparse.Namespace)\n for arg, exp in zip(options, expect):\n self.assertEqual(getattr(tmp, arg), exp)\n validate_with_fail(self, 'get_commandline_arguments', checker, data)\n" }, { "alpha_fraction": 0.5708092451095581, "alphanum_fraction": 0.5722543597221375, "avg_line_length": 24.592592239379883, "blob_id": "3709e2546330cc7d01c5fbe41b58fb66f9307c54", "content_id": "5ed8a988d84066ad6321c6efcd57be898dfceee7", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 692, "license_type": "permissive", "max_line_length": 65, "num_lines": 27, "path": "/tests/test_world.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nWorld class test\n================\n'''\n\nimport unittest\nfrom tests.testutils import print_testtitle, validate_with_fail\nfrom builder import world as wd\n\n\nclass WorldTest(unittest.TestCase):\n\n @classmethod\n def setUpClass(cls):\n print_testtitle(wd.__name__, 'World class')\n\n def test_instance(self):\n data = [\n # (title, expect)\n (True, 'test', 'test'),\n ]\n def checker(title, expect):\n tmp = wd.World(title)\n self.assertIsInstance(tmp, wd.World)\n self.assertEqual(tmp.config.title, expect)\n validate_with_fail(self, 'class instance', checker, data)\n\n" }, { "alpha_fraction": 0.7605633735656738, "alphanum_fraction": 0.7605633735656738, "avg_line_length": 13.199999809265137, "blob_id": "f839fe3d366fbfe62914cf45bc2c1c636c855e5d", "content_id": "f2638afd7ffc2c005babf9b84cf9e90297bab77c", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 71, "license_type": "permissive", "max_line_length": 25, "num_lines": 5, "path": "/examples/momotaro/__init__.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# python init.py\nimport sys\nimport momotaro\n\nsys.exit(momotaro.main())\n" }, { "alpha_fraction": 0.5789213180541992, "alphanum_fraction": 0.579910933971405, "avg_line_length": 32.68333435058594, "blob_id": "a8e68c432024e38dd2fb667458b4dc9b82acbe89", "content_id": "0778aa1b06b2fda0447a13db0a273ce1b3e6b40f", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2021, "license_type": "permissive", "max_line_length": 66, "num_lines": 60, "path": "/tests/core/test_headerupdater.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nHeaderUpdater class test\n========================\n'''\n\nimport unittest\nfrom tests.testutils import print_testtitle, validate_with_fail\nfrom builder.commands.scode import SCode, SCmd\nfrom builder.containers.chapter import Chapter\nfrom builder.containers.episode import Episode\nfrom builder.containers.scene import Scene\nfrom builder.containers.story import Story\nfrom builder.core import headerupdater as hd\n\n\nclass HeaderUpdaterTest(unittest.TestCase):\n\n @classmethod\n def setUpClass(cls):\n print_testtitle(hd.__name__, 'HeaderUpdater class')\n\n def test_instance(self):\n tmp = hd.HeaderUpdater()\n self.assertIsInstance(tmp, hd.HeaderUpdater)\n\n def test_title_of(self):\n data = [\n # (src, expect, exp_opt)\n (True, Story('test',), ('test',), 1),\n ]\n def checker(src, expect, exp_opt):\n tmp = hd.HeaderUpdater()._title_of(src)\n self.assertIsInstance(tmp, SCode)\n self.assertEqual(tmp.cmd, SCmd.TAG_TITLE)\n self.assertEqual(tmp.script, expect)\n self.assertEqual(tmp.option, exp_opt)\n validate_with_fail(self, 'title_of', checker, data)\n\n def test_outline_of(self):\n data = [\n # (src, expect)\n (True, Story('test',outline='apple'), ('apple',)),\n ]\n def checker(src, expect):\n tmp = hd.HeaderUpdater()._outline_of(src)\n self.assertIsInstance(tmp, SCode)\n self.assertEqual(tmp.cmd, SCmd.TAG_COMMENT)\n self.assertEqual(tmp.script, expect)\n validate_with_fail(self, 'outline_of', checker, data)\n\n def test_end_of(self):\n data = [\n # (src, expect)\n (True, Chapter('test',), SCmd.END_CHAPTER),\n ]\n validate_with_fail(self, 'end_of',\n lambda src, expect: self.assertEqual(\n hd.HeaderUpdater()._end_of(src).cmd, expect),\n data)\n" }, { "alpha_fraction": 0.5614144206047058, "alphanum_fraction": 0.5620347261428833, "avg_line_length": 22.705883026123047, "blob_id": "4bfc95d548eb22e741b9dd87882265ab9f52b268", "content_id": "978b8d6118a76addcbeb39857e31030a881a4047", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1612, "license_type": "permissive", "max_line_length": 80, "num_lines": 68, "path": "/builder/datatypes/sceneinfo.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nScene Information Data\n======================\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('SceneInfo',)\n\n\nimport datetime\nfrom builder.objects.day import Day\nfrom builder.objects.time import Time\nfrom builder.objects.person import Person\nfrom builder.objects.stage import Stage\nfrom builder.utils import assertion\n\n\nclass SceneInfo(object):\n ''' Scene Info Data class.\n '''\n def __init__(self,\n camera: Person,\n stage: Stage,\n day: Day,\n time: Time,\n ):\n self._camera = assertion.is_instance(camera, Person) if camera else None\n self._stage = assertion.is_instance(stage, Stage) if stage else None\n self._day = assertion.is_instance(day, Day) if day else None\n self._time = assertion.is_instance(time, Time) if time else None\n\n #\n # property\n #\n\n @property\n def camera(self) -> (Person, None):\n return self._camera\n\n @property\n def stage(self) -> (Stage, None):\n return self._stage\n\n @property\n def day(self) -> (Day, None):\n return self._day\n\n @property\n def time(self) -> (Time, None):\n return self._time\n\n #\n # methods\n #\n\n def inherited(self,\n camera: Person=None,\n stage: Stage=None,\n day: Day=None,\n time: Time=None) -> SceneInfo:\n return SceneInfo(\n camera if camera else self.camera,\n stage if stage else self.stage,\n day if day else self.day,\n time if time else self.time,\n )\n" }, { "alpha_fraction": 0.5091911554336548, "alphanum_fraction": 0.5101103186607361, "avg_line_length": 30.08571434020996, "blob_id": "bbee8da67af53e81ee626bbc236c0e05c907129d", "content_id": "78431836829abe9761ca887e0322c653119dc8e8", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1088, "license_type": "permissive", "max_line_length": 85, "num_lines": 35, "path": "/tests/commands/test_command.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nCommand enum test\n=================\n'''\n\nimport argparse\nimport unittest\nfrom tests.testutils import print_testtitle, validate_with_fail\nfrom builder.commands import command as cmd\n\n\nclass SCmdEnumTest(unittest.TestCase):\n\n @classmethod\n def setUpClass(cls):\n print_testtitle(cmd.__name__, 'SCmd enum class')\n\n def test_get_commandline_arguments(self):\n self.assertEqual(\n set(cmd.SCmd.get_all_actions()),\n set(cmd.SCmd.get_normal_actions() + cmd.SCmd.get_dialogue_actions()))\n self.assertEqual(\n set(cmd.SCmd.get_all()),\n set(\n cmd.SCmd.get_all_actions() \\\n + cmd.SCmd.get_end_of_containers() \\\n + cmd.SCmd.get_head_of_containers() \\\n + cmd.SCmd.get_informations() \\\n + cmd.SCmd.get_scene_controls() \\\n + cmd.SCmd.get_plot_infos() \\\n + cmd.SCmd.get_tags() \\\n + [cmd.SCmd.THEN]\n )\n )\n" }, { "alpha_fraction": 0.5920000076293945, "alphanum_fraction": 0.5935999751091003, "avg_line_length": 25, "blob_id": "aa9027216bf1fb88986c360a7ddad13d13aaf32c", "content_id": "6d586475303b1d86fcdb7c4a5bcd5a2a39f243af", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 627, "license_type": "permissive", "max_line_length": 76, "num_lines": 24, "path": "/builder/utils/util_name.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nName Utility methods\n====================\n'''\n\n__all__ = (\n 'name_set_from',\n )\n\n\nfrom builder.utils import assertion\n\n\ndef name_set_from(basename: str, name: str) -> tuple:\n lastname = firstname = fullname = exfullname = ''\n tmp = assertion.is_str(basename) if basename else assertion.is_str(name)\n if ',' in tmp:\n lastname, firstname = tmp.split(',')\n else:\n lastname = firstname = tmp\n fullname = tmp.replace(',', '')\n exfullname = f'{firstname}・{lastname}' if firstname != lastname else tmp\n return (firstname, lastname, fullname, exfullname)\n\n" }, { "alpha_fraction": 0.5923846960067749, "alphanum_fraction": 0.5987308025360107, "avg_line_length": 33.141666412353516, "blob_id": "1fa8b77422dcb10f7513a6e4c13dfdc025e77e47", "content_id": "b742ed4f8c19dfcd84cbd01234d0756c716140e5", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 4137, "license_type": "permissive", "max_line_length": 96, "num_lines": 120, "path": "/analyzer/core/percent_analyzer.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nPercent Analyzer Object\n=======================\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('PercentAnalyzer',)\n\n\nfrom analyzer.datatypes.analyzerexception import AnalyzerError\nfrom analyzer.datatypes.mecabdata import MecabData\nfrom analyzer.datatypes.wordclass import WordClass\nfrom analyzer.tools.counter import WordCounter\nfrom builder.core.executer import Executer\nfrom builder.datatypes.resultdata import ResultData\nfrom builder.datatypes.textlist import TextList\nfrom builder.utils import assertion\nfrom builder.utils.util_math import safe_divided\nfrom builder.utils.util_str import kanji_list_from, katakana_list_from, hiragana_list_from\nfrom builder.utils.logger import MyLogger\n\n\n# logger\nLOG = MyLogger.get_logger(__name__)\nLOG.set_file_handler()\n\n\nclass PercentAnalyzeError(AnalyzerError):\n ''' General error in PercentAnalyzer.\n '''\n pass\n\n\nclass PercentAnalyzer(Executer):\n ''' Percent Analyze class.\n '''\n def __init__(self):\n super().__init__()\n LOG.info('PERCENT_ANALYZER: initialize')\n\n #\n # methods\n #\n\n def execute(self, src: TextList) -> ResultData:\n LOG.info('PERCENT_ANALYZER: start exec')\n is_succeeded = True\n error = None\n tmp = assertion.is_listlike(self._exec_internal(src))\n return ResultData(\n tmp,\n is_succeeded,\n error)\n\n #\n # private methods\n #\n\n def _exec_internal(self, src: TextList) -> list:\n LOG.debug(f'-- src: {src}')\n tmp = []\n tmp.append('# 割合データ\\n')\n tmp.extend(self._kanji_percents(src))\n tmp.append('')\n tmp.extend(self._dialogue_percents(src))\n tmp.append('')\n return tmp\n\n def _kanji_percents(self, src: TextList) -> list:\n assertion.is_instance(src, TextList)\n tmp = []\n totals = sum([len(self._rid_topspace(line)) for line in src.data])\n kanjis = 0\n katakanas = 0\n hiraganas = 0\n for line in src.data:\n kanjis += sum(len(v) for v in kanji_list_from(line))\n katakanas += sum(len(v) for v in katakana_list_from(line))\n hiraganas += sum(len(v) for v in hiragana_list_from(line))\n kanji_per = safe_divided(kanjis, totals) * 100\n katakana_per = safe_divided(katakanas, totals) * 100\n hiragana_per = safe_divided(hiraganas, totals) * 100\n tmp.append('## カナ・漢字\\n')\n tmp.append(f\"- Total: {totals}c\")\n tmp.append(f'- Kanji: {kanji_per:.2f}% [{kanjis}c]')\n tmp.append(f'- Katakana: {katakana_per:.2f}% [{katakanas}c]')\n tmp.append(f'- Hiragana: {hiragana_per:.2f}% [{hiraganas}c]')\n return tmp\n\n def _dialogue_percents(self, src: TextList) -> list:\n assertion.is_instance(src, TextList)\n tmp = []\n def _is_desc(val):\n return val.startswith(' ')\n def _is_dialogue(val):\n return val.startswith(('「', '『'))\n totals = len([line for line in src.data])\n total_chars = sum([len(self._rid_topspace(line)) for line in src.data])\n descriptions = len([line for line in src.data if _is_desc(line)])\n desc_chars = sum([len(self._rid_topspace(line)) for line in src.data if _is_desc(line)])\n dialogues = len([line for line in src.data if _is_dialogue(line)])\n dial_chars = sum([len(line) for line in src.data if _is_dialogue(line)])\n desc_per = safe_divided(desc_chars, total_chars) * 100\n dial_per = safe_divided(dial_chars, total_chars) * 100\n tmp.append('## 台詞\\n')\n tmp.append(f'- Total : {total_chars}c / {totals}line')\n tmp.append(f'- Description: {desc_per:.2f}% [{desc_chars}c / {descriptions}line]')\n tmp.append(f'- Dialogue : {dial_per:.2f}% [{dial_chars}c / {dialogues}line]')\n return tmp\n\n def _rid_topspace(self, src: str):\n if assertion.is_str(src).startswith(' '):\n if src.startswith('    '):\n return src[4:]\n else:\n return src[1:]\n else:\n return src\n" }, { "alpha_fraction": 0.6045627593994141, "alphanum_fraction": 0.6112167239189148, "avg_line_length": 32.935482025146484, "blob_id": "afb7b80dada2629e0dff448125a720a28b9e211d", "content_id": "831000133b9c345f59f4e7e422203f8c3f7601db", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1052, "license_type": "permissive", "max_line_length": 79, "num_lines": 31, "path": "/tests/datatypes/test_resultdata.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nResultData class test\n=====================\n'''\n\nimport unittest\nfrom tests.testutils import print_testtitle, validate_with_fail\nfrom builder.datatypes.builderexception import BuilderError\nfrom builder.datatypes import resultdata as rd\n\n\nclass ResultDataTest(unittest.TestCase):\n\n @classmethod\n def setUpClass(cls):\n print_testtitle(rd.__name__, 'ResultData class')\n\n def test_instance(self):\n data = [\n # (data, is_succeeded, error, expect, exp_is_scd, exp_error)\n (True, [1,2,3], True, None,\n [1,2,3], True, None),\n ]\n def checker(rdata, is_succeeded, error, expect, exp_is_scd, exp_error):\n tmp = rd.ResultData(rdata, is_succeeded, error)\n self.assertIsInstance(tmp, rd.ResultData)\n self.assertEqual(tmp.data, expect)\n self.assertEqual(tmp.is_succeeded, exp_is_scd)\n self.assertEqual(tmp.error, exp_error)\n validate_with_fail(self, 'class instance', checker, data)\n" }, { "alpha_fraction": 0.652466356754303, "alphanum_fraction": 0.6547085046768188, "avg_line_length": 21.25, "blob_id": "6f5712c9bfb1bbc04f95b6ae29a2645387ec5b3e", "content_id": "3ab65f9233f5b33fe212c56ac9a65bed2532c487", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 446, "license_type": "permissive", "max_line_length": 63, "num_lines": 20, "path": "/tests/core/test_formatter.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nFormatter class test\n====================\n'''\n\nimport unittest\nfrom tests.testutils import print_testtitle, validate_with_fail\nfrom builder.core import formatter as fm\n\n\nclass FormatterTest(unittest.TestCase):\n\n @classmethod\n def setUpClass(cls):\n print_testtitle(fm.__name__, 'Formatter class')\n\n def test_instance(self):\n tmp = fm.Formatter()\n self.assertIsInstance(tmp, fm.Formatter)\n\n" }, { "alpha_fraction": 0.5969449877738953, "alphanum_fraction": 0.5975559949874878, "avg_line_length": 34.3237419128418, "blob_id": "83d3327542ecbd50dbc0e05b18ba38f2b470c2fe", "content_id": "99d8e6d996b82f94a669dba6818ead4625d481e5", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 4910, "license_type": "permissive", "max_line_length": 158, "num_lines": 139, "path": "/builder/core/sceneupdater.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nScene Info Updater Object\n=========================\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('SceneUpdater',)\n\n\nfrom typing import Tuple\nfrom builder.commands.scode import SCode, SCmd\nfrom builder.containers.chapter import Chapter\nfrom builder.containers.episode import Episode\nfrom builder.containers.material import Material\nfrom builder.containers.scene import Scene\nfrom builder.containers.story import Story\nfrom builder.core.executer import Executer\nfrom builder.datatypes.builderexception import BuilderError\nfrom builder.datatypes.resultdata import ResultData\nfrom builder.datatypes.sceneinfo import SceneInfo\nfrom builder.objects.day import Day\nfrom builder.objects.person import Person\nfrom builder.objects.stage import Stage\nfrom builder.objects.time import Time\nfrom builder.utils import assertion\nfrom builder.utils.logger import MyLogger\n\n\n# alias\nContainerLike = (Story, Chapter, Episode, Scene, SCode, Material)\n\n\n# logger\nLOG = MyLogger.get_logger(__name__)\nLOG.set_file_handler()\n\n\nclass SceneUpdaterError(BuilderError):\n ''' General Error of SceneUpdater.\n '''\n pass\n\n\nclass SceneUpdater(Executer):\n ''' Scene Updater Executer class.\n '''\n def __init__(self):\n super().__init__()\n LOG.info('SCENE_UPDATER: initialize')\n\n #\n # methods\n #\n\n def execute(self, src: Story) -> ResultData:\n LOG.info('SCENE_UPDATER: start exec')\n tmp, is_succeeded, error = assertion.is_tuple(self._exec_internal(src))\n return ResultData(\n assertion.is_instance(tmp, Story),\n is_succeeded,\n error)\n\n #\n # private methods\n #\n\n def _exec_internal(self, src: Story) -> Tuple[Story, bool, (SceneUpdaterError, None)]:\n assertion.is_instance(src, Story)\n\n tmp = []\n is_succeeded = True\n error = None\n camera = None\n stage = None\n day = None\n time = None\n\n for child in src.children:\n if isinstance(child, (Chapter, Episode, Scene)):\n LOG.debug(f'>> {camera.name if camera else camera}/{stage.name if stage else stage}/{day.name if day else day}/{time.name if time else time}')\n ret, camera, stage, day, time = self._updated_scene_info(child, camera, stage, day, time)\n tmp.append(ret)\n elif isinstance(child, SCode):\n tmp.append(child)\n elif isinstance(child, Material):\n tmp.append(child)\n else:\n msg = f'Invalid a child value in scene_update_exec!: {type(child)}: {child}'\n LOG.error(msg)\n error = SceneUpdaterError(msg)\n return src.inherited(*tmp), is_succeeded, error\n\n\n def _updated_scene_info(self, src: (Chapter, Episode, Scene, SCode),\n camera: Person=None,\n stage: Stage=None,\n day: Day=None,\n time: Time=None) -> Tuple[(Chapter, Episode, Scene), (Person, None), (Stage, None), (Day, None), (Time, None)]:\n if isinstance(src, (Chapter, Episode)):\n tmp = []\n for child in src.children:\n ret, camera, stage, day, time = self._updated_scene_info(child, camera, stage, day, time)\n tmp.append(ret)\n return src.inherited(*tmp), camera, stage, day, time\n elif isinstance(src, Scene):\n ret = self._get_scene_info(src)\n if not ret:\n LOG.error(f'Not found a SceneInfo!: in {src.title} scene')\n return src, camera, stage, day, time\n else:\n assertion.is_instance(ret, SCode)\n info = assertion.is_instance(ret.script[0], SceneInfo)\n camera = info.camera if info.camera else camera\n stage = info.stage if info.stage else stage\n day = info.day if info.day else day\n time = info.time if info.time else time\n codes = []\n for child in src.children:\n if self._is_scene_info(child):\n codes.append(child.inherited(script=(SceneInfo(camera, stage, day, time),)))\n else:\n codes.append(child)\n return src.inherited(*codes), camera, stage, day, time\n elif isinstance(src, SCode):\n return src, camera, stage, day, time\n else:\n LOG.error(f'Invalid value in updated_scene_info: {src}')\n return src, camera, stage, day, time\n\n def _get_scene_info(self, src: Scene) -> (SCode, None):\n for child in assertion.is_instance(src, Scene).children:\n if self._is_scene_info(child):\n return child\n return None\n\n def _is_scene_info(self, src) -> bool:\n return isinstance(src, SCode) and src.cmd is SCmd.INFO_DATA and isinstance(src.script[0], SceneInfo)\n" }, { "alpha_fraction": 0.5572670102119446, "alphanum_fraction": 0.559636652469635, "avg_line_length": 35.563175201416016, "blob_id": "1b278653d8add34953eedac2b3356ad50512f6dd", "content_id": "0e009503c56ac4c04e980944d824b2029421266e", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 10128, "license_type": "permissive", "max_line_length": 91, "num_lines": 277, "path": "/builder/core/headerupdater.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nHeader Updater Object\n=====================\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('HeaderUpdater',)\n\n\nfrom builder.commands.scode import SCode, SCmd\nfrom builder.containers.chapter import Chapter\nfrom builder.containers.episode import Episode\nfrom builder.containers.material import Material\nfrom builder.containers.scene import Scene\nfrom builder.containers.story import Story\nfrom builder.core.executer import Executer\nfrom builder.datatypes.builderexception import BuilderError\nfrom builder.datatypes.headerinfo import HeaderInfo\nfrom builder.datatypes.resultdata import ResultData\nfrom builder.datatypes.sceneinfo import SceneInfo\nfrom builder.datatypes.storyconfig import StoryConfig\nfrom builder.objects.day import Day\nfrom builder.objects.person import Person\nfrom builder.objects.stage import Stage\nfrom builder.objects.time import Time\nfrom builder.tools.checker import Checker\nfrom builder.tools.collecter import Collecter\nfrom builder.tools.counter import Counter\nfrom builder.utils import assertion\nfrom builder.utils.logger import MyLogger\n\n\n# alias\nStoryObjectLike = (Story, Chapter, Episode ,Scene, SCode, Material)\n\n\n# logger\nLOG = MyLogger.get_logger(__name__)\nLOG.set_file_handler()\n\n\nclass HeaderUpdater(Executer):\n ''' Header Updater Executer class.\n '''\n def __init__(self):\n super().__init__()\n LOG.info('HEAD_UPDATE: intialize')\n\n #\n # methods\n #\n\n def execute(self, src: Story, config: StoryConfig) -> ResultData:\n LOG.info('HEAD_UPDATE: start exec')\n is_succeeded = True\n error = None\n tmp = assertion.is_instance(self._exec_internal(src, config),\n Story)\n return ResultData(\n tmp,\n is_succeeded,\n error)\n\n #\n # private methods\n #\n\n def _exec_internal(self, src: Story, config: StoryConfig) -> Story:\n tmp = []\n columns = config.columns\n rows = config.rows\n assertion.is_instance(src, Story)\n count = Counter()\n\n config.set_desc_size(count.description_characters_of(src))\n config.set_desc_papers(count.manupaper_numbers_of(\n count.manupaper_rows_of(src, columns), rows))\n config.set_total_size(count.total_characters_of(src, True))\n config.set_total_papers(count.manupaper_numbers_of(\n count.manupaper_rows_of(src, columns, True), rows))\n\n\n tmp.append(self._collect_header_info(src, columns, rows))\n tmp.append(self._title_of(src))\n if src.outline:\n tmp.append(self._outline_of(src))\n tmp.append(self._get_contents(src, 0))\n tmp.append(self._get_contents(src, 1))\n tmp.append(self._get_contents(src, 2))\n tmp.append(self._get_storydata(src, config))\n\n for child in src.children:\n if isinstance(child, (Chapter, Episode, Scene)):\n tmp.append(self._update_container_info(child, columns, rows))\n elif isinstance(child, SCode):\n tmp.append(child)\n elif isinstance(child, Material):\n tmp.append(self._update_container_info(child, columns, rows))\n else:\n LOG.error(f'Invalid a child value!: {type(child)}: {child}')\n tmp.append(self._get_story_info(src, config))\n\n return src.inherited(*tmp)\n\n\n def _update_container_info(self, src: (Chapter, Episode, Scene, Material),\n columns: int, rows: int) -> (Chapter, Episode, Scene, Material):\n LOG.info('HEAD_UPDATER: update_container_info')\n LOG.debug(f'-- src: {src}')\n LOG.debug(f'-- columns/rows: {columns}/{rows}')\n\n assertion.is_instance(src, (Chapter, Episode, Scene, Material))\n\n tmp = []\n tmp.append(self._containerhead_of(src))\n tmp.append(self._collect_header_info(src, columns, rows))\n tmp.append(self._title_of(src))\n if isinstance(src, Scene):\n tmp.append(self._collect_scene_info(src))\n if src.outline:\n tmp.append(self._outline_of(src))\n for child in src.children:\n if isinstance(child, (Chapter, Episode, Scene)):\n tmp.append(self._update_container_info(child, columns, rows))\n elif isinstance(child, SCode):\n if Checker().has_then(child):\n tmp.append(SCode(None, SCmd.THEN, (), ''))\n tmp.append(child)\n elif isinstance(child, Material):\n tmp.append(self._update_container_info(child, columns, rows))\n else:\n LOG.error(f'Invalid child value!: {type(child)} | {child}')\n tmp.append(self._end_of(src))\n return src.inherited(*tmp)\n\n def _collect_header_info(self, src: (Story, Chapter, Episode, Scene, Material),\n columns: int, rows: int) -> SCode:\n count = Counter()\n total_lines = count.manupaper_rows_of(src, columns, True)\n lines = count.manupaper_rows_of(src, columns)\n total = count.total_characters_of(src, isinstance(src, Material))\n return SCode(None, SCmd.INFO_DATA,\n (HeaderInfo(\n total,\n total_lines,\n count.manupaper_numbers_of(total_lines, rows),\n count.description_characters_of(src),\n lines,\n count.manupaper_numbers_of(lines, rows),\n count.chapters_of(src),\n count.episodes_of(src),\n count.scenes_of(src),\n count.scodes_of_without_info(src),\n ),),\n '')\n\n def _collect_scene_info(self, src: Scene) -> SCode:\n collect = Collecter()\n cameras = collect.cameras_in_scene(src)\n stages = collect.stages_in_scene(src)\n days = collect.days_in_scene(src)\n times = collect.times_in_scene(src)\n return SCode(None, SCmd.INFO_DATA,\n (SceneInfo(\n cameras[0] if cameras else None,\n stages[0] if stages else None,\n days[0] if days else None,\n times[0] if times else None,\n ),),\n '')\n\n def _title_of(self, src: (Story, Chapter, Episode, Scene, Material)) -> SCode:\n level = 0\n if isinstance(src, Story):\n level = 1\n elif isinstance(src, Chapter):\n level = 2\n elif isinstance(src, Episode):\n level = 3\n elif isinstance(src, Scene):\n level = 4\n elif isinstance(src, Material):\n level = 2\n else:\n LOG.critical(f'Invalid source of a story object: {type(src)}: {src}')\n return SCode(None, SCmd.TAG_TITLE, (src.title,), level)\n\n def _outline_of(self, src: (Story, Chapter, Episode, Scene, Material)) -> SCode:\n return SCode(None, SCmd.TAG_COMMENT, (src.outline,), \"outline\")\n\n\n def _end_of(self, src: (Chapter, Episode, Scene, Material)) -> (SCode, None):\n cmd = None\n if isinstance(src, Chapter):\n cmd = SCmd.END_CHAPTER\n elif isinstance(src, Episode):\n cmd = SCmd.END_EPISODE\n elif isinstance(src, Scene):\n cmd = SCmd.END_SCENE\n elif isinstance(src, Material):\n cmd = SCmd.END_MATERIAL\n else:\n LOG.error(f'Invalid source!: {src}')\n return SCode(None, cmd, (), '') if cmd else None\n\n\n def _containerhead_of(self, src: (Chapter, Episode, Scene, Material)) -> (SCode, None):\n cmd = None\n if isinstance(src, Chapter):\n cmd = SCmd.HEAD_CHAPTER\n elif isinstance(src, Episode):\n cmd = SCmd.HEAD_EPISODE\n elif isinstance(src, Scene):\n cmd = SCmd.HEAD_SCENE\n elif isinstance(src, Material):\n cmd = SCmd.HEAD_MATERIAL\n else:\n LOG.error(f'Invalid source in containerhead_of: {src}')\n return SCode(None, cmd, (), '') if cmd else None\n\n\n def _get_contents(self, src: Story, info_level: int) -> SCode:\n collect = Collecter()\n tmp = []\n ch_n = ep_n = sc_n = 1\n titles = []\n if info_level == 1:\n # for Story\n titles = collect.container_titles_without_material(src)\n elif info_level == 2:\n # Materials\n titles = collect.container_titles_only_materials(src)\n else:\n # All (for Plot)\n titles = collect.container_titles(src)\n for title_set in titles:\n level, title = title_set.split(':')\n if level == '0':\n continue\n elif level == '1':\n tmp.append(f'{ch_n}. {title}')\n ch_n += 1\n elif level == '2':\n tmp.append(f' {ep_n}. {title}')\n ep_n += 1\n elif level == '3':\n tmp.append(f' {sc_n}. {title}')\n sc_n += 1\n else:\n continue\n return SCode(None, SCmd.TAG_TITLE, ('\\n'.join(tmp),), f'contents:{info_level}')\n\n def _get_story_info(self, src: Story, config: StoryConfig) -> SCode:\n version = config.version\n return SCode(None, SCmd.INFO_CONTENT, (f'version: {version}',), '')\n\n def _get_storydata(self, src: Story, config: StoryConfig) -> SCode:\n return SCode(None, SCmd.INFO_STORY,\n ({\n 'title': config.title,\n 'copy': config.copy,\n 'oneline': config.oneline,\n 'outline': config.outline,\n 'contest_info': config.contest_info,\n 'caution': config.caution,\n 'note': config.note,\n 'sites': config.sites,\n 'tags': config.taginfos,\n 'total_chars': Counter().description_characters_of(src),\n 'version': config.version,\n 'modified': config.modified,\n 'released': config.released,\n },\n ),\n '')\n" }, { "alpha_fraction": 0.5863309502601624, "alphanum_fraction": 0.5875299572944641, "avg_line_length": 27.724138259887695, "blob_id": "48371e32fa70cf5bc35afb90205d8a67a1d11df8", "content_id": "686534f14880e2a5094870aea9995e0d788d9b02", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 834, "license_type": "permissive", "max_line_length": 63, "num_lines": 29, "path": "/tests/datatypes/test_rawdata.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nRawData class test\n==================\n'''\n\nimport unittest\nfrom tests.testutils import print_testtitle, validate_with_fail\nfrom builder.datatypes.formattag import FormatTag\nfrom builder.datatypes import rawdata as rd\n\n\nclass RawDataTest(unittest.TestCase):\n\n @classmethod\n def setUpClass(cls):\n print_testtitle(rd.__name__, 'RawData class')\n\n def test_instance(self):\n data = [\n # (args, expect)\n (True, ('a', 'b', FormatTag.DESCRIPTION_HEAD),\n ('a', 'b', FormatTag.DESCRIPTION_HEAD)),\n ]\n def checker(args, expect):\n tmp = rd.RawData(*args)\n self.assertIsInstance(tmp, rd.RawData)\n self.assertEqual(tmp.data, expect)\n validate_with_fail(self, 'instance', checker, data)\n\n" }, { "alpha_fraction": 0.5083848834037781, "alphanum_fraction": 0.511005163192749, "avg_line_length": 38.589210510253906, "blob_id": "c8ad77f048ef85a8133aa8f4e5a973707d01a08c", "content_id": "659a3b1a1b30a25f83b6b0a99b6a81fc7ab127a6", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 19418, "license_type": "permissive", "max_line_length": 110, "num_lines": 482, "path": "/builder/core/compiler.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nCompiler Object\n===============\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('Compiler',)\n\n\nfrom enum import Enum, auto\nfrom typing import Tuple\nfrom builder.commands.scode import SCode, SCmd\nfrom builder.core.executer import Executer\nfrom builder.datatypes.builderexception import BuilderError\nfrom builder.datatypes.codelist import CodeList\nfrom builder.datatypes.compilemode import CompileMode\nfrom builder.datatypes.formattag import FormatTag\nfrom builder.datatypes.headerinfo import HeaderInfo\nfrom builder.datatypes.rawdata import RawData\nfrom builder.datatypes.resultdata import ResultData\nfrom builder.datatypes.plotinfo import PlotInfo\nfrom builder.datatypes.sceneinfo import SceneInfo\nfrom builder.objects.rubi import Rubi\nfrom builder.tools.checker import Checker\nfrom builder.tools.converter import Converter\nfrom builder.utils import assertion\nfrom builder.utils.logger import MyLogger\nfrom builder.utils.util_str import validate_string_duplicate_chopped, validate_dialogue_brackets\n\n\n# logger\nLOG = MyLogger.get_logger(__name__)\nLOG.set_file_handler()\n\n\nclass CompileModeError(BuilderError):\n ''' Exception of Compile mode mismatch.\n '''\n pass\n\n\nclass CompileSCmdError(BuilderError):\n ''' Exception of Compile SCode command mismatch.\n '''\n pass\n\n\nclass Compiler(Executer):\n ''' Compiler Executer class.\n '''\n def __init__(self):\n super().__init__()\n LOG.info('COMPILER: initialize')\n\n #\n # methods\n #\n\n def execute(self, src: CodeList, mode: CompileMode,\n rubis: dict=None, is_rubi: bool=False, is_comment: bool=True) -> ResultData:\n LOG.info('COMPILER: start exec')\n\n is_succeeded = True\n tmp = []\n error = None\n\n if assertion.is_instance(mode, CompileMode) is CompileMode.NORMAL:\n tmp = assertion.is_instance(self._conv_to_novel(src, is_comment), RawData)\n if is_rubi:\n tmp = assertion.is_instance(self._add_rubi_on_novel(tmp, rubis),\n RawData)\n elif mode is CompileMode.PLOT:\n tmp = assertion.is_instance(self._conv_to_plot(src, False), RawData)\n elif mode is CompileMode.STORY_DATA:\n tmp = assertion.is_instance(self._conv_to_plot(src, True), RawData)\n elif mode is CompileMode.NOVEL_TEXT:\n tmp = assertion.is_instance(self._conv_to_novel(src, is_comment), RawData)\n tmp = assertion.is_instance(self._conv_to_text(tmp), RawData)\n if is_rubi:\n tmp = assertion.is_instance(self._add_rubi_on_novel(tmp, rubis), RawData)\n elif mode is CompileMode.SCENARIO:\n tmp = src\n elif mode is CompileMode.AUDIODRAMA:\n tmp = src\n else:\n msg = f'Invalid CompileMode!: {mode}'\n LOG.error(msg)\n error = CompileModeError(msg)\n return ResultData(\n tmp,\n is_succeeded,\n error)\n\n #\n # private methods (novel)\n #\n\n def _conv_to_novel(self, src: CodeList, is_comment: bool) -> RawData:\n LOG.info('COMP: conv_to_novel start')\n\n tmp = []\n checker = Checker()\n conv = Converter()\n is_added = False\n is_then = False\n in_dialogue = False\n desc_head = \" \"\n head_info = \"\"\n dial_stock = None\n ch_num = ep_num = sc_num = 1\n\n for code in assertion.is_instance(src, CodeList).data:\n assertion.is_instance(code, SCode)\n # actions\n if code.cmd in SCmd.get_normal_actions():\n if not checker.is_empty_script(code):\n if not is_then or in_dialogue:\n tmp.append(FormatTag.DESCRIPTION_HEAD)\n in_dialogue = False\n tmp.append(f'{desc_head}{conv.to_description(conv.script_relieved_symbols(code.script))}')\n is_added = True\n elif code.cmd in SCmd.get_dialogue_actions():\n in_dialogue = True\n is_voice = code.cmd is SCmd.VOICE\n script = conv.script_relieved_symbols(code.script)\n if dial_stock:\n script = dial_stock + script\n dial_stock = None\n if not is_then:\n tmp.append(FormatTag.DIALOGUE_HEAD)\n if is_voice:\n tmp.append(f'{conv.to_dialogue(script, (\"『\", \"』\"))}')\n else:\n tmp.append(f'{conv.to_dialogue(script)}')\n else:\n dial_stock = conv.script_relieved_symbols(code.script)\n is_added = True\n # then\n elif code.cmd is SCmd.THEN:\n is_then = True\n # container break\n elif code.cmd in SCmd.get_end_of_containers():\n tmp.append(self._conv_from_end_container(code))\n elif code.cmd in SCmd.get_head_of_containers():\n # NOTE: materialで何かするならここでinto操作\n continue\n # tag\n elif code.cmd in SCmd.get_tags():\n ret, (ch_num, ep_num, sc_num) = self._conv_from_tag(code, head_info,\n (ch_num, ep_num, sc_num), is_comment, False, False, False)\n if ret:\n tmp.append(FormatTag.SYMBOL_HEAD if code.cmd is SCmd.TAG_SYMBOL else FormatTag.TAG_HEAD)\n tmp.append(ret)\n # info\n elif code.cmd in SCmd.get_informations():\n if code.cmd is SCmd.INFO_DATA:\n if isinstance(code.script[0], HeaderInfo):\n head_info = self._get_headinfo(code)\n elif isinstance(code.script[0], SceneInfo):\n tmp.append(self._get_sceneinfo(code))\n elif isinstance(code.script[0], PlotInfo):\n continue\n else:\n tmp.append(\"\".join(code.script))\n elif code.cmd is SCmd.INFO_CONTENT:\n tmp.append(self._get_storyinfo(code))\n continue\n # scene control\n elif code.cmd in SCmd.get_scene_controls():\n continue\n # plot control\n elif code.cmd in SCmd.get_plot_infos():\n continue\n else:\n msg = f'Unknown SCmd!: {code.cmd}'\n LOG.error(msg)\n if is_added:\n is_added = False\n if not is_then:\n tmp.append('\\n')\n desc_head = ' '\n else:\n is_then = False\n desc_head = ''\n return RawData(*tmp)\n\n def _conv_to_text(self, src: RawData) -> RawData:\n LOG.info('COMP: conv_to_text start')\n tmp = []\n checker = Checker()\n for line in assertion.is_instance(src, RawData).data:\n if isinstance(line, FormatTag):\n tmp.append(line)\n elif checker.is_breakline(line):\n tmp.append(line)\n elif \"# CONTENTS\" in line:\n continue\n elif line.startswith(\"○\"):\n continue\n elif checker.has_tag_top(line):\n if line.startswith('_'):\n continue\n else:\n tmp.append(line)\n elif line.startswith('<!--'):\n continue\n else:\n tmp.append(line)\n return RawData(*tmp)\n\n def _add_rubi_on_novel(self, src: RawData, rubis: dict) -> RawData:\n LOG.info('COMP: add_rubi_on_novel start')\n\n tmp = []\n discards = []\n checker = Checker()\n conv = Converter()\n\n for line in assertion.is_instance(src, RawData).data:\n if isinstance(line, FormatTag) \\\n or checker.has_tag_top(assertion.is_str(line)) \\\n or checker.is_breakline(line) \\\n or checker.has_tag_comment(line):\n tmp.append(line)\n else:\n for key, rubi in rubis.items():\n if key in discards:\n continue\n elif checker.has_rubi_key(line, key):\n if checker.has_rubi_exclusions(line, assertion.is_instance(rubi, Rubi).exclusions):\n continue\n line = conv.add_rubi(line, key, rubi.rubi)\n if not rubi.is_always:\n discards.append(key)\n tmp.append(line)\n return RawData(*tmp)\n\n #\n # private methods (plot)\n #\n\n def _conv_to_plot(self, src: CodeList, is_data: bool) -> RawData:\n LOG.info('COMP: conv_to_plot start')\n\n conv = Converter()\n tmp = []\n is_added = False\n head_info = ''\n in_material = False\n ch_num = ep_num = sc_num = 1\n\n for code in assertion.is_instance(src, CodeList).data:\n assertion.is_instance(code, SCode)\n # actions\n if code.cmd in SCmd.get_normal_actions():\n continue\n elif code.cmd in SCmd.get_dialogue_actions():\n continue\n # then\n elif code.cmd is SCmd.THEN:\n continue\n # container break\n elif code.cmd in SCmd.get_end_of_containers():\n if code.cmd is SCmd.END_CHAPTER:\n tmp.append('\\n')\n elif code.cmd is SCmd.END_MATERIAL:\n tmp.append('\\n')\n in_material = False\n else:\n continue\n elif code.cmd in SCmd.get_head_of_containers():\n if code.cmd is SCmd.HEAD_MATERIAL:\n in_material = True\n continue\n # tags\n elif code.cmd in SCmd.get_tags():\n ret, (ch_num, ep_num, sc_num) = self._conv_from_tag(code, head_info,\n (ch_num, ep_num, sc_num), True, not is_data, is_data, in_material)\n if ret:\n if code.cmd is SCmd.TAG_TITLE and not ret.startswith('#'):\n tmp.append('\\n')\n tmp.append(FormatTag.SYMBOL_HEAD if code.cmd is SCmd.TAG_SYMBOL else FormatTag.TAG_HEAD)\n tmp.append(ret)\n # info\n elif code.cmd in SCmd.get_informations():\n if code.cmd is SCmd.INFO_DATA:\n if isinstance(code.script[0], HeaderInfo):\n head_info = self._get_headinfo(code) + ' | T:' + self._get_headinfo_total(code)\n elif isinstance(code.script[0], SceneInfo):\n # NOTE: 場所情報はカット\n continue\n elif isinstance(code.script[0], PlotInfo):\n tmp.append(self._get_plotinfo(code))\n else:\n tmp.append(\"\".join(code.script))\n elif code.cmd is SCmd.INFO_CONTENT:\n tmp.append(self._get_storyinfo(code))\n elif code.cmd is SCmd.INFO_STORY and is_data:\n title = code.script[0]['title']\n tmp.append(self._get_storydata(code))\n continue\n # scene control\n elif code.cmd in SCmd.get_scene_controls():\n continue\n # plot control\n elif code.cmd in SCmd.get_plot_infos():\n ret = self._conv_from_plotinfo(code)\n if ret:\n tmp.append(ret)\n is_added = True\n # others\n else:\n LOG.error(f'Unknown SCmd!: {code.cmd}')\n if is_added:\n is_added = False\n tmp.append('\\n')\n return RawData(*tmp)\n\n #\n # privte methods (common)\n #\n\n def _conv_from_end_container(self, src: SCode) -> str:\n if assertion.is_instance(src, SCode).cmd is SCmd.END_CHAPTER:\n return '\\n--------\\n'\n elif src.cmd is SCmd.END_EPISODE:\n return '\\n\\n'\n elif src.cmd is SCmd.END_SCENE:\n return '\\n'\n else:\n return ''\n\n def _conv_from_tag(self, src: SCode, head_info: str, nums: tuple,\n is_comment: bool, is_plot: bool, is_data: bool, in_material: bool) -> Tuple[str, tuple]:\n assertion.is_str(head_info)\n tmp = ''\n ch_num, ep_num, sc_num = assertion.is_tuple(nums)\n if assertion.is_instance(src, SCode).cmd is SCmd.TAG_BR:\n tmp = '\\n\\n'\n elif src.cmd is SCmd.TAG_COMMENT:\n if is_comment:\n if src.option == 'outline':\n tmp = f'<!--\\n【{\"。\".join(src.script)}】\\n-->\\n\\n'\n else:\n if in_material:\n tmp = f'{\"。\".join(src.script)}\\n'\n else:\n tmp = f'<!--{\"。\".join(src.script)}-->\\n'\n elif src.cmd is SCmd.TAG_HR:\n tmp = '--------'*9\n elif src.cmd is SCmd.TAG_SYMBOL:\n tmp = f'\\n{\"\".join(src.script)}\\n\\n'\n elif src.cmd is SCmd.TAG_TITLE:\n if isinstance(src.option, str) and 'contents' in src.option:\n if not is_plot and not is_data and src.option == 'contents:1':\n tmp = f'---\\n# CONTENTS\\n{src.script[0]}\\n---\\n'\n elif is_plot and src.option == 'contents:0':\n tmp = f'---\\n# CONTENTS\\n{src.script[0]}\\n---\\n'\n elif is_data and src.option == 'contents:2':\n tmp = f'---\\n# CONTENTS\\n{src.script[0]}\\n---\\n'\n else:\n head = '#' * src.option if isinstance(src.option, int) else '##'\n info_str = f' {head_info}' if head_info else ''\n title = ''.join(src.script)\n head_info = ''\n if src.option == 1:\n tmp = f'{head} {title}{info_str}\\n\\n'\n elif src.option == 2:\n tmp = f'{head} Ch-{ch_num}: {title}{info_str}\\n\\n'\n ch_num += 1\n elif src.option == 3:\n tmp = f'{head} Ep-{ep_num}: {title}{info_str}\\n\\n'\n ep_num += 1\n elif src.option == 4:\n tmp = f'_S-{sc_num} {title}_ {info_str}\\n'\n sc_num += 1\n else:\n tmp = f'\\n{head} {title}\\n\\n'\n else:\n LOG.debug(f'Other tag: {src.cmd}')\n return (tmp, (ch_num, ep_num, sc_num))\n\n def _conv_from_plotinfo(self, code: SCode) -> str:\n tmp = ''\n conv = Converter()\n if code.cmd is SCmd.PLOT_NOTE:\n tmp = f' * {conv.to_description(code.script)}'\n elif code.cmd is SCmd.PLOT_MOTIF:\n tmp = f'[{conv.to_description(code.script)}][{code.option}]'\n elif code.cmd is SCmd.PLOT_FORESHADOW:\n tmp = f'\\t@{code.option} <-- |{conv.to_description(code.script)}'\n elif code.cmd is SCmd.PLOT_PAYOFF:\n tmp = f'\\t\\t@{code.option} --> |{conv.to_description(code.script)}'\n elif code.cmd is SCmd.PLOT_SETUP:\n tmp = f'[{code.option}:SETUP] {conv.to_description(code.script)}'\n elif code.cmd is SCmd.PLOT_DEVELOP:\n tmp = f'[{code.option}:DEVELOP] {conv.to_description(code.script)}'\n elif code.cmd is SCmd.PLOT_RESOLVE:\n tmp = f'[{code.option}:RESOLVE] {conv.to_description(code.script)}'\n elif code.cmd is SCmd.PLOT_TURNPOINT:\n tmp = f'[{code.option}:TURNP] {conv.to_description(code.script)}'\n return tmp\n\n def _get_headinfo(self, code: SCode) -> str:\n info = assertion.is_instance(\n assertion.is_instance(code, SCode).script[0], HeaderInfo)\n return f'[{info.desc_chars}c / {info.papers:.2f}p ({info.lines:.2f}ls)]'\n\n def _get_headinfo_total(self, code: SCode) -> str:\n info = assertion.is_instance(\n assertion.is_instance(code, SCode).script[0], HeaderInfo)\n return f'[{info.total_chars}c / {info.total_papers:.2f}p ({info.total_lines:.2f}ls)]'\n\n def _get_plotinfo(self, code: SCode) -> str:\n data = code.script[0].data\n tmp = []\n for val in data:\n info = Converter().to_description(val.script)\n if val.cmd is SCmd.PLOT_SETUP:\n tmp.append(f'[SETUP] {info}')\n elif val.cmd is SCmd.PLOT_DEVELOP:\n tmp.append(f'[DEVELOP] {info}')\n elif val.cmd is SCmd.PLOT_RESOLVE:\n tmp.append(f'[RESOLVE] {info}')\n elif val.cmd is SCmd.PLOT_TURNPOINT:\n tmp.append(f'[TURNING POINT] {info}')\n body = \"\\n\".join(tmp)\n return f'\\n## プロット情報「{code.script[0].title}」\\n\\n{body}\\n\\n---\\n'\n\n def _get_sceneinfo(self, code: SCode) -> str:\n data = assertion.is_instance(assertion.is_instance(code, SCode).script[0], SceneInfo)\n camera = data.camera.name if data.camera else \"第三者\"\n stage = data.stage.name if data.stage else \"どこか\"\n day = data.day.daystring if data.day else \"某月某日/某年\"\n time = data.time.name if data.time else \"不詳\"\n return f\"○{stage}({time}) - {day}【{camera}】\\n\"\n\n def _get_storyinfo(self, src: SCode) -> str:\n info = \"\".join(assertion.is_instance(src, SCode).script)\n return f\"<!-- STORY INFO:\\n{info}\\n-->\\n\"\n\n def _get_storydata(self, src: SCode) -> str:\n tmp = []\n data = assertion.is_instance(src, SCode).script[0]\n tmp.append('# Information')\n tmp.append(f'【コピィ】\\n{data[\"copy\"]}\\n')\n tmp.append(f'【ひとこと】\\n{data[\"oneline\"]}\\n')\n tmp.append(f'【あらすじ】\\n{data[\"outline\"]}\\n')\n if data[\"contest_info\"]:\n tmp.append(f'【コンテスト】\\n{data[\"contest_info\"]}\\n')\n if data[\"caution\"]:\n tmp.append(f'【注意事項】\\n{data[\"caution\"]}\\n')\n if data[\"sites\"]:\n if len(data[\"sites\"]) == 1:\n tmp.append(f'【掲載サイト】\\n本作は(data[\"sites\"][0])のみに掲載しています\\n')\n else:\n sites = \"、\".join(data[\"sites\"])\n tmp.append(f'【掲載サイト】\\n本作は({sites})の各サイトに掲載しています\\n')\n if data[\"note\"]:\n tmp.append(f'【備考】\\n{data[\"note\"]}\\n')\n if data[\"tags\"]:\n _ = \", \".join(data[\"tags\"])\n tmp.append(f'【タグ】\\n{_}\\n')\n digit = -3\n chars = data[\"total_chars\"]\n if chars > 1000:\n digit = -3\n elif chars > 100:\n digit = -2\n else:\n digit = 0\n tmp.append(f'【情報】\\n総文字数:約{round(data[\"total_chars\"], digit)}文字')\n tmp.append(f'バージョン:{self._conv_version_string(data[\"version\"])}')\n tmp.append(f'更新日:{data[\"modified\"].strftime(\"%Y.%m.%d\")}')\n tmp.append(f'公開日:{data[\"released\"].strftime(\"%Y.%m.%d\")}')\n body = \"\\n\".join(tmp)\n return f'\\n---\\n{body}\\n---\\n'\n\n def _conv_version_string(self, ver: tuple) -> str:\n return f'v{ver[0]}.{ver[1]}.{ver[2]}'\n" }, { "alpha_fraction": 0.5382353067398071, "alphanum_fraction": 0.5411764979362488, "avg_line_length": 13.782608985900879, "blob_id": "c34e3924553257389f410865d410befcddb00b49", "content_id": "b57d005c029dbc9364de67d058a58d6529459dd5", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 340, "license_type": "permissive", "max_line_length": 38, "num_lines": 23, "path": "/builder/datatypes/outputmode.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nOutput Mode Enum\n================\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('OutputMode',)\n\n\nfrom enum import Enum, auto\n\n\nclass OutputMode(Enum):\n ''' Output mode.\n '''\n CONSOLE = auto()\n FILE = auto()\n\n @classmethod\n def get_all(cls) -> list:\n return [cls.CONSOLE, cls.FILE]\n" }, { "alpha_fraction": 0.5707411170005798, "alphanum_fraction": 0.5736284852027893, "avg_line_length": 32.48387145996094, "blob_id": "2748409fbfa61f58fd04052858ac646f580f85d4", "content_id": "b857957b96b32608980a0d7ac0093b6e76c4ce99", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1063, "license_type": "permissive", "max_line_length": 91, "num_lines": 31, "path": "/tests/objects/test_rubi.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nRubi class test\n===============\n'''\n\nimport unittest\nfrom tests.testutils import print_testtitle, validate_with_fail\nfrom builder.objects import rubi as rb\n\n\nclass RubiTest(unittest.TestCase):\n\n @classmethod\n def setUpClass(cls):\n print_testtitle(rb.__name__, 'Rubi class')\n\n def test_instance(self):\n data = [\n # (name, rubi, exclusions, is_always, expect, exp_rubi, exp_excl, exp_al)\n (True, '太郎', '\\\\1《太郎》', (), True,\n '太郎', '\\\\1《太郎》', (), True),\n ]\n def checker(name, rubi, exclusions, is_always, expect, exp_rubi, exp_excl, exp_al):\n tmp = rb.Rubi(name, rubi, exclusions, is_always)\n self.assertIsInstance(tmp, rb.Rubi)\n self.assertEqual(tmp.name, expect)\n self.assertEqual(tmp.rubi, exp_rubi)\n self.assertEqual(tmp.exclusions, exp_excl)\n self.assertEqual(tmp.is_always, exp_al)\n validate_with_fail(self, 'class instance', checker, data)\n\n" }, { "alpha_fraction": 0.5873706936836243, "alphanum_fraction": 0.5879150629043579, "avg_line_length": 23.479999542236328, "blob_id": "e55e9c4b53ba9d25931020d21d18c40621570aab", "content_id": "9fd50d02e49ea91b89b70bb984b54dfad08878af", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1837, "license_type": "permissive", "max_line_length": 75, "num_lines": 75, "path": "/builder/datatypes/headerinfo.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nHeader Information Data\n=======================\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('HeaderInfo',)\n\n\nfrom builder.utils import assertion\n\n\nclass HeaderInfo(object):\n ''' Header Info Data class.\n '''\n def __init__(self,\n total_chars: int, total_lines: int, total_papers: (int, float),\n desc_chars: int, lines: int, papers: (int, float),\n chapters: int, episodes: int, scenes: int, scodes: int):\n self._total_chars = assertion.is_int(total_chars)\n self._total_lines = assertion.is_int(total_lines)\n self._total_papers = assertion.is_int_or_float(total_papers)\n self._desc_chars = assertion.is_int(desc_chars)\n self._lines = assertion.is_int(lines)\n self._papers = assertion.is_int_or_float(papers)\n self._chapters = assertion.is_int(chapters)\n self._episodes = assertion.is_int(episodes)\n self._scenes = assertion.is_int(scenes)\n self._scodes = assertion.is_int(scodes)\n\n #\n # property\n #\n\n @property\n def total_chars(self) -> int:\n return self._total_chars\n\n @property\n def total_lines(self) -> int:\n return self._total_lines\n\n @property\n def total_papers(self) -> (int, float):\n return self._total_papers\n\n @property\n def desc_chars(self) -> int:\n return self._desc_chars\n\n @property\n def lines(self) -> int:\n return self._lines\n\n @property\n def papers(self) -> (int, float):\n return self._papers\n\n @property\n def chapters(self) -> int:\n return self._chapters\n\n @property\n def episodes(self) -> int:\n return self._episodes\n\n @property\n def scenes(self) -> int:\n return self._scenes\n\n @property\n def scodes(self) -> int:\n return self._scodes\n\n" }, { "alpha_fraction": 0.583984375, "alphanum_fraction": 0.5859375, "avg_line_length": 17.925926208496094, "blob_id": "ef7cecdce6bd131a98151da7de0aec2766651549", "content_id": "377d1a8fde6a86a6ecd1c2405a195e6455f6ea5e", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 512, "license_type": "permissive", "max_line_length": 56, "num_lines": 27, "path": "/builder/datatypes/formattag.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nFormat Tag Enum\n===============\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('FormatTag',)\n\n\nfrom enum import Enum, auto\nfrom builder.utils import assertion\n\n\nclass FormatTag(Enum):\n ''' Format tag enumerate.\n '''\n DESCRIPTION_HEAD = auto()\n DIALOGUE_HEAD = auto()\n SYMBOL_HEAD = auto()\n TAG_HEAD = auto()\n\n @classmethod\n def get_all(cls) -> list:\n return [cls.DESCRIPTION_HEAD, cls.DIALOGUE_HEAD,\n cls.SYMBOL_HEAD, cls.TAG_HEAD]\n\n" }, { "alpha_fraction": 0.6127384305000305, "alphanum_fraction": 0.6161444187164307, "avg_line_length": 30.913043975830078, "blob_id": "6f1c31432bdb4f396882bf5e441a6a494c18d8bd", "content_id": "1ffb76702edc1efa3dab68b5bcc14874643121a6", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2978, "license_type": "permissive", "max_line_length": 172, "num_lines": 92, "path": "/analyzer/core/frequency_analyzer.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nFrequency Analyzer Object\n=========================\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('FrequencyAnalyzer',)\n\n\nfrom collections import Counter\nfrom analyzer.datatypes.analyzerexception import AnalyzerError\nfrom analyzer.datatypes.mecabdata import MecabData\nfrom analyzer.datatypes.tokenlist import TokenList\nfrom analyzer.datatypes.wordclass import WordClass\nfrom analyzer.tools.counter import WordCounter\nfrom builder.core.executer import Executer\nfrom builder.datatypes.resultdata import ResultData\nfrom builder.utils import assertion\nfrom builder.utils.util_str import kanji_list_from, katakana_list_from, hiragana_list_from\nfrom builder.utils.logger import MyLogger\n\n\n# logger\nLOG = MyLogger.get_logger(__name__)\nLOG.set_file_handler()\n\n\nclass FreqencyAnalyzeError(AnalyzerError):\n ''' General error in FrequencyAnalyzer.\n '''\n pass\n\n\nclass FrequencyAnalyzer(Executer):\n ''' Frequency Analyze class.\n '''\n def __init__(self):\n super().__init__()\n LOG.info('FREQ_ANALYZER: initialize')\n\n #\n # methods\n #\n\n def execute(self, src: TokenList) -> ResultData:\n LOG.info('FREQ_ANALYZER: start exec')\n is_succeeded = True\n error = None\n tmp = assertion.is_listlike(self._exec_internal(src))\n return ResultData(\n tmp,\n is_succeeded,\n error)\n\n #\n # private methods\n #\n\n def _exec_internal(self, src: TokenList) -> list:\n LOG.debug(f'-- src: {src}')\n assertion.is_instance(src, TokenList)\n tmp = []\n tmp.append('# 頻度分析\\n')\n for wcls in WordClass.get_all():\n lst = [token for token in src.data if token.wordclass == wcls.conv_str()]\n if wcls.conv_str() == '名詞':\n lst = [token for token in lst if not (self._is_person_name(token) or self._is_pronoun(token) or self._is_not_independence(token) or self._is_suffix(token))]\n cnt = Counter([token.basic_type for token in lst])\n idx = 0\n w_tmp = []\n tmp.append(f'* {wcls.conv_str()}')\n for word, num in cnt.most_common():\n if idx >= 10:\n break\n w_tmp.append(f'{word}({num})')\n idx += 1\n tmp.append(f' - {\"/\".join(w_tmp)}')\n return tmp\n\n def _is_person_name(self, token: MecabData) -> bool:\n return assertion.is_instance(token, MecabData).class_detail1 == '固有名詞' and token.class_detail2 == '人名'\n\n def _is_pronoun(self, token: MecabData) -> bool:\n return assertion.is_instance(token, MecabData).class_detail1 == '代名詞'\n\n def _is_not_independence(self, token: MecabData) -> bool:\n return assertion.is_instance(token, MecabData).class_detail1 == '非自立'\n\n def _is_suffix(self, token: MecabData) -> bool:\n return assertion.is_instance(token, MecabData).class_detail1 == '接尾'\n" }, { "alpha_fraction": 0.5522779226303101, "alphanum_fraction": 0.5526056885719299, "avg_line_length": 26.486486434936523, "blob_id": "26f3e52699115e5832711c430045a74ab94973cc", "content_id": "28c1c1519230da33fbf0191eb5d9cfc723fe4af0", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3051, "license_type": "permissive", "max_line_length": 72, "num_lines": 111, "path": "/builder/core/formatter.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nFormatter Object\n================\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('Reducer',)\n\n\nfrom enum import Enum, auto\nfrom builder.core.executer import Executer\nfrom builder.datatypes.builderexception import BuilderError\nfrom builder.datatypes.formatmode import FormatMode\nfrom builder.datatypes.formattag import FormatTag\nfrom builder.datatypes.rawdata import RawData\nfrom builder.datatypes.resultdata import ResultData\nfrom builder.datatypes.textlist import TextList\nfrom builder.utils import assertion\nfrom builder.utils.logger import MyLogger\n\n\n# logger\nLOG = MyLogger.get_logger(__name__)\nLOG.set_file_handler()\n\n\nclass FormatModeError(BuilderError):\n ''' Exception class for Format\n '''\n pass\n\n\nclass Formatter(Executer):\n ''' Formatter Executer class.\n '''\n def __init__(self):\n super().__init__()\n LOG.info('FORMATTER: initialize')\n\n #\n # methods\n #\n\n def execute(self, src: RawData, mode: FormatMode) -> ResultData:\n LOG.info(f'FORMATTER: start exec on [{mode}] mode')\n LOG.debug(f'-- src: {src}')\n\n is_succeeded = True\n tmp = []\n error = None\n\n if mode is FormatMode.DEFAULT:\n tmp = assertion.is_instance(self._to_default(src), TextList)\n elif mode is FormatMode.PLAIN:\n tmp = src\n elif mode is FormatMode.WEB:\n tmp = assertion.is_instance(self._to_web(src), TextList)\n elif mode is FormatMode.SMARTPHONE:\n tmp = src\n else:\n msg = f'Invalid format-mode! {mode}'\n LOG.critical(msg)\n is_succeeded = False\n error = FormatModeError(msg)\n return ResultData(\n tmp,\n is_succeeded,\n error)\n\n #\n # private methods\n #\n\n def _to_default(self, src: RawData) -> TextList:\n LOG.info('FORMAT: to_default')\n tmp = []\n for line in assertion.is_instance(src, RawData).data:\n if isinstance(line, FormatTag):\n continue\n else:\n tmp.append(line)\n return TextList(*tmp)\n\n def _to_web(self, src: RawData) -> TextList:\n LOG.info('FORMAT: to_web')\n\n tmp = []\n in_dialogue = False\n\n for line in assertion.is_instance(src, RawData).data:\n if isinstance(line, FormatTag):\n if line is FormatTag.DESCRIPTION_HEAD:\n if in_dialogue:\n tmp.append('\\n')\n in_dialogue = False\n elif line is FormatTag.DIALOGUE_HEAD:\n if not in_dialogue:\n tmp.append('\\n')\n in_dialogue = True\n elif line is FormatTag.SYMBOL_HEAD:\n pass\n elif line is FormatTag.TAG_HEAD:\n pass\n else:\n pass\n else:\n assertion.is_str(line)\n tmp.append(line)\n return TextList(*tmp)\n" }, { "alpha_fraction": 0.5742514729499817, "alphanum_fraction": 0.5766466856002808, "avg_line_length": 38.761905670166016, "blob_id": "b01e036e11ae277f6172fc1c07b98ce520b09087", "content_id": "7a55f63a5126e472df051fb03c90afa9b41e44ad", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3340, "license_type": "permissive", "max_line_length": 110, "num_lines": 84, "path": "/tests/containers/test_container.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nContainer class test\n====================\n'''\n\nimport unittest\nfrom tests.testutils import print_testtitle, validate_with_fail\nfrom builder.containers import container as cnt\nfrom builder.containers.chapter import Chapter\nfrom builder.containers.episode import Episode\nfrom builder.containers.material import Material, MaterialType\nfrom builder.containers.scene import Scene\nfrom builder.containers.story import Story\n\n\nclass ContainerTest(unittest.TestCase):\n\n @classmethod\n def setUpClass(cls):\n print_testtitle(cnt.__name__, 'Container class')\n\n def test_instance(self):\n data = [\n # (title, args, outline, exp_title, exp_args, exp_outline)\n (True, 'test', ('apple','orange'), 'a note',\n 'test', ('apple','orange'), 'a note'),\n ]\n def checker(title, args, outline, exp_title, exp_args, exp_outline):\n tmp = cnt.Container(title, *args, outline=outline)\n self.assertIsInstance(tmp, cnt.Container)\n self.assertEqual(tmp.title, exp_title)\n self.assertEqual(tmp.children, exp_args)\n self.assertEqual(tmp.outline, exp_outline)\n validate_with_fail(self, 'class instance', checker, data)\n\n def test_inherited(self):\n data = [\n # (title, args, outline, new_title, new_args, new_outline,\n # exp_title, exp_args, exp_outline)\n (True, 'test', ('a','b',), 'apple',\n 'test2', ('b','c',), 'orange',\n 'test2', ('b','c'), 'orange'),\n ]\n def checker(title, args, outline, new_title, new_args, new_outline, exp_title, exp_args, exp_outline):\n tmp = cnt.Container(title, *args, outline=outline)\n self.assertEqual(tmp.title, title)\n self.assertEqual(tmp.children, args)\n self.assertEqual(tmp.outline, outline)\n tmp2 = tmp.inherited(*new_args, title=new_title, outline=new_outline)\n self.assertIsInstance(tmp2, cnt.Container)\n self.assertEqual(tmp2.title, exp_title)\n self.assertEqual(tmp2.children, exp_args)\n self.assertEqual(tmp2.outline, exp_outline)\n validate_with_fail(self, 'inherited', checker, data)\n\n #\n # children classes\n #\n\n def test_children_classes(self):\n data = [\n # (type)\n (True, Story),\n (True, Chapter),\n (True, Episode),\n (True, Scene),\n (False, Material),\n ]\n def checker(ctype):\n tmp = ctype('test', 'a', 'b', 'c', outline='a note')\n self.assertIsInstance(tmp, ctype)\n self.assertEqual(tmp.title, 'test')\n self.assertEqual(tmp.children, ('a', 'b', 'c'))\n self.assertEqual(tmp.outline, 'a note')\n validate_with_fail(self, 'children_classes', checker, data)\n\n def test_material_class(self):\n tmp = Material(MaterialType.DOCUMENT, 'test', 'a', 'b', 'c', outline='a note')\n self.assertIsInstance(tmp, Material)\n self.assertEqual(tmp.mate_type, MaterialType.DOCUMENT)\n self.assertEqual(tmp.title, 'test')\n self.assertEqual(tmp.children, ('a', 'b', 'c'))\n self.assertEqual(tmp.outline, 'a note')\n" }, { "alpha_fraction": 0.5745341777801514, "alphanum_fraction": 0.5848861336708069, "avg_line_length": 30.129032135009766, "blob_id": "f32dc0bf2193c95d85801ddc0ca99e3a0991e3fe", "content_id": "1b32001d7b6594eabc6b56e2ad8db8d78cbdecca", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 966, "license_type": "permissive", "max_line_length": 74, "num_lines": 31, "path": "/tests/objects/test_time.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nTime class test\n===============\n'''\n\nimport datetime\nimport unittest\nfrom tests.testutils import print_testtitle, validate_with_fail\nfrom builder.objects import time as tm\n\n\nclass TimeTest(unittest.TestCase):\n\n @classmethod\n def setUpClass(cls):\n print_testtitle(tm.__name__, 'Time class')\n\n def test_instance(self):\n data = [\n # (name, hour, minute, expect, exp_h, exp_m, exp_time)\n (True, 'test', 5, 20, 'test', 5, 20, datetime.time(5,20)),\n ]\n def checker(name, hour, minute, expect, exp_h, exp_m, exp_time):\n tmp = tm.Time(name, hour, minute)\n self.assertIsInstance(tmp, tm.Time)\n self.assertEqual(tmp.name, expect)\n self.assertEqual(tmp.hour, exp_h)\n self.assertEqual(tmp.minute, exp_m)\n self.assertEqual(tmp.time, exp_time)\n validate_with_fail(self, 'class instance', checker, data)\n\n" }, { "alpha_fraction": 0.5327244997024536, "alphanum_fraction": 0.534246563911438, "avg_line_length": 16.263158798217773, "blob_id": "ff176b4223385fb75571769da18a99ccc8fed3c2", "content_id": "19eb3731c8394c2e8aae0adc16570b9a1c7a1dec", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 657, "license_type": "permissive", "max_line_length": 51, "num_lines": 38, "path": "/builder/objects/word.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nWord Object\n===========\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('Word',)\n\n\nfrom builder.objects.sobject import SObject\nfrom builder.utils import assertion\n\n\nclass Word(SObject):\n ''' Word Object class.\n '''\n\n def __init__(self,\n name: str,\n category: str='',\n info: str=''):\n super().__init__(name)\n self._category = assertion.is_str(category)\n self._info = assertion.is_str(info)\n\n #\n # property\n #\n\n @property\n def category(self) -> str:\n return self._category\n\n @property\n def info(self) -> str:\n return self._info\n\n" }, { "alpha_fraction": 0.5752688050270081, "alphanum_fraction": 0.5779569745063782, "avg_line_length": 18.526315689086914, "blob_id": "bf4b66ad0b426f89cd69792733852205f4a3c91e", "content_id": "9e2cdd47c9fbf23eb6a5c79c297dd548a27f0022", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 372, "license_type": "permissive", "max_line_length": 61, "num_lines": 19, "path": "/builder/utils/util_list.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nUtility methods for list\n========================\n'''\n\n__all__ = (\n 'except_none_list',\n )\n\nfrom itertools import chain\nfrom typing import Any\nfrom builder.utils import assertion\n\n\ndef list_without_none(src: (list, tuple)) -> list:\n ''' List without None.\n '''\n return [val for val in assertion.is_listlike(src) if val]\n\n" }, { "alpha_fraction": 0.6423529386520386, "alphanum_fraction": 0.6447058916091919, "avg_line_length": 20.200000762939453, "blob_id": "48a21b0b8de955ee5aa05f74781ae523e9917083", "content_id": "fe46177c08cde3d3273bd8d3c6f948bb3deeb7a8", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 425, "license_type": "permissive", "max_line_length": 63, "num_lines": 20, "path": "/tests/core/test_runner.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nRunner class test\n=================\n'''\n\nimport unittest\nfrom tests.testutils import print_testtitle, validate_with_fail\nfrom builder.core import runner as rn\n\n\nclass RunnerTest(unittest.TestCase):\n\n @classmethod\n def setUpClass(cls):\n print_testtitle(rn.__name__, 'Runner class')\n\n def test_instance(self):\n tmp = rn.Runner()\n self.assertIsInstance(tmp, rn.Runner)\n\n" }, { "alpha_fraction": 0.5936218500137329, "alphanum_fraction": 0.594077467918396, "avg_line_length": 23.38888931274414, "blob_id": "e4893440be284aa596bb54bcce05374bf9ab78e2", "content_id": "37311593ee65b797f31c3b2acd3f4d08e84b6e34", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2231, "license_type": "permissive", "max_line_length": 70, "num_lines": 90, "path": "/builder/core/validater.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nValidater Object\n================\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('Validater',)\n\n\nfrom typing import Tuple\nfrom builder.commands.scode import SCode, SCmd\nfrom builder.core.executer import Executer\nfrom builder.datatypes.builderexception import BuilderError\nfrom builder.datatypes.codelist import CodeList\nfrom builder.datatypes.formattag import FormatTag\nfrom builder.datatypes.resultdata import ResultData\nfrom builder.tools.checker import Checker\nfrom builder.utils import assertion\nfrom builder.utils.logger import MyLogger\n\n\n# logger\nLOG = MyLogger.get_logger(__name__)\nLOG.set_file_handler()\n\n\nclass ValidaterError(BuilderError):\n ''' General Validate Error.\n '''\n pass\n\n\nclass InvalidSymbolError(ValidaterError):\n ''' Has invalid symbol.\n '''\n pass\n\n\nclass Validater(Executer):\n ''' Description Validater Executer class.\n '''\n def __init__(self):\n super().__init__()\n LOG.info('VALIDATER: initialize')\n\n #\n # methods\n #\n\n def execute(self, src: CodeList) -> ResultData:\n LOG.info('VALIDATER: start exec')\n\n is_succeeded = True\n error = None\n ret, is_succeeded = self._has_invalid_symbol(src)\n\n if not is_succeeded:\n msg = f'Invalid symbol: {ret}'\n LOG.error(msg)\n error = InvalidSymbolError(msg)\n return ResultData(\n ret,\n is_succeeded,\n error)\n\n #\n # private methods\n #\n\n def _has_invalid_symbol(self, src: CodeList) -> Tuple[list, bool]:\n tmp = []\n invalids = []\n checker = Checker()\n\n for child in assertion.is_instance(src, CodeList).data:\n assertion.is_instance(child, SCode)\n if child.cmd in SCmd.get_all_actions():\n for line in child.script:\n if checker.has_tag_symbol(line):\n invalids.append(line)\n tmp.append(child)\n else:\n # NOTE: それ以外をどうするか。ここはスルーか\n tmp.append(child)\n if invalids:\n return (invalids, False)\n else:\n return (CodeList(*tmp), True)\n" }, { "alpha_fraction": 0.5530602335929871, "alphanum_fraction": 0.5533069968223572, "avg_line_length": 24.9743595123291, "blob_id": "0ccc45f42e3d16ee2617c6eb51326ff20968ef63", "content_id": "16925a2be1f8c78ba2383bff8a4493ecc5e7674d", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 4052, "license_type": "permissive", "max_line_length": 87, "num_lines": 156, "path": "/builder/commands/command.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nStory Command list\n==================\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('SCmd',)\n\n\nfrom enum import Enum, auto\nfrom builder.utils import assertion\n\n\nclass SCmd(Enum):\n ''' Story command enumerate.\n '''\n\n #\n # subjects\n #\n\n BE = auto()\n COME = auto()\n DO = auto()\n EXPLAIN = auto()\n GO = auto()\n HEAR = auto()\n LOOK = auto()\n TALK = auto()\n THINK = auto()\n VOICE = auto()\n WEAR = auto()\n\n #\n # scene control\n #\n\n CHANGE_CAMEARA = auto()\n CHANGE_STAGE = auto()\n CHANGE_DATE = auto()\n CHANGE_TIME = auto()\n ELAPSE_DAY = auto()\n ELAPSE_TIME = auto()\n PUT_OBJECT = auto()\n\n #\n # tags\n #\n\n TAG_BR = auto()\n TAG_COMMENT = auto()\n TAG_HR = auto()\n TAG_SYMBOL = auto()\n TAG_TITLE = auto()\n\n #\n # plot info\n #\n\n PLOT_NOTE = auto()\n PLOT_MOTIF = auto()\n PLOT_FORESHADOW = auto()\n PLOT_PAYOFF = auto()\n PLOT_SETUP = auto()\n PLOT_DEVELOP = auto()\n PLOT_RESOLVE = auto()\n PLOT_TURNPOINT = auto()\n\n #\n # meta\n #\n\n INFO_DATA = auto()\n INFO_CONTENT = auto()\n INFO_STORY = auto()\n END_CHAPTER = auto()\n END_EPISODE = auto()\n END_SCENE = auto()\n END_MATERIAL = auto()\n HEAD_CHAPTER = auto()\n HEAD_EPISODE = auto()\n HEAD_SCENE = auto()\n HEAD_MATERIAL = auto()\n THEN = auto()\n\n @classmethod\n def get_all(cls) -> list:\n return [cls.BE, cls.COME, cls.DO, cls.EXPLAIN, cls.GO,\n cls.HEAR, cls.LOOK, cls.THINK, cls.WEAR,\n cls.TALK, cls.VOICE,\n cls.CHANGE_CAMEARA, cls.CHANGE_DATE, cls.CHANGE_STAGE,\n cls.CHANGE_TIME,\n cls.ELAPSE_DAY, cls.ELAPSE_TIME,\n cls.END_CHAPTER, cls.END_EPISODE, cls.END_SCENE, cls.END_MATERIAL,\n cls.HEAD_CHAPTER, cls.HEAD_EPISODE, cls.HEAD_SCENE, cls.HEAD_MATERIAL,\n cls.PLOT_NOTE, cls.PLOT_MOTIF,\n cls.PLOT_FORESHADOW, cls.PLOT_PAYOFF,\n cls.PLOT_SETUP, cls.PLOT_DEVELOP, cls.PLOT_RESOLVE, cls.PLOT_TURNPOINT,\n cls.INFO_DATA, cls.INFO_CONTENT, cls.INFO_STORY,\n cls.PUT_OBJECT,\n cls.TAG_BR, cls.TAG_COMMENT, cls.TAG_HR, cls.TAG_SYMBOL,\n cls.TAG_TITLE,\n cls.THEN,\n ]\n\n @classmethod\n def get_all_actions(cls) -> list:\n return [cls.BE, cls.DO, cls.EXPLAIN, cls.THINK,\n cls.TALK, cls.VOICE,\n cls.COME, cls.GO,\n cls.HEAR, cls.LOOK, cls.WEAR]\n\n @classmethod\n def get_normal_actions(cls) -> list:\n return [cls.BE, cls.DO, cls.EXPLAIN, cls.THINK,\n cls.COME, cls.GO,\n cls.HEAR, cls.LOOK, cls.WEAR]\n\n @classmethod\n def get_dialogue_actions(cls) -> list:\n return [cls.TALK, cls.VOICE]\n\n @classmethod\n def get_informations(cls) -> list:\n return [cls.INFO_DATA, cls.INFO_CONTENT, cls.INFO_STORY]\n\n @classmethod\n def get_end_of_containers(cls) -> list:\n return [cls.END_CHAPTER, cls.END_EPISODE, cls.END_SCENE,\n cls.END_MATERIAL]\n\n @classmethod\n def get_head_of_containers(cls) -> list:\n return [cls.HEAD_CHAPTER, cls.HEAD_EPISODE, cls.HEAD_SCENE, cls.HEAD_MATERIAL]\n\n @classmethod\n def get_plot_infos(cls) -> list:\n return [cls.PLOT_NOTE, cls.PLOT_MOTIF,\n cls.PLOT_FORESHADOW, cls.PLOT_PAYOFF,\n cls.PLOT_SETUP, cls.PLOT_DEVELOP, cls.PLOT_RESOLVE, cls.PLOT_TURNPOINT]\n\n @classmethod\n def get_plot_structs(cls) -> list:\n return [cls.PLOT_SETUP, cls.PLOT_DEVELOP, cls.PLOT_RESOLVE, cls.PLOT_TURNPOINT]\n\n @classmethod\n def get_tags(cls) -> list:\n return [cls.TAG_BR, cls.TAG_COMMENT, cls.TAG_HR, cls.TAG_SYMBOL, cls.TAG_TITLE]\n\n @classmethod\n def get_scene_controls(cls) -> list:\n return [cls.CHANGE_CAMEARA, cls.CHANGE_DATE, cls.CHANGE_STAGE, cls.CHANGE_TIME,\n cls.ELAPSE_DAY, cls.ELAPSE_TIME,\n cls.PUT_OBJECT]\n" }, { "alpha_fraction": 0.5532710552215576, "alphanum_fraction": 0.554205596446991, "avg_line_length": 19.960784912109375, "blob_id": "6416ac5cba10e4da1d8886731f5a6398e6fefaa8", "content_id": "41313c01f884df5d3c33f5ff87ab97ef0b8a3b49", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1070, "license_type": "permissive", "max_line_length": 64, "num_lines": 51, "path": "/builder/containers/container.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nStory Container Object\n======================\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('Container',)\n\n\nfrom builder.objects.sobject import SObject\nfrom builder.utils import assertion\n\n\nclass Container(SObject):\n ''' Container base class.\n '''\n\n def __init__(self, title: str, *args: Any, outline: str=''):\n super().__init__(title)\n self._children = assertion.is_tuple(args)\n self._outline = assertion.is_str(outline)\n\n #\n # property\n #\n\n @property\n def children(self) -> list:\n return self._children\n\n @property\n def title(self) -> str:\n return self.name\n\n @property\n def outline(self) -> str:\n return self._outline\n\n #\n # methods\n #\n\n def inherited(self, *args: Any,\n title: str=None, outline: str=None) -> Container:\n return self.__class__(\n title if title else self.title,\n *args,\n outline=outline if outline else self.outline,\n ).set_priority(self.priority)\n\n" }, { "alpha_fraction": 0.5914855003356934, "alphanum_fraction": 0.5932971239089966, "avg_line_length": 25.926828384399414, "blob_id": "e8a11394bdfce7771fa9f7bb0dd3c5ec02774ffa", "content_id": "e8cd034e5a44f69d6d5a77a8bdd96d2912409673", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1106, "license_type": "permissive", "max_line_length": 70, "num_lines": 41, "path": "/builder/utils/util_dict.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nUtility methods for dictionary\n==============================\n'''\n\n__all__ = (\n 'calling_dict_from',\n 'combine_dict',\n 'dict_sorted')\n\nfrom itertools import chain\nfrom typing import Tuple\nfrom builder.utils import assertion\n\n\ndef calling_dict_from(calling: (str, dict), name: str) -> dict:\n ''' Construct a calling dictionary for Person class.\n '''\n from builder.utils.util_str import dict_from_string\n tmp = {}\n if isinstance(calling, dict):\n tmp = calling\n else:\n tmp = dict_from_string(assertion.is_str(calling), ':')\n me = tmp['me'] if 'me' in tmp else '私'\n return combine_dict(tmp, {'S': name, 'M': me})\n\n\ndef combine_dict(a: dict, b: dict) -> dict:\n ''' Combine one dictionary from two dictionaries.\n '''\n return {**assertion.is_dict(a), **assertion.is_dict(b)}\n\n\ndef dict_sorted(origin: dict, is_reverse: bool=False) -> dict:\n ''' Sort dictionary.\n '''\n return dict(\n sorted(assertion.is_dict(origin).items(),\n key=lambda x:x[0], reverse=assertion.is_bool(is_reverse)))\n" }, { "alpha_fraction": 0.5851725935935974, "alphanum_fraction": 0.5857385396957397, "avg_line_length": 21.64102554321289, "blob_id": "f76900bb3aa1863695eaf566a7dcdcecc79e85b8", "content_id": "c2b532d1bf1ca71450d0ae555fc6660759c8546e", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1769, "license_type": "permissive", "max_line_length": 111, "num_lines": 78, "path": "/builder/objects/person.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nPerson Object\n=============\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('Person',)\n\n\nfrom builder.objects.sobject import SObject\nfrom builder.utils import assertion\nfrom builder.utils.util_dict import calling_dict_from\nfrom builder.utils.util_name import name_set_from\n\n\nclass Person(SObject):\n ''' Person Object class.\n '''\n\n def __init__(self, name: str, fullname: str,\n age: int, birth: tuple, sex: str, job: str,\n calling: (str, dict)='me:私', info: str=''):\n super().__init__(name)\n self._basename = assertion.is_str(fullname)\n self._age = assertion.is_int(age)\n self._birth = assertion.is_tuple(birth)\n self._sex = assertion.is_str(sex)\n self._job = assertion.is_str(job)\n self._calling = calling_dict_from(calling, name)\n self._info = assertion.is_str(info)\n # names\n self._firstname, self._lastname, self._fullname, self._exfullname = name_set_from(self._basename, name)\n\n #\n # property\n #\n\n @property\n def age(self) -> int:\n return self._age\n\n @property\n def birth(self) -> tuple:\n return self._birth\n\n @property\n def sex(self) -> str:\n return self._sex\n\n @property\n def job(self) -> str:\n return self._job\n\n @property\n def calling(self) -> dict:\n return self._calling\n\n @property\n def info(self) -> str:\n return self._info\n\n @property\n def firstname(self) -> str:\n return self._firstname\n\n @property\n def lastname(self) -> str:\n return self._lastname\n\n @property\n def fullname(self) -> str:\n return self._fullname\n\n @property\n def exfullname(self) -> str:\n return self._exfullname\n\n" }, { "alpha_fraction": 0.5616653561592102, "alphanum_fraction": 0.5624508857727051, "avg_line_length": 30.024391174316406, "blob_id": "2ef974fad63f453eb6c36c4c49f09372d2512288", "content_id": "6eae805c2dc96622cb779f24096e1c7e23d856ac", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1273, "license_type": "permissive", "max_line_length": 65, "num_lines": 41, "path": "/tests/objects/test_sobject.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nSObject class test\n==================\n'''\n\nimport unittest\nfrom tests.testutils import print_testtitle, validate_with_fail\nfrom builder import __PRIORITY_DEFAULT__, __PRIORITY_MIN__\nfrom builder.objects import sobject as sobj\n\n\nclass SObjectTest(unittest.TestCase):\n\n @classmethod\n def setUpClass(cls):\n print_testtitle(sobj.__name__, 'SObject class')\n\n def test_instance(self):\n data = [\n # (name, expect, exp_pri)\n (True, 'test', 'test', __PRIORITY_DEFAULT__),\n ]\n def checker(name, expect, exp_pri):\n tmp = sobj.SObject(name)\n self.assertIsInstance(tmp, sobj.SObject)\n self.assertEqual(tmp.name, expect)\n self.assertEqual(tmp.priority, exp_pri)\n validate_with_fail(self, 'class instance', checker, data)\n\n def test_omit(self):\n data = [\n # (name, expect)\n (True, 'test', __PRIORITY_MIN__),\n ]\n def checker(name, expect):\n tmp = sobj.SObject(name)\n self.assertEqual(tmp.priority, __PRIORITY_DEFAULT__)\n tmp.omit()\n self.assertEqual(tmp.priority, expect)\n validate_with_fail(self, 'omit', checker, data)\n\n" }, { "alpha_fraction": 0.5649510025978088, "alphanum_fraction": 0.5661764740943909, "avg_line_length": 21.054054260253906, "blob_id": "eeff4fb4316cd39f0aa21354b7a0c55fa407e2ba", "content_id": "54c0f19f1f507d90d37e2ca93e68885035da4a2e", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 816, "license_type": "permissive", "max_line_length": 64, "num_lines": 37, "path": "/builder/datatypes/formatmode.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nFormat Mode Enum\n================\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('FormatMode',)\n\n\nfrom enum import Enum, auto\nfrom builder.utils import assertion\n\n\nclass FormatMode(Enum):\n ''' Format mode.\n '''\n DEFAULT = auto()\n PLAIN = auto()\n WEB = auto()\n SMARTPHONE = auto()\n\n @classmethod\n def get_all(cls) -> list:\n return [cls.DEFAULT, cls.PLAIN, cls.WEB, cls.SMARTPHONE]\n\n @classmethod\n def conv_to_mode(cls, mode: str) -> FormatMode:\n if assertion.is_str(mode) in ('w', 'web'):\n return FormatMode.WEB\n elif mode in ('s', 'smartphone', 'phone'):\n return FormatMode.SMARTPHONE\n elif mode in ('p', 'plain'):\n return FormatMode.PLAIN\n else:\n return FormatMode.DEFAULT\n" }, { "alpha_fraction": 0.4985661506652832, "alphanum_fraction": 0.5116755366325378, "avg_line_length": 25.521739959716797, "blob_id": "31990e92b83d6a45f513540d1f1fb11386dfe4b5", "content_id": "28d01cb5d13f2bfd2c5926dab66b3c12f7431ce3", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2549, "license_type": "permissive", "max_line_length": 79, "num_lines": 92, "path": "/builder/utils/util_str.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nUtility methods for strings\n===========================\n'''\n\n__all__ = (\n 'dict_from_string',\n 'string_replaced_by_tag',\n 'validate_dialogue_brackets',\n 'validate_string_duplicate_chopped',\n )\n\nfrom itertools import chain\nfrom typing import Tuple\nimport re\nfrom builder.utils import assertion\n\n\n## define re\nREG_ALPHA = re.compile(r'^[a-zA-Z]+$')\nREG_KANJI = re.compile(r'[一-龥]')\nREG_HIRAGANA = re.compile(r'[あ-ん]')\nREG_KATAKANA = re.compile(r'[\\u30A1-\\u30FF]')\n\n\ndef dict_from_string(src: str, splitter: str) -> dict:\n ''' Convert a dictionary from a string.\n '''\n if assertion.is_str(splitter) in assertion.is_str(src):\n tmp = src.split(splitter)\n return dict([(k,v) for k,v in zip(tmp[0::2], tmp[1::2])])\n else:\n raise ValueError(f'Invalid string, cannot convert a dictionary: {src}')\n\n\ndef hiragana_list_from(src: str) -> list:\n ''' Get a hiragana list.\n '''\n return REG_HIRAGANA.findall(assertion.is_str(src))\n\n\ndef kanji_list_from(src: str) -> list:\n ''' Get a kanji list.\n '''\n return REG_KANJI.findall(assertion.is_str(src))\n\n\ndef katakana_list_from(src: str) -> list:\n ''' Get a katakana list.\n '''\n return REG_KATAKANA.findall(assertion.is_str(src))\n\n\ndef string_replaced_by_tag(src: str, tags: dict, prefix: str='$') -> str:\n ''' Replace the target word in a string by tags.\n '''\n tmp = assertion.is_str(src)\n for k, v in assertion.is_dict(tags).items():\n if assertion.is_str(prefix) in tmp:\n tmp = re.sub(r'\\{}{}'.format(prefix, k), v, tmp)\n else:\n return tmp\n return tmp\n\n\ndef validate_dialogue_brackets(src: str) -> str:\n ''' Chop invalid brackets.\n '''\n return re.sub(r'』『', '。',\n re.sub(r'」「', '。',\n assertion.is_str(src)))\n\n\ndef validate_string_duplicate_chopped(src: str) -> str:\n ''' Chop a duplicated string end.\n\n NOTE:\n 。。。 -> 。\n 、、、 -> 、\n 、。  -> 、\n ?、  -> ?\\u3000\n !。  -> !\\u3000\n '''\n return re.sub(r'(。)+', r'\\1',\n re.sub(r'(、)+', r'\\1',\n re.sub(r'。、', r'。',\n re.sub(r'、。', r'、',\n re.sub(r'([!?!?])\\u3000[、。]', r'\\1',\n re.sub(r'([!?!?])([^ \\u3000!?!?」』])', r'\\1 \\2',\n re.sub(r'([!?!?])[、。]', r'\\1 ',\n assertion.is_str(src))))))))\n\n" }, { "alpha_fraction": 0.25868263840675354, "alphanum_fraction": 0.27113771438598633, "avg_line_length": 29.253623962402344, "blob_id": "b3ff404c5d77b03f4c2e55fcf93aa694037e749f", "content_id": "55427c9c2d7bf2415ad551bbb454e982bdbb0ea7", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 6949, "license_type": "permissive", "max_line_length": 47, "num_lines": 138, "path": "/assets/common_rubi.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nAsset: basic data\n=================\n'''\n\nASSET = {\n \"RUBIS\":(\n # (origin / rubi / exclusions / always)\n # - 名詞\n (\"顎\", \"|顎《あご》\"),\n (\"安堵\", \"|安堵《あんど》\"),\n (\"悪戯\", \"|悪戯《いたずら》\"),\n (\"鬱屈\", \"|鬱屈《うっくつ》\"),\n (\"鬱憤\", \"|鬱憤《うっぷん》\"),\n (\"瑕疵\", \"|瑕疵《かし》\"),\n (\"葛藤\", \"|葛藤《かっとう》\"),\n (\"瓦礫\", \"|瓦礫《がれき》\"),\n (\"機微\", \"|機微《きび》\"),\n (\"愚痴\", \"|愚痴《ぐち》\"),\n (\"語彙\", \"|語彙《ごい》\"),\n (\"鼓膜\", \"|鼓膜《こまく》\"),\n (\"残滓\", \"|残滓《ざんし》\"),\n (\"饒舌\", \"|饒舌《じょうぜつ》\"),\n (\"辛辣\", \"|辛辣《しんらつ》\"),\n (\"皺\", \"|皺《しわ》\"),\n (\"脛\", \"|脛《すね》\"),\n (\"躊躇\", \"|躊躇《ちゅうちょ》\"),\n (\"嘲笑\", \"|嘲笑《ちょうしょう》\"),\n (\"蔦\", \"|蔦《つた》\"),\n (\"臀部\", \"|臀部《でんぶ》\"),\n (\"喉\", \"|喉《のど》\"),\n (\"剥離\", \"|剥離《はくり》\"),\n (\"薔薇\", \"|薔薇《ばら》\"),\n (\"反芻\", \"|反芻《はんすう》\"),\n (\"髭\", \"|髭《ひげ》\"),\n (\"抽斗\", \"|抽斗《ひきだし》\"),\n (\"蓋\", \"|蓋《ふた》\"),\n (\"辟易\", \"|辟易《へきえき》\"),\n (\"頬([がはをにとでのだ])\", \"|頬《ほお》\\\\1\"),\n (\"埃([がはをにとでのだ])\", \"|埃《ほこり》\\\\1\"),\n (\"瞼([がはをにとでのだ])\", \"|瞼《まぶた》\\\\1\"),\n (\"眉間\", \"|眉間《みけん》\"),\n (\"靄\", \"|靄《もや》\"),\n (\"揶揄\", \"|揶揄《やゆ》\"),\n (\"憂鬱\", \"|憂鬱《ゆううつ》\"),\n (\"抑揚\", \"|抑揚《よくよう》\"),\n (\"檸檬\", \"|檸檬《れもん》\"),\n (\"蝋燭\", \"|蝋燭《ろうそく》\"),\n # - 動詞\n (\"煽([らりるれろっ])\", \"|煽《あお》\\\\1\"),\n (\"足掻([かきくけこい])\", \"|足掻《あが》\\\\1\"),\n (\"諦め\", \"|諦《あきら》め\"),\n (\"嘲([らりるれろっ])\", \"|嘲《あざけ》\\\\1\"),\n (\"侮([らりるれろっ])\", \"|侮《あなど》\\\\1\"),\n (\"溢れ\", \"|溢《あふ》れ\"),\n (\"癒([やゆえ])\", \"|癒《い》\\\\1\"),\n (\"淹れ\", \"|淹《い》れ\"),\n (\"憤([らりるれろっ])\", \"|憤《いきどお》\\\\1\"),\n (\"弄([らりるれろっ])\", \"|弄《いじ》\\\\1\"),\n (\"蹲([らりるれろっ])\", \"|蹲《うずくま》\\\\1\"),\n (\"唸([らりるれろっ])\", \"|唸《うな》\\\\1\"),\n (\"頷([かきくけこい])\", \"|頷《うなず》\\\\1\"),\n (\"項垂れ\", \"|項垂《うなだ》れ\"),\n (\"潤([わいうえおっ])\", \"|潤《うるお》\\\\1\"),\n (\"憂([わいうえお])\", \"|憂《うれ》\\\\1\"),\n (\"覆([わいうえおっ])\", \"|覆《おお》\\\\1\"),\n (\"噛([まみむめもん])\", \"|噛《か》\\\\1\"),\n (\"傾げ\", \"|傾《かし》げ\"),\n (\"掠([まみむめもっ])\", \"|掠《かす》\\\\1\"),\n (\"霞([まみむめもん])\", \"|霞《かす》\\\\1\"),\n (\"奏で\", \"|奏《かな》で\"),\n (\"軋([まみむめもん])\", \"|軋《きし》\"),\n (\"零([さしすせそれ])\", \"|零《こぼ》\\\\1\"),\n (\"錆び\", \"|錆《さ》び\"),\n (\"遮([らりるれろっ])\", \"|遮《さえぎ》\\\\1\"),\n (\"彷徨([わいうえおっ])\", \"|彷徨《さまよ》\\\\1\"),\n (\"晒([さしすせそ])\", \"|晒《さら》\\\\1\"),\n (\"痺れ\", \"|痺《しび》れ\"),\n (\"喋([らりるれろっ])\", \"|喋《しゃべ》\\\\1\"),\n (\"逸([らりるれろっ])\", \"|逸《そ》\\\\1\"),\n (\"揃([わいうえおっ])\", \"|揃《そろ》\\\\1\"),\n (\"嗜め\", \"|嗜《たしな》め\"),\n (\"戯れ\", \"|戯《たわむ》れ\"),\n (\"掴([まみむめもん])\", \"|掴《つか》\\\\1\"),\n (\"呟([かきくけこい])\", \"|呟《つぶや》\\\\1\"),\n (\"摘([まみむめもん])\", \"|摘《つま》\\\\1\"),\n (\"躓([かきくけこい])\", \"|躓《つまず》\\\\1\"),\n (\"捉え\", \"|捉《とら》え\"),\n (\"撫で\", \"|撫《な》で\"),\n (\"嘆([かきくけこい])\", \"|嘆《なげ》\\\\1\"),\n (\"睨([まみむめもん])\", \"|睨《にら》\\\\1\"),\n (\"捻([らりるれろっ])\", \"|捻《ねじ》\\\\1\"),\n (\"拭([わいうえおっ])\", \"|拭《ぬぐ》\\\\1\"),\n (\"覗([かきくけこい])\", \"|覗《のぞ》\\\\1\"),\n (\"顰め\", \"|顰《ひそ》め\"),\n (\"閃([まみむめもい])\", \"|閃《ひらめ》\\\\1\"),\n (\"膨ら\", \"|膨《ふくら》ら\"),\n (\"褒め\", \"|褒《ほ》め\"),\n (\"紛れ\", \"|紛《まぎ》れ\"),\n (\"跨([がぎぐげごい])\", \"|跨《また》\\\\1\"),\n (\"跨([らりるれろっ])\", \"|跨《またが》\\\\1\"),\n (\"纏([わいうえおっ])\", \"|纏《まと》\\\\1\"),\n (\"毟([らりるれろっ])\", \"|毟《むし》\\\\1\"),\n (\"漏([らりるれろっ])\", \"|漏《も》\\\\1\"),\n (\"洩([らりるれろっ])\", \"|洩《も》\\\\1\"),\n (\"弄([ばびぶべぼん])\", \"|弄《もてあそ》\\\\1\"),\n (\"貰([わいうえおっ])\", \"|貰《もら》\\\\1\"),\n (\"歪([まみむめもん])\", \"|歪《ゆが》\\\\1\"),\n (\"過([らりるれろっ])\", \"|過《よぎ》\\\\1\"),\n (\"蘇([らりるれろっ])\", \"|蘇《よみがえ》\\\\1\"),\n (\"甦([らりるれろっ])\", \"|甦《よみがえ》\\\\1\"),\n (\"喚([かきくけこい])\", \"|喚《わめ》\\\\1\"),\n # - 形容詞\n (\"厳つ\", \"|厳《いか》つ\"),\n (\"逞し\", \"|逞《たくま》し\"),\n (\"拙([かきくけこい])\", \"|拙《つたな》\\\\1\"),\n (\"眩し\", \"|眩《まぶ》し\"),\n # - 形容動詞\n (\"厭\", \"|厭《いや》\"),\n (\"微か\", \"|微《かす》か\"),\n (\"杞憂\", \"|杞憂《きゆう》\"),\n (\"気怠([いくさ])\", \"|気怠《けだる》\\\\1\"),\n (\"耳障り\", \"|耳障《みみざわ》り\"),\n (\"僅か\", \"|僅《わず》か\"),\n # - 副詞\n (\"徐に\", \"|徐《おもむろ》に\"),\n (\"急遽\", \"|急遽《きゅうきょ》\"),\n (\"暫く\", \"|暫《しばら》く\"),\n (\"所詮\", \"|所詮《しょせん》\"),\n (\"随分\", \"|随分《ずいぶん》\"),\n (\"所為\", \"|所為《せい》\"),\n (\"咄嗟\", \"|咄嗟《とっさ》\"),\n (\"殆ど\", \"|殆《ほとん》ど\"),\n (\"微塵\", \"|微塵《みじん》\"),\n (\"寧ろ\", \"|寧《むし》ろ\"),\n ),\n }\n" }, { "alpha_fraction": 0.5609357953071594, "alphanum_fraction": 0.5658324360847473, "avg_line_length": 41.72093200683594, "blob_id": "2c2ce0a2793b2048701f935422b5dc09b7414f55", "content_id": "40f80b85761769f91c935f7a878c896c3f36a442", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1844, "license_type": "permissive", "max_line_length": 97, "num_lines": 43, "path": "/tests/objects/test_person.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nPerson class test\n===============\n'''\n\nimport unittest\nfrom tests.testutils import print_testtitle, validate_with_fail\nfrom builder.objects import person as psn\n\n\nclass PersonTest(unittest.TestCase):\n\n @classmethod\n def setUpClass(cls):\n print_testtitle(psn.__name__, 'Person class')\n\n def test_instance(self):\n data = [\n # (name, fullname, age, birth, sex, job, calling, info,\n # exp_name, exp_age, exp_birth, exp_sex, exp_job, exp_calling, exp_info,\n # exp_firstname, exp_lastname, exp_fullname, exp_exfullname)\n (True, 'Taro', '', 17, (5,5), 'male', 'student', 'me:俺', 'a man',\n 'Taro', 17, (5,5), 'male', 'student', {'me':'俺','S':'Taro','M':'俺'}, 'a man',\n 'Taro', 'Taro', 'Taro', 'Taro'),\n ]\n def checker(name, fullname, age, birth, sex, job, calling, info, exp_name,\n exp_age, exp_birth, exp_sex, exp_job, exp_calling, exp_info, exp_fn,\n exp_ln, exp_full, exp_exfull):\n tmp = psn.Person(name, fullname, age, birth, sex, job, calling, info)\n self.assertIsInstance(tmp, psn.Person)\n self.assertEqual(tmp.name, exp_name)\n self.assertEqual(tmp.age, exp_age)\n self.assertEqual(tmp.birth, exp_birth)\n self.assertEqual(tmp.sex, exp_sex)\n self.assertEqual(tmp.job, exp_job)\n self.assertEqual(tmp.calling, exp_calling)\n self.assertEqual(tmp.info, exp_info)\n self.assertEqual(tmp.firstname, exp_fn)\n self.assertEqual(tmp.lastname, exp_ln)\n self.assertEqual(tmp.fullname, exp_full)\n self.assertEqual(tmp.exfullname, exp_exfull)\n validate_with_fail(self, 'class instance', checker, data)\n\n" }, { "alpha_fraction": 0.5701302886009216, "alphanum_fraction": 0.5743713974952698, "avg_line_length": 29.009090423583984, "blob_id": "80a6411cec2853501a7065ef8a88621b95cd604f", "content_id": "fe112b16ab5d188f19e650b715aff1c4f2eadd9b", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3317, "license_type": "permissive", "max_line_length": 92, "num_lines": 110, "path": "/analyzer/core/tokenizer.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nTokenizer Object\n================\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('Tokenizer',)\n\n\nimport os\nimport re\nimport MeCab\nfrom analyzer.datatypes.analyzerexception import AnalyzerError\nfrom analyzer.datatypes.mecabdata import MecabData\nfrom analyzer.datatypes.tokenlist import TokenList\nfrom analyzer.datatypes.wordclass import WordClass\nfrom builder.core.executer import Executer\nfrom builder.datatypes.resultdata import ResultData\nfrom builder.datatypes.textlist import TextList\nfrom builder.utils import assertion\nfrom builder.utils.logger import MyLogger\n\n\n# logger\nLOG = MyLogger.get_logger(__name__)\nLOG.set_file_handler()\n\n\nclass TokenizerError(AnalyzerError):\n ''' General error in Tokenizer.\n '''\n pass\n\n\nclass Tokenizer(Executer):\n ''' Tokenizer class.\n '''\n __MECAB_DIRS__ = (\n \"/usr/local/lib/mecab/dic/mecab-ipadic-neologd\",\n \"/usr/lib/x86_64-linux-gnu/mecab/dic/mecab-ipadic-neologd\",\n )\n\n def __init__(self):\n super().__init__()\n LOG.info('TOKENIZER: initialize')\n self._tagger = None\n\n #\n # methods\n #\n\n def execute(self, src: (TextList, list, tuple), person_names: list,\n mecab_dir: str=None) -> ResultData:\n LOG.info('TOKENIZER: start exec')\n is_succeeded = True\n error = None\n if not self._tagger:\n mdir = self._get_mecab_dir(mecab_dir)\n mdir = f'-d {mdir}' if mdir else ''\n self._tagger = MeCab.Tagger(mdir)\n self._tagger.parse('') # 初期化処理\n tmp = assertion.is_instance(self._exec_internal(src, person_names), TokenList)\n return ResultData(\n tmp,\n is_succeeded,\n error)\n\n #\n # private methods\n #\n\n def _exec_internal(self, src: (TextList, list, tuple), person_names: list) -> TokenList:\n LOG.debug(f'-- src: {src}')\n tmp = []\n def _excepted(target: str):\n return target in ('EOS', '', 't', 'ー')\n def _is_exists_name(target: str):\n for name in person_names:\n if name == target:\n return True\n return False\n _src = src.data if isinstance(src, TextList) else src\n parsed = self._tagger.parse('\\n'.join(assertion.is_listlike(_src))).split('\\n')\n tokens = self._packed_from_parsed(parsed)\n for token in tokens:\n if _excepted(token[0]):\n continue\n elif len(token) == 1:\n continue\n if token[1] == WordClass.NOUN.conv_str():\n if _is_exists_name(token[0]):\n token[3] = '人名'\n tmp.append(MecabData.conv(*token))\n return TokenList(*tmp)\n\n def _get_mecab_dir(self, dirname: str) -> str:\n if dirname and os.path.exists(dirname):\n return dirname\n elif os.path.exists(self.__MECAB_DIRS__[0]):\n return self.__MECAB_DIRS__[0]\n elif os.path.exists(self.__MECAB_DIRS__[1]):\n return self.__MECAB_DIRS__[1]\n else:\n LOG.error('Not set MeCab dictionary path')\n return ''\n\n def _packed_from_parsed(self, src: list) -> tuple:\n return (re.split('[\\t,]', v) for v in assertion.is_listlike(src))\n" }, { "alpha_fraction": 0.5683836340904236, "alphanum_fraction": 0.5692717432975769, "avg_line_length": 22.957447052001953, "blob_id": "7ac9a82bc58add7e4ff25a723f9521ab9242607e", "content_id": "78430885e638cfc80d20dd6513a59d8c89f8639e", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1126, "license_type": "permissive", "max_line_length": 72, "num_lines": 47, "path": "/builder/containers/material.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nMaterial Container Object\n========================\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('Material',)\n\n\nfrom typing import Any\nfrom builder.containers.container import Container\nfrom builder.datatypes.materialtype import MaterialType\nfrom builder.utils import assertion\n\n\nclass Material(Container):\n ''' Material Container class.\n '''\n\n def __init__(self,\n mate_type: MaterialType,\n title: str,\n *args: Any,\n outline: str=''):\n super().__init__(title, *args, outline=outline)\n self._mate_type = assertion.is_instance(mate_type, MaterialType)\n #\n # property\n #\n\n @property\n def mate_type(self) -> MaterialType:\n return self._mate_type\n\n #\n # methods\n #\n def inherited(self, *args: Any,\n title: str=None,\n outline: str=None) -> Material:\n return self.__class__(self.mate_type,\n title if title else self.title,\n *args,\n outline=outline if outline else self.outline,\n ).set_priority(self.priority)\n" }, { "alpha_fraction": 0.6115367412567139, "alphanum_fraction": 0.6142406463623047, "avg_line_length": 28.586666107177734, "blob_id": "3d62cbcfb6876a2e68d8a57bf31fb88adca7dfc4", "content_id": "d6de52025ec4186380b2e84e31ec06a8ebd6944e", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 4438, "license_type": "permissive", "max_line_length": 69, "num_lines": 150, "path": "/builder/commands/storycmd.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nStory Command Object\n====================\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('StoryCmd',)\n\n\nfrom typing import Any, Tuple\nfrom builder.commands.command import SCmd\nfrom builder.commands.scode import SCode\nfrom builder.containers.chapter import Chapter\nfrom builder.containers.episode import Episode\nfrom builder.containers.material import Material\nfrom builder.containers.scene import Scene\nfrom builder.datatypes.builderexception import BuilderError\nfrom builder.datatypes.database import Database\nfrom builder.datatypes.materialtype import MaterialType\nfrom builder.objects.day import Day\nfrom builder.objects.sobject import SObject\nfrom builder.objects.time import Time\nfrom builder.utils import assertion\nfrom builder.utils.logger import MyLogger\n\n\n# logger\nLOG = MyLogger.get_logger(__name__)\nLOG.set_file_handler()\n\n\nclass StoryCmdError(BuilderError):\n ''' General StoryCmd Error.\n '''\n pass\n\n\nclass StoryCmd(object):\n ''' Story Command Object class.\n '''\n\n def __init__(self, db: Database):\n LOG.info('SCMD: initialize')\n LOG.debug(f'-- db: {db}')\n self._db = assertion.is_instance(db, Database)\n\n #\n # property\n #\n\n #\n # method: for Container\n #\n\n def chapter(self, *args, **kwargs) -> Chapter:\n ''' Create a chapter container and set contents.\n '''\n return Chapter(*args, **kwargs)\n\n def episode(self, *args, **kwargs) -> Episode:\n ''' Create an episode container and set contents.\n '''\n return Episode(*args, **kwargs)\n\n def scene(self, *args, **kwargs) -> Scene:\n ''' Create a scene container and set contents.\n '''\n return Scene(*args, **kwargs)\n\n def document(self, *args, **kwargs) -> Material:\n ''' Create a document container and contents.\n '''\n return Material(MaterialType.DOCUMENT,\n *args, **kwargs)\n\n def writer_note(self, *args, **kwargs) -> Material:\n ''' Create a writer's note.\n '''\n return Material(MaterialType.WRITER_NOTE,\n *args, **kwargs)\n\n def character_note(self, *args, **kwargs) -> Material:\n ''' Create a character's note.\n '''\n return Material(MaterialType.CHARACTER_NOTE,\n *args, **kwargs)\n\n #\n # method: for Plot\n #\n\n def plot_note(self, *args) -> SCode:\n return SCode(None, SCmd.PLOT_NOTE, args, '')\n\n def foreshadow(self, *args, flagname: str='') -> SCode:\n return SCode(None, SCmd.PLOT_FORESHADOW, args, flagname)\n\n def payoff(self, *args, flagname: str='') -> SCode:\n return SCode(None, SCmd.PLOT_PAYOFF, args, flagname)\n\n def motif(self, motif: str, *args) -> SCode:\n return SCode(None, SCmd.PLOT_MOTIF, args, motif)\n\n def plot_setup(self, *args, about: str=\"main\") -> SCode:\n return SCode(None, SCmd.PLOT_SETUP, args, about)\n\n def plot_develop(self, *args, about: str=\"main\") -> SCode:\n return SCode(None, SCmd.PLOT_DEVELOP, args, about)\n\n def plot_resolve(self, *args, about: str=\"main\") -> SCode:\n return SCode(None, SCmd.PLOT_RESOLVE, args, about)\n\n def plot_turnpoint(self, *args, about: str=\"main\") -> SCode:\n return SCode(None, SCmd.PLOT_TURNPOINT, args, about)\n\n\n #\n # method: for Scene control\n #\n\n def change_camera(self, key: str) -> SCode:\n return SCode(self._db.get(key), SCmd.CHANGE_CAMEARA, ())\n\n def change_stage(self, key: str):\n return SCode(self._db.get(key), SCmd.CHANGE_STAGE, ())\n\n def change_date(self, *args: (int, str)):\n if len(args) > 1 and isinstance(args[0], int):\n tmp = Day('', *args)\n return SCode(tmp, SCmd.CHANGE_DATE, ())\n else:\n return SCode(self._db.get(args[0]), SCmd.CHANGE_DATE, ())\n\n def change_time(self, *args: (int, str)):\n if len(args) > 1 and isinstance(args[0], int):\n tmp = Time('', *args)\n return SCode(tmp, SCmd.CHANGE_TIME, ())\n else:\n return SCode(self._db.get(args[0]), SCmd.CHANGE_TIME, ())\n\n def elapse_day(self, month: int=0, day: int=0, year: int=0):\n return SCode(None, SCmd.ELAPSE_DAY, (month, day, year))\n\n def elapse_time(self, hour: int=0, minute: int=0):\n return SCode(None, SCmd.ELAPSE_TIME, (hour, minute))\n\n def put(self, *objs: SObject) -> SCode:\n return SCode(None, SCmd.PUT_OBJECT, objs)\n" }, { "alpha_fraction": 0.565371036529541, "alphanum_fraction": 0.5736160278320312, "avg_line_length": 27.266666412353516, "blob_id": "5c3569845a79c06c820094434c9206e9d8c2e3aa", "content_id": "8b11db808c3014e2bf566dd2d4e44d8fee873e74", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 849, "license_type": "permissive", "max_line_length": 63, "num_lines": 30, "path": "/tests/datatypes/test_codelist.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nCodeList class test\n===================\n'''\n\nimport unittest\nfrom tests.testutils import print_testtitle, validate_with_fail\nfrom builder.commands.scode import SCode, SCmd\nfrom builder.datatypes import codelist as cd\n\n\nclass CodeListTest(unittest.TestCase):\n\n @classmethod\n def setUpClass(cls):\n print_testtitle(cd.__name__, 'CodeList class')\n\n def test_instance(self):\n s0 = SCode(None, SCmd.BE, (), '')\n s1 = SCode(None, SCmd.INFO_DATA, (), '')\n data = [\n # (args, expect)\n (True, (s0, s1), (s0, s1)),\n ]\n def checker(args, expect):\n tmp = cd.CodeList(*args)\n self.assertIsInstance(tmp, cd.CodeList)\n self.assertEqual(tmp.data, expect)\n validate_with_fail(self, 'instance', checker, data)\n\n" }, { "alpha_fraction": 0.5478219985961914, "alphanum_fraction": 0.5486394762992859, "avg_line_length": 31.191728591918945, "blob_id": "5c10919f3c7fa01568aa70e159b7b44631cbbf1a", "content_id": "eec920f7b9712d612ca9a9bc6c57a0d6e4949e28", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 8607, "license_type": "permissive", "max_line_length": 90, "num_lines": 266, "path": "/builder/datatypes/database.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nStory Database Object\n=====================\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('Database',)\n\n\nfrom typing import Any, Callable\nfrom builder.datatypes.builderexception import BuilderError\nfrom builder.objects.day import Day\nfrom builder.objects.item import Item\nfrom builder.objects.person import Person\nfrom builder.objects.rubi import Rubi\nfrom builder.objects.sobject import SObject\nfrom builder.objects.stage import Stage\nfrom builder.objects.time import Time\nfrom builder.objects.word import Word\nfrom builder.utils import assertion\nfrom builder.utils.logger import MyLogger\n\n\n# alias\nListLike = (list, tuple)\n\n# logger\nLOG = MyLogger.get_logger(__name__)\nLOG.set_file_handler()\n\n\nclass DatabaseError(BuilderError):\n ''' DB General Error\n '''\n pass\n\n\nclass Database(object):\n ''' Database object class for a story data.\n '''\n\n __ASSET_ELEMENTS__ = ('PERSONS', 'STAGES', 'DAYS', 'TIMES', 'ITEMS', 'WORDS', 'RUBIS')\n\n def __init__(self):\n LOG.info('DB: initialize')\n self._persons = {}\n self._stages = {}\n self._days = {}\n self._times = {}\n self._items = {}\n self._words = {}\n self._rubis = {}\n self._tags = {}\n # default settings\n self.append_person('who', 'ある人', '', 30,(1,1), 'male', '会社員')\n\n #\n # property\n #\n\n @property\n def persons(self) -> dict:\n return self._persons\n\n @property\n def stages(self) -> dict:\n return self._stages\n\n @property\n def days(self) -> dict:\n return self._days\n\n @property\n def times(self) -> dict:\n return self._times\n\n @property\n def items(self) -> dict:\n return self._items\n\n @property\n def words(self) -> dict:\n return self._words\n\n @property\n def rubis(self) -> dict:\n return self._rubis\n\n @property\n def tags(self) -> dict:\n return self._tags\n\n #\n # methods\n #\n\n def get(self, key: str) -> SObject:\n if assertion.is_str(key) in self.persons:\n return self._persons[key]\n elif key in self.stages:\n return self._stages[key]\n elif key.startswith('on_') and key.replace('on_','') in self.stages:\n return self._stages[key.replace('on_', '')]\n elif key in self.days:\n return self._days[key]\n elif key.startswith('in_') and key.replace('in_','') in self.days:\n return self._days[key.replace('in_','')]\n elif key in self.times:\n return self._times[key]\n elif key.startswith('at_') and key.replace('at_','') in self.times:\n return self._times[key.replace('at_','')]\n elif key in self.items:\n return self._items[key]\n elif key.startswith('i_') and key.replace('i_','') in self.items:\n return self._items[key.replace('i_','')]\n elif key in self.words:\n return self._words[key]\n elif key.startswith('w_') and key.replace('w_','') in self.words:\n return self._words[key.replace('w_','')]\n else:\n msg = f'Not found the key in DB: {key}'\n LOG.error(msg)\n return None\n\n def get_person_names(self) -> list:\n tmp = []\n for val in self._persons.values():\n tmp.append(val.name)\n tmp.append(val.firstname)\n tmp.append(val.lastname)\n tmp.append(val.fullname)\n tmp.append(val.exfullname)\n return list(set(tmp))\n\n def build_db(self, persons: ListLike, stages: ListLike, days: ListLike,\n times: ListLike, items: ListLike, words: ListLike,\n rubis: ListLike) -> None:\n # TODO: 間違ったものの設定時はエラー出す\n if assertion.is_listlike(persons):\n self.set_persons(persons)\n if assertion.is_listlike(stages):\n self.set_stages(stages)\n if assertion.is_listlike(days):\n self.set_days(days)\n if assertion.is_listlike(times):\n self.set_times(times)\n if assertion.is_listlike(items):\n self.set_items(items)\n if assertion.is_listlike(words):\n self.set_words(words)\n if assertion.is_listlike(rubis):\n self.set_rubis(rubis)\n\n def set_from_asset(self, asset: dict) -> None:\n for elm in self.__ASSET_ELEMENTS__:\n if elm.upper() in assertion.is_dict(asset):\n if elm.lower() == 'persons':\n self.set_persons(asset[elm.upper()])\n elif elm.lower() == 'stages':\n self.set_stages(asset[elm.upper()])\n elif elm.lower() == 'days':\n self.set_days(asset[elm.upper()])\n elif elm.lower() == 'times':\n self.set_times(asset[elm.upper()])\n elif elm.lower() == 'items':\n self.set_items(asset[elm.upper()])\n elif elm.lower() == 'words':\n self.set_words(asset[elm.upper()])\n elif elm.lower() == 'rubis':\n self.set_rubis(asset[elm.upper()])\n else:\n msg = f'Asset name mismatch!: {elm.upper()}'\n LOG.error(msg)\n\n def set_persons(self, persons: ListLike) -> None:\n self._set_objects(persons, self.append_person)\n\n def set_stages(self, stages: ListLike) -> None:\n self._set_objects(stages, self.append_stage)\n\n def set_days(self, days: ListLike) -> None:\n self._set_objects(days, self.append_day)\n\n def set_times(self, times: ListLike) -> None:\n self._set_objects(times, self.append_time)\n\n def set_items(self, items: ListLike) -> None:\n self._set_objects(items, self.append_item)\n\n def set_words(self, words: ListLike) -> None:\n self._set_objects(words, self.append_word)\n\n def set_rubis(self, rubis: ListLike) -> None:\n self._set_objects(rubis, self.append_rubi)\n\n def append_person(self, key: str, *args: Any) -> None:\n self._append_object(key, *args, obj=Person)\n\n def append_stage(self, key: str, *args: Any) -> None:\n self._append_object(key, *args, obj=Stage)\n\n def append_day(self, key: str, *args: Any) -> None:\n self._append_object(key, *args, obj=Day)\n\n def append_time(self, key: str, *args: Any) -> None:\n self._append_object(key, *args, obj=Time)\n\n def append_item(self, key: str, *args: Any) -> None:\n self._append_object(key, *args, obj=Item)\n\n def append_word(self, key: str, *args: Any) -> None:\n self._append_object(key, *args, obj=Word)\n\n def append_rubi(self, key: str, *args: Any) -> None:\n self._append_object(key, *args, obj=Rubi)\n\n #\n # private methods\n #\n\n def _append_object(self, key: str, *args: Any, obj: SObject) -> None:\n if obj is Person:\n tmp = Person(*args)\n self._persons[assertion.is_str(key)] = tmp\n self._tags[key] = tmp.name\n self._tags['n_' + key] = tmp.name\n self._tags['ln_' + key] = tmp.lastname\n self._tags['fn_' + key] = tmp.firstname\n self._tags['full_' + key] = tmp.fullname\n self._tags['exfull_' + key] = tmp.exfullname\n elif obj is Stage:\n tmp = Stage(*args)\n self._stages[assertion.is_str(key)] = tmp\n self._tags[key] = tmp.name\n self._tags['on_' + key] = tmp.name\n elif obj is Day:\n tmp = Day(*args)\n self._days[assertion.is_str(key)] = tmp\n self._tags[key] = tmp.name\n self._tags['in_' + key] = tmp.name\n elif obj is Time:\n tmp = Time(*args)\n self._times[assertion.is_str(key)] = tmp\n self._tags[key] = tmp.name\n self._tags['at_' + key] = tmp.name\n elif obj is Item:\n tmp = Item(*args)\n self._items[assertion.is_str(key)] = tmp\n self._tags[key] = tmp.name\n self._tags['i_' + key] = tmp.name\n elif obj is Word:\n tmp = Word(*args)\n self._words[assertion.is_str(key)] = tmp\n self._tags[key] = tmp.name\n self._tags['w_' + key] = tmp.name\n elif obj is Rubi:\n self._rubis[assertion.is_str(key)] = Rubi(key, *args)\n else:\n msg = f'Unknown a story object for appending to DB: {obj}'\n LOG.error(msg)\n\n def _set_objects(self, data: ListLike, func: Callable) -> None:\n for line in assertion.is_listlike(data):\n func(line[0], *line[1:])\n" }, { "alpha_fraction": 0.6141079068183899, "alphanum_fraction": 0.6156638860702515, "avg_line_length": 24.355262756347656, "blob_id": "c73ebe8ecf6db3e54864f43c6fc598bd614a4379", "content_id": "ca48ccde574bfbdb184e101032d107bd07cf5344", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1942, "license_type": "permissive", "max_line_length": 96, "num_lines": 76, "path": "/analyzer/core/word_analyzer.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nWord Analyzer Object\n================\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('WordAnalyzer',)\n\n\nfrom analyzer.datatypes.analyzerexception import AnalyzerError\nfrom analyzer.datatypes.mecabdata import MecabData\nfrom analyzer.datatypes.tokenlist import TokenList\nfrom analyzer.datatypes.wordclass import WordClass\nfrom analyzer.tools.counter import WordCounter\nfrom builder.core.executer import Executer\nfrom builder.datatypes.resultdata import ResultData\nfrom builder.utils import assertion\nfrom builder.utils.logger import MyLogger\n\n\n# logger\nLOG = MyLogger.get_logger(__name__)\nLOG.set_file_handler()\n\n\nclass WordAnalyzeError(AnalyzerError):\n ''' General error in WordAnalyzer.\n '''\n pass\n\n\nclass WordAnalyzer(Executer):\n ''' Word Analyze class.\n '''\n def __init__(self):\n super().__init__()\n LOG.info('WORD_ANALYZER: initialize')\n\n #\n # methods\n #\n\n def execute(self, src: TokenList) -> ResultData:\n LOG.info('WORD_ANALYZER: start exec')\n is_succeeded = True\n error = None\n tmp = assertion.is_listlike(self._exec_internal(src))\n return ResultData(\n tmp,\n is_succeeded,\n error)\n\n #\n # private methods\n #\n\n def _exec_internal(self, src: TokenList) -> list:\n LOG.debug(f'-- src: {src}')\n tmp = []\n tmp.extend(self._wordclass_counts(src))\n return tmp\n\n def _wordclass_counts(self, src: TokenList) -> list:\n assertion.is_instance(src, TokenList)\n tmp = []\n counter = WordCounter()\n # 品詞数\n total = len(src.data)\n each_nums = [(wcls, counter.word_classes_of(src, wcls)) for wcls in WordClass.get_all()]\n tmp.append('# 品詞分析\\n')\n tmp.append(f'- Total: {total}')\n for val in each_nums:\n tmp.append(f'- {val[0].conv_str()}: {val[1]}')\n return tmp\n\n" }, { "alpha_fraction": 0.6142857074737549, "alphanum_fraction": 0.6183673739433289, "avg_line_length": 22.285715103149414, "blob_id": "cee6ffa25ef7b00ea1108149b7ab65a5b7263e2a", "content_id": "237e1f82c832b7e2c31795dd40f63ac7cb9b471c", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 490, "license_type": "permissive", "max_line_length": 63, "num_lines": 21, "path": "/tests/datatypes/test_compilemode.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nCompileMode Enum class test\n===========================\n'''\n\nimport unittest\nfrom tests.testutils import print_testtitle, validate_with_fail\nfrom builder.datatypes import compilemode as cp\n\n\nclass CompileModeTest(unittest.TestCase):\n\n @classmethod\n def setUpClass(cls):\n print_testtitle(cp.__name__, 'CompileMode Enum class')\n\n def test_instance(self):\n self.assertEqual(\n len(cp.CompileMode.get_all()),\n 6)\n\n" }, { "alpha_fraction": 0.7035176157951355, "alphanum_fraction": 0.7035176157951355, "avg_line_length": 11.4375, "blob_id": "3fce3f1010fdaaf34a9df40f904f579899b771b2", "content_id": "00c937d59962a6e022844773d9ac232b1c0ec2fd", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": true, "language": "Markdown", "length_bytes": 199, "license_type": "permissive", "max_line_length": 33, "num_lines": 16, "path": "/.github/ISSUE_TEMPLATE/custom.md", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "---\nname: Custom issue template\nabout: Simple question or request\ntitle: 'Suggest: title'\nlabels: ''\nassignees: ''\n\n---\n\nJapanese title\n===\n\nA your thought description.\n\n**Note**\nadditional comment.\n" }, { "alpha_fraction": 0.5896739363670349, "alphanum_fraction": 0.5910326242446899, "avg_line_length": 26.259260177612305, "blob_id": "734d1845dc3a0eceadad351ea4cee685f5717491", "content_id": "ea6e443496ed2c2dd0e4d4d5726ac4cc3828e263", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 736, "license_type": "permissive", "max_line_length": 65, "num_lines": 27, "path": "/tests/datatypes/test_storyconfig.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nStoryConfig class test\n======================\n'''\n\nimport unittest\nfrom tests.testutils import print_testtitle, validate_with_fail\nfrom builder.datatypes import storyconfig as sc\n\n\nclass StoryConfigTest(unittest.TestCase):\n\n @classmethod\n def setUpClass(cls):\n print_testtitle(sc.__name__, 'StoryConfig class')\n\n def test_instance(self):\n data = [\n # (title, expect)\n (True, 'test', 'test'),\n ]\n def checker(title, expect):\n tmp = sc.StoryConfig(title)\n self.assertIsInstance(tmp, sc.StoryConfig)\n self.assertEqual(tmp.title, expect)\n validate_with_fail(self, 'class instance', checker, data)\n" }, { "alpha_fraction": 0.6851698160171509, "alphanum_fraction": 0.6859983205795288, "avg_line_length": 27.046510696411133, "blob_id": "5afb2723354d4f700aa8ce6f2d632f8f478d04f0", "content_id": "befcc23abb33eacae879ec88a9b42b52b08b1178", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1207, "license_type": "permissive", "max_line_length": 134, "num_lines": 43, "path": "/builder/datatypes/resultdata.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nResult Data Object\n==================\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('ResultData',)\n\n\nfrom analyzer.datatypes.tokenlist import TokenList\nfrom builder.containers.container import Container\nfrom builder.datatypes.builderexception import BuilderError\nfrom builder.datatypes.codelist import CodeList\nfrom builder.datatypes.rawdata import RawData\nfrom builder.datatypes.textlist import TextList\nfrom builder.utils import assertion\n\n\nclass ResultData(object):\n ''' Result data package object.\n '''\n def __init__(self, data: (list, Container, CodeList, RawData, TextList, TokenList), is_succeeded: bool, error: BuilderError=None):\n self._data = assertion.is_various_types(data, (list, Container, CodeList, RawData, TextList, TokenList))\n self._is_succeeded = assertion.is_bool(is_succeeded)\n self._error = error\n\n #\n # property\n #\n\n @property\n def data(self) -> (list, Container, CodeList, RawData, TextList, TokenList):\n return self._data\n\n @property\n def is_succeeded(self) -> bool:\n return self._is_succeeded\n\n @property\n def error(self) -> (BuilderError, None):\n return self._error\n\n" }, { "alpha_fraction": 0.652466356754303, "alphanum_fraction": 0.6547085046768188, "avg_line_length": 21.25, "blob_id": "42887ae889144383e15937006347e2fd6d63b223", "content_id": "fabae1d3995684ba2ae91747128de59751e95c1f", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 446, "license_type": "permissive", "max_line_length": 63, "num_lines": 20, "path": "/tests/core/test_validater.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nValidater class test\n====================\n'''\n\nimport unittest\nfrom tests.testutils import print_testtitle, validate_with_fail\nfrom builder.core import validater as vd\n\n\nclass ValidaterTest(unittest.TestCase):\n\n @classmethod\n def setUpClass(cls):\n print_testtitle(vd.__name__, 'Validater class')\n\n def test_instance(self):\n tmp = vd.Validater()\n self.assertIsInstance(tmp, vd.Validater)\n\n" }, { "alpha_fraction": 0.528777003288269, "alphanum_fraction": 0.5305755138397217, "avg_line_length": 17.53333282470703, "blob_id": "6700d4a56fffa4dbccb088ed491e9cfd7970a5e4", "content_id": "9880b330e0ac0ce80c471bb4e5650e9570a939e8", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 556, "license_type": "permissive", "max_line_length": 45, "num_lines": 30, "path": "/builder/datatypes/compilemode.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nCompile Mode Enum\n=================\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('CompileMode',)\n\n\nfrom enum import Enum, auto\n\n\nclass CompileMode(Enum):\n ''' Compile Mode enumerate\n '''\n NORMAL = auto()\n NOVEL_TEXT = auto()\n STORY_DATA = auto()\n PLOT = auto()\n SCENARIO = auto()\n AUDIODRAMA = auto()\n\n @classmethod\n def get_all(cls) -> list:\n return [cls.NORMAL, cls.NOVEL_TEXT,\n cls.STORY_DATA,\n cls.PLOT,\n cls.SCENARIO, cls.AUDIODRAMA]\n" }, { "alpha_fraction": 0.6272352337837219, "alphanum_fraction": 0.6286107301712036, "avg_line_length": 24.964284896850586, "blob_id": "a54c0ca0c593a5328b0586fa3686ce7565a2cea5", "content_id": "d5c98c7ac00df4a5b829098e36f8917eb5292cef", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1454, "license_type": "permissive", "max_line_length": 89, "num_lines": 56, "path": "/analyzer/tools/counter.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nCounter Object\n==============\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('Counter',)\n\n\nfrom analyzer.datatypes.mecabdata import MecabData\nfrom analyzer.datatypes.wordclass import WordClass\nfrom analyzer.datatypes.tokenlist import TokenList\nfrom builder.datatypes.textlist import TextList\nfrom builder.utils import assertion\nfrom builder.utils.util_str import kanji_list_from\nfrom builder.utils.logger import MyLogger\n\n\n# logger\nLOG = MyLogger.get_logger(__name__)\nLOG.set_file_handler()\n\n\nclass WordCounter(object):\n ''' Word Counter Object class.\n '''\n\n #\n # methods (word classes)\n #\n\n def word_classes_of(self, src: TokenList, wordclass: WordClass) -> int:\n tmp = []\n assertion.is_instance(wordclass, WordClass)\n for token in assertion.is_instance(src, TokenList).data:\n if assertion.is_instance(token, MecabData).wordclass == wordclass.conv_str():\n tmp.append(token)\n return len(tmp)\n\n #\n # methods (kanji)\n #\n\n def kanjis_of(self, src: (TextList, list, tuple, str)) -> int:\n tmp = []\n if isinstance(src, TextList):\n tmp = [kanji_list_from(line) for line in src.data]\n elif isinstance(src, (list, tuple)):\n tmp = [kanji_list_from(line) for line in src]\n elif isinstance(src, str):\n tmp = kanji_list_from(src)\n else:\n return 0\n return len(tmp)\n" }, { "alpha_fraction": 0.5562157034873962, "alphanum_fraction": 0.561700165271759, "avg_line_length": 38.76363754272461, "blob_id": "45478192bf21b6fa0f98606f3d00e91bc31c2ac5", "content_id": "d340f16df6b71f3e97d3819cbd18e143722d6947", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2188, "license_type": "permissive", "max_line_length": 88, "num_lines": 55, "path": "/tests/commands/test_scode.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nSCode class test\n================\n'''\n\nimport unittest\nfrom tests.testutils import print_testtitle, validate_with_fail\nfrom builder.commands.command import SCmd\nfrom builder.commands import scode as sc\nfrom builder.objects.sobject import SObject\n\n\nclass SCodeTest(unittest.TestCase):\n\n @classmethod\n def setUpClass(cls):\n print_testtitle(sc.__name__, 'SCode class')\n\n def test_instance(self):\n obj = SObject('test')\n data = [\n # (src, cmd, script, option, exp_src, exp_cmd, exp_script, exp_option)\n (True, obj, SCmd.BE, ('apple','orange'), 'a note',\n obj, SCmd.BE, ('apple','orange'), 'a note'),\n ]\n def checker(src, cmd, script, option, exp_src, exp_cmd, exp_script, exp_option):\n tmp = sc.SCode(src, cmd, script, option)\n self.assertIsInstance(tmp, sc.SCode)\n self.assertEqual(tmp.src, exp_src)\n self.assertEqual(tmp.cmd, exp_cmd)\n self.assertEqual(tmp.script, exp_script)\n self.assertEqual(tmp.option, exp_option)\n validate_with_fail(self, 'class instance', checker, data)\n\n def test_inherited(self):\n obj0 = SObject('apple')\n obj1 = SObject('orange')\n data = [\n # (src, cmd, script, option, new_src, new_script, new_option,\n # exp_src, exp_cmd, exp_script, exp_option)\n (True, obj0, SCmd.DO, ('a', 'b'), 'a note',\n obj1, ('b', 'c'), 'a test',\n obj1, SCmd.DO, ('b', 'c'), 'a test'),\n ]\n def checker(src, cmd, script, option, new_src, new_script, new_option,\n exp_src, exp_cmd, exp_script, exp_option):\n tmp = sc.SCode(src, cmd, script, option)\n tmp2 = tmp.inherited(new_src, new_script, new_option)\n self.assertIsInstance(tmp2, sc.SCode)\n self.assertEqual(tmp2.src, exp_src)\n self.assertEqual(tmp2.cmd, exp_cmd)\n self.assertEqual(tmp2.script, exp_script)\n self.assertEqual(tmp2.option, exp_option)\n validate_with_fail(self, 'inherited', checker, data)\n\n" }, { "alpha_fraction": 0.6531531810760498, "alphanum_fraction": 0.6554054021835327, "avg_line_length": 21.149999618530273, "blob_id": "527972e080ac86457c0d2acce5201418829b8df4", "content_id": "8f87f4dd9950113075cce0f8328a17eeb0ef54cc", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 444, "license_type": "permissive", "max_line_length": 63, "num_lines": 20, "path": "/tests/datatypes/test_database.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nDatabase class test\n===================\n'''\n\nimport unittest\nfrom tests.testutils import print_testtitle, validate_with_fail\nfrom builder.datatypes import database as db\n\n\nclass DatabaseTest(unittest.TestCase):\n\n @classmethod\n def setUpClass(cls):\n print_testtitle(db.__name__, 'Database class')\n\n def test_instance(self):\n tmp = db.Database()\n self.assertIsInstance(tmp, db.Database)\n\n" }, { "alpha_fraction": 0.6666666865348816, "alphanum_fraction": 0.6694678068161011, "avg_line_length": 18.77777862548828, "blob_id": "bcca8f5faf9d6df7b1ab8bd43b6381f8d0b72580", "content_id": "a312c53b1b04052075f1ad390b14b3d32357ae98", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 357, "license_type": "permissive", "max_line_length": 59, "num_lines": 18, "path": "/analyzer/datatypes/analyzerexception.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nAnalyzer Exception Object\n=========================\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('AnalyzerException',)\n\n\nfrom builder.datatypes.builderexception import BuilderError\nfrom builder.utils import assertion\n\n\nclass AnalyzerError(BuilderError):\n \"\"\"Base class for exceptions of the story analyzer\"\"\"\n pass\n\n" }, { "alpha_fraction": 0.6052934527397156, "alphanum_fraction": 0.6055235862731934, "avg_line_length": 33.484127044677734, "blob_id": "2c827c2a3d8c88765dcac05aa84060b35141dbbe", "content_id": "c73cf2a7d26adb0e5475c6c4379be2c98367661e", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 4345, "license_type": "permissive", "max_line_length": 82, "num_lines": 126, "path": "/builder/core/tagreplacer.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nTag Replacer Object\n===================\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('TagReplacer',)\n\n\nfrom builder.commands.scode import SCode\nfrom builder.containers.chapter import Chapter\nfrom builder.containers.episode import Episode\nfrom builder.containers.material import Material\nfrom builder.containers.scene import Scene\nfrom builder.containers.story import Story\nfrom builder.core.executer import Executer\nfrom builder.datatypes.builderexception import BuilderError\nfrom builder.datatypes.resultdata import ResultData\nfrom builder.datatypes.storyconfig import StoryConfig\nfrom builder.utils import assertion\nfrom builder.utils.logger import MyLogger\nfrom builder.utils.util_dict import dict_sorted, combine_dict\nfrom builder.utils.util_str import string_replaced_by_tag\n\n\n# alias\nContainerLike = (Story, Chapter, Episode, Scene, SCode, Material)\n\n\n# logger\nLOG = MyLogger.get_logger(__name__)\nLOG.set_file_handler()\n\n\nclass TagReplacer(Executer):\n ''' Tag Replacer Executer class.\n '''\n def __init__(self):\n super().__init__()\n LOG.info('TAG_REPLACER: initialize')\n #\n # methods\n #\n\n def execute(self, src: Story, config: StoryConfig, tags: dict) -> ResultData:\n LOG.info('TAG_REPLACER: start exec')\n LOG.debug(f'-- src: {src}')\n LOG.debug(f'-- config: {config}')\n LOG.debug(f'-- tags: {tags}')\n is_succeeded = True\n error = None\n tmp = self._exec_internal(src, dict_sorted(tags, True))\n is_succeeded = self._config_data_replaced(config, dict_sorted(tags, True))\n return ResultData(\n tmp,\n is_succeeded,\n error)\n\n #\n # private methods\n #\n\n def _exec_internal(self, src: Story, tags: dict) -> Story:\n tmp = []\n for child in assertion.is_instance(src, Story).children:\n if isinstance(child, (Chapter, Episode, Scene, Material)):\n tmp.append(self._replaced_in_container(child, tags))\n elif isinstance(child, SCode):\n tmp.append(self._replaced_scode(child, tags))\n else:\n LOG.error(f'Invalid value: {child}')\n return src.inherited(\n *tmp,\n title=string_replaced_by_tag(src.title, tags),\n outline=string_replaced_by_tag(src.outline, tags))\n\n\n def _config_data_replaced(self, config: StoryConfig, tags: dict) -> bool:\n assertion.is_instance(config, StoryConfig)\n\n is_succeeded = True\n\n config.set_title(string_replaced_by_tag(config.title, tags))\n config.set_copy(string_replaced_by_tag(config.copy, tags))\n config.set_oneline(string_replaced_by_tag(config.oneline, tags))\n config.set_outline(string_replaced_by_tag(config.outline, tags))\n\n return is_succeeded\n\n\n def _replaced_in_container(self, src: (Chapter, Episode, Scene, Material),\n tags: dict) -> (Chapter, Episode, Scene):\n tmp = []\n if isinstance(src, (Chapter, Episode, Scene, Material)):\n for child in src.children:\n if isinstance(child, (Chapter, Episode, Scene, Material)):\n tmp.append(self._replaced_in_container(child, tags))\n elif isinstance(child, SCode):\n tmp.append(self._replaced_scode(child, tags))\n else:\n LOG.error(f'Invalid replace object!: {type(child)}: {child}')\n else:\n LOG.error(f'Invalid container object!: {type(src)}: {src}')\n return None\n return src.inherited(\n *tmp,\n title=string_replaced_by_tag(src.title, tags),\n outline=string_replaced_by_tag(src.outline, tags),\n )\n\n def _replaced_scode(self, src: SCode, tags: dict) -> Scode:\n script = assertion.is_instance(src, SCode).script\n _tags = tags\n def _conv(val, tags):\n if isinstance(val, str):\n return string_replaced_by_tag(val, tags)\n else:\n return val\n if hasattr(src.src, 'calling'):\n _tags = dict_sorted(combine_dict(tags, src.src.calling), True)\n script = tuple(_conv(v, _tags) for v in script)\n return src.inherited(\n script=script,\n )\n" }, { "alpha_fraction": 0.6080760359764099, "alphanum_fraction": 0.6104512810707092, "avg_line_length": 14.592592239379883, "blob_id": "9fa4ee4c4999a784bb835b224aae20dcf299cb63", "content_id": "47b13cf1e5fe457f39111f1bcc8e085dd89e2269", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 421, "license_type": "permissive", "max_line_length": 53, "num_lines": 27, "path": "/builder/core/executer.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nExecuter Object\n===============\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('Executer',)\n\n\nfrom abc import ABC, abstractmethod\nfrom builder.datatypes.resultdata import ResultData\nfrom builder.utils import assertion\n\n\nclass Executer(ABC):\n ''' Executer class.\n '''\n\n #\n # methods\n #\n\n @abstractmethod\n def execute(self, *args, **kwargs) -> ResultData:\n pass\n" }, { "alpha_fraction": 0.5233050584793091, "alphanum_fraction": 0.5254237055778503, "avg_line_length": 16.481481552124023, "blob_id": "fb4c61b61ea8a0f906e9aeb9b8e83bc4a6dc1648", "content_id": "3acde5bbd59f150632d2e99f042704e063140ee6", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 472, "license_type": "permissive", "max_line_length": 52, "num_lines": 27, "path": "/builder/datatypes/materialtype.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nMaterialType Enum\n=================\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('MaterialType',)\n\n\nfrom enum import Enum, auto\n\n\nclass MaterialType(Enum):\n ''' Material Type enumerate\n '''\n DOCUMENT = auto()\n WRITER_NOTE = auto()\n CHARACTER_NOTE = auto()\n\n @classmethod\n def get_all(cls) -> list:\n return [\n cls.WRITER_NOTE, cls.CHARACTER_NOTE,\n cls.DOCUMENT,\n ]\n" }, { "alpha_fraction": 0.5667896866798401, "alphanum_fraction": 0.5682656764984131, "avg_line_length": 29.784090042114258, "blob_id": "1f866993da50f55d665ca9412c6b1788c4d60a7e", "content_id": "c31e9d03bca6cfdd7cb33df7e722cdf64d15d6d6", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2714, "license_type": "permissive", "max_line_length": 115, "num_lines": 88, "path": "/builder/tools/checker.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nChecker Object\n==============\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('Checker',)\n\n\nimport re\nfrom typing import Any\nfrom builder.commands.scode import SCode, SCmd\nfrom builder.utils import assertion\nfrom builder.utils.logger import MyLogger\n\n\n# logger\nLOG = MyLogger.get_logger(__name__)\nLOG.set_file_handler()\n\n\nclass Checker(object):\n ''' Checker Object class.\n '''\n\n #\n # methods (has)\n #\n\n def has_rubi_exclusions(self, src: str, ex_words: (tuple, list)) -> bool:\n ''' Check whether the string has a exclusion rubi-words.\n '''\n for word in assertion.is_listlike(ex_words):\n if assertion.is_str(word) in assertion.is_str(src):\n return True\n return False\n\n def has_rubi_key(self, src: str, key: str) -> bool:\n ''' Check whether the string has a rubi-key.\n '''\n return True if re.search(r'{}'.format(assertion.is_str(key)), assertion.is_str(src)) else False\n\n def has_rubi_key_converted(self, src: str, key: str) -> bool:\n ''' Check whether the string has a converted rubi-key.\n '''\n return True if re.search(r'|{}'.format(assertion.is_str(key)), assertion.is_str(src)) \\\n or re.search(r'{《}'.format(key), src) else False\n\n def has_tag_comment(self, src: str) -> bool:\n ''' Check whether the string has a tag comment.\n '''\n return src.startswith('<!--')\n\n def has_tag_symbol(self, src: str, symbol: str='$') -> bool:\n ''' Check whether the string has a tag symbol.\n '''\n return True if re.search(r'\\{}[a-zA-Z]'.format(assertion.is_str(symbol)), assertion.is_str(src)) else False\n\n def has_tag_top(self, src: str) -> bool:\n ''' Check whether the string has a tag top.\n '''\n return src.startswith(('# ', '## ', '### ', '**', '_S'))\n\n def has_then(self, src: SCode) -> bool:\n ''' Check whether the scode script has then.\n '''\n if assertion.is_instance(src, SCode).cmd is SCmd.THEN:\n return True\n return len([val for val in src.script if '&' == val]) > 0\n\n #\n # methods (is)\n #\n\n def is_breakline(self, src: str) -> bool:\n return '\\n' == src or '\\n\\n' == src\n\n def is_empty_script(self, src: SCode, is_ex_comment: bool=False) -> bool:\n tmp_a = [val for val in assertion.is_instance(src, SCode).script if '&' == val]\n tmp_b = [val for val in src.script if val.startswith('#')] if not is_ex_comment else []\n if len(src.script) == 0:\n return True\n elif len(src.script) - len(tmp_a) - len(tmp_b) <= 0:\n return True\n else:\n return False\n\n" }, { "alpha_fraction": 0.6413043737411499, "alphanum_fraction": 0.6496655344963074, "avg_line_length": 21.980770111083984, "blob_id": "a0ee84bcab047fa63c144012f73cc769b485e23c", "content_id": "64feaa8aab4160d8ea71e2090de08645c4a4e8fa", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1196, "license_type": "permissive", "max_line_length": 99, "num_lines": 52, "path": "/builder/__init__.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# The init file is for storybuilder, that a story building manager on console.\n# License: MIT License, @see the file 'LICENSE' for details.\n'''\nStoryBuilder framework\n======================\n\nStoryBuilder is a library for developing story contents. the terms of\nthe `MIT License <https://en.wikipedia.org/wiki/MIT_License>`_.\n'''\nimport sys\n\n\nMAJOR = 0\nMINOR = 6\nMICRO = 2\nFEATURE = 0\n\n#\n# Information\n#\n\n__TITLE__ = 'StoryBuilder'\n__LICENSE__ = 'MIT'\n__VERSION__ = f\"{MAJOR}.{MINOR}.{MICRO}-{FEATURE}\" if int(FEATURE) else f\"{MAJOR}.{MINOR}.{MICRO}\"\n__AUTHOR__ = __maintainer__ = 'N.T.Works'\n__EMAIL__ = 'nagisc007@yahoo.co.jp'\n__DESC__ = 'Story builder is a library for developing story contents.'\n\n\n#\n# CONSTANTS\n#\n\n__DEFAULT_LOG_LEVEL__ = 'warning'\n__PRIORITY_DEFAULT__ = 5\n__PRIORITY_MAX__ = 10\n__PRIORITY_MIN__ = 0\n\nVERSION_MSG = (\n 'StoryBuilder: version: v{0}'.format(__VERSION__),\n 'Python: version: {0}'.format(' '.join(line.strip() for line in sys.version.splitlines())),\n )\n\n#\n# LOGGER\n#\nimport datetime\nfrom builder.utils.logger import MyLogger\n\nLOG = MyLogger.get_logger(__TITLE__)\nLOG.set_file_handler(f'{datetime.date.today()}')\nLOG.set_shared_level(__DEFAULT_LOG_LEVEL__)\n\n" }, { "alpha_fraction": 0.6570155620574951, "alphanum_fraction": 0.6592427492141724, "avg_line_length": 20.33333396911621, "blob_id": "3b71f6503ee9564f4cf92b18c9e7bb16b5c9142d", "content_id": "ccd9092b779aa59ecdce9ad468b83aa0f9fc97f8", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 449, "license_type": "permissive", "max_line_length": 63, "num_lines": 21, "path": "/tests/commands/test_tagcmd.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nTagCmd class test\n=================\n'''\n\nimport argparse\nimport unittest\nfrom tests.testutils import print_testtitle, validate_with_fail\nfrom builder.commands import tagcmd as cmd\n\n\nclass TagCmdTest(unittest.TestCase):\n\n @classmethod\n def setUpClass(cls):\n print_testtitle(cmd.__name__, 'TagCmd class')\n\n def test_instance(self):\n tmp = cmd.TagCmd()\n self.assertIsInstance(tmp, cmd.TagCmd)\n\n" }, { "alpha_fraction": 0.5988531708717346, "alphanum_fraction": 0.5991024971008301, "avg_line_length": 29.150375366210938, "blob_id": "147b34f14022dfd4ba6336de12a22315bbb4a157", "content_id": "52ef08377075530fe72e95497f0451ba7789b29a", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 4011, "license_type": "permissive", "max_line_length": 90, "num_lines": 133, "path": "/builder/core/plotupdater.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nPlot Info Updater Object\n========================\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('PlotUpdater',)\n\n\nfrom itertools import chain\nfrom typing import Tuple\nfrom builder.commands.scode import SCode, SCmd\nfrom builder.containers.chapter import Chapter\nfrom builder.containers.episode import Episode\nfrom builder.containers.material import Material\nfrom builder.containers.scene import Scene\nfrom builder.containers.story import Story\nfrom builder.core.executer import Executer\nfrom builder.datatypes.builderexception import BuilderError\nfrom builder.datatypes.resultdata import ResultData\nfrom builder.datatypes.plotinfo import PlotInfo\nfrom builder.utils import assertion\nfrom builder.utils import util_list\nfrom builder.utils.logger import MyLogger\n\n\n# alias\nContainerLike = (Story, Chapter, Episode, Scene, SCode, Material)\n\n\n# logger\nLOG = MyLogger.get_logger(__name__)\nLOG.set_file_handler()\n\n\nclass PlotUpdaterError(BuilderError):\n ''' General Error of PlotUpdater.\n '''\n pass\n\n\nclass PlotUpdater(Executer):\n ''' Plot Updater Executer class.\n '''\n def __init__(self):\n super().__init__()\n LOG.info('PLOT_UPDATER: initialize')\n\n #\n # methods\n #\n\n def execute(self, src: Story) -> ResultData:\n LOG.info('PLOT_UPDATER: start exec')\n tmp, is_succeeded, error = assertion.is_tuple(self._exec_internal(src))\n return ResultData(\n assertion.is_instance(tmp, Story),\n is_succeeded,\n error)\n\n #\n # private methods\n #\n\n def _exec_internal(self, src: Story) -> Tuple[Story, bool, (PlotUpdaterError, None)]:\n assertion.is_instance(src, Story)\n\n tmp = []\n is_succeeded = True\n error = None\n\n titles = self._collect_plot_title(src)\n\n infos = []\n for title in titles:\n ret = self._updated_plot_info(src, title)\n if ret:\n infos.append(PlotInfo(title, *ret))\n\n ret = self._inserted_after_storyinfo(src, infos)\n return ret, is_succeeded, error\n\n\n def _collect_plot_title(self, src: ContainerLike) -> list:\n tmp = []\n for child in src.children:\n if isinstance(child, (Chapter, Episode, Scene, Material)):\n tmp.extend(self._collect_plot_title(child))\n elif isinstance(child, SCode):\n if child.cmd in SCmd.get_plot_structs():\n tmp.append(child.option)\n return list(set(tmp))\n\n def _updated_plot_info(self, src: Story, title: str) -> list:\n assertion.is_instance(src, Story)\n tmp = []\n for child in src.children:\n ret = self._updated_plot_info_internal(child, title)\n if ret:\n tmp.extend(ret)\n return tmp\n\n def _updated_plot_info_internal(self, src: (Chapter, Episode, Scene, Material, SCode),\n title: str) -> list:\n if isinstance(src, (Chapter, Episode, Scene, Material)):\n tmp = []\n for child in src.children:\n ret = self._updated_plot_info_internal(child, title)\n if ret:\n tmp.extend(ret)\n return tmp\n elif isinstance(src, SCode):\n if src.cmd in SCmd.get_plot_structs() and src.option == title:\n return [src]\n else:\n LOG.error('Invalid value in updated_plot_info_internal: {src}')\n return []\n\n def _inserted_after_storyinfo(self, src: Story, infos: list) -> Story:\n assertion.is_instance(src, Story)\n LOG.debug(f'- info in inserted_after_storyinfo:{infos}')\n\n tmp = []\n for child in src.children:\n if isinstance(child, SCode) and child.cmd is SCmd.INFO_STORY:\n tmp.append(child)\n for info in infos:\n tmp.append(SCode(None, SCmd.INFO_DATA, (info,), \"\"))\n else:\n tmp.append(child)\n return src.inherited(*tmp)\n\n" }, { "alpha_fraction": 0.46714720129966736, "alphanum_fraction": 0.4674244523048401, "avg_line_length": 32.39814758300781, "blob_id": "770f4796306bcbeffdeaf80dcf6b247a488cb373", "content_id": "7386f31dd3f1e86c7eac36f56217a43b648e88ba", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3635, "license_type": "permissive", "max_line_length": 76, "num_lines": 108, "path": "/tests/tools/test_checker.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nChecker class test\n==================\n'''\n\nimport unittest\nfrom tests.testutils import print_testtitle, validate_with_fail\nfrom builder.commands.scode import SCode, SCmd\nfrom builder.tools import checker as ck\n\n\nclass CheckerTest(unittest.TestCase):\n\n @classmethod\n def setUpClass(cls):\n print_testtitle(ck.__name__, 'Item class')\n\n def test_has_rubi_exclusions(self):\n data = [\n # (src, exwords, expect)\n (True, '太郎', ['太郎',], True),\n ]\n validate_with_fail(self, 'has_rubi_exclusions',\n lambda src, exwords, expect: self.assertEqual(\n ck.Checker().has_rubi_exclusions(src, exwords), expect),\n data)\n\n def test_has_rubi_key(self):\n data = [\n # (src, key, expect[bool])\n (True, 'test', 't', True),\n ]\n validate_with_fail(self, 'has_rubi_key',\n lambda src,key,expect: self.assertEqual(\n ck.Checker().has_rubi_key(src, key), expect),\n data)\n\n def test_has_rubi_key_converted(self):\n data = [\n # (src, key, expect[bool])\n (True, '|太郎', '太郎', True),\n ]\n validate_with_fail(self, 'has_rubi_key_converted',\n lambda src,key,expect: self.assertEqual(\n ck.Checker().has_rubi_key_converted(src, key), expect),\n data)\n\n def test_has_tag_comment(self):\n data = [\n # (src, expect[bool])\n (True, '<!--comment-->', True),\n ]\n validate_with_fail(self, 'has_tag_comment',\n lambda src, expect: self.assertEqual(\n ck.Checker().has_tag_comment(src), expect),\n data)\n\n def test_has_tag_symbol(self):\n data = [\n # (src, symbol, expect)\n (True, '$taroはね', '$', True),\n (True, '俺は$taroだ', '$', True),\n ]\n validate_with_fail(self, 'has_tag_symbol',\n lambda src, symbol, expect: self.assertEqual(\n ck.Checker().has_tag_symbol(src, symbol), expect),\n data)\n\n def test_has_tag_top(self):\n data = [\n # (src, expect[bool])\n (True, '# head', True),\n ]\n validate_with_fail(self, 'has_tag_top',\n lambda src, expect: self.assertEqual(\n ck.Checker().has_tag_top(src), expect),\n data)\n\n def test_has_then(self):\n data = [\n # (src, expect[bool])\n (True, SCode(None, SCmd.THEN, (),\"\"), True),\n ]\n validate_with_fail(self, 'has_then',\n lambda src, expect: self.assertEqual(\n ck.Checker().has_then(src), expect),\n data)\n\n def test_is_breakline(self):\n data = [\n # (src, expect[bool])\n (True, '\\n', True),\n ]\n validate_with_fail(self, 'is_breakline',\n lambda src, expect: self.assertEqual(\n ck.Checker().is_breakline(src), expect),\n data)\n\n def test_is_empty_script(self):\n data = [\n # (src, expect[bool])\n (True, SCode(None, SCmd.BE, ('&',), \"\"), True),\n ]\n validate_with_fail(self, 'is_empty_script',\n lambda src, expect: self.assertEqual(\n ck.Checker().is_empty_script(src), expect),\n data)\n" }, { "alpha_fraction": 0.6254681944847107, "alphanum_fraction": 0.6264045238494873, "avg_line_length": 18.759260177612305, "blob_id": "7e0188954f0719199eb1ffa9d07b30517d0ace67", "content_id": "07714036fd94e488c2de32c9ab84a1cf39b47c34", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1068, "license_type": "permissive", "max_line_length": 59, "num_lines": 54, "path": "/builder/commands/tagcmd.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nTag Command Object\n==================\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('TagCmd',)\n\n\nfrom builder.commands.command import SCmd\nfrom builder.commands.scode import SCode\nfrom builder.datatypes.builderexception import BuilderError\nfrom builder.utils import assertion\nfrom builder.utils.logger import MyLogger\n\n\n# logger\nLOG = MyLogger.get_logger(__name__)\nLOG.set_file_handler()\n\n\nclass TagCmdError(BuilderError):\n ''' General TagCmd Error.\n '''\n pass\n\n\nclass TagCmd(object):\n ''' Tag Command Object class.\n '''\n\n def __init__(self):\n LOG.info('TCMD: initialize')\n\n #\n # methods\n #\n\n def br(self) -> SCode:\n return SCode(None, SCmd.TAG_BR, ())\n\n def comment(self, *comments: str):\n return SCode(None, SCmd.TAG_COMMENT, comments)\n\n def hr(self):\n return SCode(None, SCmd.TAG_HR, ())\n\n def symbol(self, symbol: str):\n return SCode(None, SCmd.TAG_SYMBOL, (symbol,))\n\n def title(self, title: str):\n return SCode(None, SCmd.TAG_TITLE, (title,))\n\n" }, { "alpha_fraction": 0.5737704634666443, "alphanum_fraction": 0.5749414563179016, "avg_line_length": 17.955554962158203, "blob_id": "e09c4f2ff8b6bc95e5894b4cf0c7f6cf532fbe2e", "content_id": "788608fa57c475ac84d8a84f046d64ffa4928a40", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 854, "license_type": "permissive", "max_line_length": 79, "num_lines": 45, "path": "/builder/objects/rubi.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nRubi Object\n===========\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('Rubi',)\n\n\nfrom builder.objects.sobject import SObject\nfrom builder.utils import assertion\n\n\nclass Rubi(SObject):\n ''' Rubi Object class.\n '''\n\n def __init__(self, name: str, rubi: str, exclusions: tuple=None,\n is_always: bool=False):\n super().__init__(name)\n self._rubi = assertion.is_str(rubi)\n self._exclusions = assertion.is_tuple(exclusions) if exclusions else ()\n self._is_always = assertion.is_bool(is_always)\n\n #\n # property\n #\n\n @property\n def rubi(self) -> str:\n return self._rubi\n\n @property\n def exclusions(self) -> tuple:\n return self._exclusions\n\n @property\n def is_always(self) -> bool:\n return self._is_always\n\n #\n # methods\n #\n\n" }, { "alpha_fraction": 0.5016545057296753, "alphanum_fraction": 0.5023163557052612, "avg_line_length": 25.98214340209961, "blob_id": "f9e73e9b1cccbf316f9afd18023f90a07be2c44e", "content_id": "0ffb4316a58100c62997286a3d9dd096ae182739", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1651, "license_type": "permissive", "max_line_length": 64, "num_lines": 56, "path": "/analyzer/datatypes/wordclass.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nWord Class Enum\n===============\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('WordClass',)\n\n\nfrom enum import Enum, auto\nfrom builder.utils import assertion\n\n\nclass WordClass(Enum):\n ''' Word class enumerate.\n '''\n NOUN = auto() # 名詞\n VERB = auto() # 動詞\n ADJECTIVE = auto() # 形容詞\n ADVERB = auto() # 副詞\n CONJUCTION = auto() # 接続詞\n INTERJECTION = auto() # 感動詞\n ADNOMINAL = auto() # 連体詞\n AUXVERB = auto() # 助動詞\n PARTICLE = auto() # 助詞\n MARK = auto() # 記号\n PREFIX = auto() # 接頭詞\n FILLER = auto() # フィラー\n OTHER = auto() # その他\n\n @classmethod\n def get_all(cls) -> list:\n return [cls.NOUN, cls.VERB, cls.ADJECTIVE, cls.ADVERB,\n cls.CONJUCTION, cls.INTERJECTION, cls.ADNOMINAL,\n cls.AUXVERB, cls.PARTICLE,\n cls.MARK, cls.PREFIX,\n cls.FILLER, cls.OTHER]\n\n def conv_str(self) -> str:\n return {\n WordClass.NOUN: \"名詞\",\n WordClass.VERB: \"動詞\",\n WordClass.ADJECTIVE: \"形容詞\",\n WordClass.ADVERB: \"副詞\",\n WordClass.CONJUCTION: \"接続詞\",\n WordClass.INTERJECTION: \"感動詞\",\n WordClass.ADNOMINAL: \"連体詞\",\n WordClass.AUXVERB: \"助動詞\",\n WordClass.PARTICLE: \"助詞\",\n WordClass.MARK: \"記号\",\n WordClass.PREFIX: \"接続詞\",\n WordClass.FILLER: \"フィラー\",\n WordClass.OTHER: \"その他\",\n }[self]\n" }, { "alpha_fraction": 0.5860121846199036, "alphanum_fraction": 0.5864465832710266, "avg_line_length": 28.139240264892578, "blob_id": "44c818a235d118239a390dc7834d14b241500514", "content_id": "5001c154c5ed962a17f49e109686e7ad1527c889", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2302, "license_type": "permissive", "max_line_length": 98, "num_lines": 79, "path": "/builder/core/commentconverter.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nComment Converter Object\n========================\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('CommentConverter',)\n\n\nfrom builder.commands.scode import SCode, SCmd\nfrom builder.containers.chapter import Chapter\nfrom builder.containers.episode import Episode\nfrom builder.containers.material import Material\nfrom builder.containers.scene import Scene\nfrom builder.containers.story import Story\nfrom builder.core.executer import Executer\nfrom builder.datatypes.builderexception import BuilderError\nfrom builder.datatypes.resultdata import ResultData\nfrom builder.utils import assertion\nfrom builder.utils.logger import MyLogger\n\n\n# alias\nContainerLike = (Story, Chapter, Episode, Scene, SCode, Material)\n\n# logger\nLOG = MyLogger.get_logger(__name__)\nLOG.set_file_handler()\n\n\nclass CommentConverter(Executer):\n ''' Comment Converter Executer class.\n '''\n def __init__(self):\n super().__init__()\n LOG.info('CMT_CONVERTER: initialize')\n #\n # methods\n #\n\n def execute(self, src: Story) -> ResultData:\n LOG.info('CMT_CONVERTER: start exec')\n is_succeeded = True\n error = None\n tmp = assertion.is_instance(self._exec_internal(src), Story)\n return ResultData(\n tmp,\n is_succeeded,\n error)\n\n #\n # private methods\n #\n\n def _exec_internal(self, src: ContainerLike) -> (Story, Chapter, Episode, Scene, SCode, None):\n LOG.debug(f'-- src: {src}')\n tmp = []\n if isinstance(src, (Story, Chapter, Episode, Scene, Material)):\n tmp = []\n for child in src.children:\n if isinstance(child, (Chapter, Episode, Scene, Material)):\n ret = self._exec_internal(child)\n if ret:\n tmp.append(ret)\n elif isinstance(child, SCode):\n tmp.append(child)\n elif isinstance(child, str):\n tmp.append(SCode(None, SCmd.TAG_COMMENT, (child,), ''))\n else:\n # NOTE: error check?\n pass\n return src.inherited(*tmp)\n elif isinstance(src, SCode):\n return src\n else:\n LOG.error()\n return None\n" }, { "alpha_fraction": 0.6211782097816467, "alphanum_fraction": 0.6241610646247864, "avg_line_length": 28.130434036254883, "blob_id": "265cec5b4c36517a827772c0476cea4bac7c30a4", "content_id": "8de024d357a389a6ee6f674303a355fa69ac02c2", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1351, "license_type": "permissive", "max_line_length": 96, "num_lines": 46, "path": "/builder/tools/converter.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nConverter Object\n================\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('Converter',)\n\n\nimport re\nfrom typing import Any\nfrom builder.utils import assertion\nfrom builder.utils.logger import MyLogger\nfrom builder.utils.util_str import validate_string_duplicate_chopped\n\n\n# logger\nLOG = MyLogger.get_logger(__name__)\nLOG.set_file_handler()\n\n\nclass Converter(object):\n ''' Converter Object class.\n '''\n\n #\n # methods (description)\n #\n\n def add_rubi(self, src: str, key: str, rubi: str, num: int=1) -> str:\n return re.sub(r'{}'.format(key), r'{}'.format(rubi), src, num)\n\n def to_description(self, src: (list, tuple)) -> str:\n _ = \"。\".join(assertion.is_listlike(src))\n return validate_string_duplicate_chopped(f'{_}。')\n\n def to_dialogue(self, src: (list, tuple), brackets: tuple=('「', '」')) -> str:\n _ = \"。\".join(assertion.is_listlike(src))\n return validate_string_duplicate_chopped(f'{brackets[0]}{_}{brackets[1]}')\n\n def script_relieved_strings(self, src: (list, tuple)) -> list:\n return list(val for val in assertion.is_listlike(src) if isinstance(val, (int, str)))\n def script_relieved_symbols(self, src: (list, tuple)) -> list:\n return list(val for val in assertion.is_listlike(src) if not ('&' == val or '#' in val))\n\n" }, { "alpha_fraction": 0.4457114636898041, "alphanum_fraction": 0.4486861526966095, "avg_line_length": 35.654544830322266, "blob_id": "cf67ba8f7ebb42d9013748f96636bfbdf5aa6c12", "content_id": "37af8c89ec6d7790058bb3892d435343cafc703b", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2017, "license_type": "permissive", "max_line_length": 65, "num_lines": 55, "path": "/tests/objects/test_writer.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nWriter class test\n=================\n'''\n\nimport unittest\nfrom tests.testutils import print_testtitle, validate_with_fail\nfrom builder.commands.scode import SCode, SCmd\nfrom builder.objects.sobject import SObject\nfrom builder.world import Writer\n\n\nclass WriterTest(unittest.TestCase):\n\n @classmethod\n def setUpClass(cls):\n print_testtitle(\"world.Writer\", 'Writer class')\n\n def test_instance(self):\n taro = SObject('taro')\n data = [\n # (src, act, args, exp_src, exp_cmd, exp_args)\n (True, taro, 'be', ('a',),\n taro, SCmd.BE, ('a',)),\n (True, taro, 'come', ('a',),\n taro, SCmd.COME, ('a',)),\n (True, taro, 'do', ('a',),\n taro, SCmd.DO, ('a',)),\n (True, taro, 'explain', ('a',),\n taro, SCmd.EXPLAIN, ('a',)),\n (True, taro, 'go', ('a',),\n taro, SCmd.GO, ('a',)),\n (True, taro, 'hear', ('a',),\n taro, SCmd.HEAR, ('a',)),\n (True, taro, 'look', ('a',),\n taro, SCmd.LOOK, ('a',)),\n (True, taro, 'talk', ('a',),\n taro, SCmd.TALK, ('a',)),\n (True, taro, 'think', ('a',),\n taro, SCmd.THINK, ('a',)),\n (True, taro, 'voice', ('a',),\n taro, SCmd.VOICE, ('a',)),\n (True, taro, 'wear', ('a',),\n taro, SCmd.WEAR, ('a',)),\n ]\n def checker(src, act, args, exp_src, exp_cmd, exp_args):\n tmp = Writer(src)\n self.assertIsInstance(tmp, Writer)\n tmp2 = getattr(tmp, act)(*args)\n self.assertIsInstance(tmp2, SCode)\n self.assertEqual(tmp2.src, exp_src)\n self.assertEqual(tmp2.cmd, exp_cmd)\n self.assertEqual(tmp2.script, exp_args)\n validate_with_fail(self, 'class instance', checker, data)\n\n" }, { "alpha_fraction": 0.573887288570404, "alphanum_fraction": 0.6942230463027954, "avg_line_length": 24.91773223876953, "blob_id": "5250b73199f67c227089b3940bac31370422940b", "content_id": "a5c1c7dc51c60093fe3af36b051c4b7d3f15e921", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 14177, "license_type": "permissive", "max_line_length": 112, "num_lines": 547, "path": "/CHANGELOG.md", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# ChangeLog\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)\nand this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).\n\n## [Unreleased]\n\n## [0.6.2-0] - 2021-01-29\n### Changed\n- new builder\n\n## [0.5.1-4] - 2020-02-26\n### Fixed\n- rubi: kotatsu\n\n## [0.5.1-3] - 2020-02-18\n### Fixed\n- rubi\n\n## [0.5.1-2] - 2020-02-18\n### Fixed\n- format invalid breakline\n\n## [0.5.1-1] - 2020-02-01\n### Added\n- episode char count in description\n\n## [0.5.1] - 2020-02-01\n### Added\n- description output with scene char count\n\n## [0.5.0] - 2020-02-01\n### Added\n- continued action\n\n## [0.4.5-7] - 2020-01-31\n### Changed\n- person line format\n\n## [0.4.5-6] - 2020-01-31\n### Added\n- person line output\n### Changed\n- stage and event line output dir\n\n## [0.4.5-5] - 2020-01-31\n### Fixed\n- event point string longer\n\n## [0.4.5-4] - 2020-01-31\n### Fixed\n- event line scene title\n\n## [0.4.5-3] - 2020-01-31\n### Changed\n- event line format\n### Fixed\n- stage and area cooperation\n\n## [0.4.5-2] - 2020-01-30\n### Fixed\n- Asset file names\n\n## [0.4.5-1] - 2020-01-30\n### Fixed\n- Area not set bug\n\n## [0.4.5] - 2020-01-30\n### Added\n- Area data class\n\n## [0.4.4-5] - 2020-01-29\n### Added\n- elapsed day\n\n## [0.4.4-4] - 2020-01-29\n### Added\n- Asset: acccessory\n### Changed\n- block output using list switch\n### Fixed\n- time delta in Stageline\n\n## [0.4.4-3] - 2020-01-28\n### Fixed\n- duplicated maru in Conte\n\n## [0.4.4-2] - 2020-01-28\n### Added\n- Time object new attr and methods: elapsed time\n\n## [0.4.4-1] - 2020-01-28\n### Fixed\n- desc char count: except wear action strings\n\n## [0.4.4] - 2020-01-28\n### Changed\n- object texture: single data from dict\n\n## [0.4.3-33] - 2020-01-28\n### Added\n- scene objects output on Conte\n\n## [0.4.3-32] - 2020-01-28\n### Changed\n- block info output using tags\n### Fixed\n- action object dupulicated when dividing actions\n\n## [0.4.3-31] - 2020-01-28\n### Changed\n- stage line format\n\n## [0.4.3-30] - 2020-01-27\n### Fixed\n- question and kakko bug: invalid inserting a space\n\n## [0.4.3-29] - 2020-01-27\n### Changed\n- look action and subject display format on conte\n\n## [0.4.3-28] - 2020-01-27\n### Fixed\n- combine to description bug: divided action\n\n## [0.4.3-27] - 2020-01-27\n### Changed\n- stage line output format: time delta arrow\n\n## [0.4.3-26] - 2020-01-27\n### Added\n- info volume output\n\n## [0.4.3-25] - 2020-01-26\n### Added\n- event line output\n### Changed\n- stage line format\n\n## [0.4.3-24] - 2020-01-26\n### Added\n- meta data: event\n\n## [0.4.3-23] - 2020-01-26\n### Fixed\n- info tag convert\n\n## [0.4.3-22] - 2020-01-25\n### Added\n- block title display on conte\n\n## [0.4.3-21] - 2020-01-25\n### Fixed\n- part output end number\n\n## [0.4.3-20] - 2020-01-24\n### Fixed\n- part output number\n\n## [0.4.3-19] - 2020-01-24\n### Added\n- action per person output\n\n## [0.4.3-18] - 2020-01-23\n### Fixed\n- conte output in action do with item object\n\n## [0.4.3-17] - 2020-01-23\n### Fixed\n- kigou with spacing bug: invalid inserted\n\n## [0.4.3-16] - 2020-01-21\n### Fixed\n- who bug: invalid replacement\n\n## [0.4.3-15] - 2020-01-21\n### Added\n- auto action divide\n\n## [0.4.3-14] - 2020-01-21\n### Fixed\n- mecab verbs analyzer\n\n## [0.4.3-13] - 2020-01-21\n### Fixed\n- writer subject using not person\n\n## [0.4.3-12] - 2020-01-21\n### Changed\n- conte output format (icon adding)\n\n## [0.4.3-11] - 2020-01-20\n### Added\n- chapter and episode char count output\n- block info output\n- stage line output\n### Changed\n- scene setting shared over episodes\n### Fixed\n- comment output always\n\n## [0.4.3-10] - 2020-01-15\n### Added\n- note tag convert\n- charactor count output each scene on conte\n\n## [0.4.3-9] - 2020-01-13\n### Added\n- text output\n\n## [0.4.3-8] - 2020-01-13\n### Fixed\n- tag format: br and symbol output\n\n## [0.4.3-7] - 2020-01-12\n### Added\n- columns and rows setting\n\n## [0.4.3-6] - 2020-01-12\n### Fixed\n- combine documents using then\n\n## [0.4.3-5] - 2020-01-12\n### Added\n- set outline in world\n### Fixed\n- output outline maintile\n\n## [0.4.3-4] - 2020-01-12\n### Added\n- note and titles counter\n### Changed\n- outline output format (each heads)\n\n## [0.4.3-3] - 2020-01-10\n### Fixed\n- buildDB order typo\n\n## [0.4.3-2] - 2020-01-10\n### Fixed\n- chapter count ouput: typo\n\n## [0.4.3-1] - 2020-01-10\n### Fixed\n- output without maru using ActType.Voice\n\n## [0.4.3] - 2020-01-08\n### Added\n- LifeNote\n- History\n\n## [0.4.2] - 2020-01-07\n### Added\n- MetaData\n- Rubi\n- Layer\n- Pronoun\n- Checker\n### Removed\n- Flag\n\n## NOTE\n- version 0.4.0 and 0.4.1 is fallback\n\n## [0.3.2] - 2019-12-16\n### Added\n- Writer\n- Scene: using when, where and who\n### Changed\n- Analyzer: using story containers\n### Fixed\n- old parser methods\n\n## [0.3.1] - 2019-12-02\n### Added\n- Extractor\n- Formatter\n- Covnerter\n- common times data\n- episode char count\n- Person: simple person creator\n- test utility\n### Changed\n- Parser\n- display names of values in subtest\n- Analyzer: containsWord using all story containers/And or Or check enable\n### Fixed\n- analyzer bug\n- default layer\n\n## [0.3.0] - 2019-11-17\n### Added\n- action layer\n- using MeCab for analyzer\n- priority filter\n- collect word class\n- parser class\n- formatter class\n- test utility\n- build test on travis ci\n### Changed\n- scene set at first time\n### Fixed\n- scene and episode title\n- scenario symbole without maru\n\n\n## [0.2.10] - 2019-11-13\n### Note\n- moved new repository\n\n## [0.2.9] - 2019-10-18\n### TODO\n- each unit tests\n### Changed\n- Refining total sources\n### Removed\n- Old builder\n\n## [0.2.1] - 2019-07-07\n### Added\n- themes and motifs checking utility\n- manupapers count\n- keywords checking in descriptions\n- first and last name each persons (using as tag)\n- person's new attributes\n- emphasis description\n- directly writing a description to an action\n- output each scene information\n### Fixed\n- duplicated output with info option\n- empty main title error\n- nodesc class checkout\n\n## [0.2.0] - 2019-04-27\n### Added\n- Analyzer methods from tools\n- Parser methods from tools\n### Changed\n- assertion methods\n- story structure\n### Deleted\n- old tools.py\n- olt testtools.py\n\n## [0.1.0] - 2019-04-10\n### Added\n- new Base Action\n- new Base Subject\n- Subject class for basic all subject\n### Changed\n- StoryDB to Master\n- All tests with new Action and Subject\n### Deleted\n- Behavior\n- BehavType\n- old Person class (have many attr)\n\n## [0.0.9] - 2019-04-08\n### Added\n- Characters count\n- Insert break line\n- Break symbol\n- Combine description\n- Dialogue mode in description\n- Replaced calling tag in description\n### Changed\n- Omit description using a priority\n### Fixed\n- (Kakko, Hatena) and Maru bug\n- Combine bug (vanish or each inserted break line)\n\n## [0.0.8] - 2019-04-05\n### Added\n- Utility functions(assertion, print test title)\n- Omit description\n- Story title(episode title) inserted break line before\n- Description shorter typing\n### Changed\n- Class and function arg type check using custom assertion\n- Multi calling attribute\n### Fixed\n- No use comma when after symbol\n- Coverage check\n- Behavior REPLY lacking\n\n## [0.0.7] - 2019-04-02\n### Added\n- StoryDB\n- Info, Nothing\n- AuxVerb\n- Converted objects\n- Multi object at an action\n### Changed\n- Refined Action\n- Assertion for object types\n\n## [0.0.6] - 2019-03-25\n### Added\n- New action group (scene, combi)\n- negative mode\n- action flags and deflags\n### Changed\n- output an action format\n### Fixed\n- error message without an action info\n- error message without an object name\n\n## [0.0.5] - 2019-03-19\n### Added\n- Word class\n- Action's object param\n- Behavior type\n- Many new attribute words to Person class\n- Passive mode to Action\n- Language type\n### Changed\n- Outline test using Action\n### Fixed\n- Top space with a description\n- Exchanged commandline action flags\n\n## [0.0.4] - 2019-03-19\n### Added\n- ActionGroup class\n- Master class (inherited Subject class)\n### Changed\n- Action class < Act class\n- Story management as ActionGroup\n### Deleted\n- Story class\n- Episode class\n- Scene class\n\n## [0.0.3] - 2019-03-18\n### Added\n- Github issue template\n- Github pull request template\n- BaseAction class\n- Story class\n- Episode class\n- Scene class\n- story building method\n- option parser\n- output as action infos\n### Changed\n- Act's verb without a particle\n### Fixed\n- Failed to equal sentences in testtools\n\n## [0.0.2] - 2019-03-11\n### Added\n- Act class to add a new attr \"behavior\"\n- Behavior enum types (from major english verbs)\n- Subject class for using act's subject base\n### Changed\n- Person, Stage, Item and DayTime class based Subject\n- Story check test completely 5w1h.\n### Deleted\n- Example story and test.\n- ActType(MUST, DONE)\n- Must and Done act (instead to an act behavior).\n\n## [0.0.1] - 2019-03-08\n### Added\n- This CHANGELOG file to hopefully serve as an evolving example of a standardized open source project CHANGELOG.\n- README one line implemented.\n- Basic classes to build a story.\n- Test suites for basic features.\n- Example story as usage.\n- Output story as markdown.\n\n[Unreleased]: https://github.com/nagisc007/storybuilder/compare/v0.6.2-0...HEAD\n[0.6.2-0]: https://github.com/nagisc007/storybuilder/releases/v0.6.2-0\n[0.5.1-4]: https://github.com/nagisc007/storybuilder/releases/v0.5.1-4\n[0.5.1-3]: https://github.com/nagisc007/storybuilder/releases/v0.5.1-3\n[0.5.1-2]: https://github.com/nagisc007/storybuilder/releases/v0.5.1-2\n[0.5.1-1]: https://github.com/nagisc007/storybuilder/releases/v0.5.1-1\n[0.5.1]: https://github.com/nagisc007/storybuilder/releases/v0.5.1\n[0.5.0]: https://github.com/nagisc007/storybuilder/releases/v0.5.0\n[0.4.5-7]: https://github.com/nagisc007/storybuilder/releases/v0.4.5-7\n[0.4.5-6]: https://github.com/nagisc007/storybuilder/releases/v0.4.5-6\n[0.4.5-5]: https://github.com/nagisc007/storybuilder/releases/v0.4.5-5\n[0.4.5-4]: https://github.com/nagisc007/storybuilder/releases/v0.4.5-4\n[0.4.5-3]: https://github.com/nagisc007/storybuilder/releases/v0.4.5-3\n[0.4.5-2]: https://github.com/nagisc007/storybuilder/releases/v0.4.5-2\n[0.4.5-1]: https://github.com/nagisc007/storybuilder/releases/v0.4.5-1\n[0.4.5]: https://github.com/nagisc007/storybuilder/releases/v0.4.5\n[0.4.4-5]: https://github.com/nagisc007/storybuilder/releases/v0.4.4-5\n[0.4.4-4]: https://github.com/nagisc007/storybuilder/releases/v0.4.4-4\n[0.4.4-3]: https://github.com/nagisc007/storybuilder/releases/v0.4.4-3\n[0.4.4-2]: https://github.com/nagisc007/storybuilder/releases/v0.4.4-2\n[0.4.4-1]: https://github.com/nagisc007/storybuilder/releases/v0.4.4-1\n[0.4.4]: https://github.com/nagisc007/storybuilder/releases/v0.4.4\n[0.4.3-33]: https://github.com/nagisc007/storybuilder/releases/v0.4.3-33\n[0.4.3-32]: https://github.com/nagisc007/storybuilder/releases/v0.4.3-32\n[0.4.3-31]: https://github.com/nagisc007/storybuilder/releases/v0.4.3-31\n[0.4.3-30]: https://github.com/nagisc007/storybuilder/releases/v0.4.3-30\n[0.4.3-29]: https://github.com/nagisc007/storybuilder/releases/v0.4.3-29\n[0.4.3-28]: https://github.com/nagisc007/storybuilder/releases/v0.4.3-28\n[0.4.3-27]: https://github.com/nagisc007/storybuilder/releases/v0.4.3-27\n[0.4.3-26]: https://github.com/nagisc007/storybuilder/releases/v0.4.3-26\n[0.4.3-25]: https://github.com/nagisc007/storybuilder/releases/v0.4.3-25\n[0.4.3-24]: https://github.com/nagisc007/storybuilder/releases/v0.4.3-24\n[0.4.3-23]: https://github.com/nagisc007/storybuilder/releases/v0.4.3-23\n[0.4.3-22]: https://github.com/nagisc007/storybuilder/releases/v0.4.3-22\n[0.4.3-21]: https://github.com/nagisc007/storybuilder/releases/v0.4.3-21\n[0.4.3-20]: https://github.com/nagisc007/storybuilder/releases/v0.4.3-20\n[0.4.3-19]: https://github.com/nagisc007/storybuilder/releases/v0.4.3-19\n[0.4.3-18]: https://github.com/nagisc007/storybuilder/releases/v0.4.3-18\n[0.4.3-17]: https://github.com/nagisc007/storybuilder/releases/v0.4.3-17\n[0.4.3-16]: https://github.com/nagisc007/storybuilder/releases/v0.4.3-16\n[0.4.3-15]: https://github.com/nagisc007/storybuilder/releases/v0.4.3-15\n[0.4.3-14]: https://github.com/nagisc007/storybuilder/releases/v0.4.3-14\n[0.4.3-13]: https://github.com/nagisc007/storybuilder/releases/v0.4.3-13\n[0.4.3-12]: https://github.com/nagisc007/storybuilder/releases/v0.4.3-12\n[0.4.3-11]: https://github.com/nagisc007/storybuilder/releases/v0.4.3-11\n[0.4.3-10]: https://github.com/nagisc007/storybuilder/releases/v0.4.3-10\n[0.4.3-9]: https://github.com/nagisc007/storybuilder/releases/v0.4.3-9\n[0.4.3-8]: https://github.com/nagisc007/storybuilder/releases/v0.4.3-8\n[0.4.3-7]: https://github.com/nagisc007/storybuilder/releases/v0.4.3-7\n[0.4.3-6]: https://github.com/nagisc007/storybuilder/releases/v0.4.3-6\n[0.4.3-5]: https://github.com/nagisc007/storybuilder/releases/v0.4.3-5\n[0.4.3-4]: https://github.com/nagisc007/storybuilder/releases/v0.4.3-4\n[0.4.3-3]: https://github.com/nagisc007/storybuilder/releases/v0.4.3-3\n[0.4.3-2]: https://github.com/nagisc007/storybuilder/releases/v0.4.3-2\n[0.4.3-1]: https://github.com/nagisc007/storybuilder/releases/v0.4.3-1\n[0.4.3]: https://github.com/nagisc007/storybuilder/releases/v0.4.3\n[0.4.2]: https://github.com/nagisc007/storybuilder/releases/v0.4.2\n[0.3.2]: https://github.com/nagisc007/storybuilder/releases/v0.3.2\n[0.3.1]: https://github.com/nagisc007/storybuilder/releases/v0.3.1\n[0.3.0]: https://github.com/nagisc007/storybuilder/releases/v0.3.0\n[0.2.10]: https://github.com/nagisc007/storybuilder/releases/v0.2.10\n[0.2.9]: https://github.com/nagisc007/storybuilder/releases/v0.2.9\n[0.2.1]: https://github.com/nagisc007/storybuilder/releases/v0.2.1\n[0.2.0]: https://github.com/nagisc007/storybuilder/releases/v0.2.0\n[0.1.0]: https://github.com/nagisc007/storybuilder/releases/v0.1.0\n[0.0.9]: https://github.com/nagisc007/storybuilder/releases/v0.0.9\n[0.0.8]: https://github.com/nagisc007/storybuilder/releases/v0.0.8\n[0.0.7]: https://github.com/nagisc007/storybuilder/releases/v0.0.7\n[0.0.6]: https://github.com/nagisc007/storybuilder/releases/v0.0.6\n[0.0.5]: https://github.com/nagisc007/storybuilder/releases/v0.0.5\n[0.0.4]: https://github.com/nagisc007/storybuilder/releases/v0.0.4\n[0.0.3]: https://github.com/nagisc007/storybuilder/releases/v0.0.3\n[0.0.2]: https://github.com/nagisc007/storybuilder/releases/v0.0.2\n[0.0.1]: https://github.com/nagisc007/storybuilder/releases/v0.0.1\n" }, { "alpha_fraction": 0.5595505833625793, "alphanum_fraction": 0.5632959008216858, "avg_line_length": 28.64444351196289, "blob_id": "6209e5f5164fd0f58da84e75aef090ad7059b67e", "content_id": "f395dc13368b8fe588b49a9a4f25427d4c567c06", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1335, "license_type": "permissive", "max_line_length": 77, "num_lines": 45, "path": "/tests/testutils.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nUtility methods for test\n========================\n'''\n\n__all__ = ('print_testtitle', 'validate_with_fail')\n\nfrom typing import Callable\nimport unittest\n\n\ndef print_testtitle(fname: str, title: str) -> None:\n ''' Print test title.\n '''\n assert isinstance(fname, str)\n assert isinstance(title, str)\n\n print(f\"\\n======== TEST: [ {fname} ] - {title} ========\")\n\n\ndef validate_with_fail(testcase: unittest.TestCase, title: str,\n testfunc: Callable, data: list) -> None:\n ''' Useful test function, the test run and get a success if that contains\n AssertionError or TypeError.\n Usage:\n >>> data = [\n (True, dataA, dataB, dataC),\n (False, dataA, dataB, dataC), # if error is expected\n ]\n >>> validate_with_fail(testcase, testfunc, data)\n '''\n assert isinstance(testcase, unittest.TestCase)\n assert isinstance(title, str)\n assert callable(testfunc)\n assert isinstance(data, list)\n\n for vals in data:\n with testcase.subTest(title=title, vals=vals):\n assert isinstance(vals[0], bool)\n if vals[0]:\n testfunc(*vals[1:])\n else:\n with testcase.assertRaises((AssertionError, TypeError)):\n testfunc(*vals[1:])\n\n" }, { "alpha_fraction": 0.5366575121879578, "alphanum_fraction": 0.5474328994750977, "avg_line_length": 33.80147171020508, "blob_id": "ea9e70fe562c9beefa9ba471b111bdae86949d29", "content_id": "fff6097ee34ab0070c7f066b3dcf2b437b7af6e3", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 4749, "license_type": "permissive", "max_line_length": 67, "num_lines": 136, "path": "/tests/commands/test_storycmd.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nStoryCmd class test\n===================\n'''\n\nimport argparse\nimport unittest\nfrom tests.testutils import print_testtitle, validate_with_fail\nfrom builder.commands import storycmd as cmd\nfrom builder.commands.scode import SCode, SCmd\nfrom builder.containers.chapter import Chapter\nfrom builder.containers.episode import Episode\nfrom builder.containers.scene import Scene\nfrom builder.datatypes.database import Database\n\n\nclass StoryCmdTest(unittest.TestCase):\n\n @classmethod\n def setUpClass(cls):\n print_testtitle(cmd.__name__, 'StoryCmd class')\n\n def test_instance(self):\n tmp = cmd.StoryCmd(Database())\n self.assertIsInstance(tmp, cmd.StoryCmd)\n\n #\n # for Container\n #\n\n def test_chapter(self):\n scmd = cmd.StoryCmd(Database())\n data = [\n # (title, args, outline, expect)\n (True, 'test', ('a','b'), 'apple', 'test'),\n ]\n def checker(title, args, outline, expect):\n tmp = scmd.chapter(title, *args, outline=outline)\n self.assertIsInstance(tmp, Chapter)\n self.assertEqual(tmp.title, expect)\n validate_with_fail(self, 'chapter', checker, data)\n\n def test_episode(self):\n scmd = cmd.StoryCmd(Database())\n data = [\n # (title, args, outline, expect)\n (True, 'test', ('a','b'), 'apple', 'test'),\n ]\n def checker(title, args, outline, expect):\n tmp = scmd.episode(title, *args, outline=outline)\n self.assertIsInstance(tmp, Episode)\n self.assertEqual(tmp.title, expect)\n validate_with_fail(self, 'episode', checker, data)\n\n def test_scene(self):\n scmd = cmd.StoryCmd(Database())\n data = [\n # (title, args, outline, expect)\n (True, 'test', ('a', 'b'), 'apple', 'test'),\n ]\n def checker(title, args, outline, expect):\n tmp = scmd.scene(title, *args, outline=outline)\n self.assertIsInstance(tmp, Scene)\n self.assertEqual(tmp.title, expect)\n validate_with_fail(self, 'scene', checker, data)\n\n #\n # for Scene control\n #\n\n def test_change_camera(self):\n db = Database()\n db.append_person('taro', '太郎','', 15,(1,1), 'm', 'student')\n scmd = cmd.StoryCmd(db)\n data = [\n # (key, expect)\n (True, 'taro', '太郎'),\n ]\n def checker(key, expect):\n tmp = scmd.change_camera(key)\n self.assertIsInstance(tmp, SCode)\n self.assertEqual(tmp.cmd, SCmd.CHANGE_CAMEARA)\n self.assertEqual(tmp.src.name, expect)\n validate_with_fail(self, 'change_camera', checker, data)\n\n def test_change_stage(self):\n db = Database()\n db.append_stage('room', '部屋')\n scmd = cmd.StoryCmd(db)\n data = [\n # (key, expect)\n (True, 'room', '部屋'),\n ]\n def checker(key, expect):\n tmp = scmd.change_stage(key)\n self.assertIsInstance(tmp, SCode)\n self.assertEqual(tmp.cmd, SCmd.CHANGE_STAGE)\n self.assertEqual(tmp.src.name, expect)\n validate_with_fail(self, 'change_stage', checker, data)\n\n def test_change_day(self):\n import datetime\n db = Database()\n db.append_day('d1', 'day1', 1,1,2020)\n scmd = cmd.StoryCmd(db)\n data = [\n # (keys, expect, exp_date)\n (True, ('d1',), 'day1', datetime.date(2020,1,1)),\n (True, (2,2,1000), '', datetime.date(1000,2,2)),\n ]\n def checker(keys, expect, exp_date):\n tmp = scmd.change_date(*keys)\n self.assertIsInstance(tmp, SCode)\n self.assertEqual(tmp.cmd, SCmd.CHANGE_DATE)\n self.assertEqual(tmp.src.name, expect)\n self.assertEqual(tmp.src.date, exp_date)\n validate_with_fail(self, 'change_date', checker, data)\n\n def test_change_time(self):\n import datetime\n db = Database()\n db.append_time('t1', 'noon', 12,00)\n scmd = cmd.StoryCmd(db)\n data = [\n # (keys, expect, exp_time)\n (True, ('t1',), 'noon', datetime.time(12,00)),\n (True, (11,00), '', datetime.time(11,00)),\n ]\n def checker(keys, expect, exp_time):\n tmp = scmd.change_time(*keys)\n self.assertIsInstance(tmp, SCode)\n self.assertEqual(tmp.cmd, SCmd.CHANGE_TIME)\n self.assertEqual(tmp.src.name, expect)\n self.assertEqual(tmp.src.time, exp_time)\n validate_with_fail(self, 'change_time', checker, data)\n" }, { "alpha_fraction": 0.599656343460083, "alphanum_fraction": 0.6013745665550232, "avg_line_length": 16.08823585510254, "blob_id": "43055fa9a6947a678c838eb7141ac6a45bc750f2", "content_id": "621dab4eb124829cead8e3632859655a9bab705e", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 582, "license_type": "permissive", "max_line_length": 71, "num_lines": 34, "path": "/builder/datatypes/textlist.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nText List Object\n================\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('TextList',)\n\n\nfrom typing import Tuple\nfrom builder.utils import assertion\nfrom builder.utils.logger import MyLogger\n\n\n# logger\nLOG = MyLogger.get_logger(__name__)\nLOG.set_file_handler()\n\n\nclass TextList(object):\n ''' Text list package object.\n '''\n def __init__(self, *args: str):\n self._data = tuple(assertion.is_instance(a, str) for a in args)\n\n #\n # property\n #\n\n @property\n def data(self) -> Tuple[str]:\n return self._data\n\n" }, { "alpha_fraction": 0.6276276111602783, "alphanum_fraction": 0.630630612373352, "avg_line_length": 15.600000381469727, "blob_id": "460779e2bc36f7057677aa46d481828e18a5b0e6", "content_id": "e89ba591a4a832263005c7eba700c7cc4e4819f9", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 333, "license_type": "permissive", "max_line_length": 50, "num_lines": 20, "path": "/builder/containers/chapter.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nChapter Container Object\n========================\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('Chapter',)\n\n\nfrom typing import Any\nfrom builder.containers.container import Container\nfrom builder.utils import assertion\n\n\nclass Chapter(Container):\n ''' Chapter Container class.\n '''\n pass\n\n" }, { "alpha_fraction": 0.5974889397621155, "alphanum_fraction": 0.597858190536499, "avg_line_length": 27.19791603088379, "blob_id": "fb5995b73cf37d1a6897a85faf0a623d1a82b53a", "content_id": "c1f69c5c727cd3c93412d0c7ba168f3be863221b", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2708, "license_type": "permissive", "max_line_length": 73, "num_lines": 96, "path": "/builder/core/outputter.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nOutputter Object\n================\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('Outputter',)\n\nimport datetime\nimport os\nfrom enum import Enum, auto\nfrom builder.core.executer import Executer\nfrom builder.datatypes.builderexception import BuilderError\nfrom builder.datatypes.outputmode import OutputMode\nfrom builder.datatypes.resultdata import ResultData\nfrom builder.datatypes.rawdata import RawData\nfrom builder.datatypes.textlist import TextList\nfrom builder.utils import assertion\nfrom builder.utils.logger import MyLogger\n\n\n# logger\nLOG = MyLogger.get_logger(__name__)\nLOG.set_file_handler()\n\n\nclass OutputModeError(BuilderError):\n ''' Exception of output-mode mismatch.\n '''\n pass\n\n\nclass Outputter(Executer):\n ''' Outputter Executer class.\n '''\n def __init__(self):\n super().__init__()\n LOG.info('OUTPUT: initialize')\n\n #\n # methods\n #\n\n def execute(self, src: TextList, mode: OutputMode,\n filename: str, suffix: str, extention: str,\n builddir: str) -> ResultData:\n LOG.info('OUTPUT: start exec')\n is_succeeded = True\n tmp = []\n error = None\n if assertion.is_instance(mode, OutputMode) is OutputMode.CONSOLE:\n is_succeeded = self._out_to_console(src)\n elif mode is OutputMode.FILE:\n is_succeeded = self._out_to_file(src, filename, suffix,\n extention, builddir)\n else:\n msg = f'Unknown OutputMode!: {mode}'\n LOG.critical(msg)\n error = OutputModeError(msg)\n return ResultData(\n tmp,\n is_succeeded,\n error)\n\n #\n # private methods\n #\n\n def _out_to_console(self, src: TextList) -> bool:\n LOG.info('OUTPUT: out to console')\n\n is_succeeded = True\n for line in assertion.is_instance(src, TextList).data:\n print(line, end='')\n print(datetime.datetime.now())\n return is_succeeded\n\n def _out_to_file(self, src: TextList,\n filename: str, suffix: str, extention: str,\n builddir: str) -> bool:\n LOG.info('OUTPUT: out to file')\n\n is_succeeded = True\n if not os.path.isdir(assertion.is_str(builddir)):\n os.makedirs(builddir)\n fullpath = os.path.join(builddir, \"{}{}.{}\".format(\n assertion.is_str(filename), assertion.is_str(suffix),\n assertion.is_str(extention)\n ))\n with open(fullpath, 'w') as f:\n for line in assertion.is_instance(src, TextList).data:\n f.write(f\"{line}\")\n f.write(f'{datetime.datetime.now()}')\n return is_succeeded\n\n" }, { "alpha_fraction": 0.5424912571907043, "alphanum_fraction": 0.5436553955078125, "avg_line_length": 28.586206436157227, "blob_id": "d640e88391faf225753689e2aa9e974e09d50945", "content_id": "edebf9ecdd510bed5e2377fc0457afca1c7686ae", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 859, "license_type": "permissive", "max_line_length": 63, "num_lines": 29, "path": "/tests/datatypes/test_formatmode.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nFormatMode Enum class test\n==========================\n'''\n\nimport unittest\nfrom tests.testutils import print_testtitle, validate_with_fail\nfrom builder.datatypes import formatmode as fm\n\n\nclass FormatModeTest(unittest.TestCase):\n\n @classmethod\n def setUpClass(cls):\n print_testtitle(fm.__name__, 'FormatMode Enum class')\n\n def test_conv_to_mode(self):\n data = [\n # (mode, expect)\n (True, 'w', fm.FormatMode.WEB),\n (True, 's', fm.FormatMode.SMARTPHONE),\n (True, 'p', fm.FormatMode.PLAIN),\n (True, 'n', fm.FormatMode.DEFAULT),\n ]\n validate_with_fail(self, 'conv_to_mode',\n lambda mode, expect: self.assertEqual(\n fm.FormatMode.conv_to_mode(mode), expect),\n data)\n\n" }, { "alpha_fraction": 0.5509328842163086, "alphanum_fraction": 0.5555223226547241, "avg_line_length": 37.84496307373047, "blob_id": "61ed06dd11ca8979e40e5eae8c853e0dc6e37037", "content_id": "535bb497032bf64be0b3e22e5e43a48a8bdef4e7", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 10027, "license_type": "permissive", "max_line_length": 113, "num_lines": 258, "path": "/builder/tools/counter.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nCounter Object\n==============\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('Counter',)\n\n\nfrom typing import Any\nfrom builder.commands.scode import SCode, SCmd\nfrom builder.containers.chapter import Chapter\nfrom builder.containers.episode import Episode\nfrom builder.containers.material import Material\nfrom builder.containers.scene import Scene\nfrom builder.containers.story import Story\nfrom builder.tools.checker import Checker\nfrom builder.tools.converter import Converter\nfrom builder.utils import assertion\nfrom builder.utils.logger import MyLogger\nfrom builder.utils.util_math import int_ceil\n\n\n# alias\nContainerLike = (Story, Chapter, Episode, Scene, SCode, Material, list, tuple)\n\n# logger\nLOG = MyLogger.get_logger(__name__)\nLOG.set_file_handler()\n\n\nclass Counter(object):\n ''' Counter Object class.\n '''\n\n #\n # methods (container numbers)\n #\n\n def chapters_of(self, src: ContainerLike) -> int:\n if isinstance(src, Story):\n return len([child for child in src.children if isinstance(child, Chapter)])\n elif isinstance(src, Chapter):\n return 1\n elif isinstance(src, (Episode, Scene, SCode)):\n return 0\n elif isinstance(src, Material):\n return 0\n elif isinstance(src, (list, tuple)):\n return sum([self.chapters_of(child) for child in src])\n else:\n LOG.error(f'Invalid source in chapters_of: {type(src)}: {src}')\n return 0\n\n def episodes_of(self, src: ContainerLike) -> int:\n if isinstance(src, Story):\n return sum([self.episodes_of(child) for child in src.children])\n elif isinstance(src, Chapter):\n return len([child for child in src.children if isinstance(child, Episode)])\n elif isinstance(src, Episode):\n return 1\n elif isinstance(src, (Scene, SCode)):\n return 0\n elif isinstance(src, Material):\n return 0\n elif isinstance(src, (list, tuple)):\n return sum([self.episodes_of(child) for child in src])\n else:\n LOG.error(f'Invalid source in episodes_of: {type(src)}: {src}')\n return 0\n\n def scenes_of(self, src: ContainerLike) -> int:\n if isinstance(src, (Story, Chapter)):\n return sum([self.scenes_of(child) for child in src.children])\n elif isinstance(src, Episode):\n return len([child for child in src.children if isinstance(child, Scene)])\n elif isinstance(src, Scene):\n return 1\n elif isinstance(src, SCode):\n return 0\n elif isinstance(src, Material):\n return 0\n elif isinstance(src, (list, tuple)):\n return sum([self.scenes_of(child) for child in src])\n else:\n LOG.error(f'Invalid source in scenes_of: {type(src)}: {src}')\n return 0\n\n def scodes_of(self, src: ContainerLike) -> int:\n if isinstance(src, (Story, Chapter, Episode)):\n return sum([self.scodes_of(child) for child in src.children])\n elif isinstance(src, Scene):\n return len([child for child in src.children if isinstance(child, SCode)])\n elif isinstance(src, SCode):\n return 1\n elif isinstance(src, Material):\n return 0\n elif isinstance(src, (list, tuple)):\n return sum([self.scodes_of(child) for child in src])\n else:\n LOG.error(f'Invalid source in scodes_of: {type(src)}: {src}')\n return 0\n\n def scodes_of_without_info(self, src: ContainerLike) -> int:\n def _validate_scode(val: SCode):\n return not val.cmd in SCmd.get_informations()\n if isinstance(src, (Story, Chapter, Episode)):\n return sum([self.scodes_of_without_info(child) for child in src.children])\n elif isinstance(src, Scene):\n return len([child for child in src.children if isinstance(child, SCode) and _validate_scode(child)])\n elif isinstance(src, SCode):\n return 1 if _validate_scode(src) else 0\n elif isinstance(src, Material):\n return 0\n elif isinstance(src, (list, tuple)):\n return sum([self.scodes_of_without_info(child) for child in src])\n else:\n LOG.error(f'Invalid source in scodes_of_without_info: {type(src)}: {src}')\n return 0\n\n #\n # methods (character numbers)\n #\n\n def description_characters_of(self, src: ContainerLike) -> int:\n def _validate_scode(val: SCode):\n return val.cmd in SCmd.get_all_actions()\n def _correct(val: SCode):\n if val.cmd in SCmd.get_dialogue_actions():\n return 2\n elif val.cmd in SCmd.get_normal_actions():\n return 1\n else:\n return 0\n if isinstance(src, (Story, Chapter, Episode, Scene)):\n return sum([self.description_characters_of(child) for child in src.children])\n elif isinstance(src, SCode):\n conv = Converter()\n if _validate_scode(src):\n tmp = len(\"。\".join(conv.script_relieved_symbols(src.script)))\n return tmp + _correct(src) if tmp else tmp\n elif src.cmd is SCmd.TAG_SYMBOL:\n return 1\n else:\n return 0\n elif isinstance(src, Material):\n return 0\n elif isinstance(src, (list, tuple)):\n return sum([self.description_characters_of(child) for child in src])\n else:\n LOG.error(f'Invalid source in description_characters_of: {type(src)}: {src}')\n return 0\n\n def total_characters_of(self, src: ContainerLike,\n is_contain_material: bool=False) -> int:\n if isinstance(src, (Story, Chapter, Episode, Scene)):\n return sum([self.total_characters_of(child) for child in src.children])\n elif isinstance(src, SCode):\n return len(\"。\".join(Converter().script_relieved_strings(src.script)))\n elif isinstance(src, Material):\n return sum([self.total_characters_of(child) for child in src.children]) if is_contain_material else 0\n elif isinstance(src, (list, tuple)):\n return sum([self.total_characters_of(child) for child in src])\n else:\n LOG.error(f'Invalid source in total_characters_of: {type(src)}: {src}')\n\n #\n # methods (manupapers)\n #\n\n def manupaper_numbers_of(self, lines: int, rows: int) -> float:\n ''' Count manupaper numbers, using manupaper line numbers.\n '''\n return lines / rows if rows else 0\n\n def manupaper_rows_of(self, src: ContainerLike,\n columns: int, is_contain_plot: bool=False) -> int:\n if isinstance(src, (Story, Chapter, Episode)):\n return sum(self.manupaper_rows_of(child, columns) for child in src.children)\n elif isinstance(src, Scene):\n checker = Checker()\n ret = []\n tmp = 0\n for child in src.children:\n if assertion.is_instance(child, SCode).cmd in SCmd.get_all_actions():\n if checker.is_empty_script(child, is_contain_plot):\n if tmp:\n ret.append(int_ceil(tmp, columns))\n tmp = 0\n continue\n if is_contain_plot:\n tmp += self.total_characters_of(child)\n else:\n tmp += self.description_characters_of(child)\n elif child.cmd in SCmd.get_end_of_containers():\n continue\n elif child.cmd in SCmd.get_informations():\n continue\n elif child.cmd in SCmd.get_scene_controls():\n continue\n elif child.cmd in SCmd.get_plot_infos():\n if is_contain_plot:\n tmp += self.total_characters_of(child)\n elif child.cmd in SCmd.get_tags():\n if child.cmd is SCmd.TAG_BR:\n tmp = 1\n elif child.cmd is SCmd.TAG_SYMBOL:\n tmp = 2\n else:\n tmp = 0\n if not checker.has_then(child):\n ret.append(int_ceil(tmp, columns))\n tmp = 0\n if tmp:\n ret.append(int_ceil(tmp, columns))\n return sum(ret)\n elif isinstance(src, SCode):\n # actions\n if assertion.is_instance(src, SCode).cmd in SCmd.get_all_actions():\n chars = self.total_characters_of(src) if is_contain_plot else self.description_characters_of(src)\n return int_ceil(chars + 2, columns)\n # then\n elif src.cmd is SCmd.THEN:\n return 0\n # container break\n elif src.cmd in SCmd.get_end_of_containers():\n return 0\n # tag\n elif src.cmd in SCmd.get_tags():\n if src.cmd is SCmd.TAG_BR:\n return 1\n elif src.cmd is SCmd.TAG_SYMBOL:\n return 2\n else:\n return 0\n # info\n elif src.cmd in SCmd.get_informations():\n return 0\n # scene control\n elif src.cmd in SCmd.get_scene_controls():\n return 0\n # plot control\n elif src.cmd in SCmd.get_plot_infos():\n return int_ceil(self.total_characters_of(src), columns)\n else:\n msg = f'Invalid SCmd: {code.cmd}'\n LOG.critical(msg)\n return 0\n elif isinstance(src, Material):\n return 0\n elif isinstance(src, (list, tuple)):\n return sum(self.manupaper_rows_of(child, columns) for child in src)\n else:\n msg = 'Error'\n LOG.critical(msg)\n return 0\n\n" }, { "alpha_fraction": 0.49786242842674255, "alphanum_fraction": 0.5089389681816101, "avg_line_length": 32.85197448730469, "blob_id": "7d1da276f4b90fb575b09ed8fa87ebaa631da752", "content_id": "e17186af1b1d309a2ceb4977978603144280ff1c", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 14954, "license_type": "permissive", "max_line_length": 78, "num_lines": 304, "path": "/examples/momotaro/main.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nSample Story #001: Momotaro\n'''\n\nimport os\nimport sys\nsys.path.append(os.path.join(os.path.dirname(__file__), '../..'))\nsys.path.append('builder')\nfrom builder.world import World\nfrom assets import basic\nfrom assets import common_rubi\n\n\n# DB\nPERSONS = [\n # (tag / name / full / age / birth / sex / job / calling / info)\n ('taro', '桃太郎', '', 15,(4,10), 'm', '村人', 'me:私'),\n ('mam', '絹江', '', 60,(1,1), 'f', '農家', 'me:わたし'),\n ('dad', '源三', '', 67,(1,1), 'm', '農家', 'me:わし'),\n ('dog', '犬', '', 10,(1,1), 'm', '動物'),\n ('monkey', '猿', '', 10,(1,1), 'm', '動物'),\n ('bird', '雉', '', 10,(1,1), 'm', '動物'),\n ('oni', '鬼', '', 30,(1,1), 'm', '鬼'),\n ]\nSTAGES = [\n # (tag / name / parent / geometry / info)\n ('Vila', '太郎の村', '', (100,100)),\n ('home', '太郎の家', 'on_Vila'),\n ('river', '村近くの川', '', (150,100)),\n ('field', '街道', '', (50,50)),\n ('Island', '鬼ヶ島', '', (500,50)),\n ('ship', '船', '', (200,50)),\n ]\nDAYS = [\n # (tag / name / month / day / year)\n ('birthtaro', '桃太郎誕生', 4,10, 100),\n ('know_oni', '鬼の悪事を知る', 5,10, 103),\n ('start_voyage', '鬼退治出発', 5,20, 103),\n ('buster_oni', '鬼退治', 6,10, 103),\n ]\nTIMES = [\n # (tag / name / hour / minute)\n ('morning', '朝', 8,00),\n ('noon', '昼', 12,00),\n ('afternoon', '午後', 14,00),\n ('night', '夜', 20,00),\n ]\nITEMS = [\n # (tag / name / category / info)\n ('dango', '吉備団子', 'food'),\n ('katana', '刀', 'weapon'),\n ]\nWORDS = [\n # (tag / name / info)\n (\"dogrun\", \"犬走り\"),\n (\"memo\", \"手帳\"),\n ]\nRUBIS = [\n # (origin / rubi / exclusions / always)\n (\"桃太郎\", \"|桃太郎《ももたろう》\"),\n ]\n\n## scenes\n# NOTE:\n# create each scenes\ndef sc_get_peach(w: World):\n mam = w.get('mam')\n return w.scene(\"桃を拾う\",\n w.comment(\"序盤。おばあさんが桃を拾う\"),\n w.cmd.change_camera('mam'),\n w.cmd.change_stage('on_river'),\n \"これは桃太郎の物語だ\",\n w.plot_setup(\"昔、おじいさんとおばあさんがいた\", \"二人には子どもがない\"),\n mam.be(\"あるところにおじいさんとおばあさんがいました\", \"&\"),\n mam.explain(\"おじいさんは山へ芝刈りに、おばあさんは川へ洗濯に出かけました\"),\n mam.wear(\"渋染の着物にほつれた草履\", \"ぼさぼさの白髪\"),\n mam.wear(\"目は小豆のよう\"),\n mam.wear(\"肌はシミが目立つ\"),\n mam.come(\"洗濯物を籠に入れ、河原にやってきた$Sでしたが、\", \"&\"),\n mam.do(\"川の上流からどんぶらこと大きな桃が流れてくるのを見つけました。それを見て思います\"),\n mam.do(\"じっと立って桃を見つめて\"),\n w.motif(\"桃\", \"大きな桃\"),\n mam.talk(\"あれまあ、なんて大きな桃なんでしょう\"),\n mam.think(\"おじいさんが好きそうだと思った\", \"&\"),\n mam.think(\"拾って帰って、おじいさんと一緒に食べようかしらね\", \"#桃をゲット\"),\n w.foreshadow(\"桃を拾う\"),\n mam.do(\"そう考え、何とか木の棒を使ってこちらに引き寄せ、ひと抱えもある桃を手に入れました\"),\n mam.do(\"$memoを手にして、それを忘れないように書き込んでおいた\"),\n mam.go(\"それを籠に入れ、家に帰りました\"),\n )\n\ndef sc_birth_taro(w: World):\n mam, dad = w.get('mam'), w.get('dad')\n taro = w.get('taro')\n return w.scene(\"誕生\",\n w.br(),\n w.cmd.change_stage('on_home'),\n \"部屋の様子を少し書いておく\",\n mam.be(\"#居間に座っていた\"),\n dad.be(),\n mam.talk(\"おじいさん見ておくれよ、この大きな桃\"),\n dad.talk(\"ありゃまあ、なんてぇ大きな桃だよ\",\n \"早速$meが切ってやろう\"),\n dad.do(\"ナタを手にした$Sは大きく振り上げると、一気に桃に向かってブスリ、とやりました\"),\n taro.be(\"#$S誕生する\", \"桃はパカーと真っ二つに割れて、中から玉のような赤子が出てきました\"),\n w.payoff(\"桃から桃太郎が誕生\"),\n mam.wear(\"たすき掛け\"),\n mam.talk(\"おじいさん、こりゃあ人の子だ!? なんてことだ!\"),\n mam.talk(\"子どもがいない$meに神様が授けて下さったんだよぉ\"),\n dad.talk(\"よし!\", \"$taroと名付けよう\",\n \"今日からお前は$taroだ\"),\n taro.explain(\"こうして$Sは生まれました\"),\n w.comment(\"桃太郎誕生\"),\n )\n\ndef sc_voyage(w: World):\n taro = w.get('taro')\n mam, dad = w.get('mam'), w.get('dad')\n dango = w.get('dango')\n return w.scene(\"旅立ち\",\n w.symbol(\"    ◆\"),\n w.cmd.change_camera('taro'),\n w.cmd.change_date('start_voyage'),\n w.cmd.change_time('morning'),\n taro.be(),\n taro.explain(\"$Sはすくすくと育ち、あっという間に大きく逞しく成長しました\"),\n taro.do(\"ある日、村人から鬼の悪行を聞いた$Sは考えました\"),\n w.plot_turnpoint(\"鬼の話を聞く\"),\n w.plot_develop(\"$taroは鬼退治に出発する\"),\n taro.think(\"――何とか鬼を退治して村に恩返しがしたい\"),\n taro.explain(\"そこでおじいさんとおばあさんを前にして、鬼退治をしたいと言い出したのです\"),\n mam.be(),\n dad.be(),\n mam.look(\"#神妙な顔で座っている\"),\n mam.talk(\"どうしても行くというのかい?\"),\n taro.talk(\"$meの決意は固いです\", \"何よりここまで育ててくれたあなたたちや村の人たちに恩返しがしたい\"),\n dad.talk(\"ばあさんや、男の子というのはいつか自分のやることを見つけて旅立つものだ\",\n \"行かせてやろうじゃないか\"),\n dad.do(\"そう言うと$Sは$katanaを持ってきて、$taroに渡します\"),\n dad.talk(\"これをお持ちなさい\", '&'),\n dad.talk(\"かつて鬼を切ったと言われる名刀だ\"),\n taro.talk(\"こんな大切なものを\", \"$meは絶対に鬼をやっつけてきます\"),\n mam.talk(\"それじゃあ$meは、\", \"$dangoでも作ろうかね\"),\n taro.talk(\"ありがとうございます\"),\n mam.do(\"団子を作って\"),\n taro.do(\"おばあさんからは$dangoを貰った\"),\n dango.wear(\"きな粉がまぶされ、美味しそうだ\"),\n taro.explain(\"こうして$Sは翌朝早くに旅立っていきました\"),\n w.comment(\"鬼退治\"),\n taro.go(),\n )\n\ndef sc_ally(w: World):\n taro = w.get('taro')\n dog, monkey, bird = w.get('dog'), w.get('monkey'), w.get('bird')\n return w.scene(\"家来\",\n w.plot_develop(\"$taroは道中で家来を得る\"),\n w.tag.title('家来その1'),\n w.cmd.change_stage('field'),\n taro.come('$Sが道を歩いていると、', '&'),\n w.plot_setup(\"犬が歩いてきた\", about=\"犬の家来\"),\n dog.come('向こうから$Sが歩いてきた'),\n dog.look('その$Sはなんともひどい有様で、そのうちに道端に倒れてしまった'),\n taro.talk('大丈夫ですか?'),\n dog.talk('お腹をすかせてしまって'),\n taro.talk('それならこれを食べて下さい'),\n taro.do('$dangoを一つあげました'),\n dog.talk(\"助かりました\", \"ところで$taroさんはどこに行くのですか?\"),\n taro.talk(\"鬼を退治しに行くところなんだ\"),\n dog.talk(\"それなら$meがお供しましょう\", \"鬼はこの牙が苦手と言います\"),\n taro.explain(\"こうして犬は$Sの家来となりました\"),\n taro.do(\"犬が$dogrunを走り回っているのを見ていた\"),\n w.br(),\n w.tag.title('家来その2'),\n taro.hear(\"誰かの話しかける声\"),\n taro.do(\"またしばらく歩いていきます。今度は猿が木の上から話しかけます\"),\n monkey.be(\"#木の上に\"),\n monkey.talk(\"おい、なんか美味そうなもん持ってるな\"),\n taro.talk(\"ああ、これか\", \"おばあさんが作ってくれた$dangoだ\"),\n monkey.talk(\"一つ$meにくれねえか?\"),\n taro.talk(\"いいけれども、ただでという訳にはいかないな\"),\n taro.do(\"$Sが猿を見て渋ると、猿はこう返しました\"),\n monkey.talk(\"それなら何でも一つ言うことを聞いてやろう\",\n \"$meは力こそないが、知恵はよく働く\",\n \"悪評高い鬼のやつらにだって知恵比べなら負けはしねえ\"),\n taro.talk(\"それなら$meと一緒に鬼退治に来てくれませんか?\"),\n monkey.do(\"二つ返事で頷くと、$Sは$dangoを貰って一気に口に放り込んだ\"),\n taro.explain(\"こうして犬に続き猿も家来にした$Sだったが、その行く手を阻むように川が横たわっていた\"),\n w.br(),\n w.tag.title('家来その3'),\n taro.talk(\"困ったなあ\"),\n bird.come(\"そこに$Sが優雅に翼を広げてやってくる\"),\n bird.talk(\"おや、噂の$taroさんじゃありませんか\", \"どうかされましたか?\"),\n taro.talk(\"いや、実は川が渡れずに困っていたんだ\"),\n bird.talk(\"それなら$meが仲間たちを呼んで渡してあげましょう\"),\n bird.do(\"そう言うと$Sはピーと鳴き、仲間を沢山集め、$taroたちを向こう岸へと運んでくれた\"),\n taro.do(\"$Sはお礼にと$dangoを渡したが、$birdは鬼退治に行くという話を聞き、一緒に行ってくれることになった\"),\n taro.explain(\"$Sは家来として犬、猿、雉とそれぞれ引き連れ、$on_Islandを目指しました\"),\n w.br(),\n w.tag.title('船で渡る'),\n taro.explain('$Sたちは船で$Islandに渡りました'),\n )\n\ndef sc_island(w: World):\n taro = w.get('taro')\n oni = w.get('oni')\n return w.scene(\"$on_Island\",\n w.cmd.change_stage('on_Island'),\n w.plot_resolve(\"$taroは鬼退治をした\"),\n w.comment(\"$taroは鬼退治をする\"),\n taro.come(\"$Sは家来と共に$on_Islandへとやってきた\"),\n oni.be(\"酒とご馳走で祝勝会をしている\"),\n taro.talk(\"やい!\", \"村の人たちから奪った宝物は返してもらうぞ\"),\n oni.talk(\"うるさいわ。一体何だというんだ?\"),\n taro.talk(\"$meは$taroだ。お前らを成敗する!\"),\n taro.do(\"$Sは家来と共にその場にいた鬼たちをあっという間に組み伏せた\"),\n oni.talk(\"参りました。どうか、命だけは……\"),\n taro.talk(\"もうこれ以上村の人に悪さをするんじゃないぞ?\", \"いいな?\"),\n taro.explain(\"こうして鬼たちから宝物を巻き上げ、村に持ち帰りました\"),\n )\n\n# episodes\ndef ep_birth_momotaro(w: World):\n return w.episode(\"$taro誕生\",\n w.plot_note(\"桃太郎が誕生するところ\"),\n sc_get_peach(w),\n sc_birth_taro(w),\n outline=\"流れてきた大きな桃には赤子($taro)が入っていた\",\n )\n\ndef ep_ally(w: World):\n return w.episode(\"味方\",\n w.plot_note(\"鬼退治の旅に出る桃太郎\"),\n w.plot_note(\"行く先々で仲間を手に入れ、いざ鬼ヶ島に向かう\"),\n sc_voyage(w),\n sc_ally(w),\n outline='鬼退治の旅に出た$taroは道中で仲間を得る')\n\ndef ep_buster_daemon(w: World):\n return w.episode(\"$oni退治\",\n w.plot_note(\"鬼退治を行う桃太郎\"),\n w.plot_note(\"奪われた宝物を村へと持ち帰る\"),\n sc_island(w),\n outline=\"鬼ヶ島にやってきた$taroは鬼退治をし、村に宝物を持って帰った\",\n )\n\n# main\ndef writernote(w: World):\n return w.writer_note('企画意図',\n \"これはサンプルとして「桃太郎」を使って説明するものである\",\n \"作品についての企画意図や、企画の方向性、応募要項などをここにまとめておく\",\n )\n\ndef ch_1st(w: World):\n return w.chapter(\"前半\",\n ep_birth_momotaro(w),\n )\n\ndef ch_2nd(w: World):\n return w.chapter(\"後半\",\n ep_ally(w),\n )\n\ndef ch_ending(w: World):\n return w.chapter(\"エピローグ\",\n ep_buster_daemon(w),\n )\n\ndef chara_momotaro(w: World):\n return w.chara_note('$taroの履歴書',\n \"おばあさんの手により川を流れていた桃が拾われ、その中から生まれた異端児\",\n \"通常の人間よりも早くに大きく育ち、怪力と誠実さ、正義感を備えていた\",\n \"ある時、村の人から鬼が宝物を奪っていった話を聞き、鬼退治を決意するのだった\",\n )\n\ndef main(): # pragma: no cover\n w = World.create_world('桃太郎')\n w.config.set_outline('桃から生まれた$taroが鬼退治をする')\n w.db.set_from_asset(basic.ASSET)\n w.db.set_persons(PERSONS)\n w.db.set_stages(STAGES)\n w.db.set_days(DAYS)\n w.db.set_times(TIMES)\n w.db.set_items(ITEMS)\n w.db.set_words(WORDS)\n w.db.set_rubis(RUBIS)\n w.db.set_from_asset(common_rubi.ASSET)\n w.config.set_base_date(4,10, 100)\n w.config.set_base_time(8,00)\n w.config.set_sites(\"エブリスタ\", \"小説家になろう\")\n w.config.set_taginfos('昔話', \"男主人公\", \"動物\", \"ファンタジィ\")\n return w.run(\n writernote(w),\n ch_1st(w),\n ch_2nd(w),\n ch_ending(w),\n chara_momotaro(w),\n )\n\n\nif __name__ == '__main__':\n import sys\n sys.exit(main())\n\n" }, { "alpha_fraction": 0.6230672001838684, "alphanum_fraction": 0.6233206391334534, "avg_line_length": 32.71794891357422, "blob_id": "f3a5f609e156f29399e02df6dc6fd60531cdfc2a", "content_id": "9281205ee59513b00215f32a4a0ba91b86fc5c1f", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3945, "license_type": "permissive", "max_line_length": 90, "num_lines": 117, "path": "/analyzer/analyzer.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nAnalyzer Object\n===============\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('Analyzer',)\n\nimport os\nfrom analyzer.core.frequency_analyzer import FrequencyAnalyzer\nfrom analyzer.core.percent_analyzer import PercentAnalyzer\nfrom analyzer.core.tokenizer import Tokenizer\nfrom analyzer.core.word_analyzer import WordAnalyzer\nfrom analyzer.datatypes.analyzerexception import AnalyzerError\nfrom analyzer.datatypes.tokenlist import TokenList\nfrom builder.core.executer import Executer\nfrom builder.core.outputter import Outputter\nfrom builder.datatypes.outputmode import OutputMode\nfrom builder.datatypes.rawdata import RawData\nfrom builder.datatypes.resultdata import ResultData\nfrom builder.datatypes.textlist import TextList\nfrom builder.utils import assertion\nfrom builder.utils.util_file import get_content_from_text_file\nfrom builder.utils.logger import MyLogger\n\n\n# logger\nLOG = MyLogger.get_logger(__name__)\nLOG.set_file_handler()\n\n\nclass Analyzer(Executer):\n ''' Analyzer object.\n '''\n def __init__(self):\n super().__init__()\n LOG.info('ANALYZER: initialize')\n\n def execute(self, src: (str, list, TextList),\n person_names: list,\n is_debug: bool=False) -> ResultData: # pragma: no cover\n LOG.info('ANALYZER: start exec')\n is_succeeded = True\n error = None\n basesrc = None\n result = ResultData([], is_succeeded, error)\n\n if isinstance(src, str):\n basesrc = TextList(*get_content_from_text_file(src))\n elif isinstance(src, TextList):\n basesrc = src\n elif isinstance(src, (list, tuple)):\n basesrc = TextList(*src)\n else:\n msg = f'Invalid analyze source!: {src}'\n LOG.critical(msg)\n return ResultData(result, False, AnalyzerError(msg))\n\n tmp = self._rid_tag(basesrc)\n\n LOG.info('TOKENIZER: call')\n result = assertion.is_instance(Tokenizer().execute(tmp, person_names), ResultData)\n if not result.is_succeeded:\n return result\n tokens = assertion.is_instance(result.data, TokenList)\n\n LOG.info('WORD_ANALYZER: call')\n result = assertion.is_instance(WordAnalyzer().execute(tokens), ResultData)\n if not result.is_succeeded:\n return result\n word_data = assertion.is_listlike(result.data)\n\n LOG.info('PERCENT_ANALYZER: call')\n result = assertion.is_instance(PercentAnalyzer().execute(tmp), ResultData)\n if not result.is_succeeded:\n return result\n percent_data = assertion.is_listlike(result.data)\n\n LOG.info('FREQUENCY_ANALYZER: call')\n result = assertion.is_instance(FrequencyAnalyzer().execute(tokens), ResultData)\n if not result.is_succeeded:\n return result\n freq_data = assertion.is_listlike(result.data)\n\n LOG.info('Analyzer result output')\n result_data = percent_data + ['\\n---\\n'] \\\n + word_data + ['\\n---\\n'] \\\n + freq_data\n fname = 'result'\n suffix = ''\n extention = 'md'\n builddir = 'build/results'\n mode = OutputMode.CONSOLE if is_debug else OutputMode.FILE\n data = TextList(*[f'{line}\\n' for line in result_data])\n Outputter().execute(data, mode, fname, suffix, extention, builddir)\n return result\n\n #\n # private\n #\n\n def _rid_tag(self, src: TextList) -> TextList:\n LOG.info('ANALYZER: rid tags start')\n tmp = []\n for line in assertion.is_instance(src, TextList).data:\n assertion.is_str(line)\n if line.startswith('#') or line.startswith('\\n#'):\n continue\n elif line.startswith('---') or line.startswith('\\n---'):\n continue\n elif line in ('\\n', '\\n\\n'):\n continue\n else:\n tmp.append(line)\n return TextList(*tmp)\n" }, { "alpha_fraction": 0.5714568495750427, "alphanum_fraction": 0.5730403661727905, "avg_line_length": 33.128379821777344, "blob_id": "b51dacaf99c53de846cc9c7dc9cebfa0960cd985", "content_id": "3644c480297d638133a665f6a4a8813f2d0c3379", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 5052, "license_type": "permissive", "max_line_length": 110, "num_lines": 148, "path": "/builder/core/serializer.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nSerializer Object\n=================\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('Reducer',)\n\n\nfrom itertools import chain\nfrom builder.commands.scode import SCode\nfrom builder.containers.chapter import Chapter\nfrom builder.containers.episode import Episode\nfrom builder.containers.material import Material\nfrom builder.containers.scene import Scene\nfrom builder.containers.story import Story\nfrom builder.core.executer import Executer\nfrom builder.datatypes.builderexception import BuilderError\nfrom builder.datatypes.codelist import CodeList\nfrom builder.datatypes.compilemode import CompileMode\nfrom builder.datatypes.resultdata import ResultData\nfrom builder.utils import assertion\nfrom builder.utils.logger import MyLogger\n\n\n# alias\nContainerLike = (Story, Chapter, Episode, Scene, SCode, Material)\n\n\n# logger\nLOG = MyLogger.get_logger(__name__)\nLOG.set_file_handler()\n\n\nclass SerializerError(BuilderError):\n ''' General Serializer Error.\n '''\n pass\n\n\nclass Serializer(Executer):\n ''' Serializer Executer class.\n '''\n def __init__(self):\n super().__init__()\n LOG.info('SERIALIZER: initialize')\n\n #\n # methods\n #\n\n def execute(self, src: Story, mode: CompileMode) -> ResultData:\n LOG.info('SERIALIZER: start exec')\n is_succeeded = True\n tmp = CodeList(*self._exec_internal(src, mode))\n error = None\n return ResultData(\n tmp,\n is_succeeded,\n error)\n\n #\n # private methods\n #\n\n def _exec_internal(self, src: Story, mode: CompileMode) -> list:\n ret = []\n assertion.is_instance(src, Story)\n if assertion.is_instance(mode, CompileMode) in (CompileMode.NORMAL, CompileMode.NOVEL_TEXT):\n ret = self._novel_serialized(src)\n elif mode is CompileMode.PLOT:\n ret = self._plot_serialized(src)\n elif mode is CompileMode.STORY_DATA:\n ret = self._storydata_serialized(src)\n elif mode is CompileMode.SCENARIO:\n ret = []\n elif mode is CompileMode.AUDIODRAMA:\n ret = []\n else:\n LOG.error(f'Invalid story object![1]: {type(child)}: {child}')\n return ret\n\n def _novel_serialized(self, src: ContainerLike) -> list:\n ''' NOTE: omit Material parts.\n '''\n if isinstance(src, (Story, Chapter, Episode, Scene)):\n tmp = []\n for child in assertion.is_various_types(src, (Story, Chapter, Episode, Scene, Material)).children:\n if isinstance(child, (Story, Chapter, Episode)):\n tmp.append(self._novel_serialized(child))\n elif isinstance(child, Scene):\n tmp.append(child.children)\n elif isinstance(child, SCode):\n tmp.append([child])\n elif isinstance(child, Material):\n continue\n else:\n LOG.error(f'Invalid story object![3]: {type(child)}: {child}')\n return list(chain.from_iterable(tmp))\n elif isinstance(src, SCode):\n return [src]\n elif isinstance(src, Material):\n return []\n else:\n LOG.error(f'Invalid story object![2]: {type(src)}: {src}')\n return []\n\n def _plot_serialized(self, src: ContainerLike) -> list:\n if isinstance(src, (Story, Chapter, Episode, Scene, Material)):\n tmp = []\n for child in src.children:\n if isinstance(child, (Story, Chapter, Episode)):\n tmp.append(self._plot_serialized(child))\n elif isinstance(child, Scene):\n tmp.append(child.children)\n elif isinstance(child, SCode):\n tmp.append([child])\n elif isinstance(child, Material):\n tmp.append(child.children)\n else:\n LOG.error(f'Invalid story object![4]: {type(child)}: {child}')\n return list(chain.from_iterable(tmp))\n elif isinstance(src, SCode):\n return [src]\n else:\n LOG.error(f'Invalid story object![5]: {type(src)}: {src}')\n return []\n\n def _storydata_serialized(self, src: ContainerLike) -> list:\n if isinstance(src, (Story, Chapter, Episode, Scene, Material)):\n tmp = []\n for child in src.children:\n if isinstance(child, Material):\n tmp.append(child.children)\n elif isinstance(child, (Story, Chapter, Episode, Scene)):\n continue\n elif isinstance(child, SCode):\n tmp.append([child])\n else:\n LOG.error(f'Invalid story object![6]: {type(child)}: {child}')\n return list(chain.from_iterable(tmp))\n elif isinstance(src, SCode):\n return [src]\n else:\n LOG.error(f'Invalid story object![7]: {type(child)}: {child}')\n return []\n\n" }, { "alpha_fraction": 0.6080247163772583, "alphanum_fraction": 0.6111111044883728, "avg_line_length": 17, "blob_id": "425f69badb90b8d2a7298e1003d1ba2a55914022", "content_id": "b388ee10d66715139fd0f6ee9f0984b3191293e1", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 324, "license_type": "permissive", "max_line_length": 63, "num_lines": 18, "path": "/builder/utils/util_date.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nDatetime Utility methods\n========================\n'''\n\n__all__ = (\n 'get_date_lastmodified',\n )\n\n\nimport os\nimport datetime\nfrom builder.utils import assertion\n\n\ndef get_date_lastmodified(fname: str) -> datetime.date:\n return datetime.date.fromtimestamp(os.stat(fname).st_mtime)\n" }, { "alpha_fraction": 0.4813186824321747, "alphanum_fraction": 0.48241758346557617, "avg_line_length": 30.929824829101562, "blob_id": "1becf70e8ed1bea44dc82075b737aa4957acc455", "content_id": "afc31579dee9d485ceb9669aa4d950af2b0fed29", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1950, "license_type": "permissive", "max_line_length": 75, "num_lines": 57, "path": "/tests/tools/test_converter.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nConverter class test\n====================\n'''\n\nimport unittest\nfrom tests.testutils import print_testtitle, validate_with_fail\nfrom builder.tools import converter as cnv\n\n\nclass ConverterTest(unittest.TestCase):\n\n @classmethod\n def setUpClass(cls):\n print_testtitle(cnv.__name__, 'Converter class')\n\n def test_add_rubi(self):\n data = [\n # (src, key, rubi, num, expect)\n (True, '山田太郎', '太郎', '太郎《たろう》', 1, '山田太郎《たろう》'),\n ]\n validate_with_fail(self, 'add_rubi',\n lambda src, key, rubi, num, expect: self.assertEqual(\n cnv.Converter().add_rubi(src, key, rubi, num), expect),\n data)\n\n def test_to_description(self):\n data = [\n # (src, expect)\n (True, ['太郎は、', '天才だ'], '太郎は、天才だ。'),\n ]\n validate_with_fail(self, 'to_description',\n lambda src, expect: self.assertEqual(\n cnv.Converter().to_description(src), expect),\n data)\n\n def test_to_dialogue(self):\n data = [\n # (src, expect)\n (True, ['お前は、', 'どういうつもりだ?'],\n '「お前は、どういうつもりだ?」'),\n ]\n validate_with_fail(self, 'to_dialogue',\n lambda src, expect: self.assertEqual(\n cnv.Converter().to_dialogue(src), expect),\n data)\n\n def test_script_relieved_symbols(self):\n data = [\n # (src, expect)\n (True, ['a', '&'], ['a',]),\n ]\n validate_with_fail(self, 'script_relieved_symbols',\n lambda src, expect: self.assertEqual(\n cnv.Converter().script_relieved_symbols(src), expect),\n data)\n" }, { "alpha_fraction": 0.6087715029716492, "alphanum_fraction": 0.610515832901001, "avg_line_length": 31.09600067138672, "blob_id": "6418de7f11c5fd4b87a61efbf9c8f38b5157d457", "content_id": "b06fd60336d68d3c9727fe1d4fb05fb0e5718612", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 4013, "license_type": "permissive", "max_line_length": 90, "num_lines": 125, "path": "/builder/tools/collecter.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nCollecter Object\n================\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('Collecter',)\n\n\nfrom itertools import chain\nfrom typing import Any\nfrom builder.commands.scode import SCode, SCmd\nfrom builder.containers.chapter import Chapter\nfrom builder.containers.episode import Episode\nfrom builder.containers.material import Material\nfrom builder.containers.scene import Scene\nfrom builder.containers.story import Story\nfrom builder.objects.day import Day\nfrom builder.objects.person import Person\nfrom builder.objects.stage import Stage\nfrom builder.objects.time import Time\nfrom builder.utils import assertion\nfrom builder.utils.logger import MyLogger\n\n\n# alias\nContainerLike = (Story, Chapter, Episode, Scene, Material)\n\n\n# logger\nLOG = MyLogger.get_logger(__name__)\nLOG.set_file_handler()\n\n\nclass Collecter(object):\n ''' Collecter Object class.\n '''\n\n #\n # methods (containers)\n #\n\n def container_titles(self, src: ContainerLike) -> list:\n if not isinstance(src, ContainerLike):\n return []\n tmp = []\n tmp.append(f\"{self.get_container_level(src)}:{src.title}\")\n for child in src.children:\n if isinstance(child, (Chapter, Episode, Scene, Material)):\n tmp.extend(self.container_titles(child))\n return tmp\n\n def container_titles_without_material(self, src: ContainerLike) -> list:\n if not isinstance(src, ContainerLike):\n return []\n tmp = []\n tmp.append(f'{self.get_container_level(src)}:{src.title}')\n for child in src.children:\n if isinstance(child, (Chapter, Episode, Scene)):\n tmp.extend(self.container_titles_without_material(child))\n return tmp\n\n def container_titles_only_materials(self, src: ContainerLike) -> list:\n if not isinstance(src, ContainerLike):\n return []\n tmp = []\n if isinstance(src, (Story, Material)):\n tmp.append(f'{self.get_container_level(src)}:{src.title}')\n for child in src.children:\n if isinstance(child, (Chapter, Episode, Scene, Material)):\n tmp.extend(self.container_titles_only_materials(child))\n return tmp\n\n def get_container_level(self, src: (Story, Chapter, Episode, Scene, Material)) -> int:\n if isinstance(src, Story):\n return 0\n elif isinstance(src, Chapter):\n return 1\n elif isinstance(src, Episode):\n return 2\n elif isinstance(src, Scene):\n return 3\n elif isinstance(src, Material):\n return 1\n else:\n LOG.error(f'Invalid source (story container): {src}')\n return 9\n\n #\n # scene info\n #\n\n def cameras_in_scene(self, src: Scene) -> list:\n tmp = []\n for child in assertion.is_instance(src, Scene).children:\n if isinstance(child, SCode):\n if child.cmd is SCmd.CHANGE_CAMEARA:\n tmp.append(assertion.is_instance(child.src, Person))\n return tmp\n\n def stages_in_scene(self, src: Scene) -> list:\n tmp = []\n for child in assertion.is_instance(src, Scene).children:\n if isinstance(child, SCode):\n if child.cmd is SCmd.CHANGE_STAGE:\n tmp.append(assertion.is_instance(child.src, Stage))\n return tmp\n\n def days_in_scene(self, src: Scene) -> list:\n tmp = []\n for child in assertion.is_instance(src, Scene).children:\n if isinstance(child, SCode):\n if child.cmd is SCmd.CHANGE_DATE:\n tmp.append(assertion.is_instance(child.src, Day))\n return tmp\n\n def times_in_scene(self, src: Scene) -> list:\n tmp = []\n for child in assertion.is_instance(src, Scene).children:\n if isinstance(child, SCode):\n if child.cmd is SCmd.CHANGE_TIME:\n tmp.append(assertion.is_instance(child.src, Time))\n return tmp\n\n" }, { "alpha_fraction": 0.6584094166755676, "alphanum_fraction": 0.6597131490707397, "avg_line_length": 19.70270347595215, "blob_id": "f1f35bf1172f69a11c0b6ef9d05c83ab1de2353c", "content_id": "c3242a74c11e1fac5d4a10a269a9f66844a15f35", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 767, "license_type": "permissive", "max_line_length": 84, "num_lines": 37, "path": "/builder/datatypes/rawdata.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nRaw Data Object\n===============\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('RawData',)\n\n\nfrom typing import Tuple\nfrom builder.commands.scode import SCode\nfrom builder.datatypes.builderexception import BuilderError\nfrom builder.datatypes.formattag import FormatTag\nfrom builder.utils import assertion\nfrom builder.utils.logger import MyLogger\n\n\n# logger\nLOG = MyLogger.get_logger(__name__)\nLOG.set_file_handler()\n\n\nclass RawData(object):\n ''' Raw Data package object.\n '''\n def __init__(self, *args: (str, FormatTag)):\n self._data = tuple(assertion.is_instance(a, (str, FormatTag)) for a in args)\n\n #\n # property\n #\n\n @property\n def data(self) -> Tuple[(str, FormatTag)]:\n return self._data\n\n" }, { "alpha_fraction": 0.612456738948822, "alphanum_fraction": 0.6159169673919678, "avg_line_length": 15.941176414489746, "blob_id": "ebd1c734ce81038de7cd4474805ace8708029880", "content_id": "700a1c2e44e5fc74bf503663b711441598d92891", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 289, "license_type": "permissive", "max_line_length": 56, "num_lines": 17, "path": "/builder/datatypes/builderexception.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nBuilder Exception Object\n========================\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('BuilderException',)\n\n\nfrom builder.utils import assertion\n\n\nclass BuilderError(Exception):\n \"\"\"Base class for exceptions of the story builder\"\"\"\n pass\n\n" }, { "alpha_fraction": 0.5903463363647461, "alphanum_fraction": 0.5950116515159607, "avg_line_length": 27.579486846923828, "blob_id": "87582e62a1142f5aa23786e830cf3aea4ddb55fc", "content_id": "63f72448c946e87c97cd4e4a4036c57d7560cba7", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 11146, "license_type": "permissive", "max_line_length": 115, "num_lines": 390, "path": "/builder/datatypes/storyconfig.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nStory Config Object\n===================\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('StoryConfig',)\n\n\nimport datetime\nfrom builder import __PRIORITY_DEFAULT__, __PRIORITY_MAX__, __PRIORITY_MIN__\nfrom builder.datatypes.builderexception import BuilderError\nfrom builder.datatypes.formatmode import FormatMode\nfrom builder.datatypes.outputmode import OutputMode\nfrom builder.utils import assertion\nfrom builder.utils.logger import MyLogger\n\n\n# logger\nLOG = MyLogger.get_logger(__name__)\nLOG.set_file_handler()\n\n\nclass StoryConfigError(BuilderError):\n ''' General StoryConfig Error.\n '''\n pass\n\n\nclass StoryConfig(object):\n ''' Config object class for a story building.\n '''\n\n def __init__(self, title: str):\n LOG.info('CONFIG: initialize')\n LOG.debug(f'-- title: {title}')\n # for specific\n self._title = assertion.is_str(title)\n self._copy = assertion.is_str('__catch_copy__')\n self._oneline = assertion.is_str('__one_line__')\n self._outline = assertion.is_str('__story_outline__')\n self._theme = assertion.is_str('__theme__')\n self._genre = assertion.is_str('__genre__')\n self._target = assertion.is_str('__target_age__')\n self._size = assertion.is_str('__size__')\n self._desc_size = assertion.is_int(0)\n self._total_size = assertion.is_int(0)\n self._desc_papers = assertion.is_int_or_float(0)\n self._total_papers = assertion.is_int_or_float(0)\n # for story\n self._priority = assertion.is_int(__PRIORITY_DEFAULT__)\n self._start = assertion.is_int(0)\n self._end = assertion.is_int(-1)\n self._base_date = datetime.date(2020,1,1)\n self._base_time = datetime.time(12,00)\n self._version = assertion.is_tuple((0,0,1))\n self._columns = assertion.is_int(20)\n self._rows = assertion.is_int(20)\n self._contest_info = assertion.is_str('')\n self._caution = assertion.is_str('')\n self._note = assertion.is_str('')\n self._sites = assertion.is_listlike([])\n self._taginfos = assertion.is_listlike([])\n self._modified = datetime.date.today()\n self._released = datetime.date(2020,1,1)\n # for compile\n self._is_data = assertion.is_bool(False)\n self._is_plot = assertion.is_bool(False)\n self._is_text = assertion.is_bool(False)\n self._is_scenario = assertion.is_bool(False)\n self._is_audiodrama = assertion.is_bool(False)\n self._is_rubi = assertion.is_bool(False)\n self._is_comment = assertion.is_bool(False)\n self._is_console = assertion.is_bool(False)\n self._format_mode = assertion.is_instance(FormatMode.DEFAULT, FormatMode)\n self._output_mode = assertion.is_instance(OutputMode.FILE, OutputMode)\n self._filename = assertion.is_str('story')\n self._builddir = assertion.is_str('build')\n self._log_level = assertion.is_str('warn')\n\n #\n # property (specific)\n #\n\n @property\n def title(self) -> str:\n return self._title\n\n @property\n def copy(self) -> str:\n return self._copy\n\n @property\n def oneline(self) -> str:\n return self._oneline\n\n @property\n def outline(self) -> str:\n return self._outline\n\n @property\n def theme(self) -> str:\n return self._theme\n\n @property\n def genre(self) -> str:\n return self._genre\n\n @property\n def target(self) -> str:\n return self._target\n\n @property\n def size(self) -> str:\n return self._size\n\n @property\n def desc_size(self) -> int:\n return self._desc_size\n\n @property\n def total_size(self) -> int:\n return self._total_size\n\n @property\n def desc_papers(self) -> (int, float):\n return self._desc_papers\n\n @property\n def total_papers(self) -> (int, float):\n return self._total_papers\n\n #\n # property (story)\n #\n\n @property\n def version(self) -> tuple:\n return self._version\n\n @property\n def contest_info(self) -> str:\n return self._contest_info\n\n @property\n def caution(self) -> str:\n return self._caution\n\n @property\n def note(self) -> str:\n return self._note\n\n @property\n def sites(self) -> (list, tuple):\n return self._sites\n\n @property\n def taginfos(self) -> (list, tuple):\n return self._taginfos\n\n @property\n def modified(self) -> datetime.date:\n return self._modified\n\n @property\n def released(self) -> datetime.date:\n return self._released\n\n @property\n def columns(self) -> int:\n return self._columns\n\n @property\n def rows(self) -> int:\n return self._rows\n\n @property\n def priority(self) -> int:\n return self._priority\n\n @property\n def start(self) -> int:\n return self._start\n\n @property\n def end(self) -> int:\n return self._end\n\n @property\n def is_data(self) -> bool:\n return self._is_data\n\n @property\n def is_plot(self) -> bool:\n return self._is_plot\n\n @property\n def is_text(self) -> bool:\n return self._is_text\n\n @property\n def is_scenario(self) -> bool:\n return self._is_scenario\n\n @property\n def is_audiodrama(self) -> bool:\n return self._is_audiodrama\n\n @property\n def is_rubi(self) -> bool:\n return self._is_rubi\n\n @property\n def is_comment(self) -> bool:\n return self._is_comment\n\n @property\n def is_console(self) -> bool:\n return self._is_console\n\n @property\n def format_mode(self) -> FormatMode:\n return self._format_mode\n\n @property\n def output_mode(self) -> OutputMode:\n return self._output_mode\n\n @property\n def filename(self) -> str:\n return self._filename\n\n @property\n def builddir(self) -> str:\n return self._builddir\n\n @property\n def log_level(self) -> str:\n return self._log_level\n\n #\n # methods (specific)\n #\n\n def set_title(self, title: str) -> None:\n self._title = assertion.is_str(title)\n\n def set_theme(self, theme: str) -> None:\n self._theme = assertion.is_str(theme)\n\n def set_copy(self, copy: str) -> None:\n self._copy = assertion.is_str(copy)\n\n def set_oneline(self, oneline: str) -> None:\n self._oneline = assertion.is_str(oneline)\n\n def set_outline(self, outline: str) -> None:\n self._outline = assertion.is_str(outline)\n\n def set_genre(self, genre: str) -> None:\n self._genre = assertion.is_str(genre)\n\n def set_target(self, target: str) -> None:\n self._target = assertion.is_str(target)\n\n def set_size(self, size: str) -> None:\n self._size = assertion.is_str(size)\n\n def set_desc_size(self, size: int) -> None:\n self._desc_size = assertion.is_int(size)\n\n def set_total_size(self, size: int) -> None:\n self._total_size = assertion.is_int(size)\n\n def set_desc_papers(self, papers: (int, float)) -> None:\n self._desc_papers = assertion.is_int_or_float(papers)\n\n def set_total_papers(self, papers: (int, float)) -> None:\n self._total_papers = assertion.is_int_or_float(papers)\n\n #\n # methods (story)\n #\n\n def set_version(self, *args: (str, int, tuple)) -> None:\n if isinstance(args[0], tuple):\n self._version = args[0]\n elif len(args) >= 3 and isinstance(args[0], int) and isinstance(args[1], int) and isinstance(args[2], int):\n self._version = (args[0], args[1], args[2])\n else:\n self._version = (assertion.is_str(args[0]),)\n\n def set_contest_info(self, info: str) -> None:\n self._contest_info = assertion.is_str(info)\n\n def set_caution(self, info: str) -> None:\n self._caution = assertion.is_str(info)\n\n def set_note(self, note: str) -> None:\n self._note = assertion.is_str(note)\n\n def set_sites(self, *args: str) -> None:\n self._sites = [assertion.is_str(val) for val in args]\n\n def set_taginfos(self, *args: str) -> None:\n if isinstance(args[0], (list, tuple)):\n self._taginfos = args[0]\n else:\n self._taginfos = [v for v in args if isinstance(v, str)]\n\n def set_modified(self, *args: (datetime.date, int)) -> None:\n if isinstance(args[0], datetime.date):\n self._modified = args[0]\n else:\n y, m, d = assertion.is_int(args[2]), assertion.is_int(args[0]), assertion.is_int(args[1])\n self._modified = datetime.date(y, m, d)\n\n def set_released(self, *args: (datetime.date, int)) -> None:\n if isinstance(args[0], datetime.date):\n self._released = args[0]\n else:\n y, m, d = assertion.is_int(args[2]), assertion.is_int(args[0]), assertion.is_int(args[1])\n self._released = datetime.date(y, m, d)\n\n def set_columns(self, col: int) -> None:\n self._columns = assertion.is_int(col)\n\n def set_rows(self, rows: int) -> None:\n self._rows = assertion.is_int(rows)\n\n def set_priority(self, pri: int) -> None:\n self._priority = assertion.is_between(\n assertion.is_int(pri), __PRIORITY_MAX__, __PRIORITY_MIN__)\n\n def set_start(self, start: int) -> None:\n self._start = assertion.is_int(start)\n\n def set_end(self, end: int) -> None:\n self._end = assertion.is_int(end)\n\n def set_base_date(self, month: int, day: int, year: int) -> None:\n self._base_date = datetime.date(year, month, day)\n\n def set_base_time(self, hour: int, minute: int) -> None:\n self._base_time = datetime.time(hour, minute)\n\n #\n # methods (compile)\n #\n\n def set_is_data(self, is_data: bool) -> None:\n self._is_data = assertion.is_bool(is_data)\n\n def set_is_plot(self, is_plot: bool) -> None:\n self._is_plot = assertion.is_bool(is_plot)\n\n def set_is_text(self, is_text: bool) -> None:\n self._is_text = assertion.is_bool(is_text)\n\n def set_is_scenario(self, is_scenario: bool) -> None:\n self._is_scenario = assertion.is_bool(is_scenario)\n\n def set_is_audiodrama(self, is_audiodrama: bool) -> None:\n self._is_audiodrama = assertion.is_bool(is_audiodrama)\n\n def set_is_rubi(self, is_rubi: bool) -> None:\n self._is_rubi = assertion.is_bool(is_rubi)\n\n def set_is_comment(self, is_comment: bool) -> None:\n self._is_comment = assertion.is_bool(is_comment)\n\n def set_is_console(self, is_console: bool) -> None:\n self._is_console = assertion.is_bool(is_console)\n\n def set_format_mode(self, mode: FormatMode) -> None:\n self._format_mode = assertion.is_instance(mode, FormatMode)\n\n def set_output_mode(self, mode: OutputMode) -> None:\n self._output_mode = assertion.is_instance(mode, OutputMode)\n\n def set_filename(self, filename: str) -> None:\n self._filename = assertion.is_str(filename)\n\n def set_builddir(self, builddir: str) -> None:\n self._builddir = assertion.is_str(builddir)\n\n def set_log_level(self, loglevel: str) -> None:\n self._log_level = assertion.is_str(loglevel)\n" }, { "alpha_fraction": 0.6129032373428345, "alphanum_fraction": 0.6161290407180786, "avg_line_length": 15.263157844543457, "blob_id": "8fef304a3b0dbfebf8b68c94be7dbccc954feaad", "content_id": "834b6faa99cb56ca5676b95348c28782f65aa45c", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 310, "license_type": "permissive", "max_line_length": 50, "num_lines": 19, "path": "/builder/containers/episode.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nEpisode Container Object\n========================\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('Episode',)\n\n\nfrom builder.containers.container import Container\nfrom builder.utils import assertion\n\n\nclass Episode(Container):\n ''' Episode Container class.\n '''\n pass\n\n" }, { "alpha_fraction": 0.5736767053604126, "alphanum_fraction": 0.5765379071235657, "avg_line_length": 16.450000762939453, "blob_id": "2542663e781e167e513ce267b2f1f7d7547a953e", "content_id": "b91f1fbbb422ab1bca28221121392d3a33ed5d5d", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 699, "license_type": "permissive", "max_line_length": 58, "num_lines": 40, "path": "/builder/utils/util_file.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nFile and Filename Utility methods\n=================================\n'''\n\n__all__ = (\n 'get_module_filename',\n )\n\n\nimport inspect\nimport os\nfrom builder.utils import assertion\n\n\n\n#\n# methods (file name)\n#\n\ndef get_module_filename(frame_num: int) -> str:\n frame = inspect.stack()[frame_num]\n module = inspect.getmodule(frame[0])\n return module.__file__\n\n#\n# methods (file)\n#\n\ndef is_exist_path(fname: str) -> bool:\n return os.path.exists(fname)\n\n\ndef get_content_from_text_file(fname: str) -> list:\n tmp = []\n if is_exist_path(fname):\n with open(fname) as f:\n tmp = [line.strip() for line in f.readlines()]\n return tmp\n\n" }, { "alpha_fraction": 0.5505804419517517, "alphanum_fraction": 0.5543117523193359, "avg_line_length": 36.10769271850586, "blob_id": "585644b771d7602525bf6bb8d0598d51e5a1d0d1", "content_id": "eef926d216fdb303f7b8315316a977d9aa6b83b7", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2476, "license_type": "permissive", "max_line_length": 98, "num_lines": 65, "path": "/tests/core/test_compiler.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nCompiler class test\n===================\n'''\n\nimport unittest\nfrom tests.testutils import print_testtitle, validate_with_fail\nfrom builder.commands.scode import SCode, SCmd\nfrom builder.containers.chapter import Chapter\nfrom builder.containers.episode import Episode\nfrom builder.containers.scene import Scene\nfrom builder.datatypes.codelist import CodeList\nfrom builder.datatypes.formattag import FormatTag\nfrom builder.datatypes.rawdata import RawData\nfrom builder.objects.rubi import Rubi\nfrom builder.core import compiler as cp\n\n\nclass CompilerTest(unittest.TestCase):\n\n @classmethod\n def setUpClass(cls):\n print_testtitle(cp.__name__, 'Compiler class')\n\n def test_instance(self):\n tmp = cp.Compiler()\n self.assertIsInstance(tmp, cp.Compiler)\n\n def test_conv_to_novel(self):\n data = [\n # (src, is_cmt, expect)\n (True, CodeList(*[SCode(None, SCmd.BE, ('太郎',),'')]),\n False,\n (FormatTag.DESCRIPTION_HEAD, ' 太郎。','\\n')),\n ]\n validate_with_fail(self, 'conv_to_novel',\n lambda src, is_cmt, expect: self.assertEqual(\n cp.Compiler()._conv_to_novel(src, is_cmt).data, expect),\n data)\n\n def test_add_rubi_on_novel(self):\n data = [\n # (src, rubis, expect)\n (True, RawData(*['暫くすると',]),\n {'暫く': Rubi('暫く', '暫《しばら》く')},\n ('暫《しばら》くすると',)),\n ]\n validate_with_fail(self, 'add_rubi_on_novel',\n lambda src, rubis, expect: self.assertEqual(\n cp.Compiler()._add_rubi_on_novel(src, rubis).data, expect),\n data)\n\n def test_conv_from_tag(self):\n data = [\n # (src, head, nums, is_cmt, is_plot, is_data, in_mate, expect, exp_nums)\n (True, SCode(None, SCmd.TAG_BR, (), ''), '#', (1,1,1),\n True, False, False, False,\n '\\n\\n', (1,1,1)),\n ]\n def checker(src, head, nums, is_cmt, is_plot, is_data, in_mate, expect, exp_nums):\n tmp = cp.Compiler()._conv_from_tag(src, head, nums, is_cmt, is_plot, is_data, in_mate)\n self.assertEqual(tmp[0], expect)\n self.assertEqual(tmp[1], exp_nums)\n validate_with_fail(self, 'conv_from_tag', checker, data)\n" }, { "alpha_fraction": 0.41806498169898987, "alphanum_fraction": 0.4382363557815552, "avg_line_length": 32.14793014526367, "blob_id": "b31ae3b1ad091cdfdae25c007e22fc6280e88adb", "content_id": "0fd622264428067013c8bd6aaca4b0594a51296c", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 5602, "license_type": "permissive", "max_line_length": 93, "num_lines": 169, "path": "/tests/utils/test_assertion.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nCustom assertion methods test\n=============================\n'''\n\nimport unittest\nfrom tests.testutils import print_testtitle, validate_with_fail\nfrom builder.utils import assertion\n\n\nclass MethodsTest(unittest.TestCase):\n\n @classmethod\n def setUpClass(cls):\n print_testtitle(assertion.__name__, 'custom assertion methods')\n\n def test_is_between(self):\n data = [\n # (val, max, min, expect)\n (True, 10, 100, 1, 10,),\n (False, -1, 100, 1, 10,),\n (False, 100, 50, 1, 100,),\n ]\n validate_with_fail(self, \"is_between\",\n lambda v,mx,mn,expect: self.assertEqual(assertion.is_between(v, mx, mn), expect),\n data)\n\n def test_is_bool(self):\n data = [\n # (val, expect)\n (True, True, True,),\n (True, False, False,),\n (False, [\"test\"], True,),\n ]\n validate_with_fail(self, \"is_bool\",\n lambda v,expect: self.assertEqual(assertion.is_bool(v), expect), data)\n\n def test_is_dict(self):\n data = [\n # (val, expect)\n (True, {\"test\": \"1\"}, {\"test\": \"1\"},),\n (False, [\"test\", \"1\"], [\"test\", \"1\"],),\n ]\n validate_with_fail(self, \"is_dict\",\n lambda v,expect: self.assertEqual(assertion.is_dict(v), expect), data)\n\n def test_is_instance(self):\n class Taro(object):\n def __init__(self, name: str):\n self._name = name\n class Hanako(object):\n def __init__(self, name: str):\n self._name = name\n taro1 = Taro(\"taro\")\n data = [\n # (val, class, expect)\n (True, taro1, Taro, taro1,),\n (False, taro1, Hanako, taro1,),\n ]\n validate_with_fail(self, \"is_instance\",\n lambda v,cls, expect: self.assertEqual(assertion.is_instance(v, cls), expect),\n data)\n\n def test_is_int(self):\n data = [\n # (val, expect)\n (True, 1, 1,),\n (False, \"1\", \"1\",),\n ]\n validate_with_fail(self, \"is_int\",\n lambda v,expect: self.assertEqual(assertion.is_int(v), expect), data)\n\n def test_is_int_or_float(self):\n data = [\n # (val, expect)\n (True, 1, 1,),\n (True, 1.1, 1.1,),\n (False, \"1\", \"1\",),\n ]\n validate_with_fail(self, \"is_int_or_float\",\n lambda v,expect: self.assertEqual(assertion.is_int_or_float(v), expect), data)\n\n\n def test_is_int_or_str(self):\n data = [\n # (val, expect)\n (True, 1, 1,),\n (True, \"1\", \"1\",),\n (False, [1, 2], [1, 2],),\n ]\n validate_with_fail(self, \"is_int_or_str\",\n lambda v,expect: self.assertEqual(assertion.is_int_or_str(v), expect),\n data)\n\n def test_is_list(self):\n data = [\n # (val, expect)\n (True, [1,2,3], [1,2,3],),\n (False, 1, 1),\n (False, (1,2), (1,2)),\n ]\n validate_with_fail(self, \"is_list\",\n lambda v,expect: self.assertEqual(assertion.is_list(v), expect),\n data)\n\n def test_is_listlike(self):\n data = [\n # (val, expect)\n (True, [1,2,3], [1,2,3]),\n (True, (1,2), (1,2)),\n (False, 1, 1),\n ]\n validate_with_fail(self, \"is_listlike\",\n lambda v,expect: self.assertEqual(assertion.is_listlike(v), expect),\n data)\n\n def test_is_str(self):\n data = [\n # (val, expect)\n (True, \"1\", \"1\",),\n (False, 1, 1,),\n ]\n validate_with_fail(self, \"is_str\",\n lambda v,expect: self.assertEqual(assertion.is_str(v), expect),\n data)\n\n def test_is_subclass(self):\n class Taro(object):\n def __init__(self, name: str):\n self._name = name\n class Hanako(Taro):\n def __init__(self, name: str, age: int):\n super().__init__(name)\n self._age = age\n taro1 = Taro(\"taro\")\n hanako1 = Hanako(\"hana\", 1)\n data = [\n # (val, class, expect)\n (True, taro1, Taro, taro1,),\n (True, hanako1, Taro, hanako1,),\n (False, taro1, Hanako, taro1,),\n ]\n validate_with_fail(self, \"is_subclass\",\n lambda v,cls, expect: self.assertEqual(assertion.is_subclass(v,cls), expect),\n data)\n\n def test_is_tuple(self):\n data = [\n # (val, expect)\n (True, (1,2,3), (1,2,3),),\n (False, 1, 1),\n (False, [1,2,3], [1,2,3],),\n ]\n validate_with_fail(self, \"is_tuple\",\n lambda v,expect: self.assertEqual(assertion.is_tuple(v), expect),\n data)\n\n def test_is_various_types(self):\n data = [\n # (val, types, expect)\n (True, 1, (int, str), 1),\n (True, \"1\", (int, str), \"1\"),\n (False, [1,2], (int, str), [1,2]),\n ]\n validate_with_fail(self, \"is_various_types\",\n lambda v,types,expect: self.assertEqual(\n assertion.is_various_types(v,types), expect),\n data)\n" }, { "alpha_fraction": 0.5426287651062012, "alphanum_fraction": 0.5488454699516296, "avg_line_length": 18.06779670715332, "blob_id": "7462963e1041d3c1a6cf7e9a22cc8d6035647bd8", "content_id": "44681e0b80acc36dcf4560f6eeb406b64ec1f1d2", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1134, "license_type": "permissive", "max_line_length": 90, "num_lines": 59, "path": "/builder/objects/day.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nDay Object\n==========\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('Day',)\n\n\nimport datetime\nfrom builder.objects.sobject import SObject\nfrom builder.utils import assertion\n\n\nclass Day(SObject):\n ''' Day Object class.\n '''\n\n def __init__(self, name: str, month: int=1, day: int=1, year: int=2020, info: str=''):\n super().__init__(name)\n self._date = datetime.date(\n month=assertion.is_int(month),\n day=assertion.is_int(day),\n year=assertion.is_int(year))\n self._info = assertion.is_str(info)\n\n #\n # property\n #\n\n @property\n def date(self) -> datetime.date:\n return self._date\n\n @property\n def daystring(self) -> str:\n return f'{self.month}月{self.day}日/{self.year}年'\n\n @property\n def month(self) -> int:\n return self._date.month\n\n @property\n def day(self) -> int:\n return self._date.day\n\n @property\n def year(self) -> int:\n return self._date.year\n\n @property\n def info(self) -> str:\n return self._info\n\n #\n # methods\n #\n\n" }, { "alpha_fraction": 0.5451197028160095, "alphanum_fraction": 0.5469613075256348, "avg_line_length": 15.9375, "blob_id": "1ae04b4a615e8fbc99ede1f76112167da2861608", "content_id": "a475d98aa52c3facc48262cee89d27765a7b1886", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 543, "license_type": "permissive", "max_line_length": 45, "num_lines": 32, "path": "/builder/datatypes/plotinfo.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nPlot Information Data\n=====================\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('PlotInfo',)\n\n\nfrom builder.utils import assertion\n\n\nclass PlotInfo(object):\n ''' Plot Info Data class.\n '''\n def __init__(self, title: str, *args):\n self._title = assertion.is_str(title)\n self._data = assertion.is_tuple(args)\n\n #\n # property\n #\n\n @property\n def title(self) -> str:\n return self._title\n\n @property\n def data(self) -> tuple:\n return self._data\n\n" }, { "alpha_fraction": 0.747346043586731, "alphanum_fraction": 0.7475584149360657, "avg_line_length": 39.24786376953125, "blob_id": "881a2adb7e4e60d03b697a81ada494ba4b761abb", "content_id": "e3dbcbdb3ec7d20bf8430c926dca62a8ba70bef4", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 4710, "license_type": "permissive", "max_line_length": 65, "num_lines": 117, "path": "/tests/all_tests.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nThe test suite for all test cases\n=================================\n'''\nimport unittest\nfrom tests import test_world\nfrom tests.commands import test_command\nfrom tests.commands import test_optioncmd\nfrom tests.commands import test_scode\nfrom tests.commands import test_storycmd\nfrom tests.commands import test_tagcmd\nfrom tests.containers import test_container\nfrom tests.core import test_compiler\nfrom tests.core import test_filter\nfrom tests.core import test_formatter\nfrom tests.core import test_headerupdater\nfrom tests.core import test_outputter\nfrom tests.core import test_reducer\nfrom tests.core import test_runner\nfrom tests.core import test_serializer\nfrom tests.core import test_tagreplacer\nfrom tests.core import test_validater\nfrom tests.datatypes import test_codelist\nfrom tests.datatypes import test_compilemode\nfrom tests.datatypes import test_database\nfrom tests.datatypes import test_formatmode\nfrom tests.datatypes import test_formattag\nfrom tests.datatypes import test_headerinfo\nfrom tests.datatypes import test_outputmode\nfrom tests.datatypes import test_rawdata\nfrom tests.datatypes import test_resultdata\nfrom tests.datatypes import test_storyconfig\nfrom tests.objects import test_day\nfrom tests.objects import test_item\nfrom tests.objects import test_person\nfrom tests.objects import test_rubi\nfrom tests.objects import test_sobject\nfrom tests.objects import test_stage\nfrom tests.objects import test_time\nfrom tests.objects import test_word\nfrom tests.objects import test_writer\nfrom tests.tools import test_checker\nfrom tests.tools import test_converter\nfrom tests.tools import test_counter\nfrom tests.utils import test_assertion\nfrom tests.utils import test_dict\nfrom tests.utils import test_list\nfrom tests.utils import test_logger\nfrom tests.utils import test_math\nfrom tests.utils import test_name\nfrom tests.utils import test_str\n\n\ndef suite() -> unittest.TestSuite:\n ''' Packing all tests.\n '''\n suite = unittest.TestSuite()\n\n suite.addTests((\n # commands\n unittest.makeSuite(test_command.SCmdEnumTest),\n unittest.makeSuite(test_optioncmd.OptionParserTest),\n unittest.makeSuite(test_scode.SCodeTest),\n unittest.makeSuite(test_storycmd.StoryCmdTest),\n unittest.makeSuite(test_tagcmd.TagCmdTest),\n # containers\n unittest.makeSuite(test_container.ContainerTest),\n # datatypes\n unittest.makeSuite(test_codelist.CodeListTest),\n unittest.makeSuite(test_compilemode.CompileModeTest),\n unittest.makeSuite(test_database.DatabaseTest),\n unittest.makeSuite(test_formatmode.FormatModeTest),\n unittest.makeSuite(test_formattag.FormatTagTest),\n unittest.makeSuite(test_headerinfo.HeaderInfoTest),\n unittest.makeSuite(test_outputmode.OutputModeTest),\n unittest.makeSuite(test_rawdata.RawDataTest),\n unittest.makeSuite(test_resultdata.ResultDataTest),\n unittest.makeSuite(test_storyconfig.StoryConfigTest),\n # objects\n unittest.makeSuite(test_day.DayTest),\n unittest.makeSuite(test_item.ItemTest),\n unittest.makeSuite(test_person.PersonTest),\n unittest.makeSuite(test_rubi.RubiTest),\n unittest.makeSuite(test_sobject.SObjectTest),\n unittest.makeSuite(test_stage.StageTest),\n unittest.makeSuite(test_time.TimeTest),\n unittest.makeSuite(test_word.WordTest),\n unittest.makeSuite(test_writer.WriterTest),\n # tools\n unittest.makeSuite(test_checker.CheckerTest),\n unittest.makeSuite(test_converter.ConverterTest),\n unittest.makeSuite(test_counter.CounterTest),\n # utility\n unittest.makeSuite(test_assertion.MethodsTest),\n unittest.makeSuite(test_dict.MethodsTest),\n unittest.makeSuite(test_list.MethodsTest),\n unittest.makeSuite(test_logger.MyLoggerTest),\n unittest.makeSuite(test_math.MethodsTest),\n unittest.makeSuite(test_name.MethodsTest),\n unittest.makeSuite(test_str.MethodsTest),\n # core\n unittest.makeSuite(test_compiler.CompilerTest),\n unittest.makeSuite(test_filter.FilterTest),\n unittest.makeSuite(test_formatter.FormatterTest),\n unittest.makeSuite(test_headerupdater.HeaderUpdaterTest),\n unittest.makeSuite(test_outputter.OutputterTest),\n unittest.makeSuite(test_reducer.ReducerTest),\n unittest.makeSuite(test_runner.RunnerTest),\n unittest.makeSuite(test_serializer.SerializerTest),\n unittest.makeSuite(test_tagreplacer.TagReplacerTest),\n unittest.makeSuite(test_validater.ValidaterTest),\n # main\n unittest.makeSuite(test_world.WorldTest),\n ))\n\n return suite\n\n" }, { "alpha_fraction": 0.47596606612205505, "alphanum_fraction": 0.49575871229171753, "avg_line_length": 27.675676345825195, "blob_id": "99741f52480e7a3fda15a0159de07ef5ef95d491", "content_id": "9f1b67f86d6f7da53aa91a8bd6b564bee5d35ad3", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1061, "license_type": "permissive", "max_line_length": 70, "num_lines": 37, "path": "/tests/utils/test_math.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nMathematics utility methods test\n================================\n'''\n\nimport unittest\nfrom testutils import print_testtitle, validate_with_fail\nfrom builder.utils import util_math as umath\n\n\nclass MethodsTest(unittest.TestCase):\n\n @classmethod\n def setUpClass(cls):\n print_testtitle(umath.__name__, 'mathematics-utility methods')\n\n def test_int_ceil(self):\n data = [\n # (valA, valB, expect)\n (True, 4, 2, 2),\n (True, 5, 2, 3),\n ]\n validate_with_fail(self, \"int_ceil\",\n lambda v0,v1, expect: self.assertEqual(\n umath.int_ceil(v0, v1), expect),\n data)\n\n def test_safe_divided(self):\n data = [\n # (valA, valB, expect)\n (True, 4, 2, 2),\n (True, 5, 0, 0),\n ]\n validate_with_fail(self, 'safe_divided',\n lambda v0, v1, expect: self.assertEqual(\n umath.safe_divided(v0, v1), expect), data)\n" }, { "alpha_fraction": 0.521268367767334, "alphanum_fraction": 0.5545243620872498, "avg_line_length": 34.88888931274414, "blob_id": "ad95703df7a36288387897d5d621c78a1dec4612", "content_id": "a6c20c0aa50442da759cd55fcf9e77c6ce39e10c", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1293, "license_type": "permissive", "max_line_length": 97, "num_lines": 36, "path": "/tests/objects/test_day.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nDay class test\n==============\n'''\n\nimport datetime\nimport unittest\nfrom tests.testutils import print_testtitle, validate_with_fail\nfrom builder.objects import day as dy\n\n\nclass DayTest(unittest.TestCase):\n\n @classmethod\n def setUpClass(cls):\n print_testtitle(dy.__name__, 'Day class')\n\n def test_instance(self):\n data = [\n # (name, month, day, year, info, expect, exp_m, exp_d, exp_y, exp_date, exp_info)\n (True, 'test', 1, 10, 1000, 'a note',\n 'test', 1, 10, 1000, datetime.date(1000,1,10), 'a note'),\n (True, '', 1, 10, 1000, 'a note',\n '', 1, 10, 1000, datetime.date(1000,1,10), 'a note'),\n ]\n def checker(name, mon, day, year, info, expect, exp_m, exp_d, exp_y, exp_date, exp_info):\n tmp = dy.Day(name, mon, day, year, info)\n self.assertIsInstance(tmp, dy.Day)\n self.assertEqual(tmp.name, expect)\n self.assertEqual(tmp.month, exp_m)\n self.assertEqual(tmp.day, exp_d)\n self.assertEqual(tmp.year, exp_y)\n self.assertEqual(tmp.date, exp_date)\n self.assertEqual(tmp.info, exp_info)\n validate_with_fail(self, 'class instance', checker, data)\n\n" }, { "alpha_fraction": 0.5958904027938843, "alphanum_fraction": 0.6113013625144958, "avg_line_length": 43.92307662963867, "blob_id": "2ed018271f98e1cfa80219d75b078507a1190004", "content_id": "3523651b6fe756d0301345478ca2380ad6835e59", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1752, "license_type": "permissive", "max_line_length": 131, "num_lines": 39, "path": "/tests/datatypes/test_headerinfo.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nHeaderInfo class test\n=====================\n'''\n\nimport unittest\nfrom tests.testutils import print_testtitle, validate_with_fail\nfrom builder.datatypes import headerinfo as hd\n\n\nclass HeaderInfoTest(unittest.TestCase):\n\n @classmethod\n def setUpClass(cls):\n print_testtitle(hd.__name__, 'HeaderInfo class')\n\n def test_instance(self):\n data = [\n # (chars, t_lines, t_papers, lines, papers, chaps, epis, scenes, scodes,\n # exp_chars, exp_tlines, exp_tpapers, exp_lines, exp_papers, exp_chaps, exp_epis, exp_scenes, exp_scodes)\n (True, 9, 9, 9, 1, 10, 100, 5, 5, 5, 5,\n 9, 9, 9, 1, 10, 100, 5,5,5,5),\n ]\n def checker(total, t_lines, t_papers, chars, lines, papers, chapters, episodes, scenes, scodes,\n exp_total, exp_tlines, exp_tpapers, exp_chars, exp_lines, exp_papers, exp_chaps, exp_epis, exp_scenes, exp_scodes):\n tmp = hd.HeaderInfo(total, t_lines, t_papers, chars, lines, papers, chapters, episodes, scenes, scodes)\n self.assertIsInstance(tmp, hd.HeaderInfo)\n self.assertEqual(tmp.total_chars, exp_total)\n self.assertEqual(tmp.total_lines, exp_tlines)\n self.assertEqual(tmp.total_papers, exp_tpapers)\n self.assertEqual(tmp.desc_chars, exp_chars)\n self.assertEqual(tmp.lines, exp_lines)\n self.assertEqual(tmp.papers, exp_papers)\n self.assertEqual(tmp.chapters, exp_chaps)\n self.assertEqual(tmp.episodes, exp_epis)\n self.assertEqual(tmp.scenes, exp_scenes)\n self.assertEqual(tmp.scodes, exp_scodes)\n validate_with_fail(self, 'class instance', checker, data)\n" }, { "alpha_fraction": 0.645348846912384, "alphanum_fraction": 0.6468023061752319, "avg_line_length": 18.08333396911621, "blob_id": "9bf31f74d86496542987bc0dc817efa163cb5f67", "content_id": "76357e5cf6504a003a7404494a7ff397d19bfa6e", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 688, "license_type": "permissive", "max_line_length": 73, "num_lines": 36, "path": "/builder/datatypes/codelist.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nCode List Object\n===============\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('CodeList',)\n\n\nfrom typing import Tuple\nfrom builder.commands.scode import SCode\nfrom builder.datatypes.builderexception import BuilderError\nfrom builder.utils import assertion\nfrom builder.utils.logger import MyLogger\n\n\n# logger\nLOG = MyLogger.get_logger(__name__)\nLOG.set_file_handler()\n\n\nclass CodeList(object):\n ''' Code list package object.\n '''\n def __init__(self, *args: SCode):\n self._data = tuple(assertion.is_instance(a, SCode) for a in args)\n\n #\n # property\n #\n\n @property\n def data(self) -> Tuple[SCode]:\n return self._data\n\n" }, { "alpha_fraction": 0.6341463327407837, "alphanum_fraction": 0.6356707215309143, "avg_line_length": 17.714284896850586, "blob_id": "726172b929bc8365094bb57074b9e1b0f5c29b9a", "content_id": "5396232360a678235ae365764c70103e492cb1fa", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 656, "license_type": "permissive", "max_line_length": 77, "num_lines": 35, "path": "/analyzer/datatypes/tokenlist.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nToken List Object\n=================\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('TokenList',)\n\n\nfrom typing import Tuple\nfrom analyzer.datatypes.mecabdata import MecabData\nfrom builder.utils import assertion\nfrom builder.utils.logger import MyLogger\n\n\n# logger\nLOG = MyLogger.get_logger(__name__)\nLOG.set_file_handler()\n\n\nclass TokenList(object):\n ''' Token list package object.\n '''\n def __init__(self, *args: MecabData):\n self._data = tuple(assertion.is_instance(a, MecabData) for a in args)\n\n #\n # property\n #\n\n @property\n def data(self) -> Tuple[MecabData]:\n return self._data\n\n" }, { "alpha_fraction": 0.5942876935005188, "alphanum_fraction": 0.5946317911148071, "avg_line_length": 34.42683029174805, "blob_id": "6d9752dff56a5b59a7ce5f32e22c35ce45b48fc8", "content_id": "526b207d7eaa44ee2affe862cf438c67658548b8", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2906, "license_type": "permissive", "max_line_length": 103, "num_lines": 82, "path": "/builder/commands/optioncmd.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nOption Parser Object\n====================\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('OptionParser',)\n\nimport argparse\nfrom builder.utils import assertion\nfrom builder.utils.logger import MyLogger\n\n\n# logger\nLOG = MyLogger.get_logger(__name__)\nLOG.set_file_handler()\n\n\nclass OptionParser(object):\n ''' Option Parser Object class.\n '''\n def __init__(self):\n LOG.info('OPT_PARSER: initialize')\n self._parser = argparse.ArgumentParser()\n\n #\n # property\n #\n\n @property\n def parser(self) -> argparse.ArgumentParser:\n return self._parser\n\n #\n # methods\n #\n\n def get_commandline_arguments(self,\n is_testing: bool=False,\n test_data: list=None) -> argparse.Namespace: # pragma: no cover\n ''' Get and setting a commandline option.\n\n NOTE:\n -c, --comment: output with comments.\n -d, --data: output a story data.\n -p, --plot: output a plot.\n -r, --rubi: output with rubi.\n -t, --text: output as a text.\n -z, --analyze: output an analyzed result.\n --console: output to a console.\n --debug: set DEBUG on log leve.\n --format: format type for output\n --log: set log level.\n --part: select story parts.\n --priority: set a priority filter.\n Returns:\n :`ArgumentParser`: commandline options.\n '''\n LOG.info('OPT_PARSE: get commandline arguments: start')\n parser = self._parser\n test_data = test_data if test_data else []\n\n LOG.info('OPT_PARSE: set option arguments')\n parser.add_argument('-c', '--comment', help='output with comments', action='store_true')\n parser.add_argument('-d', '--data', help='output a story data', action='store_true')\n parser.add_argument('-p', '--plot', help='output a plot', action='store_true')\n parser.add_argument('-r', '--rubi', help='output with rubi', action='store_true')\n parser.add_argument('-t', '--text', help='output as a text', action='store_true')\n parser.add_argument('-z', '--analyze', help='output an analyzed result', action='store_true')\n parser.add_argument('--console', help='output to the console (for debug)', action='store_true')\n parser.add_argument('--debug', help='set DEBUG on log level', action='store_true')\n parser.add_argument('--format', help='format type for output', type=str)\n parser.add_argument('--log', help='set a log level', type=str)\n parser.add_argument('--part', help='select story parts', type=str)\n parser.add_argument('--priority', help='set a priority filter', type=int)\n\n LOG.info('OPT_PARSE: get option arguments from commandline')\n args = parser.parse_args(args=test_data) if is_testing else parser.parse_args()\n\n return args\n\n" }, { "alpha_fraction": 0.5434007048606873, "alphanum_fraction": 0.5469679236412048, "avg_line_length": 18.090909957885742, "blob_id": "f66247f359ad12e38cbb5eb7bd6d8c00b283c3c5", "content_id": "34406d8a55874b8af85c0feef60251cf023b09e3", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 841, "license_type": "permissive", "max_line_length": 76, "num_lines": 44, "path": "/builder/objects/stage.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nStage Object\n============\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('Stage',)\n\n\nfrom builder.objects.sobject import SObject\nfrom builder.utils import assertion\n\n\nclass Stage(SObject):\n ''' Stage Object class.\n '''\n\n def __init__(self,\n name: str,\n parent: str='',\n geometry: tuple=None,\n info: str=''):\n super().__init__(name)\n self._parent = assertion.is_str(parent)\n self._geometry = assertion.is_tuple(geometry) if geometry else (0,0)\n self._info = assertion.is_str(info)\n\n #\n # property\n #\n\n @property\n def parent(self) -> str:\n return self._parent\n\n @property\n def geometry(self) -> tuple:\n return self._geometry\n\n @property\n def info(self) -> str:\n return self._info\n\n" }, { "alpha_fraction": 0.7159090638160706, "alphanum_fraction": 0.7159090638160706, "avg_line_length": 8.777777671813965, "blob_id": "211d95e73ac285262700163bb3d00aa186e6ac82", "content_id": "05015585529875da3540ce0da888d6b780ff3939", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": true, "language": "Markdown", "length_bytes": 88, "license_type": "permissive", "max_line_length": 22, "num_lines": 9, "path": "/.github/PULL_REQUEST_TEMPLATE.md", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "Japanese title\n===\n\n#issue-number\n\nA your pr description.\n\n**Note**\nadditional comment.\n" }, { "alpha_fraction": 0.5811209678649902, "alphanum_fraction": 0.5860373377799988, "avg_line_length": 32.86666488647461, "blob_id": "de5a2e0782c4765321f6f2d5b0d22ec4a94cb664", "content_id": "55e9e692cf78cda19c6df8b7a49b77b4b20561a2", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1017, "license_type": "permissive", "max_line_length": 95, "num_lines": 30, "path": "/tests/objects/test_stage.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nStage class test\n===============\n'''\n\nimport unittest\nfrom tests.testutils import print_testtitle, validate_with_fail\nfrom builder.objects import stage as st\n\n\nclass StageTest(unittest.TestCase):\n\n @classmethod\n def setUpClass(cls):\n print_testtitle(st.__name__, 'Stage class')\n\n def test_instance(self):\n data = [\n # (name, parent, geometry, info, expect, exp_p, exp_geo, exp_info)\n (True, 'test', 'on_Town', (5,5), 'a note', 'test', 'on_Town', (5,5), 'a note'),\n ]\n def checker(name, parent, geometry, info, expect, exp_p, exp_geo, exp_info):\n tmp = st.Stage(name, parent, geometry, info)\n self.assertIsInstance(tmp, st.Stage)\n self.assertEqual(tmp.name, expect)\n self.assertEqual(tmp.parent, exp_p)\n self.assertEqual(tmp.geometry, exp_geo)\n self.assertEqual(tmp.info, exp_info)\n validate_with_fail(self, 'class instance', checker, data)\n\n" }, { "alpha_fraction": 0.5835041999816895, "alphanum_fraction": 0.5846080780029297, "avg_line_length": 29.480770111083984, "blob_id": "a733961708db639be0b1a47b4e49c9174a06f654", "content_id": "ac314a42d0104ca4769ec0e81a7771506aa0a2ee", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 6341, "license_type": "permissive", "max_line_length": 85, "num_lines": 208, "path": "/builder/world.py", "repo_name": "My-Novel-Management/storybuilderunite", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n'''\nStory World Object\n===================\n'''\n\nfrom __future__ import annotations\n\n__all__ = ('World',)\n\n\nfrom builder import VERSION_MSG, __DEFAULT_LOG_LEVEL__, __VERSION__, __TITLE__\nfrom builder.commands.optioncmd import OptionParser\nfrom builder.commands.scode import SCode, SCmd\nfrom builder.commands.storycmd import StoryCmd\nfrom builder.commands.tagcmd import TagCmd\nfrom builder.containers.chapter import Chapter\nfrom builder.containers.episode import Episode\nfrom builder.containers.scene import Scene\nfrom builder.containers.story import Story\nfrom builder.core.runner import Runner\nfrom builder.datatypes.builderexception import BuilderError\nfrom builder.datatypes.database import Database\nfrom builder.datatypes.resultdata import ResultData\nfrom builder.datatypes.storyconfig import StoryConfig\nfrom builder.objects.sobject import SObject\nfrom builder.utils import assertion\nfrom builder.utils.util_date import get_date_lastmodified\nfrom builder.utils.util_file import get_module_filename\nfrom builder.utils.logger import MyLogger\n\n\n# logger\nLOG = MyLogger.get_logger(__name__)\nLOG.set_file_handler()\n\n\nclass Writer(object):\n ''' Writer Object class.\n '''\n\n def __init__(self, src: SObject):\n self._src = assertion.is_instance(src, SObject)\n\n #\n # methods\n #\n\n def be(self, *args: str) -> SCode:\n return SCode(self._src, SCmd.BE, args)\n\n def come(self, *args: str) -> SCode:\n return SCode(self._src, SCmd.COME, args)\n\n def do(self, *args: str) -> SCode:\n return SCode(self._src, SCmd.DO, args)\n\n def explain(self, *args: str) -> SCode:\n return SCode(self._src, SCmd.EXPLAIN, args)\n\n def go(self, *args: str) -> SCode:\n return SCode(self._src, SCmd.GO, args)\n\n def hear(self, *args: str) -> SCode:\n return SCode(self._src, SCmd.HEAR, args)\n\n def look(self, *args: str) -> SCode:\n return SCode(self._src, SCmd.LOOK, args)\n\n def talk(self, *args: str) -> SCode:\n return SCode(self._src, SCmd.TALK, args)\n\n def think(self, *args: str) -> SCode:\n return SCode(self._src, SCmd.THINK, args)\n\n def voice(self, *args: str) -> SCode:\n return SCode(self._src, SCmd.VOICE, args)\n\n def wear(self, *args: str) -> SCode:\n return SCode(self._src, SCmd.WEAR, args)\n\n\nclass World(object):\n ''' Story World Object class.\n '''\n\n def __init__(self, title: str, loglevel: str=__DEFAULT_LOG_LEVEL__):\n # log\n LOG.set_level(loglevel)\n # start logging\n LOG.info('--------' * 4 + f' START LOGGING [{LOG.level}]' + '--------' * 4)\n LOG.info('CLASS: World: initialize')\n LOG.debug(f'-- title: {title}')\n # data\n self._config = StoryConfig(title)\n self._db = Database()\n # command\n self._cmd = StoryCmd(self._db)\n self._tag = TagCmd()\n # hook method\n self.chapter = self._cmd.chapter\n self.episode = self._cmd.episode\n self.scene = self._cmd.scene\n self.plot_note = self._cmd.plot_note\n self.foreshadow = self._cmd.foreshadow\n self.payoff = self._cmd.payoff\n self.motif = self._cmd.motif\n self.plot_setup = self._cmd.plot_setup\n self.plot_develop = self._cmd.plot_develop\n self.plot_resolve = self._cmd.plot_resolve\n self.plot_turnpoint = self._cmd.plot_turnpoint\n self.writer_note = self._cmd.writer_note\n self.chara_note = self._cmd.character_note\n self.document = self._cmd.document\n self.br = self._tag.br\n self.comment = self._tag.comment\n self.symbol = self._tag.symbol\n self._config.set_log_level(loglevel)\n self.change_camera = self.cmd.change_camera\n self.change_stage = self.cmd.change_stage\n self.change_date = self.cmd.change_date\n self.change_time = self.cmd.change_time\n\n #\n # static methods\n #\n\n @staticmethod\n def create_world(title: str) -> World: # pragma: no cover\n ''' Get world class instance.\n '''\n # first print\n print(f'>> Build by {__TITLE__}(v{__VERSION__})')\n # log level set\n LOG.reset_logger(OptionParser().get_commandline_arguments())\n tmp = World(title)\n # default settings\n tmp.config.set_modified(get_date_lastmodified(get_module_filename(2)))\n return tmp\n\n #\n # property\n #\n\n @property\n def config(self) -> StoryConfig:\n return self._config\n\n @property\n def db(self) -> Database:\n return self._db\n\n @property\n def cmd(self) -> StoryCmd:\n return self._cmd\n\n @property\n def tag(self) -> TagCmd:\n return self._tag\n\n #\n # methods\n #\n\n def get(self, key: str) -> Writer:\n return Writer(self._db.get(key))\n\n\n def run(self, *args: (Chapter, Episode, Scene, SCode)) -> int: # pragma: no cover\n ''' Run the story builder.\n '''\n LOG.info('WORLD: START: run')\n exit_msg = ''\n exit_code = 0\n try:\n LOG.info('WORLD: create story object')\n # TODO: validate args\n tmp = Story(self.config.title, *args, outline=self.config.outline)\n LOG.info('WORLD: START: runner')\n result = assertion.is_instance(\n Runner().execute(tmp, self.config, self.db),\n ResultData)\n if not result.is_succeeded:\n if result.error:\n raise result.error\n else:\n raise BuilderError('Other Builder Error!!')\n LOG.info('... SUCCESS: runner')\n except Exception as e:\n import traceback\n ex_traceback = traceback.format_exc()\n exit_msg += '==== BUILDER ERROR ====\\n' + '\\n'.join(VERSION_MSG)\n exit_msg += f'\\n: {ex_traceback}'\n exit_code = 1\n except SystemExit as ex:\n if ex.code is not None:\n if not isinstance(ex.code, int):\n exit_msg = ex_code\n exit_code = 1\n else:\n exit_code = ex.code\n finally:\n import sys\n if exit_msg:\n LOG.critical(exit_msg)\n if exit_msg:\n sys.stderr.write(exit_msg)\n return exit_code\n\n" } ]
130
abstract-open-solutions/comuneimola.compensi
https://github.com/abstract-open-solutions/comuneimola.compensi
eec7dfdf66782aa068cca81b4776e60774fe1159
adefd663b8ac6e23334eabc27a98d932d197e4b2
be455d90aaef880f909a8a2a9be74f3e5d61d52e
refs/heads/master
2020-12-26T02:59:26.459514
2019-11-07T15:29:47
2019-11-07T15:29:47
23,952,267
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.6377314925193787, "alphanum_fraction": 0.6412037014961243, "avg_line_length": 30.418182373046875, "blob_id": "9978d7980b162d210a9253c314252d76011706db", "content_id": "389d172d2a887570c31b0c980d8d2f3182b1f9cc", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1728, "license_type": "no_license", "max_line_length": 115, "num_lines": 55, "path": "/comuneimola/compensi/validators.py", "repo_name": "abstract-open-solutions/comuneimola.compensi", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\nfrom Products.validation.interfaces.IValidator import IValidator\nfrom zope.interface import implements\nfrom comuneimola.compensi import compensiMessageFactory as _\nfrom Products.Archetypes.interfaces import IObjectPostValidation\nfrom comuneimola.compensi.interfaces.atcompenso import IATCompenso\nfrom comuneimola.compensi import compensiMessageFactory as mf\nfrom zope.component import adapts\nfrom zope.i18n import translate\nimport sys\n\n\nclass FloatValidator:\n \"\"\"\n Validator for amount\n \"\"\"\n if sys.version_info[:2] >= (2, 6):\n implements(IValidator)\n else:\n __implements__ = (IValidator,)\n\n def __init__(self, name):\n self.name = name\n\n def __call__(self, value, *args, **kwargs):\n \"\"\"\n Use hardening_tool to check if given file has a valid mimetype\n \"\"\"\n instance = kwargs.get('instance', None)\n if not instance:\n return True\n try:\n float(value)\n except:\n return translate(mf('wrong_value_error'),\n context=kwargs.get('instance').REQUEST)\n return True\n\n\nclass CompensiPostValidation(object):\n implements(IObjectPostValidation)\n adapts(IATCompenso)\n\n def __init__(self, context):\n self.context = context\n\n def __call__(self, request):\n \"\"\"Validate the context object. Return a dict with keys of fieldnames\n and values of error strings.\n \"\"\"\n norm = request.get('norm')\n other_norm = request.get('other_norm')\n if norm == 'other' and other_norm.strip() == '':\n return {'other_norm': _(u\"If you select 'other' in the previous form, you must write something here.\")}\n return {}\n" }, { "alpha_fraction": 0.7340182662010193, "alphanum_fraction": 0.7363013625144958, "avg_line_length": 30.285715103149414, "blob_id": "ba0763f17e7c3e6e5698dd69bde22112eaa51454", "content_id": "fa1a1d6e8a8279f4c8d381ae1476ea4a49691a73", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 876, "license_type": "no_license", "max_line_length": 77, "num_lines": 28, "path": "/comuneimola/compensi/__init__.py", "repo_name": "abstract-open-solutions/comuneimola.compensi", "src_encoding": "UTF-8", "text": "\"\"\"Main product initializer\n\"\"\"\n\nfrom comuneimola.compensi import config\n\nfrom Products.Archetypes import atapi\nfrom Products.CMFCore import utils\n\nfrom zope.i18nmessageid import MessageFactory\ncompensiMessageFactory = MessageFactory('comuneimola.compensi')\n\nfrom Products.validation import validation\nfrom validators import FloatValidator\nvalidation.register(FloatValidator('isFloat'))\n\n\n\ndef initialize(context):\n content_types, constructors, ftis = atapi.process_types(\n atapi.listTypes(config.PROJECTNAME),\n config.PROJECTNAME)\n\n for atype, constructor in zip(content_types, constructors):\n utils.ContentInit('%s: %s' % (config.PROJECTNAME, atype.portal_type),\n content_types=(atype, ),\n permission=config.ADD_PERMISSIONS[atype.portal_type],\n extra_constructors=(constructor,),\n ).initialize(context)\n" }, { "alpha_fraction": 0.7138461470603943, "alphanum_fraction": 0.7138461470603943, "avg_line_length": 28.545454025268555, "blob_id": "4bf2e346d29f10d5e0f4867c7497d2a613194e7e", "content_id": "d15f77e06f958a54ef168b2c31da1453a5d74a27", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 325, "license_type": "no_license", "max_line_length": 65, "num_lines": 11, "path": "/comuneimola/compensi/config.py", "repo_name": "abstract-open-solutions/comuneimola.compensi", "src_encoding": "UTF-8", "text": "\"\"\"Common configuration constants\n\"\"\"\n\nPROJECTNAME = 'comuneimola.compensi'\n\nADD_PERMISSIONS = {\n # -*- extra stuff goes here -*-\n 'ATAreaCompensi': 'comuneimola.compensi: Add ATAreaCompensi',\n 'ATCompenso': 'comuneimola.compensi: Add ATCompenso',\n 'ATLinkCompenso': 'comuneimola.compensi: Add ATLinkCompenso',\n}\n" }, { "alpha_fraction": 0.7301835417747498, "alphanum_fraction": 0.7348691821098328, "avg_line_length": 35.58571243286133, "blob_id": "dde73238cf8c4603aecfd595bdcb749d06d9c119", "content_id": "8f010f104e1839dcfc5c85fcc4762f52f89301c0", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "reStructuredText", "length_bytes": 2561, "license_type": "no_license", "max_line_length": 288, "num_lines": 70, "path": "/README.rst", "repo_name": "abstract-open-solutions/comuneimola.compensi", "src_encoding": "UTF-8", "text": "comuneimola.compensi\n====================\n\nCompatibility\n-------------\n\nTests have been made with:\n\n * Plone 3.3.5\n * Plone 4.2.1\n\nInstallation Notes\n------------------\n * If you are installing the product for use with versions prior to plone 4, the version of collective.js.datatables in the buildout must be set to 1.9.\n * The translation feature of the table, missing in collective.js.datatables 1.9 has been put in the package and under the condition Plone < 4.\n\nOperation\n---------\nOnce the product is installed you can add \"Fees Area\" objects. Inside these objects, you can add \"Fees\" objects.\n\nThe display area is set to use a view based on collective.js.datatables.\n\nA button allows you to download the contents of the table / folder in csv format.\n\nA manager must create the area. We suggest to add collection portlets to the area, to find private fees and the fees to be reviewed, for the convenience of authenticated users.\n\n\nWorkflow\n--------\nAs for the workflow of \"Fee\" objects, for now we decided to stay as close as possible to the simple publication wf of Plone.\n\nThe publisher of the document (Contributor role)\n * can add an entry\n * can add one or more links / attachments\n * can not change private items belonging to other publishers\n * may require the publication to any reviewer\n * can publish directly\n * once published:\n\n * can no longer revoke the publication\n * can not add / remove links / attachments.\n\nThe Editor role given by sharing, takes the form of a proxy to work on the \"fee\" object.\n\nA Reviewer:\n * may withdraw an item published to correct the data entered, or modify them limited to those data not affecting the effectiveness of the contract.\n\n\"Manager\" and \"Site Administrator\" can do everything, but still they should be used just in cases when only a superuser can solve a specific situation. Only these two roles can perform actions to delete, rename, cut and paste \"fees\".\n\nTo apply workflow actions (such as sending in revision and publication, back, etc..) to \"fee\" objects and its \"Link\" attachments (the \"File\" does not have any workflow, are public but follow the workflow of their container), you must use the \"Advanced ...\" function from the \"state\" menu.\n\n\nCredits\n-------\n\nDeveloped by the `City of Imola`__\n\nThe City of Imola supports the `PloneGov initiative`__.\n\n__ http://www.comune.imola.bo.it/\n__ http://www.plonegov.it/\n\n\nAuthors\n-------\nThe product was developed by\n\n.. image:: http://www.redturtle.net/redturtle_banner.png\n :alt: RedTurtle Technology Site\n :target: http://www.redturtle.net/\n" }, { "alpha_fraction": 0.637558102607727, "alphanum_fraction": 0.6402820348739624, "avg_line_length": 34.66285705566406, "blob_id": "125c531321c9b1602ee4c4412c44475d8449fea0", "content_id": "27483e83ecb241d54e015efe9534d63f1181f1e7", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 6241, "license_type": "no_license", "max_line_length": 263, "num_lines": 175, "path": "/comuneimola/compensi/content/atcompenso.py", "repo_name": "abstract-open-solutions/comuneimola.compensi", "src_encoding": "UTF-8", "text": "\"\"\"Definition of the ATCompenso content type\n\"\"\"\n\nfrom zope.interface import implements\n\nfrom Products.Archetypes import atapi\nfrom Products.Archetypes.utils import DisplayList\nfrom Products.ATContentTypes.content import folder\nfrom Products.ATContentTypes.content import schemata\n\nfrom comuneimola.compensi.interfaces.atcompenso import IATCompenso\nfrom comuneimola.compensi.config import PROJECTNAME\nfrom comuneimola.compensi import compensiMessageFactory as _\n\nATCompensoSchema = folder.ATFolderSchema.copy() + atapi.Schema((\n atapi.StringField('fiscal_data',\n required=True,\n searchable=True,\n widget=atapi.StringWidget(\n label=_(u'fiscal_data_label', default=u'Tax code or VAT number'),\n description=_(u'fiscal_data_help', default=u\"Insert the tax code or the VAT number\"),\n size=60,\n ),\n ),\n\n atapi.StringField('amount',\n required=True,\n validators=('isFloat'),\n widget=atapi.StringWidget(\n label=_(u'amount_label', default=u'Amount'),\n description=_(u'amount_help',\n default=u\"Insert the amount of remuneration (the amount is meant in Euro, format X.YY)\"),\n size=40,\n ),\n ),\n\n atapi.StringField('amount_type',\n required=True,\n vocabulary='amountTypeVocab',\n widget=atapi.SelectionWidget(\n label=_(u'amount_type', default=u'Amount type'),\n description=_(u'amount_type_help', default=u\"Select the type of amount\"),\n ),\n ),\n\n atapi.StringField('norm',\n required=True,\n storage=atapi.AnnotationStorage(migrate=True),\n vocabulary='normVocabulary',\n widget=atapi.SelectionWidget(\n label=_(u'norm_label', default=u'Norm'),\n description=_(u'norm_help', default=u\"Insert a short text to describe the norm.\"),\n ),\n ),\n\n atapi.StringField('other_norm',\n widget=atapi.StringWidget(\n label=_(u'other_norm_label', default=u'Other norm'),\n description=_(u'other_norm_help', default=u\"If you select other in the previous field, write here the value (max 60 characters)\"),\n maxlength=60,\n size=70,\n ),\n ),\n\n atapi.StringField('office',\n required=True,\n vocabulary='officeVocab',\n widget=atapi.SelectionWidget(\n label=_(u'office_label', default=u'Office'),\n description=_(u'office_help', default=u\"Select the office responsible\"),\n ),\n ),\n\n atapi.StringField('responsible',\n required=True,\n widget=atapi.StringWidget(\n label=_(u'responsible_label', default=u'Charge of the procedure'),\n description=_(u'responsible_help', default=u\"Specify the name of the charge of the procedure\"),\n size=50,\n ),\n ),\n\n atapi.StringField('award_procedures',\n required=True,\n vocabulary='awardProceduresVocab',\n widget=atapi.SelectionWidget(\n label=_(u'award_procedures_label', default=u'Procedures for the award'),\n description=_(u'award_procedures_help', default=u\"Select the award procedures\"),\n ),\n ),\n\n atapi.TextField('note',\n required=False,\n storage=atapi.AnnotationStorage(migrate=True),\n widget=atapi.TextAreaWidget(\n label=_(u'note_label', default=u'Note'),\n rows=4,\n maxlength=400,\n ),\n ),\n\n))\n\nATCompensoSchema['title'].widget.label = _(u'title_label', default=u'Name of beneficiary')\nATCompensoSchema['description'].widget.visible = False\nATCompensoSchema['effectiveDate'].widget.description = _(u'effectiveDate_help', default=u'If you set this date the item will be visible starting from this date. If you do not insert the date the item will be published immediately with the action of publication.')\nATCompensoSchema['effectiveDate'].widget.visible = {'edit': 'invisible', 'view': 'visible'}\nATCompensoSchema['expirationDate'].widget.visible = {'edit': 'invisible', 'view': 'visible'}\n\n# Set storage on fields copied from ATFolderSchema, making sure\n# they work well with the python bridge properties.\nATCompensoSchema['title'].storage = atapi.AnnotationStorage()\nATCompensoSchema['description'].storage = atapi.AnnotationStorage()\n\nschemata.finalizeATCTSchema(\n ATCompensoSchema,\n folderish=True,\n moveDiscussion=False\n)\n\n\nclass ATCompenso(folder.ATFolder):\n \"\"\"AT Compenso\"\"\"\n implements(IATCompenso)\n\n portal_type = \"ATCompenso\"\n meta_type = \"ATCompenso\"\n schema = ATCompensoSchema\n\n title = atapi.ATFieldProperty('title')\n description = atapi.ATFieldProperty('description')\n\n def officeVocab(self):\n \"\"\" \"\"\"\n offices = DisplayList()\n offices.add('', _(u'-- not specified --'))\n for office in self.aq_parent.getElenco_uffici():\n offices.add(office, office)\n return offices\n\n def awardProceduresVocab(self):\n \"\"\" \"\"\"\n award_procedures = DisplayList()\n award_procedures.add('', _(u'-- not specified --'))\n for award_procedure in self.aq_parent.getModalita_affidamento():\n award_procedures.add(award_procedure, award_procedure)\n return award_procedures\n\n def amountTypeVocab(self):\n amountTypes = DisplayList()\n amountTypes.add('', _(u'-- not specified --'))\n for amountType in self.aq_parent.getNatura_importo():\n amountTypes.add(amountType, amountType)\n return amountTypes\n\n def normVocabulary(self):\n normTypes = DisplayList()\n normTypes.add('', _(u'-- not specified --'))\n for normType in self.aq_parent.getNorma_o_titolo():\n normTypes.add(normType, normType)\n normTypes.add('other', _(u'other'))\n return normTypes\n\n def show_alert(self):\n \"\"\"\n We need to be authenticated;\n In this folderish object no link should be present\n \"\"\"\n links = self.listFolderContents({'portal_type': 'ATLinkCompenso'})\n isAnon = self.portal_membership.isAnonymousUser()\n if len(links) == 0 and not isAnon:\n return True\n return False\n\natapi.registerType(ATCompenso, PROJECTNAME)\n" }, { "alpha_fraction": 0.6883116960525513, "alphanum_fraction": 0.6883116960525513, "avg_line_length": 18.25, "blob_id": "334917866cc1f3d4028e38eb24d115ae0ab594aa", "content_id": "897d1cd166cb8668f9328fa6b071957e6bd765d9", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 231, "license_type": "no_license", "max_line_length": 50, "num_lines": 12, "path": "/comuneimola/compensi/interfaces/atareacompensi.py", "repo_name": "abstract-open-solutions/comuneimola.compensi", "src_encoding": "UTF-8", "text": "from zope.interface import Interface\n# -*- Additional Imports Here -*-\n\n\nclass IATAreaCompensi(Interface):\n \"\"\"Area Compensi\"\"\"\n\n\nclass IMoneyFormat(Interface):\n \"\"\"\n Used to retrieve correct format as money value\n \"\"\"\n" }, { "alpha_fraction": 0.5794039964675903, "alphanum_fraction": 0.5817930102348328, "avg_line_length": 31.329267501831055, "blob_id": "39f6b8c49233a5f5ae5e2c128292c4bdf49fce51", "content_id": "af107c9dd1d64b0eb29677b362ad9fd8e7afa6b1", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 7956, "license_type": "no_license", "max_line_length": 97, "num_lines": 246, "path": "/comuneimola/compensi/browser/csv_export/export_documents.py", "repo_name": "abstract-open-solutions/comuneimola.compensi", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n\nfrom zope.interface import implements, Interface\nfrom Products.Five.browser import BrowserView\nfrom Products.CMFPlone.utils import getSiteEncoding\nfrom Products.CMFCore.utils import getToolByName\nfrom Products.CMFPlone.utils import normalizeString\nfrom DateTime import DateTime\nfrom zope.interface.interfaces import IInterface\nfrom ZPublisher.Iterators import IStreamIterator\nfrom comuneimola.compensi import compensiMessageFactory as mf\nfrom comuneimola.compensi.interfaces.atareacompensi import IMoneyFormat\nfrom zope.component import getUtility\nfrom zope.i18n import translate\nimport csv\nimport os\nimport tempfile\nimport shutil\nimport codecs\n\n\nclass ICsvExport(Interface):\n\n def get_elements(objects=False):\n \"\"\"\n @description: this method should return all the element we want export;\n in this poin we can decide to use brains or objects\n \"\"\"\n\n def get_query():\n \"\"\"\n @description: here we decide which object should find in the folder so,\n objects to export\n \"\"\"\n\n def write_element(writer, element):\n \"\"\"\n @description: take an element, a connection to a csv writer and write\n the row for the current element\n \"\"\"\n\n def write_elements_to_csv(element_to_export):\n \"\"\"\n @description: take elements and export them to a csv file\n \"\"\"\n\n def get_fields():\n \"\"\"\n @description: get all the fields we want export\n \"\"\"\n\n\nNAME_MAPPING = {'title': 'Titolo',\n 'fiscal_data': 'Dati fiscali',\n 'amount': 'Importo (€)'.decode('utf-8').encode('utf-8'),\n 'amount_type': 'Natura dell\\'importo',\n 'norm': 'Norma',\n 'other_norm': 'Altro',\n 'office': 'Ufficio',\n 'responsible': 'Responsabile procedimento',\n 'award_procedures': 'Modalità di affidamento'.decode('utf-8').encode('utf-8'),\n 'effectiveDate': 'Data di pubblicazione',\n 'note': 'Note',\n }\n\n\nclass CsvExport(BrowserView):\n implements(ICsvExport)\n\n def __init__(self, context, request):\n self.context = context\n self.request = request\n self.response = self.request.RESPONSE\n self.encoding = getSiteEncoding(self.context)\n self.delimiter = ';'\n self.stringdelimiter = '\"'\n date = DateTime().strftime(\"%Y%m%d_%H%M\")\n folder_title = normalizeString(self.context.Title(),\n encoding=self.encoding)\n self.filename = date + '_' + folder_title + '.csv'\n self.moneyfmt = getUtility(IMoneyFormat)\n\n def __call__(self):\n tmp = tempfile.mkdtemp()\n tmppath = tempfile.mkdtemp(dir=tmp)\n csvpath = os.path.join(tmppath, self.filename)\n csvstream = open(csvpath, 'w')\n csvstream.write(codecs.BOM_UTF8)\n\n elements_to_export = self.get_elements(objects=True)\n self.write_elements_to_csv(csvstream, elements_to_export)\n\n csvstream.flush()\n csvstream.close()\n\n streamed = EphemeralStreamIterator(csvpath, delete_parent=True,)\n\n self.response.setHeader('Content-type',\n 'text/csv;charset=' + self.encoding)\n self.response.setHeader('Content-Disposition',\n \"attachment; filename=\" + self.filename)\n\n self.response.setHeader('Content-Length', str(len(streamed)))\n return streamed\n\n def write_element(self, writer, element):\n values = []\n addvalue = values.append\n for field in self.get_fields:\n value = element.getField(field).get(element)\n if field == 'effectiveDate':\n if value:\n value = value.strftime('%d/%m/%Y')\n if field == 'amount':\n value = self.moneyfmt.moneyfmt(value)\n if field == 'norm':\n if value == 'other':\n value = translate(mf('other'), context=self.request)\n if value:\n addvalue(value)\n else:\n addvalue(u\"\")\n writer.writerow(values)\n return\n\n def write_elements_to_csv(self, csvstream, elements_to_export):\n writer = csv.writer(csvstream,\n delimiter=self.delimiter,\n quotechar=self.stringdelimiter,\n quoting=csv.QUOTE_NONNUMERIC)\n\n encoded_field_names = [NAME_MAPPING[field] for field in self.get_fields]\n writer.writerow(encoded_field_names)\n\n for element in elements_to_export:\n\n if element == self.context:\n continue\n\n self.write_element(writer, element)\n\n return\n\n @property\n def get_fields(self):\n return ['title',\n 'fiscal_data',\n 'amount',\n 'amount_type',\n 'norm',\n 'other_norm',\n 'office',\n 'responsible',\n 'award_procedures',\n 'effectiveDate',\n 'note',\n ]\n\n @property\n def get_query(self):\n path = '/'.join(self.context.getPhysicalPath())\n query = {\n 'portal_type': 'ATCompenso',\n 'path': {\n 'query': path,\n 'depth': 1\n }\n }\n enabled_csv_states = self.context.getCsv_states()\n print enabled_csv_states\n states = enabled_csv_states or ['published', ]\n query['review_state'] = states\n return query\n\n def get_elements(self, objects=False):\n pc = getToolByName(self.context, 'portal_catalog')\n brains = pc(**self.get_query)\n if objects:\n return [brain.getObject() for brain in brains]\n return brains\n\n\n# Next code is taken from Products.csvreplicata. We don't use directly this\n# product 'cause I want keep things as simple as possible\n\n# badly stolen ideas from dexterity\n# see https://svn.plone.org/svn/plone/plone.dexterity/trunk/plone/dexterity/filerepresentation.py\n\nclass FileStreamIterator(object):\n \"\"\"Simple stream iterator to allow efficient data streaming.\n \"\"\"\n\n # Stupid workaround for the fact that on Zope < 2.12, we don't have\n # a real interface\n if IInterface.providedBy(IStreamIterator):\n implements(IStreamIterator)\n else:\n __implements__ = (IStreamIterator,)\n\n def __init__(self, path, size=None, chunk=1 << 16):\n \"\"\"Consume data (a str) into a temporary file and prepare streaming.\n\n size is the length of the data. If not given, the length of the data\n string is used.\n\n chunk is the chunk size for the iterator\n \"\"\"\n self.path = path\n self.file = open(path)\n self.file.seek(0)\n self.size = os.stat(path).st_size\n self.chunk = chunk\n\n def __iter__(self):\n return self\n\n def next(self):\n data = self.file.read(self.chunk)\n if not data:\n self.file.close()\n raise StopIteration\n return data\n\n def __len__(self):\n return self.size\n\n\nclass EphemeralStreamIterator(FileStreamIterator):\n \"\"\"File and maybe its parent directory is deleted when readed\"\"\"\n\n def __init__(self, path, size=None, chunk=1 << 16,\n delete_parent=False, delete_grand_parent=False):\n FileStreamIterator.__init__(self, path, size, chunk)\n self.delete_parent = delete_parent\n self.delete_grand_parent = delete_grand_parent\n\n def next(self):\n try:\n return FileStreamIterator.next(self)\n except:\n os.unlink(self.path)\n if self.delete_parent:\n shutil.rmtree(os.path.dirname(self.path))\n if self.delete_grand_parent:\n shutil.rmtree(os.path.dirname(os.path.dirname(self.path)))\n raise\n" }, { "alpha_fraction": 0.6838021278381348, "alphanum_fraction": 0.6838021278381348, "avg_line_length": 23.547618865966797, "blob_id": "587497465df95fa8a454159bc7e28f745563a2cd", "content_id": "4e8668b128c17cc383b6f1e514fd8ba91474040b", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1031, "license_type": "no_license", "max_line_length": 74, "num_lines": 42, "path": "/comuneimola/compensi/browser/vistacompensoview.py", "repo_name": "abstract-open-solutions/comuneimola.compensi", "src_encoding": "UTF-8", "text": "from zope.interface import implements, Interface\n\nfrom Products.Five import BrowserView\nfrom Products.CMFCore.utils import getToolByName\n\nfrom comuneimola.compensi.interfaces.atareacompensi import IMoneyFormat\nfrom zope.component import getUtility\n\n\nclass IVistacompensiView(Interface):\n \"\"\"\n vistacompensi view interface\n \"\"\"\n\n def test():\n \"\"\" test method\"\"\"\n\n\nclass vistacompensoView(BrowserView):\n \"\"\"\n vistacompensi browser view\n \"\"\"\n implements(IVistacompensiView)\n\n def __init__(self, context, request):\n self.context = context\n self.request = request\n self.mf = getUtility(IMoneyFormat)\n\n @property\n def portal_catalog(self):\n return getToolByName(self.context, 'portal_catalog')\n\n @property\n def portal(self):\n return getToolByName(self.context, 'portal_url').getPortalObject()\n\n def get_money_format(self, value):\n \"\"\"\n call the money format utility and convert the value\n \"\"\"\n return self.mf.moneyfmt(value)\n" }, { "alpha_fraction": 0.7602996230125427, "alphanum_fraction": 0.7602996230125427, "avg_line_length": 28.66666603088379, "blob_id": "04b44d715a6f14a139f3c2d6a830b422cfa4af01", "content_id": "b9f905bc5920f01b83ef78254105385f54ddcff2", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 267, "license_type": "no_license", "max_line_length": 71, "num_lines": 9, "path": "/comuneimola/compensi/viewlets/check_link.py", "repo_name": "abstract-open-solutions/comuneimola.compensi", "src_encoding": "UTF-8", "text": "from plone.app.layout.viewlets import ViewletBase\nfrom Products.Five.browser.pagetemplatefile import ViewPageTemplateFile\n\n\nclass CheckLink(ViewletBase):\n \"\"\"\n Show alert message if we don't have links\n \"\"\"\n render = ViewPageTemplateFile('check_link.pt')\n" }, { "alpha_fraction": 0.6399132609367371, "alphanum_fraction": 0.6399132609367371, "avg_line_length": 31.928571701049805, "blob_id": "c2ee60030de0b9dd5dec2499c8ce6e56b8968c2b", "content_id": "48fb0c1b44c47383adddedd71f566729041d2875", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2766, "license_type": "no_license", "max_line_length": 77, "num_lines": 84, "path": "/comuneimola/compensi/content/atareacompensi.py", "repo_name": "abstract-open-solutions/comuneimola.compensi", "src_encoding": "UTF-8", "text": "\"\"\"Definition of the ATAreaCompensi content type\n\"\"\"\n\nfrom zope.interface import implements\n\nfrom Products.Archetypes import atapi\nfrom Products.ATContentTypes.content import folder\nfrom Products.ATContentTypes.content import schemata\n\nfrom comuneimola.compensi.interfaces.atareacompensi import IATAreaCompensi\nfrom comuneimola.compensi.config import PROJECTNAME\nfrom comuneimola.compensi import compensiMessageFactory as _\n\nATAreaCompensiSchema = folder.ATFolderSchema.copy() + atapi.Schema((\n\n atapi.LinesField(name='elenco_uffici',\n widget=atapi.LinesWidget(\n label=_(u\"office_list\",\n default=u\"Office List\"),\n description=_(u\"office_list_description\",\n default=u\"List here offices for current area\"),\n ),\n required=False,\n ),\n atapi.LinesField(name='modalita_affidamento',\n widget=atapi.LinesWidget(\n label=_(u\"award_procedures_label\",\n default=u\"Procedures for the award\"),\n description=_(u\"relied_modality_description\",\n default=u\"List here the procedures for the award\"),\n ),\n required=False,\n ),\n atapi.LinesField(name='natura_importo',\n widget=atapi.LinesWidget(\n label=_(u\"type_of_amount_label\",\n default=u\"Type of amount\"),\n description=_(u\"type_of_amount_description\",\n default=u\"List here the types of amount\"),\n ),\n required=False,\n ),\n atapi.LinesField(name='norma_o_titolo',\n widget=atapi.LinesWidget(\n label=_(u\"type_of_norm\",\n default=u\"Type of norm or title\"),\n description=_(u\"type_of_norm_description\",\n default=u\"List here the norm or title\"),\n ),\n required=False,\n ),\n atapi.LinesField(name='csv_states',\n widget=atapi.MultiSelectionWidget(\n label=_(u\"Review state allowed to be exported into CSV\"),\n format='checkbox'\n ),\n required=False,\n vocabulary_factory='plone.app.vocabularies.WorkflowStates',\n ),\n\n))\n\nATAreaCompensiSchema['title'].storage = atapi.AnnotationStorage()\nATAreaCompensiSchema['description'].storage = atapi.AnnotationStorage()\n\nschemata.finalizeATCTSchema(\n ATAreaCompensiSchema,\n folderish=True,\n moveDiscussion=False\n)\n\n\nclass ATAreaCompensi(folder.ATFolder):\n \"\"\"Area Compensi\"\"\"\n implements(IATAreaCompensi)\n\n portal_type = \"ATAreaCompensi\"\n meta_type = \"ATAreaCompensi\"\n schema = ATAreaCompensiSchema\n\n title = atapi.ATFieldProperty('title')\n description = atapi.ATFieldProperty('description')\n\natapi.registerType(ATAreaCompensi, PROJECTNAME)\n" }, { "alpha_fraction": 0.806921660900116, "alphanum_fraction": 0.806921660900116, "avg_line_length": 25.14285659790039, "blob_id": "071dc30adaa78b328afad479d698da9225906497", "content_id": "672df8c0e2056a8ee8db5c1a01e609a1f866b09d", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 549, "license_type": "no_license", "max_line_length": 74, "num_lines": 21, "path": "/comuneimola/compensi/content/atlinkcompenso.py", "repo_name": "abstract-open-solutions/comuneimola.compensi", "src_encoding": "UTF-8", "text": "from zope.interface import implements\n\nfrom Products.Archetypes import atapi\nfrom Products.ATContentTypes.content import link\n\nfrom comuneimola.compensi.interfaces.atlinkcompenso import IATLinkCompenso\nfrom comuneimola.compensi.config import PROJECTNAME\n\nATLinkCompensoSchema = link.ATLinkSchema.copy()\n\n\nclass ATLinkCompenso(link.ATLink):\n \"\"\"Area Compensi\"\"\"\n implements(IATLinkCompenso)\n\n portal_type = \"ATLinkCompenso\"\n meta_type = \"ATLinkCompenso\"\n schema = ATLinkCompensoSchema\n\n\natapi.registerType(ATLinkCompenso, PROJECTNAME)\n" }, { "alpha_fraction": 0.6795580387115479, "alphanum_fraction": 0.6795580387115479, "avg_line_length": 21.625, "blob_id": "9b005d2846540ddf8dca1bb17badb51275f7b258", "content_id": "c2e0e65ca8bb64b144b1532d92cc3e3e0b2c31ca", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 181, "license_type": "no_license", "max_line_length": 41, "num_lines": 8, "path": "/comuneimola/compensi/interfaces/atlinkcompenso.py", "repo_name": "abstract-open-solutions/comuneimola.compensi", "src_encoding": "UTF-8", "text": "from zope.interface import Interface\n# -*- Additional Imports Here -*-\n\n\nclass IATLinkCompenso(Interface):\n \"\"\"AT Link per Compenso\"\"\"\n\n # -*- schema definition goes here -*-\n" }, { "alpha_fraction": 0.6512820720672607, "alphanum_fraction": 0.6520146727561951, "avg_line_length": 25.764705657958984, "blob_id": "1b0abc72a0807e700dab559d8ce378a5353f6735", "content_id": "367221b915856bff917b99dd6e996cde27194604", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1365, "license_type": "no_license", "max_line_length": 71, "num_lines": 51, "path": "/comuneimola/compensi/browser/vistaareacompensiview.py", "repo_name": "abstract-open-solutions/comuneimola.compensi", "src_encoding": "UTF-8", "text": "from zope.interface import implements, Interface\nfrom Products.Five import BrowserView\nfrom Products.CMFCore.utils import getToolByName\nfrom comuneimola.compensi.interfaces.atareacompensi import IMoneyFormat\nfrom zope.component import getUtility\n\n\nclass IVistaareacompensiView(Interface):\n \"\"\"\n vistaareacompensi view interface\n \"\"\"\n\n def contenuti_folder():\n \"\"\" test method\"\"\"\n\n def show_export_button():\n \"\"\" policy to decide how can see the button\"\"\"\n\n\nclass vistaareacompensiView(BrowserView):\n \"\"\"\n vistaareacompensi browser view\n \"\"\"\n implements(IVistaareacompensiView)\n\n def __init__(self, context, request):\n self.context = context\n self.request = request\n self.mf = getUtility(IMoneyFormat)\n\n @property\n def portal_catalog(self):\n return getToolByName(self.context, 'portal_catalog')\n\n def contenuti_folder(self):\n path = '/'.join(self.context.getPhysicalPath())\n query = {'path': {'query': path, 'depth': 1}}\n brains = self.portal_catalog(**query)\n return brains\n\n def show_export_button(self):\n \"\"\"\n Right now, everybody can see it\n \"\"\"\n return True\n\n def get_money_format(self, value):\n \"\"\"\n call the money format utility and convert the value\n \"\"\"\n return self.mf.moneyfmt(value)\n" } ]
13
diegocruz10/speechrecognition
https://github.com/diegocruz10/speechrecognition
38bab9f1089f7bc9068eeb715a5d875abd293647
5c2dff8010dab534bf1e404adb11aaa36e5008ca
dd35ee912b061cc1866adeb47fee58dbd3150557
refs/heads/master
2020-04-18T23:20:49.334356
2019-01-27T14:57:00
2019-01-27T14:57:00
167,818,958
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.5370078682899475, "alphanum_fraction": 0.5559055209159851, "avg_line_length": 23.384614944458008, "blob_id": "53764650bd92f7ce2edfb68109bb4c0975781c9d", "content_id": "358359899a49f5a7afcc563f72270fcb0684208a", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 635, "license_type": "no_license", "max_line_length": 44, "num_lines": 26, "path": "/Menu/test.py", "repo_name": "diegocruz10/speechrecognition", "src_encoding": "UTF-8", "text": "import speech_recognition as sr\n\nprint(\"***********************************\")\nprint(\"*Bienvenido, Seleccione una opcion*\")\nprint(\"***********************************\")\nprint(\"\")\t\nprint(\"1. One\")\nprint(\"2. Two\")\nprint(\"3. Three\")\nprint(\"4. Four\")\n\nr = sr.Recognizer()\nwith sr.Microphone() as source:\n\tprint(\"...\")\n\taudio = r.listen(source)\n\ntext = r.recognize_google(audio)\t\n\t\nif(text == \"One\" or text == \"1\"):\n\tprint(\"Option 1 selected\")\t\nelif(text == \"Two\" or text == \"2\"):\n\tprint(\"Option 2 selected\")\nelif(text == \"Three\" or text == \"3\"):\n\tprint(\"Option 3 selected\")\nelif(text == \"Four\" or text == \"4\"):\n\tprint(\"Option 4 selected\")\n\t" } ]
1
felipaoo/mindocker
https://github.com/felipaoo/mindocker
17e89ebeaaecc987458008608ba4e4be1a8e4d5b
6ade6590876e79c63459260c48dbc946ca9688bb
9af4991c3e85a15d86775f01320b61fe5271d945
refs/heads/master
2020-04-10T15:42:42.175475
2018-12-10T06:10:03
2018-12-10T06:10:03
161,119,709
0
0
MIT
2018-12-10T05:04:41
2018-12-10T05:32:10
2018-12-10T06:10:04
Python
[ { "alpha_fraction": 0.7548387050628662, "alphanum_fraction": 0.7677419185638428, "avg_line_length": 14.399999618530273, "blob_id": "381fd1d3d60d3c40c349fcc2f537eee5596f7c8d", "content_id": "0107c750085f9fe6245fcdc40b3ca60cf3f5f38b", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Dockerfile", "length_bytes": 155, "license_type": "permissive", "max_line_length": 36, "num_lines": 10, "path": "/Dockerfile", "repo_name": "felipaoo/mindocker", "src_encoding": "UTF-8", "text": "FROM python:3.6-alpine\n\nCOPY requirements.txt /\n\nRUN pip install -r /requirements.txt\n\nCOPY . /mindocker\nWORKDIR /mindocker\n\nCMD python mindocker/main.py\n\n" }, { "alpha_fraction": 0.5763546824455261, "alphanum_fraction": 0.5763546824455261, "avg_line_length": 19.200000762939453, "blob_id": "dbb0a05231e4a59c448f7d41874ffcc947e09f26", "content_id": "dc09ade2772266a52dd50dca20271d37c01a223c", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 203, "license_type": "permissive", "max_line_length": 28, "num_lines": 10, "path": "/mindocker/main.py", "repo_name": "felipaoo/mindocker", "src_encoding": "UTF-8", "text": "def say_hello(name):\n return 'hello ' + name\n\ndef say_goodbye(name):\n return 'goodbye ' + name\n\nif __name__ == '__main__':\n name = 'vim'\n print(say_hello(name))\n print(say_goodbye(name))\n\n" }, { "alpha_fraction": 0.7575757503509521, "alphanum_fraction": 0.7575757503509521, "avg_line_length": 9.666666984558105, "blob_id": "5484509568f13f84c66bff0c92b7bda0d88708b3", "content_id": "c32b9aaaffb8b206c31cc4b489bb9f69bfff9855", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 33, "license_type": "permissive", "max_line_length": 18, "num_lines": 3, "path": "/README.md", "repo_name": "felipaoo/mindocker", "src_encoding": "UTF-8", "text": "# mindocker\n\ndocker build tests\n\n" }, { "alpha_fraction": 0.6315789222717285, "alphanum_fraction": 0.6381579041481018, "avg_line_length": 20.64285659790039, "blob_id": "7246450a76ee9785f2ea002d2696d0c5a58b25b0", "content_id": "16b0fee8ac51624b2996c40ecb323824e6636ae9", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 304, "license_type": "permissive", "max_line_length": 49, "num_lines": 14, "path": "/tests/test_main.py", "repo_name": "felipaoo/mindocker", "src_encoding": "UTF-8", "text": "from mindocker.main import say_hello, say_goodbye\n\ndef test_main():\n assert 1 < 2\n\ndef test_say_hello():\n name = 'vim'\n expected = 'hello vim'\n assert say_hello(name) == expected\n\ndef test_say_goodbye():\n name = 'vim'\n expected = 'goodbye vim'\n assert say_goodbye(name) == expected\n\n" } ]
4
mdrisco4/Python-Command-Line-Contact-Book-Project
https://github.com/mdrisco4/Python-Command-Line-Contact-Book-Project
30fb9e54acb7bd025fc4ecc9dbd7360419689834
e0610861ef9a96da2945288f7a90952524af5ceb
f4bf0fe83be3b20f7cadf689686c3b2474016e8c
refs/heads/master
2020-12-15T19:18:33.046968
2020-01-29T19:34:09
2020-01-29T19:34:09
235,225,902
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.7649667263031006, "alphanum_fraction": 0.7671840190887451, "avg_line_length": 89.4000015258789, "blob_id": "b3af7f47d44a7a85f11bfff34971acf9b67d983e", "content_id": "61b363c7647a00fe81afdba2506263ae454ef9fa", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 451, "license_type": "no_license", "max_line_length": 271, "num_lines": 5, "path": "/README.md", "repo_name": "mdrisco4/Python-Command-Line-Contact-Book-Project", "src_encoding": "UTF-8", "text": "#Welcome to Contact Book\n###About\n######This is a command line program built with python and using sql and peewee to provide a database for for storing contact info.\n###How to use\n######To run the file enter python3 contacts.py from inside the folder that contains the file with the Python code or use the path file to navigate to the file. From there you can simply follow the prompts to create, read, update or delete any contacts that you need to." }, { "alpha_fraction": 0.5769124627113342, "alphanum_fraction": 0.5925245881080627, "avg_line_length": 28.592391967773438, "blob_id": "6b5dc06cb48814063c52c6c4f0c8db1c82d44dc7", "content_id": "f1ad85463531232a196658fc563d0769c24f8b27", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 10889, "license_type": "no_license", "max_line_length": 126, "num_lines": 368, "path": "/lib/contacts.py", "repo_name": "mdrisco4/Python-Command-Line-Contact-Book-Project", "src_encoding": "UTF-8", "text": "from peewee import *\nfrom datetime import date\nfrom create import *\nfrom read import *\nfrom update import *\nfrom delete import *\n\ndb = PostgresqlDatabase('contacts', user='postgres', password='',\n host='localhost', port=5432)\n\n# \\n == LINE BREAK\n\nclass BaseModel(Model):\n\n class Meta:\n database = db\n\nclass Contact(BaseModel):\n first_name = CharField()\n last_name = CharField()\n address = CharField()\n phone = CharField(max_length=10)\n email = CharField()\n # social_media = CharField()\n\n# class Name(BaseModel):\n# first = CharField()\n# last = CharField()\n\nclass Address(BaseModel):\n name = CharField()\n street = CharField()\n city = CharField()\n state = CharField()\n zip_code = CharField()\n\nclass Phone(BaseModel):\n name = CharField()\n home = CharField(max_length=10)\n cell = CharField(max_length=10)\n work = CharField(max_length=10)\n\nclass SocialMedia(BaseModel):\n name = CharField()\n twitter = CharField()\n facebook = CharField()\n instagram = CharField()\n snapchat = CharField()\n\ndb.connect()\ndb.drop_tables([Contact])\n# db.drop_tables([Name])\ndb.drop_tables([Phone])\ndb.drop_tables([SocialMedia])\ndb.create_tables([Contact])\n# db.create_tables([Name])\ndb.create_tables([Phone])\ndb.create_tables([SocialMedia])\n\n# CREATE\ntom = Contact(first_name='Thomas', last_name='Wayne', address='123 Gotham Alley', phone='0000000000', email='tom@mailbox.org')\nharvey = Contact(first_name='Harvey', last_name='Dent', address='Two Face Place', phone='7162375934', email='hdent24@gothamDAoffice.org')\njonathan = Contact(first_name='Johathan', last_name='Crane', address='000 Lunatic st', phone='0909090909', email='drcrane@arkham.org')\n# Setup Phone\n# Setup SocialMedia\nbob = Contact(first_name='Robert', last_name='Paulson', address='456 B st', phone='5859385758', email='robertpaulson@fightclub.com')\nbill = Contact(first_name='Bill', last_name='Murray', address='34 Venkman Place', phone='1098765432', email='drvenkman@ghostbusters.com')\nbarry = Contact(first_name='Barry', last_name='HBO', address='9 Sunday Night Way', phone='5858888888', email='billhader@greatshow.com')\n# Setup Phone\n# Setup SocialMedia\njoe = Contact(first_name='Joseph', last_name='Shmoe', address='789 C st', phone='2027384905', email='joeshmoe@lollygag.co')\njohn = Contact(first_name='John', last_name='Connor', address='1997 Judgement Day Circle', phone='worldsend', email='johnconnor@1991.T2')\njimmy = Contact(first_name='Jim', last_name='Morrison', address='71 Doors blvd', phone='0909090909', email='whenurastranger@kilmer.com')\njerry = Contact(first_name='Jerry', last_name='Rice', address='49 Haight st', phone='6500848990', email='bestreceiver@fris.co')\n# Setup Phone\n# Setup SocialMedia\nguy = Contact(first_name='Guy', last_name='People', address='1234 Place Way', phone='0912873477', email='guy@mail678.org')\ngreg = Contact(first_name='Gregory', last_name='Peck', address='56789 Location Ave', phone='9998887777', email='gp@yahoo.org')\ngregor = Contact(first_name='Gregor', last_name='Mountain', address='111 Cersei Place', phone='0000000000', email='themountain@imazombieorg')\n\ntom.save()\nharvey.save()\njonathan.save()\nbob.save()\nbill.save()\nbarry.save()\njoe.save()\njohn.save()\njimmy.save()\njerry.save()\nguy.save()\ngreg.save()\ngregor.save()\n\n# print(f\"{tom.first_name} {tom.last_name} {tom.address} {tom.phone} {tom.email}\")\n# print(f\"{bob.first_name} {bob.last_name} {bob.address} {bob.phone} {bob.email}\")\n# print(f\"{joe.first_name} {joe.last_name} {joe.address} {joe.phone} {joe.email}\")\n\n# READ (.get() and .select())\n\ndef get_info_by_first():\n print(' ')\n print('RETRIEVE CONTACT INFORMATION')\n print('Enter the person`s first name')\n print(' ')\n person = input('first name: ')\n print(' ')\n print(' ')\n print(' ')\n print(' ')\n try:\n if Contact.first_name == person:\n reply = Contact.get(Contact.first_name == person)\n print(\"CONTACT INFORMATION\")\n print(f\"Name: {reply.first_name} {reply.last_name}\")\n print(f\"Address: {reply.address}\")\n print(f\"Phone: {reply.phone}\")\n print(f\"Email: {reply.email}\")\n print(\" \")\n input(\"Hit ENTER to return home\")\n print(\" \")\n prompt_options()\n finally:\n print(' ')\n # print('INVALID RESPONSE')\n # input('Press ENTER to try again')\n get_info_by_first()\n # else:\n # prompt_options()\n\ndef see_all_contacts():\n contacts = Contact.select()\n for i in contacts:\n print(' ')\n print('ENTRY')\n print(f\"Name: {i.last_name}, {i.first_name}\")\n # print(f\"Last name: {i.last_name}\")\n print(f\"Address: {i.address}\")\n print(f\"Phone number: {i.phone}\")\n print(f\"Email: {i.email}\")\n print(f\"ID: {i.id}\")\n\ndef see_all_contacts_with_option():\n contacts = Contact.select()\n for i in contacts:\n print(' ')\n print('ENTRY')\n print(f\"Name: {i.last_name}, {i.first_name}\")\n print(f\"Address: {i.address}\")\n print(f\"Phone number: {i.phone}\")\n print(f\"Email: {i.email}\")\n # print(f\"Email: {i.id}\")\n print('')\n print('FIND YOUR CONTACT')\n print('')\n input('press ENTER to return to update')\n update_info_by_first()\n\n# UPDATE\n\ndef update_info_by_first():\n print(' ')\n print('UPDATE CONTACT PHONE NUMBER')\n print('Enter the person`s first name')\n print(' ')\n first = input('First name: ')\n new_phone = input('New phone number: ')\n try:\n reply = Contact.get(Contact.first_name == first)\n reply.phone = new_phone\n reply.save()\n prompt_options()\n\n finally:\n print(' ')\n print('INVALID RESPONSE')\n input('Press ENTER to try again')\n update_info_by_chioice()\n\ndef update_info_by_last():\n print(' ')\n print('UPDATE CONTACT PHONE NUMBER')\n print('Enter the person`s last name')\n print(' ')\n last = input('Last name: ')\n new_phone = input('New phone number: ')\n try:\n reply = Contact.get(Contact.first_name == last)\n reply.phone = new_phone\n reply.save()\n finally:\n print(' ')\n print('INVALID RESPONSE')\n input('Press ENTER to try again')\n update_info_by_chioice()\n\ndef update_info_by_phone():\n print(' ')\n print('UPDATE CONTACT PHONE NUMBER')\n print('Enter the person`s phone number')\n print(' ')\n phone = input('Phone number: ')\n new_phone = input('New phone number: ')\n try:\n reply = Contact.get(Contact.phone == phone)\n reply.phone = new_phone\n reply.save()\n finally:\n print(' ')\n print('INVALID RESPONSE')\n input('Press ENTER to try again')\n update_info_by_chioice()\n\ndef update_info_by_choice():\n print(' ')\n print('UPDATE CONTACT PHONE NUMBER')\n step1 = input('Enter S to submit a query or A to see all contacts: ')\n if step1 == 'S':\n print(' ')\n person = input('first name: ')\n new_phone = input('New phone number: ')\n try:\n reply = Contact.get(Contact.first_name == person)\n reply.phone = new_phone\n reply.save()\n prompt_options()\n finally:\n print(' ')\n print('INVALID RESPONSE')\n input('Press ENTER to try again')\n update_info_by_choice()\n elif step1 == 'A':\n see_all_contacts_with_option()\n else:\n print(' ')\n print('INVALID RESPONSE')\n input('Press ENTER to return home')\n prompt_options()\n\n \n# DELETE\n\ndef delete_contact_by_first():\n print(' ')\n print('REMOVE CONTACT')\n print('Enter the person`s first name')\n print(' ')\n person = input('first name: ')\n print(' ')\n try:\n reply = Contact.get(Contact.first_name == person)\n print(\"CONTACT INFORMATION\")\n print(f\"Name: {reply.first_name} {reply.last_name}\")\n print(f\"Address: {reply.address}\")\n print(f\"Phone: {reply.phone}\")\n print(f\"Email: {reply.email}\")\n print(' ')\n yes_no = input(f\"Are you sure you want to delete the contact info for \" + person + \"? Y or N: \")\n if yes_no == 'Y':\n print(' ')\n print('CONTACT DELETED')\n print(' ')\n input('Press ENTER to return home')\n reply = Contact.get(Contact.first_name == person)\n reply.delete_instance()\n prompt_options()\n elif yes_no == 'N':\n print(' ')\n input('Press ENTER to return home')\n prompt_options()\n else:\n print(' ')\n print('INVALID RESPONSE')\n input('Press ENTER to return home')\n prompt_options()\n finally:\n print(' ')\n print('INVALID RESPONSE')\n input('Press ENTER to try again')\n delete_contact_by_first()\n# CREATE\n\ndef add_contact(first_name, last_name, address, phone, email):\n print(' ')\n print('CREATE NEW CONTACT')\n print('if you have nothing to enter for a field press ENTER.')\n print(' ')\n first_name = input('First name: ')\n last_name = input('Last name: ')\n address = input('Address: ')\n phone = input('Phone: ')\n email = input('Email: ')\n # phone = input('Social Media: ')\n\n first_name = Contact(first_name=first_name, last_name=last_name, address=address, phone=phone, email=email)\n first_name.save()\n \n\n\n\n# NAVIGATION FUNCTION\n\ndef prompt_options():\n print(' ')\n print('WELCOME TO CONTACTS: PLEASE CHOOSE FROM THE FOLLOWING OPTIONS')\n print('Enter C to create a contact')\n print('Enter G to get a single contact`s info')\n print('Enter A to get all contacts` info')\n print('Enter U to update a contact')\n print('Enter D to delete a contact')\n print('Enter Q to exit')\n print(' ')\n action = input('ACTION: ')\n if str(action) == 'C':\n add_contact('first_name', 'last_name', 'address', 'phone', 'address')\n print('Contact created!')\n prompt_options()\n elif str(action) == 'G':\n get_info_by_first()\n print(' ')\n input('Hit ENTER to return home')\n prompt_options()\n elif str(action) == 'A':\n see_all_contacts()\n print(' ')\n input('Press ENTER to navigate to home screen')\n prompt_options()\n elif str(action) == 'U':\n update_info_by_choice()\n print('Contact phone number updated!')\n prompt_options()\n elif str(action) == 'D':\n delete_contact_by_first()\n print('Contact deleted!')\n prompt_options()\n elif str(action) == 'Q':\n exit()\n else:\n print(' ')\n print('INVALID RESPONSE')\n prompt_options()\n\n\n\nprompt_options()\n# see_all_contacts()\n\n\n\n\n\n\n# FUNCTION CALLS\n\n# CREATE\n# add_contact('first_name', 'last_name', 'address', 'phone', 'address')\n\n# GET ONE CONTACT\n# get_info_by_first()\n\n# DELETE\n# delete_contact_by_first()\n\n# UPDATE PHONE NUMBER\n# update_info_by_first()\n\n# GET ALL CONTACTS\n# see_all_contacts()" }, { "alpha_fraction": 0.7913485765457153, "alphanum_fraction": 0.792620837688446, "avg_line_length": 111.42857360839844, "blob_id": "e5bab34c01eab233bfcd9f03c199cd079a8b572f", "content_id": "6a60888be4b4af6c98f5afa280b2dfc584bdbea3", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 786, "license_type": "no_license", "max_line_length": 517, "num_lines": 7, "path": "/lib/README.md", "repo_name": "mdrisco4/Python-Command-Line-Contact-Book-Project", "src_encoding": "UTF-8", "text": "#CONTACT BOOK\n###About\nContact book is a python scripted program to store, update, view and delete your contacts from the terminal\n###How To Use\nThis app is super easy to use. To open just run python3 contacts.py out of the `lib` folder. You will be brought to a home screen that gives a variety of options. Follow the prompts to navigate around the app. CREATING and VIEWING your contacts is easy and straightforward. Updating your contacts will prompt you to either enter the name you wish to update or allow you to view all contacts in case you forgot the contact and/or spelling. Delete will confirm with a Y or N prompt before erasing any information.\n###Future Modifications\nPotential changes for this app include any debugging necessary and expanded functionality. ENJOY!!" } ]
3
alaale123/funny-python
https://github.com/alaale123/funny-python
17c13b826f388bf891af479b2a1a69139a241a10
acf9a7f99dcb0ecfad3fe8d1a3e8e934cb3a60e8
c2808c096897b76a601c5954dd4706af07544d4e
refs/heads/master
2023-02-13T12:09:49.561778
2020-12-22T12:08:47
2020-12-22T12:08:47
322,820,930
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.539301335811615, "alphanum_fraction": 0.5720524191856384, "avg_line_length": 30.06779670715332, "blob_id": "5bc92bc854308fa241ac0a57324e1b8cc88addba", "content_id": "d0fa4fd831e0bb4db8c72d4d5f68d671deb2fa74", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1832, "license_type": "no_license", "max_line_length": 129, "num_lines": 59, "path": "/myp.py", "repo_name": "alaale123/funny-python", "src_encoding": "UTF-8", "text": "from colorama import Fore, Back, Style\nimport datetime\nprint(Fore.GREEN+ 'Xisaabta Guriga')\nprint(u'\\u2630' * 50)\n\nx = str(datetime.datetime.now())\n\n\nprint(u'\\u26C4' + ' ' + 'kusoo dhawoow Zara Robot')\n\nprint(\" \")\nwho = input (u'\\u261B' + ' ' + 'Bishan yaa guriga xisaabtiisa haya: ')\n\nif who == 'dayib':\n print(u'\\u2639' + ' ' + 'waar waa ninkii dayib ahaa soo dhawoow wallo')\nelif who == 'salmaan':\n print(u'\\u263A' + ' ' + 'miskiinkii Alle Salmaan bhai')\n\nelif who == 'suul':\n print(u'\\u263B' + ' ' + 'waar waa suulkii cadaabta ahaa iska soo dhawoow sxb')\nelif who == 'mukhtaar':\n print(u'\\u265c' + ' ' + 'waar waa ninkii mukhtaar ee chess-ta jeclaa ')\n\nelif who == 'abdiaziz':\n print(u'\\u2764' + ' ' + 'waar waa Mulkiilihii soo dhawoow Mudane')\n\nelse:\n print(u'\\u26C4' + ' ' + 'barasho wacan mudane ' + who + ' ' + 'magacaygu waa zaara waxaan ahay Robot fahmi kara dadka') \n\n\n\n \n \n \n \n \n\n# print(who + ' ' + 'soo dhawoow wllo')\n\n\n\nkiro = int (input( u'\\u270F' + ' ' + 'Fadlan gali kirada guriga: '))\nnet = int (input(u'\\u270E' + ' ' + 'Fadlan gali lacagta internetka: '))\ngabadha = int (input(u'\\u270D' + ' ' + 'Fadlan gali gabadha shaqaalaha lacagteeda: '))\nelecteric = int (input(u'\\u2728' + ' ' + 'Fadlan gali lacagta laydhka: '))\ndust = int (input(u'\\u2711' + ' ' + 'Fadlan gali lacagta qashinka: '))\ngas = int (input( u'\\u2712' + ' ' + 'Fadlan gali lacagta gaska: '))\nfood = int (input( u'\\u2713' + ' ' + 'Fadlan gali lacagta cuntada: '))\n\n\n\nperson = int (input(u'\\u2A2C' + ' ' + 'imisa qof ayaad ku dagantihiin guriga: '))\n\n\ntotal = (kiro + net + gabadha + electeric + dust + gas)\nlast = total \nfinal = last / 5 + food\n\nprint(str(final) + 'tk' + ' ' + 'waxaana xisaabiyay' + ' ' + who + ' ' + x)" }, { "alpha_fraction": 0.624218761920929, "alphanum_fraction": 0.637499988079071, "avg_line_length": 19, "blob_id": "fc62daebbcdeed610afd3dfbff6d3c7a03710d58", "content_id": "61574f4bccb4c6e73cd0bc7a2510e70c30595b0c", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1280, "license_type": "no_license", "max_line_length": 109, "num_lines": 64, "path": "/cal.py", "repo_name": "alaale123/funny-python", "src_encoding": "UTF-8", "text": "print('KUSOO DHAWOOW ALALE ROBOT ')\n\n\nprint ('fadlan si aan kuugu sheego jawaabta saxda ah fadlan sisaxa u raac talaaba walba oo aan kuu sheego: ')\n\ndivide = input ('fadlan kala saar raga iyo dumarka: taabo Enter hadii aad kala saartay: ')\n\nlibin = input('fadlan libin laab tirada raga: taabo Enter hadii aad libin laabtay: ')\n\nugayn = input('fadlan ugee sadex tiradii aad libin laabtay ee Raga: taabo Enter hadii ad ugaysay: ')\n\nkudhufo = input ('fadlan shan ku dhufo tirada aad hayso hada ee Raga:taabo Enter hadii ku dhufatay: ')\n\nfinal = input('fadlan ugee tirada dumarka hadii ay jiraan totalka tirada aad hayso: ')\n\nok = int (input('fadlan gali iskugaynta guud ee tirada si aan kuugu sheego inta dumara iyo inta raga: '))\n\n\n\n\n\nlk = ok - 15\n\n\nani = [lk]\n\nmake = ani\n\ndigits = [str(x) for x in str(make)]\n# print(digits)\n\n\n\n\nd = (digits[2])\n\nif ok >=100:\n second = (digits[1] + digits[2])\n third = (digits[3])\n print(second + ' ' + ' rag ah')\n print(third + ' ' + ' dumara')\n\n\nelif ok < 25 :\n print(digits[1] + ' ' + 'gabadh ayay dhaleen ')\n print('wax rag ah may dhalin')\nelif ok >= 25:\n print(digits[1] + ' ' + 'Rag ah')\n print(digits[2] + ' ' + 'dumara')\n\nif d == '0':\n \n print('wax dumara may dhalin')\n \n\n\n \n\n\n\n\n\n\n# print(str( lk))\n" } ]
2
Autobots-CEH/Ethical-hacking-python-scripts
https://github.com/Autobots-CEH/Ethical-hacking-python-scripts
41ad0581429ad18615c0d589e0d432779d0273af
b10693d704f3c5282a99bd76268984a6687843a4
fea45721450d37dac6bbb2c29fea6acd72e65e11
refs/heads/master
2021-09-20T06:06:45.573644
2018-08-05T08:28:47
2018-08-05T08:28:47
null
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.6998695135116577, "alphanum_fraction": 0.7003045082092285, "avg_line_length": 36.04838562011719, "blob_id": "39cda4553141bb60bdc8605f235e6ba817bfc85f", "content_id": "c65eff916f8497db1150eb2280fd4671913c04b6", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2299, "license_type": "no_license", "max_line_length": 104, "num_lines": 62, "path": "/mac_changer/mac_changer.py", "repo_name": "Autobots-CEH/Ethical-hacking-python-scripts", "src_encoding": "UTF-8", "text": "#!/usr/bin/env python\n\nimport subprocess\n\n# Get info from user for command arguments\nimport optparse\nimport re\n\n# EXPLANATION\n# MAC Address or MEDIA ACCESS CONTROL\n# Is Permanent, physical and unique\n# Used within the network to identify devices and transfer data within devices\n# Each packet of data contains a source mac and destination mac\n# Allow impersonation of device and hide identity\n\ndef get_arguments():\n # Create parser object to handle user input\n parser = optparse.OptionParser()\n\n # User arguments to expect from user (-i or interface acceptable arguments)\n parser.add_option(\"-i\", \"--interface\", dest=\"interface\", help=\"Interface to change its MAC address\")\n parser.add_option(\"-m\", \"--mac\", dest=\"new_mac\", help=\"new MAC address\")\n\n # Understand and return user arguments\n (options, arguments) = parser.parse_args()\n\n if not options.interface:\n parser.error(\"[-] Please specify an interface, use --help for more info.\")\n elif not options.new_mac:\n parser.error(\"[-] Please specify a mac address, use --help for more info.\")\n\n return options\n\ndef change_mac(interface, new_mac):\n print(\"[+] Changing MAC address for \" + interface + \" to \" + new_mac)\n\n # Run linux commands through subprocess more securely using a list\n subprocess.call([\"ifconfig\", interface, \"down\"])\n subprocess.call([\"ifconfig\", interface, \"hw\", \"ether\", new_mac])\n subprocess.call([\"ifconfig\", interface, \"up\"])\n\ndef get_current_mac(interface):\n # Return output to check if mac is changed\n ifconfig_result = subprocess.check_output([\"ifconfig\", interface])\n # Search for regex object by pattern matching to mac_address format\n mac_address_search_result = re.search(r\"\\w\\w:\\w\\w:\\w\\w:\\w\\w:\\w\\w:\\w\\w\", ifconfig_result)\n\n if mac_address_search_result:\n return mac_address_search_result.group(0)\n else:\n print(\"[-] Could not read MAC address.\")\n\noptions = get_arguments()\ncurrent_mac = get_current_mac(options.interface)\nprint(\"Current MAC = \" + str(current_mac))\n\nchange_mac(options.interface, options.new_mac)\ncurrent_mac = get_current_mac(options.interface)\nif current_mac == options.new_mac:\n print(\"[+] MAC address was successfully changed to \" + current_mac)\nelse:\n print(\"[-] MAC address did not get changed.\")\n\n\n" }, { "alpha_fraction": 0.6876310110092163, "alphanum_fraction": 0.6939203143119812, "avg_line_length": 26.171428680419922, "blob_id": "a0e15ec19d1ddad25d3cfbc7611d968cd6545610", "content_id": "7bffdfcde3e918c4b3d333c86df6fdd9c6075621", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 954, "license_type": "no_license", "max_line_length": 83, "num_lines": 35, "path": "/arp_spoofer/arp_spoofer.py", "repo_name": "Autobots-CEH/Ethical-hacking-python-scripts", "src_encoding": "UTF-8", "text": "#!/usr/bin/env python\n\nimport scapy.all as scapy\n\n# ARP spoofing or poisoning (MAN IN THE MIDDLE)\n# Allows redirection of packets via hacking computer\n# Messages, websites, usernames, passwords\n# Each computer has ARP table\n# ARP is not secure\n\ndef get_mac(ip):\n # Create ARP ip address\n arp_request = scapy.ARP(pdst=ip)\n\n # Create ethernet object\n broadcast = scapy.Ether(dst=\"ff:ff:ff:ff:ff:ff\")\n\n # Combine ip and broadcast mac\n arp_request_broadcast = broadcast/arp_request\n\n answered_list = scapy.srp(arp_request_broadcast, timeout=1, verbose=\"false\")[0]\n\n # Selecting first element in list\n return answered_list[0][1].hwsrc\n\ndef spoof(target_ip, spoof_ip):\n\n target_mac = get_mac(target_ip)\n\n # Create ARP packet response\n # Op = 2 (Response) pdst=IP hwdst = MAC address psrc= Router ip\n packet = scapy.ARP(op=2, pdst=target_ip, hwdst=target_mac, psrc=spoof_ip)\n\n # Send response\n scapy.send(packet)\n\n\n\n" }, { "alpha_fraction": 0.6624161005020142, "alphanum_fraction": 0.6651006937026978, "avg_line_length": 26.61111068725586, "blob_id": "326a3fd6f5c302abd0568d54b68e193a5219e395", "content_id": "938dd6fb0555d3992c55b8404d288501be433ed7", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1490, "license_type": "no_license", "max_line_length": 86, "num_lines": 54, "path": "/network_scanner/network_scanner.py", "repo_name": "Autobots-CEH/Ethical-hacking-python-scripts", "src_encoding": "UTF-8", "text": "#!/usr/bin/env python\n\nimport scapy.all as scapy\nimport argparse\n\n# ARP = Address resolution protocol\n# Used for clients mapping an Internet protocol IP address\n# Discover devices on network and display IP address and mac address\n\ndef get_arguments():\n parser = argparse.ArgumentParser()\n\n # User arguments to expect from user (-i or interface acceptable arguments)\n parser.add_argument(\"-t\", \"--target\", dest=\"target\", help=\"Target IP / IP range.\")\n\n # Understand and return user arguments\n (options) = parser.parse_args()\n\n return options\n\ndef scan(ip):\n # Create ARP ip address\n arp_request = scapy.ARP(pdst=ip)\n\n # Create ethernet object\n broadcast = scapy.Ether(dst=\"ff:ff:ff:ff:ff:ff\")\n\n # Combine ip and broadcast mac\n arp_request_broadcast = broadcast/arp_request\n\n answered_list = scapy.srp(arp_request_broadcast, timeout=1, verbose=\"false\")[0]\n\n clients_list = []\n\n # Specify Target information from list\n for element in answered_list:\n\n client_dict = {\"ip\": element[1].psrc, \"mac\": element[1].hwsrc}\n\n clients_list.append(client_dict)\n # ip address / followed by mac address\n return(clients_list)\n\ndef print_res(results_list):\n\n # Print information header \\t tab\n print(\"IP\\t\\t\\tMAC Address\\n------------------------------------\")\n\n for client in results_list:\n print(client[\"ip\"] + \"\\t\\t\" + client[\"mac\"])\n\noptions = get_arguments()\nscan_result = scan(options.target)\nprint_res(scan_result)" } ]
3
fudgynubbles/conversion_calculator
https://github.com/fudgynubbles/conversion_calculator
49ddadf3a1ce737f29cbc864b9aa902156c3257d
075da5e208389e9e88d586f12121460cf5b3eddd
447224522c1f45003b6397f5a4b09289141d9fbe
refs/heads/master
2021-01-23T07:15:39.585049
2012-12-07T05:20:34
2012-12-07T05:20:34
null
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.6243426203727722, "alphanum_fraction": 0.6423741579055786, "avg_line_length": 29.204545974731445, "blob_id": "83c35c66ffe8f93679c6a7229f170fc69d965c97", "content_id": "d053e544e9b5cc699ccbee813f6c139584352eee", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1331, "license_type": "no_license", "max_line_length": 92, "num_lines": 44, "path": "/miles_km.py", "repo_name": "fudgynubbles/conversion_calculator", "src_encoding": "UTF-8", "text": "\n\n\n# Select calculator options for converting miles and kilometers\t\t\ndef miles_km():\n\tprint \"Enter '1' for mi to km, or '2' for km to mi\"\n\tinput = raw_input(\"> \").lower()\n\tif input == \"1\":\n\t\tprint \"Type a number to convert \\n'back' goes to previous menu \\n'done' goes to root menu\"\n\t\tprint \"-\" * 10\n\t\tmiles_to_km()\n\telif input == \"2\":\n\t\tprint \"Type a number to convert \\n'back' goes to previous menu \\n'done' goes to root menu\"\n\t\tprint \"-\" * 10\n\t\tkm_to_miles()\n\telif input == \"done\" or input == \"exit\":\n\t\timport project2\n\t\tproject2.whatyouwant()\n\telse:\n\t\tprint \"\\nSay '1', '2', or 'done'\\n\"\n\t\tmiles_km()\n\n# Selection 1: convert miles to kilometers\t\t\ndef miles_to_km():\n\tnumber = raw_input(\"Enter Miles \\n> \")\n\tif number == \"exit\" or number == \"done\":\n\t\timport project2\n\t\tproject2.whatyouwant()\n\telif number == \"back\":\n\t\tmiles_km()\n\telse:\n\t\tresult = float(number) * 1.61\n\t\tprint \"\\n%s miles is equal to %s kilometers.\\n\" % (str(number), str(result))\n\t\tmiles_to_km()\n\n# Selection 2: convert kilometers to miles\t\t\t\ndef km_to_miles():\n\tnumber = raw_input(\"Enter Kilometers \\n> \")\n\tif number == \"exit\" or number == \"done\":\n\t\timport project2\n\t\tproject2.whatyouwant()\n\telif number == \"back\":\n\t\tmiles_km()\n\telse:\n\t\tresult = float(number) * 0.62\n\t\tprint \"\\n%s kilometers is equal to %s miles.\\n\" % (str(number), str(result))\n\t\tkm_to_miles()" }, { "alpha_fraction": 0.5917202234268188, "alphanum_fraction": 0.6081370711326599, "avg_line_length": 22.350000381469727, "blob_id": "4c28cced3c005d7b42da77406f84c0994ffb3aa0", "content_id": "bd8d2706e4da2ce6d68bf4b29ed3e53af9288b57", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1401, "license_type": "no_license", "max_line_length": 92, "num_lines": 60, "path": "/currency.py", "repo_name": "fudgynubbles/conversion_calculator", "src_encoding": "UTF-8", "text": "# Currency converter\n\n\ndef currency():\n\tprint \"Enter '1' for USD to TWD, or '2' for TWD to USD\"\n\tinput = raw_input(\"> \").lower()\n\tif input == \"1\":\n\t\tprint \"Type a number to convert \\n'back' goes to previous menu \\n'done' goes to root menu\"\n\t\tprint \"-\" * 10\n\t\tusd_to_twd()\n\telif input == \"2\":\n\t\tprint \"Type a number to convert \\n'back' goes to previous menu \\n'done' goes to root menu\"\n\t\tprint \"-\" * 10\n\t\ttwd_to_usd()\n\telif input == \"done\" or input == \"exit\":\n\t\timport project2\n\t\tproject2.whatyouwant()\n\telse:\n\t\tprint \"\\nSay '1', '2', or 'done'\\n\"\n\t\tcurrency()\n\n\ndef usd_to_twd():\n\tprint \"Enter USD amount\"\n\tnumber = raw_input(\"> \")\n\tif number == \"done\" or number == \"exit\":\n\t\timport project2\n\t\tproject2.whatyouwant()\n\telif number == \"back\":\n\t\tcurrency()\n\telse:\n\t\ttry:\n\t\t\tx = float(number)\n\t\t\tif True:\n\t\t\t\tresult = float(number) * 29.0\n\t\t\t\tprint \"\\nUS$%s is equal to NT$%s\\n\" % (str(number), str(result))\n\t\t\t\tusd_to_twd()\n\t\texcept:\n\t\t\tprint \"Not a number, dummy!\"\n\t\t\tusd_to_twd()\n\n\t\t\ndef twd_to_usd():\n\tprint \"Enter TWD amount\"\n\tnumber = raw_input(\"> \")\n\tif number == \"done\" or number == \"exit\":\n\t\timport project2\n\t\tproject2.whatyouwant()\n\telif number == \"back\":\n\t\tcurrency()\n\telse:\n\t\ttry:\n\t\t\tx = float(number)\n\t\t\tif True:\n\t\t\t\tresult = float(number) * 0.030\n\t\t\t\tprint \"\\nNT$%s is equal to US$%s\\n\" % (str(number), str(result))\n\t\t\t\ttwd_to_usd()\n\t\texcept:\n\t\t\tprint \"Not a number, dummy!\"\n\t\t\ttwd_to_usd()\n" }, { "alpha_fraction": 0.8387096524238586, "alphanum_fraction": 0.8427419066429138, "avg_line_length": 82, "blob_id": "04356c7f0af61dc60146251d770c0733051d00d4", "content_id": "13101634cd320081d0017cf74ff970652ca7fca7", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 248, "license_type": "no_license", "max_line_length": 91, "num_lines": 3, "path": "/README.md", "repo_name": "fudgynubbles/conversion_calculator", "src_encoding": "UTF-8", "text": "Just experimenting with importing, functions, recursion, and other concepts.\nProject2.py initializes the program and imports currency and miles_km to access calculators\nfor currency conversion and conversion from miles to kilometers and vice versa." }, { "alpha_fraction": 0.6246498823165894, "alphanum_fraction": 0.6395891904830933, "avg_line_length": 25.14634132385254, "blob_id": "80a2a74bc9598dec0e1ec2f349bb91625be2c3bd", "content_id": "73a97e49c5a6fd6178742d13cd6dd35bd2b0c4a5", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1071, "license_type": "no_license", "max_line_length": 128, "num_lines": 41, "path": "/project2.py", "repo_name": "fudgynubbles/conversion_calculator", "src_encoding": "UTF-8", "text": "#USEFUL CALCULATOR BITCHES!!!\nimport currency\nimport miles_km\n#prompt calculator type\ndef whatyouwant():\n\tcalclist = ['1: Currency Converter', '2: Miles and Kilometers', '3: Centimeters and Inches', '4: Pounds and Kilograms', 'Exit']\n\tfor i in calclist:\n\t\tprint i\n\tcalctype = raw_input(\"What kind of calculator would you like? \\n> \").lower()\n\tif calctype == \"done\" or calctype == \"exit\":\n\t\tprint \"Goodbye\"\n\telif calctype == \"1\":\n\t\tcurrency.currency()\n\telif calctype == \"2\":\n\t\tmiles_km.miles_km()\n\telif calctype == \"3\":\n\t\tcm_in()\n\telif calctype == \"4\":\n\t\tlbs_km()\n\n\n\t\t\ndef cm_in():\n\tprint \"Enter '1' for cm to in, or '2' for in to cm\"\n\tinput = raw_input(\"> \").lower()\n\tif input == \"1\":\n\t\tprint \"Type a number to convert \\n'back' goes to previous menu \\n'done' goes to root menu\"\n\t\tprint \"-\" * 10\n\t\tcm_to_in()\n\telif input == \"2\":\n\t\tprint \"Type a number to convert \\n'back' goes to previous menu \\n'done' goes to root menu\"\n\t\tprint \"-\" * 10\n\t\tin_to_cm()\n\telif input == \"done\" or input == \"exit\": \n\t\twhatyouwant()\n\telse:\n\t\tprint \"Try again, dummy\"\n\t\tcm_in()\n\t\t\n\nwhatyouwant()" } ]
4
BenHargreaves/Item-catalog
https://github.com/BenHargreaves/Item-catalog
b26386d650362d2cc469c4a5fb5fb8401bcea1fd
0b9cb808a97908e093fb51738aa9f8d0498f36be
c3e48646a3bcc8b5fad6229a95c4857720652092
refs/heads/master
2020-03-20T22:13:56.369434
2018-06-18T19:27:30
2018-06-18T19:27:30
137,786,942
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.7290502786636353, "alphanum_fraction": 0.755586564540863, "avg_line_length": 37.47311782836914, "blob_id": "e7619b498f368442e7f8a12f80635bbfe06cd2e6", "content_id": "fd79d445e1896e608afe34a2997fe448723ea577", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3580, "license_type": "no_license", "max_line_length": 186, "num_lines": 93, "path": "/itemseeder.py", "repo_name": "BenHargreaves/Item-catalog", "src_encoding": "UTF-8", "text": "from sqlalchemy import create_engine\nfrom sqlalchemy.orm import sessionmaker\n\nfrom database_setup import CatalogItem, Base, Category, User\n\nengine = create_engine('sqlite:///itemcatalog.db')\n# Bind the engine to the metadata of the Base class so that the\n# declaratives can be accessed through a DBSession instance\nBase.metadata.bind = engine\n\nDBSession = sessionmaker(bind=engine)\n# A DBSession() instance establishes all conversations with the database\n# and represents a \"staging zone\" for all the objects loaded into the\n# database session object. Any change made against the objects in the\n# session won't be persisted into the database until you call\n# session.commit(). If you're not happy about the changes, you can\n# revert all of them back to the last commit by calling\n# session.rollback()\nsession = DBSession()\n\n\"\"\" User1 = User(name = \"Benji\", email='ben@emailtest.com', picture='https://pbs.twimg.com/profile_images/2671170543/18debd694829ed78203a5a36dd364160_400x400.png')\nsession.add(User1)\nsession.commit() \"\"\"\n\nCategory1 = Category(name='Snowboarding', friendlyURL='snowboarding')\nsession.add(Category1)\nsession.commit()\n\nCategory2 = Category(name='Basketball', friendlyURL='basketball')\nsession.add(Category2)\nsession.commit()\n\nCategory3 = Category(name='Baseball', friendlyURL='baseball')\nsession.add(Category3)\nsession.commit()\n\nCategory4 = Category(name='Beach Sport', friendlyURL='beachsport')\nsession.add(Category4)\nsession.commit()\n\nCategory5 = Category(name='Cycling', friendlyURL='cycling')\nsession.add(Category5)\nsession.commit()\n\nCategory6 = Category(name='Weightlifting', friendlyURL='weightlifting')\nsession.add(Category6)\nsession.commit()\n\nCategory7 = Category(name='Track and Field', friendlyURL='trackandfield')\nsession.add(Category7)\nsession.commit()\n\nCategory8 = Category(name='Indoor Sport', friendlyURL='indoorsport')\nsession.add(Category8)\nsession.commit()\n\nItem1 = CatalogItem(title = 'Snowboard', friendlyTitle='snowboard', description = 'A Snowboard! Woohoo!', category_id = 1, user_id = 1)\nsession.add(Item1)\nsession.commit()\n\nItem2 = CatalogItem(title = 'Basketball', friendlyTitle='basketball', description = 'Now with turbo bounce tech! Cross your friends into the shadow realm.', category_id = 2, user_id = 1)\nsession.add(Item2)\nsession.commit()\n\nItem3 = CatalogItem(title = 'Baseball Bat',friendlyTitle='baseballbat', description = 'Heeeeeere Batter Batter Batter....SWING!', category_id = 3, user_id = 1)\nsession.add(Item3)\nsession.commit()\n\nItem9 = CatalogItem(title = 'Baseball Glove',friendlyTitle='baseballglove', description = 'Catch this!', category_id = 3, user_id = 1)\nsession.add(Item9)\nsession.commit()\n\nItem4 = CatalogItem(title = 'Spikeball kit',friendlyTitle='spikeballkit', description = 'Bro that def hit the rim. RE-DO!', category_id = 4, user_id = 1)\nsession.add(Item4)\nsession.commit()\n\nItem5 = CatalogItem(title = 'Bike',friendlyTitle='bike', description = '8 Speeds, 1 rider, 2 cool', category_id = 5, user_id = 1)\nsession.add(Item5)\nsession.commit()\n\nItem6 = CatalogItem(title = 'Squat Rack',friendlyTitle='squatrack', description = 'Never skip leg day', category_id = 6, user_id = 1)\nsession.add(Item6)\nsession.commit()\n\nItem7 = CatalogItem(title = 'Javelin', friendlyTitle='javelin', description = 'This baby can really fly!', category_id = 7, user_id = 1)\nsession.add(Item7)\nsession.commit()\n\nItem8 = CatalogItem(title = 'Table Tennis set', friendlyTitle='tabletennisset', description = 'Please read safety manual before playing', category_id = 8, user_id = 1)\nsession.add(Item8)\nsession.commit()\n\nprint \"Success!\"\n\n\n" }, { "alpha_fraction": 0.6435643434524536, "alphanum_fraction": 0.6485148668289185, "avg_line_length": 32.75, "blob_id": "e469b9933aa99d6dbb9b6dc32e4a0031132ee03b", "content_id": "0d1709a2034270587495c81eee46594cacc12f95", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "HTML", "length_bytes": 404, "license_type": "no_license", "max_line_length": 131, "num_lines": 12, "path": "/templates/deleteItem.html", "repo_name": "BenHargreaves/Item-catalog", "src_encoding": "UTF-8", "text": "{% extends \"main.html\" %}\n{% block content %}\n\n<h2>Delete Item</h2>\n<p>Are you sure you wish to delete {{ item.title }}?</p>\n<form action=\"{{ url_for('deleteItem', item_name = item.friendlyTitle, category_name = item.category.friendlyURL)}}\" method=\"POST\">\n {% if 'username' in session%}\n <button type=\"submit\" class=\"btn btn-primary\">Delete</button>\n {% endif %}\n</form>\n\n{% endblock content %}" }, { "alpha_fraction": 0.7333643436431885, "alphanum_fraction": 0.7473243474960327, "avg_line_length": 30.602941513061523, "blob_id": "db773185019cad08feb6dda9470c3108f0c56058", "content_id": "8cae9764b65a518422e276f2ef874890f924ce94", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 2149, "license_type": "no_license", "max_line_length": 157, "num_lines": 68, "path": "/README.md", "repo_name": "BenHargreaves/Item-catalog", "src_encoding": "UTF-8", "text": "# Item-catalog\nSimple item catalog application to store, view and edit data filtered by a 'category'.\n\n## Dependancies and modules\n- Python 2.7\n- Flask 1.12\n- SQLAlchemy / ORM\n- sqlite\n- oAuth2Client\n- httplib2 Module (Python)\n- JSON Module (Python)\n- Requests Module (Python)\n- Bootstrap 4.1\n- jQuery 3.3.1\n- popper.js 1.14\n\n\n## Installation and setup\n- Fork and Clone Repo\n- Run the Database_setup.py file first - this creates the Model and SQLite DB\n```\npython database_setup.py\n```\n(If run correctly, you should now see 2 new files, database_setup.pyc and itemcatalog.db)\n- Next, run the ItemSeeder.py file to load in some sample data to itemcatalog.db\n```\npython itemseeder.py\n```\n(your terminal console should display a 'success' message on completion)\n\n- Run the application server using your terminal window of choice\n```\npython application.py\n```\n- Open up a web Browser, and navigate to the following address (Port 8080 is requred)\n```\nhttp://localhost:8080/\n```\n- Log in to App using the Google Sign in button on any page first to initialize the first User (UserID 1)\n\nEvery item in the seeder code has a UserID of '1' by default. This user will not exist however until the first user has logged in successfully.\nThere is no way to edit / delete items through the UI unless you are logged in, but if you try to navigate to the JSON endpoints or Edit / Delete URLs before\nthe first usere has logged in, you may recieve a error.\n\n\n## JSON endpoint Usage\nThere are currently 3 url endpoints which will return JSON objects. These URLs are not visible through the UI.\n\n1. \n```\n'/catalog/all/JSON' \n```\nReturns a list of all items in the catalog, grouped by category\n\n2. \n```\n'/catalog/<item_category>/JSON' \n```\nReturns a list of items which are in the category specified in the <item_category> part of the URL. eg;\n '/catalog/snowbaording/JSON' will return a list of all items grouped under the 'snowboarding' category.\nFor categories with multiple words, simply remove the spaces eg;\n'/catalog/indoorsports/JSON' will return items in the 'Indoor Sports' category\n\n3. \n```\n'/catalog/JSON'\n```\nReturns all items in all categories, unfiltered.\n" }, { "alpha_fraction": 0.6550662517547607, "alphanum_fraction": 0.6579734683036804, "avg_line_length": 36.126983642578125, "blob_id": "0645f3d6c9f6e5a4b4d7ed93068a6ac962de5367", "content_id": "fd720f16900d24144581981595701b57dd56688a", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 11695, "license_type": "no_license", "max_line_length": 84, "num_lines": 315, "path": "/application.py", "repo_name": "BenHargreaves/Item-catalog", "src_encoding": "UTF-8", "text": "from flask import Flask, render_template, request, redirect, url_for, jsonify, flash\nfrom sqlalchemy import create_engine, asc, desc\nfrom sqlalchemy.orm import sessionmaker\nfrom oauth2client.client import flow_from_clientsecrets\nfrom oauth2client.client import FlowExchangeError\n\n# Flask session renamed login_session to avoid conflict with DB session\nfrom flask import session as login_session\nfrom flask import make_response\n\nimport httplib2\nimport json\nimport requests\n\nfrom database_setup import CatalogItem, Base, Category, User\n\n\napp = Flask(__name__)\n\n# Connect to Database and create database session\nengine = create_engine('sqlite:///itemcatalog.db')\nBase.metadata.bind = engine\n\nDBSession = sessionmaker(bind=engine)\nsession = DBSession()\n\n\n# Use Google oAuth to create and authenticate user\n@app.route('/gconnect', methods=['POST'])\ndef login():\n code = request.data\n flow = flow_from_clientsecrets(\n 'client_secrets.json', scope='', redirect_uri='postmessage')\n auth_uri = flow.step1_get_authorize_url()\n credentials = flow.step2_exchange(code)\n\n access_token = credentials.access_token\n url = ('https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=%s'\n % access_token)\n h = httplib2.Http()\n result = json.loads(h.request(url, 'GET')[1])\n\n userinfo_url = \"https://www.googleapis.com/oauth2/v2/userinfo\"\n params = {'access_token': credentials.access_token, 'alt': 'json'}\n answer = requests.get(userinfo_url, params=params)\n\n data = answer.json()\n\n # Load Google user info request into current login session\n login_session['username'] = data['name']\n login_session['firstname'] = data['given_name']\n login_session['picture'] = data['picture']\n login_session['email'] = data['email']\n\n # Checks if user already exists, else creates a new user\n user_id = getUserID(data['email'])\n if not user_id:\n user_id = createUser(login_session)\n login_session['user_id'] = user_id\n\n flash(\"Now logged in as %s\" % login_session['username'])\n\n return login_session['username']\n\n\n# disconnect user from current login session\n@app.route('/disconnect')\ndef disconnect():\n access_token = login_session.get('access_token')\n url = 'https://accounts.google.com/o/oauth2/revoke?token=%s' % access_token\n h = httplib2.Http()\n result = h.request(url, 'GET')[0]\n\n # If token successfully revoked or doesnt exist(expired),\n # delete login session user info\n if result['status'] == '200' or result['status'] == '400':\n del login_session['username']\n del login_session['picture']\n del login_session['email']\n del login_session['user_id']\n # display flash message depending on wether the logout was\n # a success, or the auth token didnt exist\n if result['status'] == 200:\n flash('You have been successfully logged out')\n else:\n flash('Invalid Auth token, Please sign in again.')\n\n return redirect(\"/catalog\", code=302)\n\n\n# Home page, default route. Most redirects end back here after\n# form posts/user login etc..\n# The 'Latest items' page shows most recently added items for all categories,\n# and is only visible on this route\n@app.route('/')\n@app.route('/catalog/')\ndef catalog():\n categories = session.query(Category).order_by(asc(Category.name))\n catalogItems = session.query(CatalogItem).order_by(\n desc(CatalogItem.id)).all()\n return render_template(\n 'latestitems.html', items=catalogItems, categories=categories)\n\n\n# List of items for a selected category\n@app.route('/catalog/<category_name>/items/')\ndef categoryItems(category_name):\n # 'categories' is used to populate the full category list\n # 'category' is used to search for the individual items of a category\n categories = session.query(Category).order_by(asc(Category.name))\n category = session.query(Category).filter_by(\n friendlyURL=category_name).one()\n category_id = category.id\n catalogItems = session.query(CatalogItem).filter_by(\n category_id=category_id).order_by(desc(CatalogItem.id)).all()\n return render_template('items.html',\n items=catalogItems,\n categories=categories, category=category)\n\n\n# View a single item in detail and provide links to edit / delete if authorized\n@app.route('/catalog/<category_name>/<item_name>/')\ndef itemDescription(category_name, item_name):\n categories = session.query(Category).order_by(asc(Category.name))\n category = session.query(Category).filter_by(\n friendlyURL=category_name).one()\n category_id = category.id\n item = session.query(CatalogItem).filter_by(\n category_id=category_id, friendlyTitle=item_name).one()\n return render_template('viewItem.html', item=item, categories=categories)\n\n\n# Create New Category\n@app.route('/catalog/category/new/', methods=['GET', 'POST'])\ndef newCategory():\n # If current user not in login session redirect to homepage\n if 'username' not in login_session:\n flash('You are not logged in!')\n return redirect('/catalog')\n\n if request.method == 'GET':\n categories = session.query(Category).order_by(asc(Category.name))\n return render_template('newCategory.html', categories=categories)\n else:\n newCategory = Category()\n if request.form['name']:\n newCategory.name = request.form['name']\n # FriendlyURL is used for an items route.\n # Without this, items with spaces would cause routing errors.\n friendlyURL = request.form['name'].lower()\n friendlyURL = friendlyURL.replace(' ', '')\n newCategory.friendlyURL = friendlyURL\n session.add(newCategory)\n session.commit()\n flash(\"New Category Added!\")\n return redirect(url_for('catalog'))\n\n\n# Create new Item\n@app.route('/catalog/item/new/', methods=['GET', 'POST'])\ndef newItem():\n if 'username' not in login_session:\n flash('You are not logged in!')\n return redirect('/catalog')\n\n categories = session.query(Category).order_by(asc(Category.name))\n\n if request.method == 'GET':\n return render_template('newItem.html', categories=categories)\n else:\n newItem = CatalogItem()\n if request.form['title']:\n newItem.title = request.form['title']\n # FriendlyTitle is used for an items route URL.\n # Removes spaces and transforms to lowercase\n friendlyTitle = request.form['title'].lower()\n friendlyTitle = friendlyTitle.replace(' ', '')\n newItem.friendlyTitle = friendlyTitle\n if request.form['description']:\n newItem.description = request.form['description']\n if request.form['category']:\n category = session.query(Category).filter_by(\n name=request.form['category']).one()\n newItem.category_id = category.id\n newItem.user_id = login_session['user_id']\n session.add(newItem)\n session.commit()\n flash('Item successfully added!')\n return redirect(url_for('catalog'))\n\n\n# Delete an Item\n@app.route(\n '/catalog/<category_name>/<item_name>/delete/', methods=['GET', 'POST'])\ndef deleteItem(item_name, category_name):\n if 'username' not in login_session:\n flash('You are not logged in!')\n return redirect('/catalog')\n\n category = session.query(Category).filter_by(\n friendlyURL=category_name).one()\n categories = session.query(Category).order_by(asc(Category.name))\n category_id = category.id\n item = session.query(CatalogItem).filter_by(\n category_id=category_id, friendlyTitle=item_name).one()\n\n if request.method == 'GET':\n if item.user_id != login_session['user_id']:\n # Displays alert that user is not authorized to perform this action\n flash('You are not authorized to delete this item.')\n return redirect(url_for('catalog'))\n return render_template(\n 'deleteItem.html', item=item, categories=categories)\n else:\n session.delete(item)\n session.commit()\n flash('Item successfully deleted')\n return redirect(url_for('catalog'))\n\n\n# Edit an item\n@app.route(\n '/catalog/<category_name>/<item_name>/edit/', methods=['GET', 'POST'])\ndef editItem(category_name, item_name):\n if 'username' not in login_session:\n flash('You are not logged in!')\n return redirect('/catalog')\n\n category = session.query(Category).filter_by(\n friendlyURL=category_name).one()\n categories = session.query(Category).order_by(asc(Category.name))\n category_id = category.id\n item = session.query(CatalogItem).filter_by(\n category_id=category_id, friendlyTitle=item_name).one()\n\n if request.method == 'GET':\n if item.user_id != login_session['user_id']:\n flash(\"\"\"\n You are not authorized to edit this item.\n Please create your own items in order to delete.\n \"\"\")\n return redirect('catalog')\n return render_template(\n 'editItem.html', item=item, categories=categories)\n else:\n if request.form['title']:\n # If Title edited, also update friendlyTitle to keep URL consistent\n item.title = request.form['title']\n friendlyTitle = request.form['title'].lower()\n friendlyTitle = friendlyTitle.replace(' ', '')\n item.friendlyTitle = friendlyTitle\n if request.form['description']:\n item.description = request.form['description']\n if request.form['category']:\n newCategory = session.query(Category).filter_by(\n name=request.form['category']).one()\n item.category_id = newCategory.id\n session.add(item)\n session.commit()\n flash('Item successfully edited')\n return redirect(url_for('catalog'))\n\n\n# Return all items as JSON object, grouped by category\n@app.route('/catalog/all/JSON')\ndef itemsByCategoryJSON():\n category = session.query(Category).all()\n catalogItems = [c.serialize for c in category]\n for ci in catalogItems:\n items = session.query(CatalogItem).filter_by(\n category_id=ci['ID']).all()\n if items != []:\n ci['items'] = [i.categorySerialize for i in items]\n return jsonify(allitems=catalogItems)\n\n\n# Return all items of category <item_category> specified in request\n@app.route('/catalog/<item_category>/JSON')\ndef itemsFilteredCategoryJSON(item_category):\n category = session.query(Category).filter_by(\n friendlyURL=item_category).one()\n items = session.query(CatalogItem).filter_by(category_id=category.id).all()\n return jsonify(items=[i.categorySerialize for i in items])\n\n\n# Return all items as JSON objects, unfiltered\n@app.route('/catalog/JSON')\ndef allItemsJSON():\n items = session.query(CatalogItem).all()\n return jsonify(catalogItems=[i.serialize for i in items])\n\n\n# Helper functions to create and return user details\ndef createUser(login_session):\n newUser = User(name=login_session['username'], email=login_session[\n 'email'], picture=login_session['picture'])\n session.add(newUser)\n session.commit()\n user = session.query(User).filter_by(email=login_session['email']).one()\n return user.id\n\n\n# Check if user already exists. Else return null\ndef getUserID(email):\n try:\n user = session.query(User).filter_by(email=email).one()\n return user.id\n except:\n return None\n\n\nif __name__ == '__main__':\n app.secret_key = 'super_secret_key'\n app.debug = True\n app.run(host='0.0.0.0', port=8080)\n" } ]
4
svalenti/deimos
https://github.com/svalenti/deimos
ab39d82217090a643610041f4e01662e32d52bae
257eaab375ad640f96ccd84d5c26b922c0c56935
9679bc1108a380bbae6ebf51852758248f60d060
refs/heads/master
2022-04-08T14:50:25.861296
2020-03-21T05:39:31
2020-03-21T05:39:31
214,344,141
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.5455882549285889, "alphanum_fraction": 0.550000011920929, "avg_line_length": 31.380952835083008, "blob_id": "97f5bfc9a6d7071a36e194f6f97f5ba3f62e2abd", "content_id": "abba7fd3920071f0d8621d813d55259ffb5d1842", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 680, "license_type": "permissive", "max_line_length": 82, "num_lines": 21, "path": "/trunk/setup.py", "repo_name": "svalenti/deimos", "src_encoding": "UTF-8", "text": "from distutils.core import setup\nfrom os import path\nfrom glob import glob\n\nsetup(\n name='deimos',\n version='1.0.0',\n author='S. Valenti',\n author_email='stfn.valenti@gmail.com',\n scripts=glob(path.join('bin', '*.py')),\n url='',\n license='LICENSE.txt', \n description='deimos is a package for spectra reduction',\n long_description=open('README.txt').read(),\n requires=['numpy','astropy','matplotlib','ccdproc'],\n packages=['deimos'],\n package_dir={'': 'src/'},\n package_data={'deimos': [\"standard/*txt\",\"standard/*dat\",\"resources/*/*/*/*\",\\\n \"resources/*/*/*/*/*\",\\\n \"resources/*/*/*\",\"resources/*/*\"]}\n)\n" }, { "alpha_fraction": 0.3400169610977173, "alphanum_fraction": 0.3459942042827606, "avg_line_length": 62.92149353027344, "blob_id": "af82debbd421e5e0e6dfc98eb39066d7e05659c5", "content_id": "bdc728de864aee6859baa5af754a4c09e8211b7e", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 68426, "license_type": "permissive", "max_line_length": 193, "num_lines": 1070, "path": "/trunk/bin/deimospectra.py", "repo_name": "svalenti/deimos", "src_encoding": "UTF-8", "text": "#!/usr/bin/env python\n#\n# python 3 script for deimos reduction\n#\n###############################################################\ndescription = \"> reduce deimos data, run the script in a directory with deimos data \"\nusage = \"%prog [--iraf (reduce with iraf )\\n --directory (reduce data in a different directory)\\n --interactive (reduce in interactive mode)\"\nimport deimos\nfrom deimos import deimosutil\nfrom optparse import OptionParser, OptionGroup\nimport pyds9\nimport os\nimport pickle\nimport time\nimport re\nimport sys\nimport numpy as np\nfrom scipy.interpolate import LSQBivariateSpline, LSQUnivariateSpline\nfrom scipy.interpolate import interp1d\nfrom scipy.optimize import fmin\nimport numpy.polynomial.legendre as leg\nfrom matplotlib import pylab as plt\nfrom astropy.io import fits\nimport glob\nfrom deimos import __path__ as _path\nfrom deimos import irafext\nfrom deimos import deimoswave\nimport string\n\n#os.environ[\"XPA_METHOD\"] = 'unix'\n\nfrom astropy.coordinates import SkyCoord\nfrom astropy import units as u\nstd, rastd, decstd, magstd = deimosutil.readstandard('standard_deimos_mab.txt')\nscal = np.pi / 180.\n \npyversion = sys.version_info[0]\n\n# check that ds9 is open \nplt.ion()\n#ds9 = pyds9.DS9(str(time.time()))\n#ds9 = pyds9.DS9('deimos')\n#ds9.set('frame 1')\n#ds9.set('scale zscale');\n\n# open two plot figures that will be used in the script \nfig3 = plt.figure(3)\nfig2 = plt.figure(2)\nverbose= True\n\nif __name__ == \"__main__\":\n parser = OptionParser(usage=usage, description=description, version=\"%prog 1.0\")\n parser.add_option(\"-d\", \"--directory\", dest=\"directory\", default=None, type=\"str\",\n help='reduce data in this directory \\t [%default]')\n parser.add_option(\"-F\", \"--force\", dest=\"force\", action=\"store_true\",default=False)\n parser.add_option(\"--iraf\", dest=\"iraf\", action=\"store_true\")\n parser.add_option(\"--nosky\", dest=\"nosky\", action=\"store_true\")\n parser.add_option(\"--stage\", dest=\"stage\", default=None, type=\"str\",\n help='reduce data a single stage \\t [%default, trim,trim+,sky,sky+,trace,trace+,extract,extract+,wave,wave+,flux,flux+]')\n \n parser.add_option(\"-i\", \"--interactive\", action=\"store_true\",\n dest='interactive', default=False, help='Interactive \\t\\t\\ [%default]')\n parser.add_option(\"--redo\", action=\"store_true\",\n dest='redo', default=False, help='redo \\t\\t\\ [%default]')\n parser.add_option(\"--shift\", dest=\"shift\", default=None, type=float,\n help='initial wavelength shift \\t [%default]')\n \n option, args = parser.parse_args()\n _interactive = option.interactive\n _redo = option.redo\n _iraf = option.iraf\n _nsky = option.nosky\n _directory = option.directory\n _force = option.force\n stage = option.stage\n if option.shift:\n initial_shift = option.shift\n else:\n initial_shift = 0.0\n \n if _interactive:\n verbose= True\n else:\n verbose= False\n #\n # initialize the dictionary with all the infos\n #\n dictionary, setup_object, setup_arc, setup_flat = deimosutil.checkalldata(directory=_directory,verbose=verbose)\n #\n # check that all data are in the directory and\n # \n run = True\n for key in setup_object:\n if key not in setup_arc:\n print('ERROR: not arc found with the same setup')\n run = False\n if key not in setup_flat:\n print('ERROR: not flat found with the same setup')\n run = False\n \n if run:\n for setup in setup_object:\n for img in setup_object[setup]:\n for key in [3,7]:\n ################## check if it is a standard and add it to the dictionary ######################3\n print(dictionary[img]['OBJECT'],dictionary[img]['RA'],dictionary[img]['DEC'])\n _dec = dictionary[img]['DEC']\n _ra = dictionary[img]['RA']\n c = SkyCoord(_ra, _dec, frame='icrs',unit=(u.hourangle, u.deg))\n _ra = c.ra.value\n _dec = c.dec.value\n dd = np.arccos(np.sin(_dec * scal) * np.sin(decstd * scal) +\n np.cos(_dec * scal) * np.cos(decstd * scal) *\n np.cos((_ra - rastd) * scal)) * ((180 / np.pi) * 3600)\n if np.min(dd) < 5200:\n dictionary[img]['std']= std[np.argmin(dd)]\n ######################################################\n print(setup)\n deimos.deimosutil.summary(dictionary)\n \n if setup[1] == 'LVMslitC':\n _dir = '_'.join(setup)\n if stage in [None,'trim','trim+']:\n # trim and rotate dimension 3 and 7\n dictionary = deimosutil.trim_rotate_split(setup_object, setup_flat, setup_arc, dictionary, setup, _force)\n else:\n print('skip trim')\n\n masterflat={} \n if stage in [None, 'trim+', 'flat', 'flat+']:\n # make masterflat3 and masterflat 7\n print(setup_flat)\n print(setup)\n masterflat['3'] = deimosutil.makeflat(setup_flat,dictionary,setup,3,verbose=True)\n masterflat['7'] = deimosutil.makeflat(setup_flat,dictionary,setup,7,verbose=True)\n for img in setup_object[setup]:\n for key in ['3','7']:\n dictionary[img]['masterflat'+str(key)]= masterflat[key]\n dictionary[img]['trimflat'+str(key)]= dictionary[img]['trimmed'+str(key)][0].data / masterflat[key]\n else:\n for key in ['3','7']:\n masterflatname = 'masterflat_' + _dir + '_' + str(key) + '.fits'\n if os.path.isfile(_dir +'/' + str(key) + '/' + masterflatname):\n print('found flat in the directory')\n hdu = fits.open(_dir + '/' + str(key) + '/' + masterflatname)\n masterflat[key] = hdu[0].data\n for img in setup_object[setup]:\n dictionary[img]['masterflat'+str(key)]= masterflat[key]\n dictionary[img]['trimflat'+str(key)]= dictionary[img]['trimmed'+str(key)][0].data / masterflat[key] \n else:\n print('flat field not found')\n ########################################################\n # \n ## This stage is done once and it is not related to stages\n #\n print('\\n#### Find curvature solution of different setup ')\n lambdas={}\n lamb={}\n for key in [3,7]:#lambdas:\n if os.path.isfile('lambdas_' + str(pyversion) + '_' + str(key) + '.dat'):\n print('\\n### I Found the curvature solution, skip this step')\n lambdas[key] = pickle.load(open(os.path.join('./','lambdas_' + str(pyversion) + '_' + str(key) + '.dat'), 'rb'))\n else:\n lambdas[key] = None\n \n if lambdas[key] is None:\n print('\\n### Select which arc do you want to use ')\n for img in setup_arc[setup]:\n if 'trimflat' + str(key) in dictionary[img]:\n image = dictionary[img]['trimflat' + str(key)]\n elif 'trimmed' + str(key) in dictionary[img]:\n image = dictionary[img]['trimmed' + str(key)][0].data\n deimosutil.image_plot(image,3,dictionary[img]['OBJECT'])\n if pyversion>=3:\n input(' see figure 3, ' + img+' ' + dictionary[img]['OBJECT'])\n else:\n raw_input(' see figure 3, ' + img+' ' + dictionary[img]['OBJECT'])\n if verbose:\n if pyversion>=3: \n img0 = input('which image do you want to use to do find the frame curvature [' + str(setup_arc[setup][0]) + ']? ')\n else:\n img0 = raw_input('which image do you want to use to do find the frame curvature [' + str(setup_arc[setup][0]) + ']? ')\n if not img0:\n img0 = setup_arc[setup][0]\n else:\n img = setup_arc[setup][0]\n\n # if you do not observe all arc together you can combine the frames \n if ',' in img0:\n import string\n imgarclist = string.split(img0,',')\n dictionary['arcmerge_' + str(key)] = dictionary[imgarclist[0]]\n dictionary['arcmerge_' + str(key)]['trimmed'+str(key)][0].data = dictionary[imgarclist[1]]['trimmed'+str(key)][0].data +\\\n dictionary[imgarclist[0]]['trimmed'+str(key)][0].data\n img0 = 'arcmerge_' + str(key)\n raw_input('stop here')\n \n lambdas[key] = deimosutil.retify_frame(img0, dictionary, key,True)\n \n img0 = setup_object[setup][0]\n if 'trimflat' + str(key) in dictionary[img]:\n image = dictionary[img0]['trimflat' + str(key)]\n else:\n image = dictionary[img0]['trimmed' + str(key)][0].data\n\n order = 2\n # get the a pixel coordinate near the image center\n ny, nx = image.shape\n cy, cx = ny//2, nx//2\n # create 1d arays of the possible x and y values\n xs = np.arange(nx)\n ys = np.arange(ny)\n # pixel coordinates for each pixel\n yvals, xvals = np.indices(image.shape)\n \n hwidth = 300 # width = 2 * hwidth + 1\n cols = np.arange(hwidth, nx, 2 * hwidth)\n cols = cols[1:]\n \n lambdafit = np.zeros(image.shape)\n for y in range(ny):\n c = np.polyfit(cols, lambdas[key][y, cols] - xs[cols], order)\n lambdafit[y, :] = np.polyval(c, xs) + xs\n\n lamb[key] = lambdafit\n if verbose:\n if pyversion>=3:\n input('lambda solution pixel by pixel found')\n else:\n raw_input('lambda solution pixel by pixel found')\n \n##############################################################################\n #####################################\n ########## sky subtraction ##################\n if stage in [None, 'sky', 'sky+', 'trim+', 'flat+']:\n print('\\n#### Sky Subtraction ') \n for key in [3,7]:#lambdas:\n if not os.path.isdir(_dir):\n os.mkdir(_dir)\n if not os.path.isdir(_dir + '/' + str(key)):\n os.mkdir(_dir + '/' + str(key))\n for img in setup_object[setup]:\n print(img,dictionary[img]['OBJECT'],key)\n dosky = True\n if 'nosky'+str(key) in dictionary[img] and _force==False:\n image = dictionary[img]['trimmed' + str(key)][0].data\n nosky = dictionary[img]['nosky' + str(key)]\n \n deimos.deimosutil.image_plot([image,nosky],frame=3,_title='image - nosky')\n \n if pyversion>=3:\n answ = input('do you want to do the sky subtraction again ? [y/n] [n]')\n else:\n answ = raw_input('do you want to do the sky subtraction again ? [y/n] [n]')\n if not answ: answ = 'n'\n if answ in ['n','N','NO','no']:\n dosky = False\n if dosky:\n imgnosky = re.sub('.fits','',img) + '_' + str(key) + '_nosky.fits'\n header = dictionary[img]['trimmed' + str(key)][0].header\n image = dictionary[img]['trimmed' + str(key)][0].data\n# if 'trimflat' + str(key) in dictionary[img]:\n# image = dictionary[img]['trimflat' + str(key)]\n# elif 'trimmed' + str(key) in dictionary[img]:\n# image = dictionary[img]['trimmed' + str(key)][0].data\n# else:\n# print('warning: no trim and no flat filded image found')\n \n if 1==1: \n objrows, skymask = deimosutil.find_sky_object(image, 0.3, key, True) \n yvals, xvals = np.indices(image.shape)\n lambdafit = lamb[key] \n # use the (unmasked) sky background pixels and fit the 2D spline\n skyfit = deimosutil.fit_sky(lambdafit[skymask], yvals[skymask], image[skymask])\n \n # evaluate the 2D sky at every pixel\n sky = skyfit.ev(lambdafit, yvals)\n \n if verbose:\n deimos.deimosutil.image_plot([image,image-sky],frame=3,_title='image - nosky')\n if pyversion>=3:\n input('sky subtraction: original sky and residual')\n else:\n raw_input('sky subtraction: original sky and residual')\n \n dictionary[img]['sky' + str(key)] = sky\n # subtract the sky\n nosky = image - sky\n dictionary[img]['nosky' + str(key)] = nosky\n \n # nosky\n if not os.path.isdir(_dir):\n os.mkdir(_dir)\n if not os.path.isdir(_dir + '/' + str(key)):\n os.mkdir(_dir + '/' + str(key))\n imgnosky = re.sub('.fits','',img) + '_' + str(key) + '_nosky.fits'\n nosky = dictionary[img]['nosky' + str(key)]\n _out = fits.ImageHDU(data=nosky, header= header)\n fits.writeto(_dir + '/' + str(key) + '/' + imgnosky, _out.data,header=_out.header,overwrite='yes')\n\n else:\n print('skip sky step')\n \n#####################################################################\n######################################## trace #############################\n# This stage is mainly to get the aperture and background region correct\n# the exact position of the trace will be then improved with possbile a shift\n#\n if stage in [None,'trace', 'sky+', 'trim+', 'flat+','trace+']:\n if _iraf:\n #\n # use iraf and add to the dictionary all the result\n #\n #\n for img in setup_object[setup]:\n for key in [3,7]:\n _ext_trace = False\n _dispersionline = False\n \n ## write nosky file from dictionary\n imgout = re.sub('.fits','',img) + '_' + str(key) + '_nosky.fits'\n nosky = dictionary[img]['nosky' + str(key)]\n header = dictionary[img]['trimmed' + str(key)][0].header\n _out = fits.ImageHDU(data=nosky,header=header)\n fits.writeto(imgout, _out.data,overwrite='yes')\n \n ###### trace using iraf and write trace in iraf database\n dictionary = deimos.irafext.extractspectrum(dictionary,img, key, _ext_trace, _dispersionline, verbose, 'obj') \n else:\n step = 50\n polyorder = 3\n sigma = 4\n niteration = 10\n for img in setup_object[setup]:\n for key in [3,7]:\n print('\\n#### Trace ',img) \n print(img,dictionary[img]['OBJECT'],key)\n dotrace = True\n if 'peakpos_'+str(key) in dictionary[img] and _force==False:\n imm = dictionary[img]['trimmed' + str(key)][0].data\n plt.figure(3)\n plt.clf()\n deimos.deimosutil.image_plot(imm,frame=3,_title=dictionary[img]['OBJECT'])\n peakpos1 = dictionary[img]['peakpos_'+str(key)]\n xs = np.arange(len(peakpos1))\n plt.plot(xs,peakpos1,'-c')\n plt.plot(xs,peakpos1 + float(dictionary[img]['aplow_'+str(key)]),'-w')\n plt.plot(xs,peakpos1 + float(dictionary[img]['aphigh_'+str(key)]),'-w')\n bkg = np.array(string.split(dictionary[img]['bckgrintervals_' + str(key)],','),float)\n for nn in bkg:\n plt.plot(xs,peakpos1 + nn,'-y')\n if pyversion>=3:\n answ = input('do you want to trace again (see figure 3) ? [y/n] [n]')\n else:\n answ = raw_input('do you want to trace again (see figure 3) ? [y/n] [n]')\n if not answ: answ = 'n'\n if answ in ['n','N','NO','no']:\n dotrace = False\n plt.clf()\n \n if dotrace:\n # the trace is better on skysutracted images\n _rawdataname = 'nosky'\n peakpos1,centerv,highv,fwhmv,dictionary = deimos.deimosutil.tracenew(img, dictionary, key, step, True, polyorder, sigma, niteration,rawdataname=_rawdataname)\n else:\n print('skip trace')\n#####################################################################\n# if _nsky:\n# print('\\n##### Warning: Trace on the trimmed image instead of the sky')\n# _rawdataname = 'trimmed'\n# else:\n# data = dictionary[img]['nosky'+str(key)]\n# center, lower, upper, l1,l2,u1,u2 = deimos.deimosutil.profile(data,dispersion=None)\n# print(center, lower, upper, l1,l2,u1,u2) \n# if key==3:\n# dictionary = deimosutil.trace(img,dictionary, 10, 85, 3, key, True)\n# else:\n# dictionary = deimosutil.trace(img,dictionary, 10, 60, 7, key, True)\n\n\n##################################################### extraction #############################\n if stage in [None,'extract', 'sky+', 'trim+', 'flat+', 'trace+', 'extract+']:\n for key in [3,7]:\n plt.figure(2)\n plt.clf()\n ysize = 0\n for mm,img0 in enumerate(setup_object[setup]):\n image0 = dictionary[img0]['trimmed' + str(key) ][0].data\n ny, nx = image0.shape\n ysize = np.max([ysize,ny])\n if 'peakpos_' + str(key) in dictionary[img0]:\n object0 = dictionary[img0]['OBJECT']\n peak0 = dictionary[img0]['peakpos_' + str(key)]\n xs0 = np.arange(len(peak0))\n plt.plot(xs0,peak0,'-', label=str(mm) + ' '+ object0)\n plt.ylim(0,ysize)\n plt.legend()\n \n for img in setup_object[setup]:\n print('\\n#### Extraction ',img) \n print(img,dictionary[img]['OBJECT'],key)\n doextraction = True\n if 'spec_basic'+str(key) in dictionary[img] and _redo==False:\n spec_basic = dictionary[img]['spec_basic' + str(key)]\n spec_opt = dictionary[img]['spec_opt' + str(key)]\n xx = np.arange(0,len(spec_basic))\n \n plt.figure(1)\n plt.clf()\n plt.plot(xx, spec_opt, label='optimal extraction')\n plt.plot(xx, spec_basic, label='basic extraction')\n plt.xlabel('pixels')\n plt.ylabel('counts')\n plt.legend()\n \n imm = dictionary[img]['trimmed' + str(key)][0].data\n plt.figure(3)\n plt.clf()\n deimos.deimosutil.image_plot(imm,frame=3,_title=dictionary[img]['OBJECT'])\n peakpos1 = dictionary[img]['peakpos_'+str(key)]\n xs = np.arange(len(peakpos1))\n plt.title('All Traces')\n plt.plot(xs,peakpos1,'-c')\n plt.plot(xs,peakpos1 + float(dictionary[img]['aplow_'+str(key)]),'-w')\n plt.plot(xs,peakpos1 + float(dictionary[img]['aphigh_'+str(key)]),'-w') \n bkg = np.array(string.split(dictionary[img]['bckgrintervals_' + str(key)],','),float)\n for nn in bkg:\n plt.plot(xx,peakpos1 + nn,'-y')\n \n if pyversion>=3:\n answ = input('do you want to extract again ? [y/n] [n]')\n else:\n answ = raw_input('do you want to extract again ? [y/n] [n]')\n if not answ: answ = 'n'\n if answ in ['n','N','NO','no']:\n doextraction = False\n \n if doextraction:\n dictionary = deimos.deimosutil.interactive_extraction(dictionary,img, key, setup_object[setup], _nsky, interactive=True)\n\n \n ############################################################################################################ \n ## write nosky file from dictionary\n readnoise = 16\n gain = 1\n apmedfiltlength = 61 # no idea what is it\n colfitorder, scattercut = 15, 25 # no idea what is it\n othertrace = None\n _shift = 0\n if _nsky:\n print('\\n##### Warning: extract on the trimmed image instead of the sky')\n _rawdataname = 'trimmed'\n else:\n _rawdataname = 'nosky'\n \n spec_opt, spec_basic, skybg_opt, spec_var = deimos.irafext.opextract_new(img, 0, 0, False, 1,\\\n readnoise, gain, apmedfiltlength,\n colfitorder, scattercut,\n colfit_endmask=10,\n diagnostic= False,\n production= True,\\\n other = othertrace, shift=_shift,\n dictionary=dictionary, key=key,\n rawdataname = _rawdataname,\n bckhigh = False, bcklow = False)\n \n # add exstraction to the dictionary\n # iraf dimensions (to be checked)\n # 1 optimal extraction\n # 2 basic extraction\n # 3 sky\n # 4 errors\n dictionary[img]['spec_basic' + str(key)]= spec_basic\n dictionary[img]['spec_opt' + str(key)]= spec_opt\n dictionary[img]['skybg_opt' + str(key)]= skybg_opt\n dictionary[img]['spec_var' + str(key)]= spec_var\n \n ######## my simple sum \n peakpos = dictionary[img]['peakpos_' + str(key)]\n xx = np.arange(0,len(peakpos))\n aplow = dictionary[img]['aplow_' + str(key)]\n aphigh = dictionary[img]['aphigh_' + str(key)]\n image = dictionary[img]['nosky' + str(key)]\n yvals, xvals = np.indices(image.shape)\n if 'trimflat' + str(key) in dictionary[img]: \n skyimage = dictionary[img]['trimflat' + str(key)]\n elif 'trimmed' + str(key) in dictionary[img]:\n skyimage = dictionary[img]['trimmed' + str(key)][0].data\n \n aa = [(yvals> peakpos + aplow) & (yvals < peakpos + aphigh )][0]*1\n bb = [(yvals< peakpos + aplow) | (yvals > peakpos + aphigh )][0]*1\n apsum = image * aa\n skysum = skyimage * bb\n spec_my = apsum.sum(axis=0)\n skymy = skysum.sum(axis=0)\n # do not normalize my sky here\n #skymy = (skymy - np.median(skymy))/np.max(skymy)\n dictionary[img]['mysky' + str(key)]= skymy\n dictionary[img]['mybasic' + str(key)]= spec_my\n \n imgout = re.sub('.fits','',img) + '_' + str(key) + '_' + dictionary[img]['OBJECT'] + '_ex.ascii'\n np.savetxt(_dir + '/' + str(key) + '/' + imgout,np.c_[xx,spec_basic,spec_opt,skybg_opt,spec_var,spec_my,skymy],\\\n header=' pixel spec_basic spec_opt skybg_opt spec_var mybasic mysky')\n \n if verbose:\n plt.figure(3)\n plt.clf()\n deimos.deimosutil.image_plot(skysum,3)\n plt.figure(1)\n plt.clf()\n plt.plot(xx, spec_opt, label='optimal extraction')\n plt.plot(xx, spec_basic, label='basic extraction')\n plt.xlabel('pixels')\n plt.ylabel('counts')\n plt.legend()\n \n if pyversion>=3:\n input('extraction completed')\n else:\n raw_input('extraction completed')\n else:\n print('skip extraction')\n# \n##### initial wavelengh calibration #############################\n#\n# I'm just using a default wavelengh calibration (solution on the top of the script)\n# We are missing at least a check with sky line (at the moment sky is plotted vs sky reference, missing cross correlation\n#\n##################################################################\n if stage in [None,'wave', 'sky+', 'trim+', 'flat+','trace+', 'extract+', 'wave+']:\n\n ######## load the sky reference\n skyref = np.genfromtxt(os.path.join(deimos.__path__[0]+'/resources//sky/','UVES_nightsky_lowres.dat'), names='wav, flux')\n # normalize sky spectrum\n skyref['flux'] = skyref['flux']-np.min(skyref['flux'])\n skyref['flux'] = skyref['flux']/np.max(skyref['flux'])\n # interpolate the sky template\n skyref_interp = interp1d(skyref['wav'], skyref['flux'], bounds_error=False)\n#############################################################################################\n\n arc = {}\n for key in [3,7]:\n print('\\n### Select which arc do you want to use ')\n for img in setup_arc[setup]:\n if 'trimflat' + str(key) in dictionary[img]:\n image = dictionary[img]['trimflat' + str(key)]\n elif 'trimmed' + str(key) in dictionary[img]:\n image = dictionary[img]['trimmed' + str(key)][0].data\n deimosutil.image_plot(image,3,dictionary[img]['OBJECT'])\n if pyversion>=3:\n input(' see figure 3, ' + img+' ')\n else:\n raw_input(' see figure 3, ' + img+' ')\n \n if pyversion>=3: \n arc0 = input('which image do you want to use to do wavelegnth calibration [' + str(setup_arc[setup][0]) + ']? ')\n else:\n arc0 = raw_input('which image do you want to use to do wavelength caibration [' + str(setup_arc[setup][0]) + ']? ')\n if not arc0:\n arc0 = setup_arc[setup][0]\n \n # if you do not observe all arc together you can combine the frames \n if ',' in arc0:\n import string\n imgarclist = string.split(arc0,',')\n dictionary['arcmerge_' + str(key)] = dictionary[imgarclist[0]]\n dictionary['arcmerge_' + str(key)]['trimmed'+str(key)][0].data = dictionary[imgarclist[1]]['trimmed'+str(key)][0].data +\\\n dictionary[imgarclist[0]]['trimmed'+str(key)][0].data\n arc[key] = 'arcmerge_' + str(key)\n else:\n arc[key] = arc0\n\n##################################################################################################\n\n\n sameforall = {}\n for key in [3,7]:\n imgout = 'arc_' + str(arc[key]) + '_' + _dir + '_' + str(key) + '.ascii'\n doit =False\n if os.path.isfile(_dir +'/' + str(key) + '/' + imgout):\n if _redo:\n answ='y'\n else:\n if pyversion>=3: \n answ = input('arc solution already there. Use this one for all images? [y] ')\n else:\n answ = raw_input('arc solution already there. Use this one for all images? [y] ')\n if not answ:\n answ = 'y'\n \n if answ in ['y','Y','yes']:\n\n # read extracted file and write down wavelenght calibrated\n for img in setup_object[setup]:\n print('read extracted file and write down wavelenght calibrated')\n data = np.genfromtxt(_dir +'/' + str(key) + '/' + imgout)\n pixel , flux, wave = zip(*data)\n wave = np.array(wave)\n \n # use my sky for wavelength check for scince frames\n sky = np.array(dictionary[img]['mysky' + str(key)])\n # use the flux for wavelength check for standards frames\n flux = dictionary[img]['spec_opt' + str(key)]\n # reject negative values\n sky[sky<0]=0\n # normalize my sky spectrum\n sky = sky - np.min(sky)\n sky = sky / np.max(sky)\n ##############################################################################################################################\n ##### load the arc trimmed image and extract the arc in the same way the object was extracted\n peakpos = np.array(dictionary[img]['peakpos_' + str(key)])\n aplow = dictionary[img]['aplow_' + str(key)]\n aphigh = dictionary[img]['aphigh_' + str(key)]\n \n if 'trimflat' + str(key) in dictionary[arc[key]]: \n imagearc = np.array(dictionary[arc[key]]['trimflat' + str(key)])\n elif 'trimmed' + str(key) in dictionary[arc[key]]:\n imagearc = np.array(dictionary[arc[key]]['trimmed' + str(key)])[0].data\n \n ny, nx = imagearc.shape\n # create 1d arays of the possible x and y values\n xs = np.arange(nx)\n ys = np.arange(ny)\n # pixel coordinates for each pixel \n yvals, xvals = np.indices(imagearc.shape)\n aa = [(yvals> peakpos + aplow) & (yvals < peakpos + aphigh )][0]*1\n arcsum = imagearc * aa\n arcspec = arcsum.sum(axis=0)\n#########################################################################################################\n # read wave from ascii file\n \n print('do shift')\n dictionary, wave= deimoswave.checkshift(img, dictionary, key, wave, arc, arcspec, sky, skyref, skyref_interp, setup, verbose = True )\n\n # adding the wave solution to the dictionary\n dictionary[img]['wave' + str(key)]= wave\n # storing the wave solution in the data folder\n spec_opt = dictionary[img]['spec_opt' + str(key)]\n spec_basic = dictionary[img]['spec_basic' + str(key)]\n skybg_opt = dictionary[img]['skybg_opt' + str(key)]\n spec_var = dictionary[img]['spec_var' + str(key)]\n skymy = dictionary[img]['mysky' + str(key)]\n spec_my = dictionary[img]['mybasic' + str(key)]\n \n imgwave = re.sub('.fits','',img) + '_' + str(key) + '_' + dictionary[img]['OBJECT'] + '_wave.ascii'\n np.savetxt(_dir + '/' + str(key) + '/' + imgwave,np.c_[wave, xs,spec_basic,spec_opt,skybg_opt,spec_var,spec_my,skymy, arcspec],\\\n header='wave pixel spec_basic spec_opt skybg_opt spec_var mybasic mysky arcspec')\n ## shift ' + str(shift))\n \n else:\n # do normal arc calibration\n doit = True\n else: \n # do normal arc calibration\n doit = True\n\n if doit is True:\n for img in setup_object[setup]:\n print('\\n#### wavelength solution: ',img) \n print(img,dictionary[img]['OBJECT'],key)\n dowave = False\n doshift = False\n \n###################################################################################################################################### \n # use my sky for wavelength check for scince frames\n sky = np.array(dictionary[img]['mysky' + str(key)])\n # use the flux for wavelength check for standards frames\n flux = dictionary[img]['spec_opt' + str(key)]\n \n # reject negative values\n sky[sky<0]=0\n # normalize my sky spectrum\n sky = sky - np.min(sky)\n sky = sky / np.max(sky)\n######################################################################################################################################\n ##### load the arc trimmed image and extract the arc in the same way the object was extracted\n peakpos = np.array(dictionary[img]['peakpos_' + str(key)])\n aplow = dictionary[img]['aplow_' + str(key)]\n aphigh = dictionary[img]['aphigh_' + str(key)]\n \n if 'trimflat' + str(key) in dictionary[arc[key]]: \n imagearc = np.array(dictionary[arc[key]]['trimflat' + str(key)])\n elif 'trimmed' + str(key) in dictionary[arc[key]]:\n imagearc = np.array(dictionary[arc[key]]['trimmed' + str(key)])[0].data\n \n ny, nx = imagearc.shape\n # create 1d arays of the possible x and y values\n xs = np.arange(nx)\n ys = np.arange(ny)\n # pixel coordinates for each pixel \n yvals, xvals = np.indices(imagearc.shape)\n aa = [(yvals> peakpos + aplow) & (yvals < peakpos + aphigh )][0]*1\n arcsum = imagearc * aa\n arcspec = arcsum.sum(axis=0)\n########################################################################################################################################\n\n answ = False\n if key in sameforall:\n if _redo:\n answ =True\n else:\n if pyversion>=3: \n answ = input('Do you want to use the same wavelength calibration computed before [y,Y,yes] [y]? ')\n else:\n answ = raw_input('Do you want to use the same wavelength calibration computed before [y,Y,yes] [y]? ')\n if not answ:\n answ = True\n elif answ in ['Y','y','yes']:\n answ = True\n else:\n answ= False\n else:\n answ= False\n \n if answ is True:\n #\n # use solution computed before\n #\n wave = sameforall[key]\n dowave = False\n doshift = True\n \n else:\n # do a new calibration\n dowave = True\n doshift = True\n \n if 'wave'+str(key) in dictionary[img] and _force is False:\n # there is a calibration already in the dictionary\n wave = dictionary[img]['wave' + str(key)]\n flux = dictionary[img]['spec_opt' + str(key)] \n plt.figure(1)\n plt.clf()\n plt.plot(wave,sky,'-r')\n plt.plot(skyref['wav'],skyref['flux'],'-b')\n\n# plt.plot(xs,arcspec,'r-')\n if pyversion>=3:\n answ = input('do you want to do wavelength solution again ? [y/n] [n]')\n else:\n answ = raw_input('do you want to do wavelength solution again ? [y/n] [n]')\n if not answ: answ = 'n'\n if answ in ['n','N','NO','no']:\n dowave = False\n doshift = False\n \n######################################################################################################\n if dowave:\n print('\\n#### wavelength solution ',img)\n print(arc[key])\n print(dictionary[img]['OBJECT'])\n dictionary[img]['arcfile' + str(key)]= arc[key]\n dictionary[img]['arcspec' + str(key)] = arcspec \n ################################################################\n reference = os.path.join(deimos.__path__[0]+'/resources/wave/', ('/').join(setup),str(key),'arc.fits')\n initial_solution = deimosutil.poly_arc[key]\n radius = 10\n edges = 7\n deg = 5\n \n finalsolution = deimos.deimoswave.wavesolution(reference, xs, arcspec, key, radius, edges, initial_solution, deg, initial_shift)\n print(finalsolution)\n p = np.poly1d(finalsolution)\n wave = p(xs)\n sameforall[key] = wave\n \n # write arc solution\n print('write arc solution')\n imgout = 'arc_' + str(arc[key]) + '_' + _dir + '_' + str(key) + '.ascii'\n np.savetxt(_dir + '/' + str(key) + '/' + imgout, np.c_[xs, arcspec, wave ], header='pixel flux wave')\n\n##################################################### check wave calibration #################################################\n # Here I check the wave solution for standard and object separetly\n if doshift:\n dictionary, wave= deimoswave.checkshift(img, dictionary, key, wave, arc, arcspec, sky, skyref, skyref_interp, setup, verbose = True )\n\n if dowave or doshift or _redo:\n print('save the new wavelength solution')\n # adding the wave solution to the dictionary \n dictionary[img]['wave' + str(key)]= wave\n # storing the wave solution in the data folder\n spec_opt = dictionary[img]['spec_opt' + str(key)]\n spec_basic = dictionary[img]['spec_basic' + str(key)]\n skybg_opt = dictionary[img]['skybg_opt' + str(key)]\n spec_var = dictionary[img]['spec_var' + str(key)]\n skymy = dictionary[img]['mysky' + str(key)]\n spec_my = dictionary[img]['mybasic' + str(key)]\n \n imgout = re.sub('.fits','',img) + '_' + str(key) + '_' + dictionary[img]['OBJECT'] + '_wave.ascii'\n np.savetxt(_dir + '/' + str(key) + '/' + imgout,np.c_[wave, xs,spec_basic,spec_opt,skybg_opt,spec_var,spec_my,skymy, arcspec],\\\n header='wave pixel spec_basic spec_opt skybg_opt spec_var mybasic mysky arcspec')\n ## shift ' + str(shift))\n else:\n print('skip wave')\n\n\n \n# dictionary[img]['arcfile' + str(key)]= arc[key]\n# dictionary[img]['arcspec' + str(key)] = arcspec \n# shift = 0\n# if 'std' not in dictionary[img].keys():\n# # check if it is monotonically increasing\n# dxa = np.diff(wave)\n# if (dxa > 0).all() is False:\n# print('invert vector')\n# sky0 = sky[::-1]\n# wave0 = wave[::-1]\n# else:\n # sky0 = sky\n # wave0 = wave\n # \n # guess = (.000001, 1.00001, 0.00001)\n # bestparams = fmin(deimos.deimoswave.get_lamp_difference, guess, args=(wave0, sky0, skyref_interp), maxiter=10000)\n # if (dxa > 0).all() is False:\n # shift = bestparams[0]\n # else:\n # shift = (-1) * bestparams[0]\n # \n # print('shift the spectrum of ',shift) \n # # wavelength calibration in the database\n # wave = wave + shift\n # \n # if verbose:\n # plt.figure(2)\n # fig2 = plt.figure(2)\n # fig2.clf()\n # # compare the reference spectrum and the extracted sky spectrum\n # ax2 = fig2.add_subplot(2, 1, 1)\n # ax22 = fig2.add_subplot(2, 1, 2)\n # ax2.plot(skyref['wav'], skyref['flux']/np.max(skyref['flux']))\n # ax2.axes.set_ylabel('Flux Density ($10^{16} f_{\\lambda}$)')\n # ax2.axes.set_xlabel('Wavelength ($\\AA$)')\n # ax2.plot(wave, sky0)\n \n# # plot the extracted sky spectrum \n# ax22.plot(wave, flux)\n# ax22.axes.set_ylabel('Counts')\n# ax22.axes.set_xlabel('wavelenght');\n# if pyversion>=3:\n# input('stop here')\n# else:\n# raw_input('stop here') \n# else:\n# ref_filename = os.path.join(deimos.__path__[0]+'/resources/sky/','std_telluric.fits')\n# imgout = 'std_'+ _dir + '_' + str(key) + '.ascii'\n# np.savetxt(imgout, np.c_[wave, flux ], header='wave flux ') \n# shift, scalefactor = deimos.deimoswave.checkwithtelluric(wave, flux , key, ref_filename, guess=(0.001,1.0001), verbose=True)\n# print ('myshift: '+str(shift))\n# print('shift the spectrum of ',shift) \n# # wavelength calibration in the database\n# wave = wave + shift\n####################################################################################################################\n #################################################################3#################################### \n #################################################################3####################################\n ############# make response\n if stage in [None,'response','sky+', 'trim+', 'flat+','trace+', 'extract+', 'wave+', 'response+']:\n std = []\n for img in setup_object[setup]:\n if 'std' in dictionary[img].keys():\n std.append(img)\n ##############################\n print(std)\n for img in std:\n for key in [3,7]:\n doresponse = True\n if 'response'+str(key) in dictionary[img] and _force==False:\n print(img,dictionary[img]['OBJECT'],key)\n response = dictionary[img]['response'+str(key)]\n wave = dictionary[img]['wave'+str(key)]\n plt.figure(2)\n plt.clf()\n plt.plot(wave,np.log10(response),'ob')\n if pyversion>=3:\n answ = input('do you want to comute the response again ? [y/n] [n]')\n else:\n answ = raw_input('do you want to comute the response again ? [y/n] [n]')\n if not answ: answ = 'n'\n if answ in ['n','N','NO','no']:\n doresponse = False\n if doresponse:\n std0 = dictionary[img]['std']\n liststd = glob.glob(_path[0]+'/resources/onedstds/*/'+std0)\n if not len(liststd):\n print('Error: standard name not found')\n if len(liststd):\n dostandard = True\n if len(liststd)>1:\n plt.figure(1)\n plt.clf()\n symbol='|1234x'\n jj=0\n for standard in liststd:\n print(standard)\n data = np.genfromtxt(standard)\n x,y,z = zip(*data)\n std_flux = deimos.deimosutil._mag2flux(np.array(x),np.array(y)) \n plt.plot(x,std_flux,symbol[jj],label=re.sub(_path[0],'',standard))\n jj = jj+1\n plt.legend()\n if pyversion>=3:\n standard = input('few standard file in the database, which one do you want to use?')\n else:\n standard = raw_input('few standard file in the database, which one do you want to use?')\n if not standard:\n standard = liststd[0]\n else:\n standard = liststd[0] \n else:\n dostandard = False\n else:\n dostandard = False\n \n print(dictionary[img]['OBJECT'])\n print(dostandard)\n if dostandard:\n std_spec = dictionary[img]['spec_opt'+str(key)]\n _exptime = dictionary[img]['EXPTIME']\n _airmass = dictionary[img]['AIRMASS']\n wave = dictionary[img]['wave'+str(key)]\n \n response = deimosutil.DefFluxCal(wave, std_spec, stdstar=re.sub(_path[0]+'/resources/onedstds/','',standard),\\\n mode='spline', polydeg=4, exptime= _exptime, airmass= _airmass,\\\n display=verbose, interactive= verbose)\n \n data = np.genfromtxt(standard)\n x,y,z = zip(*data)\n std_flux = deimos.deimosutil._mag2flux(np.array(x),np.array(y)) \n rep = response\n \n # save response function in the dictionary\n dictionary[img]['response'+str(key)] = rep\n dictionary[img]['wave'+str(key)] = wave\n \n # write response function in the directory\n imgout = re.sub('.fits','',img) + '_' + str(key) + '_' + dictionary[img]['OBJECT'] + '_response.ascii'\n np.savetxt(_dir + '/' + str(key) + '/' + imgout,np.c_[wave, rep],\\\n header='wave response ')\n if pyversion>=3:\n input('response function applyed to the standard')\n else:\n raw_input('response function applyed to the standard')\n else:\n print('skip sensitivitity function step')\n ######################################################### \n ######################################################### \n if stage in [None,'flux', 'sky+', 'trim+', 'flat+','trace+', 'extract+', 'wave+', 'response+', 'flux+']:\n # chose sensitivity\n use_standard = {}\n for key in [3,7]:\n std=[]\n use_standard[key] = None\n plt.figure(1)\n plt.clf()\n for img in setup_object[setup]:\n if 'response' + str(key) in dictionary[img] and 'std' in dictionary[img]:\n std.append(img)\n sens = dictionary[img]['response' +str(key)]\n wave = dictionary[img]['wave' +str(key)]\n name = dictionary[img]['OBJECT'] + ' ' + str(img)\n plt.plot(wave,np.log10(sens),'-', label=name)\n plt.legend()\n if len(std)>1:\n print(std)\n if pyversion>=3:\n img0 = input('which standard do you want to use?')\n else:\n img0 = raw_input('which standard do you want to use?') \n if not img0:\n use_standard[key] = std[0]\n else:\n use_standard[key] = img0\n else:\n use_standard[key] = std[0]\n \n ######################################\n # apply sensitivity\n _dir = '_'.join(setup)\n if not os.path.isdir(_dir):\n os.mkdir(_dir)\n for key in [3,7]:\n if not os.path.isdir(_dir + '/' + str(key)):\n os.mkdir(_dir + '/' + str(key))\n \n if use_standard[key]: \n for img in setup_object[setup]:\n doflux = True\n if 'spec_flux'+str(key) in dictionary[img] and _force==False:\n print(img,dictionary[img]['OBJECT'],key)\n if pyversion>=3:\n answ = input('do you want to flux calibrate again ? [y/n] [n]')\n else:\n answ = raw_input('do you want to flux calibrate again ? [y/n] [n]')\n if not answ: answ = 'n'\n if answ in ['n','N','NO','no']:\n doflux = False\n \n if doflux:\n spec_opt = np.array(dictionary[img]['spec_opt' + str(key)])\n wave = np.array(dictionary[img]['wave' + str(key)])\n respfn = dictionary[use_standard[key]]['response'+str(key)]\n exptime = dictionary[img]['EXPTIME']\n airmass = dictionary[img]['AIRMASS']\n \n spec_opt = deimos.deimosutil.atmoexp_correction(wave, spec_opt, exptime, airmass, site='mauna', verbose = True)\n \n dictionary[img]['spec_flux'+str(key)] = spec_opt * respfn\n dictionary[img]['response'+str(key)] = respfn\n \n \n if verbose:\n plt.figure(2)\n plt.clf()\n fig2 = plt.figure(2) \n plt.clf()\n plt.title(dictionary[img]['OBJECT'])\n plt.plot(wave, spec_opt * respfn, label='Calibrated Spectrum')\n if pyversion>=3:\n input('look final spectrum')\n else:\n raw_input('look final spectrum')\n \n ################ write file\n spec_basic = dictionary[img]['spec_basic' + str(key)]\n spec_opt = dictionary[img]['spec_opt' + str(key)]\n skybg_opt = dictionary[img]['skybg_opt' + str(key)]\n wave = dictionary[img]['wave' + str(key)]\n response = dictionary[img]['response' + str(key)]\n spec_flux = np.array(dictionary[img]['spec_flux' + str(key)])\n arcspec = np.array(dictionary[img]['arcspec' + str(key)])\n\n # apply response \n skymy = dictionary[img]['mysky' + str(key)] * response\n spec_var = dictionary[img]['spec_var' + str(key)] * response\n spec_my = dictionary[img]['mybasic' + str(key)] * response\n \n if key==7:\n spec_basic = spec_basic#[::-1]\n spec_opt = spec_opt#[::-1]\n skybg_opt = skybg_opt#[::-1]\n spec_var = spec_var#[::-1]\n skymy = skymy#[::-1]\n spec_my = spec_my#[::-1]\n wave = wave#[::-1]\n response = response#[::-1] \n spec_flux = spec_flux#[::-1] \n arcspec = arcspec#[::-1]\n \n imgout = re.sub('.fits','',img) + '_' + str(key) + '_' + dictionary[img]['OBJECT'] + '_flux.ascii'\n np.savetxt(_dir + '/' + str(key) + '/' + imgout,np.c_[wave, xs,spec_basic,spec_opt,skybg_opt,spec_var,\\\n spec_my,skymy,arcspec, response,spec_flux],\\\n header='wave pixel spec_basic spec_opt skybg_opt spec_var mybasic mysky arcspec response spec_flux')\n #\\n# shift ' + str(shift))\n else:\n print('no standard for ' + str(key))\n else:\n print('skip apply sensitivitity function')\n######################################################### \n if stage in [None,'flux', 'sky+', 'trim+', 'flat+','trace+', 'extract+', 'wave+', 'response+', 'flux+', 'write']:\n objectname=[]\n for img in setup_object[setup]:\n name = dictionary[img]['OBJECT']\n if name not in objectname:\n objectname.append(name)\n if not os.path.isdir('final'):\n os.mkdir('final')\n for name in objectname:\n deimos.deimosutil.writefitstable(setup,name)\n\n \n###########################################################################################\n \n \n \n \n \n \n" }, { "alpha_fraction": 0.5260004997253418, "alphanum_fraction": 0.554756760597229, "avg_line_length": 22.44382095336914, "blob_id": "1fcf66d129073c51475f49d300b08f6f12d441a4", "content_id": "ddc05fbea7f18ca1592e123071cf8d77b718c61e", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 4173, "license_type": "permissive", "max_line_length": 99, "num_lines": 178, "path": "/trunk/src/deimos/resources/script/pythoident.py", "repo_name": "svalenti/deimos", "src_encoding": "UTF-8", "text": "#!/usr/bin/env python\n\nfrom matplotlib import pylab as plt\nimport numpy as np\nfrom scipy.optimize import fmin\nfrom scipy.interpolate import interp1d\nfrom astropy.io import fits\nimport os\nimport sys\npyversion = sys.version_info[0]\nplt.ion()\n\ndef gendeimosarc():\n data= np.genfromtxt('lamp_NIST_blue.dat')\n x,y,note,z = zip(*data)\n x = np.array(x)\n y = np.array(y)\n z = np.array(z)\n\n# x,y,z = [],[],[]\n# hdu = fits.open('lamps.fits')\n# for l in hdu[1].data[0:1]:\n# for m,g in enumerate(l[1]):\n# if l[2][m]>1000 and l[1][m]>3500:\n# z.append(l[0])\n# x.append(l[1][m])\n# y.append(l[2][m])\n\n x = np.array(x)\n y = np.array(y)\n z = np.array(z)\n \n ss = np.argsort(y)[::-1]\n x = x[ss]\n z = z[ss]\n y = y[ss]\n \n wave = np.arange(3000,11000,1)\n zero = wave - wave\n\n tot = 30\n count=0\n fig=plt.figure(1)\n for l,m in enumerate(x):\n params = [y[l],x[l],3]\n model1 = get_profile_model(params, wave)\n zero = zero + model1\n if count < tot:\n plt.text(x[l],y[l]*1.1,str(x[l]),rotation=90, rotation_mode='anchor')\n count += 1\n plt.plot(wave,zero)\n\n \n \ndef get_profile_model(params, ys):\n# a1, cy1, sigma1, a2, cy2, sigma2 = params\n a1, cy1, sigma1 = params\n \n p1 = np.exp(-(ys - cy1)**2 / 2 / sigma1**2) \n p1 /= p1.max()\n \n# p2 = np.exp(-(ys - cy2)**2 / 2 / sigma2**2) \n# p2 /= p2.max()\n return a1 * p1 #+ a2 * p2\n\ndef get_profile_chisq(params, ys, profile):\n model = get_profile_model(params, ys)\n return np.sum( (profile - model)**2 / np.sqrt(np.abs(profile)) ) / (profile.size - len(params))\n\ndef fitline(xx,yy,center,amplitude=1,sigma=3,verbose=True):\n guess = [amplitude,float(center),sigma]\n params = fmin(get_profile_chisq, guess, args=(xx, yy))\n model = get_profile_model(params, xx)\n if verbose:\n plt.plot(xx,model)\n print(params)\n return params\n\n#######################################\n#hdu = fits.open('keck_deimos_600.fits')\n#dd =hdu[1].data\n#xx,yy = zip(*dd)\n#yy = yy - np.percentile(yy,.1)\n#yy = yy/np.max(yy)\n\ndata = np.genfromtxt('arc_7.txt')\n#data = np.genfromtxt('skybgopt_7.txt')\n\nx,y = zip(*data)\nx = np.array(x)\ny = np.array(y)\ny = y - np.percentile(y,.1)\ny = y/np.max(y)\n\nansw = 'n'\n\n\narclist = 'arc_list_7.txt'\nif os.path.isfile(arclist):\n data = np.genfromtxt(arclist)\n ll,ww = zip(*data)\n ww = np.array(ww)\n sort = np.argsort(np.array(ww))\n pixels = np.array(ll)[sort]\n waves = ww[sort]\n\n plt.clf()\n plt.plot(pixels,waves,'or')\n params = np.polyfit(pixels,waves, deg= 4)\n p = np.poly1d(params)\n print(p)\n plt.plot(pixels,p(pixels),'-b')\n if pyversion>=3:\n input('stop')\n else:\n raw_input('stop')\nelse:\n pixels = []\n waves = []\n\n\ndd= 30\nfig=plt.figure(1)\nplt.clf()\nplt.plot(x,y)\n\n#plt.plot(xx,yy,'-r')\nf = interp1d(x, y)\n\nif len(waves):\n intpeak = f(pixels)\n for m,l in enumerate(waves):\n #plt.text(waves[m], intpeak[m]*1.01, str(waves[m]),rotation=90, rotation_mode='anchor')\n plt.text(pixels[m], intpeak[m]*1.01, str(waves[m]),rotation=90, rotation_mode='anchor')\n\nplt.xlim(4100,-100)\nif pyversion>=3:\n input('stop1')\nelse:\n raw_input('stop1')\n \nwhile answ in ['YES','yes','y','Y']:\n if pyversion>=3:\n center = input('pixel? ')\n else:\n center = raw_input('pixel? ')\n \n ww = [( x < float(center) + dd) & ( x > float(center) - dd)]\n params = fitline(x[ww],y[ww],center, 1, 3, verbose=True)\n if pyversion>=3:\n wave = input('which wave? ')\n else:\n wave = raw_input('which wave? ')\n if pyversion>=3:\n stop = input('one more ')\n else:\n stop = raw_input('one more ')\n \n pixels = np.append(pixels,params[1])\n waves = np.append(waves,float(wave))\n if stop in ['No','no','n']:\n answ = 'n'\n\nnp.savetxt('arc_list_7.txt',np.c_[pixels,waves])\n\n\n#params = np.polyfit(waves,pixels, deg= 4)\n#p = np.poly1d(params)\n\n#np.savetxt('arc_good_7.txt',np.c_[p(x),y])\n\n\nprint(p)\nplt.clf()\n#plt.plot(pixels,waves,'ob')\nplt.plot(p(x),y,'-r')\n\nprint(answ)\n" }, { "alpha_fraction": 0.49641671776771545, "alphanum_fraction": 0.5163098573684692, "avg_line_length": 36.92955780029297, "blob_id": "86ce89b8abde25e0d3e5dd572140d4c894c64341", "content_id": "0cce61d7f37d2019662e4bc0c405b69ca742ac60", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 87769, "license_type": "permissive", "max_line_length": 165, "num_lines": 2314, "path": "/trunk/src/deimos/deimosutil.py", "repo_name": "svalenti/deimos", "src_encoding": "UTF-8", "text": "import astropy\nfrom astropy.io import fits\nimport glob\nimport os\nimport re\nfrom matplotlib import pylab as plt\nimport numpy as np\nimport math\nfrom scipy.signal import find_peaks_cwt\nimport ccdproc\nfrom astropy.nddata import CCDData\nfrom astropy import units as u\nfrom astropy.table import QTable\nimport glob\nimport string\nfrom scipy.interpolate import LSQBivariateSpline, LSQUnivariateSpline\nfrom scipy.interpolate import UnivariateSpline\nfrom scipy.interpolate import SmoothBivariateSpline\nfrom astropy.convolution import convolve, Box1DKernel\nfrom astropy.stats import sigma_clip\nfrom scipy.optimize import fmin\nfrom scipy.optimize import minimize\nfrom scipy.optimize import least_squares\nfrom scipy.interpolate import interp1d\nimport pickle\nfrom pylab import polyfit, polyval\nfrom astropy.stats import sigma_clipped_stats\nfrom deimos import __path__ as _path\nimport sys\nimport pyds9\nimport matplotlib.gridspec as gridspec\n\npyversion = sys.version_info[0]\n\n\n\npoly_arc = {3: np.array([ 1.03773471e-05, 5.78487274e-01, 4.45847046e+03]),\n# 7: np.array([ 2.30350858e-05, -7.64099597e-01, 9.79141140e+03]),\n 7: np.array([ -1.39838149e-13, 1.83212231e-09, -8.83011172e-06, -6.28779911e-01, 9.64233695e+03])}\n\n\ndef get_profile_model(params, ys):\n# a1, cy1, sigma1, a2, cy2, sigma2 = params\n a1, cy1, sigma1 = params\n \n p1 = np.exp(-(ys - cy1)**2 / 2 / sigma1**2) \n p1 /= p1.max()\n \n# p2 = np.exp(-(ys - cy2)**2 / 2 / sigma2**2) \n# p2 /= p2.max()\n return a1 * p1 #+ a2 * p2\n\ndef get_profile_chisq(params, ys, profile):\n model = get_profile_model(params, ys)\n return np.sum( (profile - model)**2 / np.sqrt(np.abs(profile)) ) / (profile.size - len(params))\n\n\n###################################################\n\ndef get_profile_spl(dls, stamp):\n # need to sort the data (and weights) so that the x values are increasing\n x, y = dls.ravel(), stamp.ravel()\n weights = np.sqrt(np.abs(y)) # not technically optimal for coadded data, but ok\n wsort = x.argsort()\n x, y, weights = x[wsort], y[wsort], weights[wsort]\n \n # set locations for spline knots\n t = np.linspace(x.min() + 1, x.max() - 1, np.int(x.max() - x.min()))\n spl = LSQUnivariateSpline(x, y, t, weights)\n return x, y, spl\n\n############################################\n\ndef get_dl_model(params, dxs, dys):\n return dxs + params[0] * dys + params[1] * dys ** 2\n\n###########################################\n\ndef check_dl_model(params, dxs, dys, stamp):\n dls = get_dl_model(params, dxs, dys)\n x, y, spl = get_profile_spl(dls, stamp)\n chisq = np.sum((stamp - spl(dls)) ** 2 / np.sqrt(np.abs(stamp)))\n return chisq / (stamp.size - len(params))\n\n###############################################################################\n# function to fit a 2D spline\ndef fit_sky(xvals, yvals, image, ky=1, dx=0.5):\n # select knot points in the x (wavelength) direction\n tx = np.arange(xvals.min() + 2, xvals.max() - 2, dx)\n \n # select knot points in the y (spatial) direction\n ty = [] # if there are no knots, the fit will be a poly nomial of degree ky\n \n # fit the 2D spline\n return LSQBivariateSpline(xvals.ravel(), yvals.ravel(), image.ravel(), tx, ty, ky=ky)\n\n###########################\n\ndef checkalldata(directory=False,verbose=False):\n from astropy.io import ascii \n if directory:\n imglist = glob.glob(directory + '*')\n else:\n imglist = glob.glob('*fits')\n \n listhd = ['GRATENAM','SLMSKNAM','MJD-OBS','DATE-OBS','EXPTIME','AIRMASS','OBJECT',\\\n 'SLSELNAM','TARGNAME','LAMPS','FLAMPS','OBSTYPE','IMTYPE','RA','DEC']\n dictionary={}\n for img in imglist:\n dictionary[img]={}\n hdu = fits.open(img)\n dictionary[img]['fits']= hdu\n for _header in listhd:\n if hdu[0].header.get(_header) is not None:\n dictionary[img][_header]= hdu[0].header.get(_header)\n else:\n dictionary[img][_header]= None\n \n dictionary[img]['type']= None\n if dictionary[img]['SLMSKNAM'] =='GOH_X':\n dictionary[img]['type']= 'focus'\n else:\n # select arcs\n if dictionary[img]['OBSTYPE'] =='Line':\n if dictionary[img]['LAMPS']!=['Off']:\n dictionary[img]['type']= 'arc'\n # select flats\n if dictionary[img]['OBSTYPE'] =='IntFlat':\n if hdu[0].header.get('FLAMPS')!=['Off']:\n dictionary[img]['type']= 'flat'\n # select objecs\n if dictionary[img]['OBSTYPE'] =='Object':\n dictionary[img]['type']= 'object'\n \n setup_object={}\n setup_flat={}\n setup_arc={}\n skip=[]\n for img in dictionary:\n if dictionary[img]['type'] is None:\n skip.append(img) \n if verbose:\n print('skip file ' + str(img))\n# print(dictionary[img])\n# if pyversion>=3:\n# answ = input('what is it [S]kip/[O]bject/[A]rc/[F]lat] [S] ? ')\n# if not answ: answ='S'\n# else:\n# answ = raw_input('what is it [S]kip/[O]bject/[A]rc/[F]lat] [S] ? ')\n# if not answ: answ='S'\n else:\n _grism = dictionary[img]['GRATENAM']\n _slit = dictionary[img]['SLMSKNAM'] \n setup = (_grism,_slit)\n if dictionary[img]['type']=='object':\n if (_grism,_slit) not in setup_object:\n setup_object[_grism,_slit]=[]\n setup_object[_grism,_slit].append(img)\n \n if dictionary[img]['type']=='arc':\n if (_grism,_slit) not in setup_arc:\n setup_arc[_grism,_slit]=[]\n setup_arc[_grism,_slit].append(img)\n \n if dictionary[img]['type']=='flat':\n if (_grism,_slit) not in setup_flat:\n setup_flat[_grism,_slit]=[]\n setup_flat[_grism,_slit].append(img)\n \n _dir = '_'.join(setup)\n print(img,setup,dictionary[img]['OBJECT'])\n \n for key in ['3','7']:\n imgtrimmed = re.sub('.fits','',img) + '_' + str(key) + '_trimmed.fits'\n imgnosky = re.sub('.fits','',img) + '_' + str(key) + '_nosky.fits'\n imgtrace = re.sub('.fits','',img) + '_' + str(key) + '_trace.ascii'\n imgex = re.sub('.fits','',img) + '_' + str(key) + '_' + dictionary[img]['OBJECT'] + '_ex.ascii'\n imgwave = re.sub('.fits','',img) + '_' + str(key) + '_' + dictionary[img]['OBJECT'] + '_wave.ascii'\n imgresponse = re.sub('.fits','',img) + '_' + str(key) + '_' + dictionary[img]['OBJECT'] + '_response.ascii'\n imgflux = re.sub('.fits','',img) + '_' + str(key) + '_' + dictionary[img]['OBJECT'] + '_flux.ascii'\n\n if os.path.isfile(_dir + '/' + str(key) + '/' + imgtrimmed):\n hdu = fits.open(_dir + '/' + str(key) + '/' + imgtrimmed)\n dictionary[img]['trimmed' + str(key)] = hdu\n \n if os.path.isfile(_dir + '/' + str(key) + '/' + imgnosky):\n hdu = fits.open(_dir + '/' + str(key) + '/' + imgnosky)\n nosky = hdu[0].data\n dictionary[img]['nosky' + str(key)] = nosky\n hdu1 = fits.open(_dir + '/' + str(key) + '/' + imgtrimmed)\n trimmed = hdu1[0].data\n sky = trimmed - nosky\n dictionary[img]['sky' + str(key)] = sky\n\n \n if os.path.isfile(_dir + '/' + str(key) + '/' + imgtrace):\n aa, meta = readtrace(_dir + '/' + str(key) + '/' + imgtrace)\n for key1 in meta:\n if key1 in ['aplow','displine','aphigh']:\n dictionary[img][key1 + '_' + str(key)] = float(meta[key1])\n else: \n dictionary[img][key1 + '_' + str(key)] = re.sub('\\[?]?','', meta[key1])\n dictionary[img]['peakpos_'+str(key)] = aa\n \n if os.path.isfile(_dir + '/' + str(key) + '/' + imgflux):\n aa = ascii.read(_dir + '/' + str(key) + '/' + imgflux)\n if key==7:\n# dictionary[img]['spec_basic' + str(key)] = aa['spec_basic']#[::-1]\n# dictionary[img]['spec_opt' + str(key)] = aa['spec_opt']#[::-1]\n# dictionary[img]['skybg_opt' + str(key)] = aa['skybg_opt']#[::-1]\n# dictionary[img]['spec_var' + str(key)] = aa['spec_var']#[::-1]\n# dictionary[img]['mysky' + str(key)] = aa['mysky']#[::-1]\n# dictionary[img]['mybasic' + str(key)] = aa['mybasic']#[::-1]\n# dictionary[img]['wave' + str(key)] = aa['wave']#[::-1]\n# dictionary[img]['arcspec' + str(key)] = aa['arcspec']#[::-1]\n dictionary[img]['response' + str(key)] = aa['response']#[::-1]\n dictionary[img]['spec_flux' + str(key)] = aa['spec_flux']#[::-1]\n else:\n# dictionary[img]['spec_basic' + str(key)] = aa['spec_basic']\n# dictionary[img]['spec_opt' + str(key)] = aa['spec_opt']\n# dictionary[img]['skybg_opt' + str(key)] = aa['skybg_opt']\n# dictionary[img]['spec_var' + str(key)] = aa['spec_var']\n# dictionary[img]['mysky' + str(key)] = aa['mysky']\n# dictionary[img]['mybasic' + str(key)] = aa['mybasic']\n# dictionary[img]['wave' + str(key)] = aa['wave']\n# dictionary[img]['arcspec' + str(key)] = aa['arcspec']\n dictionary[img]['response' + str(key)] = aa['response']\n dictionary[img]['spec_flux' + str(key)] = aa['spec_flux']\n \n if os.path.isfile(_dir + '/' + str(key) + '/' + imgwave):\n aa = ascii.read(_dir + '/' + str(key) + '/' + imgwave)\n# dictionary[img]['spec_basic' + str(key)] = aa['spec_basic']\n# dictionary[img]['spec_opt' + str(key)] = aa['spec_opt']\n# dictionary[img]['skybg_opt' + str(key)] = aa['skybg_opt']\n# dictionary[img]['spec_var' + str(key)] = aa['spec_var']\n# dictionary[img]['mysky' + str(key)] = aa['mysky']\n# dictionary[img]['mybasic' + str(key)] = aa['mybasic']\n dictionary[img]['wave' + str(key)] = aa['wave']\n dictionary[img]['arcspec' + str(key)] = aa['arcspec']\n \n if os.path.isfile(_dir + '/' + str(key) + '/' + imgex):\n aa = ascii.read(_dir + '/' + str(key) + '/' + imgex)\n dictionary[img]['spec_basic' + str(key)] = aa['spec_basic']\n dictionary[img]['spec_opt' + str(key)] = aa['spec_opt']\n dictionary[img]['skybg_opt' + str(key)] = aa['skybg_opt']\n dictionary[img]['spec_var' + str(key)] = aa['spec_var']\n dictionary[img]['mysky' + str(key)] = aa['mysky']\n dictionary[img]['mybasic' + str(key)] = aa['mybasic']\n \n if os.path.isfile(_dir + '/' + str(key) + '/' + imgresponse):\n aa = ascii.read(_dir + '/' + str(key) + '/' + imgresponse)\n# dictionary[img]['wave' + str(key)] = aa['wave']\n dictionary[img]['response' + str(key)] = aa['response']\n\n \n for img in skip:\n del dictionary[img]\n return dictionary, setup_object, setup_arc, setup_flat\n\n########################################################################\n\ndef trim_rotate_split(setup_object,setup_flat,setup_arc,dictionary, setup, force=False, verbose=False):\n _dir = '_'.join(setup)\n slits = {}\n ############ split files\n for img in setup_object[setup] + setup_flat[setup]+setup_arc[setup]:\n for key in [3,7]:\n print(img,dictionary[img]['OBJECT'],key)\n dotrim = True\n if 'trimmed'+str(key) in dictionary[img] and force==False:\n image = dictionary[img]['trimmed' + str(key)][0].data\n image_plot(image,frame=3,_title=dictionary[img]['OBJECT'])\n \n if pyversion>=3:\n answ = input('do you want to trim again (see figure 3) ? [y/n] [n] ')\n else:\n answ = raw_input('do you want to trim again (see figure 3) ? [y/n] [n]')\n if not answ: answ = 'n'\n if answ in ['n','N','NO','no']:\n dotrim = False\n if dotrim:\n if key not in slits:\n if len(setup_flat[setup]):\n imgslit = setup_flat[setup][0]\n print('use flats to identify the slit position')\n elif len(setup_arc[setup]):\n imgslit = setup_arc[setup][0]\n print('use arc to identify the slit position')\n elif len(setup_object[setup]):\n print('use object to identify the slit position')\n imgslit = setup_object[setup][0]\n \n slits[key] = findslit(imgslit,key,verbose=True,cut=0.2)\n\n imgtrimmed = re.sub('.fits','',img) + '_' + str(key) + '_trimmed.fits'\n #\n # slit of one arcsec is the third one in the multislit\n #\n xmin,xmax = slits[key][2]\n print(xmin,xmax)\n \n _header = dictionary[img]['fits'][key].header\n _data = np.transpose(dictionary[img]['fits'][key].data)\n \n for ll in ['DATASEC','DETSIZE','DETSEC']:\n del _header[ll]\n science = CCDData(data=_data,header=_header,unit=u.adu)\n \n # add header from the \n _header['exptime'] = dictionary[img]['EXPTIME']\n _header['MJD-OBS'] = dictionary[img]['MJD-OBS']\n _header['OBJECT'] = dictionary[img]['OBJECT']\n _header['OBSTYPE'] = dictionary[img]['OBSTYPE']\n _header['AIRMASS'] = dictionary[img]['AIRMASS']\n _header['RA'] = dictionary[img]['RA']\n _header['DEC'] = dictionary[img]['DEC']\n \n # trim images \n trimmed = ccdproc.trim_image(science, fits_section='[:,' + str(xmin) + ':' + str(xmax) + ']')\n dictionary[img]['trimmed'+str(key)] = trimmed.to_hdu()\n\n if not os.path.isdir(_dir):\n os.mkdir(_dir)\n if not os.path.isdir(_dir + '/' + str(key)):\n os.mkdir(_dir + '/' + str(key))\n\n hdu = dictionary[img]['trimmed' + str(key)]\n _out = fits.ImageHDU(data=hdu[0].data, header=hdu[0].header)\n fits.writeto(_dir + '/' + str(key) + '/' + imgtrimmed, _out.data,header=_out.header,overwrite='yes')\n# else:\n# if verbose:\n# print('read trimmed image from file')\n# hdu = fits.open(_dir + '/' + str(key) + '/' + imgtrimmed)\n# dictionary[img]['trimmed' + str(key)] = hdu[0].data\n return dictionary\n\n######################################################################\n\ndef makeflat(setup_flat,dictionary,setup,key,verbose=False):\n ######### make master flat 3 \n flatlist = []\n for img in setup_flat[setup]:\n if 'trimmed'+str(key) in dictionary[img]:\n flatlist.append(dictionary[img]['trimmed'+str(key)][0].data)\n if len(flatlist):\n stack, masterflat = flatcombine2(flatlist, verbose = verbose, response = True, Saxis=0)\n _dir = '_'.join(setup)\n masterflatname = 'masterflat_' + _dir + '_' + str(key) + '.fits'\n #_out = fits.ImageHDU(data=nosky)\n fits.writeto(_dir + '/' + str(key) + '/' + masterflatname, masterflat, overwrite='yes') \n else:\n masterflat = None\n\n \n return masterflat\n\n###############################################################\n\ndef image_plot(image0,frame=3,_title='',xlabel='Column Number',ylabel='Row Number'):\n fig = plt.figure(frame)\n fig.clf()\n \n if len(image0)==2:\n ax = fig.add_subplot(2, 1, 1)\n ax2 = fig.add_subplot(2, 1, 2)\n ax.title.set_text(_title)\n \n # plot 1 \n image=image0[0]\n # determine the image pixel distribution (used for displaying below)\n sample = sigma_clip(image)\n vmin = sample.mean() - 1 * sample.std()\n vmax = sample.mean() + 3 * sample.std()\n yvals, xvals = np.indices(image.shape)\n extent = (xvals.min(), xvals.max(), yvals.min(), yvals.max())\n ax.imshow(image, origin='lower', cmap='gray', aspect='auto', vmin=vmin, vmax=vmax, extent=extent)\n ax.axes.set_xlabel(xlabel)\n ax.axes.set_ylabel(ylabel)\n \n # plot 2\n image1=image0[1]\n # determine the image pixel distribution (used for displaying below)\n sample = sigma_clip(image1)\n vmin2 = sample.mean() - 1 * sample.std()\n vmax2 = sample.mean() + 3 * sample.std()\n yvals, xvals = np.indices(image1.shape)\n extent2 = (xvals.min(), xvals.max(), yvals.min(), yvals.max())\n ax2.imshow(image1, origin='lower', cmap='gray', aspect='auto', vmin=vmin2, vmax=vmax2, extent=extent2)\n# ax2.axes.set_xlabel(xlabel)\n# ax2.axes.set_ylabel(ylabel)\n \n else:\n ax = fig.add_subplot(1, 1, 1)\n ax.title.set_text(_title)\n image = image0 \n # determine the image pixel distribution (used for displaying below)\n sample = sigma_clip(image)\n vmin = sample.mean() - 1 * sample.std()\n vmax = sample.mean() + 3 * sample.std()\n yvals, xvals = np.indices(image.shape)\n extent = (xvals.min(), xvals.max(), yvals.min(), yvals.max())\n ax.imshow(image, origin='lower', cmap='gray', aspect='auto', vmin=vmin, vmax=vmax, extent=extent)\n ax.set_xlabel(xlabel)\n ax.set_ylabel(ylabel)\n\n\n\n\n\n \n#######################################################\n\ndef find_sky_object(image,objectcut=0.2,key=3,interactive=False):\n # get the a pixel coordinate near the image center\n ny, nx = image.shape\n cy, cx = ny//2, nx//2\n # create 1d arays of the possible x and y values\n xs = np.arange(nx)\n ys = np.arange(ny)\n # pixel coordinates for each pixel\n yvals, xvals = np.indices(image.shape)\n\n # compute the row averages and normalize so that the background is near 0 and the peaks are near 1\n rowaverage = image.mean(axis=1)\n# rowaverage -= np.median(rowaverage)\n rowaverage -= np.percentile(rowaverage,0.1)\n rowaverage /= rowaverage.max()\n \n image_plot(image)\n\n plt.figure(2)\n plt.clf()\n fig2 = plt.figure(2)\n ax2 = fig2.add_subplot(1, 1, 1)\n ax2.plot(ys, rowaverage)\n ax2.set_xlabel('Row Number (y-coordinate)'), plt.ylabel('Normalized Row Average')\n ax2.grid();\n\n # find the rows with object light\n #objrows = ys[rowaverage > objectcut]\n\n rangeobj = {3:'70,100', 7:'55,90'}\n if interactive:\n if pyversion>=3:\n obj = input('give object position [eg ' + str(rangeobj[key]) + ']')\n else:\n obj = raw_input('give object position [eg ' + str(rangeobj[key]) + ']')\n \n if not obj:\n obj = rangeobj[key]\n else:\n obj = rangeobj[key]\n \n start,end= obj.split(',')\n objrows = np.arange(int(start),int(end))\n \n # mask to mark sky rows\n skymask = np.ones(image.shape, dtype=bool)\n objrows = objrows[objrows<ny]\n skymask[objrows, :] = False\n \n # also exclude bad rows\n badrows = ys[rowaverage < -0.05]\n skymask[badrows, :] = False\n \n# # rows with mostly sky background light\n# skyrows = ys[skymask.mean(axis=1) == 1]\n#\n# # median (unmasked) sky spectrum and standard deviation\n# medspec = np.median(image[skyrows, :], axis=0)\n# stdspec = np.std(image[skyrows, :], axis=0, ddof=1)\n# \n# # exclude deviant pixels from the skymask\n# pull = (image - medspec) / stdspec\n# w = pull > 5\n# skymask[w] = False\n\n if interactive:\n plt.figure(3)\n plt.clf()\n plt.imshow(skymask, origin='lower', aspect='auto');\n \n return objrows, skymask\n\n#############################################3\n\n###################################################\n\ndef retify_frame(img0, dictionary, ext=3, verbose=False): \n image = dictionary[img0]['trimmed'+str(ext)][0].data \n # this is an arc, we do not need to mask\n skymask = np.ones(image.shape, dtype=bool)\n \n# # show the mask\n# if verbose:\n# plt.figure(3)\n# plt.clf()\n# plt.imshow(skymask, origin='lower', aspect='auto');\n# if pyversion>=3:\n# input('stop')\n# else:\n# raw_input('stop')\n \n # cut out a small image \"stamp\" near the center of the frame\n ny, nx = image.shape\n cy, cx = ny//2, nx//2\n xs = np.arange(nx)\n ys = np.arange(ny)\n # pixel coordinates for each pixel\n yvals, xvals = np.indices(image.shape)\n \n row = cy\n col = cx\n hwidth = 50\n \n stamp = image[:, col - hwidth : col + hwidth]\n yvals, xvals = np.indices(image.shape)\n ys_stamp = yvals[:, col - hwidth : col + hwidth]\n xs_stamp = xvals[:, col - hwidth : col + hwidth]\n\n if verbose:\n image_plot(stamp)\n # plot stamp values against column numbers\n plt.figure(3)\n plt.clf()\n plt.plot(xs_stamp.ravel(), stamp.ravel(), 'r.');\n plt.xlabel('Column Number'), plt.ylabel('Counts');\n if pyversion>=3:\n input('stop')\n else:\n raw_input('stop')\n \n # pixel offsets from the refernece pixel\n dxs = xs_stamp - col\n dys = ys_stamp - row\n \n # parameter guess\n guess = (1e-5, 1e-5)\n\n # get the wavelength offsets and plot vs. counts\n dls = get_dl_model(guess, dxs, dys)\n plt.figure(3)\n plt.clf()\n plt.plot(dls.ravel(), stamp.ravel(), 'r.')\n plt.xlabel('Wavelength Offset')\n plt.ylabel('Counts');\n if pyversion>=3:\n input('stop')\n else:\n raw_input('stop')\n \n # fit a spline to the data and plot\n x, y, spl = get_profile_spl(dls, stamp)\n\n plt.figure(3)\n plt.clf()\n fig3= plt.figure(3)\n ax1 = fig3.add_subplot(2, 1, 2)\n# fig, axarr = plt.subplots(2, sharex=True)\n ax1.plot(x, y, 'r.')\n ax1.plot(x, spl(x))\n ax1.plot(x, y - spl(x), 'r.')\n ax1.set_ylim(-200, 200)\n ax1.set_xlabel('Wavelength Offset');\n if pyversion>=3:\n input('stop')\n else:\n raw_input('stop')\n \n # see how good our guess is\n check_dl_model(guess, dxs, dys, stamp)\n\n # get the best model parameters for this stamp\n params = fmin(check_dl_model, guess, args=(dxs, dys, stamp))\n print(\"best model parameters are\", params)\n\n hwidth = 300 # width = 2 * hwidth + 1\n cols = np.arange(hwidth, nx, 2 * hwidth)\n cols = cols[1:]\n\n # reference wavelength offsets to the center row\n row = cy\n\n # define a 2D array to hold the wavelength offsets for each pixel\n lambdas = np.zeros(image.shape) \n\n # loop over each central column\n for col in cols:\n print('col = ', col)\n \n # slice the data\n inds = np.s_[:, col - hwidth : col + hwidth]\n stamp = image[inds]\n mask = skymask[inds]\n dys = yvals[inds] - row\n dxs = xvals[inds] - col\n \n # initial fit\n params = fmin(check_dl_model, guess, args=(dxs[mask], dys[mask], stamp[mask]))\n \n # check for outliers\n dls = get_dl_model(guess, dxs, dys)\n x, y, spl = get_profile_spl(dls, stamp)\n model = spl(dls)\n pull = (stamp - model) / np.sqrt(np.abs(model))\n w = (pull < 5) & mask\n params2 = fmin(check_dl_model, params, args=(dxs[w], dys[w], stamp[w]))\n \n # record\n lambdas[inds] = get_dl_model(params2, dxs, dys) + col\n pickle.dump(lambdas, open('lambdas_' + str(pyversion) + '_' + str(ext) + '.dat', 'wb'))\n\n plotcurvature(ny,cols,lambdas,xs,order=2)\n ###############\n # just plot offsets for a few of the rows across the image\n# plt.clf()\n# order = 2\n# for y in range(10, ny, 40):\n# p = plt.plot(cols, lambdas[y, cols] - xs[cols], 'o')\n# c = np.polyfit(cols, lambdas[y, cols] - xs[cols], order)\n# plt.plot(xs, np.polyval(c, xs), c=p[0].get_color(), label='row {}'.format(y))\n# plt.legend()\n# plt.xlabel('Column Number')\n# plt.ylabel('Wavelength Offset from Middle Row');\n\n if pyversion>=3: \n input('\\n### Solution of wavelength offset shown in Figure 3 ')\n else:\n raw_input('\\n### Solution of wavelength offset shown in Figure 3 ')\n return lambdas\n\n################################################3\ndef plotcurvature(ny,cols,lambdas,xs,order=2):\n global ax2, _ny, _cols, _lambdas,_xs, _order, lines\n _ny = ny\n _lambdas = lambdas\n _xs = xs\n _order = order\n _cols = cols\n \n fig = plt.figure(1)\n plt.clf()\n ax2 = fig.add_subplot(1, 1, 1)\n \n # just plot offsets for a few of the rows across the image\n for y in range(10, _ny, 40):\n p = plt.plot(_cols, _lambdas[y, _cols] - _xs[_cols], 'o')\n c = np.polyfit(_cols, _lambdas[y, _cols] - _xs[_cols], _order)\n lines = ax2.plot(_xs, np.polyval(c, _xs), c=p[0].get_color(), label='row {}'.format(y))\n\n plt.legend()\n plt.xlabel('Column Number')\n plt.ylabel('Wavelength Offset from Middle Row');\n plt.ylim(-3,3)\n \n print('\\n#####################3\\n [a]dd point, [d]elete point, 1,2,3,[4],5,6 (poly order) \\n') \n# kid = fig.canvas.mpl_connect('key_press_event', onkeypress2)\n## cid = fig.canvas.mpl_connect('button_press_event',onclick)\n plt.draw()\n# if pyversion>=3:\n# input('left-click mark bad, right-click unmark, <d> remove. Return to exit ...')\n# else:\n# raw_input('left-click mark bad, right-click unmark, <d> remove. Return to exit ...')\n# return\n\n#######################################################\ndef onkeypress2(event):\n global ax2, _ny, _cols, _lambdas,_xs, _order, lines\n\n xdata,ydata = event.xdata,event.ydata\n print(xdata,ydata)\n print(_cols)\n print(_lambdas)\n# dist = np.sqrt((xdata-np.array(_obj_wave_ds))**2+(ydata-np.array(_LogSensfunc))**2)\n# ii = np.argmin(dist)\n\n if event.key == 'a' :\n print('a')\n# idd.append(idd[-1]+1)\n# __obj_wave_ds = list(_obj_wave_ds)\n# __obj_wave_ds.append(xdata)\n# _obj_wave_ds = np.array(__obj_wave_ds)\n# __LogSensfunc = list(_LogSensfunc)\n# __LogSensfunc.append(ydata)\n# _LogSensfunc = np.array(__LogSensfunc)\n# ax2.plot(xdata,ydata,'db',ms=10)\n\n if event.key == 'd' :\n print('d')\n# idd.remove(ii)\n# for i in range(len(_obj_wave_ds)):\n# if i not in idd: nonincl.append(i)\n\n if event.key in ['1','2','3','4','5','6','7','8','9'] :\n _order=int(event.key)\n print(_order)\n \n # just plot offsets for a few of the rows across the image\n for y in range(10, _ny, 40):\n p = plt.plot(_cols, _lambdas[y, _cols] - _xs[_cols], 'o')\n c = np.polyfit(_cols, _lambdas[y, _cols] - _xs[_cols], _order)\n lines.pop(0).remove()\n lines = ax2.plot(_xs, np.polyval(c, _xs), c=p[0].get_color(), label='row {}'.format(y))\n\n plt.legend()\n plt.ylim(-3,3)\n plt.xlabel('Column Number')\n plt.ylabel('Wavelength Offset from Middle Row'); \n print('just testing')\n\n#######################################################\n\ndef model_sky(params, dx, counts):\n# wav0, a, b, c, d, scale, c0 = params\n wav0, a, b, scale, c0 = params\n \n dtype = []\n dtype.append(('wav', float))\n dtype.append(('flux', float))\n model = np.zeros(counts.shape, dtype=dtype)\n# model['wav'] = wav0 + a * dx + b * dx**2 + c * dx**3 + d * dx**4\n model['wav'] = wav0 + a * dx + b * dx**2\n model['flux'] = c0 + scale * counts\n \n return model\n\n#######################################################\n\ndef get_sky_difference(params, dx, specdata, skyatlas):\n model = model_sky(params, dx, specdata)\n \n # residual\n res = model['flux'] - skyref_interp(model['wav'])\n \n return np.sum(res**2 / np.sqrt(np.abs(model['flux'])))\n\n#######################################################\n\ndef plot_sky_model(skyref, model):\n plt.clf()\n plt.plot(model['wav'], model['flux'], label='Extracted Sky Background');\n plt.plot(skyref['wav'], skyref['flux'], label='Reference Sky Spectrum');\n plt.xlim(model['wav'].min(), model['wav'].max());\n plt.ylim(model['flux'].min() - 0.25, model['flux'].max() + 0.25)\n plt.xlabel('Wavelength ($\\AA$)')\n plt.ylabel('Scaled Counts or Flux')\n plt.legend();\n\n###########################################\n\ndef trace(img,dictionary, g0=10, g1=85, g2=3, key=3, verbose=False):\n if 'sky' + str(key) in dictionary[img]:\n sky = dictionary[img]['sky' + str(key)][0].data\n image = dictionary[img]['trimmed' + str(key)][0].data\n nosky = image - sky\n \n # get the a pixel coordinate near the image center\n ny, nx = image.shape\n cy, cx = ny//2, nx//2\n # create 1d arays of the possible x and y values\n xs = np.arange(nx)\n ys = np.arange(ny)\n # pixel coordinates for each pixel\n yvals, xvals = np.indices(image.shape)\n \n # get the median for each row\n profile = np.median(image - sky, axis=1)\n\n # starting guess for the profile model\n guess = (g0, g1, g2)\n model = get_profile_model(guess, ys)\n\n # fit for the best model\n params = fmin(get_profile_chisq, guess, args=(ys, profile))\n print(\"best fit parameters are\", params)\n\n model = get_profile_model(params, ys)\n\n # fit the profile centered at these columns\n hwidth = 50\n cols = np.arange(hwidth, nx + 1, 2 * hwidth)\n\n ycenter = np.zeros( (len(cols), 2) )\n for icol, col in enumerate(cols):\n stamp = (image - sky)[:, col - hwidth : col + hwidth]\n profile = np.mean(stamp, axis=1)\n params = fmin(get_profile_chisq, guess, args=(ys, profile))\n ycenter[icol, :] = params[[1]]\n\n print(ycenter)\n # fit the relation with a polynomial\n ind = 0 # which trace 0 or 1?\n t_order = 3\n trace_c = np.polyfit(cols, ycenter[:, ind], t_order)\n print(trace_c)\n slitpos = yvals - np.polyval(trace_c, yvals)\n peakpos = np.polyval(trace_c, xs)\n\n dictionary[img]['peakpos' + str(key)] = peakpos\n dictionary[img]['trace' + str(key)] = slitpos\n dictionary[img]['tracefit' + str(key)] = trace_c\n if verbose:\n plt.figure(2)\n fig2 = plt.figure(2)\n fig2.clf()\n ax2 = fig2.add_subplot(2, 1, 1)\n ax22 = fig2.add_subplot(2, 1, 2)\n# fig, axarr = plt.subplots(2, sharex=True)\n ax2.plot(cols, ycenter[:, ind], 'ro')\n ax2.plot(xs, np.polyval(trace_c, xs), 'r')\n ax2.axes.set_ylabel('y-coordinate')\n ax22.plot(cols, ycenter[:, ind] - np.polyval(trace_c, cols), 'ro')\n ax22.axes.set_ylim(-0.5, 0.5)\n ax22.axes.set_ylabel('Fit Residual (pixels)')\n ax2.set_xlabel('Column Number');\n if pyversion>=3: \n input('trace completed')\n else:\n raw_input('trace completed')\n return dictionary\n\n##################################################\n\n\ndef extract(img,dictionary, key=3, edgeleft=30, edgeright=30, othertrace=None, shift=0, verbose=False):\n extract = False\n _grism = dictionary[img]['GRATENAM']\n _slit = dictionary[img]['SLMSKNAM'] \n setup = (_grism,_slit)\n _dir = '_'.join(setup)\n if not os.path.isdir(_dir):\n os.mkdir(_dir)\n if not os.path.isdir(_dir + '/' + str(key)):\n os.mkdir(_dir + '/' + str(key))\n \n if verbose:\n print('dimension ',key)\n print(img)\n \n if othertrace:\n if 'trace' + str(key) in dictionary[othertrace]:\n slitpos = dictionary[othertrace]['trace' + str(key)]\n trace_c = dictionary[othertrace]['tracefit' + str(key)]\n peak = dictionary[othertrace]['peakpos' + str(key)]\n extract = True\n else:\n print('Warning: ',othertrace,' do not have a trace')\n\n if 'trace' + str(key) in dictionary[img]:\n slitpos = dictionary[img]['trace' + str(key)]\n trace_c = dictionary[img]['tracefit' + str(key)]\n peak = dictionary[img]['peakpos' + str(key)]\n extract = True\n \n if extract is False:\n print('\\n### Error: trace not found')\n return dictionary\n else:\n sky = dictionary[img]['sky' + str(key)]\n image = dictionary[img]['trimmed' + str(key) ]\n nosky = image - sky\n \n # get the a pixel coordinate near the image center\n ny, nx = image.shape\n cy, cx = ny//2, nx//2\n # create 1d arays of the possible x and y values\n xs = np.arange(nx)\n ys = np.arange(ny)\n \n # pixel coordinates for each pixel\n yvals, xvals = np.indices(image.shape)\n \n # normalize to the pixel brightness at the trace center\n yinds = (np.round(np.polyval(trace_c, xs))).astype(int)\n normed = nosky / nosky[yinds, xs]\n\n # get 1D arrays with the positions along the slit and the normalized counts\n pos = slitpos.flatten()\n counts = normed.flatten()\n \n # sort by slit position\n sort_inds = pos.argsort()\n pos, counts = pos[sort_inds], counts[sort_inds]\n\n print(pos)\n # fit a spline to model the spatial profile\n t = np.linspace(pos.min() + 2, pos.max() - 2, ny // 2) # spline knot points\n profile_spl = LSQUnivariateSpline(pos, counts, t)\n\n # remove outliers and re-fit\n diff = counts - profile_spl(pos)\n sample = sigma_clip(diff)\n w = ((np.abs(diff) / sample.std()) < 3) & np.isfinite(diff)\n profile_spl = LSQUnivariateSpline(pos[w], counts[w], t)\n \n # create the profile image\n profile_image = profile_spl(slitpos)\n\n #profile image\n _out = fits.ImageHDU(data=profile_image)\n fits.writeto(_dir + '/' + str(key) + '/' + re.sub('.fits','',img) + '_profile_' +\\\n str(key) + '.fits', _out.data,header=_out.header,overwrite='yes')\n\n \n # de-weight negative values in provile_image\n profile_image[profile_image < 0] = 0\n \n # select which rows to sum\n w = (slitpos > (-1) * edgeleft) & (slitpos < edgeright )\n ymin, ymax = yvals[w].min(), yvals[w].max()\n print(ymin, ymax)\n\n ###########################################################\n ###### replacing with my simple basic extraction\n ######\n zero = nosky-nosky\n for r in range(nx):\n zero[int(peak[r])-edgeleft:int(peak[r])+edgeright,r]=1\n\n sumsource = nosky * zero\n sumsky = sky * zero\n spec_basic = sumsource.sum(axis=0)\n skybg_basic = sumsky.sum(axis=0)\n\n\n \n # calculate the weighted average (for each column)\n spec_opt = (nosky * profile_image)[ymin:ymax, :].sum(axis=0) / profile_image.sum(axis=0)\n \n # calculate the bias factor needed to scale the average to a sum\n bias_factor = np.median(spec_basic / spec_opt)\n spec_opt *= bias_factor\n\n if verbose:\n plt.figure(2)\n plt.clf()\n fig2 = plt.figure(2)\n ax1 = fig2.add_subplot(2, 1, 1)\n mean, median, std = sigma_clipped_stats(nosky)\n ax1.imshow(nosky, vmin = median - 2*std, vmax = median + 2*std)\n ax2 = fig2.add_subplot(2, 1, 2)\n mean, median, std = sigma_clipped_stats(profile_image)\n ax2.imshow(profile_image, vmin = median - 2*std, vmax = median + 2*std)\n if pyversion>=3:\n input('optimal extraction shown on figure 2')\n else:\n raw_input('optimal extraction shown on figure 2')\n \n # same for the sky background\n skybg_opt = (sky * profile_image)[ymin:ymax, :].sum(axis=0) / profile_image.sum(axis=0)\n bias_factor_sky = np.median(skybg_basic / skybg_opt)\n skybg_opt *= bias_factor_sky\n skybg_opt -= np.min(skybg_opt)\n dictionary[img]['spec_basic' + str(key)]= spec_basic\n dictionary[img]['spec_opt' + str(key)]= spec_opt\n dictionary[img]['skybg_opt' + str(key)]= skybg_opt\n\n if verbose:\n # plot the extracted spectrum\n plt.clf()\n plt.plot(xs, spec_basic, label='basic extraction')\n plt.plot(xs, spec_opt, label='optimal extraction')\n plt.legend()\n if pyversion>=3:\n input('extraction completed')\n else:\n raw_input('extraction completed') \n return dictionary\n \n\n################################################## \n\ndef fit_another(xs, cols, hwidths, fitparams, i, plot=True):\n col = cols[i]\n hwidth = hwidths[i]\n \n # find the closest matching index with a valid fit\n inds = np.arange(cols.size)\n w = np.isfinite(fitparams[:, 0]) & (inds != i)\n iref = inds[w][np.argmin(np.abs(inds[w] - i))]\n print(\"reference index is \", iref)\n\n # get the wavelength guess\n if w.sum() == 0:\n print(\"not enough data to make guess...bye!\")\n return\n if w.sum() < 4:\n guess = fitparams[iref, :].copy()\n guess[0] = guess[0] + guess[1] * (cols[i] - cols[iref])\n else:\n if w.sum() > 9:\n order = 3\n elif w.sum() > 6:\n order = 2\n else:\n order = 1\n print(\"order is\", order)\n cwav = np.polyfit(cols[w], fitparams[w, 0], order)\n cdwav = np.polyfit(cols[w], fitparams[w, 1], order)\n cscale = np.polyfit(cols[w], fitparams[w, 3], order)\n guess = (np.polyval(cwav, col), np.polyval(cdwav, col), 0.0, np.polyval(cscale, col), 0.0)\n print(\"guess is\", guess)\n\n w = (xs > (cols[i] - hwidths[i])) & (xs < (cols[i] + hwidths[i]))\n output = fmin(get_sky_difference, guess, args=(xs[w] - cols[i], bgspec[w], skyref)\n , full_output=True, disp=False, maxiter=10000)\n if output[4] == 0:\n fitparams[i, :] = output[0]\n print(output[0])\n\n if plot:\n model = model_sky(output[0], xs[w] - col, bgspec[w])\n plot_sky_model(skyref, model)\n plt.title('Fit to Section {}'.format(i))\n else:\n print(\"fit failed!\")\n\n########################################################\n###########################################################################\ndef readstandard(standardfile):\n import deimos\n import numpy as np\n import string, os\n\n if os.path.isfile(standardfile):\n listastandard = standardfile\n elif standardfile[0] == '/':\n listastandard = standardfile\n else:\n listastandard = _path[0] + '/standard/' + standardfile\n f = open(listastandard, 'r')\n liststd = f.readlines()\n f.close()\n star, ra, dec = [], [], []\n magnitude = []\n for i in liststd:\n if i[0] != '#':\n star.append(i.split()[0])\n _ra = (i.split()[1]).split(':')\n _dec = (i.split()[2]).split(':')\n ra.append((float(_ra[0]) + ((float(_ra[1]) + (float(_ra[2]) / 60.)) / 60.)) * 15)\n if '-' in str(_dec[0]):\n dec.append((-1) * (np.abs(float(_dec[0])) + ((float(_dec[1]) + (float(_dec[2]) / 60.)) / 60.)))\n else:\n dec.append(float(_dec[0]) + ((float(_dec[1]) + (float(_dec[2]) / 60.)) / 60.))\n try:\n magnitude.append(str.split(i)[3])\n except:\n magnitude.append(999)\n return np.array(star), np.array(ra), np.array(dec), np.array(magnitude)\n\n###########################################################################\n\ndef _mag2flux(wave, mag, zeropt=48.60):\n '''\n Convert magnitudes to flux units. This is important for dealing with standards\n and files from IRAF, which are stored in AB mag units. To be clear, this converts\n to \"PHOTFLAM\" units in IRAF-speak. Assumes the common flux zeropoint used in IRAF\n\n Parameters\n ----------\n wave : 1d numpy array\n The wavelength of the data points\n mag : 1d numpy array\n The magnitudes of the data\n zeropt : float, optional\n Conversion factor for mag->flux. (Default is 48.60)\n\n Returns\n -------\n Flux values!\n '''\n\n c = 2.99792458e18 # speed of light, in A/s\n flux = 10.0**( (mag + zeropt) / (-2.5) )\n return flux * (c / wave**2.0)\n\n###########################################################################\n\ndef DefFluxCal(obj_wave, obj_flux, stdstar='', mode='spline', polydeg=4, exptime =1, airmass=1,\n display=False, interactive=False):\n \"\"\"\n\n Parameters\n ----------\n obj_wave : 1-d array\n The 1-d wavelength array of the spectrum\n\n obj_flux : 1-d array\n The 1-d flux array of the spectrum\n\n stdstar : str\n Name of the standard star file to use for flux calibration. You\n must give the subdirectory and file name, for example:\n\n >>> sensfunc = DefFluxCal(wave, flux, mode='spline', stdstar='spec50cal/feige34.dat') # doctest: +SKIP\n\n If no standard is set, or an invalid standard is selected, will\n return array of 1's and a warning. A list of all available\n subdirectories and objects is available on the wiki, or look in\n pydis/resources/onedstds/\n\n mode : str, optional\n either \"linear\", \"spline\", or \"poly\" (Default is spline)\n\n polydeg : float, optional\n set the order of the polynomial to fit through (Default is 9)\n\n display : bool, optional\n If True, plot the down-sampled sensfunc and fit to screen (Default\n is False)\n\n Returns\n -------\n sensfunc : 1-d array\n The sensitivity function for the standard star\n\n \"\"\"\n stdstar2 = stdstar.lower()\n std_dir = os.path.join(os.path.dirname(_path[0]),\n 'deimos','resources', 'onedstds')\n\n if os.path.isfile(os.path.join(std_dir, stdstar2)):\n std_wave, std_mag, std_wth = np.genfromtxt(os.path.join(std_dir, stdstar2),\n skip_header=1, unpack=True)\n # standard star spectrum is stored in magnitude units\n std_flux = _mag2flux(std_wave, std_mag)\n\n std_flux = atmoexp_correction(std_wave, std_flux, exptime, airmass, site='mauna', verbose = True)\n \n # Automatically exclude these obnoxious lines...\n balmer = np.array([6563, 4861, 4341], dtype='float')\n\n # down-sample (ds) the observed flux to the standard's bins\n obj_flux_ds = []\n obj_wave_ds = []\n std_flux_ds = []\n for i in range(len(std_wave)):\n rng = np.where((obj_wave >= std_wave[i] - std_wth[i] / 2.0) &\n (obj_wave < std_wave[i] + std_wth[i] / 2.0))\n IsH = np.where((balmer >= std_wave[i] - std_wth[i] / 2.0) &\n (balmer < std_wave[i] + std_wth[i] / 2.0))\n\n # does this bin contain observed spectra, and no Balmer line?\n if (len(rng[0]) > 1) and (len(IsH[0]) == 0):\n # obj_flux_ds.append(np.sum(obj_flux[rng]) / std_wth[i])\n obj_flux_ds.append( np.nanmean(obj_flux[rng]) )\n obj_wave_ds.append(std_wave[i])\n std_flux_ds.append(std_flux[i])\n\n\n # the ratio between the standard star flux and observed flux\n # has units like erg / counts\n ratio = np.abs(np.array(std_flux_ds, dtype='float') /\n np.array(obj_flux_ds, dtype='float'))\n\n\n # interp calibration (sensfunc) on to object's wave grid\n # can use 3 types of interpolations: linear, cubic spline, polynomial\n\n # if invalid mode selected, make it spline\n if mode not in ('linear', 'spline', 'poly'):\n mode = 'spline'\n print(\"WARNING: invalid mode set in DefFluxCal. Changing to spline\")\n \n # actually fit the log of this sensfunc ratio\n # since IRAF does the 2.5*log(ratio), everything in mag units!\n LogSensfunc = np.log10(ratio)\n\n if interactive==True:\n again=True\n while again ==True:\n if pyversion>=3:\n mode = input('which mode [linear/spline/poly] [spline]? ')\n else:\n mode= raw_input('which mode [linear/spline/poly] [spline]? ')\n \n sensfunc2 = fitsens(obj_wave, obj_wave_ds, LogSensfunc, mode, polydeg, obj_flux, std_wave, std_flux, obj_flux_ds)\n if pyversion>=3:\n again = input('again [y/n/]? [y] ')\n else:\n again = raw_input('again [y/n]? [y] ')\n if not again: again = True\n if again in ['Yes','y','yes','YES']:\n again = True\n\n else:\n sensfunc2 = fitsens(obj_wave, obj_wave_ds, LogSensfunc, mode, polydeg, obj_flux,std_wave, std_flux, obj_flux_ds)\n else:\n sensfunc2 = np.zeros_like(obj_wave)\n print('ERROR: in DefFluxCal no valid standard star file found at ')\n print(os.path.join(std_dir, stdstar2))\n\n return 10**sensfunc2\n\n####################################\n\ndef fitsens(obj_wave, obj_wave_ds, LogSensfunc, mode, polydeg0, obj_flux,std_wave, std_flux, obj_flux_ds):\n global idd, _obj_wave, _LogSensfunc, _polydeg0, _mode, lines, lines2,lines3, _obj_wave_ds, ax2, ax22, fig,\\\n _obj_flux, _std_wave, _std_flux, nonincl, ax3, _obj_flux_ds, _sensfunc2\n fig = plt.figure(1)\n plt.clf()\n ax2 = fig.add_subplot(3, 1, 1)\n ax22 = fig.add_subplot(3, 1, 2)\n ax3 = fig.add_subplot(3, 1, 3)\n _obj_wave = obj_wave\n _obj_flux = obj_flux\n _std_wave = std_wave \n _std_flux = std_flux\n _obj_wave_ds = obj_wave_ds\n _obj_flux_ds = obj_flux_ds\n _LogSensfunc = LogSensfunc\n idd = list(range(len(obj_wave_ds)))\n _mode = mode\n _polydeg0 = polydeg0\n nonincl = []\n\n \n if not mode:\n mode='spline'\n \n if mode=='linear':\n sensfunc2 = np.interp(obj_wave, obj_wave_ds, LogSensfunc)\n elif mode=='spline':\n spl = UnivariateSpline(obj_wave_ds, LogSensfunc, ext=0, k=2 ,s=0.0025)\n sensfunc2 = spl(obj_wave)\n elif mode=='poly':\n if pyversion>=3:\n polydeg0 = input('polydeg ? [4] ' )\n else:\n polydeg0 = raw_input('polydeg ? [4] ')\n if not polydeg0: polydeg0 = 4\n \n fit = np.polyfit(obj_wave_ds, LogSensfunc, float(polydeg0))\n sensfunc2 = np.polyval(fit, obj_wave)\n\n _sensfunc2 = sensfunc2\n _mode = mode\n \n x0 = np.min(_obj_wave)\n x1 = np.max(_obj_wave)\n \n ax2.plot(_obj_wave_ds, _LogSensfunc, 'ko', label='sensfunc')\n lines = ax2.plot(_obj_wave, _sensfunc2, '-b', label='interpolated sensfunc')\n ax2.set_xlabel('Wavelength')\n ax2.set_ylabel('log Sensfunc')\n\n lines2 = ax22.plot(obj_wave, obj_flux*(10**_sensfunc2),'k',\n label='applied sensfunc')\n ax22.plot(std_wave, std_flux, 'ro', alpha=0.5, label='standard flux')\n\n\n lines3 = ax3.plot(_obj_wave, _obj_flux*(10**_sensfunc2),'k',\n label='applied sensfunc')\n\n ax3.plot(_obj_wave_ds, _obj_flux_ds*(10**LogSensfunc), 'bo', label='downsample observed')\n\n ax2.set_xlim([x0, x1])\n ax22.set_xlim([x0, x1])\n ax3.set_xlim([x0, x1])\n \n plt.legend()\n plt.draw()\n\n print('\\n#####################3\\n [a]dd point, [d]elete point, 1,2,3,[4],5,6 (poly order) \\n') \n \n kid = fig.canvas.mpl_connect('key_press_event', onkeypress)\n# cid = fig.canvas.mpl_connect('button_press_event',onclick)\n plt.draw()\n if pyversion>=3:\n input('left-click mark bad, right-click unmark, <d> remove. Return to exit ...')\n else:\n raw_input('left-click mark bad, right-click unmark, <d> remove. Return to exit ...')\n return _sensfunc2\n\n####################################\ndef onkeypress(event):\n global idd, _obj_wave, _LogSensfunc, _polydeg0, _mode, lines, lines2, lines3, _obj_wave_ds, ax2, ax22, fig,\\\n _obj_flux, _std_wave, _std_flux, nonincl, ax3, _obj_flux_ds, _sensfunc2\n\n\n xdata,ydata = event.xdata,event.ydata\n dist = np.sqrt((xdata-np.array(_obj_wave_ds))**2+(ydata-np.array(_LogSensfunc))**2)\n ii = np.argmin(dist)\n\n if event.key == 'a' :\n idd.append(idd[-1]+1)\n __obj_wave_ds = list(_obj_wave_ds)\n __obj_wave_ds.append(xdata)\n _obj_wave_ds = np.array(__obj_wave_ds)\n __LogSensfunc = list(_LogSensfunc)\n __LogSensfunc.append(ydata)\n _LogSensfunc = np.array(__LogSensfunc)\n ax2.plot(xdata,ydata,'db',ms=10)\n\n if event.key == 'd' :\n idd.remove(ii)\n for i in range(len(_obj_wave_ds)):\n if i not in idd: nonincl.append(i)\n\n if event.key in ['1','2','3','4','5','6','7','8','9'] :\n _polydeg0=int(event.key)\n print(_polydeg0)\n\n print(_mode)\n if _mode=='linear':\n sensfunc2 = np.interp(_obj_wave, _obj_wave_ds[idd], _LogSensfunc[idd])\n elif _mode=='spline':\n spl = UnivariateSpline(np.array(_obj_wave_ds)[idd], np.array(_LogSensfunc)[idd], ext=0, k=2 ,s=0.0025)\n sensfunc2 = spl(_obj_wave)\n elif _mode=='poly':\n print('type the order of the polyfit in the figure')\n fit = np.polyfit(np.array(_obj_wave_ds)[idd], np.array(_LogSensfunc)[idd], float(_polydeg0))\n sensfunc2 = np.polyval(fit, _obj_wave)\n \n _sensfunc2 = sensfunc2 \n ax2.plot(_obj_wave_ds, _LogSensfunc,'ok')\n ax2.plot(np.array(_obj_wave_ds)[nonincl], np.array(_LogSensfunc)[nonincl],'ow')\n lines.pop(0).remove()\n lines2.pop(0).remove()\n lines3.pop(0).remove()\n \n lines = ax2.plot(_obj_wave, _sensfunc2, '-b', label='interpolated sensfunc')\n\n lines2 = ax22.plot(_obj_wave, _obj_flux*(10**_sensfunc2),'k',\n label='applied sensfunc')\n ax22.plot(_std_wave, _std_flux, 'ro', alpha=0.5, label='standard flux')\n\n lines3 = ax3.plot(_obj_wave, _obj_flux*(10**_sensfunc2),'k',\n label='applied sensfunc')\n# ax3.plot(np.array(_obj_wave_ds)[idd], np.array(_obj_flux_ds)[idd]*(10**np.array(_LogSensfunc)[idd]), 'bo', label='downsample observed')\n ax3.plot(np.array(_obj_wave_ds)[nonincl], np.array(_obj_flux_ds)[nonincl]*(10**np.array(_LogSensfunc)[nonincl]), 'ro', label='')\n x0 = np.min(_obj_wave)\n x1 = np.max(_obj_wave)\n ax2.set_xlim([x0, x1])\n ax22.set_xlim([x0, x1])\n ax3.set_xlim([x0, x1])\n \n plt.draw()\n \n###############################################################################\n\n\ndef checkwavelength_arc(xx1, yy1, xx2, yy2, xmin, xmax, inter=True):\n import numpy as np\n\n minimo = max(min(xx1), min(xx2)) + 50\n massimo = min(max(xx1), max(xx2)) - 50\n yy1 = [0 if e < 0 else e for e in np.array(yy1)]\n yy2 = [0 if e < 0 else e for e in np.array(yy2)]\n _shift, integral = [], []\n for shift in range(-500, 500, 1):\n xxnew = xx1 + shift / 10.\n yy2interp = np.interp(xxnew, xx2, yy2)\n yy2timesyy = yy2interp * yy1\n xxcut = np.compress((np.array(xxnew) >= minimo) & (\n np.array(xxnew) <= massimo), np.array(xxnew))\n yycut = np.compress((np.array(xxnew) >= minimo) & (\n np.array(xxnew) <= massimo), np.array(yy2timesyy))\n integrale = np.trapz(yycut, xxcut)\n integral.append(integrale)\n _shift.append(shift / 10.)\n result = _shift[integral.index(max(integral))]\n if inter:\n # import matplotlib as mpl\n # mpl.use(\"TKAgg\")\n plt.figure(3)\n plt.clf()\n ratio = np.trapz(yy1, xx1) / np.trapz(yy2, xx2)\n print(ratio)\n yy3 = np.array(yy2) * float(ratio)\n xx4 = xx1 + result\n plt.plot(xx1, yy1, label='spectrum')\n plt.plot(xx2, yy3, label='reference sky')\n plt.plot(xx4, yy1, label='shifted spectrum')\n plt.legend(numpoints=1, markerscale=1.5)\n if xmin != '' and xmax != '':\n plt.xlim(xmin, xmax)\n return result\n\n##################################################################\n\ndef readtrace(ascifile):\n #\n # input: filename\n # output:\n # astropy ascii table,\n # dictionary of parameters\n #\n #import string\n from astropy.io import ascii\n aa = ascii.read(ascifile)\n bb = [str.split(i,'=') for i in aa.meta['comments']]\n meta = {i[0]:i[1] for i in bb}\n # ascii use the first line as title, but I want to file to be easy to plot\n # also without reading it with ascii\n aa = np.genfromtxt(ascifile)\n return aa,meta\n\n#################################################\ndef writetrace(trace,meta,tablename,output):\n #\n # input:\n # 1d array\n # meta = dictionary of parameters\n # table name\n # output filename\n #\n parameters = ''.join([' %s= %s\\n' % (line,meta[line]) for line in meta])[:-1]\n cc = '%s\\n %s ' %(tablename,parameters)\n# dd =[tablename] + ['# %s %s' % (line,meta[line]) for line in meta]+list(trace)\n np.savetxt(output,trace, header= parameters)\n \n###################################################\ndef summary(dictionary):\n print('#'*20 + '\\n')\n print('IMG OBJECT KEY TRIM SKY TRACE EXTRACTED WAVE FLUX STD RESPONSE')\n for img in dictionary:\n if dictionary[img]['type']=='object':\n for key in ['3','7']:\n tt = 'trimmed' + str(key) in dictionary[img]\n ss = 'nosky' + str(key) in dictionary[img]\n trace = 'peakpos_' + str(key) in dictionary[img]\n ex = 'spec_opt' +str(key) in dictionary[img]\n wav = 'wave' + str(key) in dictionary[img]\n flux = 'spec_flux' + str(key) in dictionary[img]\n response = 'response' + str(key) in dictionary[img]\n std = 'std' in dictionary[img]\n line = '%s %s %s %s %s %s %s %s %s %s %s' % (img,dictionary[img]['OBJECT'],key, tt,ss,trace,ex,wav,flux,std,response)\n print(line)\n print('#'*20 + '\\n')\n\n###################################################################################\n\ndef onkeypress1(event):\n global _xx,_yy, center, lower, upper, l1,l2,u1,u2, line1, line2, line3, line5, fig, gs, ax1, ax2,line6,\\\n line7,line8, nx,linel1,linel2,lineu1,lineu2\n \n xdata,ydata = event.xdata,event.ydata\n \n if event.key == '6' :\n lower = xdata\n if event.key == '7' :\n upper = xdata\n if event.key == '1' :\n l1 = xdata\n if event.key == '2' :\n l2 = xdata\n if event.key == '3' :\n u1 = xdata\n if event.key == '4' :\n u2 = xdata\n if event.key == 'c' :\n center = xdata\n\n \n line1.pop(0).remove()\n line2.pop(0).remove()\n line3.pop(0).remove()\n line5.pop(0).remove()\n line6.pop(0).remove()\n line7.pop(0).remove()\n line8.pop(0).remove()\n linel1.pop(0).remove()\n linel2.pop(0).remove()\n lineu1.pop(0).remove()\n lineu2.pop(0).remove()\n \n\n line5 = ax1.plot(_yy,_xx,'-b')\n line1 = ax1.plot([l1,l2],[0,0],'-k')\n line2 = ax1.plot([u1,u2],[0,0],'-k')\n line3 = ax1.plot([lower,upper],[1,1],'-k')\n line6 = ax1.plot([center],[1],'or')\n line7 = ax2.plot([lower,lower],[0,nx],'--r')\n line8 = ax2.plot([upper,upper],[0,nx],'--r')\n linel1 = ax2.plot([l1,l1],[0,nx],'--y')\n linel2 = ax2.plot([l2,l2],[0,nx],'--y')\n lineu1 = ax2.plot([u1,u1],[0,nx],'--y')\n lineu2 = ax2.plot([u2,u2],[0,nx],'--y')\n \ndef interactive_extraction(dictionary,img, key, listobjects, nsky0, interactive=True):\n global _dictionary, _img, _key, line1, line2, line3, line5, line6, gs, ax1, ax2,\\\n line40,line41,line42,line43, line7, _nsky1, bottom,top\n \n import string\n _grism = dictionary[img]['GRATENAM']\n _slit = dictionary[img]['SLMSKNAM'] \n setup = (_grism,_slit)\n _dir = '_'.join(setup)\n # define global varaiable \n _dictionary = dictionary\n _img = img\n _key = key\n _nsky1 = nsky0\n bottom = None\n top = None\n \n if 'trimflat' + str(_key) in _dictionary[_img]: \n image = _dictionary[_img]['trimflat' + str(_key) ]\n elif 'trimmed' + str(_key) in _dictionary[_img]:\n image = _dictionary[_img]['trimmed' + str(_key) ][0].data\n \n sky = _dictionary[_img]['sky' + str(_key)]\n nosky = image - sky\n ny, nx = nosky.shape\n xs = np.arange(nx)\n peak = _dictionary[_img]['peakpos_' + str(_key)]\n\n fig = plt.figure(3,figsize=(7,9))\n plt.clf()\n gs = gridspec.GridSpec(nrows=3, \n ncols=2, \n figure=fig, \n width_ratios= [1, 1],\n height_ratios=[1, 1, 1],\n wspace=0.3,\n hspace=0.3)\n ny, nx = image.shape\n sample = sigma_clip(image)\n vmin = sample.mean() - 1 * sample.std()\n vmax = sample.mean() + 3 * sample.std()\n yvals, xvals = np.indices(image.shape)\n extent = (xvals.min(), xvals.max(), yvals.min(), yvals.max())\n \n ax2 = fig.add_subplot(gs[0:2, 0:2])\n ax2.imshow(image, origin='lower', cmap='gray', aspect='auto', vmin=vmin, vmax=vmax, extent=extent)\n line1 = ax2.plot(xs,peak,'-r')\n line2 = ax2.plot(xs,peak + float(_dictionary[_img]['aplow_'+str(_key)]),'-w')\n line3 = ax2.plot(xs,peak + float(_dictionary[_img]['aphigh_'+str(_key)]),'-w')\n bkg = np.array(string.split(_dictionary[_img]['bckgrintervals_' + str(_key)],','),float)\n line40 = ax2.plot(xs,peak + bkg[0],'-y')\n line41 = ax2.plot(xs,peak + bkg[1],'-y')\n line42 = ax2.plot(xs,peak + bkg[2],'-y')\n line43 = ax2.plot(xs,peak + bkg[3],'-y')\n\n ax1 = fig.add_subplot(gs[2, 0:2])\n if 'spec_basic'+str(_key) in _dictionary[_img]:\n spec_basic = _dictionary[_img]['spec_basic' + str(_key)]\n spec_opt = _dictionary[_img]['spec_opt' + str(_key)]\n line5 = ax1.plot(xs, spec_opt, '-r', label='optimal extraction')\n line7 = ax1.plot(xs, spec_basic, '-b', label='')\n line6 = ax1.plot(xs, spec_basic, '-b', label='basic extraction')\n ax1.set_xlabel('pixels')\n ax1.set_ylabel('counts')\n ax1.legend()\n\n if interactive:\n othertrace = None\n _shift=0\n if pyversion>=3:\n answ = input('Do you want to use a different trace [1,2,3,4,5] [n] ?\\n (see figure 2)\\n[n] use object frame,\\n1,2,3,4,5 (trace of different object ')\n else:\n answ = raw_input('Do you want to use a different trace [1,2,3,4,5] [n] ?\\n (see figure 2)\\n[n] use object frame,\\n1,2,3,4,5 (trace of different object ')\n \n if not answ:\n answ='n'\n if answ in ['No','N','n','NO']:\n othertrace = None\n else:\n othertrace = listobjects[int(answ)]\n print(othertrace)\n \n if othertrace is not None:\n _dictionary[_img]['peakpos_' + str(_key)] = _dictionary[othertrace]['peakpos_' + str(_key)]\n peak = _dictionary[othertrace]['peakpos_' + str(_key)]\n line1.pop(0).remove()\n line1 = ax2.plot(xs,peak,'-g')\n \n print('\\n#####################\\n 1,2,3,4 for background\\n 6,7 for aperture \\n b,t to zoom the spectrum\\n [c]-enter,[r] extract again) \\n') \n kid = fig.canvas.mpl_connect('key_press_event',onkeypress5)\n plt.draw()\n if pyversion>=3:\n input('left-click mark bad, right-click unmark, <d> remove. Return to exit ...')\n else:\n raw_input('left-click mark bad, right-click unmark, <d> remove. Return to exit ...')\n \n \n # take the trace from the other file but the rest of parameters from the target\n meta ={\n 'aplow': _dictionary[_img]['aplow_' + str(_key)],\n 'bckgrfunc': _dictionary[_img]['bckgrfunc_' + str(_key)],\n 'bckgr_low_reject': _dictionary[_img]['bckgr_low_reject_' + str(_key)],\n 'displine': _dictionary[_img]['displine_' + str(_key)],\n 'aphigh': _dictionary[_img]['aphigh_' + str(_key)],\n 'bckgrfunc_iraforder': _dictionary[_img]['bckgrfunc_iraforder_' + str(_key)],\n 'coeffs': _dictionary[_img]['coeffs_' + str(_key)],\n 'bckgrintervals': _dictionary[_img]['bckgrintervals_' + str(_key)],\n 'bckgr_niterate': _dictionary[_img]['bckgr_niterate_' + str(_key)],\n 'bckgr_high_reject': _dictionary[_img]['bckgr_high_reject_' + str(_key)],\n }\n \n trace = dictionary[_img]['peakpos_'+str(_key)]\n _dictionary[_img]['peakpos_'+str(_key)] = trace\n imgtrace = re.sub('.fits','',_img) + '_' + str(_key) + '_trace.ascii'\n output = _dir + '/' + str(_key) + '/' + imgtrace \n # write the new trace for this object\n writetrace(trace,meta, 'trace', output)\n\n return _dictionary\n\ndef onkeypress5(event):\n global _dictionary, _img, _key, line1, line2, line3, line5, line6, gs, ax1, ax2,\\\n line40,line41,line42,line43,line7, _nsky1, bottom,top\n import string\n \n xdata,ydata = event.xdata,event.ydata\n print(xdata,ydata)\n\n if 'trimflat' + str(_key) in _dictionary[_img]: \n image = _dictionary[_img]['trimflat' + str(_key) ]\n elif 'trimmed' + str(_key) in _dictionary[_img]:\n image = _dictionary[_img]['trimmed' + str(_key) ][0].data\n \n sky = _dictionary[_img]['sky' + str(_key)]\n nosky = image - sky\n ny, nx = nosky.shape\n xs = np.arange(nx)\n peak = _dictionary[_img]['peakpos_' + str(_key)]\n peakinterp = interp1d(xs,peak) \n ny, nx = image.shape\n sample = sigma_clip(image)\n vmin = sample.mean() - 1 * sample.std()\n vmax = sample.mean() + 3 * sample.std()\n yvals, xvals = np.indices(image.shape)\n extent = (xvals.min(), xvals.max(), yvals.min(), yvals.max())\n\n if len(line1): line1.pop(0).remove()\n if len(line2): line2.pop(0).remove()\n line3.pop(0).remove()\n line40.pop(0).remove()\n line41.pop(0).remove()\n line42.pop(0).remove()\n line43.pop(0).remove()\n \n \n bkg = np.array(string.split(_dictionary[_img]['bckgrintervals_' + str(_key)],','),float)\n if event.key == '6' :\n _dictionary[_img]['aplow_' + str(_key)] = ydata - peakinterp(xdata)\n if event.key == '7' :\n _dictionary[_img]['aphigh_' + str(_key)] = ydata - peakinterp(xdata)\n print('7')\n if event.key == '1' :\n bkg[0] = ydata - peakinterp(xdata)\n _dictionary[_img]['bckgrintervals_' + str(_key)] = ', '.join([str(i) for i in bkg])\n if event.key == '2' :\n bkg[1] = ydata - peakinterp(xdata)\n _dictionary[_img]['bckgrintervals_' + str(_key)] = ', '.join([str(i) for i in bkg])\n if event.key == '3' :\n bkg[2] = ydata - peakinterp(xdata)\n _dictionary[_img]['bckgrintervals_' + str(_key)] = ', '.join([str(i) for i in bkg])\n if event.key == '4' :\n bkg[3] = ydata - peakinterp(xdata)\n _dictionary[_img]['bckgrintervals_' + str(_key)] = ', '.join([str(i) for i in bkg])\n if event.key == 'c' :\n shift = ydata - peakinterp(xdata)\n peak = peak + shift\n _dictionary[_img]['peakpos_' + str(_key)] = peak\n\n \n line1 = ax2.plot(xs,peak,'-r')\n line2 = ax2.plot(xs,peak + float(_dictionary[_img]['aplow_'+str(_key)]),'-w')\n line3 = ax2.plot(xs,peak + float(_dictionary[_img]['aphigh_'+str(_key)]),'-w')\n\n bkg = np.array(string.split(_dictionary[_img]['bckgrintervals_' + str(_key)],','),float)\n line40 = ax2.plot(xs,peak + bkg[0],'-y')\n line41 = ax2.plot(xs,peak + bkg[1],'-y')\n line42 = ax2.plot(xs,peak + bkg[2],'-y')\n line43 = ax2.plot(xs,peak + bkg[3],'-y')\n\n ## write nosky file from dictionary\n readnoise = 16\n gain = 1\n apmedfiltlength = 61 # no idea what is it\n colfitorder, scattercut = 15, 25 # no idea what is it\n othertrace = None\n _shift = 0\n if _nsky1:\n print('\\n##### Warning: extract on the trimmed image instead of the sky')\n _rawdataname = 'trimmed'\n else:\n _rawdataname = 'nosky'\n\n if 'spec_basic'+str(_key) in _dictionary[_img]:\n spec_basic = _dictionary[_img]['spec_basic' + str(_key)]\n spec_opt = _dictionary[_img]['spec_opt' + str(_key)]\n if line5: line5.pop(0).remove()\n if line6: line6.pop(0).remove()\n line5 = ax1.plot(xs, spec_opt,'-r' ,label='optimal extraction')\n line6 = ax1.plot(xs, spec_basic, '-b', label='basic extraction')\n ax1.set_xlabel('pixels')\n ax1.set_ylabel('counts')\n ax1.legend()\n\n\n if event.key in ['r','c']:\n from deimos import irafext\n spec_opt1, spec_basic1, skybg_opt1, spec_var1 = irafext.opextract_new(_img, 0, 0, False, 1,\\\n readnoise, gain, apmedfiltlength,\n colfitorder, scattercut,\n colfit_endmask=10,\n diagnostic= False,\n production= True,\\\n other = othertrace, shift=_shift,\n dictionary= _dictionary, key= _key,\n rawdataname = _rawdataname,\n bckhigh = False, bcklow = False)\n\n if line7:\n line7.pop(0).remove()\n line7 = ax1.plot(xs, spec_opt1, '-g', label='new extraction')\n _dictionary[_img]['spec_basic' + str(_key)]= spec_basic1\n _dictionary[_img]['spec_opt' + str(_key)]= spec_opt1\n \n if event.key =='b':\n bottom = ydata\n if event.key =='t':\n top = ydata\n \n if bottom and top:\n spec_basic = _dictionary[_img]['spec_basic' + str(_key)]\n spec_opt = _dictionary[_img]['spec_opt' + str(_key)]\n if line5: line5.pop(0).remove()\n if line6: line6.pop(0).remove()\n line5 = ax1.plot(xs, spec_opt,'-r' ,label='optimal extraction')\n line6 = ax1.plot(xs, spec_basic, '-b', label='basic extraction')\n if line7:\n line7.pop(0).remove()\n line7 = ax1.plot(xs, spec_opt1, '-g', label='new extraction')\n ax1.set_xlabel('pixels')\n ax1.set_ylabel('counts')\n ax1.legend()\n ax1.set_ylim(bottom,top)\n \n# # add exstraction to the dictionary\n# # iraf dimensions (to be checked)\n# # 1 optimal extraction\n# # 2 basic extraction\n# # 3 sky\n# # 4 errors\n# _dictionary[img]['spec_basic' + str(key)]= spec_basic\n# _dictionary[img]['spec_opt' + str(key)]= spec_opt\n# _dictionary[img]['skybg_opt' + str(key)]= skybg_opt\n# _dictionary[img]['spec_var' + str(key)]= spec_var\n \n\n\n\n \n############################################\n \n \n \ndef profilespec(data,dispersion):\n global _xx,_yy, center, lower, upper, l1,l2,u1,u2, line1, line2, line3, line5, fig, gs, ax1, ax2, line6,\\\n line7,line8, nx,linel1,linel2,lineu1,lineu2\n print(\"\\n##################\\n 1 = bg1\\n 2 = bg2\\n 3 = bg3\\n 4 = bg4\\n 6 = lower\\n 7 = upper\\n c = center\")\n fig = plt.figure(1,figsize=(7,9))\n plt.clf()\n gs = gridspec.GridSpec(nrows=3, \n ncols=2, \n figure=fig, \n width_ratios= [1, 1],\n height_ratios=[1, 1, 1],\n wspace=0.3,\n hspace=0.3)\n\n # upper plot\n datat = data.transpose()\n ny, nx = data.shape\n sample = sigma_clip(data)\n vmin = sample.mean() - 1 * sample.std()\n vmax = sample.mean() + 3 * sample.std()\n yvals, xvals = np.indices(datat.shape)\n extent = (xvals.min(), xvals.max(), yvals.min(), yvals.max())\n ax2 = fig.add_subplot(gs[0:2, 0:2])\n ax2.imshow(datat, origin='lower', cmap='gray', aspect='auto', vmin=vmin, vmax=vmax, extent=extent)\n\n \n if dispersion is None:\n xx = data.mean(axis=1)\n else:\n xx = data[:,dispersion-50:dispersion+50].mean(axis=1)\n xx= (xx - np.min(xx))/(np.max(xx)-np.min(xx)) + 1e-3\n yy = np.arange(len(xx))\n\n _xx = xx\n _yy = yy\n\n high = 1.\n fwhm = 5.\n _cent = len(_yy)/2.\n # starting guess for the profile model\n guess = (high, _cent, fwhm)\n guessbound = [(0.1,1.9),(_cent-30, _cent+30),(fwhm/3.,fwhm*2)]\n params1 = minimize(get_profile_chisq, guess, args=(_yy, _xx), bounds=guessbound)\n\n centfit = params1['x'][1]\n fwhmfit = params1['x'][2]\n if centfit!= _cent:\n center = centfit\n fwhm = np.min([fwhmfit , 15])\n \n else:\n center = _yy[np.argmax(_xx)]\n fwhm = 7\n\n \n lower = center - fwhm * 2.5\n upper = center + fwhm * 2.5\n l1 = np.max([center - fwhm * 5, 5])\n l2 = np.max([center - fwhm *4,10])\n u1 = np.min([center + fwhm * 4, len(_xx)-10])\n u2 = np.min([center + fwhm * 5, len(_xx)-5])\n\n ax1 = fig.add_subplot(gs[2, 0:2])\n \n line5 = ax1.plot(_yy,_xx,'-b')\n line1 = ax1.plot([l1,l2],[0,0],'-k')\n line2 = ax1.plot([u1,u2],[0,0],'-k')\n line3 = ax1.plot([lower,upper],[1,1],'-k')\n line6 = ax1.plot(center,1,'or')\n line7 = ax2.plot([lower,lower],[0,nx],'--r')\n line8 = ax2.plot([upper,upper],[0,nx],'--r')\n linel1 = ax2.plot([l1,l1],[0,nx],'--y')\n linel2 = ax2.plot([l2,l2],[0,nx],'--y')\n lineu1 = ax2.plot([u1,u1],[0,nx],'--y')\n lineu2 = ax2.plot([u2,u2],[0,nx],'--y')\n \n kid = fig.canvas.mpl_connect('key_press_event',onkeypress1)\n plt.draw()\n if pyversion>=3:\n input('left-click mark bad, right-click unmark, <d> remove. Return to exit ...')\n else:\n raw_input('left-click mark bad, right-click unmark, <d> remove. Return to exit ...')\n return center, lower, upper, l1,l2,u1,u2\n \ndef poly(x, y, order, rej_lo, rej_hi, niter):\n\n # x = list of x data\n # y = list of y data\n # order = polynomial order\n # rej_lo = lower rejection threshold (units=sigma)\n # rej_hi = upper rejection threshold (units=sugma)\n # niter = number of sigma-clipping iterations\n\n npts = []\n iiter = 0\n iterstatus = 1\n\n # sigma-clipping iterations\n rejected=[]\n while iiter < niter and iterstatus > 0:\n iterstatus = 0\n tmpx = []\n tmpy = []\n npts.append(len(x))\n coeffs = polyfit(x, y, order)\n fit = polyval(coeffs, x)\n\n # calculate sigma of fit\n\n sig = 0\n for ix in range(npts[iiter]):\n sig = sig + (y[ix] - fit[ix]) ** 2\n sig = math.sqrt(sig / (npts[iiter] - 1))\n\n # point-by-point sigma-clipping test\n for ix in range(npts[iiter]):\n if y[ix] - fit[ix] < rej_hi * sig and fit[ix] - y[ix] < rej_lo * sig:\n tmpx.append(x[ix])\n tmpy.append(y[ix])\n else:\n rejected.append([x[ix],y[ix]])\n iterstatus = 1\n x = tmpx\n y = tmpy\n iiter += 1\n\n # coeffs = best fit coefficients\n # iiter = number of sigma clipping iteration before convergence\n return coeffs, iiter, rejected\n\n########################################\n\ndef tracenew(img, dictionary, key, step, verbose, polyorder, sigma, niteration,rawdataname='nosky'):\n if rawdataname=='nosky':\n data = dictionary[img][rawdataname + str(key)]\n else:\n data = dictionary[img][rawdataname + str(key)][0].data\n dispersion= None\n if verbose:\n plt.clf()\n image_plot(data,2,dictionary[img]['OBJECT'])\n if pyversion>=3:\n dispersion = input('where do you want to look for the object profile [[a]ll / 300] ? [a] ')\n else:\n dispersion = raw_input('where do you want to look for the object profile [[a]ll / 300] ? [a] ')\n if not dispersion: dispersion= 'a'\n if dispersion in ['a','N','NO','n']: dispersion= None\n else:\n dispersion=int(dispersion)\n center, lower, upper, l1,l2,u1,u2 = profilespec(data,dispersion)\n if verbose:\n print(center, lower, upper, l1,l2,u1,u2)\n\n ny, nx = data.shape\n # create 1d arays of the possible x and y values\n xs = np.arange(nx)\n ys = np.arange(ny)\n \n # get the median for each row\n xx0 = data.mean(axis=1)\n # the 0.01 is because does not like the zero value\n profile = (xx0 - np.min(xx0)+0.01)/np.max(xx0)\n\n high = 1.\n fwhm = np.sqrt(center - lower)\n # starting guess for the profile model\n guess = (high,center, fwhm)\n guessbound = [(0.1,1.9),(center-10,center+10),(fwhm/3.,fwhm*2)]\n\n loop = np.arange(int(step/2),len(data[1]),step)\n centerv,highv,fwhmv=[],[],[]\n for ii in loop:\n xx1 = data[:, ii - int(step/2.): ii + int(step/2.)].mean(axis=1)\n xx1 = (xx1 - np.min(xx1)+0.01)/np.max(xx1)\n params1 = minimize(get_profile_chisq, guess, args=(ys, xx1),bounds=guessbound)\n if verbose:\n print(\"best fit parameters are\", params1)\n model1 = get_profile_model(params1['x'], ys)\n centerv.append(params1['x'][1])\n highv.append(params1['x'][0])\n fwhmv.append(params1['x'][2])\n \n polypar = np.polyfit(loop,centerv,polyorder)\n peakpos = np.polyval(polypar, xs)\n polypar1,niter,rejected = poly(loop, centerv, polyorder, sigma, sigma, niteration)\n\n peakpos1 = np.polyval(polypar1, xs)\n if verbose:\n image_plot(data,3)\n plt.plot(loop,centerv,'or')\n plt.plot(xs,peakpos,'-g')\n plt.plot(xs,peakpos1,'-c')\n plt.title(dictionary[img]['OBJECT'])\n for line in rejected:\n plt.plot(line[0],line[1],'om')\n if pyversion>=3:\n input('stop here')\n else:\n raw_input('stop here')\n plt.clf()\n \n meta={}\n meta['aplow']=lower-center\n meta['bckgrfunc']='chebyshev'\n meta['bckgr_low_reject']= 5\n\n if dispersion:\n meta['displine']=dispersion\n else:\n meta['displine']= 1000\n \n meta['aphigh']= upper - center\n meta['bckgrfunc_iraforder']= 1\n # this coeff are not used since we give directly the peakpos\n meta['coeffs'] = [2.0, 4.0, 10.0, 4090.0, -3.961599, -2.403275, 2.146498, -0.08873626]\n meta['bckgrintervals']= [[l1-center,l2-center],[u1-center,u2-center]]\n meta['bckgr_niterate']= 5\n meta['bckgr_high_reject']= 3\n\n _grism = dictionary[img]['GRATENAM']\n _slit = dictionary[img]['SLMSKNAM'] \n setup = (_grism,_slit)\n _dir = '_'.join(setup)\n imgtrace = re.sub('.fits','',img) + '_' + str(key) + '_trace.ascii'\n output = _dir + '/' + str(key) + '/' + imgtrace\n writetrace(peakpos1,meta,'trace',output)\n\n for key1 in meta:\n print(meta[key1],key1)\n if key1 in ['aplow','displine','aphigh']:\n dictionary[img][key1 + '_' + str(key)] = float(meta[key1])\n else: \n dictionary[img][key1 + '_' + str(key)] = re.sub('\\[?]?','', str(meta[key1]))\n \n dictionary[img]['peakpos_'+str(key)] = peakpos1\n \n return peakpos1,centerv,highv,fwhmv,dictionary\n\n##########################################################################\ndef smoothListGaussian(list, degree=5):\n # run a gaussian smooth to a list\n # last points are all the same to keep the same size \n window = degree*2-1\n weight = np.array([1.0]*window)\n weightGauss = []\n for i in range(window):\n i = i-degree+1\n frac = i/float(window)\n gauss = 1/(np.exp((4*(frac))**2))\n weightGauss.append(gauss)\n weight = np.array(weightGauss)*weight\n smoothed = [0.0]*(len(list)-window)\n for i in range(len(smoothed)):\n smoothed[i] = sum(np.array(list[i:i+window])*weight)/sum(weight)\n\n smoothed = smoothed + smoothed[-1:]*int(window)\n return smoothed\n\n############################################################\ndef findslit(img,key, verbose=False,cut=None):\n hdu= fits.open(img)\n x = hdu[key].data\n prof = x.mean(axis=0)\n prof = prof/np.max(prof)\n xx = np.arange(len(prof))\n prof = smoothListGaussian(list(prof), degree=5)\n prof = np.array(prof)\n if cut is None:\n cut = np.mean(prof)\n start = 0\n end = len(prof)\n point=[]\n prof1 = prof\n xx1 = xx\n mode = 'g'\n while end-start> 100:\n if mode =='g':\n if len(xx1[prof1>cut]):\n start = xx1[prof1>cut][0]\n mode = 'm'\n else:\n break\n else:\n if len(xx1[prof1>cut]):\n start = xx1[prof1<cut][0]\n mode = 'g'\n else:\n break\n point.append(start)\n prof1 = prof1[(xx1>start)]\n xx1 = xx1[(xx1>start)]\n\n yy = np.zeros(len(point))+cut\n if verbose:\n plt.clf()\n plt.plot(xx,prof,'-r')\n plt.plot(point,yy,'ob')\n\n ss = np.array(point[:-1])[np.diff(point)>100] + 20\n ee = np.array(point[1:])[np.diff(point)>100] - 20\n return list(zip(ss,ee))\n\n#################################################\n\ndef atmoexp_correction(wavestd,fluxstd,exptime,airmass,site='mauna', verbose = False):\n exptime = 1\n import deimos\n if site =='mauna':\n extinction = _path[0] + '/resources/extinction/mauna.dat'\n data = np.genfromtxt(extinction)\n aae, yye = zip(*data)\n aae, yye = np.array(aae, float), np.array(yye, float)\n atm_std = np.interp(wavestd, aae, yye)\n aircorr = 10 ** (0.4 * np.array(atm_std) * airmass)\n fluxstd_corr = (fluxstd / exptime) * aircorr\n if verbose:\n plt.clf()\n plt.plot(wavestd,fluxstd,'-r')\n plt.plot(wavestd,fluxstd_corr,'-b')\n if pyversion>=3:\n input('stop here')\n else:\n raw_input('stop here')\n return fluxstd_corr\n\n##########################################\n\ndef flatcombine2(flatlist, verbose = False, response = True, Saxis=0):\n \"\"\"\n input: list of flats\n output: \n - combined flat (median)\n - normalized flat\n \"\"\"\n files = flatlist\n for i in range(0,len(files)):\n #hdu_i = fits.open(files[i])\n# im_i = hdu_i[0].data\n if (i==0):\n all_data = files[i] \n elif (i>0):\n all_data = np.dstack( (all_data, files[i]))\n\n # do median across whole stack of flat images\n flat_stack = np.nanmedian(all_data, axis=2)\n\n if verbose:\n plt.figure(2)\n plt.clf()\n print('combined flat')\n image_plot(flat_stack,frame=2,_title='merged flat')\n# plt.imshow(flat_stack)\n\n if response:\n print('normalize flat')\n xdata = np.arange(all_data.shape[1]) # x pixels\n flat_1d = convolve(flat_stack.mean(axis=Saxis), Box1DKernel(40))\n otherdirection = convolve(flat_stack.mean(axis=1), Box1DKernel(5))\n otherdirection = otherdirection/np.max(otherdirection)\n flat_2d = flat_stack.mean(axis=Saxis)\n flat = flat_stack\n \n if Saxis==0:\n for i in range(flat_stack.shape[Saxis]):\n flat[i,:] = flat_stack[i,:] / (flat_1d * otherdirection[i])\n else:\n for i in range(flat_stack.shape[Saxis]):\n flat[:,i] = flat_stack[:,i] / (flat_1d * otherdirection[i])\n \n ### remve outlier in the flat\n flat[flat>1.1]=1.1\n flat[flat<0.9]=0.9\n\n if verbose:\n# print('here')\n# plt.figure(1)\n# plt.clf()\n# plt.plot(xdata,flat_2d,'r-')\n# plt.plot(xdata,flat_1d,'b-')\n image_plot(flat_stack,frame=1,_title='normalized flat')\n \n# plt.figure(3)\n# plt.clf()\n# plt.plot(xdata,flat_2d/flat_1d,'r-')\n# ds9 = pyds9.DS9('deimos')\n# ds9.set('frame 1')\n# ds9.set('scale zscale');\n# ds9.set_np2arr(flat)\n else:\n flat = None\n \n return flat_stack, flat\n\n######################################\ndef writetable(wave,flux,hed, output = '_output', sky=None, cov=None, optimal=None, verbose=False):\n from astropy.io import fits as pyfits\n # BINTABLE COLUMNS : wl in Angstrom, flux in erg cm**(-2) s**(-1)\n # angstrom**(-1)\n pixelCount = len(flux)\n wlArray = np.array([wave], dtype=object)\n wlCol = pyfits.Column(name='WAVE',\n format='%sE' % (pixelCount,), unit='angstrom', array=wlArray)\n\n fluxArray = np.array([flux], dtype=object) \n fluxCol = pyfits.Column(name='FLUX',\n format='%sE' % (pixelCount,), unit='erg cm**(-2) s**(-1) angstrom**(-1)', array=fluxArray)\n vec = [wlCol,fluxCol]\n if cov is not None:\n # maybe I need to take the sqrt\n # fluxErrArray = np.array([np.sqrt(varianceData[0])])\n #\n fluxErrArray = np.array([cov], dtype=object)\n fluxErrCol = pyfits.Column(name='ERR',\n format='%sE' % (pixelCount,), unit='erg cm**(-2) s**(-1) angstrom**(-1)', array=fluxErrArray)\n vec.append(fluxErrCol)\n\n if sky is not None:\n skyArray = np.array([sky], dtype=object)\n backgroundCol = pyfits.Column(name='SKYBACK',\n format='%sE' % (pixelCount,), unit='erg cm**(-2) s**(-1) angstrom**(-1)', array=skyArray)\n vec.append(backgroundCol)\n\n if optimal is not None:\n optimalArray = np.array([optimal], dtype=object)\n optimalCol = pyfits.Column(name='OPTIMAL',\n format='%sE' % (pixelCount,), unit='erg cm**(-2) s**(-1) angstrom**(-1)', array=optimalArray)\n vec.append(optimalCol)\n\n coldefs = pyfits.ColDefs(vec)\n tbhdu = pyfits.BinTableHDU.from_columns(coldefs)\n hdu = pyfits.PrimaryHDU(header=hed)\n thdulist = pyfits.HDUList([hdu, tbhdu])\n thdulist.writeto(output, overwrite=True, output_verify=\"fix+ignore\")\n\n\n##################################################################################################################\ndef writefitstable(setup,name): \n _dir = '_'.join(setup)\n wave={}\n flux={}\n sky={}\n variance={}\n # read pipeline output\n for key in ('3','7'):\n line = _dir+'/'+str(key)+ '/*' + str(name)+ '*flux.ascii'\n print(line)\n imglist = glob.glob(line)\n print(imglist)\n if key not in sky:\n sky[key] = []\n if key not in variance:\n variance[key] = []\n if key not in flux:\n flux[key] = []\n if key not in wave:\n wave[key] = [] \n for img in imglist:\n print(img)\n xxx = QTable.read(img,format='ascii')\n wave[key].append(xxx['wave'])\n flux[key].append(xxx['spec_flux'])\n \n if 'mysky' in xxx.keys():\n sky[key].append(xxx['mysky'])\n if 'spec_var' in xxx.keys():\n variance[key].append(xxx['spec_var'])\n \n # interpole the flux to the same wave\n median={}\n med_variance = {}\n med_sky={}\n for key in flux.keys():\n if key not in median:\n median[key]=[]\n \n if len(wave[key])>1:\n for i,j in enumerate(wave[key]):\n if i!=0:\n interp = interp1d(wave[key][i],flux[key][i], bounds_error=False)\n flux[key][i] = interp(wave[key][0])\n \n # do the median \n meanflux = np.nanmean(flux[key],axis=0)\n medianflux = np.nanmedian(flux[key],axis=0)\n median[key]=medianflux\n \n else:\n median[key] = flux[key][0]\n \n \n if len(variance[key])>0:\n if len(variance[key])>1:\n for i,j in enumerate(variance[key]):\n if i!=0:\n interpv = interp1d(wave[key][i],variance[key][i], bounds_error=False)\n variance[key][i] = interpv(wave[key][0])\n # do median\n \n medianvar = np.nanmedian(variance[key],axis=0)\n med_variance[key]=medianvar\n \n else:\n med_variance[key] = variance[key][0]\n else:\n med_variance[key] = None\n \n if len(sky[key])>0:\n if len(sky[key])>1:\n for i,j in enumerate(sky[key]):\n interps = interp1d(wave[key][i],sky[key][i], bounds_error=False)\n sky[key][i] = interps(wave[key][0])\n # do median\n mediansky = np.nanmedian(sky[key],axis=0)\n med_sky[key]=mediansky \n else:\n med_sky[key] = sky[key][0]\n else:\n med_sky[key] = None\n \n # read the header\n imgtrim = string.split(imglist[0],name)[0]+'trimmed.fits'\n hdu = fits.open(imgtrim)\n hed = hdu[0].header\n\n \n for key in ['3','7']:\n if wave[key][0][-1] - wave[key][0][0] < 0:\n print('invert vector')\n wave[key][0] = wave[key][0][::-1]\n median[key] = median[key][::-1]\n if med_sky[key] is not None:\n med_sky[key] = med_sky[key][::-1]\n if med_variance[key] is not None:\n med_variance[key] = med_variance[key][::-1]\n \n # write the table \n xx = np.append(wave['3'][0],wave['7'][0])\n yy = np.append(median['3'], median['7'])\n\n fig = plt.figure(2)\n fig.clf()\n plt.plot(xx,yy, '-r')\n \n if med_variance['3'] is not None and med_variance['7'] is not None:\n _cov = np.append(med_variance['3'], med_variance['7'])\n plt.plot(xx,_cov, '-b')\n else:\n _cov = None\n\n if med_sky['3'] is not None and med_sky['7'] is not None:\n _sky = np.append(med_sky['3'], med_sky['7'])\n plt.plot(xx,_sky, '-g')\n else:\n _sky = None\n\n raw_input('go on')\n _output= 'final/' + name + '_deimos_' + str(hed['MJD-OBS']) + '.fits'\n writetable(xx,yy,hed, output = _output, sky= _sky, cov= _cov, optimal=None, verbose=True)\n return _output\n\n##################################################################################################################\n" }, { "alpha_fraction": 0.6443148851394653, "alphanum_fraction": 0.6530612111091614, "avg_line_length": 37.11111068725586, "blob_id": "48559f1c8e9ce214ea33780f93aca3822b726ed7", "content_id": "9fb98e0f9d6aed553455bd763c3b761de5cac17a", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 686, "license_type": "permissive", "max_line_length": 80, "num_lines": 18, "path": "/README.md", "repo_name": "svalenti/deimos", "src_encoding": "UTF-8", "text": "The DEIMOS pipeline is a python script that can run with python 2.7 and python 3\nIt should be run from inside a directory with Deimos data.\nAt the moment only run with the following setup.\n\nMULTISLIT slit 1 arcsec\n\n\nStep of the pipeline and output files\n\n- Trim and rotate file_ext_trimmed.fits\n- Flat Done no output file \n- sky curvature lambdas_2_ext.dat,lambdas_3_ext.dat\n- sky subtraction file_ext_nosky.fits\n- trace file_ext_trace.ascii\n- extraction file_ext_ex_obj.ascii\n- wave file_ext_wave_obj.ascii\n- response file_ext_response_obj.ascii\n- flux file_ext_flux_obj.ascii\n" }, { "alpha_fraction": 0.5760160684585571, "alphanum_fraction": 0.5861380696296692, "avg_line_length": 38.5052375793457, "blob_id": "6c48dad4a260ce0e58c715bf0688162678228053", "content_id": "bd0d98932a77cea1bcf5d528c6f6ec75f04f20ab", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 64118, "license_type": "permissive", "max_line_length": 158, "num_lines": 1623, "path": "/trunk/src/deimos/irafext.py", "repo_name": "svalenti/deimos", "src_encoding": "UTF-8", "text": "####\nimport numpy as np\nimport numpy.polynomial.legendre as leg\nimport numpy.polynomial.chebyshev as cheb\nfrom astropy.io import fits\nimport scipy.ndimage as nd\nfrom astropy import modeling\nfrom datetime import datetime\nfrom matplotlib import pylab as plt\nimport sys\nimport re\nimport string\n\n \n# Class to read and interpret IRAF aperture database files.\n\nclass aperture_params:\n \"\"\"parameters read from an IRAF ap database file.\"\"\"\n def __init__(self, froot=\"\", dispaxis=2):\n if froot:\n froot = froot.replace(\".fits\", \"\")\n reading_coeffs = False # coeffs get parsed differently.\n ncoeffs = 0\n self.coeffs = []\n reading_background = False\n with open(\"database/ap%s\" % froot, \"r\") as apf:\n for l in apf:\n if l[0] != '#':\n if 'background' in l:\n reading_background = True\n if 'axis' in l:\n reading_background = False\n if 'curve' in l:\n reading_coeffs = True\n reading_background = False # just in case.\n x = l.split()\n if x: # no blank lines\n if 'image' in x[0]:\n self.imroot = x[1]\n if 'aperture' in x[0]:\n self.apnum = int(x[1])\n if self.apnum > 1:\n print(\"Warning -- apnum > 1!\")\n print(\"Multiple apertures are not implemented.\")\n if 'enter' in x[0]:\n if dispaxis == 2:\n self.center = float(x[1])\n self.displine = float(x[2])\n else:\n self.center = float(x[2])\n self.displine = float(x[1])\n if 'low' in x[0] and 'reject' not in x[0]:\n # print(l, x)\n if dispaxis == 2:\n self.aplow = float(x[1])\n self.lowline = float(x[2])\n else:\n self.aplow = float(x[2])\n self.lowline = float(x[1])\n if 'high' in x[0] and 'reject' not in x[0]:\n if dispaxis == 2:\n self.aphigh = float(x[1])\n self.highline = float(x[2])\n else:\n self.aphigh = float(x[2])\n self.highline = float(x[1])\n if reading_background:\n if 'sample' in x[0]: # this is not consistently formatted. Ugh.\n self.bckgrintervals = []\n if len(x) == 2: # lower and upper joined by comma and no space\n y = x[1].split(',')\n else : # lower and upper parts space-separated.\n y = x[1:]\n for yy in y:\n z = yy.split(':')\n # print(z)\n self.bckgrintervals.append([float(z[0]), float(z[1])])\n if 'function' in x[0]:\n self.bckgrfunc = x[1]\n if 'order' in x[0]:\n self.bckgrfunc_iraforder = int(x[1])\n if 'niterate' in x[0]:\n self.bckgr_niterate = int(x[1])\n # rejecting both low and high pixels is a bit awkward later.\n # low pixels are not much of a problem, usually, so didn't\n # implement a low-reject scheme.\n #if 'low_reject' in x[0]:\n # self.bckgr_low_reject = float(x[1])\n if 'high_reject' in x[0]:\n self.bckgr_high_reject = float(x[1])\n if reading_coeffs and 'curve' not in l:\n self.coeffs.append(float(x[0]))\n\n else:\n print(\"Need a valid image name.\")\n\n # These were all done neatly with f-string but reverted for\n # compatibility with python 2.7. Even after\n # from __future__ import print_statement\n # f-strings will not parse in pyhon 2.7.\n\n def repeat_back(self):\n print(\"root \", self.imroot, \", aperture \", self.apnum)\n print(\"center \", self.center, \" displine \", self.displine)\n print(\"aplow \", self.aplow, \", aphigh \", self.aphigh)\n print(\"lowline \", self.lowline, \" highline \", self.highline)\n print(\"bckgrfunc \", self.bckgrfunc, \"iraf_order \", self.bckgrfunc_iraforder)\n print(\"niterate \", self.bckgr_niterate, \" high_reject \", self.bckgr_high_reject)\n print(\"bckgr intervals:\")\n for b in self.bckgrintervals:\n print(\" start \", b[0], \" end \", b[1])\n print(\"coeffs:\")\n for c in self.coeffs:\n print(c)\n\n def evaluate_curve(self, pixlims=None):\n ic = irafcurve(self.coeffs)\n # ic.repeat_back()\n y = ic.evaluate_by1(pixlims)\n # curve is relative to center so need to add center to get real value.\n return self.center + y\n\n# May want to reuse irafcurve if I write code to do ident,\n# reident, or other things.\n\nclass irafcurve:\n \"\"\"A fit generated by the iraf curvefit routines, e.g. a\n an aptrace and possibly a wavelenght fit (not tested yet tho').\"\"\"\n\n def __init__(self, fitparams):\n # handed a list or tuple of firparams (which includes flags\n # for type of fit) sets up the irafcurve instance.\n\n # should be an int but it i'nt sometimes\n typecode = int(fitparams[0] + 0.001)\n\n if typecode == 1: self.curvetype = 'chebyshev'\n elif typecode == 2: self.curvetype = 'legendre'\n elif typecode == 3: self.curvetype = 'spline3'\n else:\n print(\"Unknown fit type: \", fitparams[0])\n\n # the 'iraforder' is not the conventional order; it's\n # the number of coefficients for a polynomial, so a\n # a straight line has iraforder = 2. For a spline3 it is\n # the number of spline segments.\n\n self.iraforder = int(fitparams[1] + 0.001)\n\n self.xrange = (fitparams[2], fitparams[3])\n self.span = self.xrange[1] - self.xrange[0]\n self.sumrange = self.xrange[0] + self.xrange[1]\n\n self.fitcoeffs = np.array(fitparams[4:])\n\n # Numpy provides built-in legendre and chebyshev apparatuses that make\n # this trivial. The numpy spline3 is apparently oriented toward interpolation,\n # and wasn't as easy to adapt, though I'm probably missing something. My own\n # spline3 stuff works correctly though it's more awkward.\n\n if self.curvetype == 'legendre':\n self.lpoly = leg.Legendre(self.fitcoeffs, domain = [self.xrange[0], self.xrange[1]])\n\n if self.curvetype == 'chebyshev':\n self.chpoly = cheb.Chebyshev(self.fitcoeffs, domain = [self.xrange[0], self.xrange[1]])\n\n def repeat_back(self):\n # be sure the fit read correctly\n print(\"curvetype \", self.curvetype, \" iraforder \", self.iraforder)\n print(\"xrange \", self.xrange)\n print(\"span, sumrange \", self.span, self.sumrange)\n print(\"coeffs \", self.fitcoeffs)\n\n def evalfit(self, x): # evaluate fit for an array of x-values.\n # translated from C, taking advantage of array arithmetic.\n\n if self.curvetype == 'spline3':\n\n # this is by far the most complicated case.\n\n xnorm = (2. * x - self.sumrange) / self.span\n splcoo = self.iraforder * (x - self.xrange[0]) / self.sumrange\n jlo = splcoo.astype(int) # this is 0 for pixels in first segment, 1 for 2nd etc\n a = (jlo + 1) - splcoo # these are basically x-values referred to segment boundaries\n b = splcoo - jlo\n\n # make four blank arrays\n\n coef0 = np.zeros(xnorm.shape)\n coef1 = np.zeros(xnorm.shape)\n coef2 = np.zeros(xnorm.shape)\n coef3 = np.zeros(xnorm.shape)\n\n # fill the arrays piecewise with the appropriate\n # spline coefficients. Then the evaluation can be\n # done entirely with array arithmentic.\n\n for i in range(self.iraforder):\n np.place(coef0, jlo == i, self.fitcoeffs[i])\n np.place(coef1, jlo == i, self.fitcoeffs[i+1])\n np.place(coef2, jlo == i, self.fitcoeffs[i+2])\n np.place(coef3, jlo == i, self.fitcoeffs[i+3])\n\n y = coef0 * a ** 3 + coef1 * (1. + 3. * a * (1 + a * b)) + \\\n coef2 * (1. + 3. * b * (1 + a * b)) + \\\n coef3 * b ** 3\n\n return y\n\n elif self.curvetype == \"legendre\":\n return self.lpoly(x)\n\n elif self.curvetype == \"chebyshev\":\n return self.chpoly(x)\n\n def evaluate_by1(self, pixlims=None): # evaluates curve for every pixel in range.\n if pixlims == None:\n firstpix = int(self.xrange[0] + 0.001)\n lastpix = int(self.xrange[1] + 0.001)\n else:\n firstpix = pixlims[0]\n lastpix = pixlims[1]\n pixarr = np.arange(firstpix, lastpix + 1, 1)\n return self.evalfit(pixarr)\n\n####\n\ndef fake_multispec_data(arrlist):\n # takes a list of 1-d numpy arrays, which are\n # to be the 'bands' of a multispec, and stacks them\n # into the format expected for a multispec. As of now\n # there can only be a single 'aperture'.\n\n return np.expand_dims(np.array(arrlist), 1)\n\n############################################################################################\n\n### START MAIN TASK. Get the input file.\ndef opextract(imroot, firstlinetoplot, lastlinetoplot, plot_sample, DISPAXIS, readnoise, gain, apmedfiltlength,\n colfitorder, scattercut, colfit_endmask=10, diagnostic=False, production=False, other=None, shift=0):\n\n if '.fits' in imroot:\n imroot = imroot.replace(\".fits\", \"\")\n if '.fit' in imroot:\n imroot = imroot.replace(\".fit\", \"\")\n \n if other:\n apparams = aperture_params(froot=other, dispaxis=DISPAXIS)\n else:\n apparams = aperture_params(froot=imroot, dispaxis=DISPAXIS)\n\n if diagnostic:\n apparams.repeat_back()\n\n hdu = fits.open(imroot + '.fits')\n hdr = hdu[0].header\n rawdata = hdu[0].data\n\n # If dispersion does not run along the columns, transpose\n # the data array. Doing this once here means we can assume\n # dispersion is along columns for the rest of the program.\n\n if DISPAXIS != 2:\n rawdata = rawdata.T\n\n # compute a variance image from the original counts, using\n # the specified read noise (in electrons) and gain\n # (in electrons per ADU). These can be set with command\n # line arguments or (more likely) set as defaults.\n\n # The algorithm wants variance in data numbers, so divide\n # and square.\n\n readvar = (readnoise / gain) ** 2 # read noise as variance in units of ADU\n\n # variance image data is derived from bias-subbed data.\n varimage = readvar + rawdata / gain\n\n # Creating zero arrays for processed data should be much\n # faster than building them row by row, e.g. for the\n # background-subtracted data:\n subbeddata = np.zeros(rawdata.shape)\n\n rootpi = np.sqrt(np.pi) # useful later.\n\n # Compute aperture and background limits using the\n # parameters read from the database file.\n\n apcent = apparams.evaluate_curve(pixlims=(0, rawdata.shape[0] - 1))\n\n # IRAF is one-indexed, so subtract 1 to make it zero-indexed.\n apcent -= 1\n\n # adding shift\n apcent = apcent + shift\n \n # four arrays give limits of background sections\n\n bckgrlim1 = apcent + apparams.bckgrintervals[0][0]\n bckgrlim2 = apcent + apparams.bckgrintervals[0][1]\n bckgrlim3 = apcent + apparams.bckgrintervals[1][0]\n bckgrlim4 = apcent + apparams.bckgrintervals[1][1]\n\n # arrays of limits for aperture\n aplimlow = apcent + apparams.aplow\n aplimhigh = apcent + apparams.aphigh\n # convert to integers for later use\n aplimlowint = np.round(aplimlow).astype(int)\n aplimhighint = np.round(aplimhigh).astype(int)\n\n lowestap = aplimlowint.min()\n highestap = aplimhighint.max() # extreme ends of aperture range\n\n if diagnostic:\n print(\"lowestap \", lowestap, \" highestap \", highestap)\n\n # Now compute and load the background spectrum by fitting\n # rows one by one. Start with a zero array:\n\n ### NOTE that only Legendre fits are implemented in this version. ###\n\n bckgrspec = np.zeros(apcent.shape)\n\n # crossdisp is the grid of pixel numbers for\n # fit to background, and to form the x-array\n # for optional plots.\n\n crossdisp = np.array(range(rawdata.shape[1]))\n\n # take background fit parameters from input\n # file if they loaded right.\n\n try:\n niterations = apparams.bckgr_niterate\n low_rej = apparams.bckgr_low_reject\n high_rej = apparams.bckgr_high_reject\n except:\n niterations = 3\n low_rej = 2.\n high_rej = 2.\n\n print(niterations,low_rej,high_rej)\n # fit and subtract the background. The region\n # fitted is on each side of the program object.\n # Only legendre fits have been tested.\n\n for lineindex in range(rawdata.shape[0]):\n\n ldata = rawdata[:][lineindex]\n\n # index limits for low side and high side background windows\n ind1 = int(bckgrlim1[lineindex])\n ind2 = int(bckgrlim2[lineindex])\n ind3 = int(bckgrlim3[lineindex])\n ind4 = int(bckgrlim4[lineindex])\n\n # grab subarrays for low and high side and join\n\n xlo = crossdisp[ind1:ind2]\n ylo = ldata[ind1:ind2]\n xhi = crossdisp[ind3:ind4]\n yhi = ldata[ind3:ind4]\n\n xtofit = np.hstack((xlo, xhi))\n ytofit = np.hstack((ylo, yhi))\n\n # fit and iterate to get rid of bad pixels.\n\n for iteration in range(niterations):\n\n # use legendre order from input if function is a leg\n\n if apparams.bckgrfunc == 'legendre':\n legcoefs = leg.legfit(xtofit, ytofit,\n apparams.bckgrfunc_iraforder - 1)\n else: # or default to 2nd order leg if func is something else.\n legcoefs = leg.legfit(xtofit, ytofit, 2)\n fit = leg.legval(xtofit, legcoefs)\n residuals = ytofit - fit\n stdev = np.std(residuals)\n # fancy indexing!\n keepindices = abs(residuals) < high_rej * stdev\n xtofit = xtofit[keepindices]\n ytofit = ytofit[keepindices]\n\n # Subtract the fit from this line, and store in subbeddta\n\n subbeddata[lineindex] = rawdata[lineindex] - leg.legval(crossdisp, legcoefs)\n\n # Keep the 1-d background spec at the center of the image.\n # later this is scaled up to the 'effective' width of the optimally\n # extracted spectrum and written out to the multispec.\n\n bckgrspec[lineindex] = leg.legval(apcent[lineindex], legcoefs)\n\n # If keeping diagnostics, write a sky-subtracted image.\n\n if diagnostic:\n # create a new hdu object around subbeddata\n hduout = fits.PrimaryHDU(subbeddata)\n # copy header stuff\n hdrcopy = hdr.copy(strip = True)\n hduout.header.extend(hdrcopy, strip=True, update=True,\n update_first=False, useblanks=True, bottom=False)\n # and write it.\n hduout.writeto(imroot + \"_sub.fits\", overwrite=True)\n\n print(\"Background-subbed image written to '%s_sub.fits'\" % (imroot))\n\n # Now that we have hduout, write the variance image\n # simply by substituting the data and writing.\n\n hduout.data = varimage\n hduout.writeto(imroot + \"_var.fits\", overwrite=True)\n\n print(\"Variance image written to '%s_var.fits'\" % (imroot))\n\n # PROFILE FINDING\n\n # Creates an image of the stellar spectrum profile\n # normalized row by row, i.e, Stetson's \"P_lambda\".\n\n # Start by median-filtering the subbed array parallel to the\n # dispersion; this will remove CRs and smooth a bit.\n\n smootheddata = nd.median_filter(subbeddata, size=(apmedfiltlength, 1), mode='nearest')\n\n if diagnostic:\n # write out median-smoothed array for diagnostic.\n hduout.data = smootheddata\n hduout.writeto(imroot + \"_medfilt.fits\", overwrite=True)\n print(\"Medium-filtered image written to '%s_medfilt.fits'\" % (imroot))\n\n # Find the whole x-range over which we'll extract. We'll\n # fit only those columns.\n\n aprange = range(lowestap, highestap+1, 1)\n\n # Get the range of pixels along the dispersion.\n # OSMOS data needs extreme ends masked a bit.\n\n pixrange = np.arange(0, smootheddata.shape[0], 1.)\n\n firstfitpix = colfit_endmask\n lastfitpix = smootheddata.shape[0] - colfit_endmask\n fitrange = np.arange(firstfitpix, lastfitpix, 1.)\n\n # This array will contain the normalized 2-d aperture.\n\n apdata = np.zeros(smootheddata.shape)\n\n # go column by column (parallel to dispersion), and fit\n # a polynomial to the smoothed spec in that column.\n\n # the order needs to be set high enough to follow\n # odd bumps for the echelle chip.\n # now removed to hard-coded param list\n # colfitorder = 15\n\n for i in aprange:\n\n # Diagnostics gives a nice plot of the columns and their fits, which can\n # be very enlightening. First, the smoothed data:\n\n if diagnostic:\n plt.plot(pixrange, smootheddata[:, i])\n\n legcoefs = leg.legfit(fitrange, smootheddata[firstfitpix:lastfitpix, i], colfitorder)\n\n thisfit = leg.legval(pixrange, legcoefs)\n # plot fit for diagnostic.\n if diagnostic:\n plt.plot(pixrange, thisfit)\n apdata[:, i] = thisfit\n\n # mask values less than zero\n # this may bias spec in very low s/n situations, but\n # it saves lots of trouble.\n\n apdata[apdata < 0.] = 0.\n\n # normalize across dispersion to create Horne's profile\n # estimate 'P'. This is redundant as the aperture is later\n # restricted to those within the pixel limits for that row,\n # but 'norm' is useful later.\n\n norm = np.sum(apdata, axis=1)\n\n # if there are no pixels, norm is zero. Replace those with\n # ones to avoid NaNs in the divided array.\n\n norm = np.where(norm == 0., 1., norm)\n\n # show accumulated graphs, which are of the fits of aperture\n # along the dispersion together with the median-smoothed\n # spectrum.\n\n if diagnostic:\n plt.title(\"Smoothed column data and poly fits.\")\n plt.xlabel(\"Pixel along dispersion\")\n plt.ylabel(\"Counts (not normalized)\")\n plt.show()\n\n # finally, normalize the aperture so sum across\n # dispersion is 1, making Horne's \"P\".\n # (again, this is redundant)\n\n nn = norm.reshape(rawdata.shape[0], 1)\n apdata = apdata / nn\n\n # Do something rational to normalize the\n # sky background. Let's try this:\n # - get the width of the spectrum as a sigma (from a\n # gaussian fit) at a spot where it's likely to be\n # strong -- the displine from the aperture file is\n # likely to be good.\n # - multiply sigma by root-pi. This is like an 'effective\n # width' of the aperture -- it's basically how much\n # sky effectively falls in the aperture.\n # - Use this width to renormalize the sky spec, which is\n # per-pixel.\n # - This whole exercise may be silly, but it's reasonably\n # cheap.\n\n goodapline = apdata[int(apparams.displine), aprange]\n\n # use the nice astropy Gaussian fit routines to fit profile.\n\n fitter = modeling.fitting.LevMarLSQFitter()\n model = modeling.models.Gaussian1D(amplitude = np.max(goodapline), mean = np.median(aprange), stddev=1.)\n fittedgau = fitter(model, aprange, goodapline)\n skyscalefac = rootpi * fittedgau.stddev.value\n\n if diagnostic:\n\n # diagnostic to show fidicual profile.\n\n plt.plot(aprange, goodapline)\n plt.plot(aprange, fittedgau(aprange))\n plt.title(\"Fiducial profile (from row %5.0f).\" % (apparams.displine))\n plt.show()\n\n #\n # Here comes the MAIN EVENT, namely extraction of the\n # spectrum and so on.\n #\n\n # Create 1-d arrays for the results.\n\n optimally_extracted = np.zeros(rawdata.shape[0])\n straight_sum = np.zeros(rawdata.shape[0])\n sigma_spec = np.zeros(rawdata.shape[0])\n\n # keep a summation of the non-optimally-extracted spectra\n # for later renormalization.\n\n cr_corrected_overall_flux = 0.\n\n # keep track of how many pixels are rejected.\n nrej_pixel = 0 # total number of 2d pixels affected\n corrected_specpts = 0 # total number of spectral points affected\n n_profiles_substituted = 0 # and number of profiles replaced with\n # Gaussian fits because of terrible S/N.\n\n # This optimal extraction process is very tricky. For\n # development it's useful to look at the detailed calculation\n # for several rows. I've built in the ability to\n # plot a range of rows and print out some data on them.\n # This is invoked now with command-line arguments.\n\n # We'll compute a statistic for how badly a pixel deviates from\n # the expected profile and ignore those that are bad enough.\n\n # This maximum accepted 'badness' statistic is set elsewhere now.\n # scattercut = 25. # Horne's suggested value is 25.\n\n # Finally, extract line-by-line:\n\n for lineindex in range(rawdata.shape[0]):\n\n # are we plotting this line out (etc.)?\n # This logic is separate from \"--diagnostic\".\n showdiagn = False\n if plot_sample and lineindex >= firstlinetoplot and lineindex <= lastlinetoplot:\n showdiagn = True\n\n # Compute straight sum of sky-subbed data in aperture, without pixel\n # rejection. In principle we could edit the CRs out of the straight sum but\n # that would require interpolating across them somehow.\n\n # Keep a copy of data in the aperture for later renormalization of the optimal\n # extraction.\n\n in_ap_data = subbeddata[lineindex, aplimlowint[lineindex]:aplimhighint[lineindex]]\n\n straight_sum[lineindex] = np.sum(in_ap_data)\n\n # I'm getting bad results in very poor S/N parts of the spectrum\n # where the aperture isn't well-defined even after all that smoothing.\n # Here's an attempt to fix this -- in cases where the S/N is terrible,\n # replace the aperture with the gaussian fit to the supposedly good line,\n # recentered. Here we can re-use the gaussian profile fit computed\n # earlier for the \"fiducial\" line, shifted to the local aperture\n # center from aptrace. This ignores any profile variations along the\n # dispersion, but the spec is barely detected anyway.\n\n # The norm array from before has preserved the cross-dispersion sums\n # pre-normalization. Use this to decide whether to substitute the\n # fit for the empirical profile.\n\n if norm[lineindex] < readnoise / gain: # basically nothing there.\n apmodel = modeling.models.Gaussian1D(amplitude =\n rootpi/fittedgau.stddev.value, mean = apcent[lineindex],\n stddev = fittedgau.stddev.value)\n apdata[lineindex] = apmodel(range(apdata.shape[1]))\n n_profiles_substituted = n_profiles_substituted + 1\n\n # 'pixind' is the array of pixel numbers to be included.\n # When pixels are rejected, the mechanism used is to delete\n # their index from pixind.\n\n # To start, include only pixels where the aperture is\n # at least positive and a bit.\n\n pixind0 = np.where(apdata[lineindex] > 0.001)\n # this weirdly returned a tuple that would not do fancy indexing:\n pixinds = np.array(pixind0)\n\n # Include only those pixels that are within the aperture\n # in this row.\n pixinds = pixinds[pixinds >= aplimlowint[lineindex]]\n pixinds = pixinds[pixinds <= aplimhighint[lineindex]]\n\n # renormalize apdata to the values within the aperture.\n # This is assumed to contain 'all the light'.\n\n validsum = np.sum(apdata[lineindex, pixinds])\n apdata[lineindex, pixinds] = apdata[lineindex, pixinds] / validsum\n\n worst_scatter = 10000. # initialize high to make the loop start.\n\n largest_valid_stat = 40. # this isn't used yet.\n iteration = 0\n\n # \"while\" loop to iterate CR rejection. Second\n # condtion guards against case of no valid aperture points.\n\n while worst_scatter > scattercut and pixinds.size > 0:\n\n # Horne eq'n (8):\n numerator = np.sum(apdata[lineindex, pixinds] * subbeddata[lineindex, pixinds] / varimage[lineindex, pixinds])\n denominator = np.sum(apdata[lineindex, pixinds] ** 2 / varimage[lineindex, pixinds])\n optimally_extracted[lineindex] = numerator/denominator\n\n # Horne eq'n (9) for variance, square-rooted to get sigma:\n sigma_spec[lineindex] = np.sqrt(1. / (np.sum(apdata[lineindex, pixinds] ** 2 / varimage[lineindex, pixinds])))\n\n # The procedure for eliminating cosmic rays and other discrepant profile points\n # follows; it's taken from Horne's article, page 614, top right.\n\n # compute Horne's measure of anomalous pixels due to CRs or whatever.\n\n # NOTE that an inaccurate profile estimate will lead to spurious 'bad' pixels.\n # May want to put in something to relax the rejection criterion for bright objects.\n\n scatter_array = ((subbeddata[lineindex, pixinds] - optimally_extracted[lineindex] * apdata[lineindex, pixinds])**2 / varimage[lineindex, pixinds])\n\n # array of S/Ns to assess validity of stat model - not yet used.\n sn_array = subbeddata[lineindex, pixinds] / np.sqrt(varimage[lineindex, pixinds])\n\n if showdiagn: # examine the fit in this row in detail.\n print(\"scatter_array \", scatter_array, \" shape \", scatter_array.shape)\n print(\"sn_array\", sn_array)\n\n worst_scatter = np.max(scatter_array)\n\n if worst_scatter > scattercut: # reject bad pixels\n\n # find and delete bad pixel. This will fail if there are two equal\n # values of scatter_array, but they are floats so the chance of this\n # happening is minuscule.\n\n index_of_worst = np.where(scatter_array == worst_scatter)[0][0]\n pixinds = np.delete(pixinds, index_of_worst)\n\n if showdiagn:\n print(\"worst: \", worst_scatter, \"killed index \", index_of_worst)\n\n # Also edit out the high point from the in_ap_data so it doesn't skew the\n # later overall renormalization too badly.\n\n bad_point_value = subbeddata[lineindex, index_of_worst]\n in_ap_data = in_ap_data[in_ap_data != bad_point_value]\n\n # re-normalize the remaining aperture points.\n # *** This was an error!! *** Just omit the point, and keep normalization.\n # validsum = np.sum(apdata[lineindex, pixinds])\n # apdata[lineindex, pixinds] = apdata[lineindex, pixinds] / validsum\n\n # keep track of how many pixels were rejected, and how\n # many spectral points are affected.\n\n nrej_pixel += 1\n if iteration == 0:\n corrected_specpts += 1\n\n if len(pixinds) == 0: # Uh-oh -- out of pixels!\n worst_scatter = 0. # will kick us out of loop.\n optimally_extracted[lineindex] = 0.\n\n iteration += 1\n\n if len(pixinds) == 0: # can be zero because aperture is all zero.\n optimally_extracted[lineindex] = 0.\n sigma_spec[lineindex] = 10. # arbitrary\n\n # accumulate sum of flux in non-rejected straight sum points.\n cr_corrected_overall_flux += np.sum(in_ap_data)\n\n # plot some sample lines for diagnostic if indicated.\n\n if showdiagn:\n lowx = aplimlowint[lineindex] #brevity\n highx = aplimhighint[lineindex]\n plrange = range(lowx - 15, highx + 15)\n # plot aperture profile * estimate\n plt.plot(plrange, apdata[lineindex, plrange] * optimally_extracted[lineindex])\n # and also the actual sky-subtracted data.\n plt.plot(plrange, subbeddata[lineindex, plrange])\n\n # also plot vertical bars at pixel limits, and dots at pixels that were used.\n plt.plot((lowx, lowx), (-10, 50))\n plt.plot((highx, highx), (-10, 50))\n pixpl = np.zeros(pixinds.shape[0])\n plt.plot(pixinds, pixpl, 'bo')\n plt.title(\"Line %d optextr %8.2f \" % (lineindex, optimally_extracted[lineindex]))\n plt.show()\n\n if diagnostic:\n # write aperture image (as amended by extraction) for a diagnostic.\n hduout.data = apdata\n hduout.writeto(imroot + \"_aperture.fits\", overwrite=True)\n print(\"Normalized aperture image written to '%s_aperture.fits'\" % imroot)\n print(\"(These diagnostic images are purely for your dining and dancing\")\n print(\"pleasure, and can be safely deleted.)\")\n print(\" \")\n\n # Finally, normalize the optimally extracted spec to\n # the cr-rejected straight sum.\n\n normfac = cr_corrected_overall_flux / np.sum(optimally_extracted)\n if diagnostic:\n print(\"overall flux %8.0f, sum of optimal extr. %8.0f, norm. fac %7.5f\" %\n (cr_corrected_overall_flux, np.sum(optimally_extracted), normfac))\n optimally_extracted *= normfac\n\n # EXTRACTION IS COMPLETE!\n\n # WRITE OUT AS A MULTISPEC FITS FILE.\n\n ultimate = rawdata.shape[0] - 1 # last and second-to-last indices\n penultimate = rawdata.shape[0] - 2\n\n if DISPAXIS == 2:\n\n # For modspec data -- and presumably for other column-dispersion ---\n\n # Comparison with previous extractions show an off-by-one!\n # Never could figure out why, so shift output arrays by one\n # pixel with np.roll, and repeat the last pixel.\n # Could also do this with indexing I'm thinking that\n # the implementation of np.roll is likely to be faster (?).\n\n ultimate = rawdata.shape[0] - 1\n penultimate = rawdata.shape[0] - 2\n\n out1 = np.roll(optimally_extracted, -1)\n out1[ultimate] = out1[penultimate]\n\n out2 = np.roll(straight_sum, -1)\n out2[ultimate] = out2[penultimate]\n\n out3 = np.roll(bckgrspec * skyscalefac, -1)\n out3[ultimate] = out3[penultimate]\n\n out4 = np.roll(sigma_spec, -1)\n out4[ultimate] = out4[penultimate]\n\n else: # OSMOS data (dispaxis = 1) doesn't have this issue\n # Code to fix a bad pixel at high end left in place commented\n # out in case it's needed\n out1 = optimally_extracted\n # out1[ultimate] = out1[penultimate] # fudge the last pixel.\n out2 = straight_sum\n # out2[ultimate] = out2[penultimate] # fudge the last pixel.\n out3 = bckgrspec * skyscalefac\n out4 = sigma_spec\n\n print(imroot, \": rejected \", nrej_pixel, \" pixels, affecting \", corrected_specpts, \" spectral points.\")\n return out1, out2, out3, out4\n\n\n##########################################################################\ndef dvex():\n dv = {}\n dv['line'] = {'600ZD': 300, 'Gr11': 430, 'Gr13': 200, 'GR': 150, 'GB': 430}\n dv['std'] = {'_t_order': 6, '_t_niter': 5, '_t_sample': '*', '_t_nlost': 20, '_width': 10, '_radius': 10,\n '_weights': 'variance',\n '_nsum': 30, '_t_step': 10, '_t_nsum': 10, '_lower': -10, '_upper': 10, '_b_sample': '-40:-20,20:40',\n '_resize': 'no'}\n dv['obj'] = {'_t_order': 4, '_t_niter': 5, '_t_sample': '*', '_t_nlost': 20, '_width': 10, '_radius': 10,\n '_weights': 'variance',\n '_nsum': 40, '_t_step': 10, '_t_nsum': 10, '_lower': -5, '_upper': 5, '_b_sample': '-25:-15,15:25',\n '_resize': 'yes'}\n dv['test'] = {'_t_order': 4, '_t_niter': 5, '_t_sample': '*', '_t_nlost': 20, '_width': 10, '_radius': 10,\n '_weights': 'none',\n '_nsum': 40, '_t_step': 10, '_t_nsum': 10, '_lower': -5, '_upper': 5, '_b_sample': '-25:-15,15:25',\n '_resize': 'yes'}\n return dv\n\n#################################################################\ndef repstringinfile(filein, fileout, string1, string2):\n import re\n f = open(filein, 'r')\n ss = f.readlines()\n f.close()\n f = open(fileout, 'w')\n for n in range(len(ss)):\n if string1 in ss[n]:\n f.write(re.sub(string1, string2, ss[n]))\n else:\n f.write(ss[n])\n f.close()\n\n\n##################################\n\n##############################################################################\ndef delete(listfile):\n import os\n import string\n import re\n import glob\n\n if listfile[0] == '@':\n ff = open(listfile[1:])\n files = ff.readlines()\n imglist = []\n for ff in files:\n ff = re.sub(' ', '', ff)\n if not ff == '\\n' and ff[0] != '#':\n ff = re.sub('\\n', '', ff)\n imglist.append(ff)\n elif ',' in listfile:\n imglist = str.split(listfile, sep=',')\n else:\n imglist = [listfile]\n lista = []\n for _file in imglist:\n lista = lista + glob.glob(_file)\n if lista:\n for _file in lista:\n try:\n os.system('rm ' + _file)\n except:\n pass\n\n\n###############################################################\n\ndef extractspectrum(dictionary,img, key, _ext_trace=False, _dispersionline=False, _interactive=True, _type='obj', _force=False):\n import deimos\n import glob\n import os\n import string\n import sys\n import re\n import datetime\n import numpy as np\n from astropy.io import fits\n print(_interactive)\n print(_ext_trace)\n \n imgout = re.sub('.fits','',img) + '_' + str(key) + '_nosky.fits'\n\n os.environ[\"PYRAF_BETA_STATUS\"] = \"1\"\n _extinctdir = 'direc$standard/extinction/'\n _extinction = 'lasilla2.txt'\n _observatory = 'lasilla'\n \n from pyraf import iraf\n iraf.set(direc=deimos.__path__[0] + '/')\n iraf.noao(_doprint=0)\n iraf.imred(_doprint=0)\n iraf.specred(_doprint=0)\n toforget = ['specred.apall', 'specred.transform']\n for t in toforget:\n iraf.unlearn(t)\n \n iraf.specred.dispaxi = 1\n dv = dvex()\n hdr = dictionary[img]['fits'][0].header\n _gain = 1\n _rdnoise = 1\n _grism = dictionary[img]['GRATENAM']\n \n if _force==True:\n _new = 'yes'\n _extract = 'yes'\n else:\n if not os.path.isfile('database/ap' + re.sub('.fits', '', imgout)): \n _new = 'yes'\n _extract = 'yes'\n else:\n if _interactive in ['Yes', 'yes', 'YES', 'y', 'Y',True]:\n answ = 'x'\n while answ not in ['y', 'n','no','yes']:\n answ = raw_input('\\n### do you want to trace again [[y]/n] ? ')\n if not answ:\n answ = 'y'\n if answ == 'y':\n _new, _extract = 'yes', 'yes'\n else:\n _new, _extract = 'yes', 'no'\n else:\n _new, _extract = 'no', 'no'\n \n if _extract == 'yes':\n #delete(imgex)\n ############ chose where to show the profile\n if _dispersionline:\n question = 'yes'\n while question == 'yes':\n deimos.deimosutil.image_plot(directory[img]['nosky'],2)\n dist = raw_input(\n '\\n### At which line do you want to trace the spectrum [' + str(dv['line'][_grism]) + '] ? ')\n if not dist:\n dist = 400\n try:\n dist = int(dist)\n question = 'no'\n except:\n print('\\n### input not valid, try again:')\n else:\n dist = dv['line'][_grism]\n\n ###################### \n if _ext_trace in ['yes', 'Yes', 'YES', True]:\n print('add here the use of different trace') \n else:\n _reference = ''\n _find = 'yes'\n _recenter = 'yes'\n _resize = dv[_type]['_resize']\n _edit = 'yes'\n _trace = 'yes' \n _fittrac = 'yes'\n iraf.specred.mode = 'q'\n _mode = 'q'\n _review = 'yes'\n iraf.specred.apall.b_niterate=3\n iraf.specred.apall.b_function='legendre'\n iraf.specred.aptrace.niterate=10\n iraf.specred.aptrace(imgout, referen=_reference, interactive=_interactive,\\\n find=_find, recenter=_recenter, resize=_resize,\\\n edit=_edit, trace=_trace, fittrace=_fittrac,\\\n line=dist,step=dv[_type]['_t_step'],\\\n nlost=dv[_type]['_t_nlost'], function='legendre',\\\n order=dv[_type]['_t_order'], sample=dv[_type]['_t_sample'],\\\n naverage = 1, niter=10,\\\n #dv[_type]['_t_niter'],\\\n low_reject=4, high_reject=4,\\\n nsum=dv[_type]['_t_nsum'],\\\n mode=_mode)\n\n\n ####### read iraf database and add trace in the dictionary \n apparams = deimos.irafext.aperture_params(froot=imgout, dispaxis=1)\n # data.shape[1] is for dispersion axes 1\n # data.shape[0] is for dispersion axes 0\n peakpos = apparams.evaluate_curve(pixlims=(0, dictionary[img]['trimmed'+str(key)].shape[1] - 1))\n peakpos -= 1\n\n # add trace to the dictionary\n dictionary[img]['peakpos_' + str(key)] = peakpos\n\n #add iraf parameters to the dictionary\n meta={}\n meta['coeffs'] = apparams.coeffs\n meta['bckgrintervals'] = apparams.bckgrintervals\n meta['aplow'] = apparams.aplow\n meta['aphigh'] = apparams.aphigh\n meta['bckgr_niterate'] = dv[_type]['_t_niter'] #apparams.bckgr_niterate\n meta['bckgr_low_reject'] = 5 #apparams.bckgr_low_reject\n meta['bckgr_high_reject'] = apparams.bckgr_high_reject\n meta['bckgrfunc'] = apparams.bckgrfunc\n meta['bckgrfunc_iraforder'] = apparams.bckgrfunc_iraforder\n meta['displine'] = apparams.displine\n\n for key1 in meta:\n if key1 in ['aplow','displine','aphigh']:\n dictionary[img][key1 + '_' + str(key)] = float(meta[key1])\n else: \n dictionary[img][key1 + '_' + str(key)] = re.sub('\\[?]?','', str(meta[key1]))\n \n # write the trace file\n _grism = dictionary[img]['GRATENAM']\n _slit = dictionary[img]['SLMSKNAM'] \n setup = (_grism,_slit)\n _dir = '_'.join(setup)\n imgtrace = re.sub('.fits','',img) + '_' + str(key) + '_trace.ascii'\n output = _dir + '/' + str(key) + '/' + imgtrace\n deimos.deimosutil.writetrace(peakpos,meta,'trace',output)\n else:\n print('trace already done')\n return dictionary\n##############################\n\n### START MAIN TASK. Get the input file.\ndef opextract_new(img, firstlinetoplot, lastlinetoplot, plot_sample, DISPAXIS, readnoise, gain, apmedfiltlength,\n colfitorder, scattercut, colfit_endmask=10, diagnostic=False, production=False,\n other=None, shift=0, dictionary= None, key = 3, rawdataname='nosky',\n bckhigh=False, bcklow=False):\n\n ###### imroot is only to write names for diagnostic\n imroot = re.sub('.fits','',img) + '_' + str(key) + rawdataname\n if '.fits' in imroot:\n imroot = imroot.replace(\".fits\", \"\")\n if '.fit' in imroot:\n imroot = imroot.replace(\".fit\", \"\")\n\n \n\n if dictionary:\n ##### read the matrix of data\n if rawdataname=='nosky':\n rawdata = dictionary[img][rawdataname + str(key)]\n else:\n rawdata = dictionary[img][rawdataname + str(key)][0].data\n\n\n # read all parameters from the object\n aplow = float(dictionary[img]['aplow_' + str(key)])\n bckgrfunc = re.sub(\" \",\"\",dictionary[img]['bckgrfunc_' + str(key)])\n bckgr_low_reject = dictionary[img]['bckgr_low_reject_' + str(key)]\n displine = float(dictionary[img]['displine_' + str(key)])\n aphigh = float(dictionary[img]['aphigh_' + str(key)])\n bckgrfunc_iraforder = int(dictionary[img]['bckgrfunc_iraforder_' + str(key)])\n coeffs = np.array(str.split(dictionary[img]['coeffs_' + str(key)],','),float)\n bckgrintervals = np.reshape(np.array(str.split(dictionary[img]['bckgrintervals_' + str(key)],','),float),(2,2))\n bckgr_niterate = int(dictionary[img]['bckgr_niterate_' + str(key)])\n bckgr_high_reject = float(dictionary[img]['bckgr_high_reject_' + str(key)])\n \n else:\n print('\\#### ERROR dictionary not defined ')\n\n \n if bckhigh:\n bckgr_high_reject = float(bckhigh)\n if bcklow:\n bckgr_low_reject = float(bcklow)\n \n \n # If dispersion does not run along the columns, transpose\n # the data array. Doing this once here means we can assume\n # dispersion is along columns for the rest of the program.\n\n if DISPAXIS != 2:\n rawdata = rawdata.T\n\n # compute a variance image from the original counts, using\n # the specified read noise (in electrons) and gain\n # (in electrons per ADU). These can be set with command\n # line arguments or (more likely) set as defaults.\n\n # The algorithm wants variance in data numbers, so divide\n # and square.\n\n readvar = (readnoise / gain) ** 2 # read noise as variance in units of ADU\n\n # variance image data is derived from bias-subbed data.\n varimage = readvar + rawdata / gain\n\n # Creating zero arrays for processed data should be much\n # faster than building them row by row, e.g. for the\n # background-subtracted data:\n subbeddata = np.zeros(rawdata.shape)\n\n rootpi = np.sqrt(np.pi) # useful later.\n\n\n # if other is defined use trace from other\n if other:\n if other not in dictionary:\n sys.exit('error image not in the dictionary')\n else:\n apcent = dictionary[other]['peakpos_'+str(key)] \n else:\n apcent = dictionary[img]['peakpos_'+str(key)]\n \n# # Compute aperture and background limits using the\n# # parameters read from the database file.\n# if dictionary: \n# apcent = dictionary[img]['peakpos_'+str(key)] \n# else:\n# apcent = apparams.evaluate_curve(pixlims=(0, rawdata.shape[0] - 1))\n# # IRAF is one-indexed, so subtract 1 to make it zero-indexed.\n# apcent -= 1\n \n # adding shift\n apcent = apcent + shift\n \n # four arrays give limits of background sections\n print(bckgrintervals)\n bckgrlim1 = apcent + bckgrintervals[0][0]\n bckgrlim2 = apcent + bckgrintervals[0][1]\n bckgrlim3 = apcent + bckgrintervals[1][0]\n bckgrlim4 = apcent + bckgrintervals[1][1]\n\n # arrays of limits for aperture\n aplimlow = apcent + aplow\n aplimhigh = apcent + aphigh\n # convert to integers for later use\n aplimlowint = np.round(aplimlow).astype(int)\n aplimhighint = np.round(aplimhigh).astype(int)\n\n lowestap = aplimlowint.min()\n highestap = aplimhighint.max() # extreme ends of aperture range\n\n if diagnostic:\n print(\"lowestap \", lowestap, \" highestap \", highestap)\n\n # Now compute and load the background spectrum by fitting\n # rows one by one. Start with a zero array:\n\n ### NOTE that only Legendre fits are implemented in this version. ###\n\n bckgrspec = np.zeros(apcent.shape)\n\n # crossdisp is the grid of pixel numbers for\n # fit to background, and to form the x-array\n # for optional plots.\n\n crossdisp = np.array(range(rawdata.shape[1]))\n\n # take background fit parameters from input\n # file if they loaded right.\n\n try:\n niterations = bckgr_niterate\n low_rej = bckgr_low_reject\n high_rej = bckgr_high_reject\n except:\n niterations = 3\n low_rej = 2.\n high_rej = 2.\n\n # it seems that does not work with 0 interactions\n # and pyraf seems also to not save correctly the number of interaction\n if niterations ==0:\n niterations = 10\n\n print(niterations,low_rej,high_rej)\n # fit and subtract the background. The region\n # fitted is on each side of the program object.\n # Only legendre fits have been tested.\n\n for lineindex in range(rawdata.shape[0]):\n\n ldata = rawdata[:][lineindex]\n\n # index limits for low side and high side background windows\n ind1 = int(bckgrlim1[lineindex])\n ind2 = int(bckgrlim2[lineindex])\n ind3 = int(bckgrlim3[lineindex])\n ind4 = int(bckgrlim4[lineindex])\n\n # grab subarrays for low and high side and join\n\n xlo = crossdisp[ind1:ind2]\n ylo = ldata[ind1:ind2]\n xhi = crossdisp[ind3:ind4]\n yhi = ldata[ind3:ind4]\n\n xtofit = np.hstack((xlo, xhi))\n ytofit = np.hstack((ylo, yhi))\n\n try:\n # fit and iterate to get rid of bad pixels.\n for iteration in range(niterations):\n \n # use legendre order from input if function is a leg\n if bckgrfunc == 'legendre':\n legcoefs = leg.legfit(xtofit, ytofit,\n bckgrfunc_iraforder - 1)\n else: # or default to 2nd order leg if func is something else.\n legcoefs = leg.legfit(xtofit, ytofit, 2)\n \n fit = leg.legval(xtofit, legcoefs)\n residuals = ytofit - fit\n stdev = np.std(residuals)\n # fancy indexing!\n keepindices = abs(residuals) < high_rej * stdev\n xtofit = xtofit[keepindices]\n ytofit = ytofit[keepindices]\n if len(xtofit)==0:\n print('Warning rejected too much')\n \n # Subtract the fit from this line, and store in subbeddta\n subbeddata[lineindex] = rawdata[lineindex] - leg.legval(crossdisp, legcoefs)\n except:\n print('\\##### Warning: problems subtracting the background. maybe the sky region was too small')\n subbeddata[lineindex] = rawdata[lineindex] \n\n # Keep the 1-d background spec at the center of the image.\n # later this is scaled up to the 'effective' width of the optimally\n # extracted spectrum and written out to the multispec.\n\n bckgrspec[lineindex] = leg.legval(apcent[lineindex], legcoefs)\n\n # If keeping diagnostics, write a sky-subtracted image.\n\n if diagnostic:\n # create a new hdu object around subbeddata\n hduout = fits.PrimaryHDU(subbeddata)\n # copy header stuff\n hdrcopy = hdr.copy(strip = True)\n hduout.header.extend(hdrcopy, strip=True, update=True,\n update_first=False, useblanks=True, bottom=False)\n # and write it.\n hduout.writeto(imroot + \"_sub.fits\", overwrite=True)\n\n print(\"Background-subbed image written to '%s_sub.fits'\" % (imroot))\n\n # Now that we have hduout, write the variance image\n # simply by substituting the data and writing.\n\n hduout.data = varimage\n hduout.writeto(imroot + \"_var.fits\", overwrite=True)\n\n print(\"Variance image written to '%s_var.fits'\" % (imroot))\n\n # PROFILE FINDING\n\n # Creates an image of the stellar spectrum profile\n # normalized row by row, i.e, Stetson's \"P_lambda\".\n\n # Start by median-filtering the subbed array parallel to the\n # dispersion; this will remove CRs and smooth a bit.\n\n smootheddata = nd.median_filter(subbeddata, size=(apmedfiltlength, 1), mode='nearest')\n\n if diagnostic:\n # write out median-smoothed array for diagnostic.\n hduout.data = smootheddata\n hduout.writeto(imroot + \"_medfilt.fits\", overwrite=True)\n print(\"Medium-filtered image written to '%s_medfilt.fits'\" % (imroot))\n\n # Find the whole x-range over which we'll extract. We'll\n # fit only those columns.\n\n aprange = range(lowestap, highestap+1, 1)\n\n # Get the range of pixels along the dispersion.\n # OSMOS data needs extreme ends masked a bit.\n\n pixrange = np.arange(0, smootheddata.shape[0], 1.)\n\n firstfitpix = colfit_endmask\n lastfitpix = smootheddata.shape[0] - colfit_endmask\n fitrange = np.arange(firstfitpix, lastfitpix, 1.)\n\n # This array will contain the normalized 2-d aperture.\n\n apdata = np.zeros(smootheddata.shape)\n\n # go column by column (parallel to dispersion), and fit\n # a polynomial to the smoothed spec in that column.\n\n # the order needs to be set high enough to follow\n # odd bumps for the echelle chip.\n # now removed to hard-coded param list\n # colfitorder = 15\n\n for i in aprange:\n\n # Diagnostics gives a nice plot of the columns and their fits, which can\n # be very enlightening. First, the smoothed data:\n\n if diagnostic:\n plt.plot(pixrange, smootheddata[:, i])\n\n legcoefs = leg.legfit(fitrange, smootheddata[firstfitpix:lastfitpix, i], colfitorder)\n\n thisfit = leg.legval(pixrange, legcoefs)\n # plot fit for diagnostic.\n if diagnostic:\n plt.plot(pixrange, thisfit)\n apdata[:, i] = thisfit\n\n # mask values less than zero\n # this may bias spec in very low s/n situations, but\n # it saves lots of trouble.\n\n apdata[apdata < 0.] = 0.\n\n # normalize across dispersion to create Horne's profile\n # estimate 'P'. This is redundant as the aperture is later\n # restricted to those within the pixel limits for that row,\n # but 'norm' is useful later.\n\n norm = np.sum(apdata, axis=1)\n\n # if there are no pixels, norm is zero. Replace those with\n # ones to avoid NaNs in the divided array.\n\n norm = np.where(norm == 0., 1., norm)\n\n # show accumulated graphs, which are of the fits of aperture\n # along the dispersion together with the median-smoothed\n # spectrum.\n\n if diagnostic:\n plt.title(\"Smoothed column data and poly fits.\")\n plt.xlabel(\"Pixel along dispersion\")\n plt.ylabel(\"Counts (not normalized)\")\n plt.show()\n\n # finally, normalize the aperture so sum across\n # dispersion is 1, making Horne's \"P\".\n # (again, this is redundant)\n\n nn = norm.reshape(rawdata.shape[0], 1)\n apdata = apdata / nn\n\n # Do something rational to normalize the\n # sky background. Let's try this:\n # - get the width of the spectrum as a sigma (from a\n # gaussian fit) at a spot where it's likely to be\n # strong -- the displine from the aperture file is\n # likely to be good.\n # - multiply sigma by root-pi. This is like an 'effective\n # width' of the aperture -- it's basically how much\n # sky effectively falls in the aperture.\n # - Use this width to renormalize the sky spec, which is\n # per-pixel.\n # - This whole exercise may be silly, but it's reasonably\n # cheap.\n\n goodapline = apdata[int(displine), aprange]\n\n # use the nice astropy Gaussian fit routines to fit profile.\n\n fitter = modeling.fitting.LevMarLSQFitter()\n model = modeling.models.Gaussian1D(amplitude = np.max(goodapline), mean = np.median(aprange), stddev=1.)\n fittedgau = fitter(model, aprange, goodapline)\n skyscalefac = rootpi * fittedgau.stddev.value\n\n if diagnostic:\n\n # diagnostic to show fidicual profile.\n\n plt.plot(aprange, goodapline)\n plt.plot(aprange, fittedgau(aprange))\n plt.title(\"Fiducial profile (from row %5.0f).\" % (displine))\n plt.show()\n\n #\n # Here comes the MAIN EVENT, namely extraction of the\n # spectrum and so on.\n #\n\n # Create 1-d arrays for the results.\n\n optimally_extracted = np.zeros(rawdata.shape[0])\n straight_sum = np.zeros(rawdata.shape[0])\n sigma_spec = np.zeros(rawdata.shape[0])\n\n # keep a summation of the non-optimally-extracted spectra\n # for later renormalization.\n\n cr_corrected_overall_flux = 0.\n\n # keep track of how many pixels are rejected.\n nrej_pixel = 0 # total number of 2d pixels affected\n corrected_specpts = 0 # total number of spectral points affected\n n_profiles_substituted = 0 # and number of profiles replaced with\n # Gaussian fits because of terrible S/N.\n\n # This optimal extraction process is very tricky. For\n # development it's useful to look at the detailed calculation\n # for several rows. I've built in the ability to\n # plot a range of rows and print out some data on them.\n # This is invoked now with command-line arguments.\n\n # We'll compute a statistic for how badly a pixel deviates from\n # the expected profile and ignore those that are bad enough.\n\n # This maximum accepted 'badness' statistic is set elsewhere now.\n # scattercut = 25. # Horne's suggested value is 25.\n\n # Finally, extract line-by-line:\n\n for lineindex in range(rawdata.shape[0]):\n\n # are we plotting this line out (etc.)?\n # This logic is separate from \"--diagnostic\".\n showdiagn = False\n if plot_sample and lineindex >= firstlinetoplot and lineindex <= lastlinetoplot:\n showdiagn = True\n\n # Compute straight sum of sky-subbed data in aperture, without pixel\n # rejection. In principle we could edit the CRs out of the straight sum but\n # that would require interpolating across them somehow.\n\n # Keep a copy of data in the aperture for later renormalization of the optimal\n # extraction.\n\n in_ap_data = subbeddata[lineindex, aplimlowint[lineindex]:aplimhighint[lineindex]]\n\n straight_sum[lineindex] = np.sum(in_ap_data)\n\n # I'm getting bad results in very poor S/N parts of the spectrum\n # where the aperture isn't well-defined even after all that smoothing.\n # Here's an attempt to fix this -- in cases where the S/N is terrible,\n # replace the aperture with the gaussian fit to the supposedly good line,\n # recentered. Here we can re-use the gaussian profile fit computed\n # earlier for the \"fiducial\" line, shifted to the local aperture\n # center from aptrace. This ignores any profile variations along the\n # dispersion, but the spec is barely detected anyway.\n\n # The norm array from before has preserved the cross-dispersion sums\n # pre-normalization. Use this to decide whether to substitute the\n # fit for the empirical profile.\n\n if norm[lineindex] < readnoise / gain: # basically nothing there.\n apmodel = modeling.models.Gaussian1D(amplitude =\n rootpi/fittedgau.stddev.value, mean = apcent[lineindex],\n stddev = fittedgau.stddev.value)\n apdata[lineindex] = apmodel(range(apdata.shape[1]))\n n_profiles_substituted = n_profiles_substituted + 1\n\n # 'pixind' is the array of pixel numbers to be included.\n # When pixels are rejected, the mechanism used is to delete\n # their index from pixind.\n\n # To start, include only pixels where the aperture is\n # at least positive and a bit.\n\n pixind0 = np.where(apdata[lineindex] > 0.001)\n # this weirdly returned a tuple that would not do fancy indexing:\n pixinds = np.array(pixind0)\n\n # Include only those pixels that are within the aperture\n # in this row.\n pixinds = pixinds[pixinds >= aplimlowint[lineindex]]\n pixinds = pixinds[pixinds <= aplimhighint[lineindex]]\n\n # renormalize apdata to the values within the aperture.\n # This is assumed to contain 'all the light'.\n\n validsum = np.sum(apdata[lineindex, pixinds])\n apdata[lineindex, pixinds] = apdata[lineindex, pixinds] / validsum\n\n worst_scatter = 10000. # initialize high to make the loop start.\n\n largest_valid_stat = 40. # this isn't used yet.\n iteration = 0\n\n # \"while\" loop to iterate CR rejection. Second\n # condtion guards against case of no valid aperture points.\n\n while worst_scatter > scattercut and pixinds.size > 0:\n\n # Horne eq'n (8):\n numerator = np.sum(apdata[lineindex, pixinds] * subbeddata[lineindex, pixinds] / varimage[lineindex, pixinds])\n denominator = np.sum(apdata[lineindex, pixinds] ** 2 / varimage[lineindex, pixinds])\n optimally_extracted[lineindex] = numerator/denominator\n\n # Horne eq'n (9) for variance, square-rooted to get sigma:\n sigma_spec[lineindex] = np.sqrt(1. / (np.sum(apdata[lineindex, pixinds] ** 2 / varimage[lineindex, pixinds])))\n\n # The procedure for eliminating cosmic rays and other discrepant profile points\n # follows; it's taken from Horne's article, page 614, top right.\n\n # compute Horne's measure of anomalous pixels due to CRs or whatever.\n\n # NOTE that an inaccurate profile estimate will lead to spurious 'bad' pixels.\n # May want to put in something to relax the rejection criterion for bright objects.\n\n scatter_array = ((subbeddata[lineindex, pixinds] - optimally_extracted[lineindex] * apdata[lineindex, pixinds])**2 / varimage[lineindex, pixinds])\n\n # array of S/Ns to assess validity of stat model - not yet used.\n sn_array = subbeddata[lineindex, pixinds] / np.sqrt(varimage[lineindex, pixinds])\n\n if showdiagn: # examine the fit in this row in detail.\n print(\"scatter_array \", scatter_array, \" shape \", scatter_array.shape)\n print(\"sn_array\", sn_array)\n\n worst_scatter = np.max(scatter_array)\n\n if worst_scatter > scattercut: # reject bad pixels\n\n # find and delete bad pixel. This will fail if there are two equal\n # values of scatter_array, but they are floats so the chance of this\n # happening is minuscule.\n\n index_of_worst = np.where(scatter_array == worst_scatter)[0][0]\n pixinds = np.delete(pixinds, index_of_worst)\n\n if showdiagn:\n print(\"worst: \", worst_scatter, \"killed index \", index_of_worst)\n\n # Also edit out the high point from the in_ap_data so it doesn't skew the\n # later overall renormalization too badly.\n\n bad_point_value = subbeddata[lineindex, index_of_worst]\n in_ap_data = in_ap_data[in_ap_data != bad_point_value]\n\n # re-normalize the remaining aperture points.\n # *** This was an error!! *** Just omit the point, and keep normalization.\n # validsum = np.sum(apdata[lineindex, pixinds])\n # apdata[lineindex, pixinds] = apdata[lineindex, pixinds] / validsum\n\n # keep track of how many pixels were rejected, and how\n # many spectral points are affected.\n\n nrej_pixel += 1\n if iteration == 0:\n corrected_specpts += 1\n\n if len(pixinds) == 0: # Uh-oh -- out of pixels!\n worst_scatter = 0. # will kick us out of loop.\n optimally_extracted[lineindex] = 0.\n\n iteration += 1\n\n if len(pixinds) == 0: # can be zero because aperture is all zero.\n optimally_extracted[lineindex] = 0.\n sigma_spec[lineindex] = 10. # arbitrary\n\n # accumulate sum of flux in non-rejected straight sum points.\n cr_corrected_overall_flux += np.sum(in_ap_data)\n\n # plot some sample lines for diagnostic if indicated.\n\n if showdiagn:\n lowx = aplimlowint[lineindex] #brevity\n highx = aplimhighint[lineindex]\n plrange = range(lowx - 15, highx + 15)\n # plot aperture profile * estimate\n plt.plot(plrange, apdata[lineindex, plrange] * optimally_extracted[lineindex])\n # and also the actual sky-subtracted data.\n plt.plot(plrange, subbeddata[lineindex, plrange])\n\n # also plot vertical bars at pixel limits, and dots at pixels that were used.\n plt.plot((lowx, lowx), (-10, 50))\n plt.plot((highx, highx), (-10, 50))\n pixpl = np.zeros(pixinds.shape[0])\n plt.plot(pixinds, pixpl, 'bo')\n plt.title(\"Line %d optextr %8.2f \" % (lineindex, optimally_extracted[lineindex]))\n plt.show()\n\n if diagnostic:\n # write aperture image (as amended by extraction) for a diagnostic.\n hduout.data = apdata\n hduout.writeto(imroot + \"_aperture.fits\", overwrite=True)\n print(\"Normalized aperture image written to '%s_aperture.fits'\" % imroot)\n print(\"(These diagnostic images are purely for your dining and dancing\")\n print(\"pleasure, and can be safely deleted.)\")\n print(\" \")\n\n # Finally, normalize the optimally extracted spec to\n # the cr-rejected straight sum.\n\n normfac = cr_corrected_overall_flux / np.sum(optimally_extracted)\n if diagnostic:\n print(\"overall flux %8.0f, sum of optimal extr. %8.0f, norm. fac %7.5f\" %\n (cr_corrected_overall_flux, np.sum(optimally_extracted), normfac))\n optimally_extracted *= normfac\n\n # EXTRACTION IS COMPLETE!\n\n ultimate = rawdata.shape[0] - 1 # last and second-to-last indices\n penultimate = rawdata.shape[0] - 2\n\n if DISPAXIS == 2:\n\n # For modspec data -- and presumably for other column-dispersion ---\n\n # Comparison with previous extractions show an off-by-one!\n # Never could figure out why, so shift output arrays by one\n # pixel with np.roll, and repeat the last pixel.\n # Could also do this with indexing I'm thinking that\n # the implementation of np.roll is likely to be faster (?).\n\n ultimate = rawdata.shape[0] - 1\n penultimate = rawdata.shape[0] - 2\n\n out1 = np.roll(optimally_extracted, -1)\n out1[ultimate] = out1[penultimate]\n\n out2 = np.roll(straight_sum, -1)\n out2[ultimate] = out2[penultimate]\n\n out3 = np.roll(bckgrspec * skyscalefac, -1)\n out3[ultimate] = out3[penultimate]\n\n out4 = np.roll(sigma_spec, -1)\n out4[ultimate] = out4[penultimate]\n\n else: # OSMOS data (dispaxis = 1) doesn't have this issue\n # Code to fix a bad pixel at high end left in place commented\n # out in case it's needed\n out1 = optimally_extracted\n # out1[ultimate] = out1[penultimate] # fudge the last pixel.\n out2 = straight_sum\n # out2[ultimate] = out2[penultimate] # fudge the last pixel.\n out3 = bckgrspec * skyscalefac\n out4 = sigma_spec\n\n print(imroot, \": rejected \", nrej_pixel, \" pixels, affecting \", corrected_specpts, \" spectral points.\")\n return out1, out2, out3, out4\n\n" }, { "alpha_fraction": 0.7116104960441589, "alphanum_fraction": 0.7116104960441589, "avg_line_length": 25.700000762939453, "blob_id": "476f27289c8689f85c700433b58a6a31821e46e6", "content_id": "dad63947493457d4bc2a8c6fa31a33e3b2e642a4", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 267, "license_type": "permissive", "max_line_length": 100, "num_lines": 10, "path": "/trunk/src/deimos/__init__.py", "repo_name": "svalenti/deimos", "src_encoding": "UTF-8", "text": "import numpy as np\nimport astropy\nfrom matplotlib import pylab as plt\n\n__version__ = \"unknown\"\ntry:\n from _version import __version__\nexcept ImportError:\n # We're running in a tree that doesn't have a _version.py, so we don't know what our version is.\n pass\n" }, { "alpha_fraction": 0.5356631278991699, "alphanum_fraction": 0.5713058114051819, "avg_line_length": 37.06386184692383, "blob_id": "1f546539a8466ff61ac58cea7d55ca1c564baa90", "content_id": "b133ea5ec11e44df958bc974adce2e2b809a198e", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 24437, "license_type": "permissive", "max_line_length": 133, "num_lines": 642, "path": "/trunk/src/deimos/deimoswave.py", "repo_name": "svalenti/deimos", "src_encoding": "UTF-8", "text": "from matplotlib import pylab as plt\nplt.ion()\nimport numpy as np\nfrom astropy.io import fits\nfrom scipy.interpolate import interp1d\nimport sys\nfrom scipy.optimize import fmin\npyversion = sys.version_info[0]\nimport deimos\nimport os\n\npoly_arc = {3: np.array([ 1.03773471e-05, 5.78487274e-01, 4.45847046e+03]),\n# 7: np.array([ 2.30350858e-05, -7.64099597e-01, 9.79141140e+03]),\n# 7: np.array([ -1.39838149e-13, 1.83212231e-09, -8.83011172e-06, -6.28779911e-01, 9.64233695e+03])}\n 7: np.array([ -1.39838149e-13, 1.83212231e-09, -8.83011172e-06, -6.28779911e-01, 9.64533695e+03])}\n\ndef find_nearest(array, value):\n array = np.asarray(array)\n idx = (np.abs(array - value)).argmin()\n return array[idx],idx\n\ndef get_profile_model(params1, ys):\n a1, cy1, sigma1 = params1\n p1 = np.exp(-(ys - cy1)**2 / 2 / sigma1**2)\n p1 /= p1.max()\n return a1 * p1 \n\ndef get_profile_chisq(params2, ys, profile):\n model = get_profile_model(params2, ys)\n return np.sum( (profile - model)**2 / np.sqrt(np.abs(profile)) ) / (profile.size - len(params2))\n\ndef fitline(xx,yy,center,amplitude=1,sigma=3,verbose=True):\n guess = [amplitude,float(center),sigma]\n params3 = fmin(get_profile_chisq, guess, args=(xx, yy))\n model = get_profile_model(params3, xx)\n if verbose:\n plt.clf()\n plt.plot(xx,yy,'-b',linewidth=3)\n plt.plot(xx,model,'-r',linewidth=3)\n print(params3)\n return params3\n\ndef detect_peaks(x, mph=None, mpd=1, threshold=0, edge='rising',\n kpsh=False, valley=False, show=False, ax=None, title=True):\n\n \"\"\"Detect peaks in data based on their amplitude and other features.\n Parameters\n ----------\n x : 1D array_like\n data.\n mph : {None, number}, optional (default = None)\n detect peaks that are greater than minimum peak height (if parameter\n `valley` is False) or peaks that are smaller than maximum peak height\n (if parameter `valley` is True).\n mpd : positive integer, optional (default = 1)\n detect peaks that are at least separated by minimum peak distance (in\n number of data).\n threshold : positive number, optional (default = 0)\n detect peaks (valleys) that are greater (smaller) than `threshold`\n in relation to their immediate neighbors.\n edge : {None, 'rising', 'falling', 'both'}, optional (default = 'rising')\n for a flat peak, keep only the rising edge ('rising'), only the\n falling edge ('falling'), both edges ('both'), or don't detect a\n flat peak (None).\n kpsh : bool, optional (default = False)\n keep peaks with same height even if they are closer than `mpd`.\n valley : bool, optional (default = False)\n if True (1), detect valleys (local minima) instead of peaks.\n show : bool, optional (default = False)\n if True (1), plot data in matplotlib figure.\n ax : a matplotlib.axes.Axes instance, optional (default = None).\n title : bool or string, optional (default = True)\n if True, show standard title. If False or empty string, doesn't show\n any title. If string, shows string as title.\n Returns\n -------\n ind : 1D array_like\n indeces of the peaks in `x`.\n Notes\n -----\n The detection of valleys instead of peaks is performed internally by simply\n negating the data: `ind_valleys = detect_peaks(-x)`\n The function can handle NaN's\n See this IPython Notebook [1]_.\n References\n ----------\n .. [1] http://nbviewer.ipython.org/github/demotu/BMC/blob/master/notebooks/DetectPeaks.ipynb\n Examples\n --------\n >>> from detect_peaks import detect_peaks\n >>> x = np.random.randn(100)\n >>> x[60:81] = np.nan\n >>> # detect all peaks and plot data\n >>> ind = detect_peaks(x, show=True)\n >>> print(ind)\n >>> x = np.sin(2*np.pi*5*np.linspace(0, 1, 200)) + np.random.randn(200)/5\n >>> # set minimum peak height = 0 and minimum peak distance = 20\n >>> detect_peaks(x, mph=0, mpd=20, show=True)\n >>> x = [0, 1, 0, 2, 0, 3, 0, 2, 0, 1, 0]\n >>> # set minimum peak distance = 2\n >>> detect_peaks(x, mpd=2, show=True)\n >>> x = np.sin(2*np.pi*5*np.linspace(0, 1, 200)) + np.random.randn(200)/5\n >>> # detection of valleys instead of peaks\n >>> detect_peaks(x, mph=-1.2, mpd=20, valley=True, show=True)\n >>> x = [0, 1, 1, 0, 1, 1, 0]\n >>> # detect both edges\n >>> detect_peaks(x, edge='both', show=True)\n >>> x = [-2, 1, -2, 2, 1, 1, 3, 0]\n >>> # set threshold = 2\n >>> detect_peaks(x, threshold = 2, show=True)\n >>> x = [-2, 1, -2, 2, 1, 1, 3, 0]\n >>> fig, axs = plt.subplots(ncols=2, nrows=1, figsize=(10, 4))\n >>> detect_peaks(x, show=True, ax=axs[0], threshold=0.5, title=False)\n >>> detect_peaks(x, show=True, ax=axs[1], threshold=1.5, title=False)\n Version history\n ---------------\n '1.0.6':\n Fix issue of when specifying ax object only the first plot was shown\n Add parameter to choose if a title is shown and input a title\n '1.0.5':\n The sign of `mph` is inverted if parameter `valley` is True\n \"\"\"\n\n x = np.atleast_1d(x).astype('float64')\n if x.size < 3:\n return np.array([], dtype=int)\n if valley:\n x = -x\n if mph is not None:\n mph = -mph\n # find indices of all peaks\n dx = x[1:] - x[:-1]\n # handle NaN's\n indnan = np.where(np.isnan(x))[0]\n if indnan.size:\n x[indnan] = np.inf\n dx[np.where(np.isnan(dx))[0]] = np.inf\n ine, ire, ife = np.array([[], [], []], dtype=int)\n if not edge:\n ine = np.where((np.hstack((dx, 0)) < 0) & (np.hstack((0, dx)) > 0))[0]\n else:\n if edge.lower() in ['rising', 'both']:\n ire = np.where((np.hstack((dx, 0)) <= 0) & (np.hstack((0, dx)) > 0))[0]\n if edge.lower() in ['falling', 'both']:\n ife = np.where((np.hstack((dx, 0)) < 0) & (np.hstack((0, dx)) >= 0))[0]\n ind = np.unique(np.hstack((ine, ire, ife)))\n # handle NaN's\n if ind.size and indnan.size:\n # NaN's and values close to NaN's cannot be peaks\n ind = ind[np.in1d(ind, np.unique(np.hstack((indnan, indnan-1, indnan+1))), invert=True)]\n # first and last values of x cannot be peaks\n if ind.size and ind[0] == 0:\n ind = ind[1:]\n if ind.size and ind[-1] == x.size-1:\n ind = ind[:-1]\n # remove peaks < minimum peak height\n if ind.size and mph is not None:\n ind = ind[x[ind] >= mph]\n # remove peaks - neighbors < threshold\n if ind.size and threshold > 0:\n dx = np.min(np.vstack([x[ind]-x[ind-1], x[ind]-x[ind+1]]), axis=0)\n ind = np.delete(ind, np.where(dx < threshold)[0])\n # detect small peaks closer than minimum peak distance\n if ind.size and mpd > 1:\n ind = ind[np.argsort(x[ind])][::-1] # sort ind by peak height\n idel = np.zeros(ind.size, dtype=bool)\n for i in range(ind.size):\n if not idel[i]:\n # keep peaks with the same height if kpsh is True\n idel = idel | (ind >= ind[i] - mpd) & (ind <= ind[i] + mpd) \\\n & (x[ind[i]] > x[ind] if kpsh else True)\n idel[i] = 0 # Keep current peak\n # remove the small peaks and sort back the indices by their occurrence\n ind = np.sort(ind[~idel])\n\n if show:\n if indnan.size:\n x[indnan] = np.nan\n if valley:\n x = -x\n if mph is not None:\n mph = -mph\n _plot(x, mph, mpd, threshold, edge, valley, ax, ind, title)\n\n return ind\n\n\ndef _plot(x, mph, mpd, threshold, edge, valley, ax, ind, title):\n \"\"\"Plot results of the detect_peaks function, see its help.\"\"\"\n try:\n import matplotlib.pyplot as plt\n except ImportError:\n print('matplotlib is not available.')\n else:\n if ax is None:\n _, ax = plt.subplots(1, 1, figsize=(8, 4))\n no_ax = True\n else:\n no_ax = False\n\n ax.plot(x, 'b', lw=1)\n if ind.size:\n label = 'valley' if valley else 'peak'\n label = label + 's' if ind.size > 1 else label\n ax.plot(ind, x[ind], '+', mfc=None, mec='r', mew=2, ms=8,\n label='%d %s' % (ind.size, label))\n ax.legend(loc='best', framealpha=.5, numpoints=1)\n ax.set_xlim(-.02*x.size, x.size*1.02-1)\n ymin, ymax = x[np.isfinite(x)].min(), x[np.isfinite(x)].max()\n yrange = ymax - ymin if ymax > ymin else 1\n ax.set_ylim(ymin - 0.1*yrange, ymax + 0.1*yrange)\n ax.set_xlabel('Data #', fontsize=14)\n ax.set_ylabel('Amplitude', fontsize=14)\n if title:\n if not isinstance(title, str):\n mode = 'Valley detection' if valley else 'Peak detection'\n title = \"%s (mph=%s, mpd=%d, threshold=%s, edge='%s')\"% \\\n (mode, str(mph), mpd, str(threshold), edge)\n ax.set_title(title)\n # plt.grid()\n if no_ax:\n plt.show()\n\n##################################\n# add def model_lamp_std\n\n# add crossmatch definition\n\n\ndef model_lamp(params, wave, counts):\n wav0, scale, c0 = params\n \n dtype = []\n dtype.append(('wav', float))\n dtype.append(('flux', float))\n model = np.zeros(counts.shape, dtype=dtype)\n model['wav'] = wav0 + wave #+ b * dx**2\n model['flux'] = c0 + scale * counts\n return model\n\ndef model_lamp_std(params, wave, counts):\n wav0, c0 = params\n dtype = []\n dtype.append(('wav', float))\n dtype.append(('flux', float))\n model = np.zeros(counts.shape, dtype=dtype)\n model['wav'] = wav0 + wave #+ b * dx**2\n model['flux'] = c0 * counts\n return model\n\ndef checkwithtelluric(wave, flux, key, ref_filename, guess = (1.0, 1.001), verbose=False):\n from astropy.io import ascii\n from astropy.table import QTable\n if key == 7:\n which_side = 'red'\n if key == 3:\n which_side = 'blue'\n std = QTable([wave,flux], names=('wave', 'flux'))\n std.sort('wave')\n stdwave = std['wave']\n stdflux = std['flux']\n \n stdflux = stdflux-stdflux.min()\n stdflux = stdflux/stdflux.max()\n \n # this will be the array with atmospheric lines removed\n stdwave_cut = stdwave\n stdflux_cut = stdflux\n # cut the atmoshperic lines\n if which_side == 'red':\n atm_range = [[7150, 7420],[7580,7730],[7840,8450]] #red\n if which_side == 'blue': \n #atm_range = [[6250,6340],[6850,7100],[7150, 7420],[7580,7730],[7840,8450]]\n atm_range = [[6250,6340],[6850,6990]]\n for j in atm_range:\n ww = (stdwave_cut < j[0]) | (stdwave_cut > j[1])\n stdwave_cut = stdwave_cut[ww]\n stdflux_cut = stdflux_cut[ww]\n \n # read the reference sky\n hdu = fits.open(ref_filename)\n y = hdu[0].data\n x = np.arange(len(y))\n A = hdu[0].header['CRVAL1']\n B = hdu[0].header['CDELT1']\n # use headers to get the wavelength calibration\n sky_wave = A +B *x #+ 100\n sky_flux = y\n if which_side == 'red':\n ss = (sky_wave > 6500) & (sky_wave < 9200)\n if which_side == 'blue':\n ss = (sky_wave > 4500) & (sky_wave < 7200)\n sky_flux = 1 - sky_flux[ss]\n sky_wave = sky_wave[ss]\n sky_flux[sky_flux<=0] = 1e-5\n\n # inteprolate the array\n # after removing the telluric I need to inteprolate along the cut to get the same file dimention \n flux_interp = interp1d(stdwave_cut, stdflux_cut, bounds_error=False )\n new_stdflux = flux_interp(stdwave)\n\n # the atmospheric file is usually 1 everywhwere \n atmo = stdflux/new_stdflux\n atmo[atmo<0]=0\n if which_side == 'red':\n gg = (stdwave < 8500) #red\n if which_side == 'blue':\n gg = (stdwave > 5000)\n atmwave=stdwave[gg]\n atmflux = 1 - atmo[gg]\n atmflux[atmflux<=0] = 1e-5\n\n model = model_lamp_std(guess, atmwave, atmflux)\n \n # the get_lamp_difference file takes the inteprolate model file as input \n atmomodel_interp = interp1d(sky_wave, sky_flux, bounds_error=False)\n \n # run the minization giving the interpolated atmospheric file, the initial parameter and the \n bestparams = fmin(get_lamp_difference_std, guess, args=(atmwave, atmflux, atmomodel_interp), maxiter=10000, disp = False)\n # this should be the best parameters for shift and sclae (c)\n print(bestparams)\n shift, scalefactor = bestparams[0],bestparams[1]\n print ('myshift: '+str(shift))\n\n if verbose:\n plt.figure(2)\n fig2 = plt.figure(2)\n fig2.clf()\n # compare the reference spectrum and the extracted sky spectrum\n ax2 = fig2.add_subplot(2, 1, 1)\n ax22 = fig2.add_subplot(2, 1, 2)\n ax2.plot(atmwave, atmflux,'-r')\n ax2.axes.set_ylabel('Flux Density ($10^{16} f_{\\lambda}$)')\n ax2.axes.set_xlabel('Wavelength ($\\AA$)')\n ax2.plot(atmwave, atmflux,'-b')\n ax2.plot(sky_wave, sky_flux,'-r')\n ax2.plot(atmwave+bestparams[0], atmflux,'-g')\n \n # plot the extracted sky spectrum \n ax22.plot(wave, flux)\n ax22.axes.set_ylabel('Counts')\n ax22.axes.set_xlabel('wavelenght'); \n if pyversion>=3:\n input('stop std')\n else:\n raw_input('stop std')\n \n return bestparams[0],bestparams[1]\n###########################################################\n\n\ndef get_lamp_difference(params, wave, flux, skyref_interp):\n model = model_lamp(params, wave, flux)\n \n # residual\n res = model['flux'] - skyref_interp(model['wav'])\n \n return np.sum(res**2 / np.sqrt(np.abs(model['flux'])))\n\ndef get_lamp_difference_std(params, wave, flux, skyref_interp):\n model = model_lamp_std(params, wave, flux)\n \n # residual\n res = model['flux'] - skyref_interp(model['wav'])\n \n return np.sum(res**2 / np.sqrt(np.abs(model['flux'])))\n\n###########################################################\n\ndef fitlamp(lampixel, refpeak, lampeak, deg, pixel, flux, skyref):\n global _pixel, _flux, idd, _lampixel, _refpeak, _deg, nonincl, fig, ax1, _params5, _num, _line, _line3,\\\n ax2, ax3, _skyref_wav, _skyref_flux, _line2, _line4, _line5\n \n _pixel= pixel\n _flux= flux\n _lampixel = lampixel\n _refpeak = refpeak\n _deg = deg\n _num = 0\n _skyref_wav = skyref['wav']\n _skyref_flux = skyref['flux']\n \n \n idd = list(range(len(_lampixel)))\n nonincl = []\n\n _params5 = np.polyfit(_lampixel[idd], _refpeak[idd], _deg )\n p2 = np.poly1d(_params5) \n \n fig = plt.figure(1)\n plt.clf()\n ax1 = fig.add_subplot(3, 1, 1)\n ax2 = fig.add_subplot(3, 1, 2)\n ax3 = fig.add_subplot(3, 1, 3)\n\n _line = ax1.plot(p2(_lampixel),_refpeak-p2(_lampixel),'.r')\n _line3 = ax1.plot(np.array(p2(_lampixel))[nonincl], (_refpeak-p2(_lampixel))[nonincl],'oc')\n ax1.set_xlim(np.min(p2(_pixel)),np.max(p2(_pixel)))\n\n \n ax2.plot(_skyref_wav, _skyref_flux,'-b')\n ax2.plot(p2(_pixel), _flux,'-r')\n ax2.plot(p2(_lampixel),np.ones(len(_lampixel)),'|b')\n ax2.plot(_refpeak,np.ones(len(_lampixel)),'|r')\n ax2.set_ylim(0,1.1)\n ax2.set_xlim(np.min(p2(_pixel)),np.max(p2(_pixel)))\n\n \n ax3.plot(_skyref_wav, _skyref_flux,'-b')\n _line2 = ax3.plot(p2(_pixel), _flux,'-r')\n ax3.set_xlim(p2(_lampixel[_num]) - 50, p2(_lampixel)[_num] + 50)\n ax3.set_ylim(0,1.1)\n _line4 = ax3.plot(p2(_lampixel[_num]),[1],'|b', label = 'ref. lamp detection')\n _line5 = ax3.plot(_refpeak[_num],[1],'|r', label = 'lamp detection')\n plt.legend()\n \n kid = fig.canvas.mpl_connect('key_press_event', onkeycazzo)\n plt.draw()\n if pyversion>=3:\n input('left-click mark bad, right-click unmark, <d> remove. Return to exit ...')\n else:\n raw_input('left-click mark bad, right-click unmark, <d> remove. Return to exit ...')\n return _params5\n\ndef onkeycazzo(event):\n global _pixel,_flux, idd, _lampixel, _refpeak, _deg, nonincl, fig, ax1, _params5, _num, _line, _line3,\\\n ax2, ax3, _skyref_wav, _skyref_flux, _line2, _line4, _line5\n \n xdata,ydata = event.xdata,event.ydata\n\n _params5 = np.polyfit(_lampixel[idd], _refpeak[idd], _deg )\n p2 = np.poly1d(_params5) \n\n dist = np.sqrt((xdata-np.array(p2(_lampixel)))**2+(ydata - (np.array(_refpeak)- p2(_lampixel)))**2)\n ii = np.argmin(dist)\n _num = ii\n\n if event.key == 'a' :\n idd.append(idd[-1]+1)\n __lampixel = list(_lampixel)\n __lampixel.append(xdata)\n _lampixel = np.array(__lampixel)\n __refpeak = list(_refpeak)\n __refpeak.append(ydata)\n _refpeak = np.array(__refpeak)\n ax1.plot(xdata,ydata,'ob')\n if event.key == 'd' :\n idd.remove(ii)\n _num = ii\n for i in range(len(_lampixel)):\n if i not in idd: nonincl.append(i)\n if event.key == 'c' :\n _num = ii\n\n if event.key in ['1','2','3','4','5','6','7','8','9'] :\n _deg = int(event.key)\n\n _params5 = np.polyfit(_lampixel[idd], _refpeak[idd], _deg )\n p2 = np.poly1d(_params5) \n \n _line.pop(0).remove()\n _line3.pop(0).remove()\n _line = ax1.plot(p2(_lampixel),_refpeak-p2(_lampixel),'.r')\n _line3 = ax1.plot(np.array(p2(_lampixel))[nonincl], (_refpeak-p2(_lampixel))[nonincl],'oc')\n ax1.set_xlim(np.min(p2(_pixel)),np.max(p2(_pixel)))\n\n ax2.plot(_skyref_wav, _skyref_flux,'-b')\n ax2.plot(p2(_pixel), _flux,'-r')\n ax2.plot(p2(_lampixel),np.ones(len(_lampixel)),'|b')\n ax2.plot(_refpeak,np.ones(len(_lampixel)),'|r')\n ax2.set_ylim(0,1.1)\n ax2.set_xlim(np.min(p2(_pixel)),np.max(p2(_pixel)))\n\n _line2.pop(0).remove()\n _line4.pop(0).remove()\n _line5.pop(0).remove()\n ax3.plot(_skyref_wav, _skyref_flux,'-b')\n _line2 = ax3.plot(p2(_pixel), _flux,'-r')\n ax3.set_xlim(p2(_lampixel[_num]) - 50, p2(_lampixel)[_num] + 50)\n ax3.set_ylim(0,1.1)\n _line4 = ax3.plot(p2(_lampixel[_num]),[1],'|b', label = 'ref. lamp detection')\n _line5 = ax3.plot(_refpeak[_num],[1],'|r', label = 'lamp detection')\n plt.legend()\n plt.draw()\n\n#################################\n\ndef wavesolution(reference, pixel, flux, key, radius, edge, initial_solution, deg, initial_shift=0.1):\n # read template spectrum \n hdu = fits.open(reference)\n dd =hdu[1].data\n xx,yy = zip(*dd)\n # normalize spectrum\n yy = yy/np.max(yy)\n\n skyref = {'wav': np.array(xx),\n 'flux': np.array(yy)}\n # we must interpolate the reference spectrum to the model wavelengths\n skyref_interp = interp1d(skyref['wav'], skyref['flux'], bounds_error=False)\n\n\n##\n# I don't understand what is happening here. if I write the file and read it again it works?!?!?!\n# \n##\n imgout = 'arc_test1.ascii'\n np.savetxt(imgout, np.c_[pixel, flux], header='pixel flux')\n # read asci extraction \n data = np.genfromtxt('arc_test1.ascii') \n pixel , flux= zip(*data)\n\n flux = flux - np.min(flux)\n flux = flux/np.max(flux)\n\n # use initial solution\n p = np.poly1d(initial_solution)\n wave = p(pixel)\n pixel = np.array(pixel)\n \n params = (initial_shift, 1.000001, 0.0)\n model = model_lamp(params, wave, flux)\n\n # compute the shift between ref and observed lamp\n guess = (initial_shift, 1.00001, 0.0)\n bestparams = fmin(get_lamp_difference, guess, args=(wave, flux, skyref_interp), maxiter=10000)\n shift = bestparams[0]\n print('###',shift)\n model = model_lamp(bestparams, wave, flux)\n\n # measure the peaks of the observed lamp \n peaks= detect_peaks(flux, mph = 0.05,edge='rising',mpd=2)\n\n # remove peaks too close eachother \n get_indexes = lambda x, xs: [i for (y, i) in zip(xs, range(len(xs))) if x == y]\n close_peaks = np.diff(peaks)<10\n close_peaks_index = get_indexes(True, close_peaks)\n index_to_remove = close_peaks_index + [i+1 for i in close_peaks_index] \n peaks = np.delete(peaks,index_to_remove)\n\n # measure the peaks of the reference lamp \n peaksref= detect_peaks(skyref['flux'], mph = 0.05,edge='rising',mpd=2)\n\n # remove peaks too close eachother \n get_indexes = lambda x, xs: [i for (y, i) in zip(xs, range(len(xs))) if x == y]\n close_peaks = np.diff(peaksref)<10\n close_peaks_index = get_indexes(True, close_peaks)\n index_to_remove = close_peaks_index + [i+1 for i in close_peaks_index] \n peaksref = np.delete(peaksref,index_to_remove)\n\n skyref['flux_peaks'] = skyref['flux'][peaksref]\n skyref['wav_peaks'] = skyref['wav'][peaksref] \n\n #####################\n wave0 = wave + shift\n\n refpeak=[]\n lampeak=[]\n lampixel=[]\n for i,j in enumerate(skyref['wav_peaks']):\n nearest_to_reference,nearest_to_reference_idx = find_nearest(wave[peaks] + shift, skyref['wav_peaks'][i])\n if np.abs(nearest_to_reference - skyref['wav_peaks'][i]) < radius:\n ww = [( wave0 < nearest_to_reference + edge) & ( wave0 > nearest_to_reference - edge)]\n params_fit = fitline(pixel[ww],flux[ww], peaks[nearest_to_reference_idx], 1., 3., verbose=False)\n peak_minus_fit = np.abs(p(params_fit[1]) + shift -nearest_to_reference)\n if peak_minus_fit< radius:\n # wavelength in the reference arc\n refpeak.append(skyref['wav_peaks'][i])\n \n # wavelength in the observed arc\n lampeak.append(nearest_to_reference)\n \n # pixel in the observed arc\n lampixel.append(params_fit[1])\n\n lampixel = np.array(lampixel)\n refpeak = np.array(refpeak)\n lampeak = np.array(lampeak)\n finalsolution = fitlamp(lampixel, refpeak, lampeak, deg, pixel, flux, skyref)\n return finalsolution\n\n##############################################################################################################################\n\ndef checkshift(img, dictionary, key, wave, arc, arcspec, sky, skyref, skyref_interp, setup, verbose = True ):\n dictionary[img]['arcfile' + str(key)]= arc[key]\n dictionary[img]['arcspec' + str(key)] = arcspec\n flux = dictionary[img]['spec_opt' + str(key)]\n _dir = '_'.join(setup)\n shift = 0\n if 'std' not in dictionary[img].keys():\n # check if it is monotonically increasing\n dxa = np.diff(wave)\n if (dxa > 0).all() is False:\n print('invert vector')\n sky0 = sky[::-1]\n wave0 = wave[::-1]\n else:\n sky0 = sky\n wave0 = wave\n \n guess = (.000001, 1.00001, 0.00001)\n# bestparams = fmin(deimos.deimoswave.get_lamp_difference, guess, args=(wave0, sky0, skyref_interp), maxiter=10000)\n bestparams = fmin(get_lamp_difference, guess, args=(wave0, sky0, skyref_interp), maxiter=10000)\n if (dxa > 0).all() is False:\n shift = bestparams[0]\n else:\n shift = (-1) * bestparams[0]\n \n print('shift the spectrum of ',shift) \n # wavelength calibration in the database\n wave = wave + shift\n \n if verbose:\n plt.figure(2)\n fig2 = plt.figure(2)\n fig2.clf()\n # compare the reference spectrum and the extracted sky spectrum\n ax2 = fig2.add_subplot(2, 1, 1)\n ax22 = fig2.add_subplot(2, 1, 2)\n ax2.plot(skyref['wav'], skyref['flux']/np.max(skyref['flux']))\n ax2.axes.set_ylabel('Flux Density ($10^{16} f_{\\lambda}$)')\n ax2.axes.set_xlabel('Wavelength ($\\AA$)')\n ax2.plot(wave, sky0)\n \n # plot the extracted sky spectrum \n ax22.plot(wave, flux)\n ax22.axes.set_ylabel('Counts')\n ax22.axes.set_xlabel('wavelenght');\n if pyversion>=3:\n input('stop here')\n else:\n raw_input('stop here') \n else:\n ref_filename = os.path.join(deimos.__path__[0]+'/resources/sky/','std_telluric.fits')\n imgout = 'std_'+ _dir + '_' + str(key) + '.ascii'\n np.savetxt(imgout, np.c_[wave, flux ], header='wave flux ') \n# shift, scalefactor = deimos.deimoswave.checkwithtelluric(wave, flux , key, ref_filename, guess=(0.001,1.0001), verbose=True)\n shift, scalefactor = checkwithtelluric(wave, flux , key, ref_filename, guess=(0.001,1.0001), verbose=True)\n print ('myshift: '+str(shift))\n print('shift the spectrum of ',shift) \n # wavelength calibration in the database\n wave = wave + shift\n return dictionary, wave\n" }, { "alpha_fraction": 0.5236722230911255, "alphanum_fraction": 0.5393860936164856, "avg_line_length": 34.953285217285156, "blob_id": "4cdc49043c7815fea92950284126c04f65020939", "content_id": "5f507f5e495273cdb8be6386ee7bb925fc071a0b", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 24628, "license_type": "permissive", "max_line_length": 105, "num_lines": 685, "path": "/trunk/src/deimos/old/util.py", "repo_name": "svalenti/deimos", "src_encoding": "UTF-8", "text": "import astropy\nimport numpy\nfrom astropy.io import fits\nimport glob\nimport os\nimport re\nfrom matplotlib import pylab as plt\nimport numpy as np\nimport math\nfrom scipy.signal import find_peaks_cwt\nimport ccdproc\nfrom astropy.nddata import CCDData\nfrom astropy import units as u\nfrom scipy.interpolate import LSQBivariateSpline, LSQUnivariateSpline\nfrom astropy.stats import sigma_clip\nfrom scipy.optimize import fmin\nfrom scipy.optimize import least_squares\nfrom scipy.interpolate import interp1d\nimport pickle\n\npoly_arc = {3: np.array([ 1.03773471e-05, 5.78487274e-01, 4.45847046e+03]),\n 7: np.array([ 2.30350858e-05, -7.64099597e-01, 9.79141140e+03])}\n\nplt.ion()\n\n\ndef get_profile_model(params, ys):\n# a1, cy1, sigma1, a2, cy2, sigma2 = params\n a1, cy1, sigma1 = params\n \n p1 = np.exp(-(ys - cy1)**2 / 2 / sigma1**2) \n p1 /= p1.max()\n \n# p2 = np.exp(-(ys - cy2)**2 / 2 / sigma2**2) \n# p2 /= p2.max()\n return a1 * p1 #+ a2 * p2\n\ndef get_profile_chisq(params, ys, profile):\n model = get_profile_model(params, ys)\n return np.sum( (profile - model)**2 / np.sqrt(np.abs(profile)) ) / (profile.size - len(params))\n\n###################################################\n\ndef get_profile_spl(dls, stamp):\n # need to sort the data (and weights) so that the x values are increasing\n x, y = dls.ravel(), stamp.ravel()\n weights = np.sqrt(np.abs(y)) # not technically optimal for coadded data, but ok\n wsort = x.argsort()\n x, y, weights = x[wsort], y[wsort], weights[wsort]\n \n # set locations for spline knots\n t = np.linspace(x.min() + 1, x.max() - 1, np.int(x.max() - x.min()))\n spl = LSQUnivariateSpline(x, y, t, weights)\n return x, y, spl\n\n############################################\n\ndef get_dl_model(params, dxs, dys):\n return dxs + params[0] * dys + params[1] * dys ** 2\n\n###########################################\n\ndef check_dl_model(params, dxs, dys, stamp):\n dls = get_dl_model(params, dxs, dys)\n x, y, spl = get_profile_spl(dls, stamp)\n chisq = np.sum((stamp - spl(dls)) ** 2 / np.sqrt(np.abs(stamp)))\n return chisq / (stamp.size - len(params))\n\n###############################################################################\n# function to fit a 2D spline\ndef fit_sky(xvals, yvals, image, ky=1, dx=0.5):\n # select knot points in the x (wavelength) direction\n tx = np.arange(xvals.min() + 2, xvals.max() - 2, dx)\n \n # select knot points in the y (spatial) direction\n ty = [] # if there are no knots, the fit will be a poly nomial of degree ky\n \n # fit the 2D spline\n return LSQBivariateSpline(xvals.ravel(), yvals.ravel(), image.ravel(), tx, ty, ky=ky)\n\n###############################################################################\n\ndef checkalldata(directory=False):\n if directory is not False:\n imglist = glob.glob(directory + '*')\n else:\n imglist = glob.glob('*fits')\n \n listhd = ['GRATENAM','SLMSKNAM','MJD-OBS','DATE-OBS','EXPTIME','AIRMASS','OBJECT',\\\n 'SLSELNAM','TARGNAME','LAMPS','FLAMPS','OBSTYPE','IMTYPE','RA','DEC']\n dictionary={}\n for img in imglist:\n dictionary[img]={}\n hdu = fits.open(img)\n dictionary[img]['fits']= hdu\n for _header in listhd:\n if hdu[0].header.get(_header) is not None:\n dictionary[img][_header]= hdu[0].header.get(_header)\n else:\n dictionary[img][_header]= None\n \n \n dictionary[img]['type']= None\n if dictionary[img]['SLMSKNAM'] =='GOH_X':\n dictionary[img]['type']= 'focus'\n else:\n # select arcs\n if dictionary[img]['OBSTYPE'] =='Line':\n if dictionary[img]['LAMPS']!=['Off']:\n dictionary[img]['type']= 'arc'\n # select flats\n if dictionary[img]['OBSTYPE'] =='IntFlat':\n if hdu[0].header.get('FLAMPS')!=['Off']:\n dictionary[img]['type']= 'flat'\n # select objecs\n if dictionary[img]['OBSTYPE'] =='Object':\n dictionary[img]['type']= 'object'\n \n setup_object={}\n setup_flat={}\n setup_arc={}\n for img in dictionary:\n print(img,dictionary[img]['type'],dictionary[img]['OBJECT'],dictionary[img]['OBSTYPE'])\n if dictionary[img]['type'] is None:\n print(dictionary[img])\n answ = input('what is it?')\n \n _grism = dictionary[img]['GRATENAM']\n _slit = dictionary[img]['SLMSKNAM'] \n \n if dictionary[img]['type']=='object':\n if (_grism,_slit) not in setup_object:\n setup_object[_grism,_slit]=[]\n setup_object[_grism,_slit].append(img)\n \n if dictionary[img]['type']=='arc':\n if (_grism,_slit) not in setup_arc:\n setup_arc[_grism,_slit]=[]\n setup_arc[_grism,_slit].append(img)\n \n if dictionary[img]['type']=='flat':\n if (_grism,_slit) not in setup_flat:\n setup_flat[_grism,_slit]=[]\n setup_flat[_grism,_slit].append(img)\n \n return dictionary, setup_object, setup_arc, setup_flat\n\n########################################################################\n\ndef trim_rotate_split(setup_object,setup_flat,setup_arc,dictionary,key):\n xmin3,xmax3 = 710,860\n xmin7,xmax7 = 1205,1350\n ############ split files\n for img in setup_object[key] + setup_flat[key]+setup_arc[key]:\n# img3=re.sub('.fits','',img) + '_3.fits'\n# img7=re.sub('.fits','',img) + '_7.fits' \n _header3 = dictionary[img]['fits'][3].header\n _header7 = dictionary[img]['fits'][7].header\n _data3 = np.transpose(dictionary[img]['fits'][3].data)\n _data7 = np.transpose(dictionary[img]['fits'][7].data)\n\n for ll in ['DATASEC','DETSIZE','DETSEC']:\n del _header3[ll]\n del _header7[ll]\n \n science3 = CCDData(data=_data3,header=_header3,unit=u.adu)\n science7 = CCDData(data=_data7,header=_header7,unit=u.adu)\n # add header from the \n _header3['exptime'] = dictionary[img]['EXPTIME']\n _header3['MJD-OBS'] = dictionary[img]['MJD-OBS']\n _header3['OBJECT'] = dictionary[img]['OBJECT']\n _header3['OBSTYPE'] = dictionary[img]['OBSTYPE']\n _header3['AIRMASS'] = dictionary[img]['AIRMASS']\n _header3['RA'] = dictionary[img]['RA']\n _header3['DEC'] = dictionary[img]['DEC']\n \n _header7['exptime'] = dictionary[img]['EXPTIME']\n _header7['MJD-OBS'] = dictionary[img]['MJD-OBS']\n _header7['OBJECT'] = dictionary[img]['OBJECT']\n _header7['OBSTYPE'] = dictionary[img]['OBSTYPE']\n _header7['AIRMASS'] = dictionary[img]['AIRMASS']\n _header7['RA'] = dictionary[img]['RA']\n _header7['DEC'] = dictionary[img]['DEC']\n\n # trim images \n trimmed3 = ccdproc.trim_image(science3, fits_section='[:,' + str(xmin3) + ':' + str(xmax3) + ']')\n trimmed7 = ccdproc.trim_image(science7, fits_section='[:,' + str(xmin7) + ':' + str(xmax7) + ']')\n dictionary[img]['trimmed3'] = trimmed3\n dictionary[img]['trimmed7'] = trimmed7\n return dictionary\n\n######################################################################\n\ndef makeflat(setup_flat,dictionary,key):\n masterflat3 = False\n masterflat7 = False\n ######### make master flat 3 \n flatlist = []\n for img in setup_flat[key]:\n if 'trimmed3' in dictionary[img]:\n flatlist.append(dictionary[img]['trimmed3'].data)\n masterflat3 = np.mean(flatlist,axis=0)\n else:\n print('ERROR: Flat not trimmed3')\n\n ######### make master flat 7\n flatlist = []\n for img in setup_flat[key]:\n if 'trimmed7' in dictionary[img]:\n flatlist.append(dictionary[img]['trimmed7'].data)\n masterflat7 = np.mean(flatlist,axis=0)\n else:\n print('ERROR: Flat not trimmed7')\n return masterflat3, masterflat7\n\n###############################################################\n\ndef image_plot(image):\n # determine the image pixel distribution (used for displaying below)\n sample = sigma_clip(image)\n vmin = sample.mean() - 1 * sample.std()\n vmax = sample.mean() + 3 * sample.std()\n yvals, xvals = np.indices(image.shape)\n extent = (xvals.min(), xvals.max(), yvals.min(), yvals.max())\n plt.imshow(image, origin='lower', cmap='gray', aspect='auto', vmin=vmin, vmax=vmax, extent=extent)\n plt.xlabel('Column Number')\n plt.ylabel('Row Number');\n\n#######################################################\n\ndef find_sky_object(image,objectcut=0.2,key=3,interactive=False):\n # get the a pixel coordinate near the image center\n ny, nx = image.shape\n cy, cx = ny//2, nx//2\n # create 1d arays of the possible x and y values\n xs = np.arange(nx)\n ys = np.arange(ny)\n # pixel coordinates for each pixel\n yvals, xvals = np.indices(image.shape)\n\n # compute the row averages and normalize so that the background is near 0 and the peaks are near 1\n rowaverage = image.mean(axis=1)\n# rowaverage -= np.median(rowaverage)\n rowaverage -= np.percentile(rowaverage,0.1)\n rowaverage /= rowaverage.max()\n \n image_plot(image)\n fig,ax = plt.subplots()\n ax.plot(ys, rowaverage)\n ax.set_xlabel('Row Number (y-coordinate)'), plt.ylabel('Normalized Row Average')\n plt.grid();\n # find the rows with object light\n objrows = ys[rowaverage > objectcut]\n\n rangeobj = {3:'70,100', 7:'55,90'}\n if interactive:\n obj = input('give object position [eg ' + str(rangeobj[key]) + ']')\n if not obj:\n obj = rangeobj[key]\n start,end= obj.split(',')\n objrows = np.arange(int(start),int(end))\n else:\n # add some margin to object rows\n ngrow = 5 # number of rows to include above and below object rows\n newobjrows = []\n for row in objrows:\n newobjrows.extend([row + i for i in np.arange(-ngrow, ngrow + 1)])\n objrows = np.unique(newobjrows)\n \n # mask to mark sky rows\n skymask = np.ones(image.shape, dtype=bool)\n skymask[objrows, :] = False\n \n # also exclude bad rows\n badrows = ys[rowaverage < -0.05]\n skymask[badrows, :] = False\n \n # rows with mostly sky background light\n skyrows = ys[skymask.mean(axis=1) == 1]\n\n # median (unmasked) sky spectrum and standard deviation\n medspec = np.median(image[skyrows, :], axis=0)\n stdspec = np.std(image[skyrows, :], axis=0, ddof=1)\n \n # exclude deviant pixels from the skymask\n pull = (image - medspec) / stdspec\n w = pull > 5\n skymask[w] = False\n\n if interactive:\n plt.close()\n plt.clf()\n plt.figure(figsize=(15, 3))\n plt.imshow(skymask, origin='lower', aspect='auto');\n\n plt.close()\n return objrows, skymask\n \n###################################################\n\ndef retify_frame(img0,ext=3, verbose=False): \n image = dictionary[img0]['trimmed'+str(ext)].data \n # this is an arc, we do not ned to mask\n skymask = np.ones(image.shape, dtype=bool)\n \n # show the mask\n if verbose:\n plt.close()\n plt.figure(figsize=(15, 3))\n plt.imshow(skymask, origin='lower', aspect='auto');\n input('stop')\n\n # cut out a small image \"stamp\" near the center of the frame\n ny, nx = image.shape\n cy, cx = ny//2, nx//2\n xs = np.arange(nx)\n ys = np.arange(ny)\n # pixel coordinates for each pixel\n yvals, xvals = np.indices(image.shape)\n \n row = cy\n col = cx\n hwidth = 50\n \n stamp = image[:, col - hwidth : col + hwidth]\n yvals, xvals = np.indices(image.shape)\n ys_stamp = yvals[:, col - hwidth : col + hwidth]\n xs_stamp = xvals[:, col - hwidth : col + hwidth]\n\n if verbose:\n image_plot(stamp)\n plt.close()\n \n # plot stamp values against column numbers\n plt.close()\n plt.clf()\n plt.plot(xs_stamp.ravel(), stamp.ravel(), 'r.');\n plt.xlabel('Column Number'), plt.ylabel('Counts');\n input('stop')\n plt.close()\n \n # pixel offsets from the refernece pixel\n dxs = xs_stamp - col\n dys = ys_stamp - row\n\n # parameter guess\n guess = (0, 0)\n\n # get the wavelength offsets and plot vs. counts\n dls = get_dl_model(guess, dxs, dys)\n plt.close()\n plt.clf()\n plt.plot(dls.ravel(), stamp.ravel(), 'r.')\n plt.xlabel('Wavelength Offset')\n plt.ylabel('Counts');\n input('stop')\n\n # fit a spline to the data and plot\n x, y, spl = get_profile_spl(dls, stamp)\n\n \n plt.clf()\n fig, axarr = plt.subplots(2, sharex=True)\n axarr[0].plot(x, y, 'r.')\n axarr[0].plot(x, spl(x))\n axarr[1].plot(x, y - spl(x), 'r.')\n plt.ylim(-200, 200)\n plt.xlabel('Wavelength Offset');\n input('stop')\n plt.close()\n \n # see how good our guess is\n check_dl_model(guess, dxs, dys, stamp)\n\n # get the best model parameters for this stamp\n params = fmin(check_dl_model, guess, args=(dxs, dys, stamp))\n print(\"best model parameters are\", params)\n\n hwidth = 300 # width = 2 * hwidth + 1\n cols = np.arange(hwidth, nx, 2 * hwidth)\n cols = cols[1:]\n\n # reference wavelength offsets to the center row\n row = cy\n\n # define a 2D array to hold the wavelength offsets for each pixel\n lambdas = np.zeros(image.shape) \n\n # loop over each central column\n for col in cols:\n print('col = ', col)\n \n # slice the data\n inds = np.s_[:, col - hwidth : col + hwidth]\n stamp = image[inds]\n mask = skymask[inds]\n dys = yvals[inds] - row\n dxs = xvals[inds] - col\n \n # initial fit\n params = fmin(check_dl_model, guess, args=(dxs[mask], dys[mask], stamp[mask]))\n \n # check for outliers\n dls = get_dl_model(guess, dxs, dys)\n x, y, spl = get_profile_spl(dls, stamp)\n model = spl(dls)\n pull = (stamp - model) / np.sqrt(np.abs(model))\n w = (pull < 5) & mask\n params2 = fmin(check_dl_model, params, args=(dxs[w], dys[w], stamp[w]))\n \n # record\n lambdas[inds] = get_dl_model(params2, dxs, dys) + col\n pickle.dump(lambdas, open('lambdas' + str(ext) + '.dat', 'wb'))\n\n # just plot offsets for a few of the rows across the image\n plt.clf()\n order = 2\n for y in range(10, ny, 40):\n p = plt.plot(cols, lambdas[y, cols] - xs[cols], 'o')\n c = np.polyfit(cols, lambdas[y, cols] - xs[cols], order)\n plt.plot(xs, np.polyval(c, xs), c=p[0].get_color(), label='row {}'.format(y))\n\n plt.legend()\n plt.xlabel('Column Number')\n plt.ylabel('Wavelength Offset from Middle Row');\n input('stop')\n return lambdas\n\n#######################################################\n\ndef model_sky(params, dx, counts):\n# wav0, a, b, c, d, scale, c0 = params\n wav0, a, b, scale, c0 = params\n \n dtype = []\n dtype.append(('wav', float))\n dtype.append(('flux', float))\n model = np.zeros(counts.shape, dtype=dtype)\n# model['wav'] = wav0 + a * dx + b * dx**2 + c * dx**3 + d * dx**4\n model['wav'] = wav0 + a * dx + b * dx**2\n model['flux'] = c0 + scale * counts\n \n return model\n\n#######################################################\n\ndef get_sky_difference(params, dx, specdata, skyatlas):\n model = model_sky(params, dx, specdata)\n \n # residual\n res = model['flux'] - skyref_interp(model['wav'])\n \n return np.sum(res**2 / np.sqrt(np.abs(model['flux'])))\n\n#######################################################\n\ndef plot_sky_model(skyref, model):\n plt.plot(model['wav'], model['flux'], label='Extracted Sky Background');\n plt.plot(skyref['wav'], skyref['flux'], label='Reference Sky Spectrum');\n plt.xlim(model['wav'].min(), model['wav'].max());\n plt.ylim(model['flux'].min() - 0.25, model['flux'].max() + 0.25)\n\n plt.xlabel('Wavelength ($\\AA$)')\n plt.ylabel('Scaled Counts or Flux')\n plt.legend();\n\n###########################################\n \ndef trace(img,dictionary, g0=10, g1=85, g2=3, key=3):\n if 'sky' + str(key) in dictionary[img]:\n sky = dictionary[img]['sky' + str(key)].data\n image = dictionary[img]['trimmed' + str(key)].data\n nosky = image - sky\n \n # get the a pixel coordinate near the image center\n ny, nx = image.shape\n cy, cx = ny//2, nx//2\n # create 1d arays of the possible x and y values\n xs = np.arange(nx)\n ys = np.arange(ny)\n # pixel coordinates for each pixel\n yvals, xvals = np.indices(image.shape)\n \n # get the median for each row\n profile = np.median(image - sky, axis=1)\n\n # starting guess for the profile model\n guess = (g0, g1, g2)\n model = get_profile_model(guess, ys)\n\n # fit for the best model\n params = fmin(get_profile_chisq, guess, args=(ys, profile))\n print(\"best fit parameters are\", params)\n\n model = get_profile_model(params, ys)\n\n # fit the profile centered at these columns\n hwidth = 50\n cols = np.arange(hwidth, nx + 1, 2 * hwidth)\n\n ycenter = np.zeros( (len(cols), 2) )\n for icol, col in enumerate(cols):\n stamp = (image - sky)[:, col - hwidth : col + hwidth]\n profile = np.mean(stamp, axis=1)\n params = fmin(get_profile_chisq, guess, args=(ys, profile))\n ycenter[icol, :] = params[[1]]\n \n # fit the relation with a polynomial\n ind = 0 # which trace 0 or 1?\n t_order = 3\n trace_c = np.polyfit(cols, ycenter[:, ind], t_order)\n fig, axarr = plt.subplots(2, sharex=True)\n axarr[0].plot(cols, ycenter[:, ind], 'ro')\n axarr[0].plot(xs, np.polyval(trace_c, xs), 'r')\n axarr[0].axes.set_ylabel('y-coordinate')\n axarr[1].plot(cols, ycenter[:, ind] - np.polyval(trace_c, cols), 'ro')\n axarr[1].axes.set_ylim(-0.5, 0.5)\n axarr[1].axes.set_ylabel('Fit Residual (pixels)')\n plt.xlabel('Column Number');\n input('trace completed')\n\n slitpos = yvals - np.polyval(trace_c, yvals)\n \n dictionary[img]['trace' + str(key)] = slitpos\n dictionary[img]['tracefit' + str(key)] = trace_c\n return dictionary\n\n################################################## \n\ndef extract(img,dictionary, key=3):\n if 'trace' + str(key) in dictionary[img]:\n sky = dictionary[img]['sky' + str(key)].data\n image = dictionary[img]['trimmed' + str(key) ].data\n nosky = image - sky\n \n # get the a pixel coordinate near the image center\n ny, nx = image.shape\n cy, cx = ny//2, nx//2\n # create 1d arays of the possible x and y values\n xs = np.arange(nx)\n ys = np.arange(ny)\n # pixel coordinates for each pixel\n yvals, xvals = np.indices(image.shape)\n \n slitpos = dictionary[img]['trace' + str(key)]\n trace_c = dictionary[img]['tracefit' + str(key)]\n \n # normalize to the pixel brightness at the trace center\n yinds = (np.round(np.polyval(trace_c, xs))).astype(int)\n normed = nosky / nosky[yinds, xs]\n\n # get 1D arrays with the positions along the slit and the normalized counts\n pos = slitpos.flatten()\n counts = normed.flatten()\n \n # sort by slit position\n sort_inds = pos.argsort()\n pos, counts = pos[sort_inds], counts[sort_inds]\n \n # fit a spline to model the spatial profile\n t = np.linspace(pos.min() + 2, pos.max() - 2, ny // 2) # spline knot points\n profile_spl = LSQUnivariateSpline(pos, counts, t)\n\n # remove outliers and re-fit\n diff = counts - profile_spl(pos)\n sample = sigma_clip(diff)\n w = ((np.abs(diff) / sample.std()) < 5) & np.isfinite(diff)\n profile_spl = LSQUnivariateSpline(pos[w], counts[w], t)\n \n # create the profile image\n profile_image = profile_spl(slitpos)\n \n # de-weight negative values in provile_image\n profile_image[profile_image < 0] = 0\n \n # select which rows to sum\n w = (slitpos > -10) & (slitpos < 10)\n ymin, ymax = yvals[w].min(), yvals[w].max()\n \n # calculate the sum\n spec_basic = nosky[ymin:ymax, :].sum(axis=0)\n \n # sky background\n skybg_basic = np.array(sky)[ymin:ymax, :].sum(axis=0)\n \n # calculate the weighted average (for each column)\n spec_opt = (nosky * profile_image)[ymin:ymax, :].sum(axis=0) / profile_image.sum(axis=0)\n \n # calculate the bias factor needed to scale the average to a sum\n bias_factor = np.median(spec_basic / spec_opt)\n spec_opt *= bias_factor\n \n # same for the sky background\n skybg_opt = (sky * profile_image)[ymin:ymax, :].sum(axis=0) / profile_image.sum(axis=0)\n bias_factor_sky = np.median(skybg_basic / skybg_opt)\n skybg_opt *= bias_factor_sky\n skybg_opt -= np.min(skybg_opt)\n \n # plot the extracted spectrum\n plt.clf()\n plt.plot(xs, spec_basic, label='basic extraction')\n plt.plot(xs, spec_opt, label='optimal extraction')\n plt.legend()\n dictionary[img]['spec_basic' + str(key)]= spec_basic\n dictionary[img]['spec_opt' + str(key)]= spec_opt\n dictionary[img]['skybg_opt' + str(key)]= skybg_opt\n input('extraction completed')\n return dictionary\n \n\n################################################## \n\ndef fit_another(xs, cols, hwidths, fitparams, i, plot=True):\n col = cols[i]\n hwidth = hwidths[i]\n \n # find the closest matching index with a valid fit\n inds = np.arange(cols.size)\n w = np.isfinite(fitparams[:, 0]) & (inds != i)\n iref = inds[w][np.argmin(np.abs(inds[w] - i))]\n print(\"reference index is \", iref)\n\n # get the wavelength guess\n if w.sum() == 0:\n print(\"not enough data to make guess...bye!\")\n return\n if w.sum() < 4:\n guess = fitparams[iref, :].copy()\n guess[0] = guess[0] + guess[1] * (cols[i] - cols[iref])\n else:\n if w.sum() > 9:\n order = 3\n elif w.sum() > 6:\n order = 2\n else:\n order = 1\n print(\"order is\", order)\n cwav = np.polyfit(cols[w], fitparams[w, 0], order)\n cdwav = np.polyfit(cols[w], fitparams[w, 1], order)\n cscale = np.polyfit(cols[w], fitparams[w, 3], order)\n guess = (np.polyval(cwav, col), np.polyval(cdwav, col), 0.0, np.polyval(cscale, col), 0.0)\n print(\"guess is\", guess)\n\n w = (xs > (cols[i] - hwidths[i])) & (xs < (cols[i] + hwidths[i]))\n output = fmin(get_sky_difference, guess, args=(xs[w] - cols[i], bgspec[w], skyref)\n , full_output=True, disp=False, maxiter=10000)\n if output[4] == 0:\n fitparams[i, :] = output[0]\n print(output[0])\n\n if plot:\n model = model_sky(output[0], xs[w] - col, bgspec[w])\n plot_sky_model(skyref, model)\n plt.title('Fit to Section {}'.format(i))\n else:\n print(\"fit failed!\")\n \n#######################################################\n# # apply flat \n# if masterflat3 is not False:\n# # get the a pixel coordinate near the image center\n# ny, nx = masterflat3.shape\n# cy, cx = ny//2, nx//2\n# # create 1d arays of the possible x and y values\n# xs = np.arange(nx)\n# ys = np.arange(ny)\n# # pixel coordinates for each pixel\n# yvals, xvals = np.indices(masterflat3.shape)\n# from scipy.interpolate import LSQBivariateSpline, LSQUnivariateSpline\n\n# lambdafit = np.zeros(masterflat3.shape)\n# x = lambdafit.ravel()\n# y = masterflat3.ravel()\n# weights = np.sqrt(np.abs(y)) \n# wsort = x.argsort()\n# x, y, weights = x[wsort], y[wsort], weights[wsort]\n# t = np.linspace(x.min() + 1, x.max() - 1, nx)\n# spl = LSQUnivariateSpline(x, y, t, weights)\n# plt.plot(x, spl(x))\n# plt.xlabel('Wavelength ($\\AA$)')\n# plt.ylabel('Counts');\n# input('stop')\n###############################################################\n \n###############################################################\n" } ]
9
bombaymalayalihalqa/pdf-quran-translations
https://github.com/bombaymalayalihalqa/pdf-quran-translations
8fa23fb2687f3e77e5771d8fbc8658e38265de67
0024a38528453d35c85d897ede49db476734e853
2bc0ed238c95703da9e3b24d01a9af9e94338990
refs/heads/master
2021-01-10T14:18:35.413805
2015-11-09T22:24:56
2015-11-09T22:24:56
44,017,600
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.32608696818351746, "alphanum_fraction": 0.6099033951759338, "avg_line_length": 44.88888931274414, "blob_id": "979fdf4c5e8e14976a7cc596acb828003fcb8e97", "content_id": "3f89f933598c38d6a287d18489a89eced40d4136", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 828, "license_type": "no_license", "max_line_length": 351, "num_lines": 18, "path": "/gentexforquran.py", "repo_name": "bombaymalayalihalqa/pdf-quran-translations", "src_encoding": "UTF-8", "text": "#!/usr/bin/python\ntarget=open('qu.tex','w')\ntrans=open('en.maududi.txt','r')\nsurasize=[7,286,200,176,120,165,206,75,129,109,123,111,43,52,99,128,111,110,98,135,112,78,118,64,77,227,93,88,69,60,34,30,73,54,45,83,182,88,75,85,54,53,89,59,37,35,38,29,18,45,60,49,62,55,78,96,29,22,24,13,14,11,11,18,12,12,30,52,52,44,28,28,20,56,40,31,50,40,46,42,29,19,36,25,22,17,19,26,30,20,15,21,11,8,8,19,5,8,8,11,11,8,3,9,5,4,7,3,6,3,5,4,5,6]\nfor x in range(114):\n target.write(\"\\\\chapter{\\\\surna[%d]}\\n\" %(x+1))\n target.write(\"\\\\centerline{\\\\basmalah}\\n\")\n count=0\n while(count<surasize[x]):\n target.write(\"\\\\flushright{\\\\quranayah[%d][%d]}\\n\" %(x+1,count+1))\n count=count+1\n ab=trans.readline()\n target.write(\"\\\\flushleft{\\lr{\")\n target.write(ab)\n target.write(\"}}\")\n\n\ntarget.close()\n\n\n" }, { "alpha_fraction": 0.7848605513572693, "alphanum_fraction": 0.7848605513572693, "avg_line_length": 16.785715103149414, "blob_id": "18647834ca7f4b2f430d23da920d66919ee57647", "content_id": "44d47517af53855efe9f42ca5e34cbfc123255ff", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Text", "length_bytes": 251, "license_type": "no_license", "max_line_length": 73, "num_lines": 14, "path": "/Readme.txt", "repo_name": "bombaymalayalihalqa/pdf-quran-translations", "src_encoding": "UTF-8", "text": "This is the xelatex compiled pdf for abdulla yusufali's quran translation\n\nen.yusufali.txt contains the translation [www.zekr.org]\n\n\ngentexforquran.py is to be run to generate the tex file\n\n\natlast\n\nxelatex master.tex \n\n\nwill give master.pdf output\n\n\n" } ]
2
ZWLori/models
https://github.com/ZWLori/models
96dbd990abc11f7854bc2c164719786ee5ffc505
b62c24c3a07a09795999553696de95cfdad4d158
2eddc74975a85f3ea30ab26a5edf2d2e1a3ff692
refs/heads/master
2021-08-28T19:43:19.384697
2017-12-13T03:20:45
2017-12-13T03:20:45
113,422,799
0
0
null
2017-12-07T08:21:41
2017-12-07T08:17:31
2017-12-07T02:58:49
null
[ { "alpha_fraction": 0.6808510422706604, "alphanum_fraction": 0.7007092237472534, "avg_line_length": 28.375, "blob_id": "ecf374bec636415fae98917dfca8510dd7de6434", "content_id": "069fc82406eefc8711852d2f67c0c743e2aec9be", "detected_licenses": [ "Apache-2.0" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 705, "license_type": "permissive", "max_line_length": 75, "num_lines": 24, "path": "/research/domain_adaptation/pixel_domain_adaptation/test_tfrecord.py", "repo_name": "ZWLori/models", "src_encoding": "UTF-8", "text": "import tensorflow as tf\nimport numpy as np\n\ndata_path = '/home/wanlu/data/mnist_m.tfrecord'\n\nwith tf.Session() as sess:\n\tfeature = {\n\t\t'train/images/': tf.FixedLenFeature([], tf.string),\n\t\t'train/labels/': tf.FixedLenFeature([], tf.int64)\n\t}\n\n\tfilename_queue = tf.train.string_input_producer([data_path], num_epochs=1)\n\treader = tf.TFRecordReader()\n\t_, serialized_example = reader.read(filename_queue)\n\n\tfeatures = tf.parse_single_example(serialized_example, features=feature)\n\n\timage = tf.decode_raw(features['train/images/'], tf.float32)\n\tlabel = tf.cast(features['train/labels/'], tf.int32)\n\n#\timage = tf.reshape(image, [224,224,3])\n\tprint(label.shape)\n\tprint(image.shape)\n\tprint(\"******Finish******\")\n" }, { "alpha_fraction": 0.6468686461448669, "alphanum_fraction": 0.6572498083114624, "avg_line_length": 33.97618865966797, "blob_id": "d8a71842208c64128d18c8ab1d952e081263e144", "content_id": "a18e7852d0090cd61825725002e2740c444f0dab", "detected_licenses": [ "Apache-2.0" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 5876, "license_type": "permissive", "max_line_length": 94, "num_lines": 168, "path": "/research/domain_adaptation/datasets/dataset_factory.py", "repo_name": "ZWLori/models", "src_encoding": "UTF-8", "text": "# Copyright 2017 Google Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n\"\"\"A factory-pattern class which returns image/label pairs.\"\"\"\n\nfrom __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\n\n# Dependency imports\nimport tensorflow as tf\nimport os\nfrom slim.datasets import mnist\nimport mnist_m\nfrom slim.datasets import dataset_utils\nslim = tf.contrib.slim\n\n\ndef get_dataset(dataset_name,\n split_name,\n dataset_dir,\n file_pattern=None,\n reader=None):\n \"\"\"Given a dataset name and a split_name returns a Dataset.\n\n Args:\n dataset_name: String, the name of the dataset.\n split_name: A train/test split name.\n dataset_dir: The directory where the dataset files are stored.\n file_pattern: The file pattern to use for matching the dataset source files.\n reader: The subclass of tf.ReaderBase. If left as `None`, then the default\n reader defined by each dataset is used.\n\n Returns:\n A tf-slim `Dataset` class.\n\n Raises:\n ValueError: if `dataset_name` isn't recognized.\n \"\"\"\n\n# test model for office dataset\n if dataset_name in ['amazon', 'webcam', 'dslr']: \n if dataset_utils.has_labels(dataset_dir, dataset_name+'_labels.txt'):\n labels_to_names = dataset_utils.read_label_file(dataset_dir, dataset_name+'_labels.txt')\n\n # Allowing None in the signature so that dataset_factory can use the default.\n if reader is None:\n reader = tf.TFRecordReader\n\n _FILE_PATTERN = dataset_name+'_'+split_name+'.tfrecord'\n _NUM_CLASSES = 31\n\n if dataset_name == 'amazon':\n _SPLITS_TO_SIZES = {\n 'train': 1972,\n 'validation': 845\n }\n elif dataset_name == 'webcam':\n _SPLITS_TO_SIZES = {\n 'train': 557,\n 'validation': 238\n }\n \n _ITEMS_TO_DESCRIPTIONS = {\n 'image': 'A colored image of varying height and width.',\n 'label': 'The label id of the image, integer between 0 and 30.',\n }\n\n keys_to_features = {\n 'image/encoded':\n tf.FixedLenFeature((), tf.string, default_value=''),\n 'image/format':\n tf.FixedLenFeature((), tf.string, default_value='jpeg'),\n 'image/class/label':\n tf.FixedLenFeature(\n [], tf.int64, default_value=tf.zeros([1], dtype=tf.int64)),\n }\n\n items_to_handlers = {\n 'image': slim.tfexample_decoder.Image(shape=[32,32,3], channels=3),\n 'label': slim.tfexample_decoder.Tensor('image/class/label'),\n }\n\n decoder = slim.tfexample_decoder.TFExampleDecoder(\n keys_to_features, items_to_handlers)\n\n return slim.dataset.Dataset(\n data_sources=os.path.join(dataset_dir,_FILE_PATTERN),\n reader=reader,\n decoder=decoder,\n num_samples=_SPLITS_TO_SIZES[split_name],\n num_classes=_NUM_CLASSES,\n items_to_descriptions=_ITEMS_TO_DESCRIPTIONS,\n labels_to_names=labels_to_names)\n\n dataset_name_to_module = {'mnist': mnist, 'mnist_m': mnist_m}\n \n if dataset_name not in dataset_name_to_module:\n raise ValueError('Name of dataset unknown %s.' % dataset_name)\n \n return dataset_name_to_module[dataset_name].get_split(split_name, dataset_dir,\n file_pattern, reader)\n\n\ndef provide_batch(dataset_name, split_name, dataset_dir, num_readers,\n batch_size, num_preprocessing_threads):\n \"\"\"Provides a batch of images and corresponding labels.\n\n Args:\n dataset_name: String, the name of the dataset.\n split_name: A train/test split name.\n dataset_dir: The directory where the dataset files are stored.\n num_readers: The number of readers used by DatasetDataProvider.\n batch_size: The size of the batch requested.\n num_preprocessing_threads: The number of preprocessing threads for\n tf.train.batch.\n file_pattern: The file pattern to use for matching the dataset source files.\n reader: The subclass of tf.ReaderBase. If left as `None`, then the default\n reader defined by each dataset is used.\n\n Returns:\n A batch of\n images: tensor of [batch_size, height, width, channels].\n labels: dictionary of labels.\n \"\"\"\n dataset = get_dataset(dataset_name, split_name, dataset_dir)\n print(\"########## dataset_factory ############\" + dataset_name + '_' + split_name)\n provider = slim.dataset_data_provider.DatasetDataProvider(\n dataset,\n num_readers=num_readers,\n common_queue_capacity=20 * batch_size,\n common_queue_min=10 * batch_size)\n [image, label] = provider.get(['image', 'label'])\n\n # Convert images to float32\n image = tf.image.convert_image_dtype(image, tf.float32)\n image -= 0.5\n image *= 2\n\n print(image.shape)\n # Load the data.\n labels = {}\n images, labels['classes'] = tf.train.batch(\n [image, label],\n batch_size=batch_size,\n num_threads=num_preprocessing_threads,\n capacity=5 * batch_size)\n labels['classes'] = slim.one_hot_encoding(labels['classes'],\n dataset.num_classes)\n if dataset_name in ['amazon', 'webcam', 'dslr']:\n images = tf.image.resize_images(images, [32,32])\n\n # Convert mnist to RGB and 32x32 so that it can match mnist_m.\n if dataset_name == 'mnist':\n images = tf.image.grayscale_to_rgb(images)\n images = tf.image.resize_images(images, [32, 32])\n return images, labels\n" } ]
2
Cactusolo/dwstree
https://github.com/Cactusolo/dwstree
9bed99ab42d3d968dae1768f2cf5bbb9df7a613e
e5ff2cae34bff38a2cb845d14aacf3f384aeb65a
21dbff173b1a916cf5c69443b980ca1fddcb1012
refs/heads/master
2020-04-28T05:47:30.719947
2014-03-13T17:53:56
2014-03-13T17:53:56
null
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.6011852622032166, "alphanum_fraction": 0.615342378616333, "avg_line_length": 36.49794387817383, "blob_id": "263f68ff31e86385bb32d85061506abb503fb156", "content_id": "beaa9d3ac539550daa8d1714c984d0ab8be52734", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 9112, "license_type": "no_license", "max_line_length": 102, "num_lines": 243, "path": "/dwstree/icontrasts.py", "repo_name": "Cactusolo/dwstree", "src_encoding": "UTF-8", "text": "#! /usr/bin/env python\n\n# File: icontrasts.py\n# Author: Dylan Schwilk (www.pricklysoft.org)\n# $Date: 2005/03/09 00:31:29 $\n# $Revision: 1.5 $\n# $Source: /home/schwilk/code/python/cactus-pie/nexus/RCS/icontrasts.py $\n# Copyright (C) 2003, 2004, 2005 Dylan W. Schwilk\n# www.pricklysoft.org\n\n# GNU\n# This program is free software; you can redistribute it and/or\n# modify it under the terms of the GNU General Public License\n# as published by the Free Software Foundation; either version 2 \n# of the License, or (at your option) any later version.\n# \n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n# GNU General Public License for more details. \n# \n# You should have received a copy of the GNU General Public License\n# along with this program; if not, write to the Free Software\n# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA\n# 02111-1307, USA.\n\n\"\"\"Module for Felsenstein independent contrasts.\n\"\"\"\n\n__version__ = \"1.5\"\n__author__ = '''Dylan Schwilk'''\n\n\nimport math\nfrom phylotree import PhyloTree\nfrom nexus_doc import NexusDoc\nfrom tree_math import average\n\n\ndef compute_contrasts(tree, matrix, char, adjusted=True, split_char=None):\n \"\"\"Compute independent contrasts for the phylogenetic tree. This\n function returns a lists of contrasts for a single character. It\n assumes that the matrix passed in contains character values\n accessed by tuple: (taxon, char). Reconstructed character values\n are stored in the node's data dictionary accessed by char. values\n in dictionary matrix. Contrasts are returned as a list containing\n normalized contrast for each node in postorder order. Polytomies\n are handled as suggested by Pagel (1992) (with split_char used to\n split children into two groups\"\"\"\n \n result = []\n for node in tree.postorder():\n node.abl = node.bl # add adjusted branch length attribute to each node [TODO: Better way?]\n if node.is_tip() :\n node.data[char] = matrix[(node.label, char)] # put char data in data attribute\n elif node.is_polytomy():\n result.append(_do_polytomy(node,char, adjusted, split_char))\n else :\n result.append(_do_felsenstein(node,char, adjusted))\n return result\n\n\ndef contrasts_matrix(treeDict, CharMatrix, treeList, charList, adjusted=True):\n '''Produces a results matrix of contrasts for every char in\n charlist (by char label, every tree in treeList (by name). Returns a dictionary in\n (tree, char) tuples and the values are lists of contrasts.'''\n results = {}\n for name, tree in treeDict.items():\n for char in charList :\n results[(name, char)] = compute_contrasts(tree,CharMatrix, char, adjusted)\n return results\n \ndef formatMatrix(matrix, treelist, charlist,with_ages=False):\n \"\"\"Produces string formatted for output\"\"\"\n results = ['TREE\\t']\n for c in charlist : results.append('%s\\t' %c)\n if with_ages : results.append('%s' % 'NodeAge')\n results.append('\\n')\n for name,t in treelist.items() :\n nodelist = [x for x in t.postorder() if not x.is_tip()]\n for i, node in enumerate(nodelist):\n results.append(\"%s\\t\" % name )\n for c in charlist :\n results.append( \"%f\\t\" % matrix[(name,c)][i])\n if with_ages :\n L = node.length_to_tips()\n results.append(\"%f\\t\" % ( sum(L) / float(len(L)) ) )\n results.append( '\\n')\n return ''.join(results) \n\n\n##############################################################\n## Local functions\n\ndef mean(values):\n \"\"\"Return the arithmetic average of the values.\"\"\"\n return sum(values) / float(len(values))\n\ndef _do_felsenstein(node, char, adjusted=True):\n \"\"\"Get contrasts for this node. We assume this is a non-terminal\n node with two children.\"\"\"\n\n if adjusted :\n v1,v2 = node.children[0].abl , node.children[1].abl\n else :\n v1 = 1.0; v2 = 1.0\n #extend branch length of this node to create correct variance\n node.abl += (v1 * v2) / (v1 + v2)\n #Save reconstructed value for this node\n node.data[char] = (((1.0/v1)*node.children[0].data[char] \\\n + (1.0/v2)*node.children[1].data[char]))/ (1.0/v1 + 1.0/v2); \n return (node.children[0].data[char] - node.children[1].data[char]) / math.sqrt(v1 + v2)\n\n \ndef _do_polytomy(node, char, adjusted=True, split_char=None):\n \"\"\"Do Felsenstein contrast with Pagel method for polytomies. If\n split_char is supplied, the polytomy is split according to this\n character, rather than the one used for contrasts.\"\"\"\n if not split_char : split_char=char\n sort_by_split_char = lambda n1,n2 : cmp(n1.data[split_char], n2.data[split_char])\n get_char = lambda n : n.data[char]\n get_split_char = lambda n : n.data[split_char]\n children = node.children\n children.sort(sort_by_split_char) \n N = len(children)\n \n middle = N/2\n if N % 2 != 0 : # if odd number of children, assign median according to mean of split_char\n mean = average(map(get_split_char, children))\n if children[middle].data[split_char] > mean :\n middle = (N/2) + 1\n \n\n # get Branch lengths of two groups\n # use branch lengths only if adjusted=True\n if adjusted :\n get_abl = lambda n : n.abl\n v1 = sum(map(get_abl, children[:middle] )) / float(N)\n v2 = sum(map(get_abl, children[middle:] )) / float(N)\n else :\n v1 = 1; v2 =1\n\n node.abl += (v1 * v2) / (v1 + v2)\n \n # get char values for two groups \n c1 = sum(map(get_char, children[:middle])) / float(N)\n c2 = sum(map(get_char, children[middle:])) / float(N)\n \n node.data[char] = (((1.0/v1)*c1 + (1.0/v2)*c2))/ (1.0/v1 + 1.0/v2); \n return (c1 - c2) / math.sqrt(v1 + v2)\n \n \ndef prune_missing_vals(tree, charList, charMatrix) :\n \"\"\"Prune all taxa with missing character data\"\"\"\n prune_list = []\n taxa = map(lambda l : l.label, tree.leaves())\n for c in charList :\n for taxon in taxa :\n if not charMatrix.has_key((taxon,c)) : prune_list.append(taxon)\n tree.prune_taxa(prune_list)\n\n#def _clean(tree) :\n# \"\"\"Delete the extra node attribute abl\"\"\"\n# for node in tree : del node.abl\n\n## Command-line program\n## --------------------\ndef main():\n '''Command line program to read trees and character values from a\n NEXUS file and produce independent contrasts.'''\n from nexus_doc import NexusDoc\n import math, sys\n \n try:\n # Use 2.3 optparse module\n from optparse import OptionParser\n except (ImportError, AttributeError):\n try:\n from optik import OptionParser\n except (ImportError, AttributeError):\n print \"\"\"Needs python 2.3 or Greg Ward's optik module.\"\"\"\n\n \n usage = \"usage: %prog [options] filename\"\n parser = OptionParser(usage=usage, version =\"%prog \" + __version__)\n parser.add_option(\"-c\", \"--characters\", action=\"store\", type=\"string\", \\\n dest=\"chars\", default = 'all', help=\"characters to include (comma separated)\")\n parser.add_option(\"-t\", \"--trees\", action=\"store\", type=\"string\", \\\n dest=\"trees\", default = 'all', help=\"trees to include (comma separated)\")\n parser.add_option(\"-a\", \"--age\", action=\"store_true\", \\\n dest=\"age\", default = 0, help=\"report node ages\")\n parser.add_option(\"-v\", \"--verbose\", action=\"store_true\", \\\n dest=\"verbose\", default = 0, help=\"verbose output\")\n\n\n\n # get options\n (options, args) = parser.parse_args()\n if len(args) == 1 :\n try :\n src = open(args[0]).read()\n except:\n print 'Error in file, %s' % args[0]\n else :\n src = sys.stdin.read()\n\n # verbose output\n if options.verbose :\n log = sys.stdout\n else :\n log = None\n\n nxdoc = NexusDoc(log = log)\n nxdoc.load(src)\n CM = nxdoc.CharMatrix()\n taxa = nxdoc.Taxa()\n characters = nxdoc.CharNames()\n \n if options.chars == 'all' :\n charList = characters\n else :\n charList = options.chars.split(',')\n\n if options.trees == 'all' :\n treesList = nxdoc.TreeNames()\n else :\n treesList = options.trees.split(',')\n\n # Prune trees\n prunedTrees = {}\n # if this gets moved to a module, this must be TD[name].copy() so as not to modify original tree :\n # for name in treesList : prunedTrees[name] = TD[name].copy()\n for name in treesList : prunedTrees[name] = nxdoc.TreeByName(name)\n for name in treesList: prune_missing_vals(prunedTrees[name], charList, CM)\n \n # do contrasts on pruned trees\n if options.verbose : print \"\\nContrasts Matrix:\\n\"\n contrasts = contrasts_matrix(prunedTrees, CM, treesList, charList)\n print formatMatrix(contrasts, prunedTrees, charList, with_ages = options.age)\n\n \nif __name__ == '__main__':\n main()\n" }, { "alpha_fraction": 0.5774134993553162, "alphanum_fraction": 0.5846994519233704, "avg_line_length": 27.842105865478516, "blob_id": "50c4695d03e33a20129686f97d1bf54d4f5e48e3", "content_id": "f906c43fcc7084da37e653cf5881315911518ad4", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 549, "license_type": "no_license", "max_line_length": 46, "num_lines": 19, "path": "/setup.py", "repo_name": "Cactusolo/dwstree", "src_encoding": "UTF-8", "text": "from distutils.core import setup\n\nsetup(\n name='DWSTree',\n version='0.1.0',\n author='Dylan Schwilk',\n author_email='dylan@schwilk.org',\n packages=['dwstree'],\n scripts=['scripts/cladelabel.py'\n 'scripts/dorder.py',\n 'scripts/treematic.py', \n 'scripts/treeutils.py', \n 'scripts/rarefaction.py', \n 'scripts/prune2orders.py'],\n url='https://github.com/dschwilk/dwstree',\n # license='LICENSE.txt',\n description='Phylogenetic tools.',\n long_description=open('README.md').read(),\n) \n" }, { "alpha_fraction": 0.5898919701576233, "alphanum_fraction": 0.6002722978591919, "avg_line_length": 39.94773483276367, "blob_id": "0afdd44175b76fa95e67813dc21aa2e7f7a81679", "content_id": "9ccfec0862be0cd2085aaebe545a1cd464e13787", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 11753, "license_type": "no_license", "max_line_length": 146, "num_lines": 287, "path": "/scripts/rarefaction.py", "repo_name": "Cactusolo/dwstree", "src_encoding": "UTF-8", "text": "#! /usr/bin/env python\n\n# Author: Dylan Schwilk\n# Copyright 2009 Dylan W. Schwilk\n\n# GNU\n# This program is free software; you can redistribute it and/or\n# modify it under the terms of the GNU General Public License\n# as published by the Free Software Foundation; either version 2 \n# of the License, or (at your option) any later version.\n# \n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n# GNU General Public License for more details. \n# \n# You should have received a copy of the GNU General Public License\n# along with this program; if not, write to the Free Software\n# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA\n# 02111-1307, USA.\n\n\"\"\"\nrarefaction.py. Script to do phylogenetic distance by taxonomic diversity\nrarefaction curves. Command line options exist for running. Also check\nconstants defined below (eg root of tree).\n\"\"\"\n\n__version__ = \"1.0\"\n__needs__ = '2.4'\n__author__ = \"Dylan W. Schwilk\"\n__program__ = '''rarefaction.py'''\n__usage__ = '''rarefaction.py [options] [tree_file]'''\n\nfrom dwstree import phylotree, newick\nimport random,logging, math\nimport numpy\nfrom parallel import Parallel, delayed\n#from scipy import linspace, polyval, polyfit, sqrt, stats, randn\nphylo_logger = logging.getLogger('phylo_logger')\n\n### parameters\nMAX_RARE_POINTS=32\nLOG_S_VALUES=10.0**numpy.linspace(0.25,4,MAX_RARE_POINTS) # to get 32 points equally spaced in log space\nS_VALS=[int(i) for i in LOG_S_VALUES]\n\n# print logspace\nNREPS=100 ## number of random td-pd samples per richness\n\n##params for bl exponential explore\nALPHAS=[0.2,0.4,0.6,0.8]\n#ALPHAS=[0.2,0.8]\n\n## defaults -- may be changed by command line scripts\n##params for random resolution explore\nTOPO_REPS=1000# n of randomized topologies (resolutions, bls, etc)\nREROOT_TREE=\"angiosperms\" ## common root for all analyses\nFIXED_INTERCEPT=179.0 # temporary\n\n############################################################################\n# Command line script\n############################################################################\n\ndef linear_reg_old(x,y):\n \"\"\"Linear regression. x and y are numpy arrays\"\"\"\n (ar,br)=numpy.polyfit(x,y,1)\n return(ar,br)\n\ndef linear_reg(x, y):\n \"\"\" returns slope, intercept and r-squared as tuple\"\"\"\n coeffs = numpy.polyfit(x, y, 1)\n\n # r-squared\n p = numpy.poly1d(coeffs)\n # fit values, and mean\n yhat = [p(z) for z in x]\n ybar = sum(y)/len(y)\n ssreg = sum([ (yihat - ybar)**2 for yihat in yhat])\n sstot = sum([ (yi - ybar)**2 for yi in y])\n rsquared = ssreg / sstot\n return (coeffs[0],coeffs[1],rsquared)\n\ndef linear_reg_fixed_intercept(x,y,y0):\n \"\"\"Calculate least squares slope for regression with fixed y intercept =\n y0. x and y should be numpy arrays, y0 should be a scalar. Simple version\n below probably faster.\"\"\"\n xm = numpy.vstack([x, numpy.zeros(len(x))]).T # set up coefficient matrix for numpy.linalg.lstsq\n ynew = y-y0\n coeffs,residuals,rank,s = numpy.linalg.lstsq(xm,ynew)\n return coeffs[0] # just return slope since that is all we estimated\n\ndef linear_reg_fixed2(x,y,y0=0.0):\n \"\"\"Simple slope estimate for fixed regression (regression through origin\"\"\"\n ynew = y-y0\n return sum(x*ynew)/sum(x*x)\n\n\ndef tdpd(tree,taxa,nreps):\n \"\"\"For each value of s, 1 - ntaxa, pull s taxa randomly and calculate pd.\n Repeat nreps times and return numpy vectors for s and pd. There are two\n values of s for which pd is fixed. s=1 (age of tree) and s=len(taxa) (sum\n of branch lengths for tree.\"\"\"\n points = [i for i in S_VALS if i < len(taxa)] # use s values spaced evenly in log space\n #points = range(1,len(taxa)) # use all points\n\n ntaxa = len(taxa)\n if points[-1] != ntaxa: points.append(ntaxa) ## add full richness value if not in logspaced list\n \n alen = nreps*(len(points) -2 ) # start with array shorter by nreps*2 to allow for s=1 and s=ntax at end\n td = numpy.empty(alen)\n pd = numpy.empty(alen)\n\n # THis loop below is where these simulations spend the bulk of their time\n i = 0 \n for s in points[1:-1]: #leave off s=1 and s = ntaxa since no need to call random on those\n for r in range(nreps):\n thetax = random.sample(taxa,s)\n td[i] = s\n pd[i] = tree.pd(thetax)\n #print td[i], pd[i]\n i = i+1\n s0vals = tree.pd(random.sample(taxa,1)) * numpy.ones(nreps) ## create nreps values of pd at s=1, assume altrametric\n s1vals = tree.pd(taxa) * numpy.ones(nreps) ## nreps at s=ntaxa\n\n td = numpy.concatenate( (td, numpy.ones(nreps), numpy.ones(nreps)*ntaxa) )\n pd = numpy.concatenate( (pd, s0vals, s1vals) )\n return (td, pd) \n\ndef reroot(tree, lab):\n for node in tree:\n if node.label == lab:\n tree = node\n tree.parent=None\n return tree\n return None # root not found\n\ndef read_species_from_taxa_file(fname):\n \"\"\"Read tips names from a phylomatic/treematic taxa file. Throws away\n genus,family names per taxon.\"\"\"\n taxa = set()\n try:\n src = open(fname).readlines()\n for l in src :\n l = l.strip()\n l = l.split(\"/\")\n map(lambda x:x.strip(),l)\n taxa.add(l[-1].strip())\n except IOError:\n phylo_logger.error(\"Error reading taxafile, %s\" % options.taxa_file)\n sys.exit()\n return taxa\n\ndef getz(t,tx,reps):\n \"\"\"Just a function to wrap tdpd and following regression together so as to\n have a clean single function to send to parallel processes, etc. Choose\n which regression function to call be commenting out others.\"\"\"\n x,y = tdpd(t,tx,reps)\n# return linear_reg(numpy.log10(x), numpy.log10(y))\n #return linear_reg_fixed_intercept(numpy.log10(x),numpy.log10(y),numpy.log10(FIXED_INTERCEPT))\n return linear_reg_fixed2(numpy.log10(x),numpy.log10(y),numpy.log10(FIXED_INTERCEPT))\n\n\ndef main():\n \"\"\"Command line program.\"\"\"\n import sys \n from optparse import OptionParser\n from branch_lengths import bl_bladj, get_age_dict, node_age_uniform, node_age_exponential, node_age_bladj_original\n\n logging.basicConfig()\n\n parser = OptionParser(usage=__usage__, version =\"%prog \" + __version__)\n parser.add_option(\"-a\", \"--ages-file\", action=\"store\", type=\"string\", \\\n dest=\"ages_file\", default = '', \\\n help=\"node ages file\")\n parser.add_option(\"-t\", \"--taxa\", action=\"store\", type=\"string\", \\\n dest=\"taxa_file\", default = '', help=\"taxa file in format: family/genus/species\")\n parser.add_option(\"-s\",\"--simulation\",action=\"store\", type=\"string\", \\\n help=\"simulation type: NONE | RESOLVE | BLADJ_UNIFORM | BLADJ_EXP. Default = NONE\", dest=\"sim_type\", default=\"NONE\")\n parser.add_option(\"-j\", \"--jobs\", action=\"store\", type=\"int\", \\\n dest=\"njobs\", default = 1, \\\n help=\"Number of jobs for parallel processing. Default = 1\")\n parser.add_option(\"-r\", \"--reps\", action=\"store\", type=\"int\", \\\n dest=\"toporeps\", default = TOPO_REPS, \\\n help=\"Number of replicate simulated phylogenies (resolutions or branch lengths) to explore. Default=%d\" % TOPO_REPS) \n parser.add_option(\"-v\", \"--verbose\", action=\"store_true\", dest=\"verbose\", default=False,\n\t\t\t\t\t help=\"Print INFO messages to stdout, default=%default\") \n\n (options, args) = parser.parse_args()\n\n if options.verbose:\n phylo_logger.setLevel(logging.INFO)\n \n if len(args) == 1 :\n try :\n src = open(args[0]).read()\n except IOError:\n phylo_logger.error(\"Error reading tree file, %s\" % args[0])\n sys.exit()\n else :\n src = sys.stdin.read()\n \n tree = newick.read_trees(src)[0] ## should contain 1 megatree with full\n ## taxa as methods apply branch lengths\n ## and resoltuion before pruning to\n ## species set in taxa file.\n # read taxa from phylomatic-style taxa file\n taxa = read_species_from_taxa_file(options.taxa_file)\n phylo_logger.info(\"Read taxa file with %d taxa\" % len(taxa))\n \n # read the ages file for bladj smoothing\n age_dict = get_age_dict(options.ages_file)\n \n ## reroot to REROOT_TREE (default=angiosperms)\n tree = reroot(tree, REROOT_TREE)\n\n ### do sensitivity analysis according to type\n testtrees = [] #vector of alternative phylogenies\n params = [] # vector of parameters for each phylogeny\n if options.sim_type == \"NONE\":\n bl_bladj(tree, age_dict) # standard bladj\n tree.prune_to_taxa(taxa)\n tree.normalize()\n #print tree\n for i in range(options.toporeps): \n testtrees.append(tree.copy())\n params.append((options.taxa_file, options.sim_type))\n elif options.sim_type == \"RESOLVE\":\n for i in range(options.toporeps):\n ntree = tree.copy()\n ntree.resolve() # random resolution\n bl_bladj(ntree, age_dict) # original bladj\n ntree.prune_to_taxa(taxa)\n ntree.normalize() ## reduce nodes to make traversing faster\n testtrees.append(ntree)\n params.append((options.taxa_file, options.sim_type))\n elif options.sim_type == \"BLADJ_UNIFORM\" :\n for i in range(options.toporeps):\n bl_bladj(tree, age_dict, node_age_uniform)\n tree.prune_to_taxa(taxa)\n tree.normalize() ## reduce nodes to traverse\n testtrees.append(tree.copy())\n params.append((options.taxa_file, options.sim_type)) \n elif options.sim_type == \"BLADJ_EXP\":\n for alpha in ALPHAS:\n for reverse in [False,True]:\n agefunc = lambda start,stop,n : node_age_exponential(start,stop,n,alpha,reverse)\n for i in range(options.toporeps):\n bl_bladj(tree, age_dict, agefunc)\n tree.prune_to_taxa(taxa)\n tree.normalize() ## reduce nodes to traverse\n testtrees.append(tree.copy())\n params.append((options.taxa_file, options.sim_type, alpha, reverse))\n else:\n phylo_logger.error(\"-s options not recognized. Possible simulations \\\n types are NONE (default), RESOLVE, BLADJ_UNIFORM, or BLADJ_EXP\")\n\n ### TEST CODE TO OUTPUT RAW TD-PD bivariate data ###\n if True :\n for i, t in enumerate(testtrees):\n x,y = tdpd(t,taxa,NREPS)\n for q in range(len(x)):\n print \"TREE%s\" % i,\n for p in params[i]: print p,\n print x[q], y[q]\n \n # t.make_pectinate()\n # print t.write(True) + \";\"\n sys.exit()\n\n #Now that inputs are created, run tppd using using mulitprocessing module if njobs > 1\n phylo_logger.info(\"Created %d trees. Starting rarefaction\" % len(testtrees))\n if options.njobs == 1:\n for i,t in enumerate(testtrees):\n for p in params[i]: print p,\n #x,y = tdpd(t,taxa,NREPS)\n #z,b,r = getz(t,taxa,NREPS)\n z = getz(t,taxa,NREPS)\n print z #,b,r \n sys.stdout.flush()\n else:\n results = Parallel(n_jobs=options.njobs)(delayed(getz)(i,taxa,NREPS) for i in testtrees)\n for i, r in enumerate(results) :\n for p in params[i] : print p,\n print r #[0], r[1], r[2]\n \n \nif __name__ == \"\"\"__main__\"\"\":\n main()\n\n" }, { "alpha_fraction": 0.5930680632591248, "alphanum_fraction": 0.6079589128494263, "avg_line_length": 26.5744686126709, "blob_id": "ce9b67bd7ab7cc3c0fb0f272d6535f7698b72731", "content_id": "e098b0228bbf0bd375afb2ece30f530ebef29dbc", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3895, "license_type": "no_license", "max_line_length": 99, "num_lines": 141, "path": "/scripts/cladelabel.py", "repo_name": "Cactusolo/dwstree", "src_encoding": "UTF-8", "text": "#! /usr/bin/env python\n\n# File: cladelabel.py\n# Author: Dylan Schwilk (www.pricklysoft.org)\n# Date: 2005/03/09\n# Copyright 2003, 2004, 2005 Dylan W. Schwilk\n\n# GNU\n# This program is free software; you can redistribute it and/or\n# modify it under the terms of the GNU General Public License\n# as published by the Free Software Foundation; either version 2 \n# of the License, or (at your option) any later version.\n# \n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n# GNU General Public License for more details. \n# \n# You should have received a copy of the GNU General Public License\n# along with this program; if not, write to the Free Software\n# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA\n# 02111-1307, USA.\n\n\n\"\"\"Module for labeling clades\n\n Functions:\n ----------\n\n - label_clade(tree, taxa, clade_name) finds the clade defined\n by the taxa in the list and assigns the name clade_name to the\n clade when found.\n\n - mrca(n1,n2) Finds most resent common ancestor of nodes n1\n and n2\n\n Command line program:\n \n\n\"\"\"\n__version__ = \"1.2\"\n__author__ = '''Dylan Schwilk (www.pricklysoft.org)'''\n__usage__ = '''usage: cladelabel.py clade_label_file [tree_file] '''\n\n\nfrom dwstree.phylotree import PhyloTree\nimport logging\ncactus_logger = logging.getLogger('cactus_logger')\n\n\ndef ancestor_list(n):\n \"\"\"Returns a list of n and its ancestors, starting with the\n current node, (n) and ending with the root of the tree\n \"\"\"\n result = []\n p=n\n while(1):\n result.append(p)\n if p.is_root() : return result\n p = p.parent\n\ndef mrca(n1,n2):\n \"Finds most recent common ancestor of n1, n2\"\n l1 = ancestor_list(n1)\n p=n2\n #print l1\n while(1):\n # print p\n if p in l1 : return p\n if p.is_root() : break\n p = p.parent\n return None\n \n\ndef label_clade(tree, taxa, clade_name):\n \"\"\"Find the clade containing all taxa in taxa list and label with\n name\"\"\"\n leaves = tree.leaves_by_labels(taxa)\n clade = reduce(lambda a,b : mrca(a,b),leaves)\n if clade :\n clade.label = clade_name\n\ndef main():\n '''Command line program. This program reads a nexus file or newick tree file'''\n\n from nexus_doc import NexusDoc\n import newick\n import sys \n from optparse import OptionParser\n\n parser = OptionParser(usage=__usage__, version =\"%prog \" + __version__)\n \n parser.add_option(\"-n\", \"--nexus\", action=\"store_true\", dest=\"nexus\", \n default = 0 , help=\"Read trees from NEXUS file rather than newick tree file\")\n parser.add_option(\"-v\", \"--verbose\", action=\"store_true\", dest=\"verbose\", default=False,\n\t\t\t\t\t help=\"Print INFO messages to stdout, default=%default\") \n\n (options, args) = parser.parse_args()\n if options.verbose:\n cactus_logger.setLevel(logging.INFO)\n \n # Get clade labels\n clade_lines = open(args[0]).read().split('\\n\\n')\n\n # Get trees\n if len(args) == 2 :\n try :\n src = open(args[1]).read()\n except:\n print 'Error in tree file, %s' % args[0]\n sys.exit()\n else :\n src = sys.stdin.read()\n\n if options.nexus:\n nxdoc = NexusDoc(log = None)\n nxdoc.load(src)\n trees = nxdoc.Trees()\n else :\n trees = newick.read_trees(src)\n \n for line in clade_lines:\n name, taxa = line.split(\":\")\n name = name.strip()\n taxa = taxa.split()\n\n for tree in trees:\n label_clade(tree, taxa, name)\n\n if options.nexus:\n print nxdoc\n else :\n for tree in trees:\n print \"%s;\" % tree.write(bl=True)\n\n return 0\n\n\n# Main Test function \nif __name__ == '__main__':\n main()\n\n \n\n" }, { "alpha_fraction": 0.5853472352027893, "alphanum_fraction": 0.5945051908493042, "avg_line_length": 30.19841194152832, "blob_id": "8b9461160d866166e7ae4d6919a754cd27863d3d", "content_id": "a5081ac80b9a7ab365957fcb70cede9dfa3b3c1c", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3931, "license_type": "no_license", "max_line_length": 104, "num_lines": 126, "path": "/scripts/treeutils.py", "repo_name": "Cactusolo/dwstree", "src_encoding": "UTF-8", "text": "#! /usr/bin/env python\n\n# File: treematic.py Author: Dylan Schwilk (www.pricklysoft.org)\n\n# $Date: 2008-04-28$\n\n# Copyright (C) 2008 Dylan W. Schwilk www.pricklysoft.org,\n# Algorithms orginally by Cam Webb\n\n# GNU\n# This program is free software; you can redistribute it and/or\n# modify it under the terms of the GNU General Public License\n# as published by the Free Software Foundation; either version 2 \n# of the License, or (at your option) any later version.\n# \n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n# GNU General Public License for more details. \n# \n# You should have received a copy of the GNU General Public License\n# along with this program; if not, write to the Free Software\n# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA\n# 02111-1307, USA.\n\n\"\"\"Tree utilities\n \n\"\"\"\n\n__version__ = '''1.0'''\n__program__ = '''treeutils.py'''\n__author__ = '''Dylan Schwilk'''\n__usage__ = '''treeutils.py [options] [tree_file]'''\n\n\nfrom dwstree import newick\nfrom dwstree.phylotree import PhyloTree\nimport logging\nlogging.basicConfig(format='\\n%(levelname)s:\\n%(message)s\\n')\nphylo_logger = logging.getLogger('phylo_logger')\n\n\ndef read_taxa(src):\n \"\"\"Read taxa file in phylomatic format\"\"\"\n taxa = []\n for l in src :\n l = l.strip()\n l = l.split(\"/\")\n map(lambda x:x.strip(),l)\n l.reverse() # so species is first\n taxa.append(l)\n return taxa\n \ndef main():\n '''Command line program. '''\n import sys \n from optparse import OptionParser\n\n parser = OptionParser(usage=__usage__, version =\"%prog \" + __version__)\n parser.add_option(\"-t\", \"--taxa\", action=\"store\", type=\"string\", \\\n dest=\"taxa_file\", default = '', help=\"taxa file in format: family/genus/species\")\n parser.add_option(\"-n\", \"--normalize\", action=\"store_true\", dest=\"normalize\", default=False,\n\t\t\t\t\t help=\"Normalize resulting tree (collapse nodes with single child), default=%default\")\n parser.add_option(\"-p\", \"--prune\", action=\"store\", dest=\"prune\", default='',\n\t\t\t\t\t help=\"Prune to taxa in file\")\n parser.add_option(\"-r\", \"--reroot\", action=\"store\", dest=\"reroot\", default='',\n\t\t\t\t\t help=\"Reroot tree at node with label\")\n parser.add_option(\"-v\", \"--verbose\", action=\"store_true\", dest=\"verbose\", default=False,\n\t\t\t\t\t help=\"Print INFO messages to stdout, default=%default\") \n\n (options, args) = parser.parse_args()\n\n if options.verbose:\n phylo_logger.setLevel(logging.INFO)\n \n if len(args) == 1 :\n try :\n src = open(args[0]).read()\n except IOError:\n phylo_logger.error('Error reading tree file, %s' % args[0])\n sys.exit()\n else :\n src = sys.stdin.read()\n\n trees = newick.read_trees(src)\n\n # now get taxa\n if options.taxa_file:\n taxa = read_taxa(open(options.taxa_file))\n \n result = []\n for tree in trees:\n if options.prune:\n try :\n ptaxa = read_taxa(open(options.prune).readlines())\n except IOError:\n phylo_logger.error('Error reading file, %s' % options.prune)\n sys.exit()\n \n ptaxa = [i[0] for i in ptaxa]\n tree.prune_to_taxa(ptaxa)\n \n if options.reroot:\n for node in tree:\n if node.label and node.label==options.reroot:\n tree = node\n tree.bl=0.0\n tree.parent = None\n break\n \n\n if options.normalize:\n tree.normalize()\n result.append(tree)\n \n #result.append(phylomatic(tree,taxa,options.normalize,options.prune))\n\n ## Print results\n for tree in result:\n print \"%s;\" % tree\n return 0\n\n\n\nif __name__== \"__main__\":\n main()\n" }, { "alpha_fraction": 0.5603298544883728, "alphanum_fraction": 0.5907118320465088, "avg_line_length": 27.637500762939453, "blob_id": "7715662fd457f542c2016c3f91201e269129b77b", "content_id": "a9173f49ef492606c856ea251cf8342886587a3b", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2304, "license_type": "no_license", "max_line_length": 124, "num_lines": 80, "path": "/tests/timings.py", "repo_name": "Cactusolo/dwstree", "src_encoding": "UTF-8", "text": "\n\ndef reroot(tree, lab):\n for node in tree:\n if node.label == lab:\n #print \"Found\" , lab\n tree = node\n tree.parent=None\n return tree\n raise lab + \" Not found\"\n \nif __name__==\"\"\"__main__\"\"\":\n\n import timeit\n\n import phylotree\n import newick\n import branch_lengths\n\n\n\n tree = newick.read_trees(open(\"ecol-let-sim/globalphylo\").read())[0]\n #tree = newick.read_trees(open(\"examples/ca-phylo.new\").read())[0]\n ages = branch_lengths.get_age_dict(\"ecol-let-sim/ages.txt\")\n\n\n branch_lengths.bl_one(tree)\n\n ntree = tree.copy()\n\n # print tree\n branch_lengths.bl_bladj(tree, ages)\n\n #print ntree.label\n #print ages[ntree.label]\n branch_lengths.bl_bladj(ntree, ages)\n\n\n #print len(tree.leaves())\n #tree = reroot(tree,\"moraceae\")\n #print tree.label, len(tree.leaves())\n #ntree = reroot(ntree,\"moraceae\")\n\n tree.normalize()\n ntree.normalize()\n\n #print ntree.write(True) + \";\"\n \n old_nodeages = tree.node_ages()\n new_node_ages=ntree.node_ages()\n\n assert len(old_nodeages) == len(new_node_ages)\n \n # for i in range(len(old_nodeages)):\n # if abs(old_nodeages[i][1] - new_node_ages[i][1] ) > 0.001 :\n # print old_nodeages[i][0], old_nodeages[i][1] - new_node_ages[i][1]\n \n \n tbl1 = timeit.Timer(\"branch_lengths.bl_bladj(tree, ages)\", \"from __main__ import tree, ages; import branch_lengths\") \n# tbl2 = timeit.Timer(\"branch_lengths.bl_bladj2(tree, ages)\", \"from __main__ import tree, ages; import branch_lengths\")\n\n print \"bladj1\", tbl1.timeit(5)\n# print \"bladj2\", tbl2.timeit(10)\n \n #print tree\n \n t= timeit.Timer(\"tree.write(True)\",\"from __main__ import tree\")\n t2= timeit.Timer(\"tree.write2(True)\",\"from __main__ import tree\")\n t3= timeit.Timer(\"tree.write3(True)\",\"from __main__ import tree\")\n t4= timeit.Timer(\"tree.write4(True)\",\"from __main__ import tree\")\n\n #print tree.write4(True)\n \n\n# print \"write4\",t4.timeit(1000) \n# print \"write\", t.timeit(1000)\n# print \"write3\",t3.timeit(1000)\n \n# print \"write2\", min(t2.repeat(10,100))\n# print \"write\", min(t.repeat(10,100)) \n# print \"write3\", min(t3.repeat(10,100))\n# print \"write4\", min(t4.repeat(10,100))\n\n \n \n" }, { "alpha_fraction": 0.6120502352714539, "alphanum_fraction": 0.6162599325180054, "avg_line_length": 39.3236083984375, "blob_id": "ec02f5a3c35e00d25512e3474c1703e444d12465", "content_id": "dbbe4cef15f9eb1869b1f83fd15e20676ddf5099", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 15203, "license_type": "no_license", "max_line_length": 113, "num_lines": 377, "path": "/dwstree/nexus_parser.py", "repo_name": "Cactusolo/dwstree", "src_encoding": "UTF-8", "text": "#! /usr/bin/env python\n\n# File: nexus_parser.py\n# Author: Dylan Schwilk (www.pricklysoft.org)\n# Date: 2005/03/09\n# Copyright 2003, 2004, 2005 Dylan W. Schwilk\n\n# GNU\n# This program is free software; you can redistribute it and/or\n# modify it under the terms of the GNU General Public License\n# as published by the Free Software Foundation; either version 2 \n# of the License, or (at your option) any later version.\n# \n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n# GNU General Public License for more details. \n# \n# You should have received a copy of the GNU General Public License\n# along with this program; if not, write to the Free Software\n# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA\n# 02111-1307, USA.\n\n'''\nProvides processors for NEXUS files and NEXUS blocks. The parsers\ninherit from SimpleParse DispatchProcessor.\n'''\n\n__version__ = \"1.3\"\n__author__= \"Dylan Schwilk\"\n\nimport nexus_grammar, mx.TextTools, sys\nfrom nexus_dict import NexusDict # these keeps sequence\nfrom simpleparse.dispatchprocessor import *\n\n# constants\nws = mx.TextTools.set(\" \\t\\n\\r\\'\\\"\")\n\n#Message types\nERROR = \"ERROR\"\nWARNING = \"WARNING\"\nMESSAGE = \"MESSAGE\"\nCOMMENT = \"COMMENT\"\n\n## Exceptions\nclass NexusError(StandardError):\n \"\"\"Base class for exceptions in this module.\"\"\"\n pass\n\nclass InputError(NexusError):\n \"\"\"Exception raised for errors in the input.\n\n Attributes:\n expression -- input expression in which the error occurred\n message -- explanation of the error\n \"\"\"\n\n def __init__(self, expression, message):\n self.expression = expression\n self.message = message\n\n\n# ------------- NexusFile ----------------#\nclass NexusParser( DispatchProcessor ):\n '''Dispatch processor for NEXUS grammar to create a NEXUS file.\n Provides file level dispatcher for taglist produced by\n nexus_gramar.py.\n\n By default, the processor skips all blocks. To process blocks,\n add block names and classes to the the addRecognize() function\n before parsing.'''\n \n def __init__(self, log = sys.stdout, store_unrecognized = True) :\n \n self.store_unrecognized = store_unrecognized\n self.blocks = NexusDict() # add block objects to this list\n self.comments = [] # list of comments found between blocks\n self.log = log # where log output should go\n self.__recognize = {} #dict blocks to recognize \n\n def __repr__(self) :\n '''Represent NEXUS file as a string for file storage'''\n result = ['#NEXUS\\n']\n for key, block in self.blocks.items() :\n if type(block) == type(\"\"):\n result.append(block) # an unrecognized block is stored as a string\n else :\n result.append(self.blocks[key].asString())\n return '\\n'.join(result) \n\n def addRecognize(self, name, block_class):\n self.__recognize[name] = block_class\n\n def logMessage(self, type, message, (start, buffer)):\n if self.log :\n print >> self.log, \"Line %d - %s: %s\" % (lines(0, start, buffer ), type, message)\n \n\n # ------- simpleparse.dispatchprocessor taglist callbacks -----------#\n def block(self, (tag,start,stop,subtags), buffer ):\n '''Check if block name is in dictionary of blocks to process,\n if so dispatch on all commands in block.'''\n\n # first skip past leading comments\n map = multiMap(subtags)\n name = (dispatch(self, map['name'][0] , buffer)).upper()\n if self.__recognize.has_key(name) :\n self.logMessage(MESSAGE, \"Processing block '%s'\" % name, (start, buffer))\n self.blocks[name] = self.__recognize[name](log = self.log) # create new instance of block class\n try :\n dispatchList(self.blocks[name], map['command'], buffer)\n except :\n self.logMessage(ERROR, \"Empty or incorrect block '%s'\" % name, (start, buffer)) \n else :\n self.logMessage(MESSAGE, \"Skipping block '%s'\" % name, (start, buffer))\n if self.store_unrecognized :\n self.blocks[name] = getString((tag,start,stop,subtags), buffer)\n\n\n\n # ------------- Need these calls to process block names ----------------#\n # This does duplicate info in NexusBlock class, though -- cleaner way?\n def word(self, (tag,start,stop,subtags), buffer ):\n '''We need to get the word parts separately because a word can contain comments and strings'''\n return ''.join(dispatchList(self, subtags, buffer))\n\n def word_part(self, (tag,start,stop,subtags), buffer ):\n '''We need to get the word parts separately'''\n return getString((tag,start,stop,subtags), buffer)\n\n def string(self, (tag,start,stop,subtags), buffer ):\n '''Need to fix so that it deals with two quotes'''\n return getString((tag,start+1,stop-1,subtags), buffer)\n\n def name(self, (tag,start,stop,subtags), buffer ):\n return dispatch(self, subtags[0], buffer)\n\n def comment(self, (tag,start,stop,subtags), buffer ):\n '''Comments outside of a block'''\n c = getString((tag,start,stop,subtags), buffer).strip()\n self.comments.append(c)\n # print to log if output comment\n if c[1] in \"!&%/\\@\" :\n self.logMessage(COMMENT, c, (start, buffer))\n return '' # comments stripped from tokens at this level\n\n \n#\n# ------------- BlockProcessor ----------------\n# Base class for nexus blocks\n\nclass BlockProcessor( DispatchProcessor ):\n '''\n Base class dispatch processor for NEXUS block. Provides basic\n facilities. This class is able to recognize simple assignment\n (object definition) commands where assignment is a word or\n number or. All other commands must be defined in the derived\n class. Commands are called according to the following syntax.\n For commands recognized as object assignments::\n\n addAttribute(category, object_name, object_description, has_star = False)\n\n is called. This function should not have to be overridden and simply assingns\n values to the self.objects dictionary. For other assignments, block classes\n should override::\n\n assignObject(self, category, object_name, object_description, format = None, has_star = 0)\n\n For all other commands. doCommand is called which in turn calls the function\n doCOMMANDNAME(list) if such a command exists.\n\n\n At the bare minumum, classes derived from NexusBlock must\n implement any commands that the block is expected to contain. Note that some object\n assignments are not recognized by nexus_parser.py and will end\n up being called as regular commands.'''\n \n\n def __init__(self, blockname, log = sys.stdout) :\n self.log = log # Error output\n self.blockname = blockname\n self.objects = NexusDict() # dict of dicts self.objects[category][object_name] = (object , has_star)\n\n def __repr__(self) :\n '''default representation'''\n r = ['BEGIN ;\\n' % self.blockname]\n for k in self.objects.keys() :\n r.append( '\\n%s %s;\\n' % (k, self.objects[k]))\n r.append('END;\\n')\n return ''.join(r)\n\n def asString (self) :\n return self.__repr__()\n\n # These are the main public functions used by clients:\n def addAttribute(self, category, object_name, object_description, has_star = 0) :\n '''Default implementation just adds object to\n objects[category]. Should work fine for most blocks.''' \n if not self.objects.has_key(category) :\n self.objects[category] = NexusDict()\n self.objects[category][object_name] = object_description\n if has_star : self.objects[category]['DEFAULT'] = object_description\n\n def assignObject(self, category, object_name, object_description, format = None, has_star = 0) :\n '''Handle assignments of type: CATEGORY * NAME = (FORMAT) = description.'''\n self.addAttribute(category, object_name, object_description)\n \n def doCommand(self, command_name, token_list) :\n '''Default implementation calls command do[command_name](token_list).'''\n exec('self.do%s(token_list)' % command_name.upper() )\n\n def getObject(self, cat, name):\n \"\"\"Get object, return None if objects does not exist\"\"\"\n try :\n return self.objects[cat][name]\n except KeyError :\n return None\n\n \n # ------- simpleparse.dispatchprocessor taglist callbacks -----------#\n # These methods will not generally be called by clients, only during\n # dispatch processing\n def command( self, (tag,start,stop,subtags), buffer ):\n '''Process command'''\n dispatchList(self, subtags, buffer)\n\n def simple_assignment(self, (tag,start,stop,subtags), buffer ):\n '''Add object.'''\n\n map = multiMap(subtags)\n category = dispatch(self, map['category'][0], buffer)\n has_star = 0\n if 'star' in map.keys() : has_star = 1\n for t in map['assignment'] :\n n, d = dispatch(self, t, buffer)\n self.addAttribute(category, n, d, has_star = has_star)\n\n def complex_assignment(self, (tag,start,stop,subtags), buffer ):\n has_star = 0\n the_map = singleMap(subtags)\n if 'star' in the_map.keys() : has_star = 1\n format = the_map.get('object_format', None)\n if format : format = dispatch(self, format, buffer)\n cat = dispatch(self, the_map['category'], buffer).upper()\n\n try :\n self.assignObject(cat, dispatch(self, the_map['name'], buffer),\n dispatch(self, the_map['word_token_list'], buffer),\n format = format, has_star = has_star)\n except InputError, e :\n self.logMessage(ERROR, \"Unrecognized input '%s' - %s\" % (e.expression, e.message), (start, buffer))\n\n \n def assignment(self, (tag,start,stop,subtags), buffer ):\n '''Return tuple: name, format, description.'''\n the_map = singleMap(subtags)\n return (dispatch(self, the_map['name'], buffer),\n dispatch(self, the_map['object_description'], buffer))\n\n def object_description(self, (tag,start,stop,subtags), buffer ):\n return dispatch(self, subtags[0], buffer)\n\n def category(self, (tag,start,stop,subtags), buffer ):\n return dispatch(self, subtags[0], buffer)\n\n def name(self, (tag,start,stop,subtags), buffer ):\n '''name is just a word so call on word'''\n return dispatch(self, subtags[0], buffer)\n\n def object_format(self, (tag,start,stop,subtags), buffer ):\n '''format is just a word so call on word'''\n return dispatch(self, subtags[0], buffer)\n \n def other_command( self, (tag,start,stop,subtags), buffer ):\n '''Attempt to call function __do_command with list of results'''\n #ls = []\n cmd = (dispatch(self, subtags[0], buffer)).upper()\n ls = filter(None, dispatchList(self, subtags[1:], buffer)) \n try :\n self.doCommand(cmd, ls)\n except (AttributeError) :\n self.logMessage(ERROR, \"Unrecognized command '%s'\" % cmd, (start, buffer))\n except InputError, e :\n self.logMessage(ERROR,\n \"Command '%s' syntax error at '%s' - %s\" % \\\n (cmd, e.expression, e.message), (start, buffer))\n\n def token_list(self, (tag,star,stop,subtags), buffer ):\n '''return list of tokens.'''\n return filter(None, dispatchList(self, subtags, buffer))\n\n def word_token_list(self, (tag,star,stop,subtags), buffer ):\n '''return list of tokens.'''\n return filter(None, dispatchList(self, subtags, buffer))\n\n def comment(self, (tag,start,stop,subtags), buffer ):\n return ''.join(dispatchList(self, subtags, buffer))\n \n def ignore_comment(self, (tag,start,stop,subtags), buffer ):\n \"Non command comments are returned as emtpy strings\"\n return ''\n\n def command_comment(self, (tag,start,stop,subtags), buffer ):\n '''Default implementation returns empty string.\n Output comments are printed to self.log\n Derived classes should override the comment implementation\n when they need to preserve comments'''\n c = getString((tag,start,stop,subtags), buffer).strip()\n #print >> self.log, 'Line %d - %s' % (lines(0, start, buffer ),c)\n self.logMessage(COMMENT, c, (start, buffer))\n return '' # comments stripped from tokens at this level \n\n\n def word(self, (tag,start,stop,subtags), buffer ):\n '''We need to get the word parts separately because a word can\n contain comments'''\n return ''.join(dispatchList(self, subtags, buffer))\n\n def word_part(self, (tag,start,stop,subtags), buffer ):\n '''We need to get the word parts separately'''\n return getString((tag,start,stop,subtags), buffer)\n\n def safepunct(self, (tag,start,stop,subtags), buffer ):\n '''Return punctuation character.'''\n return getString((tag,start,stop,subtags), buffer) \n\n def punct_no_equal(self, (tag,start,stop,subtags), buffer ):\n '''Return punctuation character.'''\n return getString((tag,start,stop,subtags), buffer)\n \n def tuple(self, (tag,start,stop,subtags), buffer ):\n '''( token ...)'''\n return filter(None, dispatchList(self, subtags, buffer)) # filter eliminates ignore comments\n\n # numbers returned as strings. Client is responsible for converting\n def number(self, (tag,start,stop,subtags), buffer ):\n #return dispatch(self, subtags[0], buffer)\n return (getString((tag,start,stop,subtags), buffer))\n \n## def int(self, (tag,start,stop,subtags), buffer ):\n## return (getString((tag,start,stop,subtags), buffer))\n## #return int(getString((tag,start,stop,subtags), buffer))\n##\n## def float(self, (tag,start,stop,subtags), buffer ):\n## return float(getString((tag,start,stop,subtags), buffer))\n\n\n def star(self, (tag,start,stop,subtags), buffer ):\n return 1\n\n def string(self, (tag,start,stop,subtags), buffer ):\n '''Need to fix so that it deals with two quotes'''\n return getString((tag,start+1,stop-1,subtags), buffer)\n\n\n def logMessage(self, type, message, (start, buffer)):\n if self.log :\n print >> self.log, \"Line %d - %s: %s\" % (lines(0, start, buffer ), type, message)\n\n\n# utility functions for writing nexus files\n\ndef nx_string(s):\n '''Write NEXUS string from number, string or list'''\n if type(s) == type([]) :\n result = ['(']\n for i in s :\n result.append(' %s' % str(i))\n result.append(')')\n return ''.join(result)\n elif type(s) <> type(\"\"):\n s = str(s)\n \n if mx.TextTools.setfind(s, ws) > -1 :\n # TODO: replace ' and \" with '' and \"\"\n return '\"%s\"' % s\n return s\n\n" }, { "alpha_fraction": 0.6663914322853088, "alphanum_fraction": 0.6663914322853088, "avg_line_length": 35.69696807861328, "blob_id": "1a15636f1836c100ef576b1d129314a36403801f", "content_id": "bfd100195c746f005814699b354a25855e137134", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 1211, "license_type": "no_license", "max_line_length": 171, "num_lines": 33, "path": "/README.md", "repo_name": "Cactusolo/dwstree", "src_encoding": "UTF-8", "text": "dwstree\n=======\n\ndwstree provides a python library for reading and writing newick trees and NEXUS files, manipulating phylogenetic trees, and conducting analysis of phylogenies and traits.\n\nCommand-line programs available\n-------------------------------\n\nAll of these modules provide functions/methods and also provide a command-line\ninterface. All of these programs read data in newick (*.new) and/or NEXUS file\nformat. For instructions and a list of options, use the '-h' option when\ncalling the program. For example: type 'python dorder.py -h'.\n\n - icontrasts.py: Calculates independent contrasts.\n - dorder.py: Provides the Divergence Order Test (DOT) and\n Synchronized Changes Test (SvS).\n - branch_lengths.py: Assign branch lengths to a phylogeny\n according to several different possible\n algorithms.\n - cladelabel.py label clades in a phylogeny as defined by a taxa\n list in an auxilary file.\n\n\nLibrary functions\n-----------------\n\nUse the Python help command or browse the code to understand the phylogenetic\ntree functions\n\nInstallation\n------------\n\n> python setup.py install\n" }, { "alpha_fraction": 0.6065656542778015, "alphanum_fraction": 0.631313145160675, "avg_line_length": 27.65217399597168, "blob_id": "5895b8d4525ac9e57299138b14ffec2678d8beb6", "content_id": "fb7f9a790ba2e5795b9eb587ff14537a691e1970", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1980, "license_type": "no_license", "max_line_length": 91, "num_lines": 69, "path": "/dwstree/parsimony.py", "repo_name": "Cactusolo/dwstree", "src_encoding": "UTF-8", "text": "# File: parsimony.py\n# Author: Dylan Schwilk\n# Date: 2005/03/09\n# Copyright 2003, 2004, 2005 Dylan W. Schwilk\n\n# GNU\n# This program is free software; you can redistribute it and/or\n# modify it under the terms of the GNU General Public License\n# as published by the Free Software Foundation; either version 2 \n# of the License, or (at your option) any later version.\n# \n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n# GNU General Public License for more details. \n# \n# You should have received a copy of the GNU General Public License\n# along with this program; if not, write to the Free Software\n# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA\n# 02111-1307, USA.\n\n\"\"\"Module for parsimony state reconstructions\n\n Functions:\n \n\n\"\"\"\n\n__author__ = '''Dylan Schwilk (www.pricklysoft.org)'''\n__version__ = '''$Revision: 1.2 $'''\n\nfrom phylotree import PhyloTree\nfrom tree_math import *\n\ndef linear_parsimony(tree, char, matrix):\n \"\"\"Reconstruct ancester states using linear parsimony\n\n Not yet finished.\n\n \"\"\"\n\n # downpass\n for node in tree.postorder() :\n if node.isTip() :\n node.data[char] = Range(matrix[(node.label,char)], matrix[node.label])\n else :\n node.data[char] = get_range(matrix[node.label], matrix[(node.label,char)]) \n # now for uppass \n for node in tree :\n if not node.isTip():\n assert False # not implemented\n\n\n# def squared_change_parsimony(tree, matrix, char):\n# \"\"\"Squared-change parsimony\"\"\"\n\n# for node in tree.postorder():\n# if node.isTip() :\n# node.data = matrix[(node.label, char)]\n# else :\n# node.data = \n\n\n# Main Test function \nif __name__ == '__main__':\n b = Range((52,170.1))\n a = Range((50.1, 151))\n print a, b\n print get_range(a,b)\n \n" }, { "alpha_fraction": 0.5837104320526123, "alphanum_fraction": 0.5927602052688599, "avg_line_length": 15.884614944458008, "blob_id": "27a650436d6febe794465cc3a662488267475833", "content_id": "92172129e2d7a9bd365cec3601eabfe0cf6bd828", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 442, "license_type": "no_license", "max_line_length": 53, "num_lines": 26, "path": "/scripts/prune2orders.py", "repo_name": "Cactusolo/dwstree", "src_encoding": "UTF-8", "text": "\n\n\nimport newick\nimport phylotree\nimport sys\n\n\nf = sys.argv[1]\n\ntree = newick.read_trees(open(f).read())[0]\n\n\ndef isorder(s):\n if \"_\" in s : return False\n if s[-4:] == \"ales\": return True\n\ndef isfamily(s):\n if \"_\" in s : return False\n if s[-5:] == \"aceae\": return True\n\nfor c in tree:\n if c.label and isorder(c.label): c.children = []\n\nfor c in tree:\n if c.label and isfamily(c.label): c.children = []\n \n\nprint tree, \";\"\n" }, { "alpha_fraction": 0.6037701964378357, "alphanum_fraction": 0.6127468347549438, "avg_line_length": 41.18939208984375, "blob_id": "ee443d3cead040cdcc9b77a00f7b63367312c1c7", "content_id": "78324d364632134f5a0531340fcc0bebc1d87266", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 5570, "license_type": "no_license", "max_line_length": 131, "num_lines": 132, "path": "/dwstree/nexus_grammar.py", "repo_name": "Cactusolo/dwstree", "src_encoding": "UTF-8", "text": "#! /usr/bin/env python\n\n# File: nexus_grammar.py\n# Author: Dylan Schwilk\n# Date: 2005/03/09\n# Copyright 2003, 2004, 2005 Dylan W. Schwilk\n\n# GNU\n# This program is free software; you can redistribute it and/or\n# modify it under the terms of the GNU General Public License\n# as published by the Free Software Foundation; either version 2 \n# of the License, or (at your option) any later version.\n# \n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n# GNU General Public License for more details. \n# \n# You should have received a copy of the GNU General Public License\n# along with this program; if not, write to the Free Software\n# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA\n# 02111-1307, USA.\n\n\n\"\"\"\n:Author: Dylan W. Schwilk\n:Date: 2005/03/09\n\nEBNF grammar and parser for NEXUS file language. For use with\nSimpleParse. This grammar does not try to recognize all constructs but\ndoes more parsing than a simple tokenizer. It will recognize all\nconstructs at least to the 'command' level. But other than simple\nobject assignments, such commands will simple be parsed as a command\nname and a list of tokens. The NexusBlock object is responsible for\ndealing with such commands.\n\nFeatures:\n\n1. Recognizes nested comments\n2. returns adjacent tokens, strings and comments as single word for processor to concatinate, clean\n3. Processor class can decide whether to recognize and save comments, whether to strip\n command comments from tokens, etc\n\n\nLimitations:\n\n1. Does fairly minimal structural parsing/recognition. Simple objects\n are recognized, other commands a parsed as token lists and left to\n the processor. \n \n2. Will not recognize mixed-case 'BEGIN' or END' commands; only easy\n way in simple parse would be to hard-code alternatives\n \n3. There are certainly BUGS! Need to test.\n\"\"\"\n\nfrom simpleparse.parser import Parser\nimport pprint\nfrom simpleparse.common import numbers\n\n\ndec = r'''\nnexus_file := whitespacechar*, NEXUS , whitespacechar+, (comment / block)+ \n<NEXUS> := ! , '#NEXUS' \n\n# --------------- Blocks --------------#\nblock := sep, BEGIN, sep_or_comment, name, sep_or_comment, ';' ,\n sep_or_comment, block_body, sep_or_comment, END, sep_or_comment, ';'\ncommand := simple_assignment / complex_assignment / other_command\nother_command := command_name, (sep_or_comment, token)+ , sep_or_comment , ';'\n>command_name< := word\n>BEGIN< := 'BEGIN' / 'begin'\n>END< := 'END' / 'end' / 'ENDBLOCK' / 'endblock'\n>block_body< := (sep_or_comment, (comment / command))*\n\n# --------------- Tokens --------------#\nname := word\n>token< := nx_number / word / safepunct / comment # This order works!\n>word_token< := word / safepunct / comment # this is to avoid numbers being recognized when not wanted\ntoken_list := (sep_or_comment, token)+\nword_token_list := (sep_or_comment, word_token)+\n>sep< := whitespacechar* # should I allow comments to act as token separators?\n>sep_or_comment< := ( whitespacechar / standalone_comment)*\n<whitespacechar> := [ \\t\\n\\r]\n<ws> := whitespacechar+\nsafepunct := punct_no_equal / [=]\npunct_no_equal := [-()\\\\{}/,:*+<>] # so we can recognize assignments\npunct := safepunct / [][;'\"]\n>nx_number< := number #, ?[wordchars] # nexus words can begin with digits, so number must not end with wordchars\n<wordchars> := -(punct/whitespacechar)\nword_part := wordchars+\nword := string / (word_part / comment / string)+ # comments and strings do not break words!\nstring := dq_string / sq_string\n<dq_string> := '\"', -[\"]* , '\"'\n<sq_string> := ['], ?-['] , (-['] / '\\'\\'' )* , ['], ?-[']\n\n# --------------- Objects ----------------\n# a few object types are explicitly recognized\n# all others can be handled by dispatcher\n# -----------------------------------------\nsimple_assignment := category, sep_or_comment, star?, (sep_or_comment, assignment)+ , sep_or_comment , ';'\ncomplex_assignment := category, (sep_or_comment, star)?, sep_or_comment, name, sep_or_comment,\n ( [(] , object_format, ')' , sep_or_comment)?, '=' , sep_or_comment, word_token_list, sep_or_comment , ';'\nassignment := name, sep_or_comment, '=' , sep_or_comment, object_description+\nobject_description := nx_number / word / tuple\nstar := '*'\ncategory := word\nobject_format := word\ntuple := '(' , sep_or_comment, ( (nx_number / word), sep_or_comment)+ , ')'\n\n# --------------- Comments ----------------\ncomment := sep, (command_comment / ignore_comment)\n>standalone_comment< := comment, whitespacechar # Needed so comments adjacent to tokens are returns as token\ncommand_comment := '[' , [!&%/\\@] , comment_string , ']'\nignore_comment := '[', comment_string , ']'\n<comment_string> := (-[][]+ / nested_comment)*\n<nested_comment> := ('[' , comment_string, ']')\n'''\n\n\n# --------------- The parser ----------------\nparser = Parser(dec,'nexus_file')\n\n# --------------- Test function ----------------\nif __name__ == \"__main__\":\n import sys\n #src = sys.stdin.read()\n src = sys.stdin.read()\n taglist = ( parser.parse( src))\n pprint.pprint(taglist)\n\n print 'Nexus file has %d blocks or out-of-block comments.' % len(taglist[1])\n\n" }, { "alpha_fraction": 0.5236799716949463, "alphanum_fraction": 0.5296000242233276, "avg_line_length": 35.621700286865234, "blob_id": "973f6e8df1648d852f6d3098dff7f696288a48ed", "content_id": "9f3ce3e7eb8442819e120d7d52e9d4af60616121", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 12500, "license_type": "no_license", "max_line_length": 128, "num_lines": 341, "path": "/dwstree/nexus_blocks.py", "repo_name": "Cactusolo/dwstree", "src_encoding": "UTF-8", "text": "#! /usr/bin/env python\n\n# File: nexus_blocks.py\n# Author: Dylan Schwilk (www.pricklysoft.org)\n# $Date: 2005/03/09 00:44:11 $\n# $Revision: 1.2 $\n# $Source: C:\\\\local\\\\dylan\\\\code\\\\python\\\\cactus-pie\\\\nexus\\\\RCS/nexus_blocks.py $\n# Copyright (C) 2003, 2004, 2005 Dylan W. Schwilk (www.pricklysoft.org)\n\n# GNU\n# This program is free software; you can redistribute it and/or\n# modify it under the terms of the GNU General Public License\n# as published by the Free Software Foundation; either version 2 \n# of the License, or (at your option) any later version.\n# \n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n# GNU General Public License for more details. \n# \n# You should have received a copy of the GNU General Public License\n# along with this program; if not, write to the Free Software\n# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA\n# 02111-1307, USA.\n\n\n__version__ = \"0.1\"\n__needs__ = \"2.2\"\n__author__ = \"Dylan W. Schwilk\"\n\n\"\"\"nexus_blocks module\n\n Provides several nexus block classes:\n TreesBlock\n ContinuousBlock\n SetsBlock.\n\"\"\"\n\nfrom nexus_parser import BlockProcessor, NexusError, InputError, nx_string\nimport newick, sys, operator\nfrom nexus_dict import NexusDict\n\n##############################################################################\n## ContinuousBlock\n##############################################################################\nclass ContinuousBlock(BlockProcessor):\n '''CONTINUOUS block.\n\n stores the following data:\n charlabels: list of character labels\n matrix: a dictionary of character data\n '''\n def __init__(self, n = 'CONTINUOUS', log = sys.stdout):\n BlockProcessor.__init__(self, n, log)\n self.objects['MATRIX'] = {} # use regular dictionary here must look up taxa by case sensitive name\n # defaults\n self.objects['FORMAT'] = NexusDict()\n self.objects['FORMAT']['MISSING'] = '?'\n self.objects['FORMAT']['ITEMS'] = ['AVERAGE']\n\n def __repr__(self):\n return self.asString()\n\n def asString(self): \n from nexus_parser import nx_string\n result = [\"BEGIN %s;\\n\" % self.blockname,]\n result.append(self.writeDimensions())\n result.append(self.writeFormat())\n result.append(self.writeCharlabels())\n result.append(self.writeMatrix())\n result.append('END;\\n')\n return ''.join(result)\n\n def writeDimensions(self):\n result = []\n result.append('DIMENSIONS ')\n for dim, num in self.objects['DIMENSIONS'].items():\n result.append(\"%s = %d \" %(dim, num))\n result.append(\";\\n\")\n return ''.join(result)\n\n def writeFormat(self):\n result = [\"FORMAT \",]\n for name, desc in self.objects['FORMAT'].items():\n result.append(\"%s = %s \" %(name, nx_string(desc)))\n result.append(\";\\n\")\n return ''.join(result)\n\n def writeCharlabels(self):\n result = ['CHARLABELS',]\n for i, char in enumerate(self.objects['CHARLABELS']):\n result.append(\" %s [%d]\" % (nx_string(char), i))\n result.append(';\\n')\n return ''.join(result)\n\n def writeMatrix(self):\n result = ['MATRIX\\n',]\n for taxon in self.objects['TAXLABELS']:\n result.append(\"\\t%s\\t\" % nx_string(taxon))\n for char in self.objects['CHARLABELS']:\n value = self.objects['MATRIX'].get((taxon,char), self.objects['FORMAT']['MISSING'] )\n if type(value) == type([]) :\n result.append('(')\n for i in value :\n result.append(str(i))\n result.append(') ')\n else :\n result.append(\"%s\\t\" % str(value)) # number of missing_val\n result.append('\\n')\n result.append(';\\n')\n return ''.join(result)\n\n def __checkCharlabels(self, nc):\n if not self.objects.has_key('CHARLABELS'):\n self.objects['CHARLABELS'] = []\n for i in range(1,nc+1):\n self.objects['CHARLABELS'].append(\"CHAR%d\" % i)\n \n\n def assignObject(self, category, object_name, object_description, format = None, has_star = 0) :\n '''Handle assignments of type: CATEGORY * NAME = (FORMAT) = description.'''\n raise InputError( category, 'Unrecognized object category')\n\n \n # commands\n def doCHARLABELS(self, token_list):\n '''Assign character labels'''\n self.objects[\"CHARLABELS\"] = token_list \n #print token_list\n\n \n def doMATRIX(self, token_list):\n '''Reads MATRIX command.'''\n \n nc = self.objects['DIMENSIONS']['NCHAR'] = int(self.objects['DIMENSIONS']['NCHAR'])\n self.__checkCharlabels(nc)\n\n if self.objects['DIMENSIONS'].has_key('NTAX') :\n self.objects['DIMENSIONS']['NTAX'] = int(self.objects['DIMENSIONS']['NTAX'])\n nitems = len(self.objects['FORMAT']['ITEMS'])\n self.objects['TAXLABELS'] = []\n missing = self.objects['FORMAT']['MISSING']\n \n i = 0\n while i < len(token_list) :\n item = []\n name = token_list[i]\n self.objects['TAXLABELS'].append(name)\n i+=1\n for char in range(nc) :\n if token_list[i] == missing :\n i+=1 # just skip\n elif token_list[i] == '(' :\n # TODO: if there are multiple items, they must not have missing values!\n self.objects['MATRIX'][(name,self.objects[\"CHARLABELS\"][char])] = (map(float,(token_list[i+1:i+1+nitems])))\n i = i+2+nitems # skip past ')'\n else :\n self.objects['MATRIX'][(name,self.objects[\"CHARLABELS\"][char])] = (float(token_list[i]))\n i+=1\n #self.objects['MATRIX'][name]= item\n\n\n\n##############################################################################\n## CactusBlock\n##############################################################################\n\nclass CactusBlock(ContinuousBlock):\n '''CACTUS block.\n\n Inherits from ContinuousBlock and stores\n program preferences in addition to a simple matrix.\n '''\n def __init__(self, n = 'CACTUS', log = sys.stdout):\n ContinuousBlock.__init__(self, n, log)\n\n self.objects['PROPERTIES'] = {\n 'OVERWRITE_CONTINUOUS' : False,\n 'WRITE_BRANCH_LENGTHS' : False,\n 'WRITE_SETS' : True,\n 'CHARSET' : 'CACTUS_CHAR_SET',\n 'TREESET' : 'CACTUS_TREE_SET',\n 'PRUNESET' : 'CACTUS_PRUNE_SET',\n 'PRECISION' : 9}\n\n\n def __repr__(self):\n return self.asString()\n \n def asString(self): \n result = [\"BEGIN %s;\\n\" % self.blockname,]\n\n result.append(self.writeDimensions())\n result.append(self.writeFormat())\n result.append(self.writeCharlabels())\n result.append(self.writeMatrix())\n \n result.append('PROPERTIES ')\n for p, val in self.objects['PROPERTIES'].items():\n result.append(\"%s = %s \" % (p,nx_string(val)))\n result.append(';\\n')\n \n result.append('END;\\n')\n return ''.join(result)\n\n##############################################################################\n## TreesBlock\n##############################################################################\n\nclass TreesBlock(BlockProcessor):\n '''TREES block.\n\n stores the following data:\n object[\"TRANSLATE\"]: a TRANSLATE table\n object[\"TREES\"] a dictionary containing the PhyloTree objects\n '''\n def __init__(self, n = 'TREES', log = sys.stdout):\n BlockProcessor.__init__(self, n, log)\n self.objects[\"TRANSLATE\"] = NexusDict()\n self.objects[\"TREES\"] = NexusDict()\n\n def __repr__(self):\n return self.asString()\n\n def asString(self, with_translate=False): \n \"String representation of TREES block\"\n result = [\"BEGIN %s;\\n\" % self.blockname,]\n # print len(self.objects[\"TREES\"].items())\n \n if with_translate:\n self.make_translate()\n for name, tree in self.objects[\"TREES\"].items():\n tree.relabel_taxa(self.objects[\"TRANSLATE\"])\n result.append(\"TRANSLATE\")\n entries = self.objects[\"TRANSLATE\"].items()\n for tup in entries[:-1]:\n result.append(\"%s\\t%s,\" % tup)\n result.append(\"%s\\t%s\\n;\\n\") % entries[-1]\n #result.append(self.objects[\"TRANSLATE\"].__repr__())\n \n # write the trees\n for name, tree in self.objects[\"TREES\"].items():\n result.append(\"\\tTREE %s = %s;\" %(nx_string(name), tree.write(True)))\n \n result.append(\"END;\")\n return '\\n'.join(result)\n\n def make_translate(self):\n \"\"\"Create translate table\"\"\"\n tips = sum(map(lambda t:t[1].leaves(),self.objects[\"TREES\"].items()),[])\n taxa = map(lambda n:n.label, tips)\n trans = self.objects[\"TRANSLATE\"]\n for t in taxa : trans[t]=\"\"\n count =1\n for name in trans.keys():\n trans[name]= \"%d\" % count\n count += 1\n \n\n def assignObject(self, category, object_name, object_description, format = None, has_star = 0) :\n '''Handle assignments of type: CATEGORY * NAME = (FORMAT) = description.'''\n \n if category == 'TREE' :\n t = newick.create_tree(object_description)\n t.relabel_taxa(self.objects[\"TRANSLATE\"])\n self.objects[\"TREES\"][object_name] = t\n # TODO: record rootedness\n else :\n raise InputError(category, 'Unrecognized object category')\n #print >> self.log, 'Unrecognized object category %s' % category\n \n def doTRANSLATE(self, token_list):\n '''Reads TRANSLATE table.'''\n for i in range(0,len(token_list),3):\n self.objects[\"TRANSLATE\"][ token_list[i] ] = token_list[i+1]\n #print self.objects[\"TRANSLATE\"]\n\n# end: class TreesBlock\n\n##############################################################################\n## ContinuousBlock\n##############################################################################\nclass SetsBlock(BlockProcessor):\n '''SETS block.\n stores sets as list objects.\n to access: self.objects[\"CHARSET\"][\"MYSET\"]\n\n '''\n def __init__(self, n = 'SETS', log=sys.stdout):\n BlockProcessor.__init__(self, n, log=log)\n\n def __repr__(self):\n return self.asString()\n\n def asString(self): \n result = [\"BEGIN %s;\\n\" % self.blockname,]\n for cat, obj in self.objects.items():\n for name, s in obj.items():\n if len(s) > 0 : # don't print empty sets\n result.append(\"%s %s (VECTOR) = \" % (cat, nx_string(name)))\n for i in s :\n result.append(\"%d \" % (i+1))\n result.append(';\\n')\n result.append('END;\\n')\n return ''.join(result)\n \n \n def readSet(self, description, format = \"VECTOR\") :\n \"Read set into list. Maps integer indexes from 1-based to 0-based\"\n try :\n if format.upper() == \"VECTOR\" :\n return map(lambda x : int(x)-1,description)\n else :\n raise InputError(' '.join(description), 'Unrecognized set format: %s' % format)\n except :\n raise InputError(' '.join(description), 'Unrecognized set')\n\n def assignObject(self, category, object_name, object_description, format = None, has_star = 0) :\n '''Handle assignments of type: CATEGORY * NAME = (FORMAT) = description.'''\n self.addAttribute(category, object_name, self.readSet(object_description, format))\n\n\n\n# --------------- Test --------------- #\nif __name__ == '__main__' :\n import nexus_grammar, nexus_parser\n reload(nexus_grammar)\n src = open(sys.argv[1]).read()\n \n nx = nexus_parser.NexusParser()\n \n nx.addRecognize('TREES', TreesBlock)\n nx.addRecognize('CONTINUOUS', ContinuousBlock)\n nx.addRecognize('SETS',SetsBlock)\n\n nexus_grammar.parser.parse(src, processor = nx)\n for k, b in nx.blocks.items():\n print b\n # pass\n\n #print nx.blocks[\"TREES\"]\n\n \n\n \n" }, { "alpha_fraction": 0.6070570945739746, "alphanum_fraction": 0.6162940859794617, "avg_line_length": 32.621116638183594, "blob_id": "d1bc719a1ad27cf82119797a037ff0581a36a514", "content_id": "163bc55c9bbd625b968e9e3b850a6b69e4214831", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 5413, "license_type": "no_license", "max_line_length": 111, "num_lines": 161, "path": "/scripts/treematic.py", "repo_name": "Cactusolo/dwstree", "src_encoding": "UTF-8", "text": "#! /usr/bin/env python\n\n# File: treematic.py Author: Dylan Schwilk\n\n# Date: 2008-04-28\n\n# Copyright 2008 Dylan W. Schwilk \n\n# Algorithm and idea mimics behavior of Cam Webb's phylomatic program\n# (http://phylodiversity.net/phylomatic/). This script may be useful still to\n# someone, but I believe that the current phylomatic web version provides the\n# non-species level tip output as an option now anyway. Note that this script was\n# written in 2008.\n\n\n# GNU\n# This program is free software; you can redistribute it and/or\n# modify it under the terms of the GNU General Public License\n# as published by the Free Software Foundation; either version 2 \n# of the License, or (at your option) any later version.\n# \n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n# GNU General Public License for more details. \n# \n# You should have received a copy of the GNU General Public License\n# along with this program; if not, write to the Free Software\n# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA\n# 02111-1307, USA.\n\n\"\"\"Python implementation of Cam Webb's phylomatic application. Variation allows\nnon species level tips.\n\nAlgorithm and idea mimics behavior of Cam Webb's phylomatic program\n(http://phylodiversity.net/phylomatic/). This script may be useful still to\nsomeone, but I believe that the current phylomatic web version provides the\nnon-species level tip output as an option now anyway. Note that this script was\nwritten in 2008.\n\n\n citation needed!\n\n\"\"\"\n\n__version__ = '''1.1'''\n__program__ = '''treematic.py'''\n__author__ = '''Dylan Schwilk'''\n__usage__ = '''treematic.py [options] [tree_file]'''\n\n\nfrom dwstree import newick\nfrom dwstree.phylotree import PhyloTree\nimport logging\nlogging.basicConfig(format='%(levelname)s: %(message)s')\nphylo_logger = logging.getLogger('phylo_logger')\n\n\ndef phylomatic(mtree,taxa, normalize=False, prune=True):\n '''Run phylomatic replacement algorithm on megatree (mtree) using taxa\n list.'''\n newtree = mtree.copy()\n for taxon in taxa:\n matched = False\n for i, lab in enumerate(taxon): # each taxon list must already be in order species, genus, family, etc\n for node in newtree.postorder():\n if node.label == lab :\n matched = True\n phylo_logger.info(\"FOUND MATCH: \" + node.label)\n toadd = taxon[0:i]\n toadd.reverse()\n n = node\n for t in toadd:\n c = PhyloTree(label=t)\n n.add_child(c)\n #print \"ADDED \", c.label, \" TO \", n.label\n n = c\n break\n if matched : break\n if not matched : phylo_logger.warning(\"NO MATCH: \" + \"/\".join(taxon))\n\n if prune :\n termlist = map(lambda x :x[0], taxa)\n newtree.prune_to_taxa(termlist,normalize=normalize)\n elif normalize :\n newtree.normalize()\n\n return newtree\n\ndef read_taxa_file(f):\n \"\"\"Read taxa file in phylomatic format. Returns list of lists of form:\n [ [species, genus, family], [species2,genus2, family2] ]\"\"\"\n taxa = []\n try :\n for l in open(f).readlines():\n l = l.strip()\n l = l.split(\"/\")\n map(lambda x:x.strip(),l)\n l.reverse() # so species is first\n taxa.append(l)\n except IOError :\n phylo_logger.error('Error reading taxa file, %s' % args[0])\n return taxa\n\n\ndef main():\n '''Command line program. '''\n import sys \n from optparse import OptionParser\n\n parser = OptionParser(usage=__usage__, version =\"%prog \" + __version__)\n parser.add_option(\"-t\", \"--taxa\", action=\"store\", type=\"string\", \\\n dest=\"taxa_file\", default = '', help=\"taxa file in format: family/genus/species\")\n parser.add_option(\"-n\", \"--normalize\", action=\"store_true\", dest=\"normalize\", default=False,\n\t\t\t\t\t help=\"Normalize resulting tree (collapse nodes with single child), default=%default\")\n parser.add_option(\"-f\", \"--full\", action=\"store_false\", dest=\"prune\", default=True,\n\t\t\t\t\t help=\"Output full mega tree (do not prune to taxa list)\")\n parser.add_option(\"-v\", \"--verbose\", action=\"store_true\", dest=\"verbose\", default=False,\n\t\t\t\t\t help=\"Print INFO messages to stdout, default=%default\") \n\n (options, args) = parser.parse_args()\n\n if options.verbose:\n phylo_logger.setLevel(logging.INFO)\n \n if len(args) == 1 :\n try :\n src = open(args[0]).read()\n except IOError:\n phylo_logger.error('Error reading file, %s' % args[0])\n sys.exit()\n else :\n src = sys.stdin.read()\n\n trees = newick.read_trees(src)\n\n # now get taxa\n if options.taxa_file:\n taxa = read_taxa_file(options.taxa_file)\n\n \n\n #for n in trees[0].postorder(): print n.ulabel()\n\n result = []\n for tree in trees:\n result.append(phylomatic(tree,taxa,options.normalize,options.prune))\n\n for tree in result:\n #pass\n print \"%s;\" % tree\n #tree.normalize()\n #print tree.children[0].label\n # if len(node.children)<2 : print node.label\n# print tree.leaves()\n return 0\n\n\n\nif __name__== \"__main__\":\n main()\n" }, { "alpha_fraction": 0.6101153492927551, "alphanum_fraction": 0.6172138452529907, "avg_line_length": 37.58904266357422, "blob_id": "da323447368ea2eb9459221ed7b0dbeedfb5f896", "content_id": "05f1dd7b17f4e20c4314cf1d185d25cf2ff4a762", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 5635, "license_type": "no_license", "max_line_length": 115, "num_lines": 146, "path": "/dwstree/nexus_doc.py", "repo_name": "Cactusolo/dwstree", "src_encoding": "UTF-8", "text": "#! /usr/bin/env python\n\n# File: nexus_doc.py\n# Author: Dylan Schwilk\n# Date: 2005/03/09\n# Copyright 2003, 2004, 2005 Dylan W. Schwilk\n\n# GNU\n# This program is free software; you can redistribute it and/or\n# modify it under the terms of the GNU General Public License\n# as published by the Free Software Foundation; either version 2 \n# of the License, or (at your option) any later version.\n# \n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n# GNU General Public License for more details. \n# \n# You should have received a copy of the GNU General Public License\n# along with this program; if not, write to the Free Software\n# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA\n# 02111-1307, USA.\n\n\"\"\"\n Provides NexusDoc class\n\"\"\"\n\nimport nexus_grammar, sys\nfrom nexus_blocks import TreesBlock, CactusBlock, ContinuousBlock, SetsBlock\nfrom nexus_parser import NexusParser\nfrom copy import copy\n\nclass NexusDoc(NexusParser):\n \"\"\"NEXUS file class for CACTUS documents\n\n This class provides an interface layer between the underlying nexus_parser\n that contains nexus blocks. This will allow easier refactoring of underlying\n data representation while maintaining a consistent interface.\n\n The class has several jobs:\n 1. provide brief get/set functions for data contained in blocks\n (ex: treeSet() rather than\n self.blocks['SETS'].objects['TREESET'][self.Properties()['TREESET']] )\n 2. Provide default data that a cactus program expects so that\n the cactus client program does not need to worry about\n which blocks are present.\n\n \"\"\"\n def __init__(self, log=sys.stdout, use_cactus_block = True):\n NexusParser.__init__(self, log, True)\n self.title = \"\"\n self.addRecognize('TREES', TreesBlock)\n self.addRecognize('CONTINUOUS', ContinuousBlock)\n self.addRecognize('CACTUS', CactusBlock)\n self.addRecognize('SETS', SetsBlock)\n\n self.treeset = []\n self.pruneset = []\n self.charset = []\n self.missing = '?'\n\n def load(self, input):\n try :\n # see if file-like\n input = input.read()\n except:\n pass\n src = nexus_grammar.parser.parse(input, processor = self)\n\n # determine if cactus block is present. If not,\n # get data from continuous block\n if not self.blocks.has_key('CACTUS'):\n if self.blocks.has_key('CONTINUOUS'):\n self.blocks['CACTUS'] = CactusBlock('CACTUS', log=self.log) # empty cactus block \n self.blocks['CACTUS'].objects['FORMAT'] = copy(self.blocks['CONTINUOUS'].objects['FORMAT'])\n self.blocks['CACTUS'].objects['CHARLABELS'] = copy(self.blocks['CONTINUOUS'].objects['CHARLABELS'])\n self.blocks['CACTUS'].objects['TAXLABELS'] = copy(self.blocks['CONTINUOUS'].objects['TAXLABELS'])\n self.blocks['CACTUS'].objects['DIMENSIONS'] = copy(self.blocks['CONTINUOUS'].objects['DIMENSIONS'])\n self.blocks['CACTUS'].objects['MATRIX'] = copy(self.blocks['CONTINUOUS'].objects['MATRIX'])\n else :\n self.blocks['CACTUS'] = CactusBlock('CACTUS', log=self.log) # empty cactus block \n self.missing = self.blocks['CACTUS'].getObject('FORMAT','MISSING')\n\n \n # get sets or assign if they are missing\n if not self.blocks.has_key('SETS') :\n self.blocks['SETS'] = SetsBlock('SETS', log=self.log)\n \n try : \n self.treeset = self.blocks['SETS'].objects['TREESET'][self.Properties()['TREESET']]\n except KeyError :\n self.blocks['SETS'].addAttribute('TREESET',self.Properties()['TREESET'], self.treeset)\n try:\n self.charset = self.blocks['SETS'].objects['CHARSET'][self.Properties()['CHARSET']]\n except KeyError :\n self.blocks['SETS'].addAttribute('CHARSET',self.Properties()['CHARSET'], self.charset)\n try :\n self.pruneset = self.blocks['SETS'].objects['TAXSET'][self.Properties()['PRUNESET']]\n except KeyError :\n self.blocks['SETS'].addAttribute('TAXSET',self.Properties()['PRUNESET'], self.pruneset)\n \n \n def Taxa(self):\n \"Return list of all taxa, or empty list if no Matrix\"\n try :\n return self.blocks['CACTUS'].objects['TAXLABELS']\n except KeyError:\n return []\n\n def Tree(self, i):\n '''Return Tree by number, 1-indexed'''\n try :\n return self.blocks['TREES'].objects['TREES'].items()[i-1][1]\n except IndexError, KeyError :\n return None\n\n def Trees(self):\n return self.blocks['TREES'].objects['TREES'].values()\n\n def TreeByName(self, name):\n return self.blocks['TREES'].objects['TREES'][name]\n\n def TreeNames(self):\n try :\n return self.blocks['TREES'].objects['TREES'].keys()\n except KeyError:\n return []\n\n def CharMatrix(self):\n return self.blocks['CACTUS'].objects['MATRIX'] \n\n def Char(self, i):\n \"Return Character label for number\"\n return self.blocks['CACTUS'].objects['CHARLABELS'][i]\n \n def CharNames(self):\n try :\n return self.blocks['CACTUS'].objects['CHARLABELS']\n except KeyError:\n return []\n\n def Properties(self):\n return self.blocks['CACTUS'].objects['PROPERTIES']\n\n# Operations\n# ----------\n\n" }, { "alpha_fraction": 0.5122520327568054, "alphanum_fraction": 0.5195602774620056, "avg_line_length": 31.25, "blob_id": "0332fbc9e1ee06e9b434e6d90d110d8799730df0", "content_id": "7a2085fe74039a77abc84cd4a77e2e59e1e251cb", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 16283, "license_type": "no_license", "max_line_length": 99, "num_lines": 504, "path": "/dwstree/phylotree.py", "repo_name": "Cactusolo/dwstree", "src_encoding": "UTF-8", "text": "#! /usr/bin/env python\n\n# File: phylotree.py\n# Author: Dylan Schwilk (www.pricklysoft.org)\n# $Date: 2006/09/14 04:37:50 $\n# $Revision: 1.3 $\n# $Source: /home/schwilk/code/python/cactus-pie/nexus/RCS/phylotree.py $\n# Copyright (C) 2003, 2004, 2005 Dylan W. Schwilk\n# www.pricklysoft.org\n\n# GNU\n# This program is free software; you can redistribute it and/or\n# modify it under the terms of the GNU General Public License\n# as published by the Free Software Foundation; either version 2 \n# of the License, or (at your option) any later version.\n# \n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n# GNU General Public License for more details. \n# \n# You should have received a copy of the GNU General Public License\n# along with this program; if not, write to the Free Software\n# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA\n# 02111-1307, USA.\n\n\"\"\"\nPhyloTree module.\n\nProvides n-ary tree data structure with functions to facilitate phylogenetic\nanalyses. Design emphasizes simplicity over generality and assumes one is\nworking on rooted trees.\n\nSome ideas for this class (but no code) came from Rick Ree's Mavric\nPython package (http://bioinformatics.org/mavric/) but I opted not to\nuse the Felsenstein linked list approach (FNode), althought such an\napproach allows non-recursive pre-order traversal.\n\"\"\"\n\n__version__ = \"1.5\"\n__needs__ = '2.4'\n__program__ = '''treematic.py'''\n__author__ = '''Dylan Schwilk'''\n__usage__ = '''phylotree.py [options] [tree_file]'''\n\n\nimport copy\nimport logging\nimport random\nphylo_logger = logging.getLogger('phylo_logger')\n\n######################################################################\n# Class: PhyloTree\n######################################################################\nclass PhyloTree:\n \"\"\"Tree class.\n\n A tree is simply a handle to a node. Each node contains:\n - bl: branch length\n - label : the label\n - parent: a ref to the node's parent\n - children: list of node's children\n \"\"\"\n \n def __init__(self, parent=None, bl = 0.0, label = None):\n self.parent = parent\n self.children = []\n self.label = label\n self.bl = bl\n\n def __iter__(self):\n \"\"\"The standard preorder traversal iterator.\"\"\"\n yield self\n for subtree in self.children :\n for child in subtree :\n yield child\n\n def __repr__(self) :\n return self.write(True)\n \n def delete(self) :\n if self.parent :\n self.parent.children.remove(self) \n for subtree in self:\n del subtree\n del self\n \n def postorder(self):\n \"\"\"Postorder traversal of a tree.\"\"\"\n for subtree in self.children:\n for child in subtree.postorder():\n yield child\n yield self\n\n def postorder_list(self):\n \"\"\"returns postorder list of nodes\"\"\" \n r = []\n for n in self.postorder():\n r.append(n)\n return r\n\n def preorder_list(self):\n \"\"\"returns preorder list of nodes\"\"\" \n r = []\n for n in self:\n r.append(n)\n return r\n \n def copy(self) :\n '''Deep copy of tree.'''\n if self.is_tip() :\n return copy.copy(self)\n else :\n newnode = copy.copy(self)\n newnode.children = []\n for subtree in self.children :\n newnode.add_child(subtree.copy())\n return newnode\n\n def ulabel(self):\n '''Returns the node label if it exists or an entire newick tree string\n (without branch lengths) to uniquely identify a node'''\n if self.label: return self.label\n else : return self.write(False)\n \n def labelize(self):\n ''' Adds an automatic label to any node that lacks a label'''\n n=0\n for node in self:\n if not node.label:\n node.label = \"node%d\" %n\n n = n+1\n \n def nodes_to_tips(self, vect=None, n=0):\n \"\"\"return a list of how many internodes are between node and its\n leaves \"\"\"\n if vect == None: vect = [] \n if self.is_tip():\n vect.append(n)\n else:\n for child in self.children:\n child.nodes_to_tips(vect, n+1)\n return vect\n\n def length_to_tips(self, vect=None, length=0.0):\n \"\"\"return a list of total lengths between node and its leaves\"\"\"\n if vect == None:\n vect = []\n node_length = 0.0\n else:\n node_length = self.bl #or 1.0\n\n if self.is_tip():\n vect.append(length+node_length)\n else:\n for child in self.children:\n child.length_to_tips(vect, length+node_length)\n return vect\n\n def node_ages(self):\n \"\"\"returns list of node ages for nodes in postorder order. Uses maximum \n age if tips are non-contemporaneous\n \"\"\"\n ages = []\n for node in self.postorder():\n L = node.length_to_tips()\n ages.append((node.label,max(L)))\n return ages\n\n def distance_to_root(self):\n \"\"\"Returns distance from node to the root\"\"\"\n if not self.parent is None:\n return self.parent.distance_to_root() + self.bl\n else:\n return 0\n \n\n def sum_bl(self, include_root=False) :\n \"\"\"Sum branch lengths in tree\"\"\"\n result = 0\n for node in self:\n result += node.bl\n if include_root :\n return result\n else :\n return result - self.bl\n\n # def pd2(self, l, include_root=False):\n # \"\"\"calculate phylogenetic distance (total bl) for a set of taxa in l\"\"\"\n # inodes = set()\n # result = 0.0\n # for node in self.postorder():\n # if (node in inodes) or (node.label in l) and not node.parent is None:\n # result = result + node.bl\n # inodes.add(node.parent)\n # if include_root: result = result + self.bl\n # return result\n \n def pd(self,l):\n \"\"\"calculate phylogenetic distance (total bl) for a set of taxa in l\"\"\"\n inodes = set()\n result = 0.0\n for ch in self.children:\n for node in ch.postorder():\n if (node in inodes) or (node.label in l):\n result = result + node.bl\n inodes.add(node.parent)\n return result\n \n def is_root(self) :\n return self.parent is None\n\n def is_tip(self) :\n return not self.children\n\n def is_polytomy(self):\n return len(self.children) > 2\n\n def add_child(self, child):\n \"\"\"Add child to parent\"\"\"\n child.parent = self\n self.children.append(child)\n\n def unlink_child(self, child):\n \"\"\"Unlink a child from parent and delete child.\"\"\"\n self.children.remove(child)\n del(child)\n\n def descendants(self):\n \"\"\"Returns a list of all descendants of this node.\"\"\"\n d = []\n if not self.is_tip():\n d.append(self)\n for child in self.children:\n if child.is_tip(): d.append(child)\n else: d=d+child.descendants()\n return d\n\n def leaves(self):\n \"\"\"Returns a list of leaf nodes that are descendant from this\n node. Returns a list, is not an iterator to allow modifying tree.\n \"\"\"\n lvs = []\n if not self.is_tip():\n for child in self.children:\n if child.is_tip(): lvs.append(child)\n else: lvs = lvs+child.leaves()\n else : lvs.append(self)\n return lvs\n\n def leaves_by_labels(self, labels):\n \"\"\"returns list of tips that match labels in labels.\"\"\"\n lvs = []\n for node in self:\n if node.is_tip() and node.label in labels:\n lvs.append(node)\n return lvs \n\n def resolve(self):\n \"\"\"Resolves polytomies to arbitrary zero-length bifurcating branches\"\"\"\n for node in self:\n random.shuffle(node.children)\n while len(node.children) > 2 :\n newnode = PhyloTree(bl = 0)\n newnode.add_child(node.children.pop())\n newnode.add_child(node.children.pop())\n node.add_child(newnode)\n \n def di2multi(self,tol=1e-08):\n '''Collapse multichotomies. tol is a numeric value giving the tolerance\n to consider a branch length significantly greater than zero.'''\n for node in self:\n for child in self.children:\n if child.bl < tol:\n child.collapse()\n\n \n # def collapse(self) :\n # \"Delete node and add node's children to parent. Does not relabel\"\n # assert not self.is_tip()\n # assert not self.is_root()\n # for subtree in self.children :\n # self.parent.add_child(subtree)\n # self.parent.bl += self.bl\n # self.parent.unlink_child(self)\n # del self\n\n def normalize(self):\n \"\"\"Removes all nodes with only one child. Current version can move root.\"\"\"\n for node in self.postorder_list(): # can't use generator\n if len(node.children) == 1 : \n thechild = node.children[0]\n if node.is_root(): # we can't delete root because that is handle to the whole tree\n # We need to keep self reference to root so copy child here\n for gc in thechild.children:\n node.add_child(gc)# give single child's children to root\n gc.bl += thechild.bl\n node.unlink_child(thechild) # delete original single child \n \n else : # add the thechild to its grandparent, delete current node\n thechild.bl += node.bl # extend to account for deleting this node\n node.parent.add_child(thechild)\n node.parent.unlink_child(node)\n return\n \n \n def prune_taxa(self, l, normalize=False) :\n \"\"\"Prunes taxa in set or list l from tree. Use a set.\"\"\"\n for n in self.leaves():\n if n.label in l :\n p = n.parent\n p.unlink_child(n)\n while p.is_tip():\n p.parent.unlink_child(p)\n p = p.parent\n if normalize:\n self.normalize()\n\n def prune_to_taxa(self, l, normalize=False) :\n \"\"\"Prunes tree leaving taxa in set or list l from tree\"\"\"\n for n in self.leaves():\n if n.label not in l :\n p = n.parent\n p.unlink_child(n)\n while p.is_tip():\n p.parent.unlink_child(p)\n p = p.parent\n if normalize:\n self.normalize() \n\n\n \n def write(self, bl=False):\n result = ''\n if self.children :\n l = len(self.children)\n result = \"(\"\n for i in range(l) : \n if i < l-1 : result = result + self.children[i].write(bl) + ','\n else : result = result + self.children[i].write(bl)\n result = result + ')'\n if self.label :\n result += self.label\n if bl : # and self.parent : # root is allowed to have bl\n result += ':%g' % self.bl\n return result\n\n \n def write2(self,bl=False):\n if self.children :\n r = [\"(\", \",\".join(map(lambda x: x.write(bl), self.children)),\")\"]\n else :\n r = []\n if self.label :\n r.append(self.label)\n if bl :\n r.append(\":%g\" % self.bl)\n return \"\".join(r)\n \n def write3(self,bl=False):\n if self.children :\n r = \"(\"\n for c in self.children[:-1]:\n r += c.write(bl) +\",\"\n r += self.children[-1].write(bl) + \")\"\n else :\n r = \"\"\n if self.label :\n r+=self.label\n if bl :\n r+=\":%g\" % self.bl\n return r\n \n def make_pectinate(self):\n \"\"\"\n Order descendant branches according to their size, so largest\n subtrees are first. For branches with equal number of\n children, order by label.\n\n TODO: provide reverse sort. Solved: Easiest to make_pectinate then use\n reverse()\n \"\"\"\n def sort_func(n1, n2):\n if n1.is_tip() and n2.is_tip():\n #return 0 # could have it ignore labels\n return cmp(n1.label, n2.label)\n else:\n n1lvs = n1.leaves()\n n2lvs = n2.leaves()\n l1 = len(n1lvs)\n l2 = len(n2lvs)\n if l1 > l2:\n return -1\n elif l1 == l2:\n #return 0\n lab1 = map(lambda x:x.label, n1lvs); lab1.sort()\n lab2 = map(lambda x:x.label, n2lvs); lab2.sort()\n return cmp(lab1, lab2)\n elif l1 < l2:\n return 1\n\n # now the actual sort\n for node in self.postorder_list():\n node.children.sort(sort_func)\n\n def reverse(self) :\n '''Reverse order of all nodes.'''\n for child in self.children:\n if not child.is_tip() : child.reverse()\n self.children.reverse()\n\n\n def relabel_taxa(self, thedict):\n '''relabels tips by translating from dictionary.'''\n for l in self.leaves():\n l.label = thedict.get(l.label,l.label) # default is just to keep old label\n\n\n## End: PhyloTree class\n######################################################################\n\n\n\n######################################################################\n## Utility functions\n######################################################################\n\ndef equivalent(a, b, with_bl = False):\n \"\"\"Tests for equivalent trees.\n This is useful for eliminating topologically equivilant trees,\n for example, in implementing a function such as PAUP's\n 'condense trees.'\n \"\"\"\n pa = a.copy()\n pb = b.copy()\n pa.make_pectinate()\n pb.make_pectinate()\n return __clade_equiv(pa,pb, with_bl)\n\n\ndef count_polytomies(tree):\n count = 0\n for n in tree:\n if len(n.children) > 2 : count = count+1\n return count\n\n \n\n######################################################################\n## Private Utility functions\n######################################################################\n\ndef __clade_equiv(a,b, with_bl = False):\n '''Assumes both clades are sorted by pectinate. Private.'''\n if a.is_tip() and b.is_tip():\n if a.label != b.label : return False\n else : return True\n else :\n if len(a.children) == len(b.children) :\n for i in range(len(a.children)):\n if not __clade_equiv(a.children[i],b.children[i],with_bl):\n return False\n else :\n return False\n return True\n\n\nif __name__ == \"__main__\":\n '''Command line program. '''\n import sys\n import newick\n from optparse import OptionParser\n\n parser = OptionParser(usage=__usage__, version =\"%prog \" + __version__)\n parser.add_option(\"-v\", \"--verbose\", action=\"store_true\", dest=\"verbose\", default=False,\n\t\t\t\t\t help=\"Print INFO messages to stdout, default=%default\") \n\n (options, args) = parser.parse_args()\n\n if options.verbose:\n phylo_logger.setLevel(logging.INFO)\n \n if len(args) == 1 :\n try :\n src = open(args[0]).read()\n except IOError:\n phylo_logger.error('Error reading file, %s' % args[0])\n sys.exit()\n else :\n src = sys.stdin.read()\n\n trees = newick.read_trees(src)\n\n\n for tree in trees:\n p = count_polytomies(tree)\n print \"N polytomies\", p\n\n t = len(tree.leaves())\n n = len(tree.descendants())+1\n\n print \"Taxa: %d, Nodes: %d\" % (t,n)\n #tree.normalize()\n #print tree.write(True) + \";\"\n \n\n \n \n\n\n\n \n\n" }, { "alpha_fraction": 0.5402963757514954, "alphanum_fraction": 0.5417419672012329, "avg_line_length": 32.31325149536133, "blob_id": "dc6c3555c66514ecd66fe0e3ae6d81957124aaf5", "content_id": "f6fb2f22ea2cc553b7c359bf25be5f3de8f5252b", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2767, "license_type": "no_license", "max_line_length": 78, "num_lines": 83, "path": "/dwstree/nexus_dict.py", "repo_name": "Cactusolo/dwstree", "src_encoding": "UTF-8", "text": "######################################################\n# NexusDict Class\n######################################################\n\nclass NexusDict(dict):\n \"\"\"Dictionary, that has case-insensitive keys.\n Dictionary also maintains order of items.\n \n Keys are retained in their original form\n when queried with keys() or items().\n\n Implementation: Inherites from dict. All key lookups are done\n against the uppercase keys, but all methods that expose keys to\n the user retrieve the original keys.\"\"\"\n \n def __init__(self,*args,**kwargs):\n \"\"\"Inherit from dict, store values as (key,value) pairs. Store\n uppercase keys in _fields\"\"\"\n dict.__init__(self,*args,**kwargs)\n self._fields = []\n\n def __getitem__(self, key):\n \"\"\"Retrieve the value associated with 'key' (in any case).\"\"\"\n return dict.__getitem__(self,key.upper())[1]\n\n def __setitem__(self, key, value):\n \"\"\"Associate 'value' with 'key'. If 'key' already exists, but\n in different case, it will be replaced.\"\"\"\n k = key.upper()\n dict.__setitem__(self, k, (key, value))\n if not self.has_key(key):\n self._fields.append(k)\n\n def __delitem__(self,key) :\n key = key.upper()\n try:\n dict.__delitem__(self, key)\n except KeyError:\n pass\n try:\n self._fields.remove(key)\n except ValueError:\n pass\n \n def has_key(self, key):\n \"\"\"Case insensitive test if 'key' exists.\"\"\"\n k = key.upper()\n return k in self._fields\n\n def keys(self):\n \"\"\"List of keys in their original case.\"\"\"\n return [dict.__getitem__(self,key.upper())[0] for key in self._fields]\n\n def values(self):\n \"\"\"List of values.\"\"\"\n return [dict.__getitem__(self,key.upper())[1] for key in self._fields]\n \n\n def items(self):\n \"\"\"List of (key,value) pairs.\"\"\"\n return [dict.__getitem__(self,key.upper()) for key in self._fields]\n\n def get(self, key, default):\n \"\"\"Retrieve value associated with 'key' or return default value return\n default\"\"\"\n return dict.get(self, key.upper(), default)[1]\n \n\n def setdefault(self, key, default):\n \"\"\"If 'key' doesn't exists, associate it with the 'default' value.\n Return value associated with 'key'.\"\"\"\n if not self.has_key(key):\n self[key] = default\n return self[key]\n\n def __repr__(self):\n \"\"\"String representation of the dictionary.\"\"\"\n items = \", \".join([(\"%r: %r\" % (k,v)) for k,v in self.items()])\n return \"{%s}\" % items\n\n def __str__(self):\n \"\"\"String representation of the dictionary.\"\"\"\n return repr(self)\n\n\n" }, { "alpha_fraction": 0.5636075735092163, "alphanum_fraction": 0.5849156379699707, "avg_line_length": 37.225807189941406, "blob_id": "22acccb6b5f4407496b303a79c20c1fad97b5e09", "content_id": "28efad120d6edd901d3961a05cd9541c19c52946", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 9480, "license_type": "no_license", "max_line_length": 98, "num_lines": 248, "path": "/scripts/dorder.py", "repo_name": "Cactusolo/dwstree", "src_encoding": "UTF-8", "text": "#! /usr/bin/env python\n\n# File: dorder.py\n# Author: Dylan Schwilk (www.pricklysoft.org)\n# $Date: 2008/04/18 19:08:16 $\n# $Revision: 1.1 $\n# $Source: /home/schwilk/code/python/dwstree/dorder.py,v $\n# Copyright (C) 2003, 2004, 2005 Dylan W. Schwilk www.pricklysoft.org\n\n# GNU\n# This program is free software; you can redistribute it and/or\n# modify it under the terms of the GNU General Public License\n# as published by the Free Software Foundation; either version 2 \n# of the License, or (at your option) any later version.\n# \n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n# GNU General Public License for more details. \n# \n# You should have received a copy of the GNU General Public License\n# along with this program; if not, write to the Free Software\n# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA\n# 02111-1307, USA.\n\n\"\"\"A module for divergence order and synchronized changes tests.\"\"\"\n\n__usage__ = \"\"\"usage: dorder.py [options] char1 char2 test [nexus_filename]\n possible values for 'test' :\n sync --- synchronized changes (SvS) test\n div-age --- divergence age test\n print-ages --- simply prints list of contrast magnitudes and divergence ages\"\"\"\n\n__version__ = \"1.1\"\n__author__ = '''Dylan Schwilk'''\n__program__ = '''dorder'''\n\nfrom dwstree.icontrasts import compute_contrasts, prune_missing_vals\nfrom dwstree.tree_math import weighted_average, sample_rep\nimport logging\nphylo_logger = logging.getLogger('phylo_logger')\n\n# statistical tests\ndef sync_change_test(tree, matrix, char1, char2, \\\n nrand = 1000, s_contrasts=False, rand_tips=False):\n \"\"\"Synchronous change test. This tests the significance of the\n SvS statistic for two characters. Returns a tuple: SvS, expected\n SvS and P-value.\"\"\"\n \n c1 = map(abs, compute_contrasts(tree, matrix, char1, s_contrasts, char1))\n c2 = map(abs, compute_contrasts(tree, matrix, char2, s_contrasts,char1))\n obs_svs = SvS(c1,c2)\n\n lower_count = 0\n svs_list = []\n for i in range(nrand):\n if rand_tips :\n rtree = get_randomized_tree(tree)\n r1 = map(abs, compute_contrasts(rtree, matrix, char1, s_contrasts,char1))\n r2 = map(abs, compute_contrasts(rtree, matrix, char2, s_contrasts,char1))\n else :\n r1 = sample_rep(c1)\n r2 = sample_rep(c2)\n rand_svs = SvS(r1,r2)\n svs_list.append(rand_svs)\n if rand_svs <= obs_svs : lower_count = lower_count + 1\n P = lower_count\n exp = sum(svs_list) / float(nrand)\n return obs_svs, exp, float(P) / float(nrand)\n\ndef div_age_test(tree, matrix, char1, char2, \\\n nrand = 10000, s_contrasts=False, rand_tips=False):\n \"\"\"compares weighted average of contrasts age for two characters.\n Results returned are mean1, mean2, observed diff, expected diff, p-value\"\"\"\n if len(tree.leaves()) < 3 : return 0,0,0,0\n\n c1 = map(abs, compute_contrasts(tree, matrix, char1, s_contrasts,char1))\n c2 = map(abs, compute_contrasts(tree, matrix, char2, s_contrasts,char1))\n ages = tree.node_ages()\n m1 = weighted_average(ages, c1)\n m2 = weighted_average(ages,c2)\n\n # now do sig testing\n rlist = []\n count= 0\n obs_diff = m1-m2\n for i in range(nrand):\n if rand_tips :\n rtree = get_randomized_tree(tree)\n r1 = map(abs, compute_contrasts(rtree, matrix, char1, s_contrasts,char1))\n r2 = map(abs, compute_contrasts(rtree, matrix, char2, s_contrasts,char1))\n else :\n r1 = sample_rep(c1)\n r2 = sample_rep(c2)\n \n rm1 = weighted_average(ages, r1)\n rm2 = weighted_average(ages, r2)\n r_diff = rm1-rm2\n rlist.append(r_diff)\n if obs_diff > r_diff : count = count+1\n exp = average(rlist)\n p = float(count) / float(nrand)\n return m1,m2,obs_diff,exp,p\n\n##########################################################################\n# Other functions\n##########################################################################\n\ndef divergence_ages(tree, matrix, char1, char2, s_contrasts=False):\n c1 = map(abs,compute_contrasts(tree, matrix, char1, s_contrasts,char1))\n c2 = map(abs,compute_contrasts(tree, matrix, char2, s_contrasts,char1))\n a = tree.node_ages()\n #assert len(a) == len(c1)\n return zip(c1,c2,a)\n #for i in range(len(a)):\n # print \"%f\\t%f\\t%f\" % (c1[i],c2[i],a[i])\n\n\n# functions for above tests\n\ndef SvS(c1, c2):\n \"\"\"return SvS statistic.\n Algorithm according to description by David Ackerly.\n Input should be absolute values of contrasts\"\"\"\n mid_c1 = average(c1) # average or median or midpoint?\n mid_c2 = average(c2)\n Q1 = 0.0; Q2 = 0.0 # use floating point\n for i in range(len(c1)):\n if c1[i] >= mid_c1 :\n if c2[i] < mid_c2 : Q1 += 1.0\n elif c2[i] >= mid_c2 : Q2 += 1.0\n else :\n if c2[i] >= mid_c2 : Q1 += 1.0\t \n return Q1 / (Q1+Q2)\n\ndef get_randomized_tree(tree):\n \"\"\"Returns new tree, randomizes taxon labels with replacement. Old tree is unchanged\"\"\"\n result = tree.copy()\n lvs = result.leaves()\n labels = map(lambda n:n.label, lvs)\n rlabels = sample_rep(labels)\n for i, l in enumerate(lvs):\n l.label = rlabels[i]\n return result\n \n## Command-line program\n## --------------------\ndef main():\n '''Command line program to read trees and character values from a NEXUS\n file and produce test results.'''\n from nexus_doc import NexusDoc\n from optparse import OptionParser\n import sys \n\n\n parser = OptionParser(usage=__usage__, version =\"%prog \" + __version__)\n parser.add_option(\"-t\", \"--trees\", action=\"store\", type=\"string\", \\\n dest=\"trees\", default = 'all', help=\"trees to include (comma separated)\")\n# parser.add_option(\"-o\", \"--one-tailed\", action=\"store_true\", dest=\"one_tailed\", \\\n# default = 1 , help=\"Do one-tailed significance tests\")\n parser.add_option(\"-r\", \"--replicates\", action=\"store\", type=\"int\", \\\n dest=\"NRand\", default = 1000, help=\"Number of randomizations\")\n parser.add_option(\"-s\", \"--standardized-contrasts\", action=\"store_true\", dest=\"s_contrasts\", \\\n default = 0 , help=\"Standardize contrasts by branch lengths\") \n parser.add_option(\"-i\", \"--randomize-tips\", action=\"store_true\", dest=\"rand_tips\", \\\n default = 0 , help=\"Do randomization of tips rather than contrasts\") \n parser.add_option(\"-v\", \"--verbose\", action=\"store_true\", \\\n dest=\"verbose\", default = 0, help=\"verbose output\")\n\n\n # get options\n (options, args) = parser.parse_args()\n if len(args) == 4 :\n try :\n src = open(args[3]).read()\n except IOError:\n phylo_logger.error('Error in file, %s' % args[0])\n sys.exit()\n elif len(args) == 3 :\n src = sys.stdin.read()\n else :\n p = {}\n p['prog'] = __program__\n print __usage__ % p\n sys.exit()\n char1 = args[0]; char2 = args[1]; test = args[2]\n \n # verbose output\n if options.verbose :\n log = sys.stdout\n else :\n log = None\n\n nxdoc = NexusDoc(log = log)\n nxdoc.load(src)\n CM = nxdoc.CharMatrix()\n taxa = nxdoc.Taxa()\n characters = nxdoc.CharNames()\n \n if options.trees == 'all' :\n treesList = nxdoc.TreeNames()\n else :\n treesList = options.trees.split(',')\n\n if options.verbose : print \"\\nTest Results - using characters %s, %s\\n\" % (char1, char2)\n\n # Prune trees\n prunedTrees = {}\n # if this code section gets moved to a module, this must be\n # TD[name].copy() so as not to modify original tree :\n #for name in treesList : prunedTrees[name] = nxdoc.TreeByName(name).copy()\n for name in treesList : prunedTrees[name] = nxdoc.TreeByName(name)\n for name in treesList:\n #branch_lengths.topo_bl(prunedTrees[name])\n prune_missing_vals(prunedTrees[name], [char1,char2], CM)\n\n \n if test == \"sync\" :\n # do test on pruned trees\n print \"Tree\\tSvS\\tExp_SvS\\tP\"\n for name in treesList :\n tree = prunedTrees[name]\n print \"%s\\t\" % name, \n print \"%f\\t%f\\t%f\" % sync_change_test(tree, CM, char1, char2, \\\n options.NRand, options.s_contrasts)\n elif test == \"div-age\" :\n print \"Tree\\tWMean1\\tWMean2\\tObsDiff\\tExpDiff\\tp\"\n for name in treesList :\n tree = prunedTrees[name]\n m1,m2,obs_diff, exp,p = div_age_test(tree, CM, char1, char2, \\\n options.NRand, options.s_contrasts, options.rand_tips)\n if not options.verbose :\n print \"%s\\t%f\\t%f\\t%f\\t%f\\t%f\" % (name,m1,m2,obs_diff, exp,p)\n\n elif test == \"print-ages\" :\n print \"Tree\\t%s\\t%s\\tnode_age\" % (char1, char2)\n for name in treesList :\n tree = prunedTrees[name]\n results = divergence_ages(tree, CM, char1, char2, options.s_contrasts)\n for line in results :\n print name,\n print \"\\t%f\\t%f\\t%f\" % line\n else :\n print \"Unknown test type. Choose among 'sync', 'div-age', and 'print-ages'\"\n \n \nif __name__ == '__main__':\n main()\n" }, { "alpha_fraction": 0.5523200631141663, "alphanum_fraction": 0.5748106241226196, "avg_line_length": 24.245508193969727, "blob_id": "8dac719a03b916abe6384e77271bc64a2024d26b", "content_id": "892154870fe0d6d8666dea6670dcba7eb26bb419", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 4224, "license_type": "no_license", "max_line_length": 82, "num_lines": 167, "path": "/dwstree/tree_math.py", "repo_name": "Cactusolo/dwstree", "src_encoding": "UTF-8", "text": "#! /usr/bin/env python\n\n# File: tree_math.py\n# Author: Dylan Schwilk (www.pricklysoft.org)\n# Date: 2005/03/09\n# Copyright 2003, 2004, 2005 Dylan W. Schwilk\n\n# GNU\n# This program is free software; you can redistribute it and/or\n# modify it under the terms of the GNU General Public License\n# as published by the Free Software Foundation; either version 2 \n# of the License, or (at your option) any later version.\n# \n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n# GNU General Public License for more details. \n# \n# You should have received a copy of the GNU General Public License\n# along with this program; if not, write to the Free Software\n# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA\n# 02111-1307, USA.\n\n\n\"\"\"Module for math functions\n\n Functions:\n - sample_rep\n - sample_wr\n - midpoint\n - median\n - average\n\"\"\"\n\n__version__ = \"$Revision: 1.2 $\"\n__author__ = '''Dylan Schwilk (www.pricklysoft.org)'''\n\nimport random\nimport itertools\nfrom copy import copy\n\ndef sample_rep(population, k=None):\n \"Chooses k random elements (with replacement) from a population\"\n n = len(population)\n if not k : k = n\n _random, _int = random.random, int # speed hack \n result = [None] * k\n for i in xrange(k):\n j = _int(_random() * n)\n result[i] = population[j]\n return result\n\ndef sample_wr(population, k):\n \"Chooses k random elements (with replacement) from a population\"\n n = len(population)\n _random, _int = random.random, int # speed hack \n return [_int(_random() * n) for i in itertools.repeat(None, k)]\n\n\n\n\n##def sample_rep(l, N=None):\n## \"return list of same lengthof length N sampling with replacement\"\n## if not N : N = len(l)\n## result = []\n## for i in range(N): result.append(random.choice(l))\n## return result\n \ndef midpoint(l):\n return float(min(l)+max(l))/2.0\n \ndef median(l):\n l2 = copy(l)\n l2.sort()\n N = len(l2)\n if N % 2 == 0 :\n return (l2[N/2] + l2[N/2+1]) / 2.0\n else :\n return l2[N/2]\n\ndef average(l):\n return sum(l) / float(len(l))\n \ndef weighted_average(l, weights):\n \" Return weighted avereage of l\"\n wa = [i*j for i, j in zip( l, weights)] \n return sum(wa) / sum(weights)\n\n\nclass Quadratic:\n \"\"\"Holds a, b and c parameters to a quadratic function.\"\"\"\n def __init__(self, a = 0, b= 0, c=0) :\n self.a = float(a)\n self.b = float(b)\n self.c = float(c)\n\n def __repr__(self):\n return \"%fx^2 + %fx + %f = 0\" % (self.a, self.b, self.c)\n\n def solve(self) :\n \"\"\"Returns two roots of the quadratic function\"\"\"\n from math import sqrt\n root = sqrt(self.b*self.b - 4.0*self.a*self.c)\n return (-self.b + root) / (2.0*self.a) , (-self.b - root) / (2.0*self.a)\n\n def dsolve(self):\n \"\"\"returns the solution to the derivative of the quadratic\"\"\"\n return self.b / (-2.0*self.a)\n\nclass Range:\n def __init__(self, seq=None):\n if seq:\n self.min, self.max = min(seq), max(seq)\n\n def __repr__(self):\n return \"(%s,%s)\" % (str(self.min) , str(self.max))\n\n def add(self, num) :\n if seq:\n self.max = max(num, self.max) \n self.min = min(num, self.min) \n else :\n self.min = num\n self.max = num\n \n\ndef intersect(a,b) :\n return Range(max(a.min,b.min), min(a.max,b.max))\n\n\ndef median_of_3(a,b,c) :\n \"\"\"Return median of three numbers\"\"\"\n if max(a,b,c) == a :\n return max(b,c)\n elif min(a,b,c) == a : \n return min(b,c)\n else :\n return a\n\ndef get_range(r1,r2) :\n \"\"\" \"\"\"\n x = median_of_3(r1.min, r1.max, r2.min)\n y = median_of_3(r2.max, r2.min, r1.max)\n return Range( (min(x,y), max(x,y)) )\n\n\n\ndef main():\n b = Range((52,170.1))\n a = Range((50.1, 151))\n print a, b\n print get_range(a,b)\n\n\n q = Quadratic(3,7,1)\n print q\n print q.solve()\n print q.dsolve()\n\n x = q.solve()[1]\n assert q.a*(x*x) + q.b*x + q.c == 0.0\n\n \n# Main Test function \nif __name__ == '__main__':\n\n main()\n \n \n" }, { "alpha_fraction": 0.5761476159095764, "alphanum_fraction": 0.6045523881912231, "avg_line_length": 39.9532470703125, "blob_id": "0b0dcc35100d6a62945369f2514b9b1529eec62d", "content_id": "2e4de0cb94dec3634291e48a524ca4d5fd28b40a", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 15772, "license_type": "no_license", "max_line_length": 794, "num_lines": 385, "path": "/dwstree/branch_lengths.py", "repo_name": "Cactusolo/dwstree", "src_encoding": "UTF-8", "text": "#! /usr/bin/env python\n\n# File: branch_lengths.py\n# Author: Dylan Schwilk and Helene Morlon\n# 2008-09-18\n\n# Copyright 2003, 2004, 2005, 2008 Dylan W. Schwilk and Helene Morlon\n\n# GNU\n# This program is free software; you can redistribute it and/or\n# modify it under the terms of the GNU General Public License\n# as published by the Free Software Foundation; either version 2 \n# of the License, or (at your option) any later version.\n# \n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n# GNU General Public License for more details. \n# \n# You should have received a copy of the GNU General Public License\n# along with this program; if not, write to the Free Software\n# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA\n# 02111-1307, USA.\n\n\n\"\"\"Module for branch length manipulations\n\n Tree argument to all functions must provide the interface of a PhyloTree.\n\n TODO: list functions and usage.\n \n\"\"\"\n\n__version__ = \"3.0\"\n__program__ = '''branch_lengths.py'''\n__author__ = ['''Dylan Schwilk''','''Helene Morlon''']\n__usage__ = '''branch_lengths.py [options] [tree_file]'''\n\nimport numpy\n\nimport newick\nimport logging, random, math\nphylo_logger = logging.getLogger('phylo_logger')\n\n### utility functions\ndef _rand_truncated_exp(lambd, x0):\n \"\"\" Random number generator: returns truncated exponential deviate with\n mean at 1.0 /lambd and truncated at x0\"\"\"\n return -1.0/lambd*math.log(1.0 - random.random() * (1.0-math.exp(-lambd*x0)))\n\n## Node age distribution functions\n## These functions are passed to bladj smoothing function\ndef node_age_bladj_original(start,stop,n):\n \"\"\"Returns node ages by original (non-stochastic) bladj algorithm\"\"\"\n dist = stop-start\n return [start+(i+1)*dist/(n+1) for i in range(n)]\n\ndef node_age_uniform(start,stop, n):\n \"\"\"Returns n node ages (breakpoints on line start -- stop).\"\"\"\n return sorted([random.uniform(start,stop) for i in range(n)])\n\ndef node_age_exponential(start, stop, n, alpha, reverse=False):\n \"\"\"Returns n node ages (breakpoints on line start -- stop) according to a\n truncated exponential distribution with mean = alpha*(stop-start), so lamda\n = (1/alpha)(stop-start). If reverse is true, origin of exponential pdf is\n ancestor age rather than descendant. So positive alpha values push undated\n nodes toward tips, negative values push toward root.\"\"\"\n dist = stop-start\n #lambd = dist*1.0/alpha\n if reverse :\n return sorted([stop - _rand_truncated_exp(1.0/(alpha*dist),dist) for i in range(n)])\n else :\n return sorted([start + _rand_truncated_exp(1.0/(alpha*dist),dist) for i in range(n)])\n\n## public functions\ndef bl_ages(tree, ages=None):\n \"\"\"\"Transform ages stored in ages dict to branch lengths. Dictionary must\n have a key for every node ulabel (including tips)\"\"\"\n if ages:\n for node in tree.postorder():\n if not node.is_tip():\n for child in node.children:\n child.bl = ages[node.ulabel()] - ages[child.ulabel()]\n else :\n for node in tree.postorder():\n if not node.is_tip():\n for child in node.children:\n child.bl = node.age - child.age\n \ndef bl_one(tree):\n \"\"\"Set all branch lengths to one. Root set to zero\"\"\"\n for node in tree :\n if node.is_root():\n node.bl=0.0\n else :\n node.bl=1.0\n\ndef bl_grafen(tree):\n \"\"\"Set branch lengths according to Grafen method where\n node height is proportional to number of descendants. Root set to zero.\n \"\"\"\n # total_height = len(tree.descendants()) # Should I normalize?\n for node in tree:\n if node.is_root() :\n node.bl=0\n else :\n node.bl = float(len(node.parent.descendants()) - len(node.descendants())) #/ total_height\n\ndef bl_topo(tree):\n \"\"\"Sets branch lengths according to topo method (macclade view)\n where node height is proportional to the maximum number of nodes\n descendant. Root bl set to zero.\"\"\"\n height = lambda n : max(n.nodes_to_tips())\n # total_height = height(tree)\n for node in tree :\n if node.is_root() :\n node.bl=0\n else :\n node.bl = float(height(node.parent) - height(node)) #/ total_height\n\ndef bl_bladj(tree, age_dict, age_dist_func = node_age_bladj_original, all_tips_zero=False):\n \"\"\"Set node ages according to bladj algorithm and fixed nodes. Root age\n must be fixed in ages_dict. This version allows using bladj on trees with\n tips that are not species, i.e allows for assigning branch lengths before\n pruning trees. This function will modify the tree topology if all_tips_zero\n is False, not merely branch lengths because it will delete entire branches\n that lack any fixed node age information. Based on the description of Cam\n Webb's bladj algorithm in phylocom and email discussions with Cam.\n\n Notes on version2: Function now accepts an \"age distribution function\" to\n set unfixed node ages between two known age nodes. The default,\n `_node_age_bladj_original` behaves as original: ages are evenly spaced\n between known ages. Other functions can produce other distributions (such\n as stochastic uniform or truncated exponential. Distribution function\n should return list of ages ordered from DESCENDANT to ANCESTOR ---\n increasing positive values. )\n\n Function modifies tree, but not age_dict. Does not return a value.\n \"\"\"\n # assign known ages .. For now, store temp ages in .age data member of each node.\n for node in tree:\n if age_dict.has_key(node.label):\n node.age = age_dict[node.label]\n elif node.is_tip() :\n if all_tips_zero or \"_\" in node.label:\n node.age = 0.0\n else :\n node.age = None\n else :\n node.age = None\n\n if tree.age is None : raise(ValueError(\"Error in bladj: root node must have a fixed age\"))\n _prune_unaged_tips(tree) ## get rid of unageable regions of tree\n\n # main loop to find unaged nodes\n for node in tree :\n if node.age is None : # only work on non fixed nodes\n #assert(not node.is_tip()) # Should never have unaged tip.\n \n # Find descendent with fixed age nearest in age to this node's parent \n fd = _fixed_descendants(node) # list of all line-of-sight descendents with fixed age\n \n mindist = node.parent.age - fd[0].age \n minindex = 0\n i = 1\n while i < len(fd):\n dist = node.parent.age - fd[i].age\n if dist == mindist : # We've found equivalent fixed descendents\n if len(_nodes_to_fixed_parent(fd[i].parent)) \\\n < len(_nodes_to_fixed_parent(fd[minindex])):\n minindex=i # we choose shortest intervening node distance if age dist is same\n elif dist < mindist: \n mindist = dist\n minindex = i\n i += 1\n \n desc_age = fd[minindex].age # winning node, closest fixed age\n tofix = _nodes_to_fixed_parent(fd[minindex])\n\n # set node ages:\n new_ages = age_dist_func(desc_age,node.parent.age,len(tofix))\n for i,f in enumerate(tofix):\n f.age = new_ages[i]\n\n bl_ages(tree) # assign the new branch lengths via the node age method\n \n###############################################################\n# private functions\n\ndef get_age_dict(filename):\n \"\"\"Read fixed ages from text\"\"\"\n f = open(filename)\n a_dict= {}\n ages = f.readlines()\n f.close()\n for line in ages :\n clade, age = line.split()\n clade = clade.strip()\n age = float(age.strip())\n a_dict[clade] = age\n return a_dict\n\ndef _prune_unaged_tips(tree):\n \"\"\"Remove all lineages with no fixed ages\"\"\"\n prunelist = map(lambda y: y.label , filter(lambda x: x.age is None, tree.leaves()))\n #print prunelist\n tree.prune_taxa(prunelist)\n\n \ndef _fixed_descendants(node, vect=None):\n \"\"\" Returns list of descendants that have ages fixed in age_dict \"\"\"\n if vect == None: vect = []\n if not node.age is None:\n vect.append(node)\n return vect\n else:\n for child in node.children:\n _fixed_descendants(child,vect)\n return vect\n\ndef _nodes_to_fixed_parent(node):\n \"\"\"return a vector containing all ancestor nodes excluding most recent ancestor with fixed age\n \"\"\"\n vect = []\n par = node.parent\n while par.age is None :\n vect.append(par)\n par = par.parent\n return vect\n\ndef reroot(tree, lab):\n for node in tree:\n if node.label == lab:\n tree = node\n tree.parent=None\n return tree\n return None # root not found\n\n############################################################################\n# Command line script\n############################################################################\n\ndef main():\n '''Command line program. Main argument to script is a tree file in newick\n format (or in NEXUS format if the -n option is used). The script performs one of the\n branch length algorithms on all the trees in that file and prints the changed\n file.'''\n import sys \n from optparse import OptionParser\n logging.basicConfig()\n\n parser = OptionParser(usage=__usage__, version =\"%prog \" + __version__)\n parser.add_option(\"-n\", \"--nexus\", action=\"store_true\", dest=\"nexus\", \\\n default = 0 , help=\"Read trees from NEXUS file rather than newick tree file\") \n parser.add_option(\"-t\", \"--topo\", action=\"store_true\", dest=\"topo\", \\\n default = 0 , help=\"Set branch lengths by MacClade method\") \n parser.add_option(\"-o\", \"--one\", action=\"store_true\", dest=\"one\", \\\n default = 0 , help=\"Set branch lengths to one\") \n parser.add_option(\"-g\", \"--grafen\", action=\"store_true\", dest=\"grafen\", \\\n default = 0 , help=\"Set branch lengths by grafen method\") \n parser.add_option(\"-s\", \"--smooth\", action=\"store\", type=\"string\", \\\n dest=\"ages_file\", default = '', \\\n help=\"Smooth ages between fixed nodes according to bladj algorithm using ages in file\")\n parser.add_option(\"-u\", \"--uniform\", action=\"store_true\", dest=\"uniform_age_dist\", default = 0, \\\n help=\"Distribute unknown ages by random uniform distribution. requires -s option.\")\n parser.add_option(\"-e\", \"--exponential\", action=\"store\", dest=\"exp_age_dist\", type=\"float\", default = 0, \\\n help=\"Distribute unknown ages by truncated exponential distribution with a mean of (EXP_AGE_DIST*distance). Negative indicates that skewness should be reversed. Requires -s option\")\n parser.add_option(\"-r\", \"--replicates\", action=\"store\", dest=\"nreps\", type=\"int\", default = 1, \\\n help=\"Number of replicate trees to output (only sensible with -u or -e options)\")\n parser.add_option(\"-a\", \"--ages\", action=\"store_true\", dest=\"ageout\", \\\n default = 0, help=\"Output node ages\")\n parser.add_option(\"-v\", \"--verbose\", action=\"store_true\", dest=\"verbose\", default=False,\n\t\t\t\t\t help=\"Print INFO messages to stdout, default=%default\") \n\n (options, args) = parser.parse_args()\n\n if options.verbose:\n phylo_logger.setLevel(logging.INFO)\n \n if len(args) == 1 :\n try :\n src = open(args[0]).read()\n except IOError:\n phylo_logger.error(\"Error reading tree file, %s\" % args[0])\n sys.exit()\n else :\n src = sys.stdin.read()\n\n if options.nexus:\n from nexus_doc import NexusDoc # no reason \n nxdoc = NexusDoc(log = None)\n nxdoc.load(src)\n trees = nxdoc.Trees()\n else :\n trees = newick.read_trees(src)\n\n result_trees= []\n \n for tree in trees:\n if options.one :\n phylo_logger.info(\"Setting branch lengths to one\")\n bl_one(tree)\n elif options.grafen :\n phylo_logger.info(\"Setting branch lengths by Grafen method\")\n bl_grafen(tree)\n elif options.topo : \n bl_topo(tree)\n phylo_logger.info(\"Setting branch lengths by minimal extension method\")\n elif options.ages_file :\n try:\n a_dict = get_age_dict(options.ages_file)\n except IOError:\n phylo_logger.error( \"Error reading ages file: %s\" % options.ages_file)\n sys.exit()\n phylo_logger.info(\"Running bl_bladj\")\n age_dist_func = node_age_bladj_original # default\n if options.uniform_age_dist:\n phylo_logger.info(\"Running bl_bladj with uniform age distribution\")\n age_dist_func = node_age_uniform\n if options.exp_age_dist != 0:\n if options.exp_age_dist < 0 :\n reverse = True\n options.exp_age_dist = abs(options.exp_age_dist)\n else :\n reverse = False\n phylo_logger.info(\"Running bl_bladj with exponential age distribution, alpha=%f\" % options.exp_age_dist)\n def node_age(start,stop, n):\n return node_age_exponential(start,stop,n,options.exp_age_dist, reverse)\n age_dist_func = node_age\n for i in range(options.nreps):\n newtree = tree.copy()\n bl_bladj(newtree, a_dict, age_dist_func, False)\n #t= reroot(newtree,\"angiosperms\")\n #result_trees.append(t)\n result_trees.append(newtree)\n elif options.ageout :\n phylo_logger.info(\"Printing node ages\")\n ages = tree.node_ages()\n for (l,a) in ages:\n print l,a\n\n if options.ageout:\n return 0\n \n if options.nexus:\n trees = trees + result_trees\n print nxdoc \n elif len(result_trees) > 0:\n for t in result_trees:\n print t, \";\"\n else:\n for tree in trees:\n print tree, \";\"\n return 0\n\n \ndef test():\n #TODO: add tests for bladj\n \n \"Test functions\"\n from newick import create_tree\n \n treestr = \"((((incanus:5.468750,cordulatus:5.468750):5.468750,(((leucodermis:3.125000,cyaneus:3.125000):3.125000,thyrsiflorus:6.250000):3.125000,((arboreus:3.906250,spinosus:3.906250):3.906250,(integerrimus:6.250000,(hearstiorum:4.687500,(tomentosus:3.125000,(oliganthus:1.562500,impressus:1.562500):1.562500):1.562500):1.562500):1.562500):1.562500):1.562500):1.562500,((papillosus:4.687500,foliosus:4.687500):4.687500,(diversifolius:6.250000,(griseus:3.125000,lemmonii:3.125000):3.125000):3.125000):3.125000)euceanothus:16.500000,(((((((divergens:0.642857,purpureus:0.642857):0.642857,prostratus:1.285714):0.642857,megacarpus:1.928571):0.642857,maritimus:2.571429):0.642857,masonii:3.214286):0.642857,cuneatus:3.857143):0.642857,crassifolius:4.500000)cerastes:24.500000)ceanothus:1.000000\"\n\n tree = create_tree(treestr)\n tree2 = tree.copy()\n bl_topo(tree)\n ages = tree.node_ages()\n a = {}\n for i, node in enumerate(tree2.postorder()) :\n a[node.ulabel()] = ages[i]\n bl_ages(tree2, a)\n print tree.write(True)\n print tree2.write(True)\n if tree.write(True)==tree2.write(True) :\n print \"Success\"\n\n ltree = create_tree(treestr)\n node_ages = {'ceanothus': 29.0, 'cerastes': 4.5, 'euceanothus' : 12.5}\n bl_bladj(ltree, node_ages)\n \n print ltree\n\nif __name__== \"__main__\":\n main()\n \n" } ]
19
eddydecena/data-structure
https://github.com/eddydecena/data-structure
71bfa0bf567ac3b69d67ee83609a06dd9e415561
b7b0bd960d1759c8682079fd71c83f54fc044405
035027a9d0805190a4a826b9141b57d620e8f0d6
refs/heads/master
2023-08-14T15:50:35.124589
2021-10-01T03:39:30
2021-10-01T03:39:30
null
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.42594295740127563, "alphanum_fraction": 0.47194111347198486, "avg_line_length": 19.148147583007812, "blob_id": "d1bf580657db7f76e944871e43e2ab60fb28f63d", "content_id": "e9049de7f5ced5640355a00f19a8a4b1e5e13862", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1087, "license_type": "no_license", "max_line_length": 33, "num_lines": 54, "path": "/breadth-first-search/main.py", "repo_name": "eddydecena/data-structure", "src_encoding": "UTF-8", "text": "from typing import Dict\nfrom typing import List\n\nfrom graph import bfs\nfrom graph import has_path\nfrom graph import connected\nfrom graph import KrushalAlgo\nfrom graph import LazyPrims\nfrom graph import Dijkstras\nfrom graph import BellmanFord\n\n# GRAPH: Dict[str, List[str]] = {\n# 'A' : ['B','C'],\n# 'B' : ['D', 'E'],\n# 'C' : ['F'],\n# 'D' : [],\n# 'E' : ['F'],\n# 'F' : []\n# }\n\nGRAPH: Dict[str, List[str]] = {\n 'A' : ['B','C'],\n 'B' : ['A', 'D', 'E'],\n 'C' : ['A', 'F'],\n 'D' : ['B'],\n 'E' : ['B', 'F'],\n 'F' : ['C', 'E'],\n 'G' : ['H', 'I'],\n 'H' : ['G', 'J', 'K'],\n 'I' : ['G', 'L'],\n 'J' : ['H'],\n 'K' : ['H', 'L'],\n 'L' : ['K', 'I'],\n 'Z' : []\n}\n\nka = BellmanFord(6)\nka.add_edge(0, 1, 4)\nka.add_edge(0, 2, 4)\nka.add_edge(1, 2, 2)\nka.add_edge(1, 0, 4)\nka.add_edge(2, 0, 4)\nka.add_edge(2, 1, 2)\nka.add_edge(2, 3, 3)\nka.add_edge(2, 4, 1)\nka.add_edge(2, 5, 6)\nka.add_edge(3, 2, 3)\nka.add_edge(3, 5, 2)\nka.add_edge(5, 2, 6)\nka.add_edge(5, 3, 2)\nka.add_edge(5, 4, 3)\nka.add_edge(4, 2, 1)\nka.add_edge(4, 5, 3)\nprint(ka.run(start=0))" }, { "alpha_fraction": 0.5276984572410583, "alphanum_fraction": 0.5276984572410583, "avg_line_length": 31.44444465637207, "blob_id": "3bf80ddfb2c42a190d2a361b1a64b7e0f5493ee3", "content_id": "46951dfa76527222cc5337b4394698da18e40b91", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1751, "license_type": "no_license", "max_line_length": 83, "num_lines": 54, "path": "/binary-tree-search/bts/main.py", "repo_name": "eddydecena/data-structure", "src_encoding": "UTF-8", "text": "from typing import Optional\nfrom typing import Any\n\nfrom bts.node import Node\n\nclass BinaryTreeSearch():\n def __init__(self, arr: list) -> None:\n self._tree: Optional[Node] = None\n \n for value in arr:\n self.add(value)\n \n @property\n def tree(self) -> Node:\n return self._tree\n \n def search_recursively(self, value: Any, tree: Optional[Node] == None) -> None:\n if tree == None and tree.value == value:\n return tree\n elif value < tree.value:\n self.search_recursively(value, tree.left)\n elif value > tree.value:\n self.search_recursively(value, tree.right)\n \n def search_iteratively(self, value: Any) -> None:\n current_node = self._tree\n \n while current_node != None:\n if value == current_node.value:\n return current_node\n elif value < current_node.value:\n current_node = current_node.left\n elif value > current_node.value:\n current_node = current_node.right\n return current_node\n \n def add(self, value: Any) -> None:\n node = Node(value)\n current_node = self._tree\n \n while True:\n if current_node == None:\n self._tree = node\n break\n elif node.value < current_node.value:\n if not current_node.left:\n current_node.left = node\n break\n current_node = current_node.left\n elif node.value > current_node.value:\n if not current_node.right:\n current_node.right = node\n break\n current_node = current_node.right" }, { "alpha_fraction": 0.3990384638309479, "alphanum_fraction": 0.43589743971824646, "avg_line_length": 24.83333396911621, "blob_id": "036eb58a06c4b5fabf9d63cb4b4436e28dec2c98", "content_id": "08ce6b4768e0cf2a775f669518cd6850ec2a048c", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 624, "license_type": "no_license", "max_line_length": 45, "num_lines": 24, "path": "/fenwick-tree/main.py", "repo_name": "eddydecena/data-structure", "src_encoding": "UTF-8", "text": "class Fenwick():\n def update(self, i, x):\n while i <= x:\n self.BIT[i-1] += x\n i += i & (-i)\n def query(self, i):\n s = 0\n while i > 0:\n s += self.BIT[i-1]\n i -= i & (-i)\n return s\n def __init__(self, l=[]):\n self.N = len(l)\n self.BIT = [0 for i in range(self.N)]\n for i in range(1,self.N+1):\n self.update(i, l[i-1])\n\nif __name__ == '__main__':\n fenwick = Fenwick([1,2,3,4,5,6,7,8,9,10])\n print(fenwick.BIT)\n print(f'Result: {fenwick.query(5)}')\n \n print(fenwick.BIT)\n fenwick.update(5, 25)\n " }, { "alpha_fraction": 0.6842105388641357, "alphanum_fraction": 0.6842105388641357, "avg_line_length": 21.545454025268555, "blob_id": "0a8ae9897f31332c97efa9c4dd3ede118825ca2b", "content_id": "1718cb49d716f9cb9ab71834a9bcd1c152d19f99", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 247, "license_type": "no_license", "max_line_length": 73, "num_lines": 11, "path": "/breadth-first-search/graph/has_path.py", "repo_name": "eddydecena/data-structure", "src_encoding": "UTF-8", "text": "from typing import Dict\nfrom typing import List\n\nfrom . import bfs\n\ndef has_path(GRAPH: Dict[str, List[str]], source: str, destination: str):\n visited = bfs(GRAPH, source)\n if destination in visited:\n return True\n \n return False" }, { "alpha_fraction": 0.34820371866226196, "alphanum_fraction": 0.375049352645874, "avg_line_length": 22.90566062927246, "blob_id": "4da10cd98307f073b66ff1b5586598f2c3bd0aaa", "content_id": "91cf26e515000499d410194447f39396a2668552", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2547, "license_type": "no_license", "max_line_length": 72, "num_lines": 106, "path": "/mergesot/main.py", "repo_name": "eddydecena/data-structure", "src_encoding": "UTF-8", "text": "class ButtomToTopMergeSort():\n @classmethod\n def mergesort(cls, array: list) -> list:\n low = 0\n high = len(array) - 1\n \n temp: list = array.copy()\n \n m: int = 1\n while m <= high - low:\n for i in range(low, high, 2*m):\n frm: int = i\n mid: int = i + m - 1\n to: int = min(i + 2*m - 1, high)\n cls.merge(array, temp, frm, mid, to)\n m: int = 2*m\n \n @staticmethod\n def merge(A: list, temp: int, frm: int, mid: int, to: int) -> None:\n k: int = frm\n i: int = frm\n j: int = mid + 1\n \n while i <= mid and j <= to:\n if A[i] < A[j]:\n temp[k] = A[i]\n i = i + 1\n else:\n temp[k] = A[j]\n j = j + 1\n k = k + 1\n \n while i < len(A) and i <= mid:\n temp[k] = A[i]\n k = k + 1\n i = i + 1\n \n for i in range(frm, to + 1):\n A[i] = temp[i]\n\nif __name__ == '__main__':\n A = [5, 7, -9, 3, -4, 2, 8]\n\n print(\"Original array:\", A)\n ButtomToTopMergeSort.mergesort(A)\n print(\"Sorted array:\", A)\n\n\n# # Merge two sorted sublists `A[frm…mid]` and `A[mid+1…to]`\n# def merge(A, temp, frm, mid, to):\n# k = frm\n# i = frm\n# j = mid + 1\n\n# while i <= mid and j <= to:\n# if A[i] < A[j]:\n# temp[k] = A[i]\n# i = i + 1\n# else:\n# temp[k] = A[j]\n# j = j + 1\n# k = k + 1\n\n# while i < len(A) and i <= mid:\n# temp[k] = A[i]\n# k = k + 1\n# i = i + 1\n\n# for i in range(frm, to + 1):\n# A[i] = temp[i]\n\n# def mergesort(A):\n# low = 0\n# high = len(A) - 1\n \n# # sort list `A` using a temporary list `temp`\n# temp = A.copy()\n \n# # divide the list into blocks of size `m`\n# # m = [1, 2, 4, 8, 16…]\n \n# m = 1\n# while m <= high - low:\n \n# # for m = 1, i = [0, 2, 4, 6, 8…]\n# # for m = 2, i = [0, 4, 8, 12…]\n# # for m = 4, i = [0, 8, 16…]\n# # …\n \n# for i in range(low, high, 2*m):\n# frm = i\n# mid = i + m - 1\n# to = min(i + 2*m - 1, high)\n# merge(A, temp, frm, mid, to)\n \n# m = 2*m\n \n \n# # Iterative implementation of merge sort\n# if __name__ == '__main__':\n \n# A = [5, 7, -9, 3, -4, 2, 8]\n \n# print(\"Original array:\", A)\n# mergesort(A)\n# print(\"Modified array:\", A)" }, { "alpha_fraction": 0.7153196334838867, "alphanum_fraction": 0.7213510274887085, "avg_line_length": 14.370369911193848, "blob_id": "1b74660f4b7f2caf1f78bad0ff3b25588ac979e0", "content_id": "9d8bab63c3c4e3d66854e989adffcaef9b967d62", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 829, "license_type": "no_license", "max_line_length": 114, "num_lines": 54, "path": "/linked-list-algo/README.md", "repo_name": "eddydecena/data-structure", "src_encoding": "UTF-8", "text": "# lllist\n\nThis is a implementation of the data structure algorithms Single linked list and Doubly linked list in python 3.8+\n\n# Usage\n\n## For single linked list\n\n``` python\n\nfrom llist import SinglyLinkedList\n\n# Create a singly linked list\nmy_llist = SinglyLinkedList()\n\n# Add element, equivalent to append in a list\nmy_llist.head = 3\n\n# Get last element with tail\nprint(my_llist.tail.value)\n\n# Add an element at the first\nmy_llist.add_first('a')\n\n# Get first element\nprint(my_llist.head)\n\n# Map method for functional programming\nmy_llist.map(str)\n\n# Loop through linked list element\nnode = my_llist.head\nwhile node is not None:\n print(node.value)\n node = node.next\n\n# Output\n# '3'\n# 'a'\n\n```\n\n## For doubly linked list\n\n``` python\n\nfrom llist import DoublyLinkedList\n\nmy_llist = DoublyLinkedList()\n\nmy_llist.head = 3\n\n\n```" }, { "alpha_fraction": 0.5320447683334351, "alphanum_fraction": 0.5462868809700012, "avg_line_length": 27.114286422729492, "blob_id": "1fb667e264b9a96d82cd54d2f3f67312130612b6", "content_id": "54c27af05c29e66bb833f2669c6c11a23b8c6c89", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 983, "license_type": "no_license", "max_line_length": 97, "num_lines": 35, "path": "/dynamic-connectivity/quick_find.py", "repo_name": "eddydecena/data-structure", "src_encoding": "UTF-8", "text": "import random\nfrom typing import List\nfrom typing import Optional\n\nclass QuickFind():\n array: List[Optional[int]]\n \n def __init__(self, length: int) -> None:\n self.length = length\n self.array = list(range(0, length))\n \n def union(self, p: int, q: int) -> None:\n assert self.length == len(self.array), 'difference between array length and input length'\n \n pid = self.array[p]\n qid = self.array[q]\n \n for i in range(self.length):\n if self.array[i] == pid:\n self.array[i] = qid\n \n def connected(self, p: int, q: int) -> bool:\n return self.array[p] == self.array[q]\n\nif __name__ == '__main__':\n num_op = 10 \n dc = QuickFind(num_op)\n for num in range(5):\n p = random.randint(0, num_op -1)\n q = random.randint(0, num_op-1)\n dc.union(p, q)\n dc.union(2, 5)\n print(dc.connected(2, 5))\n print('Test: ', dc.connected(3, 9))\n print(dc.array)" }, { "alpha_fraction": 0.5216284990310669, "alphanum_fraction": 0.5267175436019897, "avg_line_length": 23.625, "blob_id": "6f67348b3b1a17b69cad325564cab526cf405e85", "content_id": "66748c62a1b9e49d543b24b41648a1f09b3bf151", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 393, "license_type": "no_license", "max_line_length": 44, "num_lines": 16, "path": "/sort-algo/sort/shuffle.py", "repo_name": "eddydecena/data-structure", "src_encoding": "UTF-8", "text": "import random\n\nclass Shuffle():\n @classmethod\n def sort(cls, array: list) -> list:\n for i in range(0, len(array)):\n r: int = random.randint(0, i)\n cls.swap(array, i, r)\n return array\n \n @staticmethod\n def swap(array: list, i: int, min: int):\n temp = array[i]\n array[i] = array[min]\n array[min] = temp\n return array" }, { "alpha_fraction": 0.821052610874176, "alphanum_fraction": 0.821052610874176, "avg_line_length": 23, "blob_id": "11febb319278aba5927bd90ac28c7fffed2016e5", "content_id": "99758b0fe42f7bb072717777773231fd5256d2c8", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 95, "license_type": "no_license", "max_line_length": 35, "num_lines": 4, "path": "/linked-list-algo/llist/node/__init__.py", "repo_name": "eddydecena/data-structure", "src_encoding": "UTF-8", "text": "from .node import Node\n\nfrom .singly_node import SinglyNode\nfrom .doubly_node import DoublyNode" }, { "alpha_fraction": 0.8484848737716675, "alphanum_fraction": 0.8484848737716675, "avg_line_length": 48.5, "blob_id": "e49300480be6a7ecac7988ccdb20f7eda3942979", "content_id": "d2d232f52d0ae25f6b744adfaa1e431ad64f26bc", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 99, "license_type": "no_license", "max_line_length": 49, "num_lines": 2, "path": "/linked-list-algo/llist/__init__.py", "repo_name": "eddydecena/data-structure", "src_encoding": "UTF-8", "text": "from .singly_linked_list import SinglyLinkedList\n# from doubly_linked_list import DoublyLinkedList\n" }, { "alpha_fraction": 0.5803108811378479, "alphanum_fraction": 0.5803108811378479, "avg_line_length": 26.64285659790039, "blob_id": "074699adf6157c6b6c6d4aba1f42369193eb7410", "content_id": "ff275ad05c6c5a43cba1c11441614fff1105c9c2", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 386, "license_type": "no_license", "max_line_length": 98, "num_lines": 14, "path": "/binary-tree-search/bts/node/main.py", "repo_name": "eddydecena/data-structure", "src_encoding": "UTF-8", "text": "from typing import Any\nfrom typing import Optional\n\nclass Node():\n def __init__(self, value: Any, left: Optional[object] = None, right: Optional[object] = None):\n self.value = value\n self.left = left\n self.right = right\n \n def is_leaf(self) -> bool:\n if self.left == None and self.right == None:\n return True\n \n return False" }, { "alpha_fraction": 0.4752475321292877, "alphanum_fraction": 0.4752475321292877, "avg_line_length": 25.39130401611328, "blob_id": "3fd41ed49b9cb09995bb1e3a99cf14486826f6e2", "content_id": "da0774f61ef85d28619eb3e9465ec78082e039e0", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 606, "license_type": "no_license", "max_line_length": 48, "num_lines": 23, "path": "/sort-algo/sort/selection.py", "repo_name": "eddydecena/data-structure", "src_encoding": "UTF-8", "text": "class Selection():\n @classmethod\n def sort(cls, array: list) -> list:\n for i in range(len(array)):\n min: int = i\n for j in range(i, len(array)):\n if cls.less(array[j], array[i]):\n min = j\n array = cls.swap(array, i, min)\n return array\n \n @staticmethod\n def less(x: int, y: int):\n if x < y:\n return True\n return False\n \n @staticmethod\n def swap(array: list, i: int, min: int):\n temp = array[i]\n array[i] = array[min]\n array[min] = temp\n return array" }, { "alpha_fraction": 0.6018182039260864, "alphanum_fraction": 0.6436363458633423, "avg_line_length": 28, "blob_id": "12596c0f1c5fe809d1c2bb53211f1717f5e5f835", "content_id": "c4cd2cbf1f695b552b47aee0049116e431552a33", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 550, "license_type": "no_license", "max_line_length": 46, "num_lines": 19, "path": "/sort-algo/main.py", "repo_name": "eddydecena/data-structure", "src_encoding": "UTF-8", "text": "from sort import Selection\nfrom sort import Insertion\nfrom sort import ShellSort\nfrom sort import Shuffle\n\narray: list = [10, 2, 3, 7, 1, 0]\nprint('Unordered array: ', array)\n\nprint(f'{\"*\" * 15} Selection sort {\"*\" * 15}')\nprint('Result: ', Selection.sort(array=array))\n\nprint(f'{\"*\" * 15} Insertion sort {\"*\" * 15}')\nprint('Result: ', Insertion.sort(array=array))\n\nprint(f'{\"*\" * 15} ShellSort sort {\"*\" * 15}')\nprint('Result: ', ShellSort.sort(array=array))\n\nprint(f'{\"*\" * 15} Shuffle sort {\"*\" * 15}')\nprint('Result: ', Shuffle.sort(array=array))" }, { "alpha_fraction": 0.5339652299880981, "alphanum_fraction": 0.5339652299880981, "avg_line_length": 19.45161247253418, "blob_id": "6d2b59c33e0da027f47ed4d7eceb6ac217986366", "content_id": "5904c91ed23130463f84ff45cd4a58ae2b5c3246", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 633, "license_type": "no_license", "max_line_length": 45, "num_lines": 31, "path": "/linked-list-algo/llist/node/singly_node.py", "repo_name": "eddydecena/data-structure", "src_encoding": "UTF-8", "text": "from typing import Any\nfrom typing import Optional\n\nfrom llist.node import Node\n\nclass SinglyNode(Node):\n def __init__(\n self, \n value: Any, \n next: Optional[Node] = None) -> None:\n \n super(SinglyNode, self).__init__()\n \n self._value = value\n self._next = next\n \n @property\n def value(self) -> Any:\n return self._value\n \n @value.setter\n def value(self, v: Any) -> None:\n self._value = v\n\n @property\n def next(self) -> Node:\n return self._next\n \n @next.setter\n def next(self, node=Node) -> None:\n self._next = node" }, { "alpha_fraction": 0.43279901146888733, "alphanum_fraction": 0.4537608027458191, "avg_line_length": 26.066667556762695, "blob_id": "efc60f6412b2a54b0e0977f065692dc3499a96e6", "content_id": "5dbdd7bab64935e03b6da543b49f5a07886069cd", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 811, "license_type": "no_license", "max_line_length": 68, "num_lines": 30, "path": "/sort-algo/sort/shellsort.py", "repo_name": "eddydecena/data-structure", "src_encoding": "UTF-8", "text": "from typing import List\n\nclass ShellSort():\n @classmethod\n def sort(cls, array: list) -> list:\n n: int = len(array)\n gaps: List[int] = [701, 301, 132, 57, 23, 10, 4, 1]\n \n for gap in gaps:\n for i in range(gap, n):\n temp = array[i]\n j: int = i\n while j >= gap and cls.less(array[j], array[j-gap]):\n array = cls.swap(array, j, j-gap)\n j -= gap\n array[j] = temp\n return array\n \n @staticmethod\n def less(x: int, y: int):\n if x < y:\n return True\n return False\n \n @staticmethod\n def swap(array: list, i: int, min: int):\n temp = array[i]\n array[i] = array[min]\n array[min] = temp\n return array" }, { "alpha_fraction": 0.4657701849937439, "alphanum_fraction": 0.46882641315460205, "avg_line_length": 23.803030014038086, "blob_id": "5d2a02099a47dd99716969073036f6ccbb5922db", "content_id": "45a3f9e30a79eb50489599082ecccae02d01eccd", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1636, "license_type": "no_license", "max_line_length": 52, "num_lines": 66, "path": "/linked-list-algo/llist/singly_linked_list.py", "repo_name": "eddydecena/data-structure", "src_encoding": "UTF-8", "text": "from typing import Any\nfrom typing import Optional\nfrom typing import Callable\n\nfrom llist.node import SinglyNode\n\nclass SinglyLinkedList():\n def __init__(self) -> None:\n self.size: int = 0\n self._head: Optional[SinglyNode] = None\n self._tail: Optional[SinglyNode] = None\n \n @property\n def head(self) -> SinglyNode:\n return self._head\n \n @head.setter\n def head(self, value: int) -> None:\n node: SinglyNode = SinglyNode(value)\n \n if self.size == 0:\n self._head = node\n else:\n _node = self.head\n \n while True:\n if _node.next == None:\n _node.next = node\n self._tail = node\n break\n \n _node = _node.next\n \n self.size += 1\n \n @property\n def tail(self) -> SinglyNode:\n return self._tail\n \n def add_first(self, value: Any) -> None:\n node: SinglyNode = SinglyNode(value)\n node.next = self._head\n self._head = node\n self.size += 1\n \n def delete_last(self):\n __node = self._head\n _node = __node\n \n while True:\n if _node.next == None:\n __node.next = None\n break\n \n __node = _node\n _node = _node.next\n \n self._tail = __node\n self.size -= 1\n \n def map(self, fn: Callable[[Any], Any]) -> None:\n node = self._head\n \n while node is not None:\n node.value = fn(node.value)\n node = node.next" }, { "alpha_fraction": 0.4889543354511261, "alphanum_fraction": 0.4968090355396271, "avg_line_length": 26.54054069519043, "blob_id": "e5af22fde401394df3ee5adf5d502729306b7619", "content_id": "f590b03628b6dcc30a2b3142a7483a6f9b1e099e", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2037, "license_type": "no_license", "max_line_length": 78, "num_lines": 74, "path": "/breadth-first-search/graph/bellman.py", "repo_name": "eddydecena/data-structure", "src_encoding": "UTF-8", "text": "from typing import List\nfrom typing import Tuple\nfrom typing import Dict\nfrom typing import Optional\nfrom queue import PriorityQueue\nimport heapq\nimport math\n\nclass BellmanFord():\n graph: Dict[int, List[Tuple[int]]]\n n: int\n m: int\n visited: List[bool]\n edgeCount: int\n mstCost: int\n mstEdges: int\n pq: PriorityQueue\n \n def __init__(self, vertices: int) -> None:\n self.n = vertices\n self.m = self.n - 1\n self.visited = [False] * self.n\n self.edgeCount = 0\n self.mstCost = 0\n self.mstEdges = [None] * self.m\n self.pq = PriorityQueue()\n self.ipq = []\n self.graph = {}\n \n heapq.heapify(self.ipq)\n \n for i in range(vertices):\n self.graph[i] = []\n \n def add_edge(self, u: int=0, v: int=0, w: int=0) -> None:\n \"\"\"\n u: Actual node\n v: Edge to\n w: Edge weight\n \"\"\"\n self.graph[u].append((v, w))\n \n def run(self, start: int = 0) -> Tuple[List[int], List[int]]:\n dist: List[int] = [math.inf] * self.n\n pred: List[int] = [None] * self.n\n \n dist[start] = 0\n for _ in range(self.n-1):\n for key in self.graph:\n for edge in self.graph[key]:\n if dist[key] + edge[1] < dist[edge[0]]:\n dist[edge[0]] = dist[key] + edge[1]\n pred[edge[0]] = key\n\n for key in self.graph:\n for edge in self.graph[key]:\n if dist[key] + edge[1] < dist[edge[0]]:\n raise ValueError('Graph contains a negative-weight cycle')\n \n return dist, pred\n \n def shortest_path(self, start: int, end: int):\n dist, prev = self.lazy(start=start, end=end)\n \n path: List[int] = []\n if (dist[end] == math.inf): return path\n \n at: int = end\n while at != None:\n path.append(at)\n at = prev[at]\n \n path.reverse()\n return path" }, { "alpha_fraction": 0.43634384870529175, "alphanum_fraction": 0.45593035221099854, "avg_line_length": 26.878787994384766, "blob_id": "f63498119eb830adf93bc3942f8a1de18dd90f4a", "content_id": "aaab4c35580ef1f1ae123590cbadc3c4d2459ea9", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 919, "license_type": "no_license", "max_line_length": 61, "num_lines": 33, "path": "/quicksort/main.py", "repo_name": "eddydecena/data-structure", "src_encoding": "UTF-8", "text": "class QuickSort():\n @classmethod\n def sort(cls, array: list, low: int, high: int) -> list:\n if len(array) <= 1:\n return array\n \n if low < high:\n pi: int = cls.partition(array, low, high)\n \n cls.sort(array, low, pi-1)\n cls.sort(array, pi + 1, high)\n\n @staticmethod\n def partition(array: list, low: int, high: int) -> None:\n i: int = (low-1) # why subtract by -1\n \n pivot: int = array[high]\n \n for j in range(low, high):\n if array[j] <= pivot:\n i = i+1\n \n array[i], array[j] = array[j], array[i]\n \n array[i+1], array[high] = array[high], array[i+1]\n return (i+1)\n\nif __name__ == '__main__':\n A = [5, 7, -9, 3, -4, 2, 8]\n\n print(\"Original array:\", A)\n QuickSort.sort(A, 0, len(A)-1)\n print(\"Sorted array:\", A)" }, { "alpha_fraction": 0.518496036529541, "alphanum_fraction": 0.5257731676101685, "avg_line_length": 26.966102600097656, "blob_id": "a865d7204aa0ad470c5074d8c8f88448314c5f59", "content_id": "334693c7c60c783bf15cab2b6e736888e48ad575", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1649, "license_type": "no_license", "max_line_length": 73, "num_lines": 59, "path": "/breadth-first-search/graph/prims.py", "repo_name": "eddydecena/data-structure", "src_encoding": "UTF-8", "text": "from typing import List\nfrom typing import Tuple\nfrom typing import Dict\nfrom typing import Optional\nfrom queue import PriorityQueue\n\nclass LazyPrims():\n graph: Dict[int, List[Tuple[int]]]\n n: int\n m: int\n visited: List[bool]\n edgeCount: int\n mstCost: int\n mstEdges: int\n pq: PriorityQueue\n \n def __init__(self, vertices: int) -> None:\n self.n = vertices\n self.m = self.n - 1\n self.visited = [False] * self.n\n self.edgeCount = 0\n self.mstCost = 0\n self.mstEdges = [None] * self.m\n self.pq = PriorityQueue()\n self.graph = {}\n \n for i in range(vertices):\n self.graph[i] = []\n \n def add_edge(self, u: int=0, v: int=0, w: int=0) -> None:\n self.graph[u].append((v, w))\n \n def enqueue_edges(self, node_index: int) -> None:\n self.visited[node_index] = True\n \n edges = self.graph[node_index]\n for edge in edges:\n if not self.visited[edge[0]]:\n self.pq.put(edge)\n \n def run(self, start: int = 0) -> Tuple[Optional[int], Optional[int]]:\n self.enqueue_edges(start)\n \n while (not self.pq.empty() and self.edgeCount != self.m):\n edge = self.pq.get()\n \n if self.visited[edge[0]]:\n continue\n \n self.mstEdges[self.edgeCount] = edge\n self.edgeCount += 1\n self.mstCost += edge[1]\n \n self.enqueue_edges(edge[0])\n \n if (self.edgeCount != self.m):\n return None, None\n \n return (self.mstCost, self.mstEdges)" }, { "alpha_fraction": 0.8181818127632141, "alphanum_fraction": 0.8181818127632141, "avg_line_length": 22, "blob_id": "c762eff75283e4745f641c4300e0c82b4546480a", "content_id": "9eb37f2a011ba145766740179b2fb4b7d9978ede", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 22, "license_type": "no_license", "max_line_length": 22, "num_lines": 1, "path": "/binary-tree-search/bts/node/__init__.py", "repo_name": "eddydecena/data-structure", "src_encoding": "UTF-8", "text": "from .main import Node" }, { "alpha_fraction": 0.8518518805503845, "alphanum_fraction": 0.8518518805503845, "avg_line_length": 27, "blob_id": "0d5df14e371d9d029cb27702a4964d593ad22843", "content_id": "a48393101edddf3ad25577ed1c53b9ab7ed20129", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 27, "license_type": "no_license", "max_line_length": 27, "num_lines": 1, "path": "/hash-tables/hasht/__init__.py", "repo_name": "eddydecena/data-structure", "src_encoding": "UTF-8", "text": "from .main import HashTable" }, { "alpha_fraction": 0.482653945684433, "alphanum_fraction": 0.48699045181274414, "avg_line_length": 25.825580596923828, "blob_id": "a934fe4beedc19350a46ad728b438c1fe7236c51", "content_id": "1b316a7aa22700b7208964708ee4592fb3e821cb", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2306, "license_type": "no_license", "max_line_length": 68, "num_lines": 86, "path": "/hash-tables/hasht/main.py", "repo_name": "eddydecena/data-structure", "src_encoding": "UTF-8", "text": "from typing import Optional\nfrom typing import Any\n\nfrom hasht.node import Node\n\nclass HashTable():\n def __init__(self, capacity: int = 100) -> None:\n self.size: int = 0\n self._capacity = capacity\n self.buckets: list[Optional[Node]] = [None] * self._capacity\n self.load_factor = 0.7\n self.threshold = self._capacity * self.load_factor\n \n def hash(self, key) -> int:\n hashsum = 0\n \n for idx, c in enumerate(key):\n hashsum = (idx + len(key)) ** ord(c)\n hashsum = hashsum % self._capacity\n \n return hashsum\n \n def insert(self, key: str, value: Any) -> None:\n index = self.hash(key)\n \n node = self.buckets[index]\n \n if node is None:\n self.buckets[index] = Node(key, value)\n return\n\n while True:\n if node.next is None:\n node.next = Node(key, value)\n break\n \n node = node.next\n \n self.size += 1\n \n if self.size >= self.threshold:\n self.resize(2 * self._capacity + 1)\n \n def retrive(self, key: str) -> Any:\n index = self.hash(key)\n \n node = self.buckets[index]\n \n while ((node is not None) and (node.key != key)):\n node = node.next\n \n if node == None:\n return None\n else:\n return node\n \n def remove(self, key: str):\n index = self.hash(key)\n \n node = self.buckets[index]\n \n if node.key == key:\n self.buckets[index] = node.next\n return\n \n prev = node\n while ((node is not None) and (node.key != key)):\n if (node.next is not None):\n break\n \n prev = node\n node = node.next\n \n node.next = prev.next.next\n \n def resize(self, new_capacity: int):\n temp: HashTable = HashTable(new_capacity)\n \n for node in self.buckets:\n while node:\n temp.insert(node.key, node.value)\n node = node.next\n \n self.buckets = temp.buckets\n self._capacity = temp._capacity\n self.threshold = self._capacity * self.load_factor" }, { "alpha_fraction": 0.6991869807243347, "alphanum_fraction": 0.6991869807243347, "avg_line_length": 19.66666603088379, "blob_id": "028d8b8b616fa0edab3b5c9e5ad9ceb1e3c56a4e", "content_id": "4f4f03485c96142ace7676c5dac5613df5456747", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 123, "license_type": "no_license", "max_line_length": 34, "num_lines": 6, "path": "/linked-list-algo/llist/node/node.py", "repo_name": "eddydecena/data-structure", "src_encoding": "UTF-8", "text": "from typing import Any\nfrom typing import Optional\n\nclass Node():\n _value: Any = None\n _next: Optional[object] = None" }, { "alpha_fraction": 0.5195729732513428, "alphanum_fraction": 0.5338078141212463, "avg_line_length": 27.125, "blob_id": "4223aec8b8ef701fc50aee8beed46288c867ec80", "content_id": "6064b81ce1f2e66fc6a9edcbee6a54b35059f000", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1124, "license_type": "no_license", "max_line_length": 97, "num_lines": 40, "path": "/dynamic-connectivity/quick_union.py", "repo_name": "eddydecena/data-structure", "src_encoding": "UTF-8", "text": "import random\nfrom typing import List\nfrom typing import Optional\n\nclass QuickUnion():\n array: List[Optional[int]]\n \n def __init__(self, length: int) -> None:\n self.length = length\n self.array = list(range(0, length))\n \n def root(self, i: int) -> int:\n while(self.array[i] != i):\n # i = self.array[self.array[i]]\n self.array[i] = self.array[self.array[1]]\n i = self.array[1]\n \n return i\n \n def union(self, p: int, q: int) -> None:\n assert self.length == len(self.array), 'difference between array length and input length'\n \n i: int = self.root(p)\n j: int = self.root(q)\n self.array[i] = j\n \n def connected(self, p: int, q: int) -> bool:\n return self.root(p) == self.root(q)\n\nif __name__ == '__main__':\n num_op = 10 \n dc = QuickUnion(num_op)\n for num in range(5):\n p = random.randint(0, num_op -1)\n q = random.randint(0, num_op-1)\n dc.union(p, q)\n dc.union(2, 5)\n print(dc.connected(2, 5))\n print('Test: ', dc.connected(3, 9))\n print(dc.array)" }, { "alpha_fraction": 0.8503937125205994, "alphanum_fraction": 0.8503937125205994, "avg_line_length": 31, "blob_id": "f25daf4113240a1a8b913230c2e8aff1388db70e", "content_id": "00b74ebf31980b121ea84c9eeac6e6e53e9938af", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 127, "license_type": "no_license", "max_line_length": 32, "num_lines": 4, "path": "/sort-algo/sort/__init__.py", "repo_name": "eddydecena/data-structure", "src_encoding": "UTF-8", "text": "from .selection import Selection\nfrom .insertion import Insertion\nfrom .shellsort import ShellSort\nfrom .shuffle import Shuffle" }, { "alpha_fraction": 0.8823529481887817, "alphanum_fraction": 0.8823529481887817, "avg_line_length": 34, "blob_id": "3bc19dffa7a367f39b0477cc757a5356e654edb3", "content_id": "a67fad26e6cd8ae46a7bc5f4535a50d40261f2d5", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 34, "license_type": "no_license", "max_line_length": 34, "num_lines": 1, "path": "/binary-tree-search/bts/__init__.py", "repo_name": "eddydecena/data-structure", "src_encoding": "UTF-8", "text": "from .main import BinaryTreeSearch" }, { "alpha_fraction": 0.7076923251152039, "alphanum_fraction": 0.7589743733406067, "avg_line_length": 23.5, "blob_id": "9c49446c274e1e86ab0cc43cf9d1c9622ea9c0c7", "content_id": "63d06d60c4e919ae499d958647e4563f5a4e3109", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 195, "license_type": "no_license", "max_line_length": 52, "num_lines": 8, "path": "/binary-tree-search/test.py", "repo_name": "eddydecena/data-structure", "src_encoding": "UTF-8", "text": "from bts import BinaryTreeSearch\n\nbts = BinaryTreeSearch([1,2,10,4,5,11])\nnode = bts.search_iteratively(10)\nprint(node.value, node.left.value, node.right.value)\n\ntree = bts.tree\nprint(tree.value)" }, { "alpha_fraction": 0.7204161286354065, "alphanum_fraction": 0.7477242946624756, "avg_line_length": 29.799999237060547, "blob_id": "d3abb9334f2452ab54b560d915a269e9f22a74f9", "content_id": "4277b5e4173df3cb4259fe13df6fc9ed33fe79bf", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 769, "license_type": "no_license", "max_line_length": 68, "num_lines": 25, "path": "/hash-tables/test.py", "repo_name": "eddydecena/data-structure", "src_encoding": "UTF-8", "text": "from hasht import HashTable\n\nht = HashTable()\n\nphone_numbers = [\"555-555-5555\", \"444-444-4444\"]\ntesla_models = ['Teslas model X', 'Tesla model Y', 'Tesla model 3']\ncompanies = ['Airbnb', 'Uber', 'Digital Ocean', 'Clubhouse']\n\nht.insert('phoneDirectory', phone_numbers)\nht.insert('teslaDirectory', tesla_models)\nht.insert('companiesDirectory', companies)\n\nphone_numbers = None\ntesla_models = None\ncompanies = None\n\nht.remove('teslaDirectory')\n\nphone_numbers = ht.retrive('phoneDirectory')\ntesla_models = ht.retrive('teslaDirectory')\ncompanies = ht.retrive('companiesDirectory')\n\nprint(phone_numbers.key if phone_numbers != None else phone_numbers)\nprint(tesla_models.key if tesla_models != None else tesla_models)\nprint(companies.key if companies != None else companies)" }, { "alpha_fraction": 0.47991544008255005, "alphanum_fraction": 0.48202958703041077, "avg_line_length": 16.518518447875977, "blob_id": "27dc24416f7f5775fb4f7dabb8898096086fb142", "content_id": "e8a5a1ee14e434250d962d6dda3372df8d44c020", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 473, "license_type": "no_license", "max_line_length": 31, "num_lines": 27, "path": "/depth-first-search/main.py", "repo_name": "eddydecena/data-structure", "src_encoding": "UTF-8", "text": "from typing import Dict\nfrom typing import List\n\nSTART: str = 'A'\nGRAPH: Dict[str, List[str]] = {\n 'A' : ['B','C'],\n 'B' : ['D', 'E'],\n 'C' : ['F'],\n 'D' : [],\n 'E' : ['F'],\n 'F' : []\n}\n\nstack: list = []\nvisited: list = []\n\nstack.append(START)\nvisited.append(START)\n\nwhile len(stack) > 0:\n node = stack.pop()\n print(node, end=\" \")\n \n for n in GRAPH[node]:\n if n not in visited:\n stack.append(n)\n visited.append(n)\n" }, { "alpha_fraction": 0.46254071593284607, "alphanum_fraction": 0.4690553843975067, "avg_line_length": 25.7391300201416, "blob_id": "275b4b8c788468e909463f12434d5362a70295e1", "content_id": "f42b7ab0f24c994aaf285f582e4d5ea90710dcab", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 614, "license_type": "no_license", "max_line_length": 51, "num_lines": 23, "path": "/sort-algo/sort/insertion.py", "repo_name": "eddydecena/data-structure", "src_encoding": "UTF-8", "text": "class Insertion():\n @classmethod\n def sort(cls, array: list) -> list:\n for i in range(len(array)+1):\n for j in reversed(range(1, i)):\n if cls.less(array[j], array[j-1]):\n array = cls.swap(array, j, j-1)\n else:\n break\n return array\n \n @staticmethod\n def less(x: int, y: int):\n if x < y:\n return True\n return False\n \n @staticmethod\n def swap(array: list, i: int, min: int):\n temp = array[i]\n array[i] = array[min]\n array[min] = temp\n return array" }, { "alpha_fraction": 0.5554035305976868, "alphanum_fraction": 0.5677154660224915, "avg_line_length": 28.280000686645508, "blob_id": "d4451b3b57adf51e54b45545b708b9f3c2450aed", "content_id": "341a4b49198755bddf5e354987d450291696bdee", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 731, "license_type": "no_license", "max_line_length": 119, "num_lines": 25, "path": "/breadth-first-search/graph/bfs.py", "repo_name": "eddydecena/data-structure", "src_encoding": "UTF-8", "text": "from typing import Dict\nfrom typing import List\nfrom typing import Tuple\nfrom typing import Union\n\ndef bfs(GRAPH: Dict[str, List[str]], start: str='A', end: str='F', shortest_path: bool=False) -> Union[List[str], int]:\n queue: List[Tuple[str, int]] = []\n visited: List[str] = []\n\n queue.append((start, 0))\n visited.append(start)\n\n while len(queue) > 0:\n node: str = queue.pop(0)\n print(node[0], end=\" \")\n \n if (node[0] == end) and shortest_path:\n return node[1]\n \n for neighbour in GRAPH[node[0]]:\n if neighbour not in visited:\n visited.append(neighbour)\n queue.append((neighbour, node[1] + 1))\n \n return visited" }, { "alpha_fraction": 0.8301886916160583, "alphanum_fraction": 0.8301886916160583, "avg_line_length": 29.428571701049805, "blob_id": "202ebfc18f29b56aeb0d4cada3669440c809b881", "content_id": "b91b9f8a1f06ef99d4d99156dc1b96aa80e53d5b", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 212, "license_type": "no_license", "max_line_length": 32, "num_lines": 7, "path": "/breadth-first-search/graph/__init__.py", "repo_name": "eddydecena/data-structure", "src_encoding": "UTF-8", "text": "from .bfs import bfs\nfrom .has_path import has_path\nfrom .connected import connected\nfrom .kruskal import KrushalAlgo\nfrom .prims import LazyPrims\nfrom .dijkstras import Dijkstras\nfrom .bellman import BellmanFord" }, { "alpha_fraction": 0.5282353162765503, "alphanum_fraction": 0.5305882096290588, "avg_line_length": 23.285715103149414, "blob_id": "ee2e6102e3218a3e61fc8f9ba4ce1adf48c361af", "content_id": "1cd6eb3f820aede905c4304797c9a8f781d430b9", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 850, "license_type": "no_license", "max_line_length": 53, "num_lines": 35, "path": "/stack/main.py", "repo_name": "eddydecena/data-structure", "src_encoding": "UTF-8", "text": "from typing import Union\nfrom collections import deque\n\ndef bracketReverse(bracket: str) -> Union[str, None]:\n open_list = ['(', '{', '[']\n close_list = [')', '}', ']']\n \n try:\n index = close_list.index(bracket)\n return open_list[index]\n except ValueError:\n return None\n\ndef bracketCheck(brackets: str) -> bool:\n stack = deque()\n \n for bracket in brackets:\n try:\n if stack[-1] == bracketReverse(bracket):\n stack.pop()\n else:\n stack.append(bracket)\n except IndexError:\n stack.append(bracket)\n \n return len(stack) == 0\n\nif __name__ == '__main__':\n string = '{{[[(())]]}}'\n results: bool = bracketCheck(string)\n \n if results:\n print('Not lint for bracket')\n else:\n print('Some lint for bracket')\n" }, { "alpha_fraction": 0.5415499806404114, "alphanum_fraction": 0.5415499806404114, "avg_line_length": 20.87755012512207, "blob_id": "6ac5555d5668877fd20b17a7eece1705d777205a", "content_id": "cdfd983e021cb36b090297d23ff24d53cac574b2", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1071, "license_type": "no_license", "max_line_length": 54, "num_lines": 49, "path": "/linked-list-algo/llist/node/doubly_node.py", "repo_name": "eddydecena/data-structure", "src_encoding": "UTF-8", "text": "# from typing import Any\n# from typing import Union\n\n# class DoublyNode():\n# def __init__(\n# self, value: Any,\n# prev: Union[int, None],\n# next: Union[int, None]) -> None:\n \n# self.value = value\n# self.next = next\n# self.prev = prev\n\nfrom typing import Any\nfrom typing import Optional\n\nfrom llist.node import Node\n\nclass DoublyNode(Node):\n def __init__(self, value: Any) -> None:\n super(DoublyNode, self).__init__()\n \n self._value = value\n self._next = None\n self._prev = None\n \n @property\n def value(self) -> Any:\n return self._value\n \n @value.setter\n def value(self, v: Any) -> None:\n self._value = v\n\n @property\n def next(self) -> Node:\n return self._next\n \n @next.setter\n def next(self, node: Optional[Node]=None) -> None:\n self._next = node\n \n @property\n def prev(self) -> None:\n return self._prev\n \n @prev.setter\n def prev(self, node: Optional[Node]=None):\n self._prev = node" }, { "alpha_fraction": 0.5729729533195496, "alphanum_fraction": 0.5783783793449402, "avg_line_length": 20.823530197143555, "blob_id": "2ea3974377af6b6603f4c9473918c9eebfa5faf9", "content_id": "78d88025ba439f0d971896df0c3105b3ae868323", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 370, "license_type": "no_license", "max_line_length": 55, "num_lines": 17, "path": "/breadth-first-search/graph/connected.py", "repo_name": "eddydecena/data-structure", "src_encoding": "UTF-8", "text": "from typing import Dict\nfrom typing import List\n\nfrom . import bfs\n\ndef connected(GRAPH: Dict[str, List[str]]):\n visited: List[str] = []\n count: int = 0\n \n for key in GRAPH:\n if key not in visited:\n count += 1\n \n visited_bfs = bfs(GRAPH, start=key)\n visited = list(set(visited) | set(visited_bfs))\n \n return count" }, { "alpha_fraction": 0.6431095600128174, "alphanum_fraction": 0.6607773900032043, "avg_line_length": 17.899999618530273, "blob_id": "fe0d24019b6ca063b373284c27faaff16dbe657c", "content_id": "7a62594ab464d5c58e0e121ba8b909464c6f7172", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 566, "license_type": "no_license", "max_line_length": 45, "num_lines": 30, "path": "/linked-list-algo/test.py", "repo_name": "eddydecena/data-structure", "src_encoding": "UTF-8", "text": "from llist import SinglyLinkedList\n\nllist = SinglyLinkedList()\nprint(f'Start Size: {llist.size}')\n\nfor i in range(20):\n print(f'Adding {i}')\n llist.head = i\n\nllist.add_first(21)\nllist.delete_last()\n\nnode = llist.head\nwhile node is not None:\n print(node.value)\n node = node.next\n\nprint(f'End Size: {llist.size}')\n\nprint(f'head value: {llist.head.value}')\nprint(f'Tail value: {llist.tail.value}')\n\nprint(f'{\"-\" * 10} After value^2 {\"-\" * 10}')\n\nllist.map(lambda x: x**2)\n\nnode = llist.head\nwhile node is not None:\n print(node.value)\n node = node.next" }, { "alpha_fraction": 0.46318289637565613, "alphanum_fraction": 0.4780285060405731, "avg_line_length": 23.071428298950195, "blob_id": "d292b4a5e1b4a610ecc4cc04245c2a2cbd7ed261", "content_id": "6e4683c19e24584c12fd09158a64c8c86959c074", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1684, "license_type": "no_license", "max_line_length": 69, "num_lines": 70, "path": "/priority-queue/main.py", "repo_name": "eddydecena/data-structure", "src_encoding": "UTF-8", "text": "class PriorityQueue():\n queue: list\n \n def __init__(self) -> None:\n self.queue = []\n \n def isEmpty(self) -> bool:\n return len(self.queue) == 0\n \n def insert(self, data) -> None:\n self.queue.append(data)\n \n def delete_max(self):\n try:\n max: int = 0\n for i, value in enumerate(self.queue):\n if value > self.queue[max]:\n max = i\n item = self.queue[max]\n del self.queue[max]\n return item\n except IndexError:\n print()\n exit()\n\nclass BinaryHeapPQ():\n heap: list\n N: int\n \n def __init__(self, capacity: int) -> None:\n self.heap = [None] * (capacity + 1)\n self.N = 0\n \n def insert(self, data) -> None:\n self.N += 1\n self.heap[self.N] = data\n self.swim(self.N)\n # print(self.heap)\n \n def delete_max(self) -> None:\n pass\n \n def swim(self, k: int):\n # print(k, self.heap[k//2], self.heap[k], self.less(k//2, k))\n while (k > 1) and self.less(k//2, k):\n self.swap(k//2, k)\n k //= 2\n print(k)\n \n def less(self, x: int, y: int):\n if self.heap[x] < self.heap[y]:\n return True\n return False\n\n def swap(self, i: int, min: int):\n temp = self.heap[i]\n self.heap[i] = self.heap[min]\n self.heap[min] = temp\n\nif __name__ == '__main__':\n pq: BinaryHeapPQ = BinaryHeapPQ(10)\n pq.insert(15)\n pq.insert(12)\n pq.insert(10)\n pq.insert(11)\n pq.insert(20)\n pq.insert(11)\n print(pq.heap)\n # print(pq.delete_max())\n # print(pq.queue)" }, { "alpha_fraction": 0.4639376103878021, "alphanum_fraction": 0.4710851311683655, "avg_line_length": 29.19607925415039, "blob_id": "2de484d71f6d2847cc8fcdfde41cd5d08b62c835", "content_id": "7bc51526f6468636a2b9e6c8f10cff7506611eca", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1539, "license_type": "no_license", "max_line_length": 65, "num_lines": 51, "path": "/breadth-first-search/graph/kruskal.py", "repo_name": "eddydecena/data-structure", "src_encoding": "UTF-8", "text": "from typing import List\n\nclass KrushalAlgo():\n vertices: int\n graph: List[List[int]]\n \n def __init__(self, vertices: int) -> None:\n self.vertices = vertices\n self.graph = []\n \n def add_edge(self, u: int=0, v: int=0, w: int=0) -> None:\n self.graph.append((u, v, w))\n \n def find(self, parent: list, i: int) -> int:\n if parent[i] == i:\n return i\n return self.find(parent, parent[i])\n \n def apply_union(self, parent, rank, x, y):\n xroot: int = self.find(parent, x)\n yroot: int = self.find(parent, y)\n \n if rank[xroot] < rank[yroot]:\n parent[xroot] = yroot\n elif rank[xroot] > rank[yroot]:\n parent[yroot] = xroot\n else: \n parent[yroot] = xroot\n rank[xroot] += 1\n \n def kruskal_algo(self) -> None:\n result: list = []\n i: int = 0 \n e: int = 0\n self.graph = sorted(self.graph, key=lambda item: item[2])\n parent: list = []\n rank: list = []\n for node in range(self.vertices):\n parent.append(node)\n rank.append(0)\n while e < self.vertices - 1:\n u, v, w = self.graph[i]\n i = i + 1\n x = self.find(parent, u)\n y = self.find(parent, v)\n if x != y:\n e = e + 1\n result.append([u, v, w])\n self.apply_union(parent, rank, x, y)\n for u, v, weight in result:\n print(\"%d - %d: %d\" % (u, v, weight))" }, { "alpha_fraction": 0.4494283199310303, "alphanum_fraction": 0.45646438002586365, "avg_line_length": 24.288888931274414, "blob_id": "b23b609e1ff73bba192fb600270cf8353ccfe83e", "content_id": "3d880a66e9662a84ae634ed43c4f79c4414ab8c7", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1137, "license_type": "no_license", "max_line_length": 64, "num_lines": 45, "path": "/union-find/main.py", "repo_name": "eddydecena/data-structure", "src_encoding": "UTF-8", "text": "class Node():\n def __init__(self, label):\n self.label = label\n self.parent = self\n self.rank = 0\n\nclass UnionFind():\n def __init__(self, labels) -> None:\n self.nodes = [Node(label) for label in labels]\n \n def find(self, x) -> Node:\n root = x\n \n # find op\n while root.parent != root:\n root = root.parent\n \n # path compression\n while x.parent != root:\n parent = x.parent\n x.parent = root\n x = parent # Why\n \n return root\n \n def union(self, x, y) -> None:\n x = self.find(x)\n y = self.find(y)\n \n if x == y: return\n \n if x.rank > y.rank:\n y.parent = x\n elif y.rank > x.rank:\n x.parent = y\n elif x.rank == y.rank:\n y.parent = x.parent\n x.rank += 1\n \nif __name__ == '__main__':\n uf = UnionFind('abcdefg')\n uf.union(uf.nodes[0], uf.nodes[1])\n uf.union(uf.nodes[0], uf.nodes[-1])\n r = uf.find(uf.nodes[0])\n print(f'{r.label} is the root node of {uf.nodes[-1].label}')" }, { "alpha_fraction": 0.6177777647972107, "alphanum_fraction": 0.6177777647972107, "avg_line_length": 27.25, "blob_id": "8a7ea7d76a6127b07eef56df4e3dc1275fd6dd44", "content_id": "40e796e12f8cc47a75f23e2da9d5b5ef01306abc", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 225, "license_type": "no_license", "max_line_length": 84, "num_lines": 8, "path": "/hash-tables/hasht/node/node.py", "repo_name": "eddydecena/data-structure", "src_encoding": "UTF-8", "text": "from typing import Any\nfrom typing import Optional\n\nclass Node():\n def __init__(self, key: str, value: Any, next: Optional[object] = None) -> None:\n self.key = key\n self.value = value\n self.next = next" }, { "alpha_fraction": 0.47256743907928467, "alphanum_fraction": 0.4804486334323883, "avg_line_length": 30.132076263427734, "blob_id": "22513ea38667194b2fe0af7ebff262e9f730b646", "content_id": "71c130bf8b918c774b3977719f7e9b87e7a66e4b", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3299, "license_type": "no_license", "max_line_length": 125, "num_lines": 106, "path": "/breadth-first-search/graph/dijkstras.py", "repo_name": "eddydecena/data-structure", "src_encoding": "UTF-8", "text": "from typing import List\nfrom typing import Tuple\nfrom typing import Dict\nfrom typing import Optional\nfrom queue import PriorityQueue\nimport heapq\nimport math\n\nclass Dijkstras():\n graph: Dict[int, List[Tuple[int]]]\n n: int\n m: int\n visited: List[bool]\n edgeCount: int\n mstCost: int\n mstEdges: int\n pq: PriorityQueue\n \n def __init__(self, vertices: int) -> None:\n self.n = vertices\n self.m = self.n - 1\n self.visited = [False] * self.n\n self.edgeCount = 0\n self.mstCost = 0\n self.mstEdges = [None] * self.m\n self.pq = PriorityQueue()\n self.ipq = []\n self.graph = {}\n \n heapq.heapify(self.ipq)\n \n for i in range(vertices):\n self.graph[i] = []\n \n def add_edge(self, u: int=0, v: int=0, w: int=0) -> None:\n \"\"\"\n u: Actual node\n v: Edge to\n w: Edge weight\n \"\"\"\n self.graph[u].append((v, w))\n \n def lazy(self, start: int = 0, end: Optional[int]=None, early_stop: Optional[bool]=False) -> Tuple[List[int], List[int]]:\n dist: List[int] = [math.inf] * self.n\n prev: List[int] = [None] * self.n\n \n dist[start] = 0\n \n self.pq.put((start, 0))\n \n while not self.pq.empty():\n index, min_value = self.pq.get()\n self.visited[index] = True\n if dist[index] < min_value: continue\n for edge in self.graph[index]:\n if self.visited[edge[0]]: continue\n \n new_dist = dist[index] + edge[1]\n \n if new_dist < dist[edge[0]]:\n prev[edge[0]] = index\n dist[edge[0]] = new_dist\n self.pq.put((edge[0], new_dist))\n if early_stop and (index == end):\n return dist[end]\n\n def eager(self, start: int = 0, end: Optional[int]=None, early_stop: Optional[bool]=False):\n dist: List[int] = [math.inf] * self.n\n prev: List[int] = [None] * self.n\n \n dist[start] = 0\n\n heapq.heappush(self.ipq, (start, start))\n \n while len(self.ipq) > 0:\n index, min_value = heapq.heappop(self.ipq)\n self.visited[index] = True\n if dist[index] < min_value: continue\n for edge in self.graph[index]:\n if self.visited[edge[0]]: continue\n \n new_dist = dist[index] + edge[1]\n \n if new_dist < dist[edge[0]]:\n prev[edge[0]] = index\n dist[edge[0]] = new_dist\n if not edge[0] in self.ipq:\n heapq.heappush(self.ipq, (edge[0], new_dist))\n else:\n heapq.heapreplace(self.ipq, (edge[0], new_dist))\n if early_stop and (index == end):\n return dist[end]\n \n def shortest_path(self, start: int, end: int):\n dist, prev = self.lazy(start=start, end=end)\n \n path: List[int] = []\n if (dist[end] == math.inf): return path\n \n at: int = end\n while at != None:\n path.append(at)\n at = prev[at]\n \n path.reverse()\n return path" } ]
41
IngabireTina/UssdApp
https://github.com/IngabireTina/UssdApp
2231db8ff195a49e4539e600fab198f590ec2654
ebf48cc6b22d7c6cfe97b97fcff203a48bbb6941
a447938d6a35d6a077e177d56b19537a94cca19c
refs/heads/master
2023-01-06T12:38:51.236980
2020-11-09T06:17:41
2020-11-09T06:17:41
311,268,318
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.6388235092163086, "alphanum_fraction": 0.6482353210449219, "avg_line_length": 31.653846740722656, "blob_id": "46795b8ab16418d9d307c2f9ab06ced864d60a13", "content_id": "e9751afea34557bf07ed19cd327b2ca17f05d5aa", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 850, "license_type": "no_license", "max_line_length": 122, "num_lines": 26, "path": "/ussdapp/models.py", "repo_name": "IngabireTina/UssdApp", "src_encoding": "UTF-8", "text": "from django.db import models\nfrom rest_framework import serializers\n\n\n# Create your models here.\nclass UssdApplication(models.Model):\n msisdn = models.IntegerField()\n session_id = models.IntegerField()\n code = models.CharField(max_length=40)\n newreq = models.CharField(max_length=40)\n\n # def __str__(self):\n # return self.msisdn\n # return str(self.msisdn) + \"session:\" + str(self.session_id) + \"new request: \" + str(self.newreq) + \"code:\" + str(\n # self.code)\n\n\nclass Task(models.Model):\n msisdn = models.IntegerField()\n session_id = models.IntegerField()\n code = models.CharField(max_length=40)\n newreq = models.CharField(max_length=40)\n\n def __str__(self):\n return str(self.msisdn) + \"session:\" + str(self.session_id) + \"new request: \" + str(self.newreq) + \"code:\" + str(\n self.code)\n\n" }, { "alpha_fraction": 0.8034188151359558, "alphanum_fraction": 0.8034188151359558, "avg_line_length": 22.600000381469727, "blob_id": "c1083020550342af28ed5968a7201a7de4151e1a", "content_id": "d0f08abc36213abef5b60353b2dbb0014c2298c0", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 117, "license_type": "no_license", "max_line_length": 32, "num_lines": 5, "path": "/ussdapp/admin.py", "repo_name": "IngabireTina/UssdApp", "src_encoding": "UTF-8", "text": "from django.contrib import admin\nfrom ussdapp.models import *\n\n# Register your models here.\nadmin.site.register(Task)" }, { "alpha_fraction": 0.658730149269104, "alphanum_fraction": 0.658730149269104, "avg_line_length": 33.3636360168457, "blob_id": "a0e3a2511b122114bb33fb58ce910bfe40be11a3", "content_id": "632defa3834d272920154d84353b4e9e201bf12b", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 378, "license_type": "no_license", "max_line_length": 69, "num_lines": 11, "path": "/ussdapp/urls.py", "repo_name": "IngabireTina/UssdApp", "src_encoding": "UTF-8", "text": "from django.urls import path\nfrom . import views\n\nurlpatterns = [\n\n path('ussd-done/', views.Welcome, name='user-done'),\n path('ussd-list/', views.listView, name='user-list'),\n path('ussd-detail/<str:pk>', views.listView, name='user-detail'),\n path('ussd-create/', views.createView, name='user-create'),\n path('users/', views.UserList.as_view(), name='users'),\n]\n" }, { "alpha_fraction": 0.6915512084960938, "alphanum_fraction": 0.6942333579063416, "avg_line_length": 30.06944465637207, "blob_id": "ccce492503fc3281e13e25261e8924b6b6fec0f1", "content_id": "22038fdd7a8555b9c28fe3b24a3f0397636de811", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2237, "license_type": "no_license", "max_line_length": 80, "num_lines": 72, "path": "/ussdapp/views.py", "repo_name": "IngabireTina/UssdApp", "src_encoding": "UTF-8", "text": "from django.http import HttpResponse, JsonResponse\nfrom django.shortcuts import render\nfrom rest_framework.response import Response\nfrom rest_framework.views import APIView\nfrom rest_framework.parsers import JSONParser\n\nfrom .models import UssdApplication, Task\nfrom .serializer import UssdSerializer\n# from rest_framework import serializer\nfrom rest_framework import status\nfrom rest_framework.decorators import api_view, renderer_classes\n\n\n# Create your views here.\nclass UserList(APIView):\n def get(self, request, format=None):\n users = Task.objects.all()\n serializer = UssdSerializer(users, many=True)\n return Response(serializer.data)\n\n def post(self, request, format=None):\n self.http_method_names.append(\"GET\")\n\n serializer = UssdSerializer(data=request.data)\n if serializer.is_valid():\n serializer.save()\n return Response(serializer.data, status=status.HTTP_201_CREATED)\n return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)\n\n\ndef Welcome(request):\n return HttpResponse(\"Welcome my app\")\n\n\n# class UssdList(APIView):\n# def get(self, request, **kwargs):\n# ussds = UssdApplication.objects.all()\n# serializers = UssdSerializer(ussds, many=True)\n# data = serializers.serialize('xml', UssdApplication.objects.all())\n# return Response(data)\n#\n# def post(self, request, **kwargs):\n# serializers = UssdSerializer(data=request.data)\n# if serializers.is_valid():\n# serializers.save()\n# data = serializers.serialize('xml', UssdApplication.objects.all())\n# # return Response(data)\n#\n# return Response(data)\n\n\n@api_view(['GET'])\ndef listView(request):\n ussdapp = Task.objects.all()\n serializer = UssdSerializer(ussdapp, many=True)\n return Response(serializer.data)\n\n\n@api_view(['GET'])\ndef detailView(request, pk):\n ussdapp = Task.objects.get(id=pk)\n serializer = UssdSerializer(ussdapp, many=False)\n return Response(serializer.data)\n\n\n@api_view(['POST'])\ndef createView(request):\n serializer = UssdSerializer(data=request.data)\n if serializer.is_valid():\n serializer.save()\n\n return Response(serializer.data)\n" }, { "alpha_fraction": 0.5099457502365112, "alphanum_fraction": 0.5307413935661316, "avg_line_length": 31.52941131591797, "blob_id": "cf7b94c911fa081d0f9af885c873f81468a19837", "content_id": "5152fec089f1796d9ebd5ebb85fd106c10d804e1", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1106, "license_type": "no_license", "max_line_length": 114, "num_lines": 34, "path": "/ussdapp/migrations/0001_initial.py", "repo_name": "IngabireTina/UssdApp", "src_encoding": "UTF-8", "text": "# Generated by Django 3.1.3 on 2020-11-07 04:30\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n initial = True\n\n dependencies = [\n ]\n\n operations = [\n migrations.CreateModel(\n name='Task',\n fields=[\n ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),\n ('msisdn', models.IntegerField()),\n ('session_id', models.IntegerField()),\n ('code', models.CharField(max_length=40)),\n ('newreq', models.CharField(max_length=40)),\n ],\n ),\n migrations.CreateModel(\n name='UssdApplication',\n fields=[\n ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),\n ('msisdn', models.IntegerField()),\n ('session_id', models.IntegerField()),\n ('code', models.CharField(max_length=40)),\n ('newreq', models.CharField(max_length=40)),\n ],\n ),\n ]\n" }, { "alpha_fraction": 0.7121211886405945, "alphanum_fraction": 0.7121211886405945, "avg_line_length": 23.75, "blob_id": "fd1cef6a7120cc0a62dc4e92af2e7380f6d14415", "content_id": "96c35312556c117e58313d5471c912c4ab292cc6", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 198, "license_type": "no_license", "max_line_length": 50, "num_lines": 8, "path": "/ussdapp/serializer.py", "repo_name": "IngabireTina/UssdApp", "src_encoding": "UTF-8", "text": "from rest_framework import serializers\nfrom .models import UssdApplication, Task\n\n\nclass UssdSerializer(serializers.ModelSerializer):\n class Meta:\n model = Task\n fields = '__all__'\n" } ]
6
DipaliBPawar/Text-Analyzer-Website
https://github.com/DipaliBPawar/Text-Analyzer-Website
b1564564b64f0fc9bdb0e16572a8cccfdbbb1f3b
a75aefd8051a08056ded628bab911e73473b4a03
4d41c5b5bb41058ac1f96e648910ded44a691d1c
refs/heads/main
2023-01-30T01:49:38.016989
2020-12-13T06:19:14
2020-12-13T06:19:14
321,131,067
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.5790027976036072, "alphanum_fraction": 0.579353928565979, "avg_line_length": 34.587501525878906, "blob_id": "94e89288d6861847ef55327bfa0d780e6c88e57f", "content_id": "360a4c3cb0211acc24ef056361d72404da1cb5a5", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2848, "license_type": "no_license", "max_line_length": 131, "num_lines": 80, "path": "/firstText/firstText/firstText/views.py", "repo_name": "DipaliBPawar/Text-Analyzer-Website", "src_encoding": "UTF-8", "text": "# file created by me\n\nfrom django.http import HttpResponse\nfrom django.shortcuts import render\n\ndef index(request):\n return render(request,'index.html')\n #return HttpResponse(\"Home\")\n\ndef analyze(request):\n #get the text\n djtext = request.POST.get('text','default')\n\n # Check checkbox values\n removepuc = request.POST.get('removpunc','off')\n capitalupper = request.POST.get('capitalize','off')\n newlineremover = request.POST.get('newlineremov','off')\n extraSpaceremove = request.POST.get('extrspacremov','off')\n chactercounter = request.POST.get('charcount','off')\n #print(removepuc)\n #print(djtext)\n\n # check which checkbx is on\n # Remove Punctuations\n if removepuc == \"on\":\n #analyze the text\n #analyzed = djtext\n punctuations = '''!()-[]{};:'\"\\,<>./?@#$%^&*_~'''\n analyzed = \"\"\n for char in djtext:\n if char not in punctuations:\n analyzed=analyzed + char\n params = {'purpose':'Removed Punctuation','analyze_text':analyzed}\n djtext = analyzed\n #return render(request,'analyze.html',params)\n\n # Change into Uppercase\n if (capitalupper == \"on\"):\n analyzed = \"\"\n for char in djtext:\n analyzed = analyzed+char.upper()\n params = {'purpose': 'Capitalized Letter', 'analyze_text': analyzed}\n djtext = analyzed\n #return render(request, 'analyze.html', params)\n\n # Remove New Line or Whitespace\n if newlineremover == \"on\":\n analyzed = \"\"\n for char in djtext:\n if char !=\"\\n\" and char!=\"\\r\":\n analyzed = analyzed + char\n else:\n print(\"no\")\n print(\"pre\", analyzed)\n params = {'purpose': 'Remove new Line', 'analyze_text': analyzed}\n djtext = analyzed\n #return render(request, 'analyze.html', params)\n\n # Remove Extra Space from Text\n if extraSpaceremove == \"on\":\n analyzed = \"\"\n for index, char in enumerate(djtext):\n if not (djtext[index]== \" \" and djtext[index + 1] == \" \"):\n analyzed = analyzed + char\n params = {'purpose': 'Extra Space Remove ', 'analyze_text': analyzed}\n djtext = analyzed\n #return render(request, 'analyze.html', params)\n\n # Count Character\n if chactercounter == \"on\":\n analyzed = len(djtext)\n\n params = {'purpose': 'Count Character for Text', 'analyze_text': analyzed}\n # djtext = analyzed\n #return render(request, 'analyze.html', params)\n\n if (removepuc!= \"on\" and capitalupper!= \"on\" and newlineremover!= \"on\" and extraSpaceremove!= \"on\" and chactercounter!= \"on\"):\n return HttpResponse(\"Enter Some Tesxt!!!!!!!!!!\")\n\n return render(request, 'analyze.html', params)\n\n" } ]
1
yarmoscow/hw-iterators
https://github.com/yarmoscow/hw-iterators
30ae70e72faa3345642681bc3d53bd23ee0672b0
47f6a0f580de4e3199339c6156a57d0b9d105348
fa3e443124ff9e06d341daa42355fc239251f9b4
refs/heads/master
2023-06-01T01:33:39.950482
2021-06-24T20:59:23
2021-06-24T20:59:23
380,049,068
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.6229838728904724, "alphanum_fraction": 0.6283602118492126, "avg_line_length": 29.367347717285156, "blob_id": "a6588e92f1ee8f105e0ae54cc47c69d7d3ad3010", "content_id": "f2fd6ca97513ce834a34608d38db150b0f4e7a32", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1566, "license_type": "no_license", "max_line_length": 81, "num_lines": 49, "path": "/main.py", "repo_name": "yarmoscow/hw-iterators", "src_encoding": "UTF-8", "text": "import json\nimport re\nimport hashlib\n\nCOUNTRIES_FILE = 'countries.json'\nWIKI_URL = 'https://en.wikipedia.org/wiki/'\nCOUNTRIES_OUTPUT_FILE = 'countries.txt'\n\n\n# Класс для первого задания по итераторам.\nclass GetCountriesPages:\n\n def __init__(self, countries_json_file, url):\n self.url = url\n self.countries_json_file = countries_json_file\n\n def __iter__(self):\n with open(self.countries_json_file, 'r', encoding='utf-8') as f:\n self.countries_json_content = json.load(f)\n return self\n\n def __next__(self):\n if not self.countries_json_content:\n raise StopIteration\n current_country = self.countries_json_content.pop(0)\n current_country_name = current_country['name']['common']\n current_country_url = WIKI_URL + re.sub(r'\\s', '_', current_country_name)\n return current_country_name, current_country_url\n\n\n# Функция для задания 2 по генераторам\ndef gethash(filename):\n with open(filename, 'r', encoding='utf-8') as f:\n line = f.readline().strip()\n while line:\n yield hashlib.md5(line.encode()).hexdigest()\n line = f.readline().strip()\n\n\nif __name__ == '__main__':\n\n # Задание 1\n with open(COUNTRIES_OUTPUT_FILE, 'w', encoding='utf-8') as f:\n for country, url in GetCountriesPages(COUNTRIES_FILE, WIKI_URL):\n f.write(f'{country} - {url}\\n')\n\n # Задание 2\n for line_hash in gethash(COUNTRIES_OUTPUT_FILE):\n print(line_hash)\n" } ]
1
semihucann/face_Authentication_with_LBPH
https://github.com/semihucann/face_Authentication_with_LBPH
b32767e86dc26cfedecceada91a7f352aaf22758
e852804f573efdc56fe509951f4383eda4d06f87
164c5eca49fd60410156979eff4fc8d823a8ada6
refs/heads/master
2020-06-11T19:39:11.919756
2019-07-29T11:54:46
2019-07-29T11:54:46
194,063,338
1
0
null
null
null
null
null
[ { "alpha_fraction": 0.5941058397293091, "alphanum_fraction": 0.6001339554786682, "avg_line_length": 33.5476188659668, "blob_id": "2a9fceec1cd9118496cacdf6eedb11958f509a1d", "content_id": "8546c30f95ef4bfa2e26415962da4580be3707ae", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1493, "license_type": "no_license", "max_line_length": 119, "num_lines": 42, "path": "/faceTrainer.py", "repo_name": "semihucann/face_Authentication_with_LBPH", "src_encoding": "UTF-8", "text": "import cv2, os\r\nimport numpy as np\r\nfrom PIL import Image\r\n\r\nrecognizer = cv2.face.LBPHFaceRecognizer_create()\r\ndetector = cv2.CascadeClassifier(\"C:/Users/Cezeri_NPC/Desktop/opencv/haarcascades/haarcascade_frontalface_default.xml\")\r\n\r\nmyPath = (\"C:/Users/Cezeri_NPC/Desktop/opencv/users/\")\r\nusernames =[\"1\",\"2\",\"3\",\"4\",\"5\"]\r\n\r\n\r\ndef getImagesAndLabels():\r\n # get the path of all the files in the folder\r\n imagePaths=[]\r\n # create empth face list\r\n faceSamples = []\r\n # create empty ID list\r\n Ids = []\r\n for i in usernames:\r\n tmp = myPath\r\n tmp += i\r\n\r\n for f in os.listdir(tmp):\r\n imagePaths.append(tmp + \"/\" + f)\r\n # loading the image and converting it to gray scale\r\n pilImage = Image.open(tmp + \"/\" + f).convert('L')\r\n # Now we are converting the PIL image into numpy array\r\n imageNp = np.array(pilImage, 'uint8')\r\n # getting the Id from the image\r\n Id = int(i)\r\n # extract the face from the training image sample\r\n faces = detector.detectMultiScale(imageNp)\r\n # If a face is there then append that in the list as well as Id of it\r\n for (x, y, w, h) in faces:\r\n faceSamples.append(imageNp[y:y + h, x:x + w])\r\n Ids.append(Id)\r\n\r\n return faceSamples, Ids\r\n\r\nfaces,Ids = getImagesAndLabels()\r\nrecognizer.train(faces, np.array(Ids))\r\nrecognizer.save('C:/Users/Cezeri_NPC/Desktop/opencv/arda.yml')\r\n" }, { "alpha_fraction": 0.5636792182922363, "alphanum_fraction": 0.599056601524353, "avg_line_length": 33.22222137451172, "blob_id": "f17bdf22e3918f0adc7edbc736fe2893877a2d12", "content_id": "4cde6d5154997e53d17a7c7f5aed750c8d1a8e29", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1272, "license_type": "no_license", "max_line_length": 123, "num_lines": 36, "path": "/personDetect.py", "repo_name": "semihucann/face_Authentication_with_LBPH", "src_encoding": "UTF-8", "text": "import cv2\r\nimport numpy as np\r\n\r\ncap = cv2.VideoCapture(0)\r\n\r\nface_cascade = cv2.CascadeClassifier('C:/Users/Cezeri_NPC/Desktop/opencv/haarcascades/haarcascade_frontalface_default.xml')\r\neye_cascade = cv2.CascadeClassifier('C:/Users/Cezeri_NPC/Desktop/opencv/haarcascades/haarcascade_eye.xml')\r\n\r\nwhile(True):\r\n ret, frame = cap.read()\r\n gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)\r\n\r\n faces = face_cascade.detectMultiScale(gray, 1.3, 5)\r\n\r\n for(x,y,w,h) in faces:\r\n frame = cv2.rectangle(frame, (x,y), (x+w,y+h),(255,0,0),2)\r\n font = cv2.FONT_HERSHEY_SIMPLEX\r\n cv2.putText(frame, 'Face', (x+5, y+h-5), font, 1, (255, 0, 0), 2, cv2.LINE_AA)\r\n roi_gray = gray[y:y+h, x:x+w]\r\n roi_color = gray[y:y+h, x:x+w]\r\n eyes = eye_cascade.detectMultiScale(roi_gray)\r\n\r\n eyes = eye_cascade.detectMultiScale(gray, 1.3, 5)\r\n\r\n for (ex, ey, ew, eh) in eyes:\r\n frame = cv2.rectangle(frame, (ex, ey), (ex + ew, ey + eh), (0, 255, 0), 2)\r\n roi_gray = gray[y:y + h, x:x + w]\r\n roi_color = gray[y:y + h, x:x + w]\r\n eyes = eye_cascade.detectMultiScale(roi_gray)\r\n\r\n cv2.imshow('frame', frame)\r\n\r\n if cv2.waitKey(1) & 0xFF == ord('q'):\r\n break\r\ncap.release()\r\ncv2.destroyAllWindows()\r\n\r\n\r\n" }, { "alpha_fraction": 0.7761557102203369, "alphanum_fraction": 0.7846715450286865, "avg_line_length": 33.20833206176758, "blob_id": "b5efb34b3a3d94f0f311073820f996c53c204622", "content_id": "f5f63cfa6500180b36500e24533b667081fe9437", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 822, "license_type": "no_license", "max_line_length": 204, "num_lines": 24, "path": "/README.md", "repo_name": "semihucann/face_Authentication_with_LBPH", "src_encoding": "UTF-8", "text": "# Face Authentication with LBPH Algorithm\n\n## Introduction\n\n> Local Binary Pattern (LBP) is a simple yet very efficient texture operator which labels the pixels of an image by thresholding the neighborhood of each pixel and considers the result as a binary number.\n\n![](https://github.com/semihucann/face_Authentication_with_LBPH/blob/master/algo.jpg)\n\n##### More information about the algorithm\n[Face Recognition: Understanding LBPH Algorithm](https://towardsdatascience.com/face-recognition-how-lbph-works-90ec258c3d6b)\n\n## Usage\n\n### personDetect.py\nPeople's faces and eyes are detected by haarcascade. \n\n### faceRecognation.py\nThe code creates datasets to train from people faces.\n\n### faceTrainer.py\nThe code creates trained data (.yml) from datasets.\n\n### faceAuthantication.py\nThe code provides to authentication.\n\n" }, { "alpha_fraction": 0.5426356792449951, "alphanum_fraction": 0.586240291595459, "avg_line_length": 29.33333396911621, "blob_id": "90a3eec57a607fbc3b19cf1b099d5178789abd5d", "content_id": "737b27f14a4c0b91cff0a61d7c8a8fb94dd770b6", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1032, "license_type": "no_license", "max_line_length": 123, "num_lines": 33, "path": "/faceRecognation.py", "repo_name": "semihucann/face_Authentication_with_LBPH", "src_encoding": "UTF-8", "text": "import cv2\r\nimport numpy as np\r\nimport time\r\n\r\ncap = cv2.VideoCapture(0)\r\n\r\nface_cascade = cv2.CascadeClassifier('C:/Users/Cezeri_NPC/Desktop/opencv/haarcascades/haarcascade_frontalface_default.xml')\r\n\r\nuserName = input(\"Kullanıcı adı giriniz: \")\r\n\r\nflag = 0\r\n\r\nwhile(True):\r\n ret, frame = cap.read()\r\n gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)\r\n\r\n faces = face_cascade.detectMultiScale(gray, 1.3, 5)\r\n flag =flag+1\r\n for (x, y, w, h) in faces:\r\n frame = cv2.rectangle(frame, (x, y), (x + w, y + h), (69, 139, 116), 2)\r\n font = cv2.FONT_HERSHEY_SIMPLEX\r\n cv2.putText(frame, 'Face', (x + 5, y + h - 5), font, 1, (69, 139, 116), 2, cv2.LINE_AA)\r\n roi_gray = gray[y:y + h, x:x + w]\r\n roi_color = gray[y:y + h, x:x + w]\r\n cv2.imwrite(\"C:/Users/Cezeri_NPC/Desktop/opencv/users/\"+str(userName)+str(flag)+\".jpg\", frame[y:y+h, x:x+w])\r\n time.sleep(0.2)\r\n\r\n cv2.imshow('frame', frame)\r\n\r\n if cv2.waitKey(1) & 0xFF == ord('q'):\r\n break\r\ncap.release()\r\ncv2.destroyAllWindows()" }, { "alpha_fraction": 0.5196706056594849, "alphanum_fraction": 0.5553522706031799, "avg_line_length": 26.763158798217773, "blob_id": "caa906e4d9db251e5dba27ce326916e902516b4d", "content_id": "45a88e14d08beeec560787f7c4a28434141bc9a3", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1094, "license_type": "no_license", "max_line_length": 121, "num_lines": 38, "path": "/faceAuthentication.py", "repo_name": "semihucann/face_Authentication_with_LBPH", "src_encoding": "UTF-8", "text": "import cv2\r\nimport numpy as np\r\n\r\nfaceDetect = cv2.CascadeClassifier(\"C:/Users/Cezeri_NPC/Desktop/opencv/haarcascades/haarcascade_frontalface_default.xml\")\r\n\r\ncam = cv2.VideoCapture(0)\r\nrec = cv2.face.LBPHFaceRecognizer_create()\r\nrec.read(\"C:/Users/Cezeri_NPC/Desktop/opencv/arda.yml\")\r\nid=0\r\nfont = cv2.FONT_HERSHEY_SIMPLEX\r\n\r\nwhile(True):\r\n ret, img = cam.read()\r\n gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)\r\n faces = faceDetect.detectMultiScale(gray,1.3,5)\r\n for (x,y,w,h) in faces:\r\n cv2.rectangle(img, (x,y), (x+w,y+h),(255,0,0),2)\r\n id, conf = rec.predict(gray[y:y+h,x:x+w])\r\n if(id==1):\r\n id=\"almla\"\r\n elif(id==2):\r\n id=\"semih\"\r\n elif(id==3):\r\n id=\"yusuf\"\r\n elif(id==4):\r\n id=\"zeynep\"\r\n elif(id==5):\r\n id=\"arda\"\r\n else:\r\n id=\"bulunamadı\"\r\n\r\n\r\n cv2.putText(img, str(id), (x,y+h), font, 1, (255, 0, 0), 2, cv2.LINE_AA)\r\n cv2.imshow(\"Face\",img)\r\n if cv2.waitKey(1) & 0xFF == ord('q'):\r\n break\r\ncam.release()\r\ncv2.destroyAllWindows()\r\n" }, { "alpha_fraction": 0.5484818816184998, "alphanum_fraction": 0.5847208499908447, "avg_line_length": 27.91176414489746, "blob_id": "9fcfbafee606af0cd230a5e60443cf8ac9e5f413", "content_id": "051d5b35e81b32805ecd4bb7bdf1f51cef6cc8e4", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1022, "license_type": "no_license", "max_line_length": 126, "num_lines": 34, "path": "/carDetectFromVideo.py", "repo_name": "semihucann/face_Authentication_with_LBPH", "src_encoding": "UTF-8", "text": "import cv2\r\nimport numpy as np\r\n\r\nx = input(\"Hangi video ?\")\r\ncap = cv2.VideoCapture('car'+ x +'.mp4')\r\n\r\ny = input(\"Hangi tür ?\")\r\ny=1\r\n\r\nif(y==1):\r\n car_cascade = cv2.CascadeClassifier('C:/Users/Cezeri_NPC/Desktop/opencv/haarcascades/cars.xml')\r\nelse:\r\n car_cascade = cv2.CascadeClassifier('C:/Users/Cezeri_NPC/Desktop/opencv/haarcascades/haarcascade_frontalface_default.xml')\r\n\r\nwhile(cap.isOpened()):\r\n ret, frame = cap.read()\r\n\r\n gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)\r\n\r\n cars = car_cascade.detectMultiScale(gray, 1.3, 5)\r\n for (x, y, w, h) in cars:\r\n frame = cv2.rectangle(frame, (x, y), (x + w, y + h), (255, 0, 0), 2)\r\n font = cv2.FONT_HERSHEY_SIMPLEX\r\n cv2.putText(frame, 'Car', (x + 5, y + h - 5), font, 1, (255, 0, 0), 1, cv2.LINE_AA)\r\n roi_gray = gray[y:y + h, x:x + w]\r\n roi_color = gray[y:y + h, x:x + w]\r\n\r\n cv2.imshow('frame',frame)\r\n if cv2.waitKey(1) & 0xFF == ord('q'):\r\n break\r\n\r\n\r\ncap.release()\r\ncv2.destroyAllWindows()\r\n\r\n\r\n" } ]
6
ianpavlovic/Number-Guessing-Game
https://github.com/ianpavlovic/Number-Guessing-Game
13953d56a51880b0346e3fb72f2741574e2140ae
e0e8a406ce4329d654a093cad2e6ffedf8b8b307
448e3c462a4e4a9915ad0170913a2d1c7ace22ff
refs/heads/main
2023-09-05T09:40:59.949900
2021-10-06T01:02:00
2021-10-06T01:02:00
414,026,068
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.495719850063324, "alphanum_fraction": 0.5081712007522583, "avg_line_length": 28.88372039794922, "blob_id": "5176ec617c8d661bfcec01520b5403e0516bb0ed", "content_id": "030caf1c253f232b10a88df62b8082207b05ba4a", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1285, "license_type": "no_license", "max_line_length": 81, "num_lines": 43, "path": "/guessing_game.py", "repo_name": "ianpavlovic/Number-Guessing-Game", "src_encoding": "UTF-8", "text": "import random\nimport sys\n\nSOLUTION = random.randint(1,10)\n\ndef intro():\n print(\"--------------------------------------\")\n print(\"Hello, Welcome to Number Guessing Game\")\n print(\"--------------------------------------\\n\")\n\ndef game():\n try:\n tries = 1\n number_chosen = int(input(\"Please pick a number form 1 to 10 \"))\n except ValueError:\n print(\"Thats not a valid value please try again...\")\n else:\n while number_chosen != SOLUTION:\n if number_chosen < SOLUTION:\n print(\"It's Higher\")\n tries += 1\n number_chosen = int(input(\"Please pick a number form 1 to 10 \"))\n elif number_chosen > SOLUTION:\n print(\"It's Lower\")\n tries += 1\n number_chosen = int(input(\"Please pick a number form 1 to 10 \"))\n print(\"You got it! YOU WON!!\")\n print(\"You got it in a total of {} tries\".format(tries))\n play_again()\n\ndef play_again():\n next_game = input(\"Would you like to play again?? [y]es / [n]o: \").lower()\n if next_game == \"n\":\n print(\"Thank you for playing. See you next time =)\")\n sys.exit(0)\n elif next_game == \"y\":\n play_game()\n\ndef play_game():\n intro()\n game()\n\nplay_game()\n" }, { "alpha_fraction": 0.7818182110786438, "alphanum_fraction": 0.800000011920929, "avg_line_length": 26.5, "blob_id": "4c49c68258924edfddf0602ff4aa650139f1f536", "content_id": "4a28c9de2530fabcd306c359e4c85dd752540202", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 55, "license_type": "no_license", "max_line_length": 31, "num_lines": 2, "path": "/README.md", "repo_name": "ianpavlovic/Number-Guessing-Game", "src_encoding": "UTF-8", "text": "# Number-Guessing-Game\n Number Guessing Game Project 1\n" } ]
2
Banhkun/Seam-carving-for-content-aware-image-resizing
https://github.com/Banhkun/Seam-carving-for-content-aware-image-resizing
d454ecfdb5d08e21bbb1ddea34d8cdd782060379
66b79d7035ab4ae2b4bde7f16b14054881f977fd
6eddf0ebb5f7636030af61863cd9f9f6335b9f19
refs/heads/master
2022-02-25T18:57:39.396941
2018-03-28T06:51:18
2018-03-28T06:51:18
null
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.7401496171951294, "alphanum_fraction": 0.7511221766471863, "avg_line_length": 56.25714111328125, "blob_id": "0c2d1c215d0d1a16ae836693eef3d78ab3a5cca8", "content_id": "5aff94f23964e1c09ab1eb8863f5ff4264c12353", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 2005, "license_type": "no_license", "max_line_length": 332, "num_lines": 35, "path": "/README.md", "repo_name": "Banhkun/Seam-carving-for-content-aware-image-resizing", "src_encoding": "UTF-8", "text": "# Seam-carving-for-content-aware-image-resizing\nBased on the research paper of Mr. Shai Avidan and Mr. Ariel Shamir\nLink: http://www.faculty.idc.ac.il/arik/SCWeb/imret/imret.pdf\n\nLibraries used: os, struct, sys, Python Imaging Library, Tkinter, tkFileDialog, unittest\n\nTools used: python (IDLE)\n\nBrief Explanation:\n\nTo crop an image we remove the vertical seam(red color line) as shown in the following pictures:\n\n![pic 1](https://github.com/gov-vj/Seam-carving-for-content-aware-image-resizing/blob/master/pictures/with_seam.png)\n![pic 2](https://github.com/gov-vj/Seam-carving-for-content-aware-image-resizing/blob/master/pictures/with_seam2.png)\n\nAfter removing vertically seam iteratively multiple times the result was:\n![pic 3](https://github.com/gov-vj/Seam-carving-for-content-aware-image-resizing/blob/master/pictures/result_pic.png)\n\nOriginal pic:\n\n![pic_3](https://github.com/gov-vj/Seam-carving-for-content-aware-image-resizing/blob/master/pictures/sunset_full.png)\n\n##### A vertical seam is a connected path of low energy pixels crossing the image from top to bottom (or left to right).\n\nAn energy function defines the similarity of a pixel from it's neighboring pixels. More similar the pixel from it's neighboring pixels less its energy value.\n\nSo, the vertical seam is very similar to its neighbors and therefore, we can remove it by not losing significant information.\n\nThis can be done using dynamic programming.\n\ndp(i,j)::=energy(i,j)+min[dp(i,j-1), dp(i+1,j-1), dp(i-1,j-1)] // neighbors of (i,j) in the above layer (j-1 layer)\n\nparent(i,j)::= (i,j-1) if dp(i,j-1) is minimum in above function; (i+1,j-1) if dp(i+1,j-1) is min; (i-1,j-1) if dp(i-1,j-1) is min.\n\nFrom the equation of dp(i,j), it is clear that in any vertical seam the value of dp(i,j) increases as we go down. So, to find the vertical seam of the minimum energy among all other possible seams we first find the minimum value of dp(i,j) in the last layer (j=height-1) and then traverse from bottom to up using the parent pointer. \n" }, { "alpha_fraction": 0.39020270109176636, "alphanum_fraction": 0.4298986494541168, "avg_line_length": 37.19355010986328, "blob_id": "27f4094a4ea9ca313663c8c71801f7b3691ab176", "content_id": "c4d5ba794e74523ad14ef0129e9fc4ccb75774cd", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1184, "license_type": "no_license", "max_line_length": 105, "num_lines": 31, "path": "/resizeable_image.py", "repo_name": "Banhkun/Seam-carving-for-content-aware-image-resizing", "src_encoding": "UTF-8", "text": "import imagematrix\n\nclass ResizeableImage(imagematrix.ImageMatrix):\n def best_seam(self):\n dp=dict()\n for j in range(self.height):\n for i in range(self.width):\n if j==0: dp[i,j]=self.energy(i,j),None\n elif self.width==1:\n dp[i,j]=dp[i,j-1][0]+self.energy(i,j),(i,j-1)\n elif i==0:\n x=min([(dp[i,j-1][0],(i,j-1)),(dp[i+1,j-1][0],(i+1,j-1))])\n dp[i,j]=x[0]+self.energy(i,j),x[1]\n elif i==self.width-1:\n x=min([(dp[i,j-1][0],(i,j-1)),(dp[i-1,j-1][0],(i-1,j-1))])\n dp[i,j]=x[0]+self.energy(i,j),x[1]\n else:\n x=min([(dp[i,j-1][0],(i,j-1)),(dp[i+1,j-1][0],(i+1,j-1)),(dp[i-1,j-1][0],(i-1,j-1))])\n dp[i,j]=x[0]+self.energy(i,j),x[1]\n path=[]\n u=min([(dp[i,self.height-1][0],i) for i in range(self.width)])\n x=u[1],self.height-1\n while x is not None:\n path.append(x)\n x=dp[x][1]\n path.reverse()\n return path\n \n\n def remove_best_seam(self):\n self.remove_seam(self.best_seam())\n" } ]
2
defireous/WebScrapingProject
https://github.com/defireous/WebScrapingProject
43d3d0aa8b3333c74ad5e76f810a6ca6cd5bf439
aa4de4e623167f18b823fcfdf617b4a3923c2bd9
27f2450f58e28bf828f46347938b0a7899160b54
refs/heads/main
2023-07-12T12:16:49.384537
2021-08-10T14:38:51
2021-08-10T14:38:51
394,682,274
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.7815126180648804, "alphanum_fraction": 0.7983193397521973, "avg_line_length": 38.66666793823242, "blob_id": "14529a498bc4e762fd37532acb161123bf7e2c9a", "content_id": "3c42e4c4bfc7c3dc043b5dbfbc56fdcbb923d707", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 119, "license_type": "no_license", "max_line_length": 65, "num_lines": 3, "path": "/README.md", "repo_name": "defireous/WebScrapingProject", "src_encoding": "UTF-8", "text": "# WebScrapingProject\n1. Using python library Beautiful Soup to scrape web \"pythonjobs\"\n2. Saving file format csv file.\n" }, { "alpha_fraction": 0.6596461534500122, "alphanum_fraction": 0.6655433773994446, "avg_line_length": 27.261905670166016, "blob_id": "32a7c721dd23d0857d91453f776e4e575ec4c57d", "content_id": "0a068316174686c448476806de67615a1beacd61", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1187, "license_type": "no_license", "max_line_length": 171, "num_lines": 42, "path": "/pythonjobs.py", "repo_name": "defireous/WebScrapingProject", "src_encoding": "UTF-8", "text": "import requests\nfrom bs4 import BeautifulSoup\nimport pandas as pd\n\n\ndef getUrl(url):\n response = requests.get(url).text\n return response\n\n\nresponse = getUrl('https://pythonjobs.github.io/')\nsoup = BeautifulSoup(response, 'lxml')\n\njobs = soup.find_all('div', class_='job')\n\nname_list = []\nworkplace_list = []\ncalendar_list = []\ntype_list = []\noffice_list = []\nmore_info_list = []\njob_description_list = []\n\nfor job in jobs:\n job_detail = job.find_all('span', class_='info')\n temp_list = []\n for i in job_detail:\n temp_list.append(i.text)\n\n name_list.append(job.h1.a.text)\n workplace_list.append(temp_list[0])\n calendar_list.append(temp_list[1])\n type_list.append(temp_list[2])\n office_list.append(temp_list[3])\n more_info_list.append(job.a['href'])\n job_description_list.append(job.p.text)\n\njob_frame = {'Position': name_list, 'Workplace': workplace_list, 'Calendar': calendar_list,\n 'Type': type_list, 'Office': office_list, 'Description': job_description_list, 'More Info': ['https://pythonjobs.github.io/' + i[1:] for i in more_info_list]}\n\njob_dt = pd.DataFrame(job_frame)\nout_file = job_dt.to_csv('PythonJobs.csv', index=False)\n" } ]
2
mukeshmithrakumar/PythonUtils
https://github.com/mukeshmithrakumar/PythonUtils
cbfb80d3d4ebd473bd64c6965756d2cae6955faf
c077da4faded8d4688ff04c4020575264028ee75
58e0964289739b8472feafa16b596adb49562b72
refs/heads/master
2020-05-24T05:30:22.007955
2019-05-17T00:08:45
2019-05-17T00:08:45
187,117,551
1
1
null
null
null
null
null
[ { "alpha_fraction": 0.5915966629981995, "alphanum_fraction": 0.5915966629981995, "avg_line_length": 28.75, "blob_id": "666241a665667e26cbb18493e777bb3d277552e8", "content_id": "da1065486f245c883bd34ef9e832058231c332f3", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 595, "license_type": "permissive", "max_line_length": 115, "num_lines": 20, "path": "/PythonMasterclass/Exercise4.py", "repo_name": "mukeshmithrakumar/PythonUtils", "src_encoding": "UTF-8", "text": "\"\"\"\nAdd to the program below so that if it finds a meal without spam it prints out each of the ingredients of the meal.\n\"\"\"\n\n\nmenu = []\nmenu.append([\"egg\", \"spam\", \"bacon\"])\nmenu.append([\"egg\", \"sausage\", \"bacon\"])\nmenu.append([\"egg\", \"spam\"])\nmenu.append([\"egg\", \"bacon\", \"spam\"])\nmenu.append([\"egg\", \"bacon\", \"sausage\", \"spam\"])\nmenu.append([\"spam\", \"bacon\", \"sausage\", \"spam\"])\nmenu.append([\"spam\", \"egg\", \"spam\", \"spam\", \"bacon\", \"spam\"])\nmenu.append([\"spam\", \"egg\", \"sausage\", \"spam\"])\n\n\nfor lists in menu:\n for food in lists:\n if food!= 'spam':\n print(food, end= ' ')\n" }, { "alpha_fraction": 0.6912219524383545, "alphanum_fraction": 0.702629566192627, "avg_line_length": 33.945945739746094, "blob_id": "12d05ed168834c111a2e1a85bef1437bafe1d9af", "content_id": "e1e6a659dfb09981386b6b718f1c4ef7a04a5078", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 5172, "license_type": "permissive", "max_line_length": 118, "num_lines": 148, "path": "/Helpers/PandasHelpers.py", "repo_name": "mukeshmithrakumar/PythonUtils", "src_encoding": "UTF-8", "text": "import pandas as pd\nimport json\n\n\n# read csv and assign headers\nheaders1 = ['LabelName', 'ClassDescription']\nclass_description_boxable = pd.read_csv(path + \"class_descriptions_boxable.csv\", names = headers1)\n\n# Preprocessing Data for OD\n# make a list with the downloaded images\nimport pandas as pd\nimport os\nimport csv\n\n# goes to the directory of the train images and creates a list of the downloaded images\ndirectory = \"C:\\\\Users\\\\Mukesh\\\\GoogleAI\\\\DataFiles\\\\challenge2018_train\\\\\"\ndownloaded_list = []\nfor filename in os.listdir(directory):\n downloaded_list.append(filename)\n\n# strips the imgs of the .jpg tag, see if you can add it to the for loop above\ndownloaded_list = [imgs.strip('.jpg') for imgs in downloaded_list]\n\n# convert the downloaded imgs list to a dataframe and load the annotations df\npath_to_datafiles = \"C://Users//Mukesh//GoogleAI//DataFiles_VRD//\"\nannotations = pd.read_csv(path_to_datafiles + \"Annotations_boxes.csv\")\nannotations = pd.DataFrame(annotations)\n\n# create a new df with descriptions from annotations for the downloaded images\ndownloaded_df_train = annotations[annotations['ImageID'].isin(downloaded_list)]\n\n# drop columns not needed for the model\ndrop_columns = ['Source', 'LabelName', 'Confidence', 'IsOccluded', 'IsTruncated', 'IsGroupOf', 'IsDepiction',\n 'IsInside']\ndownloaded_df_train = downloaded_df_train.drop(columns=drop_columns)\n\n# create a dictionary with MID labels to label names\ndescriptions_file = csv.reader(open(path_to_datafiles + \"class_descriptions_boxable.csv\", 'r'))\ndescriptions_file_dict = {}\nfor row in descriptions_file:\n k, v = row\n descriptions_file_dict[k] = v\n\n# convert the MID LabelNames to human readable Label names\ndownloaded_df_train['Label'] = downloaded_df_train.Label.map(descriptions_file_dict)\n\n# adding file path as a prefix and .jpg as a suffix to the ImageID to fit the input file\ndownloaded_df_train['ImageID'] = downloaded_df_train['ImageID'].apply(lambda x: \"{}{}{}\".format(directory, x, '.jpg'))\n\n# reorder columns to fit the input file\ndownloaded_df_train_clean = downloaded_df_train[['ImageID', 'XMin', 'YMin', 'XMax', 'YMax', 'Label']]\n\n# export the df as a txt file\ndownloaded_df_train_clean.to_csv('challenge2018_train.txt', index=False, header=False)\n\n# make a column appending Label1Name + Relationship + Label2Name\n\nrel_triplet_annotations2['Img_desc'] = rel_triplet_annotations2['LabelName1'] + ' ' + \\\n rel_triplet_annotations2['RelationshipLabel'] + ' ' + \\\n rel_triplet_annotations2['LabelName2']\n\n# multiply a column by a specific value\ntrain['XMin1'] = train['XMin1'].apply(lambda x: int(x*width))\n\n# subtract a two columns to create a new one\ntrain ['box1length'] = train['XMax1'] - train['XMin1']\n\n# unique labels in a column\ntrain['RelationshipLabel'].unique()\n\n# rename columns\nCOLUMN_NAMES = {\"RelationshipLabel_at\": \"at\",\n \"RelationshipLabel_hits\": \"hits\"}\n\ntrain = train.rename(columns=COLUMN_NAMES)\n\n# To see number of unique values in a column\nmetadata_imageid_train_val_set['ImageID'].nunique()\n\n# parse a json file and replace class_id labels with mid labels\nfrom pandas.io.json import json_normalize\n\nid_to_midlabels = {}\n\ncsv_file = 'challenge-2018-class-descriptions-500.csv'\nmeta_dir = os.path.join(main_dir, challenge2018)\nboxable_classes_descriptions = os.path.join(meta_dir, csv_file)\n\ni = 0\nwith open(boxable_classes_descriptions, 'r') as descriptions_file:\n\tfor row in csv.reader(descriptions_file):\n\t\tif len(row):\n\t\t\tlabel = row[0]\n\t\t\t# description = row[1].replace(\"\\\"\", \"\").replace(\"'\", \"\").replace('`', '')\n\t\t\tid_to_midlabels[i] = label\n\t\t\ti += 1\n\nbase_dir = os.path.join(main_dir, images, test)\n\nwith open(\"predict_file.json\", 'r') as f:\n\td = json.load(f)\n\twith open(\"submission_file.json\", 'w') as sub_file:\n\t\tfor img in os.listdir(base_dir):\n\t\t\timg = img.strip('.jpg')\n\t\t\ttrain = json_normalize(d[img], record_path='boxes')\n\t\t\ttrain['cls_id'] = train.cls_id.map(id_to_midlabels)\n\t\t\tjson.dump(train, sub_file)\n\t\t\t\n\n# to split a dataframe\ntest = train[:99999]\n\n# drop column\ndf.drop(columns=['B', 'C'])\n\n# rename column\ndf = df.rename(columns={\"A\": \"a\", \"B\": \"b\"})\n\n# to rename csv without header\nheader = [\"PredictionString\"]\npqr = pd.read_csv(q, names=header)\n\n# drop specific rows based on a value\nvr_iou_negative = vr[vr['iou'] < 0 ]\nvr = vr.drop(vr_iou_negative.index, axis=0)\n\n# to check for empty columns\nnp.where(pd.isnull(df))\n\n# convert a list to a df\nvr_df = pd.DataFrame({'ImageId':downloaded_list})\n\n# merge two df with using left to join with nan values \nresult4 = pd.merge(vr_df, vr, on='ImageId', how = 'left')\n\n# access row by column value\nod_mock.loc[od_mock['ImageId'] == '8d65ca08cb5ce8e8']\n\n# drop specific columns with nan values\nanns = anns.dropna(subset=['name', 'born'])\n\n# group the rows based on column id\ncustomer_id_count = orders_2017.groupby(['customer_id', 'gender']).agg(['nunique']).reset_index()\ncustomer_id_count['order_count'] = customer_id_count['value']\ncustomer_id_count = customer_id_count._drop_axis(labels=['value', 'date'], axis=1)\n\n# reset index\ncomments = comments.reset_index(drop=True)\n" }, { "alpha_fraction": 0.5598194003105164, "alphanum_fraction": 0.6139954924583435, "avg_line_length": 22.3157901763916, "blob_id": "7a6d2fbde9398bb3486d9226a9a624841d9cb121", "content_id": "42b57a27f30fd99d9686cc7395ffbc257a6a5dec", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 443, "license_type": "permissive", "max_line_length": 90, "num_lines": 19, "path": "/PythonMasterclass/Exercise13.py", "repo_name": "mukeshmithrakumar/PythonUtils", "src_encoding": "UTF-8", "text": "\"\"\"\nWrite a Python program to remove and print every third number from a list of numbers until\nthe list becomes empty.\n\"\"\"\n\n\ndef remove_nums(int_list):\n #list starts with 0 index\n position = 3 - 1\n idx = 0\n len_list = (len(int_list))\n while len_list > 0:\n idx = (position+idx) % len_list\n print(int_list.pop(idx))\n len_list -= 1\n\n\nsample_list = [10, 20, 30, 40, 50, 60, 70, 80, 90]\nremove_nums(sample_list)\n" }, { "alpha_fraction": 0.7319561839103699, "alphanum_fraction": 0.746391236782074, "avg_line_length": 50.184715270996094, "blob_id": "f039c19ae480304ff01c38e215ad6e9e5b9c0bb7", "content_id": "0c9ba15e174700a9ff7e098fabd115dfc85ceaf4", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 8036, "license_type": "permissive", "max_line_length": 255, "num_lines": 157, "path": "/README.md", "repo_name": "mukeshmithrakumar/PythonUtils", "src_encoding": "UTF-8", "text": "<p align=\"center\"><img width=\"100%\" src=\"logo/python.jpg\" /></p>\n\n<h1 align=\"center\">Python Utils</h1>\n\n<p align=\"center\">\n <a href=\"https://github.com/ellerbrock/open-source-badges/\">\n <img src=\"https://badges.frapsoft.com/os/v2/open-source.png?v=103\" alt=\"Open Source Love\">\n </a>\n <a href=\"https://opensource.org/licenses/MIT\">\n <img src=\"https://img.shields.io/github/license/mashape/apistatus.svg\" alt=\"GitHub\">\n </a>\n <a href=\"https://www.python.org/downloads/release/python-360/\">\n <img src=\"https://img.shields.io/badge/Python-3.6-blue.svg\" alt=\"Python 3.6\">\n </a>\n <a href=\"https://github.com/mukeshmithrakumar/PythonUtils/stargazers\">\n <img src=\"https://img.shields.io/github/stars/mukeshmithrakumar/PythonUtils.svg?colorA=orange&colorB=orange&logo=github&label=Stars\"\n alt=\"GitHub Stars\">\n </a>\n <a href=\"https://www.linkedin.com/in/mukesh-mithrakumar/\">\n <img src=\"https://img.shields.io/badge/LinkedIn-blue.svg?logo=#0077B5\" alt=\"LinkedIn\">\n </a>\n</p>\n\n\n<h2 align=\"center\">What is it :question:</h2>\nThis is a collection of my helper functions, implementations and exercises in python. Please see topics below for detailed explanations of whats in the Helpers, My Implements and Python Masterclass.\n\n\n\n<h2 align=\"center\">Helpers</h2>\n\n\nData Preprocessing:\n\nEvaluation Metrics:\n\nGoogle Cloud Helpers:\n\nImage Preprocessing:\n\nIntersection Over Union:\n\nPandas Helpers:\n\nResNet:\n\nRetinaNet:\n\nSetup:\n\n\n<h2 align=\"center\">My Implements</h2>\n\n\nClosest Pair:\n\nGraph Search:\n\nShortest Path:\n\nSort:\n\nSpider:\n\n\n<h2 align=\"center\">Python Masterclass</h2>\n\n<details>\n <summary> To see the Exercises (click to expand...)</summary>\n\n[Exercise 1](/PythonMasterclass/Exercise1.py): A small program to ask for a name and an age.\n\n[Exercise 2](/PythonMasterclass/Exercise2.py): A program that takes an IP address entered at the keyboard and prints out the number of segments it contains, and the length of each segment.\n\n[Exercise 3](/PythonMasterclass/Exercise3.py): Guessing game.\n\n[Exercise 4](/PythonMasterclass/Exercise4.py): If the program finds a meal without spam it prints out each of the ingredients of the meal.\n\n[Exercise 5](/PythonMasterclass/Exercise5.py): Direction adventure game- Easy (Modify the program so that the exits is a dictionary rather than a list).\n\n[Exercise 6](/PythonMasterclass/Exercise6.py): Direction adventure game- Medium (Locations dictionary is modified so\nthat everything is in a single dictionary).\n\n[Exercise 7](): Direction adventure game- Hard (Modify to use shelves instead of dictionaries).\n\n[Exercise 8](): Create a program that allows a user to choose one of up to 9 time zones from a menu.\n\n[Exercise 9](): Write a GUI program to create a simple calculator.\n\n[Exercise 10](): Using tkinter to draw a parabola and a bunch of circles\n\n[Exercise 11](): Black Jack Challenge\n\n[Exercise 12](): Write a Python function that takes a sequence of numbers and determines if all the numbers are different from each other.\n\n[Exercise 13](/PythonMasterclass/Exercise13.py): Write a Python program to remove and print every third number from a list of numbers until the list becomes empty.\n\n[Exercise 14](/PythonMasterclass/Exercise14.py): Write a Python program to print a long text, convert the string to a list and print all the words and their frequencies.\n\n[Exercise 1](): Write a Python program to get the top stories from Google news.\n[Exercise 1](): Write a Python program to create all possible permutations from a given collection of distinct numbers\n[Exercise 1](): Write a Python program to get a string from a given string where all occurrences of its first char have been changed to $ except the first char itself.\n[Exercise 1](): Write a Python program to create a Caesar encryption\n[Exercise 1](): Write a python program to count repeated characters in a string\n[Exercise 1](): Write a Python program to reverse words in a string\n[Exercise 1](): Write a Python program to get the largest number from a list.\n[Exercise 1](): Write a Python function that takes two lists and returns True if they have at least one common member.\n[Exercise 1](): Write a Python program to select an item randomly from a list.\n[Exercise 1](): Write a Python program to find common items from two lists.\n[Exercise 1](): Write a Python program to convert list to list of dictionaries.\n[Exercise 1](): Write a Python program to remove key values pairs from a list of dictionaries.\n[Exercise 1](): Write a Python program to find the list in a list of lists whose sum of elements is the highest.\n[Exercise 1](): Write a Python program to remove duplicates from a list of lists.\n[Exercise 1](): Write a Python script to sort (ascending and descending) a dictionary by value.\n[Exercise 1](): Write a Python script to check if a given key already exists in a dictionary.\n[Exercise 1](): Write a Python script to print a dictionary where the keys are numbers between 1 and 15 (both included) and the values are square of keys\n[Exercise 1](): Write a Python program to multiply all the items in a dictionary.\n[Exercise 1](): Write a Python program to get the maximum and minimum value in a dictionary.\n[Exercise 1](): Write a Python program to find the highest 3 values in a dictionary.\n[Exercise 1](): Write a Python program to remove spaces from dictionary keys.\n[Exercise 1](): Write a Python program to add an item in a tuple.\n[Exercise 1](): Write a Python program to slice a tuple.\n[Exercise 1](): Write a Python program to convert a list of tuples into a dictionary.\n[Exercise 1](): Write a Python program to sort a tuple by its float element.\n[Exercise 1](): Write a Python program to create a set\n[Exercise 1](): Write a Python program to construct the following pattern, using a nested for loop.\n[Exercise 1](): Write a Python program to count the number of even and odd numbers from a series of numbers.\n[Exercise 1](): Write a Python program which iterates the integers from 1 to 50. For multiples of three print \"Fizz\" instead of the number and for the multiples of five print \"Buzz\". For numbers which are multiples of both three and five print \"FizzBuzz\".\n[Exercise 1](): Write a Python program which takes two digits m (row) and n (column) as input and generates a two-dimensional array. The element value in the i-th row and j-th column of the array should be i*j.\n[Exercise 1](): Write a Python program that accepts a string and calculate the number of digits and letters\n[Exercise 1](): Write a Python program to find majority element in a list.\n[Exercise 1](): Write a Python program to append text to a file and display the text.\n[Exercise 1](): Write a Python program to read last n lines of a file.\n[Exercise 1](): Write a Python program to read a file line by line store it into a variable.\n[Exercise 1](): Write a Python program to count the number of lines in a text file.\n[Exercise 1](): Write a Python program to combine each line from first file with the corresponding line in second file.\n[Exercise 1](): Write a Python script to display time data\n[Exercise 1](): Write a Python program to determine whether a given year is a leap year.\n[Exercise 1](): Write a Python program to convert unix timestamp string to readable date.\n[Exercise 1](): Write a Python program to print next 5 days starting from today\n[Exercise 1](): Write a Python program to select all the Sundays of a specified year.\n[Exercise 1](): Write a Python program to get days between two dates.\n[Exercise 1](): Write a Python program to reverse a string.\n[Exercise 1](): Write a Python function that accepts a string and calculate the number of upper case letters and lower case letters.\n[Exercise 1](): Write a Python function to check whether a string is a pangram or not.\n[Exercise 1](): Write a Python function that takes a list and returns a new list with unique elements of the first list.\n\n</details>\n\n\n<h2 align=\"center\">Python For Everybody</h2>\n\n<details>\n <summary> To see the Exercises (click to expand...)</summary>\n\n\n</details>\n" }, { "alpha_fraction": 0.68123859167099, "alphanum_fraction": 0.7030965685844421, "avg_line_length": 44.75, "blob_id": "38fa1764554d027811d810340b12be716f635618", "content_id": "96a7abc6a96316ae9fc06b4c4143b83310884324", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 549, "license_type": "permissive", "max_line_length": 107, "num_lines": 12, "path": "/PythonMasterclass/Exercise1.py", "repo_name": "mukeshmithrakumar/PythonUtils", "src_encoding": "UTF-8", "text": "\"\"\"\nWrite a small program to ask for a name and an age. When both values have been entered, check if the person\nis the right age to go on an 18-30 holiday (they must be over 18 and under 31). If they are, welcome them\nto the holiday, otherwise print a (polite) message refusing them entry.\n\"\"\"\n\nname = input(\"Please enter your name: \\n\")\nage = int(input(\"Please enter your age: \\n\"))\nif (18<=age<31):\n print(\"Welcome to the holiday {}\".format(name))\nelse:\n print(\"I am sorry {}, you do not fall between our age limit, thank you\".format(name))\n" }, { "alpha_fraction": 0.6380108594894409, "alphanum_fraction": 0.6576744914054871, "avg_line_length": 44.9216423034668, "blob_id": "90fad6ab940a1ce66dcfc2cba3e5d7d09fcac2f8", "content_id": "854c1547507b305e30206d1ae998f64d5cc094a6", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 12315, "license_type": "permissive", "max_line_length": 167, "num_lines": 268, "path": "/Helpers/Resnet.py", "repo_name": "mukeshmithrakumar/PythonUtils", "src_encoding": "UTF-8", "text": "# Resnet50 Architecture\n\nimport keras.layers\nimport keras.regularizers\n\nparameters = {\n \"kernel_initializer\": \"he_normal\"\n}\n\nclass BatchNormalization(keras.layers.BatchNormalization):\n \"\"\"\n Identical to keras.layers.BatchNormalization, but adds the option to freeze parameters.\n \"\"\"\n def __init__(self, freeze, *args, **kwargs):\n self.freeze = freeze\n super(BatchNormalization, self).__init__(*args, **kwargs)\n\n # set to non-trainable if freeze is true\n self.trainable = not self.freeze\n\n def call(self, *args, **kwargs):\n # return super.call, but set training\n return super(BatchNormalization, self).call(training=(not self.freeze), *args, **kwargs)\n\n def get_config(self):\n config = super(BatchNormalization, self).get_config()\n config.update({'freeze': self.freeze})\n return config\n\n\ndef basic_2d(filters, stage=0, block=0, kernel_size=3, numerical_name=False, stride=None, freeze_bn=False):\n \"\"\"\n A two-dimensional basic block.\n :param filters: the output’s feature space\n :param stage: int representing the stage of this block (starting from 0)\n :param block: int representing this block (starting from 0)\n :param kernel_size: size of the kernel\n :param numerical_name: if true, uses numbers to represent blocks instead of chars (ResNet{101, 152, 200})\n :param stride: int representing the stride used in the shortcut and the first conv layer, default derives stride from block id\n :param freeze_bn: if true, freezes BatchNormalization layers (ie. no updates are done in these layers)\n Usage:\n >>> import keras_resnet.blocks\n >>> keras_resnet.blocks.basic_2d(64)\n \"\"\"\n if stride is None:\n if block != 0 or stage == 0:\n stride = 1\n else:\n stride = 2\n\n if keras.backend.image_data_format() == \"channels_last\":\n axis = 3\n else:\n axis = 1\n\n if block > 0 and numerical_name:\n block_char = \"b{}\".format(block)\n else:\n block_char = chr(ord('a') + block)\n\n stage_char = str(stage + 2)\n\n def f(x):\n y = keras.layers.ZeroPadding2D(padding=1, name=\"padding{}{}_branch2a\".format(stage_char, block_char))(x)\n y = keras.layers.Conv2D(filters, kernel_size, strides=stride, use_bias=False, name=\"res{}{}_branch2a\".format(stage_char, block_char), **parameters)(y)\n y = BatchNormalization(axis=axis, epsilon=1e-5, freeze=freeze_bn, name=\"bn{}{}_branch2a\".format(stage_char, block_char))(y)\n y = keras.layers.Activation(\"relu\", name=\"res{}{}_branch2a_relu\".format(stage_char, block_char))(y)\n\n y = keras.layers.ZeroPadding2D(padding=1, name=\"padding{}{}_branch2b\".format(stage_char, block_char))(y)\n y = keras.layers.Conv2D(filters, kernel_size, use_bias=False, name=\"res{}{}_branch2b\".format(stage_char, block_char), **parameters)(y)\n y = BatchNormalization(axis=axis, epsilon=1e-5, freeze=freeze_bn, name=\"bn{}{}_branch2b\".format(stage_char, block_char))(y)\n\n if block == 0:\n shortcut = keras.layers.Conv2D(filters, (1, 1), strides=stride, use_bias=False, name=\"res{}{}_branch1\".format(stage_char, block_char), **parameters)(x)\n shortcut = BatchNormalization(axis=axis, epsilon=1e-5, freeze=freeze_bn, name=\"bn{}{}_branch1\".format(stage_char, block_char))(shortcut)\n else:\n shortcut = x\n\n y = keras.layers.Add(name=\"res{}{}\".format(stage_char, block_char))([y, shortcut])\n y = keras.layers.Activation(\"relu\", name=\"res{}{}_relu\".format(stage_char, block_char))(y)\n\n return y\n\n return f\n\n\ndef bottleneck_2d(filters, stage=0, block=0, kernel_size=3, numerical_name=False, stride=None, freeze_bn=False):\n \"\"\"\n A two-dimensional bottleneck block.\n :param filters: the output’s feature space\n :param stage: int representing the stage of this block (starting from 0)\n :param block: int representing this block (starting from 0)\n :param kernel_size: size of the kernel\n :param numerical_name: if true, uses numbers to represent blocks instead of chars (ResNet{101, 152, 200})\n :param stride: int representing the stride used in the shortcut and the first conv layer, default derives stride from block id\n :param freeze_bn: if true, freezes BatchNormalization layers (ie. no updates are done in these layers)\n Usage:\n >>> import keras_resnet.blocks\n >>> keras_resnet.blocks.bottleneck_2d(64)\n \"\"\"\n if stride is None:\n if block != 0 or stage == 0:\n stride = 1\n else:\n stride = 2\n\n if keras.backend.image_data_format() == \"channels_last\":\n axis = 3\n else:\n axis = 1\n\n if block > 0 and numerical_name:\n block_char = \"b{}\".format(block)\n else:\n block_char = chr(ord('a') + block)\n\n stage_char = str(stage + 2)\n\n def f(x):\n y = keras.layers.Conv2D(filters, (1, 1), strides=stride, use_bias=False, name=\"res{}{}_branch2a\".format(stage_char, block_char), **parameters)(x)\n y = BatchNormalization(axis=axis, epsilon=1e-5, freeze=freeze_bn, name=\"bn{}{}_branch2a\".format(stage_char, block_char))(y)\n y = keras.layers.Activation(\"relu\", name=\"res{}{}_branch2a_relu\".format(stage_char, block_char))(y)\n\n y = keras.layers.ZeroPadding2D(padding=1, name=\"padding{}{}_branch2b\".format(stage_char, block_char))(y)\n y = keras.layers.Conv2D(filters, kernel_size, use_bias=False, name=\"res{}{}_branch2b\".format(stage_char, block_char), **parameters)(y)\n y = BatchNormalization(axis=axis, epsilon=1e-5, freeze=freeze_bn, name=\"bn{}{}_branch2b\".format(stage_char, block_char))(y)\n y = keras.layers.Activation(\"relu\", name=\"res{}{}_branch2b_relu\".format(stage_char, block_char))(y)\n\n y = keras.layers.Conv2D(filters * 4, (1, 1), use_bias=False, name=\"res{}{}_branch2c\".format(stage_char, block_char), **parameters)(y)\n y = BatchNormalization(axis=axis, epsilon=1e-5, freeze=freeze_bn, name=\"bn{}{}_branch2c\".format(stage_char, block_char))(y)\n\n if block == 0:\n shortcut = keras.layers.Conv2D(filters * 4, (1, 1), strides=stride, use_bias=False, name=\"res{}{}_branch1\".format(stage_char, block_char), **parameters)(x)\n shortcut = BatchNormalization(axis=axis, epsilon=1e-5, freeze=freeze_bn, name=\"bn{}{}_branch1\".format(stage_char, block_char))(shortcut)\n else:\n shortcut = x\n\n y = keras.layers.Add(name=\"res{}{}\".format(stage_char, block_char))([y, shortcut])\n y = keras.layers.Activation(\"relu\", name=\"res{}{}_relu\".format(stage_char, block_char))(y)\n\n return y\n\n\ndef ResNet(inputs, blocks, block, include_top=True, classes=1000, freeze_bn=True, numerical_names=None, *args, **kwargs):\n \"\"\"\n Constructs a `keras.models.Model` object using the given block count.\n :param inputs: input tensor (e.g. an instance of `keras.layers.Input`)\n :param blocks: the network’s residual architecture\n :param block: a residual block (e.g. an instance of `keras_resnet.blocks.basic_2d`)\n :param include_top: if true, includes classification layers\n :param classes: number of classes to classify (include_top must be true)\n :param freeze_bn: if true, freezes BatchNormalization layers (ie. no updates are done in these layers)\n :param numerical_names: list of bool, same size as blocks, used to indicate whether names of layers should include numbers or letters\n :return model: ResNet model with encoding output (if `include_top=False`) or classification output (if `include_top=True`)\n Usage:\n >>> import keras_resnet.blocks\n >>> import keras_resnet.models\n >>> shape, classes = (224, 224, 3), 1000\n >>> x = keras.layers.Input(shape)\n >>> blocks = [2, 2, 2, 2]\n >>> block = keras_resnet.blocks.basic_2d\n >>> model = keras_resnet.models.ResNet(x, classes, blocks, block, classes=classes)\n >>> model.compile(\"adam\", \"categorical_crossentropy\", [\"accuracy\"])\n \"\"\"\n if keras.backend.image_data_format() == \"channels_last\":\n axis = 3\n else:\n axis = 1\n\n if numerical_names is None:\n numerical_names = [True] * len(blocks)\n\n x = keras.layers.ZeroPadding2D(padding=3, name=\"padding_conv1\")(inputs)\n x = keras.layers.Conv2D(64, (7, 7), strides=(2, 2), use_bias=False, name=\"conv1\")(x)\n x = BatchNormalization(axis=axis, epsilon=1e-5, freeze=freeze_bn, name=\"bn_conv1\")(x)\n x = keras.layers.Activation(\"relu\", name=\"conv1_relu\")(x)\n x = keras.layers.MaxPooling2D((3, 3), strides=(2, 2), padding=\"same\", name=\"pool1\")(x)\n\n features = 64\n\n outputs = []\n\n for stage_id, iterations in enumerate(blocks):\n for block_id in range(iterations):\n x = basic_2d(features, stage_id, block_id, numerical_name=(block_id > 0 and numerical_names[stage_id]), freeze_bn=freeze_bn)(x)\n\n features *= 2\n\n outputs.append(x)\n\n if include_top:\n assert classes > 0\n\n x = keras.layers.GlobalAveragePooling2D(name=\"pool5\")(x)\n x = keras.layers.Dense(classes, activation=\"softmax\", name=\"fc1000\")(x)\n\n return keras.models.Model(inputs=inputs, outputs=x, *args, **kwargs)\n else:\n # Else output each stages features\n return keras.models.Model(inputs=inputs, outputs=outputs, *args, **kwargs)\n\n\ndef ResNet50(inputs, blocks=None, include_top=True, classes=1000, *args, **kwargs):\n \"\"\"\n Constructs a `keras.models.Model` according to the ResNet50 specifications.\n :param inputs: input tensor (e.g. an instance of `keras.layers.Input`)\n :param blocks: the network’s residual architecture\n :param include_top: if true, includes classification layers\n :param classes: number of classes to classify (include_top must be true)\n :return model: ResNet model with encoding output (if `include_top=False`) or classification output (if `include_top=True`)\n Usage:\n >>> import keras_resnet.models\n >>> shape, classes = (224, 224, 3), 1000\n >>> x = keras.layers.Input(shape)\n >>> model = keras_resnet.models.ResNet50(x)\n >>> model.compile(\"adam\", \"categorical_crossentropy\", [\"accuracy\"])\n \"\"\"\n\n if blocks is None:\n blocks = [3, 4, 6, 3]\n numerical_names = [False, False, False, False]\n\n return ResNet(inputs, blocks, numerical_names=numerical_names, block=bottleneck_2d(64), include_top=include_top, classes=classes, *args, **kwargs)\n\n\n# ResNet Backbone\ndef resnet_retinanet(num_classes, backbone='resnet50', inputs= None, modifier=None, **kwargs):\n \"\"\" Constructs a retinanet model using a resnet backbone.\n Args\n num_classes: Number of classes to predict.\n backbone: Which backbone to use (one of ('resnet50', 'resnet101', 'resnet152')).\n inputs: The inputs to the network (defaults to a Tensor of shape (None, None, 3)).\n modifier: A function handler which can modify the backbone before using it in retinanet (this can be used to freeze backbone layers for example).\n Returns\n RetinaNet model with a ResNet backbone.\n \"\"\"\n # choose default input\n if inputs is None:\n inputs = keras.layers.Input(shape=(None, None, 3))\n\n # create the resnet backbone\n if backbone == 'resnet50':\n resnet = ResNet50(inputs, include_top=False, freeze_bn=True)\n elif backbone == 'resnet101':\n resnet = ResNet101(inputs, include_top=False, freeze_bn=True)\n elif backbone == 'resnet152':\n resnet = ResNet152(inputs, include_top=False, freeze_bn=True)\n else:\n raise ValueError('Backbone (\\'{}\\') is invalid.'.format(backbone))\n\n # invoke modifier if given\n if modifier:\n resnet = modifier(resnet)\n\n # create the full model\n return retinanet(inputs=inputs, num_classes=num_classes, backbone_layers=resnet.outputs[1:], **kwargs)\n\n\ndef resnet50_retinanet(num_classes, inputs=None, **kwargs):\n return resnet_retinanet(num_classes=num_classes, backbone='resnet50', inputs=inputs, **kwargs)\n\n\ndef resnet101_retinanet(num_classes, inputs=None, **kwargs):\n return resnet_retinanet(num_classes=num_classes, backbone='resnet101', inputs=inputs, **kwargs)\n\n\ndef resnet152_retinanet(num_classes, inputs=None, **kwargs):\n return resnet_retinanet(num_classes=num_classes, backbone='resnet152', inputs=inputs, **kwargs)\n" }, { "alpha_fraction": 0.7860465049743652, "alphanum_fraction": 0.7860465049743652, "avg_line_length": 35, "blob_id": "02c4040d510ff9713b6906069c35296f4f67f959", "content_id": "54804dea50332f8bd284c9516134f58c86e0d725", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 215, "license_type": "permissive", "max_line_length": 73, "num_lines": 6, "path": "/MyImplements/Shortestpath.py", "repo_name": "mukeshmithrakumar/PythonUtils", "src_encoding": "UTF-8", "text": "\"\"\"\nDijkstra's shortest path algorithm\nis for single source, what about multiple sources?\nCan you use closest pair algorithm to pin point a single source and then \nDijkstras' algorithm to find the shortest path?\n\"\"\"" }, { "alpha_fraction": 0.7692307829856873, "alphanum_fraction": 0.7692307829856873, "avg_line_length": 43.400001525878906, "blob_id": "71b66d5214bea06cce13120787e956b0f4c575b1", "content_id": "ad1c3e8fbe8951fc00fcf8392dcff661e544cd28", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 221, "license_type": "permissive", "max_line_length": 74, "num_lines": 5, "path": "/MyImplements/Closestpair.py", "repo_name": "mukeshmithrakumar/PythonUtils", "src_encoding": "UTF-8", "text": "\"\"\"\nThis will be a program that'd find the closest pair from a list\nI could store the list potentially in a adjaceny matrix or a adjaceny list\nwhich also will be able to use DFS or BFS to find the degree of seperation\n\"\"\"" }, { "alpha_fraction": 0.539198100566864, "alphanum_fraction": 0.5477758049964905, "avg_line_length": 30.929935455322266, "blob_id": "3454b4d035c1e03d57172d3834550f11f57adad3", "content_id": "d4412c5b0c2064e74f8e7eb05c896c5f5eaf7972", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 5013, "license_type": "permissive", "max_line_length": 148, "num_lines": 157, "path": "/Helpers/DataPreprocessing.py", "repo_name": "mukeshmithrakumar/PythonUtils", "src_encoding": "UTF-8", "text": "import numpy as np\nimport cv2\nimport pickle\nimport string\n\n\ndef get_data(input_path):\n found_bg = False\n all_imgs = {}\n\n classes_count = {}\n\n class_mapping = {}\n\n visualise = True\n\n with open(input_path, 'r') as f:\n\n print('Parsing annotation files')\n\n for line in f:\n line_split = line.strip().split(',')\n (filename, x1, y1, x2, y2, class_name) = line_split\n\n if class_name not in classes_count:\n classes_count[class_name] = 1\n else:\n classes_count[class_name] += 1\n\n if class_name not in class_mapping:\n if class_name == 'bg' and found_bg == False:\n print(\n 'Found class name with special name bg. Will be treated as a background region (this is usually for hard negative mining).')\n found_bg = True\n class_mapping[class_name] = len(class_mapping)\n\n if filename not in all_imgs:\n all_imgs[filename] = {}\n img = cv2.imread(filename)\n (rows, cols) = img.shape[:2]\n all_imgs[filename]['filepath'] = filename\n all_imgs[filename]['width'] = cols\n all_imgs[filename]['height'] = rows\n all_imgs[filename]['bboxes'] = []\n if np.random.randint(0, 7) > 0:\n all_imgs[filename]['imageset'] = 'trainval'\n else:\n all_imgs[filename]['imageset'] = 'test'\n\n all_imgs[filename]['bboxes'].append(\n {'class': class_name, 'x1': float(x1), 'x2': float(x2), 'y1': float(y1), 'y2': float(y2)})\n\n all_data = []\n for key in all_imgs:\n all_data.append(all_imgs[key])\n\n # make sure the bg class is last in the list\n if found_bg:\n if class_mapping['bg'] != len(class_mapping) - 1:\n key_to_switch = [key for key in class_mapping.keys() if class_mapping[key] == len(class_mapping) - 1][0]\n val_to_switch = class_mapping['bg']\n class_mapping['bg'] = len(class_mapping) - 1\n class_mapping[key_to_switch] = val_to_switch\n\n return all_data, classes_count, class_mapping\n\n\ndef load_pickle(path):\n with open(path, 'rb') as f:\n file = pickle.load(f)\n print('Loaded %s..' % path)\n return file\n\n\ndef save_pickle(data, path):\n with open(path, 'wb') as f:\n pickle.dump(data, f, pickle.HIGHEST_PROTOCOL)\n print('Saved %s..' % path)\n\n\ndef clean_descriptions(descriptions):\n # prepare translation table for removing punctuation\n table = str.maketrans('', '', string.punctuation)\n for key, desc_list in descriptions.items():\n for i in range(len(desc_list)):\n desc = desc_list[i]\n # tokenize\n desc = desc.split()\n # convert to lower case\n desc = [word.lower() for word in desc]\n # remove punctuation from each token\n desc = [w.translate(table) for w in desc]\n # remove hanging 's' and 'a'\n desc = [word for word in desc if len(word) > 1]\n # remove tokens with numbers in them\n desc = [word for word in desc if word.isalpha()]\n # store as string\n desc_list[i] = ' '.join(desc)\n\n\n# Code to go through tsv files and find only the ones needed to download\npath_to_directory = \"C:\\\\Users\\\\Mukesh\\\\GoogleAI\\\\DataFiles_OD\\\\\"\n\ntrain_images = {}\nwith open(path_to_directory + \"train_images_boxable_with_rotation.csv\", \"r\", encoding=\"utf8\") as f:\n for l in f:\n r = l.split(\",\")\n if r[0] == 'ImageID':\n continue\n train_images[r[2]] = r[0]\n\nprint(\"loaded {} image ids\".format(len(train_images)))\n\n# screen the images to include only the ones in the training set\npath = \"C:\\\\Users\\\\Mukesh\\\\GoogleAI\\\\DataFiles\\\\\"\ninfn = path + \"open-images-dataset-train9.tsv\"\ncount = 0\noutf = open(infn + \"trimmed_\", \"w+\")\n\nwith open(infn, \"r\") as f:\n for l in f:\n r = l[:-1].split(\"\\t\")\n if len(r) == 1: # header\n outf.write(l)\n continue\n try:\n id = train_images[r[0]]\n outf.write(l)\n count += 1\n except:\n continue\n# print(r[2])\noutf.close()\nprint(count)\n\n# converting a csv to list\nimport pandas as pd\n\npath = \"C:\\\\Users\\\\Mukesh\\\\GoogleAI\\\\DataFiles_OD\\\\\"\ncolumns = ['mid', 'desc']\nread = pd.read_csv(path + \"class_descriptions_500.csv\", names=columns)\nread = pd.DataFrame(read)\nread = read.drop(columns=['mid'])\nread = read['desc'].tolist()\n\nimport csv\n\npath2 = \"C:\\\\Users\\\\Mukesh\\\\GoogleAI\\\\Model_6_ODmxnet\\\\mx_rcnn\\\\data\\\\OIDdevkit\\\\\"\n\nwith open(path2 + \"class names.txt\", 'w') as f:\n wr = csv.writer(f, delimiter=\"\\n\")\n for ele in read:\n wr.writerow([\"'{}'\".format(ele) + ','])\n\nwith open(path2 + \"download names.txt\", 'w') as f:\n for item in downloaded_list:\n f.write(\"%s\\n\" % item)\n" }, { "alpha_fraction": 0.6308186054229736, "alphanum_fraction": 0.6436597108840942, "avg_line_length": 27.31818199157715, "blob_id": "7b2be79ffeb2ca55f4b1d3b78ad61681756b1c87", "content_id": "6d1183ae2e828e922a36dd070a12f606e118657e", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C", "length_bytes": 623, "license_type": "permissive", "max_line_length": 52, "num_lines": 22, "path": "/Helpers/makefile.c", "repo_name": "mukeshmithrakumar/PythonUtils", "src_encoding": "UTF-8", "text": "CC = gcc\nCFLAGS = -std=gnu99 -pedantic -Wall -O3\nDBGFLAGS = -std=gnu99 -pedantic -Wall -ggdb3 -DDEBUG\nSRCS=$(wildcard *.c)\nOBJS=$(patsubst %.c,%.o,$(SRCS))\nDBGOBJS=$(patsubst %.c,%.dbg.o,$(SRCS))\n.PHONY: clean depend all\nall: myProgram myProgram-debug\nmyProgram: $(OBJS)\n gcc -o $@ -O3 $(OBJS)\nmyProgram-debug: $(DBGOBJS)\n gcc -o $@ -ggdb3 $(DBGOBJS)\n%.dbg.o: %.c\n gcc $(DBGFLAGS) -c -o $@ $<\nclean:\n rm -f myProgram myProgram-debug *.o *.c~ *.h~\ndepend:\n makedepend $(SRCS)\n makedepend -a -o .dbg.o $(SRCS)\n# DO NOT DELETE\nanotherFile.o: anotherHeader.h someHeader.h\noneFile.o: oneHeader.h someHeader.h\n" }, { "alpha_fraction": 0.7803030014038086, "alphanum_fraction": 0.7803030014038086, "avg_line_length": 18, "blob_id": "ffdfd470597994bef17d43d57114070ef1d6236f", "content_id": "dcf38e9afe09d80ead4426698b597466936f9b6c", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 132, "license_type": "permissive", "max_line_length": 37, "num_lines": 7, "path": "/MyImplements/Sort.py", "repo_name": "mukeshmithrakumar/PythonUtils", "src_encoding": "UTF-8", "text": "\"\"\"\nA sorting Algorithm combining\nMerge Sort\nInsertion Sort\nQuick sort with Random median Select \nand all other stuff I can find\n\"\"\"" }, { "alpha_fraction": 0.5519077181816101, "alphanum_fraction": 0.5847382545471191, "avg_line_length": 33.1363639831543, "blob_id": "9e281ba4a2d6ee7a2bca7c47f824c7e82ff1266b", "content_id": "9b41863c5ebd6bb596b5fc21f0dbb7abb1d28c71", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2254, "license_type": "permissive", "max_line_length": 125, "num_lines": 66, "path": "/Helpers/ImagePreprocessing.py", "repo_name": "mukeshmithrakumar/PythonUtils", "src_encoding": "UTF-8", "text": "def read_image_bgr(path):\n \"\"\" Read an image in BGR format.\n Args\n path: Path to the image.\n \"\"\"\n image = np.asarray(Image.open(path).convert('RGB'))\n return image[:, :, ::-1].copy()\n\n\ndef preprocess_image(x):\n \"\"\" Preprocess an image by subtracting the ImageNet mean.\n Args\n x: np.array of shape (None, None, 3) or (3, None, None).\n mode: One of \"caffe\" or \"tf\".\n - caffe: will zero-center each color channel with\n respect to the ImageNet dataset, without scaling.\n - tf: will scale pixels between -1 and 1, sample-wise.\n Returns\n The input with the ImageNet mean subtracted.\n \"\"\"\n # mostly identical to \"https://github.com/keras-team/keras-applications/blob/master/keras_applications/imagenet_utils.py\"\n # except for converting RGB -> BGR since we assume BGR already\n x = x.astype(keras.backend.floatx())\n\n if keras.backend.image_data_format() == 'channels_first':\n if x.ndim == 3:\n x[0, :, :] -= 103.939\n x[1, :, :] -= 116.779\n x[2, :, :] -= 123.68\n else:\n x[:, 0, :, :] -= 103.939\n x[:, 1, :, :] -= 116.779\n x[:, 2, :, :] -= 123.68\n else:\n x[..., 0] -= 103.939\n x[..., 1] -= 116.779\n x[..., 2] -= 123.68\n\n return x\n\n\ndef resize_image(img, min_side=800, max_side=1333):\n \"\"\" Resize an image such that the size is constrained to min_side and max_side.\n Args\n min_side: The image's min side will be equal to min_side after resizing.\n max_side: If after resizing the image's max side is above max_side, resize until the max side is equal to max_side.\n Returns\n A resized image.\n \"\"\"\n (rows, cols, _) = img.shape\n\n smallest_side = min(rows, cols)\n\n # rescale the image so the smallest side is min_side\n scale = min_side / smallest_side\n\n # check if the largest side is now greater than max_side, which can happen\n # when images have a large aspect ratio\n largest_side = max(rows, cols)\n if largest_side * scale > max_side:\n scale = max_side / largest_side\n\n # resize the image with the computed scale\n img = cv2.resize(img, None, fx=scale, fy=scale)\n\n return img, scale\n\n" }, { "alpha_fraction": 0.6793892979621887, "alphanum_fraction": 0.6882951855659485, "avg_line_length": 27.071428298950195, "blob_id": "5a597ec9f762fd28f3f55ef881efe4031910223f", "content_id": "17d5c4989ea2cc4f3eab46bae44428b588ce9f64", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 786, "license_type": "permissive", "max_line_length": 99, "num_lines": 28, "path": "/PythonMasterclass/Exercise3.py", "repo_name": "mukeshmithrakumar/PythonUtils", "src_encoding": "UTF-8", "text": "\"\"\"\nModify the program below to use a while loop to allow as many guesses as necessary.\n\nThe program should let the player know whether to guess higher or lower, and should print a message\nwhen the guess is correct. A correct guess will terminate the program.\n\nAs an optional extra, allow the player to quit by entering 0 (zero) for their guess.\n\"\"\"\n\n\nimport random\n\nhighest = 10\nanswer = random.randint(1, highest)\n\nprint(\"Please guess a number between 1 and {}: \".format(highest))\n\nguess = 0\nwhile guess != answer:\n guess = int(input())\n if guess == 0:\n break\n if guess < answer: # guess must be greater than number\n print(\"Please guess higher\")\n elif guess > answer:\n print(\"Please guess lower\")\n else:\n print(\"Well done, you guessed it\")\n" }, { "alpha_fraction": 0.7945205569267273, "alphanum_fraction": 0.7945205569267273, "avg_line_length": 64.80000305175781, "blob_id": "e541ac4277e788966d1c0a958da2fc76a5792bfe", "content_id": "6504b2135af7d9108f7ab44ba05624dec1a52591", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 657, "license_type": "permissive", "max_line_length": 91, "num_lines": 10, "path": "/MyImplements/Graphsearch.py", "repo_name": "mukeshmithrakumar/PythonUtils", "src_encoding": "UTF-8", "text": "\"\"\"\nExplore the use of parallel computing when implementing BFS, like searching all\nthe vertices at once, like how lightning flashes\nI should also use sensory inputs like eyes and ears, since my goal is to build\na humanoid, humans don't just use brains to process data, they get help from senses\nand to process grapghs, i can visually see the graph and decide whether to use DFS or BFS\nanother thought was to use DFS without it backtracking, for eg: whenever it sees a vertex\nwith multiple edges it implements breadth first search and during BFS if the vertex has an \nedge then DFS gets implemented and DFS stops when there are no more edges to explore\n\"\"\"" }, { "alpha_fraction": 0.6226397752761841, "alphanum_fraction": 0.6396704912185669, "avg_line_length": 40.55769348144531, "blob_id": "7f5ad5fc4e57ca967cc522b409af5ae7ab4c2036", "content_id": "e2dbde7896cae33c4ef9c881fc69b5eaafacb93e", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 10804, "license_type": "permissive", "max_line_length": 146, "num_lines": 260, "path": "/Helpers/RetinaNet.py", "repo_name": "mukeshmithrakumar/PythonUtils", "src_encoding": "UTF-8", "text": "# RetinaNet: Helper Functions\n\ndef freeze_model(model):\n \"\"\" Set all layers in a model to non-trainable.\n The weights for these layers will not be updated during training.\n This function modifies the given model in-place,\n but it also returns the modified model to allow easy chaining with other functions.\n \"\"\"\n for layer in model.layers:\n layer.trainable = False\n return model\n\ndef resize_images(images, size, method='bilinear', align_corners=False):\n \"\"\" See https://www.tensorflow.org/versions/master/api_docs/python/tf/image/resize_images .\n Args\n method: The method used for interpolation. One of ('bilinear', 'nearest', 'bicubic', 'area').\n \"\"\"\n methods = {\n 'bilinear': tf.image.ResizeMethod.BILINEAR,\n 'nearest' : tf.image.ResizeMethod.NEAREST_NEIGHBOR,\n 'bicubic' : tf.image.ResizeMethod.BICUBIC,\n 'area' : tf.image.ResizeMethod.AREA,\n }\n return tf.image.resize_images(images, size, methods[method], align_corners)\n\n\nclass UpsampleLike(keras.layers.Layer):\n \"\"\" Keras layer for upsampling a Tensor to be the same shape as another Tensor.\n \"\"\"\n\n def call(self, inputs, **kwargs):\n source, target = inputs\n target_shape = keras.backend.shape(target)\n return resize_images(source, (target_shape[1], target_shape[2]), method='nearest')\n\n def compute_output_shape(self, input_shape):\n return (input_shape[0][0],) + input_shape[1][1:3] + (input_shape[0][-1],)\n\n\nclass PriorProbability(keras.initializers.Initializer):\n \"\"\" Apply a prior probability to the weights.\n \"\"\"\n\n def __init__(self, probability=0.01):\n self.probability = probability\n\n def get_config(self):\n return {\n 'probability': self.probability\n }\n\n def __call__(self, shape, dtype=None):\n # set bias to -log((1 - p)/p) for foreground\n result = np.ones(shape, dtype=dtype) * -math.log((1 - self.probability) / self.probability)\n\n return result\n\n# RetinaNet\n\ndef __build_model_pyramid(name, model, features):\n \"\"\" Applies a single submodel to each FPN level.\n Args\n name : Name of the submodel.\n model : The submodel to evaluate.\n features : The FPN features.\n Returns\n A tensor containing the response from the submodel on the FPN features.\n \"\"\"\n return keras.layers.Concatenate(axis=1, name=name)([model(f) for f in features])\n\n\ndef __build_pyramid(models, features):\n \"\"\" Applies all submodels to each FPN level.\n Args\n models : List of sumodels to run on each pyramid level (by default only regression, classifcation).\n features : The FPN features.\n Returns\n A list of tensors, one for each submodel.\n \"\"\"\n return [__build_model_pyramid(n, m, features) for n, m in models]\n\n\ndef default_classification_model(\n num_classes,\n num_anchors,\n pyramid_feature_size=256,\n prior_probability=0.01,\n classification_feature_size=256,\n name='classification_submodel'\n):\n \"\"\" Creates the default regression submodel.\n Args\n num_classes : Number of classes to predict a score for at each feature level.\n num_anchors : Number of anchors to predict classification scores for at each feature level.\n pyramid_feature_size : The number of filters to expect from the feature pyramid levels.\n classification_feature_size : The number of filters to use in the layers in the classification submodel.\n name : The name of the submodel.\n Returns\n A keras.models.Model that predicts classes for each anchor.\n \"\"\"\n options = {\n 'kernel_size' : 3,\n 'strides' : 1,\n 'padding' : 'same',\n }\n\n inputs = keras.layers.Input(shape=(None, None, pyramid_feature_size))\n outputs = inputs\n for i in range(4):\n outputs = keras.layers.Conv2D(\n filters=classification_feature_size,\n activation='relu',\n name='pyramid_classification_{}'.format(i),\n kernel_initializer=keras.initializers.normal(mean=0.0, stddev=0.01, seed=None),\n bias_initializer='zeros',\n **options\n )(outputs)\n\n outputs = keras.layers.Conv2D(\n filters=num_classes * num_anchors,\n kernel_initializer=keras.initializers.zeros(),\n bias_initializer=PriorProbability(probability=prior_probability),\n name='pyramid_classification',\n **options\n )(outputs)\n\n # reshape output and apply sigmoid\n outputs = keras.layers.Reshape((-1, num_classes), name='pyramid_classification_reshape')(outputs)\n outputs = keras.layers.Activation('sigmoid', name='pyramid_classification_sigmoid')(outputs)\n\n return keras.models.Model(inputs=inputs, outputs=outputs, name=name)\n\n\ndef default_regression_model(num_anchors, pyramid_feature_size=256, regression_feature_size=256, name='regression_submodel'):\n \"\"\" Creates the default regression submodel.\n Args\n num_anchors : Number of anchors to regress for each feature level.\n pyramid_feature_size : The number of filters to expect from the feature pyramid levels.\n regression_feature_size : The number of filters to use in the layers in the regression submodel.\n name : The name of the submodel.\n Returns\n A keras.models.Model that predicts regression values for each anchor.\n \"\"\"\n # All new conv layers except the final one in the\n # RetinaNet (classification) subnets are initialized\n # with bias b = 0 and a Gaussian weight fill with stddev = 0.01.\n options = {\n 'kernel_size' : 3,\n 'strides' : 1,\n 'padding' : 'same',\n 'kernel_initializer' : keras.initializers.normal(mean=0.0, stddev=0.01, seed=None),\n 'bias_initializer' : 'zeros'\n }\n\n inputs = keras.layers.Input(shape=(None, None, pyramid_feature_size))\n outputs = inputs\n for i in range(4):\n outputs = keras.layers.Conv2D(\n filters=regression_feature_size,\n activation='relu',\n name='pyramid_regression_{}'.format(i),\n **options\n )(outputs)\n\n outputs = keras.layers.Conv2D(num_anchors * 4, name='pyramid_regression', **options)(outputs)\n outputs = keras.layers.Reshape((-1, 4), name='pyramid_regression_reshape')(outputs)\n\n return keras.models.Model(inputs=inputs, outputs=outputs, name=name)\n\n\ndef default_submodels(num_classes, num_anchors):\n \"\"\" Create a list of default submodels used for object detection.\n The default submodels contains a regression submodel and a classification submodel.\n Args\n num_classes : Number of classes to use.\n num_anchors : Number of base anchors.\n Returns\n A list of tuple, where the first element is the name of the submodel and the second element is the submodel itself.\n \"\"\"\n return [\n ('regression', default_regression_model(num_anchors)),\n ('classification', default_classification_model(num_classes, num_anchors))\n ]\n\n\ndef __create_pyramid_features(C3, C4, C5, feature_size=256):\n \"\"\" Creates the FPN layers on top of the backbone features.\n Args\n C3 : Feature stage C3 from the backbone.\n C4 : Feature stage C4 from the backbone.\n C5 : Feature stage C5 from the backbone.\n feature_size : The feature size to use for the resulting feature levels.\n Returns\n A list of feature levels [P3, P4, P5, P6, P7].\n \"\"\"\n # upsample C5 to get P5 from the FPN paper\n P5 = keras.layers.Conv2D(feature_size, kernel_size=1, strides=1, padding='same', name='C5_reduced')(C5)\n P5_upsampled = UpsampleLike(name='P5_upsampled')([P5, C4])\n P5 = keras.layers.Conv2D(feature_size, kernel_size=3, strides=1, padding='same', name='P5')(P5)\n\n # add P5 elementwise to C4\n P4 = keras.layers.Conv2D(feature_size, kernel_size=1, strides=1, padding='same', name='C4_reduced')(C4)\n P4 = keras.layers.Add(name='P4_merged')([P5_upsampled, P4])\n P4_upsampled = UpsampleLike(name='P4_upsampled')([P4, C3])\n P4 = keras.layers.Conv2D(feature_size, kernel_size=3, strides=1, padding='same', name='P4')(P4)\n\n # add P4 elementwise to C3\n P3 = keras.layers.Conv2D(feature_size, kernel_size=1, strides=1, padding='same', name='C3_reduced')(C3)\n P3 = keras.layers.Add(name='P3_merged')([P4_upsampled, P3])\n P3 = keras.layers.Conv2D(feature_size, kernel_size=3, strides=1, padding='same', name='P3')(P3)\n\n # \"P6 is obtained via a 3x3 stride-2 conv on C5\"\n P6 = keras.layers.Conv2D(feature_size, kernel_size=3, strides=2, padding='same', name='P6')(C5)\n\n # \"P7 is computed by applying ReLU followed by a 3x3 stride-2 conv on P6\"\n P7 = keras.layers.Activation('relu', name='C6_relu')(P6)\n P7 = keras.layers.Conv2D(feature_size, kernel_size=3, strides=2, padding='same', name='P7')(P7)\n\n return [P3, P4, P5, P6, P7]\n\n\ndef retinanet(inputs,\n backbone_layers,\n num_classes,\n num_anchors= 9,\n create_pyramid_features =__create_pyramid_features,\n submodels = None,\n name = 'retinanet'\n ):\n\n \"\"\" Construct a RetinaNet model on top of a backbone.\n This model is the minimum model necessary for training (with the unfortunate exception of anchors as output).\n Args\n inputs : keras.layers.Input (or list of) for the input to the model.\n num_classes : Number of classes to classify.\n num_anchors : Number of base anchors.\n create_pyramid_features : Functor for creating pyramid features given the features C3, C4, C5 from the backbone.\n submodels : Submodels to run on each feature map (default is regression and classification submodels).\n name : Name of the model.\n Returns\n A keras.models.Model which takes an image as input and outputs generated anchors and the result from each submodel on every pyramid level.\n The order of the outputs is as defined in submodels:\n ```\n [\n regression, classification, other[0], other[1], ...\n ]\n ```\n \"\"\"\n if submodels is None:\n submodels = default_submodels(num_classes, num_anchors)\n\n C3, C4, C5 = backbone_layers\n\n # compute pyramid features as per https://arxiv.org/abs/1708.02002\n features = create_pyramid_features(C3, C4, C5)\n\n # for all pyramid levels, run available submodels\n pyramids = __build_pyramid(submodels, features)\n\n return keras.models.Model(inputs=inputs, outputs=pyramids, name=name)" }, { "alpha_fraction": 0.7349397540092468, "alphanum_fraction": 0.740963876247406, "avg_line_length": 50.07692337036133, "blob_id": "71f7b7b0bb287836fff0addbded7f8e27f85295b", "content_id": "c2ed9734a929da435ef87164e826b492d48cd19c", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1332, "license_type": "permissive", "max_line_length": 120, "num_lines": 26, "path": "/PythonMasterclass/Exercise14.py", "repo_name": "mukeshmithrakumar/PythonUtils", "src_encoding": "UTF-8", "text": "\"\"\"\nWrite a Python program to print a long text, convert the string to a list and print all the words and their frequencies.\n\"\"\"\n\nstring_words = ''' After ratifying the text on July 4, Congress issued the Declaration of\nIndependence in several forms. It was initially published as the printed Dunlap broadside\nthat was widely distributed and read to the public. The source copy used for this printing\nhas been lost, and may have been a copy in Thomas Jefferson's hand.[5] Jefferson's original\ndraft, complete with changes made by John Adams and Benjamin Franklin, and Jefferson's notes\nof changes made by Congress, are preserved at the Library of Congress. The best-known version\nof the Declaration is a signed copy that is displayed at the National Archives in Washington,\nD.C., and which is popularly regarded as the official document. This engrossed copy was ordered\nby Congress on July 19 and signed primarily on August 2.'''\n\ncleaned = []\nfor word in string_words.split():\n # isalpha returns “True” if all characters in the string are alphabets\n if not word.strip('\".,():[]5').isalpha():\n continue\n cleaned.append(word.strip('\".,():[]5').lower())\n\noutput = []\nfor word in set(cleaned):\n word_freq = cleaned.count(word)\n output.append(tuple((word, word_freq)))\nprint(sorted(output, key=lambda x: x[1], reverse=True))\n" }, { "alpha_fraction": 0.5780190229415894, "alphanum_fraction": 0.5858209133148193, "avg_line_length": 29.071428298950195, "blob_id": "461ff0948eea799a05ce27a717ebe3638fb0e149", "content_id": "fa3d7670accc3863cd860715fb56bf81d383e8e0", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2948, "license_type": "permissive", "max_line_length": 109, "num_lines": 98, "path": "/Helpers/EvalMetrics.py", "repo_name": "mukeshmithrakumar/PythonUtils", "src_encoding": "UTF-8", "text": "# Mean Average Precision\n\nimport numpy\n\n\ndef intersection_over_union(y_true, y_pred):\n \"\"\"\n :param y_pred: [minimum_r, minimum_c, maximum_r, maximum_c]\n :param y_true: [minimum_r, minimum_c, maximum_r, maximum_c]\n :return:\n \"\"\"\n y_true_minimum_r, y_true_minimum_c, y_true_maximum_r, y_true_maximum_c = y_true\n y_pred_minimum_r, y_pred_minimum_c, y_pred_maximum_r, y_pred_maximum_c = y_pred\n\n if y_true_maximum_r < y_pred_minimum_r:\n return 0.0\n\n if y_pred_maximum_r < y_true_minimum_r:\n return 0.0\n\n if y_true_maximum_c < y_pred_minimum_c:\n return 0.0\n\n if y_pred_maximum_c < y_true_minimum_c:\n return 0.0\n\n minimum_r = numpy.maximum(y_true_minimum_r, y_pred_minimum_r)\n minimum_c = numpy.maximum(y_true_minimum_c, y_pred_minimum_c)\n\n maximum_r = numpy.minimum(y_true_maximum_r, y_pred_maximum_r)\n maximum_c = numpy.minimum(y_true_maximum_c, y_pred_maximum_c)\n\n intersection = (maximum_r - minimum_r + 1) * (maximum_c - minimum_c + 1)\n\n y_true_area = (y_true_maximum_r - y_true_minimum_r + 1) * (y_true_maximum_c - y_true_minimum_c + 1)\n y_pred_area = (y_pred_maximum_r - y_pred_minimum_r + 1) * (y_pred_maximum_c - y_pred_minimum_c + 1)\n\n union = y_true_area + y_pred_area - intersection\n\n return intersection / union\n\n\ndef evaluate(y_true, y_pred, threshold=0.5):\n y_true_indices = []\n y_pred_indices = []\n\n scores = []\n\n for y_pred_detection_index, y_pred_detection in enumerate(y_pred):\n for y_true_detection_index, y_true_detection in enumerate(y_true):\n score = intersection_over_union(y_true_detection, y_pred_detection)\n\n if score > threshold:\n y_true_indices += [y_true_detection_index]\n y_pred_indices += [y_pred_detection_index]\n\n scores += [score]\n\n scores = numpy.argsort(scores)[::-1]\n\n if scores.size == 0:\n tp = 0\n fp = len(y_pred)\n fn = len(y_true)\n else:\n y_true_matched_indices = []\n y_pred_matched_indices = []\n\n for score in scores:\n y_true_index = y_true_indices[score]\n y_pred_index = y_pred_indices[score]\n\n if (y_true_index not in y_true_matched_indices) and (y_pred_index not in y_pred_matched_indices):\n y_true_matched_indices += [y_true_index]\n y_pred_matched_indices += [y_pred_index]\n\n tp = len(y_true_matched_indices)\n fp = len(y_pred) - len(y_pred_matched_indices)\n fn = len(y_true) - len(y_true_matched_indices)\n\n try:\n precision = tp / (tp + fp)\n except ZeroDivisionError:\n precision = 0.0\n\n try:\n recall = tp / (tp + fn)\n except ZeroDivisionError:\n recall = 0.0\n\n return {\n \"false negatives\": fn,\n \"false positives\": fp,\n \"precision\": precision,\n \"recall\": recall,\n \"threshold\": threshold,\n \"true positives\": tp\n }\n\n" }, { "alpha_fraction": 0.7957746386528015, "alphanum_fraction": 0.7957746386528015, "avg_line_length": 46.5, "blob_id": "d40620b322fbf72d27dbcd0f5f93d72e00774c61", "content_id": "8c32134208084443029cd0df62d99f0e76fdc4ab", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 284, "license_type": "permissive", "max_line_length": 97, "num_lines": 6, "path": "/MyImplements/Spider.py", "repo_name": "mukeshmithrakumar/PythonUtils", "src_encoding": "UTF-8", "text": "\"\"\"\nThis will be something to Spider the web searching for documents\nfrom site to site based on the links provided.\nAlso I would like to add something that would allow it to spider sites that don't allow spidering\nSomething like creating a account in google to allow for searching\n\"\"\"" }, { "alpha_fraction": 0.6328927874565125, "alphanum_fraction": 0.7041115760803223, "avg_line_length": 32.219512939453125, "blob_id": "e32e692b073d079bb59aa2ed83460f8f3ff8802d", "content_id": "b1f6f0dce023ef7bfc1de9a2a2d1db771f38e2ea", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1362, "license_type": "permissive", "max_line_length": 90, "num_lines": 41, "path": "/PythonMasterclass/Exercise2.py", "repo_name": "mukeshmithrakumar/PythonUtils", "src_encoding": "UTF-8", "text": "\"\"\"\nCreate a program that takes an IP address entered at the keyboard\nand prints out the number of segments it contains, and the length of each segment.\n\nAn IP address consists of 4 numbers, separated from each other with a full stop. But\nyour program should just count however many are entered\nExamples of the input you may get are:\n 127.0.0.1\n .192.168.0.1\n 10.0.123456.255\n 172.16\n 255\n\nSo your program should work even with invalid IP Addresses. We're just interested in the\nnumber of segments and how long each one is.\n\nOnce you have a working program, here are some more suggestions for invalid input to test:\n .123.45.678.91\n 123.4567.8.9.\n 123.156.289.10123456\n 10.10t.10.10\n 12.9.34.6.12.90\n '' - that is, press enter without typing anything\n\nThis challenge is intended to practise for loops and if/else statements, so although\nyou could use other techniques (such as splitting the string up), that's not the\napproach we're looking for here.\n\"\"\"\n\nIP_address =(input(\"Please enter an IP Address: \\n\"))\nsegment_length = 0\nsegment = 1\nfor char in IP_address:\n if (char !='.'):\n segment_length += 1\n else:\n print(\"The {} segment length is {}\".format(segment,segment_length))\n segment_length = 0\n segment += 1\nif char != '.':\n print(\"The {} segment length is {}\".format(segment, segment_length))\n" } ]
19
sophister/general-scrapy
https://github.com/sophister/general-scrapy
c194f14a44199e80c1ca4e254df5ddffc6a6369c
a0ae2a0ef457cee141e773ee9ec89526b83a73d8
66380b7054fe6009e08dd62afc1bd65cd3072edc
refs/heads/master
2021-08-24T15:52:56.112400
2017-12-10T09:29:52
2017-12-10T09:29:52
111,274,632
1
0
null
null
null
null
null
[ { "alpha_fraction": 0.27272728085517883, "alphanum_fraction": 0.39350181818008423, "avg_line_length": 31.414894104003906, "blob_id": "7a4582a112a2fe27081cb75736f481c589017507", "content_id": "16d08790a2b697a819b0722200e8f517b4663684", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3047, "license_type": "no_license", "max_line_length": 195, "num_lines": 94, "path": "/tutorial/spiders/stock50.py", "repo_name": "sophister/general-scrapy", "src_encoding": "UTF-8", "text": "import scrapy\nimport json\nimport codecs\n\n\nclass QuotesSpider(scrapy.Spider):\n name = \"stock50\"\n custom_settings = {\n \"DEFAULT_REQUEST_HEADERS\": {\n 'accept': 'application/json, text/javascript, */*; q=0.01',\n 'accept-encoding': 'gzip, deflate, br',\n 'accept-language': 'zh-CN,zh;q=0.8',\n 'cache-control': 'no-cache',\n 'cookie': '',\n 'dnt': '1',\n 'referer': 'https://gupiao.baidu.com/stock/sh000016.html?from=aladingpc',\n 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36',\n 'x-requested-with': 'XMLHttpRequest'\n }\n }\n\n def start_requests(self):\n base_url = 'https://gupiao.baidu.com/api/stocks/stockdaybar?from=pc&os_ver=1&cuid=xxx&vv=100&format=json&stock_code=sh%s&step=3&start=20170101&count=&fq_type=no&timestamp=1511068675871%s'\n args = [\n [\"600000\", \"\"],\n [\"600029\", \"\"],\n [\"600048\", \"\"],\n [\"600104\", \"\"],\n [\"600485\", \"\"],\n [\"600547\", \"\"],\n [\"600887\", \"\"],\n [\"600999\", \"\"],\n [\"601166\", \"\"],\n [\"601198\", \"\"],\n [\"601288\", \"\"],\n [\"601336\", \"\"],\n [\"601601\", \"\"],\n [\"601688\", \"\"],\n [\"601800\", \"\"],\n [\"601881\", \"\"],\n [\"601988\", \"\"],\n [\"600016\", \"\"],\n [\"600030\", \"\"],\n [\"600050\", \"\"],\n [\"600111\", \"\"],\n [\"600518\", \"\"],\n [\"600606\", \"\"],\n [\"600919\", \"\"],\n [\"601006\", \"\"],\n [\"601169\", \"\"],\n [\"601211\", \"\"],\n [\"601318\", \"\"],\n [\"601390\", \"\"],\n [\"601628\", \"\"],\n [\"601766\", \"\"],\n [\"601818\", \"\"],\n [\"601901\", \"\"],\n [\"601989\", \"\"],\n [\"600028\", \"\"],\n [\"600036\", \"\"],\n [\"600100\", \"\"],\n [\"600340\", \"\"],\n [\"600519\", \"\"],\n [\"600837\", \"\"],\n [\"600958\", \"\"],\n [\"601088\", \"\"],\n [\"601186\", \"\"],\n [\"601229\", \"\"],\n [\"601328\", \"\"],\n [\"601398\", \"\"],\n [\"601668\", \"\"],\n [\"601788\", \"\"],\n [\"601857\", \"\"],\n [\"601985\", \"\"]\n ]\n for i in args:\n url = base_url % tuple(i)\n yield scrapy.Request(url=url, callback=self.parse, meta={'code' : i[0]})\n\n def parse(self, response):\n meta = response.meta\n filename = './output-stock/' + meta['code'] + '.json'\n with open(filename, 'wb') as f:\n f.write(response.body)\n self.log('Saved file %s' % filename)\n return\n # json_body = json.loads(response.body)\n # arr = json_body['data']['pageList']\n # items = []\n # for dict in arr:\n # yield {\n # 'nick': dict['nick'],\n # 'pictUrl': dict['pictUrl']\n # }\n" }, { "alpha_fraction": 0.5023267865180969, "alphanum_fraction": 0.5031023621559143, "avg_line_length": 29.84000015258789, "blob_id": "7905221d408a607e33ed4837d3f41bcbca3ec85c", "content_id": "29995898ab9c4bd6bc9a1b8d7b144973d1761d51", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3950, "license_type": "no_license", "max_line_length": 114, "num_lines": 125, "path": "/tutorial/spiders/general.py", "repo_name": "sophister/general-scrapy", "src_encoding": "UTF-8", "text": "#! encoding:utf-8\nimport scrapy\nimport json\nimport codecs\nimport jsonpath_rw\nimport logging\n\n\nclass GeneralSpider(scrapy.Spider):\n name = \"general\"\n\n def __init__(self, config=None):\n with open(config, \"r\") as f:\n content = f.read()\n conf = json.loads(content)\n #type: json/jsonp/html\n self.crawl_type = conf['crawl_type']\n self.base_url = conf['base_url']\n self.conf = conf\n\n self.headers = {}\n\n # 添加自定义header\n if 'request_headers' in conf:\n self.headers = conf['request_headers']\n\n def start_requests(self):\n if 'args' in self.conf:\n url_list = self.handle_args_requests()\n else:\n url_list = [self.base_url]\n\n url_all = []\n\n if 'range' in self.conf:\n for url in url_list:\n new_url_list = self.handle_range_requests(url, self.conf['range'])\n url_all.extend(new_url_list)\n else:\n url_all = url_list\n # logging.debug(\"url list is: \")\n # logging.debug(url_all)\n\n headers = self.headers\n cookies = None\n \n if 'Cookie' in headers:\n cookies = headers['Cookie']\n \n return [scrapy.Request(url=url, callback=self.parse, headers=headers, cookies=cookies) for url in url_all]\n \n #处理用户提供了所有的页面循环值\n def handle_args_requests(self):\n out = []\n for i in self.conf['args']:\n url = self.base_url % tuple(i)\n out.append(url)\n # out.append(scrapy.Request(url=url, callback=self.parse))\n return out\n\n #处理用户只提供了 起始值,结束值,步进 的情况\n def handle_range_requests(self, url, page_range):\n out = []\n for page in xrange(*page_range):\n new_url = url\n new_url = new_url.replace('#page#', str(page))\n out.append(new_url)\n return out\n\n def parse(self, response):\n # filename = 'taobao.txt'\n # with open('taobao.txt', 'wb') as f:\n # f.write(response.body)\n # self.log('Saved file %s' % filename)\n # return\n if self.crawl_type == \"html\":\n obj = self.handleHTML(response)\n yield obj\n else:\n if self.crawl_type == \"jsonp\":\n content = response.body.strip()\n content = content[1+len(self.conf['jsonp_callback']):-2]\n else:\n content = response.body\n json_body = json.loads(content)\n arr = self.handleResponse(json_body)\n for i in arr:\n yield i\n\n def handleResponse(self, obj):\n jsonpath_expr = jsonpath_rw.parse(self.conf['list_json_path'])\n arr = [match.value for match in jsonpath_expr.find(obj)]\n out = []\n if 'output_item' in self.conf:\n for i in arr:\n temp = {}\n for from_key,to_key in self.conf['output_item'].items():\n if from_key in i :\n temp[to_key] = i[from_key]\n out.append(temp)\n else:\n out = arr\n return out\n \n def handleHTML(self, response):\n \n out = {}\n\n if 'output_item' in self.conf:\n for to_key, from_path in self.conf['output_item'].items():\n out[to_key] = response.xpath(from_path).extract_first()\n\n if 'output_list' in self.conf:\n for i in self.conf['output_list']:\n out[i['output_key']] = []\n \n for item in response.xpath(i['list_path']):\n obj = {}\n \n for to_key, from_path in i['items'].items():\n \n obj[to_key] = item.xpath(from_path).extract_first()\n out[i['output_key']].append(obj)\n\n return out\n \n" }, { "alpha_fraction": 0.5230280756950378, "alphanum_fraction": 0.6114346385002136, "avg_line_length": 45.07316970825195, "blob_id": "54860c7caa51b28417cb9ecbaea814f310882585", "content_id": "5aa4c0796480c87a90f348f247ed5ef131b7f5eb", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1889, "license_type": "no_license", "max_line_length": 306, "num_lines": 41, "path": "/tutorial/spiders/taobao.py", "repo_name": "sophister/general-scrapy", "src_encoding": "UTF-8", "text": "import scrapy\nimport json\nimport codecs\n\n\nclass QuotesSpider(scrapy.Spider):\n name = \"taobao\"\n custom_settings = {\n \"DEFAULT_REQUEST_HEADERS\": {\n 'accept': 'application/json, text/javascript, */*; q=0.01',\n 'accept-encoding': 'gzip, deflate, br',\n 'accept-language': 'zh-CN,zh;q=0.8',\n 'cache-control': 'no-cache',\n 'cookie': 'cna=WscvEg7nMCECAXHQimpOzffc; v=0; cookie2=1acb0a3ece98f8b0e7d27ab42595d4d4; t=ed6a0349abc6bdf036c1f9505e1a5666; _tb_token_=e33b8e43867a5; rurl=aHR0cHM6Ly9wdWIuYWxpbWFtYS5jb20vaW5kZXguaHRt; undefined_yxjh-filter-1=true; isg=AsPDMWbwnSKIjVFW5YxLMJKsUoGtkJAdt8HG7vWjRyb4tObWfQvmyiFiUHMA',\n 'dnt': '1',\n 'referer': 'https://pub.alimama.com/promo/search/index.htm?q=%E9%9E%8B&_t=1510473833209&toPage=2&perPageSize=50',\n 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36',\n 'x-requested-with': 'XMLHttpRequest'\n }\n }\n\n def start_requests(self):\n base_url = 'https://pub.alimama.com/items/search.json?q=%E9%9E%8B&_t=1510473833209&perPageSize=50&auctionTag=&shopTag=yxjh&t=1510476145129&_tb_token_=e33b8e43867a5&pvid=10_221.219.205.151_377_1510474369752&toPage='\n for i in range(30):\n url = base_url + str(i + 1)\n yield scrapy.Request(url=url, callback=self.parse)\n\n def parse(self, response):\n # filename = 'taobao.txt'\n # with open('taobao.txt', 'wb') as f:\n # f.write(response.body)\n # self.log('Saved file %s' % filename)\n # return\n json_body = json.loads(response.body)\n arr = json_body['data']['pageList']\n items = []\n for dict in arr:\n yield {\n 'nick': dict['nick'],\n 'pictUrl': dict['pictUrl']\n }\n" }, { "alpha_fraction": 0.7128205299377441, "alphanum_fraction": 0.7333333492279053, "avg_line_length": 23.41666603088379, "blob_id": "dd418f3fee16bf6cbbb4f802bb9b1c3efa96b719", "content_id": "bec0c8e21923268a5039d0a07d83ac04327e97b4", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 645, "license_type": "no_license", "max_line_length": 79, "num_lines": 24, "path": "/README.md", "repo_name": "sophister/general-scrapy", "src_encoding": "UTF-8", "text": "# general-scrapy\ngeneral scrapy for json/jsonp/html crawl\n\n## 依赖:\n\n* `python`: 2.7.14\n* `scrapy`: 1.3.3\n* `jsonpath_rw`: 1.4.0\n\n\n## how to run\n\n```shell\n# 抓取JSONP数据源\nscrapy crawl general -a config=config/jsonp-demo.json -o test2.json\n# 对API接口的 args 支持\nscrapy crawl general -a config=config/api-demo.json -o test.json\n# 对API接口的 range范围 支持\nscrapy crawl general -a config=config/api-range-demo.json -o test-range.json\n# html 静态页面\nscrapy crawl general -a config=config/html-demo.json -o test3.json\n# 登录态验证\nscrapy crawl general -a config=config/github-login-demo.json -o test-login.json\n```" }, { "alpha_fraction": 0.6230712532997131, "alphanum_fraction": 0.6284594535827637, "avg_line_length": 30.8984375, "blob_id": "d8a663b6644f534136d5d9fc3418254e1f3413e8", "content_id": "f841d1840e46d5d8ae36efd75c7c241bceb66738", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 4121, "license_type": "no_license", "max_line_length": 94, "num_lines": 128, "path": "/tutorial/middlewares.py", "repo_name": "sophister/general-scrapy", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n\n# Define here the models for your spider middleware\n#\n# See documentation in:\n# http://doc.scrapy.org/en/latest/topics/spider-middleware.html\n\nfrom scrapy import signals\n\nimport random\nimport logging\nfrom scrapy.downloadermiddlewares.httpproxy import HttpProxyMiddleware\nfrom scrapy.core.downloader.handlers.http11 import TunnelError\nfrom scrapy.downloadermiddlewares.useragent import UserAgentMiddleware #代理UA,固定导入\nimport settings\nimport requests\n\nclass IpPoolsMiddelware(HttpProxyMiddleware):\n\n def __init__(self,ip=''):\n self.service = settings.PROXY_SERVICE\n self.https_proxy_list = []\n self.http_proxy_list = []\n self.ip = ip\n self.update_count = 100\n\n def process_request(self, request, spider):\n if request.url.find('https://') == 0:\n proxy_list = self.get_https_proxy()\n else:\n proxy_list = self.get_http_proxy()\n\n if not proxy_list:\n return\n\n proxy = random.choice(proxy_list)\n ip_port = \"http://%s:%s\" % (proxy[0], proxy[1])\n request.meta[\"proxy\"] = ip_port\n logging.debug('current proxy is:' + ip_port)\n\n def get_http_proxy(self):\n proxy_list = self.get_proxy(0)\n if proxy_list:\n self.http_proxy_list = proxy_list\n\n return self.http_proxy_list\n\n def get_https_proxy(self):\n proxy_list = self.get_proxy(1)\n if proxy_list:\n self.https_proxy_list = proxy_list\n\n return self.https_proxy_list\n\n def get_proxy(self, protocol):\n proxy_list = []\n if self.update_count >= 100:\n self.update_count = 0 \n url = self.service + '/?types=0&protocol=' + str(protocol) +'&count=50&country=国内'\n r = requests.get(self.service)\n if r.status_code == 200:\n proxy_list = r.json()\n self.update_count += 1\n return proxy_list\n\n\nclass UAPoolsMiddelware(UserAgentMiddleware):\n def __init__(self, ua=''):\n self.user_agent = ua\n self.user_agent_pools = settings.USERAGENT_POOLS\n\n def process_request(self, request, spider):\n '''使用代理UA,随机选用'''\n ua = random.choice(self.user_agent_pools)\n logging.debug('current user-agent: ' + ua)\n try:\n request.headers.setdefault('User-Agent',ua)\n except Exception,e:\n print e\n pass\n \n\nclass TutorialSpiderMiddleware(object):\n # Not all methods need to be defined. If a method is not defined,\n # scrapy acts as if the spider middleware does not modify the\n # passed objects.\n\n @classmethod\n def from_crawler(cls, crawler):\n # This method is used by Scrapy to create your spiders.\n s = cls()\n crawler.signals.connect(s.spider_opened, signal=signals.spider_opened)\n return s\n\n def process_spider_input(response, spider):\n # Called for each response that goes through the spider\n # middleware and into the spider.\n\n # Should return None or raise an exception.\n return None\n\n def process_spider_output(response, result, spider):\n # Called with the results returned from the Spider, after\n # it has processed the response.\n\n # Must return an iterable of Request, dict or Item objects.\n for i in result:\n yield i\n\n def process_spider_exception(response, exception, spider):\n # Called when a spider or process_spider_input() method\n # (from other spider middleware) raises an exception.\n\n # Should return either None or an iterable of Response, dict\n # or Item objects.\n pass\n\n def process_start_requests(start_requests, spider):\n # Called with the start requests of the spider, and works\n # similarly to the process_spider_output() method, except\n # that it doesn’t have a response associated.\n\n # Must return only requests (not items).\n for r in start_requests:\n yield r\n\n def spider_opened(self, spider):\n spider.logger.info('Spider opened: %s' % spider.name)\n" } ]
5
zsnydr/test
https://github.com/zsnydr/test
82ba23a5e382f2f0584b6b206c2c618326e26413
d610fc721fb708428c34d7638c4b0bdf980d9919
cd44bf3075d5f8e6125af2274b0ca506c1bb846d
refs/heads/master
2021-01-09T20:47:25.101525
2016-07-08T07:12:49
2016-07-08T07:12:49
62,866,676
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.3734939694404602, "alphanum_fraction": 0.40963855385780334, "avg_line_length": 4.599999904632568, "blob_id": "b353be5df81b395216b40035ff5a3250ed770fbb", "content_id": "be352d534ad6c31cdeff1fed2127704141c2fd9d", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 83, "license_type": "no_license", "max_line_length": 17, "num_lines": 15, "path": "/test.py", "repo_name": "zsnydr/test", "src_encoding": "UTF-8", "text": "This is a test.\n\n\ndef test():\n '''\n '''\n print(\"pass\")\n pass\n\n\n\n\n1 \n2\n3" } ]
1
grantseltzer/fucking-around-with-ebpf
https://github.com/grantseltzer/fucking-around-with-ebpf
e113762bb4ebec0439b13d944994cb555339ed66
cbbb3dde14b467f1995c5abee3c02ef72fcdb242
b3d6ba57e0583936eb05a16e7598a8eb68c047fb
refs/heads/master
2021-06-26T00:04:19.739821
2021-05-27T14:27:53
2021-05-27T14:27:53
224,047,920
7
2
null
null
null
null
null
[ { "alpha_fraction": 0.5775302052497864, "alphanum_fraction": 0.5849581956863403, "avg_line_length": 22.91111183166504, "blob_id": "eec93bfe7759c73ac40add7fea809beb16ddc424", "content_id": "33018d2ded3a671513fdbec0b9e6041c8df48a68", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "C", "length_bytes": 1077, "license_type": "no_license", "max_line_length": 63, "num_lines": 45, "path": "/trace_commit_creds/commit_creds.c", "repo_name": "grantseltzer/fucking-around-with-ebpf", "src_encoding": "UTF-8", "text": " #include <linux/cred.h>\n #include <linux/sched.h>\n\n// Types\ntypedef struct context {\n unsigned int\t\tuid;\n unsigned int\t\tgid;\n unsigned int suid;\n unsigned int sgid;\n unsigned int euid;\n unsigned int egid;\n u32 pid;\n u32 tgid;\n u32 ppid;\n char comm[TASK_COMM_LEN];\n} context_t;\n\n// Maps\nBPF_PERF_OUTPUT(creds);\n\n// Helper functions\nstatic __always_inline int init_context(context_t *context) {\n \n struct task_struct *task;\n task = (struct task_struct *)bpf_get_current_task();\n\n context->pid = task->pid;\n context->tgid = task->tgid;\n context->ppid = task->real_parent->pid;\n bpf_get_current_comm(context->comm, sizeof(context->comm));\n\n return 0;\n}\n\n// Kprobe functions\nint print_commit_creds(struct pt_regs *ctx, struct cred *new) {\n \n context_t context = {};\n init_context(&context);\n context.uid = new->uid.val;\n context.gid = new->gid.val;\n\n creds.perf_submit(ctx, &context, sizeof(context));\n return 0;\n}\n" }, { "alpha_fraction": 0.6852791905403137, "alphanum_fraction": 0.700507640838623, "avg_line_length": 15.5, "blob_id": "cf2930a45081b19716d33c603ce20b53e0ab121d", "content_id": "6dd176683168cdcbfd1b704f26218e2b3defb4e4", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 197, "license_type": "no_license", "max_line_length": 64, "num_lines": 12, "path": "/pop_base_addr/README.md", "repo_name": "grantseltzer/fucking-around-with-ebpf", "src_encoding": "UTF-8", "text": "Compile each one seperately:\n\n`go build simple.go`\n`go build tracer.go`\n\nTry running `./simple`\n\nThen try `sudo ./tracer ./simple`, and running `./simple` again.\n\nDependencies:\n- bcc\n- kernel 4.14+" }, { "alpha_fraction": 0.6744471788406372, "alphanum_fraction": 0.6805896759033203, "avg_line_length": 15.612244606018066, "blob_id": "d3ca138f97a887e87ee74ee26acd63ca26948209", "content_id": "c05e6263de310d860fe09a30f26e369bd57ae645", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Go", "length_bytes": 814, "license_type": "no_license", "max_line_length": 74, "num_lines": 49, "path": "/pop_base_addr/tracer.go", "repo_name": "grantseltzer/fucking-around-with-ebpf", "src_encoding": "UTF-8", "text": "package main\n\nimport (\n\t\"log\"\n\t\"os\"\n\t\"os/signal\"\n\n\t\"github.com/iovisor/gobpf/bcc\"\n)\n\nconst eBPF_Program = `\n#include <uapi/linux/ptrace.h>\n\nint function(struct pt_regs *ctx) {\n \n\tvoid* stackAddr = (void*)ctx->sp;\n\n\tunsigned long returnAddress;\n\tvoid* returnAddressPtr = (void*)&returnAddress;\n\n\tbpf_probe_read(returnAddressPtr, sizeof(returnAddress), stackAddr);\n\n\treturnAddress -= 8;\n\n\tbpf_probe_write_user(stackAddr, returnAddressPtr, sizeof(returnAddress));\n\n\treturn 0;\n}\n`\n\nfunc main() {\n\n\tbpfModule := bcc.NewModule(eBPF_Program, []string{})\n\n\tfuncFD, err := bpfModule.LoadUprobe(\"function\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\terr = bpfModule.AttachUprobe(os.Args[1], \"main.function\", funcFD, -1)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tc := make(chan os.Signal, 1)\n\tsignal.Notify(c, os.Interrupt)\n\n\t<-c\n}\n" }, { "alpha_fraction": 0.634854793548584, "alphanum_fraction": 0.6473029255867004, "avg_line_length": 21.418603897094727, "blob_id": "b563c8774a0e58ab96842c30970dc45da81f5e3c", "content_id": "106600916b6b2042ec9373eac0236c9745841d7b", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "C", "length_bytes": 964, "license_type": "no_license", "max_line_length": 82, "num_lines": 43, "path": "/gophercon-eu/main.bpf.c", "repo_name": "grantseltzer/fucking-around-with-ebpf", "src_encoding": "UTF-8", "text": "//+build ignore\n#include \"vmlinux.h\"\n#include <bpf/bpf_helpers.h> \n#include <bpf/bpf_core_read.h>\n\nchar LICENSE[] SEC(\"license\") = \"GPL\";\n\n#define TASK_COMM_LEN 16\n\nstruct {\n __uint(type, BPF_MAP_TYPE_RINGBUF);\n __uint(max_entries, 1 << 24);\n} events SEC(\".maps\");\n\nlong ringbuffer_flags = 0;\n\nstruct event {\n\tu32 pid;\n u32 ppid;\n char comm[TASK_COMM_LEN];\n};\n\nSEC(\"kprobe/sys_execve\")\nint kprobe__sys_execve(struct pt_regs *ctx)\n{\n struct event *record;\n\n // Reserve space on the ringbuffer for the sample\n record = bpf_ringbuf_reserve(&events, sizeof(struct event), ringbuffer_flags);\n if (!record) {\n return 0;\n }\n\n struct task_struct *task = (struct task_struct *)bpf_get_current_task();\n\n record->ppid = BPF_CORE_READ(task, pid);\n record->pid = BPF_CORE_READ(task, real_parent, pid);\n bpf_get_current_comm(&record->comm, sizeof(record->comm));\n\n bpf_ringbuf_submit(record, ringbuffer_flags);\n\n return 0;\n}\n" }, { "alpha_fraction": 0.6824324131011963, "alphanum_fraction": 0.6891891956329346, "avg_line_length": 48.66666793823242, "blob_id": "3b56efe2ddc419d26e98db6f49d054e190e93079", "content_id": "6e0da0bb962afce4b9dfb63c446490fe3db1ce98", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Makefile", "length_bytes": 148, "license_type": "no_license", "max_line_length": 85, "num_lines": 3, "path": "/gophercon-eu/Makefile", "repo_name": "grantseltzer/fucking-around-with-ebpf", "src_encoding": "UTF-8", "text": "default:\n\tclang -g -O2 -c -target bpf -o main.bpf.o main.bpf.c\n\tCC=gcc CGO_CFLAGS=\"-I /usr/include/bpf\" CGO_LDFLAGS=\"-lbpf\" go build -o main main.go" }, { "alpha_fraction": 0.6474359035491943, "alphanum_fraction": 0.8333333134651184, "avg_line_length": 30.200000762939453, "blob_id": "50c33164c6277d84152a8075e9482c9e967c7079", "content_id": "53d7ab22bc9c70a80325cc6fa45de4faa0656efd", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Go Module", "length_bytes": 156, "license_type": "no_license", "max_line_length": 77, "num_lines": 5, "path": "/read_file_descriptors/go.mod", "repo_name": "grantseltzer/fucking-around-with-ebpf", "src_encoding": "UTF-8", "text": "module github.com/grantseltzer/fucking-around-with-ebpf/read_file_descriptors\n\ngo 1.14\n\nrequire github.com/iovisor/gobpf v0.0.0-20200614202714-e6b321d32103\n" }, { "alpha_fraction": 0.6139954924583435, "alphanum_fraction": 0.6275395154953003, "avg_line_length": 14.543859481811523, "blob_id": "1d6c299898330354e686c8374854815d78055658", "content_id": "b1ddb0d549c445e7f73f6c2b03a9dbab55448a94", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Go", "length_bytes": 886, "license_type": "no_license", "max_line_length": 72, "num_lines": 57, "path": "/gophercon-eu/main.go", "repo_name": "grantseltzer/fucking-around-with-ebpf", "src_encoding": "UTF-8", "text": "package main\n\nimport \"C\"\n\nimport (\n\t\"bytes\"\n\t\"encoding/binary\"\n\t\"fmt\"\n\t\"os\"\n\n\tbpf \"github.com/aquasecurity/libbpfgo\"\n)\n\ntype Event struct {\n\tPID uint32\n\tPPID uint32\n\tCOMM [16]byte\n}\n\nfunc main() {\n\n\tbpfModule, err := bpf.NewModuleFromFile(\"main.bpf.o\")\n\tif err != nil {\n\t\tos.Exit(-1)\n\t}\n\tdefer bpfModule.Close()\n\n\tbpfModule.BPFLoadObject()\n\tprog, err := bpfModule.GetProgram(\"kprobe__sys_execve\")\n\tif err != nil {\n\t\tos.Exit(-1)\n\t}\n\n\t_, err = prog.AttachKprobe(\"__x64_sys_execve\")\n\tif err != nil {\n\t\tos.Exit(-1)\n\t}\n\n\teventsChannel := make(chan []byte)\n\trb, err := bpfModule.InitRingBuf(\"events\", eventsChannel)\n\tif err != nil {\n\t\tos.Exit(-1)\n\t}\n\n\trb.Start()\n\n\tfor {\n\t\tb := <-eventsChannel\n\t\tbuffer := bytes.NewBuffer(b)\n\t\tev := Event{}\n\t\tbinary.Read(buffer, binary.LittleEndian, &ev)\n\t\tfmt.Printf(\"PID: %d PPID: %d COMM: %s\\n\", ev.PID, ev.PPID, ev.COMM[:])\n\t}\n\n\trb.Stop()\n\trb.Close()\n}\n" }, { "alpha_fraction": 0.6133005023002625, "alphanum_fraction": 0.6256157755851746, "avg_line_length": 20.421052932739258, "blob_id": "25e066129b372a97f0fc4be60bd6777d443f8934", "content_id": "a8d6b92786138127953c6ff424861f517b980ce1", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "C", "length_bytes": 406, "license_type": "no_license", "max_line_length": 47, "num_lines": 19, "path": "/tail_calls/py/tailcall_test.c", "repo_name": "grantseltzer/fucking-around-with-ebpf", "src_encoding": "UTF-8", "text": "#include <uapi/linux/ptrace.h>\n#include <net/sock.h>\n#include <bcc/proto.h>\n#include <linux/bpf.h>\n#include <linux/kernel.h>\n#include <uapi/linux/bpf.h>\n\nBPF_PROG_ARRAY(prog_array, 10);\n\nint tail_call(void *ctx) {\n bpf_trace_printk(\"tail-call\\n\");\n return 0;\n}\n\nint do_tail_call(void *ctx) {\n bpf_trace_printk(\"Original program\\n\");\n prog_array.call(ctx, 2);\n return 0;\n}" }, { "alpha_fraction": 0.6048171520233154, "alphanum_fraction": 0.6155218482017517, "avg_line_length": 32.30693054199219, "blob_id": "db58c7fca9fcab5fc8309d504c5e87bb627bbf48", "content_id": "d695caaa59bbaee8500747b6091e477e9923965c", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "C", "length_bytes": 3363, "license_type": "no_license", "max_line_length": 115, "num_lines": 101, "path": "/trace_seccomp/seccomp_syscall.c", "repo_name": "grantseltzer/fucking-around-with-ebpf", "src_encoding": "UTF-8", "text": "#include <linux/sched.h>\n#include <linux/types.h>\n#include <linux/filter.h>\n#include <linux/bpf_common.h>\n#include <linux/kernel.h>\n\n// Maps\nBPF_PERF_OUTPUT(output);\nBPF_HASH(seccompf, u64, struct sock_fprog); \n\n// proc_context_t holds data about the calling process\ntypedef struct proc_context {\n u32 pid;\n u32 tgid;\n u32 ppid;\n char comm[TASK_COMM_LEN];\n} proc_context_t;\n\n// init_bpf_seccomp_data reads the bpf program struct from the seccomp(2) calling procces\nint init_bpf_seccomp_data(struct pt_regs *ctx) {\n\n proc_context_t proc = {};\n struct task_struct *task;\n task = (struct task_struct *)bpf_get_current_task();\n\n proc.pid = task->pid;\n proc.tgid = task->tgid;\n proc.ppid = task->real_parent->pid;\n bpf_get_current_comm(&proc.comm, sizeof(proc.comm));\n\n unsigned int operation;\n unsigned int flags;\n void *args;\n\n // Read in seccomp(2) arguments manually from registers (can't use bcc bindings because of issue #___)\n struct pt_regs * ctx2 = (struct pt_regs *)ctx->di;\n bpf_probe_read(&operation, sizeof(operation), &ctx2->di);\n bpf_probe_read(&flags, sizeof(flags), &ctx2->si);\n bpf_probe_read(&args, sizeof(struct sock_fprog*), &ctx2->dx);\n\n // If call is installing filters\n if (operation == 1 && args != NULL) {\n\n // cast args from void* to a pointer to a sock_fprog struct\n // and then read the full structure into memory so BPF knows about it\n struct sock_fprog *bpfprog_ptr = (struct sock_fprog*)args;\n struct sock_fprog bpfprog = {}; \n bpf_probe_read(&bpfprog, sizeof(bpfprog), bpfprog_ptr);\n bpf_probe_read(&bpfprog.len, sizeof(bpfprog.len), &bpfprog.len);\n bpf_probe_read(&bpfprog.filter, sizeof(bpfprog.filter), &bpfprog.filter);\n \n bpf_trace_printk(\"Number of instructions: %d\\n\", bpfprog.len);\n\n u64 zero = 0;\n seccompf.update(&zero, &bpfprog);\n output.perf_submit(ctx, &proc, sizeof(proc));\n }\n\n return 0;\n}\n\nint interpret_bpf_progs_as_syscalls(struct pt_regs *ctx) {\n u64 zero = 0;\n struct sock_fprog *bpfprog_ptr = (struct sock_fprog*)seccompf.lookup(&zero);\n if (bpfprog_ptr == NULL) {\n return -1;\n }\n\n struct sock_filter *curAddr = bpfprog_ptr->filter;\n int sizeOfSockFprog = sizeof(*curAddr);\n int i;\n u16 code;\n u32 k;\n\n u16 bpf_statement_code = (BPF_LD | BPF_W | BPF_ABS);\n u16 bpf_jump_code = (BPF_JMP | BPF_JEQ | BPF_K); //XXX: May also be other jumps (i.e. JNE) Extract the BPF_JUMP\n struct seccomp_data *my_data;\n\n //FIXME: If it's a jump, skip the pointer ahead evaluated amount\n \n for (i = 0; i < 100; i++) {\n\n bpf_probe_read(&code, sizeof(code), &curAddr->code);\n\n if (code == bpf_statement_code) {\n bpf_probe_read(&k, sizeof(k), &curAddr->k);\n my_data = (struct seccomp_data*)&k;\n // bpf_probe_read(&data_addr->nr, sizeof(data_addr->nr), &data_addr->nr);\n bpf_trace_printk(\"k of instruction: %d\\n\\n\", my_data->nr);\n }\n\n curAddr = curAddr + sizeOfSockFprog;\n }\n\n return 0;\n}\n\n\n// Instead of tracing syscall, do a kretprobe on seccomp_prepare_filter\n// also do a kretprobe on the top level calling function to make sure\n// it was installed succesfully" }, { "alpha_fraction": 0.6610169410705566, "alphanum_fraction": 0.8192090392112732, "avg_line_length": 34.400001525878906, "blob_id": "970f5ae6bf3b129ecaf88a982425300327c1d1fb", "content_id": "aa2b2b25690e615020f7cbfef31d80713a416ef5", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Go Module", "length_bytes": 354, "license_type": "no_license", "max_line_length": 104, "num_lines": 10, "path": "/gophercon-eu/go.mod", "repo_name": "grantseltzer/fucking-around-with-ebpf", "src_encoding": "UTF-8", "text": "module github.com/grantseltzer/fucking-around-with-ebpf/gophercon-eu\n\ngo 1.16\n\nreplace github.com/aquasecurity/libbpfgo => /home/vagrant/go/src/github.com/aquasecurity/tracee/libbpfgo\n\nrequire (\n\tgithub.com/aquasecurity/libbpfgo v0.0.0-00010101000000-000000000000\n\tgithub.com/aquasecurity/tracee/libbpfgo v0.0.0-20210513142145-242d721bad3d // indirect\n)\n" }, { "alpha_fraction": 0.4865649938583374, "alphanum_fraction": 0.4880174398422241, "avg_line_length": 27.102041244506836, "blob_id": "05d8e3ea342239eb0acbec83415c6d9d55b5e28d", "content_id": "a5e6bfb793350ada3a6ecd4aff0d5466c5cee61c", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1377, "license_type": "no_license", "max_line_length": 80, "num_lines": 49, "path": "/trace_commit_creds/commit_creds.py", "repo_name": "grantseltzer/fucking-around-with-ebpf", "src_encoding": "UTF-8", "text": "#!/usr/bin/python3\n\nimport ctypes\nimport json\nfrom bcc import BPF\n\nclass CommitCredder:\n \n def __init__(self):\n BPF_PROGRAM = \"./commit_creds.c\"\n bpf_text = self.read_bpf_program(BPF_PROGRAM)\n\n self.b = BPF(text=bpf_text)\n self.b.attach_kprobe(event=\"commit_creds\", fn_name=\"print_commit_creds\")\n self.b[\"creds\"].open_perf_buffer(self.print_event)\n\n def print_event(self, cpu, data, size):\n event = self.b[\"creds\"].event(data)\n\n eventDict = {\n \"command\": event.comm.decode('utf-8'),\n \"process-id\": event.pid,\n \"parent-process-id\": event.ppid,\n \"real-uid\": event.uid,\n \"real-gid\": event.gid,\n \"saved-uid\": event.suid,\n \"saved-gid\": event.sgid,\n \"effective-uid\": event.euid,\n \"effective-gid\": event.egid\n }\n \n eventJSON = json.dumps(eventDict)\n print(eventJSON)\n\n def read_bpf_program(self, prog):\n with open(prog, \"r\") as f:\n bpf = f.read()\n return bpf\n\ndef main():\n c = CommitCredder()\n while True:\n try:\n c.b.perf_buffer_poll()\n except KeyboardInterrupt:\n exit()\n\nif __name__ == \"__main__\":\n main()\n" }, { "alpha_fraction": 0.6146341562271118, "alphanum_fraction": 0.6211382150650024, "avg_line_length": 15.184210777282715, "blob_id": "6c4d75d27d08dba42e1df63cdedbb56cc587f516", "content_id": "e899627b61ff2863cd519618d5675caba797e747", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Go", "length_bytes": 615, "license_type": "no_license", "max_line_length": 58, "num_lines": 38, "path": "/tail_calls/main.go", "repo_name": "grantseltzer/fucking-around-with-ebpf", "src_encoding": "UTF-8", "text": "package main\n\nimport (\n\t\"io/ioutil\"\n\t\"log\"\n\t\"time\"\n\n\t\"github.com/iovisor/gobpf/bcc\"\n)\n\nfunc main() {\n\tcontent, err := ioutil.ReadFile(\"./program.c\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tmod := bcc.NewModule(string(content), nil)\n\n\tsfd, err := mod.LoadKprobe(\"tail_call\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tprogTable := bcc.NewTable(mod.TableId(\"prog_array\"), mod)\n\tprogTable.Set([]byte{2}, []byte{byte(sfd)})\n\n\tdfd, err := mod.LoadKprobe(\"do_tail_call\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\terr = mod.AttachKprobe(\"__x64_sys_getcwd\", dfd, 2)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\ttime.Sleep(time.Minute)\n}\n" }, { "alpha_fraction": 0.6590909361839294, "alphanum_fraction": 0.6666666865348816, "avg_line_length": 8.428571701049805, "blob_id": "1cb2f6cc5ea1c090719e38894f397814ce5ec1a4", "content_id": "a3df2d421814cac38b51ad12b6af741fe00f1646", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Go", "length_bytes": 132, "license_type": "no_license", "max_line_length": 29, "num_lines": 14, "path": "/rewrite_params/simple.go", "repo_name": "grantseltzer/fucking-around-with-ebpf", "src_encoding": "UTF-8", "text": "package main\n\nimport (\n\t\"fmt\"\n)\n\n//go:noinline\nfunc handlerFunction(x int) {\n\tfmt.Println(x)\n}\n\nfunc main() {\n\thandlerFunction(3)\n}\n" }, { "alpha_fraction": 0.576221764087677, "alphanum_fraction": 0.5776805281639099, "avg_line_length": 26.979591369628906, "blob_id": "93bc2f1d2b12b1f2b5056d965b862e7839dcec46", "content_id": "586dd760b75ade91c3450aeb714808ee113ffb6b", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1371, "license_type": "no_license", "max_line_length": 160, "num_lines": 49, "path": "/trace_seccomp/seccomp_trace.py", "repo_name": "grantseltzer/fucking-around-with-ebpf", "src_encoding": "UTF-8", "text": "#!/usr/bin/python3\n\nimport ctypes\nimport json\nfrom bcc import BPF\n\nclass SeccompTracer:\n\n def __init__(self):\n seccomp_interpret = \"./seccomp_syscall.c\"\n\n seccomp_interpret_code = self.read_bpf_program(seccomp_interpret)\n\n self.b = BPF(text=seccomp_interpret_code)\n \n seccompFnName = self.b.get_syscall_fnname(\"seccomp\")\n self.b.attach_kprobe(event=seccompFnName, fn_name=\"interpret_bpf_progs_as_syscalls\")\n self.b.attach_kprobe(event=seccompFnName, fn_name=\"init_bpf_seccomp_data\") # init is attached last so that it's executed first (go figure...)\n\n self.b[\"output\"].open_perf_buffer(self.print_event)\n\n def print_event(self, cpu, data, size):\n event = self.b[\"output\"].event(data)\n\n eventDict = {\n \"command\": event.comm.decode('utf-8'),\n \"process-id\": event.pid,\n \"parent-process-id\": event.ppid,\n \"thread-group-id\": event.tgid\n }\n\n eventJSON = json.dumps(eventDict)\n print(eventJSON)\n\n def read_bpf_program(self, prog):\n with open(prog, \"r\") as f:\n bpf = f.read()\n return bpf\n\ndef main():\n c = SeccompTracer()\n while True:\n try:\n c.b.perf_buffer_poll()\n except KeyboardInterrupt:\n exit()\n\nif __name__ == \"__main__\":\n main()\n" }, { "alpha_fraction": 0.6587795615196228, "alphanum_fraction": 0.6674968600273132, "avg_line_length": 16.085105895996094, "blob_id": "34f6259cbbed3ba95698adcf077d14a3c3d9ccc2", "content_id": "987c02db1d3b04f8b9731c6dba71089e505d5981", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Go", "length_bytes": 803, "license_type": "no_license", "max_line_length": 78, "num_lines": 47, "path": "/rewrite_params/tracer.go", "repo_name": "grantseltzer/fucking-around-with-ebpf", "src_encoding": "UTF-8", "text": "package main\n\nimport (\n\t\"log\"\n\t\"os\"\n\t\"os/signal\"\n\n\t\"github.com/iovisor/gobpf/bcc\"\n)\n\nconst eBPF_Program = `\n#include <uapi/linux/ptrace.h>\n#include <linux/string.h>\n\nBPF_PERF_OUTPUT(events);\n\ninline int function_was_called(struct pt_regs *ctx) {\n\n\tvoid* stackAddr = (void*)ctx->sp;\n\tvoid* paramAddr = stackAddr+8;\n\t\n\tunsigned long data = 69;\n\tvoid* dataPtr = (void*)&data;\n\n\tbpf_probe_write_user(paramAddr, dataPtr, sizeof(data));\n\treturn 0;\n}\n`\n\nfunc main() {\n\n\tbpfModule := bcc.NewModule(eBPF_Program, []string{})\n\n\tuprobeFd, err := bpfModule.LoadUprobe(\"function_was_called\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\terr = bpfModule.AttachUprobe(os.Args[1], \"main.simpleFunction\", uprobeFd, -1)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tc := make(chan os.Signal, 1)\n\tsignal.Notify(c, os.Interrupt)\n\n\t<-c\n}\n" }, { "alpha_fraction": 0.6269826292991638, "alphanum_fraction": 0.6671020984649658, "avg_line_length": 21.707626342773438, "blob_id": "f492b85d59f6eaa2cfc6714e0a1659ec54cbaccf", "content_id": "ebff58a86bd9c0f8802eb9c5ed86639ed390f376", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Go", "length_bytes": 5359, "license_type": "no_license", "max_line_length": 76, "num_lines": 236, "path": "/read_file_descriptors/main.go", "repo_name": "grantseltzer/fucking-around-with-ebpf", "src_encoding": "UTF-8", "text": "package main\n\nimport (\n\t\"encoding/binary\"\n\t\"encoding/json\"\n\t\"errors\"\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\t\"os/signal\"\n\t\"strings\"\n\n\t\"github.com/iovisor/gobpf/bcc\"\n)\n\n//TODO:\n// Return value of mmap is pointer to the region\n\nconst eBPF_Program = `\n#include <uapi/linux/ptrace.h>\n\nBPF_PERF_OUTPUT(events);\n\ntypedef struct mmap_args {\n\tu32 pid;\n\tint fd;\n\tvoid* addr;\n\tsize_t length;\n\tint prot;\n\tint flags;\n\toff_t offset;\n} args_t;\n\n\nint trace_mmap(struct pt_regs *ctx) {\n\n\targs_t args = {};\n\targs.pid = (u32)bpf_get_current_pid_tgid();\n\t\n\t// In kernel 4.17+ the actual context is stored by reference in di register\n\tstruct pt_regs * actualCtx = (struct pt_regs *)ctx->di;\n\tbpf_probe_read(&args.addr, sizeof(args.addr), &actualCtx->di);\n\tbpf_probe_read(&args.length, sizeof(args.length), &actualCtx->si);\n\tbpf_probe_read(&args.prot, sizeof(args.prot), &actualCtx->dx);\n\tbpf_probe_read(&args.flags, sizeof(args.flags), &actualCtx->r10);\n\tbpf_probe_read(&args.fd, sizeof(args.fd), &actualCtx->r8);\n\tbpf_probe_read(&args.offset, sizeof(args.offset), &actualCtx->r9);\n\n\t// args_t TEST_ARGS = {};\n\t// TEST_ARGS.pid = 0xFFFFFFFF;\n\t// TEST_ARGS.fd = 0xFFFFFFFF;;\n\t// TEST_ARGS.addr = (void*)0xFFFFFFFFFFFFFFFF;\n\t// TEST_ARGS.length = 0xFFFFFFFFFFFFFFFF;\n\t// TEST_ARGS.prot = 0xFFFFFFFF;\n\t// TEST_ARGS.flags = 0xFFFFFFFF;\n\t// TEST_ARGS.offset = 0xFFFFFFFFFFFFFFFF;\n\n\t// bpf_trace_printk(\"1: %d\\n\", sizeof(TEST_ARGS));\n\t// bpf_trace_printk(\"2: %d\\n\\n\\n\", sizeof(TEST_ARGS.offset));\n\n\tevents.perf_submit(ctx, &args, sizeof(args));\n\n\treturn 0;\n}\n`\n\ntype mmap_args struct {\n\tprocessID uint32\n\tfd uint32\n\taddr uint64\n\tlength uint64\n\tprot uint32\n\tflags uint32\n\toffset uint64\n}\n\nfunc (m *mmap_args) unmarshalBinaryData(data []byte) error {\n\n\tif len(data) != 44 {\n\t\treturn errors.New(\"incorrect number of bytes in binary data for decoding\")\n\t}\n\n\tm.processID = binary.LittleEndian.Uint32(data[0:4])\n\tm.fd = binary.LittleEndian.Uint32(data[4:8])\n\tm.addr = binary.LittleEndian.Uint64(data[8:16])\n\tm.length = binary.LittleEndian.Uint64(data[16:24])\n\tm.prot = binary.LittleEndian.Uint32(data[24:28])\n\tm.flags = binary.LittleEndian.Uint32(data[28:32])\n\tm.offset = binary.LittleEndian.Uint64(data[32:40])\n\treturn nil\n}\n\nfunc main() {\n\n\tbpfModule := bcc.NewModule(eBPF_Program, []string{})\n\n\tfuncFD, err := bpfModule.LoadKprobe(\"trace_mmap\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tsyscallPrefix := bcc.GetSyscallPrefix()\n\n\terr = bpfModule.AttachKprobe(syscallPrefix+\"mmap\", funcFD, -1)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\ttable := bcc.NewTable(bpfModule.TableId(\"events\"), bpfModule)\n\tchannel := make(chan []byte)\n\tperfMap, err := bcc.InitPerfMap(table, channel, nil)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tgo func() {\n\t\tfor {\n\t\t\tvalue := <-channel\n\t\t\tmmapInfo := mmap_args{}\n\t\t\terr = mmapInfo.unmarshalBinaryData(value)\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatal(err)\n\t\t\t}\n\t\t\tprintMMapArgs(&mmapInfo)\n\t\t}\n\t}()\n\n\tperfMap.Start()\n\tdefer perfMap.Stop()\n\n\tc := make(chan os.Signal, 1)\n\tsignal.Notify(c, os.Interrupt)\n\n\t<-c\n}\n\nfunc printMMapArgs(m *mmap_args) error {\n\n\tx := struct {\n\t\tPID, Addr, Length, Protection, Flags, FileDescriptor, Offset string\n\t}{\n\t\tPID: fmt.Sprint(m.processID),\n\t\tAddr: sprintAddr(m.addr),\n\t\tLength: fmt.Sprint(m.length),\n\t\tProtection: sprintMemoryProtectionFlag(m.prot),\n\t\tFlags: sprintMemoryVisibilityFlag(m.flags),\n\t\tFileDescriptor: fmt.Sprint(m.fd),\n\t\tOffset: fmt.Sprint(m.offset),\n\t}\n\n\tjsonBytes, err := json.Marshal(x)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfmt.Printf(\"%s\\n\", jsonBytes)\n\treturn nil\n}\n\nfunc sprintAddr(addr uint64) string {\n\tif addr == 0 {\n\t\treturn \"NULL\"\n\t}\n\n\treturn fmt.Sprintf(\"%x\", addr)\n}\n\nfunc sprintMemoryProtectionFlag(prot uint32) string {\n\tvar protectionFlags []string\n\tif prot == 0x0 {\n\t\tprotectionFlags = append(protectionFlags, \"PROT_NONE\")\n\t}\n\tif prot&0x01 == 0x01 {\n\t\tprotectionFlags = append(protectionFlags, \"PROT_READ\")\n\t}\n\tif prot&0x02 == 0x02 {\n\t\tprotectionFlags = append(protectionFlags, \"PROT_WRITE\")\n\t}\n\tif prot&0x04 == 0x04 {\n\t\tprotectionFlags = append(protectionFlags, \"PROT_EXEC\")\n\t}\n\n\treturn strings.Join(protectionFlags, \"|\")\n}\n\nfunc sprintMemoryVisibilityFlag(vis uint32) string {\n\n\tvar visibilityFlags []string\n\n\tif vis&0x01 == 0x01 {\n\t\tvisibilityFlags = []string{\"MAP_SHARED\"}\n\t}\n\tif vis&0x02 == 0x02 {\n\t\tvisibilityFlags = []string{\"MAP_PRIVATE\"}\n\t}\n\tif vis&0x02 == 0x03 {\n\t\tvisibilityFlags = []string{\"MAP_SHARED_VALIDATE\"}\n\t}\n\tif vis&0x0f == 0x10 {\n\t\tvisibilityFlags = []string{\"MAP_ANONYMOUS\"}\n\t}\n\tif vis&0x0f == 0x100 {\n\t\tvisibilityFlags = []string{\"MAP_FIXED\"}\n\t}\n\tif vis&0x0f == 0x40 {\n\t\tvisibilityFlags = []string{\"MAP_32BIT\"}\n\t}\n\tif vis&0x0f == 0x200000 {\n\t\tvisibilityFlags = []string{\"MAP_FIXED_NOREPLACE\"}\n\t}\n\tif vis&0x0f == 0x01000 {\n\t\tvisibilityFlags = []string{\"MAP_GROWSDOWN\"}\n\t}\n\tif vis&0x0f == 0x100000 {\n\t\tvisibilityFlags = []string{\"MAP_HUGETLB\"}\n\t}\n\tif vis&0x0f == 0x08000 {\n\t\tvisibilityFlags = []string{\"MAP_LOCKED\"}\n\t}\n\tif vis&0x0f == 0x40000 {\n\t\tvisibilityFlags = []string{\"MAP_NONBLOCK\"}\n\t}\n\tif vis&0x0f == 0x20000 {\n\t\tvisibilityFlags = []string{\"MAP_POPULATE\"}\n\t}\n\tif vis&0x0f == 0x10000 {\n\t\tvisibilityFlags = []string{\"MAP_NORESERVE\"}\n\t}\n\tif vis&0x0f == 0x80000 {\n\t\tvisibilityFlags = []string{\"MAP_STACK\"}\n\t}\n\tif vis&0x0f == 0x4000000 {\n\t\tvisibilityFlags = []string{\"MAP_UNINITIALIZED\"}\n\t}\n\n\treturn strings.Join(visibilityFlags, \"|\")\n}\n" }, { "alpha_fraction": 0.7159624695777893, "alphanum_fraction": 0.7276995182037354, "avg_line_length": 16.79166603088379, "blob_id": "9ef16236d3221925512a70f3261d6c1e8f00c415", "content_id": "c051b7847b4c9c17a7b2d6ed1884d829b967466e", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 426, "license_type": "no_license", "max_line_length": 67, "num_lines": 24, "path": "/tail_calls/py/test.py", "repo_name": "grantseltzer/fucking-around-with-ebpf", "src_encoding": "UTF-8", "text": "import os\nimport socket\nimport time\nimport logging\nimport signal\nimport sys\nimport zmq\nimport json\nimport yaml\nimport netifaces as ni\nfrom bcc import BPF\nfrom ctypes import *\n\nb = BPF(src_file=\"tailcall_test.c\")\n\ntail_fn = b.load_func(\"tail_call\", BPF.KPROBE)\n\nprog_array = b.get_table(\"prog_array\")\n\nprog_array[c_int(2)] = c_int(tail_fn.fd)\n\nb.attach_kprobe(event=\"__x64_sys_getcwd\", fn_name = \"do_tail_call\")\n\ntime.sleep(60)" }, { "alpha_fraction": 0.6341463327407837, "alphanum_fraction": 0.6402438879013062, "avg_line_length": 9.25, "blob_id": "ffdcc23f0af9d049b9f68ea41629ff07052d2723", "content_id": "24c667ff54f2054c09761ac8b7ceb31bf6e8ca58", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Go", "length_bytes": 164, "license_type": "no_license", "max_line_length": 34, "num_lines": 16, "path": "/pop_base_addr/simple.go", "repo_name": "grantseltzer/fucking-around-with-ebpf", "src_encoding": "UTF-8", "text": "package main\n\nimport (\n\t\"fmt\"\n\t\"time\"\n)\n\n//go:noinline\nfunc function() {\n\ttime.Sleep(time.Second)\n\tfmt.Println(\"It's February 2nd!\")\n}\n\nfunc main() {\n\tfunction()\n}\n" }, { "alpha_fraction": 0.6523378491401672, "alphanum_fraction": 0.657616913318634, "avg_line_length": 29.159090042114258, "blob_id": "bc7ae979a3307511a7b0619d3a7518a2b7346306", "content_id": "4be9b8c4f2cdea1db7b588c96e89228f653b2099", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "C", "length_bytes": 1326, "license_type": "no_license", "max_line_length": 101, "num_lines": 44, "path": "/trace_seccomp/seccomp_prepare_filter.c", "repo_name": "grantseltzer/fucking-around-with-ebpf", "src_encoding": "UTF-8", "text": "#include <linux/seccomp.h>\n#include <linux/types.h>\n\n// Maps\nBPF_PERF_OUTPUT(output);\n\n// proc_context_t holds data about the calling process\ntypedef struct proc_context {\n u32 pid;\n u32 tgid;\n u32 ppid;\n char comm[TASK_COMM_LEN];\n} proc_context_t;\n\n// init_bpf_seccomp_data reads the bpf program struct from the seccomp_prepare_filter calling procces\nint init_bpf_seccomp_data(struct pt_regs *ctx) {\n\n proc_context_t proc = {};\n struct task_struct *task;\n task = (struct task_struct *)bpf_get_current_task();\n\n proc.pid = task->pid;\n proc.tgid = task->tgid;\n proc.ppid = task->real_parent->pid;\n bpf_get_current_comm(&proc.comm, sizeof(proc.comm));\n\n output.perf_submit(ctx, &proc, sizeof(proc));\n \n return 0;\n}\n\nint kretprobe__seccomp_prepare_filter(struct pt_regs *ctx) {\n //FIXME: Going to have to find out how to get the syscall numbers\n // out of seccomp_filter. seccomp_data's are populated by a triggered\n // event (i.e. when seccomp program is run, what syscall is being used)\n\n // Go down rabbit hole of libseccomp??\n \n}\n\n\n// Instead of tracing syscall, do a kretprobe on seccomp_prepare_filter\n// also do a kretprobe on the top level calling function to make sure\n// it was installed succesfully" } ]
19
rugginoso/django-transcodeandstream
https://github.com/rugginoso/django-transcodeandstream
f7a9a45e262841e0c0ac89febd39e2f3264d37e8
510a1d5b9f6ad8ae5145f9717e6ee88f7195d39c
92374b576a44105c5f3762d1bccfefec39cce45e
refs/heads/master
2016-09-06T01:58:15.579461
2013-06-14T19:11:21
2013-06-14T19:11:21
10,588,869
1
1
null
null
null
null
null
[ { "alpha_fraction": 0.6571224331855774, "alphanum_fraction": 0.6578382253646851, "avg_line_length": 36.75675582885742, "blob_id": "b5444e5a634d616dd78ba36bd19602408ac25fc6", "content_id": "5d23d1a112a405a2571cd87b19a7c9e82d52719d", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1397, "license_type": "no_license", "max_line_length": 113, "num_lines": 37, "path": "/transcodeandstream/management/commands/watchvideos.py", "repo_name": "rugginoso/django-transcodeandstream", "src_encoding": "UTF-8", "text": "from django.core.management.base import BaseCommand, CommandError\nfrom optparse import make_option\n\nfrom transcodeandstream.models import EncodeQueueEntry\nfrom transcodeandstream.settings import TAS_WATCHED_DIRECTORIES, TAS_VIDEO_EXTENSIONS, TAS_TRANSCODER_FORMATS\n\nfrom _watcher import watch, initial_check\nfrom _random import generate_random_unique_name\n\n\ndef add_entry(path):\n if EncodeQueueEntry.objects.filter(original_filename=path).count() == 0:\n existing_names = [entry['id']\n for entry in EncodeQueueEntry.objects.values('id')]\n name = generate_random_unique_name(existing_names)\n\n for format in TAS_TRANSCODER_FORMATS:\n entry = EncodeQueueEntry(\n id=name,\n original_filename=path,\n transcode_format=format,\n )\n entry.save()\n\n\nclass Command(BaseCommand):\n help = 'Watches the configured directories for now videos to encode'\n\n def handle(self, *args, **options):\n paths_just_there = set([entry['original_filename']\n for entry in EncodeQueueEntry.objects.get_new_entries().values('original_filename')])\n initial_check(\n paths_just_there,\n TAS_WATCHED_DIRECTORIES,\n TAS_VIDEO_EXTENSIONS,\n add_entry)\n watch(TAS_WATCHED_DIRECTORIES, TAS_VIDEO_EXTENSIONS, add_entry)\n" }, { "alpha_fraction": 0.6137450933456421, "alphanum_fraction": 0.6193997263908386, "avg_line_length": 56.5, "blob_id": "7926be975771d273c9629db06c63188cbe46c415", "content_id": "090238b2ebb3896795a0976e5e655f5e1d4a2190", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2299, "license_type": "no_license", "max_line_length": 199, "num_lines": 40, "path": "/transcodeandstream/migrations/0006_auto__chg_field_virtualfilesystemnode_parent.py", "repo_name": "rugginoso/django-transcodeandstream", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\nimport datetime\nfrom south.db import db\nfrom south.v2 import SchemaMigration\nfrom django.db import models\n\n\nclass Migration(SchemaMigration):\n\n def forwards(self, orm):\n\n # Changing field 'VirtualFilesystemNode.parent'\n db.alter_column(u'transcodeandstream_virtualfilesystemnode', 'parent_id', self.gf('django.db.models.fields.related.ForeignKey')(null=True, to=orm['transcodeandstream.VirtualFilesystemNode']))\n\n def backwards(self, orm):\n\n # User chose to not deal with backwards NULL issues for 'VirtualFilesystemNode.parent'\n raise RuntimeError(\"Cannot reverse this migration. 'VirtualFilesystemNode.parent' and its values cannot be restored.\")\n\n models = {\n u'transcodeandstream.encodequeueentry': {\n 'Meta': {'ordering': \"('created_at',)\", 'object_name': 'EncodeQueueEntry'},\n 'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),\n 'error': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'id': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '10', 'primary_key': 'True'}),\n 'log': ('django.db.models.fields.TextField', [], {'null': 'True'}),\n 'original_filename': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}),\n 'progress': ('django.db.models.fields.PositiveSmallIntegerField', [], {'default': '0'}),\n 'working_on': ('django.db.models.fields.BooleanField', [], {'default': 'False'})\n },\n u'transcodeandstream.virtualfilesystemnode': {\n 'Meta': {'ordering': \"('video', 'name')\", 'unique_together': \"(('name', 'parent'),)\", 'object_name': 'VirtualFilesystemNode'},\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),\n 'parent': ('django.db.models.fields.related.ForeignKey', [], {'related_name': \"'children'\", 'null': 'True', 'to': u\"orm['transcodeandstream.VirtualFilesystemNode']\"}),\n 'video': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True'})\n }\n }\n\n complete_apps = ['transcodeandstream']" }, { "alpha_fraction": 0.6731255054473877, "alphanum_fraction": 0.6756529211997986, "avg_line_length": 22.739999771118164, "blob_id": "41bfd653035cb020b936333ef8666e27162b8d9f", "content_id": "f63051340541cbaac39306eef36b55cfcfe01c7c", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1187, "license_type": "no_license", "max_line_length": 82, "num_lines": 50, "path": "/transcodeandstream/settings.py", "repo_name": "rugginoso/django-transcodeandstream", "src_encoding": "UTF-8", "text": "from django.conf import settings\nfrom django.core.exceptions import ImproperlyConfigured\n\nTAS_WATCHED_DIRECTORIES = getattr(settings, 'TAS_WATCHED_DIRECTORIES', [])\nif not TAS_WATCHED_DIRECTORIES:\n raise ImproperlyConfigured('No watched directories configured.')\n\nTAS_VIDEOS_DIRECTORY = getattr(settings, 'TAS_VIDEOS_DIRECTORY', None)\nif not TAS_VIDEOS_DIRECTORY:\n raise ImproperlyConfigured('No vidoes directory configured.')\n\nTAS_VIDEO_EXTENSIONS = getattr(settings, 'TAS_VIDEO_EXTENSIONS', (\n '.avi',\n '.mov',\n))\n\n\nTAS_FFMPEG_EXECUTABLE = getattr(\n settings,\n 'TAS_FFMPEG_EXECUTABLE',\n '/usr/bin/ffmpeg')\n\nTAS_FFMPEG_OPTIONS = getattr(\n settings,\n 'TAS_FFMPEG_OPTIONS',\n []\n)\n\nTAS_FFMPEG_FORMATS_OPTIONS = getattr(\n settings,\n 'TAS_FFMPEG_FORMATS_OPTIONS',\n {\n 'webm': ['-vcodec', 'libvpx', '-acodec', 'libvorbis'],\n 'mp4': [],\n 'ogg': [],\n }\n)\n\nTAS_TRANSCODER_POLL_SECONDS = getattr(\n settings,\n 'TAS_TRANSCODER_POLL_SECONDS',\n 10)\n\nTAS_DELETE_AFTER_TRANSCODE = getattr(settings, 'TAS_DELETE_AFTER_TRANSCODE', True)\n\nTAS_TRANSCODER_FORMATS = getattr(\n settings,\n 'TAS_TRANSCODER_FORMATS',\n ('webm',)\n)\n" }, { "alpha_fraction": 0.6186495423316956, "alphanum_fraction": 0.6263665556907654, "avg_line_length": 42.22222137451172, "blob_id": "1b92d013481b6dd3ab61abbc3ffc59f0abb7d7b6", "content_id": "a356234aa5435d8df16890327b48e120c34ff5b3", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1555, "license_type": "no_license", "max_line_length": 115, "num_lines": 36, "path": "/transcodeandstream/migrations/0001_initial.py", "repo_name": "rugginoso/django-transcodeandstream", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\nimport datetime\nfrom south.db import db\nfrom south.v2 import SchemaMigration\nfrom django.db import models\n\n\nclass Migration(SchemaMigration):\n\n def forwards(self, orm):\n # Adding model 'EncodeQueueEntry'\n db.create_table(u'transcodeandstream_encodequeueentry', (\n ('id', self.gf('django.db.models.fields.CharField')(max_length=10, primary_key=True)),\n ('original_filename', self.gf('django.db.models.fields.CharField')(max_length=255)),\n ('created_at', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),\n ('working_on', self.gf('django.db.models.fields.BooleanField')(default=False)),\n ))\n db.send_create_signal(u'transcodeandstream', ['EncodeQueueEntry'])\n\n\n def backwards(self, orm):\n # Deleting model 'EncodeQueueEntry'\n db.delete_table(u'transcodeandstream_encodequeueentry')\n\n\n models = {\n u'transcodeandstream.encodequeueentry': {\n 'Meta': {'ordering': \"('created_at',)\", 'object_name': 'EncodeQueueEntry'},\n 'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),\n 'id': ('django.db.models.fields.CharField', [], {'max_length': '10', 'primary_key': 'True'}),\n 'original_filename': ('django.db.models.fields.CharField', [], {'max_length': '255'}),\n 'working_on': ('django.db.models.fields.BooleanField', [], {'default': 'False'})\n }\n }\n\n complete_apps = ['transcodeandstream']" }, { "alpha_fraction": 0.5373134613037109, "alphanum_fraction": 0.5597015023231506, "avg_line_length": 15.75, "blob_id": "e442989e487058905d30463f2af3c66af1f54080", "content_id": "58c021099eb92aeeeadb7d04f5444f5774dc102b", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 134, "license_type": "no_license", "max_line_length": 60, "num_lines": 8, "path": "/transcodeandstream/__init__.py", "repo_name": "rugginoso/django-transcodeandstream", "src_encoding": "UTF-8", "text": "\"\"\"\nTranscode & Stream - Transcode videos and stream with Django\n\"\"\"\n\n__version__ = \"0.0.1\"\n__authors__ = [\n \"Lorenzo Masini <rugginoso@develer.com>\",\n]\n" }, { "alpha_fraction": 0.4061662256717682, "alphanum_fraction": 0.41420912742614746, "avg_line_length": 40.44444274902344, "blob_id": "0b0d51eb1c71d64e32cb06052ec2b8b6e57fef35", "content_id": "4851a08e59d2b3461d52b42b26f055b94c966a02", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 746, "license_type": "no_license", "max_line_length": 86, "num_lines": 18, "path": "/transcodeandstream/urls.py", "repo_name": "rugginoso/django-transcodeandstream", "src_encoding": "UTF-8", "text": "from django.conf.urls import patterns, include, url\n\nurlpatterns = patterns('transcodeandstream',\n url(r'^$',\n 'views.filesystem_operation', name='manager'),\n\n url(r'^manager/(?P<path>[A-Za-z0-9_\\-\\./\\s]+)?$',\n 'views.filesystem_operation', name='filesystem-operation'),\n\n url(r'^queue/$',\n 'views.queue', name='queue'),\n\n url(r'^queue/(?P<video_id>[A-Za-z0-9_\\-]{10})/log/$',\n 'views.queue_log', name='queue-log'),\n\n url(r'^queue-data/$',\n 'views.queue_data', name='queue-data'),\n )\n" }, { "alpha_fraction": 0.542682945728302, "alphanum_fraction": 0.5548780560493469, "avg_line_length": 31.799999237060547, "blob_id": "ab0b4fa85279cc5761307638338a90f96f0a4a09", "content_id": "897de1da3686a579f42f900bacdad7806eed9a2d", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 492, "license_type": "no_license", "max_line_length": 81, "num_lines": 15, "path": "/transcodeandstream/management/commands/_random.py", "repo_name": "rugginoso/django-transcodeandstream", "src_encoding": "UTF-8", "text": "from random import randrange\n\n\nCHARACTERS_RANGE = [chr(n) for n in xrange(ord('a'), ord('z'))] \\\n + [chr(n) for n in xrange(ord('A'), ord('Z'))] \\\n + [chr(n) for n in xrange(ord('0'), ord('9'))] \\\n + ['_', '-']\n\n\ndef generate_random_unique_name(existing_names, length=10):\n while True:\n name = \"\".join([CHARACTERS_RANGE[randrange(0, len(CHARACTERS_RANGE) - 1)]\n for n in xrange(length)])\n if name not in existing_names:\n return name\n" }, { "alpha_fraction": 0.6218260526657104, "alphanum_fraction": 0.6218260526657104, "avg_line_length": 26.62686538696289, "blob_id": "775c04629a6912876e5e78dc0ed67d1113ea36e6", "content_id": "35e3a35cb3967184c124a41e962f7e895c410595", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1851, "license_type": "no_license", "max_line_length": 96, "num_lines": 67, "path": "/transcodeandstream/management/commands/_watcher.py", "repo_name": "rugginoso/django-transcodeandstream", "src_encoding": "UTF-8", "text": "import os\nfrom pyinotify import WatchManager, Notifier, ProcessEvent, IN_CREATE, IN_MOVED_TO\n\n\ndef check_extension(path, extensions):\n _, ext = os.path.splitext(path)\n return (ext and ext in extensions)\n\n\ndef scan_dir(path, extensions):\n videos_paths = []\n for dirname, dirnames, filenames in os.walk(path):\n videos_paths.extend([os.path.join(path, dirname, filename)\n for filename in filenames if check_extension(filename, extensions)])\n return videos_paths\n\n\ndef process_new_entry(path, is_dir, extensions, callback):\n videos_paths = []\n if is_dir:\n videos_paths.extend(scan_dir(path, extensions))\n else:\n if check_extension(path, extensions):\n videos_paths.append(path)\n\n for video_path in videos_paths:\n callback(video_path)\n\n\nclass EventHandler(ProcessEvent):\n\n def __init__(self, callback, extensions, *args, **kwargs):\n self.callback = callback\n self.extensions = extensions\n super(EventHandler, self).__init__(*args, **kwargs)\n\n def process_IN_CREATE(self, event):\n process_new_entry(\n event.pathname,\n event.dir,\n self.extensions,\n self.callback)\n\n def process_IN_MOVED_TO(self, event):\n process_new_entry(\n event.pathname,\n event.dir,\n self.extensions,\n self.callback)\n\n\ndef initial_check(paths_just_there, dirs, extensions, callback):\n paths = []\n for d in dirs:\n paths.extend(scan_dir(d, extensions))\n\n for p in paths:\n if not p in paths_just_there:\n callback(p)\n\n\ndef watch(dirs, extensions, callback):\n wm = WatchManager()\n notifier = Notifier(wm, EventHandler(callback, extensions))\n for d in dirs:\n wm.add_watch(d, IN_CREATE | IN_MOVED_TO)\n notifier.loop()\n" }, { "alpha_fraction": 0.5945512652397156, "alphanum_fraction": 0.5956196784973145, "avg_line_length": 30.72881317138672, "blob_id": "3a5af5fc30e946f25caf30a9fb94d8fd3a0099e5", "content_id": "736981e31a9cce26f40f45d0fbd11f62c3f7a6cf", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1872, "license_type": "no_license", "max_line_length": 188, "num_lines": 59, "path": "/transcodeandstream/management/commands/transcoder.py", "repo_name": "rugginoso/django-transcodeandstream", "src_encoding": "UTF-8", "text": "from django.core.management.base import BaseCommand, CommandError\nfrom optparse import make_option\nimport time\nimport os\nimport sys\n\nfrom transcodeandstream.models import EncodeQueueEntry, VirtualFilesystemNode\nfrom transcodeandstream.settings import TAS_TRANSCODER_POLL_SECONDS, TAS_VIDEOS_DIRECTORY, TAS_FFMPEG_EXECUTABLE, TAS_FFMPEG_OPTIONS, TAS_FFMPEG_FORMATS_OPTIONS, TAS_DELETE_AFTER_TRANSCODE\n\nfrom _transcoder import encode\n\n\ndef progress_callback(id, progress, log):\n entry = EncodeQueueEntry.objects.get(pk=id)\n entry.progress = progress\n if log:\n entry.log = '\\n'.join([entry.log, log]) if entry.log else log\n entry.save()\n\n\ndef finish_callback(id, status):\n entry = EncodeQueueEntry.objects.get(pk=id)\n if status == 0:\n VirtualFilesystemNode(\n name=os.path.basename(entry.original_filename),\n video=entry.pk,\n parent=None,\n ).save()\n if TAS_DELETE_AFTER_TRANSCODE:\n os.unlink(entry.original_filename)\n entry.delete()\n else:\n entry.error = True\n entry.save()\n\n\nclass Command(BaseCommand):\n help = 'Encode videos'\n\n def handle(self, *args, **options):\n while True:\n try:\n entry = EncodeQueueEntry.objects.get_new_entries()[0]\n entry.working_on = True\n entry.save()\n encode(\n entry.pk,\n entry.original_filename,\n entry.transcode_format,\n TAS_VIDEOS_DIRECTORY,\n TAS_FFMPEG_EXECUTABLE,\n TAS_FFMPEG_OPTIONS,\n TAS_FFMPEG_FORMATS_OPTIONS,\n progress_callback,\n finish_callback,\n )\n except IndexError:\n pass\n time.sleep(TAS_TRANSCODER_POLL_SECONDS)\n" }, { "alpha_fraction": 0.608364999294281, "alphanum_fraction": 0.6159695982933044, "avg_line_length": 26.893939971923828, "blob_id": "44d42b5714a77f8235ac78e33a1b070d960a4124", "content_id": "2b3bda7d0ca9e058a3867a63d1eb8a1c9c6dae8d", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1841, "license_type": "no_license", "max_line_length": 87, "num_lines": 66, "path": "/transcodeandstream/management/commands/_transcoder.py", "repo_name": "rugginoso/django-transcodeandstream", "src_encoding": "UTF-8", "text": "import time\nimport datetime\nimport re\nimport os\nimport select\nfrom subprocess import Popen, PIPE\n\n\ndef time_to_seconds(time_string):\n try:\n t = time.strptime(time_string.split('.')[0], '%H:%M:%S')\n except ValueError:\n return 0\n\n d = datetime.timedelta(hours=t.tm_hour, minutes=t.tm_min, seconds=t.tm_sec)\n return d.total_seconds()\n\n\ndef parse_line(line):\n progress = 0\n duration = 0\n log = \"\"\n\n progress_regexp = re.compile(r'time=(\\d\\d:\\d\\d:\\d\\d.\\d\\d)')\n duration_regexp = re.compile(r'Duration:\\s+(\\d\\d:\\d\\d:\\d\\d.\\d\\d)')\n\n m = progress_regexp.search(line)\n if m:\n try:\n progress = time_to_seconds(m.group(1))\n except IndexError:\n pass\n\n m = duration_regexp.search(line)\n if m:\n try:\n duration = time_to_seconds(m.group(1))\n except IndexError:\n pass\n\n if progress == 0 and duration == 0:\n log = line\n\n return (progress, duration, log)\n\n\ndef encode(id, original_filename, format, dest_dir, ffmpeg_executable,\n ffmpeg_options, ffmpeg_formats_options, progress_callback, finish_callback):\n cmdline = [ffmpeg_executable, '-i', original_filename]\n cmdline.extend(ffmpeg_options)\n cmdline.extend(ffmpeg_formats_options.get(format, []))\n cmdline.append(os.path.join(dest_dir, ''.join((id, '.', format))))\n\n duration = 0\n transcoder = Popen(cmdline, stderr=PIPE, universal_newlines=True)\n status = None\n\n while status is None and select.select([transcoder.stderr.fileno()], [], []):\n p, d, l = parse_line(transcoder.stderr.readline().decode('utf-8'))\n if not duration:\n duration = d\n progress = p / duration * 100 if duration else 0\n progress_callback(id, progress, l)\n status = transcoder.poll()\n\n finish_callback(id, status)\n" }, { "alpha_fraction": 0.6249353289604187, "alphanum_fraction": 0.6396792531013489, "avg_line_length": 32.0427360534668, "blob_id": "7e67dc8ee0e747e60e684c48208e2ce21517d12a", "content_id": "0346f3ba6f4d7873db6a047f594646efcf4c4eaf", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3866, "license_type": "no_license", "max_line_length": 126, "num_lines": 117, "path": "/transcodeandstream/views.py", "repo_name": "rugginoso/django-transcodeandstream", "src_encoding": "UTF-8", "text": "from django.shortcuts import render_to_response, get_object_or_404\nfrom django.http import HttpResponse, Http404\nfrom django.template.context import RequestContext\nimport json\n\nfrom transcodeandstream.models import VirtualFilesystemNode, EncodeQueueEntry\nfrom transcodeandstream import forms\n\n\ndef queue(request):\n return render_to_response('transcodeandstream/queue.html')\n\n\ndef queue_data(request):\n entries = EncodeQueueEntry.objects.values(\n 'original_filename',\n 'transcode_format',\n 'progress',\n 'error',\n 'pk',\n )\n\n return HttpResponse(json.dumps(list(entries)), mimetype='text/json')\n\ndef queue_log(request, video_id):\n entry = get_object_or_404(EncodeQueueEntry, pk=video_id)\n return HttpResponse(\"<pre>%s</pre>\" % entry.log)\n\ndef get_node_by_path_or_404(path):\n try:\n node = VirtualFilesystemNode.objects.node_by_path(path)\n except VirtualFilesystemNode.DoesNotExist:\n raise Http404()\n return node\n\n\ndef filesystem_operation(request, path=''):\n action = request.GET.get('action', 'change_directory')\n # if not action in ('create_directory, change_directory', 'show_video', 'move', 'rename', 'remove'):\n # return HttpResponse(status=400)\n node = get_node_by_path_or_404(path)\n return globals()[action](request, node)\n\n\ndef create_directory(request, parent_node):\n if request.method == 'POST':\n form = forms.RenameForm(request.POST)\n if form.is_valid():\n node = VirtualFilesystemNode(name=form.cleaned_data['name'])\n node.parent = parent_node\n node.save()\n return HttpResponse(status=200)\n else:\n return HttpResponse(status=400)\n\n\ndef change_directory(request, node):\n if node is None or node.is_dir():\n children = list(node.children.all() if node else VirtualFilesystemNode.objects.filter(parent=None))\n context = {\n 'children': sorted(children, key=lambda n: (not n.is_dir(), n.name)),\n 'parent': node.parent if node else None,\n 'path_components': node.path_components() if node else None,\n }\n return render_to_response('transcodeandstream/show_directory.html', context_instance=RequestContext(request, context))\n else:\n return HttpResponse(status=400)\n\n\ndef show_video(request, node):\n if node is None or node.is_dir():\n return HttpResponse(status=400)\n else:\n context = {\n 'video': node,\n 'path_components': node.path_components() if node else None,\n }\n return render_to_response('transcodeandstream/show_video.html', context_instance=RequestContext(request, context))\n\n\ndef move(request, node):\n if request.method == 'POST':\n form = forms.MoveForm(request.POST)\n if form.is_valid():\n dest_node = get_node_by_path_or_404(form.cleaned_data['path'])\n\n if dest_node is not None and not dest_node.is_dir():\n return HttpResponse('destination is not a direcroy', status=400)\n\n if dest_node and node.path == dest_node.path:\n return HttpResponse('cannot move a directory into itself', status=400)\n\n node.parent = dest_node\n node.save()\n\n return HttpResponse(status=200)\n\n else:\n return HttpResponse(status=400)\n\ndef rename(request, node):\n if request.method == 'POST':\n form = forms.RenameForm(request.POST)\n if form.is_valid():\n node.name = form.cleaned_data['name']\n node.save()\n return HttpResponse(status=200)\n\n\ndef remove(request, node):\n if request.method == 'POST':\n form = forms.DeleteForm(request.POST)\n if form.is_valid():\n node.delete()\n return HttpResponse(status=200)\n else:\n return HttpResponse(status=400)\n" }, { "alpha_fraction": 0.7309644818305969, "alphanum_fraction": 0.7309644818305969, "avg_line_length": 14.15384578704834, "blob_id": "d7e4fafdddc8da9741046b17eb0fb5c30922ccdf", "content_id": "f702f86813db235ddbc14518b4f6cf94bed43848", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 197, "license_type": "no_license", "max_line_length": 42, "num_lines": 13, "path": "/transcodeandstream/forms.py", "repo_name": "rugginoso/django-transcodeandstream", "src_encoding": "UTF-8", "text": "from django import forms\n\n\nclass MoveForm(forms.Form):\n path = forms.CharField(required=False)\n\n\nclass RenameForm(forms.Form):\n name = forms.CharField()\n\n\nclass DeleteForm(forms.Form):\n\tpass\n" }, { "alpha_fraction": 0.6214953064918518, "alphanum_fraction": 0.6292834877967834, "avg_line_length": 31.100000381469727, "blob_id": "8973890ea75fc1290d9dd940aa18005fd8220388", "content_id": "3940f3a09f390ccedd3f3a23836b80d67e90e9f2", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1284, "license_type": "no_license", "max_line_length": 112, "num_lines": 40, "path": "/setup.py", "repo_name": "rugginoso/django-transcodeandstream", "src_encoding": "UTF-8", "text": "#!/usr/bin/env python\n\n# Use setuptools if we can\ntry:\n from setuptools.core import setup\nexcept ImportError:\n from distutils.core import setup\nfrom transcodeandstream import __version__\n\nsetup(\n name='django-transcodeandstream',\n version=__version__,\n description='Transcode videos and stream with Django',\n long_description='Django Transcode & Stream permits to transcode, organize and stream videos using Django.',\n author='Lorenzo Masini',\n author_email='rugginoso@develer.com',\n url='http://github.com/rugginoso/django-transcodeandstream/',\n classifiers=[\n \"Development Status :: 1 - Planning\",\n \"Framework :: Django\",\n \"Intended Audience :: Developers\",\n \"Intended Audience :: End Users/Desktop\",\n \"License :: OSI Approved :: BSD License\",\n \"Operating System :: POSIX :: Linux\",\n \"Programming Language :: Python :: 2.7\",\n \"Topic :: Multimedia :: Video :: Conversion\",\n \"Topic :: Multimedia :: Video :: Display\",\n ],\n packages=[\n 'transcodeandstream',\n 'transcodeandstream.migrations',\n 'transcodeandstream.management',\n 'transcodeandstream.management.commands',\n ],\n install_requires=[\n 'django>=1.4',\n 'south>=0.8.1',\n 'pyinotify>=0.9',\n ]\n)\n" }, { "alpha_fraction": 0.6452576518058777, "alphanum_fraction": 0.6504854559898376, "avg_line_length": 28.755556106567383, "blob_id": "912930133df2cfbad3867cb6348b732ae9c2ff0a", "content_id": "7939f0dfb9af6ca8008303210caa8d1eaa5284e1", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2678, "license_type": "no_license", "max_line_length": 92, "num_lines": 90, "path": "/transcodeandstream/models.py", "repo_name": "rugginoso/django-transcodeandstream", "src_encoding": "UTF-8", "text": "from django.db import models\nfrom django.db.models.signals import post_delete\n\nimport os\n\nfrom transcodeandstream.settings import TAS_VIDEOS_DIRECTORY, TAS_TRANSCODER_FORMATS\n\n\nclass EncodeQueueEntryManager(models.Manager):\n\n def get_new_entries(self):\n return super(EncodeQueueEntryManager, self).exclude(working_on=True)\n\n\nclass EncodeQueueEntry(models.Model):\n id = models.CharField(max_length=10, primary_key=True)\n original_filename = models.CharField(max_length=255)\n created_at = models.DateTimeField(auto_now_add=True)\n working_on = models.BooleanField(default=False)\n progress = models.PositiveSmallIntegerField(default=0)\n transcode_format = models.CharField(max_length=255)\n error = models.BooleanField(default=False)\n log = models.TextField(null=True)\n\n objects = EncodeQueueEntryManager()\n\n class Meta:\n ordering = ('created_at',)\n unique_together = ('id', 'original_filename', 'transcode_format')\n\nclass VirtualFilesystemNodeManager(models.Manager):\n\n def node_by_path(self, path):\n if not path:\n return None\n\n components = path.split('/')\n last_node = None\n for component in components:\n node = super(\n VirtualFilesystemNodeManager,\n self).get(parent=last_node,\n name=component)\n last_node = node\n return last_node\n\n\nclass VirtualFilesystemNode(models.Model):\n name = models.CharField(max_length=255)\n video = models.CharField(max_length=10, null=True)\n parent = models.ForeignKey('self', related_name='children', null=True)\n\n objects = VirtualFilesystemNodeManager()\n\n def is_dir(self):\n return self.video is None\n\n def filename(self, format):\n if self.video:\n filename = os.path.join(TAS_VIDEOS_DIRECTORY, ''.join((self.name, '.', format)))\n if os.path.exists(filename):\n return filename\n return None\n\n def path(self):\n return '/'.join([c.name for c in self.path_components()])\n\n def path_components(self):\n node = self\n components = []\n while node:\n components.append(node)\n node = node.parent\n return reversed(components)\n\n class Meta:\n ordering = ('video', 'name')\n unique_together = ('name', 'parent')\n\n\ndef delete_physical_file(sender, **kwargs):\n instance = kwargs.get('instance')\n assert(instance)\n\n for format in TAS_TRANSCODER_FORMATS:\n filename = instance.filename(format)\n if filename:\n os.unlink(filename)\n\npost_delete.connect(delete_physical_file, sender=VirtualFilesystemNode)\n" } ]
14
mind-protector/gallows-game---python-Tk
https://github.com/mind-protector/gallows-game---python-Tk
681afa4adf5689095851108d53a248f8f69ba472
378927a911d0240300487a40791852888a9f8edd
fcd457f439d47bae29f2db8c07343472650efbaa
refs/heads/master
2020-09-12T12:23:47.483014
2020-02-20T01:20:37
2020-02-20T01:20:37
222,424,177
1
0
null
null
null
null
null
[ { "alpha_fraction": 0.7410072088241577, "alphanum_fraction": 0.7529975771903992, "avg_line_length": 36.90909194946289, "blob_id": "bf9be21afcd9198a0436d4e09f5792ffaabc3c34", "content_id": "023eae46ca28f3b6adfb7c7b174e7b0269f6c360", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 417, "license_type": "no_license", "max_line_length": 195, "num_lines": 11, "path": "/README.md", "repo_name": "mind-protector/gallows-game---python-Tk", "src_encoding": "UTF-8", "text": "The classic game \"gallows\" in which the player needs to guess the hidden word. Made with Tkinter module.\n\nYou can install the game on your computer using installer.py. This creates the game data and the main.pyw file - the game launcher. Data contains dictionaries for the game and ASCII arts for GUI.\n\n(You don't need to install any modules)\n\nP.S.\n\n- Python version: > 3.4\n\n- OS: Windows (7)-10, Linux [situational]\n" }, { "alpha_fraction": 0.39791756868362427, "alphanum_fraction": 0.40714898705482483, "avg_line_length": 17.331951141357422, "blob_id": "a8926517ee15b7962ddb823b8ad76b5ba884deff", "content_id": "6d71fd0e66dc38ac5d2bd778c5dc969831f3985e", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 9316, "license_type": "no_license", "max_line_length": 107, "num_lines": 482, "path": "/installer.py", "repo_name": "mind-protector/gallows-game---python-Tk", "src_encoding": "UTF-8", "text": "import subprocess\r\nimport os, sys\r\n\r\n\r\nclass Installer:\r\n\r\n\t\"\"\"Game Pack Installer\r\n\tand other settings and configs\"\"\"\r\n\r\n\tdef __init__(self):\r\n\r\n\t\t\"\"\"Game datas\"\"\"\r\n\r\n\t\tself.WDIR = os.getcwd()\r\n\t\tself.STDIR = os.path.join(self.WDIR, 'game', 'stages')\r\n\t\tself.DICDIR = os.path.join(self.WDIR, 'game', 'dicts')\r\n\r\n\t\tself.STAGES = {\r\n\r\n\t\t\t'1.txt':\r\n\r\n\"\"\"\\n\r\n ___________]\r\n | |\r\n | |\r\n | |\r\n |\r\n |\r\n |\r\n |\r\n |\r\n |\r\n |\r\n |\r\n |\r\n |\r\n |\r\n (___________|__________)\r\n\"\"\",\r\n\r\n\t\t\t'2.txt':\r\n\r\n\"\"\"\\n\r\n ___________]\r\n | |\r\n | |\r\n ___|_____ |\r\n| | |\r\n| 0 0 | |\r\n|____*____| |\r\n |\r\n |\r\n |\r\n |\r\n |\r\n |\r\n |\r\n |\r\n (___________|__________)\r\n \"\"\",\r\n\r\n\t\t\t'3.txt':\r\n\r\n\"\"\"\\n\r\n ___________]\r\n | |\r\n | |\r\n ___|_____ |\r\n| | |\r\n| 0 0 | |\r\n|____*____| |\r\n | | |\r\n | | |\r\n | | |\r\n | | |\r\n |\r\n |\r\n |\r\n |\r\n (___________|__________)\r\n\"\"\",\r\n\r\n\t\t\t'4.txt':\r\n\r\n\"\"\"\\n\r\n ___________]\r\n | |\r\n | |\r\n ___|_____ |\r\n| | |\r\n| 0 0 | |\r\n|____*____| |\r\n | | |\r\n /| | |\r\n { | | |\r\n | | |\r\n |\r\n |\r\n |\r\n |\r\n (___________|__________)\r\n\"\"\",\r\n\r\n\t\t\t'5.txt':\r\n\r\n\"\"\"\\n\r\n ___________]\r\n | |\r\n | |\r\n ___|_____ |\r\n| | |\r\n| 0 0 | |\r\n|____*____| |\r\n | | |\r\n /| |\\ |\r\n { | | } |\r\n | | |\r\n |\r\n |\r\n |\r\n |\r\n (___________|__________)\r\n\"\"\",\r\n\r\n\t\t\t'6.txt':\r\n\r\n\"\"\"\\n\r\n ___________]\r\n | |\r\n | |\r\n ___|_____ |\r\n| | |\r\n| 0 0 | |\r\n|____*____| |\r\n | | |\r\n /| |\\ |\r\n { | | } |\r\n | | |\r\n / |\r\n ( |\r\n |\r\n |\r\n (___________|__________)\r\n\"\"\",\r\n\r\n\t\t\t'7.txt':\r\n\r\n\"\"\"\\n\r\n ___________]\r\n | |\r\n | |\r\n ___|_____ |\r\n| | |\r\n| x x | |\r\n|____*____| |\r\n | | |\r\n /| |\\ |\r\n { | | } |\r\n | | |\r\n / \\ |\r\n ( ) |\r\n |\r\n |\r\n (___________|__________)\r\n\"\"\"\r\n\t\t}\r\n\r\n\t\tself.DICTS = {\r\n\r\n\t\t\t'easy.txt':\r\n\r\n\"\"\"\r\nball\r\ngame\r\nstick\r\nzoo\r\nbear\r\nwisp\r\nbox\r\napple\r\nline\r\nfront \r\n\"\"\",\r\n\r\n\t\t\t'medium.txt':\r\n\r\n\"\"\"\r\nsniper\r\ntkinter\r\nmaster\r\nmistake\r\nrainbow\r\nmultiply\r\nrandom\r\ninteger\r\nstring\r\ndouble\r\n\"\"\",\r\n\r\n\t\t\t'hard.txt':\r\n\r\n\"\"\"\r\nspiderman\r\nbeastmaster\r\napparation\r\nrandomize\r\ncivilization\r\nguardians\r\ndeveloper\r\njavascript\r\ngenerator\r\nrefrigerator\r\n\"\"\"\r\n\t\t}\r\n\r\n\t\tself.SCR_TEXT = r'''\r\nfrom tkinter import *\r\nimport os, sys\r\nfrom random import randint\r\n\r\n\r\nclass Main():\r\n\r\n \"\"\"The gallows game:\r\n - player choose the letter and if the word includes this letter player get 1 point (if: 0 < points < 7)\r\n - elif get -1 point (if: 0 < points < 7)\r\n - else game is over\"\"\"\r\n\r\n def __init__(self):\r\n\r\n \"\"\"Create windows and settings\"\"\"\r\n\r\n self.root = Tk()\r\n self.WDIR = os.getcwd()\r\n\r\n self.BG = '#000000'\r\n self.FG = '#ffffff'\r\n self.FONT = 'Courier 20'\r\n\r\n self.answer = []\r\n self.question = 'Play'\r\n\r\n self.questL = None\r\n self.ansL = None\r\n self.wordL = None\r\n self.gallows = None\r\n\r\n self.points = 1\r\n self.dictionary = None\r\n self.word = None\r\n self.users_word = None\r\n self.result = None\r\n\r\n self.root.attributes('-fullscreen', True)\r\n self.root.config(background=self.BG, cursor='none')\r\n\r\n self.GUI()\r\n\r\n\r\n def _show_gallows(self):\r\n\r\n \"\"\"Return gallows stage by .txt file in game data\"\"\"\r\n\r\n with open(os.path.join(self.WDIR, 'game', 'stages', f'{self.points}.txt'), 'r', encoding='utf-8') as f:\r\n return f.read()\r\n \r\n\r\n def _random_word(self):\r\n\r\n \"\"\"Gets a random word from the current dictionary\"\"\"\r\n\r\n with open(os.path.join(self.WDIR, 'game', 'dicts', self.dictionary), 'r', encoding='utf-8') as f:\r\n lines = f.readlines()\r\n return lines[randint(1, len(lines)-1)][0:-1]\r\n\r\n\r\n def _Gameplay(self):\r\n\r\n \"\"\"Gameplay process: questions-answers (word guessing)\"\"\"\r\n\r\n def create_widgets():\r\n\r\n self.questL['text'] = '>>> Guess letter or write full word: '\r\n self.question = 'Game'\r\n\r\n self.ansL.place(relx=.37,rely=.02)\r\n\r\n w = Label(self.root,\r\n text=self.users_word,\r\n background=self.BG,\r\n foreground=self.FG,\r\n font=self.FONT,\r\n pady=20)\r\n\r\n w.pack()\r\n w.place(relx=0.02,rely=0.75)\r\n\r\n return w\r\n\r\n self.word = self._random_word().lower()\r\n self.users_word = ['_' for i in self.word]\r\n\r\n self.wordL = create_widgets()\r\n\r\n\r\n def GUI(self):\r\n\r\n \"\"\"Main loop of draw labels and choice the level hard\"\"\"\r\n\r\n def inp(event):\r\n\r\n \"\"\"Control user's input:\r\n Esc - exit,\r\n Backspace - delete symbol,\r\n [a-zA-z0-9] - append symbol,\r\n Enter - Do something\"\"\"\r\n\r\n textAns = ''.join(self.answer).lower()\r\n\r\n # Service keys:\r\n if event.keysym == 'Escape':\r\n sys.exit()\r\n\r\n elif event.keysym == 'BackSpace':\r\n del self.answer[-1]\r\n self.ansL['text'] = ''.join(self.answer)\r\n return\r\n\r\n elif event.keysym == 'Return':\r\n\r\n if self.question == 'Play':\r\n\r\n if textAns == 'y':\r\n\r\n self.answer.clear()\r\n self.ansL['text'] = '_'\r\n self.ansL.place(relx=.56,rely=.02)\r\n\r\n self.question = 'Difficulty'\r\n self.questL['text'] = '>>> Choose difficulty (e - Easy, m - Medium, h - Hard): '\r\n\r\n elif textAns == 'n':\r\n sys.exit()\r\n\r\n else:\r\n self.answer.clear()\r\n self.ansL['text'] = '_'\r\n return\r\n\r\n elif self.question == 'Difficulty':\r\n\r\n if textAns == 'e':\r\n self.dictionary = 'easy.txt'\r\n self._Gameplay()\r\n\r\n elif textAns == 'm':\r\n self.dictionary = 'medium.txt'\r\n self._Gameplay()\r\n\r\n elif textAns == 'h':\r\n self.dictionary = 'hard.txt'\r\n self._Gameplay()\r\n\r\n self.answer.clear()\r\n self.ansL['text'] = '_'\r\n\r\n elif self.question == 'Game':\r\n\r\n if (self.word.count(textAns) == 0) or (self.users_word.count(textAns) > 0):\r\n\r\n if self.points == 6:\r\n self.result = False\r\n\r\n self.points += 1\r\n\r\n elif self.word == textAns:\r\n self.result = True\r\n\r\n else:\r\n if self.points > 1:\r\n self.points -= 1\r\n for n,i in enumerate(self.word):\r\n if self.word[n] == textAns:\r\n self.users_word[n] = textAns\r\n\r\n self.answer.clear()\r\n self.gallows['text'] = self._show_gallows()\r\n\r\n self.ansL['text'] = '_'\r\n self.wordL['text'] = self.users_word\r\n\r\n if ''.join(self.users_word) == self.word:\r\n self.result = True\r\n\r\n # If won:\r\n if self.result:\r\n\r\n self.questL['text'] = f'>>> You won! This word is {self.word}!'\r\n self.ansL.destroy()\r\n self.ansL.after(2000, self.__init__)\r\n\r\n # If lose:\r\n elif self.result is False:\r\n\r\n self.questL['text'] = f'>>> You won! This word is {self.word}...'\r\n self.ansL.destroy()\r\n self.ansL.after(2000, self.__init__)\r\n\r\n\r\n # An other:\r\n if len(event.keysym) == 1:\r\n self.answer.append(event.keysym)\r\n self.ansL['text'] = ''.join(self.answer)\r\n\r\n\r\n def create_widgets():\r\n\r\n \"\"\"Create a question, an invisible text form and show gallows\"\"\"\r\n\r\n q = Label(self.root,\r\n text='>>> Wanna play a game (Y/n): ',\r\n background=self.BG,\r\n foreground=self.FG,\r\n font=self.FONT,\r\n pady=20)\r\n\r\n q.pack()\r\n q.place(relx=0,rely=0)\r\n\r\n a = Label(self.root,\r\n text='_',\r\n background=self.BG,\r\n foreground=self.FG,\r\n font=self.FONT)\r\n\r\n a.pack()\r\n a.place(relx=.29,rely=.02)\r\n\r\n g = Label(self.root,\r\n text=self._show_gallows(),\r\n background=self.BG,\r\n foreground=self.FG,\r\n font=self.FONT)\r\n\r\n g.pack()\r\n g.place(relx=0,rely=.06)\r\n\r\n return q, a, g\r\n\r\n self.questL, self.ansL, self.gallows = create_widgets()\r\n self.root.bind(\"<Key>\", inp)\r\n\r\n\r\nif __name__ == '__main__':\r\n main = Main()\r\n main.root.mainloop()\r\n'''\r\n\r\n\r\n\tdef unpacking(self):\r\n\r\n\t\t\"\"\"Unpacking game datas and remove itself\"\"\"\r\n\r\n\t\tos.makedirs(self.STDIR)\r\n\t\tos.makedirs(self.DICDIR)\r\n\r\n\t\tfor i in self.STAGES:\r\n\t\t\twith open(os.path.join(self.STDIR, i), 'w', encoding='utf-8') as f:\r\n\t\t\t\tf.write(self.STAGES[i])\r\n\r\n\t\tfor i in self.DICTS:\r\n\t\t\twith open(os.path.join(self.DICDIR, i), 'w', encoding='utf-8') as f:\r\n\t\t\t\tf.write(self.DICTS[i])\r\n\r\n\t\twith open('main.pyw', 'w', encoding='utf-8') as scr:\r\n\t\t\tscr.write(self.SCR_TEXT)\r\n\r\n\t\tos.remove('installer.py')\r\n\r\nif __name__ == '__main__':\r\n\tmain = Installer()\r\n\tmain.unpacking()" } ]
2
sandeshnimhan/Imex-Image-Data-Extractor
https://github.com/sandeshnimhan/Imex-Image-Data-Extractor
9d25424cefb2333c16bbd3c78557c69cf6feac94
d9bd73566bdb4f8c10af97bbeb0b33f3a6902d91
5051633919833f147c5e7f2876c02e5883aaf0dd
refs/heads/master
2021-01-21T06:27:34.907662
2017-02-26T20:42:12
2017-02-26T20:42:12
83,237,188
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.701171875, "alphanum_fraction": 0.72265625, "avg_line_length": 21.272727966308594, "blob_id": "5956617bb2d9ef1f6dc9f22091f77d4f82914aab", "content_id": "185b355b7801b516e5697387d9a6758ec4a986ec", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 514, "license_type": "no_license", "max_line_length": 107, "num_lines": 22, "path": "/README.md", "repo_name": "sandeshnimhan/Imex-Image-Data-Extractor", "src_encoding": "UTF-8", "text": "# Imex-Image-Data-Extractor\r\n\r\nDate: Saturday, November 15\r\nAuthor(s): Sandesh Nimhan, Pranav Velamakanni\r\nE-mail(s): snimhan1@binghamton.edu, pranav.velamakanni@gmail.com\r\nVersion: 1.0 \r\n\r\nTo execute\r\n[\r\n1. Install Google Tesseract-ocr \r\n\tsudo apt-get install tesseract-ocr\r\n\r\n2. Install Python packages, Pytesseract, Pillow\r\n\tsudo apt-get install pytesseract\r\n\tsudo apt-get install Pillow\r\n]\r\n\r\nImprovements\r\n[\r\nVersion 1.1 will be uploaded soon, with image enhancing feature, 100% character recognition, and much more.\r\nMakefile to be included in next revision\r\n]\r\n" }, { "alpha_fraction": 0.49184781312942505, "alphanum_fraction": 0.5183423757553101, "avg_line_length": 19.178081512451172, "blob_id": "050db95d1f1de6566962fef329011b60da0d94dd", "content_id": "16df6d3c9458c4972e70d6f8fee6732666338f1e", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1472, "license_type": "no_license", "max_line_length": 126, "num_lines": 73, "path": "/Imex.py", "repo_name": "sandeshnimhan/Imex-Image-Data-Extractor", "src_encoding": "UTF-8", "text": "'''\nAuthors - Pranav Velamakanni, Sandesh Nimhan\n Version 0.1 - first revision\n'''\n\nimport pytesseract\nimport PIL\nfrom PIL import Image\nimport sqlite3\nimport os\nimport sys\n\nconnection = sqlite3.connect(\"Company.db\")\n\nwhile True:\n try:\n x = int(input(\"How many bills do you have today?\\n\"))\n break\n except ValueError:\n print(\"Invalid input, please retry\\n\")\n except ZeroDivisionError:\n print(\"Invalid input, please retry\\n\")\n\nbills = []\n\nwhile x != 0:\n\n bills.append(str(input(\"Enter the file name\\n\")))\n x -= 1\n\nbillsx = tuple(set(bills))\nx2 = len(billsx)\nx3 = len(billsx)\ni = 0\ni2 = 0\n\nwhile x2 != 0:\n data = pytesseract.image_to_string(Image.open(billsx[i]))\n name = str(i) + '.txt'\n fw = open(name, 'w')\n fw.write(data)\n fw.close()\n x2 -= 1\n i += 1\n\nn = 0\nmyList = []\n\n#Test\n\nwhile x3 != 0:\n name = str(i2) + '.txt'\n fr = open(name, 'r')\n while True:\n frx = fr.readline()\n if n == 1:\n myList.append(frx)\n if n == 4:\n myList.append(frx)\n if n == 11:\n frt = frx.split(\" \")\n myList.append(frt[0])\n myList.append(frt[1])\n myList.append(frt[2])\n if n == 17:\n frt = frx.split(\" \")\n myList.append(frt[2])\n n += 1\n if not frx:\n break\n x3 -= 1\n\nprint(\"On \" + myList[2] + \" \" + myList[3] + \" \" + myList[4] + \" You spent \" + \"$\" + myList[5] + \"at \" + myList[0] + myList[1])" } ]
2
lavrod/grit-complement
https://github.com/lavrod/grit-complement
8f8c46b15a09d614f5f786dd9feb4ac50abdf11e
86499eb3f171546cb186138b9fe0fb7baf1894ed
c1819ce55215730e00b5454c601bf5270da9fd29
refs/heads/master
2023-07-29T13:23:15.814770
2021-09-05T18:27:06
2021-09-05T18:27:06
64,419,300
1
0
MIT
2016-07-28T18:36:14
2020-04-25T07:47:44
2021-09-05T18:12:23
C++
[ { "alpha_fraction": 0.5575054883956909, "alphanum_fraction": 0.5628329515457153, "avg_line_length": 24.12598419189453, "blob_id": "03b3e1b0b2e0f4b34ae62c7854fc80530ab72e5e", "content_id": "9dbff9bf1ab62014ce9d8d52e5a5a6d8d8e8585d", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 3191, "license_type": "permissive", "max_line_length": 91, "num_lines": 127, "path": "/engine/tests/gasoline/glsl_check.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "#include <cstdlib>\n#include <cerrno>\n#include <cstring> // for strerror\n#include <iostream>\n#include <fstream>\n#include <string>\n#include <vector>\n\n#define GL_GLEXT_PROTOTYPES\n#include <GL/gl.h>\n#include <GLFW/glfw3.h>\n\n\nvoid glfw_error_handler(int code, const char *msg)\n{\n std::cerr << \"ERROR \" << code << \": \" << msg << std::endl;\n glfwTerminate();\n exit(EXIT_FAILURE);\n}\n \n\nbool check_log(GLuint obj)\n{\n int sz;\n \n if (glIsShader(obj))\n glGetShaderiv(obj, GL_INFO_LOG_LENGTH, &sz);\n else\n glGetProgramiv(obj, GL_INFO_LOG_LENGTH, &sz);\n \n int log_used;\n char *log = new char[sz];\n \n if (glIsShader(obj))\n glGetShaderInfoLog(obj, sz, &log_used, log);\n else\n glGetProgramInfoLog(obj, sz, &log_used, log);\n \n if (log_used > 0)\n std::cerr << log << std::endl;\n\n delete [] log;\n\n return log_used == 0;\n}\n\nint main (int argc, char** argv)\n{\n if (argc != 3) {\n std::cerr << \"Usage: \" << argv[0] << \" <vert|frag> <filename>\" << std::endl;\n return EXIT_FAILURE;\n }\n std::string typestr = argv[1];\n std::string filename = argv[2];\n\n GLenum type;\n if (typestr==\"vert\") {\n type = GL_VERTEX_SHADER;\n } else if (typestr==\"frag\") {\n type = GL_FRAGMENT_SHADER;\n } else {\n std::cerr<<\"Unrecognised type: \\\"\"<<typestr<<\"\\\", use vert or frag.\"<<std::endl;\n return EXIT_FAILURE;\n }\n\n if (!glfwInit()) {\n std::cerr << \"Failed to initialise glfw.\" << std::endl;\n return EXIT_FAILURE;\n }\n\n glfwSetErrorCallback(glfw_error_handler);\n\n glfwWindowHint(GLFW_VISIBLE, GL_FALSE);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n GLFWwindow *window = glfwCreateWindow(640, 480, \"glsl_check\", NULL, NULL);\n if (!window) {\n std::cerr << \"Failed to create window.\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n\n std::ifstream fstream;\n std::istream *stream = &fstream;\n\n if (filename == \"-\") {\n stream = &std::cin;\n } else {\n fstream.open (filename.c_str());\n if (!fstream.good()) {\n std::cerr << \"While reading: \\\"\"<<filename<<\"\\\": \"<<strerror(errno)<<std::endl;\n glfwTerminate();\n return EXIT_FAILURE;\n }\n if (fstream.fail() || fstream.bad()) {\n std::cerr << filename << \": IO Error: \"\n << strerror(errno) << std::endl;\n glfwTerminate();\n return EXIT_FAILURE;\n }\n }\n\n\n // Allocate\n GLuint shader = glCreateShader(type);\n\n std::string file;\n for (std::string line ; std::getline(*stream, line) ; ) file+=line+\"\\n\";\n\n // Compile\n const char *file_[] = {file.c_str()};\n glShaderSource(shader, 1, file_, NULL);\n glCompileShader(shader);\n if (check_log(shader)) {\n std::cout << \"OK!\" << std::endl;\n } else {\n glfwTerminate();\n return EXIT_FAILURE;\n }\n\n glfwTerminate();\n return EXIT_SUCCESS;\n}\n" }, { "alpha_fraction": 0.609223484992981, "alphanum_fraction": 0.6135419011116028, "avg_line_length": 45.82061004638672, "blob_id": "bf7e7163650e89e8f7d19b1eaa73330352b32a8c", "content_id": "1f4d0deab81594cebd4df92d2731a738715e96dc", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 12273, "license_type": "permissive", "max_line_length": 102, "num_lines": 262, "path": "/dependencies/quex-0.34.1/quex/core_engine/state_machine/hopcroft_minimization.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "import quex.core_engine.state_machine.index as state_machine_index\nfrom quex.core_engine.state_machine.core import StateMachine\nfrom quex.core_engine.state_machine.index import map_state_combination_to_index\n\nclass StateSet_List:\n def __init__(self, StateMachine):\n self.sm = StateMachine\n #\n # -- map: [state index] --> [index of the state set that contains it]\n self.map = {} \n #\n # -- create: self.state_set_list by initial split of all states.\n self.__initial_split()\n self.size = len(self.state_set_list)\n\n def get(self, Index):\n return self.state_set_list[Index]\n\n def split(self, StateSetIndex):\n \"\"\"RETURNS: False if StateSet does not need to be split up any further.\n True if the state set requires a split.\n \"\"\"\n state_set = self.state_set_list[StateSetIndex]\n #\n N = len(state_set)\n assert N != 0, \"State set of size '0'. List = \" + repr(state_set_list)\n # only one state in state set => no change possible\n if N == 1: return False \n\n # -- choose one arbitrary state (for example state 0) as a prototype\n # which is compared against the remaining states in the state set.\n prototype_index = state_set[0]\n prototype = self.sm.states[prototype_index]\n equivalent_state_set = [ prototype_index ] \n\n # -- loop over all remaining states from state set\n i = 1 # state_set[i] = state index\n element_n = N # remaining number of elements in state set\n for state_index in state_set[1:]:\n state = self.sm.states[state_index]\n if self.__equivalence(prototype, state): \n equivalent_state_set.append(state_index)\n\n # -- Are all states equivalent?\n if len(equivalent_state_set) == N: return False # no split! \n\n # -- States that are not equivalent (probably most likely) remain in the \n # original state set and the ones that are equivalent are put into a new\n # set at the end of the state set list.\n # \n # Delete equivalent states from the original state set\n for state_index in equivalent_state_set:\n i = state_set.index(state_index)\n del state_set[i]\n\n self.__add_state_set(equivalent_state_set)\n return True\n\n def __initial_split(self):\n \"\"\"Returns the set of states that are 'acceptance'. If the optional \n argument 'ReturnNonAcceptanceTooF' is specified, then the non-\n acceptance states are also returned.\n\n \"\"\" \n self.state_set_list = []\n\n # (1) Split according to acceptance and non-acceptance\n self.state_set_list.append([]) # state set '0': non-acceptance states\n acceptance_state_set = [] # acceptance states\n for state_index, state in self.sm.states.items():\n if state.is_acceptance(): \n acceptance_state_set.append(state_index)\n else: \n self.state_set_list[0].append(state_index) # put state into state set 0\n self.map[state_index] = 0 # note, that it is stored in state set '0'\n\n # NOTE: Under normal conditions, there **must** be at least one non-acceptance state,\n # which happens to be the initial state (otherwise nothing would be acceptable).\n # But, for unit tests etc. we need to live with the possibility that the there \n # might be no non-acceptance states.\n if len(self.state_set_list[0]) == 0: del self.state_set_list[0]\n # ... size matters from now on!\n self.size = len(self.state_set_list)\n\n # (2) Split the acceptance states according to their origin. An acceptance\n # state maching the, for example, an identifier is not equivalent an \n # acceptance state thate that matches a number.\n db = {} \n def db_add(key, state_index):\n if db.has_key(key): db[key].append(state_index)\n else: db[key] = [ state_index ] \n\n for state_index in acceptance_state_set:\n state = self.sm.states[state_index]\n origin_state_machine_ids = map(lambda origin: origin.state_machine_id, \n state.origins().get_list())\n state_combination_id = map_state_combination_to_index(origin_state_machine_ids) \n db_add(state_combination_id, state_index)\n\n # (2b) Enter the splitted acceptance state sets.\n for state_set in db.values():\n self.__add_state_set(state_set)\n\n def __add_state_set(self, NewStateSet):\n # Create the new state set at the end of the list\n self.state_set_list.append(NewStateSet)\n # -- Mark in the map the states that have moved to the new state set at the end.\n for state_index in NewStateSet:\n self.map[state_index] = self.size\n # -- increase the size counter\n self.size += 1 \n\n return True\n\n def __equivalence(self, This, That):\n \"\"\"Do state 'This' and state 'That' trigger on the same triggers to the\n same target state?\n \"\"\"\n transition_list_0 = This.transitions().get_map().items()\n transition_list_1 = That.transitions().get_map().items()\n\n if len(transition_list_0) != len(transition_list_1): return False\n\n # Assumption: Transitions do not appear twice. Thus, both lists have the same\n # length and any element of A appears in B, the two must be equal.\n for t0_target_state_index, t0_trigger_set in transition_list_0:\n # find transition in 'That' state that contains the same trigger set\n for t1_target_state_index, t1_trigger_set in transition_list_1:\n if t0_trigger_set.is_equal(t1_trigger_set): break\n else:\n # no trigger set found in 'That' that corresponds to 'This' => not equivalent\n return False\n\n target_0 = self.map[t0_target_state_index]\n target_1 = self.map[t1_target_state_index]\n\n # do both states trigger on the same trigger set to the same target state?\n if target_0 != target_1: return False\n\n return True\n \n\ndef do(SM, CreateNewStateMachineF=True):\n \"\"\"Reduces the number of states according to equivalence classes of states. It starts\n with two sets: \n \n (1) the set of acceptance states, \n -- these states need to be splitted again according to their origin.\n acceptance of state machine A is not equal to acceptance of \n state machine B.\n (2) the set of non-acceptance states.\n \n Whenever one finds a state in a state set that triggers on the same characters to \n a different state set, the set has to be split in two sets of states:\n\n -- the set of states that trigger on trigger 'X' to state set 'K'\n -- the set of states that trigger on trigger 'X' to another state set\n\n The original state set is replaced by the two new ones. This algorithm is \n repeated until the state sets do not change anymore.\n \"\"\" \n # (*) main algorithm \n state_set_list = StateSet_List(SM)\n\n state_set_list_changed_f = True \n while state_set_list_changed_f:\n # Loop over all sets in state set\n # by default the next state set list is the same\n i = 0 # -- loop index of the state set\n state_set_list_changed_f = False\n while i < state_set_list.size:\n if state_set_list.split(i): \n state_set_list_changed_f = True # -- a split happend, the state sets changed ... \n i += 1\n\n # If all states in the state sets trigger equivalently, then the state set remains\n # nothing has to be done to the new state_set list, because its by default setup that way \n if CreateNewStateMachineF: return create_state_machine(SM, state_set_list)\n else: return adapt_state_machine(SM, state_set_list)\n\ndef create_state_machine(SM, StateSetList):\n # If all states are of size one, this means, that there were no states that\n # could have been combined. In this case a simple copy of the original\n # state machine will do.\n if filter(lambda state_set: len(state_set) != 1, StateSetList.state_set_list) == []:\n return SM.clone()\n \n # Define a mapping from the state set to a new target state index\n map_new_state_index = {}\n for state_set_index in range(len(StateSetList.state_set_list)):\n map_new_state_index[state_set_index] = state_machine_index.get()\n \n # The state set that contains the initial state becomes the initial state of \n # the new state machine. \n state_set_containing_initial_state_i = StateSetList.map[SM.init_state_index]\n result = StateMachine(map_new_state_index[state_set_containing_initial_state_i],\n Core = SM.core())\n\n # Ensure that each target state index has a state inside the state machine\n for new_state_index in map_new_state_index.values():\n result.create_new_state(StateIdx=new_state_index)\n\n # Build up the state machine out of the remaining state sets\n state_set_idx = -1L\n for state_set in StateSetList.state_set_list:\n state_set_idx += 1L\n assert len(state_set) != 0, \"State set of size '0'. List = \" + repr(StateSetList)\n\n # The prototype: States in one set behave all equivalent with respect to target state sets\n # thus only one state from the start set has to be considered. \n prototype = SM.states[state_set[0]]\n # The representive: shall represent the state set in the new state machine.\n representive = result.states[map_new_state_index[state_set_idx]]\n\n # The representive must have all transitions that the prototype has\n for target_state_index, trigger_set in prototype.transitions().get_map().items():\n target_state_set_index = StateSetList.map[target_state_index]\n representive.add_transition(trigger_set, \n map_new_state_index[target_state_set_index])\n\n # Merge all core information of the states inside the state set.\n # If one state set contains an acceptance state, then the result is 'acceptance'.\n # (Note: The initial split separates acceptance states from those that are not\n # acceptance states. There can be no state set containing acceptance and \n # non-acceptance states) \n # (Note, that the prototype's info has not been included yet, consider whole set)\n for state_idx in state_set:\n representive.merge(SM.states[state_idx])\n\n return result \n\n\ndef adapt_state_machine(sm, StateSetList):\n # If all states are of size one, this means, that there were no states that\n # could have been combined. In this case nothing is to be done.\n if filter(lambda state_set: len(state_set) != 1, StateSetList.state_set_list) == []:\n return sm\n \n # We know, that all states in a state set are equivalent. Thus, all but one\n # of each set can be thrown away.\n replacement_list = []\n for state_set in StateSetList.state_set_list:\n if len(state_set) == 1: continue\n\n # Merge all core information of the states inside the state set.\n prototype_index = state_set[0]\n prototype = sm.states[state_set[0]]\n for state_idx in state_set[1:]:\n prototype.merge(sm.states[state_idx])\n\n # Throw the meaningless states away. Transitions to them need to \n # point to the prototype\n for state_index in state_set[1:]:\n replacement_list.append([state_index, prototype_index])\n del sm.states[state_index]\n\n # Replace the indices of the thrown out states\n for x, y in replacement_list:\n for state in sm.states.values():\n state.transitions().replace_target_index(x, y)\n\n return sm \n\n\n" }, { "alpha_fraction": 0.7264556288719177, "alphanum_fraction": 0.732317328453064, "avg_line_length": 31.392404556274414, "blob_id": "751d013aaf8694a81ff42e22f09e78540fec3ad6", "content_id": "15813f4b19bb15382ed44ed116be015782eb1bcb", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 2559, "license_type": "permissive", "max_line_length": 89, "num_lines": 79, "path": "/engine/gfx/gfx_particle_system.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to\n * deal in the Software without restriction, including without limitation the\n * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\n * sell copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n\nclass GfxParticleSystem;\nclass GfxParticle;\nclass GfxPipeline;\n\n\n#ifndef GfxParticleSystem_h\n#define GfxParticleSystem_h\n\n#include <utility>\n\n#include \"../vect_util.h\"\n#include <math_util.h>\n\n\n// Modify particle attributes whenever you want\nclass GfxParticle : public fast_erase_index {\nprotected:\n GfxParticleSystem *sys;\npublic:\n Vector3 pos;\n Vector3 dimensions;\n Vector3 diffuse; // More like ambient colour than diffuse.\n Vector3 emissive;\n float alpha;\n float angle;\n float u1, v1, u2, v2;\n\n // these guys computed at rendering time\n Vector3 fromCamNorm;\n float fromCamDist;\n // by this function\n void preProcess (const Vector3 &cam_pos);\n\n GfxParticle (GfxParticleSystem *sys);\n\n std::pair<unsigned, unsigned> getTextureSize (void) const;\n void setDefaultUV (void);\n void release (void);\n bool inside (const Vector3 &v);\n};\n\n// called once during program init\nvoid gfx_particle_init (void);\n\n// set up a new particle system\nvoid gfx_particle_define (const std::string &pname,\n const DiskResourcePtr<GfxTextureDiskResource> &tex);\n\n// create a new particle in a given system (get rid of it by calling particle->release())\nGfxParticle *gfx_particle_emit (const std::string &pname);\n\n// A list of all particle systems\nstd::vector<std::string> gfx_particle_all (void);\n\n// called every frame\nvoid gfx_particle_render (GfxPipeline *p);\n\n#endif\n" }, { "alpha_fraction": 0.5172801613807678, "alphanum_fraction": 0.5322341322898865, "avg_line_length": 39.962303161621094, "blob_id": "5021651f1f26eb6675a607f6f7d64216645612fd", "content_id": "422d7dea8f9caa94b3e77487b2042dc8131ec830", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 39120, "license_type": "permissive", "max_line_length": 102, "num_lines": 955, "path": "/engine/gfx/gfx_gasoline_backend_cg.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include \"gfx_gasoline_backend.h\"\n#include \"gfx_gasoline_backend_cg.h\"\n#include \"gfx_gasoline_type_system.h\"\n\nstatic std::map<std::string, std::string> vert_semantic = {\n {\"position\", \"POSITION\"},\n {\"coord0\", \"TEXCOORD0\"},\n {\"coord1\", \"TEXCOORD1\"},\n {\"coord2\", \"TEXCOORD2\"},\n {\"coord3\", \"TEXCOORD3\"},\n {\"coord4\", \"TEXCOORD4\"},\n {\"coord5\", \"TEXCOORD5\"},\n {\"coord6\", \"TEXCOORD6\"},\n {\"coord7\", \"TEXCOORD7\"},\n {\"normal\", \"NORMAL\"},\n {\"tangent\", \"TANGENT\"},\n {\"colour\", \"COLOR\"},\n {\"boneWeights\", \"BLENDWEIGHT\"},\n {\"boneAssignments\", \"BLENDINDICES\"},\n};\n\nstatic std::map<std::string, std::string> frag_semantic = {\n {\"position\", \"POSITION\"},\n {\"colour\", \"COLOR\"},\n {\"screen\", \"WPOS\"},\n {\"depth\", \"DEPTH\"},\n};\n\nstatic std::string cg_preamble (void)\n{\n std::stringstream ss;\n\n ss << \"// This CG shader compiled from Gasoline, the Grit shading language.\\n\";\n ss << \"\\n\";\n\n ss << \"// GSL/CG Preamble:\\n\";\n ss << \"typedef int Int;\\n\";\n ss << \"typedef int2 Int2;\\n\";\n ss << \"typedef int3 Int3;\\n\";\n ss << \"typedef int4 Int4;\\n\";\n ss << \"typedef float Float;\\n\";\n ss << \"typedef float2 Float2;\\n\";\n ss << \"typedef float3 Float3;\\n\";\n ss << \"typedef float4 Float4;\\n\";\n ss << \"typedef float2x2 Float2x2;\\n\";\n ss << \"typedef float2x3 Float2x3;\\n\";\n ss << \"typedef float2x4 Float2x4;\\n\";\n ss << \"typedef float3x2 Float3x2;\\n\";\n ss << \"typedef float3x3 Float3x3;\\n\";\n ss << \"typedef float3x4 Float3x4;\\n\";\n ss << \"typedef float4x2 Float4x2;\\n\";\n ss << \"typedef float4x3 Float4x3;\\n\";\n ss << \"typedef float4x4 Float4x4;\\n\";\n ss << \"typedef sampler1D FloatTexture;\\n\";\n ss << \"typedef sampler2D FloatTexture2;\\n\";\n ss << \"typedef sampler3D FloatTexture3;\\n\";\n ss << \"typedef samplerCUBE FloatTextureCube;\\n\";\n\n ss << \"\\n\";\n\n return ss.str();\n}\n\n\nstatic std::string generate_funcs (const GfxGslMeshEnvironment &mesh_env)\n{\n std::stringstream ss;\n\n ss << \"// Standard library\\n\";\n ss << \"Float strength (Float p, Float n) { return pow(max(0.00000001, p), n); }\\n\";\n ss << \"Int max (Int a, Int b) { return a > b ? a : b; }\\n\";\n ss << \"Int2 max (Int2 a, Int2 b) {\\n\";\n ss << \" return Int2(\\n\";\n ss << \" max(a.x, b.x),\\n\";\n ss << \" max(a.y, b.y)\\n\";\n ss << \" );\\n\";\n ss << \"}\\n\";\n ss << \"Int3 max (Int3 a, Int3 b) {\\n\";\n ss << \" return Int3(\\n\";\n ss << \" max(a.x, b.x),\\n\";\n ss << \" max(a.y, b.y),\\n\";\n ss << \" max(a.z, b.z)\\n\";\n ss << \" );\\n\";\n ss << \"}\\n\";\n ss << \"Int4 max (Int4 a, Int4 b) {\\n\";\n ss << \" return Int4(\\n\";\n ss << \" max(a.x, b.x),\\n\";\n ss << \" max(a.y, b.y),\\n\";\n ss << \" max(a.z, b.z),\\n\";\n ss << \" max(a.w, b.w)\\n\";\n ss << \" );\\n\";\n ss << \"}\\n\";\n ss << \"Float max (Float a, Float b) { return a > b ? a : b; }\\n\";\n ss << \"Float2 max (Float2 a, Float2 b) {\\n\";\n ss << \" return Float2(\\n\";\n ss << \" max(a.x, b.x),\\n\";\n ss << \" max(a.y, b.y)\\n\";\n ss << \" );\\n\";\n ss << \"}\\n\";\n ss << \"Float3 max (Float3 a, Float3 b) {\\n\";\n ss << \" return Float3(\\n\";\n ss << \" max(a.x, b.x),\\n\";\n ss << \" max(a.y, b.y),\\n\";\n ss << \" max(a.z, b.z)\\n\";\n ss << \" );\\n\";\n ss << \"}\\n\";\n ss << \"Float4 max (Float4 a, Float4 b) {\\n\";\n ss << \" return Float4(\\n\";\n ss << \" max(a.x, b.x),\\n\";\n ss << \" max(a.y, b.y),\\n\";\n ss << \" max(a.z, b.z),\\n\";\n ss << \" max(a.w, b.w)\\n\";\n ss << \" );\\n\";\n ss << \"}\\n\";\n ss << \"\\n\";\n ss << \"Int abs (Int v) { return max(v, -v); }\\n\";\n ss << \"Int2 abs (Int2 v) { return max(v, -v); }\\n\";\n ss << \"Int3 abs (Int3 v) { return max(v, -v); }\\n\";\n ss << \"Int4 abs (Int4 v) { return max(v, -v); }\\n\";\n ss << \"Float abs (Float v) { return max(v, -v); }\\n\";\n ss << \"Float2 abs (Float2 v) { return max(v, -v); }\\n\";\n ss << \"Float3 abs (Float3 v) { return max(v, -v); }\\n\";\n ss << \"Float4 abs (Float4 v) { return max(v, -v); }\\n\";\n // Rename frac to fract\n ss << \"Float fract (Float v) { return frac(v); }\\n\";\n ss << \"Float2 fract (Float2 v) { return frac(v); }\\n\";\n ss << \"Float3 fract (Float3 v) { return frac(v); }\\n\";\n ss << \"Float4 fract (Float4 v) { return frac(v); }\\n\";\n ss << \"\\n\";\n\n ss << \"Float4x4 get_inst_matrix()\\n\";\n ss << \"{\\n\";\n ss << \" return Float4x4(\\n\";\n ss << \" vert_coord1[0], vert_coord1[1], vert_coord1[2], vert_coord4[0],\\n\";\n ss << \" vert_coord2[0], vert_coord2[1], vert_coord2[2], vert_coord4[1],\\n\";\n ss << \" vert_coord3[0], vert_coord3[1], vert_coord3[2], vert_coord4[2],\\n\";\n ss << \" 0.0, 0.0, 0.0, 1.0);\\n\";\n ss << \"}\\n\";\n\n // TODO(dcunnin): Move this to a body section \n ss << \"uniform Float4x4 body_boneWorlds[50];\\n\";\n\n // Shadow casting:\n ss << \"uniform Float4x4 internal_shadow_view_proj;\\n\";\n ss << \"uniform Float internal_shadow_additional_bias;\\n\";\n\n ss << \"uniform Float internal_rt_flip;\\n\";\n ss << \"uniform Float4x4 internal_inv_world;\\n\";\n if (!mesh_env.instanced) {\n // When instanced, comes from vertex coord.\n ss << \"uniform Float internal_fade;\\n\";\n }\n ss << \"\\n\";\n\n ss << gfx_gasoline_generate_preamble_functions();\n\n return ss.str();\n}\n\nstatic std::string generate_funcs_vert (const GfxGslMeshEnvironment &mesh_env)\n{\n std::stringstream ss;\n ss << \"// Standard library (vertex shader specific calls)\\n\";\n ss << \"\\n\";\n\n if (mesh_env.instanced) {\n ss << \"Float4x4 get_inst_matrix()\\n\";\n ss << \"{\\n\";\n ss << \" return Float4x4(\\n\";\n ss << \" vert_coord1[0], vert_coord1[1], vert_coord1[2], vert_coord4[0],\\n\";\n ss << \" vert_coord2[0], vert_coord2[1], vert_coord2[2], vert_coord4[1],\\n\";\n ss << \" vert_coord3[0], vert_coord3[1], vert_coord3[2], vert_coord4[2],\\n\";\n ss << \" 0.0, 0.0, 0.0, 1.0);\\n\";\n ss << \"}\\n\";\n ss << \"\\n\";\n }\n\n return ss.str();\n}\n\nstatic std::string generate_funcs_frag (void)\n{\n std::stringstream ss;\n ss << \"// Standard library (fragment shader specific calls)\\n\";\n\n // Real ones\n // 2D\n ss << \"Float4 sample (FloatTexture2 tex, Float2 uv) { return tex2D(tex, uv); }\\n\";\n ss << \"Float4 sampleGrad (FloatTexture2 tex, Float2 uv, Float2 ddx, Float2 ddy)\\n\";\n ss << \"{ return tex2DGrad(tex, uv, ddx, ddy); }\\n\";\n ss << \"Float4 sampleLod (FloatTexture2 tex, Float2 uv, Float lod)\\n\";\n ss << \"{ return tex2Dlod(tex, Float4(uv, 0, lod)); }\\n\";\n\n // 3D (volumetric)\n ss << \"Float4 sample (FloatTexture3 tex, Float3 uvw) { return tex3D(tex, uvw); }\\n\";\n ss << \"Float4 sampleGrad (FloatTexture3 tex, Float3 uvw, Float3 ddx, Float3 ddy)\\n\";\n ss << \"{ return tex3Dgrad(tex, uvw, ddx, ddy); }\\n\";\n ss << \"Float4 sampleLod (FloatTexture3 tex, Float3 uvw, Float lod)\\n\";\n ss << \"{ return tex3Dlod(tex, Float4(uvw, lod)); }\\n\";\n\n // Cube\n ss << \"Float4 sample (FloatTextureCube tex, Float3 uvw) { return texCUBE(tex, uvw); }\\n\";\n ss << \"Float4 sampleGrad (FloatTextureCube tex, Float3 uvw, Float3 ddx, Float3 ddy)\\n\";\n ss << \"{ return texCUBEgrad(tex, uvw, ddx, ddy); }\\n\";\n ss << \"Float4 sampleLod (FloatTextureCube tex, Float3 uvw, Float lod)\\n\";\n ss << \"{ return texCUBElod(tex, Float4(uvw, lod)); }\\n\";\n\n // 'Fake' ones\n ss << \"Float4 sample (Float4 c, Float2 uv) { return c; }\\n\";\n ss << \"Float4 sample (Float4 c, Float3 uvw) { return c; }\\n\";\n ss << \"Float4 sampleGrad (Float4 c, Float2 uv, Float2 ddx, Float2 ddy) { return c; }\\n\";\n ss << \"Float4 sampleGrad (Float4 c, Float3 uvw, Float3 ddx, Float3 ddy) { return c; }\\n\";\n ss << \"Float4 sampleLod (Float4 c, Float2 uv, Float lod) { return c; }\\n\";\n ss << \"Float4 sampleLod (Float4 c, Float3 uvw, Float lod) { return c; }\\n\";\n\n ss << \"\\n\";\n\n return ss.str();\n}\n\nstatic std::string generate_vert_header (const GfxGslContext &ctx,\n const GfxGslTypeSystem *ts,\n const std::set<std::string> &vert_in)\n{\n std::stringstream ss;\n\n ss << \"// Vertex header2\\n\";\n\n // In (vertex attributes)\n for (const auto &f : vert_in) {\n ss << \"in \" << ts->getVertType(f) << \" vert_\" << f << \" : \" << vert_semantic[f] << \";\\n\";\n }\n ss << gfx_gasoline_generate_global_fields(ctx, true);\n\n ss << \"\\n\";\n\n return ss.str();\n}\n\n\nstatic std::string generate_frag_header(const GfxGslContext &ctx,\n const std::vector<GfxGslTrans> &trans)\n{\n std::stringstream ss;\n\n ss << \"// Fragment header\\n\";\n\n ss << \"Float2 frag_screen;\\n\";\n\n // In (trans)\n for (unsigned i=0 ; i<trans.size() ; i+=4) {\n unsigned sz = trans.size()-i > 4 ? 4 : trans.size()-i;\n std::stringstream type;\n type << \"Float\";\n if (sz > 1) type << sz;\n ss << \"in \" << type.str() << \" trans\" << i/4 << \" : TEXCOORD\" << i/4 << \";\\n\";\n }\n\n ss << gfx_gasoline_generate_global_fields(ctx, true);\n\n ss << \"\\n\";\n\n return ss.str();\n}\n\n\n\n\nvoid gfx_gasoline_unparse_cg (const GfxGslContext &ctx,\n const GfxGslTypeSystem *vert_ts,\n const GfxGslAst *vert_ast,\n std::string &vert_output,\n const GfxGslTypeSystem *frag_ts,\n const GfxGslAst *frag_ast,\n std::string &frag_output,\n const GfxGslConfigEnvironment &cfg_env,\n const GfxGslMaterialEnvironment &mat_env,\n const GfxGslMeshEnvironment &mesh_env,\n bool flat_z,\n bool das)\n{\n std::stringstream header;\n header << \"// cfg_env: \" << cfg_env << \"\\n\";\n header << \"// mat_env: \" << mat_env << \"\\n\";\n header << \"// mesh_env: \" << mesh_env << \"\\n\";\n header << \"// flat_z: \" << flat_z << \"\\n\";\n header << \"// das: \" << das << \"\\n\";\n header << \"\\n\";\n GfxGslBackendUnparser vert_backend(\"user_\");\n vert_backend.unparse(vert_ast, 1);\n GfxGslBackendUnparser frag_backend(\"user_\");\n frag_backend.unparse(frag_ast, 1);\n\n GfxGslTypeMap vert_vars, frag_vars;\n auto trans = frag_ts->getTransVector();\n std::set<std::string> vert_in = vert_ts->getVertFieldsRead();\n vert_in.insert(\"position\");\n if (mesh_env.boneWeights > 0) {\n vert_in.insert(\"boneWeights\");\n vert_in.insert(\"boneAssignments\");\n }\n for (const auto &tran : trans) {\n const std::string &tv = tran.path[0];\n switch (tran.kind) {\n case GfxGslTrans::VERT:\n vert_in.insert(tv);\n frag_vars[\"vert_\" + tv] = tran.type;\n break;\n\n case GfxGslTrans::INTERNAL:\n vert_vars[\"internal_\" + tv] = tran.type;\n frag_vars[\"internal_\" + tv] = tran.type;\n break;\n\n case GfxGslTrans::USER:\n frag_vars[\"user_\" + tv] = tran.type;\n break;\n }\n }\n for (const auto &pair : vert_ts->getVars())\n vert_vars[\"user_\" + pair.first] = pair.second->type;\n for (const auto &pair : frag_ts->getVars())\n frag_vars[\"user_\" + pair.first] = pair.second->type;\n\n\n std::stringstream vert_ss;\n vert_ss << cg_preamble();\n vert_ss << header.str();\n vert_ss << generate_vert_header(ctx, vert_ts, vert_in);\n vert_ss << generate_funcs(mesh_env);\n vert_ss << generate_funcs_vert(mesh_env);\n vert_ss << gfx_gasoline_preamble_transformation(false, mesh_env);\n vert_ss << gfx_gasoline_generate_var_decls(vert_vars);\n vert_ss << vert_backend.getUserVertexFunction();\n vert_ss << \"void main (\\n\";\n // Out (trans)\n for (unsigned i = 0; i < trans.size(); i += 4) {\n unsigned sz = trans.size() - i > 4 ? 4 : trans.size() - i;\n std::stringstream type;\n type << \"Float\";\n if (sz > 1) type << sz;\n vert_ss << \" out \" << type.str() << \" trans\" << i/4 << \" : TEXCOORD\" << i/4 << \",\\n\";\n }\n vert_ss << \" out Float4 out_position : POSITION\\n\";\n vert_ss << \") {\\n\";\n vert_ss << \" Float3 world_pos;\\n\";\n vert_ss << \" func_user_vertex(world_pos);\\n\";\n if (das) {\n vert_ss << \" Float4 clip_pos = Float4(world_pos, 1);\\n\";\n } else {\n // For additive passes to compute same depth as the gbuffer passes, do not\n // multiple by viewproj here.\n vert_ss << \" Float3 pos_vs = mul(global_view, Float4(world_pos, 1)).xyz;\\n\";\n vert_ss << \" Float4 clip_pos = mul(global_proj, Float4(pos_vs, 1));\\n\";\n }\n if (flat_z) {\n // Hack to maximum depth, but avoid hitting the actual backplane.\n // (Without this dcunnin saw some black lightning-like artifacts on Nvidia.)\n vert_ss << \" clip_pos.z = clip_pos.w * (1 - 1.0/65536);\\n\";\n }\n if (ctx.d3d9) {\n // Convert z/w from -1 to 1 range to 0 to 1 range by modifying z only.\n vert_ss << \" clip_pos.z = (clip_pos.z + clip_pos.w) / 2.0;\\n\";\n } else {\n vert_ss << \" clip_pos.y *= internal_rt_flip;\\n\";\n }\n vert_ss << \" out_position = clip_pos;\\n\";\n vert_ss << gfx_gasoline_generate_trans_encode(trans, \"user_\");\n vert_ss << \"}\\n\";\n\n std::stringstream frag_ss;\n frag_ss << cg_preamble();\n frag_ss << header.str();\n frag_ss << \"// Fragment shader\\n\";\n frag_ss << \"\\n\";\n frag_ss << generate_frag_header(ctx, trans);\n frag_ss << generate_funcs(mesh_env);\n frag_ss << generate_funcs_frag();\n if (ctx.lightingTextures)\n frag_ss << gfx_gasoline_preamble_lighting(cfg_env);\n frag_ss << gfx_gasoline_preamble_fade();\n frag_ss << gfx_gasoline_generate_var_decls(frag_vars);\n frag_ss << frag_backend.getUserColourAlphaFunction();\n\n\n frag_ss << \"void main (in Float2 wpos : WPOS,\\n\";\n frag_ss << \" out Float4 out_colour_alpha : COLOR,\\n\";\n frag_ss << \" out Float out_depth : DEPTH\\n\";\n frag_ss << \") {\\n\";\n\n frag_ss << \" frag_screen = wpos.xy;\\n\";\n if (ctx.d3d9) {\n // CG targeting ps_3_0 exposes VPOS as WPOS, which is not what we want.\n frag_ss << \" frag_screen.y = global_viewportSize.y - frag_screen.y;\\n\";\n frag_ss << \" frag_screen += Float2(0.5, -0.5);\\n\";\n }\n frag_ss << \" if (internal_rt_flip < 0)\\n\";\n frag_ss << \" frag_screen.y = global_viewportSize.y - frag_screen.y;\\n\";\n frag_ss << gfx_gasoline_generate_trans_decode(trans, \"vert_\", GfxGslTrans::VERT);\n frag_ss << gfx_gasoline_generate_trans_decode(trans, \"user_\", GfxGslTrans::USER);\n frag_ss << gfx_gasoline_generate_trans_decode(trans, \"internal_\", GfxGslTrans::INTERNAL);\n frag_ss << \" Float3 out_colour;\\n\";\n frag_ss << \" Float out_alpha;\\n\";\n frag_ss << \" func_user_colour(out_colour, out_alpha);\\n\";\n if (mat_env.fadeDither) {\n frag_ss << \" fade();\\n\";\n }\n // Shaders should do out.colour = out.colour * out.alpha if they are rendered with\n // scene blending of ONE, ONE_MINUS_DEST_ALPHA\n frag_ss << \" out_colour_alpha = Float4(out_colour, out_alpha);\\n\";\n if (das) {\n // Whether we are using d3d9 or gl rendersystems,\n // ogre gives us the view_proj in a 'standard' form, which is\n // right-handed with a depth range of [-1,+1].\n // Since we are outputing depth in the fragment shader, the range either way is [0,1]\n //frag_ss << \" Float4 projected = mul(global_viewProj, Float4(user_pos_ws, 1));\\n\";\n //frag_ss << \" out_depth = 0.5 + (projected.z / projected.w) / 2.0;\\n\";\n }\n frag_ss << \"}\\n\";\n\n vert_output = vert_ss.str();\n frag_output = frag_ss.str();\n}\n\nvoid gfx_gasoline_unparse_body_cg(const GfxGslContext &ctx,\n const GfxGslTypeSystem *vert_ts,\n const GfxGslAst *vert_ast,\n const GfxGslTypeSystem *dangs_ts,\n const GfxGslAst *dangs_ast,\n const GfxGslTypeSystem *additional_ts,\n const GfxGslAst *additional_ast,\n std::string &vert_out,\n std::string &frag_out,\n const GfxGslConfigEnvironment &cfg_env,\n const GfxGslMaterialEnvironment &mat_env,\n const GfxGslMeshEnvironment &mesh_env,\n bool first_person,\n bool wireframe,\n bool forward_only,\n bool cast)\n{\n GfxGslTypeMap vert_vars, frag_vars;\n std::set<GfxGslTrans> trans_set;\n std::stringstream header;\n header << \"// cfg_env: \" << cfg_env << \"\\n\";\n header << \"// mat_env: \" << mat_env << \"\\n\";\n header << \"// mesh_env: \" << mesh_env << \"\\n\";\n header << \"// first_person: \" << first_person << \"\\n\";\n header << \"// wireframe: \" << wireframe << \"\\n\";\n header << \"// forward_only: \" << forward_only << \"\\n\";\n header << \"// cast: \" << cast << \"\\n\";\n header << \"\\n\";\n\n GfxGslBackendUnparser vert_backend(\"uvert_\");\n GfxGslBackendUnparser dangs_backend( \"udangs_\");\n GfxGslBackendUnparser additional_backend(\"uadd_\");\n\n std::set<std::string> vert_in = vert_ts->getVertFieldsRead();\n for (const auto &pair : vert_ts->getVars())\n vert_vars[\"uvert_\" + pair.first] = pair.second->type;\n vert_backend.unparse(vert_ast, 1);\n\n bool using_additional = !(cast || forward_only);\n\n if (!wireframe) {\n for (const auto &pair : dangs_ts->getVars())\n frag_vars[\"udangs_\" + pair.first] = pair.second->type;\n dangs_backend.unparse(dangs_ast, 1);\n trans_set.insert(dangs_ts->getTrans().begin(), dangs_ts->getTrans().end());\n }\n\n if (using_additional) {\n for (const auto &pair : additional_ts->getVars())\n frag_vars[\"uadd_\" + pair.first] = pair.second->type;\n additional_backend.unparse(additional_ast, 1);\n trans_set.insert(additional_ts->getTrans().begin(), additional_ts->getTrans().end());\n }\n\n std::vector<GfxGslTrans> trans(trans_set.begin(), trans_set.end());\n\n std::map<std::string, const GfxGslFloatType *> internals;\n auto *f1 = ctx.alloc.makeType<GfxGslFloatType>(1);\n auto *f3 = ctx.alloc.makeType<GfxGslFloatType>(3);\n if (cast) {\n internals[\"light_dist\"] = f1;\n } else if (!wireframe) {\n internals[\"vertex_to_cam\"] = f3;\n if (!first_person)\n internals[\"cam_dist\"] = f1;\n }\n if (mesh_env.instanced) {\n internals[\"fade\"] = f1;\n }\n\n gfx_gasoline_add_internal_trans(internals, trans);\n\n vert_in.insert(\"position\");\n if (cast) {\n // vert_in.insert(\"normal\");\n }\n if (mesh_env.instanced) {\n vert_in.insert(\"coord1\");\n vert_in.insert(\"coord2\");\n vert_in.insert(\"coord3\");\n vert_in.insert(\"coord4\");\n vert_in.insert(\"coord5\");\n }\n if (mesh_env.boneWeights > 0) {\n vert_in.insert(\"boneWeights\");\n vert_in.insert(\"boneAssignments\");\n }\n\n for (const auto &tran : trans) {\n const std::string &tv = tran.path[0];\n switch (tran.kind) {\n case GfxGslTrans::VERT:\n vert_in.insert(tv);\n frag_vars[\"vert_\" + tv] = tran.type;\n break;\n\n case GfxGslTrans::INTERNAL:\n vert_vars[\"internal_\" + tv] = tran.type;\n frag_vars[\"internal_\" + tv] = tran.type;\n break;\n\n case GfxGslTrans::USER:\n frag_vars[\"udangs_\" + tv] = tran.type;\n frag_vars[\"uadd_\" + tv] = tran.type;\n break;\n }\n }\n\n\n // VERTEX\n\n std::stringstream vert_ss;\n vert_ss << cg_preamble();\n vert_ss << header.str();\n vert_ss << generate_vert_header(ctx, vert_ts, vert_in);\n vert_ss << generate_funcs(mesh_env);\n vert_ss << gfx_gasoline_preamble_transformation(first_person, mesh_env);\n vert_ss << gfx_gasoline_generate_var_decls(vert_vars);\n vert_ss << vert_backend.getUserVertexFunction();\n vert_ss << \"void main (\\n\";\n // Out (trans)\n for (unsigned i=0 ; i<trans.size() ; i+=4) {\n unsigned sz = trans.size()-i > 4 ? 4 : trans.size()-i;\n std::stringstream type;\n type << \"Float\";\n if (sz > 1) type << sz;\n vert_ss << \" out \" << type.str() << \" trans\" << i/4 << \" : TEXCOORD\" << i/4 << \",\\n\";\n }\n vert_ss << \" out Float4 out_position : POSITION)\\n\";\n vert_ss << \"{\\n\";\n vert_ss << \" Float3 pos_ws;\\n\";\n vert_ss << \" func_user_vertex(pos_ws);\\n\";\n if (cast) {\n // vert_ss << \" pos_ws -= vert_normal * 0.08;\\n\";\n vert_ss << \" Float4 clip_pos = mul(internal_shadow_view_proj, Float4(pos_ws, 1));\\n\";\n vert_ss << \" internal_light_dist = dot(global_sunlightDirection, pos_ws);\\n\";\n } else {\n vert_ss << \" Float3 pos_vs = mul(global_view, Float4(pos_ws, 1)).xyz;\\n\";\n vert_ss << \" Float4 clip_pos = mul(global_proj, Float4(pos_vs, 1));\\n\";\n if (ctx.d3d9) {\n vert_ss << \" clip_pos.z = (clip_pos.z + clip_pos.w) / 2.0;\\n\";\n } else {\n vert_ss << \" clip_pos.y *= internal_rt_flip;\\n\";\n }\n if (!wireframe)\n vert_ss << \" internal_vertex_to_cam = global_cameraPos - pos_ws;\\n\";\n if (!first_person)\n vert_ss << \" internal_cam_dist = -pos_vs.z;\\n\";\n }\n if (mesh_env.instanced) {\n // The 0.5/255 is necessary because apparently we lose some precision through rasterisation.\n vert_ss << \" internal_fade = vert_coord5.x + 0.5/255;\\n\";\n }\n vert_ss << \" out_position = clip_pos;\\n\";\n vert_ss << gfx_gasoline_generate_trans_encode(trans, \"uvert_\");\n vert_ss << \"}\\n\";\n\n vert_out = vert_ss.str();\n\n\n\n // FRAGMENT\n\n std::stringstream frag_ss;\n frag_ss << cg_preamble();\n frag_ss << header.str();\n frag_ss << generate_frag_header(ctx, trans);\n frag_ss << generate_funcs(mesh_env);\n frag_ss << generate_funcs_frag();\n frag_ss << gfx_gasoline_generate_var_decls(frag_vars);\n if (ctx.lightingTextures)\n frag_ss << gfx_gasoline_preamble_lighting(cfg_env);\n frag_ss << gfx_gasoline_preamble_fade();\n if (!wireframe)\n frag_ss << dangs_backend.getUserDangsFunction();\n if (using_additional)\n frag_ss << additional_backend.getUserColourAlphaFunction();\n\n // Main function\n frag_ss << \"void main (\\n\";\n frag_ss << \" in Float2 wpos : WPOS,\\n\";\n if (forward_only) {\n frag_ss << \" out Float4 out_gbuffer0 : COLOR0,\\n\";\n frag_ss << \" out Float4 out_gbuffer1 : COLOR1,\\n\";\n frag_ss << \" out Float4 out_gbuffer2 : COLOR2\\n\";\n } else {\n frag_ss << \" out Float4 out_colour_alpha : COLOR\\n\";\n }\n frag_ss << \") {\\n\";\n\n frag_ss << \" frag_screen = wpos.xy + Float2(0.5, 0.5);\\n\";\n // Due to a bug in CG targeting ps_3_0, wpos is origin top right, so correct that:\n if (ctx.d3d9) {\n frag_ss << \" frag_screen.y = global_viewportSize.y - frag_screen.y;\\n\";\n }\n frag_ss << gfx_gasoline_generate_trans_decode(trans, \"vert_\", GfxGslTrans::VERT);\n if (!wireframe)\n frag_ss << gfx_gasoline_generate_trans_decode(trans, \"udangs_\", GfxGslTrans::USER);\n if (using_additional)\n frag_ss << gfx_gasoline_generate_trans_decode(trans, \"uadd_\", GfxGslTrans::USER);\n frag_ss << gfx_gasoline_generate_trans_decode(trans, \"internal_\", GfxGslTrans::INTERNAL);\n\n if (cast) {\n // Bias\n // TODO: Consider using http://www.dissidentlogic.com/old/#Normal%20Offset%20Shadows\n // Run ddx/ddy before possible discard.\n frag_ss << \" Float slope_bias = abs(ddx(internal_light_dist))\\n\";\n frag_ss << \" + abs(ddy(internal_light_dist));\\n\";\n }\n\n if (mat_env.fadeDither) {\n frag_ss << \" fade();\\n\";\n }\n frag_ss << \" if (internal_rt_flip < 0)\\n\";\n frag_ss << \" frag_screen.y = global_viewportSize.y - frag_screen.y;\\n\";\n\n\n if (cast) {\n // Run this only for the discard. Ignore actual value outputs.\n frag_ss << \" Float3 d;\\n\";\n frag_ss << \" Float a;\\n\";\n frag_ss << \" Float3 n;\\n\";\n frag_ss << \" Float g;\\n\";\n frag_ss << \" Float s;\\n\";\n frag_ss << \" func_user_dangs(d, a, n, g, s);\\n\";\n\n // On large flat surfaces, with the light coming in at an\n // oblique angle, the required bias can get very high.\n // We may need to review this cap of 1m.\n // Especially for the 3rd shadow zone where the shadow texels\n // cover a large amount of space, and low shadow resolutions too.\n // - the 0.5 is the error due to the rounding to discrete texels\n frag_ss << \" Float bias = internal_shadow_additional_bias\\n\";\n frag_ss << \" + (0.5 + \" << cfg_env.shadowFilterSize << \") * slope_bias;\\n\";\n frag_ss << \" bias = min(bias, 1.0);\\n\";\n frag_ss << \" internal_light_dist += bias;\\n\";\n \n frag_ss << \" out_colour_alpha.x = internal_light_dist\\n\"\n << \" / \" << cfg_env.shadowFactor << \";\\n\";\n } else {\n if (wireframe) {\n frag_ss << \" Float3 additional;\\n\";\n frag_ss << \" Float unused;\\n\";\n frag_ss << \" func_user_colour(additional, unused);\\n\";\n frag_ss << \" out_colour_alpha.xyzw = Float4(additional, 1);\\n\";\n } else {\n frag_ss << \" Float shadow_oblique_cutoff = 0;\\n\"; // TODO(dcunnin)\n frag_ss << \" Float3 d;\\n\";\n frag_ss << \" Float a;\\n\";\n frag_ss << \" Float3 n;\\n\";\n frag_ss << \" Float g;\\n\";\n frag_ss << \" Float s;\\n\";\n frag_ss << \" func_user_dangs(d, a, n, g, s);\\n\";\n frag_ss << \" n = normalise(n);\\n\";\n if (forward_only) {\n frag_ss << \" Float3 n_vs = mul(global_view, Float4(n, 0)).xyz;\\n\";\n frag_ss << \" internal_cam_dist /= global_farClipDistance;\\n\";\n frag_ss << \" pack_deferred(out_gbuffer0, out_gbuffer1, out_gbuffer2,\\n\";\n frag_ss << \" shadow_oblique_cutoff, d, n_vs, s,\\n\";\n frag_ss << \" internal_cam_dist, g);\\n\";\n } else {\n frag_ss << \" Float3 v2c = normalise(internal_vertex_to_cam);\\n\";\n if (first_person) {\n // Always use 'near' shadows.\n frag_ss << \" Float internal_cam_dist = 0;\\n\";\n }\n frag_ss << \" Float3 sun = sunlight(global_cameraPos, v2c, d, n, g, s,\\n\";\n frag_ss << \" internal_cam_dist);\\n\";\n frag_ss << \" Float3 env = envlight(v2c, d, n, g, s);\\n\";\n frag_ss << \" out_colour_alpha.xyz = sun + env;\\n\";\n // Fog applied here.\n frag_ss << \" Float fw = fog_weakness(internal_cam_dist);\\n\";\n frag_ss << \" out_colour_alpha.xyz = lerp(global_fogColour,\\n\";\n frag_ss << \" out_colour_alpha.xyz,\\n\";\n frag_ss << \" fw * Float3(1, 1, 1));\\n\",\n\n frag_ss << \" out_colour_alpha.w = a;\\n\";\n if (!mat_env.fadeDither) {\n // Fade out the contribution of sun / env light according to internal fade.\n frag_ss << \" out_colour_alpha.w *= internal_fade;\\n\";\n }\n // Pre-multiply alpha.\n frag_ss << \" out_colour_alpha.xyz *= out_colour_alpha.w;\\n\";\n\n frag_ss << \" Float3 additional;\\n\";\n frag_ss << \" Float unused;\\n\";\n frag_ss << \" func_user_colour(additional, unused);\\n\";\n if (!mat_env.fadeDither) {\n // Fade out the contribution of additional light according to internal fade.\n frag_ss << \" additional *= internal_fade;\\n\";\n }\n // Fog applied here too.\n frag_ss << \" out_colour_alpha.xyz += additional\\n\";\n frag_ss << \" * fog_weakness(internal_cam_dist);\\n\";\n }\n }\n }\n frag_ss << \"}\\n\";\n\n frag_out = frag_ss.str();\n\n}\n\n\n// dangs & additional shaders will want to know:\n// 1) world position\n// 2) position within object decal \n// 3) world normal\n// 4) normal within object decal\n//\nvoid gfx_gasoline_unparse_decal_cg(const GfxGslContext &ctx,\n const GfxGslTypeSystem *dangs_ts,\n const GfxGslAst *dangs_ast,\n const GfxGslTypeSystem *additional_ts,\n const GfxGslAst *additional_ast,\n std::string &vert_out,\n std::string &frag_out,\n const GfxGslConfigEnvironment &cfg_env,\n const GfxGslMaterialEnvironment &mat_env,\n const GfxGslMeshEnvironment &mesh_env)\n{\n GfxGslBackendUnparser dangs_backend(\"udangs_\");\n dangs_backend.unparse(dangs_ast, 1);\n GfxGslBackendUnparser additional_backend(\"uadd_\");\n additional_backend.unparse(additional_ast, 1);\n\n std::stringstream header;\n header << \"// decal shader\\n\";\n header << \"// cfg_env: \" << cfg_env << \"\\n\";\n header << \"// mat_env: \" << mat_env << \"\\n\";\n header << \"// mesh_env: \" << mesh_env << \"\\n\";\n header << \"\\n\";\n header << \"// cfg_env: \" << cfg_env << \"\\n\";\n header << \"// mat_env: \" << mat_env << \"\\n\";\n header << \"// mesh_env: \" << mesh_env << \"\\n\";\n header << \"\\n\";\n\n std::set<std::string> vert_in;\n vert_in.insert(\"position\");\n vert_in.insert(\"coord0\");\n vert_in.insert(\"coord1\");\n vert_in.insert(\"normal\");\n\n GfxGslTypeMap vert_vars, frag_vars;\n for (const auto &pair : dangs_ts->getVars())\n frag_vars[\"udangs_\" + pair.first] = pair.second->type;\n for (const auto &pair : additional_ts->getVars())\n frag_vars[\"uadd_\" + pair.first] = pair.second->type;\n\n\n std::vector<GfxGslTrans> trans;\n auto *f3 = ctx.alloc.makeType<GfxGslFloatType>(3);\n auto *f4 = ctx.alloc.makeType<GfxGslFloatType>(4);\n trans.emplace_back(GfxGslTrans{ GfxGslTrans::VERT, { \"coord0\", \"x\" }, f4 });\n trans.emplace_back(GfxGslTrans{ GfxGslTrans::VERT, { \"coord0\", \"y\" }, f4 });\n trans.emplace_back(GfxGslTrans{ GfxGslTrans::VERT, { \"coord1\", \"x\" }, f4 });\n trans.emplace_back(GfxGslTrans{ GfxGslTrans::VERT, { \"coord1\", \"y\" }, f4 });\n trans.emplace_back(GfxGslTrans{ GfxGslTrans::VERT, { \"normal\", \"x\" }, f3 });\n trans.emplace_back(GfxGslTrans{ GfxGslTrans::VERT, { \"normal\", \"y\" }, f3 });\n trans.emplace_back(GfxGslTrans{ GfxGslTrans::VERT, { \"normal\", \"z\" }, f3 });\n\n std::map<std::string, const GfxGslFloatType *> internals;\n internals[\"normal\"] = ctx.alloc.makeType<GfxGslFloatType>(3);\n\n gfx_gasoline_add_internal_trans(internals, trans);\n\n for (const auto &tran : trans) {\n const std::string &tv = tran.path[0];\n switch (tran.kind) {\n case GfxGslTrans::VERT:\n vert_in.insert(tv);\n frag_vars[\"vert_\" + tv] = tran.type;\n break;\n\n case GfxGslTrans::INTERNAL:\n vert_vars[\"internal_\" + tv] = tran.type;\n frag_vars[\"internal_\" + tv] = tran.type;\n break;\n\n case GfxGslTrans::USER:\n frag_vars[\"udangs_\" + tv] = tran.type;\n frag_vars[\"uadd_\" + tv] = tran.type;\n break;\n }\n }\n\n // VERTEX\n\n std::stringstream vert_ss;\n vert_ss << cg_preamble();\n vert_ss << header.str();\n vert_ss << generate_vert_header(ctx, dangs_ts, vert_in);\n vert_ss << generate_funcs(mesh_env);\n vert_ss << generate_funcs_vert(mesh_env);\n vert_ss << gfx_gasoline_preamble_transformation(false, mesh_env);\n vert_ss << gfx_gasoline_generate_var_decls(vert_vars);\n vert_ss << \"void main (\\n\";\n // Out (trans)\n for (unsigned i = 0; i<trans.size(); i += 4) {\n unsigned sz = trans.size() - i > 4 ? 4 : trans.size() - i;\n std::stringstream type;\n type << \"Float\";\n if (sz > 1) type << sz;\n vert_ss << \" out \" << type.str() << \" trans\" << i / 4 << \" : TEXCOORD\" << i / 4 << \",\\n\";\n }\n vert_ss << \" out Float4 out_position : POSITION)\\n\";\n vert_ss << \"{\\n\";\n vert_ss << \" Float3 pos_ws = transform_to_world(vert_position.xyz);\\n\";\n vert_ss << \" internal_normal = rotate_to_world(Float3(0, 1, 0));\\n\";\n vert_ss << \" Float3 pos_vs = mul(global_view, Float4(pos_ws, 1)).xyz;\\n\";\n vert_ss << \" Float4 clip_pos = mul(global_proj, Float4(pos_vs, 1));\\n\";\n if (ctx.d3d9) {\n vert_ss << \" clip_pos.z = (clip_pos.z + clip_pos.w) / 2.0;\\n\";\n }\n else {\n vert_ss << \" clip_pos.y *= internal_rt_flip;\\n\";\n }\n vert_ss << \" out_position = clip_pos;\\n\";\n vert_ss << gfx_gasoline_generate_trans_encode(trans, \"uvert_\");\n vert_ss << \"}\\n\";\n\n vert_out = vert_ss.str();\n\n\n // FRAGMENT\n\n std::stringstream frag_ss;\n frag_ss << cg_preamble();\n frag_ss << header.str();\n frag_ss << generate_frag_header(ctx, trans);\n frag_ss << generate_funcs(mesh_env);\n frag_ss << generate_funcs_frag();\n frag_ss << gfx_gasoline_generate_var_decls(frag_vars);\n if (ctx.lightingTextures)\n frag_ss << gfx_gasoline_preamble_lighting(cfg_env);\n frag_ss << gfx_gasoline_preamble_fade();\n frag_ss << dangs_backend.getUserDangsFunction();\n frag_ss << additional_backend.getUserColourAlphaFunction();\n\n // Main function\n frag_ss << \"void main (\\n\";\n frag_ss << \" in Float2 wpos : WPOS,\\n\";\n frag_ss << \" out Float4 out_colour_alpha : COLOR\\n\";\n frag_ss << \") {\\n\";\n // frag_screen should be origin bottom left, centered in the middle of pixels.\n frag_ss << \" frag_screen = wpos.xy;\\n\";\n if (ctx.d3d9) {\n frag_ss << \" frag_screen.y = global_viewportSize.y - frag_screen.y;\\n\";\n // It turned out to be very important to do the 0.5 correction after inverting the screen.\n // Otherwise, there were places where the decal did not match up with the geometry underneath.\n frag_ss << \" frag_screen += Float2(0.5, -0.5);\\n\";\n }\n frag_ss << \" if (internal_rt_flip < 0)\\n\";\n frag_ss << \" frag_screen.y = global_viewportSize.y - frag_screen.y;\\n\";\n frag_ss << gfx_gasoline_generate_trans_decode(trans, \"vert_\", GfxGslTrans::VERT);\n frag_ss << gfx_gasoline_generate_trans_decode(trans, \"frag_\", GfxGslTrans::USER);\n frag_ss << gfx_gasoline_generate_trans_decode(trans, \"internal_\", GfxGslTrans::INTERNAL);\n\n frag_ss << \" Float2 uv = frag_screen / global_viewportSize;\\n\";\n frag_ss << \" Float3 ray = lerp(\\n\";\n frag_ss << \" lerp(global_rayBottomLeft, global_rayBottomRight, Float3(uv.x)),\\n\";\n frag_ss << \" lerp(global_rayTopLeft, global_rayTopRight, Float3(uv.x)),\\n\";\n frag_ss << \" Float3(uv.y));\\n\";\n frag_ss << \" uv.y = 1 - uv.y;\\n\";\n frag_ss << \" Float4 texel0 = sample(global_gbuffer0, uv);\\n\";\n frag_ss << \" Float4 texel1 = Float4(0, 0, 0, 0);\\n\";\n frag_ss << \" Float4 texel2 = Float4(0, 0, 0, 0);\\n\";\n frag_ss << \" Float normalised_cam_dist = unpack_deferred_cam_dist(texel0, texel1, texel2);\\n\";\n frag_ss << \" Float3 pos_ws = normalised_cam_dist * ray + global_cameraPos;\\n\";\n // Apply world backwards\n frag_ss << \" Float3 pos_os = mul(internal_inv_world, Float4(pos_ws, 1)).xyz;\\n\";\n frag_ss << \" pos_os += Float3(0.5, 0, 0.5);\\n\";\n frag_ss << \" if (pos_os.x < 0) discard;\\n\";\n frag_ss << \" if (pos_os.x > 1) discard;\\n\";\n frag_ss << \" if (pos_os.z < 0) discard;\\n\";\n frag_ss << \" if (pos_os.z > 1) discard;\\n\";\n frag_ss << \" if (pos_os.y < -0.5) discard;\\n\";\n frag_ss << \" if (pos_os.y > 0.5) discard;\\n\";\n // Overwriting the vertex coord is a bit weird but it's the easiest way to make it available\n // to the dangs shader.\n frag_ss << \" vert_coord0.xy = lerp(vert_coord0.xy, vert_coord1.xy, pos_os.xz);\\n\";\n frag_ss << \" vert_coord0.zw = Float2(1 - abs(2 * pos_os.y), 0);\\n\";\n frag_ss << \" vert_normal.xyz = internal_normal;\\n\";\n\n frag_ss << \" Float cam_dist = normalised_cam_dist * global_farClipDistance;\\n\";\n frag_ss << \" Float3 d;\\n\";\n frag_ss << \" Float a;\\n\";\n frag_ss << \" Float3 n;\\n\";\n frag_ss << \" Float g;\\n\";\n frag_ss << \" Float s;\\n\";\n frag_ss << \" func_user_dangs(d, a, n, g, s);\\n\";\n frag_ss << \" n = normalise(n);\\n\";\n //frag_ss << \" Float3 internal_vertex_to_cam = global_cameraPos - pos_ws;\\n\";\n frag_ss << \" Float3 v2c = normalise(-ray);\\n\";\n frag_ss << \" Float3 sun = sunlight(pos_ws, v2c, d, n, g, s, cam_dist);\\n\";\n frag_ss << \" Float3 env = envlight(v2c, d, n, g, s);\\n\";\n frag_ss << \" Float3 additional;\\n\";\n frag_ss << \" Float unused;\\n\";\n frag_ss << \" func_user_colour(additional, unused);\\n\";\n frag_ss << \" out_colour_alpha = Float4((sun + env) * a + additional, a);\\n\";\n // frag_ss << \" out_colour_alpha = Float4(fract(pos_ws), 1);\\n\";\n // frag_ss << \" out_colour_alpha = Float4(vert_coord0.xy, 0, 0.5);\\n\";\n\n if (mat_env.fadeDither) {\n frag_ss << \" fade();\\n\";\n }\n\n frag_ss << \"}\\n\";\n\n frag_out = frag_ss.str();\n}\n\n" }, { "alpha_fraction": 0.6517632007598877, "alphanum_fraction": 0.6542820930480957, "avg_line_length": 26.379310607910156, "blob_id": "0eab0e869b885d4df0c4194c9595a1630fc53ab8", "content_id": "da5fc8f89e5ff73ecb290f8adbff78980afcc4e5", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 1588, "license_type": "permissive", "max_line_length": 65, "num_lines": 58, "path": "/dependencies/quex-0.34.1/quex/code_base/template/Accumulator.i", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "// -*- C++ -*- vim:set syntax=cpp:\n#ifndef __INCLUDE_GUARD__QUEX_LEXER_CLASS_ACCUMULATOR_I\n#define __INCLUDE_GUARD__QUEX_LEXER_CLASS_ACCUMULATOR_I\n\nnamespace quex { \ninline void\nAccumulator::flush(const QUEX_TOKEN_ID_TYPE TokenID)\n{\n if( _accumulated_text.length() == 0 ) return;\n\n _the_lexer->send(TokenID, _accumulated_text.c_str());\n _accumulated_text = std::basic_string<QUEX_CHARACTER_TYPE>();\n}\n\n\ninline void\nAccumulator::clear()\n{\n if( _accumulated_text.length() == 0 ) return;\n _accumulated_text = std::basic_string<QUEX_CHARACTER_TYPE>();\n}\n\ninline void \nAccumulator::add(const QUEX_CHARACTER_TYPE* ToBeAppended)\n{ \n if( _accumulated_text.length() == 0 ) {\n# ifdef QUEX_OPTION_COLUMN_NUMBER_COUNTING\n _begin_column = _the_lexer->column_number_at_begin();\n# endif\n# ifdef QUEX_OPTION_LINE_NUMBER_COUNTING\n _begin_line = _the_lexer->line_number_at_begin();\n# endif\n }\n _accumulated_text += ToBeAppended; \n}\n\n\ninline void \nAccumulator::add(const QUEX_CHARACTER_TYPE ToBeAppended)\n{ \n\n# if defined(QUEX_OPTION_COLUMN_NUMBER_COUNTING) || \\\n defined(QUEX_OPTION_LINE_NUMBER_COUNTING)\n if( _accumulated_text.length() == 0 ) {\n# ifdef QUEX_OPTION_COLUMN_NUMBER_COUNTING\n _begin_column = _the_lexer->column_number_at_begin();\n# endif\n# ifdef QUEX_OPTION_LINE_NUMBER_COUNTING\n _begin_line = _the_lexer->line_number_at_begin();\n# endif\n }\n# endif\n\n _accumulated_text += ToBeAppended; \n}\n\n} // namespace quex\n#endif // __INCLUDE_GUARD__QUEX_LEXER_CLASS_ACCUMULATOR_I\n" }, { "alpha_fraction": 0.5357815623283386, "alphanum_fraction": 0.5386064052581787, "avg_line_length": 33.47402572631836, "blob_id": "82f5dad98a3c102718ff006e670a7ee3e14dc13d", "content_id": "14e6296683f30a4e3d9bdc9bf3a8a25fc2861841", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 5310, "license_type": "permissive", "max_line_length": 130, "num_lines": 154, "path": "/engine/doc/grit_book/unparse_markdown.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "#!/usr/bin/python\n\nimport codecs\nimport re\nimport string\nimport textwrap\nfrom xml.sax.saxutils import escape\n\nfrom translate_xml import *\n\n\ndef UnparseMarkdownGetParentIndex(node):\n i = 0\n for c in node.parent:\n if c.kind == 'Section':\n i += 1\n if c == node:\n return i\n return None\n \n\ndef UnparseMarkdownGetPath(node):\n if not node.parent:\n return []\n here = []\n if node.kind == 'Section':\n here = [str(UnparseMarkdownGetParentIndex(node))]\n return UnparseMarkdownGetPath(node.parent) + here\n\n\ndef UnparseMarkdownGetLinkToNode(target):\n the_file = GetOutputFile(target)\n if the_file.id == target.id:\n return '%s.html' % the_file.id\n else:\n return '%s.html#%s' % (the_file.id, target.id)\n\n\ndef UnparseMarkdownGetPathString(node):\n return '.'.join(UnparseMarkdownGetPath(node))\n\n\ndef UnparseMarkdownGeneratePage(title, content, book):\n \n# s = 'This markdown file .md is generated by convert_web.py script.\\n'\n# s += 'WARNING: If you modify this file, your changes will be lost when script will be re-executed.'\n s = ''\n s += content\n s = UnparseMarkdownReplace( s )\n\n return s\n\ndef UnparseMarkdownReplace( s ):\n s = string.replace(s,'&amp;', '&')\n return s\n\ndef UnparseMarkdownReadme( s ):\n s = string.replace(s,'## Compilation Instructions', '### Grit Engine')\n s = re.sub('^##', '', s, flags=re.MULTILINE)\n return s\n\ndef UnparseMarkdownInlines(parent, inner=False):\n s = \"\"\n for n in parent:\n if isinstance(n, basestring):\n s += escape(n)\n elif n.kind == 'Definition':\n s += '***%s***' % (UnparseMarkdownInlines(n.data, True))\n elif n.kind == 'Issue':\n url = 'http://code.google.com/p/grit/issues/detail?id=%d' % n.id\n s += '[>issue %d](%s)' % (n.id,url)\n elif n.kind == 'Italic':\n s += '*%s*' % UnparseMarkdownInlines(n.data, True)\n elif n.kind == 'Emph':\n s += '**%s**' % UnparseMarkdownInlines(n.data, True)\n elif n.kind == 'Code':\n s += '`%s`' % UnparseMarkdownInlines(n.data, True)\n elif n.kind == 'Todo':\n s += '---(TODO: %s)---' % UnparseMarkdownInlines(n.data, True)\n elif n.kind == 'Web':\n s += '[%s](%s)' % (UnparseMarkdownInlines(n.data, True), n.url) \n elif n.kind == 'SRef':\n content = UnparseMarkdownInlines(n.data, True)\n s += '%s ([&sect;%s](%s))' % (content, UnparseMarkdownGetPathString(n.target), UnparseMarkdownGetLinkToNode(n.target))\n else:\n print 'ERROR: unknown node kind: ' + n.kind\n s = UnparseMarkdownReplace( s )\n return s\n\n\ndef UnparseMarkdownBlocks(book, parent, split_below, never_split):\n s = \"\"\n for n in parent:\n if n.kind == 'Image':\n s += '![%s](%s)%s\\n' % (escape(n.title),escape(n.src),escape(n.caption))\n elif n.kind == 'UnorderedList':\n for item in n.data:\n s += '* %s' % (UnparseMarkdownBlocks(book, item, split_below, never_split))\n elif n.kind == 'Section':\n new_path = UnparseMarkdownGetPath(n)\n h = len(new_path) \n title = '%s' % (escape(n.title)) \n inner_md = '\\n\\n%s %s\\n' % (\"#\" * h, title) \n inner_md += UnparseMarkdownBlocks(book, n, n.split, never_split)\n if split_below and not never_split:\n filename = 'md/' + n.id + '.md'\n print 'Writing ' + filename\n f = codecs.open(filename, 'w', 'utf-8')\n f.write(UnparseMarkdownGeneratePage(n.title, inner_md, book))\n f.close()\n if n.id == 'compilation':\n filename = 'md/README.md'\n print 'Writing ' + filename\n f = codecs.open(filename, 'w', 'utf-8')\n f.write(UnparseMarkdownGeneratePage(n.title, UnparseMarkdownReadme(inner_md), book))\n f.close()\n else:\n s += inner_md\n elif n.kind == 'Preformatted':\n s += '%s' % n.data\n elif n.kind == 'Lua':\n s += '\\n```%s```\\n' % (n.data)\n elif n.kind == 'Gasoline':\n s += '\\n```%s```\\n' % (n.data)\n elif n.kind == 'Paragraph':\n s += '\\n'\n s += '\\n'.join(textwrap.wrap(UnparseMarkdownInlines(n.data),100))\n s += '\\n'\n else:\n print \"ERROR: unknown node kind: \" + n.kind\n if split_below and not never_split:\n s += BuildMarkdownIndex(parent)\n s = UnparseMarkdownReplace( s )\n return s\n\n\ndef BuildMarkdownIndex(parent, indent=0):\n indentstr = ' ' * (indent*1)\n index = indentstr + '\\n'\n section_index = 0\n for n in parent:\n if n.kind == 'Section':\n section_index += 1\n path_string = UnparseMarkdownGetPathString(n)\n title = escape(n.title)\n index += ' ' * ((indent+1)*1)\n url = UnparseMarkdownGetLinkToNode(n)\n cls = 'index' if parent.split else 'index_nocol'\n index += '%s [%s](%s)\\n' % (path_string, title, url) #cls, \n index += BuildMarkdownIndex(n, indent+1)\n index += indentstr + '\\n'\n if section_index == 0:\n return ''\n return index\n\n" }, { "alpha_fraction": 0.5267009735107422, "alphanum_fraction": 0.5419012308120728, "avg_line_length": 41.00675582885742, "blob_id": "a7234f6b58143092e29a71ff1395cd0804278390", "content_id": "d2ed03336961f6eac8a5af8c843bbdb92f62c15b", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 37302, "license_type": "permissive", "max_line_length": 100, "num_lines": 888, "path": "/engine/gfx/gfx_gasoline_backend_glsl.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <centralised_log.h>\n\n#include \"gfx_gasoline_backend.h\"\n#include \"gfx_gasoline_backend_cg.h\"\n\nstatic std::map<std::string, std::string> vert_global = {\n {\"position\", \"vertex\"},\n {\"normal\", \"normal\"},\n {\"tangent\", \"tangent\"},\n {\"colour\", \"colour\"},\n {\"coord0\", \"uv0\"},\n {\"coord1\", \"uv1\"},\n {\"coord2\", \"uv2\"},\n {\"coord3\", \"uv3\"},\n {\"coord4\", \"uv4\"},\n {\"coord5\", \"uv5\"},\n {\"coord6\", \"uv6\"},\n {\"coord7\", \"uv7\"},\n {\"boneWeights\", \"blendWeights\"},\n {\"boneAssignments\", \"blendIndices\"},\n};\n\nstatic std::string preamble (bool glsl33)\n{\n std::stringstream ss;\n if (glsl33) {\n ss << \"#version 330\\n\";\n ss << \"#extension GL_ARB_separate_shader_objects: require\\n\";\n } else {\n ss << \"#version 130\\n\";\n }\n \n ss << \"// This GLSL shader compiled from Gasoline, the Grit shading language.\\n\";\n ss << \"\\n\";\n\n ss << \"// GSL/GLSL Preamble:\\n\";\n ss << \"#define Int int\\n\";\n ss << \"#define Int2 ivec2\\n\";\n ss << \"#define Int3 ivec3\\n\";\n ss << \"#define Int4 ivec4\\n\";\n ss << \"#define Float float\\n\";\n ss << \"#define Float2 vec2\\n\";\n ss << \"#define Float3 vec3\\n\";\n ss << \"#define Float4 vec4\\n\";\n ss << \"#define Float2x2 mat2x2\\n\";\n ss << \"#define Float2x3 mat3x2\\n\";\n ss << \"#define Float2x4 mat4x2\\n\";\n ss << \"#define Float3x2 mat2x3\\n\";\n ss << \"#define Float3x3 mat3x3\\n\";\n ss << \"#define Float3x4 mat4x3\\n\";\n ss << \"#define Float4x2 mat2x4\\n\";\n ss << \"#define Float4x3 mat3x4\\n\";\n ss << \"#define Float4x4 mat4x4\\n\";\n ss << \"#define FloatTexture sampler1D\\n\";\n ss << \"#define FloatTexture2 sampler2D\\n\";\n ss << \"#define FloatTexture3 sampler3D\\n\";\n ss << \"#define FloatTextureCube samplerCube\\n\";\n ss << \"\\n\";\n\n return ss.str();\n}\n\nstatic std::string generate_funcs (const GfxGslMeshEnvironment &mesh_env)\n{\n std::stringstream ss;\n\n ss << \"// Standard library\\n\";\n ss << \"Float strength (Float p, Float n) { return pow(max(0.00000001, p), n); }\\n\";\n ss << \"Float atan2 (Float y, Float x) { return atan(y, x); }\\n\";\n ss << \"Float2 mul (Float2x2 m, Float2 v) { return m * v; }\\n\";\n ss << \"Float2 mul (Float2x3 m, Float3 v) { return m * v; }\\n\";\n ss << \"Float2 mul (Float2x4 m, Float4 v) { return m * v; }\\n\";\n ss << \"Float3 mul (Float3x2 m, Float2 v) { return m * v; }\\n\";\n ss << \"Float3 mul (Float3x3 m, Float3 v) { return m * v; }\\n\";\n ss << \"Float3 mul (Float3x4 m, Float4 v) { return m * v; }\\n\";\n ss << \"Float4 mul (Float4x2 m, Float2 v) { return m * v; }\\n\";\n ss << \"Float4 mul (Float4x3 m, Float3 v) { return m * v; }\\n\";\n ss << \"Float4 mul (Float4x4 m, Float4 v) { return m * v; }\\n\";\n ss << \"Float lerp (Float a, Float b, Float v) { return v*b + (1-v)*a; }\\n\";\n ss << \"Float2 lerp (Float2 a, Float2 b, Float2 v) { return v*b + (Float2(1,1)-v)*a; }\\n\";\n ss << \"Float3 lerp (Float3 a, Float3 b, Float3 v) { return v*b + (Float3(1,1,1)-v)*a; }\\n\";\n ss << \"Float4 lerp (Float4 a, Float4 b, Float4 v) { return v*b + (Float4(1,1,1,1)-v)*a; }\\n\";\n\n // TODO(dcunnin): Move this to a body section\n ss << \"uniform Float4x4 body_boneWorlds[50];\\n\";\n\n // Shadow casting:\n ss << \"uniform Float4x4 internal_shadow_view_proj;\\n\";\n ss << \"uniform Float internal_shadow_additional_bias;\\n\";\n\n ss << \"uniform Float internal_rt_flip;\\n\";\n ss << \"uniform Float4x4 internal_inv_world;\\n\";\n if (!mesh_env.instanced) {\n // When instanced, comes from vertex coord.\n ss << \"uniform Float internal_fade;\\n\";\n }\n ss << \"\\n\";\n\n ss << gfx_gasoline_generate_preamble_functions();\n\n return ss.str();\n}\n\nstatic std::string generate_funcs_vert (const GfxGslMeshEnvironment &mesh_env)\n{\n std::stringstream ss;\n ss << \"// Standard library (vertex shader specific calls)\\n\";\n ss << \"\\n\";\n\n if (mesh_env.instanced) {\n ss << \"Float4x4 get_inst_matrix()\\n\";\n ss << \"{\\n\";\n ss << \" return Float4x4(\\n\";\n ss << \" vert_coord1[0], vert_coord2[0], vert_coord3[0], 0.0,\\n\";\n ss << \" vert_coord1[1], vert_coord2[1], vert_coord3[1], 0.0,\\n\";\n ss << \" vert_coord1[2], vert_coord2[2], vert_coord3[2], 0.0,\\n\";\n ss << \" vert_coord4[0], vert_coord4[1], vert_coord4[2], 1.0);\\n\";\n ss << \"}\\n\";\n ss << \"\\n\";\n }\n\n return ss.str();\n}\n\nstatic std::string generate_funcs_frag (void)\n{\n\n std::stringstream ss;\n ss << \"// Standard library (fragment shader specific calls)\\n\";\n ss << \"Float ddx (Float v) { return dFdx(v); }\\n\";\n ss << \"Float ddy (Float v) { return dFdy(v); }\\n\";\n ss << \"Float2 ddx (Float2 v) { return dFdx(v); }\\n\";\n ss << \"Float2 ddy (Float2 v) { return dFdy(v); }\\n\";\n ss << \"Float3 ddx (Float3 v) { return dFdx(v); }\\n\";\n ss << \"Float3 ddy (Float3 v) { return dFdy(v); }\\n\";\n ss << \"Float4 ddx (Float4 v) { return dFdx(v); }\\n\";\n ss << \"Float4 ddy (Float4 v) { return dFdy(v); }\\n\";\n\n // Real texture lookups\n // 2D\n ss << \"Float4 sample (FloatTexture2 tex, Float2 uv) { return texture(tex, uv); }\\n\";\n ss << \"Float4 sampleGrad (FloatTexture2 tex, Float2 uv, Float2 ddx, Float2 ddy)\\n\";\n ss << \"{ return textureGrad(tex, uv, ddx, ddy); }\\n\";\n ss << \"Float4 sampleLod (FloatTexture2 tex, Float2 uv, Float lod)\\n\";\n ss << \"{ return textureLod(tex, uv, lod); }\\n\";\n\n // 3D (volumetric)\n ss << \"Float4 sample (FloatTexture3 tex, Float3 uvw) { return texture(tex, uvw); }\\n\";\n ss << \"Float4 sampleGrad (FloatTexture3 tex, Float3 uvw, Float3 ddx, Float3 ddy)\\n\";\n ss << \"{ return textureGrad(tex, uvw, ddx, ddy); }\\n\";\n ss << \"Float4 sampleLod (FloatTexture3 tex, Float3 uvw, Float lod)\\n\";\n ss << \"{ return textureLod(tex, uvw, lod); }\\n\";\n\n // Cube\n ss << \"Float4 sample (FloatTextureCube tex, Float3 uvw) { return texture(tex, uvw); }\\n\";\n ss << \"Float4 sampleGrad (FloatTextureCube tex, Float3 uvw, Float3 ddx, Float3 ddy)\\n\";\n ss << \"{ return textureGrad(tex, uvw, ddx, ddy); }\\n\";\n ss << \"Float4 sampleLod (FloatTextureCube tex, Float3 uvw, Float lod)\\n\";\n ss << \"{ return textureLod(tex, uvw, lod); }\\n\";\n\n // 'Fake' texture lookups\n ss << \"Float4 sample (Float4 c, Float2 uv) { return c; }\\n\";\n ss << \"Float4 sample (Float4 c, Float3 uvw) { return c; }\\n\";\n ss << \"Float4 sampleGrad (Float4 c, Float2 uv, Float2 ddx, Float2 ddy) { return c; }\\n\";\n ss << \"Float4 sampleGrad (Float4 c, Float3 uvw, Float3 ddx, Float3 ddy) { return c; }\\n\";\n ss << \"Float4 sampleLod (Float4 c, Float2 uv, Float lod) { return c; }\\n\";\n ss << \"Float4 sampleLod (Float4 c, Float3 uvw, Float lod) { return c; }\\n\";\n\n ss << \"\\n\";\n return ss.str();\n}\n\nstatic std::string generate_vert_header (bool glsl33,\n const GfxGslContext &ctx,\n const GfxGslTypeSystem *ts,\n const std::vector<GfxGslTrans> &trans,\n const std::set<std::string> &vert_in)\n{\n std::stringstream ss;\n\n ss << \"// Vertex header\\n\";\n\n // In (vertex attributes)\n for (const auto &f : vert_in) {\n // I don't think it's possible to use the layout qualifier here, without\n // changing (or at least examining) the way that Ogre::Mesh maps to gl buffers.\n ss << \"in \" << ts->getVertType(f) << \" \" << vert_global[f] << \";\\n\";\n ss << ts->getVertType(f) << \" vert_\" << f << \";\\n\";\n }\n ss << gfx_gasoline_generate_global_fields(ctx, false);\n // Out (position)\n if (glsl33) {\n ss << \"out gl_PerVertex\\n\";\n ss << \"{\\n\";\n // invariant is required to avoid z fighitng on multi-pass rendering techniques.\n // Unfortunately it is broken on Intel GL.\n // ss << \" invariant vec4 gl_Position;\\n\";\n ss << \" vec4 gl_Position;\\n\";\n ss << \" float gl_PointSize;\\n\";\n ss << \" float gl_ClipDistance[];\\n\";\n ss << \"};\\n\";\n }\n // Out (trans)\n for (unsigned i=0 ; i<trans.size() ; i+=4) {\n unsigned sz = trans.size()-i > 4 ? 4 : trans.size()-i;\n std::stringstream type;\n type << \"Float\";\n if (sz > 1) type << sz;\n if (glsl33) {\n ss << \"layout(location = \" << i / 4 << \") \";\n }\n ss << \"out \" << type.str() << \" trans\" << i/4 << \";\\n\";\n }\n\n ss << \"\\n\";\n\n return ss.str();\n}\n\nstatic std::string generate_frag_header(bool glsl33, const GfxGslContext &ctx,\n const std::vector<GfxGslTrans> &trans, bool gbuffer)\n{\n std::stringstream ss;\n\n ss << \"// Fragment header\\n\";\n\n ss << \"Float2 frag_screen;\\n\";\n\n // In (trans)\n for (unsigned i=0 ; i<trans.size() ; i+=4) {\n unsigned sz = trans.size()-i > 4 ? 4 : trans.size()-i;\n std::stringstream type;\n type << \"Float\";\n if (sz > 1) type << sz;\n if (glsl33) {\n ss << \"layout(location = \" << i / 4 << \") \";\n }\n ss << \"in \" << type.str() << \" trans\" << i/4 << \";\\n\";\n }\n\n ss << gfx_gasoline_generate_global_fields(ctx, false);\n\n // Out\n if (gbuffer) {\n if (glsl33) {\n ss << \"layout(location = 0) out Float4 out_gbuffer0;\\n\";\n ss << \"layout(location = 1) out Float4 out_gbuffer1;\\n\";\n ss << \"layout(location = 2) out Float4 out_gbuffer2;\\n\";\n } else {\n // #version 130 only supports this:\n ss << \"out Float4 out_gbuffer0, out_gbuffer1, out_gbuffer2;\\n\";\n }\n } else {\n if (glsl33) {\n ss << \"layout(location = 0) \";\n }\n ss << \"out Float4 out_colour_alpha;\\n\";\n }\n //ss << \"layout (depth_any) out Float out_depth;\\n\";\n\n\n ss << \"\\n\";\n\n return ss.str();\n}\n\nvoid gfx_gasoline_unparse_glsl (const GfxGslContext &ctx,\n const GfxGslTypeSystem *vert_ts,\n const GfxGslAst *vert_ast,\n std::string &vert_output,\n const GfxGslTypeSystem *frag_ts,\n const GfxGslAst *frag_ast,\n std::string &frag_output,\n const GfxGslConfigEnvironment &cfg_env,\n const GfxGslMaterialEnvironment &mat_env,\n const GfxGslMeshEnvironment &mesh_env,\n bool glsl33,\n bool flat_z,\n bool das)\n{\n GfxGslTypeMap vert_vars, frag_vars;\n std::set<GfxGslTrans> trans_set;\n std::stringstream header;\n header << \"// cfg_env: \" << cfg_env << \"\\n\";\n header << \"// mat_env: \" << mat_env << \"\\n\";\n header << \"// mesh_env: \" << mesh_env << \"\\n\";\n header << \"// flat_z: \" << flat_z << \"\\n\";\n header << \"// das: \" << das << \"\\n\";\n header << \"\\n\";\n\n GfxGslBackendUnparser vert_backend(\"user_\");\n GfxGslBackendUnparser frag_backend(\"user_\");\n\n for (const auto &pair : vert_ts->getVars())\n vert_vars[\"user_\" + pair.first] = pair.second->type;\n vert_backend.unparse(vert_ast, 1);\n\n for (const auto &pair : frag_ts->getVars())\n frag_vars[\"user_\" + pair.first] = pair.second->type;\n frag_backend.unparse(frag_ast, 1);\n\n trans_set.insert(frag_ts->getTrans().begin(), frag_ts->getTrans().end());\n\n std::set<std::string> vert_in = vert_ts->getVertFieldsRead();\n vert_in.insert(\"position\");\n if (mesh_env.boneWeights > 0) {\n vert_in.insert(\"boneAssignments\");\n vert_in.insert(\"boneWeights\");\n }\n\n std::vector<GfxGslTrans> trans(trans_set.begin(), trans_set.end());\n std::map<std::string, const GfxGslFloatType *> internals;\n gfx_gasoline_add_internal_trans(internals, trans);\n\n for (const auto &tran : trans) {\n const std::string &tv = tran.path[0];\n switch (tran.kind) {\n case GfxGslTrans::VERT:\n vert_in.insert(tv);\n frag_vars[\"vert_\" + tv] = tran.type;\n break;\n case GfxGslTrans::INTERNAL:\n vert_vars[\"internal_\" + tv] = tran.type;\n frag_vars[\"internal_\" + tv] = tran.type;\n break;\n case GfxGslTrans::USER:\n frag_vars[\"user_\" + tv] = tran.type;\n break;\n }\n }\n\n\n\n // VERTEX\n\n std::stringstream vert_ss;\n vert_ss << preamble(glsl33);\n vert_ss << header.str();\n vert_ss << generate_vert_header(glsl33, ctx, vert_ts, trans, vert_in);\n vert_ss << generate_funcs(mesh_env);\n vert_ss << generate_funcs_vert(mesh_env);\n vert_ss << gfx_gasoline_preamble_transformation(false, mesh_env);\n vert_ss << gfx_gasoline_generate_var_decls(vert_vars);\n vert_ss << vert_backend.getUserVertexFunction();\n vert_ss << \"void main (void)\\n\";\n vert_ss << \"{\\n\";\n for (const auto &f : vert_in)\n vert_ss << \" vert_\" << f << \" = \" << vert_global[f] << \";\\n\";\n vert_ss << \" Float3 world_pos;\\n\";\n vert_ss << \" func_user_vertex(world_pos);\\n\";\n if (das) {\n vert_ss << \" Float4 clip_pos = Float4(world_pos, 1);\\n\";\n } else {\n // For additive passes to compute same depth as the gbuffer passes, do not\n // multiple by viewproj here.\n vert_ss << \" Float3 pos_vs = mul(global_view, Float4(world_pos, 1)).xyz;\\n\";\n vert_ss << \" Float4 clip_pos = mul(global_proj, Float4(pos_vs, 1));\\n\";\n }\n vert_ss << \" clip_pos.y *= internal_rt_flip;\\n\";\n // Hack to maximum depth, but avoid hitting the actual backplane.\n // (Without this dcunnin saw some black lightning-like artifacts on Nvidia.)\n if (flat_z)\n vert_ss << \" clip_pos.z = clip_pos.w * (1 - 1.0/65536);\\n\";\n vert_ss << \" gl_Position = clip_pos;\\n\";\n vert_ss << gfx_gasoline_generate_trans_encode(trans, \"user_\");\n vert_ss << \"}\\n\";\n\n vert_output = vert_ss.str();\n\n\n // FRAGMENT\n\n std::stringstream frag_ss;\n frag_ss << preamble(glsl33);\n vert_ss << header.str();\n frag_ss << generate_frag_header(glsl33, ctx, trans, false);\n frag_ss << generate_funcs(mesh_env);\n frag_ss << generate_funcs_frag();\n if (ctx.lightingTextures)\n frag_ss << gfx_gasoline_preamble_lighting(cfg_env);\n frag_ss << gfx_gasoline_preamble_fade();\n frag_ss << gfx_gasoline_generate_var_decls(frag_vars);\n frag_ss << frag_backend.getUserColourAlphaFunction();\n frag_ss << \"void main (void)\\n\";\n frag_ss << \"{\\n\";\n frag_ss << \" frag_screen = gl_FragCoord.xy;\\n\";\n frag_ss << \" if (internal_rt_flip < 0)\\n\";\n frag_ss << \" frag_screen.y = global_viewportSize.y - frag_screen.y;\\n\";\n frag_ss << gfx_gasoline_generate_trans_decode(trans, \"vert_\", GfxGslTrans::VERT);\n frag_ss << gfx_gasoline_generate_trans_decode(trans, \"user_\", GfxGslTrans::USER);\n frag_ss << gfx_gasoline_generate_trans_decode(trans, \"internal_\", GfxGslTrans::INTERNAL);\n frag_ss << \" Float3 out_colour;\\n\";\n frag_ss << \" Float out_alpha;\\n\";\n frag_ss << \" func_user_colour(out_colour, out_alpha);\\n\";\n if (mat_env.fadeDither) {\n frag_ss << \" fade();\\n\";\n } else {\n frag_ss << \" out_alpha *= internal_fade;\\n\";\n }\n // Shaders should do out.colour = out.colour * out.alpha if they are rendered with\n // scene blending of ONE, ONE_MINUS_DEST_ALPHA\n frag_ss << \" out_colour_alpha = Float4(out_colour, out_alpha);\\n\";\n if (das) {\n // Whether we are using d3d9 or gl rendersystems,\n // ogre gives us the view_proj in a 'standard' form, which is\n // right-handed with a depth range of [-1,+1].\n // Since we are outputing depth in the fragment shader, the range is [0,1]\n // Note that this code pre-supposes that all DAS shaders create a user variable\n // called pos_ws, but they are all internal shaders so we can guarantee that.\n // The pos_ws needs to be a point within the frustum.\n // frag_ss << \" Float4 projected = mul(global_viewProj, Float4(user_pos_ws, 1));\\n\";\n // frag_ss << \" gl_FragDepth = 0.5 + (projected.z / projected.w) / 2.0;\\n\";\n }\n frag_ss << \"}\\n\";\n\n frag_output = frag_ss.str();\n}\n\nvoid gfx_gasoline_unparse_body_glsl(const GfxGslContext &ctx,\n const GfxGslTypeSystem *vert_ts,\n const GfxGslAst *vert_ast,\n const GfxGslTypeSystem *dangs_ts,\n const GfxGslAst *dangs_ast,\n const GfxGslTypeSystem *additional_ts,\n const GfxGslAst *additional_ast,\n std::string &vert_out,\n std::string &frag_out,\n const GfxGslConfigEnvironment &cfg_env,\n const GfxGslMaterialEnvironment &mat_env,\n const GfxGslMeshEnvironment &mesh_env,\n bool glsl33,\n bool first_person,\n bool wireframe,\n bool forward_only,\n bool cast)\n{\n GfxGslTypeMap vert_vars, frag_vars;\n std::set<GfxGslTrans> trans_set;\n std::stringstream header;\n header << \"// cfg_env: \" << cfg_env << \"\\n\";\n header << \"// mat_env: \" << mat_env << \"\\n\";\n header << \"// mesh_env: \" << mesh_env << \"\\n\";\n header << \"// first_person: \" << first_person << \"\\n\";\n header << \"// wireframe: \" << wireframe << \"\\n\";\n header << \"// forward_only: \" << forward_only << \"\\n\";\n header << \"// cast: \" << cast << \"\\n\";\n header << \"\\n\";\n\n GfxGslBackendUnparser vert_backend(\"uvert_\");\n GfxGslBackendUnparser dangs_backend( \"udangs_\");\n GfxGslBackendUnparser additional_backend(\"uadd_\");\n\n std::set<std::string> vert_in = vert_ts->getVertFieldsRead();\n for (const auto &pair : vert_ts->getVars())\n vert_vars[\"uvert_\" + pair.first] = pair.second->type;\n vert_backend.unparse(vert_ast, 1);\n\n bool using_additional = !(cast || forward_only);\n\n if (!wireframe) {\n for (const auto &pair : dangs_ts->getVars())\n frag_vars[\"udangs_\" + pair.first] = pair.second->type;\n dangs_backend.unparse(dangs_ast, 1);\n trans_set.insert(dangs_ts->getTrans().begin(), dangs_ts->getTrans().end());\n }\n\n if (using_additional) {\n for (const auto &pair : additional_ts->getVars())\n frag_vars[\"uadd_\" + pair.first] = pair.second->type;\n additional_backend.unparse(additional_ast, 1);\n trans_set.insert(additional_ts->getTrans().begin(), additional_ts->getTrans().end());\n }\n\n std::vector<GfxGslTrans> trans(trans_set.begin(), trans_set.end());\n\n std::map<std::string, const GfxGslFloatType *> internals;\n auto *f1 = ctx.alloc.makeType<GfxGslFloatType>(1);\n auto *f3 = ctx.alloc.makeType<GfxGslFloatType>(3);\n if (cast) {\n internals[\"light_dist\"] = f1;\n } else if (!wireframe) {\n internals[\"vertex_to_cam\"] = f3;\n if (!first_person)\n internals[\"cam_dist\"] = f1;\n }\n if (mesh_env.instanced) {\n internals[\"fade\"] = f1;\n }\n\n gfx_gasoline_add_internal_trans(internals, trans);\n\n vert_in.insert(\"position\");\n if (mesh_env.instanced) {\n vert_in.insert(\"coord1\");\n vert_in.insert(\"coord2\");\n vert_in.insert(\"coord3\");\n vert_in.insert(\"coord4\");\n vert_in.insert(\"coord5\");\n }\n if (mesh_env.boneWeights > 0) {\n vert_in.insert(\"boneAssignments\");\n vert_in.insert(\"boneWeights\");\n }\n\n for (const auto &tran : trans) {\n const std::string &tv = tran.path[0];\n switch (tran.kind) {\n case GfxGslTrans::VERT:\n vert_in.insert(tv);\n frag_vars[\"vert_\" + tv] = tran.type;\n break;\n\n case GfxGslTrans::INTERNAL:\n vert_vars[\"internal_\" + tv] = tran.type;\n frag_vars[\"internal_\" + tv] = tran.type;\n break;\n\n case GfxGslTrans::USER:\n if (!wireframe)\n frag_vars[\"udangs_\" + tv] = tran.type;\n if (using_additional)\n frag_vars[\"uadd_\" + tv] = tran.type;\n break;\n }\n }\n\n\n // VERTEX\n\n std::stringstream vert_ss;\n vert_ss << preamble(glsl33);\n vert_ss << header.str();\n vert_ss << generate_vert_header(glsl33, ctx, vert_ts, trans, vert_in);\n vert_ss << generate_funcs(mesh_env);\n vert_ss << generate_funcs_vert(mesh_env);\n vert_ss << gfx_gasoline_preamble_transformation(first_person, mesh_env);\n vert_ss << gfx_gasoline_generate_var_decls(vert_vars);\n vert_ss << vert_backend.getUserVertexFunction();\n vert_ss << \"void main (void)\\n\";\n vert_ss << \"{\\n\";\n for (const auto &f : vert_in)\n vert_ss << \" vert_\" << f << \" = \" << vert_global[f] << \";\\n\";\n vert_ss << \" Float3 pos_ws;\\n\";\n vert_ss << \" func_user_vertex(pos_ws);\\n\";\n if (cast) {\n vert_ss << \" gl_Position = mul(internal_shadow_view_proj, Float4(pos_ws, 1));\\n\";\n vert_ss << \" internal_light_dist = dot(global_sunlightDirection, pos_ws);\\n\";\n } else {\n vert_ss << \" Float3 pos_vs = mul(global_view, Float4(pos_ws, 1)).xyz;\\n\";\n vert_ss << \" gl_Position = mul(global_proj, Float4(pos_vs, 1));\\n\";\n vert_ss << \" gl_Position.y *= internal_rt_flip;\\n\";\n if (!wireframe)\n vert_ss << \" internal_vertex_to_cam = global_cameraPos - pos_ws;\\n\";\n if (!first_person)\n vert_ss << \" internal_cam_dist = -pos_vs.z;\\n\";\n }\n if (mesh_env.instanced) {\n // The 0.5/255 is necessary because apparently we lose some precision through rasterisation.\n vert_ss << \" internal_fade = vert_coord5.x + 0.5/255;\\n\";\n }\n vert_ss << gfx_gasoline_generate_trans_encode(trans, \"uvert_\");\n vert_ss << \"}\\n\";\n\n vert_out = vert_ss.str();\n\n\n // FRAGMENT\n\n std::stringstream frag_ss;\n frag_ss << preamble(glsl33);\n frag_ss << header.str();\n frag_ss << generate_frag_header(glsl33, ctx, trans, forward_only);\n frag_ss << generate_funcs(mesh_env);\n frag_ss << generate_funcs_frag();\n frag_ss << gfx_gasoline_generate_var_decls(frag_vars);\n if (ctx.lightingTextures)\n frag_ss << gfx_gasoline_preamble_lighting(cfg_env);\n frag_ss << gfx_gasoline_preamble_fade();\n if (!wireframe)\n frag_ss << dangs_backend.getUserDangsFunction();\n if (using_additional)\n frag_ss << additional_backend.getUserColourAlphaFunction();\n\n // Main function\n frag_ss << \"void main (void)\\n\";\n frag_ss << \"{\\n\";\n frag_ss << \" frag_screen = gl_FragCoord.xy;\\n\";\n frag_ss << \" if (internal_rt_flip < 0)\\n\";\n frag_ss << \" frag_screen.y = global_viewportSize.y - frag_screen.y;\\n\";\n frag_ss << gfx_gasoline_generate_trans_decode(trans, \"vert_\", GfxGslTrans::VERT);\n if (!wireframe)\n frag_ss << gfx_gasoline_generate_trans_decode(trans, \"udangs_\", GfxGslTrans::USER);\n if (using_additional)\n frag_ss << gfx_gasoline_generate_trans_decode(trans, \"uadd_\", GfxGslTrans::USER);\n frag_ss << gfx_gasoline_generate_trans_decode(trans, \"internal_\", GfxGslTrans::INTERNAL);\n if (cast) {\n // Bias\n // TODO: Consider using http://www.dissidentlogic.com/old/#Normal%20Offset%20Shadows\n // Run ddx/ddy before possible discard.\n frag_ss << \" Float slope_bias = abs(ddx(internal_light_dist))\\n\";\n frag_ss << \" + abs(ddy(internal_light_dist));\\n\";\n }\n if (mat_env.fadeDither) {\n frag_ss << \" fade();\\n\";\n }\n if (cast) {\n // Run this only for the discard. Ignore actual value outputs.\n frag_ss << \" Float3 d;\\n\";\n frag_ss << \" Float a;\\n\";\n frag_ss << \" Float3 n;\\n\";\n frag_ss << \" Float g;\\n\";\n frag_ss << \" Float s;\\n\";\n frag_ss << \" func_user_dangs(d, a, n, g, s);\\n\";\n\n // On large flat surfaces, with the light coming in at an\n // oblique angle, the required bias can get very high.\n // We may need to review this cap of 1m.\n // Especially for the 3rd shadow zone where the shadow texels\n // cover a large amount of space, and low shadow resolutions too.\n // - the 0.5 is the error due to the rounding to discrete texels\n frag_ss << \" Float bias = internal_shadow_additional_bias\\n\";\n frag_ss << \" + (0.5 + \" << cfg_env.shadowFilterSize << \") * slope_bias;\\n\";\n frag_ss << \" bias = min(bias, 1.0);\\n\";\n frag_ss << \" internal_light_dist += bias;\\n\";\n\n frag_ss << \" out_colour_alpha.x = internal_light_dist\\n\"\n << \" / \" << cfg_env.shadowFactor << \";\\n\";\n } else {\n if (wireframe) {\n frag_ss << \" Float3 additional;\\n\";\n frag_ss << \" Float unused;\\n\";\n frag_ss << \" func_user_colour(additional, unused);\\n\";\n frag_ss << \" out_colour_alpha.xyzw = Float4(additional, 1);\\n\";\n } else {\n frag_ss << \" Float shadow_oblique_cutoff = 0;\\n\"; // TODO(dcunnin)\n frag_ss << \" Float3 d;\\n\";\n frag_ss << \" Float a;\\n\";\n frag_ss << \" Float3 n;\\n\";\n frag_ss << \" Float g;\\n\";\n frag_ss << \" Float s;\\n\";\n frag_ss << \" func_user_dangs(d, a, n, g, s);\\n\";\n frag_ss << \" n = normalise(n);\\n\";\n if (forward_only) {\n frag_ss << \" Float3 n_vs = mul(global_view, Float4(n, 0)).xyz;\\n\";\n frag_ss << \" internal_cam_dist /= global_farClipDistance;\\n\";\n frag_ss << \" pack_deferred(out_gbuffer0, out_gbuffer1, out_gbuffer2,\\n\";\n frag_ss << \" shadow_oblique_cutoff, d, n_vs, s,\\n\";\n frag_ss << \" internal_cam_dist, g);\\n\";\n } else {\n frag_ss << \" Float3 v2c = normalise(internal_vertex_to_cam);\\n\";\n frag_ss << \" Float3 pos_ws = global_cameraPos - internal_vertex_to_cam;\\n\";\n if (first_person) {\n // Always use 'near' shadows.\n frag_ss << \" Float internal_cam_dist = 0;\\n\";\n frag_ss << \" pos_ws = global_cameraPos;\\n\";\n }\n frag_ss << \" Float3 sun = sunlight(pos_ws, v2c, d, n, g, s,\\n\";\n frag_ss << \" internal_cam_dist);\\n\";\n frag_ss << \" Float3 env = envlight(v2c, d, n, g, s);\\n\";\n frag_ss << \" out_colour_alpha.xyz = sun + env;\\n\";\n // Fog applied here.\n frag_ss << \" Float fw = fog_weakness(internal_cam_dist);\\n\";\n frag_ss << \" out_colour_alpha.xyz = lerp(global_fogColour,\\n\";\n frag_ss << \" out_colour_alpha.xyz,\\n\";\n frag_ss << \" fw * Float3(1, 1, 1));\\n\",\n\n frag_ss << \" out_colour_alpha.w = a;\\n\";\n if (!mat_env.fadeDither) {\n // Fade out the contribution of sun / env light according to internal fade.\n frag_ss << \" out_colour_alpha.w *= internal_fade;\\n\";\n }\n // Pre-multiply alpha.\n frag_ss << \" out_colour_alpha.xyz *= out_colour_alpha.w;\\n\";\n\n frag_ss << \" Float3 additional;\\n\";\n frag_ss << \" Float unused;\\n\";\n frag_ss << \" func_user_colour(additional, unused);\\n\";\n if (!mat_env.fadeDither) {\n // Fade out the contribution of additional light according to internal fade.\n frag_ss << \" additional *= internal_fade;\\n\";\n }\n // Fog applied here too.\n frag_ss << \" out_colour_alpha.xyz += additional\\n\";\n frag_ss << \" * fog_weakness(internal_cam_dist);\\n\";\n }\n }\n }\n frag_ss << \"}\\n\";\n\n frag_out = frag_ss.str();\n}\n\n\nvoid gfx_gasoline_unparse_decal_glsl(const GfxGslContext &ctx,\n const GfxGslTypeSystem *dangs_ts,\n const GfxGslAst *dangs_ast,\n const GfxGslTypeSystem *additional_ts,\n const GfxGslAst *additional_ast,\n std::string &vert_out,\n std::string &frag_out,\n const GfxGslConfigEnvironment &cfg_env,\n const GfxGslMaterialEnvironment &mat_env,\n const GfxGslMeshEnvironment &mesh_env,\n bool glsl33)\n{\n GfxGslBackendUnparser dangs_backend(\"udangs_\");\n dangs_backend.unparse(dangs_ast, 1);\n GfxGslBackendUnparser additional_backend(\"uadd_\");\n additional_backend.unparse(additional_ast, 1);\n\n std::stringstream header;\n header << \"// decal shader\\n\";\n header << \"// cfg_env: \" << cfg_env << \"\\n\";\n header << \"// mat_env: \" << mat_env << \"\\n\";\n header << \"// mesh_env: \" << mesh_env << \"\\n\";\n header << \"\\n\";\n\n std::set<std::string> vert_in;\n vert_in.insert(\"position\");\n vert_in.insert(\"coord0\");\n vert_in.insert(\"coord1\");\n vert_in.insert(\"normal\");\n\n GfxGslTypeMap vert_vars, frag_vars;\n for (const auto &pair : dangs_ts->getVars())\n frag_vars[\"udangs_\" + pair.first] = pair.second->type;\n for (const auto &pair : additional_ts->getVars())\n frag_vars[\"uadd_\" + pair.first] = pair.second->type;\n\n\n std::vector<GfxGslTrans> trans;\n auto *f3 = ctx.alloc.makeType<GfxGslFloatType>(3);\n auto *f4 = ctx.alloc.makeType<GfxGslFloatType>(4);\n trans.emplace_back(GfxGslTrans{ GfxGslTrans::VERT, { \"coord0\", \"x\" }, f4 });\n trans.emplace_back(GfxGslTrans{ GfxGslTrans::VERT, { \"coord0\", \"y\" }, f4 });\n trans.emplace_back(GfxGslTrans{ GfxGslTrans::VERT, { \"coord1\", \"x\" }, f4 });\n trans.emplace_back(GfxGslTrans{ GfxGslTrans::VERT, { \"coord1\", \"y\" }, f4 });\n trans.emplace_back(GfxGslTrans{ GfxGslTrans::VERT, { \"normal\", \"x\" }, f3 });\n trans.emplace_back(GfxGslTrans{ GfxGslTrans::VERT, { \"normal\", \"y\" }, f3 });\n trans.emplace_back(GfxGslTrans{ GfxGslTrans::VERT, { \"normal\", \"z\" }, f3 });\n\n std::map<std::string, const GfxGslFloatType *> internals;\n internals[\"normal\"] = ctx.alloc.makeType<GfxGslFloatType>(3);\n\n gfx_gasoline_add_internal_trans(internals, trans);\n\n for (const auto &tran : trans) {\n const std::string &tv = tran.path[0];\n switch (tran.kind) {\n case GfxGslTrans::VERT:\n vert_in.insert(tv);\n frag_vars[\"vert_\" + tv] = tran.type;\n break;\n\n case GfxGslTrans::INTERNAL:\n vert_vars[\"internal_\" + tv] = tran.type;\n frag_vars[\"internal_\" + tv] = tran.type;\n break;\n\n case GfxGslTrans::USER:\n frag_vars[\"udangs_\" + tv] = tran.type;\n frag_vars[\"uadd_\" + tv] = tran.type;\n break;\n }\n }\n\n // VERTEX\n\n std::stringstream vert_ss;\n vert_ss << preamble(glsl33);\n vert_ss << header.str();\n vert_ss << generate_vert_header(glsl33, ctx, dangs_ts, trans, vert_in);\n vert_ss << generate_funcs(mesh_env);\n vert_ss << generate_funcs_vert(mesh_env);\n vert_ss << gfx_gasoline_preamble_transformation(false, mesh_env);\n vert_ss << gfx_gasoline_generate_var_decls(vert_vars);\n vert_ss << \"void main (void)\\n\";\n vert_ss << \"{\\n\";\n for (const auto &f : vert_in)\n vert_ss << \" vert_\" << f << \" = \" << vert_global[f] << \";\\n\";\n vert_ss << \" Float3 pos_ws = transform_to_world(vert_position.xyz);\\n\";\n vert_ss << \" internal_normal = rotate_to_world(Float3(0, 1, 0));\\n\";\n vert_ss << \" gl_Position = mul(global_viewProj, Float4(pos_ws, 1));\\n\";\n vert_ss << \" gl_Position.y *= internal_rt_flip;\\n\";\n vert_ss << gfx_gasoline_generate_trans_encode(trans, \"uvert_\");\n vert_ss << \"}\\n\";\n\n vert_out = vert_ss.str();\n\n\n // FRAGMENT\n\n std::stringstream frag_ss;\n frag_ss << preamble(glsl33);\n frag_ss << header.str();\n frag_ss << generate_frag_header(glsl33, ctx, trans, false);\n frag_ss << generate_funcs(mesh_env);\n frag_ss << generate_funcs_frag();\n frag_ss << gfx_gasoline_generate_var_decls(frag_vars);\n if (ctx.lightingTextures)\n frag_ss << gfx_gasoline_preamble_lighting(cfg_env);\n frag_ss << gfx_gasoline_preamble_fade();\n frag_ss << dangs_backend.getUserDangsFunction();\n frag_ss << additional_backend.getUserColourAlphaFunction();\n\n // Main function\n frag_ss << \"void main (void)\\n\";\n frag_ss << \"{\\n\";\n frag_ss << \" frag_screen = gl_FragCoord.xy;\\n\";\n frag_ss << \" if (internal_rt_flip < 0)\\n\";\n frag_ss << \" frag_screen.y = global_viewportSize.y - frag_screen.y;\\n\";\n frag_ss << gfx_gasoline_generate_trans_decode(trans, \"vert_\", GfxGslTrans::VERT);\n frag_ss << gfx_gasoline_generate_trans_decode(trans, \"frag_\", GfxGslTrans::USER);\n frag_ss << gfx_gasoline_generate_trans_decode(trans, \"internal_\", GfxGslTrans::INTERNAL);\n\n frag_ss << \" Float2 uv = frag_screen / global_viewportSize;\\n\";\n frag_ss << \" Float3 ray = lerp(\\n\";\n frag_ss << \" lerp(global_rayBottomLeft, global_rayBottomRight, Float3(uv.x)),\\n\";\n frag_ss << \" lerp(global_rayTopLeft, global_rayTopRight, Float3(uv.x)),\\n\";\n frag_ss << \" Float3(uv.y));\\n\";\n frag_ss << \" uv.y = 1 - uv.y;\\n\";\n frag_ss << \" Float3 bytes = 255 * sample(global_gbuffer0, uv).xyz;\\n\";\n frag_ss << \" Float depth_int = 256.0*256.0*bytes.x + 256.0*bytes.y + bytes.z;\\n\";\n frag_ss << \" Float normalised_cam_dist = depth_int / (256.0*256.0*256.0 - 1);\\n\";\n frag_ss << \" Float3 pos_ws = normalised_cam_dist * ray + global_cameraPos;\\n\";\n\n // Apply world backwards\n frag_ss << \" Float3 pos_os = mul(internal_inv_world, Float4(pos_ws, 1)).xyz;\\n\";\n frag_ss << \" pos_os += Float3(0.5, 0, 0.5);\\n\";\n frag_ss << \" if (pos_os.x < 0) discard;\\n\";\n frag_ss << \" if (pos_os.x > 1) discard;\\n\";\n frag_ss << \" if (pos_os.z < 0) discard;\\n\";\n frag_ss << \" if (pos_os.z > 1) discard;\\n\";\n frag_ss << \" if (pos_os.y < -0.5) discard;\\n\";\n frag_ss << \" if (pos_os.y > 0.5) discard;\\n\";\n // Overwriting the vertex coord is a bit weird but it's the easiest way to make it available\n // to the dangs shader.\n frag_ss << \" vert_coord0.xy = lerp(vert_coord0.xy, vert_coord1.xy, pos_os.xz);\\n\";\n frag_ss << \" vert_coord0.zw = Float2(1 - abs(2 * pos_os.y), 0);\\n\";\n frag_ss << \" vert_normal.xyz = internal_normal;\\n\";\n\n frag_ss << \" Float cam_dist = normalised_cam_dist * global_farClipDistance;\\n\";\n frag_ss << \" Float3 d;\\n\";\n frag_ss << \" Float a;\\n\";\n frag_ss << \" Float3 n;\\n\";\n frag_ss << \" Float g;\\n\";\n frag_ss << \" Float s;\\n\";\n frag_ss << \" func_user_dangs(d, a, n, g, s);\\n\";\n frag_ss << \" n = normalise(n);\\n\";\n //frag_ss << \" Float3 internal_vertex_to_cam = global_cameraPos - pos_ws;\\n\";\n frag_ss << \" Float3 v2c = normalise(-ray);\\n\";\n frag_ss << \" Float3 sun = sunlight(pos_ws, v2c, d, n, g, s, cam_dist);\\n\";\n frag_ss << \" Float3 env = envlight(v2c, d, n, g, s);\\n\";\n frag_ss << \" Float3 additional;\\n\";\n frag_ss << \" Float unused;\\n\";\n frag_ss << \" func_user_colour(additional, unused);\\n\";\n frag_ss << \" out_colour_alpha = Float4((sun + env) * a + additional, a);\\n\";\n // frag_ss << \" out_colour_alpha = Float4(fract(pos_ws), 1);\\n\";\n // frag_ss << \" out_colour_alpha = Float4(vert_coord0.xy, 0, 0.5);\\n\";\n\n if (mat_env.fadeDither) {\n frag_ss << \" fade();\\n\";\n }\n\n frag_ss << \"}\\n\";\n\n frag_out = frag_ss.str();\n}\n" }, { "alpha_fraction": 0.6845294833183289, "alphanum_fraction": 0.6982455849647522, "avg_line_length": 19.76158905029297, "blob_id": "0aef5ab935349b7cf2779d053211cb9ed1d2fa0a", "content_id": "4e1bd717c919db5e5def79d6316b6a179a80136f", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 3135, "license_type": "permissive", "max_line_length": 98, "num_lines": 151, "path": "/engine/net/net.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "#include \"../shared_ptr.h\"\n\nclass NetAddress;\ntypedef SharedPtr<NetAddress> NetAddressPtr;\n\nclass NetMessage;\ntypedef SharedPtr<NetMessage> NetMessagePtr;\n\nstruct lua_State;\n\n#ifndef net_h\n#define net_h\n\n#include <string>\n\nclass ExternalTable;\n\n#include <stdint.h>\n\n#if defined(WIN32)\n#include <WS2tcpip.h>\n#else\n#include <sys/socket.h>\n#include <arpa/inet.h>\n#include <sys/param.h>\n#include <sys/types.h>\n#include <netdb.h>\n#define SOCKET int\n#define INVALID_SOCKET (-1)\n#include <sys/ioctl.h>\n#endif\n\nenum NetChannel\n{\n NetChan_ClientToServer,\n NetChan_ServerToClient\n};\n\nenum NetAddressType\n{\n NetAddress_Invalid,\n NetAddress_Loopback,\n NetAddress_IPv4,\n NetAddress_IPv6\n};\n\nclass NetAddress\n{\nprivate:\n NetAddressType type;\n\n union\n {\n uint32_t ip4;\n uint8_t ip6[16];\n };\n\n uint16_t port;\n\npublic:\n NetAddress();\n NetAddress(NetAddressType type);\n NetAddress(sockaddr* addr, int length);\n\n static NetAddress& getLoopback();\n static NetAddress resolve(const char* host, NetAddressType type);\n\n bool operator ==(NetAddress& right);\n bool operator !=(NetAddress& right);\n\n NetAddressType getType() { return type; }\n void getSockAddr(sockaddr_storage* storage, int* length);\n\n std::string toString();\n};\n\nclass NetMessage\n{\nprivate:\n char* buffer;\n bool bufferManaged;\n\n int curBit;\n int maxBit;\n\npublic:\n NetMessage();\n NetMessage(const char* data, uint32_t length);\n\n virtual ~NetMessage();\n \n std::string getBuffer();\n int getLength();\n\n // readers\n bool readBool();\n int32_t readInteger();\n int32_t readInteger(int numBits);\n\n float readFloat();\n\n std::string readString();\n\n // delta readers\n int32_t readDeltaInteger(int32_t old);\n int32_t readDeltaInteger(int32_t old, int numBits);\n\n float readDeltaFloat(float old);\n\n // writers\n void writeBool(bool value);\n void writeInteger(int32_t value);\n void writeInteger(int32_t value, int numBits);\n\n void writeFloat(float value);\n\n void writeString(std::string& value);\n\n // delta writers\n void writeDeltaInteger(int32_t value, int32_t old);\n void writeDeltaInteger(int32_t value, int32_t old, int bits);\n\n void writeDeltaFloat(float value, float old);\n\n // raw reader/writer\n void readBits(int bits, void* out);\n void writeBits(int bits, const void* data);\n};\n\n// initializes the networking system\nvoid net_init();\n\n// shutdown the networking system, properly closing all LuaPtrs\nvoid net_shutdown(lua_State *L);\n\n// processes network packets and sends them off to wherever they need to go\nvoid net_process(lua_State* L);\n\n// sends an out-of-band packet to a specified network address\nvoid net_send_oob(NetChannel channel, NetAddress& address, const char* format, ...);\n\n// sends a packet to a network address\nvoid net_send(NetChannel channel, NetAddress& address, const char* packet, uint32_t packetLength);\n\n// sets the network callbacks\nvoid net_set_callbacks(ExternalTable& table, lua_State* L);\n\n// gets a loopback packet\nbool net_get_loopback_packet(NetChannel channel, std::string& packet);\n\n#endif\n" }, { "alpha_fraction": 0.4840491712093353, "alphanum_fraction": 0.49385443329811096, "avg_line_length": 66.04629516601562, "blob_id": "58296c95cab656dc81fd7dcb886c8da9f0798c69", "content_id": "bd094e74039c06faef2cffacabdb2b5073926ffb", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 7241, "license_type": "permissive", "max_line_length": 119, "num_lines": 108, "path": "/dependencies/quex-0.34.1/quex/input/setup.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "#! /usr/bin/env python\nfrom quex.core_engine.generator.languages.core import db as quex_core_engine_generator_languages_db\nclass something:\n pass\n\n\nLIST = -1\nFLAG = -2\n\nSETUP_INFO = { \n # [Name in Setup] [ Flags ] [Default / Type]\n \"buffer_limit_code\": [[\"--buffer-limit\"], \"0x0\"],\n \"bytes_per_ucs_code_point\": [[\"--bytes-per-ucs-code-point\", \"-b\"], \"1\"],\n \"no_dos_carriage_return_newline_f\": [[\"--no-DOS\"], FLAG],\n \"disable_token_queue_f\": [[\"--no-token-queue\", \"--ntq\"], FLAG], \n \"disable_string_accumulator_f\": [[\"--no-string-accumulator\", \"--nsacc\"], FLAG],\n \"enable_iconv_f\": [[\"--iconv\"], FLAG],\n \"byte_order\": [[\"--endian\"], \"<system>\"],\n \"input_application_version_id\": [[\"--version-id\"], \"0.0.0-pre-release\"],\n \"input_derived_class_file\": [[\"--derived-class-file\"], \"\"],\n \"input_derived_class_name\": [[\"--derived-class\"], \"\"],\n \"input_foreign_token_id_file\": [[\"--foreign-token-id-file\"], \"\"], # provides foreign token-ids to\n # # be included in generated file.\n \"input_lexer_class_friends\": [[\"--friend-class\"], LIST],\n \"input_mode_files\": [[\"-i\", \"--mode-files\"], LIST],\n \"input_token_class_file\": [[\"--token-class-file\"], \"\", \"quex/code_base/Token\"],\n \"input_token_class_name\": [[\"--token-class\"], \"\", \"Token\"],\n \"input_token_counter_offset\": [[\"--token-offset\"], \"10000\"],\n \"token_id_termination\": [[\"--token-id-termination\"], \"0\"],\n \"token_id_uninitialized\": [[\"--token-id-uninitialized\"], \"1\"],\n \"input_token_id_prefix\": [[\"--token-prefix\"], \"QUEX_TKN_\"],\n \"input_user_token_id_file\": [[\"--user-token-id-file\"], \"\"], # disables token-id file generation!\n \"no_mode_transition_check_f\": [[\"--no-mode-transition-check\"], FLAG],\n \"output_debug_f\": [[\"--debug\"], FLAG],\n \"output_engine_name\": [[\"-o\", \"--engine\"], \"lexer\"], \n \"post_categorizer_f\": [[\"--post-categorizer\"], FLAG],\n \"plot_graphic_format\": [[\"--plot\"], \"\"],\n \"plot_graphic_format_list_f\": [[\"--plot-format-list\"], FLAG],\n \"output_directory\": [[\"--output-directory\", \"--odir\"], \"\"],\n #\n \"version_information\": [[\"--version\", \"-v\"], FLAG],\n \"help\": [[\"--help\", \"-h\"], FLAG],\n #______________________________________________________________________________________________________\n \"begin_of_stream_code\": [[\"--begin-of-stream\"], \"0x19\"], # DEPRECATED\n \"end_of_stream_code\": [[\"--end-of-stream\"], \"0x1A\"], # DEPRECATED\n \"flex_engine_f\": [[\"--flex-engine\"], FLAG], # DEPRECATED\n \"input_pattern_file\": [[\"-p\", \"--pattern-file\"], \"\"], # DEPRECATED \n \"input_token_id_db\": [[\"-t\", \"--token-id-db\"], LIST], # DEPRECATED\n \"leave_temporary_files_f\": [[\"--leave-tmp-files\"], FLAG], # DEPRECATED\n \"plain_memory_f\": [[\"--plain-memory\"], FLAG], # DEPRECATED\n \"std_istream_support_f\": [[\"--istream-support\"], FLAG], # DEPRECATED\n \"yywrap_is_ok_f\": [[\"--yywrap-is-ok\"], FLAG], # DEPRECATED\n \"input_token_sending_via_queue_f\":[[\"--token-queue\"], FLAG], # DEPRECATED\n \"string_accumulator_f\": [[\"--string-accumulator\", \"--sacc\"], FLAG], # DEPRECATED\n}\n\nDEPRECATED = { \n \"input_pattern_file\": \n (\"Write a 'pattern { ... }' section inside the mode files instead.\\n\" + \\\n \"Syntax of the 'pattern { ... }' section and the previous file syntax\\n\" + \\\n \"are backward compatible.\", \"0.9.x\"), \n \"input_token_id_db\":\n (\"Write a 'token { ... }' section inside the mode files instead.\\n\" + \\\n \"Syntax of the 'token { ... }' section and the previous file syntax\\n\" + \\\n \"are backward compatible.\", \"0.9.x\"), \n \"yywrap_is_ok_f\":\n (\"Since the mentioned version, the flex core engine is no longer supported. The\\n\" + \\\n \"flag makes only sense for flex core engines.\", \"0.13.1\"),\n \"flex_engine_f\":\n (\"Since the mentioned version, the flex core engine is no longer supported. The\\n\" + \\\n \"flag makes only sense for flex core engines.\", \"0.13.1\"),\n \"leave_temporary_files_f\":\n (\"Since the mentioned version, the flex core engine is no longer supported. The\\n\" + \\\n \"flag makes only sense for flex core engines.\", \"0.13.1\"),\n \"plain_memory_f\": \n (\"Since the mentioned version, quex does no longer need the '--plain-memory' command\\n\" + \\\n \"line argument. The engine can be used with plain memory directly. Please, consider\\n\" + \\\n \"reading the documentation on this issue.\", \"0.31.1\"),\n \"std_istream_support_f\":\n (\"The lexical analyzer has a flexible interface now, for both C++ istreams and FILE*\\n\" + \\\n \"so that rigid setting with this option is superfluous\", \"0.13.1\"),\n \"begin_of_stream_code\":\n (\"Since the mentioned version, there is no need for end of stream and end of stream\\n\" + \\\n \"characters anymore. Options '--end-of-stream' and '--begin-of-stream' are no longer\\n\" + \\\n \"supported.\", \"0.25.2\"),\n \"end_of_stream_code\":\n (\"Since the mentioned version, there is no need for end of stream and end of stream\\n\" + \\\n \"characters anymore. Options '--end-of-stream' and '--begin-of-stream' are no longer\\n\" + \\\n \"supported.\", \"0.25.2\"),\n \"input_token_sending_via_queue_f\":\n (\"The token queue was temporarily turned off by default. Since 0.31.5 the token queue is again\\n\" + \\\n \"turned on by default, since the lexical analysers can be described much more natural. If you\\n\" + \\\n \"want to disable the token queue, please, use '--no-token-queue', or '--ntq'.\", \"0.31.5\"),\n \"string_accumulator_f\":\n (\"The string accumulator was temporarily turned off by default. Since 0.31.5 the it is again\\n\" + \\\n \"turned on by default. If you want to disable the token queue, please, use '--no-string-accumulator',\\n\" + \\\n \"or '--nsacc'.\", \"0.31.5\")\n}\n \n\nsetup = something()\nfor key, entry in SETUP_INFO.items():\n if entry[1] == LIST: default_value = []\n elif entry[1] == FLAG: default_value = False\n else: default_value = entry[1]\n setup.__dict__[key] = default_value\n\nsetup.language_db = quex_core_engine_generator_languages_db[\"C++\"]\n" }, { "alpha_fraction": 0.5771515965461731, "alphanum_fraction": 0.5806018710136414, "avg_line_length": 43.97413635253906, "blob_id": "13ca01b4a2a7d64325a36854a5a200d133d4dac3", "content_id": "77c1a669aa2a57adec45beb507ad5572de5c5c25", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 5217, "license_type": "permissive", "max_line_length": 111, "num_lines": 116, "path": "/dependencies/quex-0.34.1/quex/code_base/template/Analyser.i", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* -*- C++ -*- vim: set syntax=cpp: */\n#ifndef __INCLUDE_GUARD__QUEX__CODE_BASE__ANALYSER_MINIMAL_I__\n#define __INCLUDE_GUARD__QUEX__CODE_BASE__ANALYSER_MINIMAL_I__\n\n#include <quex/code_base/definitions>\n#include <quex/code_base/buffer/Buffer>\n\n#if ! defined(__QUEX_SETTING_PLAIN_C)\nnamespace quex {\n#endif\n\n TEMPLATE_IN(InputHandleT) void\n QuexAnalyser_construct(QuexAnalyser* me,\n QUEX_ANALYSER_FUNCTION_TYPE AnalyserFunction,\n InputHandleT* input_handle,\n QuexBufferFillerTypeEnum InputCodingType,\n const char* IANA_InputCodingName, \n const size_t BufferMemorySize,\n const size_t TranslationBufferMemorySize)\n /* input_handle == 0x0 means that there is no stream/file to read from. Instead, the \n * user intends to perform the lexical analysis directly on plain\n * memory. In this case, the user needs to call the following function\n * by hand in order to setup the memory:\n *\n * QuexBufferMemory_init(analyse->buffer._memory, (uint8_t*)MyMemoryP, MyMemorySize); \n */\n {\n QuexBuffer_construct(&me->buffer, \n input_handle,\n InputCodingType, IANA_InputCodingName,\n BufferMemorySize,\n TranslationBufferMemorySize);\n\n me->current_analyser_function = AnalyserFunction;\n\n /* Double check that everything is setup propperly. */\n QUEX_BUFFER_ASSERT_CONSISTENCY(&me->buffer);\n __quex_assert(me->buffer._input_p == me->buffer._memory._front + 1);\n }\n\n QUEX_INLINE void\n QuexAnalyser_destruct(QuexAnalyser* me)\n {\n QuexBuffer_destruct(&me->buffer);\n }\n\n QUEX_INLINE void\n QuexAnalyser_reset(QuexAnalyser* me)\n {\n QuexBuffer_reset(&me->buffer);\n }\n\n /* NOTE: 'reload_forward()' needs to be implemented for each mode, because\n * addresses related to acceptance positions need to be adapted. This\n * is not the case for 'reload_backward()'. In no case of backward\n * reloading, there are important addresses to keep track. */\n QUEX_INLINE bool \n QuexAnalyser_buffer_reload_backward(QuexBuffer* buffer)\n {\n if( buffer->filler == 0x0 ) return false;\n\n const size_t LoadedCharacterN = QuexBufferFiller_load_backward(buffer);\n if( LoadedCharacterN == 0 ) return false;\n \n /* Backward lexing happens in two cases:\n *\n * (1) When checking for a pre-condition. In this case, no dedicated acceptance\n * is involved. No acceptance positions are considered.\n * (2) When tracing back to get the end of a core pattern in pseudo-ambigous\n * post conditions. Then, no acceptance positions are involved, because\n * the start of the lexeme shall not drop before the begin of the buffer \n * and the end of the core pattern, is of course, after the start of the \n * lexeme. => there will be no reload backwards. */\n return true;\n }\n\n QUEX_INLINE bool \n QuexAnalyser_buffer_reload_forward(QuexBuffer* buffer, \n QUEX_CHARACTER_POSITION_TYPE* last_acceptance_input_position,\n QUEX_CHARACTER_POSITION_TYPE* post_context_start_position,\n const size_t PostContextN)\n {\n QUEX_CHARACTER_POSITION_TYPE* iterator = 0x0;\n QUEX_CHARACTER_POSITION_TYPE* End = post_context_start_position + PostContextN;\n\n if( buffer->filler == 0x0 ) return false;\n if( buffer->_end_of_file_p != 0x0 ) return false;\n const size_t LoadedCharacterN = QuexBufferFiller_load_forward(buffer);\n if( LoadedCharacterN == 0 ) return false;\n\n if( *last_acceptance_input_position != 0x0 ) { \n *last_acceptance_input_position -= LoadedCharacterN;\n /* QUEX_DEBUG_ADR_ASSIGNMENT(\"last_acceptance_input_position\", *last_acceptance_input_position); */\n } \n for(iterator = post_context_start_position; iterator != End; ++iterator) {\n /* NOTE: When the post_context_start_position is still undefined the following operation may\n * underflow. But, do not care, once it is **assigned** to a meaningful value, it won't */\n *iterator -= LoadedCharacterN;\n }\n \n return true;\n }\n\n\n#if ! defined(__QUEX_SETTING_PLAIN_C)\n} // namespace quex \n#endif\n\n#include <quex/code_base/buffer/Buffer.i>\n#include <quex/code_base/buffer/BufferFiller.i>\n#include <quex/code_base/buffer/plain/BufferFiller_Plain.i>\n#ifdef QUEX_OPTION_ENABLE_ICONV\n# include <quex/code_base/buffer/iconv/BufferFiller_IConv.i>\n#endif\n\n#endif /* __INCLUDE_GUARD__QUEX__CODE_BASE__ANALYSER_MINIMAL_I__ */\n" }, { "alpha_fraction": 0.536064863204956, "alphanum_fraction": 0.5588988661766052, "avg_line_length": 17.3764705657959, "blob_id": "6038f4ff7894f98afb278654ba11a2be27dcd1f1", "content_id": "df4ec2c57a13c792f53098b02c24c2d150c5bf56", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 4686, "license_type": "permissive", "max_line_length": 91, "num_lines": 255, "path": "/engine/net/net_message.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "#include <cstdlib>\n#include <cstdio>\n#include <cstring>\n\n#include <centralised_log.h>\n\n#include \"net.h\"\n\nNetMessage::NetMessage()\n{\n this->buffer = (char*)malloc(32);\n this->curBit = 0;\n this->maxBit = 32 * 8;\n this->bufferManaged = true;\n\n memset(this->buffer, 0, 32);\n}\n\nNetMessage::NetMessage(const char* data, uint32_t length)\n{\n this->buffer = (char*)malloc(length);\n this->curBit = 0;\n this->maxBit = length * 8;\n this->bufferManaged = true;\n\n memcpy(buffer, data, length);\n}\n\nNetMessage::~NetMessage()\n{\n if (bufferManaged)\n {\n free(this->buffer);\n }\n}\n\nstd::string NetMessage::getBuffer()\n{\n return std::string(buffer, (curBit + 8) / 8);\n}\n\nbool NetMessage::readBool()\n{\n bool data = false;\n readBits(1, &data);\n\n return data;\n}\n\n// this is not big endian safe\nint32_t NetMessage::readInteger()\n{\n return readInteger(32);\n}\n\nint32_t NetMessage::readInteger(int numBits)\n{\n int32_t data = 0;\n readBits(numBits, &data);\n\n return data;\n}\n\nfloat NetMessage::readFloat()\n{\n float data = 0;\n readBits(32, &data);\n\n return data;\n}\n\nstd::string NetMessage::readString()\n{\n short length;\n readBits(16, &length);\n\n char str[4097];\n readBits(length * 8, str);\n\n str[sizeof(str) - 1] = '\\0';\n\n return std::string(str);\n}\n\nint32_t NetMessage::readDeltaInteger(int32_t old)\n{\n return readDeltaInteger(old, 32);\n}\n\nint32_t NetMessage::readDeltaInteger(int32_t old, int numBits)\n{\n if (readBool())\n {\n return readInteger(numBits);\n }\n\n return old;\n}\n\nfloat NetMessage::readDeltaFloat(float old)\n{\n if (readBool())\n {\n return readFloat();\n }\n\n return old;\n}\n\nvoid NetMessage::writeBool(bool value)\n{\n writeBits(1, &value);\n}\n\nvoid NetMessage::writeInteger(int32_t value)\n{\n writeInteger(value, 32);\n}\n\nvoid NetMessage::writeInteger(int32_t value, int numBits)\n{\n writeBits(numBits, &value);\n}\n\nvoid NetMessage::writeFloat(float value)\n{\n writeBits(32, &value);\n}\n\nvoid NetMessage::writeString(std::string& value)\n{\n int length = value.length();\n writeBits(16, &length);\n\n writeBits(length * 8, value.c_str());\n}\n\nvoid NetMessage::writeDeltaInteger(int32_t value, int32_t old, int bits)\n{\n writeBool(value != old);\n\n if (value != old)\n {\n writeInteger(value, bits);\n }\n}\n\nvoid NetMessage::writeDeltaFloat(float value, float old)\n{\n writeBool(value != old);\n\n if (value != old)\n {\n writeFloat(value);\n }\n}\n\nint NetMessage::getLength()\n{\n return (curBit / 8) + ((curBit % 8) ? 0 : 1);\n}\n\nvoid NetMessage::readBits(int bits, void* out)\n{\n if (bits == 0)\n {\n return;\n }\n\n if ((curBit + bits) > maxBit)\n {\n return;\n }\n\n int curByte = curBit >> 3;\n int curOut = 0;\n\n uint8_t* outputStuff = (uint8_t*)out;\n\n while (bits > 0)\n {\n int minBit = (bits < 8) ? bits : 8;\n\n int thisByte = (int)buffer[curByte];\n curByte++;\n\n int remain = curBit & 7;\n\n if ((minBit + remain) <= 8) {\n outputStuff[curOut] = (uint8_t)((0xFF >> (8 - minBit)) & (thisByte >> remain));\n } else {\n outputStuff[curOut] = (uint8_t)(\n ((0xFF >> (8 - minBit)) & (buffer[curByte] << (8 - remain)))\n | (thisByte >> remain));\n }\n\n curOut++;\n curBit += minBit;\n bits -= minBit;\n }\n}\n\nvoid NetMessage::writeBits(int bits, const void* data)\n{\n if (!bufferManaged)\n {\n GRIT_EXCEPT(\"tried to write to a read-only NetMessage\");\n }\n\n if (bits == 0)\n {\n return;\n }\n\n if ((curBit + bits) > maxBit)\n {\n this->buffer = (char*)realloc(this->buffer, (this->maxBit + bits + 8) / 8);\n }\n\n // this code is really weird\n int bit = bits;\n\n uint8_t* myData = (uint8_t*)data;\n\n while (bit > 0)\n {\n int bitPos = curBit & 7;\n int remBit = 8 - bitPos;\n int thisWrite = (bit < remBit) ? bit : remBit;\n\n uint8_t mask = ((0xFF >> remBit) | (0xFF << (bitPos + thisWrite)));\n int bytePos = curBit >> 3;\n\n uint8_t tempByte = (mask & buffer[bytePos]);\n uint8_t thisBit = ((bits - bit) & 7);\n int thisByte = (bits - bit) >> 3;\n\n uint8_t thisData = myData[thisByte];\n\n int nextByte = (((bits - 1) >> 3) > thisByte) ? myData[thisByte + 1] : 0;\n\n thisData = ((nextByte << (8 - thisBit)) | (thisData >> thisBit));\n\n uint8_t outByte = ((~mask & (thisData << bitPos)) | tempByte);\n buffer[bytePos] = outByte;\n\n curBit += thisWrite;\n bit -= thisWrite;\n\n if (maxBit < curBit)\n {\n maxBit = curBit;\n }\n }\n}\n" }, { "alpha_fraction": 0.628947377204895, "alphanum_fraction": 0.678947389125824, "avg_line_length": 22.75, "blob_id": "92e85b74b3f60922f8bfb1dc2c0bde7014e52047", "content_id": "38fb9a35ca55117fcfd8d6b6eefbb22e0a4d3e68", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Lua", "length_bytes": 380, "license_type": "permissive", "max_line_length": 74, "num_lines": 16, "path": "/engine/tests/engine/hud/cornered.lua", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "gfx_colour_grade(`neutral.lut.png`)\ngfx_option('POST_PROCESSING', false)\n\ngfx_hud_class_add(`Rect`, {\n})\n\nobj = gfx_hud_object_add(`Rect`)\nobj.position = vec(200, 100) -- centre of object, from screen bottom left\nobj.texture = `speech-bubble.png`\nobj.size = vec(50, 50)\nobj.cornered = true\n\n\n\ngfx_render(0.1, vec(0, 0, 0), quat(1, 0, 0, 0))\ngfx_screenshot('output-cornered.png')\n" }, { "alpha_fraction": 0.487514853477478, "alphanum_fraction": 0.5582639575004578, "avg_line_length": 47.02857208251953, "blob_id": "ee92122bab33d46a0e51593da29ef206e0c65cb5", "content_id": "c9023b261886cc15ab382ceecf36a25bb17d7387", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Lua", "length_bytes": 1682, "license_type": "permissive", "max_line_length": 127, "num_lines": 35, "path": "/engine/tests/engine/cubemap/cubemap.luaimg.lua", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "\nlongitude_planes = {}\nfor longitude = 0, 359 do\n longitude_planes[longitude] = vec3(sin(rad(longitude)), cos(rad(longitude)), 0)\nend\nfunction v3_to_colour(pos)\n pos = norm(pos)\n pos = quat(23.5, vec(0, 1, 0)) * pos\n local polar = vec2(\n deg(mod(atan2(pos.x, pos.y) + 2*math.pi, 2*math.pi)),\n deg(atan(pos.z / #pos.xy))\n )\n for longitude = 0, 359, 15 do\n if abs(dot(pos, longitude_planes[longitude])) < 0.01 then\n return vec3(0, 0, 0)\n end\n end\n for latitude = -180+15, 179, 15 do\n if abs(polar.y / 15 - floor(polar.y / 15)) < 0.08 then\n return vec3(0, 0, 0)\n end\n end\n local bg = vec(0.5, 0.5, 0.5)\n if polar.y > 0 then bg = bg + vec3(0, 0, 0.3) end\n if polar.x > 180 then bg = bg + vec3(0, 0.3, 0) end\n return bg\nend;\n\nlocal sz = 256\npos_x = mipmaps(make(vec(sz, sz), 3, function(p_) local p = p_/(sz - 1) * 2 - 1; return v3_to_colour(vec3( 1, p.y, -p.x)) end))\nneg_x = mipmaps(make(vec(sz, sz), 3, function(p_) local p = p_/(sz - 1) * 2 - 1; return v3_to_colour(vec3(-1, p.y, p.x)) end))\npos_y = mipmaps(make(vec(sz, sz), 3, function(p_) local p = p_/(sz - 1) * 2 - 1; return v3_to_colour(vec3(p.x, 1, -p.y)) end))\nneg_y = mipmaps(make(vec(sz, sz), 3, function(p_) local p = p_/(sz - 1) * 2 - 1; return v3_to_colour(vec3(p.x, -1, p.y)) end))\npos_z = mipmaps(make(vec(sz, sz), 3, function(p_) local p = p_/(sz - 1) * 2 - 1; return v3_to_colour(vec3(p.x, p.y, 1)) end))\nneg_z = mipmaps(make(vec(sz, sz), 3, function(p_) local p = p_/(sz - 1) * 2 - 1; return v3_to_colour(vec3(-p.x, p.y, -1)) end))\ndds_save_cube(\"cube.dds\", \"R8G8B8\", pos_x, neg_x, pos_y, neg_y, pos_z, neg_z)\n" }, { "alpha_fraction": 0.6744186282157898, "alphanum_fraction": 0.6744186282157898, "avg_line_length": 20, "blob_id": "0f47abe59d5f3bdf325290899e716a588199e532", "content_id": "9fe3b35ef3b8a3efc23b331c87f293b43325c658", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Shell", "length_bytes": 43, "license_type": "permissive", "max_line_length": 24, "num_lines": 2, "path": "/dependencies/quex-0.34.1/demo/004/benchmark/input/clean-example_db.sh", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "rm -f data-*.txt\nrm -f EXAMPLE-DB-CREATED\n\n" }, { "alpha_fraction": 0.659947395324707, "alphanum_fraction": 0.6739702224731445, "avg_line_length": 30.174863815307617, "blob_id": "27aeef40c9ec800f489b578d14976abdcbd77217", "content_id": "375ea875b3049c47d1f78121fa82ca913ca8655b", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 5705, "license_type": "permissive", "max_line_length": 93, "num_lines": 183, "path": "/engine/physics/bcol_parser.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTwARE IS PROVIDED \"AS IS\", wITHOUT wARRANTy OF ANy KIND, ExPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE wARRANTIES OF MERCHANTABILITy,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPyRIGHT HOLDERS BE LIABLE FOR ANy CLAIM, DAMAGES OR OTHER\n * LIABILITy, wHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERwISE, ARISING FROM,\n * OUT OF OR IN CONNECTION wITH THE SOFTwARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTwARE.\n */\n\n#include <iostream>\n\nstruct BColFile;\nstruct TColFile;\n\nvoid write_bcol_as_tcol (std::ostream &o, BColFile &f);\n\nvoid write_tcol_as_bcol (std::ostream &o, TColFile &f);\n\n#ifndef BColParser_h\n#define BColParser_h\n\n#include <vector>\n\n#ifdef _MSC_VER\n typedef unsigned __int32 uint32_t;\n#else\n #include <stdint.h>\n#endif\n\n#ifdef _MSC_VER\n #define GRIT_PACKED_ATTR\n#else\n #define GRIT_PACKED_ATTR __attribute__((__packed__))\n#endif\n\n\n#ifdef _MSC_VER\n#pragma pack (push,1)\n#endif\n\nstruct OffsetBase {\n template<class T> T *offset (size_t n, size_t e=0)\n {\n char *ptr = reinterpret_cast<char*>(this);\n T *offset_ptr = reinterpret_cast<T*>(&ptr[n]);\n return &offset_ptr[e];\n }\n} GRIT_PACKED_ATTR;\n\nstruct BColVert {\n float x, y, z;\n static size_t size (void) { return 3*4; }\n} GRIT_PACKED_ATTR;\n \nstruct BColMat {\n // had to duplicate code here instead of extending OffsetBae, otherwise some sort of\n // multiple inheritance problem caused BColHull to be 1 byte too large...\n template<class T> T *offset (size_t n, size_t e=0)\n {\n char *ptr = reinterpret_cast<char*>(this);\n T *offset_ptr = reinterpret_cast<T*>(&ptr[n]);\n return &offset_ptr[e];\n }\n uint32_t charOff; // offset (relative to this) where the text can be found\n char *name (void) { return offset<char>(charOff); }\n static size_t size (void) { return 1*4; }\n} GRIT_PACKED_ATTR;\n\nstruct BColHull : OffsetBase {\n BColMat mat;\n float margin;\n uint32_t vertNum;\n uint32_t vertOff; // offset (relative to this) where BColVertex may be found\n BColVert *verts (int i=0) { return offset<BColVert>(vertOff,i); }\n static size_t size (void) { return 3*4 + BColMat::size(); }\n} GRIT_PACKED_ATTR;\n\nstruct BColBox {\n BColMat mat;\n float margin;\n float px, py, pz;\n float dx, dy, dz;\n float qw, qx, qy, qz;\n static size_t size (void) { return 11*4 + BColMat::size(); }\n} GRIT_PACKED_ATTR;\n\nstruct BColCyl {\n BColMat mat;\n float margin;\n float px, py, pz;\n float dx, dy, dz;\n float qw, qx, qy, qz;\n static size_t size (void) { return 11*4 + BColMat::size(); }\n} GRIT_PACKED_ATTR;\n\nstruct BColCone {\n BColMat mat;\n float margin;\n float px, py, pz;\n float radius, height;\n float qw, qx, qy, qz;\n static size_t size (void) { return 10*4 + BColMat::size(); }\n} GRIT_PACKED_ATTR;\n\nstruct BColPlane {\n BColMat mat;\n float nx, ny, nz;\n float d;\n static size_t size (void) { return 4*4 + BColMat::size(); }\n} GRIT_PACKED_ATTR;\n\nstruct BColSphere { \n BColMat mat;\n float px, py, pz;\n float radius;\n static size_t size (void) { return 4*4 + BColMat::size(); }\n} GRIT_PACKED_ATTR;\n\nstruct BColFace {\n BColMat mat;\n uint32_t v1, v2, v3;\n static size_t size (void) { return 3*4 + BColMat::size(); }\n} GRIT_PACKED_ATTR;\n\nstruct BColFile : OffsetBase {\n char header[8]; // \"BCOL1.0\\n\"\n float mass;\n uint32_t inertiaProvided; // \n float inertia[3];\n float linearDamping;\n float angularDamping;\n float linearSleepThreshold;\n float angularSleepThreshold;\n float ccdMotionThreshold;\n float ccdSweptSphereRadius;\n uint32_t hullNum, hullOff;\n uint32_t boxNum, boxOff;\n uint32_t cylNum, cylOff;\n uint32_t coneNum, coneOff;\n uint32_t planeNum, planeOff;\n uint32_t sphereNum, sphereOff;\n uint32_t capsuleNum, capsuleOff;\n float triMeshMargin;\n float triMeshEdgeDistanceThreshold;\n uint32_t triMeshVertNum, triMeshVertOff; // offset (relative to this) to BColVertex array\n uint32_t triMeshFaceNum, triMeshFaceOff; // offset (relative to this) to BColFace array\n\n BColHull *hulls (int i=0) { return offset<BColHull>(hullOff,i); }\n BColBox *boxes (int i=0) { return offset<BColBox>(boxOff,i); }\n BColCyl *cyls (int i=0) { return offset<BColCyl>(cylOff,i); }\n BColCone *cones (int i=0) { return offset<BColCone>(coneOff,i); }\n BColPlane *planes (int i=0) { return offset<BColPlane>(planeOff,i); }\n BColSphere *spheres (int i=0) { return offset<BColSphere>(sphereOff,i); }\n\n long totalCompoundElements (void)\n { return hullNum + boxNum + cylNum + coneNum + planeNum + sphereNum; }\n \n BColVert *triMeshVerts (int i=0) { return offset<BColVert>(triMeshVertOff,i); }\n BColFace *triMeshFaces (int i=0) { return offset<BColFace>(triMeshFaceOff,i); }\n\n static size_t size (void) { return 33*4; }\n} GRIT_PACKED_ATTR;\n\n#ifdef _MSC_VER\n#pragma pack (pop)\n#endif\n\ntypedef std::vector<BColFace> BColFaces;\ntypedef std::vector<BColVert> BColVerts;\n\n#endif\n" }, { "alpha_fraction": 0.6813187003135681, "alphanum_fraction": 0.6813187003135681, "avg_line_length": 17.200000762939453, "blob_id": "4b9555ad8d4fa7df60be86852097620cfa7f21be", "content_id": "8a181c919662602f987eb758bffce74a5269fd97", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Makefile", "length_bytes": 91, "license_type": "permissive", "max_line_length": 47, "num_lines": 5, "path": "/dependencies/quex-0.34.1/grit.mk", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "QUEX_INCLUDE_DIRS= \\\n . \\\n\nQUEX_DEFS= \\\n\tQUEX_OPTION_ASSERTS_WARNING_MESSAGE_DISABLED \\\n" }, { "alpha_fraction": 0.6649503111839294, "alphanum_fraction": 0.6700279116630554, "avg_line_length": 29.530567169189453, "blob_id": "eef439c48174fd47c38b2f3f1515a8c11c8fabdf", "content_id": "ae169b99667599c61bd98defc45e11827ac68272", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 13983, "license_type": "permissive", "max_line_length": 139, "num_lines": 458, "path": "/engine/gfx/hud.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <string>\n#include <map>\n\n#include \"../shared_ptr.h\"\n\nclass HudBase;\nclass HudObject;\nclass HudText;\n\nclass HudClass;\ntypedef std::map<std::string,HudClass*> HudClassMap;\n\n#ifndef GFX_HUD_h\n#define GFX_HUD_h\n\nextern \"C\" {\n #include <lua.h>\n #include <lauxlib.h>\n #include <lualib.h>\n}\n\n#include \"../external_table.h\"\n#include \"../grit_lua_util.h\"\n#include \"../lua_ptr.h\"\n#include \"../path_util.h\"\n#include \"../vect_util.h\"\n\n#include \"gfx_pipeline.h\"\n#include \"gfx_font.h\"\n#include \"gfx_shader.h\"\n#include \"gfx_text_buffer.h\"\n\n#define GFX_HUD_ZORDER_MAX 15\n\nclass HudClass {\n\n public:\n\n HudClass (lua_State *L, const std::string &name_)\n : name(name_)\n {\n int index = lua_gettop(L);\n for (lua_pushnil(L) ; lua_next(L,index)!=0 ; lua_pop(L,1)) {\n const char *err = table.luaSet(L);\n if (err) my_lua_error(L, err);\n }\n lua_pop(L,1); // the table we just iterated through\n }\n\n void get (lua_State *L, lua_Number key)\n {\n const char *err = table.luaGet(L, key);\n if (err) my_lua_error(L,err);\n } \n\n void set (lua_State *L, lua_Number key)\n {\n const char *err = table.luaSet(L, key);\n if (err) my_lua_error(L,err);\n }\n \n void get (lua_State *L, const std::string &key)\n {\n const char *err = table.luaGet(L, key);\n if (err) my_lua_error(L,err);\n } \n\n void set (lua_State *L, const std::string &key)\n {\n const char *err = table.luaSet(L, key);\n if (err) my_lua_error(L,err);\n }\n \n void get (lua_State *L)\n { \n const char *err = table.luaGet(L);\n if (err) my_lua_error(L,err);\n }\n\n void set (lua_State *L)\n { \n const char *err = table.luaSet(L);\n if (err) my_lua_error(L,err);\n }\n\n void dump (lua_State *L)\n {\n table.dump(L);\n }\n\n const std::string name;\n\n const ExternalTable &getTable (void) const { return table; }\n ExternalTable &getTable (void) { return table; }\n\n protected:\n\n ExternalTable table;\n\n};\n\nHudClass *hud_class_add (lua_State *L, const std::string& name);\n\nHudClass *hud_class_get (const std::string &name);\nbool hud_class_has (const std::string &name);\n\nvoid hud_class_all (HudClassMap::iterator &begin, HudClassMap::iterator &end);\nsize_t hud_class_count (void);\n\n\n\nclass HudBase : public fast_erase_index {\n\n protected:\n\n enum Aliveness { ALIVE, DYING, DEAD };\n\n Aliveness aliveness;\n\n HudObject *parent;\n\n unsigned char zOrder;\n\n Vector2 position;\n Radian orientation;\n bool inheritOrientation;\n bool enabled;\n\n public:\n bool snapPixels;\n protected:\n\n HudBase (void);\n\n // maintain tree structure\n void registerRemove (void);\n void registerAdd (void);\n\n public:\n\n virtual ~HudBase (void);\n\n virtual void destroy (void);\n virtual void destroy (lua_State *) { destroy(); }\n\n void assertAlive (void) const;\n\n bool destroyed (void) { return aliveness == DEAD; }\n\n void setEnabled (bool v) { assertAlive(); registerRemove() ; enabled = v; registerAdd(); }\n bool isEnabled (void) { assertAlive(); return enabled; }\n\n void setInheritOrientation (bool v) { assertAlive(); inheritOrientation = v; }\n bool getInheritOrientation (void) const { assertAlive(); return inheritOrientation; } \n void setOrientation (Radian v) { assertAlive(); orientation = v; }\n Radian getOrientation (void) const { assertAlive(); return orientation; }\n Radian getDerivedOrientation (void) const;\n\n void setPosition (const Vector2 &v) { assertAlive(); position = v; }\n Vector2 getPosition (void) const { assertAlive(); return position; }\n Vector2 getDerivedPosition (void) const;\n\n /** Cannot make getSize const because would need to refactor the drawing\n * code out of HudText. In other words, cannot know the size without\n * drawing the text, which requires modifying buffers.\n */\n virtual Vector2 getSize (void) = 0;\n\n Vector2 getBounds (void);\n\n Vector2 getDerivedBounds (void);\n\n void setParent (HudObject *v) { assertAlive(); registerRemove(); parent = v; registerAdd(); }\n HudObject *getParent (void) const { assertAlive(); return parent; }\n\n void setZOrder (unsigned char v) { assertAlive(); registerRemove(); zOrder = v; registerAdd(); }\n unsigned char getZOrder (void) const { assertAlive(); return zOrder; }\n\n};\n\nclass HudObject : public HudBase {\n\n public:\n\n HudClass * const hudClass;\n LuaPtr table;\n\n protected:\n fast_erase_vector<HudBase*> children;\n\n DiskResourcePtr<GfxTextureDiskResource> texture;\n GfxShaderBindings shaderBinds;\n GfxTextureStateMap texs;\n GfxTextureStateMap stencilTexs;\n\n GfxGslMaterialEnvironment matEnvRect, matEnvStencil;\n Vector2 uv1, uv2;\n bool cornered;\n Vector2 size;\n bool sizeSet;\n Vector3 colour;\n float alpha;\n bool stencil;\n // If no texture, children will be visible only within the rect.\n // If texture, children will be visible only where texture alpha > 0.5\n DiskResourcePtr<GfxTextureDiskResource> stencilTexture;\n\n bool needsResizedCallbacks;\n bool needsParentResizedCallbacks;\n bool needsInputCallbacks;\n bool needsFrameCallbacks;\n\n public:\n\n HudObject (HudClass *hud_class);\n\n void incRefCount (void);\n void decRefCount (lua_State *L);\n // do as much as we can without using L\n void destroy (void);\n // destroy with L (callbacks etc)\n void destroy (lua_State *L);\n\n void triggerInit (lua_State *L);\n void triggerResized (lua_State *L);\n void triggerParentResized (lua_State *L);\n void triggerMouseMove (lua_State *L, const Vector2 &abs);\n void triggerButton (lua_State *L, const std::string &key);\n void triggerFrame (lua_State *L, float elapsed);\n void triggerDestroy (lua_State *L);\n\n void notifyChildRemove (HudBase *child);\n void notifyChildAdd (HudBase *child);\n\n float getAlpha (void) const { assertAlive(); return alpha; }\n void setAlpha (float v);\n \n Vector3 getColour (void) const { assertAlive(); return colour; }\n void setColour (const Vector3 &v);\n \n Vector2 getUV1 (void) const { assertAlive(); return uv1; }\n void setUV1 (const Vector2 &v) { assertAlive(); uv1 = v; }\n \n Vector2 getUV2 (void) const { assertAlive(); return uv2; }\n void setUV2 (const Vector2 &v) { assertAlive(); uv2 = v; }\n\n bool isCornered (void) const { assertAlive(); return cornered; }\n void setCornered (bool v) { assertAlive(); cornered = v; }\n\n GfxTextureDiskResource *getTexture (void) const { assertAlive(); return &*texture; }\n void setTexture (const DiskResourcePtr<GfxTextureDiskResource> &v);\n\n bool isStencil (void) const { assertAlive(); return stencil; }\n void setStencil (bool v) { assertAlive(); stencil = v; }\n\n GfxTextureDiskResource *getStencilTexture (void) const\n { assertAlive(); return &*stencilTexture; }\n void setStencilTexture (const DiskResourcePtr<GfxTextureDiskResource> &v);\n\n void setSize (lua_State *L, const Vector2 &v);\n Vector2 getSize (void) { assertAlive(); return size; }\n bool getSizeSet (void) { assertAlive(); return sizeSet; }\n\n void setParent (lua_State *L, HudObject *v);\n\n bool getNeedsResizedCallbacks (void) const { assertAlive(); return needsResizedCallbacks; }\n void setNeedsResizedCallbacks (bool v) { assertAlive(); needsResizedCallbacks = v; }\n\n bool getNeedsParentResizedCallbacks (void) const\n { assertAlive(); return needsParentResizedCallbacks; }\n void setNeedsParentResizedCallbacks (bool v)\n { assertAlive(); needsParentResizedCallbacks = v; }\n\n bool getNeedsInputCallbacks (void) const { assertAlive(); return needsInputCallbacks; }\n void setNeedsInputCallbacks (bool v) { assertAlive(); needsInputCallbacks = v; }\n\n bool getNeedsFrameCallbacks (void) const { assertAlive(); return needsFrameCallbacks; }\n void setNeedsFrameCallbacks (bool v) { assertAlive(); needsFrameCallbacks = v; }\n\n // Transform screen co-ordinates (e.g. from the mouse) to co-ordinates local to the HudObject.\n Vector2 screenToLocal (const Vector2 &screen_pos);\n\n /** Return NULL for a miss, otherwise return the object hit, which can be a child. Must have needsInputCallbacks otherwise ignored. */\n HudObject *shootRay (const Vector2 &screen_pos);\n\n private:\n\n unsigned refCount;\n\n // internal function\n friend void gfx_render_hud_one (HudBase *, int);\n friend void gfx_render_hud_text (HudText *, const Vector3 &, const Vector2 &, int);\n \n};\n\nclass HudText : public HudBase {\n\n public:\n\n protected:\n GfxTextBuffer buf;\n Vector3 colour;\n float alpha;\n Vector3 letterTopColour;\n float letterTopAlpha;\n Vector3 letterBottomColour;\n float letterBottomAlpha;\n Vector2 wrap;\n long scroll;\n Vector2 shadow;\n Vector3 shadowColour;\n float shadowAlpha;\n GfxShaderBindings shaderBinds, shaderBindsShadow;\n GfxTextureStateMap texs;\n GfxGslMaterialEnvironment matEnv, matEnvShadow;\n\n\n unsigned refCount;\n\n public:\n\n HudText (GfxFont *font);\n\n ~HudText (void) { }\n\n void incRefCount (void);\n void decRefCount (void);\n void destroy (void);\n void destroy (lua_State *) { destroy(); }\n\n void clear (void);\n void append (const std::string &v);\n\n void setFont (GfxFont *v) { assertAlive() ; buf.setFont(v); }\n GfxFont *getFont (void) { assertAlive() ; return buf.getFont(); }\n\n std::string getText (void) const;\n\n long getScroll (void)\n {\n assertAlive();\n return scroll;\n }\n\n void setScroll (long v)\n {\n assertAlive();\n scroll = v;\n }\n\n void setTextWrap (const Vector2 &v)\n {\n assertAlive();\n wrap = v;\n buf.setWrap(wrap.x);\n }\n Vector2 getTextWrap (void) const {\n assertAlive();\n return wrap;\n }\n\n Vector2 getSize (void)\n {\n assertAlive();\n if (wrap == Vector2(0,0)) {\n buf.updateGPU(true, scroll, scroll+wrap.y);\n return buf.getDrawnDimensions();\n }\n return wrap;\n }\n\n unsigned long getBufferHeight (void) const\n {\n assertAlive();\n return buf.getBufferHeight();\n }\n\n float getAlpha (void) const { assertAlive(); return alpha; }\n void setAlpha (float v);\n \n Vector3 getColour (void) const { assertAlive(); return colour; }\n void setColour (const Vector3 &v);\n\n Vector2 getShadow (void) const { assertAlive(); return shadow; }\n void setShadow (const Vector2 &v) { assertAlive(); shadow = v; }\n\n Vector3 getShadowColour (void) const { assertAlive(); return shadowColour; }\n void setShadowColour (const Vector3 &v);\n\n float getShadowAlpha (void) const { assertAlive(); return shadowAlpha; }\n void setShadowAlpha (float v);\n\n Vector3 getLetterTopColour (void) const { assertAlive(); return letterTopColour; }\n void setLetterTopColour (const Vector3 &v) { assertAlive(); letterTopColour = v; }\n Vector3 getLetterBottomColour (void) const { assertAlive(); return letterBottomColour; }\n void setLetterBottomColour (const Vector3 &v) { assertAlive(); letterBottomColour = v; }\n float getLetterTopAlpha (void) const { assertAlive(); return letterTopAlpha; }\n void setLetterTopAlpha (float v) { assertAlive(); letterTopAlpha = v; }\n float getLetterBottomAlpha (void) const { assertAlive(); return letterBottomAlpha; }\n void setLetterBottomAlpha (float v) { assertAlive(); letterBottomAlpha = v; }\n \n\n // internal function\n friend void gfx_render_hud_one (HudBase *, int);\n friend void gfx_render_hud_text (HudText *, bool, const Vector2 &, int);\n};\n\n/** Called in the frame loop by the graphics code to render the HUD on top of the 3d graphics. */\nvoid hud_render (Ogre::Viewport *vp);\n\n/** Set up internal state. */\nvoid hud_init (void);\n\n/** Called as the game engine exits to clean up internal state. */\nvoid hud_shutdown (lua_State *L);\n\n/** Return the hud element at the given coordinates. */\nHudObject *hud_ray (int x, int y);\n\n/** Notify the hud system of the mouse location (called on a mouse move event). */\nvoid hud_signal_mouse_move (lua_State *L, const Vector2 &abs);\n\n/** Notify the hud system of a mouse button event. */\nvoid hud_signal_button (lua_State *L, const std::string &key);\n\n/** Notify the hud objects of a window resize. */\nvoid hud_signal_window_resized (unsigned w, unsigned h);\n\n/** Notify the hud objects that they will not be getting key presses for a while. */\nvoid hud_signal_flush (lua_State *L);\n\n/** To be called just before gfx_render, to notify hud objects of any parent\n * resize events that may be pending. The point is that this function has a lua state param, whereas the gfx_render call does not.\n */\nvoid hud_call_per_frame_callbacks (lua_State *L, float elapsed);\n\n#endif\n" }, { "alpha_fraction": 0.6738873720169067, "alphanum_fraction": 0.6761394143104553, "avg_line_length": 38.0167350769043, "blob_id": "e1b9e323be50e45d1c637a2b7d5141e94a51df3e", "content_id": "d3e8ff90d3c8bfe5b1f176402b34ed8345c84874", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 9325, "license_type": "permissive", "max_line_length": 145, "num_lines": 239, "path": "/engine/audio/audio.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include \"../shared_ptr.h\"\n\nclass AudioBody;\ntypedef SharedPtr<AudioBody> AudioBodyPtr;\n\n#ifndef audio_h\n#define audio_h\n\n#include <AL/al.h>\n\n#include <math_util.h>\n\n#include \"../background_loader.h\"\n#include \"../disk_resource.h\"\n\n#include \"audio_disk_resource.h\"\n\nenum AudioBoolOption {\n /** Whether or not setting the next option will cause fresh option values to be\n * processed (default true). To update more than one option concurrently, set\n * autoupdate to false, set the options, then set it to true. */\n AUDIO_AUTOUPDATE,\n /** Whether or not to use the OpenAL doppler shift feature. */\n AUDIO_DOPPLER_ENABLED,\n /** Whether or not to completely suppress all audio. */\n AUDIO_MUTE\n};\n\nenum AudioFloatOption {\n /** A central multiplier for controling the amplitude of all audio. */\n AUDIO_MASTER_VOLUME\n};\n\nenum AudioIntOption {\n /** UNUSED. */\n AUDIO_MAX_SOUNDS\n};\n\n/** Initialise the audio subsystem.\n * \\param devname A string to identify the audio device, or NULL for the system default.\n */\nvoid audio_init (const char *devname);\n\n/** Close the audio device, to prevent audio stuttering.\n */\nvoid audio_shutdown ();\n\n/** Call every frame.\n * \\param position Worldspace location of player.\n * \\param velocity Worldspace velocity of player.\n * \\param rotation Orientation of player.\n */\nvoid audio_update (const Vector3& position, const Vector3& velocity, const Quaternion& rotation);\n\n/** Make an instantaneous ambient sound. Useful for distant car horns, and\n * other short duration environmental sounds. The sound cannot be controlled\n * after playback has begun.\n * \\param filename The name of an audio disk resource, must be loaded.\n * \\param volume Amplitude multiplier.\n * \\param pitch Frequency multiplier (use 1 for verbatim playback).\n */\nvoid audio_play_ambient (const std::string& filename, float volume, float pitch);\n\n/** Make an instantaneous sound. Useful for bangs, knocks, and other short\n * duration sounds. The sound cannot be controlled after playback has begun.\n * \\param filename The name of an audio disk resource, must be loaded.\n * \\param position The worldspace location to emit from. Stereo sounds have channels fused.\n * \\param volume Amplitude multiplier.\n * \\param ref_dist Reference distance - the radius of a sphere inside which the\n * volume is maximum.\n * \\param roll_off The strength at which volume decreases per distance outside\n * the ref_dist sphere.\n * \\param pitch Frequency multiplier (use 1 for verbatim playback).\n */\nvoid audio_play (const std::string& filename, const Vector3& position,\n float volume, float ref_dist, float roll_off, float pitch);\n\n/** Convert the enum value to a human-readable string. */\nstd::string audio_option_to_string (AudioBoolOption o);\n/** Convert the enum value to a human-readable string. */\nstd::string audio_option_to_string (AudioIntOption o);\n/** Convert the enum value to a human-readable string. */\nstd::string audio_option_to_string (AudioFloatOption o);\n\n/** Returns the enum value of the option described by s. Only one of o0, o1,\n * o2 is modified, and t is used to tell the caller which one. */\nvoid audio_option_from_string (const std::string &s,\n int &t,\n AudioBoolOption &o0,\n AudioIntOption &o1,\n AudioFloatOption &o2);\n\n/** Set the option to a particular value. */\nvoid audio_option (AudioBoolOption o, bool v);\n/** Return the current value of the option. */\nbool audio_option (AudioBoolOption o);\n/** Set the option to a particular value. */\nvoid audio_option (AudioIntOption o, int v);\n/** Return the current value of the option. */\nint audio_option (AudioIntOption o);\n/** Set the option to a particular value. */\nvoid audio_option (AudioFloatOption o, float v);\n/** Return the current value of the option. */\nfloat audio_option (AudioFloatOption o);\n\n/** Reset all options to their defaults. */\nvoid audio_option_reset (void);\n\n/** A sound emitter whose parameters can be modified while the sound is\n * playing. Stereo sounds are implemented using two emitters. */\nclass AudioBody : public DiskResource::ReloadWatcher\n{\n private:\n DiskResourcePtr<AudioDiskResource> resource;\n\n Vector3 position;\n Quaternion orientation; // for stereo\n float separation; // for stereo\n Vector3 velocity;\n bool looping;\n float pitch;\n float volume;\n bool ambient;\n float referenceDistance;\n float rollOff;\n bool destroyed;\n\n ALuint alSourceLeft;\n ALuint alSourceRight;\n\n AudioBody (const std::string &filename, bool ambient);\n virtual ~AudioBody (void);\n\n void reinitialise (void);\n\n void notifyReloaded (const DiskResource *dr);\n\n void updatePositions (void);\n\n static const std::string className;\n\n public:\n\n /** Make a new audio source and wrap in a smart pointer.\n * \\param filename The disk resource that will be played. Must be loaded.\n * \\param ambient Whether or not the sound attenuates with player distance.\n */\n static AudioBodyPtr make (const std::string &filename, bool ambient)\n { return AudioBodyPtr(new AudioBody(filename, ambient)); }\n\n /** Return the worldspace location where sound is emitted. */\n Vector3 getPosition (void) { return position; }\n /** Set the worldspace location where sound is emitted. */\n void setPosition (const Vector3& v);\n\n /** Return the worldspace orientation of the body.\n */\n Quaternion getOrientation (void) { return orientation; }\n /** Set the worldspace orientation of the body.\n * This only has an effect for stereo sounds, where two mono emitters are used.\n */\n void setOrientation (const Quaternion& v);\n\n /** Return the separation of the two mono emitters used for a stereo sound. */\n float getSeparation (void) { return separation; }\n /** Set the separation of the two mono emitters used for a stereo sound. */\n void setSeparation (float v);\n\n /** Return the world space velocity of the sound (used for doppler). */\n Vector3 getVelocity (void) { return velocity; }\n /** Set the world space velocity of the sound (used for doppler). */\n void setVelocity (const Vector3& v);\n\n /** Return whether or not the sound plays forever. */\n bool getLooping (void) { return looping; }\n /** Set whether or not the sound plays forever. */\n void setLooping (bool v);\n\n /** Return the sound's amplitude multiplier. */\n float getVolume (void) { return volume; }\n /** Set the sound's amplitude multiplier. */\n void setVolume (float v);\n\n /** Return the sound's frequency multiplier. */\n float getPitch (void) { return pitch; }\n /** Set the sound's frequency multiplier. */\n void setPitch (float v);\n\n /** Return the radius of the sphere within which the volume is not attenuated. */\n float getReferenceDistance (void) { return referenceDistance; }\n /** Set the radius of the sphere within which the volume is not attenuated. */\n void setReferenceDistance (float v);\n\n /** Return the parameter that controls the strength of the attenuation due to distance from the edge of the reference distance sphere. */\n float getRollOff (void) { return rollOff; }\n /** Set the rolloff. \\see getRollOff. */\n void setRollOff (float v);\n\n /** Return whether or not the sound attenuates with distance from the player. */\n bool getAmbient (void) { return ambient; }\n\n /** Is the sound currently playing. */\n bool playing (void);\n /** Cause the sound to play. */\n void play (void);\n /** Pause playback (resume with \\see play). */\n void pause (void);\n /** Stop playback (restart with \\see play). */\n void stop (void);\n\n /** Destroy before destructor is called */\n void destroy (void);\n\n friend class SharedPtr<AudioBody>;\n};\n\n\n#endif\n" }, { "alpha_fraction": 0.4674670696258545, "alphanum_fraction": 0.4674670696258545, "avg_line_length": 43.5, "blob_id": "e76aa16ad714791b3180b17dbe7bac1de127084a", "content_id": "5f84cc9737237221a64d5cf3a22cc89c32dbaa74", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Makefile", "length_bytes": 2582, "license_type": "permissive", "max_line_length": 77, "num_lines": 58, "path": "/dependencies/quex-0.34.1/quex/code_base/core.mkd", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "# vim: set syntax=make: -*- makefile -*-\n\n# HELPER: find -path \"*.svn*\" -or -path \"*TEST*\" -prune -or -print > tmp.txt\nQUEX_CODE_BASE_PATH = $(QUEX_PATH)/quex/code_base\n\nQUEX_CORE = \\\n $(addprefix $(QUEX_CODE_BASE_PATH)/, \\\n Token \\\n MemoryManager \\\n TokenQueue \\\n compatibility/inttypes.h \\\n compatibility/pseudo-stdbool.h \\\n compatibility/iconv-argument-types.h \\\n compatibility/win/borland_inttypes.h \\\n compatibility/win/msc_inttypes.h \\\n compatibility/win/msc_stdint.h \\\n compatibility/stdbool.h \\\n buffer/BufferFiller \\\n buffer/Buffer \\\n buffer/BufferFiller.i \\\n buffer/Buffer.i \\\n buffer/BufferInitFactory.i \\\n buffer/iconv/BufferFiller_IConv \\\n buffer/iconv/BufferFiller_IConv.i \\\n buffer/iconv/debug.i \\\n buffer/MemoryPositionMimiker \\\n buffer/Buffer_debug.i \\\n buffer/InputPolicy \\\n buffer/TEST/Buffer_test_common.i \\\n buffer/plain/BufferFiller_Plain \\\n buffer/plain/BufferFiller_Plain.i \\\n template/IncludeStack.i \\\n template/token_receiving_via_queue.i \\\n template/buffer_access.i \\\n template/dumpster.i \\\n template/Accumulator \\\n template/QuexMode \\\n template/Analyser.i \\\n template/mode_handling.i \\\n template/token_receiving_via_singleton.i \\\n template/PostCategorizer \\\n template/token_sending_via_queue.i \\\n template/lexical_analyzer_class \\\n template/constructor.i \\\n template/token_sending_via_singleton.i \\\n template/Accumulator.i \\\n template/misc.i \\\n template/Analyser \\\n template/count_common \\\n template/Counter.i \\\n template/CounterWithIndentation.i \\\n template/Counter \\\n template/IncludeStack \\\n asserts \\\n definitions \\\n circular_queue \\\n temporary_macros_on \\\n temporary_macros_off)\n\n" }, { "alpha_fraction": 0.5184866786003113, "alphanum_fraction": 0.5282315611839294, "avg_line_length": 40.53571319580078, "blob_id": "22dcda3346f3ff274a43d0e1b997966a9d7774de", "content_id": "32daee298512de6b0ee86f815f1276f53c13212a", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3489, "license_type": "permissive", "max_line_length": 93, "num_lines": 84, "path": "/dependencies/quex-0.34.1/quex/core_engine/regular_expression/snap_backslashed_character.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "from copy import deepcopy\nfrom quex.exception import RegularExpressionException\nfrom StringIO import StringIO\n\n\nbackslashed_character_db = { \n # inside string \"...\" and outside \n 'a': ord('\\a'), 'b': ord('\\b'), 'f': ord('\\f'), 'n': ord('\\n'),\n 'r': ord('\\r'), 't': ord('\\t'), 'v': ord('\\v'), '\\\\': ord('\\\\'), '\"': ord('\"'),\n # only ouside of string\n '+': ord('+'), '*': ord('*'), '?': ord('?'), '/': ord('/'), \n '|': ord('|'), '$': ord('$'), '^': ord('^'), '-': ord('-'), \n '[': ord('['), ']': ord(']'), \n '(': ord('('), ')': ord(')'), \n '{': ord('{'), '}': ord('}'), \n}\n \ndef do(sh, ReducedSetOfBackslashedCharactersF=False):\n \"\"\"All backslashed characters shall enter this function. In particular \n backslashed characters appear in:\n \n \"$50\" -- quoted strings\n [a-zA-Z] -- character sets\n for -- lonestanding characters \n \n x = string containing characters after 'the backslash'\n i = position of the backslash in the given string\n\n ReducedSetOfBackslashedCharactersF indicates whether we are outside of a quoted\n string (lonestanding characters, sets, etc.) or inside a string. Inside a quoted\n string there are different rules, because not all control characters need to be\n considered.\n\n RETURNS: UCS code of the interpreted character,\n index of first element after the treated characters in the string\n \"\"\"\n assert sh.__class__ == StringIO or sh.__class__ == file\n assert type(ReducedSetOfBackslashedCharactersF) == bool \n\n if ReducedSetOfBackslashedCharactersF:\n backslashed_character_list = [ 'a', 'b', 'f', 'n', 'r', 't', 'v', '\\\\', '\"' ]\n else:\n backslashed_character_list = backslashed_character_db.keys()\n\n tmp = sh.read(1)\n if tmp == \"\":\n raise RegularExpressionException(\"End of file while parsing backslash sequence.\")\n\n if tmp in backslashed_character_list: return backslashed_character_db[tmp]\n elif tmp.isdigit(): sh.seek(-1,1); return __parse_octal_number(sh, 5)\n elif tmp == 'x': return __parse_hex_number(sh, 2)\n elif tmp == 'X': return __parse_hex_number(sh, 4)\n elif tmp == 'U': return __parse_hex_number(sh, 6)\n else:\n raise RegularExpressionException(\"Backslashed '%s' is unknown to quex.\" % tmp)\n\ndef __parse_octal_number(sh, MaxL):\n return __parse_base_number(sh, MaxL, \n DigitSet = \"01234567\",\n Base = 8,\n NumberName = \"octal\")\n\ndef __parse_hex_number(sh, MaxL):\n return __parse_base_number(sh, MaxL, \n DigitSet = \"0123456789abcdefABCDEF\",\n Base = 16,\n NumberName = \"hexadecimal\")\n\ndef __parse_base_number(sh, MaxL, DigitSet, Base, NumberName):\n \"\"\"MaxL = Maximum length of number to be parsed.\n \"\"\"\n number_str = \"\"\n tmp = sh.read(1)\n while tmp != \"\" and tmp in DigitSet:\n number_str += tmp\n if len(number_str) == MaxL: break\n tmp = sh.read(1)\n else:\n if tmp != \"\": sh.seek(-1,1)\n \n if number_str == \"\": \n raise RegularExpressionException(\"Missing %s number.\" % NumberName)\n\n return long(number_str, Base)\n" }, { "alpha_fraction": 0.449771523475647, "alphanum_fraction": 0.4649307429790497, "avg_line_length": 41.421539306640625, "blob_id": "451fbf6c3bd67a28d0eae606e312069bde1e2c63", "content_id": "13b3ed0bd6be5767717236e956230e56a767a13f", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 27574, "license_type": "permissive", "max_line_length": 183, "num_lines": 650, "path": "/launcher/launcher.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#pragma comment(linker,\"/manifestdependency:\\\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\\\"\")\n\n#define WINVER 0x0500\n#define _WIN32_WINNT 0x0500\n#define _WIN32_WINDOWS 0x0500\n#define WIN32_LEAN_AND_MEAN\n\n#include <windows.h>\n#include <Commdlg.h>\n#include <windowsx.h>\n#include <commctrl.h>\n#include <uxtheme.h>\n#include <richedit.h>\n\n#include <stdlib.h>\n#include <malloc.h>\n#include <memory.h>\n#include <tchar.h>\n#include <stdio.h>\n#include <string>\n#include <sstream>\n\n#define LOG_LENGTH (20*1024*1024)\n#define BUFFER_SIZE 16384\n\n#define MENU_GL 151\n#define MENU_FULLSCREEN 152\n#define MENU_DINPUT 153\n#define MENU_NOVSYNC 154\n\n// Formats a message string using the specified message and variable\n// list of arguments.\n\n#define got_error(x) do { \\\n LPVOID lpMsgBuf; \\\n DWORD err = GetLastError(); \\\n FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, \\\n NULL, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), \\\n (LPTSTR) &lpMsgBuf, 0, NULL ); \\\n std::stringstream ss; \\\n ss << x << \" (\" << __FILE__ << \":\" << __LINE__ << \")\\n\" << err << \": \"<<((char*)lpMsgBuf); \\\n MessageBox(NULL, ss.str().c_str(), \"Error\", MB_ICONEXCLAMATION | MB_OK); \\\n ExitProcess(1); \\\n} while (0)\n\nchar *cmdline;\n\nHWND win_main;\nHWND win_log;\n//HWND win_prompt;\n//HWND win_send;\nHWND win_launch;\n\nstd::string now (void)\n{\n SYSTEMTIME now;\n GetLocalTime(&now);\n char now_str[1024];\n ::sprintf(now_str, \"%04d/%02d/%02d %02d:%02d:%02d.%03d\", now.wYear, now.wMonth, now.wDay, now.wHour, now.wMinute, now.wSecond, now.wMilliseconds);\n return now_str;\n}\n\nbool scrolled_to_bottom = true;\n\nvoid test_scrolled_to_bottom (void)\n{\n SCROLLINFO scrollinfo;\n scrollinfo.cbSize = sizeof(SCROLLINFO);\n scrollinfo.fMask = SIF_ALL;\n GetScrollInfo(win_log, SB_VERT, &scrollinfo);\n scrolled_to_bottom = scrollinfo.nPos >= scrollinfo.nMax - ((int)scrollinfo.nPage) - 32;\n}\n\nvoid scroll_bottom (void)\n{\n SendMessage(win_log, WM_VSCROLL, SB_BOTTOM, 0);\n SendMessage(win_log, WM_VSCROLL, SB_LINEUP, 0);\n}\n\nvoid edit_append (const char *text)\n{\n CHARRANGE range = {-1, -1};\n SendMessage(win_log, EM_EXSETSEL, 0, (LPARAM)&range);\n SendMessage(win_log, EM_REPLACESEL, FALSE, (LPARAM)text);\n}\n\nvoid edit_clear (void)\n{\n CHARRANGE range = {0, -1};\n SendMessage(win_log, EM_EXSETSEL, 0, (LPARAM)&range);\n SendMessage(win_log, EM_REPLACESEL, FALSE, (LPARAM)\"\");\n}\n\nint current_colour = 7;\nbool current_bold = false;\nvoid set_colour (HWND edit, int c, bool b, bool everything=false)\n{\n CHARFORMAT fmt;\n fmt.cbSize = sizeof(fmt);\n fmt.dwMask = CFM_COLOR;\n fmt.dwEffects = 0;\n switch (c) {\n case 0: fmt.crTextColor = b ? RGB(127,127,127) : RGB( 0, 0, 0); break;\n case 1: fmt.crTextColor = b ? RGB(255, 0, 0) : RGB(204, 0, 0); break;\n case 2: fmt.crTextColor = b ? RGB( 0,255, 0) : RGB( 0,204, 0); break;\n case 3: fmt.crTextColor = b ? RGB(255,255, 0) : RGB(204,204, 0); break;\n case 4: fmt.crTextColor = b ? RGB( 92, 92,255) : RGB( 0, 0,237); break;\n case 5: fmt.crTextColor = b ? RGB(255, 0,255) : RGB(204, 0,204); break;\n case 6: fmt.crTextColor = b ? RGB( 0,255,255) : RGB( 0,204,204); break;\n case 7: fmt.crTextColor = b ? RGB(255,255,255) : RGB(191,191,191); break;\n }\n SendMessage(edit, EM_SETCHARFORMAT, everything?SCF_ALL:SCF_SELECTION, (LPARAM)&fmt);\n current_colour = c;\n current_bold = b;\n}\n\nvoid append_time_stamp (void)\n{\n int c = current_colour;\n bool b = current_bold;\n set_colour(win_log, 7, false, false);\n edit_append((\"[\"+now()+\"] \").c_str());\n set_colour(win_log, c, b, false);\n}\nchar *get_text (HWND rich_edit, size_t &sz)\n{\n GETTEXTEX text;\n char *buf = (char*)malloc(sz);\n text.cb = sz;\n text.flags = GT_USECRLF;\n text.codepage = CP_ACP;\n text.lpDefaultChar = NULL;\n text.lpUsedDefChar = NULL;\n LRESULT bytes = SendMessage(rich_edit, EM_GETTEXTEX, (WPARAM)&text, (LPARAM)buf);\n if ((size_t)bytes>=sz-1) {\n free(buf);\n if (sz==0) sz=1;\n sz *= 2;\n return get_text(rich_edit, sz);\n }\n sz = bytes;\n return buf;\n}\nbool menu_checked (HWND win, UINT id)\n{\n return (GetMenuState(GetMenu(win),id,MF_BYCOMMAND) & MF_CHECKED)!=0;\n}\n\nbool toggle_menu_check (HWND win, UINT id)\n{\n if (menu_checked(win,id)) {\n CheckMenuItem(GetMenu(win),id,MF_UNCHECKED);\n return false;\n } else {\n CheckMenuItem(GetMenu(win),id,MF_CHECKED);\n return true;\n }\n}\n\n\nBOOL CALLBACK AboutProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam) \n{ \n if (message==WM_COMMAND && (LOWORD(wParam)==IDOK || LOWORD(wParam)==IDCANCEL)) {\n EndDialog(hwndDlg, wParam);\n return TRUE;\n }\n return FALSE;\n} \n\nbool subproc_running = false;\nHANDLE subproc_pipe, inherited_pipe;\nOVERLAPPED subproc_read, subproc_write;\n\nvoid subproc_has_quit (void)\n{\n CloseHandle(subproc_pipe);\n subproc_running = false;\n CloseHandle(subproc_read.hEvent);\n CloseHandle(subproc_write.hEvent);\n\n Button_Enable(win_launch,TRUE);\n //Button_Enable(win_send,FALSE);\n //Edit_Enable(win_prompt,FALSE);\n EnableMenuItem(GetMenu(win_main), MENU_GL, MF_ENABLED);\n EnableMenuItem(GetMenu(win_main), MENU_FULLSCREEN, MF_ENABLED);\n EnableMenuItem(GetMenu(win_main), MENU_DINPUT, MF_ENABLED);\n EnableMenuItem(GetMenu(win_main), MENU_NOVSYNC, MF_ENABLED);\n}\n\nstd::string buffer;\n#define RAW_BUFFER_SIZE 1024\nchar raw_buffer[RAW_BUFFER_SIZE+1] = \"\";\nbool this_line_started = false;\nint in_colour = 0;\nvoid subproc_handle_output (DWORD bytes_read)\n{\n test_scrolled_to_bottom();\n SendMessage(win_log, WM_SETREDRAW, false, 0);\n for (DWORD i=0 ; i<bytes_read ; ++i) {\n char c = raw_buffer[i];\n if (in_colour) {\n if (in_colour==1) {\n if (c!='[') {\n got_error(\"no [ here: \" << c);\n } else {\n in_colour = 2;\n }\n } else {\n switch (c) {\n case 'm':\n in_colour = 0;\n case ';': {\n // process buffer\n long num = strtol(buffer.c_str(),NULL,10);\n buffer.clear();\n switch (num) {\n case 0:\n // reset\n set_colour(win_log, 7, false);\n break;\n case 1:\n // bold\n set_colour(win_log, current_colour, true);\n break;\n case 22:\n // nobold\n set_colour(win_log, current_colour, false);\n break;\n case 30: case 31: case 32: case 33:\n case 34: case 35: case 36: case 37:\n // colour\n set_colour(win_log, num-30, current_bold);\n break;\n }\n } break;\n\n case '0': case '1': case '2': case '3': case '4':\n case '5': case '6': case '7': case '8': case '9':\n buffer.append(raw_buffer+i,1);\n break;\n \n default: got_error(\"unrecognised colour code: \"<<c);\n\n }\n }\n } else {\n if (c=='\\n') {\n buffer.append(raw_buffer+i,1);\n if (!this_line_started) append_time_stamp();\n edit_append(buffer.c_str());\n this_line_started = false;\n buffer.clear();\n } else if (c=='\\033') { // enter colour code\n in_colour = true;\n if (!this_line_started) append_time_stamp();\n edit_append(buffer.c_str());\n this_line_started = true;\n buffer.clear(); \n } else {\n buffer.append(raw_buffer+i,1);\n }\n }\n }\n SendMessage(win_log, WM_SETREDRAW, true, 0);\n InvalidateRect(win_log, 0, true);\n if (scrolled_to_bottom)\n scroll_bottom();\n}\n\nvoid subproc_initiate_read (void)\n{\n ZeroMemory(raw_buffer, RAW_BUFFER_SIZE+1);\n if (!ReadFile(subproc_pipe, raw_buffer, RAW_BUFFER_SIZE, NULL, &subproc_read)) {\n if (GetLastError()==ERROR_NO_DATA) {\n } else if (GetLastError()==ERROR_BROKEN_PIPE) {\n subproc_has_quit();\n } else if (GetLastError()!=ERROR_IO_PENDING) {\n got_error(\"ReadFile of pipe\");\n }\n }\n}\n\nvoid set_env_var_to_menu_checked (const char *var, UINT menu_id)\n{\n if (!SetEnvironmentVariable(var, \"temporary\"))\n got_error(\"SetEnvironmentVariable(\\\"\"<<var<<\"\\\", ...)\");\n if (!SetEnvironmentVariable(var, menu_checked(win_main, menu_id)?\"1\":NULL))\n got_error(\"SetEnvironmentVariable(\\\"\"<<var<<\"\\\", ...)\");\n}\nvoid subproc_spawn (void)\n{\n PROCESS_INFORMATION piProcInfo;\n ZeroMemory(&piProcInfo, sizeof(PROCESS_INFORMATION));\n\n subproc_pipe = CreateNamedPipe(\n \"\\\\\\\\.\\\\pipe\\\\name\",\n PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED | FILE_FLAG_FIRST_PIPE_INSTANCE,\n PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT,\n 1,\n BUFFER_SIZE,\n BUFFER_SIZE,\n 0,\n NULL\n );\n if (subproc_pipe==INVALID_HANDLE_VALUE) got_error(\"Stdout pipe creation failed\\n\");\n\n // Set the bInheritHandle flag\n SECURITY_ATTRIBUTES saAttr;\n saAttr.nLength = sizeof(SECURITY_ATTRIBUTES);\n saAttr.bInheritHandle = TRUE;\n saAttr.lpSecurityDescriptor = NULL;\n\n inherited_pipe = CreateFile(\"\\\\\\\\.\\\\pipe\\\\name\", GENERIC_READ | GENERIC_WRITE, 0, &saAttr, OPEN_EXISTING, 0, NULL);\n if (inherited_pipe == INVALID_HANDLE_VALUE) got_error(\"Could not open sub_proc side of pipe\");\n\n STARTUPINFO siStartInfo;\n ZeroMemory(&siStartInfo, sizeof(STARTUPINFO));\n siStartInfo.cb = sizeof(STARTUPINFO);\n siStartInfo.hStdError = inherited_pipe;\n siStartInfo.hStdOutput = inherited_pipe;\n siStartInfo.hStdInput = inherited_pipe;\n siStartInfo.dwFlags |= STARTF_USESTDHANDLES;\n \n if (!ConnectNamedPipe(subproc_pipe,NULL) && GetLastError()!=ERROR_PIPE_CONNECTED)\n got_error(\"Could not open launcher side of pipe\");\n \n subproc_read.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);\n if (subproc_read.hEvent == NULL) got_error(\"Could not create event\");\n\n subproc_write.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);\n if (subproc_write.hEvent == NULL) got_error(\"Could not create event\");\n\n // sub_proc need not inherit our end of the pipe\n //SetHandleInformation(subproc_pipe, HANDLE_FLAG_INHERIT, 0);\n\n set_env_var_to_menu_checked(\"GRIT_GL\", MENU_GL);\n set_env_var_to_menu_checked(\"GRIT_FULLSCREEN\", MENU_FULLSCREEN);\n set_env_var_to_menu_checked(\"GRIT_DINPUT\", MENU_DINPUT);\n set_env_var_to_menu_checked(\"GRIT_NOVSYNC\", MENU_NOVSYNC);\n\n BOOL bFuncRetn = CreateProcess(NULL, cmdline,\n NULL, // process security attributes\n NULL, // primary thread security attributes\n TRUE, // handles are inherited\n CREATE_NO_WINDOW, // creation flags\n NULL, // use parent's environment\n NULL, // use parent's current directory\n &siStartInfo, // STARTUPINFO pointer\n &piProcInfo); // receives PROCESS_INFORMATION\n if (bFuncRetn == 0) got_error(\"CreateProcess failed.\");\n CloseHandle(piProcInfo.hProcess);\n CloseHandle(piProcInfo.hThread);\n\n // Close down on our side (sub_proc still has handles open)\n if (!CloseHandle(inherited_pipe)) got_error(\"Closing sub_proc_pipe failed\");\n\n subproc_running = true;\n subproc_initiate_read();\n\n Button_Enable(win_launch,FALSE);\n //Button_Enable(win_send,TRUE);\n //Edit_Enable(win_prompt,TRUE);\n EnableMenuItem(GetMenu(win_main), MENU_GL, MF_GRAYED);\n EnableMenuItem(GetMenu(win_main), MENU_FULLSCREEN, MF_GRAYED);\n EnableMenuItem(GetMenu(win_main), MENU_DINPUT, MF_GRAYED);\n EnableMenuItem(GetMenu(win_main), MENU_NOVSYNC, MF_GRAYED);\n}\n\n/*\nvoid subproc_write_line(const char *line, size_t sz)\n{\n WriteFile(subproc_pipe, line, sz, NULL, &subproc_write);\n DWORD bytes;\n BOOL r = GetOverlappedResult(subproc_pipe, &subproc_write, &bytes, TRUE);\n if (!r) got_error(\"GetOverlappedResult\");\n}\n*/\n\nvoid subproc_process_output (void)\n{\n DWORD bytes_read;\n if (GetOverlappedResult(subproc_pipe, &subproc_read, &bytes_read, TRUE)) {\n subproc_handle_output(bytes_read);\n subproc_initiate_read();\n } else {\n if (GetLastError()==ERROR_BROKEN_PIPE) {\n subproc_has_quit();\n } else {\n got_error(\"GetOverlappedResult\");\n }\n }\n}\n\nLRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) {\n int wmId = LOWORD(wParam), wmEvent = HIWORD(wParam);\n\n switch (message) {\n/*\n case WM_NOTIFY: {\n // intercept keypresses from win_prompt and use this to process tab and enter key\n if (((LPNMHDR)lParam)->code==EN_MSGFILTER && ((LPNMHDR)lParam)->hwndFrom==win_prompt) {\n MSGFILTER *mf = (MSGFILTER*) lParam;\n if (mf->msg==WM_KEYUP && mf->wParam==0xd) {\n SendMessage(win_send, BM_CLICK, 0, 0);\n SetFocus(win_prompt);\n return 1;\n } else if (mf->msg==WM_KEYDOWN && mf->wParam==0x9){\n SetFocus(win_send);\n return 1;\n }\n }\n } break;\n*/\n\n case WM_COMMAND:\n if (lParam==0 && wmEvent==0) { // menu\n switch (wmId) {\n case 101: { // save as\n OPENFILENAME fn;\n ZeroMemory(&fn,sizeof(fn));\n fn.lStructSize = sizeof (OPENFILENAME);\n fn.hwndOwner = hWnd;\n char name[1024] = \"output.txt\";\n fn.lpstrFile = name;\n fn.nMaxFile = sizeof(name);\n fn.lpstrDefExt = \"txt\";\n if(GetSaveFileName(&fn)) {\n FILE *f = fopen(name, \"w\");\n size_t textsz = 1024;\n char *buf = get_text(win_log, textsz);\n size_t written = fwrite(buf, 1, textsz, f);\n if (written!=textsz) {\n got_error(\"Could not write to file.\");\n }\n fclose(f);\n free(buf);\n }\n } return 0;\n\n case 102: // clear log\n edit_clear();\n return 0;\n\n case 103: // exit\n DestroyWindow(hWnd);\n return 0;\n\n case MENU_GL: // GL\n toggle_menu_check(hWnd, 151);\n return 0;\n\n case MENU_FULLSCREEN: // fullscreen\n toggle_menu_check(hWnd, 152);\n return 0;\n\n case MENU_DINPUT: // dinput\n toggle_menu_check(hWnd, 153);\n return 0;\n\n case MENU_NOVSYNC: // vsync\n toggle_menu_check(hWnd, 154);\n return 0;\n\n case 201: // about\n DialogBox((HINSTANCE)GetModuleHandle(NULL), MAKEINTRESOURCE(103), hWnd, AboutProc);\n return 0;\n }\n } else if ((HWND)lParam==win_launch) { // launch button\n switch (wmEvent) {\n case BN_CLICKED:\n subproc_spawn();\n return 0;\n }\n } else if ((HWND)lParam==win_log) { // log\n switch (wmEvent) {\n case EN_VSCROLL:\n test_scrolled_to_bottom();\n break;\n }\n } /*else if ((HWND)lParam==win_send) { // send button\n switch (wmEvent) {\n case BN_CLICKED: {\n size_t sz = 1024;\n char *buf = get_text(win_prompt, sz);\n subproc_write_line(buf, sz);\n subproc_write_line(\"\\n\", 1);\n free(buf);\n Edit_SetText(win_prompt, \"\");\n } return 0;\n }\n } */\n break;\n\n case WM_DESTROY:\n PostQuitMessage(0);\n return 0;\n\n case WM_SIZE: {\n int w = LOWORD(lParam), h = HIWORD(lParam);\n int bh = 24; // button height\n int bw = 128; // button width\n int p = 4; // padding\n MoveWindow(win_log, p, p, w-p-p, h-bh-p-p-p, TRUE);\n MoveWindow(win_launch, p, h-p-bh, w-p-p, bh, TRUE);\n/*\n MoveWindow(win_prompt, p, h-p-bh, w-p-p-bw-p-bw-p, bh, TRUE);\n MoveWindow(win_send, w-p-bw-p-bw, h-p-bh, bw, bh, TRUE);\n MoveWindow(win_launch, w-p-bw, h-p-bh, bw, bh, TRUE);\n*/\n if (scrolled_to_bottom)\n scroll_bottom();\n }\n\n }\n return DefWindowProc(hWnd, message, wParam, lParam);\n}\n\nint APIENTRY _tWinMain(HINSTANCE hInstance,\n HINSTANCE hPrevInstance,\n LPTSTR lpCmdLine,\n int nCmdShow)\n{\n UNREFERENCED_PARAMETER(hPrevInstance);\n\n cmdline = getenv(\"GRIT_PROCESS\");\n if (lpCmdLine && ::strcmp(lpCmdLine,\"\")) {\n cmdline = lpCmdLine;\n }\n if (cmdline == NULL) cmdline = \"Grit.dat\";\n \n InitCommonControls();\n\n WNDCLASSEX wcex;\n wcex.cbSize = sizeof(WNDCLASSEX);\n wcex.style = CS_HREDRAW | CS_VREDRAW;\n wcex.lpfnWndProc = WndProc;\n wcex.cbClsExtra = 0;\n wcex.cbWndExtra = 0;\n wcex.hInstance = hInstance;\n wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(112));\n wcex.hCursor = LoadCursor(NULL, IDC_ARROW);\n wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW);\n wcex.lpszMenuName = MAKEINTRESOURCE(110);\n wcex.lpszClassName = \"Grit Launcher\";\n wcex.hIconSm = (HICON)LoadImage(wcex.hInstance, MAKEINTRESOURCE(112), IMAGE_ICON, 16, 16, LR_DEFAULTSIZE|LR_SHARED);\n RegisterClassEx(&wcex);\n\n\n LoadLibrary(\"riched20.dll\");\n\n win_main = CreateWindow(\"Grit Launcher\", \"Grit Launcher\", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);\n if (!win_main) return FALSE;\n\n\n win_log = CreateWindow(RICHEDIT_CLASS, NULL,\n WS_GROUP | ES_MULTILINE | WS_VISIBLE | WS_CHILD | WS_BORDER | WS_VSCROLL | ES_DISABLENOSCROLL | ES_AUTOVSCROLL | ES_SUNKEN, \n 0, 0, 0, 0, win_main, NULL, hInstance, NULL);\n SendMessage(win_log, EM_LIMITTEXT, 0, LOG_LENGTH); // set char limit\n SendMessage(win_log, EM_SETEVENTMASK, 0, ENM_SCROLL);\n CHARFORMAT fmt;\n fmt.cbSize = sizeof(fmt);\n fmt.dwMask = CFM_FACE | CFM_SIZE | CFM_BOLD;\n fmt.yHeight = 20*8;\n strcpy(fmt.szFaceName,\"Lucida Console\");\n SendMessage(win_log, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&fmt);\n SendMessage(win_log, EM_SETBKGNDCOLOR, 0, RGB(20,20,20));\n set_colour(win_log, 7, false, true);\n Edit_SetReadOnly(win_log, TRUE);\n \n/*\n win_prompt = CreateWindow(RICHEDIT_CLASS, NULL,\n WS_TABSTOP | WS_VISIBLE | WS_CHILD | ES_AUTOHSCROLL | ES_SUNKEN | ES_LEFT, \n 0, 0, 0, 0, win_main, NULL, hInstance, NULL);\n SendMessage(win_prompt, EM_EXLIMITTEXT, 0, 1024*1024); // set char limit\n fmt.yHeight = 20*12;\n SendMessage(win_prompt, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&fmt);\n SendMessage(win_prompt, EM_SETEVENTMASK, 0, ENM_KEYEVENTS);\n SendMessage(win_prompt, EM_SETBKGNDCOLOR, 0, RGB(20,20,20));\n set_colour(win_prompt, 7, false, true);\n Edit_Enable(win_prompt,FALSE);\n\n win_send = CreateWindow(\"BUTTON\", \"&Send Lua\",\n WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON,\n 0, 0, 0, 0, win_main, NULL, hInstance, NULL);\n Button_Enable(win_send,FALSE);\n*/\n\n win_launch = CreateWindow(\"BUTTON\", \"&Launch\",\n WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON,\n 0, 0, 0, 0, win_main, NULL, hInstance, NULL);\n\n\n ShowWindow(win_main, nCmdShow);\n\n // Main message loop:\n bool alive = true;\n MSG msg;\n while (alive) {\n DWORD nCount = subproc_running ? 1 : 0;\n DWORD r = MsgWaitForMultipleObjectsEx(nCount, &subproc_read.hEvent, INFINITE, QS_ALLINPUT, MWMO_INPUTAVAILABLE);\n if (r>=WAIT_OBJECT_0 && r<WAIT_OBJECT_0+nCount) {\n subproc_process_output();\n } else if (r==WAIT_OBJECT_0+nCount) {\n while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {\n if (msg.message == WM_QUIT) {\n alive = false;\n break;\n }\n if (!IsDialogMessage(win_main, &msg)) {\n TranslateMessage(&msg);\n DispatchMessage(&msg);\n }\n }\n } else if (r>=WAIT_ABANDONED_0 && r<WAIT_ABANDONED_0+nCount) {\n got_error(\"wait abandoned\");\n } else if (r==WAIT_TIMEOUT) {\n got_error(\"wait timeout\");\n } else if (r==WAIT_FAILED) {\n got_error(\"wait failed\");\n } else {\n got_error(\"Unrecognised return code from MsgWaitForMultipleObjects\");\n }\n }\n\n\n\n\n return (int) msg.wParam;\n}\n" }, { "alpha_fraction": 0.5484126806259155, "alphanum_fraction": 0.5568783283233643, "avg_line_length": 32.14912414550781, "blob_id": "0b3373b6716cd5e808bbdb2c4af73f757fc87379", "content_id": "4dd1f1c981799d153a95ad0305f7444cd9de5125", "detected_licenses": [ "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer", "MIT" ], "is_generated": false, "is_vendor": false, "language": "Makefile", "length_bytes": 3780, "license_type": "permissive", "max_line_length": 104, "num_lines": 114, "path": "/dependencies/quex-0.34.1/demo/004/Makefile", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "# PURPOSE: Makefile Demo Application of Quex\n#\n# ABSOLUTELY NO WARRANTY\n#_______________________________________________________________________________\nCOMPILER = g++ # icpc # g++ \nCOMPILER_V = 4.3.1 # 10.1 # 4.3.1\nBUFFER_SIZE = 65536\nOPTIMIZATION = -O3 # -ggdb # -O3 # --coverage #-ggdb # -O1 #-pg # -O3# -pg -Os\n\n# (*) SETUP ____________________________________________________________________\nSETUP=-D'EMAIL=\"fschaef@users.sourceforge.net\"' \\\n -D'CPU_NAME=\"IntelCoreDuo\"' \\\n -D'CPU_CODE=\"T2400\"' \\\n -D'CPU_FREQ_MHZ=((float)(1833.0))' \\\n\t -D'CC_OPTIMIZATION_FLAGS=\"$(OPTIMIZATION)\"' \\\n -D'CHARACTER_SIZE=((unsigned)(1))' \\\n\t -D'OS_NAME=\"linux-2\"' \\\n\t -D'CC_NAME=\"$(COMPILER)\"' \\\n\t -D'CC_VERSION=\"$(COMPILER_V)\"' \\\n -D'QUEX_SETTING_BUFFER_SIZE=$(BUFFER_SIZE)' \\\n\t -D'NOTE=\"\"'\n\n.PHONY: clean\n\nifndef QUEX_PATH\n $(error The environment variable QUEX_PATH is not defined!)\nendif\ninclude $(QUEX_PATH)/quex/code_base/core.mkd\n\n# -- INPUT\nMODE_FILES = c.qx\n# -- FILES PRODUCED BY QUEX\nENGINE_NAME = c_lexer# NOTE: a whitespace after this name creates chaos!\nENGINE_SOURCES = $(ENGINE_NAME) \\\n $(ENGINE_NAME).cpp \\\n $(ENGINE_NAME)-token_ids \\\n\t\t $(ENGINE_NAME)-core-engine.cpp\nAPPLICATION = lexer\nSOURCE_FILES = lexer.cpp report.cpp \\\n\t\t\t $(ENGINE_NAME).cpp $(ENGINE_NAME)-core-engine.cpp\n\nOBJECT_FILES = $(SOURCE_FILES:.cpp=.o) # object file w/o line and column counting\nOBJECT_FILES_LC = $(OBJECT_FILES:.o=-lc.o) # object file w line and column counting\n\n# (*) COMPILER SETTINGS ________________________________________________________\n# (change COMPILER to whatever you use as compiler on the command line,\n# e.g. \"make COMPILER=icpc\" will use intel's c++ compiler)\nPROFILE_ACTIVATE = -fprofile-arcs -fprofile-values\nPROFILE_USE = -fbranch-probabilities\nCC = $(COMPILER) $(OPTIMIZATION) -Wno-deprecated -Wall \\\n\t -I./ -I$(QUEX_PATH) \\\n\t $(SETUP) \\\n -D__QUEX_CORE_OPTION_SUPPORT_BEGIN_OF_LINE_PRE_CONDITION_DISABLED \\\n\t -DNDEBUG \\\n -DQUEX_OPTION_ASSERTS_DISABLED\t\\\n\t -DQUEX_OPTION_AUTOMATIC_ANALYSIS_CONTINUATION_ON_MODE_CHANGE_DISABLED \\\n\t -DQUEX_BENCHMARK_SERIOUS \\\n #-DQUEX_SETTING_BUFFER_SIZE=64 \\\n\t # -D__QUEX_OPTION_UNIT_TEST \\\n # -D__QUEX_OPTION_DEBUG_STATE_TRANSITION_REPORTS \\\n # -D__QUEX_OPTION_UNIT_TEST_QUEX_BUFFER_LOADS \\\n\nLD = $(COMPILER) $(OPTIMIZATION) \n\n# (*) RULES ____________________________________________________________________\n# lexer --> application w/o line or column counting\n# lexer-lc --> application w/ line and column counting\nall: lexer lexer-lc\n\nlexer: $(OBJECT_FILES)\n\techo $(OBJECT_FILES)\n\t$(LD) $(OBJECT_FILES) -o $@ # -lgcov\n\nlexer-lc: $(OBJECT_FILES_LC)\n\t$(LD) $(OBJECT_FILES_LC) -o $@ # -lgcov\n\n# -- application\n%.o: %.cpp c_lexer\n\t$(CC) -c \\\n -DQUEX_OPTION_LINE_NUMBER_COUNTING_DISABLED \\\n -DQUEX_OPTION_COLUMN_NUMBER_COUNTING_DISABLED \\\n\t\t$< -o $@\n\n%-lc.o: %.cpp c_lexer\n\t$(CC) -c \\\n -DQUEX_OPTION_LINE_NUMBER_COUNTING \\\n -DQUEX_OPTION_COLUMN_NUMBER_COUNTING \\\n\t\t$< -o $@\n\n%.asm: %.cpp c_lexer\n\t$(CC) -S \\\n -DQUEX_OPTION_LINE_NUMBER_COUNTING_DISABLED \\\n -DQUEX_OPTION_COLUMN_NUMBER_COUNTING_DISABLED \\\n\t\t$< -o $@\n\n$(ENGINE_SOURCES): $(MODE_FILES) $(QUEX_CORE)\n\tquex -i $(MODE_FILES) --engine $(ENGINE_NAME) --token-offset 3 --no-token-queue --no-string-accumulator\n\n# (*) HELPERS __________________________________________________________________\nclean:\t\n\trm -f lexer lexer-lc\n\ttouch $(MODE_FILES)\n\trm -f $(ENGINE_SOURCES)\n\trm -f $(ENGINE_NAME).o\n\trm -f $(ENGINE_NAME)-core-engine.o\n\trm -f lexer.o\n\trm -f report.o\n\trm -f lexer\n\trm -f token_ids\n\trm -f *.bak\n\trm -f *.asm\n\trm -f *.gcno \n\trm -f *.gcda\n\trm -f *.gcov\n\n" }, { "alpha_fraction": 0.6229572892189026, "alphanum_fraction": 0.625483512878418, "avg_line_length": 39.08544158935547, "blob_id": "9db4ec9c8c842a5a5f44d0f9fa9c71a8d129613f", "content_id": "9c154c115a28f573a1f0ebe76b829703097ca81e", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 12667, "license_type": "permissive", "max_line_length": 93, "num_lines": 316, "path": "/engine/gfx/gfx_shader.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <cstdlib>\n#include <cstdint>\n\n#include <array>\n#include <map>\n#include <functional>\n#include <unordered_map>\n#include <string>\n\n#include <math_util.h>\n\n#include \"../shared_ptr.h\"\n\n#include \"gfx_gasoline.h\"\n#include \"gfx_pipeline.h\"\n#include \"gfx_texture_state.h\"\n\nclass GfxShader;\n\n// Bindings reuse the Param type as an easy way to store primitive values.\n// Textures are specified along side in a different structure.\ntypedef std::map<std::string, GfxGslParam> GfxShaderBindings;\n\n#ifndef GFX_SHADER_H\n#define GFX_SHADER_H\n\nstruct GfxPaintColour {\n Vector3 diff;\n float met; // metallic paint (0 -> 1)\n float gloss;\n float spec;\n};\n\n/** Some parameters that do not change from one object to the next, but do change from one\n * camera / target to another. */\nstruct GfxShaderGlobals {\n Vector3 camPos;\n Ogre::Matrix4 view;\n Ogre::Matrix4 invView; // For first person rendering\n Ogre::Matrix4 proj;\n Vector3 rayTopLeft;\n Vector3 rayTopRight;\n Vector3 rayBottomLeft;\n Vector3 rayBottomRight;\n Vector2 viewportDim;\n bool renderTargetFlipping;\n GfxPipeline *pipe;\n};\n\n/** Specify a viewport other than the one bound to the camera. */\nGfxShaderGlobals gfx_shader_globals_cam_ss (GfxPipeline *pipe, Ogre::Viewport *viewport);\n\n/** Use an alternative projection matrix, e.g. for screen-space effects. */\nGfxShaderGlobals gfx_shader_globals_cam (GfxPipeline *pipe, const Ogre::Matrix4 &proj);\n\nGfxShaderGlobals gfx_shader_globals_cam (GfxPipeline *pipe);\n\n// User always gives n strings, some of which can be empty.\n// E.g. dangs shader for sky is not needed (no lighting equation)\n// \n\n\n/** Represents the behavioural information provided by the user\n * (artist) for rendering a particular pass.\n *\n * From this, native shaders are generated on demand for different instantiations\n * of this shader (i.e., in different materials) and also for different purposes\n * (e.g. shadow casting vs emissive passes, etc).\n *\n * The rationale is that a material may define a Gasoline shader, but various rendering\n * ops are needed in practice to render objects using that material. So we will recompile\n * the shdaer for these various purposes when neeeded.\n */\nclass GfxShader {\n\n private:\n\n // These changed together, completely invalidate shader.\n std::string srcVertex, srcDangs, srcAdditional;\n GfxGslRunParams params;\n bool internal;\n\n\n struct Split {\n GfxGslPurpose purpose;\n GfxGslMeshEnvironment meshEnv;\n bool operator== (const Split &other) const\n {\n return other.purpose == purpose\n && other.meshEnv == meshEnv;\n }\n };\n\n struct SplitHash {\n size_t operator()(const Split &s) const\n {\n size_t r = my_hash(unsigned(s.purpose));\n r = r * 31 + my_hash(s.meshEnv);\n return r;\n }\n };\n\n struct NativePair {\n Ogre::HighLevelGpuProgramPtr vp, fp;\n };\n\n typedef std::unordered_map<Split, NativePair, SplitHash> ShaderCacheBySplit;\n\n struct GfxGslMaterialEnvironmentHash {\n size_t operator()(const GfxGslMaterialEnvironment &mat_env) const\n { return my_hash(mat_env); }\n };\n typedef std::unordered_map\n <GfxGslMaterialEnvironment, ShaderCacheBySplit, GfxGslMaterialEnvironmentHash>\n ShaderCacheByMaterial;\n\n struct GfxGslConfigEnvironmentHash {\n size_t operator()(const GfxGslConfigEnvironment &cfg_env) const\n { return my_hash(cfg_env); }\n };\n typedef std::unordered_map\n <GfxGslConfigEnvironment, ShaderCacheByMaterial, GfxGslConfigEnvironmentHash>\n ShaderCacheByConfig;\n\n ShaderCacheByConfig shaderCache;\n\n public:\n\n const std::string name;\n\n // Gasoline shaders\n GfxShader (const std::string &name,\n const GfxGslRunParams &params,\n const std::string &src_vertex,\n const std::string &src_dangs,\n const std::string &src_additional,\n bool internal)\n : name(name)\n {\n reset(params, src_vertex, src_dangs, src_additional, internal);\n }\n\n\n void reset (const GfxGslRunParams &params,\n const std::string &src_vertex,\n const std::string &src_dangs,\n const std::string &src_additional,\n bool internal);\n\n const GfxGslRunParams &getParams(void) const { return params; }\n\n\n // New API, may throw compilation errors if not checked previously.\n void bindShader (GfxGslPurpose purpose,\n const GfxGslMaterialEnvironment &mat_env,\n const GfxGslMeshEnvironment &mesh_env,\n const GfxShaderGlobals &globs,\n const Ogre::Matrix4 &world,\n const Ogre::Matrix4 *bone_world_matrixes,\n unsigned num_bone_world_matrixes,\n float fade,\n const GfxPaintColour *paint_colours, // Array of 4\n const GfxTextureStateMap &textures,\n const GfxShaderBindings &bindings);\n\n // New API, may throw compilation errors if not checked previously. (DEPRECATED)\n void bindShader (GfxGslPurpose purpose,\n bool fade_dither, bool instanced, unsigned bone_weights,\n const GfxShaderGlobals &globs,\n const Ogre::Matrix4 &world,\n const Ogre::Matrix4 *bone_world_matrixes,\n unsigned num_bone_world_matrixes,\n float fade,\n const GfxPaintColour *paint_colours, // Array of 4\n const GfxTextureStateMap &textures,\n const GfxShaderBindings &bindings);\n\n // Defaults the paint_colours for the many cases that don't use them.\n void bindShader (GfxGslPurpose purpose,\n const GfxGslMaterialEnvironment &mat_env,\n const GfxGslMeshEnvironment &mesh_env,\n const GfxShaderGlobals &globs,\n const Ogre::Matrix4 &world,\n const Ogre::Matrix4 *bone_world_matrixes,\n unsigned num_bone_world_matrixes,\n float fade,\n const GfxTextureStateMap &textures,\n const GfxShaderBindings &bindings);\n\n // Defaults the paint_colours for the many cases that don't use them. (DEPRECATED)\n void bindShader (GfxGslPurpose purpose,\n bool fade_dither, bool instanced, unsigned bone_weights,\n const GfxShaderGlobals &globs,\n const Ogre::Matrix4 &world,\n const Ogre::Matrix4 *bone_world_matrixes,\n unsigned num_bone_world_matrixes,\n float fade,\n const GfxTextureStateMap &textures,\n const GfxShaderBindings &bindings);\n\n // When the material is created (or reset)\n void initPass (Ogre::Pass *p, GfxGslPurpose purpose,\n const GfxGslMaterialEnvironment &mat_env,\n const GfxGslMeshEnvironment &mesh_env,\n const GfxTextureStateMap &textures,\n const GfxShaderBindings &bindings);\n\n // Every frame\n void updatePass (Ogre::Pass *p,\n const GfxShaderGlobals &globs,\n GfxGslPurpose purpose,\n const GfxGslMaterialEnvironment &mat_env,\n const GfxGslMeshEnvironment &mesh_env,\n const GfxTextureStateMap &textures,\n const GfxShaderBindings &bindings);\n\n void populateMatEnv (bool fade_dither,\n const GfxTextureStateMap &textures,\n const GfxShaderBindings &bindings,\n GfxGslMaterialEnvironment &mat_env);\n\n void populateMeshEnv (bool instanced, unsigned bone_weights,\n GfxGslMeshEnvironment &mesh_env);\n\n protected:\n\n NativePair getNativePair (GfxGslPurpose purpose,\n const GfxGslMaterialEnvironment &mat_env,\n const GfxGslMeshEnvironment &mesh_env);\n\n // Generic: binds uniforms (not textures, but texture indexes) for both RS and passes\n void bindGlobals (const Ogre::GpuProgramParametersSharedPtr &vparams,\n const Ogre::GpuProgramParametersSharedPtr &fparams,\n const GfxShaderGlobals &params, GfxGslPurpose purpose);\n void bindShaderParams (int counter,\n const Ogre::GpuProgramParametersSharedPtr &vparams,\n const Ogre::GpuProgramParametersSharedPtr &fparams,\n const GfxTextureStateMap &textures,\n const GfxShaderBindings &bindings);\n\n // RenderSystem bindings\n // gloal textures\n int bindGlobalTexturesRs (const GfxShaderGlobals &params, GfxGslPurpose purpose);\n // user-defined textures\n void bindShaderParamsRs (int counter, const GfxTextureStateMap &textures);\n // body stuff\n void bindBodyParamsRS (const Ogre::GpuProgramParametersSharedPtr &vparams,\n const Ogre::GpuProgramParametersSharedPtr &fparams,\n const GfxShaderGlobals &p,\n const Ogre::Matrix4 &world,\n const Ogre::Matrix4 *bone_world_matrixes,\n unsigned num_bone_world_matrixes,\n float fade,\n const GfxPaintColour *paint_colours, // Array of 4\n GfxGslPurpose purpose);\n\n // Init pass (set up everything)\n void initPassGlobalTextures (Ogre::Pass *p, GfxGslPurpose purpose);\n void initPassTextures (Ogre::Pass *p, const GfxTextureStateMap &textures);\n void initPassBodyParams (const Ogre::GpuProgramParametersSharedPtr &vparams,\n const Ogre::GpuProgramParametersSharedPtr &fparams,\n GfxGslPurpose purpose);\n\n void updatePassGlobalTextures (Ogre::Pass *p, GfxGslPurpose purpose);\n void updatePassTextures (Ogre::Pass *p, int counter, const GfxTextureStateMap &textures);\n void updatePassGlobals (const Ogre::GpuProgramParametersSharedPtr &vparams,\n const Ogre::GpuProgramParametersSharedPtr &fparams,\n const GfxShaderGlobals &params, GfxGslPurpose purpose);\n \n friend std::ostream &operator << (std::ostream &, const Split &);\n};\n\n\n// Ensure the given source code is statically correct.\nvoid gfx_shader_check (const std::string &name,\n const std::string &new_vertex_code,\n const std::string &new_dangs_code,\n const std::string &new_additional_code,\n const GfxGslRunParams &params,\n bool internal);\n\nGfxShader *gfx_shader_make_or_reset (const std::string &name,\n const std::string &new_vertex_code,\n const std::string &new_dangs_code,\n const std::string &new_additional_code,\n const GfxGslRunParams &params,\n bool internal);\n\nGfxShader *gfx_shader_get (const std::string &name);\nbool gfx_shader_has (const std::string &name);\n\nvoid gfx_shader_init (void);\nvoid gfx_shader_shutdown (void);\n\n#endif\n" }, { "alpha_fraction": 0.6958444118499756, "alphanum_fraction": 0.7055702805519104, "avg_line_length": 31.257143020629883, "blob_id": "6ba1b0386472d26d070d7685b732207cf4171e4d", "content_id": "112fed1f73f6b56e4a212b12fff3405396508ce8", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Shell", "length_bytes": 1131, "license_type": "permissive", "max_line_length": 206, "num_lines": 35, "path": "/engine/doc/grit_book/generate_doc.sh", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "#!/bin/bash\n\n# Copyright (c) François Dorval fdorval@hotmail.com and the Grit Game Engine project 2016 \n# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php\n\n# Generate Documentations from xml/*.xml\n# sudo apt-get install htmldoc python python-pip markdown\n# pip install pygments\n\n# Convert xml/*.xml to md/*.md (for README.md ) and generate single file html/complete.md\n# Convert xml/*.xml to html/*.html (for Web Site) and generate single file html/complete.html\n# Convert md/.md to md_html/*.html (test)\n# Convert html/complete.html to pdf/gritbook.pdf \n\npython2 convert_web.py\n\nmkdir -p md_html\n\nfor FILENAME in md/*.md\ndo\n HTML=\"${FILENAME##*/}\" # remove path and replace .md with .html\n HTML=\"./md_html/${HTML%.md}.html\"\n echo \"Convert $FILENAME into $HTML\"\n markdown \"$FILENAME\" >\"$HTML\" \ndone\n\ncp html/*.png md_html\n\n\ncd html\nhtmldoc --right 1.75cm --no-compression --headfootsize 9.0 --headfootfont courier --titleimage ../pdf/titleimage.png --logo ../pdf/logo.png --header \".l.\" --footer \".t1\" -f ../pdf/gritbook.pdf complete.html\ncd ..\n\n# other tests\n# wkhtmltopdf html/complete.html ../pdf/wk.pdf\n\n\n" }, { "alpha_fraction": 0.6122170686721802, "alphanum_fraction": 0.6243937015533447, "avg_line_length": 32.890411376953125, "blob_id": "dac27089562d6820e9fe8f3fcf59407fffad32dd", "content_id": "177092b5e3b67dc946b44ae3150c8d59978662f6", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 19792, "license_type": "permissive", "max_line_length": 99, "num_lines": 584, "path": "/engine/gfx/gfx_tracer_body.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to\n * deal in the Software without restriction, including without limitation the\n * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\n * sell copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n\n#include <string>\n#include <algorithm>\n#include <map>\n\n#include <console.h>\n#include <math_util.h>\n\n#include \"../vect_util.h\"\n\n#include \"gfx.h\"\n#include \"gfx_fertile_node.h\"\n#include \"gfx_internal.h\"\n#include \"gfx_tracer_body.h\"\n#include \"gfx_pipeline.h\"\n#include \"gfx_shader.h\"\n\nstatic float global_physics_time = 0;\nstatic float global_left_over_time = 0;\n\nconst std::string GfxTracerBody::className = \"GfxTracerBody\";\n\nstatic std::set<GfxTracerBody*> all_tracer_bodies;\n\nvoid GfxTracerBody::assertAlive (void) const\n{\n if (dead)\n EXCEPT << className << \" destroyed.\" << ENDL;\n}\n\nbool GfxTracerBody::isEnabled (void) const\n{\n assertAlive();\n return enabled;\n}\nvoid GfxTracerBody::setEnabled (bool v)\n{\n assertAlive();\n enabled = v;\n}\n\nVector3 GfxTracerBody::getDiffuseColour (void) const\n{\n assertAlive();\n return diffuseColour;\n}\nvoid GfxTracerBody::setDiffuseColour (const Vector3 &v)\n{\n assertAlive();\n diffuseColour = v;\n}\n\nVector3 GfxTracerBody::getEmissiveColour (void) const\n{\n assertAlive();\n return emissiveColour;\n}\nvoid GfxTracerBody::setEmissiveColour (const Vector3 &v)\n{\n assertAlive();\n emissiveColour = v;\n}\n\nfloat GfxTracerBody::getAlpha (void) const\n{\n assertAlive();\n return alpha;\n}\nvoid GfxTracerBody::setAlpha (float v)\n{\n assertAlive();\n alpha = v;\n}\n\nfloat GfxTracerBody::getFade (void) const\n{\n assertAlive();\n return fade;\n}\nvoid GfxTracerBody::setFade (float v)\n{\n assertAlive();\n fade = v;\n}\n\nfloat GfxTracerBody::getSize (void) const\n{\n assertAlive();\n return size;\n}\nvoid GfxTracerBody::setSize (float v)\n{\n assertAlive();\n size = v;\n}\n\nfloat GfxTracerBody::getLength (void) const\n{\n assertAlive();\n return length;\n}\nvoid GfxTracerBody::setLength (float v)\n{\n assertAlive();\n length = v;\n}\n\nGfxTextureDiskResource *GfxTracerBody::getTexture (void) const\n{\n assertAlive();\n return &*texture;\n}\nvoid GfxTracerBody::setTexture (const DiskResourcePtr<GfxTextureDiskResource> &v)\n{\n assertAlive();\n if (v != nullptr) {\n if (!v->isLoaded()) v->load();\n }\n texture = v;\n}\n\nGfxTracerBody::GfxTracerBody (const GfxNodePtr &par_)\n : GfxNode(par_),\n enabled(true),\n length(50),\n diffuseColour(0.5, 0.5, 0.5),\n emissiveColour(0, 0, 0),\n fade(1),\n alpha(1),\n size(0.1),\n buffer(this)\n{\n all_tracer_bodies.insert(this);\n}\n\nGfxTracerBody::~GfxTracerBody (void)\n{\n if (!dead) destroy();\n}\n\nvoid GfxTracerBody::destroy (void)\n{\n assertAlive();\n all_tracer_bodies.erase(this);\n GfxNode::destroy();\n}\n\nstatic GfxShader *shader;\nstatic GfxGslRunParams shader_params = {\n {\"gbuffer0\", GfxGslParam(GFX_GSL_FLOAT_TEXTURE2, 1, 1, 1, 1)},\n {\"texture\", GfxGslParam(GFX_GSL_FLOAT_TEXTURE2, 1, 1, 1, 1)},\n {\"total_length\", GfxGslParam::float1(0.0)},\n};\n\nvoid gfx_tracer_body_init (void)\n{\n\n // If we encoded worldspace total distance in a vertex coord, we could have a texture u\n // coordinate as well.\n std::string vertex_code =\n \"var fragment_v = vert.coord0.x;\\n\"\n \"var element_half_depth = vert.coord1.x;\\n\"\n \"var element_diffuse = vert.coord2.xyz;\\n\"\n \"var element_emissive = vert.coord3.xyz;\\n\"\n \"var element_alpha = vert.coord4.x;\\n\"\n \"var element_dist = vert.coord5.x;\\n\"\n \"var element_colour = global.particleAmbient * element_diffuse * element_alpha\\n\"\n \" + element_emissive;\\n\"\n \"out.position = vert.position.xyz;\\n\"\n \"var camera_to_fragment = out.position - global.cameraPos;\\n\"\n \"\";\n\n std::string colour_code =\n \"var uv = frag.screen / global.viewportSize;\\n\"\n \"var ray = lerp(lerp(global.rayBottomLeft, global.rayBottomRight, uv.x),\\n\"\n \" lerp(global.rayTopLeft, global.rayTopRight, uv.x),\\n\"\n \" uv.y);\\n\"\n \"uv.y = 1 - uv.y; // Textures addressed from top left, frag.screen is bottom left\\n\"\n \"var bytes = sample(mat.gbuffer0, uv).xyz;\\n\"\n \"var normalised_cam_dist = 255.0 * (256.0*256.0*bytes.x + 256.0*bytes.y + bytes.z)\\n\"\n \" / (256.0*256.0*256.0 - 1);\\n\"\n \"var scene_dist = length(normalised_cam_dist * ray);\\n\"\n \"var fragment_dist = length(camera_to_fragment);\\n\"\n \"var element_exposed_ = (scene_dist - fragment_dist + element_half_depth)\\n\"\n \" / element_half_depth;\\n\"\n \"var element_exposed = clamp(element_exposed_, 0.0, 1.0);\\n\"\n // We do not decode PMA here, because we are outputting in PMA form. We also\n // leave the user to premultiply their element_emissive by their element_alpha\n \"var texel = sample(mat.texture, Float2(0.5, fragment_v));\\n\"\n \"var cap_alpha = min(1.0, min(\\n\"\n \" element_dist / element_half_depth,\\n\"\n \" (mat.total_length - element_dist) / element_half_depth,\\n\"\n \"));\\n\"\n \"if (element_half_depth <= 0) {\\n\"\n \" cap_alpha = 1;\\n\"\n \"}\\n\"\n \"var alpha = texel.a * element_alpha * element_exposed * cap_alpha;\\n\"\n \"out.colour = texel.rgb * element_colour;\\n\"\n \"out.alpha = alpha;\\n\"\n \"out.colour = out.colour * element_exposed * cap_alpha;\\n\"\n \"\";\n\n shader = gfx_shader_make_or_reset(\"/system/Tracer\",\n vertex_code, \"\", colour_code, shader_params, true);\n\n\n}\n\nGfxTracerBody::Buffer::Buffer (const GfxTracerBody *body)\n : body(body)\n{\n // Compute elementVertexSize and initialize vertexDeclaration.\n auto *d = vertexData.vertexDeclaration;\n auto pos = Ogre::VES_POSITION;\n auto tc = Ogre::VES_TEXTURE_COORDINATES;\n elementVertexSize = 0;\n\n // position\n elementVertexSize += d->addElement(0, elementVertexSize, Ogre::VET_FLOAT3, pos).getSize();\n // texture coord\n elementVertexSize += d->addElement(0, elementVertexSize, Ogre::VET_FLOAT1, tc, 0).getSize();\n // element half depth\n elementVertexSize += d->addElement(0, elementVertexSize, Ogre::VET_FLOAT1, tc, 1).getSize();\n // diffuse\n elementVertexSize += d->addElement(0, elementVertexSize, Ogre::VET_FLOAT3, tc, 2).getSize();\n // emissive\n elementVertexSize += d->addElement(0, elementVertexSize, Ogre::VET_FLOAT3, tc, 3).getSize();\n // alpha\n elementVertexSize += d->addElement(0, elementVertexSize, Ogre::VET_FLOAT1, tc, 4).getSize();\n // distance\n elementVertexSize += d->addElement(0, elementVertexSize, Ogre::VET_FLOAT1, tc, 5).getSize();\n\n APP_ASSERT(elementVertexSize == sizeof(float) * 13);\n\n vertexData.vertexStart = 0;\n\n indexData.indexStart = 0;\n\n renderOp.vertexData = &vertexData;\n renderOp.indexData = &indexData;\n renderOp.operationType = Ogre::RenderOperation::OT_TRIANGLE_LIST;\n renderOp.useIndexes = true;\n vertexPtr = vertexPtr0 = NULL;\n indexPtr = indexPtr0 = NULL;\n maxElements = 0;\n}\n\nvoid GfxTracerBody::Buffer::beginTrace (unsigned elements)\n{\n if (elements > maxElements) {\n maxElements = elements;\n // Two vertexes per element.\n vertexBuffer = Ogre::HardwareBufferManager::getSingleton().createVertexBuffer(\n elementVertexSize, 2 * elements, Ogre::HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY);\n vertexData.vertexBufferBinding->setBinding(0, vertexBuffer);\n unsigned lines = elements - 1;\n // Two triangles (6 indexes) per line.\n indexData.indexBuffer =\n Ogre::HardwareBufferManager::getSingleton().createIndexBuffer(\n Ogre::HardwareIndexBuffer::IT_16BIT,\n 6 * lines,\n Ogre::HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY);\n }\n\n vertexPtr = vertexPtr0 = static_cast<float*>(\n vertexBuffer->lock(Ogre::HardwareBuffer::HBL_DISCARD));\n indexPtr = indexPtr0 = static_cast<uint16_t*>(\n indexData.indexBuffer->lock(Ogre::HardwareBuffer::HBL_DISCARD));\n counter = 0;\n}\n\n\nvoid GfxTracerBody::Buffer::addOnlyTwoTraceElements (const Vector3 &cam_pos,\n const Element &element0,\n const Element &element1)\n{\n // If we ever want the size to be screen-space neutral, we can only normalise the trace_ray.\n Vector3 element_to_cam = cam_pos - element0.pos;\n Vector3 trace_ray = element1.pos - element0.pos;\n Vector3 rib = element_to_cam.cross(trace_ray);\n rib.normalise();\n\n addTraceElement(element0, rib);\n addTraceElement(element1, rib);\n}\n\nvoid GfxTracerBody::Buffer::addFirstTraceElement (const Vector3 &cam_pos,\n const Element &element,\n const Element &element_next)\n{\n Vector3 element_to_cam = cam_pos - element.pos;\n Vector3 trace_ray = element_next.pos - element.pos;\n Vector3 rib = element_to_cam.cross(trace_ray);\n rib.normalise();\n\n addTraceElement(element, rib);\n lastPos = element.pos;\n}\n\nvoid GfxTracerBody::Buffer::addMiddleTraceElement (const Vector3 &cam_pos,\n const Element &element,\n const Element &element_next)\n{\n Vector3 element_to_cam = (cam_pos - element.pos);\n Vector3 trace_ray = (element_next.pos - element.pos).normalisedCopy()\n + (element.pos - lastPos).normalisedCopy();\n Vector3 rib = element_to_cam.cross(trace_ray);\n rib.normalise();\n \n addTraceElement(element, rib);\n lastPos = element.pos;\n}\n\nvoid GfxTracerBody::Buffer::addLastTraceElement (const Vector3 &cam_pos,\n const Element &element)\n{\n\n Vector3 element_to_cam = cam_pos - element.pos;\n Vector3 trace_ray = element.pos - lastPos;\n Vector3 rib = element_to_cam.cross(trace_ray);\n rib.normalise();\n \n addTraceElement(element, rib);\n}\n\nvoid GfxTracerBody::Buffer::addTraceElement (const GfxTracerBody::Element &element,\n const Vector3 &rib)\n{\n // First one has to be rendered specially.\n // Cache the previous position.\n\n Vector3 pos1 = element.pos + rib * element.size / 2;\n Vector3 pos2 = element.pos - rib * element.size / 2;\n\n // Higher counter means closer to the fresh end.\n // death ranges between 1 (dead) and 0 (alive)\n float death = (global_physics_time + global_left_over_time - element.timestamp) / body->length;\n // Convert it to a spline which is flat at death == 0 and death == 1 and smooth between.\n float trail_fade = 1 - (3 - 2 * death) * death * death;\n\n float additional_alpha = body->fade * trail_fade;\n\n *(vertexPtr++) = pos1.x;\n *(vertexPtr++) = pos1.y;\n *(vertexPtr++) = pos1.z;\n *(vertexPtr++) = 0;\n *(vertexPtr++) = element.size / 2;\n *(vertexPtr++) = element.diffuseColour.x * additional_alpha;\n *(vertexPtr++) = element.diffuseColour.y * additional_alpha;\n *(vertexPtr++) = element.diffuseColour.z * additional_alpha;\n *(vertexPtr++) = element.emissiveColour.x * additional_alpha;\n *(vertexPtr++) = element.emissiveColour.y * additional_alpha;\n *(vertexPtr++) = element.emissiveColour.z * additional_alpha;\n *(vertexPtr++) = element.alpha * additional_alpha;\n *(vertexPtr++) = element.distance;\n\n *(vertexPtr++) = pos2.x;\n *(vertexPtr++) = pos2.y;\n *(vertexPtr++) = pos2.z;\n *(vertexPtr++) = 1;\n *(vertexPtr++) = element.size / 2;\n *(vertexPtr++) = element.diffuseColour.x * additional_alpha;\n *(vertexPtr++) = element.diffuseColour.y * additional_alpha;\n *(vertexPtr++) = element.diffuseColour.z * additional_alpha;\n *(vertexPtr++) = element.emissiveColour.x * additional_alpha;\n *(vertexPtr++) = element.emissiveColour.y * additional_alpha;\n *(vertexPtr++) = element.emissiveColour.z * additional_alpha;\n *(vertexPtr++) = element.alpha * additional_alpha;\n *(vertexPtr++) = element.distance;\n\n if (counter > 0) {\n // a-------------c\n // b-------------d\n int a = 2 * counter - 2;\n int b = 2 * counter - 1;\n int c = 2 * counter + 0;\n int d = 2 * counter + 1;\n *(indexPtr++) = a;\n *(indexPtr++) = b;\n *(indexPtr++) = d;\n *(indexPtr++) = a;\n *(indexPtr++) = d;\n *(indexPtr++) = c;\n }\n\n counter++;\n}\n\nvoid GfxTracerBody::Buffer::endTrace (void)\n{\n vertexBuffer->unlock();\n indexData.indexBuffer->unlock();\n vertexData.vertexCount = counter * 2;\n indexData.indexCount = (counter - 1) * 6;\n unsigned vertex_floats = elementVertexSize / sizeof(float);\n APP_ASSERT(size_t(vertexPtr - vertexPtr0) == vertexData.vertexCount * vertex_floats);\n APP_ASSERT(size_t(indexPtr - indexPtr0) == indexData.indexCount);\n}\n\nvoid GfxTracerBody::render (const GfxPipeline *pipe, const GfxShaderGlobals &globs)\n{\n if (!enabled) return;\n if (dead) return;\n\n const CameraOpts &cam_opts = pipe->getCameraOpts();\n const Vector3 &cam_pos = cam_opts.pos;\n\n // PREPARE BUFFER\n\n // Add on the interpolated one. It will be removed after we have generated geometry.\n bool remove = false;\n if (global_left_over_time > 0 && elements.size() >= 2) {\n const Element &last1 = elements[elements.size() - 2];\n const Element &last2 = elements[elements.size() - 1];\n float interval_secs = last2.timestamp - last1.timestamp;\n if (interval_secs > 0) {\n Vector3 vel = (last2.pos - last1.pos) / interval_secs;\n elements.emplace_back(last2);\n elements.back().pos += global_left_over_time * vel;\n elements.back().timestamp += global_left_over_time;\n remove = true;\n } else {\n // We could potentially look back further in the buffer to try and interpolate\n // but I'm not sure if this case will arise sufficiently often to warrant\n // that complexity.\n }\n }\n \n\n // Trim the vector to only the live elements, and mark which ones we're actually going to\n // render.\n float age_limit = global_physics_time + global_left_over_time - length;\n unsigned start = 0;\n while (start < elements.size() && elements[start].timestamp < age_limit) start++;\n unsigned last_not_skipped = 0; // Index of the last element we render.\n unsigned elements_not_skipped = 0; // Number of elements to render.\n float distance = 0;\n const Vector3 *last_pos = nullptr;\n for (unsigned i = start; i < elements.size() ; ++i) {\n unsigned counter = i - start;\n if (counter > 0) {\n distance += (elements[i].pos - *last_pos).length();\n }\n elements[i].distance = distance;\n last_pos = &elements[i].pos;\n\n elements[counter] = elements[i];\n if (i > start\n && (elements[counter].pos - elements[last_not_skipped].pos).length2() < 0.000001) {\n elements[counter].skip = true;\n } else {\n elements[counter].skip = false;\n elements_not_skipped++;\n last_not_skipped = counter;\n }\n }\n elements.resize(elements.size() - start);\n\n if (elements_not_skipped <= 1) return;\n\n buffer.beginTrace(elements_not_skipped);\n if (elements_not_skipped == 2) {\n unsigned curr = 0;\n unsigned next;\n for (next = curr + 1 ; elements[next].skip ; next++);\n buffer.addOnlyTwoTraceElements(cam_pos, elements[curr], elements[next]);\n } else {\n unsigned curr;\n for (curr = 0 ; elements[curr].skip ; curr++);\n unsigned next;\n for (next = curr + 1 ; elements[next].skip ; next++);\n buffer.addFirstTraceElement(cam_pos, elements[curr], elements[next]);\n do {\n curr = next;\n for (next = curr + 1 ; elements[next].skip ; next++);\n buffer.addMiddleTraceElement(cam_pos, elements[curr], elements[next]);\n } while (next < last_not_skipped);\n buffer.addLastTraceElement(cam_pos, elements[next]);\n }\n \n buffer.endTrace();\n\n // Remove interpolated element.\n if (remove && elements.size() > 0)\n elements.pop_back();\n\n\n // ISSUE RENDER COMMANDS\n try {\n GfxTextureStateMap texs;\n // Bind this manually underneath as it is an Ogre internal texture.\n texs[\"gbuffer0\"] = gfx_texture_state_point(nullptr);\n if (texture != nullptr)\n texs[\"texture\"] = gfx_texture_state_anisotropic(&*texture, GFX_AM_CLAMP);\n\n const Ogre::Matrix4 &I = Ogre::Matrix4::IDENTITY;\n\n GfxGslRunParams bindings;\n bindings[\"total_length\"] = GfxGslParam::float1(distance);\n\n // We may use a special tracer \"purpose\" in future but this works for now.\n shader->bindShader(GFX_GSL_PURPOSE_HUD, false, false, 0,\n globs, I, nullptr, 0, 1, texs, bindings);\n\n // Manual bind as it is an Ogre internal texture.\n ogre_rs->_setTexture(NUM_GLOBAL_TEXTURES_NO_LIGHTING, true, pipe->getGBufferTexture(0));\n\n\n ogre_rs->_render(buffer.getRenderOperation());\n\n ogre_rs->_disableTextureUnit(0);\n ogre_rs->_disableTextureUnit(1);\n\n } catch (const Exception &e) {\n CERR << \"Rendering tracer, got: \" << e << std::endl;\n } catch (const Ogre::Exception &e) {\n CERR << \"Rendering tracer, got: \" << e.getDescription() << std::endl;\n }\n}\n\nvoid GfxTracerBody::pump (void)\n{\n if (dead) return;\n\n Vector3 pos = getWorldTransform() * Vector3(0, 0, 0);\n\n elements.emplace_back(\n diffuseColour, emissiveColour, alpha, size, pos, global_physics_time);\n}\n\n\nvoid gfx_tracer_body_set_left_over_time (float left_over_time)\n{\n global_left_over_time = left_over_time;\n}\n\nvoid gfx_tracer_body_render (GfxPipeline *pipe)\n{\n GfxShaderGlobals globals = gfx_shader_globals_cam(pipe);\n\n ogre_rs->_setCullingMode(Ogre::CULL_NONE);\n // Tracers behind walls will still be drawn, but will be attenuated.\n // It is probably possible to use the depth buffer for cases where the tracer is very\n // far behind the wall, depending on the max 'size' attribute of trace elements in the\n // buffer.\n ogre_rs->_setDepthBufferParams(false, false, Ogre::CMPF_LESS_EQUAL);\n ogre_rs->_setSceneBlending(Ogre::SBF_ONE, Ogre::SBF_ONE_MINUS_SOURCE_ALPHA);\n ogre_rs->_setPolygonMode(Ogre::PM_SOLID);\n ogre_rs->setStencilCheckEnabled(false);\n ogre_rs->_setDepthBias(0, 0);\n\n for (GfxTracerBody *body : all_tracer_bodies) {\n body->render(pipe, globals);\n }\n\n}\n\nvoid gfx_tracer_body_pump (float elapsed)\n{\n global_physics_time += elapsed;\n for (GfxTracerBody *body : all_tracer_bodies) {\n body->pump();\n }\n}\n" }, { "alpha_fraction": 0.667432963848114, "alphanum_fraction": 0.6735632419586182, "avg_line_length": 31.830188751220703, "blob_id": "d923fc8b54c052714ac3d14504d31b26fae50619", "content_id": "5bf539097fcfd45141c2c0750cd8babea987afbb", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 5220, "license_type": "permissive", "max_line_length": 124, "num_lines": 159, "path": "/engine/gfx/gfx_node.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include \"../shared_ptr.h\"\n\nclass GfxNode;\nclass GfxFertileNode;\ntypedef SharedPtr<GfxFertileNode> GfxNodePtr;\n\n#ifndef GfxLeaf_h\n#define GfxLeaf_h\n\n#include <math_util.h>\n\n#include \"../vect_util.h\"\n\n#include \"gfx_internal.h\"\n\n// TERMINOLOGY:\n// A GfxNode is something that can be a leaf. Everything in the tree is GfxNode.\n// A GfxFertileNode is something that can be a parent. All GfxFertileNode are also GfxNode.\n// Objects should typically extend GfxFertileNode so they can have children attached.\n// Objects that do not exist in the Ogre scene graph are currenty not GfxFertileNode since they have no internal scene node.\n\n/* A \"scenegraph\" implementation (really a tree) where each node has a corresponding\n * Ogre::SceneNode, however those nodes are all immediately beneath the Ogre::Root node. Our\n * scenegraph uses the Grit Transform struct which has correct handling of non-uniform scaling\n * (where !(x == y == z)).\n */\nclass GfxNode : public fast_erase_index {\n protected:\n static const std::string className;\n Vector3 localPos, localScale;\n Quaternion localOrientation;\n Transform worldTransform;\n /* dirtyWorldTransform is commented out because that implementation did not dirty children when\n * the parent's localTransform was updated. The current implementation updates the world\n * transform every time, which is inefficient because we might make many changes to individual\n * nodes of the tree without needing to know the intermediate derived transforms.\n */\n //bool dirtyWorldTransform;\n GfxNodePtr par;\n std::string parentBoneName;\n int parentBoneId; // Will be >= 0 if parent != null and parentBoneName != \"\"\n Ogre::SceneNode *node;\n bool dead;\n\n Ogre::Matrix4 toOgre (void) {\n Ogre::Matrix4 m;\n for (int col=0 ; col<3 ; ++col) {\n for (int row=0 ; row<3 ; ++row) {\n m[row][col] = worldTransform.mat[row][col];\n }\n }\n m[0][3] = worldTransform.pos.x;\n m[1][3] = worldTransform.pos.y;\n m[2][3] = worldTransform.pos.z;\n m[3][0] = m[3][1] = m[3][2] = 0;\n m[3][3] = 1;\n return m;\n }\n\n GfxNode (const GfxNodePtr &par_);\n virtual ~GfxNode ();\n\n void notifyParentDead (void);\n void ensureNotChildOf (GfxFertileNode *node) const;\n\n void doUpdateWorldTransform (void);\n void updateParentBoneId (void);\n\n void ensureAlive (void) const { if (dead) THROW_DEAD(className); }\n\n public:\n\n void updateWorldTransform (void) {\n /*if (dirtyWorldTransform)*/ doUpdateWorldTransform();\n }\n\n const GfxNodePtr &getParent (void) const { ensureAlive(); return par; }\n virtual void setParent (const GfxNodePtr &par_);\n\n const std::string &getParentBoneName (void) const\n {\n ensureAlive();\n return parentBoneName;\n }\n virtual void setParentBoneName (const std::string &s)\n {\n ensureAlive();\n parentBoneName = s;\n updateParentBoneId();\n }\n\n const Vector3 &getLocalPosition (void) const\n {\n ensureAlive();\n return localPos;\n }\n const Quaternion &getLocalOrientation (void) const\n {\n ensureAlive();\n return localOrientation;\n }\n const Vector3 &getLocalScale (void) const\n {\n ensureAlive();\n return localScale;\n }\n void setLocalPosition (const Vector3 &v)\n {\n ensureAlive();\n localPos = v;\n //dirtyWorldTransform = true;\n }\n void setLocalOrientation (const Quaternion &v)\n {\n ensureAlive();\n localOrientation = v;\n //dirtyWorldTransform = true;\n }\n void setLocalScale (const Vector3 &v)\n {\n ensureAlive();\n localScale = v;\n //dirtyWorldTransform = true;\n }\n Transform getWorldTransform (void)\n {\n ensureAlive();\n updateWorldTransform();\n return worldTransform;\n }\n\n virtual void destroy (void);\n virtual bool destroyed (void) const { return dead; }\n\n friend class GfxFertileNode; // otherwise it cannot access our protected stuff\n};\n\n#endif\n" }, { "alpha_fraction": 0.550628662109375, "alphanum_fraction": 0.5583822131156921, "avg_line_length": 34.6651725769043, "blob_id": "e818e69a8c2392f14b631ab798deec8bf6ce22d3", "content_id": "f8c5095532d9a7eb28de447dd0089142020f279b", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 23860, "license_type": "permissive", "max_line_length": 101, "num_lines": 669, "path": "/engine/gfx/clutter.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include \"../main.h\"\n#include \"gfx.h\"\n\n\n////////////////////////////////////////////////////////////////////////////////////////////////////\n// ClutterBuffer ///////////////////////////////////////////////////////////////////////////////////\n////////////////////////////////////////////////////////////////////////////////////////////////////\n\nClutterBuffer::ClutterBuffer (Ogre::MovableObject *mobj, unsigned triangles, bool tangents)\n : mMovableObject(mobj), mTriangles(triangles), mTangents(tangents)\n{\n}\n\nClutterBuffer::~ClutterBuffer (void)\n{\n for (SectionMap::iterator i=sects.begin(),i_=sects.end() ; i!=i_ ; ++i) {\n delete i->second;\n }\n}\n\nstatic Ogre::MaterialPtr mat_from_submesh (const Ogre::MeshPtr &mesh,\n Ogre::SubMesh *sm, bool err=false)\n{\n std::string name = sm->getMaterialName();\n name += \"&\"; // use a different material (in order to get a different shader)\n Ogre::MaterialPtr m = Ogre::MaterialManager::getSingleton().getByName(name, \"GRIT\");\n if (m.isNull()) {\n if (err) {\n CERR << \"Material not found: \\\"\" << sm->getMaterialName() << \"\\\" \"\n << \"in mesh \\\"\" << mesh->getName() << \"\\\"\" << std::endl;\n }\n m = Ogre::MaterialManager::getSingleton().getByName(\"/system/FallbackMaterial&\", \"GRIT\");\n }\n return m;\n}\n\nClutterBuffer::MTicket ClutterBuffer::reserveGeometry (const Ogre::MeshPtr &mesh)\n{\n mesh->load();\n for (int i=0 ; i<mesh->getNumSubMeshes() ; ++i) {\n Ogre::SubMesh *sm = mesh->getSubMesh(i);\n APP_ASSERT(sm->operationType == Ogre::RenderOperation::OT_TRIANGLE_LIST);\n Ogre::MaterialPtr m = mat_from_submesh(mesh,sm,true);\n getOrCreateSection(m);\n }\n Section::MTicket *stkts = new Section::MTicket[mesh->getNumSubMeshes()]();\n for (int i=0 ; i<mesh->getNumSubMeshes() ; ++i) {\n Ogre::SubMesh *sm = mesh->getSubMesh(i);\n Ogre::MaterialPtr m = mat_from_submesh(mesh,sm);\n Section &s = getOrCreateSection(m);\n stkts[i] = s.reserveGeometry(sm);\n if (!stkts[i].valid()) {\n releaseGeometry(stkts, mesh);\n return MTicket(mesh, NULL);\n }\n }\n return MTicket(mesh, stkts);\n}\n\nvoid ClutterBuffer::releaseGeometry (Section::MTicket *stkts, const Ogre::MeshPtr &mesh)\n{\n for (int i=0 ; i<mesh->getNumSubMeshes() ; ++i) {\n Ogre::SubMesh *sm = mesh->getSubMesh(i);\n Ogre::MaterialPtr m = mat_from_submesh(mesh,sm);\n Section &s = getOrCreateSection(m);\n Section::MTicket t2 = stkts[i];\n if (t2.valid()) { // it will only be invalid if we aborted half way through construction\n s.releaseGeometry(t2, sm);\n }\n }\n delete [] stkts;\n}\n\nvoid ClutterBuffer::releaseGeometry (MTicket &t)\n{\n if (!t.valid()) return;\n releaseGeometry(t.ts, t.mesh);\n}\n\nvoid ClutterBuffer::updateGeometry (const MTicket &t,\n const Ogre::Vector3 &position,\n const Ogre::Quaternion &orientation,\n float vis)\n{\n for (int i=0 ; i<t.mesh->getNumSubMeshes() ; ++i) {\n Ogre::SubMesh *sm = t.mesh->getSubMesh(i);\n Ogre::MaterialPtr m = mat_from_submesh(t.mesh,sm);\n Section &s = getOrCreateSection(m);\n s.updateGeometry(t.ts[i], sm, position, orientation, vis);\n }\n}\n\nClutterBuffer::QTicket ClutterBuffer::reserveQuad (const Ogre::MaterialPtr &m)\n{\n Section &s = getOrCreateSection(m);\n return QTicket(m, s.reserveQuad());\n}\n\nvoid ClutterBuffer::releaseQuad (QTicket &t)\n{\n Section &s = getOrCreateSection(t.m);\n s.releaseQuad(t.t);\n}\n\nvoid ClutterBuffer::updateQuad (const QTicket &t,\n const Ogre::Vector3 (&pos)[4],\n const Ogre::Vector3 (&norm)[4],\n const Ogre::Vector2 (&uv)[4],\n const Ogre::Vector3 (*tang)[4],\n float vis)\n\n{\n Section &s = getOrCreateSection(t.m);\n s.updateQuad(t.t, pos, norm, uv, tang, vis);\n}\n\n\n\n\n////////////////////////////////////////////////////////////////////////////////////////////////////\n// ClutterBuffer::Section //////////////////////////////////////////////////////////////////////////\n////////////////////////////////////////////////////////////////////////////////////////////////////\n\n// what would it take, for triangles to be automatic\n// * recreate HWVB\n// * copy data from old to new (probably easy because cached in 'data')\n// what would it take, for tangents to be automatic\n// * the above points\n// * change vertex declaration\n\nClutterBuffer::Section::Section (ClutterBuffer *parent, unsigned triangles,\n const Ogre::MaterialPtr &m)\n{\n mParent = parent;\n mMaterial = m;\n APP_ASSERT(!m.isNull());\n marker = 0;\n\n mRenderOperation.useIndexes = false;\n mRenderOperation.vertexData = &mVertexData;\n mRenderOperation.operationType = Ogre::RenderOperation::OT_TRIANGLE_LIST;\n\n mDeclSize = 0;\n mVertexData.vertexDeclaration->addElement(0, mDeclSize, Ogre::VET_FLOAT3, Ogre::VES_POSITION);\n mDeclSize += Ogre::VertexElement::getTypeSize(Ogre::VET_FLOAT3);\n mVertexData.vertexDeclaration->addElement(0, mDeclSize, Ogre::VET_FLOAT3, Ogre::VES_NORMAL);\n mDeclSize += Ogre::VertexElement::getTypeSize(Ogre::VET_FLOAT3);\n mVertexData.vertexDeclaration->addElement(0, mDeclSize, Ogre::VET_FLOAT2,\n Ogre::VES_TEXTURE_COORDINATES);\n mDeclSize += Ogre::VertexElement::getTypeSize(Ogre::VET_FLOAT2);\n mVertexData.vertexDeclaration->addElement(0, mDeclSize, Ogre::VET_FLOAT1,\n Ogre::VES_TEXTURE_COORDINATES,1);\n mDeclSize += Ogre::VertexElement::getTypeSize(Ogre::VET_FLOAT1);\n if (mParent->mTangents) {\n mVertexData.vertexDeclaration->addElement(0, mDeclSize, Ogre::VET_FLOAT3,Ogre::VES_TANGENT);\n mDeclSize += Ogre::VertexElement::getTypeSize(Ogre::VET_FLOAT3);\n }\n\n // Make the vertex buffer larger if estimated vertex count higher\n // to allow for user-configured growth area\n Ogre::HardwareVertexBufferSharedPtr vbuf =\n Ogre::HardwareBufferManager::getSingleton().createVertexBuffer(\n mDeclSize, 3*triangles,\n Ogre::HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY);\n\n mVertexData.vertexBufferBinding->setBinding(0, vbuf);\n\n usage.resize(triangles);\n data.resize(3*triangles*mDeclSize);\n vbuf->writeData(0, 3*triangles*mDeclSize, &data[0]);\n first = 0;\n last = 0;\n usedTriangles = 0;\n \n //mVertexData.vertexCount = 3*triangles;\n updateFirstLast();\n}\n\nClutterBuffer::Section::~Section (void)\n{\n}\n\nvoid ClutterBuffer::Section::updateFirstLast (void)\n{\n if (first == last && last == 0) {\n mVertexData.vertexStart = 0;\n mVertexData.vertexCount = 0;\n } else {\n mVertexData.vertexStart = first * 3;\n mVertexData.vertexCount = (last-first+1) * 3;\n }\n}\n\nvoid ClutterBuffer::Section::reserveTriangles (unsigned triangles, unsigned &off, unsigned &len)\n{\n if (usedTriangles==usage.size()) {\n len = 0;\n return;\n }\n // do a linear search to find a free block of size 'triangles'\n unsigned found = 0;\n for (unsigned i=0 ; i<usage.size() ; ++i) {\n if (marker == usage.size()) {\n found = 0;\n marker = 0;\n }\n bool tri_used = usage[marker++];\n if (tri_used) {\n found = 0;\n } else {\n found++;\n if (found==triangles) break;\n }\n }\n len = found;\n off = marker-found;\n for (unsigned j=off ; j<marker ; ++j) {\n usage[j] = true;\n }\n if (off<first) {\n first = off;\n }\n if (marker-1>last) {\n last = marker-1;\n }\n updateFirstLast();\n usedTriangles += len;\n}\n\nvoid ClutterBuffer::Section::releaseTriangles (unsigned off, unsigned len)\n{\n usedTriangles -= len;\n for (unsigned o=off ; o<off+len ; ++o) {\n usage[o] = false;\n }\n while (usage[last] == false) {\n if (last==0) {\n break;\n }\n last--;\n }\n while (usage[first] == false) {\n if (first>=last) {\n first = 0;\n break;\n }\n first++;\n }\n updateFirstLast();\n memset(&data[3*mDeclSize*off], 0, 3*mDeclSize*len);\n mVertexData.vertexBufferBinding->getBuffer(0)\n ->writeData(off*3*mDeclSize, len*3*mDeclSize, &data[off*3*mDeclSize]);\n}\n\n\n\nClutterBuffer::Section::MTicket ClutterBuffer::Section::reserveGeometry (Ogre::SubMesh *sm)\n{\n\n Ogre::IndexData* idata = sm->indexData;\n unsigned triangles = idata->indexCount / 3u;\n unsigned off, len;\n reserveTriangles(triangles, off, len);\n if (len==0) return MTicket();\n APP_ASSERT(len == triangles);\n return MTicket (off);\n}\n\nvoid ClutterBuffer::Section::releaseGeometry (MTicket &t, Ogre::SubMesh *sm)\n{\n Ogre::IndexData* idata = sm->indexData;\n int triangles = idata->indexCount / 3;\n releaseTriangles(t.offset, triangles);\n t.offset= 0xFFFFFFFF;\n}\n\nvoid ClutterBuffer::Section::updateGeometry (const MTicket &t,\n const Ogre::SubMesh *sm,\n const Ogre::Vector3 &position,\n const Ogre::Quaternion &orientation,\n float vis)\n{\n Ogre::IndexData* idata = sm->indexData;\n unsigned triangles = idata->indexCount / 3;\n Ogre::VertexData* vdata = sm->useSharedVertices ? sm->parent->sharedVertexData\n : sm->vertexData;\n Ogre::VertexDeclaration *vdecl = vdata->vertexDeclaration;\n\n const Ogre::VertexElement *vel_pos = vdecl->findElementBySemantic(Ogre::VES_POSITION);\n APP_ASSERT(vel_pos->getType() == Ogre::VET_FLOAT3);\n const Ogre::VertexElement *vel_norm = vdecl->findElementBySemantic(Ogre::VES_NORMAL);\n APP_ASSERT(vel_norm->getType() == Ogre::VET_FLOAT3);\n const Ogre::VertexElement *vel_uv= vdecl->findElementBySemantic(Ogre::VES_TEXTURE_COORDINATES);\n APP_ASSERT(vel_uv->getType() == Ogre::VET_FLOAT2);\n const Ogre::VertexElement *vel_tang = NULL; //initialise to avoid warning\n if (mParent->mTangents) {\n vel_tang = vdecl->findElementBySemantic (Ogre::VES_TANGENT);\n APP_ASSERT(vel_tang==NULL || vel_tang->getType()==Ogre::VET_FLOAT3);\n }\n\n\n Ogre::VertexBufferBinding *vbind = vdata->vertexBufferBinding;\n\n APP_ASSERT(1==vbind->getBufferCount());\n\n const Ogre::HardwareIndexBufferSharedPtr &ibuf = idata->indexBuffer;\n const Ogre::HardwareVertexBufferSharedPtr &vbuf = vbind->getBuffer(0);\n\n APP_ASSERT(ibuf->getType() == Ogre::HardwareIndexBuffer::IT_16BIT);\n\n const char *the_vbuf = (const char*)vbuf->lock(Ogre::HardwareBuffer::HBL_READ_ONLY);\n const unsigned short *the_ibuf =\n (const unsigned short*)ibuf->lock(Ogre::HardwareBuffer::HBL_READ_ONLY);\n\n\n for (unsigned i=0 ; i<3*triangles ; ++i) {\n unsigned index = the_ibuf[idata->indexStart + i];\n unsigned vo = (index + vdata->vertexStart) * vdecl->getVertexSize(0);\n\n Ogre::Vector3 pos;\n memcpy(&pos.x, &the_vbuf[vo + vel_pos->getOffset()], vel_pos->getSize());\n pos = orientation * pos + position;\n\n Ogre::Vector3 norm;\n memcpy(&norm.x, &the_vbuf[vo + vel_norm->getOffset()], vel_norm->getSize());\n norm = orientation * norm;\n\n Ogre::Vector3 tang = Ogre::Vector3(0,0,0);\n if (vel_tang!=NULL) {\n memcpy(&tang.x, &the_vbuf[vo + vel_tang->getOffset()], vel_tang->getSize());\n tang = orientation * tang;\n }\n\n Ogre::Vector2 uv;\n memcpy(&uv.x, &the_vbuf[vo + vel_uv->getOffset()], vel_uv->getSize());\n\n unsigned vi = (i + t.offset*3) * mDeclSize;\n memcpy(&data[vi + 0*sizeof(float)], &pos.x, 3*sizeof(float));\n memcpy(&data[vi + 3*sizeof(float)], &norm.x, 3*sizeof(float));\n memcpy(&data[vi + 6*sizeof(float)], &uv.x, 2*sizeof(float));\n memcpy(&data[vi + 8*sizeof(float)], &vis, 1*sizeof(float));\n if (mParent->mTangents) {\n memcpy(&data[vi + 9*sizeof(float)], &tang.x, 3*sizeof(float));\n }\n }\n\n vbuf->unlock();\n ibuf->unlock();\n\n mVertexData.vertexBufferBinding->getBuffer(0)\n ->writeData(t.offset*3*mDeclSize, triangles*3*mDeclSize, &data[t.offset*3*mDeclSize]);\n}\n\n\n\nClutterBuffer::Section::QTicket ClutterBuffer::Section::reserveQuad (void)\n{\n unsigned off, len;\n reserveTriangles(2, off, len);\n if (len==0) return QTicket();\n return QTicket(off);\n}\n\nvoid ClutterBuffer::Section::releaseQuad (QTicket &t)\n{\n releaseTriangles(t.offset,2);\n t.offset = 0xFFFFFFFF;\n}\n\nvoid ClutterBuffer::Section::updateQuad (const QTicket &t,\n const Ogre::Vector3 (&pos)[4],\n const Ogre::Vector3 (&norm)[4],\n const Ogre::Vector2 (&uv)[4],\n const Ogre::Vector3 (*tang)[4],\n float vis)\n{\n const int idxs[6] = { 0, 3, 1, 0, 2, 3 };\n if (mParent->mTangents) {\n APP_ASSERT(mDeclSize == 12*sizeof(float));\n } else {\n APP_ASSERT(mDeclSize == 9*sizeof(float));\n }\n for (unsigned i=0 ; i<6 ; ++i) {\n unsigned vi = (i + t.offset*3) * mDeclSize;\n //std::cout << t.offset << \" \" << vi << std::endl;\n memcpy(&data[vi + 0*sizeof(float)], &pos[idxs[i]].x, 3*sizeof(float));\n memcpy(&data[vi + 3*sizeof(float)], &norm[idxs[i]].x, 3*sizeof(float));\n memcpy(&data[vi + 6*sizeof(float)], &uv[idxs[i]].x, 2*sizeof(float));\n memcpy(&data[vi + 8*sizeof(float)], &vis, 1*sizeof(float));\n if (mParent->mTangents) {\n memcpy(&data[vi + 9*sizeof(float)], &(*tang)[idxs[i]].x, 3*sizeof(float));\n }\n }\n\n mVertexData.vertexBufferBinding->getBuffer(0)\n ->writeData(t.offset*3*mDeclSize, 2*3*mDeclSize, &data[t.offset*3*mDeclSize]);\n}\n\nvoid ClutterBuffer::Section::accumulateUtilisation (size_t &used, size_t &rendered, size_t &total)\n{\n used += usedTriangles;\n rendered += (last==0 && first==0) ? 0 : (last-first+1);\n total += usage.size();\n}\n\ntypedef ClutterBuffer::SectionMap::const_iterator I;\n\nvoid ClutterBuffer::getUtilisation (size_t &used, size_t &rendered, size_t &total)\n{\n for (I i=sects.begin(),i_=sects.end() ; i!=i_ ; ++i) {\n Section &s = *i->second;\n s.accumulateUtilisation(used,rendered,total);\n }\n}\n\n\n\n\n\n////////////////////////////////////////////////////////////////////////////////////////////////////\n// MovableClutter //////////////////////////////////////////////////////////////////////////////////\n////////////////////////////////////////////////////////////////////////////////////////////////////\n\nvoid MovableClutter::visitRenderables (Ogre::Renderable::Visitor *visitor, bool debug)\n{\n (void) debug;\n for (I i=clutter.getSections().begin(),i_=clutter.getSections().end() ; i!=i_ ; ++i) {\n visitor->visit(i->second, 0, false);\n }\n}\n\n\nvoid MovableClutter::_updateRenderQueue (Ogre::RenderQueue *queue)\n{\n for (I i=clutter.getSections().begin(),i_=clutter.getSections().end() ; i!=i_ ; ++i) {\n ClutterBuffer::Section &s = *i->second;\n if (s.getRenderOperation()->vertexData->vertexCount == 0) return;\n\n if (mRenderQueuePrioritySet) {\n assert(mRenderQueueIDSet == true);\n queue->addRenderable(&s, mRenderQueueID,\n mRenderQueuePriority);\n } else if (mRenderQueueIDSet) {\n queue->addRenderable(&s, mRenderQueueID,\n queue->getDefaultRenderablePriority());\n } else {\n queue->addRenderable(&s, queue->getDefaultQueueGroup(),\n queue->getDefaultRenderablePriority());\n }\n }\n}\n\n\n\n\n////////////////////////////////////////////////////////////////////////////////////////////////////\n// MovableClutterFactory ///////////////////////////////////////////////////////////////////////////\n////////////////////////////////////////////////////////////////////////////////////////////////////\n\nOgre::MovableObject* MovableClutterFactory::createInstanceImpl (\n const Ogre::String& name, const Ogre::NameValuePairList* params)\n{\n Ogre::NameValuePairList::const_iterator ni;\n\n if (params==NULL || (ni = params->find(\"triangles\"))==params->end())\n GRIT_EXCEPT(\"Must give triangles when creating MovableClutter object\");\n unsigned triangles = atoi(ni->second.c_str());\n\n bool tangents = false; // optional\n if (params!=NULL && (ni = params->find(\"tangents\"))!=params->end()) {\n tangents = ni->second == \"true\";\n }\n\n // must have mesh parameter\n return OGRE_NEW MovableClutter(name, triangles, tangents);\n}\n\n\nvoid MovableClutterFactory::destroyInstance (Ogre::MovableObject* obj)\n{\n OGRE_DELETE obj;\n}\n\n\n////////////////////////////////////////////////////////////////////////////////////////////////////\n// RangedClutter ///////////////////////////////////////////////////////////////////////////////////\n////////////////////////////////////////////////////////////////////////////////////////////////////\n\ntypedef ClutterBuffer::SectionMap::const_iterator I;\n\nfloat RangedClutter::Item::calcFade (float range2)\n{\n const float out = streamer_fade_out_factor;\n float range = ::sqrtf(range2);\n \n float fade = 1.0; \n\n if (range > out) {\n fade = (1-range) / (1-out);\n } \n\n return fade;\n}\n\nvoid RangedClutter::visitRenderables (Ogre::Renderable::Visitor *visitor, bool debug)\n{\n (void) debug;\n for (I i=mClutter.getSections().begin(),i_=mClutter.getSections().end() ; i!=i_ ; ++i) {\n visitor->visit(i->second, 0, false);\n }\n}\n\nvoid RangedClutter::registerMe (void)\n{\n streamer_callback_register(this);\n}\n\nvoid RangedClutter::unregisterMe (void)\n{\n streamer_callback_unregister(this);\n}\n\nvoid RangedClutter::_updateRenderQueue (Ogre::RenderQueue *queue)\n{\n for (I i=mClutter.getSections().begin(),i_=mClutter.getSections().end() ; i!=i_ ; ++i) {\n ClutterBuffer::Section &s = *i->second;\n if (s.getRenderOperation()->vertexData->vertexCount == 0) return;\n\n if (mRenderQueuePrioritySet) {\n assert(mRenderQueueIDSet == true);\n queue->addRenderable(&s, mRenderQueueID,\n mRenderQueuePriority);\n } else if (mRenderQueueIDSet) {\n queue->addRenderable(&s, mRenderQueueID,\n queue->getDefaultRenderablePriority());\n } else {\n queue->addRenderable(&s, queue->getDefaultQueueGroup(),\n queue->getDefaultRenderablePriority());\n }\n }\n}\n\nvoid RangedClutter::update (const Vector3 &new_pos)\n{\n const float vis2 = mVisibility * mVisibility;\n typedef Cargo::iterator I;\n\n // iterate through all activated guys to see who is too far to stay activated\n Cargo victims = activated;\n for (I i=victims.begin(), i_=victims.end() ; i!=i_ ; ++i) {\n Item *o = *i;\n //note we use vis2 not visibility\n float range2 = o->range2(new_pos) / vis2;\n\n if (range2 > 1) {\n // now out of range\n mClutter.releaseGeometry(o->ticket);\n o->activated = false;\n Item *filler = activated[activated.size()-1];\n activated[o->activatedIndex] = filler;\n filler->activatedIndex = o->activatedIndex;\n activated.pop_back();\n } else {\n // still in range, update visibility\n float fade = o->calcFade(range2);\n if (fade!=o->lastFade) {\n mClutter.updateGeometry(o->ticket, to_ogre(o->pos), to_ogre(o->quat), fade);\n o->lastFade = fade;\n }\n }\n }\n\n Cargo cargo;\n mSpace.getPresent(new_pos.x, new_pos.y, new_pos.z, mStepSize, mVisibility, cargo);\n // iterate through the cargo to see who needs to become activated\n for (Cargo::iterator i=cargo.begin(),i_=cargo.end() ; i!=i_ ; ++i) {\n Item *o = *i;\n\n if (o->activated) continue;\n\n float range2 = o->range2(new_pos) / vis2;\n\n // not in range yet\n if (range2 > 1) continue;\n\n float fade = o->calcFade(range2);\n o->lastFade = fade;\n\n //activate o\n o->ticket = mClutter.reserveGeometry(o->mesh);\n if (!o->ticket.valid()) continue;\n mClutter.updateGeometry(o->ticket, to_ogre(o->pos), to_ogre(o->quat), fade);\n o->activatedIndex = activated.size();\n activated.push_back(o);\n o->activated = true;\n }\n}\n\nvoid RangedClutter::push_back (const SimpleTransform &t)\n{\n // it is very important that the number of samples does not increase over time, or\n // the vector will resize and these pointers will become invalid\n items.push_back(Item());\n Item &item = items[items.size()-1];\n item.parent = this;\n item.activated = false;\n item.mesh = mNextMesh;\n item.quat = t.quat;\n item.lastFade = 0;\n mSpace.add(&item);\n item.updateSphere(t.pos, mItemRenderingDistance);\n}\n\nvoid RangedClutter::getUtilisation (size_t &used, size_t &rendered, size_t &total)\n{\n mClutter.getUtilisation(used,rendered,total);\n}\n\n\n////////////////////////////////////////////////////////////////////////////////////////////////////\n// RangedClutterFactory ///////////////////////////////////////////////////////////////////////////\n////////////////////////////////////////////////////////////////////////////////////////////////////\n\nOgre::MovableObject* RangedClutterFactory::createInstanceImpl (\n const Ogre::String& name, const Ogre::NameValuePairList* params)\n{\n Ogre::NameValuePairList::const_iterator ni;\n\n if (params==NULL || (ni = params->find(\"triangles\"))==params->end())\n GRIT_EXCEPT(\"Must give triangles when creating RangedClutter object\");\n unsigned triangles = atoi(ni->second.c_str());\n\n bool tangents = false; // optional\n if (params!=NULL && (ni = params->find(\"tangents\"))!=params->end()) {\n tangents = ni->second == \"true\";\n }\n\n // must have mesh parameter\n return OGRE_NEW RangedClutter(name, triangles, tangents);\n}\n\n\nvoid RangedClutterFactory::destroyInstance (Ogre::MovableObject* obj)\n{\n OGRE_DELETE obj;\n}\n\n// pim: ts=4:sw=4:expandtab\n" }, { "alpha_fraction": 0.5472647547721863, "alphanum_fraction": 0.5492957830429077, "avg_line_length": 46.477989196777344, "blob_id": "0164ef72c8e5e8a2d179f17b0a249ebf94444f5d", "content_id": "14956cc4236e202f45de39c63fe9d287f06c5b1d", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 22649, "license_type": "permissive", "max_line_length": 111, "num_lines": 477, "path": "/dependencies/quex-0.34.1/quex/lexer_mode.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "################################################################################\n#! /usr/bin/env python\n# Quex is free software; you can redistribute it and/or modify it under the\n# terms of the GNU Lesser General Public License as published by the Free\n# Software Foundation; either version 2.1 of the License, or (at your option)\n# any later version.\n# \n# This software is distributed in the hope that it will be useful, but WITHOUT\n# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more\n# details.\n# \n# You should have received a copy of the GNU Lesser General Public License along\n# with this library; if not, write to the Free Software Foundation, Inc., 59\n# Temple Place, Suite 330, Boston, MA 02111-1307 USA\n#\n# (C) 2006, 2007 Frank-Rene Schaefer\n#\n################################################################################\nimport sys\nimport os\n\nfrom copy import copy\nfrom quex.frs_py.file_in import error_msg\nfrom quex.core_engine.generator.action_info import *\n\n#-----------------------------------------------------------------------------------------\n# mode_db: storing the mode information into a dictionary:\n# key = mode name\n# item = LexMode object\n#-----------------------------------------------------------------------------------------\nmode_db = {}\n\n\nclass OptionInfo:\n \"\"\"This type is used only in context of a dictionary, the key\n to the dictionary is the option's name.\"\"\"\n def __init__(self, Type, Domain=-1):\n # self.name = Option see comment above\n self.type = Type\n if Type == \"list\" and Domain == -1: self.domain = []\n else: self.domain = Domain\n\nclass LexMode:\n def __init__(self, Name, Filename, LineN):\n global mode_db\n\n self.filename = Filename\n self.line_n = LineN\n\n self.name = Name\n self.base_modes = []\n # Read pattern information into dictionary object. This allows for the following:\n # (i) inheritance of pattern behavior in different modes.\n # (ii) 'virtual' patterns in the sense that their behavior can be\n # overwritten.\n self.__matches = {} # genuine patterns as specified in the mode declaration\n\n self.__repriorization_db = {} # patterns of the base class to be reprioritized\n # # map: pattern --> new pattern index\n self.__deletion_db = {} # patterns of the base class to be deleted\n\n self.__inheritance_resolved_f = False # inherited patterns are only valid, after the\n # # function 'pattern_action_pairs()' has been\n # # called, since it resolves all inheritance issues.\n self.__resolved_matches = {} # own and inherited patterns after call to function\n # # 'pattern_action_pairs().\n\n # register at the mode database\n mode_db[Name] = self\n\n # (*) set the information about possible options\n self.options = {} # option settings\n\n # -- default settings for options\n self.options[\"inheritable\"] = \"yes\"\n self.options[\"exit\"] = []\n self.options[\"entry\"] = []\n self.options[\"restrict\"] = []\n self.options[\"skip\"] = []\n self.options[\"skip-range\"] = []\n self.options[\"skip-nesting-range\"] = []\n\n self.on_entry = CodeFragment()\n self.on_exit = CodeFragment()\n self.on_match = CodeFragment()\n self.on_failure = CodeFragment()\n self.on_end_of_stream = CodeFragment()\n self.on_indentation = CodeFragment()\n\n # A flag indicating wether the mode has gone trough\n # consistency check.\n self.consistency_check_done_f = False\n self.inheritance_circularity_check_done_f = False\n\n def has_event_handler(self):\n if self.on_entry.get_code() != \"\": return True\n elif self.on_exit.get_code() != \"\": return True\n elif self.on_match.get_code() != \"\": return True\n elif self.on_failure.get_code() != \"\": return True\n elif self.on_end_of_stream.get_code() != \"\": return True\n elif self.on_indentation.get_code() != \"\": return True\n else: return False\n\n def has_pattern(self, PatternStr):\n return self.__matches.has_key(PatternStr)\n\n def get_match_object(self, PatternStr):\n return self.__matches[PatternStr]\n\n def has_matches(self):\n assert self.inheritance_circularity_check_done_f == True, \\\n \"called before consistency check!\"\n\n if self.__matches != {}: return True\n\n for name in self.base_modes:\n if mode_db[name].has_matches(): return True\n\n return False\n\n def own_matches(self):\n return self.__matches\n\n def add_match(self, Pattern, Action, PatternStateMachine):\n if self.__matches.has_key(Pattern):\n error_msg(\"Pattern '%s' appeared twice in mode definition.\\n\" % Pattern + \\\n \"Only the last definition is considered.\", \n Action.filename, Action.line_n, DontExitF=True)\n\n self.__matches[Pattern] = PatternActionInfo(PatternStateMachine, Action, Pattern)\n\n def add_match_priority(self, Pattern, PatternStateMachine, PatternIdx, fh):\n if self.__matches.has_key(Pattern):\n error_msg(\"Pattern '%s' appeared twice in mode definition.\\n\" % Pattern + \\\n \"Only this priority mark is considered.\", fh)\n\n self.__repriorization_db[Pattern] = PatternIdx\n\n def add_match_deletion(self, Pattern, PatternStateMachine, fh):\n if self.__matches.has_key(Pattern):\n error_msg(\"Deletion of '%s' which appeared before in same mode.\\n\" % Pattern + \\\n \"Deletion of pattern.\", fh)\n\n self.__deletion_db[Pattern] = True\n\n def on_entry_code_fragments(self, Depth=0):\n \"\"\"Collect all 'on_entry' event handlers from all base classes.\n Returns list of 'CodeFragment'.\n \"\"\"\n return self.__collect_fragments(\"on_entry\")\n\n def on_exit_code_fragments(self, Depth=0):\n \"\"\"Collect all 'on_exit' event handlers from all base classes.\n Returns list of 'CodeFragment'.\n \"\"\"\n return self.__collect_fragments(\"on_exit\")\n\n def on_indentation_code_fragments(self, Depth=0):\n \"\"\"Collect all 'on_indentation' event handlers from all base classes.\n Returns list of 'CodeFragment'.\n \"\"\"\n return self.__collect_fragments(\"on_indentation\")\n\n def on_match_code_fragments(self, Depth=0):\n \"\"\"Collect all 'on_match' event handlers from all base classes.\n Returns list of 'CodeFragment'.\n \"\"\"\n return self.__collect_fragments(\"on_match\")\n\n def on_end_of_stream_code_fragments(self, Depth=0):\n \"\"\"Collect all 'on_end_of_stream' event handlers from all base classes.\n Returns list of 'CodeFragment'.\n \"\"\"\n return self.__collect_fragments(\"on_end_of_stream\")\n\n def on_failure_code_fragments(self, Depth=0):\n \"\"\"Collect all 'on_failure' event handlers from all base classes.\n Returns list of 'CodeFragment'.\n \"\"\"\n return self.__collect_fragments(\"on_failure\")\n\n def __collect_fragments(self, FragmentName, Depth=0):\n \"\"\"Collect all event handlers with the given FragmentName from all base classes.\n Returns list of 'CodeFragment'.\n \"\"\"\n if self.__dict__[FragmentName].get_code() == \"\":\n code_fragments = []\n else: \n code_fragments = [ self.__dict__[FragmentName] ]\n\n for base_mode_name in self.base_modes:\n # -- get 'on_match' handler from the base mode\n base_mode = mode_db[base_mode_name]\n code_fragments.extend(base_mode.on_match_code_fragments(Depth+1))\n\n # reverse the order, so that the lowest base class appears first\n if Depth==0: code_fragments.reverse()\n\n return code_fragments\n\n def pattern_action_pairs(self, Depth=0):\n \"\"\"Collect patterns of all inherited modes. Patterns are like virtual functions\n in C++ or other object oriented programming languages. Also, the patterns of the\n uppest mode has the highest priority, i.e. comes first.\n\n The list 'DerivedModes' is used in recursive calls (see '__collect_patterns') to\n determine a circular inheritance error.\n \"\"\"\n\n # (1) collect patterns from base modes\n inherited_matches = {}\n for base_mode_name in self.base_modes:\n\n # -- get patterns of the base mode (the mode one inherits from)\n base_mode = mode_db[base_mode_name]\n base_patterns = base_mode.pattern_action_pairs(Depth + 1)\n\n for pattern, match in base_patterns.items():\n inherited_matches[pattern] = match\n\n # (2) -- treat the overwriting of virtual patterns and\n # -- reset the 'pattern index' and the 'inheritance level index'\n # if a PRIORITY-MARK was set somewhere\n # -- delete inherited patterns that are marked for deletion.\n resolved_matches = {}\n\n # -- loop over inherited patterns and add them to the list\n for inherited_pattern, inherited_match in inherited_matches.items():\n if self.__deletion_db.has_key(inherited_pattern):\n # totally ignore the pattern, do not absorb it into 'resolved matches'\n pass\n elif self.__repriorization_db.has_key(inherited_pattern):\n # adapt the pattern index, this automatically adapts the priorization\n resolved_matches[inherited_pattern] = copy(inherited_match)\n new_id = self.__repriorization_db[inherited_pattern]\n resolved_matches[inherited_pattern].pattern_state_machine().core().set_id(new_id)\n resolved_matches[inherited_pattern].inheritance_level = Depth\n resolved_matches[inherited_pattern].inheritance_mode_name = self.name\n elif inherited_pattern not in self.__matches.keys():\n # inherited pattern did not at all occur in the own matches list\n resolved_matches[inherited_pattern] = copy(inherited_match)\n else:\n # own match overides the inherited pattern\n resolved_matches[inherited_pattern] = copy(inherited_match)\n resolved_matches[inherited_pattern].inheritance_level = Depth\n resolved_matches[inherited_pattern].inheritance_mode_name = self.name\n\n # -- loop over own patterns and add what is not added yet\n # (the priority marked patterns should now all be added. if\n # a priority marked pattern in not present yet, it means that\n # it was not mentioned in a base mode)\n for pattern, match in self.__matches.items():\n if resolved_matches.has_key(pattern): continue\n resolved_matches[pattern] = copy(match)\n resolved_matches[pattern].inheritance_level = Depth\n resolved_matches[pattern].inheritance_mode_name = self.name\n\n return resolved_matches\n\n def inheritance_structure_string(self, Depth=0):\n \"\"\"NOTE: The consistency check ensures that all base modes are\n defined and inheritable and there is no circular inheritance !\n Therefore there is no need to check if the base mode\n has an entry in the mode database.\"\"\"\n assert self.consistency_check_done_f == True, \\\n \"called before consistency check!\"\n\n if Depth != 0: str = \"** \" + (\" \" * Depth) + self.name + \"\\n\"\n else: str = \"** <\" + self.name + \">\\n\"\n for base_mode_name in self.base_modes:\n mode = mode_db[base_mode_name]\n str += mode.inheritance_structure_string(Depth + 1)\n return str\n\n def get_base_modes(self):\n \"\"\"Get all base classes recursively.\n NOTE: Circularity check needs to happen somewhere else\n This function is part of the consistency check!\n \"\"\"\n assert self.inheritance_circularity_check_done_f == True, \\\n \"called before consistency check!\"\n\n base_mode_collection = copy(self.base_modes)\n for base_mode in self.base_modes:\n # -- append base_mode to the base modes of current mode\n base_mode_collection_candidates = mode_db[base_mode].get_base_modes()\n for candidate in base_mode_collection_candidates:\n if candidate not in base_mode_collection:\n base_mode_collection.append(candidate)\n\n return base_mode_collection\n\n def add_option(self, Option, Value):\n \"\"\" SANITY CHECK:\n -- which options are concatinated to a list\n -- which ones are replaced\n -- what are the values of the options\n \"\"\"\n assert mode_option_info_db.has_key(Option)\n\n oi = mode_option_info_db[Option]\n if oi.type == \"list\":\n # append the value, assume in lists everything is allowed\n if self.options.has_key(Option): self.options[Option].append(Value)\n else: self.options[Option] = [ Value ]\n else:\n assert Value in oi.domain\n self.options[Option] = Value\n\n def consistency_check(self):\n \"\"\"Checks for the following:\n\n -- existence of base modes\n -- circularity of inheritance\n -- existence of enter and exit modes\n -- checks that if X has an exit to Y,\n then Y must have an entry to X\n\n Any failure causes an immediate break up.\n \"\"\"\n\n # (*) Base Modes\n #\n # -- ability to inherit\n #\n # NOTE: existence of modes is checked in ciruclarity test.\n #\n for base_mode_name in self.base_modes:\n # -- is base mode inheritable?\n if mode_db[base_mode_name].options[\"inheritable\"] == \"no\":\n error_msg(\"mode '%s' inherits mode '%s' which is **not inheritable**.\" % \\\n (self.name, base_mode_name), self.filename, self.line_n)\n\n # -- require all bases modes\n all_base_modes = self.get_base_modes()\n\n # (*) A mode that does not force to be inherited needs finally contain matches.\n # A mode that contains only event handlers is not <inheritable: only>, but\n # somehow, it needs some matches in the base classes, otherwise it cannot\n # act as a pattern state machine.\n if self.options[\"inheritable\"] != \"only\" and self.has_matches() == False:\n error_msg(\"mode '%s' was allowed without <inheritable: only> despite it contains no matches\\n\" % \\\n (self.name) + \\\n \"because it contains event handlers. Finally, though, it seems not want to inherit\\n\" + \\\n \"any mode that contains matches. Therefore, it cannot act as a pattern detecting\\n\" + \\\n \"state machine and cannot be a lexical analyzer mode.\",\n self.filename, self.line_n)\n\n # (*) Enter/Exit Transitions\n for mode_name in self.options[\"exit\"]:\n # -- does other mode exist?\n if mode_db.has_key(mode_name) == False:\n error_msg(\"mode '%s'\\nhas an exit to mode '%s'\\nbut no such mode exists.\" % \\\n (self.name, mode_name), self.filename, self.line_n)\n\n # -- does other mode have an entry for this mode?\n # (does this or any of the base modes have an entry to the other mode?)\n other_mode = mode_db[mode_name]\n # -- no restrictions => OK\n if other_mode.options[\"entry\"] == []: continue\n # -- restricted entry => check if this mode ore one of the base modes can enter\n for base_mode in [self.name] + all_base_modes:\n if base_mode in other_mode.options[\"entry\"]: break\n else:\n error_msg(\"mode '%s'\\nhas an exit to mode '%s',\" % (self.name, mode_name),\n self.filename, self.line_n, DontExitF=True)\n error_msg(\"but mode '%s'\\nhas no entry for mode '%s'.\\n\" % (mode_name, self.name) + \\\n \"or any of its base modes.\",\n other_mode.filename, other_mode.line_n)\n\n for mode_name in self.options[\"entry\"]:\n # -- does other mode exist?\n if mode_db.has_key(mode_name) == False:\n error_msg(\"mode '%s'\\nhas an entry from mode '%s'\\nbut no such mode exists.\" % \\\n (self.name, mode_name),\n self.filename, self.line_n)\n\n # -- does other mode have an exit for this mode?\n # (does this or any of the base modes have an exit to the other mode?)\n other_mode = mode_db[mode_name]\n # -- no restrictions => OK\n if other_mode.options[\"exit\"] == []: continue\n # -- restricted exit => check if this mode ore one of the base modes can enter\n for base_mode in [self.name] + all_base_modes:\n if base_mode in other_mode.options[\"exit\"]: break\n else:\n error_msg(\"mode '%s'\\nhas an entry for mode '%s'\" % (self.name, mode_name),\n self.filename, self.line_n, DontExitF=True)\n error_msg(\"but mode '%s'\\nhas no exit to mode '%s'\\n\" % (mode_name, self.name) + \\\n \"or any of its base modes.\",\n other_mode.filename, other_mode.line_n)\n \n self.consistency_check_done_f = True\n\n #def get_number_of_post_conditioned_patterns(self):\n # \"\"\"NOTE: The number of post conditions determines the size of an array. However,\n # the analyser, later one determines it again and then it is correct. But,\n # still keep in mind that this number is 'crucial'!\n # \"\"\"\n # pattern_action_pairs = self.pattern_action_pairs()\n # post_condition_n = 0\n # for match in pattern_action_pairs.values():\n # if match.pattern_state_machine.core().post_context_id() != -1L:\n # post_condition_n += 1\n # return post_condition_n\n\n#-----------------------------------------------------------------------------------------\n# mode option information/format: \n#-----------------------------------------------------------------------------------------\nmode_option_info_db = {\n # -- a mode can be inheritable or not or only inheritable. if a mode\n # is only inheritable it is not printed on its on, only as a base\n # mode for another mode. default is 'yes'\n \"inheritable\": OptionInfo(\"single\", [\"no\", \"yes\", \"only\"]),\n # -- a mode can restrict the possible modes to exit to. this for the\n # sake of clarity. if no exit is explicitly mentioned all modes are\n # possible. if it is tried to transit to a mode which is not in\n # the list of explicitly stated exits, an error occurs.\n # entrys work respectively.\n \"exit\": OptionInfo(\"list\"),\n \"entry\": OptionInfo(\"list\"),\n # -- a mode can restrict the exits and entrys explicitly mentioned\n # then, a derived mode cannot add now exits or entrys\n \"restrict\": OptionInfo(\"list\", [\"exit\", \"entry\"]),\n # -- a mode can have 'skippers' that effectivels skip ranges that are out of interest.\n \"skip\": OptionInfo(\"list\"), # \"multiple: RE-character-set\n \"skip_range\": OptionInfo(\"list\"), # \"multiple: RE-character-string RE-character-string\n \"skip_nested_range\": OptionInfo(\"list\"), # \"multiple: RE-character-string RE-character-string\n}\n\n#-----------------------------------------------------------------------------------------\n# initial_mode: mode in which the lexcial analyser shall start\n#-----------------------------------------------------------------------------------------\ninitial_mode = CodeFragment()\n\n#-----------------------------------------------------------------------------------------\n# header: code fragment that is to be pasted before mode transitions\n# and pattern action pairs (e.g. '#include<something>'\n#-----------------------------------------------------------------------------------------\nheader = CodeFragment()\n\n#-----------------------------------------------------------------------------------------\n# class_body: code fragment that is to be pasted inside the class definition\n# of the lexical analyser class.\n#-----------------------------------------------------------------------------------------\nclass_body = CodeFragment()\n\n#-----------------------------------------------------------------------------------------\n# class_init: code fragment that is to be pasted inside the lexer class constructor\n#-----------------------------------------------------------------------------------------\nclass_init = CodeFragment()\n\n\nclass PatternShorthand:\n def __init__(self, Name=\"\", StateMachine=\"\", Filename=\"\", LineN=-1, RE=\"\"):\n assert StateMachine.has_origins() == False\n assert StateMachine.__class__.__name__ == \"StateMachine\"\n\n self.name = Name\n self.state_machine = StateMachine\n self.filename = Filename\n self.line_n = LineN\n self.regular_expression = RE\n\n#-----------------------------------------------------------------------------------------\n# shorthand_db: user defined names for regular expressions.\n# (this is what contained in the pattern file for flex-based engines.\n# it is only used with quex generated engines) \n#-----------------------------------------------------------------------------------------\nshorthand_db = {}\n\n#-----------------------------------------------------------------------------------------\n# token_id_db: list of all defined token-ids together with the file position\n# where they are defined. See token_ide_maker, class TokenInfo.\n#-----------------------------------------------------------------------------------------\ntoken_id_db = {}\n\n\n" }, { "alpha_fraction": 0.48507463932037354, "alphanum_fraction": 0.48507463932037354, "avg_line_length": 31.912281036376953, "blob_id": "84a80732835215465af8027417d42cd35059be4f", "content_id": "f62f0a6ca4872770cf28ed1eaea1b7f98d87ed20", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Makefile", "length_bytes": 1876, "license_type": "permissive", "max_line_length": 80, "num_lines": 57, "path": "/dependencies/quex-0.34.1/demo/006/Makefile", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "# PURPOSE: Makefile for unit tests.\n#\n# ABSOLUTELY NO WARRANTY\n#_______________________________________________________________________________\n.PHONY: clean\nifndef QUEX_PATH\n $(error The environment variable QUEX_PATH is not defined!)\nendif\n\n# (*) SETUP ____________________________________________________________________\n# -- INPUT\nMODE_FILES = simple.qx\n# -- FILES PRODUCED BY QUEX\nENGINE_NAME = tiny_lexer# NOTE: a whitespace after this name creates chaos!\nENGINE_SOURCES = $(ENGINE_NAME) \\\n $(ENGINE_NAME).cpp \\\n $(ENGINE_NAME)-token_ids \\\n\t\t $(ENGINE_NAME)-core-engine.cpp\n# -- OUTPUT\nAPPLICATION = lexer\n\n# (*) COMPILER SETTINGS ________________________________________________________\n# (change COMPILER to whatever you use as compiler on the command line,\n# e.g. \"make COMPILER=icpc\" will use intel's c++ compiler)\nCOMPILER = g++\nCC = $(COMPILER) -c -fPIC -ggdb -Wno-deprecated -Wall \\\n\t -I./ -I$(QUEX_PATH) $(NDEBUG_F) \\\n -DQUEX_OPTION_ACTIVATE_ASSERTS\t \\\n #-D__QUEX_OPTION_DEBUG_STATE_TRANSITION_REPORTS\t \n\nLD = $(COMPILER)\n\n# (*) RULES ____________________________________________________________________\n# -- application\n$(APPLICATION): $(APPLICATION).o \\\n\t $(ENGINE_NAME).o $(ENGINE_NAME)-core-engine.o\n\t$(LD) ./$(APPLICATION).o $(ENGINE_NAME).o $(ENGINE_NAME)-core-engine.o \\\n -o $(APPLICATION) \n\n# -- engine and object files\n%.o: %.cpp $(ENGINE_SOURCES)\n\t$(CC) $< -o $@\n\n$(ENGINE_SOURCES): $(MODE_FILES)\n\tquex -i $(MODE_FILES) --engine $(ENGINE_NAME) \n\n# (*) HELPERS __________________________________________________________________\n#\nclean:\t\n\ttouch $(MODE_FILES)\n\trm -f $(ENGINE_SOURCES)\n\trm -f $(ENGINE_NAME).o\n\trm -f $(ENGINE_NAME)-core-engine.o\n\trm -f lexer.o\n\trm -f lexer\n\trm -f token_ids\n\trm -f *.bak\n" }, { "alpha_fraction": 0.6435643434524536, "alphanum_fraction": 0.6732673048973083, "avg_line_length": 15.833333015441895, "blob_id": "01b3bb7b06ea1cae6faddf297f6373adad6837c8", "content_id": "de1729eb8e9eb656f3983a179e26cdf834b2e092", "detected_licenses": [ "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer", "MIT" ], "is_generated": false, "is_vendor": false, "language": "C", "length_bytes": 303, "license_type": "permissive", "max_line_length": 30, "num_lines": 18, "path": "/dependencies/quex-0.34.1/demo/008/Calc_token-ids.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/*\n * Proto_token-ids.h\n *\n * Created on: 31-ott-2008\n * Author: mark\n */\n\n#ifndef PROTO_TOKENIDS_H_\n#define PROTO_TOKENIDS_H_\n\n//#include \"Proto_token-ids.i\"\n#include \"Calc_parser.tab.hpp\"\n\n#define TKN_TERMINATION 0\n#define TKN_UNINITIALIZED 1\n#define TKN_DUMMY 2\n\n#endif /* PROTO_TOKENIDS_H_ */\n" }, { "alpha_fraction": 0.5396119952201843, "alphanum_fraction": 0.5597160458564758, "avg_line_length": 33.94507598876953, "blob_id": "23990a4585b6d106ef127d4115e5b4c475b3e6be", "content_id": "075db3a2bfd32b037b6842f26b94ea85c7981760", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 18454, "license_type": "permissive", "max_line_length": 154, "num_lines": 528, "path": "/engine/gfx/gfx_disk_resource.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include \"gfx_disk_resource.h\"\n#include \"gfx_internal.h\"\n#include \"gfx_material.h\"\n#include \"gfx_body.h\"\n#include \"gfx_sky_body.h\"\n\n\nbool gfx_disk_resource_verbose_loads = false;\n\ndouble gfx_gpu_ram_available (void)\n{\n return gfx_option(GFX_RAM);\n}\n\ndouble gfx_gpu_ram_used (void)\n{\n // TODO: don't use Ogre for this, track it from Grit.\n // It will be useful to provide this number as well, to make sure it does\n // not significantly deviate from Grit's number.\n Ogre::TextureManager &tm = Ogre::TextureManager::getSingleton();\n Ogre::MeshManager &mm = Ogre::MeshManager::getSingleton();\n return (tm.getMemoryUsage() + mm.getMemoryUsage()) / 1024.0 / 1024.0;\n}\n\n\nGfxMeshDiskResource::GfxMeshDiskResource (const std::string &name)\n : GfxGPUDiskResource(name)\n{\n try {\n std::string ogre_name = name.substr(1);\n Ogre::HardwareBuffer::Usage u = Ogre::HardwareBuffer::HBU_STATIC_WRITE_ONLY;\n auto result = Ogre::MeshManager::getSingleton()\n .createOrRetrieve(ogre_name,RESGRP, false,0, 0, u, u, false, false);\n rp = result.first.staticCast<Ogre::Mesh>();\n } catch (Ogre::Exception &e) { \n GRIT_EXCEPT(\"Couldn't find graphics resource: \"+e.getFullDescription());\n } \n}\n\n\n// hack to get access to stuff\nclass MyMeshHack : public Ogre::Mesh {\n public:\n static Ogre::DataStreamPtr getData (const Ogre::MeshPtr &mp) \n {\n return ((*mp).*&MyMeshHack::mFreshFromDisk);\n }\n};\n\n// get the material names only\nclass MyMeshDeserializer : public Ogre::Serializer {\n\n public:\n\n MyMeshDeserializer (const Ogre::DataStreamPtr stream, Ogre::MeshSerializerListener *listener)\n {\n mStream = stream;\n mListener = listener;\n mVersion = \"[MeshSerializer_v1.8]\";\n }\n \n void importMatNames (const Ogre::MeshPtr &pMesh, std::vector<std::string> &mat_names)\n {\n\n mStream->seek(0);\n\n determineEndianness(mStream);\n\n // Read header and determine the version\n // Read header ID\n unsigned short headerID;\n readShorts(mStream, &headerID, 1);\n\n // Read version\n std::string ver = readString(mStream);\n // Jump back to start\n mStream->seek(0);\n\n if (ver != \"[MeshSerializer_v1.8]\" && ver != \"[MeshSerializer_v1.100]\" ) {\n GRIT_EXCEPT(\"Mesh \\\"\"+pMesh->getName()+\"\\\" wrong version \"+ver);\n }\n\n mVersion = ver;\n readFileHeader(mStream);\n\n unsigned short streamID = readChunk(mStream);\n APP_ASSERT(streamID == Ogre::M_MESH);\n\n bool skeletallyAnimated;\n readBools(mStream, &skeletallyAnimated, 1);\n\n for (streamID = readChunk(mStream) ; !mStream->eof() ; streamID = readChunk(mStream)) {\n bool broken = false;\n switch (streamID) {\n // ignore all of these\n case Ogre::M_ANIMATION: \n case Ogre::M_ANIMATION_MORPH_KEYFRAME: \n case Ogre::M_ANIMATION_POSE_KEYFRAME: \n case Ogre::M_ANIMATION_POSE_REF: \n case Ogre::M_ANIMATIONS: \n case Ogre::M_ANIMATION_TRACK: \n case Ogre::M_EDGE_GROUP: \n case Ogre::M_EDGE_LIST_LOD: \n case Ogre::M_EDGE_LISTS: \n case Ogre::M_GEOMETRY: \n case Ogre::M_GEOMETRY_VERTEX_BUFFER: \n case Ogre::M_GEOMETRY_VERTEX_BUFFER_DATA: \n case Ogre::M_GEOMETRY_VERTEX_DECLARATION: \n case Ogre::M_GEOMETRY_VERTEX_ELEMENT: \n case Ogre::M_HEADER: \n case Ogre::M_MESH: \n case Ogre::M_MESH_BONE_ASSIGNMENT: \n case Ogre::M_MESH_BOUNDS: \n case Ogre::M_MESH_LOD_GENERATED: \n case Ogre::M_MESH_LOD_MANUAL: \n case Ogre::M_MESH_LOD_USAGE: \n case Ogre::M_MESH_SKELETON_LINK: \n case Ogre::M_POSE: \n case Ogre::M_POSES: \n case Ogre::M_POSE_VERTEX: \n case Ogre::M_SUBMESH_BONE_ASSIGNMENT: \n case Ogre::M_SUBMESH_NAME_TABLE: \n case Ogre::M_SUBMESH_NAME_TABLE_ELEMENT: \n case Ogre::M_SUBMESH_OPERATION: \n case Ogre::M_SUBMESH_TEXTURE_ALIAS: \n case Ogre::M_TABLE_EXTREMES: \n break;\n // this is what we're looking for\n case Ogre::M_SUBMESH: {\n size_t pos = mStream->tell();\n std::string mat_name = readString(mStream);\n mListener->processMaterialName(&*pMesh, &mat_name);\n mat_names.push_back(mat_name);\n mStream->seek(pos); // back to the 'overhead'\n } break;\n // error case if streamID is unknown\n default:\n CERR << \"Corrupted mesh, not loading textures: \\\"\"<<pMesh->getName()<<\"\\\", streamId was \" << streamID << std::endl;\n mat_names.clear();\n broken = true;\n break;\n }\n if (broken) break;\n int stream_overhead_size = 6; // not exposed from Ogre\n mStream->skip(mCurrentstreamLen - stream_overhead_size); \n }\n\n mStream->seek(0);\n\n }\n \n Ogre::MeshSerializerListener *mListener;\n};\n\n\nvoid GfxMeshDiskResource::loadImpl (void)\n{\n APP_ASSERT(!isLoaded());\n try {\n if (!rp->isLoaded()) {\n // do as much as we can, given that this is a background thread\n if (gfx_disk_resource_verbose_loads)\n CVERB << \"Preparing an Ogre::Resource: \" << rp->getName() << std::endl;\n rp->prepare();\n\n // for meshes, scan the bytes from disk to extract materials, then work out\n // what textures we are depending on...\n Ogre::DataStreamPtr mesh_data = MyMeshHack::getData(rp);\n std::vector<std::string> mat_names;\n MyMeshDeserializer mmd(mesh_data, Ogre::MeshManager::getSingleton().getListener());\n mmd.importMatNames(rp, mat_names);\n\n GFX_MAT_SYNC;\n if (gfx_disk_resource_verbose_loads) {\n CVERB << \"materials = [\";\n for (unsigned i=0 ; i<mat_names.size() ; ++i) {\n CLOG << (i==0?\" \":\", \") << mat_names[i];\n }\n CLOG << \"]\" << std::endl;\n }\n\n // sync with main thread to get texture names\n for (unsigned i=0 ; i<mat_names.size() ; ++i) {\n if (gfx_material_has_any(mat_names[i])) {\n gfx_material_add_dependencies(mat_names[i], this);\n } else {\n // Mesh references non-existing material, so silently ignore.\n // When it is later used, an error will be raised then.\n // This is actually better, as the error is raised at the point of use...\n // Rather than asynchronously, in advance of use.\n }\n }\n \n } else {\n CVERB << \"Internal warning: Loaded in OGRE, unloaded in GRIT: \\\"\" << getName() << \"\\\"\" << std::endl;\n }\n } catch (Ogre::Exception &e) {\n GRIT_EXCEPT(e.getDescription());\n }\n}\n\nvoid GfxMeshDiskResource::reloadImpl(void)\n{\n if (gfx_disk_resource_verbose_loads)\n CVERB << \"OGRE: Reloading: \" << rp->getName() << std::endl;\n try {\n rp->reload();\n if (rp->hasSkeleton()) rp->getSkeleton()->reload();\n for (unsigned long i=0 ; i<gfx_all_nodes.size() ; ++i) {\n GfxNode *leaf = gfx_all_nodes[i];\n GfxBody *b = dynamic_cast<GfxBody*>(leaf);\n if (b!=NULL && b->mesh == rp) b->reinitialise();\n }\n for (unsigned long i=0 ; i<gfx_all_sky_bodies.size() ; ++i) {\n GfxSkyBody *b = gfx_all_sky_bodies[i];\n if (b->mesh == rp) b->reinitialise();\n }\n } catch (Ogre::Exception &e) {\n CERR << e.getFullDescription() << std::endl;\n } \n} \n\nvoid GfxMeshDiskResource::unloadImpl(void)\n{\n if (gfx_disk_resource_verbose_loads)\n CVERB << \"OGRE: Unloading: \" << rp->getName() << std::endl;\n try {\n rp->unload();\n } catch (Ogre::Exception &e) {\n CERR << e.getFullDescription() << std::endl;\n } \n} \n\n\n\nGfxTextureDiskResource::GfxTextureDiskResource (const std::string &name)\n : GfxBaseTextureDiskResource(name)\n{\n try {\n std::string ogre_name = name.substr(1);\n auto result = Ogre::TextureManager::getSingleton().createOrRetrieve(ogre_name,RESGRP);\n rp = result.first.staticCast<Ogre::Texture>();\n } catch (Ogre::Exception &e) { \n GRIT_EXCEPT(\"Couldn't find graphics resource: \"+e.getFullDescription());\n } \n}\n\nvoid GfxTextureDiskResource::loadImpl (void)\n{\n APP_ASSERT(!isLoaded());\n try {\n if (!rp->isLoaded()) {\n // do as much as we can, given that this is a background thread\n if (gfx_disk_resource_verbose_loads)\n CVERB << \"Preparing an Ogre::Resource: \" << rp->getName() << std::endl;\n rp->prepare();\n\n } else {\n CVERB << \"Internal warning: Loaded in OGRE, unloaded in GRIT: \\\"\" << getName() << \"\\\"\" << std::endl;\n }\n } catch (Ogre::Exception &e) {\n GRIT_EXCEPT(e.getDescription());\n }\n}\n\nvoid GfxTextureDiskResource::reloadImpl(void)\n{\n if (gfx_disk_resource_verbose_loads)\n CVERB << \"OGRE: Reloading: \" << rp->getName() << std::endl;\n try {\n rp->reload();\n } catch (Ogre::Exception &e) {\n CERR << e.getFullDescription() << std::endl;\n } \n} \n\nvoid GfxTextureDiskResource::unloadImpl(void)\n{\n if (gfx_disk_resource_verbose_loads)\n CVERB << \"OGRE: Unloading: \" << rp->getName() << std::endl;\n try {\n rp->unload();\n } catch (Ogre::Exception &e) {\n CERR << e.getFullDescription() << std::endl;\n } \n} \n\n\n\n\nGfxEnvCubeDiskResource::GfxEnvCubeDiskResource (const std::string &name)\n : GfxBaseTextureDiskResource(name)\n{\n APP_ASSERT(name.length()>0 && name[0]=='/');\n try {\n std::string ogre_name = name.substr(1);\n rp = Ogre::TextureManager::getSingleton().createManual(ogre_name, RESGRP, Ogre::TEX_TYPE_CUBE_MAP, 512, 512, Ogre::MIP_DEFAULT, Ogre::PF_UNKNOWN);\n } catch (Ogre::Exception &e) { \n GRIT_EXCEPT(\"Couldn't create an env cube: \"+e.getFullDescription());\n } \n}\n\n\n/* This is a procedural tiny cube if we ever need it:\n // Prepare texture (6(1x1) RGB8) \n uint8_t raw_tex_stack[] = { \n 0xff, 0x7f, 0x7f, \n 0x00, 0x7f, 0x7f, \n 0x7f, 0xff, 0x7f, \n 0x7f, 0x00, 0x7f, \n 0x7f, 0x7f, 0xff, \n 0x7f, 0x7f, 0x00 \n }; \n // Load raw byte array into an Image \n img.loadDynamicImage(raw_tex_stack, 1, 1, 1, Ogre::PF_B8G8R8, false, 6, 0); \n*/\n\nvoid GfxEnvCubeDiskResource::loadImpl (void)\n{\n APP_ASSERT(!isLoaded());\n uint8_t *raw_tex = NULL;\n try {\n const std::string &ogre_name = rp->getName();\n\n if (gfx_disk_resource_verbose_loads)\n CVERB << \"Loading env cube: \" << ogre_name << std::endl;\n\n if (rp->isLoaded()) {\n CERR << \"WARNING: env cube \"<<ogre_name<<\" should not be loaded in Ogre\" << std::endl;\n rp->unload();\n }\n\n Ogre::Image disk;\n disk.load (ogre_name, RESGRP);\n if (disk.getWidth() != disk.getHeight()*6) {\n GRIT_EXCEPT(\"Environment map has incorrect dimensions: \"+ogre_name);\n }\n unsigned sz = disk.getHeight();\n if (sz & (sz-1) ) {\n GRIT_EXCEPT(\"Environment map size not a power of 2: \"+ogre_name);\n }\n raw_tex = OGRE_ALLOC_T(uint8_t, disk.getSize(), Ogre::MEMCATEGORY_GENERAL);\n\n Ogre::Image img;\n img.loadDynamicImage(raw_tex, sz, sz, 1, disk.getFormat(), true, 6, 0);\n // copy faces across\n Ogre::PixelBox from = disk.getPixelBox();\n for (unsigned face=0 ; face<6 ; ++face) {\n Ogre::PixelBox to = img.getPixelBox(face,0);\n for (unsigned y=0 ; y<sz ; ++y) {\n for (unsigned x=0 ; x<sz ; ++x) {\n to.setColourAt(from.getColourAt(face*sz + x, y, 0), x, y, 0);\n }\n }\n }\n\n\n rp->loadImage(img);\n\n } catch (Ogre::Exception &e) {\n\n GRIT_EXCEPT(e.getDescription());\n }\n}\n\nvoid GfxEnvCubeDiskResource::unloadImpl(void)\n{\n if (gfx_disk_resource_verbose_loads)\n CVERB << \"OGRE: Unloading env cube: \" << rp->getName() << std::endl;\n try {\n rp->unload();\n } catch (Ogre::Exception &e) {\n CERR << e.getFullDescription() << std::endl;\n } \n} \n\n\n\n\nGfxColourGradeLUTDiskResource::GfxColourGradeLUTDiskResource (const std::string &name)\n : GfxBaseTextureDiskResource(name)\n{\n APP_ASSERT(name.length()>0 && name[0]=='/');\n try {\n std::string ogre_name = name.substr(1);\n rp = Ogre::TextureManager::getSingleton().createManual(ogre_name, RESGRP, Ogre::TEX_TYPE_3D, 32, 32, 32, 0, Ogre::PF_UNKNOWN);\n } catch (Ogre::Exception &e) { \n GRIT_EXCEPT(\"Couldn't create a LUT texture: \"+e.getFullDescription());\n } \n}\n\nvoid GfxColourGradeLUTDiskResource::loadImpl (void)\n{\n APP_ASSERT(!isLoaded());\n uint8_t *raw_tex = NULL;\n try {\n const std::string &ogre_name = rp->getName();\n\n if (gfx_disk_resource_verbose_loads)\n CVERB << \"Loading colour grade LUT: \" << ogre_name << std::endl;\n\n if (rp->isLoaded()) {\n CERR << \"Colour grade \"<<ogre_name<<\" should not be 'loaded' in Ogre\" << std::endl;\n rp->unload();\n }\n\n Ogre::Image disk;\n disk.load (ogre_name, RESGRP);\n unsigned sz = disk.getHeight();\n if (sz != 32) {\n GRIT_EXCEPT(\"Colour grade LUT does not have dimensions 1024x32: \"+ogre_name);\n }\n if (disk.getWidth() != sz*sz) {\n GRIT_EXCEPT(\"Colour grade LUT has incorrect dimensions: \"+ogre_name);\n }\n if (sz & (sz-1) ) {\n GRIT_EXCEPT(\"Colour grade LUT size not a power of 2: \"+ogre_name);\n }\n raw_tex = new uint8_t[disk.getSize()];\n\n img.loadDynamicImage(raw_tex, sz, sz, sz, disk.getFormat(), true, 1, 0);\n // copy faces across\n Ogre::PixelBox from = disk.getPixelBox();\n Ogre::PixelBox to = img.getPixelBox();\n for (unsigned z=0 ; z<sz ; ++z) {\n for (unsigned y=0 ; y<sz ; ++y) {\n for (unsigned x=0 ; x<sz ; ++x) {\n to.setColourAt(from.getColourAt(z*sz + x, y, 0), x, y, z);\n }\n }\n }\n\n rp->loadImage(img);\n\n } catch (Ogre::Exception &e) {\n\n GRIT_EXCEPT(e.getDescription());\n }\n}\n\nstatic inline Vector3 lerp1 (const Vector3 &v0, const Vector3 &v1, float a) { return (1-a)*v0 + a*v1; }\n\nstatic inline Vector3 lerp2 (const Vector3 &v00, const Vector3 &v01,\n const Vector3 &v10, const Vector3 &v11,\n float a, float b)\n{\n return lerp1(\n lerp1(v00, v01, b),\n lerp1(v10, v11, b),\n a);\n}\n\nstatic inline Vector3 lerp3 (const Vector3 &v000, const Vector3 &v001, const Vector3 &v010, const Vector3 &v011,\n const Vector3 &v100, const Vector3 &v101, const Vector3 &v110, const Vector3 &v111,\n float a, float b, float c)\n{\n return lerp1(\n lerp2(v000, v001, v010, v011, b, c),\n lerp2(v100, v101, v110, v111, b, c),\n a);\n}\n\nVector3 GfxColourGradeLUTDiskResource::lookUp (const Vector3 &v) const\n{\n if (!isLoaded()) GRIT_EXCEPT(\"Attempting to look up a colour in unloaded LUT \\\"\"+getName()+\"\\\"\");\n\n float x = v.x > 0 ? v.x < 1 ? v.x : 1 : 0;\n float y = v.y > 0 ? v.y < 1 ? v.y : 1 : 0;\n float z = v.z > 0 ? v.z < 1 ? v.z : 1 : 0;\n\n x *= 31; y*=31; z*=31;\n \n unsigned char x0 = (unsigned char)floorf(x), x1 = x0+1;\n unsigned char y0 = (unsigned char)floorf(y), y1 = y0+1;\n unsigned char z0 = (unsigned char)floorf(z), z1 = z0+1;\n\n if (x1 > 31) x = x0 = x1 = 31;\n if (y1 > 31) y = y0 = y1 = 31;\n if (z1 > 31) z = z0 = z1 = 31;\n\n Ogre::PixelBox pb = img.getPixelBox();\n Vector3 v000 = from_ogre_cv(pb.getColourAt(x0, y0, z0));\n Vector3 v001 = from_ogre_cv(pb.getColourAt(x0, y0, z1));\n Vector3 v010 = from_ogre_cv(pb.getColourAt(x0, y1, z0));\n Vector3 v011 = from_ogre_cv(pb.getColourAt(x0, y1, z1));\n Vector3 v100 = from_ogre_cv(pb.getColourAt(x1, y0, z0));\n Vector3 v101 = from_ogre_cv(pb.getColourAt(x1, y0, z1));\n Vector3 v110 = from_ogre_cv(pb.getColourAt(x1, y1, z0));\n Vector3 v111 = from_ogre_cv(pb.getColourAt(x1, y1, z1));\n\n float xd = x - x0;\n float yd = y - y0;\n float zd = z - z0;\n\n return lerp3(v000, v001, v010, v011, v100, v101, v110, v111, xd, yd, zd);\n}\n\nvoid GfxColourGradeLUTDiskResource::unloadImpl(void)\n{\n if (gfx_disk_resource_verbose_loads)\n CVERB << \"OGRE: Unloading colour grade LUT: \" << rp->getName() << std::endl;\n try {\n rp->unload();\n } catch (Ogre::Exception &e) {\n CERR << e.getFullDescription() << std::endl;\n } \n} \n\n" }, { "alpha_fraction": 0.6261261105537415, "alphanum_fraction": 0.6303935647010803, "avg_line_length": 28.08965492248535, "blob_id": "6a581ec0c24e002448616082fe30421b6105c1f7", "content_id": "7f405244d115f47514ef10856f8c9f3b3ab419fe", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 25308, "license_type": "permissive", "max_line_length": 144, "num_lines": 870, "path": "/engine/gfx/gfx_body.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <centralised_log.h>\n\n#include \"gfx_internal.h\"\n\n#include \"gfx_body.h\"\n\nconst std::string GfxBody::className = \"GfxBody\";\n\nstatic std::set<GfxBody*> first_person_bodies;\n\n// {{{ Sub\n\nunsigned short GfxBody::Sub::getNumWorldTransforms(void) const\n{\n if (!parent->numBoneMatrixes) {\n // No skeletal animation, or software skinning\n return 1;\n }\n\n // Hardware skinning, count all actually used matrices\n const Ogre::Mesh::IndexMap& indexMap = subMesh->useSharedVertices ?\n subMesh->parent->sharedBlendIndexToBoneIndexMap : subMesh->blendIndexToBoneIndexMap;\n APP_ASSERT(indexMap.size() <= parent->numBoneMatrixes);\n\n return static_cast<unsigned short>(indexMap.size());\n}\n\nvoid GfxBody::Sub::getWorldTransforms(Ogre::Matrix4* xform) const\n{\n if (!parent->numBoneMatrixes) {\n // No skeletal animation, or software skinning\n *xform = parent->toOgre();\n return;\n }\n\n // Hardware skinning, pass all actually used matrices\n const Ogre::Mesh::IndexMap& indexMap = subMesh->useSharedVertices ?\n subMesh->parent->sharedBlendIndexToBoneIndexMap : subMesh->blendIndexToBoneIndexMap;\n APP_ASSERT(indexMap.size() <= parent->numBoneMatrixes);\n\n if (parent->boneWorldMatrixes) {\n\n // Bones, use cached matrices built when _updateRenderQueue was called\n for (Ogre::Mesh::IndexMap::const_iterator i=indexMap.begin(),i_=indexMap.end() ; i!=i_; ++i) {\n *(xform++) = parent->boneWorldMatrixes[*i];\n }\n\n } else {\n\n // All animations disabled, use parent GfxBody world transform only\n std::fill_n(xform, indexMap.size(), parent->toOgre());\n }\n}\n\nOgre::Real GfxBody::Sub::getSquaredViewDepth (const Ogre::Camera* cam) const\n{\n Ogre::Vector3 diff = to_ogre(parent->worldTransform.pos) - cam->getDerivedPosition();\n return diff.squaredLength();\n}\n\nstatic Ogre::LightList EMPTY_LIGHTS;\n\nconst Ogre::LightList& GfxBody::Sub::getLights (void) const\n{\n return EMPTY_LIGHTS;\n}\n\nbool GfxBody::Sub::getCastShadows (void) const\n{\n return parent->getCastShadows();\n}\n\nconst Ogre::MaterialPtr& GfxBody::Sub::getMaterial(void) const\n{\n return parent->renderMaterial;\n}\n\n\n// }}}\n\n\n\n\n\n// {{{ RENDERING\n\nvoid GfxBody::updateBoneMatrixes (void)\n{\n if (skeleton) {\n\n //update the current hardware animation state\n skeleton->setAnimationState(animationState);\n skeleton->_getBoneMatrices(boneMatrixes);\n\n updateWorldTransform();\n\n Ogre::OptimisedUtil::getImplementation()->concatenateAffineMatrices(\n toOgre(),\n boneMatrixes,\n boneWorldMatrixes,\n numBoneMatrixes);\n }\n}\n\nvoid GfxBody::_updateRenderQueue(Ogre::RenderQueue* queue)\n{\n bool shadow_cast =\n ogre_sm->_getCurrentRenderStage() == Ogre::SceneManager::IRS_RENDER_TO_TEXTURE;\n\n if (!enabled || fade < 0.000001 || firstPerson) return;\n\n bool do_wireframe = (wireframe || gfx_option(GFX_WIREFRAME));\n bool do_regular = !do_wireframe || gfx_option(GFX_WIREFRAME_SOLID);\n\n // fade is used by both shadow_cast and regular pass\n // we could potentially move this out of the frame loop if it affects performance\n for (unsigned i=0 ; i<subList.size() ; ++i) {\n Sub *sub = subList[i];\n sub->setCustomParameter(0, Ogre::Vector4(fade,0,0,0));\n }\n\n if (shadow_cast) {\n\n // Add each visible Sub to the queue\n for (unsigned i=0 ; i<subList.size() ; ++i) {\n\n Sub *sub = subList[i];\n\n GfxMaterial *m = sub->material;\n\n if (!sub->getCastShadows()) continue;\n if (!m->getCastShadows()) continue;\n\n // Ogre chases ->getTechnique(0)->getShadowCasterMaterial() to get the actual one\n // which is m->castMat\n renderMaterial = m->regularMat;\n\n queue->addRenderable(sub, 0, 0);\n }\n\n } else {\n\n // Add each visible Sub to the queue\n for (unsigned i=0 ; i<subList.size() ; ++i) {\n\n Sub *sub = subList[i];\n\n // car paint\n for (int k=0 ; k<4 ; ++k) {\n const GfxPaintColour &c = colours[k];\n // The 0th one is fade\n sub->setCustomParameter(4*k+1, Ogre::Vector4(c.diff.x, c.diff.y, c.diff.z, 0));\n sub->setCustomParameter(4*k+2, Ogre::Vector4(c.met, 0, 0, 0));\n sub->setCustomParameter(4*k+3, Ogre::Vector4(c.gloss, 0, 0, 0));\n sub->setCustomParameter(4*k+4, Ogre::Vector4(c.spec, 0, 0, 0));\n }\n\n GfxMaterial *m = sub->material;\n\n if (do_regular) {\n\n // TODO: Warn if mesh does not have required vertex attributes for this material\n // taking into account dead code due to particular uniform values.\n // E.g. vertex coluors, alpha, normals, tangents, extra tex coords.\n\n /* TODO: Pick a specific material by\n * bones: 1 2 3 4\n * Fading: false/true\n */\n\n /*\n if (fade < 1 && m->getSceneBlend() == GFX_MATERIAL_OPAQUE) {\n renderMaterial = m->fadingMat;\n } else {\n renderMaterial = m->regularMat;\n }\n */\n renderMaterial = m->regularMat;\n\n int queue_group = RQ_GBUFFER_OPAQUE;\n switch (m->getSceneBlend()) {\n case GFX_MATERIAL_OPAQUE: queue_group = RQ_GBUFFER_OPAQUE; break;\n case GFX_MATERIAL_ALPHA: queue_group = RQ_FORWARD_ALPHA; break;\n case GFX_MATERIAL_ALPHA_DEPTH: queue_group = RQ_FORWARD_ALPHA_DEPTH; break;\n }\n queue->addRenderable(sub, queue_group, 0);\n\n if (m->getAdditionalLighting() && sub->emissiveEnabled) {\n renderMaterial = m->additionalMat;\n switch (m->getSceneBlend()) {\n case GFX_MATERIAL_OPAQUE: queue_group = RQ_FORWARD_OPAQUE_EMISSIVE; break;\n case GFX_MATERIAL_ALPHA: queue_group = RQ_FORWARD_ALPHA_EMISSIVE; break;\n case GFX_MATERIAL_ALPHA_DEPTH: queue_group = RQ_FORWARD_ALPHA_DEPTH_EMISSIVE; break;\n }\n queue->addRenderable(sub, queue_group, 0);\n }\n }\n\n if (do_wireframe) {\n renderMaterial = m->wireframeMat;\n queue->addRenderable(sub, RQ_FORWARD_ALPHA, 0);\n }\n\n }\n\n }\n\n renderMaterial.setNull();\n\n}\n\nvoid GfxBody::visitRenderables(Ogre::Renderable::Visitor* visitor, bool)\n{\n // Visit each Sub\n for (SubList::iterator i = subList.begin(); i != subList.end(); ++i) {\n GfxMaterial *m = (*i)->material;\n // Commenting these out as they appear to be set anyway in _updateRenderQueue\n renderMaterial = m->regularMat;\n visitor->visit(*i, 0, false);\n renderMaterial.setNull();\n }\n}\n\n\nconst Ogre::AxisAlignedBox& GfxBody::getBoundingBox(void) const\n{\n return mesh->getBounds();\n}\n\nOgre::Real GfxBody::getBoundingRadius(void) const\n{\n return mesh->getBoundingSphereRadius();\n}\n\n // }}}\n\n\n\n\n\n\n\n\n\nstatic const std::string &apply_map (const GfxStringMap &sm, const std::string &s)\n{\n GfxStringMap::const_iterator i = sm.find(s);\n return i==sm.end() ? s : i->second;\n}\n\nGfxBodyPtr GfxBody::make (const std::string &mesh_name,\n const GfxStringMap &sm,\n const GfxNodePtr &par_)\n{\n auto gdr = disk_resource_use<GfxMeshDiskResource>(mesh_name);\n if (gdr == nullptr) GRIT_EXCEPT(\"Resource is not a mesh: \\\"\" + mesh_name + \"\\\"\");\n\n return GfxBodyPtr(new GfxBody(gdr, sm, par_));\n}\n\nGfxBody::GfxBody (const DiskResourcePtr<GfxMeshDiskResource> &gdr, const GfxStringMap &sm,\n const GfxNodePtr &par_)\n : GfxFertileNode(par_), initialMaterialMap(sm), gdr(gdr)\n{\n node->attachObject(this);\n\n mesh = gdr->getOgreMeshPtr();\n\n mesh->load();\n\n memset(colours, 0, sizeof(colours));\n\n fade = 1;\n enabled = true;\n castShadows = true;\n skeleton = NULL;\n wireframe = false;\n firstPerson = false;\n\n reinitialise();\n}\n\nunsigned GfxBody::getSubMeshByOriginalMaterialName (const std::string &n)\n{\n for (unsigned i=0 ; i<mesh->getNumSubMeshes() ; ++i) {\n Ogre::SubMesh *sm = mesh->getSubMesh(i);\n if (sm->getMaterialName() == n) {\n return i;\n }\n }\n CERR << \"Mesh did not contain material \\\"\"<<n<<\"\\\"\" <<std::endl;\n return 0;\n}\n\nvoid GfxBody::updateBones (void)\n{\n if (skeleton == NULL) {\n manualBones.clear();\n return;\n }\n manualBones.resize(skeleton->getNumBones());\n for (unsigned i=0 ; i<skeleton->getNumBones() ; ++i) {\n skeleton->getBone(i)->setManuallyControlled(manualBones[i]);\n }\n skeleton->_notifyManualBonesDirty(); // HACK: ogre should do this itself\n}\n\nvoid GfxBody::destroyGraphics (void)\n{\n for (SubList::iterator i=subList.begin(),i_=subList.end() ; i!=i_ ; ++i) {\n delete *i;\n }\n subList.clear();\n \n if (skeleton) {\n OGRE_FREE_SIMD(boneWorldMatrixes, Ogre::MEMCATEGORY_ANIMATION);\n OGRE_DELETE skeleton;\n OGRE_FREE_SIMD(boneMatrixes, Ogre::MEMCATEGORY_ANIMATION);\n }\n}\n\nvoid GfxBody::reinitialise (void)\n{\n APP_ASSERT(mesh->isLoaded());\n\n destroyGraphics();\n\n for (unsigned short i = 0; i < mesh->getNumSubMeshes(); ++i) {\n Ogre::SubMesh *sm = mesh->getSubMesh(i);\n Sub* sub = new Sub(this, sm);\n subList.push_back(sub);\n GFX_MAT_SYNC;\n std::string matname = apply_map(initialMaterialMap, sm->getMaterialName());\n if (!gfx_material_has(matname)) {\n CERR << \"Mesh \\\"/\"<<mesh->getName()<<\"\\\" references non-existing material \"\n << \"\\\"\"<<matname<<\"\\\"\"<<std::endl;\n matname = \"/system/FallbackMaterial\";\n }\n sub->material = gfx_material_get(matname);\n }\n\n\n if (!mesh->getSkeleton().isNull()) {\n skeleton = OGRE_NEW Ogre::SkeletonInstance(mesh->getSkeleton());\n skeleton->load();\n numBoneMatrixes = skeleton->getNumBones();\n boneMatrixes = static_cast<Ogre::Matrix4*>(OGRE_MALLOC_SIMD(sizeof(Ogre::Matrix4) * numBoneMatrixes, Ogre::MEMCATEGORY_ANIMATION));\n boneWorldMatrixes = static_cast<Ogre::Matrix4*>(OGRE_MALLOC_SIMD(sizeof(Ogre::Matrix4) * numBoneMatrixes, Ogre::MEMCATEGORY_ANIMATION));\n\n mesh->_initAnimationState(&animationState);\n } else {\n skeleton = NULL;\n numBoneMatrixes = 0;\n boneMatrixes = NULL;\n boneWorldMatrixes = NULL;\n }\n\n updateBones();\n}\n\nGfxBody::~GfxBody (void)\n{\n if (!dead) destroy();\n}\n\nvoid GfxBody::destroy (void)\n{\n if (dead) THROW_DEAD(className);\n destroyGraphics();\n setFirstPerson(false); // Remove it from the set.\n GfxFertileNode::destroy();\n}\n\nGfxMaterial *GfxBody::getMaterial (unsigned i)\n{\n if (i >= subList.size()) GRIT_EXCEPT(\"Submesh id out of range. \");\n return subList[i]->material;\n}\n\nconst std::string &GfxBody::getOriginalMaterialName (unsigned i)\n{\n if (i >= subList.size()) GRIT_EXCEPT(\"Submesh id out of range. \");\n return mesh->getSubMesh(i)->getMaterialName();\n}\n\nvoid GfxBody::setMaterial (unsigned i, GfxMaterial *m)\n{\n if (i >= subList.size()) GRIT_EXCEPT(\"Submesh id out of range. \");\n if (subList[i]->material == m) return;\n subList[i]->material = m;\n}\n\nbool GfxBody::getEmissiveEnabled (unsigned i)\n{\n if (i >= subList.size()) GRIT_EXCEPT(\"Submesh id out of range. \");\n return subList[i]->emissiveEnabled;\n}\n\nvoid GfxBody::setEmissiveEnabled (unsigned i, bool v)\n{\n if (i >= subList.size()) GRIT_EXCEPT(\"Submesh id out of range. \");\n subList[i]->emissiveEnabled = v;\n}\n\nunsigned GfxBody::getBatches (void) const\n{\n return subList.size();\n}\n\nunsigned GfxBody::getBatchesWithChildren (void) const\n{\n return getBatches() + GfxFertileNode::getBatchesWithChildren();\n}\n\nunsigned GfxBody::getVertexes (void) const\n{\n return mesh->sharedVertexData->vertexCount;\n}\n\nunsigned GfxBody::getVertexesWithChildren (void) const\n{\n return getVertexes() + GfxFertileNode::getVertexesWithChildren();\n}\n\nunsigned GfxBody::getTriangles (void) const\n{\n unsigned total = 0;\n for (unsigned i=0 ; i<subList.size() ; ++i) {\n total += subList[i]->getSubMesh()->indexData->indexCount/3;\n }\n return total;\n}\n\nunsigned GfxBody::getTrianglesWithChildren (void) const\n{\n return getTriangles() + GfxFertileNode::getTrianglesWithChildren();\n}\n\nfloat GfxBody::getFade (void)\n{\n if (dead) THROW_DEAD(className);\n return fade;\n}\nvoid GfxBody::setFade (float f)\n{\n if (dead) THROW_DEAD(className);\n fade = f;\n}\n\nbool GfxBody::getCastShadows (void)\n{\n return castShadows;\n}\nvoid GfxBody::setCastShadows (bool v)\n{\n if (dead) THROW_DEAD(className);\n castShadows = v;\n}\n\nbool GfxBody::getWireframe (void)\n{\n return wireframe;\n}\nvoid GfxBody::setWireframe (bool v)\n{\n if (dead) THROW_DEAD(className);\n wireframe = v;\n}\n\nbool GfxBody::getFirstPerson (void)\n{\n return firstPerson;\n}\nvoid GfxBody::setFirstPerson (bool v)\n{\n if (dead) THROW_DEAD(className);\n if (firstPerson == v) return;\n firstPerson = v;\n if (firstPerson) {\n first_person_bodies.insert(this);\n } else {\n first_person_bodies.erase(this);\n }\n}\n\nGfxPaintColour GfxBody::getPaintColour (int i)\n{\n if (dead) THROW_DEAD(className);\n return colours[i];\n}\nvoid GfxBody::setPaintColour (int i, const GfxPaintColour &c)\n{\n if (dead) THROW_DEAD(className);\n colours[i] = c;\n}\n\nunsigned GfxBody::getNumBones (void) const\n{\n if (dead) THROW_DEAD(className);\n return manualBones.size();\n}\n\nbool GfxBody::hasBoneName (const std::string name) const\n{\n if (dead) THROW_DEAD(className);\n if (skeleton == NULL) GRIT_EXCEPT(\"GfxBody has no skeleton\");\n return skeleton->hasBone(name);\n}\n\nunsigned GfxBody::getBoneId (const std::string name) const\n{\n if (dead) THROW_DEAD(className);\n if (skeleton == NULL) GRIT_EXCEPT(\"GfxBody has no skeleton\");\n if (!skeleton->hasBone(name)) GRIT_EXCEPT(\"GfxBody has no bone \\\"\"+name+\"\\\"\");\n return skeleton->getBone(name)->getHandle();\n}\n\nvoid GfxBody::checkBone (unsigned n) const\n{\n if (dead) THROW_DEAD(className);\n if (manualBones.size()==0) GRIT_EXCEPT(\"GfxBody has no skeleton\");\n if (n >= manualBones.size()) {\n std::stringstream ss;\n ss << \"Bone \" << n << \" out of range [0,\" << manualBones.size() << \")\";\n GRIT_EXCEPT(ss.str());\n }\n}\n\nconst std::string &GfxBody::getBoneName (unsigned n) const\n{\n checkBone(n);\n return skeleton->getBone(n)->getName();\n}\n\nbool GfxBody::getBoneManuallyControlled (unsigned n)\n{\n checkBone(n);\n return manualBones[n];\n}\n\nvoid GfxBody::setBoneManuallyControlled (unsigned n, bool v)\n{\n checkBone(n);\n manualBones[n] = v;\n updateBones();\n}\n\nvoid GfxBody::setAllBonesManuallyControlled (bool v)\n{\n if (dead) THROW_DEAD(className);\n for (unsigned i=0 ; i<manualBones.size() ; ++i) {\n manualBones[i] = v;\n }\n updateBones();\n}\n\nVector3 GfxBody::getBoneInitialPosition (unsigned n)\n{\n checkBone(n);\n Ogre::Bone *bone = skeleton->getBone(n);\n return from_ogre(bone->getInitialPosition());\n}\n\nVector3 GfxBody::getBoneWorldPosition (unsigned n)\n{\n checkBone(n);\n Ogre::Bone *bone = skeleton->getBone(n);\n return from_ogre(bone->_getDerivedPosition());\n}\n\nVector3 GfxBody::getBoneLocalPosition (unsigned n)\n{\n checkBone(n);\n Ogre::Bone *bone = skeleton->getBone(n);\n return from_ogre(bone->getPosition());\n}\n\nQuaternion GfxBody::getBoneInitialOrientation (unsigned n)\n{\n checkBone(n);\n Ogre::Bone *bone = skeleton->getBone(n);\n return from_ogre(bone->getInitialOrientation());\n}\n\nQuaternion GfxBody::getBoneWorldOrientation (unsigned n)\n{\n checkBone(n);\n Ogre::Bone *bone = skeleton->getBone(n);\n return from_ogre(bone->_getDerivedOrientation());\n}\n\nQuaternion GfxBody::getBoneLocalOrientation (unsigned n)\n{\n checkBone(n);\n Ogre::Bone *bone = skeleton->getBone(n);\n return from_ogre(bone->getOrientation());\n}\n\nVector3 GfxBody::getBoneInitialScale (unsigned n)\n{\n checkBone(n);\n Ogre::Bone *bone = skeleton->getBone(n);\n return from_ogre(bone->getInitialScale());\n}\n\nVector3 GfxBody::getBoneWorldScale (unsigned n)\n{\n checkBone(n);\n Ogre::Bone *bone = skeleton->getBone(n);\n return from_ogre(bone->_getDerivedScale());\n}\n\nVector3 GfxBody::getBoneLocalScale (unsigned n)\n{\n checkBone(n);\n Ogre::Bone *bone = skeleton->getBone(n);\n return from_ogre(bone->getScale());\n}\n\n\nTransform GfxBody::getBoneWorldTransform (unsigned n)\n{\n checkBone(n);\n Ogre::Bone *bone = skeleton->getBone(n);\n Transform t(from_ogre(bone->_getDerivedPosition()), from_ogre(bone->_getDerivedOrientation()), from_ogre(bone->_getDerivedScale()));\n updateWorldTransform();\n return worldTransform * t;\n}\n\n\nvoid GfxBody::setBoneLocalPosition (unsigned n, const Vector3 &v)\n{\n checkBone(n);\n Ogre::Bone *bone = skeleton->getBone(n);\n bone->setPosition(to_ogre(v));\n}\n\nvoid GfxBody::setBoneLocalOrientation (unsigned n, const Quaternion &v)\n{\n checkBone(n);\n Ogre::Bone *bone = skeleton->getBone(n);\n bone->setOrientation(to_ogre(v));\n}\n\nvoid GfxBody::setBoneLocalScale (unsigned n, const Vector3 &v)\n{\n checkBone(n);\n Ogre::Bone *bone = skeleton->getBone(n);\n bone->setScale(to_ogre(v));\n}\n\nstd::vector<std::string> GfxBody::getAnimationNames (void)\n{\n std::vector<std::string> r;\n\n if (dead) THROW_DEAD(className);\n\n if (skeleton == NULL) GRIT_EXCEPT(\"GfxBody has no skeleton\");\n \n Ogre::AnimationStateIterator it = animationState.getAnimationStateIterator();\n\n while (it.hasMoreElements()) r.push_back(it.getNext()->getAnimationName());\n\n return r;\n}\n\nOgre::AnimationState *GfxBody::getAnimState (const std::string &name)\n{\n if (skeleton == NULL) GRIT_EXCEPT(\"GfxBody has no skeleton\");\n Ogre::AnimationState *state = animationState.getAnimationState(name);\n if (state == NULL) GRIT_EXCEPT(\"GfxBody has no animation called \\\"\"+name+\"\\\"\");\n return state;\n}\n\nfloat GfxBody::getAnimationLength (const std::string &name)\n{\n if (dead) THROW_DEAD(className);\n return getAnimState(name)->getLength();\n}\n\nfloat GfxBody::getAnimationPos (const std::string &name)\n{\n if (dead) THROW_DEAD(className);\n return getAnimState(name)->getTimePosition();\n}\n\nvoid GfxBody::setAnimationPos (const std::string &name, float v)\n{\n if (dead) THROW_DEAD(className);\n getAnimState(name)->setTimePosition(v);\n}\n\nfloat GfxBody::getAnimationMask (const std::string &name)\n{\n if (dead) THROW_DEAD(className);\n Ogre::AnimationState *state = getAnimState(name);\n if (!state->getEnabled()) return 0.0f;\n return state->getWeight();\n}\n\nvoid GfxBody::setAnimationMask (const std::string &name, float v)\n{\n if (dead) THROW_DEAD(className);\n Ogre::AnimationState *state = getAnimState(name);\n state->setWeight(v);\n state->setEnabled(v > 0.0f);\n}\n\nbool GfxBody::isEnabled (void)\n{\n if (dead) THROW_DEAD(className);\n return enabled;\n}\n\nvoid GfxBody::setEnabled (bool v)\n{\n if (dead) THROW_DEAD(className);\n enabled = v;\n}\n\nstd::string GfxBody::getMeshName (void) const\n{\n return \"/\" + mesh->getName();\n}\n\n\nvoid GfxBody::renderFirstPerson (const GfxShaderGlobals &g,\n bool alpha_blend)\n{\n if (!enabled || fade < 0.000001) return;\n\n bool do_wireframe = (wireframe || gfx_option(GFX_WIREFRAME));\n bool do_regular = !do_wireframe || gfx_option(GFX_WIREFRAME_SOLID);\n\n bool fade_dither = fade < 1;\n bool instanced = false;\n unsigned bone_weights = mesh->getNumBlendWeightsPerVertex();\n\n const Ogre::Matrix4 world = toOgre();\n\n // TODO(dcunnin): object parameters\n\n // this is to protect the material to texture mappings which might be\n // concurrently read by the background loading thread\n // TODO: use a RW lock to avoid stalls\n GFX_MAT_SYNC;\n\n for (unsigned i=0 ; i<subList.size() ; ++i) {\n\n Sub *sub = subList[i];\n\n GfxMaterial *mat = sub->material;\n\n // Skip if wrong kind of material for this set of passes\n bool mat_alpha = mat->getSceneBlend() != GFX_MATERIAL_OPAQUE;\n if (alpha_blend != mat_alpha) continue;\n\n bool pass_fade_dither = fade_dither && !mat_alpha;\n\n Ogre::SubMesh *sm = mesh->getSubMesh(i);\n\n if (do_regular) {\n \n // render sm using mat\n const GfxTextureStateMap &mat_texs = mat->getTextures();\n mat->getShader()->bindShader(\n GFX_GSL_PURPOSE_FIRST_PERSON, pass_fade_dither, instanced, bone_weights, g, world,\n boneWorldMatrixes, numBoneMatrixes, fade, colours, mat_texs, mat->getBindings());\n\n switch (mat->getSceneBlend()) {\n case GFX_MATERIAL_OPAQUE:\n ogre_rs->_setDepthBufferParams(true, true, Ogre::CMPF_LESS_EQUAL);\n ogre_rs->_setSceneBlending(Ogre::SBF_ONE, Ogre::SBF_ZERO);\n break;\n case GFX_MATERIAL_ALPHA:\n ogre_rs->_setDepthBufferParams(true, false, Ogre::CMPF_LESS_EQUAL);\n ogre_rs->_setSceneBlending(Ogre::SBF_ONE, Ogre::SBF_ONE_MINUS_SOURCE_ALPHA);\n break;\n case GFX_MATERIAL_ALPHA_DEPTH:\n ogre_rs->_setDepthBufferParams(true, true, Ogre::CMPF_LESS_EQUAL);\n ogre_rs->_setSceneBlending(Ogre::SBF_ONE, Ogre::SBF_ONE_MINUS_SOURCE_ALPHA);\n break;\n }\n\n ogre_rs->_setPolygonMode(Ogre::PM_SOLID);\n ogre_rs->setStencilCheckEnabled(false);\n ogre_rs->_setDepthBias(0, 0);\n\n Ogre::RenderOperation op;\n sm->_getRenderOperation(op);\n ogre_rs->_render(op);\n\n for (unsigned i=0 ; i<mat_texs.size() ; ++i) {\n ogre_rs->_disableTextureUnit(i);\n }\n }\n\n if (do_wireframe) {\n\n mat->getShader()->bindShader(\n GFX_GSL_PURPOSE_FIRST_PERSON_WIREFRAME, pass_fade_dither, instanced, bone_weights, g,\n world, boneWorldMatrixes, numBoneMatrixes, fade, colours, GfxTextureStateMap(),\n mat->getBindings());\n\n ogre_rs->_setDepthBufferParams(true, false, Ogre::CMPF_LESS_EQUAL);\n ogre_rs->_setSceneBlending(Ogre::SBF_ONE, Ogre::SBF_ZERO);\n ogre_rs->_setPolygonMode(Ogre::PM_WIREFRAME);\n ogre_rs->_setCullingMode(Ogre::CULL_NONE);\n ogre_rs->setStencilCheckEnabled(false);\n ogre_rs->_setDepthBias(1, 0);\n\n Ogre::RenderOperation op;\n sm->_getRenderOperation(op);\n ogre_rs->_render(op);\n }\n \n }\n\n}\n\n\nvoid gfx_body_render_first_person (GfxPipeline *p, bool alpha_blend)\n{\n // Gbuffer stores depth from 0 to 1 (cam to far clip plane), so we could render first person\n // bodies into the gbuffer even though they have different clip planes. However I think this\n // would have shadow artifacts. So instead, I'll treat it as a point when lighting it, i.e.\n // sample shadow buffer at a point and intersect the camera with the point lights to determine\n // the ones that should be used to light us.\n\n Ogre::Frustum frustum; // Used to calculate projection matrix.\n frustum.setFOVy(Ogre::Degree(p->getCameraOpts().fovY));\n frustum.setAspectRatio(p->getCamera()->getAspectRatio());\n frustum.setNearClipDistance(gfx_option(GFX_FIRST_PERSON_NEAR_CLIP));\n frustum.setFarClipDistance(gfx_option(GFX_FIRST_PERSON_FAR_CLIP));\n // No 3d effect on first person objects (TODO: I think that's right, need to actually verify)\n frustum.setFrustumOffset(0);\n frustum.setFocalLength(1);\n\n GfxShaderGlobals g =\n gfx_shader_globals_cam(p, frustum.getProjectionMatrix());\n\n // Render, to HDR buffer\n // TODO: receive shadow\n // TODO: instancing\n\n for (const auto &body : first_person_bodies) {\n body->renderFirstPerson(g, alpha_blend);\n }\n}\n" }, { "alpha_fraction": 0.5812785625457764, "alphanum_fraction": 0.5831050276756287, "avg_line_length": 37.421051025390625, "blob_id": "1b01e4ac60f2cd29b21806d7b58cab773bdd557f", "content_id": "fc752a6a07bc4949a22fdeaaa93ed1bb19d408ee", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 2190, "license_type": "permissive", "max_line_length": 95, "num_lines": 57, "path": "/dependencies/quex-0.34.1/quex/code_base/template/token_receiving_via_queue.i", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "// -*- C++ -*- vim: set syntax=cpp:\nnamespace quex { \n inline void\n CLASS::get_token(__QUEX_SETTING_TOKEN_CLASS_NAME** result_pp) \n // NOTE: As long as the 'get_token()' function is not called there is nothing\n // happening to the token in the queue. But, a parser very probably\n // does a couple af calls to 'get_token()' before a rule triggers \n // and data structures can be stored.\n //\n // ARGUMENTS:\n // result_p points to memory where token information has to be stored.\n // TIP:\n // result_p could point into the token queue directly (TODO), if a limit \n // number can be defined so that the token queue does not overwrite it, as\n // long as the parser is chewing on it.\n //\n // RETURNS:\n // Token-ID of the currently read token.\n // Token-ID = '$$TOKEN_CLASS$$::ID_UNITIALIZED' is returned in \n // case that no token could be read.\n {\n __quex_assert(_token_queue != 0x0);\n // (i) tokens are in queue --> take next token from stack\n if( _token_queue->is_empty() == false ) {\n // DEBUG \n *result_pp = _token_queue->quick_pop();\n return;\n }\n\n# if ! defined(QUEX_OPTION_AUTOMATIC_ANALYSIS_CONTINUATION_ON_MODE_CHANGE)\n QuexAnalyser::current_analyser_function(this);\n# else\n do { \n QuexAnalyser::current_analyser_function(this);\n\n // In case a mode change happend inside the pattern actions, the function is forced\n // to return (see end of analyzer function at REENTRY label). If the tokenstack is\n // non-empty, we return to the caller (spare one check). If its empty the analyzer\n // function (which has recently been setup) is called again.\n } while ( _token_queue->is_empty() );\n# endif\n\n *result_pp = _token_queue->quick_pop();\n return;\n }\n\n inline QUEX_TOKEN_ID_TYPE\n CLASS::get_token(__QUEX_SETTING_TOKEN_CLASS_NAME* result_p) \n {\n __QUEX_SETTING_TOKEN_CLASS_NAME* tmp = 0x0;\n get_token(&tmp);\n *result_p = *tmp;\n return result_p->type_id();\n }\n\n\n}\n" }, { "alpha_fraction": 0.4385964870452881, "alphanum_fraction": 0.4385964870452881, "avg_line_length": 17, "blob_id": "b0de7346b03cbbfc96f79006df32beaf19972e02", "content_id": "a7c73353ed69fd9a1211522617fbb9bb6d506746", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 399, "license_type": "permissive", "max_line_length": 64, "num_lines": 22, "path": "/dependencies/quex-0.34.1/demo/005/simple.qx", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "// -*- C++ -*-\n\ntoken {\n INCLUDE\n IDENTIFIER\n BRACKET_OPEN\n BRACKET_CLOSE\n NUMBER\n}\n\nmode ONE_AND_ONLY\n{\n <<EOF>> => QUEX_TKN_TERMINATION;\n\n \"(\" => QUEX_TKN_BRACKET_OPEN;\n \")\" => QUEX_TKN_BRACKET_CLOSE;\n //\n \"include\" => QUEX_TKN_INCLUDE;\n //\n ([_a-zA-Z]|(\"/\"|\".\"|\"'\"))+ => QUEX_TKN_IDENTIFIER(Lexeme); \n [ \\t\\r\\n]+ { }\n}\n\n\n\n" }, { "alpha_fraction": 0.5599928498268127, "alphanum_fraction": 0.5718697309494019, "avg_line_length": 25.332290649414062, "blob_id": "d13963b8a10e4e0c523056c2edd2368c65e37144", "content_id": "41f9844958289ad5b981ef1ad4a3054d254b9745", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 33679, "license_type": "permissive", "max_line_length": 95, "num_lines": 1279, "path": "/engine/lua_wrappers_core.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <limits.h>\n\n#ifdef USE_GOOGLE_PERF_TOOLS\n #include <google/profiler.h>\n#endif\n\n#ifndef WIN32\n #include <sys/mman.h>\n#endif\n\n#include <sleep.h>\n\n#include <lua_stack.h>\n#include <lua_utf8.h>\n#include <io_util.h>\n\n#include \"audio/lua_wrappers_audio.h\"\n#include \"background_loader.h\"\n#include <centralised_log.h>\n#include \"clipboard.h\"\n#include \"core_option.h\"\n#include \"gfx/gfx_disk_resource.h\"\n#include \"gfx/lua_wrappers_gfx.h\"\n#include \"grit_lua_util.h\"\n#include \"input_filter.h\"\n#include \"joystick.h\"\n#include \"keyboard.h\"\n#include \"lua_wrappers_disk_resource.h\"\n#include \"lua_wrappers_gritobj.h\"\n#include \"lua_wrappers_primitives.h\"\n#include \"main.h\"\n#include \"mouse.h\"\n#include \"navigation/lua_wrappers_navigation.h\"\n#include \"net/lua_wrappers_net.h\"\n#include \"path_util.h\"\n#include \"physics/lua_wrappers_physics.h\"\n\n#define IFILTER_TAG \"Grit/InputFilter\"\n\n\n// INPUT_FILTER ========================================================== {{{\n\nstatic int ifilter_make (lua_State *L)\n{\nTRY_START\n check_args(L, 2);\n double order = luaL_checknumber(L, 1);\n std::string desc = check_string(L, 2);\n InputFilter *self = new InputFilter(order, desc);\n push(L, self, IFILTER_TAG);\n return 1;\nTRY_END\n}\n\nstatic int ifilter_tostring (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n GET_UD_MACRO(InputFilter, self, 1, IFILTER_TAG);\n std::stringstream ss;\n ss << IFILTER_TAG << \" \" << static_cast<void*>(&self) << \" (\" << self.order << \") \\\"\"\n << self.description << \"\\\"\";\n lua_pushstring(L, ss.str().c_str());\n return 1;\nTRY_END\n}\n\nstatic int ifilter_gc (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n GET_UD_MACRO(InputFilter, self, 1, IFILTER_TAG);\n if (self.isAlive()) self.destroy(L);\n delete &self;\n return 0;\nTRY_END\n}\n\nstatic int ifilter_pressed (lua_State *L)\n{\nTRY_START\n check_args(L, 2);\n GET_UD_MACRO(InputFilter, self, 1, IFILTER_TAG);\n std::string button = check_string(L, 2);\n lua_pushboolean(L, self.isButtonPressed(button));\n return 1;\nTRY_END\n}\n\nstatic int ifilter_bind (lua_State *L)\n{\nTRY_START\n if (lua_gettop(L) < 3) EXCEPT << \"InputFilter.bind takes at least 3 arguments.\" << ENDL;\n while (lua_gettop(L) < 5) lua_pushnil(L);\n check_args(L, 5);\n GET_UD_MACRO(InputFilter, self, 1, IFILTER_TAG);\n std::string button = check_string(L, 2);\n self.bind(L, button);\n return 0;\nTRY_END\n}\n\nstatic int ifilter_unbind (lua_State *L)\n{\nTRY_START\n check_args(L, 2);\n GET_UD_MACRO(InputFilter, self, 1, IFILTER_TAG);\n std::string button = check_string(L, 2);\n self.unbind(L, button);\n return 0;\nTRY_END\n}\n\nstatic int ifilter_destroy (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n GET_UD_MACRO(InputFilter, self, 1, IFILTER_TAG);\n self.destroy(L);\n return 0;\nTRY_END\n}\n\nstatic int ifilter_index (lua_State *L)\n{\nTRY_START\n check_args(L, 2);\n GET_UD_MACRO(InputFilter, self, 1, IFILTER_TAG);\n std::string key = luaL_checkstring(L, 2);\n if (key == \"order\") {\n lua_pushnumber(L, self.order);\n } else if (key == \"description\") {\n push_string(L, self.description);\n } else if (key == \"enabled\") {\n lua_pushboolean(L, self.getEnabled());\n } else if (key == \"modal\") {\n lua_pushboolean(L, self.getModal());\n } else if (key == \"mouseCapture\") {\n lua_pushboolean(L, self.getMouseCapture());\n } else if (key == \"bind\") {\n push_cfunction(L, ifilter_bind);\n } else if (key == \"unbind\") {\n push_cfunction(L, ifilter_unbind);\n } else if (key == \"pressed\") {\n push_cfunction(L, ifilter_pressed);\n } else if (key == \"binds\") {\n std::vector<std::string> binds = self.allBinds();\n lua_createtable(L, binds.size(), 0);\n for (unsigned i=0 ; i<binds.size() ; ++i) {\n push_string(L, binds[i]);\n lua_rawseti(L, -2, i + 1);\n }\n } else if (key == \"destroy\") {\n push_cfunction(L, ifilter_destroy);\n } else {\n my_lua_error(L, \"Not a readable InputFilter member: \" + key);\n }\n return 1;\nTRY_END\n}\n\nstatic int ifilter_newindex (lua_State *L)\n{\nTRY_START\n check_args(L, 3);\n GET_UD_MACRO(InputFilter, self, 1, IFILTER_TAG);\n std::string key = luaL_checkstring(L, 2);\n if (key == \"enabled\") {\n bool v = check_bool(L, 3);\n self.setEnabled(L, v);\n } else if (key == \"modal\") {\n bool v = check_bool(L, 3);\n self.setModal(L, v);\n } else if (key == \"mouseCapture\") {\n bool v = check_bool(L, 3);\n self.setMouseCapture(L, v);\n } else if (key == \"mouseMoveCallback\") {\n if (lua_type(L, 3) != LUA_TFUNCTION) {\n EXCEPT << \"mouseMoveCallback expects a function.\" << ENDL;\n }\n self.setMouseMoveCallback(L);\n } else {\n EXCEPT << \"Not a writeable InputFilter member: \" << key << ENDL;\n }\n return 0;\nTRY_END\n}\n\nEQ_PTR_MACRO(InputFilter, ifilter, IFILTER_TAG)\n\nMT_MACRO_NEWINDEX(ifilter);\n\n\n//}}}\n\n\n// GLOBAL LIBRARY ========================================================== {{{\n\nstatic int global_have_focus (lua_State *L)\n{\nTRY_START\n check_args(L, 0);\n lua_pushboolean(L, keyboard->hasFocus());\n return 1;\nTRY_END\n}\n\nstatic int global_get_keyb_presses (lua_State *L)\n{\nTRY_START\n check_args(L, 0);\n Keyboard::Presses presses = keyboard->getPresses();\n\n lua_createtable(L, presses.size(), 0);\n for (unsigned int i=0 ; i<presses.size() ; i++) {\n const char *key = presses[i].c_str();\n lua_pushnumber(L, i + 1);\n lua_pushstring(L, key);\n lua_settable(L, -3);\n }\n\n return 1;\nTRY_END\n}\n\nstatic int global_get_keyb_verbose (lua_State *L)\n{\nTRY_START\n check_args(L, 0);\n lua_pushboolean(L, keyboard->getVerbose());\n return 1;\nTRY_END\n}\n\nstatic int global_set_keyb_verbose (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n bool b = check_bool(L, 1);\n keyboard->setVerbose(b);\n return 0;\nTRY_END\n}\n\nstatic int global_get_mouse_events (lua_State *L)\n{\nTRY_START\n check_args(L, 0);\n\n int rel_x, rel_y, x, y;\n std::vector<int> clicks;\n bool moved = mouse->getEvents(&clicks, &x, &y, &rel_x, &rel_y);\n\n lua_pushboolean(L, moved);\n\n lua_createtable(L, clicks.size(), 0);\n for (unsigned int i=0 ; i<clicks.size() ; i++) {\n int button = clicks[i];\n lua_pushnumber(L, i + 1);\n const char *button_ = \"unknown\";\n switch (button) {\n case Mouse::MOUSE_LEFT: button_=\"+left\" ; break;\n case -Mouse::MOUSE_LEFT: button_=\"-left\" ; break;\n case Mouse::MOUSE_MIDDLE: button_=\"+middle\" ; break;\n case -Mouse::MOUSE_MIDDLE: button_=\"-middle\" ; break;\n case Mouse::MOUSE_RIGHT: button_=\"+right\" ; break;\n case -Mouse::MOUSE_RIGHT: button_=\"-right\" ; break;\n case Mouse::MOUSE_SCROLL_UP: button_=\"+up\" ; break;\n case -Mouse::MOUSE_SCROLL_UP: button_=\"-up\" ;break;\n case Mouse::MOUSE_SCROLL_DOWN: button_=\"+down\" ; break;\n case -Mouse::MOUSE_SCROLL_DOWN: button_=\"-down\" ;break;\n }\n lua_pushstring(L, button_);\n lua_settable(L, -3);\n }\n\n lua_pushnumber(L, x);\n lua_pushnumber(L, y);\n lua_pushnumber(L, rel_x);\n lua_pushnumber(L, rel_y);\n\n return 6;\nTRY_END\n}\n\nstatic int global_get_joystick_events (lua_State *L)\n{\nTRY_START\n\n check_args(L, 0);\n\n std::vector<signed char> buttons_indexes_and_values;\n std::vector<signed char> axes_indexes;\n std::vector<short int> axes_values; \n\n bool moved = joystick->getEvents(&buttons_indexes_and_values, &axes_indexes, &axes_values);\n\n lua_pushboolean(L, moved);\n\n lua_createtable(L, buttons_indexes_and_values.size(), 0);\n for (unsigned int i=0 ; i<buttons_indexes_and_values.size() ; i++) {\n int button = buttons_indexes_and_values[i];\n lua_pushnumber(L, i + 1);\n const char *button_ = \"unknown\";\n \n switch (button) {\n case Joystick::JOYSTICK_BUTTON1: button_=\"+js01\" ; break;\n case -Joystick::JOYSTICK_BUTTON1: button_=\"-js01\" ; break;\n case Joystick::JOYSTICK_BUTTON2: button_=\"+js02\" ; break;\n case -Joystick::JOYSTICK_BUTTON2: button_=\"-js02\" ; break;\n case Joystick::JOYSTICK_BUTTON3: button_=\"+js03\" ; break;\n case -Joystick::JOYSTICK_BUTTON3: button_=\"-js03\" ; break;\n case Joystick::JOYSTICK_BUTTON4: button_=\"+js04\" ; break;\n case -Joystick::JOYSTICK_BUTTON4: button_=\"-js04\" ;break;\n case Joystick::JOYSTICK_BUTTON5: button_=\"+js05\" ; break;\n case -Joystick::JOYSTICK_BUTTON5: button_=\"-js05\" ;break;\n case Joystick::JOYSTICK_BUTTON6: button_=\"+js06\" ; break;\n case -Joystick::JOYSTICK_BUTTON6: button_=\"-js06\" ; break;\n case Joystick::JOYSTICK_BUTTON7: button_=\"+js07\" ; break;\n case -Joystick::JOYSTICK_BUTTON7: button_=\"-js07\" ; break;\n case Joystick::JOYSTICK_BUTTON8: button_=\"+js08\" ; break;\n case -Joystick::JOYSTICK_BUTTON8: button_=\"-js08\" ; break;\n case Joystick::JOYSTICK_BUTTON9: button_=\"+js09\" ; break;\n case -Joystick::JOYSTICK_BUTTON9: button_=\"-js09\" ;break;\n case Joystick::JOYSTICK_BUTTON10: button_=\"+js10\" ; break;\n case -Joystick::JOYSTICK_BUTTON10: button_=\"-js10\" ;break;\n case Joystick::JOYSTICK_BUTTON11: button_=\"+js11\" ; break;\n case -Joystick::JOYSTICK_BUTTON11: button_=\"-js11\" ;break;\n }\n\n lua_pushstring(L, button_);\n lua_settable(L, -3);\n }\n\n if (axes_indexes.size() == axes_values.size()) {\n lua_createtable(L, axes_indexes.size(), 0);\n for (unsigned int i=0 ; i<axes_indexes.size() ; i++) {\n double axe_index = axes_indexes[i];\n double axe_value = axes_values[i];\n double pushvalue = (axe_value/32767.0); \n lua_pushnumber(L, i + 1);\n lua_pushvector2(L, axe_index, pushvalue);\n lua_settable(L, -3);\n }\n\n return 3;\n }\n\n return 2;\nTRY_END\n}\n\nstatic int global_input_filter_trickle_mouse_move (lua_State *L)\n{\nTRY_START\n check_args(L, 2);\n Vector2 rel = check_v2(L, 1);\n Vector2 abs = check_v2(L, 2);\n input_filter_trickle_mouse_move(L, rel, abs);\n return 0;\nTRY_END\n}\n\nstatic int global_input_filter_trickle_button (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n const char *str = luaL_checkstring(L, 1);\n input_filter_trickle_button(L, str);\n return 0;\nTRY_END\n}\n\nstatic int global_input_filter_pressed (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n const char *str = luaL_checkstring(L, 1);\n lua_pushboolean(L, input_filter_pressed(str));\n return 1;\nTRY_END\n}\n\nstatic int global_input_filter_flush (lua_State *L)\n{\nTRY_START\n check_args(L, 0);\n input_filter_flush(L);\n return 0;\nTRY_END\n}\n\nstatic int global_input_filter_map (lua_State *L)\n{\nTRY_START\n check_args(L, 0);\n std::vector<std::pair<double, std::string>> filters = input_filter_list();\n lua_createtable(L, filters.size(), 0);\n int top_table = lua_gettop(L);\n for (unsigned int i=0 ; i<filters.size() ; i++) {\n lua_pushnumber(L, filters[i].first);\n push_string(L, filters[i].second);\n lua_settable(L, top_table);\n }\n return 1;\nTRY_END\n}\n\nstatic int global_input_filter_get_cursor_hidden (lua_State *L)\n{\nTRY_START\n check_args(L, 0);\n lua_pushboolean(L, input_filter_get_cursor_hidden());\n return 1;\nTRY_END\n}\n\nstatic int global_input_filter_set_cursor_hidden (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n bool v = check_bool(L, 1);\n input_filter_set_cursor_hidden(v);\n return 0;\nTRY_END\n}\n\n\n\n\n////////////////////////////////////////////////////////////////////////////////\n\nstatic int global_get_alloc_stats (lua_State *L)\n{\nTRY_START\n check_args(L, 0);\n size_t counter, mallocs, reallocs, frees;\n lua_alloc_stats_get(counter, mallocs, reallocs, frees);\n lua_pushnumber(L, counter);\n lua_pushnumber(L, mallocs);\n lua_pushnumber(L, reallocs);\n lua_pushnumber(L, frees);\n return 4;\nTRY_END\n}\n\nstatic int global_set_alloc_stats (lua_State *L)\n{\nTRY_START\n check_args(L, 3);\n size_t mallocs = check_t<size_t>(L, 1);\n size_t reallocs = check_t<size_t>(L, 2); \n size_t frees = check_t<size_t>(L, 3);\n lua_alloc_stats_set(mallocs, reallocs, frees);\n return 0;\nTRY_END\n}\n\nstatic int global_reset_alloc_stats (lua_State *L)\n{\nTRY_START\n check_args(L, 0);\n lua_alloc_stats_set(0, 0, 0);\n return 0;\nTRY_END\n}\n\nstatic int global_get_in_queue_size (lua_State *L)\n{\nTRY_START\n check_args(L, 0);\n size_t sz = bgl->size();\n lua_pushnumber(L, sz);\n return 1;\nTRY_END\n}\n\nstatic int global_get_out_queue_size_gpu (lua_State *L)\n{\nTRY_START\n check_args(L, 0);\n size_t sz = bgl->getLRUQueueSizeGPU();\n lua_pushnumber(L, sz);\n return 1;\nTRY_END\n}\n\nstatic int global_get_out_queue_size_host (lua_State *L)\n{\nTRY_START\n check_args(L, 0);\n size_t sz = bgl->getLRUQueueSizeHost();\n lua_pushnumber(L, sz);\n return 1;\nTRY_END\n}\n\n\nstatic int global_give_queue_allowance (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n float amount = check_float(L, 1);\n bgl->setAllowance(amount);\n return 0;\nTRY_END\n}\n\n\nstatic int global_handle_bastards (lua_State *L)\n{\nTRY_START\n check_args(L, 0);\n bgl->handleBastards();\n return 0;\nTRY_END\n}\n\nstatic int global_check_ram_gpu (lua_State *L)\n{\nTRY_START\n check_args(L, 0);\n bgl->checkRAMGPU();\n return 0;\nTRY_END\n}\n\nstatic int global_check_ram_host (lua_State *L)\n{\nTRY_START\n check_args(L, 0);\n bgl->checkRAMHost();\n return 0;\nTRY_END\n}\n\n\nstatic int global_clicked_close (lua_State *L)\n{\nTRY_START\n check_args(L, 0);\n lua_pushboolean(L, clicked_close);\n return 1;\nTRY_END\n}\n\n\nstatic int global_get_clipboard (lua_State *L)\n{\nTRY_START\n check_args(L, 0);\n lua_pushstring(L, clipboard_get().c_str());\n return 1;\nTRY_END\n}\n\nstatic int global_set_clipboard (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n std::string s = luaL_checkstring(L, 1);\n clipboard_set(s);\n return 0;\nTRY_END\n}\n\nstatic int global_get_clipboard_selection (lua_State *L)\n{\nTRY_START\n check_args(L, 0);\n lua_pushstring(L, clipboard_selection_get().c_str());\n return 1;\nTRY_END\n}\n\nstatic int global_set_clipboard_selection (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n std::string s = luaL_checkstring(L, 1);\n clipboard_selection_set(s);\n return 0;\nTRY_END\n}\n\n\nstatic int global_sleep_micros (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n lua_Number micros = luaL_checknumber(L, 1);\n mysleep((long)micros);\n return 0;\nTRY_END\n}\n\nstatic int global_sleep_seconds (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n lua_Number secs = luaL_checknumber(L, 1);\n mysleep((long)(1E6*secs));\n return 0;\nTRY_END\n}\n\nstatic int global_micros (lua_State *L)\n{\nTRY_START\n check_args(L, 0);\n lua_pushnumber(L, micros());\n return 1;\nTRY_END\n}\n\nstatic int global_seconds (lua_State *L)\n{\nTRY_START\n check_args(L, 0);\n lua_pushnumber(L, micros()/1000000.0);\n return 1;\nTRY_END\n}\n\nstatic int global_error (lua_State *L)\n{\nTRY_START\n if (lua_gettop(L) != 1 && lua_gettop(L) != 2) {\n check_args(L, 2);\n }\n\n const char *msg = luaL_checkstring(L, 1);\n unsigned long level = 1;\n if (lua_gettop(L) == 2) {\n level = check_t<unsigned long>(L, 2);\n }\n my_lua_error(L, msg, level);\n\n return 0;\nTRY_END\n}\n\n\nstatic int global_error_handler (lua_State *L)\n{\nTRY_START\n my_lua_error_handler(L);\n return 0;\nTRY_END\n}\n\n\nstatic int global_print (lua_State *L)\n{\nTRY_START\n std::stringstream ss;\n int args = lua_gettop(L);\n for (int i=1 ; i<=args ; ++i) {\n if (i > 1) ss << \"\\t\";\n if (lua_isstring(L, i)) {\n ss << lua_tostring(L, i);\n } else {\n lua_pushglobaltable(L);\n lua_getfield(L, -1, \"dump\");\n lua_remove(L, -2); //global table\n lua_pushvalue(L, i);\n lua_call(L, 1, 1);\n ss << lua_tostring(L, -1);\n lua_pop(L, 1);\n }\n }\n clog.print(ss.str());\n return 0;\nTRY_END\n}\n\n\nstatic int global_console_poll (lua_State *L)\n{\nTRY_START\n check_args(L, 0);\n lua_pushstring(L, clog.consolePoll().c_str());\n return 1;\nTRY_END\n}\n\n\nstatic int global_check_nan (lua_State *L)\n{\nTRY_START\n std::stringstream msg;\n for (int i=1 ; i <= lua_gettop(L) ; ++i) {\n float w, x, y, z;\n switch (lua_type(L, i)) {\n case LUA_TNUMBER:\n if (std::isnan(lua_tonumber(L, i))) {\n msg << \"Got NaN in number, index \" << i;\n my_lua_error(L, msg.str());\n }\n break;\n\n case LUA_TVECTOR2:\n lua_checkvector2(L, i, &x, &y);\n if (std::isnan(x)) {\n msg << \"Got NaN in vec2 x coord, index \" << i;\n my_lua_error(L, msg.str());\n }\n if (std::isnan(y)) {\n msg << \"Got NaN in vec2 y coord, index \" << i;\n my_lua_error(L, msg.str());\n }\n break;\n\n case LUA_TVECTOR3:\n lua_checkvector3(L, i, &x, &y, &z);\n if (std::isnan(x)) {\n msg << \"Got NaN in vec3 x coord, index \" << i;\n my_lua_error(L, msg.str());\n }\n if (std::isnan(y)) {\n msg << \"Got NaN in vec3 y coord, index \" << i;\n my_lua_error(L, msg.str());\n }\n if (std::isnan(z)) {\n msg << \"Got NaN in vec3 z coord, index \" << i;\n my_lua_error(L, msg.str());\n }\n break;\n\n case LUA_TVECTOR4:\n lua_checkvector4(L, i, &x, &y, &z, &w);\n if (std::isnan(x)) {\n msg << \"Got NaN in vec4 x coord, index \" << i;\n my_lua_error(L, msg.str());\n }\n if (std::isnan(y)) {\n msg << \"Got NaN in vec4 y coord, index \" << i;\n my_lua_error(L, msg.str());\n }\n if (std::isnan(z)) {\n msg << \"Got NaN in vec4 z coord, index \" << i;\n my_lua_error(L, msg.str());\n }\n if (std::isnan(w)) {\n msg << \"Got NaN in vec4 w coord, index \" << i;\n my_lua_error(L, msg.str());\n }\n break;\n\n case LUA_TQUAT:\n lua_checkquat(L, i, &x, &y, &z, &w);\n if (std::isnan(w)) {\n msg << \"Got NaN in quat w coord, index \" << i;\n my_lua_error(L, msg.str());\n }\n if (std::isnan(x)) {\n msg << \"Got NaN in quat x coord, index \" << i;\n my_lua_error(L, msg.str());\n }\n if (std::isnan(y)) {\n msg << \"Got NaN in quat y coord, index \" << i;\n my_lua_error(L, msg.str());\n }\n if (std::isnan(z)) {\n msg << \"Got NaN in quat z coord, index \" << i;\n my_lua_error(L, msg.str());\n }\n break;\n\n default:;\n // No other types can have NaN.\n }\n }\n return 0;\nTRY_END\n}\n\n\nstatic int global_profiler_start (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n #ifdef USE_GOOGLE_PERF_TOOLS\n std::string filename = luaL_checkstring(L, 1);\n ProfilerStart(filename.c_str());\n #else\n my_lua_error(L, \"Not compiled with USE_GOOGLE_PERF_TOOLS\");\n #endif\n return 0;\nTRY_END\n}\n\n\nstatic int global_profiler_stop (lua_State *L)\n{\nTRY_START\n check_args(L, 0);\n #ifdef USE_GOOGLE_PERF_TOOLS\n ProfilerStop();\n #else\n my_lua_error(L, \"Not compiled with USE_GOOGLE_PERF_TOOLS\");\n #endif\n return 0;\nTRY_END\n}\n\n\nstatic int global_mlockall (lua_State *L)\n{\nTRY_START\n check_args(L, 0);\n #ifdef WIN32\n // just fail silently\n //my_lua_error(L, \"mlockall not supported on Windows.\");\n #else\n mlockall(MCL_CURRENT | MCL_FUTURE);\n #endif\n return 0;\nTRY_END\n}\n\n\nstatic int global_munlockall (lua_State *L)\n{\nTRY_START\n check_args(L, 0);\n #ifdef WIN32\n // just fail silently\n //my_lua_error(L, \"mlockall not supported on Windows.\");\n #else\n munlockall();\n #endif\n return 0;\nTRY_END\n}\n\n\nstruct LuaIncludeState {\n Ogre::DataStreamPtr ds;\n char buf[16384];\n};\n\nstatic const char *aux_aux_include (lua_State *L, void *ud, size_t *size)\n{\n (void) L;\n LuaIncludeState &lis = *static_cast<LuaIncludeState*>(ud);\n *size = lis.ds->read(lis.buf, sizeof(lis.buf));\n return lis.buf;\n}\n\n\nstatic int aux_include (lua_State *L, const std::string &filename)\n{\n std::string fname(filename, 1); // strip leading /\n if (!Ogre::ResourceGroupManager::getSingleton().resourceExists(\"GRIT\", fname)) {\n lua_pushfstring(L, \"File not found: \\\"%s\\\"\", filename.c_str());\n return LUA_ERRFILE;\n }\n LuaIncludeState lis;\n lis.ds = Ogre::ResourceGroupManager::getSingleton().openResource(fname, \"GRIT\");\n // Last argument means it will accept either binary or text files.\n return lua_load(L, aux_aux_include, &lis, (\"@\" + filename).c_str(), \"bt\");\n}\n\n\nstatic int global_import_str (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n std::string filename = luaL_checkstring(L, 1);\n std::string fname(filename, 1); // strip leading /\n\n if (!Ogre::ResourceGroupManager::getSingleton().resourceExists(\"GRIT\", fname))\n my_lua_error(L, \"File not found: \\\"\" + filename + \"\\\"\");\n\n Ogre::DataStreamPtr ds\n = Ogre::ResourceGroupManager::getSingleton().openResource(fname, \"GRIT\");\n push_string(L, ds->getAsString());\n\n return 1;\nTRY_END\n}\n\nstatic int global_include (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n std::string filename = check_path(L, 1);\n\n // stack: [filename]\n int status = aux_include(L, filename);\n if (status) {\n // stack: [filename, error_string]\n const char *str = lua_tostring(L, -1);\n // call error function manually, lua will not do this for us in lua_load\n my_lua_error(L, str);\n // stack: [filename]\n return 0;\n } else {\n // stack: [filename, function]\n lua_call(L, 0, LUA_MULTRET);\n // stack: [filename, ?]\n return lua_gettop(L) - 1;\n }\nTRY_END\n}\n\nstatic int global_safe_include (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n std::string filename = check_path(L, 1);\n\n lua_pushboolean(L, true);\n\n // stack: [filename, true]\n int status = aux_include(L, filename);\n if (status) {\n // stack: [filename, true, error_string]\n // The 'true' on the stack never gets used in this case.\n\n // Propagate errors that aren't \"file not found\".\n if (status != LUA_ERRFILE) {\n const char *str = lua_tostring(L, -1);\n my_lua_error(L, str);\n }\n // stack: [filename, true, error_string]\n lua_pop(L, 1);\n // stack: [filename, true]\n lua_pushboolean(L, false);\n // stack: [filename, true, false]\n return 1;\n\n } else {\n // stack: [filename, true, function]\n lua_call(L, 0, LUA_MULTRET);\n // stack: [filename, true, ?]\n return lua_gettop(L) - 1;\n }\nTRY_END\n}\n\nstatic int global_current_dir (lua_State *L)\n{\n int level = 1;\n if (lua_gettop(L) == 1) {\n level = check_t<int>(L, 1);\n } else {\n check_args(L, 0);\n }\n std::string dir = lua_current_dir(L, level);\n push_string(L, dir);\n return 1;\n}\n\nstatic int global_core_option_reset (lua_State *L)\n{\nTRY_START\n check_args(L, 0);\n core_option_reset();\n return 0;\nTRY_END\n}\n\nstatic int global_core_option (lua_State *L)\n{\nTRY_START\n if (lua_gettop(L) == 2) {\n std::string opt = check_string(L, 1);\n int t;\n CoreBoolOption o0;\n CoreIntOption o1;\n CoreFloatOption o2;\n core_option_from_string(opt, t, o0, o1, o2);\n switch (t) {\n case -1: my_lua_error(L, \"Unrecognised core option: \\\"\" + opt + \"\\\"\");\n case 0: core_option(o0, check_bool(L, 2)); break;\n case 1: core_option(o1, check_t<int>(L, 2)); break;\n case 2: core_option(o2, check_float(L, 2)); break;\n default: my_lua_error(L, \"Unrecognised type from core_option_from_string\");\n }\n return 0;\n } else {\n check_args(L, 1);\n std::string opt = check_string(L, 1);\n int t;\n CoreBoolOption o0;\n CoreIntOption o1;\n CoreFloatOption o2;\n core_option_from_string(opt, t, o0, o1, o2);\n switch (t) {\n case -1: my_lua_error(L, \"Unrecognised core option: \\\"\" + opt + \"\\\"\");\n case 0: lua_pushboolean(L, core_option(o0)); break;\n case 1: lua_pushnumber(L, core_option(o1)); break;\n case 2: lua_pushnumber(L, core_option(o2)); break;\n default: my_lua_error(L, \"Unrecognised type from core_option_from_string\");\n }\n return 1;\n }\nTRY_END\n}\n\n\nstatic lua_Number game_time = 0;\ntypedef std::map<lua_Number, std::vector<LuaPtr*> > EventMap;\nstatic EventMap event_map;\n\nstatic void add_event (lua_State *L, lua_Number countdown)\n{\n LuaPtr *lp = new LuaPtr();\n lp->setNoPop(L);\n event_map[countdown + game_time].push_back(lp);\n}\n\nstatic int global_future_event (lua_State *L)\n{\nTRY_START\n check_args(L, 2);\n lua_Number countdown = luaL_checknumber(L, 1);\n if (!lua_isfunction(L, 2)) my_lua_error(L, \"Argument 2 must be a function.\");\n add_event(L, countdown);\n return 0;\nTRY_END\n}\n\nstatic int global_clear_events (lua_State *L)\n{\nTRY_START\n check_args(L, 0);\n for (EventMap::iterator i=event_map.begin(), i_=event_map.end() ; i != i_ ; ++i) {\n for (unsigned j=0 ; j<i->second.size() ; ++j) {\n i->second[j]->setNil(L);\n delete i->second[j];\n }\n }\n event_map.clear();\n return 0;\nTRY_END\n}\n\nstatic int global_dump_events (lua_State *L)\n{\nTRY_START\n check_args(L, 0);\n lua_newtable(L);\n int counter = 1;\n for (EventMap::iterator i=event_map.begin(), i_=event_map.end() ; i != i_ ; ++i) {\n for (unsigned j=0 ; j<i->second.size() ; ++j) {\n i->second[j]->push(L);\n lua_rawseti(L, -2, counter++);\n lua_pushnumber(L, i->first);\n lua_rawseti(L, -2, counter++);\n }\n }\n return 1;\nTRY_END\n}\n\nstatic int global_do_events (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n lua_Number elapsed = luaL_checknumber(L, 1);\n \n lua_pushcfunction(L, my_lua_error_handler);\n int error_handler = lua_gettop(L);\n\n game_time += elapsed;\n do {\n // stack: eh\n EventMap::iterator i = event_map.begin();\n if (i == event_map.end()) break;\n lua_Number time = i->first;\n std::vector<LuaPtr*> &events = i->second;\n if (time > game_time) break;\n for (unsigned j=0 ; j<events.size() ; ++j) {\n // stack: eh\n LuaPtr *func = events[j];\n func->push(L);\n // stack: eh, func\n int status = lua_pcall(L, 0, 1, error_handler);\n if (status) {\n lua_pop(L, 1); // error msg\n } else {\n // stack: eh, r\n if (!lua_isnil(L, -1)) {\n if (!lua_isnumber(L, -1)) {\n CERR << \"Return type of event must be number or nil.\" << std::endl;\n } else {\n lua_Number r = lua_tonumber(L, -1);\n func->push(L);\n add_event(L, r);\n lua_pop(L, 1);\n }\n // stack: eh, r;\n }\n lua_pop(L, 1);\n // stack: eh\n }\n func->setNil(L);\n delete func;\n // stack: eh\n }\n event_map.erase(i);\n } while (true);\n return 0;\nTRY_END\n}\n\n\n\nstatic const luaL_reg global[] = {\n\n {\"core_option_reset\", global_core_option_reset},\n {\"core_option\", global_core_option},\n {\"import_str\", global_import_str},\n {\"include\", global_include},\n {\"safe_include\", global_safe_include},\n {\"current_dir\", global_current_dir},\n {\"error\", global_error},\n {\"error_handler\", global_error_handler},\n {\"print\", global_print},\n {\"console_poll\", global_console_poll},\n {\"check_nan\", global_check_nan},\n\n {\"clicked_close\", global_clicked_close},\n {\"have_focus\", global_have_focus},\n\n {\"get_keyb_presses\", global_get_keyb_presses},\n {\"set_keyb_verbose\", global_set_keyb_verbose},\n {\"get_keyb_verbose\", global_get_keyb_verbose},\n {\"get_mouse_events\", global_get_mouse_events},\n {\"get_joystick_events\", global_get_joystick_events},\n {\"micros\", global_micros},\n {\"seconds\", global_seconds},\n {\"sleep_seconds\", global_sleep_seconds},\n {\"sleep_micros\", global_sleep_micros},\n {\"sleep\", global_sleep_micros},\n {\"get_clipboard\", global_get_clipboard},\n {\"set_clipboard\", global_set_clipboard},\n {\"get_clipboard_selection\", global_get_clipboard_selection},\n {\"set_clipboard_selection\", global_set_clipboard_selection},\n\n {\"get_alloc_stats\", global_get_alloc_stats},\n {\"set_alloc_stats\", global_set_alloc_stats},\n {\"reset_alloc_stats\", global_reset_alloc_stats},\n\n {\"get_in_queue_size\", global_get_in_queue_size},\n {\"get_out_queue_size_gpu\", global_get_out_queue_size_gpu},\n {\"get_out_queue_size_host\", global_get_out_queue_size_host},\n {\"give_queue_allowance\", global_give_queue_allowance},\n {\"handle_bastards\", global_handle_bastards},\n {\"check_ram_gpu\", global_check_ram_gpu},\n {\"check_ram_host\", global_check_ram_host},\n\n {\"mlockall\", global_mlockall},\n {\"munlockall\", global_munlockall},\n\n {\"profiler_start\", global_profiler_start},\n {\"profiler_stop\", global_profiler_stop},\n\n {\"input_filter_trickle_button\", global_input_filter_trickle_button},\n {\"input_filter_trickle_mouse_move\", global_input_filter_trickle_mouse_move},\n {\"input_filter_pressed\", global_input_filter_pressed},\n {\"input_filter_flush\", global_input_filter_flush},\n {\"input_filter_map\", global_input_filter_map},\n {\"input_filter_get_cursor_hidden\", global_input_filter_get_cursor_hidden},\n {\"input_filter_set_cursor_hidden\", global_input_filter_set_cursor_hidden},\n\n {\"InputFilter\", ifilter_make},\n {\"PlotV3\", plot_v3_make},\n {\"Plot\", plot_make},\n {\"StringDB\", stringdb_make},\n\n {\"future_event\", global_future_event},\n {\"clear_events\", global_clear_events},\n {\"dump_events\", global_dump_events},\n {\"do_events\", global_do_events},\n\n {NULL, NULL}\n};\n\n//}}}\n\n\n// GENERAL CODE ============================================================ {{{\n\nstatic int lua_panic(lua_State *L)\n{\nTRY_START\n lua_checkstack(L, 2);\n if (lua_type(L, -1) == LUA_TTABLE) {\n lua_rawgeti(L, -1, 2);\n }\n\n std::string err = luaL_checkstring(L, -1);\n CERR<<\"PANIC! \"<<err<<std::endl;\n app_fatal();\n return 0;\nTRY_END\n}\n\nvoid init_lua (const char *filename, const std::vector<std::string> &args, lua_State *&L)\n{\n L = lua_newstate(lua_alloc, NULL);\n lua_atpanic(L, lua_panic);\n\n luaL_openlibs(L);\n\n push_cfunction(L, my_lua_error_handler);\n int error_handler = lua_gettop(L);\n\n ADD_MT_MACRO(ifilter, IFILTER_TAG);\n ADD_MT_MACRO(plot, PLOT_TAG);\n ADD_MT_MACRO(plot_v3, PLOT_V3_TAG);\n ADD_MT_MACRO(stringdb, STRINGDB_TAG);\n\n lua_getglobal(L, \"print\");\n lua_setglobal(L, \"print_stdout\");\n\n register_lua_globals(L, global);\n\n utf8_lua_init(L);\n gritobj_lua_init(L);\n gfx_lua_init(L);\n physics_lua_init(L);\n audio_lua_init(L);\n disk_resource_lua_init(L);\n net_lua_init(L);\n navigation_lua_init(L);\n\n int status = aux_include(L, filename);\n if (status) {\n std::string str = lua_tostring(L, -1);\n lua_pop(L, 1); // message\n EXCEPT << \"Loading Lua file: \" << str << std::endl;\n } else {\n check_stack(L, args.size());\n for (const auto &arg : args) {\n push_string(L, arg);\n }\n // error handler should print stacktrace and stuff\n status = lua_pcall(L, args.size(), 0, error_handler);\n if (status) {\n lua_pop(L, 1); //message\n EXCEPT << \"Error running init script.\" << ENDL;\n }\n }\n lua_pop(L, 1); //error handler\n}\n\nvoid shutdown_lua (lua_State *L)\n{\n lua_close(L);\n func_map_leak_all();\n}\n\n//}}}\n" }, { "alpha_fraction": 0.6970103979110718, "alphanum_fraction": 0.6993618011474609, "avg_line_length": 43.969696044921875, "blob_id": "0f6e66310090b2e05f8952fc4c3ed130b5acaed3", "content_id": "227ab334192fa954fc1a483b98b0ababe8dea01b", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2977, "license_type": "permissive", "max_line_length": 98, "num_lines": 66, "path": "/dependencies/quex-0.34.1/quex/core_engine/state_machine/index.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "# special states:\nfrom copy import deepcopy, copy\n\ndef clear():\n global __internal_state_index_counter\n global __map_combination_to_index\n global __map_state_machine_id_to_state_machine\n global __internal_state_machine_id_counter\n __internal_state_index_counter = long(-1)\n __map_combination_to_index = {}\n __map_state_machine_id_to_state_machine = {} \n __internal_state_machine_id_counter = long(-1)\n\n# The index is chosen to be globally unique, even though, there is a constraint\n# that all target indices of a state machine must be also start indices. For connecting\n# state machines though, it is much easier to rely on a globaly unique state index.\n#\n# NOTE: The index is stored in a 'long' variable. If this variable flows over, then\n# we are likely not be able to implement our state machine due to memory shortage\n# anyway.\n__internal_state_index_counter = long(-1)\ndef get():\n \"\"\"Returns a unique state index.\"\"\"\n global __internal_state_index_counter\n __internal_state_index_counter += long(1)\n return __internal_state_index_counter\n\n__map_combination_to_index = {}\ndef map_state_combination_to_index(cc_combination):\n \"\"\"Returns index for the given combination. If the given combination\n does **not** have an index, it gets a new one. Else the existing one is\n returned.\"\"\"\n cc_combination.sort()\n key_str = repr(cc_combination)\n\n if not __map_combination_to_index.has_key(key_str):\n # use state_machine.index.get() to get a new unique index for the combination\n __map_combination_to_index[key_str] = get() \n \n return __map_combination_to_index[key_str]\n\n__internal_state_machine_id_counter = long(-1)\ndef get_state_machine_id():\n \"\"\"Produces a unique id for the state machine. This function is only to be called\n from inside the constructor of class StateMachine.\"\"\"\n global __internal_state_machine_id_counter\n __internal_state_machine_id_counter += long(1)\n return __internal_state_machine_id_counter \n\nDELETED__map_state_machine_id_to_state_machine = {} \ndef DELETED_register_state_machine(StateMachineRef):\n \"\"\"Produces a unique id for the state machine. This function is only to be called\n from inside the constructor of class StateMachine.\"\"\"\n assert StateMachineRef not in __map_state_machine_id_to_state_machine.values(), \\\n \"error: tried to register state machine twice\"\n \n global __internal_state_machine_id_counter\n __internal_state_machine_id_counter += long(1)\n # add the state machine under the give key to the database\n __map_state_machine_id_to_state_machine[__internal_state_machine_id_counter] = StateMachineRef\n return __internal_state_machine_id_counter \n \ndef DELETED_get_state_machine_by_id(StateMachineID):\n assert __map_state_machine_id_to_state_machine.has_key(StateMachineID)\n\n return __map_state_machine_id_to_state_machine[StateMachineID] \n \n" }, { "alpha_fraction": 0.7743732333183289, "alphanum_fraction": 0.7910863757133484, "avg_line_length": 21.375, "blob_id": "63b597095739dc35e95f1e5cfbeea7968b0c43a3", "content_id": "e1eea49114dfa45eba00b44e802352666398e6a4", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C", "length_bytes": 359, "license_type": "permissive", "max_line_length": 38, "num_lines": 16, "path": "/dependencies/stdafx/stdafx.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "#include <Ogre.h>\n#include <OgreDepthBuffer.h>\n#include <OgreMeshFileFormat.h>\n#include <OgreOptimisedUtil.h>\n#include <OgrePredefinedControllers.h>\n\n#ifdef WIN32\n#include <OgreD3D9RenderSystem.h>\n#include <OgreD3D9HLSLProgram.h>\n#endif\n\n#include <OgreOctreePlugin.h>\n#include <OgreOctreeSceneManager.h>\n\n#include <OgreCgPlugin.h>\n#include <OgreCgProgram.h>\n\n" }, { "alpha_fraction": 0.6316823959350586, "alphanum_fraction": 0.6332547068595886, "avg_line_length": 23.69902992248535, "blob_id": "c8bdebd79a5218ad38c6f943fde5e5a654f93aff", "content_id": "2f3149f4f5179cb9d5b4fe6c9be687216f3ca73e", "detected_licenses": [ "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer", "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 2544, "license_type": "permissive", "max_line_length": 96, "num_lines": 103, "path": "/dependencies/quex-0.34.1/quex/code_base/template/mode_handling.i", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "// -*- C++ -*- vim:set syntax=cpp:\nnamespace quex { \ninline QuexMode&\nCLASS::mode() \n{ return *__current_mode_p; }\n\ninline int\nCLASS::mode_id() const\n{ return __current_mode_p->id; }\n\ninline const char*\nCLASS::mode_name() const\n{ return __current_mode_p->name; }\n\ninline void\nCLASS::set_mode_brutally(const int ModeID)\n{ set_mode_brutally(*(mode_db[ModeID])); }\n\ninline void \nCLASS::set_mode_brutally(const QuexMode& Mode) \n{ \n __current_mode_p = (QuexMode*)&Mode;\n QuexAnalyser::current_analyser_function = Mode.analyser_function; \n}\n\ninline void\nCLASS::__debug_print_transition(QuexMode* Source, QuexMode* Target)\n{\n# ifdef QUEX_OPTION_DEBUG_MODE_TRANSITIONS\n# ifdef QUEX_OPTION_LINE_NUMBER_COUNTING\n std::cerr << \"line = \" << line_number_at_begin() << std::endl;\n# endif\n# ifdef QUEX_OPTION_COLUMN_NUMBER_COUNTING\n std::cerr << \"column = \" << column_number_at_begin() << std::endl;\n# endif\n std::cerr << \"FromMode: \" << Source->name << \" ToMode: \" << Target->name << std::endl;\n# endif\n}\n\ninline void \nCLASS::enter_mode(/* NOT const*/ QuexMode& TargetMode) \n{\n /* NOT const */ QuexMode& SourceMode = mode();\n\n /* To be optimized aways if its function body is empty (see above) */\n __debug_print_transition(&SourceMode, &TargetMode); \n\n# ifdef __QUEX_OPTION_ON_EXIT_HANDLER_PRESENT\n SourceMode.on_exit(this, &TargetMode);\n# endif\n set_mode_brutally(TargetMode.id);\n\n# ifdef __QUEX_OPTION_ON_ENTRY_HANDLER_PRESENT\n TargetMode.on_entry(this, &SourceMode); \n# endif\n}\n\ninline void \nCLASS::operator<<(const int ModeID) \n{ enter_mode(map_mode_id_to_mode(ModeID)); }\n\ninline void \nCLASS::operator<<(/* NOT const*/ QuexMode& Mode) \n{ enter_mode(Mode); }\n\n\ninline void \nCLASS::pop_mode() \n{ \n __quex_assert(_mode_stack.size() != 0);\n QuexMode* tmp; \n tmp = _mode_stack.back(); \n _mode_stack.pop_back(); \n enter_mode(*tmp); \n}\n\ninline void\nCLASS::pop_drop_mode() \n{ \n __quex_assert(_mode_stack.size() != 0);\n _mode_stack.pop_back(); // do not care about what was popped\n}\n \ninline void \nCLASS::push_mode(QuexMode& new_mode) \n{ \n _mode_stack.push_back(&(mode())); \n enter_mode(new_mode); \n}\n\n\ninline QuexMode&\nCLASS::map_mode_id_to_mode(const int ModeID)\n{ \n __quex_assert(ModeID >= 0);\n __quex_assert(ModeID < __QUEX_SETTING_MAX_MODE_CLASS_N + 1); // first mode is unused by quex\n return *(mode_db[ModeID]); \n}\n\ninline int \nCLASS::map_mode_to_mode_id(const QuexMode& Mode) const\n{ return Mode.id; }\n}\n" }, { "alpha_fraction": 0.6014344096183777, "alphanum_fraction": 0.6495901346206665, "avg_line_length": 31.5, "blob_id": "39b6800d3c5e38bac22145ea1f758358fbb94b97", "content_id": "c67829638bbacdebbce7756bafa942b5a279dabb", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Lua", "length_bytes": 976, "license_type": "permissive", "max_line_length": 80, "num_lines": 30, "path": "/engine/tests/engine/cast_sphere/test.lua", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "physics_set_material(`/common/pmat/Stone`, 4) -- RoughGroup\ngcol = `test.gcol`\nhold = disk_resource_hold_make(gcol) -- Keep it from being unloaded\ndisk_resource_ensure_loaded(gcol) -- Load it (in rendering thread)\n\nlocal body = physics_body_make(gcol, vec(0, 0, 0), quat(1, 0, 0, 0))\n\nfunction do_test(ray_start, ray)\n local rad = 0.05\n local ray = vec(0, 0, -2)\n local dist = physics_sweep_sphere(rad, ray_start, ray, true, 0)\n local sweep_end = ray_start + dist * ray + rad * norm(ray)\n\n -- Compare with a simple ray\n dist = physics_cast(ray_start, ray, true, 0)\n local cast_end = ray_start + dist * ray\n\n return sweep_end - cast_end\nend\n\nfunction assert_small(v)\n if #v > 0.0001 then\n error(\"Difference between sphere cast and ray cast is too great: \" .. v)\n end\nend\n\nassert_small(do_test(vec(-150, 310, 1.5)))\nassert_small(do_test(vec(98, 14, 1.5)))\nassert_small(do_test(vec(192, -370, 1.5)))\nassert_small(do_test(vec(0, 0, 1.5)))\n\n" }, { "alpha_fraction": 0.44104668498039246, "alphanum_fraction": 0.49505773186683655, "avg_line_length": 31.676254272460938, "blob_id": "cf136cc683c56bb4dc035161e70a3e9975001a4f", "content_id": "50be406ea1d490a528f0153d63b4124dc09a65e9", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 347614, "license_type": "permissive", "max_line_length": 942, "num_lines": 10638, "path": "/dependencies/quex-0.34.1/demo/004/c_lexer-core-engine.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": " /* Information about what pattern 'comes' from what mode in the inheritance tree.\n * \n * [1] pattern, [2] dominating mode, [3] dominating inheritance level, [4] pattern index\n * \n * (PROGRAM)\n * [ \\n\\t] PROGRAM 0 00131\n * \\\"/ *\\\" PROGRAM 0 00133\n * \\\"//\\\" PROGRAM 0 00136\n * \\\"#\\\"[ \\t]*\\\"include\\\"[ \\t]*{P_INCLUDE_FILE2} PROGRAM 0 00161\n * \\\"#\\\"[ \\t]*\\\"include\\\"[ \\t]*{P_INCLUDE_FILE1} PROGRAM 0 00185\n * \\\"#\\\"[ \\t]*\\\"define\\\" PROGRAM 0 00199\n * \\\"#\\\"[ \\t]*\\\"if\\\" PROGRAM 0 00213\n * \\\"#\\\"[ \\t]*\\\"elif\\\" PROGRAM 0 00227\n * \\\"#\\\"[ \\t]*\\\"ifdef\\\" PROGRAM 0 00241\n * \\\"#\\\"[ \\t]*\\\"ifndef\\\" PROGRAM 0 00255\n * \\\"#\\\"[ \\t]*\\\"endif\\\" PROGRAM 0 00269\n * \\\"#\\\"[ \\t]*\\\"else\\\" PROGRAM 0 00283\n * \\\"#\\\"[ \\t]*\\\"pragma\\\" PROGRAM 0 00297\n * \\\"#\\\"[ \\t]*\\\"error\\\" PROGRAM 0 00311\n * defined PROGRAM 0 00313\n * \\\"\\\\\\n\\\" PROGRAM 0 00316\n * unsigned PROGRAM 0 00319\n * int PROGRAM 0 00322\n * long PROGRAM 0 00325\n * float PROGRAM 0 00328\n * double PROGRAM 0 00331\n * char PROGRAM 0 00334\n * \\\"#\\\" PROGRAM 0 00337\n * \\\"##\\\" PROGRAM 0 00340\n * \\\"?\\\" PROGRAM 0 00343\n * \\\"~\\\" PROGRAM 0 00346\n * \\\"(\\\" PROGRAM 0 00349\n * \\\")\\\" PROGRAM 0 00352\n * \\\"[\\\" PROGRAM 0 00355\n * \\\"]\\\" PROGRAM 0 00358\n * \\\"{\\\" PROGRAM 0 00361\n * \\\"}\\\" PROGRAM 0 00364\n * \\\"=\\\" PROGRAM 0 00367\n * \\\"+\\\" PROGRAM 0 00370\n * \\\"-\\\" PROGRAM 0 00373\n * \\\"*\\\" PROGRAM 0 00376\n * \\\"/\\\" PROGRAM 0 00379\n * \\\"%\\\" PROGRAM 0 00382\n * \\\"+=\\\" PROGRAM 0 00385\n * \\\"-=\\\" PROGRAM 0 00388\n * \\\"*=\\\" PROGRAM 0 00391\n * \\\"/=\\\" PROGRAM 0 00394\n * \\\"==\\\" PROGRAM 0 00397\n * \\\"!=\\\" PROGRAM 0 00400\n * \\\">\\\" PROGRAM 0 00403\n * \\\">=\\\" PROGRAM 0 00406\n * \\\"<\\\" PROGRAM 0 00409\n * \\\"<=\\\" PROGRAM 0 00412\n * \\\"!\\\" PROGRAM 0 00415\n * \\\"|\\\" PROGRAM 0 00418\n * \\\"^\\\" PROGRAM 0 00421\n * \\\"||\\\" PROGRAM 0 00424\n * \\\"&\\\" PROGRAM 0 00427\n * \\\"&&\\\" PROGRAM 0 00430\n * \\\":\\\" PROGRAM 0 00433\n * struct PROGRAM 0 00436\n * const PROGRAM 0 00439\n * if PROGRAM 0 00442\n * else PROGRAM 0 00445\n * switch PROGRAM 0 00448\n * for PROGRAM 0 00451\n * do PROGRAM 0 00454\n * while PROGRAM 0 00457\n * break PROGRAM 0 00460\n * continue PROGRAM 0 00463\n * \\\";\\\" PROGRAM 0 00466\n * \\\".\\\" PROGRAM 0 00469\n * \\\",\\\" PROGRAM 0 00472\n * {P_IDENTIFIER} PROGRAM 0 00474\n * {P_NUMBER} PROGRAM 0 00476\n * {P_STRING} PROGRAM 0 00478\n * {P_QUOTED_CHAR} PROGRAM 0 00480\n * \n * \n * \n */\n#include \"c_lexer\"\n#if ! defined(__QUEX_SETTING_PLAIN_C)\nnamespace quex {\n#endif\n#define QUEX_LEXER_CLASS c_lexer\n\n#include <quex/code_base/template/Analyser>\n#include <quex/code_base/buffer/Buffer>\n\n#ifdef CONTINUE\n# undef CONTINUE\n#endif\n#define CONTINUE goto __REENTRY_PREPARATION;\n#include <quex/code_base/temporary_macros_on>\n\n__QUEX_SETTING_ANALYSER_FUNCTION_RETURN_TYPE \nc_lexer_PROGRAM_analyser_function(QuexAnalyser* me) \n{\n /* NOTE: Different modes correspond to different analyser functions. The analyser*/\n /* functions are all located inside the main class as static functions. That*/\n /* means, they are something like 'globals'. They receive a pointer to the */\n /* lexical analyser, since static member do not have access to the 'this' pointer.*/\n# if defined (__QUEX_SETTING_PLAIN_C)\n# define self (*me)\n# else\n using namespace quex;\n QUEX_LEXER_CLASS& self = *((QUEX_LEXER_CLASS*)me);\n# endif\n /* me = pointer to state of the lexical analyser */\n quex::QuexMode& PROGRAM = QUEX_LEXER_CLASS::PROGRAM;\n QUEX_GOTO_LABEL_TYPE last_acceptance = QUEX_GOTO_TERMINAL_LABEL_INIT_VALUE;\n QUEX_CHARACTER_POSITION_TYPE last_acceptance_input_position = (QUEX_CHARACTER_TYPE*)(0x00);\n QUEX_CHARACTER_POSITION_TYPE* post_context_start_position = 0x0;\n const size_t PostContextStartPositionN = (size_t)0;\n QUEX_CHARACTER_TYPE input = (QUEX_CHARACTER_TYPE)(0x00);\n\n /* Post context positions do not have to be reset or initialized. If a state\n * is reached which is associated with 'end of post context' it is clear what\n * post context is meant. This results from the ways the state machine is \n * constructed. A post context positions live time looks like the following:\n *\n * (1) unitialized (don't care)\n * (1.b) on buffer reload it may, or may not be adapted (don't care)\n * (2) when a post context begin state is passed, the it is **SET** (now: take care)\n * (2.b) on buffer reload it **is adapted**.\n * (3) when a terminal state of the post context is reached (which can only be reached\n * for that particular post context, then the post context position is used\n * to reset the input position. */\n#if defined(QUEX_OPTION_AUTOMATIC_ANALYSIS_CONTINUATION_ON_MODE_CHANGE) \\\n || defined(QUEX_OPTION_ASSERTS)\n me->DEBUG_analyser_function_at_entry = me->current_analyser_function;\n#endif\n__REENTRY:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: __REENTRY\");\n QuexBuffer_mark_lexeme_start(&me->buffer);\n QuexBuffer_undo_terminating_zero_for_lexeme(&me->buffer);\n /* state machine */\n /* init-state = 2375L\n * 02375() <~ (131, 408), (133, 417), (136, 427), (161, 555), (185, 693), (199, 765), (213, 809), (227, 861), (241, 921), (255, 988), (269, 1050), (283, 1105), (297, 1171), (311, 1233), (313, 1254), (316, 1268), (319, 1289), (322, 1306), (325, 1320), (328, 1337), (331, 1357), (334, 1374), (337, 1383), (340, 1391), (343, 1398), (346, 1404), (349, 1410), (352, 1416), (355, 1422), (358, 1428), (361, 1434), (364, 1440), (367, 1446), (370, 1452), (373, 1458), (376, 1464), (379, 1470), (382, 1476), (385, 1484), (388, 1493), (391, 1502), (394, 1511), (397, 1520), (400, 1529), (403, 1536), (406, 1544), (409, 1551), (412, 1559), (415, 1566), (418, 1572), (421, 1578), (424, 1586), (427, 1593), (430, 1601), (433, 1608), (436, 1624), (439, 1643), (442, 1655), (445, 1668), (448, 1687), (451, 1702), (454, 1712), (457, 1727), (460, 1745), (463, 1769), (466, 1782), (469, 1788), (472, 1794), (474, 1798), (476, 1802), (478, 1809), (480, 1820)\n * == ['\\t', '\\n'], ' ' ==> 02391\n * == '!' ==> 02396\n * == '\"' ==> 02400\n * == '#' ==> 02386\n * == '%' ==> 02398\n * == '&' ==> 02385\n * == ''' ==> 02403\n * == '(' ==> 02410\n * == ')' ==> 02399\n * == '*' ==> 02404\n * == '+' ==> 02389\n * == ',' ==> 02378\n * == '-' ==> 02379\n * == '.' ==> 02387\n * == '/' ==> 02394\n * == ['0', '9'] ==> 02388\n * == ':' ==> 02408\n * == ';' ==> 02392\n * == '<' ==> 02409\n * == '=' ==> 02412\n * == '>' ==> 02413\n * == '?' ==> 02376\n * == ['A', 'Z'], '_', 'a', ['g', 'h'], ['j', 'k'], ['m', 'r'], 't', 'v', ['x', 'z'] ==> 02415\n * == '[' ==> 02395\n * == '\\' ==> 02397\n * == ']' ==> 02380\n * == '^' ==> 02407\n * == 'b' ==> 02416\n * == 'c' ==> 02414\n * == 'd' ==> 02390\n * == 'e' ==> 02384\n * == 'f' ==> 02393\n * == 'i' ==> 02405\n * == 'l' ==> 02406\n * == 's' ==> 02401\n * == 'u' ==> 02411\n * == 'w' ==> 02402\n * == '{' ==> 02381\n * == '|' ==> 02382\n * == '}' ==> 02377\n * == '~' ==> 02383\n * <no epsilon>\n * 02376(A, S) <~ (343, 1399, A, S)\n * <no epsilon>\n * 02377(A, S) <~ (364, 1441, A, S)\n * <no epsilon>\n * 02378(A, S) <~ (472, 1795, A, S)\n * <no epsilon>\n * 02379(A, S) <~ (373, 1459, A, S), (388, 1494)\n * == '=' ==> 02548\n * <no epsilon>\n * 02548(A, S) <~ (388, 1495, A, S)\n * <no epsilon>\n * 02380(A, S) <~ (358, 1429, A, S)\n * <no epsilon>\n * 02381(A, S) <~ (361, 1435, A, S)\n * <no epsilon>\n * 02382(A, S) <~ (418, 1573, A, S), (424, 1587)\n * == '|' ==> 02547\n * <no epsilon>\n * 02547(A, S) <~ (424, 1588, A, S)\n * <no epsilon>\n * 02383(A, S) <~ (346, 1405, A, S)\n * <no epsilon>\n * 02384(A, S) <~ (474, 1799, A, S), (445, 1669)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 'k'], ['m', 'z'] ==> 02415\n * == 'l' ==> 02544\n * <no epsilon>\n * 02544(A, S) <~ (474, 1799, A, S), (445, 1670)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 'r'], ['t', 'z'] ==> 02415\n * == 's' ==> 02545\n * <no epsilon>\n * 02545(A, S) <~ (474, 1799, A, S), (445, 1671)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 'd'], ['f', 'z'] ==> 02415\n * == 'e' ==> 02546\n * <no epsilon>\n * 02546(A, S) <~ (445, 1672, A, S)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 'z'] ==> 02415\n * <no epsilon>\n * 02415(A, S) <~ (474, 1799, A, S)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 'z'] ==> 02415\n * <no epsilon>\n * 02385(A, S) <~ (427, 1594, A, S), (430, 1602)\n * == '&' ==> 02543\n * <no epsilon>\n * 02543(A, S) <~ (430, 1603, A, S)\n * <no epsilon>\n * 02386(A, S) <~ (337, 1384, A, S), (161, 557), (185, 694), (199, 766), (213, 810), (227, 862), (241, 922), (255, 989), (269, 1051), (283, 1106), (297, 1172), (311, 1234), (340, 1392)\n * == '\\t', ' ' ==> 02497\n * == '#' ==> 02496\n * == 'd' ==> 02494\n * == 'e' ==> 02498\n * == 'i' ==> 02495\n * == 'p' ==> 02499\n * <no epsilon>\n * 02496(A, S) <~ (340, 1393, A, S)\n * <no epsilon>\n * 02497() <~ (161, 557), (185, 694), (199, 766), (213, 810), (227, 862), (241, 922), (255, 989), (269, 1051), (283, 1106), (297, 1172), (311, 1234)\n * == '\\t', ' ' ==> 02497\n * == 'd' ==> 02494\n * == 'e' ==> 02498\n * == 'i' ==> 02495\n * == 'p' ==> 02499\n * <no epsilon>\n * 02498() <~ (227, 863), (269, 1052), (283, 1107), (311, 1236)\n * == 'l' ==> 02507\n * == 'n' ==> 02505\n * == 'r' ==> 02506\n * <no epsilon>\n * 02505() <~ (269, 1053)\n * == 'd' ==> 02515\n * <no epsilon>\n * 02515() <~ (269, 1054)\n * == 'i' ==> 02516\n * <no epsilon>\n * 02516() <~ (269, 1048)\n * == 'f' ==> 02517\n * <no epsilon>\n * 02517(A, S) <~ (269, 1049, A, S)\n * <no epsilon>\n * 02506() <~ (311, 1235)\n * == 'r' ==> 02512\n * <no epsilon>\n * 02512() <~ (311, 1237)\n * == 'o' ==> 02513\n * <no epsilon>\n * 02513() <~ (311, 1231)\n * == 'r' ==> 02514\n * <no epsilon>\n * 02514(A, S) <~ (311, 1232, A, S)\n * <no epsilon>\n * 02507() <~ (227, 864), (283, 1108)\n * == 'i' ==> 02508\n * == 's' ==> 02509\n * <no epsilon>\n * 02508() <~ (227, 859)\n * == 'f' ==> 02511\n * <no epsilon>\n * 02511(A, S) <~ (227, 860, A, S)\n * <no epsilon>\n * 02509() <~ (283, 1103)\n * == 'e' ==> 02510\n * <no epsilon>\n * 02510(A, S) <~ (283, 1104, A, S)\n * <no epsilon>\n * 02499() <~ (297, 1173)\n * == 'r' ==> 02500\n * <no epsilon>\n * 02500() <~ (297, 1174)\n * == 'a' ==> 02501\n * <no epsilon>\n * 02501() <~ (297, 1175)\n * == 'g' ==> 02502\n * <no epsilon>\n * 02502() <~ (297, 1176)\n * == 'm' ==> 02503\n * <no epsilon>\n * 02503() <~ (297, 1169)\n * == 'a' ==> 02504\n * <no epsilon>\n * 02504(A, S) <~ (297, 1170, A, S)\n * <no epsilon>\n * 02494() <~ (199, 767)\n * == 'e' ==> 02538\n * <no epsilon>\n * 02538() <~ (199, 768)\n * == 'f' ==> 02539\n * <no epsilon>\n * 02539() <~ (199, 769)\n * == 'i' ==> 02540\n * <no epsilon>\n * 02540() <~ (199, 770)\n * == 'n' ==> 02541\n * <no epsilon>\n * 02541() <~ (199, 763)\n * == 'e' ==> 02542\n * <no epsilon>\n * 02542(A, S) <~ (199, 764, A, S)\n * <no epsilon>\n * 02495() <~ (161, 558), (185, 695), (213, 807), (241, 923), (255, 990)\n * == 'f' ==> 02518\n * == 'n' ==> 02519\n * <no epsilon>\n * 02518(A, S) <~ (213, 808, A, S), (241, 924), (255, 991)\n * == 'd' ==> 02531\n * == 'n' ==> 02532\n * <no epsilon>\n * 02531() <~ (241, 925)\n * == 'e' ==> 02536\n * <no epsilon>\n * 02536() <~ (241, 919)\n * == 'f' ==> 02537\n * <no epsilon>\n * 02537(A, S) <~ (241, 920, A, S)\n * <no epsilon>\n * 02532() <~ (255, 992)\n * == 'd' ==> 02533\n * <no epsilon>\n * 02533() <~ (255, 993)\n * == 'e' ==> 02534\n * <no epsilon>\n * 02534() <~ (255, 986)\n * == 'f' ==> 02535\n * <no epsilon>\n * 02535(A, S) <~ (255, 987, A, S)\n * <no epsilon>\n * 02519() <~ (161, 559), (185, 696)\n * == 'c' ==> 02520\n * <no epsilon>\n * 02520() <~ (161, 560), (185, 697)\n * == 'l' ==> 02521\n * <no epsilon>\n * 02521() <~ (161, 561), (185, 698)\n * == 'u' ==> 02522\n * <no epsilon>\n * 02522() <~ (161, 562), (185, 699)\n * == 'd' ==> 02523\n * <no epsilon>\n * 02523() <~ (161, 563), (185, 700)\n * == 'e' ==> 02524\n * <no epsilon>\n * 02524() <~ (161, 564), (185, 701)\n * == '\\t', ' ' ==> 02524\n * == '\"' ==> 02526\n * == '<' ==> 02525\n * <no epsilon>\n * 02525() <~ (185, 702)\n * == [\\1, '='], ['?', oo] ==> 02529\n * <no epsilon>\n * 02529() <~ (185, 691)\n * == [\\1, '='], ['?', oo] ==> 02529\n * == '>' ==> 02530\n * <no epsilon>\n * 02530(A, S) <~ (185, 692, A, S)\n * <no epsilon>\n * 02526() <~ (161, 565)\n * == [\\1, '!'], ['#', oo] ==> 02527\n * <no epsilon>\n * 02527() <~ (161, 566)\n * == [\\1, '!'], ['#', oo] ==> 02527\n * == '\"' ==> 02528\n * <no epsilon>\n * 02528(A, S) <~ (161, 556, A, S)\n * <no epsilon>\n * 02387(A, S) <~ (469, 1789, A, S)\n * <no epsilon>\n * 02388(A, S) <~ (476, 1803, A, S)\n * == ['0', '9'] ==> 02388\n * <no epsilon>\n * 02389(A, S) <~ (370, 1453, A, S), (385, 1485)\n * == '=' ==> 02493\n * <no epsilon>\n * 02493(A, S) <~ (385, 1486, A, S)\n * <no epsilon>\n * 02390(A, S) <~ (474, 1799, A, S), (313, 1255), (331, 1358), (454, 1713)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 'd'], ['f', 'n'], ['p', 'z'] ==> 02415\n * == 'e' ==> 02482\n * == 'o' ==> 02483\n * <no epsilon>\n * 02482(A, S) <~ (474, 1799, A, S), (313, 1256)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 'e'], ['g', 'z'] ==> 02415\n * == 'f' ==> 02488\n * <no epsilon>\n * 02488(A, S) <~ (474, 1799, A, S), (313, 1257)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 'h'], ['j', 'z'] ==> 02415\n * == 'i' ==> 02489\n * <no epsilon>\n * 02489(A, S) <~ (474, 1799, A, S), (313, 1258)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 'm'], ['o', 'z'] ==> 02415\n * == 'n' ==> 02490\n * <no epsilon>\n * 02490(A, S) <~ (474, 1799, A, S), (313, 1259)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 'd'], ['f', 'z'] ==> 02415\n * == 'e' ==> 02491\n * <no epsilon>\n * 02491(A, S) <~ (474, 1799, A, S), (313, 1260)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 'c'], ['e', 'z'] ==> 02415\n * == 'd' ==> 02492\n * <no epsilon>\n * 02492(A, S) <~ (313, 1261, A, S)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 'z'] ==> 02415\n * <no epsilon>\n * 02483(A, S) <~ (454, 1714, A, S), (331, 1359)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 't'], ['v', 'z'] ==> 02415\n * == 'u' ==> 02484\n * <no epsilon>\n * 02484(A, S) <~ (474, 1799, A, S), (331, 1360)\n * == ['0', '9'], ['A', 'Z'], '_', 'a', ['c', 'z'] ==> 02415\n * == 'b' ==> 02485\n * <no epsilon>\n * 02485(A, S) <~ (474, 1799, A, S), (331, 1361)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 'k'], ['m', 'z'] ==> 02415\n * == 'l' ==> 02486\n * <no epsilon>\n * 02486(A, S) <~ (474, 1799, A, S), (331, 1362)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 'd'], ['f', 'z'] ==> 02415\n * == 'e' ==> 02487\n * <no epsilon>\n * 02487(A, S) <~ (331, 1363, A, S)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 'z'] ==> 02415\n * <no epsilon>\n * 02391(A, S) <~ (131, 409, A, S)\n * <no epsilon>\n * 02392(A, S) <~ (466, 1783, A, S)\n * <no epsilon>\n * 02393(A, S) <~ (474, 1799, A, S), (328, 1338), (451, 1703)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 'k'], ['m', 'n'], ['p', 'z'] ==> 02415\n * == 'l' ==> 02477\n * == 'o' ==> 02476\n * <no epsilon>\n * 02476(A, S) <~ (474, 1799, A, S), (451, 1704)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 'q'], ['s', 'z'] ==> 02415\n * == 'r' ==> 02481\n * <no epsilon>\n * 02481(A, S) <~ (451, 1705, A, S)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 'z'] ==> 02415\n * <no epsilon>\n * 02477(A, S) <~ (474, 1799, A, S), (328, 1339)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 'n'], ['p', 'z'] ==> 02415\n * == 'o' ==> 02478\n * <no epsilon>\n * 02478(A, S) <~ (474, 1799, A, S), (328, 1340)\n * == ['0', '9'], ['A', 'Z'], '_', ['b', 'z'] ==> 02415\n * == 'a' ==> 02479\n * <no epsilon>\n * 02479(A, S) <~ (474, 1799, A, S), (328, 1341)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 's'], ['u', 'z'] ==> 02415\n * == 't' ==> 02480\n * <no epsilon>\n * 02480(A, S) <~ (328, 1342, A, S)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 'z'] ==> 02415\n * <no epsilon>\n * 02394(A, S) <~ (379, 1471, A, S), (133, 418), (136, 428), (394, 1512)\n * == '*' ==> 02473\n * == '/' ==> 02475\n * == '=' ==> 02474\n * <no epsilon>\n * 02473(A, S) <~ (133, 419, A, S)\n * <no epsilon>\n * 02474(A, S) <~ (394, 1513, A, S)\n * <no epsilon>\n * 02475(A, S) <~ (136, 429, A, S)\n * <no epsilon>\n * 02395(A, S) <~ (355, 1423, A, S)\n * <no epsilon>\n * 02396(A, S) <~ (415, 1567, A, S), (400, 1530)\n * == '=' ==> 02472\n * <no epsilon>\n * 02472(A, S) <~ (400, 1531, A, S)\n * <no epsilon>\n * 02397() <~ (316, 1269)\n * == '\\n' ==> 02471\n * <no epsilon>\n * 02471(A, S) <~ (316, 1270, A, S)\n * <no epsilon>\n * 02398(A, S) <~ (382, 1477, A, S)\n * <no epsilon>\n * 02399(A, S) <~ (352, 1417, A, S)\n * <no epsilon>\n * 02400() <~ (478, 1810)\n * == [\\1, '!'], ['#', '['], [']', oo] ==> 02400\n * == '\"' ==> 02469\n * == '\\' ==> 02468\n * <no epsilon>\n * 02468() <~ (478, 1812)\n * == [\\1, '!'], ['#', '['], [']', oo] ==> 02400\n * == '\"' ==> 02470\n * == '\\' ==> 02468\n * <no epsilon>\n * 02470(A, S) <~ (478, 1813, A, S)\n * == [\\1, '!'], ['#', '['], [']', oo] ==> 02400\n * == '\"' ==> 02469\n * == '\\' ==> 02468\n * <no epsilon>\n * 02469(A, S) <~ (478, 1811, A, S)\n * <no epsilon>\n * 02401(A, S) <~ (474, 1799, A, S), (436, 1625), (448, 1688)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 's'], ['u', 'v'], ['x', 'z'] ==> 02415\n * == 't' ==> 02459\n * == 'w' ==> 02458\n * <no epsilon>\n * 02458(A, S) <~ (474, 1799, A, S), (448, 1689)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 'h'], ['j', 'z'] ==> 02415\n * == 'i' ==> 02464\n * <no epsilon>\n * 02464(A, S) <~ (474, 1799, A, S), (448, 1690)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 's'], ['u', 'z'] ==> 02415\n * == 't' ==> 02465\n * <no epsilon>\n * 02465(A, S) <~ (474, 1799, A, S), (448, 1691)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 'b'], ['d', 'z'] ==> 02415\n * == 'c' ==> 02466\n * <no epsilon>\n * 02466(A, S) <~ (474, 1799, A, S), (448, 1692)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 'g'], ['i', 'z'] ==> 02415\n * == 'h' ==> 02467\n * <no epsilon>\n * 02467(A, S) <~ (448, 1693, A, S)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 'z'] ==> 02415\n * <no epsilon>\n * 02459(A, S) <~ (474, 1799, A, S), (436, 1626)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 'q'], ['s', 'z'] ==> 02415\n * == 'r' ==> 02460\n * <no epsilon>\n * 02460(A, S) <~ (474, 1799, A, S), (436, 1627)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 't'], ['v', 'z'] ==> 02415\n * == 'u' ==> 02461\n * <no epsilon>\n * 02461(A, S) <~ (474, 1799, A, S), (436, 1628)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 'b'], ['d', 'z'] ==> 02415\n * == 'c' ==> 02462\n * <no epsilon>\n * 02462(A, S) <~ (474, 1799, A, S), (436, 1629)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 's'], ['u', 'z'] ==> 02415\n * == 't' ==> 02463\n * <no epsilon>\n * 02463(A, S) <~ (436, 1630, A, S)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 'z'] ==> 02415\n * <no epsilon>\n * 02402(A, S) <~ (474, 1799, A, S), (457, 1728)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 'g'], ['i', 'z'] ==> 02415\n * == 'h' ==> 02454\n * <no epsilon>\n * 02454(A, S) <~ (474, 1799, A, S), (457, 1729)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 'h'], ['j', 'z'] ==> 02415\n * == 'i' ==> 02455\n * <no epsilon>\n * 02455(A, S) <~ (474, 1799, A, S), (457, 1730)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 'k'], ['m', 'z'] ==> 02415\n * == 'l' ==> 02456\n * <no epsilon>\n * 02456(A, S) <~ (474, 1799, A, S), (457, 1731)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 'd'], ['f', 'z'] ==> 02415\n * == 'e' ==> 02457\n * <no epsilon>\n * 02457(A, S) <~ (457, 1732, A, S)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 'z'] ==> 02415\n * <no epsilon>\n * 02403() <~ (480, 1821)\n * == [\\1, '&'], ['(', '['], [']', oo] ==> 02452\n * == ''' ==> 02451\n * == '\\' ==> 02450\n * <no epsilon>\n * 02450() <~ (480, 1823)\n * == ''' ==> 02453\n * == ['0', '9'], '\\', ['a', 'c'], 'f', 'n', 'r', 't', 'v' ==> 02452\n * <no epsilon>\n * 02452() <~ (480, 1824)\n * == ''' ==> 02451\n * <no epsilon>\n * 02451(A, S) <~ (480, 1822, A, S)\n * <no epsilon>\n * 02453(A, S) <~ (480, 1825, A, S)\n * == ''' ==> 02451\n * <no epsilon>\n * 02404(A, S) <~ (376, 1465, A, S), (391, 1503)\n * == '=' ==> 02449\n * <no epsilon>\n * 02449(A, S) <~ (391, 1504, A, S)\n * <no epsilon>\n * 02405(A, S) <~ (474, 1799, A, S), (322, 1307), (442, 1656)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 'e'], ['g', 'm'], ['o', 'z'] ==> 02415\n * == 'f' ==> 02446\n * == 'n' ==> 02447\n * <no epsilon>\n * 02446(A, S) <~ (442, 1657, A, S)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 'z'] ==> 02415\n * <no epsilon>\n * 02447(A, S) <~ (474, 1799, A, S), (322, 1308)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 's'], ['u', 'z'] ==> 02415\n * == 't' ==> 02448\n * <no epsilon>\n * 02448(A, S) <~ (322, 1309, A, S)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 'z'] ==> 02415\n * <no epsilon>\n * 02406(A, S) <~ (474, 1799, A, S), (325, 1321)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 'n'], ['p', 'z'] ==> 02415\n * == 'o' ==> 02443\n * <no epsilon>\n * 02443(A, S) <~ (474, 1799, A, S), (325, 1322)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 'm'], ['o', 'z'] ==> 02415\n * == 'n' ==> 02444\n * <no epsilon>\n * 02444(A, S) <~ (474, 1799, A, S), (325, 1323)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 'f'], ['h', 'z'] ==> 02415\n * == 'g' ==> 02445\n * <no epsilon>\n * 02445(A, S) <~ (325, 1324, A, S)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 'z'] ==> 02415\n * <no epsilon>\n * 02407(A, S) <~ (421, 1579, A, S)\n * <no epsilon>\n * 02408(A, S) <~ (433, 1609, A, S)\n * <no epsilon>\n * 02409(A, S) <~ (409, 1552, A, S), (412, 1560)\n * == '=' ==> 02442\n * <no epsilon>\n * 02442(A, S) <~ (412, 1561, A, S)\n * <no epsilon>\n * 02410(A, S) <~ (349, 1411, A, S)\n * <no epsilon>\n * 02411(A, S) <~ (474, 1799, A, S), (319, 1290)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 'm'], ['o', 'z'] ==> 02415\n * == 'n' ==> 02435\n * <no epsilon>\n * 02435(A, S) <~ (474, 1799, A, S), (319, 1291)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 'r'], ['t', 'z'] ==> 02415\n * == 's' ==> 02436\n * <no epsilon>\n * 02436(A, S) <~ (474, 1799, A, S), (319, 1292)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 'h'], ['j', 'z'] ==> 02415\n * == 'i' ==> 02437\n * <no epsilon>\n * 02437(A, S) <~ (474, 1799, A, S), (319, 1293)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 'f'], ['h', 'z'] ==> 02415\n * == 'g' ==> 02438\n * <no epsilon>\n * 02438(A, S) <~ (474, 1799, A, S), (319, 1294)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 'm'], ['o', 'z'] ==> 02415\n * == 'n' ==> 02439\n * <no epsilon>\n * 02439(A, S) <~ (474, 1799, A, S), (319, 1295)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 'd'], ['f', 'z'] ==> 02415\n * == 'e' ==> 02440\n * <no epsilon>\n * 02440(A, S) <~ (474, 1799, A, S), (319, 1296)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 'c'], ['e', 'z'] ==> 02415\n * == 'd' ==> 02441\n * <no epsilon>\n * 02441(A, S) <~ (319, 1297, A, S)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 'z'] ==> 02415\n * <no epsilon>\n * 02412(A, S) <~ (367, 1447, A, S), (397, 1521)\n * == '=' ==> 02434\n * <no epsilon>\n * 02434(A, S) <~ (397, 1522, A, S)\n * <no epsilon>\n * 02413(A, S) <~ (403, 1537, A, S), (406, 1545)\n * == '=' ==> 02433\n * <no epsilon>\n * 02433(A, S) <~ (406, 1546, A, S)\n * <no epsilon>\n * 02414(A, S) <~ (474, 1799, A, S), (334, 1375), (439, 1644), (463, 1770)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 'g'], ['i', 'n'], ['p', 'z'] ==> 02415\n * == 'h' ==> 02422\n * == 'o' ==> 02421\n * <no epsilon>\n * 02421(A, S) <~ (474, 1799, A, S), (439, 1645), (463, 1771)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 'm'], ['o', 'z'] ==> 02415\n * == 'n' ==> 02425\n * <no epsilon>\n * 02425(A, S) <~ (474, 1799, A, S), (439, 1646), (463, 1772)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 'r'], ['u', 'z'] ==> 02415\n * == 's' ==> 02427\n * == 't' ==> 02426\n * <no epsilon>\n * 02426(A, S) <~ (474, 1799, A, S), (463, 1773)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 'h'], ['j', 'z'] ==> 02415\n * == 'i' ==> 02429\n * <no epsilon>\n * 02429(A, S) <~ (474, 1799, A, S), (463, 1774)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 'm'], ['o', 'z'] ==> 02415\n * == 'n' ==> 02430\n * <no epsilon>\n * 02430(A, S) <~ (474, 1799, A, S), (463, 1775)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 't'], ['v', 'z'] ==> 02415\n * == 'u' ==> 02431\n * <no epsilon>\n * 02431(A, S) <~ (474, 1799, A, S), (463, 1776)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 'd'], ['f', 'z'] ==> 02415\n * == 'e' ==> 02432\n * <no epsilon>\n * 02432(A, S) <~ (463, 1777, A, S)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 'z'] ==> 02415\n * <no epsilon>\n * 02427(A, S) <~ (474, 1799, A, S), (439, 1647)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 's'], ['u', 'z'] ==> 02415\n * == 't' ==> 02428\n * <no epsilon>\n * 02428(A, S) <~ (439, 1648, A, S)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 'z'] ==> 02415\n * <no epsilon>\n * 02422(A, S) <~ (474, 1799, A, S), (334, 1376)\n * == ['0', '9'], ['A', 'Z'], '_', ['b', 'z'] ==> 02415\n * == 'a' ==> 02423\n * <no epsilon>\n * 02423(A, S) <~ (474, 1799, A, S), (334, 1377)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 'q'], ['s', 'z'] ==> 02415\n * == 'r' ==> 02424\n * <no epsilon>\n * 02424(A, S) <~ (334, 1378, A, S)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 'z'] ==> 02415\n * <no epsilon>\n * 02416(A, S) <~ (474, 1799, A, S), (460, 1746)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 'q'], ['s', 'z'] ==> 02415\n * == 'r' ==> 02417\n * <no epsilon>\n * 02417(A, S) <~ (474, 1799, A, S), (460, 1747)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 'd'], ['f', 'z'] ==> 02415\n * == 'e' ==> 02418\n * <no epsilon>\n * 02418(A, S) <~ (474, 1799, A, S), (460, 1748)\n * == ['0', '9'], ['A', 'Z'], '_', ['b', 'z'] ==> 02415\n * == 'a' ==> 02419\n * <no epsilon>\n * 02419(A, S) <~ (474, 1799, A, S), (460, 1749)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 'j'], ['l', 'z'] ==> 02415\n * == 'k' ==> 02420\n * <no epsilon>\n * 02420(A, S) <~ (460, 1750, A, S)\n * == ['0', '9'], ['A', 'Z'], '_', ['a', 'z'] ==> 02415\n * <no epsilon>\n * \n */\nSTATE_2375:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2375\");\n\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 91) {\n if( input < 43) {\n if( input < 36) {\n if( input < 32) {\n if( input == 9 || input == 10 ) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_131_DIRECT;\n } else {\n goto STATE_2375_DROP_OUT;\n }\n } else {\n if( input < 34) {\n if( input == 32) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_131_DIRECT; /* ' ' */\n } else {\n goto STATE_2396; /* '!' */\n }\n } else {\n if( input == 34) {\n goto STATE_2400; /* '\"' */\n } else {\n goto STATE_2386; /* '#' */\n }\n }\n }\n } else {\n if( input < 39) {\n if( input < 37) {\n goto STATE_2375_DROP_OUT_DIRECT; /* '$' */\n } else {\n if( input == 37) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_382_DIRECT; /* '%' */\n } else {\n goto STATE_2385; /* '&' */\n }\n }\n } else {\n if( input < 41) {\n if( input == 39) {\n goto STATE_2403; /* ''' */\n } else {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_349_DIRECT; /* '(' */\n }\n } else {\n if( input == 41) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_352_DIRECT; /* ')' */\n } else {\n goto STATE_2404; /* '*' */\n }\n }\n }\n }\n } else {\n if( input < 59) {\n if( input < 46) {\n if( input < 44) {\n goto STATE_2389; /* '+' */\n } else {\n if( input == 44) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_472_DIRECT; /* ',' */\n } else {\n goto STATE_2379; /* '-' */\n }\n }\n } else {\n if( input < 48) {\n if( input == 46) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_469_DIRECT; /* '.' */\n } else {\n goto STATE_2394; /* '/' */\n }\n } else {\n if( input != 58) {\n goto STATE_2388; /* ['0', '9'] */\n } else {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_433_DIRECT; /* ':' */\n }\n }\n }\n } else {\n if( input < 62) {\n if( input < 60) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_466_DIRECT; /* ';' */\n } else {\n if( input == 60) {\n goto STATE_2409; /* '<' */\n } else {\n goto STATE_2412; /* '=' */\n }\n }\n } else {\n if( input < 64) {\n if( input == 62) {\n goto STATE_2413; /* '>' */\n } else {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_343_DIRECT; /* '?' */\n }\n } else {\n if( input == 64) {\n goto STATE_2375_DROP_OUT_DIRECT; /* '@' */\n } else {\n goto STATE_2415; /* ['A', 'Z'] */\n }\n }\n }\n }\n }\n } else {\n if( input < 106) {\n if( input < 98) {\n if( input < 94) {\n if( input < 92) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_355_DIRECT; /* '[' */\n } else {\n if( input == 92) {\n goto STATE_2397; /* '\\' */\n } else {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_358_DIRECT; /* ']' */\n }\n }\n } else {\n if( input < 96) {\n if( input == 94) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_421_DIRECT; /* '^' */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input == 96) {\n goto STATE_2375_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_2415; /* 'a' */\n }\n }\n }\n } else {\n if( input < 101) {\n if( input < 99) {\n goto STATE_2416; /* 'b' */\n } else {\n if( input == 99) {\n goto STATE_2414; /* 'c' */\n } else {\n goto STATE_2390; /* 'd' */\n }\n }\n } else {\n if( input < 103) {\n if( input == 101) {\n goto STATE_2384; /* 'e' */\n } else {\n goto STATE_2393; /* 'f' */\n }\n } else {\n if( input != 105) {\n goto STATE_2415; /* ['g', 'h'] */\n } else {\n goto STATE_2405; /* 'i' */\n }\n }\n }\n }\n } else {\n if( input < 119) {\n if( input < 115) {\n if( input == 108) {\n goto STATE_2406; /* 'l' */\n } else {\n goto STATE_2415; /* ['j', 'k'] */\n }\n } else {\n if( input < 117) {\n if( input == 115) {\n goto STATE_2401; /* 's' */\n } else {\n goto STATE_2415; /* 't' */\n }\n } else {\n if( input == 117) {\n goto STATE_2411; /* 'u' */\n } else {\n goto STATE_2415; /* 'v' */\n }\n }\n }\n } else {\n if( input < 124) {\n if( input < 120) {\n goto STATE_2402; /* 'w' */\n } else {\n if( input != 123) {\n goto STATE_2415; /* ['x', 'z'] */\n } else {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_361_DIRECT; /* '{' */\n }\n }\n } else {\n if( input < 126) {\n if( input == 124) {\n goto STATE_2382; /* '|' */\n } else {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_364_DIRECT; /* '}' */\n }\n } else {\n if( input == 126) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_346_DIRECT; /* '~' */\n } else {\n goto STATE_2375_DROP_OUT_DIRECT; /* ['', oo] */\n }\n }\n }\n }\n }\n }\n\nSTATE_2375_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2375_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2375_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2375_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n if( QuexBuffer_is_end_of_file(&me->buffer) ) {\n /* NO CHECK 'last_acceptance != -1' --- first state can **never** be an acceptance state */\n goto TERMINAL_END_OF_STREAM;\n }\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2375_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\nSTATE_2375_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2375_INPUT\");\n QuexBuffer_input_p_increment(&me->buffer);\n goto STATE_2375;\nSTATE_2379:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2379\");\n\nSTATE_2379_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2379_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 61) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_388_DIRECT; /* '=' */\n } else {\n goto STATE_2379_DROP_OUT; /* [-oo, '<'] */\n }\n\nSTATE_2379_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2379_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2379_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2379_DROP_OUT_DIRECT\");\n goto TERMINAL_373_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"373\");\n QUEX_SET_last_acceptance(373);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2379_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2382:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2382\");\n\nSTATE_2382_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2382_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 124) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_424_DIRECT; /* '|' */\n } else {\n goto STATE_2382_DROP_OUT; /* [-oo, '{'] */\n }\n\nSTATE_2382_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2382_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2382_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2382_DROP_OUT_DIRECT\");\n goto TERMINAL_418_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"418\");\n QUEX_SET_last_acceptance(418);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2382_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2384:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2384\");\n\nSTATE_2384_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2384_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 95) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2384_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input >= 65 && input < 91 ) {\n goto STATE_2415; /* ['A', 'Z'] */\n } else {\n goto STATE_2384_DROP_OUT_DIRECT; /* [':', '@'] */\n }\n }\n } else {\n if( input < 108) {\n if( input == 96) {\n goto STATE_2384_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input < 109) {\n goto STATE_2544; /* 'l' */\n } else {\n if( input < 123) {\n goto STATE_2415; /* ['m', 'z'] */\n } else {\n goto STATE_2384_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_2384_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2384_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2384_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2384_DROP_OUT_DIRECT\");\n goto TERMINAL_474_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"474\");\n QUEX_SET_last_acceptance(474);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2384_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2385:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2385\");\n\nSTATE_2385_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2385_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 38) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_430_DIRECT; /* '&' */\n } else {\n goto STATE_2385_DROP_OUT; /* [-oo, '%'] */\n }\n\nSTATE_2385_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2385_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2385_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2385_DROP_OUT_DIRECT\");\n goto TERMINAL_427_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"427\");\n QUEX_SET_last_acceptance(427);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2385_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2386:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2386\");\n\nSTATE_2386_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2386_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"337\");\n QUEX_SET_last_acceptance(337);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n if( input < 100) {\n if( input < 32) {\n if( input == 9) {\n goto STATE_2497; /* '\\t' */\n } else {\n goto STATE_2386_DROP_OUT; /* [-oo, \\8] */\n }\n } else {\n if( input < 35) {\n if( input == 32) {\n goto STATE_2497; /* ' ' */\n } else {\n goto STATE_2386_DROP_OUT_DIRECT; /* ['!', '\"'] */\n }\n } else {\n if( input == 35) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_340_DIRECT; /* '#' */\n } else {\n goto STATE_2386_DROP_OUT_DIRECT; /* ['$', 'c'] */\n }\n }\n }\n } else {\n if( input < 105) {\n if( input < 101) {\n goto STATE_2494; /* 'd' */\n } else {\n if( input == 101) {\n goto STATE_2498; /* 'e' */\n } else {\n goto STATE_2386_DROP_OUT_DIRECT; /* ['f', 'h'] */\n }\n }\n } else {\n if( input < 112) {\n if( input == 105) {\n goto STATE_2495; /* 'i' */\n } else {\n goto STATE_2386_DROP_OUT_DIRECT; /* ['j', 'o'] */\n }\n } else {\n if( input == 112) {\n goto STATE_2499; /* 'p' */\n } else {\n goto STATE_2386_DROP_OUT_DIRECT; /* ['q', oo] */\n }\n }\n }\n }\n\nSTATE_2386_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2386_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2386_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2386_DROP_OUT_DIRECT\");\n goto TERMINAL_337;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"337\");\n QUEX_SET_last_acceptance(337);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2386_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2388:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2388\");\n\nSTATE_2388_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2388_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input >= 48 && input < 58 ) {\n goto STATE_2388; /* ['0', '9'] */\n } else {\n goto STATE_2388_DROP_OUT; /* [-oo, '/'] */\n }\n\nSTATE_2388_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2388_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2388_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2388_DROP_OUT_DIRECT\");\n goto TERMINAL_476_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"476\");\n QUEX_SET_last_acceptance(476);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2388_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2389:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2389\");\n\nSTATE_2389_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2389_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 61) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_385_DIRECT; /* '=' */\n } else {\n goto STATE_2389_DROP_OUT; /* [-oo, '<'] */\n }\n\nSTATE_2389_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2389_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2389_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2389_DROP_OUT_DIRECT\");\n goto TERMINAL_370_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"370\");\n QUEX_SET_last_acceptance(370);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2389_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2390:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2390\");\n\nSTATE_2390_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2390_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 96) {\n if( input < 65) {\n if( input >= 48 && input < 58 ) {\n goto STATE_2415; /* ['0', '9'] */\n } else {\n goto STATE_2390_DROP_OUT; /* [-oo, '/'] */\n }\n } else {\n if( input >= 91 && input < 95 ) {\n goto STATE_2390_DROP_OUT_DIRECT; /* ['[', '^'] */\n } else {\n goto STATE_2415; /* ['A', 'Z'] */\n }\n }\n } else {\n if( input < 102) {\n if( input < 97) {\n goto STATE_2390_DROP_OUT_DIRECT; /* '`' */\n } else {\n if( input != 101) {\n goto STATE_2415; /* ['a', 'd'] */\n } else {\n goto STATE_2482; /* 'e' */\n }\n }\n } else {\n if( input < 112) {\n if( input != 111) {\n goto STATE_2415; /* ['f', 'n'] */\n } else {\n goto STATE_2483; /* 'o' */\n }\n } else {\n if( input < 123) {\n goto STATE_2415; /* ['p', 'z'] */\n } else {\n goto STATE_2390_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_2390_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2390_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2390_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2390_DROP_OUT_DIRECT\");\n goto TERMINAL_474_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"474\");\n QUEX_SET_last_acceptance(474);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2390_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2393:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2393\");\n\nSTATE_2393_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2393_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 96) {\n if( input < 65) {\n if( input >= 48 && input < 58 ) {\n goto STATE_2415; /* ['0', '9'] */\n } else {\n goto STATE_2393_DROP_OUT; /* [-oo, '/'] */\n }\n } else {\n if( input >= 91 && input < 95 ) {\n goto STATE_2393_DROP_OUT_DIRECT; /* ['[', '^'] */\n } else {\n goto STATE_2415; /* ['A', 'Z'] */\n }\n }\n } else {\n if( input < 109) {\n if( input < 97) {\n goto STATE_2393_DROP_OUT_DIRECT; /* '`' */\n } else {\n if( input != 108) {\n goto STATE_2415; /* ['a', 'k'] */\n } else {\n goto STATE_2477; /* 'l' */\n }\n }\n } else {\n if( input < 112) {\n if( input != 111) {\n goto STATE_2415; /* ['m', 'n'] */\n } else {\n goto STATE_2476; /* 'o' */\n }\n } else {\n if( input < 123) {\n goto STATE_2415; /* ['p', 'z'] */\n } else {\n goto STATE_2393_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_2393_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2393_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2393_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2393_DROP_OUT_DIRECT\");\n goto TERMINAL_474_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"474\");\n QUEX_SET_last_acceptance(474);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2393_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2394:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2394\");\n\nSTATE_2394_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2394_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 47) {\n if( input == 42) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_133_DIRECT; /* '*' */\n } else {\n goto STATE_2394_DROP_OUT; /* [-oo, ')'] */\n }\n } else {\n if( input < 61) {\n if( input == 47) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_136_DIRECT; /* '/' */\n } else {\n goto STATE_2394_DROP_OUT_DIRECT; /* ['0', '<'] */\n }\n } else {\n if( input == 61) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_394_DIRECT; /* '=' */\n } else {\n goto STATE_2394_DROP_OUT_DIRECT; /* ['>', oo] */\n }\n }\n }\n\nSTATE_2394_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2394_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2394_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2394_DROP_OUT_DIRECT\");\n goto TERMINAL_379_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"379\");\n QUEX_SET_last_acceptance(379);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2394_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2396:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2396\");\n\nSTATE_2396_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2396_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 61) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_400_DIRECT; /* '=' */\n } else {\n goto STATE_2396_DROP_OUT; /* [-oo, '<'] */\n }\n\nSTATE_2396_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2396_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2396_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2396_DROP_OUT_DIRECT\");\n goto TERMINAL_415_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"415\");\n QUEX_SET_last_acceptance(415);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2396_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2397:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2397\");\n\nSTATE_2397_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2397_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 10) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_316_DIRECT; /* '\\n' */\n } else {\n goto STATE_2397_DROP_OUT; /* [-oo, '\\t'] */\n }\n\nSTATE_2397_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2397_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2397_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2397_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2397_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2400:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2400\");\n\nSTATE_2400_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2400_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 35) {\n if( input < 1) {\n goto STATE_2400_DROP_OUT; /* [-oo, \\0] */\n } else {\n if( input != 34) {\n goto STATE_2400; /* [\\1, '!'] */\n } else {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_478_DIRECT; /* '\"' */\n }\n }\n } else {\n if( input == 92) {\n goto STATE_2468; /* '\\' */\n } else {\n goto STATE_2400; /* ['#', '['] */\n }\n }\n\nSTATE_2400_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2400_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2400_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2400_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2400_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2401:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2401\");\n\nSTATE_2401_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2401_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 96) {\n if( input < 65) {\n if( input >= 48 && input < 58 ) {\n goto STATE_2415; /* ['0', '9'] */\n } else {\n goto STATE_2401_DROP_OUT; /* [-oo, '/'] */\n }\n } else {\n if( input >= 91 && input < 95 ) {\n goto STATE_2401_DROP_OUT_DIRECT; /* ['[', '^'] */\n } else {\n goto STATE_2415; /* ['A', 'Z'] */\n }\n }\n } else {\n if( input < 117) {\n if( input < 97) {\n goto STATE_2401_DROP_OUT_DIRECT; /* '`' */\n } else {\n if( input != 116) {\n goto STATE_2415; /* ['a', 's'] */\n } else {\n goto STATE_2459; /* 't' */\n }\n }\n } else {\n if( input < 120) {\n if( input != 119) {\n goto STATE_2415; /* ['u', 'v'] */\n } else {\n goto STATE_2458; /* 'w' */\n }\n } else {\n if( input == 120 || input == 121 || input == 122 ) {\n goto STATE_2415;\n } else {\n goto STATE_2401_DROP_OUT;\n }\n }\n }\n }\n\nSTATE_2401_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2401_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2401_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2401_DROP_OUT_DIRECT\");\n goto TERMINAL_474_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"474\");\n QUEX_SET_last_acceptance(474);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2401_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2402:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2402\");\n\nSTATE_2402_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2402_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 95) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2402_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input >= 65 && input < 91 ) {\n goto STATE_2415; /* ['A', 'Z'] */\n } else {\n goto STATE_2402_DROP_OUT_DIRECT; /* [':', '@'] */\n }\n }\n } else {\n if( input < 104) {\n if( input == 96) {\n goto STATE_2402_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input < 105) {\n goto STATE_2454; /* 'h' */\n } else {\n if( input < 123) {\n goto STATE_2415; /* ['i', 'z'] */\n } else {\n goto STATE_2402_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_2402_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2402_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2402_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2402_DROP_OUT_DIRECT\");\n goto TERMINAL_474_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"474\");\n QUEX_SET_last_acceptance(474);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2402_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2403:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2403\");\n\nSTATE_2403_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2403_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 40) {\n if( input < 1) {\n goto STATE_2403_DROP_OUT; /* [-oo, \\0] */\n } else {\n if( input != 39) {\n goto STATE_2452; /* [\\1, '&'] */\n } else {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_480_DIRECT; /* ''' */\n }\n }\n } else {\n if( input == 92) {\n goto STATE_2450; /* '\\' */\n } else {\n goto STATE_2452; /* ['(', '['] */\n }\n }\n\nSTATE_2403_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2403_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2403_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2403_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2403_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2404:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2404\");\n\nSTATE_2404_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2404_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 61) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_391_DIRECT; /* '=' */\n } else {\n goto STATE_2404_DROP_OUT; /* [-oo, '<'] */\n }\n\nSTATE_2404_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2404_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2404_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2404_DROP_OUT_DIRECT\");\n goto TERMINAL_376_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"376\");\n QUEX_SET_last_acceptance(376);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2404_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2405:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2405\");\n\nSTATE_2405_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2405_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 96) {\n if( input < 65) {\n if( input >= 48 && input < 58 ) {\n goto STATE_2415; /* ['0', '9'] */\n } else {\n goto STATE_2405_DROP_OUT; /* [-oo, '/'] */\n }\n } else {\n if( input >= 91 && input < 95 ) {\n goto STATE_2405_DROP_OUT_DIRECT; /* ['[', '^'] */\n } else {\n goto STATE_2415; /* ['A', 'Z'] */\n }\n }\n } else {\n if( input < 103) {\n if( input < 97) {\n goto STATE_2405_DROP_OUT_DIRECT; /* '`' */\n } else {\n if( input != 102) {\n goto STATE_2415; /* ['a', 'e'] */\n } else {\n goto STATE_2446; /* 'f' */\n }\n }\n } else {\n if( input < 111) {\n if( input != 110) {\n goto STATE_2415; /* ['g', 'm'] */\n } else {\n goto STATE_2447; /* 'n' */\n }\n } else {\n if( input < 123) {\n goto STATE_2415; /* ['o', 'z'] */\n } else {\n goto STATE_2405_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_2405_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2405_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2405_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2405_DROP_OUT_DIRECT\");\n goto TERMINAL_474_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"474\");\n QUEX_SET_last_acceptance(474);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2405_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2406:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2406\");\n\nSTATE_2406_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2406_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 95) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2406_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input >= 65 && input < 91 ) {\n goto STATE_2415; /* ['A', 'Z'] */\n } else {\n goto STATE_2406_DROP_OUT_DIRECT; /* [':', '@'] */\n }\n }\n } else {\n if( input < 111) {\n if( input == 96) {\n goto STATE_2406_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input < 112) {\n goto STATE_2443; /* 'o' */\n } else {\n if( input < 123) {\n goto STATE_2415; /* ['p', 'z'] */\n } else {\n goto STATE_2406_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_2406_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2406_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2406_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2406_DROP_OUT_DIRECT\");\n goto TERMINAL_474_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"474\");\n QUEX_SET_last_acceptance(474);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2406_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2409:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2409\");\n\nSTATE_2409_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2409_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 61) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_412_DIRECT; /* '=' */\n } else {\n goto STATE_2409_DROP_OUT; /* [-oo, '<'] */\n }\n\nSTATE_2409_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2409_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2409_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2409_DROP_OUT_DIRECT\");\n goto TERMINAL_409_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"409\");\n QUEX_SET_last_acceptance(409);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2409_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2411:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2411\");\n\nSTATE_2411_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2411_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 95) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2411_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input >= 65 && input < 91 ) {\n goto STATE_2415; /* ['A', 'Z'] */\n } else {\n goto STATE_2411_DROP_OUT_DIRECT; /* [':', '@'] */\n }\n }\n } else {\n if( input < 110) {\n if( input == 96) {\n goto STATE_2411_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input < 111) {\n goto STATE_2435; /* 'n' */\n } else {\n if( input < 123) {\n goto STATE_2415; /* ['o', 'z'] */\n } else {\n goto STATE_2411_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_2411_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2411_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2411_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2411_DROP_OUT_DIRECT\");\n goto TERMINAL_474_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"474\");\n QUEX_SET_last_acceptance(474);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2411_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2412:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2412\");\n\nSTATE_2412_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2412_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 61) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_397_DIRECT; /* '=' */\n } else {\n goto STATE_2412_DROP_OUT; /* [-oo, '<'] */\n }\n\nSTATE_2412_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2412_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2412_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2412_DROP_OUT_DIRECT\");\n goto TERMINAL_367_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"367\");\n QUEX_SET_last_acceptance(367);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2412_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2413:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2413\");\n\nSTATE_2413_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2413_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 61) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_406_DIRECT; /* '=' */\n } else {\n goto STATE_2413_DROP_OUT; /* [-oo, '<'] */\n }\n\nSTATE_2413_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2413_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2413_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2413_DROP_OUT_DIRECT\");\n goto TERMINAL_403_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"403\");\n QUEX_SET_last_acceptance(403);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2413_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2414:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2414\");\n\nSTATE_2414_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2414_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 96) {\n if( input < 65) {\n if( input >= 48 && input < 58 ) {\n goto STATE_2415; /* ['0', '9'] */\n } else {\n goto STATE_2414_DROP_OUT; /* [-oo, '/'] */\n }\n } else {\n if( input >= 91 && input < 95 ) {\n goto STATE_2414_DROP_OUT_DIRECT; /* ['[', '^'] */\n } else {\n goto STATE_2415; /* ['A', 'Z'] */\n }\n }\n } else {\n if( input < 105) {\n if( input < 97) {\n goto STATE_2414_DROP_OUT_DIRECT; /* '`' */\n } else {\n if( input != 104) {\n goto STATE_2415; /* ['a', 'g'] */\n } else {\n goto STATE_2422; /* 'h' */\n }\n }\n } else {\n if( input < 112) {\n if( input != 111) {\n goto STATE_2415; /* ['i', 'n'] */\n } else {\n goto STATE_2421; /* 'o' */\n }\n } else {\n if( input < 123) {\n goto STATE_2415; /* ['p', 'z'] */\n } else {\n goto STATE_2414_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_2414_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2414_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2414_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2414_DROP_OUT_DIRECT\");\n goto TERMINAL_474_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"474\");\n QUEX_SET_last_acceptance(474);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2414_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2415:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2415\");\n\nSTATE_2415_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2415_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 91) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2415_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input < 65) {\n goto STATE_2415_DROP_OUT_DIRECT; /* [':', '@'] */\n } else {\n goto STATE_2415; /* ['A', 'Z'] */\n }\n }\n } else {\n if( input < 96) {\n if( input != 95) {\n goto STATE_2415_DROP_OUT_DIRECT; /* ['[', '^'] */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input >= 97 && input < 123 ) {\n goto STATE_2415; /* ['a', 'z'] */\n } else {\n goto STATE_2415_DROP_OUT_DIRECT; /* '`' */\n }\n }\n }\n\nSTATE_2415_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2415_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2415_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2415_DROP_OUT_DIRECT\");\n goto TERMINAL_474_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"474\");\n QUEX_SET_last_acceptance(474);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2415_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2416:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2416\");\n\nSTATE_2416_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2416_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 95) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2416_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input >= 65 && input < 91 ) {\n goto STATE_2415; /* ['A', 'Z'] */\n } else {\n goto STATE_2416_DROP_OUT_DIRECT; /* [':', '@'] */\n }\n }\n } else {\n if( input < 114) {\n if( input == 96) {\n goto STATE_2416_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input < 115) {\n goto STATE_2417; /* 'r' */\n } else {\n if( input < 123) {\n goto STATE_2415; /* ['s', 'z'] */\n } else {\n goto STATE_2416_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_2416_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2416_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2416_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2416_DROP_OUT_DIRECT\");\n goto TERMINAL_474_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"474\");\n QUEX_SET_last_acceptance(474);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2416_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2417:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2417\");\n\nSTATE_2417_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2417_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 95) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2417_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input >= 65 && input < 91 ) {\n goto STATE_2415; /* ['A', 'Z'] */\n } else {\n goto STATE_2417_DROP_OUT_DIRECT; /* [':', '@'] */\n }\n }\n } else {\n if( input < 101) {\n if( input == 96) {\n goto STATE_2417_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input < 102) {\n goto STATE_2418; /* 'e' */\n } else {\n if( input < 123) {\n goto STATE_2415; /* ['f', 'z'] */\n } else {\n goto STATE_2417_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_2417_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2417_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2417_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2417_DROP_OUT_DIRECT\");\n goto TERMINAL_474_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"474\");\n QUEX_SET_last_acceptance(474);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2417_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2418:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2418\");\n\nSTATE_2418_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2418_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 95) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2418_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input >= 65 && input < 91 ) {\n goto STATE_2415; /* ['A', 'Z'] */\n } else {\n goto STATE_2418_DROP_OUT_DIRECT; /* [':', '@'] */\n }\n }\n } else {\n if( input < 97) {\n if( input == 95) {\n goto STATE_2415; /* '_' */\n } else {\n goto STATE_2418_DROP_OUT_DIRECT; /* '`' */\n }\n } else {\n if( input < 98) {\n goto STATE_2419; /* 'a' */\n } else {\n if( input < 123) {\n goto STATE_2415; /* ['b', 'z'] */\n } else {\n goto STATE_2418_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_2418_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2418_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2418_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2418_DROP_OUT_DIRECT\");\n goto TERMINAL_474_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"474\");\n QUEX_SET_last_acceptance(474);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2418_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2419:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2419\");\n\nSTATE_2419_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2419_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 95) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2419_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input >= 65 && input < 91 ) {\n goto STATE_2415; /* ['A', 'Z'] */\n } else {\n goto STATE_2419_DROP_OUT_DIRECT; /* [':', '@'] */\n }\n }\n } else {\n if( input < 107) {\n if( input == 96) {\n goto STATE_2419_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input < 108) {\n goto STATE_2420; /* 'k' */\n } else {\n if( input < 123) {\n goto STATE_2415; /* ['l', 'z'] */\n } else {\n goto STATE_2419_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_2419_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2419_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2419_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2419_DROP_OUT_DIRECT\");\n goto TERMINAL_474_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"474\");\n QUEX_SET_last_acceptance(474);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2419_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2420:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2420\");\n\nSTATE_2420_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2420_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 91) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2420_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input < 65) {\n goto STATE_2420_DROP_OUT_DIRECT; /* [':', '@'] */\n } else {\n goto STATE_2415; /* ['A', 'Z'] */\n }\n }\n } else {\n if( input < 96) {\n if( input != 95) {\n goto STATE_2420_DROP_OUT_DIRECT; /* ['[', '^'] */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input >= 97 && input < 123 ) {\n goto STATE_2415; /* ['a', 'z'] */\n } else {\n goto STATE_2420_DROP_OUT_DIRECT; /* '`' */\n }\n }\n }\n\nSTATE_2420_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2420_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2420_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2420_DROP_OUT_DIRECT\");\n goto TERMINAL_460_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"460\");\n QUEX_SET_last_acceptance(460);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2420_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2421:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2421\");\n\nSTATE_2421_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2421_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 95) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2421_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input >= 65 && input < 91 ) {\n goto STATE_2415; /* ['A', 'Z'] */\n } else {\n goto STATE_2421_DROP_OUT_DIRECT; /* [':', '@'] */\n }\n }\n } else {\n if( input < 110) {\n if( input == 96) {\n goto STATE_2421_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input < 111) {\n goto STATE_2425; /* 'n' */\n } else {\n if( input < 123) {\n goto STATE_2415; /* ['o', 'z'] */\n } else {\n goto STATE_2421_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_2421_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2421_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2421_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2421_DROP_OUT_DIRECT\");\n goto TERMINAL_474_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"474\");\n QUEX_SET_last_acceptance(474);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2421_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2422:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2422\");\n\nSTATE_2422_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2422_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 95) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2422_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input >= 65 && input < 91 ) {\n goto STATE_2415; /* ['A', 'Z'] */\n } else {\n goto STATE_2422_DROP_OUT_DIRECT; /* [':', '@'] */\n }\n }\n } else {\n if( input < 97) {\n if( input == 95) {\n goto STATE_2415; /* '_' */\n } else {\n goto STATE_2422_DROP_OUT_DIRECT; /* '`' */\n }\n } else {\n if( input < 98) {\n goto STATE_2423; /* 'a' */\n } else {\n if( input < 123) {\n goto STATE_2415; /* ['b', 'z'] */\n } else {\n goto STATE_2422_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_2422_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2422_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2422_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2422_DROP_OUT_DIRECT\");\n goto TERMINAL_474_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"474\");\n QUEX_SET_last_acceptance(474);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2422_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2423:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2423\");\n\nSTATE_2423_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2423_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 95) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2423_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input >= 65 && input < 91 ) {\n goto STATE_2415; /* ['A', 'Z'] */\n } else {\n goto STATE_2423_DROP_OUT_DIRECT; /* [':', '@'] */\n }\n }\n } else {\n if( input < 114) {\n if( input == 96) {\n goto STATE_2423_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input < 115) {\n goto STATE_2424; /* 'r' */\n } else {\n if( input < 123) {\n goto STATE_2415; /* ['s', 'z'] */\n } else {\n goto STATE_2423_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_2423_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2423_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2423_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2423_DROP_OUT_DIRECT\");\n goto TERMINAL_474_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"474\");\n QUEX_SET_last_acceptance(474);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2423_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2424:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2424\");\n\nSTATE_2424_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2424_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 91) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2424_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input < 65) {\n goto STATE_2424_DROP_OUT_DIRECT; /* [':', '@'] */\n } else {\n goto STATE_2415; /* ['A', 'Z'] */\n }\n }\n } else {\n if( input < 96) {\n if( input != 95) {\n goto STATE_2424_DROP_OUT_DIRECT; /* ['[', '^'] */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input >= 97 && input < 123 ) {\n goto STATE_2415; /* ['a', 'z'] */\n } else {\n goto STATE_2424_DROP_OUT_DIRECT; /* '`' */\n }\n }\n }\n\nSTATE_2424_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2424_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2424_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2424_DROP_OUT_DIRECT\");\n goto TERMINAL_334_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"334\");\n QUEX_SET_last_acceptance(334);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2424_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2425:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2425\");\n\nSTATE_2425_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2425_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 96) {\n if( input < 65) {\n if( input >= 48 && input < 58 ) {\n goto STATE_2415; /* ['0', '9'] */\n } else {\n goto STATE_2425_DROP_OUT; /* [-oo, '/'] */\n }\n } else {\n if( input >= 91 && input < 95 ) {\n goto STATE_2425_DROP_OUT_DIRECT; /* ['[', '^'] */\n } else {\n goto STATE_2415; /* ['A', 'Z'] */\n }\n }\n } else {\n if( input < 116) {\n if( input < 97) {\n goto STATE_2425_DROP_OUT_DIRECT; /* '`' */\n } else {\n if( input != 115) {\n goto STATE_2415; /* ['a', 'r'] */\n } else {\n goto STATE_2427; /* 's' */\n }\n }\n } else {\n if( input < 117) {\n goto STATE_2426; /* 't' */\n } else {\n if( input < 123) {\n goto STATE_2415; /* ['u', 'z'] */\n } else {\n goto STATE_2425_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_2425_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2425_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2425_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2425_DROP_OUT_DIRECT\");\n goto TERMINAL_474_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"474\");\n QUEX_SET_last_acceptance(474);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2425_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2426:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2426\");\n\nSTATE_2426_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2426_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 95) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2426_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input >= 65 && input < 91 ) {\n goto STATE_2415; /* ['A', 'Z'] */\n } else {\n goto STATE_2426_DROP_OUT_DIRECT; /* [':', '@'] */\n }\n }\n } else {\n if( input < 105) {\n if( input == 96) {\n goto STATE_2426_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input < 106) {\n goto STATE_2429; /* 'i' */\n } else {\n if( input < 123) {\n goto STATE_2415; /* ['j', 'z'] */\n } else {\n goto STATE_2426_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_2426_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2426_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2426_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2426_DROP_OUT_DIRECT\");\n goto TERMINAL_474_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"474\");\n QUEX_SET_last_acceptance(474);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2426_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2427:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2427\");\n\nSTATE_2427_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2427_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 95) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2427_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input >= 65 && input < 91 ) {\n goto STATE_2415; /* ['A', 'Z'] */\n } else {\n goto STATE_2427_DROP_OUT_DIRECT; /* [':', '@'] */\n }\n }\n } else {\n if( input < 116) {\n if( input == 96) {\n goto STATE_2427_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input < 117) {\n goto STATE_2428; /* 't' */\n } else {\n if( input < 123) {\n goto STATE_2415; /* ['u', 'z'] */\n } else {\n goto STATE_2427_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_2427_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2427_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2427_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2427_DROP_OUT_DIRECT\");\n goto TERMINAL_474_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"474\");\n QUEX_SET_last_acceptance(474);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2427_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2428:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2428\");\n\nSTATE_2428_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2428_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 91) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2428_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input < 65) {\n goto STATE_2428_DROP_OUT_DIRECT; /* [':', '@'] */\n } else {\n goto STATE_2415; /* ['A', 'Z'] */\n }\n }\n } else {\n if( input < 96) {\n if( input != 95) {\n goto STATE_2428_DROP_OUT_DIRECT; /* ['[', '^'] */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input >= 97 && input < 123 ) {\n goto STATE_2415; /* ['a', 'z'] */\n } else {\n goto STATE_2428_DROP_OUT_DIRECT; /* '`' */\n }\n }\n }\n\nSTATE_2428_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2428_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2428_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2428_DROP_OUT_DIRECT\");\n goto TERMINAL_439_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"439\");\n QUEX_SET_last_acceptance(439);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2428_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2429:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2429\");\n\nSTATE_2429_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2429_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 95) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2429_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input >= 65 && input < 91 ) {\n goto STATE_2415; /* ['A', 'Z'] */\n } else {\n goto STATE_2429_DROP_OUT_DIRECT; /* [':', '@'] */\n }\n }\n } else {\n if( input < 110) {\n if( input == 96) {\n goto STATE_2429_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input < 111) {\n goto STATE_2430; /* 'n' */\n } else {\n if( input < 123) {\n goto STATE_2415; /* ['o', 'z'] */\n } else {\n goto STATE_2429_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_2429_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2429_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2429_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2429_DROP_OUT_DIRECT\");\n goto TERMINAL_474_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"474\");\n QUEX_SET_last_acceptance(474);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2429_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2430:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2430\");\n\nSTATE_2430_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2430_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 95) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2430_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input >= 65 && input < 91 ) {\n goto STATE_2415; /* ['A', 'Z'] */\n } else {\n goto STATE_2430_DROP_OUT_DIRECT; /* [':', '@'] */\n }\n }\n } else {\n if( input < 117) {\n if( input == 96) {\n goto STATE_2430_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input < 118) {\n goto STATE_2431; /* 'u' */\n } else {\n if( input < 123) {\n goto STATE_2415; /* ['v', 'z'] */\n } else {\n goto STATE_2430_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_2430_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2430_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2430_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2430_DROP_OUT_DIRECT\");\n goto TERMINAL_474_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"474\");\n QUEX_SET_last_acceptance(474);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2430_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2431:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2431\");\n\nSTATE_2431_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2431_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 95) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2431_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input >= 65 && input < 91 ) {\n goto STATE_2415; /* ['A', 'Z'] */\n } else {\n goto STATE_2431_DROP_OUT_DIRECT; /* [':', '@'] */\n }\n }\n } else {\n if( input < 101) {\n if( input == 96) {\n goto STATE_2431_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input < 102) {\n goto STATE_2432; /* 'e' */\n } else {\n if( input < 123) {\n goto STATE_2415; /* ['f', 'z'] */\n } else {\n goto STATE_2431_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_2431_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2431_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2431_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2431_DROP_OUT_DIRECT\");\n goto TERMINAL_474_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"474\");\n QUEX_SET_last_acceptance(474);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2431_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2432:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2432\");\n\nSTATE_2432_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2432_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 91) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2432_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input < 65) {\n goto STATE_2432_DROP_OUT_DIRECT; /* [':', '@'] */\n } else {\n goto STATE_2415; /* ['A', 'Z'] */\n }\n }\n } else {\n if( input < 96) {\n if( input != 95) {\n goto STATE_2432_DROP_OUT_DIRECT; /* ['[', '^'] */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input >= 97 && input < 123 ) {\n goto STATE_2415; /* ['a', 'z'] */\n } else {\n goto STATE_2432_DROP_OUT_DIRECT; /* '`' */\n }\n }\n }\n\nSTATE_2432_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2432_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2432_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2432_DROP_OUT_DIRECT\");\n goto TERMINAL_463_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"463\");\n QUEX_SET_last_acceptance(463);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2432_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2435:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2435\");\n\nSTATE_2435_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2435_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 95) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2435_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input >= 65 && input < 91 ) {\n goto STATE_2415; /* ['A', 'Z'] */\n } else {\n goto STATE_2435_DROP_OUT_DIRECT; /* [':', '@'] */\n }\n }\n } else {\n if( input < 115) {\n if( input == 96) {\n goto STATE_2435_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input < 116) {\n goto STATE_2436; /* 's' */\n } else {\n if( input < 123) {\n goto STATE_2415; /* ['t', 'z'] */\n } else {\n goto STATE_2435_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_2435_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2435_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2435_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2435_DROP_OUT_DIRECT\");\n goto TERMINAL_474_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"474\");\n QUEX_SET_last_acceptance(474);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2435_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2436:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2436\");\n\nSTATE_2436_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2436_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 95) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2436_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input >= 65 && input < 91 ) {\n goto STATE_2415; /* ['A', 'Z'] */\n } else {\n goto STATE_2436_DROP_OUT_DIRECT; /* [':', '@'] */\n }\n }\n } else {\n if( input < 105) {\n if( input == 96) {\n goto STATE_2436_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input < 106) {\n goto STATE_2437; /* 'i' */\n } else {\n if( input < 123) {\n goto STATE_2415; /* ['j', 'z'] */\n } else {\n goto STATE_2436_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_2436_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2436_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2436_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2436_DROP_OUT_DIRECT\");\n goto TERMINAL_474_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"474\");\n QUEX_SET_last_acceptance(474);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2436_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2437:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2437\");\n\nSTATE_2437_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2437_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 95) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2437_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input >= 65 && input < 91 ) {\n goto STATE_2415; /* ['A', 'Z'] */\n } else {\n goto STATE_2437_DROP_OUT_DIRECT; /* [':', '@'] */\n }\n }\n } else {\n if( input < 103) {\n if( input == 96) {\n goto STATE_2437_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input < 104) {\n goto STATE_2438; /* 'g' */\n } else {\n if( input < 123) {\n goto STATE_2415; /* ['h', 'z'] */\n } else {\n goto STATE_2437_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_2437_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2437_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2437_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2437_DROP_OUT_DIRECT\");\n goto TERMINAL_474_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"474\");\n QUEX_SET_last_acceptance(474);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2437_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2438:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2438\");\n\nSTATE_2438_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2438_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 95) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2438_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input >= 65 && input < 91 ) {\n goto STATE_2415; /* ['A', 'Z'] */\n } else {\n goto STATE_2438_DROP_OUT_DIRECT; /* [':', '@'] */\n }\n }\n } else {\n if( input < 110) {\n if( input == 96) {\n goto STATE_2438_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input < 111) {\n goto STATE_2439; /* 'n' */\n } else {\n if( input < 123) {\n goto STATE_2415; /* ['o', 'z'] */\n } else {\n goto STATE_2438_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_2438_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2438_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2438_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2438_DROP_OUT_DIRECT\");\n goto TERMINAL_474_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"474\");\n QUEX_SET_last_acceptance(474);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2438_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2439:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2439\");\n\nSTATE_2439_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2439_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 95) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2439_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input >= 65 && input < 91 ) {\n goto STATE_2415; /* ['A', 'Z'] */\n } else {\n goto STATE_2439_DROP_OUT_DIRECT; /* [':', '@'] */\n }\n }\n } else {\n if( input < 101) {\n if( input == 96) {\n goto STATE_2439_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input < 102) {\n goto STATE_2440; /* 'e' */\n } else {\n if( input < 123) {\n goto STATE_2415; /* ['f', 'z'] */\n } else {\n goto STATE_2439_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_2439_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2439_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2439_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2439_DROP_OUT_DIRECT\");\n goto TERMINAL_474_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"474\");\n QUEX_SET_last_acceptance(474);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2439_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2440:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2440\");\n\nSTATE_2440_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2440_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 95) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2440_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input >= 65 && input < 91 ) {\n goto STATE_2415; /* ['A', 'Z'] */\n } else {\n goto STATE_2440_DROP_OUT_DIRECT; /* [':', '@'] */\n }\n }\n } else {\n if( input < 100) {\n if( input == 96) {\n goto STATE_2440_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input < 101) {\n goto STATE_2441; /* 'd' */\n } else {\n if( input < 123) {\n goto STATE_2415; /* ['e', 'z'] */\n } else {\n goto STATE_2440_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_2440_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2440_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2440_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2440_DROP_OUT_DIRECT\");\n goto TERMINAL_474_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"474\");\n QUEX_SET_last_acceptance(474);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2440_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2441:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2441\");\n\nSTATE_2441_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2441_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 91) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2441_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input < 65) {\n goto STATE_2441_DROP_OUT_DIRECT; /* [':', '@'] */\n } else {\n goto STATE_2415; /* ['A', 'Z'] */\n }\n }\n } else {\n if( input < 96) {\n if( input != 95) {\n goto STATE_2441_DROP_OUT_DIRECT; /* ['[', '^'] */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input >= 97 && input < 123 ) {\n goto STATE_2415; /* ['a', 'z'] */\n } else {\n goto STATE_2441_DROP_OUT_DIRECT; /* '`' */\n }\n }\n }\n\nSTATE_2441_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2441_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2441_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2441_DROP_OUT_DIRECT\");\n goto TERMINAL_319_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"319\");\n QUEX_SET_last_acceptance(319);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2441_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2443:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2443\");\n\nSTATE_2443_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2443_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 95) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2443_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input >= 65 && input < 91 ) {\n goto STATE_2415; /* ['A', 'Z'] */\n } else {\n goto STATE_2443_DROP_OUT_DIRECT; /* [':', '@'] */\n }\n }\n } else {\n if( input < 110) {\n if( input == 96) {\n goto STATE_2443_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input < 111) {\n goto STATE_2444; /* 'n' */\n } else {\n if( input < 123) {\n goto STATE_2415; /* ['o', 'z'] */\n } else {\n goto STATE_2443_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_2443_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2443_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2443_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2443_DROP_OUT_DIRECT\");\n goto TERMINAL_474_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"474\");\n QUEX_SET_last_acceptance(474);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2443_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2444:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2444\");\n\nSTATE_2444_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2444_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 95) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2444_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input >= 65 && input < 91 ) {\n goto STATE_2415; /* ['A', 'Z'] */\n } else {\n goto STATE_2444_DROP_OUT_DIRECT; /* [':', '@'] */\n }\n }\n } else {\n if( input < 103) {\n if( input == 96) {\n goto STATE_2444_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input < 104) {\n goto STATE_2445; /* 'g' */\n } else {\n if( input < 123) {\n goto STATE_2415; /* ['h', 'z'] */\n } else {\n goto STATE_2444_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_2444_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2444_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2444_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2444_DROP_OUT_DIRECT\");\n goto TERMINAL_474_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"474\");\n QUEX_SET_last_acceptance(474);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2444_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2445:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2445\");\n\nSTATE_2445_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2445_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 91) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2445_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input < 65) {\n goto STATE_2445_DROP_OUT_DIRECT; /* [':', '@'] */\n } else {\n goto STATE_2415; /* ['A', 'Z'] */\n }\n }\n } else {\n if( input < 96) {\n if( input != 95) {\n goto STATE_2445_DROP_OUT_DIRECT; /* ['[', '^'] */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input >= 97 && input < 123 ) {\n goto STATE_2415; /* ['a', 'z'] */\n } else {\n goto STATE_2445_DROP_OUT_DIRECT; /* '`' */\n }\n }\n }\n\nSTATE_2445_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2445_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2445_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2445_DROP_OUT_DIRECT\");\n goto TERMINAL_325_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"325\");\n QUEX_SET_last_acceptance(325);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2445_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2446:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2446\");\n\nSTATE_2446_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2446_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 91) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2446_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input < 65) {\n goto STATE_2446_DROP_OUT_DIRECT; /* [':', '@'] */\n } else {\n goto STATE_2415; /* ['A', 'Z'] */\n }\n }\n } else {\n if( input < 96) {\n if( input != 95) {\n goto STATE_2446_DROP_OUT_DIRECT; /* ['[', '^'] */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input >= 97 && input < 123 ) {\n goto STATE_2415; /* ['a', 'z'] */\n } else {\n goto STATE_2446_DROP_OUT_DIRECT; /* '`' */\n }\n }\n }\n\nSTATE_2446_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2446_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2446_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2446_DROP_OUT_DIRECT\");\n goto TERMINAL_442_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"442\");\n QUEX_SET_last_acceptance(442);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2446_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2447:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2447\");\n\nSTATE_2447_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2447_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 95) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2447_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input >= 65 && input < 91 ) {\n goto STATE_2415; /* ['A', 'Z'] */\n } else {\n goto STATE_2447_DROP_OUT_DIRECT; /* [':', '@'] */\n }\n }\n } else {\n if( input < 116) {\n if( input == 96) {\n goto STATE_2447_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input < 117) {\n goto STATE_2448; /* 't' */\n } else {\n if( input < 123) {\n goto STATE_2415; /* ['u', 'z'] */\n } else {\n goto STATE_2447_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_2447_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2447_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2447_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2447_DROP_OUT_DIRECT\");\n goto TERMINAL_474_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"474\");\n QUEX_SET_last_acceptance(474);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2447_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2448:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2448\");\n\nSTATE_2448_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2448_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 91) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2448_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input < 65) {\n goto STATE_2448_DROP_OUT_DIRECT; /* [':', '@'] */\n } else {\n goto STATE_2415; /* ['A', 'Z'] */\n }\n }\n } else {\n if( input < 96) {\n if( input != 95) {\n goto STATE_2448_DROP_OUT_DIRECT; /* ['[', '^'] */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input >= 97 && input < 123 ) {\n goto STATE_2415; /* ['a', 'z'] */\n } else {\n goto STATE_2448_DROP_OUT_DIRECT; /* '`' */\n }\n }\n }\n\nSTATE_2448_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2448_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2448_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2448_DROP_OUT_DIRECT\");\n goto TERMINAL_322_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"322\");\n QUEX_SET_last_acceptance(322);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2448_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2450:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2450\");\n\nSTATE_2450_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2450_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 102) {\n if( input < 58) {\n if( input < 40) {\n if( input != 39) {\n goto STATE_2450_DROP_OUT; /* [-oo, '&'] */\n } else {\n goto STATE_2453; /* ''' */\n }\n } else {\n if( input < 48) {\n goto STATE_2450_DROP_OUT_DIRECT; /* ['(', '/'] */\n } else {\n goto STATE_2452; /* ['0', '9'] */\n }\n }\n } else {\n if( input < 93) {\n if( input != 92) {\n goto STATE_2450_DROP_OUT_DIRECT; /* [':', '['] */\n } else {\n goto STATE_2452; /* '\\' */\n }\n } else {\n if( input == 97 || input == 98 || input == 99 ) {\n goto STATE_2452;\n } else {\n goto STATE_2450_DROP_OUT;\n }\n }\n }\n } else {\n if( input < 115) {\n if( input == 102 || input == 110 || input == 114 ) {\n goto STATE_2452;\n } else {\n goto STATE_2450_DROP_OUT;\n }\n } else {\n if( input == 116 || input == 118 ) {\n goto STATE_2452;\n } else {\n goto STATE_2450_DROP_OUT;\n }\n }\n }\n\nSTATE_2450_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2450_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2450_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2450_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2450_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2452:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2452\");\n\nSTATE_2452_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2452_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 39) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_480_DIRECT; /* ''' */\n } else {\n goto STATE_2452_DROP_OUT; /* [-oo, '&'] */\n }\n\nSTATE_2452_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2452_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2452_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2452_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2452_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2453:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2453\");\n\nSTATE_2453_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2453_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 39) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_480_DIRECT; /* ''' */\n } else {\n goto STATE_2453_DROP_OUT; /* [-oo, '&'] */\n }\n\nSTATE_2453_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2453_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2453_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2453_DROP_OUT_DIRECT\");\n goto TERMINAL_480_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"480\");\n QUEX_SET_last_acceptance(480);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2453_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2454:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2454\");\n\nSTATE_2454_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2454_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 95) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2454_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input >= 65 && input < 91 ) {\n goto STATE_2415; /* ['A', 'Z'] */\n } else {\n goto STATE_2454_DROP_OUT_DIRECT; /* [':', '@'] */\n }\n }\n } else {\n if( input < 105) {\n if( input == 96) {\n goto STATE_2454_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input < 106) {\n goto STATE_2455; /* 'i' */\n } else {\n if( input < 123) {\n goto STATE_2415; /* ['j', 'z'] */\n } else {\n goto STATE_2454_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_2454_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2454_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2454_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2454_DROP_OUT_DIRECT\");\n goto TERMINAL_474_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"474\");\n QUEX_SET_last_acceptance(474);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2454_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2455:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2455\");\n\nSTATE_2455_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2455_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 95) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2455_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input >= 65 && input < 91 ) {\n goto STATE_2415; /* ['A', 'Z'] */\n } else {\n goto STATE_2455_DROP_OUT_DIRECT; /* [':', '@'] */\n }\n }\n } else {\n if( input < 108) {\n if( input == 96) {\n goto STATE_2455_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input < 109) {\n goto STATE_2456; /* 'l' */\n } else {\n if( input < 123) {\n goto STATE_2415; /* ['m', 'z'] */\n } else {\n goto STATE_2455_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_2455_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2455_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2455_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2455_DROP_OUT_DIRECT\");\n goto TERMINAL_474_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"474\");\n QUEX_SET_last_acceptance(474);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2455_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2456:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2456\");\n\nSTATE_2456_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2456_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 95) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2456_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input >= 65 && input < 91 ) {\n goto STATE_2415; /* ['A', 'Z'] */\n } else {\n goto STATE_2456_DROP_OUT_DIRECT; /* [':', '@'] */\n }\n }\n } else {\n if( input < 101) {\n if( input == 96) {\n goto STATE_2456_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input < 102) {\n goto STATE_2457; /* 'e' */\n } else {\n if( input < 123) {\n goto STATE_2415; /* ['f', 'z'] */\n } else {\n goto STATE_2456_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_2456_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2456_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2456_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2456_DROP_OUT_DIRECT\");\n goto TERMINAL_474_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"474\");\n QUEX_SET_last_acceptance(474);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2456_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2457:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2457\");\n\nSTATE_2457_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2457_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 91) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2457_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input < 65) {\n goto STATE_2457_DROP_OUT_DIRECT; /* [':', '@'] */\n } else {\n goto STATE_2415; /* ['A', 'Z'] */\n }\n }\n } else {\n if( input < 96) {\n if( input != 95) {\n goto STATE_2457_DROP_OUT_DIRECT; /* ['[', '^'] */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input >= 97 && input < 123 ) {\n goto STATE_2415; /* ['a', 'z'] */\n } else {\n goto STATE_2457_DROP_OUT_DIRECT; /* '`' */\n }\n }\n }\n\nSTATE_2457_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2457_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2457_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2457_DROP_OUT_DIRECT\");\n goto TERMINAL_457_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"457\");\n QUEX_SET_last_acceptance(457);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2457_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2458:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2458\");\n\nSTATE_2458_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2458_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 95) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2458_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input >= 65 && input < 91 ) {\n goto STATE_2415; /* ['A', 'Z'] */\n } else {\n goto STATE_2458_DROP_OUT_DIRECT; /* [':', '@'] */\n }\n }\n } else {\n if( input < 105) {\n if( input == 96) {\n goto STATE_2458_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input < 106) {\n goto STATE_2464; /* 'i' */\n } else {\n if( input < 123) {\n goto STATE_2415; /* ['j', 'z'] */\n } else {\n goto STATE_2458_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_2458_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2458_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2458_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2458_DROP_OUT_DIRECT\");\n goto TERMINAL_474_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"474\");\n QUEX_SET_last_acceptance(474);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2458_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2459:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2459\");\n\nSTATE_2459_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2459_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 95) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2459_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input >= 65 && input < 91 ) {\n goto STATE_2415; /* ['A', 'Z'] */\n } else {\n goto STATE_2459_DROP_OUT_DIRECT; /* [':', '@'] */\n }\n }\n } else {\n if( input < 114) {\n if( input == 96) {\n goto STATE_2459_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input < 115) {\n goto STATE_2460; /* 'r' */\n } else {\n if( input < 123) {\n goto STATE_2415; /* ['s', 'z'] */\n } else {\n goto STATE_2459_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_2459_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2459_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2459_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2459_DROP_OUT_DIRECT\");\n goto TERMINAL_474_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"474\");\n QUEX_SET_last_acceptance(474);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2459_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2460:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2460\");\n\nSTATE_2460_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2460_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 95) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2460_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input >= 65 && input < 91 ) {\n goto STATE_2415; /* ['A', 'Z'] */\n } else {\n goto STATE_2460_DROP_OUT_DIRECT; /* [':', '@'] */\n }\n }\n } else {\n if( input < 117) {\n if( input == 96) {\n goto STATE_2460_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input < 118) {\n goto STATE_2461; /* 'u' */\n } else {\n if( input < 123) {\n goto STATE_2415; /* ['v', 'z'] */\n } else {\n goto STATE_2460_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_2460_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2460_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2460_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2460_DROP_OUT_DIRECT\");\n goto TERMINAL_474_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"474\");\n QUEX_SET_last_acceptance(474);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2460_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2461:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2461\");\n\nSTATE_2461_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2461_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 95) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2461_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input >= 65 && input < 91 ) {\n goto STATE_2415; /* ['A', 'Z'] */\n } else {\n goto STATE_2461_DROP_OUT_DIRECT; /* [':', '@'] */\n }\n }\n } else {\n if( input < 99) {\n if( input == 95 || input == 97 || input == 98 ) {\n goto STATE_2415;\n } else {\n goto STATE_2461_DROP_OUT;\n }\n } else {\n if( input < 100) {\n goto STATE_2462; /* 'c' */\n } else {\n if( input < 123) {\n goto STATE_2415; /* ['d', 'z'] */\n } else {\n goto STATE_2461_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_2461_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2461_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2461_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2461_DROP_OUT_DIRECT\");\n goto TERMINAL_474_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"474\");\n QUEX_SET_last_acceptance(474);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2461_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2462:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2462\");\n\nSTATE_2462_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2462_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 95) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2462_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input >= 65 && input < 91 ) {\n goto STATE_2415; /* ['A', 'Z'] */\n } else {\n goto STATE_2462_DROP_OUT_DIRECT; /* [':', '@'] */\n }\n }\n } else {\n if( input < 116) {\n if( input == 96) {\n goto STATE_2462_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input < 117) {\n goto STATE_2463; /* 't' */\n } else {\n if( input < 123) {\n goto STATE_2415; /* ['u', 'z'] */\n } else {\n goto STATE_2462_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_2462_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2462_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2462_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2462_DROP_OUT_DIRECT\");\n goto TERMINAL_474_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"474\");\n QUEX_SET_last_acceptance(474);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2462_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2463:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2463\");\n\nSTATE_2463_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2463_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 91) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2463_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input < 65) {\n goto STATE_2463_DROP_OUT_DIRECT; /* [':', '@'] */\n } else {\n goto STATE_2415; /* ['A', 'Z'] */\n }\n }\n } else {\n if( input < 96) {\n if( input != 95) {\n goto STATE_2463_DROP_OUT_DIRECT; /* ['[', '^'] */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input >= 97 && input < 123 ) {\n goto STATE_2415; /* ['a', 'z'] */\n } else {\n goto STATE_2463_DROP_OUT_DIRECT; /* '`' */\n }\n }\n }\n\nSTATE_2463_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2463_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2463_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2463_DROP_OUT_DIRECT\");\n goto TERMINAL_436_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"436\");\n QUEX_SET_last_acceptance(436);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2463_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2464:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2464\");\n\nSTATE_2464_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2464_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 95) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2464_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input >= 65 && input < 91 ) {\n goto STATE_2415; /* ['A', 'Z'] */\n } else {\n goto STATE_2464_DROP_OUT_DIRECT; /* [':', '@'] */\n }\n }\n } else {\n if( input < 116) {\n if( input == 96) {\n goto STATE_2464_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input < 117) {\n goto STATE_2465; /* 't' */\n } else {\n if( input < 123) {\n goto STATE_2415; /* ['u', 'z'] */\n } else {\n goto STATE_2464_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_2464_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2464_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2464_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2464_DROP_OUT_DIRECT\");\n goto TERMINAL_474_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"474\");\n QUEX_SET_last_acceptance(474);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2464_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2465:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2465\");\n\nSTATE_2465_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2465_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 95) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2465_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input >= 65 && input < 91 ) {\n goto STATE_2415; /* ['A', 'Z'] */\n } else {\n goto STATE_2465_DROP_OUT_DIRECT; /* [':', '@'] */\n }\n }\n } else {\n if( input < 99) {\n if( input == 95 || input == 97 || input == 98 ) {\n goto STATE_2415;\n } else {\n goto STATE_2465_DROP_OUT;\n }\n } else {\n if( input < 100) {\n goto STATE_2466; /* 'c' */\n } else {\n if( input < 123) {\n goto STATE_2415; /* ['d', 'z'] */\n } else {\n goto STATE_2465_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_2465_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2465_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2465_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2465_DROP_OUT_DIRECT\");\n goto TERMINAL_474_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"474\");\n QUEX_SET_last_acceptance(474);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2465_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2466:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2466\");\n\nSTATE_2466_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2466_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 95) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2466_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input >= 65 && input < 91 ) {\n goto STATE_2415; /* ['A', 'Z'] */\n } else {\n goto STATE_2466_DROP_OUT_DIRECT; /* [':', '@'] */\n }\n }\n } else {\n if( input < 104) {\n if( input == 96) {\n goto STATE_2466_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input < 105) {\n goto STATE_2467; /* 'h' */\n } else {\n if( input < 123) {\n goto STATE_2415; /* ['i', 'z'] */\n } else {\n goto STATE_2466_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_2466_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2466_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2466_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2466_DROP_OUT_DIRECT\");\n goto TERMINAL_474_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"474\");\n QUEX_SET_last_acceptance(474);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2466_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2467:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2467\");\n\nSTATE_2467_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2467_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 91) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2467_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input < 65) {\n goto STATE_2467_DROP_OUT_DIRECT; /* [':', '@'] */\n } else {\n goto STATE_2415; /* ['A', 'Z'] */\n }\n }\n } else {\n if( input < 96) {\n if( input != 95) {\n goto STATE_2467_DROP_OUT_DIRECT; /* ['[', '^'] */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input >= 97 && input < 123 ) {\n goto STATE_2415; /* ['a', 'z'] */\n } else {\n goto STATE_2467_DROP_OUT_DIRECT; /* '`' */\n }\n }\n }\n\nSTATE_2467_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2467_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2467_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2467_DROP_OUT_DIRECT\");\n goto TERMINAL_448_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"448\");\n QUEX_SET_last_acceptance(448);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2467_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2468:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2468\");\n\nSTATE_2468_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2468_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 35) {\n if( input < 1) {\n goto STATE_2468_DROP_OUT; /* [-oo, \\0] */\n } else {\n if( input != 34) {\n goto STATE_2400; /* [\\1, '!'] */\n } else {\n goto STATE_2470; /* '\"' */\n }\n }\n } else {\n if( input == 92) {\n goto STATE_2468; /* '\\' */\n } else {\n goto STATE_2400; /* ['#', '['] */\n }\n }\n\nSTATE_2468_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2468_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2468_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2468_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2468_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2470:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2470\");\n\nSTATE_2470_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2470_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"478\");\n QUEX_SET_last_acceptance(478);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n if( input < 35) {\n if( input < 1) {\n goto STATE_2470_DROP_OUT; /* [-oo, \\0] */\n } else {\n if( input != 34) {\n goto STATE_2400; /* [\\1, '!'] */\n } else {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_478_DIRECT; /* '\"' */\n }\n }\n } else {\n if( input == 92) {\n goto STATE_2468; /* '\\' */\n } else {\n goto STATE_2400; /* ['#', '['] */\n }\n }\n\nSTATE_2470_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2470_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2470_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2470_DROP_OUT_DIRECT\");\n goto TERMINAL_478;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"478\");\n QUEX_SET_last_acceptance(478);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2470_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2476:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2476\");\n\nSTATE_2476_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2476_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 95) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2476_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input >= 65 && input < 91 ) {\n goto STATE_2415; /* ['A', 'Z'] */\n } else {\n goto STATE_2476_DROP_OUT_DIRECT; /* [':', '@'] */\n }\n }\n } else {\n if( input < 114) {\n if( input == 96) {\n goto STATE_2476_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input < 115) {\n goto STATE_2481; /* 'r' */\n } else {\n if( input < 123) {\n goto STATE_2415; /* ['s', 'z'] */\n } else {\n goto STATE_2476_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_2476_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2476_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2476_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2476_DROP_OUT_DIRECT\");\n goto TERMINAL_474_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"474\");\n QUEX_SET_last_acceptance(474);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2476_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2477:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2477\");\n\nSTATE_2477_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2477_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 95) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2477_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input >= 65 && input < 91 ) {\n goto STATE_2415; /* ['A', 'Z'] */\n } else {\n goto STATE_2477_DROP_OUT_DIRECT; /* [':', '@'] */\n }\n }\n } else {\n if( input < 111) {\n if( input == 96) {\n goto STATE_2477_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input < 112) {\n goto STATE_2478; /* 'o' */\n } else {\n if( input < 123) {\n goto STATE_2415; /* ['p', 'z'] */\n } else {\n goto STATE_2477_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_2477_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2477_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2477_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2477_DROP_OUT_DIRECT\");\n goto TERMINAL_474_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"474\");\n QUEX_SET_last_acceptance(474);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2477_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2478:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2478\");\n\nSTATE_2478_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2478_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 95) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2478_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input >= 65 && input < 91 ) {\n goto STATE_2415; /* ['A', 'Z'] */\n } else {\n goto STATE_2478_DROP_OUT_DIRECT; /* [':', '@'] */\n }\n }\n } else {\n if( input < 97) {\n if( input == 95) {\n goto STATE_2415; /* '_' */\n } else {\n goto STATE_2478_DROP_OUT_DIRECT; /* '`' */\n }\n } else {\n if( input < 98) {\n goto STATE_2479; /* 'a' */\n } else {\n if( input < 123) {\n goto STATE_2415; /* ['b', 'z'] */\n } else {\n goto STATE_2478_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_2478_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2478_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2478_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2478_DROP_OUT_DIRECT\");\n goto TERMINAL_474_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"474\");\n QUEX_SET_last_acceptance(474);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2478_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2479:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2479\");\n\nSTATE_2479_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2479_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 95) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2479_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input >= 65 && input < 91 ) {\n goto STATE_2415; /* ['A', 'Z'] */\n } else {\n goto STATE_2479_DROP_OUT_DIRECT; /* [':', '@'] */\n }\n }\n } else {\n if( input < 116) {\n if( input == 96) {\n goto STATE_2479_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input < 117) {\n goto STATE_2480; /* 't' */\n } else {\n if( input < 123) {\n goto STATE_2415; /* ['u', 'z'] */\n } else {\n goto STATE_2479_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_2479_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2479_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2479_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2479_DROP_OUT_DIRECT\");\n goto TERMINAL_474_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"474\");\n QUEX_SET_last_acceptance(474);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2479_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2480:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2480\");\n\nSTATE_2480_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2480_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 91) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2480_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input < 65) {\n goto STATE_2480_DROP_OUT_DIRECT; /* [':', '@'] */\n } else {\n goto STATE_2415; /* ['A', 'Z'] */\n }\n }\n } else {\n if( input < 96) {\n if( input != 95) {\n goto STATE_2480_DROP_OUT_DIRECT; /* ['[', '^'] */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input >= 97 && input < 123 ) {\n goto STATE_2415; /* ['a', 'z'] */\n } else {\n goto STATE_2480_DROP_OUT_DIRECT; /* '`' */\n }\n }\n }\n\nSTATE_2480_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2480_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2480_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2480_DROP_OUT_DIRECT\");\n goto TERMINAL_328_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"328\");\n QUEX_SET_last_acceptance(328);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2480_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2481:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2481\");\n\nSTATE_2481_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2481_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 91) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2481_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input < 65) {\n goto STATE_2481_DROP_OUT_DIRECT; /* [':', '@'] */\n } else {\n goto STATE_2415; /* ['A', 'Z'] */\n }\n }\n } else {\n if( input < 96) {\n if( input != 95) {\n goto STATE_2481_DROP_OUT_DIRECT; /* ['[', '^'] */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input >= 97 && input < 123 ) {\n goto STATE_2415; /* ['a', 'z'] */\n } else {\n goto STATE_2481_DROP_OUT_DIRECT; /* '`' */\n }\n }\n }\n\nSTATE_2481_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2481_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2481_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2481_DROP_OUT_DIRECT\");\n goto TERMINAL_451_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"451\");\n QUEX_SET_last_acceptance(451);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2481_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2482:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2482\");\n\nSTATE_2482_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2482_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 95) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2482_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input >= 65 && input < 91 ) {\n goto STATE_2415; /* ['A', 'Z'] */\n } else {\n goto STATE_2482_DROP_OUT_DIRECT; /* [':', '@'] */\n }\n }\n } else {\n if( input < 102) {\n if( input == 96) {\n goto STATE_2482_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input < 103) {\n goto STATE_2488; /* 'f' */\n } else {\n if( input < 123) {\n goto STATE_2415; /* ['g', 'z'] */\n } else {\n goto STATE_2482_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_2482_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2482_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2482_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2482_DROP_OUT_DIRECT\");\n goto TERMINAL_474_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"474\");\n QUEX_SET_last_acceptance(474);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2482_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2483:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2483\");\n\nSTATE_2483_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2483_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 95) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2483_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input >= 65 && input < 91 ) {\n goto STATE_2415; /* ['A', 'Z'] */\n } else {\n goto STATE_2483_DROP_OUT_DIRECT; /* [':', '@'] */\n }\n }\n } else {\n if( input < 117) {\n if( input == 96) {\n goto STATE_2483_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input < 118) {\n goto STATE_2484; /* 'u' */\n } else {\n if( input < 123) {\n goto STATE_2415; /* ['v', 'z'] */\n } else {\n goto STATE_2483_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_2483_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2483_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2483_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2483_DROP_OUT_DIRECT\");\n goto TERMINAL_454_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"454\");\n QUEX_SET_last_acceptance(454);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2483_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2484:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2484\");\n\nSTATE_2484_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2484_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 95) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2484_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input >= 65 && input < 91 ) {\n goto STATE_2415; /* ['A', 'Z'] */\n } else {\n goto STATE_2484_DROP_OUT_DIRECT; /* [':', '@'] */\n }\n }\n } else {\n if( input < 98) {\n if( input == 95 || input == 97 ) {\n goto STATE_2415;\n } else {\n goto STATE_2484_DROP_OUT;\n }\n } else {\n if( input < 99) {\n goto STATE_2485; /* 'b' */\n } else {\n if( input < 123) {\n goto STATE_2415; /* ['c', 'z'] */\n } else {\n goto STATE_2484_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_2484_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2484_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2484_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2484_DROP_OUT_DIRECT\");\n goto TERMINAL_474_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"474\");\n QUEX_SET_last_acceptance(474);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2484_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2485:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2485\");\n\nSTATE_2485_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2485_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 95) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2485_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input >= 65 && input < 91 ) {\n goto STATE_2415; /* ['A', 'Z'] */\n } else {\n goto STATE_2485_DROP_OUT_DIRECT; /* [':', '@'] */\n }\n }\n } else {\n if( input < 108) {\n if( input == 96) {\n goto STATE_2485_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input < 109) {\n goto STATE_2486; /* 'l' */\n } else {\n if( input < 123) {\n goto STATE_2415; /* ['m', 'z'] */\n } else {\n goto STATE_2485_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_2485_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2485_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2485_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2485_DROP_OUT_DIRECT\");\n goto TERMINAL_474_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"474\");\n QUEX_SET_last_acceptance(474);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2485_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2486:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2486\");\n\nSTATE_2486_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2486_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 95) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2486_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input >= 65 && input < 91 ) {\n goto STATE_2415; /* ['A', 'Z'] */\n } else {\n goto STATE_2486_DROP_OUT_DIRECT; /* [':', '@'] */\n }\n }\n } else {\n if( input < 101) {\n if( input == 96) {\n goto STATE_2486_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input < 102) {\n goto STATE_2487; /* 'e' */\n } else {\n if( input < 123) {\n goto STATE_2415; /* ['f', 'z'] */\n } else {\n goto STATE_2486_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_2486_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2486_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2486_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2486_DROP_OUT_DIRECT\");\n goto TERMINAL_474_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"474\");\n QUEX_SET_last_acceptance(474);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2486_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2487:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2487\");\n\nSTATE_2487_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2487_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 91) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2487_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input < 65) {\n goto STATE_2487_DROP_OUT_DIRECT; /* [':', '@'] */\n } else {\n goto STATE_2415; /* ['A', 'Z'] */\n }\n }\n } else {\n if( input < 96) {\n if( input != 95) {\n goto STATE_2487_DROP_OUT_DIRECT; /* ['[', '^'] */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input >= 97 && input < 123 ) {\n goto STATE_2415; /* ['a', 'z'] */\n } else {\n goto STATE_2487_DROP_OUT_DIRECT; /* '`' */\n }\n }\n }\n\nSTATE_2487_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2487_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2487_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2487_DROP_OUT_DIRECT\");\n goto TERMINAL_331_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"331\");\n QUEX_SET_last_acceptance(331);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2487_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2488:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2488\");\n\nSTATE_2488_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2488_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 95) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2488_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input >= 65 && input < 91 ) {\n goto STATE_2415; /* ['A', 'Z'] */\n } else {\n goto STATE_2488_DROP_OUT_DIRECT; /* [':', '@'] */\n }\n }\n } else {\n if( input < 105) {\n if( input == 96) {\n goto STATE_2488_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input < 106) {\n goto STATE_2489; /* 'i' */\n } else {\n if( input < 123) {\n goto STATE_2415; /* ['j', 'z'] */\n } else {\n goto STATE_2488_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_2488_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2488_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2488_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2488_DROP_OUT_DIRECT\");\n goto TERMINAL_474_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"474\");\n QUEX_SET_last_acceptance(474);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2488_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2489:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2489\");\n\nSTATE_2489_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2489_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 95) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2489_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input >= 65 && input < 91 ) {\n goto STATE_2415; /* ['A', 'Z'] */\n } else {\n goto STATE_2489_DROP_OUT_DIRECT; /* [':', '@'] */\n }\n }\n } else {\n if( input < 110) {\n if( input == 96) {\n goto STATE_2489_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input < 111) {\n goto STATE_2490; /* 'n' */\n } else {\n if( input < 123) {\n goto STATE_2415; /* ['o', 'z'] */\n } else {\n goto STATE_2489_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_2489_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2489_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2489_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2489_DROP_OUT_DIRECT\");\n goto TERMINAL_474_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"474\");\n QUEX_SET_last_acceptance(474);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2489_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2490:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2490\");\n\nSTATE_2490_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2490_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 95) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2490_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input >= 65 && input < 91 ) {\n goto STATE_2415; /* ['A', 'Z'] */\n } else {\n goto STATE_2490_DROP_OUT_DIRECT; /* [':', '@'] */\n }\n }\n } else {\n if( input < 101) {\n if( input == 96) {\n goto STATE_2490_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input < 102) {\n goto STATE_2491; /* 'e' */\n } else {\n if( input < 123) {\n goto STATE_2415; /* ['f', 'z'] */\n } else {\n goto STATE_2490_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_2490_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2490_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2490_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2490_DROP_OUT_DIRECT\");\n goto TERMINAL_474_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"474\");\n QUEX_SET_last_acceptance(474);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2490_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2491:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2491\");\n\nSTATE_2491_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2491_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 95) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2491_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input >= 65 && input < 91 ) {\n goto STATE_2415; /* ['A', 'Z'] */\n } else {\n goto STATE_2491_DROP_OUT_DIRECT; /* [':', '@'] */\n }\n }\n } else {\n if( input < 100) {\n if( input == 96) {\n goto STATE_2491_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input < 101) {\n goto STATE_2492; /* 'd' */\n } else {\n if( input < 123) {\n goto STATE_2415; /* ['e', 'z'] */\n } else {\n goto STATE_2491_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_2491_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2491_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2491_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2491_DROP_OUT_DIRECT\");\n goto TERMINAL_474_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"474\");\n QUEX_SET_last_acceptance(474);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2491_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2492:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2492\");\n\nSTATE_2492_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2492_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 91) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2492_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input < 65) {\n goto STATE_2492_DROP_OUT_DIRECT; /* [':', '@'] */\n } else {\n goto STATE_2415; /* ['A', 'Z'] */\n }\n }\n } else {\n if( input < 96) {\n if( input != 95) {\n goto STATE_2492_DROP_OUT_DIRECT; /* ['[', '^'] */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input >= 97 && input < 123 ) {\n goto STATE_2415; /* ['a', 'z'] */\n } else {\n goto STATE_2492_DROP_OUT_DIRECT; /* '`' */\n }\n }\n }\n\nSTATE_2492_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2492_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2492_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2492_DROP_OUT_DIRECT\");\n goto TERMINAL_313_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"313\");\n QUEX_SET_last_acceptance(313);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2492_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2494:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2494\");\n\nSTATE_2494_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2494_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 101) {\n goto STATE_2538; /* 'e' */\n } else {\n goto STATE_2494_DROP_OUT; /* [-oo, 'd'] */\n }\n\nSTATE_2494_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2494_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2494_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2494_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2494_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2495:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2495\");\n\nSTATE_2495_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2495_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 103) {\n if( input != 102) {\n goto STATE_2495_DROP_OUT; /* [-oo, 'e'] */\n } else {\n goto STATE_2518; /* 'f' */\n }\n } else {\n if( input == 110) {\n goto STATE_2519; /* 'n' */\n } else {\n goto STATE_2495_DROP_OUT_DIRECT; /* ['g', 'm'] */\n }\n }\n\nSTATE_2495_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2495_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2495_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2495_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2495_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2497:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2497\");\n\nSTATE_2497_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2497_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 101) {\n if( input < 32) {\n if( input == 9) {\n goto STATE_2497; /* '\\t' */\n } else {\n goto STATE_2497_DROP_OUT; /* [-oo, \\8] */\n }\n } else {\n if( input < 33) {\n goto STATE_2497; /* ' ' */\n } else {\n if( input != 100) {\n goto STATE_2497_DROP_OUT_DIRECT; /* ['!', 'c'] */\n } else {\n goto STATE_2494; /* 'd' */\n }\n }\n }\n } else {\n if( input < 106) {\n if( input < 102) {\n goto STATE_2498; /* 'e' */\n } else {\n if( input != 105) {\n goto STATE_2497_DROP_OUT_DIRECT; /* ['f', 'h'] */\n } else {\n goto STATE_2495; /* 'i' */\n }\n }\n } else {\n if( input == 112) {\n goto STATE_2499; /* 'p' */\n } else {\n goto STATE_2497_DROP_OUT_DIRECT; /* ['j', 'o'] */\n }\n }\n }\n\nSTATE_2497_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2497_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2497_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2497_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2497_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2498:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2498\");\n\nSTATE_2498_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2498_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 110) {\n if( input == 108) {\n goto STATE_2507; /* 'l' */\n } else {\n goto STATE_2498_DROP_OUT; /* [-oo, 'k'] */\n }\n } else {\n if( input < 114) {\n if( input == 110) {\n goto STATE_2505; /* 'n' */\n } else {\n goto STATE_2498_DROP_OUT_DIRECT; /* ['o', 'q'] */\n }\n } else {\n if( input == 114) {\n goto STATE_2506; /* 'r' */\n } else {\n goto STATE_2498_DROP_OUT_DIRECT; /* ['s', oo] */\n }\n }\n }\n\nSTATE_2498_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2498_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2498_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2498_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2498_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2499:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2499\");\n\nSTATE_2499_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2499_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 114) {\n goto STATE_2500; /* 'r' */\n } else {\n goto STATE_2499_DROP_OUT; /* [-oo, 'q'] */\n }\n\nSTATE_2499_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2499_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2499_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2499_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2499_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2500:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2500\");\n\nSTATE_2500_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2500_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 97) {\n goto STATE_2501; /* 'a' */\n } else {\n goto STATE_2500_DROP_OUT; /* [-oo, '`'] */\n }\n\nSTATE_2500_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2500_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2500_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2500_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2500_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2501:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2501\");\n\nSTATE_2501_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2501_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 103) {\n goto STATE_2502; /* 'g' */\n } else {\n goto STATE_2501_DROP_OUT; /* [-oo, 'f'] */\n }\n\nSTATE_2501_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2501_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2501_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2501_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2501_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2502:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2502\");\n\nSTATE_2502_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2502_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 109) {\n goto STATE_2503; /* 'm' */\n } else {\n goto STATE_2502_DROP_OUT; /* [-oo, 'l'] */\n }\n\nSTATE_2502_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2502_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2502_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2502_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2502_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2503:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2503\");\n\nSTATE_2503_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2503_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 97) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_297_DIRECT; /* 'a' */\n } else {\n goto STATE_2503_DROP_OUT; /* [-oo, '`'] */\n }\n\nSTATE_2503_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2503_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2503_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2503_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2503_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2505:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2505\");\n\nSTATE_2505_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2505_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 100) {\n goto STATE_2515; /* 'd' */\n } else {\n goto STATE_2505_DROP_OUT; /* [-oo, 'c'] */\n }\n\nSTATE_2505_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2505_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2505_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2505_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2505_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2506:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2506\");\n\nSTATE_2506_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2506_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 114) {\n goto STATE_2512; /* 'r' */\n } else {\n goto STATE_2506_DROP_OUT; /* [-oo, 'q'] */\n }\n\nSTATE_2506_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2506_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2506_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2506_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2506_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2507:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2507\");\n\nSTATE_2507_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2507_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 106) {\n if( input != 105) {\n goto STATE_2507_DROP_OUT; /* [-oo, 'h'] */\n } else {\n goto STATE_2508; /* 'i' */\n }\n } else {\n if( input == 115) {\n goto STATE_2509; /* 's' */\n } else {\n goto STATE_2507_DROP_OUT_DIRECT; /* ['j', 'r'] */\n }\n }\n\nSTATE_2507_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2507_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2507_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2507_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2507_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2508:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2508\");\n\nSTATE_2508_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2508_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 102) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_227_DIRECT; /* 'f' */\n } else {\n goto STATE_2508_DROP_OUT; /* [-oo, 'e'] */\n }\n\nSTATE_2508_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2508_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2508_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2508_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2508_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2509:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2509\");\n\nSTATE_2509_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2509_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 101) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_283_DIRECT; /* 'e' */\n } else {\n goto STATE_2509_DROP_OUT; /* [-oo, 'd'] */\n }\n\nSTATE_2509_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2509_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2509_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2509_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2509_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2512:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2512\");\n\nSTATE_2512_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2512_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 111) {\n goto STATE_2513; /* 'o' */\n } else {\n goto STATE_2512_DROP_OUT; /* [-oo, 'n'] */\n }\n\nSTATE_2512_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2512_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2512_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2512_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2512_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2513:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2513\");\n\nSTATE_2513_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2513_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 114) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_311_DIRECT; /* 'r' */\n } else {\n goto STATE_2513_DROP_OUT; /* [-oo, 'q'] */\n }\n\nSTATE_2513_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2513_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2513_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2513_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2513_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2515:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2515\");\n\nSTATE_2515_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2515_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 105) {\n goto STATE_2516; /* 'i' */\n } else {\n goto STATE_2515_DROP_OUT; /* [-oo, 'h'] */\n }\n\nSTATE_2515_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2515_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2515_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2515_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2515_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2516:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2516\");\n\nSTATE_2516_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2516_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 102) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_269_DIRECT; /* 'f' */\n } else {\n goto STATE_2516_DROP_OUT; /* [-oo, 'e'] */\n }\n\nSTATE_2516_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2516_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2516_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2516_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2516_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2518:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2518\");\n\nSTATE_2518_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2518_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"213\");\n QUEX_SET_last_acceptance(213);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n if( input < 101) {\n if( input != 100) {\n goto STATE_2518_DROP_OUT; /* [-oo, 'c'] */\n } else {\n goto STATE_2531; /* 'd' */\n }\n } else {\n if( input == 110) {\n goto STATE_2532; /* 'n' */\n } else {\n goto STATE_2518_DROP_OUT_DIRECT; /* ['e', 'm'] */\n }\n }\n\nSTATE_2518_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2518_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2518_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2518_DROP_OUT_DIRECT\");\n goto TERMINAL_213;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"213\");\n QUEX_SET_last_acceptance(213);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2518_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2519:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2519\");\n\nSTATE_2519_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2519_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 99) {\n goto STATE_2520; /* 'c' */\n } else {\n goto STATE_2519_DROP_OUT; /* [-oo, 'b'] */\n }\n\nSTATE_2519_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2519_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2519_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2519_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2519_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2520:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2520\");\n\nSTATE_2520_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2520_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 108) {\n goto STATE_2521; /* 'l' */\n } else {\n goto STATE_2520_DROP_OUT; /* [-oo, 'k'] */\n }\n\nSTATE_2520_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2520_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2520_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2520_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2520_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2521:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2521\");\n\nSTATE_2521_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2521_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 117) {\n goto STATE_2522; /* 'u' */\n } else {\n goto STATE_2521_DROP_OUT; /* [-oo, 't'] */\n }\n\nSTATE_2521_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2521_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2521_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2521_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2521_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2522:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2522\");\n\nSTATE_2522_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2522_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 100) {\n goto STATE_2523; /* 'd' */\n } else {\n goto STATE_2522_DROP_OUT; /* [-oo, 'c'] */\n }\n\nSTATE_2522_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2522_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2522_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2522_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2522_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2523:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2523\");\n\nSTATE_2523_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2523_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 101) {\n goto STATE_2524; /* 'e' */\n } else {\n goto STATE_2523_DROP_OUT; /* [-oo, 'd'] */\n }\n\nSTATE_2523_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2523_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2523_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2523_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2523_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2524:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2524\");\n\nSTATE_2524_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2524_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 33) {\n if( input == 9 || input == 32 ) {\n goto STATE_2524;\n } else {\n goto STATE_2524_DROP_OUT;\n }\n } else {\n if( input < 35) {\n if( input == 33) {\n goto STATE_2524_DROP_OUT_DIRECT; /* '!' */\n } else {\n goto STATE_2526; /* '\"' */\n }\n } else {\n if( input == 60) {\n goto STATE_2525; /* '<' */\n } else {\n goto STATE_2524_DROP_OUT_DIRECT; /* ['#', ';'] */\n }\n }\n }\n\nSTATE_2524_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2524_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2524_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2524_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2524_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2525:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2525\");\n\nSTATE_2525_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2525_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 62) {\n if( input < 1) {\n goto STATE_2525_DROP_OUT; /* [-oo, \\0] */\n } else {\n goto STATE_2529; /* [\\1, '='] */\n }\n } else {\n if( input == 62) {\n goto STATE_2525_DROP_OUT_DIRECT; /* '>' */\n } else {\n goto STATE_2529; /* ['?', oo] */\n }\n }\n\nSTATE_2525_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2525_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2525_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2525_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2525_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2526:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2526\");\n\nSTATE_2526_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2526_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 34) {\n if( input < 1) {\n goto STATE_2526_DROP_OUT; /* [-oo, \\0] */\n } else {\n goto STATE_2527; /* [\\1, '!'] */\n }\n } else {\n if( input == 34) {\n goto STATE_2526_DROP_OUT_DIRECT; /* '\"' */\n } else {\n goto STATE_2527; /* ['#', oo] */\n }\n }\n\nSTATE_2526_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2526_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2526_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2526_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2526_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2527:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2527\");\n\nSTATE_2527_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2527_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 34) {\n if( input < 1) {\n goto STATE_2527_DROP_OUT; /* [-oo, \\0] */\n } else {\n goto STATE_2527; /* [\\1, '!'] */\n }\n } else {\n if( input == 34) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_161_DIRECT; /* '\"' */\n } else {\n goto STATE_2527; /* ['#', oo] */\n }\n }\n\nSTATE_2527_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2527_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2527_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2527_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2527_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2529:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2529\");\n\nSTATE_2529_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2529_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 62) {\n if( input < 1) {\n goto STATE_2529_DROP_OUT; /* [-oo, \\0] */\n } else {\n goto STATE_2529; /* [\\1, '='] */\n }\n } else {\n if( input == 62) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_185_DIRECT; /* '>' */\n } else {\n goto STATE_2529; /* ['?', oo] */\n }\n }\n\nSTATE_2529_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2529_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2529_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2529_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2529_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2531:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2531\");\n\nSTATE_2531_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2531_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 101) {\n goto STATE_2536; /* 'e' */\n } else {\n goto STATE_2531_DROP_OUT; /* [-oo, 'd'] */\n }\n\nSTATE_2531_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2531_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2531_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2531_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2531_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2532:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2532\");\n\nSTATE_2532_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2532_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 100) {\n goto STATE_2533; /* 'd' */\n } else {\n goto STATE_2532_DROP_OUT; /* [-oo, 'c'] */\n }\n\nSTATE_2532_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2532_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2532_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2532_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2532_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2533:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2533\");\n\nSTATE_2533_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2533_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 101) {\n goto STATE_2534; /* 'e' */\n } else {\n goto STATE_2533_DROP_OUT; /* [-oo, 'd'] */\n }\n\nSTATE_2533_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2533_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2533_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2533_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2533_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2534:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2534\");\n\nSTATE_2534_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2534_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 102) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_255_DIRECT; /* 'f' */\n } else {\n goto STATE_2534_DROP_OUT; /* [-oo, 'e'] */\n }\n\nSTATE_2534_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2534_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2534_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2534_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2534_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2536:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2536\");\n\nSTATE_2536_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2536_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 102) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_241_DIRECT; /* 'f' */\n } else {\n goto STATE_2536_DROP_OUT; /* [-oo, 'e'] */\n }\n\nSTATE_2536_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2536_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2536_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2536_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2536_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2538:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2538\");\n\nSTATE_2538_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2538_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 102) {\n goto STATE_2539; /* 'f' */\n } else {\n goto STATE_2538_DROP_OUT; /* [-oo, 'e'] */\n }\n\nSTATE_2538_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2538_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2538_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2538_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2538_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2539:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2539\");\n\nSTATE_2539_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2539_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 105) {\n goto STATE_2540; /* 'i' */\n } else {\n goto STATE_2539_DROP_OUT; /* [-oo, 'h'] */\n }\n\nSTATE_2539_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2539_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2539_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2539_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2539_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2540:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2540\");\n\nSTATE_2540_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2540_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 110) {\n goto STATE_2541; /* 'n' */\n } else {\n goto STATE_2540_DROP_OUT; /* [-oo, 'm'] */\n }\n\nSTATE_2540_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2540_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2540_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2540_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2540_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2541:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2541\");\n\nSTATE_2541_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2541_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 101) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_199_DIRECT; /* 'e' */\n } else {\n goto STATE_2541_DROP_OUT; /* [-oo, 'd'] */\n }\n\nSTATE_2541_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2541_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2541_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2541_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2541_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2544:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2544\");\n\nSTATE_2544_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2544_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 95) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2544_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input >= 65 && input < 91 ) {\n goto STATE_2415; /* ['A', 'Z'] */\n } else {\n goto STATE_2544_DROP_OUT_DIRECT; /* [':', '@'] */\n }\n }\n } else {\n if( input < 115) {\n if( input == 96) {\n goto STATE_2544_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input < 116) {\n goto STATE_2545; /* 's' */\n } else {\n if( input < 123) {\n goto STATE_2415; /* ['t', 'z'] */\n } else {\n goto STATE_2544_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_2544_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2544_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2544_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2544_DROP_OUT_DIRECT\");\n goto TERMINAL_474_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"474\");\n QUEX_SET_last_acceptance(474);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2544_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2545:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2545\");\n\nSTATE_2545_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2545_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 95) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2545_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input >= 65 && input < 91 ) {\n goto STATE_2415; /* ['A', 'Z'] */\n } else {\n goto STATE_2545_DROP_OUT_DIRECT; /* [':', '@'] */\n }\n }\n } else {\n if( input < 101) {\n if( input == 96) {\n goto STATE_2545_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input < 102) {\n goto STATE_2546; /* 'e' */\n } else {\n if( input < 123) {\n goto STATE_2415; /* ['f', 'z'] */\n } else {\n goto STATE_2545_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_2545_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2545_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2545_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2545_DROP_OUT_DIRECT\");\n goto TERMINAL_474_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"474\");\n QUEX_SET_last_acceptance(474);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2545_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2546:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2546\");\n\nSTATE_2546_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2546_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 91) {\n if( input < 58) {\n if( input < 48) {\n goto STATE_2546_DROP_OUT; /* [-oo, '/'] */\n } else {\n goto STATE_2415; /* ['0', '9'] */\n }\n } else {\n if( input < 65) {\n goto STATE_2546_DROP_OUT_DIRECT; /* [':', '@'] */\n } else {\n goto STATE_2415; /* ['A', 'Z'] */\n }\n }\n } else {\n if( input < 96) {\n if( input != 95) {\n goto STATE_2546_DROP_OUT_DIRECT; /* ['[', '^'] */\n } else {\n goto STATE_2415; /* '_' */\n }\n } else {\n if( input >= 97 && input < 123 ) {\n goto STATE_2415; /* ['a', 'z'] */\n } else {\n goto STATE_2546_DROP_OUT_DIRECT; /* '`' */\n }\n }\n }\n\nSTATE_2546_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2546_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2546_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2546_DROP_OUT_DIRECT\");\n goto TERMINAL_445_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"445\");\n QUEX_SET_last_acceptance(445);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2546_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\n\n /* (*) Terminal states _______________________________________________________*/\n /**/\n /* Acceptance terminal states, i.e. the 'winner patterns'. This means*/\n /* that the last input dropped out of a state where the longest matching*/\n /* pattern was according to the terminal state. The terminal states are */\n /* numbered after the pattern id.*/\n /**/\n#define Lexeme (me->buffer._lexeme_start_p)\n#define LexemeBegin (me->buffer._lexeme_start_p)\n#define LexemeEnd (me->buffer._input_p)\n#define LexemeL (size_t)(me->buffer._input_p - me->buffer._lexeme_start_p)\nTERMINAL_385:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_385\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_385_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_385_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(2);\n \n #line 142 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_ASSIGN_PLUS); return;\n #else\n self.send(); return QUEX_TKN_ASSIGN_PLUS;\n #endif\n#line 8206 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_131:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_131\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_131_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_131_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count(Lexeme, LexemeEnd);\n {\n /* Character set skipper state */\n { \n /* Skip any character in ['\\t', '\\n'], ' ' */\n # if defined(QUEX_OPTION_LINE_NUMBER_COUNTING) || defined(QUEX_OPTION_COLUMN_NUMBER_COUNTING)\n # ifdef QUEX_OPTION_COLUMN_NUMBER_COUNTING\n QUEX_CHARACTER_POSITION_TYPE column_count_p_410L = QuexBuffer_tell_memory_adr(&me->buffer);\n # endif\n # endif\n \n \n QUEX_BUFFER_ASSERT_CONSISTENCY(&me->buffer);\n __quex_assert(QuexBuffer_content_size(&me->buffer) >= 1);\n if( QuexBuffer_distance_input_to_text_end(&me->buffer) == 0 ) \n goto STATE_410_DROP_OUT;\n \n /* NOTE: For simple skippers the end of content does not have to be overwriten \n * with anything (as done for range skippers). This is so, because the abort\n * criteria is that a character occurs which does not belong to the trigger \n * set. The BufferLimitCode, though, does never belong to any trigger set and\n * thus, no special character is to be set. */\n STATE_410_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_410_INPUT\");\n \n input = QuexBuffer_input_get(&me->buffer); \n \n # if defined(QUEX_OPTION_LINE_NUMBER_COUNTING) || defined(QUEX_OPTION_COLUMN_NUMBER_COUNTING)\n if( input == (QUEX_CHARACTER_TYPE)'\\n' ) { \n ++(self.counter._line_number_at_end);\n # if defined(QUEX_OPTION_COLUMN_NUMBER_COUNTING)\n column_count_p_410L = QuexBuffer_tell_memory_adr(&me->buffer);\n self.counter._column_number_at_end = 0;\n # endif\n }\n # endif\n \n if( input == 9 || input == 10 || input == 32 ) {\n goto STATE_410;\n } else {\n goto STATE_410_DROP_OUT;\n }\n \n \n STATE_410:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_410\");\n \n QuexBuffer_input_p_increment(&me->buffer); /* Now, BLC cannot occur. See above. */\n goto STATE_410_INPUT;\n \n STATE_410_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_410_DROP_OUT\");\n \n /* -- When loading new content it is always taken care that the beginning of the lexeme\n * is not 'shifted' out of the buffer. In the case of skipping, we do not care about\n * the lexeme at all, so do not restrict the load procedure and set the lexeme start\n * to the actual input position. \n * -- The input_p will at this point in time always point to the buffer border. */\n if( QuexBuffer_distance_input_to_text_end(&me->buffer) == 0 ) {\n QUEX_BUFFER_ASSERT_CONSISTENCY(&me->buffer);\n # ifdef QUEX_OPTION_COLUMN_NUMBER_COUNTING\n self.counter._column_number_at_end += QuexBuffer_tell_memory_adr(&me->buffer)\n - column_count_p_410L;\n # endif\n \n QuexBuffer_mark_lexeme_start(&me->buffer);\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n \n QUEX_BUFFER_ASSERT_CONSISTENCY(&me->buffer);\n QuexBuffer_input_p_increment(&me->buffer);\n # ifdef QUEX_OPTION_COLUMN_NUMBER_COUNTING\n column_count_p_410L = QuexBuffer_tell_memory_adr(&me->buffer);\n # endif\n \n goto STATE_410_INPUT;\n } else {\n goto TERMINAL_END_OF_STREAM;\n }\n }\n \n /* STATE_410_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_410_DROP_OUT_DIRECT\");\n \n # ifdef QUEX_OPTION_COLUMN_NUMBER_COUNTING\n self.counter._column_number_at_end += QuexBuffer_tell_memory_adr(&me->buffer)\n - column_count_p_410L;\n # endif\n \n /* There was no buffer limit code, so no end of buffer or end of file --> continue analysis \n * The character we just swallowed must be re-considered by the main state machine.\n * But, note that the initial state does not increment '_input_p'!\n */\n goto __REENTRY_PREPARATION; \n }\n \n }\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_388:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_388\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_388_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_388_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(2);\n \n #line 143 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_ASSIGN_MINUS); return;\n #else\n self.send(); return QUEX_TKN_ASSIGN_MINUS;\n #endif\n#line 8347 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_133:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_133\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_133_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_133_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(2);\n {\n /* Range skipper state */\n {\n /* Delimiter: '*', '/', */\n const QUEX_CHARACTER_TYPE Skipper420[] = { 0x2A, 0x2F, };\n const size_t Skipper420L = 2;\n QUEX_CHARACTER_TYPE* text_end = QuexBuffer_text_end(&me->buffer);\n # if defined(QUEX_OPTION_LINE_NUMBER_COUNTING) || defined(QUEX_OPTION_COLUMN_NUMBER_COUNTING)\n # ifdef QUEX_OPTION_COLUMN_NUMBER_COUNTING\n QUEX_CHARACTER_POSITION_TYPE column_count_p_420 = QuexBuffer_tell_memory_adr(&me->buffer);\n # endif\n # endif\n \n \n STATE_420:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_420\");\n \n QUEX_BUFFER_ASSERT_CONSISTENCY(&me->buffer);\n __quex_assert(QuexBuffer_content_size(&me->buffer) >= Skipper420L );\n \n /* NOTE: If _input_p == end of buffer, then it will drop out immediately out of the\n * loop below and drop into the buffer reload procedure. */\n \n /* Loop eating characters: Break-out as soon as the First Character of the Delimiter\n * (FCD) is reached. Thus, the FCD plays also the role of the Buffer Limit Code. There\n * are two reasons for break-out:\n * (1) we reached a limit (end-of-file or buffer-limit)\n * (2) there was really the FCD in the character stream\n * This must be distinguished after the loop was exited. But, during the 'swallowing' we\n * are very fast, because we do not have to check for two different characters. */\n *text_end = Skipper420[0]; /* Overwrite BufferLimitCode (BLC). */\n while( 1 + 1 == 2 ) {\n \n input = QuexBuffer_input_get(&me->buffer); \n if( input == Skipper420[0]) {\n \n break;\n \n }\n \n \n # if defined(QUEX_OPTION_LINE_NUMBER_COUNTING) || defined(QUEX_OPTION_COLUMN_NUMBER_COUNTING)\n if( input == (QUEX_CHARACTER_TYPE)'\\n' ) { \n ++(self.counter._line_number_at_end);\n # if defined(QUEX_OPTION_COLUMN_NUMBER_COUNTING)\n column_count_p_420 = QuexBuffer_tell_memory_adr(&me->buffer);\n self.counter._column_number_at_end = 0;\n # endif\n }\n # endif\n \n QuexBuffer_input_p_increment(&me->buffer); /* Now, BLC cannot occur. See above. */\n }\n \n *text_end = QUEX_SETTING_BUFFER_LIMIT_CODE; /* Reset BLC. */\n \n /* Case (1) and (2) from above can be distinguished easily: \n *\n * (1) Distance to text end == 0: \n * End-of-File or Buffer-Limit. \n * => goto to drop-out handling\n *\n * (2) Else: \n * First character of delimit reached. \n * => For the verification of the tail of the delimiter it is \n * essential that it is loaded completely into the buffer. \n * For this, it must be required:\n *\n * Distance to text end >= Delimiter length \n *\n * _input_p end\n * | | end - _input_p >= 3\n * [ ][R][E][M][#] \n * \n * The case of reload should be seldom and is costy anyway. \n * Thus let's say, that in this case we simply enter the drop \n * out and start the search for the delimiter all over again.\n *\n * (2.1) Distance to text end < Delimiter length\n * => goto to drop-out handling\n * (2.2) Start detection of tail of delimiter\n *\n */\n if( QuexBuffer_distance_input_to_text_end(&me->buffer) == 0 ) {\n /* (1) */\n goto STATE_420_DROP_OUT; \n } \n else if( Skipper420L && QuexBuffer_distance_input_to_text_end(&me->buffer) < Skipper420L ) {\n /* (2.1) */\n goto STATE_420_DROP_OUT; \n }\n \n /* (2.2) Test the remaining delimiter, but note, that the check must restart at '_input_p + 1'\n * if any later check fails. */\n QuexBuffer_input_p_increment(&me->buffer);\n /* Example: Delimiter = '*', '/'; if we get ...[*][*][/]... then the the first \"*\" causes \n * a drop out out of the 'swallowing loop' and the second \"*\" will mismatch \n * the required \"/\". But, then the second \"*\" must be presented to the\n * swallowing loop and the letter after it completes the 'match'.\n * (The whole discussion, of course, is superflous if the range delimiter has length 1.) */\n input = QuexBuffer_input_get_offset(&me->buffer, 0);\n if( input != Skipper420[1]) {\n goto STATE_420;\n }\n \n {\n QuexBuffer_input_p_add_offset(&me->buffer, 1); \n /* NOTE: The initial state does not increment the input_p. When it detects that\n * it is located on a buffer border, it automatically triggers a reload. No \n * need here to reload the buffer. */\n # ifdef QUEX_OPTION_COLUMN_NUMBER_COUNTING\n self.counter._column_number_at_end += QuexBuffer_tell_memory_adr(&me->buffer)\n - column_count_p_420;\n # endif\n \n goto __REENTRY_PREPARATION; /* End of range reached. */\n }\n \n STATE_420_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_420_DROP_OUT\");\n \n QUEX_BUFFER_ASSERT_CONSISTENCY_LIGHT(&me->buffer);\n /* -- When loading new content it is checked that the beginning of the lexeme\n * is not 'shifted' out of the buffer. In the case of skipping, we do not care about\n * the lexeme at all, so do not restrict the load procedure and set the lexeme start\n * to the actual input position. */\n /* -- According to case (2.1) is is possible that the _input_p does not point to the end\n * of the buffer, thus we record the current position in the lexeme start pointer and\n * recover it after the loading. */\n QuexBuffer_mark_lexeme_start(&me->buffer);\n me->buffer._input_p = text_end;\n # ifdef QUEX_OPTION_COLUMN_NUMBER_COUNTING\n self.counter._column_number_at_end += QuexBuffer_tell_memory_adr(&me->buffer)\n - column_count_p_420;\n # endif\n \n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n /* Recover '_input_p' from lexeme start \n * (inverse of what we just did before the loading) */\n me->buffer._input_p = me->buffer._lexeme_start_p;\n /* After reload, we need to increment _input_p. That's how the game is supposed to be played. \n * But, we recovered from lexeme start pointer, and this one does not need to be incremented. */\n text_end = QuexBuffer_text_end(&me->buffer);\n # ifdef QUEX_OPTION_COLUMN_NUMBER_COUNTING\n column_count_p_420 = QuexBuffer_tell_memory_adr(&me->buffer);\n # endif\n \n QUEX_BUFFER_ASSERT_CONSISTENCY(&me->buffer);\n goto STATE_420;\n }\n /* Here, either the loading failed or it is not enough space to carry a closing delimiter */\n me->buffer._input_p = me->buffer._lexeme_start_p;\n \n }\n \n }\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_391:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_391\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_391_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_391_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(2);\n \n #line 144 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_ASSIGN_MULT); return;\n #else\n self.send(); return QUEX_TKN_ASSIGN_MULT;\n #endif\n#line 8548 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_136:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_136\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_136_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_136_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(2);\n {\n /* Range skipper state */\n {\n /* Delimiter: '\n ', */\n const QUEX_CHARACTER_TYPE Skipper430[] = { 0xA, };\n const size_t Skipper430L = 1;\n QUEX_CHARACTER_TYPE* text_end = QuexBuffer_text_end(&me->buffer);\n # if defined(QUEX_OPTION_LINE_NUMBER_COUNTING) || defined(QUEX_OPTION_COLUMN_NUMBER_COUNTING)\n # ifdef QUEX_OPTION_COLUMN_NUMBER_COUNTING\n QUEX_CHARACTER_POSITION_TYPE column_count_p_430 = QuexBuffer_tell_memory_adr(&me->buffer);\n # endif\n # endif\n \n \n STATE_430:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_430\");\n \n QUEX_BUFFER_ASSERT_CONSISTENCY(&me->buffer);\n __quex_assert(QuexBuffer_content_size(&me->buffer) >= Skipper430L );\n \n /* NOTE: If _input_p == end of buffer, then it will drop out immediately out of the\n * loop below and drop into the buffer reload procedure. */\n \n /* Loop eating characters: Break-out as soon as the First Character of the Delimiter\n * (FCD) is reached. Thus, the FCD plays also the role of the Buffer Limit Code. There\n * are two reasons for break-out:\n * (1) we reached a limit (end-of-file or buffer-limit)\n * (2) there was really the FCD in the character stream\n * This must be distinguished after the loop was exited. But, during the 'swallowing' we\n * are very fast, because we do not have to check for two different characters. */\n *text_end = Skipper430[0]; /* Overwrite BufferLimitCode (BLC). */\n while( 1 + 1 == 2 ) {\n \n input = QuexBuffer_input_get(&me->buffer); \n if( input == Skipper430[0]) {\n \n break;\n \n }\n \n \n QuexBuffer_input_p_increment(&me->buffer); /* Now, BLC cannot occur. See above. */\n }\n \n *text_end = QUEX_SETTING_BUFFER_LIMIT_CODE; /* Reset BLC. */\n \n /* Case (1) and (2) from above can be distinguished easily: \n *\n * (1) Distance to text end == 0: \n * End-of-File or Buffer-Limit. \n * => goto to drop-out handling\n *\n * (2) Else: \n * First character of delimit reached. \n * => For the verification of the tail of the delimiter it is \n * essential that it is loaded completely into the buffer. \n * For this, it must be required:\n *\n * Distance to text end >= Delimiter length \n *\n * _input_p end\n * | | end - _input_p >= 3\n * [ ][R][E][M][#] \n * \n * The case of reload should be seldom and is costy anyway. \n * Thus let's say, that in this case we simply enter the drop \n * out and start the search for the delimiter all over again.\n *\n * (2.1) Distance to text end < Delimiter length\n * => goto to drop-out handling\n * (2.2) Start detection of tail of delimiter\n *\n */\n if( QuexBuffer_distance_input_to_text_end(&me->buffer) == 0 ) {\n /* (1) */\n goto STATE_430_DROP_OUT; \n } \n else if( Skipper430L && QuexBuffer_distance_input_to_text_end(&me->buffer) < Skipper430L ) {\n /* (2.1) */\n goto STATE_430_DROP_OUT; \n }\n # ifdef QUEX_OPTION_LINE_NUMBER_COUNTING\n ++(self.counter._line_number_at_end); /* First limit character was the newline */\n # endif\n /* (2.2) Test the remaining delimiter, but note, that the check must restart at '_input_p + 1'\n * if any later check fails. */\n QuexBuffer_input_p_increment(&me->buffer);\n /* Example: Delimiter = '*', '/'; if we get ...[*][*][/]... then the the first \"*\" causes \n * a drop out out of the 'swallowing loop' and the second \"*\" will mismatch \n * the required \"/\". But, then the second \"*\" must be presented to the\n * swallowing loop and the letter after it completes the 'match'.\n * (The whole discussion, of course, is superflous if the range delimiter has length 1.) */\n \n {\n QuexBuffer_input_p_add_offset(&me->buffer, 0); \n /* NOTE: The initial state does not increment the input_p. When it detects that\n * it is located on a buffer border, it automatically triggers a reload. No \n * need here to reload the buffer. */\n # ifdef QUEX_OPTION_COLUMN_NUMBER_COUNTING\n self.counter._column_number_at_end = 1;\n # endif\n \n goto __REENTRY_PREPARATION; /* End of range reached. */\n }\n \n STATE_430_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_430_DROP_OUT\");\n \n QUEX_BUFFER_ASSERT_CONSISTENCY_LIGHT(&me->buffer);\n /* -- When loading new content it is checked that the beginning of the lexeme\n * is not 'shifted' out of the buffer. In the case of skipping, we do not care about\n * the lexeme at all, so do not restrict the load procedure and set the lexeme start\n * to the actual input position. */\n /* -- According to case (2.1) is is possible that the _input_p does not point to the end\n * of the buffer, thus we record the current position in the lexeme start pointer and\n * recover it after the loading. */\n QuexBuffer_mark_lexeme_start(&me->buffer);\n me->buffer._input_p = text_end;\n # ifdef QUEX_OPTION_COLUMN_NUMBER_COUNTING\n self.counter._column_number_at_end += QuexBuffer_tell_memory_adr(&me->buffer)\n - column_count_p_430;\n # endif\n \n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n /* Recover '_input_p' from lexeme start \n * (inverse of what we just did before the loading) */\n me->buffer._input_p = me->buffer._lexeme_start_p;\n /* After reload, we need to increment _input_p. That's how the game is supposed to be played. \n * But, we recovered from lexeme start pointer, and this one does not need to be incremented. */\n text_end = QuexBuffer_text_end(&me->buffer);\n # ifdef QUEX_OPTION_COLUMN_NUMBER_COUNTING\n column_count_p_430 = QuexBuffer_tell_memory_adr(&me->buffer);\n # endif\n \n QUEX_BUFFER_ASSERT_CONSISTENCY(&me->buffer);\n goto STATE_430;\n }\n /* Here, either the loading failed or it is not enough space to carry a closing delimiter */\n me->buffer._input_p = me->buffer._lexeme_start_p;\n \n }\n \n }\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_394:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_394\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_394_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_394_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(2);\n \n #line 145 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_ASSIGN_DIV); return;\n #else\n self.send(); return QUEX_TKN_ASSIGN_DIV;\n #endif\n#line 8737 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_343:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_343\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_343_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_343_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(1);\n \n #line 128 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_QUESTION_MARK); return;\n #else\n self.send(); return QUEX_TKN_QUESTION_MARK;\n #endif\n#line 8763 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_269:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_269\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_269_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_269_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(LexemeL);\n \n #line 112 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_PP_ENDIF); return;\n #else\n self.send(); return QUEX_TKN_PP_ENDIF;\n #endif\n#line 8789 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_400:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_400\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_400_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_400_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(2);\n \n #line 147 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_NOT_EQ); return;\n #else\n self.send(); return QUEX_TKN_NOT_EQ;\n #endif\n#line 8815 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_403:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_403\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_403_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_403_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(1);\n \n #line 148 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_GREATER); return;\n #else\n self.send(); return QUEX_TKN_GREATER;\n #endif\n#line 8841 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_406:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_406\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_406_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_406_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(2);\n \n #line 149 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_GR_EQ); return;\n #else\n self.send(); return QUEX_TKN_GR_EQ;\n #endif\n#line 8867 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_409:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_409\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_409_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_409_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(1);\n \n #line 150 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_LESS); return;\n #else\n self.send(); return QUEX_TKN_LESS;\n #endif\n#line 8893 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_439:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_439\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_439_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_439_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(5);\n \n #line 160 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_CONST); return;\n #else\n self.send(); return QUEX_TKN_CONST;\n #endif\n#line 8919 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_283:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_283\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_283_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_283_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(LexemeL);\n \n #line 113 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_PP_ELSE); return;\n #else\n self.send(); return QUEX_TKN_PP_ELSE;\n #endif\n#line 8945 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_412:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_412\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_412_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_412_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(2);\n \n #line 151 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_LE_EQ); return;\n #else\n self.send(); return QUEX_TKN_LE_EQ;\n #endif\n#line 8971 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_474:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_474\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_474_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_474_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(LexemeL);\n \n #line 173 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_IDENTIFIER); return;\n #else\n self.send(); return QUEX_TKN_IDENTIFIER;\n #endif\n#line 8997 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_415:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_415\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_415_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_415_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(1);\n \n #line 152 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_NOT); return;\n #else\n self.send(); return QUEX_TKN_NOT;\n #endif\n#line 9023 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_161:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_161\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_161_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_161_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count(Lexeme, LexemeEnd);\n \n #line 105 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_PP_INCLUDE); return;\n #else\n self.send(); return QUEX_TKN_PP_INCLUDE;\n #endif\n#line 9049 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_418:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_418\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_418_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_418_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(1);\n \n #line 153 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_LOGICAL_OR); return;\n #else\n self.send(); return QUEX_TKN_LOGICAL_OR;\n #endif\n#line 9075 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_421:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_421\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_421_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_421_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(1);\n \n #line 154 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_EXCLUSIVE_OR); return;\n #else\n self.send(); return QUEX_TKN_EXCLUSIVE_OR;\n #endif\n#line 9101 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_424:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_424\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_424_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_424_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(2);\n \n #line 155 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_OR); return;\n #else\n self.send(); return QUEX_TKN_OR;\n #endif\n#line 9127 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_297:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_297\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_297_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_297_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(LexemeL);\n \n #line 114 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_PP_PRAGMA); return;\n #else\n self.send(); return QUEX_TKN_PP_PRAGMA;\n #endif\n#line 9153 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_427:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_427\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_427_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_427_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(1);\n \n #line 156 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_AMPERSANT); return;\n #else\n self.send(); return QUEX_TKN_AMPERSANT;\n #endif\n#line 9179 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_430:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_430\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_430_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_430_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(2);\n \n #line 157 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_AND); return;\n #else\n self.send(); return QUEX_TKN_AND;\n #endif\n#line 9205 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_433:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_433\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_433_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_433_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(1);\n \n #line 158 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_COLON); return;\n #else\n self.send(); return QUEX_TKN_COLON;\n #endif\n#line 9231 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_469:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_469\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_469_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_469_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(1);\n \n #line 170 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_DOT); return;\n #else\n self.send(); return QUEX_TKN_DOT;\n #endif\n#line 9257 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_436:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_436\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_436_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_436_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(6);\n \n #line 159 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_STRUCT); return;\n #else\n self.send(); return QUEX_TKN_STRUCT;\n #endif\n#line 9283 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_311:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_311\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_311_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_311_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(LexemeL);\n \n #line 115 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_PP_ERROR); return;\n #else\n self.send(); return QUEX_TKN_PP_ERROR;\n #endif\n#line 9309 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_185:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_185\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_185_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_185_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count(Lexeme, LexemeEnd);\n \n #line 106 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_PP_INCLUDE); return;\n #else\n self.send(); return QUEX_TKN_PP_INCLUDE;\n #endif\n#line 9335 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_442:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_442\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_442_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_442_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(2);\n \n #line 161 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_IF); return;\n #else\n self.send(); return QUEX_TKN_IF;\n #endif\n#line 9361 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_316:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_316\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_316_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_316_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_FixNewlineN(Lexeme, LexemeEnd, 1);\n \n #line 117 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_BACKLASHED_NEWLINE); return;\n #else\n self.send(); return QUEX_TKN_BACKLASHED_NEWLINE;\n #endif\n#line 9387 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_445:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_445\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_445_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_445_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(4);\n \n #line 162 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_ELSE); return;\n #else\n self.send(); return QUEX_TKN_ELSE;\n #endif\n#line 9413 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_319:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_319\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_319_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_319_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(8);\n \n #line 119 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_TYPE_UNSIGNED); return;\n #else\n self.send(); return QUEX_TKN_TYPE_UNSIGNED;\n #endif\n#line 9439 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_448:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_448\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_448_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_448_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(6);\n \n #line 163 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_SWITCH); return;\n #else\n self.send(); return QUEX_TKN_SWITCH;\n #endif\n#line 9465 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_480:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_480\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_480_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_480_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count(Lexeme, LexemeEnd);\n \n #line 176 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_QUOTED_CHAR); return;\n #else\n self.send(); return QUEX_TKN_QUOTED_CHAR;\n #endif\n#line 9491 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_322:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_322\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_322_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_322_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(3);\n \n #line 120 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_TYPE_INT); return;\n #else\n self.send(); return QUEX_TKN_TYPE_INT;\n #endif\n#line 9517 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_451:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_451\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_451_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_451_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(3);\n \n #line 164 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_FOR); return;\n #else\n self.send(); return QUEX_TKN_FOR;\n #endif\n#line 9543 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_325:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_325\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_325_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_325_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(4);\n \n #line 121 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_TYPE_LONG); return;\n #else\n self.send(); return QUEX_TKN_TYPE_LONG;\n #endif\n#line 9569 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_454:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_454\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_454_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_454_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(2);\n \n #line 165 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_DO); return;\n #else\n self.send(); return QUEX_TKN_DO;\n #endif\n#line 9595 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_199:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_199\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_199_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_199_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(LexemeL);\n \n #line 107 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_PP_DEFINE); return;\n #else\n self.send(); return QUEX_TKN_PP_DEFINE;\n #endif\n#line 9621 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_328:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_328\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_328_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_328_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(5);\n \n #line 122 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_TYPE_FLOAT); return;\n #else\n self.send(); return QUEX_TKN_TYPE_FLOAT;\n #endif\n#line 9647 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_457:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_457\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_457_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_457_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(5);\n \n #line 166 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_WHILE); return;\n #else\n self.send(); return QUEX_TKN_WHILE;\n #endif\n#line 9673 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_331:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_331\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_331_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_331_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(6);\n \n #line 123 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_TYPE_DOUBLE); return;\n #else\n self.send(); return QUEX_TKN_TYPE_DOUBLE;\n #endif\n#line 9699 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_460:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_460\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_460_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_460_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(5);\n \n #line 167 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_BREAK); return;\n #else\n self.send(); return QUEX_TKN_BREAK;\n #endif\n#line 9725 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_334:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_334\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_334_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_334_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(4);\n \n #line 124 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_TYPE_CHAR); return;\n #else\n self.send(); return QUEX_TKN_TYPE_CHAR;\n #endif\n#line 9751 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_397:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_397\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_397_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_397_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(2);\n \n #line 146 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_EQ); return;\n #else\n self.send(); return QUEX_TKN_EQ;\n #endif\n#line 9777 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_337:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_337\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\n /* TERMINAL_337_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_337_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(1);\n \n #line 126 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_HASH); return;\n #else\n self.send(); return QUEX_TKN_HASH;\n #endif\n#line 9804 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_466:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_466\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_466_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_466_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(1);\n \n #line 169 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_SEMICOLON); return;\n #else\n self.send(); return QUEX_TKN_SEMICOLON;\n #endif\n#line 9830 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_355:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_355\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_355_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_355_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(1);\n \n #line 132 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_CORNER_BRACKET_O); return;\n #else\n self.send(); return QUEX_TKN_CORNER_BRACKET_O;\n #endif\n#line 9856 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_340:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_340\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_340_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_340_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(2);\n \n #line 127 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_DOUBLE_HASH); return;\n #else\n self.send(); return QUEX_TKN_DOUBLE_HASH;\n #endif\n#line 9882 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_213:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_213\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\n /* TERMINAL_213_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_213_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(LexemeL);\n \n #line 108 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_PP_IF); return;\n #else\n self.send(); return QUEX_TKN_PP_IF;\n #endif\n#line 9909 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_313:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_313\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_313_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_313_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(7);\n \n #line 116 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_PP_DEFINED); return;\n #else\n self.send(); return QUEX_TKN_PP_DEFINED;\n #endif\n#line 9935 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_472:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_472\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_472_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_472_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(1);\n \n #line 171 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_COMMA); return;\n #else\n self.send(); return QUEX_TKN_COMMA;\n #endif\n#line 9961 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_346:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_346\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_346_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_346_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(1);\n \n #line 129 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_TILDE); return;\n #else\n self.send(); return QUEX_TKN_TILDE;\n #endif\n#line 9987 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_463:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_463\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_463_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_463_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(8);\n \n #line 168 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_CONTINUE); return;\n #else\n self.send(); return QUEX_TKN_CONTINUE;\n #endif\n#line 10013 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_476:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_476\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_476_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_476_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(LexemeL);\n \n #line 174 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_NUMBER); return;\n #else\n self.send(); return QUEX_TKN_NUMBER;\n #endif\n#line 10039 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_349:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_349\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_349_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_349_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(1);\n \n #line 130 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_BRACKET_O); return;\n #else\n self.send(); return QUEX_TKN_BRACKET_O;\n #endif\n#line 10065 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_478:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_478\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_478_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_478_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count(Lexeme, LexemeEnd);\n \n #line 175 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_STRING); return;\n #else\n self.send(); return QUEX_TKN_STRING;\n #endif\n#line 10091 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_352:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_352\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_352_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_352_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(1);\n \n #line 131 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_BRACKET_C); return;\n #else\n self.send(); return QUEX_TKN_BRACKET_C;\n #endif\n#line 10117 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_227:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_227\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_227_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_227_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(LexemeL);\n \n #line 109 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_PP_ELIF); return;\n #else\n self.send(); return QUEX_TKN_PP_ELIF;\n #endif\n#line 10143 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_358:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_358\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_358_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_358_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(1);\n \n #line 133 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_CORNER_BRACKET_C); return;\n #else\n self.send(); return QUEX_TKN_CORNER_BRACKET_C;\n #endif\n#line 10169 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_361:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_361\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_361_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_361_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(1);\n \n #line 134 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_CURLY_BRACKET_O); return;\n #else\n self.send(); return QUEX_TKN_CURLY_BRACKET_O;\n #endif\n#line 10195 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_364:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_364\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_364_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_364_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(1);\n \n #line 135 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_CURLY_BRACKET_C); return;\n #else\n self.send(); return QUEX_TKN_CURLY_BRACKET_C;\n #endif\n#line 10221 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_367:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_367\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_367_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_367_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(1);\n \n #line 136 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_OP_ASSIGNMENT); return;\n #else\n self.send(); return QUEX_TKN_OP_ASSIGNMENT;\n #endif\n#line 10247 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_241:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_241\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_241_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_241_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(LexemeL);\n \n #line 110 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_PP_IFDEF); return;\n #else\n self.send(); return QUEX_TKN_PP_IFDEF;\n #endif\n#line 10273 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_370:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_370\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_370_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_370_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(1);\n \n #line 137 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_PLUS); return;\n #else\n self.send(); return QUEX_TKN_PLUS;\n #endif\n#line 10299 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_373:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_373\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_373_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_373_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(1);\n \n #line 138 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_MINUS); return;\n #else\n self.send(); return QUEX_TKN_MINUS;\n #endif\n#line 10325 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_376:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_376\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_376_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_376_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(1);\n \n #line 139 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_MULT); return;\n #else\n self.send(); return QUEX_TKN_MULT;\n #endif\n#line 10351 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_379:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_379\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_379_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_379_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(1);\n \n #line 140 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_DIV); return;\n #else\n self.send(); return QUEX_TKN_DIV;\n #endif\n#line 10377 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_382:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_382\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_382_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_382_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(1);\n \n #line 141 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_MODULO); return;\n #else\n self.send(); return QUEX_TKN_MODULO;\n #endif\n#line 10403 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_255:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_255\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_255_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_255_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(LexemeL);\n \n #line 111 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_PP_IFNDEF); return;\n #else\n self.send(); return QUEX_TKN_PP_IFNDEF;\n #endif\n#line 10429 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\n\n\nTERMINAL_END_OF_STREAM:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_END_OF_STREAM\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n \n #line 103 \"c.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_TERMINATION); return;\n #else\n self.send(); return QUEX_TKN_TERMINATION;\n #endif\n#line 10451 \"c_lexer-core-engine.cpp\"\n \n }\n }\n\n#ifdef __QUEX_OPTION_ANALYSER_RETURN_TYPE_IS_VOID\n return /*__QUEX_TOKEN_ID_TERMINATION*/;\n#else\n return __QUEX_TOKEN_ID_TERMINATION;\n#endif\n\nTERMINAL_DEFAULT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_DEFAULT\");\n\nme->buffer._input_p = me->buffer._lexeme_start_p;\nif( QuexBuffer_is_end_of_file(&me->buffer) ) {\n\n /* Next increment will stop on EOF character. */\n}\n\nelse {\n /* Step over nomatching character */\n QuexBuffer_input_p_increment(&me->buffer);\n}\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count(Lexeme, LexemeEnd);\n self.send(QUEX_TKN_TERMINATION);\n #ifdef __QUEX_OPTION_ANALYSER_RETURN_TYPE_IS_VOID\n return /*__QUEX_TOKEN_ID_TERMINATION*/;\n #else\n return __QUEX_TOKEN_ID_TERMINATION;\n #endif\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\n#undef Lexeme\n#undef LexemeBegin\n#undef LexemeEnd\n#undef LexemeL\n#ifndef __QUEX_OPTION_USE_COMPUTED_GOTOS\n__TERMINAL_ROUTER: {\n /* if last_acceptance => goto correspondent acceptance terminal state*/\n /* else => execute defaul action*/\n switch( last_acceptance ) {\n case 385: goto TERMINAL_385;\n case 131: goto TERMINAL_131;\n case 388: goto TERMINAL_388;\n case 133: goto TERMINAL_133;\n case 391: goto TERMINAL_391;\n case 136: goto TERMINAL_136;\n case 394: goto TERMINAL_394;\n case 343: goto TERMINAL_343;\n case 269: goto TERMINAL_269;\n case 400: goto TERMINAL_400;\n case 403: goto TERMINAL_403;\n case 406: goto TERMINAL_406;\n case 409: goto TERMINAL_409;\n case 439: goto TERMINAL_439;\n case 283: goto TERMINAL_283;\n case 412: goto TERMINAL_412;\n case 474: goto TERMINAL_474;\n case 415: goto TERMINAL_415;\n case 161: goto TERMINAL_161;\n case 418: goto TERMINAL_418;\n case 421: goto TERMINAL_421;\n case 424: goto TERMINAL_424;\n case 297: goto TERMINAL_297;\n case 427: goto TERMINAL_427;\n case 430: goto TERMINAL_430;\n case 433: goto TERMINAL_433;\n case 469: goto TERMINAL_469;\n case 436: goto TERMINAL_436;\n case 311: goto TERMINAL_311;\n case 185: goto TERMINAL_185;\n case 442: goto TERMINAL_442;\n case 316: goto TERMINAL_316;\n case 445: goto TERMINAL_445;\n case 319: goto TERMINAL_319;\n case 448: goto TERMINAL_448;\n case 480: goto TERMINAL_480;\n case 322: goto TERMINAL_322;\n case 451: goto TERMINAL_451;\n case 325: goto TERMINAL_325;\n case 454: goto TERMINAL_454;\n case 199: goto TERMINAL_199;\n case 328: goto TERMINAL_328;\n case 457: goto TERMINAL_457;\n case 331: goto TERMINAL_331;\n case 460: goto TERMINAL_460;\n case 334: goto TERMINAL_334;\n case 397: goto TERMINAL_397;\n case 337: goto TERMINAL_337;\n case 466: goto TERMINAL_466;\n case 355: goto TERMINAL_355;\n case 340: goto TERMINAL_340;\n case 213: goto TERMINAL_213;\n case 313: goto TERMINAL_313;\n case 472: goto TERMINAL_472;\n case 346: goto TERMINAL_346;\n case 463: goto TERMINAL_463;\n case 476: goto TERMINAL_476;\n case 349: goto TERMINAL_349;\n case 478: goto TERMINAL_478;\n case 352: goto TERMINAL_352;\n case 227: goto TERMINAL_227;\n case 358: goto TERMINAL_358;\n case 361: goto TERMINAL_361;\n case 364: goto TERMINAL_364;\n case 367: goto TERMINAL_367;\n case 241: goto TERMINAL_241;\n case 370: goto TERMINAL_370;\n case 373: goto TERMINAL_373;\n case 376: goto TERMINAL_376;\n case 379: goto TERMINAL_379;\n case 382: goto TERMINAL_382;\n case 255: goto TERMINAL_255;\n\n default: goto TERMINAL_DEFAULT;; /* nothing matched */\n }\n }\n#endif /* __QUEX_OPTION_USE_COMPUTED_GOTOS */\n\n \n__REENTRY_PREPARATION:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: __REENTRY_PREPARATION\");\n\n /* (*) Common point for **restarting** lexical analysis.\n * at each time when CONTINUE is called at the end of a pattern. */\n last_acceptance = QUEX_GOTO_TERMINAL_LABEL_INIT_VALUE;\n\n\n /* Post context positions do not have to be reset or initialized. If a state\n * is reached which is associated with 'end of post context' it is clear what\n * post context is meant. This results from the ways the state machine is \n * constructed. A post context positions live time looks like the following:\n *\n * (1) unitialized (don't care)\n * (1.b) on buffer reload it may, or may not be adapted (don't care)\n * (2) when a post context begin state is passed, the it is **SET** (now: take care)\n * (2.b) on buffer reload it **is adapted**.\n * (3) when a terminal state of the post context is reached (which can only be reached\n * for that particular post context, then the post context position is used\n * to reset the input position. */\n\n /* If a mode change happened, then the function must first return and\n * indicate that another mode function is to be called. At this point, \n * we to force a 'return' on a mode change. \n *\n * Pseudo Code: if( previous_mode != current_mode ) {\n * return 0;\n * }\n *\n * When the analyzer returns, the caller function has to watch if a mode change\n * occured. If not it can call this function again. */\n#if defined(QUEX_OPTION_AUTOMATIC_ANALYSIS_CONTINUATION_ON_MODE_CHANGE) || defined(QUEX_OPTION_ASSERTS)\n if( me->DEBUG_analyser_function_at_entry != me->current_analyser_function ) \n#endif\n { \n#if defined(QUEX_OPTION_AUTOMATIC_ANALYSIS_CONTINUATION_ON_MODE_CHANGE)\n# ifdef __QUEX_OPTION_ANALYSER_RETURN_TYPE_IS_VOID\n return /*__QUEX_TOKEN_ID_UNINITIALIZED*/;\n# else\n return __QUEX_TOKEN_ID_UNINITIALIZED;\n# endif\n#elif defined(QUEX_OPTION_ASSERTS)\n QUEX_ERROR_EXIT(\"Mode change without immediate return from the lexical analyser.\");\n#endif\n }\n\n goto __REENTRY;\n\n /* prevent compiler warning 'unused variable': use variables once in a part of the code*/\n /* that is never reached (and deleted by the compiler anyway).*/\n if( 0 == 1 ) {\n int unused = 0;\n unused = unused + PROGRAM.id;\n }\n}\n#include <quex/code_base/temporary_macros_off>\n#if ! defined(__QUEX_SETTING_PLAIN_C)\n} // namespace quex\n#endif\n" }, { "alpha_fraction": 0.431291401386261, "alphanum_fraction": 0.43418875336647034, "avg_line_length": 31.213333129882812, "blob_id": "cad7ff4aef8e3780ed974b8e107c4640538f3c69", "content_id": "b15065255dd625a472a2ae7559f573bda68a94b2", "detected_licenses": [ "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer", "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 2416, "license_type": "permissive", "max_line_length": 102, "num_lines": 75, "path": "/dependencies/quex-0.34.1/demo/005/lexer.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "#include<fstream> \n#include<iostream> \n\n// (*) include lexical analyser header\n#include <./tiny_lexer>\n#include <./tiny_lexer-token_ids>\n\nusing namespace std;\n\nint \nmain(int argc, char** argv) \n{ \n // (*) create token\n quex::Token Token;\n // (*) create the lexical analyser\n // if no command line argument is specified user file 'example.txt'\n quex::tiny_lexer* qlex = new quex::tiny_lexer(argc == 1 ? \"example.txt\" : argv[1]);\n\n // (*) print the version \n // cout << qlex->version() << endl << endl;\n\n cout << \",------------------------------------------------------------------------------------\\n\";\n cout << \"| [START]\\n\";\n\n int number_of_tokens = 0;\n bool continue_lexing_f = true;\n // (*) loop until the 'termination' token arrives\n do {\n // (*) get next token from the token stream\n qlex->get_token(&Token);\n\n // (*) print out token information\n // -- name of the token\n cout << Token.type_id_name() << \"\\t\" << Token.text().c_str() << endl;\n\n switch( Token.type_id() ) {\n default: \n break;\n\n case QUEX_TKN_INCLUDE: \n {\n qlex->get_token(&Token);\n cout << Token.type_id_name() << \"\\t\" << Token.text().c_str() << endl;\n if( Token.type_id() != QUEX_TKN_IDENTIFIER ) {\n cout << \"found 'include' without a subsequent filename. hm?\\n\";\n break;\n }\n \n cout << \">> including: \" << Token.text().c_str() << endl;\n FILE* fh = fopen((const char*)(Token.text().c_str()), \"r\");\n if( fh == 0x0 ) {\n cout << \"file not found\\n\";\n return 0;\n }\n qlex->include_stack.push(fh);\n break;\n \n }\n case QUEX_TKN_TERMINATION:\n if( qlex->include_stack.pop() == false ) continue_lexing_f = false;\n else cout << \"<< return from include\\n\";\n break;\n }\n\n\n ++number_of_tokens;\n\n // (*) check against 'termination'\n } while( continue_lexing_f );\n\n cout << \"| [END] number of token = \" << number_of_tokens << \"\\n\";\n cout << \"`------------------------------------------------------------------------------------\\n\";\n\n return 0;\n}\n" }, { "alpha_fraction": 0.5871129035949707, "alphanum_fraction": 0.5958711504936218, "avg_line_length": 41.03947448730469, "blob_id": "3e3ec3bb3aefad25e1f87100a899bfc0b50e4218", "content_id": "64035e4beb3f7172b4d397f0ab1f1fc91859d0b6", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3197, "license_type": "permissive", "max_line_length": 122, "num_lines": 76, "path": "/dependencies/quex-0.34.1/quex/core_engine/regular_expression/traditional_character_set.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "import sys\nimport StringIO\nimport quex.core_engine.utf8 as utf8\nimport quex.core_engine.regular_expression.snap_backslashed_character as snap_backslashed_character\nfrom quex.core_engine.interval_handling import *\nfrom quex.exception import RegularExpressionException\n\n\n\nclass Tracker:\n def __init__(self):\n self.match_set = NumberSet()\n self.negation_f = False\n \n def consider_interval(self, Begin, End):\n if Begin > End:\n raise RegularExpressionException(\"Character range: '-' requires character with 'lower code' to preceed\\n\" + \\\n \"found range '%s-%s' which corresponds to %i-%i as unicode code points.\" % \\\n (utf8.map_unicode_to_utf8(Begin), utf8.map_unicode_to_utf8(End), Begin, End))\n\n self.match_set.add_interval(Interval(Begin, End))\n\n def consider_letter(self, CharCode):\n self.consider_interval(CharCode, CharCode+1)\n \ndef do_string(UTF8_String):\n return do(StringIO.StringIO(UTF8_String))\n\ndef do(sh):\n \"\"\"Transforms an expression of the form [a-z0-9A-Z] into a NumberSet of\n code points that corresponds to the characters and character ranges mentioned.\n \"\"\"\n assert sh.__class__.__name__ == \"StringIO\" \\\n or sh.__class__.__name__ == \"file\"\n\n def __check_letter(stream, letter):\n position = stream.tell()\n if stream.read(1) == letter: return True\n else: stream.seek(position); return False\n\n # check, if the set is thought to be inverse (preceeded by '^')\n tracker = Tracker()\n\n if __check_letter(sh, \"^\"): tracker.negation_f = True\n\n char_code = None\n while char_code != 0xFF:\n char_code = utf8.__read_one_utf8_code_from_stream(sh)\n\n if char_code == ord(\"-\"):\n raise RegularExpressionException(\"Character range operator '-' requires a preceding character as in 'a-z'.\")\n elif char_code == 0xFF: \n raise RegularExpressionException(\"Missing closing ']' in character range expression.\")\n elif char_code == ord(\"]\"):\n break\n elif char_code == ord(\"\\\\\"):\n char_code = snap_backslashed_character.do(sh)\n\n if not __check_letter(sh, \"-\"): \n # (*) Normal character\n tracker.consider_letter(char_code)\n else:\n # (*) Character range: 'character0' '-' 'character1'\n char_code_2 = utf8.__read_one_utf8_code_from_stream(sh)\n if char_code_2 in [0xFF, ord(']')]: \n raise RegularExpressionException(\"Character range: '-' requires a character following '-'.\")\n elif char_code == ord(\"-\"):\n raise RegularExpressionException(\"Character range operator '-' followed by '-'.\")\n elif char_code_2 == ord(\"\\\\\"): \n char_code_2 = snap_backslashed_character.do(sh) \n\n # value denotes 'end', i.e first character outside the interval => add 1\n tracker.consider_interval(char_code, char_code_2 + 1)\n\n if tracker.negation_f: return tracker.match_set.inverse()\n else: return tracker.match_set\n\n\n" }, { "alpha_fraction": 0.5173310041427612, "alphanum_fraction": 0.530453085899353, "avg_line_length": 44.12849044799805, "blob_id": "f3ff98b108c4e6e6cfcda345ca82e4a0216cb5ec", "content_id": "44c649874342c63e1ce02e699e2e10dd62fc2462", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 8078, "license_type": "permissive", "max_line_length": 124, "num_lines": 179, "path": "/dependencies/quex-0.34.1/quex/code_base/buffer/Buffer_debug.i", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* -*- C++ -*- vim: set syntax=cpp:\n *\n * (C) 2008 Frank-Rene Schaefer */\n#ifndef __INCLUDE_GUARD_QUEX__CODE_BASE__BUFFER__BUFFER_DEBUG_I_\n#define __INCLUDE_GUARD_QUEX__CODE_BASE__BUFFER__BUFFER_DEBUG_I_\n\n#include <quex/code_base/definitions>\n#include <quex/code_base/buffer/Buffer>\n#include <quex/code_base/buffer/BufferFiller>\n\n\n\n#if ! defined (__QUEX_SETTING_PLAIN_C)\nnamespace quex {\n#endif\n\n QUEX_INLINE void BufferFiller_x_show_content(QuexBuffer* buffer); \n QUEX_INLINE void BufferFiller_show_brief_content(QuexBuffer* buffer);\n QUEX_INLINE void BufferFiller_show_content(QuexBuffer* buffer); \n\n QUEX_INLINE void \n BufferFiller_show_brief_content(QuexBuffer* buffer) \n {\n __quex_assert(buffer != 0x0);\n QuexBufferFiller* me = buffer->filler;\n __quex_assert(me != 0x0);\n\n QUEX_BUFFER_ASSERT_CONSISTENCY(buffer);\n __QUEX_STD_printf(\"Begin of Buffer Character Index: %i\\n\", (int)buffer->_content_first_character_index);\n __QUEX_STD_printf(\"End of Buffer Character Index: %i\\n\", (int)me->tell_character_index(me));\n if( buffer->_end_of_file_p == 0x0 )\n __QUEX_STD_printf(\"_end_of_file_p (offset) = <0x0>\\n\");\n else\n __QUEX_STD_printf(\"_end_of_file_p (offset) = %08X\\n\", \n (int)(buffer->_end_of_file_p - buffer->_memory._front));\n __QUEX_STD_printf(\"_input_p (offset) = %08X\\n\", (int)(buffer->_input_p - buffer->_memory._front));\n __QUEX_STD_printf(\"_lexeme_start_p (offset) = %08X\\n\", (int)(buffer->_lexeme_start_p - buffer->_memory._front));\n __QUEX_STD_printf(\"_back (offset) = %08X\\n\", (int)(buffer->_memory._back - buffer->_memory._front));\n }\n\n QUEX_INLINE void \n BufferFiller_x_show_content(QuexBuffer* buffer) \n {\n BufferFiller_show_content(buffer);\n BufferFiller_show_brief_content(buffer);\n }\n\n QUEX_INLINE QUEX_CHARACTER_TYPE\n __BufferFiller_get_border_char(QuexBuffer* buffer, const QUEX_CHARACTER_TYPE* C) \n {\n if ( *C != QUEX_SETTING_BUFFER_LIMIT_CODE ) \n return (QUEX_CHARACTER_TYPE)'?'; \n else if( buffer->_end_of_file_p == C ) \n return (QUEX_CHARACTER_TYPE)']';\n else if( buffer->_content_first_character_index == 0 && buffer->_memory._front == C ) \n return (QUEX_CHARACTER_TYPE)'[';\n else\n return (QUEX_CHARACTER_TYPE)'|';\n }\n\n QUEX_INLINE void\n QuexBuffer_show_content(QuexBuffer* buffer)\n {\n# if QUEX_CHARACTER_TYPE == uint8_t\n# define QUEX_BUFFER_EMPTY_CHAR ((uint8_t)0xFFFFFFFF)\n# elif QUEX_CHARACTER_TYPE == uint16_t\n# define QUEX_BUFFER_EMPTY_CHAR ((uint16_t)0xFFFFFFFF)\n# else /* QUEX_CHARACTER_TYPE == uint32_t */\n# define QUEX_BUFFER_EMPTY_CHAR ((uint32_t)0xFFFFFFFF)\n# endif\n size_t i = 0;\n QUEX_CHARACTER_TYPE EmptyChar = sizeof(QUEX_CHARACTER_TYPE) == 1 ? (QUEX_CHARACTER_TYPE)(0xFF)\n : sizeof(QUEX_CHARACTER_TYPE) == 2 ? (QUEX_CHARACTER_TYPE)(0xFFFF)\n : (QUEX_CHARACTER_TYPE)(0xFFFFFFFF);\n QUEX_CHARACTER_TYPE* ContentFront = QuexBuffer_content_front(buffer);\n QUEX_CHARACTER_TYPE* BufferFront = buffer->_memory._front;\n QUEX_CHARACTER_TYPE* BufferBack = buffer->_memory._back;\n QUEX_CHARACTER_TYPE* iterator = 0x0;\n QUEX_CHARACTER_TYPE* end_p = buffer->_end_of_file_p != 0x0 ? buffer->_end_of_file_p \n : buffer->_memory._back;\n\n __QUEX_STD_printf(\"|%c\", __BufferFiller_get_border_char(buffer, BufferFront));\n for(iterator = ContentFront; iterator != end_p; ++iterator) {\n __QUEX_STD_printf(\"%c\", *iterator == EmptyChar ? '~' : *iterator);\n }\n __QUEX_STD_printf(\"%c\", __BufferFiller_get_border_char(buffer, end_p));\n /**/\n const size_t L = (buffer->_end_of_file_p == 0x0) ? 0 : BufferBack - buffer->_end_of_file_p;\n for(i=0; i < L; ++i) __QUEX_STD_printf(\"|\");\n\n __QUEX_STD_printf(\"|\");\n }\n\n QUEX_INLINE void \n BufferFiller_show_content(QuexBuffer* buffer) \n {\n __quex_assert(buffer != 0x0);\n /* NOTE: If the limiting char needs to be replaced temporarily by\n * a terminating zero.\n * NOTE: This is a **simple** printing function for unit testing and debugging\n * it is thought to print only ASCII characters (i.e. code points < 0xFF)*/\n size_t i = 0;\n const size_t ContentSize = QuexBuffer_content_size(buffer);\n QUEX_CHARACTER_TYPE* ContentFront = QuexBuffer_content_front(buffer);\n QUEX_CHARACTER_TYPE* BufferFront = buffer->_memory._front;\n QUEX_CHARACTER_TYPE* BufferBack = buffer->_memory._back;\n\n /*_________________________________________________________________________________*/\n char* tmp = (char*)__QUEX_ALLOCATE_MEMORY(ContentSize + 4);\n /* tmp[0] = outer border*/\n /* tmp[1] = buffer limit*/\n /* tmp[2...ContentSize+1] = ContentFront[0...ContentSize-1]*/\n /* tmp[ContentSize+2] = buffer limit*/\n /* tmp[ContentSize+3] = outer border*/\n /* tmp[ContentSize+4] = terminating zero*/\n for(i=2; i<ContentSize + 2 ; ++i) tmp[i] = ' ';\n tmp[ContentSize+4] = '\\0';\n tmp[ContentSize+3] = '|';\n tmp[ContentSize+2] = __BufferFiller_get_border_char(buffer, BufferBack);\n tmp[1] = __BufferFiller_get_border_char(buffer, BufferFront);\n tmp[0] = '|';\n /* tmp[_SHOW_current_fallback_n - 1 + 2] = ':'; */\n tmp[buffer->_input_p - ContentFront + 2] = 'C';\n if( buffer->_lexeme_start_p >= ContentFront && buffer->_lexeme_start_p <= BufferBack ) \n tmp[(int)(buffer->_lexeme_start_p - ContentFront) + 2] = 'S';\n /**/\n if ( buffer->_input_p == ContentFront - 2 ) {\n __QUEX_STD_printf(tmp); __QUEX_STD_printf(\" <out>\");\n } else {\n __QUEX_STD_printf(\" \");\n if( *buffer->_input_p == QUEX_SETTING_BUFFER_LIMIT_CODE ) \n __QUEX_STD_printf(\"BLC\");\n else \n __QUEX_STD_printf(\"'%c'\", (char)(*buffer->_input_p));\n }\n /* std::cout << \" = 0x\" << std::hex << int(*buffer->_input_p) << std::dec */\n __QUEX_STD_printf(\"\\n\");\n QuexBuffer_show_content(buffer);\n __QUEX_FREE_MEMORY(tmp);\n }\n\n QUEX_INLINE void \n QuexBuffer_show_byte_content(QuexBuffer* buffer, const int IndentationN) \n {\n __quex_assert(buffer != 0x0);\n QuexBufferMemory* memory = &buffer->_memory;\n __quex_assert(memory != 0x0);\n\n int i = 0, j = 0;\n uint8_t* byte_p = (uint8_t*)memory->_front;\n uint8_t* next_byte_p = (uint8_t*)memory->_front + 1;\n uint8_t* End = (uint8_t*)(memory->_back + 1);\n\n for(j=0; j<IndentationN; ++j) fprintf(stdout, \" \");\n for(; byte_p != End; ++byte_p, ++next_byte_p, ++i) {\n fprintf(stdout, \"%02X\", (int)*byte_p);\n if ( next_byte_p == (uint8_t*)buffer->_end_of_file_p ) \n fprintf(stdout, \"[\");\n else if( byte_p == (uint8_t*)buffer->_end_of_file_p + sizeof(QUEX_CHARACTER_TYPE)-1) \n fprintf(stdout, \"]\");\n else \n fprintf(stdout, \".\");\n if( (i+1) % 0x8 == 0 ) fprintf(stdout, \" \");\n if( (i+1) % 0x10 == 0 ) { \n fprintf(stdout, \"\\n\");\n for(j=0; j<IndentationN; ++j) fprintf(stdout, \" \");\n }\n }\n fprintf(stdout, \"\\n\");\n }\n\n#if ! defined(__QUEX_SETTING_PLAIN_C)\n} /* namespace quex */\n#endif \n\n#include <quex/code_base/buffer/Buffer.i>\n\n\n#endif /* __INCLUDE_GUARD_QUEX__CODE_BASE__BUFFER__BUFFER_DEBUG_I_ */\n" }, { "alpha_fraction": 0.6808441877365112, "alphanum_fraction": 0.6820286512374878, "avg_line_length": 30.269359588623047, "blob_id": "26c73e26bd353d5561a8d121c72a8b2717e038e7", "content_id": "462eac7ab9d52ccceca39a3f1da1ccd5c4094451", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 9287, "license_type": "permissive", "max_line_length": 97, "num_lines": 297, "path": "/engine/background_loader.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <vector>\n#include \"vect_util.h\"\n\nclass BackgroundLoader;\nclass Demand;\ntypedef fast_erase_vector<Demand*> Demands;\n\n#ifndef BACKGROUNDLOADER_H\n#define BACKGROUNDLOADER_H\n\n#include <algorithm>\n#include <condition_variable>\n#include <list>\n#include <mutex>\n#include <thread>\n\n#include <centralised_log.h>\n\n#include \"disk_resource.h\"\n\n/** A least recently used queue, used to select resources to unload in the\n * event of memory pressure. The basic idea is you push to the queue when you\n * no-longer need something, and you pop if you need to free space. If you\n * start using something, you call removeIfPresent to mark it as being used\n * again.\n */\ntemplate<typename T> class LRUQueue {\n\n protected:\n\n typedef std::list<T> Queue;\n\n typedef typename Queue::size_type size_type;\n\n\n public:\n\n /** Create an empty queue. */\n LRUQueue () : mSize(0) { }\n\n /** Destructor. */\n ~LRUQueue () { }\n\n /** If v is in the queue, remove it, otherwise a no-op. */\n inline void removeIfPresent (const T &v)\n {\n //if already in queue, remove\n typename Queue::iterator end = mQueue.end();\n typename Queue::iterator i = std::find(mQueue.begin(), end, v);\n if (i != end) {\n mQueue.erase(i);\n mSize--;\n }\n }\n\n /** Add a new object v to the queue.\n *\n * This means you're not intending to use it anymore, but it is the most recently used thing.\n */\n inline void push (const T &v)\n {\n //it only gets pushed if it's not referenced anywhere\n //so the following line is a waste of time\n //removeIfPresent(v);\n\n //add to young end of queue\n mQueue.push_front(v);\n mSize++;\n }\n\n /** Retrieve the least-recently used thing, and remove it from the queue. */\n inline T pop ()\n {\n //remove from old end of queue\n T v = mQueue.back();\n mQueue.pop_back();\n mSize--;\n return v;\n }\n\n /** Return the number of elements in the queue. This is the number of\n * resources that are loaded but not being used (i.e. it's a cache in case they\n * need to be used again. */\n inline size_type size () const { return mSize; }\n\n /** Make the queue empty. */\n inline void clear () { mQueue.clear() ; mSize=0; }\n\n\n protected:\n\n /** Cache of the number of elements in the queue. */\n size_t mSize;\n\n /** The queue itself, a linked list. */\n Queue mQueue;\n};\n\n\n/** When a GritObject wants to load something, it registers a 'demand' with the\n * BackgroundLoader. This acts as a channel of communication. The object can\n * communicate its changing position (the distance to the demand is used by the\n * background loader to prioritise loads), and the list of resources needed.\n * The BackgroundLoader communicates back when the loading is completed and\n * whether any errors occured.\n *\n * Typical mode of operation is to have a Demand inline in your object,\n * addDiskReource many times to build up the list of needed resources, call\n * requestLoad to start the background loading, waiting for isInBackgroundQueue\n * to return false.\n *\n * Note that when resources are loaded in this fashion, the loading and the\n * increment/decrement aspects of the DiskResource are handled automatically.\n */\nclass Demand : public fast_erase_index {\n\n public:\n\n Demand (void)\n : mInBackgroundQueue(false), mDist(0.0f), incremented(false), causedError(false)\n { }\n\n /** Add a required disk resource (by absolute path to the file). */\n void addDiskResource (const std::string &rn)\n {\n DiskResource *dr = disk_resource_get_or_make(rn);\n if (dr == NULL) return;\n resources.push_back(dr);\n }\n\n /** Clear out the list, useful for reusing a Demand object. */\n void clearDiskResources (void)\n {\n resources.clear();\n }\n\n /** Called by the main thread to get resources loaded prior to activation\n * of objects. Repeated calls update the distance of the object, used for\n * prioritising the queue of demands. Returns !isInBackgroundQueue() for\n * convenience.\n */\n bool requestLoad (float dist);\n\n /** Is the demand registered to be procesed by the background thread? If\n * true, the background thread will (eventually) process this demand. If\n * false, either 1) the demand has never been registered, 2) it was registered\n * and the loading has already completed, or 3) it was registered and all the\n * resources were actually loaded and there was no background loading to be\n * done. Either way, a return value of false following a requestLoad call\n * means that the resources are loaded.\n */\n bool isInBackgroundQueue (void) { return mInBackgroundQueue; }\n\n /* Cancel a requestLoad call, or indicate the resources are no-longer\n * required. They may be unloaded if necessary according to memory pressure.\n * May be called when isInBackgroundQueue() == true in which case the demand is\n * removed from the background queue and any partially completed loading is\n * correctly undone.\n */\n void finishedWith (void);\n\n /** Load resources in the foreground thread, block until complete. Called\n * usually as a result of debug commands from the console. Obviously, this\n * will cause a frame stall (a drop in fps) so is not advised for normal use.\n */\n void immediateLoad (void);\n\n /** Reload resources in the foreground thread, block until complete called\n * usually as a result of debug commands from the console Obviously, this will\n * cause a frame rate stall.\n */\n void immediateReload (void);\n\n /** Are the resources in this Demand loaded yet? Simply tests each one's loaded status. */\n bool loaded (void);\n\n /** Did the background loading throw an exception at all? If so, not all\n * the disk resources are available. It is suggested to call finishedWith()\n * and proceed no further. The error (probably a file not found or other I/O\n * error) will already have been reported to the user in the console.\n */\n bool errorOnLoad (void) { return causedError; }\n\n private:\n\n /** Did we add to the background queue yet? */\n bool mInBackgroundQueue;\n\n /** The vector of resources that are required. */\n DiskResources resources;\n\n /** Distance from the player to the user of these resources. */\n volatile float mDist;\n\n /** Have we called increment on the resources yet? */\n bool incremented;\n\n /** Did an error occur in the background thread? */\n bool causedError;\n\n friend class BackgroundLoader;\n};\n\n\n/** Singleton class that managest the background loading of DiskResources using\n * a system thread to block on the I/O involved. The intent is to avoid stalls\n * in the frame loop due to loading from disk. Resources are loaded ahead of\n * when they are needed, and when multiple resources are needed, the closest to\n * the player is loaded first. */\nclass BackgroundLoader {\n\n public:\n\n\n BackgroundLoader (void);\n\n ~BackgroundLoader (void);\n\n void shutdown (void);\n\n void add (Demand *d);\n\n void remove (Demand *d);\n\n void handleBastards (void);\n\n size_t size (void) { return mDemands.size(); }\n\n void setAllowance (float m);\n\n\n // background thread entry point\n static void thread_main (BackgroundLoader *self);\n\n void thread_main (void);\n\n std::recursive_mutex lock;\n std::condition_variable_any cVar;\n\n protected:\n\n bool nearestDemand (Demand * volatile &return_demand);\n\n DiskResources mBastards;\n volatile unsigned short mNumBastards;\n\n Demands mDemands;\n\n std::thread *mThread;\n\n Demand * volatile mCurrent;\n volatile bool mQuit;\n\n float mAllowance;\n\n\n public:\n\n size_t getLRUQueueSizeGPU (void) const\n { return mDeathRowGPU.size(); }\n size_t getLRUQueueSizeHost (void) const\n { return mDeathRowHost.size(); }\n\n void finishedWith (DiskResource *);\n\n void checkRAMHost (void);\n void checkRAMGPU (void);\n\n protected:\n\n LRUQueue<DiskResource*> mDeathRowGPU;\n LRUQueue<DiskResource*> mDeathRowHost;\n\n};\n\n#endif\n" }, { "alpha_fraction": 0.4663795530796051, "alphanum_fraction": 0.4880073070526123, "avg_line_length": 39.1654052734375, "blob_id": "4e5e57f7bdf5f08ed7682b7fda038f8ffac3824b", "content_id": "178ac02b7b62976a6dd32a388a76da98af693841", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 31811, "license_type": "permissive", "max_line_length": 100, "num_lines": 792, "path": "/engine/gfx/gfx_gasoline_backend.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016;\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <cmath>\n\n#include \"gfx_gasoline_backend.h\"\n\n\nstatic std::string unparse_type (const GfxGslType *t_)\n{\n std::stringstream ss;\n if (auto *t = dynamic_cast<const GfxGslArrayType*>(t_)) {\n ss << unparse_type(t->elementType);\n ss << \"[\" << t->size << \"]\";\n } else if (dynamic_cast<const GfxGslFunctionType*>(t_)) {\n EXCEPTEX << \"Cannot unparse function type.\" << ENDL;\n } else {\n ss << t_;\n }\n return ss.str();\n}\n\nvoid GfxGslBackendUnparser::unparseType (const GfxGslType *t_)\n{\n ss << unparse_type(t_);\n}\n\nvoid GfxGslBackendUnparser::zeroInitialise(const std::string &space, const std::string &name,\n GfxGslType *t_)\n{\n\n if (auto *t = dynamic_cast<const GfxGslFloatType*>(t_)) {\n switch (t->dim) {\n case 4:\n ss << space << name << \".w = 0.0;\\n\";\n case 3:\n ss << space << name << \".z = 0.0;\\n\";\n case 2:\n ss << space << name << \".y = 0.0;\\n\";\n ss << space << name << \".x = 0.0;\\n\";\n return;\n case 1:\n ss << space << name << \" = 0.0;\\n\";\n return;\n }\n\n } else if (auto *t = dynamic_cast<const GfxGslIntType*>(t_)) {\n switch (t->dim) {\n case 4:\n ss << space << name << \".w = 0;\\n\";\n case 3:\n ss << space << name << \".z = 0;\\n\";\n case 2:\n ss << space << name << \".y = 0;\\n\";\n ss << space << name << \".x = 0;\\n\";\n return;\n case 1:\n ss << space << name << \" = 0;\\n\";\n return;\n }\n\n } else if (dynamic_cast<const GfxGslBoolType*>(t_)) {\n ss << space << name << \" = false;\\n\";\n\n } else if (auto *t = dynamic_cast<const GfxGslArrayType*>(t_)) {\n for (unsigned i=0 ; i<t->size ; ++i) {\n std::stringstream name2;\n name2 << name << \"[\" << i << \"]\";\n zeroInitialise(space, name2.str(), t->elementType);\n }\n\n } else {\n EXCEPTEX << \"Cannot zero initialise type: \" << t << ENDL;\n }\n}\n\nvoid GfxGslBackendUnparser::unparse (const GfxGslAst *ast_, int indent)\n{\n std::string space(4 * indent, ' ');\n if (auto ast = dynamic_cast<const GfxGslBlock*>(ast_)) {\n ss << space << \"{\\n\";\n for (auto stmt : ast->stmts) {\n unparse(stmt, indent+1);\n }\n ss << space << \"}\\n\";\n } else if (auto ast = dynamic_cast<const GfxGslShader*>(ast_)) {\n for (auto stmt : ast->stmts) {\n unparse(stmt, indent);\n }\n } else if (auto ast = dynamic_cast<const GfxGslDecl*>(ast_)) {\n std::string name = varPref + ast->id;\n // Define it.\n if (!ast->def->topLevel) {\n ss << space;\n unparseType(ast->def->type);\n ss << \" \" << name << \";\\n\";\n }\n // Initialise it.\n if (auto arrLit = dynamic_cast<const GfxGslLiteralArray*>(ast->init)) {\n for (size_t i=0 ; i<arrLit->elements.size() ; ++i) {\n ss << space << name << \"[\" << i << \"] = \";\n unparse(arrLit->elements[i], indent);\n ss << \";\\n\";\n }\n } else if (ast->init != nullptr) {\n ss << space << name << \" = \";\n unparse(ast->init, indent);\n ss << \";\\n\";\n } else {\n zeroInitialise(space, name, ast->def->type);\n }\n } else if (auto ast = dynamic_cast<const GfxGslIf*>(ast_)) {\n ss << space << \"if (\";\n unparse(ast->cond, indent);\n ss << \") {\\n\";\n unparse(ast->yes, indent+1);\n if (ast->no) {\n ss << space << \"} else {\\n\";\n unparse(ast->no, indent+1);\n }\n ss << space << \"}\\n\";\n } else if (auto ast = dynamic_cast<const GfxGslFor*>(ast_)) {\n std::string space2(4 * (indent + 1), ' ');\n ss << space << \"{\\n\";\n if (ast->id != \"\") {\n std::string name = varPref + ast->id;\n // Define it.\n ss << space2;\n unparseType(ast->def->type);\n ss << \" \" << name << \";\\n\";\n // Initialise it.\n if (ast->init != nullptr) {\n ss << space2 << name << \" = \";\n unparse(ast->init, indent);\n ss << \";\\n\";\n } else {\n zeroInitialise(space2, name, ast->def->type);\n }\n } else if (ast->init != nullptr) {\n unparse(ast->init, indent + 1);\n ss << \";\\n\";\n }\n ss << space2 << \"for (\";\n ss << \" ; \";\n unparse(ast->cond, indent + 1);\n ss << \" ; \";\n if (auto inc_ass = dynamic_cast<const GfxGslAssign*>(ast->inc)) {\n unparse(inc_ass->target, indent + 2);\n ss << \" = \";\n unparse(inc_ass->expr, indent + 2);\n } else {\n unparse(ast->inc, indent + 2);\n }\n ss << \") {\\n\";\n unparse(ast->body, indent + 2);\n ss << space2 << \"}\\n\";\n ss << space << \"}\\n\";\n } else if (auto ast = dynamic_cast<const GfxGslAssign*>(ast_)) {\n ss << space;\n unparse(ast->target, indent);\n ss << \" = \";\n unparse(ast->expr, indent);\n ss << \";\\n\";\n } else if (dynamic_cast<const GfxGslDiscard*>(ast_)) {\n ss << space << \"discard;\\n\";\n } else if (dynamic_cast<const GfxGslReturn*>(ast_)) {\n ss << space << \"return;\\n\";\n\n } else if (auto ast = dynamic_cast<const GfxGslCall*>(ast_)) {\n ss << ast->func;\n if (ast->args.size() == 0) {\n ss << \"()\";\n } else {\n const char *sep = \"(\";\n for (auto arg : ast->args) {\n ss << sep;\n unparse(arg, indent);\n sep = \", \";\n }\n ss << \")\";\n }\n\n } else if (auto ast = dynamic_cast<const GfxGslArrayLookup*>(ast_)) {\n ss << \"(\";\n unparse(ast->target, indent);\n ss << \")[\";\n unparse(ast->index, indent);\n ss << \"]\";\n\n } else if (auto ast = dynamic_cast<const GfxGslField*>(ast_)) {\n if (dynamic_cast<GfxGslGlobalType*>(ast->target->type)) {\n ss << \"global_\" << ast->id;\n } else if (dynamic_cast<GfxGslMatType*>(ast->target->type)) {\n ss << \"mat_\" << ast->id;\n } else if (dynamic_cast<GfxGslVertType*>(ast->target->type)) {\n ss << \"vert_\" << ast->id;\n } else if (dynamic_cast<GfxGslFragType*>(ast->target->type)) {\n ss << \"frag_\" + ast->id;\n } else if (dynamic_cast<GfxGslOutType*>(ast->target->type)) {\n ss << \"out_\" + ast->id;\n } else if (dynamic_cast<GfxGslBodyType*>(ast->target->type)) {\n ss << \"body_\" + ast->id;\n } else if (auto *type = dynamic_cast<GfxGslCoordType*>(ast->target->type)) {\n if (type->dim == 1) {\n ASSERT(ast->id == \"x\" || ast->id == \"r\");\n ss << \"(\";\n unparse(ast->target, indent);\n ss << \")\";\n } else {\n ss << \"(\";\n unparse(ast->target, indent);\n ss << \").\";\n ss << ast->id;\n }\n } else {\n ss << \"(\";\n unparse(ast->target, indent);\n ss << \").\";\n ss << ast->id;\n }\n } else if (auto ast = dynamic_cast<const GfxGslLiteralInt*>(ast_)) {\n ss << \"Int(\" << ast->val << \")\";\n } else if (auto ast = dynamic_cast<const GfxGslLiteralFloat*>(ast_)) {\n ss << \"Float(\" << ast->val << \")\";\n } else if (auto ast = dynamic_cast<const GfxGslLiteralBoolean*>(ast_)) {\n ss << (ast->val ? \"true\" : \"false\");\n } else if (auto ast = dynamic_cast<const GfxGslVar*>(ast_)) {\n ss << varPref << ast->id;\n } else if (auto ast = dynamic_cast<const GfxGslBinary*>(ast_)) {\n if (ast->op == GFX_GSL_OP_MOD) {\n ss << \"mod(\";\n unparse(ast->a, indent);\n ss << \", \";\n unparse(ast->b, indent);\n ss << \")\";\n } else {\n ss << \"(\";\n unparse(ast->a, indent);\n ss << \" \" << to_string(ast->op) << \" \";\n unparse(ast->b, indent);\n ss << \")\";\n }\n } else if (dynamic_cast<const GfxGslGlobal*>(ast_)) {\n ss << \"global\";\n } else if (dynamic_cast<const GfxGslMat*>(ast_)) {\n ss << \"mat\";\n } else if (dynamic_cast<const GfxGslVert*>(ast_)) {\n ss << \"vert\";\n } else if (dynamic_cast<const GfxGslFrag*>(ast_)) {\n ss << \"frag\";\n } else if (dynamic_cast<const GfxGslOut*>(ast_)) {\n ss << \"out\";\n\n } else {\n EXCEPTEX << \"INTERNAL ERROR: Unknown GfxGslAst.\" << ENDL;\n }\n}\n\nstd::string gfx_gasoline_generate_preamble_functions (void)\n{\n std::stringstream ss;\n\n ss << \"Float3 normalise (Float3 v) { return normalize(v); }\\n\";\n ss << \"Float4 pma_decode (Float4 v) { return Float4(v.xyz/v.w, v.w); }\\n\";\n ss << \"Float gamma_decode (Float v) { return pow(v, 2.2); }\\n\";\n ss << \"Float2 gamma_decode (Float2 v) { return pow(v, Float2(2.2, 2.2)); }\\n\";\n ss << \"Float3 gamma_decode (Float3 v) { return pow(v, Float3(2.2, 2.2, 2.2)); }\\n\";\n ss << \"Float4 gamma_decode (Float4 v) { return pow(v, Float4(2.2, 2.2, 2.2, 2.2)); }\\n\";\n ss << \"Float gamma_encode (Float v) { return pow(v, 1/2.2); }\\n\";\n ss << \"Float2 gamma_encode (Float2 v) { return pow(v, Float2(1/2.2, 1/2.2)); }\\n\";\n ss << \"Float3 gamma_encode (Float3 v) { return pow(v, Float3(1/2.2, 1/2.2, 1/2.2)); }\\n\";\n ss << \"Float4 gamma_encode (Float4 v) { return pow(v, Float4(1/2.2, 1/2.2, 1/2.2, 1/2.2)); }\\n\";\n\n ss << \"Float3 desaturate (Float3 c, Float sat)\\n\";\n ss << \"{\\n\";\n ss << \" Float grey = (c.x + c.y + c.z) / 3;\\n\";\n ss << \" return lerp(Float3(grey, grey, grey), c, Float3(sat, sat, sat));\\n\";\n ss << \"}\\n\";\n\n ss << \"Float3 unpack_deferred_diffuse_colour(Float4 texel0, Float4 texel1, Float4 texel2)\\n\";\n ss << \"{\\n\";\n ss << \" return gamma_decode(texel2.rgb);\\n\";\n ss << \"}\\n\\n\";\n\n ss << \"Float unpack_deferred_specular(Float4 texel0, Float4 texel1, Float4 texel2)\\n\";\n ss << \"{\\n\";\n ss << \" return gamma_decode(texel2.a);\\n\";\n ss << \"}\\n\\n\";\n\n ss << \"Float unpack_deferred_shadow_cutoff(Float4 texel0, Float4 texel1, Float4 texel2)\\n\";\n ss << \"{\\n\";\n ss << \" texel0.a *= 255;\\n\";\n ss << \" if (texel0.a >= 128) {\\n\";\n ss << \" texel0.a -= 128;\\n\";\n ss << \" }\\n\";\n ss << \" return texel1.a;\\n\";\n ss << \"}\\n\\n\";\n\n ss << \"Float unpack_deferred_gloss(Float4 texel0, Float4 texel1, Float4 texel2)\\n\";\n ss << \"{\\n\";\n ss << \" return texel1.a;\\n\";\n ss << \"}\\n\\n\";\n\n ss << \"Float unpack_deferred_cam_dist(Float4 texel0, Float4 texel1, Float4 texel2)\\n\";\n ss << \"{\\n\";\n ss << \" return 255.0\\n\";\n ss << \" * (256.0*256.0*texel0.x + 256.0*texel0.y + texel0.z)\\n\";\n ss << \" / (256.0*256.0*256.0 - 1);\\n\";\n ss << \"}\\n\\n\";\n\n ss << \"Float3 unpack_deferred_normal(Float4 texel0, Float4 texel1, Float4 texel2)\\n\";\n ss << \"{\\n\";\n ss << \" Float up = -1;\\n\"; // 1 or -1\n ss << \" texel0.a *= 255;\\n\";\n ss << \" if (texel0.a >= 128) {\\n\";\n ss << \" up = 1;\\n\";\n ss << \" }\\n\";\n // This algorithm is described as USE_NORMAL_ENCODING == 1 in the original uber.cgh.\n ss << \" Float2 low2 = texel1.xy * 255;\\n\"; // range: [0,256)\n ss << \" Float hi_mixed = texel1.z * 255;\\n\"; // range: [0,256)\n ss << \" Float2 hi2;\\n\"; // range: [0, 16)\n ss << \" hi2.y = int(hi_mixed/16);\\n\";\n ss << \" hi2.x = hi_mixed - hi2.y*16;\\n\";\n ss << \" Float2 tmp = low2 + hi2*256;\\n\"; // range: [0, 4096)\n ss << \" Float3 normal;\\n\"; // range: [0, 1]\n ss << \" normal.xy = (tmp/4095) * Float2(2,2) - Float2(1,1);\\n\";\n ss << \" normal.z = up * (sqrt(1 - min(1.0, normal.x*normal.x + normal.y*normal.y)));\\n\";\n ss << \" return normal;\\n\";\n ss << \"}\\n\\n\";\n\n ss << \"void pack_deferred(\\n\";\n ss << \" out Float4 texel0,\\n\";\n ss << \" out Float4 texel1,\\n\";\n ss << \" out Float4 texel2,\\n\";\n ss << \" in Float shadow_oblique_cutoff,\\n\";\n ss << \" in Float3 diff_colour,\\n\";\n ss << \" in Float3 normal,\\n\"; // normalised, view space\n ss << \" in Float specular,\\n\";\n ss << \" in Float cam_dist,\\n\"; // normalised\n ss << \" in Float gloss\\n\";\n ss << \") {\\n\";\n\n // Encode normal:\n // range [0, 1]\n ss << \" Float2 normal1 = (normal.xy + Float2(1, 1)) / 2;\\n\";\n // range [0, 4096)\n ss << \" Float2 normal2 = floor(normal1 * 4095);\\n\";\n // range [0, 16)\n ss << \" Float2 hi2 = floor(normal2 / 256);\\n\";\n // range [0, 256)\n ss << \" Float2 low2 = normal2 - hi2*256;\\n\";\n // range [0, 256)\n ss << \" Float hi_mixed = hi2.x + hi2.y*16;\\n\";\n // range [0, 1]\n ss << \" Float4 encoded_normal = \\n\";\n ss << \" Float4(low2.x/255, low2.y/255, hi_mixed/255, normal.z >= 0.0 ? 1 : 0);\\n\";\n\n // Encode distance from camera\n ss << \" Float v = cam_dist * (256.0*256.0*256.0 - 1);\\n\";\n ss << \" Float3 r;\\n\";\n ss << \" r.x = floor(v / 256.0 / 256.0);\\n\"; // most significant\n ss << \" r.y = floor((v - r.x * 256.0 * 256.0) / 256.0);\\n\"; // middle significant\n ss << \" r.z = (v - r.x * 256.0 * 256.0 - r.y * 256.0);\\n\"; // least significant\n // Note that z component is not floored, but this should not cause a problem as gbuffer write\n // will implicitly floor it.\n ss << \" Float3 split_cam_dist = r / 255.0;\\n\";\n\n ss << \" texel0.xyz = split_cam_dist;\\n\";\n ss << \" texel0.w = (shadow_oblique_cutoff * 127 + encoded_normal.w * 128) / 255;\\n\";\n ss << \" texel1 = Float4(encoded_normal.xyz, gloss);\\n\";\n ss << \" texel2 = Float4(gamma_encode(diff_colour), gamma_encode(specular));\\n\";\n ss << \"}\\n\";\n\n // Punctual lighting simulates the lighting of a fragment by rays all eminating from\n // the same point. Arguments light_diffuse and light_specular are usually the same value.\n // surf_to_light: surface to light vector\n // surf_to_cam: surface to camera vector (typically computed in vertex shader)\n // sd: surface diffuse colour\n // sn: surface normal vector\n // sg: surface gloss (0 to 1)\n // ss: surface spec (0 to 1)\n // light_diffuse: light intensity 0 to 1 or greater for hdr (number of photons, basically)\n // light_specular: light intensity 0 to 1 or greater for hdr (number of photons, basically)\n ss << \"Float3 punctual_lighting(Float3 surf_to_light, Float3 surf_to_cam,\\n\"\n << \" Float3 sd, Float3 sn, Float sg, Float ss,\\n\";\n ss << \" Float3 light_diffuse, Float3 light_specular)\\n\";\n ss << \"{\\n\";\n\n ss << \" Float3 diff_component = light_diffuse * sd;\\n\";\n\n // specular component\n ss << \" Float3 surf_to_half = normalise(0.5*(surf_to_cam + surf_to_light));\\n\";\n ss << \" Float fresnel = ss + (1-ss)\\n\";\n ss << \" * strength(1.0 - dot(surf_to_light, surf_to_half), 5);\\n\";\n ss << \" Float gloss = pow(4096.0, sg);\\n\";\n ss << \" Float highlight = 1.0/8 * (gloss+2) * strength(dot(sn, surf_to_half), gloss);\\n\";\n ss << \" Float3 spec_component = light_specular * fresnel * highlight;\\n\";\n\n ss << \" return (spec_component + diff_component) * max(0.0, dot(sn, surf_to_light));\\n\";\n ss << \"}\\n\";\n return ss.str();\n}\n\nstatic std::string unparse_param_value(const GfxGslParam &p)\n{\n std::stringstream ss;\n // whether float or int, use << for each\n ASSERT(gfx_gasoline_param_is_static(p));\n ss << p;\n return ss.str();\n}\n\nstd::string gfx_gasoline_generate_global_fields (const GfxGslContext &ctx, bool reg)\n{\n std::stringstream ss;\n\n unsigned counter = 0;\n\n for (const auto &pair : ctx.globalFields) {\n if (pair.second.lighting && !ctx.lightingTextures) continue;\n ss << \"uniform \" << pair.second.t << \" global_\" << pair.first;\n if (reg && dynamic_cast<const GfxGslTextureType*>(pair.second.t)) {\n ss << \" : register(s\" << counter << \")\";\n counter++;\n }\n ss << \";\\n\";\n }\n for (const auto &pair : ctx.matFields) {\n auto it = ctx.ubt.find(pair.first);\n if (auto *tt = dynamic_cast<const GfxGslTextureType*>(pair.second.t)) {\n if (it != ctx.ubt.end()) {\n if (it->second) {\n ss << \"uniform Float4 mat_\" << pair.first;\n } else {\n ss << \"const Float4 mat_\" << pair.first << \" = \" << tt->solid;\n }\n } else {\n ss << \"uniform \" << pair.second.t << \" mat_\" << pair.first;\n if (reg) {\n ss << \" : register(s\" << counter << \")\";\n counter++;\n }\n }\n } else {\n auto it2 = ctx.staticValues.find(pair.first);\n if (it2 != ctx.staticValues.end()) {\n ss << \"const \" << pair.second << \" mat_\" << pair.first << \" = \"\n << unparse_param_value(it2->second);\n } else {\n ss << \"uniform \" << pair.second << \" mat_\" << pair.first;\n }\n }\n ss << \";\\n\";\n }\n for (const auto &pair : ctx.bodyFields) {\n ss << \"uniform \" << pair.second.t << \" body_\" << pair.first;\n if (reg && dynamic_cast<const GfxGslTextureType*>(pair.second.t)) {\n EXCEPTEX << \"Not allowed\" << ENDL;\n ss << \" : register(s\" << counter << \")\";\n counter++;\n }\n ss << \";\\n\";\n }\n\n return ss.str();\n}\n\nstd::string gfx_gasoline_generate_var_decls (const GfxGslTypeMap &vars) \n{\n std::stringstream ss;\n\n if (vars.size() == 0) return \"\";\n\n ss << \"// Variable declarations\\n\";\n\n for (const auto &pair : vars)\n ss << unparse_type(pair.second) << \" \" << pair.first << \";\\n\";\n\n ss << \"\\n\";\n\n return ss.str();\n}\n\nstd::string gfx_gasoline_generate_trans_encode (const std::vector<GfxGslTrans> &trans,\n const std::string &var_pref)\n{\n std::stringstream ss;\n\n if (trans.size() == 0) return \"\";\n\n ss << \" // Encode interpolated vars\\n\";\n\n for (unsigned i=0 ; i<trans.size() ; i+=4) {\n unsigned sz = trans.size()-i > 4 ? 4 : trans.size()-i;\n static const char *fields = \"xyzw\";\n for (unsigned j=0 ; j<sz ; ++j) {\n const auto &tran = trans[i+j];\n std::stringstream expr;\n switch (tran.kind) {\n case GfxGslTrans::VERT:\n expr << \"vert_\" << tran.path[0];\n break;\n case GfxGslTrans::USER:\n expr << var_pref << tran.path[0];\n break;\n case GfxGslTrans::INTERNAL:\n expr << \"internal_\" << tran.path[0];\n break;\n }\n for (unsigned k=1 ; k<tran.path.size() ; ++k)\n expr << \".\" << tran.path[k];\n ss << \" trans\" << i/4;\n if (sz > 1) ss << \".\" << fields[j];\n ss << \" = \" << expr.str() << \";\\n\";\n\n }\n }\n ss << \"\\n\";\n\n return ss.str();\n}\n\n\nstd::string gfx_gasoline_generate_trans_decode(const std::vector<GfxGslTrans> &trans,\n const std::string &pref,\n GfxGslTrans::Kind only)\n{\n std::stringstream ss;\n\n if (trans.size() == 0) return \"\";\n\n ss << \"// Decode interpolated vars\\n\";\n\n for (unsigned i=0 ; i<trans.size() ; i+=4) {\n unsigned sz = trans.size()-i > 4 ? 4 : trans.size()-i;\n static const char *fields = \"xyzw\";\n for (unsigned j=0 ; j<sz ; ++j) {\n const auto &tran = trans[i+j];\n std::stringstream expr;\n std::string prefix = pref;\n for (unsigned k=0 ; k<tran.path.size() ; ++k) {\n expr << prefix << tran.path[k];\n prefix = \".\";\n }\n if (tran.kind == only) {\n ss << \" \" << expr.str() << \" = \";\n ss << \"trans\" << i/4;\n if (sz > 1) ss << \".\" << fields[j];\n ss << \";\\n\";\n }\n }\n }\n\n ss << \"\\n\";\n\n return ss.str();\n}\n\nstd::string gfx_gasoline_preamble_lighting (const GfxGslConfigEnvironment &cfg_env) \n{\n std::stringstream ss;\n\n ss << \"// Lighting functions\\n\";\n\n // Test a single shadow map at a single position (world space).\n ss << \"Float test_shadow(Float3 pos_ws,\\n\";\n ss << \" Float4x4 shadow_view_proj,\\n\";\n ss << \" FloatTexture2 tex,\\n\";\n ss << \" Float spread)\\n\";\n ss << \"{\\n\";\n ss << \" Float sun_dist = dot(pos_ws, global_sunlightDirection)\\n\";\n ss << \" / \" << cfg_env.shadowFactor << \";\\n\";\n ss << \" Float3 pos_ls = mul(shadow_view_proj, Float4(pos_ws, 1)).xyw;\\n\";\n ss << \" pos_ls.xy /= pos_ls.z;\\n\";\n auto filter_taps_side = unsigned(::sqrt(cfg_env.shadowFilterTaps) + 0.5);\n float half_filter_taps_side = filter_taps_side / 2.0;\n ss << \" Int filter_taps_side = \" << filter_taps_side << \";\\n\";\n ss << \" Float half_filter_taps_side = \" << half_filter_taps_side << \";\\n\";\n switch (cfg_env.shadowDitherMode) {\n case GfxGslConfigEnvironment::SHADOW_DITHER_NONE:\n ss << \" Float2 fragment_uv_offset = Float2(0,0);\\n\";\n break;\n case GfxGslConfigEnvironment::SHADOW_DITHER_NOISE:\n ss << \" Float2 noise_uv = frag_screen.xy / 64;\\n\";\n ss << \" Float2 noise_texel = sampleLod(global_shadowPcfNoiseMap, noise_uv, 0).rg;\\n\";\n ss << \" Float2 noise_offset = (2 * noise_texel - 1); // length(offset) <= 1\\n\";\n ss << \" Float2 fragment_uv_offset = 0.8 * noise_offset;\\n\";\n break;\n case GfxGslConfigEnvironment::SHADOW_DITHER_PLAIN:\n ss << \" Float2 dithered_offset;\\n\";\n ss << \" if ((Int(frag_screen.x) % 2) == 1) {\\n\";\n ss << \" if ((Int(frag_screen.y)%2)==1) {\\n\";\n ss << \" dithered_offset = Float2( 1, 0);\\n\";\n ss << \" } else {\\n\";\n ss << \" dithered_offset = Float2(-1, 0);\\n\";\n ss << \" }\\n\";\n ss << \" } else {\\n\";\n ss << \" if ((Int(frag_screen.y) % 2) == 1) {\\n\";\n ss << \" dithered_offset = Float2( 0, 1);\\n\";\n ss << \" } else {\\n\";\n ss << \" dithered_offset = Float2( 0, -1);\\n\";\n ss << \" }\\n\";\n ss << \" }\\n\";\n ss << \" Float2 fragment_uv_offset = 0.6 * dithered_offset;\\n\";\n break;\n }\n ss << \" fragment_uv_offset *= spread / filter_taps_side / \" << cfg_env.shadowRes << \";\\n\";\n ss << \" Float total = 0;\\n\";\n ss << \" for (Int y=0 ; y < filter_taps_side ; y++) {\\n\";\n ss << \" for (Int x=0 ; x < filter_taps_side ; x++) {\\n\";\n ss << \" Float2 tap_uv = Float2(x - half_filter_taps_side + 0.5,\\n\";\n ss << \" y - half_filter_taps_side + 0.5);\\n\";\n ss << \" tap_uv *= spread / \" << cfg_env.shadowRes << \" / half_filter_taps_side;\\n\";\n ss << \" tap_uv += pos_ls.xy + fragment_uv_offset;\\n\";\n ss << \" total += sun_dist > sampleLod(tex, tap_uv, 0).r ? 1.0 : 0.0;\\n\";\n ss << \" }\\n\";\n ss << \" }\\n\";\n ss << \" return total / \" << cfg_env.shadowFilterTaps << \";\\n\";\n ss << \"}\\n\";\n\n ss << \"Float unshadowyness(Float3 pos_ws, Float cam_dist)\\n\";\n ss << \"{\\n\";\n ss << \" Float shadowyness = 0.0;\\n\";\n ss << \" if (cam_dist < \" << cfg_env.shadowDist[0] << \") {\\n\";\n ss << \" shadowyness = test_shadow(pos_ws, global_shadowViewProj0,\\n\";\n ss << \" global_shadowMap0,\\n\";\n ss << \" \" << cfg_env.shadowSpread[0] << \");\\n\";\n ss << \" } else if (cam_dist < \" << cfg_env.shadowDist[1] << \") {\\n\";\n ss << \" shadowyness = test_shadow(pos_ws, global_shadowViewProj1,\\n\";\n ss << \" global_shadowMap1,\\n\";\n ss << \" \" << cfg_env.shadowSpread[1] << \");\\n\";\n ss << \" } else if (cam_dist < \" << cfg_env.shadowDist[2] << \") {\\n\";\n ss << \" shadowyness = test_shadow(pos_ws, global_shadowViewProj2,\\n\";\n ss << \" global_shadowMap2,\\n\";\n ss << \" \" << cfg_env.shadowSpread[2] << \");\\n\";\n ss << \" }\\n\";\n ss << \" Float fade = 1;\\n\";\n ss << \" Float sf_end = \" << cfg_env.shadowFadeEnd << \";\\n\";\n ss << \" Float sf_start = \" << cfg_env.shadowFadeStart << \";\\n\";\n ss << \" if (sf_end != sf_start) {\\n\";\n ss << \" fade = min(1.0, (sf_end - cam_dist) / (sf_end - sf_start));\\n\";\n ss << \" }\\n\";\n ss << \" shadowyness *= fade;\\n\";\n ss << \" return max(0.0, 1 - shadowyness);\\n\";\n ss << \"}\\n\\n\";\n\n // Env cube lighting simulates global illumination (i.e. light from all directions).\n ss << \"Float3 env_lighting(Float3 surf_to_cam,\\n\"\n << \" Float3 sd, Float3 sn, Float sg, Float ss,\\n\";\n ss << \" FloatTextureCube cube, Float map_mipmaps)\\n\";\n ss << \"{\\n\";\n ss << \" Float3 reflect_ws = -reflect(surf_to_cam, sn);\\n\";\n // Use 20 as the max mipmap, as we will never see a texture 2^20 big.\n ss << \" Float3 fresnel_light = \\n\";\n ss << \" gamma_decode(sampleLod(cube, reflect_ws, map_mipmaps - 1).rgb);\\n\";\n ss << \" Float3 diff_light = gamma_decode(sampleLod(cube, sn, map_mipmaps - 1).rgb);\\n\";\n ss << \" Float spec_mm = (1 - sg) * map_mipmaps;\\n\"; // Spec mip map\n ss << \" Float3 spec_light = gamma_decode(sampleLod(cube, reflect_ws, spec_mm).rgb);\\n\";\n ss << \" Float3 diff_component = sd * diff_light;\\n\";\n ss << \" Float3 spec_component = ss * spec_light;\\n\";\n ss << \" Float fresnel_factor = strength(1.0 - dot(sn, surf_to_cam), 5);\\n\";\n ss << \" Float3 fresnel_component = sg * fresnel_factor * fresnel_light;\\n\";\n ss << \" return 16 * (diff_component + spec_component + fresnel_component);\\n\";\n ss << \"}\\n\\n\";\n\n ss << \"Float3 sunlight(Float3 shadow_pos, Float3 s2c, Float3 d, Float3 n, Float g, Float s,\\n\";\n ss << \" Float cam_dist)\\n\";\n ss << \"{\\n\";\n ss << \" Float3 sun = punctual_lighting(-global_sunlightDirection, s2c,\\n\";\n ss << \" d, n, g, s, global_sunlightDiffuse, global_sunlightSpecular);\\n\";\n ss << \" sun *= unshadowyness(shadow_pos, cam_dist);\\n\";\n ss << \" return sun;\\n\";\n ss << \"}\\n\\n\";\n\n ss << \"Float3 envlight(Float3 s2c, Float3 d, Float3 n, Float g, Float s)\\n\";\n ss << \"{\\n\";\n if (cfg_env.envBoxes == 1) {\n ss << \" Float3 env = env_lighting(s2c,\\n\";\n ss << \" d, n, g, s, global_envCube0, global_envCubeMipmaps0);\\n\";\n } else if (cfg_env.envBoxes == 2) {\n ss << \" Float3 env0 = env_lighting(s2c,\\n\";\n ss << \" d, n, g, s, global_envCube0, global_envCubeMipmaps0);\\n\";\n ss << \" Float3 env1 = env_lighting(s2c,\\n\";\n ss << \" d, n, g, s, global_envCube1, global_envCubeMipmaps1);\\n\";\n ss << \" Float3 env = lerp(env0, env1, global_envCubeCrossFade * Float3(1,1,1));\\n\";\n } else {\n ss << \" Float3 env = Float3(0.0, 0.0, 0.0);\\n\";\n }\n ss << \" return env;\\n\";\n ss << \"}\\n\\n\";\n\n ss << \"Float fog_weakness(Float cam_dist)\\n\";\n ss << \"{\\n\";\n ss << \" Float num_particles = global_fogDensity * cam_dist;\\n\";\n ss << \" return clamp(exp(-num_particles * num_particles), 0.0, 1.0);\\n\";\n ss << \"}\\n\";\n\n return ss.str();\n}\n\n\nstd::string gfx_gasoline_preamble_fade (void) \n{\n std::stringstream ss;\n\n ss << \"void fade (void)\\n\";\n ss << \"{\\n\";\n ss << \" int x = (int(frag_screen.x) % 8);\\n\";\n ss << \" int y = (int(frag_screen.y) % 8);\\n\";\n ss << \" Float fade = internal_fade * 16.0; // 16 possibilities\\n\";\n ss << \" Float2 uv = Float2(x,y);\\n\";\n ss << \" // uv points to top left square now\\n\";\n ss << \" uv.x += 8.0 * (int(fade)%4);\\n\";\n ss << \" uv.y += 8.0 * int(fade/4);\\n\";\n ss << \" if (sampleLod(global_fadeDitherMap, uv / 32.0, 0).r < 0.5) discard;\\n\";\n ss << \"}\\n\";\n\n ss << \"\\n\";\n return ss.str();\n}\n\n\nstd::string gfx_gasoline_preamble_transformation (bool first_person,\n const GfxGslMeshEnvironment &mesh_env)\n{\n std::stringstream ss;\n ss << \"// Standard library (vertex shader specific calls)\\n\";\n\n ss << \"Float4 transform_to_world_aux (Float4 v)\\n\";\n ss << \"{\\n\";\n\n if (mesh_env.instanced) {\n ss << \" v = mul(get_inst_matrix(), v);\\n\";\n }\n\n if (mesh_env.boneWeights == 0) {\n ss << \" v = mul(body_world, v);\\n\";\n } else {\n // The bone weights are supposed to sum to 1, we could remove this overconservative divide\n // if we could assert that property at mesh loading time.\n ss << \" Float total = 0;\\n\";\n ss << \" Float4 r = Float4(0, 0, 0, 0);\\n\";\n for (unsigned i=0 ; i < mesh_env.boneWeights ; ++i) {\n ss << \" r += vert_boneWeights[\" << i << \"]\\n\";\n ss << \" * mul(body_boneWorlds[int(vert_boneAssignments[\" << i << \"])], v);\\n\";\n ss << \" total += vert_boneWeights[\" << i << \"];\\n\";\n }\n ss << \" v = r / total;\\n\";\n }\n // If we're in first person mode, the \"world space\" coord is actually a space that is centered\n // at the camera with Y pointing into the distance, Z up and X right. To convert that to true\n // world space we just use the inverse view matrix. However, since the view matrix converts to\n // a coordinate frame where Z points into the distance, we do a conversion fully into that\n // coordinate frame first. Then we apply the inverse view matrix which rewinds that and also\n // takes us all the way back to actual world space.\n if (first_person) {\n ss << \" v = Float4(v.x, v.z, -v.y, v.w);\\n\";\n ss << \" v = mul(global_invView, v);\\n\";\n }\n ss << \" return v;\\n\";\n ss << \"}\\n\";\n\n\n ss << \"Float3 transform_to_world (Float3 v)\\n\";\n ss << \"{\\n\";\n ss << \" return transform_to_world_aux(Float4(v, 1)).xyz;\\n\";\n ss << \"}\\n\";\n\n ss << \"Float3 rotate_to_world (Float3 v)\\n\";\n ss << \"{\\n\";\n ss << \" return transform_to_world_aux(Float4(v, 0)).xyz;\\n\";\n ss << \"}\\n\";\n\n return ss.str();\n}\n" }, { "alpha_fraction": 0.5786933898925781, "alphanum_fraction": 0.5809205770492554, "avg_line_length": 40.43077087402344, "blob_id": "1b2db460b024085b7542a99cb56958c146411663", "content_id": "c5f65801a49edfbe09b6da94708609e59af59039", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2694, "license_type": "permissive", "max_line_length": 130, "num_lines": 65, "path": "/dependencies/quex-0.34.1/quex/core_engine/generator/languages/python.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "from copy import copy\nfrom quex.frs_py.string_handling import blue_print\n\n#________________________________________________________________________________\n# Python\n# \ndef __transition(CurrentStateIdx, StateIdx, \n TargetStateIdx, BackwardLexingF=False, DeadEndStateDB={}):\n # NOTE: This is a very rudimental implementation of the __goto_state, see the cpp implementation\n # for a complete implementation.\n UserDefinedStateMachineName = \"unimportant\"\n if StateIdx == None: \n return __goto_terminal_state(UserDefinedStateMachineName, \n TargetStateIdx) # specific terminal state\n\n txt = \"# QUEX_LABEL_%s_ENTRY_%s;\\n\" % (UserDefinedStateMachineName,\n repr(StateIdx).replace(\"L\",\"\"))\n return txt + \"return %s\" % repr(StateIdx)\n \n \ndef __goto_terminal_state(UserDefinedStateMachineName, SuccessfulOriginalStateMachineID=None):\n if SuccessfulOriginalStateMachineID == None:\n txt = \"# goto QUEX_LABEL_%s_TERMINAL;\\n\" % UserDefinedStateMachineName\n else: \n txt = \"# goto QUEX_LABEL_%s_TERMINAL_%s;\\n\" % (UserDefinedStateMachineName,\n repr(SuccessfulOriginalStateMachineID).replace(\"L\",\"\"))\n return txt + \"return -1\" \n\ndef __note_acceptance(SuccessfulOriginalStateMachineID, LanguageDB, BackwardLexingF=False, BackwardInputPositionDetectionF=False):\n if SuccessfulOriginalStateMachineID != None:\n txt = \"# last_acceptance = %s\\n\" % SuccessfulOriginalStateMachineID\n txt += \"# last_acceptance_input_position = stream.tell()\\n\"\n else:\n txt = \"\" \n return txt\n\ndef __label_definition(LabelName):\n return \"# case \" + LabelName + \":\"\n\ndef __state_drop_out_code(StateMachineName, CurrentStateIdx, BackwardLexingF,\n CurrentStateIsAcceptanceF = None,\n OriginList = None,\n LanguageDB = None,\n DropOutTargetStateID = -1):\n return \"\"\n\ndef __get_if_in_character_set(ValueList):\n assert type(ValueList) == list\n assert len(ValueList) > 0\n\n txt = \"if input in [\"\n for value in ValueList:\n txt += \"%i, \" % value\n txt += \"]:\\n\"\n\n return txt\n\ndef __get_if_in_interval(TriggerSet):\n assert TriggerSet.__class__.__name__ == \"Interval\"\n assert TriggerSet.size() >= 2\n\n if TriggerSet.size() == 2:\n return \"if input == %i or input == %i:\\n\" % (TriggerSet.begin, TriggerSet.end - 1)\n else:\n return \"if input >= %i and input < %i:\\n\" % (TriggerSet.begin, TriggerSet.end)\n\n" }, { "alpha_fraction": 0.5810036063194275, "alphanum_fraction": 0.5835611820220947, "avg_line_length": 45.75876235961914, "blob_id": "3d6c5691e797b9819ffc1a45301b3ffd2f5aa64f", "content_id": "75e3db75c96cb5db2b1aaf508e1e8f85a9958a5b", "detected_licenses": [ "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer", "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 22678, "license_type": "permissive", "max_line_length": 120, "num_lines": 485, "path": "/dependencies/quex-0.34.1/quex/core_engine/generator/languages/cpp.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "from copy import copy\nfrom quex.frs_py.file_in import is_identifier_start, is_identifier_continue\nfrom quex.frs_py.string_handling import blue_print\n\nimport quex.core_engine.state_machine.index as index\n#\n\ndef __nice(SM_ID): \n return repr(SM_ID).replace(\"L\", \"\")\n\n#________________________________________________________________________________\n# C++\n#\n\n__header_definitions_txt = \"\"\"\n#include <quex/code_base/template/Analyser>\n#include <quex/code_base/buffer/Buffer>\n\n#ifdef CONTINUE\n# undef CONTINUE\n#endif\n#define CONTINUE $$GOTO_START_PREPARATION$$\n\"\"\"\n\ndef __header_definitions(LanguageDB):\n\n txt = __header_definitions_txt\n txt = txt.replace(\"$$GOTO_START_PREPARATION$$\", LanguageDB[\"$goto\"](\"$re-start\"))\n return txt\n\ndef __local_variable_definitions(VariableInfoList):\n txt = \"\"\n L = max(map(lambda info: len(info[0]), VariableInfoList))\n for info in VariableInfoList:\n if len(info) > 3: \n if info[3] != 0:\n type = info[0]\n name = info[1] + \"[%s]\" % repr(info[3])\n value = \"/* uninitialized */\"\n else:\n type = info[0] + \"*\"\n name = info[1] \n value = \"= 0x0\"\n else:\n type = info[0]\n name = info[1] \n value = \"= \" + info[2]\n txt += \" %s%s %s %s;\\n\" % (type, \" \" * (L-len(type)), name, value)\n return txt\n \n__function_signature = \"\"\"\n__QUEX_SETTING_ANALYSER_FUNCTION_RETURN_TYPE \n$$QUEX_ANALYZER_STRUCT_NAME$$_$$STATE_MACHINE_NAME$$_analyser_function(QuexAnalyser* me) \n{\n /* NOTE: Different modes correspond to different analyser functions. The analyser*/\n /* functions are all located inside the main class as static functions. That*/\n /* means, they are something like 'globals'. They receive a pointer to the */\n /* lexical analyser, since static member do not have access to the 'this' pointer.*/\n# if defined (__QUEX_SETTING_PLAIN_C)\n# define self (*me)\n# else\n using namespace quex;\n QUEX_LEXER_CLASS& self = *((QUEX_LEXER_CLASS*)me);\n# endif\n\"\"\"\n\ncomment_on_post_context_position_init_str = \"\"\"\n /* Post context positions do not have to be reset or initialized. If a state\n * is reached which is associated with 'end of post context' it is clear what\n * post context is meant. This results from the ways the state machine is \n * constructed. A post context positions live time looks like the following:\n *\n * (1) unitialized (don't care)\n * (1.b) on buffer reload it may, or may not be adapted (don't care)\n * (2) when a post context begin state is passed, the it is **SET** (now: take care)\n * (2.b) on buffer reload it **is adapted**.\n * (3) when a terminal state of the post context is reached (which can only be reached\n * for that particular post context, then the post context position is used\n * to reset the input position. */\n\"\"\"\n\n\ndef __analyser_function(StateMachineName, EngineClassName, StandAloneEngineF,\n function_body, PostConditionedStateMachineID_List, PreConditionIDList,\n ModeNameList=[], InitialStateIndex=-1, LanguageDB=None): \n \"\"\"EngineClassName = name of the structure that contains the engine state.\n if a mode of a complete quex environment is created, this\n is the mode name. otherwise, any name can be chosen. \n StandAloneEngineF = False if a mode for a quex engine is to be created. True\n if a stand-alone lexical engine is required (without the\n complete mode-handling framework of quex).\n \n NOTE: If a stand-alone lexer is requested, then there are two functions that are\n created additionally: \n\n 'EngineClassName'_init(EngineClassName* me,\n QUEX_CHARACTER_TYPE StartInputPosition);\n\n This function has to be called before starting the lexing process.\n See the unit tests for examples.\n \n 'EngineClassName'_do(EngineClassName* me);\n \n This function does a lexical analysis from the current position as\n it is stored in 'me'.\n \"\"\" \n txt = \"\"\n\n local_variable_list = []\n signature = __function_signature\n\n if not StandAloneEngineF: \n L = max(map(lambda name: len(name), ModeNameList))\n for name in ModeNameList:\n local_variable_list.append([\"quex::QuexMode&\", name + \" \" * (L- len(name)), \n \"QUEX_LEXER_CLASS::\" + name]) \n\n txt = \"#include <quex/code_base/temporary_macros_on>\\n\"\n txt += signature\n txt = txt.replace(\"$$STATE_MACHINE_NAME$$\", StateMachineName) \n\n txt += \" \" + LanguageDB[\"$comment\"](\"me = pointer to state of the lexical analyser\") + \"\\n\"\n\n PostContextN = len(PostConditionedStateMachineID_List)\n local_variable_list.extend(\n [ [\"QUEX_GOTO_LABEL_TYPE\", \"last_acceptance\", \"QUEX_GOTO_TERMINAL_LABEL_INIT_VALUE\"],\n [\"QUEX_CHARACTER_POSITION_TYPE\", \"last_acceptance_input_position\", \"(QUEX_CHARACTER_TYPE*)(0x00)\"],\n [\"QUEX_CHARACTER_POSITION_TYPE\", \"post_context_start_position\", \"(QUEX_CHARACTER_TYPE*)(0x00)\", \n PostContextN],\n [\"const size_t\", \"PostContextStartPositionN\", \"(size_t)\" + repr(PostContextN)],\n [\"QUEX_CHARACTER_TYPE\", \"input\", \"(QUEX_CHARACTER_TYPE)(0x00)\"]\n ])\n \n # -- pre-condition fulfillment flags \n for pre_context_sm_id in PreConditionIDList:\n local_variable_list.append([\"int\", \"pre_context_%s_fulfilled_f\" % __nice(pre_context_sm_id), \"0\"])\n\n txt += __local_variable_definitions(local_variable_list)\n txt += comment_on_post_context_position_init_str\n txt += \"#if defined(QUEX_OPTION_AUTOMATIC_ANALYSIS_CONTINUATION_ON_MODE_CHANGE) \\\\\\n\"\n txt += \" || defined(QUEX_OPTION_ASSERTS)\\n\"\n txt += \" me->DEBUG_analyser_function_at_entry = me->current_analyser_function;\\n\"\n txt += \"#endif\\n\"\n\n txt += LanguageDB[\"$label-def\"](\"$start\")\n\n # -- entry to the actual function body\n txt += \" \" + LanguageDB[\"$mark-lexeme-start\"] + \"\\n\"\n txt += \" QuexBuffer_undo_terminating_zero_for_lexeme(&me->buffer);\\n\";\n \n txt += function_body\n\n # -- prevent the warning 'unused variable'\n txt += \"\\n\"\n txt += \" /* prevent compiler warning 'unused variable': use variables once in a part of the code*/\\n\"\n txt += \" /* that is never reached (and deleted by the compiler anyway).*/\\n\"\n txt += \" if( 0 == 1 ) {\\n\"\n txt += \" int unused = 0;\\n\"\n for mode_name in ModeNameList:\n txt += \" unused = unused + %s.id;\\n\" % mode_name\n ## This was once we did not know ... if there was a goto to the initial state or not.\n ## txt += \" goto %s;\\n\" % label.get(StateMachineName, InitialStateIndex)\n\n txt += \" }\\n\"\n\n txt += \"}\\n\"\n\n # -- the name of the game\n txt = txt.replace(\"$$QUEX_ANALYZER_STRUCT_NAME$$\", EngineClassName)\n\n txt += \"#include <quex/code_base/temporary_macros_off>\\n\"\n return txt\n\n__terminal_state_str = \"\"\"\n /* (*) Terminal states _______________________________________________________*/\n /**/\n /* Acceptance terminal states, i.e. the 'winner patterns'. This means*/\n /* that the last input dropped out of a state where the longest matching*/\n /* pattern was according to the terminal state. The terminal states are */\n /* numbered after the pattern id.*/\n /**/\n#define Lexeme (me->buffer._lexeme_start_p)\n#define LexemeBegin (me->buffer._lexeme_start_p)\n#define LexemeEnd (me->buffer._input_p)\n#define LexemeL (size_t)(me->buffer._input_p - me->buffer._lexeme_start_p)\n$$SPECIFIC_TERMINAL_STATES$$\n\n$$TERMINAL_END_OF_STREAM-DEF$$\n$$END_OF_STREAM_ACTION$$\n#ifdef __QUEX_OPTION_ANALYSER_RETURN_TYPE_IS_VOID\n return /*__QUEX_TOKEN_ID_TERMINATION*/;\n#else\n return __QUEX_TOKEN_ID_TERMINATION;\n#endif\n\n$$TERMINAL_DEFAULT-DEF$$\n$$DEFAULT_ACTION$$\n $$GOTO_START_PREPARATION$$\n\n#undef Lexeme\n#undef LexemeBegin\n#undef LexemeEnd\n#undef LexemeL\n#ifndef __QUEX_OPTION_USE_COMPUTED_GOTOS\n__TERMINAL_ROUTER: {\n /* if last_acceptance => goto correspondent acceptance terminal state*/\n /* else => execute defaul action*/\n switch( last_acceptance ) {\n$$JUMPS_TO_ACCEPTANCE_STATE$$\n default: $$TERMINAL_DEFAULT-GOTO$$; /* nothing matched */\n }\n }\n#endif /* __QUEX_OPTION_USE_COMPUTED_GOTOS */\n\"\"\"\n\n__on_continue_reentry_preparation_str = \"\"\"\n \n$$REENTRY_PREPARATION$$\n /* (*) Common point for **restarting** lexical analysis.\n * at each time when CONTINUE is called at the end of a pattern. */\n last_acceptance = QUEX_GOTO_TERMINAL_LABEL_INIT_VALUE;\n$$DELETE_PRE_CONDITION_FULLFILLED_FLAGS$$\n$$COMMENT_ON_POST_CONTEXT_INITIALIZATION$$\n /* If a mode change happened, then the function must first return and\n * indicate that another mode function is to be called. At this point, \n * we to force a 'return' on a mode change. \n *\n * Pseudo Code: if( previous_mode != current_mode ) {\n * return 0;\n * }\n *\n * When the analyzer returns, the caller function has to watch if a mode change\n * occured. If not it can call this function again. */\n#if defined(QUEX_OPTION_AUTOMATIC_ANALYSIS_CONTINUATION_ON_MODE_CHANGE) \\\n || defined(QUEX_OPTION_ASSERTS)\n if( me->DEBUG_analyser_function_at_entry != me->current_analyser_function ) \n#endif\n { \n#if defined(QUEX_OPTION_AUTOMATIC_ANALYSIS_CONTINUATION_ON_MODE_CHANGE)\n# ifdef __QUEX_OPTION_ANALYSER_RETURN_TYPE_IS_VOID\n return /*__QUEX_TOKEN_ID_UNINITIALIZED*/;\n# else\n return __QUEX_TOKEN_ID_UNINITIALIZED;\n# endif\n#elif defined(QUEX_OPTION_ASSERTS)\n QUEX_ERROR_EXIT(\"Mode change without immediate return from the lexical analyser.\");\n#endif\n }\n\n $$GOTO_START$$\n\"\"\"\n\ndef __adorn_action_code(action_info, SMD, SupportBeginOfLineF, IndentationOffset=4): \n indentation = \" \" * IndentationOffset \n txt = \"\"\n # TODO: There could be a differenciation between a pattern that contains\n # newline at the end, and those that do not. Then, there need not\n # be a conditional question.\n if SupportBeginOfLineF:\n txt += indentation + \"QuexBuffer_store_last_character_of_lexeme_for_next_run(&me->buffer);\\n\"\n\n if action_info.action().require_terminating_zero_f():\n txt += indentation + \"QuexBuffer_set_terminating_zero_for_lexeme(&me->buffer);\\n\"\n\n code_str = action_info.action().get_code()\n\n txt += indentation + \"{\\n\"\n txt += indentation + \" \" + code_str.replace(\"\\n\", \"\\n \") + \"\\n\" \n txt += indentation + \"}\\n\"\n\n return txt\n\ndef get_terminal_code(state_machine_id, SMD, pattern_action_info, SupportBeginOfLineF, LanguageDB):\n state_machine = SMD.sm()\n DirectlyReachedTerminalID_List = SMD.directly_reached_terminal_id_list()\n\n txt = \"\"\n state_machine_id_str = __nice(state_machine_id)\n state_machine = pattern_action_info.pattern_state_machine()\n #\n action_code = __adorn_action_code(pattern_action_info, SMD, SupportBeginOfLineF)\n \n # (*) The 'normal' terminal state can also be reached by the terminal\n # router and, thus, **must** restore the acceptance input position. This is so, \n # because when the 'goto last_acceptance' is triggered the 'last_acceptance'\n # may lay backwards and needs to be restored.\n txt += LanguageDB[\"$label-def\"](\"$terminal\", state_machine_id) + \"\\n\"\n\n # (1) Retrieving the input position for the next run\n # NOTE: The different scenarios differ in the way they can 'offer' an entry\n # to the terminal without restoring the input position. This 'direct'\n # entry is useful for direct transitions to a terminal where there\n # acceptance position is clear.\n if state_machine.core().post_context_backward_input_position_detector_sm() != None:\n # Pseudo Ambiguous Post Contexts:\n # -- require that the end of the core pattern is to be searched! One \n # cannot simply restore some stored input position.\n # -- The pseudo-ambiguous post condition is translated into a 'normal'\n # pattern. However, after a match a backward detection of the end\n # of the core pattern is done. Here, we first need to go to the point\n # where the 'normal' pattern ended, then we can do a backward detection.\n txt += \" \" + LanguageDB[\"$input/seek_position\"](\"last_acceptance_input_position\") + \"\\n\"\n txt += LanguageDB[\"$label-def\"](\"$terminal-direct\", state_machine_id) + \"\\n\"\n txt += \" PAPC_input_postion_backward_detector_%s(me);\\n\" % \\\n __nice(state_machine.core().post_context_backward_input_position_detector_sm_id())\n\n elif state_machine.core().post_context_id() != -1L: \n post_condition_index = SMD.get_post_context_index(state_machine_id)\n # Post Contexted Patterns:\n txt += LanguageDB[\"$label-def\"](\"$terminal-direct\", state_machine_id) + \"\\n\"\n # -- have a dedicated register from where they store the end of the core pattern.\n variable = \"post_context_start_position[%s]\" % __nice(post_condition_index) \n txt += \" \" + LanguageDB[\"$comment\"](\"post context index '%s' == state machine '%s'\" % \\\n (__nice(post_condition_index), __nice(state_machine_id))) + \"\\n\"\n txt += \" \" + LanguageDB[\"$input/seek_position\"](variable) + \"\\n\"\n\n else:\n # Normal Acceptance:\n # -- only restore the input position\n txt += \" \" + LanguageDB[\"$input/seek_position\"](\"last_acceptance_input_position\") + \"\\n\"\n txt += LanguageDB[\"$label-def\"](\"$terminal-direct\", state_machine_id) + \"\\n\"\n\n\n\n # -- paste the action code that correponds to the pattern \n txt += action_code + \"\\n\" \n txt += \" \" + LanguageDB[\"$goto\"](\"$re-start\") + \"\\n\" \n txt += \"\\n\"\n\n return txt\n\ndef __terminal_states(SMD, action_db, DefaultAction, EndOfStreamAction, \n SupportBeginOfLineF, PreConditionIDList, LanguageDB):\n \"\"\"NOTE: During backward-lexing, for a pre-condition, there is not need for terminal\n states, since only the flag 'pre-condition fulfilled is raised.\n \"\"\" \n assert SMD.__class__.__name__ == \"StateMachineDecorator\"\n sm = SMD.sm()\n PostConditionedStateMachineID_List = SMD.post_contexted_sm_id_list()\n DirectlyReachedTerminalID_List = SMD.directly_reached_terminal_id_list()\n\n # (*) specific terminal states of patterns (entered from acceptance states)\n txt = \"\"\n for state_machine_id, pattern_action_info in action_db.items():\n txt += get_terminal_code(state_machine_id, SMD, pattern_action_info, SupportBeginOfLineF, LanguageDB)\n specific_terminal_states_str = txt\n\n # (*) general terminal state (entered from non-acceptance state) \n txt = \"\" \n for state_machine_id in action_db.keys():\n txt += \" case %s: \" % repr(state_machine_id).replace(\"L\", \"\")\n txt += LanguageDB[\"$goto\"](\"$terminal\", state_machine_id) + \"\\n\"\n jumps_to_acceptance_states_str = txt\n\n # (*) preparation of the reentry without return:\n # delete all pre-condition fullfilled flags\n txt = \"\"\n for pre_context_sm_id in PreConditionIDList:\n txt += \" \" + LanguageDB[\"$assignment\"](\"pre_context_%s_fulfilled_f\" % __nice(pre_context_sm_id), 0)\n delete_pre_context_flags_str = txt\n\n # -- execute default pattern action \n # -- goto initial state \n end_of_stream_code_action_str = __adorn_action_code(EndOfStreamAction, SMD, SupportBeginOfLineF,\n IndentationOffset=16)\n # -- DEFAULT ACTION: Under 'normal' circumstances the default action is simply to be executed\n # since the 'get_forward()' incremented the 'current' pointer.\n # HOWEVER, when end of file has been reached the 'current' pointer has to\n # be reset so that the initial state can drop out on the buffer limit code\n # and then transit to the end of file action.\n # NOTE: It is possible that 'miss' happens after a chain of characters appeared. In any case the input\n # pointer must be setup right after the lexeme start. This way, the lexer becomes a new chance as\n # soon as possible.\n default_action_str = \"me->buffer._input_p = me->buffer._lexeme_start_p;\\n\"\n default_action_str += LanguageDB[\"$if EOF\"] + \"\\n\"\n default_action_str += \" \" + LanguageDB[\"$comment\"](\"Next increment will stop on EOF character.\") + \"\\n\"\n default_action_str += LanguageDB[\"$endif\"] + \"\\n\"\n default_action_str += LanguageDB[\"$else\"] + \"\\n\"\n default_action_str += \" \" + LanguageDB[\"$comment\"](\"Step over nomatching character\") + \"\\n\"\n default_action_str += \" \" + LanguageDB[\"$input/increment\"] + \"\\n\"\n default_action_str += LanguageDB[\"$endif\"] + \"\\n\"\n default_action_str += __adorn_action_code(DefaultAction, SMD, SupportBeginOfLineF,\n IndentationOffset=16)\n\n # -- routing to states via switch statement\n # (note, the gcc computed goto is implement, too)\n txt = \"\"\n for state_index, state in sm.states.items():\n if state.transitions().is_empty(): continue\n txt += \" \"\n txt += \"case %i: \" % int(state_index) + LanguageDB[\"$goto\"](\"$input\", state_index) + \"\\n\"\n\n if sm.core().pre_context_sm() != None:\n for state_index, state in sm.core().pre_context_sm().states.items():\n if state.transitions().is_empty(): continue\n txt += \" \"\n txt += \"case %i: \" % int(state_index) + LanguageDB[\"$goto\"](\"$input\", state_index) + \"\\n\"\n\n switch_cases_drop_out_back_router_str = txt\n\n if PreConditionIDList == []: precondition_involved_f = \"0\"\n else: precondition_involved_f = \"1\"\n\n txt = blue_print(__terminal_state_str, \n [[\"$$JUMPS_TO_ACCEPTANCE_STATE$$\", jumps_to_acceptance_states_str], \n [\"$$SPECIFIC_TERMINAL_STATES$$\", specific_terminal_states_str],\n [\"$$DEFAULT_ACTION$$\", default_action_str],\n [\"$$END_OF_STREAM_ACTION$$\", end_of_stream_code_action_str],\n [\"$$TERMINAL_END_OF_STREAM-DEF$$\", LanguageDB[\"$label-def\"](\"$terminal-EOF\")],\n [\"$$TERMINAL_DEFAULT-DEF$$\", LanguageDB[\"$label-def\"](\"$terminal-DEFAULT\")],\n [\"$$TERMINAL_GENERAL-DEF$$\", LanguageDB[\"$label-def\"](\"$terminal-general\", False)],\n [\"$$TERMINAL_DEFAULT-GOTO$$\", LanguageDB[\"$goto\"](\"$terminal-DEFAULT\")],\n [\"$$STATE_MACHINE_NAME$$\", SMD.name()],\n [\"$$GOTO_START_PREPARATION$$\", LanguageDB[\"$goto\"](\"$re-start\")],\n ])\n\n txt += blue_print(__on_continue_reentry_preparation_str,\n [[\"$$REENTRY_PREPARATION$$\", LanguageDB[\"$label-def\"](\"$re-start\")],\n [\"$$DELETE_PRE_CONDITION_FULLFILLED_FLAGS$$\", delete_pre_context_flags_str],\n [\"$$GOTO_START$$\", LanguageDB[\"$goto\"](\"$start\")],\n [\"$$COMMENT_ON_POST_CONTEXT_INITIALIZATION$$\", comment_on_post_context_position_init_str],\n ])\n\n return txt\n \n\ndef __frame_of_all(Code, HeaderFile, LexerClassName):\n return \"#include \\\"%s\\\"\\n\" % HeaderFile + \\\n \"#if ! defined(__QUEX_SETTING_PLAIN_C)\\n\" + \\\n \"namespace quex {\\n\" + \\\n \"#endif\\n\" + \\\n \"#define QUEX_LEXER_CLASS %s\\n\" % LexerClassName + \\\n Code + \\\n \"#if ! defined(__QUEX_SETTING_PLAIN_C)\\n\" + \\\n \"} // namespace quex\\n\" + \\\n \"#endif\\n\" \n\ndef __get_if_in_character_set(ValueList):\n assert type(ValueList) == list\n assert len(ValueList) > 0\n txt = \"if( \"\n for value in ValueList:\n txt += \"input == %i || \" % value\n\n txt = txt[:-3] + \") {\\n\"\n return txt\n\ndef __get_if_in_interval(TriggerSet):\n assert TriggerSet.__class__.__name__ == \"Interval\"\n assert TriggerSet.size() >= 2\n\n if TriggerSet.size() == 2:\n return \"if( input == %i || input == %i ) {\\n\" % (TriggerSet.begin, TriggerSet.end - 1)\n else:\n return \"if( input >= %i && input < %i ) {\\n\" % (TriggerSet.begin, TriggerSet.end)\n\n\ndef __require_terminating_zero_preparation(LanguageDB, CodeStr):\n CommentDelimiterList = LanguageDB[\"$comment-delimiters\"]\n assert type(CommentDelimiterList) == list\n ObjectName = \"Lexeme\"\n\n for delimiter_info in CommentDelimiterList:\n assert type(delimiter_info) == list, \"Argument 'CommentDelimiters' must be of type [[]]\"\n assert len(delimiter_info) == 3, \\\n \"Elements of argument CommentDelimiters must be arrays with three elements:\\n\" + \\\n \"start of comment, end of comment, replacement string for comment.\\n\" + \\\n \"received: \" + repr(delimiter_info)\n\n txt = CodeStr\n L = len(txt)\n LO = len(ObjectName)\n found_i = -1\n while 1 + 1 == 2:\n # TODO: Implement the skip_whitespace() function for more general treatment of Comment\n # delimiters. Quotes for strings '\"\" shall then also be treate like comments.\n found_i = txt.find(ObjectName, found_i + 1)\n\n if found_i == -1: return False\n\n # Note: The variable must be named 'exactly' like the given name. 'xLexeme' or 'Lexemey'\n # shall not trigger a treatment of 'Lexeme'.\n if (found_i == 0 or not is_identifier_start(txt[found_i - 1])) \\\n and (found_i == L - LO or not is_identifier_continue(txt[found_i + LO])): \n return True\n" }, { "alpha_fraction": 0.6079584956169128, "alphanum_fraction": 0.6217992901802063, "avg_line_length": 40.869564056396484, "blob_id": "86860d1a0df4c444c2f24050d93b1f7f9ca12b97", "content_id": "70095c007ebe4359a748ac4d9052caab5b6649c3", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2890, "license_type": "permissive", "max_line_length": 96, "num_lines": 69, "path": "/dependencies/quex-0.34.1/quex/DEFINITIONS.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "#! /usr/bin/env python\n# Quex is free software; you can redistribute it and/or modify it under the\n# terms of the GNU Lesser General Public License as published by the Free\n# Software Foundation; either version 2.1 of the License, or (at your option)\n# any later version.\n# \n# This software is distributed in the hope that it will be useful, but WITHOUT\n# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more\n# details.\n# \n# You should have received a copy of the GNU Lesser General Public License along\n# with this library; if not, write to the Free Software Foundation, Inc., 59\n# Temple Place, Suite 330, Boston, MA 02111-1307 USA\n#\n# (C) 2007 Frank-Rene Schaefer\n#\n################################################################################\n# -*- python -*-\nimport os\nimport sys\n\nQUEX_VERSION = '0.34.1'\n\ntry:\n QUEX_INSTALLATION_DIR = os.environ[\"QUEX_PATH\"]\nexcept:\n print \"error: environment variable 'QUEX_PATH' is not defined.\"\n if os.name == \"posix\":\n print \"error: your system is 'posix'.\"\n print \"error: if you are using bash-shell, append the following line\"\n print \"error: to your '~/.bashrc' file:\"\n print \"error:\"\n print \"error: export QUEX_PATH=directory-where-quex-has-been-installed\"\n\n elif os.name == \"nt\":\n print \"error: Right click on [MyComputer]\"\n print \"error: -> [Properties]\"\n print \"error: -> Tab[Advanced]\"\n print \"error: -> [Environment Variables]\"\n print \"error: and from there it is obvious.\"\n\n else:\n print \"error: for your system '%s' it is not known how to set environment\" % os.name\n print \"error: variables. if you find out, please, send an email to\"\n print \"error: <fschaef@users.sourceforge.net>\"\n sys.exit(-1)\n\nsys.path.insert(0, QUEX_INSTALLATION_DIR)\nQUEX_TEMPLATE_DB_DIR = QUEX_INSTALLATION_DIR + \"/quex/code_base\"\n\ndef check():\n global QUEX_INSTALLATION_DIR\n\n # -- Try to acces the file 'quex-exe.py' in order to verify\n if os.access(QUEX_INSTALLATION_DIR + \"/quex-exe.py\", os.F_OK) == False:\n print \"error: Environment variable 'QUEX_PATH' does not point to\"\n print \"error: a valid installation directory of quex.\"\n print \"error: current setting of 'QUEX_PATH':\"\n print \"error:\", QUEX_INSTALLATION_DIR\n sys.exit(-1)\n\n # -- Check for version 2.4 or higher\n if sys.version_info[0] < 2 or \\\n (sys.version_info[0] == 2 and sys.version_info[1] < 4):\n print \"error: Quex requires Python version 2.4 or higher. Detected version '%i.%i'.\" % \\\n (sys.version_info[0], sys.version_info[1])\n print \"error: Please, visit http://www.python.org and download an appropriate release.\"\n sys.exit(-1)\n\n" }, { "alpha_fraction": 0.6325023174285889, "alphanum_fraction": 0.6602031588554382, "avg_line_length": 33.90322494506836, "blob_id": "f1b74607873277c43f4a29b8e8b162b2cbb3b1c0", "content_id": "c5fd8d39e5f160f219b77b08ca0e2fefb0d2d768", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Shell", "length_bytes": 1083, "license_type": "permissive", "max_line_length": 85, "num_lines": 31, "path": "/dependencies/quex-0.34.1/demo/004/benchmark/run-sunCC.sh", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "stamp=`date +%Yy%mm%dd-%Hh%M`\noutput=\"result-$stamp.dat\"\n#\nexport TOOLPATH=/opt/sunstudio\nexport PATH=/opt/sunstudio/sunstudioceres/bin/:$PATH\nCOMPILER=sunCC\nCOMPILER_V=5.10\nCOMPILER_DIR=/opt/sunstudio/sunstudioceres/bin/\n#\ncd ..\n# NOTE -msse3 --> only for CoreDuo Processors\nmake clean; make OPTIMIZATION='-O5 ' COMPILER=$COMPILER COMPILER_V=$COMPILER_V\ncd benchmark\n../lexer-lc many-tiny-tokens.c > $output\n../lexer-lc single-large-token.c >> $output\n../lexer-lc linux-2.6.22.17-kernel-dir.c >> $output\n\n../lexer many-tiny-tokens.c >> $output\n../lexer single-large-token.c >> $output\n../lexer linux-2.6.22.17-kernel-dir.c >> $output\n\ncd ..\nmake clean; make OPTIMIZATION='-O5 -xspace' COMPILER=$COMPILER COMPILER_V=$COMPILER_V\ncd benchmark\n../lexer-lc many-tiny-tokens.c >> $output\n../lexer-lc single-large-token.c >> $output\n../lexer-lc linux-2.6.22.17-kernel-dir.c >> $output\n\n../lexer many-tiny-tokens.c >> $output\n../lexer single-large-token.c >> $output\n../lexer linux-2.6.22.17-kernel-dir.c >> $output\n\n" }, { "alpha_fraction": 0.6077743768692017, "alphanum_fraction": 0.6457694172859192, "avg_line_length": 36.598899841308594, "blob_id": "c3d950c70e553e1b8316cef8417b9fd1e62a0083", "content_id": "53c9b8c3ae515d6ac4296e8ca48598f336ba2fdc", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 6843, "license_type": "permissive", "max_line_length": 100, "num_lines": 182, "path": "/engine/linux/joystick_devjs.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n// based on https://www.kernel.org/doc/Documentation/input/joystick-api.txt\n//\n// REQUIREMENTS: a physical joystick/gamepad and libsdl2-dev\n//\n// TESTED WITH: Gamepad/Joystick USB Rock Candy for Xbox 360\n//\n// LINUX DRIVER INSTALLATION:\n// ubuntu$ sudo apt-get install libsdl2-dev \n//\n// LINUX TEST: (plug joystick/gamepad)\n// The device shall not generate any events during idle state (ie: when not moving sticks or\n// pressing buttons) otherwise grit engine will be flooded with events and may decrease performance\n// of a game engine.\n// ubuntu$ jstest --normal /dev/input/js0\n//\n// LINUX CALIBRATION: (plug joystick/gamepad)\n// During calibration when asked to press a button or move a stick hold action until specified to\n// release otherwise wrong calibration values will be computed.\n// ubuntu$ jscal /dev/input/js0\n// \n// DISPLAY CALIBRATION: \n// ubuntu$ jscal -p /dev/input/js0\n//\n// CREATE CALIBRATION SCRIPT: \n\n/*\nCreated once after you have done the calibration, execute this script to restore your calibration\nafter reboot if necessary\n# create\necho \"#!/bin/bash\" >joystick_calibrate.sh\njscal -p /dev/input/js0 >>joystick_calibrate.sh\nchmod +x joystick_calibrate.sh\n# restore\n./joystick_calibrate.sh\n*/\n\n/*\nCalibrate reset script for Rock Candy. (Warning! this script erase the current linux joystick\ncalibration to default neutral value. You may need to adapt this script to the number of\nbuttons/axes of your device.)\n#!/bin/bash\njscal -s 8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /dev/input/js0\njscal -p /dev/input/js0\njscal -c /dev/input/js0\n*/\n\n/*\nIn the event that jscal did not compute the correct values, here is manually calibrated values for\nRock Candy. (Warning! this command overwrite the current linux joystick calibration and reduce\nprecision/range of your device. Reuse calibaration procedure or reset procedure to recover full\nprecision/range of your device. You may need to adapt this command to the number of buttons/axes of\nyour device.)\njscal -s 8,1,8000,-4000,4000,18663,18663,1,8000,-4000,4000,18663,18663,0,0,1,8000,-4000,4000,\\\n18663,18663,1,8000,-4000,4000,18663,18663,0,0,0,0,0,0 /dev/input/js0\nDetails:\n8 number of axes\n# First axis:\n1 1 = correction and 4 coefficients, otherwise 0 no correction and no 4 coefficients after\n8000 precision range, -4000..4000 = 8000\n-4000 minimum value for center, ignore 0..-4000 \n4000 maximum value for center, ignore 0..4000\n18663 round((32767 / (abs(-32767) - abs(-4000))) * 16384)\n = (normal_range / reduced_range) * 16384 = 18662.15 >> 18663\n18663 round((32767 / (abs(32767) - abs(4000))) * 16384)\n# Second axis:\n...\n*/\n\n\n#include <stdio.h>\n#include <sys/types.h>\n#include <sys/stat.h>\n#include <fcntl.h>\n#include <unistd.h>\n#include <stdlib.h>\n#include <string.h>\n#include <errno.h>\n\n#include <sstream>\n\n#include <centralised_log.h>\n\n#include \"joystick_devjs.h\"\n\nJoystickDevjs::JoystickDevjs(size_t window)\n{\n win = window;\n\n // If this fails, fd will be < 0 and JoystickDevjs will be a stub.\n fd = open (\"/dev/input/js0\", O_RDONLY | O_NONBLOCK);\n}\n\nJoystickDevjs::~JoystickDevjs()\n{\n if (fd >= 0) {\n close(fd);\n fd = -1;\n }\n}\n\nbool JoystickDevjs::getEvents(std::vector<signed char> *buttons_indexes_and_values,\n std::vector<signed char> *axes_indexes,\n std::vector<short int> *axes_values) \n{\n struct JoystickDevjsEvent event;\n if (buttons_indexes_and_values) buttons_indexes_and_values->clear();\n if (axes_indexes) axes_indexes->clear();\n if (axes_values) axes_values->clear();\n\n if (fd < 0) return false; // joystick connection state is: detached\n int n;\n\n while (true) {\n n = read(fd, &event, sizeof(struct JoystickDevjsEvent));\n if (n != sizeof(struct JoystickDevjsEvent)) break;\n\n // event.type &= ~ JOYSTICK_DEVJS_EVENT_TYPE_INIT; /* discard init events */\n\n switch (event.type) {\n case JOYSTICK_DEVJS_EVENT_TYPE_BUTTON: {\n signed char pushed_button_index_and_value;\n signed char button_index = event.index+1;\n \n if ( button_index <= JOYSTICK_MAX_NUM_BUTTONS ) {\n if ( buttons_indexes_and_values ) {\n signed char mod=-1;\n if( event.value ) mod=1;\n pushed_button_index_and_value = button_index;\n pushed_button_index_and_value = pushed_button_index_and_value * mod;\n buttons_indexes_and_values->push_back(pushed_button_index_and_value);\n // printf(\"B%02d:%02d:%02d\\n\",\n // button_index, event.value, pushed_button_index_and_value);\n }\n }\n }\n break;\n\n case JOYSTICK_DEVJS_EVENT_TYPE_AXE: {\n signed char pushed_axe_index = event.index + 1;\n short int pushed_axe_value = event.value;\n\n if (pushed_axe_index <= JOYSTICK_MAX_NUM_AXES) {\n if (axes_indexes && axes_values) {\n axes_indexes->push_back(pushed_axe_index);\n axes_values->push_back(pushed_axe_value);\n // printf(\"J%02d:%06d:%d\\n\",\n // pushed_axe_index, event.value, pushed_axe_value);\n }\n }\n }\n break;\n }\n }\n\n if( n==sizeof(struct JoystickDevjsEvent) || (n == -1 && errno==EAGAIN) ) {\n return true; // joystick connection state is: attached \n }\n else {\n return false; // joystick connection state is: detached \n }\n}\n" }, { "alpha_fraction": 0.5753166675567627, "alphanum_fraction": 0.5791395902633667, "avg_line_length": 27.40518569946289, "blob_id": "7186a1169b3d6951367808bef515f17033fb0005", "content_id": "0450ccb839e80cdbaece151aaf4606bb64d6dac4", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 17526, "license_type": "permissive", "max_line_length": 97, "num_lines": 617, "path": "/engine/input_filter.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include \"lua_util.h\"\n#include \"lua_ptr.h\"\n#include \"input_filter.h\"\n#include \"gfx/hud.h\"\n\ntypedef InputFilter::BindingSet BindingSet;\ntypedef std::map<double, InputFilter *> IFMap;\nstatic IFMap ifmap;\n\nstatic std::set<std::string> pressed;\nbool input_filter_pressed (const std::string &button)\n{\n return pressed.find(button) != pressed.end();\n}\n\n\nstatic Vector2 last_mouse_pos(0, 0);\nstatic Vector2 prior_grab_mouse_pos(0, 0);\nstatic bool is_captured = false;\nstatic bool cursor_hidden = false;\n\n// Based on the state of the input filters, grab or ungrab the mouse.\nstatic void update_grabbed (void)\n{\n bool should_be_captured = false;\n for (IFMap::iterator i=ifmap.begin(), i_=ifmap.end() ; i != i_ ; ++i) {\n InputFilter *f = i->second;\n if (!f->getEnabled()) continue;\n if (f->getMouseCapture()) should_be_captured = true;\n if (f->getModal()) break;\n }\n if (!keyboard->hasFocus()) should_be_captured = false;\n bool should_hide = should_be_captured || cursor_hidden;\n if (is_captured == should_be_captured) {\n mouse->setHide(should_hide);\n return;\n }\n is_captured = should_be_captured;\n if (should_be_captured) {\n prior_grab_mouse_pos = last_mouse_pos;\n mouse->setHide(should_hide);\n mouse->setGrab(true);\n } else {\n mouse->setPos(prior_grab_mouse_pos.x, prior_grab_mouse_pos.y);\n last_mouse_pos = prior_grab_mouse_pos;\n mouse->setGrab(false);\n mouse->setHide(should_hide);\n }\n}\n\nbool input_filter_has (double order)\n{\n IFMap::iterator i = ifmap.find(order);\n return i != ifmap.end();\n}\n\nstd::string input_filter_get_description (double order)\n{\n IFMap::iterator i = ifmap.find(order);\n if (i == ifmap.end()) EXCEPT << \"No InputFilter at order \" << order << ENDL;\n return i->second->description;\n}\n\nnamespace {\n struct Combo {\n bool ctrl, alt, shift;\n std::string prefix;\n Combo (void) { }\n Combo (bool ctrl, bool alt, bool shift, const std::string &prefix)\n : ctrl(ctrl), alt(alt), shift(shift), prefix(prefix) { }\n };\n\n Combo combos[8] = {\n Combo(true, true, true, \"C+A+S+\"),\n Combo(true, true, false, \"C+A+\"),\n Combo(true, false, true, \"C+S+\"),\n Combo(false, true, true, \"A+S+\"),\n Combo(true, false, false, \"C+\"),\n Combo(false, true, false, \"A+\"),\n Combo(false, false, true, \"S+\"),\n Combo(false, false, false, \"\"),\n };\n const Combo &empty_combo = combos[7];\n}\n\nstatic const Combo &prefix_to_combo (const std::string &prefix)\n{\n for (unsigned i=0 ; i<8 ; ++i) {\n const Combo &c = combos[i];\n if (c.prefix == prefix) return c;\n }\n EXCEPT << \"Unrecognised key combo: \" << prefix << ENDL;\n}\n\nbool InputFilter::isBound (const std::string &ev)\n{\n return buttonCallbacks.find(ev) != buttonCallbacks.end();\n}\n\nstd::vector<std::string> InputFilter::allBinds (void)\n{\n std::vector<std::string> r;\n for (const auto &pair : buttonCallbacks) {\n r.push_back(pair.first);\n }\n return r;\n}\n\nbool InputFilter::acceptButton (lua_State *L, const std::string &ev)\n{\n ensureAlive();\n char kind = ev[0];\n std::string button = &ev[1];\n\n if (kind == '+') {\n\n std::vector<Combo> found;\n for (unsigned i=0 ; i<8 ; ++i) {\n const Combo &c = combos[i];\n // ignore prefixes that do not apply given current modifier status\n if (c.ctrl && !input_filter_pressed(\"Ctrl\")) continue;\n if (c.alt && !input_filter_pressed(\"Alt\")) continue;\n if (c.shift && !input_filter_pressed(\"Shift\")) continue;\n if (isBound(c.prefix + button)) found.push_back(c);\n }\n // if no bindings match, fall through\n if (found.size() == 0) return false;\n\n // should not already be down\n APP_ASSERT(!isButtonPressed(button));\n\n const Combo &c = found[0];\n \n down[button] = c.prefix;\n\n std::string bind = c.prefix + button;\n\n const Callback &cb = buttonCallbacks.find(bind)->second;\n \n const LuaPtr &func = cb.down;\n\n if (!func.isNil()) {\n triggerFunc(L, bind, func);\n }\n\n } else if (kind == '-' || kind == '=') {\n\n ButtonStatus::iterator earlier = down.find(button);\n\n // Maybe some lower filter has it bound with fewer modifiers.\n if (earlier == down.end()) return false;\n\n const std::string &prefix = earlier->second;\n\n std::string bind = prefix + button;\n\n // If it's down, there must be a callback for it\n const Callback &cb = buttonCallbacks.find(bind)->second;\n\n if (kind == '-') {\n down.erase(button);\n }\n\n const LuaPtr &func = kind == '-' ? cb.up : cb.repeat;\n if (!func.isNil()) {\n triggerFunc(L, bind, func);\n }\n\n } else if (kind == ':') {\n\n // Potentially let these go to the HUD.\n return false;\n } else {\n CERR << \"Unrecognized kind: \\\"\" << std::string(1, kind) << \"\\\"\" << std::endl;\n }\n\n return true;\n}\n\nvoid InputFilter::triggerFunc (lua_State *L, const std::string &bind, const LuaPtr &func)\n{\n ensureAlive();\n\n APP_ASSERT(!func.isNil());\n\n STACK_BASE;\n //stack is empty\n\n // error handler in case there is a problem during \n // the callback\n push_cfunction(L, my_lua_error_handler);\n int error_handler = lua_gettop(L);\n\n //stack: err\n\n // get the function\n func.push(L);\n //stack: err, callback\n\n STACK_CHECK_N(2);\n\n // call (1 arg), pops function too\n int status = lua_pcall(L, 0, 0, error_handler);\n if (status) {\n STACK_CHECK_N(2);\n //stack: err, error\n // pop the error message since the error handler will\n // have already printed it out\n lua_pop(L, 2);\n STACK_CHECK;\n CERR << \"InputFilter \\\"\" << description << \"\\\" \"\n << \"raised an error on bind \"<<bind<<\".\" << std::endl;\n //stack is empty\n } else {\n //stack: err\n STACK_CHECK_N(1);\n lua_pop(L, 1);\n //stack is empty\n }\n\n //stack is empty\n STACK_CHECK;\n}\n\nvoid InputFilter::triggerMouseMove (lua_State *L, const Vector2 &rel)\n{\n ensureAlive();\n\n STACK_BASE;\n //stack is empty\n\n // error handler in case there is a problem during \n // the callback\n push_cfunction(L, my_lua_error_handler);\n int error_handler = lua_gettop(L);\n\n //stack: err\n\n // get the function\n mouseMoveCallback.push(L);\n //stack: err, callback\n if (lua_isnil(L, -1)) {\n lua_pop(L, 2);\n STACK_CHECK;\n CERR << \"InputFilter \\\"\" << description << \"\\\" \"\n << \"has no mouseMoveCallback function, releasing mouse.\" << std::endl;\n setMouseCapture(L, false);\n return;\n }\n\n\n //stack: err, callback\n STACK_CHECK_N(2);\n\n push_v2(L, rel);\n //stack: err, callback, rel\n\n STACK_CHECK_N(3);\n\n // call (1 arg), pops function too\n int status = lua_pcall(L, 1, 0, error_handler);\n if (status) {\n STACK_CHECK_N(2);\n //stack: err, error\n // pop the error message since the error handler will\n // have already printed it out\n lua_pop(L, 2);\n STACK_CHECK;\n CERR << \"InputFilter \\\"\" << description << \"\\\" \"\n << \"raised an error on mouseMoveCallback, disabling mouse capture.\" << std::endl;\n setMouseCapture(L, false);\n //stack is empty\n } else {\n //stack: err\n STACK_CHECK_N(1);\n lua_pop(L, 1);\n //stack is empty\n }\n\n //stack is empty\n STACK_CHECK;\n}\n\nvoid InputFilter::flushAll (lua_State *L)\n{\n ensureAlive();\n // 'down' modified by acceptButton (and also potentially by callbacks).\n ButtonStatus d = down;\n for (ButtonStatus::iterator i=d.begin(), i_=d.end() ; i != i_ ; ++i) {\n acceptButton(L, \"-\" + i->first);\n }\n APP_ASSERT(down.size() == 0);\n}\n\n/** Is maskee masked by masker? */\nstatic bool masked_by (const Combo &maskee, const Combo &masker)\n{\n // masker needs to have fewer modifiers\n if (masker.ctrl && !maskee.ctrl) return false;\n if (masker.alt && !maskee.alt) return false;\n if (masker.shift && !maskee.shift) return false;\n return true;\n}\n\nstatic std::pair<Combo, std::string> split_bind (const std::string &bind)\n{\n // This code assumes keys do not contain - and are non-empty.\n size_t last = bind.rfind('-');\n if (last == std::string::npos) return std::pair<Combo, std::string>(empty_combo, bind);\n APP_ASSERT(last + 1 < bind.length());\n std::string prefix = bind.substr(0, last + 1);\n std::string button = bind.substr(last + 1);\n return std::pair<Combo, std::string>(prefix_to_combo(prefix), button);\n}\n\nstatic bool masked_by (const std::string &maskee_, const std::string &masker_)\n{\n auto maskee = split_bind(maskee_);\n auto masker = split_bind(masker_);\n\n // Different keys, cannot mask.\n if (maskee.second != masker.second) return false;\n\n // Otherwise examine key combinations.\n return masked_by(maskee.first, masker.first);\n}\n\n/** Is the given bind maskee masked by something in the set masker? */\nstatic bool masked_by (const std::string &maskee, const BindingSet &masker)\n{\n for (BindingSet::iterator i=masker.begin(), i_=masker.end() ; i != i_ ; ++i) {\n if (masked_by(maskee, *i)) return true;\n }\n return false;\n}\n\nvoid InputFilter::flushSet (lua_State *L, const BindingSet &s)\n{\n ensureAlive();\n // 'down' modified by acceptButton (and also potentially by callbacks).\n ButtonStatus d = down;\n for (ButtonStatus::iterator i=d.begin(), i_=d.end() ; i != i_ ; ++i) {\n if (masked_by(i->second, s))\n acceptButton(L, \"-\" + i->first);\n }\n APP_ASSERT(down.size() == 0);\n}\n\nvoid input_filter_trickle_button (lua_State *L, const std::string &ev)\n{\n char kind = ev[0];\n std::string button = &ev[1];\n if (kind == '+') {\n pressed.insert(button);\n } else if (kind == '-') {\n pressed.erase(button);\n }\n\n // copy because callbacks can alter the map while we're iterating over it\n IFMap m = ifmap;\n bool signal_hud = true;\n for (IFMap::const_iterator i=m.begin(), i_=m.end() ; i != i_ ; ++i) {\n InputFilter *f = i->second;\n if (!f->getEnabled()) continue;\n if (f->getMouseCapture()) signal_hud = false;\n if (f->acceptButton(L, ev)) {\n signal_hud = false;\n break;\n }\n if (f->getModal()) break;\n }\n if (signal_hud) hud_signal_button(L, ev);\n}\n\nvoid input_filter_trickle_mouse_move (lua_State *L, const Vector2 &rel, const Vector2 &abs)\n{\n // copy because callbacks can alter the map while we're iterating over it\n last_mouse_pos = abs;\n IFMap m = ifmap;\n for (IFMap::const_iterator i=m.begin(), i_=m.end() ; i != i_ ; ++i) {\n InputFilter *f = i->second;\n if (!f->getEnabled()) continue;\n if (f->getMouseCapture()) {\n f->triggerMouseMove(L, rel);\n return;\n }\n if (f->getModal()) break;\n }\n hud_signal_mouse_move(L, abs);\n}\n\nvoid input_filter_flush (lua_State *L)\n{\n pressed.clear();\n IFMap m = ifmap;\n for (IFMap::const_iterator i=m.begin(), i_=m.end() ; i != i_ ; ++i) {\n InputFilter *f = i->second;\n f->flushAll(L);\n }\n hud_signal_flush(L);\n update_grabbed();\n}\n\nstd::vector<std::pair<double, std::string>> input_filter_list (void)\n{\n std::vector<std::pair<double, std::string>> r;\n for (IFMap::const_iterator i=ifmap.begin(), i_=ifmap.end() ; i != i_ ; ++i) {\n r.emplace_back(i->second->order, i->second->description);\n }\n return r;\n}\n\nvoid input_filter_set_cursor_hidden (bool v)\n{\n cursor_hidden = v;\n update_grabbed();\n}\n\nbool input_filter_get_cursor_hidden (void)\n{\n return cursor_hidden;\n}\n\nvoid input_filter_shutdown (lua_State *L)\n{\n IFMap m = ifmap;\n for (IFMap::const_iterator i=m.begin(), i_=m.end() ; i != i_ ; ++i) {\n InputFilter *f = i->second;\n f->destroy(L);\n }\n APP_ASSERT(ifmap.size() == 0);\n}\n\n\nInputFilter::InputFilter (double order, const std::string &desc)\n\n : modal(false), enabled(true), mouseCapture(false), destroyed(false), order(order),\n description(desc)\n{\n IFMap::iterator i = ifmap.find(order);\n if (i != ifmap.end()) {\n EXCEPT << \"Cannot create InputFilter \\\"\" << desc << \"\\\" at order already occupied by \"\n << \"\\\"\"<<i->second->description<<\"\\\"\" << std::endl;\n }\n ifmap[order] = this;\n}\n \nInputFilter::~InputFilter (void)\n{\n if (!destroyed) {\n CERR << \"InputFilter \\\"\" << description << \"\\\" deleted without being destroyed first.\"\n << std::endl;\n mouseMoveCallback.leak();\n CallbackMap &m = buttonCallbacks;\n for (CallbackMap::iterator i=m.begin(), i_=m.end() ; i != i_ ; ++i) {\n i->second.down.leak();\n i->second.up.leak();\n i->second.repeat.leak();\n }\n buttonCallbacks.clear();\n ifmap.erase(this->order);\n }\n}\n\nvoid InputFilter::destroy (lua_State *L)\n{\n ensureAlive();\n destroyed = true;\n mouseMoveCallback.setNil(L);\n CallbackMap &m = buttonCallbacks;\n for (CallbackMap::iterator i=m.begin(), i_=m.end() ; i != i_ ; ++i) {\n i->second.down.setNil(L);\n i->second.up.setNil(L);\n i->second.repeat.setNil(L);\n }\n buttonCallbacks.clear();\n ifmap.erase(this->order);\n}\n\nvoid InputFilter::bind (lua_State *L, const std::string &button)\n{\n ensureAlive();\n\n Callback &c = buttonCallbacks[button];\n c.down.setNil(L);\n c.up.setNil(L);\n c.repeat.setNil(L);\n APP_ASSERT(lua_gettop(L) >= 3);\n // DOWN\n if (!lua_isnil(L, -3)) {\n if (!lua_isfunction(L, -3)) {\n EXCEPT << \"Expected a function for down binding of \" << button << ENDL;\n }\n c.down.setNoPop(L, -3);\n }\n // UP\n if (!lua_isnil(L, -2)) {\n if (!lua_isfunction(L, -2)) {\n EXCEPT << \"Expected a function for up binding of \" << button << ENDL;\n }\n c.up.setNoPop(L, -2);\n }\n // REPEAT\n if (!lua_isnil(L, -1)) {\n if (lua_isboolean(L, -1)) {\n if (lua_toboolean(L, -1)) {\n if (lua_isnil(L, -3)) {\n c.repeat.setNoPop(L, -3);\n }\n }\n // it's false, treat the same as nil\n } else {\n if (!lua_isfunction(L, -1)) {\n EXCEPT << \"Expected a function or true for repeat binding of \" << button << ENDL;\n }\n c.repeat.setNoPop(L, -1);\n }\n }\n}\n\nvoid InputFilter::unbind (lua_State *L, const std::string &button)\n{\n ensureAlive();\n\n Callback &c = buttonCallbacks[button];\n c.down.setNil(L);\n c.up.setNil(L);\n c.repeat.setNil(L);\n buttonCallbacks.erase(button);\n // just in case the button was down at the time of the unbind call\n down.erase(button);\n}\n\nvoid InputFilter::setMouseMoveCallback (lua_State *L)\n{\n ensureAlive();\n mouseMoveCallback.setNoPop(L);\n}\n\nvoid InputFilter::setEnabled (lua_State *L, bool v)\n{\n ensureAlive();\n if (enabled == v) return;\n enabled = v;\n if (enabled) {\n // If enabling, release all masked buttons below.\n BindingSet masked;\n for (auto i=buttonCallbacks.begin(), i_=buttonCallbacks.end() ; i != i_ ; ++i) {\n masked.insert(i->first);\n }\n IFMap::iterator i = ifmap.find(this->order);\n i++;\n for ( ; i != ifmap.end(); ++i) {\n i->second->flushSet(L, masked);\n }\n } else {\n // If disabling, release all local buttons.\n flushAll(L);\n }\n\n enabled = v;\n update_grabbed();\n}\n\nvoid InputFilter::setModal (lua_State *L, bool v)\n{\n ensureAlive();\n if (modal == v) return;\n modal = v;\n if (modal) {\n IFMap::iterator i = ifmap.find(this->order);\n i++;\n for ( ; i != ifmap.end(); ++i) {\n i->second->flushAll(L);\n }\n }\n update_grabbed();\n}\n\nvoid InputFilter::setMouseCapture (lua_State *L, bool v)\n{\n ensureAlive();\n if (mouseCapture == v) return;\n mouseCapture = v;\n\n if (mouseCapture) {\n hud_signal_flush(L);\n }\n update_grabbed();\n}\n\nbool InputFilter::isButtonPressed (const std::string &b)\n{\n ensureAlive();\n return down.find(b) != down.end();\n}\n" }, { "alpha_fraction": 0.51270592212677, "alphanum_fraction": 0.5312063694000244, "avg_line_length": 29.54157829284668, "blob_id": "37a3a13135c781249e23a332fb4c0bd6bae90d8b", "content_id": "e2de06d5e7b028173be1533447398547c4cfb650", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 14324, "license_type": "permissive", "max_line_length": 127, "num_lines": 469, "path": "/engine/navigation/mesh_loader_obj.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "//\n// Copyright (c) 2009-2010 Mikko Mononen memon@inside.org\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n//\n\n#include \"mesh_loader_obj.h\"\n#include <stdio.h>\n#include <stdlib.h>\n#include <string>\n#define _USE_MATH_DEFINES\n#include <math.h>\n\nrcMeshLoaderObj::rcMeshLoaderObj() :\n m_scale(1.0f),\n m_verts(0),\n m_tris(0),\n m_normals(0),\n m_vertCount(0),\n m_triCount(0)\n{\n}\n\nrcMeshLoaderObj::~rcMeshLoaderObj()\n{\n delete [] m_verts;\n delete [] m_normals;\n delete [] m_tris;\n}\n \nvoid rcMeshLoaderObj::addVertex(float x, float y, float z, int& cap)\n{\n if (m_vertCount+1 > cap)\n {\n cap = !cap ? 8 : cap*2;\n float* nv = new float[cap*3];\n if (m_vertCount)\n memcpy(nv, m_verts, m_vertCount*3*sizeof(float));\n delete [] m_verts;\n m_verts = nv;\n }\n float* dst = &m_verts[m_vertCount*3];\n\n *dst++ = x*m_scale;\n *dst++ = y*m_scale;\n *dst++ = z*m_scale;\n m_vertCount++;\n}\n\nvoid rcMeshLoaderObj::addTriangle(int a, int b, int c, int& cap)\n{\n if (m_triCount+1 > cap)\n {\n cap = !cap ? 8 : cap*2;\n int* nv = new int[cap*3];\n if (m_triCount)\n memcpy(nv, m_tris, m_triCount*3*sizeof(int));\n delete [] m_tris;\n m_tris = nv;\n }\n int* dst = &m_tris[m_triCount*3];\n *dst++ = a;\n *dst++ = b;\n *dst++ = c;\n m_triCount++;\n}\n\nstatic char* parseRow(char* buf, char* bufEnd, char* row, int len)\n{\n bool start = true;\n bool done = false;\n int n = 0;\n while (!done && buf < bufEnd)\n {\n char c = *buf;\n buf++;\n // multirow\n switch (c)\n {\n case '\\\\':\n break;\n case '\\n':\n if (start) break;\n done = true;\n break;\n case '\\r':\n break;\n case '\\t':\n case ' ':\n if (start) break;\n default:\n start = false;\n row[n++] = c;\n if (n >= len-1)\n done = true;\n break;\n }\n }\n row[n] = '\\0';\n return buf;\n}\n\nstatic int parseFace(char* row, int* data, int n, int vcnt)\n{\n int j = 0;\n while (*row != '\\0')\n {\n // Skip initial white space\n while (*row != '\\0' && (*row == ' ' || *row == '\\t'))\n row++;\n char* s = row;\n // Find vertex delimiter and terminated the string there for conversion.\n while (*row != '\\0' && *row != ' ' && *row != '\\t')\n {\n if (*row == '/') *row = '\\0';\n row++;\n }\n if (*s == '\\0')\n continue;\n int vi = atoi(s);\n data[j++] = vi < 0 ? vi+vcnt : vi-1;\n if (j >= n) return j;\n }\n return j;\n}\n\nbool rcMeshLoaderObj::load(const std::string& filename)\n{\n char* buf = 0;\n FILE* fp = fopen(filename.c_str(), \"rb\");\n if (!fp)\n return false;\n if (fseek(fp, 0, SEEK_END) != 0)\n {\n fclose(fp);\n return false;\n }\n long bufSize = ftell(fp);\n if (bufSize < 0)\n {\n fclose(fp);\n return false;\n }\n if (fseek(fp, 0, SEEK_SET) != 0)\n {\n fclose(fp);\n return false;\n }\n buf = new char[bufSize];\n if (!buf)\n {\n fclose(fp);\n return false;\n }\n size_t readLen = fread(buf, bufSize, 1, fp);\n fclose(fp);\n\n if (readLen != 1)\n {\n delete[] buf;\n return false;\n }\n\n char* src = buf;\n char* srcEnd = buf + bufSize;\n char row[512];\n int face[32];\n float x,y,z;\n int nv;\n int vcap = 0;\n int tcap = 0;\n \n while (src < srcEnd)\n {\n // Parse one row\n row[0] = '\\0';\n src = parseRow(src, srcEnd, row, sizeof(row)/sizeof(char));\n // Skip comments\n if (row[0] == '#') continue;\n if (row[0] == 'v' && row[1] != 'n' && row[1] != 't')\n {\n // Vertex pos\n sscanf(row+1, \"%f %f %f\", &x, &y, &z);\n addVertex(x, y, z, vcap);\n }\n if (row[0] == 'f')\n {\n // Faces\n nv = parseFace(row+1, face, 32, m_vertCount);\n for (int i = 2; i < nv; ++i)\n {\n const int a = face[0];\n const int b = face[i-1];\n const int c = face[i];\n if (a < 0 || a >= m_vertCount || b < 0 || b >= m_vertCount || c < 0 || c >= m_vertCount)\n continue;\n addTriangle(a, b, c, tcap);\n }\n }\n }\n\n delete [] buf;\n\n // Calculate normals.\n m_normals = new float[m_triCount*3];\n for (int i = 0; i < m_triCount*3; i += 3)\n {\n const float* v0 = &m_verts[m_tris[i]*3];\n const float* v1 = &m_verts[m_tris[i+1]*3];\n const float* v2 = &m_verts[m_tris[i+2]*3];\n float e0[3], e1[3];\n for (int j = 0; j < 3; ++j)\n {\n e0[j] = v1[j] - v0[j];\n e1[j] = v2[j] - v0[j];\n }\n float* n = &m_normals[i];\n n[0] = e0[1]*e1[2] - e0[2]*e1[1];\n n[1] = e0[2]*e1[0] - e0[0]*e1[2];\n n[2] = e0[0]*e1[1] - e0[1]*e1[0];\n float d = sqrtf(n[0]*n[0] + n[1]*n[1] + n[2]*n[2]);\n if (d > 0)\n {\n d = 1.0f/d;\n n[0] *= d;\n n[1] *= d;\n n[2] *= d;\n }\n }\n \n m_filename = filename;\n return true;\n}\n\n// this method is a modified version of one taken from OgreCrowd http://ogre3d.org/forums/viewtopic.php?f=11&t=69781\nbool rcMeshLoaderObj::convertGfxBody(std::vector<GfxBodyPtr> srcBodies)\n{\n // TODO: This function should probably return early if srcBodies.size() == 0?\n APP_ASSERT(srcBodies.size() > 0);\n GfxBodyPtr ent = srcBodies[0];\n\n//Convert all vertices and triangles to recast format\n const int numNodes = srcBodies.size();\n size_t *meshVertexCount = new size_t[numNodes];\n size_t *meshIndexCount = new size_t[numNodes];\n Ogre::Vector3 **meshVertices = new Ogre::Vector3*[numNodes];\n unsigned long **meshIndices = new unsigned long*[numNodes];\n\n m_vertCount = 0;\n int index_count = 0;\n size_t i = 0;\n for (std::vector<GfxBodyPtr>::iterator iter = srcBodies.begin(); iter != srcBodies.end(); iter++) {\n getMeshInformation((*iter)->mesh, meshVertexCount[i], meshVertices[i], meshIndexCount[i], meshIndices[i]);\n\n //total number of verts\n m_vertCount += meshVertexCount[i];\n //total number of indices\n index_count += meshIndexCount[i];\n\n i++;\n }\n\n// DECLARE RECAST DATA BUFFERS USING THE INFO WE GRABBED ABOVE\n m_verts = new float[m_vertCount * 3];// *3 as verts holds x,y,&z for each verts in the array\n m_tris = new int[index_count];// tris in recast is really indices like ogre\n\n //convert index count into tri count\n m_triCount = index_count / 3; //although the tris array are indices the ntris is actual number of triangles, eg. indices/3;\n\n //copy all meshes verticies into single buffer and transform to world space relative to parentNode\n int vertsIndex = 0;\n int prevVerticiesCount = 0;\n int prevIndexCountTotal = 0;\n i = 0;\n for (std::vector<GfxBodyPtr>::iterator iter = srcBodies.begin(); iter != srcBodies.end(); iter++) {\n GfxBodyPtr ent = *iter;\n //find the transform between the reference node and this node\n Transform transform = ent->getWorldTransform();\n Vector3 vertexPos;\n for (size_t j = 0; j < meshVertexCount[i]; j++)\n {\n vertexPos = transform*from_ogre(meshVertices[i][j]);\n m_verts[vertsIndex + 0] = -vertexPos.x;\n m_verts[vertsIndex + 1] = vertexPos.z;\n m_verts[vertsIndex + 2] = vertexPos.y;\n vertsIndex += 3;\n }\n\n for (size_t j = 0; j < meshIndexCount[i]; j++)\n {\n m_tris[prevIndexCountTotal + j] = meshIndices[i][j] + prevVerticiesCount;\n }\n prevIndexCountTotal += meshIndexCount[i];\n prevVerticiesCount += meshVertexCount[i];\n\n APP_ASSERT(vertsIndex == prevVerticiesCount * 3);\n\n i++;\n }\n APP_ASSERT(prevVerticiesCount == m_vertCount);\n APP_ASSERT(prevIndexCountTotal == m_triCount * 3);\n\n //delete tempory arrays\n //TODO These probably could member variables, this would increase performance slightly\n delete[] meshVertices;\n delete[] meshIndices;\n delete[] meshVertexCount;\n delete[] meshIndexCount;\n\n m_normals = new float[m_triCount * 3];\n for (int i = 0; i < m_triCount * 3; i += 3)\n {\n const float* v0 = &m_verts[m_tris[i + 0] * 3];\n const float* v1 = &m_verts[m_tris[i + 1] * 3];\n const float* v2 = &m_verts[m_tris[i + 2] * 3];\n float e0[3], e1[3];\n for (int j = 0; j < 3; ++j)\n {\n e0[j] = (v1[j] - v0[j]);\n e1[j] = (v2[j] - v0[j]);\n }\n float* n = &m_normals[i];\n n[0] = ((e0[1] * e1[2]) - (e0[2] * e1[1]));\n n[1] = ((e0[2] * e1[0]) - (e0[0] * e1[2]));\n n[2] = ((e0[0] * e1[1]) - (e0[1] * e1[0]));\n\n float d = sqrtf(n[0] * n[0] + n[1] * n[1] + n[2] * n[2]);\n if (d > 0)\n {\n d = 1.0f / d;\n n[0] *= d;\n n[1] *= d;\n n[2] *= d;\n }\n }\n return true;\n}\n\n// Get the mesh information for the given mesh. Code found on this Wiki link:\n// http://www.ogre3d.org/tikiwiki/RetrieveVertexData\nvoid getMeshInformation(const Ogre::MeshPtr mesh, size_t &vertex_count, Ogre::Vector3* &vertices,\n size_t &index_count, unsigned long* &indices, const Ogre::Vector3 &position,\n const Ogre::Quaternion &orient, const Ogre::Vector3 &scale)\n{\n bool added_shared = false;\n size_t current_offset = 0;\n size_t shared_offset = 0;\n size_t next_offset = 0;\n size_t index_offset = 0;\n\n vertex_count = index_count = 0;\n\n // Calculate how many vertices and indices we're going to need\n for (unsigned short i = 0; i < mesh->getNumSubMeshes(); ++i)\n {\n Ogre::SubMesh* submesh = mesh->getSubMesh(i);\n // We only need to add the shared vertices once\n if (submesh->useSharedVertices)\n {\n if (!added_shared)\n {\n vertex_count += mesh->sharedVertexData->vertexCount;\n added_shared = true;\n }\n }\n else\n {\n vertex_count += submesh->vertexData->vertexCount;\n }\n // Add the indices\n index_count += submesh->indexData->indexCount;\n }\n\n // Allocate space for the vertices and indices\n vertices = new Ogre::Vector3[vertex_count];\n indices = new unsigned long[index_count];\n\n added_shared = false;\n\n // Run through the submeshes again, adding the data into the arrays\n for (unsigned short i = 0; i < mesh->getNumSubMeshes(); ++i)\n {\n Ogre::SubMesh* submesh = mesh->getSubMesh(i);\n\n Ogre::VertexData* vertex_data = submesh->useSharedVertices ? mesh->sharedVertexData : submesh->vertexData;\n\n if ((!submesh->useSharedVertices) || (submesh->useSharedVertices && !added_shared))\n {\n if (submesh->useSharedVertices)\n {\n added_shared = true;\n shared_offset = current_offset;\n }\n\n const Ogre::VertexElement* posElem =\n vertex_data->vertexDeclaration->findElementBySemantic(Ogre::VES_POSITION);\n\n Ogre::HardwareVertexBufferSharedPtr vbuf =\n vertex_data->vertexBufferBinding->getBuffer(posElem->getSource());\n\n unsigned char* vertex =\n static_cast<unsigned char*>(vbuf->lock(Ogre::HardwareBuffer::HBL_READ_ONLY));\n\n // There is _no_ baseVertexPointerToElement() which takes an Ogre::Real or a double\n // as second argument. So make it float, to avoid trouble when Ogre::Real will\n // be comiled/typedefed as double:\n //Ogre::Real* pReal;\n float* pReal;\n\n for (size_t j = 0; j < vertex_data->vertexCount; ++j, vertex += vbuf->getVertexSize())\n {\n posElem->baseVertexPointerToElement(vertex, &pReal);\n Ogre::Vector3 pt(pReal[0], pReal[1], pReal[2]);\n vertices[current_offset + j] = (orient * (pt * scale)) + position;\n }\n\n vbuf->unlock();\n next_offset += vertex_data->vertexCount;\n }\n\n\n Ogre::IndexData* index_data = submesh->indexData;\n size_t numTris = index_data->indexCount / 3;\n Ogre::HardwareIndexBufferSharedPtr ibuf = index_data->indexBuffer;\n\n bool use32bitindexes = (ibuf->getType() == Ogre::HardwareIndexBuffer::IT_32BIT);\n\n size_t offset = (submesh->useSharedVertices) ? shared_offset : current_offset;\n\n if (use32bitindexes)\n {\n auto *pLong = static_cast<uint32_t*>(ibuf->lock(Ogre::HardwareBuffer::HBL_READ_ONLY));\n for (size_t k = 0; k < numTris * 3; ++k)\n {\n indices[index_offset++] = pLong[k] + offset;\n }\n }\n else\n {\n auto *pShort = static_cast<uint16_t*>(ibuf->lock(Ogre::HardwareBuffer::HBL_READ_ONLY));\n for (size_t k = 0; k < numTris * 3; ++k)\n {\n indices[index_offset++] = static_cast<unsigned long>(pShort[k]) + offset;\n }\n }\n\n ibuf->unlock();\n current_offset = next_offset;\n }\n}\n\n// TODO\nbool rcMeshLoaderObj::convertRigidBody(std::vector<RigidBody*> srcBodies)\n{\n (void) srcBodies;\n return true;\n}\n" }, { "alpha_fraction": 0.5890190601348877, "alphanum_fraction": 0.5899379849433899, "avg_line_length": 49.323699951171875, "blob_id": "f14b69b1d3754810d0e28bb2cd5691167787d98d", "content_id": "89d5a5911a56c37f2ca7befce6205aa40b4dfec0", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 8706, "license_type": "permissive", "max_line_length": 114, "num_lines": 173, "path": "/dependencies/quex-0.34.1/quex/core_engine/generator/base.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "from quex.frs_py.file_in import error_msg\nimport quex.core_engine.state_machine.parallelize as parallelize\nfrom quex.core_engine.generator.action_info import PatternActionInfo\nimport quex.core_engine.state_machine.nfa_to_dfa as nfa_to_dfa\nimport quex.core_engine.state_machine.hopcroft_minimization as hopcroft\n\nclass GeneratorBase:\n def __init__(self, PatternActionPair_List, StateMachineName):\n assert type(PatternActionPair_List) == list\n assert map(lambda elm: elm.__class__ == PatternActionInfo, PatternActionPair_List) \\\n == [ True ] * len(PatternActionPair_List)\n\n self.state_machine_name = StateMachineName\n\n # -- setup of state machine lists and id lists\n self.__extract_special_lists(PatternActionPair_List)\n\n # (*) create state (combined) state machines\n # -- core state machine\n self.sm = self.__create_core_state_machine()\n # -- pre conditions\n self.pre_context_sm = self.__create_pre_context_state_machine()\n # -- backward detectors for state machines with forward ambiguous\n # post-conditions.\n self.papc_backward_detector_state_machine_list = \\\n self.__create_backward_input_position_detectors()\n\n def __extract_special_lists(self, PatternActionPair_List):\n # (0) extract data structures:\n # -- state machine list: simply a list of all state machines\n # (the original state machine id is marked as 'origin' inside \n # 'get_state_machine')\n # -- a map from state machine id to related action (i.e. the code fragment) \n self.state_machine_list = []\n self.action_db = {}\n # -- extract:\n # -- state machines that are post-conditioned\n self.post_contexted_sm_id_list = []\n # -- state machines that nore non-trivially pre-conditioned, \n # i.e. they need a reverse state machine to be verified.\n self.pre_context_sm_id_list = []\n self.pre_context_sm_list = []\n # -- pre-conditions that are trivial, i.e. it is only checked for\n # the last character, if it was a particular one or not.\n self.begin_of_line_condition_f = False\n # [NOT IMPLEMENTED YET] \n # # trivial_pre_context_dict = {} # map: state machine id --> character code(s)\n for action_info in PatternActionPair_List:\n sm = action_info.pattern_state_machine()\n sm_id = sm.get_id()\n self.state_machine_list.append(sm)\n\n # -- register action information under the state machine id, where it belongs.\n self.action_db[sm_id] = action_info\n\n # -- collect all pre-conditions and make one single state machine out of it\n pre_sm = sm.core().pre_context_sm()\n if pre_sm != None:\n self.pre_context_sm_list.append(pre_sm)\n self.pre_context_sm_id_list.append(pre_sm.get_id())\n \n if sm.core().pre_context_begin_of_line_f():\n self.begin_of_line_condition_f = True\n\n # [NOT IMPLEMENTED YET] \n # # -- collect information about trivial (char code) pre-conditions \n # # if sm.get_trivial_pre_context_character_codes() != []:\n # # trivial_pre_context_dict[sm.get_id()] = sm.get_trivial_pre_context_character_codes()\n\n # -- collect all ids of post conditioned state machines\n if sm.core().post_context_id() != -1L:\n self.post_contexted_sm_id_list.append(sm_id)\n\n def __create_core_state_machine(self):\n # (1) transform all given patterns into a single state machine\n # (the index of the patterns remain as 'origins' inside the states)\n return self.__get_combined_state_machine(self.state_machine_list)\n\n def __create_pre_context_state_machine(self):\n if self.pre_context_sm_list == []: return None\n\n # -- add empty actions for the pre-condition terminal states\n for pre_sm in self.pre_context_sm_list:\n self.action_db[pre_sm.get_id()] = PatternActionInfo(pre_sm, \"\")\n\n return self.__get_combined_state_machine(self.pre_context_sm_list, \n FilterDominatedOriginsF=False)\n\n def __create_backward_input_position_detectors(self):\n # -- find state machines that contain a state flagged with \n # 'pseudo-ambiguous-post-condition'.\n # -- collect all backward detector state machines in a list\n papc_sm_list = [] \n for sm in self.state_machine_list:\n papc_sm = sm.core().post_context_backward_input_position_detector_sm()\n if sm.core().post_context_backward_input_position_detector_sm() == None: continue\n papc_sm_list.append(papc_sm)\n # -- code generation 'looks' for origins, so mark them.\n papc_sm.mark_state_origins()\n\n return papc_sm_list \n\n def __get_combined_state_machine(self, StateMachine_List, FilterDominatedOriginsF=True):\n \"\"\"Creates a DFA state machine that incorporates the paralell\n process of all pattern passed as state machines in \n the StateMachine_List. Each origins of each state machine\n are kept in the final state, if it is not dominated.\n\n Performs: -- parallelization\n -- translation from NFA to DFA\n -- Frank Schaefers Adapted Hopcroft optimization.\n\n Again: The state machine ids of the original state machines\n are traced through the whole process.\n \n FilterDominatedOriginsF, if set to False, can disable the filtering\n of dominated origins. This is important for pre-conditions, because,\n all successful patterns need to be reported! \n \n \"\"\" \n def __check(Place, sm):\n __check_on_orphan_states(Place, sm)\n __check_on_init_state_not_acceptance(Place, sm)\n\n def __check_on_orphan_states(Place, sm):\n orphan_state_list = sm.get_orphaned_state_index_list()\n if orphan_state_list == []: return\n error_msg(\"After '%s'\" % Place + \"\\n\" + \\\n \"Orphaned state(s) detected in regular expression (optimization lack).\\n\" + \\\n \"Please, log a defect at the projects website quex.sourceforge.net.\\n\" + \\\n \"Orphan state(s) = \" + repr(orphan_state_list) + \"\\n\", \n fh, DontExitF=True)\n\n def __check_on_init_state_not_acceptance(Place, sm):\n init_state = sm.get_init_state()\n if init_state.core().is_acceptance():\n error_msg(\"After '%s'\" % Place + \"\\n\" + \\\n \"The initial state is 'acceptance'. This should never appear.\\n\" + \\\n \"Please, log a defect at the projects website quex.sourceforge.net.\\n\")\n\n if filter(lambda origin: origin.is_acceptance(), init_state.origins().get_list()) != []:\n error_msg(\"After '%s'\" % Place + \"\\n\" + \\\n \"Initial state contains an origin that is 'acceptance'. This should never appear.\\n\" + \\\n \"Please, log a defect at the projects website quex.sourceforge.net.\\n\")\n\n # (1) mark at each state machine the machine and states as 'original'.\n # \n # This is necessary to trace in the combined state machine the\n # pattern that actually matched. Note, that a state machine in\n # the StateMachine_List represents one possible pattern that can\n # match the current input. \n #\n map(lambda x: x.mark_state_origins(), StateMachine_List)\n \n # (2) setup all patterns in paralell \n sm = parallelize.do(StateMachine_List)\n __check(\"Parallelization\", sm)\n\n # (3) convert the state machine to an DFA (paralellization created an NFA)\n sm = nfa_to_dfa.do(sm)\n __check(\"NFA to DFA\", sm)\n\n # (4) determine for each state in the DFA what is the dominating original state\n if FilterDominatedOriginsF: sm.filter_dominated_origins()\n __check(\"Filter Dominated Origins\", sm)\n\n # (5) perform hopcroft optimization\n # Note, that hopcroft optimization does consider the original acceptance \n # states when deciding if two state sets are equivalent. \n sm = hopcroft.do(sm)\n __check(\"Hopcroft Minimization\", sm)\n\n return sm\n" }, { "alpha_fraction": 0.4943181872367859, "alphanum_fraction": 0.5056818127632141, "avg_line_length": 25.52054786682129, "blob_id": "822bb2c7b62634753d1be8c166727e085f7c01bf", "content_id": "cfe43c05fc693de6d32d93b8b3a2ec22329fb5ab", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1936, "license_type": "permissive", "max_line_length": 69, "num_lines": 73, "path": "/dependencies/quex-0.34.1/quex/frs_py/string_handling.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "def trim(Str):\n \"\"\"Deletes whitepspace borders of a string.\n \n Transforms: input = \" hallo, du da \"\n into output = \"hallo, du da\"\n \"\"\"\n\n if Str == \"\": return \"\"\n L = len(Str)\n for i in range(L):\n if not Str[i].isspace():\n break\n else:\n # reached end of string --> empty string\n return \"\"\n\n for k in range(1, L-i+1):\n if not Str[L-k].isspace():\n break\n\n # note, if k = 1 then we would return Str[i:0]\n if L-i != 1:\n if k == 1: return Str[i:]\n else: return Str[i:-k + 1]\n else: return Str[i:]\n\n\ndef blue_print(BluePrintStr, Replacements, CommonStart=\"$\"):\n \"\"\"Takes a string acting as blue print and replaces all\n replacements of the form r in Replacements:\n\n r[0] = original pattern\n r[1] = replacements\n\n Original pattern must start with '$'.\n \"\"\"\n # -- sort the replacements so that long strings\n # are replaced first\n Replacements.sort(lambda a, b: cmp(len(b[0]), len(a[0])))\n\n # -- the longest original\n L = len(Replacements[0][0])\n\n txt = BluePrintStr\n result = \"\"\n prev_end = 0\n while 1 + 1 == 2:\n i = txt.find(CommonStart, prev_end)\n if i == -1: \n result += txt[prev_end:]\n return result\n\n for orig, replacement in Replacements:\n assert orig[0] == CommonStart[0]\n if txt.find(orig, i, i + L) == i: \n result += txt[prev_end:i] + replacement\n prev_end = i + len(orig)\n break\n else:\n # Nothing matched the expression starting with '$' simply\n # continue as if nothing happend.\n result += txt[prev_end:i+1]\n prev_end = i + 1\n pass\n\n\n\ndef tex_safe(Str):\n\n for letter in \"_%&^#$\":\n Str.replace(letter, \"\\\\\" + letter)\n\n return Str\n" }, { "alpha_fraction": 0.5590856075286865, "alphanum_fraction": 0.5621852278709412, "avg_line_length": 45.85454559326172, "blob_id": "30d242118cd9eb9518330375832ca0e43588687e", "content_id": "041b44fae739817765c69616cb1341fa2a15df9c", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2581, "license_type": "permissive", "max_line_length": 110, "num_lines": 55, "path": "/dependencies/quex-0.34.1/quex/core_engine/generator/input_position_backward_detector.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "# PURPOSE: Where there is a pseudo ambiguous post-condition, there\n# cannot be made an immediate decision about the input position after\n# an acceptance state is reached. Instead, it is necessary to \n# go backwards and detect the start of the post-condition \n# a-posteriori. This function produces code of the backward\n# detector inside a function.\n#\n# (C) 2007 Frank-Rene Schaefer\n#\n################################################################################\nimport quex.core_engine.generator.state_machine_coder as state_machine_coder\nfrom quex.core_engine.generator.state_machine_decorator import StateMachineDecorator\nfrom quex.frs_py.string_handling import blue_print\n\nfunction_str = \"\"\"\n#include <quex/code_base/temporary_macros_on>\nQUEX_INLINE void \nPAPC_input_postion_backward_detector_$$ID$$(QuexAnalyser* me) \n{\n$$LOCAL_VARIABLES$$\n$$STATE_MACHINE$$\n$$FUNCTION_BODY$$ \n}\n#include <quex/code_base/temporary_macros_off>\n\"\"\"\n\ndef do(sm, LanguageDB, PrintStateMachineF):\n\n decorated_state_machine = StateMachineDecorator(sm, \n \"BACKWARD_DETECTOR_\" + repr(sm.get_id()),\n PostContextSM_ID_List = [], \n BackwardLexingF=True, \n BackwardInputPositionDetectionF=True)\n\n function_body = state_machine_coder.do(decorated_state_machine)\n\n sm_str = \" \" + LanguageDB[\"$comment\"](\"state machine\") + \"\\n\"\n if PrintStateMachineF: \n sm_str += LanguageDB[\"$ml-comment\"](sm.get_string(NormalizeF=False)) + \"\\n\"\n\n # -- input position detectors simply the next 'catch' and return\n function_body += LanguageDB[\"$label-def\"](\"$terminal-general\", True) + \"\\n\"\n function_body += LanguageDB[\"$input/seek_position\"](\"end_of_core_pattern_position\") + \"\\n\"\n function_body += LanguageDB[\"$input/increment\"] + \"\\n\"\n\n variables_txt = LanguageDB[\"$local-variable-defs\"](\n [[\"QUEX_CHARACTER_TYPE\", \"input\", \"(QUEX_CHARACTER_TYPE)(0x0)\"],\n [\"QUEX_CHARACTER_POSITION_TYPE\", \"end_of_core_pattern_position\", \"(QUEX_CHARACTER_TYPE*)(0x0)\"]])\n\n return blue_print(function_str, \n [[\"$$ID$$\", repr(sm.get_id()).replace(\"L\", \"\")],\n [\"$$FUNCTION_BODY$$\", function_body],\n [\"$$LOCAL_VARIABLES$$\", variables_txt],\n [\"$$STATE_MACHINE$$\", sm_str],\n ])\n\n\n\n\n" }, { "alpha_fraction": 0.653407096862793, "alphanum_fraction": 0.6547907590866089, "avg_line_length": 30.560440063476562, "blob_id": "3a7861c007a68f3f687567657562aa6497a66808", "content_id": "40378a4f2f7651be6b7473cfa89ccbe6d957973f", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 2891, "license_type": "permissive", "max_line_length": 86, "num_lines": 91, "path": "/gtasa/surfinfo.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016 \n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE. \n */\n \n#ifndef SURFINFO_H \n#define SURFINFO_H \n\n#include <istream>\n#include <vector>\n#include <string> \n#include <map> \n\n#include \"csvread.h\"\n\nstruct SurfInfo {\n std::string name;\n\n std::string adhesion_group;\n float tyre_grip;\n float wet_grip;\n std::string skidmark;\n std::string friction_effect;\n bool soft_landing;\n bool see_through;\n bool shoot_through;\n bool sand;\n bool water;\n bool shallow_water;\n bool beach;\n bool steep_slope; // can't climb\n bool glass; // shatters\n bool stairs; // hack to stop camera tilt\n bool skateable;\n bool pavement;\n int roughness; // pad vibration\n int flammability;\n bool sparks; // not used\n bool sprint;\n bool footsteps; // leave footprints\n bool footdust;\n bool cardirt;\n bool carclean;\n bool w_grass;\n bool w_gravel;\n bool w_mud;\n bool w_dust;\n bool w_sand;\n bool w_spray;\n bool proc_plant;\n bool proc_obj;\n bool climbable;\n std::string bullet_fx;\n};\n\nstruct SurfInfoData { \n std::vector<SurfInfo> surfaces;\n\n // the map points into the vehicles vector above, so don't resize the above vector\n typedef std::map<std::string,SurfInfo*> SurfInfoMap;\n typedef SurfInfoMap::iterator iterator;\n SurfInfoMap map;\n\n SurfInfo *&operator [] (const std::string &i) { return map[i]; }\n \n iterator begin() { return map.begin(); }\n iterator end() { return map.end(); }\n iterator find(const std::string &i) { return map.find(i); }\n\n}; \n\n// the csv should be already read in\nvoid read_surfinfo (Csv &csv, SurfInfoData &data);\n \n#endif \n\n" }, { "alpha_fraction": 0.65969318151474, "alphanum_fraction": 0.6663877367973328, "avg_line_length": 37.54838562011719, "blob_id": "7e791d9713680defcbf17a93759ddac9fb3256fd", "content_id": "d4d9b21fda4b66c249ee1163368eb7f0c211f3bd", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 3585, "license_type": "permissive", "max_line_length": 98, "num_lines": 93, "path": "/engine/gfx/gfx_sky_material.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <string>\n#include <map>\n\n#include <centralised_log.h>\n\n#include \"gfx_internal.h\"\n#include \"gfx_sky_material.h\"\n#include \"gfx_sky_body.h\"\n\n\nGfxSkyMaterial *gfx_sky_material_add (const std::string &name)\n{\n GFX_MAT_SYNC;\n if (gfx_sky_material_has(name)) GRIT_EXCEPT(\"Material already exists: \\\"\"+name+\"\\\"\");\n GfxSkyMaterial *r = new GfxSkyMaterial(name);\n material_db[name] = r;\n return r;\n}\n\nGfxSkyMaterial *gfx_sky_material_add_or_get (const std::string &name)\n{\n GFX_MAT_SYNC;\n if (gfx_material_has_any(name)) {\n GfxSkyMaterial *mat = dynamic_cast<GfxSkyMaterial*>(material_db[name]);\n if (mat==NULL) GRIT_EXCEPT(\"Material already exists but is the wrong kind: \\\"\"+name+\"\\\"\");\n return mat;\n }\n return gfx_sky_material_add(name);\n}\n\nGfxSkyMaterial *gfx_sky_material_get (const std::string &name)\n{\n GFX_MAT_SYNC;\n if (!gfx_sky_material_has(name)) GRIT_EXCEPT(\"Sky material does not exist: \\\"\"+name+\"\\\"\");\n GfxSkyMaterial *mat = dynamic_cast<GfxSkyMaterial*>(material_db[name]);\n if (mat==NULL) GRIT_EXCEPT(\"Wrong kind of material: \\\"\"+name+\"\\\"\");\n return mat;\n}\n\nbool gfx_sky_material_has (const std::string &name)\n{\n GFX_MAT_SYNC;\n GfxMaterialDB::iterator it = material_db.find(name);\n if (it == material_db.end()) return false;\n return dynamic_cast<GfxSkyMaterial*>(it->second) != NULL;\n}\n\nGfxSkyMaterial::GfxSkyMaterial (const std::string &name)\n : GfxBaseMaterial(name, gfx_shader_get(\"/system/SkyDefault\")),\n sceneBlend(GFX_SKY_MATERIAL_OPAQUE)\n{\n}\n\nvoid gfx_sky_material_init (void)\n{\n std::string vs = \"out.position = transform_to_world(vert.position.xyz);\\n\";\n std::string fs = \"var c = pma_decode(sample(mat.emissiveMap, vert.coord0.xy))\\n\"\n \" * Float4(1, 1, 1, mat.alphaMask);\\n\"\n \"if (c.a <= mat.alphaRejectThreshold) discard;\\n\"\n \"out.colour = gamma_decode(c.rgb) * mat.emissiveMask;\\n\"\n \"out.alpha = c.a;\\n\"\n \"out.colour = out.colour * out.alpha;\\n\";\n\n gfx_shader_make_or_reset(\"/system/SkyDefault\", vs, \"\", fs, {\n { \"alphaMask\", GfxGslParam::float1(1.0f) },\n { \"alphaRejectThreshold\", GfxGslParam::float1(-1.0f) },\n { \"emissiveMap\", GfxGslParam(GFX_GSL_FLOAT_TEXTURE2, 1, 1, 1, 1) },\n { \"emissiveMask\", GfxGslParam::float3(1, 1, 1) },\n }, false);\n\n gfx_sky_material_add(\"/system/SkyDefault\");\n}\n" }, { "alpha_fraction": 0.6080586314201355, "alphanum_fraction": 0.6886447072029114, "avg_line_length": 33.125, "blob_id": "b52531c82f0544b0aaed7aae1e20c64a8f0fa35f", "content_id": "b7eada411f538f718043638d227bd8b822afd4ce", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Lua", "length_bytes": 273, "license_type": "permissive", "max_line_length": 47, "num_lines": 8, "path": "/engine/tests/engine/hud/text.lua", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "include `font_impact50.lua`\ngfx_colour_grade(`neutral.lut.png`)\ngfx_option('POST_PROCESSING', false)\nt = gfx_hud_text_add(`Impact50`)\nt.text = \"Some test text 123\"\nt.position = vec(200, 100)\ngfx_render(0.1, vec(0, 0, 0), quat(1, 0, 0, 0))\ngfx_screenshot('output-text.png')\n" }, { "alpha_fraction": 0.6838913559913635, "alphanum_fraction": 0.6902188062667847, "avg_line_length": 28.625, "blob_id": "04e7d257a6467d074de68de976f5ac842d479a2a", "content_id": "b8dd13c3a4a68c600f235387957372faa9335a97", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 3793, "license_type": "permissive", "max_line_length": 91, "num_lines": 128, "path": "/engine/gfx/gfx_option.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#ifndef GFX_OPTION_H\n#define GFX_OPTION_H\n\nenum GfxBoolOption {\n GFX_AUTOUPDATE,\n GFX_SHADOW_RECEIVE,\n GFX_SHADOW_CAST,\n GFX_VSYNC,\n GFX_FULLSCREEN,\n\n GFX_FOG,\n GFX_WIREFRAME,\n GFX_WIREFRAME_SOLID,\n GFX_ANAGLYPH,\n GFX_CROSS_EYE,\n\n GFX_SHADOW_SIMPLE_OPTIMAL_ADJUST,\n GFX_SHADOW_AGGRESSIVE_FOCUS_REGION,\n GFX_SHADOW_FILTER_DITHER,\n GFX_SHADOW_FILTER_DITHER_TEXTURE,\n GFX_SHADOW_EMULATE_PCF,\n\n GFX_POST_PROCESSING,\n GFX_RENDER_PARTICLES,\n GFX_POINT_LIGHTS,\n GFX_RENDER_SKY,\n GFX_RENDER_HUD,\n\n GFX_RENDER_FIRST_PERSON,\n GFX_UPDATE_MATERIALS,\n};\n\nenum GfxIntOption {\n GFX_FULLSCREEN_WIDTH,\n GFX_FULLSCREEN_HEIGHT,\n GFX_SHADOW_RES,\n GFX_SHADOW_FILTER_TAPS,\n GFX_BLOOM_ITERATIONS,\n\n GFX_RAM,\n GFX_DEBUG_MODE,\n};\n\nenum GfxFloatOption {\n GFX_FOV,\n GFX_NEAR_CLIP,\n GFX_FAR_CLIP,\n GFX_FIRST_PERSON_NEAR_CLIP,\n GFX_FIRST_PERSON_FAR_CLIP,\n GFX_EYE_SEPARATION, // FOR 'real' 3d\n GFX_MONITOR_HEIGHT, // FOR 'real' 3d\n\n GFX_MONITOR_EYE_DISTANCE, // FOR 'real' 3d\n GFX_MIN_PERCEIVED_DEPTH, // FOR 'real' 3d -- distance from eyes of the front clip plane\n GFX_MAX_PERCEIVED_DEPTH, // FOR 'real' 3d -- distance from eyes of the rear clip plane\n GFX_SHADOW_START,\n GFX_SHADOW_END0,\n\n GFX_SHADOW_END1,\n GFX_SHADOW_END2,\n GFX_SHADOW_FADE_START,\n GFX_SHADOW_FILTER_SIZE,\n GFX_SHADOW_OPTIMAL_ADJUST0,\n\n GFX_SHADOW_OPTIMAL_ADJUST1,\n GFX_SHADOW_OPTIMAL_ADJUST2,\n GFX_SHADOW_LIGHT_DIRECTION_THRESHOLD,\n GFX_SHADOW_PADDING,\n GFX_SHADOW_SPREAD_FACTOR0,\n\n GFX_SHADOW_SPREAD_FACTOR1,\n GFX_SHADOW_SPREAD_FACTOR2,\n GFX_ANAGLYPH_LEFT_RED_MASK,\n GFX_ANAGLYPH_LEFT_GREEN_MASK,\n GFX_ANAGLYPH_LEFT_BLUE_MASK,\n\n GFX_ANAGLYPH_RIGHT_RED_MASK,\n GFX_ANAGLYPH_RIGHT_GREEN_MASK,\n GFX_ANAGLYPH_RIGHT_BLUE_MASK,\n GFX_ANAGLYPH_DESATURATION,\n\n GFX_BLOOM_THRESHOLD\n};\n\nstd::string gfx_option_to_string (GfxBoolOption o);\nstd::string gfx_option_to_string (GfxIntOption o);\nstd::string gfx_option_to_string (GfxFloatOption o);\n\n// set's t to either 0,1,2 and fills in the approriate argument\nvoid gfx_option_from_string (const std::string &s,\n int &t,\n GfxBoolOption &o0,\n GfxIntOption &o1,\n GfxFloatOption &o2);\n\nvoid gfx_option (GfxBoolOption o, bool v);\nbool gfx_option (GfxBoolOption o);\nvoid gfx_option (GfxIntOption o, int v);\nint gfx_option (GfxIntOption o);\nvoid gfx_option (GfxFloatOption o, float v);\nfloat gfx_option (GfxFloatOption o);\n\nvoid gfx_option_init (void);\nvoid gfx_option_reset (void);\n\n\n#endif\n\n" }, { "alpha_fraction": 0.6100308299064636, "alphanum_fraction": 0.6115710139274597, "avg_line_length": 46.429222106933594, "blob_id": "86e795cad1e68b95028a9cf04f57057d54b61ed6", "content_id": "bd1bafcf61e260ea3d95d2be99b1c22a82166e41", "detected_licenses": [ "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer", "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 10388, "license_type": "permissive", "max_line_length": 119, "num_lines": 219, "path": "/dependencies/quex-0.34.1/quex/core.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "from copy import copy\nimport os\nimport sys\n\nfrom quex.frs_py.file_in import error_msg\n\nfrom quex.input.setup import setup as Setup\nimport quex.token_id_maker as token_id_maker\nimport quex.lexer_mode as lexer_mode\nfrom quex.core_engine.generator.action_info import UserCodeFragment_straighten_open_line_pragmas, \\\n CodeFragment\nfrom quex.token_id_maker import TokenInfo\n\nimport quex.core_engine.generator.core as generator\nfrom quex.core_engine.generator.action_info import PatternActionInfo\nimport quex.input.quex_file_parser as quex_file_parser\nimport quex.consistency_check as consistency_check\nimport quex.output.cpp.core as quex_class_out\nimport quex.output.cpp.action_code_formatter as action_code_formatter\nimport quex.output.graphviz.interface as plot_generator\n\ndef do():\n \"\"\"Generates state machines for all modes. Each mode results into \n a separate state machine that is stuck into a virtual function\n of a class derived from class 'quex_mode'.\n \"\"\"\n # NOTE: The generated header file that contains the lexical analyser class includes\n # the file \"code_base/code_base/definitions-quex-buffer.h\". But the analyser\n # functions also need 'connection' to the lexer class, so we include the header\n # of the generated lexical analyser at this place.\n lexer_mode.token_id_db[\"TERMINATION\"] = TokenInfo(\"TERMINATION\", ID=Setup.token_id_termination)\n lexer_mode.token_id_db[\"UNINITIALIZED\"] = TokenInfo(\"UNINITIALIZED\", ID=Setup.token_id_uninitialized)\n\n mode_db = __get_mode_db(Setup)\n\n # (*) get list of modes that are actually implemented\n # (abstract modes only serve as common base)\n mode_list = filter(lambda mode: mode.options[\"inheritable\"] != \"only\", mode_db.values())\n mode_name_list = map(lambda mode: mode.name, mode_list)\n\n # (2) implement the 'quex' core class from a template\n #\n # -- do the coding of the class framework\n quex_class_out.do(mode_db, Setup)\n\n # (3) create the token ids\n token_id_maker.do(Setup) \n\n # (3) implement the lexer mode-specific analyser functions\n inheritance_info_str = \"Information about what pattern 'comes' from what mode in the inheritance tree.\\n\\n\"\n inheritance_info_str += \"[1] pattern, [2] dominating mode, [3] dominating inheritance level, [4] pattern index\\n\\n\"\n analyzer_code = \"\"\n for mode in mode_list: \n # accumulate inheritance information for comment\n x, y = get_code_for_mode(mode, mode_name_list) \n analyzer_code += x\n inheritance_info_str += \"(%s)\\n\" % mode.name + y + \"\\n\\n\"\n \n # find unused labels\n analyzer_code = generator.delete_unused_labels(analyzer_code)\n\n # generate frame for analyser code\n analyzer_code = generator.frame_this(analyzer_code)\n\n # Bring the info about the patterns first\n inheritance_info_str = inheritance_info_str.replace(\"*/\", \"* /\")\n inheritance_info_str = inheritance_info_str.replace(\"/*\", \"/ *\")\n analyzer_code = Setup.language_db[\"$ml-comment\"](inheritance_info_str) + \"\\n\" + analyzer_code\n\n # write code to a header file\n fh = open(Setup.output_core_engine_file, \"wb\")\n if os.linesep != \"\\n\": analyzer_code = analyzer_code.replace(\"\\n\", os.linesep)\n fh.write(analyzer_code)\n fh.close()\n\n UserCodeFragment_straighten_open_line_pragmas(Setup.output_file_stem, \"C\")\n UserCodeFragment_straighten_open_line_pragmas(Setup.output_core_engine_file, \"C\")\n UserCodeFragment_straighten_open_line_pragmas(Setup.output_code_file, \"C\")\n\ndef get_code_for_mode(Mode, ModeNameList):\n\n # -- some modes only define event handlers that are inherited\n if not Mode.has_matches(): return \"\", \"\"\n\n # -- 'end of stream' action\n if Mode.on_end_of_stream_code_fragments() == []:\n txt = \"self.send(%sTERMINATION);\\n\" % Setup.input_token_id_prefix \n txt += \"#ifdef __QUEX_OPTION_ANALYSER_RETURN_TYPE_IS_VOID\\n\"\n txt += \" return /*__QUEX_TOKEN_ID_TERMINATION*/;\\n\"\n txt += \"#else\\n\"\n txt += \" return __QUEX_TOKEN_ID_TERMINATION;\\n\"\n txt += \"#endif\\n\"\n Mode.on_end_of_stream = CodeFragment(txt)\n\n end_of_stream_action = action_code_formatter.do(Mode, Mode.on_end_of_stream_code_fragments(), \n \"on_end_of_stream\", None, EOF_ActionF=True)\n # -- 'default' action (nothing matched)\n\n if Mode.on_failure_code_fragments() == []:\n txt = \"self.send(%sTERMINATION);\\n\" % Setup.input_token_id_prefix \n txt += \"#ifdef __QUEX_OPTION_ANALYSER_RETURN_TYPE_IS_VOID\\n\"\n txt += \" return /*__QUEX_TOKEN_ID_TERMINATION*/;\\n\"\n txt += \"#else\\n\"\n txt += \" return __QUEX_TOKEN_ID_TERMINATION;\\n\"\n txt += \"#endif\\n\"\n Mode.on_failure = CodeFragment(txt)\n\n default_action = action_code_formatter.do(Mode, Mode.on_failure_code_fragments(), \n \"on_failure\", None, Default_ActionF=True)\n\n # -- adapt pattern-action pair information so that it can be treated\n # by the code generator.\n inheritance_info_str, pattern_action_pair_list = get_generator_input(Mode)\n\n analyzer_code = generator.do(pattern_action_pair_list, \n DefaultAction = PatternActionInfo(None, default_action), \n EndOfStreamAction = PatternActionInfo(None, end_of_stream_action),\n PrintStateMachineF = True,\n StateMachineName = Mode.name,\n AnalyserStateClassName = Setup.output_engine_name,\n StandAloneAnalyserF = False, \n QuexEngineHeaderDefinitionFile = Setup.output_file_stem,\n ModeNameList = ModeNameList)\n\n return analyzer_code, inheritance_info_str\n \ndef get_generator_input(Mode):\n \"\"\"The module 'quex.core_engine.generator.core' produces the code for the \n state machine. However, it requires a certain data format. This function\n adapts the mode information to this format. Additional code is added \n\n -- for counting newlines and column numbers. This happens inside\n the function ACTION_ENTRY().\n -- (optional) for a virtual function call 'on_action_entry()'.\n -- (optional) for debug output that tells the line number and column number.\n \"\"\"\n match_info_list = Mode.pattern_action_pairs().values()\n\n # (*) sort the patterns:\n #\n # -- The order of the patterns determine the sequence of the creation of the \n # state machines for the patterns.\n # -- The sequence of the state machines determines the state machine ids. Patterns\n # that are created earlier have a 'smaller' state machine id than patterns \n # that are created later. \n # -- The state machine id stands for the 'privilidge' of a pattern. A pattern\n # with a lower state machine id has a higher priviledge than a pattern with\n # a higher id. The state machine id is used for **sorting** during code\n # generation.\n #\n # A mode potentially accumulates inherited patterns from base modes.\n # => At this place all patterns are sorted according to their inheritance \n # level. Thus, a propper priviledge handling is guaranteed.\n def pattern_precedence(A, B):\n tmp = - cmp(A.inheritance_level, B.inheritance_level)\n if tmp != 0: return tmp\n else: return cmp(A.pattern_index(), B.pattern_index())\n \n match_info_list.sort(pattern_precedence)\n\n inheritance_info_str = \"\"\n pattern_action_pair_list = []\n for pattern_info in match_info_list:\n safe_pattern_str = pattern_info.pattern.replace(\"\\\"\", \"\\\\\\\"\")\n pattern_state_machine = pattern_info.pattern_state_machine()\n\n # Prepare the action code for the analyzer engine. For this purpose several things\n # are be added to the user's code.\n prepared_action = action_code_formatter.do(Mode, pattern_info.action(), safe_pattern_str,\n pattern_state_machine)\n\n action_info = PatternActionInfo(pattern_state_machine, prepared_action)\n\n pattern_action_pair_list.append(action_info)\n\n inheritance_info_str += \" %s %s %2i %05i\\n\" % (safe_pattern_str,\n pattern_info.inheritance_mode_name,\n pattern_info.inheritance_level, \n pattern_info.pattern_index())\n \n return inheritance_info_str, pattern_action_pair_list\n\ndef __get_post_context_n(match_info_list):\n n = 0\n for info in MatchInfoList:\n if info.pattern_state_machine().core().post_context_id() != -1L:\n n += 1\n return n\n\ndef do_plot():\n\n mode_db = __get_mode_db(Setup)\n\n for mode in mode_db.values(): \n # -- some modes only define event handlers that are inherited\n if not mode.has_matches(): continue\n\n # -- adapt pattern-action pair information so that it can be treated\n # by the code generator.\n dummy, pattern_action_pair_list = get_generator_input(mode)\n\n plotter = plot_generator.Generator(pattern_action_pair_list, \n StateMachineName = mode.name,\n GraphicFormat = Setup.plot_graphic_format)\n plotter.do()\n\ndef __get_mode_db(Setup):\n # (0) check basic assumptions\n if Setup.input_mode_files == []: error_msg(\"No input files.\")\n \n # (1) input: do the pattern analysis, in case exact counting of newlines is required\n # (this might speed up the lexer, but nobody might care ...)\n # pattern_db = analyse_patterns.do(pattern_file) \n mode_db = quex_file_parser.do(Setup.input_mode_files, Setup)\n\n # (*) perform consistency check \n consistency_check.do(mode_db)\n\n return mode_db\n\n" }, { "alpha_fraction": 0.40079447627067566, "alphanum_fraction": 0.40476688742637634, "avg_line_length": 46.83000183105469, "blob_id": "336b9197a653320bc9f8f2c085042fae1d4bb684", "content_id": "9d56c34b31e1b88cc53dd0f7b13975e3b83047a0", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 4783, "license_type": "permissive", "max_line_length": 127, "num_lines": 100, "path": "/dependencies/quex-0.34.1/quex/code_base/buffer/iconv/debug.i", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "// -*- C++ -*- vim: set syntax=cpp:\n// (C) 2007 Frank-Rene Schaefer\n// NO WARRRANTY\n//\n#ifndef __INCLUDE_GUARD_QUEX_BUFFER_ICONV_INPUT_STRATEGY_UNIT_TEST_HELPER__\n#define __INCLUDE_GUARD_QUEX_BUFFER_ICONV_INPUT_STRATEGY_UNIT_TEST_HELPER__\n\n#if ! defined (__QUEX_OPTION_UNIT_TEST_INPUT_STRATEGY_ICONV)\n\n# define QUEX_UNIT_TEST_ICONV_INPUT_STRATEGY_PRINT_CONSTRUCTOR(X,Y,Z) /* empty */\n# define QUEX_UNIT_TEST_ICONV_INPUT_STRATEGY_PRINT_RAW_BUFFER_LOAD(X) /* empty */\n# define QUEX_UNIT_TEST_ICONV_INPUT_STRATEGY_PRINT_ICONV_REPORT(X) /* empty */\n# define QUEX_UNIT_TEST_ICONV_INPUT_STRATEGY_PRINT_RAW_AND_USER_BUFFER(X) /* empty */\n\n#else \n\nnamespace quex {\n\n QUEX_INLINE void \n QuexBufferFiller_IConv_print_construction_info(TEMPLATED_CLASS* me,\n const char* FromCoding, const char* ToCoding,\n iconv_t IconvResult)\n {\n /* clear raw buffer, for easy visual control */\n for(int i=0; i<raw_buffer.size; ++i) { \n raw_buffer.begin[i] = 0; \n } \n std::cout << \"from: \" << FromCoding << std::endl; \n std::cout << \"to: \" << ToCoding << std::endl; \n\n if( IconvResult == (iconv_t)(-1) ) { \n switch( errno ) { \n case EINVAL: // incomplete sequence ecountered (cut in between character) \n std::cout << \"invalid conversion\\n\"; \n } \n }\n }\n\n QUEX_INLINE void\n CLASS::QUEX_UNIT_TEST_ICONV_INPUT_STRATEGY_PRINT_RAW_BUFFER_LOAD(size_t LoadedByteN) \n {\n std::cout << \"(*) loaded bytes = \" << LoadedByteN << std::endl; \n raw_buffer.print(\"raw buffer\");\n }\n\n QUEX_INLINE void\n CLASS::QUEX_UNIT_TEST_ICONV_INPUT_STRATEGY_PRINT_ICONV_REPORT(size_t Report) \n {\n std::cout << \"(*) converted\\n\"; \n if( Report == (size_t)(-1) ) {\n switch( errno ) { \n case EILSEQ: // invalid sequence encountered \n std::cout << \"invalid sequence\\n\"; \n break; \n case EINVAL: // incomplete sequence ecountered (cut in between character) \n std::cout << \"incomplete sequence\\n\"; \n break; \n case E2BIG: // not enough room in output buffer \n std::cout << \"not enough room in output buffer\\n\"; \n break; \n } \n } \n else { \n std::cout << \"normal conversion completed!\\n\"; \n }\n }\n\n QUEX_INLINE void\n CLASS::QUEX_UNIT_TEST_ICONV_INPUT_STRATEGY_PRINT_RAW_AND_USER_BUFFER(CLASS::buffer_info* user_buffer) \n {\n raw_buffer.print(\"raw buffer\"); \n user_buffer->print(\"user buffer\", user_buffer->position - user_buffer->begin);\n }\n\n QUEX_INLINE void \n CLASS::buffer_info::print(const char* name, int until_idx /* = -1*/) \n {\n if( until_idx == -1 ) until_idx = size;\n fprintf(stdout, \"%s:\\n\", name);\n fprintf(stdout, \" position = %i\\n\", (int)(position - begin));\n fprintf(stdout, \" bytes left = %i\\n\", bytes_left_n);\n fprintf(stdout, \" content = {\\n\");\n\n fprintf(stdout, \" \");\n for(int i=0; i < until_idx ; ++i) {\n unsigned char b = begin[i+0];\n fprintf(stdout, \"%02X.\", (unsigned)b);\n if( (i+1) % 10 == 0 ) fprintf(stdout, \"\\n \");\n }\n fprintf(stdout, \"\\n\");\n\n fprintf(stdout, \" }\\n\");\n }\n}\n#undef CLASS\n#undef QUEX_INLINE\n\n#endif\n\n#endif // __INCLUDE_GUARD_QUEX_BUFFER_ICONV_INPUT_STRATEGY_UNIT_TEST_HELPER__\n" }, { "alpha_fraction": 0.644885778427124, "alphanum_fraction": 0.6463805437088013, "avg_line_length": 35.30232620239258, "blob_id": "23c07dabc1269434cf86066214c4620d13dc25c0", "content_id": "295728c0990883489a0114affeaa2e27be3ce1cc", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 4683, "license_type": "permissive", "max_line_length": 95, "num_lines": 129, "path": "/engine/shared_ptr.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#ifndef SharedPtr_h\n#define SharedPtr_h\n\n#include <cstdlib>\n#include <functional>\n\n/** A smart pointer that does reference counting and calls delete on the target\n * when the number of references hits zero. Note that unlike Ogre::SharedPtr,\n * this one is not thread-safe (i.e. you cannot make reference or unreference\n * the target in concurrent threads or the counter updates will race). */\ntemplate<class T> class SharedPtr {\n\n /** The target. */\n T *ptr;\n\n /** The number of references to the target. Note that to allow a general\n * T, we allocate the counter separately. It would also be possible to require\n * a counter inside the T object. */\n unsigned int *cnt;\n\n public:\n\n /** Deference to the target. */\n T& operator*() const { return *ptr; }\n\n /** Deference to the target (-> form). */\n T* operator->() const { return ptr; }\n\n /** Is the target NULL? */\n bool isNull (void) const { return cnt==NULL; }\n\n /** Set the target to NULL. */\n void setNull (void) {\n if (isNull()) return;\n useCount()--;\n if (useCount()==0) {\n delete cnt;\n delete ptr;\n }\n ptr = NULL;\n cnt = NULL;\n }\n\n /** Return the number of references to the target. */\n unsigned int &useCount (void) const { return *cnt; }\n\n /** Create with a NULL target. */\n SharedPtr (void) : ptr(NULL), cnt(NULL) { }\n\n /** Create with a given raw pointer as a target. The raw pointer should be\n * used only through the SharedPtr from this point onwards, as it can be\n * difficult to know when raw pointers to reference-counted memory become\n * dangling. */\n explicit SharedPtr (T *p) : ptr(p), cnt(p==NULL?NULL:new unsigned int(1)) { }\n\n /** Make a new reference to an existing SharedPtr (incrementing the reference counter). */\n SharedPtr (const SharedPtr<T> &p) : ptr(p.ptr), cnt(p.cnt) { if (!isNull()) useCount()++; }\n\n /** Destructor (decrements the reference counter). */\n ~SharedPtr (void) { setNull(); }\n\n /** Make this SharedPtr reference the target of SharedPtr p.\n *\n * This increments the reference counter.\n */\n SharedPtr &operator= (const SharedPtr<T> &p) {\n // The next line is not just an optimisation, it is needed for correctness\n // without it if *cnt==1 then the setNull() would free the storage,\n // in what ought to be a no-op. Obviously this would cause considerable drama.\n if (p==*this) return *this;\n T *ptr_ = p.ptr;\n unsigned int *cnt_ = p.cnt;\n setNull();\n ptr = ptr_;\n cnt = cnt_;\n if (!isNull()) useCount()++;\n return *this;\n }\n\n /** Return a SharedPtr to the same object that has a supertype.\n *\n * Follows C++ static_cast rules.\n */\n template<class U> SharedPtr<U> staticCast (void) const\n {\n SharedPtr<U> r;\n r.cnt = cnt;\n r.ptr = static_cast<U*>(ptr);\n if (!isNull()) useCount()++;\n return r;\n }\n\n template<class U> friend class SharedPtr;\n};\n\n/** Do the targets match? */\ntemplate<class T, class U> inline bool operator==(SharedPtr<T> const& a, SharedPtr<U> const& b)\n{ return &*a == &*b; }\n\n/** Are the targets different? */\ntemplate<class T, class U> inline bool operator!=(SharedPtr<T> const& a, SharedPtr<U> const& b)\n{ return ! (a==b); }\n\n/** Call std::less on the targets. */\ntemplate<class T, class U> inline bool operator<(SharedPtr<T> const& a, SharedPtr<U> const& b)\n{ return std::less<const void*>()(&*a, &*b); }\n\n#endif\n" }, { "alpha_fraction": 0.7233940362930298, "alphanum_fraction": 0.7311840653419495, "avg_line_length": 29.560440063476562, "blob_id": "d2c81b6e04bc807ec14cd9f69fb5c1f0b2c2c2f4", "content_id": "71d01f93af0ebe26e9379107649ea527c09e40b3", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 8344, "license_type": "permissive", "max_line_length": 134, "num_lines": 273, "path": "/engine/gfx/gfx.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n/* TODO:\n * shaders\n * materials\n */\n\n#include \"../vect_util.h\"\n#include \"../shared_ptr.h\"\n\n// Only things that are referenced from Lua AND can be destroyed (before shutdown) get a SharedPtr\nstruct GfxCallback;\nstruct GfxLastRenderStats;\nstruct GfxLastFrameStats;\nstruct GfxRunningFrameStats;\nstruct GfxPaintColour;\n\ntypedef std::map<std::string, std::string> GfxStringMap;\n\n// Used as a default param in some calls\nextern const GfxStringMap gfx_empty_string_map;\n\n#ifndef gfx_h\n#define gfx_h\n\n#include <string>\n\n#include <math_util.h>\n\n#include \"gfx_disk_resource.h\"\n#include \"gfx_node.h\"\n\n#include \"gfx_particle_system.h\"\n\nextern \"C\" {\n #include <lua.h>\n #include <lauxlib.h>\n #include <lualib.h>\n}\n\n\nextern fast_erase_vector<GfxNode*> gfx_all_nodes;\n\nstruct GfxCallback {\n virtual ~GfxCallback (void) { }\n virtual void clickedClose (void) = 0;\n virtual void windowResized (int width, int height) = 0;\n virtual void messageLogged (const std::string &msg) = 0;\n};\n\n\n/** Are we in Direct3D, driven by environment var.\n * \n * Can be used in static scope (i.e. to initialise globals before main().\n */\nbool gfx_d3d9 (void);\nbool gfx_gl3 (void);\n\nsize_t gfx_init (GfxCallback &cb);\n\nvoid gfx_window_events_pump (void);\n\nvoid gfx_render (float elapsed, const Vector3 &cam_pos, const Quaternion &cam_dir);\n\nvoid gfx_screenshot (const std::string &filename);\n\nvoid gfx_bake_env_cube (const std::string &filename, unsigned size, const Vector3 &cam_pos, float saturation, const Vector3 &ambient);\n\n\n// lighting parameters\nGfxEnvCubeDiskResource *gfx_env_cube (unsigned i);\nvoid gfx_env_cube (unsigned i, const DiskResourcePtr<GfxEnvCubeDiskResource> &v);\nfloat gfx_env_cube_cross_fade (void);\nvoid gfx_env_cube_cross_fade (float);\n\nGfxTextureDiskResource *gfx_shadow_pcf_noise_map (void);\nvoid gfx_shadow_pcf_noise_map (const DiskResourcePtr<GfxTextureDiskResource> &v);\nGfxTextureDiskResource *gfx_fade_dither_map (void);\nvoid gfx_fade_dither_map (const DiskResourcePtr<GfxTextureDiskResource> &v);\nGfxTextureDiskResource *gfx_corona_map (void);\nvoid gfx_corona_map (const DiskResourcePtr<GfxTextureDiskResource> &v);\n\n\nVector3 gfx_particle_ambient (void);\nvoid gfx_particle_ambient (const Vector3 &v);\n\nVector3 gfx_sunlight_diffuse (void);\nvoid gfx_sunlight_diffuse (const Vector3 &v);\n\nVector3 gfx_sunlight_specular (void);\nvoid gfx_sunlight_specular (const Vector3 &v);\n\nVector3 gfx_sunlight_direction (void);\nvoid gfx_sunlight_direction (const Vector3 &v);\n\n\n// fog\nVector3 gfx_fog_colour (void);\nvoid gfx_fog_colour (const Vector3 &v);\n\nfloat gfx_fog_density (void);\nvoid gfx_fog_density (float v);\n\n\n// sun (as it appears as a disc in the sky)\nVector3 gfx_sun_direction (void);\nvoid gfx_sun_direction (const Vector3 &v);\n\nVector3 gfx_sun_colour (void);\nvoid gfx_sun_colour (const Vector3 &v);\n\nfloat gfx_sun_alpha (void);\nvoid gfx_sun_alpha (float v);\n\nfloat gfx_sun_size (void);\nvoid gfx_sun_size (float v);\n\nfloat gfx_sun_falloff_distance (void);\nvoid gfx_sun_falloff_distance (float v);\n\n\n// sky\nfloat gfx_sky_glare_sun_distance (void);\nvoid gfx_sky_glare_sun_distance (float v);\n\nfloat gfx_sky_glare_horizon_elevation (void);\nvoid gfx_sky_glare_horizon_elevation (float v);\n\nfloat gfx_sky_divider (unsigned i);\nvoid gfx_sky_divider (unsigned i, float v);\n\nVector3 gfx_sky_colour (unsigned i);\nvoid gfx_sky_colour (unsigned i, const Vector3 &v);\n\nVector3 gfx_sky_sun_colour (unsigned i);\nvoid gfx_sky_sun_colour (unsigned i, const Vector3 &v);\n\nfloat gfx_sky_alpha (unsigned i);\nvoid gfx_sky_alpha (unsigned i, float v);\n\nfloat gfx_sky_sun_alpha (unsigned i);\nvoid gfx_sky_sun_alpha (unsigned i, float v);\n\nVector3 gfx_sky_cloud_colour (void);\nvoid gfx_sky_cloud_colour (const Vector3 &v);\n\nfloat gfx_sky_cloud_coverage (void);\nvoid gfx_sky_cloud_coverage (float v);\n\nVector3 gfx_hell_colour (void);\nvoid gfx_hell_colour (const Vector3 &v);\n\n\n// tone mapping\nGfxColourGradeLUTDiskResource *gfx_colour_grade (void);\nvoid gfx_colour_grade (const DiskResourcePtr<GfxColourGradeLUTDiskResource> &v);\n\nfloat gfx_global_saturation (void);\nvoid gfx_global_saturation (float);\n\nfloat gfx_global_exposure (void);\nvoid gfx_global_exposure (float);\n\n\nstruct GfxLastRenderStats {\n float batches;\n float triangles;\n float micros;\n GfxLastRenderStats (const GfxLastRenderStats &o)\n : batches(o.batches), triangles(o.triangles), micros(o.micros) { }\n GfxLastRenderStats (void) : batches(0), triangles(0), micros(0) { }\n GfxLastRenderStats &operator+= (const GfxLastRenderStats &o) {\n batches += o.batches; triangles += o.triangles; micros += o.micros;\n return *this;\n }\n GfxLastRenderStats &operator/= (float time) {\n batches /= time; triangles /= time; micros /= time;\n return *this;\n }\n};\n\nstruct GfxLastFrameStats {\n GfxLastRenderStats shadow[3];\n GfxLastRenderStats left_gbuffer;\n GfxLastRenderStats left_deferred;\n GfxLastRenderStats right_gbuffer;\n GfxLastRenderStats right_deferred;\n GfxLastRenderStats hud;\n};\n\nstruct GfxRunningFrameStats {\n GfxLastFrameStats min;\n GfxLastFrameStats avg;\n GfxLastFrameStats max;\n};\n\nGfxLastFrameStats gfx_last_frame_stats (void);\nGfxRunningFrameStats gfx_running_frame_stats (void);\n\nenum GfxMaterialType {\n GFX_MATERIAL,\n GFX_SKY_MATERIAL\n};\n\nGfxMaterialType gfx_material_type (const std::string &name);\n\nbool gfx_material_has_any (const std::string &name);\n\n\nvoid gfx_shutdown_lua (lua_State *L);\n\nvoid gfx_shutdown (void);\n\nVector3 gfx_colour_grade_look_up (const Vector3 &v);\n\nbool gfx_window_active (void);\nVector2 gfx_window_size (void);\nVector2 gfx_window_size_in_scene (void);\nVector3 gfx_world_to_screen (const Vector3 &cam_pos, const Quaternion &cam_dir, const Vector3 &p);\nVector3 gfx_screen_to_world (const Vector3 &cam_pos, const Quaternion &cam_dir, const Vector2 &p);\n\n// FIXME: everything below here is a horrible hack\nextern Ogre::Root *ogre_root; // FIXME: hack\nextern Ogre::OctreeSceneManager *ogre_sm; // FIXME: hack\nextern Ogre::RenderWindow *ogre_win; // FIXME: hack\n\n\nstatic inline Ogre::Vector2 to_ogre (const Vector2 &v)\n{ return Ogre::Vector2(v.x, v.y); }\nstatic inline Ogre::Vector3 to_ogre (const Vector3 &v)\n{ return Ogre::Vector3(v.x, v.y, v.z); }\nstatic inline Ogre::Vector4 to_ogre (const Vector4 &v)\n{ return Ogre::Vector4(v.x, v.y, v.z, v.w); }\nstatic inline Ogre::Quaternion to_ogre (const Quaternion &v)\n{ return Ogre::Quaternion(v.w, v.x, v.y, v.z); }\nstatic inline Ogre::ColourValue to_ogre_cv (const Vector3 &v)\n{ return Ogre::ColourValue(v.x, v.y, v.z); }\nstatic inline Ogre::Degree to_ogre (const Degree &v)\n{ return Ogre::Degree(v.inDegrees()); }\nstatic inline Ogre::Radian to_ogre (const Radian &v)\n{ return Ogre::Degree(v.inRadians()); }\n\nstatic inline Vector3 from_ogre (const Ogre::Vector3 &v)\n{ return Vector3(v.x,v.y,v.z); }\nstatic inline Quaternion from_ogre (const Ogre::Quaternion &v)\n{ return Quaternion(v.w,v.x,v.y,v.z); }\nstatic inline Vector3 from_ogre_cv (const Ogre::ColourValue &v)\n{ return Vector3(v.r, v.g, v.b); }\nstatic inline Degree from_ogre (const Ogre::Degree &v)\n{ return Degree(v.valueDegrees()); }\nstatic inline Radian from_ogre (const Ogre::Radian &v)\n{ return Radian(v.valueRadians()); }\n\n#endif \n" }, { "alpha_fraction": 0.5130771994590759, "alphanum_fraction": 0.5663851499557495, "avg_line_length": 29.848520278930664, "blob_id": "5aa75b60c320bac1b31d028d3ad58e42dfe739f9", "content_id": "2441b04589c1042536d04d30a08cca8da28c0dd9", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 454341, "license_type": "permissive", "max_line_length": 581, "num_lines": 14728, "path": "/engine/physics/tcol_lexer-core-engine.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": " /* Information about what pattern 'comes' from what mode in the inheritance tree.\n * \n * [1] pattern, [2] dominating mode, [3] dominating inheritance level, [4] pattern index\n * \n * (COMMENT)\n * \\\"* /\\\" COMMENT 0 00308\n * \\\"//\\\"[^\\n]* COMMENT 0 00318\n * .|\\n COMMENT 0 00329\n * \n * \n * (MAIN)\n * [ \\t\\r\\n\\v]+ MAIN 0 00005\n * \\\"//\\\"[^\\n]* MAIN 0 00014\n * \\\"/ *\\\" MAIN 0 00016\n * \\\"TCOL1.0\\\" MAIN 0 00019\n * \\\"attributes\\\" MAIN 0 00022\n * \\\"static\\\" MAIN 0 00025\n * \\\"mass\\\" MAIN 0 00028\n * \\\"inertia\\\" MAIN 0 00031\n * \\\"friction\\\" MAIN 0 00034\n * \\\"restitution\\\" MAIN 0 00037\n * \\\"linear_damping\\\" MAIN 0 00040\n * \\\"angular_damping\\\" MAIN 0 00043\n * \\\"linear_sleep_threshold\\\" MAIN 0 00046\n * \\\"angular_sleep_threshold\\\" MAIN 0 00049\n * \\\"ccd_motion_threshold\\\" MAIN 0 00052\n * \\\"ccd_swept_sphere_radius\\\" MAIN 0 00055\n * \\\"margin\\\" MAIN 0 00058\n * \\\"material\\\" MAIN 0 00061\n * \\\"shrink\\\" MAIN 0 00064\n * \\\"center\\\"|\\\"centre\\\" MAIN 0 00076\n * \\\"normal\\\" MAIN 0 00078\n * \\\"orientation\\\" MAIN 0 00081\n * \\\"dimensions\\\" MAIN 0 00084\n * \\\"radius\\\" MAIN 0 00087\n * \\\"height\\\" MAIN 0 00090\n * \\\"distance\\\" MAIN 0 00093\n * \\\"vertexes\\\"|\\\"vertices\\\" MAIN 0 00105\n * \\\"faces\\\" MAIN 0 00107\n * \\\"max_edge_angle_threshold\\\" MAIN 0 00110\n * \\\"edge_distance_threshold\\\" MAIN 0 00113\n * \\\"compound\\\" MAIN 0 00116\n * \\\"hull\\\" MAIN 0 00119\n * \\\"box\\\" MAIN 0 00122\n * \\\"cylinder\\\" MAIN 0 00125\n * \\\"cone\\\" MAIN 0 00128\n * \\\"sphere\\\" MAIN 0 00131\n * \\\"plane\\\" MAIN 0 00134\n * \\\"capsule\\\" MAIN 0 00137\n * \\\"multisphere\\\" MAIN 0 00140\n * \\\"trimesh\\\" MAIN 0 00143\n * \\\";\\\" MAIN 0 00146\n * \\\"{\\\" MAIN 0 00149\n * \\\"}\\\" MAIN 0 00152\n * \\\"\\\\\"\\\"[^\\\\\"]*\\\"\\\\\"\\\" MAIN 0 00167\n * 0|[1-9][0-9]* MAIN 0 00183\n * (\\\"-\\\"|\\\"+\\\")?(0|[1-9][0-9]*|[0-9]+\\\".\\\"[0-9]*|[0-9]*\\\".\\\"[0-9]+)([Ee](\\\"-\\\"|\\\"+\\\")?[0-9]+)? MAIN 0 00291\n * \\\"0x\\\"[0-9A-Za-z]+ MAIN 0 00302\n * . MAIN 0 00305\n * \n * \n * \n */\n#include \"tcol_lexer\"\n#if ! defined(__QUEX_SETTING_PLAIN_C)\nnamespace quex {\n#endif\n#define QUEX_LEXER_CLASS tcol_lexer\n\n#include <quex/code_base/template/Analyser>\n#include <quex/code_base/buffer/Buffer>\n\n#ifdef CONTINUE\n# undef CONTINUE\n#endif\n#define CONTINUE goto __REENTRY_PREPARATION;\n#include <quex/code_base/temporary_macros_on>\n\n__QUEX_SETTING_ANALYSER_FUNCTION_RETURN_TYPE \ntcol_lexer_COMMENT_analyser_function(QuexAnalyser* me) \n{\n /* NOTE: Different modes correspond to different analyser functions. The analyser*/\n /* functions are all located inside the main class as static functions. That*/\n /* means, they are something like 'globals'. They receive a pointer to the */\n /* lexical analyser, since static member do not have access to the 'this' pointer.*/\n# if defined (__QUEX_SETTING_PLAIN_C)\n# define self (*me)\n# else\n using namespace quex;\n QUEX_LEXER_CLASS& self = *((QUEX_LEXER_CLASS*)me);\n# endif\n /* me = pointer to state of the lexical analyser */\n quex::QuexMode& COMMENT = QUEX_LEXER_CLASS::COMMENT;\n quex::QuexMode& MAIN = QUEX_LEXER_CLASS::MAIN;\n QUEX_GOTO_LABEL_TYPE last_acceptance = QUEX_GOTO_TERMINAL_LABEL_INIT_VALUE;\n QUEX_CHARACTER_POSITION_TYPE last_acceptance_input_position = (QUEX_CHARACTER_TYPE*)(0x00);\n QUEX_CHARACTER_POSITION_TYPE* post_context_start_position = 0x0;\n const size_t PostContextStartPositionN = (size_t)0;\n QUEX_CHARACTER_TYPE input = (QUEX_CHARACTER_TYPE)(0x00);\n\n /* Post context positions do not have to be reset or initialized. If a state\n * is reached which is associated with 'end of post context' it is clear what\n * post context is meant. This results from the ways the state machine is \n * constructed. A post context positions live time looks like the following:\n *\n * (1) unitialized (don't care)\n * (1.b) on buffer reload it may, or may not be adapted (don't care)\n * (2) when a post context begin state is passed, the it is **SET** (now: take care)\n * (2.b) on buffer reload it **is adapted**.\n * (3) when a terminal state of the post context is reached (which can only be reached\n * for that particular post context, then the post context position is used\n * to reset the input position. */\n#if defined(QUEX_OPTION_AUTOMATIC_ANALYSIS_CONTINUATION_ON_MODE_CHANGE) \\\n || defined(QUEX_OPTION_ASSERTS)\n me->DEBUG_analyser_function_at_entry = me->current_analyser_function;\n#endif\n__REENTRY:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: __REENTRY\");\n QuexBuffer_mark_lexeme_start(&me->buffer);\n QuexBuffer_undo_terminating_zero_for_lexeme(&me->buffer);\n /* state machine */\n /* init-state = 1911L\n * 01911() <~ (308, 1840), (318, 1867), (329, 1889)\n * == [\\1, ')'], ['+', '.'], ['0', oo] ==> 01912\n * == '*' ==> 01913\n * == '/' ==> 01914\n * <no epsilon>\n * 01912(A, S) <~ (329, 1890, A, S)\n * <no epsilon>\n * 01913(A, S) <~ (329, 1890, A, S), (308, 1841)\n * == '/' ==> 01916\n * <no epsilon>\n * 01916(A, S) <~ (308, 1842, A, S)\n * <no epsilon>\n * 01914(A, S) <~ (329, 1890, A, S), (318, 1865)\n * == '/' ==> 01915\n * <no epsilon>\n * 01915(A, S) <~ (318, 1866, A, S)\n * == [\\1, '\\t'], [\\11, oo] ==> 01915\n * <no epsilon>\n * \n */\nSTATE_1911:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_1911\");\n\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 43) {\n if( input < 1) {\n goto STATE_1911_DROP_OUT; /* [-oo, \\0] */\n } else {\n if( input != 42) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_329_DIRECT; /* [\\1, ')'] */\n } else {\n goto STATE_1913; /* '*' */\n }\n }\n } else {\n if( input == 47) {\n goto STATE_1914; /* '/' */\n } else {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_329_DIRECT; /* ['+', '.'] */\n }\n }\n\nSTATE_1911_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_1911_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_1911_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_1911_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n if( QuexBuffer_is_end_of_file(&me->buffer) ) {\n /* NO CHECK 'last_acceptance != -1' --- first state can **never** be an acceptance state */\n goto TERMINAL_END_OF_STREAM;\n }\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_1911_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\nSTATE_1911_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_1911_INPUT\");\n QuexBuffer_input_p_increment(&me->buffer);\n goto STATE_1911;\nSTATE_1913:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_1913\");\n\nSTATE_1913_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_1913_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 47) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_308_DIRECT; /* '/' */\n } else {\n goto STATE_1913_DROP_OUT; /* [-oo, '.'] */\n }\n\nSTATE_1913_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_1913_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_1913_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_1913_DROP_OUT_DIRECT\");\n goto TERMINAL_329_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"329\");\n QUEX_SET_last_acceptance(329);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_1913_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_1914:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_1914\");\n\nSTATE_1914_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_1914_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 47) {\n goto STATE_1915; /* '/' */\n } else {\n goto STATE_1914_DROP_OUT; /* [-oo, '.'] */\n }\n\nSTATE_1914_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_1914_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_1914_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_1914_DROP_OUT_DIRECT\");\n goto TERMINAL_329_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"329\");\n QUEX_SET_last_acceptance(329);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_1914_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_1915:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_1915\");\n\nSTATE_1915_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_1915_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 10) {\n if( input < 1) {\n goto STATE_1915_DROP_OUT; /* [-oo, \\0] */\n } else {\n goto STATE_1915; /* [\\1, '\\t'] */\n }\n } else {\n if( input == 10) {\n goto STATE_1915_DROP_OUT_DIRECT; /* '\\n' */\n } else {\n goto STATE_1915; /* [\\11, oo] */\n }\n }\n\nSTATE_1915_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_1915_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_1915_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_1915_DROP_OUT_DIRECT\");\n goto TERMINAL_318_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"318\");\n QUEX_SET_last_acceptance(318);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_1915_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\n\n /* (*) Terminal states _______________________________________________________*/\n /**/\n /* Acceptance terminal states, i.e. the 'winner patterns'. This means*/\n /* that the last input dropped out of a state where the longest matching*/\n /* pattern was according to the terminal state. The terminal states are */\n /* numbered after the pattern id.*/\n /**/\n#define Lexeme (me->buffer._lexeme_start_p)\n#define LexemeBegin (me->buffer._lexeme_start_p)\n#define LexemeEnd (me->buffer._input_p)\n#define LexemeL (size_t)(me->buffer._input_p - me->buffer._lexeme_start_p)\nTERMINAL_329:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_329\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_329_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_329_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count(Lexeme, LexemeEnd);\n \n #line 135 \"tcol_lexer.qx\"\n \n#line 344 \"tcol_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_308:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_308\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_308_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_308_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(2);\n \n #line 133 \"tcol_lexer.qx\"\n self << MAIN; \n#line 366 \"tcol_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_318:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_318\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_318_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_318_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(LexemeL);\n \n #line 134 \"tcol_lexer.qx\"\n \n#line 388 \"tcol_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\n\n\nTERMINAL_END_OF_STREAM:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_END_OF_STREAM\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.send(QUEX_TKN_TERMINATION);\n #ifdef __QUEX_OPTION_ANALYSER_RETURN_TYPE_IS_VOID\n return /*__QUEX_TOKEN_ID_TERMINATION*/;\n #else\n return __QUEX_TOKEN_ID_TERMINATION;\n #endif\n \n }\n }\n\n#ifdef __QUEX_OPTION_ANALYSER_RETURN_TYPE_IS_VOID\n return /*__QUEX_TOKEN_ID_TERMINATION*/;\n#else\n return __QUEX_TOKEN_ID_TERMINATION;\n#endif\n\nTERMINAL_DEFAULT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_DEFAULT\");\n\nme->buffer._input_p = me->buffer._lexeme_start_p;\nif( QuexBuffer_is_end_of_file(&me->buffer) ) {\n\n /* Next increment will stop on EOF character. */\n}\n\nelse {\n /* Step over nomatching character */\n QuexBuffer_input_p_increment(&me->buffer);\n}\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count(Lexeme, LexemeEnd);\n self.send(QUEX_TKN_TERMINATION);\n #ifdef __QUEX_OPTION_ANALYSER_RETURN_TYPE_IS_VOID\n return /*__QUEX_TOKEN_ID_TERMINATION*/;\n #else\n return __QUEX_TOKEN_ID_TERMINATION;\n #endif\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\n#undef Lexeme\n#undef LexemeBegin\n#undef LexemeEnd\n#undef LexemeL\n#ifndef __QUEX_OPTION_USE_COMPUTED_GOTOS\n__TERMINAL_ROUTER: {\n /* if last_acceptance => goto correspondent acceptance terminal state*/\n /* else => execute defaul action*/\n switch( last_acceptance ) {\n case 329: goto TERMINAL_329;\n case 308: goto TERMINAL_308;\n case 318: goto TERMINAL_318;\n\n default: goto TERMINAL_DEFAULT;; /* nothing matched */\n }\n }\n#endif /* __QUEX_OPTION_USE_COMPUTED_GOTOS */\n\n \n__REENTRY_PREPARATION:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: __REENTRY_PREPARATION\");\n\n /* (*) Common point for **restarting** lexical analysis.\n * at each time when CONTINUE is called at the end of a pattern. */\n last_acceptance = QUEX_GOTO_TERMINAL_LABEL_INIT_VALUE;\n\n\n /* Post context positions do not have to be reset or initialized. If a state\n * is reached which is associated with 'end of post context' it is clear what\n * post context is meant. This results from the ways the state machine is \n * constructed. A post context positions live time looks like the following:\n *\n * (1) unitialized (don't care)\n * (1.b) on buffer reload it may, or may not be adapted (don't care)\n * (2) when a post context begin state is passed, the it is **SET** (now: take care)\n * (2.b) on buffer reload it **is adapted**.\n * (3) when a terminal state of the post context is reached (which can only be reached\n * for that particular post context, then the post context position is used\n * to reset the input position. */\n\n /* If a mode change happened, then the function must first return and\n * indicate that another mode function is to be called. At this point, \n * we to force a 'return' on a mode change. \n *\n * Pseudo Code: if( previous_mode != current_mode ) {\n * return 0;\n * }\n *\n * When the analyzer returns, the caller function has to watch if a mode change\n * occured. If not it can call this function again. */\n#if defined(QUEX_OPTION_AUTOMATIC_ANALYSIS_CONTINUATION_ON_MODE_CHANGE) || defined(QUEX_OPTION_ASSERTS)\n if( me->DEBUG_analyser_function_at_entry != me->current_analyser_function ) \n#endif\n { \n#if defined(QUEX_OPTION_AUTOMATIC_ANALYSIS_CONTINUATION_ON_MODE_CHANGE)\n# ifdef __QUEX_OPTION_ANALYSER_RETURN_TYPE_IS_VOID\n return /*__QUEX_TOKEN_ID_UNINITIALIZED*/;\n# else\n return __QUEX_TOKEN_ID_UNINITIALIZED;\n# endif\n#elif defined(QUEX_OPTION_ASSERTS)\n QUEX_ERROR_EXIT(\"Mode change without immediate return from the lexical analyser.\");\n#endif\n }\n\n goto __REENTRY;\n\n /* prevent compiler warning 'unused variable': use variables once in a part of the code*/\n /* that is never reached (and deleted by the compiler anyway).*/\n if( 0 == 1 ) {\n int unused = 0;\n unused = unused + COMMENT.id;\n unused = unused + MAIN.id;\n }\n}\n#include <quex/code_base/temporary_macros_off>\n\n#include <quex/code_base/template/Analyser>\n#include <quex/code_base/buffer/Buffer>\n\n#ifdef CONTINUE\n# undef CONTINUE\n#endif\n#define CONTINUE goto __REENTRY_PREPARATION;\n#include <quex/code_base/temporary_macros_on>\n\n__QUEX_SETTING_ANALYSER_FUNCTION_RETURN_TYPE \ntcol_lexer_MAIN_analyser_function(QuexAnalyser* me) \n{\n /* NOTE: Different modes correspond to different analyser functions. The analyser*/\n /* functions are all located inside the main class as static functions. That*/\n /* means, they are something like 'globals'. They receive a pointer to the */\n /* lexical analyser, since static member do not have access to the 'this' pointer.*/\n# if defined (__QUEX_SETTING_PLAIN_C)\n# define self (*me)\n# else\n using namespace quex;\n QUEX_LEXER_CLASS& self = *((QUEX_LEXER_CLASS*)me);\n# endif\n /* me = pointer to state of the lexical analyser */\n quex::QuexMode& COMMENT = QUEX_LEXER_CLASS::COMMENT;\n quex::QuexMode& MAIN = QUEX_LEXER_CLASS::MAIN;\n QUEX_GOTO_LABEL_TYPE last_acceptance = QUEX_GOTO_TERMINAL_LABEL_INIT_VALUE;\n QUEX_CHARACTER_POSITION_TYPE last_acceptance_input_position = (QUEX_CHARACTER_TYPE*)(0x00);\n QUEX_CHARACTER_POSITION_TYPE* post_context_start_position = 0x0;\n const size_t PostContextStartPositionN = (size_t)0;\n QUEX_CHARACTER_TYPE input = (QUEX_CHARACTER_TYPE)(0x00);\n\n /* Post context positions do not have to be reset or initialized. If a state\n * is reached which is associated with 'end of post context' it is clear what\n * post context is meant. This results from the ways the state machine is \n * constructed. A post context positions live time looks like the following:\n *\n * (1) unitialized (don't care)\n * (1.b) on buffer reload it may, or may not be adapted (don't care)\n * (2) when a post context begin state is passed, the it is **SET** (now: take care)\n * (2.b) on buffer reload it **is adapted**.\n * (3) when a terminal state of the post context is reached (which can only be reached\n * for that particular post context, then the post context position is used\n * to reset the input position. */\n#if defined(QUEX_OPTION_AUTOMATIC_ANALYSIS_CONTINUATION_ON_MODE_CHANGE) \\\n || defined(QUEX_OPTION_ASSERTS)\n me->DEBUG_analyser_function_at_entry = me->current_analyser_function;\n#endif\n__REENTRY:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: __REENTRY\");\n QuexBuffer_mark_lexeme_start(&me->buffer);\n QuexBuffer_undo_terminating_zero_for_lexeme(&me->buffer);\n /* state machine */\n /* init-state = 2842L\n * 02842() <~ (5, 16), (14, 42), (16, 49), (19, 68), (22, 98), (25, 123), (28, 140), (31, 161), (34, 187), (37, 220), (40, 262), (43, 309), (46, 371), (49, 442), (52, 508), (55, 577), (58, 615), (61, 640), (64, 663), (76, 739), (78, 759), (81, 790), (84, 824), (87, 849), (90, 870), (93, 895), (105, 993), (107, 1013), (110, 1069), (113, 1142), (116, 1184), (119, 1203), (122, 1216), (125, 1238), (128, 1257), (131, 1276), (134, 1295), (137, 1317), (140, 1349), (143, 1377), (146, 1389), (149, 1395), (152, 1401), (167, 1435), (183, 1471), (291, 1784), (302, 1824), (305, 1832)\n * == [\\1, \\8], \\12, [\\14, \\31], '!', ['#', '*'], ',', ':', ['<', 'S'], ['U', '`'], 'g', ['j', 'k'], 'q', 'u', ['w', 'z'], '|', ['~', oo] ==> 02782\n * == ['\\t', \\11], '\\r', ' ' ==> 02785\n * == '\"' ==> 02803\n * == '+', '-' ==> 02844\n * == '.' ==> 02790\n * == '/' ==> 02792\n * == '0' ==> 02793\n * == ['1', '9'] ==> 02804\n * == ';' ==> 02778\n * == 'T' ==> 02800\n * == 'a' ==> 02794\n * == 'b' ==> 02788\n * == 'c' ==> 02798\n * == 'd' ==> 02795\n * == 'e' ==> 02801\n * == 'f' ==> 02799\n * == 'h' ==> 02796\n * == 'i' ==> 02786\n * == 'l' ==> 02784\n * == 'm' ==> 02783\n * == 'n' ==> 02780\n * == 'o' ==> 02787\n * == 'p' ==> 02791\n * == 'r' ==> 02797\n * == 's' ==> 02779\n * == 't' ==> 02802\n * == 'v' ==> 02789\n * == '{' ==> 02781\n * == '}' ==> 02817\n * <no epsilon>\n * 02817(A, S) <~ (152, 1402, A, S)\n * <no epsilon>\n * 02844(A, S) <~ (305, 1833, A, S), (291, 1788)\n * == '.' ==> 03066\n * == '0' ==> 02848\n * == ['1', '9'] ==> 02774\n * <no epsilon>\n * 02848(A, S) <~ (291, 1787, A, S)\n * == '.' ==> 02843\n * == ['0', '9'] ==> 03058\n * == 'E', 'e' ==> 02845\n * <no epsilon>\n * 03058() <~ (291, 1789)\n * == '.' ==> 02843\n * == ['0', '9'] ==> 03058\n * <no epsilon>\n * 02843(A, S) <~ (291, 1791, A, S)\n * == ['0', '9'] ==> 02843\n * == 'E', 'e' ==> 02845\n * <no epsilon>\n * 02845() <~ (291, 1790)\n * == '+', '-' ==> 02847\n * == ['0', '9'] ==> 02846\n * <no epsilon>\n * 02846(A, S) <~ (291, 1792, A, S)\n * == ['0', '9'] ==> 02846\n * <no epsilon>\n * 02847() <~ (291, 1793)\n * == ['0', '9'] ==> 02846\n * <no epsilon>\n * 03066() <~ (291, 1786)\n * == ['0', '9'] ==> 02843\n * <no epsilon>\n * 02774(A, S) <~ (291, 1785, A, S)\n * == '.' ==> 02843\n * == ['0', '9'] ==> 02774\n * == 'E', 'e' ==> 02845\n * <no epsilon>\n * 02778(A, S) <~ (146, 1390, A, S)\n * <no epsilon>\n * 02779(A, S) <~ (305, 1833, A, S), (25, 124), (64, 664), (131, 1277)\n * == 'h' ==> 02918\n * == 'p' ==> 02926\n * == 't' ==> 02931\n * <no epsilon>\n * 02931() <~ (25, 125)\n * == 'a' ==> 02936\n * <no epsilon>\n * 02936() <~ (25, 126)\n * == 't' ==> 02935\n * <no epsilon>\n * 02935() <~ (25, 127)\n * == 'i' ==> 02934\n * <no epsilon>\n * 02934() <~ (25, 128)\n * == 'c' ==> 02838\n * <no epsilon>\n * 02838(A, S) <~ (25, 129, A, S)\n * <no epsilon>\n * 02926() <~ (131, 1278)\n * == 'h' ==> 02925\n * <no epsilon>\n * 02925() <~ (131, 1279)\n * == 'e' ==> 02924\n * <no epsilon>\n * 02924() <~ (131, 1280)\n * == 'r' ==> 02923\n * <no epsilon>\n * 02923() <~ (131, 1281)\n * == 'e' ==> 02773\n * <no epsilon>\n * 02773(A, S) <~ (131, 1282, A, S)\n * <no epsilon>\n * 02918() <~ (64, 665)\n * == 'r' ==> 02929\n * <no epsilon>\n * 02929() <~ (64, 666)\n * == 'i' ==> 02928\n * <no epsilon>\n * 02928() <~ (64, 667)\n * == 'n' ==> 02927\n * <no epsilon>\n * 02927() <~ (64, 668)\n * == 'k' ==> 02807\n * <no epsilon>\n * 02807(A, S) <~ (64, 669, A, S)\n * <no epsilon>\n * 02780(A, S) <~ (305, 1833, A, S), (78, 760)\n * == 'o' ==> 03124\n * <no epsilon>\n * 03124() <~ (78, 761)\n * == 'r' ==> 02851\n * <no epsilon>\n * 02851() <~ (78, 762)\n * == 'm' ==> 02979\n * <no epsilon>\n * 02979() <~ (78, 763)\n * == 'a' ==> 02771\n * <no epsilon>\n * 02771() <~ (78, 764)\n * == 'l' ==> 02836\n * <no epsilon>\n * 02836(A, S) <~ (78, 765, A, S)\n * <no epsilon>\n * 02781(A, S) <~ (149, 1396, A, S)\n * <no epsilon>\n * 02782(A, S) <~ (305, 1833, A, S)\n * <no epsilon>\n * 02783(A, S) <~ (305, 1833, A, S), (28, 141), (58, 616), (61, 641), (110, 1070), (140, 1350)\n * == 'a' ==> 03095\n * == 'u' ==> 03099\n * <no epsilon>\n * 03099() <~ (140, 1351)\n * == 'l' ==> 03097\n * <no epsilon>\n * 03097() <~ (140, 1352)\n * == 't' ==> 02858\n * <no epsilon>\n * 02858() <~ (140, 1353)\n * == 'i' ==> 02857\n * <no epsilon>\n * 02857() <~ (140, 1354)\n * == 's' ==> 03100\n * <no epsilon>\n * 03100() <~ (140, 1355)\n * == 'p' ==> 02922\n * <no epsilon>\n * 02922() <~ (140, 1356)\n * == 'h' ==> 02921\n * <no epsilon>\n * 02921() <~ (140, 1357)\n * == 'e' ==> 02920\n * <no epsilon>\n * 02920() <~ (140, 1358)\n * == 'r' ==> 03104\n * <no epsilon>\n * 03104() <~ (140, 1359)\n * == 'e' ==> 02830\n * <no epsilon>\n * 02830(A, S) <~ (140, 1360, A, S)\n * <no epsilon>\n * 03095() <~ (28, 142), (58, 617), (61, 642), (110, 1071)\n * == 'r' ==> 03108\n * == 's' ==> 03106\n * == 't' ==> 03116\n * == 'x' ==> 03109\n * <no epsilon>\n * 03116() <~ (61, 643)\n * == 'e' ==> 03115\n * <no epsilon>\n * 03115() <~ (61, 644)\n * == 'r' ==> 02870\n * <no epsilon>\n * 02870() <~ (61, 645)\n * == 'i' ==> 03118\n * <no epsilon>\n * 03118() <~ (61, 646)\n * == 'a' ==> 03117\n * <no epsilon>\n * 03117() <~ (61, 647)\n * == 'l' ==> 02831\n * <no epsilon>\n * 02831(A, S) <~ (61, 648, A, S)\n * <no epsilon>\n * 03106() <~ (28, 143)\n * == 's' ==> 02832\n * <no epsilon>\n * 02832(A, S) <~ (28, 144, A, S)\n * <no epsilon>\n * 03108() <~ (58, 618)\n * == 'g' ==> 03120\n * <no epsilon>\n * 03120() <~ (58, 619)\n * == 'i' ==> 03119\n * <no epsilon>\n * 03119() <~ (58, 620)\n * == 'n' ==> 02776\n * <no epsilon>\n * 02776(A, S) <~ (58, 621, A, S)\n * <no epsilon>\n * 03109() <~ (110, 1072)\n * == '_' ==> 02885\n * <no epsilon>\n * 02885() <~ (110, 1073)\n * == 'e' ==> 03110\n * <no epsilon>\n * 03110() <~ (110, 1074)\n * == 'd' ==> 02863\n * <no epsilon>\n * 02863() <~ (110, 1075)\n * == 'g' ==> 02865\n * <no epsilon>\n * 02865() <~ (110, 1076)\n * == 'e' ==> 02864\n * <no epsilon>\n * 02864() <~ (110, 1077)\n * == '_' ==> 02884\n * <no epsilon>\n * 02884() <~ (110, 1078)\n * == 'a' ==> 02883\n * <no epsilon>\n * 02883() <~ (110, 1079)\n * == 'n' ==> 03112\n * <no epsilon>\n * 03112() <~ (110, 1080)\n * == 'g' ==> 03113\n * <no epsilon>\n * 03113() <~ (110, 1081)\n * == 'l' ==> 02875\n * <no epsilon>\n * 02875() <~ (110, 1082)\n * == 'e' ==> 02874\n * <no epsilon>\n * 02874() <~ (110, 1083)\n * == '_' ==> 02894\n * <no epsilon>\n * 02894() <~ (110, 1084)\n * == 't' ==> 02896\n * <no epsilon>\n * 02896() <~ (110, 1085)\n * == 'h' ==> 02895\n * <no epsilon>\n * 02895() <~ (110, 1086)\n * == 'r' ==> 02859\n * <no epsilon>\n * 02859() <~ (110, 1087)\n * == 'e' ==> 02893\n * <no epsilon>\n * 02893() <~ (110, 1088)\n * == 's' ==> 02899\n * <no epsilon>\n * 02899() <~ (110, 1089)\n * == 'h' ==> 02901\n * <no epsilon>\n * 02901() <~ (110, 1090)\n * == 'o' ==> 02900\n * <no epsilon>\n * 02900() <~ (110, 1091)\n * == 'l' ==> 03114\n * <no epsilon>\n * 03114() <~ (110, 1092)\n * == 'd' ==> 02839\n * <no epsilon>\n * 02839(A, S) <~ (110, 1093, A, S)\n * <no epsilon>\n * 02784(A, S) <~ (305, 1833, A, S), (40, 263), (46, 372)\n * == 'i' ==> 03089\n * <no epsilon>\n * 03089() <~ (40, 264), (46, 373)\n * == 'n' ==> 02856\n * <no epsilon>\n * 02856() <~ (40, 265), (46, 374)\n * == 'e' ==> 03036\n * <no epsilon>\n * 03036() <~ (40, 266), (46, 375)\n * == 'a' ==> 03035\n * <no epsilon>\n * 03035() <~ (40, 267), (46, 376)\n * == 'r' ==> 02879\n * <no epsilon>\n * 02879() <~ (40, 268), (46, 377)\n * == '_' ==> 03037\n * <no epsilon>\n * 03037() <~ (40, 269), (46, 378)\n * == 'd' ==> 03039\n * == 's' ==> 03038\n * <no epsilon>\n * 03038() <~ (46, 379)\n * == 'l' ==> 02853\n * <no epsilon>\n * 02853() <~ (46, 380)\n * == 'e' ==> 03047\n * <no epsilon>\n * 03047() <~ (46, 381)\n * == 'e' ==> 03045\n * <no epsilon>\n * 03045() <~ (46, 382)\n * == 'p' ==> 03107\n * <no epsilon>\n * 03107() <~ (46, 383)\n * == '_' ==> 03105\n * <no epsilon>\n * 03105() <~ (46, 384)\n * == 't' ==> 03103\n * <no epsilon>\n * 03103() <~ (46, 385)\n * == 'h' ==> 03102\n * <no epsilon>\n * 03102() <~ (46, 386)\n * == 'r' ==> 03101\n * <no epsilon>\n * 03101() <~ (46, 387)\n * == 'e' ==> 03098\n * <no epsilon>\n * 03098() <~ (46, 388)\n * == 's' ==> 03096\n * <no epsilon>\n * 03096() <~ (46, 389)\n * == 'h' ==> 03094\n * <no epsilon>\n * 03094() <~ (46, 390)\n * == 'o' ==> 03093\n * <no epsilon>\n * 03093() <~ (46, 391)\n * == 'l' ==> 03092\n * <no epsilon>\n * 03092() <~ (46, 392)\n * == 'd' ==> 02829\n * <no epsilon>\n * 02829(A, S) <~ (46, 393, A, S)\n * <no epsilon>\n * 03039() <~ (40, 270)\n * == 'a' ==> 02877\n * <no epsilon>\n * 02877() <~ (40, 271)\n * == 'm' ==> 03040\n * <no epsilon>\n * 03040() <~ (40, 272)\n * == 'p' ==> 02887\n * <no epsilon>\n * 02887() <~ (40, 273)\n * == 'i' ==> 03091\n * <no epsilon>\n * 03091() <~ (40, 274)\n * == 'n' ==> 03090\n * <no epsilon>\n * 03090() <~ (40, 275)\n * == 'g' ==> 02828\n * <no epsilon>\n * 02828(A, S) <~ (40, 276, A, S)\n * <no epsilon>\n * 02785(A, S) <~ (5, 17, A, S)\n * == ['\\t', \\11], '\\r', ' ' ==> 02785\n * <no epsilon>\n * 02786(A, S) <~ (305, 1833, A, S), (31, 162)\n * == 'n' ==> 02933\n * <no epsilon>\n * 02933() <~ (31, 163)\n * == 'e' ==> 02932\n * <no epsilon>\n * 02932() <~ (31, 164)\n * == 'r' ==> 02930\n * <no epsilon>\n * 02930() <~ (31, 165)\n * == 't' ==> 03087\n * <no epsilon>\n * 03087() <~ (31, 166)\n * == 'i' ==> 03085\n * <no epsilon>\n * 03085() <~ (31, 167)\n * == 'a' ==> 02827\n * <no epsilon>\n * 02827(A, S) <~ (31, 168, A, S)\n * <no epsilon>\n * 02787(A, S) <~ (305, 1833, A, S), (81, 791)\n * == 'r' ==> 02850\n * <no epsilon>\n * 02850() <~ (81, 792)\n * == 'i' ==> 03082\n * <no epsilon>\n * 03082() <~ (81, 793)\n * == 'e' ==> 03081\n * <no epsilon>\n * 03081() <~ (81, 794)\n * == 'n' ==> 02881\n * <no epsilon>\n * 02881() <~ (81, 795)\n * == 't' ==> 02876\n * <no epsilon>\n * 02876() <~ (81, 796)\n * == 'a' ==> 03088\n * <no epsilon>\n * 03088() <~ (81, 797)\n * == 't' ==> 03086\n * <no epsilon>\n * 03086() <~ (81, 798)\n * == 'i' ==> 03084\n * <no epsilon>\n * 03084() <~ (81, 799)\n * == 'o' ==> 03083\n * <no epsilon>\n * 03083() <~ (81, 800)\n * == 'n' ==> 02837\n * <no epsilon>\n * 02837(A, S) <~ (81, 801, A, S)\n * <no epsilon>\n * 02788(A, S) <~ (305, 1833, A, S), (122, 1217)\n * == 'o' ==> 03080\n * <no epsilon>\n * 03080() <~ (122, 1218)\n * == 'x' ==> 02826\n * <no epsilon>\n * 02826(A, S) <~ (122, 1219, A, S)\n * <no epsilon>\n * 02789(A, S) <~ (305, 1833, A, S), (105, 996)\n * == 'e' ==> 03068\n * <no epsilon>\n * 03068() <~ (105, 995)\n * == 'r' ==> 02869\n * <no epsilon>\n * 02869() <~ (105, 997)\n * == 't' ==> 03072\n * <no epsilon>\n * 03072() <~ (105, 998)\n * == 'e' ==> 03075\n * == 'i' ==> 03079\n * <no epsilon>\n * 03075() <~ (105, 1000)\n * == 'x' ==> 03078\n * <no epsilon>\n * 03078() <~ (105, 994)\n * == 'e' ==> 03077\n * <no epsilon>\n * 03077() <~ (105, 991)\n * == 's' ==> 02825\n * <no epsilon>\n * 02825(A, S) <~ (105, 992, A, S)\n * <no epsilon>\n * 03079() <~ (105, 999)\n * == 'c' ==> 03078\n * <no epsilon>\n * 02790(A, S) <~ (305, 1833, A, S), (291, 1786)\n * == ['0', '9'] ==> 02843\n * <no epsilon>\n * 02791(A, S) <~ (305, 1833, A, S), (134, 1296)\n * == 'l' ==> 03063\n * <no epsilon>\n * 03063() <~ (134, 1297)\n * == 'a' ==> 03062\n * <no epsilon>\n * 03062() <~ (134, 1298)\n * == 'n' ==> 03060\n * <no epsilon>\n * 03060() <~ (134, 1299)\n * == 'e' ==> 02775\n * <no epsilon>\n * 02775(A, S) <~ (134, 1300, A, S)\n * <no epsilon>\n * 02792(A, S) <~ (305, 1833, A, S), (14, 40), (16, 50)\n * == '*' ==> 02824\n * == '/' ==> 02823\n * <no epsilon>\n * 02824(A, S) <~ (16, 51, A, S)\n * <no epsilon>\n * 02823(A, S) <~ (14, 41, A, S)\n * == [\\1, '\\t'], [\\11, oo] ==> 02823\n * <no epsilon>\n * 02793(A, S) <~ (183, 1473, A, S), (302, 1825)\n * == '.' ==> 02843\n * == ['0', '9'] ==> 03058\n * == 'E', 'e' ==> 02845\n * == 'x' ==> 03053\n * <no epsilon>\n * 03053() <~ (302, 1826)\n * == ['0', '9'], ['A', 'Z'], ['a', 'z'] ==> 02822\n * <no epsilon>\n * 02822(A, S) <~ (302, 1827, A, S)\n * == ['0', '9'], ['A', 'Z'], ['a', 'z'] ==> 02822\n * <no epsilon>\n * 02794(A, S) <~ (305, 1833, A, S), (22, 99), (43, 310), (49, 443)\n * == 'n' ==> 03025\n * == 't' ==> 03027\n * <no epsilon>\n * 03025() <~ (43, 311), (49, 444)\n * == 'g' ==> 02972\n * <no epsilon>\n * 02972() <~ (43, 312), (49, 445)\n * == 'u' ==> 03034\n * <no epsilon>\n * 03034() <~ (43, 313), (49, 446)\n * == 'l' ==> 03057\n * <no epsilon>\n * 03057() <~ (43, 314), (49, 447)\n * == 'a' ==> 03056\n * <no epsilon>\n * 03056() <~ (43, 315), (49, 448)\n * == 'r' ==> 03054\n * <no epsilon>\n * 03054() <~ (43, 316), (49, 449)\n * == '_' ==> 03052\n * <no epsilon>\n * 03052() <~ (43, 317), (49, 450)\n * == 'd' ==> 03048\n * == 's' ==> 03074\n * <no epsilon>\n * 03048() <~ (43, 318)\n * == 'a' ==> 03046\n * <no epsilon>\n * 03046() <~ (43, 319)\n * == 'm' ==> 03044\n * <no epsilon>\n * 03044() <~ (43, 320)\n * == 'p' ==> 03043\n * <no epsilon>\n * 03043() <~ (43, 321)\n * == 'i' ==> 03042\n * <no epsilon>\n * 03042() <~ (43, 322)\n * == 'n' ==> 03041\n * <no epsilon>\n * 03041() <~ (43, 323)\n * == 'g' ==> 02820\n * <no epsilon>\n * 02820(A, S) <~ (43, 324, A, S)\n * <no epsilon>\n * 03074() <~ (49, 451)\n * == 'l' ==> 03073\n * <no epsilon>\n * 03073() <~ (49, 452)\n * == 'e' ==> 03071\n * <no epsilon>\n * 03071() <~ (49, 453)\n * == 'e' ==> 03070\n * <no epsilon>\n * 03070() <~ (49, 454)\n * == 'p' ==> 03069\n * <no epsilon>\n * 03069() <~ (49, 455)\n * == '_' ==> 03067\n * <no epsilon>\n * 03067() <~ (49, 456)\n * == 't' ==> 03065\n * <no epsilon>\n * 03065() <~ (49, 457)\n * == 'h' ==> 03064\n * <no epsilon>\n * 03064() <~ (49, 458)\n * == 'r' ==> 03061\n * <no epsilon>\n * 03061() <~ (49, 459)\n * == 'e' ==> 03059\n * <no epsilon>\n * 03059() <~ (49, 460)\n * == 's' ==> 03055\n * <no epsilon>\n * 03055() <~ (49, 461)\n * == 'h' ==> 03051\n * <no epsilon>\n * 03051() <~ (49, 462)\n * == 'o' ==> 03050\n * <no epsilon>\n * 03050() <~ (49, 463)\n * == 'l' ==> 03049\n * <no epsilon>\n * 03049() <~ (49, 464)\n * == 'd' ==> 02821\n * <no epsilon>\n * 02821(A, S) <~ (49, 465, A, S)\n * <no epsilon>\n * 03027() <~ (22, 100)\n * == 't' ==> 03026\n * <no epsilon>\n * 03026() <~ (22, 101)\n * == 'r' ==> 03029\n * <no epsilon>\n * 03029() <~ (22, 102)\n * == 'i' ==> 03028\n * <no epsilon>\n * 03028() <~ (22, 103)\n * == 'b' ==> 03031\n * <no epsilon>\n * 03031() <~ (22, 104)\n * == 'u' ==> 03030\n * <no epsilon>\n * 03030() <~ (22, 105)\n * == 't' ==> 03033\n * <no epsilon>\n * 03033() <~ (22, 106)\n * == 'e' ==> 03032\n * <no epsilon>\n * 03032() <~ (22, 107)\n * == 's' ==> 02819\n * <no epsilon>\n * 02819(A, S) <~ (22, 108, A, S)\n * <no epsilon>\n * 02795(A, S) <~ (305, 1833, A, S), (84, 825), (93, 896)\n * == 'i' ==> 03014\n * <no epsilon>\n * 03014() <~ (84, 826), (93, 897)\n * == 'm' ==> 02878\n * == 's' ==> 02886\n * <no epsilon>\n * 02878() <~ (84, 827)\n * == 'e' ==> 03016\n * <no epsilon>\n * 03016() <~ (84, 828)\n * == 'n' ==> 03015\n * <no epsilon>\n * 03015() <~ (84, 829)\n * == 's' ==> 03018\n * <no epsilon>\n * 03018() <~ (84, 830)\n * == 'i' ==> 03017\n * <no epsilon>\n * 03017() <~ (84, 831)\n * == 'o' ==> 03020\n * <no epsilon>\n * 03020() <~ (84, 832)\n * == 'n' ==> 03019\n * <no epsilon>\n * 03019() <~ (84, 833)\n * == 's' ==> 02835\n * <no epsilon>\n * 02835(A, S) <~ (84, 834, A, S)\n * <no epsilon>\n * 02886() <~ (93, 898)\n * == 't' ==> 03023\n * <no epsilon>\n * 03023() <~ (93, 899)\n * == 'a' ==> 03022\n * <no epsilon>\n * 03022() <~ (93, 900)\n * == 'n' ==> 03021\n * <no epsilon>\n * 03021() <~ (93, 901)\n * == 'c' ==> 03024\n * <no epsilon>\n * 03024() <~ (93, 902)\n * == 'e' ==> 02818\n * <no epsilon>\n * 02818(A, S) <~ (93, 903, A, S)\n * <no epsilon>\n * 02796(A, S) <~ (305, 1833, A, S), (90, 871), (119, 1204)\n * == 'e' ==> 03012\n * == 'u' ==> 03010\n * <no epsilon>\n * 03010() <~ (119, 1205)\n * == 'l' ==> 03009\n * <no epsilon>\n * 03009() <~ (119, 1206)\n * == 'l' ==> 02816\n * <no epsilon>\n * 02816(A, S) <~ (119, 1207, A, S)\n * <no epsilon>\n * 03012() <~ (90, 872)\n * == 'i' ==> 03011\n * <no epsilon>\n * 03011() <~ (90, 873)\n * == 'g' ==> 02892\n * <no epsilon>\n * 02892() <~ (90, 874)\n * == 'h' ==> 03013\n * <no epsilon>\n * 03013() <~ (90, 875)\n * == 't' ==> 02772\n * <no epsilon>\n * 02772(A, S) <~ (90, 876, A, S)\n * <no epsilon>\n * 02797(A, S) <~ (305, 1833, A, S), (37, 221), (87, 850)\n * == 'a' ==> 02970\n * == 'e' ==> 02997\n * <no epsilon>\n * 02970() <~ (87, 851)\n * == 'd' ==> 02974\n * <no epsilon>\n * 02974() <~ (87, 852)\n * == 'i' ==> 03007\n * <no epsilon>\n * 03007() <~ (87, 853)\n * == 'u' ==> 03004\n * <no epsilon>\n * 03004() <~ (87, 854)\n * == 's' ==> 02841\n * <no epsilon>\n * 02841(A, S) <~ (87, 855, A, S)\n * <no epsilon>\n * 02997() <~ (37, 222)\n * == 's' ==> 02996\n * <no epsilon>\n * 02996() <~ (37, 223)\n * == 't' ==> 02854\n * <no epsilon>\n * 02854() <~ (37, 224)\n * == 'i' ==> 02973\n * <no epsilon>\n * 02973() <~ (37, 225)\n * == 't' ==> 02982\n * <no epsilon>\n * 02982() <~ (37, 226)\n * == 'u' ==> 03008\n * <no epsilon>\n * 03008() <~ (37, 227)\n * == 't' ==> 03006\n * <no epsilon>\n * 03006() <~ (37, 228)\n * == 'i' ==> 03003\n * <no epsilon>\n * 03003() <~ (37, 229)\n * == 'o' ==> 03001\n * <no epsilon>\n * 03001() <~ (37, 230)\n * == 'n' ==> 02814\n * <no epsilon>\n * 02814(A, S) <~ (37, 231, A, S)\n * <no epsilon>\n * 02798(A, S) <~ (305, 1833, A, S), (52, 509), (55, 578), (76, 740), (116, 1185), (125, 1239), (128, 1258), (137, 1318)\n * == 'a' ==> 02937\n * == 'c' ==> 02938\n * == 'e' ==> 02939\n * == 'o' ==> 02941\n * == 'y' ==> 02940\n * <no epsilon>\n * 02937() <~ (137, 1319)\n * == 'p' ==> 02991\n * <no epsilon>\n * 02991() <~ (137, 1320)\n * == 's' ==> 02990\n * <no epsilon>\n * 02990() <~ (137, 1321)\n * == 'u' ==> 02995\n * <no epsilon>\n * 02995() <~ (137, 1322)\n * == 'l' ==> 02993\n * <no epsilon>\n * 02993() <~ (137, 1323)\n * == 'e' ==> 02813\n * <no epsilon>\n * 02813(A, S) <~ (137, 1324, A, S)\n * <no epsilon>\n * 02938() <~ (52, 510), (55, 579)\n * == 'd' ==> 02958\n * <no epsilon>\n * 02958() <~ (52, 511), (55, 580)\n * == '_' ==> 02957\n * <no epsilon>\n * 02957() <~ (52, 512), (55, 581)\n * == 'm' ==> 02980\n * == 's' ==> 02959\n * <no epsilon>\n * 02980() <~ (52, 513)\n * == 'o' ==> 02989\n * <no epsilon>\n * 02989() <~ (52, 514)\n * == 't' ==> 02986\n * <no epsilon>\n * 02986() <~ (52, 515)\n * == 'i' ==> 02984\n * <no epsilon>\n * 02984() <~ (52, 516)\n * == 'o' ==> 02983\n * <no epsilon>\n * 02983() <~ (52, 517)\n * == 'n' ==> 03005\n * <no epsilon>\n * 03005() <~ (52, 518)\n * == '_' ==> 03002\n * <no epsilon>\n * 03002() <~ (52, 519)\n * == 't' ==> 03000\n * <no epsilon>\n * 03000() <~ (52, 520)\n * == 'h' ==> 02999\n * <no epsilon>\n * 02999() <~ (52, 521)\n * == 'r' ==> 02998\n * <no epsilon>\n * 02998() <~ (52, 522)\n * == 'e' ==> 02994\n * <no epsilon>\n * 02994() <~ (52, 523)\n * == 's' ==> 02992\n * <no epsilon>\n * 02992() <~ (52, 524)\n * == 'h' ==> 02988\n * <no epsilon>\n * 02988() <~ (52, 525)\n * == 'o' ==> 02987\n * <no epsilon>\n * 02987() <~ (52, 526)\n * == 'l' ==> 02985\n * <no epsilon>\n * 02985() <~ (52, 527)\n * == 'd' ==> 02812\n * <no epsilon>\n * 02812(A, S) <~ (52, 528, A, S)\n * <no epsilon>\n * 02959() <~ (55, 582)\n * == 'w' ==> 02961\n * <no epsilon>\n * 02961() <~ (55, 583)\n * == 'e' ==> 02960\n * <no epsilon>\n * 02960() <~ (55, 584)\n * == 'p' ==> 02963\n * <no epsilon>\n * 02963() <~ (55, 585)\n * == 't' ==> 02962\n * <no epsilon>\n * 02962() <~ (55, 586)\n * == '_' ==> 02965\n * <no epsilon>\n * 02965() <~ (55, 587)\n * == 's' ==> 02964\n * <no epsilon>\n * 02964() <~ (55, 588)\n * == 'p' ==> 02919\n * <no epsilon>\n * 02919() <~ (55, 589)\n * == 'h' ==> 02967\n * <no epsilon>\n * 02967() <~ (55, 590)\n * == 'e' ==> 02966\n * <no epsilon>\n * 02966() <~ (55, 591)\n * == 'r' ==> 02880\n * <no epsilon>\n * 02880() <~ (55, 592)\n * == 'e' ==> 02969\n * <no epsilon>\n * 02969() <~ (55, 593)\n * == '_' ==> 02968\n * <no epsilon>\n * 02968() <~ (55, 594)\n * == 'r' ==> 02971\n * <no epsilon>\n * 02971() <~ (55, 595)\n * == 'a' ==> 02981\n * <no epsilon>\n * 02981() <~ (55, 596)\n * == 'd' ==> 02977\n * <no epsilon>\n * 02977() <~ (55, 597)\n * == 'i' ==> 02976\n * <no epsilon>\n * 02976() <~ (55, 598)\n * == 'u' ==> 02975\n * <no epsilon>\n * 02975() <~ (55, 599)\n * == 's' ==> 02815\n * <no epsilon>\n * 02815(A, S) <~ (55, 600, A, S)\n * <no epsilon>\n * 02939() <~ (76, 741)\n * == 'n' ==> 02954\n * <no epsilon>\n * 02954() <~ (76, 742)\n * == 't' ==> 02953\n * <no epsilon>\n * 02953() <~ (76, 743)\n * == 'e' ==> 02956\n * == 'r' ==> 02955\n * <no epsilon>\n * 02955() <~ (76, 737)\n * == 'e' ==> 02811\n * <no epsilon>\n * 02811(A, S) <~ (76, 738, A, S)\n * <no epsilon>\n * 02956() <~ (76, 744)\n * == 'r' ==> 02811\n * <no epsilon>\n * 02940() <~ (125, 1240)\n * == 'l' ==> 02950\n * <no epsilon>\n * 02950() <~ (125, 1241)\n * == 'i' ==> 02949\n * <no epsilon>\n * 02949() <~ (125, 1242)\n * == 'n' ==> 02948\n * <no epsilon>\n * 02948() <~ (125, 1243)\n * == 'd' ==> 02952\n * <no epsilon>\n * 02952() <~ (125, 1244)\n * == 'e' ==> 02951\n * <no epsilon>\n * 02951() <~ (125, 1245)\n * == 'r' ==> 02810\n * <no epsilon>\n * 02810(A, S) <~ (125, 1246, A, S)\n * <no epsilon>\n * 02941() <~ (116, 1186), (128, 1259)\n * == 'm' ==> 02943\n * == 'n' ==> 02942\n * <no epsilon>\n * 02942() <~ (128, 1260)\n * == 'e' ==> 02809\n * <no epsilon>\n * 02809(A, S) <~ (128, 1261, A, S)\n * <no epsilon>\n * 02943() <~ (116, 1187)\n * == 'p' ==> 02945\n * <no epsilon>\n * 02945() <~ (116, 1188)\n * == 'o' ==> 02944\n * <no epsilon>\n * 02944() <~ (116, 1189)\n * == 'u' ==> 02947\n * <no epsilon>\n * 02947() <~ (116, 1190)\n * == 'n' ==> 02946\n * <no epsilon>\n * 02946() <~ (116, 1191)\n * == 'd' ==> 02808\n * <no epsilon>\n * 02808(A, S) <~ (116, 1192, A, S)\n * <no epsilon>\n * 02799(A, S) <~ (305, 1833, A, S), (34, 188), (107, 1014)\n * == 'a' ==> 03076\n * == 'r' ==> 02898\n * <no epsilon>\n * 02898() <~ (34, 189)\n * == 'i' ==> 03121\n * <no epsilon>\n * 03121() <~ (34, 190)\n * == 'c' ==> 02978\n * <no epsilon>\n * 02978() <~ (34, 191)\n * == 't' ==> 02882\n * <no epsilon>\n * 02882() <~ (34, 192)\n * == 'i' ==> 02897\n * <no epsilon>\n * 02897() <~ (34, 193)\n * == 'o' ==> 03122\n * <no epsilon>\n * 03122() <~ (34, 194)\n * == 'n' ==> 02833\n * <no epsilon>\n * 02833(A, S) <~ (34, 195, A, S)\n * <no epsilon>\n * 03076() <~ (107, 1015)\n * == 'c' ==> 03111\n * <no epsilon>\n * 03111() <~ (107, 1016)\n * == 'e' ==> 03123\n * <no epsilon>\n * 03123() <~ (107, 1017)\n * == 's' ==> 02834\n * <no epsilon>\n * 02834(A, S) <~ (107, 1018, A, S)\n * <no epsilon>\n * 02800(A, S) <~ (305, 1833, A, S), (19, 69)\n * == 'C' ==> 02905\n * <no epsilon>\n * 02905() <~ (19, 70)\n * == 'O' ==> 02907\n * <no epsilon>\n * 02907() <~ (19, 71)\n * == 'L' ==> 02909\n * <no epsilon>\n * 02909() <~ (19, 72)\n * == '1' ==> 02913\n * <no epsilon>\n * 02913() <~ (19, 73)\n * == '.' ==> 02915\n * <no epsilon>\n * 02915() <~ (19, 74)\n * == '0' ==> 02777\n * <no epsilon>\n * 02777(A, S) <~ (19, 75, A, S)\n * <no epsilon>\n * 02801(A, S) <~ (305, 1833, A, S), (113, 1143)\n * == 'd' ==> 02873\n * <no epsilon>\n * 02873() <~ (113, 1144)\n * == 'g' ==> 02868\n * <no epsilon>\n * 02868() <~ (113, 1145)\n * == 'e' ==> 02867\n * <no epsilon>\n * 02867() <~ (113, 1146)\n * == '_' ==> 02866\n * <no epsilon>\n * 02866() <~ (113, 1147)\n * == 'd' ==> 02872\n * <no epsilon>\n * 02872() <~ (113, 1148)\n * == 'i' ==> 02871\n * <no epsilon>\n * 02871() <~ (113, 1149)\n * == 's' ==> 02891\n * <no epsilon>\n * 02891() <~ (113, 1150)\n * == 't' ==> 02890\n * <no epsilon>\n * 02890() <~ (113, 1151)\n * == 'a' ==> 02889\n * <no epsilon>\n * 02889() <~ (113, 1152)\n * == 'n' ==> 02888\n * <no epsilon>\n * 02888() <~ (113, 1153)\n * == 'c' ==> 02917\n * <no epsilon>\n * 02917() <~ (113, 1154)\n * == 'e' ==> 02916\n * <no epsilon>\n * 02916() <~ (113, 1155)\n * == '_' ==> 02914\n * <no epsilon>\n * 02914() <~ (113, 1156)\n * == 't' ==> 02912\n * <no epsilon>\n * 02912() <~ (113, 1157)\n * == 'h' ==> 02911\n * <no epsilon>\n * 02911() <~ (113, 1158)\n * == 'r' ==> 02910\n * <no epsilon>\n * 02910() <~ (113, 1159)\n * == 'e' ==> 02908\n * <no epsilon>\n * 02908() <~ (113, 1160)\n * == 's' ==> 02906\n * <no epsilon>\n * 02906() <~ (113, 1161)\n * == 'h' ==> 02904\n * <no epsilon>\n * 02904() <~ (113, 1162)\n * == 'o' ==> 02903\n * <no epsilon>\n * 02903() <~ (113, 1163)\n * == 'l' ==> 02902\n * <no epsilon>\n * 02902() <~ (113, 1164)\n * == 'd' ==> 02840\n * <no epsilon>\n * 02840(A, S) <~ (113, 1165, A, S)\n * <no epsilon>\n * 02802(A, S) <~ (305, 1833, A, S), (143, 1378)\n * == 'r' ==> 02852\n * <no epsilon>\n * 02852() <~ (143, 1379)\n * == 'i' ==> 02855\n * <no epsilon>\n * 02855() <~ (143, 1380)\n * == 'm' ==> 02862\n * <no epsilon>\n * 02862() <~ (143, 1381)\n * == 'e' ==> 02861\n * <no epsilon>\n * 02861() <~ (143, 1382)\n * == 's' ==> 02860\n * <no epsilon>\n * 02860() <~ (143, 1383)\n * == 'h' ==> 02806\n * <no epsilon>\n * 02806(A, S) <~ (143, 1384, A, S)\n * <no epsilon>\n * 02803(A, S) <~ (305, 1833, A, S), (167, 1433)\n * == [\\1, '!'], ['#', oo] ==> 02849\n * == '\"' ==> 02805\n * <no epsilon>\n * 02849() <~ (167, 1433)\n * == [\\1, '!'], ['#', oo] ==> 02849\n * == '\"' ==> 02805\n * <no epsilon>\n * 02805(A, S) <~ (167, 1434, A, S)\n * <no epsilon>\n * 02804(A, S) <~ (183, 1472, A, S)\n * == '.' ==> 02843\n * == ['0', '9'] ==> 02804\n * == 'E', 'e' ==> 02845\n * <no epsilon>\n * \n */\nSTATE_2842:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2842\");\n\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 99) {\n if( input < 45) {\n if( input < 32) {\n if( input < 12) {\n if( input < 1) {\n goto STATE_2842_DROP_OUT; /* [-oo, \\0] */\n } else {\n if( input < 9) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_305_DIRECT; /* [\\1, \\8] */\n } else {\n goto STATE_2785; /* ['\\t', \\11] */\n }\n }\n } else {\n if( input == 13) {\n goto STATE_2785; /* '\\r' */\n } else {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_305_DIRECT; /* \\12 */\n }\n }\n } else {\n if( input < 35) {\n if( input < 33) {\n goto STATE_2785; /* ' ' */\n } else {\n if( input == 33) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_305_DIRECT; /* '!' */\n } else {\n goto STATE_2803; /* '\"' */\n }\n }\n } else {\n if( input == 43) {\n goto STATE_2844; /* '+' */\n } else {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_305_DIRECT; /* ['#', '*'] */\n }\n }\n }\n } else {\n if( input < 59) {\n if( input < 48) {\n if( input < 46) {\n goto STATE_2844; /* '-' */\n } else {\n if( input == 46) {\n goto STATE_2790; /* '.' */\n } else {\n goto STATE_2792; /* '/' */\n }\n }\n } else {\n if( input < 49) {\n goto STATE_2793; /* '0' */\n } else {\n if( input != 58) {\n goto STATE_2804; /* ['1', '9'] */\n } else {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_305_DIRECT; /* ':' */\n }\n }\n }\n } else {\n if( input < 85) {\n if( input < 60) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_146_DIRECT; /* ';' */\n } else {\n if( input != 84) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_305_DIRECT; /* ['<', 'S'] */\n } else {\n goto STATE_2800; /* 'T' */\n }\n }\n } else {\n if( input < 97) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_305_DIRECT; /* ['U', '`'] */\n } else {\n if( input == 97) {\n goto STATE_2794; /* 'a' */\n } else {\n goto STATE_2788; /* 'b' */\n }\n }\n }\n }\n }\n } else {\n if( input < 112) {\n if( input < 105) {\n if( input < 102) {\n if( input < 100) {\n goto STATE_2798; /* 'c' */\n } else {\n if( input == 100) {\n goto STATE_2795; /* 'd' */\n } else {\n goto STATE_2801; /* 'e' */\n }\n }\n } else {\n if( input < 103) {\n goto STATE_2799; /* 'f' */\n } else {\n if( input == 103) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_305_DIRECT; /* 'g' */\n } else {\n goto STATE_2796; /* 'h' */\n }\n }\n }\n } else {\n if( input < 109) {\n if( input < 106) {\n goto STATE_2786; /* 'i' */\n } else {\n if( input != 108) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_305_DIRECT; /* ['j', 'k'] */\n } else {\n goto STATE_2784; /* 'l' */\n }\n }\n } else {\n if( input < 110) {\n goto STATE_2783; /* 'm' */\n } else {\n if( input == 110) {\n goto STATE_2780; /* 'n' */\n } else {\n goto STATE_2787; /* 'o' */\n }\n }\n }\n }\n } else {\n if( input < 118) {\n if( input < 115) {\n if( input < 113) {\n goto STATE_2791; /* 'p' */\n } else {\n if( input == 113) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_305_DIRECT; /* 'q' */\n } else {\n goto STATE_2797; /* 'r' */\n }\n }\n } else {\n if( input < 116) {\n goto STATE_2779; /* 's' */\n } else {\n if( input == 116) {\n goto STATE_2802; /* 't' */\n } else {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_305_DIRECT; /* 'u' */\n }\n }\n }\n } else {\n if( input < 124) {\n if( input < 119) {\n goto STATE_2789; /* 'v' */\n } else {\n if( input != 123) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_305_DIRECT; /* ['w', 'z'] */\n } else {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_149_DIRECT; /* '{' */\n }\n }\n } else {\n if( input == 125) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_152_DIRECT; /* '}' */\n } else {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_305_DIRECT; /* '|' */\n }\n }\n }\n }\n }\n\nSTATE_2842_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2842_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2842_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2842_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n if( QuexBuffer_is_end_of_file(&me->buffer) ) {\n /* NO CHECK 'last_acceptance != -1' --- first state can **never** be an acceptance state */\n goto TERMINAL_END_OF_STREAM;\n }\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2842_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\nSTATE_2842_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2842_INPUT\");\n QuexBuffer_input_p_increment(&me->buffer);\n goto STATE_2842;\nSTATE_2771:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2771\");\n\nSTATE_2771_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2771_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 108) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_78_DIRECT; /* 'l' */\n } else {\n goto STATE_2771_DROP_OUT; /* [-oo, 'k'] */\n }\n\nSTATE_2771_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2771_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2771_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2771_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2771_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2774:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2774\");\n\nSTATE_2774_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2774_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"291\");\n QUEX_SET_last_acceptance(291);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n if( input < 58) {\n if( input < 47) {\n if( input != 46) {\n goto STATE_2774_DROP_OUT; /* [-oo, '-'] */\n } else {\n goto STATE_2843; /* '.' */\n }\n } else {\n if( input == 47) {\n goto STATE_2774_DROP_OUT_DIRECT; /* '/' */\n } else {\n goto STATE_2774; /* ['0', '9'] */\n }\n }\n } else {\n if( input == 69 || input == 101 ) {\n goto STATE_2845;\n } else {\n goto STATE_2774_DROP_OUT;\n }\n }\n\nSTATE_2774_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2774_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2774_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2774_DROP_OUT_DIRECT\");\n goto TERMINAL_291;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"291\");\n QUEX_SET_last_acceptance(291);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2774_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2779:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2779\");\n\nSTATE_2779_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2779_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"305\");\n QUEX_SET_last_acceptance(305);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n if( input < 112) {\n if( input == 104) {\n goto STATE_2918; /* 'h' */\n } else {\n goto STATE_2779_DROP_OUT; /* [-oo, 'g'] */\n }\n } else {\n if( input < 116) {\n if( input == 112) {\n goto STATE_2926; /* 'p' */\n } else {\n goto STATE_2779_DROP_OUT_DIRECT; /* ['q', 's'] */\n }\n } else {\n if( input == 116) {\n goto STATE_2931; /* 't' */\n } else {\n goto STATE_2779_DROP_OUT_DIRECT; /* ['u', oo] */\n }\n }\n }\n\nSTATE_2779_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2779_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2779_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2779_DROP_OUT_DIRECT\");\n goto TERMINAL_305;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"305\");\n QUEX_SET_last_acceptance(305);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2779_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2780:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2780\");\n\nSTATE_2780_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2780_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"305\");\n QUEX_SET_last_acceptance(305);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n if( input == 111) {\n goto STATE_3124; /* 'o' */\n } else {\n goto STATE_2780_DROP_OUT; /* [-oo, 'n'] */\n }\n\nSTATE_2780_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2780_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2780_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2780_DROP_OUT_DIRECT\");\n goto TERMINAL_305;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"305\");\n QUEX_SET_last_acceptance(305);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2780_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2783:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2783\");\n\nSTATE_2783_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2783_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"305\");\n QUEX_SET_last_acceptance(305);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n if( input < 98) {\n if( input != 97) {\n goto STATE_2783_DROP_OUT; /* [-oo, '`'] */\n } else {\n goto STATE_3095; /* 'a' */\n }\n } else {\n if( input == 117) {\n goto STATE_3099; /* 'u' */\n } else {\n goto STATE_2783_DROP_OUT_DIRECT; /* ['b', 't'] */\n }\n }\n\nSTATE_2783_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2783_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2783_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2783_DROP_OUT_DIRECT\");\n goto TERMINAL_305;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"305\");\n QUEX_SET_last_acceptance(305);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2783_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2784:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2784\");\n\nSTATE_2784_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2784_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"305\");\n QUEX_SET_last_acceptance(305);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n if( input == 105) {\n goto STATE_3089; /* 'i' */\n } else {\n goto STATE_2784_DROP_OUT; /* [-oo, 'h'] */\n }\n\nSTATE_2784_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2784_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2784_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2784_DROP_OUT_DIRECT\");\n goto TERMINAL_305;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"305\");\n QUEX_SET_last_acceptance(305);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2784_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2785:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2785\");\n\nSTATE_2785_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2785_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 13) {\n if( input == 9 || input == 10 || input == 11 ) {\n goto STATE_2785;\n } else {\n goto STATE_2785_DROP_OUT;\n }\n } else {\n if( input == 13 || input == 32 ) {\n goto STATE_2785;\n } else {\n goto STATE_2785_DROP_OUT;\n }\n }\n\nSTATE_2785_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2785_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2785_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2785_DROP_OUT_DIRECT\");\n goto TERMINAL_5_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"5\");\n QUEX_SET_last_acceptance(5);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2785_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2786:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2786\");\n\nSTATE_2786_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2786_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"305\");\n QUEX_SET_last_acceptance(305);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n if( input == 110) {\n goto STATE_2933; /* 'n' */\n } else {\n goto STATE_2786_DROP_OUT; /* [-oo, 'm'] */\n }\n\nSTATE_2786_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2786_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2786_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2786_DROP_OUT_DIRECT\");\n goto TERMINAL_305;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"305\");\n QUEX_SET_last_acceptance(305);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2786_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2787:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2787\");\n\nSTATE_2787_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2787_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"305\");\n QUEX_SET_last_acceptance(305);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n if( input == 114) {\n goto STATE_2850; /* 'r' */\n } else {\n goto STATE_2787_DROP_OUT; /* [-oo, 'q'] */\n }\n\nSTATE_2787_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2787_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2787_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2787_DROP_OUT_DIRECT\");\n goto TERMINAL_305;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"305\");\n QUEX_SET_last_acceptance(305);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2787_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2788:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2788\");\n\nSTATE_2788_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2788_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"305\");\n QUEX_SET_last_acceptance(305);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n if( input == 111) {\n goto STATE_3080; /* 'o' */\n } else {\n goto STATE_2788_DROP_OUT; /* [-oo, 'n'] */\n }\n\nSTATE_2788_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2788_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2788_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2788_DROP_OUT_DIRECT\");\n goto TERMINAL_305;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"305\");\n QUEX_SET_last_acceptance(305);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2788_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2789:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2789\");\n\nSTATE_2789_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2789_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"305\");\n QUEX_SET_last_acceptance(305);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n if( input == 101) {\n goto STATE_3068; /* 'e' */\n } else {\n goto STATE_2789_DROP_OUT; /* [-oo, 'd'] */\n }\n\nSTATE_2789_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2789_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2789_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2789_DROP_OUT_DIRECT\");\n goto TERMINAL_305;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"305\");\n QUEX_SET_last_acceptance(305);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2789_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2790:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2790\");\n\nSTATE_2790_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2790_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input >= 48 && input < 58 ) {\n goto STATE_2843; /* ['0', '9'] */\n } else {\n goto STATE_2790_DROP_OUT; /* [-oo, '/'] */\n }\n\nSTATE_2790_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2790_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2790_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2790_DROP_OUT_DIRECT\");\n goto TERMINAL_305_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"305\");\n QUEX_SET_last_acceptance(305);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2790_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2791:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2791\");\n\nSTATE_2791_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2791_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"305\");\n QUEX_SET_last_acceptance(305);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n if( input == 108) {\n goto STATE_3063; /* 'l' */\n } else {\n goto STATE_2791_DROP_OUT; /* [-oo, 'k'] */\n }\n\nSTATE_2791_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2791_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2791_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2791_DROP_OUT_DIRECT\");\n goto TERMINAL_305;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"305\");\n QUEX_SET_last_acceptance(305);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2791_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2792:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2792\");\n\nSTATE_2792_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2792_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 43) {\n if( input != 42) {\n goto STATE_2792_DROP_OUT; /* [-oo, ')'] */\n } else {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_16_DIRECT; /* '*' */\n }\n } else {\n if( input == 47) {\n goto STATE_2823; /* '/' */\n } else {\n goto STATE_2792_DROP_OUT_DIRECT; /* ['+', '.'] */\n }\n }\n\nSTATE_2792_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2792_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2792_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2792_DROP_OUT_DIRECT\");\n goto TERMINAL_305_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"305\");\n QUEX_SET_last_acceptance(305);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2792_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2793:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2793\");\n\nSTATE_2793_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2793_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"183\");\n QUEX_SET_last_acceptance(183);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n if( input < 69) {\n if( input < 47) {\n if( input != 46) {\n goto STATE_2793_DROP_OUT; /* [-oo, '-'] */\n } else {\n goto STATE_2843; /* '.' */\n }\n } else {\n if( input >= 48 && input < 58 ) {\n goto STATE_3058; /* ['0', '9'] */\n } else {\n goto STATE_2793_DROP_OUT_DIRECT; /* '/' */\n }\n }\n } else {\n if( input < 102) {\n if( input == 69 || input == 101 ) {\n goto STATE_2845;\n } else {\n goto STATE_2793_DROP_OUT;\n }\n } else {\n if( input == 120) {\n goto STATE_3053; /* 'x' */\n } else {\n goto STATE_2793_DROP_OUT_DIRECT; /* ['f', 'w'] */\n }\n }\n }\n\nSTATE_2793_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2793_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2793_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2793_DROP_OUT_DIRECT\");\n goto TERMINAL_183;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"183\");\n QUEX_SET_last_acceptance(183);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2793_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2794:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2794\");\n\nSTATE_2794_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2794_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"305\");\n QUEX_SET_last_acceptance(305);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n if( input < 111) {\n if( input != 110) {\n goto STATE_2794_DROP_OUT; /* [-oo, 'm'] */\n } else {\n goto STATE_3025; /* 'n' */\n }\n } else {\n if( input == 116) {\n goto STATE_3027; /* 't' */\n } else {\n goto STATE_2794_DROP_OUT_DIRECT; /* ['o', 's'] */\n }\n }\n\nSTATE_2794_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2794_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2794_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2794_DROP_OUT_DIRECT\");\n goto TERMINAL_305;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"305\");\n QUEX_SET_last_acceptance(305);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2794_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2795:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2795\");\n\nSTATE_2795_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2795_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"305\");\n QUEX_SET_last_acceptance(305);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n if( input == 105) {\n goto STATE_3014; /* 'i' */\n } else {\n goto STATE_2795_DROP_OUT; /* [-oo, 'h'] */\n }\n\nSTATE_2795_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2795_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2795_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2795_DROP_OUT_DIRECT\");\n goto TERMINAL_305;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"305\");\n QUEX_SET_last_acceptance(305);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2795_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2796:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2796\");\n\nSTATE_2796_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2796_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"305\");\n QUEX_SET_last_acceptance(305);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n if( input < 102) {\n if( input != 101) {\n goto STATE_2796_DROP_OUT; /* [-oo, 'd'] */\n } else {\n goto STATE_3012; /* 'e' */\n }\n } else {\n if( input == 117) {\n goto STATE_3010; /* 'u' */\n } else {\n goto STATE_2796_DROP_OUT_DIRECT; /* ['f', 't'] */\n }\n }\n\nSTATE_2796_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2796_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2796_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2796_DROP_OUT_DIRECT\");\n goto TERMINAL_305;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"305\");\n QUEX_SET_last_acceptance(305);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2796_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2797:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2797\");\n\nSTATE_2797_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2797_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"305\");\n QUEX_SET_last_acceptance(305);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n if( input < 98) {\n if( input != 97) {\n goto STATE_2797_DROP_OUT; /* [-oo, '`'] */\n } else {\n goto STATE_2970; /* 'a' */\n }\n } else {\n if( input == 101) {\n goto STATE_2997; /* 'e' */\n } else {\n goto STATE_2797_DROP_OUT_DIRECT; /* ['b', 'd'] */\n }\n }\n\nSTATE_2797_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2797_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2797_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2797_DROP_OUT_DIRECT\");\n goto TERMINAL_305;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"305\");\n QUEX_SET_last_acceptance(305);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2797_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2798:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2798\");\n\nSTATE_2798_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2798_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"305\");\n QUEX_SET_last_acceptance(305);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n if( input < 101) {\n if( input < 98) {\n if( input != 97) {\n goto STATE_2798_DROP_OUT; /* [-oo, '`'] */\n } else {\n goto STATE_2937; /* 'a' */\n }\n } else {\n if( input == 99) {\n goto STATE_2938; /* 'c' */\n } else {\n goto STATE_2798_DROP_OUT_DIRECT; /* 'b' */\n }\n }\n } else {\n if( input < 112) {\n if( input < 102) {\n goto STATE_2939; /* 'e' */\n } else {\n if( input != 111) {\n goto STATE_2798_DROP_OUT_DIRECT; /* ['f', 'n'] */\n } else {\n goto STATE_2941; /* 'o' */\n }\n }\n } else {\n if( input == 121) {\n goto STATE_2940; /* 'y' */\n } else {\n goto STATE_2798_DROP_OUT_DIRECT; /* ['p', 'x'] */\n }\n }\n }\n\nSTATE_2798_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2798_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2798_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2798_DROP_OUT_DIRECT\");\n goto TERMINAL_305;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"305\");\n QUEX_SET_last_acceptance(305);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2798_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2799:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2799\");\n\nSTATE_2799_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2799_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"305\");\n QUEX_SET_last_acceptance(305);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n if( input < 98) {\n if( input != 97) {\n goto STATE_2799_DROP_OUT; /* [-oo, '`'] */\n } else {\n goto STATE_3076; /* 'a' */\n }\n } else {\n if( input == 114) {\n goto STATE_2898; /* 'r' */\n } else {\n goto STATE_2799_DROP_OUT_DIRECT; /* ['b', 'q'] */\n }\n }\n\nSTATE_2799_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2799_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2799_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2799_DROP_OUT_DIRECT\");\n goto TERMINAL_305;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"305\");\n QUEX_SET_last_acceptance(305);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2799_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2800:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2800\");\n\nSTATE_2800_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2800_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"305\");\n QUEX_SET_last_acceptance(305);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n if( input == 67) {\n goto STATE_2905; /* 'C' */\n } else {\n goto STATE_2800_DROP_OUT; /* [-oo, 'B'] */\n }\n\nSTATE_2800_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2800_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2800_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2800_DROP_OUT_DIRECT\");\n goto TERMINAL_305;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"305\");\n QUEX_SET_last_acceptance(305);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2800_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2801:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2801\");\n\nSTATE_2801_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2801_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"305\");\n QUEX_SET_last_acceptance(305);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n if( input == 100) {\n goto STATE_2873; /* 'd' */\n } else {\n goto STATE_2801_DROP_OUT; /* [-oo, 'c'] */\n }\n\nSTATE_2801_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2801_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2801_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2801_DROP_OUT_DIRECT\");\n goto TERMINAL_305;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"305\");\n QUEX_SET_last_acceptance(305);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2801_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2802:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2802\");\n\nSTATE_2802_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2802_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"305\");\n QUEX_SET_last_acceptance(305);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n if( input == 114) {\n goto STATE_2852; /* 'r' */\n } else {\n goto STATE_2802_DROP_OUT; /* [-oo, 'q'] */\n }\n\nSTATE_2802_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2802_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2802_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2802_DROP_OUT_DIRECT\");\n goto TERMINAL_305;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"305\");\n QUEX_SET_last_acceptance(305);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2802_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2803:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2803\");\n\nSTATE_2803_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2803_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"305\");\n QUEX_SET_last_acceptance(305);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n if( input < 34) {\n if( input < 1) {\n goto STATE_2803_DROP_OUT; /* [-oo, \\0] */\n } else {\n goto STATE_2849; /* [\\1, '!'] */\n }\n } else {\n if( input == 34) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_167_DIRECT; /* '\"' */\n } else {\n goto STATE_2849; /* ['#', oo] */\n }\n }\n\nSTATE_2803_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2803_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2803_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2803_DROP_OUT_DIRECT\");\n goto TERMINAL_305;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"305\");\n QUEX_SET_last_acceptance(305);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2803_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2804:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2804\");\n\nSTATE_2804_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2804_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"183\");\n QUEX_SET_last_acceptance(183);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n if( input < 58) {\n if( input < 47) {\n if( input != 46) {\n goto STATE_2804_DROP_OUT; /* [-oo, '-'] */\n } else {\n goto STATE_2843; /* '.' */\n }\n } else {\n if( input == 47) {\n goto STATE_2804_DROP_OUT_DIRECT; /* '/' */\n } else {\n goto STATE_2804; /* ['0', '9'] */\n }\n }\n } else {\n if( input == 69 || input == 101 ) {\n goto STATE_2845;\n } else {\n goto STATE_2804_DROP_OUT;\n }\n }\n\nSTATE_2804_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2804_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2804_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2804_DROP_OUT_DIRECT\");\n goto TERMINAL_183;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"183\");\n QUEX_SET_last_acceptance(183);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2804_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2822:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2822\");\n\nSTATE_2822_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2822_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 65) {\n if( input >= 48 && input < 58 ) {\n goto STATE_2822; /* ['0', '9'] */\n } else {\n goto STATE_2822_DROP_OUT; /* [-oo, '/'] */\n }\n } else {\n if( input < 97) {\n if( input < 91) {\n goto STATE_2822; /* ['A', 'Z'] */\n } else {\n goto STATE_2822_DROP_OUT_DIRECT; /* ['[', '`'] */\n }\n } else {\n if( input < 123) {\n goto STATE_2822; /* ['a', 'z'] */\n } else {\n goto STATE_2822_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n\nSTATE_2822_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2822_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2822_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2822_DROP_OUT_DIRECT\");\n goto TERMINAL_302_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"302\");\n QUEX_SET_last_acceptance(302);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2822_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2823:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2823\");\n\nSTATE_2823_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2823_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 10) {\n if( input < 1) {\n goto STATE_2823_DROP_OUT; /* [-oo, \\0] */\n } else {\n goto STATE_2823; /* [\\1, '\\t'] */\n }\n } else {\n if( input == 10) {\n goto STATE_2823_DROP_OUT_DIRECT; /* '\\n' */\n } else {\n goto STATE_2823; /* [\\11, oo] */\n }\n }\n\nSTATE_2823_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2823_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2823_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2823_DROP_OUT_DIRECT\");\n goto TERMINAL_14_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"14\");\n QUEX_SET_last_acceptance(14);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2823_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2843:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2843\");\n\nSTATE_2843_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2843_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"291\");\n QUEX_SET_last_acceptance(291);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n if( input < 69) {\n if( input >= 48 && input < 58 ) {\n goto STATE_2843; /* ['0', '9'] */\n } else {\n goto STATE_2843_DROP_OUT; /* [-oo, '/'] */\n }\n } else {\n if( input == 69 || input == 101 ) {\n goto STATE_2845;\n } else {\n goto STATE_2843_DROP_OUT;\n }\n }\n\nSTATE_2843_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2843_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2843_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2843_DROP_OUT_DIRECT\");\n goto TERMINAL_291;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"291\");\n QUEX_SET_last_acceptance(291);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2843_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2844:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2844\");\n\nSTATE_2844_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2844_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"305\");\n QUEX_SET_last_acceptance(305);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n if( input < 48) {\n if( input == 46) {\n goto STATE_3066; /* '.' */\n } else {\n goto STATE_2844_DROP_OUT; /* [-oo, '-'] */\n }\n } else {\n if( input < 49) {\n goto STATE_2848; /* '0' */\n } else {\n if( input < 58) {\n goto STATE_2774; /* ['1', '9'] */\n } else {\n goto STATE_2844_DROP_OUT_DIRECT; /* [':', oo] */\n }\n }\n }\n\nSTATE_2844_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2844_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2844_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2844_DROP_OUT_DIRECT\");\n goto TERMINAL_305;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"305\");\n QUEX_SET_last_acceptance(305);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2844_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2845:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2845\");\n\nSTATE_2845_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2845_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 45) {\n if( input == 43) {\n goto STATE_2847; /* '+' */\n } else {\n goto STATE_2845_DROP_OUT; /* [-oo, '*'] */\n }\n } else {\n if( input < 48) {\n if( input == 45) {\n goto STATE_2847; /* '-' */\n } else {\n goto STATE_2845_DROP_OUT_DIRECT; /* ['.', '/'] */\n }\n } else {\n if( input < 58) {\n goto STATE_2846; /* ['0', '9'] */\n } else {\n goto STATE_2845_DROP_OUT_DIRECT; /* [':', oo] */\n }\n }\n }\n\nSTATE_2845_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2845_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2845_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2845_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2845_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2846:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2846\");\n\nSTATE_2846_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2846_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input >= 48 && input < 58 ) {\n goto STATE_2846; /* ['0', '9'] */\n } else {\n goto STATE_2846_DROP_OUT; /* [-oo, '/'] */\n }\n\nSTATE_2846_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2846_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2846_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2846_DROP_OUT_DIRECT\");\n goto TERMINAL_291_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"291\");\n QUEX_SET_last_acceptance(291);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2846_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2847:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2847\");\n\nSTATE_2847_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2847_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input >= 48 && input < 58 ) {\n goto STATE_2846; /* ['0', '9'] */\n } else {\n goto STATE_2847_DROP_OUT; /* [-oo, '/'] */\n }\n\nSTATE_2847_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2847_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2847_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2847_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2847_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2848:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2848\");\n\nSTATE_2848_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2848_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"291\");\n QUEX_SET_last_acceptance(291);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n if( input < 58) {\n if( input < 47) {\n if( input != 46) {\n goto STATE_2848_DROP_OUT; /* [-oo, '-'] */\n } else {\n goto STATE_2843; /* '.' */\n }\n } else {\n if( input == 47) {\n goto STATE_2848_DROP_OUT_DIRECT; /* '/' */\n } else {\n goto STATE_3058; /* ['0', '9'] */\n }\n }\n } else {\n if( input == 69 || input == 101 ) {\n goto STATE_2845;\n } else {\n goto STATE_2848_DROP_OUT;\n }\n }\n\nSTATE_2848_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2848_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2848_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2848_DROP_OUT_DIRECT\");\n goto TERMINAL_291;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"291\");\n QUEX_SET_last_acceptance(291);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2848_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2849:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2849\");\n\nSTATE_2849_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2849_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 34) {\n if( input < 1) {\n goto STATE_2849_DROP_OUT; /* [-oo, \\0] */\n } else {\n goto STATE_2849; /* [\\1, '!'] */\n }\n } else {\n if( input == 34) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_167_DIRECT; /* '\"' */\n } else {\n goto STATE_2849; /* ['#', oo] */\n }\n }\n\nSTATE_2849_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2849_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2849_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2849_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2849_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2850:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2850\");\n\nSTATE_2850_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2850_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 105) {\n goto STATE_3082; /* 'i' */\n } else {\n goto STATE_2850_DROP_OUT; /* [-oo, 'h'] */\n }\n\nSTATE_2850_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2850_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2850_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2850_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2850_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2851:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2851\");\n\nSTATE_2851_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2851_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 109) {\n goto STATE_2979; /* 'm' */\n } else {\n goto STATE_2851_DROP_OUT; /* [-oo, 'l'] */\n }\n\nSTATE_2851_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2851_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2851_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2851_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2851_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2852:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2852\");\n\nSTATE_2852_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2852_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 105) {\n goto STATE_2855; /* 'i' */\n } else {\n goto STATE_2852_DROP_OUT; /* [-oo, 'h'] */\n }\n\nSTATE_2852_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2852_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2852_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2852_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2852_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2853:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2853\");\n\nSTATE_2853_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2853_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 101) {\n goto STATE_3047; /* 'e' */\n } else {\n goto STATE_2853_DROP_OUT; /* [-oo, 'd'] */\n }\n\nSTATE_2853_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2853_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2853_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2853_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2853_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2854:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2854\");\n\nSTATE_2854_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2854_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 105) {\n goto STATE_2973; /* 'i' */\n } else {\n goto STATE_2854_DROP_OUT; /* [-oo, 'h'] */\n }\n\nSTATE_2854_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2854_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2854_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2854_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2854_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2855:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2855\");\n\nSTATE_2855_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2855_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 109) {\n goto STATE_2862; /* 'm' */\n } else {\n goto STATE_2855_DROP_OUT; /* [-oo, 'l'] */\n }\n\nSTATE_2855_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2855_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2855_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2855_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2855_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2856:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2856\");\n\nSTATE_2856_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2856_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 101) {\n goto STATE_3036; /* 'e' */\n } else {\n goto STATE_2856_DROP_OUT; /* [-oo, 'd'] */\n }\n\nSTATE_2856_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2856_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2856_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2856_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2856_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2857:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2857\");\n\nSTATE_2857_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2857_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 115) {\n goto STATE_3100; /* 's' */\n } else {\n goto STATE_2857_DROP_OUT; /* [-oo, 'r'] */\n }\n\nSTATE_2857_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2857_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2857_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2857_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2857_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2858:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2858\");\n\nSTATE_2858_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2858_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 105) {\n goto STATE_2857; /* 'i' */\n } else {\n goto STATE_2858_DROP_OUT; /* [-oo, 'h'] */\n }\n\nSTATE_2858_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2858_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2858_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2858_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2858_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2859:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2859\");\n\nSTATE_2859_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2859_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 101) {\n goto STATE_2893; /* 'e' */\n } else {\n goto STATE_2859_DROP_OUT; /* [-oo, 'd'] */\n }\n\nSTATE_2859_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2859_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2859_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2859_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2859_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2860:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2860\");\n\nSTATE_2860_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2860_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 104) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_143_DIRECT; /* 'h' */\n } else {\n goto STATE_2860_DROP_OUT; /* [-oo, 'g'] */\n }\n\nSTATE_2860_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2860_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2860_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2860_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2860_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2861:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2861\");\n\nSTATE_2861_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2861_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 115) {\n goto STATE_2860; /* 's' */\n } else {\n goto STATE_2861_DROP_OUT; /* [-oo, 'r'] */\n }\n\nSTATE_2861_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2861_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2861_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2861_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2861_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2862:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2862\");\n\nSTATE_2862_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2862_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 101) {\n goto STATE_2861; /* 'e' */\n } else {\n goto STATE_2862_DROP_OUT; /* [-oo, 'd'] */\n }\n\nSTATE_2862_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2862_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2862_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2862_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2862_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2863:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2863\");\n\nSTATE_2863_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2863_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 103) {\n goto STATE_2865; /* 'g' */\n } else {\n goto STATE_2863_DROP_OUT; /* [-oo, 'f'] */\n }\n\nSTATE_2863_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2863_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2863_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2863_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2863_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2864:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2864\");\n\nSTATE_2864_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2864_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 95) {\n goto STATE_2884; /* '_' */\n } else {\n goto STATE_2864_DROP_OUT; /* [-oo, '^'] */\n }\n\nSTATE_2864_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2864_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2864_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2864_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2864_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2865:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2865\");\n\nSTATE_2865_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2865_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 101) {\n goto STATE_2864; /* 'e' */\n } else {\n goto STATE_2865_DROP_OUT; /* [-oo, 'd'] */\n }\n\nSTATE_2865_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2865_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2865_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2865_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2865_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2866:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2866\");\n\nSTATE_2866_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2866_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 100) {\n goto STATE_2872; /* 'd' */\n } else {\n goto STATE_2866_DROP_OUT; /* [-oo, 'c'] */\n }\n\nSTATE_2866_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2866_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2866_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2866_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2866_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2867:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2867\");\n\nSTATE_2867_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2867_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 95) {\n goto STATE_2866; /* '_' */\n } else {\n goto STATE_2867_DROP_OUT; /* [-oo, '^'] */\n }\n\nSTATE_2867_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2867_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2867_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2867_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2867_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2868:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2868\");\n\nSTATE_2868_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2868_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 101) {\n goto STATE_2867; /* 'e' */\n } else {\n goto STATE_2868_DROP_OUT; /* [-oo, 'd'] */\n }\n\nSTATE_2868_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2868_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2868_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2868_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2868_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2869:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2869\");\n\nSTATE_2869_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2869_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 116) {\n goto STATE_3072; /* 't' */\n } else {\n goto STATE_2869_DROP_OUT; /* [-oo, 's'] */\n }\n\nSTATE_2869_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2869_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2869_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2869_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2869_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2870:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2870\");\n\nSTATE_2870_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2870_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 105) {\n goto STATE_3118; /* 'i' */\n } else {\n goto STATE_2870_DROP_OUT; /* [-oo, 'h'] */\n }\n\nSTATE_2870_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2870_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2870_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2870_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2870_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2871:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2871\");\n\nSTATE_2871_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2871_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 115) {\n goto STATE_2891; /* 's' */\n } else {\n goto STATE_2871_DROP_OUT; /* [-oo, 'r'] */\n }\n\nSTATE_2871_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2871_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2871_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2871_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2871_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2872:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2872\");\n\nSTATE_2872_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2872_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 105) {\n goto STATE_2871; /* 'i' */\n } else {\n goto STATE_2872_DROP_OUT; /* [-oo, 'h'] */\n }\n\nSTATE_2872_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2872_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2872_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2872_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2872_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2873:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2873\");\n\nSTATE_2873_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2873_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 103) {\n goto STATE_2868; /* 'g' */\n } else {\n goto STATE_2873_DROP_OUT; /* [-oo, 'f'] */\n }\n\nSTATE_2873_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2873_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2873_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2873_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2873_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2874:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2874\");\n\nSTATE_2874_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2874_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 95) {\n goto STATE_2894; /* '_' */\n } else {\n goto STATE_2874_DROP_OUT; /* [-oo, '^'] */\n }\n\nSTATE_2874_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2874_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2874_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2874_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2874_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2875:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2875\");\n\nSTATE_2875_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2875_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 101) {\n goto STATE_2874; /* 'e' */\n } else {\n goto STATE_2875_DROP_OUT; /* [-oo, 'd'] */\n }\n\nSTATE_2875_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2875_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2875_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2875_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2875_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2876:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2876\");\n\nSTATE_2876_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2876_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 97) {\n goto STATE_3088; /* 'a' */\n } else {\n goto STATE_2876_DROP_OUT; /* [-oo, '`'] */\n }\n\nSTATE_2876_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2876_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2876_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2876_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2876_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2877:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2877\");\n\nSTATE_2877_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2877_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 109) {\n goto STATE_3040; /* 'm' */\n } else {\n goto STATE_2877_DROP_OUT; /* [-oo, 'l'] */\n }\n\nSTATE_2877_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2877_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2877_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2877_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2877_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2878:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2878\");\n\nSTATE_2878_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2878_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 101) {\n goto STATE_3016; /* 'e' */\n } else {\n goto STATE_2878_DROP_OUT; /* [-oo, 'd'] */\n }\n\nSTATE_2878_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2878_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2878_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2878_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2878_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2879:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2879\");\n\nSTATE_2879_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2879_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 95) {\n goto STATE_3037; /* '_' */\n } else {\n goto STATE_2879_DROP_OUT; /* [-oo, '^'] */\n }\n\nSTATE_2879_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2879_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2879_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2879_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2879_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2880:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2880\");\n\nSTATE_2880_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2880_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 101) {\n goto STATE_2969; /* 'e' */\n } else {\n goto STATE_2880_DROP_OUT; /* [-oo, 'd'] */\n }\n\nSTATE_2880_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2880_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2880_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2880_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2880_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2881:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2881\");\n\nSTATE_2881_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2881_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 116) {\n goto STATE_2876; /* 't' */\n } else {\n goto STATE_2881_DROP_OUT; /* [-oo, 's'] */\n }\n\nSTATE_2881_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2881_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2881_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2881_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2881_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2882:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2882\");\n\nSTATE_2882_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2882_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 105) {\n goto STATE_2897; /* 'i' */\n } else {\n goto STATE_2882_DROP_OUT; /* [-oo, 'h'] */\n }\n\nSTATE_2882_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2882_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2882_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2882_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2882_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2883:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2883\");\n\nSTATE_2883_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2883_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 110) {\n goto STATE_3112; /* 'n' */\n } else {\n goto STATE_2883_DROP_OUT; /* [-oo, 'm'] */\n }\n\nSTATE_2883_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2883_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2883_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2883_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2883_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2884:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2884\");\n\nSTATE_2884_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2884_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 97) {\n goto STATE_2883; /* 'a' */\n } else {\n goto STATE_2884_DROP_OUT; /* [-oo, '`'] */\n }\n\nSTATE_2884_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2884_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2884_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2884_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2884_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2885:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2885\");\n\nSTATE_2885_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2885_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 101) {\n goto STATE_3110; /* 'e' */\n } else {\n goto STATE_2885_DROP_OUT; /* [-oo, 'd'] */\n }\n\nSTATE_2885_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2885_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2885_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2885_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2885_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2886:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2886\");\n\nSTATE_2886_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2886_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 116) {\n goto STATE_3023; /* 't' */\n } else {\n goto STATE_2886_DROP_OUT; /* [-oo, 's'] */\n }\n\nSTATE_2886_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2886_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2886_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2886_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2886_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2887:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2887\");\n\nSTATE_2887_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2887_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 105) {\n goto STATE_3091; /* 'i' */\n } else {\n goto STATE_2887_DROP_OUT; /* [-oo, 'h'] */\n }\n\nSTATE_2887_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2887_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2887_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2887_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2887_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2888:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2888\");\n\nSTATE_2888_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2888_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 99) {\n goto STATE_2917; /* 'c' */\n } else {\n goto STATE_2888_DROP_OUT; /* [-oo, 'b'] */\n }\n\nSTATE_2888_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2888_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2888_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2888_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2888_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2889:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2889\");\n\nSTATE_2889_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2889_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 110) {\n goto STATE_2888; /* 'n' */\n } else {\n goto STATE_2889_DROP_OUT; /* [-oo, 'm'] */\n }\n\nSTATE_2889_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2889_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2889_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2889_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2889_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2890:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2890\");\n\nSTATE_2890_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2890_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 97) {\n goto STATE_2889; /* 'a' */\n } else {\n goto STATE_2890_DROP_OUT; /* [-oo, '`'] */\n }\n\nSTATE_2890_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2890_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2890_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2890_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2890_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2891:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2891\");\n\nSTATE_2891_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2891_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 116) {\n goto STATE_2890; /* 't' */\n } else {\n goto STATE_2891_DROP_OUT; /* [-oo, 's'] */\n }\n\nSTATE_2891_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2891_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2891_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2891_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2891_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2892:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2892\");\n\nSTATE_2892_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2892_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 104) {\n goto STATE_3013; /* 'h' */\n } else {\n goto STATE_2892_DROP_OUT; /* [-oo, 'g'] */\n }\n\nSTATE_2892_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2892_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2892_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2892_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2892_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2893:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2893\");\n\nSTATE_2893_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2893_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 115) {\n goto STATE_2899; /* 's' */\n } else {\n goto STATE_2893_DROP_OUT; /* [-oo, 'r'] */\n }\n\nSTATE_2893_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2893_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2893_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2893_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2893_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2894:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2894\");\n\nSTATE_2894_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2894_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 116) {\n goto STATE_2896; /* 't' */\n } else {\n goto STATE_2894_DROP_OUT; /* [-oo, 's'] */\n }\n\nSTATE_2894_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2894_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2894_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2894_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2894_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2895:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2895\");\n\nSTATE_2895_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2895_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 114) {\n goto STATE_2859; /* 'r' */\n } else {\n goto STATE_2895_DROP_OUT; /* [-oo, 'q'] */\n }\n\nSTATE_2895_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2895_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2895_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2895_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2895_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2896:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2896\");\n\nSTATE_2896_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2896_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 104) {\n goto STATE_2895; /* 'h' */\n } else {\n goto STATE_2896_DROP_OUT; /* [-oo, 'g'] */\n }\n\nSTATE_2896_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2896_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2896_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2896_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2896_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2897:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2897\");\n\nSTATE_2897_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2897_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 111) {\n goto STATE_3122; /* 'o' */\n } else {\n goto STATE_2897_DROP_OUT; /* [-oo, 'n'] */\n }\n\nSTATE_2897_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2897_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2897_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2897_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2897_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2898:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2898\");\n\nSTATE_2898_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2898_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 105) {\n goto STATE_3121; /* 'i' */\n } else {\n goto STATE_2898_DROP_OUT; /* [-oo, 'h'] */\n }\n\nSTATE_2898_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2898_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2898_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2898_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2898_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2899:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2899\");\n\nSTATE_2899_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2899_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 104) {\n goto STATE_2901; /* 'h' */\n } else {\n goto STATE_2899_DROP_OUT; /* [-oo, 'g'] */\n }\n\nSTATE_2899_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2899_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2899_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2899_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2899_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2900:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2900\");\n\nSTATE_2900_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2900_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 108) {\n goto STATE_3114; /* 'l' */\n } else {\n goto STATE_2900_DROP_OUT; /* [-oo, 'k'] */\n }\n\nSTATE_2900_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2900_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2900_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2900_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2900_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2901:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2901\");\n\nSTATE_2901_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2901_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 111) {\n goto STATE_2900; /* 'o' */\n } else {\n goto STATE_2901_DROP_OUT; /* [-oo, 'n'] */\n }\n\nSTATE_2901_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2901_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2901_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2901_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2901_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2902:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2902\");\n\nSTATE_2902_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2902_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 100) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_113_DIRECT; /* 'd' */\n } else {\n goto STATE_2902_DROP_OUT; /* [-oo, 'c'] */\n }\n\nSTATE_2902_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2902_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2902_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2902_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2902_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2903:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2903\");\n\nSTATE_2903_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2903_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 108) {\n goto STATE_2902; /* 'l' */\n } else {\n goto STATE_2903_DROP_OUT; /* [-oo, 'k'] */\n }\n\nSTATE_2903_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2903_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2903_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2903_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2903_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2904:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2904\");\n\nSTATE_2904_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2904_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 111) {\n goto STATE_2903; /* 'o' */\n } else {\n goto STATE_2904_DROP_OUT; /* [-oo, 'n'] */\n }\n\nSTATE_2904_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2904_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2904_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2904_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2904_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2905:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2905\");\n\nSTATE_2905_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2905_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 79) {\n goto STATE_2907; /* 'O' */\n } else {\n goto STATE_2905_DROP_OUT; /* [-oo, 'N'] */\n }\n\nSTATE_2905_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2905_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2905_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2905_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2905_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2906:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2906\");\n\nSTATE_2906_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2906_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 104) {\n goto STATE_2904; /* 'h' */\n } else {\n goto STATE_2906_DROP_OUT; /* [-oo, 'g'] */\n }\n\nSTATE_2906_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2906_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2906_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2906_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2906_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2907:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2907\");\n\nSTATE_2907_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2907_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 76) {\n goto STATE_2909; /* 'L' */\n } else {\n goto STATE_2907_DROP_OUT; /* [-oo, 'K'] */\n }\n\nSTATE_2907_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2907_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2907_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2907_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2907_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2908:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2908\");\n\nSTATE_2908_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2908_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 115) {\n goto STATE_2906; /* 's' */\n } else {\n goto STATE_2908_DROP_OUT; /* [-oo, 'r'] */\n }\n\nSTATE_2908_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2908_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2908_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2908_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2908_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2909:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2909\");\n\nSTATE_2909_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2909_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 49) {\n goto STATE_2913; /* '1' */\n } else {\n goto STATE_2909_DROP_OUT; /* [-oo, '0'] */\n }\n\nSTATE_2909_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2909_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2909_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2909_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2909_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2910:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2910\");\n\nSTATE_2910_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2910_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 101) {\n goto STATE_2908; /* 'e' */\n } else {\n goto STATE_2910_DROP_OUT; /* [-oo, 'd'] */\n }\n\nSTATE_2910_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2910_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2910_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2910_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2910_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2911:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2911\");\n\nSTATE_2911_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2911_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 114) {\n goto STATE_2910; /* 'r' */\n } else {\n goto STATE_2911_DROP_OUT; /* [-oo, 'q'] */\n }\n\nSTATE_2911_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2911_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2911_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2911_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2911_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2912:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2912\");\n\nSTATE_2912_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2912_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 104) {\n goto STATE_2911; /* 'h' */\n } else {\n goto STATE_2912_DROP_OUT; /* [-oo, 'g'] */\n }\n\nSTATE_2912_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2912_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2912_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2912_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2912_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2913:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2913\");\n\nSTATE_2913_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2913_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 46) {\n goto STATE_2915; /* '.' */\n } else {\n goto STATE_2913_DROP_OUT; /* [-oo, '-'] */\n }\n\nSTATE_2913_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2913_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2913_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2913_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2913_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2914:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2914\");\n\nSTATE_2914_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2914_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 116) {\n goto STATE_2912; /* 't' */\n } else {\n goto STATE_2914_DROP_OUT; /* [-oo, 's'] */\n }\n\nSTATE_2914_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2914_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2914_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2914_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2914_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2915:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2915\");\n\nSTATE_2915_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2915_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 48) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_19_DIRECT; /* '0' */\n } else {\n goto STATE_2915_DROP_OUT; /* [-oo, '/'] */\n }\n\nSTATE_2915_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2915_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2915_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2915_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2915_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2916:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2916\");\n\nSTATE_2916_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2916_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 95) {\n goto STATE_2914; /* '_' */\n } else {\n goto STATE_2916_DROP_OUT; /* [-oo, '^'] */\n }\n\nSTATE_2916_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2916_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2916_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2916_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2916_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2917:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2917\");\n\nSTATE_2917_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2917_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 101) {\n goto STATE_2916; /* 'e' */\n } else {\n goto STATE_2917_DROP_OUT; /* [-oo, 'd'] */\n }\n\nSTATE_2917_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2917_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2917_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2917_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2917_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2918:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2918\");\n\nSTATE_2918_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2918_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 114) {\n goto STATE_2929; /* 'r' */\n } else {\n goto STATE_2918_DROP_OUT; /* [-oo, 'q'] */\n }\n\nSTATE_2918_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2918_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2918_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2918_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2918_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2919:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2919\");\n\nSTATE_2919_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2919_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 104) {\n goto STATE_2967; /* 'h' */\n } else {\n goto STATE_2919_DROP_OUT; /* [-oo, 'g'] */\n }\n\nSTATE_2919_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2919_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2919_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2919_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2919_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2920:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2920\");\n\nSTATE_2920_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2920_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 114) {\n goto STATE_3104; /* 'r' */\n } else {\n goto STATE_2920_DROP_OUT; /* [-oo, 'q'] */\n }\n\nSTATE_2920_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2920_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2920_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2920_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2920_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2921:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2921\");\n\nSTATE_2921_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2921_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 101) {\n goto STATE_2920; /* 'e' */\n } else {\n goto STATE_2921_DROP_OUT; /* [-oo, 'd'] */\n }\n\nSTATE_2921_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2921_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2921_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2921_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2921_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2922:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2922\");\n\nSTATE_2922_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2922_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 104) {\n goto STATE_2921; /* 'h' */\n } else {\n goto STATE_2922_DROP_OUT; /* [-oo, 'g'] */\n }\n\nSTATE_2922_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2922_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2922_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2922_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2922_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2923:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2923\");\n\nSTATE_2923_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2923_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 101) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_131_DIRECT; /* 'e' */\n } else {\n goto STATE_2923_DROP_OUT; /* [-oo, 'd'] */\n }\n\nSTATE_2923_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2923_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2923_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2923_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2923_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2924:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2924\");\n\nSTATE_2924_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2924_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 114) {\n goto STATE_2923; /* 'r' */\n } else {\n goto STATE_2924_DROP_OUT; /* [-oo, 'q'] */\n }\n\nSTATE_2924_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2924_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2924_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2924_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2924_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2925:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2925\");\n\nSTATE_2925_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2925_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 101) {\n goto STATE_2924; /* 'e' */\n } else {\n goto STATE_2925_DROP_OUT; /* [-oo, 'd'] */\n }\n\nSTATE_2925_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2925_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2925_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2925_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2925_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2926:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2926\");\n\nSTATE_2926_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2926_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 104) {\n goto STATE_2925; /* 'h' */\n } else {\n goto STATE_2926_DROP_OUT; /* [-oo, 'g'] */\n }\n\nSTATE_2926_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2926_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2926_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2926_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2926_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2927:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2927\");\n\nSTATE_2927_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2927_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 107) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_64_DIRECT; /* 'k' */\n } else {\n goto STATE_2927_DROP_OUT; /* [-oo, 'j'] */\n }\n\nSTATE_2927_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2927_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2927_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2927_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2927_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2928:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2928\");\n\nSTATE_2928_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2928_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 110) {\n goto STATE_2927; /* 'n' */\n } else {\n goto STATE_2928_DROP_OUT; /* [-oo, 'm'] */\n }\n\nSTATE_2928_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2928_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2928_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2928_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2928_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2929:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2929\");\n\nSTATE_2929_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2929_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 105) {\n goto STATE_2928; /* 'i' */\n } else {\n goto STATE_2929_DROP_OUT; /* [-oo, 'h'] */\n }\n\nSTATE_2929_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2929_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2929_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2929_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2929_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2930:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2930\");\n\nSTATE_2930_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2930_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 116) {\n goto STATE_3087; /* 't' */\n } else {\n goto STATE_2930_DROP_OUT; /* [-oo, 's'] */\n }\n\nSTATE_2930_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2930_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2930_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2930_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2930_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2931:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2931\");\n\nSTATE_2931_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2931_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 97) {\n goto STATE_2936; /* 'a' */\n } else {\n goto STATE_2931_DROP_OUT; /* [-oo, '`'] */\n }\n\nSTATE_2931_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2931_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2931_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2931_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2931_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2932:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2932\");\n\nSTATE_2932_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2932_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 114) {\n goto STATE_2930; /* 'r' */\n } else {\n goto STATE_2932_DROP_OUT; /* [-oo, 'q'] */\n }\n\nSTATE_2932_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2932_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2932_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2932_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2932_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2933:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2933\");\n\nSTATE_2933_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2933_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 101) {\n goto STATE_2932; /* 'e' */\n } else {\n goto STATE_2933_DROP_OUT; /* [-oo, 'd'] */\n }\n\nSTATE_2933_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2933_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2933_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2933_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2933_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2934:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2934\");\n\nSTATE_2934_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2934_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 99) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_25_DIRECT; /* 'c' */\n } else {\n goto STATE_2934_DROP_OUT; /* [-oo, 'b'] */\n }\n\nSTATE_2934_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2934_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2934_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2934_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2934_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2935:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2935\");\n\nSTATE_2935_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2935_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 105) {\n goto STATE_2934; /* 'i' */\n } else {\n goto STATE_2935_DROP_OUT; /* [-oo, 'h'] */\n }\n\nSTATE_2935_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2935_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2935_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2935_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2935_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2936:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2936\");\n\nSTATE_2936_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2936_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 116) {\n goto STATE_2935; /* 't' */\n } else {\n goto STATE_2936_DROP_OUT; /* [-oo, 's'] */\n }\n\nSTATE_2936_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2936_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2936_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2936_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2936_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2937:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2937\");\n\nSTATE_2937_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2937_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 112) {\n goto STATE_2991; /* 'p' */\n } else {\n goto STATE_2937_DROP_OUT; /* [-oo, 'o'] */\n }\n\nSTATE_2937_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2937_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2937_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2937_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2937_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2938:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2938\");\n\nSTATE_2938_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2938_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 100) {\n goto STATE_2958; /* 'd' */\n } else {\n goto STATE_2938_DROP_OUT; /* [-oo, 'c'] */\n }\n\nSTATE_2938_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2938_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2938_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2938_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2938_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2939:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2939\");\n\nSTATE_2939_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2939_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 110) {\n goto STATE_2954; /* 'n' */\n } else {\n goto STATE_2939_DROP_OUT; /* [-oo, 'm'] */\n }\n\nSTATE_2939_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2939_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2939_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2939_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2939_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2940:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2940\");\n\nSTATE_2940_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2940_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 108) {\n goto STATE_2950; /* 'l' */\n } else {\n goto STATE_2940_DROP_OUT; /* [-oo, 'k'] */\n }\n\nSTATE_2940_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2940_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2940_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2940_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2940_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2941:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2941\");\n\nSTATE_2941_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2941_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 110) {\n if( input != 109) {\n goto STATE_2941_DROP_OUT; /* [-oo, 'l'] */\n } else {\n goto STATE_2943; /* 'm' */\n }\n } else {\n if( input == 110) {\n goto STATE_2942; /* 'n' */\n } else {\n goto STATE_2941_DROP_OUT_DIRECT; /* ['o', oo] */\n }\n }\n\nSTATE_2941_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2941_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2941_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2941_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2941_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2942:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2942\");\n\nSTATE_2942_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2942_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 101) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_128_DIRECT; /* 'e' */\n } else {\n goto STATE_2942_DROP_OUT; /* [-oo, 'd'] */\n }\n\nSTATE_2942_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2942_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2942_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2942_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2942_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2943:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2943\");\n\nSTATE_2943_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2943_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 112) {\n goto STATE_2945; /* 'p' */\n } else {\n goto STATE_2943_DROP_OUT; /* [-oo, 'o'] */\n }\n\nSTATE_2943_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2943_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2943_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2943_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2943_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2944:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2944\");\n\nSTATE_2944_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2944_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 117) {\n goto STATE_2947; /* 'u' */\n } else {\n goto STATE_2944_DROP_OUT; /* [-oo, 't'] */\n }\n\nSTATE_2944_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2944_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2944_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2944_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2944_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2945:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2945\");\n\nSTATE_2945_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2945_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 111) {\n goto STATE_2944; /* 'o' */\n } else {\n goto STATE_2945_DROP_OUT; /* [-oo, 'n'] */\n }\n\nSTATE_2945_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2945_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2945_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2945_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2945_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2946:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2946\");\n\nSTATE_2946_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2946_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 100) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_116_DIRECT; /* 'd' */\n } else {\n goto STATE_2946_DROP_OUT; /* [-oo, 'c'] */\n }\n\nSTATE_2946_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2946_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2946_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2946_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2946_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2947:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2947\");\n\nSTATE_2947_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2947_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 110) {\n goto STATE_2946; /* 'n' */\n } else {\n goto STATE_2947_DROP_OUT; /* [-oo, 'm'] */\n }\n\nSTATE_2947_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2947_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2947_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2947_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2947_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2948:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2948\");\n\nSTATE_2948_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2948_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 100) {\n goto STATE_2952; /* 'd' */\n } else {\n goto STATE_2948_DROP_OUT; /* [-oo, 'c'] */\n }\n\nSTATE_2948_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2948_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2948_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2948_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2948_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2949:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2949\");\n\nSTATE_2949_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2949_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 110) {\n goto STATE_2948; /* 'n' */\n } else {\n goto STATE_2949_DROP_OUT; /* [-oo, 'm'] */\n }\n\nSTATE_2949_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2949_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2949_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2949_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2949_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2950:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2950\");\n\nSTATE_2950_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2950_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 105) {\n goto STATE_2949; /* 'i' */\n } else {\n goto STATE_2950_DROP_OUT; /* [-oo, 'h'] */\n }\n\nSTATE_2950_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2950_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2950_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2950_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2950_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2951:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2951\");\n\nSTATE_2951_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2951_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 114) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_125_DIRECT; /* 'r' */\n } else {\n goto STATE_2951_DROP_OUT; /* [-oo, 'q'] */\n }\n\nSTATE_2951_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2951_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2951_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2951_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2951_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2952:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2952\");\n\nSTATE_2952_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2952_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 101) {\n goto STATE_2951; /* 'e' */\n } else {\n goto STATE_2952_DROP_OUT; /* [-oo, 'd'] */\n }\n\nSTATE_2952_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2952_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2952_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2952_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2952_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2953:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2953\");\n\nSTATE_2953_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2953_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 102) {\n if( input != 101) {\n goto STATE_2953_DROP_OUT; /* [-oo, 'd'] */\n } else {\n goto STATE_2956; /* 'e' */\n }\n } else {\n if( input == 114) {\n goto STATE_2955; /* 'r' */\n } else {\n goto STATE_2953_DROP_OUT_DIRECT; /* ['f', 'q'] */\n }\n }\n\nSTATE_2953_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2953_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2953_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2953_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2953_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2954:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2954\");\n\nSTATE_2954_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2954_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 116) {\n goto STATE_2953; /* 't' */\n } else {\n goto STATE_2954_DROP_OUT; /* [-oo, 's'] */\n }\n\nSTATE_2954_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2954_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2954_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2954_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2954_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2955:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2955\");\n\nSTATE_2955_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2955_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 101) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_76_DIRECT; /* 'e' */\n } else {\n goto STATE_2955_DROP_OUT; /* [-oo, 'd'] */\n }\n\nSTATE_2955_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2955_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2955_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2955_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2955_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2956:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2956\");\n\nSTATE_2956_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2956_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 114) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_76_DIRECT; /* 'r' */\n } else {\n goto STATE_2956_DROP_OUT; /* [-oo, 'q'] */\n }\n\nSTATE_2956_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2956_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2956_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2956_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2956_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2957:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2957\");\n\nSTATE_2957_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2957_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 110) {\n if( input != 109) {\n goto STATE_2957_DROP_OUT; /* [-oo, 'l'] */\n } else {\n goto STATE_2980; /* 'm' */\n }\n } else {\n if( input == 115) {\n goto STATE_2959; /* 's' */\n } else {\n goto STATE_2957_DROP_OUT_DIRECT; /* ['n', 'r'] */\n }\n }\n\nSTATE_2957_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2957_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_2957_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2957_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2957_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2958:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2958\");\n\nSTATE_2958_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2958_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 95) {\n goto STATE_2957; /* '_' */\n } else {\n goto STATE_2958_DROP_OUT; /* [-oo, '^'] */\n }\n\nSTATE_2958_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2958_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2958_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2958_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2958_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2959:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2959\");\n\nSTATE_2959_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2959_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 119) {\n goto STATE_2961; /* 'w' */\n } else {\n goto STATE_2959_DROP_OUT; /* [-oo, 'v'] */\n }\n\nSTATE_2959_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2959_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2959_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2959_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2959_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2960:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2960\");\n\nSTATE_2960_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2960_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 112) {\n goto STATE_2963; /* 'p' */\n } else {\n goto STATE_2960_DROP_OUT; /* [-oo, 'o'] */\n }\n\nSTATE_2960_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2960_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2960_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2960_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2960_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2961:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2961\");\n\nSTATE_2961_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2961_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 101) {\n goto STATE_2960; /* 'e' */\n } else {\n goto STATE_2961_DROP_OUT; /* [-oo, 'd'] */\n }\n\nSTATE_2961_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2961_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2961_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2961_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2961_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2962:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2962\");\n\nSTATE_2962_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2962_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 95) {\n goto STATE_2965; /* '_' */\n } else {\n goto STATE_2962_DROP_OUT; /* [-oo, '^'] */\n }\n\nSTATE_2962_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2962_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2962_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2962_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2962_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2963:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2963\");\n\nSTATE_2963_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2963_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 116) {\n goto STATE_2962; /* 't' */\n } else {\n goto STATE_2963_DROP_OUT; /* [-oo, 's'] */\n }\n\nSTATE_2963_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2963_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2963_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2963_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2963_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2964:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2964\");\n\nSTATE_2964_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2964_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 112) {\n goto STATE_2919; /* 'p' */\n } else {\n goto STATE_2964_DROP_OUT; /* [-oo, 'o'] */\n }\n\nSTATE_2964_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2964_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2964_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2964_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2964_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2965:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2965\");\n\nSTATE_2965_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2965_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 115) {\n goto STATE_2964; /* 's' */\n } else {\n goto STATE_2965_DROP_OUT; /* [-oo, 'r'] */\n }\n\nSTATE_2965_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2965_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2965_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2965_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2965_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2966:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2966\");\n\nSTATE_2966_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2966_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 114) {\n goto STATE_2880; /* 'r' */\n } else {\n goto STATE_2966_DROP_OUT; /* [-oo, 'q'] */\n }\n\nSTATE_2966_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2966_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2966_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2966_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2966_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2967:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2967\");\n\nSTATE_2967_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2967_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 101) {\n goto STATE_2966; /* 'e' */\n } else {\n goto STATE_2967_DROP_OUT; /* [-oo, 'd'] */\n }\n\nSTATE_2967_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2967_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2967_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2967_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2967_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2968:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2968\");\n\nSTATE_2968_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2968_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 114) {\n goto STATE_2971; /* 'r' */\n } else {\n goto STATE_2968_DROP_OUT; /* [-oo, 'q'] */\n }\n\nSTATE_2968_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2968_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2968_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2968_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2968_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2969:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2969\");\n\nSTATE_2969_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2969_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 95) {\n goto STATE_2968; /* '_' */\n } else {\n goto STATE_2969_DROP_OUT; /* [-oo, '^'] */\n }\n\nSTATE_2969_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2969_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2969_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2969_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2969_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2970:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2970\");\n\nSTATE_2970_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2970_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 100) {\n goto STATE_2974; /* 'd' */\n } else {\n goto STATE_2970_DROP_OUT; /* [-oo, 'c'] */\n }\n\nSTATE_2970_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2970_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2970_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2970_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2970_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2971:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2971\");\n\nSTATE_2971_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2971_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 97) {\n goto STATE_2981; /* 'a' */\n } else {\n goto STATE_2971_DROP_OUT; /* [-oo, '`'] */\n }\n\nSTATE_2971_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2971_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2971_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2971_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2971_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2972:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2972\");\n\nSTATE_2972_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2972_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 117) {\n goto STATE_3034; /* 'u' */\n } else {\n goto STATE_2972_DROP_OUT; /* [-oo, 't'] */\n }\n\nSTATE_2972_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2972_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2972_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2972_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2972_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2973:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2973\");\n\nSTATE_2973_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2973_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 116) {\n goto STATE_2982; /* 't' */\n } else {\n goto STATE_2973_DROP_OUT; /* [-oo, 's'] */\n }\n\nSTATE_2973_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2973_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2973_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2973_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2973_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2974:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2974\");\n\nSTATE_2974_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2974_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 105) {\n goto STATE_3007; /* 'i' */\n } else {\n goto STATE_2974_DROP_OUT; /* [-oo, 'h'] */\n }\n\nSTATE_2974_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2974_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2974_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2974_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2974_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2975:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2975\");\n\nSTATE_2975_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2975_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 115) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_55_DIRECT; /* 's' */\n } else {\n goto STATE_2975_DROP_OUT; /* [-oo, 'r'] */\n }\n\nSTATE_2975_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2975_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2975_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2975_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2975_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2976:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2976\");\n\nSTATE_2976_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2976_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 117) {\n goto STATE_2975; /* 'u' */\n } else {\n goto STATE_2976_DROP_OUT; /* [-oo, 't'] */\n }\n\nSTATE_2976_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2976_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2976_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2976_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2976_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2977:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2977\");\n\nSTATE_2977_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2977_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 105) {\n goto STATE_2976; /* 'i' */\n } else {\n goto STATE_2977_DROP_OUT; /* [-oo, 'h'] */\n }\n\nSTATE_2977_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2977_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2977_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2977_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2977_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2978:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2978\");\n\nSTATE_2978_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2978_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 116) {\n goto STATE_2882; /* 't' */\n } else {\n goto STATE_2978_DROP_OUT; /* [-oo, 's'] */\n }\n\nSTATE_2978_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2978_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2978_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2978_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2978_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2979:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2979\");\n\nSTATE_2979_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2979_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 97) {\n goto STATE_2771; /* 'a' */\n } else {\n goto STATE_2979_DROP_OUT; /* [-oo, '`'] */\n }\n\nSTATE_2979_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2979_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2979_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2979_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2979_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2980:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2980\");\n\nSTATE_2980_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2980_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 111) {\n goto STATE_2989; /* 'o' */\n } else {\n goto STATE_2980_DROP_OUT; /* [-oo, 'n'] */\n }\n\nSTATE_2980_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2980_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2980_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2980_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2980_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2981:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2981\");\n\nSTATE_2981_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2981_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 100) {\n goto STATE_2977; /* 'd' */\n } else {\n goto STATE_2981_DROP_OUT; /* [-oo, 'c'] */\n }\n\nSTATE_2981_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2981_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2981_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2981_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2981_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2982:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2982\");\n\nSTATE_2982_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2982_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 117) {\n goto STATE_3008; /* 'u' */\n } else {\n goto STATE_2982_DROP_OUT; /* [-oo, 't'] */\n }\n\nSTATE_2982_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2982_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2982_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2982_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2982_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2983:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2983\");\n\nSTATE_2983_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2983_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 110) {\n goto STATE_3005; /* 'n' */\n } else {\n goto STATE_2983_DROP_OUT; /* [-oo, 'm'] */\n }\n\nSTATE_2983_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2983_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2983_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2983_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2983_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2984:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2984\");\n\nSTATE_2984_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2984_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 111) {\n goto STATE_2983; /* 'o' */\n } else {\n goto STATE_2984_DROP_OUT; /* [-oo, 'n'] */\n }\n\nSTATE_2984_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2984_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2984_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2984_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2984_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2985:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2985\");\n\nSTATE_2985_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2985_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 100) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_52_DIRECT; /* 'd' */\n } else {\n goto STATE_2985_DROP_OUT; /* [-oo, 'c'] */\n }\n\nSTATE_2985_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2985_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2985_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2985_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2985_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2986:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2986\");\n\nSTATE_2986_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2986_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 105) {\n goto STATE_2984; /* 'i' */\n } else {\n goto STATE_2986_DROP_OUT; /* [-oo, 'h'] */\n }\n\nSTATE_2986_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2986_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2986_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2986_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2986_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2987:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2987\");\n\nSTATE_2987_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2987_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 108) {\n goto STATE_2985; /* 'l' */\n } else {\n goto STATE_2987_DROP_OUT; /* [-oo, 'k'] */\n }\n\nSTATE_2987_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2987_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2987_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2987_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2987_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2988:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2988\");\n\nSTATE_2988_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2988_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 111) {\n goto STATE_2987; /* 'o' */\n } else {\n goto STATE_2988_DROP_OUT; /* [-oo, 'n'] */\n }\n\nSTATE_2988_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2988_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2988_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2988_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2988_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2989:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2989\");\n\nSTATE_2989_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2989_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 116) {\n goto STATE_2986; /* 't' */\n } else {\n goto STATE_2989_DROP_OUT; /* [-oo, 's'] */\n }\n\nSTATE_2989_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2989_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2989_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2989_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2989_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2990:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2990\");\n\nSTATE_2990_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2990_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 117) {\n goto STATE_2995; /* 'u' */\n } else {\n goto STATE_2990_DROP_OUT; /* [-oo, 't'] */\n }\n\nSTATE_2990_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2990_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2990_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2990_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2990_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2991:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2991\");\n\nSTATE_2991_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2991_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 115) {\n goto STATE_2990; /* 's' */\n } else {\n goto STATE_2991_DROP_OUT; /* [-oo, 'r'] */\n }\n\nSTATE_2991_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2991_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2991_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2991_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2991_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2992:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2992\");\n\nSTATE_2992_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2992_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 104) {\n goto STATE_2988; /* 'h' */\n } else {\n goto STATE_2992_DROP_OUT; /* [-oo, 'g'] */\n }\n\nSTATE_2992_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2992_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2992_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2992_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2992_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2993:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2993\");\n\nSTATE_2993_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2993_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 101) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_137_DIRECT; /* 'e' */\n } else {\n goto STATE_2993_DROP_OUT; /* [-oo, 'd'] */\n }\n\nSTATE_2993_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2993_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2993_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2993_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2993_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2994:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2994\");\n\nSTATE_2994_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2994_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 115) {\n goto STATE_2992; /* 's' */\n } else {\n goto STATE_2994_DROP_OUT; /* [-oo, 'r'] */\n }\n\nSTATE_2994_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2994_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2994_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2994_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2994_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2995:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2995\");\n\nSTATE_2995_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2995_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 108) {\n goto STATE_2993; /* 'l' */\n } else {\n goto STATE_2995_DROP_OUT; /* [-oo, 'k'] */\n }\n\nSTATE_2995_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2995_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2995_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2995_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2995_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2996:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2996\");\n\nSTATE_2996_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2996_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 116) {\n goto STATE_2854; /* 't' */\n } else {\n goto STATE_2996_DROP_OUT; /* [-oo, 's'] */\n }\n\nSTATE_2996_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2996_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2996_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2996_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2996_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2997:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2997\");\n\nSTATE_2997_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2997_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 115) {\n goto STATE_2996; /* 's' */\n } else {\n goto STATE_2997_DROP_OUT; /* [-oo, 'r'] */\n }\n\nSTATE_2997_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2997_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2997_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2997_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2997_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2998:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2998\");\n\nSTATE_2998_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2998_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 101) {\n goto STATE_2994; /* 'e' */\n } else {\n goto STATE_2998_DROP_OUT; /* [-oo, 'd'] */\n }\n\nSTATE_2998_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2998_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2998_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2998_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2998_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_2999:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2999\");\n\nSTATE_2999_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2999_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 114) {\n goto STATE_2998; /* 'r' */\n } else {\n goto STATE_2999_DROP_OUT; /* [-oo, 'q'] */\n }\n\nSTATE_2999_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2999_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_2999_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_2999_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_2999_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3000:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3000\");\n\nSTATE_3000_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3000_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 104) {\n goto STATE_2999; /* 'h' */\n } else {\n goto STATE_3000_DROP_OUT; /* [-oo, 'g'] */\n }\n\nSTATE_3000_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3000_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3000_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3000_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3000_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3001:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3001\");\n\nSTATE_3001_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3001_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 110) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_37_DIRECT; /* 'n' */\n } else {\n goto STATE_3001_DROP_OUT; /* [-oo, 'm'] */\n }\n\nSTATE_3001_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3001_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3001_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3001_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3001_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3002:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3002\");\n\nSTATE_3002_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3002_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 116) {\n goto STATE_3000; /* 't' */\n } else {\n goto STATE_3002_DROP_OUT; /* [-oo, 's'] */\n }\n\nSTATE_3002_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3002_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3002_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3002_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3002_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3003:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3003\");\n\nSTATE_3003_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3003_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 111) {\n goto STATE_3001; /* 'o' */\n } else {\n goto STATE_3003_DROP_OUT; /* [-oo, 'n'] */\n }\n\nSTATE_3003_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3003_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3003_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3003_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3003_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3004:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3004\");\n\nSTATE_3004_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3004_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 115) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_87_DIRECT; /* 's' */\n } else {\n goto STATE_3004_DROP_OUT; /* [-oo, 'r'] */\n }\n\nSTATE_3004_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3004_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3004_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3004_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3004_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3005:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3005\");\n\nSTATE_3005_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3005_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 95) {\n goto STATE_3002; /* '_' */\n } else {\n goto STATE_3005_DROP_OUT; /* [-oo, '^'] */\n }\n\nSTATE_3005_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3005_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3005_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3005_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3005_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3006:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3006\");\n\nSTATE_3006_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3006_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 105) {\n goto STATE_3003; /* 'i' */\n } else {\n goto STATE_3006_DROP_OUT; /* [-oo, 'h'] */\n }\n\nSTATE_3006_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3006_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3006_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3006_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3006_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3007:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3007\");\n\nSTATE_3007_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3007_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 117) {\n goto STATE_3004; /* 'u' */\n } else {\n goto STATE_3007_DROP_OUT; /* [-oo, 't'] */\n }\n\nSTATE_3007_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3007_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3007_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3007_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3007_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3008:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3008\");\n\nSTATE_3008_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3008_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 116) {\n goto STATE_3006; /* 't' */\n } else {\n goto STATE_3008_DROP_OUT; /* [-oo, 's'] */\n }\n\nSTATE_3008_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3008_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3008_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3008_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3008_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3009:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3009\");\n\nSTATE_3009_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3009_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 108) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_119_DIRECT; /* 'l' */\n } else {\n goto STATE_3009_DROP_OUT; /* [-oo, 'k'] */\n }\n\nSTATE_3009_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3009_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3009_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3009_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3009_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3010:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3010\");\n\nSTATE_3010_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3010_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 108) {\n goto STATE_3009; /* 'l' */\n } else {\n goto STATE_3010_DROP_OUT; /* [-oo, 'k'] */\n }\n\nSTATE_3010_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3010_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3010_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3010_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3010_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3011:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3011\");\n\nSTATE_3011_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3011_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 103) {\n goto STATE_2892; /* 'g' */\n } else {\n goto STATE_3011_DROP_OUT; /* [-oo, 'f'] */\n }\n\nSTATE_3011_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3011_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3011_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3011_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3011_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3012:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3012\");\n\nSTATE_3012_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3012_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 105) {\n goto STATE_3011; /* 'i' */\n } else {\n goto STATE_3012_DROP_OUT; /* [-oo, 'h'] */\n }\n\nSTATE_3012_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3012_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3012_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3012_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3012_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3013:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3013\");\n\nSTATE_3013_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3013_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 116) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_90_DIRECT; /* 't' */\n } else {\n goto STATE_3013_DROP_OUT; /* [-oo, 's'] */\n }\n\nSTATE_3013_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3013_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3013_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3013_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3013_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3014:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3014\");\n\nSTATE_3014_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3014_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 110) {\n if( input != 109) {\n goto STATE_3014_DROP_OUT; /* [-oo, 'l'] */\n } else {\n goto STATE_2878; /* 'm' */\n }\n } else {\n if( input == 115) {\n goto STATE_2886; /* 's' */\n } else {\n goto STATE_3014_DROP_OUT_DIRECT; /* ['n', 'r'] */\n }\n }\n\nSTATE_3014_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3014_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_3014_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3014_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3014_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3015:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3015\");\n\nSTATE_3015_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3015_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 115) {\n goto STATE_3018; /* 's' */\n } else {\n goto STATE_3015_DROP_OUT; /* [-oo, 'r'] */\n }\n\nSTATE_3015_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3015_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3015_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3015_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3015_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3016:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3016\");\n\nSTATE_3016_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3016_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 110) {\n goto STATE_3015; /* 'n' */\n } else {\n goto STATE_3016_DROP_OUT; /* [-oo, 'm'] */\n }\n\nSTATE_3016_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3016_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3016_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3016_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3016_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3017:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3017\");\n\nSTATE_3017_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3017_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 111) {\n goto STATE_3020; /* 'o' */\n } else {\n goto STATE_3017_DROP_OUT; /* [-oo, 'n'] */\n }\n\nSTATE_3017_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3017_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3017_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3017_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3017_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3018:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3018\");\n\nSTATE_3018_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3018_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 105) {\n goto STATE_3017; /* 'i' */\n } else {\n goto STATE_3018_DROP_OUT; /* [-oo, 'h'] */\n }\n\nSTATE_3018_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3018_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3018_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3018_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3018_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3019:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3019\");\n\nSTATE_3019_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3019_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 115) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_84_DIRECT; /* 's' */\n } else {\n goto STATE_3019_DROP_OUT; /* [-oo, 'r'] */\n }\n\nSTATE_3019_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3019_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3019_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3019_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3019_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3020:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3020\");\n\nSTATE_3020_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3020_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 110) {\n goto STATE_3019; /* 'n' */\n } else {\n goto STATE_3020_DROP_OUT; /* [-oo, 'm'] */\n }\n\nSTATE_3020_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3020_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3020_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3020_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3020_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3021:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3021\");\n\nSTATE_3021_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3021_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 99) {\n goto STATE_3024; /* 'c' */\n } else {\n goto STATE_3021_DROP_OUT; /* [-oo, 'b'] */\n }\n\nSTATE_3021_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3021_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3021_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3021_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3021_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3022:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3022\");\n\nSTATE_3022_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3022_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 110) {\n goto STATE_3021; /* 'n' */\n } else {\n goto STATE_3022_DROP_OUT; /* [-oo, 'm'] */\n }\n\nSTATE_3022_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3022_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3022_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3022_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3022_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3023:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3023\");\n\nSTATE_3023_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3023_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 97) {\n goto STATE_3022; /* 'a' */\n } else {\n goto STATE_3023_DROP_OUT; /* [-oo, '`'] */\n }\n\nSTATE_3023_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3023_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3023_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3023_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3023_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3024:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3024\");\n\nSTATE_3024_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3024_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 101) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_93_DIRECT; /* 'e' */\n } else {\n goto STATE_3024_DROP_OUT; /* [-oo, 'd'] */\n }\n\nSTATE_3024_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3024_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3024_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3024_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3024_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3025:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3025\");\n\nSTATE_3025_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3025_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 103) {\n goto STATE_2972; /* 'g' */\n } else {\n goto STATE_3025_DROP_OUT; /* [-oo, 'f'] */\n }\n\nSTATE_3025_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3025_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3025_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3025_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3025_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3026:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3026\");\n\nSTATE_3026_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3026_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 114) {\n goto STATE_3029; /* 'r' */\n } else {\n goto STATE_3026_DROP_OUT; /* [-oo, 'q'] */\n }\n\nSTATE_3026_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3026_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3026_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3026_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3026_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3027:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3027\");\n\nSTATE_3027_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3027_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 116) {\n goto STATE_3026; /* 't' */\n } else {\n goto STATE_3027_DROP_OUT; /* [-oo, 's'] */\n }\n\nSTATE_3027_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3027_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3027_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3027_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3027_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3028:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3028\");\n\nSTATE_3028_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3028_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 98) {\n goto STATE_3031; /* 'b' */\n } else {\n goto STATE_3028_DROP_OUT; /* [-oo, 'a'] */\n }\n\nSTATE_3028_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3028_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3028_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3028_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3028_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3029:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3029\");\n\nSTATE_3029_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3029_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 105) {\n goto STATE_3028; /* 'i' */\n } else {\n goto STATE_3029_DROP_OUT; /* [-oo, 'h'] */\n }\n\nSTATE_3029_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3029_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3029_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3029_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3029_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3030:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3030\");\n\nSTATE_3030_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3030_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 116) {\n goto STATE_3033; /* 't' */\n } else {\n goto STATE_3030_DROP_OUT; /* [-oo, 's'] */\n }\n\nSTATE_3030_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3030_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3030_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3030_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3030_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3031:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3031\");\n\nSTATE_3031_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3031_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 117) {\n goto STATE_3030; /* 'u' */\n } else {\n goto STATE_3031_DROP_OUT; /* [-oo, 't'] */\n }\n\nSTATE_3031_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3031_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3031_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3031_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3031_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3032:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3032\");\n\nSTATE_3032_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3032_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 115) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_22_DIRECT; /* 's' */\n } else {\n goto STATE_3032_DROP_OUT; /* [-oo, 'r'] */\n }\n\nSTATE_3032_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3032_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3032_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3032_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3032_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3033:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3033\");\n\nSTATE_3033_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3033_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 101) {\n goto STATE_3032; /* 'e' */\n } else {\n goto STATE_3033_DROP_OUT; /* [-oo, 'd'] */\n }\n\nSTATE_3033_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3033_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3033_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3033_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3033_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3034:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3034\");\n\nSTATE_3034_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3034_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 108) {\n goto STATE_3057; /* 'l' */\n } else {\n goto STATE_3034_DROP_OUT; /* [-oo, 'k'] */\n }\n\nSTATE_3034_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3034_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3034_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3034_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3034_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3035:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3035\");\n\nSTATE_3035_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3035_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 114) {\n goto STATE_2879; /* 'r' */\n } else {\n goto STATE_3035_DROP_OUT; /* [-oo, 'q'] */\n }\n\nSTATE_3035_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3035_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3035_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3035_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3035_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3036:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3036\");\n\nSTATE_3036_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3036_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 97) {\n goto STATE_3035; /* 'a' */\n } else {\n goto STATE_3036_DROP_OUT; /* [-oo, '`'] */\n }\n\nSTATE_3036_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3036_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3036_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3036_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3036_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3037:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3037\");\n\nSTATE_3037_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3037_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 101) {\n if( input != 100) {\n goto STATE_3037_DROP_OUT; /* [-oo, 'c'] */\n } else {\n goto STATE_3039; /* 'd' */\n }\n } else {\n if( input == 115) {\n goto STATE_3038; /* 's' */\n } else {\n goto STATE_3037_DROP_OUT_DIRECT; /* ['e', 'r'] */\n }\n }\n\nSTATE_3037_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3037_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_3037_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3037_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3037_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3038:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3038\");\n\nSTATE_3038_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3038_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 108) {\n goto STATE_2853; /* 'l' */\n } else {\n goto STATE_3038_DROP_OUT; /* [-oo, 'k'] */\n }\n\nSTATE_3038_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3038_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3038_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3038_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3038_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3039:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3039\");\n\nSTATE_3039_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3039_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 97) {\n goto STATE_2877; /* 'a' */\n } else {\n goto STATE_3039_DROP_OUT; /* [-oo, '`'] */\n }\n\nSTATE_3039_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3039_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3039_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3039_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3039_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3040:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3040\");\n\nSTATE_3040_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3040_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 112) {\n goto STATE_2887; /* 'p' */\n } else {\n goto STATE_3040_DROP_OUT; /* [-oo, 'o'] */\n }\n\nSTATE_3040_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3040_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3040_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3040_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3040_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3041:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3041\");\n\nSTATE_3041_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3041_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 103) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_43_DIRECT; /* 'g' */\n } else {\n goto STATE_3041_DROP_OUT; /* [-oo, 'f'] */\n }\n\nSTATE_3041_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3041_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3041_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3041_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3041_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3042:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3042\");\n\nSTATE_3042_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3042_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 110) {\n goto STATE_3041; /* 'n' */\n } else {\n goto STATE_3042_DROP_OUT; /* [-oo, 'm'] */\n }\n\nSTATE_3042_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3042_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3042_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3042_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3042_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3043:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3043\");\n\nSTATE_3043_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3043_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 105) {\n goto STATE_3042; /* 'i' */\n } else {\n goto STATE_3043_DROP_OUT; /* [-oo, 'h'] */\n }\n\nSTATE_3043_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3043_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3043_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3043_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3043_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3044:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3044\");\n\nSTATE_3044_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3044_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 112) {\n goto STATE_3043; /* 'p' */\n } else {\n goto STATE_3044_DROP_OUT; /* [-oo, 'o'] */\n }\n\nSTATE_3044_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3044_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3044_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3044_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3044_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3045:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3045\");\n\nSTATE_3045_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3045_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 112) {\n goto STATE_3107; /* 'p' */\n } else {\n goto STATE_3045_DROP_OUT; /* [-oo, 'o'] */\n }\n\nSTATE_3045_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3045_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3045_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3045_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3045_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3046:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3046\");\n\nSTATE_3046_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3046_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 109) {\n goto STATE_3044; /* 'm' */\n } else {\n goto STATE_3046_DROP_OUT; /* [-oo, 'l'] */\n }\n\nSTATE_3046_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3046_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3046_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3046_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3046_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3047:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3047\");\n\nSTATE_3047_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3047_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 101) {\n goto STATE_3045; /* 'e' */\n } else {\n goto STATE_3047_DROP_OUT; /* [-oo, 'd'] */\n }\n\nSTATE_3047_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3047_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3047_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3047_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3047_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3048:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3048\");\n\nSTATE_3048_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3048_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 97) {\n goto STATE_3046; /* 'a' */\n } else {\n goto STATE_3048_DROP_OUT; /* [-oo, '`'] */\n }\n\nSTATE_3048_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3048_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3048_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3048_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3048_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3049:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3049\");\n\nSTATE_3049_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3049_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 100) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_49_DIRECT; /* 'd' */\n } else {\n goto STATE_3049_DROP_OUT; /* [-oo, 'c'] */\n }\n\nSTATE_3049_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3049_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3049_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3049_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3049_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3050:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3050\");\n\nSTATE_3050_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3050_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 108) {\n goto STATE_3049; /* 'l' */\n } else {\n goto STATE_3050_DROP_OUT; /* [-oo, 'k'] */\n }\n\nSTATE_3050_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3050_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3050_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3050_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3050_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3051:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3051\");\n\nSTATE_3051_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3051_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 111) {\n goto STATE_3050; /* 'o' */\n } else {\n goto STATE_3051_DROP_OUT; /* [-oo, 'n'] */\n }\n\nSTATE_3051_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3051_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3051_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3051_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3051_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3052:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3052\");\n\nSTATE_3052_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3052_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 101) {\n if( input != 100) {\n goto STATE_3052_DROP_OUT; /* [-oo, 'c'] */\n } else {\n goto STATE_3048; /* 'd' */\n }\n } else {\n if( input == 115) {\n goto STATE_3074; /* 's' */\n } else {\n goto STATE_3052_DROP_OUT_DIRECT; /* ['e', 'r'] */\n }\n }\n\nSTATE_3052_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3052_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_3052_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3052_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3052_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3053:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3053\");\n\nSTATE_3053_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3053_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 65) {\n if( input >= 48 && input < 58 ) {\n goto STATE_2822; /* ['0', '9'] */\n } else {\n goto STATE_3053_DROP_OUT; /* [-oo, '/'] */\n }\n } else {\n if( input < 97) {\n if( input < 91) {\n goto STATE_2822; /* ['A', 'Z'] */\n } else {\n goto STATE_3053_DROP_OUT_DIRECT; /* ['[', '`'] */\n }\n } else {\n if( input < 123) {\n goto STATE_2822; /* ['a', 'z'] */\n } else {\n goto STATE_3053_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n\nSTATE_3053_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3053_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_3053_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3053_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3053_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3054:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3054\");\n\nSTATE_3054_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3054_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 95) {\n goto STATE_3052; /* '_' */\n } else {\n goto STATE_3054_DROP_OUT; /* [-oo, '^'] */\n }\n\nSTATE_3054_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3054_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3054_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3054_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3054_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3055:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3055\");\n\nSTATE_3055_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3055_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 104) {\n goto STATE_3051; /* 'h' */\n } else {\n goto STATE_3055_DROP_OUT; /* [-oo, 'g'] */\n }\n\nSTATE_3055_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3055_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3055_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3055_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3055_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3056:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3056\");\n\nSTATE_3056_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3056_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 114) {\n goto STATE_3054; /* 'r' */\n } else {\n goto STATE_3056_DROP_OUT; /* [-oo, 'q'] */\n }\n\nSTATE_3056_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3056_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3056_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3056_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3056_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3057:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3057\");\n\nSTATE_3057_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3057_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 97) {\n goto STATE_3056; /* 'a' */\n } else {\n goto STATE_3057_DROP_OUT; /* [-oo, '`'] */\n }\n\nSTATE_3057_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3057_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3057_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3057_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3057_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3058:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3058\");\n\nSTATE_3058_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3058_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 47) {\n if( input != 46) {\n goto STATE_3058_DROP_OUT; /* [-oo, '-'] */\n } else {\n goto STATE_2843; /* '.' */\n }\n } else {\n if( input >= 48 && input < 58 ) {\n goto STATE_3058; /* ['0', '9'] */\n } else {\n goto STATE_3058_DROP_OUT_DIRECT; /* '/' */\n }\n }\n\nSTATE_3058_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3058_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_3058_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3058_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3058_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3059:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3059\");\n\nSTATE_3059_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3059_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 115) {\n goto STATE_3055; /* 's' */\n } else {\n goto STATE_3059_DROP_OUT; /* [-oo, 'r'] */\n }\n\nSTATE_3059_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3059_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3059_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3059_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3059_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3060:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3060\");\n\nSTATE_3060_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3060_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 101) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_134_DIRECT; /* 'e' */\n } else {\n goto STATE_3060_DROP_OUT; /* [-oo, 'd'] */\n }\n\nSTATE_3060_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3060_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3060_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3060_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3060_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3061:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3061\");\n\nSTATE_3061_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3061_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 101) {\n goto STATE_3059; /* 'e' */\n } else {\n goto STATE_3061_DROP_OUT; /* [-oo, 'd'] */\n }\n\nSTATE_3061_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3061_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3061_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3061_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3061_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3062:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3062\");\n\nSTATE_3062_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3062_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 110) {\n goto STATE_3060; /* 'n' */\n } else {\n goto STATE_3062_DROP_OUT; /* [-oo, 'm'] */\n }\n\nSTATE_3062_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3062_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3062_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3062_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3062_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3063:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3063\");\n\nSTATE_3063_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3063_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 97) {\n goto STATE_3062; /* 'a' */\n } else {\n goto STATE_3063_DROP_OUT; /* [-oo, '`'] */\n }\n\nSTATE_3063_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3063_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3063_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3063_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3063_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3064:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3064\");\n\nSTATE_3064_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3064_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 114) {\n goto STATE_3061; /* 'r' */\n } else {\n goto STATE_3064_DROP_OUT; /* [-oo, 'q'] */\n }\n\nSTATE_3064_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3064_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3064_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3064_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3064_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3065:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3065\");\n\nSTATE_3065_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3065_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 104) {\n goto STATE_3064; /* 'h' */\n } else {\n goto STATE_3065_DROP_OUT; /* [-oo, 'g'] */\n }\n\nSTATE_3065_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3065_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3065_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3065_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3065_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3066:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3066\");\n\nSTATE_3066_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3066_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input >= 48 && input < 58 ) {\n goto STATE_2843; /* ['0', '9'] */\n } else {\n goto STATE_3066_DROP_OUT; /* [-oo, '/'] */\n }\n\nSTATE_3066_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3066_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3066_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3066_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3066_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3067:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3067\");\n\nSTATE_3067_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3067_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 116) {\n goto STATE_3065; /* 't' */\n } else {\n goto STATE_3067_DROP_OUT; /* [-oo, 's'] */\n }\n\nSTATE_3067_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3067_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3067_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3067_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3067_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3068:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3068\");\n\nSTATE_3068_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3068_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 114) {\n goto STATE_2869; /* 'r' */\n } else {\n goto STATE_3068_DROP_OUT; /* [-oo, 'q'] */\n }\n\nSTATE_3068_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3068_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3068_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3068_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3068_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3069:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3069\");\n\nSTATE_3069_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3069_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 95) {\n goto STATE_3067; /* '_' */\n } else {\n goto STATE_3069_DROP_OUT; /* [-oo, '^'] */\n }\n\nSTATE_3069_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3069_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3069_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3069_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3069_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3070:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3070\");\n\nSTATE_3070_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3070_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 112) {\n goto STATE_3069; /* 'p' */\n } else {\n goto STATE_3070_DROP_OUT; /* [-oo, 'o'] */\n }\n\nSTATE_3070_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3070_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3070_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3070_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3070_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3071:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3071\");\n\nSTATE_3071_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3071_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 101) {\n goto STATE_3070; /* 'e' */\n } else {\n goto STATE_3071_DROP_OUT; /* [-oo, 'd'] */\n }\n\nSTATE_3071_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3071_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3071_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3071_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3071_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3072:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3072\");\n\nSTATE_3072_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3072_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 102) {\n if( input != 101) {\n goto STATE_3072_DROP_OUT; /* [-oo, 'd'] */\n } else {\n goto STATE_3075; /* 'e' */\n }\n } else {\n if( input == 105) {\n goto STATE_3079; /* 'i' */\n } else {\n goto STATE_3072_DROP_OUT_DIRECT; /* ['f', 'h'] */\n }\n }\n\nSTATE_3072_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3072_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_3072_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3072_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3072_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3073:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3073\");\n\nSTATE_3073_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3073_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 101) {\n goto STATE_3071; /* 'e' */\n } else {\n goto STATE_3073_DROP_OUT; /* [-oo, 'd'] */\n }\n\nSTATE_3073_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3073_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3073_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3073_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3073_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3074:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3074\");\n\nSTATE_3074_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3074_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 108) {\n goto STATE_3073; /* 'l' */\n } else {\n goto STATE_3074_DROP_OUT; /* [-oo, 'k'] */\n }\n\nSTATE_3074_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3074_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3074_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3074_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3074_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3075:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3075\");\n\nSTATE_3075_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3075_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 120) {\n goto STATE_3078; /* 'x' */\n } else {\n goto STATE_3075_DROP_OUT; /* [-oo, 'w'] */\n }\n\nSTATE_3075_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3075_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3075_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3075_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3075_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3076:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3076\");\n\nSTATE_3076_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3076_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 99) {\n goto STATE_3111; /* 'c' */\n } else {\n goto STATE_3076_DROP_OUT; /* [-oo, 'b'] */\n }\n\nSTATE_3076_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3076_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3076_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3076_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3076_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3077:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3077\");\n\nSTATE_3077_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3077_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 115) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_105_DIRECT; /* 's' */\n } else {\n goto STATE_3077_DROP_OUT; /* [-oo, 'r'] */\n }\n\nSTATE_3077_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3077_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3077_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3077_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3077_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3078:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3078\");\n\nSTATE_3078_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3078_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 101) {\n goto STATE_3077; /* 'e' */\n } else {\n goto STATE_3078_DROP_OUT; /* [-oo, 'd'] */\n }\n\nSTATE_3078_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3078_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3078_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3078_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3078_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3079:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3079\");\n\nSTATE_3079_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3079_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 99) {\n goto STATE_3078; /* 'c' */\n } else {\n goto STATE_3079_DROP_OUT; /* [-oo, 'b'] */\n }\n\nSTATE_3079_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3079_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3079_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3079_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3079_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3080:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3080\");\n\nSTATE_3080_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3080_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 120) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_122_DIRECT; /* 'x' */\n } else {\n goto STATE_3080_DROP_OUT; /* [-oo, 'w'] */\n }\n\nSTATE_3080_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3080_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3080_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3080_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3080_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3081:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3081\");\n\nSTATE_3081_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3081_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 110) {\n goto STATE_2881; /* 'n' */\n } else {\n goto STATE_3081_DROP_OUT; /* [-oo, 'm'] */\n }\n\nSTATE_3081_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3081_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3081_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3081_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3081_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3082:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3082\");\n\nSTATE_3082_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3082_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 101) {\n goto STATE_3081; /* 'e' */\n } else {\n goto STATE_3082_DROP_OUT; /* [-oo, 'd'] */\n }\n\nSTATE_3082_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3082_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3082_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3082_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3082_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3083:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3083\");\n\nSTATE_3083_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3083_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 110) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_81_DIRECT; /* 'n' */\n } else {\n goto STATE_3083_DROP_OUT; /* [-oo, 'm'] */\n }\n\nSTATE_3083_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3083_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3083_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3083_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3083_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3084:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3084\");\n\nSTATE_3084_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3084_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 111) {\n goto STATE_3083; /* 'o' */\n } else {\n goto STATE_3084_DROP_OUT; /* [-oo, 'n'] */\n }\n\nSTATE_3084_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3084_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3084_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3084_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3084_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3085:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3085\");\n\nSTATE_3085_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3085_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 97) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_31_DIRECT; /* 'a' */\n } else {\n goto STATE_3085_DROP_OUT; /* [-oo, '`'] */\n }\n\nSTATE_3085_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3085_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3085_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3085_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3085_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3086:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3086\");\n\nSTATE_3086_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3086_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 105) {\n goto STATE_3084; /* 'i' */\n } else {\n goto STATE_3086_DROP_OUT; /* [-oo, 'h'] */\n }\n\nSTATE_3086_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3086_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3086_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3086_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3086_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3087:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3087\");\n\nSTATE_3087_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3087_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 105) {\n goto STATE_3085; /* 'i' */\n } else {\n goto STATE_3087_DROP_OUT; /* [-oo, 'h'] */\n }\n\nSTATE_3087_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3087_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3087_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3087_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3087_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3088:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3088\");\n\nSTATE_3088_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3088_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 116) {\n goto STATE_3086; /* 't' */\n } else {\n goto STATE_3088_DROP_OUT; /* [-oo, 's'] */\n }\n\nSTATE_3088_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3088_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3088_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3088_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3088_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3089:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3089\");\n\nSTATE_3089_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3089_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 110) {\n goto STATE_2856; /* 'n' */\n } else {\n goto STATE_3089_DROP_OUT; /* [-oo, 'm'] */\n }\n\nSTATE_3089_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3089_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3089_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3089_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3089_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3090:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3090\");\n\nSTATE_3090_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3090_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 103) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_40_DIRECT; /* 'g' */\n } else {\n goto STATE_3090_DROP_OUT; /* [-oo, 'f'] */\n }\n\nSTATE_3090_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3090_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3090_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3090_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3090_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3091:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3091\");\n\nSTATE_3091_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3091_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 110) {\n goto STATE_3090; /* 'n' */\n } else {\n goto STATE_3091_DROP_OUT; /* [-oo, 'm'] */\n }\n\nSTATE_3091_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3091_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3091_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3091_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3091_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3092:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3092\");\n\nSTATE_3092_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3092_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 100) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_46_DIRECT; /* 'd' */\n } else {\n goto STATE_3092_DROP_OUT; /* [-oo, 'c'] */\n }\n\nSTATE_3092_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3092_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3092_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3092_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3092_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3093:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3093\");\n\nSTATE_3093_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3093_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 108) {\n goto STATE_3092; /* 'l' */\n } else {\n goto STATE_3093_DROP_OUT; /* [-oo, 'k'] */\n }\n\nSTATE_3093_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3093_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3093_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3093_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3093_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3094:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3094\");\n\nSTATE_3094_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3094_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 111) {\n goto STATE_3093; /* 'o' */\n } else {\n goto STATE_3094_DROP_OUT; /* [-oo, 'n'] */\n }\n\nSTATE_3094_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3094_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3094_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3094_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3094_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3095:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3095\");\n\nSTATE_3095_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3095_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 116) {\n if( input < 114) {\n goto STATE_3095_DROP_OUT; /* [-oo, 'q'] */\n } else {\n if( input == 114) {\n goto STATE_3108; /* 'r' */\n } else {\n goto STATE_3106; /* 's' */\n }\n }\n } else {\n if( input < 120) {\n if( input == 116) {\n goto STATE_3116; /* 't' */\n } else {\n goto STATE_3095_DROP_OUT_DIRECT; /* ['u', 'w'] */\n }\n } else {\n if( input == 120) {\n goto STATE_3109; /* 'x' */\n } else {\n goto STATE_3095_DROP_OUT_DIRECT; /* ['y', oo] */\n }\n }\n }\n\nSTATE_3095_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3095_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_3095_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3095_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3095_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3096:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3096\");\n\nSTATE_3096_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3096_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 104) {\n goto STATE_3094; /* 'h' */\n } else {\n goto STATE_3096_DROP_OUT; /* [-oo, 'g'] */\n }\n\nSTATE_3096_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3096_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3096_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3096_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3096_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3097:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3097\");\n\nSTATE_3097_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3097_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 116) {\n goto STATE_2858; /* 't' */\n } else {\n goto STATE_3097_DROP_OUT; /* [-oo, 's'] */\n }\n\nSTATE_3097_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3097_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3097_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3097_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3097_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3098:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3098\");\n\nSTATE_3098_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3098_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 115) {\n goto STATE_3096; /* 's' */\n } else {\n goto STATE_3098_DROP_OUT; /* [-oo, 'r'] */\n }\n\nSTATE_3098_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3098_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3098_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3098_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3098_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3099:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3099\");\n\nSTATE_3099_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3099_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 108) {\n goto STATE_3097; /* 'l' */\n } else {\n goto STATE_3099_DROP_OUT; /* [-oo, 'k'] */\n }\n\nSTATE_3099_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3099_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3099_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3099_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3099_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3100:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3100\");\n\nSTATE_3100_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3100_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 112) {\n goto STATE_2922; /* 'p' */\n } else {\n goto STATE_3100_DROP_OUT; /* [-oo, 'o'] */\n }\n\nSTATE_3100_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3100_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3100_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3100_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3100_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3101:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3101\");\n\nSTATE_3101_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3101_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 101) {\n goto STATE_3098; /* 'e' */\n } else {\n goto STATE_3101_DROP_OUT; /* [-oo, 'd'] */\n }\n\nSTATE_3101_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3101_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3101_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3101_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3101_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3102:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3102\");\n\nSTATE_3102_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3102_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 114) {\n goto STATE_3101; /* 'r' */\n } else {\n goto STATE_3102_DROP_OUT; /* [-oo, 'q'] */\n }\n\nSTATE_3102_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3102_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3102_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3102_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3102_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3103:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3103\");\n\nSTATE_3103_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3103_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 104) {\n goto STATE_3102; /* 'h' */\n } else {\n goto STATE_3103_DROP_OUT; /* [-oo, 'g'] */\n }\n\nSTATE_3103_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3103_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3103_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3103_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3103_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3104:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3104\");\n\nSTATE_3104_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3104_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 101) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_140_DIRECT; /* 'e' */\n } else {\n goto STATE_3104_DROP_OUT; /* [-oo, 'd'] */\n }\n\nSTATE_3104_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3104_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3104_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3104_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3104_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3105:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3105\");\n\nSTATE_3105_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3105_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 116) {\n goto STATE_3103; /* 't' */\n } else {\n goto STATE_3105_DROP_OUT; /* [-oo, 's'] */\n }\n\nSTATE_3105_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3105_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3105_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3105_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3105_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3106:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3106\");\n\nSTATE_3106_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3106_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 115) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_28_DIRECT; /* 's' */\n } else {\n goto STATE_3106_DROP_OUT; /* [-oo, 'r'] */\n }\n\nSTATE_3106_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3106_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3106_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3106_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3106_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3107:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3107\");\n\nSTATE_3107_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3107_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 95) {\n goto STATE_3105; /* '_' */\n } else {\n goto STATE_3107_DROP_OUT; /* [-oo, '^'] */\n }\n\nSTATE_3107_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3107_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3107_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3107_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3107_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3108:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3108\");\n\nSTATE_3108_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3108_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 103) {\n goto STATE_3120; /* 'g' */\n } else {\n goto STATE_3108_DROP_OUT; /* [-oo, 'f'] */\n }\n\nSTATE_3108_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3108_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3108_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3108_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3108_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3109:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3109\");\n\nSTATE_3109_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3109_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 95) {\n goto STATE_2885; /* '_' */\n } else {\n goto STATE_3109_DROP_OUT; /* [-oo, '^'] */\n }\n\nSTATE_3109_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3109_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3109_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3109_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3109_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3110:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3110\");\n\nSTATE_3110_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3110_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 100) {\n goto STATE_2863; /* 'd' */\n } else {\n goto STATE_3110_DROP_OUT; /* [-oo, 'c'] */\n }\n\nSTATE_3110_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3110_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3110_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3110_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3110_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3111:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3111\");\n\nSTATE_3111_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3111_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 101) {\n goto STATE_3123; /* 'e' */\n } else {\n goto STATE_3111_DROP_OUT; /* [-oo, 'd'] */\n }\n\nSTATE_3111_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3111_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3111_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3111_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3111_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3112:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3112\");\n\nSTATE_3112_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3112_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 103) {\n goto STATE_3113; /* 'g' */\n } else {\n goto STATE_3112_DROP_OUT; /* [-oo, 'f'] */\n }\n\nSTATE_3112_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3112_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3112_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3112_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3112_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3113:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3113\");\n\nSTATE_3113_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3113_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 108) {\n goto STATE_2875; /* 'l' */\n } else {\n goto STATE_3113_DROP_OUT; /* [-oo, 'k'] */\n }\n\nSTATE_3113_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3113_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3113_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3113_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3113_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3114:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3114\");\n\nSTATE_3114_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3114_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 100) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_110_DIRECT; /* 'd' */\n } else {\n goto STATE_3114_DROP_OUT; /* [-oo, 'c'] */\n }\n\nSTATE_3114_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3114_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3114_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3114_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3114_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3115:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3115\");\n\nSTATE_3115_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3115_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 114) {\n goto STATE_2870; /* 'r' */\n } else {\n goto STATE_3115_DROP_OUT; /* [-oo, 'q'] */\n }\n\nSTATE_3115_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3115_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3115_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3115_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3115_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3116:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3116\");\n\nSTATE_3116_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3116_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 101) {\n goto STATE_3115; /* 'e' */\n } else {\n goto STATE_3116_DROP_OUT; /* [-oo, 'd'] */\n }\n\nSTATE_3116_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3116_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3116_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3116_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3116_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3117:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3117\");\n\nSTATE_3117_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3117_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 108) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_61_DIRECT; /* 'l' */\n } else {\n goto STATE_3117_DROP_OUT; /* [-oo, 'k'] */\n }\n\nSTATE_3117_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3117_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3117_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3117_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3117_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3118:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3118\");\n\nSTATE_3118_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3118_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 97) {\n goto STATE_3117; /* 'a' */\n } else {\n goto STATE_3118_DROP_OUT; /* [-oo, '`'] */\n }\n\nSTATE_3118_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3118_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3118_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3118_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3118_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3119:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3119\");\n\nSTATE_3119_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3119_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 110) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_58_DIRECT; /* 'n' */\n } else {\n goto STATE_3119_DROP_OUT; /* [-oo, 'm'] */\n }\n\nSTATE_3119_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3119_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3119_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3119_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3119_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3120:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3120\");\n\nSTATE_3120_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3120_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 105) {\n goto STATE_3119; /* 'i' */\n } else {\n goto STATE_3120_DROP_OUT; /* [-oo, 'h'] */\n }\n\nSTATE_3120_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3120_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3120_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3120_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3120_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3121:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3121\");\n\nSTATE_3121_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3121_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 99) {\n goto STATE_2978; /* 'c' */\n } else {\n goto STATE_3121_DROP_OUT; /* [-oo, 'b'] */\n }\n\nSTATE_3121_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3121_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3121_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3121_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3121_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3122:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3122\");\n\nSTATE_3122_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3122_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 110) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_34_DIRECT; /* 'n' */\n } else {\n goto STATE_3122_DROP_OUT; /* [-oo, 'm'] */\n }\n\nSTATE_3122_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3122_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3122_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3122_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3122_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3123:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3123\");\n\nSTATE_3123_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3123_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 115) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_107_DIRECT; /* 's' */\n } else {\n goto STATE_3123_DROP_OUT; /* [-oo, 'r'] */\n }\n\nSTATE_3123_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3123_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3123_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3123_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3123_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_3124:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3124\");\n\nSTATE_3124_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3124_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input == 114) {\n goto STATE_2851; /* 'r' */\n } else {\n goto STATE_3124_DROP_OUT; /* [-oo, 'q'] */\n }\n\nSTATE_3124_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3124_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_3124_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_3124_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_3124_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\n\n /* (*) Terminal states _______________________________________________________*/\n /**/\n /* Acceptance terminal states, i.e. the 'winner patterns'. This means*/\n /* that the last input dropped out of a state where the longest matching*/\n /* pattern was according to the terminal state. The terminal states are */\n /* numbered after the pattern id.*/\n /**/\n#define Lexeme (me->buffer._lexeme_start_p)\n#define LexemeBegin (me->buffer._lexeme_start_p)\n#define LexemeEnd (me->buffer._input_p)\n#define LexemeL (size_t)(me->buffer._input_p - me->buffer._lexeme_start_p)\nTERMINAL_128:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_128\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_128_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_128_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(4);\n \n #line 111 \"tcol_lexer.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_CONE); return;\n #else\n self.send(); return QUEX_TKN_CONE;\n #endif\n#line 13329 \"tcol_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_131:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_131\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_131_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_131_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(6);\n \n #line 112 \"tcol_lexer.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_SPHERE); return;\n #else\n self.send(); return QUEX_TKN_SPHERE;\n #endif\n#line 13355 \"tcol_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_5:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_5\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_5_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_5_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count(Lexeme, LexemeEnd);\n \n #line 71 \"tcol_lexer.qx\"\n \n#line 13377 \"tcol_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_134:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_134\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_134_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_134_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(5);\n \n #line 113 \"tcol_lexer.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_PLANE); return;\n #else\n self.send(); return QUEX_TKN_PLANE;\n #endif\n#line 13403 \"tcol_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_137:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_137\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_137_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_137_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(7);\n \n #line 114 \"tcol_lexer.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_CAPSULE); return;\n #else\n self.send(); return QUEX_TKN_CAPSULE;\n #endif\n#line 13429 \"tcol_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_140:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_140\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_140_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_140_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(11);\n \n #line 115 \"tcol_lexer.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_MULTISPHERE); return;\n #else\n self.send(); return QUEX_TKN_MULTISPHERE;\n #endif\n#line 13455 \"tcol_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_14:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_14\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_14_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_14_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(LexemeL);\n \n #line 72 \"tcol_lexer.qx\"\n \n#line 13477 \"tcol_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_143:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_143\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_143_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_143_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(7);\n \n #line 116 \"tcol_lexer.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_TRIMESH); return;\n #else\n self.send(); return QUEX_TKN_TRIMESH;\n #endif\n#line 13503 \"tcol_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_16:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_16\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_16_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_16_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(2);\n \n #line 73 \"tcol_lexer.qx\"\n self << COMMENT; \n#line 13525 \"tcol_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_146:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_146\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_146_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_146_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(1);\n \n #line 119 \"tcol_lexer.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_SEMI); return;\n #else\n self.send(); return QUEX_TKN_SEMI;\n #endif\n#line 13551 \"tcol_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_19:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_19\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_19_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_19_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(7);\n \n #line 75 \"tcol_lexer.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_TCOL); return;\n #else\n self.send(); return QUEX_TKN_TCOL;\n #endif\n#line 13577 \"tcol_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_149:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_149\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_149_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_149_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(1);\n \n #line 120 \"tcol_lexer.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_LBRACE); return;\n #else\n self.send(); return QUEX_TKN_LBRACE;\n #endif\n#line 13603 \"tcol_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_22:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_22\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_22_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_22_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(10);\n \n #line 77 \"tcol_lexer.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_ATTRIBUTES); return;\n #else\n self.send(); return QUEX_TKN_ATTRIBUTES;\n #endif\n#line 13629 \"tcol_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_152:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_152\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_152_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_152_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(1);\n \n #line 121 \"tcol_lexer.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_RBRACE); return;\n #else\n self.send(); return QUEX_TKN_RBRACE;\n #endif\n#line 13655 \"tcol_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_25:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_25\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_25_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_25_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(6);\n \n #line 78 \"tcol_lexer.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_STATIC); return;\n #else\n self.send(); return QUEX_TKN_STATIC;\n #endif\n#line 13681 \"tcol_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_28:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_28\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_28_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_28_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(4);\n \n #line 79 \"tcol_lexer.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_MASS); return;\n #else\n self.send(); return QUEX_TKN_MASS;\n #endif\n#line 13707 \"tcol_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_31:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_31\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_31_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_31_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(7);\n \n #line 80 \"tcol_lexer.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_INERTIA); return;\n #else\n self.send(); return QUEX_TKN_INERTIA;\n #endif\n#line 13733 \"tcol_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_34:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_34\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_34_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_34_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(8);\n \n #line 81 \"tcol_lexer.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_FRICTION); return;\n #else\n self.send(); return QUEX_TKN_FRICTION;\n #endif\n#line 13759 \"tcol_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_291:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_291\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_291_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_291_DIRECT\");\n\n QuexBuffer_set_terminating_zero_for_lexeme(&me->buffer);\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(LexemeL);\n \n #line 124 \"tcol_lexer.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_FLOAT, Lexeme); return;\n #else\n self.send(Lexeme); return QUEX_TKN_FLOAT;\n #endif\n#line 13786 \"tcol_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_37:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_37\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_37_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_37_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(11);\n \n #line 82 \"tcol_lexer.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_RESTITUTION); return;\n #else\n self.send(); return QUEX_TKN_RESTITUTION;\n #endif\n#line 13812 \"tcol_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_167:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_167\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_167_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_167_DIRECT\");\n\n QuexBuffer_set_terminating_zero_for_lexeme(&me->buffer);\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count(Lexeme, LexemeEnd);\n \n #line 122 \"tcol_lexer.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_STRING, Lexeme); return;\n #else\n self.send(Lexeme); return QUEX_TKN_STRING;\n #endif\n#line 13839 \"tcol_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_40:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_40\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_40_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_40_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(14);\n \n #line 83 \"tcol_lexer.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_LINEAR_DAMPING); return;\n #else\n self.send(); return QUEX_TKN_LINEAR_DAMPING;\n #endif\n#line 13865 \"tcol_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_43:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_43\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_43_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_43_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(15);\n \n #line 84 \"tcol_lexer.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_ANGULAR_DAMPING); return;\n #else\n self.send(); return QUEX_TKN_ANGULAR_DAMPING;\n #endif\n#line 13891 \"tcol_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_46:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_46\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_46_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_46_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(22);\n \n #line 85 \"tcol_lexer.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_LINEAR_SLEEP_THRESHOLD); return;\n #else\n self.send(); return QUEX_TKN_LINEAR_SLEEP_THRESHOLD;\n #endif\n#line 13917 \"tcol_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_49:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_49\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_49_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_49_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(23);\n \n #line 86 \"tcol_lexer.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_ANGULAR_SLEEP_THRESHOLD); return;\n #else\n self.send(); return QUEX_TKN_ANGULAR_SLEEP_THRESHOLD;\n #endif\n#line 13943 \"tcol_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_52:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_52\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_52_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_52_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(20);\n \n #line 87 \"tcol_lexer.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_CCD_MOTION_THRESHOLD); return;\n #else\n self.send(); return QUEX_TKN_CCD_MOTION_THRESHOLD;\n #endif\n#line 13969 \"tcol_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_55:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_55\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_55_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_55_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(23);\n \n #line 88 \"tcol_lexer.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_CCD_SWEPT_SPHERE_RADIUS); return;\n #else\n self.send(); return QUEX_TKN_CCD_SWEPT_SPHERE_RADIUS;\n #endif\n#line 13995 \"tcol_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_58:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_58\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_58_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_58_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(6);\n \n #line 90 \"tcol_lexer.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_MARGIN); return;\n #else\n self.send(); return QUEX_TKN_MARGIN;\n #endif\n#line 14021 \"tcol_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_61:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_61\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_61_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_61_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(8);\n \n #line 91 \"tcol_lexer.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_MATERIAL); return;\n #else\n self.send(); return QUEX_TKN_MATERIAL;\n #endif\n#line 14047 \"tcol_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_64:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_64\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_64_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_64_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(6);\n \n #line 92 \"tcol_lexer.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_SHRINK); return;\n #else\n self.send(); return QUEX_TKN_SHRINK;\n #endif\n#line 14073 \"tcol_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_183:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_183\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\n /* TERMINAL_183_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_183_DIRECT\");\n\n QuexBuffer_set_terminating_zero_for_lexeme(&me->buffer);\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(LexemeL);\n \n #line 123 \"tcol_lexer.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_NATURAL, atoi((char*)Lexeme)); return;\n #else\n self.send(atoi((char*)Lexeme)); return QUEX_TKN_NATURAL;\n #endif\n#line 14101 \"tcol_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_76:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_76\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_76_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_76_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(6);\n \n #line 93 \"tcol_lexer.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_CENTRE); return;\n #else\n self.send(); return QUEX_TKN_CENTRE;\n #endif\n#line 14127 \"tcol_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_305:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_305\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_305_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_305_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(1);\n \n #line 126 \"tcol_lexer.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_UNKNOWN); return;\n #else\n self.send(); return QUEX_TKN_UNKNOWN;\n #endif\n#line 14153 \"tcol_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_78:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_78\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_78_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_78_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(6);\n \n #line 94 \"tcol_lexer.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_NORMAL); return;\n #else\n self.send(); return QUEX_TKN_NORMAL;\n #endif\n#line 14179 \"tcol_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_81:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_81\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_81_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_81_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(11);\n \n #line 95 \"tcol_lexer.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_ORIENTATION); return;\n #else\n self.send(); return QUEX_TKN_ORIENTATION;\n #endif\n#line 14205 \"tcol_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_84:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_84\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_84_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_84_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(10);\n \n #line 96 \"tcol_lexer.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_DIMENSIONS); return;\n #else\n self.send(); return QUEX_TKN_DIMENSIONS;\n #endif\n#line 14231 \"tcol_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_87:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_87\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_87_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_87_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(6);\n \n #line 97 \"tcol_lexer.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_RADIUS); return;\n #else\n self.send(); return QUEX_TKN_RADIUS;\n #endif\n#line 14257 \"tcol_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_90:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_90\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_90_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_90_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(6);\n \n #line 98 \"tcol_lexer.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_HEIGHT); return;\n #else\n self.send(); return QUEX_TKN_HEIGHT;\n #endif\n#line 14283 \"tcol_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_93:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_93\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_93_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_93_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(8);\n \n #line 99 \"tcol_lexer.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_DISTANCE); return;\n #else\n self.send(); return QUEX_TKN_DISTANCE;\n #endif\n#line 14309 \"tcol_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_105:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_105\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_105_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_105_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(8);\n \n #line 100 \"tcol_lexer.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_VERTEXES); return;\n #else\n self.send(); return QUEX_TKN_VERTEXES;\n #endif\n#line 14335 \"tcol_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_107:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_107\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_107_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_107_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(5);\n \n #line 101 \"tcol_lexer.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_FACES); return;\n #else\n self.send(); return QUEX_TKN_FACES;\n #endif\n#line 14361 \"tcol_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_110:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_110\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_110_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_110_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(24);\n \n #line 102 \"tcol_lexer.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_MAX_EDGE_ANGLE_THRESHOLD); return;\n #else\n self.send(); return QUEX_TKN_MAX_EDGE_ANGLE_THRESHOLD;\n #endif\n#line 14387 \"tcol_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_113:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_113\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_113_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_113_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(23);\n \n #line 103 \"tcol_lexer.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_EDGE_DISTANCE_THRESHOLD); return;\n #else\n self.send(); return QUEX_TKN_EDGE_DISTANCE_THRESHOLD;\n #endif\n#line 14413 \"tcol_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_302:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_302\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_302_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_302_DIRECT\");\n\n QuexBuffer_set_terminating_zero_for_lexeme(&me->buffer);\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(LexemeL);\n \n #line 125 \"tcol_lexer.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_HEX, Lexeme); return;\n #else\n self.send(Lexeme); return QUEX_TKN_HEX;\n #endif\n#line 14440 \"tcol_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_116:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_116\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_116_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_116_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(8);\n \n #line 107 \"tcol_lexer.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_COMPOUND); return;\n #else\n self.send(); return QUEX_TKN_COMPOUND;\n #endif\n#line 14466 \"tcol_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_119:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_119\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_119_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_119_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(4);\n \n #line 108 \"tcol_lexer.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_HULL); return;\n #else\n self.send(); return QUEX_TKN_HULL;\n #endif\n#line 14492 \"tcol_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_122:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_122\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_122_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_122_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(3);\n \n #line 109 \"tcol_lexer.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_BOX); return;\n #else\n self.send(); return QUEX_TKN_BOX;\n #endif\n#line 14518 \"tcol_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_125:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_125\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_125_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_125_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(8);\n \n #line 110 \"tcol_lexer.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_CYLINDER); return;\n #else\n self.send(); return QUEX_TKN_CYLINDER;\n #endif\n#line 14544 \"tcol_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\n\n\nTERMINAL_END_OF_STREAM:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_END_OF_STREAM\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.send(QUEX_TKN_TERMINATION);\n #ifdef __QUEX_OPTION_ANALYSER_RETURN_TYPE_IS_VOID\n return /*__QUEX_TOKEN_ID_TERMINATION*/;\n #else\n return __QUEX_TOKEN_ID_TERMINATION;\n #endif\n \n }\n }\n\n#ifdef __QUEX_OPTION_ANALYSER_RETURN_TYPE_IS_VOID\n return /*__QUEX_TOKEN_ID_TERMINATION*/;\n#else\n return __QUEX_TOKEN_ID_TERMINATION;\n#endif\n\nTERMINAL_DEFAULT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_DEFAULT\");\n\nme->buffer._input_p = me->buffer._lexeme_start_p;\nif( QuexBuffer_is_end_of_file(&me->buffer) ) {\n\n /* Next increment will stop on EOF character. */\n}\n\nelse {\n /* Step over nomatching character */\n QuexBuffer_input_p_increment(&me->buffer);\n}\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count(Lexeme, LexemeEnd);\n self.send(QUEX_TKN_TERMINATION);\n #ifdef __QUEX_OPTION_ANALYSER_RETURN_TYPE_IS_VOID\n return /*__QUEX_TOKEN_ID_TERMINATION*/;\n #else\n return __QUEX_TOKEN_ID_TERMINATION;\n #endif\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\n#undef Lexeme\n#undef LexemeBegin\n#undef LexemeEnd\n#undef LexemeL\n#ifndef __QUEX_OPTION_USE_COMPUTED_GOTOS\n__TERMINAL_ROUTER: {\n /* if last_acceptance => goto correspondent acceptance terminal state*/\n /* else => execute defaul action*/\n switch( last_acceptance ) {\n case 128: goto TERMINAL_128;\n case 131: goto TERMINAL_131;\n case 5: goto TERMINAL_5;\n case 134: goto TERMINAL_134;\n case 137: goto TERMINAL_137;\n case 140: goto TERMINAL_140;\n case 14: goto TERMINAL_14;\n case 143: goto TERMINAL_143;\n case 16: goto TERMINAL_16;\n case 146: goto TERMINAL_146;\n case 19: goto TERMINAL_19;\n case 149: goto TERMINAL_149;\n case 22: goto TERMINAL_22;\n case 152: goto TERMINAL_152;\n case 25: goto TERMINAL_25;\n case 28: goto TERMINAL_28;\n case 31: goto TERMINAL_31;\n case 34: goto TERMINAL_34;\n case 291: goto TERMINAL_291;\n case 37: goto TERMINAL_37;\n case 167: goto TERMINAL_167;\n case 40: goto TERMINAL_40;\n case 43: goto TERMINAL_43;\n case 46: goto TERMINAL_46;\n case 49: goto TERMINAL_49;\n case 52: goto TERMINAL_52;\n case 55: goto TERMINAL_55;\n case 58: goto TERMINAL_58;\n case 61: goto TERMINAL_61;\n case 64: goto TERMINAL_64;\n case 183: goto TERMINAL_183;\n case 76: goto TERMINAL_76;\n case 305: goto TERMINAL_305;\n case 78: goto TERMINAL_78;\n case 81: goto TERMINAL_81;\n case 84: goto TERMINAL_84;\n case 87: goto TERMINAL_87;\n case 90: goto TERMINAL_90;\n case 93: goto TERMINAL_93;\n case 105: goto TERMINAL_105;\n case 107: goto TERMINAL_107;\n case 110: goto TERMINAL_110;\n case 113: goto TERMINAL_113;\n case 302: goto TERMINAL_302;\n case 116: goto TERMINAL_116;\n case 119: goto TERMINAL_119;\n case 122: goto TERMINAL_122;\n case 125: goto TERMINAL_125;\n\n default: goto TERMINAL_DEFAULT;; /* nothing matched */\n }\n }\n#endif /* __QUEX_OPTION_USE_COMPUTED_GOTOS */\n\n \n__REENTRY_PREPARATION:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: __REENTRY_PREPARATION\");\n\n /* (*) Common point for **restarting** lexical analysis.\n * at each time when CONTINUE is called at the end of a pattern. */\n last_acceptance = QUEX_GOTO_TERMINAL_LABEL_INIT_VALUE;\n\n\n /* Post context positions do not have to be reset or initialized. If a state\n * is reached which is associated with 'end of post context' it is clear what\n * post context is meant. This results from the ways the state machine is \n * constructed. A post context positions live time looks like the following:\n *\n * (1) unitialized (don't care)\n * (1.b) on buffer reload it may, or may not be adapted (don't care)\n * (2) when a post context begin state is passed, the it is **SET** (now: take care)\n * (2.b) on buffer reload it **is adapted**.\n * (3) when a terminal state of the post context is reached (which can only be reached\n * for that particular post context, then the post context position is used\n * to reset the input position. */\n\n /* If a mode change happened, then the function must first return and\n * indicate that another mode function is to be called. At this point, \n * we to force a 'return' on a mode change. \n *\n * Pseudo Code: if( previous_mode != current_mode ) {\n * return 0;\n * }\n *\n * When the analyzer returns, the caller function has to watch if a mode change\n * occured. If not it can call this function again. */\n#if defined(QUEX_OPTION_AUTOMATIC_ANALYSIS_CONTINUATION_ON_MODE_CHANGE) || defined(QUEX_OPTION_ASSERTS)\n if( me->DEBUG_analyser_function_at_entry != me->current_analyser_function ) \n#endif\n { \n#if defined(QUEX_OPTION_AUTOMATIC_ANALYSIS_CONTINUATION_ON_MODE_CHANGE)\n# ifdef __QUEX_OPTION_ANALYSER_RETURN_TYPE_IS_VOID\n return /*__QUEX_TOKEN_ID_UNINITIALIZED*/;\n# else\n return __QUEX_TOKEN_ID_UNINITIALIZED;\n# endif\n#elif defined(QUEX_OPTION_ASSERTS)\n QUEX_ERROR_EXIT(\"Mode change without immediate return from the lexical analyser.\");\n#endif\n }\n\n goto __REENTRY;\n\n /* prevent compiler warning 'unused variable': use variables once in a part of the code*/\n /* that is never reached (and deleted by the compiler anyway).*/\n if( 0 == 1 ) {\n int unused = 0;\n unused = unused + COMMENT.id;\n unused = unused + MAIN.id;\n }\n}\n#include <quex/code_base/temporary_macros_off>\n#if ! defined(__QUEX_SETTING_PLAIN_C)\n} // namespace quex\n#endif\n" }, { "alpha_fraction": 0.3795093894004822, "alphanum_fraction": 0.3795093894004822, "avg_line_length": 45.13333511352539, "blob_id": "a1d0b2c74a9e052b69339a897853a709b9cc1a5e", "content_id": "6f691daa48361959c646808e5afa5481e2789096", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 693, "license_type": "permissive", "max_line_length": 69, "num_lines": 15, "path": "/dependencies/quex-0.34.1/demo/006/simple.qx", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "// -*- C++ -*-\nmode ONE_AND_ONLY\n{\n <<EOF>> => QUEX_TKN_TERMINATION;\n\n \"hey\" => QUEX_TKN_HEY________________(Lexeme);\n \"hallo\" => QUEX_TKN_HALLO______________(Lexeme);\n [a-z] => QUEX_TKN_LETTER_____________(Lexeme);\n (hey)+/hey => QUEX_TKN_HEY_P___HEY________(Lexeme);\n hey/(hey|hallo)+ => QUEX_TKN_HEY_____HEY_HALLO_P(Lexeme);\n (hey)+/((he[y]?)|hallo)+ => QUEX_TKN_HEY_P___HEY_ETC____(Lexeme);\n hey/hey => QUEX_TKN_HEY_____HEY________(Lexeme);\n heyhey => QUEX_TKN_HEY_HEY____________(Lexeme);\n [ \\n]+ => QUEX_TKN_WHITESPACE();\n}\n\n" }, { "alpha_fraction": 0.6516083478927612, "alphanum_fraction": 0.653500497341156, "avg_line_length": 32.55555725097656, "blob_id": "5085f3d8e7ce7cfc765429b0e06ea11b45dde5a0", "content_id": "482e25ad4b9d1e0c37bba24d84fd08be6735d4a8", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 4228, "license_type": "permissive", "max_line_length": 99, "num_lines": 126, "path": "/engine/vect_util.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#ifndef VECT_UTIL_H\n#define VECT_UTIL_H\n\n#include <vector>\n#include <algorithm>\n\n#include <centralised_log.h>\n\n/** Remove the element at index from the vector vect in O(1) time by popping it\n * from the back. */\ntemplate<class T> void vect_remove_fast (std::vector<T> &vect, size_t index)\n{\n APP_ASSERT(index < vect.size());\n // I would use std::swap at this point, but apparently that makes visual studio crash...\n if (index != vect.size()-1) {\n T tmp = vect[vect.size()-1];\n vect[index] = tmp;\n }\n vect.pop_back();\n}\n\n/** Inherit from this struct to get the index member variable required by\n * fast_erase_vector. */\nstruct fast_erase_index {\n size_t _index;\n};\n\nnamespace {\n /** A utility function to dereference a value if required. */\n template<class T> struct maybe_deref {\n static T &_ (T &v)\n {\n return v;\n }\n };\n\n /** A utility function to dereference a value if required. */\n template<class T> struct maybe_deref<T*> {\n static T &_ (T *v)\n {\n return *v;\n }\n };\n}\n\n/** A class that has most of the useful functionality of std::vector but has\n * O(1) removal time and no ordering guarantees. The vector can only contain\n * objects with a member variable called _index, which is updated to hold that\n * objects index when it is moved. Pointers to such objects are also allowed.\n * */\ntemplate<class T> class fast_erase_vector {\n public:\n\n /** Add an object to the vector. */\n void push_back (const T &v)\n {\n maybe_deref<T>::_(v)._index = vect.size();\n vect.push_back(v);\n }\n\n /** Remove an object from the vector. */\n void erase (const T &v)\n {\n size_t index = maybe_deref<T>::_(v)._index;\n vect_remove_fast(vect, index);\n if (vect.size() == index) return; // v happened to be at the end\n // vect[index] now contains something else, update it\n maybe_deref<T>::_(vect[index])._index = index;\n }\n\n /** Return the number of objects present. */\n size_t size (void) const { return vect.size(); }\n\n /** Remove all objects from the vector. */\n void clear (void) { vect.clear(); }\n\n /** Prepare the vector for holding the given number of objects. */\n void reserve (size_t n) { vect.reserve(n); }\n\n /** Vector capacity.\n *\n * Return the number of objects this vector can hold before it must reallocate its internal\n * memory.\n */\n size_t capacity (void) const { return vect.capacity(); }\n\n /** Look up a particular index.\n * Warning: This is only useful for iterations because the indexes are not stable. They change\n * during remove operations.\n */\n T &operator[] (size_t i) { return vect[i]; }\n\n /** Look up a particular index.\n * Warning: This is only useful for iterations because the indexes are not stable. They change\n * during remove operations.\n */\n const T &operator[] (size_t i) const { return vect[i]; }\n\n const std::vector<T> &rawVector (void) { return vect; }\n\n private:\n std::vector<T> vect;\n};\n\n#endif\n" }, { "alpha_fraction": 0.6889952421188354, "alphanum_fraction": 0.6909090876579285, "avg_line_length": 19.490196228027344, "blob_id": "517762092ac682b3edcb1be9642495f589200d1f", "content_id": "c357e962a255a91013ea819d3fb90c4bb523aa70", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 1045, "license_type": "permissive", "max_line_length": 97, "num_lines": 51, "path": "/engine/net/net.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "#include <sleep.h>\n\n#include <centralised_log.h>\n#include \"net.h\"\n\n#include \"net_manager.h\"\n\nstatic NetManager* netManager;\n\nvoid net_init()\n{\n netManager = new NetManager();\n}\n\nvoid net_shutdown(lua_State *L)\n{\n netManager->getCBTable().clear(L); //closing LuaPtrs\n \n delete netManager;\n}\n\nvoid net_process(lua_State* L)\n{\n APP_ASSERT(netManager != NULL);\n\n netManager->process(L);\n}\n\nvoid net_send(NetChannel channel, NetAddress& address, const char* packet, uint32_t packetLength)\n{\n APP_ASSERT(netManager != NULL);\n\n std::string s = std::string(packet, packetLength);\n netManager->sendPacket(channel, address, s);\n}\n\nbool net_get_loopback_packet(NetChannel channel, std::string& packet)\n{\n APP_ASSERT(netManager != NULL);\n\n return netManager->getLoopbackPacket(channel, packet);\n}\n\nvoid net_set_callbacks(ExternalTable& table, lua_State* L)\n{\n APP_ASSERT(netManager != NULL);\n\n netManager->setCBTable(table);\n \n table.clear(L); //ensure setNil() is called so we don't get LuaPtr shutdown error\n}\n" }, { "alpha_fraction": 0.6821114420890808, "alphanum_fraction": 0.6856305003166199, "avg_line_length": 30.574073791503906, "blob_id": "047401dcdf096b6d323404dccc7fbe2ba585eb5f", "content_id": "3f37cc35f82be445adc2ab87ebfdefb7febe4469", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 3410, "license_type": "permissive", "max_line_length": 105, "num_lines": 108, "path": "/engine/gfx/gfx_ranged_instances.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include \"../shared_ptr.h\"\n\nclass GfxRangedInstances;\ntypedef SharedPtr<GfxRangedInstances> GfxRangedInstancesPtr;\n\n\n#ifndef GFX_RANGED_INSTANCES_H\n#define GFX_RANGED_INSTANCES_H\n\n#include \"../streamer.h\"\n#include \"../cache_friendly_range_space_simd.h\"\n\n#include \"gfx_instances.h\"\n\nclass GfxRangedInstances : public GfxInstances, public StreamerCallback {\n\n protected:\n\n static const std::string className;\n\n GfxRangedInstances (const DiskResourcePtr<GfxMeshDiskResource> &mesh, const GfxNodePtr &par_);\n ~GfxRangedInstances ();\n\n struct Item {\n GfxRangedInstances *parent;\n int index; // maintained by the RangeSpace class\n Vector3 pos;\n Quaternion quat;\n bool activated;\n int activatedIndex;\n unsigned ticket;\n float renderingDistance;\n float lastFade;\n void updateSphere (const Vector3 &pos_, float r_)\n {\n renderingDistance = r_;\n pos = pos_;\n parent->mSpace.updateSphere(index, pos.x, pos.y, pos.z, r_);\n }\n void updateIndex (int index_) { index = index_; }\n float range2 (const Vector3 &new_pos) const\n {\n return (new_pos-pos).length2() / renderingDistance / renderingDistance;\n }\n float calcFade (float range2);\n };\n typedef std::vector<Item> Items;\n\n typedef CacheFriendlyRangeSpace<Item*> RS;\n typedef RS::Cargo Cargo;\n RS mSpace;\n Items items;\n Cargo activated;\n\n\n float mItemRenderingDistance;\n float mVisibility;\n float mStepSize;\n\n\n public:\n static GfxRangedInstancesPtr make (const std::string &mesh, const GfxNodePtr &par_=GfxNodePtr(NULL));\n\n void push_back (const SimpleTransform &t);\n void reserve (size_t s) {\n items.reserve(s);\n mSpace.reserve(s);\n }; \n size_t size (void) { return items.size(); }\n\n void registerMe (void);\n void unregisterMe (void);\n void update (const Vector3 &new_pos);\n void update (unsigned int inst, const Vector3 &pos, const Quaternion &q, float fade)\n { this->GfxInstances::update(inst, pos, q, fade); }\n\n public:\n\n virtual const Ogre::String& getMovableType (void) const\n {\n return className;\n }\n\n friend class SharedPtr<GfxRangedInstances>;\n};\n\n#endif\n" }, { "alpha_fraction": 0.6965000033378601, "alphanum_fraction": 0.6980000138282776, "avg_line_length": 33.482757568359375, "blob_id": "2000a27392c467c7dada3ec3e4bea753465c63f5", "content_id": "799feac3b3b2c70f583c9a109e022b6035fb7e76", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 4000, "license_type": "permissive", "max_line_length": 96, "num_lines": 116, "path": "/engine/dense_index_map.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\nclass DenseIndexMap;\n\n#ifndef DENSE_INDEX_MAP_H\n#define DENSE_INDEX_MAP_H\n\n#include <vector>\n\n// Maps fixed (sparse) indexes to a dense list, by keeping an internal\n// dense list of indexes that are reassigned to fill the holes.\n// The assignment of dense indexes changes often, but it never has any\n// 'holes'. On the other hand, sparse indexes may be unused sometimes, and\n// are retained in a free list for future use.\nclass DenseIndexMap {\n \n protected:\n\n // CLASS INVARIANT: freeList.size() + sparseIndexes.size() == denseIndexes.size()\n\n // Gives the sparse index of a given dense index\n std::vector<unsigned int> sparseIndexes;\n \n // Gives the dense index of a given sparse index\n std::vector<unsigned int> denseIndexes;\n\n // Unused sparse indexes\n std::vector<unsigned int> freeList;\n\n\n public:\n \n // Class does not do range checking internally, since indexes are often not computed\n // This utility function will check if an index is valid. Call it if you want.\n void sparseIndexValid (unsigned sparse_index) const;\n\n // Looking up an index from the free list in denseIndexes gets you 0xFFFF\n unsigned denseIndex (unsigned sparse_index) const { return denseIndexes[sparse_index]; }\n\n // Reserve is called implicitly by newIndex, or you can call it yourself.\n unsigned reserve (unsigned new_capacity); \n\n // Number of allocated indexes\n unsigned size (void) const { return sparseIndexes.size(); }\n\n // Number of reserved indexes\n unsigned capacity (void) const { return denseIndexes.size(); }\n\n // Return a new sparse index from the freeList and allocate space for it\n unsigned newSparseIndex (void);\n\n // Return an index to the pool\n void delSparseIndex (unsigned index);\n}; \n\n\ntemplate<class T> class DenseIndexMapWithCargo : public DenseIndexMap {\n\n protected:\n\n std::vector<T> cargo;\n\n public:\n\n T &operator [] (unsigned i) { return cargo[i]; }\n const T &operator [] (unsigned i) const { return cargo[i]; }\n\n unsigned newSparseIndex (const T &init)\n {\n unsigned i = DenseIndexMap::newSparseIndex();\n cargo.push_back(init);\n return i;\n }\n\n unsigned newSparseIndex (void) { return newSparseIndex(T()); }\n\n unsigned reserve (unsigned new_capacity)\n {\n new_capacity = DenseIndexMap::reserve(new_capacity);\n cargo.reserve(new_capacity);\n return new_capacity;\n }\n \n void delSparseIndex (unsigned index)\n {\n unsigned dense_index = denseIndexes[index];\n unsigned last = sparseIndexes.size()-1;\n if (dense_index != last) {\n // reorganise buffer to move last instance into the position of the one just removed\n cargo[dense_index] = cargo[last];\n }\n cargo.pop_back();\n DenseIndexMap::delSparseIndex(index);\n }\n};\n \n#endif\n" }, { "alpha_fraction": 0.6243496537208557, "alphanum_fraction": 0.6264308094978333, "avg_line_length": 22.390243530273438, "blob_id": "18f8d8d6e3b96e935b55d325bce130588e282a93", "content_id": "0b15c9a7904232be2863af4f81e9ea68a8c58372", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 961, "license_type": "permissive", "max_line_length": 90, "num_lines": 41, "path": "/dependencies/quex-0.34.1/quex/code_base/template/token_sending_via_queue.i", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "// -*- C++ -*- vim:set syntax=cpp:\nnamespace quex { \n#ifdef QUEX_OPTION_DEBUG_TOKEN_SENDING\n# define __QUEX_DEBUG_TOKEN_SENDING() \\\n std::cerr << \"$$LEXER_CLASS_NAME$$::send \" << *(_token_queue->top()) << std::endl;\n#else\n# define __QUEX_DEBUG_TOKEN_SENDING() /* nothing */\n#endif\n\ninline void \nCLASS::send(const __QUEX_SETTING_TOKEN_CLASS_NAME& That) \n{\n _token_queue->push(That);\n __QUEX_DEBUG_TOKEN_SENDING();\n}\n\ninline void \nCLASS::send(const QUEX_TOKEN_ID_TYPE ID) \n{\n _token_queue->push(ID);\n __QUEX_DEBUG_TOKEN_SENDING();\n}\n\ninline void \nCLASS::send_n(const int N, QUEX_TOKEN_ID_TYPE ID) \n{\n __quex_assert(N > 0);\n for(int n=0; n < N; n++) send(ID); // applies DEBUG of 'send()'\n}\n\ntemplate <typename ContentT>\ninline void \nCLASS::send(const QUEX_TOKEN_ID_TYPE ID, ContentT Content) \n{\n _token_queue->push(ID, Content);\n __QUEX_DEBUG_TOKEN_SENDING();\n}\n\n} // namespace quex\n\n#undef __QUEX_DEBUG_TOKEN_SENDING\n\n\n" }, { "alpha_fraction": 0.65234375, "alphanum_fraction": 0.65234375, "avg_line_length": 41.63888931274414, "blob_id": "419dffddb0c283707c570ed85b93ddc38f100845", "content_id": "5ba646158478a7cf07928b130ee6fbfe02ffc0b9", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3072, "license_type": "permissive", "max_line_length": 99, "num_lines": 72, "path": "/dependencies/quex-0.34.1/quex/core_engine/generator/state_machine_decorator.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "from copy import deepcopy\nimport quex.core_engine.state_machine.dead_end_analysis as dead_end_analysis\n\nclass StateMachineDecorator:\n def __init__(self, SM, Name, PostContextSM_ID_List, \n BackwardLexingF, BackwardInputPositionDetectionF):\n assert SM.__class__.__name__ == \"StateMachine\"\n assert Name != \"\"\n assert type(BackwardInputPositionDetectionF) == bool\n assert type(BackwardLexingF) == bool\n assert not BackwardInputPositionDetectionF or BackwardLexingF == True, \\\n \"BackwardInputPositionDetectionF can only be set if BackwardLexingF is set.\"\n assert type(PostContextSM_ID_List) == list\n if BackwardInputPositionDetectionF: assert BackwardLexingF\n\n self.__name = Name\n self.__state_machine = SM\n self.__post_condition_id_list = deepcopy(PostContextSM_ID_List)\n self.__post_condition_id_list.sort()\n\n self.__mode = \"ForwardLexing\"\n if BackwardLexingF:\n if BackwardInputPositionDetectionF: self.__mode = \"BackwardInputPositionDetection\"\n else: self.__mode = \"BackwardLexing\"\n\n # -- collect the 'dead end states' (states without further transitions)\n # create a map from the 'dead end state\n self.__dead_end_state_db, self.__directly_reached_terminal_id_list = \\\n dead_end_analysis.do(SM)\n\n if BackwardLexingF:\n # During backward lexing (pre-condition, backward input position detection)\n # there are no dedicated terminal states in the first place.\n self.__directly_reached_terminal_id_list = []\n\n def name(self):\n return self.__name\n\n def mode(self):\n return self.__mode\n\n def backward_lexing_f(self):\n assert self.__mode in [\"ForwardLexing\", \"BackwardLexing\", \"BackwardInputPositionDetection\"]\n return self.__mode in [\"BackwardLexing\", \"BackwardInputPositionDetection\"] \n\n def forward_lexing_f(self):\n assert self.__mode in [\"ForwardLexing\", \"BackwardLexing\", \"BackwardInputPositionDetection\"]\n return not backward_lexing_f()\n\n def backward_input_position_detection_f(self):\n assert self.__mode in [\"ForwardLexing\", \"BackwardLexing\", \"BackwardInputPositionDetection\"]\n return self.__mode == \"BackwardInputPositionDetection\" \n\n def post_contexted_sm_id_list(self):\n return self.__post_condition_id_list\n\n def post_contexted_sm_n(self):\n return len(self.post_contexted_sm_id_list())\n\n def get_post_context_index(self, PostContextSM_ID):\n assert PostContextSM_ID in self.__post_condition_id_list, \\\n \"Error: request of post context state machine id which does not exist.\"\n return self.__post_condition_id_list.index(PostContextSM_ID)\n\n def sm(self):\n return self.__state_machine\n\n def dead_end_state_db(self):\n return self.__dead_end_state_db\n\n def directly_reached_terminal_id_list(self):\n self.__directly_reached_terminal_id_list\n\n\n" }, { "alpha_fraction": 0.4660971760749817, "alphanum_fraction": 0.47397223114967346, "avg_line_length": 38.02083206176758, "blob_id": "2c7d01f459c4d9439779908acdecb08c38b8324d", "content_id": "36ede3f96ab862bf4217febc5cb5e7657dacf604", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 7492, "license_type": "permissive", "max_line_length": 98, "num_lines": 192, "path": "/gtasa/colread.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <cstdlib>\n#include <cstring>\n#include <cerrno>\n#include <iostream>\n#include <fstream>\n\n#include \"ios_util.h\"\n#include \"physics/tcol_parser.h\"\n#include \"col_parser.h\"\n\n#define VERSION \"1.0\"\n\nconst char *info =\n\"colread (c) Dave Cunningham 2007 (version: \" VERSION \")\\n\"\n\"I can read COLL COL2 COL3 TCOL and BCOL files.\\n\"\n\"I can write TCOL and BCOL files.\\n\"\n\"Some TCOL features are preprocessed on read, such as hull shrinking.\\n\\n\";\n\nconst char *usage =\n\"Usage: colread { <opt> }\\n\\n\"\n\"where <opt> ::= \\\"-v\\\" | \\\"--verbose\\\" increase debug level\\n\"\n\" | \\\"-q\\\" | \\\"--quiet\\\" decrease debug level\\n\"\n\" | \\\"-h\\\" | \\\"--help\\\" this message\\n\\n\"\n\" | \\\"-i\\\" | \\\"--input\\\" <name> input file\\n\"\n\" | \\\"-o\\\" | \\\"--output\\\" <name> output file\\n\"\n\" (ignored if binary col found)\\n\\n\"\n\" | \\\"-B\\\" | \\\"--output-bcol\\\" output binary\\n\"\n\" | \\\"-T\\\" | \\\"--output-tcol\\\" output text (default)\\n\";\n\nstd::string next_arg(int& so_far, int argc, char **argv)\n{\n if (so_far==argc) {\n std::cerr<<\"Ran out of arguments.\"<<std::endl;\n std::cerr<<usage<<std::endl;\n exit(EXIT_FAILURE);\n }\n return argv[so_far++];\n}\n\nCentralisedLog clog;\nvoid app_fatal (void) { abort(); }\n\nvoid assert_triggered (void) { } \n\nint main(int argc, char **argv)\n{\n if (argc==1) {\n std::cout<<info<<std::endl;\n std::cout<<usage<<std::endl;\n return EXIT_SUCCESS;\n }\n\n // default parameters\n int debug_level = 0;\n bool output_binary_specified = false;\n bool output_binary = false;\n std::string input_filename;\n std::string output_filename;\n std::string mat_prefix;\n\n int so_far = 1;\n\n while (so_far<argc) {\n std::string arg = next_arg(so_far,argc,argv);\n if (arg==\"-v\" || arg==\"--verbose\") {\n debug_level++;\n } else if (arg==\"-q\" || arg==\"--quiet\") {\n debug_level--;\n } else if (arg==\"-i\" || arg==\"--input\") {\n input_filename = next_arg(so_far,argc,argv);\n } else if (arg==\"-o\" || arg==\"--output\") {\n output_filename = next_arg(so_far,argc,argv);\n } else if (arg==\"-B\" || arg==\"--output-bcol\") {\n output_binary = true;\n output_binary_specified = true;\n } else if (arg==\"-T\" || arg==\"--output-tcol\") {\n output_binary = false;\n output_binary_specified = true;\n } else if (arg==\"-m\" || arg==\"--material-prefix\") {\n mat_prefix = next_arg(so_far,argc,argv);\n } else if (arg==\"-h\" || arg==\"--help\") {\n std::cout<<info<<std::endl;\n std::cout<<usage<<std::endl;\n } else {\n std::cerr<<\"Unrecognised argument: \"<<arg<<std::endl;\n std::cerr<<usage<<std::endl;\n return EXIT_FAILURE;\n }\n }\n\n if (!output_binary_specified) {\n output_binary = output_filename.length()>=5 &&\n output_filename.substr(output_filename.length()-5)==\".bcol\";\n }\n\n std::istream *in = NULL;\n std::ostream *out = NULL;\n\n init_global_db();\n\n try {\n\n if (input_filename==\"\" || input_filename==\"-\") {\n in = &std::cin;\n } else {\n std::ifstream *in_ = new std::ifstream();\n in = in_;\n in_->open(input_filename.c_str(), std::ios::binary);\n APP_ASSERT_IO_SUCCESSFUL(*in_,\n \"opening \"+input_filename);\n }\n\n unsigned long fourcc = ios_peek_u32(*in);\n APP_ASSERT_IO_SUCCESSFUL(*in,\"reading fourcc\");\n\n if (fourcc==0x4c4f4354) { //TCOL\n\n TColFile tcol;\n\n quex::tcol_lexer* qlex =\n new quex::tcol_lexer(in);\n parse_tcol_1_0(input_filename,qlex,tcol);\n delete qlex;\n\n if (output_filename==\"\"||output_filename==\"-\") {\n out = &std::cout;\n } else {\n std::ofstream *out_=new std::ofstream();\n out = out_;\n out_->open(output_filename.c_str(),\n std::ios::binary);\n APP_ASSERT_IO_SUCCESSFUL(*out_,\n \"opening \"+output_filename);\n }\n if (output_binary) {\n //write_tcol_as_bcol(*out, tcol);\n } else {\n pretty_print_tcol(*out,tcol);\n }\n\n } else if (fourcc==0x4c4f4342) { //BCOL\n GRIT_EXCEPT(\"Reading bcol not implemented.\");\n } else if (fourcc==0x4c4c4f43) { // COLL\n dump_all_cols(*in,output_binary,mat_prefix,global_db,debug_level);\n } else if (fourcc==0x324c4f43) { // COL2\n dump_all_cols(*in,output_binary,mat_prefix,global_db,debug_level);\n } else if (fourcc==0x334c4f43) { // COL3\n dump_all_cols(*in,output_binary,mat_prefix,global_db,debug_level);\n } else {\n GRIT_EXCEPT(\"Unrecognised fourcc tag.\");\n }\n\n\n } catch (const Exception &e) {\n\n CERR << e << std::endl;\n\n if (in!=&std::cin) delete in;\n if (out!=&std::cout) delete out;\n\n return EXIT_FAILURE;\n\n }\n\n if (in!=&std::cin) delete in;\n if (out!=&std::cout) delete out;\n\n return EXIT_SUCCESS;\n}\n\n// vim: shiftwidth=8:tabstop=8:expandtab\n" }, { "alpha_fraction": 0.682311475276947, "alphanum_fraction": 0.6934345960617065, "avg_line_length": 33.76415252685547, "blob_id": "02e160072efc4105b1eb1c0a746a60b73888836a", "content_id": "a6b298c7105c985d602ead8adffc51b7d1adae36", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 3686, "license_type": "permissive", "max_line_length": 100, "num_lines": 106, "path": "/engine/bullet_debug_drawer.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n// Based on http://www.ogre3d.org/wiki/index.php/BulletDebugDrawer\n// copyright ownership unknown\n\n#include <centralised_log.h>\n\n#include \"bullet_debug_drawer.h\"\n#include \"gfx/gfx.h\"\n#include \"gfx/gfx_debug.h\"\n#include \"gfx/gfx_internal.h\"\n#include \"physics/physics_world.h\"\n\nstatic inline Vector3 from_bullet (const btVector3 &from)\n{ return Vector3(from.x(), from.y(), from.z()); }\n\nstatic inline Quaternion from_bullet (const btQuaternion &from)\n{ return Quaternion(from.w(), from.x(), from.y(), from.z()); }\n\nBulletDebugDrawer::BulletDebugDrawer (void)\n{\n contactPoints = &contactPoints1;\n mDebugModes = (DebugDrawModes) DBG_NoDebug;\n}\n\nBulletDebugDrawer::~BulletDebugDrawer (void)\n{\n}\n\nvoid BulletDebugDrawer::drawLine (const btVector3 &from, const btVector3 &to,\n const btVector3 &colour)\n{\n gfx_debug_line(from_bullet(from), from_bullet(to), from_bullet(colour), 1);\n}\n\nvoid BulletDebugDrawer::drawTriangle (const btVector3 &v0, const btVector3 &v1, const btVector3 &v2,\n const btVector3 &colour, btScalar alpha)\n{\n gfx_debug_triangle(from_bullet(v0), from_bullet(v1), from_bullet(v2),\n from_bullet(colour), alpha);\n}\n\nvoid BulletDebugDrawer::drawContactPoint (const btVector3 &point, const btVector3 &normal,\n btScalar distance, int life_time, const btVector3 &colour)\n{\n contactPoints->push_back(ContactPoint{\n from_bullet(point),\n from_bullet(point) + from_bullet(normal) * distance,\n from_bullet(colour),\n size_t(micros() + life_time),\n });\n}\n\nvoid BulletDebugDrawer::frameCallback (void)\n{\n size_t now = micros();\n std::vector<ContactPoint> *new_cps =\n contactPoints == &contactPoints1 ? &contactPoints2 : &contactPoints1;\n for (const auto &cp : *contactPoints) {\n gfx_debug_point(cp.from, 0.1, Vector3(1, 1, 1), 0.3);\n gfx_debug_line(cp.from, cp.to, cp.colour, 1.0);\n if (now <= cp.dieTime)\n new_cps->push_back(cp);\n }\n contactPoints->clear();\n contactPoints = new_cps;\n}\n\nvoid BulletDebugDrawer::reportErrorWarning (const char *warningString)\n{\n CVERB << warningString << std::endl;\n}\n\nvoid BulletDebugDrawer::draw3dText (const btVector3 &location, const char *textString)\n{\n (void) location; (void) textString;\n}\n\nvoid BulletDebugDrawer::setDebugMode (int debugMode)\n{\n mDebugModes = (DebugDrawModes) debugMode;\n}\n\nint BulletDebugDrawer::getDebugMode (void) const\n{\n return mDebugModes;\n}\n\n" }, { "alpha_fraction": 0.7052298188209534, "alphanum_fraction": 0.7052298188209534, "avg_line_length": 24.200000762939453, "blob_id": "f2c340ee250d9d8f2e668f664a8565dc1fbf9c25", "content_id": "fd92a9d1e98396b20aaf85f078df5265199a52c1", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Makefile", "length_bytes": 631, "license_type": "permissive", "max_line_length": 82, "num_lines": 25, "path": "/gtasa/grit.mk", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "\n# TODO: move the engine stuff into dependencies/grit-util or grit-col or whatever.\n# This should be easier once tcol is replaced with json.\nEXTRACT_CPP_SRCS=\\\n\t../engine/physics/bcol_parser.cpp \\\n\t../engine/physics/tcol_parser.cpp \\\n\t../engine/physics/tcol_lexer.cpp \\\n\t../engine/physics/tcol_parser.cpp \\\n\t../engine/physics/tcol_lexer-core-engine.cpp \\\n\t../engine/physics/bcol_parser.cpp \\\n\tcol_parser.cpp \\\n\tcsvread.cpp \\\n\tdffread.cpp \\\n\tdirutil.cpp \\\n\textract.cpp \\\n\thandling.cpp \\\n\tideread.cpp \\\n\timgread.cpp \\\n\tiplread.cpp \\\n\tprocobj.cpp \\\n\tsurfinfo.cpp \\\n\ttex_dups.cpp \\\n\ttxdread.cpp \\\n\nEXTRACT_INCLUDE_DIRS=\\\n ../engine\n" }, { "alpha_fraction": 0.5398654937744141, "alphanum_fraction": 0.5859750509262085, "avg_line_length": 23.20930290222168, "blob_id": "3d938ec651c86dd7893ada701e9ad2e10dffb512", "content_id": "7c73b74be88a3a8af3a596e6e487de7a1eaec953", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Lua", "length_bytes": 1041, "license_type": "permissive", "max_line_length": 63, "num_lines": 43, "path": "/engine/tests/engine/cubemap/cubemap.lua", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "gfx_colour_grade(`neutral.lut.png`)\ngfx_fade_dither_map `stipple.png`\n\ngfx_register_shader(`Ball`, {\n tex = {\n uniformKind = \"TEXTURE_CUBE\",\n },\n vertexCode = [[\n var pos_os = vert.position.xyz;\n var normal_os = vert.normal.xyz;\n var normal_ws = rotate_to_world(vert.normal.xyz);\n ]],\n dangsCode = [[\n out.diffuse = 0;\n out.gloss = 0;\n out.specular = 0;\n out.normal = normal_ws;\n ]],\n additionalCode = [[\n out.colour = gamma_decode(sample(mat.tex, pos_os).xyz);\n ]],\n})\n\nregister_material(`Ball`, {\n shader = `Ball`,\n tex = `cube.dds`,\n additionalLighting = true,\n})\n\nb1 = gfx_body_make(`Ball.mesh`)\nb1.localPosition = vec(-2, 5, 0)\nb1.localScale = vec(10, 10, 10)\n\nb2 = gfx_body_make(`Ball.mesh`)\nb2.localPosition = vec(0, 5, 0)\nb2.localScale = vec(10, 10, 10)\n\nb3 = gfx_body_make(`Ball.mesh`)\nb3.localPosition = vec(2, 5, 0)\nb3.localScale = vec(10, 10, 10)\n\ngfx_render(0.1, vec(0, 0, 0), quat(1, 0, 0, 0))\ngfx_screenshot('output-cubemap.png')\n" }, { "alpha_fraction": 0.6609686613082886, "alphanum_fraction": 0.6619183421134949, "avg_line_length": 22.93181800842285, "blob_id": "7b114d029f1107ee708b5e2ab6c8ffa61f622df9", "content_id": "320fc0740d0243169101911f5c9db702fa17feba", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 1053, "license_type": "permissive", "max_line_length": 72, "num_lines": 44, "path": "/dependencies/quex-0.34.1/demo/004/c_lexer.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "#include\"c_lexer\"\nnamespace quex {\n QuexMode c_lexer::PROGRAM;\n#define self (*me)\n\n void\n c_lexer_PROGRAM_on_entry(c_lexer* me, const QuexMode* FromMode) {\n#ifdef __QUEX_OPTION_RUNTIME_MODE_TRANSITION_CHECK\n__quex_assert(me->PROGRAM.has_entry_from(FromMode));\n#endif\n\n }\n\n void\n c_lexer_PROGRAM_on_exit(c_lexer* me, const QuexMode* ToMode) {\n#ifdef __QUEX_OPTION_RUNTIME_MODE_TRANSITION_CHECK\n__quex_assert(me->PROGRAM.has_exit_to(ToMode));\n#endif\n\n }\n\n#ifdef __QUEX_OPTION_INDENTATION_TRIGGER_SUPPORT \n void\n c_lexer_PROGRAM_on_indentation(c_lexer* me, const int Indentation) {\n__quex_assert(Indentation >= 0);\n }\n#endif\n\n#ifdef __QUEX_OPTION_RUNTIME_MODE_TRANSITION_CHECK\n bool\n c_lexer_PROGRAM_has_base(const QuexMode* Mode) {\n return false;\n }\n bool\n c_lexer_PROGRAM_has_entry_from(const QuexMode* Mode) {\n return true; // default\n }\n bool\n c_lexer_PROGRAM_has_exit_to(const QuexMode* Mode) {\n return true; // default\n }\n#endif \n#undef self\n} // END: namespace quex\n" }, { "alpha_fraction": 0.5853334665298462, "alphanum_fraction": 0.5906404256820679, "avg_line_length": 25.531200408935547, "blob_id": "81544c0129057e187da2e96019a7c6f4aaaf4655", "content_id": "4d2c24203457e8f65f1c1d1922bea977701bf81f", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 16582, "license_type": "permissive", "max_line_length": 97, "num_lines": 625, "path": "/engine/grit_object.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <cmath>\n\n#include \"main.h\"\n#include \"grit_object.h\"\n#include \"grit_class.h\"\n\n#include \"grit_lua_util.h\"\n#include \"lua_wrappers_gritobj.h\"\n\n\nstatic GObjMap objs;\nstatic GObjSet objs_needing_frame_callbacks;\nstatic GObjSet objs_needing_step_callbacks;\nstatic GObjPtrs loaded;\nstatic unsigned long long name_generation_counter;\n\nGritObject::GritObject (const std::string &name_,\n GritClass *gritClass_)\n : name(name_), \n anonymous(false),\n gritClass(gritClass_),\n lua(LUA_NOREF),\n needsFrameCallbacks(false),\n needsStepCallbacks(false),\n demandRegistered(false),\n imposedFarFade(1.0),\n lastFade(-1)\n{\n gritClass->acquire();\n} \n\nvoid GritObject::destroy (lua_State *L, const GritObjectPtr &self)\n{\n if (gritClass==NULL) return;;\n if (needsFrameCallbacks) {\n objs_needing_frame_callbacks.erase(self);\n }\n if (needsStepCallbacks) {\n objs_needing_step_callbacks.erase(self);\n }\n setNearObj(self, GritObjectPtr());\n setFarObj(self, GritObjectPtr());\n deactivate(L, self);\n gritClass->release(L);\n gritClass = NULL;\n tryUnloadResources();\n userValues.destroy(L);\n} \n\n\n\n\nvoid GritObject::notifyFade (lua_State *L,\n const GritObjectPtr &self,\n const float fade)\n{\n if (gritClass==NULL) GRIT_EXCEPT(\"Object destroyed\");\n\n if (!isActivated()) return;\n\n STACK_BASE;\n //stack is empty\n\n push_cfunction(L, my_lua_error_handler);\n int error_handler = lua_gettop(L);\n\n //stack: err\n\n // call into lua...\n //stack: err\n getField(L, \"setFade\");\n //stack: err, class, callback\n if (lua_isnil(L, -1)) {\n // TODO(dcunnin): We should add needsFadeCallbacks.\n // This might be part of a genreal overhaul of lod levels, etc.\n\n // no setFade function, do nothing\n lua_pop(L, 2);\n //stack is empty\n STACK_CHECK;\n return;\n }\n\n //stack: err, callback\n // we now have the callback to play with\n \n push_gritobj(L, self); // persistent grit obj\n lua_pushnumber(L, fade); // fade\n //stack: err, callback, persistent, fade\n int status = lua_pcall(L, 2, 0, error_handler);\n if (status) {\n //stack: err, msg\n // pop the error message since the error handler will\n // have already printed it out\n lua_pop(L, 1);\n object_del(L, self);\n //stack: err\n }\n //stack: err\n\n lua_pop(L, 1);\n //stack is empty\n STACK_CHECK;\n\n}\n\nvoid GritObject::activate (lua_State *L,\n const GritObjectPtr &self)\n{\n if (isActivated()) return;\n\n // can call in from lua after destroyed by deleteObject\n if (gritClass==NULL) GRIT_EXCEPT(\"Object destroyed\");\n\n if (!demand.loaded()) {\n // If it's not loaded yet then we must have been activated explicitly\n // i.e. not via the streamer, which waits until the demand is loaded.\n // Since it's an explicit activation, we better make sure it will work.\n try {\n demand.immediateLoad();\n } catch (Exception &e) {\n CERR << e << std::endl;\n CERR << \"Object: \\\"\" << name << \"\\\" raised an error on activation, so destroying it.\"\n << std::endl;\n // will deactivate us\n object_del(L, self);\n return;\n }\n\n }\n\n STACK_BASE;\n //stack is empty\n\n // error handler in case there is a problem during \n // the callback\n push_cfunction(L, my_lua_error_handler);\n int error_handler = lua_gettop(L);\n\n //stack: err\n\n //stack: err\n getField(L, \"activate\");\n //stack: err, callback\n if (lua_isnil(L, -1)) {\n // don't activate it as class does not have activate function\n // pop both the error handler and the nil activate function\n // and the table\n lua_pop(L, 3);\n CERR << \"activating object: \\\"\"<<name<<\"\\\": \"\n << \"class \\\"\"<<gritClass->name<<\"\\\" \"\n << \"does not have activate function\" << std::endl;\n object_del(L, self);\n STACK_CHECK;\n return;\n }\n\n //stack: err, callback\n STACK_CHECK_N(2);\n\n // Call activate callback:\n\n // push 4 args\n lua_checkstack(L, 5);\n //stack: err, callback\n push_gritobj(L, self); // persistent\n //stack: err, callback, persistent\n lua_newtable(L); // instance\n //stack: err, callback, persistent, instance\n lua_pushvalue(L, -1);\n //stack: err, callback, persistent, instance, instance\n lua = luaL_ref(L, LUA_REGISTRYINDEX); // set up the lua ref to the new instance\n //stack: err, callback, persistent, instance\n STACK_CHECK_N(4);\n\n // call (2 args), pops function too\n int status = lua_pcall(L, 2, 0, error_handler);\n if (status) {\n STACK_CHECK_N(2);\n //stack: err, error\n // pop the error message since the error handler will\n // have already printed it out\n lua_pop(L, 1);\n CERR << \"Object: \\\"\" << name << \"\\\" raised an error on activation, so destroying it.\"\n << std::endl;\n // will deactivate us\n object_del(L, self);\n //stack: err\n STACK_CHECK_N(1);\n } else {\n STACK_CHECK_N(1);\n //stack: err\n streamer_list_as_activated(self);\n lastFade = -1;\n }\n //stack: err\n\n STACK_CHECK_N(1);\n lua_pop(L, 1);\n //stack is empty\n STACK_CHECK;\n}\n\nfloat GritObject::calcFade (const float range2, bool &overlap)\n{\n // Windows prohibits use of variables called 'near' and 'far'.\n const GritObjectPtr &the_near = getNearObj();\n const GritObjectPtr &the_far = getFarObj();\n\n const float out = streamer_fade_out_factor;\n\n const float over = streamer_fade_overlap_factor;\n\n\n float range = ::sqrtf(range2);\n\n float fade = 1.0;\n // if near is not activated, farfade will be out of date\n if (!the_near.isNull() && the_near->isActivated()) {\n fade = the_near->getImposedFarFade();\n if (fade<1) overlap = true;\n }\n if (the_far.isNull()) {\n if (range > out) {\n fade = (1-range) / (1-out);\n }\n // doesn't actually do anything as there is no far\n imposedFarFade = 1.0;\n } else {\n //TODO: generalise hte following 2 options together\n const float overmid = (over + 1)/2;\n if (range > overmid) {\n fade = (1-range) / (1-overmid);\n imposedFarFade = 1;\n } else if (range > over) {\n imposedFarFade = 1 - (overmid-range) / (overmid-over);\n } else {\n imposedFarFade = 0;\n }\n }\n if (fade<0) fade = 0;\n if (imposedFarFade<0) imposedFarFade = 0;\n return fade;\n}\n\nbool GritObject::deactivate (lua_State *L, const GritObjectPtr &self)\n{\n if (gritClass==NULL) GRIT_EXCEPT(\"Object destroyed\");\n\n if (!isActivated()) return false;\n\n bool killme = false;\n\n streamer_unlist_as_activated(self);\n\n STACK_BASE;\n //stack is empty\n\n push_cfunction(L, my_lua_error_handler);\n int error_handler = lua_gettop(L);\n\n //stack: err\n\n //stack: err\n getField(L, \"deactivate\");\n //stack: err, callback\n if (lua_isnil(L, -1)) {\n lua_pop(L, 2);\n //stack is empty\n CERR << \"deactivating object: \\\"\"<<name<<\"\\\": \"\n << \"class \\\"\"<<gritClass->name<<\"\\\" \"\n << \"does not have deactivate function\" << std::endl;\n luaL_unref(L, LUA_REGISTRYINDEX, lua);\n lua = LUA_NOREF;\n\n STACK_CHECK;\n // returning true indicates the object will be erased\n // to prevent the error reoccuring\n return true;\n }\n\n //stack: err, callback\n // Make the call.\n\n push_gritobj(L, self); // persistent grit obj\n //stack: err, callback, self\n int status = lua_pcall(L, 1, 1, error_handler);\n if (status) {\n //stack: err, msg\n // pop the error message since the error handler will\n // have already printed it out\n lua_pop(L, 1);\n killme = true;\n //stack: err\n } else {\n //stack: err, killme\n killme = 0 != lua_toboolean(L, -1);\n lua_pop(L, 1);\n //stack: err\n }\n //stack: err\n\n luaL_unref(L, LUA_REGISTRYINDEX, lua);\n lua = LUA_NOREF;\n\n lua_pop(L, 1);\n //stack is empty\n STACK_CHECK;\n\n return killme;\n}\n\n\nvoid GritObject::init (lua_State *L, const GritObjectPtr &self)\n{\n if (gritClass==NULL) GRIT_EXCEPT(\"Object destroyed\");\n\n STACK_BASE;\n //stack is empty\n\n push_cfunction(L, my_lua_error_handler);\n int error_handler = lua_gettop(L);\n\n //stack: err\n\n //stack: err\n getField(L, \"init\");\n //stack: err, callback\n if (lua_isnil(L, -1)) {\n lua_pop(L, 2);\n //stack is empty\n STACK_CHECK;\n CERR << \"initializing object: \\\"\"<<name<<\"\\\": \"\n << \"class \\\"\"<<gritClass->name<<\"\\\" \"\n << \"does not have init function\" << std::endl;\n object_del(L, self);\n return;\n }\n\n // Call the callback.\n\n lua_checkstack(L, 2);\n push_gritobj(L, self); // persistent grit obj\n //stack: err, callback, persistent\n int status = lua_pcall(L, 1, 0, error_handler);\n if (status) {\n //stack: err, msg\n // pop the error message since the error handler will\n // have already printed it out\n lua_pop(L, 1);\n CERR << \"Object: \\\"\" << name << \"\\\" raised an error on initialization, so destroying it.\"\n << std::endl;\n // will deactivate us\n object_del(L, self);\n //stack: err\n }\n //stack: err\n\n lua_pop(L, 1);\n //stack is empty\n STACK_CHECK;\n\n}\n\nbool GritObject::frameCallback (lua_State *L, const GritObjectPtr &self, float elapsed)\n{\n if (gritClass==NULL) GRIT_EXCEPT(\"Object destroyed\");\n\n STACK_BASE;\n //stack is empty\n\n push_cfunction(L, my_lua_error_handler);\n int error_handler = lua_gettop(L);\n\n //stack: err\n getField(L, \"frameCallback\");\n //stack: err, callback\n if (lua_isnil(L, -1)) {\n lua_pop(L, 2);\n //stack is empty\n STACK_CHECK;\n return false;\n }\n\n // Call the callback.\n\n lua_checkstack(L, 2);\n push_gritobj(L, self); // persistent grit obj\n lua_pushnumber(L, elapsed); // time since last frame\n //stack: err, callback, instance, elapsed\n int status = lua_pcall(L, 2, 0, error_handler);\n if (status) {\n //stack: err, msg\n // pop the error message since the error handler will\n // have already printed it out\n lua_pop(L, 1);\n //stack: err\n }\n //stack: err\n\n lua_pop(L, 1);\n //stack is empty\n STACK_CHECK;\n\n return status == 0;\n}\n\nbool GritObject::stepCallback (lua_State *L, const GritObjectPtr &self, float elapsed)\n{\n if (gritClass==NULL) GRIT_EXCEPT(\"Object destroyed\");\n\n STACK_BASE;\n //stack is empty\n\n push_cfunction(L, my_lua_error_handler);\n int error_handler = lua_gettop(L);\n\n //stack: err\n\n getField(L, \"stepCallback\");\n //stack: err, callback\n if (lua_isnil(L, -1)) {\n lua_pop(L, 2);\n //stack is empty\n STACK_CHECK;\n return false;\n }\n\n // Call the callback.\n\n lua_checkstack(L, 2);\n push_gritobj(L, self); // persistent grit obj\n lua_pushnumber(L, elapsed); // time since last frame\n //stack: err, callback, instance, elapsed\n int status = lua_pcall(L, 2, 0, error_handler);\n if (status) {\n //stack: err, msg\n // pop the error message since the error handler will\n // have already printed it out\n lua_pop(L, 1);\n //stack: err\n }\n //stack: err\n\n lua_pop(L, 1);\n //stack is empty\n STACK_CHECK;\n\n return status == 0;\n}\n\nvoid GritObject::updateSphere (const Vector3 &pos_, float r_)\n{\n if (index==-1) return;\n pos = pos_;\n r = r_;\n streamer_update_sphere(index, pos, r);\n}\n\nvoid GritObject::updateSphere (const Vector3 &pos_)\n{\n updateSphere(pos_, r);\n}\n\nvoid GritObject::updateSphere (float r_)\n{\n updateSphere(pos, r_);\n}\n\nvoid GritObject::setNeedsFrameCallbacks (const GritObjectPtr &self, bool v)\n{\n if (gritClass==NULL) GRIT_EXCEPT(\"Object destroyed\");\n if (v == needsFrameCallbacks) return;\n needsFrameCallbacks = v;\n\n if (!v) {\n objs_needing_frame_callbacks.erase(self);\n } else {\n objs_needing_frame_callbacks.insert(self);\n }\n}\n\nvoid GritObject::setNeedsStepCallbacks (const GritObjectPtr &self, bool v)\n{\n if (gritClass==NULL) GRIT_EXCEPT(\"Object destroyed\");\n if (v == needsStepCallbacks) return;\n needsStepCallbacks = v;\n\n if (!v) {\n objs_needing_step_callbacks.erase(self);\n } else {\n objs_needing_step_callbacks.insert(self);\n }\n}\n\nvoid GritObject::getField (lua_State *L, const std::string &f) const\n{\n if (gritClass==NULL) GRIT_EXCEPT(\"Object destroyed\");\n\n const char *err = userValues.luaGet(L, f);\n if (err) my_lua_error(L, err);\n if (!lua_isnil(L, -1)) return;\n lua_pop(L, 1);\n // try class instead\n gritClass->get(L, f);\n}\n\n\n\n\n\nGritObjectPtr object_add (lua_State *L, std::string name, GritClass *grit_class)\n{\n bool anonymous = false;\n if (name==\"\") {\n anonymous = true;\n do {\n std::stringstream ss;\n ss << \"Unnamed:\" << grit_class->name\n << \":\" << name_generation_counter++;\n name = ss.str();\n } while (objs.find(name) != objs.end());\n }\n\n GObjMap::iterator i = objs.find(name);\n\n if (i != objs.end()) {\n object_del(L, i->second);\n }\n\n GritObjectPtr self = GritObjectPtr(new GritObject(name, grit_class));\n self->anonymous = anonymous;\n objs[name] = self;\n streamer_list(self);\n\n return self;\n}\n\nvoid object_del (lua_State *L, const GritObjectPtr &o)\n{\n o->destroy(L, o);\n streamer_unlist(o);\n\n GObjMap::iterator i = objs.find(o->name);\n // Since object deactivation can trigger other objects to be destroyed,\n // sometimes when quitting, due to the order in which the objects are destroyed,\n // we destroy an object that is already dead...\n if (i != objs.end()) objs.erase(o->name);\n}\n\nconst GritObjectPtr &object_get (const std::string &name)\n{\n GObjMap::iterator i = objs.find(name);\n if (i==objs.end())\n GRIT_EXCEPT(\"GritObject does not exist: \" + name);\n\n return i->second;\n}\n\nbool object_has (const std::string &name)\n{\n return objs.find(name) != objs.end();\n}\n\n\nvoid object_all (GObjMap::iterator &begin, GObjMap::iterator &end)\n{\n begin = objs.begin();\n end = objs.end();\n}\n\nvoid object_all_del (lua_State *L)\n{\n GObjMap m = objs;\n for (GObjMap::iterator i=m.begin(), i_=m.end() ; i != i_ ; ++i) {\n object_del(L, i->second);\n }\n}\n\nint object_count (void) {\n return objs.size();\n}\n\nvoid object_do_frame_callbacks (lua_State *L, float elapsed)\n{\n GObjSet victims = objs_needing_frame_callbacks;\n typedef GObjSet::iterator I;\n for (I i=victims.begin(), i_=victims.end() ; i != i_ ; ++i) {\n if (!(*i)->frameCallback(L, *i, elapsed)) {\n (*i)->setNeedsFrameCallbacks(*i, false);\n }\n }\n}\n\nvoid object_do_step_callbacks (lua_State *L, float elapsed)\n{\n GObjSet victims = objs_needing_step_callbacks;\n typedef GObjSet::iterator I;\n for (I i=victims.begin(), i_=victims.end() ; i != i_ ; ++i) {\n if (!(*i)->stepCallback(L, *i, elapsed)) {\n (*i)->setNeedsStepCallbacks(*i, false);\n }\n }\n}\n" }, { "alpha_fraction": 0.44565799832344055, "alphanum_fraction": 0.46965086460113525, "avg_line_length": 39.17985534667969, "blob_id": "600485cb92a71d4057a19215be8ebbb410e24cc5", "content_id": "86a1ca599f5dc984cce0a314c2524ee32705190e", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 5585, "license_type": "permissive", "max_line_length": 80, "num_lines": 139, "path": "/gtasa/ifpread.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <cstdlib>\n#include <cmath>\n\n#include <sstream>\n#include <string>\n#include <vector>\n#include <iostream>\n#include <fstream>\n\n#include \"ios_util.h\"\n\nvoid ifpread(std::istream &f, std::string p)\n{\n unsigned long fourcc = ios_read_u32(f);\n APP_ASSERT(fourcc==0x33504e41); // ANP3\n\n unsigned long body_size = ios_read_u32(f);\n std::cout<<p<<\".body_size: \"<<body_size<<\"\\n\";\n std::string filename = ios_read_fixedstr(f,24);\n std::cout<<p<<\".filename: \"<<filename<<\"\\n\";\n\n unsigned long num_anims = ios_read_u32(f);\n std::cout<<p<<\".num_anims: \"<<num_anims<<\"\\n\";\n\n for (unsigned long i=0 ; i<num_anims ; i++) {\n std::stringstream p2_;\n p2_ << p << \".anim[\" << i << \"]\";\n std::string p2(p2_.str());\n std::string anim_name = ios_read_fixedstr(f,24);\n std::cout<<p2<<\".anim_name: \"<<anim_name<<\"\\n\";\n unsigned long num_bones = ios_read_u32(f);\n std::cout<<p2<<\".num_bones: \"<<num_bones<<\"\\n\";\n unsigned long size = ios_read_u32(f);\n std::cout<<p2<<\".anim_size: \"<<size<<\"\\n\";\n unsigned long one = ios_read_u32(f);\n APP_ASSERT(one==1);\n for (unsigned long j=0 ; j<num_bones ; j++) {\n std::stringstream p3_;\n p3_ << p2 << \".bone[\"<<j<<\"]\";\n std::string p3(p3_.str());\n std::string bone_name = ios_read_fixedstr(f,24);\n std::cout<<p3<<\".bone_name: \"<<bone_name<<\"\\n\";\n unsigned long frame_type = ios_read_u32(f);\n std::cout<<p3<<\".frame_type: \"<<frame_type<<\"\\n\";\n APP_ASSERT(frame_type==3 || frame_type==4);\n unsigned long num_frames = ios_read_u32(f);\n std::cout<<p3<<\".num_frames: \"<<num_frames<<\"\\n\";\n unsigned long bone_id = ios_read_u32(f);\n std::cout<<p3<<\".bone_id: \"<<bone_id<<\"\\n\";\n for (unsigned long k=0 ; k<num_frames ; k++) {\n std::stringstream p4_;\n p4_ << p3 << \".frame[\"<<k<<\"]\";\n std::string p4(p4_.str());\n float qx = ios_read_s16(f) / 4096.0f;\n float qy = ios_read_s16(f) / 4096.0f;\n float qz = ios_read_s16(f) / 4096.0f;\n float qw = ios_read_s16(f) / 4096.0f;\n std::cout<<p4<<\".quat_x: \"<<qx<<\"\\n\";\n std::cout<<p4<<\".quat_y: \"<<qy<<\"\\n\";\n std::cout<<p4<<\".quat_z: \"<<qz<<\"\\n\";\n std::cout<<p4<<\".quat_w: \"<<qw<<\"\\n\";\n float time = ios_read_u16(f) / 60.0f;\n std::cout<<p4<<\".time: \"<<time<<\"\\n\";\n if (frame_type==4) {\n float px = ios_read_s16(f) / 1024.0f;\n float py = ios_read_s16(f) / 1024.0f;\n float pz = ios_read_s16(f) / 1024.0f;\n std::cout<<p4<<\".pos_x: \"<<px<<\"\\n\";\n std::cout<<p4<<\".pos_y: \"<<py<<\"\\n\";\n std::cout<<p4<<\".pos_z: \"<<pz<<\"\\n\";\n }\n }\n }\n }\n}\n\n\n\n#ifdef _IFPREAD_EXEC\n\nsize_t amount_read = 0;\nsize_t amount_seeked = 0;\n\nvoid assert_triggered (void) { }\n\nint main(int argc, char *argv[])\n{\n if (argc!=2) {\n std::cerr<<\"Usage: \"<<argv[0]<<\" <ifp file>\"<<std::endl;\n return EXIT_FAILURE;\n }\n\n try {\n\n std::string ifp_name = argv[1];\n\n std::ifstream f;\n f.open(ifp_name.c_str(),std::ios::binary);\n APP_ASSERT_IO_SUCCESSFUL(f,\"Opening ifp file: \"+ifp_name);\n\n ifpread(f,ifp_name);\n\n } catch (const Exception &e) {\n \n CERR << e << std::endl;\n\n return EXIT_FAILURE;\n\n }\n\n\n\n return EXIT_SUCCESS;\n}\n\n#endif\n\n// vim: shiftwidth=8:tabstop=8:expandtab\n" }, { "alpha_fraction": 0.6873661875724792, "alphanum_fraction": 0.6899357438087463, "avg_line_length": 31.8873233795166, "blob_id": "2d12e39afb6c2fe6d3df656c9120cfc0c9ea0750", "content_id": "b0ce9e3aed3c7390f17171dfa071f20e369437b1", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 2335, "license_type": "permissive", "max_line_length": 98, "num_lines": 71, "path": "/engine/gfx/gfx_font.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include \"gfx_font.h\"\n\ntypedef std::map<std::string, GfxFont *> FontMap;\nFontMap db;\n\nVector2 GfxFont::getTextureDimensions (void) {\n Ogre::TexturePtr ptr = texture->getOgreTexturePtr();\n ptr->load(); // push to GPU, otherwise width and height are wrong\n return Vector2(ptr->getWidth(), ptr->getHeight());\n}\n\nbool gfx_font_has (const std::string &name)\n{\n FontMap::iterator it = db.find(name);\n if (it == db.end()) return false;\n return true;\n}\n\nstd::vector<GfxFont*> gfx_font_list (void)\n{\n std::vector<GfxFont*> r;\n for (FontMap::const_iterator i=db.begin(),i_=db.end() ; i!=i_ ; ++i) {\n r.push_back(i->second);\n }\n return r;\n}\n\nGfxFont *gfx_font_get (const std::string &name)\n{\n if (!gfx_font_has(name)) return NULL;\n return db[name];\n}\n\nGfxFont *gfx_font_make (const std::string &name, GfxTextureDiskResource *dr, unsigned long height)\n{\n GfxFont *f = gfx_font_get(name);\n if (f == NULL) {\n f = new GfxFont(name, dr, height);\n db[name] = f;\n } else {\n f->setTexture(DiskResourcePtr<GfxTextureDiskResource>(dr));\n f->clearCodePoints();\n }\n return f;\n}\n\nunsigned long gfx_font_num (void)\n{\n return db.size();\n}\n" }, { "alpha_fraction": 0.5826154947280884, "alphanum_fraction": 0.5826154947280884, "avg_line_length": 26.12765884399414, "blob_id": "a692daa99492b0a1ac1c232f68a34bbedc8910ba", "content_id": "7c098c35d595b828fd440cf457c289402a5e320b", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 1277, "license_type": "permissive", "max_line_length": 81, "num_lines": 47, "path": "/dependencies/quex-0.34.1/quex/code_base/template/token_sending_via_singleton.i", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "// -*- C++ -*- vim:set syntax=cpp:\n\n#ifdef QUEX_OPTION_DEBUG_TOKEN_SENDING\n# define __QUEX_DEBUG_TOKEN_SENDING() \\\n std::cerr << \"$$LEXER_CLASS_NAME$$::send \" << _token << std::endl;\n#else\n# define __QUEX_DEBUG_TOKEN_SENDING() /* nothing */\n#endif\n\nnamespace quex { \n inline void \n CLASS::send() \n { \n /* This function exists only, so that code generation looks uniform. \n * It is empty, so it does not harm at all-it's simply optimized away. */\n }\n\n inline void \n CLASS::send(const __QUEX_SETTING_TOKEN_CLASS_NAME& That) \n {\n the_token = That;\n __QUEX_DEBUG_TOKEN_SENDING();\n }\n\n inline void \n CLASS::send(const QUEX_TOKEN_ID_TYPE ID) \n {\n the_token.set(ID);\n __QUEX_DEBUG_TOKEN_SENDING();\n }\n\n inline void \n CLASS::send_n(const int N, QUEX_TOKEN_ID_TYPE ID) \n {\n /* this function does not make sense for singleton tokens */\n the_token.set(ID); // applies DEBUG of 'send()'\n __QUEX_DEBUG_TOKEN_SENDING();\n }\n\n template <typename ContentT> inline void \n CLASS::send(const QUEX_TOKEN_ID_TYPE ID, ContentT Content) \n {\n the_token.set(ID, Content);\n __QUEX_DEBUG_TOKEN_SENDING();\n }\n}\n#undef __QUEX_DEBUG_TOKEN_SENDING\n\n\n" }, { "alpha_fraction": 0.7108784317970276, "alphanum_fraction": 0.7123327255249023, "avg_line_length": 37.629215240478516, "blob_id": "8c3f3b5cc8d3f1b69726ab823f74ef273472f6a7", "content_id": "72c855d73a434b61a1159c5ac41b60ff6b2c3f96", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 3438, "license_type": "permissive", "max_line_length": 140, "num_lines": 89, "path": "/engine/audio/audio_disk_resource.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\nclass AudioDiskResource;\n\n#ifndef AUDIO_DISK_RESOURCE_H\n#define AUDIO_DISK_RESOURCE_H\n\n#include <AL/al.h>\n\n#include <centralised_log.h>\n#include \"../background_loader.h\"\n\n/** A disk resource that represents a sound file on disk. Currently only .wav is supported. Can be stereo or mono (detected at load time).\n */\nclass AudioDiskResource : public DiskResource {\n\npublic:\n /** To create a resource, call disk_resource_get_or_make. This function is for internal use only. */\n AudioDiskResource (const std::string &name)\n : name(name), stereo(false)\n {\n }\n\n /** Specialised loading functionality for audio files. */\n virtual void loadImpl (void);\n\n /** Specialised unloading functionality for audio files. */\n virtual void unloadImpl (void);\n\n /** The name of the resource, i.e. the filename on disk as an absolute Grit path. */\n virtual const std::string &getName (void) const { return name; }\n\n /** A buffer containing either both channels interleaved (in the case of stereo) or just the single channel. */\n ALuint getALBufferAll(void) { return stereo ? alBuffer : alBufferLeft; }\n\n /** A buffer containing just the left channel. */\n ALuint getALBufferLeft(void) { return alBufferLeft; }\n\n /** A buffer containing just the right channel, or 0 if sound is mono. */\n ALuint getALBufferRight(void) { return alBufferRight; }\n\n /** Is the loaded file a stereo one? Discovered at loading time. */\n bool getStereo (void) { return stereo; }\n\nprivate:\n\n /** Utility function to load a PCM file with .wav header from the byte stream. */\n void loadWAV (Ogre::DataStreamPtr &file);\n \n /** Utility function to load and decode Ogg Vorbis file. */\n void loadOGG (Ogre::DataStreamPtr &file);\n \n /** Cache of the name. */\n const std::string name;\n\n /** The buffer containing interleaved left and right channels, used for stereo playback. If resource is not stereo, is unused. */\n ALuint alBuffer;\n\n /** The buffer containing only the left channel, or the mono channel in the case of a mono resource. */\n ALuint alBufferLeft;\n\n /** The buffer containing only the right channel, unused if the resource is not stereo. */\n ALuint alBufferRight;\n\n /** Is the loaded file a stereo one? */\n bool stereo;\n\n};\n\n#endif\n" }, { "alpha_fraction": 0.6536912322044373, "alphanum_fraction": 0.7145527601242065, "avg_line_length": 97.95146179199219, "blob_id": "84abda2357c70c8bbbe3c472b4af3848366e4699", "content_id": "0ec32cd08146cef4a001206719219f2de47730c7", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 1842971, "license_type": "permissive", "max_line_length": 143, "num_lines": 18625, "path": "/gtasa/tex_dups.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <cstdlib>\n#include <iostream>\n\n#include <string>\n\n#include \"tex_dups.h\"\n\n// stores whether a given texture can be substituted for another identical\n// texture to avoid duplicates\ntypedef std::map<std::string, const char *> TexDupMap;\n\nstatic TexDupMap tex_dup_map;\n\nstatic bool initialised;\n\nconst char *massive_array[] =\n{ // {{{\n \"gta3.img/canalsg_law.txd/bow_church_grass_alt.dds\",\"gta3.img/2notherbuildsfe.txd/bow_church_grass_alt.dds\",\n \"gta3.img/fishwarf.txd/bow_church_grass_alt.dds\",\"gta3.img/2notherbuildsfe.txd/bow_church_grass_alt.dds\",\n \"gta3.img/lanbloki.txd/bow_church_grass_alt.dds\",\"gta3.img/2notherbuildsfe.txd/bow_church_grass_alt.dds\",\n \"gta3.img/landshit_31_sfe.txd/bow_church_grass_alt.dds\",\"gta3.img/2notherbuildsfe.txd/bow_church_grass_alt.dds\",\n \"gta3.img/law_beach2.txd/bow_church_grass_alt.dds\",\"gta3.img/2notherbuildsfe.txd/bow_church_grass_alt.dds\",\n \"gta3.img/lawest1.txd/bow_church_grass_alt.dds\",\"gta3.img/2notherbuildsfe.txd/bow_church_grass_alt.dds\",\n \"gta3.img/lombard.txd/bow_church_grass_alt.dds\",\"gta3.img/2notherbuildsfe.txd/bow_church_grass_alt.dds\",\n \"gta3.img/roadsfe.txd/bow_church_grass_alt.dds\",\"gta3.img/2notherbuildsfe.txd/bow_church_grass_alt.dds\",\n \"gta3.img/sfvictorian.txd/bow_church_grass_alt.dds\",\"gta3.img/2notherbuildsfe.txd/bow_church_grass_alt.dds\",\n \"gta3.img/skyscr1_lan2.txd/bow_church_grass_alt.dds\",\"gta3.img/2notherbuildsfe.txd/bow_church_grass_alt.dds\",\n \"gta3.img/slapart01sfe.txd/bow_church_grass_alt.dds\",\"gta3.img/2notherbuildsfe.txd/bow_church_grass_alt.dds\",\n \"gta3.img/sw_block06.txd/bow_church_grass_alt.dds\",\"gta3.img/2notherbuildsfe.txd/bow_church_grass_alt.dds\",\n \"gta3.img/venice_law.txd/bow_church_grass_alt.dds\",\"gta3.img/2notherbuildsfe.txd/bow_church_grass_alt.dds\",\n \"gta3.img/vgssland03.txd/bow_church_grass_alt.dds\",\"gta3.img/2notherbuildsfe.txd/bow_church_grass_alt.dds\",\n \"gta3.img/vgsswarehse01.txd/bow_church_grass_alt.dds\",\"gta3.img/2notherbuildsfe.txd/bow_church_grass_alt.dds\",\n \"gta3.img/beachapts_lax.txd/flatdoor01_law.dds\",\"gta3.img/2notherbuildsfe.txd/flatdoor01_law.dds\",\n \"gta3.img/coast_apts.txd/flatdoor01_law.dds\",\"gta3.img/2notherbuildsfe.txd/flatdoor01_law.dds\",\n \"gta3.img/law_cnrtplaz.txd/flatdoor01_law.dds\",\"gta3.img/2notherbuildsfe.txd/flatdoor01_law.dds\",\n \"gta3.img/lawwhitebuilds.txd/flatdoor01_law.dds\",\"gta3.img/2notherbuildsfe.txd/flatdoor01_law.dds\",\n \"gta3.img/slapart01sfe.txd/flatdoor01_law.dds\",\"gta3.img/2notherbuildsfe.txd/flatdoor01_law.dds\",\n \"gta3.img/venice_law.txd/flatdoor01_law.dds\",\"gta3.img/2notherbuildsfe.txd/flatdoor01_law.dds\",\n \"gta3.img/glenpark1x_lae.txd/bow_abpave_gen.dds\",\"gta3.img/2notherbuildsfe.txd/bow_abpave_gen.dds\",\n \"gta3.img/gymblok2_lae2.txd/bow_abpave_gen.dds\",\"gta3.img/2notherbuildsfe.txd/bow_abpave_gen.dds\",\n \"gta3.img/jeffers5a_lae.txd/bow_abpave_gen.dds\",\"gta3.img/2notherbuildsfe.txd/bow_abpave_gen.dds\",\n \"gta3.img/lahillsroadscoast.txd/bow_abpave_gen.dds\",\"gta3.img/2notherbuildsfe.txd/bow_abpave_gen.dds\",\n \"gta3.img/landcoast_lae2.txd/bow_abpave_gen.dds\",\"gta3.img/2notherbuildsfe.txd/bow_abpave_gen.dds\",\n \"gta3.img/lasground_las2.txd/bow_abpave_gen.dds\",\"gta3.img/2notherbuildsfe.txd/bow_abpave_gen.dds\",\n \"gta3.img/lashops1_las2.txd/bow_abpave_gen.dds\",\"gta3.img/2notherbuildsfe.txd/bow_abpave_gen.dds\",\n \"gta3.img/lashops91_las2.txd/bow_abpave_gen.dds\",\"gta3.img/2notherbuildsfe.txd/bow_abpave_gen.dds\",\n \"gta3.img/melrose17_lawn.txd/bow_abpave_gen.dds\",\"gta3.img/2notherbuildsfe.txd/bow_abpave_gen.dds\",\n \"gta3.img/slapart01sfe.txd/bow_abpave_gen.dds\",\"gta3.img/2notherbuildsfe.txd/bow_abpave_gen.dds\",\n \"gta3.img/stolenbuild02.txd/bow_abpave_gen.dds\",\"gta3.img/2notherbuildsfe.txd/bow_abpave_gen.dds\",\n \"gta3.img/vgnfirestat.txd/bow_abpave_gen.dds\",\"gta3.img/2notherbuildsfe.txd/bow_abpave_gen.dds\",\n \"gta_int.img/imm_roomss.txd/bow_abpave_gen.dds\",\"gta3.img/2notherbuildsfe.txd/bow_abpave_gen.dds\",\n \"gta_int.img/imy_motel2.txd/bow_abpave_gen.dds\",\"gta3.img/2notherbuildsfe.txd/bow_abpave_gen.dds\",\n \"gta_int.img/imy_motel.txd/bow_abpave_gen.dds\",\"gta3.img/2notherbuildsfe.txd/bow_abpave_gen.dds\",\n \"gta_int.img/savegenmotel.txd/bow_abpave_gen.dds\",\"gta3.img/2notherbuildsfe.txd/bow_abpave_gen.dds\",\n \"gta_int.img/sweets_roon.txd/bow_abpave_gen.dds\",\"gta3.img/2notherbuildsfe.txd/bow_abpave_gen.dds\",\n \"gta3.img/slapart01sfe.txd/sl_vicwall02.dds\",\"gta3.img/2notherbuildsfe.txd/sl_vicwall02.dds\",\n \"gta3.img/slapart01sfe.txd/sl_vicwin02.dds\",\"gta3.img/2notherbuildsfe.txd/sl_vicwin02.dds\",\n \"gta3.img/slapart01sfe.txd/sl_vicbrikwall01.dds\",\"gta3.img/2notherbuildsfe.txd/sl_vicbrikwall01.dds\",\n \"gta3.img/711_sfw.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/a51_ext.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/airport1_sfse.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/airportrminl_sfse.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/ammu_lan2.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/anotherbuildsfe.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/archybuild10.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/bakerybit_sfse.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/bakery_sfse.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/barrio1_lae2.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/beachapts_lax.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/beafron1_law2.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/beafron2_law2.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/bighangarsfxr.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/bigoldbuild_sfe.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/bigshed_sfse.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/bigwhitesfe.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/blacksky_sfse.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/blokmodb.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/boxhses_sfsx.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/boxybld2_sfw.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/boxybld_sfw.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/buildblk555.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/buildblk55.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/buildtestlawn.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/burgalrystore_sfse.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/burgsh01_law.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/carshow_sfse.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/ce_bankalley1.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/ce_bankalley2.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/ce_bankalley3.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/cemetery_law.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/ce_pizza.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/cetown3cs_t.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/chinatown2.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/chinatownsfe.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/cityhall_lan.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/cityhall_sfse.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/cityhall_sfs.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/civic03_lan.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/civic04_lan.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/civic06_lan.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/coast_apts.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/councl_law2.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/crackfact_sfse.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/cunte_bar1.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/cunte_town1.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/cuntwbtzzcs_t.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/cuntwrestcs_t.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/cuntwshopscs_t.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/cw2_cinemablockcs_t.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/cw_tempstuffcs_t.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/cw_truckstopcs_t.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/cxref_savhus.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/dem4_sfxrf.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/des_boneyard.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/des_damquay.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/des_dinerw.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/desn2_truckstop.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/des_nstuff.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/des_ntown.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/desn_truckstop.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/des_nwtown.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/des_stownmain2.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/des_stownmain3.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/des_stownmots1.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/des_stownstrip1.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/des_stownstrip2.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/des_telescopestuff.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/des_ufoinn.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/dingbat01_la.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/donut_sfw.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/downtown1_las.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/downtown3_las.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/downtown_las.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/drivingschool_sfse.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/dtbuil1_lan2.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/eastbeach09_lae2.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/eastbeach2a_lae2.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/eastbeach8_lae2.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/eastls1b_lae2.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/eastls3_lae2.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/eastls4_lae2.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/factorynewsfse.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/factory_sfse.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/fedmint_sfs.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/fighot.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/fishwarf.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/furniture_lae2.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/ganton02_lae2.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/garag3_lawn.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/gayclub_sfs.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/gazlaw1.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/gazlaw2.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/gazlaw3.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/gazsfn1.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/gazsfn2.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/genwhse_sfse.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/genwhse_sfs.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/ggatepark.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/glenpark1x_lae.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/gravblok01_lahills.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/grnwht_sfe.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/ground2_las2.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/ground3_las.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/groundbit_sfse.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/gymblok2_lae2.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/haight1_sfs.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/hashblock1b_sfs.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/hashblock1_sfs.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/hashblock1z_sfs.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/hashblock2b_sfs.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/hashblock2_sfs.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/hashblock3_sfs.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/hashblock4_sfs.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/hashhouses1_sfs.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/hashupass_sfs.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/hillhousex_la10_12.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/hosbibalsfw.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/hotel2_sfs.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/idlewood6_lae.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/industry3_las2.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/inglewood01_lax.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/lae2bigblock.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/lae2newtempbx.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/lahills_whisky.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/laland1_lan2.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/lanblokb2.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/lanblokb.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/lanriver.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/lasground_las2.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/lashops1b_las2.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/lashops1_las2.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/lashops6_las2.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/lashops91_las2.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/lashops93_las2.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/lasraodnshops.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/law_beach2.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/law_doontoon.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/lngblok_lae2.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/lomall.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/losflor2_lae2.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/losflor4_lae2.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/mainlcawn.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/mall_law.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/melrose02_lawn.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/melrose03_lawn.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/melrose05_lawn.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/melrose12_lawn.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/melrose13_lawn.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/melrose19_lawn.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/miragecasino2.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/mission2apts_sfse.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/mission2_sfse.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/mission3_sfse.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/mission4_sfs.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/newstuff_sfn.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/oldgarage_sfse.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/oldshops_las.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/ottos_sfw.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/pershingsq.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/pier_sfe.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/posh2_sfe.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/projects_la.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/queens1_sfs.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/queens2_sfs.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/queens3_sfs.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/queensammo_sfs.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/railway_las.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/rodeo01_law2.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/rodeo02_law2.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/rodeo03_law2.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/rodeo05_law2.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/sancliff02_law2.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/sancliff_law2.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/sanpedhse_1x.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/santavenice3.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/scum2_sfs.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/scum_sfse.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/sfe_builda.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/sfe_swank1.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/sfvictorian.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/shops2_sfse.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/shops_sfse.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/shopszz_sfse.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/skyscr1_lan2.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/skyscrap_sfse.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/slapart01sfe.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/smallertxd.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/sprunkworks.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/station_sfse.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/stolenbuild01.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/subpen1_sfse.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/subshops_sfs.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/sunrise04_lawn.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/sunrise05_lawn.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/sunrise09_lawn.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/sunrise11_lawn.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/sunset01_law2.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/sunset01_lawn.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/sunset02_law2.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/sunset03_law2.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/sunset04_law2.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/sunset1_lan2.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/sunsetbittyu.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/sunst18_lawn.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/sw_apartflat5.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/sw_apartflat.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/sw_apartflatx.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/sw_block01.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/sw_block04.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/sw_block09.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/sw_block10.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/sw_block11a.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/sw_block11.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/sw_block12.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/sw_block9.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/sw_genstore.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/sw_library.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/sw_med1.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/sw_office.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/sw_roadgas.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/tramstatsfw.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/vegasbuild.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/vegastemp1.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/venice_law.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/vgnbball.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/vgncircir.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/vgnpwrmainbld.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/vgnretail4.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/vgnshambild1.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/vgntamotel.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/vgnusedcar.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/vgnvrock.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/vgsbikeschool.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/vgsebuild01.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/vgsecarshow.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/vgssairportcpark.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/vict_sfw.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/warehus_las2.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/wasteland_las2.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/w_town3cs_t.txd/ws_rooftarmac1.dds\",\"gta3.img/2notherbuildsfe.txd/ws_rooftarmac1.dds\",\n \"gta3.img/slapart01sfe.txd/sl_vicrfedge.dds\",\"gta3.img/2notherbuildsfe.txd/sl_vicrfedge.dds\",\n \"gta3.img/slapart01sfe.txd/sl_vicwall01.dds\",\"gta3.img/2notherbuildsfe.txd/sl_vicwall01.dds\",\n \"gta3.img/slapart01sfe.txd/sl_vicwin01.dds\",\"gta3.img/2notherbuildsfe.txd/sl_vicwin01.dds\",\n \"gta3.img/anotherbuildsfe.txd/gz_vicdoor1.dds\",\"gta3.img/2notherbuildsfe.txd/gz_vicdoor1.dds\",\n \"gta3.img/boxybld2_sfw.txd/gz_vicdoor1.dds\",\"gta3.img/2notherbuildsfe.txd/gz_vicdoor1.dds\",\n \"gta3.img/boxybld_sfw.txd/gz_vicdoor1.dds\",\"gta3.img/2notherbuildsfe.txd/gz_vicdoor1.dds\",\n \"gta3.img/hashblock1b_sfs.txd/gz_vicdoor1.dds\",\"gta3.img/2notherbuildsfe.txd/gz_vicdoor1.dds\",\n \"gta3.img/hashhouses1_sfs.txd/gz_vicdoor1.dds\",\"gta3.img/2notherbuildsfe.txd/gz_vicdoor1.dds\",\n \"gta3.img/sfvictorian.txd/gz_vicdoor1.dds\",\"gta3.img/2notherbuildsfe.txd/gz_vicdoor1.dds\",\n \"gta3.img/slapart01sfe.txd/gz_vicdoor1.dds\",\"gta3.img/2notherbuildsfe.txd/gz_vicdoor1.dds\",\n \"gta3.img/vict_sfw.txd/gz_vicdoor1.dds\",\"gta3.img/2notherbuildsfe.txd/gz_vicdoor1.dds\",\n \"gta3.img/anotherbuildsfe.txd/gz_vicdoor2.dds\",\"gta3.img/2notherbuildsfe.txd/gz_vicdoor2.dds\",\n \"gta3.img/boxybld2_sfw.txd/gz_vicdoor2.dds\",\"gta3.img/2notherbuildsfe.txd/gz_vicdoor2.dds\",\n \"gta3.img/hashblock1b_sfs.txd/gz_vicdoor2.dds\",\"gta3.img/2notherbuildsfe.txd/gz_vicdoor2.dds\",\n \"gta3.img/hashhouses1_sfs.txd/gz_vicdoor2.dds\",\"gta3.img/2notherbuildsfe.txd/gz_vicdoor2.dds\",\n \"gta3.img/sfvictorian.txd/gz_vicdoor2.dds\",\"gta3.img/2notherbuildsfe.txd/gz_vicdoor2.dds\",\n \"gta3.img/slapart01sfe.txd/gz_vicdoor2.dds\",\"gta3.img/2notherbuildsfe.txd/gz_vicdoor2.dds\",\n \"gta3.img/vict_sfw.txd/gz_vicdoor2.dds\",\"gta3.img/2notherbuildsfe.txd/gz_vicdoor2.dds\",\n \"gta3.img/anotherbuildsfe.txd/ferry_build14.dds\",\"gta3.img/2notherbuildsfe.txd/ferry_build14.dds\",\n \"gta3.img/archybuild10.txd/ferry_build14.dds\",\"gta3.img/2notherbuildsfe.txd/ferry_build14.dds\",\n \"gta3.img/bigoldbuild_sfe.txd/ferry_build14.dds\",\"gta3.img/2notherbuildsfe.txd/ferry_build14.dds\",\n \"gta3.img/ferry_building.txd/ferry_build14.dds\",\"gta3.img/2notherbuildsfe.txd/ferry_build14.dds\",\n \"gta3.img/fishwarf.txd/ferry_build14.dds\",\"gta3.img/2notherbuildsfe.txd/ferry_build14.dds\",\n \"gta3.img/pier_sfe.txd/ferry_build14.dds\",\"gta3.img/2notherbuildsfe.txd/ferry_build14.dds\",\n \"gta3.img/sfvictorian.txd/ferry_build14.dds\",\"gta3.img/2notherbuildsfe.txd/ferry_build14.dds\",\n \"gta3.img/smallertxd.txd/ferry_build14.dds\",\"gta3.img/2notherbuildsfe.txd/ferry_build14.dds\",\n \"gta_int.img/711c.txd/cj_7_11_win.dds\",\"gta3.img/7_11_door.txd/cj_7_11_win.dds\",\n \"gta_int.img/genintint711_1.txd/cj_7_11_win.dds\",\"gta3.img/7_11_door.txd/cj_7_11_win.dds\",\n \"gta3.img/cj_bar.txd/cj_sheetmetal2.dds\",\"gta3.img/7_11_door.txd/cj_sheetmetal2.dds\",\n \"gta3.img/cj_dfext.txd/cj_sheetmetal2.dds\",\"gta3.img/7_11_door.txd/cj_sheetmetal2.dds\",\n \"gta3.img/cj_ext_vend2.txd/cj_sheetmetal2.dds\",\"gta3.img/7_11_door.txd/cj_sheetmetal2.dds\",\n \"gta3.img/cj_ext_vend.txd/cj_sheetmetal2.dds\",\"gta3.img/7_11_door.txd/cj_sheetmetal2.dds\",\n \"gta3.img/hubprops2_sfse.txd/cj_sheetmetal2.dds\",\"gta3.img/7_11_door.txd/cj_sheetmetal2.dds\",\n \"gta3.img/new_shop_door.txd/cj_sheetmetal2.dds\",\"gta3.img/7_11_door.txd/cj_sheetmetal2.dds\",\n \"gta3.img/shop_doors2.txd/cj_sheetmetal2.dds\",\"gta3.img/7_11_door.txd/cj_sheetmetal2.dds\",\n \"gta3.img/ticket_sub.txd/cj_sheetmetal2.dds\",\"gta3.img/7_11_door.txd/cj_sheetmetal2.dds\",\n \"gta3.img/totoie.txd/cj_sheetmetal2.dds\",\"gta3.img/7_11_door.txd/cj_sheetmetal2.dds\",\n \"gta_int.img/airp_prop.txd/cj_sheetmetal2.dds\",\"gta3.img/7_11_door.txd/cj_sheetmetal2.dds\",\n \"gta_int.img/cj_anim.txd/cj_sheetmetal2.dds\",\"gta3.img/7_11_door.txd/cj_sheetmetal2.dds\",\n \"gta_int.img/cj_burg_sign2.txd/cj_sheetmetal2.dds\",\"gta3.img/7_11_door.txd/cj_sheetmetal2.dds\",\n \"gta_int.img/cj_burg_sign.txd/cj_sheetmetal2.dds\",\"gta3.img/7_11_door.txd/cj_sheetmetal2.dds\",\n \"gta_int.img/cj_coin_op.txd/cj_sheetmetal2.dds\",\"gta3.img/7_11_door.txd/cj_sheetmetal2.dds\",\n \"gta_int.img/cj_commercial.txd/cj_sheetmetal2.dds\",\"gta3.img/7_11_door.txd/cj_sheetmetal2.dds\",\n \"gta_int.img/cj_ff_acc1.txd/cj_sheetmetal2.dds\",\"gta3.img/7_11_door.txd/cj_sheetmetal2.dds\",\n \"gta_int.img/cj_ff_counters.txd/cj_sheetmetal2.dds\",\"gta3.img/7_11_door.txd/cj_sheetmetal2.dds\",\n \"gta_int.img/cj_ff.txd/cj_sheetmetal2.dds\",\"gta3.img/7_11_door.txd/cj_sheetmetal2.dds\",\n \"gta_int.img/cj_jucie.txd/cj_sheetmetal2.dds\",\"gta3.img/7_11_door.txd/cj_sheetmetal2.dds\",\n \"gta_int.img/cj_kitchen.txd/cj_sheetmetal2.dds\",\"gta3.img/7_11_door.txd/cj_sheetmetal2.dds\",\n \"gta_int.img/cj_lighting.txd/cj_sheetmetal2.dds\",\"gta3.img/7_11_door.txd/cj_sheetmetal2.dds\",\n \"gta_int.img/cj_piz_sign.txd/cj_sheetmetal2.dds\",\"gta3.img/7_11_door.txd/cj_sheetmetal2.dds\",\n \"gta_int.img/cjtemp.txd/cj_sheetmetal2.dds\",\"gta3.img/7_11_door.txd/cj_sheetmetal2.dds\",\n \"gta_int.img/cooler1.txd/cj_sheetmetal2.dds\",\"gta3.img/7_11_door.txd/cj_sheetmetal2.dds\",\n \"gta_int.img/intclothesa.txd/cj_sheetmetal2.dds\",\"gta3.img/7_11_door.txd/cj_sheetmetal2.dds\",\n \"gta_int.img/newcrak.txd/cj_sheetmetal2.dds\",\"gta3.img/7_11_door.txd/cj_sheetmetal2.dds\",\n \"gta_int.img/ryfurn2.txd/cj_sheetmetal2.dds\",\"gta3.img/7_11_door.txd/cj_sheetmetal2.dds\",\n \"gta_int.img/sfhss2.txd/cj_sheetmetal2.dds\",\"gta3.img/7_11_door.txd/cj_sheetmetal2.dds\",\n \"gta_int.img/smallsfhs.txd/cj_sheetmetal2.dds\",\"gta3.img/7_11_door.txd/cj_sheetmetal2.dds\",\n \"gta_int.img/svcunthoose.txd/cj_sheetmetal2.dds\",\"gta3.img/7_11_door.txd/cj_sheetmetal2.dds\",\n \"gta_int.img/svsfsmbits.txd/cj_sheetmetal2.dds\",\"gta3.img/7_11_door.txd/cj_sheetmetal2.dds\",\n \"gta3.img/cj_bar.txd/cj_chrome2.dds\",\"gta3.img/7_11_door.txd/cj_chrome2.dds\",\n \"gta3.img/cj_street_props.txd/cj_chrome2.dds\",\"gta3.img/7_11_door.txd/cj_chrome2.dds\",\n \"gta3.img/ext_doors2.txd/cj_chrome2.dds\",\"gta3.img/7_11_door.txd/cj_chrome2.dds\",\n \"gta3.img/ext_doors_old.txd/cj_chrome2.dds\",\"gta3.img/7_11_door.txd/cj_chrome2.dds\",\n \"gta3.img/externalext.txd/cj_chrome2.dds\",\"gta3.img/7_11_door.txd/cj_chrome2.dds\",\n \"gta3.img/fort_sfw.txd/cj_chrome2.dds\",\"gta3.img/7_11_door.txd/cj_chrome2.dds\",\n \"gta3.img/hubint1_sfse.txd/cj_chrome2.dds\",\"gta3.img/7_11_door.txd/cj_chrome2.dds\",\n \"gta3.img/industrialext.txd/cj_chrome2.dds\",\"gta3.img/7_11_door.txd/cj_chrome2.dds\",\n \"gta3.img/int_doors.txd/cj_chrome2.dds\",\"gta3.img/7_11_door.txd/cj_chrome2.dds\",\n \"gta3.img/new_shop_door.txd/cj_chrome2.dds\",\"gta3.img/7_11_door.txd/cj_chrome2.dds\",\n \"gta3.img/queensammo_sfs.txd/cj_chrome2.dds\",\"gta3.img/7_11_door.txd/cj_chrome2.dds\",\n \"gta3.img/shop_doors2.txd/cj_chrome2.dds\",\"gta3.img/7_11_door.txd/cj_chrome2.dds\",\n \"gta3.img/shop_doors.txd/cj_chrome2.dds\",\"gta3.img/7_11_door.txd/cj_chrome2.dds\",\n \"gta_int.img/ab_abbatoir01.txd/cj_chrome2.dds\",\"gta3.img/7_11_door.txd/cj_chrome2.dds\",\n \"gta_int.img/ab_trukstpa.txd/cj_chrome2.dds\",\"gta3.img/7_11_door.txd/cj_chrome2.dds\",\n \"gta_int.img/ab_wooziea.txd/cj_chrome2.dds\",\"gta3.img/7_11_door.txd/cj_chrome2.dds\",\n \"gta_int.img/burg_furn.txd/cj_chrome2.dds\",\"gta3.img/7_11_door.txd/cj_chrome2.dds\",\n \"gta_int.img/cj_bathroom.txd/cj_chrome2.dds\",\"gta3.img/7_11_door.txd/cj_chrome2.dds\",\n \"gta_int.img/cj_furniture.txd/cj_chrome2.dds\",\"gta3.img/7_11_door.txd/cj_chrome2.dds\",\n \"gta_int.img/cj_hi_fi2.txd/cj_chrome2.dds\",\"gta3.img/7_11_door.txd/cj_chrome2.dds\",\n \"gta_int.img/cj_lighting.txd/cj_chrome2.dds\",\"gta3.img/7_11_door.txd/cj_chrome2.dds\",\n \"gta_int.img/cj_office.txd/cj_chrome2.dds\",\"gta3.img/7_11_door.txd/cj_chrome2.dds\",\n \"gta_int.img/cj_s_beds.txd/cj_chrome2.dds\",\"gta3.img/7_11_door.txd/cj_chrome2.dds\",\n \"gta_int.img/cj_tables.txd/cj_chrome2.dds\",\"gta3.img/7_11_door.txd/cj_chrome2.dds\",\n \"gta_int.img/cj_tv_stand.txd/cj_chrome2.dds\",\"gta3.img/7_11_door.txd/cj_chrome2.dds\",\n \"gta_int.img/cj_tv.txd/cj_chrome2.dds\",\"gta3.img/7_11_door.txd/cj_chrome2.dds\",\n \"gta_int.img/genintclothessport.txd/cj_chrome2.dds\",\"gta3.img/7_11_door.txd/cj_chrome2.dds\",\n \"gta_int.img/genintintbarb2.txd/cj_chrome2.dds\",\"gta3.img/7_11_door.txd/cj_chrome2.dds\",\n \"gta_int.img/genintintfasta.txd/cj_chrome2.dds\",\"gta3.img/7_11_door.txd/cj_chrome2.dds\",\n \"gta_int.img/genintintfastd.txd/cj_chrome2.dds\",\"gta3.img/7_11_door.txd/cj_chrome2.dds\",\n \"gta_int.img/genintsmlrst_split.txd/cj_chrome2.dds\",\"gta3.img/7_11_door.txd/cj_chrome2.dds\",\n \"gta_int.img/gf3.txd/cj_chrome2.dds\",\"gta3.img/7_11_door.txd/cj_chrome2.dds\",\n \"gta_int.img/lasmalldesk.txd/cj_chrome2.dds\",\"gta3.img/7_11_door.txd/cj_chrome2.dds\",\n \"gta_int.img/pizza_furn.txd/cj_chrome2.dds\",\"gta3.img/7_11_door.txd/cj_chrome2.dds\",\n \"gta_int.img/sweetshall.txd/cj_chrome2.dds\",\"gta3.img/7_11_door.txd/cj_chrome2.dds\",\n \"gta_int.img/tsdinerxitbox.txd/cj_chrome2.dds\",\"gta3.img/7_11_door.txd/cj_chrome2.dds\",\n \"gta_int.img/vegassavesmal.txd/cj_chrome2.dds\",\"gta3.img/7_11_door.txd/cj_chrome2.dds\",\n \"gta_int.img/vgshm2int2.txd/cj_chrome2.dds\",\"gta3.img/7_11_door.txd/cj_chrome2.dds\",\n \"gta_int.img/whore_furn.txd/cj_chrome2.dds\",\"gta3.img/7_11_door.txd/cj_chrome2.dds\",\n \"gta3.img/coastground.txd/dt_carpark_line_texture.dds\",\"gta3.img/711_sfw.txd/dt_carpark_line_texture.dds\",\n \"gta3.img/copshop_sfe.txd/dt_carpark_line_texture.dds\",\"gta3.img/711_sfw.txd/dt_carpark_line_texture.dds\",\n \"gta3.img/cw_motel1.txd/dt_carpark_line_texture.dds\",\"gta3.img/711_sfw.txd/dt_carpark_line_texture.dds\",\n \"gta3.img/ggatepark.txd/dt_carpark_line_texture.dds\",\"gta3.img/711_sfw.txd/dt_carpark_line_texture.dds\",\n \"gta3.img/hosbibal2sfw.txd/dt_carpark_line_texture.dds\",\"gta3.img/711_sfw.txd/dt_carpark_line_texture.dds\",\n \"gta3.img/multistory_sfe.txd/dt_carpark_line_texture.dds\",\"gta3.img/711_sfw.txd/dt_carpark_line_texture.dds\",\n \"gta3.img/bombshop_sfe.txd/sw_sheddoor2.dds\",\"gta3.img/711_sfw.txd/sw_sheddoor2.dds\",\n \"gta3.img/ce_payspray.txd/sw_sheddoor2.dds\",\"gta3.img/711_sfw.txd/sw_sheddoor2.dds\",\n \"gta3.img/hashmarket1_sfs.txd/sw_sheddoor2.dds\",\"gta3.img/711_sfw.txd/sw_sheddoor2.dds\",\n \"gta3.img/lahills_safe1.txd/sw_sheddoor2.dds\",\"gta3.img/711_sfw.txd/sw_sheddoor2.dds\",\n \"gta3.img/shopliquor_las.txd/sw_sheddoor2.dds\",\"gta3.img/711_sfw.txd/sw_sheddoor2.dds\",\n \"gta3.img/sw_block04.txd/sw_sheddoor2.dds\",\"gta3.img/711_sfw.txd/sw_sheddoor2.dds\",\n \"gta3.img/sw_sheds.txd/sw_sheddoor2.dds\",\"gta3.img/711_sfw.txd/sw_sheddoor2.dds\",\n \"gta3.img/vgnretail3.txd/sw_sheddoor2.dds\",\"gta3.img/711_sfw.txd/sw_sheddoor2.dds\",\n \"gta3.img/vgnusedcar.txd/sw_sheddoor2.dds\",\"gta3.img/711_sfw.txd/sw_sheddoor2.dds\",\n \"gta3.img/des_stownmots1.txd/staddoors1.dds\",\"gta3.img/711_sfw.txd/staddoors1.dds\",\n \"gta3.img/grnwht_sfe.txd/staddoors1.dds\",\"gta3.img/711_sfw.txd/staddoors1.dds\",\n \"gta3.img/theatrelan2.txd/staddoors1.dds\",\"gta3.img/711_sfw.txd/staddoors1.dds\",\n \"gta3.img/vgnpwrmainbld.txd/staddoors1.dds\",\"gta3.img/711_sfw.txd/staddoors1.dds\",\n \"gta3.img/bev_law2.txd/brick.dds\",\"gta3.img/711_sfw.txd/brick.dds\",\n \"gta3.img/contachou1_lae2.txd/brick.dds\",\"gta3.img/711_sfw.txd/brick.dds\",\n \"gta3.img/des_trainstuff.txd/brick.dds\",\"gta3.img/711_sfw.txd/brick.dds\",\n \"gta3.img/ganghouse1_lax.txd/brick.dds\",\"gta3.img/711_sfw.txd/brick.dds\",\n \"gta3.img/ganton01_lae2.txd/brick.dds\",\"gta3.img/711_sfw.txd/brick.dds\",\n \"gta3.img/garag3_lawn.txd/brick.dds\",\"gta3.img/711_sfw.txd/brick.dds\",\n \"gta3.img/hillhousex_la10_12.txd/brick.dds\",\"gta3.img/711_sfw.txd/brick.dds\",\n \"gta3.img/hillhousex_la1_2.txd/brick.dds\",\"gta3.img/711_sfw.txd/brick.dds\",\n \"gta3.img/lngblok_lae2.txd/brick.dds\",\"gta3.img/711_sfw.txd/brick.dds\",\n \"gta3.img/railtracklae.txd/brick.dds\",\"gta3.img/711_sfw.txd/brick.dds\",\n \"gta3.img/richman04_lahills.txd/brick.dds\",\"gta3.img/711_sfw.txd/brick.dds\",\n \"gta3.img/cw2_cinemablockcs_t.txd/pcut_bot_law.dds\",\"gta3.img/711_sfw.txd/pcut_bot_law.dds\",\n \"gta3.img/cw2_storesnstuff.txd/pcut_bot_law.dds\",\"gta3.img/711_sfw.txd/pcut_bot_law.dds\",\n \"gta3.img/des_ufoinn.txd/pcut_bot_law.dds\",\"gta3.img/711_sfw.txd/pcut_bot_law.dds\",\n \"gta3.img/des_wgarage.txd/pcut_bot_law.dds\",\"gta3.img/711_sfw.txd/pcut_bot_law.dds\",\n \"gta3.img/lngblok_lae2.txd/pcut_bot_law.dds\",\"gta3.img/711_sfw.txd/pcut_bot_law.dds\",\n \"gta3.img/shops2_law.txd/pcut_bot_law.dds\",\"gta3.img/711_sfw.txd/pcut_bot_law.dds\",\n \"gta3.img/skyscrapelawn.txd/pcut_bot_law.dds\",\"gta3.img/711_sfw.txd/pcut_bot_law.dds\",\n \"gta3.img/sw_block12.txd/pcut_bot_law.dds\",\"gta3.img/711_sfw.txd/pcut_bot_law.dds\",\n \"gta3.img/sw_fact01.txd/pcut_bot_law.dds\",\"gta3.img/711_sfw.txd/pcut_bot_law.dds\",\n \"gta3.img/chateau_lawn.txd/shingles2.dds\",\"gta3.img/711_sfw.txd/shingles2.dds\",\n \"gta3.img/cw2_storesnstuff.txd/shingles2.dds\",\"gta3.img/711_sfw.txd/shingles2.dds\",\n \"gta3.img/cw_motel2cs_t.txd/shingles2.dds\",\"gta3.img/711_sfw.txd/shingles2.dds\",\n \"gta3.img/des_stownmots1.txd/shingles2.dds\",\"gta3.img/711_sfw.txd/shingles2.dds\",\n \"gta3.img/eastls3_lae2.txd/shingles2.dds\",\"gta3.img/711_sfw.txd/shingles2.dds\",\n \"gta3.img/idlewood46_lae.txd/shingles2.dds\",\"gta3.img/711_sfw.txd/shingles2.dds\",\n \"gta3.img/santamonhus.txd/shingles2.dds\",\"gta3.img/711_sfw.txd/shingles2.dds\",\n \"gta3.img/bigoldbuild_sfe.txd/mono1_sfe.dds\",\"gta3.img/711_sfw.txd/mono1_sfe.dds\",\n \"gta3.img/landshit_31_sfe.txd/mono1_sfe.dds\",\"gta3.img/711_sfw.txd/mono1_sfe.dds\",\n \"gta3.img/law_doontoon.txd/mono1_sfe.dds\",\"gta3.img/711_sfw.txd/mono1_sfe.dds\",\n \"gta3.img/pier69.txd/mono1_sfe.dds\",\"gta3.img/711_sfw.txd/mono1_sfe.dds\",\n \"gta3.img/sfe_park1.txd/mono1_sfe.dds\",\"gta3.img/711_sfw.txd/mono1_sfe.dds\",\n \"gta3.img/sfe_swank1.txd/mono1_sfe.dds\",\"gta3.img/711_sfw.txd/mono1_sfe.dds\",\n \"gta3.img/landshit_31_sfe.txd/mono2_sfe.dds\",\"gta3.img/711_sfw.txd/mono2_sfe.dds\",\n \"gta3.img/law_doontoon.txd/mono2_sfe.dds\",\"gta3.img/711_sfw.txd/mono2_sfe.dds\",\n \"gta3.img/pier69.txd/mono2_sfe.dds\",\"gta3.img/711_sfw.txd/mono2_sfe.dds\",\n \"gta3.img/sfe_park1.txd/mono2_sfe.dds\",\"gta3.img/711_sfw.txd/mono2_sfe.dds\",\n \"gta3.img/sfe_swank1.txd/mono2_sfe.dds\",\"gta3.img/711_sfw.txd/mono2_sfe.dds\",\n \"gta3.img/ballys01.txd/rebrckwall_128.dds\",\"gta3.img/711_sfw.txd/rebrckwall_128.dds\",\n \"gta3.img/ballys02.txd/rebrckwall_128.dds\",\"gta3.img/711_sfw.txd/rebrckwall_128.dds\",\n \"gta3.img/donut_sfw.txd/rebrckwall_128.dds\",\"gta3.img/711_sfw.txd/rebrckwall_128.dds\",\n \"gta3.img/vgsebuild02.txd/rebrckwall_128.dds\",\"gta3.img/711_sfw.txd/rebrckwall_128.dds\",\n \"gta3.img/sfvictorian.txd/beachwall_law.dds\",\"gta3.img/711_sfw.txd/beachwall_law.dds\",\n \"gta3.img/vgntrainstat.txd/beachwall_law.dds\",\"gta3.img/711_sfw.txd/beachwall_law.dds\",\n \"gta3.img/vgsetrainstn.txd/beachwall_law.dds\",\"gta3.img/711_sfw.txd/beachwall_law.dds\",\n \"gta3.img/airport2.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/airportcpark_sfse.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/airportgnd_sfse.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/airportroads_sfse.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/airprtrunway_las.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/anotherbuildsfe.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/baseballground_sfs.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/bigboxtemp1.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/bigwhitesfe.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/boigas_sfw.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/boxybld2_sfw.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/boxybld_sfw.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/calfed_sfe.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/canalsg_law.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/carimpound_sfe.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/carpark_sfe.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/carshow_sfse.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/chemgrnd_las2.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/cluckbell_sfs.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/coastground.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/copshop_sfe.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/cs_town.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/cuntwbtzzcs_t.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/cw2_photoblockcs_t.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/drivingschool_sfse.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/eastbeach2a_lae2.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/fishwarf.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/garage_sfw.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/gardencentre_sfs.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/gazlaw2.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/gazlaw3.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/grnwht_sfe.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/hashblock1_sfs.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/hosbibalsfw.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/imrancomp_las2.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/lan2_gm1.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/landsfw.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/lanpolicecp.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/law_beach2.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/law_doontoon.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/lawwhitebuilds.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/mall_sfse.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/mountainsfs.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/multistory_sfe.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/ottos_sfw.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/park_sfw.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/piera_law2.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/roadsfe.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/rodeo03_law2.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/sfe_builda.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/sfvictorian.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/shops2_law.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/skyscrap_sfse.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/slapart01sfe.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/smallertxd.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/tramstatsfw.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/vegascourtbld.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/vegasemulticar.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/vegastemp1.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/venice_law.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/vgndwntwn1.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/vgnland.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/vgsespras.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/vgsnbuild07.txd/ws_carpark2.dds\",\"gta3.img/711_sfw.txd/ws_carpark2.dds\",\n \"gta3.img/a51_ext.txd/des_rails1.dds\",\"gta3.img/a51_alpha.txd/des_rails1.dds\",\n \"gta3.img/ce_traintrack1.txd/des_rails1.dds\",\"gta3.img/a51_alpha.txd/des_rails1.dds\",\n \"gta3.img/cos_bankblock1.txd/des_rails1.dds\",\"gta3.img/a51_alpha.txd/des_rails1.dds\",\n \"gta3.img/dam_genroom.txd/des_rails1.dds\",\"gta3.img/a51_alpha.txd/des_rails1.dds\",\n \"gta3.img/des_nstuff.txd/des_rails1.dds\",\"gta3.img/a51_alpha.txd/des_rails1.dds\",\n \"gta3.img/desn_trainstuff.txd/des_rails1.dds\",\"gta3.img/a51_alpha.txd/des_rails1.dds\",\n \"gta3.img/des_ranch.txd/des_rails1.dds\",\"gta3.img/a51_alpha.txd/des_rails1.dds\",\n \"gta3.img/des_se1.txd/des_rails1.dds\",\"gta3.img/a51_alpha.txd/des_rails1.dds\",\n \"gta3.img/des_stownstrip1.txd/des_rails1.dds\",\"gta3.img/a51_alpha.txd/des_rails1.dds\",\n \"gta3.img/des_telescopestuff.txd/des_rails1.dds\",\"gta3.img/a51_alpha.txd/des_rails1.dds\",\n \"gta3.img/eastbeach09_lae2.txd/des_rails1.dds\",\"gta3.img/a51_alpha.txd/des_rails1.dds\",\n \"gta3.img/jettycw.txd/des_rails1.dds\",\"gta3.img/a51_alpha.txd/des_rails1.dds\",\n \"gta3.img/milbase.txd/des_rails1.dds\",\"gta3.img/a51_alpha.txd/des_rails1.dds\",\n \"gta3.img/refinery.txd/des_rails1.dds\",\"gta3.img/a51_alpha.txd/des_rails1.dds\",\n \"gta3.img/samsite_sfxrf.txd/des_rails1.dds\",\"gta3.img/a51_alpha.txd/des_rails1.dds\",\n \"gta3.img/sw_block12.txd/des_rails1.dds\",\"gta3.img/a51_alpha.txd/des_rails1.dds\",\n \"gta3.img/a51.txd/a51_glass.dds\",\"gta3.img/a51_alpha.txd/a51_glass.dds\",\n \"gta3.img/a51_ext.txd/stanwind_nt.dds\",\"gta3.img/a51_alpha.txd/stanwind_nt.dds\",\n \"gta3.img/downtown_las.txd/stanwind_nt.dds\",\"gta3.img/a51_alpha.txd/stanwind_nt.dds\",\n \"gta_int.img/genintintsmallrest.txd/stanwind_nt.dds\",\"gta3.img/a51_alpha.txd/stanwind_nt.dds\",\n \"gta3.img/a51_ext.txd/a51_handrail.dds\",\"gta3.img/a51_alpha.txd/a51_handrail.dds\",\n \"gta3.img/a51.txd/a51_handrail.dds\",\"gta3.img/a51_alpha.txd/a51_handrail.dds\",\n \"gta3.img/a51_undergrnd.txd/a51_handrail.dds\",\"gta3.img/a51_alpha.txd/a51_handrail.dds\",\n \"gta3.img/cw2_photoblockcs_t.txd/a51_handrail.dds\",\"gta3.img/a51_alpha.txd/a51_handrail.dds\",\n \"gta3.img/des_byoffice.txd/a51_handrail.dds\",\"gta3.img/a51_alpha.txd/a51_handrail.dds\",\n \"gta3.img/des_cn2_dam.txd/a51_handrail.dds\",\"gta3.img/a51_alpha.txd/a51_handrail.dds\",\n \"gta3.img/desn_trainstuff.txd/a51_handrail.dds\",\"gta3.img/a51_alpha.txd/a51_handrail.dds\",\n \"gta3.img/des_quarrybelts.txd/a51_handrail.dds\",\"gta3.img/a51_alpha.txd/a51_handrail.dds\",\n \"gta3.img/des_trainstuff.txd/a51_handrail.dds\",\"gta3.img/a51_alpha.txd/a51_handrail.dds\",\n \"gta3.img/des_wdam.txd/a51_handrail.dds\",\"gta3.img/a51_alpha.txd/a51_handrail.dds\",\n \"gta3.img/milbase.txd/a51_handrail.dds\",\"gta3.img/a51_alpha.txd/a51_handrail.dds\",\n \"gta3.img/airoads_las.txd/ws_stationgirder1.dds\",\"gta3.img/a51_alpha.txd/ws_stationgirder1.dds\",\n \"gta3.img/ce_fact01.txd/ws_stationgirder1.dds\",\"gta3.img/a51_alpha.txd/ws_stationgirder1.dds\",\n \"gta3.img/des_bigearstuff.txd/ws_stationgirder1.dds\",\"gta3.img/a51_alpha.txd/ws_stationgirder1.dds\",\n \"gta3.img/des_factory.txd/ws_stationgirder1.dds\",\"gta3.img/a51_alpha.txd/ws_stationgirder1.dds\",\n \"gta3.img/des_quarrybits.txd/ws_stationgirder1.dds\",\"gta3.img/a51_alpha.txd/ws_stationgirder1.dds\",\n \"gta3.img/des_stownmain3.txd/ws_stationgirder1.dds\",\"gta3.img/a51_alpha.txd/ws_stationgirder1.dds\",\n \"gta3.img/milbase.txd/ws_stationgirder1.dds\",\"gta3.img/a51_alpha.txd/ws_stationgirder1.dds\",\n \"gta3.img/station_sfse.txd/ws_stationgirder1.dds\",\"gta3.img/a51_alpha.txd/ws_stationgirder1.dds\",\n \"gta3.img/sw_smlfarm.txd/ws_stationgirder1.dds\",\"gta3.img/a51_alpha.txd/ws_stationgirder1.dds\",\n \"gta3.img/vgnpwrwhse.txd/ws_stationgirder1.dds\",\"gta3.img/a51_alpha.txd/ws_stationgirder1.dds\",\n \"gta3.img/vgwestabats.txd/ws_stationgirder1.dds\",\"gta3.img/a51_alpha.txd/ws_stationgirder1.dds\",\n \"gta3.img/a51.txd/ws_castironwalk.dds\",\"gta3.img/a51_alpha.txd/ws_castironwalk.dds\",\n \"gta3.img/airwelcomesign_sfse.txd/ws_castironwalk.dds\",\"gta3.img/a51_alpha.txd/ws_castironwalk.dds\",\n \"gta3.img/carrierint_sfs.txd/ws_castironwalk.dds\",\"gta3.img/a51_alpha.txd/ws_castironwalk.dds\",\n \"gta3.img/country_breakable.txd/ws_castironwalk.dds\",\"gta3.img/a51_alpha.txd/ws_castironwalk.dds\",\n \"gta3.img/crackfactwalkb.txd/ws_castironwalk.dds\",\"gta3.img/a51_alpha.txd/ws_castironwalk.dds\",\n \"gta3.img/cranes_dyn2_cj.txd/ws_castironwalk.dds\",\"gta3.img/a51_alpha.txd/ws_castironwalk.dds\",\n \"gta3.img/cxref_freeway.txd/ws_castironwalk.dds\",\"gta3.img/a51_alpha.txd/ws_castironwalk.dds\",\n \"gta3.img/des_telescopestuff.txd/ws_castironwalk.dds\",\"gta3.img/a51_alpha.txd/ws_castironwalk.dds\",\n \"gta3.img/pyr_roof.txd/ws_castironwalk.dds\",\"gta3.img/a51_alpha.txd/ws_castironwalk.dds\",\n \"gta_int.img/crack.txd/ws_castironwalk.dds\",\"gta3.img/a51_alpha.txd/ws_castironwalk.dds\",\n \"gta_int.img/imy_motelxtra.txd/ws_castironwalk.dds\",\"gta3.img/a51_alpha.txd/ws_castironwalk.dds\",\n \"gta3.img/a51.txd/metalox64.dds\",\"gta3.img/a51_crane.txd/metalox64.dds\",\n \"gta3.img/arprtxxref_las.txd/metalox64.dds\",\"gta3.img/a51_crane.txd/metalox64.dds\",\n \"gta3.img/bombshop_las.txd/metalox64.dds\",\"gta3.img/a51_crane.txd/metalox64.dds\",\n \"gta3.img/bombshop_sfe.txd/metalox64.dds\",\"gta3.img/a51_crane.txd/metalox64.dds\",\n \"gta3.img/carrierint_sfs.txd/metalox64.dds\",\"gta3.img/a51_crane.txd/metalox64.dds\",\n \"gta3.img/ce_loadbay.txd/metalox64.dds\",\"gta3.img/a51_crane.txd/metalox64.dds\",\n \"gta3.img/cj_bar.txd/metalox64.dds\",\"gta3.img/a51_crane.txd/metalox64.dds\",\n \"gta3.img/crackfactwalkb.txd/metalox64.dds\",\"gta3.img/a51_crane.txd/metalox64.dds\",\n \"gta3.img/cranes_dyn2.txd/metalox64.dds\",\"gta3.img/a51_crane.txd/metalox64.dds\",\n \"gta3.img/cs_misc.txd/metalox64.dds\",\"gta3.img/a51_crane.txd/metalox64.dds\",\n \"gta3.img/cuntwshopscs_t.txd/metalox64.dds\",\"gta3.img/a51_crane.txd/metalox64.dds\",\n \"gta3.img/cw_farm.txd/metalox64.dds\",\"gta3.img/a51_crane.txd/metalox64.dds\",\n \"gta3.img/cxref_desert.txd/metalox64.dds\",\"gta3.img/a51_crane.txd/metalox64.dds\",\n \"gta3.img/cxrf_indstuff.txd/metalox64.dds\",\"gta3.img/a51_crane.txd/metalox64.dds\",\n \"gta3.img/cxrf_payspray.txd/metalox64.dds\",\"gta3.img/a51_crane.txd/metalox64.dds\",\n \"gta3.img/des_bigearstuff.txd/metalox64.dds\",\"gta3.img/a51_crane.txd/metalox64.dds\",\n \"gta3.img/des_boneyard.txd/metalox64.dds\",\"gta3.img/a51_crane.txd/metalox64.dds\",\n \"gta3.img/dk_midbuilds.txd/metalox64.dds\",\"gta3.img/a51_crane.txd/metalox64.dds\",\n \"gta3.img/docks_las2.txd/metalox64.dds\",\"gta3.img/a51_crane.txd/metalox64.dds\",\n \"gta3.img/eastls4_lae2.txd/metalox64.dds\",\"gta3.img/a51_crane.txd/metalox64.dds\",\n \"gta3.img/factorycuntw.txd/metalox64.dds\",\"gta3.img/a51_crane.txd/metalox64.dds\",\n \"gta3.img/factory_sfse.txd/metalox64.dds\",\"gta3.img/a51_crane.txd/metalox64.dds\",\n \"gta3.img/glenpark7_lae.txd/metalox64.dds\",\"gta3.img/a51_crane.txd/metalox64.dds\",\n \"gta3.img/hubint2.txd/metalox64.dds\",\"gta3.img/a51_crane.txd/metalox64.dds\",\n \"gta3.img/immcrax.txd/metalox64.dds\",\"gta3.img/a51_crane.txd/metalox64.dds\",\n \"gta3.img/indust_lax.txd/metalox64.dds\",\"gta3.img/a51_crane.txd/metalox64.dds\",\n \"gta3.img/lafuckar.txd/metalox64.dds\",\"gta3.img/a51_crane.txd/metalox64.dds\",\n \"gta3.img/lahillstxd1a.txd/metalox64.dds\",\"gta3.img/a51_crane.txd/metalox64.dds\",\n \"gta3.img/lanriver.txd/metalox64.dds\",\"gta3.img/a51_crane.txd/metalox64.dds\",\n \"gta3.img/lashops1b_las2.txd/metalox64.dds\",\"gta3.img/a51_crane.txd/metalox64.dds\",\n \"gta3.img/lasxrefdock.txd/metalox64.dds\",\"gta3.img/a51_crane.txd/metalox64.dds\",\n \"gta3.img/ramp2.txd/metalox64.dds\",\"gta3.img/a51_crane.txd/metalox64.dds\",\n \"gta3.img/sfn_crashbar.txd/metalox64.dds\",\"gta3.img/a51_crane.txd/metalox64.dds\",\n \"gta3.img/sunset01_lawn.txd/metalox64.dds\",\"gta3.img/a51_crane.txd/metalox64.dds\",\n \"gta3.img/tcenewhillhus02.txd/metalox64.dds\",\"gta3.img/a51_crane.txd/metalox64.dds\",\n \"gta3.img/tramstatsfw.txd/metalox64.dds\",\"gta3.img/a51_crane.txd/metalox64.dds\",\n \"gta3.img/tvstudio_law2.txd/metalox64.dds\",\"gta3.img/a51_crane.txd/metalox64.dds\",\n \"gta3.img/vegasairprtland.txd/metalox64.dds\",\"gta3.img/a51_crane.txd/metalox64.dds\",\n \"gta3.img/vgehshade.txd/metalox64.dds\",\"gta3.img/a51_crane.txd/metalox64.dds\",\n \"gta3.img/vgncarshade1.txd/metalox64.dds\",\"gta3.img/a51_crane.txd/metalox64.dds\",\n \"gta3.img/vgnhelipad1.txd/metalox64.dds\",\"gta3.img/a51_crane.txd/metalox64.dds\",\n \"gta3.img/vgnpwroutbld1.txd/metalox64.dds\",\"gta3.img/a51_crane.txd/metalox64.dds\",\n \"gta3.img/vgnretail3.txd/metalox64.dds\",\"gta3.img/a51_crane.txd/metalox64.dds\",\n \"gta3.img/vgsehseing1.txd/metalox64.dds\",\"gta3.img/a51_crane.txd/metalox64.dds\",\n \"gta3.img/vgwstdirtyrd.txd/metalox64.dds\",\"gta3.img/a51_crane.txd/metalox64.dds\",\n \"gta3.img/vgwwelcome.txd/metalox64.dds\",\"gta3.img/a51_crane.txd/metalox64.dds\",\n \"gta3.img/ws_jetty_sfx.txd/metalox64.dds\",\"gta3.img/a51_crane.txd/metalox64.dds\",\n \"gta_int.img/crack.txd/metalox64.dds\",\"gta3.img/a51_crane.txd/metalox64.dds\",\n \"gta_int.img/kickstart.txd/metalox64.dds\",\"gta3.img/a51_crane.txd/metalox64.dds\",\n \"gta3.img/des_telescopestuff.txd/dish_base1.dds\",\"gta3.img/a51_crane.txd/dish_base1.dds\",\n \"gta3.img/des_telescopestuff.txd/dish_base2.dds\",\"gta3.img/a51_crane.txd/dish_base2.dds\",\n \"gta3.img/des_quarrybelts.txd/quarry_conv_belt_struct.dds\",\"gta3.img/a51_crane.txd/quarry_conv_belt_struct.dds\",\n \"gta3.img/des_quarrybits.txd/quarry_conv_belt_struct.dds\",\"gta3.img/a51_crane.txd/quarry_conv_belt_struct.dds\",\n \"gta3.img/refinery.txd/quarry_conv_belt_struct.dds\",\"gta3.img/a51_crane.txd/quarry_conv_belt_struct.dds\",\n \"gta3.img/imrancomp_las2.txd/banding5_64hv.dds\",\"gta3.img/a51_crane.txd/banding5_64hv.dds\",\n \"gta3.img/vgnrailbrdge.txd/banding5_64hv.dds\",\"gta3.img/a51_crane.txd/banding5_64hv.dds\",\n \"gta3.img/a51_detailstuff.txd/girder2_grey_64hv.dds\",\"gta3.img/a51_crane.txd/girder2_grey_64hv.dds\",\n \"gta3.img/a51_labdoor.txd/girder2_grey_64hv.dds\",\"gta3.img/a51_crane.txd/girder2_grey_64hv.dds\",\n \"gta3.img/a51_labs.txd/girder2_grey_64hv.dds\",\"gta3.img/a51_crane.txd/girder2_grey_64hv.dds\",\n \"gta3.img/a51_stores.txd/girder2_grey_64hv.dds\",\"gta3.img/a51_crane.txd/girder2_grey_64hv.dds\",\n \"gta3.img/arprtxxref_las.txd/girder2_grey_64hv.dds\",\"gta3.img/a51_crane.txd/girder2_grey_64hv.dds\",\n \"gta3.img/hangar1_sfxref.txd/girder2_grey_64hv.dds\",\"gta3.img/a51_crane.txd/girder2_grey_64hv.dds\",\n \"gta3.img/mall_sfse.txd/girder2_grey_64hv.dds\",\"gta3.img/a51_crane.txd/girder2_grey_64hv.dds\",\n \"gta3.img/station_sfse.txd/girder2_grey_64hv.dds\",\"gta3.img/a51_crane.txd/girder2_grey_64hv.dds\",\n \"gta3.img/targetmx.txd/girder2_grey_64hv.dds\",\"gta3.img/a51_crane.txd/girder2_grey_64hv.dds\",\n \"gta3.img/vegasdwntwn1.txd/girder2_grey_64hv.dds\",\"gta3.img/a51_crane.txd/girder2_grey_64hv.dds\",\n \"gta3.img/vegasshangar.txd/girder2_grey_64hv.dds\",\"gta3.img/a51_crane.txd/girder2_grey_64hv.dds\",\n \"gta3.img/vgnabatoir.txd/girder2_grey_64hv.dds\",\"gta3.img/a51_crane.txd/girder2_grey_64hv.dds\",\n \"gta3.img/vgncnstrct1.txd/girder2_grey_64hv.dds\",\"gta3.img/a51_crane.txd/girder2_grey_64hv.dds\",\n \"gta3.img/vgnpwrwhse.txd/girder2_grey_64hv.dds\",\"gta3.img/a51_crane.txd/girder2_grey_64hv.dds\",\n \"gta3.img/vgnvrock.txd/girder2_grey_64hv.dds\",\"gta3.img/a51_crane.txd/girder2_grey_64hv.dds\",\n \"gta3.img/vgsecnstrct01.txd/girder2_grey_64hv.dds\",\"gta3.img/a51_crane.txd/girder2_grey_64hv.dds\",\n \"gta3.img/vgwestabats.txd/girder2_grey_64hv.dds\",\"gta3.img/a51_crane.txd/girder2_grey_64hv.dds\",\n \"gta3.img/a51_ext.txd/concretegroundl1_256.dds\",\"gta3.img/a51_detailstuff.txd/concretegroundl1_256.dds\",\n \"gta3.img/a51_labs.txd/concretegroundl1_256.dds\",\"gta3.img/a51_detailstuff.txd/concretegroundl1_256.dds\",\n \"gta3.img/a51.txd/concretegroundl1_256.dds\",\"gta3.img/a51_detailstuff.txd/concretegroundl1_256.dds\",\n \"gta3.img/docks_las2.txd/concretegroundl1_256.dds\",\"gta3.img/a51_detailstuff.txd/concretegroundl1_256.dds\",\n \"gta3.img/freeway_las.txd/concretegroundl1_256.dds\",\"gta3.img/a51_detailstuff.txd/concretegroundl1_256.dds\",\n \"gta3.img/glenpark6_lae.txd/concretegroundl1_256.dds\",\"gta3.img/a51_detailstuff.txd/concretegroundl1_256.dds\",\n \"gta3.img/miragecasino1.txd/concretegroundl1_256.dds\",\"gta3.img/a51_detailstuff.txd/concretegroundl1_256.dds\",\n \"gta3.img/pirateland.txd/concretegroundl1_256.dds\",\"gta3.img/a51_detailstuff.txd/concretegroundl1_256.dds\",\n \"gta3.img/vgncircir.txd/concretegroundl1_256.dds\",\"gta3.img/a51_detailstuff.txd/concretegroundl1_256.dds\",\n \"gta3.img/vgncnstrct1.txd/concretegroundl1_256.dds\",\"gta3.img/a51_detailstuff.txd/concretegroundl1_256.dds\",\n \"gta3.img/vgncondos1.txd/concretegroundl1_256.dds\",\"gta3.img/a51_detailstuff.txd/concretegroundl1_256.dds\",\n \"gta3.img/vgsecnstrct01.txd/concretegroundl1_256.dds\",\"gta3.img/a51_detailstuff.txd/concretegroundl1_256.dds\",\n \"gta3.img/vgsncircon.txd/concretegroundl1_256.dds\",\"gta3.img/a51_detailstuff.txd/concretegroundl1_256.dds\",\n \"gta3.img/vgssairport02.txd/concretegroundl1_256.dds\",\"gta3.img/a51_detailstuff.txd/concretegroundl1_256.dds\",\n \"gta3.img/a51_ext.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/a51_stores.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/a51.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/airport_las.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/arprtxxref_las.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/barrio1_lae.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/carrierint_sfs.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/cehillhse14.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/cephotoblockcs_t.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/ce_traintrack1.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/ce_traintrack2.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/crackfactwalkb.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/cunte_block1.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/cunte_blockammo.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/des_byoffice.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/des_cn2_dam.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/des_quarrybelts.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/des_quarrybits.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/des_trainstuff.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/dkcargoshp_las2.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/dockcargo1_las.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/docks_las2.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/factorycuntw.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/freeway_las.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/groundb_las2.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/ground_las2.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/hobos_lawn.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/idlewood6_tr.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/imrancomp_las2.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/indust_lax.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/kb_skip_txd.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/kmbjumpx.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/kmb_plkx.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/lahillstxd1a.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/lanriver.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/la_props1.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/lasroads_las2.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/lasxrefdock.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/law2misc_lax.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/milbase.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/pierb_law2.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/pierc_law2.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/quarry.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/railtracklae.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/refinery.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/samsite_sfxrf.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/sw_block05.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/tcenewhillhus02.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/traingen_sfse.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/traintrack_las2.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/tvstudio_law2.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/vegasdwntwn1.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/vegenmotel.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/vgnabatoir.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/vgnhelipad1.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/vgnplantgen.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/vgnpwroutbld2.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/vgnrailroad.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/vgnvrock.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/vgsrailroad.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/vgssstairs1.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/vgwestrailrd.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/warehus_las2.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/wiresetc_las2.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta_int.img/genintwarehsint3.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta_int.img/kickstart.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta_int.img/smashtv.txd/metpat64.dds\",\"gta3.img/a51_detailstuff.txd/metpat64.dds\",\n \"gta3.img/a51_labdoor.txd/ws_carparkwall2.dds\",\"gta3.img/a51_detailstuff.txd/ws_carparkwall2.dds\",\n \"gta3.img/a51_labs.txd/ws_carparkwall2.dds\",\"gta3.img/a51_detailstuff.txd/ws_carparkwall2.dds\",\n \"gta3.img/a51.txd/ws_carparkwall2.dds\",\"gta3.img/a51_detailstuff.txd/ws_carparkwall2.dds\",\n \"gta3.img/airportcpark_sfse.txd/ws_carparkwall2.dds\",\"gta3.img/a51_detailstuff.txd/ws_carparkwall2.dds\",\n \"gta3.img/bballcpark1.txd/ws_carparkwall2.dds\",\"gta3.img/a51_detailstuff.txd/ws_carparkwall2.dds\",\n \"gta3.img/carimpound_sfe.txd/ws_carparkwall2.dds\",\"gta3.img/a51_detailstuff.txd/ws_carparkwall2.dds\",\n \"gta3.img/carpark_sfe.txd/ws_carparkwall2.dds\",\"gta3.img/a51_detailstuff.txd/ws_carparkwall2.dds\",\n \"gta3.img/dockcargo1_las.txd/ws_carparkwall2.dds\",\"gta3.img/a51_detailstuff.txd/ws_carparkwall2.dds\",\n \"gta3.img/ground3_las2.txd/ws_carparkwall2.dds\",\"gta3.img/a51_detailstuff.txd/ws_carparkwall2.dds\",\n \"gta3.img/groundb_las2.txd/ws_carparkwall2.dds\",\"gta3.img/a51_detailstuff.txd/ws_carparkwall2.dds\",\n \"gta3.img/ground_las2.txd/ws_carparkwall2.dds\",\"gta3.img/a51_detailstuff.txd/ws_carparkwall2.dds\",\n \"gta3.img/imrancomp_las2.txd/ws_carparkwall2.dds\",\"gta3.img/a51_detailstuff.txd/ws_carparkwall2.dds\",\n \"gta3.img/indust_lax.txd/ws_carparkwall2.dds\",\"gta3.img/a51_detailstuff.txd/ws_carparkwall2.dds\",\n \"gta3.img/lanpolicecp.txd/ws_carparkwall2.dds\",\"gta3.img/a51_detailstuff.txd/ws_carparkwall2.dds\",\n \"gta3.img/lasxrefdock.txd/ws_carparkwall2.dds\",\"gta3.img/a51_detailstuff.txd/ws_carparkwall2.dds\",\n \"gta3.img/pol_barrx.txd/ws_carparkwall2.dds\",\"gta3.img/a51_detailstuff.txd/ws_carparkwall2.dds\",\n \"gta3.img/rodeo03_law2.txd/ws_carparkwall2.dds\",\"gta3.img/a51_detailstuff.txd/ws_carparkwall2.dds\",\n \"gta3.img/union_las.txd/ws_carparkwall2.dds\",\"gta3.img/a51_detailstuff.txd/ws_carparkwall2.dds\",\n \"gta3.img/vegascourtbld.txd/ws_carparkwall2.dds\",\"gta3.img/a51_detailstuff.txd/ws_carparkwall2.dds\",\n \"gta3.img/vegasemulticar.txd/ws_carparkwall2.dds\",\"gta3.img/a51_detailstuff.txd/ws_carparkwall2.dds\",\n \"gta3.img/vgndwntwn1.txd/ws_carparkwall2.dds\",\"gta3.img/a51_detailstuff.txd/ws_carparkwall2.dds\",\n \"gta3.img/vgsn_carpark01.txd/ws_carparkwall2.dds\",\"gta3.img/a51_detailstuff.txd/ws_carparkwall2.dds\",\n \"gta3.img/warehus_las2.txd/ws_carparkwall2.dds\",\"gta3.img/a51_detailstuff.txd/ws_carparkwall2.dds\",\n \"gta_int.img/genintwarehsint3.txd/ws_carparkwall2.dds\",\"gta3.img/a51_detailstuff.txd/ws_carparkwall2.dds\",\n \"gta_int.img/smashtv.txd/ws_carparkwall2.dds\",\"gta3.img/a51_detailstuff.txd/ws_carparkwall2.dds\",\n \"gta3.img/coochieghous.txd/aluminiumbands256.dds\",\"gta3.img/a51_detailstuff.txd/aluminiumbands256.dds\",\n \"gta3.img/cuntwbt.txd/aluminiumbands256.dds\",\"gta3.img/a51_detailstuff.txd/aluminiumbands256.dds\",\n \"gta3.img/desn2_peckers.txd/aluminiumbands256.dds\",\"gta3.img/a51_detailstuff.txd/aluminiumbands256.dds\",\n \"gta3.img/des_stownmain3.txd/aluminiumbands256.dds\",\"gta3.img/a51_detailstuff.txd/aluminiumbands256.dds\",\n \"gta3.img/gang2hous1_lae.txd/aluminiumbands256.dds\",\"gta3.img/a51_detailstuff.txd/aluminiumbands256.dds\",\n \"gta3.img/ganghouse1_lax.txd/aluminiumbands256.dds\",\"gta3.img/a51_detailstuff.txd/aluminiumbands256.dds\",\n \"gta3.img/garag3_lawn.txd/aluminiumbands256.dds\",\"gta3.img/a51_detailstuff.txd/aluminiumbands256.dds\",\n \"gta3.img/kmb_ramp_txd.txd/aluminiumbands256.dds\",\"gta3.img/a51_detailstuff.txd/aluminiumbands256.dds\",\n \"gta3.img/lawnstripm.txd/aluminiumbands256.dds\",\"gta3.img/a51_detailstuff.txd/aluminiumbands256.dds\",\n \"gta3.img/milbase.txd/aluminiumbands256.dds\",\"gta3.img/a51_detailstuff.txd/aluminiumbands256.dds\",\n \"gta3.img/smokecantxd.txd/aluminiumbands256.dds\",\"gta3.img/a51_detailstuff.txd/aluminiumbands256.dds\",\n \"gta3.img/vgncircir2.txd/aluminiumbands64.dds\",\"gta3.img/a51_detailstuff.txd/aluminiumbands256.dds\",\n \"gta3.img/vgnretail2.txd/aluminiumbands256.dds\",\"gta3.img/a51_detailstuff.txd/aluminiumbands256.dds\",\n \"gta3.img/vgnshopnmall.txd/aluminiumbands256.dds\",\"gta3.img/a51_detailstuff.txd/aluminiumbands256.dds\",\n \"gta3.img/vgsairport.txd/aluminiumbands256.dds\",\"gta3.img/a51_detailstuff.txd/aluminiumbands256.dds\",\n \"gta3.img/xrf_refineryla.txd/aluminiumbands256.dds\",\"gta3.img/a51_detailstuff.txd/aluminiumbands256.dds\",\n \"gta_int.img/gb_foodwrap01.txd/aluminiumbands256.dds\",\"gta3.img/a51_detailstuff.txd/aluminiumbands256.dds\",\n \"gta_int.img/int_tatoo.txd/aluminiumbands256.dds\",\"gta3.img/a51_detailstuff.txd/aluminiumbands256.dds\",\n \"gta_int.img/lee_txd.txd/aluminiumbands256.dds\",\"gta3.img/a51_detailstuff.txd/aluminiumbands256.dds\",\n \"gta3.img/a51_ext.txd/banding9_64hv.dds\",\"gta3.img/a51_detailstuff.txd/banding9_64hv.dds\",\n \"gta3.img/a51_labs.txd/banding9_64hv.dds\",\"gta3.img/a51_detailstuff.txd/banding9_64hv.dds\",\n \"gta3.img/a51.txd/banding9_64hv.dds\",\"gta3.img/a51_detailstuff.txd/banding9_64hv.dds\",\n \"gta3.img/a51vntcvx.txd/banding9_64hv.dds\",\"gta3.img/a51_detailstuff.txd/banding9_64hv.dds\",\n \"gta3.img/airwelcomesign_sfse.txd/banding9_64hv.dds\",\"gta3.img/a51_detailstuff.txd/banding9_64hv.dds\",\n \"gta3.img/beafron1_law2.txd/banding9_64hv.dds\",\"gta3.img/a51_detailstuff.txd/banding9_64hv.dds\",\n \"gta3.img/beafron2_law2.txd/banding9_64hv.dds\",\"gta3.img/a51_detailstuff.txd/banding9_64hv.dds\",\n \"gta3.img/billbox.txd/banding9_64hv.dds\",\"gta3.img/a51_detailstuff.txd/banding9_64hv.dds\",\n \"gta3.img/billbrd.txd/banding9_64hv.dds\",\"gta3.img/a51_detailstuff.txd/banding9_64hv.dds\",\n \"gta3.img/buildingsitevge.txd/banding9_64hv.dds\",\"gta3.img/a51_detailstuff.txd/banding9_64hv.dds\",\n \"gta3.img/ce_oldbridge.txd/banding9_64hv.dds\",\"gta3.img/a51_detailstuff.txd/banding9_64hv.dds\",\n \"gta3.img/des_gunclub.txd/banding9_64hv.dds\",\"gta3.img/a51_detailstuff.txd/banding9_64hv.dds\",\n \"gta3.img/docks_las2.txd/banding9_64hv.dds\",\"gta3.img/a51_detailstuff.txd/banding9_64hv.dds\",\n \"gta3.img/ele_substation.txd/banding9_64hv.dds\",\"gta3.img/a51_detailstuff.txd/banding9_64hv.dds\",\n \"gta3.img/ganton01_lae2.txd/banding9_64hv.dds\",\"gta3.img/a51_detailstuff.txd/banding9_64hv.dds\",\n \"gta3.img/indust_lax.txd/banding9_64hv.dds\",\"gta3.img/a51_detailstuff.txd/banding9_64hv.dds\",\n \"gta3.img/jeffers4_lae.txd/banding9_64hv.dds\",\"gta3.img/a51_detailstuff.txd/banding9_64hv.dds\",\n \"gta3.img/lachempipe.txd/banding9_64hv.dds\",\"gta3.img/a51_detailstuff.txd/banding9_64hv.dds\",\n \"gta3.img/laroadsigcunt.txd/banding9_64hv.dds\",\"gta3.img/a51_detailstuff.txd/banding9_64hv.dds\",\n \"gta3.img/laroadsig_la_cj.txd/banding9_64hv.dds\",\"gta3.img/a51_detailstuff.txd/banding9_64hv.dds\",\n \"gta3.img/laroadsig_la.txd/banding9_64hv.dds\",\"gta3.img/a51_detailstuff.txd/banding9_64hv.dds\",\n \"gta3.img/minigx.txd/banding9_64hv.dds\",\"gta3.img/a51_detailstuff.txd/banding9_64hv.dds\",\n \"gta3.img/pierc_law2.txd/banding9_64hv.dds\",\"gta3.img/a51_detailstuff.txd/banding9_64hv.dds\",\n \"gta3.img/roadbridge_sfse.txd/banding9_64hv.dds\",\"gta3.img/a51_detailstuff.txd/banding9_64hv.dds\",\n \"gta3.img/rodeo02_law2.txd/banding9_64hv.dds\",\"gta3.img/a51_detailstuff.txd/banding9_64hv.dds\",\n \"gta3.img/santamonicalaw2.txd/banding9_64hv.dds\",\"gta3.img/a51_detailstuff.txd/banding9_64hv.dds\",\n \"gta3.img/sfroadsign.txd/banding9_64hv.dds\",\"gta3.img/a51_detailstuff.txd/banding9_64hv.dds\",\n \"gta3.img/signs.txd/banding9_64hv.dds\",\"gta3.img/a51_detailstuff.txd/banding9_64hv.dds\",\n \"gta3.img/transformer_sfs.txd/banding9_64hv.dds\",\"gta3.img/a51_detailstuff.txd/banding9_64hv.dds\",\n \"gta3.img/vegasflag.txd/banding9_64hv.dds\",\"gta3.img/a51_detailstuff.txd/banding9_64hv.dds\",\n \"gta3.img/vegashse2.txd/banding9_64hv.dds\",\"gta3.img/a51_detailstuff.txd/banding9_64hv.dds\",\n \"gta3.img/vegashse8.txd/banding9_64hv.dds\",\"gta3.img/a51_detailstuff.txd/banding9_64hv.dds\",\n \"gta3.img/vgnfirestat.txd/banding9_64hv.dds\",\"gta3.img/a51_detailstuff.txd/banding9_64hv.dds\",\n \"gta3.img/vgnfremnt1.txd/banding9_64hv.dds\",\"gta3.img/a51_detailstuff.txd/banding9_64hv.dds\",\n \"gta3.img/vgsbballnet1.txd/banding9_64hv.dds\",\"gta3.img/a51_detailstuff.txd/banding9_64hv.dds\",\n \"gta3.img/vgsncircon.txd/banding9_64hv.dds\",\"gta3.img/a51_detailstuff.txd/banding9_64hv.dds\",\n \"gta_int.img/innertrack.txd/banding9_64hv.dds\",\"gta3.img/a51_detailstuff.txd/banding9_64hv.dds\",\n \"gta_int.img/innertrak.txd/banding9_64hv.dds\",\"gta3.img/a51_detailstuff.txd/banding9_64hv.dds\",\n \"gta3.img/a51_ext.txd/ws_metalpanel1.dds\",\"gta3.img/a51_detailstuff.txd/ws_metalpanel1.dds\",\n \"gta3.img/a51_labdoor.txd/ws_metalpanel1.dds\",\"gta3.img/a51_detailstuff.txd/ws_metalpanel1.dds\",\n \"gta3.img/a51.txd/ws_metalpanel1.dds\",\"gta3.img/a51_detailstuff.txd/ws_metalpanel1.dds\",\n \"gta3.img/dam_genroom.txd/ws_metalpanel1.dds\",\"gta3.img/a51_detailstuff.txd/ws_metalpanel1.dds\",\n \"gta3.img/depot_sfse.txd/ws_metalpanel1.dds\",\"gta3.img/a51_detailstuff.txd/ws_metalpanel1.dds\",\n \"gta3.img/des_ufoinn.txd/ws_metalpanel1.dds\",\"gta3.img/a51_detailstuff.txd/ws_metalpanel1.dds\",\n \"gta3.img/milbase.txd/ws_metalpanel1.dds\",\"gta3.img/a51_detailstuff.txd/ws_metalpanel1.dds\",\n \"gta3.img/privatesign.txd/ws_metalpanel1.dds\",\"gta3.img/a51_detailstuff.txd/ws_metalpanel1.dds\",\n \"gta3.img/cinemart_alpha.txd/roucghstonebrtb.dds\",\"gta3.img/a51_detailstuff.txd/roucghstonebrtb.dds\",\n \"gta3.img/cityhall_tr_lan.txd/roucghstonebrtb.dds\",\"gta3.img/a51_detailstuff.txd/roucghstonebrtb.dds\",\n \"gta3.img/cs_mountaindetail.txd/roucghstonebrtb.dds\",\"gta3.img/a51_detailstuff.txd/roucghstonebrtb.dds\",\n \"gta3.img/desn2_alphabits.txd/roucghstonebrtb.dds\",\"gta3.img/a51_detailstuff.txd/roucghstonebrtb.dds\",\n \"gta3.img/eastlstr_lae2.txd/roucghstonebrtb.dds\",\"gta3.img/a51_detailstuff.txd/roucghstonebrtb.dds\",\n \"gta3.img/hub_alpha.txd/roucghstonebrtb.dds\",\"gta3.img/a51_detailstuff.txd/roucghstonebrtb.dds\",\n \"gta3.img/a51.txd/a51_floorpanel1.dds\",\"gta3.img/a51_detailstuff.txd/a51_floorpanel1.dds\",\n \"gta3.img/milbase.txd/gen_monitor.dds\",\"gta3.img/a51_detailstuff.txd/gen_monitor.dds\",\n \"gta_int.img/cj_office.txd/gen_monitor.dds\",\"gta3.img/a51_detailstuff.txd/gen_monitor.dds\",\n \"gta_int.img/police_props.txd/gen_monitor.dds\",\"gta3.img/a51_detailstuff.txd/gen_monitor.dds\",\n \"gta_int.img/shopping_acc.txd/gen_monitor.dds\",\"gta3.img/a51_detailstuff.txd/gen_monitor.dds\",\n \"gta3.img/milbase.txd/gen_keyboard.dds\",\"gta3.img/a51_detailstuff.txd/gen_keyboard.dds\",\n \"gta3.img/a51_ext.txd/a51_secdesk.dds\",\"gta3.img/a51_detailstuff.txd/a51_secdesk.dds\",\n \"gta3.img/a51_ext.txd/a51_panels1.dds\",\"gta3.img/a51_detailstuff.txd/a51_panels1.dds\",\n \"gta3.img/a51.txd/a51_panels1.dds\",\"gta3.img/a51_detailstuff.txd/a51_panels1.dds\",\n \"gta3.img/a51.txd/a51_boffstuff3.dds\",\"gta3.img/a51_detailstuff.txd/a51_boffstuff3.dds\",\n \"gta3.img/milbase.txd/a51_boffstuff3.dds\",\"gta3.img/a51_detailstuff.txd/a51_boffstuff3.dds\",\n \"gta3.img/a51_ext.txd/a51_monitors.dds\",\"gta3.img/a51_detailstuff.txd/a51_monitors.dds\",\n \"gta3.img/a51.txd/a51_monitors.dds\",\"gta3.img/a51_detailstuff.txd/a51_monitors.dds\",\n \"gta3.img/airport1_sfse.txd/steel256128.dds\",\"gta3.img/a51_detailstuff.txd/steel256128.dds\",\n \"gta3.img/ballys01.txd/steel256128.dds\",\"gta3.img/a51_detailstuff.txd/steel256128.dds\",\n \"gta3.img/ballysesc01.txd/steel256128.dds\",\"gta3.img/a51_detailstuff.txd/steel256128.dds\",\n \"gta3.img/bigshap_sfw.txd/steel256128.dds\",\"gta3.img/a51_detailstuff.txd/steel256128.dds\",\n \"gta3.img/bigshed_sfse.txd/steel256128.dds\",\"gta3.img/a51_detailstuff.txd/steel256128.dds\",\n \"gta3.img/car_ship_sfse.txd/steel256128.dds\",\"gta3.img/a51_detailstuff.txd/steel256128.dds\",\n \"gta3.img/country_breakable.txd/steel256128.dds\",\"gta3.img/a51_detailstuff.txd/steel256128.dds\",\n \"gta3.img/des_byoffice.txd/steel256128.dds\",\"gta3.img/a51_detailstuff.txd/steel256128.dds\",\n \"gta3.img/des_quarrybits.txd/steel256128.dds\",\"gta3.img/a51_detailstuff.txd/steel256128.dds\",\n \"gta3.img/dkcargoshp_las2.txd/steel256128.dds\",\"gta3.img/a51_detailstuff.txd/steel256128.dds\",\n \"gta3.img/docks2refl_sfse.txd/steel256128.dds\",\"gta3.img/a51_detailstuff.txd/steel256128.dds\",\n \"gta3.img/drydockshed_sfse.txd/steel256128.dds\",\"gta3.img/a51_detailstuff.txd/steel256128.dds\",\n \"gta3.img/newstand.txd/steel256128.dds\",\"gta3.img/a51_detailstuff.txd/steel256128.dds\",\n \"gta3.img/xrf_refineryla.txd/steel256128.dds\",\"gta3.img/a51_detailstuff.txd/steel256128.dds\",\n \"gta3.img/a51_ext.txd/upt_fence_mesh.dds\",\"gta3.img/a51_detailstuff.txd/upt_fence_mesh.dds\",\n \"gta3.img/a51_undergrnd.txd/upt_fence_mesh.dds\",\"gta3.img/a51_detailstuff.txd/upt_fence_mesh.dds\",\n \"gta3.img/barrio1_lae2.txd/upt_fence_mesh.dds\",\"gta3.img/a51_detailstuff.txd/upt_fence_mesh.dds\",\n \"gta3.img/beach_las2.txd/upt_fence_mesh.dds\",\"gta3.img/a51_detailstuff.txd/upt_fence_mesh.dds\",\n \"gta3.img/blackwestran1_lae2.txd/upt_fence_mesh.dds\",\"gta3.img/a51_detailstuff.txd/upt_fence_mesh.dds\",\n \"gta3.img/cephotoblockcs_t.txd/upt_fence_mesh.dds\",\"gta3.img/a51_detailstuff.txd/upt_fence_mesh.dds\",\n \"gta3.img/cinemart_alpha.txd/upt_fence_mesh.dds\",\"gta3.img/a51_detailstuff.txd/upt_fence_mesh.dds\",\n \"gta3.img/civic04_lan.txd/upt_fence_mesh.dds\",\"gta3.img/a51_detailstuff.txd/upt_fence_mesh.dds\",\n \"gta3.img/countryclbgnd_sfs.txd/upt_fence_mesh.dds\",\"gta3.img/a51_detailstuff.txd/upt_fence_mesh.dds\",\n \"gta3.img/countryclbtnis_sfs.txd/upt_fence_mesh.dds\",\"gta3.img/a51_detailstuff.txd/upt_fence_mesh.dds\",\n \"gta3.img/cunte_town1.txd/upt_fence_mesh.dds\",\"gta3.img/a51_detailstuff.txd/upt_fence_mesh.dds\",\n \"gta3.img/cuntwtunnel.txd/upt_fence_mesh.dds\",\"gta3.img/a51_detailstuff.txd/upt_fence_mesh.dds\",\n \"gta3.img/cw2_photoblockcs_t.txd/upt_fence_mesh.dds\",\"gta3.img/a51_detailstuff.txd/upt_fence_mesh.dds\",\n \"gta3.img/cxref_savhus.txd/upt_fence_mesh.dds\",\"gta3.img/a51_detailstuff.txd/upt_fence_mesh.dds\",\n \"gta3.img/desn_teepee.txd/upt_fence_mesh.dds\",\"gta3.img/a51_detailstuff.txd/upt_fence_mesh.dds\",\n \"gta3.img/des_quarrybits.txd/upt_fence_mesh.dds\",\"gta3.img/a51_detailstuff.txd/upt_fence_mesh.dds\",\n \"gta3.img/des_quarry.txd/upt_fence_mesh.dds\",\"gta3.img/a51_detailstuff.txd/upt_fence_mesh.dds\",\n \"gta3.img/des_refinery.txd/upt_fence_mesh.dds\",\"gta3.img/a51_detailstuff.txd/upt_fence_mesh.dds\",\n \"gta3.img/des_telescopestuff.txd/upt_fence_mesh.dds\",\"gta3.img/a51_detailstuff.txd/upt_fence_mesh.dds\",\n \"gta3.img/des_wtownmain.txd/upt_fence_mesh.dds\",\"gta3.img/a51_detailstuff.txd/upt_fence_mesh.dds\",\n \"gta3.img/factryfence.txd/upt_fence_mesh.dds\",\"gta3.img/a51_detailstuff.txd/upt_fence_mesh.dds\",\n \"gta3.img/hashblock1_sfs.txd/upt_fence_mesh.dds\",\"gta3.img/a51_detailstuff.txd/upt_fence_mesh.dds\",\n \"gta3.img/hub_alpha.txd/upt_fence_mesh.dds\",\"gta3.img/a51_detailstuff.txd/upt_fence_mesh.dds\",\n \"gta3.img/inglewood01_lax.txd/upt_fence_mesh.dds\",\"gta3.img/a51_detailstuff.txd/upt_fence_mesh.dds\",\n \"gta3.img/jeffers4_lae.txd/upt_fence_mesh.dds\",\"gta3.img/a51_detailstuff.txd/upt_fence_mesh.dds\",\n \"gta3.img/laealpha.txd/upt_fence_mesh.dds\",\"gta3.img/a51_detailstuff.txd/upt_fence_mesh.dds\",\n \"gta3.img/lanfireesc_tr.txd/upt_fence_mesh.dds\",\"gta3.img/a51_detailstuff.txd/upt_fence_mesh.dds\",\n \"gta3.img/milbase.txd/upt_fence_mesh.dds\",\"gta3.img/a51_detailstuff.txd/upt_fence_mesh.dds\",\n \"gta3.img/oldwest.txd/upt_fence_mesh.dds\",\"gta3.img/a51_detailstuff.txd/upt_fence_mesh.dds\",\n \"gta3.img/stadtplaza_lae2.txd/upt_fence_mesh.dds\",\"gta3.img/a51_detailstuff.txd/upt_fence_mesh.dds\",\n \"gta3.img/stormd_fill.txd/upt_fence_mesh.dds\",\"gta3.img/a51_detailstuff.txd/upt_fence_mesh.dds\",\n \"gta3.img/stripshop1.txd/upt_fence_mesh.dds\",\"gta3.img/a51_detailstuff.txd/upt_fence_mesh.dds\",\n \"gta3.img/sunset1alp_lan2.txd/upt_fence_mesh.dds\",\"gta3.img/a51_detailstuff.txd/upt_fence_mesh.dds\",\n \"gta3.img/sw_block04.txd/upt_fence_mesh.dds\",\"gta3.img/a51_detailstuff.txd/upt_fence_mesh.dds\",\n \"gta3.img/sw_brewery.txd/upt_fence_mesh.dds\",\"gta3.img/a51_detailstuff.txd/upt_fence_mesh.dds\",\n \"gta3.img/vegashse2.txd/upt_fence_mesh.dds\",\"gta3.img/a51_detailstuff.txd/upt_fence_mesh.dds\",\n \"gta3.img/vegashse8.txd/upt_fence_mesh.dds\",\"gta3.img/a51_detailstuff.txd/upt_fence_mesh.dds\",\n \"gta3.img/vgesvhouse01.txd/upt_fence_mesh.dds\",\"gta3.img/a51_detailstuff.txd/upt_fence_mesh.dds\",\n \"gta3.img/vgnbasktball.txd/upt_fence_mesh.dds\",\"gta3.img/a51_detailstuff.txd/upt_fence_mesh.dds\",\n \"gta3.img/vgnbballsign2.txd/upt_fence_mesh.dds\",\"gta3.img/a51_detailstuff.txd/upt_fence_mesh.dds\",\n \"gta3.img/vgnbball.txd/upt_fence_mesh.dds\",\"gta3.img/a51_detailstuff.txd/upt_fence_mesh.dds\",\n \"gta3.img/vgncondos1.txd/upt_fence_mesh.dds\",\"gta3.img/a51_detailstuff.txd/upt_fence_mesh.dds\",\n \"gta3.img/vgncorp1.txd/upt_fence_mesh.dds\",\"gta3.img/a51_detailstuff.txd/upt_fence_mesh.dds\",\n \"gta3.img/vgnewfence.txd/upt_fence_mesh.dds\",\"gta3.img/a51_detailstuff.txd/upt_fence_mesh.dds\",\n \"gta3.img/vgnfirestat.txd/upt_fence_mesh.dds\",\"gta3.img/a51_detailstuff.txd/upt_fence_mesh.dds\",\n \"gta3.img/vgnfremnt1.txd/upt_fence_mesh.dds\",\"gta3.img/a51_detailstuff.txd/upt_fence_mesh.dds\",\n \"gta3.img/vgnhseing1.txd/upt_fence_mesh.dds\",\"gta3.img/a51_detailstuff.txd/upt_fence_mesh.dds\",\n \"gta3.img/vgnlowbild.txd/upt_fence_mesh.dds\",\"gta3.img/a51_detailstuff.txd/upt_fence_mesh.dds\",\n \"gta3.img/vgnlowwall.txd/upt_fence_mesh.dds\",\"gta3.img/a51_detailstuff.txd/upt_fence_mesh.dds\",\n \"gta3.img/vgnretail4.txd/upt_fence_mesh.dds\",\"gta3.img/a51_detailstuff.txd/upt_fence_mesh.dds\",\n \"gta3.img/vgsbballcrt.txd/upt_fence_mesh.dds\",\"gta3.img/a51_detailstuff.txd/upt_fence_mesh.dds\",\n \"gta3.img/vgsnbuild07.txd/upt_fence_mesh.dds\",\"gta3.img/a51_detailstuff.txd/upt_fence_mesh.dds\",\n \"gta3.img/vgwestboiga1.txd/upt_fence_mesh.dds\",\"gta3.img/a51_detailstuff.txd/upt_fence_mesh.dds\",\n \"gta3.img/vgwestretail1.txd/upt_fence_mesh.dds\",\"gta3.img/a51_detailstuff.txd/upt_fence_mesh.dds\",\n \"gta3.img/vgwsavehses.txd/upt_fence_mesh.dds\",\"gta3.img/a51_detailstuff.txd/upt_fence_mesh.dds\",\n \"gta3.img/w_towncs_t.txd/upt_fence_mesh.dds\",\"gta3.img/a51_detailstuff.txd/upt_fence_mesh.dds\",\n \"gta_int.img/8bars.txd/upt_fence_mesh.dds\",\"gta3.img/a51_detailstuff.txd/upt_fence_mesh.dds\",\n \"gta_int.img/dirtouter.txd/upt_fence_mesh.dds\",\"gta3.img/a51_detailstuff.txd/upt_fence_mesh.dds\",\n \"gta_int.img/dirtrack.txd/upt_fence_mesh.dds\",\"gta3.img/a51_detailstuff.txd/upt_fence_mesh.dds\",\n \"gta_int.img/sumoback.txd/upt_fence_mesh.dds\",\"gta3.img/a51_detailstuff.txd/upt_fence_mesh.dds\",\n \"gta3.img/ammu_lan2.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/barrio1_lae2.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/beach_las2.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/chicano10_lae.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/ci_studio5.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/civic01_lan.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/coast_las2.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/cs_ebridge.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/cs_mountain.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/cs_wbridge.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/cxref_desert.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/cxref_freeway.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/des_ebridge.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/des_ne.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/des_nw2.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/des_nw.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/des_quarrybelts.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/des_quarrybits.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/des_ranch.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/des_se1.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/des_stownw.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/des_telescopestuff.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/docks_las2.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/ele_substation.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/fighot.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/garag3_lawn.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/glenphouse_lax.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/groundbit_sfse.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/hillhousex_la10_12.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/hillhousex_la9.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/idlewood6_lae.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/inglewood01_lax.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/lae2tempshit.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/lan2freeway.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/lanblokb2.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/lanblokc.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/landhub.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/landlae2.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/lanlacmab_lan2.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/lanroad.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/law_beach2.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/lawnstripm.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/melrose05_lawn.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/oldfreeway_sfse.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/paynspray_lae.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/refinery.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/resicarpark.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/rodeo01_law2.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/rodeo02_law2.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/rodeo05_law2.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/stormdrain_las2.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/stormdrain.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/sunset01_law2.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/sunset02_law2.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/sunset1_lan2.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/sw_fact01.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/vegasaircon.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/vegasdwntwn1.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/vegstreetsign.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/vgnabatoir.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/vgnusedcar.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/vgsecarshow.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/vgsncircon.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/vgssland01.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/vgssland03.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/vgssroads.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta_int.img/cj_statue_1.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta_int.img/cj_statue_2.txd/block2.dds\",\"gta3.img/a51_ext.txd/block2.dds\",\n \"gta3.img/bighangarsfxr.txd/ws_corr_2_plain.dds\",\"gta3.img/a51_ext.txd/ws_corr_2_plain.dds\",\n \"gta3.img/carshow_sfse.txd/ws_corr_2_plain.dds\",\"gta3.img/a51_ext.txd/ws_corr_2_plain.dds\",\n \"gta3.img/cetown3cs_t.txd/ws_corr_2_plain.dds\",\"gta3.img/a51_ext.txd/ws_corr_2_plain.dds\",\n \"gta3.img/countryclub_sfs.txd/ws_corr_2_plain.dds\",\"gta3.img/a51_ext.txd/ws_corr_2_plain.dds\",\n \"gta3.img/des_boneyard.txd/ws_corr_2_plain.dds\",\"gta3.img/a51_ext.txd/ws_corr_2_plain.dds\",\n \"gta3.img/des_quarrybits.txd/ws_corr_2_plain.dds\",\"gta3.img/a51_ext.txd/ws_corr_2_plain.dds\",\n \"gta3.img/drydockshed_sfse.txd/ws_corr_2_plain.dds\",\"gta3.img/a51_ext.txd/ws_corr_2_plain.dds\",\n \"gta3.img/fedmint_sfs.txd/ws_corr_2_plain.dds\",\"gta3.img/a51_ext.txd/ws_corr_2_plain.dds\",\n \"gta3.img/sw_fact02alt.txd/ws_corr_2_plain.dds\",\"gta3.img/a51_ext.txd/ws_corr_2_plain.dds\",\n \"gta3.img/vegasshangar.txd/ws_corr_2_plain.dds\",\"gta3.img/a51_ext.txd/ws_corr_2_plain.dds\",\n \"gta3.img/vgssairportcpark.txd/ws_corr_2_plain.dds\",\"gta3.img/a51_ext.txd/ws_corr_2_plain.dds\",\n \"gta3.img/xenon_sfse.txd/ws_corr_2_plain.dds\",\"gta3.img/a51_ext.txd/ws_corr_2_plain.dds\",\n \"gta3.img/airportcpark_sfse.txd/wilswin01_la.dds\",\"gta3.img/a51_ext.txd/wilswin01_la.dds\",\n \"gta3.img/carpark_sfe.txd/wilswin01_la.dds\",\"gta3.img/a51_ext.txd/wilswin01_la.dds\",\n \"gta3.img/crparkgm_lan2.txd/wilswin01_la.dds\",\"gta3.img/a51_ext.txd/wilswin01_la.dds\",\n \"gta3.img/des_bigearstuff.txd/wilswin01_la.dds\",\"gta3.img/a51_ext.txd/wilswin01_la.dds\",\n \"gta3.img/des_gunclub.txd/wilswin01_la.dds\",\"gta3.img/a51_ext.txd/wilswin01_la.dds\",\n \"gta3.img/des_stownmots1.txd/wilswin01_la.dds\",\"gta3.img/a51_ext.txd/wilswin01_la.dds\",\n \"gta3.img/imrancomp_las2.txd/wilswin01_la.dds\",\"gta3.img/a51_ext.txd/wilswin01_la.dds\",\n \"gta3.img/lawwhitebuilds.txd/wilswin01_la.dds\",\"gta3.img/a51_ext.txd/wilswin01_la.dds\",\n \"gta3.img/vegasemulticar.txd/wilswin01_la.dds\",\"gta3.img/a51_ext.txd/wilswin01_la.dds\",\n \"gta3.img/airport1_sfse.txd/ws_whitewall2_top.dds\",\"gta3.img/a51_ext.txd/ws_whitewall2_top.dds\",\n \"gta3.img/arprtxxref_las.txd/ws_whitewall2_top.dds\",\"gta3.img/a51_ext.txd/ws_whitewall2_top.dds\",\n \"gta3.img/des_stownw.txd/ws_whitewall2_top.dds\",\"gta3.img/a51_ext.txd/ws_whitewall2_top.dds\",\n \"gta3.img/hangar1_sfxref.txd/ws_whitewall2_top.dds\",\"gta3.img/a51_ext.txd/ws_whitewall2_top.dds\",\n \"gta3.img/mission3z_sfse.txd/ws_whitewall2_top.dds\",\"gta3.img/a51_ext.txd/ws_whitewall2_top.dds\",\n \"gta3.img/queens2_sfs.txd/ws_whitewall2_top.dds\",\"gta3.img/a51_ext.txd/ws_whitewall2_top.dds\",\n \"gta3.img/stadbridge_sfs.txd/ws_whitewall2_top.dds\",\"gta3.img/a51_ext.txd/ws_whitewall2_top.dds\",\n \"gta3.img/sw_ware01.txd/ws_whitewall2_top.dds\",\"gta3.img/a51_ext.txd/ws_whitewall2_top.dds\",\n \"gta3.img/vegasshangar.txd/ws_whitewall2_top.dds\",\"gta3.img/a51_ext.txd/ws_whitewall2_top.dds\",\n \"gta3.img/vgnbballsign2.txd/ws_whitewall2_top.dds\",\"gta3.img/a51_ext.txd/ws_whitewall2_top.dds\",\n \"gta3.img/vgnbball.txd/ws_whitewall2_top.dds\",\"gta3.img/a51_ext.txd/ws_whitewall2_top.dds\",\n \"gta3.img/w_town3cs_t.txd/ws_whitewall2_top.dds\",\"gta3.img/a51_ext.txd/ws_whitewall2_top.dds\",\n \"gta3.img/airport1_sfse.txd/ws_whitewall2_bottom.dds\",\"gta3.img/a51_ext.txd/ws_whitewall2_bottom.dds\",\n \"gta3.img/arprtxxref_las.txd/ws_whitewall2_bottom.dds\",\"gta3.img/a51_ext.txd/ws_whitewall2_bottom.dds\",\n \"gta3.img/civic01_lan.txd/ws_whitewall2_bottom.dds\",\"gta3.img/a51_ext.txd/ws_whitewall2_bottom.dds\",\n \"gta3.img/civic03_lan.txd/ws_whitewall2_bottom.dds\",\"gta3.img/a51_ext.txd/ws_whitewall2_bottom.dds\",\n \"gta3.img/des_nwtown.txd/ws_whitewall2_bottom.dds\",\"gta3.img/a51_ext.txd/ws_whitewall2_bottom.dds\",\n \"gta3.img/ebeachcineblok.txd/ws_whitewall2_bottom.dds\",\"gta3.img/a51_ext.txd/ws_whitewall2_bottom.dds\",\n \"gta3.img/foodlawn.txd/ws_whitewall2_bottom.dds\",\"gta3.img/a51_ext.txd/ws_whitewall2_bottom.dds\",\n \"gta3.img/haight1_sfs.txd/ws_whitewall2_bottom.dds\",\"gta3.img/a51_ext.txd/ws_whitewall2_bottom.dds\",\n \"gta3.img/hangar1_sfxref.txd/ws_whitewall2_bottom.dds\",\"gta3.img/a51_ext.txd/ws_whitewall2_bottom.dds\",\n \"gta3.img/lanblokb2.txd/ws_whitewall2_bottom.dds\",\"gta3.img/a51_ext.txd/ws_whitewall2_bottom.dds\",\n \"gta3.img/mission2_sfse.txd/ws_whitewall2_bottom.dds\",\"gta3.img/a51_ext.txd/ws_whitewall2_bottom.dds\",\n \"gta3.img/mission3ground_sfse.txd/ws_whitewall2_bottom.dds\",\"gta3.img/a51_ext.txd/ws_whitewall2_bottom.dds\",\n \"gta3.img/mission3_sfse.txd/ws_whitewall2_bottom.dds\",\"gta3.img/a51_ext.txd/ws_whitewall2_bottom.dds\",\n \"gta3.img/mission3z_sfse.txd/ws_whitewall2_bottom.dds\",\"gta3.img/a51_ext.txd/ws_whitewall2_bottom.dds\",\n \"gta3.img/mission_sfse.txd/ws_whitewall2_bottom.dds\",\"gta3.img/a51_ext.txd/ws_whitewall2_bottom.dds\",\n \"gta3.img/stadbridge_sfs.txd/ws_whitewall2_bottom.dds\",\"gta3.img/a51_ext.txd/ws_whitewall2_bottom.dds\",\n \"gta3.img/sw_block04.txd/ws_whitewall2_bottom.dds\",\"gta3.img/a51_ext.txd/ws_whitewall2_bottom.dds\",\n \"gta3.img/sw_block10.txd/ws_whitewall2_bottom.dds\",\"gta3.img/a51_ext.txd/ws_whitewall2_bottom.dds\",\n \"gta3.img/sw_ware01.txd/ws_whitewall2_bottom.dds\",\"gta3.img/a51_ext.txd/ws_whitewall2_bottom.dds\",\n \"gta3.img/vegashse6.txd/ws_whitewall2_bottom.dds\",\"gta3.img/a51_ext.txd/ws_whitewall2_bottom.dds\",\n \"gta3.img/vegasshangar.txd/ws_whitewall2_bottom.dds\",\"gta3.img/a51_ext.txd/ws_whitewall2_bottom.dds\",\n \"gta3.img/vgnbball.txd/ws_whitewall2_bottom.dds\",\"gta3.img/a51_ext.txd/ws_whitewall2_bottom.dds\",\n \"gta3.img/vgncorp1.txd/ws_whitewall2_bottom.dds\",\"gta3.img/a51_ext.txd/ws_whitewall2_bottom.dds\",\n \"gta3.img/vgs_stadium.txd/ws_whitewall2_bottom.dds\",\"gta3.img/a51_ext.txd/ws_whitewall2_bottom.dds\",\n \"gta3.img/w_town3cs_t.txd/ws_whitewall2_bottom.dds\",\"gta3.img/a51_ext.txd/ws_whitewall2_bottom.dds\",\n \"gta3.img/cuntwbtxcs_t.txd/corugwall_sandy.dds\",\"gta3.img/a51_ext.txd/corugwall_sandy.dds\",\n \"gta3.img/firehouse_sfse.txd/corugwall_sandy.dds\",\"gta3.img/a51_ext.txd/corugwall_sandy.dds\",\n \"gta3.img/milbase.txd/corugwall_sandy.dds\",\"gta3.img/a51_ext.txd/corugwall_sandy.dds\",\n \"gta3.img/venicegb02_law.txd/corugwall_sandy.dds\",\"gta3.img/a51_ext.txd/corugwall_sandy.dds\",\n \"gta3.img/w_town3cs_t.txd/corugwall_sandy.dds\",\"gta3.img/a51_ext.txd/corugwall_sandy.dds\",\n \"gta3.img/a51.txd/ventb128.dds\",\"gta3.img/a51_ext.txd/ventb128.dds\",\n \"gta3.img/bigshap_sfw.txd/ventb128.dds\",\"gta3.img/a51_ext.txd/ventb128.dds\",\n \"gta3.img/sawmillcs_t.txd/ventb128.dds\",\"gta3.img/a51_ext.txd/ventb128.dds\",\n \"gta3.img/bballvgnint.txd/alleydoor2.dds\",\"gta3.img/a51_ext.txd/alleydoor2.dds\",\n \"gta3.img/cetown3cs_t.txd/alleydoor2.dds\",\"gta3.img/a51_ext.txd/alleydoor2.dds\",\n \"gta3.img/cewrehse.txd/alleydoor2.dds\",\"gta3.img/a51_ext.txd/alleydoor2.dds\",\n \"gta3.img/cw2_storesnstuff.txd/alleydoor2.dds\",\"gta3.img/a51_ext.txd/alleydoor2.dds\",\n \"gta3.img/dam_genroom.txd/alleydoor2.dds\",\"gta3.img/a51_ext.txd/alleydoor2.dds\",\n \"gta3.img/desn2_truckstop.txd/alleydoor2.dds\",\"gta3.img/a51_ext.txd/alleydoor2.dds\",\n \"gta3.img/des_nwtown.txd/alleydoor2.dds\",\"gta3.img/a51_ext.txd/alleydoor2.dds\",\n \"gta3.img/eastbeach8_lae2.txd/alleydoor2.dds\",\"gta3.img/a51_ext.txd/alleydoor2.dds\",\n \"gta3.img/gazlaw3.txd/alleydoor2.dds\",\"gta3.img/a51_ext.txd/alleydoor2.dds\",\n \"gta3.img/gazsfn1.txd/alleydoor2.dds\",\"gta3.img/a51_ext.txd/alleydoor2.dds\",\n \"gta3.img/lahillshilhs1c.txd/alleydoor2.dds\",\"gta3.img/a51_ext.txd/alleydoor2.dds\",\n \"gta3.img/mall_law.txd/alleydoor2.dds\",\"gta3.img/a51_ext.txd/alleydoor2.dds\",\n \"gta3.img/rodeo05_law2.txd/alleydoor2.dds\",\"gta3.img/a51_ext.txd/alleydoor2.dds\",\n \"gta3.img/shops2_law.txd/alleydoor2.dds\",\"gta3.img/a51_ext.txd/alleydoor2.dds\",\n \"gta3.img/stuff2_sfn.txd/alleydoor2.dds\",\"gta3.img/a51_ext.txd/alleydoor2.dds\",\n \"gta3.img/sunrise04_lawn.txd/alleydoor2.dds\",\"gta3.img/a51_ext.txd/alleydoor2.dds\",\n \"gta3.img/sw_block12.txd/alleydoor2.dds\",\"gta3.img/a51_ext.txd/alleydoor2.dds\",\n \"gta3.img/vgnoutown2.txd/alleydoor2.dds\",\"gta3.img/a51_ext.txd/alleydoor2.dds\",\n \"gta3.img/vgs_stadium.txd/alleydoor2.dds\",\"gta3.img/a51_ext.txd/alleydoor2.dds\",\n \"gta3.img/vgsswarehse02.txd/alleydoor2.dds\",\"gta3.img/a51_ext.txd/alleydoor2.dds\",\n \"gta3.img/vgwestabats.txd/alleydoor2.dds\",\"gta3.img/a51_ext.txd/alleydoor2.dds\",\n \"gta3.img/vgwestoutwn2.txd/alleydoor2.dds\",\"gta3.img/a51_ext.txd/alleydoor2.dds\",\n \"gta3.img/vgwestretail1.txd/alleydoor2.dds\",\"gta3.img/a51_ext.txd/alleydoor2.dds\",\n \"gta_int.img/ab_abbatoir01.txd/alleydoor2.dds\",\"gta3.img/a51_ext.txd/alleydoor2.dds\",\n \"gta3.img/bev_law2.txd/alleydoor9b.dds\",\"gta3.img/a51_ext.txd/alleydoor9b.dds\",\n \"gta3.img/contachou1_lae2.txd/alleydoor9b.dds\",\"gta3.img/a51_ext.txd/alleydoor9b.dds\",\n \"gta3.img/cw2_storesnstuff.txd/alleydoor9b.dds\",\"gta3.img/a51_ext.txd/alleydoor9b.dds\",\n \"gta3.img/cxrf_payspray.txd/alleydoor9b.dds\",\"gta3.img/a51_ext.txd/alleydoor9b.dds\",\n \"gta3.img/des_wgarage.txd/alleydoor9b.dds\",\"gta3.img/a51_ext.txd/alleydoor9b.dds\",\n \"gta3.img/eastls4_lae2.txd/alleydoor9b.dds\",\"gta3.img/a51_ext.txd/alleydoor9b.dds\",\n \"gta3.img/factory_door.txd/alleydoor9b.dds\",\"gta3.img/a51_ext.txd/alleydoor9b.dds\",\n \"gta3.img/gazlaw2.txd/alleydoor9b.dds\",\"gta3.img/a51_ext.txd/alleydoor9b.dds\",\n \"gta3.img/glenpark6d_lae.txd/alleydoor9b.dds\",\"gta3.img/a51_ext.txd/alleydoor9b.dds\",\n \"gta3.img/lanlacmab_lan2.txd/alleydoor9b.dds\",\"gta3.img/a51_ext.txd/alleydoor9b.dds\",\n \"gta3.img/lasground_las2.txd/alleydoor9b.dds\",\"gta3.img/a51_ext.txd/alleydoor9b.dds\",\n \"gta3.img/lomall.txd/alleydoor9b.dds\",\"gta3.img/a51_ext.txd/alleydoor9b.dds\",\n \"gta3.img/shops01_law.txd/alleydoor9b.dds\",\"gta3.img/a51_ext.txd/alleydoor9b.dds\",\n \"gta3.img/subshops_sfs.txd/alleydoor9b.dds\",\"gta3.img/a51_ext.txd/alleydoor9b.dds\",\n \"gta3.img/sw_poorhouse.txd/alleydoor9b.dds\",\"gta3.img/a51_ext.txd/alleydoor9b.dds\",\n \"gta3.img/vegasairprtland.txd/alleydoor9b.dds\",\"gta3.img/a51_ext.txd/alleydoor9b.dds\",\n \"gta3.img/vgnfremnt1.txd/alleydoor9b.dds\",\"gta3.img/a51_ext.txd/alleydoor9b.dds\",\n \"gta3.img/vgnretail72.txd/alleydoor9b.dds\",\"gta3.img/a51_ext.txd/alleydoor9b.dds\",\n \"gta3.img/vgsswarhse04.txd/alleydoor9b.dds\",\"gta3.img/a51_ext.txd/alleydoor9b.dds\",\n \"gta3.img/carparkssfn.txd/ws_trans_concr.dds\",\"gta3.img/a51_ext.txd/ws_trans_concr.dds\",\n \"gta3.img/ground5_las.txd/ws_trans_concr.dds\",\"gta3.img/a51_ext.txd/ws_trans_concr.dds\",\n \"gta3.img/laroadsigcunt.txd/ws_trans_concr.dds\",\"gta3.img/a51_ext.txd/ws_trans_concr.dds\",\n \"gta3.img/laroadsig_la_cj.txd/ws_trans_concr.dds\",\"gta3.img/a51_ext.txd/ws_trans_concr.dds\",\n \"gta3.img/laroadsig_la.txd/ws_trans_concr.dds\",\"gta3.img/a51_ext.txd/ws_trans_concr.dds\",\n \"gta3.img/newstuff_sfn.txd/ws_trans_concr.dds\",\"gta3.img/a51_ext.txd/ws_trans_concr.dds\",\n \"gta3.img/pointysfe.txd/ws_trans_concr.dds\",\"gta3.img/a51_ext.txd/ws_trans_concr.dds\",\n \"gta3.img/railtracklae.txd/ws_trans_concr.dds\",\"gta3.img/a51_ext.txd/ws_trans_concr.dds\",\n \"gta3.img/sfn_apart02sfn.txd/ws_trans_concr.dds\",\"gta3.img/a51_ext.txd/ws_trans_concr.dds\",\n \"gta3.img/sfroadsign.txd/ws_trans_concr.dds\",\"gta3.img/a51_ext.txd/ws_trans_concr.dds\",\n \"gta3.img/smallertxd.txd/ws_trans_concr.dds\",\"gta3.img/a51_ext.txd/ws_trans_concr.dds\",\n \"gta3.img/stormdrain_las2.txd/ws_trans_concr.dds\",\"gta3.img/a51_ext.txd/ws_trans_concr.dds\",\n \"gta3.img/a51.txd/concretewall22_256.dds\",\"gta3.img/a51_ext.txd/concretewall22_256.dds\",\n \"gta3.img/cunteroads3.txd/concretewall22_256.dds\",\"gta3.img/a51_ext.txd/concretewall22_256.dds\",\n \"gta3.img/gravblok01_lahills.txd/concretewall22_256.dds\",\"gta3.img/a51_ext.txd/concretewall22_256.dds\",\n \"gta3.img/lahillsla_roads.txd/concretewall22_256.dds\",\"gta3.img/a51_ext.txd/concretewall22_256.dds\",\n \"gta3.img/milbase.txd/concretewall22_256.dds\",\"gta3.img/a51_ext.txd/concretewall22_256.dds\",\n \"gta3.img/miragecasino1.txd/concretewall22_256.dds\",\"gta3.img/a51_ext.txd/concretewall22_256.dds\",\n \"gta3.img/mullho05_lahills.txd/concretewall22_256.dds\",\"gta3.img/a51_ext.txd/concretewall22_256.dds\",\n \"gta3.img/smallertxd.txd/concretewall22_256.dds\",\"gta3.img/a51_ext.txd/concretewall22_256.dds\",\n \"gta3.img/tunnel_sfe.txd/concretewall22_256.dds\",\"gta3.img/a51_ext.txd/concretewall22_256.dds\",\n \"gta3.img/vgsecnstrct01.txd/concretewall22_256.dds\",\"gta3.img/a51_ext.txd/concretewall22_256.dds\",\n \"gta3.img/vgsshiways.txd/concretewall22_256.dds\",\"gta3.img/a51_ext.txd/concretewall22_256.dds\",\n \"gta3.img/a51.txd/vgs_shopwall01_128.dds\",\"gta3.img/a51_ext.txd/vgs_shopwall01_128.dds\",\n \"gta3.img/des_cen.txd/vgs_shopwall01_128.dds\",\"gta3.img/a51_ext.txd/vgs_shopwall01_128.dds\",\n \"gta3.img/desertroads.txd/vgs_shopwall01_128.dds\",\"gta3.img/a51_ext.txd/vgs_shopwall01_128.dds\",\n \"gta3.img/desn2_peckers.txd/vgs_shopwall01_128.dds\",\"gta3.img/a51_ext.txd/vgs_shopwall01_128.dds\",\n \"gta3.img/desn_desert.txd/vgs_shopwall01_128.dds\",\"gta3.img/a51_ext.txd/vgs_shopwall01_128.dds\",\n \"gta3.img/des_ne.txd/vgs_shopwall01_128.dds\",\"gta3.img/a51_ext.txd/vgs_shopwall01_128.dds\",\n \"gta3.img/des_n.txd/vgs_shopwall01_128.dds\",\"gta3.img/a51_ext.txd/vgs_shopwall01_128.dds\",\n \"gta3.img/des_nw.txd/vgs_shopwall01_128.dds\",\"gta3.img/a51_ext.txd/vgs_shopwall01_128.dds\",\n \"gta3.img/des_se1.txd/vgs_shopwall01_128.dds\",\"gta3.img/a51_ext.txd/vgs_shopwall01_128.dds\",\n \"gta3.img/des_sw.txd/vgs_shopwall01_128.dds\",\"gta3.img/a51_ext.txd/vgs_shopwall01_128.dds\",\n \"gta3.img/des_wdam.txd/vgs_shopwall01_128.dds\",\"gta3.img/a51_ext.txd/vgs_shopwall01_128.dds\",\n \"gta3.img/ballys02.txd/des_dirt1.dds\",\"gta3.img/a51_ext.txd/des_dirt1.dds\",\n \"gta3.img/ce_ground01.txd/des_dirt1.dds\",\"gta3.img/a51_ext.txd/des_dirt1.dds\",\n \"gta3.img/ce_ground11.txd/des_dirt1.dds\",\"gta3.img/a51_ext.txd/des_dirt1.dds\",\n \"gta3.img/ce_ground12.txd/des_dirt1.dds\",\"gta3.img/a51_ext.txd/des_dirt1.dds\",\n \"gta3.img/cs_coast.txd/des_dirt1.dds\",\"gta3.img/a51_ext.txd/des_dirt1.dds\",\n \"gta3.img/cs_forest.txd/des_dirt1.dds\",\"gta3.img/a51_ext.txd/des_dirt1.dds\",\n \"gta3.img/cs_mountain.txd/des_dirt1.dds\",\"gta3.img/a51_ext.txd/des_dirt1.dds\",\n \"gta3.img/cs_town.txd/des_dirt1.dds\",\"gta3.img/a51_ext.txd/des_dirt1.dds\",\n \"gta3.img/des2vegas_join.txd/des_dirt1.dds\",\"gta3.img/a51_ext.txd/des_dirt1.dds\",\n \"gta3.img/des_cen.txd/des_dirt1.dds\",\"gta3.img/a51_ext.txd/des_dirt1.dds\",\n \"gta3.img/desn_decocafe.txd/des_dirt1.dds\",\"gta3.img/a51_ext.txd/des_dirt1.dds\",\n \"gta3.img/des_ne.txd/des_dirt1.dds\",\"gta3.img/a51_ext.txd/des_dirt1.dds\",\n \"gta3.img/des_n.txd/des_dirt1.dds\",\"gta3.img/a51_ext.txd/des_dirt1.dds\",\n \"gta3.img/des_nw2.txd/des_dirt1.dds\",\"gta3.img/a51_ext.txd/des_dirt1.dds\",\n \"gta3.img/des_nw.txd/des_dirt1.dds\",\"gta3.img/a51_ext.txd/des_dirt1.dds\",\n \"gta3.img/des_se1.txd/des_dirt1.dds\",\"gta3.img/a51_ext.txd/des_dirt1.dds\",\n \"gta3.img/des_se2.txd/des_dirt1.dds\",\"gta3.img/a51_ext.txd/des_dirt1.dds\",\n \"gta3.img/des_se3.txd/des_dirt1.dds\",\"gta3.img/a51_ext.txd/des_dirt1.dds\",\n \"gta3.img/des_se4.txd/des_dirt1.dds\",\"gta3.img/a51_ext.txd/des_dirt1.dds\",\n \"gta3.img/des_s.txd/des_dirt1.dds\",\"gta3.img/a51_ext.txd/des_dirt1.dds\",\n \"gta3.img/des_sw.txd/des_dirt1.dds\",\"gta3.img/a51_ext.txd/des_dirt1.dds\",\n \"gta3.img/flmngoland.txd/des_dirt1.dds\",\"gta3.img/a51_ext.txd/des_dirt1.dds\",\n \"gta3.img/luxorland.txd/des_dirt1.dds\",\"gta3.img/a51_ext.txd/des_dirt1.dds\",\n \"gta3.img/pirateland.txd/des_dirt1.dds\",\"gta3.img/a51_ext.txd/des_dirt1.dds\",\n \"gta3.img/vegassland62.txd/des_dirt1.dds\",\"gta3.img/a51_ext.txd/des_dirt1.dds\",\n \"gta3.img/vgnglfcrse1.txd/des_dirt1.dds\",\"gta3.img/a51_ext.txd/des_dirt1.dds\",\n \"gta3.img/vgnland.txd/des_dirt1.dds\",\"gta3.img/a51_ext.txd/des_dirt1.dds\",\n \"gta3.img/vgsecoast.txd/des_dirt1.dds\",\"gta3.img/a51_ext.txd/des_dirt1.dds\",\n \"gta3.img/vgsehighways.txd/des_dirt1.dds\",\"gta3.img/a51_ext.txd/des_dirt1.dds\",\n \"gta3.img/vgseland.txd/des_dirt1.dds\",\"gta3.img/a51_ext.txd/des_dirt1.dds\",\n \"gta3.img/vgseroads.txd/des_dirt1.dds\",\"gta3.img/a51_ext.txd/des_dirt1.dds\",\n \"gta3.img/vgsland2.txd/des_dirt1.dds\",\"gta3.img/a51_ext.txd/des_dirt1.dds\",\n \"gta3.img/vgsrailroad.txd/des_dirt1.dds\",\"gta3.img/a51_ext.txd/des_dirt1.dds\",\n \"gta3.img/vgssland01.txd/des_dirt1.dds\",\"gta3.img/a51_ext.txd/des_dirt1.dds\",\n \"gta3.img/vgssland02.txd/des_dirt1.dds\",\"gta3.img/a51_ext.txd/des_dirt1.dds\",\n \"gta3.img/vgssland03.txd/des_dirt1.dds\",\"gta3.img/a51_ext.txd/des_dirt1.dds\",\n \"gta3.img/vgssland.txd/des_dirt1.dds\",\"gta3.img/a51_ext.txd/des_dirt1.dds\",\n \"gta3.img/vgwestcoast.txd/des_dirt1.dds\",\"gta3.img/a51_ext.txd/des_dirt1.dds\",\n \"gta3.img/vgwestland.txd/des_dirt1.dds\",\"gta3.img/a51_ext.txd/des_dirt1.dds\",\n \"gta_int.img/dirtrack.txd/des_dirt1.dds\",\"gta3.img/a51_ext.txd/des_dirt1.dds\",\n \"gta3.img/a51.txd/a51_wall1.dds\",\"gta3.img/a51_ext.txd/a51_wall1.dds\",\n \"gta3.img/sw_roadgas.txd/a51_wall1.dds\",\"gta3.img/a51_ext.txd/a51_wall1.dds\",\n \"gta3.img/des_cen.txd/des_dirttrack1.dds\",\"gta3.img/a51_ext.txd/des_dirttrack1.dds\",\n \"gta3.img/des_ne.txd/des_dirttrack1.dds\",\"gta3.img/a51_ext.txd/des_dirttrack1.dds\",\n \"gta3.img/des_n.txd/des_dirttrack1.dds\",\"gta3.img/a51_ext.txd/des_dirttrack1.dds\",\n \"gta3.img/des_nw2.txd/des_dirttrack1.dds\",\"gta3.img/a51_ext.txd/des_dirttrack1.dds\",\n \"gta3.img/des_nw.txd/des_dirttrack1.dds\",\"gta3.img/a51_ext.txd/des_dirttrack1.dds\",\n \"gta3.img/des_se2.txd/des_dirttrack1.dds\",\"gta3.img/a51_ext.txd/des_dirttrack1.dds\",\n \"gta3.img/des_se3.txd/des_dirttrack1.dds\",\"gta3.img/a51_ext.txd/des_dirttrack1.dds\",\n \"gta3.img/des_s.txd/des_dirttrack1.dds\",\"gta3.img/a51_ext.txd/des_dirttrack1.dds\",\n \"gta3.img/des_sw.txd/des_dirttrack1.dds\",\"gta3.img/a51_ext.txd/des_dirttrack1.dds\",\n \"gta3.img/a51.txd/plaintarmac1.dds\",\"gta3.img/a51_ext.txd/plaintarmac1.dds\",\n \"gta3.img/airprtrunway_las.txd/plaintarmac1.dds\",\"gta3.img/a51_ext.txd/plaintarmac1.dds\",\n \"gta3.img/civic04_lan.txd/plaintarmac1.dds\",\"gta3.img/a51_ext.txd/plaintarmac1.dds\",\n \"gta3.img/cs_roads.txd/plaintarmac1.dds\",\"gta3.img/a51_ext.txd/plaintarmac1.dds\",\n \"gta3.img/cs_town.txd/plaintarmac1.dds\",\"gta3.img/a51_ext.txd/plaintarmac1.dds\",\n \"gta3.img/cw2_cinemablockcs_t.txd/plaintarmac1.dds\",\"gta3.img/a51_ext.txd/plaintarmac1.dds\",\n \"gta3.img/cw2_photoblockcs_t.txd/plaintarmac1.dds\",\"gta3.img/a51_ext.txd/plaintarmac1.dds\",\n \"gta3.img/des_cen.txd/plaintarmac1.dds\",\"gta3.img/a51_ext.txd/plaintarmac1.dds\",\n \"gta3.img/eastbeach2a_lae2.txd/plaintarmac1.dds\",\"gta3.img/a51_ext.txd/plaintarmac1.dds\",\n \"gta3.img/ebeachcineblok.txd/plaintarmac1.dds\",\"gta3.img/a51_ext.txd/plaintarmac1.dds\",\n \"gta3.img/fighot.txd/plaintarmac1.dds\",\"gta3.img/a51_ext.txd/plaintarmac1.dds\",\n \"gta3.img/freeway2_las2.txd/plaintarmac1.dds\",\"gta3.img/a51_ext.txd/plaintarmac1.dds\",\n \"gta3.img/freeway2_las.txd/plaintarmac1.dds\",\"gta3.img/a51_ext.txd/plaintarmac1.dds\",\n \"gta3.img/freeway_las.txd/plaintarmac1.dds\",\"gta3.img/a51_ext.txd/plaintarmac1.dds\",\n \"gta3.img/lae2roadshub.txd/plaintarmac1.dds\",\"gta3.img/a51_ext.txd/plaintarmac1.dds\",\n \"gta3.img/lanblokb2.txd/plaintarmac1.dds\",\"gta3.img/a51_ext.txd/plaintarmac1.dds\",\n \"gta3.img/lanbloke.txd/plaintarmac1.dds\",\"gta3.img/a51_ext.txd/plaintarmac1.dds\",\n \"gta3.img/lanbloki.txd/plaintarmac1.dds\",\"gta3.img/a51_ext.txd/plaintarmac1.dds\",\n \"gta3.img/lanriver.txd/plaintarmac1.dds\",\"gta3.img/a51_ext.txd/plaintarmac1.dds\",\n \"gta3.img/luxorpillar1.txd/plaintarmac1.dds\",\"gta3.img/a51_ext.txd/plaintarmac1.dds\",\n \"gta3.img/railway_las.txd/plaintarmac1.dds\",\"gta3.img/a51_ext.txd/plaintarmac1.dds\",\n \"gta3.img/santamopollaw2.txd/plaintarmac1.dds\",\"gta3.img/a51_ext.txd/plaintarmac1.dds\",\n \"gta3.img/traintrack_las.txd/plaintarmac1.dds\",\"gta3.img/a51_ext.txd/plaintarmac1.dds\",\n \"gta3.img/vagabond.txd/plaintarmac1.dds\",\"gta3.img/a51_ext.txd/plaintarmac1.dds\",\n \"gta3.img/vgseland.txd/plaintarmac1.dds\",\"gta3.img/a51_ext.txd/plaintarmac1.dds\",\n \"gta3.img/warehus_las2.txd/plaintarmac1.dds\",\"gta3.img/a51_ext.txd/plaintarmac1.dds\",\n \"gta3.img/w_town2cs_t.txd/plaintarmac1.dds\",\"gta3.img/a51_ext.txd/plaintarmac1.dds\",\n \"gta3.img/w_towncs_t.txd/plaintarmac1.dds\",\"gta3.img/a51_ext.txd/plaintarmac1.dds\",\n \"gta3.img/a51_imy.txd/a51_blastdoor.dds\",\"gta3.img/a51_ext.txd/a51_blastdoor.dds\",\n \"gta3.img/a51_labs.txd/a51_blastdoor.dds\",\"gta3.img/a51_ext.txd/a51_blastdoor.dds\",\n \"gta3.img/a51.txd/a51_blastdoor.dds\",\"gta3.img/a51_ext.txd/a51_blastdoor.dds\",\n \"gta3.img/milbase.txd/a51_blastdoor.dds\",\"gta3.img/a51_ext.txd/a51_blastdoor.dds\",\n \"gta3.img/des_cen.txd/des_dirttrack1r.dds\",\"gta3.img/a51_ext.txd/des_dirttrack1r.dds\",\n \"gta3.img/des_ne.txd/des_dirttrack1r.dds\",\"gta3.img/a51_ext.txd/des_dirttrack1r.dds\",\n \"gta3.img/des_n.txd/des_dirttrack1r.dds\",\"gta3.img/a51_ext.txd/des_dirttrack1r.dds\",\n \"gta3.img/des_nw2.txd/des_dirttrack1r.dds\",\"gta3.img/a51_ext.txd/des_dirttrack1r.dds\",\n \"gta3.img/des_nw.txd/des_dirttrack1r.dds\",\"gta3.img/a51_ext.txd/des_dirttrack1r.dds\",\n \"gta3.img/des_se2.txd/des_dirttrack1r.dds\",\"gta3.img/a51_ext.txd/des_dirttrack1r.dds\",\n \"gta3.img/des_se3.txd/des_dirttrack1r.dds\",\"gta3.img/a51_ext.txd/des_dirttrack1r.dds\",\n \"gta3.img/des_sw.txd/des_dirttrack1r.dds\",\"gta3.img/a51_ext.txd/des_dirttrack1r.dds\",\n \"gta3.img/a51.txd/sm_conc_hatch.dds\",\"gta3.img/a51_ext.txd/sm_conc_hatch.dds\",\n \"gta3.img/des_cen.txd/sm_conc_hatch.dds\",\"gta3.img/a51_ext.txd/sm_conc_hatch.dds\",\n \"gta3.img/law2_roadsb.txd/sm_conc_hatch.dds\",\"gta3.img/a51_ext.txd/sm_conc_hatch.dds\",\n \"gta3.img/milbase.txd/sm_conc_hatch.dds\",\"gta3.img/a51_ext.txd/sm_conc_hatch.dds\",\n \"gta3.img/a51.txd/concreteyellow256=copy.dds\",\"gta3.img/a51_ext.txd/concreteyellow256=copy.dds\",\n \"gta3.img/des_cen.txd/concreteyellow256=copy.dds\",\"gta3.img/a51_ext.txd/concreteyellow256=copy.dds\",\n \"gta3.img/trainplatform_sfse.txd/concreteyellow256=copy.dds\",\"gta3.img/a51_ext.txd/concreteyellow256=copy.dds\",\n \"gta3.img/vgndwntwn22.txd/concreteyellow256=copy.dds\",\"gta3.img/a51_ext.txd/concreteyellow256=copy.dds\",\n \"gta3.img/vgnrailroad.txd/concreteyellow256=copy.dds\",\"gta3.img/a51_ext.txd/concreteyellow256=copy.dds\",\n \"gta3.img/vgsrailroad.txd/concreteyellow256=copy.dds\",\"gta3.img/a51_ext.txd/concreteyellow256=copy.dds\",\n \"gta3.img/vgwestrailrd.txd/concreteyellow256=copy.dds\",\"gta3.img/a51_ext.txd/concreteyellow256=copy.dds\",\n \"gta_int.img/kickstart.txd/concreteyellow256=copy.dds\",\"gta3.img/a51_ext.txd/concreteyellow256=copy.dds\",\n \"gta_int.img/sumostad.txd/concreteyellow256=copy.dds\",\"gta3.img/a51_ext.txd/concreteyellow256=copy.dds\",\n \"gta3.img/ce_ground08.txd/tar_1line256hv.dds\",\"gta3.img/a51_ext.txd/tar_1line256hv.dds\",\n \"gta3.img/cs_ebridge.txd/tar_1line256hv.dds\",\"gta3.img/a51_ext.txd/tar_1line256hv.dds\",\n \"gta3.img/cs_roads.txd/tar_1line256hv.dds\",\"gta3.img/a51_ext.txd/tar_1line256hv.dds\",\n \"gta3.img/cunteroads1.txd/tar_1line256hv.dds\",\"gta3.img/a51_ext.txd/tar_1line256hv.dds\",\n \"gta3.img/cunteroads2.txd/tar_1line256hv.dds\",\"gta3.img/a51_ext.txd/tar_1line256hv.dds\",\n \"gta3.img/cunteroads3.txd/tar_1line256hv.dds\",\"gta3.img/a51_ext.txd/tar_1line256hv.dds\",\n \"gta3.img/cunteroads4.txd/tar_1line256hv.dds\",\"gta3.img/a51_ext.txd/tar_1line256hv.dds\",\n \"gta3.img/cunteroads5.txd/tar_1line256hv.dds\",\"gta3.img/a51_ext.txd/tar_1line256hv.dds\",\n \"gta3.img/des_cen.txd/tar_1line256hv.dds\",\"gta3.img/a51_ext.txd/tar_1line256hv.dds\",\n \"gta3.img/des_nbridge.txd/tar_1line256hv.dds\",\"gta3.img/a51_ext.txd/tar_1line256hv.dds\",\n \"gta3.img/des_ne.txd/tar_1line256hv.dds\",\"gta3.img/a51_ext.txd/tar_1line256hv.dds\",\n \"gta3.img/des_n.txd/tar_1line256hv.dds\",\"gta3.img/a51_ext.txd/tar_1line256hv.dds\",\n \"gta3.img/des_nw2.txd/tar_1line256hv.dds\",\"gta3.img/a51_ext.txd/tar_1line256hv.dds\",\n \"gta3.img/des_nw.txd/tar_1line256hv.dds\",\"gta3.img/a51_ext.txd/tar_1line256hv.dds\",\n \"gta3.img/des_se1.txd/tar_1line256hv.dds\",\"gta3.img/a51_ext.txd/tar_1line256hv.dds\",\n \"gta3.img/des_se2.txd/tar_1line256hv.dds\",\"gta3.img/a51_ext.txd/tar_1line256hv.dds\",\n \"gta3.img/des_se3.txd/tar_1line256hv.dds\",\"gta3.img/a51_ext.txd/tar_1line256hv.dds\",\n \"gta3.img/des_se4.txd/tar_1line256hv.dds\",\"gta3.img/a51_ext.txd/tar_1line256hv.dds\",\n \"gta3.img/des_stownw.txd/tar_1line256hv.dds\",\"gta3.img/a51_ext.txd/tar_1line256hv.dds\",\n \"gta3.img/des_s.txd/tar_1line256hv.dds\",\"gta3.img/a51_ext.txd/tar_1line256hv.dds\",\n \"gta3.img/des_sw.txd/tar_1line256hv.dds\",\"gta3.img/a51_ext.txd/tar_1line256hv.dds\",\n \"gta3.img/des_wdam.txd/tar_1line256hv.dds\",\"gta3.img/a51_ext.txd/tar_1line256hv.dds\",\n \"gta3.img/freeway2_sfs.txd/tar_1line256hv.dds\",\"gta3.img/a51_ext.txd/tar_1line256hv.dds\",\n \"gta3.img/freeways2_sfse.txd/tar_1line256hv.dds\",\"gta3.img/a51_ext.txd/tar_1line256hv.dds\",\n \"gta3.img/lahillsla_roads.txd/tar_1line256hv.dds\",\"gta3.img/a51_ext.txd/tar_1line256hv.dds\",\n \"gta3.img/lahillslaroads.txd/tar_1line256hv.dds\",\"gta3.img/a51_ext.txd/tar_1line256hv.dds\",\n \"gta3.img/lahillsroadscoast.txd/tar_1line256hv.dds\",\"gta3.img/a51_ext.txd/tar_1line256hv.dds\",\n \"gta3.img/mountroads_sfse.txd/tar_1line256hv.dds\",\"gta3.img/a51_ext.txd/tar_1line256hv.dds\",\n \"gta3.img/mullho03_lahills.txd/tar_1line256hv.dds\",\"gta3.img/a51_ext.txd/tar_1line256hv.dds\",\n \"gta3.img/mullho05_lahills.txd/tar_1line256hv.dds\",\"gta3.img/a51_ext.txd/tar_1line256hv.dds\",\n \"gta3.img/roadslahills.txd/tar_1line256hv.dds\",\"gta3.img/a51_ext.txd/tar_1line256hv.dds\",\n \"gta3.img/silconland_sfse.txd/tar_1line256hv.dds\",\"gta3.img/a51_ext.txd/tar_1line256hv.dds\",\n \"gta3.img/sv_ground_sfs.txd/tar_1line256hv.dds\",\"gta3.img/a51_ext.txd/tar_1line256hv.dds\",\n \"gta3.img/cuntwbtxcs_t.txd/des_backdoor1.dds\",\"gta3.img/a51_ext.txd/des_backdoor1.dds\",\n \"gta3.img/des_factory.txd/des_backdoor1.dds\",\"gta3.img/a51_ext.txd/des_backdoor1.dds\",\n \"gta3.img/des_ntown.txd/des_backdoor1.dds\",\"gta3.img/a51_ext.txd/des_backdoor1.dds\",\n \"gta3.img/des_nwtown.txd/des_backdoor1.dds\",\"gta3.img/a51_ext.txd/des_backdoor1.dds\",\n \"gta3.img/des_steakhouse.txd/des_backdoor1.dds\",\"gta3.img/a51_ext.txd/des_backdoor1.dds\",\n \"gta3.img/des_substation.txd/des_backdoor1.dds\",\"gta3.img/a51_ext.txd/des_backdoor1.dds\",\n \"gta3.img/des_telescopestuff.txd/des_backdoor1.dds\",\"gta3.img/a51_ext.txd/des_backdoor1.dds\",\n \"gta3.img/des_wdam.txd/des_backdoor1.dds\",\"gta3.img/a51_ext.txd/des_backdoor1.dds\",\n \"gta3.img/des_wtownmain.txd/des_backdoor1.dds\",\"gta3.img/a51_ext.txd/des_backdoor1.dds\",\n \"gta3.img/ufo_bar.txd/des_backdoor1.dds\",\"gta3.img/a51_ext.txd/des_backdoor1.dds\",\n \"gta3.img/airport1_sfse.txd/ws_controltowerwin1.dds\",\"gta3.img/a51_ext.txd/ws_controltowerwin1.dds\",\n \"gta3.img/boneyard.txd/ws_controltowerwin1.dds\",\"gta3.img/a51_ext.txd/ws_controltowerwin1.dds\",\n \"gta3.img/cw_tempstuffcs_t.txd/ws_controltowerwin1.dds\",\"gta3.img/a51_ext.txd/ws_controltowerwin1.dds\",\n \"gta3.img/des_quarrycrane.txd/ws_controltowerwin1.dds\",\"gta3.img/a51_ext.txd/ws_controltowerwin1.dds\",\n \"gta3.img/a51_undergrnd.txd/block.dds\",\"gta3.img/a51_ext.txd/block.dds\",\n \"gta3.img/bombshop_las.txd/block.dds\",\"gta3.img/a51_ext.txd/block.dds\",\n \"gta3.img/bombshop_sfe.txd/block.dds\",\"gta3.img/a51_ext.txd/block.dds\",\n \"gta3.img/ce_ground12.txd/block.dds\",\"gta3.img/a51_ext.txd/block.dds\",\n \"gta3.img/ce_railbridge.txd/block.dds\",\"gta3.img/a51_ext.txd/block.dds\",\n \"gta3.img/ce_traintrack1.txd/block.dds\",\"gta3.img/a51_ext.txd/block.dds\",\n \"gta3.img/comedbarrio1_la.txd/block.dds\",\"gta3.img/a51_ext.txd/block.dds\",\n \"gta3.img/cunteroads1.txd/block.dds\",\"gta3.img/a51_ext.txd/block.dds\",\n \"gta3.img/cunteroads2.txd/block.dds\",\"gta3.img/a51_ext.txd/block.dds\",\n \"gta3.img/cunteroads4.txd/block.dds\",\"gta3.img/a51_ext.txd/block.dds\",\n \"gta3.img/cunteroads5.txd/block.dds\",\"gta3.img/a51_ext.txd/block.dds\",\n \"gta3.img/cunteroads6.txd/block.dds\",\"gta3.img/a51_ext.txd/block.dds\",\n \"gta3.img/desertmisc.txd/block.dds\",\"gta3.img/a51_ext.txd/block.dds\",\n \"gta3.img/desn2_roadbloks.txd/block.dds\",\"gta3.img/a51_ext.txd/block.dds\",\n \"gta3.img/des_nbridge.txd/block.dds\",\"gta3.img/a51_ext.txd/block.dds\",\n \"gta3.img/des_quarrybits.txd/block.dds\",\"gta3.img/a51_ext.txd/block.dds\",\n \"gta3.img/des_quarrycrane.txd/block.dds\",\"gta3.img/a51_ext.txd/block.dds\",\n \"gta3.img/des_se1.txd/block.dds\",\"gta3.img/a51_ext.txd/block.dds\",\n \"gta3.img/des_se4.txd/block.dds\",\"gta3.img/a51_ext.txd/block.dds\",\n \"gta3.img/des_wgarage.txd/block.dds\",\"gta3.img/a51_ext.txd/block.dds\",\n \"gta3.img/dingbat01_la.txd/block.dds\",\"gta3.img/a51_ext.txd/block.dds\",\n \"gta3.img/firehouse_sfse.txd/block.dds\",\"gta3.img/a51_ext.txd/block.dds\",\n \"gta3.img/lae2roads.txd/block.dds\",\"gta3.img/a51_ext.txd/block.dds\",\n \"gta3.img/lahillslaroads.txd/block.dds\",\"gta3.img/a51_ext.txd/block.dds\",\n \"gta3.img/lan2freeway.txd/block.dds\",\"gta3.img/a51_ext.txd/block.dds\",\n \"gta3.img/landhub.txd/block.dds\",\"gta3.img/a51_ext.txd/block.dds\",\n \"gta3.img/landlae2e.txd/block.dds\",\"gta3.img/a51_ext.txd/block.dds\",\n \"gta3.img/lanroad.txd/block.dds\",\"gta3.img/a51_ext.txd/block.dds\",\n \"gta3.img/mullho03a_lahills.txd/block.dds\",\"gta3.img/a51_ext.txd/block.dds\",\n \"gta3.img/mullho03_lahills.txd/block.dds\",\"gta3.img/a51_ext.txd/block.dds\",\n \"gta3.img/mullho05_lahills.txd/block.dds\",\"gta3.img/a51_ext.txd/block.dds\",\n \"gta3.img/parktunnel_sfs.txd/block.dds\",\"gta3.img/a51_ext.txd/block.dds\",\n \"gta3.img/piera_law2.txd/block.dds\",\"gta3.img/a51_ext.txd/block.dds\",\n \"gta3.img/refinery.txd/block.dds\",\"gta3.img/a51_ext.txd/block.dds\",\n \"gta3.img/roads_lahills.txd/block.dds\",\"gta3.img/a51_ext.txd/block.dds\",\n \"gta3.img/sw_railbridge1.txd/block.dds\",\"gta3.img/a51_ext.txd/block.dds\",\n \"gta3.img/tvtower_sfs.txd/block.dds\",\"gta3.img/a51_ext.txd/block.dds\",\n \"gta3.img/vgnground.txd/block.dds\",\"gta3.img/a51_ext.txd/block.dds\",\n \"gta3.img/vgnplantgen.txd/block.dds\",\"gta3.img/a51_ext.txd/block.dds\",\n \"gta3.img/vgnpwrmainbld.txd/block.dds\",\"gta3.img/a51_ext.txd/block.dds\",\n \"gta3.img/vgnpwroutbld1.txd/block.dds\",\"gta3.img/a51_ext.txd/block.dds\",\n \"gta3.img/vgnpwroutbld2.txd/block.dds\",\"gta3.img/a51_ext.txd/block.dds\",\n \"gta3.img/vgnrailbrdge.txd/block.dds\",\"gta3.img/a51_ext.txd/block.dds\",\n \"gta3.img/vgnretail3.txd/block.dds\",\"gta3.img/a51_ext.txd/block.dds\",\n \"gta3.img/vgseroads.txd/block.dds\",\"gta3.img/a51_ext.txd/block.dds\",\n \"gta3.img/vgsnhighway.txd/block.dds\",\"gta3.img/a51_ext.txd/block.dds\",\n \"gta3.img/vgsroadbridge.txd/block.dds\",\"gta3.img/a51_ext.txd/block.dds\",\n \"gta3.img/vgsshiways.txd/block.dds\",\"gta3.img/a51_ext.txd/block.dds\",\n \"gta3.img/vgssland01.txd/block.dds\",\"gta3.img/a51_ext.txd/block.dds\",\n \"gta3.img/vgssroads.txd/block.dds\",\"gta3.img/a51_ext.txd/block.dds\",\n \"gta3.img/vgwestground.txd/block.dds\",\"gta3.img/a51_ext.txd/block.dds\",\n \"gta3.img/vgwstdirtyrd.txd/block.dds\",\"gta3.img/a51_ext.txd/block.dds\",\n \"gta3.img/vgwsthiway1.txd/block.dds\",\"gta3.img/a51_ext.txd/block.dds\",\n \"gta3.img/vinewood01_lahills.txd/block.dds\",\"gta3.img/a51_ext.txd/block.dds\",\n \"gta_int.img/ab_vegasgymmain.txd/block.dds\",\"gta3.img/a51_ext.txd/block.dds\",\n \"gta3.img/a51_stores.txd/a51_metal1.dds\",\"gta3.img/a51_ext.txd/a51_metal1.dds\",\n \"gta3.img/a51.txd/a51_metal1.dds\",\"gta3.img/a51_ext.txd/a51_metal1.dds\",\n \"gta3.img/milbase.txd/a51_metal1.dds\",\"gta3.img/a51_ext.txd/a51_metal1.dds\",\n \"gta3.img/a51_stores.txd/des_elepylon.dds\",\"gta3.img/a51_ext.txd/des_elepylon.dds\",\n \"gta3.img/cn_substation.txd/des_elepylon.dds\",\"gta3.img/a51_ext.txd/des_elepylon.dds\",\n \"gta3.img/dam_genroom.txd/des_elepylon.dds\",\"gta3.img/a51_ext.txd/des_elepylon.dds\",\n \"gta3.img/des_cn2_dam.txd/des_elepylon.dds\",\"gta3.img/a51_ext.txd/des_elepylon.dds\",\n \"gta3.img/des_substation.txd/des_elepylon.dds\",\"gta3.img/a51_ext.txd/des_elepylon.dds\",\n \"gta3.img/ele_substation.txd/des_elepylon.dds\",\"gta3.img/a51_ext.txd/des_elepylon.dds\",\n \"gta3.img/carimpound_sfe.txd/block2_high.dds\",\"gta3.img/a51_ext.txd/block2_high.dds\",\n \"gta3.img/ce_oldbridge.txd/block2_high.dds\",\"gta3.img/a51_ext.txd/block2_high.dds\",\n \"gta3.img/counte_bridge.txd/block2_high.dds\",\"gta3.img/a51_ext.txd/block2_high.dds\",\n \"gta3.img/desertmisc.txd/block2_high.dds\",\"gta3.img/a51_ext.txd/block2_high.dds\",\n \"gta3.img/des_ne.txd/block2_high.dds\",\"gta3.img/a51_ext.txd/block2_high.dds\",\n \"gta3.img/des_nw.txd/block2_high.dds\",\"gta3.img/a51_ext.txd/block2_high.dds\",\n \"gta3.img/des_quarrybelts.txd/block2_high.dds\",\"gta3.img/a51_ext.txd/block2_high.dds\",\n \"gta3.img/des_quarrybits.txd/block2_high.dds\",\"gta3.img/a51_ext.txd/block2_high.dds\",\n \"gta3.img/des_quarry.txd/block2_high.dds\",\"gta3.img/a51_ext.txd/block2_high.dds\",\n \"gta3.img/des_ranch.txd/block2_high.dds\",\"gta3.img/a51_ext.txd/block2_high.dds\",\n \"gta3.img/des_sw.txd/block2_high.dds\",\"gta3.img/a51_ext.txd/block2_high.dds\",\n \"gta3.img/des_telescopestuff.txd/block2_high.dds\",\"gta3.img/a51_ext.txd/block2_high.dds\",\n \"gta3.img/des_trainstuff.txd/block2_high.dds\",\"gta3.img/a51_ext.txd/block2_high.dds\",\n \"gta3.img/des_ufoinn.txd/block2_high.dds\",\"gta3.img/a51_ext.txd/block2_high.dds\",\n \"gta3.img/freeways_sfse.txd/block2_high.dds\",\"gta3.img/a51_ext.txd/block2_high.dds\",\n \"gta3.img/hillcliff_lahills.txd/block2_high.dds\",\"gta3.img/a51_ext.txd/block2_high.dds\",\n \"gta3.img/lahillslaroads.txd/block2_high.dds\",\"gta3.img/a51_ext.txd/block2_high.dds\",\n \"gta3.img/lanpolicecp.txd/block2_high.dds\",\"gta3.img/a51_ext.txd/block2_high.dds\",\n \"gta3.img/milbase.txd/block2_high.dds\",\"gta3.img/a51_ext.txd/block2_high.dds\",\n \"gta3.img/rodeo03_law2.txd/block2_high.dds\",\"gta3.img/a51_ext.txd/block2_high.dds\",\n \"gta3.img/samsite_sfxrf.txd/block2_high.dds\",\"gta3.img/a51_ext.txd/block2_high.dds\",\n \"gta3.img/sunsetbittyu.txd/block2_high.dds\",\"gta3.img/a51_ext.txd/block2_high.dds\",\n \"gta3.img/sw_farm1.txd/block2_high.dds\",\"gta3.img/a51_ext.txd/block2_high.dds\",\n \"gta3.img/vegascourtbld.txd/block2_high.dds\",\"gta3.img/a51_ext.txd/block2_high.dds\",\n \"gta3.img/vgndwntwn1.txd/block2_high.dds\",\"gta3.img/a51_ext.txd/block2_high.dds\",\n \"gta3.img/vgnplantgen.txd/block2_high.dds\",\"gta3.img/a51_ext.txd/block2_high.dds\",\n \"gta3.img/xenon_sfse.txd/block2_high.dds\",\"gta3.img/a51_ext.txd/block2_high.dds\",\n \"gta3.img/barrio1_lae.txd/cabin5.dds\",\"gta3.img/a51_ext.txd/cabin5.dds\",\n \"gta3.img/car_ship_sfse.txd/cabin5.dds\",\"gta3.img/a51_ext.txd/cabin5.dds\",\n \"gta3.img/cos_bankblock1.txd/cabin5.dds\",\"gta3.img/a51_ext.txd/cabin5.dds\",\n \"gta3.img/cw2_storesnstuff.txd/cabin5.dds\",\"gta3.img/a51_ext.txd/cabin5.dds\",\n \"gta3.img/cw_truckstopcs_t.txd/cabin5.dds\",\"gta3.img/a51_ext.txd/cabin5.dds\",\n \"gta3.img/cxref_desert.txd/cabin5.dds\",\"gta3.img/a51_ext.txd/cabin5.dds\",\n \"gta3.img/des_clifftown.txd/cabin5.dds\",\"gta3.img/a51_ext.txd/cabin5.dds\",\n \"gta3.img/des_gunclub.txd/cabin5.dds\",\"gta3.img/a51_ext.txd/cabin5.dds\",\n \"gta3.img/desn2_truckstop.txd/cabin5.dds\",\"gta3.img/a51_ext.txd/cabin5.dds\",\n \"gta3.img/des_nstuff.txd/cabin5.dds\",\"gta3.img/a51_ext.txd/cabin5.dds\",\n \"gta3.img/des_stownstrip1.txd/cabin5.dds\",\"gta3.img/a51_ext.txd/cabin5.dds\",\n \"gta3.img/des_telescopestuff.txd/cabin5.dds\",\"gta3.img/a51_ext.txd/cabin5.dds\",\n \"gta3.img/des_wgarage.txd/cabin5.dds\",\"gta3.img/a51_ext.txd/cabin5.dds\",\n \"gta3.img/ele_substation.txd/cabin5.dds\",\"gta3.img/a51_ext.txd/cabin5.dds\",\n \"gta3.img/factorycuntw.txd/cabin5.dds\",\"gta3.img/a51_ext.txd/cabin5.dds\",\n \"gta3.img/mainlcawn.txd/cabin5.dds\",\"gta3.img/a51_ext.txd/cabin5.dds\",\n \"gta3.img/refinery.txd/cabin5.dds\",\"gta3.img/a51_ext.txd/cabin5.dds\",\n \"gta3.img/resicarpark.txd/cabin5.dds\",\"gta3.img/a51_ext.txd/cabin5.dds\",\n \"gta3.img/sw_block12.txd/cabin5.dds\",\"gta3.img/a51_ext.txd/cabin5.dds\",\n \"gta3.img/vegasaircon.txd/cabin5.dds\",\"gta3.img/a51_ext.txd/cabin5.dds\",\n \"gta3.img/vegaswrehse1.txd/cabin5.dds\",\"gta3.img/a51_ext.txd/cabin5.dds\",\n \"gta3.img/vgnusedcar.txd/cabin5.dds\",\"gta3.img/a51_ext.txd/cabin5.dds\",\n \"gta3.img/vgsecarshow.txd/cabin5.dds\",\"gta3.img/a51_ext.txd/cabin5.dds\",\n \"gta3.img/wshxrefhse2.txd/cabin5.dds\",\"gta3.img/a51_ext.txd/cabin5.dds\",\n \"gta3.img/a51.txd/vent01_64.dds\",\"gta3.img/a51_ext.txd/vent01_64.dds\",\n \"gta3.img/coast_apts.txd/vent01_64.dds\",\"gta3.img/a51_ext.txd/vent01_64.dds\",\n \"gta3.img/contachou1_lae2.txd/vent01_64.dds\",\"gta3.img/a51_ext.txd/vent01_64.dds\",\n \"gta3.img/des_bighus.txd/vent01_64.dds\",\"gta3.img/a51_ext.txd/vent01_64.dds\",\n \"gta3.img/milbase.txd/vent01_64.dds\",\"gta3.img/a51_ext.txd/vent01_64.dds\",\n \"gta3.img/pylons.txd/vent01_64.dds\",\"gta3.img/a51_ext.txd/vent01_64.dds\",\n \"gta3.img/sunrise01_lawn.txd/vent01_64.dds\",\"gta3.img/a51_ext.txd/vent01_64.dds\",\n \"gta3.img/sw_poorhouse.txd/vent01_64.dds\",\"gta3.img/a51_ext.txd/vent01_64.dds\",\n \"gta3.img/vegasairprtland.txd/vent01_64.dds\",\"gta3.img/a51_ext.txd/vent01_64.dds\",\n \"gta3.img/vgsswarhse04.txd/vent01_64.dds\",\"gta3.img/a51_ext.txd/vent01_64.dds\",\n \"gta3.img/barrio1_lae2.txd/stormdrain2_nt.dds\",\"gta3.img/a51_ext.txd/stormdrain2_nt.dds\",\n \"gta3.img/beafron1_law2.txd/stormdrain2_nt.dds\",\"gta3.img/a51_ext.txd/stormdrain2_nt.dds\",\n \"gta3.img/beafron2_law2.txd/stormdrain2_nt.dds\",\"gta3.img/a51_ext.txd/stormdrain2_nt.dds\",\n \"gta3.img/boxybld_sfw.txd/stormdrain2_nt.dds\",\"gta3.img/a51_ext.txd/stormdrain2_nt.dds\",\n \"gta3.img/des_factory.txd/stormdrain2_nt.dds\",\"gta3.img/a51_ext.txd/stormdrain2_nt.dds\",\n \"gta3.img/des_se1.txd/stormdrain2_nt.dds\",\"gta3.img/a51_ext.txd/stormdrain2_nt.dds\",\n \"gta3.img/des_se4.txd/stormdrain2_nt.dds\",\"gta3.img/a51_ext.txd/stormdrain2_nt.dds\",\n \"gta3.img/des_stownstrip1.txd/stormdrain2_nt.dds\",\"gta3.img/a51_ext.txd/stormdrain2_nt.dds\",\n \"gta3.img/des_sw.txd/stormdrain2_nt.dds\",\"gta3.img/a51_ext.txd/stormdrain2_nt.dds\",\n \"gta3.img/furniture_lae2.txd/stormdrain2_nt.dds\",\"gta3.img/a51_ext.txd/stormdrain2_nt.dds\",\n \"gta3.img/ggbridge_sfn.txd/stormdrain2_nt.dds\",\"gta3.img/a51_ext.txd/stormdrain2_nt.dds\",\n \"gta3.img/glenpark7_lae.txd/stormdrain2_nt.dds\",\"gta3.img/a51_ext.txd/stormdrain2_nt.dds\",\n \"gta3.img/hosbibalsfw.txd/stormdrain2_nt.dds\",\"gta3.img/a51_ext.txd/stormdrain2_nt.dds\",\n \"gta3.img/jeffers5a_lae.txd/stormdrain2_nt.dds\",\"gta3.img/a51_ext.txd/stormdrain2_nt.dds\",\n \"gta3.img/lae2bridge.txd/stormdrain2_nt.dds\",\"gta3.img/a51_ext.txd/stormdrain2_nt.dds\",\n \"gta3.img/lae2roadshub.txd/stormdrain2_nt.dds\",\"gta3.img/a51_ext.txd/stormdrain2_nt.dds\",\n \"gta3.img/lae2roads.txd/stormdrain2_nt.dds\",\"gta3.img/a51_ext.txd/stormdrain2_nt.dds\",\n \"gta3.img/lahillsland.txd/stormdrain2_nt.dds\",\"gta3.img/a51_ext.txd/stormdrain2_nt.dds\",\n \"gta3.img/landcoast_lae2.txd/stormdrain2_nt.dds\",\"gta3.img/a51_ext.txd/stormdrain2_nt.dds\",\n \"gta3.img/landlae2.txd/stormdrain2_nt.dds\",\"gta3.img/a51_ext.txd/stormdrain2_nt.dds\",\n \"gta3.img/landsfw.txd/stormdrain2_nt.dds\",\"gta3.img/a51_ext.txd/stormdrain2_nt.dds\",\n \"gta3.img/lanriver.txd/stormdrain2_nt.dds\",\"gta3.img/a51_ext.txd/stormdrain2_nt.dds\",\n \"gta3.img/lngblok_lae2.txd/stormdrain2_nt.dds\",\"gta3.img/a51_ext.txd/stormdrain2_nt.dds\",\n \"gta3.img/melrose02_lawn.txd/stormdrain2_nt.dds\",\"gta3.img/a51_ext.txd/stormdrain2_nt.dds\",\n \"gta3.img/melrose05_lawn.txd/stormdrain2_nt.dds\",\"gta3.img/a51_ext.txd/stormdrain2_nt.dds\",\n \"gta3.img/melrose19_lawn.txd/stormdrain2_nt.dds\",\"gta3.img/a51_ext.txd/stormdrain2_nt.dds\",\n \"gta3.img/multistory_sfe.txd/stormdrain2_nt.dds\",\"gta3.img/a51_ext.txd/stormdrain2_nt.dds\",\n \"gta3.img/sfroadsign.txd/stormdrain2_nt.dds\",\"gta3.img/a51_ext.txd/stormdrain2_nt.dds\",\n \"gta3.img/stormdra1_lae.txd/stormdrain2_nt.dds\",\"gta3.img/a51_ext.txd/stormdrain2_nt.dds\",\n \"gta3.img/stormdrain2_las2.txd/stormdrain2_nt.dds\",\"gta3.img/a51_ext.txd/stormdrain2_nt.dds\",\n \"gta3.img/stormdrain_las2.txd/stormdrain2_nt.dds\",\"gta3.img/a51_ext.txd/stormdrain2_nt.dds\",\n \"gta3.img/stormdrain.txd/stormdrain2_nt.dds\",\"gta3.img/a51_ext.txd/stormdrain2_nt.dds\",\n \"gta3.img/sunset04_law2.txd/stormdrain2_nt.dds\",\"gta3.img/a51_ext.txd/stormdrain2_nt.dds\",\n \"gta3.img/sunset1_lan2.txd/stormdrain2_nt.dds\",\"gta3.img/a51_ext.txd/stormdrain2_nt.dds\",\n \"gta3.img/a51.txd/concretemanky.dds\",\"gta3.img/a51_ext.txd/concretemanky.dds\",\n \"gta3.img/a51_undergrnd.txd/concretemanky.dds\",\"gta3.img/a51_ext.txd/concretemanky.dds\",\n \"gta3.img/burnsground.txd/concretemanky.dds\",\"gta3.img/a51_ext.txd/concretemanky.dds\",\n \"gta3.img/cecuntetunnel.txd/concretemanky.dds\",\"gta3.img/a51_ext.txd/concretemanky.dds\",\n \"gta3.img/ce_fact01.txd/concretemanky.dds\",\"gta3.img/a51_ext.txd/concretemanky.dds\",\n \"gta3.img/ce_fact03.txd/concretemanky.dds\",\"gta3.img/a51_ext.txd/concretemanky.dds\",\n \"gta3.img/ce_ground09.txd/concretemanky.dds\",\"gta3.img/a51_ext.txd/concretemanky.dds\",\n \"gta3.img/cehillhse14.txd/concretemanky.dds\",\"gta3.img/a51_ext.txd/concretemanky.dds\",\n \"gta3.img/cityhall_lan.txd/concretemanky.dds\",\"gta3.img/a51_ext.txd/concretemanky.dds\",\n \"gta3.img/cityhall_tr_lan.txd/concretemanky.dds\",\"gta3.img/a51_ext.txd/concretemanky.dds\",\n \"gta3.img/civic01_lan.txd/concretemanky.dds\",\"gta3.img/a51_ext.txd/concretemanky.dds\",\n \"gta3.img/civic07_lan.txd/concretemanky.dds\",\"gta3.img/a51_ext.txd/concretemanky.dds\",\n \"gta3.img/cuntwbtxcs_t.txd/concretemanky.dds\",\"gta3.img/a51_ext.txd/concretemanky.dds\",\n \"gta3.img/cw_truckstopcs_t.txd/concretemanky.dds\",\"gta3.img/a51_ext.txd/concretemanky.dds\",\n \"gta3.img/cxrf_payspray.txd/concretemanky.dds\",\"gta3.img/a51_ext.txd/concretemanky.dds\",\n \"gta3.img/des_bigearstuff.txd/concretemanky.dds\",\"gta3.img/a51_ext.txd/concretemanky.dds\",\n \"gta3.img/desn2_peckers.txd/concretemanky.dds\",\"gta3.img/a51_ext.txd/concretemanky.dds\",\n \"gta3.img/des_ne.txd/concretemanky.dds\",\"gta3.img/a51_ext.txd/concretemanky.dds\",\n \"gta3.img/desn_truckstop.txd/concretemanky.dds\",\"gta3.img/a51_ext.txd/concretemanky.dds\",\n \"gta3.img/des_quarrybits.txd/concretemanky.dds\",\"gta3.img/a51_ext.txd/concretemanky.dds\",\n \"gta3.img/des_se4.txd/concretemanky.dds\",\"gta3.img/a51_ext.txd/concretemanky.dds\",\n \"gta3.img/des_stownmain3.txd/concretemanky.dds\",\"gta3.img/a51_ext.txd/concretemanky.dds\",\n \"gta3.img/des_s.txd/concretemanky.dds\",\"gta3.img/a51_ext.txd/concretemanky.dds\",\n \"gta3.img/des_sw.txd/concretemanky.dds\",\"gta3.img/a51_ext.txd/concretemanky.dds\",\n \"gta3.img/des_telescopestuff.txd/concretemanky.dds\",\"gta3.img/a51_ext.txd/concretemanky.dds\",\n \"gta3.img/downtown1_las.txd/concretemanky.dds\",\"gta3.img/a51_ext.txd/concretemanky.dds\",\n \"gta3.img/eastbeach7_lae2.txd/concretemanky.dds\",\"gta3.img/a51_ext.txd/concretemanky.dds\",\n \"gta3.img/ebeachcineblok.txd/concretemanky.dds\",\"gta3.img/a51_ext.txd/concretemanky.dds\",\n \"gta3.img/furniture_lae2.txd/concretemanky.dds\",\"gta3.img/a51_ext.txd/concretemanky.dds\",\n \"gta3.img/glenpark1x_lae.txd/concretemanky.dds\",\"gta3.img/a51_ext.txd/concretemanky.dds\",\n \"gta3.img/hillhousex13_6.txd/concretemanky.dds\",\"gta3.img/a51_ext.txd/concretemanky.dds\",\n \"gta3.img/hosbibalsfw.txd/concretemanky.dds\",\"gta3.img/a51_ext.txd/concretemanky.dds\",\n \"gta3.img/lae2bigblock.txd/concretemanky.dds\",\"gta3.img/a51_ext.txd/concretemanky.dds\",\n \"gta3.img/lahillslaroads.txd/concretemanky.dds\",\"gta3.img/a51_ext.txd/concretemanky.dds\",\n \"gta3.img/laland1_lan2.txd/concretemanky.dds\",\"gta3.img/a51_ext.txd/concretemanky.dds\",\n \"gta3.img/lanblokc.txd/concretemanky.dds\",\"gta3.img/a51_ext.txd/concretemanky.dds\",\n \"gta3.img/lanblokd.txd/concretemanky.dds\",\"gta3.img/a51_ext.txd/concretemanky.dds\",\n \"gta3.img/lanbloke.txd/concretemanky.dds\",\"gta3.img/a51_ext.txd/concretemanky.dds\",\n \"gta3.img/lanblokg.txd/concretemanky.dds\",\"gta3.img/a51_ext.txd/concretemanky.dds\",\n \"gta3.img/lanbloki.txd/concretemanky.dds\",\"gta3.img/a51_ext.txd/concretemanky.dds\",\n \"gta3.img/landlae2c.txd/concretemanky.dds\",\"gta3.img/a51_ext.txd/concretemanky.dds\",\n \"gta3.img/lanriver.txd/concretemanky.dds\",\"gta3.img/a51_ext.txd/concretemanky.dds\",\n \"gta3.img/libhelipad_lan2.txd/concretemanky.dds\",\"gta3.img/a51_ext.txd/concretemanky.dds\",\n \"gta3.img/lngblok_lae2.txd/concretemanky.dds\",\"gta3.img/a51_ext.txd/concretemanky.dds\",\n \"gta3.img/melrose05_lawn.txd/concretemanky.dds\",\"gta3.img/a51_ext.txd/concretemanky.dds\",\n \"gta3.img/richman02_lahills.txd/concretemanky.dds\",\"gta3.img/a51_ext.txd/concretemanky.dds\",\n \"gta3.img/roadslahills.txd/concretemanky.dds\",\"gta3.img/a51_ext.txd/concretemanky.dds\",\n \"gta3.img/shops01_law.txd/concretemanky.dds\",\"gta3.img/a51_ext.txd/concretemanky.dds\",\n \"gta3.img/skyscr1_lan2.txd/concretemanky.dds\",\"gta3.img/a51_ext.txd/concretemanky.dds\",\n \"gta3.img/skyscrap2_lan2.txd/concretemanky.dds\",\"gta3.img/a51_ext.txd/concretemanky.dds\",\n \"gta3.img/smallertxd.txd/concretemanky.dds\",\"gta3.img/a51_ext.txd/concretemanky.dds\",\n \"gta3.img/sunset02_law2.txd/concretemanky.dds\",\"gta3.img/a51_ext.txd/concretemanky.dds\",\n \"gta3.img/sunstr_lawn.txd/concretemanky.dds\",\"gta3.img/a51_ext.txd/concretemanky.dds\",\n \"gta3.img/sw_block9.txd/concretemanky.dds\",\"gta3.img/a51_ext.txd/concretemanky.dds\",\n \"gta3.img/templae2land.txd/concretemanky.dds\",\"gta3.img/a51_ext.txd/concretemanky.dds\",\n \"gta3.img/theatrelan2.txd/concretemanky.dds\",\"gta3.img/a51_ext.txd/concretemanky.dds\",\n \"gta3.img/vgnbball.txd/concretemanky.dds\",\"gta3.img/a51_ext.txd/concretemanky.dds\",\n \"gta3.img/vgsroadbridge.txd/concretemanky.dds\",\"gta3.img/a51_ext.txd/concretemanky.dds\",\n \"gta3.img/vgsshiways.txd/concretemanky.dds\",\"gta3.img/a51_ext.txd/concretemanky.dds\",\n \"gta3.img/a51.txd/a51_intdoor.dds\",\"gta3.img/a51_imy.txd/a51_intdoor.dds\",\n \"gta3.img/a51.txd/bonyrd_skin2.dds\",\"gta3.img/a51jdrx.txd/bonyrd_skin2.dds\",\n \"gta3.img/boneyard.txd/bonyrd_skin2.dds\",\"gta3.img/a51jdrx.txd/bonyrd_skin2.dds\",\n \"gta3.img/cxref_desert.txd/bonyrd_skin2.dds\",\"gta3.img/a51jdrx.txd/bonyrd_skin2.dds\",\n \"gta3.img/cxref_freeway.txd/bonyrd_skin2.dds\",\"gta3.img/a51jdrx.txd/bonyrd_skin2.dds\",\n \"gta3.img/dam_genroom.txd/bonyrd_skin2.dds\",\"gta3.img/a51jdrx.txd/bonyrd_skin2.dds\",\n \"gta3.img/milbase.txd/sam_camo.dds\",\"gta3.img/a51jdrx.txd/sam_camo.dds\",\n \"gta3.img/a51.txd/banding3c_64hv.dds\",\"gta3.img/a51_labs.txd/banding3c_64hv.dds\",\n \"gta3.img/cos_liquorstore.txd/banding3c_64hv.dds\",\"gta3.img/a51_labs.txd/banding3c_64hv.dds\",\n \"gta3.img/cxref_savhus.txd/banding3c_64hv.dds\",\"gta3.img/a51_labs.txd/banding3c_64hv.dds\",\n \"gta3.img/des_airfieldhus.txd/banding3c_64hv.dds\",\"gta3.img/a51_labs.txd/banding3c_64hv.dds\",\n \"gta3.img/des_byofficeint.txd/banding3c_64hv.dds\",\"gta3.img/a51_labs.txd/banding3c_64hv.dds\",\n \"gta3.img/gategen.txd/banding3c_64hv.dds\",\"gta3.img/a51_labs.txd/banding3c_64hv.dds\",\n \"gta3.img/hobos_lawn.txd/banding3c_64hv.dds\",\"gta3.img/a51_labs.txd/banding3c_64hv.dds\",\n \"gta3.img/lanbloke.txd/banding3c_64hv.dds\",\"gta3.img/a51_labs.txd/banding3c_64hv.dds\",\n \"gta3.img/lasxrefdock.txd/banding3c_64hv.dds\",\"gta3.img/a51_labs.txd/banding3c_64hv.dds\",\n \"gta3.img/mp_ranchcut.txd/banding3c_64hv.dds\",\"gta3.img/a51_labs.txd/banding3c_64hv.dds\",\n \"gta3.img/pierb_law2.txd/banding3c_64hv.dds\",\"gta3.img/a51_labs.txd/banding3c_64hv.dds\",\n \"gta3.img/pyr_roof.txd/banding3c_64hv.dds\",\"gta3.img/a51_labs.txd/banding3c_64hv.dds\",\n \"gta3.img/stormdrain.txd/banding3c_64hv.dds\",\"gta3.img/a51_labs.txd/banding3c_64hv.dds\",\n \"gta3.img/sunrise09_lawn.txd/banding3c_64hv.dds\",\"gta3.img/a51_labs.txd/banding3c_64hv.dds\",\n \"gta3.img/sw_block05.txd/banding3c_64hv.dds\",\"gta3.img/a51_labs.txd/banding3c_64hv.dds\",\n \"gta3.img/ufo_barbakroom.txd/banding3c_64hv.dds\",\"gta3.img/a51_labs.txd/banding3c_64hv.dds\",\n \"gta3.img/vegaswrehse1.txd/banding3c_64hv.dds\",\"gta3.img/a51_labs.txd/banding3c_64hv.dds\",\n \"gta3.img/vgnrailbrdge.txd/banding3c_64hv.dds\",\"gta3.img/a51_labs.txd/banding3c_64hv.dds\",\n \"gta3.img/vgsbldng1.txd/banding3c_64hv.dds\",\"gta3.img/a51_labs.txd/banding3c_64hv.dds\",\n \"gta3.img/a51.txd/a51_cardreader.dds\",\"gta3.img/a51_labs.txd/a51_cardreader.dds\",\n \"gta3.img/cephotoblockcs_t.txd/studiowall4_law.dds\",\"gta3.img/a51_labs.txd/studiowall4_law.dds\",\n \"gta3.img/ebeachcineblok.txd/studiowall4_law.dds\",\"gta3.img/a51_labs.txd/studiowall4_law.dds\",\n \"gta3.img/sw_fact01a.txd/studiowall4_law.dds\",\"gta3.img/a51_labs.txd/studiowall4_law.dds\",\n \"gta3.img/sw_office.txd/studiowall4_law.dds\",\"gta3.img/a51_labs.txd/studiowall4_law.dds\",\n \"gta3.img/vegascourtbld.txd/studiowall4_law.dds\",\"gta3.img/a51_labs.txd/studiowall4_law.dds\",\n \"gta3.img/vegashse3.txd/studiowall4_law.dds\",\"gta3.img/a51_labs.txd/studiowall4_law.dds\",\n \"gta3.img/vgs_stadium.txd/studiowall4_law.dds\",\"gta3.img/a51_labs.txd/studiowall4_law.dds\",\n \"gta_int.img/genintclothessport.txd/studiowall4_law.dds\",\"gta3.img/a51_labs.txd/studiowall4_law.dds\",\n \"gta3.img/coast_apts.txd/washapartwall1_256.dds\",\"gta3.img/a51_labs.txd/washapartwall1_256.dds\",\n \"gta3.img/cos_pizzaplace.txd/washapartwall1_256.dds\",\"gta3.img/a51_labs.txd/washapartwall1_256.dds\",\n \"gta3.img/desn_decocafe.txd/washapartwall1_256.dds\",\"gta3.img/a51_labs.txd/washapartwall1_256.dds\",\n \"gta3.img/des_stownstrip2.txd/washapartwall1_256.dds\",\"gta3.img/a51_labs.txd/washapartwall1_256.dds\",\n \"gta3.img/eastbeach3c_lae2.txd/washapartwall1_256.dds\",\"gta3.img/a51_labs.txd/washapartwall1_256.dds\",\n \"gta3.img/mainlcawn.txd/washapartwall1_256.dds\",\"gta3.img/a51_labs.txd/washapartwall1_256.dds\",\n \"gta3.img/rodeo02_law2.txd/washapartwall1_256.dds\",\"gta3.img/a51_labs.txd/washapartwall1_256.dds\",\n \"gta3.img/sw_block06.txd/washapartwall1_256.dds\",\"gta3.img/a51_labs.txd/washapartwall1_256.dds\",\n \"gta3.img/vgnabatoir.txd/washapartwall1_256.dds\",\"gta3.img/a51_labs.txd/washapartwall1_256.dds\",\n \"gta_int.img/dr_gsnew.txd/washapartwall1_256.dds\",\"gta3.img/a51_labs.txd/washapartwall1_256.dds\",\n \"gta_int.img/madpoolbit.txd/washapartwall1_256.dds\",\"gta3.img/a51_labs.txd/washapartwall1_256.dds\",\n \"gta3.img/a51.txd/ws_stationfloor.dds\",\"gta3.img/a51_labs.txd/ws_stationfloor.dds\",\n \"gta3.img/cathedral_sfs.txd/ws_stationfloor.dds\",\"gta3.img/a51_labs.txd/ws_stationfloor.dds\",\n \"gta3.img/cityhall_sfs.txd/ws_stationfloor.dds\",\"gta3.img/a51_labs.txd/ws_stationfloor.dds\",\n \"gta3.img/docg01_lahills.txd/ws_stationfloor.dds\",\"gta3.img/a51_labs.txd/ws_stationfloor.dds\",\n \"gta3.img/hotel1.txd/ws_stationfloor.dds\",\"gta3.img/a51_labs.txd/ws_stationfloor.dds\",\n \"gta3.img/lahillshilhs1b.txd/ws_stationfloor.dds\",\"gta3.img/a51_labs.txd/ws_stationfloor.dds\",\n \"gta3.img/lahillshilhs1d.txd/ws_stationfloor.dds\",\"gta3.img/a51_labs.txd/ws_stationfloor.dds\",\n \"gta3.img/lahillshilhs1z.txd/ws_stationfloor.dds\",\"gta3.img/a51_labs.txd/ws_stationfloor.dds\",\n \"gta3.img/lahillshilhse.txd/ws_stationfloor.dds\",\"gta3.img/a51_labs.txd/ws_stationfloor.dds\",\n \"gta3.img/plaza1_lan2.txd/ws_stationfloor.dds\",\"gta3.img/a51_labs.txd/ws_stationfloor.dds\",\n \"gta3.img/silicon2_sfse.txd/ws_stationfloor.dds\",\"gta3.img/a51_labs.txd/ws_stationfloor.dds\",\n \"gta3.img/station_sfse.txd/ws_stationfloor.dds\",\"gta3.img/a51_labs.txd/ws_stationfloor.dds\",\n \"gta3.img/vegenmotel.txd/ws_stationfloor.dds\",\"gta3.img/a51_labs.txd/ws_stationfloor.dds\",\n \"gta3.img/vgncircir.txd/ws_stationfloor.dds\",\"gta3.img/a51_labs.txd/ws_stationfloor.dds\",\n \"gta_int.img/cj_barb2.txd/ws_stationfloor.dds\",\"gta3.img/a51_labs.txd/ws_stationfloor.dds\",\n \"gta_int.img/cj_barb.txd/ws_stationfloor.dds\",\"gta3.img/a51_labs.txd/ws_stationfloor.dds\",\n \"gta_int.img/cj_casino_prop.txd/ws_stationfloor.dds\",\"gta3.img/a51_labs.txd/ws_stationfloor.dds\",\n \"gta_int.img/dr_gsnew.txd/ws_stationfloor.dds\",\"gta3.img/a51_labs.txd/ws_stationfloor.dds\",\n \"gta_int.img/genintint711_1.txd/ws_stationfloor.dds\",\"gta3.img/a51_labs.txd/ws_stationfloor.dds\",\n \"gta_int.img/madpoolbit.txd/ws_stationfloor.dds\",\"gta3.img/a51_labs.txd/ws_stationfloor.dds\",\n \"gta_int.img/scummy.txd/ws_stationfloor.dds\",\"gta3.img/a51_labs.txd/ws_stationfloor.dds\",\n \"gta3.img/a51.txd/stormdrain7.dds\",\"gta3.img/a51_labs.txd/stormdrain7.dds\",\n \"gta3.img/eastbeach3c_lae2.txd/stormdrain7.dds\",\"gta3.img/a51_labs.txd/stormdrain7.dds\",\n \"gta3.img/glenpark7_lae.txd/stormdrain7.dds\",\"gta3.img/a51_labs.txd/stormdrain7.dds\",\n \"gta3.img/hotel1.txd/stormdrain7.dds\",\"gta3.img/a51_labs.txd/stormdrain7.dds\",\n \"gta3.img/dam_genroom.txd/dam_terazzo.dds\",\"gta3.img/a51_labs.txd/dam_terazzo.dds\",\n \"gta3.img/cw_truckstopcs_t.txd/a51_labwall1.dds\",\"gta3.img/a51_labs.txd/a51_labwall1.dds\",\n \"gta3.img/desn_truckstop.txd/a51_labwall1.dds\",\"gta3.img/a51_labs.txd/a51_labwall1.dds\",\n \"gta3.img/sw_fact01.txd/a51_labwall1.dds\",\"gta3.img/a51_labs.txd/a51_labwall1.dds\",\n \"gta3.img/cuntwlandwest.txd/stormdrain5_nt.dds\",\"gta3.img/a51_spotlight.txd/stormdrain5_nt.dds\",\n \"gta3.img/cw2_storesnstuff.txd/stormdrain5_nt.dds\",\"gta3.img/a51_spotlight.txd/stormdrain5_nt.dds\",\n \"gta3.img/airport_las.txd/metpat64chev_128.dds\",\"gta3.img/a51_stores.txd/metpat64chev_128.dds\",\n \"gta3.img/vgnplantgen.txd/metpat64chev_128.dds\",\"gta3.img/a51_stores.txd/metpat64chev_128.dds\",\n \"gta3.img/des_telescopestuff.txd/dish_panel_a.dds\",\"gta3.img/a51_stores.txd/dish_panel_a.dds\",\n \"gta3.img/des_telescopestuff.txd/dish_roundbit_a.dds\",\"gta3.img/a51_stores.txd/dish_roundbit_a.dds\",\n \"gta3.img/airportgnd_sfse.txd/steel64.dds\",\"gta3.img/a51_stores.txd/steel64.dds\",\n \"gta3.img/beafron1_law2.txd/steel64.dds\",\"gta3.img/a51_stores.txd/steel64.dds\",\n \"gta3.img/beafron2_law2.txd/steel64.dds\",\"gta3.img/a51_stores.txd/steel64.dds\",\n \"gta3.img/con_stuff.txd/steel64.dds\",\"gta3.img/a51_stores.txd/steel64.dds\",\n \"gta3.img/cunte_house1.txd/steel64.dds\",\"gta3.img/a51_stores.txd/steel64.dds\",\n \"gta3.img/des_bighus.txd/steel64.dds\",\"gta3.img/a51_stores.txd/steel64.dds\",\n \"gta3.img/des_boneyard.txd/steel64.dds\",\"gta3.img/a51_stores.txd/steel64.dds\",\n \"gta3.img/des_refinery.txd/steel64.dds\",\"gta3.img/a51_stores.txd/steel64.dds\",\n \"gta3.img/dockcargo1_las.txd/steel64.dds\",\"gta3.img/a51_stores.txd/steel64.dds\",\n \"gta3.img/docks_las2.txd/steel64.dds\",\"gta3.img/a51_stores.txd/steel64.dds\",\n \"gta3.img/freightcrane.txd/steel64.dds\",\"gta3.img/a51_stores.txd/steel64.dds\",\n \"gta3.img/gategen.txd/steel64.dds\",\"gta3.img/a51_stores.txd/steel64.dds\",\n \"gta3.img/grasshouse.txd/steel64.dds\",\"gta3.img/a51_stores.txd/steel64.dds\",\n \"gta3.img/lahillshilhs1b.txd/steel64.dds\",\"gta3.img/a51_stores.txd/steel64.dds\",\n \"gta3.img/lahillshilhs1d.txd/steel64.dds\",\"gta3.img/a51_stores.txd/steel64.dds\",\n \"gta3.img/lahillshilhs1z.txd/steel64.dds\",\"gta3.img/a51_stores.txd/steel64.dds\",\n \"gta3.img/lahillshilhse.txd/steel64.dds\",\"gta3.img/a51_stores.txd/steel64.dds\",\n \"gta3.img/lasxrefdock.txd/steel64.dds\",\"gta3.img/a51_stores.txd/steel64.dds\",\n \"gta3.img/pierb_law2.txd/steel64.dds\",\"gta3.img/a51_stores.txd/steel64.dds\",\n \"gta3.img/pierc_law2.txd/steel64.dds\",\"gta3.img/a51_stores.txd/steel64.dds\",\n \"gta3.img/santamonicalaw2.txd/steel64.dds\",\"gta3.img/a51_stores.txd/steel64.dds\",\n \"gta3.img/stormdra1_lae.txd/steel64.dds\",\"gta3.img/a51_stores.txd/steel64.dds\",\n \"gta3.img/subpen2_sfse.txd/steel64.dds\",\"gta3.img/a51_stores.txd/steel64.dds\",\n \"gta3.img/sw_poorhouse.txd/steel64.dds\",\"gta3.img/a51_stores.txd/steel64.dds\",\n \"gta3.img/vegasflag.txd/steel64.dds\",\"gta3.img/a51_stores.txd/steel64.dds\",\n \"gta3.img/vegaswrehse1.txd/steel64.dds\",\"gta3.img/a51_stores.txd/steel64.dds\",\n \"gta3.img/vgnabatoir.txd/steel64.dds\",\"gta3.img/a51_stores.txd/steel64.dds\",\n \"gta3.img/vgnbballsign2.txd/steel64.dds\",\"gta3.img/a51_stores.txd/steel64.dds\",\n \"gta3.img/vgncorp1.txd/steel64.dds\",\"gta3.img/a51_stores.txd/steel64.dds\",\n \"gta3.img/vgndwntwn2.txd/steel64.dds\",\"gta3.img/a51_stores.txd/steel64.dds\",\n \"gta3.img/vgndwntwn5.txd/steel64.dds\",\"gta3.img/a51_stores.txd/steel64.dds\",\n \"gta3.img/vgnfirestat.txd/steel64.dds\",\"gta3.img/a51_stores.txd/steel64.dds\",\n \"gta3.img/vgnlowbild.txd/steel64.dds\",\"gta3.img/a51_stores.txd/steel64.dds\",\n \"gta3.img/vgnplantgen.txd/steel64.dds\",\"gta3.img/a51_stores.txd/steel64.dds\",\n \"gta3.img/vgse24hr.txd/steel64.dds\",\"gta3.img/a51_stores.txd/steel64.dds\",\n \"gta3.img/vgssairport02.txd/steel64.dds\",\"gta3.img/a51_stores.txd/steel64.dds\",\n \"gta3.img/vgssmulticarprk.txd/steel64.dds\",\"gta3.img/a51_stores.txd/steel64.dds\",\n \"gta3.img/wc_lift_sfse.txd/steel64.dds\",\"gta3.img/a51_stores.txd/steel64.dds\",\n \"gta3.img/xenon_sfse.txd/steel64.dds\",\"gta3.img/a51_stores.txd/steel64.dds\",\n \"gta3.img/cos_liquorstore.txd/wtmetal3.dds\",\"gta3.img/a51_stores.txd/wtmetal3.dds\",\n \"gta3.img/countryclub_sfs.txd/wtmetal3.dds\",\"gta3.img/a51_stores.txd/wtmetal3.dds\",\n \"gta3.img/refinery.txd/wtmetal3.dds\",\"gta3.img/a51_stores.txd/wtmetal3.dds\",\n \"gta3.img/tikisign.txd/wtmetal3.dds\",\"gta3.img/a51_stores.txd/wtmetal3.dds\",\n \"gta3.img/wddngchplsign2.txd/wtmetal3.dds\",\"gta3.img/a51_stores.txd/wtmetal3.dds\",\n \"gta3.img/cs_ry_props.txd/metalic128.dds\",\"gta3.img/a51_stores.txd/metalic128.dds\",\n \"gta3.img/cuntwshopscs_t.txd/metalic128.dds\",\"gta3.img/a51_stores.txd/metalic128.dds\",\n \"gta3.img/milbase.txd/metalic128.dds\",\"gta3.img/a51_stores.txd/metalic128.dds\",\n \"gta3.img/ufo_bar.txd/metalic128.dds\",\"gta3.img/a51_stores.txd/metalic128.dds\",\n \"gta3.img/vgntrainstat.txd/metalic128.dds\",\"gta3.img/a51_stores.txd/metalic128.dds\",\n \"gta3.img/vgnvrock.txd/metalic128.dds\",\"gta3.img/a51_stores.txd/metalic128.dds\",\n \"gta3.img/vgsssignage02.txd/metalic128.dds\",\"gta3.img/a51_stores.txd/metalic128.dds\",\n \"gta3.img/wshxrefpump.txd/metalic128.dds\",\"gta3.img/a51_stores.txd/metalic128.dds\",\n \"gta_int.img/ab_trukstpc.txd/metalic128.dds\",\"gta3.img/a51_stores.txd/metalic128.dds\",\n \"gta_int.img/gb_dirtycrock01.txd/metalic128.dds\",\"gta3.img/a51_stores.txd/metalic128.dds\",\n \"gta_int.img/labig3int2.txd/metalic128.dds\",\"gta3.img/a51_stores.txd/metalic128.dds\",\n \"gta3.img/ce_ground10.txd/des_ghotwood1.dds\",\"gta3.img/a51_stores.txd/des_ghotwood1.dds\",\n \"gta3.img/country_breakable.txd/des_ghotwood1.dds\",\"gta3.img/a51_stores.txd/des_ghotwood1.dds\",\n \"gta3.img/cuntwbt.txd/des_ghotwood1.dds\",\"gta3.img/a51_stores.txd/des_ghotwood1.dds\",\n \"gta3.img/cuntwlandcent.txd/des_ghotwood1.dds\",\"gta3.img/a51_stores.txd/des_ghotwood1.dds\",\n \"gta3.img/cuntwland.txd/des_ghotwood1.dds\",\"gta3.img/a51_stores.txd/des_ghotwood1.dds\",\n \"gta3.img/cuntwshopscs_t.txd/des_ghotwood1.dds\",\"gta3.img/a51_stores.txd/des_ghotwood1.dds\",\n \"gta3.img/cw2_logcabins.txd/des_ghotwood1.dds\",\"gta3.img/a51_stores.txd/des_ghotwood1.dds\",\n \"gta3.img/cw2_photoblockcs_t.txd/des_ghotwood1.dds\",\"gta3.img/a51_stores.txd/des_ghotwood1.dds\",\n \"gta3.img/cw2_storesnstuff.txd/des_ghotwood1.dds\",\"gta3.img/a51_stores.txd/des_ghotwood1.dds\",\n \"gta3.img/cwsbarn.txd/des_ghotwood1.dds\",\"gta3.img/a51_stores.txd/des_ghotwood1.dds\",\n \"gta3.img/cw_truckstopcs_t.txd/des_ghotwood1.dds\",\"gta3.img/a51_stores.txd/des_ghotwood1.dds\",\n \"gta3.img/cxref_desert.txd/des_ghotwood1.dds\",\"gta3.img/a51_stores.txd/des_ghotwood1.dds\",\n \"gta3.img/cxref_oldwest.txd/des_ghotwood1.dds\",\"gta3.img/a51_stores.txd/des_ghotwood1.dds\",\n \"gta3.img/cxref_savhus.txd/des_ghotwood1.dds\",\"gta3.img/a51_stores.txd/des_ghotwood1.dds\",\n \"gta3.img/des_airfieldhus.txd/des_ghotwood1.dds\",\"gta3.img/a51_stores.txd/des_ghotwood1.dds\",\n \"gta3.img/des_baitshop.txd/des_ghotwood1.dds\",\"gta3.img/a51_stores.txd/des_ghotwood1.dds\",\n \"gta3.img/des_bighus.txd/des_ghotwood1.dds\",\"gta3.img/a51_stores.txd/des_ghotwood1.dds\",\n \"gta3.img/des_farmstuff.txd/des_ghotwood1.dds\",\"gta3.img/a51_stores.txd/des_ghotwood1.dds\",\n \"gta3.img/desn2_minestuff.txd/des_ghotwood1.dds\",\"gta3.img/a51_stores.txd/des_ghotwood1.dds\",\n \"gta3.img/des_nstuff.txd/des_ghotwood1.dds\",\"gta3.img/a51_stores.txd/des_ghotwood1.dds\",\n \"gta3.img/desn_truckstop.txd/des_ghotwood1.dds\",\"gta3.img/a51_stores.txd/des_ghotwood1.dds\",\n \"gta3.img/des_nwtown.txd/des_ghotwood1.dds\",\"gta3.img/a51_stores.txd/des_ghotwood1.dds\",\n \"gta3.img/des_quarrybelts.txd/des_ghotwood1.dds\",\"gta3.img/a51_stores.txd/des_ghotwood1.dds\",\n \"gta3.img/des_ranch.txd/des_ghotwood1.dds\",\"gta3.img/a51_stores.txd/des_ghotwood1.dds\",\n \"gta3.img/des_stownmain2.txd/des_ghotwood1.dds\",\"gta3.img/a51_stores.txd/des_ghotwood1.dds\",\n \"gta3.img/des_stownw.txd/des_ghotwood1.dds\",\"gta3.img/a51_stores.txd/des_ghotwood1.dds\",\n \"gta3.img/des_ufoinn.txd/des_ghotwood1.dds\",\"gta3.img/a51_stores.txd/des_ghotwood1.dds\",\n \"gta3.img/des_wtownmain.txd/des_ghotwood1.dds\",\"gta3.img/a51_stores.txd/des_ghotwood1.dds\",\n \"gta3.img/oldwest.txd/des_ghotwood1.dds\",\"gta3.img/a51_stores.txd/des_ghotwood1.dds\",\n \"gta3.img/sw_smlfarm.txd/des_ghotwood1.dds\",\"gta3.img/a51_stores.txd/des_ghotwood1.dds\",\n \"gta3.img/truth_farm.txd/des_ghotwood1.dds\",\"gta3.img/a51_stores.txd/des_ghotwood1.dds\",\n \"gta3.img/ufo_bar.txd/des_ghotwood1.dds\",\"gta3.img/a51_stores.txd/des_ghotwood1.dds\",\n \"gta_int.img/gf3.txd/des_ghotwood1.dds\",\"gta3.img/a51_stores.txd/des_ghotwood1.dds\",\n \"gta_int.img/gf4.txd/des_ghotwood1.dds\",\"gta3.img/a51_stores.txd/des_ghotwood1.dds\",\n \"gta3.img/dam_genroom.txd/dam_gencrane.dds\",\"gta3.img/a51_stores.txd/dam_gencrane.dds\",\n \"gta3.img/milbase.txd/dam_gencrane.dds\",\"gta3.img/a51_stores.txd/dam_gencrane.dds\",\n \"gta3.img/bev_law2.txd/fence_64.dds\",\"gta3.img/a51_stores.txd/fence_64.dds\",\n \"gta3.img/car_ship_sfse.txd/fence_64.dds\",\"gta3.img/a51_stores.txd/fence_64.dds\",\n \"gta3.img/des_telescopestuff.txd/fence_64.dds\",\"gta3.img/a51_stores.txd/fence_64.dds\",\n \"gta3.img/factorycuntw.txd/fence_64.dds\",\"gta3.img/a51_stores.txd/fence_64.dds\",\n \"gta3.img/filmstud.txd/fence_64.dds\",\"gta3.img/a51_stores.txd/fence_64.dds\",\n \"gta3.img/gravblok01_lahills.txd/fence_64.dds\",\"gta3.img/a51_stores.txd/fence_64.dds\",\n \"gta3.img/lae2coast_alpha.txd/fence_64.dds\",\"gta3.img/a51_stores.txd/fence_64.dds\",\n \"gta3.img/lawalphav.txd/fence_64.dds\",\"gta3.img/a51_stores.txd/fence_64.dds\",\n \"gta3.img/lawwhitebuilds.txd/fence_64.dds\",\"gta3.img/a51_stores.txd/fence_64.dds\",\n \"gta3.img/maingatetxd.txd/fence_64.dds\",\"gta3.img/a51_stores.txd/fence_64.dds\",\n \"gta3.img/milbase.txd/fence_64.dds\",\"gta3.img/a51_stores.txd/fence_64.dds\",\n \"gta3.img/samsite_sfxrf.txd/fence_64.dds\",\"gta3.img/a51_stores.txd/fence_64.dds\",\n \"gta3.img/santamonhus.txd/fence_64.dds\",\"gta3.img/a51_stores.txd/fence_64.dds\",\n \"gta3.img/studio01_lawn.txd/fence_64.dds\",\"gta3.img/a51_stores.txd/fence_64.dds\",\n \"gta3.img/sunrise10_lawn.txd/fence_64.dds\",\"gta3.img/a51_stores.txd/fence_64.dds\",\n \"gta3.img/vegasbuild.txd/fence_64.dds\",\"gta3.img/a51_stores.txd/fence_64.dds\",\n \"gta3.img/vegasdwntwn1.txd/fence_64.dds\",\"gta3.img/a51_stores.txd/fence_64.dds\",\n \"gta3.img/vgncnstrct1.txd/fence_64.dds\",\"gta3.img/a51_stores.txd/fence_64.dds\",\n \"gta3.img/vgnpwrmainbld.txd/fence_64.dds\",\"gta3.img/a51_stores.txd/fence_64.dds\",\n \"gta3.img/vgnpwroutbld2.txd/fence_64.dds\",\"gta3.img/a51_stores.txd/fence_64.dds\",\n \"gta3.img/vgnpwroutbld3.txd/fence_64.dds\",\"gta3.img/a51_stores.txd/fence_64.dds\",\n \"gta3.img/vgsecnstrct01.txd/fence_64.dds\",\"gta3.img/a51_stores.txd/fence_64.dds\",\n \"gta3.img/vgsncircon.txd/fence_64.dds\",\"gta3.img/a51_stores.txd/fence_64.dds\",\n \"gta3.img/satdish.txd/hangingwires1.dds\",\"gta3.img/a51_stores.txd/hangingwires1.dds\",\n \"gta3.img/bighangarsfxr.txd/wallgreyred128.dds\",\"gta3.img/a51.txd/wallgreyred128.dds\",\n \"gta3.img/des_boneyard.txd/wallgreyred128.dds\",\"gta3.img/a51.txd/wallgreyred128.dds\",\n \"gta3.img/garage_sfw.txd/wallgreyred128.dds\",\"gta3.img/a51.txd/wallgreyred128.dds\",\n \"gta3.img/ground4_las.txd/wallgreyred128.dds\",\"gta3.img/a51.txd/wallgreyred128.dds\",\n \"gta3.img/ground5_las.txd/wallgreyred128.dds\",\"gta3.img/a51.txd/wallgreyred128.dds\",\n \"gta3.img/vegasshangar.txd/wallgreyred128.dds\",\"gta3.img/a51.txd/wallgreyred128.dds\",\n \"gta3.img/vgsespras.txd/wallgreyred128.dds\",\"gta3.img/a51.txd/wallgreyred128.dds\",\n \"gta3.img/vgssairportcpark.txd/wallgreyred128.dds\",\"gta3.img/a51.txd/wallgreyred128.dds\",\n \"gta3.img/dam_genroom.txd/dam_gencon.dds\",\"gta3.img/a51.txd/dam_gencon.dds\",\n \"gta3.img/milbase.txd/dam_gencon.dds\",\"gta3.img/a51.txd/dam_gencon.dds\",\n \"gta3.img/corvinsign_sfse.txd/scratchedmetal.dds\",\"gta3.img/a51.txd/scratchedmetal.dds\",\n \"gta3.img/farmhouse.txd/scratchedmetal.dds\",\"gta3.img/a51.txd/scratchedmetal.dds\",\n \"gta3.img/benches_cj.txd/metal3_128.dds\",\"gta3.img/a51.txd/metal3_128.dds\",\n \"gta3.img/buildingsitevge.txd/metal3_128.dds\",\"gta3.img/a51.txd/metal3_128.dds\",\n \"gta3.img/des_ufoinn.txd/metal3_128.dds\",\"gta3.img/a51.txd/metal3_128.dds\",\n \"gta3.img/factorycuntw.txd/metal3_128.dds\",\"gta3.img/a51.txd/metal3_128.dds\",\n \"gta3.img/indust_lax.txd/metal3_128.dds\",\"gta3.img/a51.txd/metal3_128.dds\",\n \"gta3.img/privatesign.txd/metal3_128.dds\",\"gta3.img/a51.txd/metal3_128.dds\",\n \"gta3.img/sw_sheds.txd/metal3_128.dds\",\"gta3.img/a51.txd/metal3_128.dds\",\n \"gta3.img/ufo_bar.txd/metal3_128.dds\",\"gta3.img/a51.txd/metal3_128.dds\",\n \"gta3.img/vgnplantgen.txd/metal3_128.dds\",\"gta3.img/a51.txd/metal3_128.dds\",\n \"gta3.img/vgnpwrmainbld.txd/metal3_128.dds\",\"gta3.img/a51.txd/metal3_128.dds\",\n \"gta3.img/vgnpwroutbld1.txd/metal3_128.dds\",\"gta3.img/a51.txd/metal3_128.dds\",\n \"gta3.img/vgsairport.txd/metal3_128.dds\",\"gta3.img/a51.txd/metal3_128.dds\",\n \"gta3.img/vgsncircon.txd/metal3_128.dds\",\"gta3.img/a51.txd/metal3_128.dds\",\n \"gta3.img/xrf_refineryla.txd/metal3_128.dds\",\"gta3.img/a51.txd/metal3_128.dds\",\n \"gta3.img/ammu_lan2.txd/banding3_64hv.dds\",\"gta3.img/a51.txd/banding3_64hv.dds\",\n \"gta3.img/cwestfac.txd/banding3_64hv.dds\",\"gta3.img/a51.txd/banding3_64hv.dds\",\n \"gta3.img/des_factory.txd/banding3_64hv.dds\",\"gta3.img/a51.txd/banding3_64hv.dds\",\n \"gta3.img/des_ufoinn.txd/banding3_64hv.dds\",\"gta3.img/a51.txd/banding3_64hv.dds\",\n \"gta3.img/dkcargoshp_las2.txd/banding3_64hv.dds\",\"gta3.img/a51.txd/banding3_64hv.dds\",\n \"gta3.img/hillhousex_la10_12.txd/banding3_64hv.dds\",\"gta3.img/a51.txd/banding3_64hv.dds\",\n \"gta3.img/plc_stinger.txd/banding3_64hv.dds\",\"gta3.img/a51.txd/banding3_64hv.dds\",\n \"gta3.img/sunset01_law2.txd/banding3_64hv.dds\",\"gta3.img/a51.txd/banding3_64hv.dds\",\n \"gta3.img/sw_church.txd/banding3_64hv.dds\",\"gta3.img/a51.txd/banding3_64hv.dds\",\n \"gta3.img/temp_stinger.txd/banding3_64hv.dds\",\"gta3.img/a51.txd/banding3_64hv.dds\",\n \"gta3.img/vegashse2.txd/banding3_64hv.dds\",\"gta3.img/a51.txd/banding3_64hv.dds\",\n \"gta3.img/vegashse8.txd/banding3_64hv.dds\",\"gta3.img/a51.txd/banding3_64hv.dds\",\n \"gta3.img/vgebillboards.txd/banding3_64hv.dds\",\"gta3.img/a51.txd/banding3_64hv.dds\",\n \"gta3.img/vgeretail1.txd/banding3_64hv.dds\",\"gta3.img/a51.txd/banding3_64hv.dds\",\n \"gta3.img/vgnfrates.txd/banding3_64hv.dds\",\"gta3.img/a51.txd/banding3_64hv.dds\",\n \"gta3.img/vgnfremnt2.txd/banding3_64hv.dds\",\"gta3.img/a51.txd/banding3_64hv.dds\",\n \"gta3.img/vgnpwrmainbld.txd/banding3_64hv.dds\",\"gta3.img/a51.txd/banding3_64hv.dds\",\n \"gta3.img/vgnshopnmall.txd/banding3_64hv.dds\",\"gta3.img/a51.txd/banding3_64hv.dds\",\n \"gta3.img/vgsebuild01.txd/banding3_64hv.dds\",\"gta3.img/a51.txd/banding3_64hv.dds\",\n \"gta3.img/vgsebuild02.txd/banding3_64hv.dds\",\"gta3.img/a51.txd/banding3_64hv.dds\",\n \"gta3.img/vgsewrehse.txd/banding3_64hv.dds\",\"gta3.img/a51.txd/banding3_64hv.dds\",\n \"gta3.img/vgssstairs1.txd/banding3_64hv.dds\",\"gta3.img/a51.txd/banding3_64hv.dds\",\n \"gta3.img/vgsswrehse03.txd/banding3_64hv.dds\",\"gta3.img/a51.txd/banding3_64hv.dds\",\n \"gta3.img/cwestfac.txd/ventb64.dds\",\"gta3.img/a51.txd/ventb64.dds\",\n \"gta3.img/vgnfrates.txd/ventb64.dds\",\"gta3.img/a51.txd/ventb64.dds\",\n \"gta3.img/vgnshopnmall.txd/ventb64.dds\",\"gta3.img/a51.txd/ventb64.dds\",\n \"gta3.img/vgsewrehse.txd/ventb64.dds\",\"gta3.img/a51.txd/ventb64.dds\",\n \"gta3.img/vgsswrehse03.txd/ventb64.dds\",\"gta3.img/a51.txd/ventb64.dds\",\n \"gta3.img/beafron1_law2.txd/bluemetal.dds\",\"gta3.img/a51.txd/bluemetal.dds\",\n \"gta3.img/cos_bankblock1.txd/bluemetal.dds\",\"gta3.img/a51.txd/bluemetal.dds\",\n \"gta3.img/crackfactdem_sfs.txd/bluemetal.dds\",\"gta3.img/a51.txd/bluemetal.dds\",\n \"gta3.img/crackfact_sfse.txd/bluemetal.dds\",\"gta3.img/a51.txd/bluemetal.dds\",\n \"gta3.img/crack_intkb.txd/bluemetal.dds\",\"gta3.img/a51.txd/bluemetal.dds\",\n \"gta3.img/cuntwbridges.txd/bluemetal.dds\",\"gta3.img/a51.txd/bluemetal.dds\",\n \"gta3.img/cw_farm.txd/bluemetal.dds\",\"gta3.img/a51.txd/bluemetal.dds\",\n \"gta3.img/cxref_desert.txd/bluemetal.dds\",\"gta3.img/a51.txd/bluemetal.dds\",\n \"gta3.img/dkcargoshp_las2.txd/bluemetal.dds\",\"gta3.img/a51.txd/bluemetal.dds\",\n \"gta3.img/dockcargo2_las.txd/bluemetal.dds\",\"gta3.img/a51.txd/bluemetal.dds\",\n \"gta3.img/docks2_las2.txd/bluemetal.dds\",\"gta3.img/a51.txd/bluemetal.dds\",\n \"gta3.img/docks_las2.txd/bluemetal.dds\",\"gta3.img/a51.txd/bluemetal.dds\",\n \"gta3.img/garag3_lawn.txd/bluemetal.dds\",\"gta3.img/a51.txd/bluemetal.dds\",\n \"gta3.img/helimagnet.txd/bluemetal.dds\",\"gta3.img/a51.txd/bluemetal.dds\",\n \"gta3.img/imrancompyard_las.txd/bluemetal.dds\",\"gta3.img/a51.txd/bluemetal.dds\",\n \"gta3.img/lachempipe.txd/bluemetal.dds\",\"gta3.img/a51.txd/bluemetal.dds\",\n \"gta3.img/lasxrefdock.txd/bluemetal.dds\",\"gta3.img/a51.txd/bluemetal.dds\",\n \"gta3.img/metal.txd/bluemetal.dds\",\"gta3.img/a51.txd/bluemetal.dds\",\n \"gta3.img/pyr_roof.txd/bluemetal.dds\",\"gta3.img/a51.txd/bluemetal.dds\",\n \"gta3.img/scaffolding_sfx.txd/bluemetal.dds\",\"gta3.img/a51.txd/bluemetal.dds\",\n \"gta3.img/vgnplantgen.txd/bluemetal.dds\",\"gta3.img/a51.txd/bluemetal.dds\",\n \"gta3.img/vgnpwrentrnce.txd/bluemetal.dds\",\"gta3.img/a51.txd/bluemetal.dds\",\n \"gta3.img/vgslowbuild1.txd/bluemetal.dds\",\"gta3.img/a51.txd/bluemetal.dds\",\n \"gta_int.img/ab_vegasgymmain.txd/bluemetal.dds\",\"gta3.img/a51.txd/bluemetal.dds\",\n \"gta3.img/drydockgate_sfse.txd/sl_metalwalk.dds\",\"gta3.img/a51.txd/sl_metalwalk.dds\",\n \"gta_int.img/genintintbarb.txd/sl_metalwalk.dds\",\"gta3.img/a51.txd/sl_metalwalk.dds\",\n \"gta3.img/cw_truckstopcs_t.txd/a51_vent1.dds\",\"gta3.img/a51.txd/a51_vent1.dds\",\n \"gta3.img/des_quarrybits.txd/a51_vent1.dds\",\"gta3.img/a51.txd/a51_vent1.dds\",\n \"gta3.img/des_quarry.txd/a51_vent1.dds\",\"gta3.img/a51.txd/a51_vent1.dds\",\n \"gta3.img/cecuntetunnel.txd/des_factower.dds\",\"gta3.img/a51.txd/des_factower.dds\",\n \"gta3.img/cs_wbridge.txd/des_factower.dds\",\"gta3.img/a51.txd/des_factower.dds\",\n \"gta3.img/cxref_savhus.txd/des_factower.dds\",\"gta3.img/a51.txd/des_factower.dds\",\n \"gta3.img/desertmisc.txd/des_factower.dds\",\"gta3.img/a51.txd/des_factower.dds\",\n \"gta3.img/des_factory.txd/des_factower.dds\",\"gta3.img/a51.txd/des_factower.dds\",\n \"gta3.img/des_quarrycrane.txd/des_factower.dds\",\"gta3.img/a51.txd/des_factower.dds\",\n \"gta3.img/des_telescopestuff.txd/des_factower.dds\",\"gta3.img/a51.txd/des_factower.dds\",\n \"gta3.img/mtb_banners.txd/des_factower.dds\",\"gta3.img/a51.txd/des_factower.dds\",\n \"gta3.img/wong_twx.txd/des_factower.dds\",\"gta3.img/a51.txd/des_factower.dds\",\n \"gta3.img/xrf_refineryla.txd/des_factower.dds\",\"gta3.img/a51.txd/des_factower.dds\",\n \"gta3.img/airportroads_sfse.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta3.img/airprtrunway_las.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta3.img/airroadsigns_sfse.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta3.img/airwelcomesign_sfse.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta3.img/arprtxxref_las.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta3.img/bighangarsfxr.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta3.img/carrierxr.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta3.img/carshow_sfse.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta3.img/ce_payspray.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta3.img/ce_traintrack2.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta3.img/country_breakable.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta3.img/crackfactdem_sfs.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta3.img/crackfact_sfse.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta3.img/cuntwbtxcs_t.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta3.img/cw2_storesnstuff.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta3.img/des_boneyard.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta3.img/des_factory.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta3.img/desn2_peckers.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta3.img/desn_truckstop.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta3.img/des_ufoinn.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta3.img/des_wgarage.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta3.img/drivingschool_sfse.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta3.img/drydockgate_sfse.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta3.img/fences.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta3.img/firehouse_sfse.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta3.img/goflagx.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta3.img/hashmarket_sfsx.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta3.img/hotel1.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta3.img/lachempipe.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta3.img/lanbloke.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta3.img/lanriver.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta3.img/lwbldstuff03.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta3.img/metal.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta3.img/milbase.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta3.img/oldgarage_sfse.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta3.img/railtracklae.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta3.img/rcflagx.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta3.img/stadium_lae2.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta3.img/stadium_sfse.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta3.img/sunrise05_lawn.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta3.img/sw_well1.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta3.img/traincross.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta3.img/vegasairprtland.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta3.img/vegashse5.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta3.img/vegashse6.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta3.img/vegashse7.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta3.img/vegasshangar.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta3.img/vegassvehse7.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta3.img/vgegassign.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta3.img/vgngassign.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta3.img/vgnretail72.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta3.img/vgsbikeschool.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta3.img/vgsn_billboard.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta3.img/vgssairport02.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta3.img/vgssairportcpark.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta3.img/vgssmulticarprk.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta3.img/ws_roadside_dyn1.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta3.img/xenon_sfse.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta_int.img/gb_foodwrap01.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta_int.img/gf5.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta_int.img/lee_stripclub.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta_int.img/maddogsdoors.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta_int.img/svcunthoose.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta_int.img/whore_main.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta_int.img/whore_rms.txd/alumox64.dds\",\"gta3.img/a51.txd/alumox64.dds\",\n \"gta3.img/airportcpark_sfse.txd/airvent_gz.dds\",\"gta3.img/a51.txd/airvent_gz.dds\",\n \"gta3.img/carimpound_sfe.txd/airvent_gz.dds\",\"gta3.img/a51.txd/airvent_gz.dds\",\n \"gta3.img/carpark_sfe.txd/airvent_gz.dds\",\"gta3.img/a51.txd/airvent_gz.dds\",\n \"gta3.img/cephotoblockcs_t.txd/airvent_gz.dds\",\"gta3.img/a51.txd/airvent_gz.dds\",\n \"gta3.img/cw2_photoblockcs_t.txd/airvent_gz.dds\",\"gta3.img/a51.txd/airvent_gz.dds\",\n \"gta3.img/ship_brijsfw.txd/airvent_gz.dds\",\"gta3.img/a51.txd/airvent_gz.dds\",\n \"gta3.img/vegasemulticar.txd/airvent_gz.dds\",\"gta3.img/a51.txd/airvent_gz.dds\",\n \"gta3.img/chemgrnd_las2.txd/redmetal.dds\",\"gta3.img/a51.txd/redmetal.dds\",\n \"gta3.img/desertmisc.txd/redmetal.dds\",\"gta3.img/a51.txd/redmetal.dds\",\n \"gta3.img/desn_trainstuff.txd/redmetal.dds\",\"gta3.img/a51.txd/redmetal.dds\",\n \"gta3.img/des_xoilfield.txd/redmetal.dds\",\"gta3.img/a51.txd/redmetal.dds\",\n \"gta3.img/dkcargoshp_las2.txd/redmetal.dds\",\"gta3.img/a51.txd/redmetal.dds\",\n \"gta3.img/dynbarrels.txd/redmetal.dds\",\"gta3.img/a51.txd/redmetal.dds\",\n \"gta3.img/factorycuntw.txd/redmetal.dds\",\"gta3.img/a51.txd/redmetal.dds\",\n \"gta3.img/ground_las2.txd/redmetal.dds\",\"gta3.img/a51.txd/redmetal.dds\",\n \"gta3.img/immcrax.txd/redmetal.dds\",\"gta3.img/a51.txd/redmetal.dds\",\n \"gta3.img/idlewood46_lae.txd/redmetal.dds\",\"gta3.img/a51.txd/redmetal.dds\",\n \"gta3.img/lachempipe.txd/redmetal.dds\",\"gta3.img/a51.txd/redmetal.dds\",\n \"gta3.img/lasxrefdock.txd/redmetal.dds\",\"gta3.img/a51.txd/redmetal.dds\",\n \"gta3.img/milbase.txd/redmetal.dds\",\"gta3.img/a51.txd/redmetal.dds\",\n \"gta3.img/railtracklae.txd/redmetal.dds\",\"gta3.img/a51.txd/redmetal.dds\",\n \"gta3.img/samsite_sfxrf.txd/redmetal.dds\",\"gta3.img/a51.txd/redmetal.dds\",\n \"gta3.img/vgnpwroutbld1.txd/redmetal.dds\",\"gta3.img/a51.txd/redmetal.dds\",\n \"gta3.img/vgnpwroutbld2.txd/redmetal.dds\",\"gta3.img/a51.txd/redmetal.dds\",\n \"gta3.img/milbase.txd/a51_boffstuff1.dds\",\"gta3.img/a51.txd/a51_boffstuff1.dds\",\n \"gta3.img/cewrehse.txd/carparkwall12_256.dds\",\"gta3.img/a51.txd/carparkwall12_256.dds\",\n \"gta3.img/desn2_truckstop.txd/carparkwall12_256.dds\",\"gta3.img/a51.txd/carparkwall12_256.dds\",\n \"gta3.img/lasground2_las2.txd/carparkwall12_256.dds\",\"gta3.img/a51.txd/carparkwall12_256.dds\",\n \"gta3.img/shamcpark.txd/carparkwall12_256.dds\",\"gta3.img/a51.txd/carparkwall12_256.dds\",\n \"gta3.img/skyscrap2_lan2.txd/carparkwall12_256.dds\",\"gta3.img/a51.txd/carparkwall12_256.dds\",\n \"gta3.img/stormdrain_las2.txd/carparkwall12_256.dds\",\"gta3.img/a51.txd/carparkwall12_256.dds\",\n \"gta3.img/vegasbuild.txd/carparkwall12_256.dds\",\"gta3.img/a51.txd/carparkwall12_256.dds\",\n \"gta3.img/vegashse6.txd/carparkwall12_256.dds\",\"gta3.img/a51.txd/carparkwall12_256.dds\",\n \"gta3.img/vgsnbuild07.txd/carparkwall12_256.dds\",\"gta3.img/a51.txd/carparkwall12_256.dds\",\n \"gta3.img/cs_mountain.txd/des_tunnellight.dds\",\"gta3.img/a51.txd/des_tunnellight.dds\",\n \"gta3.img/des_nw.txd/des_tunnellight.dds\",\"gta3.img/a51.txd/des_tunnellight.dds\",\n \"gta3.img/cranes_dyn2_cj.txd/sw_olddrum1.dds\",\"gta3.img/a51.txd/sw_olddrum1.dds\",\n \"gta3.img/cuntwf.txd/sw_olddrum1.dds\",\"gta3.img/a51.txd/sw_olddrum1.dds\",\n \"gta3.img/des_quarrybits.txd/sw_olddrum1.dds\",\"gta3.img/a51.txd/sw_olddrum1.dds\",\n \"gta3.img/farmstuff.txd/sw_olddrum1.dds\",\"gta3.img/a51.txd/sw_olddrum1.dds\",\n \"gta3.img/frieghter2sfe.txd/sw_olddrum1.dds\",\"gta3.img/a51.txd/sw_olddrum1.dds\",\n \"gta3.img/groundbit_sfse.txd/sw_olddrum1.dds\",\"gta3.img/a51.txd/sw_olddrum1.dds\",\n \"gta3.img/sw_farm1.txd/sw_olddrum1.dds\",\"gta3.img/a51.txd/sw_olddrum1.dds\",\n \"gta3.img/vgngebuild.txd/pavegrey128.dds\",\"gta3.img/a51.txd/pavegrey128.dds\",\n \"gta3.img/ap_build4e.txd/was_scrpyd_door_in_hngr.dds\",\"gta3.img/a51_undergrnd.txd/was_scrpyd_door_in_hngr.dds\",\n \"gta3.img/cw_junkbuildcs_t.txd/was_scrpyd_door_in_hngr.dds\",\"gta3.img/a51_undergrnd.txd/was_scrpyd_door_in_hngr.dds\",\n \"gta3.img/cw_junkyardmachin.txd/was_scrpyd_door_in_hngr.dds\",\"gta3.img/a51_undergrnd.txd/was_scrpyd_door_in_hngr.dds\",\n \"gta3.img/vgnbball.txd/was_scrpyd_door_in_hngr.dds\",\"gta3.img/a51_undergrnd.txd/was_scrpyd_door_in_hngr.dds\",\n \"gta3.img/carrierint_sfs.txd/ws_shipmetal5.dds\",\"gta3.img/ab_acc_control.txd/ws_shipmetal5.dds\",\n \"gta3.img/carrier_sfse.txd/ws_shipmetal5.dds\",\"gta3.img/ab_acc_control.txd/ws_shipmetal5.dds\",\n \"gta3.img/light_fit_ext.txd/cj_bulletbrass.dds\",\"gta3.img/ab_jetlite.txd/cj_bulletbrass.dds\",\n \"gta_int.img/ab_mafiasuitea.txd/bathwin01_int.dds\",\"gta3.img/ab_jetlite.txd/bathwin01_int.dds\",\n \"gta_int.img/ab_sfammumain.txd/bathwin01_int.dds\",\"gta3.img/ab_jetlite.txd/bathwin01_int.dds\",\n \"gta_int.img/bikeskool.txd/bathwin01_int.dds\",\"gta3.img/ab_jetlite.txd/bathwin01_int.dds\",\n \"gta_int.img/estate2.txd/bathwin01_int.dds\",\"gta3.img/ab_jetlite.txd/bathwin01_int.dds\",\n \"gta_int.img/papaerchaseoffice.txd/bathwin01_int.dds\",\"gta3.img/ab_jetlite.txd/bathwin01_int.dds\",\n \"gta_int.img/traidaqua.txd/bathwin01_int.dds\",\"gta3.img/ab_jetlite.txd/bathwin01_int.dds\",\n \"gta_int.img/jet_interior.txd/mp_jet_seat.dds\",\"gta3.img/ab_jetseat.txd/mp_jet_seat.dds\",\n \"gta3.img/apsecurity_sfxrf.txd/ws_guardhousedoor.dds\",\"gta3.img/adam_v_doort.txd/ws_guardhousedoor.dds\",\n \"gta3.img/gatehouse_sfse.txd/ws_guardhousedoor.dds\",\"gta3.img/adam_v_doort.txd/ws_guardhousedoor.dds\",\n \"gta3.img/gayclub_sfs.txd/ws_guardhousedoor.dds\",\"gta3.img/adam_v_doort.txd/ws_guardhousedoor.dds\",\n \"gta3.img/vegashse3.txd/ws_guardhousedoor.dds\",\"gta3.img/adam_v_doort.txd/ws_guardhousedoor.dds\",\n \"gta3.img/vegashse5.txd/ws_guardhousedoor.dds\",\"gta3.img/adam_v_doort.txd/ws_guardhousedoor.dds\",\n \"gta3.img/vegashse6.txd/ws_guardhousedoor.dds\",\"gta3.img/adam_v_doort.txd/ws_guardhousedoor.dds\",\n \"gta3.img/vegashse7.txd/ws_guardhousedoor.dds\",\"gta3.img/adam_v_doort.txd/ws_guardhousedoor.dds\",\n \"gta3.img/vegassvehse7.txd/ws_guardhousedoor.dds\",\"gta3.img/adam_v_doort.txd/ws_guardhousedoor.dds\",\n \"gta3.img/sanpedhse_1x.txd/lasjmdoorgud.dds\",\"gta3.img/addoorx.txd/lasjmdoorgud.dds\",\n \"gta3.img/sjmla_las.txd/lasjmdoorgud.dds\",\"gta3.img/addoorx.txd/lasjmdoorgud.dds\",\n \"gta3.img/snpedhusxref.txd/lasjmdoorgud.dds\",\"gta3.img/addoorx.txd/lasjmdoorgud.dds\",\n \"gta_int.img/lee_bdupsmain.txd/lasjmdoorgud.dds\",\"gta3.img/addoorx.txd/lasjmdoorgud.dds\",\n \"gta3.img/barrio1_lae.txd/rustyboltpanel.dds\",\"gta3.img/adjumpx.txd/rustyboltpanel.dds\",\n \"gta3.img/landjump.txd/rustyboltpanel.dds\",\"gta3.img/adjumpx.txd/rustyboltpanel.dds\",\n \"gta3.img/airwelcome_sfse.txd/gen_chrome.dds\",\"gta3.img/adjumpx.txd/gen_chrome.dds\",\n \"gta3.img/barrio1_lae.txd/gen_chrome.dds\",\"gta3.img/adjumpx.txd/gen_chrome.dds\",\n \"gta3.img/bball_hpx.txd/gen_chrome.dds\",\"gta3.img/adjumpx.txd/gen_chrome.dds\",\n \"gta3.img/boigas_sfe.txd/gen_chrome.dds\",\"gta3.img/adjumpx.txd/gen_chrome.dds\",\n \"gta3.img/boigas_sfw.txd/gen_chrome.dds\",\"gta3.img/adjumpx.txd/gen_chrome.dds\",\n \"gta3.img/bskball_standext.txd/gen_chrome.dds\",\"gta3.img/adjumpx.txd/gen_chrome.dds\",\n \"gta3.img/bs_sfs.txd/gen_chrome.dds\",\"gta3.img/adjumpx.txd/gen_chrome.dds\",\n \"gta3.img/burgsh01_law.txd/gen_chrome.dds\",\"gta3.img/adjumpx.txd/gen_chrome.dds\",\n \"gta3.img/cf_metals_sfse.txd/gen_chrome.dds\",\"gta3.img/adjumpx.txd/gen_chrome.dds\",\n \"gta3.img/cranes_dyn2_cj.txd/gen_chrome.dds\",\"gta3.img/adjumpx.txd/gen_chrome.dds\",\n \"gta3.img/cuntwrestcs_t.txd/gen_chrome.dds\",\"gta3.img/adjumpx.txd/gen_chrome.dds\",\n \"gta3.img/des_stownmots1.txd/gen_chrome.dds\",\"gta3.img/adjumpx.txd/gen_chrome.dds\",\n \"gta3.img/factorycuntw.txd/gen_chrome.dds\",\"gta3.img/adjumpx.txd/gen_chrome.dds\",\n \"gta3.img/fishwarf.txd/gen_chrome.dds\",\"gta3.img/adjumpx.txd/gen_chrome.dds\",\n \"gta3.img/freightcrane.txd/gen_chrome.dds\",\"gta3.img/adjumpx.txd/gen_chrome.dds\",\n \"gta3.img/hotel1.txd/gen_chrome.dds\",\"gta3.img/adjumpx.txd/gen_chrome.dds\",\n \"gta3.img/landjump.txd/gen_chrome.dds\",\"gta3.img/adjumpx.txd/gen_chrome.dds\",\n \"gta3.img/law2misc_lax.txd/gen_chrome.dds\",\"gta3.img/adjumpx.txd/gen_chrome.dds\",\n \"gta3.img/lawnburg.txd/gen_chrome.dds\",\"gta3.img/adjumpx.txd/gen_chrome.dds\",\n \"gta3.img/lawnstripm.txd/gen_chrome.dds\",\"gta3.img/adjumpx.txd/gen_chrome.dds\",\n \"gta3.img/refinery.txd/gen_chrome.dds\",\"gta3.img/adjumpx.txd/gen_chrome.dds\",\n \"gta3.img/satdish.txd/gen_chrome.dds\",\"gta3.img/adjumpx.txd/gen_chrome.dds\",\n \"gta3.img/sprunkworks.txd/gen_chrome.dds\",\"gta3.img/adjumpx.txd/gen_chrome.dds\",\n \"gta3.img/vgnboiga1.txd/gen_chrome.dds\",\"gta3.img/adjumpx.txd/gen_chrome.dds\",\n \"gta3.img/vgnpwrmainbld.txd/gen_chrome.dds\",\"gta3.img/adjumpx.txd/gen_chrome.dds\",\n \"gta3.img/vgnpwroutbld2.txd/gen_chrome.dds\",\"gta3.img/adjumpx.txd/gen_chrome.dds\",\n \"gta3.img/vgnretail2.txd/gen_chrome.dds\",\"gta3.img/adjumpx.txd/gen_chrome.dds\",\n \"gta3.img/vgnretail7.txd/gen_chrome.dds\",\"gta3.img/adjumpx.txd/gen_chrome.dds\",\n \"gta3.img/vgnvrock.txd/gen_chrome.dds\",\"gta3.img/adjumpx.txd/gen_chrome.dds\",\n \"gta3.img/vgsbballnet1.txd/gen_chrome.dds\",\"gta3.img/adjumpx.txd/gen_chrome.dds\",\n \"gta3.img/vgsscollege.txd/gen_chrome.dds\",\"gta3.img/adjumpx.txd/gen_chrome.dds\",\n \"gta3.img/vgwestboiga1.txd/gen_chrome.dds\",\"gta3.img/adjumpx.txd/gen_chrome.dds\",\n \"gta3.img/wshxrefhse2.txd/gen_chrome.dds\",\"gta3.img/adjumpx.txd/gen_chrome.dds\",\n \"gta3.img/alpha.txd/alpha92interior128.dds\",\"gta3.img/admiral.txd/admiral92interior128.dds\",\n \"gta3.img/cabbie.txd/cabbie92interior128.dds\",\"gta3.img/admiral.txd/admiral92interior128.dds\",\n \"gta3.img/dft30.txd/dft3092interior128.dds\",\"gta3.img/admiral.txd/admiral92interior128.dds\",\n \"gta3.img/elegant.txd/elegant92interior128.dds\",\"gta3.img/admiral.txd/admiral92interior128.dds\",\n \"gta3.img/fortune.txd/fortune92interior128.dds\",\"gta3.img/admiral.txd/admiral92interior128.dds\",\n \"gta3.img/glendale.txd/glendale92interior128.dds\",\"gta3.img/admiral.txd/admiral92interior128.dds\",\n \"gta3.img/greenwoo.txd/greenwoo92interior128.dds\",\"gta3.img/admiral.txd/admiral92interior128.dds\",\n \"gta3.img/hustler.txd/hustler92interior128.dds\",\"gta3.img/admiral.txd/admiral92interior128.dds\",\n \"gta3.img/journey.txd/journey92interior128.dds\",\"gta3.img/admiral.txd/admiral92interior128.dds\",\n \"gta3.img/monster.txd/monster92interior128.dds\",\"gta3.img/admiral.txd/admiral92interior128.dds\",\n \"gta3.img/oceanic.txd/oceanic92interior128.dds\",\"gta3.img/admiral.txd/admiral92interior128.dds\",\n \"gta3.img/premier.txd/premier92interior128.dds\",\"gta3.img/admiral.txd/admiral92interior128.dds\",\n \"gta3.img/sabre.txd/sabre92interior128.dds\",\"gta3.img/admiral.txd/admiral92interior128.dds\",\n \"gta3.img/stretch.txd/stretch92interior128.dds\",\"gta3.img/admiral.txd/admiral92interior128.dds\",\n \"gta3.img/taxi.txd/taxi92interior128.dds\",\"gta3.img/admiral.txd/admiral92interior128.dds\",\n \"gta3.img/voodoo.txd/voodoo92interior128.dds\",\"gta3.img/admiral.txd/admiral92interior128.dds\",\n \"gta3.img/elegant.txd/elegant92wheel64.dds\",\"gta3.img/admiral.txd/admiral92wheel64.dds\",\n \"gta3.img/car_ship_sfse.txd/ws_cargoshipdoor.dds\",\"gta3.img/ad_rmx.txd/ws_cargoshipdoor.dds\",\n \"gta3.img/impexpx.txd/ws_cargoshipdoor.dds\",\"gta3.img/ad_rmx.txd/ws_cargoshipdoor.dds\",\n \"gta3.img/jeffers4_lae.txd/ws_cargoshipdoor.dds\",\"gta3.img/ad_rmx.txd/ws_cargoshipdoor.dds\",\n \"gta3.img/mdlckdx.txd/ws_cargoshipdoor.dds\",\"gta3.img/ad_rmx.txd/ws_cargoshipdoor.dds\",\n \"gta3.img/ammocapx.txd/ammo_tube.dds\",\"gta3.img/ad_rmx.txd/ammo_tube.dds\",\n \"gta3.img/katana.txd/gun_katana.dds\",\"gta3.img/adswrdx.txd/gun_katana.dds\",\n \"gta3.img/bakerybit2_sfse.txd/cratetop128.dds\",\"gta3.img/aircarpkbarier_sfse.txd/cratetop128.dds\",\n \"gta3.img/bskball_standext.txd/cratetop128.dds\",\"gta3.img/aircarpkbarier_sfse.txd/cratetop128.dds\",\n \"gta3.img/car_ship_sfse.txd/cratetop128.dds\",\"gta3.img/aircarpkbarier_sfse.txd/cratetop128.dds\",\n \"gta3.img/ce_ground01.txd/cratetop128.dds\",\"gta3.img/aircarpkbarier_sfse.txd/cratetop128.dds\",\n \"gta3.img/ce_ground07.txd/cratetop128.dds\",\"gta3.img/aircarpkbarier_sfse.txd/cratetop128.dds\",\n \"gta3.img/ci_studio5.txd/cratetop128.dds\",\"gta3.img/aircarpkbarier_sfse.txd/cratetop128.dds\",\n \"gta3.img/cj_barr_set_1.txd/cratetop128.dds\",\"gta3.img/aircarpkbarier_sfse.txd/cratetop128.dds\",\n \"gta3.img/counte_b2.txd/cratetop128.dds\",\"gta3.img/aircarpkbarier_sfse.txd/cratetop128.dds\",\n \"gta3.img/counte_bridge.txd/cratetop128.dds\",\"gta3.img/aircarpkbarier_sfse.txd/cratetop128.dds\",\n \"gta3.img/cxref_oldwest.txd/cratetop128.dds\",\"gta3.img/aircarpkbarier_sfse.txd/cratetop128.dds\",\n \"gta3.img/cxref_quarrytest.txd/cratetop128.dds\",\"gta3.img/aircarpkbarier_sfse.txd/cratetop128.dds\",\n \"gta3.img/dockcargo1_las.txd/cratetop128.dds\",\"gta3.img/aircarpkbarier_sfse.txd/cratetop128.dds\",\n \"gta3.img/farmstuff.txd/cratetop128.dds\",\"gta3.img/aircarpkbarier_sfse.txd/cratetop128.dds\",\n \"gta3.img/gayclub_sfs.txd/cratetop128.dds\",\"gta3.img/aircarpkbarier_sfse.txd/cratetop128.dds\",\n \"gta3.img/glenpark6_lae.txd/cratetop128.dds\",\"gta3.img/aircarpkbarier_sfse.txd/cratetop128.dds\",\n \"gta3.img/ground_las2.txd/cratetop128.dds\",\"gta3.img/aircarpkbarier_sfse.txd/cratetop128.dds\",\n \"gta3.img/hotelbackpool_sfs.txd/cratetop128.dds\",\"gta3.img/aircarpkbarier_sfse.txd/cratetop128.dds\",\n \"gta3.img/hrbr_sfn.txd/cratetop128.dds\",\"gta3.img/aircarpkbarier_sfse.txd/cratetop128.dds\",\n \"gta3.img/hrbr_sfw.txd/cratetop128.dds\",\"gta3.img/aircarpkbarier_sfse.txd/cratetop128.dds\",\n \"gta3.img/newramp.txd/cratetop128.dds\",\"gta3.img/aircarpkbarier_sfse.txd/cratetop128.dds\",\n \"gta3.img/oldwest.txd/cratetop128.dds\",\"gta3.img/aircarpkbarier_sfse.txd/cratetop128.dds\",\n \"gta3.img/sw_apartments.txd/cratetop128.dds\",\"gta3.img/aircarpkbarier_sfse.txd/cratetop128.dds\",\n \"gta3.img/sw_jetty.txd/cratetop128.dds\",\"gta3.img/aircarpkbarier_sfse.txd/cratetop128.dds\",\n \"gta3.img/truckedepotlawn.txd/cratetop128.dds\",\"gta3.img/aircarpkbarier_sfse.txd/cratetop128.dds\",\n \"gta3.img/ufo_bar.txd/cratetop128.dds\",\"gta3.img/aircarpkbarier_sfse.txd/cratetop128.dds\",\n \"gta3.img/vgssairport.txd/cratetop128.dds\",\"gta3.img/aircarpkbarier_sfse.txd/cratetop128.dds\",\n \"gta3.img/ws_jetty_sfx.txd/cratetop128.dds\",\"gta3.img/aircarpkbarier_sfse.txd/cratetop128.dds\",\n \"gta3.img/cj_barr_set_1.txd/bareboards_64a.dds\",\"gta3.img/aircarpkbarier_sfse.txd/bareboards_64a.dds\",\n \"gta3.img/cj_barr_set_1.txd/glass_64a.dds\",\"gta3.img/aircarpkbarier_sfse.txd/glass_64a.dds\",\n \"gta3.img/cj_barr_set_1.txd/banding8_64hv.dds\",\"gta3.img/aircarpkbarier_sfse.txd/banding8_64hv.dds\",\n \"gta3.img/barrier.txd/chevron_red_64hva.dds\",\"gta3.img/aircarpkbarier_sfse.txd/chevron_red_64hva.dds\",\n \"gta3.img/cj_barr_set_1.txd/chevron_red_64hva.dds\",\"gta3.img/aircarpkbarier_sfse.txd/chevron_red_64hva.dds\",\n \"gta3.img/helixbarrier.txd/chevron_red_64hva.dds\",\"gta3.img/aircarpkbarier_sfse.txd/chevron_red_64hva.dds\",\n \"gta3.img/metalbarrier.txd/chevron_red_64hva.dds\",\"gta3.img/aircarpkbarier_sfse.txd/chevron_red_64hva.dds\",\n \"gta3.img/vegasbuild.txd/chevron_red_64hva.dds\",\"gta3.img/aircarpkbarier_sfse.txd/chevron_red_64hva.dds\",\n \"gta3.img/cj_barr_set_1.txd/redband_64ha.dds\",\"gta3.img/aircarpkbarier_sfse.txd/redband_64ha.dds\",\n \"gta_int.img/destructo.txd/redband_64.dds\",\"gta3.img/aircarpkbarier_sfse.txd/redband_64ha.dds\",\n \"gta_int.img/stadstunt.txd/redband_64.dds\",\"gta3.img/aircarpkbarier_sfse.txd/redband_64ha.dds\",\n \"gta_int.img/sumostands.txd/redband_64.dds\",\"gta3.img/aircarpkbarier_sfse.txd/redband_64ha.dds\",\n \"gta3.img/break_garden.txd/cj_plating.dds\",\"gta3.img/airconext.txd/cj_plating.dds\",\n \"gta3.img/cj_street_props.txd/cj_plating.dds\",\"gta3.img/airconext.txd/cj_plating.dds\",\n \"gta3.img/sfroadsign.txd/cj_plating.dds\",\"gta3.img/airconext.txd/cj_plating.dds\",\n \"gta_int.img/mafcasgenstuff.txd/cj_plating.dds\",\"gta3.img/airconext.txd/cj_plating.dds\",\n \"gta_int.img/maint1.txd/cj_plating.dds\",\"gta3.img/airconext.txd/cj_plating.dds\",\n \"gta3.img/break_street2.txd/cj_plating3.dds\",\"gta3.img/airconext.txd/cj_plating3.dds\",\n \"gta3.img/cj_street_props.txd/cj_plating3.dds\",\"gta3.img/airconext.txd/cj_plating3.dds\",\n \"gta_int.img/cj_chris.txd/cj_plating3.dds\",\"gta3.img/airconext.txd/cj_plating3.dds\",\n \"gta_int.img/mafcasgenstuff.txd/cj_plating3.dds\",\"gta3.img/airconext.txd/cj_plating3.dds\",\n \"gta3.img/cj_street_props.txd/cj_plating2.dds\",\"gta3.img/airconext.txd/cj_plating2.dds\",\n \"gta_int.img/mafcasgenstuff.txd/cj_plating2.dds\",\"gta3.img/airconext.txd/cj_plating2.dds\",\n \"gta3.img/break_road_ws.txd/cj_sheet2.dds\",\"gta3.img/airconext.txd/cj_sheet2.dds\",\n \"gta3.img/break_street1.txd/cj_sheet2.dds\",\"gta3.img/airconext.txd/cj_sheet2.dds\",\n \"gta3.img/cj_dfext.txd/cj_sheet2.dds\",\"gta3.img/airconext.txd/cj_sheet2.dds\",\n \"gta3.img/cj_street_props.txd/cj_sheet2.dds\",\"gta3.img/airconext.txd/cj_sheet2.dds\",\n \"gta3.img/crates_n_stuffext.txd/cj_sheet2.dds\",\"gta3.img/airconext.txd/cj_sheet2.dds\",\n \"gta3.img/externalext.txd/cj_sheet2.dds\",\"gta3.img/airconext.txd/cj_sheet2.dds\",\n \"gta3.img/industrialext.txd/cj_sheet2.dds\",\"gta3.img/airconext.txd/cj_sheet2.dds\",\n \"gta_int.img/cj_ammo.txd/cj_sheet2.dds\",\"gta3.img/airconext.txd/cj_sheet2.dds\",\n \"gta_int.img/cj_beds.txd/cj_sheet2.dds\",\"gta3.img/airconext.txd/cj_sheet2.dds\",\n \"gta_int.img/cj_furniture.txd/cj_sheet2.dds\",\"gta3.img/airconext.txd/cj_sheet2.dds\",\n \"gta_int.img/cj_s_beds.txd/cj_sheet2.dds\",\"gta3.img/airconext.txd/cj_sheet2.dds\",\n \"gta_int.img/cj_seating.txd/cj_sheet2.dds\",\"gta3.img/airconext.txd/cj_sheet2.dds\",\n \"gta_int.img/cjtemp.txd/cj_sheet2.dds\",\"gta3.img/airconext.txd/cj_sheet2.dds\",\n \"gta_int.img/mafcasgenstuff.txd/cj_sheet2.dds\",\"gta3.img/airconext.txd/cj_sheet2.dds\",\n \"gta_int.img/maint1.txd/cj_sheet2.dds\",\"gta3.img/airconext.txd/cj_sheet2.dds\",\n \"gta_int.img/maint3.txd/cj_sheet2.dds\",\"gta3.img/airconext.txd/cj_sheet2.dds\",\n \"gta3.img/elecfence_bar.txd/ws_leccyfncesign.dds\",\"gta3.img/airfence_sfse.txd/ws_leccyfncesign.dds\",\n \"gta3.img/navybasefence.txd/ws_leccyfncesign.dds\",\"gta3.img/airfence_sfse.txd/ws_leccyfncesign.dds\",\n \"gta3.img/airprtrunway_las.txd/ws_griddyfence.dds\",\"gta3.img/airfence_sfse.txd/ws_griddyfence.dds\",\n \"gta3.img/arsex.txd/ws_griddyfence.dds\",\"gta3.img/airfence_sfse.txd/ws_griddyfence.dds\",\n \"gta3.img/elecfence_bar.txd/ws_griddyfence.dds\",\"gta3.img/airfence_sfse.txd/ws_griddyfence.dds\",\n \"gta3.img/fedmint_sfs.txd/ws_griddyfence.dds\",\"gta3.img/airfence_sfse.txd/ws_griddyfence.dds\",\n \"gta3.img/navybasefence.txd/ws_griddyfence.dds\",\"gta3.img/airfence_sfse.txd/ws_griddyfence.dds\",\n \"gta3.img/vgsselecfence.txd/ws_griddyfence.dds\",\"gta3.img/airfence_sfse.txd/ws_griddyfence.dds\",\n \"gta3.img/airprtrunway_las.txd/ws_leccyfncetop.dds\",\"gta3.img/airfence_sfse.txd/ws_leccyfncetop.dds\",\n \"gta3.img/cunteroads1.txd/ws_leccyfncetop.dds\",\"gta3.img/airfence_sfse.txd/ws_leccyfncetop.dds\",\n \"gta3.img/elecfence_bar.txd/ws_leccyfncetop.dds\",\"gta3.img/airfence_sfse.txd/ws_leccyfncetop.dds\",\n \"gta3.img/fedmint_sfs.txd/ws_leccyfncetop.dds\",\"gta3.img/airfence_sfse.txd/ws_leccyfncetop.dds\",\n \"gta3.img/gategen.txd/ws_leccyfncetop.dds\",\"gta3.img/airfence_sfse.txd/ws_leccyfncetop.dds\",\n \"gta3.img/navybasefence.txd/ws_leccyfncetop.dds\",\"gta3.img/airfence_sfse.txd/ws_leccyfncetop.dds\",\n \"gta3.img/vegasnefnc.txd/ws_leccyfncetop.dds\",\"gta3.img/airfence_sfse.txd/ws_leccyfncetop.dds\",\n \"gta3.img/vgsn_fncelec_pst.txd/ws_leccyfncetop.dds\",\"gta3.img/airfence_sfse.txd/ws_leccyfncetop.dds\",\n \"gta3.img/vgsselecfence.txd/ws_leccyfncetop.dds\",\"gta3.img/airfence_sfse.txd/ws_leccyfncetop.dds\",\n \"gta3.img/wiresnshit.txd/ws_leccyfncetop.dds\",\"gta3.img/airfence_sfse.txd/ws_leccyfncetop.dds\",\n \"gta3.img/airwelcomesign_sfse.txd/ws_oldpainted.dds\",\"gta3.img/airfence_sfse.txd/ws_oldpainted.dds\",\n \"gta3.img/buildingsitevge.txd/ws_oldpainted.dds\",\"gta3.img/airfence_sfse.txd/ws_oldpainted.dds\",\n \"gta3.img/coe_offtrackshop.txd/ws_oldpainted.dds\",\"gta3.img/airfence_sfse.txd/ws_oldpainted.dds\",\n \"gta3.img/cuntwshopscs_t.txd/ws_oldpainted.dds\",\"gta3.img/airfence_sfse.txd/ws_oldpainted.dds\",\n \"gta3.img/cw2_photoblockcs_t.txd/ws_oldpainted.dds\",\"gta3.img/airfence_sfse.txd/ws_oldpainted.dds\",\n \"gta3.img/cxref_oldwest.txd/ws_oldpainted.dds\",\"gta3.img/airfence_sfse.txd/ws_oldpainted.dds\",\n \"gta3.img/des_baitshop.txd/ws_oldpainted.dds\",\"gta3.img/airfence_sfse.txd/ws_oldpainted.dds\",\n \"gta3.img/des_farmstuff.txd/ws_oldpainted.dds\",\"gta3.img/airfence_sfse.txd/ws_oldpainted.dds\",\n \"gta3.img/drivingschool_sfse.txd/ws_oldpainted.dds\",\"gta3.img/airfence_sfse.txd/ws_oldpainted.dds\",\n \"gta3.img/elecfence_bar.txd/ws_oldpainted.dds\",\"gta3.img/airfence_sfse.txd/ws_oldpainted.dds\",\n \"gta3.img/fedmint_sfs.txd/ws_oldpainted.dds\",\"gta3.img/airfence_sfse.txd/ws_oldpainted.dds\",\n \"gta3.img/milbase.txd/ws_oldpainted.dds\",\"gta3.img/airfence_sfse.txd/ws_oldpainted.dds\",\n \"gta3.img/navybasefence.txd/ws_oldpainted.dds\",\"gta3.img/airfence_sfse.txd/ws_oldpainted.dds\",\n \"gta3.img/oldwest.txd/ws_oldpainted.dds\",\"gta3.img/airfence_sfse.txd/ws_oldpainted.dds\",\n \"gta3.img/portakabin.txd/ws_oldpainted.dds\",\"gta3.img/airfence_sfse.txd/ws_oldpainted.dds\",\n \"gta3.img/samsite_sfxrf.txd/ws_oldpainted.dds\",\"gta3.img/airfence_sfse.txd/ws_oldpainted.dds\",\n \"gta3.img/sfse_hubstuff.txd/ws_oldpainted.dds\",\"gta3.img/airfence_sfse.txd/ws_oldpainted.dds\",\n \"gta3.img/silicon_sfxrf.txd/ws_oldpainted.dds\",\"gta3.img/airfence_sfse.txd/ws_oldpainted.dds\",\n \"gta3.img/vegasnefnc.txd/ws_oldpainted.dds\",\"gta3.img/airfence_sfse.txd/ws_oldpainted.dds\",\n \"gta3.img/vgsbikeschool.txd/ws_oldpainted.dds\",\"gta3.img/airfence_sfse.txd/ws_oldpainted.dds\",\n \"gta3.img/vgsselecfence.txd/ws_oldpainted.dds\",\"gta3.img/airfence_sfse.txd/ws_oldpainted.dds\",\n \"gta3.img/wiresnshit.txd/ws_oldpainted.dds\",\"gta3.img/airfence_sfse.txd/ws_oldpainted.dds\",\n \"gta3.img/airport2.txd/aarprt8las.dds\",\"gta3.img/airoads_las.txd/aarprt8las.dds\",\n \"gta3.img/airport_las.txd/aarprt8las.dds\",\"gta3.img/airoads_las.txd/aarprt8las.dds\",\n \"gta3.img/airportdetail.txd/aarprt9las.dds\",\"gta3.img/airoads_las.txd/aarprt9las.dds\",\n \"gta3.img/airportcpark_sfse.txd/ws_carparkwall1.dds\",\"gta3.img/airoads_las.txd/ws_carparkwall1.dds\",\n \"gta3.img/airport_las.txd/ws_carparkwall1.dds\",\"gta3.img/airoads_las.txd/ws_carparkwall1.dds\",\n \"gta3.img/bballcpark1.txd/ws_carparkwall1.dds\",\"gta3.img/airoads_las.txd/ws_carparkwall1.dds\",\n \"gta3.img/carpark_sfe.txd/ws_carparkwall1.dds\",\"gta3.img/airoads_las.txd/ws_carparkwall1.dds\",\n \"gta3.img/ce_ground13.txd/ws_carparkwall1.dds\",\"gta3.img/airoads_las.txd/ws_carparkwall1.dds\",\n \"gta3.img/ground_las2.txd/ws_carparkwall1.dds\",\"gta3.img/airoads_las.txd/ws_carparkwall1.dds\",\n \"gta3.img/hashblock2_sfs.txd/ws_carparkwall1.dds\",\"gta3.img/airoads_las.txd/ws_carparkwall1.dds\",\n \"gta3.img/skyscrap_sfse.txd/ws_carparkwall1.dds\",\"gta3.img/airoads_las.txd/ws_carparkwall1.dds\",\n \"gta3.img/sw_med1.txd/ws_carparkwall1.dds\",\"gta3.img/airoads_las.txd/ws_carparkwall1.dds\",\n \"gta3.img/airport3_las.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/airportcpark_sfse.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/airport_las.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/alleys_sfs.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/backroad_sfs.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/beachbx_sfw.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/bighangarsfxr.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/boxhses_sfsx.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/capitol_lawn.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/carimpound_sfe.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/carpark_sfe.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/carshow_sfse.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/chemgrnd_las2.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/cityhall_sfs.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/civic03_lan.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/civic04_lan.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/crackfact_sfse.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/cuntwbtzzcs_t.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/cuntwland.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/cuntwtunnel.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/cw2_storesnstuff.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/dem1_sfxrf.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/depot_sfse.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/des_airfieldhus.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/des_boneyard.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/des_byoffice.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/des_dinerw.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/desn2_truckstop.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/des_ne.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/des_nstuff.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/des_se1.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/des_se4.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/des_s.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/des_trainstuff.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/docg01_lahills.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/docks2refl_sfse.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/docks2_sfse.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/drivingschool_sfse.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/eastbeach4a_lae2.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/ebeachcineblok.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/fedmint_sfs.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/freeway_las.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/gayclub_sfs.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/gravblok01_lahills.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/graveyard_sfs.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/ground3_las2.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/groundbit_sfse.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/groundbit_sfs.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/groundb_las2.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/ground_las2.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/haight1_sfs.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/hashblock1b_sfs.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/hashblock1_sfs.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/hashblock1z_sfs.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/hashblock2b_sfs.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/hashblock2_sfs.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/hashblock3_sfs.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/hashblock4_sfs.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/hashhouses1_sfs.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/hashmarket1_sfs.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/hashupass_sfs.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/hotel2_sfs.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/hotelbackpool_sfs.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/hotelback_sfs.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/hubhole_sfse.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/idlewood6_detail.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/lahillshilhs1d.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/lanlacmab_lan2.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/lanpolicecp.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/lasroads_las.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/lasxrefdock.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/lawnstripm.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/mall_sfse.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/milbase.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/mountainsfs.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/navyroad_sfse.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/oc_flats_gnd_sfs.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/officy_sfs.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/queens1_sfs.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/queens2_sfs.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/queens3_sfs.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/queensammo_sfs.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/queensparks_sfs.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/railway_las.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/refinery.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/roadsanfranse.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/roads_sfs.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/roads_tunnellahills.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/scum2_sfs.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/scum_sfse.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/sfse_hubstuff.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/shops_sfse.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/shopszz_sfse.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/silicon_sfse.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/smallertxd.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/stadiumground_sfse.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/stapl.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/stationsfse_1.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/station_sfse.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/stormdrain_las2.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/stripshop1.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/subshops_sfs.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/traingen_sfse.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/trainplatform_sfse.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/traintrack_las2.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/traintrack_las.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/vegasemulticar.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/vegassland62.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/vgndwntwn22.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/vgnewhsewal.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/vgnfrates.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/vgnhseing1.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/vgnhseland.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/vgnrailroad.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/vgnretail2.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/vgntrainstat.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/vgsbikeschool.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/vgsehseing1.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/vgsn_flwbdcrb.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/vgsn_rbstiff.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/vgsrailroad.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/vgwesthseing1.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/vgwestrailrd.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/wasteland_las2.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta_int.img/dr_gsbits.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta_int.img/dr_gsnew.txd/concretenewb256.dds\",\"gta3.img/airoads_las.txd/concretenewb256.dds\",\n \"gta3.img/airport2.txd/tardor2.dds\",\"gta3.img/airoads_las.txd/tardor2.dds\",\n \"gta3.img/airportdetail.txd/tardor2.dds\",\"gta3.img/airoads_las.txd/tardor2.dds\",\n \"gta3.img/arprtxxref_las.txd/tardor2.dds\",\"gta3.img/airoads_las.txd/tardor2.dds\",\n \"gta3.img/buildblk55.txd/tardor2.dds\",\"gta3.img/airoads_las.txd/tardor2.dds\",\n \"gta3.img/airport2.txd/sjmhoodlawn42.dds\",\"gta3.img/airoads_las.txd/sjmhoodlawn42.dds\",\n \"gta3.img/airport_las.txd/sjmhoodlawn42.dds\",\"gta3.img/airoads_las.txd/sjmhoodlawn42.dds\",\n \"gta3.img/barrio1_lae.txd/sjmhoodlawn42.dds\",\"gta3.img/airoads_las.txd/sjmhoodlawn42.dds\",\n \"gta3.img/docks2_las2.txd/sjmhoodlawn42.dds\",\"gta3.img/airoads_las.txd/sjmhoodlawn42.dds\",\n \"gta3.img/freeway_las.txd/sjmhoodlawn42.dds\",\"gta3.img/airoads_las.txd/sjmhoodlawn42.dds\",\n \"gta3.img/idlewood6_detail.txd/sjmhoodlawn42.dds\",\"gta3.img/airoads_las.txd/sjmhoodlawn42.dds\",\n \"gta3.img/industry3_las2.txd/sjmhoodlawn42.dds\",\"gta3.img/airoads_las.txd/sjmhoodlawn42.dds\",\n \"gta3.img/laeroads.txd/sjmhoodlawn42.dds\",\"gta3.img/airoads_las.txd/sjmhoodlawn42.dds\",\n \"gta3.img/lanroad.txd/sjmhoodlawn42.dds\",\"gta3.img/airoads_las.txd/sjmhoodlawn42.dds\",\n \"gta3.img/lasroads_las.txd/sjmhoodlawn42.dds\",\"gta3.img/airoads_las.txd/sjmhoodlawn42.dds\",\n \"gta3.img/roads_tunnellahills.txd/sjmhoodlawn42.dds\",\"gta3.img/airoads_las.txd/sjmhoodlawn42.dds\",\n \"gta3.img/temproadtxd.txd/sjmhoodlawn42.dds\",\"gta3.img/airoads_las.txd/sjmhoodlawn42.dds\",\n \"gta3.img/airport2.txd/snpedtest1.dds\",\"gta3.img/airoads_las.txd/snpedtest1.dds\",\n \"gta3.img/airport_las.txd/snpedtest1.dds\",\"gta3.img/airoads_las.txd/snpedtest1.dds\",\n \"gta3.img/barrio1_lae.txd/snpedtest1.dds\",\"gta3.img/airoads_las.txd/snpedtest1.dds\",\n \"gta3.img/freeway2_las2.txd/snpedtest1.dds\",\"gta3.img/airoads_las.txd/snpedtest1.dds\",\n \"gta3.img/freeway2_las.txd/snpedtest1.dds\",\"gta3.img/airoads_las.txd/snpedtest1.dds\",\n \"gta3.img/freeway_las.txd/snpedtest1.dds\",\"gta3.img/airoads_las.txd/snpedtest1.dds\",\n \"gta3.img/griffobs_las.txd/snpedtest1.dds\",\"gta3.img/airoads_las.txd/snpedtest1.dds\",\n \"gta3.img/ground4_las.txd/snpedtest1.dds\",\"gta3.img/airoads_las.txd/snpedtest1.dds\",\n \"gta3.img/idlewood6_detail.txd/snpedtest1.dds\",\"gta3.img/airoads_las.txd/snpedtest1.dds\",\n \"gta3.img/lae2roadshub.txd/snpedtest1.dds\",\"gta3.img/airoads_las.txd/snpedtest1.dds\",\n \"gta3.img/lae2roads.txd/snpedtest1.dds\",\"gta3.img/airoads_las.txd/snpedtest1.dds\",\n \"gta3.img/laeroads2s.txd/snpedtest1.dds\",\"gta3.img/airoads_las.txd/snpedtest1.dds\",\n \"gta3.img/laeroads.txd/snpedtest1.dds\",\"gta3.img/airoads_las.txd/snpedtest1.dds\",\n \"gta3.img/lahillsla_roads.txd/snpedtest1.dds\",\"gta3.img/airoads_las.txd/snpedtest1.dds\",\n \"gta3.img/lahillslaroads.txd/snpedtest1.dds\",\"gta3.img/airoads_las.txd/snpedtest1.dds\",\n \"gta3.img/lan2freeway.txd/snpedtest1.dds\",\"gta3.img/airoads_las.txd/snpedtest1.dds\",\n \"gta3.img/lanroad.txd/snpedtest1.dds\",\"gta3.img/airoads_las.txd/snpedtest1.dds\",\n \"gta3.img/lasground2_las2.txd/snpedtest1.dds\",\"gta3.img/airoads_las.txd/snpedtest1.dds\",\n \"gta3.img/lasground_las2.txd/snpedtest1.dds\",\"gta3.img/airoads_las.txd/snpedtest1.dds\",\n \"gta3.img/lashops93_las2.txd/snpedtest1.dds\",\"gta3.img/airoads_las.txd/snpedtest1.dds\",\n \"gta3.img/lasraodnshops.txd/snpedtest1.dds\",\"gta3.img/airoads_las.txd/snpedtest1.dds\",\n \"gta3.img/lasroads_las2.txd/snpedtest1.dds\",\"gta3.img/airoads_las.txd/snpedtest1.dds\",\n \"gta3.img/lasroads_las.txd/snpedtest1.dds\",\"gta3.img/airoads_las.txd/snpedtest1.dds\",\n \"gta3.img/law2_roadsb.txd/snpedtest1.dds\",\"gta3.img/airoads_las.txd/snpedtest1.dds\",\n \"gta3.img/railtracklae.txd/snpedtest1.dds\",\"gta3.img/airoads_las.txd/snpedtest1.dds\",\n \"gta3.img/roadlan2.txd/snpedtest1.dds\",\"gta3.img/airoads_las.txd/snpedtest1.dds\",\n \"gta3.img/roads_lahills.txd/snpedtest1.dds\",\"gta3.img/airoads_las.txd/snpedtest1.dds\",\n \"gta3.img/roads_lawn.txd/snpedtest1.dds\",\"gta3.img/airoads_las.txd/snpedtest1.dds\",\n \"gta3.img/roads_law.txd/snpedtest1.dds\",\"gta3.img/airoads_las.txd/snpedtest1.dds\",\n \"gta3.img/roads_tunnellahills.txd/snpedtest1.dds\",\"gta3.img/airoads_las.txd/snpedtest1.dds\",\n \"gta3.img/skyscrap2_lan2.txd/snpedtest1.dds\",\"gta3.img/airoads_las.txd/snpedtest1.dds\",\n \"gta3.img/stapl.txd/snpedtest1.dds\",\"gta3.img/airoads_las.txd/snpedtest1.dds\",\n \"gta3.img/stormdrain_las2.txd/snpedtest1.dds\",\"gta3.img/airoads_las.txd/snpedtest1.dds\",\n \"gta3.img/union_las.txd/snpedtest1.dds\",\"gta3.img/airoads_las.txd/snpedtest1.dds\",\n \"gta3.img/airprtrunway_las.txd/sjmhoodlawn41.dds\",\"gta3.img/airoads_las.txd/sjmhoodlawn41.dds\",\n \"gta3.img/coast_las2.txd/sjmhoodlawn41.dds\",\"gta3.img/airoads_las.txd/sjmhoodlawn41.dds\",\n \"gta3.img/crparkgm_lan2.txd/sjmhoodlawn41.dds\",\"gta3.img/airoads_las.txd/sjmhoodlawn41.dds\",\n \"gta3.img/docks2_las2.txd/sjmhoodlawn41.dds\",\"gta3.img/airoads_las.txd/sjmhoodlawn41.dds\",\n \"gta3.img/docks_las2.txd/sjmhoodlawn41.dds\",\"gta3.img/airoads_las.txd/sjmhoodlawn41.dds\",\n \"gta3.img/freeway2_las2.txd/sjmhoodlawn41.dds\",\"gta3.img/airoads_las.txd/sjmhoodlawn41.dds\",\n \"gta3.img/freeway2_las.txd/sjmhoodlawn41.dds\",\"gta3.img/airoads_las.txd/sjmhoodlawn41.dds\",\n \"gta3.img/freeway_las.txd/sjmhoodlawn41.dds\",\"gta3.img/airoads_las.txd/sjmhoodlawn41.dds\",\n \"gta3.img/griffobs_las.txd/sjmhoodlawn41.dds\",\"gta3.img/airoads_las.txd/sjmhoodlawn41.dds\",\n \"gta3.img/ground2_las2.txd/sjmhoodlawn41.dds\",\"gta3.img/airoads_las.txd/sjmhoodlawn41.dds\",\n \"gta3.img/ground4_las.txd/sjmhoodlawn41.dds\",\"gta3.img/airoads_las.txd/sjmhoodlawn41.dds\",\n \"gta3.img/idlewood3_lae.txd/sjmhoodlawn41.dds\",\"gta3.img/airoads_las.txd/sjmhoodlawn41.dds\",\n \"gta3.img/lae2newtempbx.txd/sjmhoodlawn41.dds\",\"gta3.img/airoads_las.txd/sjmhoodlawn41.dds\",\n \"gta3.img/lae2roadscoast.txd/sjmhoodlawn41.dds\",\"gta3.img/airoads_las.txd/sjmhoodlawn41.dds\",\n \"gta3.img/lae2roadshub.txd/sjmhoodlawn41.dds\",\"gta3.img/airoads_las.txd/sjmhoodlawn41.dds\",\n \"gta3.img/lae2roads.txd/sjmhoodlawn41.dds\",\"gta3.img/airoads_las.txd/sjmhoodlawn41.dds\",\n \"gta3.img/laeroads2s.txd/sjmhoodlawn41.dds\",\"gta3.img/airoads_las.txd/sjmhoodlawn41.dds\",\n \"gta3.img/laeroads.txd/sjmhoodlawn41.dds\",\"gta3.img/airoads_las.txd/sjmhoodlawn41.dds\",\n \"gta3.img/lan2freeway.txd/sjmhoodlawn41.dds\",\"gta3.img/airoads_las.txd/sjmhoodlawn41.dds\",\n \"gta3.img/lasground2_las2.txd/sjmhoodlawn41.dds\",\"gta3.img/airoads_las.txd/sjmhoodlawn41.dds\",\n \"gta3.img/lasground_las2.txd/sjmhoodlawn41.dds\",\"gta3.img/airoads_las.txd/sjmhoodlawn41.dds\",\n \"gta3.img/lasraodnshops.txd/sjmhoodlawn41.dds\",\"gta3.img/airoads_las.txd/sjmhoodlawn41.dds\",\n \"gta3.img/lasroads_las2.txd/sjmhoodlawn41.dds\",\"gta3.img/airoads_las.txd/sjmhoodlawn41.dds\",\n \"gta3.img/lasroads_las.txd/sjmhoodlawn41.dds\",\"gta3.img/airoads_las.txd/sjmhoodlawn41.dds\",\n \"gta3.img/roadlan2.txd/sjmhoodlawn41.dds\",\"gta3.img/airoads_las.txd/sjmhoodlawn41.dds\",\n \"gta3.img/roads_lahills.txd/sjmhoodlawn41.dds\",\"gta3.img/airoads_las.txd/sjmhoodlawn41.dds\",\n \"gta3.img/roads_lawn.txd/sjmhoodlawn41.dds\",\"gta3.img/airoads_las.txd/sjmhoodlawn41.dds\",\n \"gta3.img/sjmla_las.txd/sjmhoodlawn41.dds\",\"gta3.img/airoads_las.txd/sjmhoodlawn41.dds\",\n \"gta3.img/stormdrain_las2.txd/sjmhoodlawn41.dds\",\"gta3.img/airoads_las.txd/sjmhoodlawn41.dds\",\n \"gta3.img/wasteland_las2.txd/sjmhoodlawn41.dds\",\"gta3.img/airoads_las.txd/sjmhoodlawn41.dds\",\n \"gta_int.img/intgarage2aint3.txd/sjmhoodlawn41.dds\",\"gta3.img/airoads_las.txd/sjmhoodlawn41.dds\",\n \"gta_int.img/int_kbsgarage3.txd/sjmhoodlawn41.dds\",\"gta3.img/airoads_las.txd/sjmhoodlawn41.dds\",\n \"gta3.img/ap_build4e.txd/weewall256.dds\",\"gta3.img/airoads_las.txd/weewall256.dds\",\n \"gta3.img/des_stownstrip1.txd/weewall256.dds\",\"gta3.img/airoads_las.txd/weewall256.dds\",\n \"gta3.img/freeway_las.txd/weewall256.dds\",\"gta3.img/airoads_las.txd/weewall256.dds\",\n \"gta3.img/vgnretail6.txd/weewall256.dds\",\"gta3.img/airoads_las.txd/weewall256.dds\",\n \"gta3.img/vgshpground.txd/weewall256.dds\",\"gta3.img/airoads_las.txd/weewall256.dds\",\n \"gta3.img/vgssairport02.txd/weewall256.dds\",\"gta3.img/airoads_las.txd/weewall256.dds\",\n \"gta3.img/airport2.txd/grassdry_128hv.dds\",\"gta3.img/airoads_las.txd/grassdry_128hv.dds\",\n \"gta3.img/airportdetail.txd/grassdry_128hv.dds\",\"gta3.img/airoads_las.txd/grassdry_128hv.dds\",\n \"gta3.img/airprtrunway_las.txd/grassdry_128hv.dds\",\"gta3.img/airoads_las.txd/grassdry_128hv.dds\",\n \"gta3.img/arprtxxref_las.txd/grassdry_128hv.dds\",\"gta3.img/airoads_las.txd/grassdry_128hv.dds\",\n \"gta3.img/civic04_lan.txd/grassdry_128hv.dds\",\"gta3.img/airoads_las.txd/grassdry_128hv.dds\",\n \"gta3.img/ground4_las.txd/grassdry_128hv.dds\",\"gta3.img/airoads_las.txd/grassdry_128hv.dds\",\n \"gta3.img/landlae2.txd/grassdry_128hv.dds\",\"gta3.img/airoads_las.txd/grassdry_128hv.dds\",\n \"gta3.img/lasground_las2.txd/grassdry_128hv.dds\",\"gta3.img/airoads_las.txd/grassdry_128hv.dds\",\n \"gta3.img/vegashse3.txd/grassdry_128hv.dds\",\"gta3.img/airoads_las.txd/grassdry_128hv.dds\",\n \"gta3.img/vegashse4.txd/grassdry_128hv.dds\",\"gta3.img/airoads_las.txd/grassdry_128hv.dds\",\n \"gta3.img/vegashse5.txd/grassdry_128hv.dds\",\"gta3.img/airoads_las.txd/grassdry_128hv.dds\",\n \"gta3.img/vegashse6.txd/grassdry_128hv.dds\",\"gta3.img/airoads_las.txd/grassdry_128hv.dds\",\n \"gta3.img/vegashse7.txd/grassdry_128hv.dds\",\"gta3.img/airoads_las.txd/grassdry_128hv.dds\",\n \"gta3.img/vegassvehse7.txd/grassdry_128hv.dds\",\"gta3.img/airoads_las.txd/grassdry_128hv.dds\",\n \"gta3.img/vegirlfr01.txd/grassdry_128hv.dds\",\"gta3.img/airoads_las.txd/grassdry_128hv.dds\",\n \"gta3.img/vgseland03_lvs.txd/grassdry_128hv.dds\",\"gta3.img/airoads_las.txd/grassdry_128hv.dds\",\n \"gta3.img/airport2.txd/dt_road.dds\",\"gta3.img/airoads_las.txd/dt_road.dds\",\n \"gta3.img/airport_las.txd/dt_road.dds\",\"gta3.img/airoads_las.txd/dt_road.dds\",\n \"gta3.img/airportroads_sfse.txd/dt_road.dds\",\"gta3.img/airoads_las.txd/dt_road.dds\",\n \"gta3.img/burnsground.txd/dt_road.dds\",\"gta3.img/airoads_las.txd/dt_road.dds\",\n \"gta3.img/civic03_lan.txd/dt_road.dds\",\"gta3.img/airoads_las.txd/dt_road.dds\",\n \"gta3.img/coast_apts.txd/dt_road.dds\",\"gta3.img/airoads_las.txd/dt_road.dds\",\n \"gta3.img/coast_las2.txd/dt_road.dds\",\"gta3.img/airoads_las.txd/dt_road.dds\",\n \"gta3.img/cunteroads4.txd/dt_road.dds\",\"gta3.img/airoads_las.txd/dt_road.dds\",\n \"gta3.img/docks2_las2.txd/dt_road.dds\",\"gta3.img/airoads_las.txd/dt_road.dds\",\n \"gta3.img/docks_las2.txd/dt_road.dds\",\"gta3.img/airoads_las.txd/dt_road.dds\",\n \"gta3.img/drivingschool_sfse.txd/dt_road.dds\",\"gta3.img/airoads_las.txd/dt_road.dds\",\n \"gta3.img/eastbeach2a_lae2.txd/dt_road.dds\",\"gta3.img/airoads_las.txd/dt_road.dds\",\n \"gta3.img/eastbeach8_lae2.txd/dt_road.dds\",\"gta3.img/airoads_las.txd/dt_road.dds\",\n \"gta3.img/firehouse_sfse.txd/dt_road.dds\",\"gta3.img/airoads_las.txd/dt_road.dds\",\n \"gta3.img/freeway2_las2.txd/dt_road.dds\",\"gta3.img/airoads_las.txd/dt_road.dds\",\n \"gta3.img/freeway_las.txd/dt_road.dds\",\"gta3.img/airoads_las.txd/dt_road.dds\",\n \"gta3.img/genroads_sfse.txd/dt_road.dds\",\"gta3.img/airoads_las.txd/dt_road.dds\",\n \"gta3.img/ground4_las.txd/dt_road.dds\",\"gta3.img/airoads_las.txd/dt_road.dds\",\n \"gta3.img/lae2bigblock.txd/dt_road.dds\",\"gta3.img/airoads_las.txd/dt_road.dds\",\n \"gta3.img/lae2roadscoast.txd/dt_road.dds\",\"gta3.img/airoads_las.txd/dt_road.dds\",\n \"gta3.img/lae2roadshub.txd/dt_road.dds\",\"gta3.img/airoads_las.txd/dt_road.dds\",\n \"gta3.img/lae2roads.txd/dt_road.dds\",\"gta3.img/airoads_las.txd/dt_road.dds\",\n \"gta3.img/lahillsroadscoast.txd/dt_road.dds\",\"gta3.img/airoads_las.txd/dt_road.dds\",\n \"gta3.img/landcoast_lae2.txd/dt_road.dds\",\"gta3.img/airoads_las.txd/dt_road.dds\",\n \"gta3.img/landsfw.txd/dt_road.dds\",\"gta3.img/airoads_las.txd/dt_road.dds\",\n \"gta3.img/lanriver.txd/dt_road.dds\",\"gta3.img/airoads_las.txd/dt_road.dds\",\n \"gta3.img/lasroads_las2.txd/dt_road.dds\",\"gta3.img/airoads_las.txd/dt_road.dds\",\n \"gta3.img/mountainsfs.txd/dt_road.dds\",\"gta3.img/airoads_las.txd/dt_road.dds\",\n \"gta3.img/parktunnel_sfs.txd/dt_road.dds\",\"gta3.img/airoads_las.txd/dt_road.dds\",\n \"gta3.img/roads_sfs.txd/dt_road.dds\",\"gta3.img/airoads_las.txd/dt_road.dds\",\n \"gta3.img/sfn_roadssfn.txd/dt_road.dds\",\"gta3.img/airoads_las.txd/dt_road.dds\",\n \"gta3.img/skyscrap_sfse.txd/dt_road.dds\",\"gta3.img/airoads_las.txd/dt_road.dds\",\n \"gta3.img/stormdrain.txd/dt_road.dds\",\"gta3.img/airoads_las.txd/dt_road.dds\",\n \"gta3.img/sv_ground_sfs.txd/dt_road.dds\",\"gta3.img/airoads_las.txd/dt_road.dds\",\n \"gta3.img/vgnground.txd/dt_road.dds\",\"gta3.img/airoads_las.txd/dt_road.dds\",\n \"gta3.img/vgsehighways.txd/dt_road.dds\",\"gta3.img/airoads_las.txd/dt_road.dds\",\n \"gta3.img/vgseroads.txd/dt_road.dds\",\"gta3.img/airoads_las.txd/dt_road.dds\",\n \"gta3.img/vgsnhighway.txd/dt_road.dds\",\"gta3.img/airoads_las.txd/dt_road.dds\",\n \"gta3.img/vgssroads.txd/dt_road.dds\",\"gta3.img/airoads_las.txd/dt_road.dds\",\n \"gta3.img/vgwsthiway1.txd/dt_road.dds\",\"gta3.img/airoads_las.txd/dt_road.dds\",\n \"gta_int.img/rampforduthie.txd/dt_road.dds\",\"gta3.img/airoads_las.txd/dt_road.dds\",\n \"gta3.img/baseballground_sfs.txd/kbpavement_test.dds\",\"gta3.img/airoads_las.txd/kbpavement_test.dds\",\n \"gta3.img/coast_apts.txd/kbpavement_test.dds\",\"gta3.img/airoads_las.txd/kbpavement_test.dds\",\n \"gta3.img/exclibrland.txd/kbpavement_test.dds\",\"gta3.img/airoads_las.txd/kbpavement_test.dds\",\n \"gta3.img/fosterroads_sfse.txd/kbpavement_test.dds\",\"gta3.img/airoads_las.txd/kbpavement_test.dds\",\n \"gta3.img/freeways3_sfse.txd/kbpavement_test.dds\",\"gta3.img/airoads_las.txd/kbpavement_test.dds\",\n \"gta3.img/lae2roadscoast.txd/kbpavement_test.dds\",\"gta3.img/airoads_las.txd/kbpavement_test.dds\",\n \"gta3.img/lae2roadshub.txd/kbpavement_test.dds\",\"gta3.img/airoads_las.txd/kbpavement_test.dds\",\n \"gta3.img/lae2roads.txd/kbpavement_test.dds\",\"gta3.img/airoads_las.txd/kbpavement_test.dds\",\n \"gta3.img/lahillsroadscoast.txd/kbpavement_test.dds\",\"gta3.img/airoads_las.txd/kbpavement_test.dds\",\n \"gta3.img/landcoast_lae2.txd/kbpavement_test.dds\",\"gta3.img/airoads_las.txd/kbpavement_test.dds\",\n \"gta3.img/lasground2_las2.txd/kbpavement_test.dds\",\"gta3.img/airoads_las.txd/kbpavement_test.dds\",\n \"gta3.img/roads_lawn.txd/kbpavement_test.dds\",\"gta3.img/airoads_las.txd/kbpavement_test.dds\",\n \"gta3.img/skyscrap_sfse.txd/kbpavement_test.dds\",\"gta3.img/airoads_las.txd/kbpavement_test.dds\",\n \"gta3.img/stormdrain.txd/kbpavement_test.dds\",\"gta3.img/airoads_las.txd/kbpavement_test.dds\",\n \"gta3.img/traindocks_sfse.txd/kbpavement_test.dds\",\"gta3.img/airoads_las.txd/kbpavement_test.dds\",\n \"gta3.img/vgseland.txd/kbpavement_test.dds\",\"gta3.img/airoads_las.txd/kbpavement_test.dds\",\n \"gta3.img/vgseroads.txd/kbpavement_test.dds\",\"gta3.img/airoads_las.txd/kbpavement_test.dds\",\n \"gta3.img/vgssmulticarprk.txd/kbpavement_test.dds\",\"gta3.img/airoads_las.txd/kbpavement_test.dds\",\n \"gta3.img/vgssroads.txd/kbpavement_test.dds\",\"gta3.img/airoads_las.txd/kbpavement_test.dds\",\n \"gta3.img/vgwestground.txd/kbpavement_test.dds\",\"gta3.img/airoads_las.txd/kbpavement_test.dds\",\n \"gta3.img/warehus_las2.txd/kbpavement_test.dds\",\"gta3.img/airoads_las.txd/kbpavement_test.dds\",\n \"gta3.img/airport2.txd/easykerb.dds\",\"gta3.img/airoads_las.txd/easykerb.dds\",\n \"gta3.img/airport_las.txd/easykerb.dds\",\"gta3.img/airoads_las.txd/easykerb.dds\",\n \"gta3.img/airprtrunway_las.txd/easykerb.dds\",\"gta3.img/airoads_las.txd/easykerb.dds\",\n \"gta3.img/coast_las2.txd/easykerb.dds\",\"gta3.img/airoads_las.txd/easykerb.dds\",\n \"gta3.img/docks2_las2.txd/easykerb.dds\",\"gta3.img/airoads_las.txd/easykerb.dds\",\n \"gta3.img/docks_las2.txd/easykerb.dds\",\"gta3.img/airoads_las.txd/easykerb.dds\",\n \"gta3.img/freeway2_las2.txd/easykerb.dds\",\"gta3.img/airoads_las.txd/easykerb.dds\",\n \"gta3.img/freeway2_las.txd/easykerb.dds\",\"gta3.img/airoads_las.txd/easykerb.dds\",\n \"gta3.img/freeway_las.txd/easykerb.dds\",\"gta3.img/airoads_las.txd/easykerb.dds\",\n \"gta3.img/griffobs_las.txd/easykerb.dds\",\"gta3.img/airoads_las.txd/easykerb.dds\",\n \"gta3.img/ground4_las.txd/easykerb.dds\",\"gta3.img/airoads_las.txd/easykerb.dds\",\n \"gta3.img/lanroad.txd/easykerb.dds\",\"gta3.img/airoads_las.txd/easykerb.dds\",\n \"gta3.img/lasground_las2.txd/easykerb.dds\",\"gta3.img/airoads_las.txd/easykerb.dds\",\n \"gta3.img/lasraodnshops.txd/easykerb.dds\",\"gta3.img/airoads_las.txd/easykerb.dds\",\n \"gta3.img/lasroads_las2.txd/easykerb.dds\",\"gta3.img/airoads_las.txd/easykerb.dds\",\n \"gta3.img/lasroads_las.txd/easykerb.dds\",\"gta3.img/airoads_las.txd/easykerb.dds\",\n \"gta3.img/shopliquor_las.txd/easykerb.dds\",\"gta3.img/airoads_las.txd/easykerb.dds\",\n \"gta3.img/stormdrain_las2.txd/easykerb.dds\",\"gta3.img/airoads_las.txd/easykerb.dds\",\n \"gta3.img/union_las.txd/easykerb.dds\",\"gta3.img/airoads_las.txd/easykerb.dds\",\n \"gta3.img/carrierint_sfs.txd/yellowscum64.dds\",\"gta3.img/airport1_sfse.txd/yellowscum64.dds\",\n \"gta3.img/cranes_dyn2.txd/yellowscum64.dds\",\"gta3.img/airport1_sfse.txd/yellowscum64.dds\",\n \"gta3.img/factorycuntw.txd/yellowscum64.dds\",\"gta3.img/airport1_sfse.txd/yellowscum64.dds\",\n \"gta3.img/indust_lax.txd/yellowscum64.dds\",\"gta3.img/airport1_sfse.txd/yellowscum64.dds\",\n \"gta3.img/kei_wnchx.txd/yellowscum64.dds\",\"gta3.img/airport1_sfse.txd/yellowscum64.dds\",\n \"gta3.img/lasxrefdock.txd/yellowscum64.dds\",\"gta3.img/airport1_sfse.txd/yellowscum64.dds\",\n \"gta3.img/subpen2_sfse.txd/yellowscum64.dds\",\"gta3.img/airport1_sfse.txd/yellowscum64.dds\",\n \"gta3.img/vgnpwroutbld2.txd/yellowscum64.dds\",\"gta3.img/airport1_sfse.txd/yellowscum64.dds\",\n \"gta3.img/sancliff02_law2.txd/airportwind03.dds\",\"gta3.img/airport1_sfse.txd/airportwind03.dds\",\n \"gta3.img/airportrminl_sfse.txd/ws_airportdoors1.dds\",\"gta3.img/airport1_sfse.txd/ws_airportdoors1.dds\",\n \"gta3.img/depot_sfse.txd/ws_airportdoors1.dds\",\"gta3.img/airport1_sfse.txd/ws_airportdoors1.dds\",\n \"gta3.img/silicon2_sfse.txd/ws_airportdoors1.dds\",\"gta3.img/airport1_sfse.txd/ws_airportdoors1.dds\",\n \"gta3.img/silicon_sfxrf.txd/ws_airportdoors1.dds\",\"gta3.img/airport1_sfse.txd/ws_airportdoors1.dds\",\n \"gta3.img/skyscrapper_sfs.txd/ws_airportdoors1.dds\",\"gta3.img/airport1_sfse.txd/ws_airportdoors1.dds\",\n \"gta3.img/skyscrap_sfse.txd/ws_airportdoors1.dds\",\"gta3.img/airport1_sfse.txd/ws_airportdoors1.dds\",\n \"gta3.img/subshops_sfs.txd/ws_airportdoors1.dds\",\"gta3.img/airport1_sfse.txd/ws_airportdoors1.dds\",\n \"gta3.img/tvtower_sfs.txd/ws_airportdoors1.dds\",\"gta3.img/airport1_sfse.txd/ws_airportdoors1.dds\",\n \"gta3.img/firehouse_sfse.txd/ws_rollerdoor_fire.dds\",\"gta3.img/airport1_sfse.txd/ws_rollerdoor_fire.dds\",\n \"gta3.img/lanlacma_lan2.txd/laslacma93.dds\",\"gta3.img/airport2.txd/laslacma93.dds\",\n \"gta3.img/lahills_wiresnshit3.txd/bevflower2.dds\",\"gta3.img/airport2.txd/bevflower2.dds\",\n \"gta3.img/airportdetail.txd/sm_agave_2.dds\",\"gta3.img/airport2.txd/sm_agave_2.dds\",\n \"gta3.img/arprtxxref_las.txd/sm_agave_2.dds\",\"gta3.img/airport2.txd/sm_agave_2.dds\",\n \"gta3.img/beach_las2.txd/sm_agave_2.dds\",\"gta3.img/airport2.txd/sm_agave_2.dds\",\n \"gta3.img/beacliff_law2.txd/sm_agave_2.dds\",\"gta3.img/airport2.txd/sm_agave_2.dds\",\n \"gta3.img/griffobs_las.txd/sm_agave_2.dds\",\"gta3.img/airport2.txd/sm_agave_2.dds\",\n \"gta3.img/rodeo02_law2.txd/sm_agave_2.dds\",\"gta3.img/airport2.txd/sm_agave_2.dds\",\n \"gta3.img/rodeo05_law2.txd/sm_agave_2.dds\",\"gta3.img/airport2.txd/sm_agave_2.dds\",\n \"gta3.img/vgsscollege.txd/sm_agave_2.dds\",\"gta3.img/airport2.txd/sm_agave_2.dds\",\n \"gta3.img/wiresetc_las2.txd/sm_agave_2.dds\",\"gta3.img/airport2.txd/sm_agave_2.dds\",\n \"gta3.img/wiresetc_las.txd/sm_agave_2.dds\",\"gta3.img/airport2.txd/sm_agave_2.dds\",\n \"gta_int.img/genintgtatrees.txd/sm_agave_2.dds\",\"gta3.img/airport2.txd/sm_agave_2.dds\",\n \"gta3.img/hub_alpha.txd/kbplanter_plants1.dds\",\"gta3.img/airport2.txd/kbplanter_plants1.dds\",\n \"gta3.img/lae2coast_alpha.txd/kbplanter_plants1.dds\",\"gta3.img/airport2.txd/kbplanter_plants1.dds\",\n \"gta3.img/laealpha.txd/kbplanter_plants1.dds\",\"gta3.img/airport2.txd/kbplanter_plants1.dds\",\n \"gta3.img/lawnbush.txd/kbplanter_plants1.dds\",\"gta3.img/airport2.txd/kbplanter_plants1.dds\",\n \"gta3.img/sunrise05_lawn.txd/kbplanter_plants1.dds\",\"gta3.img/airport2.txd/kbplanter_plants1.dds\",\n \"gta3.img/sw_diner1.txd/kbplanter_plants1.dds\",\"gta3.img/airport2.txd/kbplanter_plants1.dds\",\n \"gta_int.img/genintgeneric.txd/kbplanter_plants1.dds\",\"gta3.img/airport2.txd/kbplanter_plants1.dds\",\n \"gta3.img/airportdetail.txd/aarprt6las.dds\",\"gta3.img/airport2.txd/aarprt6las.dds\",\n \"gta3.img/airport_las.txd/aarprt6las.dds\",\"gta3.img/airport2.txd/aarprt6las.dds\",\n \"gta3.img/airport3_las.txd/sw_door12.dds\",\"gta3.img/airport2.txd/sw_door12.dds\",\n \"gta3.img/airport_las.txd/sw_door12.dds\",\"gta3.img/airport2.txd/sw_door12.dds\",\n \"gta3.img/ce_bankalley1.txd/sw_door12.dds\",\"gta3.img/airport2.txd/sw_door12.dds\",\n \"gta3.img/ce_bankalley2.txd/sw_door12.dds\",\"gta3.img/airport2.txd/sw_door12.dds\",\n \"gta3.img/ce_bankalley3.txd/sw_door12.dds\",\"gta3.img/airport2.txd/sw_door12.dds\",\n \"gta3.img/sw_block11.txd/sw_door12.dds\",\"gta3.img/airport2.txd/sw_door12.dds\",\n \"gta3.img/sw_fact01.txd/sw_door12.dds\",\"gta3.img/airport2.txd/sw_door12.dds\",\n \"gta3.img/sw_library.txd/sw_door12.dds\",\"gta3.img/airport2.txd/sw_door12.dds\",\n \"gta3.img/freeway_las.txd/scaff2flas.dds\",\"gta3.img/airport2.txd/scaff2flas.dds\",\n \"gta3.img/airport_las.txd/laslacma96.dds\",\"gta3.img/airport2.txd/laslacma96.dds\",\n \"gta3.img/arprtxxref_las.txd/laslacma96.dds\",\"gta3.img/airport2.txd/laslacma96.dds\",\n \"gta3.img/downtown_las.txd/laslacma96.dds\",\"gta3.img/airport2.txd/laslacma96.dds\",\n \"gta3.img/lanlacma_lan2.txd/laslacma96.dds\",\"gta3.img/airport2.txd/laslacma96.dds\",\n \"gta3.img/airport_las.txd/sjmpostbar3.dds\",\"gta3.img/airport2.txd/sjmpostbar3.dds\",\n \"gta3.img/sanpedhse_1x.txd/sjmpostbar3.dds\",\"gta3.img/airport2.txd/sjmpostbar3.dds\",\n \"gta3.img/snpedhusxref.txd/sjmpostbar3.dds\",\"gta3.img/airport2.txd/sjmpostbar3.dds\",\n \"gta3.img/airport_las.txd/aarprt3las.dds\",\"gta3.img/airport2.txd/aarprt3las.dds\",\n \"gta3.img/vgsswarehse02.txd/sw_shedwall02.dds\",\"gta3.img/airport2.txd/sw_shedwall02.dds\",\n \"gta3.img/airport_las.txd/sanpedock5.dds\",\"gta3.img/airport2.txd/sanpedock5.dds\",\n \"gta3.img/groundb_las2.txd/sanpedock5.dds\",\"gta3.img/airport2.txd/sanpedock5.dds\",\n \"gta3.img/ground_las2.txd/sanpedock5.dds\",\"gta3.img/airport2.txd/sanpedock5.dds\",\n \"gta3.img/imrancomp_las2.txd/sanpedock5.dds\",\"gta3.img/airport2.txd/sanpedock5.dds\",\n \"gta3.img/lasxrefdock.txd/sanpedock5.dds\",\"gta3.img/airport2.txd/sanpedock5.dds\",\n \"gta3.img/sw_sheds2.txd/sanpedock5.dds\",\"gta3.img/airport2.txd/sanpedock5.dds\",\n \"gta3.img/warehus_las2.txd/sanpedock5.dds\",\"gta3.img/airport2.txd/sanpedock5.dds\",\n \"gta_int.img/genintwarehsint3.txd/sanpedock5.dds\",\"gta3.img/airport2.txd/sanpedock5.dds\",\n \"gta3.img/airport_las.txd/aarprt5las.dds\",\"gta3.img/airport2.txd/aarprt5las.dds\",\n \"gta3.img/airport_las.txd/brnstucco1.dds\",\"gta3.img/airport2.txd/brnstucco1.dds\",\n \"gta3.img/des_telescopestuff.txd/brnstucco1.dds\",\"gta3.img/airport2.txd/brnstucco1.dds\",\n \"gta3.img/vgnbball.txd/brnstucco1.dds\",\"gta3.img/airport2.txd/brnstucco1.dds\",\n \"gta3.img/vgsebuild01.txd/brnstucco1.dds\",\"gta3.img/airport2.txd/brnstucco1.dds\",\n \"gta3.img/airport_las.txd/bathtile01_int.dds\",\"gta3.img/airport2.txd/bathtile01_int.dds\",\n \"gta3.img/shops_sfse.txd/bathtile01_int.dds\",\"gta3.img/airport2.txd/bathtile01_int.dds\",\n \"gta3.img/vgnfremnt2.txd/bathtile01_int.dds\",\"gta3.img/airport2.txd/bathtile01_int.dds\",\n \"gta3.img/airport_las.txd/sanairtex1.dds\",\"gta3.img/airport2.txd/sanairtex1.dds\",\n \"gta3.img/ground5_las.txd/sanairtex1.dds\",\"gta3.img/airport2.txd/sanairtex1.dds\",\n \"gta3.img/shopliquor_las.txd/sanairtex1.dds\",\"gta3.img/airport2.txd/sanairtex1.dds\",\n \"gta3.img/lanbloke.txd/tardor9.dds\",\"gta3.img/airport2.txd/tardor9.dds\",\n \"gta3.img/lanlacmab_lan2.txd/tardor9.dds\",\"gta3.img/airport2.txd/tardor9.dds\",\n \"gta3.img/lanlacma_lan2.txd/tardor9.dds\",\"gta3.img/airport2.txd/tardor9.dds\",\n \"gta3.img/lawnxref.txd/tardor9.dds\",\"gta3.img/airport2.txd/tardor9.dds\",\n \"gta3.img/dockcargo1_las.txd/sanpedock7.dds\",\"gta3.img/airport3_las.txd/sanpedock7.dds\",\n \"gta3.img/garag3_lawn.txd/sanpedock7.dds\",\"gta3.img/airport3_las.txd/sanpedock7.dds\",\n \"gta3.img/ground3_las2.txd/sanpedock7.dds\",\"gta3.img/airport3_las.txd/sanpedock7.dds\",\n \"gta3.img/groundb_las2.txd/sanpedock7.dds\",\"gta3.img/airport3_las.txd/sanpedock7.dds\",\n \"gta3.img/ground_las2.txd/sanpedock7.dds\",\"gta3.img/airport3_las.txd/sanpedock7.dds\",\n \"gta3.img/idlewood6_detail.txd/sanpedock7.dds\",\"gta3.img/airport3_las.txd/sanpedock7.dds\",\n \"gta3.img/paynspray_lae.txd/sanpedock7.dds\",\"gta3.img/airport3_las.txd/sanpedock7.dds\",\n \"gta3.img/railway_las.txd/sanpedock7.dds\",\"gta3.img/airport3_las.txd/sanpedock7.dds\",\n \"gta3.img/refinery.txd/sanpedock7.dds\",\"gta3.img/airport3_las.txd/sanpedock7.dds\",\n \"gta3.img/union_las.txd/sanpedock7.dds\",\"gta3.img/airport3_las.txd/sanpedock7.dds\",\n \"gta3.img/warehus_las2.txd/sanpedock7.dds\",\"gta3.img/airport3_las.txd/sanpedock7.dds\",\n \"gta3.img/cuntwbtxcs_t.txd/brwall_128.dds\",\"gta3.img/airport3_las.txd/brwall_128.dds\",\n \"gta3.img/lawartg.txd/brwall_128.dds\",\"gta3.img/airport3_las.txd/brwall_128.dds\",\n \"gta3.img/lawwhitebuilds.txd/brwall_128.dds\",\"gta3.img/airport3_las.txd/brwall_128.dds\",\n \"gta3.img/melrose17_lawn.txd/brwall_128.dds\",\"gta3.img/airport3_las.txd/brwall_128.dds\",\n \"gta3.img/ufo_bar.txd/brwall_128.dds\",\"gta3.img/airport3_las.txd/brwall_128.dds\",\n \"gta3.img/airportrminl_sfse.txd/mirrwind4_lan.dds\",\"gta3.img/airport3_las.txd/mirrwind1_lan.dds\",\n \"gta3.img/lahillshilhs1c.txd/mirrwind4_lan.dds\",\"gta3.img/airport3_las.txd/mirrwind1_lan.dds\",\n \"gta3.img/vgnpwrentrnce.txd/mirrwind4_lan.dds\",\"gta3.img/airport3_las.txd/mirrwind1_lan.dds\",\n \"gta3.img/airport_las.txd/aarprt1las.dds\",\"gta3.img/airport3_las.txd/aarprt1las.dds\",\n \"gta3.img/beachapts_lax.txd/gnhotelwall02_128.dds\",\"gta3.img/airport3_las.txd/gnhotelwall02_128.dds\",\n \"gta3.img/carpark3_lvs.txd/gnhotelwall02_128.dds\",\"gta3.img/airport3_las.txd/gnhotelwall02_128.dds\",\n \"gta3.img/casnorylgrnd.txd/gnhotelwall02_128.dds\",\"gta3.img/airport3_las.txd/gnhotelwall02_128.dds\",\n \"gta3.img/coast_apts.txd/gnhotelwall02_128.dds\",\"gta3.img/airport3_las.txd/gnhotelwall02_128.dds\",\n \"gta3.img/cos_pizzaplace.txd/gnhotelwall02_128.dds\",\"gta3.img/airport3_las.txd/gnhotelwall02_128.dds\",\n \"gta3.img/cw_motel1.txd/gnhotelwall02_128.dds\",\"gta3.img/airport3_las.txd/gnhotelwall02_128.dds\",\n \"gta3.img/des_dinerw.txd/gnhotelwall02_128.dds\",\"gta3.img/airport3_las.txd/gnhotelwall02_128.dds\",\n \"gta3.img/des_ranch.txd/gnhotelwall02_128.dds\",\"gta3.img/airport3_las.txd/gnhotelwall02_128.dds\",\n \"gta3.img/des_stownstrip1.txd/gnhotelwall02_128.dds\",\"gta3.img/airport3_las.txd/gnhotelwall02_128.dds\",\n \"gta3.img/exclibrland.txd/gnhotelwall02_128.dds\",\"gta3.img/airport3_las.txd/gnhotelwall02_128.dds\",\n \"gta3.img/flmngoland.txd/gnhotelwall02_128.dds\",\"gta3.img/airport3_las.txd/gnhotelwall02_128.dds\",\n \"gta3.img/garag3_lawn.txd/gnhotelwall02_128.dds\",\"gta3.img/airport3_las.txd/gnhotelwall02_128.dds\",\n \"gta3.img/gnhotel1.txd/gnhotelwall02_128.dds\",\"gta3.img/airport3_las.txd/gnhotelwall02_128.dds\",\n \"gta3.img/laconcha.txd/gnhotelwall02_128.dds\",\"gta3.img/airport3_las.txd/gnhotelwall02_128.dds\",\n \"gta3.img/nucarpark.txd/gnhotelwall02_128.dds\",\"gta3.img/airport3_las.txd/gnhotelwall02_128.dds\",\n \"gta3.img/stadium_sfse.txd/gnhotelwall02_128.dds\",\"gta3.img/airport3_las.txd/gnhotelwall02_128.dds\",\n \"gta3.img/sunrise02_lawn.txd/gnhotelwall02_128.dds\",\"gta3.img/airport3_las.txd/gnhotelwall02_128.dds\",\n \"gta3.img/sunset01_lawn.txd/gnhotelwall02_128.dds\",\"gta3.img/airport3_las.txd/gnhotelwall02_128.dds\",\n \"gta3.img/vegasemulticar.txd/gnhotelwall02_128.dds\",\"gta3.img/airport3_las.txd/gnhotelwall02_128.dds\",\n \"gta3.img/vgnshopnmall.txd/gnhotelwall02_128.dds\",\"gta3.img/airport3_las.txd/gnhotelwall02_128.dds\",\n \"gta3.img/vgnvrock.txd/gnhotelwall02_128.dds\",\"gta3.img/airport3_las.txd/gnhotelwall02_128.dds\",\n \"gta3.img/vgsecoast.txd/gnhotelwall02_128.dds\",\"gta3.img/airport3_las.txd/gnhotelwall02_128.dds\",\n \"gta3.img/vgseland.txd/gnhotelwall02_128.dds\",\"gta3.img/airport3_las.txd/gnhotelwall02_128.dds\",\n \"gta3.img/vgssmulticarprk.txd/gnhotelwall02_128.dds\",\"gta3.img/airport3_las.txd/gnhotelwall02_128.dds\",\n \"gta3.img/vgsswarehse02c.txd/gnhotelwall02_128.dds\",\"gta3.img/airport3_las.txd/gnhotelwall02_128.dds\",\n \"gta3.img/vgsswarehse02.txd/gnhotelwall02_128.dds\",\"gta3.img/airport3_las.txd/gnhotelwall02_128.dds\",\n \"gta3.img/vgsswrehse03.txd/gnhotelwall02_128.dds\",\"gta3.img/airport3_las.txd/gnhotelwall02_128.dds\",\n \"gta3.img/wddngchplgrnd01.txd/gnhotelwall02_128.dds\",\"gta3.img/airport3_las.txd/gnhotelwall02_128.dds\",\n \"gta3.img/groundb_las2.txd/sanpedock8.dds\",\"gta3.img/airport3_las.txd/sanpedock8.dds\",\n \"gta3.img/wasteland_las2.txd/sanpedock8.dds\",\"gta3.img/airport3_las.txd/sanpedock8.dds\",\n \"gta3.img/dk_midbuilds.txd/gallery01_law.dds\",\"gta3.img/airport3_las.txd/gallery01_law.dds\",\n \"gta3.img/hotelbackpool_sfs.txd/gallery01_law.dds\",\"gta3.img/airport3_las.txd/gallery01_law.dds\",\n \"gta3.img/laconcha.txd/gallery01_law.dds\",\"gta3.img/airport3_las.txd/gallery01_law.dds\",\n \"gta3.img/lawartg.txd/gallery01_law.dds\",\"gta3.img/airport3_las.txd/gallery01_law.dds\",\n \"gta3.img/mainlcawn.txd/gallery01_law.dds\",\"gta3.img/airport3_las.txd/gallery01_law.dds\",\n \"gta3.img/rodeo02_law2.txd/gallery01_law.dds\",\"gta3.img/airport3_las.txd/gallery01_law.dds\",\n \"gta3.img/sunrise11_lawn.txd/gallery01_law.dds\",\"gta3.img/airport3_las.txd/gallery01_law.dds\",\n \"gta3.img/sw_med1.txd/gallery01_law.dds\",\"gta3.img/airport3_las.txd/gallery01_law.dds\",\n \"gta3.img/vgeamun.txd/gallery01_law.dds\",\"gta3.img/airport3_las.txd/gallery01_law.dds\",\n \"gta3.img/vgnamun.txd/gallery01_law.dds\",\"gta3.img/airport3_las.txd/gallery01_law.dds\",\n \"gta3.img/vgs_stadium.txd/gallery01_law.dds\",\"gta3.img/airport3_las.txd/gallery01_law.dds\",\n \"gta3.img/bulkheadlight.txd/ws_fluorescent1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_fluorescent1.dds\",\n \"gta3.img/carimpound_sfe.txd/ws_fluorescent1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_fluorescent1.dds\",\n \"gta3.img/carpark_sfe.txd/ws_fluorescent1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_fluorescent1.dds\",\n \"gta3.img/cuntwland.txd/ws_fluorescent1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_fluorescent1.dds\",\n \"gta3.img/cuntwtunnel.txd/ws_fluorescent1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_fluorescent1.dds\",\n \"gta3.img/depot_sfse.txd/ws_fluorescent1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_fluorescent1.dds\",\n \"gta3.img/dtbuil1_lan2.txd/ws_fluorescent1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_fluorescent1.dds\",\n \"gta3.img/fighot.txd/ws_fluorescent1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_fluorescent1.dds\",\n \"gta3.img/golftunnel_sfs.txd/ws_fluorescent1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_fluorescent1.dds\",\n \"gta3.img/hashupass_sfs.txd/ws_fluorescent1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_fluorescent1.dds\",\n \"gta3.img/hosbibalsfw.txd/ws_fluorescent1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_fluorescent1.dds\",\n \"gta3.img/lanpolicecp.txd/ws_fluorescent1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_fluorescent1.dds\",\n \"gta3.img/rodeo03_law2.txd/ws_fluorescent1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_fluorescent1.dds\",\n \"gta3.img/skyscrap2_lan2.txd/ws_fluorescent1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_fluorescent1.dds\",\n \"gta3.img/skyscrap_sfse.txd/ws_fluorescent1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_fluorescent1.dds\",\n \"gta3.img/stolenbuild01.txd/ws_fluorescent1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_fluorescent1.dds\",\n \"gta3.img/stolenbuild02.txd/ws_fluorescent1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_fluorescent1.dds\",\n \"gta3.img/tunnel_sfe.txd/ws_fluorescent1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_fluorescent1.dds\",\n \"gta3.img/vegasemulticar.txd/ws_fluorescent1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_fluorescent1.dds\",\n \"gta3.img/vgsn_rooflit.txd/ws_fluorescent1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_fluorescent1.dds\",\n \"gta3.img/telegraph.txd/ws_crashbarrier2.dds\",\"gta3.img/airportcpark_sfse.txd/ws_crashbarrier2.dds\",\n \"gta3.img/vgstlgraphpole.txd/ws_crashbarrier2.dds\",\"gta3.img/airportcpark_sfse.txd/ws_crashbarrier2.dds\",\n \"gta3.img/counte_b2.txd/ws_crashbarrier.dds\",\"gta3.img/airportcpark_sfse.txd/ws_crashbarrier.dds\",\n \"gta3.img/carpark_sfe.txd/ws_fireexit.dds\",\"gta3.img/airportcpark_sfse.txd/ws_fireexit.dds\",\n \"gta3.img/eastbeach8_lae2.txd/ws_fireexit.dds\",\"gta3.img/airportcpark_sfse.txd/ws_fireexit.dds\",\n \"gta3.img/lanbloke.txd/ws_fireexit.dds\",\"gta3.img/airportcpark_sfse.txd/ws_fireexit.dds\",\n \"gta3.img/vegasemulticar.txd/ws_fireexit.dds\",\"gta3.img/airportcpark_sfse.txd/ws_fireexit.dds\",\n \"gta3.img/carimpound_sfe.txd/ws_doubledoor1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_doubledoor1.dds\",\n \"gta3.img/carpark_sfe.txd/ws_doubledoor1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_doubledoor1.dds\",\n \"gta3.img/coast_apts.txd/ws_doubledoor1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_doubledoor1.dds\",\n \"gta3.img/cw2_cinemablockcs_t.txd/ws_doubledoor1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_doubledoor1.dds\",\n \"gta3.img/gazlaw1.txd/ws_doubledoor1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_doubledoor1.dds\",\n \"gta3.img/gazlaw2.txd/ws_doubledoor1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_doubledoor1.dds\",\n \"gta3.img/gazlaw3.txd/ws_doubledoor1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_doubledoor1.dds\",\n \"gta3.img/gazsfn1.txd/ws_doubledoor1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_doubledoor1.dds\",\n \"gta3.img/lanpolicecp.txd/ws_doubledoor1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_doubledoor1.dds\",\n \"gta3.img/law_beach2.txd/ws_doubledoor1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_doubledoor1.dds\",\n \"gta3.img/queens1_sfs.txd/ws_doubledoor1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_doubledoor1.dds\",\n \"gta3.img/slapart01sfe.txd/ws_doubledoor1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_doubledoor1.dds\",\n \"gta3.img/sunrise02_lawn.txd/ws_doubledoor1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_doubledoor1.dds\",\n \"gta3.img/sw_brewery.txd/ws_doubledoor1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_doubledoor1.dds\",\n \"gta3.img/vegasemulticar.txd/ws_doubledoor1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_doubledoor1.dds\",\n \"gta3.img/vgndwntwn1.txd/ws_doubledoor1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_doubledoor1.dds\",\n \"gta3.img/airprtrunway_las.txd/ws_carpark1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_carpark1.dds\",\n \"gta3.img/baseballground_sfs.txd/ws_carpark1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_carpark1.dds\",\n \"gta3.img/canalsg_law.txd/ws_carpark1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_carpark1.dds\",\n \"gta3.img/carimpound_sfe.txd/ws_carpark1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_carpark1.dds\",\n \"gta3.img/carpark_sfe.txd/ws_carpark1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_carpark1.dds\",\n \"gta3.img/ce_ground01.txd/ws_carpark1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_carpark1.dds\",\n \"gta3.img/ce_ground05.txd/ws_carpark1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_carpark1.dds\",\n \"gta3.img/cluckbell_sfs.txd/ws_carpark1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_carpark1.dds\",\n \"gta3.img/cuntwbtzzcs_t.txd/ws_carpark1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_carpark1.dds\",\n \"gta3.img/drivingschool_sfse.txd/ws_carpark1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_carpark1.dds\",\n \"gta3.img/eastbeach2a_lae2.txd/ws_carpark1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_carpark1.dds\",\n \"gta3.img/gardencentre_sfs.txd/ws_carpark1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_carpark1.dds\",\n \"gta3.img/hashblock1_sfs.txd/ws_carpark1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_carpark1.dds\",\n \"gta3.img/lanpolicecp.txd/ws_carpark1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_carpark1.dds\",\n \"gta3.img/lawwhitebuilds.txd/ws_carpark1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_carpark1.dds\",\n \"gta3.img/mall_sfse.txd/ws_carpark1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_carpark1.dds\",\n \"gta3.img/mountainsfs.txd/ws_carpark1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_carpark1.dds\",\n \"gta3.img/rodeo03_law2.txd/ws_carpark1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_carpark1.dds\",\n \"gta3.img/skyscrap_sfse.txd/ws_carpark1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_carpark1.dds\",\n \"gta3.img/vegascourtbld.txd/ws_carpark1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_carpark1.dds\",\n \"gta3.img/vegasemulticar.txd/ws_carpark1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_carpark1.dds\",\n \"gta3.img/vegastemp1.txd/ws_carpark1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_carpark1.dds\",\n \"gta3.img/vgndwntwn1.txd/ws_carpark1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_carpark1.dds\",\n \"gta3.img/vgsnbuild07.txd/ws_carpark1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_carpark1.dds\",\n \"gta3.img/carpark_sfe.txd/elecbox2.dds\",\"gta3.img/airportcpark_sfse.txd/elecbox2.dds\",\n \"gta3.img/carimpound_sfe.txd/ws_carpark3.dds\",\"gta3.img/airportcpark_sfse.txd/ws_carpark3.dds\",\n \"gta3.img/carpark_sfe.txd/ws_carpark3.dds\",\"gta3.img/airportcpark_sfse.txd/ws_carpark3.dds\",\n \"gta3.img/hospital_lae.txd/ws_carpark3.dds\",\"gta3.img/airportcpark_sfse.txd/ws_carpark3.dds\",\n \"gta3.img/lanpolicecp.txd/ws_carpark3.dds\",\"gta3.img/airportcpark_sfse.txd/ws_carpark3.dds\",\n \"gta3.img/miragecasino1.txd/ws_carpark3.dds\",\"gta3.img/airportcpark_sfse.txd/ws_carpark3.dds\",\n \"gta3.img/piera_law2.txd/ws_carpark3.dds\",\"gta3.img/airportcpark_sfse.txd/ws_carpark3.dds\",\n \"gta3.img/vegascourtbld.txd/ws_carpark3.dds\",\"gta3.img/airportcpark_sfse.txd/ws_carpark3.dds\",\n \"gta3.img/vegasemulticar.txd/ws_carpark3.dds\",\"gta3.img/airportcpark_sfse.txd/ws_carpark3.dds\",\n \"gta3.img/vegastemp1.txd/ws_carpark3.dds\",\"gta3.img/airportcpark_sfse.txd/ws_carpark3.dds\",\n \"gta3.img/vgndwntwn1.txd/ws_carpark3.dds\",\"gta3.img/airportcpark_sfse.txd/ws_carpark3.dds\",\n \"gta3.img/carpark_sfe.txd/vgsclubdoor02_128.dds\",\"gta3.img/airportcpark_sfse.txd/vgsclubdoor02_128.dds\",\n \"gta3.img/chinatownsfe.txd/vgsclubdoor02_128.dds\",\"gta3.img/airportcpark_sfse.txd/vgsclubdoor02_128.dds\",\n \"gta3.img/crparkgm_lan2.txd/vgsclubdoor02_128.dds\",\"gta3.img/airportcpark_sfse.txd/vgsclubdoor02_128.dds\",\n \"gta3.img/farmhouse.txd/vgsclubdoor02_128.dds\",\"gta3.img/airportcpark_sfse.txd/vgsclubdoor02_128.dds\",\n \"gta3.img/vegasemulticar.txd/vgsclubdoor02_128.dds\",\"gta3.img/airportcpark_sfse.txd/vgsclubdoor02_128.dds\",\n \"gta3.img/vgndwntwn21.txd/vgsclubdoor02_128.dds\",\"gta3.img/airportcpark_sfse.txd/vgsclubdoor02_128.dds\",\n \"gta3.img/vgnretail4.txd/vgsclubdoor02_128.dds\",\"gta3.img/airportcpark_sfse.txd/vgsclubdoor02_128.dds\",\n \"gta3.img/vgnretail5.txd/vgsclubdoor02_128.dds\",\"gta3.img/airportcpark_sfse.txd/vgsclubdoor02_128.dds\",\n \"gta3.img/vgnretail6.txd/vgsclubdoor02_128.dds\",\"gta3.img/airportcpark_sfse.txd/vgsclubdoor02_128.dds\",\n \"gta3.img/vgs_shops.txd/vgsclubdoor02_128.dds\",\"gta3.img/airportcpark_sfse.txd/vgsclubdoor02_128.dds\",\n \"gta3.img/bendytunnel_sfse.txd/ws_fluorescent2.dds\",\"gta3.img/airportcpark_sfse.txd/ws_fluorescent2.dds\",\n \"gta3.img/burnsground.txd/ws_fluorescent2.dds\",\"gta3.img/airportcpark_sfse.txd/ws_fluorescent2.dds\",\n \"gta3.img/ebeachcineblok.txd/ws_fluorescent2.dds\",\"gta3.img/airportcpark_sfse.txd/ws_fluorescent2.dds\",\n \"gta3.img/carimpound_sfe.txd/helipad_bits.dds\",\"gta3.img/airportcpark_sfse.txd/helipad_bits.dds\",\n \"gta3.img/carpark_sfe.txd/helipad_bits.dds\",\"gta3.img/airportcpark_sfse.txd/helipad_bits.dds\",\n \"gta3.img/libhelipad_lan2.txd/helipad_bits.dds\",\"gta3.img/airportcpark_sfse.txd/helipad_bits.dds\",\n \"gta3.img/moregenroofstuff.txd/helipad_bits.dds\",\"gta3.img/airportcpark_sfse.txd/helipad_bits.dds\",\n \"gta3.img/sfe_copchop.txd/helipad_bits.dds\",\"gta3.img/airportcpark_sfse.txd/helipad_bits.dds\",\n \"gta3.img/sfn_helipad.txd/helipad_bits.dds\",\"gta3.img/airportcpark_sfse.txd/helipad_bits.dds\",\n \"gta3.img/ship_brijsfw.txd/helipad_bits.dds\",\"gta3.img/airportcpark_sfse.txd/helipad_bits.dds\",\n \"gta3.img/vegasemulticar.txd/helipad_bits.dds\",\"gta3.img/airportcpark_sfse.txd/helipad_bits.dds\",\n \"gta3.img/vgnhelipad1.txd/helipad_bits.dds\",\"gta3.img/airportcpark_sfse.txd/helipad_bits.dds\",\n \"gta3.img/airportroads_sfse.txd/ws_roadarrow1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_roadarrow1.dds\",\n \"gta3.img/airportroads_sfse.txd/ws_aircarparksign1.dds\",\"gta3.img/airportcpark_sfse.txd/ws_aircarparksign1.dds\",\n \"gta3.img/carpark_sfe.txd/ws_boothpanel.dds\",\"gta3.img/airportcpark_sfse.txd/ws_boothpanel.dds\",\n \"gta3.img/crparkgm_lan2.txd/ws_boothpanel.dds\",\"gta3.img/airportcpark_sfse.txd/ws_boothpanel.dds\",\n \"gta3.img/vegasemulticar.txd/ws_boothpanel.dds\",\"gta3.img/airportcpark_sfse.txd/ws_boothpanel.dds\",\n \"gta3.img/vgsairport.txd/aarprt93las.dds\",\"gta3.img/airportdetail.txd/aarprt93las.dds\",\n \"gta3.img/vgsairport.txd/aarprt91las.dds\",\"gta3.img/airportdetail.txd/aarprt91las.dds\",\n \"gta3.img/billbrd01_lan2.txd/prolaps01.dds\",\"gta3.img/airportdetail.txd/prolaps01.dds\",\n \"gta3.img/bridgeland_sfse.txd/prolaps01.dds\",\"gta3.img/airportdetail.txd/prolaps01.dds\",\n \"gta3.img/glenpark6_lae.txd/prolaps01.dds\",\"gta3.img/airportdetail.txd/prolaps01.dds\",\n \"gta3.img/golf_sfs.txd/prolaps01.dds\",\"gta3.img/airportdetail.txd/prolaps01.dds\",\n \"gta3.img/sunbill_law2.txd/prolaps01.dds\",\"gta3.img/airportdetail.txd/prolaps01.dds\",\n \"gta3.img/sunstrans_law2.txd/prolaps01.dds\",\"gta3.img/airportdetail.txd/prolaps01.dds\",\n \"gta3.img/vgnshopnmall.txd/prolaps01_small.dds\",\"gta3.img/airportdetail.txd/prolaps01.dds\",\n \"gta_int.img/genintclothessport.txd/prolaps01.dds\",\"gta3.img/airportdetail.txd/prolaps01.dds\",\n \"gta3.img/airportgnd_sfse.txd/didersachs01.dds\",\"gta3.img/airportdetail.txd/didersachs01.dds\",\n \"gta3.img/billbrd01_lan2.txd/didersachs01.dds\",\"gta3.img/airportdetail.txd/didersachs01.dds\",\n \"gta3.img/billbrd01_lan.txd/didersachs01.dds\",\"gta3.img/airportdetail.txd/didersachs01.dds\",\n \"gta3.img/lahillsads.txd/didersachs01.dds\",\"gta3.img/airportdetail.txd/didersachs01.dds\",\n \"gta3.img/rodeo01_law2.txd/didersachs01.dds\",\"gta3.img/airportdetail.txd/didersachs01.dds\",\n \"gta3.img/sunbill_law2.txd/didersachs01.dds\",\"gta3.img/airportdetail.txd/didersachs01.dds\",\n \"gta3.img/vgebillboards.txd/didersachs01.dds\",\"gta3.img/airportdetail.txd/didersachs01.dds\",\n \"gta3.img/vgsssignage04.txd/didersachs01.dds\",\"gta3.img/airportdetail.txd/didersachs01.dds\",\n \"gta3.img/vgwestabats.txd/didersachs01.dds\",\"gta3.img/airportdetail.txd/didersachs01.dds\",\n \"gta3.img/wiresetc_las.txd/didersachs01.dds\",\"gta3.img/airportdetail.txd/didersachs01.dds\",\n \"gta3.img/billbrdlawn.txd/ads003=copy.dds\",\"gta3.img/airportdetail.txd/ads003=copy.dds\",\n \"gta3.img/idlewood46_lae.txd/ads003=copy.dds\",\"gta3.img/airportdetail.txd/ads003=copy.dds\",\n \"gta3.img/lae2billboards.txd/ads003=copy.dds\",\"gta3.img/airportdetail.txd/ads003=copy.dds\",\n \"gta3.img/stadiumground_sfse.txd/ads003=copy.dds\",\"gta3.img/airportdetail.txd/ads003=copy.dds\",\n \"gta3.img/sunbill_law2.txd/ads003=copy.dds\",\"gta3.img/airportdetail.txd/ads003=copy.dds\",\n \"gta3.img/sunstrans_law2.txd/ads003=copy.dds\",\"gta3.img/airportdetail.txd/ads003=copy.dds\",\n \"gta3.img/vgsssignage04.txd/ads003=copy.dds\",\"gta3.img/airportdetail.txd/ads003=copy.dds\",\n \"gta3.img/wiresetc_las.txd/ads003=copy.dds\",\"gta3.img/airportdetail.txd/ads003=copy.dds\",\n \"gta3.img/rodeot01_law2.txd/kb_ivy_256.dds\",\"gta3.img/airportdetail.txd/kb_ivy_256.dds\",\n \"gta3.img/arprtxxref_las.txd/bevflower1.dds\",\"gta3.img/airportdetail.txd/bevflower1.dds\",\n \"gta3.img/griffobs_las.txd/bevflower1.dds\",\"gta3.img/airportdetail.txd/bevflower1.dds\",\n \"gta3.img/lahills_wiresnshit3.txd/bevflower1.dds\",\"gta3.img/airportdetail.txd/bevflower1.dds\",\n \"gta3.img/wiresetc_las.txd/bevflower1.dds\",\"gta3.img/airportdetail.txd/bevflower1.dds\",\n \"gta3.img/arprtxxref_las.txd/sm_agave_1.dds\",\"gta3.img/airportdetail.txd/sm_agave_1.dds\",\n \"gta3.img/beach_las2.txd/sm_agave_1.dds\",\"gta3.img/airportdetail.txd/sm_agave_1.dds\",\n \"gta3.img/beach_las.txd/sm_agave_1.dds\",\"gta3.img/airportdetail.txd/sm_agave_1.dds\",\n \"gta3.img/beacliff_law2.txd/sm_agave_1.dds\",\"gta3.img/airportdetail.txd/sm_agave_1.dds\",\n \"gta3.img/burnsalpha.txd/sm_agave_1.dds\",\"gta3.img/airportdetail.txd/sm_agave_1.dds\",\n \"gta3.img/cinemart_alpha.txd/sm_agave_1.dds\",\"gta3.img/airportdetail.txd/sm_agave_1.dds\",\n \"gta3.img/cityhall_tr_lan.txd/sm_agave_1.dds\",\"gta3.img/airportdetail.txd/sm_agave_1.dds\",\n \"gta3.img/civic01_lan.txd/sm_agave_1.dds\",\"gta3.img/airportdetail.txd/sm_agave_1.dds\",\n \"gta3.img/civic02_lan.txd/sm_agave_1.dds\",\"gta3.img/airportdetail.txd/sm_agave_1.dds\",\n \"gta3.img/ctscene_las.txd/sm_agave_1.dds\",\"gta3.img/airportdetail.txd/sm_agave_1.dds\",\n \"gta3.img/fosterflowers.txd/sm_agave_1.dds\",\"gta3.img/airportdetail.txd/sm_agave_1.dds\",\n \"gta3.img/griffobs_las.txd/sm_agave_1.dds\",\"gta3.img/airportdetail.txd/sm_agave_1.dds\",\n \"gta3.img/hub_alpha.txd/sm_agave_1.dds\",\"gta3.img/airportdetail.txd/sm_agave_1.dds\",\n \"gta3.img/idlewood6_tr.txd/sm_agave_1.dds\",\"gta3.img/airportdetail.txd/sm_agave_1.dds\",\n \"gta3.img/lae2coast_alpha.txd/sm_agave_1.dds\",\"gta3.img/airportdetail.txd/sm_agave_1.dds\",\n \"gta3.img/laealpha.txd/sm_agave_1.dds\",\"gta3.img/airportdetail.txd/sm_agave_1.dds\",\n \"gta3.img/lanblokc.txd/sm_agave_1.dds\",\"gta3.img/airportdetail.txd/sm_agave_1.dds\",\n \"gta3.img/lawalphav.txd/sm_agave_1.dds\",\"gta3.img/airportdetail.txd/sm_agave_1.dds\",\n \"gta3.img/lawnbush.txd/sm_agave_1.dds\",\"gta3.img/airportdetail.txd/sm_agave_1.dds\",\n \"gta3.img/rodeo04_law2.txd/sm_agave_1.dds\",\"gta3.img/airportdetail.txd/sm_agave_1.dds\",\n \"gta3.img/sunstrans_law2.txd/sm_agave_1.dds\",\"gta3.img/airportdetail.txd/sm_agave_1.dds\",\n \"gta3.img/vegashse5.txd/sm_agave_1.dds\",\"gta3.img/airportdetail.txd/sm_agave_1.dds\",\n \"gta3.img/vegashse6.txd/sm_agave_1.dds\",\"gta3.img/airportdetail.txd/sm_agave_1.dds\",\n \"gta3.img/vegashse7.txd/sm_agave_1.dds\",\"gta3.img/airportdetail.txd/sm_agave_1.dds\",\n \"gta3.img/vegassvehse7.txd/sm_agave_1.dds\",\"gta3.img/airportdetail.txd/sm_agave_1.dds\",\n \"gta3.img/vgnglfcrse1.txd/sm_agave_1.dds\",\"gta3.img/airportdetail.txd/sm_agave_1.dds\",\n \"gta3.img/vgsscollege.txd/sm_agave_1.dds\",\"gta3.img/airportdetail.txd/sm_agave_1.dds\",\n \"gta3.img/vgssland03.txd/sm_agave_1.dds\",\"gta3.img/airportdetail.txd/sm_agave_1.dds\",\n \"gta3.img/vgsswarehse01.txd/sm_agave_1.dds\",\"gta3.img/airportdetail.txd/sm_agave_1.dds\",\n \"gta3.img/wiresetc2_las.txd/sm_agave_1.dds\",\"gta3.img/airportdetail.txd/sm_agave_1.dds\",\n \"gta3.img/wiresetc_las2.txd/sm_agave_1.dds\",\"gta3.img/airportdetail.txd/sm_agave_1.dds\",\n \"gta3.img/wiresetc_las.txd/sm_agave_1.dds\",\"gta3.img/airportdetail.txd/sm_agave_1.dds\",\n \"gta3.img/airport_las.txd/hedge2.dds\",\"gta3.img/airportdetail.txd/hedge2.dds\",\n \"gta3.img/cunte2_lahills.txd/hedge2.dds\",\"gta3.img/airportdetail.txd/hedge2.dds\",\n \"gta3.img/downtown_las.txd/hedge2.dds\",\"gta3.img/airportdetail.txd/hedge2.dds\",\n \"gta3.img/lahillsgrounds.txd/hedge2.dds\",\"gta3.img/airportdetail.txd/hedge2.dds\",\n \"gta3.img/lashops1b_las2.txd/hedge2.dds\",\"gta3.img/airportdetail.txd/hedge2.dds\",\n \"gta3.img/richman02_lahills.txd/hedge2.dds\",\"gta3.img/airportdetail.txd/hedge2.dds\",\n \"gta3.img/union_las.txd/hedge2.dds\",\"gta3.img/airportdetail.txd/hedge2.dds\",\n \"gta3.img/cityhall_tr_lan.txd/crackedgroundb.dds\",\"gta3.img/airportgnd_sfse.txd/crackedgroundb.dds\",\n \"gta3.img/crparkgm_lan2.txd/crackedgroundb.dds\",\"gta3.img/airportgnd_sfse.txd/crackedgroundb.dds\",\n \"gta3.img/ctscene_las.txd/crackedgroundb.dds\",\"gta3.img/airportgnd_sfse.txd/crackedgroundb.dds\",\n \"gta3.img/cunte_wires.txd/crackedgroundb.dds\",\"gta3.img/airportgnd_sfse.txd/crackedgroundb.dds\",\n \"gta3.img/desn2_alphabits.txd/crackedgroundb.dds\",\"gta3.img/airportgnd_sfse.txd/crackedgroundb.dds\",\n \"gta3.img/eastlstr_lae2.txd/crackedgroundb.dds\",\"gta3.img/airportgnd_sfse.txd/crackedgroundb.dds\",\n \"gta3.img/telewirelawn.txd/crackedgroundb.dds\",\"gta3.img/airportgnd_sfse.txd/crackedgroundb.dds\",\n \"gta3.img/wiresetc2_las.txd/crackedgroundb.dds\",\"gta3.img/airportgnd_sfse.txd/crackedgroundb.dds\",\n \"gta3.img/wiresetc_las2.txd/crackedgroundb.dds\",\"gta3.img/airportgnd_sfse.txd/crackedgroundb.dds\",\n \"gta3.img/wiresetc_las.txd/crackedgroundb.dds\",\"gta3.img/airportgnd_sfse.txd/crackedgroundb.dds\",\n \"gta3.img/xenon_sfse.txd/crackedgroundb.dds\",\"gta3.img/airportgnd_sfse.txd/crackedgroundb.dds\",\n \"gta3.img/coastground.txd/coasty_bit3_sfe.dds\",\"gta3.img/airportgnd_sfse.txd/coasty_bit3_sfe.dds\",\n \"gta3.img/docks2_sfse.txd/coasty_bit3_sfe.dds\",\"gta3.img/airportgnd_sfse.txd/coasty_bit3_sfe.dds\",\n \"gta3.img/ferrybit_sfw.txd/coasty_bit3_sfe.dds\",\"gta3.img/airportgnd_sfse.txd/coasty_bit3_sfe.dds\",\n \"gta3.img/hrbr_sfn.txd/coasty_bit3_sfe.dds\",\"gta3.img/airportgnd_sfse.txd/coasty_bit3_sfe.dds\",\n \"gta3.img/hrbr_sfw.txd/coasty_bit3_sfe.dds\",\"gta3.img/airportgnd_sfse.txd/coasty_bit3_sfe.dds\",\n \"gta3.img/subpen1_sfse.txd/coasty_bit3_sfe.dds\",\"gta3.img/airportgnd_sfse.txd/coasty_bit3_sfe.dds\",\n \"gta3.img/vgsecoast.txd/coasty_bit3_sfe.dds\",\"gta3.img/airportgnd_sfse.txd/coasty_bit3_sfe.dds\",\n \"gta3.img/glenpark7_lae.txd/bobo_3.dds\",\"gta3.img/airportgnd_sfse.txd/bobo_3.dds\",\n \"gta3.img/tempo22_law.txd/bobo_3.dds\",\"gta3.img/airportgnd_sfse.txd/bobo_3.dds\",\n \"gta3.img/vgebillboards.txd/bobo_3.dds\",\"gta3.img/airportgnd_sfse.txd/bobo_3.dds\",\n \"gta3.img/vgsssignage03.txd/bobo_3.dds\",\"gta3.img/airportgnd_sfse.txd/bobo_3.dds\",\n \"gta3.img/warehus_las2.txd/bobo_3.dds\",\"gta3.img/airportgnd_sfse.txd/bobo_3.dds\",\n \"gta3.img/docks2_sfse.txd/ws_whitestripe.dds\",\"gta3.img/airportgnd_sfse.txd/ws_whitestripe.dds\",\n \"gta3.img/vgssland01.txd/ws_whitestripe.dds\",\"gta3.img/airportgnd_sfse.txd/ws_whitestripe.dds\",\n \"gta3.img/airprtrunway_las.txd/ws_yellowline.dds\",\"gta3.img/airportgnd_sfse.txd/ws_yellowline.dds\",\n \"gta3.img/arprtxxref_las.txd/gridchev_64hv.dds\",\"gta3.img/airportgnd_sfse.txd/gridchev_64hv.dds\",\n \"gta3.img/vegasairprtland.txd/gridchev_64hv.dds\",\"gta3.img/airportgnd_sfse.txd/gridchev_64hv.dds\",\n \"gta3.img/vgnabatoir.txd/gridchev_64hv.dds\",\"gta3.img/airportgnd_sfse.txd/gridchev_64hv.dds\",\n \"gta3.img/vgssstairs1.txd/gridchev_64hv.dds\",\"gta3.img/airportgnd_sfse.txd/gridchev_64hv.dds\",\n \"gta_int.img/genintintbarb2.txd/gridchev_64hv.dds\",\"gta3.img/airportgnd_sfse.txd/gridchev_64hv.dds\",\n \"gta_int.img/genintintbarb.txd/gridchev_64hv.dds\",\"gta3.img/airportgnd_sfse.txd/gridchev_64hv.dds\",\n \"gta3.img/fedmint_sfs.txd/ws_oldpainted2rusty.dds\",\"gta3.img/airportgnd_sfse.txd/ws_oldpainted2rusty.dds\",\n \"gta3.img/roadbridge_sfse.txd/ws_oldpainted2rusty.dds\",\"gta3.img/airportgnd_sfse.txd/ws_oldpainted2rusty.dds\",\n \"gta3.img/stadbridge_sfs.txd/ws_bridgepavement2.dds\",\"gta3.img/airportgnd_sfse.txd/ws_bridgepavement2.dds\",\n \"gta3.img/blacksky_sfse.txd/ws_whiteplaster_top.dds\",\"gta3.img/airportgnd_sfse.txd/ws_whiteplaster_top.dds\",\n \"gta3.img/ap_learjets.txd/black64.dds\",\"gta3.img/airportgnd_sfse.txd/black64.dds\",\n \"gta3.img/crackfact_sfse.txd/black64.dds\",\"gta3.img/airportgnd_sfse.txd/black64.dds\",\n \"gta3.img/crack_intkb.txd/black64.dds\",\"gta3.img/airportgnd_sfse.txd/black64.dds\",\n \"gta3.img/cunts_gunclub.txd/black64.dds\",\"gta3.img/airportgnd_sfse.txd/black64.dds\",\n \"gta3.img/des_boneyard.txd/black64.dds\",\"gta3.img/airportgnd_sfse.txd/black64.dds\",\n \"gta3.img/des_gunclub.txd/black64.dds\",\"gta3.img/airportgnd_sfse.txd/black64.dds\",\n \"gta3.img/desn2_stud.txd/black64.dds\",\"gta3.img/airportgnd_sfse.txd/black64.dds\",\n \"gta3.img/des_quarrybits.txd/black64.dds\",\"gta3.img/airportgnd_sfse.txd/black64.dds\",\n \"gta3.img/des_ranch.txd/black64.dds\",\"gta3.img/airportgnd_sfse.txd/black64.dds\",\n \"gta3.img/dyntraffic.txd/black64.dds\",\"gta3.img/airportgnd_sfse.txd/black64.dds\",\n \"gta3.img/farmhouse.txd/black64.dds\",\"gta3.img/airportgnd_sfse.txd/black64.dds\",\n \"gta3.img/freight.txd/freight92window64.dds\",\"gta3.img/airportgnd_sfse.txd/black64.dds\",\n \"gta3.img/kei_wnchx.txd/black64.dds\",\"gta3.img/airportgnd_sfse.txd/black64.dds\",\n \"gta3.img/la_props1.txd/black64.dds\",\"gta3.img/airportgnd_sfse.txd/black64.dds\",\n \"gta3.img/lashops6_las2.txd/black64.dds\",\"gta3.img/airportgnd_sfse.txd/black64.dds\",\n \"gta3.img/libertyfar.txd/chinabuildnew1c.dds\",\"gta3.img/airportgnd_sfse.txd/black64.dds\",\n \"gta3.img/missiles_sfs.txd/black64.dds\",\"gta3.img/airportgnd_sfse.txd/black64.dds\",\n \"gta3.img/refinery.txd/black64.dds\",\"gta3.img/airportgnd_sfse.txd/black64.dds\",\n \"gta3.img/stadtplaza_lae2.txd/black64.dds\",\"gta3.img/airportgnd_sfse.txd/black64.dds\",\n \"gta3.img/vgsbikeschool.txd/black64.dds\",\"gta3.img/airportgnd_sfse.txd/black64.dds\",\n \"gta3.img/wshxrefpump.txd/black64.dds\",\"gta3.img/airportgnd_sfse.txd/black64.dds\",\n \"gta_int.img/gb_books01.txd/black64.dds\",\"gta3.img/airportgnd_sfse.txd/black64.dds\",\n \"gta_int.img/gb_magazines01.txd/black64.dds\",\"gta3.img/airportgnd_sfse.txd/black64.dds\",\n \"gta_int.img/gb_ornaments01.txd/black64.dds\",\"gta3.img/airportgnd_sfse.txd/black64.dds\",\n \"gta_int.img/gen_offtrackint.txd/black64.dds\",\"gta3.img/airportgnd_sfse.txd/black64.dds\",\n \"gta_int.img/imm_rooms.txd/black64.dds\",\"gta3.img/airportgnd_sfse.txd/black64.dds\",\n \"gta_int.img/labig3int2.txd/black64.dds\",\"gta3.img/airportgnd_sfse.txd/black64.dds\",\n \"gta_int.img/lee_studhall.txd/black64.dds\",\"gta3.img/airportgnd_sfse.txd/black64.dds\",\n \"gta3.img/airprtrunway_las.txd/ap_runwaysigns2.dds\",\"gta3.img/airportgnd_sfse.txd/ap_runwaysigns2.dds\",\n \"gta3.img/airprtrunway_las.txd/ap_runwaysigns.dds\",\"gta3.img/airportgnd_sfse.txd/ap_runwaysigns.dds\",\n \"gta3.img/vgssland01.txd/ws_runwaytarmac.dds\",\"gta3.img/airportgnd_sfse.txd/ws_runwaytarmac.dds\",\n \"gta3.img/railbridge_sfse.txd/sea_wall_temp.dds\",\"gta3.img/airportgnd_sfse.txd/sea_wall_temp.dds\",\n \"gta3.img/airportroads_sfse.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/bakerybit2_sfse.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/bakerybit_sfse.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/beacliff_law2.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/bevcunto2_lahills.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/bridgeland_sfse.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/ce_ground01.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/ce_ground02.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/ce_ground03.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/ce_ground04.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/ce_ground05.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/ce_ground07.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/ce_ground08.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/ce_ground09.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/ce_ground10.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/ce_ground11.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/ce_ground12.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/ce_ground13.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/ce_ground14.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/chicano10_lae.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/cityhall_sfs.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/copshop_sfe.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/countryclbgnd_sfs.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/cs_forest.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/cs_mountain.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/cs_scrapyardarea.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/cs_scrapyard.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/cs_town.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/cunte1_lahills.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/cunteroads1.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/cunteroads2.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/cunteroads4.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/cunteroads5.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/cuntwlandcent.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/cuntwland.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/cuntwtunnel.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/docks2_sfse.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/easthills_lahills.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/exclibrland.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/fedmint_sfs.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/firehouse_sfse.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/freeways2_sfse.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/gardencentre_sfs.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/golf_sfs.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/graveyard_sfs.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/groundbit_sfse.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/groundbit_sfs.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/haight1_sfs.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/hillcliff_lahills.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/hotelback_sfs.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/lahillsground4cye.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/lahillsground4.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/lahillsgrounds.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/lahillslaroads.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/lahillsroadscoast.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/landsfe.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/law2_roadsb.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/lawland2.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/mullho03a_lahills.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/mullho03_lahills.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/oc_flats_gnd_sfs.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/officy_sfs.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/pinkcarpark_sfs.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/queensparks_sfs.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/richman02_lahills.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/richman04_lahills.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/roadslahills.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/roads_lawn.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/silconland_sfse.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/silicon2_sfse.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/silicon_sfse.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/skyscrapper_sfs.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/stadiumground_sfse.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/stadjunct_sfse.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/sunse10b_law2.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/sunset03_law2.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/sunset04_law2.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/sw_apartments.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/sw_office.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/tikigrass.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/traingen_sfse.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/vgsscollege.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/vgssland02.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/vgssland.txd/desgreengrass.dds\",\"gta3.img/airportgnd_sfse.txd/desgreengrass.dds\",\n \"gta3.img/airprtrunway_las.txd/white.dds\",\"gta3.img/airportgnd_sfse.txd/white.dds\",\n \"gta3.img/buildingsitevge.txd/white.dds\",\"gta3.img/airportgnd_sfse.txd/white.dds\",\n \"gta3.img/cj_traffic.txd/white.dds\",\"gta3.img/airportgnd_sfse.txd/white.dds\",\n \"gta3.img/crackfact_sfse.txd/white.dds\",\"gta3.img/airportgnd_sfse.txd/white.dds\",\n \"gta3.img/crack_intkb.txd/white.dds\",\"gta3.img/airportgnd_sfse.txd/white.dds\",\n \"gta3.img/dynsigns.txd/white64.dds\",\"gta3.img/airportgnd_sfse.txd/white.dds\",\n \"gta3.img/hubint2.txd/white.dds\",\"gta3.img/airportgnd_sfse.txd/white.dds\",\n \"gta3.img/kei_wnchx.txd/white.dds\",\"gta3.img/airportgnd_sfse.txd/white.dds\",\n \"gta3.img/missiles_sfs.txd/white.dds\",\"gta3.img/airportgnd_sfse.txd/white.dds\",\n \"gta3.img/pyramid.txd/white.dds\",\"gta3.img/airportgnd_sfse.txd/white.dds\",\n \"gta3.img/sfse_hubstuff.txd/white.dds\",\"gta3.img/airportgnd_sfse.txd/white.dds\",\n \"gta3.img/vgssland01.txd/white.dds\",\"gta3.img/airportgnd_sfse.txd/white.dds\",\n \"gta3.img/ws_jetty_sfx.txd/white.dds\",\"gta3.img/airportgnd_sfse.txd/white.dds\",\n \"gta_int.img/cj_barb2.txd/white.dds\",\"gta3.img/airportgnd_sfse.txd/white.dds\",\n \"gta_int.img/cj_bs_bathroom.txd/white.dds\",\"gta3.img/airportgnd_sfse.txd/white.dds\",\n \"gta_int.img/cj_ff.txd/white.dds\",\"gta3.img/airportgnd_sfse.txd/white.dds\",\n \"gta_int.img/cj_lighting.txd/white.dds\",\"gta3.img/airportgnd_sfse.txd/white.dds\",\n \"gta_int.img/cj_reels.txd/white.dds\",\"gta3.img/airportgnd_sfse.txd/white.dds\",\n \"gta_int.img/cuntcuts.txd/white.dds\",\"gta3.img/airportgnd_sfse.txd/white.dds\",\n \"gta_int.img/gb_cleancrock01.txd/white.dds\",\"gta3.img/airportgnd_sfse.txd/white.dds\",\n \"gta_int.img/gb_dirtycrock01.txd/white.dds\",\"gta3.img/airportgnd_sfse.txd/white.dds\",\n \"gta_int.img/gb_kitchtake.txd/white.dds\",\"gta3.img/airportgnd_sfse.txd/white.dds\",\n \"gta_int.img/gb_takeaway01.txd/white.dds\",\"gta3.img/airportgnd_sfse.txd/white.dds\",\n \"gta_int.img/labig3int2.txd/white.dds\",\"gta3.img/airportgnd_sfse.txd/white.dds\",\n \"gta_int.img/maint1.txd/white.dds\",\"gta3.img/airportgnd_sfse.txd/white.dds\",\n \"gta_int.img/savesfmid.txd/white.dds\",\"gta3.img/airportgnd_sfse.txd/white.dds\",\n \"gta_int.img/sfhosemed2.txd/white.dds\",\"gta3.img/airportgnd_sfse.txd/white.dds\",\n \"gta_int.img/shopping_acc.txd/white.dds\",\"gta3.img/airportgnd_sfse.txd/white.dds\",\n \"gta_int.img/shopping_clothes.txd/white.dds\",\"gta3.img/airportgnd_sfse.txd/white.dds\",\n \"gta_int.img/shopping_freezers.txd/white.dds\",\"gta3.img/airportgnd_sfse.txd/white.dds\",\n \"gta_int.img/shopping.txd/white.dds\",\"gta3.img/airportgnd_sfse.txd/white.dds\",\n \"gta_int.img/svbits.txd/white.dds\",\"gta3.img/airportgnd_sfse.txd/white.dds\",\n \"gta_int.img/svsfsm.txd/white.dds\",\"gta3.img/airportgnd_sfse.txd/white.dds\",\n \"gta_int.img/svvgmid.txd/white.dds\",\"gta3.img/airportgnd_sfse.txd/white.dds\",\n \"gta3.img/coastground.txd/sf_pave2.dds\",\"gta3.img/airportgnd_sfse.txd/sf_pave2.dds\",\n \"gta3.img/docks2_sfse.txd/sf_pave2.dds\",\"gta3.img/airportgnd_sfse.txd/sf_pave2.dds\",\n \"gta3.img/road2sfe.txd/sf_pave2.dds\",\"gta3.img/airportgnd_sfse.txd/sf_pave2.dds\",\n \"gta3.img/smallertxd.txd/sf_pave2.dds\",\"gta3.img/airportgnd_sfse.txd/sf_pave2.dds\",\n \"gta3.img/subpen1_sfse.txd/sf_pave2.dds\",\"gta3.img/airportgnd_sfse.txd/sf_pave2.dds\",\n \"gta3.img/vegass_jetty.txd/sf_pave2.dds\",\"gta3.img/airportgnd_sfse.txd/sf_pave2.dds\",\n \"gta3.img/vgsecoast.txd/sf_pave2.dds\",\"gta3.img/airportgnd_sfse.txd/sf_pave2.dds\",\n \"gta3.img/bev_law2.txd/bow_warehousewall.dds\",\"gta3.img/airport_las.txd/bow_warehousewall.dds\",\n \"gta3.img/buildblk555.txd/bow_warehousewall.dds\",\"gta3.img/airport_las.txd/bow_warehousewall.dds\",\n \"gta3.img/buildblk55.txd/bow_warehousewall.dds\",\"gta3.img/airport_las.txd/bow_warehousewall.dds\",\n \"gta3.img/civic06_lan.txd/bow_warehousewall.dds\",\"gta3.img/airport_las.txd/bow_warehousewall.dds\",\n \"gta3.img/cunteroads1.txd/bow_warehousewall.dds\",\"gta3.img/airport_las.txd/bow_warehousewall.dds\",\n \"gta3.img/cunteroads2.txd/bow_warehousewall.dds\",\"gta3.img/airport_las.txd/bow_warehousewall.dds\",\n \"gta3.img/downtown3_las.txd/bow_warehousewall.dds\",\"gta3.img/airport_las.txd/bow_warehousewall.dds\",\n \"gta3.img/hospital_lawn.txd/bow_warehousewall.dds\",\"gta3.img/airport_las.txd/bow_warehousewall.dds\",\n \"gta3.img/lae2roadscoast.txd/bow_warehousewall.dds\",\"gta3.img/airport_las.txd/bow_warehousewall.dds\",\n \"gta3.img/lae2roads.txd/bow_warehousewall.dds\",\"gta3.img/airport_las.txd/bow_warehousewall.dds\",\n \"gta3.img/lahillsroadscoast.txd/bow_warehousewall.dds\",\"gta3.img/airport_las.txd/bow_warehousewall.dds\",\n \"gta3.img/lanriver.txd/bow_warehousewall.dds\",\"gta3.img/airport_las.txd/bow_warehousewall.dds\",\n \"gta3.img/melrose02_lawn.txd/bow_warehousewall.dds\",\"gta3.img/airport_las.txd/bow_warehousewall.dds\",\n \"gta3.img/melrose05_lawn.txd/bow_warehousewall.dds\",\"gta3.img/airport_las.txd/bow_warehousewall.dds\",\n \"gta3.img/melrose11_lawn.txd/bow_warehousewall.dds\",\"gta3.img/airport_las.txd/bow_warehousewall.dds\",\n \"gta3.img/rodeoprk_law2.txd/bow_warehousewall.dds\",\"gta3.img/airport_las.txd/bow_warehousewall.dds\",\n \"gta3.img/santamonhus1.txd/bow_warehousewall.dds\",\"gta3.img/airport_las.txd/bow_warehousewall.dds\",\n \"gta3.img/santamonhus.txd/bow_warehousewall.dds\",\"gta3.img/airport_las.txd/bow_warehousewall.dds\",\n \"gta3.img/santamonicalaw2a.txd/bow_warehousewall.dds\",\"gta3.img/airport_las.txd/bow_warehousewall.dds\",\n \"gta3.img/shops2_law.txd/bow_warehousewall.dds\",\"gta3.img/airport_las.txd/bow_warehousewall.dds\",\n \"gta3.img/studio01_lawn.txd/bow_warehousewall.dds\",\"gta3.img/airport_las.txd/bow_warehousewall.dds\",\n \"gta3.img/sunset01_law2.txd/bow_warehousewall.dds\",\"gta3.img/airport_las.txd/bow_warehousewall.dds\",\n \"gta3.img/sunsetbittyu.txd/bow_warehousewall.dds\",\"gta3.img/airport_las.txd/bow_warehousewall.dds\",\n \"gta3.img/sw_block12.txd/bow_warehousewall.dds\",\"gta3.img/airport_las.txd/bow_warehousewall.dds\",\n \"gta3.img/vgwestretail1.txd/bow_warehousewall.dds\",\"gta3.img/airport_las.txd/bow_warehousewall.dds\",\n \"gta3.img/lift_drx.txd/liftdoorsac256.dds\",\"gta3.img/airport_las.txd/liftdoorsac256.dds\",\n \"gta3.img/shamcpark.txd/liftdoorsac256.dds\",\"gta3.img/airport_las.txd/liftdoorsac256.dds\",\n \"gta3.img/vgssairport.txd/liftdoorsac256.dds\",\"gta3.img/airport_las.txd/liftdoorsac256.dds\",\n \"gta_int.img/all_vault.txd/liftdoorsac256.dds\",\"gta3.img/airport_las.txd/liftdoorsac256.dds\",\n \"gta_int.img/civic02cj.txd/liftdoorsac256.dds\",\"gta3.img/airport_las.txd/liftdoorsac256.dds\",\n \"gta_int.img/mafiacasinovault01.txd/liftdoorsac256.dds\",\"gta3.img/airport_las.txd/liftdoorsac256.dds\",\n \"gta3.img/bendytunnel_sfse.txd/fencekb_64h.dds\",\"gta3.img/airport_las.txd/fencekb_64h.dds\",\n \"gta3.img/chgatedes.txd/fencekb_64h.dds\",\"gta3.img/airport_las.txd/fencekb_64h.dds\",\n \"gta3.img/chgatex.txd/fencekb_64h.dds\",\"gta3.img/airport_las.txd/fencekb_64h.dds\",\n \"gta3.img/ctgtxx.txd/fencekb_64h.dds\",\"gta3.img/airport_las.txd/fencekb_64h.dds\",\n \"gta3.img/electricgate.txd/fencekb_64h.dds\",\"gta3.img/airport_las.txd/fencekb_64h.dds\",\n \"gta3.img/fences.txd/fencekb_64h.dds\",\"gta3.img/airport_las.txd/fencekb_64h.dds\",\n \"gta3.img/laealpha.txd/fencekb_64h.dds\",\"gta3.img/airport_las.txd/fencekb_64h.dds\",\n \"gta3.img/vgndwntwn1.txd/fencekb_64h.dds\",\"gta3.img/airport_las.txd/fencekb_64h.dds\",\n \"gta3.img/vgnmall.txd/fencekb_64h.dds\",\"gta3.img/airport_las.txd/fencekb_64h.dds\",\n \"gta3.img/airportroads_sfse.txd/heliconcrete.dds\",\"gta3.img/airport_las.txd/heliconcrete.dds\",\n \"gta3.img/beach_las2.txd/heliconcrete.dds\",\"gta3.img/airport_las.txd/heliconcrete.dds\",\n \"gta3.img/beafron1_law2.txd/heliconcrete.dds\",\"gta3.img/airport_las.txd/heliconcrete.dds\",\n \"gta3.img/bevcunto2_lahills.txd/heliconcrete.dds\",\"gta3.img/airport_las.txd/heliconcrete.dds\",\n \"gta3.img/compapartb_la.txd/heliconcrete.dds\",\"gta3.img/airport_las.txd/heliconcrete.dds\",\n \"gta3.img/compapart_la.txd/heliconcrete.dds\",\"gta3.img/airport_las.txd/heliconcrete.dds\",\n \"gta3.img/contachou1_lae2.txd/heliconcrete.dds\",\"gta3.img/airport_las.txd/heliconcrete.dds\",\n \"gta3.img/coochieghous.txd/heliconcrete.dds\",\"gta3.img/airport_las.txd/heliconcrete.dds\",\n \"gta3.img/councl_law2.txd/heliconcrete.dds\",\"gta3.img/airport_las.txd/heliconcrete.dds\",\n \"gta3.img/eastbeach09_lae2.txd/heliconcrete.dds\",\"gta3.img/airport_las.txd/heliconcrete.dds\",\n \"gta3.img/ganghouse1_lax.txd/heliconcrete.dds\",\"gta3.img/airport_las.txd/heliconcrete.dds\",\n \"gta3.img/ganton01_lae2.txd/heliconcrete.dds\",\"gta3.img/airport_las.txd/heliconcrete.dds\",\n \"gta3.img/goldengate_sfw.txd/heliconcrete.dds\",\"gta3.img/airport_las.txd/heliconcrete.dds\",\n \"gta3.img/ground5_las.txd/heliconcrete.dds\",\"gta3.img/airport_las.txd/heliconcrete.dds\",\n \"gta3.img/lahillsgrounds.txd/heliconcrete.dds\",\"gta3.img/airport_las.txd/heliconcrete.dds\",\n \"gta3.img/lahillsla_roads.txd/heliconcrete.dds\",\"gta3.img/airport_las.txd/heliconcrete.dds\",\n \"gta3.img/lasroads_las.txd/heliconcrete.dds\",\"gta3.img/airport_las.txd/heliconcrete.dds\",\n \"gta3.img/law2_roadsb.txd/heliconcrete.dds\",\"gta3.img/airport_las.txd/heliconcrete.dds\",\n \"gta3.img/piera_law2.txd/heliconcrete.dds\",\"gta3.img/airport_las.txd/heliconcrete.dds\",\n \"gta3.img/roads_tunnellahills.txd/heliconcrete.dds\",\"gta3.img/airport_las.txd/heliconcrete.dds\",\n \"gta3.img/rodeo02_law2.txd/heliconcrete.dds\",\"gta3.img/airport_las.txd/heliconcrete.dds\",\n \"gta3.img/sfn_sfn.txd/heliconcrete.dds\",\"gta3.img/airport_las.txd/heliconcrete.dds\",\n \"gta3.img/sunset01_lawn.txd/heliconcrete.dds\",\"gta3.img/airport_las.txd/heliconcrete.dds\",\n \"gta3.img/sw_sheds.txd/heliconcrete.dds\",\"gta3.img/airport_las.txd/heliconcrete.dds\",\n \"gta3.img/vegasbuild.txd/heliconcrete.dds\",\"gta3.img/airport_las.txd/heliconcrete.dds\",\n \"gta3.img/vegassvehse7.txd/heliconcrete.dds\",\"gta3.img/airport_las.txd/heliconcrete.dds\",\n \"gta3.img/vegirlfr01.txd/heliconcrete.dds\",\"gta3.img/airport_las.txd/heliconcrete.dds\",\n \"gta3.img/venchouse_lax.txd/heliconcrete.dds\",\"gta3.img/airport_las.txd/heliconcrete.dds\",\n \"gta3.img/vgnbball.txd/heliconcrete.dds\",\"gta3.img/airport_las.txd/heliconcrete.dds\",\n \"gta3.img/vgnpwroutbld2.txd/heliconcrete.dds\",\"gta3.img/airport_las.txd/heliconcrete.dds\",\n \"gta3.img/vgsland2.txd/heliconcrete.dds\",\"gta3.img/airport_las.txd/heliconcrete.dds\",\n \"gta3.img/vgsshospshop.txd/heliconcrete.dds\",\"gta3.img/airport_las.txd/heliconcrete.dds\",\n \"gta3.img/vgssroads.txd/heliconcrete.dds\",\"gta3.img/airport_las.txd/heliconcrete.dds\",\n \"gta3.img/vgsswarehse02c.txd/heliconcrete.dds\",\"gta3.img/airport_las.txd/heliconcrete.dds\",\n \"gta_int.img/cj_statue_1.txd/heliconcrete.dds\",\"gta3.img/airport_las.txd/heliconcrete.dds\",\n \"gta_int.img/cj_statue_2.txd/heliconcrete.dds\",\"gta3.img/airport_las.txd/heliconcrete.dds\",\n \"gta3.img/cehillhse14.txd/fancy_slab128.dds\",\"gta3.img/airport_las.txd/fancy_slab128.dds\",\n \"gta3.img/coastground.txd/fancy_slab128.dds\",\"gta3.img/airport_las.txd/fancy_slab128.dds\",\n \"gta3.img/ferrybit_sfw.txd/fancy_slab128.dds\",\"gta3.img/airport_las.txd/fancy_slab128.dds\",\n \"gta3.img/hrbr_sfn.txd/fancy_slab128.dds\",\"gta3.img/airport_las.txd/fancy_slab128.dds\",\n \"gta3.img/hrbr_sfw.txd/fancy_slab128.dds\",\"gta3.img/airport_las.txd/fancy_slab128.dds\",\n \"gta3.img/law_doontoon.txd/fancy_slab128.dds\",\"gta3.img/airport_las.txd/fancy_slab128.dds\",\n \"gta3.img/shops2_law.txd/fancy_slab128.dds\",\"gta3.img/airport_las.txd/fancy_slab128.dds\",\n \"gta3.img/stadium_sfse.txd/fancy_slab128.dds\",\"gta3.img/airport_las.txd/fancy_slab128.dds\",\n \"gta3.img/sw_brewery.txd/fancy_slab128.dds\",\"gta3.img/airport_las.txd/fancy_slab128.dds\",\n \"gta3.img/vgnland.txd/fancy_slab128.dds\",\"gta3.img/airport_las.txd/fancy_slab128.dds\",\n \"gta3.img/vgnshambild1.txd/fancy_slab128.dds\",\"gta3.img/airport_las.txd/fancy_slab128.dds\",\n \"gta3.img/vgnvrock.txd/fancy_slab128.dds\",\"gta3.img/airport_las.txd/fancy_slab128.dds\",\n \"gta3.img/vgsnbuild07.txd/fancy_slab128.dds\",\"gta3.img/airport_las.txd/fancy_slab128.dds\",\n \"gta3.img/airprtrunway_las.txd/grass_128hv.dds\",\"gta3.img/airport_las.txd/grass_128hv.dds\",\n \"gta3.img/ballys02.txd/grass_128hv.dds\",\"gta3.img/airport_las.txd/grass_128hv.dds\",\n \"gta3.img/baseballground_sfs.txd/grass_128hv.dds\",\"gta3.img/airport_las.txd/grass_128hv.dds\",\n \"gta3.img/beachbx_sfw.txd/grass_128hv.dds\",\"gta3.img/airport_las.txd/grass_128hv.dds\",\n \"gta3.img/beach_sfs.txd/grass_128hv.dds\",\"gta3.img/airport_las.txd/grass_128hv.dds\",\n \"gta3.img/bevcunto2_lahills.txd/grass_128hv.dds\",\"gta3.img/airport_las.txd/grass_128hv.dds\",\n \"gta3.img/boigas_sfw.txd/grass_128hv.dds\",\"gta3.img/airport_las.txd/grass_128hv.dds\",\n \"gta3.img/boxybld_sfw.txd/grass_128hv.dds\",\"gta3.img/airport_las.txd/grass_128hv.dds\",\n \"gta3.img/ce_burbhouse.txd/grass_128hv.dds\",\"gta3.img/airport_las.txd/grass_128hv.dds\",\n \"gta3.img/ce_ground07.txd/grass_128hv.dds\",\"gta3.img/airport_las.txd/grass_128hv.dds\",\n \"gta3.img/cemetery_law.txd/grass_128hv.dds\",\"gta3.img/airport_las.txd/grass_128hv.dds\",\n \"gta3.img/chateau_lawn.txd/grass_128hv.dds\",\"gta3.img/airport_las.txd/grass_128hv.dds\",\n \"gta3.img/civic01_lan.txd/grass_128hv.dds\",\"gta3.img/airport_las.txd/grass_128hv.dds\",\n \"gta3.img/civic07_lan.txd/grass_128hv.dds\",\"gta3.img/airport_las.txd/grass_128hv.dds\",\n \"gta3.img/countryclbtnis_sfs.txd/grass_128hv.dds\",\"gta3.img/airport_las.txd/grass_128hv.dds\",\n \"gta3.img/cunte_house1.txd/grass_128hv.dds\",\"gta3.img/airport_las.txd/grass_128hv.dds\",\n \"gta3.img/donut_sfw.txd/grass_128hv.dds\",\"gta3.img/airport_las.txd/grass_128hv.dds\",\n \"gta3.img/filmstud.txd/grass_128hv.dds\",\"gta3.img/airport_las.txd/grass_128hv.dds\",\n \"gta3.img/freeway2_sfs.txd/grass_128hv.dds\",\"gta3.img/airport_las.txd/grass_128hv.dds\",\n \"gta3.img/freeway_las.txd/grass_128hv.dds\",\"gta3.img/airport_las.txd/grass_128hv.dds\",\n \"gta3.img/freeway_sfs.txd/grass_128hv.dds\",\"gta3.img/airport_las.txd/grass_128hv.dds\",\n \"gta3.img/golf_sfs.txd/grass_128hv.dds\",\"gta3.img/airport_las.txd/grass_128hv.dds\",\n \"gta3.img/grassybit_sfw.txd/grass_128hv.dds\",\"gta3.img/airport_las.txd/grass_128hv.dds\",\n \"gta3.img/griffobs_las.txd/grass_128hv.dds\",\"gta3.img/airport_las.txd/grass_128hv.dds\",\n \"gta3.img/hospital_lawn.txd/grass_128hv.dds\",\"gta3.img/airport_las.txd/grass_128hv.dds\",\n \"gta3.img/lahillsgrounds.txd/grass_128hv.dds\",\"gta3.img/airport_las.txd/grass_128hv.dds\",\n \"gta3.img/laland1_lan2.txd/grass_128hv.dds\",\"gta3.img/airport_las.txd/grass_128hv.dds\",\n \"gta3.img/landsfw.txd/grass_128hv.dds\",\"gta3.img/airport_las.txd/grass_128hv.dds\",\n \"gta3.img/law_beach1.txd/grass_128hv.dds\",\"gta3.img/airport_las.txd/grass_128hv.dds\",\n \"gta3.img/lawest1.txd/grass_128hv.dds\",\"gta3.img/airport_las.txd/grass_128hv.dds\",\n \"gta3.img/lawngrn.txd/grass_128hv.dds\",\"gta3.img/airport_las.txd/grass_128hv.dds\",\n \"gta3.img/lawnpark.txd/grass_128hv.dds\",\"gta3.img/airport_las.txd/grass_128hv.dds\",\n \"gta3.img/lawnstripm.txd/grass_128hv.dds\",\"gta3.img/airport_las.txd/grass_128hv.dds\",\n \"gta3.img/lawwhitebuilds.txd/grass_128hv.dds\",\"gta3.img/airport_las.txd/grass_128hv.dds\",\n \"gta3.img/levdes01_lawn.txd/grass_128hv.dds\",\"gta3.img/airport_las.txd/grass_128hv.dds\",\n \"gta3.img/lod_a_law.txd/grass_128hv.dds\",\"gta3.img/airport_las.txd/grass_128hv.dds\",\n \"gta3.img/melrose07_lawn.txd/grass_128hv.dds\",\"gta3.img/airport_las.txd/grass_128hv.dds\",\n \"gta3.img/park_sfw.txd/grass_128hv.dds\",\"gta3.img/airport_las.txd/grass_128hv.dds\",\n \"gta3.img/queensparks_sfs.txd/grass_128hv.dds\",\"gta3.img/airport_las.txd/grass_128hv.dds\",\n \"gta3.img/richman02_lahills.txd/grass_128hv.dds\",\"gta3.img/airport_las.txd/grass_128hv.dds\",\n \"gta3.img/rock_coastsfw.txd/grass_128hv.dds\",\"gta3.img/airport_las.txd/grass_128hv.dds\",\n \"gta3.img/rodeo03_law2.txd/grass_128hv.dds\",\"gta3.img/airport_las.txd/grass_128hv.dds\",\n \"gta3.img/sandy_sfw.txd/grass_128hv.dds\",\"gta3.img/airport_las.txd/grass_128hv.dds\",\n \"gta3.img/santamonicalaw2a.txd/grass_128hv.dds\",\"gta3.img/airport_las.txd/grass_128hv.dds\",\n \"gta3.img/santamonicalaw2.txd/grass_128hv.dds\",\"gta3.img/airport_las.txd/grass_128hv.dds\",\n \"gta3.img/studio01_lawn.txd/grass_128hv.dds\",\"gta3.img/airport_las.txd/grass_128hv.dds\",\n \"gta3.img/sw_poorhouse.txd/grass_128hv.dds\",\"gta3.img/airport_las.txd/grass_128hv.dds\",\n \"gta3.img/tempstuff_lae.txd/grass_128hv.dds\",\"gta3.img/airport_las.txd/grass_128hv.dds\",\n \"gta3.img/venicegb02_law.txd/grass_128hv.dds\",\"gta3.img/airport_las.txd/grass_128hv.dds\",\n \"gta3.img/vgnbball.txd/grass_128hv.dds\",\"gta3.img/airport_las.txd/grass_128hv.dds\",\n \"gta3.img/vgnretail2.txd/grass_128hv.dds\",\"gta3.img/airport_las.txd/grass_128hv.dds\",\n \"gta3.img/vgseland.txd/grass_128hv.dds\",\"gta3.img/airport_las.txd/grass_128hv.dds\",\n \"gta3.img/vgwestcoast.txd/grass_128hv.dds\",\"gta3.img/airport_las.txd/grass_128hv.dds\",\n \"gta3.img/vgwestland2.txd/grass_128hv.dds\",\"gta3.img/airport_las.txd/grass_128hv.dds\",\n \"gta3.img/vict_sfw.txd/grass_128hv.dds\",\"gta3.img/airport_las.txd/grass_128hv.dds\",\n \"gta_int.img/starps_ext.txd/grass_128hv.dds\",\"gta3.img/airport_las.txd/grass_128hv.dds\",\n \"gta3.img/capitol_lawn.txd/bow_loadingbay_door.dds\",\"gta3.img/airport_las.txd/bow_loadingbay_door.dds\",\n \"gta3.img/cewrehse.txd/bow_loadingbay_door.dds\",\"gta3.img/airport_las.txd/bow_loadingbay_door.dds\",\n \"gta3.img/civic06_lan.txd/bow_loadingbay_door.dds\",\"gta3.img/airport_las.txd/bow_loadingbay_door.dds\",\n \"gta3.img/crackfactdem_sfs.txd/bow_loadingbay_door.dds\",\"gta3.img/airport_las.txd/bow_loadingbay_door.dds\",\n \"gta3.img/crackfact_sfse.txd/bow_loadingbay_door.dds\",\"gta3.img/airport_las.txd/bow_loadingbay_door.dds\",\n \"gta3.img/factorynewsfse.txd/bow_loadingbay_door.dds\",\"gta3.img/airport_las.txd/bow_loadingbay_door.dds\",\n \"gta3.img/fighot.txd/bow_loadingbay_door.dds\",\"gta3.img/airport_las.txd/bow_loadingbay_door.dds\",\n \"gta3.img/ground5_las.txd/bow_loadingbay_door.dds\",\"gta3.img/airport_las.txd/bow_loadingbay_door.dds\",\n \"gta3.img/groundbit_sfs.txd/bow_loadingbay_door.dds\",\"gta3.img/airport_las.txd/bow_loadingbay_door.dds\",\n \"gta3.img/lanbloki.txd/bow_loadingbay_door.dds\",\"gta3.img/airport_las.txd/bow_loadingbay_door.dds\",\n \"gta3.img/lawnstripm.txd/bow_loadingbay_door.dds\",\"gta3.img/airport_las.txd/bow_loadingbay_door.dds\",\n \"gta3.img/newstuff_sfn.txd/bow_loadingbay_door.dds\",\"gta3.img/airport_las.txd/bow_loadingbay_door.dds\",\n \"gta3.img/shopliquor_las.txd/bow_loadingbay_door.dds\",\"gta3.img/airport_las.txd/bow_loadingbay_door.dds\",\n \"gta3.img/shutter_veg.txd/bow_loadingbay_door.dds\",\"gta3.img/airport_las.txd/bow_loadingbay_door.dds\",\n \"gta3.img/vgnretail2.txd/bow_loadingbay_door.dds\",\"gta3.img/airport_las.txd/bow_loadingbay_door.dds\",\n \"gta3.img/vgnretail4.txd/bow_loadingbay_door.dds\",\"gta3.img/airport_las.txd/bow_loadingbay_door.dds\",\n \"gta3.img/vgnretail7.txd/bow_loadingbay_door.dds\",\"gta3.img/airport_las.txd/bow_loadingbay_door.dds\",\n \"gta3.img/vgsewrehse.txd/bow_loadingbay_door.dds\",\"gta3.img/airport_las.txd/bow_loadingbay_door.dds\",\n \"gta3.img/vgslowbuild1.txd/bow_loadingbay_door.dds\",\"gta3.img/airport_las.txd/bow_loadingbay_door.dds\",\n \"gta3.img/vgsswarehse02.txd/bow_loadingbay_door.dds\",\"gta3.img/airport_las.txd/bow_loadingbay_door.dds\",\n \"gta3.img/warehus_las2.txd/bow_loadingbay_door.dds\",\"gta3.img/airport_las.txd/bow_loadingbay_door.dds\",\n \"gta3.img/w_towncs_t.txd/bow_loadingbay_door.dds\",\"gta3.img/airport_las.txd/bow_loadingbay_door.dds\",\n \"gta3.img/downtown_las.txd/laslacma6.dds\",\"gta3.img/airport_las.txd/laslacma6.dds\",\n \"gta3.img/griffobs_las.txd/sjmlahus28.dds\",\"gta3.img/airport_las.txd/sjmlahus28.dds\",\n \"gta3.img/ground4_las.txd/sjmlahus28.dds\",\"gta3.img/airport_las.txd/sjmlahus28.dds\",\n \"gta3.img/ground5_las.txd/sjmlahus28.dds\",\"gta3.img/airport_las.txd/sjmlahus28.dds\",\n \"gta3.img/kbgarage_las.txd/sjmlahus28.dds\",\"gta3.img/airport_las.txd/sjmlahus28.dds\",\n \"gta3.img/lae2newtempbx.txd/sjmlahus28.dds\",\"gta3.img/airport_las.txd/sjmlahus28.dds\",\n \"gta3.img/lanbloke.txd/sjmlahus28.dds\",\"gta3.img/airport_las.txd/sjmlahus28.dds\",\n \"gta3.img/lasroads_las2.txd/sjmlahus28.dds\",\"gta3.img/airport_las.txd/sjmlahus28.dds\",\n \"gta3.img/lawnxref.txd/sjmlahus28.dds\",\"gta3.img/airport_las.txd/sjmlahus28.dds\",\n \"gta3.img/pershingsq.txd/sjmlahus28.dds\",\"gta3.img/airport_las.txd/sjmlahus28.dds\",\n \"gta3.img/santamonhus1.txd/sjmlahus28.dds\",\"gta3.img/airport_las.txd/sjmlahus28.dds\",\n \"gta3.img/santamonhus.txd/sjmlahus28.dds\",\"gta3.img/airport_las.txd/sjmlahus28.dds\",\n \"gta3.img/union_las.txd/sjmlahus28.dds\",\"gta3.img/airport_las.txd/sjmlahus28.dds\",\n \"gta3.img/casroyale.txd/carfx1.dds\",\"gta3.img/airportpillar.txd/carfx1.dds\",\n \"gta3.img/flamingo1.txd/carfx1.dds\",\"gta3.img/airportpillar.txd/carfx1.dds\",\n \"gta3.img/lwbldstuff03.txd/carfx1.dds\",\"gta3.img/airportpillar.txd/carfx1.dds\",\n \"gta3.img/tikitorch.txd/carfx1.dds\",\"gta3.img/airportpillar.txd/carfx1.dds\",\n \"gta3.img/vgncnstrct1.txd/carfx1.dds\",\"gta3.img/airportpillar.txd/carfx1.dds\",\n \"gta3.img/vgse24hr.txd/carfx1.dds\",\"gta3.img/airportpillar.txd/carfx1.dds\",\n \"gta3.img/vgseflmngonion.txd/carfx1.dds\",\"gta3.img/airportpillar.txd/carfx1.dds\",\n \"gta3.img/xrefairtree.txd/carfx1.dds\",\"gta3.img/airportpillar.txd/carfx1.dds\",\n \"gta3.img/arprtxxref_las.txd/metalic_64.dds\",\"gta3.img/airportpillar.txd/metalic_64.dds\",\n \"gta3.img/ballys01.txd/metalic_64.dds\",\"gta3.img/airportpillar.txd/metalic_64.dds\",\n \"gta3.img/ceasersign.txd/metalic_64.dds\",\"gta3.img/airportpillar.txd/metalic_64.dds\",\n \"gta3.img/chinatownsfe.txd/metalic_64.dds\",\"gta3.img/airportpillar.txd/metalic_64.dds\",\n \"gta3.img/csrsfence01.txd/metalic_64.dds\",\"gta3.img/airportpillar.txd/metalic_64.dds\",\n \"gta3.img/lachempipe.txd/metalic_64.dds\",\"gta3.img/airportpillar.txd/metalic_64.dds\",\n \"gta3.img/pyr_roof.txd/metalic_64.dds\",\"gta3.img/airportpillar.txd/metalic_64.dds\",\n \"gta3.img/tikitorch.txd/metalic_64.dds\",\"gta3.img/airportpillar.txd/metalic_64.dds\",\n \"gta3.img/vgnfremnt1.txd/metalic_64.dds\",\"gta3.img/airportpillar.txd/metalic_64.dds\",\n \"gta3.img/vgnfremntsgn.txd/metalic_64.dds\",\"gta3.img/airportpillar.txd/metalic_64.dds\",\n \"gta3.img/vgnptrlpmp.txd/metalic_64.dds\",\"gta3.img/airportpillar.txd/metalic_64.dds\",\n \"gta3.img/vgssairport.txd/metalic_64.dds\",\"gta3.img/airportpillar.txd/metalic_64.dds\",\n \"gta3.img/vgssstairs1.txd/metalic_64.dds\",\"gta3.img/airportpillar.txd/metalic_64.dds\",\n \"gta3.img/xrefairtree.txd/metalic_64.dds\",\"gta3.img/airportpillar.txd/metalic_64.dds\",\n \"gta_int.img/gen_offtrackint.txd/metalic_64.dds\",\"gta3.img/airportpillar.txd/metalic_64.dds\",\n \"gta_int.img/lee_studhall.txd/metalic_64.dds\",\"gta3.img/airportpillar.txd/metalic_64.dds\",\n \"gta_int.img/sweetsmain.txd/metalic_64.dds\",\"gta3.img/airportpillar.txd/metalic_64.dds\",\n \"gta3.img/vgssairport02.txd/ws_airportwall2.dds\",\"gta3.img/airportrminl_sfse.txd/ws_airportwall2.dds\",\n \"gta3.img/vgssairport.txd/ws_airportwall2.dds\",\"gta3.img/airportrminl_sfse.txd/ws_airportwall2.dds\",\n \"gta3.img/vgsswarehse02.txd/ws_airportwall2.dds\",\"gta3.img/airportrminl_sfse.txd/ws_airportwall2.dds\",\n \"gta3.img/vgssairport.txd/ws_airportwall1.dds\",\"gta3.img/airportrminl_sfse.txd/ws_airportwall1.dds\",\n \"gta3.img/airportroads_sfse.txd/ws_rotten_concrete1.dds\",\"gta3.img/airportrminl_sfse.txd/ws_rotten_concrete1.dds\",\n \"gta3.img/backroad_sfs.txd/ws_rotten_concrete1.dds\",\"gta3.img/airportrminl_sfse.txd/ws_rotten_concrete1.dds\",\n \"gta3.img/bakerybit2_sfse.txd/ws_rotten_concrete1.dds\",\"gta3.img/airportrminl_sfse.txd/ws_rotten_concrete1.dds\",\n \"gta3.img/bakerybit_sfse.txd/ws_rotten_concrete1.dds\",\"gta3.img/airportrminl_sfse.txd/ws_rotten_concrete1.dds\",\n \"gta3.img/bakery_sfse.txd/ws_rotten_concrete1.dds\",\"gta3.img/airportrminl_sfse.txd/ws_rotten_concrete1.dds\",\n \"gta3.img/burgalrystore_sfse.txd/ws_rotten_concrete1.dds\",\"gta3.img/airportrminl_sfse.txd/ws_rotten_concrete1.dds\",\n \"gta3.img/carshow_sfse.txd/ws_rotten_concrete1.dds\",\"gta3.img/airportrminl_sfse.txd/ws_rotten_concrete1.dds\",\n \"gta3.img/cluckbell_sfs.txd/ws_rotten_concrete1.dds\",\"gta3.img/airportrminl_sfse.txd/ws_rotten_concrete1.dds\",\n \"gta3.img/crackfactdem_sfs.txd/ws_rotten_concrete1.dds\",\"gta3.img/airportrminl_sfse.txd/ws_rotten_concrete1.dds\",\n \"gta3.img/crackfact_sfse.txd/ws_rotten_concrete1.dds\",\"gta3.img/airportrminl_sfse.txd/ws_rotten_concrete1.dds\",\n \"gta3.img/crack_intkb.txd/ws_rotten_concrete1.dds\",\"gta3.img/airportrminl_sfse.txd/ws_rotten_concrete1.dds\",\n \"gta3.img/freeways3_sfse.txd/ws_rotten_concrete1.dds\",\"gta3.img/airportrminl_sfse.txd/ws_rotten_concrete1.dds\",\n \"gta3.img/freeways_sfse.txd/ws_rotten_concrete1.dds\",\"gta3.img/airportrminl_sfse.txd/ws_rotten_concrete1.dds\",\n \"gta3.img/groundbit_sfse.txd/ws_rotten_concrete1.dds\",\"gta3.img/airportrminl_sfse.txd/ws_rotten_concrete1.dds\",\n \"gta3.img/groundbit_sfs.txd/ws_rotten_concrete1.dds\",\"gta3.img/airportrminl_sfse.txd/ws_rotten_concrete1.dds\",\n \"gta3.img/hrbr_sfn.txd/ws_rotten_concrete1.dds\",\"gta3.img/airportrminl_sfse.txd/ws_rotten_concrete1.dds\",\n \"gta3.img/mission2_sfse.txd/ws_rotten_concrete1.dds\",\"gta3.img/airportrminl_sfse.txd/ws_rotten_concrete1.dds\",\n \"gta3.img/oldgarage_sfse.txd/ws_rotten_concrete1.dds\",\"gta3.img/airportrminl_sfse.txd/ws_rotten_concrete1.dds\",\n \"gta3.img/railbridge_sfse.txd/ws_rotten_concrete1.dds\",\"gta3.img/airportrminl_sfse.txd/ws_rotten_concrete1.dds\",\n \"gta3.img/sfn_sfn.txd/ws_rotten_concrete1.dds\",\"gta3.img/airportrminl_sfse.txd/ws_rotten_concrete1.dds\",\n \"gta3.img/shops2extra_sfse.txd/ws_rotten_concrete1.dds\",\"gta3.img/airportrminl_sfse.txd/ws_rotten_concrete1.dds\",\n \"gta3.img/skyscrap_sfse.txd/ws_rotten_concrete1.dds\",\"gta3.img/airportrminl_sfse.txd/ws_rotten_concrete1.dds\",\n \"gta3.img/stadjunct_sfse.txd/ws_rotten_concrete1.dds\",\"gta3.img/airportrminl_sfse.txd/ws_rotten_concrete1.dds\",\n \"gta3.img/subshops_sfs.txd/ws_rotten_concrete1.dds\",\"gta3.img/airportrminl_sfse.txd/ws_rotten_concrete1.dds\",\n \"gta_int.img/cj_statue_1.txd/ws_rotten_concrete1.dds\",\"gta3.img/airportrminl_sfse.txd/ws_rotten_concrete1.dds\",\n \"gta3.img/vgssairport.txd/ws_airportwin3.dds\",\"gta3.img/airportrminl_sfse.txd/ws_airportwin3.dds\",\n \"gta3.img/depot_sfse.txd/ws_airportwin2.dds\",\"gta3.img/airportrminl_sfse.txd/ws_airportwin2.dds\",\n \"gta3.img/hillhousex_la1_2.txd/ws_airportwin2.dds\",\"gta3.img/airportrminl_sfse.txd/ws_airportwin2.dds\",\n \"gta3.img/lasxrefdock.txd/ws_airportwin2.dds\",\"gta3.img/airportrminl_sfse.txd/ws_airportwin2.dds\",\n \"gta3.img/silicon2_sfse.txd/ws_airportwin2.dds\",\"gta3.img/airportrminl_sfse.txd/ws_airportwin2.dds\",\n \"gta3.img/silicon_sfxrf.txd/ws_airportwin2.dds\",\"gta3.img/airportrminl_sfse.txd/ws_airportwin2.dds\",\n \"gta3.img/skyscrapper_sfs.txd/ws_airportwin2.dds\",\"gta3.img/airportrminl_sfse.txd/ws_airportwin2.dds\",\n \"gta3.img/skyscrap_sfse.txd/ws_airportwin2.dds\",\"gta3.img/airportrminl_sfse.txd/ws_airportwin2.dds\",\n \"gta3.img/subshops_sfs.txd/ws_airportwin2.dds\",\"gta3.img/airportrminl_sfse.txd/ws_airportwin2.dds\",\n \"gta3.img/sunset02_law2.txd/ws_airportwin2.dds\",\"gta3.img/airportrminl_sfse.txd/ws_airportwin2.dds\",\n \"gta3.img/dockroad_sfse.txd/sf_junction5.dds\",\"gta3.img/airportroads_sfse.txd/sf_junction5.dds\",\n \"gta3.img/fosterroads_sfse.txd/sf_junction5.dds\",\"gta3.img/airportroads_sfse.txd/sf_junction5.dds\",\n \"gta3.img/genroads_sfse.txd/sf_junction5.dds\",\"gta3.img/airportroads_sfse.txd/sf_junction5.dds\",\n \"gta3.img/navyroad_sfse.txd/sf_junction5.dds\",\"gta3.img/airportroads_sfse.txd/sf_junction5.dds\",\n \"gta3.img/road2sfe.txd/sf_junction5.dds\",\"gta3.img/airportroads_sfse.txd/sf_junction5.dds\",\n \"gta3.img/roadsanfranse.txd/sf_junction5.dds\",\"gta3.img/airportroads_sfse.txd/sf_junction5.dds\",\n \"gta3.img/roadsfe.txd/sf_junction5.dds\",\"gta3.img/airportroads_sfse.txd/sf_junction5.dds\",\n \"gta3.img/sfsroads.txd/sf_junction5.dds\",\"gta3.img/airportroads_sfse.txd/sf_junction5.dds\",\n \"gta3.img/smallertxd.txd/sf_junction5.dds\",\"gta3.img/airportroads_sfse.txd/sf_junction5.dds\",\n \"gta3.img/apsecurity_sfxrf.txd/ws_white_wall1.dds\",\"gta3.img/airportroads_sfse.txd/ws_white_wall1.dds\",\n \"gta3.img/carshow_sfse.txd/ws_white_wall1.dds\",\"gta3.img/airportroads_sfse.txd/ws_white_wall1.dds\",\n \"gta3.img/casnorylgrnd.txd/ws_white_wall1.dds\",\"gta3.img/airportroads_sfse.txd/ws_white_wall1.dds\",\n \"gta3.img/ce_farmxref.txd/ws_white_wall1.dds\",\"gta3.img/airportroads_sfse.txd/ws_white_wall1.dds\",\n \"gta3.img/cuntwf.txd/ws_white_wall1.dds\",\"gta3.img/airportroads_sfse.txd/ws_white_wall1.dds\",\n \"gta3.img/eastbeach4a_lae2.txd/ws_white_wall1.dds\",\"gta3.img/airportroads_sfse.txd/ws_white_wall1.dds\",\n \"gta3.img/eastbeach7_lae2.txd/ws_white_wall1.dds\",\"gta3.img/airportroads_sfse.txd/ws_white_wall1.dds\",\n \"gta3.img/ganton01_lae2.txd/ws_white_wall1.dds\",\"gta3.img/airportroads_sfse.txd/ws_white_wall1.dds\",\n \"gta3.img/lahillshilhs1c.txd/ws_white_wall1.dds\",\"gta3.img/airportroads_sfse.txd/ws_white_wall1.dds\",\n \"gta3.img/sfsroadshotel.txd/ws_white_wall1.dds\",\"gta3.img/airportroads_sfse.txd/ws_white_wall1.dds\",\n \"gta3.img/skyscrapelawn.txd/ws_white_wall1.dds\",\"gta3.img/airportroads_sfse.txd/ws_white_wall1.dds\",\n \"gta3.img/subshops_sfs.txd/ws_white_wall1.dds\",\"gta3.img/airportroads_sfse.txd/ws_white_wall1.dds\",\n \"gta3.img/sw_block10.txd/ws_white_wall1.dds\",\"gta3.img/airportroads_sfse.txd/ws_white_wall1.dds\",\n \"gta3.img/tvtower_sfs.txd/ws_white_wall1.dds\",\"gta3.img/airportroads_sfse.txd/ws_white_wall1.dds\",\n \"gta3.img/vgnboiga1.txd/ws_white_wall1.dds\",\"gta3.img/airportroads_sfse.txd/ws_white_wall1.dds\",\n \"gta3.img/vgnptrlpmp.txd/ws_white_wall1.dds\",\"gta3.img/airportroads_sfse.txd/ws_white_wall1.dds\",\n \"gta3.img/vgnretail72.txd/ws_white_wall1.dds\",\"gta3.img/airportroads_sfse.txd/ws_white_wall1.dds\",\n \"gta3.img/vgslowbuild.txd/ws_white_wall1.dds\",\"gta3.img/airportroads_sfse.txd/ws_white_wall1.dds\",\n \"gta3.img/vgssairport02.txd/ws_white_wall1.dds\",\"gta3.img/airportroads_sfse.txd/ws_white_wall1.dds\",\n \"gta3.img/xenon_sfse.txd/ws_white_wall1.dds\",\"gta3.img/airportroads_sfse.txd/ws_white_wall1.dds\",\n \"gta3.img/beach_las.txd/stones256128.dds\",\"gta3.img/airportroads_sfse.txd/stones256128.dds\",\n \"gta3.img/centralresac1.txd/stones256128.dds\",\"gta3.img/airportroads_sfse.txd/stones256128.dds\",\n \"gta3.img/gazlaw2.txd/stones256128.dds\",\"gta3.img/airportroads_sfse.txd/stones256128.dds\",\n \"gta3.img/glenpark1x_lae.txd/stones256128.dds\",\"gta3.img/airportroads_sfse.txd/stones256128.dds\",\n \"gta3.img/idlewood46_lae.txd/stones256128.dds\",\"gta3.img/airportroads_sfse.txd/stones256128.dds\",\n \"gta3.img/laeroads.txd/stones256128.dds\",\"gta3.img/airportroads_sfse.txd/stones256128.dds\",\n \"gta3.img/vegascourtbld.txd/stones256128.dds\",\"gta3.img/airportroads_sfse.txd/stones256128.dds\",\n \"gta3.img/vgndwntwn22.txd/stones256128.dds\",\"gta3.img/airportroads_sfse.txd/stones256128.dds\",\n \"gta3.img/vgnptrlpmp.txd/stones256128.dds\",\"gta3.img/airportroads_sfse.txd/stones256128.dds\",\n \"gta3.img/vgnretail5.txd/stones256128.dds\",\"gta3.img/airportroads_sfse.txd/stones256128.dds\",\n \"gta3.img/vgslowbuild.txd/stones256128.dds\",\"gta3.img/airportroads_sfse.txd/stones256128.dds\",\n \"gta3.img/cunteroads1.txd/dt_road_stoplinea.dds\",\"gta3.img/airportroads_sfse.txd/dt_road_stoplinea.dds\",\n \"gta3.img/cunteroads2.txd/dt_road_stoplinea.dds\",\"gta3.img/airportroads_sfse.txd/dt_road_stoplinea.dds\",\n \"gta3.img/cunteroads5.txd/dt_road_stoplinea.dds\",\"gta3.img/airportroads_sfse.txd/dt_road_stoplinea.dds\",\n \"gta3.img/lae2roadshub.txd/dt_road_stoplinea.dds\",\"gta3.img/airportroads_sfse.txd/dt_road_stoplinea.dds\",\n \"gta3.img/lae2roads.txd/dt_road_stoplinea.dds\",\"gta3.img/airportroads_sfse.txd/dt_road_stoplinea.dds\",\n \"gta3.img/roads_lahills.txd/dt_road_stoplinea.dds\",\"gta3.img/airportroads_sfse.txd/dt_road_stoplinea.dds\",\n \"gta3.img/roads_lawn.txd/dt_road_stoplinea.dds\",\"gta3.img/airportroads_sfse.txd/dt_road_stoplinea.dds\",\n \"gta3.img/roads_sfs.txd/dt_road_stoplinea.dds\",\"gta3.img/airportroads_sfse.txd/dt_road_stoplinea.dds\",\n \"gta3.img/vgnground.txd/dt_road_stoplinea.dds\",\"gta3.img/airportroads_sfse.txd/dt_road_stoplinea.dds\",\n \"gta3.img/vgsehighways.txd/dt_road_stoplinea.dds\",\"gta3.img/airportroads_sfse.txd/dt_road_stoplinea.dds\",\n \"gta3.img/vgseroads.txd/dt_road_stoplinea.dds\",\"gta3.img/airportroads_sfse.txd/dt_road_stoplinea.dds\",\n \"gta3.img/vgsnhighway.txd/dt_road_stoplinea.dds\",\"gta3.img/airportroads_sfse.txd/dt_road_stoplinea.dds\",\n \"gta3.img/vgsshiways.txd/dt_road_stoplinea.dds\",\"gta3.img/airportroads_sfse.txd/dt_road_stoplinea.dds\",\n \"gta3.img/vgssroads.txd/dt_road_stoplinea.dds\",\"gta3.img/airportroads_sfse.txd/dt_road_stoplinea.dds\",\n \"gta3.img/vgwsthiway1.txd/dt_road_stoplinea.dds\",\"gta3.img/airportroads_sfse.txd/dt_road_stoplinea.dds\",\n \"gta3.img/backroad_sfs.txd/sf_pave6.dds\",\"gta3.img/airportroads_sfse.txd/sf_pave6.dds\",\n \"gta3.img/bendytunnel_sfse.txd/sf_pave6.dds\",\"gta3.img/airportroads_sfse.txd/sf_pave6.dds\",\n \"gta3.img/carparkssfn.txd/sf_pave6.dds\",\"gta3.img/airportroads_sfse.txd/sf_pave6.dds\",\n \"gta3.img/carshow_sfse.txd/sf_pave6.dds\",\"gta3.img/airportroads_sfse.txd/sf_pave6.dds\",\n \"gta3.img/countryclbtnis_sfs.txd/sf_pave6.dds\",\"gta3.img/airportroads_sfse.txd/sf_pave6.dds\",\n \"gta3.img/dockroad_sfse.txd/sf_pave6.dds\",\"gta3.img/airportroads_sfse.txd/sf_pave6.dds\",\n \"gta3.img/drivingschool_sfse.txd/sf_pave6.dds\",\"gta3.img/airportroads_sfse.txd/sf_pave6.dds\",\n \"gta3.img/fedmint_sfs.txd/sf_pave6.dds\",\"gta3.img/airportroads_sfse.txd/sf_pave6.dds\",\n \"gta3.img/genroads_sfse.txd/sf_pave6.dds\",\"gta3.img/airportroads_sfse.txd/sf_pave6.dds\",\n \"gta3.img/ggatepark.txd/sf_pave6.dds\",\"gta3.img/airportroads_sfse.txd/sf_pave6.dds\",\n \"gta3.img/ggbridge_sfn.txd/sf_pave6.dds\",\"gta3.img/airportroads_sfse.txd/sf_pave6.dds\",\n \"gta3.img/goldengate_sfw.txd/sf_pave6.dds\",\"gta3.img/airportroads_sfse.txd/sf_pave6.dds\",\n \"gta3.img/highway_sfn.txd/sf_pave6.dds\",\"gta3.img/airportroads_sfse.txd/sf_pave6.dds\",\n \"gta3.img/hotelback_sfs.txd/sf_pave6.dds\",\"gta3.img/airportroads_sfse.txd/sf_pave6.dds\",\n \"gta3.img/landsfw.txd/sf_pave6.dds\",\"gta3.img/airportroads_sfse.txd/sf_pave6.dds\",\n \"gta3.img/mountainsfs.txd/sf_pave6.dds\",\"gta3.img/airportroads_sfse.txd/sf_pave6.dds\",\n \"gta3.img/navyroad_sfse.txd/sf_pave6.dds\",\"gta3.img/airportroads_sfse.txd/sf_pave6.dds\",\n \"gta3.img/newstuff_sfn.txd/sf_pave6.dds\",\"gta3.img/airportroads_sfse.txd/sf_pave6.dds\",\n \"gta3.img/parktunnel_sfs.txd/sf_pave6.dds\",\"gta3.img/airportroads_sfse.txd/sf_pave6.dds\",\n \"gta3.img/pinkcarpark_sfs.txd/sf_pave6.dds\",\"gta3.img/airportroads_sfse.txd/sf_pave6.dds\",\n \"gta3.img/road2sfe.txd/sf_pave6.dds\",\"gta3.img/airportroads_sfse.txd/sf_pave6.dds\",\n \"gta3.img/roadsanfranse.txd/sf_pave6.dds\",\"gta3.img/airportroads_sfse.txd/sf_pave6.dds\",\n \"gta3.img/roadsfe.txd/sf_pave6.dds\",\"gta3.img/airportroads_sfse.txd/sf_pave6.dds\",\n \"gta3.img/sfn_roadssfn.txd/sf_pave6.dds\",\"gta3.img/airportroads_sfse.txd/sf_pave6.dds\",\n \"gta3.img/sfn_sfn.txd/sf_pave6.dds\",\"gta3.img/airportroads_sfse.txd/sf_pave6.dds\",\n \"gta3.img/sfsroadshotel.txd/sf_pave6.dds\",\"gta3.img/airportroads_sfse.txd/sf_pave6.dds\",\n \"gta3.img/sfsroads.txd/sf_pave6.dds\",\"gta3.img/airportroads_sfse.txd/sf_pave6.dds\",\n \"gta3.img/stadjunct_sfse.txd/sf_pave6.dds\",\"gta3.img/airportroads_sfse.txd/sf_pave6.dds\",\n \"gta3.img/tunnel_sfe.txd/sf_pave6.dds\",\"gta3.img/airportroads_sfse.txd/sf_pave6.dds\",\n \"gta3.img/backroad_sfs.txd/sf_road5.dds\",\"gta3.img/airportroads_sfse.txd/sf_road5.dds\",\n \"gta3.img/bendytunnel_sfse.txd/sf_road5.dds\",\"gta3.img/airportroads_sfse.txd/sf_road5.dds\",\n \"gta3.img/carshow_sfse.txd/sf_road5.dds\",\"gta3.img/airportroads_sfse.txd/sf_road5.dds\",\n \"gta3.img/dockroad_sfse.txd/sf_road5.dds\",\"gta3.img/airportroads_sfse.txd/sf_road5.dds\",\n \"gta3.img/fosterroads_sfse.txd/sf_road5.dds\",\"gta3.img/airportroads_sfse.txd/sf_road5.dds\",\n \"gta3.img/freeways_sfse.txd/sf_road5.dds\",\"gta3.img/airportroads_sfse.txd/sf_road5.dds\",\n \"gta3.img/genroads_sfse.txd/sf_road5.dds\",\"gta3.img/airportroads_sfse.txd/sf_road5.dds\",\n \"gta3.img/ggbridge_sfn.txd/sf_road5.dds\",\"gta3.img/airportroads_sfse.txd/sf_road5.dds\",\n \"gta3.img/goldengate_sfw.txd/sf_road5.dds\",\"gta3.img/airportroads_sfse.txd/sf_road5.dds\",\n \"gta3.img/highway_sfn.txd/sf_road5.dds\",\"gta3.img/airportroads_sfse.txd/sf_road5.dds\",\n \"gta3.img/hotelback_sfs.txd/sf_road5.dds\",\"gta3.img/airportroads_sfse.txd/sf_road5.dds\",\n \"gta3.img/navyroad_sfse.txd/sf_road5.dds\",\"gta3.img/airportroads_sfse.txd/sf_road5.dds\",\n \"gta3.img/pinkcarpark_sfs.txd/sf_road5.dds\",\"gta3.img/airportroads_sfse.txd/sf_road5.dds\",\n \"gta3.img/road2sfe.txd/sf_road5.dds\",\"gta3.img/airportroads_sfse.txd/sf_road5.dds\",\n \"gta3.img/roadsanfranse.txd/sf_road5.dds\",\"gta3.img/airportroads_sfse.txd/sf_road5.dds\",\n \"gta3.img/roadsfe.txd/sf_road5.dds\",\"gta3.img/airportroads_sfse.txd/sf_road5.dds\",\n \"gta3.img/sfn_roadssfn.txd/sf_road5.dds\",\"gta3.img/airportroads_sfse.txd/sf_road5.dds\",\n \"gta3.img/sfn_sfn.txd/sf_road5.dds\",\"gta3.img/airportroads_sfse.txd/sf_road5.dds\",\n \"gta3.img/sfsroads.txd/sf_road5.dds\",\"gta3.img/airportroads_sfse.txd/sf_road5.dds\",\n \"gta3.img/stadiumground_sfse.txd/sf_road5.dds\",\"gta3.img/airportroads_sfse.txd/sf_road5.dds\",\n \"gta3.img/stadjunct_sfse.txd/sf_road5.dds\",\"gta3.img/airportroads_sfse.txd/sf_road5.dds\",\n \"gta3.img/tunnel_sfe.txd/sf_road5.dds\",\"gta3.img/airportroads_sfse.txd/sf_road5.dds\",\n \"gta3.img/vgssairport02.txd/ws_guardhousedoor.dds\",\"gta3.img/airprtrunway_las.txd/ws_guardhousedoor.dds\",\n \"gta3.img/vgssairport02.txd/policeha02black_128.dds\",\"gta3.img/airprtrunway_las.txd/policeha02black_128.dds\",\n \"gta3.img/apsecurity_sfse.txd/gen_meshfencing.dds\",\"gta3.img/airprtrunway_las.txd/gen_meshfencing.dds\",\n \"gta3.img/break_fen_mesh2.txd/gen_meshfencing.dds\",\"gta3.img/airprtrunway_las.txd/gen_meshfencing.dds\",\n \"gta3.img/break_fen_mesh.txd/gen_meshfencing.dds\",\"gta3.img/airprtrunway_las.txd/gen_meshfencing.dds\",\n \"gta3.img/break_f_mesh.txd/gen_meshfencing.dds\",\"gta3.img/airprtrunway_las.txd/gen_meshfencing.dds\",\n \"gta3.img/cj_street_props.txd/gen_meshfencing.dds\",\"gta3.img/airprtrunway_las.txd/gen_meshfencing.dds\",\n \"gta3.img/country_breakable.txd/gen_meshfencing.dds\",\"gta3.img/airprtrunway_las.txd/gen_meshfencing.dds\",\n \"gta3.img/crates_n_stuffext.txd/gen_meshfencing.dds\",\"gta3.img/airprtrunway_las.txd/gen_meshfencing.dds\",\n \"gta3.img/exitfence_sfse.txd/gen_meshfencing.dds\",\"gta3.img/airprtrunway_las.txd/gen_meshfencing.dds\",\n \"gta3.img/ext_doors2.txd/gen_meshfencing.dds\",\"gta3.img/airprtrunway_las.txd/gen_meshfencing.dds\",\n \"gta3.img/externalext.txd/gen_meshfencing.dds\",\"gta3.img/airprtrunway_las.txd/gen_meshfencing.dds\",\n \"gta3.img/gategen.txd/gen_meshfencing.dds\",\"gta3.img/airprtrunway_las.txd/gen_meshfencing.dds\",\n \"gta3.img/junkpiles.txd/gen_meshfencing.dds\",\"gta3.img/airprtrunway_las.txd/gen_meshfencing.dds\",\n \"gta3.img/vegaswrehse1.txd/gen_meshfencing.dds\",\"gta3.img/airprtrunway_las.txd/gen_meshfencing.dds\",\n \"gta3.img/vgnpwrwhse.txd/gen_meshfencing.dds\",\"gta3.img/airprtrunway_las.txd/gen_meshfencing.dds\",\n \"gta3.img/vgssmulticarprk.txd/gen_meshfencing.dds\",\"gta3.img/airprtrunway_las.txd/gen_meshfencing.dds\",\n \"gta3.img/ws_apgatex.txd/gen_meshfencing.dds\",\"gta3.img/airprtrunway_las.txd/gen_meshfencing.dds\",\n \"gta_int.img/mafcasgenstuff.txd/gen_meshfencing.dds\",\"gta3.img/airprtrunway_las.txd/gen_meshfencing.dds\",\n \"gta3.img/billbrd01_lan2.txd/bobo_2.dds\",\"gta3.img/airprtrunway_las.txd/bobo_2.dds\",\n \"gta3.img/ground3_las.txd/bobo_2.dds\",\"gta3.img/airprtrunway_las.txd/bobo_2.dds\",\n \"gta3.img/stadjunct_sfse.txd/bobo_2.dds\",\"gta3.img/airprtrunway_las.txd/bobo_2.dds\",\n \"gta3.img/apsecurity_sfse.txd/cj_sheetmetal.dds\",\"gta3.img/airprtrunway_las.txd/cj_sheetmetal.dds\",\n \"gta3.img/break_fen_mesh2.txd/cj_sheetmetal.dds\",\"gta3.img/airprtrunway_las.txd/cj_sheetmetal.dds\",\n \"gta3.img/break_fen_mesh.txd/cj_sheetmetal.dds\",\"gta3.img/airprtrunway_las.txd/cj_sheetmetal.dds\",\n \"gta3.img/break_f_mesh.txd/cj_sheetmetal.dds\",\"gta3.img/airprtrunway_las.txd/cj_sheetmetal.dds\",\n \"gta3.img/break_garden.txd/cj_sheetmetal.dds\",\"gta3.img/airprtrunway_las.txd/cj_sheetmetal.dds\",\n \"gta3.img/break_s_bins.txd/cj_sheetmetal.dds\",\"gta3.img/airprtrunway_las.txd/cj_sheetmetal.dds\",\n \"gta3.img/break_s_fillers.txd/cj_sheetmetal.dds\",\"gta3.img/airprtrunway_las.txd/cj_sheetmetal.dds\",\n \"gta3.img/break_s_sf.txd/cj_sheetmetal.dds\",\"gta3.img/airprtrunway_las.txd/cj_sheetmetal.dds\",\n \"gta3.img/break_street2.txd/cj_sheetmetal.dds\",\"gta3.img/airprtrunway_las.txd/cj_sheetmetal.dds\",\n \"gta3.img/cj_bins2.txd/cj_sheetmetal.dds\",\"gta3.img/airprtrunway_las.txd/cj_sheetmetal.dds\",\n \"gta3.img/dsfs.txd/cj_sheetmetal.dds\",\"gta3.img/airprtrunway_las.txd/cj_sheetmetal.dds\",\n \"gta3.img/dyn_objects.txd/cj_sheetmetal.dds\",\"gta3.img/airprtrunway_las.txd/cj_sheetmetal.dds\",\n \"gta3.img/exitfence_sfse.txd/cj_sheetmetal.dds\",\"gta3.img/airprtrunway_las.txd/cj_sheetmetal.dds\",\n \"gta3.img/industrialext.txd/cj_sheetmetal.dds\",\"gta3.img/airprtrunway_las.txd/cj_sheetmetal.dds\",\n \"gta3.img/junkpiles.txd/cj_sheetmetal.dds\",\"gta3.img/airprtrunway_las.txd/cj_sheetmetal.dds\",\n \"gta3.img/pedalsx.txd/cj_sheetmetal.dds\",\"gta3.img/airprtrunway_las.txd/cj_sheetmetal.dds\",\n \"gta3.img/vgssmulticarprk.txd/cj_sheetmetal.dds\",\"gta3.img/airprtrunway_las.txd/cj_sheetmetal.dds\",\n \"gta3.img/vgssroads.txd/cj_sheetmetal.dds\",\"gta3.img/airprtrunway_las.txd/cj_sheetmetal.dds\",\n \"gta3.img/ws_apgatex.txd/cj_sheetmetal.dds\",\"gta3.img/airprtrunway_las.txd/cj_sheetmetal.dds\",\n \"gta_int.img/ab_abbatoir01.txd/cj_sheetmetal.dds\",\"gta3.img/airprtrunway_las.txd/cj_sheetmetal.dds\",\n \"gta_int.img/cj_chris.txd/cj_sheetmetal.dds\",\"gta3.img/airprtrunway_las.txd/cj_sheetmetal.dds\",\n \"gta_int.img/cj_coin_op_2.txd/cj_sheetmetal.dds\",\"gta3.img/airprtrunway_las.txd/cj_sheetmetal.dds\",\n \"gta_int.img/cj_kitchen.txd/cj_sheetmetal.dds\",\"gta3.img/airprtrunway_las.txd/cj_sheetmetal.dds\",\n \"gta_int.img/cj_tv_stand.txd/cj_sheetmetal.dds\",\"gta3.img/airprtrunway_las.txd/cj_sheetmetal.dds\",\n \"gta_int.img/cj_tv.txd/cj_sheetmetal.dds\",\"gta3.img/airprtrunway_las.txd/cj_sheetmetal.dds\",\n \"gta_int.img/cj_urb.txd/cj_sheetmetal.dds\",\"gta3.img/airprtrunway_las.txd/cj_sheetmetal.dds\",\n \"gta_int.img/cj_vic.txd/cj_sheetmetal.dds\",\"gta3.img/airprtrunway_las.txd/cj_sheetmetal.dds\",\n \"gta_int.img/genintint711_1.txd/cj_sheetmetal.dds\",\"gta3.img/airprtrunway_las.txd/cj_sheetmetal.dds\",\n \"gta_int.img/genintintbarb.txd/cj_sheetmetal.dds\",\"gta3.img/airprtrunway_las.txd/cj_sheetmetal.dds\",\n \"gta_int.img/genintint_gym.txd/cj_sheetmetal.dds\",\"gta3.img/airprtrunway_las.txd/cj_sheetmetal.dds\",\n \"gta_int.img/maint3.txd/cj_sheetmetal.dds\",\"gta3.img/airprtrunway_las.txd/cj_sheetmetal.dds\",\n \"gta_int.img/police_props.txd/cj_sheetmetal.dds\",\"gta3.img/airprtrunway_las.txd/cj_sheetmetal.dds\",\n \"gta_int.img/ryfurn2.txd/cj_sheetmetal.dds\",\"gta3.img/airprtrunway_las.txd/cj_sheetmetal.dds\",\n \"gta_int.img/shopping_acc.txd/cj_sheetmetal.dds\",\"gta3.img/airprtrunway_las.txd/cj_sheetmetal.dds\",\n \"gta_int.img/shopping.txd/cj_sheetmetal.dds\",\"gta3.img/airprtrunway_las.txd/cj_sheetmetal.dds\",\n \"gta_int.img/slot_bank.txd/cj_sheetmetal.dds\",\"gta3.img/airprtrunway_las.txd/cj_sheetmetal.dds\",\n \"gta_int.img/svsfsmbits.txd/cj_sheetmetal.dds\",\"gta3.img/airprtrunway_las.txd/cj_sheetmetal.dds\",\n \"gta3.img/apsecurity_sfxrf.txd/ws_bluelino.dds\",\"gta3.img/airprtrunway_las.txd/ws_bluelino.dds\",\n \"gta3.img/vgssairport02.txd/ws_bluelino.dds\",\"gta3.img/airprtrunway_las.txd/ws_bluelino.dds\",\n \"gta3.img/chicano10_lae.txd/homies_1.dds\",\"gta3.img/airprtrunway_las.txd/homies_1.dds\",\n \"gta3.img/ground5_las.txd/homies_1.dds\",\"gta3.img/airprtrunway_las.txd/homies_1.dds\",\n \"gta3.img/idlewood6_lae.txd/homies_1.dds\",\"gta3.img/airprtrunway_las.txd/homies_1.dds\",\n \"gta3.img/vgebillboards.txd/homies_1.dds\",\"gta3.img/airprtrunway_las.txd/homies_1.dds\",\n \"gta3.img/vgsssignage04.txd/homies_1.dds\",\"gta3.img/airprtrunway_las.txd/homies_1.dds\",\n \"gta3.img/vgwstbboard.txd/homies_1.dds\",\"gta3.img/airprtrunway_las.txd/homies_1.dds\",\n \"gta3.img/capitol_lawn.txd/greyground256.dds\",\"gta3.img/airprtrunway_las.txd/greyground256.dds\",\n \"gta3.img/carpark3_lvs.txd/greyground256.dds\",\"gta3.img/airprtrunway_las.txd/greyground256.dds\",\n \"gta3.img/casnorylgrnd.txd/greyground256.dds\",\"gta3.img/airprtrunway_las.txd/greyground256.dds\",\n \"gta3.img/chinatownmall.txd/greyground256.dds\",\"gta3.img/airprtrunway_las.txd/greyground256.dds\",\n \"gta3.img/civic06_lan.txd/greyground256.dds\",\"gta3.img/airprtrunway_las.txd/greyground256.dds\",\n \"gta3.img/cuntwroad.txd/greyground256.dds\",\"gta3.img/airprtrunway_las.txd/greyground256.dds\",\n \"gta3.img/exclibrland.txd/greyground256.dds\",\"gta3.img/airprtrunway_las.txd/greyground256.dds\",\n \"gta3.img/fctrygrnd01.txd/greyground256.dds\",\"gta3.img/airprtrunway_las.txd/greyground256.dds\",\n \"gta3.img/glenpark1x_lae.txd/greyground256.dds\",\"gta3.img/airprtrunway_las.txd/greyground256.dds\",\n \"gta3.img/gnhotel1.txd/greyground256.dds\",\"gta3.img/airprtrunway_las.txd/greyground256.dds\",\n \"gta3.img/idlewood6_lae.txd/greyground256.dds\",\"gta3.img/airprtrunway_las.txd/greyground256.dds\",\n \"gta3.img/laesmokecnthus.txd/greyground256.dds\",\"gta3.img/airprtrunway_las.txd/greyground256.dds\",\n \"gta3.img/lanbloka.txd/greyground256.dds\",\"gta3.img/airprtrunway_las.txd/greyground256.dds\",\n \"gta3.img/lanblokb.txd/greyground256.dds\",\"gta3.img/airprtrunway_las.txd/greyground256.dds\",\n \"gta3.img/landcoast_lae2.txd/greyground256.dds\",\"gta3.img/airprtrunway_las.txd/greyground256.dds\",\n \"gta3.img/lanriver.txd/greyground256.dds\",\"gta3.img/airprtrunway_las.txd/greyground256.dds\",\n \"gta3.img/nucarparkwall.txd/greyground256.dds\",\"gta3.img/airprtrunway_las.txd/greyground256.dds\",\n \"gta3.img/olympic01.txd/greyground256.dds\",\"gta3.img/airprtrunway_las.txd/greyground256.dds\",\n \"gta3.img/pirateland.txd/greyground256.dds\",\"gta3.img/airprtrunway_las.txd/greyground256.dds\",\n \"gta3.img/roads_lawn.txd/greyground256.dds\",\"gta3.img/airprtrunway_las.txd/greyground256.dds\",\n \"gta3.img/stolenbuild01.txd/greyground256.dds\",\"gta3.img/airprtrunway_las.txd/greyground256.dds\",\n \"gta3.img/sw_church.txd/greyground256.dds\",\"gta3.img/airprtrunway_las.txd/greyground256.dds\",\n \"gta3.img/sw_fact01.txd/greyground256.dds\",\"gta3.img/airprtrunway_las.txd/greyground256.dds\",\n \"gta3.img/sw_library.txd/greyground256.dds\",\"gta3.img/airprtrunway_las.txd/greyground256.dds\",\n \"gta3.img/tikimotel.txd/greyground256.dds\",\"gta3.img/airprtrunway_las.txd/greyground256.dds\",\n \"gta3.img/trnstnground.txd/greyground256.dds\",\"gta3.img/airprtrunway_las.txd/greyground256.dds\",\n \"gta3.img/vegass_jetty.txd/greyground256.dds\",\"gta3.img/airprtrunway_las.txd/greyground256.dds\",\n \"gta3.img/vegassland62.txd/greyground256.dds\",\"gta3.img/airprtrunway_las.txd/greyground256.dds\",\n \"gta3.img/venice_law.txd/greyground256.dds\",\"gta3.img/airprtrunway_las.txd/greyground256.dds\",\n \"gta3.img/vgeamun.txd/greyground256.dds\",\"gta3.img/airprtrunway_las.txd/greyground256.dds\",\n \"gta3.img/vgeretl1grnd.txd/greyground256.dds\",\"gta3.img/airprtrunway_las.txd/greyground256.dds\",\n \"gta3.img/vgsbldng1.txd/greyground256.dds\",\"gta3.img/airprtrunway_las.txd/greyground256.dds\",\n \"gta3.img/vgsdwntwn2.txd/greyground256.dds\",\"gta3.img/airprtrunway_las.txd/greyground256.dds\",\n \"gta3.img/vgsebuild01.txd/greyground256.dds\",\"gta3.img/airprtrunway_las.txd/greyground256.dds\",\n \"gta3.img/vgsebuild02.txd/greyground256.dds\",\"gta3.img/airprtrunway_las.txd/greyground256.dds\",\n \"gta3.img/vgsecoast.txd/greyground256.dds\",\"gta3.img/airprtrunway_las.txd/greyground256.dds\",\n \"gta3.img/vgseland03_lvs.txd/greyground256.dds\",\"gta3.img/airprtrunway_las.txd/greyground256.dds\",\n \"gta3.img/vgseland.txd/greyground256.dds\",\"gta3.img/airprtrunway_las.txd/greyground256.dds\",\n \"gta3.img/vgsetrainstn.txd/greyground256.dds\",\"gta3.img/airprtrunway_las.txd/greyground256.dds\",\n \"gta3.img/vgsland2.txd/greyground256.dds\",\"gta3.img/airprtrunway_las.txd/greyground256.dds\",\n \"gta3.img/vgslowbuild.txd/greyground256.dds\",\"gta3.img/airprtrunway_las.txd/greyground256.dds\",\n \"gta3.img/vgsschurch.txd/greyground256.dds\",\"gta3.img/airprtrunway_las.txd/greyground256.dds\",\n \"gta3.img/vgsscollege.txd/greyground256.dds\",\"gta3.img/airprtrunway_las.txd/greyground256.dds\",\n \"gta3.img/vgsshiways.txd/greyground256.dds\",\"gta3.img/airprtrunway_las.txd/greyground256.dds\",\n \"gta3.img/vgsshospshop.txd/greyground256.dds\",\"gta3.img/airprtrunway_las.txd/greyground256.dds\",\n \"gta3.img/vgssland01.txd/greyground256.dds\",\"gta3.img/airprtrunway_las.txd/greyground256.dds\",\n \"gta3.img/vgssland02.txd/greyground256.dds\",\"gta3.img/airprtrunway_las.txd/greyground256.dds\",\n \"gta3.img/vgssland03.txd/greyground256.dds\",\"gta3.img/airprtrunway_las.txd/greyground256.dds\",\n \"gta3.img/vgssland.txd/greyground256.dds\",\"gta3.img/airprtrunway_las.txd/greyground256.dds\",\n \"gta3.img/vgssstairs1.txd/greyground256.dds\",\"gta3.img/airprtrunway_las.txd/greyground256.dds\",\n \"gta3.img/wddngchplgrnd01.txd/greyground256.dds\",\"gta3.img/airprtrunway_las.txd/greyground256.dds\",\n \"gta3.img/barrio1_lae.txd/dockwall1.dds\",\"gta3.img/airprtrunway_las.txd/dockwall1.dds\",\n \"gta3.img/conhooses.txd/dockwall1.dds\",\"gta3.img/airprtrunway_las.txd/dockwall1.dds\",\n \"gta3.img/docks_las2.txd/dockwall1.dds\",\"gta3.img/airprtrunway_las.txd/dockwall1.dds\",\n \"gta3.img/freeway2_las2.txd/dockwall1.dds\",\"gta3.img/airprtrunway_las.txd/dockwall1.dds\",\n \"gta3.img/freeway2_las.txd/dockwall1.dds\",\"gta3.img/airprtrunway_las.txd/dockwall1.dds\",\n \"gta3.img/freeway_las.txd/dockwall1.dds\",\"gta3.img/airprtrunway_las.txd/dockwall1.dds\",\n \"gta3.img/lae2newtempbx.txd/dockwall1.dds\",\"gta3.img/airprtrunway_las.txd/dockwall1.dds\",\n \"gta3.img/santamonicalaw2a.txd/dockwall1.dds\",\"gta3.img/airprtrunway_las.txd/dockwall1.dds\",\n \"gta3.img/warehus_las2.txd/dockwall1.dds\",\"gta3.img/airprtrunway_las.txd/dockwall1.dds\",\n \"gta3.img/cunteroads1.txd/desbarlas.dds\",\"gta3.img/airprtrunway_las.txd/desbarlas.dds\",\n \"gta3.img/cunteroads6.txd/desbarlas.dds\",\"gta3.img/airprtrunway_las.txd/desbarlas.dds\",\n \"gta3.img/cunte_wires.txd/desbarlas.dds\",\"gta3.img/airprtrunway_las.txd/desbarlas.dds\",\n \"gta3.img/cuntwlandse.txd/desbarlas.dds\",\"gta3.img/airprtrunway_las.txd/desbarlas.dds\",\n \"gta3.img/freeway_las.txd/desbarlas.dds\",\"gta3.img/airprtrunway_las.txd/desbarlas.dds\",\n \"gta3.img/lahillslaroads.txd/desbarlas.dds\",\"gta3.img/airprtrunway_las.txd/desbarlas.dds\",\n \"gta3.img/lahillstr_lawn.txd/desbarlas.dds\",\"gta3.img/airprtrunway_las.txd/desbarlas.dds\",\n \"gta3.img/lahills_wiresnshit3.txd/desbarlas.dds\",\"gta3.img/airprtrunway_las.txd/desbarlas.dds\",\n \"gta3.img/lashops93_las2.txd/desbarlas.dds\",\"gta3.img/airprtrunway_las.txd/desbarlas.dds\",\n \"gta3.img/lasroads_las.txd/desbarlas.dds\",\"gta3.img/airprtrunway_las.txd/desbarlas.dds\",\n \"gta3.img/mtbfencecs_t.txd/desbarlas.dds\",\"gta3.img/airprtrunway_las.txd/desbarlas.dds\",\n \"gta3.img/mulveg2lahills.txd/desbarlas.dds\",\"gta3.img/airprtrunway_las.txd/desbarlas.dds\",\n \"gta3.img/wiresnshit.txd/desbarlas.dds\",\"gta3.img/airprtrunway_las.txd/desbarlas.dds\",\n \"gta3.img/coast_las2.txd/cos_hiwaymid_256.dds\",\"gta3.img/airprtrunway_las.txd/cos_hiwaymid_256.dds\",\n \"gta3.img/cunteroads3.txd/cos_hiwaymid_256.dds\",\"gta3.img/airprtrunway_las.txd/cos_hiwaymid_256.dds\",\n \"gta3.img/cunteroads4.txd/cos_hiwaymid_256.dds\",\"gta3.img/airprtrunway_las.txd/cos_hiwaymid_256.dds\",\n \"gta3.img/cunteroads5.txd/cos_hiwaymid_256.dds\",\"gta3.img/airprtrunway_las.txd/cos_hiwaymid_256.dds\",\n \"gta3.img/cunteroads6.txd/cos_hiwaymid_256.dds\",\"gta3.img/airprtrunway_las.txd/cos_hiwaymid_256.dds\",\n \"gta3.img/freeway2_las2.txd/cos_hiwaymid_256.dds\",\"gta3.img/airprtrunway_las.txd/cos_hiwaymid_256.dds\",\n \"gta3.img/freeway2_las.txd/cos_hiwaymid_256.dds\",\"gta3.img/airprtrunway_las.txd/cos_hiwaymid_256.dds\",\n \"gta3.img/freeway_las.txd/cos_hiwaymid_256.dds\",\"gta3.img/airprtrunway_las.txd/cos_hiwaymid_256.dds\",\n \"gta3.img/lae2roadscoast.txd/cos_hiwaymid_256.dds\",\"gta3.img/airprtrunway_las.txd/cos_hiwaymid_256.dds\",\n \"gta3.img/lae2roads.txd/cos_hiwaymid_256.dds\",\"gta3.img/airprtrunway_las.txd/cos_hiwaymid_256.dds\",\n \"gta3.img/laeroads.txd/cos_hiwaymid_256.dds\",\"gta3.img/airprtrunway_las.txd/cos_hiwaymid_256.dds\",\n \"gta3.img/lahillsroads6.txd/cos_hiwaymid_256.dds\",\"gta3.img/airprtrunway_las.txd/cos_hiwaymid_256.dds\",\n \"gta3.img/lahillsroadscoast.txd/cos_hiwaymid_256.dds\",\"gta3.img/airprtrunway_las.txd/cos_hiwaymid_256.dds\",\n \"gta3.img/lan2freeway.txd/cos_hiwaymid_256.dds\",\"gta3.img/airprtrunway_las.txd/cos_hiwaymid_256.dds\",\n \"gta3.img/lanroad.txd/cos_hiwaymid_256.dds\",\"gta3.img/airprtrunway_las.txd/cos_hiwaymid_256.dds\",\n \"gta3.img/beach_las2.txd/lasjmfence1.dds\",\"gta3.img/airprtrunway_las.txd/lasjmfence1.dds\",\n \"gta3.img/chemgrnd_las2.txd/lasjmfence1.dds\",\"gta3.img/airprtrunway_las.txd/lasjmfence1.dds\",\n \"gta3.img/des_dinerw.txd/lasjmfence1.dds\",\"gta3.img/airprtrunway_las.txd/lasjmfence1.dds\",\n \"gta3.img/ebeach_veg.txd/lasjmfence1.dds\",\"gta3.img/airprtrunway_las.txd/lasjmfence1.dds\",\n \"gta3.img/freeway2_las2.txd/lasjmfence1.dds\",\"gta3.img/airprtrunway_las.txd/lasjmfence1.dds\",\n \"gta3.img/freeway2_las.txd/lasjmfence1.dds\",\"gta3.img/airprtrunway_las.txd/lasjmfence1.dds\",\n \"gta3.img/freeway_las.txd/lasjmfence1.dds\",\"gta3.img/airprtrunway_las.txd/lasjmfence1.dds\",\n \"gta3.img/ground5_las.txd/lasjmfence1.dds\",\"gta3.img/airprtrunway_las.txd/lasjmfence1.dds\",\n \"gta3.img/laealpha.txd/lasjmfence1.dds\",\"gta3.img/airprtrunway_las.txd/lasjmfence1.dds\",\n \"gta3.img/lahills_wiresnshit3.txd/lasjmfence1.dds\",\"gta3.img/airprtrunway_las.txd/lasjmfence1.dds\",\n \"gta3.img/lasground_las2.txd/lasjmfence1.dds\",\"gta3.img/airprtrunway_las.txd/lasjmfence1.dds\",\n \"gta3.img/roads_tunnellahills.txd/lasjmfence1.dds\",\"gta3.img/airprtrunway_las.txd/lasjmfence1.dds\",\n \"gta3.img/stormdrain_las2.txd/lasjmfence1.dds\",\"gta3.img/airprtrunway_las.txd/lasjmfence1.dds\",\n \"gta3.img/wiresetc2_las.txd/lasjmfence1.dds\",\"gta3.img/airprtrunway_las.txd/lasjmfence1.dds\",\n \"gta3.img/wiresetc_las2.txd/lasjmfence1.dds\",\"gta3.img/airprtrunway_las.txd/lasjmfence1.dds\",\n \"gta3.img/wiresetc_las.txd/lasjmfence1.dds\",\"gta3.img/airprtrunway_las.txd/lasjmfence1.dds\",\n \"gta3.img/ground3_las.txd/mannblok2_lan.dds\",\"gta3.img/airprtrunway_las.txd/mannblok2_lan.dds\",\n \"gta3.img/wasteland_las2.txd/mannblok2_lan.dds\",\"gta3.img/airprtrunway_las.txd/mannblok2_lan.dds\",\n \"gta3.img/break_s_bins.txd/cj_lamppost1.dds\",\"gta3.img/airroadsigns_sfse.txd/cj_lamppost1.dds\",\n \"gta3.img/break_scaffold.txd/cj_lamppost1.dds\",\"gta3.img/airroadsigns_sfse.txd/cj_lamppost1.dds\",\n \"gta3.img/break_street2.txd/cj_lamppost1.dds\",\"gta3.img/airroadsigns_sfse.txd/cj_lamppost1.dds\",\n \"gta3.img/cj_bins.txd/cj_lamppost1.dds\",\"gta3.img/airroadsigns_sfse.txd/cj_lamppost1.dds\",\n \"gta3.img/cj_dfext.txd/cj_lamppost1.dds\",\"gta3.img/airroadsigns_sfse.txd/cj_lamppost1.dds\",\n \"gta3.img/cj_dyn_prop.txd/cj_lamppost1.dds\",\"gta3.img/airroadsigns_sfse.txd/cj_lamppost1.dds\",\n \"gta3.img/cj_street_props.txd/cj_lamppost1.dds\",\"gta3.img/airroadsigns_sfse.txd/cj_lamppost1.dds\",\n \"gta3.img/cj_traffic.txd/cj_lamppost1.dds\",\"gta3.img/airroadsigns_sfse.txd/cj_lamppost1.dds\",\n \"gta3.img/docklight.txd/cj_lamppost1.dds\",\"gta3.img/airroadsigns_sfse.txd/cj_lamppost1.dds\",\n \"gta3.img/dyn_objects.txd/cj_lamppost1.dds\",\"gta3.img/airroadsigns_sfse.txd/cj_lamppost1.dds\",\n \"gta3.img/externalext.txd/cj_lamppost1.dds\",\"gta3.img/airroadsigns_sfse.txd/cj_lamppost1.dds\",\n \"gta3.img/gay_xref.txd/cj_lamppost1.dds\",\"gta3.img/airroadsigns_sfse.txd/cj_lamppost1.dds\",\n \"gta3.img/hubint2.txd/cj_lamppost1.dds\",\"gta3.img/airroadsigns_sfse.txd/cj_lamppost1.dds\",\n \"gta3.img/hubprops2_sfse.txd/cj_lamppost1.dds\",\"gta3.img/airroadsigns_sfse.txd/cj_lamppost1.dds\",\n \"gta3.img/laesmokecuts.txd/cj_lamppost1.dds\",\"gta3.img/airroadsigns_sfse.txd/cj_lamppost1.dds\",\n \"gta3.img/roadside.txd/cj_lamppost1.dds\",\"gta3.img/airroadsigns_sfse.txd/cj_lamppost1.dds\",\n \"gta_int.img/external.txd/cj_lamppost1.dds\",\"gta3.img/airroadsigns_sfse.txd/cj_lamppost1.dds\",\n \"gta3.img/billbrd.txd/bbback.dds\",\"gta3.img/airwelcomesign_sfse.txd/bbback.dds\",\n \"gta3.img/rodeo02_law2.txd/bbback.dds\",\"gta3.img/airwelcomesign_sfse.txd/bbback.dds\",\n \"gta3.img/sunset03_law2.txd/bbback.dds\",\"gta3.img/airwelcomesign_sfse.txd/bbback.dds\",\n \"gta3.img/vgndwntwn2.txd/bbback.dds\",\"gta3.img/airwelcomesign_sfse.txd/bbback.dds\",\n \"gta_int.img/innertrack.txd/bbback.dds\",\"gta3.img/airwelcomesign_sfse.txd/bbback.dds\",\n \"gta_int.img/innertrak.txd/bbback.dds\",\"gta3.img/airwelcomesign_sfse.txd/bbback.dds\",\n \"gta3.img/dingbat01_la.txd/sl_rustyrailing.dds\",\"gta3.img/airwelcomesign_sfse.txd/sl_rustyrailing.dds\",\n \"gta3.img/ggbridge_sfn.txd/sl_rustyrailing.dds\",\"gta3.img/airwelcomesign_sfse.txd/sl_rustyrailing.dds\",\n \"gta3.img/goldengate_sfw.txd/sl_rustyrailing.dds\",\"gta3.img/airwelcomesign_sfse.txd/sl_rustyrailing.dds\",\n \"gta3.img/landsfw.txd/sl_rustyrailing.dds\",\"gta3.img/airwelcomesign_sfse.txd/sl_rustyrailing.dds\",\n \"gta3.img/lanfireesc_tr.txd/sl_rustyrailing.dds\",\"gta3.img/airwelcomesign_sfse.txd/sl_rustyrailing.dds\",\n \"gta3.img/roadbridge_sfse.txd/sl_rustyrailing.dds\",\"gta3.img/airwelcomesign_sfse.txd/sl_rustyrailing.dds\",\n \"gta3.img/rodeo05_law2.txd/sl_rustyrailing.dds\",\"gta3.img/airwelcomesign_sfse.txd/sl_rustyrailing.dds\",\n \"gta3.img/vgssairportcpark.txd/sl_rustyrailing.dds\",\"gta3.img/airwelcomesign_sfse.txd/sl_rustyrailing.dds\",\n \"gta3.img/xrf_refineryla.txd/sl_rustyrailing.dds\",\"gta3.img/airwelcomesign_sfse.txd/sl_rustyrailing.dds\",\n \"gta3.img/chromegun.txd/muzzle_texture4.dds\",\"gta3.img/ak47.txd/muzzle_texture4.dds\",\n \"gta3.img/colt45.txd/muzzle_texture4.dds\",\"gta3.img/ak47.txd/muzzle_texture4.dds\",\n \"gta3.img/cuntgun.txd/muzzle_texture4.dds\",\"gta3.img/ak47.txd/muzzle_texture4.dds\",\n \"gta3.img/desert_eagle.txd/muzzle_texture4.dds\",\"gta3.img/ak47.txd/muzzle_texture4.dds\",\n \"gta3.img/m4.txd/muzzle_texture4.dds\",\"gta3.img/ak47.txd/muzzle_texture4.dds\",\n \"gta3.img/micro_uzi.txd/muzzle_texture4.dds\",\"gta3.img/ak47.txd/muzzle_texture4.dds\",\n \"gta3.img/minigun.txd/muzzle_texture4.dds\",\"gta3.img/ak47.txd/muzzle_texture4.dds\",\n \"gta3.img/mp5lng.txd/muzzle_texture4.dds\",\"gta3.img/ak47.txd/muzzle_texture4.dds\",\n \"gta3.img/sawnoff.txd/muzzle_texture4.dds\",\"gta3.img/ak47.txd/muzzle_texture4.dds\",\n \"gta3.img/shotgspa.txd/muzzle_texture4.dds\",\"gta3.img/ak47.txd/muzzle_texture4.dds\",\n \"gta3.img/silenced.txd/muzzle_texture4.dds\",\"gta3.img/ak47.txd/muzzle_texture4.dds\",\n \"gta3.img/sniper.txd/muzzle_texture4.dds\",\"gta3.img/ak47.txd/muzzle_texture4.dds\",\n \"gta3.img/tec9.txd/muzzle_texture4.dds\",\"gta3.img/ak47.txd/muzzle_texture4.dds\",\n \"gta3.img/genalley.txd/stuffdirtcol.dds\",\"gta3.img/alleyprop.txd/stuffdirtcol.dds\",\n \"gta3.img/genalley.txd/hoteldetails2.dds\",\"gta3.img/alleyprop.txd/hoteldetails2.dds\",\n \"gta3.img/idlewood46_lae.txd/hoteldetails2.dds\",\"gta3.img/alleyprop.txd/hoteldetails2.dds\",\n \"gta3.img/kmb_camx.txd/hoteldetails2.dds\",\"gta3.img/alleyprop.txd/hoteldetails2.dds\",\n \"gta3.img/skyscrapper_sfs.txd/ws_asphalt.dds\",\"gta3.img/alleys_sfs.txd/ws_asphalt.dds\",\n \"gta3.img/bakerybit_sfse.txd/ws_sandstone1.dds\",\"gta3.img/alleys_sfs.txd/ws_sandstone1.dds\",\n \"gta3.img/beafron2_law2.txd/ws_sandstone1.dds\",\"gta3.img/alleys_sfs.txd/ws_sandstone1.dds\",\n \"gta3.img/civic1_lan2.txd/ws_sandstone1.dds\",\"gta3.img/alleys_sfs.txd/ws_sandstone1.dds\",\n \"gta3.img/cluckbell_sfs.txd/ws_sandstone1.dds\",\"gta3.img/alleys_sfs.txd/ws_sandstone1.dds\",\n \"gta3.img/crackdrive_sfse.txd/ws_sandstone1.dds\",\"gta3.img/alleys_sfs.txd/ws_sandstone1.dds\",\n \"gta3.img/cs_town.txd/ws_sandstone1.dds\",\"gta3.img/alleys_sfs.txd/ws_sandstone1.dds\",\n \"gta3.img/cunte_block1.txd/ws_sandstone1.dds\",\"gta3.img/alleys_sfs.txd/ws_sandstone1.dds\",\n \"gta3.img/cuntwlandcarparks.txd/ws_sandstone1.dds\",\"gta3.img/alleys_sfs.txd/ws_sandstone1.dds\",\n \"gta3.img/cuntwland.txd/ws_sandstone1.dds\",\"gta3.img/alleys_sfs.txd/ws_sandstone1.dds\",\n \"gta3.img/cw2_photoblockcs_t.txd/ws_sandstone1.dds\",\"gta3.img/alleys_sfs.txd/ws_sandstone1.dds\",\n \"gta3.img/cw_road.txd/ws_sandstone1.dds\",\"gta3.img/alleys_sfs.txd/ws_sandstone1.dds\",\n \"gta3.img/docks2_sfse.txd/ws_sandstone1.dds\",\"gta3.img/alleys_sfs.txd/ws_sandstone1.dds\",\n \"gta3.img/groundbit_sfse.txd/ws_sandstone1.dds\",\"gta3.img/alleys_sfs.txd/ws_sandstone1.dds\",\n \"gta3.img/groundbit_sfs.txd/ws_sandstone1.dds\",\"gta3.img/alleys_sfs.txd/ws_sandstone1.dds\",\n \"gta3.img/hashblock3_sfs.txd/ws_sandstone1.dds\",\"gta3.img/alleys_sfs.txd/ws_sandstone1.dds\",\n \"gta3.img/oc_flats_gnd_sfs.txd/ws_sandstone1.dds\",\"gta3.img/alleys_sfs.txd/ws_sandstone1.dds\",\n \"gta3.img/queens3_sfs.txd/ws_sandstone1.dds\",\"gta3.img/alleys_sfs.txd/ws_sandstone1.dds\",\n \"gta3.img/queensammo_sfs.txd/ws_sandstone1.dds\",\"gta3.img/alleys_sfs.txd/ws_sandstone1.dds\",\n \"gta3.img/station_sfse.txd/ws_sandstone1.dds\",\"gta3.img/alleys_sfs.txd/ws_sandstone1.dds\",\n \"gta3.img/stolenbuild02.txd/ws_sandstone1.dds\",\"gta3.img/alleys_sfs.txd/ws_sandstone1.dds\",\n \"gta3.img/sw_block12.txd/ws_sandstone1.dds\",\"gta3.img/alleys_sfs.txd/ws_sandstone1.dds\",\n \"gta3.img/traindocks_sfse.txd/ws_sandstone1.dds\",\"gta3.img/alleys_sfs.txd/ws_sandstone1.dds\",\n \"gta3.img/vgngebuild.txd/ws_sandstone1.dds\",\"gta3.img/alleys_sfs.txd/ws_sandstone1.dds\",\n \"gta3.img/vgsbikeschool.txd/ws_sandstone1.dds\",\"gta3.img/alleys_sfs.txd/ws_sandstone1.dds\",\n \"gta3.img/vgwestabats.txd/ws_sandstone1.dds\",\"gta3.img/alleys_sfs.txd/ws_sandstone1.dds\",\n \"gta3.img/hashblock3_sfs.txd/ws_alley_conc3.dds\",\"gta3.img/alleys_sfs.txd/ws_alley_conc3.dds\",\n \"gta3.img/hashmarket1_sfs.txd/ws_alley_conc3.dds\",\"gta3.img/alleys_sfs.txd/ws_alley_conc3.dds\",\n \"gta3.img/benches.txd/planks01.dds\",\"gta3.img/alleystuff.txd/planks01.dds\",\n \"gta3.img/canalsg_law.txd/planks01.dds\",\"gta3.img/alleystuff.txd/planks01.dds\",\n \"gta3.img/des_damquay.txd/planks01.dds\",\"gta3.img/alleystuff.txd/planks01.dds\",\n \"gta3.img/lae2billboards.txd/planks01.dds\",\"gta3.img/alleystuff.txd/planks01.dds\",\n \"gta3.img/lahillstxd1a.txd/planks01.dds\",\"gta3.img/alleystuff.txd/planks01.dds\",\n \"gta3.img/landjump.txd/planks01.dds\",\"gta3.img/alleystuff.txd/planks01.dds\",\n \"gta3.img/pirateship01.txd/planks01.dds\",\"gta3.img/alleystuff.txd/planks01.dds\",\n \"gta3.img/sw_block10.txd/planks01.dds\",\"gta3.img/alleystuff.txd/planks01.dds\",\n \"gta3.img/tcenewhillhus02.txd/planks01.dds\",\"gta3.img/alleystuff.txd/planks01.dds\",\n \"gta3.img/tramstatsfw.txd/planks01.dds\",\"gta3.img/alleystuff.txd/planks01.dds\",\n \"gta3.img/ufo_bar.txd/planks01.dds\",\"gta3.img/alleystuff.txd/planks01.dds\",\n \"gta3.img/wc_lift_sfse.txd/planks01.dds\",\"gta3.img/alleystuff.txd/planks01.dds\",\n \"gta3.img/woodpanels.txd/planks01.dds\",\"gta3.img/alleystuff.txd/planks01.dds\",\n \"gta3.img/crates.txd/cratec.dds\",\"gta3.img/alleystuff.txd/cratec.dds\",\n \"gta3.img/cuntwbcs_t.txd/cratec.dds\",\"gta3.img/alleystuff.txd/cratec.dds\",\n \"gta3.img/cuntwshopscs_t.txd/cratec.dds\",\"gta3.img/alleystuff.txd/cratec.dds\",\n \"gta3.img/xrfcrates_sfs.txd/cratec.dds\",\"gta3.img/alleystuff.txd/cratec.dds\",\n \"gta3.img/crates.txd/crate_b.dds\",\"gta3.img/alleystuff.txd/crate_b.dds\",\n \"gta3.img/cuntwbcs_t.txd/crate_b.dds\",\"gta3.img/alleystuff.txd/crate_b.dds\",\n \"gta3.img/cuntwshopscs_t.txd/crate_b.dds\",\"gta3.img/alleystuff.txd/crate_b.dds\",\n \"gta3.img/gunbox.txd/crate_b.dds\",\"gta3.img/alleystuff.txd/crate_b.dds\",\n \"gta3.img/imstuff_las2.txd/crate_b.dds\",\"gta3.img/alleystuff.txd/crate_b.dds\",\n \"gta3.img/imy_bbox.txd/crate_b.dds\",\"gta3.img/alleystuff.txd/crate_b.dds\",\n \"gta3.img/xrfcrates_sfs.txd/crate_b.dds\",\"gta3.img/alleystuff.txd/crate_b.dds\",\n \"gta3.img/sw_block01.txd/sjmstair.dds\",\"gta3.img/alleystuff.txd/sjmstair.dds\",\n \"gta3.img/sw_block09.txd/sjmstair.dds\",\"gta3.img/alleystuff.txd/sjmstair.dds\",\n \"gta3.img/sw_block12.txd/sjmstair.dds\",\"gta3.img/alleystuff.txd/sjmstair.dds\",\n \"gta3.img/sw_diner1.txd/gen_crate.dds\",\"gta3.img/alleystuff.txd/gen_crate.dds\",\n \"gta3.img/greenwoo.txd/greenwoo92wheel64.dds\",\"gta3.img/alpha.txd/alpha92wheel64.dds\",\n \"gta3.img/firetruk.txd/firetruk92wheel.dds\",\"gta3.img/ambulan.txd/ambulan92wheel.dds\",\n \"gta3.img/newsvan.txd/newsvan92wheel64.dds\",\"gta3.img/ambulan.txd/ambulan92wheel.dds\",\n \"gta3.img/pony.txd/pony92wheel64.dds\",\"gta3.img/ambulan.txd/ambulan92wheel.dds\",\n \"gta3.img/rumpo.txd/rumpo92wheel64.dds\",\"gta3.img/ambulan.txd/ambulan92wheel.dds\",\n \"gta3.img/topfun.txd/pony92wheel64.dds\",\"gta3.img/ambulan.txd/ambulan92wheel.dds\",\n \"gta3.img/foodlawn.txd/foodmartla1.dds\",\"gta3.img/ammu_lan2.txd/foodmartla1.dds\",\n \"gta3.img/lanblokb2.txd/foodmartla1.dds\",\"gta3.img/ammu_lan2.txd/foodmartla1.dds\",\n \"gta3.img/melrose02_lawn.txd/foodmartla1.dds\",\"gta3.img/ammu_lan2.txd/foodmartla1.dds\",\n \"gta3.img/melrose08_lawn.txd/foodmartla1.dds\",\"gta3.img/ammu_lan2.txd/foodmartla1.dds\",\n \"gta3.img/vgsswarehse02c.txd/foodmartla1.dds\",\"gta3.img/ammu_lan2.txd/foodmartla1.dds\",\n \"gta3.img/buildblk55.txd/sl_dtbuild02win1.dds\",\"gta3.img/ammu_lan2.txd/sl_dtbuild02win1.dds\",\n \"gta3.img/sunset1_lan2.txd/sl_dtbuild02win1.dds\",\"gta3.img/ammu_lan2.txd/sl_dtbuild02win1.dds\",\n \"gta3.img/cuntwbt.txd/newall4-4.dds\",\"gta3.img/ammu_lan2.txd/newall4-4.dds\",\n \"gta3.img/cuntwshopscs_t.txd/newall4-4.dds\",\"gta3.img/ammu_lan2.txd/newall4-4.dds\",\n \"gta3.img/des_stownmain1.txd/newall4-4.dds\",\"gta3.img/ammu_lan2.txd/newall4-4.dds\",\n \"gta3.img/des_stownmain2.txd/newall4-4.dds\",\"gta3.img/ammu_lan2.txd/newall4-4.dds\",\n \"gta3.img/des_stownmain3.txd/newall4-4.dds\",\"gta3.img/ammu_lan2.txd/newall4-4.dds\",\n \"gta3.img/des_stownstrip1.txd/newall4-4.dds\",\"gta3.img/ammu_lan2.txd/newall4-4.dds\",\n \"gta3.img/des_stownstrip2.txd/newall4-4.dds\",\"gta3.img/ammu_lan2.txd/newall4-4.dds\",\n \"gta3.img/des_ufoinn.txd/newall4-4.dds\",\"gta3.img/ammu_lan2.txd/newall4-4.dds\",\n \"gta3.img/docks2_las2.txd/newall4-4.dds\",\"gta3.img/ammu_lan2.txd/newall4-4.dds\",\n \"gta3.img/docks_las2.txd/newall4-4.dds\",\"gta3.img/ammu_lan2.txd/newall4-4.dds\",\n \"gta3.img/garage_sfw.txd/newall4-4.dds\",\"gta3.img/ammu_lan2.txd/newall4-4.dds\",\n \"gta3.img/oldshops_las.txd/newall4-4.dds\",\"gta3.img/ammu_lan2.txd/newall4-4.dds\",\n \"gta3.img/oldwest.txd/newall4-4.dds\",\"gta3.img/ammu_lan2.txd/newall4-4.dds\",\n \"gta3.img/sunset1_lan2.txd/newall4-4.dds\",\"gta3.img/ammu_lan2.txd/newall4-4.dds\",\n \"gta3.img/beafron2_law2.txd/dior.dds\",\"gta3.img/ammu_lan2.txd/dior.dds\",\n \"gta3.img/rodeo02_law2.txd/dior.dds\",\"gta3.img/ammu_lan2.txd/dior.dds\",\n \"gta3.img/sunset1_lan2.txd/dior.dds\",\"gta3.img/ammu_lan2.txd/dior.dds\",\n \"gta3.img/chinatownsfe.txd/sf_chinashop2.dds\",\"gta3.img/ammu_lan2.txd/sf_chinashop2.dds\",\n \"gta3.img/civic07_lan.txd/sf_chinashop2.dds\",\"gta3.img/ammu_lan2.txd/sf_chinashop2.dds\",\n \"gta3.img/fishwarf.txd/sf_chinashop2.dds\",\"gta3.img/ammu_lan2.txd/sf_chinashop2.dds\",\n \"gta3.img/smallertxd.txd/sf_chinashop2.dds\",\"gta3.img/ammu_lan2.txd/sf_chinashop2.dds\",\n \"gta3.img/sunset1_lan2.txd/sf_chinashop2.dds\",\"gta3.img/ammu_lan2.txd/sf_chinashop2.dds\",\n \"gta3.img/vgnfrates.txd/sf_chinashop2.dds\",\"gta3.img/ammu_lan2.txd/sf_chinashop2.dds\",\n \"gta3.img/ce_bankalley2.txd/corporate1.dds\",\"gta3.img/ammu_lan2.txd/corporate1.dds\",\n \"gta3.img/cuntwbt.txd/corporate1.dds\",\"gta3.img/ammu_lan2.txd/corporate1.dds\",\n \"gta3.img/des_bigearstuff.txd/corporate1.dds\",\"gta3.img/ammu_lan2.txd/corporate1.dds\",\n \"gta3.img/desn2_peckers.txd/corporate1.dds\",\"gta3.img/ammu_lan2.txd/corporate1.dds\",\n \"gta3.img/des_stownmain3.txd/corporate1.dds\",\"gta3.img/ammu_lan2.txd/corporate1.dds\",\n \"gta3.img/des_stownw.txd/corporate1.dds\",\"gta3.img/ammu_lan2.txd/corporate1.dds\",\n \"gta3.img/des_telescopestuff.txd/corporate1.dds\",\"gta3.img/ammu_lan2.txd/corporate1.dds\",\n \"gta3.img/laconcha.txd/corporate1.dds\",\"gta3.img/ammu_lan2.txd/corporate1.dds\",\n \"gta3.img/newstuff_sfn.txd/corporate1.dds\",\"gta3.img/ammu_lan2.txd/corporate1.dds\",\n \"gta3.img/sw_doors.txd/corporate1.dds\",\"gta3.img/ammu_lan2.txd/corporate1.dds\",\n \"gta3.img/vgndwntwn5.txd/corporate1.dds\",\"gta3.img/ammu_lan2.txd/corporate1.dds\",\n \"gta3.img/vgnpwrentrnce.txd/corporate1.dds\",\"gta3.img/ammu_lan2.txd/corporate1.dds\",\n \"gta3.img/venchouse_lax.txd/mallextmid01.dds\",\"gta3.img/ammu_lan2.txd/mallextmid01.dds\",\n \"gta3.img/lanblokb2.txd/sl_fudstore2.dds\",\"gta3.img/ammu_lan2.txd/sl_fudstore2.dds\",\n \"gta3.img/lanblokb.txd/sl_fudstore2.dds\",\"gta3.img/ammu_lan2.txd/sl_fudstore2.dds\",\n \"gta3.img/lanlacmab_lan2.txd/sl_fudstore2.dds\",\"gta3.img/ammu_lan2.txd/sl_fudstore2.dds\",\n \"gta3.img/oldshops_las.txd/sl_fudstore2.dds\",\"gta3.img/ammu_lan2.txd/sl_fudstore2.dds\",\n \"gta3.img/sunset1_lan2.txd/sl_fudstore2.dds\",\"gta3.img/ammu_lan2.txd/sl_fudstore2.dds\",\n \"gta3.img/lanblokb2.txd/sl_fudstore1.dds\",\"gta3.img/ammu_lan2.txd/sl_fudstore1.dds\",\n \"gta3.img/lanblokb.txd/sl_fudstore1.dds\",\"gta3.img/ammu_lan2.txd/sl_fudstore1.dds\",\n \"gta3.img/lanlacmab_lan2.txd/sl_fudstore1.dds\",\"gta3.img/ammu_lan2.txd/sl_fudstore1.dds\",\n \"gta3.img/oldshops_las.txd/sl_fudstore1.dds\",\"gta3.img/ammu_lan2.txd/sl_fudstore1.dds\",\n \"gta3.img/sunset1_lan2.txd/sl_fudstore1.dds\",\"gta3.img/ammu_lan2.txd/sl_fudstore1.dds\",\n \"gta3.img/dtbuil1_lan2.txd/sl_lavicdtwall1.dds\",\"gta3.img/ammu_lan2.txd/sl_lavicdtwall1.dds\",\n \"gta3.img/fighot.txd/sl_lavicdtwall1.dds\",\"gta3.img/ammu_lan2.txd/sl_lavicdtwall1.dds\",\n \"gta3.img/lanblokb2.txd/sl_lavicdtwall1.dds\",\"gta3.img/ammu_lan2.txd/sl_lavicdtwall1.dds\",\n \"gta3.img/lawnstripm.txd/sl_lavicdtwall1.dds\",\"gta3.img/ammu_lan2.txd/sl_lavicdtwall1.dds\",\n \"gta3.img/buildblk55.txd/sl_dtrufrear2win2.dds\",\"gta3.img/ammu_lan2.txd/sl_dtrufrear2win2.dds\",\n \"gta3.img/buildblk55.txd/sl_dtrufrear2win1.dds\",\"gta3.img/ammu_lan2.txd/sl_dtrufrear2win1.dds\",\n \"gta3.img/buildtestlawn.txd/stormdrain5_nt.dds\",\"gta3.img/ammu_lan2.txd/stormdrain5_nt.dds\",\n \"gta3.img/chateau_lawn.txd/stormdrain5_nt.dds\",\"gta3.img/ammu_lan2.txd/stormdrain5_nt.dds\",\n \"gta3.img/civic01_lan.txd/stormdrain5_nt.dds\",\"gta3.img/ammu_lan2.txd/stormdrain5_nt.dds\",\n \"gta3.img/cn_nwbrigstuff.txd/stormdrain5_nt.dds\",\"gta3.img/ammu_lan2.txd/stormdrain5_nt.dds\",\n \"gta3.img/conhooses.txd/stormdrain5_nt.dds\",\"gta3.img/ammu_lan2.txd/stormdrain5_nt.dds\",\n \"gta3.img/cunteroads1.txd/stormdrain5_nt.dds\",\"gta3.img/ammu_lan2.txd/stormdrain5_nt.dds\",\n \"gta3.img/des_damquay.txd/stormdrain5_nt.dds\",\"gta3.img/ammu_lan2.txd/stormdrain5_nt.dds\",\n \"gta3.img/desn2_stud.txd/stormdrain5_nt.dds\",\"gta3.img/ammu_lan2.txd/stormdrain5_nt.dds\",\n \"gta3.img/des_nw2.txd/stormdrain5_nt.dds\",\"gta3.img/ammu_lan2.txd/stormdrain5_nt.dds\",\n \"gta3.img/des_nw.txd/stormdrain5_nt.dds\",\"gta3.img/ammu_lan2.txd/stormdrain5_nt.dds\",\n \"gta3.img/des_stownstrip1.txd/stormdrain5_nt.dds\",\"gta3.img/ammu_lan2.txd/stormdrain5_nt.dds\",\n \"gta3.img/des_s.txd/stormdrain5_nt.dds\",\"gta3.img/ammu_lan2.txd/stormdrain5_nt.dds\",\n \"gta3.img/des_wgarage.txd/stormdrain5_nt.dds\",\"gta3.img/ammu_lan2.txd/stormdrain5_nt.dds\",\n \"gta3.img/dtbuil1_lan2.txd/stormdrain5_nt.dds\",\"gta3.img/ammu_lan2.txd/stormdrain5_nt.dds\",\n \"gta3.img/griffobs_las.txd/stormdrain5_nt.dds\",\"gta3.img/ammu_lan2.txd/stormdrain5_nt.dds\",\n \"gta3.img/grnwht_sfe.txd/stormdrain5_nt.dds\",\"gta3.img/ammu_lan2.txd/stormdrain5_nt.dds\",\n \"gta3.img/lanriver.txd/stormdrain5_nt.dds\",\"gta3.img/ammu_lan2.txd/stormdrain5_nt.dds\",\n \"gta3.img/law2_roadsb.txd/stormdrain5_nt.dds\",\"gta3.img/ammu_lan2.txd/stormdrain5_nt.dds\",\n \"gta3.img/lawnstripm.txd/stormdrain5_nt.dds\",\"gta3.img/ammu_lan2.txd/stormdrain5_nt.dds\",\n \"gta3.img/mainlcawn.txd/stormdrain5_nt.dds\",\"gta3.img/ammu_lan2.txd/stormdrain5_nt.dds\",\n \"gta3.img/melrose02_lawn.txd/stormdrain5_nt.dds\",\"gta3.img/ammu_lan2.txd/stormdrain5_nt.dds\",\n \"gta3.img/melrose05_lawn.txd/stormdrain5_nt.dds\",\"gta3.img/ammu_lan2.txd/stormdrain5_nt.dds\",\n \"gta3.img/melrose08_lawn.txd/stormdrain5_nt.dds\",\"gta3.img/ammu_lan2.txd/stormdrain5_nt.dds\",\n \"gta3.img/melrose12_lawn.txd/stormdrain5_nt.dds\",\"gta3.img/ammu_lan2.txd/stormdrain5_nt.dds\",\n \"gta3.img/melrose15_lawn.txd/stormdrain5_nt.dds\",\"gta3.img/ammu_lan2.txd/stormdrain5_nt.dds\",\n \"gta3.img/melrose19_lawn.txd/stormdrain5_nt.dds\",\"gta3.img/ammu_lan2.txd/stormdrain5_nt.dds\",\n \"gta3.img/mullho05_lahills.txd/stormdrain5_nt.dds\",\"gta3.img/ammu_lan2.txd/stormdrain5_nt.dds\",\n \"gta3.img/skyscrap3_lan2.txd/stormdrain5_nt.dds\",\"gta3.img/ammu_lan2.txd/stormdrain5_nt.dds\",\n \"gta3.img/skyscrap_sfse.txd/stormdrain5_nt.dds\",\"gta3.img/ammu_lan2.txd/stormdrain5_nt.dds\",\n \"gta3.img/sprunkworks.txd/stormdrain5_nt.dds\",\"gta3.img/ammu_lan2.txd/stormdrain5_nt.dds\",\n \"gta3.img/stationtunnel.txd/stormdrain5_nt.dds\",\"gta3.img/ammu_lan2.txd/stormdrain5_nt.dds\",\n \"gta3.img/stolenbuild03.txd/stormdrain5_nt.dds\",\"gta3.img/ammu_lan2.txd/stormdrain5_nt.dds\",\n \"gta3.img/sunrise09_lawn.txd/stormdrain5_nt.dds\",\"gta3.img/ammu_lan2.txd/stormdrain5_nt.dds\",\n \"gta3.img/sunrise11_lawn.txd/stormdrain5_nt.dds\",\"gta3.img/ammu_lan2.txd/stormdrain5_nt.dds\",\n \"gta3.img/sunset01_law2.txd/stormdrain5_nt.dds\",\"gta3.img/ammu_lan2.txd/stormdrain5_nt.dds\",\n \"gta3.img/sunset04_law2.txd/stormdrain5_nt.dds\",\"gta3.img/ammu_lan2.txd/stormdrain5_nt.dds\",\n \"gta3.img/sunset1_lan2.txd/stormdrain5_nt.dds\",\"gta3.img/ammu_lan2.txd/stormdrain5_nt.dds\",\n \"gta3.img/sunsetbittyu.txd/stormdrain5_nt.dds\",\"gta3.img/ammu_lan2.txd/stormdrain5_nt.dds\",\n \"gta3.img/sw_brewery.txd/stormdrain5_nt.dds\",\"gta3.img/ammu_lan2.txd/stormdrain5_nt.dds\",\n \"gta3.img/tvstudio_law2.txd/stormdrain5_nt.dds\",\"gta3.img/ammu_lan2.txd/stormdrain5_nt.dds\",\n \"gta_int.img/ab_cargo_int.txd/ab_planeboby.dds\",\"gta3.img/androm.txd/andromeda92body.dds\",\n \"gta3.img/hashhouses1_sfs.txd/gz_vic1c.dds\",\"gta3.img/anotherbuildsfe.txd/gz_vic1c.dds\",\n \"gta3.img/sfvictorian.txd/gz_vic1c.dds\",\"gta3.img/anotherbuildsfe.txd/gz_vic1c.dds\",\n \"gta3.img/vict_sfw.txd/gz_vic1c.dds\",\"gta3.img/anotherbuildsfe.txd/gz_vic1c.dds\",\n \"gta3.img/hashhouses1_sfs.txd/gz_vic1d.dds\",\"gta3.img/anotherbuildsfe.txd/gz_vic1d.dds\",\n \"gta3.img/sfvictorian.txd/gz_vic1d.dds\",\"gta3.img/anotherbuildsfe.txd/gz_vic1d.dds\",\n \"gta3.img/vict_sfw.txd/gz_vic1d.dds\",\"gta3.img/anotherbuildsfe.txd/gz_vic1d.dds\",\n \"gta3.img/hashhouses1_sfs.txd/gz_vic1b.dds\",\"gta3.img/anotherbuildsfe.txd/gz_vic1b.dds\",\n \"gta3.img/sfvictorian.txd/gz_vic1b.dds\",\"gta3.img/anotherbuildsfe.txd/gz_vic1b.dds\",\n \"gta3.img/vict_sfw.txd/gz_vic1b.dds\",\"gta3.img/anotherbuildsfe.txd/gz_vic1b.dds\",\n \"gta3.img/hashhouses1_sfs.txd/gz_vic1e.dds\",\"gta3.img/anotherbuildsfe.txd/gz_vic1e.dds\",\n \"gta3.img/sfvictorian.txd/gz_vic1e.dds\",\"gta3.img/anotherbuildsfe.txd/gz_vic1e.dds\",\n \"gta3.img/vict_sfw.txd/gz_vic1e.dds\",\"gta3.img/anotherbuildsfe.txd/gz_vic1e.dds\",\n \"gta3.img/bigoldbuild_sfe.txd/gz_vic1a.dds\",\"gta3.img/anotherbuildsfe.txd/gz_vic1a.dds\",\n \"gta3.img/blokmodb.txd/gz_vic1a.dds\",\"gta3.img/anotherbuildsfe.txd/gz_vic1a.dds\",\n \"gta3.img/countryclub_sfs.txd/gz_vic1a.dds\",\"gta3.img/anotherbuildsfe.txd/gz_vic1a.dds\",\n \"gta3.img/hashblock1b_sfs.txd/gz_vic1a.dds\",\"gta3.img/anotherbuildsfe.txd/gz_vic1a.dds\",\n \"gta3.img/hashhouses1_sfs.txd/gz_vic1a.dds\",\"gta3.img/anotherbuildsfe.txd/gz_vic1a.dds\",\n \"gta3.img/posh2_sfe.txd/gz_vic1a.dds\",\"gta3.img/anotherbuildsfe.txd/gz_vic1a.dds\",\n \"gta3.img/sfvictorian.txd/gz_vic1a.dds\",\"gta3.img/anotherbuildsfe.txd/gz_vic1a.dds\",\n \"gta3.img/smallertxd.txd/gz_vic1a.dds\",\"gta3.img/anotherbuildsfe.txd/gz_vic1a.dds\",\n \"gta3.img/vict_sfw.txd/gz_vic1a.dds\",\"gta3.img/anotherbuildsfe.txd/gz_vic1a.dds\",\n \"gta3.img/farmhouse.txd/gz_vic2c.dds\",\"gta3.img/anotherbuildsfe.txd/gz_vic2c.dds\",\n \"gta3.img/hashhouses1_sfs.txd/gz_vic2c.dds\",\"gta3.img/anotherbuildsfe.txd/gz_vic2c.dds\",\n \"gta3.img/sfvictorian.txd/gz_vic2c.dds\",\"gta3.img/anotherbuildsfe.txd/gz_vic2c.dds\",\n \"gta3.img/vict_sfw.txd/gz_vic2c.dds\",\"gta3.img/anotherbuildsfe.txd/gz_vic2c.dds\",\n \"gta3.img/hashhouses1_sfs.txd/gz_vic2a.dds\",\"gta3.img/anotherbuildsfe.txd/gz_vic2a.dds\",\n \"gta3.img/sfvictorian.txd/gz_vic2a.dds\",\"gta3.img/anotherbuildsfe.txd/gz_vic2a.dds\",\n \"gta3.img/vict_sfw.txd/gz_vic2a.dds\",\"gta3.img/anotherbuildsfe.txd/gz_vic2a.dds\",\n \"gta3.img/blokmodb.txd/gz_vic2d.dds\",\"gta3.img/anotherbuildsfe.txd/gz_vic2d.dds\",\n \"gta3.img/hashhouses1_sfs.txd/gz_vic2d.dds\",\"gta3.img/anotherbuildsfe.txd/gz_vic2d.dds\",\n \"gta3.img/sfvictorian.txd/gz_vic2d.dds\",\"gta3.img/anotherbuildsfe.txd/gz_vic2d.dds\",\n \"gta3.img/vict_sfw.txd/gz_vic2d.dds\",\"gta3.img/anotherbuildsfe.txd/gz_vic2d.dds\",\n \"gta3.img/hashhouses1_sfs.txd/gz_vic2b.dds\",\"gta3.img/anotherbuildsfe.txd/gz_vic2b.dds\",\n \"gta3.img/sfvictorian.txd/gz_vic2b.dds\",\"gta3.img/anotherbuildsfe.txd/gz_vic2b.dds\",\n \"gta3.img/vict_sfw.txd/gz_vic2b.dds\",\"gta3.img/anotherbuildsfe.txd/gz_vic2b.dds\",\n \"gta3.img/big_vic1.txd/grassgrn256.dds\",\"gta3.img/anotherbuildsfe.txd/grassgrn256.dds\",\n \"gta3.img/boxybld2_sfw.txd/grassgrn256.dds\",\"gta3.img/anotherbuildsfe.txd/grassgrn256.dds\",\n \"gta3.img/boxybld_sfw.txd/grassgrn256.dds\",\"gta3.img/anotherbuildsfe.txd/grassgrn256.dds\",\n \"gta3.img/canalsg_law.txd/grassgrn256.dds\",\"gta3.img/anotherbuildsfe.txd/grassgrn256.dds\",\n \"gta3.img/churchsfe.txd/grassgrn256.dds\",\"gta3.img/anotherbuildsfe.txd/grassgrn256.dds\",\n \"gta3.img/fishwarf.txd/grassgrn256.dds\",\"gta3.img/anotherbuildsfe.txd/grassgrn256.dds\",\n \"gta3.img/hosbibalsfw.txd/grassgrn256.dds\",\"gta3.img/anotherbuildsfe.txd/grassgrn256.dds\",\n \"gta3.img/laland1_lan2.txd/grassgrn256.dds\",\"gta3.img/anotherbuildsfe.txd/grassgrn256.dds\",\n \"gta3.img/law_doontoon.txd/grassgrn256.dds\",\"gta3.img/anotherbuildsfe.txd/grassgrn256.dds\",\n \"gta3.img/multistory_sfe.txd/grassgrn256.dds\",\"gta3.img/anotherbuildsfe.txd/grassgrn256.dds\",\n \"gta3.img/sfe_swank1.txd/grassgrn256.dds\",\"gta3.img/anotherbuildsfe.txd/grassgrn256.dds\",\n \"gta3.img/sfvictorian.txd/grassgrn256.dds\",\"gta3.img/anotherbuildsfe.txd/grassgrn256.dds\",\n \"gta3.img/slapart01sfe.txd/grassgrn256.dds\",\"gta3.img/anotherbuildsfe.txd/grassgrn256.dds\",\n \"gta3.img/vgssland03.txd/grassgrn256.dds\",\"gta3.img/anotherbuildsfe.txd/grassgrn256.dds\",\n \"gta3.img/blockalpha.txd/ws_railing1.dds\",\"gta3.img/apartmentalpha.txd/ws_railing1.dds\",\n \"gta3.img/boxhses_sfsx.txd/ws_railing1.dds\",\"gta3.img/apartmentalpha.txd/ws_railing1.dds\",\n \"gta3.img/laealpha.txd/ws_railing1.dds\",\"gta3.img/apartmentalpha.txd/ws_railing1.dds\",\n \"gta3.img/lanblokc.txd/ws_railing1.dds\",\"gta3.img/apartmentalpha.txd/ws_railing1.dds\",\n \"gta3.img/rodeost01_lax.txd/ws_railing1.dds\",\"gta3.img/apartmentalpha.txd/ws_railing1.dds\",\n \"gta3.img/civic02_lan.txd/gymshop1_lae.dds\",\"gta3.img/apartmentalpha.txd/gymshop1_lae.dds\",\n \"gta3.img/hospital_lae.txd/gymshop1_lae.dds\",\"gta3.img/apartmentalpha.txd/gymshop1_lae.dds\",\n \"gta3.img/vgssairport02.txd/redpylon.dds\",\"gta3.img/ap_build4e.txd/redpylon.dds\",\n \"gta3.img/benches.txd/redwhite_stripe.dds\",\"gta3.img/ap_build4e.txd/redwhite_stripe.dds\",\n \"gta3.img/dyncones.txd/redwhite_stripe.dds\",\"gta3.img/ap_build4e.txd/redwhite_stripe.dds\",\n \"gta3.img/foodkarts.txd/redwhite_stripe.dds\",\"gta3.img/ap_build4e.txd/redwhite_stripe.dds\",\n \"gta3.img/gnhotel1.txd/redwhite_stripe.dds\",\"gta3.img/ap_build4e.txd/redwhite_stripe.dds\",\n \"gta3.img/smashbarr.txd/redwhite_stripe.dds\",\"gta3.img/ap_build4e.txd/redwhite_stripe.dds\",\n \"gta3.img/vgssairport02.txd/redwhite_stripe.dds\",\"gta3.img/ap_build4e.txd/redwhite_stripe.dds\",\n \"gta3.img/vgssmulticarprk.txd/redwhite_stripe.dds\",\"gta3.img/ap_build4e.txd/redwhite_stripe.dds\",\n \"gta3.img/downtown_las.txd/roof09l256.dds\",\"gta3.img/ap_build4e.txd/roof09l256.dds\",\n \"gta3.img/vgnoutown2.txd/roof09l256.dds\",\"gta3.img/ap_build4e.txd/roof09l256.dds\",\n \"gta3.img/vgssairport02.txd/roof09l256.dds\",\"gta3.img/ap_build4e.txd/roof09l256.dds\",\n \"gta3.img/vgsswarehse02.txd/roof09l256.dds\",\"gta3.img/ap_build4e.txd/roof09l256.dds\",\n \"gta_int.img/inneroval.txd/roof09l256.dds\",\"gta3.img/ap_build4e.txd/roof09l256.dds\",\n \"gta_int.img/ovalsurround.txd/roof09l256.dds\",\"gta3.img/ap_build4e.txd/roof09l256.dds\",\n \"gta_int.img/stadstunt.txd/roof09l256.dds\",\"gta3.img/ap_build4e.txd/roof09l256.dds\",\n \"gta3.img/mp_ranchcut.txd/leather_seat_256.dds\",\"gta3.img/apsecurity_sfxrf.txd/leather_seat_256.dds\",\n \"gta3.img/policechair.txd/leather_seat_256.dds\",\"gta3.img/apsecurity_sfxrf.txd/leather_seat_256.dds\",\n \"gta3.img/ufo_barbakroom.txd/leather_seat_256.dds\",\"gta3.img/apsecurity_sfxrf.txd/leather_seat_256.dds\",\n \"gta3.img/vgssairport02.txd/leather_seat_256.dds\",\"gta3.img/apsecurity_sfxrf.txd/leather_seat_256.dds\",\n \"gta_int.img/cj_office.txd/leather_seat_256.dds\",\"gta3.img/apsecurity_sfxrf.txd/leather_seat_256.dds\",\n \"gta_int.img/dr_gsmix.txd/leather_seat_256.dds\",\"gta3.img/apsecurity_sfxrf.txd/leather_seat_256.dds\",\n \"gta3.img/sfn_byofficeint.txd/win_desktop.dds\",\"gta3.img/apsecurity_sfxrf.txd/win_desktop.dds\",\n \"gta3.img/vgssairport02.txd/win_desktop.dds\",\"gta3.img/apsecurity_sfxrf.txd/win_desktop.dds\",\n \"gta_int.img/whore_furn.txd/win_desktop.dds\",\"gta3.img/apsecurity_sfxrf.txd/win_desktop.dds\",\n \"gta3.img/break_street1.txd/cj_wood1.dds\",\"gta3.img/apsecurity_sfxrf.txd/cj_wood1.dds\",\n \"gta3.img/hubprops2_sfse.txd/cj_wood1.dds\",\"gta3.img/apsecurity_sfxrf.txd/cj_wood1.dds\",\n \"gta3.img/sfeship1.txd/cj_wood1.dds\",\"gta3.img/apsecurity_sfxrf.txd/cj_wood1.dds\",\n \"gta3.img/ship_brijsfw.txd/cj_wood1.dds\",\"gta3.img/apsecurity_sfxrf.txd/cj_wood1.dds\",\n \"gta3.img/street_rubishext.txd/cj_wood1.dds\",\"gta3.img/apsecurity_sfxrf.txd/cj_wood1.dds\",\n \"gta3.img/vgsn_polnb.txd/cj_wood1.dds\",\"gta3.img/apsecurity_sfxrf.txd/cj_wood1.dds\",\n \"gta3.img/vgssairport02.txd/cj_wood1.dds\",\"gta3.img/apsecurity_sfxrf.txd/cj_wood1.dds\",\n \"gta_int.img/cj_barb2.txd/cj_wood1.dds\",\"gta3.img/apsecurity_sfxrf.txd/cj_wood1.dds\",\n \"gta_int.img/cj_bed_furn.txd/cj_wood1.dds\",\"gta3.img/apsecurity_sfxrf.txd/cj_wood1.dds\",\n \"gta_int.img/cj_beds.txd/cj_wood1.dds\",\"gta3.img/apsecurity_sfxrf.txd/cj_wood1.dds\",\n \"gta_int.img/cj_exp.txd/cj_wood1.dds\",\"gta3.img/apsecurity_sfxrf.txd/cj_wood1.dds\",\n \"gta_int.img/cj_furniture.txd/cj_wood1.dds\",\"gta3.img/apsecurity_sfxrf.txd/cj_wood1.dds\",\n \"gta_int.img/cj_hi_fi2.txd/cj_wood1.dds\",\"gta3.img/apsecurity_sfxrf.txd/cj_wood1.dds\",\n \"gta_int.img/cj_hotel_sw.txd/cj_wood1.dds\",\"gta3.img/apsecurity_sfxrf.txd/cj_wood1.dds\",\n \"gta_int.img/cj_hotel.txd/cj_wood1.dds\",\"gta3.img/apsecurity_sfxrf.txd/cj_wood1.dds\",\n \"gta_int.img/cj_kitchen.txd/cj_wood1.dds\",\"gta3.img/apsecurity_sfxrf.txd/cj_wood1.dds\",\n \"gta_int.img/cj_med_beds.txd/cj_wood1.dds\",\"gta3.img/apsecurity_sfxrf.txd/cj_wood1.dds\",\n \"gta_int.img/cj_office.txd/cj_wood1.dds\",\"gta3.img/apsecurity_sfxrf.txd/cj_wood1.dds\",\n \"gta_int.img/cj_s_beds.txd/cj_wood1.dds\",\"gta3.img/apsecurity_sfxrf.txd/cj_wood1.dds\",\n \"gta_int.img/cj_tables.txd/cj_wood1.dds\",\"gta3.img/apsecurity_sfxrf.txd/cj_wood1.dds\",\n \"gta_int.img/cj_tv_stand.txd/cj_wood1.dds\",\"gta3.img/apsecurity_sfxrf.txd/cj_wood1.dds\",\n \"gta_int.img/cloth_trackies.txd/cj_wood1.dds\",\"gta3.img/apsecurity_sfxrf.txd/cj_wood1.dds\",\n \"gta_int.img/cloth_track_t.txd/cj_wood1.dds\",\"gta3.img/apsecurity_sfxrf.txd/cj_wood1.dds\",\n \"gta_int.img/gap.txd/cj_wood1.dds\",\"gta3.img/apsecurity_sfxrf.txd/cj_wood1.dds\",\n \"gta_int.img/genhotelsave.txd/cj_wood1.dds\",\"gta3.img/apsecurity_sfxrf.txd/cj_wood1.dds\",\n \"gta_int.img/genintintfasta.txd/cj_wood1.dds\",\"gta3.img/apsecurity_sfxrf.txd/cj_wood1.dds\",\n \"gta_int.img/genintintfastd.txd/cj_wood1.dds\",\"gta3.img/apsecurity_sfxrf.txd/cj_wood1.dds\",\n \"gta_int.img/genintintsex.txd/cj_wood1.dds\",\"gta3.img/apsecurity_sfxrf.txd/cj_wood1.dds\",\n \"gta_int.img/gf1.txd/cj_wood1.dds\",\"gta3.img/apsecurity_sfxrf.txd/cj_wood1.dds\",\n \"gta_int.img/gf2.txd/cj_wood1.dds\",\"gta3.img/apsecurity_sfxrf.txd/cj_wood1.dds\",\n \"gta_int.img/int_zerosrca.txd/cj_wood1.dds\",\"gta3.img/apsecurity_sfxrf.txd/cj_wood1.dds\",\n \"gta_int.img/police_props.txd/cj_wood1.dds\",\"gta3.img/apsecurity_sfxrf.txd/cj_wood1.dds\",\n \"gta_int.img/police_props_un.txd/cj_wood1.dds\",\"gta3.img/apsecurity_sfxrf.txd/cj_wood1.dds\",\n \"gta_int.img/rc_shop_hanger.txd/cj_wood1.dds\",\"gta3.img/apsecurity_sfxrf.txd/cj_wood1.dds\",\n \"gta_int.img/rc_shop_toy.txd/cj_wood1.dds\",\"gta3.img/apsecurity_sfxrf.txd/cj_wood1.dds\",\n \"gta_int.img/rc_shop.txd/cj_wood1.dds\",\"gta3.img/apsecurity_sfxrf.txd/cj_wood1.dds\",\n \"gta_int.img/rystuff.txd/cj_wood1.dds\",\"gta3.img/apsecurity_sfxrf.txd/cj_wood1.dds\",\n \"gta_int.img/shopping.txd/cj_wood1.dds\",\"gta3.img/apsecurity_sfxrf.txd/cj_wood1.dds\",\n \"gta_int.img/skate_shop.txd/cj_wood1.dds\",\"gta3.img/apsecurity_sfxrf.txd/cj_wood1.dds\",\n \"gta_int.img/surf_boards.txd/cj_wood1.dds\",\"gta3.img/apsecurity_sfxrf.txd/cj_wood1.dds\",\n \"gta_int.img/sweetshall.txd/cj_wood1.dds\",\"gta3.img/apsecurity_sfxrf.txd/cj_wood1.dds\",\n \"gta_int.img/vegassavesmal.txd/cj_wood1.dds\",\"gta3.img/apsecurity_sfxrf.txd/cj_wood1.dds\",\n \"gta_int.img/zip_clothes.txd/cj_wood1.dds\",\"gta3.img/apsecurity_sfxrf.txd/cj_wood1.dds\",\n \"gta3.img/ballyring01.txd/chromepipe2_64hv.dds\",\"gta3.img/apsecurity_sfxrf.txd/chromepipe2_64hv.dds\",\n \"gta3.img/des_nwtown.txd/chromepipe2_64hv.dds\",\"gta3.img/apsecurity_sfxrf.txd/chromepipe2_64hv.dds\",\n \"gta3.img/gravblok01_lahills.txd/chromepipe2_64hv.dds\",\"gta3.img/apsecurity_sfxrf.txd/chromepipe2_64hv.dds\",\n \"gta3.img/hospital_lae.txd/chromepipe2_64hv.dds\",\"gta3.img/apsecurity_sfxrf.txd/chromepipe2_64hv.dds\",\n \"gta3.img/las2_dockoff.txd/chromepipe2_64hv.dds\",\"gta3.img/apsecurity_sfxrf.txd/chromepipe2_64hv.dds\",\n \"gta3.img/ottos2_sfw.txd/chromepipe2_64hv.dds\",\"gta3.img/apsecurity_sfxrf.txd/chromepipe2_64hv.dds\",\n \"gta3.img/refinery.txd/chromepipe2_64hv.dds\",\"gta3.img/apsecurity_sfxrf.txd/chromepipe2_64hv.dds\",\n \"gta3.img/ufo_barbakroom.txd/chromepipe2_64hv.dds\",\"gta3.img/apsecurity_sfxrf.txd/chromepipe2_64hv.dds\",\n \"gta3.img/vgssairport02.txd/chromepipe2_64hv.dds\",\"gta3.img/apsecurity_sfxrf.txd/chromepipe2_64hv.dds\",\n \"gta_int.img/cj_office.txd/chromepipe2_64hv.dds\",\"gta3.img/apsecurity_sfxrf.txd/chromepipe2_64hv.dds\",\n \"gta_int.img/intclothesa.txd/chromeffect.dds\",\"gta3.img/apsecurity_sfxrf.txd/chromepipe2_64hv.dds\",\n \"gta3.img/bakery_sfse.txd/ws_altz_wall10.dds\",\"gta3.img/apsecurity_sfxrf.txd/ws_altz_wall10.dds\",\n \"gta3.img/bendytunnel_sfse.txd/ws_altz_wall10.dds\",\"gta3.img/apsecurity_sfxrf.txd/ws_altz_wall10.dds\",\n \"gta3.img/carshow_sfse.txd/ws_altz_wall10.dds\",\"gta3.img/apsecurity_sfxrf.txd/ws_altz_wall10.dds\",\n \"gta3.img/corvinsign_sfse.txd/ws_altz_wall10.dds\",\"gta3.img/apsecurity_sfxrf.txd/ws_altz_wall10.dds\",\n \"gta3.img/crackdrive_sfse.txd/ws_altz_wall10.dds\",\"gta3.img/apsecurity_sfxrf.txd/ws_altz_wall10.dds\",\n \"gta3.img/crackfactdem_sfs.txd/ws_altz_wall10.dds\",\"gta3.img/apsecurity_sfxrf.txd/ws_altz_wall10.dds\",\n \"gta3.img/crackfact_sfse.txd/ws_altz_wall10.dds\",\"gta3.img/apsecurity_sfxrf.txd/ws_altz_wall10.dds\",\n \"gta3.img/fedmint_sfs.txd/ws_altz_wall10.dds\",\"gta3.img/apsecurity_sfxrf.txd/ws_altz_wall10.dds\",\n \"gta3.img/garage_sfw.txd/ws_altz_wall10.dds\",\"gta3.img/apsecurity_sfxrf.txd/ws_altz_wall10.dds\",\n \"gta3.img/gatehouse_sfse.txd/ws_altz_wall10.dds\",\"gta3.img/apsecurity_sfxrf.txd/ws_altz_wall10.dds\",\n \"gta3.img/graveyard_sfs.txd/ws_altz_wall10.dds\",\"gta3.img/apsecurity_sfxrf.txd/ws_altz_wall10.dds\",\n \"gta3.img/groundbit_sfs.txd/ws_altz_wall10.dds\",\"gta3.img/apsecurity_sfxrf.txd/ws_altz_wall10.dds\",\n \"gta3.img/hotelback_sfs.txd/ws_altz_wall10.dds\",\"gta3.img/apsecurity_sfxrf.txd/ws_altz_wall10.dds\",\n \"gta3.img/jump_sfxref.txd/ws_altz_wall10.dds\",\"gta3.img/apsecurity_sfxrf.txd/ws_altz_wall10.dds\",\n \"gta3.img/oc_flats_gnd_sfs.txd/ws_altz_wall10.dds\",\"gta3.img/apsecurity_sfxrf.txd/ws_altz_wall10.dds\",\n \"gta3.img/oldgarage_sfse.txd/ws_altz_wall10.dds\",\"gta3.img/apsecurity_sfxrf.txd/ws_altz_wall10.dds\",\n \"gta3.img/slapart01sfe.txd/ws_altz_wall10.dds\",\"gta3.img/apsecurity_sfxrf.txd/ws_altz_wall10.dds\",\n \"gta3.img/subshops_sfs.txd/ws_altz_wall10.dds\",\"gta3.img/apsecurity_sfxrf.txd/ws_altz_wall10.dds\",\n \"gta3.img/vgsespras.txd/ws_altz_wall10.dds\",\"gta3.img/apsecurity_sfxrf.txd/ws_altz_wall10.dds\",\n \"gta3.img/vgssairport02.txd/ws_altz_wall10.dds\",\"gta3.img/apsecurity_sfxrf.txd/ws_altz_wall10.dds\",\n \"gta3.img/depot_sfse.txd/ws_rooftarmac2.dds\",\"gta3.img/apsecurity_sfxrf.txd/ws_rooftarmac2.dds\",\n \"gta3.img/eastbeach4a_lae2.txd/ws_rooftarmac2.dds\",\"gta3.img/apsecurity_sfxrf.txd/ws_rooftarmac2.dds\",\n \"gta3.img/gatehouse_sfse.txd/ws_rooftarmac2.dds\",\"gta3.img/apsecurity_sfxrf.txd/ws_rooftarmac2.dds\",\n \"gta3.img/mall_sfse.txd/ws_rooftarmac2.dds\",\"gta3.img/apsecurity_sfxrf.txd/ws_rooftarmac2.dds\",\n \"gta3.img/melrose03_lawn.txd/ws_rooftarmac2.dds\",\"gta3.img/apsecurity_sfxrf.txd/ws_rooftarmac2.dds\",\n \"gta3.img/midtownshops_sfs.txd/ws_rooftarmac2.dds\",\"gta3.img/apsecurity_sfxrf.txd/ws_rooftarmac2.dds\",\n \"gta3.img/mission3z_sfse.txd/ws_rooftarmac2.dds\",\"gta3.img/apsecurity_sfxrf.txd/ws_rooftarmac2.dds\",\n \"gta3.img/mission_sfse.txd/ws_rooftarmac2.dds\",\"gta3.img/apsecurity_sfxrf.txd/ws_rooftarmac2.dds\",\n \"gta3.img/motel_lae.txd/ws_rooftarmac2.dds\",\"gta3.img/apsecurity_sfxrf.txd/ws_rooftarmac2.dds\",\n \"gta3.img/officy_sfs.txd/ws_rooftarmac2.dds\",\"gta3.img/apsecurity_sfxrf.txd/ws_rooftarmac2.dds\",\n \"gta3.img/rodeost01_lax.txd/ws_rooftarmac2.dds\",\"gta3.img/apsecurity_sfxrf.txd/ws_rooftarmac2.dds\",\n \"gta3.img/subshops_sfs.txd/ws_rooftarmac2.dds\",\"gta3.img/apsecurity_sfxrf.txd/ws_rooftarmac2.dds\",\n \"gta3.img/tvtower_sfs.txd/ws_rooftarmac2.dds\",\"gta3.img/apsecurity_sfxrf.txd/ws_rooftarmac2.dds\",\n \"gta3.img/vgssairport02.txd/ws_rooftarmac2.dds\",\"gta3.img/apsecurity_sfxrf.txd/ws_rooftarmac2.dds\",\n \"gta3.img/bdupshouse_lae.txd/lostonclad1.dds\",\"gta3.img/apsecurity_sfxrf.txd/lostonclad1.dds\",\n \"gta3.img/ce_ground09.txd/lostonclad1.dds\",\"gta3.img/apsecurity_sfxrf.txd/lostonclad1.dds\",\n \"gta3.img/countryclbgnd_sfs.txd/lostonclad1.dds\",\"gta3.img/apsecurity_sfxrf.txd/lostonclad1.dds\",\n \"gta3.img/countryclbtnis_sfs.txd/lostonclad1.dds\",\"gta3.img/apsecurity_sfxrf.txd/lostonclad1.dds\",\n \"gta3.img/eastls1b_lae2.txd/lostonclad1.dds\",\"gta3.img/apsecurity_sfxrf.txd/lostonclad1.dds\",\n \"gta3.img/eastshops1_lae.txd/lostonclad1.dds\",\"gta3.img/apsecurity_sfxrf.txd/lostonclad1.dds\",\n \"gta3.img/gangblok1_lae2.txd/lostonclad1.dds\",\"gta3.img/apsecurity_sfxrf.txd/lostonclad1.dds\",\n \"gta3.img/gatehouse_sfse.txd/lostonclad1.dds\",\"gta3.img/apsecurity_sfxrf.txd/lostonclad1.dds\",\n \"gta3.img/glenpark1_lae.txd/lostonclad1.dds\",\"gta3.img/apsecurity_sfxrf.txd/lostonclad1.dds\",\n \"gta3.img/glenphouse_lax.txd/lostonclad1.dds\",\"gta3.img/apsecurity_sfxrf.txd/lostonclad1.dds\",\n \"gta3.img/haight1_sfs.txd/lostonclad1.dds\",\"gta3.img/apsecurity_sfxrf.txd/lostonclad1.dds\",\n \"gta3.img/hillhousex13_6.txd/lostonclad1.dds\",\"gta3.img/apsecurity_sfxrf.txd/lostonclad1.dds\",\n \"gta3.img/idlewood6_lae.txd/lostonclad1.dds\",\"gta3.img/apsecurity_sfxrf.txd/lostonclad1.dds\",\n \"gta3.img/jeffers4_lae.txd/lostonclad1.dds\",\"gta3.img/apsecurity_sfxrf.txd/lostonclad1.dds\",\n \"gta3.img/richman02_lahills.txd/lostonclad1.dds\",\"gta3.img/apsecurity_sfxrf.txd/lostonclad1.dds\",\n \"gta3.img/roadslahills.txd/lostonclad1.dds\",\"gta3.img/apsecurity_sfxrf.txd/lostonclad1.dds\",\n \"gta3.img/shops01_law.txd/lostonclad1.dds\",\"gta3.img/apsecurity_sfxrf.txd/lostonclad1.dds\",\n \"gta3.img/templae2land.txd/lostonclad1.dds\",\"gta3.img/apsecurity_sfxrf.txd/lostonclad1.dds\",\n \"gta3.img/vgssairport02.txd/lostonclad1.dds\",\"gta3.img/apsecurity_sfxrf.txd/lostonclad1.dds\",\n \"gta3.img/cathedral_sfs.txd/policeha02black_128.dds\",\"gta3.img/apsecurity_sfxrf.txd/policeha02black_128.dds\",\n \"gta3.img/gatehouse_sfse.txd/policeha02black_128.dds\",\"gta3.img/apsecurity_sfxrf.txd/policeha02black_128.dds\",\n \"gta3.img/gayclub_sfs.txd/policeha02black_128.dds\",\"gta3.img/apsecurity_sfxrf.txd/policeha02black_128.dds\",\n \"gta3.img/hillhousex13_6.txd/policeha02black_128.dds\",\"gta3.img/apsecurity_sfxrf.txd/policeha02black_128.dds\",\n \"gta3.img/lahillshilhs1e.txd/policeha02black_128.dds\",\"gta3.img/apsecurity_sfxrf.txd/policeha02black_128.dds\",\n \"gta3.img/ce_fact03.txd/conc_wall_stripd2128h.dds\",\"gta3.img/archbrij.txd/conc_wall_stripd2128h.dds\",\n \"gta3.img/ce_oldbridge.txd/conc_wall_stripd2128h.dds\",\"gta3.img/archbrij.txd/conc_wall_stripd2128h.dds\",\n \"gta3.img/cunteroads3.txd/conc_wall_stripd2128h.dds\",\"gta3.img/archbrij.txd/conc_wall_stripd2128h.dds\",\n \"gta3.img/hillcliff_lahills.txd/conc_wall_stripd2128h.dds\",\"gta3.img/archbrij.txd/conc_wall_stripd2128h.dds\",\n \"gta3.img/lahills_safe1.txd/conc_wall_stripd2128h.dds\",\"gta3.img/archbrij.txd/conc_wall_stripd2128h.dds\",\n \"gta3.img/sfn_helipad.txd/conc_wall_stripd2128h.dds\",\"gta3.img/archbrij.txd/conc_wall_stripd2128h.dds\",\n \"gta3.img/smallertxd.txd/sfe_bigbuild2.dds\",\"gta3.img/archybuild10.txd/sfe_bigbuild2.dds\",\n \"gta3.img/fishwarf.txd/sf_windos_15.dds\",\"gta3.img/archybuild10.txd/sf_windos_15.dds\",\n \"gta3.img/lngblok_lae2.txd/sf_windos_15.dds\",\"gta3.img/archybuild10.txd/sf_windos_15.dds\",\n \"gta3.img/smallertxd.txd/sf_windos_15.dds\",\"gta3.img/archybuild10.txd/sf_windos_15.dds\",\n \"gta3.img/fishwarf.txd/sf_windos_15b.dds\",\"gta3.img/archybuild10.txd/sf_windos_15b.dds\",\n \"gta3.img/gangblok1_lae2.txd/sf_windos_15b.dds\",\"gta3.img/archybuild10.txd/sf_windos_15b.dds\",\n \"gta3.img/smallertxd.txd/sf_windos_15b.dds\",\"gta3.img/archybuild10.txd/sf_windos_15b.dds\",\n \"gta3.img/sfe_builda.txd/sf_windos_7.dds\",\"gta3.img/archybuild10.txd/sf_windos_7.dds\",\n \"gta3.img/blokmodb.txd/whitedecosfe3.dds\",\"gta3.img/archybuild10.txd/whitedecosfe3.dds\",\n \"gta3.img/slapart01sfe.txd/whitedecosfe3.dds\",\"gta3.img/archybuild10.txd/whitedecosfe3.dds\",\n \"gta3.img/smallertxd.txd/whitedecosfe3.dds\",\"gta3.img/archybuild10.txd/whitedecosfe3.dds\",\n \"gta3.img/blokmodb.txd/sf_shop2.dds\",\"gta3.img/archybuild10.txd/sf_shop2.dds\",\n \"gta3.img/chinatownmall.txd/sf_shop2.dds\",\"gta3.img/archybuild10.txd/sf_shop2.dds\",\n \"gta3.img/pier69.txd/sf_shop2.dds\",\"gta3.img/archybuild10.txd/sf_shop2.dds\",\n \"gta3.img/slapart01sfe.txd/sf_shop2.dds\",\"gta3.img/archybuild10.txd/sf_shop2.dds\",\n \"gta3.img/smallertxd.txd/sf_shop2.dds\",\"gta3.img/archybuild10.txd/sf_shop2.dds\",\n \"gta3.img/bigwhitesfe.txd/stonesteps1.dds\",\"gta3.img/archybuild10.txd/stonesteps1.dds\",\n \"gta3.img/chinatownsfe.txd/stonesteps1.dds\",\"gta3.img/archybuild10.txd/stonesteps1.dds\",\n \"gta3.img/churchsfe.txd/stonesteps1.dds\",\"gta3.img/archybuild10.txd/stonesteps1.dds\",\n \"gta3.img/copshop_sfe.txd/stonesteps1.dds\",\"gta3.img/archybuild10.txd/stonesteps1.dds\",\n \"gta3.img/fishwarf.txd/stonesteps1.dds\",\"gta3.img/archybuild10.txd/stonesteps1.dds\",\n \"gta3.img/lomall.txd/stonesteps1.dds\",\"gta3.img/archybuild10.txd/stonesteps1.dds\",\n \"gta3.img/sfe_park1.txd/stonesteps1.dds\",\"gta3.img/archybuild10.txd/stonesteps1.dds\",\n \"gta3.img/smallertxd.txd/stonesteps1.dds\",\"gta3.img/archybuild10.txd/stonesteps1.dds\",\n \"gta3.img/venice_law.txd/stonesteps1.dds\",\"gta3.img/archybuild10.txd/stonesteps1.dds\",\n \"gta3.img/vgntrainstat.txd/stonesteps1.dds\",\"gta3.img/archybuild10.txd/stonesteps1.dds\",\n \"gta3.img/calfed_sfe.txd/rooftop_gz3.dds\",\"gta3.img/archybuild10.txd/rooftop_gz3.dds\",\n \"gta3.img/chinatownsfe.txd/rooftop_gz3.dds\",\"gta3.img/archybuild10.txd/rooftop_gz3.dds\",\n \"gta3.img/copshop_sfe.txd/rooftop_gz3.dds\",\"gta3.img/archybuild10.txd/rooftop_gz3.dds\",\n \"gta3.img/ferry_building.txd/rooftop_gz3.dds\",\"gta3.img/archybuild10.txd/rooftop_gz3.dds\",\n \"gta3.img/monlith_sfe.txd/rooftop_gz3.dds\",\"gta3.img/archybuild10.txd/rooftop_gz3.dds\",\n \"gta3.img/moregenroofstuff.txd/rooftop_gz3.dds\",\"gta3.img/archybuild10.txd/rooftop_gz3.dds\",\n \"gta3.img/pier69.txd/rooftop_gz3.dds\",\"gta3.img/archybuild10.txd/rooftop_gz3.dds\",\n \"gta3.img/sfe_builda.txd/rooftop_gz3.dds\",\"gta3.img/archybuild10.txd/rooftop_gz3.dds\",\n \"gta3.img/sfvictorian.txd/rooftop_gz3.dds\",\"gta3.img/archybuild10.txd/rooftop_gz3.dds\",\n \"gta3.img/vgnhelipad1.txd/rooftop_gz3.dds\",\"gta3.img/archybuild10.txd/rooftop_gz3.dds\",\n \"gta3.img/copshop_sfe.txd/copshop5.dds\",\"gta3.img/archybuild10.txd/copshop5.dds\",\n \"gta3.img/fishwarf.txd/copshop5.dds\",\"gta3.img/archybuild10.txd/copshop5.dds\",\n \"gta3.img/ggatepark.txd/copshop5.dds\",\"gta3.img/archybuild10.txd/copshop5.dds\",\n \"gta3.img/copshop_sfe.txd/copshop3.dds\",\"gta3.img/archybuild10.txd/copshop3.dds\",\n \"gta3.img/fishwarf.txd/copshop3.dds\",\"gta3.img/archybuild10.txd/copshop3.dds\",\n \"gta3.img/ggatepark.txd/copshop3.dds\",\"gta3.img/archybuild10.txd/copshop3.dds\",\n \"gta3.img/hosbibalsfw.txd/copshop3.dds\",\"gta3.img/archybuild10.txd/copshop3.dds\",\n \"gta3.img/copshop_sfe.txd/copshop2.dds\",\"gta3.img/archybuild10.txd/copshop2.dds\",\n \"gta3.img/bigoldbuild_sfe.txd/bank_sfe5.dds\",\"gta3.img/archybuild10.txd/bank_sfe5.dds\",\n \"gta3.img/bigoldbuild_sfe.txd/bank_sfe2.dds\",\"gta3.img/archybuild10.txd/bank_sfe2.dds\",\n \"gta3.img/boigas_sfw.txd/upt_conc=floorclean.dds\",\"gta3.img/archybuild10.txd/upt_conc=floorclean.dds\",\n \"gta3.img/chinatownsfe.txd/upt_conc=floorclean.dds\",\"gta3.img/archybuild10.txd/upt_conc=floorclean.dds\",\n \"gta3.img/ci_studio5.txd/upt_conc=floorclean.dds\",\"gta3.img/archybuild10.txd/upt_conc=floorclean.dds\",\n \"gta3.img/ci_studio.txd/upt_conc=floorclean.dds\",\"gta3.img/archybuild10.txd/upt_conc=floorclean.dds\",\n \"gta3.img/compomark_lae2.txd/upt_conc=floorclean.dds\",\"gta3.img/archybuild10.txd/upt_conc=floorclean.dds\",\n \"gta3.img/cw_motel2cs_t.txd/upt_conc=floorclean.dds\",\"gta3.img/archybuild10.txd/upt_conc=floorclean.dds\",\n \"gta3.img/des_nwtown.txd/upt_conc=floorclean.dds\",\"gta3.img/archybuild10.txd/upt_conc=floorclean.dds\",\n \"gta3.img/docks_las2.txd/upt_conc=floorclean.dds\",\"gta3.img/archybuild10.txd/upt_conc=floorclean.dds\",\n \"gta3.img/hashblock1_sfs.txd/upt_conc=floorclean.dds\",\"gta3.img/archybuild10.txd/upt_conc=floorclean.dds\",\n \"gta3.img/lasxrefdock.txd/upt_conc=floorclean.dds\",\"gta3.img/archybuild10.txd/upt_conc=floorclean.dds\",\n \"gta3.img/lombard.txd/upt_conc=floorclean.dds\",\"gta3.img/archybuild10.txd/upt_conc=floorclean.dds\",\n \"gta3.img/nicepark_sfe.txd/upt_conc=floorclean.dds\",\"gta3.img/archybuild10.txd/upt_conc=floorclean.dds\",\n \"gta3.img/smallertxd.txd/upt_conc=floorclean.dds\",\"gta3.img/archybuild10.txd/upt_conc=floorclean.dds\",\n \"gta3.img/sw_fact01a.txd/upt_conc=floorclean.dds\",\"gta3.img/archybuild10.txd/upt_conc=floorclean.dds\",\n \"gta3.img/bigoldbuild_sfe.txd/copshop6.dds\",\"gta3.img/archybuild10.txd/copshop6.dds\",\n \"gta3.img/copshop_sfe.txd/copshop6.dds\",\"gta3.img/archybuild10.txd/copshop6.dds\",\n \"gta3.img/gazlaw3.txd/copshop6.dds\",\"gta3.img/archybuild10.txd/copshop6.dds\",\n \"gta3.img/ggatepark.txd/copshop6.dds\",\"gta3.img/archybuild10.txd/copshop6.dds\",\n \"gta3.img/blokmodb.txd/whitedecosfe4.dds\",\"gta3.img/archybuild10.txd/whitedecosfe4.dds\",\n \"gta3.img/fishwarf.txd/whitedecosfe4.dds\",\"gta3.img/archybuild10.txd/whitedecosfe4.dds\",\n \"gta3.img/slapart01sfe.txd/whitedecosfe4.dds\",\"gta3.img/archybuild10.txd/whitedecosfe4.dds\",\n \"gta3.img/smallertxd.txd/whitedecosfe4.dds\",\"gta3.img/archybuild10.txd/whitedecosfe4.dds\",\n \"gta3.img/smallertxd.txd/hotel_bit2.dds\",\"gta3.img/archybuild10.txd/hotel_bit2.dds\",\n \"gta3.img/blokmodb.txd/whitedecosfe1.dds\",\"gta3.img/archybuild10.txd/whitedecosfe1.dds\",\n \"gta3.img/fishwarf.txd/whitedecosfe1.dds\",\"gta3.img/archybuild10.txd/whitedecosfe1.dds\",\n \"gta3.img/slapart01sfe.txd/whitedecosfe1.dds\",\"gta3.img/archybuild10.txd/whitedecosfe1.dds\",\n \"gta3.img/smallertxd.txd/whitedecosfe1.dds\",\"gta3.img/archybuild10.txd/whitedecosfe1.dds\",\n \"gta3.img/blokmodb.txd/whitedecosfe2.dds\",\"gta3.img/archybuild10.txd/whitedecosfe2.dds\",\n \"gta3.img/fishwarf.txd/whitedecosfe2.dds\",\"gta3.img/archybuild10.txd/whitedecosfe2.dds\",\n \"gta3.img/slapart01sfe.txd/whitedecosfe2.dds\",\"gta3.img/archybuild10.txd/whitedecosfe2.dds\",\n \"gta3.img/smallertxd.txd/whitedecosfe2.dds\",\"gta3.img/archybuild10.txd/whitedecosfe2.dds\",\n \"gta3.img/boigas_sfw.txd/vgnburgwal5_256.dds\",\"gta3.img/archybuild10.txd/vgnburgwal5_256.dds\",\n \"gta3.img/bs_sfs.txd/vgnburgwal5_256.dds\",\"gta3.img/archybuild10.txd/vgnburgwal5_256.dds\",\n \"gta3.img/cluckbell_sfs.txd/vgnburgwal5_256.dds\",\"gta3.img/archybuild10.txd/vgnburgwal5_256.dds\",\n \"gta3.img/lawnburg.txd/vgnburgwal5_256.dds\",\"gta3.img/archybuild10.txd/vgnburgwal5_256.dds\",\n \"gta3.img/vgnboiga1.txd/vgnburgwal5_256.dds\",\"gta3.img/archybuild10.txd/vgnburgwal5_256.dds\",\n \"gta3.img/vgndwntwn23.txd/vgnburgwal5_256.dds\",\"gta3.img/archybuild10.txd/vgnburgwal5_256.dds\",\n \"gta3.img/vgwestboiga1.txd/vgnburgwal5_256.dds\",\"gta3.img/archybuild10.txd/vgnburgwal5_256.dds\",\n \"gta3.img/bigoldbuild_sfe.txd/vgnburgwal4_128.dds\",\"gta3.img/archybuild10.txd/vgnburgwal4_128.dds\",\n \"gta3.img/boigas_sfw.txd/vgnburgwal4_128.dds\",\"gta3.img/archybuild10.txd/vgnburgwal4_128.dds\",\n \"gta3.img/bs_sfs.txd/vgnburgwal4_128.dds\",\"gta3.img/archybuild10.txd/vgnburgwal4_128.dds\",\n \"gta3.img/cluckbell_sfs.txd/vgnburgwal4_128.dds\",\"gta3.img/archybuild10.txd/vgnburgwal4_128.dds\",\n \"gta3.img/lawnburg.txd/vgnburgwal4_128.dds\",\"gta3.img/archybuild10.txd/vgnburgwal4_128.dds\",\n \"gta3.img/vgnboiga1.txd/vgnburgwal4_128.dds\",\"gta3.img/archybuild10.txd/vgnburgwal4_128.dds\",\n \"gta3.img/vgwestboiga1.txd/vgnburgwal4_128.dds\",\"gta3.img/archybuild10.txd/vgnburgwal4_128.dds\",\n \"gta3.img/icons7.txd/gun_armour.dds\",\"gta3.img/armour.txd/gun_armour.dds\",\n \"gta3.img/lashops1b_las2.txd/dirtywhite.dds\",\"gta3.img/arprtxxref_las.txd/dirtywhite.dds\",\n \"gta3.img/santamonicalaw2a.txd/dirtywhite.dds\",\"gta3.img/arprtxxref_las.txd/dirtywhite.dds\",\n \"gta3.img/vegasarrows.txd/dirtywhite.dds\",\"gta3.img/arprtxxref_las.txd/dirtywhite.dds\",\n \"gta3.img/vgshpground.txd/dirtywhite.dds\",\"gta3.img/arprtxxref_las.txd/dirtywhite.dds\",\n \"gta3.img/vgsshospshop.txd/dirtywhite.dds\",\"gta3.img/arprtxxref_las.txd/dirtywhite.dds\",\n \"gta3.img/cistudiolod2.txd/chevron_lod.dds\",\"gta3.img/arprtxxref_las.txd/chevron64hva.dds\",\n \"gta3.img/lodvgsslod01.txd/chevron_lod.dds\",\"gta3.img/arprtxxref_las.txd/chevron64hva.dds\",\n \"gta3.img/vegasairprtland.txd/chevron64hva.dds\",\"gta3.img/arprtxxref_las.txd/chevron64hva.dds\",\n \"gta3.img/vegasairprtland.txd/dustytar_64hv.dds\",\"gta3.img/arprtxxref_las.txd/dustytar_64hv.dds\",\n \"gta3.img/docks2_sfse.txd/corrroof_64hv.dds\",\"gta3.img/arprtxxref_las.txd/corrroof_64hv.dds\",\n \"gta3.img/metalbarrier.txd/corrroof_64hv.dds\",\"gta3.img/arprtxxref_las.txd/corrroof_64hv.dds\",\n \"gta3.img/sawmillcs_t.txd/corrroof_64hv.dds\",\"gta3.img/arprtxxref_las.txd/corrroof_64hv.dds\",\n \"gta3.img/vegasairprtland.txd/corrroof_64hv.dds\",\"gta3.img/arprtxxref_las.txd/corrroof_64hv.dds\",\n \"gta3.img/vgssairport.txd/corrroof_64hv.dds\",\"gta3.img/arprtxxref_las.txd/corrroof_64hv.dds\",\n \"gta3.img/vgsswarhse04.txd/corrroof_64hv.dds\",\"gta3.img/arprtxxref_las.txd/corrroof_64hv.dds\",\n \"gta3.img/ce_oldbridge.txd/rustybolts.dds\",\"gta3.img/arprtxxref_las.txd/rustybolts.dds\",\n \"gta3.img/dockcargo2_las.txd/lastrk6.dds\",\"gta3.img/arprtxxref_las.txd/lastrk6.dds\",\n \"gta3.img/imrancompyard_las.txd/lastrk6.dds\",\"gta3.img/arprtxxref_las.txd/lastrk6.dds\",\n \"gta3.img/hangar1_sfxref.txd/ws_corrugateddoor1.dds\",\"gta3.img/arprtxxref_las.txd/ws_corrugateddoor1.dds\",\n \"gta3.img/railway_las.txd/ws_corrugateddoor1.dds\",\"gta3.img/arprtxxref_las.txd/ws_corrugateddoor1.dds\",\n \"gta3.img/stuff2_sfn.txd/ws_corrugateddoor1.dds\",\"gta3.img/arprtxxref_las.txd/ws_corrugateddoor1.dds\",\n \"gta3.img/vegasshangar.txd/ws_corrugateddoor1.dds\",\"gta3.img/arprtxxref_las.txd/ws_corrugateddoor1.dds\",\n \"gta3.img/cityhall_sfs.txd/grn_window2_16.dds\",\"gta3.img/arprtxxref_las.txd/grn_window2_16.dds\",\n \"gta3.img/factory_sfse.txd/grn_window2_16.dds\",\"gta3.img/arprtxxref_las.txd/grn_window2_16.dds\",\n \"gta3.img/gardencentre_sfs.txd/grn_window2_16.dds\",\"gta3.img/arprtxxref_las.txd/grn_window2_16.dds\",\n \"gta3.img/hangar1_sfxref.txd/grn_window2_16.dds\",\"gta3.img/arprtxxref_las.txd/grn_window2_16.dds\",\n \"gta3.img/sancliff02_law2.txd/grn_window2_16.dds\",\"gta3.img/arprtxxref_las.txd/grn_window2_16.dds\",\n \"gta3.img/subshops_sfs.txd/grn_window2_16.dds\",\"gta3.img/arprtxxref_las.txd/grn_window2_16.dds\",\n \"gta3.img/vegasshangar.txd/grn_window2_16.dds\",\"gta3.img/arprtxxref_las.txd/grn_window2_16.dds\",\n \"gta3.img/vgnpwrmainbld.txd/grn_window2_16.dds\",\"gta3.img/arprtxxref_las.txd/grn_window2_16.dds\",\n \"gta3.img/cunte_lik.txd/ws_corrugated2.dds\",\"gta3.img/arprtxxref_las.txd/ws_corrugated2.dds\",\n \"gta3.img/cuntwbt.txd/ws_corrugated2.dds\",\"gta3.img/arprtxxref_las.txd/ws_corrugated2.dds\",\n \"gta3.img/cuntwf.txd/ws_corrugated2.dds\",\"gta3.img/arprtxxref_las.txd/ws_corrugated2.dds\",\n \"gta3.img/cuntwshopscs_t.txd/ws_corrugated2.dds\",\"gta3.img/arprtxxref_las.txd/ws_corrugated2.dds\",\n \"gta3.img/des_bigearstuff.txd/ws_corrugated2.dds\",\"gta3.img/arprtxxref_las.txd/ws_corrugated2.dds\",\n \"gta3.img/desn2_peckers.txd/ws_corrugated2.dds\",\"gta3.img/arprtxxref_las.txd/ws_corrugated2.dds\",\n \"gta3.img/des_stownmain3.txd/ws_corrugated2.dds\",\"gta3.img/arprtxxref_las.txd/ws_corrugated2.dds\",\n \"gta3.img/gravblok01_lahills.txd/ws_corrugated2.dds\",\"gta3.img/arprtxxref_las.txd/ws_corrugated2.dds\",\n \"gta3.img/hangar1_sfxref.txd/ws_corrugated2.dds\",\"gta3.img/arprtxxref_las.txd/ws_corrugated2.dds\",\n \"gta3.img/vegasshangar.txd/ws_corrugated2.dds\",\"gta3.img/arprtxxref_las.txd/ws_corrugated2.dds\",\n \"gta3.img/vgnptrlpmp.txd/ws_corrugated2.dds\",\"gta3.img/arprtxxref_las.txd/ws_corrugated2.dds\",\n \"gta3.img/vgslowbuild.txd/ws_corrugated2.dds\",\"gta3.img/arprtxxref_las.txd/ws_corrugated2.dds\",\n \"gta3.img/ce_fact01.txd/ws_corrugated1.dds\",\"gta3.img/arprtxxref_las.txd/ws_corrugated1.dds\",\n \"gta3.img/cuntwbt.txd/ws_corrugated1.dds\",\"gta3.img/arprtxxref_las.txd/ws_corrugated1.dds\",\n \"gta3.img/des_bigearstuff.txd/ws_corrugated1.dds\",\"gta3.img/arprtxxref_las.txd/ws_corrugated1.dds\",\n \"gta3.img/des_factory.txd/ws_corrugated1.dds\",\"gta3.img/arprtxxref_las.txd/ws_corrugated1.dds\",\n \"gta3.img/desn2_peckers.txd/ws_corrugated1.dds\",\"gta3.img/arprtxxref_las.txd/ws_corrugated1.dds\",\n \"gta3.img/des_ranch.txd/ws_corrugated1.dds\",\"gta3.img/arprtxxref_las.txd/ws_corrugated1.dds\",\n \"gta3.img/des_stownmain3.txd/ws_corrugated1.dds\",\"gta3.img/arprtxxref_las.txd/ws_corrugated1.dds\",\n \"gta3.img/des_stownw.txd/ws_corrugated1.dds\",\"gta3.img/arprtxxref_las.txd/ws_corrugated1.dds\",\n \"gta3.img/hangar1_sfxref.txd/ws_corrugated1.dds\",\"gta3.img/arprtxxref_las.txd/ws_corrugated1.dds\",\n \"gta3.img/stationsfse_1.txd/ws_corrugated1.dds\",\"gta3.img/arprtxxref_las.txd/ws_corrugated1.dds\",\n \"gta3.img/vegasshangar.txd/ws_corrugated1.dds\",\"gta3.img/arprtxxref_las.txd/ws_corrugated1.dds\",\n \"gta3.img/vgnpwrentrnce.txd/ws_corrugated1.dds\",\"gta3.img/arprtxxref_las.txd/ws_corrugated1.dds\",\n \"gta3.img/mall_law.txd/nopark128.dds\",\"gta3.img/arsex.txd/nopark128.dds\",\n \"gta3.img/stuff2_sfn.txd/nopark128.dds\",\"gta3.img/arsex.txd/nopark128.dds\",\n \"gta3.img/vgssairport02.txd/nopark128.dds\",\"gta3.img/arsex.txd/nopark128.dds\",\n \"gta3.img/artict2.txd/artict2_128x64.dds\",\"gta3.img/artict1.txd/artict1_128x64.dds\",\n \"gta3.img/artict3.txd/artict3_128x64.dds\",\"gta3.img/artict1.txd/artict1_128x64.dds\",\n \"gta3.img/artict2.txd/artict2wheel64.dds\",\"gta3.img/artict1.txd/artict1wheel64.dds\",\n \"gta3.img/artict3.txd/artict3wheel64.dds\",\"gta3.img/artict1.txd/artict1wheel64.dds\",\n \"gta3.img/bagboxa.txd/bagboxa92wheel.dds\",\"gta3.img/artict1.txd/artict1wheel64.dds\",\n \"gta3.img/bagboxb.txd/bagboxb92wheel.dds\",\"gta3.img/artict1.txd/artict1wheel64.dds\",\n \"gta3.img/baggage.txd/baggage92wheel.dds\",\"gta3.img/artict1.txd/artict1wheel64.dds\",\n \"gta3.img/cement.txd/cement92wheel.dds\",\"gta3.img/artict1.txd/artict1wheel64.dds\",\n \"gta3.img/dft30.txd/dft3092wheel64.dds\",\"gta3.img/artict1.txd/artict1wheel64.dds\",\n \"gta3.img/duneride.txd/dunerider92wheel.dds\",\"gta3.img/artict1.txd/artict1wheel64.dds\",\n \"gta3.img/firela.txd/firela92wheel64.dds\",\"gta3.img/artict1.txd/artict1wheel64.dds\",\n \"gta3.img/linerun.txd/linerun92wheel64.dds\",\"gta3.img/artict1.txd/artict1wheel64.dds\",\n \"gta3.img/packer.txd/packer92wheel.dds\",\"gta3.img/artict1.txd/artict1wheel64.dds\",\n \"gta3.img/petrotr.txd/petrotr92wheel.dds\",\"gta3.img/artict1.txd/artict1wheel64.dds\",\n \"gta3.img/petro.txd/petro92wheel.dds\",\"gta3.img/artict1.txd/artict1wheel64.dds\",\n \"gta3.img/swatvan.txd/swatvan92wheel.dds\",\"gta3.img/artict1.txd/artict1wheel64.dds\",\n \"gta3.img/tugstair.txd/tugstair92wheel.dds\",\"gta3.img/artict1.txd/artict1wheel64.dds\",\n \"gta3.img/tug.txd/tug92wheel.dds\",\"gta3.img/artict1.txd/artict1wheel64.dds\",\n \"gta3.img/cunteroads6.txd/retainwall1.dds\",\"gta3.img/backroad_sfs.txd/retainwall1.dds\",\n \"gta3.img/des_nw2.txd/retainwall1.dds\",\"gta3.img/backroad_sfs.txd/retainwall1.dds\",\n \"gta3.img/downtown1_las.txd/retainwall1.dds\",\"gta3.img/backroad_sfs.txd/retainwall1.dds\",\n \"gta3.img/downtown3_las.txd/retainwall1.dds\",\"gta3.img/backroad_sfs.txd/retainwall1.dds\",\n \"gta3.img/fedmint_sfs.txd/retainwall1.dds\",\"gta3.img/backroad_sfs.txd/retainwall1.dds\",\n \"gta3.img/griffobs_las.txd/retainwall1.dds\",\"gta3.img/backroad_sfs.txd/retainwall1.dds\",\n \"gta3.img/groundbit_sfs.txd/retainwall1.dds\",\"gta3.img/backroad_sfs.txd/retainwall1.dds\",\n \"gta3.img/hotelbackpool_sfs.txd/retainwall1.dds\",\"gta3.img/backroad_sfs.txd/retainwall1.dds\",\n \"gta3.img/lasroads_las.txd/retainwall1.dds\",\"gta3.img/backroad_sfs.txd/retainwall1.dds\",\n \"gta3.img/mullho03a_lahills.txd/retainwall1.dds\",\"gta3.img/backroad_sfs.txd/retainwall1.dds\",\n \"gta3.img/baseballground_sfs.txd/bow_church_dirt.dds\",\"gta3.img/backroad_sfs.txd/bow_church_dirt.dds\",\n \"gta3.img/canalsg_law.txd/bow_church_dirt.dds\",\"gta3.img/backroad_sfs.txd/bow_church_dirt.dds\",\n \"gta3.img/ce_ground04.txd/bow_church_dirt.dds\",\"gta3.img/backroad_sfs.txd/bow_church_dirt.dds\",\n \"gta3.img/ce_ground05.txd/bow_church_dirt.dds\",\"gta3.img/backroad_sfs.txd/bow_church_dirt.dds\",\n \"gta3.img/ce_ground07.txd/bow_church_dirt.dds\",\"gta3.img/backroad_sfs.txd/bow_church_dirt.dds\",\n \"gta3.img/ce_ground10.txd/bow_church_dirt.dds\",\"gta3.img/backroad_sfs.txd/bow_church_dirt.dds\",\n \"gta3.img/ce_ground14.txd/bow_church_dirt.dds\",\"gta3.img/backroad_sfs.txd/bow_church_dirt.dds\",\n \"gta3.img/cuntwlandse.txd/bow_church_dirt.dds\",\"gta3.img/backroad_sfs.txd/bow_church_dirt.dds\",\n \"gta3.img/eastbeach7_lae2.txd/bow_church_dirt.dds\",\"gta3.img/backroad_sfs.txd/bow_church_dirt.dds\",\n \"gta3.img/exclibrland.txd/bow_church_dirt.dds\",\"gta3.img/backroad_sfs.txd/bow_church_dirt.dds\",\n \"gta3.img/hotelbackpool_sfs.txd/bow_church_dirt.dds\",\"gta3.img/backroad_sfs.txd/bow_church_dirt.dds\",\n \"gta3.img/hubhole_sfse.txd/bow_church_dirt.dds\",\"gta3.img/backroad_sfs.txd/bow_church_dirt.dds\",\n \"gta3.img/hub_sfse.txd/bow_church_dirt.dds\",\"gta3.img/backroad_sfs.txd/bow_church_dirt.dds\",\n \"gta3.img/mission2_sfse.txd/bow_church_dirt.dds\",\"gta3.img/backroad_sfs.txd/bow_church_dirt.dds\",\n \"gta3.img/oc_flats_gnd_sfs.txd/bow_church_dirt.dds\",\"gta3.img/backroad_sfs.txd/bow_church_dirt.dds\",\n \"gta3.img/park_sfw.txd/bow_church_dirt.dds\",\"gta3.img/backroad_sfs.txd/bow_church_dirt.dds\",\n \"gta3.img/pier69.txd/bow_church_dirt.dds\",\"gta3.img/backroad_sfs.txd/bow_church_dirt.dds\",\n \"gta3.img/scum2_sfs.txd/bow_church_dirt.dds\",\"gta3.img/backroad_sfs.txd/bow_church_dirt.dds\",\n \"gta3.img/triadprops_lvs.txd/bow_church_dirt.dds\",\"gta3.img/backroad_sfs.txd/bow_church_dirt.dds\",\n \"gta3.img/vegashse2.txd/bow_church_dirt.dds\",\"gta3.img/backroad_sfs.txd/bow_church_dirt.dds\",\n \"gta3.img/vgnbball.txd/bow_church_dirt.dds\",\"gta3.img/backroad_sfs.txd/bow_church_dirt.dds\",\n \"gta3.img/vgndwntwn2.txd/bow_church_dirt.dds\",\"gta3.img/backroad_sfs.txd/bow_church_dirt.dds\",\n \"gta3.img/gta_deserttrees.txd/sm_des_bush1.dds\",\"gta3.img/badlands.txd/sm_des_bush1.dds\",\n \"gta3.img/gtarock_deserts.txd/sm_des_bush1.dds\",\"gta3.img/badlands.txd/sm_des_bush1.dds\",\n \"gta3.img/gtarock_deserts.txd/newtreeleaves128.dds\",\"gta3.img/badlands.txd/newtreeleaves128.dds\",\n \"gta3.img/gta_tree_bevhills.txd/newtreeleaves128.dds\",\"gta3.img/badlands.txd/newtreeleaves128.dds\",\n \"gta3.img/gta_tree_boak.txd/newtreeleaves128.dds\",\"gta3.img/badlands.txd/newtreeleaves128.dds\",\n \"gta3.img/bakerybit_sfse.txd/frate64_yellow.dds\",\"gta3.img/bakerybit2_sfse.txd/frate64_yellow.dds\",\n \"gta3.img/bigshap_sfw.txd/frate64_yellow.dds\",\"gta3.img/bakerybit2_sfse.txd/frate64_yellow.dds\",\n \"gta3.img/continx.txd/frate64_yellow.dds\",\"gta3.img/bakerybit2_sfse.txd/frate64_yellow.dds\",\n \"gta3.img/dkcargoshpe.txd/frate64_yellow.dds\",\"gta3.img/bakerybit2_sfse.txd/frate64_yellow.dds\",\n \"gta3.img/dkcargoshp.txd/frate64_yellow.dds\",\"gta3.img/bakerybit2_sfse.txd/frate64_yellow.dds\",\n \"gta3.img/factorycuntw.txd/frate64_yellow.dds\",\"gta3.img/bakerybit2_sfse.txd/frate64_yellow.dds\",\n \"gta3.img/freight_sfe.txd/frate64_yellow.dds\",\"gta3.img/bakerybit2_sfse.txd/frate64_yellow.dds\",\n \"gta3.img/frieghter2sfe.txd/frate64_yellow.dds\",\"gta3.img/bakerybit2_sfse.txd/frate64_yellow.dds\",\n \"gta3.img/lasxrefdock.txd/frate64_yellow.dds\",\"gta3.img/bakerybit2_sfse.txd/frate64_yellow.dds\",\n \"gta3.img/plantbox.txd/frate64_yellow.dds\",\"gta3.img/bakerybit2_sfse.txd/frate64_yellow.dds\",\n \"gta3.img/vegaswrehse1.txd/frate64_yellow.dds\",\"gta3.img/bakerybit2_sfse.txd/frate64_yellow.dds\",\n \"gta3.img/vgnfrates.txd/frate64_yellow.dds\",\"gta3.img/bakerybit2_sfse.txd/frate64_yellow.dds\",\n \"gta3.img/vgnpwroutbld3.txd/frate64_yellow.dds\",\"gta3.img/bakerybit2_sfse.txd/frate64_yellow.dds\",\n \"gta3.img/vgsefreight.txd/frate64_yellow.dds\",\"gta3.img/bakerybit2_sfse.txd/frate64_yellow.dds\",\n \"gta3.img/vgsswarehse01.txd/frate64_yellow.dds\",\"gta3.img/bakerybit2_sfse.txd/frate64_yellow.dds\",\n \"gta3.img/vgsswarehse02b.txd/frate64_yellow.dds\",\"gta3.img/bakerybit2_sfse.txd/frate64_yellow.dds\",\n \"gta3.img/vgsswarehse02.txd/frate64_yellow.dds\",\"gta3.img/bakerybit2_sfse.txd/frate64_yellow.dds\",\n \"gta3.img/vgsswrehse03.txd/frate64_yellow.dds\",\"gta3.img/bakerybit2_sfse.txd/frate64_yellow.dds\",\n \"gta3.img/vgwestoutwn2.txd/frate64_yellow.dds\",\"gta3.img/bakerybit2_sfse.txd/frate64_yellow.dds\",\n \"gta3.img/bakerybit_sfse.txd/frate_doors64yellow.dds\",\"gta3.img/bakerybit2_sfse.txd/frate_doors64yellow.dds\",\n \"gta3.img/bigshap_sfw.txd/frate_doors64yellow.dds\",\"gta3.img/bakerybit2_sfse.txd/frate_doors64yellow.dds\",\n \"gta3.img/continx.txd/frate_doors64yellow.dds\",\"gta3.img/bakerybit2_sfse.txd/frate_doors64yellow.dds\",\n \"gta3.img/dkcargoshpe.txd/frate_doors64yellow.dds\",\"gta3.img/bakerybit2_sfse.txd/frate_doors64yellow.dds\",\n \"gta3.img/dkcargoshp.txd/frate_doors64yellow.dds\",\"gta3.img/bakerybit2_sfse.txd/frate_doors64yellow.dds\",\n \"gta3.img/factorycuntw.txd/frate_doors64yellow.dds\",\"gta3.img/bakerybit2_sfse.txd/frate_doors64yellow.dds\",\n \"gta3.img/freight_sfe.txd/frate_doors64yellow.dds\",\"gta3.img/bakerybit2_sfse.txd/frate_doors64yellow.dds\",\n \"gta3.img/frieghter2sfe.txd/frate_doors64yellow.dds\",\"gta3.img/bakerybit2_sfse.txd/frate_doors64yellow.dds\",\n \"gta3.img/lasxrefdock.txd/frate_doors64yellow.dds\",\"gta3.img/bakerybit2_sfse.txd/frate_doors64yellow.dds\",\n \"gta3.img/plantbox.txd/frate_doors64yellow.dds\",\"gta3.img/bakerybit2_sfse.txd/frate_doors64yellow.dds\",\n \"gta3.img/vegaswrehse1.txd/frate_doors64yellow.dds\",\"gta3.img/bakerybit2_sfse.txd/frate_doors64yellow.dds\",\n \"gta3.img/vgnfrates.txd/frate_doors64yellow.dds\",\"gta3.img/bakerybit2_sfse.txd/frate_doors64yellow.dds\",\n \"gta3.img/vgnpwroutbld3.txd/frate_doors64yellow.dds\",\"gta3.img/bakerybit2_sfse.txd/frate_doors64yellow.dds\",\n \"gta3.img/vgsefreight.txd/frate_doors64yellow.dds\",\"gta3.img/bakerybit2_sfse.txd/frate_doors64yellow.dds\",\n \"gta3.img/vgsswarehse01.txd/frate_doors64yellow.dds\",\"gta3.img/bakerybit2_sfse.txd/frate_doors64yellow.dds\",\n \"gta3.img/vgsswarehse02b.txd/frate_doors64yellow.dds\",\"gta3.img/bakerybit2_sfse.txd/frate_doors64yellow.dds\",\n \"gta3.img/vgsswarehse02.txd/frate_doors64yellow.dds\",\"gta3.img/bakerybit2_sfse.txd/frate_doors64yellow.dds\",\n \"gta3.img/vgsswrehse03.txd/frate_doors64yellow.dds\",\"gta3.img/bakerybit2_sfse.txd/frate_doors64yellow.dds\",\n \"gta3.img/vgwestoutwn2.txd/frate_doors64yellow.dds\",\"gta3.img/bakerybit2_sfse.txd/frate_doors64yellow.dds\",\n \"gta3.img/bakerybit_sfse.txd/frate_doors64.dds\",\"gta3.img/bakerybit2_sfse.txd/frate_doors64.dds\",\n \"gta3.img/bigshap_sfw.txd/frate_doors64.dds\",\"gta3.img/bakerybit2_sfse.txd/frate_doors64.dds\",\n \"gta3.img/continbx.txd/frate_doors64.dds\",\"gta3.img/bakerybit2_sfse.txd/frate_doors64.dds\",\n \"gta3.img/continx.txd/frate_doors64.dds\",\"gta3.img/bakerybit2_sfse.txd/frate_doors64.dds\",\n \"gta3.img/dkcargoshpe.txd/frate_doors64.dds\",\"gta3.img/bakerybit2_sfse.txd/frate_doors64.dds\",\n \"gta3.img/dkcargoshp.txd/frate_doors64.dds\",\"gta3.img/bakerybit2_sfse.txd/frate_doors64.dds\",\n \"gta3.img/freight_sfe.txd/frate_doors64.dds\",\"gta3.img/bakerybit2_sfse.txd/frate_doors64.dds\",\n \"gta3.img/lasxrefdock.txd/frate_doors64.dds\",\"gta3.img/bakerybit2_sfse.txd/frate_doors64.dds\",\n \"gta3.img/bakerybit_sfse.txd/frate64_blue.dds\",\"gta3.img/bakerybit2_sfse.txd/frate64_blue.dds\",\n \"gta3.img/bigshap_sfw.txd/frate64_blue.dds\",\"gta3.img/bakerybit2_sfse.txd/frate64_blue.dds\",\n \"gta3.img/continbx.txd/frate64_blue.dds\",\"gta3.img/bakerybit2_sfse.txd/frate64_blue.dds\",\n \"gta3.img/continx.txd/frate64_blue.dds\",\"gta3.img/bakerybit2_sfse.txd/frate64_blue.dds\",\n \"gta3.img/dkcargoshpe.txd/frate64_blue.dds\",\"gta3.img/bakerybit2_sfse.txd/frate64_blue.dds\",\n \"gta3.img/dkcargoshp.txd/frate64_blue.dds\",\"gta3.img/bakerybit2_sfse.txd/frate64_blue.dds\",\n \"gta3.img/factorycuntw.txd/frate64_blue.dds\",\"gta3.img/bakerybit2_sfse.txd/frate64_blue.dds\",\n \"gta3.img/freight_sfe.txd/frate64_blue.dds\",\"gta3.img/bakerybit2_sfse.txd/frate64_blue.dds\",\n \"gta3.img/lasxrefdock.txd/frate64_blue.dds\",\"gta3.img/bakerybit2_sfse.txd/frate64_blue.dds\",\n \"gta3.img/plantbox.txd/frate64_blue.dds\",\"gta3.img/bakerybit2_sfse.txd/frate64_blue.dds\",\n \"gta3.img/vegaswrehse1.txd/frate64_blue.dds\",\"gta3.img/bakerybit2_sfse.txd/frate64_blue.dds\",\n \"gta3.img/vgnfrates.txd/frate64_blue.dds\",\"gta3.img/bakerybit2_sfse.txd/frate64_blue.dds\",\n \"gta3.img/vgnpwroutbld3.txd/frate64_blue.dds\",\"gta3.img/bakerybit2_sfse.txd/frate64_blue.dds\",\n \"gta3.img/vgsefreight.txd/frate64_blue.dds\",\"gta3.img/bakerybit2_sfse.txd/frate64_blue.dds\",\n \"gta3.img/vgsswarehse01.txd/frate64_blue.dds\",\"gta3.img/bakerybit2_sfse.txd/frate64_blue.dds\",\n \"gta3.img/vgsswarehse02b.txd/frate64_blue.dds\",\"gta3.img/bakerybit2_sfse.txd/frate64_blue.dds\",\n \"gta3.img/vgsswarehse02.txd/frate64_blue.dds\",\"gta3.img/bakerybit2_sfse.txd/frate64_blue.dds\",\n \"gta3.img/vgsswrehse03.txd/frate64_blue.dds\",\"gta3.img/bakerybit2_sfse.txd/frate64_blue.dds\",\n \"gta3.img/vgwestoutwn2.txd/frate64_blue.dds\",\"gta3.img/bakerybit2_sfse.txd/frate64_blue.dds\",\n \"gta3.img/bakerybit_sfse.txd/frate64_red.dds\",\"gta3.img/bakerybit2_sfse.txd/frate64_red.dds\",\n \"gta3.img/bigshap_sfw.txd/frate64_red.dds\",\"gta3.img/bakerybit2_sfse.txd/frate64_red.dds\",\n \"gta3.img/continx.txd/frate64_red.dds\",\"gta3.img/bakerybit2_sfse.txd/frate64_red.dds\",\n \"gta3.img/dkcargoshpe.txd/frate64_red.dds\",\"gta3.img/bakerybit2_sfse.txd/frate64_red.dds\",\n \"gta3.img/dkcargoshp.txd/frate64_red.dds\",\"gta3.img/bakerybit2_sfse.txd/frate64_red.dds\",\n \"gta3.img/factorycuntw.txd/frate64_red.dds\",\"gta3.img/bakerybit2_sfse.txd/frate64_red.dds\",\n \"gta3.img/freight_sfe.txd/frate64_red.dds\",\"gta3.img/bakerybit2_sfse.txd/frate64_red.dds\",\n \"gta3.img/lasxrefdock.txd/frate64_red.dds\",\"gta3.img/bakerybit2_sfse.txd/frate64_red.dds\",\n \"gta3.img/plantbox.txd/frate64_red.dds\",\"gta3.img/bakerybit2_sfse.txd/frate64_red.dds\",\n \"gta3.img/vegaswrehse1.txd/frate64_red.dds\",\"gta3.img/bakerybit2_sfse.txd/frate64_red.dds\",\n \"gta3.img/vgnfrates.txd/frate64_red.dds\",\"gta3.img/bakerybit2_sfse.txd/frate64_red.dds\",\n \"gta3.img/vgsefreight.txd/frate64_red.dds\",\"gta3.img/bakerybit2_sfse.txd/frate64_red.dds\",\n \"gta3.img/vgsswarehse01.txd/frate64_red.dds\",\"gta3.img/bakerybit2_sfse.txd/frate64_red.dds\",\n \"gta3.img/vgsswarehse02b.txd/frate64_red.dds\",\"gta3.img/bakerybit2_sfse.txd/frate64_red.dds\",\n \"gta3.img/vgsswarehse02.txd/frate64_red.dds\",\"gta3.img/bakerybit2_sfse.txd/frate64_red.dds\",\n \"gta3.img/vgsswrehse03.txd/frate64_red.dds\",\"gta3.img/bakerybit2_sfse.txd/frate64_red.dds\",\n \"gta3.img/vgwestoutwn2.txd/frate64_red.dds\",\"gta3.img/bakerybit2_sfse.txd/frate64_red.dds\",\n \"gta_int.img/cj_chris.txd/frate64_red.dds\",\"gta3.img/bakerybit2_sfse.txd/frate64_red.dds\",\n \"gta3.img/bakerybit_sfse.txd/frate_doors128red.dds\",\"gta3.img/bakerybit2_sfse.txd/frate_doors128red.dds\",\n \"gta3.img/bigshap_sfw.txd/frate_doors128red.dds\",\"gta3.img/bakerybit2_sfse.txd/frate_doors128red.dds\",\n \"gta3.img/continx.txd/frate_doors128red.dds\",\"gta3.img/bakerybit2_sfse.txd/frate_doors128red.dds\",\n \"gta3.img/dkcargoshpe.txd/frate_doors128red.dds\",\"gta3.img/bakerybit2_sfse.txd/frate_doors128red.dds\",\n \"gta3.img/dkcargoshp.txd/frate_doors128red.dds\",\"gta3.img/bakerybit2_sfse.txd/frate_doors128red.dds\",\n \"gta3.img/factorycuntw.txd/frate_doors128red.dds\",\"gta3.img/bakerybit2_sfse.txd/frate_doors128red.dds\",\n \"gta3.img/freight_sfe.txd/frate_doors128red.dds\",\"gta3.img/bakerybit2_sfse.txd/frate_doors128red.dds\",\n \"gta3.img/lasxrefdock.txd/frate_doors128red.dds\",\"gta3.img/bakerybit2_sfse.txd/frate_doors128red.dds\",\n \"gta3.img/plantbox.txd/frate_doors128red.dds\",\"gta3.img/bakerybit2_sfse.txd/frate_doors128red.dds\",\n \"gta3.img/vegaswrehse1.txd/frate_doors128red.dds\",\"gta3.img/bakerybit2_sfse.txd/frate_doors128red.dds\",\n \"gta3.img/vgnfrates.txd/frate_doors128red.dds\",\"gta3.img/bakerybit2_sfse.txd/frate_doors128red.dds\",\n \"gta3.img/vgsefreight.txd/frate_doors128red.dds\",\"gta3.img/bakerybit2_sfse.txd/frate_doors128red.dds\",\n \"gta3.img/vgsswarehse01.txd/frate_doors128red.dds\",\"gta3.img/bakerybit2_sfse.txd/frate_doors128red.dds\",\n \"gta3.img/vgsswarehse02b.txd/frate_doors128red.dds\",\"gta3.img/bakerybit2_sfse.txd/frate_doors128red.dds\",\n \"gta3.img/vgsswarehse02.txd/frate_doors128red.dds\",\"gta3.img/bakerybit2_sfse.txd/frate_doors128red.dds\",\n \"gta3.img/vgsswrehse03.txd/frate_doors128red.dds\",\"gta3.img/bakerybit2_sfse.txd/frate_doors128red.dds\",\n \"gta3.img/vgwestoutwn2.txd/frate_doors128red.dds\",\"gta3.img/bakerybit2_sfse.txd/frate_doors128red.dds\",\n \"gta_int.img/cj_chris.txd/frate_doors128red.dds\",\"gta3.img/bakerybit2_sfse.txd/frate_doors128red.dds\",\n \"gta3.img/bakerybit_sfse.txd/gb_truckdepot29.dds\",\"gta3.img/bakerybit2_sfse.txd/gb_truckdepot29.dds\",\n \"gta3.img/barrio1_lae.txd/gb_truckdepot29.dds\",\"gta3.img/bakerybit2_sfse.txd/gb_truckdepot29.dds\",\n \"gta3.img/boxybld2_sfw.txd/gb_truckdepot29.dds\",\"gta3.img/bakerybit2_sfse.txd/gb_truckdepot29.dds\",\n \"gta3.img/ce_fact03.txd/gb_truckdepot29.dds\",\"gta3.img/bakerybit2_sfse.txd/gb_truckdepot29.dds\",\n \"gta3.img/csrspalace02.txd/gb_truckdepot29.dds\",\"gta3.img/bakerybit2_sfse.txd/gb_truckdepot29.dds\",\n \"gta3.img/gazsfn1.txd/gb_truckdepot29.dds\",\"gta3.img/bakerybit2_sfse.txd/gb_truckdepot29.dds\",\n \"gta3.img/industry3_las2.txd/gb_truckdepot29.dds\",\"gta3.img/bakerybit2_sfse.txd/gb_truckdepot29.dds\",\n \"gta3.img/lan2_gm1.txd/gb_truckdepot29.dds\",\"gta3.img/bakerybit2_sfse.txd/gb_truckdepot29.dds\",\n \"gta3.img/lanblokc.txd/gb_truckdepot29.dds\",\"gta3.img/bakerybit2_sfse.txd/gb_truckdepot29.dds\",\n \"gta3.img/sw_fact01.txd/gb_truckdepot29.dds\",\"gta3.img/bakerybit2_sfse.txd/gb_truckdepot29.dds\",\n \"gta3.img/vgncircir.txd/gb_truckdepot29.dds\",\"gta3.img/bakerybit2_sfse.txd/gb_truckdepot29.dds\",\n \"gta3.img/vgnshopnmall.txd/gb_truckdepot29.dds\",\"gta3.img/bakerybit2_sfse.txd/gb_truckdepot29.dds\",\n \"gta3.img/vgselckupgrgdr.txd/gb_truckdepot29.dds\",\"gta3.img/bakerybit2_sfse.txd/gb_truckdepot29.dds\",\n \"gta3.img/vgsswarehse02c.txd/gb_truckdepot29.dds\",\"gta3.img/bakerybit2_sfse.txd/gb_truckdepot29.dds\",\n \"gta3.img/vgsswarehse02.txd/gb_truckdepot29.dds\",\"gta3.img/bakerybit2_sfse.txd/gb_truckdepot29.dds\",\n \"gta3.img/vgsswrehse03.txd/gb_truckdepot29.dds\",\"gta3.img/bakerybit2_sfse.txd/gb_truckdepot29.dds\",\n \"gta3.img/warehus_las2.txd/gb_truckdepot29.dds\",\"gta3.img/bakerybit2_sfse.txd/gb_truckdepot29.dds\",\n \"gta3.img/bakery_sfse.txd/ws_altz_wall5.dds\",\"gta3.img/bakerybit2_sfse.txd/ws_altz_wall5.dds\",\n \"gta3.img/groundbit_sfse.txd/ws_altz_wall5.dds\",\"gta3.img/bakerybit2_sfse.txd/ws_altz_wall5.dds\",\n \"gta3.img/oldgarage_sfse.txd/ws_altz_wall5.dds\",\"gta3.img/bakerybit2_sfse.txd/ws_altz_wall5.dds\",\n \"gta3.img/sfn_helipad.txd/windoresidential256.dds\",\"gta3.img/bakerybit_sfse.txd/windoresidential256.dds\",\n \"gta3.img/carshow_sfse.txd/ws_altz_wall7.dds\",\"gta3.img/bakerybit_sfse.txd/ws_altz_wall7.dds\",\n \"gta3.img/crack_intkb.txd/ws_altz_wall7.dds\",\"gta3.img/bakerybit_sfse.txd/ws_altz_wall7.dds\",\n \"gta3.img/hashblock2b_sfs.txd/ws_altz_wall7.dds\",\"gta3.img/bakerybit_sfse.txd/ws_altz_wall7.dds\",\n \"gta3.img/hashblock2_sfs.txd/ws_altz_wall7.dds\",\"gta3.img/bakerybit_sfse.txd/ws_altz_wall7.dds\",\n \"gta3.img/subshops_sfs.txd/ws_altz_wall7.dds\",\"gta3.img/bakerybit_sfse.txd/ws_altz_wall7.dds\",\n \"gta3.img/bakery_sfse.txd/ws_oldwarehouse10c.dds\",\"gta3.img/bakerybit_sfse.txd/ws_oldwarehouse10c.dds\",\n \"gta3.img/hashupass_sfs.txd/ws_oldwarehouse10c.dds\",\"gta3.img/bakerybit_sfse.txd/ws_oldwarehouse10c.dds\",\n \"gta3.img/groundbit_sfse.txd/ws_oldwarehouse10d.dds\",\"gta3.img/bakerybit_sfse.txd/ws_oldwarehouse10d.dds\",\n \"gta3.img/hashupass_sfs.txd/ws_oldwarehouse10d.dds\",\"gta3.img/bakerybit_sfse.txd/ws_oldwarehouse10d.dds\",\n \"gta3.img/bakery_sfse.txd/ws_oldwarehouse10a.dds\",\"gta3.img/bakerybit_sfse.txd/ws_oldwarehouse10a.dds\",\n \"gta3.img/hashupass_sfs.txd/ws_oldwarehouse10a.dds\",\"gta3.img/bakerybit_sfse.txd/ws_oldwarehouse10a.dds\",\n \"gta3.img/subshops_sfs.txd/ws_oldwarehouse10a.dds\",\"gta3.img/bakerybit_sfse.txd/ws_oldwarehouse10a.dds\",\n \"gta3.img/bakery_sfse.txd/ws_doubledoor4.dds\",\"gta3.img/bakerybit_sfse.txd/ws_doubledoor4.dds\",\n \"gta3.img/hashupass_sfs.txd/ws_doubledoor4.dds\",\"gta3.img/bakerybit_sfse.txd/ws_doubledoor4.dds\",\n \"gta3.img/genwhse_sfse.txd/cabin6.dds\",\"gta3.img/bakery_sfse.txd/cabin6.dds\",\n \"gta3.img/hubint2.txd/cabin6.dds\",\"gta3.img/bakery_sfse.txd/cabin6.dds\",\n \"gta3.img/stadiumground_sfse.txd/ws_rshaul_dirt.dds\",\"gta3.img/bakery_sfse.txd/ws_rshaul_dirt.dds\",\n \"gta3.img/truckedepotlawn.txd/ws_rshaul_dirt.dds\",\"gta3.img/bakery_sfse.txd/ws_rshaul_dirt.dds\",\n \"gta3.img/vgsswarehse02.txd/ws_rshaul_dirt.dds\",\"gta3.img/bakery_sfse.txd/ws_rshaul_dirt.dds\",\n \"gta3.img/crackdrive_sfse.txd/ws_altz_wall4.dds\",\"gta3.img/bakery_sfse.txd/ws_altz_wall4.dds\",\n \"gta3.img/crackfactdem_sfs.txd/ws_altz_wall4.dds\",\"gta3.img/bakery_sfse.txd/ws_altz_wall4.dds\",\n \"gta3.img/crackfact_sfse.txd/ws_altz_wall4.dds\",\"gta3.img/bakery_sfse.txd/ws_altz_wall4.dds\",\n \"gta3.img/hashblock2b_sfs.txd/ws_altz_wall4.dds\",\"gta3.img/bakery_sfse.txd/ws_altz_wall4.dds\",\n \"gta3.img/hotelback_sfs.txd/ws_altz_wall4.dds\",\"gta3.img/bakery_sfse.txd/ws_altz_wall4.dds\",\n \"gta3.img/oldgarage_sfse.txd/ws_altz_wall4.dds\",\"gta3.img/bakery_sfse.txd/ws_altz_wall4.dds\",\n \"gta3.img/ballys01.txd/ballywall01_64.dds\",\"gta3.img/ballypillar01.txd/ballywall01_64.dds\",\n \"gta3.img/pirateland.txd/ballydoor01_128.dds\",\"gta3.img/ballys01.txd/ballydoor01_128.dds\",\n \"gta3.img/triaddrsx.txd/ballydoor01_128.dds\",\"gta3.img/ballys01.txd/ballydoor01_128.dds\",\n \"gta3.img/casroyale.txd/vgncorpdoor1_512.dds\",\"gta3.img/ballys01.txd/vgncorpdoor1_512.dds\",\n \"gta3.img/cuntwshopscs_t.txd/vgncorpdoor1_512.dds\",\"gta3.img/ballys01.txd/vgncorpdoor1_512.dds\",\n \"gta3.img/excalibur.txd/vgncorpdoor1_512.dds\",\"gta3.img/ballys01.txd/vgncorpdoor1_512.dds\",\n \"gta3.img/pointysfe.txd/vgncorpdoor1_512.dds\",\"gta3.img/ballys01.txd/vgncorpdoor1_512.dds\",\n \"gta3.img/stadium_sfse.txd/vgncorpdoor1_512.dds\",\"gta3.img/ballys01.txd/vgncorpdoor1_512.dds\",\n \"gta3.img/vgnfremnt1.txd/casinolightsblu_128.dds\",\"gta3.img/ballys01.txd/casinolightsblu_128.dds\",\n \"gta3.img/vgnfremnt2.txd/casinolightsblu_128.dds\",\"gta3.img/ballys01.txd/casinolightsblu_128.dds\",\n \"gta_int.img/cj_office.txd/cj_blackplastic.dds\",\"gta3.img/ballys01.txd/cj_blackplastic.dds\",\n \"gta_int.img/cj_tv.txd/cj_blackplastic.dds\",\"gta3.img/ballys01.txd/cj_blackplastic.dds\",\n \"gta_int.img/cuntcuts.txd/cj_blackplastic.dds\",\"gta3.img/ballys01.txd/cj_blackplastic.dds\",\n \"gta_int.img/lasmalldesk.txd/cj_blackplastic.dds\",\"gta3.img/ballys01.txd/cj_blackplastic.dds\",\n \"gta3.img/ballys02.txd/ws_floortiles4.dds\",\"gta3.img/ballys01.txd/ws_floortiles4.dds\",\n \"gta3.img/casnorylgrnd.txd/ws_floortiles4.dds\",\"gta3.img/ballys01.txd/ws_floortiles4.dds\",\n \"gta3.img/cathedral_sfs.txd/ws_floortiles4.dds\",\"gta3.img/ballys01.txd/ws_floortiles4.dds\",\n \"gta3.img/cityhall_sfs.txd/ws_floortiles4.dds\",\"gta3.img/ballys01.txd/ws_floortiles4.dds\",\n \"gta3.img/ballysign01.txd/ballywall02_128.dds\",\"gta3.img/ballys01.txd/ballywall02_128.dds\",\n \"gta3.img/ballys02.txd/greyground256128.dds\",\"gta3.img/ballys01.txd/greyground256128.dds\",\n \"gta3.img/carparkssfn.txd/greyground256128.dds\",\"gta3.img/ballys01.txd/greyground256128.dds\",\n \"gta3.img/casroyale.txd/greyground256128.dds\",\"gta3.img/ballys01.txd/greyground256128.dds\",\n \"gta3.img/csrspalace01.txd/greyground256128.dds\",\"gta3.img/ballys01.txd/greyground256128.dds\",\n \"gta3.img/csrspalace02.txd/greyground256128.dds\",\"gta3.img/ballys01.txd/greyground256128.dds\",\n \"gta3.img/eastbeach3c_lae2.txd/greyground256128.dds\",\"gta3.img/ballys01.txd/greyground256128.dds\",\n \"gta3.img/eastbeach7_lae2.txd/greyground256128.dds\",\"gta3.img/ballys01.txd/greyground256128.dds\",\n \"gta3.img/excalibursign.txd/greyground256128.dds\",\"gta3.img/ballys01.txd/greyground256128.dds\",\n \"gta3.img/excalibur.txd/greyground256128.dds\",\"gta3.img/ballys01.txd/greyground256128.dds\",\n \"gta3.img/filmstud.txd/greyground256128.dds\",\"gta3.img/ballys01.txd/greyground256128.dds\",\n \"gta3.img/flamingo1.txd/greyground256128.dds\",\"gta3.img/ballys01.txd/greyground256128.dds\",\n \"gta3.img/flmngoland.txd/greyground256128.dds\",\"gta3.img/ballys01.txd/greyground256128.dds\",\n \"gta3.img/genshop.txd/greyground256128.dds\",\"gta3.img/ballys01.txd/greyground256128.dds\",\n \"gta3.img/lahillslaroads.txd/greyground256128.dds\",\"gta3.img/ballys01.txd/greyground256128.dds\",\n \"gta3.img/lashops93_las2.txd/greyground256128.dds\",\"gta3.img/ballys01.txd/greyground256128.dds\",\n \"gta3.img/lowbuild03_lvs.txd/greyground256128.dds\",\"gta3.img/ballys01.txd/greyground256128.dds\",\n \"gta3.img/newstuff_sfn.txd/greyground256128.dds\",\"gta3.img/ballys01.txd/greyground256128.dds\",\n \"gta3.img/officeground.txd/greyground256128.dds\",\"gta3.img/ballys01.txd/greyground256128.dds\",\n \"gta3.img/pyramid.txd/greyground256128.dds\",\"gta3.img/ballys01.txd/greyground256128.dds\",\n \"gta3.img/sunset02_law2.txd/greyground256128.dds\",\"gta3.img/ballys01.txd/greyground256128.dds\",\n \"gta3.img/triadcasino.txd/greyground256128.dds\",\"gta3.img/ballys01.txd/greyground256128.dds\",\n \"gta3.img/vegasemulticar.txd/greyground256128.dds\",\"gta3.img/ballys01.txd/greyground256128.dds\",\n \"gta3.img/vgnbasktball.txd/greyground256128.dds\",\"gta3.img/ballys01.txd/greyground256128.dds\",\n \"gta3.img/vgnland.txd/greyground256128.dds\",\"gta3.img/ballys01.txd/greyground256128.dds\",\n \"gta3.img/vgsbballcrt.txd/greyground256128.dds\",\"gta3.img/ballys01.txd/greyground256128.dds\",\n \"gta3.img/vgseland.txd/greyground256128.dds\",\"gta3.img/ballys01.txd/greyground256128.dds\",\n \"gta3.img/vgsmall.txd/greyground256128.dds\",\"gta3.img/ballys01.txd/greyground256128.dds\",\n \"gta3.img/vgsmotelgrnd.txd/greyground256128.dds\",\"gta3.img/ballys01.txd/greyground256128.dds\",\n \"gta3.img/vgssairport02.txd/greyground256128.dds\",\"gta3.img/ballys01.txd/greyground256128.dds\",\n \"gta3.img/vgssairportcpark.txd/greyground256128.dds\",\"gta3.img/ballys01.txd/greyground256128.dds\",\n \"gta3.img/vgsshospshop.txd/greyground256128.dds\",\"gta3.img/ballys01.txd/greyground256128.dds\",\n \"gta3.img/vgssmulticarprk.txd/greyground256128.dds\",\"gta3.img/ballys01.txd/greyground256128.dds\",\n \"gta3.img/vgsswarehse01.txd/greyground256128.dds\",\"gta3.img/ballys01.txd/greyground256128.dds\",\n \"gta3.img/vgwestland2.txd/greyground256128.dds\",\"gta3.img/ballys01.txd/greyground256128.dds\",\n \"gta3.img/vgwestland.txd/greyground256128.dds\",\"gta3.img/ballys01.txd/greyground256128.dds\",\n \"gta3.img/bigboxtemp1.txd/walltiles_128.dds\",\"gta3.img/ballys02.txd/walltiles_128.dds\",\n \"gta3.img/boxybld2_sfw.txd/walltiles_128.dds\",\"gta3.img/ballys02.txd/walltiles_128.dds\",\n \"gta3.img/mall_sfse.txd/walltiles_128.dds\",\"gta3.img/ballys02.txd/walltiles_128.dds\",\n \"gta3.img/ce_burbhouse.txd/grass_concpath_128hv.dds\",\"gta3.img/ballys02.txd/grass_concpath_128hv.dds\",\n \"gta3.img/ce_ground09.txd/grass_concpath_128hv.dds\",\"gta3.img/ballys02.txd/grass_concpath_128hv.dds\",\n \"gta3.img/des_bighus.txd/grass_concpath_128hv.dds\",\"gta3.img/ballys02.txd/grass_concpath_128hv.dds\",\n \"gta3.img/nicepark_sfe.txd/grass_concpath_128hv.dds\",\"gta3.img/ballys02.txd/grass_concpath_128hv.dds\",\n \"gta3.img/queensparks_sfs.txd/grass_concpath_128hv.dds\",\"gta3.img/ballys02.txd/grass_concpath_128hv.dds\",\n \"gta3.img/roadslahills.txd/grass_concpath_128hv.dds\",\"gta3.img/ballys02.txd/grass_concpath_128hv.dds\",\n \"gta3.img/sw_poorhouse.txd/grass_concpath_128hv.dds\",\"gta3.img/ballys02.txd/grass_concpath_128hv.dds\",\n \"gta3.img/tikigrass.txd/grass_concpath_128hv.dds\",\"gta3.img/ballys02.txd/grass_concpath_128hv.dds\",\n \"gta_int.img/starps_ext.txd/kb_pathgras.dds\",\"gta3.img/ballys02.txd/grass_concpath_128hv.dds\",\n \"gta3.img/ceasersign.txd/vgnmetaltopwal1_256.dds\",\"gta3.img/ballysign01.txd/vgnmetaltopwal1_256.dds\",\n \"gta3.img/laconchasign.txd/vgnpawnlng_256.dds\",\"gta3.img/ballysign01.txd/vgnpawnlng_256.dds\",\n \"gta3.img/lawnabv.txd/vgnpawnlng_256.dds\",\"gta3.img/ballysign01.txd/vgnpawnlng_256.dds\",\n \"gta3.img/vgndwntwn23.txd/vgnpawnlng_256.dds\",\"gta3.img/ballysign01.txd/vgnpawnlng_256.dds\",\n \"gta3.img/lawwhitebuilds.txd/waterclear256.dds\",\"gta3.img/ballyswater.txd/waterclear256.dds\",\n \"gta3.img/pershingsq.txd/waterclear256.dds\",\"gta3.img/ballyswater.txd/waterclear256.dds\",\n \"gta3.img/vgndwntwn3.txd/waterclear256.dds\",\"gta3.img/ballyswater.txd/waterclear256.dds\",\n \"gta3.img/buffalo.txd/buffalo92wheel32.dds\",\"gta3.img/banshee.txd/banshee92wheel32.dds\",\n \"gta3.img/comet.txd/comet92wheel32.dds\",\"gta3.img/banshee.txd/banshee92wheel32.dds\",\n \"gta3.img/infernus.txd/infernus92wheel32.dds\",\"gta3.img/banshee.txd/banshee92wheel32.dds\",\n \"gta3.img/infernus.txd/infernus92handle32.dds\",\"gta3.img/banshee.txd/banshee92handle32.dds\",\n \"gta3.img/des_nwtown.txd/awirex2.dds\",\"gta3.img/bar_chainlink.txd/awirex2.dds\",\n \"gta3.img/fencehaiti.txd/awirex2.dds\",\"gta3.img/bar_chainlink.txd/awirex2.dds\",\n \"gta3.img/fencehaiti.txd/sjmshopbk.dds\",\"gta3.img/bar_chainlink.txd/sjmshopbk.dds\",\n \"gta3.img/benson.txd/benson92wheel64.dds\",\"gta3.img/barracks.txd/barracks92wheel64.dds\",\n \"gta3.img/fbitruck.txd/fbitruck92wheel64.dds\",\"gta3.img/barracks.txd/barracks92wheel64.dds\",\n \"gta3.img/flatbed.txd/flatbed92wheel64.dds\",\"gta3.img/barracks.txd/barracks92wheel64.dds\",\n \"gta3.img/rdtrain.txd/flatbed92wheel64.dds\",\"gta3.img/barracks.txd/barracks92wheel64.dds\",\n \"gta3.img/trash.txd/trash92wheel64.dds\",\"gta3.img/barracks.txd/barracks92wheel64.dds\",\n \"gta3.img/reefer.txd/bodykitmesh64.dds\",\"gta3.img/barracks.txd/barracks92mesh16.dds\",\n \"gta3.img/boxburg.txd/boxville92crate128.dds\",\"gta3.img/barracks.txd/barracks92crate128.dds\",\n \"gta3.img/boxville.txd/boxville92crate128.dds\",\"gta3.img/barracks.txd/barracks92crate128.dds\",\n \"gta3.img/roadblkx.txd/yellow_64.dds\",\"gta3.img/barrierblk.txd/yellow_64.dds\",\n \"gta3.img/roadblkx.txd/warnsigns2.dds\",\"gta3.img/barrierblk.txd/warnsigns2.dds\",\n \"gta3.img/roadblkx.txd/warnsigns1.dds\",\"gta3.img/barrierblk.txd/warnsigns1.dds\",\n \"gta3.img/roadblkx.txd/block.dds\",\"gta3.img/barrierblk.txd/block.dds\",\n \"gta3.img/eastls1_lae2.txd/alleywall2.dds\",\"gta3.img/barrio1_lae2.txd/alleywall2.dds\",\n \"gta3.img/vgnretail4.txd/alleywall2.dds\",\"gta3.img/barrio1_lae2.txd/alleywall2.dds\",\n \"gta3.img/vgnretail5.txd/alleywall2.dds\",\"gta3.img/barrio1_lae2.txd/alleywall2.dds\",\n \"gta3.img/vgnretail7.txd/alleywall2.dds\",\"gta3.img/barrio1_lae2.txd/alleywall2.dds\",\n \"gta3.img/vgntrainstat.txd/alleywall2.dds\",\"gta3.img/barrio1_lae2.txd/alleywall2.dds\",\n \"gta3.img/vgsetrainstn.txd/alleywall2.dds\",\"gta3.img/barrio1_lae2.txd/alleywall2.dds\",\n \"gta3.img/docks_las2.txd/dockpave_256.dds\",\"gta3.img/barrio1_lae2.txd/dockpave_256.dds\",\n \"gta3.img/freeway_las.txd/dockpave_256.dds\",\"gta3.img/barrio1_lae2.txd/dockpave_256.dds\",\n \"gta3.img/lanroad.txd/dockpave_256.dds\",\"gta3.img/barrio1_lae2.txd/dockpave_256.dds\",\n \"gta3.img/law2_roadsb.txd/dockpave_256.dds\",\"gta3.img/barrio1_lae2.txd/dockpave_256.dds\",\n \"gta3.img/piera_law2.txd/dockpave_256.dds\",\"gta3.img/barrio1_lae2.txd/dockpave_256.dds\",\n \"gta3.img/roads_lawn.txd/dockpave_256.dds\",\"gta3.img/barrio1_lae2.txd/dockpave_256.dds\",\n \"gta3.img/roads_law.txd/dockpave_256.dds\",\"gta3.img/barrio1_lae2.txd/dockpave_256.dds\",\n \"gta3.img/stapl.txd/dockpave_256.dds\",\"gta3.img/barrio1_lae2.txd/dockpave_256.dds\",\n \"gta3.img/sw_ware01.txd/dockpave_256.dds\",\"gta3.img/barrio1_lae2.txd/dockpave_256.dds\",\n \"gta3.img/bdupshouse_lae.txd/brickred.dds\",\"gta3.img/barrio1_lae2.txd/brickred.dds\",\n \"gta3.img/canalsg_law.txd/brickred.dds\",\"gta3.img/barrio1_lae2.txd/brickred.dds\",\n \"gta3.img/ce_ground09.txd/brickred.dds\",\"gta3.img/barrio1_lae2.txd/brickred.dds\",\n \"gta3.img/chicano10_lae.txd/brickred.dds\",\"gta3.img/barrio1_lae2.txd/brickred.dds\",\n \"gta3.img/eastbeach2a_lae2.txd/brickred.dds\",\"gta3.img/barrio1_lae2.txd/brickred.dds\",\n \"gta3.img/furniture_lae2.txd/brickred.dds\",\"gta3.img/barrio1_lae2.txd/brickred.dds\",\n \"gta3.img/glenpark1_lae.txd/brickred.dds\",\"gta3.img/barrio1_lae2.txd/brickred.dds\",\n \"gta3.img/glenphouse_lax.txd/brickred.dds\",\"gta3.img/barrio1_lae2.txd/brickred.dds\",\n \"gta3.img/lashops6_las2.txd/brickred.dds\",\"gta3.img/barrio1_lae2.txd/brickred.dds\",\n \"gta3.img/lasraodnshops.txd/brickred.dds\",\"gta3.img/barrio1_lae2.txd/brickred.dds\",\n \"gta3.img/melrose05_lawn.txd/brickred.dds\",\"gta3.img/barrio1_lae2.txd/brickred.dds\",\n \"gta3.img/richman02_lahills.txd/brickred.dds\",\"gta3.img/barrio1_lae2.txd/brickred.dds\",\n \"gta3.img/richman04_lahills.txd/brickred.dds\",\"gta3.img/barrio1_lae2.txd/brickred.dds\",\n \"gta3.img/roadslahills.txd/brickred.dds\",\"gta3.img/barrio1_lae2.txd/brickred.dds\",\n \"gta3.img/vgndwntwn1.txd/brickred.dds\",\"gta3.img/barrio1_lae2.txd/brickred.dds\",\n \"gta3.img/vgnland.txd/brickred.dds\",\"gta3.img/barrio1_lae2.txd/brickred.dds\",\n \"gta3.img/vgnvrock.txd/brickred.dds\",\"gta3.img/barrio1_lae2.txd/brickred.dds\",\n \"gta3.img/vgsbikeschool.txd/brickred.dds\",\"gta3.img/barrio1_lae2.txd/brickred.dds\",\n \"gta3.img/vgssland01.txd/brickred.dds\",\"gta3.img/barrio1_lae2.txd/brickred.dds\",\n \"gta3.img/vgwestland.txd/brickred.dds\",\"gta3.img/barrio1_lae2.txd/brickred.dds\",\n \"gta3.img/furniture_lae2.txd/gangsign4_lae.dds\",\"gta3.img/barrio1_lae2.txd/gangsign4_lae.dds\",\n \"gta3.img/glenpark1_lae.txd/gangsign4_lae.dds\",\"gta3.img/barrio1_lae2.txd/gangsign4_lae.dds\",\n \"gta3.img/jeffers5a_lae.txd/gangsign4_lae.dds\",\"gta3.img/barrio1_lae2.txd/gangsign4_lae.dds\",\n \"gta3.img/melrose05_lawn.txd/gangsign4_lae.dds\",\"gta3.img/barrio1_lae2.txd/gangsign4_lae.dds\",\n \"gta3.img/vegasbuild.txd/gangsign4_lae.dds\",\"gta3.img/barrio1_lae2.txd/gangsign4_lae.dds\",\n \"gta3.img/vgsespras.txd/gangsign4_lae.dds\",\"gta3.img/barrio1_lae2.txd/gangsign4_lae.dds\",\n \"gta3.img/furniture_lae2.txd/gangsign3_lae.dds\",\"gta3.img/barrio1_lae2.txd/gangsign3_lae.dds\",\n \"gta3.img/melrose05_lawn.txd/gangsign3_lae.dds\",\"gta3.img/barrio1_lae2.txd/gangsign3_lae.dds\",\n \"gta3.img/vegasbuild.txd/gangsign3_lae.dds\",\"gta3.img/barrio1_lae2.txd/gangsign3_lae.dds\",\n \"gta3.img/vgsespras.txd/gangsign3_lae.dds\",\"gta3.img/barrio1_lae2.txd/gangsign3_lae.dds\",\n \"gta3.img/eastbeach2a_lae2.txd/gangshop12_lae.dds\",\"gta3.img/barrio1_lae2.txd/gangshop12_lae.dds\",\n \"gta3.img/furniture_lae2.txd/gangshop12_lae.dds\",\"gta3.img/barrio1_lae2.txd/gangshop12_lae.dds\",\n \"gta3.img/melrose05_lawn.txd/gangshop12_lae.dds\",\"gta3.img/barrio1_lae2.txd/gangshop12_lae.dds\",\n \"gta3.img/idlewood6_lae.txd/gangshop11_lae.dds\",\"gta3.img/barrio1_lae2.txd/gangshop11_lae.dds\",\n \"gta3.img/melrose05_lawn.txd/gangshop11_lae.dds\",\"gta3.img/barrio1_lae2.txd/gangshop11_lae.dds\",\n \"gta3.img/furniture_lae2.txd/gangshop10_lae.dds\",\"gta3.img/barrio1_lae2.txd/gangshop10_lae.dds\",\n \"gta3.img/gangblok1_lae2.txd/gangshop10_lae.dds\",\"gta3.img/barrio1_lae2.txd/gangshop10_lae.dds\",\n \"gta3.img/jeffers5a_lae.txd/gangshop10_lae.dds\",\"gta3.img/barrio1_lae2.txd/gangshop10_lae.dds\",\n \"gta3.img/melrose05_lawn.txd/gangshop10_lae.dds\",\"gta3.img/barrio1_lae2.txd/gangshop10_lae.dds\",\n \"gta3.img/cables_sfe.txd/telewires_law.dds\",\"gta3.img/barrio1_lae.txd/telewires_law.dds\",\n \"gta3.img/cables_sfn.txd/telewires_law.dds\",\"gta3.img/barrio1_lae.txd/telewires_law.dds\",\n \"gta3.img/cinemart_alpha.txd/telewires_law.dds\",\"gta3.img/barrio1_lae.txd/telewires_law.dds\",\n \"gta3.img/cranes_dyn2.txd/telewires_law.dds\",\"gta3.img/barrio1_lae.txd/telewires_law.dds\",\n \"gta3.img/cunte_wires.txd/telewires_law.dds\",\"gta3.img/barrio1_lae.txd/telewires_law.dds\",\n \"gta3.img/cw_wires2cs_t.txd/telewires_law.dds\",\"gta3.img/barrio1_lae.txd/telewires_law.dds\",\n \"gta3.img/des_clifftown.txd/telewires_law.dds\",\"gta3.img/barrio1_lae.txd/telewires_law.dds\",\n \"gta3.img/des_miscbits.txd/telewires_law.dds\",\"gta3.img/barrio1_lae.txd/telewires_law.dds\",\n \"gta3.img/desn2_alphabits.txd/telewires_law.dds\",\"gta3.img/barrio1_lae.txd/telewires_law.dds\",\n \"gta3.img/des_quarrycrane.txd/telewires_law.dds\",\"gta3.img/barrio1_lae.txd/telewires_law.dds\",\n \"gta3.img/des_telescopestuff.txd/telewires_law.dds\",\"gta3.img/barrio1_lae.txd/telewires_law.dds\",\n \"gta3.img/des_wires.txd/telewires_law.dds\",\"gta3.img/barrio1_lae.txd/telewires_law.dds\",\n \"gta3.img/eastlstr2_lae2.txd/telewires_law.dds\",\"gta3.img/barrio1_lae.txd/telewires_law.dds\",\n \"gta3.img/eastlstr_lae2.txd/telewires_law.dds\",\"gta3.img/barrio1_lae.txd/telewires_law.dds\",\n \"gta3.img/gb_lageneric.txd/telewires_law.dds\",\"gta3.img/barrio1_lae.txd/telewires_law.dds\",\n \"gta3.img/gravblokmast.txd/telewires_law.dds\",\"gta3.img/barrio1_lae.txd/telewires_law.dds\",\n \"gta3.img/hub_alpha.txd/telewires_law.dds\",\"gta3.img/barrio1_lae.txd/telewires_law.dds\",\n \"gta3.img/imrancomp_las2.txd/telewires_law.dds\",\"gta3.img/barrio1_lae.txd/telewires_law.dds\",\n \"gta3.img/lae2coast_alpha.txd/telewires_law.dds\",\"gta3.img/barrio1_lae.txd/telewires_law.dds\",\n \"gta3.img/laealpha.txd/telewires_law.dds\",\"gta3.img/barrio1_lae.txd/telewires_law.dds\",\n \"gta3.img/lahillstr_lawn.txd/telewires_law.dds\",\"gta3.img/barrio1_lae.txd/telewires_law.dds\",\n \"gta3.img/lahills_wiresnshit3.txd/telewires_law.dds\",\"gta3.img/barrio1_lae.txd/telewires_law.dds\",\n \"gta3.img/mulveg2lahills.txd/telewires_law.dds\",\"gta3.img/barrio1_lae.txd/telewires_law.dds\",\n \"gta3.img/pierb_law2.txd/telewires_law.dds\",\"gta3.img/barrio1_lae.txd/telewires_law.dds\",\n \"gta3.img/sunstrans_law2.txd/telewires_law.dds\",\"gta3.img/barrio1_lae.txd/telewires_law.dds\",\n \"gta3.img/telewirelawn.txd/telewires_law.dds\",\"gta3.img/barrio1_lae.txd/telewires_law.dds\",\n \"gta3.img/vegasneon.txd/telewires_law.dds\",\"gta3.img/barrio1_lae.txd/telewires_law.dds\",\n \"gta3.img/vgseneonwires.txd/telewires_law.dds\",\"gta3.img/barrio1_lae.txd/telewires_law.dds\",\n \"gta3.img/wiresetc2_las.txd/telewires_law.dds\",\"gta3.img/barrio1_lae.txd/telewires_law.dds\",\n \"gta3.img/wiresetc_las2.txd/telewires_law.dds\",\"gta3.img/barrio1_lae.txd/telewires_law.dds\",\n \"gta3.img/wiresetc_las.txd/telewires_law.dds\",\"gta3.img/barrio1_lae.txd/telewires_law.dds\",\n \"gta3.img/wires_sfs.txd/telewires_law.dds\",\"gta3.img/barrio1_lae.txd/telewires_law.dds\",\n \"gta3.img/wong_twx.txd/telewires_law.dds\",\"gta3.img/barrio1_lae.txd/telewires_law.dds\",\n \"gta_int.img/genintwarehsint3.txd/telewires_law.dds\",\"gta3.img/barrio1_lae.txd/telewires_law.dds\",\n \"gta_int.img/smashtv.txd/telewires_law.dds\",\"gta3.img/barrio1_lae.txd/telewires_law.dds\",\n \"gta3.img/cinemart_alpha.txd/wshbrsh1las.dds\",\"gta3.img/barrio1_lae.txd/wshbrsh1las.dds\",\n \"gta3.img/vgnptrlpmp.txd/wshbrsh1las.dds\",\"gta3.img/barrio1_lae.txd/wshbrsh1las.dds\",\n \"gta3.img/civic03_lan.txd/crossing_law.dds\",\"gta3.img/barrio1_lae.txd/crossing_law.dds\",\n \"gta3.img/coast_las2.txd/crossing_law.dds\",\"gta3.img/barrio1_lae.txd/crossing_law.dds\",\n \"gta3.img/cunteroads2.txd/crossing_law.dds\",\"gta3.img/barrio1_lae.txd/crossing_law.dds\",\n \"gta3.img/cunteroads4.txd/crossing_law.dds\",\"gta3.img/barrio1_lae.txd/crossing_law.dds\",\n \"gta3.img/cunteroads5.txd/crossing_law.dds\",\"gta3.img/barrio1_lae.txd/crossing_law.dds\",\n \"gta3.img/cunteroads6.txd/crossing_law.dds\",\"gta3.img/barrio1_lae.txd/crossing_law.dds\",\n \"gta3.img/fctrygrnd01.txd/crossing_law.dds\",\"gta3.img/barrio1_lae.txd/crossing_law.dds\",\n \"gta3.img/freeway_las.txd/crossing_law.dds\",\"gta3.img/barrio1_lae.txd/crossing_law.dds\",\n \"gta3.img/hotelback_sfs.txd/crossing_law.dds\",\"gta3.img/barrio1_lae.txd/crossing_law.dds\",\n \"gta3.img/idlewood6_detail.txd/crossing_law.dds\",\"gta3.img/barrio1_lae.txd/crossing_law.dds\",\n \"gta3.img/lae2roadscoast.txd/crossing_law.dds\",\"gta3.img/barrio1_lae.txd/crossing_law.dds\",\n \"gta3.img/lae2roadshub.txd/crossing_law.dds\",\"gta3.img/barrio1_lae.txd/crossing_law.dds\",\n \"gta3.img/lae2roads.txd/crossing_law.dds\",\"gta3.img/barrio1_lae.txd/crossing_law.dds\",\n \"gta3.img/laeroads2s.txd/crossing_law.dds\",\"gta3.img/barrio1_lae.txd/crossing_law.dds\",\n \"gta3.img/lahillsla_roads.txd/crossing_law.dds\",\"gta3.img/barrio1_lae.txd/crossing_law.dds\",\n \"gta3.img/lahillslaroads.txd/crossing_law.dds\",\"gta3.img/barrio1_lae.txd/crossing_law.dds\",\n \"gta3.img/lahillsroadscoast.txd/crossing_law.dds\",\"gta3.img/barrio1_lae.txd/crossing_law.dds\",\n \"gta3.img/lanriver.txd/crossing_law.dds\",\"gta3.img/barrio1_lae.txd/crossing_law.dds\",\n \"gta3.img/lanroad.txd/crossing_law.dds\",\"gta3.img/barrio1_lae.txd/crossing_law.dds\",\n \"gta3.img/law2_roadsb.txd/crossing_law.dds\",\"gta3.img/barrio1_lae.txd/crossing_law.dds\",\n \"gta3.img/pinkcarpark_sfs.txd/crossing_law.dds\",\"gta3.img/barrio1_lae.txd/crossing_law.dds\",\n \"gta3.img/roadlan2.txd/crossing_law.dds\",\"gta3.img/barrio1_lae.txd/crossing_law.dds\",\n \"gta3.img/roads_lawn.txd/crossing_law.dds\",\"gta3.img/barrio1_lae.txd/crossing_law.dds\",\n \"gta3.img/roads_law.txd/crossing_law.dds\",\"gta3.img/barrio1_lae.txd/crossing_law.dds\",\n \"gta3.img/stapl.txd/crossing_law.dds\",\"gta3.img/barrio1_lae.txd/crossing_law.dds\",\n \"gta3.img/stormdrain.txd/crossing_law.dds\",\"gta3.img/barrio1_lae.txd/crossing_law.dds\",\n \"gta3.img/vgnground2.txd/crossing_law.dds\",\"gta3.img/barrio1_lae.txd/crossing_law.dds\",\n \"gta3.img/vgnground.txd/crossing_law.dds\",\"gta3.img/barrio1_lae.txd/crossing_law.dds\",\n \"gta3.img/vgseroads.txd/crossing_law.dds\",\"gta3.img/barrio1_lae.txd/crossing_law.dds\",\n \"gta3.img/vgssdrtyroads.txd/crossing_law.dds\",\"gta3.img/barrio1_lae.txd/crossing_law.dds\",\n \"gta3.img/vgsshiways.txd/crossing_law.dds\",\"gta3.img/barrio1_lae.txd/crossing_law.dds\",\n \"gta3.img/vgssroads.txd/crossing_law.dds\",\"gta3.img/barrio1_lae.txd/crossing_law.dds\",\n \"gta3.img/vgwestground.txd/crossing_law.dds\",\"gta3.img/barrio1_lae.txd/crossing_law.dds\",\n \"gta3.img/vgwstdirtyrd.txd/crossing_law.dds\",\"gta3.img/barrio1_lae.txd/crossing_law.dds\",\n \"gta3.img/vgndwntwn2.txd/concretenewgery256.dds\",\"gta3.img/barrio1_lae.txd/concretenewgery256.dds\",\n \"gta3.img/vgngebuild.txd/concretenewgery256.dds\",\"gta3.img/barrio1_lae.txd/concretenewgery256.dds\",\n \"gta3.img/boigas_sfw.txd/roof06l256.dds\",\"gta3.img/barrio1_lae.txd/roof06l256.dds\",\n \"gta3.img/cunts_gunclub.txd/roof06l256.dds\",\"gta3.img/barrio1_lae.txd/roof06l256.dds\",\n \"gta3.img/cw2_storesnstuff.txd/roof06l256.dds\",\"gta3.img/barrio1_lae.txd/roof06l256.dds\",\n \"gta3.img/des_gunclub.txd/roof06l256.dds\",\"gta3.img/barrio1_lae.txd/roof06l256.dds\",\n \"gta3.img/des_ntown.txd/roof06l256.dds\",\"gta3.img/barrio1_lae.txd/roof06l256.dds\",\n \"gta3.img/des_nwtownpolice.txd/roof06l256.dds\",\"gta3.img/barrio1_lae.txd/roof06l256.dds\",\n \"gta3.img/des_nwtown.txd/roof06l256.dds\",\"gta3.img/barrio1_lae.txd/roof06l256.dds\",\n \"gta3.img/des_nwtownw.txd/roof06l256.dds\",\"gta3.img/barrio1_lae.txd/roof06l256.dds\",\n \"gta3.img/des_stownw.txd/roof06l256.dds\",\"gta3.img/barrio1_lae.txd/roof06l256.dds\",\n \"gta3.img/des_wgarage.txd/roof06l256.dds\",\"gta3.img/barrio1_lae.txd/roof06l256.dds\",\n \"gta3.img/des_wtownmain.txd/roof06l256.dds\",\"gta3.img/barrio1_lae.txd/roof06l256.dds\",\n \"gta3.img/jeffers4_lae.txd/roof06l256.dds\",\"gta3.img/barrio1_lae.txd/roof06l256.dds\",\n \"gta3.img/lahillshilhs1b.txd/roof06l256.dds\",\"gta3.img/barrio1_lae.txd/roof06l256.dds\",\n \"gta3.img/lahillshilhs1d.txd/roof06l256.dds\",\"gta3.img/barrio1_lae.txd/roof06l256.dds\",\n \"gta3.img/lahillshilhs1z.txd/roof06l256.dds\",\"gta3.img/barrio1_lae.txd/roof06l256.dds\",\n \"gta3.img/lahillshilhse.txd/roof06l256.dds\",\"gta3.img/barrio1_lae.txd/roof06l256.dds\",\n \"gta3.img/lawnapartxref.txd/roof06l256.dds\",\"gta3.img/barrio1_lae.txd/roof06l256.dds\",\n \"gta3.img/vegasnbuild1.txd/roof06l256.dds\",\"gta3.img/barrio1_lae.txd/roof06l256.dds\",\n \"gta3.img/vgeamun.txd/roof06l256.dds\",\"gta3.img/barrio1_lae.txd/roof06l256.dds\",\n \"gta3.img/vgnamun.txd/roof06l256.dds\",\"gta3.img/barrio1_lae.txd/roof06l256.dds\",\n \"gta3.img/vgnboiga1.txd/roof06l256.dds\",\"gta3.img/barrio1_lae.txd/roof06l256.dds\",\n \"gta3.img/vgndwntwn21.txd/roof06l256.dds\",\"gta3.img/barrio1_lae.txd/roof06l256.dds\",\n \"gta3.img/vgndwntwn5.txd/roof06l256.dds\",\"gta3.img/barrio1_lae.txd/roof06l256.dds\",\n \"gta3.img/vgnhseing1.txd/roof06l256.dds\",\"gta3.img/barrio1_lae.txd/roof06l256.dds\",\n \"gta3.img/vgnptrlpmp.txd/roof06l256.dds\",\"gta3.img/barrio1_lae.txd/roof06l256.dds\",\n \"gta3.img/vgnretail4.txd/roof06l256.dds\",\"gta3.img/barrio1_lae.txd/roof06l256.dds\",\n \"gta3.img/vgnxrefhse1.txd/roof06l256.dds\",\"gta3.img/barrio1_lae.txd/roof06l256.dds\",\n \"gta3.img/vgslowbuild.txd/roof06l256.dds\",\"gta3.img/barrio1_lae.txd/roof06l256.dds\",\n \"gta3.img/vgsswarehse02c.txd/roof06l256.dds\",\"gta3.img/barrio1_lae.txd/roof06l256.dds\",\n \"gta3.img/w_town3cs_t.txd/roof06l256.dds\",\"gta3.img/barrio1_lae.txd/roof06l256.dds\",\n \"gta3.img/mall_sfse.txd/corporate3green_128.dds\",\"gta3.img/barrio1_lae.txd/corporate3green_128.dds\",\n \"gta3.img/pierc_law2.txd/corporate3green_128.dds\",\"gta3.img/barrio1_lae.txd/corporate3green_128.dds\",\n \"gta3.img/skyscrap2_lan2.txd/corporate3green_128.dds\",\"gta3.img/barrio1_lae.txd/corporate3green_128.dds\",\n \"gta3.img/vegasbuild.txd/corporate3green_128.dds\",\"gta3.img/barrio1_lae.txd/corporate3green_128.dds\",\n \"gta3.img/vgnretail3.txd/corporate3green_128.dds\",\"gta3.img/barrio1_lae.txd/corporate3green_128.dds\",\n \"gta3.img/vgnretail7.txd/corporate3green_128.dds\",\"gta3.img/barrio1_lae.txd/corporate3green_128.dds\",\n \"gta3.img/vgsswrehse03.txd/corporate3green_128.dds\",\"gta3.img/barrio1_lae.txd/corporate3green_128.dds\",\n \"gta3.img/cetown3cs_t.txd/sw_wind16.dds\",\"gta3.img/barrio1_lae.txd/sw_wind16.dds\",\n \"gta3.img/idlewood6_lae.txd/sw_wind16.dds\",\"gta3.img/barrio1_lae.txd/sw_wind16.dds\",\n \"gta3.img/lashops91_las2.txd/sw_wind16.dds\",\"gta3.img/barrio1_lae.txd/sw_wind16.dds\",\n \"gta3.img/mainlcawn.txd/sw_wind16.dds\",\"gta3.img/barrio1_lae.txd/sw_wind16.dds\",\n \"gta3.img/shopliquor_las.txd/sw_wind16.dds\",\"gta3.img/barrio1_lae.txd/sw_wind16.dds\",\n \"gta3.img/sw_block09.txd/sw_wind16.dds\",\"gta3.img/barrio1_lae.txd/sw_wind16.dds\",\n \"gta3.img/sw_block11.txd/sw_wind16.dds\",\"gta3.img/barrio1_lae.txd/sw_wind16.dds\",\n \"gta3.img/sw_block9.txd/sw_wind16.dds\",\"gta3.img/barrio1_lae.txd/sw_wind16.dds\",\n \"gta3.img/sw_roadgas.txd/sw_wind16.dds\",\"gta3.img/barrio1_lae.txd/sw_wind16.dds\",\n \"gta3.img/blacksky_sfse.txd/dirtgaz64b.dds\",\"gta3.img/barrio1_lae.txd/dirtgaz64b.dds\",\n \"gta3.img/chemgrnd_las2.txd/dirtgaz64b.dds\",\"gta3.img/barrio1_lae.txd/dirtgaz64b.dds\",\n \"gta3.img/gayclub_sfs.txd/dirtgaz64b.dds\",\"gta3.img/barrio1_lae.txd/dirtgaz64b.dds\",\n \"gta3.img/gazlaw3.txd/dirtgaz64b.dds\",\"gta3.img/barrio1_lae.txd/dirtgaz64b.dds\",\n \"gta3.img/ground3_las2.txd/dirtgaz64b.dds\",\"gta3.img/barrio1_lae.txd/dirtgaz64b.dds\",\n \"gta3.img/ground_las2.txd/dirtgaz64b.dds\",\"gta3.img/barrio1_lae.txd/dirtgaz64b.dds\",\n \"gta3.img/hashmarket1_sfs.txd/dirtgaz64b.dds\",\"gta3.img/barrio1_lae.txd/dirtgaz64b.dds\",\n \"gta3.img/idlewood6_detail.txd/dirtgaz64b.dds\",\"gta3.img/barrio1_lae.txd/dirtgaz64b.dds\",\n \"gta3.img/oc_flats_gnd_sfs.txd/dirtgaz64b.dds\",\"gta3.img/barrio1_lae.txd/dirtgaz64b.dds\",\n \"gta3.img/scum2_sfs.txd/dirtgaz64b.dds\",\"gta3.img/barrio1_lae.txd/dirtgaz64b.dds\",\n \"gta3.img/sfsroadshotel.txd/dirtgaz64b.dds\",\"gta3.img/barrio1_lae.txd/dirtgaz64b.dds\",\n \"gta3.img/smallertxd.txd/dirtgaz64b.dds\",\"gta3.img/barrio1_lae.txd/dirtgaz64b.dds\",\n \"gta3.img/stormdrain_las2.txd/dirtgaz64b.dds\",\"gta3.img/barrio1_lae.txd/dirtgaz64b.dds\",\n \"gta3.img/traintrack_las2.txd/dirtgaz64b.dds\",\"gta3.img/barrio1_lae.txd/dirtgaz64b.dds\",\n \"gta_int.img/genintgeneric.txd/dirtgaz64b.dds\",\"gta3.img/barrio1_lae.txd/dirtgaz64b.dds\",\n \"gta_int.img/plants.txd/dirtgaz64b.dds\",\"gta3.img/barrio1_lae.txd/dirtgaz64b.dds\",\n \"gta3.img/bdupshouse_lae.txd/ws_rooftarmac1.dds\",\"gta3.img/barrio1_lae.txd/ws_rooftarmac1.dds\",\n \"gta3.img/chicano10_lae.txd/ws_rooftarmac1.dds\",\"gta3.img/barrio1_lae.txd/ws_rooftarmac1.dds\",\n \"gta3.img/glenpark6d_lae.txd/ws_rooftarmac1.dds\",\"gta3.img/barrio1_lae.txd/ws_rooftarmac1.dds\",\n \"gta3.img/glenpark6_lae.txd/ws_rooftarmac1.dds\",\"gta3.img/barrio1_lae.txd/ws_rooftarmac1.dds\",\n \"gta3.img/hospital_lae.txd/ws_rooftarmac1.dds\",\"gta3.img/barrio1_lae.txd/ws_rooftarmac1.dds\",\n \"gta3.img/idlewood3_lae.txd/ws_rooftarmac1.dds\",\"gta3.img/barrio1_lae.txd/ws_rooftarmac1.dds\",\n \"gta3.img/idlewood46_lae.txd/ws_rooftarmac1.dds\",\"gta3.img/barrio1_lae.txd/ws_rooftarmac1.dds\",\n \"gta3.img/idlewood6_detail.txd/ws_rooftarmac1.dds\",\"gta3.img/barrio1_lae.txd/ws_rooftarmac1.dds\",\n \"gta3.img/jeffers4_lae.txd/ws_rooftarmac1.dds\",\"gta3.img/barrio1_lae.txd/ws_rooftarmac1.dds\",\n \"gta3.img/paynspray_lae.txd/ws_rooftarmac1.dds\",\"gta3.img/barrio1_lae.txd/ws_rooftarmac1.dds\",\n \"gta3.img/portakabin.txd/ws_rooftarmac1.dds\",\"gta3.img/barrio1_lae.txd/ws_rooftarmac1.dds\",\n \"gta3.img/vegasshangar.txd/ws_rooftarmac1.dds\",\"gta3.img/barrio1_lae.txd/ws_rooftarmac1.dds\",\n \"gta3.img/civic04_lan.txd/snpdwargrn1.dds\",\"gta3.img/barrio1_lae.txd/snpdwargrn1.dds\",\n \"gta3.img/docks2_las2.txd/snpdwargrn1.dds\",\"gta3.img/barrio1_lae.txd/snpdwargrn1.dds\",\n \"gta3.img/docks_las2.txd/snpdwargrn1.dds\",\"gta3.img/barrio1_lae.txd/snpdwargrn1.dds\",\n \"gta3.img/downtown_las.txd/snpdwargrn1.dds\",\"gta3.img/barrio1_lae.txd/snpdwargrn1.dds\",\n \"gta3.img/freeway_las.txd/snpdwargrn1.dds\",\"gta3.img/barrio1_lae.txd/snpdwargrn1.dds\",\n \"gta3.img/idlewood6_detail.txd/snpdwargrn1.dds\",\"gta3.img/barrio1_lae.txd/snpdwargrn1.dds\",\n \"gta3.img/laeroads.txd/snpdwargrn1.dds\",\"gta3.img/barrio1_lae.txd/snpdwargrn1.dds\",\n \"gta3.img/warehus_las2.txd/snpdwargrn1.dds\",\"gta3.img/barrio1_lae.txd/snpdwargrn1.dds\",\n \"gta3.img/civic04_lan.txd/rufwaldock1.dds\",\"gta3.img/barrio1_lae.txd/rufwaldock1.dds\",\n \"gta3.img/groundb_las2.txd/rufwaldock1.dds\",\"gta3.img/barrio1_lae.txd/rufwaldock1.dds\",\n \"gta3.img/ground_las2.txd/rufwaldock1.dds\",\"gta3.img/barrio1_lae.txd/rufwaldock1.dds\",\n \"gta3.img/indust_lax.txd/rufwaldock1.dds\",\"gta3.img/barrio1_lae.txd/rufwaldock1.dds\",\n \"gta3.img/lae2roads.txd/rufwaldock1.dds\",\"gta3.img/barrio1_lae.txd/rufwaldock1.dds\",\n \"gta3.img/laeroads.txd/rufwaldock1.dds\",\"gta3.img/barrio1_lae.txd/rufwaldock1.dds\",\n \"gta3.img/lanroad.txd/rufwaldock1.dds\",\"gta3.img/barrio1_lae.txd/rufwaldock1.dds\",\n \"gta3.img/warehus_las2.txd/rufwaldock1.dds\",\"gta3.img/barrio1_lae.txd/rufwaldock1.dds\",\n \"gta3.img/warehus_las2.txd/sanpedocka1.dds\",\"gta3.img/barrio1_lae.txd/sanpedocka1.dds\",\n \"gta3.img/xrf_refineryla.txd/sanpedocka1.dds\",\"gta3.img/barrio1_lae.txd/sanpedocka1.dds\",\n \"gta3.img/canalsg_law.txd/bow_church_dirt_to_grass_side_t.dds\",\"gta3.img/baseballground_sfs.txd/bow_church_dirt_to_grass_side_t.dds\",\n \"gta3.img/crparkgm_lan2.txd/bow_church_dirt_to_grass_side_t.dds\",\"gta3.img/baseballground_sfs.txd/bow_church_dirt_to_grass_side_t.dds\",\n \"gta3.img/lawest1.txd/bow_church_dirt_to_grass_side_t.dds\",\"gta3.img/baseballground_sfs.txd/bow_church_dirt_to_grass_side_t.dds\",\n \"gta3.img/roads_tunnellahills.txd/ws_baseballdirt.dds\",\"gta3.img/baseballground_sfs.txd/ws_baseballdirt.dds\",\n \"gta3.img/vgnretail6.txd/ws_baseballdirt.dds\",\"gta3.img/baseballground_sfs.txd/ws_baseballdirt.dds\",\n \"gta3.img/cathedral_sfs.txd/ws_football_lines2.dds\",\"gta3.img/baseballground_sfs.txd/ws_football_lines2.dds\",\n \"gta3.img/libhelipad_lan2.txd/helipad_mesh_t.dds\",\"gta3.img/baseball_sfsx.txd/helipad_mesh_t.dds\",\n \"gta3.img/sfe_copchop.txd/helipad_mesh_t.dds\",\"gta3.img/baseball_sfsx.txd/helipad_mesh_t.dds\",\n \"gta3.img/vgnhelipad1.txd/helipad_mesh_t.dds\",\"gta3.img/baseball_sfsx.txd/helipad_mesh_t.dds\",\n \"gta3.img/vgnpwrmainbld.txd/helipad_mesh_t.dds\",\"gta3.img/baseball_sfsx.txd/helipad_mesh_t.dds\",\n \"gta3.img/moregenroofstuff.txd/helipad_strutt.dds\",\"gta3.img/baseball_sfsx.txd/helipad_strutt.dds\",\n \"gta3.img/sfe_copchop.txd/helipad_strutt.dds\",\"gta3.img/baseball_sfsx.txd/helipad_strutt.dds\",\n \"gta3.img/vgnhelipad1.txd/helipad_strutt.dds\",\"gta3.img/baseball_sfsx.txd/helipad_strutt.dds\",\n \"gta3.img/vgnpwrmainbld.txd/helipad_strutt.dds\",\"gta3.img/baseball_sfsx.txd/helipad_strutt.dds\",\n \"gta3.img/benches_cj.txd/telepole128.dds\",\"gta3.img/baseball_sfsx.txd/telepole128.dds\",\n \"gta3.img/canalsg_law.txd/telepole128.dds\",\"gta3.img/baseball_sfsx.txd/telepole128.dds\",\n \"gta3.img/crackfact_sfse.txd/telepole128.dds\",\"gta3.img/baseball_sfsx.txd/telepole128.dds\",\n \"gta3.img/des_ntown.txd/telepole128.dds\",\"gta3.img/baseball_sfsx.txd/telepole128.dds\",\n \"gta3.img/des_nwstuff.txd/telepole128.dds\",\"gta3.img/baseball_sfsx.txd/telepole128.dds\",\n \"gta3.img/des_pueblo.txd/telepole128.dds\",\"gta3.img/baseball_sfsx.txd/telepole128.dds\",\n \"gta3.img/drivingschool_sfse.txd/telepole128.dds\",\"gta3.img/baseball_sfsx.txd/telepole128.dds\",\n \"gta3.img/landjump.txd/telepole128.dds\",\"gta3.img/baseball_sfsx.txd/telepole128.dds\",\n \"gta3.img/sw_diner1.txd/telepole128.dds\",\"gta3.img/baseball_sfsx.txd/telepole128.dds\",\n \"gta3.img/vgsbikeschool.txd/telepole128.dds\",\"gta3.img/baseball_sfsx.txd/telepole128.dds\",\n \"gta_int.img/kickstart.txd/telepole128.dds\",\"gta3.img/baseball_sfsx.txd/telepole128.dds\",\n \"gta3.img/miragecasino2.txd/vgspshrailing1.dds\",\"gta3.img/bballcpark1.txd/vgspshrailing1.dds\",\n \"gta3.img/vgnretail5.txd/vgspshrailing1.dds\",\"gta3.img/bballcpark1.txd/vgspshrailing1.dds\",\n \"gta3.img/vgnsqrfnce.txd/vgspshrailing1.dds\",\"gta3.img/bballcpark1.txd/vgspshrailing1.dds\",\n \"gta3.img/cephotoblockcs_t.txd/backstageceiling1_128.dds\",\"gta3.img/bballcpark1.txd/backstageceiling1_128.dds\",\n \"gta3.img/garag3_lawn.txd/backstageceiling1_128.dds\",\"gta3.img/bballcpark1.txd/backstageceiling1_128.dds\",\n \"gta3.img/gravblok01_lahills.txd/backstageceiling1_128.dds\",\"gta3.img/bballcpark1.txd/backstageceiling1_128.dds\",\n \"gta3.img/lawnbit.txd/backstageceiling1_128.dds\",\"gta3.img/bballcpark1.txd/backstageceiling1_128.dds\",\n \"gta3.img/melrose12_lawn.txd/backstageceiling1_128.dds\",\"gta3.img/bballcpark1.txd/backstageceiling1_128.dds\",\n \"gta3.img/plaza1_lan2.txd/backstageceiling1_128.dds\",\"gta3.img/bballcpark1.txd/backstageceiling1_128.dds\",\n \"gta3.img/richman04_lahills.txd/backstageceiling1_128.dds\",\"gta3.img/bballcpark1.txd/backstageceiling1_128.dds\",\n \"gta3.img/roads_lawn.txd/backstageceiling1_128.dds\",\"gta3.img/bballcpark1.txd/backstageceiling1_128.dds\",\n \"gta3.img/roads_tunnellahills.txd/backstageceiling1_128.dds\",\"gta3.img/bballcpark1.txd/backstageceiling1_128.dds\",\n \"gta3.img/sunrise01_lawn.txd/backstageceiling1_128.dds\",\"gta3.img/bballcpark1.txd/backstageceiling1_128.dds\",\n \"gta3.img/sunrise04_lawn.txd/backstageceiling1_128.dds\",\"gta3.img/bballcpark1.txd/backstageceiling1_128.dds\",\n \"gta3.img/sunrise11_lawn.txd/backstageceiling1_128.dds\",\"gta3.img/bballcpark1.txd/backstageceiling1_128.dds\",\n \"gta3.img/sunset01_lawn.txd/backstageceiling1_128.dds\",\"gta3.img/bballcpark1.txd/backstageceiling1_128.dds\",\n \"gta3.img/sunset04_law2.txd/backstageceiling1_128.dds\",\"gta3.img/bballcpark1.txd/backstageceiling1_128.dds\",\n \"gta3.img/sunst18_lawn.txd/backstageceiling1_128.dds\",\"gta3.img/bballcpark1.txd/backstageceiling1_128.dds\",\n \"gta3.img/vgnshamcpark.txd/backstageceiling1_128.dds\",\"gta3.img/bballcpark1.txd/backstageceiling1_128.dds\",\n \"gta3.img/blokmodb.txd/ws_carparknew2.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew2.dds\",\n \"gta3.img/boxybld2_sfw.txd/ws_carparknew2.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew2.dds\",\n \"gta3.img/boxybld_sfw.txd/ws_carparknew2.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew2.dds\",\n \"gta3.img/cathedral_sfs.txd/ws_carparknew2.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew2.dds\",\n \"gta3.img/chinatownsfe.txd/ws_carparknew2.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew2.dds\",\n \"gta3.img/cuntwlandcarparks.txd/ws_carparknew2.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew2.dds\",\n \"gta3.img/cuntwland.txd/ws_carparknew2.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew2.dds\",\n \"gta3.img/cuntwlandwest.txd/ws_carparknew2.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew2.dds\",\n \"gta3.img/cuntwroad.txd/ws_carparknew2.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew2.dds\",\n \"gta3.img/fedmint_sfs.txd/ws_carparknew2.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew2.dds\",\n \"gta3.img/ggatepark.txd/ws_carparknew2.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew2.dds\",\n \"gta3.img/glenpark1_lae.txd/ws_carparknew2.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew2.dds\",\n \"gta3.img/glenpark6d_lae.txd/ws_carparknew2.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew2.dds\",\n \"gta3.img/hashblock1b_sfs.txd/ws_carparknew2.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew2.dds\",\n \"gta3.img/hashhouses1_sfs.txd/ws_carparknew2.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew2.dds\",\n \"gta3.img/hotel1.txd/ws_carparknew2.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew2.dds\",\n \"gta3.img/lombard.txd/ws_carparknew2.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew2.dds\",\n \"gta3.img/miragecasino1.txd/ws_carparknew2.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew2.dds\",\n \"gta3.img/pinkcarpark_sfs.txd/ws_carparknew2.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew2.dds\",\n \"gta3.img/railway_las.txd/ws_carparknew2.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew2.dds\",\n \"gta3.img/roads_sfs.txd/ws_carparknew2.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew2.dds\",\n \"gta3.img/sfvictorian.txd/ws_carparknew2.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew2.dds\",\n \"gta3.img/silicon_sfse.txd/ws_carparknew2.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew2.dds\",\n \"gta3.img/smallertxd.txd/ws_carparknew2.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew2.dds\",\n \"gta3.img/stadium_lae2.txd/ws_carparknew2.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew2.dds\",\n \"gta3.img/stapl.txd/ws_carparknew2.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew2.dds\",\n \"gta3.img/sunrise10_lawn.txd/ws_carparknew2.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew2.dds\",\n \"gta3.img/sunse10b_law2.txd/ws_carparknew2.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew2.dds\",\n \"gta3.img/sunset04_law2.txd/ws_carparknew2.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew2.dds\",\n \"gta3.img/sw_block04.txd/ws_carparknew2.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew2.dds\",\n \"gta3.img/sw_block06.txd/ws_carparknew2.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew2.dds\",\n \"gta3.img/sw_office.txd/ws_carparknew2.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew2.dds\",\n \"gta3.img/traintrack_las.txd/ws_carparknew2.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew2.dds\",\n \"gta3.img/vegasbuild.txd/ws_carparknew2.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew2.dds\",\n \"gta3.img/vegasdwntwn1.txd/ws_carparknew2.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew2.dds\",\n \"gta3.img/vgnland.txd/ws_carparknew2.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew2.dds\",\n \"gta3.img/vgnshamcpark.txd/ws_carparknew2.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew2.dds\",\n \"gta3.img/vgsbikeschool.txd/ws_carparknew2.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew2.dds\",\n \"gta3.img/vgsschurch.txd/ws_carparknew2.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew2.dds\",\n \"gta3.img/vgssland01.txd/ws_carparknew2.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew2.dds\",\n \"gta3.img/vgwestcoast.txd/ws_carparknew2.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew2.dds\",\n \"gta3.img/vgwestland2.txd/ws_carparknew2.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew2.dds\",\n \"gta3.img/vgwestland.txd/ws_carparknew2.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew2.dds\",\n \"gta3.img/vict_sfw.txd/ws_carparknew2.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew2.dds\",\n \"gta3.img/docks2_las2.txd/ws_carparknew2a.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew2a.dds\",\n \"gta3.img/docks_las2.txd/ws_carparknew2a.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew2a.dds\",\n \"gta3.img/vegasbuild.txd/ws_carparknew2a.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew2a.dds\",\n \"gta3.img/vgnland.txd/ws_carparknew2a.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew2a.dds\",\n \"gta3.img/vgsbikeschool.txd/ws_carparknew2a.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew2a.dds\",\n \"gta3.img/vgwestcoast.txd/ws_carparknew2a.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew2a.dds\",\n \"gta3.img/vgwestland.txd/ws_carparknew2a.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew2a.dds\",\n \"gta3.img/bs_sfs.txd/curbyell_64h.dds\",\"gta3.img/bballcpark1.txd/curbyell_64h.dds\",\n \"gta3.img/carpark3_lvs.txd/curbyell_64h.dds\",\"gta3.img/bballcpark1.txd/curbyell_64h.dds\",\n \"gta3.img/crparkgm_lan2.txd/curbyell_64h.dds\",\"gta3.img/bballcpark1.txd/curbyell_64h.dds\",\n \"gta3.img/lawnshite2n.txd/curbyell_64h.dds\",\"gta3.img/bballcpark1.txd/curbyell_64h.dds\",\n \"gta3.img/shamcpark.txd/curbyell_64h.dds\",\"gta3.img/bballcpark1.txd/curbyell_64h.dds\",\n \"gta3.img/stripshop1.txd/curbyell_64h.dds\",\"gta3.img/bballcpark1.txd/curbyell_64h.dds\",\n \"gta3.img/vegassland62.txd/curbyell_64h.dds\",\"gta3.img/bballcpark1.txd/curbyell_64h.dds\",\n \"gta3.img/vgeamun.txd/curbyell_64h.dds\",\"gta3.img/bballcpark1.txd/curbyell_64h.dds\",\n \"gta3.img/vgnamun.txd/curbyell_64h.dds\",\"gta3.img/bballcpark1.txd/curbyell_64h.dds\",\n \"gta3.img/vgnboiga1.txd/curbyell_64h.dds\",\"gta3.img/bballcpark1.txd/curbyell_64h.dds\",\n \"gta3.img/vgndwntwn22.txd/curbyell_64h.dds\",\"gta3.img/bballcpark1.txd/curbyell_64h.dds\",\n \"gta3.img/vgnfremnt1.txd/curbyell_64h.dds\",\"gta3.img/bballcpark1.txd/curbyell_64h.dds\",\n \"gta3.img/vgnland.txd/curbyell_64h.dds\",\"gta3.img/bballcpark1.txd/curbyell_64h.dds\",\n \"gta3.img/vgnlowbild.txd/curbyell_64h.dds\",\"gta3.img/bballcpark1.txd/curbyell_64h.dds\",\n \"gta3.img/vgnlowwall.txd/curbyell_64h.dds\",\"gta3.img/bballcpark1.txd/curbyell_64h.dds\",\n \"gta3.img/vgnptrlpmp.txd/curbyell_64h.dds\",\"gta3.img/bballcpark1.txd/curbyell_64h.dds\",\n \"gta3.img/vgnretail5.txd/curbyell_64h.dds\",\"gta3.img/bballcpark1.txd/curbyell_64h.dds\",\n \"gta3.img/vgnretail72.txd/curbyell_64h.dds\",\"gta3.img/bballcpark1.txd/curbyell_64h.dds\",\n \"gta3.img/vgnshopnmall.txd/curbyell_64h.dds\",\"gta3.img/bballcpark1.txd/curbyell_64h.dds\",\n \"gta3.img/vgse24hr.txd/curbyell_64h.dds\",\"gta3.img/bballcpark1.txd/curbyell_64h.dds\",\n \"gta3.img/vgsecarshow.txd/curbyell_64h.dds\",\"gta3.img/bballcpark1.txd/curbyell_64h.dds\",\n \"gta3.img/vgslowbuild.txd/curbyell_64h.dds\",\"gta3.img/bballcpark1.txd/curbyell_64h.dds\",\n \"gta3.img/vgsnbuild07.txd/curbyell_64h.dds\",\"gta3.img/bballcpark1.txd/curbyell_64h.dds\",\n \"gta3.img/vgsn_carpark01.txd/curbyell_64h.dds\",\"gta3.img/bballcpark1.txd/curbyell_64h.dds\",\n \"gta3.img/vgwestboiga1.txd/curbyell_64h.dds\",\"gta3.img/bballcpark1.txd/curbyell_64h.dds\",\n \"gta3.img/vgwestland.txd/curbyell_64h.dds\",\"gta3.img/bballcpark1.txd/curbyell_64h.dds\",\n \"gta3.img/vgwestretail1.txd/curbyell_64h.dds\",\"gta3.img/bballcpark1.txd/curbyell_64h.dds\",\n \"gta3.img/cathedral_sfs.txd/ws_carparknew1.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew1.dds\",\n \"gta3.img/cuntwlandcarparks.txd/ws_carparknew1.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew1.dds\",\n \"gta3.img/fedmint_sfs.txd/ws_carparknew1.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew1.dds\",\n \"gta3.img/glenpark1_lae.txd/ws_carparknew1.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew1.dds\",\n \"gta3.img/glenpark6d_lae.txd/ws_carparknew1.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew1.dds\",\n \"gta3.img/pinkcarpark_sfs.txd/ws_carparknew1.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew1.dds\",\n \"gta3.img/roads_sfs.txd/ws_carparknew1.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew1.dds\",\n \"gta3.img/silicon_sfse.txd/ws_carparknew1.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew1.dds\",\n \"gta3.img/stadium_lae2.txd/ws_carparknew1.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew1.dds\",\n \"gta3.img/stapl.txd/ws_carparknew1.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew1.dds\",\n \"gta3.img/sunrise10_lawn.txd/ws_carparknew1.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew1.dds\",\n \"gta3.img/sunse10b_law2.txd/ws_carparknew1.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew1.dds\",\n \"gta3.img/sunset04_law2.txd/ws_carparknew1.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew1.dds\",\n \"gta3.img/sw_block06.txd/ws_carparknew1.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew1.dds\",\n \"gta3.img/sw_office.txd/ws_carparknew1.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew1.dds\",\n \"gta3.img/vegasbuild.txd/ws_carparknew1.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew1.dds\",\n \"gta3.img/vgnland.txd/ws_carparknew1.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew1.dds\",\n \"gta3.img/vgwestcoast.txd/ws_carparknew1.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew1.dds\",\n \"gta3.img/vgwestland2.txd/ws_carparknew1.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew1.dds\",\n \"gta3.img/vgwestland.txd/ws_carparknew1.dds\",\"gta3.img/bballcpark1.txd/ws_carparknew1.dds\",\n \"gta3.img/bskball_standext.txd/wire2.dds\",\"gta3.img/bball_hpx.txd/wire2.dds\",\n \"gta3.img/cuntplntfnce.txd/wire2.dds\",\"gta3.img/bball_hpx.txd/wire2.dds\",\n \"gta3.img/santamonhus1.txd/wire2.dds\",\"gta3.img/bball_hpx.txd/wire2.dds\",\n \"gta3.img/santamonhus.txd/wire2.dds\",\"gta3.img/bball_hpx.txd/wire2.dds\",\n \"gta3.img/vgsbballnet1.txd/wire2.dds\",\"gta3.img/bball_hpx.txd/wire2.dds\",\n \"gta3.img/vgwestrailrd.txd/wire2.dds\",\"gta3.img/bball_hpx.txd/wire2.dds\",\n \"gta3.img/vgnhseland.txd/lodumstand1_lae.dds\",\"gta3.img/bballvgnintlod.txd/lodumstand1_lae.dds\",\n \"gta3.img/beach_las2.txd/bow_abattoir_conc2.dds\",\"gta3.img/bballvgnint.txd/bow_abattoir_conc2.dds\",\n \"gta3.img/ce_ground11.txd/bow_abattoir_conc2.dds\",\"gta3.img/bballvgnint.txd/bow_abattoir_conc2.dds\",\n \"gta3.img/ce_pizza.txd/bow_abattoir_conc2.dds\",\"gta3.img/bballvgnint.txd/bow_abattoir_conc2.dds\",\n \"gta3.img/chemgrnd_las2.txd/bow_abattoir_conc2.dds\",\"gta3.img/bballvgnint.txd/bow_abattoir_conc2.dds\",\n \"gta3.img/civic1_lan2.txd/bow_abattoir_conc2.dds\",\"gta3.img/bballvgnint.txd/bow_abattoir_conc2.dds\",\n \"gta3.img/cunte1_lahills.txd/bow_abattoir_conc2.dds\",\"gta3.img/bballvgnint.txd/bow_abattoir_conc2.dds\",\n \"gta3.img/cunteroads3.txd/bow_abattoir_conc2.dds\",\"gta3.img/bballvgnint.txd/bow_abattoir_conc2.dds\",\n \"gta3.img/cunteroads5.txd/bow_abattoir_conc2.dds\",\"gta3.img/bballvgnint.txd/bow_abattoir_conc2.dds\",\n \"gta3.img/docks_las2.txd/bow_abattoir_conc2.dds\",\"gta3.img/bballvgnint.txd/bow_abattoir_conc2.dds\",\n \"gta3.img/downtown1_las.txd/bow_abattoir_conc2.dds\",\"gta3.img/bballvgnint.txd/bow_abattoir_conc2.dds\",\n \"gta3.img/downtown3_las.txd/bow_abattoir_conc2.dds\",\"gta3.img/bballvgnint.txd/bow_abattoir_conc2.dds\",\n \"gta3.img/easthills_lahills.txd/bow_abattoir_conc2.dds\",\"gta3.img/bballvgnint.txd/bow_abattoir_conc2.dds\",\n \"gta3.img/freeway2_las2.txd/bow_abattoir_conc2.dds\",\"gta3.img/bballvgnint.txd/bow_abattoir_conc2.dds\",\n \"gta3.img/freeway2_las.txd/bow_abattoir_conc2.dds\",\"gta3.img/bballvgnint.txd/bow_abattoir_conc2.dds\",\n \"gta3.img/glenpark1x_lae.txd/bow_abattoir_conc2.dds\",\"gta3.img/bballvgnint.txd/bow_abattoir_conc2.dds\",\n \"gta3.img/griffobs_las.txd/bow_abattoir_conc2.dds\",\"gta3.img/bballvgnint.txd/bow_abattoir_conc2.dds\",\n \"gta3.img/ground2_las2.txd/bow_abattoir_conc2.dds\",\"gta3.img/bballvgnint.txd/bow_abattoir_conc2.dds\",\n \"gta3.img/ground3_las.txd/bow_abattoir_conc2.dds\",\"gta3.img/bballvgnint.txd/bow_abattoir_conc2.dds\",\n \"gta3.img/ground5_las.txd/bow_abattoir_conc2.dds\",\"gta3.img/bballvgnint.txd/bow_abattoir_conc2.dds\",\n \"gta3.img/groundb_las2.txd/bow_abattoir_conc2.dds\",\"gta3.img/bballvgnint.txd/bow_abattoir_conc2.dds\",\n \"gta3.img/ground_las2.txd/bow_abattoir_conc2.dds\",\"gta3.img/bballvgnint.txd/bow_abattoir_conc2.dds\",\n \"gta3.img/hillhousex13_6.txd/bow_abattoir_conc2.dds\",\"gta3.img/bballvgnint.txd/bow_abattoir_conc2.dds\",\n \"gta3.img/hillhousex4_5.txd/bow_abattoir_conc2.dds\",\"gta3.img/bballvgnint.txd/bow_abattoir_conc2.dds\",\n \"gta3.img/idlewood3_lae.txd/bow_abattoir_conc2.dds\",\"gta3.img/bballvgnint.txd/bow_abattoir_conc2.dds\",\n \"gta3.img/laeroads2s.txd/bow_abattoir_conc2.dds\",\"gta3.img/bballvgnint.txd/bow_abattoir_conc2.dds\",\n \"gta3.img/lahillshilhs1x.txd/bow_abattoir_conc2.dds\",\"gta3.img/bballvgnint.txd/bow_abattoir_conc2.dds\",\n \"gta3.img/lahills_whisky.txd/bow_abattoir_conc2.dds\",\"gta3.img/bballvgnint.txd/bow_abattoir_conc2.dds\",\n \"gta3.img/lan2freeway.txd/bow_abattoir_conc2.dds\",\"gta3.img/bballvgnint.txd/bow_abattoir_conc2.dds\",\n \"gta3.img/lasground2_las2.txd/bow_abattoir_conc2.dds\",\"gta3.img/bballvgnint.txd/bow_abattoir_conc2.dds\",\n \"gta3.img/lashops1b_las2.txd/bow_abattoir_conc2.dds\",\"gta3.img/bballvgnint.txd/bow_abattoir_conc2.dds\",\n \"gta3.img/lashops93_las2.txd/bow_abattoir_conc2.dds\",\"gta3.img/bballvgnint.txd/bow_abattoir_conc2.dds\",\n \"gta3.img/lasraodnshops.txd/bow_abattoir_conc2.dds\",\"gta3.img/bballvgnint.txd/bow_abattoir_conc2.dds\",\n \"gta3.img/lasroads_las2.txd/bow_abattoir_conc2.dds\",\"gta3.img/bballvgnint.txd/bow_abattoir_conc2.dds\",\n \"gta3.img/lasroads_las.txd/bow_abattoir_conc2.dds\",\"gta3.img/bballvgnint.txd/bow_abattoir_conc2.dds\",\n \"gta3.img/law_beach1.txd/bow_abattoir_conc2.dds\",\"gta3.img/bballvgnint.txd/bow_abattoir_conc2.dds\",\n \"gta3.img/lawland2.txd/bow_abattoir_conc2.dds\",\"gta3.img/bballvgnint.txd/bow_abattoir_conc2.dds\",\n \"gta3.img/oldshops_las.txd/bow_abattoir_conc2.dds\",\"gta3.img/bballvgnint.txd/bow_abattoir_conc2.dds\",\n \"gta3.img/railway_las.txd/bow_abattoir_conc2.dds\",\"gta3.img/bballvgnint.txd/bow_abattoir_conc2.dds\",\n \"gta3.img/santamonicalaw2a.txd/bow_abattoir_conc2.dds\",\"gta3.img/bballvgnint.txd/bow_abattoir_conc2.dds\",\n \"gta3.img/shopliquor_las.txd/bow_abattoir_conc2.dds\",\"gta3.img/bballvgnint.txd/bow_abattoir_conc2.dds\",\n \"gta3.img/sjmla_las.txd/bow_abattoir_conc2.dds\",\"gta3.img/bballvgnint.txd/bow_abattoir_conc2.dds\",\n \"gta3.img/stolenbuild03.txd/bow_abattoir_conc2.dds\",\"gta3.img/bballvgnint.txd/bow_abattoir_conc2.dds\",\n \"gta3.img/stormdrain_las2.txd/bow_abattoir_conc2.dds\",\"gta3.img/bballvgnint.txd/bow_abattoir_conc2.dds\",\n \"gta3.img/sw_apartments.txd/bow_abattoir_conc2.dds\",\"gta3.img/bballvgnint.txd/bow_abattoir_conc2.dds\",\n \"gta3.img/sw_block10.txd/bow_abattoir_conc2.dds\",\"gta3.img/bballvgnint.txd/bow_abattoir_conc2.dds\",\n \"gta3.img/vgndwntwn2.txd/bow_abattoir_conc2.dds\",\"gta3.img/bballvgnint.txd/bow_abattoir_conc2.dds\",\n \"gta3.img/vgnland.txd/bow_abattoir_conc2.dds\",\"gta3.img/bballvgnint.txd/bow_abattoir_conc2.dds\",\n \"gta3.img/vgnpwroutbld1.txd/bow_abattoir_conc2.dds\",\"gta3.img/bballvgnint.txd/bow_abattoir_conc2.dds\",\n \"gta3.img/warehus_las2.txd/bow_abattoir_conc2.dds\",\"gta3.img/bballvgnint.txd/bow_abattoir_conc2.dds\",\n \"gta_int.img/inneroval.txd/bow_abattoir_conc2.dds\",\"gta3.img/bballvgnint.txd/bow_abattoir_conc2.dds\",\n \"gta_int.img/intgarage2aint3.txd/bow_abattoir_conc2.dds\",\"gta3.img/bballvgnint.txd/bow_abattoir_conc2.dds\",\n \"gta_int.img/int_kbsgarage3.txd/bow_abattoir_conc2.dds\",\"gta3.img/bballvgnint.txd/bow_abattoir_conc2.dds\",\n \"gta_int.img/lee_bdupsmain.txd/bow_abattoir_conc2.dds\",\"gta3.img/bballvgnint.txd/bow_abattoir_conc2.dds\",\n \"gta_int.img/ovalsurround.txd/bow_abattoir_conc2.dds\",\"gta3.img/bballvgnint.txd/bow_abattoir_conc2.dds\",\n \"gta_int.img/stadstunt.txd/bow_abattoir_conc2.dds\",\"gta3.img/bballvgnint.txd/bow_abattoir_conc2.dds\",\n \"gta3.img/cw2_storesnstuff.txd/forumstand1_lae.dds\",\"gta3.img/bballvgnint.txd/forumstand1_lae.dds\",\n \"gta_int.img/711c.txd/forumstand1_lae.dds\",\"gta3.img/bballvgnint.txd/forumstand1_lae.dds\",\n \"gta_int.img/genintint711_1.txd/forumstand1_lae.dds\",\"gta3.img/bballvgnint.txd/forumstand1_lae.dds\",\n \"gta3.img/desn2_peckers.txd/carparkwall1_256.dds\",\"gta3.img/bballvgnint.txd/carparkwall1_256.dds\",\n \"gta3.img/des_stownmain3.txd/carparkwall1_256.dds\",\"gta3.img/bballvgnint.txd/carparkwall1_256.dds\",\n \"gta3.img/des_substation.txd/carparkwall1_256.dds\",\"gta3.img/bballvgnint.txd/carparkwall1_256.dds\",\n \"gta3.img/hospital_lae.txd/carparkwall1_256.dds\",\"gta3.img/bballvgnint.txd/carparkwall1_256.dds\",\n \"gta3.img/laeroads2s.txd/carparkwall1_256.dds\",\"gta3.img/bballvgnint.txd/carparkwall1_256.dds\",\n \"gta3.img/laradarmast.txd/carparkwall1_256.dds\",\"gta3.img/bballvgnint.txd/carparkwall1_256.dds\",\n \"gta3.img/vegastemp1.txd/carparkwall1_256.dds\",\"gta3.img/bballvgnint.txd/carparkwall1_256.dds\",\n \"gta3.img/vgnbball.txd/carparkwall1_256.dds\",\"gta3.img/bballvgnint.txd/carparkwall1_256.dds\",\n \"gta3.img/vgnshamcpark.txd/carparkwall1_256.dds\",\"gta3.img/bballvgnint.txd/carparkwall1_256.dds\",\n \"gta3.img/icons1.txd/blugrad32.dds\",\"gta3.img/bbpcpx.txd/blugrad32.dds\",\n \"gta3.img/icons4.txd/blugrad32.dds\",\"gta3.img/bbpcpx.txd/blugrad32.dds\",\n \"gta3.img/glenphouse_lax.txd/awningsides2.dds\",\"gta3.img/bdupshouse_lae.txd/awningsides2.dds\",\n \"gta3.img/mainlcawn.txd/awningsides2.dds\",\"gta3.img/bdupshouse_lae.txd/awningsides2.dds\",\n \"gta3.img/sunset02_law2.txd/awningsides2.dds\",\"gta3.img/bdupshouse_lae.txd/awningsides2.dds\",\n \"gta3.img/chicano10_lae.txd/comptwall23.dds\",\"gta3.img/bdupshouse_lae.txd/comptwall23.dds\",\n \"gta3.img/glenphouse_lax.txd/comptwall23.dds\",\"gta3.img/bdupshouse_lae.txd/comptwall23.dds\",\n \"gta3.img/idlewood6_lae.txd/comptwall23.dds\",\"gta3.img/bdupshouse_lae.txd/comptwall23.dds\",\n \"gta3.img/inglewood01_lax.txd/comptwall23.dds\",\"gta3.img/bdupshouse_lae.txd/comptwall23.dds\",\n \"gta3.img/rodeoprk_law2.txd/comptwall23.dds\",\"gta3.img/bdupshouse_lae.txd/comptwall23.dds\",\n \"gta3.img/chicano10_lae.txd/ws_boxhouse_wins3.dds\",\"gta3.img/bdupshouse_lae.txd/ws_boxhouse_wins3.dds\",\n \"gta3.img/glenphouse_lax.txd/ws_boxhouse_wins3.dds\",\"gta3.img/bdupshouse_lae.txd/ws_boxhouse_wins3.dds\",\n \"gta3.img/inglewood01_lax.txd/ws_boxhouse_wins3.dds\",\"gta3.img/bdupshouse_lae.txd/ws_boxhouse_wins3.dds\",\n \"gta3.img/lae2grnd.txd/ws_boxhouse_wins3.dds\",\"gta3.img/bdupshouse_lae.txd/ws_boxhouse_wins3.dds\",\n \"gta3.img/beafron1_law2.txd/gangwin4_lae.dds\",\"gta3.img/bdupshouse_lae.txd/gangwin4_lae.dds\",\n \"gta3.img/chicano10_lae.txd/gangwin4_lae.dds\",\"gta3.img/bdupshouse_lae.txd/gangwin4_lae.dds\",\n \"gta3.img/contachou1_lae2.txd/gangwin4_lae.dds\",\"gta3.img/bdupshouse_lae.txd/gangwin4_lae.dds\",\n \"gta3.img/eastls1b_lae2.txd/gangwin4_lae.dds\",\"gta3.img/bdupshouse_lae.txd/gangwin4_lae.dds\",\n \"gta3.img/eastls4_lae2.txd/gangwin4_lae.dds\",\"gta3.img/bdupshouse_lae.txd/gangwin4_lae.dds\",\n \"gta3.img/melrose12_lawn.txd/gangwin4_lae.dds\",\"gta3.img/bdupshouse_lae.txd/gangwin4_lae.dds\",\n \"gta3.img/rodeoprk_law2.txd/gangwin4_lae.dds\",\"gta3.img/bdupshouse_lae.txd/gangwin4_lae.dds\",\n \"gta_int.img/carter_outside.txd/gangwin4_lae.dds\",\"gta3.img/bdupshouse_lae.txd/gangwin4_lae.dds\",\n \"gta3.img/chicano10_lae.txd/compdoor2_lae.dds\",\"gta3.img/bdupshouse_lae.txd/compdoor2_lae.dds\",\n \"gta3.img/glenphouse_lax.txd/compdoor2_lae.dds\",\"gta3.img/bdupshouse_lae.txd/compdoor2_lae.dds\",\n \"gta3.img/lae2grnd.txd/compdoor2_lae.dds\",\"gta3.img/bdupshouse_lae.txd/compdoor2_lae.dds\",\n \"gta3.img/landlae2b.txd/compdoor2_lae.dds\",\"gta3.img/bdupshouse_lae.txd/compdoor2_lae.dds\",\n \"gta3.img/chicano10_lae.txd/compdoor4_lae.dds\",\"gta3.img/bdupshouse_lae.txd/compdoor4_lae.dds\",\n \"gta3.img/eastls1b_lae2.txd/compdoor4_lae.dds\",\"gta3.img/bdupshouse_lae.txd/compdoor4_lae.dds\",\n \"gta3.img/eastls4_lae2.txd/compdoor4_lae.dds\",\"gta3.img/bdupshouse_lae.txd/compdoor4_lae.dds\",\n \"gta3.img/ganton02_lae2.txd/compdoor4_lae.dds\",\"gta3.img/bdupshouse_lae.txd/compdoor4_lae.dds\",\n \"gta3.img/glenphouse_lax.txd/compdoor4_lae.dds\",\"gta3.img/bdupshouse_lae.txd/compdoor4_lae.dds\",\n \"gta3.img/lae2grnd.txd/compdoor4_lae.dds\",\"gta3.img/bdupshouse_lae.txd/compdoor4_lae.dds\",\n \"gta3.img/chicano10_lae.txd/sw_woodflloor.dds\",\"gta3.img/bdupshouse_lae.txd/sw_woodflloor.dds\",\n \"gta3.img/glenphouse_lax.txd/sw_woodflloor.dds\",\"gta3.img/bdupshouse_lae.txd/sw_woodflloor.dds\",\n \"gta3.img/park_sfw.txd/sw_woodflloor.dds\",\"gta3.img/bdupshouse_lae.txd/sw_woodflloor.dds\",\n \"gta3.img/sunset01_lawn.txd/sw_woodflloor.dds\",\"gta3.img/bdupshouse_lae.txd/sw_woodflloor.dds\",\n \"gta3.img/sw_apartments.txd/sw_woodflloor.dds\",\"gta3.img/bdupshouse_lae.txd/sw_woodflloor.dds\",\n \"gta3.img/sw_shack2.txd/sw_woodflloor.dds\",\"gta3.img/bdupshouse_lae.txd/sw_woodflloor.dds\",\n \"gta3.img/boxybld2_sfw.txd/shingles3.dds\",\"gta3.img/bdupshouse_lae.txd/shingles3.dds\",\n \"gta3.img/cetown3cs_t.txd/shingles3.dds\",\"gta3.img/bdupshouse_lae.txd/shingles3.dds\",\n \"gta3.img/chicano10_lae.txd/shingles3.dds\",\"gta3.img/bdupshouse_lae.txd/shingles3.dds\",\n \"gta3.img/cuntwbtzzcs_t.txd/shingles3.dds\",\"gta3.img/bdupshouse_lae.txd/shingles3.dds\",\n \"gta3.img/des_dinerw.txd/shingles3.dds\",\"gta3.img/bdupshouse_lae.txd/shingles3.dds\",\n \"gta3.img/glenpark6_lae.txd/shingles3.dds\",\"gta3.img/bdupshouse_lae.txd/shingles3.dds\",\n \"gta3.img/glenphouse_lax.txd/shingles3.dds\",\"gta3.img/bdupshouse_lae.txd/shingles3.dds\",\n \"gta3.img/ground3_las.txd/shingles3.dds\",\"gta3.img/bdupshouse_lae.txd/shingles3.dds\",\n \"gta3.img/jeffers4_lae.txd/shingles3.dds\",\"gta3.img/bdupshouse_lae.txd/shingles3.dds\",\n \"gta3.img/mainlcawn.txd/shingles3.dds\",\"gta3.img/bdupshouse_lae.txd/shingles3.dds\",\n \"gta3.img/melrose12_lawn.txd/shingles3.dds\",\"gta3.img/bdupshouse_lae.txd/shingles3.dds\",\n \"gta3.img/ct_stabx.txd/ct_canopy.dds\",\"gta3.img/bdwinx.txd/ct_canopy.dds\",\n \"gta3.img/coveredpath_sfs.txd/ind_roadskank.dds\",\"gta3.img/beachapts_lax.txd/ind_roadskank.dds\",\n \"gta3.img/lanblokb2.txd/ind_roadskank.dds\",\"gta3.img/beachapts_lax.txd/ind_roadskank.dds\",\n \"gta3.img/lanriver.txd/ind_roadskank.dds\",\"gta3.img/beachapts_lax.txd/ind_roadskank.dds\",\n \"gta3.img/burnsground.txd/grass_dry_64hv.dds\",\"gta3.img/beachapts_lax.txd/grass_dry_64hv.dds\",\n \"gta3.img/coast_apts.txd/grass_dry_64hv.dds\",\"gta3.img/beachapts_lax.txd/grass_dry_64hv.dds\",\n \"gta3.img/eastbeach4a_lae2.txd/grass_dry_64hv.dds\",\"gta3.img/beachapts_lax.txd/grass_dry_64hv.dds\",\n \"gta3.img/ebeachcineblok.txd/grass_dry_64hv.dds\",\"gta3.img/beachapts_lax.txd/grass_dry_64hv.dds\",\n \"gta3.img/garag3_lawn.txd/grass_dry_64hv.dds\",\"gta3.img/beachapts_lax.txd/grass_dry_64hv.dds\",\n \"gta3.img/lae2grnd.txd/grass_dry_64hv.dds\",\"gta3.img/beachapts_lax.txd/grass_dry_64hv.dds\",\n \"gta3.img/beafron2_law2.txd/eastwin07_lae2.dds\",\"gta3.img/beachapts_lax.txd/eastwin07_lae2.dds\",\n \"gta3.img/stolenbuild01.txd/eastwin07_lae2.dds\",\"gta3.img/beachapts_lax.txd/eastwin07_lae2.dds\",\n \"gta3.img/coast_apts.txd/eastwall3_lae2.dds\",\"gta3.img/beachapts_lax.txd/eastwall3_lae2.dds\",\n \"gta3.img/mulhousclahills.txd/eastwall3_lae2.dds\",\"gta3.img/beachapts_lax.txd/eastwall3_lae2.dds\",\n \"gta3.img/rodeo01_law2.txd/eastwall3_lae2.dds\",\"gta3.img/beachapts_lax.txd/eastwall3_lae2.dds\",\n \"gta3.img/coast_apts.txd/eastwall4_lae2.dds\",\"gta3.img/beachapts_lax.txd/eastwall4_lae2.dds\",\n \"gta3.img/ce_bankalley1.txd/bow_dryclean_wall_upr.dds\",\"gta3.img/beachapts_lax.txd/bow_dryclean_wall_upr.dds\",\n \"gta3.img/ce_bankalley2.txd/bow_dryclean_wall_upr.dds\",\"gta3.img/beachapts_lax.txd/bow_dryclean_wall_upr.dds\",\n \"gta3.img/coast_apts.txd/bow_dryclean_wall_upr.dds\",\"gta3.img/beachapts_lax.txd/bow_dryclean_wall_upr.dds\",\n \"gta3.img/comedhos1_la.txd/bow_dryclean_wall_upr.dds\",\"gta3.img/beachapts_lax.txd/bow_dryclean_wall_upr.dds\",\n \"gta3.img/dingbat01_la.txd/bow_dryclean_wall_upr.dds\",\"gta3.img/beachapts_lax.txd/bow_dryclean_wall_upr.dds\",\n \"gta3.img/oldshops_las.txd/bow_dryclean_wall_upr.dds\",\"gta3.img/beachapts_lax.txd/bow_dryclean_wall_upr.dds\",\n \"gta3.img/sw_block12.txd/bow_dryclean_wall_upr.dds\",\"gta3.img/beachapts_lax.txd/bow_dryclean_wall_upr.dds\",\n \"gta3.img/sw_church.txd/bow_dryclean_wall_upr.dds\",\"gta3.img/beachapts_lax.txd/bow_dryclean_wall_upr.dds\",\n \"gta3.img/ci_studio5.txd/stormdrain6.dds\",\"gta3.img/beachapts_lax.txd/stormdrain6.dds\",\n \"gta3.img/coast_apts.txd/stormdrain6.dds\",\"gta3.img/beachapts_lax.txd/stormdrain6.dds\",\n \"gta3.img/des_ne.txd/stormdrain6.dds\",\"gta3.img/beachapts_lax.txd/stormdrain6.dds\",\n \"gta3.img/des_stownstrip1.txd/stormdrain6.dds\",\"gta3.img/beachapts_lax.txd/stormdrain6.dds\",\n \"gta3.img/des_trainstuff.txd/stormdrain6.dds\",\"gta3.img/beachapts_lax.txd/stormdrain6.dds\",\n \"gta3.img/ebeachcineblok.txd/stormdrain6.dds\",\"gta3.img/beachapts_lax.txd/stormdrain6.dds\",\n \"gta3.img/mullho03_lahills.txd/stormdrain6.dds\",\"gta3.img/beachapts_lax.txd/stormdrain6.dds\",\n \"gta3.img/multistory_sfe.txd/stormdrain6.dds\",\"gta3.img/beachapts_lax.txd/stormdrain6.dds\",\n \"gta3.img/sanclifbal1_lax.txd/stormdrain6.dds\",\"gta3.img/beachapts_lax.txd/stormdrain6.dds\",\n \"gta3.img/sancliff02_law2.txd/stormdrain6.dds\",\"gta3.img/beachapts_lax.txd/stormdrain6.dds\",\n \"gta3.img/sancliff_law2.txd/stormdrain6.dds\",\"gta3.img/beachapts_lax.txd/stormdrain6.dds\",\n \"gta3.img/stormdrain.txd/stormdrain6.dds\",\"gta3.img/beachapts_lax.txd/stormdrain6.dds\",\n \"gta3.img/coast_apts.txd/sjmscorclawn.dds\",\"gta3.img/beachapts_lax.txd/sjmscorclawn.dds\",\n \"gta3.img/coast_las2.txd/sjmscorclawn.dds\",\"gta3.img/beachapts_lax.txd/sjmscorclawn.dds\",\n \"gta3.img/eastbeach2a_lae2.txd/sjmscorclawn.dds\",\"gta3.img/beachapts_lax.txd/sjmscorclawn.dds\",\n \"gta3.img/ebeach_veg.txd/sjmscorclawn.dds\",\"gta3.img/beachapts_lax.txd/sjmscorclawn.dds\",\n \"gta3.img/glenpark1x_lae.txd/sjmscorclawn.dds\",\"gta3.img/beachapts_lax.txd/sjmscorclawn.dds\",\n \"gta3.img/ground2_las2.txd/sjmscorclawn.dds\",\"gta3.img/beachapts_lax.txd/sjmscorclawn.dds\",\n \"gta3.img/ground5_las.txd/sjmscorclawn.dds\",\"gta3.img/beachapts_lax.txd/sjmscorclawn.dds\",\n \"gta3.img/idlewood3_lae.txd/sjmscorclawn.dds\",\"gta3.img/beachapts_lax.txd/sjmscorclawn.dds\",\n \"gta3.img/idlewood46_lae.txd/sjmscorclawn.dds\",\"gta3.img/beachapts_lax.txd/sjmscorclawn.dds\",\n \"gta3.img/jeffers4_lae.txd/sjmscorclawn.dds\",\"gta3.img/beachapts_lax.txd/sjmscorclawn.dds\",\n \"gta3.img/landcoast_lae2.txd/sjmscorclawn.dds\",\"gta3.img/beachapts_lax.txd/sjmscorclawn.dds\",\n \"gta3.img/landlae2b.txd/sjmscorclawn.dds\",\"gta3.img/beachapts_lax.txd/sjmscorclawn.dds\",\n \"gta3.img/landlae2c.txd/sjmscorclawn.dds\",\"gta3.img/beachapts_lax.txd/sjmscorclawn.dds\",\n \"gta3.img/landlae2.txd/sjmscorclawn.dds\",\"gta3.img/beachapts_lax.txd/sjmscorclawn.dds\",\n \"gta3.img/lasground_las2.txd/sjmscorclawn.dds\",\"gta3.img/beachapts_lax.txd/sjmscorclawn.dds\",\n \"gta3.img/coast_apts.txd/comptcowind1.dds\",\"gta3.img/beachapts_lax.txd/comptcowind1.dds\",\n \"gta3.img/eastbeach4a_lae2.txd/comptcowind1.dds\",\"gta3.img/beachapts_lax.txd/comptcowind1.dds\",\n \"gta3.img/mullholl_lahills.txd/comptcowind1.dds\",\"gta3.img/beachapts_lax.txd/comptcowind1.dds\",\n \"gta3.img/sunrise09_lawn.txd/comptcowind1.dds\",\"gta3.img/beachapts_lax.txd/comptcowind1.dds\",\n \"gta3.img/tcecen4law.txd/comptcowind1.dds\",\"gta3.img/beachapts_lax.txd/comptcowind1.dds\",\n \"gta3.img/boxybld_sfw.txd/boxybox_sf4.dds\",\"gta3.img/beachbx_sfw.txd/boxybox_sf4.dds\",\n \"gta3.img/boxybld_sfw.txd/boxybox_sf4b.dds\",\"gta3.img/beachbx_sfw.txd/boxybox_sf4b.dds\",\n \"gta3.img/boxybld_sfw.txd/boxybox_sf3.dds\",\"gta3.img/beachbx_sfw.txd/boxybox_sf3.dds\",\n \"gta3.img/boxybld_sfw.txd/boxybox_sf3b.dds\",\"gta3.img/beachbx_sfw.txd/boxybox_sf3b.dds\",\n \"gta3.img/boxybld_sfw.txd/boxybox_sf2b.dds\",\"gta3.img/beachbx_sfw.txd/boxybox_sf2b.dds\",\n \"gta3.img/boxybld_sfw.txd/boxybox_sf2c.dds\",\"gta3.img/beachbx_sfw.txd/boxybox_sf2c.dds\",\n \"gta3.img/boxybld_sfw.txd/sf_garden3.dds\",\"gta3.img/beachbx_sfw.txd/sf_garden3.dds\",\n \"gta3.img/boxybld_sfw.txd/boxybox_sf6b.dds\",\"gta3.img/beachbx_sfw.txd/boxybox_sf6b.dds\",\n \"gta3.img/boxybld_sfw.txd/boxybox_sf6.dds\",\"gta3.img/beachbx_sfw.txd/boxybox_sf6.dds\",\n \"gta3.img/boxybld_sfw.txd/boxybox_sf2.dds\",\"gta3.img/beachbx_sfw.txd/boxybox_sf2.dds\",\n \"gta3.img/boxybld_sfw.txd/boxybox_sf5b.dds\",\"gta3.img/beachbx_sfw.txd/boxybox_sf5b.dds\",\n \"gta3.img/boxybld_sfw.txd/boxybox_sf5.dds\",\"gta3.img/beachbx_sfw.txd/boxybox_sf5.dds\",\n \"gta3.img/boxybld_sfw.txd/boxybox_sf1.dds\",\"gta3.img/beachbx_sfw.txd/boxybox_sf1.dds\",\n \"gta3.img/boxybld_sfw.txd/boxybox_sf1b.dds\",\"gta3.img/beachbx_sfw.txd/boxybox_sf1b.dds\",\n \"gta3.img/rock_coastsfw.txd/cst_rock_coast_sfw.dds\",\"gta3.img/beachbx_sfw.txd/cst_rock_coast_sfw.dds\",\n \"gta3.img/sandy_sfw.txd/cst_rock_coast_sfw.dds\",\"gta3.img/beachbx_sfw.txd/cst_rock_coast_sfw.dds\",\n \"gta3.img/rock_coastsfw.txd/newrockgrass_sfw.dds\",\"gta3.img/beachbx_sfw.txd/newrockgrass_sfw.dds\",\n \"gta3.img/sandy_sfw.txd/newrockgrass_sfw.dds\",\"gta3.img/beachbx_sfw.txd/newrockgrass_sfw.dds\",\n \"gta3.img/lodvgsslod.txd/ws_neatwoodfence_lod.dds\",\"gta3.img/beachhut_lod.txd/ws_neatwoodfence_lod.dds\",\n \"gta3.img/boxybld_sfw.txd/sw_flatroof01.dds\",\"gta3.img/beachhut.txd/sw_flatroof01.dds\",\n \"gta3.img/cunte_blockammo.txd/sw_flatroof01.dds\",\"gta3.img/beachhut.txd/sw_flatroof01.dds\",\n \"gta3.img/cunte_gas01.txd/sw_flatroof01.dds\",\"gta3.img/beachhut.txd/sw_flatroof01.dds\",\n \"gta3.img/cunte_lik.txd/sw_flatroof01.dds\",\"gta3.img/beachhut.txd/sw_flatroof01.dds\",\n \"gta3.img/cw2_logcabins.txd/sw_flatroof01.dds\",\"gta3.img/beachhut.txd/sw_flatroof01.dds\",\n \"gta3.img/cw2_storesnstuff.txd/sw_flatroof01.dds\",\"gta3.img/beachhut.txd/sw_flatroof01.dds\",\n \"gta3.img/desn2_stud.txd/sw_flatroof01.dds\",\"gta3.img/beachhut.txd/sw_flatroof01.dds\",\n \"gta3.img/desn_decocafe.txd/sw_flatroof01.dds\",\"gta3.img/beachhut.txd/sw_flatroof01.dds\",\n \"gta3.img/des_quarrybits.txd/sw_flatroof01.dds\",\"gta3.img/beachhut.txd/sw_flatroof01.dds\",\n \"gta3.img/des_stownmots1.txd/sw_flatroof01.dds\",\"gta3.img/beachhut.txd/sw_flatroof01.dds\",\n \"gta3.img/des_wgarage.txd/sw_flatroof01.dds\",\"gta3.img/beachhut.txd/sw_flatroof01.dds\",\n \"gta3.img/santamonicalaw2a.txd/sw_flatroof01.dds\",\"gta3.img/beachhut.txd/sw_flatroof01.dds\",\n \"gta3.img/sw_block05.txd/sw_flatroof01.dds\",\"gta3.img/beachhut.txd/sw_flatroof01.dds\",\n \"gta3.img/sw_diner1.txd/sw_flatroof01.dds\",\"gta3.img/beachhut.txd/sw_flatroof01.dds\",\n \"gta3.img/sw_genstore1.txd/sw_flatroof01.dds\",\"gta3.img/beachhut.txd/sw_flatroof01.dds\",\n \"gta3.img/gayclub_sfs.txd/ws_decking1.dds\",\"gta3.img/beachhut.txd/ws_decking1.dds\",\n \"gta3.img/ce_railbridge.txd/block2_low.dds\",\"gta3.img/beach_lae2.txd/block2_low.dds\",\n \"gta3.img/cunte1_lahills.txd/block2_low.dds\",\"gta3.img/beach_lae2.txd/block2_low.dds\",\n \"gta3.img/cw_truckstopcs_t.txd/block2_low.dds\",\"gta3.img/beach_lae2.txd/block2_low.dds\",\n \"gta3.img/desn2_truckstop.txd/block2_low.dds\",\"gta3.img/beach_lae2.txd/block2_low.dds\",\n \"gta3.img/des_nstuff.txd/block2_low.dds\",\"gta3.img/beach_lae2.txd/block2_low.dds\",\n \"gta3.img/des_se4.txd/block2_low.dds\",\"gta3.img/beach_lae2.txd/block2_low.dds\",\n \"gta3.img/hillcliff_lahills.txd/block2_low.dds\",\"gta3.img/beach_lae2.txd/block2_low.dds\",\n \"gta3.img/landsfw.txd/block2_low.dds\",\"gta3.img/beach_lae2.txd/block2_low.dds\",\n \"gta3.img/lanroad.txd/block2_low.dds\",\"gta3.img/beach_lae2.txd/block2_low.dds\",\n \"gta3.img/parktunnel_sfs.txd/block2_low.dds\",\"gta3.img/beach_lae2.txd/block2_low.dds\",\n \"gta3.img/subshops_sfs.txd/block2_low.dds\",\"gta3.img/beach_lae2.txd/block2_low.dds\",\n \"gta3.img/vegascourtbld.txd/block2_low.dds\",\"gta3.img/beach_lae2.txd/block2_low.dds\",\n \"gta3.img/vgsshospshop.txd/block2_low.dds\",\"gta3.img/beach_lae2.txd/block2_low.dds\",\n \"gta3.img/beach_las.txd/sm_minipalm1.dds\",\"gta3.img/beach_las2.txd/sm_minipalm1.dds\",\n \"gta3.img/beacliff_law2.txd/sm_minipalm1.dds\",\"gta3.img/beach_las2.txd/sm_minipalm1.dds\",\n \"gta3.img/eastlstr2_lae2.txd/sm_minipalm1.dds\",\"gta3.img/beach_las2.txd/sm_minipalm1.dds\",\n \"gta3.img/griffobs_las.txd/sm_minipalm1.dds\",\"gta3.img/beach_las2.txd/sm_minipalm1.dds\",\n \"gta3.img/lae2coast_alpha.txd/sm_minipalm1.dds\",\"gta3.img/beach_las2.txd/sm_minipalm1.dds\",\n \"gta3.img/laealpha.txd/sm_minipalm1.dds\",\"gta3.img/beach_las2.txd/sm_minipalm1.dds\",\n \"gta3.img/lawalphav.txd/sm_minipalm1.dds\",\"gta3.img/beach_las2.txd/sm_minipalm1.dds\",\n \"gta3.img/rodeo04_law2.txd/sm_minipalm1.dds\",\"gta3.img/beach_las2.txd/sm_minipalm1.dds\",\n \"gta3.img/sunstrans_law2.txd/sm_minipalm1.dds\",\"gta3.img/beach_las2.txd/sm_minipalm1.dds\",\n \"gta3.img/vgsscollege.txd/sm_minipalm1.dds\",\"gta3.img/beach_las2.txd/sm_minipalm1.dds\",\n \"gta3.img/wiresetc2_las.txd/sm_minipalm1.dds\",\"gta3.img/beach_las2.txd/sm_minipalm1.dds\",\n \"gta3.img/wiresetc_las2.txd/sm_minipalm1.dds\",\"gta3.img/beach_las2.txd/sm_minipalm1.dds\",\n \"gta3.img/wiresetc_las.txd/sm_minipalm1.dds\",\"gta3.img/beach_las2.txd/sm_minipalm1.dds\",\n \"gta_int.img/genintgtatrees.txd/sm_minipalm1.dds\",\"gta3.img/beach_las2.txd/sm_minipalm1.dds\",\n \"gta3.img/contachou1_lae2.txd/ganggraf04_la.dds\",\"gta3.img/beach_las2.txd/ganggraf04_la.dds\",\n \"gta3.img/ctscene_las.txd/ganggraf04_la.dds\",\"gta3.img/beach_las2.txd/ganggraf04_la.dds\",\n \"gta3.img/glenpark7_lae.txd/ganggraf04_la.dds\",\"gta3.img/beach_las2.txd/ganggraf04_la.dds\",\n \"gta3.img/stormd_filllas2.txd/ganggraf04_la.dds\",\"gta3.img/beach_las2.txd/ganggraf04_la.dds\",\n \"gta3.img/wiresetc2_las.txd/ganggraf04_la.dds\",\"gta3.img/beach_las2.txd/ganggraf04_la.dds\",\n \"gta3.img/wiresetc_las2.txd/ganggraf04_la.dds\",\"gta3.img/beach_las2.txd/ganggraf04_la.dds\",\n \"gta3.img/wiresetc_las.txd/ganggraf04_la.dds\",\"gta3.img/beach_las2.txd/ganggraf04_la.dds\",\n \"gta3.img/coast_las2.txd/boardwalk_la.dds\",\"gta3.img/beach_las2.txd/boardwalk_la.dds\",\n \"gta3.img/counte_b2.txd/boardwalk_la.dds\",\"gta3.img/beach_las2.txd/boardwalk_la.dds\",\n \"gta3.img/des_airfieldhus.txd/boardwalk_la.dds\",\"gta3.img/beach_las2.txd/boardwalk_la.dds\",\n \"gta3.img/des_geyser.txd/boardwalk_la.dds\",\"gta3.img/beach_las2.txd/boardwalk_la.dds\",\n \"gta3.img/des_nwstuff.txd/boardwalk_la.dds\",\"gta3.img/beach_las2.txd/boardwalk_la.dds\",\n \"gta3.img/des_nw.txd/boardwalk_la.dds\",\"gta3.img/beach_las2.txd/boardwalk_la.dds\",\n \"gta3.img/des_ranch.txd/boardwalk_la.dds\",\"gta3.img/beach_las2.txd/boardwalk_la.dds\",\n \"gta3.img/lae2roadscoast.txd/boardwalk_la.dds\",\"gta3.img/beach_las2.txd/boardwalk_la.dds\",\n \"gta3.img/lahillsground4.txd/boardwalk_la.dds\",\"gta3.img/beach_las2.txd/boardwalk_la.dds\",\n \"gta3.img/mulhousclahills.txd/boardwalk_la.dds\",\"gta3.img/beach_las2.txd/boardwalk_la.dds\",\n \"gta3.img/pirateship01.txd/boardwalk_la.dds\",\"gta3.img/beach_las2.txd/boardwalk_la.dds\",\n \"gta3.img/sw_diner1.txd/boardwalk_la.dds\",\"gta3.img/beach_las2.txd/boardwalk_la.dds\",\n \"gta3.img/sw_farm1.txd/boardwalk_la.dds\",\"gta3.img/beach_las2.txd/boardwalk_la.dds\",\n \"gta3.img/sw_sheds.txd/boardwalk_la.dds\",\"gta3.img/beach_las2.txd/boardwalk_la.dds\",\n \"gta3.img/w_town3cs_t.txd/boardwalk_la.dds\",\"gta3.img/beach_las2.txd/boardwalk_la.dds\",\n \"gta3.img/groundb_las2.txd/bow_meshfence.dds\",\"gta3.img/beach_las2.txd/bow_meshfence.dds\",\n \"gta3.img/wiresetc_las2.txd/bow_meshfence.dds\",\"gta3.img/beach_las2.txd/bow_meshfence.dds\",\n \"gta3.img/pirateland.txd/luxorwall02_128sandblend.dds\",\"gta3.img/beach_las2.txd/luxorwall02_128sandblend.dds\",\n \"gta3.img/ce_ground02.txd/sw_sand.dds\",\"gta3.img/beach_las2.txd/sw_sand.dds\",\n \"gta3.img/ce_ground03.txd/sw_sand.dds\",\"gta3.img/beach_las2.txd/sw_sand.dds\",\n \"gta3.img/ce_ground04.txd/sw_sand.dds\",\"gta3.img/beach_las2.txd/sw_sand.dds\",\n \"gta3.img/ce_ground05.txd/sw_sand.dds\",\"gta3.img/beach_las2.txd/sw_sand.dds\",\n \"gta3.img/ce_ground07.txd/sw_sand.dds\",\"gta3.img/beach_las2.txd/sw_sand.dds\",\n \"gta3.img/ce_ground08.txd/sw_sand.dds\",\"gta3.img/beach_las2.txd/sw_sand.dds\",\n \"gta3.img/cuntwlandcarparks.txd/sw_sand.dds\",\"gta3.img/beach_las2.txd/sw_sand.dds\",\n \"gta3.img/cuntwlandse.txd/sw_sand.dds\",\"gta3.img/beach_las2.txd/sw_sand.dds\",\n \"gta3.img/cuntwlandwest.txd/sw_sand.dds\",\"gta3.img/beach_las2.txd/sw_sand.dds\",\n \"gta3.img/sbedsfn_sfn.txd/sw_sand.dds\",\"gta3.img/beach_las2.txd/sw_sand.dds\",\n \"gta3.img/sw_railbridge.txd/sw_sand.dds\",\"gta3.img/beach_las2.txd/sw_sand.dds\",\n \"gta3.img/sw_shack2.txd/sw_sand.dds\",\"gta3.img/beach_las2.txd/sw_sand.dds\",\n \"gta3.img/vgseseabed.txd/sw_sand.dds\",\"gta3.img/beach_las2.txd/sw_sand.dds\",\n \"gta3.img/beacliff_law2.txd/sm_agave_bloom.dds\",\"gta3.img/beach_las.txd/sm_agave_bloom.dds\",\n \"gta3.img/rodeo04_law2.txd/sm_agave_bloom.dds\",\"gta3.img/beach_las.txd/sm_agave_bloom.dds\",\n \"gta3.img/sunstrans_law2.txd/sm_agave_bloom.dds\",\"gta3.img/beach_las.txd/sm_agave_bloom.dds\",\n \"gta3.img/law_beach1.txd/sandnew_law.dds\",\"gta3.img/beach_las.txd/sandnew_law.dds\",\n \"gta3.img/law_beach2.txd/sandnew_law.dds\",\"gta3.img/beach_las.txd/sandnew_law.dds\",\n \"gta3.img/lawland2.txd/sandnew_law.dds\",\"gta3.img/beach_las.txd/sandnew_law.dds\",\n \"gta3.img/santamonicalaw2a.txd/sandnew_law.dds\",\"gta3.img/beach_las.txd/sandnew_law.dds\",\n \"gta3.img/santamonicalaw2.txd/sandnew_law.dds\",\"gta3.img/beach_las.txd/sandnew_law.dds\",\n \"gta3.img/sfn_sfn.txd/sandnew_law.dds\",\"gta3.img/beach_las.txd/sandnew_law.dds\",\n \"gta3.img/griffobs_las.txd/grifnewtex1x_las.dds\",\"gta3.img/beach_las.txd/grifnewtex1x_las.dds\",\n \"gta3.img/lasground2_las2.txd/grifnewtex1x_las.dds\",\"gta3.img/beach_las.txd/grifnewtex1x_las.dds\",\n \"gta3.img/cunte1_lahills.txd/lasclifface.dds\",\"gta3.img/beach_las.txd/lasclifface.dds\",\n \"gta3.img/griffobs_las.txd/lasclifface.dds\",\"gta3.img/beach_las.txd/lasclifface.dds\",\n \"gta3.img/cs_ebridge.txd/pavea256.dds\",\"gta3.img/beach_sfs.txd/pavea256.dds\",\n \"gta3.img/cs_wbridge.txd/pavea256.dds\",\"gta3.img/beach_sfs.txd/pavea256.dds\",\n \"gta3.img/cuntwbtzzcs_t.txd/pavea256.dds\",\"gta3.img/beach_sfs.txd/pavea256.dds\",\n \"gta3.img/des_dinerw.txd/pavea256.dds\",\"gta3.img/beach_sfs.txd/pavea256.dds\",\n \"gta3.img/des_ebridge.txd/pavea256.dds\",\"gta3.img/beach_sfs.txd/pavea256.dds\",\n \"gta3.img/desn_decocafe.txd/pavea256.dds\",\"gta3.img/beach_sfs.txd/pavea256.dds\",\n \"gta3.img/des_n.txd/pavea256.dds\",\"gta3.img/beach_sfs.txd/pavea256.dds\",\n \"gta3.img/des_se1.txd/pavea256.dds\",\"gta3.img/beach_sfs.txd/pavea256.dds\",\n \"gta3.img/des_steakhouse.txd/pavea256.dds\",\"gta3.img/beach_sfs.txd/pavea256.dds\",\n \"gta3.img/des_stownw.txd/pavea256.dds\",\"gta3.img/beach_sfs.txd/pavea256.dds\",\n \"gta3.img/freeway2_sfs.txd/pavea256.dds\",\"gta3.img/beach_sfs.txd/pavea256.dds\",\n \"gta3.img/lahills_safe1.txd/pavea256.dds\",\"gta3.img/beach_sfs.txd/pavea256.dds\",\n \"gta3.img/sw_fact02alt.txd/pavea256.dds\",\"gta3.img/beach_sfs.txd/pavea256.dds\",\n \"gta3.img/vgssmulticarprk.txd/pavea256.dds\",\"gta3.img/beach_sfs.txd/pavea256.dds\",\n \"gta_int.img/ab_sfammumain.txd/pavea256.dds\",\"gta3.img/beach_sfs.txd/pavea256.dds\",\n \"gta3.img/underwater.txd/rocktb128.dds\",\"gta3.img/beach_sfs.txd/rocktb128.dds\",\n \"gta3.img/des_n.txd/sm_rock2_desert.dds\",\"gta3.img/beacliff_law2.txd/sm_rock2_desert.dds\",\n \"gta3.img/macpark1tr_lae.txd/sm_rock2_desert.dds\",\"gta3.img/beacliff_law2.txd/sm_rock2_desert.dds\",\n \"gta3.img/rodeo04_law2.txd/sm_rock2_desert.dds\",\"gta3.img/beacliff_law2.txd/sm_rock2_desert.dds\",\n \"gta_int.img/gen_pol_vegas.txd/sm_rock2_desert.dds\",\"gta3.img/beacliff_law2.txd/sm_rock2_desert.dds\",\n \"gta_int.img/kickstart.txd/sm_rock2_desert.dds\",\"gta3.img/beacliff_law2.txd/sm_rock2_desert.dds\",\n \"gta3.img/cunte_rocks.txd/sm_des_bush1.dds\",\"gta3.img/beacliff_law2.txd/sm_des_bush1.dds\",\n \"gta3.img/cw_tempstuffcs_t.txd/sm_des_bush1.dds\",\"gta3.img/beacliff_law2.txd/sm_des_bush1.dds\",\n \"gta3.img/des_dinerw.txd/sm_des_bush1.dds\",\"gta3.img/beacliff_law2.txd/sm_des_bush1.dds\",\n \"gta3.img/desert.txd/sm_des_bush1.dds\",\"gta3.img/beacliff_law2.txd/sm_des_bush1.dds\",\n \"gta3.img/desn2_minestuff.txd/sm_des_bush1.dds\",\"gta3.img/beacliff_law2.txd/sm_des_bush1.dds\",\n \"gta3.img/rodeo04_law2.txd/sm_des_bush1.dds\",\"gta3.img/beacliff_law2.txd/sm_des_bush1.dds\",\n \"gta3.img/vegashse2.txd/sm_des_bush1.dds\",\"gta3.img/beacliff_law2.txd/sm_des_bush1.dds\",\n \"gta3.img/vgndwntwn2.txd/sm_des_bush1.dds\",\"gta3.img/beacliff_law2.txd/sm_des_bush1.dds\",\n \"gta3.img/cw_tempstuffcs_t.txd/newtreeleaves128.dds\",\"gta3.img/beacliff_law2.txd/newtreeleaves128.dds\",\n \"gta3.img/des_dinerw.txd/newtreeleaves128.dds\",\"gta3.img/beacliff_law2.txd/newtreeleaves128.dds\",\n \"gta3.img/desn2_stud.txd/newtreeleaves128.dds\",\"gta3.img/beacliff_law2.txd/newtreeleaves128.dds\",\n \"gta3.img/des_trees.txd/newtreeleaves128.dds\",\"gta3.img/beacliff_law2.txd/newtreeleaves128.dds\",\n \"gta3.img/gta_tree_oak.txd/newtreeleaves128.dds\",\"gta3.img/beacliff_law2.txd/newtreeleaves128.dds\",\n \"gta3.img/laealpha.txd/newtreeleaves128.dds\",\"gta3.img/beacliff_law2.txd/newtreeleaves128.dds\",\n \"gta3.img/lawest1.txd/newtreeleaves128.dds\",\"gta3.img/beacliff_law2.txd/newtreeleaves128.dds\",\n \"gta3.img/lawwhitebuilds.txd/newtreeleaves128.dds\",\"gta3.img/beacliff_law2.txd/newtreeleaves128.dds\",\n \"gta3.img/rodeo04_law2.txd/newtreeleaves128.dds\",\"gta3.img/beacliff_law2.txd/newtreeleaves128.dds\",\n \"gta3.img/vgseflowers.txd/newtreeleaves128.dds\",\"gta3.img/beacliff_law2.txd/newtreeleaves128.dds\",\n \"gta_int.img/burger_tray.txd/newtreeleaves128.dds\",\"gta3.img/beacliff_law2.txd/newtreeleaves128.dds\",\n \"gta_int.img/cb_details.txd/newtreeleaves128.dds\",\"gta3.img/beacliff_law2.txd/newtreeleaves128.dds\",\n \"gta_int.img/chick_tray.txd/newtreeleaves128.dds\",\"gta3.img/beacliff_law2.txd/newtreeleaves128.dds\",\n \"gta3.img/lahills_curvesteps.txd/concretebigblu4256128.dds\",\"gta3.img/beacliff_law2.txd/concretebigblu4256128.dds\",\n \"gta3.img/rodeo03_law2.txd/concretebigblu4256128.dds\",\"gta3.img/beacliff_law2.txd/concretebigblu4256128.dds\",\n \"gta3.img/canalsg_law.txd/grasstype3.dds\",\"gta3.img/beacliff_law2.txd/grasstype3.dds\",\n \"gta3.img/casnorylgrnd.txd/grasstype3.dds\",\"gta3.img/beacliff_law2.txd/grasstype3.dds\",\n \"gta3.img/cuntwlandcarparks.txd/grasstype3.dds\",\"gta3.img/beacliff_law2.txd/grasstype3.dds\",\n \"gta3.img/cuntwlandse.txd/grasstype3.dds\",\"gta3.img/beacliff_law2.txd/grasstype3.dds\",\n \"gta3.img/cuntwland.txd/grasstype3.dds\",\"gta3.img/beacliff_law2.txd/grasstype3.dds\",\n \"gta3.img/trnstnground.txd/grasstype3.dds\",\"gta3.img/beacliff_law2.txd/grasstype3.dds\",\n \"gta3.img/miragecasino2.txd/redclifftop256.dds\",\"gta3.img/beacliff_law2.txd/redclifftop256.dds\",\n \"gta3.img/melrosetr1_lawn.txd/rippost01_la.dds\",\"gta3.img/beafron1_law2.txd/rippost01_la.dds\",\n \"gta3.img/chicano10_lae.txd/shutter02la.dds\",\"gta3.img/beafron1_law2.txd/shutter02la.dds\",\n \"gta3.img/shutters_lawn.txd/shutter02la.dds\",\"gta3.img/beafron1_law2.txd/shutter02la.dds\",\n \"gta3.img/sfn_apart02sfn.txd/woodroof01_128.dds\",\"gta3.img/beafron1_law2.txd/woodroof01_128.dds\",\n \"gta3.img/sw_church.txd/woodroof01_128.dds\",\"gta3.img/beafron1_law2.txd/woodroof01_128.dds\",\n \"gta3.img/vegashse4.txd/woodroof01_128.dds\",\"gta3.img/beafron1_law2.txd/woodroof01_128.dds\",\n \"gta3.img/w_town3cs_t.txd/woodroof01_128.dds\",\"gta3.img/beafron1_law2.txd/woodroof01_128.dds\",\n \"gta3.img/shops2_law.txd/blueshade2_64.dds\",\"gta3.img/beafron1_law2.txd/blueshade2_64.dds\",\n \"gta3.img/bev_law2.txd/pierroof01_law.dds\",\"gta3.img/beafron1_law2.txd/pierroof01_law.dds\",\n \"gta3.img/comedprj1_la.txd/comptwall31.dds\",\"gta3.img/beafron1_law2.txd/comptwall31.dds\",\n \"gta3.img/eastls3_lae2.txd/comptwall31.dds\",\"gta3.img/beafron1_law2.txd/comptwall31.dds\",\n \"gta3.img/imrancomp_las2.txd/comptwall31.dds\",\"gta3.img/beafron1_law2.txd/comptwall31.dds\",\n \"gta3.img/rodeo05_law2.txd/comptwall31.dds\",\"gta3.img/beafron1_law2.txd/comptwall31.dds\",\n \"gta3.img/laealpha.txd/compfence7_lae.dds\",\"gta3.img/beafron1_law2.txd/compfence7_lae.dds\",\n \"gta3.img/councl_law2.txd/comptwall30.dds\",\"gta3.img/beafron1_law2.txd/comptwall30.dds\",\n \"gta3.img/eastls3_lae2.txd/comptwall30.dds\",\"gta3.img/beafron1_law2.txd/comptwall30.dds\",\n \"gta3.img/garag3_lawn.txd/comptwall30.dds\",\"gta3.img/beafron1_law2.txd/comptwall30.dds\",\n \"gta3.img/idlewood46_lae.txd/comptwall30.dds\",\"gta3.img/beafron1_law2.txd/comptwall30.dds\",\n \"gta3.img/idlewood6_detail.txd/comptwall30.dds\",\"gta3.img/beafron1_law2.txd/comptwall30.dds\",\n \"gta3.img/lanbloke.txd/comptwall30.dds\",\"gta3.img/beafron1_law2.txd/comptwall30.dds\",\n \"gta3.img/melrose05_lawn.txd/comptwall30.dds\",\"gta3.img/beafron1_law2.txd/comptwall30.dds\",\n \"gta3.img/melrose12_lawn.txd/comptwall30.dds\",\"gta3.img/beafron1_law2.txd/comptwall30.dds\",\n \"gta3.img/melrose19_lawn.txd/comptwall30.dds\",\"gta3.img/beafron1_law2.txd/comptwall30.dds\",\n \"gta3.img/piera_law2.txd/comptwall30.dds\",\"gta3.img/beafron1_law2.txd/comptwall30.dds\",\n \"gta3.img/sunrise11_lawn.txd/comptwall30.dds\",\"gta3.img/beafron1_law2.txd/comptwall30.dds\",\n \"gta3.img/sunset01_lawn.txd/comptwall30.dds\",\"gta3.img/beafron1_law2.txd/comptwall30.dds\",\n \"gta3.img/glenpark6d_lae.txd/shutter04la.dds\",\"gta3.img/beafron1_law2.txd/shutter04la.dds\",\n \"gta3.img/vgsswarehse02.txd/pierwin03_law.dds\",\"gta3.img/beafron1_law2.txd/pierwin03_law.dds\",\n \"gta3.img/ce_pizza.txd/comptwall37.dds\",\"gta3.img/beafron1_law2.txd/comptwall37.dds\",\n \"gta3.img/eastls4_lae2.txd/comptwall37.dds\",\"gta3.img/beafron1_law2.txd/comptwall37.dds\",\n \"gta3.img/idlewood3_lae.txd/comptwall37.dds\",\"gta3.img/beafron1_law2.txd/comptwall37.dds\",\n \"gta3.img/inglewood01_lax.txd/comptwall37.dds\",\"gta3.img/beafron1_law2.txd/comptwall37.dds\",\n \"gta3.img/santamonhus1.txd/comptwall37.dds\",\"gta3.img/beafron1_law2.txd/comptwall37.dds\",\n \"gta3.img/sunrise11_lawn.txd/comptwall37.dds\",\"gta3.img/beafron1_law2.txd/comptwall37.dds\",\n \"gta3.img/bev_law2.txd/shingledblue_la.dds\",\"gta3.img/beafron1_law2.txd/shingledblue_la.dds\",\n \"gta3.img/pierb_law2.txd/shingledblue_la.dds\",\"gta3.img/beafron1_law2.txd/shingledblue_la.dds\",\n \"gta3.img/logcabincs_t.txd/gen_scaffold_wood_under.dds\",\"gta3.img/beafron1_law2.txd/gen_scaffold_wood_under.dds\",\n \"gta3.img/ufo_bar.txd/gen_scaffold_wood_under.dds\",\"gta3.img/beafron1_law2.txd/gen_scaffold_wood_under.dds\",\n \"gta3.img/vgnscaffold.txd/gen_scaffold_wood_under.dds\",\"gta3.img/beafron1_law2.txd/gen_scaffold_wood_under.dds\",\n \"gta3.img/vgsecnstrct03.txd/gen_scaffold_wood_under.dds\",\"gta3.img/beafron1_law2.txd/gen_scaffold_wood_under.dds\",\n \"gta3.img/pierb_law2.txd/pierbild01_law.dds\",\"gta3.img/beafron1_law2.txd/pierbild01_law.dds\",\n \"gta3.img/chicano10_lae.txd/melroran3_law.dds\",\"gta3.img/beafron1_law2.txd/melroran3_law.dds\",\n \"gta3.img/melrose02_lawn.txd/melroran3_law.dds\",\"gta3.img/beafron1_law2.txd/melroran3_law.dds\",\n \"gta3.img/melrose08_lawn.txd/melroran3_law.dds\",\"gta3.img/beafron1_law2.txd/melroran3_law.dds\",\n \"gta3.img/melrose19_lawn.txd/melroran3_law.dds\",\"gta3.img/beafron1_law2.txd/melroran3_law.dds\",\n \"gta3.img/motel_lae.txd/melroran3_law.dds\",\"gta3.img/beafron1_law2.txd/melroran3_law.dds\",\n \"gta3.img/sunset04_law2.txd/melroran3_law.dds\",\"gta3.img/beafron1_law2.txd/melroran3_law.dds\",\n \"gta3.img/bigshap_sfw.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta3.img/carrierint_sfs.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta3.img/cehillhse14.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta3.img/crackfactwalkb.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta3.img/cranes_dyn2_cj.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta3.img/cunte_block1.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta3.img/cunte_wires.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta3.img/cwestfac.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta3.img/desn2_stud.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta3.img/des_xoilfield.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta3.img/docg01alfa_lahills.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta3.img/factorycuntw.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta3.img/fishwarf.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta3.img/idlewood6_tr.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta3.img/imrancomp_las2.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta3.img/lahillshilhs1b.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta3.img/lahillshilhs1d.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta3.img/lahillshilhs1z.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta3.img/lahillshilhse.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta3.img/lasxrefdock.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta3.img/law2misc_lax.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta3.img/lawnapartxref.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta3.img/lawnstripm.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta3.img/olympic01.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta3.img/pyr_roof.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta3.img/sancliff_law2.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta3.img/stadbridge_sfs.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta3.img/sunset1alp_lan2.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta3.img/sunstrans_law2.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta3.img/telewirelawn.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta3.img/tikimotel.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta3.img/vegasdwntwn1.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta3.img/vegenmotel.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta3.img/vgnabatoir.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta3.img/vgncoast.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta3.img/vgncondos1.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta3.img/vgndwntwn22.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta3.img/vgnfirestat.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta3.img/vgnfrates.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta3.img/vgnhelipad1.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta3.img/vgnhseing1.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta3.img/vgnpwrmainbld.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta3.img/vgnpwroutbld2.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta3.img/vgnpwroutbld3.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta3.img/vgnpwrwhse.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta3.img/vgnshopnmall.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta3.img/vgntamotel.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta3.img/vgnvrock.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta3.img/vgnxrefhse1.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta3.img/vgsewrehse.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta3.img/vgspumphse.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta3.img/vgssstadrail.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta3.img/vgssstairs1.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta3.img/vgsswrehse03.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta3.img/vgsxrefpart1.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta3.img/vgwestboiga1.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta3.img/warehus_las2.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta3.img/wc_lift_sfse.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta3.img/wiresetc_las2.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta_int.img/civic02cj.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta_int.img/crack.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta_int.img/genintwarehsint3.txd/fire_esc_fence.dds\",\"gta3.img/beafron2_law2.txd/fire_esc_fence.dds\",\n \"gta3.img/pierc_law2.txd/sanpiz1.dds\",\"gta3.img/beafron2_law2.txd/sanpiz1.dds\",\n \"gta3.img/buildtestlawn.txd/smoothie.dds\",\"gta3.img/beafron2_law2.txd/smoothie.dds\",\n \"gta3.img/dtbuil1_lan2.txd/smoothie.dds\",\"gta3.img/beafron2_law2.txd/smoothie.dds\",\n \"gta3.img/melrose02_lawn.txd/smoothie.dds\",\"gta3.img/beafron2_law2.txd/smoothie.dds\",\n \"gta3.img/melrose05_lawn.txd/smoothie.dds\",\"gta3.img/beafron2_law2.txd/smoothie.dds\",\n \"gta3.img/melrose08_lawn.txd/smoothie.dds\",\"gta3.img/beafron2_law2.txd/smoothie.dds\",\n \"gta3.img/melrose15_lawn.txd/smoothie.dds\",\"gta3.img/beafron2_law2.txd/smoothie.dds\",\n \"gta3.img/melrose19_lawn.txd/smoothie.dds\",\"gta3.img/beafron2_law2.txd/smoothie.dds\",\n \"gta3.img/sunrise04_lawn.txd/smoothie.dds\",\"gta3.img/beafron2_law2.txd/smoothie.dds\",\n \"gta3.img/sunrise08_lawn.txd/smoothie.dds\",\"gta3.img/beafron2_law2.txd/smoothie.dds\",\n \"gta3.img/sunset01_law2.txd/smoothie.dds\",\"gta3.img/beafron2_law2.txd/smoothie.dds\",\n \"gta3.img/sunset03_law2.txd/smoothie.dds\",\"gta3.img/beafron2_law2.txd/smoothie.dds\",\n \"gta3.img/sunset04_law2.txd/smoothie.dds\",\"gta3.img/beafron2_law2.txd/smoothie.dds\",\n \"gta3.img/sunsetbittyu.txd/smoothie.dds\",\"gta3.img/beafron2_law2.txd/smoothie.dds\",\n \"gta3.img/vgntamotel.txd/smoothie.dds\",\"gta3.img/beafron2_law2.txd/smoothie.dds\",\n \"gta3.img/vgsswarehse02c.txd/smoothie.dds\",\"gta3.img/beafron2_law2.txd/smoothie.dds\",\n \"gta3.img/blokmodb.txd/concretebigb256128.dds\",\"gta3.img/beafron2_law2.txd/concretebigb256128.dds\",\n \"gta3.img/chateau_lawn.txd/concretebigb256128.dds\",\"gta3.img/beafron2_law2.txd/concretebigb256128.dds\",\n \"gta3.img/garage_sfw.txd/concretebigb256128.dds\",\"gta3.img/beafron2_law2.txd/concretebigb256128.dds\",\n \"gta3.img/hospital_lawn.txd/concretebigb256128.dds\",\"gta3.img/beafron2_law2.txd/concretebigb256128.dds\",\n \"gta3.img/lasxrefdock.txd/concretebigb256128.dds\",\"gta3.img/beafron2_law2.txd/concretebigb256128.dds\",\n \"gta3.img/law_beach2.txd/concretebigb256128.dds\",\"gta3.img/beafron2_law2.txd/concretebigb256128.dds\",\n \"gta3.img/law_cnrtplaz.txd/concretebigb256128.dds\",\"gta3.img/beafron2_law2.txd/concretebigb256128.dds\",\n \"gta3.img/lawest1.txd/concretebigb256128.dds\",\"gta3.img/beafron2_law2.txd/concretebigb256128.dds\",\n \"gta3.img/lawland2.txd/concretebigb256128.dds\",\"gta3.img/beafron2_law2.txd/concretebigb256128.dds\",\n \"gta3.img/lawwhitebuilds.txd/concretebigb256128.dds\",\"gta3.img/beafron2_law2.txd/concretebigb256128.dds\",\n \"gta3.img/mall_law.txd/concretebigb256128.dds\",\"gta3.img/beafron2_law2.txd/concretebigb256128.dds\",\n \"gta3.img/melrose03_lawn.txd/concretebigb256128.dds\",\"gta3.img/beafron2_law2.txd/concretebigb256128.dds\",\n \"gta3.img/melrose16_lawn.txd/concretebigb256128.dds\",\"gta3.img/beafron2_law2.txd/concretebigb256128.dds\",\n \"gta3.img/santamonicalaw2.txd/concretebigb256128.dds\",\"gta3.img/beafron2_law2.txd/concretebigb256128.dds\",\n \"gta3.img/sunrise01_lawn.txd/concretebigb256128.dds\",\"gta3.img/beafron2_law2.txd/concretebigb256128.dds\",\n \"gta3.img/sunrise02_lawn.txd/concretebigb256128.dds\",\"gta3.img/beafron2_law2.txd/concretebigb256128.dds\",\n \"gta3.img/sunrise05_lawn.txd/concretebigb256128.dds\",\"gta3.img/beafron2_law2.txd/concretebigb256128.dds\",\n \"gta3.img/sunrise08_lawn.txd/concretebigb256128.dds\",\"gta3.img/beafron2_law2.txd/concretebigb256128.dds\",\n \"gta3.img/sunrise10_lawn.txd/concretebigb256128.dds\",\"gta3.img/beafron2_law2.txd/concretebigb256128.dds\",\n \"gta3.img/venice_law.txd/concretebigb256128.dds\",\"gta3.img/beafron2_law2.txd/concretebigb256128.dds\",\n \"gta3.img/vict_sfw.txd/concretebigb256128.dds\",\"gta3.img/beafron2_law2.txd/concretebigb256128.dds\",\n \"gta_int.img/genintintfastc.txd/concretebigb256128.dds\",\"gta3.img/beafron2_law2.txd/concretebigb256128.dds\",\n \"gta3.img/vgsssignage02.txd/heat_03.dds\",\"gta3.img/beafron2_law2.txd/heat_03.dds\",\n \"gta3.img/vgsssignage03.txd/heat_03.dds\",\"gta3.img/beafron2_law2.txd/heat_03.dds\",\n \"gta3.img/councl_law2.txd/downtwin27.dds\",\"gta3.img/beafron2_law2.txd/downtwin27.dds\",\n \"gta3.img/sunrise11_lawn.txd/downtwin27.dds\",\"gta3.img/beafron2_law2.txd/downtwin27.dds\",\n \"gta3.img/cunte_wires.txd/telewireslong2.dds\",\"gta3.img/beafron2_law2.txd/telewireslong.dds\",\n \"gta3.img/desn2_alphabits.txd/telewireslong2.dds\",\"gta3.img/beafron2_law2.txd/telewireslong.dds\",\n \"gta3.img/des_stwnsigns1.txd/telewireslong2.dds\",\"gta3.img/beafron2_law2.txd/telewireslong.dds\",\n \"gta3.img/des_wires.txd/telewireslong2.dds\",\"gta3.img/beafron2_law2.txd/telewireslong.dds\",\n \"gta3.img/lae2coast_alpha.txd/telewireslong2.dds\",\"gta3.img/beafron2_law2.txd/telewireslong.dds\",\n \"gta3.img/laealpha.txd/telewireslong2.dds\",\"gta3.img/beafron2_law2.txd/telewireslong.dds\",\n \"gta3.img/pierb_law2.txd/telewireslong.dds\",\"gta3.img/beafron2_law2.txd/telewireslong.dds\",\n \"gta3.img/sunstrans_law2.txd/telewireslong2.dds\",\"gta3.img/beafron2_law2.txd/telewireslong.dds\",\n \"gta3.img/ce_bankalley1.txd/des_bunting.dds\",\"gta3.img/beafron2_law2.txd/des_bunting.dds\",\n \"gta3.img/desn2_alphabits.txd/des_bunting.dds\",\"gta3.img/beafron2_law2.txd/des_bunting.dds\",\n \"gta3.img/des_ntown.txd/des_bunting.dds\",\"gta3.img/beafron2_law2.txd/des_bunting.dds\",\n \"gta3.img/motelalpha.txd/des_bunting.dds\",\"gta3.img/beafron2_law2.txd/des_bunting.dds\",\n \"gta3.img/pierb_law2.txd/des_bunting.dds\",\"gta3.img/beafron2_law2.txd/des_bunting.dds\",\n \"gta3.img/pierc_law2.txd/des_bunting.dds\",\"gta3.img/beafron2_law2.txd/des_bunting.dds\",\n \"gta3.img/pier_law.txd/des_bunting.dds\",\"gta3.img/beafron2_law2.txd/des_bunting.dds\",\n \"gta3.img/sw_apartflat5.txd/des_bunting.dds\",\"gta3.img/beafron2_law2.txd/des_bunting.dds\",\n \"gta3.img/carrierint_sfs.txd/loadingdoorclean.dds\",\"gta3.img/beafron2_law2.txd/loadingdoorclean.dds\",\n \"gta3.img/carrier_sfse.txd/loadingdoorclean.dds\",\"gta3.img/beafron2_law2.txd/loadingdoorclean.dds\",\n \"gta3.img/chinatownsfe.txd/loadingdoorclean.dds\",\"gta3.img/beafron2_law2.txd/loadingdoorclean.dds\",\n \"gta3.img/copshop_sfe.txd/loadingdoorclean.dds\",\"gta3.img/beafron2_law2.txd/loadingdoorclean.dds\",\n \"gta3.img/depot_sfse.txd/loadingdoorclean.dds\",\"gta3.img/beafron2_law2.txd/loadingdoorclean.dds\",\n \"gta3.img/des_factory.txd/loadingdoorclean.dds\",\"gta3.img/beafron2_law2.txd/loadingdoorclean.dds\",\n \"gta3.img/garag3_lawn.txd/loadingdoorclean.dds\",\"gta3.img/beafron2_law2.txd/loadingdoorclean.dds\",\n \"gta3.img/hosbibalsfw.txd/loadingdoorclean.dds\",\"gta3.img/beafron2_law2.txd/loadingdoorclean.dds\",\n \"gta3.img/hospital_lawn.txd/loadingdoorclean.dds\",\"gta3.img/beafron2_law2.txd/loadingdoorclean.dds\",\n \"gta3.img/hotelbackpool_sfs.txd/loadingdoorclean.dds\",\"gta3.img/beafron2_law2.txd/loadingdoorclean.dds\",\n \"gta3.img/hotelback_sfs.txd/loadingdoorclean.dds\",\"gta3.img/beafron2_law2.txd/loadingdoorclean.dds\",\n \"gta3.img/idlewood6_lae.txd/loadingdoorclean.dds\",\"gta3.img/beafron2_law2.txd/loadingdoorclean.dds\",\n \"gta3.img/melrose11_lawn.txd/loadingdoorclean.dds\",\"gta3.img/beafron2_law2.txd/loadingdoorclean.dds\",\n \"gta3.img/melrose17_lawn.txd/loadingdoorclean.dds\",\"gta3.img/beafron2_law2.txd/loadingdoorclean.dds\",\n \"gta3.img/stuff2_sfn.txd/loadingdoorclean.dds\",\"gta3.img/beafron2_law2.txd/loadingdoorclean.dds\",\n \"gta3.img/sw_fact02.txd/loadingdoorclean.dds\",\"gta3.img/beafron2_law2.txd/loadingdoorclean.dds\",\n \"gta3.img/vegasnbuild1.txd/loadingdoorclean.dds\",\"gta3.img/beafron2_law2.txd/loadingdoorclean.dds\",\n \"gta3.img/vegaswrehse1.txd/loadingdoorclean.dds\",\"gta3.img/beafron2_law2.txd/loadingdoorclean.dds\",\n \"gta3.img/vgnfrates.txd/loadingdoorclean.dds\",\"gta3.img/beafron2_law2.txd/loadingdoorclean.dds\",\n \"gta3.img/vgsewrehse.txd/loadingdoorclean.dds\",\"gta3.img/beafron2_law2.txd/loadingdoorclean.dds\",\n \"gta3.img/vgsswarehse01.txd/loadingdoorclean.dds\",\"gta3.img/beafron2_law2.txd/loadingdoorclean.dds\",\n \"gta3.img/vgsswarehse02.txd/loadingdoorclean.dds\",\"gta3.img/beafron2_law2.txd/loadingdoorclean.dds\",\n \"gta_int.img/ovalsurround.txd/loadingdoorclean.dds\",\"gta3.img/beafron2_law2.txd/loadingdoorclean.dds\",\n \"gta_int.img/stadstunt.txd/loadingdoorclean.dds\",\"gta3.img/beafron2_law2.txd/loadingdoorclean.dds\",\n \"gta3.img/melrose11_lawn.txd/melrshop04_lawn.dds\",\"gta3.img/beafron2_law2.txd/melrshop04_lawn.dds\",\n \"gta3.img/sunrise05_lawn.txd/hollysign02_law.dds\",\"gta3.img/beafron2_law2.txd/hollysign02_law.dds\",\n \"gta3.img/civic03_lan.txd/downtshop7_lan.dds\",\"gta3.img/beafron2_law2.txd/downtshop7_lan.dds\",\n \"gta3.img/civic04_lan.txd/downtshop7_lan.dds\",\"gta3.img/beafron2_law2.txd/downtshop7_lan.dds\",\n \"gta3.img/lanblokb2.txd/downtshop7_lan.dds\",\"gta3.img/beafron2_law2.txd/downtshop7_lan.dds\",\n \"gta3.img/lanblokb.txd/downtshop7_lan.dds\",\"gta3.img/beafron2_law2.txd/downtshop7_lan.dds\",\n \"gta3.img/mainlcawn.txd/downtsign3_la.dds\",\"gta3.img/beafron2_law2.txd/downtsign3_la.dds\",\n \"gta3.img/sunrise09_lawn.txd/downtsign3_la.dds\",\"gta3.img/beafron2_law2.txd/downtsign3_la.dds\",\n \"gta3.img/sunrise08_lawn.txd/giftsign01_law.dds\",\"gta3.img/beafron2_law2.txd/giftsign01_law.dds\",\n \"gta3.img/vgsswarehse02c.txd/giftsign01_law.dds\",\"gta3.img/beafron2_law2.txd/giftsign01_law.dds\",\n \"gta3.img/buildblk55.txd/snpdwingrat1.dds\",\"gta3.img/beafron2_law2.txd/snpdwingrat1.dds\",\n \"gta3.img/fighot.txd/snpdwingrat1.dds\",\"gta3.img/beafron2_law2.txd/snpdwingrat1.dds\",\n \"gta3.img/gangblok1_lae2.txd/snpdwingrat1.dds\",\"gta3.img/beafron2_law2.txd/snpdwingrat1.dds\",\n \"gta3.img/ganton01_lae2.txd/snpdwingrat1.dds\",\"gta3.img/beafron2_law2.txd/snpdwingrat1.dds\",\n \"gta3.img/lanbloka.txd/snpdwingrat1.dds\",\"gta3.img/beafron2_law2.txd/snpdwingrat1.dds\",\n \"gta3.img/lanblokb2.txd/snpdwingrat1.dds\",\"gta3.img/beafron2_law2.txd/snpdwingrat1.dds\",\n \"gta3.img/lanbloki.txd/snpdwingrat1.dds\",\"gta3.img/beafron2_law2.txd/snpdwingrat1.dds\",\n \"gta3.img/melrose02_lawn.txd/snpdwingrat1.dds\",\"gta3.img/beafron2_law2.txd/snpdwingrat1.dds\",\n \"gta3.img/melrose15_lawn.txd/snpdwingrat1.dds\",\"gta3.img/beafron2_law2.txd/snpdwingrat1.dds\",\n \"gta3.img/melrose19_lawn.txd/snpdwingrat1.dds\",\"gta3.img/beafron2_law2.txd/snpdwingrat1.dds\",\n \"gta3.img/sunrise08_lawn.txd/snpdwingrat1.dds\",\"gta3.img/beafron2_law2.txd/snpdwingrat1.dds\",\n \"gta3.img/sunset04_law2.txd/snpdwingrat1.dds\",\"gta3.img/beafron2_law2.txd/snpdwingrat1.dds\",\n \"gta3.img/sunst18_lawn.txd/snpdwingrat1.dds\",\"gta3.img/beafron2_law2.txd/snpdwingrat1.dds\",\n \"gta3.img/industry3_las2.txd/snpedshptst1c.dds\",\"gta3.img/beafron2_law2.txd/snpedshptst1c.dds\",\n \"gta3.img/lawland2.txd/boardwalk2_la.dds\",\"gta3.img/beafron2_law2.txd/boardwalk2_la.dds\",\n \"gta3.img/santamonicalaw2.txd/boardwalk2_la.dds\",\"gta3.img/beafron2_law2.txd/boardwalk2_la.dds\",\n \"gta3.img/glenpark1x_lae.txd/shutter03la.dds\",\"gta3.img/beafron2_law2.txd/shutter03la.dds\",\n \"gta3.img/shutters_lawn.txd/shutter03la.dds\",\"gta3.img/beafron2_law2.txd/shutter03la.dds\",\n \"gta3.img/vgsshospshop.txd/shutter03la.dds\",\"gta3.img/beafron2_law2.txd/shutter03la.dds\",\n \"gta3.img/tempstuff_lae.txd/examwall2_lae.dds\",\"gta3.img/beafron2_law2.txd/examwall2_lae.dds\",\n \"gta3.img/mission2apts_sfse.txd/ws_ed_shop11.dds\",\"gta3.img/beafron2_law2.txd/ws_ed_shop11.dds\",\n \"gta3.img/scum_sfse.txd/ws_ed_shop11.dds\",\"gta3.img/beafron2_law2.txd/ws_ed_shop11.dds\",\n \"gta3.img/haight1_sfs.txd/ws_ed_shop9.dds\",\"gta3.img/beafron2_law2.txd/ws_ed_shop9.dds\",\n \"gta3.img/midtownshops_sfs.txd/ws_ed_shop9.dds\",\"gta3.img/beafron2_law2.txd/ws_ed_shop9.dds\",\n \"gta3.img/mission2apts_sfse.txd/ws_ed_shop9.dds\",\"gta3.img/beafron2_law2.txd/ws_ed_shop9.dds\",\n \"gta3.img/scum_sfse.txd/ws_ed_shop9.dds\",\"gta3.img/beafron2_law2.txd/ws_ed_shop9.dds\",\n \"gta3.img/gazsfn1.txd/concretenewb256128.dds\",\"gta3.img/beafron2_law2.txd/concretenewb256128.dds\",\n \"gta3.img/law_beach2.txd/concretenewb256128.dds\",\"gta3.img/beafron2_law2.txd/concretenewb256128.dds\",\n \"gta3.img/roadsfe.txd/concretenewb256128.dds\",\"gta3.img/beafron2_law2.txd/concretenewb256128.dds\",\n \"gta3.img/sfvictorian.txd/concretenewb256128.dds\",\"gta3.img/beafron2_law2.txd/concretenewb256128.dds\",\n \"gta3.img/shops01_law.txd/concretenewb256128.dds\",\"gta3.img/beafron2_law2.txd/concretenewb256128.dds\",\n \"gta3.img/studio01_lawn.txd/concretenewb256128.dds\",\"gta3.img/beafron2_law2.txd/concretenewb256128.dds\",\n \"gta3.img/ganton01_lae2.txd/decoacwallbtmb21_256.dds\",\"gta3.img/beafron2_law2.txd/decoacwallbtmb21_256.dds\",\n \"gta3.img/idlewood46_lae.txd/decoacwallbtmb21_256.dds\",\"gta3.img/beafron2_law2.txd/decoacwallbtmb21_256.dds\",\n \"gta3.img/lanlacmab_lan2.txd/decoacwallbtmb21_256.dds\",\"gta3.img/beafron2_law2.txd/decoacwallbtmb21_256.dds\",\n \"gta3.img/vegashse4.txd/decoacwallbtmb21_256.dds\",\"gta3.img/beafron2_law2.txd/decoacwallbtmb21_256.dds\",\n \"gta3.img/hospital_lae.txd/eris_3.dds\",\"gta3.img/beafron2_law2.txd/eris_3.dds\",\n \"gta3.img/lawnbillbrd.txd/eris_3.dds\",\"gta3.img/beafron2_law2.txd/eris_3.dds\",\n \"gta3.img/vgsssignage04.txd/eris_3.dds\",\"gta3.img/beafron2_law2.txd/eris_3.dds\",\n \"gta3.img/billbrd01_lan2.txd/homies_2.dds\",\"gta3.img/beafron2_law2.txd/homies_2.dds\",\n \"gta3.img/billbrd01_lan.txd/homies_2.dds\",\"gta3.img/beafron2_law2.txd/homies_2.dds\",\n \"gta3.img/glenpark7_lae.txd/homies_2.dds\",\"gta3.img/beafron2_law2.txd/homies_2.dds\",\n \"gta3.img/hospital_lae.txd/homies_2.dds\",\"gta3.img/beafron2_law2.txd/homies_2.dds\",\n \"gta3.img/stadium_sfse.txd/homies_2.dds\",\"gta3.img/beafron2_law2.txd/homies_2.dds\",\n \"gta3.img/sunrise05_lawn.txd/homies_2.dds\",\"gta3.img/beafron2_law2.txd/homies_2.dds\",\n \"gta_int.img/dirtouter.txd/ah_homiessharp.dds\",\"gta3.img/beafron2_law2.txd/homies_2.dds\",\n \"gta3.img/eastbeach8_lae2.txd/eastwin01_lae2.dds\",\"gta3.img/beafron2_law2.txd/eastwin01_lae2.dds\",\n \"gta3.img/idlewood6_lae.txd/eastwin01_lae2.dds\",\"gta3.img/beafron2_law2.txd/eastwin01_lae2.dds\",\n \"gta3.img/jeffers5a_lae.txd/comptwall33.dds\",\"gta3.img/beafron2_law2.txd/comptwall33.dds\",\n \"gta3.img/rodeo02_law2.txd/comptwall33.dds\",\"gta3.img/beafron2_law2.txd/comptwall33.dds\",\n \"gta3.img/rodeo05_law2.txd/comptwall33.dds\",\"gta3.img/beafron2_law2.txd/comptwall33.dds\",\n \"gta3.img/sunset01_law2.txd/comptwall33.dds\",\"gta3.img/beafron2_law2.txd/comptwall33.dds\",\n \"gta3.img/sunset02_law2.txd/comptwall33.dds\",\"gta3.img/beafron2_law2.txd/comptwall33.dds\",\n \"gta3.img/sunset03_law2.txd/comptwall33.dds\",\"gta3.img/beafron2_law2.txd/comptwall33.dds\",\n \"gta3.img/idlewood6_lae.txd/scumshop01_lae.dds\",\"gta3.img/beafron2_law2.txd/scumshop01_lae.dds\",\n \"gta3.img/coast_las2.txd/sjmcargr.dds\",\"gta3.img/beafron2_law2.txd/sjmcargr.dds\",\n \"gta3.img/docks_las2.txd/sjmcargr.dds\",\"gta3.img/beafron2_law2.txd/sjmcargr.dds\",\n \"gta3.img/glenpark1x_lae.txd/sjmcargr.dds\",\"gta3.img/beafron2_law2.txd/sjmcargr.dds\",\n \"gta3.img/griffobs_las.txd/sjmcargr.dds\",\"gta3.img/beafron2_law2.txd/sjmcargr.dds\",\n \"gta3.img/ground2_las2.txd/sjmcargr.dds\",\"gta3.img/beafron2_law2.txd/sjmcargr.dds\",\n \"gta3.img/imrancomp_las2.txd/sjmcargr.dds\",\"gta3.img/beafron2_law2.txd/sjmcargr.dds\",\n \"gta3.img/lanlacma_lan2.txd/sjmcargr.dds\",\"gta3.img/beafron2_law2.txd/sjmcargr.dds\",\n \"gta3.img/lasground_las2.txd/sjmcargr.dds\",\"gta3.img/beafron2_law2.txd/sjmcargr.dds\",\n \"gta3.img/lashops1b_las2.txd/sjmcargr.dds\",\"gta3.img/beafron2_law2.txd/sjmcargr.dds\",\n \"gta3.img/lashops1_las2.txd/sjmcargr.dds\",\"gta3.img/beafron2_law2.txd/sjmcargr.dds\",\n \"gta3.img/lawland2.txd/sjmcargr.dds\",\"gta3.img/beafron2_law2.txd/sjmcargr.dds\",\n \"gta3.img/sanpedh22_1x.txd/sjmcargr.dds\",\"gta3.img/beafron2_law2.txd/sjmcargr.dds\",\n \"gta3.img/sanpedhse_1x.txd/sjmcargr.dds\",\"gta3.img/beafron2_law2.txd/sjmcargr.dds\",\n \"gta3.img/santamonhus1.txd/sjmcargr.dds\",\"gta3.img/beafron2_law2.txd/sjmcargr.dds\",\n \"gta3.img/santamonicalaw2.txd/sjmcargr.dds\",\"gta3.img/beafron2_law2.txd/sjmcargr.dds\",\n \"gta3.img/snpedhusxref.txd/sjmcargr.dds\",\"gta3.img/beafron2_law2.txd/sjmcargr.dds\",\n \"gta_int.img/genintwarehsint3.txd/sjmcargr.dds\",\"gta3.img/beafron2_law2.txd/sjmcargr.dds\",\n \"gta_int.img/lee_bdupsmain.txd/sjmcargr.dds\",\"gta3.img/beafron2_law2.txd/sjmcargr.dds\",\n \"gta_int.img/smashtv.txd/sjmcargr.dds\",\"gta3.img/beafron2_law2.txd/sjmcargr.dds\",\n \"gta3.img/cargobob.txd/cargobobrotorblack128.dds\",\"gta3.img/beagle.txd/cargobobrotorblack128.dds\",\n \"gta3.img/hunter.txd/cargobobrotorblack128.dds\",\"gta3.img/beagle.txd/cargobobrotorblack128.dds\",\n \"gta3.img/leviathn.txd/cargobobrotorblack128.dds\",\"gta3.img/beagle.txd/cargobobrotorblack128.dds\",\n \"gta3.img/polmav.txd/cargobobrotorblack128.dds\",\"gta3.img/beagle.txd/cargobobrotorblack128.dds\",\n \"gta3.img/raindanc.txd/cargobobrotorblack128.dds\",\"gta3.img/beagle.txd/cargobobrotorblack128.dds\",\n \"gta3.img/seaspar.txd/cargobobrotorblack128.dds\",\"gta3.img/beagle.txd/cargobobrotorblack128.dds\",\n \"gta3.img/vcnmav.txd/cargobobrotorblack128.dds\",\"gta3.img/beagle.txd/cargobobrotorblack128.dds\",\n \"gta3.img/griffobs_las.txd/pierdoor02_law.dds\",\"gta3.img/benches.txd/pierdoor02_law.dds\",\n \"gta3.img/ground4_las.txd/pierdoor02_law.dds\",\"gta3.img/benches.txd/pierdoor02_law.dds\",\n \"gta3.img/cuntwbt.txd/concretemanky.dds\",\"gta3.img/benchm.txd/concretemanky.dds\",\n \"gta3.img/glenpark6_lae.txd/concretemanky.dds\",\"gta3.img/benchm.txd/concretemanky.dds\",\n \"gta3.img/idlewood46_lae.txd/concretemanky.dds\",\"gta3.img/benchm.txd/concretemanky.dds\",\n \"gta3.img/laeroads.txd/concretemanky.dds\",\"gta3.img/benchm.txd/concretemanky.dds\",\n \"gta3.img/tempstuff_lae.txd/concretemanky.dds\",\"gta3.img/benchm.txd/concretemanky.dds\",\n \"gta_int.img/kickstart.txd/concretemanky.dds\",\"gta3.img/benchm.txd/concretemanky.dds\",\n \"gta3.img/fences.txd/blackmetal.dds\",\"gta3.img/bendytunnel_sfse.txd/blackmetal.dds\",\n \"gta3.img/hubprops2_sfse.txd/blackmetal.dds\",\"gta3.img/bendytunnel_sfse.txd/blackmetal.dds\",\n \"gta_int.img/genintintcarint3.txd/blackmetal.dds\",\"gta3.img/bendytunnel_sfse.txd/blackmetal.dds\",\n \"gta3.img/carshow_sfse.txd/ws_altz_wall10b.dds\",\"gta3.img/bendytunnel_sfse.txd/ws_altz_wall10b.dds\",\n \"gta3.img/corvinsign_sfse.txd/ws_altz_wall10b.dds\",\"gta3.img/bendytunnel_sfse.txd/ws_altz_wall10b.dds\",\n \"gta3.img/graveyard_sfs.txd/ws_altz_wall10b.dds\",\"gta3.img/bendytunnel_sfse.txd/ws_altz_wall10b.dds\",\n \"gta3.img/hashblock2_sfs.txd/ws_altz_wall10b.dds\",\"gta3.img/bendytunnel_sfse.txd/ws_altz_wall10b.dds\",\n \"gta3.img/scum2_sfs.txd/ws_altz_wall10b.dds\",\"gta3.img/bendytunnel_sfse.txd/ws_altz_wall10b.dds\",\n \"gta3.img/civic07_lan.txd/bow_sub_wallshine.dds\",\"gta3.img/bendytunnel_sfse.txd/bow_sub_wallshine.dds\",\n \"gta3.img/parktunnel_sfs.txd/bow_sub_wallshine.dds\",\"gta3.img/bendytunnel_sfse.txd/bow_sub_wallshine.dds\",\n \"gta3.img/des_s.txd/bow_sub_walltiles.dds\",\"gta3.img/bendytunnel_sfse.txd/bow_sub_walltiles.dds\",\n \"gta3.img/hashupass_sfs.txd/bow_sub_walltiles.dds\",\"gta3.img/bendytunnel_sfse.txd/bow_sub_walltiles.dds\",\n \"gta3.img/hotelbackpool_sfs.txd/bow_sub_walltiles.dds\",\"gta3.img/bendytunnel_sfse.txd/bow_sub_walltiles.dds\",\n \"gta3.img/parktunnel_sfs.txd/bow_sub_walltiles.dds\",\"gta3.img/bendytunnel_sfse.txd/bow_sub_walltiles.dds\",\n \"gta3.img/railway_las.txd/bow_sub_walltiles.dds\",\"gta3.img/bendytunnel_sfse.txd/bow_sub_walltiles.dds\",\n \"gta3.img/silicon2_sfse.txd/bow_sub_walltiles.dds\",\"gta3.img/bendytunnel_sfse.txd/bow_sub_walltiles.dds\",\n \"gta3.img/vegasemulticar.txd/bow_sub_walltiles.dds\",\"gta3.img/bendytunnel_sfse.txd/bow_sub_walltiles.dds\",\n \"gta3.img/vgssairportcpark.txd/bow_sub_walltiles.dds\",\"gta3.img/bendytunnel_sfse.txd/bow_sub_walltiles.dds\",\n \"gta3.img/vgs_stadium.txd/bow_sub_walltiles.dds\",\"gta3.img/bendytunnel_sfse.txd/bow_sub_walltiles.dds\",\n \"gta_int.img/genintintfastb2.txd/bow_sub_walltiles.dds\",\"gta3.img/bendytunnel_sfse.txd/bow_sub_walltiles.dds\",\n \"gta_int.img/genintintfastc.txd/bow_sub_walltiles.dds\",\"gta3.img/bendytunnel_sfse.txd/bow_sub_walltiles.dds\",\n \"gta3.img/mule.txd/mule92interior128.dds\",\"gta3.img/benson.txd/mule92interior128.dds\",\n \"gta3.img/cunte_block1.txd/newgrnd1brn_128.dds\",\"gta3.img/bevcunto2_lahills.txd/newgrnd1brn_128.dds\",\n \"gta3.img/dockcargo1_las.txd/newgrnd1brn_128.dds\",\"gta3.img/bevcunto2_lahills.txd/newgrnd1brn_128.dds\",\n \"gta3.img/factorycunte.txd/newgrnd1brn_128.dds\",\"gta3.img/bevcunto2_lahills.txd/newgrnd1brn_128.dds\",\n \"gta3.img/landlae2e.txd/newgrnd1brn_128.dds\",\"gta3.img/bevcunto2_lahills.txd/newgrnd1brn_128.dds\",\n \"gta3.img/sprunkworks.txd/newgrnd1brn_128.dds\",\"gta3.img/bevcunto2_lahills.txd/newgrnd1brn_128.dds\",\n \"gta3.img/sw_apartments.txd/newgrnd1brn_128.dds\",\"gta3.img/bevcunto2_lahills.txd/newgrnd1brn_128.dds\",\n \"gta3.img/xenon_sfse.txd/newgrnd1brn_128.dds\",\"gta3.img/bevcunto2_lahills.txd/newgrnd1brn_128.dds\",\n \"gta_int.img/inneroval.txd/newgrnd1brn_128.dds\",\"gta3.img/bevcunto2_lahills.txd/newgrnd1brn_128.dds\",\n \"gta_int.img/ovalsurround.txd/newgrnd1brn_128.dds\",\"gta3.img/bevcunto2_lahills.txd/newgrnd1brn_128.dds\",\n \"gta_int.img/stadstunt.txd/newgrnd1brn_128.dds\",\"gta3.img/bevcunto2_lahills.txd/newgrnd1brn_128.dds\",\n \"gta_int.img/stad_tag.txd/newgrnd1brn_128.dds\",\"gta3.img/bevcunto2_lahills.txd/newgrnd1brn_128.dds\",\n \"gta3.img/santamonhus1.txd/ws_floortiles2.dds\",\"gta3.img/bevcunto2_lahills.txd/ws_floortiles2.dds\",\n \"gta3.img/silicon2_sfse.txd/ws_floortiles2.dds\",\"gta3.img/bevcunto2_lahills.txd/ws_floortiles2.dds\",\n \"gta3.img/skyscrap_sfse.txd/ws_floortiles2.dds\",\"gta3.img/bevcunto2_lahills.txd/ws_floortiles2.dds\",\n \"gta3.img/hillcliff_lahills.txd/aamanbev96x.dds\",\"gta3.img/bevcunto2_lahills.txd/aamanbev96x.dds\",\n \"gta3.img/lahillsgrounds.txd/aamanbev96x.dds\",\"gta3.img/bevcunto2_lahills.txd/aamanbev96x.dds\",\n \"gta3.img/richman02_lahills.txd/aamanbev96x.dds\",\"gta3.img/bevcunto2_lahills.txd/aamanbev96x.dds\",\n \"gta3.img/richman04_lahills.txd/aamanbev96x.dds\",\"gta3.img/bevcunto2_lahills.txd/aamanbev96x.dds\",\n \"gta3.img/chateau_lawn.txd/crazypave.dds\",\"gta3.img/bevcunto2_lahills.txd/crazypave.dds\",\n \"gta3.img/firehouse_sfse.txd/crazypave.dds\",\"gta3.img/bevcunto2_lahills.txd/crazypave.dds\",\n \"gta3.img/lahillsgrounds.txd/crazypave.dds\",\"gta3.img/bevcunto2_lahills.txd/crazypave.dds\",\n \"gta3.img/lawwhitebuilds.txd/crazypave.dds\",\"gta3.img/bevcunto2_lahills.txd/crazypave.dds\",\n \"gta3.img/melrose07_lawn.txd/crazypave.dds\",\"gta3.img/bevcunto2_lahills.txd/crazypave.dds\",\n \"gta3.img/mullho03a_lahills.txd/crazypave.dds\",\"gta3.img/bevcunto2_lahills.txd/crazypave.dds\",\n \"gta3.img/richman02_lahills.txd/crazypave.dds\",\"gta3.img/bevcunto2_lahills.txd/crazypave.dds\",\n \"gta3.img/union_las.txd/crazypave.dds\",\"gta3.img/bevcunto2_lahills.txd/crazypave.dds\",\n \"gta3.img/venicegb02_law.txd/crazypave.dds\",\"gta3.img/bevcunto2_lahills.txd/crazypave.dds\",\n \"gta3.img/venice_law.txd/crazypave.dds\",\"gta3.img/bevcunto2_lahills.txd/crazypave.dds\",\n \"gta3.img/vinewood01_lahills.txd/crazypave.dds\",\"gta3.img/bevcunto2_lahills.txd/crazypave.dds\",\n \"gta3.img/boxybld_sfw.txd/stonewall3_la.dds\",\"gta3.img/bevcunto2_lahills.txd/stonewall3_la.dds\",\n \"gta3.img/ce_ground10.txd/stonewall3_la.dds\",\"gta3.img/bevcunto2_lahills.txd/stonewall3_la.dds\",\n \"gta3.img/ce_ground11.txd/stonewall3_la.dds\",\"gta3.img/bevcunto2_lahills.txd/stonewall3_la.dds\",\n \"gta3.img/coast_apts.txd/stonewall3_la.dds\",\"gta3.img/bevcunto2_lahills.txd/stonewall3_la.dds\",\n \"gta3.img/cuntwland.txd/stonewall3_la.dds\",\"gta3.img/bevcunto2_lahills.txd/stonewall3_la.dds\",\n \"gta3.img/miragecasino2.txd/stonewall3_la.dds\",\"gta3.img/bevcunto2_lahills.txd/stonewall3_la.dds\",\n \"gta3.img/sw_oldshack.txd/stonewall3_la.dds\",\"gta3.img/bevcunto2_lahills.txd/stonewall3_la.dds\",\n \"gta3.img/venicegb02_law.txd/stonewall3_la.dds\",\"gta3.img/bevcunto2_lahills.txd/stonewall3_la.dds\",\n \"gta3.img/vgnboiga1.txd/stonewall3_la.dds\",\"gta3.img/bevcunto2_lahills.txd/stonewall3_la.dds\",\n \"gta3.img/vgncorp1.txd/stonewall3_la.dds\",\"gta3.img/bevcunto2_lahills.txd/stonewall3_la.dds\",\n \"gta3.img/vgnewhsewal.txd/stonewall3_la.dds\",\"gta3.img/bevcunto2_lahills.txd/stonewall3_la.dds\",\n \"gta3.img/vgsn_rbstiff.txd/stonewall3_la.dds\",\"gta3.img/bevcunto2_lahills.txd/stonewall3_la.dds\",\n \"gta3.img/vgwestground.txd/stonewall3_la.dds\",\"gta3.img/bevcunto2_lahills.txd/stonewall3_la.dds\",\n \"gta3.img/lahillshilhs1e.txd/bow_abattoir_floor_clean.dds\",\"gta3.img/bevcunto2_lahills.txd/bow_abattoir_floor_clean.dds\",\n \"gta3.img/lahillstxd1a.txd/bow_abattoir_floor_clean.dds\",\"gta3.img/bevcunto2_lahills.txd/bow_abattoir_floor_clean.dds\",\n \"gta3.img/lawngrnd.txd/bow_abattoir_floor_clean.dds\",\"gta3.img/bevcunto2_lahills.txd/bow_abattoir_floor_clean.dds\",\n \"gta3.img/lawngrn.txd/bow_abattoir_floor_clean.dds\",\"gta3.img/bevcunto2_lahills.txd/bow_abattoir_floor_clean.dds\",\n \"gta3.img/lawnshite2n.txd/bow_abattoir_floor_clean.dds\",\"gta3.img/bevcunto2_lahills.txd/bow_abattoir_floor_clean.dds\",\n \"gta3.img/shopliquor_las.txd/bow_abattoir_floor_clean.dds\",\"gta3.img/bevcunto2_lahills.txd/bow_abattoir_floor_clean.dds\",\n \"gta3.img/tcenewhillhus02.txd/bow_abattoir_floor_clean.dds\",\"gta3.img/bevcunto2_lahills.txd/bow_abattoir_floor_clean.dds\",\n \"gta3.img/desn2_stud.txd/ws_patio1.dds\",\"gta3.img/bevcunto2_lahills.txd/ws_patio1.dds\",\n \"gta3.img/lahillshilhs1x.txd/ws_patio1.dds\",\"gta3.img/bevcunto2_lahills.txd/ws_patio1.dds\",\n \"gta3.img/lawnstripm.txd/ws_patio1.dds\",\"gta3.img/bevcunto2_lahills.txd/ws_patio1.dds\",\n \"gta3.img/bevmans01_la.txd/adeta.dds\",\"gta3.img/bevcunto2_lahills.txd/adeta.dds\",\n \"gta3.img/coast_apts.txd/adeta.dds\",\"gta3.img/bevcunto2_lahills.txd/adeta.dds\",\n \"gta3.img/coast_las2.txd/adeta.dds\",\"gta3.img/bevcunto2_lahills.txd/adeta.dds\",\n \"gta3.img/griffobs_las.txd/adeta.dds\",\"gta3.img/bevcunto2_lahills.txd/adeta.dds\",\n \"gta3.img/landcoast_lae2.txd/adeta.dds\",\"gta3.img/bevcunto2_lahills.txd/adeta.dds\",\n \"gta3.img/lasground_las2.txd/adeta.dds\",\"gta3.img/bevcunto2_lahills.txd/adeta.dds\",\n \"gta3.img/snpedhusxref.txd/adeta.dds\",\"gta3.img/bevcunto2_lahills.txd/adeta.dds\",\n \"gta3.img/bigwhitesfe.txd/shopdoor01_law.dds\",\"gta3.img/bev_law2.txd/shopdoor01_law.dds\",\n \"gta3.img/coast_apts.txd/shopdoor01_law.dds\",\"gta3.img/bev_law2.txd/shopdoor01_law.dds\",\n \"gta3.img/des_damquay.txd/shopdoor01_law.dds\",\"gta3.img/bev_law2.txd/shopdoor01_law.dds\",\n \"gta3.img/melrose07_lawn.txd/shopdoor01_law.dds\",\"gta3.img/bev_law2.txd/shopdoor01_law.dds\",\n \"gta3.img/melrose17_lawn.txd/shopdoor01_law.dds\",\"gta3.img/bev_law2.txd/shopdoor01_law.dds\",\n \"gta3.img/sunrise01_lawn.txd/shopdoor01_law.dds\",\"gta3.img/bev_law2.txd/shopdoor01_law.dds\",\n \"gta3.img/triadcasino.txd/shopdoor01_law.dds\",\"gta3.img/bev_law2.txd/shopdoor01_law.dds\",\n \"gta_int.img/triad_main.txd/shopdoor01_law.dds\",\"gta3.img/bev_law2.txd/shopdoor01_law.dds\",\n \"gta3.img/lasxrefdock.txd/glass_fence_64hv.dds\",\"gta3.img/bev_law2.txd/glass_fence_64hv.dds\",\n \"gta3.img/santamonhus.txd/glass_fence_64hv.dds\",\"gta3.img/bev_law2.txd/glass_fence_64hv.dds\",\n \"gta3.img/vgnglfcrse1.txd/glass_fence_64hv.dds\",\"gta3.img/bev_law2.txd/glass_fence_64hv.dds\",\n \"gta3.img/santamonhus.txd/pierwall03_law.dds\",\"gta3.img/bev_law2.txd/pierwall03_law.dds\",\n \"gta3.img/comedhos1_la.txd/comptwindo2.dds\",\"gta3.img/bev_law2.txd/comptwindo2.dds\",\n \"gta3.img/contachou1_lae2.txd/comptwindo2.dds\",\"gta3.img/bev_law2.txd/comptwindo2.dds\",\n \"gta3.img/jeffers4_lae.txd/comptwindo2.dds\",\"gta3.img/bev_law2.txd/comptwindo2.dds\",\n \"gta3.img/laesmokecnthus.txd/comptwindo2.dds\",\"gta3.img/bev_law2.txd/comptwindo2.dds\",\n \"gta3.img/santamonhus.txd/comptwindo2.dds\",\"gta3.img/bev_law2.txd/comptwindo2.dds\",\n \"gta_int.img/starps_ext.txd/comptwindo2.dds\",\"gta3.img/bev_law2.txd/comptwindo2.dds\",\n \"gta_int.img/straps_int.txd/comptwindo2.dds\",\"gta3.img/bev_law2.txd/comptwindo2.dds\",\n \"gta3.img/santamonhus.txd/pierhouse3_law.dds\",\"gta3.img/bev_law2.txd/pierhouse3_law.dds\",\n \"gta3.img/santamonhus.txd/pierfence02b_law.dds\",\"gta3.img/bev_law2.txd/pierfence02b_law.dds\",\n \"gta3.img/venicegb02_law.txd/pierfence02b_law.dds\",\"gta3.img/bev_law2.txd/pierfence02b_law.dds\",\n \"gta3.img/hillhousex2_us.txd/concretebigb256.dds\",\"gta3.img/bev_law2.txd/concretebigb256.dds\",\n \"gta3.img/law_doontoon.txd/concretebigb256.dds\",\"gta3.img/bev_law2.txd/concretebigb256.dds\",\n \"gta3.img/mullholl_lahills.txd/concretebigb256.dds\",\"gta3.img/bev_law2.txd/concretebigb256.dds\",\n \"gta3.img/santamonhus1.txd/concretebigb256.dds\",\"gta3.img/bev_law2.txd/concretebigb256.dds\",\n \"gta3.img/santamonhus.txd/concretebigb256.dds\",\"gta3.img/bev_law2.txd/concretebigb256.dds\",\n \"gta3.img/shops2_law.txd/concretebigb256.dds\",\"gta3.img/bev_law2.txd/concretebigb256.dds\",\n \"gta3.img/sunst18_lawn.txd/concretebigb256.dds\",\"gta3.img/bev_law2.txd/concretebigb256.dds\",\n \"gta3.img/tcecen4law.txd/concretebigb256.dds\",\"gta3.img/bev_law2.txd/concretebigb256.dds\",\n \"gta3.img/tcenewhillhus02.txd/concretebigb256.dds\",\"gta3.img/bev_law2.txd/concretebigb256.dds\",\n \"gta3.img/venicegb02_law.txd/concretebigb256.dds\",\"gta3.img/bev_law2.txd/concretebigb256.dds\",\n \"gta3.img/vgnlowbild.txd/pierwin08b_law.dds\",\"gta3.img/bev_law2.txd/pierwin08b_law.dds\",\n \"gta3.img/santamonhus.txd/pierwin08_law.dds\",\"gta3.img/bev_law2.txd/pierwin08_law.dds\",\n \"gta3.img/santamonhus1.txd/shinglegrey_la.dds\",\"gta3.img/bev_law2.txd/shinglegrey_la.dds\",\n \"gta3.img/santamonhus1.txd/pierfence02_law.dds\",\"gta3.img/bev_law2.txd/pierfence02_law.dds\",\n \"gta3.img/santamonhus.txd/pierfence02_law.dds\",\"gta3.img/bev_law2.txd/pierfence02_law.dds\",\n \"gta3.img/venicegb02_law.txd/pierfence02_law.dds\",\"gta3.img/bev_law2.txd/pierfence02_law.dds\",\n \"gta3.img/pierb_law2.txd/pierbild04_law.dds\",\"gta3.img/bev_law2.txd/pierbild04_law.dds\",\n \"gta3.img/santamonhus1.txd/pierbild04_law.dds\",\"gta3.img/bev_law2.txd/pierbild04_law.dds\",\n \"gta3.img/santamonhus.txd/pierbild04_law.dds\",\"gta3.img/bev_law2.txd/pierbild04_law.dds\",\n \"gta3.img/counte_b2.txd/beachwalkway.dds\",\"gta3.img/bev_law2.txd/beachwalkway.dds\",\n \"gta3.img/counte_bridge.txd/beachwalkway.dds\",\"gta3.img/bev_law2.txd/beachwalkway.dds\",\n \"gta3.img/ct_stabx.txd/beachwalkway.dds\",\"gta3.img/bev_law2.txd/beachwalkway.dds\",\n \"gta3.img/des_ranch.txd/beachwalkway.dds\",\"gta3.img/bev_law2.txd/beachwalkway.dds\",\n \"gta3.img/des_steakhouse.txd/beachwalkway.dds\",\"gta3.img/bev_law2.txd/beachwalkway.dds\",\n \"gta3.img/foodkarts.txd/beachwalkway.dds\",\"gta3.img/bev_law2.txd/beachwalkway.dds\",\n \"gta3.img/hillhousex_la1_2.txd/beachwalkway.dds\",\"gta3.img/bev_law2.txd/beachwalkway.dds\",\n \"gta3.img/idlewood6_detail.txd/beachwalkway.dds\",\"gta3.img/bev_law2.txd/beachwalkway.dds\",\n \"gta3.img/imrancomp_las2.txd/beachwalkway.dds\",\"gta3.img/bev_law2.txd/beachwalkway.dds\",\n \"gta3.img/imstuff_las2.txd/beachwalkway.dds\",\"gta3.img/bev_law2.txd/beachwalkway.dds\",\n \"gta3.img/jettycw.txd/beachwalkway.dds\",\"gta3.img/bev_law2.txd/beachwalkway.dds\",\n \"gta3.img/sw_oldshack.txd/beachwalkway.dds\",\"gta3.img/bev_law2.txd/beachwalkway.dds\",\n \"gta3.img/compapart_la.txd/pierwin05_law.dds\",\"gta3.img/bev_law2.txd/pierwin05_law.dds\",\n \"gta3.img/ce_fact01.txd/comptdoor2.dds\",\"gta3.img/bev_law2.txd/comptdoor2.dds\",\n \"gta3.img/comedhos1_la.txd/comptdoor2.dds\",\"gta3.img/bev_law2.txd/comptdoor2.dds\",\n \"gta3.img/comedprj1_la.txd/comptdoor2.dds\",\"gta3.img/bev_law2.txd/comptdoor2.dds\",\n \"gta3.img/compapartb_la.txd/comptdoor2.dds\",\"gta3.img/bev_law2.txd/comptdoor2.dds\",\n \"gta3.img/compapart_la.txd/comptdoor2.dds\",\"gta3.img/bev_law2.txd/comptdoor2.dds\",\n \"gta3.img/contachou1_lae2.txd/comptdoor2.dds\",\"gta3.img/bev_law2.txd/comptdoor2.dds\",\n \"gta3.img/cuntwbtxcs_t.txd/comptdoor2.dds\",\"gta3.img/bev_law2.txd/comptdoor2.dds\",\n \"gta3.img/des_bigearstuff.txd/comptdoor2.dds\",\"gta3.img/bev_law2.txd/comptdoor2.dds\",\n \"gta3.img/des_bighus.txd/comptdoor2.dds\",\"gta3.img/bev_law2.txd/comptdoor2.dds\",\n \"gta3.img/des_quarrybits.txd/comptdoor2.dds\",\"gta3.img/bev_law2.txd/comptdoor2.dds\",\n \"gta3.img/des_stownmain3.txd/comptdoor2.dds\",\"gta3.img/bev_law2.txd/comptdoor2.dds\",\n \"gta3.img/hillhousex2_us.txd/comptdoor2.dds\",\"gta3.img/bev_law2.txd/comptdoor2.dds\",\n \"gta3.img/jeffers4_lae.txd/comptdoor2.dds\",\"gta3.img/bev_law2.txd/comptdoor2.dds\",\n \"gta3.img/laesmokecnthus.txd/comptdoor2.dds\",\"gta3.img/bev_law2.txd/comptdoor2.dds\",\n \"gta3.img/landhub.txd/comptdoor2.dds\",\"gta3.img/bev_law2.txd/comptdoor2.dds\",\n \"gta3.img/mullholl_lahills.txd/comptdoor2.dds\",\"gta3.img/bev_law2.txd/comptdoor2.dds\",\n \"gta3.img/projects_la.txd/comptdoor2.dds\",\"gta3.img/bev_law2.txd/comptdoor2.dds\",\n \"gta3.img/sw_poorhouse.txd/comptdoor2.dds\",\"gta3.img/bev_law2.txd/comptdoor2.dds\",\n \"gta3.img/tcecen4law.txd/comptdoor2.dds\",\"gta3.img/bev_law2.txd/comptdoor2.dds\",\n \"gta3.img/vegashse2.txd/comptdoor2.dds\",\"gta3.img/bev_law2.txd/comptdoor2.dds\",\n \"gta_int.img/starps_ext.txd/comptdoor2.dds\",\"gta3.img/bev_law2.txd/comptdoor2.dds\",\n \"gta_int.img/straps_int.txd/comptdoor2.dds\",\"gta3.img/bev_law2.txd/comptdoor2.dds\",\n \"gta3.img/ground4_las.txd/dirtkb_64hv.dds\",\"gta3.img/bev_law2.txd/dirtkb_64hv.dds\",\n \"gta3.img/lae2grnd.txd/dirtkb_64hv.dds\",\"gta3.img/bev_law2.txd/dirtkb_64hv.dds\",\n \"gta3.img/landhub.txd/dirtkb_64hv.dds\",\"gta3.img/bev_law2.txd/dirtkb_64hv.dds\",\n \"gta3.img/landlae2c.txd/dirtkb_64hv.dds\",\"gta3.img/bev_law2.txd/dirtkb_64hv.dds\",\n \"gta3.img/landlae2e.txd/dirtkb_64hv.dds\",\"gta3.img/bev_law2.txd/dirtkb_64hv.dds\",\n \"gta3.img/lasground2_las2.txd/dirtkb_64hv.dds\",\"gta3.img/bev_law2.txd/dirtkb_64hv.dds\",\n \"gta3.img/lasroads_las2.txd/dirtkb_64hv.dds\",\"gta3.img/bev_law2.txd/dirtkb_64hv.dds\",\n \"gta3.img/lasroads_las.txd/dirtkb_64hv.dds\",\"gta3.img/bev_law2.txd/dirtkb_64hv.dds\",\n \"gta3.img/santamonhus1.txd/dirtkb_64hv.dds\",\"gta3.img/bev_law2.txd/dirtkb_64hv.dds\",\n \"gta3.img/shops2_law.txd/dirtkb_64hv.dds\",\"gta3.img/bev_law2.txd/dirtkb_64hv.dds\",\n \"gta_int.img/sumoback.txd/dirtkb_64hv.dds\",\"gta3.img/bev_law2.txd/dirtkb_64hv.dds\",\n \"gta3.img/cemetery_law.txd/studwalltop_law.dds\",\"gta3.img/bev_law2.txd/studwalltop_law.dds\",\n \"gta3.img/filmstud.txd/studwalltop_law.dds\",\"gta3.img/bev_law2.txd/studwalltop_law.dds\",\n \"gta3.img/lahillsland.txd/studwalltop_law.dds\",\"gta3.img/bev_law2.txd/studwalltop_law.dds\",\n \"gta3.img/lawnest2.txd/studwalltop_law.dds\",\"gta3.img/bev_law2.txd/studwalltop_law.dds\",\n \"gta3.img/melrose07_lawn.txd/studwalltop_law.dds\",\"gta3.img/bev_law2.txd/studwalltop_law.dds\",\n \"gta3.img/pointysfe.txd/studwalltop_law.dds\",\"gta3.img/bev_law2.txd/studwalltop_law.dds\",\n \"gta3.img/santamonhus1.txd/studwalltop_law.dds\",\"gta3.img/bev_law2.txd/studwalltop_law.dds\",\n \"gta3.img/santamonhus.txd/studwalltop_law.dds\",\"gta3.img/bev_law2.txd/studwalltop_law.dds\",\n \"gta3.img/santamonicalaw2.txd/studwalltop_law.dds\",\"gta3.img/bev_law2.txd/studwalltop_law.dds\",\n \"gta3.img/sw_library.txd/studwalltop_law.dds\",\"gta3.img/bev_law2.txd/studwalltop_law.dds\",\n \"gta3.img/coast_apts.txd/lasjmposh2.dds\",\"gta3.img/bev_law2.txd/lasjmposh2.dds\",\n \"gta3.img/tcecen4law.txd/lasjmposh2.dds\",\"gta3.img/bev_law2.txd/lasjmposh2.dds\",\n \"gta3.img/ground4_las.txd/sjmlahus26.dds\",\"gta3.img/bevmans01_la.txd/sjmlahus26.dds\",\n \"gta3.img/mulhousclahills.txd/sjmlahus26.dds\",\"gta3.img/bevmans01_la.txd/sjmlahus26.dds\",\n \"gta3.img/sjmla_las.txd/sjmlahus26.dds\",\"gta3.img/bevmans01_la.txd/sjmlahus26.dds\",\n \"gta3.img/snpedhusxref.txd/sjmlahus26.dds\",\"gta3.img/bevmans01_la.txd/sjmlahus26.dds\",\n \"gta3.img/eastls4_lae2.txd/sjmlahus23.dds\",\"gta3.img/bevmans01_la.txd/sjmlahus23.dds\",\n \"gta3.img/snpedhusxref.txd/sjmlahus23.dds\",\"gta3.img/bevmans01_la.txd/sjmlahus23.dds\",\n \"gta3.img/griffobs_las.txd/sjmlahus21.dds\",\"gta3.img/bevmans01_la.txd/sjmlahus21.dds\",\n \"gta3.img/snpedhusxref.txd/sjmlahus21.dds\",\"gta3.img/bevmans01_la.txd/sjmlahus21.dds\",\n \"gta3.img/snpedhusxref.txd/sjmhoodaad.dds\",\"gta3.img/bevmans01_la.txd/sjmhoodaad.dds\",\n \"gta3.img/comedhos1_la.txd/sjmhoodlawn9s.dds\",\"gta3.img/bevmans01_la.txd/sjmhoodlawn9s.dds\",\n \"gta3.img/glenpark1x_lae.txd/sjmhoodlawn9s.dds\",\"gta3.img/bevmans01_la.txd/sjmhoodlawn9s.dds\",\n \"gta3.img/jeffers4_lae.txd/sjmhoodlawn9s.dds\",\"gta3.img/bevmans01_la.txd/sjmhoodlawn9s.dds\",\n \"gta3.img/lae2grnd.txd/sjmhoodlawn9s.dds\",\"gta3.img/bevmans01_la.txd/sjmhoodlawn9s.dds\",\n \"gta3.img/landhub.txd/sjmhoodlawn9s.dds\",\"gta3.img/bevmans01_la.txd/sjmhoodlawn9s.dds\",\n \"gta3.img/sfn_apart02sfn.txd/sjmhoodlawn9s.dds\",\"gta3.img/bevmans01_la.txd/sjmhoodlawn9s.dds\",\n \"gta3.img/cemetery_law.txd/cemebuild03_law.dds\",\"gta3.img/bevmans01_la.txd/cemebuild03_law.dds\",\n \"gta3.img/richman02_lahills.txd/aamanbev95x.dds\",\"gta3.img/bevmans01_la.txd/aamanbev95x.dds\",\n \"gta3.img/vinewood01_lahills.txd/aamanbev95x.dds\",\"gta3.img/bevmans01_la.txd/aamanbev95x.dds\",\n \"gta3.img/cuntwbtxcs_t.txd/rooftiles1.dds\",\"gta3.img/bevmans01_la.txd/rooftiles1.dds\",\n \"gta3.img/cw_motel1.txd/rooftiles1.dds\",\"gta3.img/bevmans01_la.txd/rooftiles1.dds\",\n \"gta3.img/des_stownstrip1.txd/rooftiles1.dds\",\"gta3.img/bevmans01_la.txd/rooftiles1.dds\",\n \"gta3.img/hillhouse14_la.txd/rooftiles1.dds\",\"gta3.img/bevmans01_la.txd/rooftiles1.dds\",\n \"gta3.img/hillhousex_la10_12.txd/rooftiles1.dds\",\"gta3.img/bevmans01_la.txd/rooftiles1.dds\",\n \"gta3.img/newstuff_sfn.txd/rooftiles1.dds\",\"gta3.img/bevmans01_la.txd/rooftiles1.dds\",\n \"gta3.img/sfn_apart02sfn.txd/rooftiles1.dds\",\"gta3.img/bevmans01_la.txd/rooftiles1.dds\",\n \"gta3.img/shops_sfse.txd/rooftiles1.dds\",\"gta3.img/bevmans01_la.txd/rooftiles1.dds\",\n \"gta3.img/tikimotel.txd/rooftiles1.dds\",\"gta3.img/bevmans01_la.txd/rooftiles1.dds\",\n \"gta3.img/vgnglfcrse1.txd/rooftiles1.dds\",\"gta3.img/bevmans01_la.txd/rooftiles1.dds\",\n \"gta3.img/casroyale.txd/genroof02_128.dds\",\"gta3.img/bevmans01_la.txd/genroof02_128.dds\",\n \"gta3.img/mall_law.txd/genroof02_128.dds\",\"gta3.img/bevmans01_la.txd/genroof02_128.dds\",\n \"gta3.img/sw_apartments.txd/genroof02_128.dds\",\"gta3.img/bevmans01_la.txd/genroof02_128.dds\",\n \"gta3.img/vegashse2.txd/genroof02_128.dds\",\"gta3.img/bevmans01_la.txd/genroof02_128.dds\",\n \"gta3.img/vegashse5.txd/genroof02_128.dds\",\"gta3.img/bevmans01_la.txd/genroof02_128.dds\",\n \"gta3.img/vegashse8.txd/genroof02_128.dds\",\"gta3.img/bevmans01_la.txd/genroof02_128.dds\",\n \"gta3.img/vgesvhouse01.txd/genroof02_128.dds\",\"gta3.img/bevmans01_la.txd/genroof02_128.dds\",\n \"gta3.img/vgndwntwn21.txd/genroof02_128.dds\",\"gta3.img/bevmans01_la.txd/genroof02_128.dds\",\n \"gta3.img/vgnhseblk1.txd/genroof02_128.dds\",\"gta3.img/bevmans01_la.txd/genroof02_128.dds\",\n \"gta3.img/vgnhseing1.txd/genroof02_128.dds\",\"gta3.img/bevmans01_la.txd/genroof02_128.dds\",\n \"gta3.img/vgwsavehses.txd/genroof02_128.dds\",\"gta3.img/bevmans01_la.txd/genroof02_128.dds\",\n \"gta3.img/cemetery_law.txd/wilsdoor_01_la.dds\",\"gta3.img/bevmans01_la.txd/wilsdoor_01_la.dds\",\n \"gta3.img/compapart_la.txd/pierwin01_law.dds\",\"gta3.img/bevmans01_la.txd/pierwin01_law.dds\",\n \"gta3.img/pierb_law2.txd/pierwin01_law.dds\",\"gta3.img/bevmans01_la.txd/pierwin01_law.dds\",\n \"gta3.img/bigboxtemp1.txd/garagedoor4_law.dds\",\"gta3.img/bevmans01_la.txd/garagedoor4_law.dds\",\n \"gta3.img/hillhousex_la1_2.txd/garagedoor4_law.dds\",\"gta3.img/bevmans01_la.txd/garagedoor4_law.dds\",\n \"gta3.img/hillhousex_la9.txd/garagedoor4_law.dds\",\"gta3.img/bevmans01_la.txd/garagedoor4_law.dds\",\n \"gta3.img/law_cnrtplaz.txd/garagedoor4_law.dds\",\"gta3.img/bevmans01_la.txd/garagedoor4_law.dds\",\n \"gta3.img/lawest1.txd/garagedoor4_law.dds\",\"gta3.img/bevmans01_la.txd/garagedoor4_law.dds\",\n \"gta3.img/newstuff_sfn.txd/garagedoor4_law.dds\",\"gta3.img/bevmans01_la.txd/garagedoor4_law.dds\",\n \"gta3.img/sfn_apart02sfn.txd/garagedoor4_law.dds\",\"gta3.img/bevmans01_la.txd/garagedoor4_law.dds\",\n \"gta_int.img/lawest1.txd/garagedoor4_law.dds\",\"gta3.img/bevmans01_la.txd/garagedoor4_law.dds\",\n \"gta3.img/hillhouse14_la.txd/aamanbev7x.dds\",\"gta3.img/bevmans01_la.txd/aamanbev7x.dds\",\n \"gta3.img/lahills_wiresnshit3.txd/aamanbev6x.dds\",\"gta3.img/bevmans01_la.txd/aamanbev6x.dds\",\n \"gta3.img/griffobs_las.txd/lasbevcit7.dds\",\"gta3.img/bevmans01_la.txd/lasbevcit7.dds\",\n \"gta3.img/jeffers4_lae.txd/lasbevcit7.dds\",\"gta3.img/bevmans01_la.txd/lasbevcit7.dds\",\n \"gta3.img/tempstuff_lae.txd/lasbevcit7.dds\",\"gta3.img/bevmans01_la.txd/lasbevcit7.dds\",\n \"gta3.img/ground4_las.txd/sjmlahus29.dds\",\"gta3.img/bevmans01_la.txd/sjmlahus29.dds\",\n \"gta3.img/ground5_las.txd/sjmlahus29.dds\",\"gta3.img/bevmans01_la.txd/sjmlahus29.dds\",\n \"gta3.img/lahillsgrounds.txd/sjmlahus29.dds\",\"gta3.img/bevmans01_la.txd/sjmlahus29.dds\",\n \"gta3.img/snpedhusxref.txd/sjmlahus29.dds\",\"gta3.img/bevmans01_la.txd/sjmlahus29.dds\",\n \"gta3.img/boigas_sfw.txd/genroof01_128.dds\",\"gta3.img/bevmans01_la.txd/genroof01_128.dds\",\n \"gta3.img/bs_sfs.txd/genroof01_128.dds\",\"gta3.img/bevmans01_la.txd/genroof01_128.dds\",\n \"gta3.img/des_clifftown.txd/genroof01_128.dds\",\"gta3.img/bevmans01_la.txd/genroof01_128.dds\",\n \"gta3.img/eastls4_lae2.txd/genroof01_128.dds\",\"gta3.img/bevmans01_la.txd/genroof01_128.dds\",\n \"gta3.img/hillhousex13_6.txd/genroof01_128.dds\",\"gta3.img/bevmans01_la.txd/genroof01_128.dds\",\n \"gta3.img/lae2newtempbx.txd/genroof01_128.dds\",\"gta3.img/bevmans01_la.txd/genroof01_128.dds\",\n \"gta3.img/lanblokb2.txd/genroof01_128.dds\",\"gta3.img/bevmans01_la.txd/genroof01_128.dds\",\n \"gta3.img/lawnburg.txd/genroof01_128.dds\",\"gta3.img/bevmans01_la.txd/genroof01_128.dds\",\n \"gta3.img/residential01.txd/genroof01_128.dds\",\"gta3.img/bevmans01_la.txd/genroof01_128.dds\",\n \"gta3.img/vegashse6.txd/genroof01_128.dds\",\"gta3.img/bevmans01_la.txd/genroof01_128.dds\",\n \"gta3.img/vegashse7.txd/genroof01_128.dds\",\"gta3.img/bevmans01_la.txd/genroof01_128.dds\",\n \"gta3.img/vgnboiga1.txd/genroof01_128.dds\",\"gta3.img/bevmans01_la.txd/genroof01_128.dds\",\n \"gta3.img/vgndwntwn22.txd/genroof01_128.dds\",\"gta3.img/bevmans01_la.txd/genroof01_128.dds\",\n \"gta3.img/vgnretail6.txd/genroof01_128.dds\",\"gta3.img/bevmans01_la.txd/genroof01_128.dds\",\n \"gta3.img/vgnshopnmall.txd/genroof01_128.dds\",\"gta3.img/bevmans01_la.txd/genroof01_128.dds\",\n \"gta3.img/vgntamotel.txd/genroof01_128.dds\",\"gta3.img/bevmans01_la.txd/genroof01_128.dds\",\n \"gta3.img/vgwestboiga1.txd/genroof01_128.dds\",\"gta3.img/bevmans01_la.txd/genroof01_128.dds\",\n \"gta3.img/wasteland_las2.txd/genroof01_128.dds\",\"gta3.img/bevmans01_la.txd/genroof01_128.dds\",\n \"gta3.img/break_scaffold.txd/cheerybox03.dds\",\"gta3.img/b_fen_wood.txd/cheerybox03.dds\",\n \"gta3.img/crates.txd/cheerybox03.dds\",\"gta3.img/b_fen_wood.txd/cheerybox03.dds\",\n \"gta3.img/gym_weights.txd/cheerybox03.dds\",\"gta3.img/b_fen_wood.txd/cheerybox03.dds\",\n \"gta3.img/kmb_cratex.txd/cheerybox03.dds\",\"gta3.img/b_fen_wood.txd/cheerybox03.dds\",\n \"gta3.img/kmbjumpx.txd/cheerybox03.dds\",\"gta3.img/b_fen_wood.txd/cheerybox03.dds\",\n \"gta3.img/copcarla.txd/copcarla92wheel64.dds\",\"gta3.img/bfinject.txd/emperor92wheel64.dds\",\n \"gta3.img/copcarsf.txd/copcarla92wheel64.dds\",\"gta3.img/bfinject.txd/emperor92wheel64.dds\",\n \"gta3.img/emperor.txd/emperor92wheel64.dds\",\"gta3.img/bfinject.txd/emperor92wheel64.dds\",\n \"gta3.img/feltzer.txd/feltzer92wheel64.dds\",\"gta3.img/bfinject.txd/emperor92wheel64.dds\",\n \"gta3.img/fortune.txd/fortune92wheel64.dds\",\"gta3.img/bfinject.txd/emperor92wheel64.dds\",\n \"gta3.img/hotknife.txd/emperor92wheel64.dds\",\"gta3.img/bfinject.txd/emperor92wheel64.dds\",\n \"gta3.img/premier.txd/copcarla92wheel64.dds\",\"gta3.img/bfinject.txd/emperor92wheel64.dds\",\n \"gta3.img/sandking.txd/emperor92wheel64.dds\",\"gta3.img/bfinject.txd/emperor92wheel64.dds\",\n \"gta3.img/taxi.txd/taxi92wheel64.dds\",\"gta3.img/bfinject.txd/emperor92wheel64.dds\",\n \"gta3.img/hfyri.txd/watchcro.dds\",\"gta3.img/bfyri.txd/watchcro.dds\",\n \"gta3.img/hmyri.txd/watchcro.dds\",\"gta3.img/bfyri.txd/watchcro.dds\",\n \"gta3.img/ofyri.txd/watchcro.dds\",\"gta3.img/bfyri.txd/watchcro.dds\",\n \"gta3.img/shmycr.txd/watchcro.dds\",\"gta3.img/bfyri.txd/watchcro.dds\",\n \"gta3.img/wfyri.txd/watchcro.dds\",\"gta3.img/bfyri.txd/watchcro.dds\",\n \"gta3.img/wmyri.txd/watchcro.dds\",\"gta3.img/bfyri.txd/watchcro.dds\",\n \"gta3.img/buildblk555.txd/tarmacplain_bank.dds\",\"gta3.img/bigboxtemp1.txd/tarmacplain_bank.dds\",\n \"gta3.img/civic01_lan.txd/tarmacplain_bank.dds\",\"gta3.img/bigboxtemp1.txd/tarmacplain_bank.dds\",\n \"gta3.img/civic06_lan.txd/tarmacplain_bank.dds\",\"gta3.img/bigboxtemp1.txd/tarmacplain_bank.dds\",\n \"gta3.img/eastbeach2a_lae2.txd/tarmacplain_bank.dds\",\"gta3.img/bigboxtemp1.txd/tarmacplain_bank.dds\",\n \"gta3.img/fighot.txd/tarmacplain_bank.dds\",\"gta3.img/bigboxtemp1.txd/tarmacplain_bank.dds\",\n \"gta3.img/furniture_lae2.txd/tarmacplain_bank.dds\",\"gta3.img/bigboxtemp1.txd/tarmacplain_bank.dds\",\n \"gta3.img/lae2roads.txd/tarmacplain_bank.dds\",\"gta3.img/bigboxtemp1.txd/tarmacplain_bank.dds\",\n \"gta3.img/landcoast_lae2.txd/tarmacplain_bank.dds\",\"gta3.img/bigboxtemp1.txd/tarmacplain_bank.dds\",\n \"gta3.img/lanriver.txd/tarmacplain_bank.dds\",\"gta3.img/bigboxtemp1.txd/tarmacplain_bank.dds\",\n \"gta3.img/lanroad.txd/tarmacplain_bank.dds\",\"gta3.img/bigboxtemp1.txd/tarmacplain_bank.dds\",\n \"gta3.img/lashops1_las2.txd/tarmacplain_bank.dds\",\"gta3.img/bigboxtemp1.txd/tarmacplain_bank.dds\",\n \"gta3.img/lashops6_las2.txd/tarmacplain_bank.dds\",\"gta3.img/bigboxtemp1.txd/tarmacplain_bank.dds\",\n \"gta3.img/lomall.txd/tarmacplain_bank.dds\",\"gta3.img/bigboxtemp1.txd/tarmacplain_bank.dds\",\n \"gta3.img/losflor4_lae2.txd/tarmacplain_bank.dds\",\"gta3.img/bigboxtemp1.txd/tarmacplain_bank.dds\",\n \"gta3.img/sfvictorian.txd/tarmacplain_bank.dds\",\"gta3.img/bigboxtemp1.txd/tarmacplain_bank.dds\",\n \"gta3.img/sunset01_law2.txd/tarmacplain_bank.dds\",\"gta3.img/bigboxtemp1.txd/tarmacplain_bank.dds\",\n \"gta3.img/sunset03_law2.txd/tarmacplain_bank.dds\",\"gta3.img/bigboxtemp1.txd/tarmacplain_bank.dds\",\n \"gta3.img/union_las.txd/tarmacplain_bank.dds\",\"gta3.img/bigboxtemp1.txd/tarmacplain_bank.dds\",\n \"gta3.img/vgssland01.txd/tarmacplain_bank.dds\",\"gta3.img/bigboxtemp1.txd/tarmacplain_bank.dds\",\n \"gta3.img/boxybld2_sfw.txd/browntin1.dds\",\"gta3.img/bigboxtemp1.txd/browntin1.dds\",\n \"gta3.img/comedprj1_la.txd/browntin1.dds\",\"gta3.img/bigboxtemp1.txd/browntin1.dds\",\n \"gta3.img/cunte_bar1.txd/browntin1.dds\",\"gta3.img/bigboxtemp1.txd/browntin1.dds\",\n \"gta3.img/cuntwbtxcs_t.txd/browntin1.dds\",\"gta3.img/bigboxtemp1.txd/browntin1.dds\",\n \"gta3.img/desn2_peckers.txd/browntin1.dds\",\"gta3.img/bigboxtemp1.txd/browntin1.dds\",\n \"gta3.img/des_steakhouse.txd/browntin1.dds\",\"gta3.img/bigboxtemp1.txd/browntin1.dds\",\n \"gta3.img/des_stownmots1.txd/browntin1.dds\",\"gta3.img/bigboxtemp1.txd/browntin1.dds\",\n \"gta3.img/gardencentre_sfs.txd/browntin1.dds\",\"gta3.img/bigboxtemp1.txd/browntin1.dds\",\n \"gta3.img/jeffers4_lae.txd/browntin1.dds\",\"gta3.img/bigboxtemp1.txd/browntin1.dds\",\n \"gta3.img/vegashse2.txd/browntin1.dds\",\"gta3.img/bigboxtemp1.txd/browntin1.dds\",\n \"gta3.img/vgnretail4.txd/browntin1.dds\",\"gta3.img/bigboxtemp1.txd/browntin1.dds\",\n \"gta3.img/vgsewrehse.txd/browntin1.dds\",\"gta3.img/bigboxtemp1.txd/browntin1.dds\",\n \"gta3.img/vgsswarehse01.txd/browntin1.dds\",\"gta3.img/bigboxtemp1.txd/browntin1.dds\",\n \"gta3.img/vgsswarehse02.txd/browntin1.dds\",\"gta3.img/bigboxtemp1.txd/browntin1.dds\",\n \"gta3.img/vgsswrehse03.txd/browntin1.dds\",\"gta3.img/bigboxtemp1.txd/browntin1.dds\",\n \"gta3.img/boxybld2_sfw.txd/rooftiles2.dds\",\"gta3.img/bigboxtemp1.txd/rooftiles2.dds\",\n \"gta3.img/gayclub_sfs.txd/rooftiles2.dds\",\"gta3.img/bigboxtemp1.txd/rooftiles2.dds\",\n \"gta3.img/hotel1.txd/rooftiles2.dds\",\"gta3.img/bigboxtemp1.txd/rooftiles2.dds\",\n \"gta3.img/pierb_law2.txd/rooftiles2.dds\",\"gta3.img/bigboxtemp1.txd/rooftiles2.dds\",\n \"gta3.img/sfn_apart02sfn.txd/rooftiles2.dds\",\"gta3.img/bigboxtemp1.txd/rooftiles2.dds\",\n \"gta3.img/sw_poorhouse.txd/rooftiles2.dds\",\"gta3.img/bigboxtemp1.txd/rooftiles2.dds\",\n \"gta3.img/boxhses_sfsx.txd/ws_garagedoor3_white.dds\",\"gta3.img/bigboxtemp1.txd/ws_garagedoor3_white.dds\",\n \"gta3.img/ce_burbhouse.txd/ws_garagedoor3_white.dds\",\"gta3.img/bigboxtemp1.txd/ws_garagedoor3_white.dds\",\n \"gta3.img/cehillhse14.txd/ws_garagedoor3_white.dds\",\"gta3.img/bigboxtemp1.txd/ws_garagedoor3_white.dds\",\n \"gta3.img/counte_b2.txd/ws_garagedoor3_white.dds\",\"gta3.img/bigboxtemp1.txd/ws_garagedoor3_white.dds\",\n \"gta3.img/hillhousex13_6.txd/ws_garagedoor3_white.dds\",\"gta3.img/bigboxtemp1.txd/ws_garagedoor3_white.dds\",\n \"gta3.img/hillhousex4_5.txd/ws_garagedoor3_white.dds\",\"gta3.img/bigboxtemp1.txd/ws_garagedoor3_white.dds\",\n \"gta3.img/lahillshilhs1b.txd/ws_garagedoor3_white.dds\",\"gta3.img/bigboxtemp1.txd/ws_garagedoor3_white.dds\",\n \"gta3.img/lahillshilhs1d.txd/ws_garagedoor3_white.dds\",\"gta3.img/bigboxtemp1.txd/ws_garagedoor3_white.dds\",\n \"gta3.img/lahillshilhs1x.txd/ws_garagedoor3_white.dds\",\"gta3.img/bigboxtemp1.txd/ws_garagedoor3_white.dds\",\n \"gta3.img/lahillshilhs1z.txd/ws_garagedoor3_white.dds\",\"gta3.img/bigboxtemp1.txd/ws_garagedoor3_white.dds\",\n \"gta3.img/lahillshilhse.txd/ws_garagedoor3_white.dds\",\"gta3.img/bigboxtemp1.txd/ws_garagedoor3_white.dds\",\n \"gta3.img/sw_diner1.txd/ws_garagedoor3_white.dds\",\"gta3.img/bigboxtemp1.txd/ws_garagedoor3_white.dds\",\n \"gta3.img/boxhses_sfsx.txd/shingles1.dds\",\"gta3.img/bigboxtemp1.txd/shingles1.dds\",\n \"gta3.img/compapartb_la.txd/shingles1.dds\",\"gta3.img/bigboxtemp1.txd/shingles1.dds\",\n \"gta3.img/compapart_la.txd/shingles1.dds\",\"gta3.img/bigboxtemp1.txd/shingles1.dds\",\n \"gta3.img/contachou1_lae2.txd/shingles1.dds\",\"gta3.img/bigboxtemp1.txd/shingles1.dds\",\n \"gta3.img/des_geyser.txd/shingles1.dds\",\"gta3.img/bigboxtemp1.txd/shingles1.dds\",\n \"gta3.img/desn2_stud.txd/shingles1.dds\",\"gta3.img/bigboxtemp1.txd/shingles1.dds\",\n \"gta3.img/des_ranch.txd/shingles1.dds\",\"gta3.img/bigboxtemp1.txd/shingles1.dds\",\n \"gta3.img/des_ufoinn.txd/shingles1.dds\",\"gta3.img/bigboxtemp1.txd/shingles1.dds\",\n \"gta3.img/jeffers4_lae.txd/shingles1.dds\",\"gta3.img/bigboxtemp1.txd/shingles1.dds\",\n \"gta3.img/laesmokecnthus.txd/shingles1.dds\",\"gta3.img/bigboxtemp1.txd/shingles1.dds\",\n \"gta3.img/law_beach2.txd/shingles1.dds\",\"gta3.img/bigboxtemp1.txd/shingles1.dds\",\n \"gta3.img/vegashse5.txd/shingles1.dds\",\"gta3.img/bigboxtemp1.txd/shingles1.dds\",\n \"gta3.img/vegashse7.txd/shingles1.dds\",\"gta3.img/bigboxtemp1.txd/shingles1.dds\",\n \"gta3.img/vegassvehse7.txd/shingles1.dds\",\"gta3.img/bigboxtemp1.txd/shingles1.dds\",\n \"gta3.img/vict_sfw.txd/shingles1.dds\",\"gta3.img/bigboxtemp1.txd/shingles1.dds\",\n \"gta_int.img/starps_ext.txd/shingles1.dds\",\"gta3.img/bigboxtemp1.txd/shingles1.dds\",\n \"gta3.img/cos_liquorstore.txd/board64_law.dds\",\"gta3.img/bigboxtemp1.txd/board64_law.dds\",\n \"gta3.img/ebeachcineblok.txd/board64_law.dds\",\"gta3.img/bigboxtemp1.txd/board64_law.dds\",\n \"gta3.img/farmstuff.txd/board64_law.dds\",\"gta3.img/bigboxtemp1.txd/board64_law.dds\",\n \"gta3.img/gay_xref.txd/board64_law.dds\",\"gta3.img/bigboxtemp1.txd/board64_law.dds\",\n \"gta3.img/ottos2_sfw.txd/board64_law.dds\",\"gta3.img/bigboxtemp1.txd/board64_law.dds\",\n \"gta3.img/sf_telpole.txd/board64_law.dds\",\"gta3.img/bigboxtemp1.txd/board64_law.dds\",\n \"gta3.img/telegraph.txd/board64_law.dds\",\"gta3.img/bigboxtemp1.txd/board64_law.dds\",\n \"gta3.img/vgncondos1.txd/board64_law.dds\",\"gta3.img/bigboxtemp1.txd/board64_law.dds\",\n \"gta3.img/vgntelepole.txd/board64_law.dds\",\"gta3.img/bigboxtemp1.txd/board64_law.dds\",\n \"gta3.img/vgstlgraphpole.txd/board64_law.dds\",\"gta3.img/bigboxtemp1.txd/board64_law.dds\",\n \"gta_int.img/svsfsm.txd/board64_law.dds\",\"gta3.img/bigboxtemp1.txd/board64_law.dds\",\n \"gta3.img/mullholl_lahills.txd/mullcar01_law.dds\",\"gta3.img/bigboxtemp1.txd/mullcar01_law.dds\",\n \"gta3.img/pointysfe.txd/mullcar01_law.dds\",\"gta3.img/bigboxtemp1.txd/mullcar01_law.dds\",\n \"gta3.img/tcecen4law.txd/mullcar01_law.dds\",\"gta3.img/bigboxtemp1.txd/mullcar01_law.dds\",\n \"gta3.img/boxybld2_sfw.txd/lombard_build3_1.dds\",\"gta3.img/bigboxtemp1.txd/lombard_build3_1.dds\",\n \"gta3.img/lombard.txd/lombard_build3_1.dds\",\"gta3.img/bigboxtemp1.txd/lombard_build3_1.dds\",\n \"gta3.img/boxybld2_sfw.txd/lombard_build2_5.dds\",\"gta3.img/bigboxtemp1.txd/lombard_build2_5.dds\",\n \"gta3.img/law_beach2.txd/lombard_build2_5.dds\",\"gta3.img/bigboxtemp1.txd/lombard_build2_5.dds\",\n \"gta3.img/lombard.txd/lombard_build2_5.dds\",\"gta3.img/bigboxtemp1.txd/lombard_build2_5.dds\",\n \"gta3.img/boxybld2_sfw.txd/patiodr_law.dds\",\"gta3.img/bigboxtemp1.txd/patiodr_law.dds\",\n \"gta3.img/cehillhse14.txd/patiodr_law.dds\",\"gta3.img/bigboxtemp1.txd/patiodr_law.dds\",\n \"gta3.img/desn2_stud.txd/patiodr_law.dds\",\"gta3.img/bigboxtemp1.txd/patiodr_law.dds\",\n \"gta3.img/des_ranch.txd/patiodr_law.dds\",\"gta3.img/bigboxtemp1.txd/patiodr_law.dds\",\n \"gta3.img/gravblok01_lahills.txd/patiodr_law.dds\",\"gta3.img/bigboxtemp1.txd/patiodr_law.dds\",\n \"gta3.img/hillhousex13_6.txd/patiodr_law.dds\",\"gta3.img/bigboxtemp1.txd/patiodr_law.dds\",\n \"gta3.img/hillhousex2_us.txd/patiodr_law.dds\",\"gta3.img/bigboxtemp1.txd/patiodr_law.dds\",\n \"gta3.img/lahillshilhs1b.txd/patiodr_law.dds\",\"gta3.img/bigboxtemp1.txd/patiodr_law.dds\",\n \"gta3.img/lahillshilhs1c.txd/patiodr_law.dds\",\"gta3.img/bigboxtemp1.txd/patiodr_law.dds\",\n \"gta3.img/lahillshilhs1d.txd/patiodr_law.dds\",\"gta3.img/bigboxtemp1.txd/patiodr_law.dds\",\n \"gta3.img/lahillshilhs1e.txd/patiodr_law.dds\",\"gta3.img/bigboxtemp1.txd/patiodr_law.dds\",\n \"gta3.img/lahillshilhs1z.txd/patiodr_law.dds\",\"gta3.img/bigboxtemp1.txd/patiodr_law.dds\",\n \"gta3.img/lahillshilhse.txd/patiodr_law.dds\",\"gta3.img/bigboxtemp1.txd/patiodr_law.dds\",\n \"gta3.img/mullholl_lahills.txd/patiodr_law.dds\",\"gta3.img/bigboxtemp1.txd/patiodr_law.dds\",\n \"gta3.img/santavenice3.txd/patiodr_law.dds\",\"gta3.img/bigboxtemp1.txd/patiodr_law.dds\",\n \"gta3.img/tcecen4law.txd/patiodr_law.dds\",\"gta3.img/bigboxtemp1.txd/patiodr_law.dds\",\n \"gta3.img/venicegb02_law.txd/patiodr_law.dds\",\"gta3.img/bigboxtemp1.txd/patiodr_law.dds\",\n \"gta_int.img/dr_gsnew.txd/patiodr_law.dds\",\"gta3.img/bigboxtemp1.txd/patiodr_law.dds\",\n \"gta3.img/boxybld2_sfw.txd/lombard_build2_4.dds\",\"gta3.img/bigboxtemp1.txd/lombard_build2_4.dds\",\n \"gta3.img/law_beach2.txd/lombard_build2_4.dds\",\"gta3.img/bigboxtemp1.txd/lombard_build2_4.dds\",\n \"gta3.img/lombard.txd/lombard_build2_4.dds\",\"gta3.img/bigboxtemp1.txd/lombard_build2_4.dds\",\n \"gta3.img/boxybld2_sfw.txd/lombard_build2_2.dds\",\"gta3.img/bigboxtemp1.txd/lombard_build2_2.dds\",\n \"gta3.img/law_beach2.txd/lombard_build2_2.dds\",\"gta3.img/bigboxtemp1.txd/lombard_build2_2.dds\",\n \"gta3.img/lombard.txd/lombard_build2_2.dds\",\"gta3.img/bigboxtemp1.txd/lombard_build2_2.dds\",\n \"gta3.img/boxybld2_sfw.txd/redbrickground256.dds\",\"gta3.img/bigboxtemp1.txd/redbrickground256.dds\",\n \"gta3.img/docg01_lahills.txd/redbrickground256.dds\",\"gta3.img/bigboxtemp1.txd/redbrickground256.dds\",\n \"gta3.img/easthills_lahills.txd/redbrickground256.dds\",\"gta3.img/bigboxtemp1.txd/redbrickground256.dds\",\n \"gta3.img/jeffers4_lae.txd/redbrickground256.dds\",\"gta3.img/bigboxtemp1.txd/redbrickground256.dds\",\n \"gta3.img/mullho03a_lahills.txd/redbrickground256.dds\",\"gta3.img/bigboxtemp1.txd/redbrickground256.dds\",\n \"gta_int.img/dr_gsbits.txd/redbrickground256.dds\",\"gta3.img/bigboxtemp1.txd/redbrickground256.dds\",\n \"gta3.img/comedbarrio1_la.txd/acrooftop1256.dds\",\"gta3.img/bigboxtemp1.txd/acrooftop1256.dds\",\n \"gta3.img/councl_law2.txd/acrooftop1256.dds\",\"gta3.img/bigboxtemp1.txd/acrooftop1256.dds\",\n \"gta3.img/cuntclub_law2.txd/acrooftop1256.dds\",\"gta3.img/bigboxtemp1.txd/acrooftop1256.dds\",\n \"gta3.img/des_bighus.txd/acrooftop1256.dds\",\"gta3.img/bigboxtemp1.txd/acrooftop1256.dds\",\n \"gta3.img/des_damquay.txd/acrooftop1256.dds\",\"gta3.img/bigboxtemp1.txd/acrooftop1256.dds\",\n \"gta3.img/des_substation.txd/acrooftop1256.dds\",\"gta3.img/bigboxtemp1.txd/acrooftop1256.dds\",\n \"gta3.img/law_beach2.txd/acrooftop1256.dds\",\"gta3.img/bigboxtemp1.txd/acrooftop1256.dds\",\n \"gta3.img/sancliff_law2.txd/acrooftop1256.dds\",\"gta3.img/bigboxtemp1.txd/acrooftop1256.dds\",\n \"gta3.img/santamonhus1.txd/acrooftop1256.dds\",\"gta3.img/bigboxtemp1.txd/acrooftop1256.dds\",\n \"gta3.img/stolenbuild03.txd/acrooftop1256.dds\",\"gta3.img/bigboxtemp1.txd/acrooftop1256.dds\",\n \"gta3.img/subshops_sfs.txd/acrooftop1256.dds\",\"gta3.img/bigboxtemp1.txd/acrooftop1256.dds\",\n \"gta3.img/sw_block06.txd/acrooftop1256.dds\",\"gta3.img/bigboxtemp1.txd/acrooftop1256.dds\",\n \"gta3.img/vgndwntwn2.txd/acrooftop1256.dds\",\"gta3.img/bigboxtemp1.txd/acrooftop1256.dds\",\n \"gta3.img/vgnglfcrse1.txd/acrooftop1256.dds\",\"gta3.img/bigboxtemp1.txd/acrooftop1256.dds\",\n \"gta3.img/boxybld2_sfw.txd/sf_concrete1.dds\",\"gta3.img/bigboxtemp1.txd/sf_concrete1.dds\",\n \"gta3.img/lomall.txd/sf_concrete1.dds\",\"gta3.img/bigboxtemp1.txd/sf_concrete1.dds\",\n \"gta3.img/monlith_sfe.txd/sf_concrete1.dds\",\"gta3.img/bigboxtemp1.txd/sf_concrete1.dds\",\n \"gta3.img/sfe_park1.txd/sf_concrete1.dds\",\"gta3.img/bigboxtemp1.txd/sf_concrete1.dds\",\n \"gta3.img/slapart01sfe.txd/sf_concrete1.dds\",\"gta3.img/bigboxtemp1.txd/sf_concrete1.dds\",\n \"gta3.img/boxybld2_sfw.txd/sfn_grass1.dds\",\"gta3.img/bigboxtemp1.txd/sfn_grass1.dds\",\n \"gta3.img/carparkssfn.txd/sfn_grass1.dds\",\"gta3.img/bigboxtemp1.txd/sfn_grass1.dds\",\n \"gta3.img/ce_ground07.txd/desgrassbrn.dds\",\"gta3.img/bigboxtemp1.txd/sfn_grass1.dds\",\n \"gta3.img/chicano10_lae.txd/desgrassbrn.dds\",\"gta3.img/bigboxtemp1.txd/sfn_grass1.dds\",\n \"gta3.img/des_nw2.txd/desgrassbrn.dds\",\"gta3.img/bigboxtemp1.txd/sfn_grass1.dds\",\n \"gta3.img/des_nw.txd/desgrassbrn.dds\",\"gta3.img/bigboxtemp1.txd/sfn_grass1.dds\",\n \"gta3.img/des_se4.txd/desgrassbrn.dds\",\"gta3.img/bigboxtemp1.txd/sfn_grass1.dds\",\n \"gta3.img/des_sw.txd/desgrassbrn.dds\",\"gta3.img/bigboxtemp1.txd/sfn_grass1.dds\",\n \"gta3.img/lahillsgrounds.txd/desgrassbrn.dds\",\"gta3.img/bigboxtemp1.txd/sfn_grass1.dds\",\n \"gta3.img/newstuff_sfn.txd/sfn_grass1.dds\",\"gta3.img/bigboxtemp1.txd/sfn_grass1.dds\",\n \"gta3.img/sfn_apart02sfn.txd/sfn_grass1.dds\",\"gta3.img/bigboxtemp1.txd/sfn_grass1.dds\",\n \"gta3.img/sfn_sfn.txd/sfn_grass1.dds\",\"gta3.img/bigboxtemp1.txd/sfn_grass1.dds\",\n \"gta3.img/sw_fact01a.txd/desgrassbrn.dds\",\"gta3.img/bigboxtemp1.txd/sfn_grass1.dds\",\n \"gta3.img/vgsecoast.txd/desgrassbrn.dds\",\"gta3.img/bigboxtemp1.txd/sfn_grass1.dds\",\n \"gta3.img/vgsshospshop.txd/desgrassbrn.dds\",\"gta3.img/bigboxtemp1.txd/sfn_grass1.dds\",\n \"gta3.img/vgssland02.txd/desgrassbrn.dds\",\"gta3.img/bigboxtemp1.txd/sfn_grass1.dds\",\n \"gta3.img/boxybld2_sfw.txd/poshground_sfw.dds\",\"gta3.img/bigboxtemp1.txd/poshground_sfw.dds\",\n \"gta3.img/coast_apts.txd/garagedoor5_law.dds\",\"gta3.img/bigboxtemp1.txd/garagedoor5_law.dds\",\n \"gta3.img/vegashse4.txd/garagedoor5_law.dds\",\"gta3.img/bigboxtemp1.txd/garagedoor5_law.dds\",\n \"gta3.img/vegashse7.txd/garagedoor5_law.dds\",\"gta3.img/bigboxtemp1.txd/garagedoor5_law.dds\",\n \"gta3.img/vegirlfr01.txd/garagedoor5_law.dds\",\"gta3.img/bigboxtemp1.txd/garagedoor5_law.dds\",\n \"gta3.img/venice_law.txd/garagedoor5_law.dds\",\"gta3.img/bigboxtemp1.txd/garagedoor5_law.dds\",\n \"gta3.img/boxybld2_sfw.txd/poshbox3b.dds\",\"gta3.img/bigboxtemp1.txd/poshbox3b.dds\",\n \"gta3.img/boxybld2_sfw.txd/poshbox3a.dds\",\"gta3.img/bigboxtemp1.txd/poshbox3a.dds\",\n \"gta3.img/boxybld2_sfw.txd/poshbox3c.dds\",\"gta3.img/bigboxtemp1.txd/poshbox3c.dds\",\n \"gta3.img/boxybld2_sfw.txd/ws_airportwin1.dds\",\"gta3.img/bigboxtemp1.txd/ws_airportwin1.dds\",\n \"gta3.img/donut_sfw.txd/ws_airportwin1.dds\",\"gta3.img/bigboxtemp1.txd/ws_airportwin1.dds\",\n \"gta3.img/gazlaw3.txd/ws_airportwin1.dds\",\"gta3.img/bigboxtemp1.txd/ws_airportwin1.dds\",\n \"gta3.img/silicon_sfxrf.txd/ws_airportwin1.dds\",\"gta3.img/bigboxtemp1.txd/ws_airportwin1.dds\",\n \"gta3.img/boxybld2_sfw.txd/ws_alley5_256_blank.dds\",\"gta3.img/bigboxtemp1.txd/ws_alley5_256_blank.dds\",\n \"gta3.img/copshop_sfe.txd/bevdoor02_law.dds\",\"gta3.img/bigbuildlawn.txd/bevdoor02_law.dds\",\n \"gta3.img/eastbeach8_lae2.txd/bevdoor02_law.dds\",\"gta3.img/bigbuildlawn.txd/bevdoor02_law.dds\",\n \"gta3.img/lanblokb2.txd/bevdoor02_law.dds\",\"gta3.img/bigbuildlawn.txd/bevdoor02_law.dds\",\n \"gta3.img/lanblokg.txd/bevdoor02_law.dds\",\"gta3.img/bigbuildlawn.txd/bevdoor02_law.dds\",\n \"gta3.img/rodeo01_law2.txd/bevdoor02_law.dds\",\"gta3.img/bigbuildlawn.txd/bevdoor02_law.dds\",\n \"gta3.img/sunrise04_lawn.txd/bevdoor02_law.dds\",\"gta3.img/bigbuildlawn.txd/bevdoor02_law.dds\",\n \"gta3.img/vgnfremnt1.txd/bevdoor02_law.dds\",\"gta3.img/bigbuildlawn.txd/bevdoor02_law.dds\",\n \"gta3.img/gangblok1_lae2.txd/roof10l256.dds\",\"gta3.img/bigbuildlawn.txd/roof10l256.dds\",\n \"gta3.img/oldshops_las.txd/roof10l256.dds\",\"gta3.img/bigbuildlawn.txd/roof10l256.dds\",\n \"gta3.img/sw_ware01.txd/roof10l256.dds\",\"gta3.img/bigbuildlawn.txd/roof10l256.dds\",\n \"gta3.img/vgncorp1.txd/roof10l256.dds\",\"gta3.img/bigbuildlawn.txd/roof10l256.dds\",\n \"gta3.img/lanblokb2.txd/ornatebuildlaw2_3.dds\",\"gta3.img/bigbuildlawn.txd/ornatebuildlaw2_3.dds\",\n \"gta3.img/lanblokg.txd/ornatebuildlaw2_3.dds\",\"gta3.img/bigbuildlawn.txd/ornatebuildlaw2_3.dds\",\n \"gta3.img/lanblokb2.txd/ornatebuildlaw2_4.dds\",\"gta3.img/bigbuildlawn.txd/ornatebuildlaw2_4.dds\",\n \"gta3.img/lanblokg.txd/ornatebuildlaw2_4.dds\",\"gta3.img/bigbuildlawn.txd/ornatebuildlaw2_4.dds\",\n \"gta3.img/lanblokb2.txd/ornatebuildlaw2_2.dds\",\"gta3.img/bigbuildlawn.txd/ornatebuildlaw2_2.dds\",\n \"gta3.img/lanblokg.txd/ornatebuildlaw2_2.dds\",\"gta3.img/bigbuildlawn.txd/ornatebuildlaw2_2.dds\",\n \"gta3.img/lanblokb2.txd/ornatebuildlaw2_1.dds\",\"gta3.img/bigbuildlawn.txd/ornatebuildlaw2_1.dds\",\n \"gta3.img/lanblokg.txd/ornatebuildlaw2_1.dds\",\"gta3.img/bigbuildlawn.txd/ornatebuildlaw2_1.dds\",\n \"gta3.img/des_boneyard.txd/ws_hangardoor.dds\",\"gta3.img/bighangarsfxr.txd/ws_hangardoor.dds\",\n \"gta3.img/vegasshangar.txd/ws_hangardoor.dds\",\"gta3.img/bighangarsfxr.txd/ws_hangardoor.dds\",\n \"gta3.img/vgssairportcpark.txd/ws_hangardoor.dds\",\"gta3.img/bighangarsfxr.txd/ws_hangardoor.dds\",\n \"gta3.img/des_boneyard.txd/ws_trainstationwin1.dds\",\"gta3.img/bighangarsfxr.txd/ws_trainstationwin1.dds\",\n \"gta3.img/silicon2_sfse.txd/ws_trainstationwin1.dds\",\"gta3.img/bighangarsfxr.txd/ws_trainstationwin1.dds\",\n \"gta3.img/station_sfse.txd/ws_trainstationwin1.dds\",\"gta3.img/bighangarsfxr.txd/ws_trainstationwin1.dds\",\n \"gta3.img/vegasshangar.txd/ws_trainstationwin1.dds\",\"gta3.img/bighangarsfxr.txd/ws_trainstationwin1.dds\",\n \"gta3.img/vgssairportcpark.txd/ws_trainstationwin1.dds\",\"gta3.img/bighangarsfxr.txd/ws_trainstationwin1.dds\",\n \"gta3.img/des_boneyard.txd/railgird32bit.dds\",\"gta3.img/bighangarsfxr.txd/railgird32bit.dds\",\n \"gta3.img/des_xoilfield.txd/railgird32bit.dds\",\"gta3.img/bighangarsfxr.txd/railgird32bit.dds\",\n \"gta3.img/vegasshangar.txd/railgird32bit.dds\",\"gta3.img/bighangarsfxr.txd/railgird32bit.dds\",\n \"gta3.img/vgssairportcpark.txd/railgird32bit.dds\",\"gta3.img/bighangarsfxr.txd/railgird32bit.dds\",\n \"gta_int.img/destructo.txd/railgird32bit.dds\",\"gta3.img/bighangarsfxr.txd/railgird32bit.dds\",\n \"gta_int.img/stadstunt.txd/railgird32bit.dds\",\"gta3.img/bighangarsfxr.txd/railgird32bit.dds\",\n \"gta_int.img/sumo.txd/railgird32bit.dds\",\"gta3.img/bighangarsfxr.txd/railgird32bit.dds\",\n \"gta3.img/cxref_desert.txd/ws_crossbeam1.dds\",\"gta3.img/bighangarsfxr.txd/ws_crossbeam1.dds\",\n \"gta3.img/des_boneyard.txd/ws_crossbeam1.dds\",\"gta3.img/bighangarsfxr.txd/ws_crossbeam1.dds\",\n \"gta3.img/vegasshangar.txd/ws_crossbeam1.dds\",\"gta3.img/bighangarsfxr.txd/ws_crossbeam1.dds\",\n \"gta3.img/vgssairportcpark.txd/ws_crossbeam1.dds\",\"gta3.img/bighangarsfxr.txd/ws_crossbeam1.dds\",\n \"gta3.img/des_boneyard.txd/ws_breezeblocks.dds\",\"gta3.img/bighangarsfxr.txd/ws_breezeblocks.dds\",\n \"gta3.img/drivingschool_sfse.txd/ws_breezeblocks.dds\",\"gta3.img/bighangarsfxr.txd/ws_breezeblocks.dds\",\n \"gta3.img/fedmint_sfs.txd/ws_breezeblocks.dds\",\"gta3.img/bighangarsfxr.txd/ws_breezeblocks.dds\",\n \"gta3.img/subshops_sfs.txd/ws_breezeblocks.dds\",\"gta3.img/bighangarsfxr.txd/ws_breezeblocks.dds\",\n \"gta3.img/vegasshangar.txd/ws_breezeblocks.dds\",\"gta3.img/bighangarsfxr.txd/ws_breezeblocks.dds\",\n \"gta3.img/vgsbikeschool.txd/ws_breezeblocks.dds\",\"gta3.img/bighangarsfxr.txd/ws_breezeblocks.dds\",\n \"gta3.img/vgssairportcpark.txd/ws_breezeblocks.dds\",\"gta3.img/bighangarsfxr.txd/ws_breezeblocks.dds\",\n \"gta3.img/chinatownsfe.txd/sf_windos_13wall.dds\",\"gta3.img/bigoldbuild_sfe.txd/sf_windos_13wall.dds\",\n \"gta3.img/fishwarf.txd/sf_windos_13wall.dds\",\"gta3.img/bigoldbuild_sfe.txd/sf_windos_13wall.dds\",\n \"gta3.img/smallertxd.txd/sf_windos_13wall.dds\",\"gta3.img/bigoldbuild_sfe.txd/sf_windos_13wall.dds\",\n \"gta3.img/law_doontoon.txd/sfe_nicearch4.dds\",\"gta3.img/bigoldbuild_sfe.txd/sfe_nicearch4.dds\",\n \"gta3.img/sfe_swank1.txd/sfe_nicearch4.dds\",\"gta3.img/bigoldbuild_sfe.txd/sfe_nicearch4.dds\",\n \"gta3.img/smallertxd.txd/sfe_nicearch4.dds\",\"gta3.img/bigoldbuild_sfe.txd/sfe_nicearch4.dds\",\n \"gta3.img/stolenbuild02.txd/sfe_nicearch4.dds\",\"gta3.img/bigoldbuild_sfe.txd/sfe_nicearch4.dds\",\n \"gta3.img/bigwhitesfe.txd/sfe_arch1.dds\",\"gta3.img/bigoldbuild_sfe.txd/sfe_arch1.dds\",\n \"gta3.img/posh2_sfe.txd/sfe_arch1.dds\",\"gta3.img/bigoldbuild_sfe.txd/sfe_arch1.dds\",\n \"gta3.img/sfe_park1.txd/sfe_arch1.dds\",\"gta3.img/bigoldbuild_sfe.txd/sfe_arch1.dds\",\n \"gta3.img/smallertxd.txd/sf_windos_2.dds\",\"gta3.img/bigoldbuild_sfe.txd/sf_windos_2.dds\",\n \"gta3.img/smallertxd.txd/roofthing2_sfe.dds\",\"gta3.img/bigoldbuild_sfe.txd/roofthing2_sfe.dds\",\n \"gta3.img/smallertxd.txd/lanky4_sfe.dds\",\"gta3.img/bigoldbuild_sfe.txd/lanky4_sfe.dds\",\n \"gta3.img/smallertxd.txd/lanky2_sfe.dds\",\"gta3.img/bigoldbuild_sfe.txd/lanky2_sfe.dds\",\n \"gta3.img/smallertxd.txd/lanky1_sfe.dds\",\"gta3.img/bigoldbuild_sfe.txd/lanky1_sfe.dds\",\n \"gta3.img/chinatownmall.txd/cluckbell02_law.dds\",\"gta3.img/bigoldbuild_sfe.txd/cluckbell02_law.dds\",\n \"gta3.img/cluckbell_sfs.txd/cluckbell02_law.dds\",\"gta3.img/bigoldbuild_sfe.txd/cluckbell02_law.dds\",\n \"gta3.img/cuntwbtzzcs_t.txd/cluckbell02_law.dds\",\"gta3.img/bigoldbuild_sfe.txd/cluckbell02_law.dds\",\n \"gta3.img/des_dinerw.txd/cluckbell02_law.dds\",\"gta3.img/bigoldbuild_sfe.txd/cluckbell02_law.dds\",\n \"gta3.img/des_ufoinn.txd/cluckbell02_law.dds\",\"gta3.img/bigoldbuild_sfe.txd/cluckbell02_law.dds\",\n \"gta3.img/furniture_lae2.txd/cluckbell02_law.dds\",\"gta3.img/bigoldbuild_sfe.txd/cluckbell02_law.dds\",\n \"gta3.img/lashops6_las2.txd/cluckbell02_law.dds\",\"gta3.img/bigoldbuild_sfe.txd/cluckbell02_law.dds\",\n \"gta3.img/vgnretail2.txd/cluckbell02_law.dds\",\"gta3.img/bigoldbuild_sfe.txd/cluckbell02_law.dds\",\n \"gta3.img/chinatownmall.txd/cluckbell01_law.dds\",\"gta3.img/bigoldbuild_sfe.txd/cluckbell01_law.dds\",\n \"gta3.img/cluckbell_sfs.txd/cluckbell01_law.dds\",\"gta3.img/bigoldbuild_sfe.txd/cluckbell01_law.dds\",\n \"gta3.img/cuntwbtzzcs_t.txd/cluckbell01_law.dds\",\"gta3.img/bigoldbuild_sfe.txd/cluckbell01_law.dds\",\n \"gta3.img/des_dinerw.txd/cluckbell01_law.dds\",\"gta3.img/bigoldbuild_sfe.txd/cluckbell01_law.dds\",\n \"gta3.img/lawnabv.txd/cluckbell01_law.dds\",\"gta3.img/bigoldbuild_sfe.txd/cluckbell01_law.dds\",\n \"gta3.img/vgnbballsign2.txd/cluckbell01_law.dds\",\"gta3.img/bigoldbuild_sfe.txd/cluckbell01_law.dds\",\n \"gta3.img/vgndwntwn23.txd/cluckbell01_law.dds\",\"gta3.img/bigoldbuild_sfe.txd/cluckbell01_law.dds\",\n \"gta3.img/vgnshopnmall.txd/cluckbell01_law.dds\",\"gta3.img/bigoldbuild_sfe.txd/cluckbell01_law.dds\",\n \"gta3.img/boigas_sfw.txd/vgnburgwal3_256.dds\",\"gta3.img/bigoldbuild_sfe.txd/vgnburgwal3_256.dds\",\n \"gta3.img/bs_sfs.txd/vgnburgwal3_256.dds\",\"gta3.img/bigoldbuild_sfe.txd/vgnburgwal3_256.dds\",\n \"gta3.img/cluckbell_sfs.txd/vgnburgwal3_256.dds\",\"gta3.img/bigoldbuild_sfe.txd/vgnburgwal3_256.dds\",\n \"gta3.img/lawnabv.txd/vgnburgwal3_256.dds\",\"gta3.img/bigoldbuild_sfe.txd/vgnburgwal3_256.dds\",\n \"gta3.img/lawnburg.txd/vgnburgwal3_256.dds\",\"gta3.img/bigoldbuild_sfe.txd/vgnburgwal3_256.dds\",\n \"gta3.img/vgnboiga1.txd/vgnburgwal3_256.dds\",\"gta3.img/bigoldbuild_sfe.txd/vgnburgwal3_256.dds\",\n \"gta3.img/vgndwntwn23.txd/vgnburgwal3_256.dds\",\"gta3.img/bigoldbuild_sfe.txd/vgnburgwal3_256.dds\",\n \"gta3.img/vgsscollege.txd/vgnburgwal3_256.dds\",\"gta3.img/bigoldbuild_sfe.txd/vgnburgwal3_256.dds\",\n \"gta3.img/vgwestboiga1.txd/vgnburgwal3_256.dds\",\"gta3.img/bigoldbuild_sfe.txd/vgnburgwal3_256.dds\",\n \"gta3.img/smallertxd.txd/sf_shop4.dds\",\"gta3.img/bigoldbuild_sfe.txd/sf_shop4.dds\",\n \"gta3.img/ext_doors2.txd/clubdoor1_256.dds\",\"gta3.img/bigoldbuild_sfe.txd/clubdoor1_256.dds\",\n \"gta3.img/pier69.txd/clubdoor1_256.dds\",\"gta3.img/bigoldbuild_sfe.txd/clubdoor1_256.dds\",\n \"gta3.img/vgnfremnt2.txd/clubdoor1_256.dds\",\"gta3.img/bigoldbuild_sfe.txd/clubdoor1_256.dds\",\n \"gta_int.img/lee_strip2.txd/clubdoor1_256.dds\",\"gta3.img/bigoldbuild_sfe.txd/clubdoor1_256.dds\",\n \"gta3.img/smallertxd.txd/sf_windos_3.dds\",\"gta3.img/bigoldbuild_sfe.txd/sf_windos_3.dds\",\n \"gta3.img/gazlaw3.txd/bigbrown2_sfe.dds\",\"gta3.img/bigoldbuild_sfe.txd/bigbrown2_sfe.dds\",\n \"gta3.img/gazlaw3.txd/sfe_bigbuild1.dds\",\"gta3.img/bigoldbuild_sfe.txd/sfe_bigbuild1.dds\",\n \"gta3.img/smallertxd.txd/sfe_bigbuild1.dds\",\"gta3.img/bigoldbuild_sfe.txd/sfe_bigbuild1.dds\",\n \"gta3.img/smallertxd.txd/sf_windos_1.dds\",\"gta3.img/bigoldbuild_sfe.txd/sf_windos_1.dds\",\n \"gta3.img/dtbuil1_lan2.txd/sf_backaley1.dds\",\"gta3.img/bigoldbuild_sfe.txd/sf_backaley1.dds\",\n \"gta3.img/sfn_sfn.txd/sf_backaley1.dds\",\"gta3.img/bigoldbuild_sfe.txd/sf_backaley1.dds\",\n \"gta3.img/stolenbuild01.txd/sf_backaley1.dds\",\"gta3.img/bigoldbuild_sfe.txd/sf_backaley1.dds\",\n \"gta_int.img/rampforduthie.txd/sf_backaley1.dds\",\"gta3.img/bigoldbuild_sfe.txd/sf_backaley1.dds\",\n \"gta3.img/smallertxd.txd/bank_sfe3.dds\",\"gta3.img/bigoldbuild_sfe.txd/bank_sfe3.dds\",\n \"gta_int.img/rampforduthie.txd/bank_sfe3.dds\",\"gta3.img/bigoldbuild_sfe.txd/bank_sfe3.dds\",\n \"gta3.img/stolenbuild01.txd/bank_sfe1.dds\",\"gta3.img/bigoldbuild_sfe.txd/bank_sfe1.dds\",\n \"gta3.img/sunrise05_lawn.txd/bank_sfe1.dds\",\"gta3.img/bigoldbuild_sfe.txd/bank_sfe1.dds\",\n \"gta3.img/maintlitetriangle.txd/man_ceiling.dds\",\"gta3.img/bigshap_sfw.txd/man_ceiling.dds\",\n \"gta_int.img/imy_motel2.txd/man_ceiling.dds\",\"gta3.img/bigshap_sfw.txd/man_ceiling.dds\",\n \"gta_int.img/imy_motel.txd/man_ceiling.dds\",\"gta3.img/bigshap_sfw.txd/man_ceiling.dds\",\n \"gta_int.img/maint1.txd/man_ceiling.dds\",\"gta3.img/bigshap_sfw.txd/man_ceiling.dds\",\n \"gta3.img/frieghter2sfe.txd/freight_crate3.dds\",\"gta3.img/bigshap_sfw.txd/freight_crate3.dds\",\n \"gta3.img/frieghter2sfe.txd/freight_crate5.dds\",\"gta3.img/bigshap_sfw.txd/freight_crate5.dds\",\n \"gta3.img/frieghter2sfe.txd/freight_crate4.dds\",\"gta3.img/bigshap_sfw.txd/freight_crate4.dds\",\n \"gta3.img/frieghter2sfe.txd/freight_crate6.dds\",\"gta3.img/bigshap_sfw.txd/freight_crate6.dds\",\n \"gta3.img/car_ship_sfse.txd/freighterhull2.dds\",\"gta3.img/bigshap_sfw.txd/freighterhull2.dds\",\n \"gta3.img/car_ship_sfse.txd/freighterhull1.dds\",\"gta3.img/bigshap_sfw.txd/freighterhull1.dds\",\n \"gta3.img/freight_sfe.txd/freighter5.dds\",\"gta3.img/bigshap_sfw.txd/freighter5.dds\",\n \"gta3.img/car_ship_sfse.txd/freighter3.dds\",\"gta3.img/bigshap_sfw.txd/freighter3.dds\",\n \"gta3.img/freight_sfe.txd/freighter3.dds\",\"gta3.img/bigshap_sfw.txd/freighter3.dds\",\n \"gta3.img/bigshapx.txd/freighter1.dds\",\"gta3.img/bigshap_sfw.txd/freighter1.dds\",\n \"gta3.img/car_ship_sfse.txd/freighter1.dds\",\"gta3.img/bigshap_sfw.txd/freighter1.dds\",\n \"gta3.img/car_ship_sfse.txd/freighter2.dds\",\"gta3.img/bigshap_sfw.txd/freighter2.dds\",\n \"gta3.img/freight_sfe.txd/freighter2.dds\",\"gta3.img/bigshap_sfw.txd/freighter2.dds\",\n \"gta3.img/car_ship_sfse.txd/freighter4.dds\",\"gta3.img/bigshap_sfw.txd/freighter4.dds\",\n \"gta3.img/freight_sfe.txd/freighter4.dds\",\"gta3.img/bigshap_sfw.txd/freighter4.dds\",\n \"gta3.img/frieghter2sfe.txd/freighter4.dds\",\"gta3.img/bigshap_sfw.txd/freighter4.dds\",\n \"gta3.img/car_ship_sfse.txd/boatfunnel2_64.dds\",\"gta3.img/bigshap_sfw.txd/boatfunnel2_64.dds\",\n \"gta3.img/dkcargoshp_las2.txd/boatfunnel2_64.dds\",\"gta3.img/bigshap_sfw.txd/boatfunnel2_64.dds\",\n \"gta3.img/car_ship_sfse.txd/alleywin5.dds\",\"gta3.img/bigshap_sfw.txd/alleywin5.dds\",\n \"gta3.img/dkcargoshp_las2.txd/alleywin5.dds\",\"gta3.img/bigshap_sfw.txd/alleywin5.dds\",\n \"gta3.img/sfn_caravansfn.txd/trail_win.dds\",\"gta3.img/bigshap_sfw.txd/alleywin5.dds\",\n \"gta3.img/trailers.txd/trail_win.dds\",\"gta3.img/bigshap_sfw.txd/alleywin5.dds\",\n \"gta3.img/car_ship_sfse.txd/boatfunnel1_128.dds\",\"gta3.img/bigshap_sfw.txd/boatfunnel1_128.dds\",\n \"gta3.img/dkcargoshp_las2.txd/boatfunnel1_128.dds\",\"gta3.img/bigshap_sfw.txd/boatfunnel1_128.dds\",\n \"gta3.img/oldgarage_sfse.txd/ws_corr_plastic.dds\",\"gta3.img/bigshed_sfse.txd/ws_corr_plastic.dds\",\n \"gta3.img/drivingschool_sfse.txd/ws_reinforcedbutwonky.dds\",\"gta3.img/bigshed_sfse.txd/ws_reinforcedbutwonky.dds\",\n \"gta3.img/vgsbikeschool.txd/ws_reinforcedbutwonky.dds\",\"gta3.img/bigshed_sfse.txd/ws_reinforcedbutwonky.dds\",\n \"gta_int.img/kickstart.txd/ws_reinforcedbutwonky.dds\",\"gta3.img/bigshed_sfse.txd/ws_reinforcedbutwonky.dds\",\n \"gta3.img/cetown3cs_t.txd/ws_corr_metal2.dds\",\"gta3.img/bigshed_sfse.txd/ws_corr_metal2.dds\",\n \"gta3.img/conhooses.txd/ws_corr_metal2.dds\",\"gta3.img/bigshed_sfse.txd/ws_corr_metal2.dds\",\n \"gta3.img/crackfactdem_sfs.txd/ws_corr_metal2.dds\",\"gta3.img/bigshed_sfse.txd/ws_corr_metal2.dds\",\n \"gta3.img/crackfact_sfse.txd/ws_corr_metal2.dds\",\"gta3.img/bigshed_sfse.txd/ws_corr_metal2.dds\",\n \"gta3.img/crack_intkb.txd/ws_corr_metal2.dds\",\"gta3.img/bigshed_sfse.txd/ws_corr_metal2.dds\",\n \"gta3.img/cunts_gunclub.txd/ws_corr_metal2.dds\",\"gta3.img/bigshed_sfse.txd/ws_corr_metal2.dds\",\n \"gta3.img/des_gunclub.txd/ws_corr_metal2.dds\",\"gta3.img/bigshed_sfse.txd/ws_corr_metal2.dds\",\n \"gta3.img/sunset01_lawn.txd/ws_corr_metal2.dds\",\"gta3.img/bigshed_sfse.txd/ws_corr_metal2.dds\",\n \"gta3.img/des_gunclub.txd/ws_corr_metal3.dds\",\"gta3.img/bigshed_sfse.txd/ws_corr_metal3.dds\",\n \"gta3.img/des_quarrybits.txd/ws_corr_metal3.dds\",\"gta3.img/bigshed_sfse.txd/ws_corr_metal3.dds\",\n \"gta3.img/des_quarrycrane.txd/ws_corr_metal3.dds\",\"gta3.img/bigshed_sfse.txd/ws_corr_metal3.dds\",\n \"gta3.img/drivingschool_sfse.txd/ws_corr_metal3.dds\",\"gta3.img/bigshed_sfse.txd/ws_corr_metal3.dds\",\n \"gta3.img/pirateship01.txd/ws_corr_metal3.dds\",\"gta3.img/bigshed_sfse.txd/ws_corr_metal3.dds\",\n \"gta3.img/resicarpark.txd/ws_corr_metal3.dds\",\"gta3.img/bigshed_sfse.txd/ws_corr_metal3.dds\",\n \"gta3.img/vgnusedcar.txd/ws_corr_metal3.dds\",\"gta3.img/bigshed_sfse.txd/ws_corr_metal3.dds\",\n \"gta3.img/vgsecarshow.txd/ws_corr_metal3.dds\",\"gta3.img/bigshed_sfse.txd/ws_corr_metal3.dds\",\n \"gta3.img/sw_block10.txd/sw_warewinx4.dds\",\"gta3.img/bigshed_sfse.txd/sw_warewinx4.dds\",\n \"gta3.img/sw_ware01.txd/sw_warewinx4.dds\",\"gta3.img/bigshed_sfse.txd/sw_warewinx4.dds\",\n \"gta3.img/factory_sfse.txd/ws_oldwarehouse9.dds\",\"gta3.img/bigshed_sfse.txd/ws_oldwarehouse9.dds\",\n \"gta3.img/genwhse_sfse.txd/ws_oldwarehouse9.dds\",\"gta3.img/bigshed_sfse.txd/ws_oldwarehouse9.dds\",\n \"gta3.img/factorynewsfse.txd/ws_oldwarehouse1.dds\",\"gta3.img/bigshed_sfse.txd/ws_oldwarehouse1.dds\",\n \"gta3.img/factory_sfse.txd/ws_oldwarehouse1.dds\",\"gta3.img/bigshed_sfse.txd/ws_oldwarehouse1.dds\",\n \"gta3.img/genwhse_sfse.txd/ws_oldwarehouse1.dds\",\"gta3.img/bigshed_sfse.txd/ws_oldwarehouse1.dds\",\n \"gta3.img/genwhse_sfs.txd/ws_oldwarehouse1.dds\",\"gta3.img/bigshed_sfse.txd/ws_oldwarehouse1.dds\",\n \"gta3.img/civic04_lan.txd/forestfloor3.dds\",\"gta3.img/bigwhitesfe.txd/forestfloor3.dds\",\n \"gta3.img/cuntwlandcent.txd/forestfloor3.dds\",\"gta3.img/bigwhitesfe.txd/forestfloor3.dds\",\n \"gta3.img/cuntwlandse.txd/forestfloor3.dds\",\"gta3.img/bigwhitesfe.txd/forestfloor3.dds\",\n \"gta3.img/cuntwlandwest.txd/forestfloor3.dds\",\"gta3.img/bigwhitesfe.txd/forestfloor3.dds\",\n \"gta3.img/laeroads.txd/forestfloor3.dds\",\"gta3.img/bigwhitesfe.txd/forestfloor3.dds\",\n \"gta3.img/sw_well1.txd/forestfloor3.dds\",\"gta3.img/bigwhitesfe.txd/forestfloor3.dds\",\n \"gta_int.img/pdomebar.txd/clubpole_sfw.dds\",\"gta3.img/bigwhitesfe.txd/clubpole_sfw.dds\",\n \"gta_int.img/pleas_dome.txd/clubpole_sfw.dds\",\"gta3.img/bigwhitesfe.txd/clubpole_sfw.dds\",\n \"gta3.img/gazlaw2.txd/bigwhite_4.dds\",\"gta3.img/bigwhitesfe.txd/bigwhite_4.dds\",\n \"gta3.img/boxybld2_sfw.txd/bigwhite_3.dds\",\"gta3.img/bigwhitesfe.txd/bigwhite_3.dds\",\n \"gta3.img/lomall.txd/lomall_ext2_.dds\",\"gta3.img/bigwhitesfe.txd/lomall_ext2_.dds\",\n \"gta3.img/fishwarf.txd/sfe_arch10.dds\",\"gta3.img/bigwhitesfe.txd/sfe_arch10.dds\",\n \"gta3.img/ottos_sfw.txd/sfe_arch10.dds\",\"gta3.img/bigwhitesfe.txd/sfe_arch10.dds\",\n \"gta3.img/sfroofshit.txd/sfe_arch10.dds\",\"gta3.img/bigwhitesfe.txd/sfe_arch10.dds\",\n \"gta3.img/vegascourtbld.txd/liftdoors_kb_256.dds\",\"gta3.img/bigwhitesfe.txd/liftdoors_kb_256.dds\",\n \"gta3.img/vgndwntwn1.txd/liftdoors_kb_256.dds\",\"gta3.img/bigwhitesfe.txd/liftdoors_kb_256.dds\",\n \"gta3.img/vgsnbuild07.txd/liftdoors_kb_256.dds\",\"gta3.img/bigwhitesfe.txd/liftdoors_kb_256.dds\",\n \"gta3.img/posh2_sfe.txd/sfe_arch2.dds\",\"gta3.img/bigwhitesfe.txd/sfe_arch2.dds\",\n \"gta3.img/sfe_park1.txd/sfe_arch2.dds\",\"gta3.img/bigwhitesfe.txd/sfe_arch2.dds\",\n \"gta3.img/bikera.txd/bikera.dds\",\"gta3.img/bikdrug.txd/bikera.dds\",\n \"gta3.img/billbrd.txd/iron.dds\",\"gta3.img/billbox.txd/iron.dds\",\n \"gta3.img/sunset03_law2.txd/iron.dds\",\"gta3.img/billbox.txd/iron.dds\",\n \"gta3.img/jeffers4_lae.txd/billdetaily.dds\",\"gta3.img/billbox.txd/billdetaily.dds\",\n \"gta3.img/rodeo02_law2.txd/billdetaily.dds\",\"gta3.img/billbox.txd/billdetaily.dds\",\n \"gta3.img/billbrd.txd/addwood.dds\",\"gta3.img/billbox.txd/addwood.dds\",\n \"gta3.img/jeffers4_lae.txd/addwood.dds\",\"gta3.img/billbox.txd/addwood.dds\",\n \"gta3.img/vgnshopnmall.txd/hardon_1.dds\",\"gta3.img/billbrd01_lan2.txd/hardon_1.dds\",\n \"gta3.img/stadjunct_sfse.txd/eris_1.dds\",\"gta3.img/billbrd01_lan2.txd/eris_1.dds\",\n \"gta3.img/wiresetc_las.txd/eris_1.dds\",\"gta3.img/billbrd01_lan2.txd/eris_1.dds\",\n \"gta3.img/glenpark7_lae.txd/cokopops_1.dds\",\"gta3.img/billbrd01_lan.txd/cokopops_1.dds\",\n \"gta3.img/golf_sfs.txd/cokopops_1.dds\",\"gta3.img/billbrd01_lan.txd/cokopops_1.dds\",\n \"gta3.img/lawnbillbrd.txd/cokopops_1.dds\",\"gta3.img/billbrd01_lan.txd/cokopops_1.dds\",\n \"gta_int.img/7_11_posters.txd/cokopops_1.dds\",\"gta3.img/billbrd01_lan.txd/cokopops_1.dds\",\n \"gta3.img/lahillsads.txd/heat_02.dds\",\"gta3.img/billbrd01_lan.txd/heat_02.dds\",\n \"gta3.img/vgwstbboard.txd/heat_02.dds\",\"gta3.img/billbrd01_lan.txd/heat_02.dds\",\n \"gta3.img/vgsssignage04.txd/semi2dirty.dds\",\"gta3.img/billbrdlawn.txd/semi2dirty.dds\",\n \"gta3.img/lawnbillbrd.txd/bobobillboard1.dds\",\"gta3.img/billbrdlawn.txd/bobobillboard1.dds\",\n \"gta3.img/melrose11_lawn.txd/bobobillboard1.dds\",\"gta3.img/billbrdlawn.txd/bobobillboard1.dds\",\n \"gta3.img/vgebillboards.txd/bobobillboard1.dds\",\"gta3.img/billbrdlawn.txd/bobobillboard1.dds\",\n \"gta3.img/vgnfrates.txd/bobobillboard1.dds\",\"gta3.img/billbrdlawn.txd/bobobillboard1.dds\",\n \"gta3.img/lae2billboards.txd/semi3dirty.dds\",\"gta3.img/billbrdlawn.txd/semi3dirty.dds\",\n \"gta3.img/stadium_sfse.txd/semi3dirty.dds\",\"gta3.img/billbrdlawn.txd/semi3dirty.dds\",\n \"gta3.img/sunstrans_law2.txd/semi3dirty.dds\",\"gta3.img/billbrdlawn.txd/semi3dirty.dds\",\n \"gta3.img/vgebillboards.txd/semi3dirty.dds\",\"gta3.img/billbrdlawn.txd/semi3dirty.dds\",\n \"gta3.img/vgncorp1.txd/semi3dirty.dds\",\"gta3.img/billbrdlawn.txd/semi3dirty.dds\",\n \"gta3.img/vgwstbboard.txd/semi3dirty.dds\",\"gta3.img/billbrdlawn.txd/semi3dirty.dds\",\n \"gta3.img/vgnusedcar.txd/semi1dirty.dds\",\"gta3.img/billbrdlawn.txd/semi1dirty.dds\",\n \"gta3.img/vgsssignage04.txd/semi1dirty.dds\",\"gta3.img/billbrdlawn.txd/semi1dirty.dds\",\n \"gta3.img/lanlod.txd/heat_02lod.dds\",\"gta3.img/billbrdlod_lan.txd/heat_02lod.dds\",\n \"gta3.img/lanlod.txd/didersachs01lod.dds\",\"gta3.img/billbrdlod_lan.txd/didersachs01lod.dds\",\n \"gta3.img/lod_lan2.txd/didersachs01lod.dds\",\"gta3.img/billbrdlod_lan.txd/didersachs01lod.dds\",\n \"gta3.img/lod2lae1.txd/homies_2lod.dds\",\"gta3.img/billbrdlod_lan.txd/homies_2lod.dds\",\n \"gta3.img/lod_lan2.txd/homies_2lod.dds\",\"gta3.img/billbrdlod_lan.txd/homies_2lod.dds\",\n \"gta3.img/lanlod.txd/eris_2lod.dds\",\"gta3.img/billbrdlod_lan.txd/eris_2lod.dds\",\n \"gta3.img/ce_breweryref.txd/fence1.dds\",\"gta3.img/billbrd.txd/fence1.dds\",\n \"gta3.img/ceroadsigns.txd/fence1.dds\",\"gta3.img/billbrd.txd/fence1.dds\",\n \"gta3.img/coveredpath_sfs.txd/fence1.dds\",\"gta3.img/billbrd.txd/fence1.dds\",\n \"gta3.img/cxref_desert.txd/fence1.dds\",\"gta3.img/billbrd.txd/fence1.dds\",\n \"gta3.img/des_nwtownw.txd/fence1.dds\",\"gta3.img/billbrd.txd/fence1.dds\",\n \"gta3.img/ground2_las2.txd/fence1.dds\",\"gta3.img/billbrd.txd/fence1.dds\",\n \"gta3.img/ground3_las2.txd/fence1.dds\",\"gta3.img/billbrd.txd/fence1.dds\",\n \"gta3.img/ground4_las.txd/fence1.dds\",\"gta3.img/billbrd.txd/fence1.dds\",\n \"gta3.img/ground5_las.txd/fence1.dds\",\"gta3.img/billbrd.txd/fence1.dds\",\n \"gta3.img/imrancomp_las2.txd/fence1.dds\",\"gta3.img/billbrd.txd/fence1.dds\",\n \"gta3.img/lahillstr_lawn.txd/fence1.dds\",\"gta3.img/billbrd.txd/fence1.dds\",\n \"gta3.img/sw_poorhouse.txd/fence1.dds\",\"gta3.img/billbrd.txd/fence1.dds\",\n \"gta3.img/ufo_bar.txd/fence1.dds\",\"gta3.img/billbrd.txd/fence1.dds\",\n \"gta3.img/woodycs_t.txd/fence1.dds\",\"gta3.img/billbrd.txd/fence1.dds\",\n \"gta_int.img/genintwarehsint3.txd/fence1.dds\",\"gta3.img/billbrd.txd/fence1.dds\",\n \"gta_int.img/innertrack.txd/fence1.dds\",\"gta3.img/billbrd.txd/fence1.dds\",\n \"gta_int.img/innertrak.txd/fence1.dds\",\"gta3.img/billbrd.txd/fence1.dds\",\n \"gta3.img/cuntwbtxcs_t.txd/ws_oldpainted2.dds\",\"gta3.img/billbrd.txd/ws_oldpainted2.dds\",\n \"gta3.img/des_bigearstuff.txd/ws_oldpainted2.dds\",\"gta3.img/billbrd.txd/ws_oldpainted2.dds\",\n \"gta3.img/des_damquay.txd/ws_oldpainted2.dds\",\"gta3.img/billbrd.txd/ws_oldpainted2.dds\",\n \"gta3.img/desn2_stud.txd/ws_oldpainted2.dds\",\"gta3.img/billbrd.txd/ws_oldpainted2.dds\",\n \"gta3.img/des_quarrybits.txd/ws_oldpainted2.dds\",\"gta3.img/billbrd.txd/ws_oldpainted2.dds\",\n \"gta3.img/des_quarrycrane.txd/ws_oldpainted2.dds\",\"gta3.img/billbrd.txd/ws_oldpainted2.dds\",\n \"gta3.img/des_stownmain3.txd/ws_oldpainted2.dds\",\"gta3.img/billbrd.txd/ws_oldpainted2.dds\",\n \"gta3.img/des_stownmots1.txd/ws_oldpainted2.dds\",\"gta3.img/billbrd.txd/ws_oldpainted2.dds\",\n \"gta3.img/dockroad_sfse.txd/ws_oldpainted2.dds\",\"gta3.img/billbrd.txd/ws_oldpainted2.dds\",\n \"gta3.img/freeways3_sfse.txd/ws_oldpainted2.dds\",\"gta3.img/billbrd.txd/ws_oldpainted2.dds\",\n \"gta3.img/refinery.txd/ws_oldpainted2.dds\",\"gta3.img/billbrd.txd/ws_oldpainted2.dds\",\n \"gta3.img/roadbridge_sfse.txd/ws_oldpainted2.dds\",\"gta3.img/billbrd.txd/ws_oldpainted2.dds\",\n \"gta3.img/sw_sheds2.txd/ws_oldpainted2.dds\",\"gta3.img/billbrd.txd/ws_oldpainted2.dds\",\n \"gta_int.img/innertrack.txd/ws_oldpainted2.dds\",\"gta3.img/billbrd.txd/ws_oldpainted2.dds\",\n \"gta_int.img/innertrak.txd/ws_oldpainted2.dds\",\"gta3.img/billbrd.txd/ws_oldpainted2.dds\",\n \"gta3.img/sfroadsign.txd/spotlight_64.dds\",\"gta3.img/billbrd.txd/spotlight_64.dds\",\n \"gta_int.img/innertrack.txd/spotlight_64.dds\",\"gta3.img/billbrd.txd/spotlight_64.dds\",\n \"gta_int.img/innertrak.txd/spotlight_64.dds\",\"gta3.img/billbrd.txd/spotlight_64.dds\",\n \"gta3.img/dockcargo1_las.txd/bluemetal02.dds\",\"gta3.img/billbrd.txd/bluemetal02.dds\",\n \"gta3.img/dynpostbx.txd/bluemetal02.dds\",\"gta3.img/billbrd.txd/bluemetal02.dds\",\n \"gta3.img/dynrecycle.txd/bluemetal02.dds\",\"gta3.img/billbrd.txd/bluemetal02.dds\",\n \"gta3.img/factorycuntw.txd/bluemetal02.dds\",\"gta3.img/billbrd.txd/bluemetal02.dds\",\n \"gta3.img/ground3_las2.txd/bluemetal02.dds\",\"gta3.img/billbrd.txd/bluemetal02.dds\",\n \"gta3.img/imrancomp_las2.txd/bluemetal02.dds\",\"gta3.img/billbrd.txd/bluemetal02.dds\",\n \"gta3.img/imstuff_las2.txd/bluemetal02.dds\",\"gta3.img/billbrd.txd/bluemetal02.dds\",\n \"gta3.img/lahillstxd1a.txd/bluemetal02.dds\",\"gta3.img/billbrd.txd/bluemetal02.dds\",\n \"gta3.img/tcenewhillhus02.txd/bluemetal02.dds\",\"gta3.img/billbrd.txd/bluemetal02.dds\",\n \"gta3.img/vgnpwroutbld2.txd/bluemetal02.dds\",\"gta3.img/billbrd.txd/bluemetal02.dds\",\n \"gta3.img/xenon_sfse.txd/bluemetal02.dds\",\"gta3.img/billbrd.txd/bluemetal02.dds\",\n \"gta3.img/k_militx.txd/billdetaily.dds\",\"gta3.img/billbrd.txd/billdetaily.dds\",\n \"gta3.img/sunset03_law2.txd/billdetaily.dds\",\"gta3.img/billbrd.txd/billdetaily.dds\",\n \"gta3.img/sunbill_law2.txd/bboardback.dds\",\"gta3.img/billbrd.txd/bboardback.dds\",\n \"gta3.img/sunset03_law2.txd/bboardback.dds\",\"gta3.img/billbrd.txd/bboardback.dds\",\n \"gta3.img/sunstrans_law2.txd/bboardback.dds\",\"gta3.img/billbrd.txd/bboardback.dds\",\n \"gta3.img/vgnpwrentrnce.txd/bboardback.dds\",\"gta3.img/billbrd.txd/bboardback.dds\",\n \"gta3.img/vgnusedcar.txd/bboardback.dds\",\"gta3.img/billbrd.txd/bboardback.dds\",\n \"gta_int.img/innertrack.txd/bboardback.dds\",\"gta3.img/billbrd.txd/bboardback.dds\",\n \"gta_int.img/innertrak.txd/bboardback.dds\",\"gta3.img/billbrd.txd/bboardback.dds\",\n \"gta3.img/inditaly.txd/vent_64.dds\",\"gta3.img/bistro.txd/vent_64.dds\",\n \"gta3.img/lee_kitch.txd/sw_door11.dds\",\"gta3.img/bistro.txd/sw_door11.dds\",\n \"gta3.img/librest.txd/stainedglass.dds\",\"gta3.img/bistro.txd/stainedglass.dds\",\n \"gta3.img/lee_kitch.txd/plate.dds\",\"gta3.img/bistro.txd/plate.dds\",\n \"gta3.img/librest.txd/panel.dds\",\"gta3.img/bistro.txd/panel.dds\",\n \"gta3.img/hospital2.txd/mp_snow.dds\",\"gta3.img/bistro.txd/mp_snow.dds\",\n \"gta3.img/indhospital.txd/mp_snow.dds\",\"gta3.img/bistro.txd/mp_snow.dds\",\n \"gta3.img/inditaly.txd/mp_snow.dds\",\"gta3.img/bistro.txd/mp_snow.dds\",\n \"gta3.img/indsupasave.txd/mp_snow.dds\",\"gta3.img/bistro.txd/mp_snow.dds\",\n \"gta3.img/indust1.txd/mp_snow.dds\",\"gta3.img/bistro.txd/mp_snow.dds\",\n \"gta3.img/lee_kitch.txd/mp_snow.dds\",\"gta3.img/bistro.txd/mp_snow.dds\",\n \"gta3.img/libertyfar.txd/mp_snow.dds\",\"gta3.img/bistro.txd/mp_snow.dds\",\n \"gta3.img/libertygen.txd/mp_snow.dds\",\"gta3.img/bistro.txd/mp_snow.dds\",\n \"gta3.img/libertyhi3.txd/mp_snow.dds\",\"gta3.img/bistro.txd/mp_snow.dds\",\n \"gta3.img/libertyhi4.txd/mp_snow.dds\",\"gta3.img/bistro.txd/mp_snow.dds\",\n \"gta3.img/libertyhi.txd/mp_snow.dds\",\"gta3.img/bistro.txd/mp_snow.dds\",\n \"gta3.img/snow.txd/mp_snow.dds\",\"gta3.img/bistro.txd/mp_snow.dds\",\n \"gta3.img/inditaly.txd/mottled_grey_64hv.dds\",\"gta3.img/bistro.txd/mottled_grey_64hv.dds\",\n \"gta3.img/lee_kitch.txd/mottled_grey_64hv.dds\",\"gta3.img/bistro.txd/mottled_grey_64hv.dds\",\n \"gta3.img/librest.txd/mottled_grey_64hv.dds\",\"gta3.img/bistro.txd/mottled_grey_64hv.dds\",\n \"gta3.img/libertyhi5.txd/marblekb_256128.dds\",\"gta3.img/bistro.txd/marblekb_256128.dds\",\n \"gta3.img/librest.txd/dinerfloor.dds\",\"gta3.img/bistro.txd/dinerfloor.dds\",\n \"gta3.img/lee_kitch.txd/concretebig3_256.dds\",\"gta3.img/bistro.txd/concretebig3_256.dds\",\n \"gta3.img/libertyhi.txd/concretebig3_256.dds\",\"gta3.img/bistro.txd/concretebig3_256.dds\",\n \"gta3.img/librest.txd/concretebig3_256.dds\",\"gta3.img/bistro.txd/concretebig3_256.dds\",\n \"gta3.img/librest.txd/barbersflr1_la.dds\",\"gta3.img/bistro.txd/barbersflr1_la.dds\",\n \"gta3.img/hotelbackpool_sfs.txd/ws_glass_balustrade.dds\",\"gta3.img/blacksky_sfse.txd/ws_glass_balustrade.dds\",\n \"gta3.img/buildblk55.txd/corporate3.dds\",\"gta3.img/blacksky_sfse.txd/corporate3.dds\",\n \"gta3.img/cw2_photoblockcs_t.txd/corporate3.dds\",\"gta3.img/blacksky_sfse.txd/corporate3.dds\",\n \"gta3.img/des_stownmain1.txd/corporate3.dds\",\"gta3.img/blacksky_sfse.txd/corporate3.dds\",\n \"gta3.img/des_wtownmain.txd/corporate3.dds\",\"gta3.img/blacksky_sfse.txd/corporate3.dds\",\n \"gta3.img/stripshop1.txd/corporate3.dds\",\"gta3.img/blacksky_sfse.txd/corporate3.dds\",\n \"gta3.img/sunrise08_lawn.txd/corporate3.dds\",\"gta3.img/blacksky_sfse.txd/corporate3.dds\",\n \"gta3.img/sunst18_lawn.txd/corporate3.dds\",\"gta3.img/blacksky_sfse.txd/corporate3.dds\",\n \"gta3.img/sw_block04.txd/corporate3.dds\",\"gta3.img/blacksky_sfse.txd/corporate3.dds\",\n \"gta3.img/sw_block06.txd/corporate3.dds\",\"gta3.img/blacksky_sfse.txd/corporate3.dds\",\n \"gta3.img/vgnmall.txd/corporate3.dds\",\"gta3.img/blacksky_sfse.txd/corporate3.dds\",\n \"gta3.img/vgsmall.txd/corporate3.dds\",\"gta3.img/blacksky_sfse.txd/corporate3.dds\",\n \"gta3.img/vgs_stadium.txd/corporate3.dds\",\"gta3.img/blacksky_sfse.txd/corporate3.dds\",\n \"gta3.img/crack_intkb.txd/ws_altz_wall7_top.dds\",\"gta3.img/blacksky_sfse.txd/ws_altz_wall7_top.dds\",\n \"gta3.img/gardencentre_sfs.txd/ws_altz_wall7_top.dds\",\"gta3.img/blacksky_sfse.txd/ws_altz_wall7_top.dds\",\n \"gta3.img/eastlstr_lae2.txd/des_indrails.dds\",\"gta3.img/blackwestran1_lae2.txd/des_indrails.dds\",\n \"gta3.img/laealpha.txd/des_indrails.dds\",\"gta3.img/blackwestran1_lae2.txd/des_indrails.dds\",\n \"gta3.img/mulveg2lahills.txd/des_indrails.dds\",\"gta3.img/blackwestran1_lae2.txd/des_indrails.dds\",\n \"gta3.img/oldwest.txd/des_indrails.dds\",\"gta3.img/blackwestran1_lae2.txd/des_indrails.dds\",\n \"gta3.img/savanna2.txd/savanna92body256b.dds\",\"gta3.img/blade2.txd/blade92body256b.dds\",\n \"gta3.img/bloodra.txd/glendale92wheel64.dds\",\"gta3.img/blade.txd/blade92wheel64.dds\",\n \"gta3.img/broadway.txd/broadway92wheel64.dds\",\"gta3.img/blade.txd/blade92wheel64.dds\",\n \"gta3.img/cabbie.txd/cabbie92wheel64.dds\",\"gta3.img/blade.txd/blade92wheel64.dds\",\n \"gta3.img/glendale.txd/blade92wheel64.dds\",\"gta3.img/blade.txd/blade92wheel64.dds\",\n \"gta3.img/hermes.txd/blade92wheel64.dds\",\"gta3.img/blade.txd/blade92wheel64.dds\",\n \"gta3.img/hustler.txd/blade92wheel64.dds\",\"gta3.img/blade.txd/blade92wheel64.dds\",\n \"gta3.img/oceanic.txd/blade92wheel64.dds\",\"gta3.img/blade.txd/blade92wheel64.dds\",\n \"gta3.img/voodoo.txd/voodoo92wheel64.dds\",\"gta3.img/blade.txd/blade92wheel64.dds\",\n \"gta3.img/emperor.txd/stafford92interior128.dds\",\"gta3.img/blistac.txd/blistac92interior128.dds\",\n \"gta3.img/stafford.txd/stafford92interior128.dds\",\"gta3.img/blistac.txd/blistac92interior128.dds\",\n \"gta3.img/supergt.txd/stafford92interior128.dds\",\"gta3.img/blistac.txd/blistac92interior128.dds\",\n \"gta3.img/turismo.txd/stafford92interior128.dds\",\"gta3.img/blistac.txd/blistac92interior128.dds\",\n \"gta3.img/willard.txd/willard92interior128.dds\",\"gta3.img/blistac.txd/blistac92interior128.dds\",\n \"gta3.img/kbgarage_las.txd/tatty_wood_1.dds\",\"gta3.img/blkbrdx.txd/tatty_wood_1.dds\",\n \"gta3.img/lasground2_las2.txd/tatty_wood_1.dds\",\"gta3.img/blkbrdx.txd/tatty_wood_1.dds\",\n \"gta_int.img/gf4.txd/tatty_wood_1.dds\",\"gta3.img/blkbrdx.txd/tatty_wood_1.dds\",\n \"gta3.img/nucarpark.txd/duskyred_64.dds\",\"gta3.img/blockalpha.txd/duskyred_64.dds\",\n \"gta3.img/burnsground.txd/lightwallv256.dds\",\"gta3.img/blokmodb.txd/lightwallv256.dds\",\n \"gta3.img/cunte_blockammo.txd/lightwallv256.dds\",\"gta3.img/blokmodb.txd/lightwallv256.dds\",\n \"gta3.img/bombshop_las.txd/bow_grimebrick.dds\",\"gta3.img/blokmodb.txd/bow_grimebrick.dds\",\n \"gta3.img/bombshop_sfe.txd/bow_grimebrick.dds\",\"gta3.img/blokmodb.txd/bow_grimebrick.dds\",\n \"gta3.img/des_gunclub.txd/bow_grimebrick.dds\",\"gta3.img/blokmodb.txd/bow_grimebrick.dds\",\n \"gta3.img/lasraodnshops.txd/bow_grimebrick.dds\",\"gta3.img/blokmodb.txd/bow_grimebrick.dds\",\n \"gta3.img/sw_apartflat5.txd/bow_grimebrick.dds\",\"gta3.img/blokmodb.txd/bow_grimebrick.dds\",\n \"gta3.img/sw_block11a.txd/bow_grimebrick.dds\",\"gta3.img/blokmodb.txd/bow_grimebrick.dds\",\n \"gta3.img/sw_roadgas.txd/bow_grimebrick.dds\",\"gta3.img/blokmodb.txd/bow_grimebrick.dds\",\n \"gta3.img/vgnfirestat.txd/bow_grimebrick.dds\",\"gta3.img/blokmodb.txd/bow_grimebrick.dds\",\n \"gta3.img/vgnretail3.txd/bow_grimebrick.dds\",\"gta3.img/blokmodb.txd/bow_grimebrick.dds\",\n \"gta3.img/carshow_sfse.txd/alleywin4.dds\",\"gta3.img/blokmodb.txd/alleywin4.dds\",\n \"gta3.img/cuntwbt.txd/alleywin4.dds\",\"gta3.img/blokmodb.txd/alleywin4.dds\",\n \"gta3.img/desn2_peckers.txd/alleywin4.dds\",\"gta3.img/blokmodb.txd/alleywin4.dds\",\n \"gta3.img/des_stownmain3.txd/alleywin4.dds\",\"gta3.img/blokmodb.txd/alleywin4.dds\",\n \"gta3.img/vegasairprtland.txd/alleywin4.dds\",\"gta3.img/blokmodb.txd/alleywin4.dds\",\n \"gta3.img/vgsswarhse04.txd/alleywin4.dds\",\"gta3.img/blokmodb.txd/alleywin4.dds\",\n \"gta3.img/vgnretail2.txd/bincosign1_128.dds\",\"gta3.img/blokmodb.txd/bincosign1_128.dds\",\n \"gta3.img/boxybld_sfw.txd/grass.dds\",\"gta3.img/blokmodb.txd/grass.dds\",\n \"gta3.img/eastbeach2a_lae2.txd/grass.dds\",\"gta3.img/blokmodb.txd/grass.dds\",\n \"gta3.img/flmngoland.txd/grass.dds\",\"gta3.img/blokmodb.txd/grass.dds\",\n \"gta3.img/hashhouses1_sfs.txd/grass.dds\",\"gta3.img/blokmodb.txd/grass.dds\",\n \"gta3.img/hospital_lae.txd/grass.dds\",\"gta3.img/blokmodb.txd/grass.dds\",\n \"gta3.img/lae2roadscoast.txd/grass.dds\",\"gta3.img/blokmodb.txd/grass.dds\",\n \"gta3.img/mall_law.txd/grass.dds\",\"gta3.img/blokmodb.txd/grass.dds\",\n \"gta3.img/sfe_park1.txd/grass.dds\",\"gta3.img/blokmodb.txd/grass.dds\",\n \"gta3.img/sw_brewery.txd/grass.dds\",\"gta3.img/blokmodb.txd/grass.dds\",\n \"gta3.img/vegashse2.txd/grass.dds\",\"gta3.img/blokmodb.txd/grass.dds\",\n \"gta3.img/vegashse8.txd/grass.dds\",\"gta3.img/blokmodb.txd/grass.dds\",\n \"gta3.img/vgesvhouse01.txd/grass.dds\",\"gta3.img/blokmodb.txd/grass.dds\",\n \"gta3.img/vgwsavehses.txd/grass.dds\",\"gta3.img/blokmodb.txd/grass.dds\",\n \"gta3.img/vict_sfw.txd/grass.dds\",\"gta3.img/blokmodb.txd/grass.dds\",\n \"gta3.img/wddngchplgrnd01.txd/grass.dds\",\"gta3.img/blokmodb.txd/grass.dds\",\n \"gta3.img/boxybld_sfw.txd/sf_garagedr1.dds\",\"gta3.img/blokmodb.txd/sf_garagedr1.dds\",\n \"gta3.img/law_beach2.txd/sf_garagedr1.dds\",\"gta3.img/blokmodb.txd/sf_garagedr1.dds\",\n \"gta3.img/lombard.txd/sf_garagedr1.dds\",\"gta3.img/blokmodb.txd/sf_garagedr1.dds\",\n \"gta3.img/boxybld_sfw.txd/lombard_build1_1.dds\",\"gta3.img/blokmodb.txd/lombard_build1_1.dds\",\n \"gta3.img/lombard.txd/lombard_build1_1.dds\",\"gta3.img/blokmodb.txd/lombard_build1_1.dds\",\n \"gta3.img/boxybld_sfw.txd/lombard_build1_4.dds\",\"gta3.img/blokmodb.txd/lombard_build1_4.dds\",\n \"gta3.img/lombard.txd/lombard_build1_4.dds\",\"gta3.img/blokmodb.txd/lombard_build1_4.dds\",\n \"gta3.img/vict_sfw.txd/lombard_build1_4.dds\",\"gta3.img/blokmodb.txd/lombard_build1_4.dds\",\n \"gta3.img/lombard.txd/lombard_build1_2.dds\",\"gta3.img/blokmodb.txd/lombard_build1_2.dds\",\n \"gta3.img/fescape2_sfe.txd/fireescape1_sfe.dds\",\"gta3.img/blokmodb.txd/fireescape1_sfe.dds\",\n \"gta3.img/fescape3_sfe.txd/fireescape1_sfe.dds\",\"gta3.img/blokmodb.txd/fireescape1_sfe.dds\",\n \"gta3.img/fescape_sfe.txd/fireescape1_sfe.dds\",\"gta3.img/blokmodb.txd/fireescape1_sfe.dds\",\n \"gta3.img/fescap_sfs.txd/fireescape1_sfe.dds\",\"gta3.img/blokmodb.txd/fireescape1_sfe.dds\",\n \"gta3.img/fescap_sfw.txd/fireescape1_sfe.dds\",\"gta3.img/blokmodb.txd/fireescape1_sfe.dds\",\n \"gta3.img/ggatepark.txd/fireescape1_sfe.dds\",\"gta3.img/blokmodb.txd/fireescape1_sfe.dds\",\n \"gta3.img/lae2coast_alpha.txd/fireescape1_sfe.dds\",\"gta3.img/blokmodb.txd/fireescape1_sfe.dds\",\n \"gta3.img/lan2_alphas.txd/fireescape1_sfe.dds\",\"gta3.img/blokmodb.txd/fireescape1_sfe.dds\",\n \"gta3.img/sunset1alp_lan2.txd/fireescape1_sfe.dds\",\"gta3.img/blokmodb.txd/fireescape1_sfe.dds\",\n \"gta3.img/bluebr.txd/blue2.dds\",\"gta3.img/bluebl.txd/blue2.dds\",\n \"gta3.img/bmydrug.txd/neckcross.dds\",\"gta3.img/bmycr.txd/neckcross.dds\",\n \"gta3.img/hmycr.txd/neckcross.dds\",\"gta3.img/bmycr.txd/neckcross.dds\",\n \"gta3.img/hmydrug.txd/neckcross.dds\",\"gta3.img/bmycr.txd/neckcross.dds\",\n \"gta3.img/lsv3.txd/neckcross.dds\",\"gta3.img/bmycr.txd/neckcross.dds\",\n \"gta3.img/sfr2.txd/neckcross.dds\",\"gta3.img/bmycr.txd/neckcross.dds\",\n \"gta3.img/vla2.txd/neckcross.dds\",\"gta3.img/bmycr.txd/neckcross.dds\",\n \"gta3.img/vla3.txd/neckcross.dds\",\"gta3.img/bmycr.txd/neckcross.dds\",\n \"gta3.img/wmycr.txd/neckcross.dds\",\"gta3.img/bmycr.txd/neckcross.dds\",\n \"gta3.img/fam3.txd/neckcross.dds\",\"gta3.img/bmydj.txd/neckcross.dds\",\n \"gta3.img/boxburg.txd/boxville92wheel64.dds\",\"gta3.img/bobcat.txd/bobcat92wheel64.dds\",\n \"gta3.img/boxville.txd/boxville92wheel64.dds\",\"gta3.img/bobcat.txd/bobcat92wheel64.dds\",\n \"gta3.img/hotdog.txd/hotdog92wheel64.dds\",\"gta3.img/bobcat.txd/bobcat92wheel64.dds\",\n \"gta3.img/moonbeam.txd/bobcat92wheel64.dds\",\"gta3.img/bobcat.txd/bobcat92wheel64.dds\",\n \"gta3.img/mrwhoop.txd/mrwhoo92wheel64.dds\",\"gta3.img/bobcat.txd/bobcat92wheel64.dds\",\n \"gta3.img/utiltr1.txd/utiltr192wheel64.dds\",\"gta3.img/bobcat.txd/bobcat92wheel64.dds\",\n \"gta3.img/walton.txd/walton92wheel64.dds\",\"gta3.img/bobcat.txd/bobcat92wheel64.dds\",\n \"gta3.img/yankee.txd/yankee92wheel64.dds\",\"gta3.img/bobcat.txd/bobcat92wheel64.dds\",\n \"gta3.img/boigas_sfw.txd/burgershotmenu256.dds\",\"gta3.img/boigas_sfe.txd/burgershotmenu256.dds\",\n \"gta3.img/bs_sfs.txd/burgershotmenu256.dds\",\"gta3.img/boigas_sfe.txd/burgershotmenu256.dds\",\n \"gta3.img/burgsh01_law.txd/burgershotmenu256.dds\",\"gta3.img/boigas_sfe.txd/burgershotmenu256.dds\",\n \"gta3.img/lawnburg.txd/burgershotmenu256.dds\",\"gta3.img/boigas_sfe.txd/burgershotmenu256.dds\",\n \"gta3.img/lawnshite2n.txd/burgershotmenu256.dds\",\"gta3.img/boigas_sfe.txd/burgershotmenu256.dds\",\n \"gta3.img/vgnboiga1.txd/burgershotmenu256.dds\",\"gta3.img/boigas_sfe.txd/burgershotmenu256.dds\",\n \"gta3.img/vgwestboiga1.txd/burgershotmenu256.dds\",\"gta3.img/boigas_sfe.txd/burgershotmenu256.dds\",\n \"gta3.img/boigas_sfw.txd/burgershotsign1_256.dds\",\"gta3.img/boigas_sfe.txd/burgershotsign1_256.dds\",\n \"gta3.img/bs_sfs.txd/burgershotsign1_256.dds\",\"gta3.img/boigas_sfe.txd/burgershotsign1_256.dds\",\n \"gta3.img/burgsh01_law.txd/burgershotsign1_256.dds\",\"gta3.img/boigas_sfe.txd/burgershotsign1_256.dds\",\n \"gta3.img/lawnburg.txd/burgershotsign1_256.dds\",\"gta3.img/boigas_sfe.txd/burgershotsign1_256.dds\",\n \"gta3.img/lawnshite2n.txd/burgershotsign1_256.dds\",\"gta3.img/boigas_sfe.txd/burgershotsign1_256.dds\",\n \"gta3.img/vgnboiga1.txd/burgershotsign1_256.dds\",\"gta3.img/boigas_sfe.txd/burgershotsign1_256.dds\",\n \"gta3.img/vgwestboiga1.txd/burgershotsign1_256.dds\",\"gta3.img/boigas_sfe.txd/burgershotsign1_256.dds\",\n \"gta3.img/boigas_sfw.txd/vgnburger_256.dds\",\"gta3.img/boigas_sfe.txd/vgnburger_256.dds\",\n \"gta3.img/bs_sfs.txd/vgnburger_256.dds\",\"gta3.img/boigas_sfe.txd/vgnburger_256.dds\",\n \"gta3.img/burgsh01_law.txd/vgnburger_256.dds\",\"gta3.img/boigas_sfe.txd/vgnburger_256.dds\",\n \"gta3.img/lawnburg.txd/vgnburger_256.dds\",\"gta3.img/boigas_sfe.txd/vgnburger_256.dds\",\n \"gta3.img/vgnboiga1.txd/vgnburger_256.dds\",\"gta3.img/boigas_sfe.txd/vgnburger_256.dds\",\n \"gta3.img/vgwestboiga1.txd/vgnburger_256.dds\",\"gta3.img/boigas_sfe.txd/vgnburger_256.dds\",\n \"gta3.img/calfed_sfe.txd/calfederal5.dds\",\"gta3.img/boigas_sfw.txd/calfederal5.dds\",\n \"gta3.img/fishwarf.txd/calfederal5.dds\",\"gta3.img/boigas_sfw.txd/calfederal5.dds\",\n \"gta3.img/tunnel_sfe.txd/calfederal5.dds\",\"gta3.img/boigas_sfw.txd/calfederal5.dds\",\n \"gta3.img/calfed_sfe.txd/calfederal4.dds\",\"gta3.img/boigas_sfw.txd/calfederal4.dds\",\n \"gta3.img/sfvictorian.txd/calfederal4.dds\",\"gta3.img/boigas_sfw.txd/calfederal4.dds\",\n \"gta3.img/slapart01sfe.txd/calfederal4.dds\",\"gta3.img/boigas_sfw.txd/calfederal4.dds\",\n \"gta3.img/tunnel_sfe.txd/calfederal4.dds\",\"gta3.img/boigas_sfw.txd/calfederal4.dds\",\n \"gta3.img/bs_sfs.txd/vgnburgwal1_128.dds\",\"gta3.img/boigas_sfw.txd/vgnburgwal1_128.dds\",\n \"gta3.img/lawnabv.txd/vgnburgwal1_128.dds\",\"gta3.img/boigas_sfw.txd/vgnburgwal1_128.dds\",\n \"gta3.img/lawnburg.txd/vgnburgwal1_128.dds\",\"gta3.img/boigas_sfw.txd/vgnburgwal1_128.dds\",\n \"gta3.img/vegasbuild.txd/vgnburgwal1_128.dds\",\"gta3.img/boigas_sfw.txd/vgnburgwal1_128.dds\",\n \"gta3.img/vgnboiga1.txd/vgnburgwal1_128.dds\",\"gta3.img/boigas_sfw.txd/vgnburgwal1_128.dds\",\n \"gta3.img/vgndwntwn23.txd/vgnburgwal1_128.dds\",\"gta3.img/boigas_sfw.txd/vgnburgwal1_128.dds\",\n \"gta3.img/vgwestboiga1.txd/vgnburgwal1_128.dds\",\"gta3.img/boigas_sfw.txd/vgnburgwal1_128.dds\",\n \"gta3.img/bs_sfs.txd/vgnburgwal6_256.dds\",\"gta3.img/boigas_sfw.txd/vgnburgwal6_256.dds\",\n \"gta3.img/lawnburg.txd/vgnburgwal6_256.dds\",\"gta3.img/boigas_sfw.txd/vgnburgwal6_256.dds\",\n \"gta3.img/vgnboiga1.txd/vgnburgwal6_256.dds\",\"gta3.img/boigas_sfw.txd/vgnburgwal6_256.dds\",\n \"gta3.img/vgwestboiga1.txd/vgnburgwal6_256.dds\",\"gta3.img/boigas_sfw.txd/vgnburgwal6_256.dds\",\n \"gta3.img/bs_sfs.txd/vgnburgwal2_128.dds\",\"gta3.img/boigas_sfw.txd/vgnburgwal2_128.dds\",\n \"gta3.img/cluckbell_sfs.txd/vgnburgwal2_128.dds\",\"gta3.img/boigas_sfw.txd/vgnburgwal2_128.dds\",\n \"gta3.img/lawnburg.txd/vgnburgwal2_128.dds\",\"gta3.img/boigas_sfw.txd/vgnburgwal2_128.dds\",\n \"gta3.img/vgwestboiga1.txd/vgnburgwal2_128.dds\",\"gta3.img/boigas_sfw.txd/vgnburgwal2_128.dds\",\n \"gta3.img/bs_sfs.txd/gewhite1_64.dds\",\"gta3.img/boigas_sfw.txd/gewhite1_64.dds\",\n \"gta3.img/hashblock1_sfs.txd/gewhite1_64.dds\",\"gta3.img/boigas_sfw.txd/gewhite1_64.dds\",\n \"gta3.img/hubint2.txd/gewhite1_64.dds\",\"gta3.img/boigas_sfw.txd/gewhite1_64.dds\",\n \"gta3.img/lawnburg.txd/gewhite1_64.dds\",\"gta3.img/boigas_sfw.txd/gewhite1_64.dds\",\n \"gta3.img/ufo_bar.txd/gewhite1_64.dds\",\"gta3.img/boigas_sfw.txd/gewhite1_64.dds\",\n \"gta3.img/vgngebuild.txd/gewhite1_64.dds\",\"gta3.img/boigas_sfw.txd/gewhite1_64.dds\",\n \"gta3.img/vgnlpost.txd/gewhite1_64.dds\",\"gta3.img/boigas_sfw.txd/gewhite1_64.dds\",\n \"gta3.img/vgwestboiga1.txd/gewhite1_64.dds\",\"gta3.img/boigas_sfw.txd/gewhite1_64.dds\",\n \"gta3.img/bombshop_sfe.txd/dynobox.dds\",\"gta3.img/bombshop_las.txd/dynobox.dds\",\n \"gta3.img/vgnretail3.txd/dynobox.dds\",\"gta3.img/bombshop_las.txd/dynobox.dds\",\n \"gta3.img/bombshop_sfe.txd/shutterclosed_law.dds\",\"gta3.img/bombshop_las.txd/shutterclosed_law.dds\",\n \"gta3.img/vgnretail3.txd/shutterclosed_law.dds\",\"gta3.img/bombshop_las.txd/shutterclosed_law.dds\",\n \"gta3.img/bombshop_sfe.txd/lightcover1.dds\",\"gta3.img/bombshop_las.txd/lightcover1.dds\",\n \"gta3.img/vgnretail3.txd/lightcover1.dds\",\"gta3.img/bombshop_las.txd/lightcover1.dds\",\n \"gta3.img/bombshop_sfe.txd/kb_spray_light1.dds\",\"gta3.img/bombshop_las.txd/kb_spray_light1.dds\",\n \"gta3.img/vgnretail3.txd/kb_spray_light1.dds\",\"gta3.img/bombshop_las.txd/kb_spray_light1.dds\",\n \"gta3.img/bombshop_sfe.txd/greymetal.dds\",\"gta3.img/bombshop_las.txd/greymetal.dds\",\n \"gta3.img/corvinsign_sfse.txd/greymetal.dds\",\"gta3.img/bombshop_las.txd/greymetal.dds\",\n \"gta3.img/countrys.txd/greymetal.dds\",\"gta3.img/bombshop_las.txd/greymetal.dds\",\n \"gta3.img/cw2_photoblockcs_t.txd/greymetal.dds\",\"gta3.img/bombshop_las.txd/greymetal.dds\",\n \"gta3.img/frieghter2sfe.txd/greymetal.dds\",\"gta3.img/bombshop_las.txd/greymetal.dds\",\n \"gta3.img/vgnretail3.txd/greymetal.dds\",\"gta3.img/bombshop_las.txd/greymetal.dds\",\n \"gta3.img/vgnretail3.txd/calendar01.dds\",\"gta3.img/bombshop_sfe.txd/calendar01.dds\",\n \"gta3.img/des_ufoinn.txd/bonyrd_skin1.dds\",\"gta3.img/boneyard.txd/bonyrd_skin1.dds\",\n \"gta3.img/boxville.txd/boxville92interior128.dds\",\"gta3.img/boxburg.txd/boxville92interior128.dds\",\n \"gta3.img/duneride.txd/dunerider92interior128.dds\",\"gta3.img/boxburg.txd/boxville92interior128.dds\",\n \"gta3.img/lashops1b_las2.txd/crate128.dds\",\"gta3.img/boxes.txd/crate128.dds\",\n \"gta3.img/vgssairport.txd/crate128.dds\",\"gta3.img/boxes.txd/crate128.dds\",\n \"gta3.img/cj_box1.txd/cardboxes_128.dds\",\"gta3.img/boxes.txd/cardboxes_128.dds\",\n \"gta3.img/cm_bxx.txd/cardboxes_128.dds\",\"gta3.img/boxes.txd/cardboxes_128.dds\",\n \"gta3.img/cunte_gas01.txd/cardboxes_128.dds\",\"gta3.img/boxes.txd/cardboxes_128.dds\",\n \"gta3.img/hubint2.txd/cardboxes_128.dds\",\"gta3.img/boxes.txd/cardboxes_128.dds\",\n \"gta3.img/k_boxes.txd/cardboxes_128.dds\",\"gta3.img/boxes.txd/cardboxes_128.dds\",\n \"gta3.img/laesmokecuts.txd/cardboxes_128.dds\",\"gta3.img/boxes.txd/cardboxes_128.dds\",\n \"gta3.img/smash_bxx.txd/cardboxes_128.dds\",\"gta3.img/boxes.txd/cardboxes_128.dds\",\n \"gta_int.img/genintintcarint3.txd/cardboxes_128.dds\",\"gta3.img/boxes.txd/cardboxes_128.dds\",\n \"gta_int.img/genintintgarage2.txd/cardboxes_128.dds\",\"gta3.img/boxes.txd/cardboxes_128.dds\",\n \"gta_int.img/genintintgarage3b.txd/cardboxes_128.dds\",\"gta3.img/boxes.txd/cardboxes_128.dds\",\n \"gta3.img/sw_poorhouse.txd/sw_barnwoodblu.dds\",\"gta3.img/boxhses_sfsx.txd/sw_barnwoodblu.dds\",\n \"gta3.img/w_town3cs_t.txd/sw_barnwoodblu.dds\",\"gta3.img/boxhses_sfsx.txd/sw_barnwoodblu.dds\",\n \"gta3.img/hashblock2_sfs.txd/ws_garagedoor2_blue.dds\",\"gta3.img/boxhses_sfsx.txd/ws_garagedoor2_blue.dds\",\n \"gta3.img/hillhousex13_6.txd/ws_garagedoor2_blue.dds\",\"gta3.img/boxhses_sfsx.txd/ws_garagedoor2_blue.dds\",\n \"gta3.img/vgesvhouse01.txd/ws_garagedoor2_blue.dds\",\"gta3.img/boxhses_sfsx.txd/ws_garagedoor2_blue.dds\",\n \"gta3.img/vgwsavehses.txd/ws_garagedoor2_blue.dds\",\"gta3.img/boxhses_sfsx.txd/ws_garagedoor2_blue.dds\",\n \"gta3.img/melrose02_lawn.txd/labluewall.dds\",\"gta3.img/boxhses_sfsx.txd/labluewall.dds\",\n \"gta3.img/melrose08_lawn.txd/labluewall.dds\",\"gta3.img/boxhses_sfsx.txd/labluewall.dds\",\n \"gta3.img/sanclifbal1_lax.txd/labluewall.dds\",\"gta3.img/boxhses_sfsx.txd/labluewall.dds\",\n \"gta3.img/sancliff02_law2.txd/labluewall.dds\",\"gta3.img/boxhses_sfsx.txd/labluewall.dds\",\n \"gta3.img/stadium_lae2.txd/labluewall.dds\",\"gta3.img/boxhses_sfsx.txd/labluewall.dds\",\n \"gta3.img/sunrise11_lawn.txd/labluewall.dds\",\"gta3.img/boxhses_sfsx.txd/labluewall.dds\",\n \"gta3.img/sunset04_law2.txd/labluewall.dds\",\"gta3.img/boxhses_sfsx.txd/labluewall.dds\",\n \"gta_int.img/genintintbarb.txd/labluewall.dds\",\"gta3.img/boxhses_sfsx.txd/labluewall.dds\",\n \"gta3.img/lawland2.txd/stonewall_la.dds\",\"gta3.img/boxhses_sfsx.txd/stonewall_la.dds\",\n \"gta3.img/oc_flats_gnd_sfs.txd/stonewall_la.dds\",\"gta3.img/boxhses_sfsx.txd/stonewall_la.dds\",\n \"gta3.img/tikimotel.txd/stonewall_la.dds\",\"gta3.img/boxhses_sfsx.txd/stonewall_la.dds\",\n \"gta3.img/venice_law.txd/stonewall_la.dds\",\"gta3.img/boxhses_sfsx.txd/stonewall_la.dds\",\n \"gta3.img/ext_doors.txd/ws_painted_doors1.dds\",\"gta3.img/boxhses_sfsx.txd/ws_painted_doors1.dds\",\n \"gta3.img/gazsfn1.txd/ws_painted_doors1.dds\",\"gta3.img/boxhses_sfsx.txd/ws_painted_doors1.dds\",\n \"gta3.img/law_beach2.txd/ws_painted_doors1.dds\",\"gta3.img/boxhses_sfsx.txd/ws_painted_doors1.dds\",\n \"gta3.img/vgnretail3.txd/hilcouwall1.dds\",\"gta3.img/boxhses_sfsx.txd/hilcouwall1.dds\",\n \"gta3.img/vgnretail4.txd/hilcouwall1.dds\",\"gta3.img/boxhses_sfsx.txd/hilcouwall1.dds\",\n \"gta3.img/vgnretail7.txd/hilcouwall1.dds\",\"gta3.img/boxhses_sfsx.txd/hilcouwall1.dds\",\n \"gta3.img/melrose02_lawn.txd/lagreenwall.dds\",\"gta3.img/boxhses_sfsx.txd/lagreenwall.dds\",\n \"gta3.img/melrose19_lawn.txd/lagreenwall.dds\",\"gta3.img/boxhses_sfsx.txd/lagreenwall.dds\",\n \"gta3.img/rodeo02_law2.txd/lagreenwall.dds\",\"gta3.img/boxhses_sfsx.txd/lagreenwall.dds\",\n \"gta3.img/sunset04_law2.txd/lagreenwall.dds\",\"gta3.img/boxhses_sfsx.txd/lagreenwall.dds\",\n \"gta3.img/vgnretail6.txd/lagreenwall.dds\",\"gta3.img/boxhses_sfsx.txd/lagreenwall.dds\",\n \"gta3.img/des_stownmain2.txd/ws_green_wall1.dds\",\"gta3.img/boxhses_sfsx.txd/ws_green_wall1.dds\",\n \"gta3.img/eastbeach4a_lae2.txd/ws_green_wall1.dds\",\"gta3.img/boxhses_sfsx.txd/ws_green_wall1.dds\",\n \"gta3.img/lae2grnd.txd/ws_garagedoor2_white.dds\",\"gta3.img/boxhses_sfsx.txd/ws_garagedoor2_white.dds\",\n \"gta3.img/sfn_apart02sfn.txd/ws_garagedoor2_white.dds\",\"gta3.img/boxhses_sfsx.txd/ws_garagedoor2_white.dds\",\n \"gta3.img/vegashse3.txd/ws_garagedoor2_white.dds\",\"gta3.img/boxhses_sfsx.txd/ws_garagedoor2_white.dds\",\n \"gta3.img/vegashse7.txd/ws_garagedoor2_white.dds\",\"gta3.img/boxhses_sfsx.txd/ws_garagedoor2_white.dds\",\n \"gta3.img/vegassvehse7.txd/ws_garagedoor2_white.dds\",\"gta3.img/boxhses_sfsx.txd/ws_garagedoor2_white.dds\",\n \"gta3.img/presidio01_sfn.txd/ws_wood_doors2.dds\",\"gta3.img/boxhses_sfsx.txd/ws_wood_doors2.dds\",\n \"gta3.img/sw_church.txd/ws_wood_doors2.dds\",\"gta3.img/boxhses_sfsx.txd/ws_wood_doors2.dds\",\n \"gta3.img/ce_burbhouse.txd/ws_vic_wood1.dds\",\"gta3.img/boxhses_sfsx.txd/ws_vic_wood1.dds\",\n \"gta3.img/ce_pizza.txd/ws_vic_wood1.dds\",\"gta3.img/boxhses_sfsx.txd/ws_vic_wood1.dds\",\n \"gta3.img/cunte_house1.txd/ws_vic_wood1.dds\",\"gta3.img/boxhses_sfsx.txd/ws_vic_wood1.dds\",\n \"gta3.img/pierc_law2.txd/ws_vic_wood1.dds\",\"gta3.img/boxhses_sfsx.txd/ws_vic_wood1.dds\",\n \"gta3.img/sw_block11.txd/ws_vic_wood1.dds\",\"gta3.img/boxhses_sfsx.txd/ws_vic_wood1.dds\",\n \"gta3.img/sw_church.txd/ws_vic_wood1.dds\",\"gta3.img/boxhses_sfsx.txd/ws_vic_wood1.dds\",\n \"gta3.img/desn2_stud.txd/ws_pink_wall1.dds\",\"gta3.img/boxhses_sfsx.txd/ws_pink_wall1.dds\",\n \"gta3.img/pinkcarpark_sfs.txd/ws_pink_wall1.dds\",\"gta3.img/boxhses_sfsx.txd/ws_pink_wall1.dds\",\n \"gta3.img/docg01_lahills.txd/ws_garagedoor3_pink.dds\",\"gta3.img/boxhses_sfsx.txd/ws_garagedoor3_pink.dds\",\n \"gta3.img/vegashse5.txd/ws_garagedoor3_pink.dds\",\"gta3.img/boxhses_sfsx.txd/ws_garagedoor3_pink.dds\",\n \"gta3.img/vgnbball.txd/ws_garagedoor3_pink.dds\",\"gta3.img/boxhses_sfsx.txd/ws_garagedoor3_pink.dds\",\n \"gta3.img/des_ranch.txd/ws_wood_doors1.dds\",\"gta3.img/boxhses_sfsx.txd/ws_wood_doors1.dds\",\n \"gta3.img/ext_doors.txd/ws_painted_doors2.dds\",\"gta3.img/boxhses_sfsx.txd/ws_painted_doors2.dds\",\n \"gta3.img/ce_burbhouse.txd/tanboard1.dds\",\"gta3.img/boxhses_sfsx.txd/tanboard1.dds\",\n \"gta3.img/compapart_la.txd/tanboard1.dds\",\"gta3.img/boxhses_sfsx.txd/tanboard1.dds\",\n \"gta3.img/vegasemulticar.txd/ws_mixedbrick.dds\",\"gta3.img/boxhses_sfsx.txd/ws_mixedbrick.dds\",\n \"gta3.img/vgssairportcpark.txd/ws_mixedbrick.dds\",\"gta3.img/boxhses_sfsx.txd/ws_mixedbrick.dds\",\n \"gta3.img/vgwestland.txd/ws_mixedbrick.dds\",\"gta3.img/boxhses_sfsx.txd/ws_mixedbrick.dds\",\n \"gta3.img/sfn_apart02sfn.txd/ws_garagedoor3_green.dds\",\"gta3.img/boxhses_sfsx.txd/ws_garagedoor3_green.dds\",\n \"gta3.img/lae2grnd.txd/ws_boxhouse_wins5.dds\",\"gta3.img/boxhses_sfsx.txd/ws_boxhouse_wins5.dds\",\n \"gta3.img/w_town3cs_t.txd/ws_boxhouse_wins5.dds\",\"gta3.img/boxhses_sfsx.txd/ws_boxhouse_wins5.dds\",\n \"gta3.img/des_ranch.txd/ws_doorframe.dds\",\"gta3.img/boxhses_sfsx.txd/ws_doorframe.dds\",\n \"gta3.img/mulhouslahills.txd/lacreamwall1.dds\",\"gta3.img/boxhses_sfsx.txd/lacreamwall1.dds\",\n \"gta3.img/sw_block11a.txd/lacreamwall1.dds\",\"gta3.img/boxhses_sfsx.txd/lacreamwall1.dds\",\n \"gta3.img/cuntwrestcs_t.txd/compcouwall1.dds\",\"gta3.img/boxybld2_sfw.txd/compcouwall1.dds\",\n \"gta3.img/des_byoffice.txd/compcouwall1.dds\",\"gta3.img/boxybld2_sfw.txd/compcouwall1.dds\",\n \"gta3.img/des_stownmots1.txd/compcouwall1.dds\",\"gta3.img/boxybld2_sfw.txd/compcouwall1.dds\",\n \"gta3.img/fishwarf.txd/compcouwall1.dds\",\"gta3.img/boxybld2_sfw.txd/compcouwall1.dds\",\n \"gta3.img/lashops6_las2.txd/compcouwall1.dds\",\"gta3.img/boxybld2_sfw.txd/compcouwall1.dds\",\n \"gta3.img/pirateship01.txd/compcouwall1.dds\",\"gta3.img/boxybld2_sfw.txd/compcouwall1.dds\",\n \"gta3.img/sfn_office.txd/compcouwall1.dds\",\"gta3.img/boxybld2_sfw.txd/compcouwall1.dds\",\n \"gta3.img/sunrise04_lawn.txd/compcouwall1.dds\",\"gta3.img/boxybld2_sfw.txd/compcouwall1.dds\",\n \"gta3.img/sunrise10_lawn.txd/compcouwall1.dds\",\"gta3.img/boxybld2_sfw.txd/compcouwall1.dds\",\n \"gta3.img/sw_roadgas.txd/compcouwall1.dds\",\"gta3.img/boxybld2_sfw.txd/compcouwall1.dds\",\n \"gta3.img/tempo22_law.txd/compcouwall1.dds\",\"gta3.img/boxybld2_sfw.txd/compcouwall1.dds\",\n \"gta3.img/vgnlowbild.txd/compcouwall1.dds\",\"gta3.img/boxybld2_sfw.txd/compcouwall1.dds\",\n \"gta3.img/vgse24hr.txd/compcouwall1.dds\",\"gta3.img/boxybld2_sfw.txd/compcouwall1.dds\",\n \"gta3.img/cuntwbtxcs_t.txd/dirty01.dds\",\"gta3.img/boxybld2_sfw.txd/dirty01.dds\",\n \"gta3.img/comedhos1_la.txd/comptdoor3.dds\",\"gta3.img/boxybld2_sfw.txd/comptdoor3.dds\",\n \"gta3.img/hillhouse14_la.txd/comptdoor3.dds\",\"gta3.img/boxybld2_sfw.txd/comptdoor3.dds\",\n \"gta3.img/hillhousex2_us.txd/comptdoor3.dds\",\"gta3.img/boxybld2_sfw.txd/comptdoor3.dds\",\n \"gta3.img/vegashse6.txd/comptdoor3.dds\",\"gta3.img/boxybld2_sfw.txd/comptdoor3.dds\",\n \"gta3.img/civic03_lan.txd/bevdoor01_law.dds\",\"gta3.img/boxybld2_sfw.txd/bevdoor01_law.dds\",\n \"gta3.img/eastbeach7_lae2.txd/bevdoor01_law.dds\",\"gta3.img/boxybld2_sfw.txd/bevdoor01_law.dds\",\n \"gta3.img/shops2_law.txd/bevdoor01_law.dds\",\"gta3.img/boxybld2_sfw.txd/bevdoor01_law.dds\",\n \"gta3.img/law_beach2.txd/lombard_build2_1.dds\",\"gta3.img/boxybld2_sfw.txd/lombard_build2_1.dds\",\n \"gta3.img/lombard.txd/lombard_build2_1.dds\",\"gta3.img/boxybld2_sfw.txd/lombard_build2_1.dds\",\n \"gta3.img/ggatepark.txd/sfn_rock2.dds\",\"gta3.img/boxybld2_sfw.txd/sfn_rock2.dds\",\n \"gta3.img/sfvictorian.txd/gz_vic4e.dds\",\"gta3.img/boxybld2_sfw.txd/gz_vic4e.dds\",\n \"gta3.img/slapart01sfe.txd/gz_vic4e.dds\",\"gta3.img/boxybld2_sfw.txd/gz_vic4e.dds\",\n \"gta3.img/sfvictorian.txd/gz_vic4c.dds\",\"gta3.img/boxybld2_sfw.txd/gz_vic4c.dds\",\n \"gta3.img/slapart01sfe.txd/gz_vic4c.dds\",\"gta3.img/boxybld2_sfw.txd/gz_vic4c.dds\",\n \"gta3.img/sfvictorian.txd/gz_vic4b.dds\",\"gta3.img/boxybld2_sfw.txd/gz_vic4b.dds\",\n \"gta3.img/slapart01sfe.txd/gz_vic4b.dds\",\"gta3.img/boxybld2_sfw.txd/gz_vic4b.dds\",\n \"gta3.img/sfvictorian.txd/gz_vic4a.dds\",\"gta3.img/boxybld2_sfw.txd/gz_vic4a.dds\",\n \"gta3.img/slapart01sfe.txd/gz_vic4a.dds\",\"gta3.img/boxybld2_sfw.txd/gz_vic4a.dds\",\n \"gta3.img/boxybld_sfw.txd/boxybox_sf3z.dds\",\"gta3.img/boxybld2_sfw.txd/boxybox_sf3z.dds\",\n \"gta3.img/hospital_lae.txd/hospwall1.dds\",\"gta3.img/boxybld_sfw.txd/hospwall1.dds\",\n \"gta3.img/des_nwtown.txd/taxi_256.dds\",\"gta3.img/boxybld_sfw.txd/taxi_256.dds\",\n \"gta3.img/des_s.txd/taxi_256.dds\",\"gta3.img/boxybld_sfw.txd/taxi_256.dds\",\n \"gta3.img/nucarparkwall.txd/taxi_256.dds\",\"gta3.img/boxybld_sfw.txd/taxi_256.dds\",\n \"gta3.img/sw_block05.txd/taxi_256.dds\",\"gta3.img/boxybld_sfw.txd/taxi_256.dds\",\n \"gta3.img/sw_block09.txd/taxi_256.dds\",\"gta3.img/boxybld_sfw.txd/taxi_256.dds\",\n \"gta3.img/sw_genstore.txd/taxi_256.dds\",\"gta3.img/boxybld_sfw.txd/taxi_256.dds\",\n \"gta3.img/vgseland.txd/taxi_256.dds\",\"gta3.img/boxybld_sfw.txd/taxi_256.dds\",\n \"gta3.img/crackfact_sfse.txd/ws_altz_wall8_bot.dds\",\"gta3.img/boxybld_sfw.txd/ws_altz_wall8_bot.dds\",\n \"gta3.img/hashblock2_sfs.txd/ws_altz_wall8_bot.dds\",\"gta3.img/boxybld_sfw.txd/ws_altz_wall8_bot.dds\",\n \"gta3.img/smallertxd.txd/boxybox_sf1z.dds\",\"gta3.img/boxybld_sfw.txd/boxybox_sf1z.dds\",\n \"gta3.img/coastground.txd/pierbuild_btm1.dds\",\"gta3.img/boxybld_sfw.txd/pierbuild_btm1.dds\",\n \"gta3.img/donut_sfw.txd/pierbuild_btm1.dds\",\"gta3.img/boxybld_sfw.txd/pierbuild_btm1.dds\",\n \"gta3.img/fishwarf.txd/pierbuild_btm1.dds\",\"gta3.img/boxybld_sfw.txd/pierbuild_btm1.dds\",\n \"gta3.img/gazlaw3.txd/pierbuild_btm1.dds\",\"gta3.img/boxybld_sfw.txd/pierbuild_btm1.dds\",\n \"gta3.img/sfn_helipad.txd/pierbuild_btm1.dds\",\"gta3.img/boxybld_sfw.txd/pierbuild_btm1.dds\",\n \"gta3.img/donut_sfw.txd/ws_alley_conc1.dds\",\"gta3.img/boxybld_sfw.txd/ws_alley_conc1.dds\",\n \"gta3.img/fort_sfw.txd/ws_alley_conc1.dds\",\"gta3.img/boxybld_sfw.txd/ws_alley_conc1.dds\",\n \"gta3.img/laland1_lan2.txd/ws_alley_conc1.dds\",\"gta3.img/boxybld_sfw.txd/ws_alley_conc1.dds\",\n \"gta3.img/park_sfw.txd/ws_alley_conc1.dds\",\"gta3.img/boxybld_sfw.txd/ws_alley_conc1.dds\",\n \"gta3.img/warehus_las2.txd/ws_alley_conc1.dds\",\"gta3.img/boxybld_sfw.txd/ws_alley_conc1.dds\",\n \"gta3.img/dyn_objects.txd/cj_bottle.dds\",\"gta3.img/break_bar.txd/cj_bottle.dds\",\n \"gta3.img/cj_bar.txd/cj_bottle2.dds\",\"gta3.img/break_bar.txd/cj_bottle2.dds\",\n \"gta3.img/hubprops2_sfse.txd/cj_bottle2.dds\",\"gta3.img/break_bar.txd/cj_bottle2.dds\",\n \"gta3.img/break_street2.txd/cj_darkwood.dds\",\"gta3.img/break_farm.txd/cj_darkwood.dds\",\n \"gta3.img/cart.txd/cj_darkwood.dds\",\"gta3.img/break_farm.txd/cj_darkwood.dds\",\n \"gta3.img/crates_n_stuffext.txd/cj_darkwood.dds\",\"gta3.img/break_farm.txd/cj_darkwood.dds\",\n \"gta3.img/gta_brokentrees.txd/cj_darkwood.dds\",\"gta3.img/break_farm.txd/cj_darkwood.dds\",\n \"gta3.img/hubint2.txd/cj_darkwood.dds\",\"gta3.img/break_farm.txd/cj_darkwood.dds\",\n \"gta3.img/hubprops2_sfse.txd/cj_darkwood.dds\",\"gta3.img/break_farm.txd/cj_darkwood.dds\",\n \"gta3.img/laesmokecuts.txd/cj_darkwood.dds\",\"gta3.img/break_farm.txd/cj_darkwood.dds\",\n \"gta_int.img/cj_ammo.txd/cj_darkwood.dds\",\"gta3.img/break_farm.txd/cj_darkwood.dds\",\n \"gta_int.img/cj_beds.txd/cj_darkwood.dds\",\"gta3.img/break_farm.txd/cj_darkwood.dds\",\n \"gta_int.img/picture_frame.txd/cj_darkwood.dds\",\"gta3.img/break_farm.txd/cj_darkwood.dds\",\n \"gta3.img/totoie.txd/cj_hay2.dds\",\"gta3.img/break_farm.txd/cj_hay2.dds\",\n \"gta_int.img/chick_tray.txd/cj_hay2.dds\",\"gta3.img/break_farm.txd/cj_hay2.dds\",\n \"gta_int.img/cj_anim.txd/cj_hay2.dds\",\"gta3.img/break_farm.txd/cj_hay2.dds\",\n \"gta_int.img/gf3.txd/cj_hay2.dds\",\"gta3.img/break_farm.txd/cj_hay2.dds\",\n \"gta3.img/chicanotr1_lae.txd/compfence2_lae.dds\",\"gta3.img/break_fence1.txd/compfence2_lae.dds\",\n \"gta3.img/ground4_las.txd/compfence2_lae.dds\",\"gta3.img/break_fence1.txd/compfence2_lae.dds\",\n \"gta3.img/break_scaffold.txd/cj_w_wood.dds\",\"gta3.img/break_fence1.txd/cj_w_wood.dds\",\n \"gta3.img/break_street2.txd/cj_w_wood.dds\",\"gta3.img/break_fence1.txd/cj_w_wood.dds\",\n \"gta3.img/gazebo.txd/cj_w_wood.dds\",\"gta3.img/break_fence1.txd/cj_w_wood.dds\",\n \"gta3.img/int_doors.txd/cj_w_wood.dds\",\"gta3.img/break_fence1.txd/cj_w_wood.dds\",\n \"gta_int.img/cj_bathroom.txd/cj_w_wood.dds\",\"gta3.img/break_fence1.txd/cj_w_wood.dds\",\n \"gta_int.img/picture_frame.txd/cj_w_wood.dds\",\"gta3.img/break_fence1.txd/cj_w_wood.dds\",\n \"gta3.img/cj_bins.txd/cj_dump3.dds\",\"gta3.img/break_fence3.txd/cj_dump3.dds\",\n \"gta3.img/cj_street_props.txd/cj_dump3.dds\",\"gta3.img/break_fence3.txd/cj_dump3.dds\",\n \"gta3.img/laesmokecuts.txd/cj_dump3.dds\",\"gta3.img/break_fence3.txd/cj_dump3.dds\",\n \"gta3.img/roadside.txd/cj_dump3.dds\",\"gta3.img/break_fence3.txd/cj_dump3.dds\",\n \"gta3.img/break_street1.txd/cj_dump.dds\",\"gta3.img/break_fence3.txd/cj_dump.dds\",\n \"gta3.img/cj_bins2.txd/cj_dump.dds\",\"gta3.img/break_fence3.txd/cj_dump.dds\",\n \"gta3.img/cj_bins.txd/cj_dump.dds\",\"gta3.img/break_fence3.txd/cj_dump.dds\",\n \"gta3.img/copshop_sfe.txd/cj_dump.dds\",\"gta3.img/break_fence3.txd/cj_dump.dds\",\n \"gta3.img/street_rubishext.txd/cj_dump.dds\",\"gta3.img/break_fence3.txd/cj_dump.dds\",\n \"gta3.img/tmbinx.txd/cj_dump.dds\",\"gta3.img/break_fence3.txd/cj_dump.dds\",\n \"gta3.img/cj_street_props.txd/cj_trafficlights.dds\",\"gta3.img/break_fence3.txd/cj_trafficlights.dds\",\n \"gta3.img/cj_traffic.txd/cj_trafficlights.dds\",\"gta3.img/break_fence3.txd/cj_trafficlights.dds\",\n \"gta3.img/gay_xref.txd/cj_trafficlights.dds\",\"gta3.img/break_fence3.txd/cj_trafficlights.dds\",\n \"gta3.img/bustopm.txd/cj_frame_glass.dds\",\"gta3.img/break_fence3.txd/cj_frame_glass.dds\",\n \"gta3.img/cj_ext_vend2.txd/cj_frame_glass.dds\",\"gta3.img/break_fence3.txd/cj_frame_glass.dds\",\n \"gta3.img/mp_ranchcut.txd/cj_frame_glass.dds\",\"gta3.img/break_fence3.txd/cj_frame_glass.dds\",\n \"gta3.img/ottos2_sfw.txd/cj_frame_glass.dds\",\"gta3.img/break_fence3.txd/cj_frame_glass.dds\",\n \"gta_int.img/cj_ammo.txd/cj_frame_glass.dds\",\"gta3.img/break_fence3.txd/cj_frame_glass.dds\",\n \"gta_int.img/cj_bs_bathroom.txd/cj_frame_glass.dds\",\"gta3.img/break_fence3.txd/cj_frame_glass.dds\",\n \"gta_int.img/cj_ff_acc1.txd/cj_frame_glass.dds\",\"gta3.img/break_fence3.txd/cj_frame_glass.dds\",\n \"gta_int.img/cj_ff_counters.txd/cj_frame_glass.dds\",\"gta3.img/break_fence3.txd/cj_frame_glass.dds\",\n \"gta_int.img/cj_ff.txd/cj_frame_glass.dds\",\"gta3.img/break_fence3.txd/cj_frame_glass.dds\",\n \"gta_int.img/cj_furniture.txd/cj_frame_glass.dds\",\"gta3.img/break_fence3.txd/cj_frame_glass.dds\",\n \"gta_int.img/cj_hotel_sw.txd/cj_frame_glass.dds\",\"gta3.img/break_fence3.txd/cj_frame_glass.dds\",\n \"gta_int.img/cj_jucie.txd/cj_frame_glass.dds\",\"gta3.img/break_fence3.txd/cj_frame_glass.dds\",\n \"gta_int.img/cj_kitchen.txd/cj_frame_glass.dds\",\"gta3.img/break_fence3.txd/cj_frame_glass.dds\",\n \"gta_int.img/cj_office.txd/cj_frame_glass.dds\",\"gta3.img/break_fence3.txd/cj_frame_glass.dds\",\n \"gta_int.img/cj_off_lic.txd/cj_frame_glass.dds\",\"gta3.img/break_fence3.txd/cj_frame_glass.dds\",\n \"gta_int.img/cj_ss_1.txd/cj_frame_glass.dds\",\"gta3.img/break_fence3.txd/cj_frame_glass.dds\",\n \"gta_int.img/cj_ss_3.txd/cj_frame_glass.dds\",\"gta3.img/break_fence3.txd/cj_frame_glass.dds\",\n \"gta_int.img/cj_ss_4.txd/cj_frame_glass.dds\",\"gta3.img/break_fence3.txd/cj_frame_glass.dds\",\n \"gta_int.img/cj_tables.txd/cj_frame_glass.dds\",\"gta3.img/break_fence3.txd/cj_frame_glass.dds\",\n \"gta_int.img/newcrak.txd/cj_frame_glass.dds\",\"gta3.img/break_fence3.txd/cj_frame_glass.dds\",\n \"gta_int.img/pdomes_logo.txd/cj_frame_glass.dds\",\"gta3.img/break_fence3.txd/cj_frame_glass.dds\",\n \"gta_int.img/plants_galss.txd/cj_frame_glass.dds\",\"gta3.img/break_fence3.txd/cj_frame_glass.dds\",\n \"gta_int.img/rc_shop_trains.txd/cj_frame_glass.dds\",\"gta3.img/break_fence3.txd/cj_frame_glass.dds\",\n \"gta_int.img/rc_shop.txd/cj_frame_glass.dds\",\"gta3.img/break_fence3.txd/cj_frame_glass.dds\",\n \"gta_int.img/sfhss2.txd/cj_frame_glass.dds\",\"gta3.img/break_fence3.txd/cj_frame_glass.dds\",\n \"gta_int.img/shopping.txd/cj_frame_glass.dds\",\"gta3.img/break_fence3.txd/cj_frame_glass.dds\",\n \"gta_int.img/smallsfhs.txd/cj_frame_glass.dds\",\"gta3.img/break_fence3.txd/cj_frame_glass.dds\",\n \"gta_int.img/vegassavesmal.txd/cj_frame_glass.dds\",\"gta3.img/break_fence3.txd/cj_frame_glass.dds\",\n \"gta3.img/break_street1.txd/cj_dump2.dds\",\"gta3.img/break_fence3.txd/cj_dump2.dds\",\n \"gta3.img/cj_bins2.txd/cj_dump2.dds\",\"gta3.img/break_fence3.txd/cj_dump2.dds\",\n \"gta3.img/cj_street_props.txd/cj_dump2.dds\",\"gta3.img/break_fence3.txd/cj_dump2.dds\",\n \"gta3.img/street_rubishext.txd/cj_dump2.dds\",\"gta3.img/break_fence3.txd/cj_dump2.dds\",\n \"gta3.img/break_s_sf.txd/cj_bin_lid.dds\",\"gta3.img/break_fence3.txd/cj_bin_lid.dds\",\n \"gta3.img/cj_bins.txd/cj_bin_lid.dds\",\"gta3.img/break_fence3.txd/cj_bin_lid.dds\",\n \"gta3.img/cj_street_props.txd/cj_bin_lid.dds\",\"gta3.img/break_fence3.txd/cj_bin_lid.dds\",\n \"gta3.img/laesmokecuts.txd/cj_bin_lid.dds\",\"gta3.img/break_fence3.txd/cj_bin_lid.dds\",\n \"gta3.img/roadside.txd/cj_bin_lid.dds\",\"gta3.img/break_fence3.txd/cj_bin_lid.dds\",\n \"gta_int.img/genintintbarb.txd/mp_barbedwire.dds\",\"gta3.img/break_fen_mesh2.txd/mp_barbedwire.dds\",\n \"gta3.img/chemgrnd_las2.txd/meetwalv2.dds\",\"gta3.img/break_f_mesh.txd/meetwalv2.dds\",\n \"gta3.img/ground_las2.txd/meetwalv2.dds\",\"gta3.img/break_f_mesh.txd/meetwalv2.dds\",\n \"gta3.img/traintrack_las2.txd/meetwalv2.dds\",\"gta3.img/break_f_mesh.txd/meetwalv2.dds\",\n \"gta3.img/wiresetc_las2.txd/meetwalv2.dds\",\"gta3.img/break_f_mesh.txd/meetwalv2.dds\",\n \"gta3.img/xrf_refineryla.txd/meetwalv2.dds\",\"gta3.img/break_f_mesh.txd/meetwalv2.dds\",\n \"gta3.img/break_road.txd/cj_corrigated.dds\",\"gta3.img/break_f_mesh.txd/cj_corrigated.dds\",\n \"gta3.img/break_street1.txd/cj_corrigated.dds\",\"gta3.img/break_f_mesh.txd/cj_corrigated.dds\",\n \"gta3.img/break_street2.txd/cj_corrigated.dds\",\"gta3.img/break_f_mesh.txd/cj_corrigated.dds\",\n \"gta3.img/imy_trx.txd/cj_corrigated.dds\",\"gta3.img/break_f_mesh.txd/cj_corrigated.dds\",\n \"gta3.img/junkpiles.txd/cj_corrigated.dds\",\"gta3.img/break_f_mesh.txd/cj_corrigated.dds\",\n \"gta3.img/ramp1.txd/cj_corrigated.dds\",\"gta3.img/break_f_mesh.txd/cj_corrigated.dds\",\n \"gta3.img/sw_well1.txd/cj_corrigated.dds\",\"gta3.img/break_f_mesh.txd/cj_corrigated.dds\",\n \"gta3.img/break_garden.txd/cj_slatedwood.dds\",\"gta3.img/break_f_w.txd/cj_slatedwood.dds\",\n \"gta3.img/break_s_bins.txd/cj_slatedwood.dds\",\"gta3.img/break_f_w.txd/cj_slatedwood.dds\",\n \"gta3.img/break_s_box.txd/cj_slatedwood.dds\",\"gta3.img/break_f_w.txd/cj_slatedwood.dds\",\n \"gta3.img/break_scaffold.txd/cj_slatedwood.dds\",\"gta3.img/break_f_w.txd/cj_slatedwood.dds\",\n \"gta3.img/break_street1.txd/cj_slatedwood.dds\",\"gta3.img/break_f_w.txd/cj_slatedwood.dds\",\n \"gta3.img/break_street2.txd/cj_slatedwood.dds\",\"gta3.img/break_f_w.txd/cj_slatedwood.dds\",\n \"gta3.img/cart.txd/cj_slatedwood.dds\",\"gta3.img/break_f_w.txd/cj_slatedwood.dds\",\n \"gta3.img/cj_benches.txd/cj_slatedwood.dds\",\"gta3.img/break_f_w.txd/cj_slatedwood.dds\",\n \"gta3.img/cj_bins.txd/cj_slatedwood.dds\",\"gta3.img/break_f_w.txd/cj_slatedwood.dds\",\n \"gta3.img/cj_noodle_1.txd/cj_slatedwood.dds\",\"gta3.img/break_f_w.txd/cj_slatedwood.dds\",\n \"gta3.img/cj_plant_props.txd/cj_slatedwood.dds\",\"gta3.img/break_f_w.txd/cj_slatedwood.dds\",\n \"gta3.img/crates_n_stuffext.txd/cj_slatedwood.dds\",\"gta3.img/break_f_w.txd/cj_slatedwood.dds\",\n \"gta3.img/cr_boxes.txd/cj_slatedwood.dds\",\"gta3.img/break_f_w.txd/cj_slatedwood.dds\",\n \"gta3.img/db_ammo.txd/cj_slatedwood.dds\",\"gta3.img/break_f_w.txd/cj_slatedwood.dds\",\n \"gta3.img/kfencex.txd/cj_slatedwood.dds\",\"gta3.img/break_f_w.txd/cj_slatedwood.dds\",\n \"gta3.img/lv_ammo.txd/cj_slatedwood.dds\",\"gta3.img/break_f_w.txd/cj_slatedwood.dds\",\n \"gta3.img/mp_ranchcut.txd/cj_slatedwood.dds\",\"gta3.img/break_f_w.txd/cj_slatedwood.dds\",\n \"gta_int.img/cj_ammo.txd/cj_slatedwood.dds\",\"gta3.img/break_f_w.txd/cj_slatedwood.dds\",\n \"gta_int.img/cj_bathroom.txd/cj_slatedwood.dds\",\"gta3.img/break_f_w.txd/cj_slatedwood.dds\",\n \"gta_int.img/dr_gsnew.txd/cj_slatedwood.dds\",\"gta3.img/break_f_w.txd/cj_slatedwood.dds\",\n \"gta_int.img/mafcasgenstuff.txd/cj_slatedwood.dds\",\"gta3.img/break_f_w.txd/cj_slatedwood.dds\",\n \"gta_int.img/maint3.txd/cj_slatedwood.dds\",\"gta3.img/break_f_w.txd/cj_slatedwood.dds\",\n \"gta_int.img/plants_tabletop.txd/cj_slatedwood.dds\",\"gta3.img/break_f_w.txd/cj_slatedwood.dds\",\n \"gta3.img/break_road.txd/cj_greenwood.dds\",\"gta3.img/break_f_w.txd/cj_greenwood.dds\",\n \"gta3.img/break_s_fillers.txd/cj_greenwood.dds\",\"gta3.img/break_f_w.txd/cj_greenwood.dds\",\n \"gta3.img/cj_benches.txd/cj_greenwood.dds\",\"gta3.img/break_f_w.txd/cj_greenwood.dds\",\n \"gta3.img/break_s_box.txd/gen_bin_bag.dds\",\"gta3.img/break_pallet.txd/gen_bin_bag.dds\",\n \"gta3.img/drubish.txd/gen_bin_bag.dds\",\"gta3.img/break_pallet.txd/gen_bin_bag.dds\",\n \"gta3.img/cj_box1.txd/slated.dds\",\"gta3.img/break_pallet.txd/slated.dds\",\n \"gta3.img/junkpiles.txd/slated.dds\",\"gta3.img/break_pallet.txd/slated.dds\",\n \"gta_int.img/cj_ss_1.txd/slated.dds\",\"gta3.img/break_pallet.txd/slated.dds\",\n \"gta_int.img/munation1.txd/slated.dds\",\"gta3.img/break_pallet.txd/slated.dds\",\n \"gta_int.img/shopping.txd/slated.dds\",\"gta3.img/break_pallet.txd/slated.dds\",\n \"gta3.img/break_scaffold.txd/cj_s_pole.dds\",\"gta3.img/break_road.txd/cj_s_pole.dds\",\n \"gta3.img/break_s_fillers.txd/cj_s_pole.dds\",\"gta3.img/break_road.txd/cj_s_pole.dds\",\n \"gta3.img/vgnoutown2.txd/cj_s_pole.dds\",\"gta3.img/break_road.txd/cj_s_pole.dds\",\n \"gta3.img/vgnptrlpmp.txd/cj_s_pole.dds\",\"gta3.img/break_road.txd/cj_s_pole.dds\",\n \"gta3.img/vgslowbuild.txd/cj_s_pole.dds\",\"gta3.img/break_road.txd/cj_s_pole.dds\",\n \"gta3.img/break_road_ws.txd/cj_orangebarrier2.dds\",\"gta3.img/break_road.txd/cj_orangebarrier2.dds\",\n \"gta3.img/imy_trx.txd/cj_orangebarrier2.dds\",\"gta3.img/break_road.txd/cj_orangebarrier2.dds\",\n \"gta_int.img/cj_barb.txd/cj_wood_dark.dds\",\"gta3.img/break_s_bins.txd/cj_wood_dark.dds\",\n \"gta_int.img/cj_bathroom.txd/cj_wood_dark.dds\",\"gta3.img/break_s_bins.txd/cj_wood_dark.dds\",\n \"gta_int.img/cj_casino_prop.txd/cj_wood_dark.dds\",\"gta3.img/break_s_bins.txd/cj_wood_dark.dds\",\n \"gta_int.img/cj_coin_op.txd/cj_wood_dark.dds\",\"gta3.img/break_s_bins.txd/cj_wood_dark.dds\",\n \"gta_int.img/cj_furniture.txd/cj_wood_dark.dds\",\"gta3.img/break_s_bins.txd/cj_wood_dark.dds\",\n \"gta_int.img/cj_hotel_sw.txd/cj_wood_dark.dds\",\"gta3.img/break_s_bins.txd/cj_wood_dark.dds\",\n \"gta_int.img/cj_office.txd/cj_wood_dark.dds\",\"gta3.img/break_s_bins.txd/cj_wood_dark.dds\",\n \"gta_int.img/cj_tables.txd/cj_wood_dark.dds\",\"gta3.img/break_s_bins.txd/cj_wood_dark.dds\",\n \"gta_int.img/cj_tv_stand.txd/cj_wood_dark.dds\",\"gta3.img/break_s_bins.txd/cj_wood_dark.dds\",\n \"gta_int.img/genintintbarbera.txd/cj_wood_dark.dds\",\"gta3.img/break_s_bins.txd/cj_wood_dark.dds\",\n \"gta_int.img/immy_furn.txd/cj_wood_dark.dds\",\"gta3.img/break_s_bins.txd/cj_wood_dark.dds\",\n \"gta_int.img/im_xtra.txd/cj_wood_dark.dds\",\"gta3.img/break_s_bins.txd/cj_wood_dark.dds\",\n \"gta_int.img/lasmalldesk.txd/cj_wood_dark.dds\",\"gta3.img/break_s_bins.txd/cj_wood_dark.dds\",\n \"gta_int.img/picture_frame.txd/cj_wood_dark.dds\",\"gta3.img/break_s_bins.txd/cj_wood_dark.dds\",\n \"gta_int.img/savegenmotel.txd/cj_wood_dark.dds\",\"gta3.img/break_s_bins.txd/cj_wood_dark.dds\",\n \"gta_int.img/whore_furn.txd/cj_wood_dark.dds\",\"gta3.img/break_s_bins.txd/cj_wood_dark.dds\",\n \"gta3.img/sfeship1.txd/cj_red_leather.dds\",\"gta3.img/break_s_bins.txd/cj_red_leather.dds\",\n \"gta_int.img/cj_lighting.txd/cj_red_leather.dds\",\"gta3.img/break_s_bins.txd/cj_red_leather.dds\",\n \"gta_int.img/cj_tables.txd/cj_red_leather.dds\",\"gta3.img/break_s_bins.txd/cj_red_leather.dds\",\n \"gta_int.img/svsfsmbits.txd/cj_red_leather.dds\",\"gta3.img/break_s_bins.txd/cj_red_leather.dds\",\n \"gta_int.img/cj_tables.txd/marble1.dds\",\"gta3.img/break_s_bins.txd/marble1.dds\",\n \"gta_int.img/whore_furn.txd/marble1.dds\",\"gta3.img/break_s_bins.txd/marble1.dds\",\n \"gta3.img/cj_bins.txd/dirt64b.dds\",\"gta3.img/break_s_bins.txd/dirt64b.dds\",\n \"gta3.img/cj_plant_props.txd/dirt64b.dds\",\"gta3.img/break_s_bins.txd/dirt64b.dds\",\n \"gta3.img/gta_brokentrees.txd/dirt64b.dds\",\"gta3.img/break_s_bins.txd/dirt64b.dds\",\n \"gta3.img/ottos2_sfw.txd/dirt64b.dds\",\"gta3.img/break_s_bins.txd/dirt64b.dds\",\n \"gta3.img/plants_officeext.txd/dirt64b.dds\",\"gta3.img/break_s_bins.txd/dirt64b.dds\",\n \"gta3.img/sfeship1.txd/dirt64b.dds\",\"gta3.img/break_s_bins.txd/dirt64b.dds\",\n \"gta3.img/vgsbikesclint.txd/dirt64b.dds\",\"gta3.img/break_s_bins.txd/dirt64b.dds\",\n \"gta_int.img/cj_ammo.txd/dirt64b.dds\",\"gta3.img/break_s_bins.txd/dirt64b.dds\",\n \"gta_int.img/cj_lighting.txd/dirt64b.dds\",\"gta3.img/break_s_bins.txd/dirt64b.dds\",\n \"gta_int.img/crlsbits.txd/dirt64b.dds\",\"gta3.img/break_s_bins.txd/dirt64b.dds\",\n \"gta_int.img/gb_ornaments01.txd/dirt64b.dds\",\"gta3.img/break_s_bins.txd/dirt64b.dds\",\n \"gta_int.img/genhotelsave.txd/dirt64b.dds\",\"gta3.img/break_s_bins.txd/dirt64b.dds\",\n \"gta_int.img/im_xtra.txd/dirt64b.dds\",\"gta3.img/break_s_bins.txd/dirt64b.dds\",\n \"gta_int.img/labig1int2.txd/dirt64b.dds\",\"gta3.img/break_s_bins.txd/dirt64b.dds\",\n \"gta_int.img/plants_designer.txd/dirt64b.dds\",\"gta3.img/break_s_bins.txd/dirt64b.dds\",\n \"gta_int.img/plants_office.txd/dirt64b.dds\",\"gta3.img/break_s_bins.txd/dirt64b.dds\",\n \"gta_int.img/plants_tabletop.txd/dirt64b.dds\",\"gta3.img/break_s_bins.txd/dirt64b.dds\",\n \"gta_int.img/plants.txd/dirt64b.dds\",\"gta3.img/break_s_bins.txd/dirt64b.dds\",\n \"gta_int.img/rystuff.txd/dirt64b.dds\",\"gta3.img/break_s_bins.txd/dirt64b.dds\",\n \"gta_int.img/vegassavesmal.txd/dirt64b.dds\",\"gta3.img/break_s_bins.txd/dirt64b.dds\",\n \"gta3.img/break_s_box.txd/gen_box.dds\",\"gta3.img/break_s_bins.txd/gen_box.dds\",\n \"gta3.img/crates_n_stuffext.txd/gen_box.dds\",\"gta3.img/break_s_bins.txd/gen_box.dds\",\n \"gta3.img/junkpiles.txd/gen_box.dds\",\"gta3.img/break_s_bins.txd/gen_box.dds\",\n \"gta3.img/break_street1.txd/cj_crates.dds\",\"gta3.img/break_s_box.txd/cj_crates.dds\",\n \"gta3.img/cj_crate_will.txd/cj_crates.dds\",\"gta3.img/break_s_box.txd/cj_crates.dds\",\n \"gta3.img/crates_n_stuffext.txd/cj_crates.dds\",\"gta3.img/break_s_box.txd/cj_crates.dds\",\n \"gta3.img/ramp1.txd/cj_crates.dds\",\"gta3.img/break_s_box.txd/cj_crates.dds\",\n \"gta_int.img/cj_sex.txd/cj_blue_wood.dds\",\"gta3.img/break_scaffold.txd/cj_blue_wood.dds\",\n \"gta_int.img/cj_ff_acc1.txd/cj_burger.dds\",\"gta3.img/break_s_fillers.txd/cj_burger.dds\",\n \"gta_int.img/pick_up.txd/cj_burger.dds\",\"gta3.img/break_s_fillers.txd/cj_burger.dds\",\n \"gta_int.img/cj_sex.txd/cj_sex_sign1.dds\",\"gta3.img/break_s_fillers.txd/cj_sex_sign1.dds\",\n \"gta3.img/cj_chip_maker.txd/cj_tv_screen.dds\",\"gta3.img/break_street1.txd/cj_tv_screen.dds\",\n \"gta3.img/des_byofficeint.txd/cj_tv_screen.dds\",\"gta3.img/break_street1.txd/cj_tv_screen.dds\",\n \"gta3.img/dyn_elec.txd/cj_tv_screen.dds\",\"gta3.img/break_street1.txd/cj_tv_screen.dds\",\n \"gta3.img/hubprops2_sfse.txd/cj_tv_screen.dds\",\"gta3.img/break_street1.txd/cj_tv_screen.dds\",\n \"gta3.img/sfeship1.txd/cj_tv_screen.dds\",\"gta3.img/break_street1.txd/cj_tv_screen.dds\",\n \"gta3.img/sfn_byofficeint.txd/cj_tv_screen.dds\",\"gta3.img/break_street1.txd/cj_tv_screen.dds\",\n \"gta3.img/vgsbikesclint.txd/cj_tv_screen.dds\",\"gta3.img/break_street1.txd/cj_tv_screen.dds\",\n \"gta_int.img/cj_furniture.txd/cj_tv_screen.dds\",\"gta3.img/break_street1.txd/cj_tv_screen.dds\",\n \"gta_int.img/cj_office.txd/cj_tv_screen.dds\",\"gta3.img/break_street1.txd/cj_tv_screen.dds\",\n \"gta_int.img/cj_s_beds.txd/cj_tv_screen.dds\",\"gta3.img/break_street1.txd/cj_tv_screen.dds\",\n \"gta_int.img/cj_sex.txd/cj_tv_screen.dds\",\"gta3.img/break_street1.txd/cj_tv_screen.dds\",\n \"gta_int.img/cj_steal_tv.txd/cj_tv_screen.dds\",\"gta3.img/break_street1.txd/cj_tv_screen.dds\",\n \"gta_int.img/cj_tables.txd/cj_tv_screen.dds\",\"gta3.img/break_street1.txd/cj_tv_screen.dds\",\n \"gta_int.img/cj_tv_stand.txd/cj_tv_screen.dds\",\"gta3.img/break_street1.txd/cj_tv_screen.dds\",\n \"gta_int.img/cj_tv.txd/cj_tv_screen.dds\",\"gta3.img/break_street1.txd/cj_tv_screen.dds\",\n \"gta_int.img/drivingbit.txd/cj_tv_screen.dds\",\"gta3.img/break_street1.txd/cj_tv_screen.dds\",\n \"gta_int.img/genhotelsave.txd/cj_tv_screen.dds\",\"gta3.img/break_street1.txd/cj_tv_screen.dds\",\n \"gta_int.img/immy_furn.txd/cj_tv_screen.dds\",\"gta3.img/break_street1.txd/cj_tv_screen.dds\",\n \"gta_int.img/int_brothelint3.txd/cj_tv_screen.dds\",\"gta3.img/break_street1.txd/cj_tv_screen.dds\",\n \"gta_int.img/lasmalldesk.txd/cj_tv_screen.dds\",\"gta3.img/break_street1.txd/cj_tv_screen.dds\",\n \"gta_int.img/police_props.txd/cj_tv_screen.dds\",\"gta3.img/break_street1.txd/cj_tv_screen.dds\",\n \"gta_int.img/rystuff.txd/cj_tv_screen.dds\",\"gta3.img/break_street1.txd/cj_tv_screen.dds\",\n \"gta_int.img/savegenmotel.txd/cj_tv_screen.dds\",\"gta3.img/break_street1.txd/cj_tv_screen.dds\",\n \"gta_int.img/sweetshall.txd/cj_tv_screen.dds\",\"gta3.img/break_street1.txd/cj_tv_screen.dds\",\n \"gta_int.img/vegassavesmal.txd/cj_tv_screen.dds\",\"gta3.img/break_street1.txd/cj_tv_screen.dds\",\n \"gta3.img/des_byofficeint.txd/cj_lightwood.dds\",\"gta3.img/break_street1.txd/cj_lightwood.dds\",\n \"gta3.img/dyn_elec.txd/cj_lightwood.dds\",\"gta3.img/break_street1.txd/cj_lightwood.dds\",\n \"gta3.img/hubprops2_sfse.txd/cj_lightwood.dds\",\"gta3.img/break_street1.txd/cj_lightwood.dds\",\n \"gta3.img/sfn_byofficeint.txd/cj_lightwood.dds\",\"gta3.img/break_street1.txd/cj_lightwood.dds\",\n \"gta3.img/totoie.txd/cj_lightwood.dds\",\"gta3.img/break_street1.txd/cj_lightwood.dds\",\n \"gta3.img/vgsbikesclint.txd/cj_lightwood.dds\",\"gta3.img/break_street1.txd/cj_lightwood.dds\",\n \"gta_int.img/bitsnbobs.txd/cj_lightwood.dds\",\"gta3.img/break_street1.txd/cj_lightwood.dds\",\n \"gta_int.img/cj_anim.txd/cj_lightwood.dds\",\"gta3.img/break_street1.txd/cj_lightwood.dds\",\n \"gta_int.img/cj_commercial.txd/cj_lightwood.dds\",\"gta3.img/break_street1.txd/cj_lightwood.dds\",\n \"gta_int.img/cj_ff.txd/cj_lightwood.dds\",\"gta3.img/break_street1.txd/cj_lightwood.dds\",\n \"gta_int.img/cj_furniture.txd/cj_lightwood.dds\",\"gta3.img/break_street1.txd/cj_lightwood.dds\",\n \"gta_int.img/cj_hi_fi.txd/cj_lightwood.dds\",\"gta3.img/break_street1.txd/cj_lightwood.dds\",\n \"gta_int.img/cj_hotel_sw.txd/cj_lightwood.dds\",\"gta3.img/break_street1.txd/cj_lightwood.dds\",\n \"gta_int.img/cj_kitchen.txd/cj_lightwood.dds\",\"gta3.img/break_street1.txd/cj_lightwood.dds\",\n \"gta_int.img/cj_lighting.txd/cj_lightwood.dds\",\"gta3.img/break_street1.txd/cj_lightwood.dds\",\n \"gta_int.img/cj_seating.txd/cj_lightwood.dds\",\"gta3.img/break_street1.txd/cj_lightwood.dds\",\n \"gta_int.img/cj_sex.txd/cj_lightwood.dds\",\"gta3.img/break_street1.txd/cj_lightwood.dds\",\n \"gta_int.img/cj_sofa.txd/cj_lightwood.dds\",\"gta3.img/break_street1.txd/cj_lightwood.dds\",\n \"gta_int.img/cj_steal_tv.txd/cj_lightwood.dds\",\"gta3.img/break_street1.txd/cj_lightwood.dds\",\n \"gta_int.img/cj_tables.txd/cj_lightwood.dds\",\"gta3.img/break_street1.txd/cj_lightwood.dds\",\n \"gta_int.img/cj_tv_stand.txd/cj_lightwood.dds\",\"gta3.img/break_street1.txd/cj_lightwood.dds\",\n \"gta_int.img/cj_tv.txd/cj_lightwood.dds\",\"gta3.img/break_street1.txd/cj_lightwood.dds\",\n \"gta_int.img/cj_urb.txd/cj_lightwood.dds\",\"gta3.img/break_street1.txd/cj_lightwood.dds\",\n \"gta_int.img/drivingbit.txd/cj_lightwood.dds\",\"gta3.img/break_street1.txd/cj_lightwood.dds\",\n \"gta_int.img/genhotelsave.txd/cj_lightwood.dds\",\"gta3.img/break_street1.txd/cj_lightwood.dds\",\n \"gta_int.img/hospital.txd/cj_lightwood.dds\",\"gta3.img/break_street1.txd/cj_lightwood.dds\",\n \"gta_int.img/immy_furn.txd/cj_lightwood.dds\",\"gta3.img/break_street1.txd/cj_lightwood.dds\",\n \"gta_int.img/lasmalldesk.txd/cj_lightwood.dds\",\"gta3.img/break_street1.txd/cj_lightwood.dds\",\n \"gta_int.img/picture_frame_clip.txd/cj_lightwood.dds\",\"gta3.img/break_street1.txd/cj_lightwood.dds\",\n \"gta_int.img/picture_frame.txd/cj_lightwood.dds\",\"gta3.img/break_street1.txd/cj_lightwood.dds\",\n \"gta_int.img/ryfurn2.txd/cj_lightwood.dds\",\"gta3.img/break_street1.txd/cj_lightwood.dds\",\n \"gta_int.img/savegenmotel.txd/cj_lightwood.dds\",\"gta3.img/break_street1.txd/cj_lightwood.dds\",\n \"gta_int.img/shopping.txd/cj_lightwood.dds\",\"gta3.img/break_street1.txd/cj_lightwood.dds\",\n \"gta_int.img/sweets_roon.txd/cj_lightwood.dds\",\"gta3.img/break_street1.txd/cj_lightwood.dds\",\n \"gta_int.img/vghotelnice.txd/cj_lightwood.dds\",\"gta3.img/break_street1.txd/cj_lightwood.dds\",\n \"gta3.img/carshow2_sfse.txd/box_texturepage.dds\",\"gta3.img/break_street1.txd/box_texturepage.dds\",\n \"gta3.img/cj_dfext.txd/box_texturepage.dds\",\"gta3.img/break_street1.txd/box_texturepage.dds\",\n \"gta3.img/crates_n_stuffext.txd/box_texturepage.dds\",\"gta3.img/break_street1.txd/box_texturepage.dds\",\n \"gta3.img/hubprops2_sfse.txd/box_texturepage.dds\",\"gta3.img/break_street1.txd/box_texturepage.dds\",\n \"gta3.img/lasxrefdockbox.txd/box_texturepage.dds\",\"gta3.img/break_street1.txd/box_texturepage.dds\",\n \"gta3.img/modshopintbits_sfs.txd/box_texturepage.dds\",\"gta3.img/break_street1.txd/box_texturepage.dds\",\n \"gta3.img/ufo_barbakroom.txd/box_texturepage.dds\",\"gta3.img/break_street1.txd/box_texturepage.dds\",\n \"gta_int.img/ab.txd/box_texturepage.dds\",\"gta3.img/break_street1.txd/box_texturepage.dds\",\n \"gta_int.img/maint3.txd/box_texturepage.dds\",\"gta3.img/break_street1.txd/box_texturepage.dds\",\n \"gta3.img/cj_street_props.txd/cj_skip.dds\",\"gta3.img/break_s_ws.txd/cj_skip.dds\",\n \"gta3.img/burgalrystore_sfse.txd/ws_altz_wall1.dds\",\"gta3.img/bridgeland_sfse.txd/ws_altz_wall1.dds\",\n \"gta3.img/crackfact_sfse.txd/ws_altz_wall1.dds\",\"gta3.img/bridgeland_sfse.txd/ws_altz_wall1.dds\",\n \"gta3.img/lawnbillbrd.txd/prolaps02.dds\",\"gta3.img/bridgeland_sfse.txd/prolaps02.dds\",\n \"gta3.img/vgebillboards.txd/prolaps02.dds\",\"gta3.img/bridgeland_sfse.txd/prolaps02.dds\",\n \"gta3.img/vgnretail3.txd/prolaps02.dds\",\"gta3.img/bridgeland_sfse.txd/prolaps02.dds\",\n \"gta3.img/vgnusedcar.txd/prolaps02.dds\",\"gta3.img/bridgeland_sfse.txd/prolaps02.dds\",\n \"gta3.img/savanna.txd/savanna92interior128.dds\",\"gta3.img/broadway.txd/broadway92interior128.dds\",\n \"gta3.img/tornado.txd/tornado92interior128.dds\",\"gta3.img/broadway.txd/broadway92interior128.dds\",\n \"gta3.img/vgsbballnet1.txd/drkbrownmetal.dds\",\"gta3.img/bskball_standext.txd/drkbrownmetal.dds\",\n \"gta3.img/eastls1_lae2.txd/roof06l256.dds\",\"gta3.img/bs_sfs.txd/roof06l256.dds\",\n \"gta3.img/furniture_lae2.txd/roof06l256.dds\",\"gta3.img/bs_sfs.txd/roof06l256.dds\",\n \"gta3.img/lae2bigblock.txd/roof06l256.dds\",\"gta3.img/bs_sfs.txd/roof06l256.dds\",\n \"gta3.img/lawnburg.txd/roof06l256.dds\",\"gta3.img/bs_sfs.txd/roof06l256.dds\",\n \"gta3.img/lngblok_lae2.txd/roof06l256.dds\",\"gta3.img/bs_sfs.txd/roof06l256.dds\",\n \"gta3.img/melrose12_lawn.txd/roof06l256.dds\",\"gta3.img/bs_sfs.txd/roof06l256.dds\",\n \"gta3.img/vgnfirestat.txd/roof06l256.dds\",\"gta3.img/bs_sfs.txd/roof06l256.dds\",\n \"gta3.img/vgnretail72.txd/roof06l256.dds\",\"gta3.img/bs_sfs.txd/roof06l256.dds\",\n \"gta3.img/vgwestboiga1.txd/roof06l256.dds\",\"gta3.img/bs_sfs.txd/roof06l256.dds\",\n \"gta3.img/jeffers4_lae.txd/conc_slabgrey_256128.dds\",\"gta3.img/bs_sfs.txd/conc_slabgrey_256128.dds\",\n \"gta3.img/lawngrnd.txd/conc_slabgrey_256128.dds\",\"gta3.img/bs_sfs.txd/conc_slabgrey_256128.dds\",\n \"gta3.img/lawnshite2n.txd/conc_slabgrey_256128.dds\",\"gta3.img/bs_sfs.txd/conc_slabgrey_256128.dds\",\n \"gta3.img/ramp2.txd/conc_slabgrey_256128.dds\",\"gta3.img/bs_sfs.txd/conc_slabgrey_256128.dds\",\n \"gta3.img/shamcpark.txd/conc_slabgrey_256128.dds\",\"gta3.img/bs_sfs.txd/conc_slabgrey_256128.dds\",\n \"gta3.img/sunrise09_lawn.txd/conc_slabgrey_256128.dds\",\"gta3.img/bs_sfs.txd/conc_slabgrey_256128.dds\",\n \"gta3.img/vgnboiga1.txd/conc_slabgrey_256128.dds\",\"gta3.img/bs_sfs.txd/conc_slabgrey_256128.dds\",\n \"gta3.img/vgnlowwall.txd/conc_slabgrey_256128.dds\",\"gta3.img/bs_sfs.txd/conc_slabgrey_256128.dds\",\n \"gta3.img/vgnretail72.txd/conc_slabgrey_256128.dds\",\"gta3.img/bs_sfs.txd/conc_slabgrey_256128.dds\",\n \"gta3.img/vgnshopnmall.txd/conc_slabgrey_256128.dds\",\"gta3.img/bs_sfs.txd/conc_slabgrey_256128.dds\",\n \"gta3.img/vgsecarshow.txd/conc_slabgrey_256128.dds\",\"gta3.img/bs_sfs.txd/conc_slabgrey_256128.dds\",\n \"gta3.img/vgsn_carpark01.txd/conc_slabgrey_256128.dds\",\"gta3.img/bs_sfs.txd/conc_slabgrey_256128.dds\",\n \"gta3.img/vgssland03.txd/conc_slabgrey_256128.dds\",\"gta3.img/bs_sfs.txd/conc_slabgrey_256128.dds\",\n \"gta3.img/vgwestboiga1.txd/conc_slabgrey_256128.dds\",\"gta3.img/bs_sfs.txd/conc_slabgrey_256128.dds\",\n \"gta3.img/vgwestretail1.txd/conc_slabgrey_256128.dds\",\"gta3.img/bs_sfs.txd/conc_slabgrey_256128.dds\",\n \"gta3.img/comet.txd/comet92interior128.dds\",\"gta3.img/buffalo.txd/buffalo92interior128.dds\",\n \"gta3.img/buildblk55.txd/sl_plazatile01.dds\",\"gta3.img/buildblk555.txd/sl_plazatile01.dds\",\n \"gta3.img/cityhall_lan.txd/sl_plazatile01.dds\",\"gta3.img/buildblk555.txd/sl_plazatile01.dds\",\n \"gta3.img/civic1_lan2.txd/sl_plazatile01.dds\",\"gta3.img/buildblk555.txd/sl_plazatile01.dds\",\n \"gta3.img/glenpark1_lae.txd/sl_plazatile01.dds\",\"gta3.img/buildblk555.txd/sl_plazatile01.dds\",\n \"gta3.img/lan2_gm1.txd/sl_plazatile01.dds\",\"gta3.img/buildblk555.txd/sl_plazatile01.dds\",\n \"gta3.img/skyscr1_lan2.txd/sl_plazatile01.dds\",\"gta3.img/buildblk555.txd/sl_plazatile01.dds\",\n \"gta3.img/skyscrap3_lan2.txd/sl_plazatile01.dds\",\"gta3.img/buildblk555.txd/sl_plazatile01.dds\",\n \"gta3.img/caravanprk_sfn.txd/sl_sfngrssdrt01.dds\",\"gta3.img/buildblk555.txd/sl_sfngrssdrt01.dds\",\n \"gta3.img/crparkgm_lan2.txd/sl_sfngrssdrt01.dds\",\"gta3.img/buildblk555.txd/sl_sfngrssdrt01.dds\",\n \"gta3.img/lan2freeway.txd/sl_sfngrssdrt01.dds\",\"gta3.img/buildblk555.txd/sl_sfngrssdrt01.dds\",\n \"gta3.img/lanroad.txd/sl_sfngrssdrt01.dds\",\"gta3.img/buildblk555.txd/sl_sfngrssdrt01.dds\",\n \"gta3.img/stapl.txd/sl_sfngrssdrt01.dds\",\"gta3.img/buildblk555.txd/sl_sfngrssdrt01.dds\",\n \"gta3.img/hashblock4_sfs.txd/ws_oldershop2.dds\",\"gta3.img/buildblk55.txd/ws_oldershop2.dds\",\n \"gta3.img/mission3_sfse.txd/ws_oldershop2.dds\",\"gta3.img/buildblk55.txd/ws_oldershop2.dds\",\n \"gta3.img/mission4_sfs.txd/ws_oldershop2.dds\",\"gta3.img/buildblk55.txd/ws_oldershop2.dds\",\n \"gta3.img/queens2_sfs.txd/ws_oldershop2.dds\",\"gta3.img/buildblk55.txd/ws_oldershop2.dds\",\n \"gta3.img/scum2_sfs.txd/ws_oldershop2.dds\",\"gta3.img/buildblk55.txd/ws_oldershop2.dds\",\n \"gta3.img/shops2_sfse.txd/ws_oldershop2.dds\",\"gta3.img/buildblk55.txd/ws_oldershop2.dds\",\n \"gta3.img/hashblock4_sfs.txd/ws_oldershop1.dds\",\"gta3.img/buildblk55.txd/ws_oldershop1.dds\",\n \"gta3.img/mission3_sfse.txd/ws_oldershop1.dds\",\"gta3.img/buildblk55.txd/ws_oldershop1.dds\",\n \"gta3.img/mission4_sfs.txd/ws_oldershop1.dds\",\"gta3.img/buildblk55.txd/ws_oldershop1.dds\",\n \"gta3.img/queens2_sfs.txd/ws_oldershop1.dds\",\"gta3.img/buildblk55.txd/ws_oldershop1.dds\",\n \"gta3.img/scum2_sfs.txd/ws_oldershop1.dds\",\"gta3.img/buildblk55.txd/ws_oldershop1.dds\",\n \"gta3.img/shops2_sfse.txd/ws_oldershop1.dds\",\"gta3.img/buildblk55.txd/ws_oldershop1.dds\",\n \"gta3.img/cecuntetunnel.txd/gb_nastybar03.dds\",\"gta3.img/buildblk55.txd/gb_nastybar03.dds\",\n \"gta3.img/ce_terminal.txd/gb_nastybar03.dds\",\"gta3.img/buildblk55.txd/gb_nastybar03.dds\",\n \"gta3.img/firehouse_sfse.txd/gb_nastybar03.dds\",\"gta3.img/buildblk55.txd/gb_nastybar03.dds\",\n \"gta3.img/glenpark1_lae.txd/gb_nastybar03.dds\",\"gta3.img/buildblk55.txd/gb_nastybar03.dds\",\n \"gta3.img/lae2bigblock.txd/gb_nastybar03.dds\",\"gta3.img/buildblk55.txd/gb_nastybar03.dds\",\n \"gta3.img/lahillsground4cye.txd/gb_nastybar03.dds\",\"gta3.img/buildblk55.txd/gb_nastybar03.dds\",\n \"gta3.img/lanlacmab_lan2.txd/gb_nastybar03.dds\",\"gta3.img/buildblk55.txd/gb_nastybar03.dds\",\n \"gta3.img/lawnbit.txd/gb_nastybar03.dds\",\"gta3.img/buildblk55.txd/gb_nastybar03.dds\",\n \"gta3.img/lawnbuy.txd/gb_nastybar03.dds\",\"gta3.img/buildblk55.txd/gb_nastybar03.dds\",\n \"gta3.img/lawngrnd.txd/gb_nastybar03.dds\",\"gta3.img/buildblk55.txd/gb_nastybar03.dds\",\n \"gta3.img/lawngrn.txd/gb_nastybar03.dds\",\"gta3.img/buildblk55.txd/gb_nastybar03.dds\",\n \"gta3.img/skyscrapelawn.txd/gb_nastybar03.dds\",\"gta3.img/buildblk55.txd/gb_nastybar03.dds\",\n \"gta3.img/sw_apartflat5.txd/gb_nastybar03.dds\",\"gta3.img/buildblk55.txd/gb_nastybar03.dds\",\n \"gta3.img/vegashse7.txd/gb_nastybar03.dds\",\"gta3.img/buildblk55.txd/gb_nastybar03.dds\",\n \"gta3.img/vegassvehse7.txd/gb_nastybar03.dds\",\"gta3.img/buildblk55.txd/gb_nastybar03.dds\",\n \"gta3.img/vgsebuild01.txd/gb_nastybar03.dds\",\"gta3.img/buildblk55.txd/gb_nastybar03.dds\",\n \"gta3.img/vgsswarehse02.txd/gb_nastybar03.dds\",\"gta3.img/buildblk55.txd/gb_nastybar03.dds\",\n \"gta3.img/vgwestland.txd/gb_nastybar03.dds\",\"gta3.img/buildblk55.txd/gb_nastybar03.dds\",\n \"gta_int.img/cj_bar2.txd/gb_nastybar03.dds\",\"gta3.img/buildblk55.txd/gb_nastybar03.dds\",\n \"gta3.img/vgntamotel.txd/drugstore256.dds\",\"gta3.img/buildblk55.txd/drugstore256.dds\",\n \"gta3.img/civic06_lan.txd/downtwin1.dds\",\"gta3.img/buildblk55.txd/downtwin1.dds\",\n \"gta3.img/civic07_lan.txd/downtwin1.dds\",\"gta3.img/buildblk55.txd/downtwin1.dds\",\n \"gta3.img/downtown1_las.txd/downtwin1.dds\",\"gta3.img/buildblk55.txd/downtwin1.dds\",\n \"gta3.img/ebeachcineblok.txd/downtwin1.dds\",\"gta3.img/buildblk55.txd/downtwin1.dds\",\n \"gta3.img/fighot.txd/downtwin1.dds\",\"gta3.img/buildblk55.txd/downtwin1.dds\",\n \"gta3.img/lanblokb2.txd/downtwin1.dds\",\"gta3.img/buildblk55.txd/downtwin1.dds\",\n \"gta3.img/lanblokb.txd/downtwin1.dds\",\"gta3.img/buildblk55.txd/downtwin1.dds\",\n \"gta3.img/gazlaw2.txd/lawshop4.dds\",\"gta3.img/buildblk55.txd/lawshop4.dds\",\n \"gta3.img/gazsfn1.txd/lawshop4.dds\",\"gta3.img/buildblk55.txd/lawshop4.dds\",\n \"gta3.img/mall_law.txd/lawshop4.dds\",\"gta3.img/buildblk55.txd/lawshop4.dds\",\n \"gta3.img/ground3_las.txd/snpdsqdoor.dds\",\"gta3.img/buildblk55.txd/snpdsqdoor.dds\",\n \"gta3.img/wasteland_las2.txd/snpdsqdoor.dds\",\"gta3.img/buildblk55.txd/snpdsqdoor.dds\",\n \"gta3.img/sunrise08_lawn.txd/holpac01_law.dds\",\"gta3.img/buildblk55.txd/holpac01_law.dds\",\n \"gta3.img/sfse_hubstuff.txd/ws_generatorside.dds\",\"gta3.img/buildingsitevge.txd/ws_generatorside.dds\",\n \"gta3.img/sfse_hubstuff.txd/ws_oldpaintedyello.dds\",\"gta3.img/buildingsitevge.txd/ws_oldpaintedyello.dds\",\n \"gta3.img/sfse_hubstuff.txd/ws_floodlight.dds\",\"gta3.img/buildingsitevge.txd/ws_floodlight.dds\",\n \"gta3.img/cuntwbridges.txd/telepole2128.dds\",\"gta3.img/buildingsitevge.txd/telepole2128.dds\",\n \"gta3.img/cw_changemecs_t.txd/telepole2128.dds\",\"gta3.img/buildingsitevge.txd/telepole2128.dds\",\n \"gta3.img/gay_xref.txd/telepole2128.dds\",\"gta3.img/buildingsitevge.txd/telepole2128.dds\",\n \"gta3.img/mtbfencecs_t.txd/telepole2128.dds\",\"gta3.img/buildingsitevge.txd/telepole2128.dds\",\n \"gta3.img/sf_telpole.txd/telepole2128.dds\",\"gta3.img/buildingsitevge.txd/telepole2128.dds\",\n \"gta3.img/sw_church.txd/telepole2128.dds\",\"gta3.img/buildingsitevge.txd/telepole2128.dds\",\n \"gta3.img/telegraph.txd/telepole2128.dds\",\"gta3.img/buildingsitevge.txd/telepole2128.dds\",\n \"gta3.img/vgntelepole.txd/telepole2128.dds\",\"gta3.img/buildingsitevge.txd/telepole2128.dds\",\n \"gta3.img/vgsncircon.txd/telepole2128.dds\",\"gta3.img/buildingsitevge.txd/telepole2128.dds\",\n \"gta3.img/vgstlgraphpole.txd/telepole2128.dds\",\"gta3.img/buildingsitevge.txd/telepole2128.dds\",\n \"gta_int.img/kickstart.txd/telepole2128.dds\",\"gta3.img/buildingsitevge.txd/telepole2128.dds\",\n \"gta3.img/cxref_desert.txd/boardgate_law.dds\",\"gta3.img/buildingsitevge.txd/boardgate_law.dds\",\n \"gta3.img/des_damquay.txd/boardgate_law.dds\",\"gta3.img/buildingsitevge.txd/boardgate_law.dds\",\n \"gta3.img/idlewood6_detail.txd/boardgate_law.dds\",\"gta3.img/buildingsitevge.txd/boardgate_law.dds\",\n \"gta3.img/jeffers4_lae.txd/boardgate_law.dds\",\"gta3.img/buildingsitevge.txd/boardgate_law.dds\",\n \"gta3.img/melrose06_lawn.txd/boardgate_law.dds\",\"gta3.img/buildingsitevge.txd/boardgate_law.dds\",\n \"gta3.img/mulhouslahills.txd/boardgate_law.dds\",\"gta3.img/buildingsitevge.txd/boardgate_law.dds\",\n \"gta3.img/park_sfw.txd/boardgate_law.dds\",\"gta3.img/buildingsitevge.txd/boardgate_law.dds\",\n \"gta3.img/sunset03_law2.txd/boardgate_law.dds\",\"gta3.img/buildingsitevge.txd/boardgate_law.dds\",\n \"gta3.img/sunstrans_law2.txd/boardgate_law.dds\",\"gta3.img/buildingsitevge.txd/boardgate_law.dds\",\n \"gta3.img/vgncnstrct1.txd/boardgate_law.dds\",\"gta3.img/buildingsitevge.txd/boardgate_law.dds\",\n \"gta3.img/vgsecnstrctfence.txd/boardgate_law.dds\",\"gta3.img/buildingsitevge.txd/boardgate_law.dds\",\n \"gta3.img/vgsecnstrctfence.txd/ws_woodenscreen1.dds\",\"gta3.img/buildingsitevge.txd/ws_woodenscreen1.dds\",\n \"gta3.img/gazlaw1.txd/lawshopwall4.dds\",\"gta3.img/buildtestlawn.txd/lawshopwall4.dds\",\n \"gta3.img/gazlaw2.txd/lawshopwall4.dds\",\"gta3.img/buildtestlawn.txd/lawshopwall4.dds\",\n \"gta3.img/gazsfn1.txd/lawshopwall4.dds\",\"gta3.img/buildtestlawn.txd/lawshopwall4.dds\",\n \"gta3.img/law_beach2.txd/lawshopwall4.dds\",\"gta3.img/buildtestlawn.txd/lawshopwall4.dds\",\n \"gta3.img/melrose02_lawn.txd/lawshopwall4.dds\",\"gta3.img/buildtestlawn.txd/lawshopwall4.dds\",\n \"gta3.img/melrose05_lawn.txd/lawshopwall4.dds\",\"gta3.img/buildtestlawn.txd/lawshopwall4.dds\",\n \"gta3.img/melrose08_lawn.txd/lawshopwall4.dds\",\"gta3.img/buildtestlawn.txd/lawshopwall4.dds\",\n \"gta3.img/melrose19_lawn.txd/lawshopwall4.dds\",\"gta3.img/buildtestlawn.txd/lawshopwall4.dds\",\n \"gta3.img/sunsetbittyu.txd/lawshopwall4.dds\",\"gta3.img/buildtestlawn.txd/lawshopwall4.dds\",\n \"gta3.img/telewirelawn.txd/lawshopwall4.dds\",\"gta3.img/buildtestlawn.txd/lawshopwall4.dds\",\n \"gta3.img/venchouse_lax.txd/lawshopwall4.dds\",\"gta3.img/buildtestlawn.txd/lawshopwall4.dds\",\n \"gta3.img/compomark_lae2.txd/alleydoor8.dds\",\"gta3.img/buildtestlawn.txd/alleydoor8.dds\",\n \"gta3.img/eastbeach2a_lae2.txd/alleydoor8.dds\",\"gta3.img/buildtestlawn.txd/alleydoor8.dds\",\n \"gta3.img/eastbeach3c_lae2.txd/alleydoor8.dds\",\"gta3.img/buildtestlawn.txd/alleydoor8.dds\",\n \"gta3.img/eastshops1_lae.txd/alleydoor8.dds\",\"gta3.img/buildtestlawn.txd/alleydoor8.dds\",\n \"gta3.img/ganton01_lae2.txd/alleydoor8.dds\",\"gta3.img/buildtestlawn.txd/alleydoor8.dds\",\n \"gta3.img/garaged_lawn.txd/alleydoor8.dds\",\"gta3.img/buildtestlawn.txd/alleydoor8.dds\",\n \"gta3.img/gazlaw3.txd/alleydoor8.dds\",\"gta3.img/buildtestlawn.txd/alleydoor8.dds\",\n \"gta3.img/ground_las2.txd/alleydoor8.dds\",\"gta3.img/buildtestlawn.txd/alleydoor8.dds\",\n \"gta3.img/imrancomp_las2.txd/alleydoor8.dds\",\"gta3.img/buildtestlawn.txd/alleydoor8.dds\",\n \"gta3.img/lashops1b_las2.txd/alleydoor8.dds\",\"gta3.img/buildtestlawn.txd/alleydoor8.dds\",\n \"gta3.img/lashops1_las2.txd/alleydoor8.dds\",\"gta3.img/buildtestlawn.txd/alleydoor8.dds\",\n \"gta3.img/oldgarage_sfse.txd/alleydoor8.dds\",\"gta3.img/buildtestlawn.txd/alleydoor8.dds\",\n \"gta3.img/oldshops_las.txd/alleydoor8.dds\",\"gta3.img/buildtestlawn.txd/alleydoor8.dds\",\n \"gta3.img/shopliquor_las.txd/alleydoor8.dds\",\"gta3.img/buildtestlawn.txd/alleydoor8.dds\",\n \"gta3.img/stuff2_sfn.txd/alleydoor8.dds\",\"gta3.img/buildtestlawn.txd/alleydoor8.dds\",\n \"gta3.img/subshops_sfs.txd/alleydoor8.dds\",\"gta3.img/buildtestlawn.txd/alleydoor8.dds\",\n \"gta3.img/vegasbuild.txd/alleydoor8.dds\",\"gta3.img/buildtestlawn.txd/alleydoor8.dds\",\n \"gta3.img/vgeretail1.txd/alleydoor8.dds\",\"gta3.img/buildtestlawn.txd/alleydoor8.dds\",\n \"gta3.img/vgnhseing1.txd/alleydoor8.dds\",\"gta3.img/buildtestlawn.txd/alleydoor8.dds\",\n \"gta3.img/vgnpwrmainbld.txd/alleydoor8.dds\",\"gta3.img/buildtestlawn.txd/alleydoor8.dds\",\n \"gta3.img/vgnretail5.txd/alleydoor8.dds\",\"gta3.img/buildtestlawn.txd/alleydoor8.dds\",\n \"gta3.img/vgsebuild01.txd/alleydoor8.dds\",\"gta3.img/buildtestlawn.txd/alleydoor8.dds\",\n \"gta3.img/vgsebuild02.txd/alleydoor8.dds\",\"gta3.img/buildtestlawn.txd/alleydoor8.dds\",\n \"gta3.img/vgsewrehse.txd/alleydoor8.dds\",\"gta3.img/buildtestlawn.txd/alleydoor8.dds\",\n \"gta3.img/vgsswarehse02.txd/alleydoor8.dds\",\"gta3.img/buildtestlawn.txd/alleydoor8.dds\",\n \"gta_int.img/genintwarehsint3.txd/alleydoor8.dds\",\"gta3.img/buildtestlawn.txd/alleydoor8.dds\",\n \"gta_int.img/smashtv.txd/alleydoor8.dds\",\"gta3.img/buildtestlawn.txd/alleydoor8.dds\",\n \"gta_int.img/steve_doors.txd/alleydoor8.dds\",\"gta3.img/buildtestlawn.txd/alleydoor8.dds\",\n \"gta3.img/gnhotel1.txd/yellowrust_64.dds\",\"gta3.img/buoy.txd/yellowrust_64.dds\",\n \"gta3.img/vgssairport02.txd/yellowrust_64.dds\",\"gta3.img/buoy.txd/yellowrust_64.dds\",\n \"gta3.img/vgssmulticarprk.txd/yellowrust_64.dds\",\"gta3.img/buoy.txd/yellowrust_64.dds\",\n \"gta_int.img/kickstart.txd/yellowrust_64.dds\",\"gta3.img/buoy.txd/yellowrust_64.dds\",\n \"gta3.img/cunte_bar1.txd/bow_loadingbaydoor.dds\",\"gta3.img/burgalrystore_sfse.txd/bow_loadingbaydoor.dds\",\n \"gta3.img/cw2_photoblockcs_t.txd/bow_loadingbaydoor.dds\",\"gta3.img/burgalrystore_sfse.txd/bow_loadingbaydoor.dds\",\n \"gta3.img/sunst18_lawn.txd/bow_loadingbaydoor.dds\",\"gta3.img/burgalrystore_sfse.txd/bow_loadingbaydoor.dds\",\n \"gta3.img/sw_fact01a.txd/bow_loadingbaydoor.dds\",\"gta3.img/burgalrystore_sfse.txd/bow_loadingbaydoor.dds\",\n \"gta3.img/sw_ware01.txd/bow_loadingbaydoor.dds\",\"gta3.img/burgalrystore_sfse.txd/bow_loadingbaydoor.dds\",\n \"gta3.img/truckedepotlawn.txd/bow_loadingbaydoor.dds\",\"gta3.img/burgalrystore_sfse.txd/bow_loadingbaydoor.dds\",\n \"gta3.img/vgnfrates.txd/bow_loadingbaydoor.dds\",\"gta3.img/burgalrystore_sfse.txd/bow_loadingbaydoor.dds\",\n \"gta3.img/vgsewrehse.txd/bow_loadingbaydoor.dds\",\"gta3.img/burgalrystore_sfse.txd/bow_loadingbaydoor.dds\",\n \"gta3.img/vgsswarehse02c.txd/bow_loadingbaydoor.dds\",\"gta3.img/burgalrystore_sfse.txd/bow_loadingbaydoor.dds\",\n \"gta3.img/vgsswarehse02.txd/bow_loadingbaydoor.dds\",\"gta3.img/burgalrystore_sfse.txd/bow_loadingbaydoor.dds\",\n \"gta3.img/w_town3cs_t.txd/bow_loadingbaydoor.dds\",\"gta3.img/burgalrystore_sfse.txd/bow_loadingbaydoor.dds\",\n \"gta3.img/hashblock4_sfs.txd/ws_altz_wall2bluetop.dds\",\"gta3.img/burgalrystore_sfse.txd/ws_altz_wall2bluetop.dds\",\n \"gta3.img/factorynewsfse.txd/ws_whousedoor1.dds\",\"gta3.img/burgalrystore_sfse.txd/ws_whousedoor1.dds\",\n \"gta3.img/genwhse_sfse.txd/ws_whousedoor1.dds\",\"gta3.img/burgalrystore_sfse.txd/ws_whousedoor1.dds\",\n \"gta3.img/genwhse_sfs.txd/ws_whousedoor1.dds\",\"gta3.img/burgalrystore_sfse.txd/ws_whousedoor1.dds\",\n \"gta3.img/pierc_law2.txd/ws_whousedoor1.dds\",\"gta3.img/burgalrystore_sfse.txd/ws_whousedoor1.dds\",\n \"gta3.img/cos_bankroofs.txd/ws_warehswin2.dds\",\"gta3.img/burgalrystore_sfse.txd/ws_warehswin2.dds\",\n \"gta3.img/genwhse_sfse.txd/ws_harryplums.dds\",\"gta3.img/burgalrystore_sfse.txd/ws_harryplums.dds\",\n \"gta3.img/des_nwtownw.txd/burgroof01_law.dds\",\"gta3.img/burgsh01_law.txd/burgroof01_law.dds\",\n \"gta3.img/ground2_las2.txd/newall2.dds\",\"gta3.img/burgsh01_law.txd/newall2.dds\",\n \"gta3.img/idlewood6_lae.txd/newall2.dds\",\"gta3.img/burgsh01_law.txd/newall2.dds\",\n \"gta3.img/vgsebuild01.txd/newall2.dds\",\"gta3.img/burgsh01_law.txd/newall2.dds\",\n \"gta3.img/warehus_las2.txd/newall2.dds\",\"gta3.img/burgsh01_law.txd/newall2.dds\",\n \"gta3.img/griffobs_las.txd/plantb256.dds\",\"gta3.img/burnsalpha.txd/plantb256.dds\",\n \"gta3.img/hub_alpha.txd/plantb256.dds\",\"gta3.img/burnsalpha.txd/plantb256.dds\",\n \"gta3.img/lae2coast_alpha.txd/plantb256.dds\",\"gta3.img/burnsalpha.txd/plantb256.dds\",\n \"gta3.img/lawalphav.txd/plantb256.dds\",\"gta3.img/burnsalpha.txd/plantb256.dds\",\n \"gta3.img/easthills_lahills.txd/indund_64.dds\",\"gta3.img/burnsground.txd/indund_64.dds\",\n \"gta3.img/lae2bridge.txd/indund_64.dds\",\"gta3.img/burnsground.txd/indund_64.dds\",\n \"gta3.img/lae2roadscoast.txd/indund_64.dds\",\"gta3.img/burnsground.txd/indund_64.dds\",\n \"gta3.img/rodeoprk_law2.txd/indund_64.dds\",\"gta3.img/burnsground.txd/indund_64.dds\",\n \"gta3.img/vgnland.txd/indund_64.dds\",\"gta3.img/burnsground.txd/indund_64.dds\",\n \"gta3.img/glenpark1x_lae.txd/ahoodgardr.dds\",\"gta3.img/burnsground.txd/ahoodgardr.dds\",\n \"gta3.img/ground4_las.txd/ahoodgardr.dds\",\"gta3.img/burnsground.txd/ahoodgardr.dds\",\n \"gta3.img/ground5_las.txd/ahoodgardr.dds\",\"gta3.img/burnsground.txd/ahoodgardr.dds\",\n \"gta3.img/jeffers4_lae.txd/ahoodgardr.dds\",\"gta3.img/burnsground.txd/ahoodgardr.dds\",\n \"gta3.img/lae2grnd.txd/ahoodgardr.dds\",\"gta3.img/burnsground.txd/ahoodgardr.dds\",\n \"gta3.img/landlae2c.txd/ahoodgardr.dds\",\"gta3.img/burnsground.txd/ahoodgardr.dds\",\n \"gta3.img/mulhousclahills.txd/ahoodgardr.dds\",\"gta3.img/burnsground.txd/ahoodgardr.dds\",\n \"gta3.img/cemetery_law.txd/dirtyredwall512.dds\",\"gta3.img/burnsground.txd/dirtyredwall512.dds\",\n \"gta3.img/chateau_lawn.txd/dirtyredwall512.dds\",\"gta3.img/burnsground.txd/dirtyredwall512.dds\",\n \"gta3.img/glenpark6_lae.txd/dirtyredwall512.dds\",\"gta3.img/burnsground.txd/dirtyredwall512.dds\",\n \"gta3.img/lae2grnd.txd/dirtyredwall512.dds\",\"gta3.img/burnsground.txd/dirtyredwall512.dds\",\n \"gta3.img/cetown3cs_t.txd/newall10_seamless.dds\",\"gta3.img/burnsground.txd/newall10_seamless.dds\",\n \"gta3.img/cw2_storesnstuff.txd/newall10_seamless.dds\",\"gta3.img/burnsground.txd/newall10_seamless.dds\",\n \"gta3.img/lae2grnd.txd/newall10_seamless.dds\",\"gta3.img/burnsground.txd/newall10_seamless.dds\",\n \"gta3.img/landlae2b.txd/newall10_seamless.dds\",\"gta3.img/burnsground.txd/newall10_seamless.dds\",\n \"gta3.img/landlae2c.txd/newall10_seamless.dds\",\"gta3.img/burnsground.txd/newall10_seamless.dds\",\n \"gta3.img/queensparks_sfs.txd/newall10_seamless.dds\",\"gta3.img/burnsground.txd/newall10_seamless.dds\",\n \"gta3.img/sprunkworks.txd/newall10_seamless.dds\",\"gta3.img/burnsground.txd/newall10_seamless.dds\",\n \"gta3.img/stuff2_sfn.txd/newall10_seamless.dds\",\"gta3.img/burnsground.txd/newall10_seamless.dds\",\n \"gta3.img/sw_apartflat.txd/newall10_seamless.dds\",\"gta3.img/burnsground.txd/newall10_seamless.dds\",\n \"gta3.img/vict_sfw.txd/newall10_seamless.dds\",\"gta3.img/burnsground.txd/newall10_seamless.dds\",\n \"gta3.img/ce_bankalley1.txd/bluapartwall1_256.dds\",\"gta3.img/burnsground.txd/bluapartwall1_256.dds\",\n \"gta3.img/ce_bankalley3.txd/bluapartwall1_256.dds\",\"gta3.img/burnsground.txd/bluapartwall1_256.dds\",\n \"gta3.img/comedhos1_la.txd/bluapartwall1_256.dds\",\"gta3.img/burnsground.txd/bluapartwall1_256.dds\",\n \"gta3.img/cos_pizzaplace.txd/bluapartwall1_256.dds\",\"gta3.img/burnsground.txd/bluapartwall1_256.dds\",\n \"gta3.img/des_stownstrip2.txd/bluapartwall1_256.dds\",\"gta3.img/burnsground.txd/bluapartwall1_256.dds\",\n \"gta3.img/eastbeach09_lae2.txd/bluapartwall1_256.dds\",\"gta3.img/burnsground.txd/bluapartwall1_256.dds\",\n \"gta3.img/eastbeach2a_lae2.txd/bluapartwall1_256.dds\",\"gta3.img/burnsground.txd/bluapartwall1_256.dds\",\n \"gta3.img/eastbeach4a_lae2.txd/bluapartwall1_256.dds\",\"gta3.img/burnsground.txd/bluapartwall1_256.dds\",\n \"gta3.img/eastls1_lae2.txd/bluapartwall1_256.dds\",\"gta3.img/burnsground.txd/bluapartwall1_256.dds\",\n \"gta3.img/gymblok2_lae2.txd/bluapartwall1_256.dds\",\"gta3.img/burnsground.txd/bluapartwall1_256.dds\",\n \"gta3.img/hashblock3_sfs.txd/bluapartwall1_256.dds\",\"gta3.img/burnsground.txd/bluapartwall1_256.dds\",\n \"gta3.img/hashmarket1_sfs.txd/bluapartwall1_256.dds\",\"gta3.img/burnsground.txd/bluapartwall1_256.dds\",\n \"gta3.img/hillhousex4_5.txd/bluapartwall1_256.dds\",\"gta3.img/burnsground.txd/bluapartwall1_256.dds\",\n \"gta3.img/jeffers5a_lae.txd/bluapartwall1_256.dds\",\"gta3.img/burnsground.txd/bluapartwall1_256.dds\",\n \"gta3.img/lahillshilhs1x.txd/bluapartwall1_256.dds\",\"gta3.img/burnsground.txd/bluapartwall1_256.dds\",\n \"gta3.img/melrose03_lawn.txd/bluapartwall1_256.dds\",\"gta3.img/burnsground.txd/bluapartwall1_256.dds\",\n \"gta3.img/melrose13_lawn.txd/bluapartwall1_256.dds\",\"gta3.img/burnsground.txd/bluapartwall1_256.dds\",\n \"gta3.img/sfn_apart02sfn.txd/bluapartwall1_256.dds\",\"gta3.img/burnsground.txd/bluapartwall1_256.dds\",\n \"gta3.img/sfn_helipad.txd/bluapartwall1_256.dds\",\"gta3.img/burnsground.txd/bluapartwall1_256.dds\",\n \"gta3.img/subshops_sfs.txd/bluapartwall1_256.dds\",\"gta3.img/burnsground.txd/bluapartwall1_256.dds\",\n \"gta3.img/sunrise08_lawn.txd/bluapartwall1_256.dds\",\"gta3.img/burnsground.txd/bluapartwall1_256.dds\",\n \"gta3.img/sunset02_law2.txd/bluapartwall1_256.dds\",\"gta3.img/burnsground.txd/bluapartwall1_256.dds\",\n \"gta3.img/templae2land.txd/bluapartwall1_256.dds\",\"gta3.img/burnsground.txd/bluapartwall1_256.dds\",\n \"gta3.img/vegashse2.txd/bluapartwall1_256.dds\",\"gta3.img/burnsground.txd/bluapartwall1_256.dds\",\n \"gta3.img/venchouse_lax.txd/bluapartwall1_256.dds\",\"gta3.img/burnsground.txd/bluapartwall1_256.dds\",\n \"gta3.img/vgncorp1.txd/bluapartwall1_256.dds\",\"gta3.img/burnsground.txd/bluapartwall1_256.dds\",\n \"gta3.img/vgnfrates.txd/bluapartwall1_256.dds\",\"gta3.img/burnsground.txd/bluapartwall1_256.dds\",\n \"gta3.img/vgnretail2.txd/bluapartwall1_256.dds\",\"gta3.img/burnsground.txd/bluapartwall1_256.dds\",\n \"gta3.img/vgnretail7.txd/bluapartwall1_256.dds\",\"gta3.img/burnsground.txd/bluapartwall1_256.dds\",\n \"gta3.img/canalsg_law.txd/laroad_offroad1.dds\",\"gta3.img/burnsground.txd/laroad_offroad1.dds\",\n \"gta3.img/civic03_lan.txd/laroad_offroad1.dds\",\"gta3.img/burnsground.txd/laroad_offroad1.dds\",\n \"gta3.img/eastbeach2a_lae2.txd/laroad_offroad1.dds\",\"gta3.img/burnsground.txd/laroad_offroad1.dds\",\n \"gta3.img/hub_alpha.txd/laroad_offroad1.dds\",\"gta3.img/burnsground.txd/laroad_offroad1.dds\",\n \"gta3.img/lae2roadscoast.txd/laroad_offroad1.dds\",\"gta3.img/burnsground.txd/laroad_offroad1.dds\",\n \"gta3.img/lae2roadshub.txd/laroad_offroad1.dds\",\"gta3.img/burnsground.txd/laroad_offroad1.dds\",\n \"gta3.img/lae2roads.txd/laroad_offroad1.dds\",\"gta3.img/burnsground.txd/laroad_offroad1.dds\",\n \"gta3.img/laeroads.txd/laroad_offroad1.dds\",\"gta3.img/burnsground.txd/laroad_offroad1.dds\",\n \"gta3.img/lahillsla_roads.txd/laroad_offroad1.dds\",\"gta3.img/burnsground.txd/laroad_offroad1.dds\",\n \"gta3.img/lan2freeway.txd/laroad_offroad1.dds\",\"gta3.img/burnsground.txd/laroad_offroad1.dds\",\n \"gta3.img/landhub.txd/laroad_offroad1.dds\",\"gta3.img/burnsground.txd/laroad_offroad1.dds\",\n \"gta3.img/landlae2b.txd/laroad_offroad1.dds\",\"gta3.img/burnsground.txd/laroad_offroad1.dds\",\n \"gta3.img/lanroad.txd/laroad_offroad1.dds\",\"gta3.img/burnsground.txd/laroad_offroad1.dds\",\n \"gta3.img/law2_roadsb.txd/laroad_offroad1.dds\",\"gta3.img/burnsground.txd/laroad_offroad1.dds\",\n \"gta3.img/lawland2.txd/laroad_offroad1.dds\",\"gta3.img/burnsground.txd/laroad_offroad1.dds\",\n \"gta3.img/roads_lawn.txd/laroad_offroad1.dds\",\"gta3.img/burnsground.txd/laroad_offroad1.dds\",\n \"gta3.img/roads_tunnellahills.txd/laroad_offroad1.dds\",\"gta3.img/burnsground.txd/laroad_offroad1.dds\",\n \"gta3.img/skyscrap2_lan2.txd/laroad_offroad1.dds\",\"gta3.img/burnsground.txd/laroad_offroad1.dds\",\n \"gta3.img/stormdrain_las2.txd/laroad_offroad1.dds\",\"gta3.img/burnsground.txd/laroad_offroad1.dds\",\n \"gta3.img/chemgrnd_las2.txd/newall1-1128.dds\",\"gta3.img/burnsground.txd/newall1-1128.dds\",\n \"gta3.img/glenpark1x_lae.txd/newall1-1128.dds\",\"gta3.img/burnsground.txd/newall1-1128.dds\",\n \"gta3.img/idlewood3_lae.txd/newall1-1128.dds\",\"gta3.img/burnsground.txd/newall1-1128.dds\",\n \"gta3.img/industry3_las2.txd/newall1-1128.dds\",\"gta3.img/burnsground.txd/newall1-1128.dds\",\n \"gta3.img/lashops93_las2.txd/newall1-1128.dds\",\"gta3.img/burnsground.txd/newall1-1128.dds\",\n \"gta3.img/railway_las.txd/newall1-1128.dds\",\"gta3.img/burnsground.txd/newall1-1128.dds\",\n \"gta3.img/warehus_las2.txd/newall1-1128.dds\",\"gta3.img/burnsground.txd/newall1-1128.dds\",\n \"gta3.img/picador.txd/picador92interior128.dds\",\"gta3.img/burrito.txd/burrito92interior128.dds\",\n \"gta3.img/rumpo.txd/rumpo92interior128.dds\",\"gta3.img/burrito.txd/burrito92interior128.dds\",\n \"gta3.img/copcarru.txd/rancher92wheel64.dds\",\"gta3.img/burrito.txd/burrito92wheel64.dds\",\n \"gta3.img/fbiranch.txd/rancher92wheel64.dds\",\"gta3.img/burrito.txd/burrito92wheel64.dds\",\n \"gta3.img/picador.txd/utility92wheel64.dds\",\"gta3.img/burrito.txd/burrito92wheel64.dds\",\n \"gta3.img/rancher.txd/rancher92wheel64.dds\",\"gta3.img/burrito.txd/burrito92wheel64.dds\",\n \"gta3.img/rnchlure.txd/rancher92wheel64.dds\",\"gta3.img/burrito.txd/burrito92wheel64.dds\",\n \"gta3.img/utility.txd/utility92wheel64.dds\",\"gta3.img/burrito.txd/burrito92wheel64.dds\",\n \"gta_int.img/cj_ammo.txd/cj_greenmetal.dds\",\"gta3.img/bustopm.txd/cj_greenmetal.dds\",\n \"gta_int.img/cj_burg_sign.txd/cj_greenmetal.dds\",\"gta3.img/bustopm.txd/cj_greenmetal.dds\",\n \"gta_int.img/cj_cb_sign.txd/cj_greenmetal.dds\",\"gta3.img/bustopm.txd/cj_greenmetal.dds\",\n \"gta_int.img/cj_don_sign.txd/cj_greenmetal.dds\",\"gta3.img/bustopm.txd/cj_greenmetal.dds\",\n \"gta_int.img/cj_ff_acc1.txd/cj_greenmetal.dds\",\"gta3.img/bustopm.txd/cj_greenmetal.dds\",\n \"gta_int.img/cj_piz_sign.txd/cj_greenmetal.dds\",\"gta3.img/bustopm.txd/cj_greenmetal.dds\",\n \"gta_int.img/cj_ss_1.txd/cj_greenmetal.dds\",\"gta3.img/bustopm.txd/cj_greenmetal.dds\",\n \"gta3.img/vgntrainstat.txd/cj_bs_menu5.dds\",\"gta3.img/bustopm.txd/cj_bs_menu5.dds\",\n \"gta_int.img/cj_burg_sign2.txd/cj_bs_menu5.dds\",\"gta3.img/bustopm.txd/cj_bs_menu5.dds\",\n \"gta3.img/coach.txd/coach92wheel64.dds\",\"gta3.img/bus.txd/dash92wheel64.dds\",\n \"gta3.img/securica.txd/securica92wheel64.dds\",\"gta3.img/bus.txd/dash92wheel64.dds\",\n \"gta3.img/coach.txd/coach92decals128.dds\",\"gta3.img/bus.txd/bus92decals128.dds\",\n \"gta3.img/cables_sfw.txd/dt_overwire_t.dds\",\"gta3.img/cables_sfe.txd/dt_overwire_t.dds\",\n \"gta3.img/pier_law.txd/dt_overwire_t.dds\",\"gta3.img/cables_sfe.txd/dt_overwire_t.dds\",\n \"gta3.img/romero.txd/romero92wheel64.dds\",\"gta3.img/cadrona.txd/cadrona92wheel64.dds\",\n \"gta3.img/sentinel.txd/sentinel92wheel64.dds\",\"gta3.img/cadrona.txd/cadrona92wheel64.dds\",\n \"gta3.img/washing.txd/washing92wheel64.dds\",\"gta3.img/cadrona.txd/cadrona92wheel64.dds\",\n \"gta3.img/sentinel.txd/sentinel92interior128.dds\",\"gta3.img/cadrona.txd/cadrona92interior128.dds\",\n \"gta3.img/flamingo1.txd/slidingdoor01_128.dds\",\"gta3.img/calfed_sfe.txd/slidingdoor01_128.dds\",\n \"gta3.img/hosbibalsfw.txd/slidingdoor01_128.dds\",\"gta3.img/calfed_sfe.txd/slidingdoor01_128.dds\",\n \"gta3.img/sphinx01.txd/slidingdoor01_128.dds\",\"gta3.img/calfed_sfe.txd/slidingdoor01_128.dds\",\n \"gta3.img/vgssairport.txd/slidingdoor01_128.dds\",\"gta3.img/calfed_sfe.txd/slidingdoor01_128.dds\",\n \"gta3.img/hashblock1b_sfs.txd/sw_brewbrick01.dds\",\"gta3.img/canalsg_law.txd/sw_brewbrick01.dds\",\n \"gta3.img/hashblock1_sfs.txd/sw_brewbrick01.dds\",\"gta3.img/canalsg_law.txd/sw_brewbrick01.dds\",\n \"gta3.img/hashblock1z_sfs.txd/sw_brewbrick01.dds\",\"gta3.img/canalsg_law.txd/sw_brewbrick01.dds\",\n \"gta3.img/resicarpark.txd/sw_brewbrick01.dds\",\"gta3.img/canalsg_law.txd/sw_brewbrick01.dds\",\n \"gta3.img/sfvictorian.txd/sw_brewbrick01.dds\",\"gta3.img/canalsg_law.txd/sw_brewbrick01.dds\",\n \"gta3.img/sw_apartflatx.txd/sw_brewbrick01.dds\",\"gta3.img/canalsg_law.txd/sw_brewbrick01.dds\",\n \"gta3.img/sw_block01.txd/sw_brewbrick01.dds\",\"gta3.img/canalsg_law.txd/sw_brewbrick01.dds\",\n \"gta3.img/sw_block11a.txd/sw_brewbrick01.dds\",\"gta3.img/canalsg_law.txd/sw_brewbrick01.dds\",\n \"gta3.img/sw_block11.txd/sw_brewbrick01.dds\",\"gta3.img/canalsg_law.txd/sw_brewbrick01.dds\",\n \"gta3.img/sw_brewery.txd/sw_brewbrick01.dds\",\"gta3.img/canalsg_law.txd/sw_brewbrick01.dds\",\n \"gta3.img/sw_fact01a.txd/sw_brewbrick01.dds\",\"gta3.img/canalsg_law.txd/sw_brewbrick01.dds\",\n \"gta3.img/vgnusedcar.txd/sw_brewbrick01.dds\",\"gta3.img/canalsg_law.txd/sw_brewbrick01.dds\",\n \"gta3.img/vgsecarshow.txd/sw_brewbrick01.dds\",\"gta3.img/canalsg_law.txd/sw_brewbrick01.dds\",\n \"gta3.img/coveredpath_sfs.txd/ws_sheetwood_clean.dds\",\"gta3.img/canalsg_law.txd/ws_sheetwood_clean.dds\",\n \"gta3.img/hashmarket_sfsx.txd/ws_sheetwood_clean.dds\",\"gta3.img/canalsg_law.txd/ws_sheetwood_clean.dds\",\n \"gta3.img/scum2_sfs.txd/ws_sheetwood_clean.dds\",\"gta3.img/canalsg_law.txd/ws_sheetwood_clean.dds\",\n \"gta3.img/sw_furniture.txd/ws_sheetwood_clean.dds\",\"gta3.img/canalsg_law.txd/ws_sheetwood_clean.dds\",\n \"gta3.img/xrfcrates_sfs.txd/ws_sheetwood_clean.dds\",\"gta3.img/canalsg_law.txd/ws_sheetwood_clean.dds\",\n \"gta_int.img/gb_kitchtake.txd/ws_sheetwood_clean.dds\",\"gta3.img/canalsg_law.txd/ws_sheetwood_clean.dds\",\n \"gta_int.img/gb_takeaway01.txd/ws_sheetwood_clean.dds\",\"gta3.img/canalsg_law.txd/ws_sheetwood_clean.dds\",\n \"gta_int.img/maint1.txd/ws_sheetwood_clean.dds\",\"gta3.img/canalsg_law.txd/ws_sheetwood_clean.dds\",\n \"gta3.img/chateau_lawn.txd/block2bb.dds\",\"gta3.img/canalsg_law.txd/block2bb.dds\",\n \"gta3.img/copshop_sfe.txd/block2bb.dds\",\"gta3.img/canalsg_law.txd/block2bb.dds\",\n \"gta3.img/des_bighus.txd/block2bb.dds\",\"gta3.img/canalsg_law.txd/block2bb.dds\",\n \"gta3.img/luxorpillar04.txd/block2bb.dds\",\"gta3.img/canalsg_law.txd/block2bb.dds\",\n \"gta3.img/luxorpillar1.txd/block2bb.dds\",\"gta3.img/canalsg_law.txd/block2bb.dds\",\n \"gta3.img/roads_law.txd/block2bb.dds\",\"gta3.img/canalsg_law.txd/block2bb.dds\",\n \"gta3.img/ws_jetty_sfx.txd/pierlegs.dds\",\"gta3.img/canalsg_law.txd/pierlegs.dds\",\n \"gta_int.img/barrier.txd/pierlegs.dds\",\"gta3.img/canalsg_law.txd/pierlegs.dds\",\n \"gta3.img/coastground.txd/bow_church_grass_gen.dds\",\"gta3.img/canalsg_law.txd/bow_church_grass_gen.dds\",\n \"gta3.img/crparkgm_lan2.txd/bow_church_grass_gen.dds\",\"gta3.img/canalsg_law.txd/bow_church_grass_gen.dds\",\n \"gta3.img/gazlaw1.txd/bow_church_grass_gen.dds\",\"gta3.img/canalsg_law.txd/bow_church_grass_gen.dds\",\n \"gta3.img/grsbitsfe.txd/bow_church_grass_gen.dds\",\"gta3.img/canalsg_law.txd/bow_church_grass_gen.dds\",\n \"gta3.img/lanblokg.txd/bow_church_grass_gen.dds\",\"gta3.img/canalsg_law.txd/bow_church_grass_gen.dds\",\n \"gta3.img/miragecasino2.txd/bow_church_grass_gen.dds\",\"gta3.img/canalsg_law.txd/bow_church_grass_gen.dds\",\n \"gta3.img/sw_fact01.txd/bow_church_grass_gen.dds\",\"gta3.img/canalsg_law.txd/bow_church_grass_gen.dds\",\n \"gta3.img/tramstatsfw.txd/bow_church_grass_gen.dds\",\"gta3.img/canalsg_law.txd/bow_church_grass_gen.dds\",\n \"gta3.img/vgndwntwn21.txd/bow_church_grass_gen.dds\",\"gta3.img/canalsg_law.txd/bow_church_grass_gen.dds\",\n \"gta3.img/vgnewhsewal.txd/bow_church_grass_gen.dds\",\"gta3.img/canalsg_law.txd/bow_church_grass_gen.dds\",\n \"gta3.img/vgnfrates.txd/bow_church_grass_gen.dds\",\"gta3.img/canalsg_law.txd/bow_church_grass_gen.dds\",\n \"gta3.img/vgnland.txd/bow_church_grass_gen.dds\",\"gta3.img/canalsg_law.txd/bow_church_grass_gen.dds\",\n \"gta3.img/vgnhseing1.txd/bow_church_grass_gen.dds\",\"gta3.img/canalsg_law.txd/bow_church_grass_gen.dds\",\n \"gta3.img/vgnhseland.txd/bow_church_grass_gen.dds\",\"gta3.img/canalsg_law.txd/bow_church_grass_gen.dds\",\n \"gta3.img/vgnshambild1.txd/bow_church_grass_gen.dds\",\"gta3.img/canalsg_law.txd/bow_church_grass_gen.dds\",\n \"gta3.img/vgsehseing1.txd/bow_church_grass_gen.dds\",\"gta3.img/canalsg_law.txd/bow_church_grass_gen.dds\",\n \"gta3.img/vgsnbuild07.txd/bow_church_grass_gen.dds\",\"gta3.img/canalsg_law.txd/bow_church_grass_gen.dds\",\n \"gta3.img/vgsn_flwbdcrb.txd/bow_church_grass_gen.dds\",\"gta3.img/canalsg_law.txd/bow_church_grass_gen.dds\",\n \"gta3.img/vgsn_rbstiff.txd/bow_church_grass_gen.dds\",\"gta3.img/canalsg_law.txd/bow_church_grass_gen.dds\",\n \"gta3.img/vgssairport.txd/bow_church_grass_gen.dds\",\"gta3.img/canalsg_law.txd/bow_church_grass_gen.dds\",\n \"gta3.img/vgssland01.txd/bow_church_grass_gen.dds\",\"gta3.img/canalsg_law.txd/bow_church_grass_gen.dds\",\n \"gta3.img/vgssland03.txd/bow_church_grass_gen.dds\",\"gta3.img/canalsg_law.txd/bow_church_grass_gen.dds\",\n \"gta3.img/vgssland.txd/bow_church_grass_gen.dds\",\"gta3.img/canalsg_law.txd/bow_church_grass_gen.dds\",\n \"gta3.img/vgwestcoast.txd/bow_church_grass_gen.dds\",\"gta3.img/canalsg_law.txd/bow_church_grass_gen.dds\",\n \"gta3.img/vgwestground.txd/bow_church_grass_gen.dds\",\"gta3.img/canalsg_law.txd/bow_church_grass_gen.dds\",\n \"gta3.img/vgwesthseing1.txd/bow_church_grass_gen.dds\",\"gta3.img/canalsg_law.txd/bow_church_grass_gen.dds\",\n \"gta3.img/vgwestland2.txd/bow_church_grass_gen.dds\",\"gta3.img/canalsg_law.txd/bow_church_grass_gen.dds\",\n \"gta3.img/vgwestland.txd/bow_church_grass_gen.dds\",\"gta3.img/canalsg_law.txd/bow_church_grass_gen.dds\",\n \"gta3.img/conhooses.txd/hilcouwall2.dds\",\"gta3.img/capitol_lawn.txd/hilcouwall2.dds\",\n \"gta3.img/countryclbgnd_sfs.txd/hilcouwall2.dds\",\"gta3.img/capitol_lawn.txd/hilcouwall2.dds\",\n \"gta3.img/countryclbtnis_sfs.txd/hilcouwall2.dds\",\"gta3.img/capitol_lawn.txd/hilcouwall2.dds\",\n \"gta3.img/golf_sfs.txd/hilcouwall2.dds\",\"gta3.img/capitol_lawn.txd/hilcouwall2.dds\",\n \"gta3.img/lae2grnd.txd/hilcouwall2.dds\",\"gta3.img/capitol_lawn.txd/hilcouwall2.dds\",\n \"gta3.img/sunrise05_lawn.txd/hilcouwall2.dds\",\"gta3.img/capitol_lawn.txd/hilcouwall2.dds\",\n \"gta3.img/sw_apartflat.txd/hilcouwall2.dds\",\"gta3.img/capitol_lawn.txd/hilcouwall2.dds\",\n \"gta3.img/sw_block11.txd/hilcouwall2.dds\",\"gta3.img/capitol_lawn.txd/hilcouwall2.dds\",\n \"gta3.img/w_town3cs_t.txd/hilcouwall2.dds\",\"gta3.img/capitol_lawn.txd/hilcouwall2.dds\",\n \"gta3.img/landhub.txd/alleygroundb256.dds\",\"gta3.img/capitol_lawn.txd/alleygroundb256.dds\",\n \"gta3.img/lawnabv.txd/alleygroundb256.dds\",\"gta3.img/capitol_lawn.txd/alleygroundb256.dds\",\n \"gta3.img/stormdrain.txd/alleygroundb256.dds\",\"gta3.img/capitol_lawn.txd/alleygroundb256.dds\",\n \"gta3.img/vgeamun.txd/alleygroundb256.dds\",\"gta3.img/capitol_lawn.txd/alleygroundb256.dds\",\n \"gta3.img/vgnamun.txd/alleygroundb256.dds\",\"gta3.img/capitol_lawn.txd/alleygroundb256.dds\",\n \"gta3.img/vgndwntwn23.txd/alleygroundb256.dds\",\"gta3.img/capitol_lawn.txd/alleygroundb256.dds\",\n \"gta3.img/vgwestland.txd/alleygroundb256.dds\",\"gta3.img/capitol_lawn.txd/alleygroundb256.dds\",\n \"gta3.img/ce_pizza.txd/gymshop1_lae.dds\",\"gta3.img/capitol_lawn.txd/gymshop1_lae.dds\",\n \"gta3.img/civic03_lan.txd/gymshop1_lae.dds\",\"gta3.img/capitol_lawn.txd/gymshop1_lae.dds\",\n \"gta3.img/civic06_lan.txd/gymshop1_lae.dds\",\"gta3.img/capitol_lawn.txd/gymshop1_lae.dds\",\n \"gta3.img/civic07_lan.txd/gymshop1_lae.dds\",\"gta3.img/capitol_lawn.txd/gymshop1_lae.dds\",\n \"gta3.img/des_stownstrip2.txd/gymshop1_lae.dds\",\"gta3.img/capitol_lawn.txd/gymshop1_lae.dds\",\n \"gta3.img/downtown3_las.txd/gymshop1_lae.dds\",\"gta3.img/capitol_lawn.txd/gymshop1_lae.dds\",\n \"gta3.img/eastbeach3c_lae2.txd/gymshop1_lae.dds\",\"gta3.img/capitol_lawn.txd/gymshop1_lae.dds\",\n \"gta3.img/eastls4_lae2.txd/gymshop1_lae.dds\",\"gta3.img/capitol_lawn.txd/gymshop1_lae.dds\",\n \"gta3.img/idlewood3_lae.txd/gymshop1_lae.dds\",\"gta3.img/capitol_lawn.txd/gymshop1_lae.dds\",\n \"gta3.img/lanbloka.txd/gymshop1_lae.dds\",\"gta3.img/capitol_lawn.txd/gymshop1_lae.dds\",\n \"gta3.img/lanblokc.txd/gymshop1_lae.dds\",\"gta3.img/capitol_lawn.txd/gymshop1_lae.dds\",\n \"gta3.img/lanblokd.txd/gymshop1_lae.dds\",\"gta3.img/capitol_lawn.txd/gymshop1_lae.dds\",\n \"gta3.img/lashops1b_las2.txd/gymshop1_lae.dds\",\"gta3.img/capitol_lawn.txd/gymshop1_lae.dds\",\n \"gta3.img/melrose02_lawn.txd/gymshop1_lae.dds\",\"gta3.img/capitol_lawn.txd/gymshop1_lae.dds\",\n \"gta3.img/melrose05_lawn.txd/gymshop1_lae.dds\",\"gta3.img/capitol_lawn.txd/gymshop1_lae.dds\",\n \"gta3.img/melrose08_lawn.txd/gymshop1_lae.dds\",\"gta3.img/capitol_lawn.txd/gymshop1_lae.dds\",\n \"gta3.img/melrose11_lawn.txd/gymshop1_lae.dds\",\"gta3.img/capitol_lawn.txd/gymshop1_lae.dds\",\n \"gta3.img/melrose13_lawn.txd/gymshop1_lae.dds\",\"gta3.img/capitol_lawn.txd/gymshop1_lae.dds\",\n \"gta3.img/melrosetr1_lawn.txd/gymshop1_lae.dds\",\"gta3.img/capitol_lawn.txd/gymshop1_lae.dds\",\n \"gta3.img/rodeo02_law2.txd/gymshop1_lae.dds\",\"gta3.img/capitol_lawn.txd/gymshop1_lae.dds\",\n \"gta3.img/sunrise04_lawn.txd/gymshop1_lae.dds\",\"gta3.img/capitol_lawn.txd/gymshop1_lae.dds\",\n \"gta3.img/sunrise05_lawn.txd/gymshop1_lae.dds\",\"gta3.img/capitol_lawn.txd/gymshop1_lae.dds\",\n \"gta3.img/sunset01_lawn.txd/gymshop1_lae.dds\",\"gta3.img/capitol_lawn.txd/gymshop1_lae.dds\",\n \"gta3.img/sunset03_law2.txd/gymshop1_lae.dds\",\"gta3.img/capitol_lawn.txd/gymshop1_lae.dds\",\n \"gta3.img/sunset04_law2.txd/gymshop1_lae.dds\",\"gta3.img/capitol_lawn.txd/gymshop1_lae.dds\",\n \"gta3.img/sunstrans_law2.txd/gymshop1_lae.dds\",\"gta3.img/capitol_lawn.txd/gymshop1_lae.dds\",\n \"gta3.img/cwestfac.txd/lasjmscruffwall3.dds\",\"gta3.img/capitol_lawn.txd/lasjmscruffwall3.dds\",\n \"gta3.img/vgnfrates.txd/lasjmscruffwall3.dds\",\"gta3.img/capitol_lawn.txd/lasjmscruffwall3.dds\",\n \"gta3.img/vgsewrehse.txd/lasjmscruffwall3.dds\",\"gta3.img/capitol_lawn.txd/lasjmscruffwall3.dds\",\n \"gta3.img/vgsswrehse03.txd/lasjmscruffwall3.dds\",\"gta3.img/capitol_lawn.txd/lasjmscruffwall3.dds\",\n \"gta3.img/ce_bankalley1.txd/vgs_whitewall_128.dds\",\"gta3.img/capitol_lawn.txd/vgs_whitewall_128.dds\",\n \"gta3.img/ce_bankalley2.txd/vgs_whitewall_128.dds\",\"gta3.img/capitol_lawn.txd/vgs_whitewall_128.dds\",\n \"gta3.img/ce_bankalley3.txd/vgs_whitewall_128.dds\",\"gta3.img/capitol_lawn.txd/vgs_whitewall_128.dds\",\n \"gta3.img/cos_liquorstore.txd/vgs_whitewall_128.dds\",\"gta3.img/capitol_lawn.txd/vgs_whitewall_128.dds\",\n \"gta3.img/cuntwbtzzcs_t.txd/vgs_whitewall_128.dds\",\"gta3.img/capitol_lawn.txd/vgs_whitewall_128.dds\",\n \"gta3.img/des_dinerw.txd/vgs_whitewall_128.dds\",\"gta3.img/capitol_lawn.txd/vgs_whitewall_128.dds\",\n \"gta3.img/eastbeach4a_lae2.txd/vgs_whitewall_128.dds\",\"gta3.img/capitol_lawn.txd/vgs_whitewall_128.dds\",\n \"gta3.img/sw_fact01.txd/vgs_whitewall_128.dds\",\"gta3.img/capitol_lawn.txd/vgs_whitewall_128.dds\",\n \"gta3.img/sw_fact02alt.txd/vgs_whitewall_128.dds\",\"gta3.img/capitol_lawn.txd/vgs_whitewall_128.dds\",\n \"gta3.img/ufo_bar.txd/vgs_whitewall_128.dds\",\"gta3.img/capitol_lawn.txd/vgs_whitewall_128.dds\",\n \"gta3.img/vgsshospshop.txd/vgs_whitewall_128.dds\",\"gta3.img/capitol_lawn.txd/vgs_whitewall_128.dds\",\n \"gta3.img/eastbeach3c_lae2.txd/capitolwin1_lawn.dds\",\"gta3.img/capitol_lawn.txd/capitolwin1_lawn.dds\",\n \"gta3.img/nightlights1_law2.txd/capitolwin1_lawn.dds\",\"gta3.img/capitol_lawn.txd/capitolwin1_lawn.dds\",\n \"gta3.img/rodeo05_law2.txd/capitolwin1_lawn.dds\",\"gta3.img/capitol_lawn.txd/capitolwin1_lawn.dds\",\n \"gta3.img/crparkgm_lan2.txd/sl_sfngrass01.dds\",\"gta3.img/caravanprk_sfn.txd/sl_sfngrass01.dds\",\n \"gta3.img/lan2freeway.txd/sl_sfngrass01.dds\",\"gta3.img/caravanprk_sfn.txd/sl_sfngrass01.dds\",\n \"gta3.img/lanroad.txd/sl_sfngrass01.dds\",\"gta3.img/caravanprk_sfn.txd/sl_sfngrass01.dds\",\n \"gta3.img/stapl.txd/sl_sfngrass01.dds\",\"gta3.img/caravanprk_sfn.txd/sl_sfngrass01.dds\",\n \"gta3.img/carparkssfn.txd/sl_sfndirt01.dds\",\"gta3.img/caravanprk_sfn.txd/sl_sfndirt01.dds\",\n \"gta3.img/newstuff_sfn.txd/sl_sfndirt01.dds\",\"gta3.img/caravanprk_sfn.txd/sl_sfndirt01.dds\",\n \"gta3.img/sfn_sfn.txd/sfn_rocktbrn128.dds\",\"gta3.img/caravanprk_sfn.txd/sfn_rocktbrn128.dds\",\n \"gta3.img/stuff2_sfn.txd/sfn_rocktbrn128.dds\",\"gta3.img/caravanprk_sfn.txd/sfn_rocktbrn128.dds\",\n \"gta3.img/ce_ground01.txd/desertgryard256.dds\",\"gta3.img/caravanprk_sfn.txd/desertgryard256.dds\",\n \"gta3.img/ce_ground02.txd/desertgryard256.dds\",\"gta3.img/caravanprk_sfn.txd/desertgryard256.dds\",\n \"gta3.img/ce_ground03.txd/desertgryard256.dds\",\"gta3.img/caravanprk_sfn.txd/desertgryard256.dds\",\n \"gta3.img/ce_ground04.txd/desertgryard256.dds\",\"gta3.img/caravanprk_sfn.txd/desertgryard256.dds\",\n \"gta3.img/ce_ground05.txd/desertgryard256.dds\",\"gta3.img/caravanprk_sfn.txd/desertgryard256.dds\",\n \"gta3.img/ce_ground08.txd/desertgryard256.dds\",\"gta3.img/caravanprk_sfn.txd/desertgryard256.dds\",\n \"gta3.img/ce_ground09.txd/desertgryard256.dds\",\"gta3.img/caravanprk_sfn.txd/desertgryard256.dds\",\n \"gta3.img/ce_ground10.txd/desertgryard256.dds\",\"gta3.img/caravanprk_sfn.txd/desertgryard256.dds\",\n \"gta3.img/ce_ground11.txd/desertgryard256.dds\",\"gta3.img/caravanprk_sfn.txd/desertgryard256.dds\",\n \"gta3.img/ce_ground12.txd/desertgryard256.dds\",\"gta3.img/caravanprk_sfn.txd/desertgryard256.dds\",\n \"gta3.img/ce_ground13.txd/desertgryard256.dds\",\"gta3.img/caravanprk_sfn.txd/desertgryard256.dds\",\n \"gta3.img/ce_ground14.txd/desertgryard256.dds\",\"gta3.img/caravanprk_sfn.txd/desertgryard256.dds\",\n \"gta3.img/cn_nwbrigstuff.txd/desertgryard256.dds\",\"gta3.img/caravanprk_sfn.txd/desertgryard256.dds\",\n \"gta3.img/desn2_stud.txd/desertgryard256.dds\",\"gta3.img/caravanprk_sfn.txd/desertgryard256.dds\",\n \"gta3.img/des_nw2.txd/desertgryard256.dds\",\"gta3.img/caravanprk_sfn.txd/desertgryard256.dds\",\n \"gta3.img/des_nw.txd/desertgryard256.dds\",\"gta3.img/caravanprk_sfn.txd/desertgryard256.dds\",\n \"gta3.img/des_se3.txd/desertgryard256.dds\",\"gta3.img/caravanprk_sfn.txd/desertgryard256.dds\",\n \"gta3.img/hobos_lawn.txd/desertgryard256.dds\",\"gta3.img/caravanprk_sfn.txd/desertgryard256.dds\",\n \"gta3.img/lahillsground4cye.txd/desertgryard256.dds\",\"gta3.img/caravanprk_sfn.txd/desertgryard256.dds\",\n \"gta3.img/mullho03a_lahills.txd/desertgryard256.dds\",\"gta3.img/caravanprk_sfn.txd/desertgryard256.dds\",\n \"gta3.img/mullho03_lahills.txd/desertgryard256.dds\",\"gta3.img/caravanprk_sfn.txd/desertgryard256.dds\",\n \"gta3.img/richman02_lahills.txd/desertgryard256.dds\",\"gta3.img/caravanprk_sfn.txd/desertgryard256.dds\",\n \"gta3.img/roadslahills.txd/desertgryard256.dds\",\"gta3.img/caravanprk_sfn.txd/desertgryard256.dds\",\n \"gta3.img/sfn_sfn.txd/desertgryard256.dds\",\"gta3.img/caravanprk_sfn.txd/desertgryard256.dds\",\n \"gta3.img/sunsetbittyu.txd/desertgryard256.dds\",\"gta3.img/caravanprk_sfn.txd/desertgryard256.dds\",\n \"gta3.img/vgsmotelgrnd.txd/desertgryard256.dds\",\"gta3.img/caravanprk_sfn.txd/desertgryard256.dds\",\n \"gta3.img/vinewood01_lahills.txd/desertgryard256.dds\",\"gta3.img/caravanprk_sfn.txd/desertgryard256.dds\",\n \"gta_int.img/ab_cargo_int.txd/cargo_gir3.dds\",\"gta3.img/cargo_rear.txd/cargo_gir3.dds\",\n \"gta_int.img/ab_sfammuunits.txd/cargo_gir3.dds\",\"gta3.img/cargo_rear.txd/cargo_gir3.dds\",\n \"gta_int.img/ab_cargo_int.txd/cargo_pipes.dds\",\"gta3.img/cargo_rear.txd/cargo_pipes.dds\",\n \"gta_int.img/ab_cargo_int.txd/cargo_ceil2.dds\",\"gta3.img/cargo_rear.txd/cargo_ceil2.dds\",\n \"gta_int.img/ab_cargo_int.txd/cargo_top1.dds\",\"gta3.img/cargo_rear.txd/cargo_top1.dds\",\n \"gta_int.img/ab_cargo_int.txd/cargo_wall2.dds\",\"gta3.img/cargo_rear.txd/cargo_wall2.dds\",\n \"gta3.img/krampx.txd/cargo_floor2.dds\",\"gta3.img/cargo_rear.txd/cargo_floor2.dds\",\n \"gta_int.img/ab_cargo_int.txd/cargo_floor2.dds\",\"gta3.img/cargo_rear.txd/cargo_floor2.dds\",\n \"gta_int.img/ab_cargo_int.txd/cargo_floor1.dds\",\"gta3.img/cargo_rear.txd/cargo_floor1.dds\",\n \"gta3.img/krampx.txd/cargo_gir2.dds\",\"gta3.img/cargo_rear.txd/cargo_gir2.dds\",\n \"gta_int.img/ab_cargo_int.txd/cargo_gir2.dds\",\"gta3.img/cargo_rear.txd/cargo_gir2.dds\",\n \"gta3.img/kmb_netx.txd/747_cage.dds\",\"gta3.img/cargo_rear.txd/747_cage.dds\",\n \"gta_int.img/ab_cargo_int.txd/747_cage.dds\",\"gta3.img/cargo_rear.txd/747_cage.dds\",\n \"gta3.img/lanpolicecp.txd/poundwall1_sfe.dds\",\"gta3.img/carimpound_sfe.txd/poundwall1_sfe.dds\",\n \"gta3.img/rodeo03_law2.txd/poundwall1_sfe.dds\",\"gta3.img/carimpound_sfe.txd/poundwall1_sfe.dds\",\n \"gta3.img/vgndwntwn1.txd/poundwall1_sfe.dds\",\"gta3.img/carimpound_sfe.txd/poundwall1_sfe.dds\",\n \"gta3.img/copshop_sfe.txd/poundroofblock_sfe.dds\",\"gta3.img/carimpound_sfe.txd/poundroofblock_sfe.dds\",\n \"gta3.img/hosbibalsfw.txd/poundroofblock_sfe.dds\",\"gta3.img/carimpound_sfe.txd/poundroofblock_sfe.dds\",\n \"gta3.img/lanpolicecp.txd/poundroofblock_sfe.dds\",\"gta3.img/carimpound_sfe.txd/poundroofblock_sfe.dds\",\n \"gta3.img/rodeo03_law2.txd/poundroofblock_sfe.dds\",\"gta3.img/carimpound_sfe.txd/poundroofblock_sfe.dds\",\n \"gta3.img/vegascourtbld.txd/poundroofblock_sfe.dds\",\"gta3.img/carimpound_sfe.txd/poundroofblock_sfe.dds\",\n \"gta3.img/vegastemp1.txd/poundroofblock_sfe.dds\",\"gta3.img/carimpound_sfe.txd/poundroofblock_sfe.dds\",\n \"gta3.img/vgndwntwn1.txd/poundroofblock_sfe.dds\",\"gta3.img/carimpound_sfe.txd/poundroofblock_sfe.dds\",\n \"gta3.img/vgsn_carpark01.txd/poundroofblock_sfe.dds\",\"gta3.img/carimpound_sfe.txd/poundroofblock_sfe.dds\",\n \"gta3.img/copshop_sfe.txd/poundroofsupport_sfe.dds\",\"gta3.img/carimpound_sfe.txd/poundroofsupport_sfe.dds\",\n \"gta3.img/hosbibalsfw.txd/poundroofsupport_sfe.dds\",\"gta3.img/carimpound_sfe.txd/poundroofsupport_sfe.dds\",\n \"gta3.img/lanpolicecp.txd/poundroofsupport_sfe.dds\",\"gta3.img/carimpound_sfe.txd/poundroofsupport_sfe.dds\",\n \"gta3.img/rodeo03_law2.txd/poundroofsupport_sfe.dds\",\"gta3.img/carimpound_sfe.txd/poundroofsupport_sfe.dds\",\n \"gta3.img/vegascourtbld.txd/poundroofsupport_sfe.dds\",\"gta3.img/carimpound_sfe.txd/poundroofsupport_sfe.dds\",\n \"gta3.img/vegastemp1.txd/poundroofsupport_sfe.dds\",\"gta3.img/carimpound_sfe.txd/poundroofsupport_sfe.dds\",\n \"gta3.img/vgndwntwn1.txd/poundroofsupport_sfe.dds\",\"gta3.img/carimpound_sfe.txd/poundroofsupport_sfe.dds\",\n \"gta3.img/vgsn_carpark01.txd/poundroofsupport_sfe.dds\",\"gta3.img/carimpound_sfe.txd/poundroofsupport_sfe.dds\",\n \"gta3.img/luxorland.txd/greyground12802.dds\",\"gta3.img/carpark3_lvs.txd/greyground12802.dds\",\n \"gta3.img/vgseland.txd/greyground12802.dds\",\"gta3.img/carpark3_lvs.txd/greyground12802.dds\",\n \"gta3.img/vegassland62.txd/greystones01_128.dds\",\"gta3.img/carpark3_lvs.txd/greystones01_128.dds\",\n \"gta3.img/exclibrland.txd/pave02_128.dds\",\"gta3.img/carpark3_lvs.txd/pave02_128.dds\",\n \"gta3.img/sw_med1.txd/pave02_128.dds\",\"gta3.img/carpark3_lvs.txd/pave02_128.dds\",\n \"gta3.img/vgshpground.txd/pave02_128.dds\",\"gta3.img/carpark3_lvs.txd/pave02_128.dds\",\n \"gta3.img/vgsshospshop.txd/pave02_128.dds\",\"gta3.img/carpark3_lvs.txd/pave02_128.dds\",\n \"gta3.img/exclibrland.txd/corner1_128.dds\",\"gta3.img/carpark3_lvs.txd/corner1_128.dds\",\n \"gta3.img/vgshpground.txd/corner1_128.dds\",\"gta3.img/carpark3_lvs.txd/corner1_128.dds\",\n \"gta3.img/vgsshospshop.txd/corner1_128.dds\",\"gta3.img/carpark3_lvs.txd/corner1_128.dds\",\n \"gta3.img/vgshpground.txd/newgrnd1_128.dds\",\"gta3.img/carpark3_lvs.txd/newgrnd1_128.dds\",\n \"gta3.img/vgssmulticarprk.txd/newgrnd1_128.dds\",\"gta3.img/carpark3_lvs.txd/newgrnd1_128.dds\",\n \"gta3.img/lasroads_las.txd/decoacwallbtm1_256.dds\",\"gta3.img/carparkssfn.txd/decoacwallbtm1_256.dds\",\n \"gta3.img/melrose03_lawn.txd/decoacwallbtm1_256.dds\",\"gta3.img/carparkssfn.txd/decoacwallbtm1_256.dds\",\n \"gta3.img/union_las.txd/decoacwallbtm1_256.dds\",\"gta3.img/carparkssfn.txd/decoacwallbtm1_256.dds\",\n \"gta3.img/countryclbgnd_sfs.txd/parking2plain.dds\",\"gta3.img/carparkssfn.txd/parking2plain.dds\",\n \"gta3.img/countryclbtnis_sfs.txd/parking2plain.dds\",\"gta3.img/carparkssfn.txd/parking2plain.dds\",\n \"gta3.img/cs_forest.txd/parking2plain.dds\",\"gta3.img/carparkssfn.txd/parking2plain.dds\",\n \"gta3.img/cs_town.txd/parking2plain.dds\",\"gta3.img/carparkssfn.txd/parking2plain.dds\",\n \"gta3.img/desn_decocafe.txd/parking2plain.dds\",\"gta3.img/carparkssfn.txd/parking2plain.dds\",\n \"gta3.img/des_nw2.txd/parking2plain.dds\",\"gta3.img/carparkssfn.txd/parking2plain.dds\",\n \"gta3.img/des_nw.txd/parking2plain.dds\",\"gta3.img/carparkssfn.txd/parking2plain.dds\",\n \"gta3.img/des_sw.txd/parking2plain.dds\",\"gta3.img/carparkssfn.txd/parking2plain.dds\",\n \"gta3.img/fctrygrnd01.txd/parking2plain.dds\",\"gta3.img/carparkssfn.txd/parking2plain.dds\",\n \"gta3.img/golf_sfs.txd/parking2plain.dds\",\"gta3.img/carparkssfn.txd/parking2plain.dds\",\n \"gta3.img/officeground.txd/parking2plain.dds\",\"gta3.img/carparkssfn.txd/parking2plain.dds\",\n \"gta3.img/sfn_helipad.txd/parking2plain.dds\",\"gta3.img/carparkssfn.txd/parking2plain.dds\",\n \"gta3.img/sfn_roadssfn.txd/parking2plain.dds\",\"gta3.img/carparkssfn.txd/parking2plain.dds\",\n \"gta3.img/sw_apartments.txd/parking2plain.dds\",\"gta3.img/carparkssfn.txd/parking2plain.dds\",\n \"gta3.img/sw_brewery.txd/parking2plain.dds\",\"gta3.img/carparkssfn.txd/parking2plain.dds\",\n \"gta3.img/sw_diner1.txd/parking2plain.dds\",\"gta3.img/carparkssfn.txd/parking2plain.dds\",\n \"gta3.img/vegassland62.txd/parking2plain.dds\",\"gta3.img/carparkssfn.txd/parking2plain.dds\",\n \"gta3.img/vgsmotelgrnd.txd/parking2plain.dds\",\"gta3.img/carparkssfn.txd/parking2plain.dds\",\n \"gta3.img/countryclbtnis_sfs.txd/parking2.dds\",\"gta3.img/carparkssfn.txd/parking2.dds\",\n \"gta3.img/cunte_town1.txd/parking2.dds\",\"gta3.img/carparkssfn.txd/parking2.dds\",\n \"gta3.img/cw_truckstopcs_t.txd/parking2.dds\",\"gta3.img/carparkssfn.txd/parking2.dds\",\n \"gta3.img/desn_decocafe.txd/parking2.dds\",\"gta3.img/carparkssfn.txd/parking2.dds\",\n \"gta3.img/desn_truckstop.txd/parking2.dds\",\"gta3.img/carparkssfn.txd/parking2.dds\",\n \"gta3.img/des_nw.txd/parking2.dds\",\"gta3.img/carparkssfn.txd/parking2.dds\",\n \"gta3.img/des_sw.txd/parking2.dds\",\"gta3.img/carparkssfn.txd/parking2.dds\",\n \"gta3.img/sfn_roadssfn.txd/parking2.dds\",\"gta3.img/carparkssfn.txd/parking2.dds\",\n \"gta3.img/sw_apartments.txd/parking2.dds\",\"gta3.img/carparkssfn.txd/parking2.dds\",\n \"gta3.img/sw_brewery.txd/parking2.dds\",\"gta3.img/carparkssfn.txd/parking2.dds\",\n \"gta3.img/sw_diner1.txd/parking2.dds\",\"gta3.img/carparkssfn.txd/parking2.dds\",\n \"gta3.img/carshow_sfse.txd/sf_junction2.dds\",\"gta3.img/carparkssfn.txd/sf_junction2.dds\",\n \"gta3.img/highway_sfn.txd/sf_junction2.dds\",\"gta3.img/carparkssfn.txd/sf_junction2.dds\",\n \"gta3.img/sfn_roadssfn.txd/sf_junction2.dds\",\"gta3.img/carparkssfn.txd/sf_junction2.dds\",\n \"gta3.img/highway_sfn.txd/sf_junction1.dds\",\"gta3.img/carparkssfn.txd/sf_junction1.dds\",\n \"gta3.img/sfn_roadssfn.txd/sf_junction1.dds\",\"gta3.img/carparkssfn.txd/sf_junction1.dds\",\n \"gta3.img/cj_dfext.txd/chainlinkac1_128.dds\",\"gta3.img/carrierint_sfs.txd/chainlinkac1_128.dds\",\n \"gta3.img/freightcrane.txd/chainlinkac1_128.dds\",\"gta3.img/carrierint_sfs.txd/chainlinkac1_128.dds\",\n \"gta3.img/kei_wnchx.txd/chainlinkac1_128.dds\",\"gta3.img/carrierint_sfs.txd/chainlinkac1_128.dds\",\n \"gta3.img/subpen2_sfse.txd/chainlinkac1_128.dds\",\"gta3.img/carrierint_sfs.txd/chainlinkac1_128.dds\",\n \"gta3.img/vegasbuild.txd/chainlinkac1_128.dds\",\"gta3.img/carrierint_sfs.txd/chainlinkac1_128.dds\",\n \"gta3.img/foodkarts.txd/noodpot_64.dds\",\"gta3.img/carrierint_sfs.txd/noodpot_64.dds\",\n \"gta3.img/kei_wnchx.txd/noodpot_64.dds\",\"gta3.img/carrierint_sfs.txd/noodpot_64.dds\",\n \"gta3.img/subpen2_sfse.txd/noodpot_64.dds\",\"gta3.img/carrierint_sfs.txd/noodpot_64.dds\",\n \"gta3.img/carrier_sfse.txd/ws_shipmetal4.dds\",\"gta3.img/carrierint_sfs.txd/ws_shipmetal4.dds\",\n \"gta3.img/carrier_sfse.txd/ws_doorfront.dds\",\"gta3.img/carrierint_sfs.txd/ws_doorfront.dds\",\n \"gta3.img/carrier_sfse.txd/ws_floor2.dds\",\"gta3.img/carrierint_sfs.txd/ws_floor2.dds\",\n \"gta3.img/carrier_sfse.txd/ws_shipmetal3.dds\",\"gta3.img/carrierint_sfs.txd/ws_shipmetal3.dds\",\n \"gta3.img/carrier_sfse.txd/ws_cogtrack.dds\",\"gta3.img/carrierint_sfs.txd/ws_cogtrack.dds\",\n \"gta3.img/cranes_dyn2_cj.txd/ws_cogtrack.dds\",\"gta3.img/carrierint_sfs.txd/ws_cogtrack.dds\",\n \"gta3.img/carrierxr.txd/ws_decklines.dds\",\"gta3.img/carrier_sfse.txd/ws_decklines.dds\",\n \"gta3.img/carrierxr.txd/ws_carrierdeckbase.dds\",\"gta3.img/carrier_sfse.txd/ws_carrierdeckbase.dds\",\n \"gta3.img/cranes_dyn2_cj.txd/ws_bridgewins.dds\",\"gta3.img/carrier_sfse.txd/ws_bridgewins.dds\",\n \"gta3.img/cranes_dyn2.txd/ws_bridgewins.dds\",\"gta3.img/carrier_sfse.txd/ws_bridgewins.dds\",\n \"gta3.img/carrierxr.txd/ws_shipmetal1.dds\",\"gta3.img/carrier_sfse.txd/ws_shipmetal1.dds\",\n \"gta3.img/car_ship_sfse.txd/ws_shipmetal1.dds\",\"gta3.img/carrier_sfse.txd/ws_shipmetal1.dds\",\n \"gta3.img/hubprops2_sfse.txd/ab_plasicwrapa.dds\",\"gta3.img/carshow2_sfse.txd/ab_plasicwrapa.dds\",\n \"gta3.img/modshopintbits_sfs.txd/ab_plasicwrapa.dds\",\"gta3.img/carshow2_sfse.txd/ab_plasicwrapa.dds\",\n \"gta_int.img/ab.txd/ab_plasicwrapa.dds\",\"gta3.img/carshow2_sfse.txd/ab_plasicwrapa.dds\",\n \"gta3.img/hubprops2_sfse.txd/ab_metalholes.dds\",\"gta3.img/carshow2_sfse.txd/ab_metalholes.dds\",\n \"gta3.img/modshopintbits_sfs.txd/ab_metalholes.dds\",\"gta3.img/carshow2_sfse.txd/ab_metalholes.dds\",\n \"gta_int.img/ab_mafcaslaund.txd/ab_metalholes.dds\",\"gta3.img/carshow2_sfse.txd/ab_metalholes.dds\",\n \"gta_int.img/ab.txd/ab_metalholes.dds\",\"gta3.img/carshow2_sfse.txd/ab_metalholes.dds\",\n \"gta3.img/ct_stabx.txd/ab_metaledge.dds\",\"gta3.img/carshow2_sfse.txd/ab_metaledge.dds\",\n \"gta3.img/hubprops2_sfse.txd/ab_metaledge.dds\",\"gta3.img/carshow2_sfse.txd/ab_metaledge.dds\",\n \"gta3.img/modshopintbits_sfs.txd/ab_metaledge.dds\",\"gta3.img/carshow2_sfse.txd/ab_metaledge.dds\",\n \"gta_int.img/ab_mafcaslaund.txd/ab_metaledge.dds\",\"gta3.img/carshow2_sfse.txd/ab_metaledge.dds\",\n \"gta_int.img/ab.txd/ab_metaledge.dds\",\"gta3.img/carshow2_sfse.txd/ab_metaledge.dds\",\n \"gta_int.img/genintintcarint3.txd/ab_metaledge.dds\",\"gta3.img/carshow2_sfse.txd/ab_metaledge.dds\",\n \"gta_int.img/genintintgarage2.txd/ab_metaledge.dds\",\"gta3.img/carshow2_sfse.txd/ab_metaledge.dds\",\n \"gta_int.img/genintintgarage3b.txd/ab_metaledge.dds\",\"gta3.img/carshow2_sfse.txd/ab_metaledge.dds\",\n \"gta_int.img/mafcastopfoor.txd/ab_metaledge.dds\",\"gta3.img/carshow2_sfse.txd/ab_metaledge.dds\",\n \"gta3.img/hubprops2_sfse.txd/chipboard_256.dds\",\"gta3.img/carshow2_sfse.txd/chipboard_256.dds\",\n \"gta3.img/modshopintbits_sfs.txd/chipboard_256.dds\",\"gta3.img/carshow2_sfse.txd/chipboard_256.dds\",\n \"gta_int.img/ab_mafcaslaund.txd/chipboard_256.dds\",\"gta3.img/carshow2_sfse.txd/chipboard_256.dds\",\n \"gta_int.img/ab_sfgymbeams.txd/chipboard_256.dds\",\"gta3.img/carshow2_sfse.txd/chipboard_256.dds\",\n \"gta_int.img/ab.txd/chipboard_256.dds\",\"gta3.img/carshow2_sfse.txd/chipboard_256.dds\",\n \"gta_int.img/casinovault01.txd/chipboard_256.dds\",\"gta3.img/carshow2_sfse.txd/chipboard_256.dds\",\n \"gta3.img/carter_mainmap.txd/striplight1.dds\",\"gta3.img/carshow2_sfse.txd/striplight1.dds\",\n \"gta3.img/cw_junkbuildcs_t.txd/striplight1.dds\",\"gta3.img/carshow2_sfse.txd/striplight1.dds\",\n \"gta3.img/modshopintbits_sfs.txd/striplight1.dds\",\"gta3.img/carshow2_sfse.txd/striplight1.dds\",\n \"gta3.img/sfeship1.txd/striplight1.dds\",\"gta3.img/carshow2_sfse.txd/striplight1.dds\",\n \"gta3.img/ufo_bar.txd/striplight1.dds\",\"gta3.img/carshow2_sfse.txd/striplight1.dds\",\n \"gta3.img/vgnplantgen.txd/striplight1.dds\",\"gta3.img/carshow2_sfse.txd/striplight1.dds\",\n \"gta_int.img/ab_abbatoir01.txd/striplight1.dds\",\"gta3.img/carshow2_sfse.txd/striplight1.dds\",\n \"gta_int.img/ab_sfgymbits01.txd/striplight1.dds\",\"gta3.img/carshow2_sfse.txd/striplight1.dds\",\n \"gta_int.img/ab_vegasgymlites.txd/striplight1.dds\",\"gta3.img/carshow2_sfse.txd/striplight1.dds\",\n \"gta_int.img/carter_block.txd/striplight1.dds\",\"gta3.img/carshow2_sfse.txd/striplight1.dds\",\n \"gta_int.img/casinovault01.txd/striplight1.dds\",\"gta3.img/carshow2_sfse.txd/striplight1.dds\",\n \"gta_int.img/estate2.txd/striplight1.dds\",\"gta3.img/carshow2_sfse.txd/striplight1.dds\",\n \"gta_int.img/int_policea03a.txd/striplight1.dds\",\"gta3.img/carshow2_sfse.txd/striplight1.dds\",\n \"gta_int.img/intring_gymint3.txd/striplight1.dds\",\"gta3.img/carshow2_sfse.txd/striplight1.dds\",\n \"gta_int.img/int_tatoo.txd/striplight1.dds\",\"gta3.img/carshow2_sfse.txd/striplight1.dds\",\n \"gta_int.img/mp_policesf.txd/striplight1.dds\",\"gta3.img/carshow2_sfse.txd/striplight1.dds\",\n \"gta_int.img/temp_shop.txd/striplight1.dds\",\"gta3.img/carshow2_sfse.txd/striplight1.dds\",\n \"gta3.img/carshow_sfse.txd/ws_carshowwin1.dds\",\"gta3.img/carshowglass_sfsx.txd/ws_carshowwin1.dds\",\n \"gta3.img/cathedral_sfs.txd/concpanel_la.dds\",\"gta3.img/carshow_sfse.txd/concpanel_la.dds\",\n \"gta3.img/cityhall_sfs.txd/concpanel_la.dds\",\"gta3.img/carshow_sfse.txd/concpanel_la.dds\",\n \"gta3.img/cuntwbtzzcs_t.txd/concpanel_la.dds\",\"gta3.img/carshow_sfse.txd/concpanel_la.dds\",\n \"gta3.img/cw2_storesnstuff.txd/concpanel_la.dds\",\"gta3.img/carshow_sfse.txd/concpanel_la.dds\",\n \"gta3.img/dam_genroom.txd/concpanel_la.dds\",\"gta3.img/carshow_sfse.txd/concpanel_la.dds\",\n \"gta3.img/des_dinerw.txd/concpanel_la.dds\",\"gta3.img/carshow_sfse.txd/concpanel_la.dds\",\n \"gta3.img/desn2_truckstop.txd/concpanel_la.dds\",\"gta3.img/carshow_sfse.txd/concpanel_la.dds\",\n \"gta3.img/des_wgarage.txd/concpanel_la.dds\",\"gta3.img/carshow_sfse.txd/concpanel_la.dds\",\n \"gta3.img/docg01_lahills.txd/concpanel_la.dds\",\"gta3.img/carshow_sfse.txd/concpanel_la.dds\",\n \"gta3.img/gravblok01_lahills.txd/concpanel_la.dds\",\"gta3.img/carshow_sfse.txd/concpanel_la.dds\",\n \"gta3.img/mall_sfse.txd/concpanel_la.dds\",\"gta3.img/carshow_sfse.txd/concpanel_la.dds\",\n \"gta3.img/rodeo01_law2.txd/concpanel_la.dds\",\"gta3.img/carshow_sfse.txd/concpanel_la.dds\",\n \"gta3.img/skyscrap_sfse.txd/concpanel_la.dds\",\"gta3.img/carshow_sfse.txd/concpanel_la.dds\",\n \"gta3.img/stationsfse_1.txd/concpanel_la.dds\",\"gta3.img/carshow_sfse.txd/concpanel_la.dds\",\n \"gta3.img/station_sfse.txd/concpanel_la.dds\",\"gta3.img/carshow_sfse.txd/concpanel_la.dds\",\n \"gta3.img/sunset01_law2.txd/concpanel_la.dds\",\"gta3.img/carshow_sfse.txd/concpanel_la.dds\",\n \"gta3.img/sunset02_law2.txd/concpanel_la.dds\",\"gta3.img/carshow_sfse.txd/concpanel_la.dds\",\n \"gta3.img/sw_block04.txd/concpanel_la.dds\",\"gta3.img/carshow_sfse.txd/concpanel_la.dds\",\n \"gta3.img/sw_fact01a.txd/concpanel_la.dds\",\"gta3.img/carshow_sfse.txd/concpanel_la.dds\",\n \"gta3.img/sw_med1.txd/concpanel_la.dds\",\"gta3.img/carshow_sfse.txd/concpanel_la.dds\",\n \"gta3.img/vgnlowbild.txd/concpanel_la.dds\",\"gta3.img/carshow_sfse.txd/concpanel_la.dds\",\n \"gta3.img/vgnptrlpmp.txd/concpanel_la.dds\",\"gta3.img/carshow_sfse.txd/concpanel_la.dds\",\n \"gta3.img/vgnretail72.txd/concpanel_la.dds\",\"gta3.img/carshow_sfse.txd/concpanel_la.dds\",\n \"gta3.img/vgsairport.txd/concpanel_la.dds\",\"gta3.img/carshow_sfse.txd/concpanel_la.dds\",\n \"gta3.img/vgsecarshow.txd/concpanel_la.dds\",\"gta3.img/carshow_sfse.txd/concpanel_la.dds\",\n \"gta3.img/vgslowbuild.txd/concpanel_la.dds\",\"gta3.img/carshow_sfse.txd/concpanel_la.dds\",\n \"gta3.img/vgssairport.txd/concpanel_la.dds\",\"gta3.img/carshow_sfse.txd/concpanel_la.dds\",\n \"gta3.img/vgsshospshop.txd/concpanel_la.dds\",\"gta3.img/carshow_sfse.txd/concpanel_la.dds\",\n \"gta_int.img/dr_gsnew.txd/concpanel_la.dds\",\"gta3.img/carshow_sfse.txd/concpanel_la.dds\",\n \"gta_int.img/madpoolbit.txd/concpanel_la.dds\",\"gta3.img/carshow_sfse.txd/concpanel_la.dds\",\n \"gta3.img/ce_payspray.txd/ws_rollerdoor_silver.dds\",\"gta3.img/carshow_sfse.txd/ws_rollerdoor_silver.dds\",\n \"gta3.img/sfn_helipad.txd/ws_rollerdoor_silver.dds\",\"gta3.img/carshow_sfse.txd/ws_rollerdoor_silver.dds\",\n \"gta3.img/venicegb02_law.txd/ws_rollerdoor_silver.dds\",\"gta3.img/carshow_sfse.txd/ws_rollerdoor_silver.dds\",\n \"gta3.img/vgnfirestat.txd/ws_rollerdoor_silver.dds\",\"gta3.img/carshow_sfse.txd/ws_rollerdoor_silver.dds\",\n \"gta3.img/ce_payspray.txd/laspryshpsig1.dds\",\"gta3.img/carshow_sfse.txd/laspryshpsig1.dds\",\n \"gta3.img/garag3_lawn.txd/laspryshpsig1.dds\",\"gta3.img/carshow_sfse.txd/laspryshpsig1.dds\",\n \"gta3.img/garage_sfw.txd/laspryshpsig1.dds\",\"gta3.img/carshow_sfse.txd/laspryshpsig1.dds\",\n \"gta3.img/paynspray_lae.txd/laspryshpsig1.dds\",\"gta3.img/carshow_sfse.txd/laspryshpsig1.dds\",\n \"gta3.img/vegasbuild.txd/laspryshpsig1.dds\",\"gta3.img/carshow_sfse.txd/laspryshpsig1.dds\",\n \"gta3.img/vgsespras.txd/laspryshpsig1.dds\",\"gta3.img/carshow_sfse.txd/laspryshpsig1.dds\",\n \"gta3.img/garag3_lawn.txd/ws_transfender_dirty.dds\",\"gta3.img/carshow_sfse.txd/ws_transfender_dirty.dds\",\n \"gta3.img/shop06_lvs.txd/ws_transfender_dirty.dds\",\"gta3.img/carshow_sfse.txd/ws_transfender_dirty.dds\",\n \"gta3.img/sw_block11a.txd/ws_basheddoor1.dds\",\"gta3.img/carshow_sfse.txd/ws_basheddoor1.dds\",\n \"gta3.img/vgsbikeschool.txd/ws_basheddoor1.dds\",\"gta3.img/carshow_sfse.txd/ws_basheddoor1.dds\",\n \"gta_int.img/pleas_dome.txd/ws_basheddoor1.dds\",\"gta3.img/carshow_sfse.txd/ws_basheddoor1.dds\",\n \"gta_int.img/carter_block_2.txd/mp_carter_wallpaper.dds\",\"gta3.img/carter_mainmap.txd/mp_carter_wallpaper.dds\",\n \"gta_int.img/ab_sfammumain.txd/ab_stripped_floor.dds\",\"gta3.img/carter_mainmap.txd/ab_stripped_floor.dds\",\n \"gta_int.img/carter_block.txd/ab_stripped_floor.dds\",\"gta3.img/carter_mainmap.txd/ab_stripped_floor.dds\",\n \"gta_int.img/l_vggybox.txd/ab_stripped_floor.dds\",\"gta3.img/carter_mainmap.txd/ab_stripped_floor.dds\",\n \"gta_int.img/carter_block_2.txd/dt_ind_door.dds\",\"gta3.img/carter_mainmap.txd/dt_ind_door.dds\",\n \"gta_int.img/carter_block.txd/dt_ind_door.dds\",\"gta3.img/carter_mainmap.txd/dt_ind_door.dds\",\n \"gta3.img/sjmla_las.txd/gragedoorkb1.dds\",\"gta3.img/carter_mainmap.txd/gragedoorkb1.dds\",\n \"gta_int.img/burg_1.txd/gragedoorkb1.dds\",\"gta3.img/carter_mainmap.txd/gragedoorkb1.dds\",\n \"gta_int.img/carls_kit1.txd/gragedoorkb1.dds\",\"gta3.img/carter_mainmap.txd/gragedoorkb1.dds\",\n \"gta_int.img/intgarage2aint3.txd/gragedoorkb1.dds\",\"gta3.img/carter_mainmap.txd/gragedoorkb1.dds\",\n \"gta_int.img/int_kbsgarage3.txd/gragedoorkb1.dds\",\"gta3.img/carter_mainmap.txd/gragedoorkb1.dds\",\n \"gta_int.img/carter_block.txd/firestation_rollerdoor2.dds\",\"gta3.img/carter_mainmap.txd/firestation_rollerdoor2.dds\",\n \"gta_int.img/genintintsex.txd/firestation_rollerdoor2.dds\",\"gta3.img/carter_mainmap.txd/firestation_rollerdoor2.dds\",\n \"gta_int.img/gf1.txd/mp_apt1_brokedoor.dds\",\"gta3.img/carter_mainmap.txd/mp_apt1_brokedoor.dds\",\n \"gta_int.img/gf6.txd/mp_apt1_brokedoor.dds\",\"gta3.img/carter_mainmap.txd/mp_apt1_brokedoor.dds\",\n \"gta_int.img/lamidint2.txd/mp_apt1_brokedoor.dds\",\"gta3.img/carter_mainmap.txd/mp_apt1_brokedoor.dds\",\n \"gta_int.img/rylounge.txd/mp_apt1_brokedoor.dds\",\"gta3.img/carter_mainmap.txd/mp_apt1_brokedoor.dds\",\n \"gta_int.img/rystuff.txd/mp_apt1_brokedoor.dds\",\"gta3.img/carter_mainmap.txd/mp_apt1_brokedoor.dds\",\n \"gta_int.img/sfhsb3.txd/mp_apt1_brokedoor.dds\",\"gta3.img/carter_mainmap.txd/mp_apt1_brokedoor.dds\",\n \"gta_int.img/svvgmid.txd/mp_apt1_brokedoor.dds\",\"gta3.img/carter_mainmap.txd/mp_apt1_brokedoor.dds\",\n \"gta_int.img/vgshs2int2.txd/mp_apt1_brokedoor.dds\",\"gta3.img/carter_mainmap.txd/mp_apt1_brokedoor.dds\",\n \"gta_int.img/carter_block_2.txd/ab_corfloor.dds\",\"gta3.img/carter_mainmap.txd/ab_corfloor.dds\",\n \"gta_int.img/carter_block.txd/ab_corfloor.dds\",\"gta3.img/carter_mainmap.txd/ab_corfloor.dds\",\n \"gta_int.img/casinovault01.txd/ab_corfloor.dds\",\"gta3.img/carter_mainmap.txd/ab_corfloor.dds\",\n \"gta_int.img/mafiacasinovault01.txd/ab_corfloor.dds\",\"gta3.img/carter_mainmap.txd/ab_corfloor.dds\",\n \"gta3.img/junkpiles.txd/cj_tyre.dds\",\"gta3.img/cart.txd/cj_tyre.dds\",\n \"gta_int.img/maint1.txd/cj_gener_wheel.dds\",\"gta3.img/cart.txd/cj_gener_wheel.dds\",\n \"gta3.img/sunrise05_lawn.txd/vinesign1_law.dds\",\"gta3.img/casinoshops1.txd/vinesign1_law.dds\",\n \"gta3.img/sunrise09_lawn.txd/vinesign1_law.dds\",\"gta3.img/casinoshops1.txd/vinesign1_law.dds\",\n \"gta3.img/vgnlowbild.txd/sexsign1_256.dds\",\"gta3.img/casinoshops1.txd/sexsign1_256.dds\",\n \"gta3.img/vgnretail7.txd/sexsign1_256.dds\",\"gta3.img/casinoshops1.txd/sexsign1_256.dds\",\n \"gta3.img/vgse24hr.txd/sexsign1_256.dds\",\"gta3.img/casinoshops1.txd/sexsign1_256.dds\",\n \"gta3.img/lawnabv.txd/vgnbordpnk1_256.dds\",\"gta3.img/casinoshops1.txd/vgnbordpnk1_256.dds\",\n \"gta3.img/vgndwntwn23.txd/vgnbordpnk1_256.dds\",\"gta3.img/casinoshops1.txd/vgnbordpnk1_256.dds\",\n \"gta3.img/vgnretail4.txd/vgsn_yelwall.dds\",\"gta3.img/casinoshops1.txd/vgsn_yelwall.dds\",\n \"gta3.img/des_stownstrip2.txd/laredwall.dds\",\"gta3.img/casinoshops1.txd/laredwall.dds\",\n \"gta3.img/furniture_lae2.txd/laredwall.dds\",\"gta3.img/casinoshops1.txd/laredwall.dds\",\n \"gta3.img/melrose02_lawn.txd/laredwall.dds\",\"gta3.img/casinoshops1.txd/laredwall.dds\",\n \"gta3.img/sunset04_law2.txd/laredwall.dds\",\"gta3.img/casinoshops1.txd/laredwall.dds\",\n \"gta3.img/vgnretail6.txd/laredwall.dds\",\"gta3.img/casinoshops1.txd/laredwall.dds\",\n \"gta3.img/vgseland.txd/laredwall.dds\",\"gta3.img/casinoshops1.txd/laredwall.dds\",\n \"gta3.img/ce_ground09.txd/fakestone1_la.dds\",\"gta3.img/casinoshops1.txd/fakestone1_la.dds\",\n \"gta3.img/coast_apts.txd/fakestone1_la.dds\",\"gta3.img/casinoshops1.txd/fakestone1_la.dds\",\n \"gta3.img/comedprj1_la.txd/fakestone1_la.dds\",\"gta3.img/casinoshops1.txd/fakestone1_la.dds\",\n \"gta3.img/dingbat01_la.txd/fakestone1_la.dds\",\"gta3.img/casinoshops1.txd/fakestone1_la.dds\",\n \"gta3.img/mainlcawn.txd/fakestone1_la.dds\",\"gta3.img/casinoshops1.txd/fakestone1_la.dds\",\n \"gta3.img/motel_lae.txd/fakestone1_la.dds\",\"gta3.img/casinoshops1.txd/fakestone1_la.dds\",\n \"gta3.img/richman02_lahills.txd/fakestone1_la.dds\",\"gta3.img/casinoshops1.txd/fakestone1_la.dds\",\n \"gta3.img/richman04_lahills.txd/fakestone1_la.dds\",\"gta3.img/casinoshops1.txd/fakestone1_la.dds\",\n \"gta3.img/sunrise01_lawn.txd/fakestone1_la.dds\",\"gta3.img/casinoshops1.txd/fakestone1_la.dds\",\n \"gta_int.img/labig2int2.txd/fakestone1_la.dds\",\"gta3.img/casinoshops1.txd/fakestone1_la.dds\",\n \"gta_int.img/svcunthoose.txd/fakestone1_la.dds\",\"gta3.img/casinoshops1.txd/fakestone1_la.dds\",\n \"gta3.img/des_stownw.txd/hosp02_law.dds\",\"gta3.img/casinoshops1.txd/hosp02_law.dds\",\n \"gta3.img/hospital_lawn.txd/hosp02_law.dds\",\"gta3.img/casinoshops1.txd/hosp02_law.dds\",\n \"gta3.img/vgnretail7.txd/inwindow1shdw64.dds\",\"gta3.img/casinoshops1.txd/inwindow1shdw64.dds\",\n \"gta3.img/lowbuild03_lvs.txd/vgshopwndw01_128.dds\",\"gta3.img/casinoshops1.txd/vgshopwndw01_128.dds\",\n \"gta3.img/stripshop1.txd/247sign1.dds\",\"gta3.img/casinoshops1.txd/247sign1.dds\",\n \"gta3.img/vegasdwntwn1.txd/247sign1.dds\",\"gta3.img/casinoshops1.txd/247sign1.dds\",\n \"gta3.img/vgnbballsign2.txd/247sign1.dds\",\"gta3.img/casinoshops1.txd/247sign1.dds\",\n \"gta3.img/vgnretail2.txd/247sign1.dds\",\"gta3.img/casinoshops1.txd/247sign1.dds\",\n \"gta3.img/vgnretail6.txd/247sign1.dds\",\"gta3.img/casinoshops1.txd/247sign1.dds\",\n \"gta3.img/vgnshopnmall.txd/247sign1.dds\",\"gta3.img/casinoshops1.txd/247sign1.dds\",\n \"gta3.img/stripshop1.txd/247sign2.dds\",\"gta3.img/casinoshops1.txd/247sign2.dds\",\n \"gta3.img/vgnretail6.txd/247sign2.dds\",\"gta3.img/casinoshops1.txd/247sign2.dds\",\n \"gta3.img/oc_flats_gnd_sfs.txd/ws_woodyhedge.dds\",\"gta3.img/cathedral_sfs.txd/ws_woodyhedge.dds\",\n \"gta3.img/civic03_lan.txd/dirt64b2.dds\",\"gta3.img/cathedral_sfs.txd/dirt64b2.dds\",\n \"gta3.img/compomark_lae2.txd/dirt64b2.dds\",\"gta3.img/cathedral_sfs.txd/dirt64b2.dds\",\n \"gta3.img/counthousmisc.txd/dirt64b2.dds\",\"gta3.img/cathedral_sfs.txd/dirt64b2.dds\",\n \"gta3.img/countryclbgnd_sfs.txd/dirt64b2.dds\",\"gta3.img/cathedral_sfs.txd/dirt64b2.dds\",\n \"gta3.img/countryclbtnis_sfs.txd/dirt64b2.dds\",\"gta3.img/cathedral_sfs.txd/dirt64b2.dds\",\n \"gta3.img/cuntwlandcarparks.txd/dirt64b2.dds\",\"gta3.img/cathedral_sfs.txd/dirt64b2.dds\",\n \"gta3.img/cuntwland.txd/dirt64b2.dds\",\"gta3.img/cathedral_sfs.txd/dirt64b2.dds\",\n \"gta3.img/drivingschool_sfse.txd/dirt64b2.dds\",\"gta3.img/cathedral_sfs.txd/dirt64b2.dds\",\n \"gta3.img/griffobs_las.txd/dirt64b2.dds\",\"gta3.img/cathedral_sfs.txd/dirt64b2.dds\",\n \"gta3.img/ground2_las2.txd/dirt64b2.dds\",\"gta3.img/cathedral_sfs.txd/dirt64b2.dds\",\n \"gta3.img/ground4_las.txd/dirt64b2.dds\",\"gta3.img/cathedral_sfs.txd/dirt64b2.dds\",\n \"gta3.img/ground5_las.txd/dirt64b2.dds\",\"gta3.img/cathedral_sfs.txd/dirt64b2.dds\",\n \"gta3.img/lashops93_las2.txd/dirt64b2.dds\",\"gta3.img/cathedral_sfs.txd/dirt64b2.dds\",\n \"gta3.img/lawnbit.txd/dirt64b2.dds\",\"gta3.img/cathedral_sfs.txd/dirt64b2.dds\",\n \"gta3.img/lawnbuy.txd/dirt64b2.dds\",\"gta3.img/cathedral_sfs.txd/dirt64b2.dds\",\n \"gta3.img/lomall.txd/dirt64b2.dds\",\"gta3.img/cathedral_sfs.txd/dirt64b2.dds\",\n \"gta3.img/sw_block11.txd/dirt64b2.dds\",\"gta3.img/cathedral_sfs.txd/dirt64b2.dds\",\n \"gta3.img/sw_diner1.txd/dirt64b2.dds\",\"gta3.img/cathedral_sfs.txd/dirt64b2.dds\",\n \"gta3.img/sw_genstore.txd/dirt64b2.dds\",\"gta3.img/cathedral_sfs.txd/dirt64b2.dds\",\n \"gta3.img/vgnmall.txd/dirt64b2.dds\",\"gta3.img/cathedral_sfs.txd/dirt64b2.dds\",\n \"gta3.img/vgnshopnmall.txd/dirt64b2.dds\",\"gta3.img/cathedral_sfs.txd/dirt64b2.dds\",\n \"gta3.img/vgssland01.txd/dirt64b2.dds\",\"gta3.img/cathedral_sfs.txd/dirt64b2.dds\",\n \"gta3.img/vgssland03.txd/dirt64b2.dds\",\"gta3.img/cathedral_sfs.txd/dirt64b2.dds\",\n \"gta3.img/wasteland_las2.txd/dirt64b2.dds\",\"gta3.img/cathedral_sfs.txd/dirt64b2.dds\",\n \"gta_int.img/gen_pol_vegas.txd/dirt64b2.dds\",\"gta3.img/cathedral_sfs.txd/dirt64b2.dds\",\n \"gta_int.img/innertrak.txd/ah_dirt64b2.dds\",\"gta3.img/cathedral_sfs.txd/dirt64b2.dds\",\n \"gta_int.img/kickstart.txd/ah_dirt64b2.dds\",\"gta3.img/cathedral_sfs.txd/dirt64b2.dds\",\n \"gta_int.img/sumoback.txd/dirt64b2.dds\",\"gta3.img/cathedral_sfs.txd/dirt64b2.dds\",\n \"gta3.img/cityhall_sfse.txd/ws_coppersheet.dds\",\"gta3.img/cathedral_sfs.txd/ws_coppersheet.dds\",\n \"gta3.img/cityhall_sfs.txd/ws_coppersheet.dds\",\"gta3.img/cathedral_sfs.txd/ws_coppersheet.dds\",\n \"gta3.img/officy_sfs.txd/ws_coppersheet.dds\",\"gta3.img/cathedral_sfs.txd/ws_coppersheet.dds\",\n \"gta3.img/skyscrap_sfse.txd/ws_coppersheet.dds\",\"gta3.img/cathedral_sfs.txd/ws_coppersheet.dds\",\n \"gta3.img/cityhall_sfs.txd/ws_bigwooddoor.dds\",\"gta3.img/cathedral_sfs.txd/ws_bigwooddoor.dds\",\n \"gta3.img/vgncorp1.txd/mexreast1_256.dds\",\"gta3.img/ceasersign.txd/mexreast1_256.dds\",\n \"gta3.img/eastls4_lae2.txd/newindow13.dds\",\"gta3.img/ce_bankalley1.txd/newindow13.dds\",\n \"gta3.img/mulhousclahills.txd/newindow13.dds\",\"gta3.img/ce_bankalley1.txd/newindow13.dds\",\n \"gta3.img/vgnretail4.txd/newindow13.dds\",\"gta3.img/ce_bankalley1.txd/newindow13.dds\",\n \"gta3.img/eastls4_lae2.txd/sw_door07.dds\",\"gta3.img/ce_bankalley1.txd/sw_door07.dds\",\n \"gta3.img/santamonicalaw2.txd/sw_door07.dds\",\"gta3.img/ce_bankalley1.txd/sw_door07.dds\",\n \"gta3.img/sw_block11.txd/sw_door07.dds\",\"gta3.img/ce_bankalley1.txd/sw_door07.dds\",\n \"gta3.img/sw_genstore1.txd/sw_door07.dds\",\"gta3.img/ce_bankalley1.txd/sw_door07.dds\",\n \"gta_int.img/ab_xit_box.txd/sw_door07.dds\",\"gta3.img/ce_bankalley1.txd/sw_door07.dds\",\n \"gta_int.img/bikeskool.txd/sw_door07.dds\",\"gta3.img/ce_bankalley1.txd/sw_door07.dds\",\n \"gta_int.img/cj_barb2.txd/sw_door07.dds\",\"gta3.img/ce_bankalley1.txd/sw_door07.dds\",\n \"gta_int.img/cj_barb.txd/sw_door07.dds\",\"gta3.img/ce_bankalley1.txd/sw_door07.dds\",\n \"gta_int.img/cj_exp.txd/sw_door07.dds\",\"gta3.img/ce_bankalley1.txd/sw_door07.dds\",\n \"gta_int.img/estate2.txd/sw_door07.dds\",\"gta3.img/ce_bankalley1.txd/sw_door07.dds\",\n \"gta_int.img/gap.txd/sw_door07.dds\",\"gta3.img/ce_bankalley1.txd/sw_door07.dds\",\n \"gta_int.img/genintclothessport.txd/sw_door07.dds\",\"gta3.img/ce_bankalley1.txd/sw_door07.dds\",\n \"gta_int.img/genintintfastb2.txd/sw_door07.dds\",\"gta3.img/ce_bankalley1.txd/sw_door07.dds\",\n \"gta_int.img/genintintfastc.txd/sw_door07.dds\",\"gta3.img/ce_bankalley1.txd/sw_door07.dds\",\n \"gta_int.img/genintintfastd.txd/sw_door07.dds\",\"gta3.img/ce_bankalley1.txd/sw_door07.dds\",\n \"gta_int.img/intclotheshiphop.txd/sw_door07.dds\",\"gta3.img/ce_bankalley1.txd/sw_door07.dds\",\n \"gta_int.img/int_cutbar3.txd/sw_door07.dds\",\"gta3.img/ce_bankalley1.txd/sw_door07.dds\",\n \"gta_int.img/int_zerosrca.txd/sw_door07.dds\",\"gta3.img/ce_bankalley1.txd/sw_door07.dds\",\n \"gta_int.img/mafcastopfoor.txd/sw_door07.dds\",\"gta3.img/ce_bankalley1.txd/sw_door07.dds\",\n \"gta_int.img/mafcas_xitbox.txd/sw_door07.dds\",\"gta3.img/ce_bankalley1.txd/sw_door07.dds\",\n \"gta_int.img/scummy.txd/sw_door07.dds\",\"gta3.img/ce_bankalley1.txd/sw_door07.dds\",\n \"gta3.img/cw2_cinemablockcs_t.txd/sw_wind05.dds\",\"gta3.img/ce_bankalley1.txd/sw_wind05.dds\",\n \"gta3.img/des_stownmots1.txd/sw_wind05.dds\",\"gta3.img/ce_bankalley1.txd/sw_wind05.dds\",\n \"gta3.img/lae2newtempbx.txd/sw_wind05.dds\",\"gta3.img/ce_bankalley1.txd/sw_wind05.dds\",\n \"gta3.img/sw_apartflatx.txd/sw_wind05.dds\",\"gta3.img/ce_bankalley1.txd/sw_wind05.dds\",\n \"gta3.img/sw_block05.txd/sw_wind05.dds\",\"gta3.img/ce_bankalley1.txd/sw_wind05.dds\",\n \"gta3.img/sw_genstore1.txd/sw_wind05.dds\",\"gta3.img/ce_bankalley1.txd/sw_wind05.dds\",\n \"gta3.img/w_town3cs_t.txd/sw_wind05.dds\",\"gta3.img/ce_bankalley1.txd/sw_wind05.dds\",\n \"gta3.img/ce_loadbay.txd/sw_warewall.dds\",\"gta3.img/ce_bankalley1.txd/sw_warewall.dds\",\n \"gta3.img/ce_bankalley2.txd/conc_wall_128h.dds\",\"gta3.img/ce_bankalley1.txd/conc_wall_128h.dds\",\n \"gta3.img/eastls4_lae2.txd/conc_wall_128h.dds\",\"gta3.img/ce_bankalley1.txd/conc_wall_128h.dds\",\n \"gta3.img/sw_block11a.txd/conc_wall_128h.dds\",\"gta3.img/ce_bankalley1.txd/conc_wall_128h.dds\",\n \"gta3.img/vgnpwrwhse.txd/conc_wall_128h.dds\",\"gta3.img/ce_bankalley1.txd/conc_wall_128h.dds\",\n \"gta3.img/vgwestabats.txd/conc_wall_128h.dds\",\"gta3.img/ce_bankalley1.txd/conc_wall_128h.dds\",\n \"gta_int.img/casinovault01.txd/conc_wall_128h.dds\",\"gta3.img/ce_bankalley1.txd/conc_wall_128h.dds\",\n \"gta3.img/ce_bankalley2.txd/ws_basheddoor2.dds\",\"gta3.img/ce_bankalley1.txd/ws_basheddoor2.dds\",\n \"gta3.img/cr1_drx.txd/ws_basheddoor2.dds\",\"gta3.img/ce_bankalley1.txd/ws_basheddoor2.dds\",\n \"gta3.img/lahillstxd1a.txd/ws_basheddoor2.dds\",\"gta3.img/ce_bankalley1.txd/ws_basheddoor2.dds\",\n \"gta3.img/oldgarage_sfse.txd/ws_basheddoor2.dds\",\"gta3.img/ce_bankalley1.txd/ws_basheddoor2.dds\",\n \"gta3.img/rider1dr.txd/ws_basheddoor2.dds\",\"gta3.img/ce_bankalley1.txd/ws_basheddoor2.dds\",\n \"gta3.img/sw_block11.txd/ws_basheddoor2.dds\",\"gta3.img/ce_bankalley1.txd/ws_basheddoor2.dds\",\n \"gta3.img/tcenewhillhus02.txd/ws_basheddoor2.dds\",\"gta3.img/ce_bankalley1.txd/ws_basheddoor2.dds\",\n \"gta3.img/vegasdwntwn1.txd/ws_basheddoor2.dds\",\"gta3.img/ce_bankalley1.txd/ws_basheddoor2.dds\",\n \"gta3.img/vgnpwrwhse.txd/ws_basheddoor2.dds\",\"gta3.img/ce_bankalley1.txd/ws_basheddoor2.dds\",\n \"gta3.img/vgwestabats.txd/ws_basheddoor2.dds\",\"gta3.img/ce_bankalley1.txd/ws_basheddoor2.dds\",\n \"gta3.img/ce_bankalley2.txd/lalightledge.dds\",\"gta3.img/ce_bankalley1.txd/lalightledge.dds\",\n \"gta3.img/ce_bankalley3.txd/lalightledge.dds\",\"gta3.img/ce_bankalley1.txd/lalightledge.dds\",\n \"gta3.img/cw2_cinemablockcs_t.txd/lalightledge.dds\",\"gta3.img/ce_bankalley1.txd/lalightledge.dds\",\n \"gta3.img/sunrise01_lawn.txd/lalightledge.dds\",\"gta3.img/ce_bankalley1.txd/lalightledge.dds\",\n \"gta3.img/sw_apartflat5.txd/lalightledge.dds\",\"gta3.img/ce_bankalley1.txd/lalightledge.dds\",\n \"gta3.img/sw_apartflat.txd/lalightledge.dds\",\"gta3.img/ce_bankalley1.txd/lalightledge.dds\",\n \"gta3.img/vgsebuild01.txd/lalightledge.dds\",\"gta3.img/ce_bankalley1.txd/lalightledge.dds\",\n \"gta3.img/vgsebuild02.txd/lalightledge.dds\",\"gta3.img/ce_bankalley1.txd/lalightledge.dds\",\n \"gta3.img/ce_bankalley2.txd/hospunder_law.dds\",\"gta3.img/ce_bankalley1.txd/hospunder_law.dds\",\n \"gta3.img/ce_fact01.txd/hospunder_law.dds\",\"gta3.img/ce_bankalley1.txd/hospunder_law.dds\",\n \"gta3.img/coast_apts.txd/hospunder_law.dds\",\"gta3.img/ce_bankalley1.txd/hospunder_law.dds\",\n \"gta3.img/cuntwbtxcs_t.txd/hospunder_law.dds\",\"gta3.img/ce_bankalley1.txd/hospunder_law.dds\",\n \"gta3.img/depot_sfse.txd/hospunder_law.dds\",\"gta3.img/ce_bankalley1.txd/hospunder_law.dds\",\n \"gta3.img/des_bigearstuff.txd/hospunder_law.dds\",\"gta3.img/ce_bankalley1.txd/hospunder_law.dds\",\n \"gta3.img/des_quarrybits.txd/hospunder_law.dds\",\"gta3.img/ce_bankalley1.txd/hospunder_law.dds\",\n \"gta3.img/des_stownmain3.txd/hospunder_law.dds\",\"gta3.img/ce_bankalley1.txd/hospunder_law.dds\",\n \"gta3.img/dk_midbuilds.txd/hospunder_law.dds\",\"gta3.img/ce_bankalley1.txd/hospunder_law.dds\",\n \"gta3.img/hospital_lawn.txd/hospunder_law.dds\",\"gta3.img/ce_bankalley1.txd/hospunder_law.dds\",\n \"gta3.img/sunrise01_lawn.txd/hospunder_law.dds\",\"gta3.img/ce_bankalley1.txd/hospunder_law.dds\",\n \"gta3.img/xenon_sfse.txd/hospunder_law.dds\",\"gta3.img/ce_bankalley1.txd/hospunder_law.dds\",\n \"gta3.img/cunte_cop.txd/sw_stairs1.dds\",\"gta3.img/ce_bankalley1.txd/sw_stairs1.dds\",\n \"gta3.img/cunte_house1.txd/sw_stairs1.dds\",\"gta3.img/ce_bankalley1.txd/sw_stairs1.dds\",\n \"gta3.img/lahills_curvesteps.txd/sw_stairs1.dds\",\"gta3.img/ce_bankalley1.txd/sw_stairs1.dds\",\n \"gta3.img/sw_apartflat.txd/sw_stairs1.dds\",\"gta3.img/ce_bankalley1.txd/sw_stairs1.dds\",\n \"gta3.img/sw_apartments.txd/sw_stairs1.dds\",\"gta3.img/ce_bankalley1.txd/sw_stairs1.dds\",\n \"gta3.img/sw_block01.txd/sw_stairs1.dds\",\"gta3.img/ce_bankalley1.txd/sw_stairs1.dds\",\n \"gta3.img/sw_block03.txd/sw_stairs1.dds\",\"gta3.img/ce_bankalley1.txd/sw_stairs1.dds\",\n \"gta3.img/sw_block09.txd/sw_stairs1.dds\",\"gta3.img/ce_bankalley1.txd/sw_stairs1.dds\",\n \"gta3.img/sw_block11.txd/sw_stairs1.dds\",\"gta3.img/ce_bankalley1.txd/sw_stairs1.dds\",\n \"gta3.img/sw_brewery.txd/sw_stairs1.dds\",\"gta3.img/ce_bankalley1.txd/sw_stairs1.dds\",\n \"gta3.img/sw_church.txd/sw_stairs1.dds\",\"gta3.img/ce_bankalley1.txd/sw_stairs1.dds\",\n \"gta3.img/sw_library.txd/sw_stairs1.dds\",\"gta3.img/ce_bankalley1.txd/sw_stairs1.dds\",\n \"gta3.img/sw_ware01.txd/sw_stairs1.dds\",\"gta3.img/ce_bankalley1.txd/sw_stairs1.dds\",\n \"gta3.img/vgnfremnt2.txd/pizza_wellstacked.dds\",\"gta3.img/ce_bankalley1.txd/pizza_wellstacked.dds\",\n \"gta3.img/vgnmall.txd/pizza_wellstacked.dds\",\"gta3.img/ce_bankalley1.txd/pizza_wellstacked.dds\",\n \"gta3.img/vgnshopnmall.txd/pizza_wellstacked.dds\",\"gta3.img/ce_bankalley1.txd/pizza_wellstacked.dds\",\n \"gta3.img/queensammo_sfs.txd/ws_ammu-awning.dds\",\"gta3.img/ce_bankalley1.txd/ws_ammu-awning.dds\",\n \"gta3.img/vgnretail7.txd/sw_dicksounds.dds\",\"gta3.img/ce_bankalley1.txd/sw_dicksounds.dds\",\n \"gta3.img/ce_bankalley2.txd/ws_boxhouse_wins1.dds\",\"gta3.img/ce_bankalley1.txd/ws_boxhouse_wins1.dds\",\n \"gta3.img/coast_apts.txd/ws_boxhouse_wins1.dds\",\"gta3.img/ce_bankalley1.txd/ws_boxhouse_wins1.dds\",\n \"gta3.img/dingbat01_la.txd/ws_boxhouse_wins1.dds\",\"gta3.img/ce_bankalley1.txd/ws_boxhouse_wins1.dds\",\n \"gta3.img/lngblok_lae2.txd/ws_boxhouse_wins1.dds\",\"gta3.img/ce_bankalley1.txd/ws_boxhouse_wins1.dds\",\n \"gta3.img/sunrise01_lawn.txd/ws_boxhouse_wins1.dds\",\"gta3.img/ce_bankalley1.txd/ws_boxhouse_wins1.dds\",\n \"gta3.img/sw_block12.txd/ws_boxhouse_wins1.dds\",\"gta3.img/ce_bankalley1.txd/ws_boxhouse_wins1.dds\",\n \"gta3.img/cw2_photoblockcs_t.txd/sw_storewin02.dds\",\"gta3.img/ce_bankalley1.txd/sw_storewin02.dds\",\n \"gta3.img/cw_truckstopcs_t.txd/sw_storewin02.dds\",\"gta3.img/ce_bankalley1.txd/sw_storewin02.dds\",\n \"gta3.img/desn_truckstop.txd/sw_storewin02.dds\",\"gta3.img/ce_bankalley1.txd/sw_storewin02.dds\",\n \"gta3.img/garage_sfw.txd/garage_win_sfw.dds\",\"gta3.img/ce_bankalley1.txd/sw_storewin02.dds\",\n \"gta3.img/sw_block01.txd/sw_storewin02.dds\",\"gta3.img/ce_bankalley1.txd/sw_storewin02.dds\",\n \"gta3.img/sw_genstore.txd/sw_storewin02.dds\",\"gta3.img/ce_bankalley1.txd/sw_storewin02.dds\",\n \"gta3.img/ce_bankalley2.txd/sw_door09.dds\",\"gta3.img/ce_bankalley1.txd/sw_door09.dds\",\n \"gta3.img/cluckbell_sfs.txd/sw_door09.dds\",\"gta3.img/ce_bankalley1.txd/sw_door09.dds\",\n \"gta3.img/des_stownmain1.txd/sw_door09.dds\",\"gta3.img/ce_bankalley1.txd/sw_door09.dds\",\n \"gta3.img/garage_sfw.txd/sw_door09.dds\",\"gta3.img/ce_bankalley1.txd/sw_door09.dds\",\n \"gta3.img/shop_doors2.txd/sw_door09.dds\",\"gta3.img/ce_bankalley1.txd/sw_door09.dds\",\n \"gta3.img/sw_apartflat.txd/sw_door09.dds\",\"gta3.img/ce_bankalley1.txd/sw_door09.dds\",\n \"gta3.img/venice_law.txd/sw_door09.dds\",\"gta3.img/ce_bankalley1.txd/sw_door09.dds\",\n \"gta3.img/vgsbldng1.txd/sw_door09.dds\",\"gta3.img/ce_bankalley1.txd/sw_door09.dds\",\n \"gta3.img/vgwestretail1.txd/sw_door09.dds\",\"gta3.img/ce_bankalley1.txd/sw_door09.dds\",\n \"gta_int.img/papaerchaseoffice.txd/sw_door09.dds\",\"gta3.img/ce_bankalley1.txd/sw_door09.dds\",\n \"gta3.img/ce_bankalley2.txd/alleywall3.dds\",\"gta3.img/ce_bankalley1.txd/alleywall3.dds\",\n \"gta3.img/eastls1_lae2.txd/alleywall3.dds\",\"gta3.img/ce_bankalley1.txd/alleywall3.dds\",\n \"gta3.img/lahillshilhs1e.txd/alleywall3.dds\",\"gta3.img/ce_bankalley1.txd/alleywall3.dds\",\n \"gta3.img/sw_apartflat5.txd/alleywall3.dds\",\"gta3.img/ce_bankalley1.txd/alleywall3.dds\",\n \"gta3.img/sw_apartflat.txd/alleywall3.dds\",\"gta3.img/ce_bankalley1.txd/alleywall3.dds\",\n \"gta3.img/sw_apartflatx.txd/alleywall3.dds\",\"gta3.img/ce_bankalley1.txd/alleywall3.dds\",\n \"gta3.img/sw_block11a.txd/alleywall3.dds\",\"gta3.img/ce_bankalley1.txd/alleywall3.dds\",\n \"gta3.img/sw_block12.txd/alleywall3.dds\",\"gta3.img/ce_bankalley1.txd/alleywall3.dds\",\n \"gta3.img/vegaswrehse1.txd/alleywall3.dds\",\"gta3.img/ce_bankalley1.txd/alleywall3.dds\",\n \"gta3.img/vgnretail3.txd/alleywall3.dds\",\"gta3.img/ce_bankalley1.txd/alleywall3.dds\",\n \"gta3.img/vgnretail4.txd/alleywall3.dds\",\"gta3.img/ce_bankalley1.txd/alleywall3.dds\",\n \"gta3.img/vgnretail5.txd/alleywall3.dds\",\"gta3.img/ce_bankalley1.txd/alleywall3.dds\",\n \"gta3.img/vgnretail7.txd/alleywall3.dds\",\"gta3.img/ce_bankalley1.txd/alleywall3.dds\",\n \"gta3.img/vgntamotel.txd/alleywall3.dds\",\"gta3.img/ce_bankalley1.txd/alleywall3.dds\",\n \"gta3.img/vgntrainstat.txd/alleywall3.dds\",\"gta3.img/ce_bankalley1.txd/alleywall3.dds\",\n \"gta3.img/vgsetrainstn.txd/alleywall3.dds\",\"gta3.img/ce_bankalley1.txd/alleywall3.dds\",\n \"gta3.img/vgwestland.txd/alleywall3.dds\",\"gta3.img/ce_bankalley1.txd/alleywall3.dds\",\n \"gta3.img/ce_bankalley2.txd/sw_brick03.dds\",\"gta3.img/ce_bankalley1.txd/sw_brick03.dds\",\n \"gta3.img/cunte_gas01.txd/sw_brick03.dds\",\"gta3.img/ce_bankalley1.txd/sw_brick03.dds\",\n \"gta3.img/sw_block10.txd/sw_furnisign.dds\",\"gta3.img/ce_bankalley1.txd/sw_furnisign.dds\",\n \"gta3.img/vgsshospshop.txd/sw_furnisign.dds\",\"gta3.img/ce_bankalley1.txd/sw_furnisign.dds\",\n \"gta3.img/ce_bankalley2.txd/bow_abbmetaldoor.dds\",\"gta3.img/ce_bankalley1.txd/bow_abbmetaldoor.dds\",\n \"gta3.img/lashops93_las2.txd/bow_abbmetaldoor.dds\",\"gta3.img/ce_bankalley1.txd/bow_abbmetaldoor.dds\",\n \"gta3.img/sw_apartflat5.txd/bow_abbmetaldoor.dds\",\"gta3.img/ce_bankalley1.txd/bow_abbmetaldoor.dds\",\n \"gta3.img/sw_block11a.txd/bow_abbmetaldoor.dds\",\"gta3.img/ce_bankalley1.txd/bow_abbmetaldoor.dds\",\n \"gta3.img/cetown3cs_t.txd/sw_storewin01.dds\",\"gta3.img/ce_bankalley1.txd/sw_storewin01.dds\",\n \"gta3.img/desn2_truckstop.txd/sw_storewin01.dds\",\"gta3.img/ce_bankalley1.txd/sw_storewin01.dds\",\n \"gta3.img/des_stownmain2.txd/sw_storewin01.dds\",\"gta3.img/ce_bankalley1.txd/sw_storewin01.dds\",\n \"gta3.img/sw_apartflat5.txd/sw_storewin01.dds\",\"gta3.img/ce_bankalley1.txd/sw_storewin01.dds\",\n \"gta3.img/sw_block06.txd/sw_storewin01.dds\",\"gta3.img/ce_bankalley1.txd/sw_storewin01.dds\",\n \"gta3.img/sw_block10.txd/sw_storewin01.dds\",\"gta3.img/ce_bankalley1.txd/sw_storewin01.dds\",\n \"gta3.img/sw_block11.txd/sw_storewin01.dds\",\"gta3.img/ce_bankalley1.txd/sw_storewin01.dds\",\n \"gta3.img/sw_block12.txd/sw_storewin01.dds\",\"gta3.img/ce_bankalley1.txd/sw_storewin01.dds\",\n \"gta3.img/ce_bankalley2.txd/sjmalley.dds\",\"gta3.img/ce_bankalley1.txd/sjmalley.dds\",\n \"gta3.img/sw_diner1.txd/sjmalley.dds\",\"gta3.img/ce_bankalley1.txd/sjmalley.dds\",\n \"gta3.img/ce_bankalley3.txd/sw_awningsx4.dds\",\"gta3.img/ce_bankalley2.txd/sw_awningsx4.dds\",\n \"gta3.img/cunte_blockammo.txd/sw_awningsx4.dds\",\"gta3.img/ce_bankalley2.txd/sw_awningsx4.dds\",\n \"gta3.img/sw_apartflat.txd/sw_awningsx4.dds\",\"gta3.img/ce_bankalley2.txd/sw_awningsx4.dds\",\n \"gta3.img/sw_apartflatx.txd/sw_awningsx4.dds\",\"gta3.img/ce_bankalley2.txd/sw_awningsx4.dds\",\n \"gta3.img/sw_block04.txd/sw_awningsx4.dds\",\"gta3.img/ce_bankalley2.txd/sw_awningsx4.dds\",\n \"gta3.img/sw_block05.txd/sw_awningsx4.dds\",\"gta3.img/ce_bankalley2.txd/sw_awningsx4.dds\",\n \"gta3.img/sw_block11a.txd/sw_awningsx4.dds\",\"gta3.img/ce_bankalley2.txd/sw_awningsx4.dds\",\n \"gta3.img/sw_block9.txd/sw_awningsx4.dds\",\"gta3.img/ce_bankalley2.txd/sw_awningsx4.dds\",\n \"gta3.img/ce_farmxref.txd/sw_brick04.dds\",\"gta3.img/ce_bankalley2.txd/sw_brick04.dds\",\n \"gta3.img/cunte_cop.txd/sw_brick04.dds\",\"gta3.img/ce_bankalley2.txd/sw_brick04.dds\",\n \"gta3.img/cunte_gas01.txd/sw_brick04.dds\",\"gta3.img/ce_bankalley2.txd/sw_brick04.dds\",\n \"gta3.img/cuntwf.txd/sw_brick04.dds\",\"gta3.img/ce_bankalley2.txd/sw_brick04.dds\",\n \"gta3.img/ce_bankalley3.txd/sw_genx4.dds\",\"gta3.img/ce_bankalley2.txd/sw_genx4.dds\",\n \"gta3.img/cunte_blockammo.txd/sw_genx4.dds\",\"gta3.img/ce_bankalley2.txd/sw_genx4.dds\",\n \"gta3.img/sw_apartflat5.txd/sw_genx4.dds\",\"gta3.img/ce_bankalley2.txd/sw_genx4.dds\",\n \"gta3.img/venice_law.txd/sw_genx4.dds\",\"gta3.img/ce_bankalley2.txd/sw_genx4.dds\",\n \"gta3.img/ce_bankalley3.txd/newall5-2.dds\",\"gta3.img/ce_bankalley2.txd/newall5-2.dds\",\n \"gta3.img/ce_ground11.txd/newall5-2.dds\",\"gta3.img/ce_bankalley2.txd/newall5-2.dds\",\n \"gta3.img/ce_ground12.txd/newall5-2.dds\",\"gta3.img/ce_bankalley2.txd/newall5-2.dds\",\n \"gta3.img/ce_ground14.txd/newall5-2.dds\",\"gta3.img/ce_bankalley2.txd/newall5-2.dds\",\n \"gta3.img/ce_payspray.txd/newall5-2.dds\",\"gta3.img/ce_bankalley2.txd/newall5-2.dds\",\n \"gta3.img/chemgrnd_las2.txd/newall5-2.dds\",\"gta3.img/ce_bankalley2.txd/newall5-2.dds\",\n \"gta3.img/civic07_lan.txd/newall5-2.dds\",\"gta3.img/ce_bankalley2.txd/newall5-2.dds\",\n \"gta3.img/stormdrain_las2.txd/newall5-2.dds\",\"gta3.img/ce_bankalley2.txd/newall5-2.dds\",\n \"gta3.img/sw_sheds.txd/newall5-2.dds\",\"gta3.img/ce_bankalley2.txd/newall5-2.dds\",\n \"gta3.img/sw_apartflat.txd/sw_wind08.dds\",\"gta3.img/ce_bankalley2.txd/sw_wind08.dds\",\n \"gta3.img/dk_midbuilds.txd/sw_fleishberg01.dds\",\"gta3.img/ce_bankalley3.txd/sw_fleishberg01.dds\",\n \"gta3.img/sw_brewery.txd/sw_fleishberg01.dds\",\"gta3.img/ce_bankalley3.txd/sw_fleishberg01.dds\",\n \"gta3.img/vgnbballsign2.txd/sw_fleishberg01.dds\",\"gta3.img/ce_bankalley3.txd/sw_fleishberg01.dds\",\n \"gta_int.img/crowds.txd/sw_fleishberg01.dds\",\"gta3.img/ce_bankalley3.txd/sw_fleishberg01.dds\",\n \"gta_int.img/kickarse.txd/sw_fleishberg01.dds\",\"gta3.img/ce_bankalley3.txd/sw_fleishberg01.dds\",\n \"gta_int.img/stands.txd/sw_fleishberg01.dds\",\"gta3.img/ce_bankalley3.txd/sw_fleishberg01.dds\",\n \"gta3.img/cuntbridge.txd/metal1_128.dds\",\"gta3.img/ce_bankalley3.txd/metal1_128.dds\",\n \"gta3.img/cuntplntfnce.txd/metal1_128.dds\",\"gta3.img/ce_bankalley3.txd/metal1_128.dds\",\n \"gta3.img/cuntwshopscs_t.txd/metal1_128.dds\",\"gta3.img/ce_bankalley3.txd/metal1_128.dds\",\n \"gta3.img/cxref_freeway.txd/metal1_128.dds\",\"gta3.img/ce_bankalley3.txd/metal1_128.dds\",\n \"gta3.img/des_nwtown.txd/metal1_128.dds\",\"gta3.img/ce_bankalley3.txd/metal1_128.dds\",\n \"gta3.img/des_refinery.txd/metal1_128.dds\",\"gta3.img/ce_bankalley3.txd/metal1_128.dds\",\n \"gta3.img/des_trainstuff.txd/metal1_128.dds\",\"gta3.img/ce_bankalley3.txd/metal1_128.dds\",\n \"gta3.img/des_wtownmain.txd/metal1_128.dds\",\"gta3.img/ce_bankalley3.txd/metal1_128.dds\",\n \"gta3.img/des_xoilfield.txd/metal1_128.dds\",\"gta3.img/ce_bankalley3.txd/metal1_128.dds\",\n \"gta3.img/dockcargo1_las.txd/metal1_128.dds\",\"gta3.img/ce_bankalley3.txd/metal1_128.dds\",\n \"gta3.img/dynsigns.txd/metal1_128.dds\",\"gta3.img/ce_bankalley3.txd/metal1_128.dds\",\n \"gta3.img/eastls1b_lae2.txd/metal1_128.dds\",\"gta3.img/ce_bankalley3.txd/metal1_128.dds\",\n \"gta3.img/fishwarf.txd/metal1_128.dds\",\"gta3.img/ce_bankalley3.txd/metal1_128.dds\",\n \"gta3.img/frieghter2sfe.txd/metal1_128.dds\",\"gta3.img/ce_bankalley3.txd/metal1_128.dds\",\n \"gta3.img/ganton02_lae2.txd/metal1_128.dds\",\"gta3.img/ce_bankalley3.txd/metal1_128.dds\",\n \"gta3.img/ggatepark.txd/metal1_128.dds\",\"gta3.img/ce_bankalley3.txd/metal1_128.dds\",\n \"gta3.img/ground3_las2.txd/metal1_128.dds\",\"gta3.img/ce_bankalley3.txd/metal1_128.dds\",\n \"gta3.img/groundb_las2.txd/metal1_128.dds\",\"gta3.img/ce_bankalley3.txd/metal1_128.dds\",\n \"gta3.img/ground_las2.txd/metal1_128.dds\",\"gta3.img/ce_bankalley3.txd/metal1_128.dds\",\n \"gta3.img/gymblok2_lae2.txd/metal1_128.dds\",\"gta3.img/ce_bankalley3.txd/metal1_128.dds\",\n \"gta3.img/imrancomp_las2.txd/metal1_128.dds\",\"gta3.img/ce_bankalley3.txd/metal1_128.dds\",\n \"gta3.img/indust_lax.txd/metal1_128.dds\",\"gta3.img/ce_bankalley3.txd/metal1_128.dds\",\n \"gta3.img/labins01_la.txd/metal1_128.dds\",\"gta3.img/ce_bankalley3.txd/metal1_128.dds\",\n \"gta3.img/laealpha.txd/metal1_128.dds\",\"gta3.img/ce_bankalley3.txd/metal1_128.dds\",\n \"gta3.img/landlae2c.txd/metal1_128.dds\",\"gta3.img/ce_bankalley3.txd/metal1_128.dds\",\n \"gta3.img/lasxrefdock.txd/metal1_128.dds\",\"gta3.img/ce_bankalley3.txd/metal1_128.dds\",\n \"gta3.img/law2misc_lax.txd/metal1_128.dds\",\"gta3.img/ce_bankalley3.txd/metal1_128.dds\",\n \"gta3.img/law2_roadsb.txd/metal1_128.dds\",\"gta3.img/ce_bankalley3.txd/metal1_128.dds\",\n \"gta3.img/maingatetxd.txd/metal1_128.dds\",\"gta3.img/ce_bankalley3.txd/metal1_128.dds\",\n \"gta3.img/mtbfencecs_t.txd/metal1_128.dds\",\"gta3.img/ce_bankalley3.txd/metal1_128.dds\",\n \"gta3.img/pierb_law2.txd/metal1_128.dds\",\"gta3.img/ce_bankalley3.txd/metal1_128.dds\",\n \"gta3.img/pierc_law2.txd/metal1_128.dds\",\"gta3.img/ce_bankalley3.txd/metal1_128.dds\",\n \"gta3.img/privatesign.txd/metal1_128.dds\",\"gta3.img/ce_bankalley3.txd/metal1_128.dds\",\n \"gta3.img/pylons.txd/metal1_128.dds\",\"gta3.img/ce_bankalley3.txd/metal1_128.dds\",\n \"gta3.img/roadsign.txd/metal1_128.dds\",\"gta3.img/ce_bankalley3.txd/metal1_128.dds\",\n \"gta3.img/telegraph.txd/metal1_128.dds\",\"gta3.img/ce_bankalley3.txd/metal1_128.dds\",\n \"gta3.img/union_las.txd/metal1_128.dds\",\"gta3.img/ce_bankalley3.txd/metal1_128.dds\",\n \"gta3.img/vgehshade.txd/metal1_128.dds\",\"gta3.img/ce_bankalley3.txd/metal1_128.dds\",\n \"gta3.img/vgetrainfnce.txd/metal1_128.dds\",\"gta3.img/ce_bankalley3.txd/metal1_128.dds\",\n \"gta3.img/vgncarshade1.txd/metal1_128.dds\",\"gta3.img/ce_bankalley3.txd/metal1_128.dds\",\n \"gta3.img/vgnntrainfnce.txd/metal1_128.dds\",\"gta3.img/ce_bankalley3.txd/metal1_128.dds\",\n \"gta3.img/vgnpwrentrnce.txd/metal1_128.dds\",\"gta3.img/ce_bankalley3.txd/metal1_128.dds\",\n \"gta3.img/vgnpwrmainbld.txd/metal1_128.dds\",\"gta3.img/ce_bankalley3.txd/metal1_128.dds\",\n \"gta3.img/vgnpwroutbld1.txd/metal1_128.dds\",\"gta3.img/ce_bankalley3.txd/metal1_128.dds\",\n \"gta3.img/vgnshopnmall.txd/metal1_128.dds\",\"gta3.img/ce_bankalley3.txd/metal1_128.dds\",\n \"gta3.img/vgsehseing1.txd/metal1_128.dds\",\"gta3.img/ce_bankalley3.txd/metal1_128.dds\",\n \"gta3.img/vgsroadsign.txd/metal1_128.dds\",\"gta3.img/ce_bankalley3.txd/metal1_128.dds\",\n \"gta3.img/vgstlgraphpole.txd/metal1_128.dds\",\"gta3.img/ce_bankalley3.txd/metal1_128.dds\",\n \"gta3.img/vgwestrailrd.txd/metal1_128.dds\",\"gta3.img/ce_bankalley3.txd/metal1_128.dds\",\n \"gta3.img/warehus_las2.txd/metal1_128.dds\",\"gta3.img/ce_bankalley3.txd/metal1_128.dds\",\n \"gta3.img/xrf_refineryla.txd/metal1_128.dds\",\"gta3.img/ce_bankalley3.txd/metal1_128.dds\",\n \"gta_int.img/genintwarehsint3.txd/metal1_128.dds\",\"gta3.img/ce_bankalley3.txd/metal1_128.dds\",\n \"gta_int.img/smashtv.txd/metal1_128.dds\",\"gta3.img/ce_bankalley3.txd/metal1_128.dds\",\n \"gta3.img/sunset01_law2.txd/bankside_256.dds\",\"gta3.img/ce_bankalley3.txd/bankside_256.dds\",\n \"gta3.img/cs_lod.txd/fence1lod.dds\",\"gta3.img/cebrew_lod1.txd/fence1lod.dds\",\n \"gta3.img/electricgate.txd/notice02.dds\",\"gta3.img/ce_burbhouse.txd/notice02.dds\",\n \"gta3.img/hospital2.txd/black.dds\",\"gta3.img/ce_burbhouse.txd/black_128.dds\",\n \"gta3.img/hospital2.txd/airportdoor1.dds\",\"gta3.img/ce_burbhouse.txd/black_128.dds\",\n \"gta3.img/libertyhi5.txd/indtenbtm128.dds\",\"gta3.img/ce_burbhouse.txd/black_128.dds\",\n \"gta3.img/ce_payspray.txd/sw_shedwindow1.dds\",\"gta3.img/ce_burbhouse.txd/sw_shedwindow1.dds\",\n \"gta3.img/sw_shack2.txd/sw_shedwindow1.dds\",\"gta3.img/ce_burbhouse.txd/sw_shedwindow1.dds\",\n \"gta3.img/sw_sheds.txd/sw_shedwindow1.dds\",\"gta3.img/ce_burbhouse.txd/sw_shedwindow1.dds\",\n \"gta3.img/des_byoffice.txd/ventc64.dds\",\"gta3.img/ce_burbhouse.txd/ventc64.dds\",\n \"gta3.img/dockcargo1_las.txd/ventc64.dds\",\"gta3.img/ce_burbhouse.txd/ventc64.dds\",\n \"gta3.img/lasxrefdock.txd/ventc64.dds\",\"gta3.img/ce_burbhouse.txd/ventc64.dds\",\n \"gta3.img/vegasaircon.txd/ventc64.dds\",\"gta3.img/ce_burbhouse.txd/ventc64.dds\",\n \"gta3.img/xenon_sfse.txd/ventc64.dds\",\"gta3.img/ce_burbhouse.txd/ventc64.dds\",\n \"gta3.img/sw_apartflatx.txd/wallbeigenew256.dds\",\"gta3.img/ce_burbhouse.txd/wallbeigenew256.dds\",\n \"gta3.img/sw_block10.txd/wallbeigenew256.dds\",\"gta3.img/ce_burbhouse.txd/wallbeigenew256.dds\",\n \"gta3.img/tempo22_law.txd/wallbeigenew256.dds\",\"gta3.img/ce_burbhouse.txd/wallbeigenew256.dds\",\n \"gta3.img/cunte_blockammo.txd/sw_door13.dds\",\"gta3.img/ce_burbhouse.txd/sw_door13.dds\",\n \"gta3.img/vegashse4.txd/sw_door13.dds\",\"gta3.img/ce_burbhouse.txd/sw_door13.dds\",\n \"gta3.img/cetown3cs_t.txd/sw_wind10.dds\",\"gta3.img/ce_burbhouse.txd/sw_wind10.dds\",\n \"gta3.img/cxref_savhus.txd/sw_wind10.dds\",\"gta3.img/ce_burbhouse.txd/sw_wind10.dds\",\n \"gta3.img/sw_apartflat5.txd/sw_wind10.dds\",\"gta3.img/ce_burbhouse.txd/sw_wind10.dds\",\n \"gta3.img/pierc_law2.txd/pierdoor02_law.dds\",\"gta3.img/ce_burbhouse.txd/pierdoor02_law.dds\",\n \"gta3.img/sfn_apart02sfn.txd/pierdoor02_law.dds\",\"gta3.img/ce_burbhouse.txd/pierdoor02_law.dds\",\n \"gta3.img/sw_church.txd/shingles4.dds\",\"gta3.img/ce_burbhouse.txd/shingles4.dds\",\n \"gta3.img/vegashse4.txd/shingles4.dds\",\"gta3.img/ce_burbhouse.txd/shingles4.dds\",\n \"gta3.img/vegirlfr01.txd/shingles4.dds\",\"gta3.img/ce_burbhouse.txd/shingles4.dds\",\n \"gta3.img/ce_ground14.txd/floor_tileone_256.dds\",\"gta3.img/ce_burbhouse.txd/floor_tileone_256.dds\",\n \"gta3.img/cetown3cs_t.txd/floor_tileone_256.dds\",\"gta3.img/ce_burbhouse.txd/floor_tileone_256.dds\",\n \"gta3.img/cunte_blockammo.txd/floor_tileone_256.dds\",\"gta3.img/ce_burbhouse.txd/floor_tileone_256.dds\",\n \"gta3.img/cunte_town1.txd/floor_tileone_256.dds\",\"gta3.img/ce_burbhouse.txd/floor_tileone_256.dds\",\n \"gta3.img/roads_lawn.txd/floor_tileone_256.dds\",\"gta3.img/ce_burbhouse.txd/floor_tileone_256.dds\",\n \"gta3.img/sw_apartflat.txd/floor_tileone_256.dds\",\"gta3.img/ce_burbhouse.txd/floor_tileone_256.dds\",\n \"gta3.img/sw_apartflatx.txd/floor_tileone_256.dds\",\"gta3.img/ce_burbhouse.txd/floor_tileone_256.dds\",\n \"gta3.img/cemetery_law.txd/conc_wall2_128h.dds\",\"gta3.img/ce_burbhouse.txd/conc_wall2_128h.dds\",\n \"gta3.img/cemetint_law.txd/conc_wall2_128h.dds\",\"gta3.img/ce_burbhouse.txd/conc_wall2_128h.dds\",\n \"gta3.img/cunte_house1.txd/conc_wall2_128h.dds\",\"gta3.img/ce_burbhouse.txd/conc_wall2_128h.dds\",\n \"gta3.img/ggatepark.txd/conc_wall2_128h.dds\",\"gta3.img/ce_burbhouse.txd/conc_wall2_128h.dds\",\n \"gta3.img/skyscrapelan2.txd/conc_wall2_128h.dds\",\"gta3.img/ce_burbhouse.txd/conc_wall2_128h.dds\",\n \"gta3.img/sw_church.txd/conc_wall2_128h.dds\",\"gta3.img/ce_burbhouse.txd/conc_wall2_128h.dds\",\n \"gta3.img/sw_fact02alt.txd/conc_wall2_128h.dds\",\"gta3.img/ce_burbhouse.txd/conc_wall2_128h.dds\",\n \"gta3.img/vgnabatoir.txd/conc_wall2_128h.dds\",\"gta3.img/ce_burbhouse.txd/conc_wall2_128h.dds\",\n \"gta3.img/cw2_photoblockcs_t.txd/sw_wallbrick_06.dds\",\"gta3.img/ce_burbhouse.txd/sw_wallbrick_06.dds\",\n \"gta3.img/easthills_lahills.txd/sw_wallbrick_06.dds\",\"gta3.img/ce_burbhouse.txd/sw_wallbrick_06.dds\",\n \"gta3.img/sw_block05.txd/sw_wallbrick_06.dds\",\"gta3.img/ce_burbhouse.txd/sw_wallbrick_06.dds\",\n \"gta3.img/sw_poorhouse.txd/sw_wallbrick_06.dds\",\"gta3.img/ce_burbhouse.txd/sw_wallbrick_06.dds\",\n \"gta3.img/vegashse8.txd/sw_wallbrick_06.dds\",\"gta3.img/ce_burbhouse.txd/sw_wallbrick_06.dds\",\n \"gta3.img/vgesvhouse01.txd/sw_wallbrick_06.dds\",\"gta3.img/ce_burbhouse.txd/sw_wallbrick_06.dds\",\n \"gta3.img/vgsecarshow.txd/sw_wallbrick_06.dds\",\"gta3.img/ce_burbhouse.txd/sw_wallbrick_06.dds\",\n \"gta3.img/vgssland01.txd/sw_wallbrick_06.dds\",\"gta3.img/ce_burbhouse.txd/sw_wallbrick_06.dds\",\n \"gta3.img/ce_ground07.txd/grass_path_law.dds\",\"gta3.img/ce_burbhouse.txd/grass_path_law.dds\",\n \"gta3.img/cemetery_law.txd/grass_path_law.dds\",\"gta3.img/ce_burbhouse.txd/grass_path_law.dds\",\n \"gta3.img/cunte_house1.txd/grass_path_law.dds\",\"gta3.img/ce_burbhouse.txd/grass_path_law.dds\",\n \"gta3.img/sw_poorhouse.txd/grass_path_law.dds\",\"gta3.img/ce_burbhouse.txd/grass_path_law.dds\",\n \"gta3.img/des_bighus.txd/sw_lattice.dds\",\"gta3.img/ce_burbhouse.txd/sw_lattice.dds\",\n \"gta3.img/sw_poorhouse.txd/sw_lattice.dds\",\"gta3.img/ce_burbhouse.txd/sw_lattice.dds\",\n \"gta3.img/ce_lod_02.txd/vgs_whitewall_128lod.dds\",\"gta3.img/ce_burblod.txd/vgs_whitewall_128lod.dds\",\n \"gta3.img/lawnlodbig.txd/vgs_whitewall_128lod.dds\",\"gta3.img/ce_burblod.txd/vgs_whitewall_128lod.dds\",\n \"gta3.img/lodlawnsmall.txd/vgs_whitewall_128lod.dds\",\"gta3.img/ce_burblod.txd/vgs_whitewall_128lod.dds\",\n \"gta3.img/lodvgsslod01.txd/vgs_whitewall_128lod.dds\",\"gta3.img/ce_burblod.txd/vgs_whitewall_128lod.dds\",\n \"gta3.img/lodvegaswest1.txd/sw_wallbrick_lod.dds\",\"gta3.img/ce_burblod.txd/sw_wallbrick_06lod.dds\",\n \"gta3.img/lodvegaswest2.txd/sw_wallbrick_lod.dds\",\"gta3.img/ce_burblod.txd/sw_wallbrick_06lod.dds\",\n \"gta3.img/lodvegaswest3.txd/sw_wallbrick_lod.dds\",\"gta3.img/ce_burblod.txd/sw_wallbrick_06lod.dds\",\n \"gta3.img/lodvegaswest4.txd/sw_wallbrick_lod.dds\",\"gta3.img/ce_burblod.txd/sw_wallbrick_06lod.dds\",\n \"gta3.img/lodvgsslod01.txd/sw_wallbrick_lod.dds\",\"gta3.img/ce_burblod.txd/sw_wallbrick_06lod.dds\",\n \"gta3.img/lodvgswestout.txd/sw_wallbrick_lod.dds\",\"gta3.img/ce_burblod.txd/sw_wallbrick_06lod.dds\",\n \"gta3.img/vegaselod3.txd/sw_wallbrick_lod.dds\",\"gta3.img/ce_burblod.txd/sw_wallbrick_06lod.dds\",\n \"gta3.img/vegashselod1.txd/sw_wallbrick_lod.dds\",\"gta3.img/ce_burblod.txd/sw_wallbrick_06lod.dds\",\n \"gta3.img/ce_lod_04.txd/conc_wall2_128hlod.dds\",\"gta3.img/ce_burblod.txd/conc_wall2_128hlod.dds\",\n \"gta3.img/ce_lod_05.txd/conc_wall2_128hlod.dds\",\"gta3.img/ce_burblod.txd/conc_wall2_128hlod.dds\",\n \"gta3.img/indust_lax.txd/hangingwires2.dds\",\"gta3.img/cecuntetunnel.txd/hangingwires2.dds\",\n \"gta3.img/telegraph.txd/hangingwires2.dds\",\"gta3.img/cecuntetunnel.txd/hangingwires2.dds\",\n \"gta3.img/transformer_sfs.txd/hangingwires2.dds\",\"gta3.img/cecuntetunnel.txd/hangingwires2.dds\",\n \"gta3.img/vgstlgraphpole.txd/hangingwires2.dds\",\"gta3.img/cecuntetunnel.txd/hangingwires2.dds\",\n \"gta_int.img/destructo.txd/hangingwires2.dds\",\"gta3.img/cecuntetunnel.txd/hangingwires2.dds\",\n \"gta_int.img/stadstunt.txd/hangingwires2.dds\",\"gta3.img/cecuntetunnel.txd/hangingwires2.dds\",\n \"gta_int.img/sumo.txd/hangingwires2.dds\",\"gta3.img/cecuntetunnel.txd/hangingwires2.dds\",\n \"gta3.img/cunte_wires.txd/awirex2.dds\",\"gta3.img/cecuntetunnel.txd/awirex2.dds\",\n \"gta3.img/ce_ground05.txd/dirtywall_256.dds\",\"gta3.img/cecuntetunnel.txd/dirtywall_256.dds\",\n \"gta3.img/cunte_town1.txd/dirtywall_256.dds\",\"gta3.img/cecuntetunnel.txd/dirtywall_256.dds\",\n \"gta3.img/ce_traintrack2.txd/ab_walllite.dds\",\"gta3.img/cecuntetunnel.txd/ab_walllite.dds\",\n \"gta3.img/lanriver.txd/ab_walllite.dds\",\"gta3.img/cecuntetunnel.txd/ab_walllite.dds\",\n \"gta3.img/railtracklae.txd/ab_walllite.dds\",\"gta3.img/cecuntetunnel.txd/ab_walllite.dds\",\n \"gta3.img/roads_tunnellahills.txd/ab_walllite.dds\",\"gta3.img/cecuntetunnel.txd/ab_walllite.dds\",\n \"gta_int.img/genintintgarage3b.txd/ab_walllite.dds\",\"gta3.img/cecuntetunnel.txd/ab_walllite.dds\",\n \"gta_int.img/carter_outside.txd/mp_carter_corrwall.dds\",\"gta3.img/cecuntetunnel.txd/mp_carter_corrwall.dds\",\n \"gta3.img/cewrehse.txd/airportwall_2_2.dds\",\"gta3.img/cecuntetunnel.txd/airportwall_2_2.dds\",\n \"gta3.img/gravblok01_lahills.txd/airportwall_2_2.dds\",\"gta3.img/cecuntetunnel.txd/airportwall_2_2.dds\",\n \"gta3.img/plaza1_lan2.txd/airportwall_2_2.dds\",\"gta3.img/cecuntetunnel.txd/airportwall_2_2.dds\",\n \"gta3.img/roadlan2.txd/airportwall_2_2.dds\",\"gta3.img/cecuntetunnel.txd/airportwall_2_2.dds\",\n \"gta3.img/easthills_lahills.txd/pave04_128.dds\",\"gta3.img/cecuntetunnel.txd/pave04_128.dds\",\n \"gta3.img/lahillsgrounds.txd/pave04_128.dds\",\"gta3.img/cecuntetunnel.txd/pave04_128.dds\",\n \"gta3.img/richman02_lahills.txd/pave04_128.dds\",\"gta3.img/cecuntetunnel.txd/pave04_128.dds\",\n \"gta3.img/sw_office.txd/pave04_128.dds\",\"gta3.img/cecuntetunnel.txd/pave04_128.dds\",\n \"gta3.img/venicegb02_law.txd/pave04_128.dds\",\"gta3.img/cecuntetunnel.txd/pave04_128.dds\",\n \"gta3.img/cuntwroad.txd/conc_wall_stripd128h.dds\",\"gta3.img/cecuntetunnel.txd/conc_wall_stripd128h.dds\",\n \"gta3.img/lahillsgrounds.txd/conc_wall_stripd128h.dds\",\"gta3.img/cecuntetunnel.txd/conc_wall_stripd128h.dds\",\n \"gta3.img/lashops93_las2.txd/conc_wall_stripd128h.dds\",\"gta3.img/cecuntetunnel.txd/conc_wall_stripd128h.dds\",\n \"gta3.img/melrose15_lawn.txd/conc_wall_stripd128h.dds\",\"gta3.img/cecuntetunnel.txd/conc_wall_stripd128h.dds\",\n \"gta3.img/sunrise08_lawn.txd/conc_wall_stripd128h.dds\",\"gta3.img/cecuntetunnel.txd/conc_wall_stripd128h.dds\",\n \"gta3.img/vgndwntwn1.txd/conc_wall_stripd128h.dds\",\"gta3.img/cecuntetunnel.txd/conc_wall_stripd128h.dds\",\n \"gta_int.img/intclotheshiphop.txd/conc_wall_stripd128h.dds\",\"gta3.img/cecuntetunnel.txd/conc_wall_stripd128h.dds\",\n \"gta3.img/conhooses.txd/des_sherrifwall1.dds\",\"gta3.img/ce_fact01.txd/des_sherrifwall1.dds\",\n \"gta3.img/cuntwshopscs_t.txd/des_sherrifwall1.dds\",\"gta3.img/ce_fact01.txd/des_sherrifwall1.dds\",\n \"gta3.img/cxrf_payspray.txd/des_sherrifwall1.dds\",\"gta3.img/ce_fact01.txd/des_sherrifwall1.dds\",\n \"gta3.img/des_bigearstuff.txd/des_sherrifwall1.dds\",\"gta3.img/ce_fact01.txd/des_sherrifwall1.dds\",\n \"gta3.img/des_bighus.txd/des_sherrifwall1.dds\",\"gta3.img/ce_fact01.txd/des_sherrifwall1.dds\",\n \"gta3.img/des_factory.txd/des_sherrifwall1.dds\",\"gta3.img/ce_fact01.txd/des_sherrifwall1.dds\",\n \"gta3.img/des_nwtownpolice.txd/des_sherrifwall1.dds\",\"gta3.img/ce_fact01.txd/des_sherrifwall1.dds\",\n \"gta3.img/des_ranch.txd/des_sherrifwall1.dds\",\"gta3.img/ce_fact01.txd/des_sherrifwall1.dds\",\n \"gta3.img/des_stownmain3.txd/des_sherrifwall1.dds\",\"gta3.img/ce_fact01.txd/des_sherrifwall1.dds\",\n \"gta3.img/des_stownstrip2.txd/des_sherrifwall1.dds\",\"gta3.img/ce_fact01.txd/des_sherrifwall1.dds\",\n \"gta3.img/des_ufoinn.txd/des_sherrifwall1.dds\",\"gta3.img/ce_fact01.txd/des_sherrifwall1.dds\",\n \"gta3.img/sw_smlfarm.txd/des_sherrifwall1.dds\",\"gta3.img/ce_fact01.txd/des_sherrifwall1.dds\",\n \"gta3.img/ce_fact03.txd/airconfrnt1_128.dds\",\"gta3.img/ce_fact01.txd/airconfrnt1_128.dds\",\n \"gta3.img/cuntwbtxcs_t.txd/airconfrnt1_128.dds\",\"gta3.img/ce_fact01.txd/airconfrnt1_128.dds\",\n \"gta3.img/cxrf_payspray.txd/airconfrnt1_128.dds\",\"gta3.img/ce_fact01.txd/airconfrnt1_128.dds\",\n \"gta3.img/des_bigearstuff.txd/airconfrnt1_128.dds\",\"gta3.img/ce_fact01.txd/airconfrnt1_128.dds\",\n \"gta3.img/desn2_peckers.txd/airconfrnt1_128.dds\",\"gta3.img/ce_fact01.txd/airconfrnt1_128.dds\",\n \"gta3.img/conhooses.txd/des_hooswin2.dds\",\"gta3.img/ce_fact01.txd/des_hooswin2.dds\",\n \"gta3.img/cuntwbtxcs_t.txd/des_hooswin2.dds\",\"gta3.img/ce_fact01.txd/des_hooswin2.dds\",\n \"gta3.img/des_bigearstuff.txd/des_hooswin2.dds\",\"gta3.img/ce_fact01.txd/des_hooswin2.dds\",\n \"gta3.img/desn2_peckers.txd/des_hooswin2.dds\",\"gta3.img/ce_fact01.txd/des_hooswin2.dds\",\n \"gta3.img/des_quarrybits.txd/des_hooswin2.dds\",\"gta3.img/ce_fact01.txd/des_hooswin2.dds\",\n \"gta3.img/des_steakhouse.txd/des_hooswin2.dds\",\"gta3.img/ce_fact01.txd/des_hooswin2.dds\",\n \"gta3.img/des_stownmain3.txd/des_hooswin2.dds\",\"gta3.img/ce_fact01.txd/des_hooswin2.dds\",\n \"gta3.img/des_wtownmain.txd/des_hooswin2.dds\",\"gta3.img/ce_fact01.txd/des_hooswin2.dds\",\n \"gta3.img/sw_sheds2.txd/des_hooswin2.dds\",\"gta3.img/ce_fact01.txd/des_hooswin2.dds\",\n \"gta3.img/cunte_bar1.txd/airportmetalwall256.dds\",\"gta3.img/ce_fact01.txd/airportmetalwall256.dds\",\n \"gta3.img/cuntwbt.txd/airportmetalwall256.dds\",\"gta3.img/ce_fact01.txd/airportmetalwall256.dds\",\n \"gta3.img/cuntwbtxcs_t.txd/airportmetalwall256.dds\",\"gta3.img/ce_fact01.txd/airportmetalwall256.dds\",\n \"gta3.img/des_bigearstuff.txd/airportmetalwall256.dds\",\"gta3.img/ce_fact01.txd/airportmetalwall256.dds\",\n \"gta3.img/desn2_peckers.txd/airportmetalwall256.dds\",\"gta3.img/ce_fact01.txd/airportmetalwall256.dds\",\n \"gta3.img/desn2_truckstop.txd/airportmetalwall256.dds\",\"gta3.img/ce_fact01.txd/airportmetalwall256.dds\",\n \"gta3.img/des_nwtownclinic.txd/airportmetalwall256.dds\",\"gta3.img/ce_fact01.txd/airportmetalwall256.dds\",\n \"gta3.img/des_nwtownpolice.txd/airportmetalwall256.dds\",\"gta3.img/ce_fact01.txd/airportmetalwall256.dds\",\n \"gta3.img/des_nwtown.txd/airportmetalwall256.dds\",\"gta3.img/ce_fact01.txd/airportmetalwall256.dds\",\n \"gta3.img/des_nwtownw.txd/airportmetalwall256.dds\",\"gta3.img/ce_fact01.txd/airportmetalwall256.dds\",\n \"gta3.img/des_quarrybits.txd/airportmetalwall256.dds\",\"gta3.img/ce_fact01.txd/airportmetalwall256.dds\",\n \"gta3.img/des_stownmain1.txd/airportmetalwall256.dds\",\"gta3.img/ce_fact01.txd/airportmetalwall256.dds\",\n \"gta3.img/des_substation.txd/airportmetalwall256.dds\",\"gta3.img/ce_fact01.txd/airportmetalwall256.dds\",\n \"gta3.img/des_telescopestuff.txd/airportmetalwall256.dds\",\"gta3.img/ce_fact01.txd/airportmetalwall256.dds\",\n \"gta3.img/des_wtownmain.txd/airportmetalwall256.dds\",\"gta3.img/ce_fact01.txd/airportmetalwall256.dds\",\n \"gta3.img/sawmillcs_t.txd/airportmetalwall256.dds\",\"gta3.img/ce_fact01.txd/airportmetalwall256.dds\",\n \"gta3.img/sprunkworks.txd/airportmetalwall256.dds\",\"gta3.img/ce_fact01.txd/airportmetalwall256.dds\",\n \"gta3.img/sw_fact01.txd/airportmetalwall256.dds\",\"gta3.img/ce_fact01.txd/airportmetalwall256.dds\",\n \"gta3.img/sw_sheds2.txd/airportmetalwall256.dds\",\"gta3.img/ce_fact01.txd/airportmetalwall256.dds\",\n \"gta3.img/vgnretail7.txd/airportmetalwall256.dds\",\"gta3.img/ce_fact01.txd/airportmetalwall256.dds\",\n \"gta3.img/vgsewrehse.txd/airportmetalwall256.dds\",\"gta3.img/ce_fact01.txd/airportmetalwall256.dds\",\n \"gta3.img/vgsrailbuild.txd/airportmetalwall256.dds\",\"gta3.img/ce_fact01.txd/airportmetalwall256.dds\",\n \"gta3.img/vgsswarehse02.txd/airportmetalwall256.dds\",\"gta3.img/ce_fact01.txd/airportmetalwall256.dds\",\n \"gta3.img/cuntwbt.txd/glassblock_law.dds\",\"gta3.img/ce_fact01.txd/glassblock_law.dds\",\n \"gta3.img/des_bigearstuff.txd/glassblock_law.dds\",\"gta3.img/ce_fact01.txd/glassblock_law.dds\",\n \"gta3.img/desn2_peckers.txd/glassblock_law.dds\",\"gta3.img/ce_fact01.txd/glassblock_law.dds\",\n \"gta3.img/des_stownmain3.txd/glassblock_law.dds\",\"gta3.img/ce_fact01.txd/glassblock_law.dds\",\n \"gta3.img/eastbeach2a_lae2.txd/glassblock_law.dds\",\"gta3.img/ce_fact01.txd/glassblock_law.dds\",\n \"gta3.img/hrbr_sfn.txd/glassblock_law.dds\",\"gta3.img/ce_fact01.txd/glassblock_law.dds\",\n \"gta3.img/losflor4_lae2.txd/glassblock_law.dds\",\"gta3.img/ce_fact01.txd/glassblock_law.dds\",\n \"gta3.img/santamonhus.txd/glassblock_law.dds\",\"gta3.img/ce_fact01.txd/glassblock_law.dds\",\n \"gta3.img/sawmillcs_t.txd/glassblock_law.dds\",\"gta3.img/ce_fact01.txd/glassblock_law.dds\",\n \"gta3.img/sunrise09_lawn.txd/glassblock_law.dds\",\"gta3.img/ce_fact01.txd/glassblock_law.dds\",\n \"gta3.img/venchouse_lax.txd/glassblock_law.dds\",\"gta3.img/ce_fact01.txd/glassblock_law.dds\",\n \"gta3.img/vgntamotel.txd/glassblock_law.dds\",\"gta3.img/ce_fact01.txd/glassblock_law.dds\",\n \"gta3.img/cuntwbt.txd/puttywall1.dds\",\"gta3.img/ce_fact01.txd/puttywall1.dds\",\n \"gta3.img/des_bigearstuff.txd/puttywall1.dds\",\"gta3.img/ce_fact01.txd/puttywall1.dds\",\n \"gta3.img/desn2_peckers.txd/puttywall1.dds\",\"gta3.img/ce_fact01.txd/puttywall1.dds\",\n \"gta3.img/vegasdwntwn1.txd/puttywall1.dds\",\"gta3.img/ce_fact01.txd/puttywall1.dds\",\n \"gta3.img/sw_apartflat.txd/gb_truckdepot19.dds\",\"gta3.img/ce_fact03.txd/gb_truckdepot19.dds\",\n \"gta3.img/sw_fact02.txd/gb_truckdepot19.dds\",\"gta3.img/ce_fact03.txd/gb_truckdepot19.dds\",\n \"gta3.img/ce_payspray.txd/sw_newcorrug.dds\",\"gta3.img/ce_fact03.txd/sw_newcorrug.dds\",\n \"gta3.img/des_quarrybits.txd/sw_newcorrug.dds\",\"gta3.img/ce_fact03.txd/sw_newcorrug.dds\",\n \"gta3.img/sw_brewery.txd/sw_newcorrug.dds\",\"gta3.img/ce_fact03.txd/sw_newcorrug.dds\",\n \"gta3.img/sw_fact01a.txd/sw_newcorrug.dds\",\"gta3.img/ce_fact03.txd/sw_newcorrug.dds\",\n \"gta3.img/sw_fact02.txd/sw_newcorrug.dds\",\"gta3.img/ce_fact03.txd/sw_newcorrug.dds\",\n \"gta3.img/sw_sheds.txd/sw_newcorrug.dds\",\"gta3.img/ce_fact03.txd/sw_newcorrug.dds\",\n \"gta3.img/sw_block03.txd/sw_garwind.dds\",\"gta3.img/ce_fact03.txd/sw_garwind.dds\",\n \"gta3.img/sw_brewery.txd/sw_garwind.dds\",\"gta3.img/ce_fact03.txd/sw_garwind.dds\",\n \"gta3.img/sw_fact01a.txd/sw_garwind.dds\",\"gta3.img/ce_fact03.txd/sw_garwind.dds\",\n \"gta3.img/sw_fact01.txd/sw_garwind.dds\",\"gta3.img/ce_fact03.txd/sw_garwind.dds\",\n \"gta3.img/sw_sheds.txd/sw_garwind.dds\",\"gta3.img/ce_fact03.txd/sw_garwind.dds\",\n \"gta3.img/ce_terminal.txd/shitydoor1_256.dds\",\"gta3.img/ce_fact03.txd/shitydoor1_256.dds\",\n \"gta3.img/ext_doors_old.txd/shitydoor1_256.dds\",\"gta3.img/ce_fact03.txd/shitydoor1_256.dds\",\n \"gta3.img/jeffers4_lae.txd/shitydoor1_256.dds\",\"gta3.img/ce_fact03.txd/shitydoor1_256.dds\",\n \"gta3.img/lanblokb2.txd/shitydoor1_256.dds\",\"gta3.img/ce_fact03.txd/shitydoor1_256.dds\",\n \"gta3.img/lanblokb.txd/shitydoor1_256.dds\",\"gta3.img/ce_fact03.txd/shitydoor1_256.dds\",\n \"gta3.img/sfn_apart02sfn.txd/shitydoor1_256.dds\",\"gta3.img/ce_fact03.txd/shitydoor1_256.dds\",\n \"gta3.img/sw_roadgas.txd/shitydoor1_256.dds\",\"gta3.img/ce_fact03.txd/shitydoor1_256.dds\",\n \"gta3.img/vegashse4.txd/shitydoor1_256.dds\",\"gta3.img/ce_fact03.txd/shitydoor1_256.dds\",\n \"gta3.img/vegirlfr01.txd/shitydoor1_256.dds\",\"gta3.img/ce_fact03.txd/shitydoor1_256.dds\",\n \"gta3.img/w_town3cs_t.txd/shitydoor1_256.dds\",\"gta3.img/ce_fact03.txd/shitydoor1_256.dds\",\n \"gta_int.img/sweetshall.txd/shitydoor1_256.dds\",\"gta3.img/ce_fact03.txd/shitydoor1_256.dds\",\n \"gta3.img/lahills_whisky.txd/ind_pkabin.dds\",\"gta3.img/ce_fact03.txd/ind_pkabin.dds\",\n \"gta3.img/ce_farmxref.txd/sw_corrugtile.dds\",\"gta3.img/ce_fact03.txd/sw_corrugtile.dds\",\n \"gta3.img/conhooses.txd/sw_corrugtile.dds\",\"gta3.img/ce_fact03.txd/sw_corrugtile.dds\",\n \"gta3.img/cuntwf.txd/sw_corrugtile.dds\",\"gta3.img/ce_fact03.txd/sw_corrugtile.dds\",\n \"gta3.img/des_byoffice.txd/sw_corrugtile.dds\",\"gta3.img/ce_fact03.txd/sw_corrugtile.dds\",\n \"gta3.img/des_nwtown.txd/sw_corrugtile.dds\",\"gta3.img/ce_fact03.txd/sw_corrugtile.dds\",\n \"gta3.img/des_quarrybits.txd/sw_corrugtile.dds\",\"gta3.img/ce_fact03.txd/sw_corrugtile.dds\",\n \"gta3.img/des_quarrycrane.txd/sw_corrugtile.dds\",\"gta3.img/ce_fact03.txd/sw_corrugtile.dds\",\n \"gta3.img/factorycunte.txd/sw_corrugtile.dds\",\"gta3.img/ce_fact03.txd/sw_corrugtile.dds\",\n \"gta3.img/sw_farm1.txd/sw_corrugtile.dds\",\"gta3.img/ce_fact03.txd/sw_corrugtile.dds\",\n \"gta3.img/sw_poorhouse.txd/sw_corrugtile.dds\",\"gta3.img/ce_fact03.txd/sw_corrugtile.dds\",\n \"gta3.img/sw_roadgas.txd/sw_corrugtile.dds\",\"gta3.img/ce_fact03.txd/sw_corrugtile.dds\",\n \"gta3.img/ce_ground02.txd/desertstones256.dds\",\"gta3.img/ce_farmxref.txd/desertstones256.dds\",\n \"gta3.img/ce_ground03.txd/desertstones256.dds\",\"gta3.img/ce_farmxref.txd/desertstones256.dds\",\n \"gta3.img/ce_ground04.txd/desertstones256.dds\",\"gta3.img/ce_farmxref.txd/desertstones256.dds\",\n \"gta3.img/ce_ground07.txd/desertstones256.dds\",\"gta3.img/ce_farmxref.txd/desertstones256.dds\",\n \"gta3.img/ce_ground08.txd/desertstones256.dds\",\"gta3.img/ce_farmxref.txd/desertstones256.dds\",\n \"gta3.img/ce_ground09.txd/desertstones256.dds\",\"gta3.img/ce_farmxref.txd/desertstones256.dds\",\n \"gta3.img/ce_ground10.txd/desertstones256.dds\",\"gta3.img/ce_farmxref.txd/desertstones256.dds\",\n \"gta3.img/ce_ground13.txd/desertstones256.dds\",\"gta3.img/ce_farmxref.txd/desertstones256.dds\",\n \"gta3.img/ce_ground14.txd/desertstones256.dds\",\"gta3.img/ce_farmxref.txd/desertstones256.dds\",\n \"gta3.img/chicano10_lae.txd/desertstones256.dds\",\"gta3.img/ce_farmxref.txd/desertstones256.dds\",\n \"gta3.img/cs_coast.txd/desertstones256.dds\",\"gta3.img/ce_farmxref.txd/desertstones256.dds\",\n \"gta3.img/cs_forest.txd/desertstones256.dds\",\"gta3.img/ce_farmxref.txd/desertstones256.dds\",\n \"gta3.img/cs_mountain.txd/desertstones256.dds\",\"gta3.img/ce_farmxref.txd/desertstones256.dds\",\n \"gta3.img/cs_roads.txd/desertstones256.dds\",\"gta3.img/ce_farmxref.txd/desertstones256.dds\",\n \"gta3.img/cs_scrapyardarea.txd/desertstones256.dds\",\"gta3.img/ce_farmxref.txd/desertstones256.dds\",\n \"gta3.img/cs_town.txd/desertstones256.dds\",\"gta3.img/ce_farmxref.txd/desertstones256.dds\",\n \"gta3.img/cunte1_lahills.txd/desertstones256.dds\",\"gta3.img/ce_farmxref.txd/desertstones256.dds\",\n \"gta3.img/cunteroads4.txd/desertstones256.dds\",\"gta3.img/ce_farmxref.txd/desertstones256.dds\",\n \"gta3.img/cuntwlandcarparks.txd/desertstones256.dds\",\"gta3.img/ce_farmxref.txd/desertstones256.dds\",\n \"gta3.img/cuntwlandcent.txd/desertstones256.dds\",\"gta3.img/ce_farmxref.txd/desertstones256.dds\",\n \"gta3.img/cuntwlandse.txd/desertstones256.dds\",\"gta3.img/ce_farmxref.txd/desertstones256.dds\",\n \"gta3.img/cuntwland.txd/desertstones256.dds\",\"gta3.img/ce_farmxref.txd/desertstones256.dds\",\n \"gta3.img/cuntwlandwest.txd/desertstones256.dds\",\"gta3.img/ce_farmxref.txd/desertstones256.dds\",\n \"gta3.img/desn2_alphabits.txd/desertstones256.dds\",\"gta3.img/ce_farmxref.txd/desertstones256.dds\",\n \"gta3.img/des_quarrybits.txd/desertstones256.dds\",\"gta3.img/ce_farmxref.txd/desertstones256.dds\",\n \"gta3.img/des_quarry.txd/desertstones256.dds\",\"gta3.img/ce_farmxref.txd/desertstones256.dds\",\n \"gta3.img/des_se3.txd/desertstones256.dds\",\"gta3.img/ce_farmxref.txd/desertstones256.dds\",\n \"gta3.img/des_se4.txd/desertstones256.dds\",\"gta3.img/ce_farmxref.txd/desertstones256.dds\",\n \"gta3.img/des_s.txd/desertstones256.dds\",\"gta3.img/ce_farmxref.txd/desertstones256.dds\",\n \"gta3.img/des_sw.txd/desertstones256.dds\",\"gta3.img/ce_farmxref.txd/desertstones256.dds\",\n \"gta3.img/easthills_lahills.txd/desertstones256.dds\",\"gta3.img/ce_farmxref.txd/desertstones256.dds\",\n \"gta3.img/hillcliff_lahills.txd/desertstones256.dds\",\"gta3.img/ce_farmxref.txd/desertstones256.dds\",\n \"gta3.img/lahillsground4cye.txd/desertstones256.dds\",\"gta3.img/ce_farmxref.txd/desertstones256.dds\",\n \"gta3.img/lahillsgrounds.txd/desertstones256.dds\",\"gta3.img/ce_farmxref.txd/desertstones256.dds\",\n \"gta3.img/lahillslaroads.txd/desertstones256.dds\",\"gta3.img/ce_farmxref.txd/desertstones256.dds\",\n \"gta3.img/mullho03a_lahills.txd/desertstones256.dds\",\"gta3.img/ce_farmxref.txd/desertstones256.dds\",\n \"gta3.img/mullho03_lahills.txd/desertstones256.dds\",\"gta3.img/ce_farmxref.txd/desertstones256.dds\",\n \"gta3.img/richman02_lahills.txd/desertstones256.dds\",\"gta3.img/ce_farmxref.txd/desertstones256.dds\",\n \"gta3.img/richman04_lahills.txd/desertstones256.dds\",\"gta3.img/ce_farmxref.txd/desertstones256.dds\",\n \"gta3.img/roadslahills.txd/desertstones256.dds\",\"gta3.img/ce_farmxref.txd/desertstones256.dds\",\n \"gta3.img/silconland_sfse.txd/desertstones256.dds\",\"gta3.img/ce_farmxref.txd/desertstones256.dds\",\n \"gta3.img/vgnfirestat.txd/desertstones256.dds\",\"gta3.img/ce_farmxref.txd/desertstones256.dds\",\n \"gta3.img/vgnland.txd/desertstones256.dds\",\"gta3.img/ce_farmxref.txd/desertstones256.dds\",\n \"gta3.img/vgwestland.txd/desertstones256.dds\",\"gta3.img/ce_farmxref.txd/desertstones256.dds\",\n \"gta3.img/ce_ground01.txd/forestfloor256.dds\",\"gta3.img/ce_farmxref.txd/forestfloor256.dds\",\n \"gta3.img/ce_ground08.txd/forestfloor256.dds\",\"gta3.img/ce_farmxref.txd/forestfloor256.dds\",\n \"gta3.img/ce_ground10.txd/forestfloor256.dds\",\"gta3.img/ce_farmxref.txd/forestfloor256.dds\",\n \"gta3.img/cs_forest.txd/forestfloor256.dds\",\"gta3.img/ce_farmxref.txd/forestfloor256.dds\",\n \"gta3.img/cs_mountain.txd/forestfloor256.dds\",\"gta3.img/ce_farmxref.txd/forestfloor256.dds\",\n \"gta3.img/cs_town.txd/forestfloor256.dds\",\"gta3.img/ce_farmxref.txd/forestfloor256.dds\",\n \"gta3.img/cunte1_lahills.txd/forestfloor256.dds\",\"gta3.img/ce_farmxref.txd/forestfloor256.dds\",\n \"gta3.img/cuntwlandcarparks.txd/forestfloor256.dds\",\"gta3.img/ce_farmxref.txd/forestfloor256.dds\",\n \"gta3.img/cuntwlandcent.txd/forestfloor256.dds\",\"gta3.img/ce_farmxref.txd/forestfloor256.dds\",\n \"gta3.img/cuntwlandse.txd/forestfloor256.dds\",\"gta3.img/ce_farmxref.txd/forestfloor256.dds\",\n \"gta3.img/cuntwland.txd/forestfloor256.dds\",\"gta3.img/ce_farmxref.txd/forestfloor256.dds\",\n \"gta3.img/cuntwlandwest.txd/forestfloor256.dds\",\"gta3.img/ce_farmxref.txd/forestfloor256.dds\",\n \"gta3.img/lahillslaroads.txd/forestfloor256.dds\",\"gta3.img/ce_farmxref.txd/forestfloor256.dds\",\n \"gta3.img/sw_oldshack.txd/sw_woodflloorsplat.dds\",\"gta3.img/ce_farmxref.txd/sw_woodflloorsplat.dds\",\n \"gta3.img/cuntwf.txd/sw_barnwood1.dds\",\"gta3.img/ce_farmxref.txd/sw_barnwood1.dds\",\n \"gta3.img/des_bighus.txd/sw_barnwood1.dds\",\"gta3.img/ce_farmxref.txd/sw_barnwood1.dds\",\n \"gta3.img/sw_farm1.txd/sw_barnwood1.dds\",\"gta3.img/ce_farmxref.txd/sw_barnwood1.dds\",\n \"gta3.img/sw_poorhouse.txd/sw_barnwood1.dds\",\"gta3.img/ce_farmxref.txd/sw_barnwood1.dds\",\n \"gta3.img/cetown3cs_t.txd/sw_slate01.dds\",\"gta3.img/ce_farmxref.txd/sw_slate01.dds\",\n \"gta3.img/cuntwf.txd/sw_slate01.dds\",\"gta3.img/ce_farmxref.txd/sw_slate01.dds\",\n \"gta3.img/sw_farm1.txd/sw_slate01.dds\",\"gta3.img/ce_farmxref.txd/sw_slate01.dds\",\n \"gta3.img/cuntwf.txd/sw_barnfloor1.dds\",\"gta3.img/ce_farmxref.txd/sw_barnfloor1.dds\",\n \"gta3.img/sw_farm1.txd/sw_barnfloor1.dds\",\"gta3.img/ce_farmxref.txd/sw_barnfloor1.dds\",\n \"gta3.img/ce_ground13.txd/sw_barnwood2.dds\",\"gta3.img/ce_farmxref.txd/sw_barnwood2.dds\",\n \"gta3.img/cetown3cs_t.txd/sw_barnwood2.dds\",\"gta3.img/ce_farmxref.txd/sw_barnwood2.dds\",\n \"gta3.img/cuntwf.txd/sw_barnwood2.dds\",\"gta3.img/ce_farmxref.txd/sw_barnwood2.dds\",\n \"gta3.img/sw_farm1.txd/sw_barnwood2.dds\",\"gta3.img/ce_farmxref.txd/sw_barnwood2.dds\",\n \"gta3.img/cuntwf.txd/sw_barnwood4.dds\",\"gta3.img/ce_farmxref.txd/sw_barnwood4.dds\",\n \"gta3.img/sw_farm1.txd/sw_barnwood4.dds\",\"gta3.img/ce_farmxref.txd/sw_barnwood4.dds\",\n \"gta3.img/des_damquay.txd/sw_barnwind01.dds\",\"gta3.img/ce_farmxref.txd/sw_barnwind01.dds\",\n \"gta3.img/sw_farm1.txd/sw_barnwind01.dds\",\"gta3.img/ce_farmxref.txd/sw_barnwind01.dds\",\n \"gta3.img/cuntwf.txd/sw_barndoor2.dds\",\"gta3.img/ce_farmxref.txd/sw_barndoor2.dds\",\n \"gta3.img/cw2_photoblockcs_t.txd/sw_barndoor2.dds\",\"gta3.img/ce_farmxref.txd/sw_barndoor2.dds\",\n \"gta3.img/cxref_desert.txd/sw_barndoor2.dds\",\"gta3.img/ce_farmxref.txd/sw_barndoor2.dds\",\n \"gta3.img/cxrf_payspray.txd/sw_barndoor2.dds\",\"gta3.img/ce_farmxref.txd/sw_barndoor2.dds\",\n \"gta3.img/cuntwf.txd/sw_barndoor1.dds\",\"gta3.img/ce_farmxref.txd/sw_barndoor1.dds\",\n \"gta3.img/sw_farm1.txd/sw_barndoor1.dds\",\"gta3.img/ce_farmxref.txd/sw_barndoor1.dds\",\n \"gta3.img/sw_oldshack.txd/sw_barndoor1.dds\",\"gta3.img/ce_farmxref.txd/sw_barndoor1.dds\",\n \"gta3.img/cuntwf.txd/sw_barnwood5.dds\",\"gta3.img/ce_farmxref.txd/sw_barnwood5.dds\",\n \"gta3.img/cxref_savhus.txd/sw_barnwood5.dds\",\"gta3.img/ce_farmxref.txd/sw_barnwood5.dds\",\n \"gta3.img/cs_mountain.txd/forestfloorbranch256.dds\",\"gta3.img/ce_farmxref.txd/forestfloorbranch256.dds\",\n \"gta3.img/cuntwlandse.txd/forestfloorbranch256.dds\",\"gta3.img/ce_farmxref.txd/forestfloorbranch256.dds\",\n \"gta3.img/cuntwland.txd/forestfloorbranch256.dds\",\"gta3.img/ce_farmxref.txd/forestfloorbranch256.dds\",\n \"gta3.img/cuntwlandwest.txd/forestfloorbranch256.dds\",\"gta3.img/ce_farmxref.txd/forestfloorbranch256.dds\",\n \"gta3.img/landlae2b.txd/forestfloorbranch256.dds\",\"gta3.img/ce_farmxref.txd/forestfloorbranch256.dds\",\n \"gta3.img/sw_farm1.txd/forestfloorbranch256.dds\",\"gta3.img/ce_farmxref.txd/forestfloorbranch256.dds\",\n \"gta3.img/ce_ground02.txd/cs_rockdetail2.dds\",\"gta3.img/ce_ground01.txd/cs_rockdetail2.dds\",\n \"gta3.img/ce_ground03.txd/cs_rockdetail2.dds\",\"gta3.img/ce_ground01.txd/cs_rockdetail2.dds\",\n \"gta3.img/ce_ground04.txd/cs_rockdetail2.dds\",\"gta3.img/ce_ground01.txd/cs_rockdetail2.dds\",\n \"gta3.img/ce_ground05.txd/cs_rockdetail2.dds\",\"gta3.img/ce_ground01.txd/cs_rockdetail2.dds\",\n \"gta3.img/ce_ground07.txd/cs_rockdetail2.dds\",\"gta3.img/ce_ground01.txd/cs_rockdetail2.dds\",\n \"gta3.img/ce_ground08.txd/cs_rockdetail2.dds\",\"gta3.img/ce_ground01.txd/cs_rockdetail2.dds\",\n \"gta3.img/ce_ground10.txd/cs_rockdetail2.dds\",\"gta3.img/ce_ground01.txd/cs_rockdetail2.dds\",\n \"gta3.img/ce_ground11.txd/cs_rockdetail2.dds\",\"gta3.img/ce_ground01.txd/cs_rockdetail2.dds\",\n \"gta3.img/ce_ground12.txd/cs_rockdetail2.dds\",\"gta3.img/ce_ground01.txd/cs_rockdetail2.dds\",\n \"gta3.img/ce_ground13.txd/cs_rockdetail2.dds\",\"gta3.img/ce_ground01.txd/cs_rockdetail2.dds\",\n \"gta3.img/hillcliff_lahills.txd/cs_rockdetail2.dds\",\"gta3.img/ce_ground01.txd/cs_rockdetail2.dds\",\n \"gta3.img/lahillsgrounds.txd/cs_rockdetail2.dds\",\"gta3.img/ce_ground01.txd/cs_rockdetail2.dds\",\n \"gta3.img/mullho03a_lahills.txd/cs_rockdetail2.dds\",\"gta3.img/ce_ground01.txd/cs_rockdetail2.dds\",\n \"gta3.img/mullho03_lahills.txd/cs_rockdetail2.dds\",\"gta3.img/ce_ground01.txd/cs_rockdetail2.dds\",\n \"gta3.img/richman02_lahills.txd/cs_rockdetail2.dds\",\"gta3.img/ce_ground01.txd/cs_rockdetail2.dds\",\n \"gta3.img/vinewood01_lahills.txd/cs_rockdetail2.dds\",\"gta3.img/ce_ground01.txd/cs_rockdetail2.dds\",\n \"gta3.img/ce_ground02.txd/cw2_mountrock.dds\",\"gta3.img/ce_ground01.txd/cw2_mountrock.dds\",\n \"gta3.img/ce_ground04.txd/cw2_mountrock.dds\",\"gta3.img/ce_ground01.txd/cw2_mountrock.dds\",\n \"gta3.img/ce_ground05.txd/cw2_mountrock.dds\",\"gta3.img/ce_ground01.txd/cw2_mountrock.dds\",\n \"gta3.img/ce_ground08.txd/cw2_mountrock.dds\",\"gta3.img/ce_ground01.txd/cw2_mountrock.dds\",\n \"gta3.img/ce_ground09.txd/cw2_mountrock.dds\",\"gta3.img/ce_ground01.txd/cw2_mountrock.dds\",\n \"gta3.img/ce_ground10.txd/cw2_mountrock.dds\",\"gta3.img/ce_ground01.txd/cw2_mountrock.dds\",\n \"gta3.img/ce_ground11.txd/cw2_mountrock.dds\",\"gta3.img/ce_ground01.txd/cw2_mountrock.dds\",\n \"gta3.img/ce_ground14.txd/cw2_mountrock.dds\",\"gta3.img/ce_ground01.txd/cw2_mountrock.dds\",\n \"gta3.img/cn_nwbrigstuff.txd/cw2_mountrock.dds\",\"gta3.img/ce_ground01.txd/cw2_mountrock.dds\",\n \"gta3.img/cs_forest.txd/cw2_mountrock.dds\",\"gta3.img/ce_ground01.txd/cw2_mountrock.dds\",\n \"gta3.img/cs_mountain.txd/cw2_mountrock.dds\",\"gta3.img/ce_ground01.txd/cw2_mountrock.dds\",\n \"gta3.img/cs_scrapyardarea.txd/cw2_mountrock.dds\",\"gta3.img/ce_ground01.txd/cw2_mountrock.dds\",\n \"gta3.img/cunte1_lahills.txd/cw2_mountrock.dds\",\"gta3.img/ce_ground01.txd/cw2_mountrock.dds\",\n \"gta3.img/des_nw2.txd/cw2_mountrock.dds\",\"gta3.img/ce_ground01.txd/cw2_mountrock.dds\",\n \"gta3.img/easthills_lahills.txd/cw2_mountrock.dds\",\"gta3.img/ce_ground01.txd/cw2_mountrock.dds\",\n \"gta3.img/lahillsground4cye.txd/cw2_mountrock.dds\",\"gta3.img/ce_ground01.txd/cw2_mountrock.dds\",\n \"gta3.img/mullho03a_lahills.txd/cw2_mountrock.dds\",\"gta3.img/ce_ground01.txd/cw2_mountrock.dds\",\n \"gta3.img/p69_rocks.txd/sfe_rock1.dds\",\"gta3.img/ce_ground01.txd/cw2_mountrock.dds\",\n \"gta3.img/ce_ground11.txd/des_dirt1grass.dds\",\"gta3.img/ce_ground01.txd/des_dirt1grass.dds\",\n \"gta3.img/ce_ground12.txd/des_dirt1grass.dds\",\"gta3.img/ce_ground01.txd/des_dirt1grass.dds\",\n \"gta3.img/ce_ground02.txd/sw_rockgrassb2.dds\",\"gta3.img/ce_ground01.txd/sw_rockgrassb2.dds\",\n \"gta3.img/ce_ground04.txd/sw_rockgrassb2.dds\",\"gta3.img/ce_ground01.txd/sw_rockgrassb2.dds\",\n \"gta3.img/ce_ground05.txd/sw_rockgrassb2.dds\",\"gta3.img/ce_ground01.txd/sw_rockgrassb2.dds\",\n \"gta3.img/ce_ground08.txd/sw_rockgrassb2.dds\",\"gta3.img/ce_ground01.txd/sw_rockgrassb2.dds\",\n \"gta3.img/ce_ground09.txd/sw_rockgrassb2.dds\",\"gta3.img/ce_ground01.txd/sw_rockgrassb2.dds\",\n \"gta3.img/cunte1_lahills.txd/sw_rockgrassb2.dds\",\"gta3.img/ce_ground01.txd/sw_rockgrassb2.dds\",\n \"gta3.img/easthills_lahills.txd/sw_rockgrassb2.dds\",\"gta3.img/ce_ground01.txd/sw_rockgrassb2.dds\",\n \"gta3.img/lahillsground4cye.txd/sw_rockgrassb2.dds\",\"gta3.img/ce_ground01.txd/sw_rockgrassb2.dds\",\n \"gta3.img/mullho03a_lahills.txd/sw_rockgrassb2.dds\",\"gta3.img/ce_ground01.txd/sw_rockgrassb2.dds\",\n \"gta3.img/ce_ground02.txd/sw_stones.dds\",\"gta3.img/ce_ground01.txd/sw_stones.dds\",\n \"gta3.img/ce_ground03.txd/sw_stones.dds\",\"gta3.img/ce_ground01.txd/sw_stones.dds\",\n \"gta3.img/ce_ground04.txd/sw_stones.dds\",\"gta3.img/ce_ground01.txd/sw_stones.dds\",\n \"gta3.img/ce_ground05.txd/sw_stones.dds\",\"gta3.img/ce_ground01.txd/sw_stones.dds\",\n \"gta3.img/ce_ground07.txd/sw_stones.dds\",\"gta3.img/ce_ground01.txd/sw_stones.dds\",\n \"gta3.img/ce_ground11.txd/sw_stones.dds\",\"gta3.img/ce_ground01.txd/sw_stones.dds\",\n \"gta3.img/ce_ground12.txd/sw_stones.dds\",\"gta3.img/ce_ground01.txd/sw_stones.dds\",\n \"gta3.img/ce_ground13.txd/sw_stones.dds\",\"gta3.img/ce_ground01.txd/sw_stones.dds\",\n \"gta3.img/ce_ground14.txd/sw_stones.dds\",\"gta3.img/ce_ground01.txd/sw_stones.dds\",\n \"gta3.img/easthills_lahills.txd/sw_stones.dds\",\"gta3.img/ce_ground01.txd/sw_stones.dds\",\n \"gta3.img/lahillsground4.txd/sw_stones.dds\",\"gta3.img/ce_ground01.txd/sw_stones.dds\",\n \"gta3.img/vgssland.txd/sw_stones.dds\",\"gta3.img/ce_ground01.txd/sw_stones.dds\",\n \"gta3.img/ce_ground02.txd/sw_stonesgrass.dds\",\"gta3.img/ce_ground01.txd/sw_stonesgrass.dds\",\n \"gta3.img/ce_ground03.txd/sw_stonesgrass.dds\",\"gta3.img/ce_ground01.txd/sw_stonesgrass.dds\",\n \"gta3.img/ce_ground04.txd/sw_stonesgrass.dds\",\"gta3.img/ce_ground01.txd/sw_stonesgrass.dds\",\n \"gta3.img/ce_ground05.txd/sw_stonesgrass.dds\",\"gta3.img/ce_ground01.txd/sw_stonesgrass.dds\",\n \"gta3.img/ce_ground07.txd/sw_stonesgrass.dds\",\"gta3.img/ce_ground01.txd/sw_stonesgrass.dds\",\n \"gta3.img/ce_ground11.txd/sw_stonesgrass.dds\",\"gta3.img/ce_ground01.txd/sw_stonesgrass.dds\",\n \"gta3.img/ce_ground12.txd/sw_stonesgrass.dds\",\"gta3.img/ce_ground01.txd/sw_stonesgrass.dds\",\n \"gta3.img/ce_ground13.txd/sw_stonesgrass.dds\",\"gta3.img/ce_ground01.txd/sw_stonesgrass.dds\",\n \"gta3.img/ce_ground14.txd/sw_stonesgrass.dds\",\"gta3.img/ce_ground01.txd/sw_stonesgrass.dds\",\n \"gta3.img/easthills_lahills.txd/sw_stonesgrass.dds\",\"gta3.img/ce_ground01.txd/sw_stonesgrass.dds\",\n \"gta3.img/lahillsground4.txd/sw_stonesgrass.dds\",\"gta3.img/ce_ground01.txd/sw_stonesgrass.dds\",\n \"gta3.img/mullho03a_lahills.txd/sw_stonesgrass.dds\",\"gta3.img/ce_ground01.txd/sw_stonesgrass.dds\",\n \"gta3.img/vgssland.txd/sw_stonesgrass.dds\",\"gta3.img/ce_ground01.txd/sw_stonesgrass.dds\",\n \"gta3.img/ce_ground08.txd/forestfloorgrass.dds\",\"gta3.img/ce_ground01.txd/forestfloorgrass.dds\",\n \"gta3.img/ce_ground10.txd/forestfloorgrass.dds\",\"gta3.img/ce_ground01.txd/forestfloorgrass.dds\",\n \"gta3.img/cunte1_lahills.txd/forestfloorgrass.dds\",\"gta3.img/ce_ground01.txd/forestfloorgrass.dds\",\n \"gta3.img/ce_ground02.txd/dirttracksgrass256.dds\",\"gta3.img/ce_ground01.txd/dirttracksgrass256.dds\",\n \"gta3.img/ce_ground03.txd/dirttracksgrass256.dds\",\"gta3.img/ce_ground01.txd/dirttracksgrass256.dds\",\n \"gta3.img/ce_ground04.txd/dirttracksgrass256.dds\",\"gta3.img/ce_ground01.txd/dirttracksgrass256.dds\",\n \"gta3.img/ce_ground05.txd/dirttracksgrass256.dds\",\"gta3.img/ce_ground01.txd/dirttracksgrass256.dds\",\n \"gta3.img/ce_ground07.txd/dirttracksgrass256.dds\",\"gta3.img/ce_ground01.txd/dirttracksgrass256.dds\",\n \"gta3.img/ce_ground09.txd/dirttracksgrass256.dds\",\"gta3.img/ce_ground01.txd/dirttracksgrass256.dds\",\n \"gta3.img/ce_ground10.txd/dirttracksgrass256.dds\",\"gta3.img/ce_ground01.txd/dirttracksgrass256.dds\",\n \"gta3.img/ce_ground12.txd/dirttracksgrass256.dds\",\"gta3.img/ce_ground01.txd/dirttracksgrass256.dds\",\n \"gta3.img/ce_ground13.txd/dirttracksgrass256.dds\",\"gta3.img/ce_ground01.txd/dirttracksgrass256.dds\",\n \"gta3.img/ce_ground14.txd/dirttracksgrass256.dds\",\"gta3.img/ce_ground01.txd/dirttracksgrass256.dds\",\n \"gta3.img/cs_roads.txd/dirttracksgrass256.dds\",\"gta3.img/ce_ground01.txd/dirttracksgrass256.dds\",\n \"gta3.img/cs_town.txd/dirttracksgrass256.dds\",\"gta3.img/ce_ground01.txd/dirttracksgrass256.dds\",\n \"gta3.img/cunte1_lahills.txd/dirttracksgrass256.dds\",\"gta3.img/ce_ground01.txd/dirttracksgrass256.dds\",\n \"gta3.img/cunteroads1.txd/dirttracksgrass256.dds\",\"gta3.img/ce_ground01.txd/dirttracksgrass256.dds\",\n \"gta3.img/cunteroads2.txd/dirttracksgrass256.dds\",\"gta3.img/ce_ground01.txd/dirttracksgrass256.dds\",\n \"gta3.img/cunteroads5.txd/dirttracksgrass256.dds\",\"gta3.img/ce_ground01.txd/dirttracksgrass256.dds\",\n \"gta3.img/cunteroads6.txd/dirttracksgrass256.dds\",\"gta3.img/ce_ground01.txd/dirttracksgrass256.dds\",\n \"gta3.img/easthills_lahills.txd/dirttracksgrass256.dds\",\"gta3.img/ce_ground01.txd/dirttracksgrass256.dds\",\n \"gta3.img/lahillsground4cye.txd/dirttracksgrass256.dds\",\"gta3.img/ce_ground01.txd/dirttracksgrass256.dds\",\n \"gta3.img/lahillsground4.txd/dirttracksgrass256.dds\",\"gta3.img/ce_ground01.txd/dirttracksgrass256.dds\",\n \"gta3.img/ce_ground02.txd/grassbrn2rockbrng.dds\",\"gta3.img/ce_ground01.txd/grassbrn2rockbrng.dds\",\n \"gta3.img/ce_ground03.txd/grassbrn2rockbrng.dds\",\"gta3.img/ce_ground01.txd/grassbrn2rockbrng.dds\",\n \"gta3.img/ce_ground05.txd/grassbrn2rockbrng.dds\",\"gta3.img/ce_ground01.txd/grassbrn2rockbrng.dds\",\n \"gta3.img/ce_ground07.txd/grassbrn2rockbrng.dds\",\"gta3.img/ce_ground01.txd/grassbrn2rockbrng.dds\",\n \"gta3.img/ce_ground10.txd/grassbrn2rockbrng.dds\",\"gta3.img/ce_ground01.txd/grassbrn2rockbrng.dds\",\n \"gta3.img/ce_ground11.txd/grassbrn2rockbrng.dds\",\"gta3.img/ce_ground01.txd/grassbrn2rockbrng.dds\",\n \"gta3.img/ce_ground12.txd/grassbrn2rockbrng.dds\",\"gta3.img/ce_ground01.txd/grassbrn2rockbrng.dds\",\n \"gta3.img/ce_ground13.txd/grassbrn2rockbrng.dds\",\"gta3.img/ce_ground01.txd/grassbrn2rockbrng.dds\",\n \"gta3.img/ce_ground14.txd/grassbrn2rockbrng.dds\",\"gta3.img/ce_ground01.txd/grassbrn2rockbrng.dds\",\n \"gta3.img/cs_mountain.txd/grassbrn2rockbrng.dds\",\"gta3.img/ce_ground01.txd/grassbrn2rockbrng.dds\",\n \"gta3.img/cunteroads4.txd/grassbrn2rockbrng.dds\",\"gta3.img/ce_ground01.txd/grassbrn2rockbrng.dds\",\n \"gta3.img/groundbit_sfse.txd/grassbrn2rockbrng.dds\",\"gta3.img/ce_ground01.txd/grassbrn2rockbrng.dds\",\n \"gta3.img/lahillsground4.txd/grassbrn2rockbrng.dds\",\"gta3.img/ce_ground01.txd/grassbrn2rockbrng.dds\",\n \"gta3.img/ce_ground02.txd/rocktbrn128.dds\",\"gta3.img/ce_ground01.txd/rocktbrn128.dds\",\n \"gta3.img/ce_ground03.txd/rocktbrn128.dds\",\"gta3.img/ce_ground01.txd/rocktbrn128.dds\",\n \"gta3.img/ce_ground04.txd/rocktbrn128.dds\",\"gta3.img/ce_ground01.txd/rocktbrn128.dds\",\n \"gta3.img/ce_ground05.txd/rocktbrn128.dds\",\"gta3.img/ce_ground01.txd/rocktbrn128.dds\",\n \"gta3.img/ce_ground07.txd/rocktbrn128.dds\",\"gta3.img/ce_ground01.txd/rocktbrn128.dds\",\n \"gta3.img/ce_ground08.txd/rocktbrn128.dds\",\"gta3.img/ce_ground01.txd/rocktbrn128.dds\",\n \"gta3.img/ce_ground10.txd/rocktbrn128.dds\",\"gta3.img/ce_ground01.txd/rocktbrn128.dds\",\n \"gta3.img/ce_ground11.txd/rocktbrn128.dds\",\"gta3.img/ce_ground01.txd/rocktbrn128.dds\",\n \"gta3.img/ce_ground12.txd/rocktbrn128.dds\",\"gta3.img/ce_ground01.txd/rocktbrn128.dds\",\n \"gta3.img/ce_ground13.txd/rocktbrn128.dds\",\"gta3.img/ce_ground01.txd/rocktbrn128.dds\",\n \"gta3.img/cn_nwbrigstuff.txd/rocktbrn128.dds\",\"gta3.img/ce_ground01.txd/rocktbrn128.dds\",\n \"gta3.img/des2vegas_join.txd/rocktbrn128.dds\",\"gta3.img/ce_ground01.txd/rocktbrn128.dds\",\n \"gta3.img/des_ne.txd/rocktbrn128.dds\",\"gta3.img/ce_ground01.txd/rocktbrn128.dds\",\n \"gta3.img/des_n.txd/rocktbrn128.dds\",\"gta3.img/ce_ground01.txd/rocktbrn128.dds\",\n \"gta3.img/des_nw2.txd/rocktbrn128.dds\",\"gta3.img/ce_ground01.txd/rocktbrn128.dds\",\n \"gta3.img/des_nw.txd/rocktbrn128.dds\",\"gta3.img/ce_ground01.txd/rocktbrn128.dds\",\n \"gta3.img/des_se4.txd/rocktbrn128.dds\",\"gta3.img/ce_ground01.txd/rocktbrn128.dds\",\n \"gta3.img/des_sw.txd/rocktbrn128.dds\",\"gta3.img/ce_ground01.txd/rocktbrn128.dds\",\n \"gta3.img/lahillsgrounds.txd/rocktbrn128.dds\",\"gta3.img/ce_ground01.txd/rocktbrn128.dds\",\n \"gta3.img/sfn_sfn.txd/rocktbrn128.dds\",\"gta3.img/ce_ground01.txd/rocktbrn128.dds\",\n \"gta3.img/silconland_sfse.txd/rocktbrn128.dds\",\"gta3.img/ce_ground01.txd/rocktbrn128.dds\",\n \"gta3.img/stuff2_sfn.txd/rocktbrn128.dds\",\"gta3.img/ce_ground01.txd/rocktbrn128.dds\",\n \"gta3.img/vgsecoast.txd/rocktbrn128.dds\",\"gta3.img/ce_ground01.txd/rocktbrn128.dds\",\n \"gta3.img/ce_ground05.txd/desertgravelgrassroad.dds\",\"gta3.img/ce_ground01.txd/desertgravelgrassroad.dds\",\n \"gta3.img/ce_ground07.txd/desertgravelgrassroad.dds\",\"gta3.img/ce_ground01.txd/desertgravelgrassroad.dds\",\n \"gta3.img/ce_ground08.txd/desertgravelgrassroad.dds\",\"gta3.img/ce_ground01.txd/desertgravelgrassroad.dds\",\n \"gta3.img/ce_ground12.txd/desertgravelgrassroad.dds\",\"gta3.img/ce_ground01.txd/desertgravelgrassroad.dds\",\n \"gta3.img/cunteroads1.txd/desertgravelgrassroad.dds\",\"gta3.img/ce_ground01.txd/desertgravelgrassroad.dds\",\n \"gta3.img/cunteroads2.txd/desertgravelgrassroad.dds\",\"gta3.img/ce_ground01.txd/desertgravelgrassroad.dds\",\n \"gta3.img/cunteroads3.txd/desertgravelgrassroad.dds\",\"gta3.img/ce_ground01.txd/desertgravelgrassroad.dds\",\n \"gta3.img/cunteroads4.txd/desertgravelgrassroad.dds\",\"gta3.img/ce_ground01.txd/desertgravelgrassroad.dds\",\n \"gta3.img/cunteroads5.txd/desertgravelgrassroad.dds\",\"gta3.img/ce_ground01.txd/desertgravelgrassroad.dds\",\n \"gta3.img/cunteroads6.txd/desertgravelgrassroad.dds\",\"gta3.img/ce_ground01.txd/desertgravelgrassroad.dds\",\n \"gta3.img/firehouse_sfse.txd/desertgravelgrassroad.dds\",\"gta3.img/ce_ground01.txd/desertgravelgrassroad.dds\",\n \"gta3.img/hobos_lawn.txd/desertgravelgrassroad.dds\",\"gta3.img/ce_ground01.txd/desertgravelgrassroad.dds\",\n \"gta3.img/lahillsgrounds.txd/desertgravelgrassroad.dds\",\"gta3.img/ce_ground01.txd/desertgravelgrassroad.dds\",\n \"gta3.img/lahillsla_roads.txd/desertgravelgrassroad.dds\",\"gta3.img/ce_ground01.txd/desertgravelgrassroad.dds\",\n \"gta3.img/lahillslaroads.txd/desertgravelgrassroad.dds\",\"gta3.img/ce_ground01.txd/desertgravelgrassroad.dds\",\n \"gta3.img/lahillsroads6.txd/desertgravelgrassroad.dds\",\"gta3.img/ce_ground01.txd/desertgravelgrassroad.dds\",\n \"gta3.img/lahillsroadscoast.txd/desertgravelgrassroad.dds\",\"gta3.img/ce_ground01.txd/desertgravelgrassroad.dds\",\n \"gta3.img/mountroads_sfse.txd/desertgravelgrassroad.dds\",\"gta3.img/ce_ground01.txd/desertgravelgrassroad.dds\",\n \"gta3.img/mullho03a_lahills.txd/desertgravelgrassroad.dds\",\"gta3.img/ce_ground01.txd/desertgravelgrassroad.dds\",\n \"gta3.img/richman04_lahills.txd/desertgravelgrassroad.dds\",\"gta3.img/ce_ground01.txd/desertgravelgrassroad.dds\",\n \"gta3.img/roads_cunte.txd/desertgravelgrassroad.dds\",\"gta3.img/ce_ground01.txd/desertgravelgrassroad.dds\",\n \"gta3.img/roadslahills.txd/desertgravelgrassroad.dds\",\"gta3.img/ce_ground01.txd/desertgravelgrassroad.dds\",\n \"gta3.img/roads_lawn.txd/desertgravelgrassroad.dds\",\"gta3.img/ce_ground01.txd/desertgravelgrassroad.dds\",\n \"gta3.img/sunsetbittyu.txd/desertgravelgrassroad.dds\",\"gta3.img/ce_ground01.txd/desertgravelgrassroad.dds\",\n \"gta3.img/vinewood01_lahills.txd/desertgravelgrassroad.dds\",\"gta3.img/ce_ground01.txd/desertgravelgrassroad.dds\",\n \"gta3.img/ce_ground02.txd/sw_rockgrassb1.dds\",\"gta3.img/ce_ground01.txd/sw_rockgrassb1.dds\",\n \"gta3.img/ce_ground04.txd/sw_rockgrassb1.dds\",\"gta3.img/ce_ground01.txd/sw_rockgrassb1.dds\",\n \"gta3.img/ce_ground05.txd/sw_rockgrassb1.dds\",\"gta3.img/ce_ground01.txd/sw_rockgrassb1.dds\",\n \"gta3.img/ce_ground08.txd/sw_rockgrassb1.dds\",\"gta3.img/ce_ground01.txd/sw_rockgrassb1.dds\",\n \"gta3.img/ce_ground09.txd/sw_rockgrassb1.dds\",\"gta3.img/ce_ground01.txd/sw_rockgrassb1.dds\",\n \"gta3.img/ce_ground10.txd/sw_rockgrassb1.dds\",\"gta3.img/ce_ground01.txd/sw_rockgrassb1.dds\",\n \"gta3.img/ce_ground11.txd/sw_rockgrassb1.dds\",\"gta3.img/ce_ground01.txd/sw_rockgrassb1.dds\",\n \"gta3.img/ce_ground14.txd/sw_rockgrassb1.dds\",\"gta3.img/ce_ground01.txd/sw_rockgrassb1.dds\",\n \"gta3.img/cunte1_lahills.txd/sw_rockgrassb1.dds\",\"gta3.img/ce_ground01.txd/sw_rockgrassb1.dds\",\n \"gta3.img/easthills_lahills.txd/sw_rockgrassb1.dds\",\"gta3.img/ce_ground01.txd/sw_rockgrassb1.dds\",\n \"gta3.img/lahillsground4cye.txd/sw_rockgrassb1.dds\",\"gta3.img/ce_ground01.txd/sw_rockgrassb1.dds\",\n \"gta3.img/mullho03a_lahills.txd/sw_rockgrassb1.dds\",\"gta3.img/ce_ground01.txd/sw_rockgrassb1.dds\",\n \"gta3.img/ce_ground02.txd/desgreengrassmix.dds\",\"gta3.img/ce_ground01.txd/desgreengrassmix.dds\",\n \"gta3.img/ce_ground03.txd/desgreengrassmix.dds\",\"gta3.img/ce_ground01.txd/desgreengrassmix.dds\",\n \"gta3.img/ce_ground04.txd/desgreengrassmix.dds\",\"gta3.img/ce_ground01.txd/desgreengrassmix.dds\",\n \"gta3.img/ce_ground05.txd/desgreengrassmix.dds\",\"gta3.img/ce_ground01.txd/desgreengrassmix.dds\",\n \"gta3.img/ce_ground08.txd/desgreengrassmix.dds\",\"gta3.img/ce_ground01.txd/desgreengrassmix.dds\",\n \"gta3.img/ce_ground09.txd/desgreengrassmix.dds\",\"gta3.img/ce_ground01.txd/desgreengrassmix.dds\",\n \"gta3.img/ce_ground10.txd/desgreengrassmix.dds\",\"gta3.img/ce_ground01.txd/desgreengrassmix.dds\",\n \"gta3.img/ce_ground11.txd/desgreengrassmix.dds\",\"gta3.img/ce_ground01.txd/desgreengrassmix.dds\",\n \"gta3.img/ce_ground12.txd/desgreengrassmix.dds\",\"gta3.img/ce_ground01.txd/desgreengrassmix.dds\",\n \"gta3.img/ce_ground13.txd/desgreengrassmix.dds\",\"gta3.img/ce_ground01.txd/desgreengrassmix.dds\",\n \"gta3.img/ce_ground14.txd/desgreengrassmix.dds\",\"gta3.img/ce_ground01.txd/desgreengrassmix.dds\",\n \"gta3.img/cunteroads2.txd/desgreengrassmix.dds\",\"gta3.img/ce_ground01.txd/desgreengrassmix.dds\",\n \"gta3.img/docg01_lahills.txd/desgreengrassmix.dds\",\"gta3.img/ce_ground01.txd/desgreengrassmix.dds\",\n \"gta3.img/lahillsground4cye.txd/desgreengrassmix.dds\",\"gta3.img/ce_ground01.txd/desgreengrassmix.dds\",\n \"gta3.img/lahillsgrounds.txd/desgreengrassmix.dds\",\"gta3.img/ce_ground01.txd/desgreengrassmix.dds\",\n \"gta3.img/mullho03a_lahills.txd/desgreengrassmix.dds\",\"gta3.img/ce_ground01.txd/desgreengrassmix.dds\",\n \"gta3.img/richman02_lahills.txd/desgreengrassmix.dds\",\"gta3.img/ce_ground01.txd/desgreengrassmix.dds\",\n \"gta3.img/vinewood01_lahills.txd/desgreengrassmix.dds\",\"gta3.img/ce_ground01.txd/desgreengrassmix.dds\",\n \"gta3.img/ce_ground02.txd/sw_rockgrass1.dds\",\"gta3.img/ce_ground01.txd/sw_rockgrass1.dds\",\n \"gta3.img/ce_ground04.txd/sw_rockgrass1.dds\",\"gta3.img/ce_ground01.txd/sw_rockgrass1.dds\",\n \"gta3.img/ce_ground05.txd/sw_rockgrass1.dds\",\"gta3.img/ce_ground01.txd/sw_rockgrass1.dds\",\n \"gta3.img/ce_ground08.txd/sw_rockgrass1.dds\",\"gta3.img/ce_ground01.txd/sw_rockgrass1.dds\",\n \"gta3.img/ce_ground10.txd/sw_rockgrass1.dds\",\"gta3.img/ce_ground01.txd/sw_rockgrass1.dds\",\n \"gta3.img/ce_ground11.txd/sw_rockgrass1.dds\",\"gta3.img/ce_ground01.txd/sw_rockgrass1.dds\",\n \"gta3.img/ce_ground14.txd/sw_rockgrass1.dds\",\"gta3.img/ce_ground01.txd/sw_rockgrass1.dds\",\n \"gta3.img/cunte1_lahills.txd/sw_rockgrass1.dds\",\"gta3.img/ce_ground01.txd/sw_rockgrass1.dds\",\n \"gta3.img/lahillsground4cye.txd/sw_rockgrass1.dds\",\"gta3.img/ce_ground01.txd/sw_rockgrass1.dds\",\n \"gta3.img/mullho03a_lahills.txd/sw_rockgrass1.dds\",\"gta3.img/ce_ground01.txd/sw_rockgrass1.dds\",\n \"gta3.img/ce_ground03.txd/desertgravelgrass256.dds\",\"gta3.img/ce_ground02.txd/desertgravelgrass256.dds\",\n \"gta3.img/ce_ground04.txd/desertgravelgrass256.dds\",\"gta3.img/ce_ground02.txd/desertgravelgrass256.dds\",\n \"gta3.img/ce_ground07.txd/desertgravelgrass256.dds\",\"gta3.img/ce_ground02.txd/desertgravelgrass256.dds\",\n \"gta3.img/ce_ground08.txd/desertgravelgrass256.dds\",\"gta3.img/ce_ground02.txd/desertgravelgrass256.dds\",\n \"gta3.img/ce_ground09.txd/desertgravelgrass256.dds\",\"gta3.img/ce_ground02.txd/desertgravelgrass256.dds\",\n \"gta3.img/ce_ground10.txd/desertgravelgrass256.dds\",\"gta3.img/ce_ground02.txd/desertgravelgrass256.dds\",\n \"gta3.img/ce_ground11.txd/desertgravelgrass256.dds\",\"gta3.img/ce_ground02.txd/desertgravelgrass256.dds\",\n \"gta3.img/chicano10_lae.txd/desertgravelgrass256.dds\",\"gta3.img/ce_ground02.txd/desertgravelgrass256.dds\",\n \"gta3.img/cs_town.txd/desertgravelgrass256.dds\",\"gta3.img/ce_ground02.txd/desertgravelgrass256.dds\",\n \"gta3.img/cunte1_lahills.txd/desertgravelgrass256.dds\",\"gta3.img/ce_ground02.txd/desertgravelgrass256.dds\",\n \"gta3.img/cunteroads4.txd/desertgravelgrass256.dds\",\"gta3.img/ce_ground02.txd/desertgravelgrass256.dds\",\n \"gta3.img/easthills_lahills.txd/desertgravelgrass256.dds\",\"gta3.img/ce_ground02.txd/desertgravelgrass256.dds\",\n \"gta3.img/hillcliff_lahills.txd/desertgravelgrass256.dds\",\"gta3.img/ce_ground02.txd/desertgravelgrass256.dds\",\n \"gta3.img/lahillsground4cye.txd/desertgravelgrass256.dds\",\"gta3.img/ce_ground02.txd/desertgravelgrass256.dds\",\n \"gta3.img/lahillsgrounds.txd/desertgravelgrass256.dds\",\"gta3.img/ce_ground02.txd/desertgravelgrass256.dds\",\n \"gta3.img/lahillslaroads.txd/desertgravelgrass256.dds\",\"gta3.img/ce_ground02.txd/desertgravelgrass256.dds\",\n \"gta3.img/lawland2.txd/desertgravelgrass256.dds\",\"gta3.img/ce_ground02.txd/desertgravelgrass256.dds\",\n \"gta3.img/mullho03a_lahills.txd/desertgravelgrass256.dds\",\"gta3.img/ce_ground02.txd/desertgravelgrass256.dds\",\n \"gta3.img/mullho03_lahills.txd/desertgravelgrass256.dds\",\"gta3.img/ce_ground02.txd/desertgravelgrass256.dds\",\n \"gta3.img/richman04_lahills.txd/desertgravelgrass256.dds\",\"gta3.img/ce_ground02.txd/desertgravelgrass256.dds\",\n \"gta3.img/roadslahills.txd/desertgravelgrass256.dds\",\"gta3.img/ce_ground02.txd/desertgravelgrass256.dds\",\n \"gta3.img/vinewood01_lahills.txd/desertgravelgrass256.dds\",\"gta3.img/ce_ground02.txd/desertgravelgrass256.dds\",\n \"gta3.img/ce_ground03.txd/sw_warewall2.dds\",\"gta3.img/ce_ground02.txd/sw_warewall2.dds\",\n \"gta3.img/ce_loadbay.txd/sw_warewall2.dds\",\"gta3.img/ce_ground02.txd/sw_warewall2.dds\",\n \"gta3.img/ce_traintrack1.txd/sw_warewall2.dds\",\"gta3.img/ce_ground02.txd/sw_warewall2.dds\",\n \"gta3.img/ce_traintrack2.txd/sw_warewall2.dds\",\"gta3.img/ce_ground02.txd/sw_warewall2.dds\",\n \"gta3.img/lanriver.txd/sw_warewall2.dds\",\"gta3.img/ce_ground02.txd/sw_warewall2.dds\",\n \"gta3.img/railtracklae.txd/sw_warewall2.dds\",\"gta3.img/ce_ground02.txd/sw_warewall2.dds\",\n \"gta3.img/sw_apartments.txd/sw_warewall2.dds\",\"gta3.img/ce_ground02.txd/sw_warewall2.dds\",\n \"gta3.img/ce_ground03.txd/sw_sandgrass.dds\",\"gta3.img/ce_ground02.txd/sw_sandgrass.dds\",\n \"gta3.img/ce_ground04.txd/sw_sandgrass.dds\",\"gta3.img/ce_ground02.txd/sw_sandgrass.dds\",\n \"gta3.img/ce_ground05.txd/sw_sandgrass.dds\",\"gta3.img/ce_ground02.txd/sw_sandgrass.dds\",\n \"gta3.img/ce_ground07.txd/sw_sandgrass.dds\",\"gta3.img/ce_ground02.txd/sw_sandgrass.dds\",\n \"gta3.img/ce_ground08.txd/sw_sandgrass.dds\",\"gta3.img/ce_ground02.txd/sw_sandgrass.dds\",\n \"gta3.img/ce_ground07.txd/carpark_256128.dds\",\"gta3.img/ce_ground03.txd/carpark_256128.dds\",\n \"gta3.img/law_doontoon.txd/carpark_256128.dds\",\"gta3.img/ce_ground03.txd/carpark_256128.dds\",\n \"gta3.img/sw_fact02.txd/carpark_256128.dds\",\"gta3.img/ce_ground03.txd/carpark_256128.dds\",\n \"gta3.img/ce_ground07.txd/sw_grass01.dds\",\"gta3.img/ce_ground03.txd/sw_grass01.dds\",\n \"gta3.img/ce_ground10.txd/sw_grass01.dds\",\"gta3.img/ce_ground03.txd/sw_grass01.dds\",\n \"gta3.img/ce_ground11.txd/sw_grass01.dds\",\"gta3.img/ce_ground03.txd/sw_grass01.dds\",\n \"gta3.img/ce_ground07.txd/sw_grass01a.dds\",\"gta3.img/ce_ground03.txd/sw_grass01a.dds\",\n \"gta3.img/ce_ground10.txd/sw_grass01a.dds\",\"gta3.img/ce_ground03.txd/sw_grass01a.dds\",\n \"gta3.img/ce_ground11.txd/sw_grass01a.dds\",\"gta3.img/ce_ground03.txd/sw_grass01a.dds\",\n \"gta3.img/ce_ground04.txd/desclifftypebsmix.dds\",\"gta3.img/ce_ground03.txd/desclifftypebsmix.dds\",\n \"gta3.img/ce_ground05.txd/desclifftypebsmix.dds\",\"gta3.img/ce_ground03.txd/desclifftypebsmix.dds\",\n \"gta3.img/ce_ground07.txd/desclifftypebsmix.dds\",\"gta3.img/ce_ground03.txd/desclifftypebsmix.dds\",\n \"gta3.img/ce_ground12.txd/desclifftypebsmix.dds\",\"gta3.img/ce_ground03.txd/desclifftypebsmix.dds\",\n \"gta3.img/cunte_rocks.txd/desclifftypebsmix.dds\",\"gta3.img/ce_ground03.txd/desclifftypebsmix.dds\",\n \"gta3.img/richman04_lahills.txd/desclifftypebsmix.dds\",\"gta3.img/ce_ground03.txd/desclifftypebsmix.dds\",\n \"gta3.img/ce_ground04.txd/desmudtrail.dds\",\"gta3.img/ce_ground03.txd/desmudtrail.dds\",\n \"gta3.img/ce_ground05.txd/desmudtrail.dds\",\"gta3.img/ce_ground03.txd/desmudtrail.dds\",\n \"gta3.img/ce_ground07.txd/desmudtrail.dds\",\"gta3.img/ce_ground03.txd/desmudtrail.dds\",\n \"gta3.img/ce_ground12.txd/desmudtrail.dds\",\"gta3.img/ce_ground03.txd/desmudtrail.dds\",\n \"gta3.img/ce_ground13.txd/desmudtrail.dds\",\"gta3.img/ce_ground03.txd/desmudtrail.dds\",\n \"gta3.img/ce_ground14.txd/desmudtrail.dds\",\"gta3.img/ce_ground03.txd/desmudtrail.dds\",\n \"gta3.img/cunteroads2.txd/desmudtrail.dds\",\"gta3.img/ce_ground03.txd/desmudtrail.dds\",\n \"gta3.img/cunteroads4.txd/desmudtrail.dds\",\"gta3.img/ce_ground03.txd/desmudtrail.dds\",\n \"gta3.img/vgncnstrct1.txd/desmudtrail.dds\",\"gta3.img/ce_ground03.txd/desmudtrail.dds\",\n \"gta3.img/vgsecnstrct02.txd/desmudtrail.dds\",\"gta3.img/ce_ground03.txd/desmudtrail.dds\",\n \"gta3.img/cuntwlandse.txd/grassgrnbrnx256.dds\",\"gta3.img/ce_ground04.txd/grassgrnbrn256.dds\",\n \"gta3.img/vgwestland.txd/grassgrnbrn256.dds\",\"gta3.img/ce_ground04.txd/grassgrnbrn256.dds\",\n \"gta3.img/ce_ground05.txd/rocktbrn128blnd.dds\",\"gta3.img/ce_ground04.txd/rocktbrn128blnd.dds\",\n \"gta3.img/ce_ground08.txd/rocktbrn128blnd.dds\",\"gta3.img/ce_ground04.txd/rocktbrn128blnd.dds\",\n \"gta3.img/ce_ground12.txd/rocktbrn128blnd.dds\",\"gta3.img/ce_ground04.txd/rocktbrn128blnd.dds\",\n \"gta3.img/ce_ground13.txd/rocktbrn128blnd.dds\",\"gta3.img/ce_ground04.txd/rocktbrn128blnd.dds\",\n \"gta3.img/cs_forest.txd/rocktbrn128blnd.dds\",\"gta3.img/ce_ground04.txd/rocktbrn128blnd.dds\",\n \"gta3.img/cs_mountain.txd/rocktbrn128blnd.dds\",\"gta3.img/ce_ground04.txd/rocktbrn128blnd.dds\",\n \"gta3.img/cs_town.txd/rocktbrn128blnd.dds\",\"gta3.img/ce_ground04.txd/rocktbrn128blnd.dds\",\n \"gta3.img/cunte1_lahills.txd/rocktbrn128blnd.dds\",\"gta3.img/ce_ground04.txd/rocktbrn128blnd.dds\",\n \"gta3.img/hillcliff_lahills.txd/rocktbrn128blnd.dds\",\"gta3.img/ce_ground04.txd/rocktbrn128blnd.dds\",\n \"gta3.img/hobos_lawn.txd/rocktbrn128blnd.dds\",\"gta3.img/ce_ground04.txd/rocktbrn128blnd.dds\",\n \"gta3.img/landsfe.txd/rocktbrn128blnd.dds\",\"gta3.img/ce_ground04.txd/rocktbrn128blnd.dds\",\n \"gta3.img/mullho03a_lahills.txd/rocktbrn128blnd.dds\",\"gta3.img/ce_ground04.txd/rocktbrn128blnd.dds\",\n \"gta3.img/silconland_sfse.txd/rocktbrn128blnd.dds\",\"gta3.img/ce_ground04.txd/rocktbrn128blnd.dds\",\n \"gta3.img/ce_ground09.txd/carpark_128.dds\",\"gta3.img/ce_ground04.txd/carpark_128.dds\",\n \"gta3.img/eastls1_lae2.txd/carpark_128.dds\",\"gta3.img/ce_ground04.txd/carpark_128.dds\",\n \"gta3.img/lae2grnd.txd/carpark_128.dds\",\"gta3.img/ce_ground04.txd/carpark_128.dds\",\n \"gta3.img/nucarpark.txd/carpark_128.dds\",\"gta3.img/ce_ground04.txd/carpark_128.dds\",\n \"gta3.img/residnce01.txd/carpark_128.dds\",\"gta3.img/ce_ground04.txd/carpark_128.dds\",\n \"gta3.img/roadslahills.txd/carpark_128.dds\",\"gta3.img/ce_ground04.txd/carpark_128.dds\",\n \"gta3.img/shop06_lvs.txd/carpark_128.dds\",\"gta3.img/ce_ground04.txd/carpark_128.dds\",\n \"gta3.img/shop09.txd/carpark_128.dds\",\"gta3.img/ce_ground04.txd/carpark_128.dds\",\n \"gta3.img/sw_brewery.txd/carpark_128.dds\",\"gta3.img/ce_ground04.txd/carpark_128.dds\",\n \"gta3.img/sw_genstore.txd/carpark_128.dds\",\"gta3.img/ce_ground04.txd/carpark_128.dds\",\n \"gta3.img/vegasemulticar.txd/carpark_128.dds\",\"gta3.img/ce_ground04.txd/carpark_128.dds\",\n \"gta3.img/vgslockup.txd/carpark_128.dds\",\"gta3.img/ce_ground04.txd/carpark_128.dds\",\n \"gta3.img/vgsoffice1.txd/carpark_128.dds\",\"gta3.img/ce_ground04.txd/carpark_128.dds\",\n \"gta3.img/vgsswarehse02c.txd/carpark_128.dds\",\"gta3.img/ce_ground04.txd/carpark_128.dds\",\n \"gta3.img/vgsswarhse04.txd/carpark_128.dds\",\"gta3.img/ce_ground04.txd/carpark_128.dds\",\n \"gta3.img/ce_ground12.txd/desmud.dds\",\"gta3.img/ce_ground05.txd/desmud.dds\",\n \"gta3.img/ce_ground14.txd/desmud.dds\",\"gta3.img/ce_ground05.txd/desmud.dds\",\n \"gta3.img/cemetery_law.txd/desmud.dds\",\"gta3.img/ce_ground05.txd/desmud.dds\",\n \"gta3.img/chicano10_lae.txd/desmud.dds\",\"gta3.img/ce_ground05.txd/desmud.dds\",\n \"gta3.img/cs_mountain.txd/desmud.dds\",\"gta3.img/ce_ground05.txd/desmud.dds\",\n \"gta3.img/cs_town.txd/desmud.dds\",\"gta3.img/ce_ground05.txd/desmud.dds\",\n \"gta3.img/cuntwbtzzcs_t.txd/desmud.dds\",\"gta3.img/ce_ground05.txd/desmud.dds\",\n \"gta3.img/cuntwlandcent.txd/desmud.dds\",\"gta3.img/ce_ground05.txd/desmud.dds\",\n \"gta3.img/cuntwlandse.txd/desmud.dds\",\"gta3.img/ce_ground05.txd/desmud.dds\",\n \"gta3.img/cuntwlandwest.txd/desmud.dds\",\"gta3.img/ce_ground05.txd/desmud.dds\",\n \"gta3.img/cw2_photoblockcs_t.txd/desmud.dds\",\"gta3.img/ce_ground05.txd/desmud.dds\",\n \"gta3.img/desn2_stud.txd/desmud.dds\",\"gta3.img/ce_ground05.txd/desmud.dds\",\n \"gta3.img/vgncnstrct1.txd/desmud.dds\",\"gta3.img/ce_ground05.txd/desmud.dds\",\n \"gta3.img/vgsecnstrct02.txd/desmud.dds\",\"gta3.img/ce_ground05.txd/desmud.dds\",\n \"gta3.img/chicano10_lae.txd/brngrss2stones.dds\",\"gta3.img/ce_ground07.txd/brngrss2stones.dds\",\n \"gta3.img/des_sw.txd/brngrss2stones.dds\",\"gta3.img/ce_ground07.txd/brngrss2stones.dds\",\n \"gta3.img/ce_ground11.txd/sw_grassb01.dds\",\"gta3.img/ce_ground07.txd/sw_grassb01.dds\",\n \"gta3.img/ce_ground11.txd/sw_crops.dds\",\"gta3.img/ce_ground07.txd/sw_crops.dds\",\n \"gta3.img/ce_ground10.txd/cw2_mountdirt.dds\",\"gta3.img/ce_ground08.txd/cw2_mountdirt.dds\",\n \"gta3.img/cs_forest.txd/cw2_mountdirt.dds\",\"gta3.img/ce_ground08.txd/cw2_mountdirt.dds\",\n \"gta3.img/cs_mountain.txd/cw2_mountdirt.dds\",\"gta3.img/ce_ground08.txd/cw2_mountdirt.dds\",\n \"gta3.img/cs_scrapyardarea.txd/cw2_mountdirt.dds\",\"gta3.img/ce_ground08.txd/cw2_mountdirt.dds\",\n \"gta3.img/cs_town.txd/cw2_mountdirt.dds\",\"gta3.img/ce_ground08.txd/cw2_mountdirt.dds\",\n \"gta3.img/cuntwlandse.txd/cw2_mountdirt.dds\",\"gta3.img/ce_ground08.txd/cw2_mountdirt.dds\",\n \"gta3.img/desn2_peckers.txd/cw2_mountdirt.dds\",\"gta3.img/ce_ground08.txd/cw2_mountdirt.dds\",\n \"gta3.img/ce_ground10.txd/cw2_mountdirt2grass.dds\",\"gta3.img/ce_ground08.txd/cw2_mountdirt2grass.dds\",\n \"gta3.img/cs_forest.txd/cw2_mountdirt2grass.dds\",\"gta3.img/ce_ground08.txd/cw2_mountdirt2grass.dds\",\n \"gta3.img/cs_mountain.txd/cw2_mountdirt2grass.dds\",\"gta3.img/ce_ground08.txd/cw2_mountdirt2grass.dds\",\n \"gta3.img/cs_town.txd/cw2_mountdirt2grass.dds\",\"gta3.img/ce_ground08.txd/cw2_mountdirt2grass.dds\",\n \"gta3.img/ce_ground14.txd/dirtblendlit.dds\",\"gta3.img/ce_ground08.txd/dirtblendlit.dds\",\n \"gta3.img/mullho03a_lahills.txd/dirtblendlit.dds\",\"gta3.img/ce_ground08.txd/dirtblendlit.dds\",\n \"gta3.img/mullho03_lahills.txd/dirtblendlit.dds\",\"gta3.img/ce_ground08.txd/dirtblendlit.dds\",\n \"gta3.img/richman02_lahills.txd/dirtblendlit.dds\",\"gta3.img/ce_ground08.txd/dirtblendlit.dds\",\n \"gta3.img/roadslahills.txd/dirtblendlit.dds\",\"gta3.img/ce_ground08.txd/dirtblendlit.dds\",\n \"gta3.img/vinewood01_lahills.txd/dirtblendlit.dds\",\"gta3.img/ce_ground08.txd/dirtblendlit.dds\",\n \"gta3.img/des_nw2.txd/desgrassbrn_grn.dds\",\"gta3.img/ce_ground08.txd/desgrassbrn_grn.dds\",\n \"gta3.img/des_nw.txd/desgrassbrn_grn.dds\",\"gta3.img/ce_ground08.txd/desgrassbrn_grn.dds\",\n \"gta3.img/chicano10_lae.txd/grassbrn2rockbrn.dds\",\"gta3.img/ce_ground08.txd/grassbrn2rockbrn.dds\",\n \"gta3.img/des_nw2.txd/grassbrn2rockbrn.dds\",\"gta3.img/ce_ground08.txd/grassbrn2rockbrn.dds\",\n \"gta3.img/des_nw.txd/grassbrn2rockbrn.dds\",\"gta3.img/ce_ground08.txd/grassbrn2rockbrn.dds\",\n \"gta3.img/des_se4.txd/grassbrn2rockbrn.dds\",\"gta3.img/ce_ground08.txd/grassbrn2rockbrn.dds\",\n \"gta3.img/des_sw.txd/grassbrn2rockbrn.dds\",\"gta3.img/ce_ground08.txd/grassbrn2rockbrn.dds\",\n \"gta3.img/lahillsgrounds.txd/grassbrn2rockbrn.dds\",\"gta3.img/ce_ground08.txd/grassbrn2rockbrn.dds\",\n \"gta3.img/vgsecoast.txd/grassbrn2rockbrn.dds\",\"gta3.img/ce_ground08.txd/grassbrn2rockbrn.dds\",\n \"gta3.img/vgssland02.txd/grassbrn2rockbrn.dds\",\"gta3.img/ce_ground08.txd/grassbrn2rockbrn.dds\",\n \"gta3.img/cw_truckstopcs_t.txd/des_ranchwall1.dds\",\"gta3.img/ce_ground09.txd/des_ranchwall1.dds\",\n \"gta3.img/des_cen.txd/des_ranchwall1.dds\",\"gta3.img/ce_ground09.txd/des_ranchwall1.dds\",\n \"gta3.img/des_clifftown.txd/des_ranchwall1.dds\",\"gta3.img/ce_ground09.txd/des_ranchwall1.dds\",\n \"gta3.img/des_damquay.txd/des_ranchwall1.dds\",\"gta3.img/ce_ground09.txd/des_ranchwall1.dds\",\n \"gta3.img/desn2_minestuff.txd/des_ranchwall1.dds\",\"gta3.img/ce_ground09.txd/des_ranchwall1.dds\",\n \"gta3.img/desn2_stud.txd/des_ranchwall1.dds\",\"gta3.img/ce_ground09.txd/des_ranchwall1.dds\",\n \"gta3.img/des_ne.txd/des_ranchwall1.dds\",\"gta3.img/ce_ground09.txd/des_ranchwall1.dds\",\n \"gta3.img/desn_teepee.txd/des_ranchwall1.dds\",\"gta3.img/ce_ground09.txd/des_ranchwall1.dds\",\n \"gta3.img/desn_truckstop.txd/des_ranchwall1.dds\",\"gta3.img/ce_ground09.txd/des_ranchwall1.dds\",\n \"gta3.img/des_n.txd/des_ranchwall1.dds\",\"gta3.img/ce_ground09.txd/des_ranchwall1.dds\",\n \"gta3.img/des_nw2.txd/des_ranchwall1.dds\",\"gta3.img/ce_ground09.txd/des_ranchwall1.dds\",\n \"gta3.img/des_nwtownpolice.txd/des_ranchwall1.dds\",\"gta3.img/ce_ground09.txd/des_ranchwall1.dds\",\n \"gta3.img/des_nw.txd/des_ranchwall1.dds\",\"gta3.img/ce_ground09.txd/des_ranchwall1.dds\",\n \"gta3.img/des_ranch.txd/des_ranchwall1.dds\",\"gta3.img/ce_ground09.txd/des_ranchwall1.dds\",\n \"gta3.img/des_se1.txd/des_ranchwall1.dds\",\"gta3.img/ce_ground09.txd/des_ranchwall1.dds\",\n \"gta3.img/des_stownmain2.txd/des_ranchwall1.dds\",\"gta3.img/ce_ground09.txd/des_ranchwall1.dds\",\n \"gta3.img/des_stownmots1.txd/des_ranchwall1.dds\",\"gta3.img/ce_ground09.txd/des_ranchwall1.dds\",\n \"gta3.img/des_stownstrip1.txd/des_ranchwall1.dds\",\"gta3.img/ce_ground09.txd/des_ranchwall1.dds\",\n \"gta3.img/des_stownstrip2.txd/des_ranchwall1.dds\",\"gta3.img/ce_ground09.txd/des_ranchwall1.dds\",\n \"gta3.img/des_s.txd/des_ranchwall1.dds\",\"gta3.img/ce_ground09.txd/des_ranchwall1.dds\",\n \"gta3.img/des_sw.txd/des_ranchwall1.dds\",\"gta3.img/ce_ground09.txd/des_ranchwall1.dds\",\n \"gta3.img/docg01_lahills.txd/des_ranchwall1.dds\",\"gta3.img/ce_ground09.txd/des_ranchwall1.dds\",\n \"gta3.img/easthills_lahills.txd/des_ranchwall1.dds\",\"gta3.img/ce_ground09.txd/des_ranchwall1.dds\",\n \"gta3.img/hillcliff_lahills.txd/des_ranchwall1.dds\",\"gta3.img/ce_ground09.txd/des_ranchwall1.dds\",\n \"gta3.img/mullho03a_lahills.txd/des_ranchwall1.dds\",\"gta3.img/ce_ground09.txd/des_ranchwall1.dds\",\n \"gta3.img/mullho03_lahills.txd/des_ranchwall1.dds\",\"gta3.img/ce_ground09.txd/des_ranchwall1.dds\",\n \"gta3.img/roadslahills.txd/des_ranchwall1.dds\",\"gta3.img/ce_ground09.txd/des_ranchwall1.dds\",\n \"gta3.img/vinewood01_lahills.txd/des_ranchwall1.dds\",\"gta3.img/ce_ground09.txd/des_ranchwall1.dds\",\n \"gta_int.img/dr_gsnew.txd/des_ranchwall1.dds\",\"gta3.img/ce_ground09.txd/des_ranchwall1.dds\",\n \"gta3.img/ce_ground13.txd/des_dirt2=trackl.dds\",\"gta3.img/ce_ground10.txd/des_dirt2=trackl.dds\",\n \"gta3.img/cs_coast.txd/des_dirt2=trackl.dds\",\"gta3.img/ce_ground10.txd/des_dirt2=trackl.dds\",\n \"gta3.img/des_bighus.txd/des_dirt2=trackl.dds\",\"gta3.img/ce_ground10.txd/des_dirt2=trackl.dds\",\n \"gta3.img/des_se1.txd/des_dirt2=trackl.dds\",\"gta3.img/ce_ground10.txd/des_dirt2=trackl.dds\",\n \"gta3.img/des_se3.txd/des_dirt2=trackl.dds\",\"gta3.img/ce_ground10.txd/des_dirt2=trackl.dds\",\n \"gta3.img/des_se4.txd/des_dirt2=trackl.dds\",\"gta3.img/ce_ground10.txd/des_dirt2=trackl.dds\",\n \"gta3.img/ce_ground12.txd/desgreengrasstrckend.dds\",\"gta3.img/ce_ground10.txd/desgreengrasstrckend.dds\",\n \"gta3.img/ce_ground13.txd/desgreengrasstrckend.dds\",\"gta3.img/ce_ground10.txd/desgreengrasstrckend.dds\",\n \"gta3.img/ce_ground12.txd/des_dirt2grass.dds\",\"gta3.img/ce_ground10.txd/des_dirt2grass.dds\",\n \"gta3.img/ce_ground13.txd/des_dirt2grass.dds\",\"gta3.img/ce_ground10.txd/des_dirt2grass.dds\",\n \"gta3.img/ce_ground12.txd/des_dirt2track.dds\",\"gta3.img/ce_ground10.txd/des_dirt2track.dds\",\n \"gta3.img/ce_ground13.txd/des_dirt2track.dds\",\"gta3.img/ce_ground10.txd/des_dirt2track.dds\",\n \"gta3.img/cs_coast.txd/des_dirt2track.dds\",\"gta3.img/ce_ground10.txd/des_dirt2track.dds\",\n \"gta3.img/cs_town.txd/des_dirt2track.dds\",\"gta3.img/ce_ground10.txd/des_dirt2track.dds\",\n \"gta3.img/des_bighus.txd/des_dirt2track.dds\",\"gta3.img/ce_ground10.txd/des_dirt2track.dds\",\n \"gta3.img/des_ne.txd/des_dirt2track.dds\",\"gta3.img/ce_ground10.txd/des_dirt2track.dds\",\n \"gta3.img/des_n.txd/des_dirt2track.dds\",\"gta3.img/ce_ground10.txd/des_dirt2track.dds\",\n \"gta3.img/des_quarry.txd/des_dirt2track.dds\",\"gta3.img/ce_ground10.txd/des_dirt2track.dds\",\n \"gta3.img/des_se1.txd/des_dirt2track.dds\",\"gta3.img/ce_ground10.txd/des_dirt2track.dds\",\n \"gta3.img/des_se3.txd/des_dirt2track.dds\",\"gta3.img/ce_ground10.txd/des_dirt2track.dds\",\n \"gta3.img/des_se4.txd/des_dirt2track.dds\",\"gta3.img/ce_ground10.txd/des_dirt2track.dds\",\n \"gta3.img/des_s.txd/des_dirt2track.dds\",\"gta3.img/ce_ground10.txd/des_dirt2track.dds\",\n \"gta3.img/des_sw.txd/des_dirt2track.dds\",\"gta3.img/ce_ground10.txd/des_dirt2track.dds\",\n \"gta_int.img/dirtrack.txd/des_dirt2track.dds\",\"gta3.img/ce_ground10.txd/des_dirt2track.dds\",\n \"gta3.img/ce_ground12.txd/des_dirt2.dds\",\"gta3.img/ce_ground10.txd/des_dirt2.dds\",\n \"gta3.img/ce_ground13.txd/des_dirt2.dds\",\"gta3.img/ce_ground10.txd/des_dirt2.dds\",\n \"gta3.img/cs_town.txd/des_dirt2.dds\",\"gta3.img/ce_ground10.txd/des_dirt2.dds\",\n \"gta3.img/cuntwlandcarparks.txd/des_dirt2.dds\",\"gta3.img/ce_ground10.txd/des_dirt2.dds\",\n \"gta3.img/cuntwlandcent.txd/des_dirt2.dds\",\"gta3.img/ce_ground10.txd/des_dirt2.dds\",\n \"gta3.img/cuntwland.txd/des_dirt2.dds\",\"gta3.img/ce_ground10.txd/des_dirt2.dds\",\n \"gta3.img/des_bighus.txd/des_dirt2.dds\",\"gta3.img/ce_ground10.txd/des_dirt2.dds\",\n \"gta3.img/des_ne.txd/des_dirt2.dds\",\"gta3.img/ce_ground10.txd/des_dirt2.dds\",\n \"gta3.img/des_n.txd/des_dirt2.dds\",\"gta3.img/ce_ground10.txd/des_dirt2.dds\",\n \"gta3.img/des_nw2.txd/des_dirt2.dds\",\"gta3.img/ce_ground10.txd/des_dirt2.dds\",\n \"gta3.img/des_nw.txd/des_dirt2.dds\",\"gta3.img/ce_ground10.txd/des_dirt2.dds\",\n \"gta3.img/des_quarry.txd/des_dirt2.dds\",\"gta3.img/ce_ground10.txd/des_dirt2.dds\",\n \"gta3.img/des_se1.txd/des_dirt2.dds\",\"gta3.img/ce_ground10.txd/des_dirt2.dds\",\n \"gta3.img/des_se3.txd/des_dirt2.dds\",\"gta3.img/ce_ground10.txd/des_dirt2.dds\",\n \"gta3.img/des_se4.txd/des_dirt2.dds\",\"gta3.img/ce_ground10.txd/des_dirt2.dds\",\n \"gta3.img/des_s.txd/des_dirt2.dds\",\"gta3.img/ce_ground10.txd/des_dirt2.dds\",\n \"gta3.img/des_sw.txd/des_dirt2.dds\",\"gta3.img/ce_ground10.txd/des_dirt2.dds\",\n \"gta_int.img/dirtrack.txd/des_dirt2.dds\",\"gta3.img/ce_ground10.txd/des_dirt2.dds\",\n \"gta3.img/conhooses.txd/des_shingles.dds\",\"gta3.img/ce_ground10.txd/des_shingles.dds\",\n \"gta3.img/cunte_house1.txd/des_shingles.dds\",\"gta3.img/ce_ground10.txd/des_shingles.dds\",\n \"gta3.img/cuntwbt.txd/des_shingles.dds\",\"gta3.img/ce_ground10.txd/des_shingles.dds\",\n \"gta3.img/cuntwlandcent.txd/des_shingles.dds\",\"gta3.img/ce_ground10.txd/des_shingles.dds\",\n \"gta3.img/cuntwland.txd/des_shingles.dds\",\"gta3.img/ce_ground10.txd/des_shingles.dds\",\n \"gta3.img/cuntwshopscs_t.txd/des_shingles.dds\",\"gta3.img/ce_ground10.txd/des_shingles.dds\",\n \"gta3.img/cw2_storesnstuff.txd/des_shingles.dds\",\"gta3.img/ce_ground10.txd/des_shingles.dds\",\n \"gta3.img/cxref_oldwest.txd/des_shingles.dds\",\"gta3.img/ce_ground10.txd/des_shingles.dds\",\n \"gta3.img/cxref_savhus.txd/des_shingles.dds\",\"gta3.img/ce_ground10.txd/des_shingles.dds\",\n \"gta3.img/des_bighus.txd/des_shingles.dds\",\"gta3.img/ce_ground10.txd/des_shingles.dds\",\n \"gta3.img/des_farmstuff.txd/des_shingles.dds\",\"gta3.img/ce_ground10.txd/des_shingles.dds\",\n \"gta3.img/des_ntown.txd/des_shingles.dds\",\"gta3.img/ce_ground10.txd/des_shingles.dds\",\n \"gta3.img/des_nwtown.txd/des_shingles.dds\",\"gta3.img/ce_ground10.txd/des_shingles.dds\",\n \"gta3.img/des_nwtownw.txd/des_shingles.dds\",\"gta3.img/ce_ground10.txd/des_shingles.dds\",\n \"gta3.img/des_ranch.txd/des_shingles.dds\",\"gta3.img/ce_ground10.txd/des_shingles.dds\",\n \"gta3.img/des_wtownmain.txd/des_shingles.dds\",\"gta3.img/ce_ground10.txd/des_shingles.dds\",\n \"gta3.img/oldwest.txd/des_shingles.dds\",\"gta3.img/ce_ground10.txd/des_shingles.dds\",\n \"gta3.img/sw_smlfarm.txd/des_shingles.dds\",\"gta3.img/ce_ground10.txd/des_shingles.dds\",\n \"gta3.img/truth_farm.txd/des_shingles.dds\",\"gta3.img/ce_ground10.txd/des_shingles.dds\",\n \"gta3.img/cuntwlandcent.txd/sw_dirt01.dds\",\"gta3.img/ce_ground11.txd/sw_dirt01.dds\",\n \"gta3.img/lawnpark.txd/sw_dirt01.dds\",\"gta3.img/ce_ground11.txd/sw_dirt01.dds\",\n \"gta3.img/des_se3.txd/grassdead1blnd.dds\",\"gta3.img/ce_ground11.txd/grassdead1blnd.dds\",\n \"gta3.img/mullho03a_lahills.txd/grassdead1blnd.dds\",\"gta3.img/ce_ground11.txd/grassdead1blnd.dds\",\n \"gta3.img/richman02_lahills.txd/grassdead1blnd.dds\",\"gta3.img/ce_ground11.txd/grassdead1blnd.dds\",\n \"gta3.img/cunte1_lahills.txd/grassdead1.dds\",\"gta3.img/ce_ground11.txd/grassdead1.dds\",\n \"gta3.img/cuntwlandcarparks.txd/grassdead1.dds\",\"gta3.img/ce_ground11.txd/grassdead1.dds\",\n \"gta3.img/cuntwlandse.txd/grassdead1.dds\",\"gta3.img/ce_ground11.txd/grassdead1.dds\",\n \"gta3.img/cuntwland.txd/grassdead1.dds\",\"gta3.img/ce_ground11.txd/grassdead1.dds\",\n \"gta3.img/cuntwlandwest.txd/grassdead1.dds\",\"gta3.img/ce_ground11.txd/grassdead1.dds\",\n \"gta3.img/des_se2.txd/grassdead1.dds\",\"gta3.img/ce_ground11.txd/grassdead1.dds\",\n \"gta3.img/des_se3.txd/grassdead1.dds\",\"gta3.img/ce_ground11.txd/grassdead1.dds\",\n \"gta3.img/glenpark1_lae.txd/grassdead1.dds\",\"gta3.img/ce_ground11.txd/grassdead1.dds\",\n \"gta3.img/lahillslaroads.txd/grassdead1.dds\",\"gta3.img/ce_ground11.txd/grassdead1.dds\",\n \"gta3.img/law2_roadsb.txd/grassdead1.dds\",\"gta3.img/ce_ground11.txd/grassdead1.dds\",\n \"gta3.img/motel_lae.txd/grassdead1.dds\",\"gta3.img/ce_ground11.txd/grassdead1.dds\",\n \"gta3.img/mullho03a_lahills.txd/grassdead1.dds\",\"gta3.img/ce_ground11.txd/grassdead1.dds\",\n \"gta3.img/richman02_lahills.txd/grassdead1.dds\",\"gta3.img/ce_ground11.txd/grassdead1.dds\",\n \"gta3.img/ce_ground14.txd/desmudgrass.dds\",\"gta3.img/ce_ground12.txd/desmudgrass.dds\",\n \"gta3.img/cemetery_law.txd/desmudgrass.dds\",\"gta3.img/ce_ground12.txd/desmudgrass.dds\",\n \"gta3.img/cunteroads2.txd/desmudgrass.dds\",\"gta3.img/ce_ground12.txd/desmudgrass.dds\",\n \"gta3.img/ce_ground14.txd/concretedust2_line.dds\",\"gta3.img/ce_ground13.txd/concretedust2_line.dds\",\n \"gta3.img/sw_fact01a.txd/concretedust2_line.dds\",\"gta3.img/ce_ground13.txd/concretedust2_line.dds\",\n \"gta3.img/vgnland.txd/concretedust2_line.dds\",\"gta3.img/ce_ground13.txd/concretedust2_line.dds\",\n \"gta3.img/crackdrive_sfse.txd/dustyconcrete.dds\",\"gta3.img/ce_ground13.txd/dustyconcrete.dds\",\n \"gta3.img/sw_block05.txd/dustyconcrete.dds\",\"gta3.img/ce_ground13.txd/dustyconcrete.dds\",\n \"gta3.img/vgsbikeschool.txd/dustyconcrete.dds\",\"gta3.img/ce_ground13.txd/dustyconcrete.dds\",\n \"gta3.img/lan2freeway.txd/desertstones256grass.dds\",\"gta3.img/ce_ground14.txd/desertstones256grass.dds\",\n \"gta3.img/lahillsgrounds.txd/ladukfeen1.dds\",\"gta3.img/cehillhse14.txd/ladukfeen1.dds\",\n \"gta3.img/lahillshilhs1b.txd/ladukfeen1.dds\",\"gta3.img/cehillhse14.txd/ladukfeen1.dds\",\n \"gta3.img/lahillshilhs1d.txd/ladukfeen1.dds\",\"gta3.img/cehillhse14.txd/ladukfeen1.dds\",\n \"gta3.img/lahillshilhs1z.txd/ladukfeen1.dds\",\"gta3.img/cehillhse14.txd/ladukfeen1.dds\",\n \"gta3.img/cos_pizzaplace.txd/swimpoolside1_128.dds\",\"gta3.img/cehillhse14.txd/swimpoolside1_128.dds\",\n \"gta3.img/vgncondos1.txd/swimpoolside1_128.dds\",\"gta3.img/cehillhse14.txd/swimpoolside1_128.dds\",\n \"gta3.img/vgnvrock.txd/swimpoolside1_128.dds\",\"gta3.img/cehillhse14.txd/swimpoolside1_128.dds\",\n \"gta3.img/lashops1b_las2.txd/swimpoolbtm1_128.dds\",\"gta3.img/cehillhse14.txd/swimpoolbtm1_128.dds\",\n \"gta3.img/tikigrass.txd/swimpoolbtm1_128.dds\",\"gta3.img/cehillhse14.txd/swimpoolbtm1_128.dds\",\n \"gta3.img/vgncondos1.txd/swimpoolbtm1_128.dds\",\"gta3.img/cehillhse14.txd/swimpoolbtm1_128.dds\",\n \"gta3.img/vgnvrock.txd/swimpoolbtm1_128.dds\",\"gta3.img/cehillhse14.txd/swimpoolbtm1_128.dds\",\n \"gta3.img/vgseland03_lvs.txd/swimpoolbtm1_128.dds\",\"gta3.img/cehillhse14.txd/swimpoolbtm1_128.dds\",\n \"gta3.img/vgsswrehse03.txd/swimpoolbtm1_128.dds\",\"gta3.img/cehillhse14.txd/swimpoolbtm1_128.dds\",\n \"gta_int.img/genintintfasta.txd/swimpoolbtm1_128.dds\",\"gta3.img/cehillhse14.txd/swimpoolbtm1_128.dds\",\n \"gta3.img/compapart_la.txd/comptwindo4.dds\",\"gta3.img/cehillhse14.txd/comptwindo4.dds\",\n \"gta3.img/contachou1_lae2.txd/comptwindo4.dds\",\"gta3.img/cehillhse14.txd/comptwindo4.dds\",\n \"gta3.img/gangblok1_lae2.txd/comptwindo4.dds\",\"gta3.img/cehillhse14.txd/comptwindo4.dds\",\n \"gta3.img/hillhousex2_us.txd/comptwindo4.dds\",\"gta3.img/cehillhse14.txd/comptwindo4.dds\",\n \"gta3.img/melrose07_lawn.txd/comptwindo4.dds\",\"gta3.img/cehillhse14.txd/comptwindo4.dds\",\n \"gta3.img/vegashse2.txd/comptwindo4.dds\",\"gta3.img/cehillhse14.txd/comptwindo4.dds\",\n \"gta3.img/vegashse4.txd/comptwindo4.dds\",\"gta3.img/cehillhse14.txd/comptwindo4.dds\",\n \"gta3.img/vegashse8.txd/comptwindo4.dds\",\"gta3.img/cehillhse14.txd/comptwindo4.dds\",\n \"gta3.img/sprunkworks.txd/glassblocks1.dds\",\"gta3.img/cehillhse14.txd/glassblocks1.dds\",\n \"gta3.img/compapart_la.txd/comptonbrij1.dds\",\"gta3.img/cehillhse14.txd/comptonbrij1.dds\",\n \"gta3.img/hillhousex13_6.txd/comptonbrij1.dds\",\"gta3.img/cehillhse14.txd/comptonbrij1.dds\",\n \"gta3.img/hillhousex4_5.txd/comptonbrij1.dds\",\"gta3.img/cehillhse14.txd/comptonbrij1.dds\",\n \"gta3.img/sw_apartflat.txd/comptonbrij1.dds\",\"gta3.img/cehillhse14.txd/comptonbrij1.dds\",\n \"gta3.img/vgnretail6.txd/comptonbrij1.dds\",\"gta3.img/cehillhse14.txd/comptonbrij1.dds\",\n \"gta3.img/dk_midbuilds.txd/sw_waredoor.dds\",\"gta3.img/ce_loadbay.txd/sw_waredoor.dds\",\n \"gta3.img/sw_block05.txd/sw_waredoor.dds\",\"gta3.img/ce_loadbay.txd/sw_waredoor.dds\",\n \"gta3.img/sw_fact01a.txd/sw_waredoor.dds\",\"gta3.img/ce_loadbay.txd/sw_waredoor.dds\",\n \"gta3.img/sw_fact01.txd/sw_waredoor.dds\",\"gta3.img/ce_loadbay.txd/sw_waredoor.dds\",\n \"gta3.img/dk_midbuilds.txd/sw_trailer.dds\",\"gta3.img/ce_loadbay.txd/sw_trailer.dds\",\n \"gta3.img/dk_midbuilds.txd/sw_trailerred.dds\",\"gta3.img/ce_loadbay.txd/sw_trailerred.dds\",\n \"gta3.img/dk_midbuilds.txd/sw_wheelt.dds\",\"gta3.img/ce_loadbay.txd/sw_wheelt.dds\",\n \"gta3.img/dk_midbuilds.txd/sw_wheel1.dds\",\"gta3.img/ce_loadbay.txd/sw_wheel1.dds\",\n \"gta3.img/sw_fact01.txd/sw_corrug.dds\",\"gta3.img/ce_loadbay.txd/sw_corrug.dds\",\n \"gta3.img/ce_traintrack1.txd/sw_smlite.dds\",\"gta3.img/ce_loadbay.txd/sw_smlite.dds\",\n \"gta3.img/ce_traintrack2.txd/sw_smlite.dds\",\"gta3.img/ce_loadbay.txd/sw_smlite.dds\",\n \"gta3.img/lanriver.txd/sw_smlite.dds\",\"gta3.img/ce_loadbay.txd/sw_smlite.dds\",\n \"gta3.img/railtracklae.txd/sw_smlite.dds\",\"gta3.img/ce_loadbay.txd/sw_smlite.dds\",\n \"gta3.img/sw_brewery.txd/sw_smlite.dds\",\"gta3.img/ce_loadbay.txd/sw_smlite.dds\",\n \"gta3.img/sw_fact01a.txd/sw_smlite.dds\",\"gta3.img/ce_loadbay.txd/sw_smlite.dds\",\n \"gta3.img/sw_fact01.txd/sw_smlite.dds\",\"gta3.img/ce_loadbay.txd/sw_smlite.dds\",\n \"gta3.img/sw_roadgas.txd/sw_smlite.dds\",\"gta3.img/ce_loadbay.txd/sw_smlite.dds\",\n \"gta3.img/sw_ware01.txd/sw_smlite.dds\",\"gta3.img/ce_loadbay.txd/sw_smlite.dds\",\n \"gta3.img/ce_lod_02.txd/block2_lowlod.dds\",\"gta3.img/ce_lod_01.txd/block2_lowlod.dds\",\n \"gta3.img/ce_lod_03.txd/block2_lowlod.dds\",\"gta3.img/ce_lod_01.txd/block2_lowlod.dds\",\n \"gta3.img/lahillsa_lodw.txd/block2_lowlod.dds\",\"gta3.img/ce_lod_01.txd/block2_lowlod.dds\",\n \"gta3.img/ce_lod_02.txd/cratetop128lod.dds\",\"gta3.img/ce_lod_01.txd/cratetop128lod.dds\",\n \"gta3.img/ce_lod_04.txd/cratetop128lod.dds\",\"gta3.img/ce_lod_01.txd/cratetop128lod.dds\",\n \"gta3.img/ce_lod_02.txd/sw_rockgrass1lod.dds\",\"gta3.img/ce_lod_01.txd/sw_rockgrass1lod.dds\",\n \"gta3.img/ce_lod_03.txd/sw_rockgrass1lod.dds\",\"gta3.img/ce_lod_01.txd/sw_rockgrass1lod.dds\",\n \"gta3.img/ce_lod_04.txd/sw_rockgrass1lod.dds\",\"gta3.img/ce_lod_01.txd/sw_rockgrass1lod.dds\",\n \"gta3.img/ce_lod_05.txd/sw_rockgrass1lod.dds\",\"gta3.img/ce_lod_01.txd/sw_rockgrass1lod.dds\",\n \"gta3.img/ce_lod_07.txd/sw_rockgrass1lod.dds\",\"gta3.img/ce_lod_01.txd/sw_rockgrass1lod.dds\",\n \"gta3.img/lahillsa_lodw.txd/sw_rockgrass1lod.dds\",\"gta3.img/ce_lod_01.txd/sw_rockgrass1lod.dds\",\n \"gta3.img/ce_lod_02.txd/desertgravelgrass256lod.dds\",\"gta3.img/ce_lod_01.txd/desertgravelgrass256lod.dds\",\n \"gta3.img/ce_lod_03.txd/desertgravelgrass256lod.dds\",\"gta3.img/ce_lod_01.txd/desertgravelgrass256lod.dds\",\n \"gta3.img/ce_lod_04.txd/desertgravelgrass256lod.dds\",\"gta3.img/ce_lod_01.txd/desertgravelgrass256lod.dds\",\n \"gta3.img/ce_lod_05.txd/desertgravelgrass256lod.dds\",\"gta3.img/ce_lod_01.txd/desertgravelgrass256lod.dds\",\n \"gta3.img/ce_lod_07.txd/desertgravelgrass256lod.dds\",\"gta3.img/ce_lod_01.txd/desertgravelgrass256lod.dds\",\n \"gta3.img/lahillsa_lod.txd/desertgravelgrass256lod.dds\",\"gta3.img/ce_lod_01.txd/desertgravelgrass256lod.dds\",\n \"gta3.img/lahillsa_lodw.txd/desertgravelgrass256lod.dds\",\"gta3.img/ce_lod_01.txd/desertgravelgrass256lod.dds\",\n \"gta3.img/lahills_lod.txd/desertgravelgrass256lod.dds\",\"gta3.img/ce_lod_01.txd/desertgravelgrass256lod.dds\",\n \"gta3.img/ce_lod_02.txd/sw_stoneslod.dds\",\"gta3.img/ce_lod_01.txd/sw_stoneslod.dds\",\n \"gta3.img/ce_lod_03.txd/sw_stoneslod.dds\",\"gta3.img/ce_lod_01.txd/sw_stoneslod.dds\",\n \"gta3.img/ce_lod_04.txd/sw_stoneslod.dds\",\"gta3.img/ce_lod_01.txd/sw_stoneslod.dds\",\n \"gta3.img/ce_lod_05.txd/sw_stoneslod.dds\",\"gta3.img/ce_lod_01.txd/sw_stoneslod.dds\",\n \"gta3.img/lahills_lod.txd/sw_stoneslod.dds\",\"gta3.img/ce_lod_01.txd/sw_stoneslod.dds\",\n \"gta3.img/lodvgsslod02.txd/sw_stoneslod.dds\",\"gta3.img/ce_lod_01.txd/sw_stoneslod.dds\",\n \"gta3.img/ce_lod_02.txd/des_dirt1grasslod.dds\",\"gta3.img/ce_lod_01.txd/des_dirt1grasslod.dds\",\n \"gta3.img/ce_lod_07.txd/des_dirt1grasslod.dds\",\"gta3.img/ce_lod_01.txd/des_dirt1grasslod.dds\",\n \"gta3.img/ce_lod_02.txd/des_dirt1lod.dds\",\"gta3.img/ce_lod_01.txd/des_dirt1lod.dds\",\n \"gta3.img/ce_lod_07.txd/des_dirt1lod.dds\",\"gta3.img/ce_lod_01.txd/des_dirt1lod.dds\",\n \"gta3.img/lod_countryn.txd/des_dirt1lod.dds\",\"gta3.img/ce_lod_01.txd/des_dirt1lod.dds\",\n \"gta3.img/lodvgsslod02.txd/des_dirt1lod.dds\",\"gta3.img/ce_lod_01.txd/des_dirt1lod.dds\",\n \"gta3.img/ce_lod_02.txd/rocktbrn128lod.dds\",\"gta3.img/ce_lod_01.txd/rocktbrn128lod.dds\",\n \"gta3.img/ce_lod_03.txd/rocktbrn128lod.dds\",\"gta3.img/ce_lod_01.txd/rocktbrn128lod.dds\",\n \"gta3.img/ce_lod_04.txd/rocktbrn128lod.dds\",\"gta3.img/ce_lod_01.txd/rocktbrn128lod.dds\",\n \"gta3.img/ce_lod_05.txd/rocktbrn128lod.dds\",\"gta3.img/ce_lod_01.txd/rocktbrn128lod.dds\",\n \"gta3.img/ce_lod_07.txd/rocktbrn128lod.dds\",\"gta3.img/ce_lod_01.txd/rocktbrn128lod.dds\",\n \"gta3.img/lahillsa_lodw.txd/rocktbrn128lod.dds\",\"gta3.img/ce_lod_01.txd/rocktbrn128lod.dds\",\n \"gta3.img/lahills_lod.txd/rocktbrn128lod.dds\",\"gta3.img/ce_lod_01.txd/rocktbrn128lod.dds\",\n \"gta3.img/lod_countryn.txd/rocktbrn128lod.dds\",\"gta3.img/ce_lod_01.txd/rocktbrn128lod.dds\",\n \"gta3.img/ce_lod_02.txd/sw_grassb01lod.dds\",\"gta3.img/ce_lod_01.txd/sw_grassb01lod.dds\",\n \"gta3.img/ce_lod_02.txd/sw_farmroad01lod.dds\",\"gta3.img/ce_lod_01.txd/sw_farmroad01lod.dds\",\n \"gta3.img/ce_lod_04.txd/sw_cropslod.dds\",\"gta3.img/ce_lod_01.txd/sw_cropslod.dds\",\n \"gta3.img/ce_lod_02.txd/sw_grass01alod.dds\",\"gta3.img/ce_lod_01.txd/sw_grass01alod.dds\",\n \"gta3.img/ce_lod_03.txd/sw_grass01alod.dds\",\"gta3.img/ce_lod_01.txd/sw_grass01alod.dds\",\n \"gta3.img/ce_lod_04.txd/sw_grass01alod.dds\",\"gta3.img/ce_lod_01.txd/sw_grass01alod.dds\",\n \"gta3.img/ce_lod_07.txd/sw_grass01alod.dds\",\"gta3.img/ce_lod_01.txd/sw_grass01alod.dds\",\n \"gta3.img/ce_lod_02.txd/sw_grass01lod.dds\",\"gta3.img/ce_lod_01.txd/sw_grass01lod.dds\",\n \"gta3.img/ce_lod_03.txd/sw_grass01lod.dds\",\"gta3.img/ce_lod_01.txd/sw_grass01lod.dds\",\n \"gta3.img/ce_lod_04.txd/sw_grass01lod.dds\",\"gta3.img/ce_lod_01.txd/sw_grass01lod.dds\",\n \"gta3.img/ce_lod_07.txd/sw_grass01lod.dds\",\"gta3.img/ce_lod_01.txd/sw_grass01lod.dds\",\n \"gta3.img/ce_lod_02.txd/sw_stonesgrasslod.dds\",\"gta3.img/ce_lod_01.txd/sw_stonesgrasslod.dds\",\n \"gta3.img/ce_lod_03.txd/sw_stonesgrasslod.dds\",\"gta3.img/ce_lod_01.txd/sw_stonesgrasslod.dds\",\n \"gta3.img/ce_lod_04.txd/sw_stonesgrasslod.dds\",\"gta3.img/ce_lod_01.txd/sw_stonesgrasslod.dds\",\n \"gta3.img/ce_lod_05.txd/sw_stonesgrasslod.dds\",\"gta3.img/ce_lod_01.txd/sw_stonesgrasslod.dds\",\n \"gta3.img/ce_lod_07.txd/sw_stonesgrasslod.dds\",\"gta3.img/ce_lod_01.txd/sw_stonesgrasslod.dds\",\n \"gta3.img/lahills_lod.txd/sw_stonesgrasslod.dds\",\"gta3.img/ce_lod_01.txd/sw_stonesgrasslod.dds\",\n \"gta3.img/lodvgsslod02.txd/sw_stonesgrasslod.dds\",\"gta3.img/ce_lod_01.txd/sw_stonesgrasslod.dds\",\n \"gta3.img/ce_lod_02.txd/cuntetownroad2lod.dds\",\"gta3.img/ce_lod_01.txd/cuntetownroad2lod.dds\",\n \"gta3.img/ce_lod_04.txd/cuntetownroad2lod.dds\",\"gta3.img/ce_lod_01.txd/cuntetownroad2lod.dds\",\n \"gta3.img/ce_lod_05.txd/cuntetownroad2lod.dds\",\"gta3.img/ce_lod_01.txd/cuntetownroad2lod.dds\",\n \"gta3.img/ce_lod_07.txd/cuntetownroad2lod.dds\",\"gta3.img/ce_lod_01.txd/cuntetownroad2lod.dds\",\n \"gta3.img/lahillsa_lod.txd/cuntetownroad2lod.dds\",\"gta3.img/ce_lod_01.txd/cuntetownroad2lod.dds\",\n \"gta3.img/lahillsa_lodw.txd/cuntetownroad2lod.dds\",\"gta3.img/ce_lod_01.txd/cuntetownroad2lod.dds\",\n \"gta3.img/ce_lod_02.txd/cunte_roadwideside.dds\",\"gta3.img/ce_lod_01.txd/cunte_roadwideside.dds\",\n \"gta3.img/ce_lod_03.txd/cunte_roadwideside.dds\",\"gta3.img/ce_lod_01.txd/cunte_roadwideside.dds\",\n \"gta3.img/ce_lod_04.txd/cunte_roadwideside.dds\",\"gta3.img/ce_lod_01.txd/cunte_roadwideside.dds\",\n \"gta3.img/ce_lod_05.txd/cunte_roadwideside.dds\",\"gta3.img/ce_lod_01.txd/cunte_roadwideside.dds\",\n \"gta3.img/ce_lod_07.txd/cunte_roadwideside.dds\",\"gta3.img/ce_lod_01.txd/cunte_roadwideside.dds\",\n \"gta3.img/lahillsa_lodw.txd/cunte_roadwideside.dds\",\"gta3.img/ce_lod_01.txd/cunte_roadwideside.dds\",\n \"gta3.img/lahills_lod.txd/cunte_roadwideside.dds\",\"gta3.img/ce_lod_01.txd/cunte_roadwideside.dds\",\n \"gta3.img/ce_lod_04.txd/ce_watertower1lod.dds\",\"gta3.img/ce_lod_01.txd/ce_watertower1lod.dds\",\n \"gta3.img/cunte_farmlod.txd/farmbarn02lod.dds\",\"gta3.img/ce_lod_01.txd/farmbarn02lod.dds\",\n \"gta3.img/lodlawnland.txd/farmbarn02lod.dds\",\"gta3.img/ce_lod_01.txd/farmbarn02lod.dds\",\n \"gta3.img/cunte_farmlod.txd/farmbarn01lod.dds\",\"gta3.img/ce_lod_01.txd/farmbarn01lod.dds\",\n \"gta3.img/lodlawnland.txd/farmbarn01lod.dds\",\"gta3.img/ce_lod_01.txd/farmbarn01lod.dds\",\n \"gta3.img/ce_lod_04.txd/carpark_128lod.dds\",\"gta3.img/ce_lod_01.txd/carpark_128lod.dds\",\n \"gta3.img/ce_lod_07.txd/carpark_128lod.dds\",\"gta3.img/ce_lod_01.txd/carpark_128lod.dds\",\n \"gta3.img/ce_lod_02.txd/desertgryard256lod.dds\",\"gta3.img/ce_lod_01.txd/desertgryard256lod.dds\",\n \"gta3.img/ce_lod_03.txd/desertgryard256lod.dds\",\"gta3.img/ce_lod_01.txd/desertgryard256lod.dds\",\n \"gta3.img/ce_lod_04.txd/desertgryard256lod.dds\",\"gta3.img/ce_lod_01.txd/desertgryard256lod.dds\",\n \"gta3.img/ce_lod_05.txd/desertgryard256lod.dds\",\"gta3.img/ce_lod_01.txd/desertgryard256lod.dds\",\n \"gta3.img/ce_lod_07.txd/desertgryard256lod.dds\",\"gta3.img/ce_lod_01.txd/desertgryard256lod.dds\",\n \"gta3.img/lahillsa_lod.txd/desertgryard256lod.dds\",\"gta3.img/ce_lod_01.txd/desertgryard256lod.dds\",\n \"gta3.img/lahillsa_lodw.txd/desertgryard256lod.dds\",\"gta3.img/ce_lod_01.txd/desertgryard256lod.dds\",\n \"gta3.img/lahills_lod.txd/desertgryard256lod.dds\",\"gta3.img/ce_lod_01.txd/desertgryard256lod.dds\",\n \"gta3.img/lod_countryn.txd/desertgryard256lod.dds\",\"gta3.img/ce_lod_01.txd/desertgryard256lod.dds\",\n \"gta3.img/ce_lod_02.txd/grassbrn2rockbrnglod.dds\",\"gta3.img/ce_lod_01.txd/grassbrn2rockbrnglod.dds\",\n \"gta3.img/ce_lod_03.txd/grassbrn2rockbrnglod.dds\",\"gta3.img/ce_lod_01.txd/grassbrn2rockbrnglod.dds\",\n \"gta3.img/ce_lod_04.txd/grassbrn2rockbrnglod.dds\",\"gta3.img/ce_lod_01.txd/grassbrn2rockbrnglod.dds\",\n \"gta3.img/ce_lod_05.txd/grassbrn2rockbrnglod.dds\",\"gta3.img/ce_lod_01.txd/grassbrn2rockbrnglod.dds\",\n \"gta3.img/ce_lod_07.txd/grassbrn2rockbrnglod.dds\",\"gta3.img/ce_lod_01.txd/grassbrn2rockbrnglod.dds\",\n \"gta3.img/cs_lod.txd/grassbrn2rockbrnglod.dds\",\"gta3.img/ce_lod_01.txd/grassbrn2rockbrnglod.dds\",\n \"gta3.img/lahills_lod.txd/grassbrn2rockbrnglod.dds\",\"gta3.img/ce_lod_01.txd/grassbrn2rockbrnglod.dds\",\n \"gta3.img/ce_lod_02.txd/forestfloorgrasslod.dds\",\"gta3.img/ce_lod_01.txd/forestfloorgrasslod.dds\",\n \"gta3.img/ce_lod_07.txd/forestfloorgrasslod.dds\",\"gta3.img/ce_lod_01.txd/forestfloorgrasslod.dds\",\n \"gta3.img/ce_lod_02.txd/forestfloor256lod.dds\",\"gta3.img/ce_lod_01.txd/forestfloor256lod.dds\",\n \"gta3.img/ce_lod_07.txd/forestfloor256lod.dds\",\"gta3.img/ce_lod_01.txd/forestfloor256lod.dds\",\n \"gta3.img/lahillsa_lodw.txd/forestfloor256lod.dds\",\"gta3.img/ce_lod_01.txd/forestfloor256lod.dds\",\n \"gta3.img/ce_lod_02.txd/dirttracksgrass256lod.dds\",\"gta3.img/ce_lod_01.txd/dirttracksgrass256lod.dds\",\n \"gta3.img/ce_lod_03.txd/dirttracksgrass256lod.dds\",\"gta3.img/ce_lod_01.txd/dirttracksgrass256lod.dds\",\n \"gta3.img/ce_lod_04.txd/dirttracksgrass256lod.dds\",\"gta3.img/ce_lod_01.txd/dirttracksgrass256lod.dds\",\n \"gta3.img/ce_lod_05.txd/dirttracksgrass256lod.dds\",\"gta3.img/ce_lod_01.txd/dirttracksgrass256lod.dds\",\n \"gta3.img/ce_lod_07.txd/dirttracksgrass256lod.dds\",\"gta3.img/ce_lod_01.txd/dirttracksgrass256lod.dds\",\n \"gta3.img/lahills_lod.txd/dirttracksgrass256lod.dds\",\"gta3.img/ce_lod_01.txd/dirttracksgrass256lod.dds\",\n \"gta3.img/ce_lod_02.txd/sw_rockgrassb1lod.dds\",\"gta3.img/ce_lod_01.txd/sw_rockgrassb1lod.dds\",\n \"gta3.img/ce_lod_03.txd/sw_rockgrassb1lod.dds\",\"gta3.img/ce_lod_01.txd/sw_rockgrassb1lod.dds\",\n \"gta3.img/ce_lod_04.txd/sw_rockgrassb1lod.dds\",\"gta3.img/ce_lod_01.txd/sw_rockgrassb1lod.dds\",\n \"gta3.img/ce_lod_05.txd/sw_rockgrassb1lod.dds\",\"gta3.img/ce_lod_01.txd/sw_rockgrassb1lod.dds\",\n \"gta3.img/ce_lod_07.txd/sw_rockgrassb1lod.dds\",\"gta3.img/ce_lod_01.txd/sw_rockgrassb1lod.dds\",\n \"gta3.img/lahillsa_lod.txd/sw_rockgrassb1lod.dds\",\"gta3.img/ce_lod_01.txd/sw_rockgrassb1lod.dds\",\n \"gta3.img/lahillsa_lodw.txd/sw_rockgrassb1lod.dds\",\"gta3.img/ce_lod_01.txd/sw_rockgrassb1lod.dds\",\n \"gta3.img/lahills_lod.txd/sw_rockgrassb1lod.dds\",\"gta3.img/ce_lod_01.txd/sw_rockgrassb1lod.dds\",\n \"gta3.img/ce_lod_02.txd/desgreengrasslod.dds\",\"gta3.img/ce_lod_01.txd/desgreengrasslod.dds\",\n \"gta3.img/ce_lod_03.txd/desgreengrasslod.dds\",\"gta3.img/ce_lod_01.txd/desgreengrasslod.dds\",\n \"gta3.img/ce_lod_04.txd/desgreengrasslod.dds\",\"gta3.img/ce_lod_01.txd/desgreengrasslod.dds\",\n \"gta3.img/ce_lod_05.txd/desgreengrasslod.dds\",\"gta3.img/ce_lod_01.txd/desgreengrasslod.dds\",\n \"gta3.img/ce_lod_07.txd/desgreengrasslod.dds\",\"gta3.img/ce_lod_01.txd/desgreengrasslod.dds\",\n \"gta3.img/lahillsa_lod.txd/desgreengrasslod.dds\",\"gta3.img/ce_lod_01.txd/desgreengrasslod.dds\",\n \"gta3.img/lahillsa_lodw.txd/desgreengrasslod.dds\",\"gta3.img/ce_lod_01.txd/desgreengrasslod.dds\",\n \"gta3.img/lahills_lod.txd/desgreengrasslod.dds\",\"gta3.img/ce_lod_01.txd/desgreengrasslod.dds\",\n \"gta3.img/lodvgsslod02.txd/desgreengrasslod.dds\",\"gta3.img/ce_lod_01.txd/desgreengrasslod.dds\",\n \"gta3.img/lodvgsslod.txd/desgreengrasslod.dds\",\"gta3.img/ce_lod_01.txd/desgreengrasslod.dds\",\n \"gta3.img/ce_lod_02.txd/desgreengrassmixlod.dds\",\"gta3.img/ce_lod_01.txd/desgreengrassmixlod.dds\",\n \"gta3.img/ce_lod_03.txd/desgreengrassmixlod.dds\",\"gta3.img/ce_lod_01.txd/desgreengrassmixlod.dds\",\n \"gta3.img/ce_lod_04.txd/desgreengrassmixlod.dds\",\"gta3.img/ce_lod_01.txd/desgreengrassmixlod.dds\",\n \"gta3.img/ce_lod_05.txd/desgreengrassmixlod.dds\",\"gta3.img/ce_lod_01.txd/desgreengrassmixlod.dds\",\n \"gta3.img/ce_lod_07.txd/desgreengrassmixlod.dds\",\"gta3.img/ce_lod_01.txd/desgreengrassmixlod.dds\",\n \"gta3.img/lahillsa_lod.txd/desgreengrassmixlod.dds\",\"gta3.img/ce_lod_01.txd/desgreengrassmixlod.dds\",\n \"gta3.img/lahillsa_lodw.txd/desgreengrassmixlod.dds\",\"gta3.img/ce_lod_01.txd/desgreengrassmixlod.dds\",\n \"gta3.img/lahills_lod.txd/desgreengrassmixlod.dds\",\"gta3.img/ce_lod_01.txd/desgreengrassmixlod.dds\",\n \"gta3.img/ce_lod_03.txd/trail_wall1lod.dds\",\"gta3.img/ce_lod_02.txd/trail_wall1lod.dds\",\n \"gta3.img/lahillsa_lodw.txd/trail_wall1lod.dds\",\"gta3.img/ce_lod_02.txd/trail_wall1lod.dds\",\n \"gta3.img/lod_countryn.txd/trail_wall1lod.dds\",\"gta3.img/ce_lod_02.txd/trail_wall1lod.dds\",\n \"gta3.img/ce_lod_03.txd/newgrnd1brn_128lod.dds\",\"gta3.img/ce_lod_02.txd/newgrnd1brn_128lod.dds\",\n \"gta3.img/lahillsa_lod.txd/newgrnd1brn_128lod.dds\",\"gta3.img/ce_lod_02.txd/newgrnd1brn_128lod.dds\",\n \"gta3.img/lahillsa_lodw.txd/planks01lod.dds\",\"gta3.img/ce_lod_02.txd/planks01lod.dds\",\n \"gta3.img/lahills_lod.txd/planks01lod.dds\",\"gta3.img/ce_lod_02.txd/planks01lod.dds\",\n \"gta3.img/ce_lod_07.txd/dirtblendlitlod.dds\",\"gta3.img/ce_lod_02.txd/dirtblendlitlod.dds\",\n \"gta3.img/lahillsa_lod.txd/dirtblendlitlod.dds\",\"gta3.img/ce_lod_02.txd/dirtblendlitlod.dds\",\n \"gta3.img/lahills_lod.txd/dirtblendlitlod.dds\",\"gta3.img/ce_lod_02.txd/dirtblendlitlod.dds\",\n \"gta3.img/lawnlodbig.txd/greyground_lod.dds\",\"gta3.img/ce_lod_02.txd/greyground_lod.dds\",\n \"gta3.img/lawnlodbig.txd/greyground256.dds\",\"gta3.img/ce_lod_02.txd/greyground_lod.dds\",\n \"gta3.img/lod2lae1.txd/greyground_lod.dds\",\"gta3.img/ce_lod_02.txd/greyground_lod.dds\",\n \"gta3.img/lodlawnsmall.txd/greyground_lod.dds\",\"gta3.img/ce_lod_02.txd/greyground_lod.dds\",\n \"gta3.img/lodlawnsmall.txd/greyground256.dds\",\"gta3.img/ce_lod_02.txd/greyground_lod.dds\",\n \"gta3.img/lodvgsslod01.txd/greyground256.dds\",\"gta3.img/ce_lod_02.txd/greyground_lod.dds\",\n \"gta3.img/lodvgsslod01.txd/greyground_lod.dds\",\"gta3.img/ce_lod_02.txd/greyground_lod.dds\",\n \"gta3.img/lodvgsslod02.txd/greyground_lod.dds\",\"gta3.img/ce_lod_02.txd/greyground_lod.dds\",\n \"gta3.img/lodvgsslod.txd/greyground_lod.dds\",\"gta3.img/ce_lod_02.txd/greyground_lod.dds\",\n \"gta3.img/vegaselod1.txd/greyground_lod.dds\",\"gta3.img/ce_lod_02.txd/greyground_lod.dds\",\n \"gta3.img/vegaselod2.txd/greyground_lod.dds\",\"gta3.img/ce_lod_02.txd/greyground_lod.dds\",\n \"gta3.img/vegaselod3.txd/greyground_lod.dds\",\"gta3.img/ce_lod_02.txd/greyground_lod.dds\",\n \"gta3.img/vegasnlod1.txd/greyground_lod.dds\",\"gta3.img/ce_lod_02.txd/greyground_lod.dds\",\n \"gta3.img/vegasnlod4.txd/greyground_lod.dds\",\"gta3.img/ce_lod_02.txd/greyground_lod.dds\",\n \"gta3.img/ce_lod_04.txd/desgrassbrnlod.dds\",\"gta3.img/ce_lod_02.txd/desgrassbrnlod.dds\",\n \"gta3.img/lod_countryn.txd/desgrassbrnlod.dds\",\"gta3.img/ce_lod_02.txd/desgrassbrnlod.dds\",\n \"gta3.img/ce_lod_03.txd/desertstones256lod.dds\",\"gta3.img/ce_lod_02.txd/desertstones256lod.dds\",\n \"gta3.img/ce_lod_04.txd/desertstones256lod.dds\",\"gta3.img/ce_lod_02.txd/desertstones256lod.dds\",\n \"gta3.img/ce_lod_05.txd/desertstones256lod.dds\",\"gta3.img/ce_lod_02.txd/desertstones256lod.dds\",\n \"gta3.img/ce_lod_07.txd/desertstones256lod.dds\",\"gta3.img/ce_lod_02.txd/desertstones256lod.dds\",\n \"gta3.img/lahillsa_lod.txd/desertstones256lod.dds\",\"gta3.img/ce_lod_02.txd/desertstones256lod.dds\",\n \"gta3.img/lahillsa_lodw.txd/desertstones256lod.dds\",\"gta3.img/ce_lod_02.txd/desertstones256lod.dds\",\n \"gta3.img/lahills_lod.txd/desertstones256lod.dds\",\"gta3.img/ce_lod_02.txd/desertstones256lod.dds\",\n \"gta3.img/lod_countryn.txd/desertstones256lod.dds\",\"gta3.img/ce_lod_02.txd/desertstones256lod.dds\",\n \"gta3.img/ce_lod_03.txd/desmudlod.dds\",\"gta3.img/ce_lod_02.txd/desmudlod.dds\",\n \"gta3.img/ce_lod_03.txd/ce_roadverge.dds\",\"gta3.img/ce_lod_02.txd/ce_roadverge.dds\",\n \"gta3.img/ce_lod_04.txd/ce_roadverge.dds\",\"gta3.img/ce_lod_02.txd/ce_roadverge.dds\",\n \"gta3.img/ce_lod_05.txd/ce_roadverge.dds\",\"gta3.img/ce_lod_02.txd/ce_roadverge.dds\",\n \"gta3.img/ce_lod_07.txd/ce_roadverge.dds\",\"gta3.img/ce_lod_02.txd/ce_roadverge.dds\",\n \"gta3.img/lahillsa_lodw.txd/ce_roadverge.dds\",\"gta3.img/ce_lod_02.txd/ce_roadverge.dds\",\n \"gta3.img/ce_lod_03.txd/cuntetownroad1lod.dds\",\"gta3.img/ce_lod_02.txd/cuntetownroad1lod.dds\",\n \"gta3.img/ce_lod_04.txd/cuntetownroad1lod.dds\",\"gta3.img/ce_lod_02.txd/cuntetownroad1lod.dds\",\n \"gta3.img/ce_lod_07.txd/cuntetownroad1lod.dds\",\"gta3.img/ce_lod_02.txd/cuntetownroad1lod.dds\",\n \"gta3.img/lahillsa_lod.txd/cuntetownroad1lod.dds\",\"gta3.img/ce_lod_02.txd/cuntetownroad1lod.dds\",\n \"gta3.img/lahillsa_lodw.txd/cuntetownroad1lod.dds\",\"gta3.img/ce_lod_02.txd/cuntetownroad1lod.dds\",\n \"gta3.img/lahills_lod.txd/bow_warehousewalllod.dds\",\"gta3.img/ce_lod_02.txd/bow_warehousewalllod.dds\",\n \"gta3.img/ce_lod_03.txd/blocklod.dds\",\"gta3.img/ce_lod_02.txd/blocklod.dds\",\n \"gta3.img/ce_lod_04.txd/blocklod.dds\",\"gta3.img/ce_lod_02.txd/blocklod.dds\",\n \"gta3.img/ce_lod_05.txd/blocklod.dds\",\"gta3.img/ce_lod_02.txd/blocklod.dds\",\n \"gta3.img/ce_lod_07.txd/blocklod.dds\",\"gta3.img/ce_lod_02.txd/blocklod.dds\",\n \"gta3.img/cunte_farmlod.txd/blocklod.dds\",\"gta3.img/ce_lod_02.txd/blocklod.dds\",\n \"gta3.img/lahillsa_lod.txd/blocklod.dds\",\"gta3.img/ce_lod_02.txd/blocklod.dds\",\n \"gta3.img/lahillsa_lodw.txd/blocklod.dds\",\"gta3.img/ce_lod_02.txd/blocklod.dds\",\n \"gta3.img/lahills_lod.txd/blocklod.dds\",\"gta3.img/ce_lod_02.txd/blocklod.dds\",\n \"gta3.img/lodvegaswest1.txd/blocklod.dds\",\"gta3.img/ce_lod_02.txd/blocklod.dds\",\n \"gta3.img/lodvgsslod01.txd/blocklod.dds\",\"gta3.img/ce_lod_02.txd/blocklod.dds\",\n \"gta3.img/lodvgsslod02.txd/blocklod.dds\",\"gta3.img/ce_lod_02.txd/blocklod.dds\",\n \"gta3.img/lodvgswestout.txd/blocklod.dds\",\"gta3.img/ce_lod_02.txd/blocklod.dds\",\n \"gta3.img/vegaselod2.txd/blocklod.dds\",\"gta3.img/ce_lod_02.txd/blocklod.dds\",\n \"gta3.img/vegaselod3.txd/blocklod.dds\",\"gta3.img/ce_lod_02.txd/blocklod.dds\",\n \"gta3.img/vegasnlod4.txd/blocklod.dds\",\"gta3.img/ce_lod_02.txd/blocklod.dds\",\n \"gta3.img/ce_lod_03.txd/des_dirt2grasslod.dds\",\"gta3.img/ce_lod_02.txd/des_dirt2grasslod.dds\",\n \"gta3.img/ce_lod_07.txd/des_dirt2grasslod.dds\",\"gta3.img/ce_lod_02.txd/des_dirt2grasslod.dds\",\n \"gta3.img/ce_lod_03.txd/des_dirt2lod.dds\",\"gta3.img/ce_lod_02.txd/des_dirt2lod.dds\",\n \"gta3.img/ce_lod_07.txd/des_dirt2lod.dds\",\"gta3.img/ce_lod_02.txd/des_dirt2lod.dds\",\n \"gta3.img/lod_countryn.txd/des_dirt2lod.dds\",\"gta3.img/ce_lod_02.txd/des_dirt2lod.dds\",\n \"gta3.img/ce_lod_03.txd/des_dirt2tracklod.dds\",\"gta3.img/ce_lod_02.txd/des_dirt2tracklod.dds\",\n \"gta3.img/ce_lod_07.txd/des_dirt2tracklod.dds\",\"gta3.img/ce_lod_02.txd/des_dirt2tracklod.dds\",\n \"gta3.img/lod_countryn.txd/des_dirt2tracklod.dds\",\"gta3.img/ce_lod_02.txd/des_dirt2tracklod.dds\",\n \"gta3.img/ce_lod_03.txd/rocktbrn128bllod.dds\",\"gta3.img/ce_lod_02.txd/rocktbrn128bllod.dds\",\n \"gta3.img/ce_lod_04.txd/rocktbrn128bllod.dds\",\"gta3.img/ce_lod_02.txd/rocktbrn128bllod.dds\",\n \"gta3.img/ce_lod_05.txd/rocktbrn128bllod.dds\",\"gta3.img/ce_lod_02.txd/rocktbrn128bllod.dds\",\n \"gta3.img/ce_lod_07.txd/rocktbrn128bllod.dds\",\"gta3.img/ce_lod_02.txd/rocktbrn128bllod.dds\",\n \"gta3.img/lahillsa_lod.txd/rocktbrn128blnlod.dds\",\"gta3.img/ce_lod_02.txd/rocktbrn128bllod.dds\",\n \"gta3.img/lahillsa_lod.txd/rocktbrn128bllod.dds\",\"gta3.img/ce_lod_02.txd/rocktbrn128bllod.dds\",\n \"gta3.img/lahillsa_lodw.txd/rocktbrn128blnlod.dds\",\"gta3.img/ce_lod_02.txd/rocktbrn128bllod.dds\",\n \"gta3.img/ce_lod_03.txd/floor_tileone_256lod.dds\",\"gta3.img/ce_lod_02.txd/floor_tileone_256lod.dds\",\n \"gta3.img/lahillsa_lod.txd/heliconcrete_lod.dds\",\"gta3.img/ce_lod_02.txd/heliconcrete_lod.dds\",\n \"gta3.img/lahillsa_lodw.txd/heliconcrete_lod.dds\",\"gta3.img/ce_lod_02.txd/heliconcrete_lod.dds\",\n \"gta3.img/lodlawnsmall.txd/heliconcrete_lod.dds\",\"gta3.img/ce_lod_02.txd/heliconcrete_lod.dds\",\n \"gta3.img/lodvgsslod02.txd/heliconcrete_lod.dds\",\"gta3.img/ce_lod_02.txd/heliconcrete_lod.dds\",\n \"gta3.img/lodvgsslod.txd/heliconcrete_lod.dds\",\"gta3.img/ce_lod_02.txd/heliconcrete_lod.dds\",\n \"gta3.img/vegaselod2.txd/heliconcrete_lod.dds\",\"gta3.img/ce_lod_02.txd/heliconcrete_lod.dds\",\n \"gta3.img/ce_lod_03.txd/bow_church_dirtlod.dds\",\"gta3.img/ce_lod_02.txd/bow_church_dirtlod.dds\",\n \"gta3.img/ce_lod_04.txd/bow_church_dirtlod.dds\",\"gta3.img/ce_lod_02.txd/bow_church_dirtlod.dds\",\n \"gta3.img/ce_lod_05.txd/bow_church_dirtlod.dds\",\"gta3.img/ce_lod_02.txd/bow_church_dirtlod.dds\",\n \"gta3.img/ce_lod_07.txd/bow_church_dirtlod.dds\",\"gta3.img/ce_lod_02.txd/bow_church_dirtlod.dds\",\n \"gta3.img/lodvgsslod.txd/browntinlod.dds\",\"gta3.img/ce_lod_02.txd/browntinlod.dds\",\n \"gta3.img/vegashselod1.txd/browntinlod.dds\",\"gta3.img/ce_lod_02.txd/browntinlod.dds\",\n \"gta3.img/lodvegaswest3.txd/airportmetalwalllod.dds\",\"gta3.img/ce_lod_02.txd/airportmetalwalllod.dds\",\n \"gta3.img/lodvgsslod.txd/airportmetalwalllod.dds\",\"gta3.img/ce_lod_02.txd/airportmetalwalllod.dds\",\n \"gta3.img/lodvegaswest3.txd/vgnwrehselod7.dds\",\"gta3.img/ce_lod_02.txd/vgnwrehselod7.dds\",\n \"gta3.img/lodvgsslod.txd/vgnwrehselod7.dds\",\"gta3.img/ce_lod_02.txd/vgnwrehselod7.dds\",\n \"gta3.img/lodvegaswest3.txd/vgnwrehselod3.dds\",\"gta3.img/ce_lod_02.txd/vgnwrehselod3.dds\",\n \"gta3.img/lodvgsslod.txd/vgnwrehselod3.dds\",\"gta3.img/ce_lod_02.txd/vgnwrehselod3.dds\",\n \"gta3.img/lodvegaswest3.txd/vgnwrehselod2.dds\",\"gta3.img/ce_lod_02.txd/vgnwrehselod2.dds\",\n \"gta3.img/lodvgsslod.txd/vgnwrehselod2.dds\",\"gta3.img/ce_lod_02.txd/vgnwrehselod2.dds\",\n \"gta3.img/lodvegaswest3.txd/vgnwrehselod1.dds\",\"gta3.img/ce_lod_02.txd/vgnwrehselod1.dds\",\n \"gta3.img/lodvgsslod.txd/vgnwrehselod1.dds\",\"gta3.img/ce_lod_02.txd/vgnwrehselod1.dds\",\n \"gta3.img/cs_lod.txd/ws_rooftarmac1lod.dds\",\"gta3.img/ce_lod_02.txd/ws_rooftarmac1lod.dds\",\n \"gta3.img/ealod_law2.txd/ws_rooftarmac1lod.dds\",\"gta3.img/ce_lod_02.txd/ws_rooftarmac1lod.dds\",\n \"gta3.img/laeast2_lod.txd/ws_rooftarmac1lod.dds\",\"gta3.img/ce_lod_02.txd/ws_rooftarmac1lod.dds\",\n \"gta3.img/lahillsa_lod.txd/ws_rooftarmac1lod.dds\",\"gta3.img/ce_lod_02.txd/ws_rooftarmac1lod.dds\",\n \"gta3.img/lahillsa_lodw.txd/ws_rooftarmac1lod.dds\",\"gta3.img/ce_lod_02.txd/ws_rooftarmac1lod.dds\",\n \"gta3.img/lawnlodbig.txd/ws_rooftarmac1lod.dds\",\"gta3.img/ce_lod_02.txd/ws_rooftarmac1lod.dds\",\n \"gta3.img/laxref_lod.txd/ws_rooftarmac1lod.dds\",\"gta3.img/ce_lod_02.txd/ws_rooftarmac1lod.dds\",\n \"gta3.img/lod2lae1.txd/ws_rooftarmac1lod.dds\",\"gta3.img/ce_lod_02.txd/ws_rooftarmac1lod.dds\",\n \"gta3.img/lod_boxhses_sfsx.txd/ws_rooftarmac1lod.dds\",\"gta3.img/ce_lod_02.txd/ws_rooftarmac1lod.dds\",\n \"gta3.img/lod_cn2_stown.txd/ws_rooftarmac1lod.dds\",\"gta3.img/ce_lod_02.txd/ws_rooftarmac1lod.dds\",\n \"gta3.img/lod_countn2.txd/ws_rooftarmac1lod.dds\",\"gta3.img/ce_lod_02.txd/ws_rooftarmac1lod.dds\",\n \"gta3.img/lod_countryn.txd/ws_rooftarmac1lod.dds\",\"gta3.img/ce_lod_02.txd/ws_rooftarmac1lod.dds\",\n \"gta3.img/lod_cxrefhooses.txd/ws_rooftarmac1lod.dds\",\"gta3.img/ce_lod_02.txd/ws_rooftarmac1lod.dds\",\n \"gta3.img/lod_dem_sfxrf.txd/ws_rooftarmac1lod.dds\",\"gta3.img/ce_lod_02.txd/ws_rooftarmac1lod.dds\",\n \"gta3.img/lodhangar_sfsxref.txd/ws_rooftarmac1lod.dds\",\"gta3.img/ce_lod_02.txd/ws_rooftarmac1lod.dds\",\n \"gta3.img/lod_las2.txd/ws_rooftarmac1lod.dds\",\"gta3.img/ce_lod_02.txd/ws_rooftarmac1lod.dds\",\n \"gta3.img/lodlawnsmall.txd/ws_rooftarmac1lod.dds\",\"gta3.img/ce_lod_02.txd/ws_rooftarmac1lod.dds\",\n \"gta3.img/lod_sfs2.txd/ws_rooftarmac1lod.dds\",\"gta3.img/ce_lod_02.txd/ws_rooftarmac1lod.dds\",\n \"gta3.img/lod_sfs3.txd/ws_rooftarmac1lod.dds\",\"gta3.img/ce_lod_02.txd/ws_rooftarmac1lod.dds\",\n \"gta3.img/lod_sfs4.txd/ws_rooftarmac1lod.dds\",\"gta3.img/ce_lod_02.txd/ws_rooftarmac1lod.dds\",\n \"gta3.img/lod_sfse3.txd/ws_rooftarmac1lod.dds\",\"gta3.img/ce_lod_02.txd/ws_rooftarmac1lod.dds\",\n \"gta3.img/lod_sfse69.txd/ws_rooftarmac1lod.dds\",\"gta3.img/ce_lod_02.txd/ws_rooftarmac1lod.dds\",\n \"gta3.img/lod_sfse.txd/ws_rooftarmac1lod.dds\",\"gta3.img/ce_lod_02.txd/ws_rooftarmac1lod.dds\",\n \"gta3.img/lodvegaswest2.txd/ws_rooftarmaclod.dds\",\"gta3.img/ce_lod_02.txd/ws_rooftarmac1lod.dds\",\n \"gta3.img/lodvegaswest2.txd/ws_rooftarmac1lod.dds\",\"gta3.img/ce_lod_02.txd/ws_rooftarmac1lod.dds\",\n \"gta3.img/lodvegaswest3.txd/ws_rooftarmaclod.dds\",\"gta3.img/ce_lod_02.txd/ws_rooftarmac1lod.dds\",\n \"gta3.img/lodvgshangar.txd/ws_rooftarmac1lod.dds\",\"gta3.img/ce_lod_02.txd/ws_rooftarmac1lod.dds\",\n \"gta3.img/lodvgsslod01.txd/ws_rooftarmac1lod.dds\",\"gta3.img/ce_lod_02.txd/ws_rooftarmac1lod.dds\",\n \"gta3.img/lodvgsslod.txd/ws_rooftarmac1lod.dds\",\"gta3.img/ce_lod_02.txd/ws_rooftarmac1lod.dds\",\n \"gta3.img/lodvgsslod.txd/ws_rooftarmaclod.dds\",\"gta3.img/ce_lod_02.txd/ws_rooftarmac1lod.dds\",\n \"gta3.img/vegaselod2.txd/ws_rooftarmac1lod.dds\",\"gta3.img/ce_lod_02.txd/ws_rooftarmac1lod.dds\",\n \"gta3.img/vegasnlod1.txd/ws_rooftarmac1lod.dds\",\"gta3.img/ce_lod_02.txd/ws_rooftarmac1lod.dds\",\n \"gta3.img/vegasnlod2.txd/ws_rooftarmac1lod.dds\",\"gta3.img/ce_lod_02.txd/ws_rooftarmac1lod.dds\",\n \"gta3.img/vegasnlod4.txd/ws_rooftarmac1lod.dds\",\"gta3.img/ce_lod_02.txd/ws_rooftarmac1lod.dds\",\n \"gta3.img/welod_law2.txd/ws_rooftarmac1lod.dds\",\"gta3.img/ce_lod_02.txd/ws_rooftarmac1lod.dds\",\n \"gta3.img/ce_lod_03.txd/pavea256lod.dds\",\"gta3.img/ce_lod_02.txd/pavea256lod.dds\",\n \"gta3.img/lahillsa_lod.txd/concretenewb256lod.dds\",\"gta3.img/ce_lod_02.txd/concretenewb256lod.dds\",\n \"gta3.img/lahillsa_lodw.txd/concretenewb256lod.dds\",\"gta3.img/ce_lod_02.txd/concretenewb256lod.dds\",\n \"gta3.img/lodvegaswest2.txd/sw_brewbricklod.dds\",\"gta3.img/ce_lod_02.txd/sw_brewbrick01lod.dds\",\n \"gta3.img/ce_lod_04.txd/upt_conc=floorcleanlod.dds\",\"gta3.img/ce_lod_02.txd/upt_conc=floorcleanlod.dds\",\n \"gta3.img/lahillsa_lodw.txd/upt_conc=floorcleanlod.dds\",\"gta3.img/ce_lod_02.txd/upt_conc=floorcleanlod.dds\",\n \"gta3.img/ce_lod_03.txd/bow_abattoir_conc2lod.dds\",\"gta3.img/ce_lod_02.txd/bow_abattoir_conc2lod.dds\",\n \"gta3.img/ce_lod_04.txd/bow_abattoir_conc2lod.dds\",\"gta3.img/ce_lod_02.txd/bow_abattoir_conc2lod.dds\",\n \"gta3.img/ce_lod_05.txd/bow_abattoir_conc2lod.dds\",\"gta3.img/ce_lod_02.txd/bow_abattoir_conc2lod.dds\",\n \"gta3.img/lahillsa_lodw.txd/bow_abattoir_conc2lod.dds\",\"gta3.img/ce_lod_02.txd/bow_abattoir_conc2lod.dds\",\n \"gta3.img/lahills_lod.txd/bow_abattoir_conc2lod.dds\",\"gta3.img/ce_lod_02.txd/bow_abattoir_conc2lod.dds\",\n \"gta3.img/ce_lod_04.txd/cw2_mountdirtlod.dds\",\"gta3.img/ce_lod_02.txd/cw2_mountdirtlod.dds\",\n \"gta3.img/ce_lod_07.txd/cw2_mountdirtlod.dds\",\"gta3.img/ce_lod_02.txd/cw2_mountdirtlod.dds\",\n \"gta3.img/ce_lod_07.txd/cw2_mountdirt2grasslod.dds\",\"gta3.img/ce_lod_02.txd/cw2_mountdirt2grasslod.dds\",\n \"gta3.img/cs_lod_town.txd/cw2_photoroof_lod.dds\",\"gta3.img/ce_lod_03.txd/cw2_photoroof_lod.dds\",\n \"gta3.img/cs_lod_town.txd/cw2_photoblock01_lod.dds\",\"gta3.img/ce_lod_03.txd/cw2_photoblock01_lod.dds\",\n \"gta3.img/cs_lod_town.txd/cw2_wtownblok1_lod.dds\",\"gta3.img/ce_lod_03.txd/cw2_wtownblok1_lod.dds\",\n \"gta3.img/lod2lae1.txd/sjmlaelod93.dds\",\"gta3.img/ce_lod_03.txd/sjmlaelod93.dds\",\n \"gta3.img/gangholod1_lax.txd/ws_roof_lod.dds\",\"gta3.img/ce_lod_03.txd/ws_roof_lod.dds\",\n \"gta3.img/laeast2_lod.txd/ws_roof_lod.dds\",\"gta3.img/ce_lod_03.txd/ws_roof_lod.dds\",\n \"gta3.img/lod2lae1.txd/ws_roof_lod.dds\",\"gta3.img/ce_lod_03.txd/ws_roof_lod.dds\",\n \"gta3.img/lod_a_law.txd/ws_roof_lod.dds\",\"gta3.img/ce_lod_03.txd/ws_roof_lod.dds\",\n \"gta3.img/lod_cn2_stown.txd/ws_roof_lod.dds\",\"gta3.img/ce_lod_03.txd/ws_roof_lod.dds\",\n \"gta3.img/lod_las2.txd/ws_roof_lod.dds\",\"gta3.img/ce_lod_03.txd/ws_roof_lod.dds\",\n \"gta3.img/welod_law2.txd/ws_roof_lod.dds\",\"gta3.img/ce_lod_03.txd/ws_roof_lod.dds\",\n \"gta3.img/lod_las2.txd/lod_bowabatconc2.dds\",\"gta3.img/ce_lod_03.txd/lod_bowabatconc2.dds\",\n \"gta3.img/ce_lod_04.txd/newall3_16c128lod.dds\",\"gta3.img/ce_lod_03.txd/newall3_16c128lod.dds\",\n \"gta3.img/ce_lod_04.txd/concretemanky_lod.dds\",\"gta3.img/ce_lod_03.txd/concretemanky_lod.dds\",\n \"gta3.img/lahillsa_lodw.txd/concretemanky_lod.dds\",\"gta3.img/ce_lod_03.txd/concretemanky_lod.dds\",\n \"gta3.img/lod2_las.txd/concretemanky_lod.dds\",\"gta3.img/ce_lod_03.txd/concretemanky_lod.dds\",\n \"gta3.img/lod_cn2_stown.txd/concretemanky_lod.dds\",\"gta3.img/ce_lod_03.txd/concretemanky_lod.dds\",\n \"gta3.img/lodlawnsmall.txd/concretemanky_lod.dds\",\"gta3.img/ce_lod_03.txd/concretemanky_lod.dds\",\n \"gta3.img/lodvgsslod.txd/concretemanky_lod.dds\",\"gta3.img/ce_lod_03.txd/concretemanky_lod.dds\",\n \"gta3.img/vegaselod2.txd/concretemanky_lod.dds\",\"gta3.img/ce_lod_03.txd/concretemanky_lod.dds\",\n \"gta3.img/vegaselod3.txd/concretemanky_lod.dds\",\"gta3.img/ce_lod_03.txd/concretemanky_lod.dds\",\n \"gta3.img/ce_lod_05.txd/dirtywall_256lod.dds\",\"gta3.img/ce_lod_03.txd/dirtywall_256lod.dds\",\n \"gta3.img/ce_lod_07.txd/dirtywall_256lod.dds\",\"gta3.img/ce_lod_03.txd/dirtywall_256lod.dds\",\n \"gta3.img/ce_lod_04.txd/ce_4laneverge.dds\",\"gta3.img/ce_lod_03.txd/ce_4laneverge.dds\",\n \"gta3.img/ce_lod_05.txd/ce_4laneverge.dds\",\"gta3.img/ce_lod_03.txd/ce_4laneverge.dds\",\n \"gta3.img/lahills_lod.txd/ce_4laneverge.dds\",\"gta3.img/ce_lod_03.txd/ce_4laneverge.dds\",\n \"gta3.img/ce_lod_07.txd/conc_wall_stripxlod.dds\",\"gta3.img/ce_lod_03.txd/conc_wall_stripxlod.dds\",\n \"gta3.img/lahillsa_lodw.txd/conc_wall_stripxlod.dds\",\"gta3.img/ce_lod_03.txd/conc_wall_stripxlod.dds\",\n \"gta3.img/ce_lod_07.txd/desertgryard256grs2lod.dds\",\"gta3.img/ce_lod_04.txd/desertgryard256grs2lod.dds\",\n \"gta3.img/ce_lod_07.txd/gen_scrap_wheel_rimlod.dds\",\"gta3.img/ce_lod_04.txd/gen_scrap_wheel_rimlod.dds\",\n \"gta3.img/ce_lod_07.txd/rustyboltslod.dds\",\"gta3.img/ce_lod_04.txd/rustyboltslod.dds\",\n \"gta3.img/lahillsa_lod.txd/2laneverge.dds\",\"gta3.img/ce_lod_04.txd/2laneverge.dds\",\n \"gta3.img/cunte_farmlod.txd/backstageceiling1_128lod.dds\",\"gta3.img/ce_lod_04.txd/backstageceiling1_128lod.dds\",\n \"gta3.img/lahillsa_lod.txd/backstageceiling1_128lod.dds\",\"gta3.img/ce_lod_04.txd/backstageceiling1_128lod.dds\",\n \"gta3.img/lahillsa_lod.txd/greypavroadlod.dds\",\"gta3.img/ce_lod_04.txd/greypavroadlod.dds\",\n \"gta3.img/lahillsa_lod.txd/stormdrain2_ntlod.dds\",\"gta3.img/ce_lod_04.txd/stormdrain2_ntlod.dds\",\n \"gta3.img/lod_countryn.txd/stormdrain2_ntlod.dds\",\"gta3.img/ce_lod_04.txd/stormdrain2_ntlod.dds\",\n \"gta3.img/ce_lod_05.txd/sw_warewall2lod.dds\",\"gta3.img/ce_lod_04.txd/sw_warewall2lod.dds\",\n \"gta3.img/ce_lod_05.txd/sw_tunnel02bmplod.dds\",\"gta3.img/ce_lod_04.txd/sw_tunnel02bmplod.dds\",\n \"gta3.img/lod2lae1.txd/sw_tunnel02bmplod.dds\",\"gta3.img/ce_lod_04.txd/sw_tunnel02bmplod.dds\",\n \"gta3.img/ce_lod_05.txd/sw_tunnel01lod.dds\",\"gta3.img/ce_lod_04.txd/sw_tunnel01lod.dds\",\n \"gta3.img/lod2lae1.txd/sw_tunnel01lod.dds\",\"gta3.img/ce_lod_04.txd/sw_tunnel01lod.dds\",\n \"gta3.img/lodvegaswest1.txd/lod_tunnel01.dds\",\"gta3.img/ce_lod_04.txd/sw_tunnel01lod.dds\",\n \"gta3.img/ce_lod_05.txd/cunte_traintraxx2.dds\",\"gta3.img/ce_lod_04.txd/cunte_traintraxx2.dds\",\n \"gta3.img/lod2lae1.txd/cunte_traintraxx2.dds\",\"gta3.img/ce_lod_04.txd/cunte_traintraxx2.dds\",\n \"gta3.img/ce_lod_05.txd/fourlanefreeway.dds\",\"gta3.img/ce_lod_04.txd/fourlanefreeway.dds\",\n \"gta3.img/lahills_lod.txd/fourlanefreeway.dds\",\"gta3.img/ce_lod_04.txd/fourlanefreeway.dds\",\n \"gta3.img/ce_lod_05.txd/desclifftypebsmixlod.dds\",\"gta3.img/ce_lod_04.txd/desclifftypebsmixlod.dds\",\n \"gta3.img/lahillsa_lod.txd/desclifftypebsmixlod.dds\",\"gta3.img/ce_lod_04.txd/desclifftypebsmixlod.dds\",\n \"gta3.img/ce_lod_05.txd/sw_sandlod.dds\",\"gta3.img/ce_lod_04.txd/sw_sandlod.dds\",\n \"gta3.img/ce_lod_07.txd/sw_sandlod.dds\",\"gta3.img/ce_lod_04.txd/sw_sandlod.dds\",\n \"gta3.img/lod_las2.txd/sw_sandlod.dds\",\"gta3.img/ce_lod_04.txd/sw_sandlod.dds\",\n \"gta3.img/ce_lod_05.txd/sw_sandgrasslod.dds\",\"gta3.img/ce_lod_04.txd/sw_sandgrasslod.dds\",\n \"gta3.img/ce_lod_07.txd/sw_sandgrasslod.dds\",\"gta3.img/ce_lod_04.txd/sw_sandgrasslod.dds\",\n \"gta3.img/ce_lod_07.txd/sw_rock1lod.dds\",\"gta3.img/ce_lod_05.txd/sw_rock1lod.dds\",\n \"gta3.img/lahillsa_lodw.txd/concretewall22_256lod.dds\",\"gta3.img/ce_lod_05.txd/concretewall22_256lod.dds\",\n \"gta3.img/lahills_lod.txd/concretewall22_256lod.dds\",\"gta3.img/ce_lod_05.txd/concretewall22_256lod.dds\",\n \"gta3.img/lahillsa_lod.txd/retainwall1lod.dds\",\"gta3.img/ce_lod_05.txd/retainwall1lod.dds\",\n \"gta3.img/lod3_las.txd/retainwall1_lod.dds\",\"gta3.img/ce_lod_05.txd/retainwall1lod.dds\",\n \"gta3.img/lod_countryn.txd/retainwall1lod.dds\",\"gta3.img/ce_lod_05.txd/retainwall1lod.dds\",\n \"gta3.img/lod_sfs2.txd/retainwall1_lod.dds\",\"gta3.img/ce_lod_05.txd/retainwall1lod.dds\",\n \"gta3.img/lahillsa_lodw.txd/tar_1linefreewylod.dds\",\"gta3.img/ce_lod_07.txd/tar_1linefreewylod.dds\",\n \"gta3.img/lahills_lod.txd/tar_1linefreewylod.dds\",\"gta3.img/ce_lod_07.txd/tar_1linefreewylod.dds\",\n \"gta3.img/lod_countryn.txd/tar_1linefreewylod.dds\",\"gta3.img/ce_lod_07.txd/tar_1linefreewylod.dds\",\n \"gta3.img/lahillsa_lod.txd/grassdead1blndlod.dds\",\"gta3.img/ce_lod_07.txd/grassdead1blndlod.dds\",\n \"gta3.img/lahills_lod.txd/grassdead1blndlod.dds\",\"gta3.img/ce_lod_07.txd/grassdead1blndlod.dds\",\n \"gta3.img/lahillsa_lod.txd/grassdead1lod.dds\",\"gta3.img/ce_lod_07.txd/grassdead1lod.dds\",\n \"gta3.img/lahillsa_lodw.txd/grassdead1lod.dds\",\"gta3.img/ce_lod_07.txd/grassdead1lod.dds\",\n \"gta3.img/lahillsa_lodw.txd/grassbrn2rockbrnlod.dds\",\"gta3.img/ce_lod_07.txd/grassbrn2rockbrnlod.dds\",\n \"gta3.img/lod_countryn.txd/grassbrn2rockbrnlod.dds\",\"gta3.img/ce_lod_07.txd/grassbrn2rockbrnlod.dds\",\n \"gta3.img/lahillsa_lod.txd/sw_rockgrassb2lod.dds\",\"gta3.img/ce_lod_07.txd/sw_rockgrassb2lod.dds\",\n \"gta3.img/lahillsa_lodw.txd/sw_rockgrassb2lod.dds\",\"gta3.img/ce_lod_07.txd/sw_rockgrassb2lod.dds\",\n \"gta3.img/lahills_lod.txd/sw_rockgrassb2lod.dds\",\"gta3.img/ce_lod_07.txd/sw_rockgrassb2lod.dds\",\n \"gta3.img/lahillsa_lod.txd/lostonclad1lod.dds\",\"gta3.img/ce_lod_07.txd/lostonclad1lod.dds\",\n \"gta3.img/lahillsa_lod.txd/gravelkb2_128lod.dds\",\"gta3.img/ce_lod_07.txd/gravelkb2_128lod.dds\",\n \"gta3.img/lahillsa_lod.txd/des_ranchwall1lod.dds\",\"gta3.img/ce_lod_07.txd/des_ranchwall1lod.dds\",\n \"gta3.img/lod_countryn.txd/des_ranchwall1lod.dds\",\"gta3.img/ce_lod_07.txd/des_ranchwall1lod.dds\",\n \"gta3.img/lahillsa_lod.txd/redbrickground256lod.dds\",\"gta3.img/ce_lod_07.txd/redbrickground256lod.dds\",\n \"gta3.img/lahills_lod.txd/redbrickground256lod.dds\",\"gta3.img/ce_lod_07.txd/redbrickground256lod.dds\",\n \"gta3.img/lahillsa_lodw.txd/desmudtrail2lod.dds\",\"gta3.img/ce_lod_07.txd/desmudtrail2lod.dds\",\n \"gta3.img/lahills_lod.txd/desmudtrail2lod.dds\",\"gta3.img/ce_lod_07.txd/desmudtrail2lod.dds\",\n \"gta3.img/dumper.txd/dumper92logo.dds\",\"gta3.img/cement.txd/cement92logo.dds\",\n \"gta3.img/civic01_lan.txd/brickgrey.dds\",\"gta3.img/cemetery_law.txd/brickgrey.dds\",\n \"gta3.img/chateau_lawn.txd/ppinkwallb512.dds\",\"gta3.img/cemetery_law.txd/ppinkwallb512.dds\",\n \"gta3.img/cw_truckstopcs_t.txd/ppinkwallb512.dds\",\"gta3.img/cemetery_law.txd/ppinkwallb512.dds\",\n \"gta3.img/des_factory.txd/ppinkwallb512.dds\",\"gta3.img/cemetery_law.txd/ppinkwallb512.dds\",\n \"gta3.img/des_nstuff.txd/ppinkwallb512.dds\",\"gta3.img/cemetery_law.txd/ppinkwallb512.dds\",\n \"gta3.img/industry3_las2.txd/hottop6_law.dds\",\"gta3.img/cemetery_law.txd/hottop6_law.dds\",\n \"gta3.img/lawnest2.txd/grave01_law.dds\",\"gta3.img/cemetery_law.txd/grave01_law.dds\",\n \"gta3.img/levdes01_lawn.txd/grave01_law.dds\",\"gta3.img/cemetery_law.txd/grave01_law.dds\",\n \"gta3.img/cemetint_law.txd/churcharch_law.dds\",\"gta3.img/cemetery_law.txd/churcharch_law.dds\",\n \"gta3.img/lawnest2.txd/mauswall03_law.dds\",\"gta3.img/cemetery_law.txd/mauswall03_law.dds\",\n \"gta3.img/lawnest2.txd/mauswall02_law.dds\",\"gta3.img/cemetery_law.txd/mauswall02_law.dds\",\n \"gta3.img/mulhousclahills.txd/mauswall02_law.dds\",\"gta3.img/cemetery_law.txd/mauswall02_law.dds\",\n \"gta3.img/sjmla_las.txd/mauswall02_law.dds\",\"gta3.img/cemetery_law.txd/mauswall02_law.dds\",\n \"gta3.img/lawnest2.txd/mausdoor01_law.dds\",\"gta3.img/cemetery_law.txd/mausdoor01_law.dds\",\n \"gta3.img/cemetint_law.txd/mauswall01_law.dds\",\"gta3.img/cemetery_law.txd/mauswall01_law.dds\",\n \"gta3.img/lawnest2.txd/mauswall01_law.dds\",\"gta3.img/cemetery_law.txd/mauswall01_law.dds\",\n \"gta3.img/prop_pizzabox.txd/pizzabox.dds\",\"gta3.img/cemetint_law.txd/pizzabox.dds\",\n \"gta_int.img/cj_ss_2.txd/pizzabox.dds\",\"gta3.img/cemetint_law.txd/pizzabox.dds\",\n \"gta_int.img/genintgeneric.txd/kbtree4_test.dds\",\"gta3.img/centralresac1.txd/kbtree4_test.dds\",\n \"gta_int.img/plants.txd/kbtree4_test.dds\",\"gta3.img/centralresac1.txd/kbtree4_test.dds\",\n \"gta3.img/vgndwntwn22.txd/hedge2_128.dds\",\"gta3.img/centralresac1.txd/hedge2_128.dds\",\n \"gta3.img/des_ranch.txd/gen_scrap_wheel_rim.dds\",\"gta3.img/ce_oldbridge.txd/gen_scrap_wheel_rim.dds\",\n \"gta3.img/jettycw.txd/gen_scrap_wheel_rim.dds\",\"gta3.img/ce_oldbridge.txd/gen_scrap_wheel_rim.dds\",\n \"gta3.img/lanriver.txd/gen_scrap_wheel_rim.dds\",\"gta3.img/ce_oldbridge.txd/gen_scrap_wheel_rim.dds\",\n \"gta3.img/cxref_oldwest.txd/gen_rusty_poll.dds\",\"gta3.img/ce_oldbridge.txd/gen_rusty_poll.dds\",\n \"gta3.img/des_xoilfield.txd/gen_rusty_poll.dds\",\"gta3.img/ce_oldbridge.txd/gen_rusty_poll.dds\",\n \"gta3.img/farmstuff.txd/gen_rusty_poll.dds\",\"gta3.img/ce_oldbridge.txd/gen_rusty_poll.dds\",\n \"gta3.img/minex.txd/gen_rusty_poll.dds\",\"gta3.img/ce_oldbridge.txd/gen_rusty_poll.dds\",\n \"gta3.img/oldwest.txd/gen_rusty_poll.dds\",\"gta3.img/ce_oldbridge.txd/gen_rusty_poll.dds\",\n \"gta3.img/sw_oldshack.txd/gen_rusty_poll.dds\",\"gta3.img/ce_oldbridge.txd/gen_rusty_poll.dds\",\n \"gta3.img/sw_smlfarm.txd/gen_rusty_poll.dds\",\"gta3.img/ce_oldbridge.txd/gen_rusty_poll.dds\",\n \"gta3.img/immcrax.txd/banding8_64.dds\",\"gta3.img/ce_oldbridge.txd/banding8_64.dds\",\n \"gta3.img/ceroadsigns.txd/stormdrain3_nt.dds\",\"gta3.img/ce_oldbridge.txd/stormdrain3_nt.dds\",\n \"gta3.img/civic01_lan.txd/stormdrain3_nt.dds\",\"gta3.img/ce_oldbridge.txd/stormdrain3_nt.dds\",\n \"gta3.img/civic06_lan.txd/stormdrain3_nt.dds\",\"gta3.img/ce_oldbridge.txd/stormdrain3_nt.dds\",\n \"gta3.img/cn_nwbrigstuff.txd/stormdrain3_nt.dds\",\"gta3.img/ce_oldbridge.txd/stormdrain3_nt.dds\",\n \"gta3.img/councl_law2.txd/stormdrain3_nt.dds\",\"gta3.img/ce_oldbridge.txd/stormdrain3_nt.dds\",\n \"gta3.img/desn2_stud.txd/stormdrain3_nt.dds\",\"gta3.img/ce_oldbridge.txd/stormdrain3_nt.dds\",\n \"gta3.img/des_nw2.txd/stormdrain3_nt.dds\",\"gta3.img/ce_oldbridge.txd/stormdrain3_nt.dds\",\n \"gta3.img/ebeachcineblok.txd/stormdrain3_nt.dds\",\"gta3.img/ce_oldbridge.txd/stormdrain3_nt.dds\",\n \"gta3.img/fighot.txd/stormdrain3_nt.dds\",\"gta3.img/ce_oldbridge.txd/stormdrain3_nt.dds\",\n \"gta3.img/glenpark6d_lae.txd/stormdrain3_nt.dds\",\"gta3.img/ce_oldbridge.txd/stormdrain3_nt.dds\",\n \"gta3.img/glenpark6_lae.txd/stormdrain3_nt.dds\",\"gta3.img/ce_oldbridge.txd/stormdrain3_nt.dds\",\n \"gta3.img/hrbr_sfn.txd/stormdrain3_nt.dds\",\"gta3.img/ce_oldbridge.txd/stormdrain3_nt.dds\",\n \"gta3.img/lae2roads.txd/stormdrain3_nt.dds\",\"gta3.img/ce_oldbridge.txd/stormdrain3_nt.dds\",\n \"gta3.img/lanriver.txd/stormdrain3_nt.dds\",\"gta3.img/ce_oldbridge.txd/stormdrain3_nt.dds\",\n \"gta3.img/lanroad.txd/stormdrain3_nt.dds\",\"gta3.img/ce_oldbridge.txd/stormdrain3_nt.dds\",\n \"gta3.img/law2_roadsb.txd/stormdrain3_nt.dds\",\"gta3.img/ce_oldbridge.txd/stormdrain3_nt.dds\",\n \"gta3.img/law_doontoon.txd/stormdrain3_nt.dds\",\"gta3.img/ce_oldbridge.txd/stormdrain3_nt.dds\",\n \"gta3.img/lomall.txd/stormdrain3_nt.dds\",\"gta3.img/ce_oldbridge.txd/stormdrain3_nt.dds\",\n \"gta3.img/melrose11_lawn.txd/stormdrain3_nt.dds\",\"gta3.img/ce_oldbridge.txd/stormdrain3_nt.dds\",\n \"gta3.img/pierc_law2.txd/stormdrain3_nt.dds\",\"gta3.img/ce_oldbridge.txd/stormdrain3_nt.dds\",\n \"gta3.img/railtracklae.txd/stormdrain3_nt.dds\",\"gta3.img/ce_oldbridge.txd/stormdrain3_nt.dds\",\n \"gta3.img/roads_lahills.txd/stormdrain3_nt.dds\",\"gta3.img/ce_oldbridge.txd/stormdrain3_nt.dds\",\n \"gta3.img/stapl.txd/stormdrain3_nt.dds\",\"gta3.img/ce_oldbridge.txd/stormdrain3_nt.dds\",\n \"gta3.img/sw_roadgas.txd/stormdrain3_nt.dds\",\"gta3.img/ce_oldbridge.txd/stormdrain3_nt.dds\",\n \"gta3.img/venice_law.txd/stormdrain3_nt.dds\",\"gta3.img/ce_oldbridge.txd/stormdrain3_nt.dds\",\n \"gta_int.img/genintint711_1.txd/stormdrain3_nt.dds\",\"gta3.img/ce_oldbridge.txd/stormdrain3_nt.dds\",\n \"gta3.img/cxrf_payspray.txd/spraypipegz1.dds\",\"gta3.img/ce_payspray.txd/spraypipegz1.dds\",\n \"gta3.img/lvse_spray1.txd/spraypipegz1.dds\",\"gta3.img/ce_payspray.txd/spraypipegz1.dds\",\n \"gta3.img/paynspray_lae.txd/spraypipegz1.dds\",\"gta3.img/ce_payspray.txd/spraypipegz1.dds\",\n \"gta3.img/sfe_spray1.txd/spraypipegz1.dds\",\"gta3.img/ce_payspray.txd/spraypipegz1.dds\",\n \"gta3.img/sprayshp_sfse.txd/spraypipegz1.dds\",\"gta3.img/ce_payspray.txd/spraypipegz1.dds\",\n \"gta3.img/vegasbuild.txd/spraypipegz1.dds\",\"gta3.img/ce_payspray.txd/spraypipegz1.dds\",\n \"gta3.img/cxrf_payspray.txd/airvent2_128.dds\",\"gta3.img/ce_payspray.txd/airvent2_128.dds\",\n \"gta3.img/lvse_spray1.txd/airvent2_128.dds\",\"gta3.img/ce_payspray.txd/airvent2_128.dds\",\n \"gta3.img/paynspray_lae.txd/airvent2_128.dds\",\"gta3.img/ce_payspray.txd/airvent2_128.dds\",\n \"gta3.img/sfe_spray1.txd/airvent2_128.dds\",\"gta3.img/ce_payspray.txd/airvent2_128.dds\",\n \"gta3.img/sprayshp_sfse.txd/airvent2_128.dds\",\"gta3.img/ce_payspray.txd/airvent2_128.dds\",\n \"gta3.img/vegasbuild.txd/airvent2_128.dds\",\"gta3.img/ce_payspray.txd/airvent2_128.dds\",\n \"gta3.img/cxrf_payspray.txd/sf_spray_floor2.dds\",\"gta3.img/ce_payspray.txd/sf_spray_floor2.dds\",\n \"gta3.img/lvse_spray1.txd/sf_spray_floor2.dds\",\"gta3.img/ce_payspray.txd/sf_spray_floor2.dds\",\n \"gta3.img/paynspray_lae.txd/sf_spray_floor2.dds\",\"gta3.img/ce_payspray.txd/sf_spray_floor2.dds\",\n \"gta3.img/sfe_spray1.txd/sf_spray_floor2.dds\",\"gta3.img/ce_payspray.txd/sf_spray_floor2.dds\",\n \"gta3.img/sprayshp_sfse.txd/sf_spray_floor2.dds\",\"gta3.img/ce_payspray.txd/sf_spray_floor2.dds\",\n \"gta3.img/vegasbuild.txd/sf_spray_floor2.dds\",\"gta3.img/ce_payspray.txd/sf_spray_floor2.dds\",\n \"gta3.img/vgsespras.txd/sf_spray_floor2.dds\",\"gta3.img/ce_payspray.txd/sf_spray_floor2.dds\",\n \"gta3.img/cxrf_payspray.txd/sf_spray_floor1.dds\",\"gta3.img/ce_payspray.txd/sf_spray_floor1.dds\",\n \"gta3.img/lvse_spray1.txd/sf_spray_floor1.dds\",\"gta3.img/ce_payspray.txd/sf_spray_floor1.dds\",\n \"gta3.img/paynspray_lae.txd/sf_spray_floor1.dds\",\"gta3.img/ce_payspray.txd/sf_spray_floor1.dds\",\n \"gta3.img/sfe_spray1.txd/sf_spray_floor1.dds\",\"gta3.img/ce_payspray.txd/sf_spray_floor1.dds\",\n \"gta3.img/sprayshp_sfse.txd/sf_spray_floor1.dds\",\"gta3.img/ce_payspray.txd/sf_spray_floor1.dds\",\n \"gta3.img/vegasbuild.txd/sf_spray_floor1.dds\",\"gta3.img/ce_payspray.txd/sf_spray_floor1.dds\",\n \"gta3.img/cxrf_payspray.txd/sf_spray3.dds\",\"gta3.img/ce_payspray.txd/sf_spray3.dds\",\n \"gta3.img/lvse_spray1.txd/sf_spray3.dds\",\"gta3.img/ce_payspray.txd/sf_spray3.dds\",\n \"gta3.img/paynspray_lae.txd/sf_spray3.dds\",\"gta3.img/ce_payspray.txd/sf_spray3.dds\",\n \"gta3.img/sfe_spray1.txd/sf_spray3.dds\",\"gta3.img/ce_payspray.txd/sf_spray3.dds\",\n \"gta3.img/sprayshp_sfse.txd/sf_spray3.dds\",\"gta3.img/ce_payspray.txd/sf_spray3.dds\",\n \"gta3.img/vegasbuild.txd/sf_spray3.dds\",\"gta3.img/ce_payspray.txd/sf_spray3.dds\",\n \"gta3.img/cxrf_payspray.txd/sf_spray2.dds\",\"gta3.img/ce_payspray.txd/sf_spray2.dds\",\n \"gta3.img/lvse_spray1.txd/sf_spray2.dds\",\"gta3.img/ce_payspray.txd/sf_spray2.dds\",\n \"gta3.img/paynspray_lae.txd/sf_spray2.dds\",\"gta3.img/ce_payspray.txd/sf_spray2.dds\",\n \"gta3.img/sfe_spray1.txd/sf_spray2.dds\",\"gta3.img/ce_payspray.txd/sf_spray2.dds\",\n \"gta3.img/sprayshp_sfse.txd/sf_spray2.dds\",\"gta3.img/ce_payspray.txd/sf_spray2.dds\",\n \"gta3.img/vegasbuild.txd/sf_spray2.dds\",\"gta3.img/ce_payspray.txd/sf_spray2.dds\",\n \"gta3.img/vgsespras.txd/sf_spray2.dds\",\"gta3.img/ce_payspray.txd/sf_spray2.dds\",\n \"gta3.img/sw_sheds.txd/sw_shedwall03.dds\",\"gta3.img/ce_payspray.txd/sw_shedwall03.dds\",\n \"gta3.img/cunte_gas01.txd/sw_door11.dds\",\"gta3.img/ce_payspray.txd/sw_door11.dds\",\n \"gta3.img/desn2_truckstop.txd/sw_door11.dds\",\"gta3.img/ce_payspray.txd/sw_door11.dds\",\n \"gta3.img/libhelipad_lan2.txd/sw_door11.dds\",\"gta3.img/ce_payspray.txd/sw_door11.dds\",\n \"gta3.img/sw_sheds.txd/sw_door11.dds\",\"gta3.img/ce_payspray.txd/sw_door11.dds\",\n \"gta3.img/sw_ware01.txd/sw_door11.dds\",\"gta3.img/ce_payspray.txd/sw_door11.dds\",\n \"gta3.img/vgnabatoir.txd/sw_door11.dds\",\"gta3.img/ce_payspray.txd/sw_door11.dds\",\n \"gta3.img/cw2_photoblockcs_t.txd/lampost_16clr.dds\",\"gta3.img/cephotoblockcs_t.txd/lampost_16clr.dds\",\n \"gta3.img/dkcargoshp_las2.txd/lampost_16clr.dds\",\"gta3.img/cephotoblockcs_t.txd/lampost_16clr.dds\",\n \"gta3.img/dynsigns.txd/lampost_16clr.dds\",\"gta3.img/cephotoblockcs_t.txd/lampost_16clr.dds\",\n \"gta3.img/dyntraffic.txd/lampost_16clr.dds\",\"gta3.img/cephotoblockcs_t.txd/lampost_16clr.dds\",\n \"gta3.img/gay_xref.txd/lampost_16clr.dds\",\"gta3.img/cephotoblockcs_t.txd/lampost_16clr.dds\",\n \"gta3.img/vgnlpost.txd/lampost_16clr.dds\",\"gta3.img/cephotoblockcs_t.txd/lampost_16clr.dds\",\n \"gta3.img/cunte_bar1.txd/sw_wind23.dds\",\"gta3.img/cephotoblockcs_t.txd/sw_wind23.dds\",\n \"gta3.img/cunte_town1.txd/sw_wind23.dds\",\"gta3.img/cephotoblockcs_t.txd/sw_wind23.dds\",\n \"gta3.img/fishwarf.txd/sw_wind23.dds\",\"gta3.img/cephotoblockcs_t.txd/sw_wind23.dds\",\n \"gta3.img/cewrehse.txd/sw_door16.dds\",\"gta3.img/cephotoblockcs_t.txd/sw_door16.dds\",\n \"gta3.img/jeffers5a_lae.txd/sw_door16.dds\",\"gta3.img/cephotoblockcs_t.txd/sw_door16.dds\",\n \"gta3.img/skyscrapelawn.txd/sw_door16.dds\",\"gta3.img/cephotoblockcs_t.txd/sw_door16.dds\",\n \"gta3.img/sw_apartflat.txd/sw_door16.dds\",\"gta3.img/cephotoblockcs_t.txd/sw_door16.dds\",\n \"gta3.img/sw_block09.txd/sw_door16.dds\",\"gta3.img/cephotoblockcs_t.txd/sw_door16.dds\",\n \"gta3.img/sw_fact02.txd/sw_door16.dds\",\"gta3.img/cephotoblockcs_t.txd/sw_door16.dds\",\n \"gta3.img/sw_office.txd/sw_door16.dds\",\"gta3.img/cephotoblockcs_t.txd/sw_door16.dds\",\n \"gta3.img/w_town3cs_t.txd/sw_door16.dds\",\"gta3.img/cephotoblockcs_t.txd/sw_door16.dds\",\n \"gta3.img/cluckbell_sfs.txd/alleydoor3.dds\",\"gta3.img/cephotoblockcs_t.txd/alleydoor3.dds\",\n \"gta3.img/cunts_gunclub.txd/alleydoor3.dds\",\"gta3.img/cephotoblockcs_t.txd/alleydoor3.dds\",\n \"gta3.img/cw_truckstopcs_t.txd/alleydoor3.dds\",\"gta3.img/cephotoblockcs_t.txd/alleydoor3.dds\",\n \"gta3.img/des_gunclub.txd/alleydoor3.dds\",\"gta3.img/cephotoblockcs_t.txd/alleydoor3.dds\",\n \"gta3.img/desn_truckstop.txd/alleydoor3.dds\",\"gta3.img/cephotoblockcs_t.txd/alleydoor3.dds\",\n \"gta3.img/des_stownmain2.txd/alleydoor3.dds\",\"gta3.img/cephotoblockcs_t.txd/alleydoor3.dds\",\n \"gta3.img/des_stownstrip2.txd/alleydoor3.dds\",\"gta3.img/cephotoblockcs_t.txd/alleydoor3.dds\",\n \"gta3.img/downtown_las.txd/alleydoor3.dds\",\"gta3.img/cephotoblockcs_t.txd/alleydoor3.dds\",\n \"gta3.img/sunrise01_lawn.txd/alleydoor3.dds\",\"gta3.img/cephotoblockcs_t.txd/alleydoor3.dds\",\n \"gta3.img/sunset02_law2.txd/alleydoor3.dds\",\"gta3.img/cephotoblockcs_t.txd/alleydoor3.dds\",\n \"gta3.img/sw_library.txd/alleydoor3.dds\",\"gta3.img/cephotoblockcs_t.txd/alleydoor3.dds\",\n \"gta3.img/vgnfrates.txd/alleydoor3.dds\",\"gta3.img/cephotoblockcs_t.txd/alleydoor3.dds\",\n \"gta3.img/vgnmall.txd/alleydoor3.dds\",\"gta3.img/cephotoblockcs_t.txd/alleydoor3.dds\",\n \"gta3.img/vgnptrlpmp.txd/alleydoor3.dds\",\"gta3.img/cephotoblockcs_t.txd/alleydoor3.dds\",\n \"gta3.img/vgnretail6.txd/alleydoor3.dds\",\"gta3.img/cephotoblockcs_t.txd/alleydoor3.dds\",\n \"gta3.img/vgnshambild1.txd/alleydoor3.dds\",\"gta3.img/cephotoblockcs_t.txd/alleydoor3.dds\",\n \"gta3.img/vgsewrehse.txd/alleydoor3.dds\",\"gta3.img/cephotoblockcs_t.txd/alleydoor3.dds\",\n \"gta3.img/vgslowbuild.txd/alleydoor3.dds\",\"gta3.img/cephotoblockcs_t.txd/alleydoor3.dds\",\n \"gta3.img/vgsmall.txd/alleydoor3.dds\",\"gta3.img/cephotoblockcs_t.txd/alleydoor3.dds\",\n \"gta3.img/vgsswarehse02.txd/alleydoor3.dds\",\"gta3.img/cephotoblockcs_t.txd/alleydoor3.dds\",\n \"gta3.img/wasteland_las2.txd/alleydoor3.dds\",\"gta3.img/cephotoblockcs_t.txd/alleydoor3.dds\",\n \"gta3.img/w_town3cs_t.txd/alleydoor3.dds\",\"gta3.img/cephotoblockcs_t.txd/alleydoor3.dds\",\n \"gta3.img/lawnbit.txd/wallwashv128.dds\",\"gta3.img/cephotoblockcs_t.txd/wallwashv128.dds\",\n \"gta3.img/sfn_helipad.txd/wallwashv128.dds\",\"gta3.img/cephotoblockcs_t.txd/wallwashv128.dds\",\n \"gta3.img/smallertxd.txd/wallwashv128.dds\",\"gta3.img/cephotoblockcs_t.txd/wallwashv128.dds\",\n \"gta3.img/cunte_bar1.txd/sw_wall_05.dds\",\"gta3.img/cephotoblockcs_t.txd/sw_wall_05.dds\",\n \"gta3.img/sw_block05.txd/sw_wall_05.dds\",\"gta3.img/cephotoblockcs_t.txd/sw_wall_05.dds\",\n \"gta3.img/sw_genstore1.txd/sw_wall_05.dds\",\"gta3.img/cephotoblockcs_t.txd/sw_wall_05.dds\",\n \"gta3.img/des_stwnsigns1.txd/dustyjade_128.dds\",\"gta3.img/cephotoblockcs_t.txd/dustyjade_128.dds\",\n \"gta3.img/fighot.txd/dustyjade_128.dds\",\"gta3.img/cephotoblockcs_t.txd/dustyjade_128.dds\",\n \"gta_int.img/gb_cleancrock01.txd/dustyjade_128.dds\",\"gta3.img/cephotoblockcs_t.txd/dustyjade_128.dds\",\n \"gta3.img/shops01_law.txd/bigs01_law.dds\",\"gta3.img/cephotoblockcs_t.txd/bigs01_law.dds\",\n \"gta3.img/sunrise08_lawn.txd/bigs01_law.dds\",\"gta3.img/cephotoblockcs_t.txd/bigs01_law.dds\",\n \"gta3.img/vgnbballsign2.txd/bigs01_law.dds\",\"gta3.img/cephotoblockcs_t.txd/bigs01_law.dds\",\n \"gta3.img/furniture_lae2.txd/parking1_lae2.dds\",\"gta3.img/ce_pizza.txd/parking1_lae2.dds\",\n \"gta3.img/idlewood3_lae.txd/parking1_lae2.dds\",\"gta3.img/ce_pizza.txd/parking1_lae2.dds\",\n \"gta3.img/eastls4_lae2.txd/comptwall36.dds\",\"gta3.img/ce_pizza.txd/comptwall36.dds\",\n \"gta3.img/idlewood3_lae.txd/comptwall36.dds\",\"gta3.img/ce_pizza.txd/comptwall36.dds\",\n \"gta3.img/melrose12_lawn.txd/comptwall36.dds\",\"gta3.img/ce_pizza.txd/comptwall36.dds\",\n \"gta3.img/motel_lae.txd/comptwall36.dds\",\"gta3.img/ce_pizza.txd/comptwall36.dds\",\n \"gta3.img/sunset03_law2.txd/comptwall36.dds\",\"gta3.img/ce_pizza.txd/comptwall36.dds\",\n \"gta3.img/chinatownmall.txd/pizzasign_lae.dds\",\"gta3.img/ce_pizza.txd/pizzasign_lae.dds\",\n \"gta3.img/idlewood3_lae.txd/pizzasign_lae.dds\",\"gta3.img/ce_pizza.txd/pizzasign_lae.dds\",\n \"gta3.img/pier69.txd/pizzasign_lae.dds\",\"gta3.img/ce_pizza.txd/pizzasign_lae.dds\",\n \"gta3.img/smallertxd.txd/pizzasign_lae.dds\",\"gta3.img/ce_pizza.txd/pizzasign_lae.dds\",\n \"gta3.img/sw_block06.txd/pizzasign_lae.dds\",\"gta3.img/ce_pizza.txd/pizzasign_lae.dds\",\n \"gta3.img/vgnfirestat.txd/pizzasign_lae.dds\",\"gta3.img/ce_pizza.txd/pizzasign_lae.dds\",\n \"gta3.img/vgnretail2.txd/pizzasign_lae.dds\",\"gta3.img/ce_pizza.txd/pizzasign_lae.dds\",\n \"gta3.img/contachou1_lae2.txd/brickred2.dds\",\"gta3.img/ce_pizza.txd/brickred2.dds\",\n \"gta3.img/hillcliff_lahills.txd/brickred2.dds\",\"gta3.img/ce_pizza.txd/brickred2.dds\",\n \"gta3.img/idlewood3_lae.txd/brickred2.dds\",\"gta3.img/ce_pizza.txd/brickred2.dds\",\n \"gta3.img/lae2newtempbx.txd/brickred2.dds\",\"gta3.img/ce_pizza.txd/brickred2.dds\",\n \"gta3.img/lae2roadscoast.txd/brickred2.dds\",\"gta3.img/ce_pizza.txd/brickred2.dds\",\n \"gta3.img/mall_sfse.txd/brickred2.dds\",\"gta3.img/ce_pizza.txd/brickred2.dds\",\n \"gta3.img/mullho03a_lahills.txd/brickred2.dds\",\"gta3.img/ce_pizza.txd/brickred2.dds\",\n \"gta3.img/mullho03_lahills.txd/brickred2.dds\",\"gta3.img/ce_pizza.txd/brickred2.dds\",\n \"gta3.img/newstuff_sfn.txd/brickred2.dds\",\"gta3.img/ce_pizza.txd/brickred2.dds\",\n \"gta3.img/richman02_lahills.txd/brickred2.dds\",\"gta3.img/ce_pizza.txd/brickred2.dds\",\n \"gta3.img/skyscrapper_sfs.txd/brickred2.dds\",\"gta3.img/ce_pizza.txd/brickred2.dds\",\n \"gta3.img/stadjunct_sfse.txd/brickred2.dds\",\"gta3.img/ce_pizza.txd/brickred2.dds\",\n \"gta3.img/vgncondos1.txd/brickred2.dds\",\"gta3.img/ce_pizza.txd/brickred2.dds\",\n \"gta3.img/vgsxrefpart1.txd/brickred2.dds\",\"gta3.img/ce_pizza.txd/brickred2.dds\",\n \"gta3.img/des_ufoinn.txd/fastfood1_lae.dds\",\"gta3.img/ce_pizza.txd/fastfood1_lae.dds\",\n \"gta3.img/furniture_lae2.txd/fastfood1_lae.dds\",\"gta3.img/ce_pizza.txd/fastfood1_lae.dds\",\n \"gta3.img/idlewood3_lae.txd/fastfood1_lae.dds\",\"gta3.img/ce_pizza.txd/fastfood1_lae.dds\",\n \"gta3.img/lashops6_las2.txd/fastfood1_lae.dds\",\"gta3.img/ce_pizza.txd/fastfood1_lae.dds\",\n \"gta3.img/idlewood3_lae.txd/pizzasign2la.dds\",\"gta3.img/ce_pizza.txd/pizzasign2la.dds\",\n \"gta_int.img/cj_beds.txd/cj_tartan.dds\",\"gta3.img/ce_racestart.txd/cj_tartan.dds\",\n \"gta_int.img/cj_furniture.txd/cj_tartan.dds\",\"gta3.img/ce_racestart.txd/cj_tartan.dds\",\n \"gta_int.img/cj_sofa.txd/cj_tartan.dds\",\"gta3.img/ce_racestart.txd/cj_tartan.dds\",\n \"gta_int.img/rystuff.txd/cj_tartan.dds\",\"gta3.img/ce_racestart.txd/cj_tartan.dds\",\n \"gta_int.img/trailerkb.txd/cj_tartan.dds\",\"gta3.img/ce_racestart.txd/cj_tartan.dds\",\n \"gta_int.img/crlsbits.txd/lw_seat2.dds\",\"gta3.img/ce_racestart.txd/lw_seat2.dds\",\n \"gta_int.img/imy_mtlcouch.txd/lw_seat2.dds\",\"gta3.img/ce_racestart.txd/lw_seat2.dds\",\n \"gta_int.img/kbcouch1.txd/lw_seat2.dds\",\"gta3.img/ce_racestart.txd/lw_seat2.dds\",\n \"gta_int.img/vegassavesmal.txd/lw_seat2.dds\",\"gta3.img/ce_racestart.txd/lw_seat2.dds\",\n \"gta3.img/ufo_bar.txd/sa_wood07_128.dds\",\"gta3.img/ce_racestart.txd/sa_wood07_128.dds\",\n \"gta_int.img/gb_ornaments01.txd/sa_wood07_128.dds\",\"gta3.img/ce_racestart.txd/sa_wood07_128.dds\",\n \"gta_int.img/labig1int2.txd/sa_wood07_128.dds\",\"gta3.img/ce_racestart.txd/sa_wood07_128.dds\",\n \"gta_int.img/genintintcarint3.txd/rusta256128.dds\",\"gta3.img/ce_railbridge.txd/rusta256128.dds\",\n \"gta3.img/sw_block03.txd/sw_barberpole.dds\",\"gta3.img/ceroadsigns.txd/sw_barberpole.dds\",\n \"gta3.img/crackfacttanks_sfs.txd/cabin3.dds\",\"gta3.img/ce_terminal.txd/cabin3.dds\",\n \"gta3.img/factory_sfse.txd/cabin3.dds\",\"gta3.img/ce_terminal.txd/cabin3.dds\",\n \"gta_int.img/gen_pol_vegas.txd/mp_gun_dirt.dds\",\"gta3.img/ce_terminal.txd/mp_gimp_oilfloor.dds\",\n \"gta_int.img/gf4.txd/mp_gimp_oilfloor.dds\",\"gta3.img/ce_terminal.txd/mp_gimp_oilfloor.dds\",\n \"gta_int.img/mp_policesf.txd/mp_gun_dirt.dds\",\"gta3.img/ce_terminal.txd/mp_gimp_oilfloor.dds\",\n \"gta3.img/des_xoilfield.txd/gen_metal.dds\",\"gta3.img/ce_terminal.txd/gen_metal.dds\",\n \"gta3.img/factorycuntw.txd/gen_metal.dds\",\"gta3.img/ce_terminal.txd/gen_metal.dds\",\n \"gta3.img/vgnpwroutbld2.txd/gen_metal.dds\",\"gta3.img/ce_terminal.txd/gen_metal.dds\",\n \"gta_int.img/imy_motel2.txd/gen_metal.dds\",\"gta3.img/ce_terminal.txd/gen_metal.dds\",\n \"gta3.img/conhooses.txd/des_adobewall2.dds\",\"gta3.img/ce_terminal.txd/des_adobewall2.dds\",\n \"gta3.img/cw_truckstopcs_t.txd/des_adobewall2.dds\",\"gta3.img/ce_terminal.txd/des_adobewall2.dds\",\n \"gta3.img/des_clifftown.txd/des_adobewall2.dds\",\"gta3.img/ce_terminal.txd/des_adobewall2.dds\",\n \"gta3.img/des_nstuff.txd/des_adobewall2.dds\",\"gta3.img/ce_terminal.txd/des_adobewall2.dds\",\n \"gta3.img/des_nwtown.txd/des_adobewall2.dds\",\"gta3.img/ce_terminal.txd/des_adobewall2.dds\",\n \"gta3.img/des_nwtownw.txd/des_adobewall2.dds\",\"gta3.img/ce_terminal.txd/des_adobewall2.dds\",\n \"gta3.img/des_stownmain1.txd/des_adobewall2.dds\",\"gta3.img/ce_terminal.txd/des_adobewall2.dds\",\n \"gta3.img/des_wtownmain.txd/des_adobewall2.dds\",\"gta3.img/ce_terminal.txd/des_adobewall2.dds\",\n \"gta3.img/cetown3cs_t.txd/pierboards_la.dds\",\"gta3.img/ce_terminal.txd/pierboards_la.dds\",\n \"gta3.img/cunte_blockammo.txd/pierboards_la.dds\",\"gta3.img/ce_terminal.txd/pierboards_la.dds\",\n \"gta3.img/cuntwf.txd/pierboards_la.dds\",\"gta3.img/ce_terminal.txd/pierboards_la.dds\",\n \"gta3.img/ground3_las.txd/pierboards_la.dds\",\"gta3.img/ce_terminal.txd/pierboards_la.dds\",\n \"gta3.img/sfn_apart02sfn.txd/pierboards_la.dds\",\"gta3.img/ce_terminal.txd/pierboards_la.dds\",\n \"gta3.img/sw_block04.txd/pierboards_la.dds\",\"gta3.img/ce_terminal.txd/pierboards_la.dds\",\n \"gta3.img/chinatownsfe.txd/whitewall256.dds\",\"gta3.img/ce_terminal.txd/whitewall256.dds\",\n \"gta3.img/eastls4_lae2.txd/whitewall256.dds\",\"gta3.img/ce_terminal.txd/whitewall256.dds\",\n \"gta3.img/ggatepark.txd/whitewall256.dds\",\"gta3.img/ce_terminal.txd/whitewall256.dds\",\n \"gta3.img/sw_block01.txd/whitewall256.dds\",\"gta3.img/ce_terminal.txd/whitewall256.dds\",\n \"gta3.img/dem1_sfxrf.txd/ws_peeling_ceiling1.dds\",\"gta3.img/ce_terminal.txd/ws_peeling_ceiling1.dds\",\n \"gta3.img/dem4_sfxrf.txd/ws_peeling_ceiling1.dds\",\"gta3.img/ce_terminal.txd/ws_peeling_ceiling1.dds\",\n \"gta3.img/mountainsfs.txd/grass4dirtyb.dds\",\"gta3.img/ce_terminal.txd/grass4dirtyb.dds\",\n \"gta3.img/cunte_block1.txd/sw_door18.dds\",\"gta3.img/cetown3cs_t.txd/sw_door18.dds\",\n \"gta3.img/cw2_cinemablockcs_t.txd/sw_door18.dds\",\"gta3.img/cetown3cs_t.txd/sw_door18.dds\",\n \"gta3.img/desn2_truckstop.txd/sw_door18.dds\",\"gta3.img/cetown3cs_t.txd/sw_door18.dds\",\n \"gta3.img/eastbeach3c_lae2.txd/sw_door18.dds\",\"gta3.img/cetown3cs_t.txd/sw_door18.dds\",\n \"gta3.img/gardencentre_sfs.txd/sw_door18.dds\",\"gta3.img/cetown3cs_t.txd/sw_door18.dds\",\n \"gta3.img/idlewood6_lae.txd/sw_door18.dds\",\"gta3.img/cetown3cs_t.txd/sw_door18.dds\",\n \"gta3.img/lashops91_las2.txd/sw_door18.dds\",\"gta3.img/cetown3cs_t.txd/sw_door18.dds\",\n \"gta3.img/shopliquor_las.txd/sw_door18.dds\",\"gta3.img/cetown3cs_t.txd/sw_door18.dds\",\n \"gta3.img/sw_apartflat5.txd/sw_door18.dds\",\"gta3.img/cetown3cs_t.txd/sw_door18.dds\",\n \"gta3.img/sw_apartflatx.txd/sw_door18.dds\",\"gta3.img/cetown3cs_t.txd/sw_door18.dds\",\n \"gta3.img/sw_block12.txd/sw_door18.dds\",\"gta3.img/cetown3cs_t.txd/sw_door18.dds\",\n \"gta3.img/sw_block9.txd/sw_door18.dds\",\"gta3.img/cetown3cs_t.txd/sw_door18.dds\",\n \"gta3.img/sw_genstore.txd/sw_door18.dds\",\"gta3.img/cetown3cs_t.txd/sw_door18.dds\",\n \"gta3.img/w_town3cs_t.txd/sw_door18.dds\",\"gta3.img/cetown3cs_t.txd/sw_door18.dds\",\n \"gta3.img/cunte_gas01.txd/sw_door17.dds\",\"gta3.img/cetown3cs_t.txd/sw_door17.dds\",\n \"gta3.img/cw_truckstopcs_t.txd/sw_door17.dds\",\"gta3.img/cetown3cs_t.txd/sw_door17.dds\",\n \"gta3.img/desn_truckstop.txd/sw_door17.dds\",\"gta3.img/cetown3cs_t.txd/sw_door17.dds\",\n \"gta3.img/lae2newtempbx.txd/sw_door17.dds\",\"gta3.img/cetown3cs_t.txd/sw_door17.dds\",\n \"gta3.img/sw_block10.txd/sw_door17.dds\",\"gta3.img/cetown3cs_t.txd/sw_door17.dds\",\n \"gta3.img/sw_block12.txd/sw_door17.dds\",\"gta3.img/cetown3cs_t.txd/sw_door17.dds\",\n \"gta3.img/cunte_blockammo.txd/sw_wind18.dds\",\"gta3.img/cetown3cs_t.txd/sw_wind18.dds\",\n \"gta3.img/sw_block01.txd/sw_wind18.dds\",\"gta3.img/cetown3cs_t.txd/sw_wind18.dds\",\n \"gta3.img/sw_block09.txd/sw_wind18.dds\",\"gta3.img/cetown3cs_t.txd/sw_wind18.dds\",\n \"gta3.img/newstuff_sfn.txd/sw_wind15.dds\",\"gta3.img/cetown3cs_t.txd/sw_wind15.dds\",\n \"gta3.img/sw_apartflatx.txd/sw_wind15.dds\",\"gta3.img/cetown3cs_t.txd/sw_wind15.dds\",\n \"gta3.img/sw_block11a.txd/sw_wind15.dds\",\"gta3.img/cetown3cs_t.txd/sw_wind15.dds\",\n \"gta3.img/excalibur.txd/ws_sandstone2.dds\",\"gta3.img/cetown3cs_t.txd/ws_sandstone2.dds\",\n \"gta3.img/idlewood3_lae.txd/ws_sandstone2.dds\",\"gta3.img/cetown3cs_t.txd/ws_sandstone2.dds\",\n \"gta3.img/lashops93_las2.txd/ws_sandstone2.dds\",\"gta3.img/cetown3cs_t.txd/ws_sandstone2.dds\",\n \"gta3.img/lasroads_las.txd/ws_sandstone2.dds\",\"gta3.img/cetown3cs_t.txd/ws_sandstone2.dds\",\n \"gta3.img/losflor2_lae2.txd/ws_sandstone2.dds\",\"gta3.img/cetown3cs_t.txd/ws_sandstone2.dds\",\n \"gta3.img/stationsfse_1.txd/ws_sandstone2.dds\",\"gta3.img/cetown3cs_t.txd/ws_sandstone2.dds\",\n \"gta3.img/station_sfse.txd/ws_sandstone2.dds\",\"gta3.img/cetown3cs_t.txd/ws_sandstone2.dds\",\n \"gta3.img/sw_ware01.txd/ws_sandstone2.dds\",\"gta3.img/cetown3cs_t.txd/ws_sandstone2.dds\",\n \"gta3.img/vegashse4.txd/ws_sandstone2.dds\",\"gta3.img/cetown3cs_t.txd/ws_sandstone2.dds\",\n \"gta3.img/vegashse5.txd/ws_sandstone2.dds\",\"gta3.img/cetown3cs_t.txd/ws_sandstone2.dds\",\n \"gta3.img/vegashse7.txd/ws_sandstone2.dds\",\"gta3.img/cetown3cs_t.txd/ws_sandstone2.dds\",\n \"gta3.img/vegirlfr01.txd/ws_sandstone2.dds\",\"gta3.img/cetown3cs_t.txd/ws_sandstone2.dds\",\n \"gta3.img/vgnfrates.txd/ws_sandstone2.dds\",\"gta3.img/cetown3cs_t.txd/ws_sandstone2.dds\",\n \"gta3.img/wasteland_las2.txd/ws_sandstone2.dds\",\"gta3.img/cetown3cs_t.txd/ws_sandstone2.dds\",\n \"gta3.img/des_stownstrip2.txd/des_cafesign.dds\",\"gta3.img/cetown3cs_t.txd/des_cafesign.dds\",\n \"gta3.img/sw_block03.txd/sw_wall03.dds\",\"gta3.img/cetown3cs_t.txd/sw_wall03.dds\",\n \"gta3.img/sw_block9.txd/sw_wall03.dds\",\"gta3.img/cetown3cs_t.txd/sw_wall03.dds\",\n \"gta3.img/ce_traintrack2.txd/sw_tunnel02bmp.dds\",\"gta3.img/ce_traintrack1.txd/sw_tunnel02bmp.dds\",\n \"gta3.img/cuntwlandwest.txd/sw_tunnel02bmp.dds\",\"gta3.img/ce_traintrack1.txd/sw_tunnel02bmp.dds\",\n \"gta3.img/railtracklae.txd/sw_tunnel02bmp.dds\",\"gta3.img/ce_traintrack1.txd/sw_tunnel02bmp.dds\",\n \"gta3.img/traintunnel2_sfse.txd/sw_tunnel02bmp.dds\",\"gta3.img/ce_traintrack1.txd/sw_tunnel02bmp.dds\",\n \"gta3.img/ce_traintrack2.txd/sw_tunnel01.dds\",\"gta3.img/ce_traintrack1.txd/sw_tunnel01.dds\",\n \"gta3.img/lanriver.txd/sw_tunnel01.dds\",\"gta3.img/ce_traintrack1.txd/sw_tunnel01.dds\",\n \"gta3.img/railtracklae.txd/sw_tunnel01.dds\",\"gta3.img/ce_traintrack1.txd/sw_tunnel01.dds\",\n \"gta3.img/railtunn1_law2.txd/sw_tunnel01.dds\",\"gta3.img/ce_traintrack1.txd/sw_tunnel01.dds\",\n \"gta3.img/traintrack_las.txd/sw_tunnel01.dds\",\"gta3.img/ce_traintrack1.txd/sw_tunnel01.dds\",\n \"gta3.img/traintunnel2_sfse.txd/sw_tunnel01.dds\",\"gta3.img/ce_traintrack1.txd/sw_tunnel01.dds\",\n \"gta3.img/tunnel_law.txd/sw_tunnel01.dds\",\"gta3.img/ce_traintrack1.txd/sw_tunnel01.dds\",\n \"gta3.img/vgwstdirtyrd.txd/sw_tunnel01.dds\",\"gta3.img/ce_traintrack1.txd/sw_tunnel01.dds\",\n \"gta3.img/ce_traintrack2.txd/sw_traingravelb1.dds\",\"gta3.img/ce_traintrack1.txd/sw_traingravelb1.dds\",\n \"gta3.img/ce_traintrack2.txd/ws_traintrax1.dds\",\"gta3.img/ce_traintrack1.txd/ws_traintrax1.dds\",\n \"gta3.img/desn_trainstuff.txd/ws_traintrax1.dds\",\"gta3.img/ce_traintrack1.txd/ws_traintrax1.dds\",\n \"gta3.img/des_trainstuff.txd/ws_traintrax1.dds\",\"gta3.img/ce_traintrack1.txd/ws_traintrax1.dds\",\n \"gta3.img/lasroads_las2.txd/ws_traintrax1.dds\",\"gta3.img/ce_traintrack1.txd/ws_traintrax1.dds\",\n \"gta3.img/railbridge_sfse.txd/ws_traintrax1.dds\",\"gta3.img/ce_traintrack1.txd/ws_traintrax1.dds\",\n \"gta3.img/railtracklae.txd/ws_traintrax1.dds\",\"gta3.img/ce_traintrack1.txd/ws_traintrax1.dds\",\n \"gta3.img/railtunn1_law2.txd/ws_traintrax1.dds\",\"gta3.img/ce_traintrack1.txd/ws_traintrax1.dds\",\n \"gta3.img/railwaycuntw.txd/ws_traintrax1.dds\",\"gta3.img/ce_traintrack1.txd/ws_traintrax1.dds\",\n \"gta3.img/railway_las.txd/ws_traintrax1.dds\",\"gta3.img/ce_traintrack1.txd/ws_traintrax1.dds\",\n \"gta3.img/stationtunnel.txd/ws_traintrax1.dds\",\"gta3.img/ce_traintrack1.txd/ws_traintrax1.dds\",\n \"gta3.img/traindocks_sfse.txd/ws_traintrax1.dds\",\"gta3.img/ce_traintrack1.txd/ws_traintrax1.dds\",\n \"gta3.img/traingen_sfse.txd/ws_traintrax1.dds\",\"gta3.img/ce_traintrack1.txd/ws_traintrax1.dds\",\n \"gta3.img/trainplatform_sfse.txd/ws_traintrax1.dds\",\"gta3.img/ce_traintrack1.txd/ws_traintrax1.dds\",\n \"gta3.img/traintrack_las2.txd/ws_traintrax1.dds\",\"gta3.img/ce_traintrack1.txd/ws_traintrax1.dds\",\n \"gta3.img/traintrack_las.txd/ws_traintrax1.dds\",\"gta3.img/ce_traintrack1.txd/ws_traintrax1.dds\",\n \"gta3.img/traintunnel1_sfse.txd/ws_traintrax1.dds\",\"gta3.img/ce_traintrack1.txd/ws_traintrax1.dds\",\n \"gta3.img/traintunnel2_sfse.txd/ws_traintrax1.dds\",\"gta3.img/ce_traintrack1.txd/ws_traintrax1.dds\",\n \"gta3.img/tunnel_law.txd/ws_traintrax1.dds\",\"gta3.img/ce_traintrack1.txd/ws_traintrax1.dds\",\n \"gta3.img/vgnrailroad.txd/ws_traintrax1.dds\",\"gta3.img/ce_traintrack1.txd/ws_traintrax1.dds\",\n \"gta3.img/vgsrailroad.txd/ws_traintrax1.dds\",\"gta3.img/ce_traintrack1.txd/ws_traintrax1.dds\",\n \"gta3.img/vgwestrailrd.txd/ws_traintrax1.dds\",\"gta3.img/ce_traintrack1.txd/ws_traintrax1.dds\",\n \"gta3.img/cunte_block1.txd/sw_backdoor02.dds\",\"gta3.img/ce_traintrack2.txd/sw_backdoor02.dds\",\n \"gta3.img/cuntwshopscs_t.txd/sw_backdoor02.dds\",\"gta3.img/ce_traintrack2.txd/sw_backdoor02.dds\",\n \"gta3.img/des_quarrycrane.txd/sw_backdoor02.dds\",\"gta3.img/ce_traintrack2.txd/sw_backdoor02.dds\",\n \"gta3.img/gimp_drx.txd/sw_backdoor02.dds\",\"gta3.img/ce_traintrack2.txd/sw_backdoor02.dds\",\n \"gta3.img/jump_sfxref.txd/sw_backdoor02.dds\",\"gta3.img/ce_traintrack2.txd/sw_backdoor02.dds\",\n \"gta3.img/lanriver.txd/sw_backdoor02.dds\",\"gta3.img/ce_traintrack2.txd/sw_backdoor02.dds\",\n \"gta3.img/railtracklae.txd/sw_backdoor02.dds\",\"gta3.img/ce_traintrack2.txd/sw_backdoor02.dds\",\n \"gta3.img/sw_block04.txd/sw_backdoor02.dds\",\"gta3.img/ce_traintrack2.txd/sw_backdoor02.dds\",\n \"gta3.img/conhooses.txd/corr_roof1.dds\",\"gta3.img/cewrehse.txd/corr_roof1.dds\",\n \"gta3.img/cuntwbt.txd/corr_roof1.dds\",\"gta3.img/cewrehse.txd/corr_roof1.dds\",\n \"gta3.img/cuntwshopscs_t.txd/corr_roof1.dds\",\"gta3.img/cewrehse.txd/corr_roof1.dds\",\n \"gta3.img/cw2_storesnstuff.txd/corr_roof1.dds\",\"gta3.img/cewrehse.txd/corr_roof1.dds\",\n \"gta3.img/cxref_desert.txd/corr_roof1.dds\",\"gta3.img/cewrehse.txd/corr_roof1.dds\",\n \"gta3.img/cxref_oldwest.txd/corr_roof1.dds\",\"gta3.img/cewrehse.txd/corr_roof1.dds\",\n \"gta3.img/cxref_savhus.txd/corr_roof1.dds\",\"gta3.img/cewrehse.txd/corr_roof1.dds\",\n \"gta3.img/cxrf_payspray.txd/corr_roof1.dds\",\"gta3.img/cewrehse.txd/corr_roof1.dds\",\n \"gta3.img/des_baitshop.txd/corr_roof1.dds\",\"gta3.img/cewrehse.txd/corr_roof1.dds\",\n \"gta3.img/des_bighus.txd/corr_roof1.dds\",\"gta3.img/cewrehse.txd/corr_roof1.dds\",\n \"gta3.img/des_boneyard.txd/corr_roof1.dds\",\"gta3.img/cewrehse.txd/corr_roof1.dds\",\n \"gta3.img/des_byoffice.txd/corr_roof1.dds\",\"gta3.img/cewrehse.txd/corr_roof1.dds\",\n \"gta3.img/des_clifftown.txd/corr_roof1.dds\",\"gta3.img/cewrehse.txd/corr_roof1.dds\",\n \"gta3.img/des_damquay.txd/corr_roof1.dds\",\"gta3.img/cewrehse.txd/corr_roof1.dds\",\n \"gta3.img/des_farmstuff.txd/corr_roof1.dds\",\"gta3.img/cewrehse.txd/corr_roof1.dds\",\n \"gta3.img/desn2_peckers.txd/corr_roof1.dds\",\"gta3.img/cewrehse.txd/corr_roof1.dds\",\n \"gta3.img/des_nstuff.txd/corr_roof1.dds\",\"gta3.img/cewrehse.txd/corr_roof1.dds\",\n \"gta3.img/des_ntown.txd/corr_roof1.dds\",\"gta3.img/cewrehse.txd/corr_roof1.dds\",\n \"gta3.img/des_nwtown.txd/corr_roof1.dds\",\"gta3.img/cewrehse.txd/corr_roof1.dds\",\n \"gta3.img/des_stownmain1.txd/corr_roof1.dds\",\"gta3.img/cewrehse.txd/corr_roof1.dds\",\n \"gta3.img/des_stownmain2.txd/corr_roof1.dds\",\"gta3.img/cewrehse.txd/corr_roof1.dds\",\n \"gta3.img/des_stownmain3.txd/corr_roof1.dds\",\"gta3.img/cewrehse.txd/corr_roof1.dds\",\n \"gta3.img/des_stownstrip1.txd/corr_roof1.dds\",\"gta3.img/cewrehse.txd/corr_roof1.dds\",\n \"gta3.img/des_stwnsigns1.txd/corr_roof1.dds\",\"gta3.img/cewrehse.txd/corr_roof1.dds\",\n \"gta3.img/des_ufoinn.txd/corr_roof1.dds\",\"gta3.img/cewrehse.txd/corr_roof1.dds\",\n \"gta3.img/des_wtownmain.txd/corr_roof1.dds\",\"gta3.img/cewrehse.txd/corr_roof1.dds\",\n \"gta3.img/eastshops1_lae.txd/corr_roof1.dds\",\"gta3.img/cewrehse.txd/corr_roof1.dds\",\n \"gta3.img/garage_sfw.txd/corr_roof1.dds\",\"gta3.img/cewrehse.txd/corr_roof1.dds\",\n \"gta3.img/oldwest.txd/corr_roof1.dds\",\"gta3.img/cewrehse.txd/corr_roof1.dds\",\n \"gta3.img/sfn_office.txd/corr_roof1.dds\",\"gta3.img/cewrehse.txd/corr_roof1.dds\",\n \"gta3.img/sprunkworks.txd/corr_roof1.dds\",\"gta3.img/cewrehse.txd/corr_roof1.dds\",\n \"gta3.img/sw_smlfarm.txd/corr_roof1.dds\",\"gta3.img/cewrehse.txd/corr_roof1.dds\",\n \"gta3.img/vgehshade.txd/corr_roof1.dds\",\"gta3.img/cewrehse.txd/corr_roof1.dds\",\n \"gta3.img/vgncarshade1.txd/corr_roof1.dds\",\"gta3.img/cewrehse.txd/corr_roof1.dds\",\n \"gta3.img/vgsehseing1.txd/corr_roof1.dds\",\"gta3.img/cewrehse.txd/corr_roof1.dds\",\n \"gta3.img/vgsespras.txd/corr_roof1.dds\",\"gta3.img/cewrehse.txd/corr_roof1.dds\",\n \"gta3.img/vgsrailbuild.txd/corr_roof1.dds\",\"gta3.img/cewrehse.txd/corr_roof1.dds\",\n \"gta3.img/vgnretail2.txd/roof09l256.dds\",\"gta3.img/cewrehse.txd/roof09l256.dds\",\n \"gta3.img/vgwestabats.txd/roof09l256.dds\",\"gta3.img/cewrehse.txd/roof09l256.dds\",\n \"gta3.img/vgwestoutwn2.txd/roof09l256.dds\",\"gta3.img/cewrehse.txd/roof09l256.dds\",\n \"gta3.img/skyscr1_lan2.txd/sw_wind13.dds\",\"gta3.img/cewrehse.txd/sw_wind13.dds\",\n \"gta3.img/sw_apartflat.txd/sw_wind13.dds\",\"gta3.img/cewrehse.txd/sw_wind13.dds\",\n \"gta3.img/sw_apartflatx.txd/sw_wind13.dds\",\"gta3.img/cewrehse.txd/sw_wind13.dds\",\n \"gta3.img/sw_block09.txd/sw_wind13.dds\",\"gta3.img/cewrehse.txd/sw_wind13.dds\",\n \"gta3.img/sw_block9.txd/sw_wind13.dds\",\"gta3.img/cewrehse.txd/sw_wind13.dds\",\n \"gta3.img/sw_fact01.txd/sw_wind13.dds\",\"gta3.img/cewrehse.txd/sw_wind13.dds\",\n \"gta3.img/sw_office.txd/sw_wind13.dds\",\"gta3.img/cewrehse.txd/sw_wind13.dds\",\n \"gta3.img/crackfact_sfse.txd/ws_altz_wall8_top.dds\",\"gta3.img/cf_metals_sfse.txd/ws_altz_wall8_top.dds\",\n \"gta3.img/des_woodbr.txd/alumplat64.dds\",\"gta3.img/cgo_barx.txd/alumplat64.dds\",\n \"gta3.img/dynbarrels.txd/alumplat64.dds\",\"gta3.img/cgo_barx.txd/alumplat64.dds\",\n \"gta3.img/hubint2.txd/alumplat64.dds\",\"gta3.img/cgo_barx.txd/alumplat64.dds\",\n \"gta3.img/privatesign.txd/alumplat64.dds\",\"gta3.img/cgo_barx.txd/alumplat64.dds\",\n \"gta3.img/sunset1_lan2.txd/alumplat64.dds\",\"gta3.img/cgo_barx.txd/alumplat64.dds\",\n \"gta_int.img/ab_cargo_int.txd/alumplat64.dds\",\"gta3.img/cgo_barx.txd/alumplat64.dds\",\n \"gta3.img/dynbarrels.txd/yellowmetal.dds\",\"gta3.img/cgo_barx.txd/yellowmetal.dds\",\n \"gta_int.img/ab_cargo_int.txd/yellowmetal.dds\",\"gta3.img/cgo_barx.txd/yellowmetal.dds\",\n \"gta3.img/od_beachstuff.txd/wood02.dds\",\"gta3.img/chairsntable.txd/wood02.dds\",\n \"gta3.img/lasground2_las2.txd/backstagefloor1_256.dds\",\"gta3.img/chateau_lawn.txd/backstagefloor1_256.dds\",\n \"gta3.img/stormdrain_las2.txd/backstagefloor1_256.dds\",\"gta3.img/chateau_lawn.txd/backstagefloor1_256.dds\",\n \"gta3.img/vgsmotelgrnd.txd/backstagefloor1_256.dds\",\"gta3.img/chateau_lawn.txd/backstagefloor1_256.dds\",\n \"gta3.img/dingbat01_la.txd/doorkb_1_256.dds\",\"gta3.img/chateau_lawn.txd/doorkb_1_256.dds\",\n \"gta3.img/lahillshilhs1e.txd/doorkb_1_256.dds\",\"gta3.img/chateau_lawn.txd/doorkb_1_256.dds\",\n \"gta3.img/sw_ware01.txd/doorkb_1_256.dds\",\"gta3.img/chateau_lawn.txd/doorkb_1_256.dds\",\n \"gta3.img/venchouse_lax.txd/doorkb_1_256.dds\",\"gta3.img/chateau_lawn.txd/doorkb_1_256.dds\",\n \"gta3.img/shops01_law.txd/chatwall03_law.dds\",\"gta3.img/chateau_lawn.txd/chatwall03_law.dds\",\n \"gta3.img/shops2_law.txd/chatwall03_law.dds\",\"gta3.img/chateau_lawn.txd/chatwall03_law.dds\",\n \"gta3.img/ground2_las2.txd/newall1-1.dds\",\"gta3.img/chemgrnd_las2.txd/newall1-1.dds\",\n \"gta3.img/groundb_las2.txd/newall1-1.dds\",\"gta3.img/chemgrnd_las2.txd/newall1-1.dds\",\n \"gta3.img/imrancomp_las2.txd/newall1-1.dds\",\"gta3.img/chemgrnd_las2.txd/newall1-1.dds\",\n \"gta3.img/imrancompyard_las.txd/newall1-1.dds\",\"gta3.img/chemgrnd_las2.txd/newall1-1.dds\",\n \"gta3.img/railway_las.txd/newall1-1.dds\",\"gta3.img/chemgrnd_las2.txd/newall1-1.dds\",\n \"gta3.img/indust2_lax.txd/was_side.dds\",\"gta3.img/chemgrnd_las2.txd/was_side.dds\",\n \"gta3.img/railway_las.txd/sjmhicut5las.dds\",\"gta3.img/chemgrnd_las2.txd/sjmhicut5las.dds\",\n \"gta3.img/warehus_las2.txd/sjmhicut5las.dds\",\"gta3.img/chemgrnd_las2.txd/sjmhicut5las.dds\",\n \"gta3.img/shops01_law.txd/newall1-3seamless.dds\",\"gta3.img/chemgrnd_las2.txd/newall1-3seamless.dds\",\n \"gta3.img/vgsebuild01.txd/newall1-3seamless.dds\",\"gta3.img/chemgrnd_las2.txd/newall1-3seamless.dds\",\n \"gta3.img/chgatex.txd/corrugated2.dds\",\"gta3.img/chgatedes.txd/corrugated2.dds\",\n \"gta3.img/ctgtxx.txd/corrugated2.dds\",\"gta3.img/chgatedes.txd/corrugated2.dds\",\n \"gta3.img/docks2refl_sfse.txd/corrugated2.dds\",\"gta3.img/chgatedes.txd/corrugated2.dds\",\n \"gta3.img/quarry.txd/corrugated2.dds\",\"gta3.img/chgatedes.txd/corrugated2.dds\",\n \"gta3.img/ctgtxx.txd/nopark.dds\",\"gta3.img/chgatex.txd/nopark.dds\",\n \"gta3.img/eastls1_lae2.txd/gangshop8_lae.dds\",\"gta3.img/chicano10_lae.txd/gangshop8_lae.dds\",\n \"gta3.img/civic07_lan.txd/downtwin16.dds\",\"gta3.img/chicano10_lae.txd/downtwin16.dds\",\n \"gta3.img/downtown1_las.txd/downtwin16.dds\",\"gta3.img/chicano10_lae.txd/downtwin16.dds\",\n \"gta3.img/eastbeach2a_lae2.txd/downtwin16.dds\",\"gta3.img/chicano10_lae.txd/downtwin16.dds\",\n \"gta3.img/gangblok1_lae2.txd/downtwin16.dds\",\"gta3.img/chicano10_lae.txd/downtwin16.dds\",\n \"gta3.img/idlewood6_lae.txd/downtwin16.dds\",\"gta3.img/chicano10_lae.txd/downtwin16.dds\",\n \"gta3.img/lae2bigblock.txd/downtwin16.dds\",\"gta3.img/chicano10_lae.txd/downtwin16.dds\",\n \"gta3.img/civic06_lan.txd/downtwin4.dds\",\"gta3.img/chicano10_lae.txd/downtwin4.dds\",\n \"gta3.img/downtown3_las.txd/downtwin4.dds\",\"gta3.img/chicano10_lae.txd/downtwin4.dds\",\n \"gta3.img/lanbloka.txd/downtwin4.dds\",\"gta3.img/chicano10_lae.txd/downtwin4.dds\",\n \"gta3.img/lanblokb.txd/downtwin4.dds\",\"gta3.img/chicano10_lae.txd/downtwin4.dds\",\n \"gta3.img/glenpark1x_lae.txd/santall4.dds\",\"gta3.img/chicano10_lae.txd/santall4.dds\",\n \"gta3.img/idlewood3_lae.txd/santall4.dds\",\"gta3.img/chicano10_lae.txd/santall4.dds\",\n \"gta3.img/idlewood6_lae.txd/santall4.dds\",\"gta3.img/chicano10_lae.txd/santall4.dds\",\n \"gta3.img/industry3_las2.txd/santall4.dds\",\"gta3.img/chicano10_lae.txd/santall4.dds\",\n \"gta3.img/contachou1_lae2.txd/comptwall5.dds\",\"gta3.img/chicano10_lae.txd/comptwall5.dds\",\n \"gta3.img/ganghouse1_lax.txd/comptwall5.dds\",\"gta3.img/chicano10_lae.txd/comptwall5.dds\",\n \"gta3.img/ground_las2.txd/gb_nastybar22.dds\",\"gta3.img/chicano10_lae.txd/gb_nastybar22.dds\",\n \"gta3.img/laland1_lan2.txd/gm_labuld2_d.dds\",\"gta3.img/chicano10_lae.txd/gm_labuld2_d.dds\",\n \"gta3.img/skyscrap2_lan2.txd/gm_labuld2_d.dds\",\"gta3.img/chicano10_lae.txd/gm_labuld2_d.dds\",\n \"gta3.img/stapl.txd/gm_labuld2_d.dds\",\"gta3.img/chicano10_lae.txd/gm_labuld2_d.dds\",\n \"gta3.img/stolenbuild01.txd/gm_labuld2_d.dds\",\"gta3.img/chicano10_lae.txd/gm_labuld2_d.dds\",\n \"gta3.img/theatrelan2.txd/gm_labuld2_d.dds\",\"gta3.img/chicano10_lae.txd/gm_labuld2_d.dds\",\n \"gta3.img/cs_forest.txd/grassdeadbrn256.dds\",\"gta3.img/chicano10_lae.txd/grassdeadbrn256.dds\",\n \"gta3.img/cuntwlandwest.txd/grassdeadbrn256.dds\",\"gta3.img/chicano10_lae.txd/grassdeadbrn256.dds\",\n \"gta3.img/des_s.txd/grassdeadbrn256.dds\",\"gta3.img/chicano10_lae.txd/grassdeadbrn256.dds\",\n \"gta3.img/lae2bridge.txd/grassdeadbrn256.dds\",\"gta3.img/chicano10_lae.txd/grassdeadbrn256.dds\",\n \"gta3.img/landcoast_lae2.txd/grassdeadbrn256.dds\",\"gta3.img/chicano10_lae.txd/grassdeadbrn256.dds\",\n \"gta3.img/landlae2c.txd/grassdeadbrn256.dds\",\"gta3.img/chicano10_lae.txd/grassdeadbrn256.dds\",\n \"gta3.img/idlewood6_lae.txd/eris_5.dds\",\"gta3.img/chicano10_lae.txd/eris_5.dds\",\n \"gta3.img/vgebillboards.txd/eris_5.dds\",\"gta3.img/chicano10_lae.txd/eris_5.dds\",\n \"gta3.img/vgnbball.txd/eris_5.dds\",\"gta3.img/chicano10_lae.txd/eris_5.dds\",\n \"gta3.img/vgsssignage03.txd/eris_5.dds\",\"gta3.img/chicano10_lae.txd/eris_5.dds\",\n \"gta3.img/contachou1_lae2.txd/compfence1_lae.dds\",\"gta3.img/chicano10_lae.txd/compfence1_lae.dds\",\n \"gta3.img/eastls1_lae2.txd/compfence1_lae.dds\",\"gta3.img/chicano10_lae.txd/compfence1_lae.dds\",\n \"gta3.img/glenphouse_lax.txd/compfence1_lae.dds\",\"gta3.img/chicano10_lae.txd/compfence1_lae.dds\",\n \"gta3.img/melrose12_lawn.txd/compfence1_lae.dds\",\"gta3.img/chicano10_lae.txd/compfence1_lae.dds\",\n \"gta3.img/rodeoprk_law2.txd/compfence1_lae.dds\",\"gta3.img/chicano10_lae.txd/compfence1_lae.dds\",\n \"gta3.img/coast_apts.txd/ws_garagedoor2_green.dds\",\"gta3.img/chicano10_lae.txd/ws_garagedoor2_green.dds\",\n \"gta3.img/contachou1_lae2.txd/ws_garagedoor2_green.dds\",\"gta3.img/chicano10_lae.txd/ws_garagedoor2_green.dds\",\n \"gta3.img/sunrise01_lawn.txd/ws_garagedoor2_green.dds\",\"gta3.img/chicano10_lae.txd/ws_garagedoor2_green.dds\",\n \"gta3.img/vegashse5.txd/ws_garagedoor2_green.dds\",\"gta3.img/chicano10_lae.txd/ws_garagedoor2_green.dds\",\n \"gta3.img/idlewood6_lae.txd/heat_04.dds\",\"gta3.img/chicano10_lae.txd/heat_04.dds\",\n \"gta3.img/vgsssignage04.txd/heat_04.dds\",\"gta3.img/chicano10_lae.txd/heat_04.dds\",\n \"gta3.img/vgwstbboard.txd/heat_04.dds\",\"gta3.img/chicano10_lae.txd/heat_04.dds\",\n \"gta3.img/idlewood6_lae.txd/newall7.dds\",\"gta3.img/chicano10_lae.txd/newall7.dds\",\n \"gta3.img/lae2newtempbx.txd/newall7.dds\",\"gta3.img/chicano10_lae.txd/newall7.dds\",\n \"gta3.img/lasground_las2.txd/newall7.dds\",\"gta3.img/chicano10_lae.txd/newall7.dds\",\n \"gta3.img/lashops1b_las2.txd/newall7.dds\",\"gta3.img/chicano10_lae.txd/newall7.dds\",\n \"gta3.img/lashops1_las2.txd/newall7.dds\",\"gta3.img/chicano10_lae.txd/newall7.dds\",\n \"gta3.img/lashops91_las2.txd/newall7.dds\",\"gta3.img/chicano10_lae.txd/newall7.dds\",\n \"gta3.img/motel_lae.txd/newall7.dds\",\"gta3.img/chicano10_lae.txd/newall7.dds\",\n \"gta3.img/sunrise01_lawn.txd/newall7.dds\",\"gta3.img/chicano10_lae.txd/newall7.dds\",\n \"gta3.img/eastls4_lae2.txd/crakwall1_lae2.dds\",\"gta3.img/chicano10_lae.txd/crakwall1_lae2.dds\",\n \"gta3.img/idlewood6_lae.txd/crakwall1_lae2.dds\",\"gta3.img/chicano10_lae.txd/crakwall1_lae2.dds\",\n \"gta3.img/lae2grnd.txd/crakwall1_lae2.dds\",\"gta3.img/chicano10_lae.txd/crakwall1_lae2.dds\",\n \"gta3.img/projects_la.txd/crakwall1_lae2.dds\",\"gta3.img/chicano10_lae.txd/crakwall1_lae2.dds\",\n \"gta3.img/eastls1b_lae2.txd/comptwall15.dds\",\"gta3.img/chicano10_lae.txd/comptwall15.dds\",\n \"gta3.img/ganghouse1_lax.txd/comptwall15.dds\",\"gta3.img/chicano10_lae.txd/comptwall15.dds\",\n \"gta3.img/glenphouse_lax.txd/comptwall15.dds\",\"gta3.img/chicano10_lae.txd/comptwall15.dds\",\n \"gta3.img/lae2roads.txd/comptwall15.dds\",\"gta3.img/chicano10_lae.txd/comptwall15.dds\",\n \"gta3.img/landlae2b.txd/comptwall15.dds\",\"gta3.img/chicano10_lae.txd/comptwall15.dds\",\n \"gta3.img/melrose02_lawn.txd/comptwall15.dds\",\"gta3.img/chicano10_lae.txd/comptwall15.dds\",\n \"gta3.img/melrose19_lawn.txd/comptwall15.dds\",\"gta3.img/chicano10_lae.txd/comptwall15.dds\",\n \"gta3.img/sunset04_law2.txd/comptwall15.dds\",\"gta3.img/chicano10_lae.txd/comptwall15.dds\",\n \"gta3.img/eastls1b_lae2.txd/comptsign4_lae.dds\",\"gta3.img/chicano10_lae.txd/comptsign4_lae.dds\",\n \"gta3.img/ganton02_lae2.txd/comptsign4_lae.dds\",\"gta3.img/chicano10_lae.txd/comptsign4_lae.dds\",\n \"gta3.img/laealpha.txd/gangsign5_lae.dds\",\"gta3.img/chicano10_lae.txd/gangsign5_lae.dds\",\n \"gta3.img/eastls4_lae2.txd/g_256.dds\",\"gta3.img/chicano10_lae.txd/g_256.dds\",\n \"gta3.img/ganton01_lae2.txd/g_256.dds\",\"gta3.img/chicano10_lae.txd/g_256.dds\",\n \"gta3.img/sunrise04_lawn.txd/g_256.dds\",\"gta3.img/chicano10_lae.txd/g_256.dds\",\n \"gta3.img/sw_apartflatx.txd/g_256.dds\",\"gta3.img/chicano10_lae.txd/g_256.dds\",\n \"gta3.img/sw_block12.txd/g_256.dds\",\"gta3.img/chicano10_lae.txd/g_256.dds\",\n \"gta3.img/sw_block9.txd/g_256.dds\",\"gta3.img/chicano10_lae.txd/g_256.dds\",\n \"gta3.img/idlewood6_detail.txd/frame_la.dds\",\"gta3.img/chicano10_lae.txd/frame_la.dds\",\n \"gta3.img/jeffers4_lae.txd/frame_la.dds\",\"gta3.img/chicano10_lae.txd/frame_la.dds\",\n \"gta3.img/laealpha.txd/frame_la.dds\",\"gta3.img/chicano10_lae.txd/frame_la.dds\",\n \"gta3.img/melrose06_lawn.txd/frame_la.dds\",\"gta3.img/chicano10_lae.txd/frame_la.dds\",\n \"gta3.img/motelalpha.txd/frame_la.dds\",\"gta3.img/chicano10_lae.txd/frame_la.dds\",\n \"gta3.img/mulhouslahills.txd/frame_la.dds\",\"gta3.img/chicano10_lae.txd/frame_la.dds\",\n \"gta3.img/roadstr_lae.txd/frame_la.dds\",\"gta3.img/chicano10_lae.txd/frame_la.dds\",\n \"gta3.img/sunstrans_law2.txd/frame_la.dds\",\"gta3.img/chicano10_lae.txd/frame_la.dds\",\n \"gta3.img/coast_apts.txd/comptwall32.dds\",\"gta3.img/chicano10_lae.txd/comptwall32.dds\",\n \"gta3.img/comedprj1_la.txd/comptwall32.dds\",\"gta3.img/chicano10_lae.txd/comptwall32.dds\",\n \"gta3.img/glenphouse_lax.txd/comptwall32.dds\",\"gta3.img/chicano10_lae.txd/comptwall32.dds\",\n \"gta3.img/projects_la.txd/comptwall32.dds\",\"gta3.img/chicano10_lae.txd/comptwall32.dds\",\n \"gta3.img/rodeo02_law2.txd/comptwall32.dds\",\"gta3.img/chicano10_lae.txd/comptwall32.dds\",\n \"gta3.img/sunrise04_lawn.txd/comptwall32.dds\",\"gta3.img/chicano10_lae.txd/comptwall32.dds\",\n \"gta3.img/sunset01_law2.txd/comptwall32.dds\",\"gta3.img/chicano10_lae.txd/comptwall32.dds\",\n \"gta3.img/comedbarrio1_la.txd/comptwall10.dds\",\"gta3.img/chicano10_lae.txd/comptwall10.dds\",\n \"gta3.img/comedhos1_la.txd/comptwall10.dds\",\"gta3.img/chicano10_lae.txd/comptwall10.dds\",\n \"gta3.img/compapart_la.txd/comptwall10.dds\",\"gta3.img/chicano10_lae.txd/comptwall10.dds\",\n \"gta3.img/des_ufoinn.txd/comptwall10.dds\",\"gta3.img/chicano10_lae.txd/comptwall10.dds\",\n \"gta3.img/eastbeach2a_lae2.txd/comptwall10.dds\",\"gta3.img/chicano10_lae.txd/comptwall10.dds\",\n \"gta3.img/furniture_lae2.txd/comptwall10.dds\",\"gta3.img/chicano10_lae.txd/comptwall10.dds\",\n \"gta3.img/glenphouse_lax.txd/comptwall10.dds\",\"gta3.img/chicano10_lae.txd/comptwall10.dds\",\n \"gta3.img/jeffers4_lae.txd/comptwall10.dds\",\"gta3.img/chicano10_lae.txd/comptwall10.dds\",\n \"gta3.img/sunrise09_lawn.txd/comptwall10.dds\",\"gta3.img/chicano10_lae.txd/comptwall10.dds\",\n \"gta3.img/templae2land.txd/comptwall10.dds\",\"gta3.img/chicano10_lae.txd/comptwall10.dds\",\n \"gta3.img/cuntrock.txd/rocktbrn128.dds\",\"gta3.img/chicano10_lae.txd/rocktbrn128.dds\",\n \"gta3.img/gta_rockcuntry.txd/rocktbrn128.dds\",\"gta3.img/chicano10_lae.txd/rocktbrn128.dds\",\n \"gta3.img/vgssland02.txd/rocktbrn128.dds\",\"gta3.img/chicano10_lae.txd/rocktbrn128.dds\",\n \"gta3.img/idlewood6_detail.txd/sunsfire1b_law.dds\",\"gta3.img/chicanotr1_lae.txd/sunsfire1b_law.dds\",\n \"gta3.img/melrose03_lawn.txd/sunsfire1b_law.dds\",\"gta3.img/chicanotr1_lae.txd/sunsfire1b_law.dds\",\n \"gta3.img/rodeo05_law2.txd/sunsfire1b_law.dds\",\"gta3.img/chicanotr1_lae.txd/sunsfire1b_law.dds\",\n \"gta3.img/sunrise05_lawn.txd/sunsfire1b_law.dds\",\"gta3.img/chicanotr1_lae.txd/sunsfire1b_law.dds\",\n \"gta3.img/idlewood6_detail.txd/sunsfire1_law.dds\",\"gta3.img/chicanotr1_lae.txd/sunsfire1_law.dds\",\n \"gta3.img/melrose03_lawn.txd/sunsfire1_law.dds\",\"gta3.img/chicanotr1_lae.txd/sunsfire1_law.dds\",\n \"gta3.img/rodeo05_law2.txd/sunsfire1_law.dds\",\"gta3.img/chicanotr1_lae.txd/sunsfire1_law.dds\",\n \"gta3.img/sunrise05_lawn.txd/sunsfire1_law.dds\",\"gta3.img/chicanotr1_lae.txd/sunsfire1_law.dds\",\n \"gta3.img/eastbeach8_lae2.txd/eb_firesc2_lae2.dds\",\"gta3.img/chicanotr1_lae.txd/eb_firesc2_lae2.dds\",\n \"gta3.img/ebeach_veg.txd/fireesc1_lae.dds\",\"gta3.img/chicanotr1_lae.txd/fireesc1_lae.dds\",\n \"gta3.img/lae2_alphabits.txd/fireesc1_lae.dds\",\"gta3.img/chicanotr1_lae.txd/fireesc1_lae.dds\",\n \"gta3.img/laealpha.txd/fireesc1_lae.dds\",\"gta3.img/chicanotr1_lae.txd/fireesc1_lae.dds\",\n \"gta3.img/lanfireesc_tr.txd/fireesc1_lae.dds\",\"gta3.img/chicanotr1_lae.txd/fireesc1_lae.dds\",\n \"gta3.img/eastbeach8_lae2.txd/eb_firesc1_lae2.dds\",\"gta3.img/chicanotr1_lae.txd/eb_firesc1_lae2.dds\",\n \"gta3.img/hashmarket1_sfs.txd/eb_firesc1_lae2.dds\",\"gta3.img/chicanotr1_lae.txd/eb_firesc1_lae2.dds\",\n \"gta3.img/sfw_victemp2.txd/ws_red_wood2.dds\",\"gta3.img/chinatown2.txd/ws_red_wood2.dds\",\n \"gta3.img/cuntwbtzzcs_t.txd/patio1.dds\",\"gta3.img/chinatown2.txd/patio1.dds\",\n \"gta3.img/des_dinerw.txd/patio1.dds\",\"gta3.img/chinatown2.txd/patio1.dds\",\n \"gta3.img/des_gunclub.txd/patio1.dds\",\"gta3.img/chinatown2.txd/patio1.dds\",\n \"gta3.img/des_stownmain3.txd/patio1.dds\",\"gta3.img/chinatown2.txd/patio1.dds\",\n \"gta3.img/lahillshilhs1b.txd/patio1.dds\",\"gta3.img/chinatown2.txd/patio1.dds\",\n \"gta3.img/lahillshilhs1d.txd/patio1.dds\",\"gta3.img/chinatown2.txd/patio1.dds\",\n \"gta3.img/lahillshilhs1x.txd/patio1.dds\",\"gta3.img/chinatown2.txd/patio1.dds\",\n \"gta3.img/lahillshilhs1z.txd/patio1.dds\",\"gta3.img/chinatown2.txd/patio1.dds\",\n \"gta3.img/lahillshilhse.txd/patio1.dds\",\"gta3.img/chinatown2.txd/patio1.dds\",\n \"gta3.img/melrose05_lawn.txd/patio1.dds\",\"gta3.img/chinatown2.txd/patio1.dds\",\n \"gta3.img/melrose08_lawn.txd/patio1.dds\",\"gta3.img/chinatown2.txd/patio1.dds\",\n \"gta3.img/sunrise04_lawn.txd/patio1.dds\",\"gta3.img/chinatown2.txd/patio1.dds\",\n \"gta3.img/sunrise08_lawn.txd/patio1.dds\",\"gta3.img/chinatown2.txd/patio1.dds\",\n \"gta3.img/sunsetbittyu.txd/patio1.dds\",\"gta3.img/chinatown2.txd/patio1.dds\",\n \"gta3.img/vgnfrates.txd/patio1.dds\",\"gta3.img/chinatown2.txd/patio1.dds\",\n \"gta3.img/vgnptrlpmp.txd/patio1.dds\",\"gta3.img/chinatown2.txd/patio1.dds\",\n \"gta3.img/vgntamotel.txd/patio1.dds\",\"gta3.img/chinatown2.txd/patio1.dds\",\n \"gta3.img/vgsewrehse.txd/patio1.dds\",\"gta3.img/chinatown2.txd/patio1.dds\",\n \"gta3.img/vgslowbuild.txd/patio1.dds\",\"gta3.img/chinatown2.txd/patio1.dds\",\n \"gta3.img/vgsswarehse02.txd/patio1.dds\",\"gta3.img/chinatown2.txd/patio1.dds\",\n \"gta3.img/dockcargo1_las.txd/ws_plasterwall2.dds\",\"gta3.img/chinatown2.txd/ws_plasterwall2.dds\",\n \"gta3.img/xenon_sfse.txd/ws_plasterwall2.dds\",\"gta3.img/chinatown2.txd/ws_plasterwall2.dds\",\n \"gta3.img/pointysfe.txd/ws_trans_window1.dds\",\"gta3.img/chinatown2.txd/ws_trans_window1.dds\",\n \"gta3.img/sfw_victemp2.txd/rooftiles4b.dds\",\"gta3.img/chinatown2.txd/rooftiles4b.dds\",\n \"gta3.img/sfw_victemp2.txd/rooftiles4.dds\",\"gta3.img/chinatown2.txd/rooftiles4.dds\",\n \"gta3.img/vgnretail2.txd/ziplogo1_128.dds\",\"gta3.img/chinatownmall.txd/ziplogo1_128.dds\",\n \"gta3.img/vgsshospshop.txd/ctmall16_128.dds\",\"gta3.img/chinatownmall.txd/ctmall16_128.dds\",\n \"gta3.img/copshop_sfe.txd/wallwash128.dds\",\"gta3.img/chinatownsfe.txd/wallwash128.dds\",\n \"gta3.img/pier69.txd/woozie_hall.dds\",\"gta3.img/chinatownsfe.txd/woozie_hall.dds\",\n \"gta3.img/fishwarf.txd/sf_windos_13a.dds\",\"gta3.img/chinatownsfe.txd/sf_windos_13a.dds\",\n \"gta3.img/smallertxd.txd/sf_windos_13a.dds\",\"gta3.img/chinatownsfe.txd/sf_windos_13a.dds\",\n \"gta3.img/cw_junkyardmachin.txd/was_scrpyd_baler_floor.dds\",\"gta3.img/chinatownsfe.txd/was_scrpyd_baler_floor.dds\",\n \"gta3.img/easthills_lahills.txd/was_scrpyd_baler_floor.dds\",\"gta3.img/chinatownsfe.txd/was_scrpyd_baler_floor.dds\",\n \"gta3.img/fishwarf.txd/sf_windos_11wall.dds\",\"gta3.img/chinatownsfe.txd/sf_windos_11wall.dds\",\n \"gta3.img/fishwarf.txd/sf_windos_11a.dds\",\"gta3.img/chinatownsfe.txd/sf_windos_11a.dds\",\n \"gta3.img/fishwarf.txd/sf_windos_13b.dds\",\"gta3.img/chinatownsfe.txd/sf_windos_13b.dds\",\n \"gta3.img/smallertxd.txd/sf_windos_13b.dds\",\"gta3.img/chinatownsfe.txd/sf_windos_13b.dds\",\n \"gta3.img/fishwarf.txd/sf_chinashopground.dds\",\"gta3.img/chinatownsfe.txd/sf_chinashopground.dds\",\n \"gta3.img/smallertxd.txd/sf_chinashopground.dds\",\"gta3.img/chinatownsfe.txd/sf_chinashopground.dds\",\n \"gta3.img/dtbuil1_lan2.txd/sf_chinashop1.dds\",\"gta3.img/chinatownsfe.txd/sf_chinashop1.dds\",\n \"gta3.img/fishwarf.txd/sf_chinashop1.dds\",\"gta3.img/chinatownsfe.txd/sf_chinashop1.dds\",\n \"gta3.img/smallertxd.txd/sf_chinashop1.dds\",\"gta3.img/chinatownsfe.txd/sf_chinashop1.dds\",\n \"gta3.img/sunset1_lan2.txd/sf_chinashop1.dds\",\"gta3.img/chinatownsfe.txd/sf_chinashop1.dds\",\n \"gta_int.img/sexdetail.txd/gun_chainsaw2.dds\",\"gta3.img/chnsaw.txd/gun_chainsaw2.dds\",\n \"gta3.img/des_ntown.txd/gravelkb_128.dds\",\"gta3.img/churchsfe.txd/gravelkb_128.dds\",\n \"gta3.img/des_stownstrip2.txd/gravelkb_128.dds\",\"gta3.img/churchsfe.txd/gravelkb_128.dds\",\n \"gta3.img/graveyard_sfs.txd/gravelkb_128.dds\",\"gta3.img/churchsfe.txd/gravelkb_128.dds\",\n \"gta3.img/vgndwntwn2.txd/gravelkb_128.dds\",\"gta3.img/churchsfe.txd/gravelkb_128.dds\",\n \"gta3.img/vgnusedcar.txd/gravelkb_128.dds\",\"gta3.img/churchsfe.txd/gravelkb_128.dds\",\n \"gta3.img/vgwestland.txd/gravelkb_128.dds\",\"gta3.img/churchsfe.txd/gravelkb_128.dds\",\n \"gta3.img/civic1_lan2.txd/posh_eagle3_sfe.dds\",\"gta3.img/churchsfe.txd/posh_eagle3_sfe.dds\",\n \"gta3.img/posh2_sfe.txd/posh_eagle3_sfe.dds\",\"gta3.img/churchsfe.txd/posh_eagle3_sfe.dds\",\n \"gta3.img/posh_sfe.txd/posh_eagle3_sfe.dds\",\"gta3.img/churchsfe.txd/posh_eagle3_sfe.dds\",\n \"gta3.img/civic1_lan2.txd/pier69_roof1.dds\",\"gta3.img/churchsfe.txd/pier69_roof1.dds\",\n \"gta3.img/pier69.txd/pier69_roof1.dds\",\"gta3.img/churchsfe.txd/pier69_roof1.dds\",\n \"gta3.img/posh_sfe.txd/pier69_roof1.dds\",\"gta3.img/churchsfe.txd/pier69_roof1.dds\",\n \"gta3.img/gta_brokentrees.txd/cj_bark.dds\",\"gta3.img/ciggarx.txd/cj_bark.dds\",\n \"gta3.img/player_props.txd/cj_bark.dds\",\"gta3.img/ciggarx.txd/cj_bark.dds\",\n \"gta_int.img/gf3.txd/cj_bark.dds\",\"gta3.img/ciggarx.txd/cj_bark.dds\",\n \"gta3.img/player_props.txd/cj_kitchdoor.dds\",\"gta3.img/ciggarx.txd/cj_kitchdoor.dds\",\n \"gta_int.img/cj_kitchen.txd/cj_kitchdoor.dds\",\"gta3.img/ciggarx.txd/cj_kitchdoor.dds\",\n \"gta_int.img/ryfurn2.txd/cj_kitchdoor.dds\",\"gta3.img/ciggarx.txd/cj_kitchdoor.dds\",\n \"gta3.img/ebeach_veg.txd/kb_ivy2_256.dds\",\"gta3.img/cinemart_alpha.txd/kb_ivy2_256.dds\",\n \"gta3.img/hosbibal2sfw.txd/kb_ivy2_256.dds\",\"gta3.img/cinemart_alpha.txd/kb_ivy2_256.dds\",\n \"gta3.img/hotelbackpool_sfs.txd/kb_ivy2_256.dds\",\"gta3.img/cinemart_alpha.txd/kb_ivy2_256.dds\",\n \"gta3.img/laealpha.txd/kb_ivy2_256.dds\",\"gta3.img/cinemart_alpha.txd/kb_ivy2_256.dds\",\n \"gta3.img/lahillstr_lawn.txd/kb_ivy2_128.dds\",\"gta3.img/cinemart_alpha.txd/kb_ivy2_256.dds\",\n \"gta3.img/lahills_wiresnshit3.txd/kb_ivy2_256.dds\",\"gta3.img/cinemart_alpha.txd/kb_ivy2_256.dds\",\n \"gta3.img/lawalphav.txd/kb_ivy2_256.dds\",\"gta3.img/cinemart_alpha.txd/kb_ivy2_256.dds\",\n \"gta3.img/lawnest2.txd/kb_ivy2_256.dds\",\"gta3.img/cinemart_alpha.txd/kb_ivy2_256.dds\",\n \"gta3.img/mullho03a_lahills.txd/kb_ivy2_256.dds\",\"gta3.img/cinemart_alpha.txd/kb_ivy2_256.dds\",\n \"gta3.img/stormd_filllas2.txd/kb_ivy2_256.dds\",\"gta3.img/cinemart_alpha.txd/kb_ivy2_256.dds\",\n \"gta3.img/stormd_fill.txd/kb_ivy2_256.dds\",\"gta3.img/cinemart_alpha.txd/kb_ivy2_256.dds\",\n \"gta_int.img/genintgeneric.txd/kb_ivy2_256.dds\",\"gta3.img/cinemart_alpha.txd/kb_ivy2_256.dds\",\n \"gta3.img/lae2_alphabits.txd/shadow_law.dds\",\"gta3.img/cinemart_alpha.txd/shadow_law.dds\",\n \"gta3.img/lae2coast_alpha.txd/shadow_law.dds\",\"gta3.img/cinemart_alpha.txd/shadow_law.dds\",\n \"gta3.img/desn2_roadbloks.txd/warnsigns2.dds\",\"gta3.img/ci_studio1.txd/warnsigns2.dds\",\n \"gta3.img/desn2_roadbloks.txd/warnsigns1.dds\",\"gta3.img/ci_studio1.txd/warnsigns1.dds\",\n \"gta3.img/des_stownmain1.txd/corugwall1.dds\",\"gta3.img/ci_studio5.txd/corugwall1.dds\",\n \"gta3.img/des_stownmots1.txd/corugwall1.dds\",\"gta3.img/ci_studio5.txd/corugwall1.dds\",\n \"gta3.img/des_stownstrip2.txd/corugwall1.dds\",\"gta3.img/ci_studio5.txd/corugwall1.dds\",\n \"gta3.img/hrbr_sfn.txd/corugwall1.dds\",\"gta3.img/ci_studio5.txd/corugwall1.dds\",\n \"gta3.img/lasroads_las.txd/corugwall1.dds\",\"gta3.img/ci_studio5.txd/corugwall1.dds\",\n \"gta3.img/sfn_helipad.txd/corugwall1.dds\",\"gta3.img/ci_studio5.txd/corugwall1.dds\",\n \"gta3.img/sw_fact01a.txd/corugwall1.dds\",\"gta3.img/ci_studio5.txd/corugwall1.dds\",\n \"gta3.img/sw_office.txd/corugwall1.dds\",\"gta3.img/ci_studio5.txd/corugwall1.dds\",\n \"gta3.img/vegaswrehse1.txd/corugwall1.dds\",\"gta3.img/ci_studio5.txd/corugwall1.dds\",\n \"gta3.img/venicegb02_law.txd/corugwall1.dds\",\"gta3.img/ci_studio5.txd/corugwall1.dds\",\n \"gta3.img/vgnabatoir.txd/corugwall1.dds\",\"gta3.img/ci_studio5.txd/corugwall1.dds\",\n \"gta3.img/vgnretail4.txd/corugwall1.dds\",\"gta3.img/ci_studio5.txd/corugwall1.dds\",\n \"gta3.img/ci_studio.txd/bdoor.dds\",\"gta3.img/ci_studio5.txd/bdoor.dds\",\n \"gta3.img/ci_studio.txd/stageside1.dds\",\"gta3.img/ci_studio5.txd/stageside1.dds\",\n \"gta3.img/filmstud.txd/stageside1.dds\",\"gta3.img/ci_studio5.txd/stageside1.dds\",\n \"gta3.img/ci_studio.txd/studioroof.dds\",\"gta3.img/ci_studio5.txd/studioroof.dds\",\n \"gta3.img/tvstudio_law2.txd/studioroof.dds\",\"gta3.img/ci_studio5.txd/studioroof.dds\",\n \"gta3.img/ci_studio.txd/aircon.dds\",\"gta3.img/ci_studio5.txd/aircon.dds\",\n \"gta3.img/richman02_lahills.txd/studiowall2_law.dds\",\"gta3.img/ci_studio5.txd/studiowall2_law.dds\",\n \"gta3.img/sw_block04.txd/studiowall2_law.dds\",\"gta3.img/ci_studio5.txd/studiowall2_law.dds\",\n \"gta_int.img/ab_vegasgymmain.txd/studiowall2_law.dds\",\"gta3.img/ci_studio5.txd/studiowall2_law.dds\",\n \"gta_int.img/genintint2_gym.txd/studiowall2_law.dds\",\"gta3.img/ci_studio5.txd/studiowall2_law.dds\",\n \"gta3.img/filmstud.txd/studoor01_law.dds\",\"gta3.img/ci_studio5.txd/studoor01_law.dds\",\n \"gta3.img/laeast2_lod.txd/bow_abpavegen_lod.dds\",\"gta3.img/cistudiolod2.txd/bow_abpavegen_lod.dds\",\n \"gta3.img/lod2lae1.txd/bow_abpavegen_lod.dds\",\"gta3.img/cistudiolod2.txd/bow_abpavegen_lod.dds\",\n \"gta3.img/lod_las2.txd/bow_abpavegen_lod.dds\",\"gta3.img/cistudiolod2.txd/bow_abpavegen_lod.dds\",\n \"gta3.img/lodlawnsmall.txd/bow_abpavegen_lod.dds\",\"gta3.img/cistudiolod2.txd/bow_abpavegen_lod.dds\",\n \"gta3.img/lodvgwstcoast.txd/bow_abpavegen_lod.dds\",\"gta3.img/cistudiolod2.txd/bow_abpavegen_lod.dds\",\n \"gta3.img/lodlawnsmall.txd/lodci_stud3.dds\",\"gta3.img/cistudiolod2.txd/lodci_stud3.dds\",\n \"gta3.img/lodlawnsmall.txd/lodci_stud2.dds\",\"gta3.img/cistudiolod2.txd/lodci_stud2.dds\",\n \"gta3.img/lodlawnsmall.txd/lodci_stud1.dds\",\"gta3.img/cistudiolod2.txd/lodci_stud1.dds\",\n \"gta3.img/lodlawnsmall.txd/studroof_lod.dds\",\"gta3.img/cistudiolod2.txd/studroof_lod.dds\",\n \"gta3.img/civic07_lan.txd/cityhallroof.dds\",\"gta3.img/cityhall_lan.txd/cityhallroof.dds\",\n \"gta3.img/downtown1_las.txd/cityhallroof.dds\",\"gta3.img/cityhall_lan.txd/cityhallroof.dds\",\n \"gta3.img/downtown_las.txd/cityhalltow1.dds\",\"gta3.img/cityhall_lan.txd/cityhalltow1.dds\",\n \"gta3.img/tikimotel.txd/lacityhwal1.dds\",\"gta3.img/cityhall_lan.txd/lacityhwal1.dds\",\n \"gta3.img/dem4_sfxrf.txd/man_cellarfloor128.dds\",\"gta3.img/cityhall_lan.txd/man_cellarfloor128.dds\",\n \"gta3.img/glenpark6d_lae.txd/man_cellarfloor128.dds\",\"gta3.img/cityhall_lan.txd/man_cellarfloor128.dds\",\n \"gta3.img/hospital_lae.txd/man_cellarfloor128.dds\",\"gta3.img/cityhall_lan.txd/man_cellarfloor128.dds\",\n \"gta3.img/hubint1_sfse.txd/man_cellarfloor128.dds\",\"gta3.img/cityhall_lan.txd/man_cellarfloor128.dds\",\n \"gta3.img/lahillshilhs1c.txd/man_cellarfloor128.dds\",\"gta3.img/cityhall_lan.txd/man_cellarfloor128.dds\",\n \"gta3.img/lawngrnd.txd/man_cellarfloor128.dds\",\"gta3.img/cityhall_lan.txd/man_cellarfloor128.dds\",\n \"gta3.img/civic01_lan.txd/sl_labedingsoil.dds\",\"gta3.img/cityhall_lan.txd/sl_labedingsoil.dds\",\n \"gta3.img/civic1_lan2.txd/sl_labedingsoil.dds\",\"gta3.img/cityhall_lan.txd/sl_labedingsoil.dds\",\n \"gta3.img/lanblokb2.txd/sl_labedingsoil.dds\",\"gta3.img/cityhall_lan.txd/sl_labedingsoil.dds\",\n \"gta3.img/lanblokc.txd/sl_labedingsoil.dds\",\"gta3.img/cityhall_lan.txd/sl_labedingsoil.dds\",\n \"gta3.img/lanblokg.txd/sl_labedingsoil.dds\",\"gta3.img/cityhall_lan.txd/sl_labedingsoil.dds\",\n \"gta3.img/lanlacma_lan2.txd/sl_labedingsoil.dds\",\"gta3.img/cityhall_lan.txd/sl_labedingsoil.dds\",\n \"gta3.img/lanriver.txd/sl_labedingsoil.dds\",\"gta3.img/cityhall_lan.txd/sl_labedingsoil.dds\",\n \"gta3.img/plaza1_lan2.txd/sl_labedingsoil.dds\",\"gta3.img/cityhall_lan.txd/sl_labedingsoil.dds\",\n \"gta3.img/stolenbuild01.txd/sl_labedingsoil.dds\",\"gta3.img/cityhall_lan.txd/sl_labedingsoil.dds\",\n \"gta3.img/stolenbuild03.txd/sl_labedingsoil.dds\",\"gta3.img/cityhall_lan.txd/sl_labedingsoil.dds\",\n \"gta3.img/theatrelan2.txd/sl_labedingsoil.dds\",\"gta3.img/cityhall_lan.txd/sl_labedingsoil.dds\",\n \"gta_int.img/civic02cj.txd/sl_labedingsoil.dds\",\"gta3.img/cityhall_lan.txd/sl_labedingsoil.dds\",\n \"gta3.img/lanbloke.txd/citywall2.dds\",\"gta3.img/cityhall_lan.txd/citywall2.dds\",\n \"gta3.img/civic07_lan.txd/citywin1.dds\",\"gta3.img/cityhall_lan.txd/citywin1.dds\",\n \"gta3.img/downtown1_las.txd/citywin1.dds\",\"gta3.img/cityhall_lan.txd/citywin1.dds\",\n \"gta3.img/lae2bigblock.txd/citywin1.dds\",\"gta3.img/cityhall_lan.txd/citywin1.dds\",\n \"gta3.img/lanblokd.txd/citywall1.dds\",\"gta3.img/cityhall_lan.txd/citywall1.dds\",\n \"gta3.img/sunrise04_lawn.txd/citywall1.dds\",\"gta3.img/cityhall_lan.txd/citywall1.dds\",\n \"gta3.img/sunrise11_lawn.txd/citywall1.dds\",\"gta3.img/cityhall_lan.txd/citywall1.dds\",\n \"gta3.img/csrspalace02.txd/bevdoor03_law.dds\",\"gta3.img/cityhall_lan.txd/bevdoor03_law.dds\",\n \"gta3.img/eastbeach09_lae2.txd/bevdoor03_law.dds\",\"gta3.img/cityhall_lan.txd/bevdoor03_law.dds\",\n \"gta3.img/ebeachcineblok.txd/bevdoor03_law.dds\",\"gta3.img/cityhall_lan.txd/bevdoor03_law.dds\",\n \"gta3.img/lanblokb.txd/bevdoor03_law.dds\",\"gta3.img/cityhall_lan.txd/bevdoor03_law.dds\",\n \"gta3.img/rodeo01_law2.txd/bevdoor03_law.dds\",\"gta3.img/cityhall_lan.txd/bevdoor03_law.dds\",\n \"gta3.img/sw_doors.txd/bevdoor03_law.dds\",\"gta3.img/cityhall_lan.txd/bevdoor03_law.dds\",\n \"gta_int.img/mafcasmain.txd/bevdoor03_law.dds\",\"gta3.img/cityhall_lan.txd/bevdoor03_law.dds\",\n \"gta3.img/cityhall_sfs.txd/ws_cityhall3.dds\",\"gta3.img/cityhall_sfse.txd/ws_cityhall3.dds\",\n \"gta3.img/hotel2_sfs.txd/ws_cityhall3.dds\",\"gta3.img/cityhall_sfse.txd/ws_cityhall3.dds\",\n \"gta3.img/mission3_sfse.txd/ws_cityhall3.dds\",\"gta3.img/cityhall_sfse.txd/ws_cityhall3.dds\",\n \"gta3.img/mission_sfse.txd/ws_cityhall3.dds\",\"gta3.img/cityhall_sfse.txd/ws_cityhall3.dds\",\n \"gta3.img/officy_sfs.txd/ws_cityhall3.dds\",\"gta3.img/cityhall_sfse.txd/ws_cityhall3.dds\",\n \"gta3.img/queens1_sfs.txd/ws_cityhall3.dds\",\"gta3.img/cityhall_sfse.txd/ws_cityhall3.dds\",\n \"gta3.img/queens3_sfs.txd/ws_cityhall3.dds\",\"gta3.img/cityhall_sfse.txd/ws_cityhall3.dds\",\n \"gta3.img/shops_sfse.txd/ws_cityhall3.dds\",\"gta3.img/cityhall_sfse.txd/ws_cityhall3.dds\",\n \"gta3.img/cityhall_sfs.txd/ws_cityhall4.dds\",\"gta3.img/cityhall_sfse.txd/ws_cityhall4.dds\",\n \"gta3.img/hotel2_sfs.txd/ws_cityhall4.dds\",\"gta3.img/cityhall_sfse.txd/ws_cityhall4.dds\",\n \"gta3.img/officy_sfs.txd/ws_cityhall4.dds\",\"gta3.img/cityhall_sfse.txd/ws_cityhall4.dds\",\n \"gta3.img/queens1_sfs.txd/ws_cityhall4.dds\",\"gta3.img/cityhall_sfse.txd/ws_cityhall4.dds\",\n \"gta3.img/cityhall_sfs.txd/ws_cityhall5.dds\",\"gta3.img/cityhall_sfse.txd/ws_cityhall5.dds\",\n \"gta3.img/hotel2_sfs.txd/ws_cityhall5.dds\",\"gta3.img/cityhall_sfse.txd/ws_cityhall5.dds\",\n \"gta3.img/officy_sfs.txd/ws_cityhall5.dds\",\"gta3.img/cityhall_sfse.txd/ws_cityhall5.dds\",\n \"gta3.img/shops_sfse.txd/ws_cityhall5.dds\",\"gta3.img/cityhall_sfse.txd/ws_cityhall5.dds\",\n \"gta3.img/officy_sfs.txd/ws_oldoffice7.dds\",\"gta3.img/cityhall_sfse.txd/ws_oldoffice7.dds\",\n \"gta3.img/shops_sfse.txd/ws_oldoffice7.dds\",\"gta3.img/cityhall_sfse.txd/ws_oldoffice7.dds\",\n \"gta3.img/officy_sfs.txd/ws_oldoffice6.dds\",\"gta3.img/cityhall_sfse.txd/ws_oldoffice6.dds\",\n \"gta3.img/officy_sfs.txd/ws_oldoffice5.dds\",\"gta3.img/cityhall_sfse.txd/ws_oldoffice5.dds\",\n \"gta3.img/queens1_sfs.txd/ws_artgallery3.dds\",\"gta3.img/cityhall_sfs.txd/ws_artgallery3.dds\",\n \"gta3.img/hotel2_sfs.txd/ws_artgallery.dds\",\"gta3.img/cityhall_sfs.txd/ws_artgallery.dds\",\n \"gta3.img/queens1_sfs.txd/ws_artgallery.dds\",\"gta3.img/cityhall_sfs.txd/ws_artgallery.dds\",\n \"gta3.img/gardencentre_sfs.txd/ws_concretenew_step.dds\",\"gta3.img/cityhall_sfs.txd/ws_concretenew_step.dds\",\n \"gta3.img/parktunnel_sfs.txd/ws_concretenew_step.dds\",\"gta3.img/cityhall_sfs.txd/ws_concretenew_step.dds\",\n \"gta3.img/stadium_sfse.txd/ws_concretenew_step.dds\",\"gta3.img/cityhall_sfs.txd/ws_concretenew_step.dds\",\n \"gta3.img/station_sfse.txd/ws_concretenew_step.dds\",\"gta3.img/cityhall_sfs.txd/ws_concretenew_step.dds\",\n \"gta3.img/sunset02_law2.txd/ws_oldoffice2.dds\",\"gta3.img/cityhall_sfs.txd/ws_oldoffice2.dds\",\n \"gta3.img/hotel2_sfs.txd/ws_oldoffice4.dds\",\"gta3.img/cityhall_sfs.txd/ws_oldoffice4.dds\",\n \"gta3.img/pyr_roof.txd/banding4_64hv.dds\",\"gta3.img/cityhall_sfs.txd/banding4_64hv.dds\",\n \"gta3.img/hotel2_sfs.txd/ws_cityhall2.dds\",\"gta3.img/cityhall_sfs.txd/ws_cityhall2.dds\",\n \"gta3.img/coast_apts.txd/ws_bigblackdoor.dds\",\"gta3.img/cityhall_sfs.txd/ws_bigblackdoor.dds\",\n \"gta3.img/dingbat01_la.txd/ws_bigblackdoor.dds\",\"gta3.img/cityhall_sfs.txd/ws_bigblackdoor.dds\",\n \"gta3.img/hotel1.txd/ws_bigblackdoor.dds\",\"gta3.img/cityhall_sfs.txd/ws_bigblackdoor.dds\",\n \"gta3.img/lanblokb2.txd/ws_bigblackdoor.dds\",\"gta3.img/cityhall_sfs.txd/ws_bigblackdoor.dds\",\n \"gta3.img/subshops_sfs.txd/ws_bigblackdoor.dds\",\"gta3.img/cityhall_sfs.txd/ws_bigblackdoor.dds\",\n \"gta3.img/ws_d1.txd/ws_bigblackdoor.dds\",\"gta3.img/cityhall_sfs.txd/ws_bigblackdoor.dds\",\n \"gta3.img/civic02_lan.txd/foliage256.dds\",\"gta3.img/cityhall_tr_lan.txd/foliage256.dds\",\n \"gta3.img/laealpha.txd/foliage256.dds\",\"gta3.img/cityhall_tr_lan.txd/foliage256.dds\",\n \"gta3.img/lawnbush.txd/foliage256.dds\",\"gta3.img/cityhall_tr_lan.txd/foliage256.dds\",\n \"gta3.img/veg_fuzzyplant.txd/foliage256.dds\",\"gta3.img/cityhall_tr_lan.txd/foliage256.dds\",\n \"gta3.img/vgsebushes.txd/foliage256.dds\",\"gta3.img/cityhall_tr_lan.txd/foliage256.dds\",\n \"gta3.img/civic01_lan.txd/planta256.dds\",\"gta3.img/cityhall_tr_lan.txd/planta256.dds\",\n \"gta3.img/civic02_lan.txd/planta256.dds\",\"gta3.img/cityhall_tr_lan.txd/planta256.dds\",\n \"gta3.img/fosterflowers.txd/planta256.dds\",\"gta3.img/cityhall_tr_lan.txd/planta256.dds\",\n \"gta3.img/lae2coast_alpha.txd/planta256.dds\",\"gta3.img/cityhall_tr_lan.txd/planta256.dds\",\n \"gta3.img/vgnglfcrse1.txd/planta256.dds\",\"gta3.img/cityhall_tr_lan.txd/planta256.dds\",\n \"gta3.img/vgsn_nitree.txd/planta256.dds\",\"gta3.img/cityhall_tr_lan.txd/planta256.dds\",\n \"gta3.img/fosterflowers.txd/starflower4.dds\",\"gta3.img/cityhall_tr_lan.txd/starflower4.dds\",\n \"gta3.img/laealpha.txd/starflower4.dds\",\"gta3.img/cityhall_tr_lan.txd/starflower4.dds\",\n \"gta3.img/rodeo04_law2.txd/starflower4.dds\",\"gta3.img/cityhall_tr_lan.txd/starflower4.dds\",\n \"gta3.img/sfxref.txd/starflower4.dds\",\"gta3.img/cityhall_tr_lan.txd/starflower4.dds\",\n \"gta3.img/triadbush_lvs.txd/starflower4.dds\",\"gta3.img/cityhall_tr_lan.txd/starflower4.dds\",\n \"gta3.img/vegashse5.txd/starflower4.dds\",\"gta3.img/cityhall_tr_lan.txd/starflower4.dds\",\n \"gta3.img/vegashse6.txd/starflower4.dds\",\"gta3.img/cityhall_tr_lan.txd/starflower4.dds\",\n \"gta3.img/vegashse7.txd/starflower4.dds\",\"gta3.img/cityhall_tr_lan.txd/starflower4.dds\",\n \"gta3.img/vegassvehse7.txd/starflower4.dds\",\"gta3.img/cityhall_tr_lan.txd/starflower4.dds\",\n \"gta3.img/vegstadplants.txd/starflower4.dds\",\"gta3.img/cityhall_tr_lan.txd/starflower4.dds\",\n \"gta3.img/vgndwntwn2.txd/starflower4.dds\",\"gta3.img/cityhall_tr_lan.txd/starflower4.dds\",\n \"gta3.img/vgnglfcrse1.txd/starflower4.dds\",\"gta3.img/cityhall_tr_lan.txd/starflower4.dds\",\n \"gta3.img/vgsebushes.txd/starflower4.dds\",\"gta3.img/cityhall_tr_lan.txd/starflower4.dds\",\n \"gta3.img/vgseflowers.txd/starflower4.dds\",\"gta3.img/cityhall_tr_lan.txd/starflower4.dds\",\n \"gta3.img/vgsn_flowers.txd/starflower4.dds\",\"gta3.img/cityhall_tr_lan.txd/starflower4.dds\",\n \"gta3.img/fosterflowers.txd/starflower2.dds\",\"gta3.img/cityhall_tr_lan.txd/starflower2.dds\",\n \"gta3.img/laealpha.txd/starflower2.dds\",\"gta3.img/cityhall_tr_lan.txd/starflower2.dds\",\n \"gta3.img/lawalphav.txd/starflower2.dds\",\"gta3.img/cityhall_tr_lan.txd/starflower2.dds\",\n \"gta3.img/sfeship1.txd/starflower2.dds\",\"gta3.img/cityhall_tr_lan.txd/starflower2.dds\",\n \"gta3.img/sfxref.txd/starflower2.dds\",\"gta3.img/cityhall_tr_lan.txd/starflower2.dds\",\n \"gta3.img/sunstrans_law2.txd/starflower2.dds\",\"gta3.img/cityhall_tr_lan.txd/starflower2.dds\",\n \"gta3.img/triadbush_lvs.txd/starflower2.dds\",\"gta3.img/cityhall_tr_lan.txd/starflower2.dds\",\n \"gta3.img/vegashse2.txd/starflower2.dds\",\"gta3.img/cityhall_tr_lan.txd/starflower2.dds\",\n \"gta3.img/vegashse5.txd/starflower2.dds\",\"gta3.img/cityhall_tr_lan.txd/starflower2.dds\",\n \"gta3.img/vegashse6.txd/starflower2.dds\",\"gta3.img/cityhall_tr_lan.txd/starflower2.dds\",\n \"gta3.img/vegashse7.txd/starflower2.dds\",\"gta3.img/cityhall_tr_lan.txd/starflower2.dds\",\n \"gta3.img/vegassvehse7.txd/starflower2.dds\",\"gta3.img/cityhall_tr_lan.txd/starflower2.dds\",\n \"gta3.img/vegstadplants.txd/starflower2.dds\",\"gta3.img/cityhall_tr_lan.txd/starflower2.dds\",\n \"gta3.img/vgndwntwn2.txd/starflower2.dds\",\"gta3.img/cityhall_tr_lan.txd/starflower2.dds\",\n \"gta3.img/vgnglfcrse1.txd/starflower2.dds\",\"gta3.img/cityhall_tr_lan.txd/starflower2.dds\",\n \"gta3.img/vgsebushes.txd/starflower2.dds\",\"gta3.img/cityhall_tr_lan.txd/starflower2.dds\",\n \"gta3.img/vgseflowers.txd/starflower2.dds\",\"gta3.img/cityhall_tr_lan.txd/starflower2.dds\",\n \"gta_int.img/plants_tabletop.txd/starflower2.dds\",\"gta3.img/cityhall_tr_lan.txd/starflower2.dds\",\n \"gta_int.img/vegassavesmal.txd/starflower2.dds\",\"gta3.img/cityhall_tr_lan.txd/starflower2.dds\",\n \"gta3.img/sunstr_lawn.txd/mc_flags1.dds\",\"gta3.img/cityhall_tr_lan.txd/mc_flags1.dds\",\n \"gta3.img/glenpark7_lae.txd/sl_laexporail.dds\",\"gta3.img/civic01_lan.txd/sl_laexporail.dds\",\n \"gta3.img/stapl.txd/sl_laexporail.dds\",\"gta3.img/civic01_lan.txd/sl_laexporail.dds\",\n \"gta3.img/lanblokc.txd/sl_laoffblok2wall1.dds\",\"gta3.img/civic01_lan.txd/sl_laoffblok2wall1.dds\",\n \"gta3.img/countryclub_sfs.txd/crazy=paving.dds\",\"gta3.img/civic01_lan.txd/crazy=paving.dds\",\n \"gta3.img/cuntclub_law2.txd/crazy=paving.dds\",\"gta3.img/civic01_lan.txd/crazy=paving.dds\",\n \"gta3.img/hotel1.txd/crazy=paving.dds\",\"gta3.img/civic01_lan.txd/crazy=paving.dds\",\n \"gta3.img/hotelback_sfs.txd/crazy=paving.dds\",\"gta3.img/civic01_lan.txd/crazy=paving.dds\",\n \"gta3.img/law_beach2.txd/crazy=paving.dds\",\"gta3.img/civic01_lan.txd/crazy=paving.dds\",\n \"gta3.img/lomall.txd/crazy=paving.dds\",\"gta3.img/civic01_lan.txd/crazy=paving.dds\",\n \"gta3.img/mountainsfs.txd/crazy=paving.dds\",\"gta3.img/civic01_lan.txd/crazy=paving.dds\",\n \"gta_int.img/civic02cj.txd/crazy=paving.dds\",\"gta3.img/civic01_lan.txd/crazy=paving.dds\",\n \"gta3.img/fighot.txd/sl_dwntwnshpfrnt1.dds\",\"gta3.img/civic01_lan.txd/sl_dwntwnshpfrnt1.dds\",\n \"gta3.img/lanblokb2.txd/sl_dwntwnshpfrnt1.dds\",\"gta3.img/civic01_lan.txd/sl_dwntwnshpfrnt1.dds\",\n \"gta3.img/lanblokc.txd/sl_dwntwnshpfrnt1.dds\",\"gta3.img/civic01_lan.txd/sl_dwntwnshpfrnt1.dds\",\n \"gta3.img/skyscr1_lan2.txd/sl_dwntwnshpfrnt1.dds\",\"gta3.img/civic01_lan.txd/sl_dwntwnshpfrnt1.dds\",\n \"gta3.img/skyscrap2_lan2.txd/sl_dwntwnshpfrnt1.dds\",\"gta3.img/civic01_lan.txd/sl_dwntwnshpfrnt1.dds\",\n \"gta3.img/stolenbuild03.txd/sl_dwntwnshpfrnt1.dds\",\"gta3.img/civic01_lan.txd/sl_dwntwnshpfrnt1.dds\",\n \"gta3.img/cos_bankroofs.txd/nt_bonav1.dds\",\"gta3.img/civic01_lan.txd/nt_bonav1.dds\",\n \"gta3.img/dingbat01_la.txd/nt_bonav1.dds\",\"gta3.img/civic01_lan.txd/nt_bonav1.dds\",\n \"gta3.img/skyscrapelan2.txd/nt_bonav1.dds\",\"gta3.img/civic01_lan.txd/nt_bonav1.dds\",\n \"gta3.img/des_nw.txd/parking1plain.dds\",\"gta3.img/civic01_lan.txd/parking1plain.dds\",\n \"gta3.img/des_se1.txd/parking1plain.dds\",\"gta3.img/civic01_lan.txd/parking1plain.dds\",\n \"gta3.img/lanblokb2.txd/parking1plain.dds\",\"gta3.img/civic01_lan.txd/parking1plain.dds\",\n \"gta3.img/lanbloke.txd/parking1plain.dds\",\"gta3.img/civic01_lan.txd/parking1plain.dds\",\n \"gta3.img/lawnxref.txd/parking1plain.dds\",\"gta3.img/civic01_lan.txd/parking1plain.dds\",\n \"gta3.img/civic04_lan.txd/sl_dwntwndr1.dds\",\"gta3.img/civic01_lan.txd/sl_dwntwndr1.dds\",\n \"gta3.img/fighot.txd/sl_dwntwndr1.dds\",\"gta3.img/civic01_lan.txd/sl_dwntwndr1.dds\",\n \"gta3.img/lanblokb2.txd/sl_dwntwndr1.dds\",\"gta3.img/civic01_lan.txd/sl_dwntwndr1.dds\",\n \"gta3.img/lanblokc.txd/sl_dwntwndr1.dds\",\"gta3.img/civic01_lan.txd/sl_dwntwndr1.dds\",\n \"gta3.img/sfe_builda.txd/sl_dwntwndr1.dds\",\"gta3.img/civic01_lan.txd/sl_dwntwndr1.dds\",\n \"gta3.img/skyscr1_lan2.txd/sl_dwntwndr1.dds\",\"gta3.img/civic01_lan.txd/sl_dwntwndr1.dds\",\n \"gta3.img/skyscrap2_lan2.txd/sl_dwntwndr1.dds\",\"gta3.img/civic01_lan.txd/sl_dwntwndr1.dds\",\n \"gta3.img/stolenbuild01.txd/sl_dwntwndr1.dds\",\"gta3.img/civic01_lan.txd/sl_dwntwndr1.dds\",\n \"gta3.img/stolenbuild03.txd/sl_dwntwndr1.dds\",\"gta3.img/civic01_lan.txd/sl_dwntwndr1.dds\",\n \"gta3.img/lanriver.txd/sl_flagstone1.dds\",\"gta3.img/civic01_lan.txd/sl_flagstone1.dds\",\n \"gta3.img/slapart01sfe.txd/sl_flagstone1.dds\",\"gta3.img/civic01_lan.txd/sl_flagstone1.dds\",\n \"gta3.img/stapl.txd/sl_flagstone1.dds\",\"gta3.img/civic01_lan.txd/sl_flagstone1.dds\",\n \"gta3.img/lanblokg.txd/sl_concretewall1.dds\",\"gta3.img/civic01_lan.txd/sl_concretewall1.dds\",\n \"gta3.img/lanroad.txd/sl_concretewall1.dds\",\"gta3.img/civic01_lan.txd/sl_concretewall1.dds\",\n \"gta3.img/plaza1_lan2.txd/sl_concretewall1.dds\",\"gta3.img/civic01_lan.txd/sl_concretewall1.dds\",\n \"gta3.img/skyscr1_lan2.txd/sl_concretewall1.dds\",\"gta3.img/civic01_lan.txd/sl_concretewall1.dds\",\n \"gta3.img/skyscrapelan2.txd/sl_concretewall1.dds\",\"gta3.img/civic01_lan.txd/sl_concretewall1.dds\",\n \"gta3.img/stolenbuild02.txd/sl_concretewall1.dds\",\"gta3.img/civic01_lan.txd/sl_concretewall1.dds\",\n \"gta3.img/stolenbuild03.txd/sl_concretewall1.dds\",\"gta3.img/civic01_lan.txd/sl_concretewall1.dds\",\n \"gta3.img/hosbibal2sfw.txd/kb_balcony_ferns.dds\",\"gta3.img/civic02_lan.txd/kb_balcony_ferns.dds\",\n \"gta_int.img/genintgeneric.txd/kb_balcony_ferns.dds\",\"gta3.img/civic02_lan.txd/kb_balcony_ferns.dds\",\n \"gta3.img/lanblokb2.txd/sl_shopshttr1.dds\",\"gta3.img/civic03_lan.txd/sl_shopshttr1.dds\",\n \"gta3.img/lanblokb.txd/sl_shopshttr1.dds\",\"gta3.img/civic03_lan.txd/sl_shopshttr1.dds\",\n \"gta3.img/melrose03_lawn.txd/downtsign8_la.dds\",\"gta3.img/civic03_lan.txd/downtsign8_la.dds\",\n \"gta3.img/sunrise11_lawn.txd/downtshop6_lan.dds\",\"gta3.img/civic03_lan.txd/downtshop6_lan.dds\",\n \"gta3.img/civic06_lan.txd/downtshop5_lan.dds\",\"gta3.img/civic03_lan.txd/downtshop5_lan.dds\",\n \"gta3.img/gymblok2_lae2.txd/downtshop5_lan.dds\",\"gta3.img/civic03_lan.txd/downtshop5_lan.dds\",\n \"gta3.img/lae2bigblock.txd/downtshop5_lan.dds\",\"gta3.img/civic03_lan.txd/downtshop5_lan.dds\",\n \"gta3.img/mainlcawn.txd/downtshop5_lan.dds\",\"gta3.img/civic03_lan.txd/downtshop5_lan.dds\",\n \"gta3.img/melrose19_lawn.txd/downtshop5_lan.dds\",\"gta3.img/civic03_lan.txd/downtshop5_lan.dds\",\n \"gta3.img/sunrise09_lawn.txd/downtshop5_lan.dds\",\"gta3.img/civic03_lan.txd/downtshop5_lan.dds\",\n \"gta3.img/ebeachcineblok.txd/downtsign2_la.dds\",\"gta3.img/civic03_lan.txd/downtsign2_la.dds\",\n \"gta3.img/lashops1_las2.txd/downtsign2_la.dds\",\"gta3.img/civic03_lan.txd/downtsign2_la.dds\",\n \"gta3.img/melrose11_lawn.txd/downtsign2_la.dds\",\"gta3.img/civic03_lan.txd/downtsign2_la.dds\",\n \"gta3.img/civic06_lan.txd/downtshop2_lan.dds\",\"gta3.img/civic03_lan.txd/downtshop2_lan.dds\",\n \"gta3.img/downtown3_las.txd/downtshop2_lan.dds\",\"gta3.img/civic03_lan.txd/downtshop2_lan.dds\",\n \"gta3.img/ebeachcineblok.txd/downtshop2_lan.dds\",\"gta3.img/civic03_lan.txd/downtshop2_lan.dds\",\n \"gta3.img/lanbloka.txd/downtshop2_lan.dds\",\"gta3.img/civic03_lan.txd/downtshop2_lan.dds\",\n \"gta3.img/lanblokb2.txd/downtshop2_lan.dds\",\"gta3.img/civic03_lan.txd/downtshop2_lan.dds\",\n \"gta3.img/lanblokb.txd/downtshop2_lan.dds\",\"gta3.img/civic03_lan.txd/downtshop2_lan.dds\",\n \"gta3.img/lashops1b_las2.txd/downtshop2_lan.dds\",\"gta3.img/civic03_lan.txd/downtshop2_lan.dds\",\n \"gta3.img/lashops1_las2.txd/downtshop2_lan.dds\",\"gta3.img/civic03_lan.txd/downtshop2_lan.dds\",\n \"gta3.img/lngblok_lae2.txd/downtshop2_lan.dds\",\"gta3.img/civic03_lan.txd/downtshop2_lan.dds\",\n \"gta3.img/mainlcawn.txd/downtshop2_lan.dds\",\"gta3.img/civic03_lan.txd/downtshop2_lan.dds\",\n \"gta3.img/melrose03_lawn.txd/downtshop2_lan.dds\",\"gta3.img/civic03_lan.txd/downtshop2_lan.dds\",\n \"gta3.img/melrose11_lawn.txd/downtshop2_lan.dds\",\"gta3.img/civic03_lan.txd/downtshop2_lan.dds\",\n \"gta3.img/melrose19_lawn.txd/downtshop2_lan.dds\",\"gta3.img/civic03_lan.txd/downtshop2_lan.dds\",\n \"gta3.img/sunset04_law2.txd/downtshop2_lan.dds\",\"gta3.img/civic03_lan.txd/downtshop2_lan.dds\",\n \"gta3.img/civic06_lan.txd/pediments1.dds\",\"gta3.img/civic03_lan.txd/pediments1.dds\",\n \"gta3.img/civic07_lan.txd/pediments1.dds\",\"gta3.img/civic03_lan.txd/pediments1.dds\",\n \"gta3.img/downtown1_las.txd/pediments1.dds\",\"gta3.img/civic03_lan.txd/pediments1.dds\",\n \"gta3.img/lae2bigblock.txd/pediments1.dds\",\"gta3.img/civic03_lan.txd/pediments1.dds\",\n \"gta3.img/civic06_lan.txd/downtwin2.dds\",\"gta3.img/civic03_lan.txd/downtwin2.dds\",\n \"gta3.img/civic07_lan.txd/downtwin2.dds\",\"gta3.img/civic03_lan.txd/downtwin2.dds\",\n \"gta3.img/downtown1_las.txd/downtwin2.dds\",\"gta3.img/civic03_lan.txd/downtwin2.dds\",\n \"gta3.img/downtown_las.txd/downtwin2.dds\",\"gta3.img/civic03_lan.txd/downtwin2.dds\",\n \"gta3.img/dtbuil1_lan2.txd/downtwin2.dds\",\"gta3.img/civic03_lan.txd/downtwin2.dds\",\n \"gta3.img/ebeachcineblok.txd/downtwin2.dds\",\"gta3.img/civic03_lan.txd/downtwin2.dds\",\n \"gta3.img/lashops1_las2.txd/downtwin2.dds\",\"gta3.img/civic03_lan.txd/downtwin2.dds\",\n \"gta3.img/mainlcawn.txd/downtwin2.dds\",\"gta3.img/civic03_lan.txd/downtwin2.dds\",\n \"gta3.img/civic06_lan.txd/downtwin6.dds\",\"gta3.img/civic03_lan.txd/downtwin6.dds\",\n \"gta3.img/dtbuil1_lan2.txd/downtwin6.dds\",\"gta3.img/civic03_lan.txd/downtwin6.dds\",\n \"gta3.img/lae2bigblock.txd/downtwin6.dds\",\"gta3.img/civic03_lan.txd/downtwin6.dds\",\n \"gta3.img/lanbloka.txd/downtwin6.dds\",\"gta3.img/civic03_lan.txd/downtwin6.dds\",\n \"gta3.img/lngblok_lae2.txd/downtwin6.dds\",\"gta3.img/civic03_lan.txd/downtwin6.dds\",\n \"gta3.img/sunrise11_lawn.txd/downtwin6.dds\",\"gta3.img/civic03_lan.txd/downtwin6.dds\",\n \"gta3.img/sunst18_lawn.txd/downtwin6.dds\",\"gta3.img/civic03_lan.txd/downtwin6.dds\",\n \"gta3.img/cuntwlandse.txd/parking2plain.dds\",\"gta3.img/civic03_lan.txd/parking2plain.dds\",\n \"gta3.img/cuntwland.txd/parking2plain.dds\",\"gta3.img/civic03_lan.txd/parking2plain.dds\",\n \"gta3.img/des_cen.txd/parking2plain.dds\",\"gta3.img/civic03_lan.txd/parking2plain.dds\",\n \"gta3.img/des_damquay.txd/parking2plain.dds\",\"gta3.img/civic03_lan.txd/parking2plain.dds\",\n \"gta3.img/des_ne.txd/parking2plain.dds\",\"gta3.img/civic03_lan.txd/parking2plain.dds\",\n \"gta3.img/des_n.txd/parking2plain.dds\",\"gta3.img/civic03_lan.txd/parking2plain.dds\",\n \"gta3.img/des_se1.txd/parking2plain.dds\",\"gta3.img/civic03_lan.txd/parking2plain.dds\",\n \"gta3.img/des_s.txd/parking2plain.dds\",\"gta3.img/civic03_lan.txd/parking2plain.dds\",\n \"gta3.img/lanriver.txd/parking2plain.dds\",\"gta3.img/civic03_lan.txd/parking2plain.dds\",\n \"gta3.img/downtown3_las.txd/gymshop2_lae.dds\",\"gta3.img/civic03_lan.txd/gymshop2_lae.dds\",\n \"gta3.img/lanbloka.txd/gymshop2_lae.dds\",\"gta3.img/civic03_lan.txd/gymshop2_lae.dds\",\n \"gta3.img/lanblokd.txd/gymshop2_lae.dds\",\"gta3.img/civic03_lan.txd/gymshop2_lae.dds\",\n \"gta3.img/lawnstripm.txd/gymshop2_lae.dds\",\"gta3.img/civic03_lan.txd/gymshop2_lae.dds\",\n \"gta3.img/melrose02_lawn.txd/gymshop2_lae.dds\",\"gta3.img/civic03_lan.txd/gymshop2_lae.dds\",\n \"gta3.img/melrose11_lawn.txd/gymshop2_lae.dds\",\"gta3.img/civic03_lan.txd/gymshop2_lae.dds\",\n \"gta3.img/melrose19_lawn.txd/gymshop2_lae.dds\",\"gta3.img/civic03_lan.txd/gymshop2_lae.dds\",\n \"gta3.img/rodeo02_law2.txd/gymshop2_lae.dds\",\"gta3.img/civic03_lan.txd/gymshop2_lae.dds\",\n \"gta3.img/sancliff02_law2.txd/gymshop2_lae.dds\",\"gta3.img/civic03_lan.txd/gymshop2_lae.dds\",\n \"gta3.img/sancliff_law2.txd/gymshop2_lae.dds\",\"gta3.img/civic03_lan.txd/gymshop2_lae.dds\",\n \"gta3.img/sunset04_law2.txd/gymshop2_lae.dds\",\"gta3.img/civic03_lan.txd/gymshop2_lae.dds\",\n \"gta3.img/civic04_lan.txd/twintwall2_lan.dds\",\"gta3.img/civic03_lan.txd/twintwall2_lan.dds\",\n \"gta3.img/compomark_lae2.txd/sidelatino1_lae.dds\",\"gta3.img/civic03_lan.txd/sidelatino1_lae.dds\",\n \"gta3.img/councl_law2.txd/sidelatino1_lae.dds\",\"gta3.img/civic03_lan.txd/sidelatino1_lae.dds\",\n \"gta3.img/laeroads2s.txd/sidelatino1_lae.dds\",\"gta3.img/civic03_lan.txd/sidelatino1_lae.dds\",\n \"gta3.img/lahillsla_roads.txd/sidelatino1_lae.dds\",\"gta3.img/civic03_lan.txd/sidelatino1_lae.dds\",\n \"gta3.img/lanblokb2.txd/sidelatino1_lae.dds\",\"gta3.img/civic03_lan.txd/sidelatino1_lae.dds\",\n \"gta3.img/lanbloke.txd/sidelatino1_lae.dds\",\"gta3.img/civic03_lan.txd/sidelatino1_lae.dds\",\n \"gta3.img/lanbloki.txd/sidelatino1_lae.dds\",\"gta3.img/civic03_lan.txd/sidelatino1_lae.dds\",\n \"gta3.img/lanriver.txd/sidelatino1_lae.dds\",\"gta3.img/civic03_lan.txd/sidelatino1_lae.dds\",\n \"gta3.img/lanroad.txd/sidelatino1_lae.dds\",\"gta3.img/civic03_lan.txd/sidelatino1_lae.dds\",\n \"gta3.img/lasroads_las.txd/sidelatino1_lae.dds\",\"gta3.img/civic03_lan.txd/sidelatino1_lae.dds\",\n \"gta3.img/law2_roadsb.txd/sidelatino1_lae.dds\",\"gta3.img/civic03_lan.txd/sidelatino1_lae.dds\",\n \"gta3.img/roads_lawn.txd/sidelatino1_lae.dds\",\"gta3.img/civic03_lan.txd/sidelatino1_lae.dds\",\n \"gta3.img/roads_law.txd/sidelatino1_lae.dds\",\"gta3.img/civic03_lan.txd/sidelatino1_lae.dds\",\n \"gta3.img/stapl.txd/sidelatino1_lae.dds\",\"gta3.img/civic03_lan.txd/sidelatino1_lae.dds\",\n \"gta3.img/sunset01_law2.txd/sidelatino1_lae.dds\",\"gta3.img/civic03_lan.txd/sidelatino1_lae.dds\",\n \"gta3.img/civic06_lan.txd/ws_rottenwall.dds\",\"gta3.img/civic03_lan.txd/ws_rottenwall.dds\",\n \"gta3.img/contachou1_lae2.txd/ws_rottenwall.dds\",\"gta3.img/civic03_lan.txd/ws_rottenwall.dds\",\n \"gta3.img/cs_forest.txd/ws_rottenwall.dds\",\"gta3.img/civic03_lan.txd/ws_rottenwall.dds\",\n \"gta3.img/cs_mountain.txd/ws_rottenwall.dds\",\"gta3.img/civic03_lan.txd/ws_rottenwall.dds\",\n \"gta3.img/cs_scrapyardarea.txd/ws_rottenwall.dds\",\"gta3.img/civic03_lan.txd/ws_rottenwall.dds\",\n \"gta3.img/cs_scrapyard.txd/ws_rottenwall.dds\",\"gta3.img/civic03_lan.txd/ws_rottenwall.dds\",\n \"gta3.img/cs_town.txd/ws_rottenwall.dds\",\"gta3.img/civic03_lan.txd/ws_rottenwall.dds\",\n \"gta3.img/cuntwbridges.txd/ws_rottenwall.dds\",\"gta3.img/civic03_lan.txd/ws_rottenwall.dds\",\n \"gta3.img/cuntwlandcarparks.txd/ws_rottenwall.dds\",\"gta3.img/civic03_lan.txd/ws_rottenwall.dds\",\n \"gta3.img/cuntwlandse.txd/ws_rottenwall.dds\",\"gta3.img/civic03_lan.txd/ws_rottenwall.dds\",\n \"gta3.img/cuntwlandwest.txd/ws_rottenwall.dds\",\"gta3.img/civic03_lan.txd/ws_rottenwall.dds\",\n \"gta3.img/fighot.txd/ws_rottenwall.dds\",\"gta3.img/civic03_lan.txd/ws_rottenwall.dds\",\n \"gta3.img/lanblokb2.txd/ws_rottenwall.dds\",\"gta3.img/civic03_lan.txd/ws_rottenwall.dds\",\n \"gta3.img/lanbloki.txd/ws_rottenwall.dds\",\"gta3.img/civic03_lan.txd/ws_rottenwall.dds\",\n \"gta3.img/landhub.txd/ws_rottenwall.dds\",\"gta3.img/civic03_lan.txd/ws_rottenwall.dds\",\n \"gta3.img/oc_flats_gnd_sfs.txd/ws_rottenwall.dds\",\"gta3.img/civic03_lan.txd/ws_rottenwall.dds\",\n \"gta3.img/railwaycuntw.txd/ws_rottenwall.dds\",\"gta3.img/civic03_lan.txd/ws_rottenwall.dds\",\n \"gta3.img/sawmillcs_t.txd/ws_rottenwall.dds\",\"gta3.img/civic03_lan.txd/ws_rottenwall.dds\",\n \"gta3.img/vgnfrates.txd/ws_rottenwall.dds\",\"gta3.img/civic03_lan.txd/ws_rottenwall.dds\",\n \"gta3.img/coast_apts.txd/hosdoor01_law.dds\",\"gta3.img/civic04_lan.txd/hosdoor01_law.dds\",\n \"gta3.img/gazlaw1.txd/hosdoor01_law.dds\",\"gta3.img/civic04_lan.txd/hosdoor01_law.dds\",\n \"gta3.img/hospital_lawn.txd/hosdoor01_law.dds\",\"gta3.img/civic04_lan.txd/hosdoor01_law.dds\",\n \"gta3.img/sunrise01_lawn.txd/hosdoor01_law.dds\",\"gta3.img/civic04_lan.txd/hosdoor01_law.dds\",\n \"gta3.img/sw_brewery.txd/hosdoor01_law.dds\",\"gta3.img/civic04_lan.txd/hosdoor01_law.dds\",\n \"gta3.img/civic07_lan.txd/alleydoor6.dds\",\"gta3.img/civic04_lan.txd/alleydoor6.dds\",\n \"gta3.img/downtown_las.txd/alleydoor6.dds\",\"gta3.img/civic04_lan.txd/alleydoor6.dds\",\n \"gta3.img/ground3_las.txd/alleydoor6.dds\",\"gta3.img/civic04_lan.txd/alleydoor6.dds\",\n \"gta3.img/idlewood6_lae.txd/alleydoor6.dds\",\"gta3.img/civic04_lan.txd/alleydoor6.dds\",\n \"gta3.img/lae2newtempbx.txd/alleydoor6.dds\",\"gta3.img/civic04_lan.txd/alleydoor6.dds\",\n \"gta3.img/oldshops_las.txd/alleydoor6.dds\",\"gta3.img/civic04_lan.txd/alleydoor6.dds\",\n \"gta3.img/santamopollaw2.txd/alleydoor6.dds\",\"gta3.img/civic04_lan.txd/alleydoor6.dds\",\n \"gta3.img/shops01_law.txd/alleydoor6.dds\",\"gta3.img/civic04_lan.txd/alleydoor6.dds\",\n \"gta3.img/cxref_desert.txd/forumstand1_lae.dds\",\"gta3.img/civic04_lan.txd/forumstand1_lae.dds\",\n \"gta3.img/des_stownmain3.txd/forumstand1_lae.dds\",\"gta3.img/civic04_lan.txd/forumstand1_lae.dds\",\n \"gta3.img/des_wgarage.txd/forumstand1_lae.dds\",\"gta3.img/civic04_lan.txd/forumstand1_lae.dds\",\n \"gta3.img/eastbeach09_lae2.txd/forumstand1_lae.dds\",\"gta3.img/civic04_lan.txd/forumstand1_lae.dds\",\n \"gta3.img/glenpark6d_lae.txd/forumstand1_lae.dds\",\"gta3.img/civic04_lan.txd/forumstand1_lae.dds\",\n \"gta3.img/laeroads2s.txd/forumstand1_lae.dds\",\"gta3.img/civic04_lan.txd/forumstand1_lae.dds\",\n \"gta3.img/lahillsland.txd/forumstand1_lae.dds\",\"gta3.img/civic04_lan.txd/forumstand1_lae.dds\",\n \"gta3.img/laradarmast.txd/forumstand1_lae.dds\",\"gta3.img/civic04_lan.txd/forumstand1_lae.dds\",\n \"gta3.img/lawnstripm.txd/forumstand1_lae.dds\",\"gta3.img/civic04_lan.txd/forumstand1_lae.dds\",\n \"gta3.img/stadium_lae2.txd/forumstand1_lae.dds\",\"gta3.img/civic04_lan.txd/forumstand1_lae.dds\",\n \"gta3.img/sw_block06.txd/forumstand1_lae.dds\",\"gta3.img/civic04_lan.txd/forumstand1_lae.dds\",\n \"gta3.img/sw_church.txd/forumstand1_lae.dds\",\"gta3.img/civic04_lan.txd/forumstand1_lae.dds\",\n \"gta3.img/sw_diner1.txd/forumstand1_lae.dds\",\"gta3.img/civic04_lan.txd/forumstand1_lae.dds\",\n \"gta3.img/vgsswarehse02c.txd/forumstand1_lae.dds\",\"gta3.img/civic04_lan.txd/forumstand1_lae.dds\",\n \"gta_int.img/cj_exp.txd/forumstand1_lae.dds\",\"gta3.img/civic04_lan.txd/forumstand1_lae.dds\",\n \"gta3.img/civic07_lan.txd/downtwin9.dds\",\"gta3.img/civic06_lan.txd/downtwin9.dds\",\n \"gta3.img/downtown1_las.txd/downtwin9.dds\",\"gta3.img/civic06_lan.txd/downtwin9.dds\",\n \"gta3.img/ebeachcineblok.txd/downtwin9.dds\",\"gta3.img/civic06_lan.txd/downtwin9.dds\",\n \"gta3.img/lae2bigblock.txd/downtwin9.dds\",\"gta3.img/civic06_lan.txd/downtwin9.dds\",\n \"gta3.img/lanblokb2.txd/downtwin9.dds\",\"gta3.img/civic06_lan.txd/downtwin9.dds\",\n \"gta3.img/downtown_las.txd/bow_stained_wall.dds\",\"gta3.img/civic06_lan.txd/bow_stained_wall.dds\",\n \"gta3.img/freeway_las.txd/bow_stained_wall.dds\",\"gta3.img/civic06_lan.txd/bow_stained_wall.dds\",\n \"gta3.img/olympic01.txd/casinobulb2_128.dds\",\"gta3.img/civic06_lan.txd/casinobulb2_128.dds\",\n \"gta3.img/vgnfremnt1.txd/casinobulb2_128.dds\",\"gta3.img/civic06_lan.txd/casinobulb2_128.dds\",\n \"gta3.img/vgnfremnt2.txd/casinobulb2_128.dds\",\"gta3.img/civic06_lan.txd/casinobulb2_128.dds\",\n \"gta3.img/vgwestretail1.txd/casinobulb2_128.dds\",\"gta3.img/civic06_lan.txd/casinobulb2_128.dds\",\n \"gta3.img/downtown1_las.txd/shopawning1_lan.dds\",\"gta3.img/civic06_lan.txd/shopawning1_lan.dds\",\n \"gta3.img/downtown_las.txd/shopawning1_lan.dds\",\"gta3.img/civic06_lan.txd/shopawning1_lan.dds\",\n \"gta3.img/lae2bigblock.txd/shopawning1_lan.dds\",\"gta3.img/civic06_lan.txd/shopawning1_lan.dds\",\n \"gta3.img/dtbuil1_lan2.txd/downtshop4_lan.dds\",\"gta3.img/civic06_lan.txd/downtshop4_lan.dds\",\n \"gta3.img/eastbeach8_lae2.txd/downtshop4_lan.dds\",\"gta3.img/civic06_lan.txd/downtshop4_lan.dds\",\n \"gta3.img/ebeachcineblok.txd/downtshop4_lan.dds\",\"gta3.img/civic06_lan.txd/downtshop4_lan.dds\",\n \"gta3.img/gymblok2_lae2.txd/downtshop4_lan.dds\",\"gta3.img/civic06_lan.txd/downtshop4_lan.dds\",\n \"gta3.img/lanblokb2.txd/downtshop4_lan.dds\",\"gta3.img/civic06_lan.txd/downtshop4_lan.dds\",\n \"gta3.img/mainlcawn.txd/downtshop4_lan.dds\",\"gta3.img/civic06_lan.txd/downtshop4_lan.dds\",\n \"gta3.img/melrose03_lawn.txd/downtshop4_lan.dds\",\"gta3.img/civic06_lan.txd/downtshop4_lan.dds\",\n \"gta3.img/sunset04_law2.txd/downtshop4_lan.dds\",\"gta3.img/civic06_lan.txd/downtshop4_lan.dds\",\n \"gta3.img/ebeachcineblok.txd/lacityhwal2.dds\",\"gta3.img/civic06_lan.txd/lacityhwal2.dds\",\n \"gta3.img/vgnretail6.txd/lacityhwal2.dds\",\"gta3.img/civic06_lan.txd/lacityhwal2.dds\",\n \"gta3.img/dtbuil1_lan2.txd/downtsign6_la.dds\",\"gta3.img/civic06_lan.txd/downtsign6_la.dds\",\n \"gta3.img/ebeachcineblok.txd/downtsign6_la.dds\",\"gta3.img/civic06_lan.txd/downtsign6_la.dds\",\n \"gta3.img/ebeachcineblok.txd/downtsign4_la.dds\",\"gta3.img/civic06_lan.txd/downtsign4_la.dds\",\n \"gta3.img/gymblok2_lae2.txd/downtsign4_la.dds\",\"gta3.img/civic06_lan.txd/downtsign4_la.dds\",\n \"gta3.img/mainlcawn.txd/downtsign4_la.dds\",\"gta3.img/civic06_lan.txd/downtsign4_la.dds\",\n \"gta3.img/melrose11_lawn.txd/downtsign4_la.dds\",\"gta3.img/civic06_lan.txd/downtsign4_la.dds\",\n \"gta3.img/melrose19_lawn.txd/downtsign4_la.dds\",\"gta3.img/civic06_lan.txd/downtsign4_la.dds\",\n \"gta3.img/gymblok2_lae2.txd/downtsign2_la.dds\",\"gta3.img/civic06_lan.txd/downtsign2_la.dds\",\n \"gta3.img/lae2bigblock.txd/downtsign2_la.dds\",\"gta3.img/civic06_lan.txd/downtsign2_la.dds\",\n \"gta3.img/mainlcawn.txd/downtsign2_la.dds\",\"gta3.img/civic06_lan.txd/downtsign2_la.dds\",\n \"gta3.img/melrose19_lawn.txd/downtsign2_la.dds\",\"gta3.img/civic06_lan.txd/downtsign2_la.dds\",\n \"gta3.img/downtown3_las.txd/downtsign1_la.dds\",\"gta3.img/civic06_lan.txd/downtsign1_la.dds\",\n \"gta3.img/dtbuil1_lan2.txd/downtsign1_la.dds\",\"gta3.img/civic06_lan.txd/downtsign1_la.dds\",\n \"gta3.img/ebeachcineblok.txd/downtsign1_la.dds\",\"gta3.img/civic06_lan.txd/downtsign1_la.dds\",\n \"gta3.img/gymblok2_lae2.txd/downtsign1_la.dds\",\"gta3.img/civic06_lan.txd/downtsign1_la.dds\",\n \"gta3.img/lae2newtempbx.txd/downtsign1_la.dds\",\"gta3.img/civic06_lan.txd/downtsign1_la.dds\",\n \"gta3.img/lashops1b_las2.txd/downtsign1_la.dds\",\"gta3.img/civic06_lan.txd/downtsign1_la.dds\",\n \"gta3.img/lashops1_las2.txd/downtsign1_la.dds\",\"gta3.img/civic06_lan.txd/downtsign1_la.dds\",\n \"gta3.img/melrose11_lawn.txd/downtsign1_la.dds\",\"gta3.img/civic06_lan.txd/downtsign1_la.dds\",\n \"gta3.img/dingbat01_la.txd/awningsides1.dds\",\"gta3.img/civic06_lan.txd/awningsides1.dds\",\n \"gta3.img/sw_apartflatx.txd/awningsides1.dds\",\"gta3.img/civic06_lan.txd/awningsides1.dds\",\n \"gta3.img/civic07_lan.txd/downtwin7.dds\",\"gta3.img/civic06_lan.txd/downtwin7.dds\",\n \"gta3.img/lanbloka.txd/downtwin7.dds\",\"gta3.img/civic06_lan.txd/downtwin7.dds\",\n \"gta3.img/sunset1_lan2.txd/downtwin7.dds\",\"gta3.img/civic06_lan.txd/downtwin7.dds\",\n \"gta3.img/melrose11_lawn.txd/downtwin6det.dds\",\"gta3.img/civic06_lan.txd/downtwin6det.dds\",\n \"gta3.img/sunrise11_lawn.txd/downtwin6det.dds\",\"gta3.img/civic06_lan.txd/downtwin6det.dds\",\n \"gta3.img/sunst18_lawn.txd/downtwin6det.dds\",\"gta3.img/civic06_lan.txd/downtwin6det.dds\",\n \"gta3.img/downtown1_las.txd/downtwin5.dds\",\"gta3.img/civic06_lan.txd/downtwin5.dds\",\n \"gta3.img/downtown_las.txd/downtwin5.dds\",\"gta3.img/civic06_lan.txd/downtwin5.dds\",\n \"gta3.img/lae2bigblock.txd/downtwin5.dds\",\"gta3.img/civic06_lan.txd/downtwin5.dds\",\n \"gta3.img/lanblokd.txd/downtwin5.dds\",\"gta3.img/civic06_lan.txd/downtwin5.dds\",\n \"gta3.img/downtown1_las.txd/downtwin3.dds\",\"gta3.img/civic06_lan.txd/downtwin3.dds\",\n \"gta3.img/downtown_las.txd/downtwin3.dds\",\"gta3.img/civic06_lan.txd/downtwin3.dds\",\n \"gta3.img/sunset1_lan2.txd/downtwin3.dds\",\"gta3.img/civic06_lan.txd/downtwin3.dds\",\n \"gta3.img/civic07_lan.txd/pediments2.dds\",\"gta3.img/civic06_lan.txd/pediments2.dds\",\n \"gta3.img/downtown1_las.txd/pediments2.dds\",\"gta3.img/civic06_lan.txd/pediments2.dds\",\n \"gta3.img/downtown3_las.txd/pediments2.dds\",\"gta3.img/civic06_lan.txd/pediments2.dds\",\n \"gta3.img/downtown_las.txd/pediments2.dds\",\"gta3.img/civic06_lan.txd/pediments2.dds\",\n \"gta3.img/dtbuil1_lan2.txd/pediments2.dds\",\"gta3.img/civic06_lan.txd/pediments2.dds\",\n \"gta3.img/councl_law2.txd/discware1_lae2.dds\",\"gta3.img/civic06_lan.txd/discware1_lae2.dds\",\n \"gta3.img/sunrise11_lawn.txd/discware1_lae2.dds\",\"gta3.img/civic06_lan.txd/discware1_lae2.dds\",\n \"gta3.img/downtown1_las.txd/downtsign11_la.dds\",\"gta3.img/civic07_lan.txd/downtsign11_la.dds\",\n \"gta3.img/gymblok2_lae2.txd/downtsign11_la.dds\",\"gta3.img/civic07_lan.txd/downtsign11_la.dds\",\n \"gta3.img/sunset1_lan2.txd/downtsign10_la.dds\",\"gta3.img/civic07_lan.txd/downtsign10_la.dds\",\n \"gta3.img/lae2bigblock.txd/downtsign9_la.dds\",\"gta3.img/civic07_lan.txd/downtsign9_la.dds\",\n \"gta3.img/lngblok_lae2.txd/downtsign9_la.dds\",\"gta3.img/civic07_lan.txd/downtsign9_la.dds\",\n \"gta3.img/downtown1_las.txd/column1_lan.dds\",\"gta3.img/civic07_lan.txd/column1_lan.dds\",\n \"gta3.img/lae2bigblock.txd/column1_lan.dds\",\"gta3.img/civic07_lan.txd/column1_lan.dds\",\n \"gta3.img/downtown1_las.txd/badmarb1_lan.dds\",\"gta3.img/civic07_lan.txd/badmarb1_lan.dds\",\n \"gta3.img/lae2bigblock.txd/badmarb1_lan.dds\",\"gta3.img/civic07_lan.txd/badmarb1_lan.dds\",\n \"gta3.img/lanbloke.txd/badmarb1_lan.dds\",\"gta3.img/civic07_lan.txd/badmarb1_lan.dds\",\n \"gta3.img/lanriver.txd/badmarb1_lan.dds\",\"gta3.img/civic07_lan.txd/badmarb1_lan.dds\",\n \"gta3.img/pershingsq.txd/badmarb1_lan.dds\",\"gta3.img/civic07_lan.txd/badmarb1_lan.dds\",\n \"gta3.img/rodeo05_law2.txd/badmarb1_lan.dds\",\"gta3.img/civic07_lan.txd/badmarb1_lan.dds\",\n \"gta3.img/downtown1_las.txd/downtshop10_lan.dds\",\"gta3.img/civic07_lan.txd/downtshop10_lan.dds\",\n \"gta3.img/eastbeach2a_lae2.txd/downtshop10_lan.dds\",\"gta3.img/civic07_lan.txd/downtshop10_lan.dds\",\n \"gta3.img/fighot.txd/downtshop10_lan.dds\",\"gta3.img/civic07_lan.txd/downtshop10_lan.dds\",\n \"gta3.img/gymblok2_lae2.txd/downtshop10_lan.dds\",\"gta3.img/civic07_lan.txd/downtshop10_lan.dds\",\n \"gta3.img/lanlacmab_lan2.txd/downtshop10_lan.dds\",\"gta3.img/civic07_lan.txd/downtshop10_lan.dds\",\n \"gta3.img/downtown1_las.txd/downtwin15.dds\",\"gta3.img/civic07_lan.txd/downtwin15.dds\",\n \"gta3.img/dtbuil1_lan2.txd/downtwin15.dds\",\"gta3.img/civic07_lan.txd/downtwin15.dds\",\n \"gta3.img/downtown1_las.txd/odddoor1_lan.dds\",\"gta3.img/civic07_lan.txd/odddoor1_lan.dds\",\n \"gta3.img/downtown1_las.txd/downtwin12.dds\",\"gta3.img/civic07_lan.txd/downtwin12.dds\",\n \"gta3.img/sunst18_lawn.txd/downtwin12.dds\",\"gta3.img/civic07_lan.txd/downtwin12.dds\",\n \"gta3.img/dtbuil1_lan2.txd/sl_rotnbrik.dds\",\"gta3.img/civic07_lan.txd/sl_rotnbrik.dds\",\n \"gta3.img/lanblokb2.txd/sl_rotnbrik.dds\",\"gta3.img/civic07_lan.txd/sl_rotnbrik.dds\",\n \"gta3.img/lanblokb.txd/sl_rotnbrik.dds\",\"gta3.img/civic07_lan.txd/sl_rotnbrik.dds\",\n \"gta3.img/lanblokd.txd/sl_rotnbrik.dds\",\"gta3.img/civic07_lan.txd/sl_rotnbrik.dds\",\n \"gta3.img/stolenbuild02.txd/sl_rotnbrik.dds\",\"gta3.img/civic07_lan.txd/sl_rotnbrik.dds\",\n \"gta3.img/dtbuil1_lan2.txd/sl_dwntwncanpy1.dds\",\"gta3.img/civic07_lan.txd/sl_dwntwncanpy1.dds\",\n \"gta3.img/lanblokb.txd/sl_dwntwncanpy1.dds\",\"gta3.img/civic07_lan.txd/sl_dwntwncanpy1.dds\",\n \"gta3.img/downtown1_las.txd/downtshop9_lan.dds\",\"gta3.img/civic07_lan.txd/downtshop9_lan.dds\",\n \"gta3.img/eastbeach3c_lae2.txd/downtshop9_lan.dds\",\"gta3.img/civic07_lan.txd/downtshop9_lan.dds\",\n \"gta3.img/fighot.txd/downtshop9_lan.dds\",\"gta3.img/civic07_lan.txd/downtshop9_lan.dds\",\n \"gta3.img/lae2bigblock.txd/downtshop9_lan.dds\",\"gta3.img/civic07_lan.txd/downtshop9_lan.dds\",\n \"gta3.img/lanbloka.txd/downtshop9_lan.dds\",\"gta3.img/civic07_lan.txd/downtshop9_lan.dds\",\n \"gta3.img/sunrise11_lawn.txd/downtshop9_lan.dds\",\"gta3.img/civic07_lan.txd/downtshop9_lan.dds\",\n \"gta3.img/downtown1_las.txd/downtshop8_lan.dds\",\"gta3.img/civic07_lan.txd/downtshop8_lan.dds\",\n \"gta3.img/dtbuil1_lan2.txd/downtshop8_lan.dds\",\"gta3.img/civic07_lan.txd/downtshop8_lan.dds\",\n \"gta3.img/eastbeach8_lae2.txd/downtshop8_lan.dds\",\"gta3.img/civic07_lan.txd/downtshop8_lan.dds\",\n \"gta3.img/fighot.txd/downtshop8_lan.dds\",\"gta3.img/civic07_lan.txd/downtshop8_lan.dds\",\n \"gta3.img/lae2bigblock.txd/downtshop8_lan.dds\",\"gta3.img/civic07_lan.txd/downtshop8_lan.dds\",\n \"gta3.img/lngblok_lae2.txd/downtshop8_lan.dds\",\"gta3.img/civic07_lan.txd/downtshop8_lan.dds\",\n \"gta3.img/downtown1_las.txd/downtwin14det.dds\",\"gta3.img/civic07_lan.txd/downtwin14det.dds\",\n \"gta3.img/eastbeach3c_lae2.txd/downtwin14det.dds\",\"gta3.img/civic07_lan.txd/downtwin14det.dds\",\n \"gta3.img/downtown1_las.txd/downtwin14.dds\",\"gta3.img/civic07_lan.txd/downtwin14.dds\",\n \"gta3.img/gymblok2_lae2.txd/downtwin14.dds\",\"gta3.img/civic07_lan.txd/downtwin14.dds\",\n \"gta3.img/downtown1_las.txd/sf_windos_10.dds\",\"gta3.img/civic07_lan.txd/sf_windos_10.dds\",\n \"gta3.img/fishwarf.txd/sf_windos_10.dds\",\"gta3.img/civic07_lan.txd/sf_windos_10.dds\",\n \"gta3.img/smallertxd.txd/sf_windos_10.dds\",\"gta3.img/civic07_lan.txd/sf_windos_10.dds\",\n \"gta3.img/downtown1_las.txd/downtwin9det.dds\",\"gta3.img/civic07_lan.txd/downtwin9det.dds\",\n \"gta3.img/gangblok1_lae2.txd/downtwin9det.dds\",\"gta3.img/civic07_lan.txd/downtwin9det.dds\",\n \"gta3.img/lae2bigblock.txd/downtwin9det.dds\",\"gta3.img/civic07_lan.txd/downtwin9det.dds\",\n \"gta3.img/melrose19_lawn.txd/downtwin9det.dds\",\"gta3.img/civic07_lan.txd/downtwin9det.dds\",\n \"gta3.img/stormdrain.txd/downtwin9det.dds\",\"gta3.img/civic07_lan.txd/downtwin9det.dds\",\n \"gta3.img/glenpark6_lae.txd/oldbrwall1_la.dds\",\"gta3.img/civic07_lan.txd/oldbrwall1_la.dds\",\n \"gta3.img/glenpark6_lae.txd/oldbrwall2_la.dds\",\"gta3.img/civic07_lan.txd/oldbrwall2_la.dds\",\n \"gta3.img/lanlacmab_lan2.txd/oldbrwall2_la.dds\",\"gta3.img/civic07_lan.txd/oldbrwall2_la.dds\",\n \"gta3.img/sunrise05_lawn.txd/hollywin02_law.dds\",\"gta3.img/civic07_lan.txd/hollywin02_law.dds\",\n \"gta3.img/posh_sfe.txd/posh_eagle14_sfe.dds\",\"gta3.img/civic1_lan2.txd/posh_eagle14_sfe.dds\",\n \"gta3.img/pershingsq.txd/posh_eagle13_sfe.dds\",\"gta3.img/civic1_lan2.txd/posh_eagle13_sfe.dds\",\n \"gta3.img/pier69.txd/posh_eagle13_sfe.dds\",\"gta3.img/civic1_lan2.txd/posh_eagle13_sfe.dds\",\n \"gta3.img/posh_sfe.txd/posh_eagle13_sfe.dds\",\"gta3.img/civic1_lan2.txd/posh_eagle13_sfe.dds\",\n \"gta3.img/smallertxd.txd/posh_eagle13_sfe.dds\",\"gta3.img/civic1_lan2.txd/posh_eagle13_sfe.dds\",\n \"gta3.img/pershingsq.txd/posh_eagle12_sfe.dds\",\"gta3.img/civic1_lan2.txd/posh_eagle12_sfe.dds\",\n \"gta3.img/posh_sfe.txd/posh_eagle12_sfe.dds\",\"gta3.img/civic1_lan2.txd/posh_eagle12_sfe.dds\",\n \"gta3.img/smallertxd.txd/posh_eagle12_sfe.dds\",\"gta3.img/civic1_lan2.txd/posh_eagle12_sfe.dds\",\n \"gta3.img/posh_sfe.txd/posh_eagle10_sfe.dds\",\"gta3.img/civic1_lan2.txd/posh_eagle10_sfe.dds\",\n \"gta3.img/posh_sfe.txd/posh_eagle11_sfe.dds\",\"gta3.img/civic1_lan2.txd/posh_eagle11_sfe.dds\",\n \"gta3.img/sfe_park1.txd/posh_eagle11_sfe.dds\",\"gta3.img/civic1_lan2.txd/posh_eagle11_sfe.dds\",\n \"gta3.img/posh_sfe.txd/posh_eagle4_sfe.dds\",\"gta3.img/civic1_lan2.txd/posh_eagle4_sfe.dds\",\n \"gta3.img/smallertxd.txd/posh_eagle4_sfe.dds\",\"gta3.img/civic1_lan2.txd/posh_eagle4_sfe.dds\",\n \"gta3.img/posh_sfe.txd/posh_eagle2_sfe.dds\",\"gta3.img/civic1_lan2.txd/posh_eagle2_sfe.dds\",\n \"gta3.img/smallertxd.txd/posh_eagle2_sfe.dds\",\"gta3.img/civic1_lan2.txd/posh_eagle2_sfe.dds\",\n \"gta3.img/posh_sfe.txd/posh_eagle1_sfe.dds\",\"gta3.img/civic1_lan2.txd/posh_eagle1_sfe.dds\",\n \"gta3.img/cj_airprt.txd/cj_tubeside.dds\",\"gta3.img/cj_airprt2.txd/cj_tubeside.dds\",\n \"gta3.img/cj_airprt.txd/cj_shelf_white.dds\",\"gta3.img/cj_airprt2.txd/cj_shelf_white.dds\",\n \"gta3.img/cj_airprt.txd/cj_rubber.dds\",\"gta3.img/cj_airprt2.txd/cj_rubber.dds\",\n \"gta3.img/cj_airprt.txd/cj_polished.dds\",\"gta3.img/cj_airprt2.txd/cj_polished.dds\",\n \"gta3.img/dkcargoshp_las2.txd/bandingblue_64.dds\",\"gta3.img/cj_barr_set_1.txd/banding_blue_64hv.dds\",\n \"gta3.img/lanbloke.txd/banding_blue_64hv.dds\",\"gta3.img/cj_barr_set_1.txd/banding_blue_64hv.dds\",\n \"gta3.img/lasxrefdock.txd/bandingblue_64.dds\",\"gta3.img/cj_barr_set_1.txd/banding_blue_64hv.dds\",\n \"gta3.img/lanbloke.txd/stop2_64.dds\",\"gta3.img/cj_barr_set_1.txd/stop2_64.dds\",\n \"gta3.img/vgndwntwn1.txd/stop2_64.dds\",\"gta3.img/cj_barr_set_1.txd/stop2_64.dds\",\n \"gta_int.img/cj_ss_1.txd/cj_b_towel.dds\",\"gta3.img/cj_bar.txd/cj_b_towel.dds\",\n \"gta_int.img/cj_ss_1.txd/cj_bar_bottle1.dds\",\"gta3.img/cj_bar.txd/cj_bar_bottle1.dds\",\n \"gta3.img/hubprops2_sfse.txd/cj_bar_tap1.dds\",\"gta3.img/cj_bar.txd/cj_bar_tap1.dds\",\n \"gta3.img/junkpiles.txd/cj_rubbish1.dds\",\"gta3.img/cj_bins2.txd/cj_rubbish1.dds\",\n \"gta3.img/metalbarrier_cj.txd/cj_galvanised.dds\",\"gta3.img/cj_carter.txd/cj_galvanised.dds\",\n \"gta_int.img/airp_prop.txd/cj_galvanised.dds\",\"gta3.img/cj_carter.txd/cj_galvanised.dds\",\n \"gta_int.img/cj_barb2.txd/cj_galvanised.dds\",\"gta3.img/cj_carter.txd/cj_galvanised.dds\",\n \"gta_int.img/cj_ff_counters.txd/cj_galvanised.dds\",\"gta3.img/cj_carter.txd/cj_galvanised.dds\",\n \"gta_int.img/cj_hi_fi.txd/cj_galvanised.dds\",\"gta3.img/cj_carter.txd/cj_galvanised.dds\",\n \"gta_int.img/cj_jucie.txd/cj_galvanised.dds\",\"gta3.img/cj_carter.txd/cj_galvanised.dds\",\n \"gta_int.img/cj_off_lic.txd/cj_galvanised.dds\",\"gta3.img/cj_carter.txd/cj_galvanised.dds\",\n \"gta_int.img/genintintbarb.txd/cj_galvanised.dds\",\"gta3.img/cj_carter.txd/cj_galvanised.dds\",\n \"gta_int.img/gs_mansion_lights.txd/cj_galvanised.dds\",\"gta3.img/cj_carter.txd/cj_galvanised.dds\",\n \"gta_int.img/mansionlights.txd/cj_galvanised.dds\",\"gta3.img/cj_carter.txd/cj_galvanised.dds\",\n \"gta_int.img/otb_machine.txd/mp_cj_galvanised.dds\",\"gta3.img/cj_carter.txd/cj_galvanised.dds\",\n \"gta_int.img/rystuff.txd/mp_cj_galvanised.dds\",\"gta3.img/cj_carter.txd/cj_galvanised.dds\",\n \"gta_int.img/sfhsm1.txd/cj_galvanised.dds\",\"gta3.img/cj_carter.txd/cj_galvanised.dds\",\n \"gta_int.img/sfhsm2bits.txd/cj_galvanised.dds\",\"gta3.img/cj_carter.txd/cj_galvanised.dds\",\n \"gta_int.img/skate_shop.txd/cj_galvanised.dds\",\"gta3.img/cj_carter.txd/cj_galvanised.dds\",\n \"gta_int.img/svlabigbits.txd/cj_galvanised.dds\",\"gta3.img/cj_carter.txd/cj_galvanised.dds\",\n \"gta_int.img/carter_block_2.txd/mp_carter_windows.dds\",\"gta3.img/cj_carter.txd/mp_carter_windows.dds\",\n \"gta_int.img/carter_block.txd/mp_carter_windows.dds\",\"gta3.img/cj_carter.txd/mp_carter_windows.dds\",\n \"gta_int.img/carter_block_2.txd/mp_carter_wallbot.dds\",\"gta3.img/cj_carter.txd/mp_carter_wallbot.dds\",\n \"gta_int.img/carter_block.txd/mp_carter_wallbot.dds\",\"gta3.img/cj_carter.txd/mp_carter_wallbot.dds\",\n \"gta_int.img/711c.txd/cj_white_wall2.dds\",\"gta3.img/cj_chip_maker.txd/cj_white_wall2.dds\",\n \"gta_int.img/airp_prop.txd/cj_white_wall2.dds\",\"gta3.img/cj_chip_maker.txd/cj_white_wall2.dds\",\n \"gta_int.img/gap.txd/cj_white_wall2.dds\",\"gta3.img/cj_chip_maker.txd/cj_white_wall2.dds\",\n \"gta_int.img/genintint711_1.txd/cj_white_wall2.dds\",\"gta3.img/cj_chip_maker.txd/cj_white_wall2.dds\",\n \"gta_int.img/genintintsex.txd/cj_white_wall2.dds\",\"gta3.img/cj_chip_maker.txd/cj_white_wall2.dds\",\n \"gta3.img/industrialext.txd/cj_y_generatordetail.dds\",\"gta3.img/cj_chip_maker.txd/cj_y_generatordetail.dds\",\n \"gta_int.img/maint1.txd/cj_y_generatordetail.dds\",\"gta3.img/cj_chip_maker.txd/cj_y_generatordetail.dds\",\n \"gta3.img/cj_noodle_1.txd/cj_shelf_white.dds\",\"gta3.img/cj_chip_maker.txd/cj_shelf_white.dds\",\n \"gta_int.img/cj_ammun_extra.txd/cj_shelf_white.dds\",\"gta3.img/cj_chip_maker.txd/cj_shelf_white.dds\",\n \"gta_int.img/cj_ff_acc1.txd/cj_shelf_white.dds\",\"gta3.img/cj_chip_maker.txd/cj_shelf_white.dds\",\n \"gta_int.img/cj_ff_acc2.txd/cj_shelf_white.dds\",\"gta3.img/cj_chip_maker.txd/cj_shelf_white.dds\",\n \"gta_int.img/cj_jucie.txd/cj_shelf_white.dds\",\"gta3.img/cj_chip_maker.txd/cj_shelf_white.dds\",\n \"gta_int.img/cj_kitchen.txd/cj_shelf_white.dds\",\"gta3.img/cj_chip_maker.txd/cj_shelf_white.dds\",\n \"gta_int.img/cj_off_lic.txd/cj_shelf_white.dds\",\"gta3.img/cj_chip_maker.txd/cj_shelf_white.dds\",\n \"gta_int.img/cj_sex.txd/cj_shelf_white.dds\",\"gta3.img/cj_chip_maker.txd/cj_shelf_white.dds\",\n \"gta_int.img/cj_ss_1.txd/cj_shelf_white.dds\",\"gta3.img/cj_chip_maker.txd/cj_shelf_white.dds\",\n \"gta_int.img/cj_ss_2.txd/cj_shelf_white.dds\",\"gta3.img/cj_chip_maker.txd/cj_shelf_white.dds\",\n \"gta_int.img/cj_ss_3.txd/cj_shelf_white.dds\",\"gta3.img/cj_chip_maker.txd/cj_shelf_white.dds\",\n \"gta_int.img/cj_ss_4.txd/cj_shelf_white.dds\",\"gta3.img/cj_chip_maker.txd/cj_shelf_white.dds\",\n \"gta3.img/industrialext.txd/cj_generator3.dds\",\"gta3.img/cj_chip_maker.txd/cj_generator3.dds\",\n \"gta_int.img/cj_ammo.txd/cj_generator3.dds\",\"gta3.img/cj_chip_maker.txd/cj_generator3.dds\",\n \"gta3.img/cj_till_break.txd/gen_till.dds\",\"gta3.img/cj_commerciax.txd/gen_till.dds\",\n \"gta_int.img/cj_urb.txd/gen_till.dds\",\"gta3.img/cj_commerciax.txd/gen_till.dds\",\n \"gta_int.img/shopping_acc.txd/gen_till.dds\",\"gta3.img/cj_commerciax.txd/gen_till.dds\",\n \"gta_int.img/shop_shelf1.txd/gen_till.dds\",\"gta3.img/cj_commerciax.txd/gen_till.dds\",\n \"gta_int.img/cj_ss_1.txd/cj_tubeside.dds\",\"gta3.img/cj_crate_will.txd/cj_tubeside.dds\",\n \"gta_int.img/cj_ss_2.txd/cj_tubeside.dds\",\"gta3.img/cj_crate_will.txd/cj_tubeside.dds\",\n \"gta_int.img/cj_ss_4.txd/cj_tubeside.dds\",\"gta3.img/cj_crate_will.txd/cj_tubeside.dds\",\n \"gta3.img/light_fit_ext.txd/ws_volumetriclight.dds\",\"gta3.img/cj_dfext.txd/ws_volumetriclight.dds\",\n \"gta_int.img/blindinglite.txd/ws_volumetriclight.dds\",\"gta3.img/cj_dfext.txd/ws_volumetriclight.dds\",\n \"gta_int.img/chick_blind.txd/ws_volumetriclight.dds\",\"gta3.img/cj_dfext.txd/ws_volumetriclight.dds\",\n \"gta_int.img/cj_barb.txd/ws_volumetriclight.dds\",\"gta3.img/cj_dfext.txd/ws_volumetriclight.dds\",\n \"gta_int.img/pleas_dome.txd/ws_volumetriclight.dds\",\"gta3.img/cj_dfext.txd/ws_volumetriclight.dds\",\n \"gta_int.img/ryslites.txd/ws_volumetriclight.dds\",\"gta3.img/cj_dfext.txd/ws_volumetriclight.dds\",\n \"gta_int.img/shopping.txd/ws_volumetriclight.dds\",\"gta3.img/cj_dfext.txd/ws_volumetriclight.dds\",\n \"gta_int.img/sweetslites.txd/ws_volumetriclight.dds\",\"gta3.img/cj_dfext.txd/ws_volumetriclight.dds\",\n \"gta_int.img/cj_chris.txd/cj_metalplate2.dds\",\"gta3.img/cj_dfext.txd/cj_metalplate2.dds\",\n \"gta_int.img/cj_gash.txd/cj_metalplate2.dds\",\"gta3.img/cj_dfext.txd/cj_metalplate2.dds\",\n \"gta_int.img/cj_urb.txd/cj_metalplate2.dds\",\"gta3.img/cj_dfext.txd/cj_metalplate2.dds\",\n \"gta_int.img/genintintbarb.txd/cj_metalplate2.dds\",\"gta3.img/cj_dfext.txd/cj_metalplate2.dds\",\n \"gta_int.img/intclotheshiphop.txd/cj_metalplate2.dds\",\"gta3.img/cj_dfext.txd/cj_metalplate2.dds\",\n \"gta_int.img/cj_ammo.txd/cj_lightwood(e).dds\",\"gta3.img/cj_dfext.txd/cj_lightwood(e).dds\",\n \"gta_int.img/cj_ff.txd/cj_lightwood(e).dds\",\"gta3.img/cj_dfext.txd/cj_lightwood(e).dds\",\n \"gta_int.img/cj_hi_fi.txd/cj_lightwood(e).dds\",\"gta3.img/cj_dfext.txd/cj_lightwood(e).dds\",\n \"gta_int.img/cj_kitchen.txd/cj_lightwood(e).dds\",\"gta3.img/cj_dfext.txd/cj_lightwood(e).dds\",\n \"gta_int.img/cj_off_lic.txd/cj_lightwood(e).dds\",\"gta3.img/cj_dfext.txd/cj_lightwood(e).dds\",\n \"gta3.img/junkpiles.txd/cj_strolly.dds\",\"gta3.img/cj_dyn_prop.txd/cj_strolly.dds\",\n \"gta_int.img/cj_ff.txd/cj_strolly.dds\",\"gta3.img/cj_dyn_prop.txd/cj_strolly.dds\",\n \"gta3.img/externalext.txd/cj_gas_can.dds\",\"gta3.img/cj_exp_props.txd/cj_gas_can.dds\",\n \"gta_int.img/cj_commercial.txd/cj_s_vendor.dds\",\"gta3.img/cj_ext_vend2.txd/cj_s_vendor.dds\",\n \"gta_int.img/cj_commercial.txd/cj_sweets.dds\",\"gta3.img/cj_ext_vend2.txd/cj_sweets.dds\",\n \"gta_int.img/cjtemp.txd/cj_sweets.dds\",\"gta3.img/cj_ext_vend2.txd/cj_sweets.dds\",\n \"gta3.img/cj_till_break.txd/money_128.dds\",\"gta3.img/cj_money_bags.txd/money_128.dds\",\n \"gta3.img/dyn_cash.txd/money_128.dds\",\"gta3.img/cj_money_bags.txd/money_128.dds\",\n \"gta_int.img/cj_ammo.txd/cj_canvas2.dds\",\"gta3.img/cj_noodle_1.txd/cj_canvas2.dds\",\n \"gta_int.img/gf5.txd/cj_canvas2.dds\",\"gta3.img/cj_noodle_1.txd/cj_canvas2.dds\",\n \"gta3.img/gta_brokentrees.txd/cj_plant.dds\",\"gta3.img/cj_plant_props.txd/cj_plant.dds\",\n \"gta3.img/sfeship1.txd/cj_plant.dds\",\"gta3.img/cj_plant_props.txd/cj_plant.dds\",\n \"gta_int.img/crlsbits.txd/cj_plant.dds\",\"gta3.img/cj_plant_props.txd/cj_plant.dds\",\n \"gta_int.img/im_xtra.txd/cj_plant.dds\",\"gta3.img/cj_plant_props.txd/cj_plant.dds\",\n \"gta_int.img/plants_tabletop.txd/cj_plant.dds\",\"gta3.img/cj_plant_props.txd/cj_plant.dds\",\n \"gta_int.img/plants.txd/cj_plant.dds\",\"gta3.img/cj_plant_props.txd/cj_plant.dds\",\n \"gta_int.img/rystuff.txd/cj_plant.dds\",\"gta3.img/cj_plant_props.txd/cj_plant.dds\",\n \"gta_int.img/vegassavesmal.txd/cj_plant.dds\",\"gta3.img/cj_plant_props.txd/cj_plant.dds\",\n \"gta3.img/dyn_objects.txd/cj_o2tank.dds\",\"gta3.img/cj_street_props.txd/cj_o2tank.dds\",\n \"gta3.img/externalext.txd/cj_o2tank.dds\",\"gta3.img/cj_street_props.txd/cj_o2tank.dds\",\n \"gta3.img/hubprops2_sfse.txd/cj_o2tank.dds\",\"gta3.img/cj_street_props.txd/cj_o2tank.dds\",\n \"gta3.img/vgsbballnet1.txd/cj_o2tank.dds\",\"gta3.img/cj_street_props.txd/cj_o2tank.dds\",\n \"gta3.img/crates_n_stuffext.txd/cj_sheet2holes.dds\",\"gta3.img/cj_street_props.txd/cj_sheet2holes.dds\",\n \"gta3.img/externalext.txd/cj_sheet2holes.dds\",\"gta3.img/cj_street_props.txd/cj_sheet2holes.dds\",\n \"gta_int.img/cj_ammo.txd/cj_sheet2holes.dds\",\"gta3.img/cj_street_props.txd/cj_sheet2holes.dds\",\n \"gta_int.img/mafcasgenstuff.txd/cj_sheet2holes.dds\",\"gta3.img/cj_street_props.txd/cj_sheet2holes.dds\",\n \"gta3.img/des_byofficeint.txd/cj_black_metal.dds\",\"gta3.img/cj_till_break.txd/cj_black_metal.dds\",\n \"gta3.img/sfn_byofficeint.txd/cj_black_metal.dds\",\"gta3.img/cj_till_break.txd/cj_black_metal.dds\",\n \"gta3.img/vgsbikesclint.txd/cj_black_metal.dds\",\"gta3.img/cj_till_break.txd/cj_black_metal.dds\",\n \"gta_int.img/cj_ammo.txd/cj_black_metal.dds\",\"gta3.img/cj_till_break.txd/cj_black_metal.dds\",\n \"gta_int.img/cj_ammun_extra.txd/cj_black_metal.dds\",\"gta3.img/cj_till_break.txd/cj_black_metal.dds\",\n \"gta_int.img/cj_bar2.txd/cj_black_metal.dds\",\"gta3.img/cj_till_break.txd/cj_black_metal.dds\",\n \"gta_int.img/cj_commercial.txd/cj_black_metal.dds\",\"gta3.img/cj_till_break.txd/cj_black_metal.dds\",\n \"gta_int.img/cj_ff_counters.txd/cj_black_metal.dds\",\"gta3.img/cj_till_break.txd/cj_black_metal.dds\",\n \"gta_int.img/cj_ff.txd/cj_black_metal.dds\",\"gta3.img/cj_till_break.txd/cj_black_metal.dds\",\n \"gta_int.img/cj_furniture.txd/cj_black_metal.dds\",\"gta3.img/cj_till_break.txd/cj_black_metal.dds\",\n \"gta_int.img/cj_hi_fi2.txd/cj_black_metal.dds\",\"gta3.img/cj_till_break.txd/cj_black_metal.dds\",\n \"gta_int.img/cj_hi_fi.txd/cj_black_metal.dds\",\"gta3.img/cj_till_break.txd/cj_black_metal.dds\",\n \"gta_int.img/cj_jucie.txd/cj_black_metal.dds\",\"gta3.img/cj_till_break.txd/cj_black_metal.dds\",\n \"gta_int.img/cj_kitchen.txd/cj_black_metal.dds\",\"gta3.img/cj_till_break.txd/cj_black_metal.dds\",\n \"gta_int.img/cj_off_lic.txd/cj_black_metal.dds\",\"gta3.img/cj_till_break.txd/cj_black_metal.dds\",\n \"gta_int.img/cj_sex.txd/cj_black_metal.dds\",\"gta3.img/cj_till_break.txd/cj_black_metal.dds\",\n \"gta_int.img/cj_ss_1.txd/cj_black_metal.dds\",\"gta3.img/cj_till_break.txd/cj_black_metal.dds\",\n \"gta_int.img/cj_ss_2.txd/cj_black_metal.dds\",\"gta3.img/cj_till_break.txd/cj_black_metal.dds\",\n \"gta_int.img/cj_ss_3.txd/cj_black_metal.dds\",\"gta3.img/cj_till_break.txd/cj_black_metal.dds\",\n \"gta_int.img/cj_ss_4.txd/cj_black_metal.dds\",\"gta3.img/cj_till_break.txd/cj_black_metal.dds\",\n \"gta_int.img/cj_steal_tv.txd/cj_black_metal.dds\",\"gta3.img/cj_till_break.txd/cj_black_metal.dds\",\n \"gta_int.img/cj_tv_stand.txd/cj_black_metal.dds\",\"gta3.img/cj_till_break.txd/cj_black_metal.dds\",\n \"gta_int.img/cj_tv.txd/cj_black_metal.dds\",\"gta3.img/cj_till_break.txd/cj_black_metal.dds\",\n \"gta_int.img/cj_urb.txd/cj_black_metal.dds\",\"gta3.img/cj_till_break.txd/cj_black_metal.dds\",\n \"gta_int.img/cj_video.txd/cj_black_metal.dds\",\"gta3.img/cj_till_break.txd/cj_black_metal.dds\",\n \"gta_int.img/drivingbit.txd/cj_black_metal.dds\",\"gta3.img/cj_till_break.txd/cj_black_metal.dds\",\n \"gta_int.img/genintintbarb.txd/cj_black_metal.dds\",\"gta3.img/cj_till_break.txd/cj_black_metal.dds\",\n \"gta_int.img/lasmalldesk.txd/cj_black_metal.dds\",\"gta3.img/cj_till_break.txd/cj_black_metal.dds\",\n \"gta_int.img/picture_frame_clip.txd/cj_black_metal.dds\",\"gta3.img/cj_till_break.txd/cj_black_metal.dds\",\n \"gta_int.img/shopping_acc.txd/cj_black_metal.dds\",\"gta3.img/cj_till_break.txd/cj_black_metal.dds\",\n \"gta_int.img/shopping_clothes.txd/cj_black_metal.dds\",\"gta3.img/cj_till_break.txd/cj_black_metal.dds\",\n \"gta_int.img/shopping.txd/cj_black_metal.dds\",\"gta3.img/cj_till_break.txd/cj_black_metal.dds\",\n \"gta_int.img/shop_shelf1.txd/cj_black_metal.dds\",\"gta3.img/cj_till_break.txd/cj_black_metal.dds\",\n \"gta_int.img/sweetshall.txd/cj_black_metal.dds\",\"gta3.img/cj_till_break.txd/cj_black_metal.dds\",\n \"gta_int.img/vegassavesmal.txd/cj_black_metal.dds\",\"gta3.img/cj_till_break.txd/cj_black_metal.dds\",\n \"gta3.img/gay_xref.txd/cj_sign6.dds\",\"gta3.img/cj_traffic.txd/cj_sign6.dds\",\n \"gta3.img/elegy.txd/elegy92interior128.dds\",\"gta3.img/club.txd/club92interior128.dds\",\n \"gta3.img/flash.txd/flash92interior128.dds\",\"gta3.img/club.txd/club92interior128.dds\",\n \"gta3.img/jester.txd/stratum92interior128.dds\",\"gta3.img/club.txd/club92interior128.dds\",\n \"gta3.img/phoenix.txd/phoenix92interior128.dds\",\"gta3.img/club.txd/club92interior128.dds\",\n \"gta3.img/sandking.txd/sandking92interior128.dds\",\"gta3.img/club.txd/club92interior128.dds\",\n \"gta3.img/stratum.txd/stratum92interior128.dds\",\"gta3.img/club.txd/club92interior128.dds\",\n \"gta3.img/sultan.txd/sultan92interior128.dds\",\"gta3.img/club.txd/club92interior128.dds\",\n \"gta3.img/sunrise.txd/elegy92interior128.dds\",\"gta3.img/club.txd/club92interior128.dds\",\n \"gta3.img/uranus.txd/uranus92interior128.dds\",\"gta3.img/club.txd/club92interior128.dds\",\n \"gta3.img/vgndwntwn23.txd/vgncarwash3_256.dds\",\"gta3.img/cluckbell_sfs.txd/vgncarwash3_256.dds\",\n \"gta3.img/vgnmall.txd/vgncarwash3_256.dds\",\"gta3.img/cluckbell_sfs.txd/vgncarwash3_256.dds\",\n \"gta3.img/vgsmall.txd/vgncarwash3_256.dds\",\"gta3.img/cluckbell_sfs.txd/vgncarwash3_256.dds\",\n \"gta3.img/vgsbikeschool.txd/tgogg4_256.dds\",\"gta3.img/cluckbell_sfs.txd/tgogg4_256.dds\",\n \"gta3.img/foodlawn.txd/roof04l256.dds\",\"gta3.img/cluckbell_sfs.txd/roof04l256.dds\",\n \"gta3.img/lawnabv.txd/roof04l256.dds\",\"gta3.img/cluckbell_sfs.txd/roof04l256.dds\",\n \"gta3.img/vegasdwntwn1.txd/roof04l256.dds\",\"gta3.img/cluckbell_sfs.txd/roof04l256.dds\",\n \"gta3.img/vgndwntwn2.txd/roof04l256.dds\",\"gta3.img/cluckbell_sfs.txd/roof04l256.dds\",\n \"gta3.img/vgnretail3.txd/roof04l256.dds\",\"gta3.img/cluckbell_sfs.txd/roof04l256.dds\",\n \"gta3.img/lawnabv.txd/vgndwntwnrf1_256.dds\",\"gta3.img/cluckbell_sfs.txd/vgndwntwnrf1_256.dds\",\n \"gta3.img/vgndwntwn23.txd/vgndwntwnrf1_256.dds\",\"gta3.img/cluckbell_sfs.txd/vgndwntwnrf1_256.dds\",\n \"gta3.img/vgnretail3.txd/vgndwntwnrf1_256.dds\",\"gta3.img/cluckbell_sfs.txd/vgndwntwnrf1_256.dds\",\n \"gta3.img/vgnretail72.txd/vgndwntwnrf1_256.dds\",\"gta3.img/cluckbell_sfs.txd/vgndwntwnrf1_256.dds\",\n \"gta3.img/vgwestretail1.txd/vgndwntwnrf1_256.dds\",\"gta3.img/cluckbell_sfs.txd/vgndwntwnrf1_256.dds\",\n \"gta3.img/councl_law2.txd/ws_nicepave.dds\",\"gta3.img/cluckbell_sfs.txd/ws_nicepave.dds\",\n \"gta3.img/gardencentre_sfs.txd/ws_nicepave.dds\",\"gta3.img/cluckbell_sfs.txd/ws_nicepave.dds\",\n \"gta3.img/law2_roadsb.txd/ws_nicepave.dds\",\"gta3.img/cluckbell_sfs.txd/ws_nicepave.dds\",\n \"gta3.img/roads_law.txd/ws_nicepave.dds\",\"gta3.img/cluckbell_sfs.txd/ws_nicepave.dds\",\n \"gta3.img/des_nw2.txd/rocktbrn128blndlit.dds\",\"gta3.img/cn_nwbrigstuff.txd/rocktbrn128blndlit.dds\",\n \"gta3.img/hobos_lawn.txd/rocktbrn128blndlit.dds\",\"gta3.img/cn_nwbrigstuff.txd/rocktbrn128blndlit.dds\",\n \"gta3.img/landlae2c.txd/rocktbrn128blndlit.dds\",\"gta3.img/cn_nwbrigstuff.txd/rocktbrn128blndlit.dds\",\n \"gta3.img/mullho03_lahills.txd/rocktbrn128blndlit.dds\",\"gta3.img/cn_nwbrigstuff.txd/rocktbrn128blndlit.dds\",\n \"gta3.img/richman02_lahills.txd/rocktbrn128blndlit.dds\",\"gta3.img/cn_nwbrigstuff.txd/rocktbrn128blndlit.dds\",\n \"gta3.img/sfn_sfn.txd/rocktbrn128blndlit.dds\",\"gta3.img/cn_nwbrigstuff.txd/rocktbrn128blndlit.dds\",\n \"gta3.img/sunsetbittyu.txd/rocktbrn128blndlit.dds\",\"gta3.img/cn_nwbrigstuff.txd/rocktbrn128blndlit.dds\",\n \"gta3.img/vinewood01_lahills.txd/rocktbrn128blndlit.dds\",\"gta3.img/cn_nwbrigstuff.txd/rocktbrn128blndlit.dds\",\n \"gta3.img/des_nw2.txd/blendrock2grgrass.dds\",\"gta3.img/cn_nwbrigstuff.txd/blendrock2grgrass.dds\",\n \"gta3.img/des_ne.txd/tar_1linefreewy.dds\",\"gta3.img/cn_nwbrigstuff.txd/tar_1linefreewy.dds\",\n \"gta3.img/des_nw2.txd/tar_1linefreewy.dds\",\"gta3.img/cn_nwbrigstuff.txd/tar_1linefreewy.dds\",\n \"gta3.img/des_nw.txd/tar_1linefreewy.dds\",\"gta3.img/cn_nwbrigstuff.txd/tar_1linefreewy.dds\",\n \"gta3.img/des_se2.txd/tar_1linefreewy.dds\",\"gta3.img/cn_nwbrigstuff.txd/tar_1linefreewy.dds\",\n \"gta3.img/des_se4.txd/tar_1linefreewy.dds\",\"gta3.img/cn_nwbrigstuff.txd/tar_1linefreewy.dds\",\n \"gta3.img/des_s.txd/tar_1linefreewy.dds\",\"gta3.img/cn_nwbrigstuff.txd/tar_1linefreewy.dds\",\n \"gta3.img/des_sw.txd/tar_1linefreewy.dds\",\"gta3.img/cn_nwbrigstuff.txd/tar_1linefreewy.dds\",\n \"gta3.img/lahillsgrounds.txd/tar_1linefreewy.dds\",\"gta3.img/cn_nwbrigstuff.txd/tar_1linefreewy.dds\",\n \"gta3.img/roads_lawn.txd/tar_1linefreewy.dds\",\"gta3.img/cn_nwbrigstuff.txd/tar_1linefreewy.dds\",\n \"gta3.img/desn2_alphabits.txd/desbar.dds\",\"gta3.img/cn_nwbrigstuff.txd/desbar.dds\",\n \"gta3.img/des_n.txd/desbar.dds\",\"gta3.img/cn_nwbrigstuff.txd/desbar.dds\",\n \"gta3.img/des_wires.txd/desbar.dds\",\"gta3.img/cn_nwbrigstuff.txd/desbar.dds\",\n \"gta3.img/cs_ebridge.txd/des_facmetal.dds\",\"gta3.img/cn_nwbrigstuff.txd/des_facmetal.dds\",\n \"gta3.img/cs_wbridge.txd/des_facmetal.dds\",\"gta3.img/cn_nwbrigstuff.txd/des_facmetal.dds\",\n \"gta3.img/des_byoffice.txd/des_facmetal.dds\",\"gta3.img/cn_nwbrigstuff.txd/des_facmetal.dds\",\n \"gta3.img/des_ebridge.txd/des_facmetal.dds\",\"gta3.img/cn_nwbrigstuff.txd/des_facmetal.dds\",\n \"gta3.img/desertmisc.txd/des_facmetal.dds\",\"gta3.img/cn_nwbrigstuff.txd/des_facmetal.dds\",\n \"gta3.img/des_factory.txd/des_facmetal.dds\",\"gta3.img/cn_nwbrigstuff.txd/des_facmetal.dds\",\n \"gta3.img/des_se4.txd/des_facmetal.dds\",\"gta3.img/cn_nwbrigstuff.txd/des_facmetal.dds\",\n \"gta3.img/des_stownw.txd/des_facmetal.dds\",\"gta3.img/cn_nwbrigstuff.txd/des_facmetal.dds\",\n \"gta3.img/dam_genroom.txd/dam_genbeam.dds\",\"gta3.img/cn_nwbrigstuff.txd/dam_genbeam.dds\",\n \"gta3.img/desn_trainstuff.txd/dam_genbeam.dds\",\"gta3.img/cn_nwbrigstuff.txd/dam_genbeam.dds\",\n \"gta3.img/des_oilfield.txd/dam_genbeam.dds\",\"gta3.img/cn_nwbrigstuff.txd/dam_genbeam.dds\",\n \"gta3.img/des_quarrybits.txd/dam_genbeam.dds\",\"gta3.img/cn_nwbrigstuff.txd/dam_genbeam.dds\",\n \"gta3.img/des_trainstuff.txd/dam_genbeam.dds\",\"gta3.img/cn_nwbrigstuff.txd/dam_genbeam.dds\",\n \"gta3.img/des_substation.txd/des_pylon2.dds\",\"gta3.img/cn_substation.txd/des_pylon2.dds\",\n \"gta3.img/ele_substation.txd/des_pylon2.dds\",\"gta3.img/cn_substation.txd/des_pylon2.dds\",\n \"gta3.img/weefarmcuntw.txd/sjmbigold4.dds\",\"gta3.img/cntdrrkx.txd/sjmbigold4.dds\",\n \"gta3.img/cxref_oldwest.txd/sjmbigold5.dds\",\"gta3.img/cntdrrkx.txd/sjmbigold5.dds\",\n \"gta3.img/oldwest.txd/sjmbigold5.dds\",\"gta3.img/cntdrrkx.txd/sjmbigold5.dds\",\n \"gta3.img/weefarmcuntw.txd/sjmbigold5.dds\",\"gta3.img/cntdrrkx.txd/sjmbigold5.dds\",\n \"gta3.img/sunrise01_lawn.txd/pave_dirty.dds\",\"gta3.img/coast_apts.txd/pave_dirty.dds\",\n \"gta3.img/sunrise01_lawn.txd/sunsetmall03b_law.dds\",\"gta3.img/coast_apts.txd/sunsetmall03b_law.dds\",\n \"gta3.img/garag3_lawn.txd/skategrnd2.dds\",\"gta3.img/coast_apts.txd/skategrnd2.dds\",\n \"gta3.img/sunrise01_lawn.txd/skategrnd2.dds\",\"gta3.img/coast_apts.txd/skategrnd2.dds\",\n \"gta3.img/vegashse6.txd/ws_garagedoor2_yello.dds\",\"gta3.img/coast_apts.txd/ws_garagedoor2_yello.dds\",\n \"gta3.img/sunrise01_lawn.txd/otb_floor1.dds\",\"gta3.img/coast_apts.txd/otb_floor1.dds\",\n \"gta_int.img/gen_offtrackint.txd/otb_floor1.dds\",\"gta3.img/coast_apts.txd/otb_floor1.dds\",\n \"gta3.img/sunrise01_lawn.txd/sjmhoodoor1.dds\",\"gta3.img/coast_apts.txd/sjmhoodoor1.dds\",\n \"gta3.img/sunrise01_lawn.txd/highshopwall1256.dds\",\"gta3.img/coast_apts.txd/highshopwall1256.dds\",\n \"gta3.img/venicegb02_law.txd/highshopwall1256.dds\",\"gta3.img/coast_apts.txd/highshopwall1256.dds\",\n \"gta3.img/vgntrainstat.txd/highshopwall1256.dds\",\"gta3.img/coast_apts.txd/highshopwall1256.dds\",\n \"gta3.img/vgseroads.txd/highshopwall1256.dds\",\"gta3.img/coast_apts.txd/highshopwall1256.dds\",\n \"gta3.img/vgsetrainstn.txd/highshopwall1256.dds\",\"gta3.img/coast_apts.txd/highshopwall1256.dds\",\n \"gta3.img/vgsshiways.txd/highshopwall1256.dds\",\"gta3.img/coast_apts.txd/highshopwall1256.dds\",\n \"gta3.img/vgwestground.txd/highshopwall1256.dds\",\"gta3.img/coast_apts.txd/highshopwall1256.dds\",\n \"gta3.img/vgwstdirtyrd.txd/highshopwall1256.dds\",\"gta3.img/coast_apts.txd/highshopwall1256.dds\",\n \"gta3.img/vgwsthiway1.txd/highshopwall1256.dds\",\"gta3.img/coast_apts.txd/highshopwall1256.dds\",\n \"gta3.img/lae2bigblock.txd/scumtiles1_lae.dds\",\"gta3.img/coast_apts.txd/scumtiles1_lae.dds\",\n \"gta3.img/landlae2b.txd/scumtiles1_lae.dds\",\"gta3.img/coast_apts.txd/scumtiles1_lae.dds\",\n \"gta3.img/lngblok_lae2.txd/scumtiles1_lae.dds\",\"gta3.img/coast_apts.txd/scumtiles1_lae.dds\",\n \"gta3.img/garage_sfw.txd/yardgrass1.dds\",\"gta3.img/coast_apts.txd/yardgrass1.dds\",\n \"gta3.img/jeffers4_lae.txd/yardgrass1.dds\",\"gta3.img/coast_apts.txd/yardgrass1.dds\",\n \"gta3.img/landhub.txd/yardgrass1.dds\",\"gta3.img/coast_apts.txd/yardgrass1.dds\",\n \"gta3.img/skyscrap2_lan2.txd/yardgrass1.dds\",\"gta3.img/coast_apts.txd/yardgrass1.dds\",\n \"gta3.img/sw_block9.txd/yardgrass1.dds\",\"gta3.img/coast_apts.txd/yardgrass1.dds\",\n \"gta3.img/sw_med1.txd/yardgrass1.dds\",\"gta3.img/coast_apts.txd/yardgrass1.dds\",\n \"gta3.img/vgeamun.txd/yardgrass1.dds\",\"gta3.img/coast_apts.txd/yardgrass1.dds\",\n \"gta3.img/vgnamun.txd/yardgrass1.dds\",\"gta3.img/coast_apts.txd/yardgrass1.dds\",\n \"gta3.img/vgnbball.txd/yardgrass1.dds\",\"gta3.img/coast_apts.txd/yardgrass1.dds\",\n \"gta3.img/vgncondos1.txd/yardgrass1.dds\",\"gta3.img/coast_apts.txd/yardgrass1.dds\",\n \"gta3.img/vgncorp1.txd/yardgrass1.dds\",\"gta3.img/coast_apts.txd/yardgrass1.dds\",\n \"gta3.img/vgndwntwn1.txd/yardgrass1.dds\",\"gta3.img/coast_apts.txd/yardgrass1.dds\",\n \"gta3.img/vgngebuild.txd/yardgrass1.dds\",\"gta3.img/coast_apts.txd/yardgrass1.dds\",\n \"gta3.img/vgnland.txd/yardgrass1.dds\",\"gta3.img/coast_apts.txd/yardgrass1.dds\",\n \"gta3.img/vgnpwroutbld1.txd/yardgrass1.dds\",\"gta3.img/coast_apts.txd/yardgrass1.dds\",\n \"gta3.img/vgnretail7.txd/yardgrass1.dds\",\"gta3.img/coast_apts.txd/yardgrass1.dds\",\n \"gta3.img/vgnvrock.txd/yardgrass1.dds\",\"gta3.img/coast_apts.txd/yardgrass1.dds\",\n \"gta3.img/vgsxrefpart1.txd/yardgrass1.dds\",\"gta3.img/coast_apts.txd/yardgrass1.dds\",\n \"gta3.img/vgwestcoast.txd/yardgrass1.dds\",\"gta3.img/coast_apts.txd/yardgrass1.dds\",\n \"gta3.img/vgwestground.txd/yardgrass1.dds\",\"gta3.img/coast_apts.txd/yardgrass1.dds\",\n \"gta3.img/vgwestland.txd/yardgrass1.dds\",\"gta3.img/coast_apts.txd/yardgrass1.dds\",\n \"gta3.img/sanpedh22_1x.txd/snpdhus4.dds\",\"gta3.img/coast_apts.txd/snpdhus4.dds\",\n \"gta3.img/lahillshilhs1c.txd/vendoor01_law.dds\",\"gta3.img/coast_apts.txd/vendoor01_law.dds\",\n \"gta3.img/vegashse2.txd/vendoor01_law.dds\",\"gta3.img/coast_apts.txd/vendoor01_law.dds\",\n \"gta3.img/lanriver.txd/ws_garagedoor4_peach.dds\",\"gta3.img/coast_apts.txd/ws_garagedoor4_peach.dds\",\n \"gta3.img/sjmla_las.txd/ws_garagedoor4_peach.dds\",\"gta3.img/coast_apts.txd/ws_garagedoor4_peach.dds\",\n \"gta3.img/vegashse4.txd/ws_garagedoor4_peach.dds\",\"gta3.img/coast_apts.txd/ws_garagedoor4_peach.dds\",\n \"gta3.img/sunrise01_lawn.txd/sjmhoodwin.dds\",\"gta3.img/coast_apts.txd/sjmhoodwin.dds\",\n \"gta3.img/mall_law.txd/forlease_law.dds\",\"gta3.img/coast_apts.txd/forlease_law.dds\",\n \"gta3.img/melrose15_lawn.txd/forlease_law.dds\",\"gta3.img/coast_apts.txd/forlease_law.dds\",\n \"gta3.img/posterssfse.txd/forlease_law.dds\",\"gta3.img/coast_apts.txd/forlease_law.dds\",\n \"gta3.img/sunset03_law2.txd/forlease_law.dds\",\"gta3.img/coast_apts.txd/forlease_law.dds\",\n \"gta3.img/sunset04_law2.txd/forlease_law.dds\",\"gta3.img/coast_apts.txd/forlease_law.dds\",\n \"gta3.img/melrose12_lawn.txd/pierbuild_roof1.dds\",\"gta3.img/coastground.txd/pierbuild_roof1.dds\",\n \"gta3.img/sfn_helipad.txd/pierbuild_roof1.dds\",\"gta3.img/coastground.txd/pierbuild_roof1.dds\",\n \"gta3.img/sfn_helipad.txd/pierbuild_btm2.dds\",\"gta3.img/coastground.txd/pierbuild_btm2.dds\",\n \"gta3.img/sfn_helipad.txd/pierbuild_btm3.dds\",\"gta3.img/coastground.txd/pierbuild_btm3.dds\",\n \"gta3.img/sfn_helipad.txd/pierbuild_top1.dds\",\"gta3.img/coastground.txd/pierbuild_top1.dds\",\n \"gta3.img/docks2_sfse.txd/coasty_bit4_sfe.dds\",\"gta3.img/coastground.txd/coasty_bit4_sfe.dds\",\n \"gta3.img/ferrybit_sfw.txd/coasty_bit4_sfe.dds\",\"gta3.img/coastground.txd/coasty_bit4_sfe.dds\",\n \"gta3.img/hrbr_sfn.txd/coasty_bit4_sfe.dds\",\"gta3.img/coastground.txd/coasty_bit4_sfe.dds\",\n \"gta3.img/hrbr_sfw.txd/coasty_bit4_sfe.dds\",\"gta3.img/coastground.txd/coasty_bit4_sfe.dds\",\n \"gta3.img/subpen1_sfse.txd/coasty_bit4_sfe.dds\",\"gta3.img/coastground.txd/coasty_bit4_sfe.dds\",\n \"gta3.img/vgsecoast.txd/coasty_bit4_sfe.dds\",\"gta3.img/coastground.txd/coasty_bit4_sfe.dds\",\n \"gta3.img/ferrybit_sfw.txd/coasty_fencet_sfe.dds\",\"gta3.img/coastground.txd/coasty_fencet_sfe.dds\",\n \"gta3.img/hrbr_sfn.txd/coasty_fencet_sfe.dds\",\"gta3.img/coastground.txd/coasty_fencet_sfe.dds\",\n \"gta3.img/hrbr_sfw.txd/coasty_fencet_sfe.dds\",\"gta3.img/coastground.txd/coasty_fencet_sfe.dds\",\n \"gta3.img/lombard.txd/coasty_fencet_sfe.dds\",\"gta3.img/coastground.txd/coasty_fencet_sfe.dds\",\n \"gta3.img/mulhousclahills.txd/coasty_fencet_sfe.dds\",\"gta3.img/coastground.txd/coasty_fencet_sfe.dds\",\n \"gta3.img/pier69.txd/coasty_fencet_sfe.dds\",\"gta3.img/coastground.txd/coasty_fencet_sfe.dds\",\n \"gta3.img/sfvictorian2.txd/coasty_fencet_sfe.dds\",\"gta3.img/coastground.txd/coasty_fencet_sfe.dds\",\n \"gta3.img/vegass_jetty.txd/coasty_fencet_sfe.dds\",\"gta3.img/coastground.txd/coasty_fencet_sfe.dds\",\n \"gta3.img/vgsecoast.txd/coasty_fencet_sfe.dds\",\"gta3.img/coastground.txd/coasty_fencet_sfe.dds\",\n \"gta3.img/ferrybit_sfw.txd/coasty_bit_sfe.dds\",\"gta3.img/coastground.txd/coasty_bit_sfe.dds\",\n \"gta3.img/hrbr_sfn.txd/coasty_bit_sfe.dds\",\"gta3.img/coastground.txd/coasty_bit_sfe.dds\",\n \"gta3.img/hrbr_sfw.txd/coasty_bit_sfe.dds\",\"gta3.img/coastground.txd/coasty_bit_sfe.dds\",\n \"gta3.img/cunteroads3.txd/cos_hiwayout_256.dds\",\"gta3.img/coast_las2.txd/cos_hiwayout_256.dds\",\n \"gta3.img/cunteroads4.txd/cos_hiwayout_256.dds\",\"gta3.img/coast_las2.txd/cos_hiwayout_256.dds\",\n \"gta3.img/cunteroads5.txd/cos_hiwayout_256.dds\",\"gta3.img/coast_las2.txd/cos_hiwayout_256.dds\",\n \"gta3.img/freeway2_las2.txd/cos_hiwayout_256.dds\",\"gta3.img/coast_las2.txd/cos_hiwayout_256.dds\",\n \"gta3.img/freeway2_las.txd/cos_hiwayout_256.dds\",\"gta3.img/coast_las2.txd/cos_hiwayout_256.dds\",\n \"gta3.img/freeway_las.txd/cos_hiwayout_256.dds\",\"gta3.img/coast_las2.txd/cos_hiwayout_256.dds\",\n \"gta3.img/lae2roadscoast.txd/cos_hiwayout_256.dds\",\"gta3.img/coast_las2.txd/cos_hiwayout_256.dds\",\n \"gta3.img/lae2roads.txd/cos_hiwayout_256.dds\",\"gta3.img/coast_las2.txd/cos_hiwayout_256.dds\",\n \"gta3.img/laeroads.txd/cos_hiwayout_256.dds\",\"gta3.img/coast_las2.txd/cos_hiwayout_256.dds\",\n \"gta3.img/lahillsroads6.txd/cos_hiwayout_256.dds\",\"gta3.img/coast_las2.txd/cos_hiwayout_256.dds\",\n \"gta3.img/lahillsroadscoast.txd/cos_hiwayout_256.dds\",\"gta3.img/coast_las2.txd/cos_hiwayout_256.dds\",\n \"gta3.img/lan2freeway.txd/cos_hiwayout_256.dds\",\"gta3.img/coast_las2.txd/cos_hiwayout_256.dds\",\n \"gta3.img/lanroad.txd/cos_hiwayout_256.dds\",\"gta3.img/coast_las2.txd/cos_hiwayout_256.dds\",\n \"gta3.img/cunte_gas01.txd/des_pylon1.dds\",\"gta3.img/coe_offtrackshop.txd/des_pylon1.dds\",\n \"gta3.img/des_boneyard.txd/des_pylon1.dds\",\"gta3.img/coe_offtrackshop.txd/des_pylon1.dds\",\n \"gta3.img/des_refinery.txd/des_pylon1.dds\",\"gta3.img/coe_offtrackshop.txd/des_pylon1.dds\",\n \"gta3.img/des_xoilfield.txd/des_pylon1.dds\",\"gta3.img/coe_offtrackshop.txd/des_pylon1.dds\",\n \"gta3.img/milbase.txd/des_pylon1.dds\",\"gta3.img/coe_offtrackshop.txd/des_pylon1.dds\",\n \"gta3.img/pylons.txd/des_pylon1.dds\",\"gta3.img/coe_offtrackshop.txd/des_pylon1.dds\",\n \"gta3.img/refinery.txd/des_pylon1.dds\",\"gta3.img/coe_offtrackshop.txd/des_pylon1.dds\",\n \"gta3.img/sprunkworks.txd/des_pylon1.dds\",\"gta3.img/coe_offtrackshop.txd/des_pylon1.dds\",\n \"gta3.img/xrf_refineryla.txd/des_pylon1.dds\",\"gta3.img/coe_offtrackshop.txd/des_pylon1.dds\",\n \"gta3.img/des_dinerw.txd/des_signframe.dds\",\"gta3.img/coe_offtrackshop.txd/des_signframe.dds\",\n \"gta3.img/des_stownmots1.txd/des_signframe.dds\",\"gta3.img/coe_offtrackshop.txd/des_signframe.dds\",\n \"gta3.img/des_stwnsigns1.txd/des_signframe.dds\",\"gta3.img/coe_offtrackshop.txd/des_signframe.dds\",\n \"gta3.img/silenced.txd/colt_all.dds\",\"gta3.img/colt45.txd/colt_all.dds\",\n \"gta3.img/col_wall2x.txd/ab_wood1.dds\",\"gta3.img/col_wall1x.txd/ab_wood1.dds\",\n \"gta3.img/col_wall3x.txd/ab_wood1.dds\",\"gta3.img/col_wall1x.txd/ab_wood1.dds\",\n \"gta3.img/lae2fake_int.txd/ab_wood1.dds\",\"gta3.img/col_wall1x.txd/ab_wood1.dds\",\n \"gta_int.img/ganghoos.txd/ab_wood1.dds\",\"gta3.img/col_wall1x.txd/ab_wood1.dds\",\n \"gta_int.img/imm_roomss.txd/ab_wood1.dds\",\"gta3.img/col_wall1x.txd/ab_wood1.dds\",\n \"gta_int.img/imy_motel2.txd/ab_wood1.dds\",\"gta3.img/col_wall1x.txd/ab_wood1.dds\",\n \"gta_int.img/imy_motel.txd/ab_wood1.dds\",\"gta3.img/col_wall1x.txd/ab_wood1.dds\",\n \"gta_int.img/savegenmotel.txd/ab_wood1.dds\",\"gta3.img/col_wall1x.txd/ab_wood1.dds\",\n \"gta_int.img/sweetsmain.txd/ab_wood1.dds\",\"gta3.img/col_wall1x.txd/ab_wood1.dds\",\n \"gta_int.img/sweets_roon.txd/ab_wood1.dds\",\"gta3.img/col_wall1x.txd/ab_wood1.dds\",\n \"gta3.img/col_wall2x.txd/wall1.dds\",\"gta3.img/col_wall1x.txd/wall1.dds\",\n \"gta3.img/col_wall3x.txd/wall1.dds\",\"gta3.img/col_wall1x.txd/wall1.dds\",\n \"gta_int.img/carls_kit1.txd/wall1.dds\",\"gta3.img/col_wall1x.txd/wall1.dds\",\n \"gta_int.img/carls_kit2.txd/wall1.dds\",\"gta3.img/col_wall1x.txd/wall1.dds\",\n \"gta_int.img/lasmall2int2.txd/wall1.dds\",\"gta3.img/col_wall1x.txd/wall1.dds\",\n \"gta_int.img/ganghoos.txd/motel_wall4.dds\",\"gta3.img/col_wall1x.txd/motel_wall4.dds\",\n \"gta_int.img/imm_rooms.txd/motel_wall4.dds\",\"gta3.img/col_wall1x.txd/motel_wall4.dds\",\n \"gta_int.img/imy_motel2.txd/motel_wall4.dds\",\"gta3.img/col_wall1x.txd/motel_wall4.dds\",\n \"gta_int.img/lasmall1int2.txd/motel_wall4.dds\",\"gta3.img/col_wall1x.txd/motel_wall4.dds\",\n \"gta_int.img/lasmallsave.txd/motel_wall4.dds\",\"gta3.img/col_wall1x.txd/motel_wall4.dds\",\n \"gta_int.img/savegenmotel.txd/motel_wall4.dds\",\"gta3.img/col_wall1x.txd/motel_wall4.dds\",\n \"gta_int.img/sweets_roon.txd/motel_wall4.dds\",\"gta3.img/col_wall1x.txd/motel_wall4.dds\",\n \"gta3.img/col_wall2x.txd/mp_diner_ceilingdirt.dds\",\"gta3.img/col_wall1x.txd/mp_diner_ceilingdirt.dds\",\n \"gta3.img/col_wall5x.txd/mp_diner_ceilingdirt.dds\",\"gta3.img/col_wall1x.txd/mp_diner_ceilingdirt.dds\",\n \"gta_int.img/ganghoos.txd/mp_diner_ceilingdirt.dds\",\"gta3.img/col_wall1x.txd/mp_diner_ceilingdirt.dds\",\n \"gta_int.img/gen_munation.txd/mp_diner_ceilingdirt.dds\",\"gta3.img/col_wall1x.txd/mp_diner_ceilingdirt.dds\",\n \"gta_int.img/newcrak.txd/mp_diner_ceilingdirt.dds\",\"gta3.img/col_wall1x.txd/mp_diner_ceilingdirt.dds\",\n \"gta3.img/col_wall2x.txd/mp_burn_wall4.dds\",\"gta3.img/col_wall1x.txd/mp_burn_wall4.dds\",\n \"gta3.img/col_wall5x.txd/mp_burn_wall4.dds\",\"gta3.img/col_wall1x.txd/mp_burn_wall4.dds\",\n \"gta_int.img/ganghoos.txd/mp_burn_wall4.dds\",\"gta3.img/col_wall1x.txd/mp_burn_wall4.dds\",\n \"gta_int.img/ganghoos.txd/mp_burn_wall1.dds\",\"gta3.img/col_wall1x.txd/mp_burn_wall1.dds\",\n \"gta3.img/col_wall3x.txd/curtain_sink2.dds\",\"gta3.img/col_wall2x.txd/curtain_sink2.dds\",\n \"gta_int.img/gf1.txd/curtain_sink2.dds\",\"gta3.img/col_wall2x.txd/curtain_sink2.dds\",\n \"gta_int.img/gf2.txd/curtain_sink2.dds\",\"gta3.img/col_wall2x.txd/curtain_sink2.dds\",\n \"gta_int.img/lasmall2int2.txd/curtain_sink2.dds\",\"gta3.img/col_wall2x.txd/curtain_sink2.dds\",\n \"gta_int.img/savegenmotel.txd/curtain_sink2.dds\",\"gta3.img/col_wall2x.txd/curtain_sink2.dds\",\n \"gta3.img/col_wall5x.txd/mp_burn_wall2.dds\",\"gta3.img/col_wall2x.txd/mp_burn_wall2.dds\",\n \"gta_int.img/ganghoos.txd/mp_burn_wall2.dds\",\"gta3.img/col_wall2x.txd/mp_burn_wall2.dds\",\n \"gta_int.img/ganghoos.txd/kitchen-wall1.dds\",\"gta3.img/col_wall3x.txd/kitchen-wall1.dds\",\n \"gta_int.img/lasmall2int2.txd/wall3.dds\",\"gta3.img/col_wall3x.txd/wall3.dds\",\n \"gta_int.img/ab_mafiasuitea.txd/mp_burn_ceiling.dds\",\"gta3.img/col_wall3x.txd/mp_burn_ceiling.dds\",\n \"gta_int.img/ab_wooziea.txd/mp_burn_ceiling.dds\",\"gta3.img/col_wall3x.txd/mp_burn_ceiling.dds\",\n \"gta_int.img/dr_gsbits.txd/mp_burn_ceiling.dds\",\"gta3.img/col_wall3x.txd/mp_burn_ceiling.dds\",\n \"gta_int.img/dr_gsnew.txd/mp_burn_ceiling.dds\",\"gta3.img/col_wall3x.txd/mp_burn_ceiling.dds\",\n \"gta_int.img/estate2.txd/mp_burn_ceiling.dds\",\"gta3.img/col_wall3x.txd/mp_burn_ceiling.dds\",\n \"gta_int.img/ganghoos.txd/mp_burn_ceiling.dds\",\"gta3.img/col_wall3x.txd/mp_burn_ceiling.dds\",\n \"gta_int.img/ab_trukstpa.txd/mp_diner_wood.dds\",\"gta3.img/col_wall3x.txd/mp_diner_wood.dds\",\n \"gta_int.img/burg_1.txd/mp_diner_wood.dds\",\"gta3.img/col_wall3x.txd/mp_diner_wood.dds\",\n \"gta_int.img/carlslounge.txd/mp_diner_wood.dds\",\"gta3.img/col_wall3x.txd/mp_diner_wood.dds\",\n \"gta_int.img/cj_exp.txd/mp_diner_wood.dds\",\"gta3.img/col_wall3x.txd/mp_diner_wood.dds\",\n \"gta_int.img/genintclothessport.txd/mp_diner_wood.dds\",\"gta3.img/col_wall3x.txd/mp_diner_wood.dds\",\n \"gta_int.img/imm_roomss.txd/mp_diner_wood.dds\",\"gta3.img/col_wall3x.txd/mp_diner_wood.dds\",\n \"gta_int.img/lasmall2int2.txd/mp_diner_wood.dds\",\"gta3.img/col_wall3x.txd/mp_diner_wood.dds\",\n \"gta_int.img/skate_shop.txd/mp_diner_wood.dds\",\"gta3.img/col_wall3x.txd/mp_diner_wood.dds\",\n \"gta_int.img/sweets_roon.txd/mp_diner_wood.dds\",\"gta3.img/col_wall3x.txd/mp_diner_wood.dds\",\n \"gta3.img/dingbat01_la.txd/greenwall2.dds\",\"gta3.img/comedbarrio1_la.txd/greenwall2.dds\",\n \"gta3.img/eastbeach3c_lae2.txd/greenwall2.dds\",\"gta3.img/comedbarrio1_la.txd/greenwall2.dds\",\n \"gta3.img/idlewood3_lae.txd/greenwall2.dds\",\"gta3.img/comedbarrio1_la.txd/greenwall2.dds\",\n \"gta3.img/jeffers4_lae.txd/greenwall2.dds\",\"gta3.img/comedbarrio1_la.txd/greenwall2.dds\",\n \"gta3.img/pirateship01.txd/greenwall2.dds\",\"gta3.img/comedbarrio1_la.txd/greenwall2.dds\",\n \"gta3.img/sunst18_lawn.txd/greenwall2.dds\",\"gta3.img/comedbarrio1_la.txd/greenwall2.dds\",\n \"gta3.img/vegashse3.txd/greenwall2.dds\",\"gta3.img/comedbarrio1_la.txd/greenwall2.dds\",\n \"gta3.img/vgshpground.txd/greenwall2.dds\",\"gta3.img/comedbarrio1_la.txd/greenwall2.dds\",\n \"gta3.img/vgsmotelgrnd.txd/greenwall2.dds\",\"gta3.img/comedbarrio1_la.txd/greenwall2.dds\",\n \"gta3.img/vgs_shop5.txd/greenwall2.dds\",\"gta3.img/comedbarrio1_la.txd/greenwall2.dds\",\n \"gta_int.img/starps_ext.txd/greenwall2.dds\",\"gta3.img/comedbarrio1_la.txd/greenwall2.dds\",\n \"gta3.img/sunset01_law2.txd/comptwall9.dds\",\"gta3.img/comedbarrio1_la.txd/comptwall9.dds\",\n \"gta3.img/coochieghous.txd/compdoor1_lae.dds\",\"gta3.img/comedbarrio1_la.txd/compdoor1_lae.dds\",\n \"gta3.img/gang2hous1_lae.txd/compdoor1_lae.dds\",\"gta3.img/comedbarrio1_la.txd/compdoor1_lae.dds\",\n \"gta3.img/ganghouse1_lax.txd/compdoor1_lae.dds\",\"gta3.img/comedbarrio1_la.txd/compdoor1_lae.dds\",\n \"gta3.img/glenphouse_lax.txd/compdoor1_lae.dds\",\"gta3.img/comedbarrio1_la.txd/compdoor1_lae.dds\",\n \"gta3.img/hillhousex_la9.txd/compdoor1_lae.dds\",\"gta3.img/comedbarrio1_la.txd/compdoor1_lae.dds\",\n \"gta3.img/inglewood01_lax.txd/compdoor1_lae.dds\",\"gta3.img/comedbarrio1_la.txd/compdoor1_lae.dds\",\n \"gta3.img/docg01_lahills.txd/bow_dlct_plstrb_gen.dds\",\"gta3.img/comedhos1_la.txd/bow_dlct_plstrb_gen.dds\",\n \"gta3.img/eastbeach3c_lae2.txd/bow_dlct_plstrb_gen.dds\",\"gta3.img/comedhos1_la.txd/bow_dlct_plstrb_gen.dds\",\n \"gta3.img/landhub.txd/bow_dlct_plstrb_gen.dds\",\"gta3.img/comedhos1_la.txd/bow_dlct_plstrb_gen.dds\",\n \"gta3.img/mullho03a_lahills.txd/bow_dlct_plstrb_gen.dds\",\"gta3.img/comedhos1_la.txd/bow_dlct_plstrb_gen.dds\",\n \"gta3.img/sw_diner1.txd/bow_dlct_plstrb_gen.dds\",\"gta3.img/comedhos1_la.txd/bow_dlct_plstrb_gen.dds\",\n \"gta3.img/contachou1_lae2.txd/comptwindo1.dds\",\"gta3.img/comedhos1_la.txd/comptwindo1.dds\",\n \"gta3.img/des_wdam.txd/comptwindo1.dds\",\"gta3.img/comedhos1_la.txd/comptwindo1.dds\",\n \"gta3.img/ganton01_lae2.txd/comptwindo1.dds\",\"gta3.img/comedhos1_la.txd/comptwindo1.dds\",\n \"gta3.img/portakabin.txd/comptwindo1.dds\",\"gta3.img/comedhos1_la.txd/comptwindo1.dds\",\n \"gta3.img/snpedhusxref.txd/comptwindo1.dds\",\"gta3.img/comedhos1_la.txd/comptwindo1.dds\",\n \"gta3.img/vgnretail4.txd/comptwindo1.dds\",\"gta3.img/comedhos1_la.txd/comptwindo1.dds\",\n \"gta3.img/cw_tempstuffcs_t.txd/bow_dryclean_bricks.dds\",\"gta3.img/comedhos1_la.txd/bow_dryclean_bricks.dds\",\n \"gta3.img/hillhousex2_us.txd/bow_dryclean_bricks.dds\",\"gta3.img/comedhos1_la.txd/bow_dryclean_bricks.dds\",\n \"gta3.img/kbgarage_las.txd/bow_dryclean_bricks.dds\",\"gta3.img/comedhos1_la.txd/bow_dryclean_bricks.dds\",\n \"gta3.img/mullholl_lahills.txd/bow_dryclean_bricks.dds\",\"gta3.img/comedhos1_la.txd/bow_dryclean_bricks.dds\",\n \"gta3.img/oldshops_las.txd/bow_dryclean_bricks.dds\",\"gta3.img/comedhos1_la.txd/bow_dryclean_bricks.dds\",\n \"gta3.img/tcecen4law.txd/bow_dryclean_bricks.dds\",\"gta3.img/comedhos1_la.txd/bow_dryclean_bricks.dds\",\n \"gta3.img/idlewood46_lae.txd/dock1.dds\",\"gta3.img/comedhos1_la.txd/dock1.dds\",\n \"gta3.img/sunrise09_lawn.txd/dock1.dds\",\"gta3.img/comedhos1_la.txd/dock1.dds\",\n \"gta3.img/vgnglfcrse1.txd/dock1.dds\",\"gta3.img/comedhos1_la.txd/dock1.dds\",\n \"gta3.img/projects_la.txd/comptwall6.dds\",\"gta3.img/comedhos1_la.txd/comptwall6.dds\",\n \"gta3.img/ganghouse1_lax.txd/comptwall2.dds\",\"gta3.img/comedhos1_la.txd/comptwall2.dds\",\n \"gta3.img/compapartb_la.txd/comptdoor1.dds\",\"gta3.img/comedhos1_la.txd/comptdoor1.dds\",\n \"gta3.img/compapart_la.txd/comptdoor1.dds\",\"gta3.img/comedhos1_la.txd/comptdoor1.dds\",\n \"gta3.img/contachou1_lae2.txd/comptdoor1.dds\",\"gta3.img/comedhos1_la.txd/comptdoor1.dds\",\n \"gta3.img/cunte_house1.txd/comptdoor1.dds\",\"gta3.img/comedhos1_la.txd/comptdoor1.dds\",\n \"gta3.img/eastls1_lae2.txd/comptdoor1.dds\",\"gta3.img/comedhos1_la.txd/comptdoor1.dds\",\n \"gta3.img/eastls4_lae2.txd/comptdoor1.dds\",\"gta3.img/comedhos1_la.txd/comptdoor1.dds\",\n \"gta3.img/idlewood46_lae.txd/comptdoor1.dds\",\"gta3.img/comedhos1_la.txd/comptdoor1.dds\",\n \"gta3.img/sunset01_lawn.txd/comptdoor1.dds\",\"gta3.img/comedhos1_la.txd/comptdoor1.dds\",\n \"gta3.img/vegashse8.txd/comptdoor1.dds\",\"gta3.img/comedhos1_la.txd/comptdoor1.dds\",\n \"gta3.img/vgnretail4.txd/comptdoor1.dds\",\"gta3.img/comedhos1_la.txd/comptdoor1.dds\",\n \"gta3.img/vgnretail72.txd/comptdoor1.dds\",\"gta3.img/comedhos1_la.txd/comptdoor1.dds\",\n \"gta3.img/eastls4_lae2.txd/comptwall4.dds\",\"gta3.img/comedhos1_la.txd/comptwall4.dds\",\n \"gta3.img/jeffers4_lae.txd/comptwall4.dds\",\"gta3.img/comedhos1_la.txd/comptwall4.dds\",\n \"gta3.img/jeffers4_lae.txd/comptroof2.dds\",\"gta3.img/comedhos1_la.txd/comptroof2.dds\",\n \"gta3.img/eastbeach2a_lae2.txd/walljunkdet1.dds\",\"gta3.img/comedprj1_la.txd/walljunkdet1.dds\",\n \"gta3.img/eastbeach2a_lae2.txd/waljundirt1.dds\",\"gta3.img/comedprj1_la.txd/waljundirt1.dds\",\n \"gta3.img/contachou1_lae2.txd/gableends1.dds\",\"gta3.img/compapart_la.txd/gableends1.dds\",\n \"gta3.img/contachou1_lae2.txd/tancolum1.dds\",\"gta3.img/compapart_la.txd/tancolum1.dds\",\n \"gta3.img/docg01alfa_lahills.txd/tancolum1.dds\",\"gta3.img/compapart_la.txd/tancolum1.dds\",\n \"gta3.img/contachou1_lae2.txd/crencoudet1.dds\",\"gta3.img/compapart_la.txd/crencoudet1.dds\",\n \"gta3.img/dingbat01_la.txd/comptwall11.dds\",\"gta3.img/compapart_la.txd/comptwall11.dds\",\n \"gta3.img/sw_block11a.txd/awniningsides1.dds\",\"gta3.img/compapart_la.txd/awniningsides1.dds\",\n \"gta3.img/sw_block11.txd/awniningsides1.dds\",\"gta3.img/compapart_la.txd/awniningsides1.dds\",\n \"gta3.img/houselod_lax.txd/comptwall4lod.dds\",\"gta3.img/comphouse_lod.txd/comptwall4lod.dds\",\n \"gta3.img/lod2lae1.txd/comptwall4lod.dds\",\"gta3.img/comphouse_lod.txd/comptwall4lod.dds\",\n \"gta3.img/lod2lae1.txd/compthous1lod.dds\",\"gta3.img/comphouse_lod.txd/compthous1lod.dds\",\n \"gta3.img/houselod_lax.txd/comptroof1lod.dds\",\"gta3.img/comphouse_lod.txd/comptroof1lod.dds\",\n \"gta3.img/lod2lae1.txd/comptroof1lod.dds\",\"gta3.img/comphouse_lod.txd/comptroof1lod.dds\",\n \"gta3.img/pierlaw2_lod.txd/comptroof1lod.dds\",\"gta3.img/comphouse_lod.txd/comptroof1lod.dds\",\n \"gta3.img/cuntwland.txd/grassdirtblend.dds\",\"gta3.img/compomark_lae2.txd/grassdirtblend.dds\",\n \"gta3.img/pirateland.txd/grasstype7.dds\",\"gta3.img/compomark_lae2.txd/grasstype7.dds\",\n \"gta3.img/eastbeach3c_lae2.txd/gangsign5_lae.dds\",\"gta3.img/compomark_lae2.txd/gangsign5_lae.dds\",\n \"gta3.img/pierc_law2.txd/beachwall4_256.dds\",\"gta3.img/compomark_lae2.txd/beachwall4_256.dds\",\n \"gta3.img/pierc_law2.txd/beachwall3_256.dds\",\"gta3.img/compomark_lae2.txd/beachwall3_256.dds\",\n \"gta3.img/eastls4_lae2.txd/sanpshop2.dds\",\"gta3.img/compomark_lae2.txd/sanpshop2.dds\",\n \"gta3.img/imstuff_las2.txd/sjmlawarplt.dds\",\"gta3.img/compthotrans_la.txd/sjmlawarplt.dds\",\n \"gta3.img/imy_bbox.txd/sjmlawarplt.dds\",\"gta3.img/compthotrans_la.txd/sjmlawarplt.dds\",\n \"gta3.img/sjmla_las.txd/sjmlawarplt.dds\",\"gta3.img/compthotrans_la.txd/sjmlawarplt.dds\",\n \"gta3.img/imstuff_las2.txd/sjmlawarplt3.dds\",\"gta3.img/compthotrans_la.txd/sjmlawarplt3.dds\",\n \"gta3.img/sjmla_las.txd/sjmlawarplt3.dds\",\"gta3.img/compthotrans_la.txd/sjmlawarplt3.dds\",\n \"gta3.img/des_stownstrip1.txd/drvin_door2.dds\",\"gta3.img/con_drivein.txd/drvin_door2.dds\",\n \"gta3.img/desn_teepee.txd/drvin_door1.dds\",\"gta3.img/con_drivein.txd/drvin_door1.dds\",\n \"gta3.img/des_teepee.txd/drvin_door1.dds\",\"gta3.img/con_drivein.txd/drvin_door1.dds\",\n \"gta3.img/des_wtownmain.txd/drvin_door1.dds\",\"gta3.img/con_drivein.txd/drvin_door1.dds\",\n \"gta3.img/cxref_desert.txd/drvin_metal.dds\",\"gta3.img/con_drivein.txd/desrtmetal.dds\",\n \"gta3.img/des_clifftown.txd/drvin_metal.dds\",\"gta3.img/con_drivein.txd/desrtmetal.dds\",\n \"gta3.img/desn_teepee.txd/drvin_metal.dds\",\"gta3.img/con_drivein.txd/desrtmetal.dds\",\n \"gta3.img/des_teepee.txd/drvin_metal.dds\",\"gta3.img/con_drivein.txd/desrtmetal.dds\",\n \"gta3.img/oldwest.txd/drvin_metal.dds\",\"gta3.img/con_drivein.txd/desrtmetal.dds\",\n \"gta3.img/desn_teepee.txd/drvin_wind2.dds\",\"gta3.img/con_drivein.txd/drvin_wind2.dds\",\n \"gta3.img/des_stownstrip1.txd/drvin_wind2.dds\",\"gta3.img/con_drivein.txd/drvin_wind2.dds\",\n \"gta3.img/des_teepee.txd/drvin_wind2.dds\",\"gta3.img/con_drivein.txd/drvin_wind2.dds\",\n \"gta3.img/des_byoffice.txd/drvin_front.dds\",\"gta3.img/con_drivein.txd/drvin_front.dds\",\n \"gta3.img/des_geyser.txd/drvin_stuct2.dds\",\"gta3.img/con_drivein.txd/drvin_stuct2.dds\",\n \"gta3.img/des_ntown.txd/drvin_stuct2.dds\",\"gta3.img/con_drivein.txd/drvin_stuct2.dds\",\n \"gta3.img/des_stwnsigns1.txd/drvin_stuct2.dds\",\"gta3.img/con_drivein.txd/drvin_stuct2.dds\",\n \"gta3.img/des_stownw.txd/drvin_back.dds\",\"gta3.img/con_drivein.txd/drvin_back.dds\",\n \"gta3.img/oldwest.txd/drvin_back.dds\",\"gta3.img/con_drivein.txd/drvin_back.dds\",\n \"gta3.img/des_stwnsigns1.txd/drvin_stuct.dds\",\"gta3.img/con_drivein.txd/drvin_stuct.dds\",\n \"gta3.img/cuntwbtxcs_t.txd/des_whitewin1.dds\",\"gta3.img/conhooses.txd/des_whitewin1.dds\",\n \"gta3.img/cuntwshopscs_t.txd/des_whitewin1.dds\",\"gta3.img/conhooses.txd/des_whitewin1.dds\",\n \"gta3.img/cxref_oldwest.txd/des_whitewin1.dds\",\"gta3.img/conhooses.txd/des_whitewin1.dds\",\n \"gta3.img/des_baitshop.txd/des_whitewin1.dds\",\"gta3.img/conhooses.txd/des_whitewin1.dds\",\n \"gta3.img/des_farmstuff.txd/des_whitewin1.dds\",\"gta3.img/conhooses.txd/des_whitewin1.dds\",\n \"gta3.img/des_nstuff.txd/des_whitewin1.dds\",\"gta3.img/conhooses.txd/des_whitewin1.dds\",\n \"gta3.img/des_nwtownclinic.txd/des_whitewin1.dds\",\"gta3.img/conhooses.txd/des_whitewin1.dds\",\n \"gta3.img/des_nwtown.txd/des_whitewin1.dds\",\"gta3.img/conhooses.txd/des_whitewin1.dds\",\n \"gta3.img/des_nwtownw.txd/des_whitewin1.dds\",\"gta3.img/conhooses.txd/des_whitewin1.dds\",\n \"gta3.img/des_wtownmain.txd/des_whitewin1.dds\",\"gta3.img/conhooses.txd/des_whitewin1.dds\",\n \"gta3.img/oldwest.txd/des_whitewin1.dds\",\"gta3.img/conhooses.txd/des_whitewin1.dds\",\n \"gta3.img/cxref_oldwest.txd/des_door1.dds\",\"gta3.img/conhooses.txd/des_door1.dds\",\n \"gta3.img/des_clifftown.txd/des_door1.dds\",\"gta3.img/conhooses.txd/des_door1.dds\",\n \"gta3.img/des_farmstuff.txd/des_door1.dds\",\"gta3.img/conhooses.txd/des_door1.dds\",\n \"gta3.img/des_nstuff.txd/des_door1.dds\",\"gta3.img/conhooses.txd/des_door1.dds\",\n \"gta3.img/des_ntown.txd/des_door1.dds\",\"gta3.img/conhooses.txd/des_door1.dds\",\n \"gta3.img/des_nwtownw.txd/des_door1.dds\",\"gta3.img/conhooses.txd/des_door1.dds\",\n \"gta3.img/des_pueblo.txd/des_door1.dds\",\"gta3.img/conhooses.txd/des_door1.dds\",\n \"gta3.img/des_wtownmain.txd/des_door1.dds\",\"gta3.img/conhooses.txd/des_door1.dds\",\n \"gta3.img/oldwest.txd/des_door1.dds\",\"gta3.img/conhooses.txd/des_door1.dds\",\n \"gta3.img/sfn_caravansfn.txd/trail_wall2.dds\",\"gta3.img/conhooses.txd/trail_wall2.dds\",\n \"gta3.img/sw_block09.txd/trail_wall2.dds\",\"gta3.img/conhooses.txd/trail_wall2.dds\",\n \"gta3.img/trailers.txd/trail_wall2.dds\",\"gta3.img/conhooses.txd/trail_wall2.dds\",\n \"gta3.img/sfn_caravansfn.txd/trail_wheel.dds\",\"gta3.img/conhooses.txd/trail_wheel.dds\",\n \"gta3.img/trailers.txd/trail_wheel.dds\",\"gta3.img/conhooses.txd/trail_wheel.dds\",\n \"gta3.img/country_breakable.txd/ws_corr_metal1.dds\",\"gta3.img/conhooses.txd/ws_corr_metal1.dds\",\n \"gta3.img/crackfactdem_sfs.txd/ws_corr_metal1.dds\",\"gta3.img/conhooses.txd/ws_corr_metal1.dds\",\n \"gta3.img/crackfact_sfse.txd/ws_corr_metal1.dds\",\"gta3.img/conhooses.txd/ws_corr_metal1.dds\",\n \"gta3.img/crack_intkb.txd/ws_corr_metal1.dds\",\"gta3.img/conhooses.txd/ws_corr_metal1.dds\",\n \"gta3.img/cs_misc.txd/ws_corr_metal1.dds\",\"gta3.img/conhooses.txd/ws_corr_metal1.dds\",\n \"gta3.img/cw2_photoblockcs_t.txd/ws_corr_metal1.dds\",\"gta3.img/conhooses.txd/ws_corr_metal1.dds\",\n \"gta3.img/cxref_desert.txd/ws_corr_metal1.dds\",\"gta3.img/conhooses.txd/ws_corr_metal1.dds\",\n \"gta3.img/cxref_savhus.txd/ws_corr_metal1.dds\",\"gta3.img/conhooses.txd/ws_corr_metal1.dds\",\n \"gta3.img/des_boneyard.txd/ws_corr_metal1.dds\",\"gta3.img/conhooses.txd/ws_corr_metal1.dds\",\n \"gta3.img/des_quarrybelts.txd/ws_corr_metal1.dds\",\"gta3.img/conhooses.txd/ws_corr_metal1.dds\",\n \"gta3.img/newhubgrg1_sfse.txd/ws_corr_metal1.dds\",\"gta3.img/conhooses.txd/ws_corr_metal1.dds\",\n \"gta3.img/oldgarage_sfse.txd/ws_corr_metal1.dds\",\"gta3.img/conhooses.txd/ws_corr_metal1.dds\",\n \"gta3.img/oldwest.txd/ws_corr_metal1.dds\",\"gta3.img/conhooses.txd/ws_corr_metal1.dds\",\n \"gta3.img/sunset01_lawn.txd/ws_corr_metal1.dds\",\"gta3.img/conhooses.txd/ws_corr_metal1.dds\",\n \"gta3.img/tramstatsfw.txd/ws_corr_metal1.dds\",\"gta3.img/conhooses.txd/ws_corr_metal1.dds\",\n \"gta3.img/cxref_oldwest.txd/trail_win2.dds\",\"gta3.img/conhooses.txd/trail_win2.dds\",\n \"gta3.img/des_farmstuff.txd/trail_win2.dds\",\"gta3.img/conhooses.txd/trail_win2.dds\",\n \"gta3.img/oldwest.txd/trail_win2.dds\",\"gta3.img/conhooses.txd/trail_win2.dds\",\n \"gta3.img/sfn_caravansfn.txd/trail_win2.dds\",\"gta3.img/conhooses.txd/trail_win2.dds\",\n \"gta3.img/trailers.txd/trail_win2.dds\",\"gta3.img/conhooses.txd/trail_win2.dds\",\n \"gta3.img/desn2_stud.txd/des_hooswinwee1.dds\",\"gta3.img/conhooses.txd/des_hooswinwee1.dds\",\n \"gta3.img/des_stownmain2.txd/des_hooswinwee1.dds\",\"gta3.img/conhooses.txd/des_hooswinwee1.dds\",\n \"gta3.img/des_ufoinn.txd/des_hooswinwee1.dds\",\"gta3.img/conhooses.txd/des_hooswinwee1.dds\",\n \"gta3.img/des_wtownmain.txd/des_hooswinwee1.dds\",\"gta3.img/conhooses.txd/des_hooswinwee1.dds\",\n \"gta3.img/des_ntown.txd/des_greyboards.dds\",\"gta3.img/conhooses.txd/des_greyboards.dds\",\n \"gta3.img/des_nwtownclinic.txd/des_greyboards.dds\",\"gta3.img/conhooses.txd/des_greyboards.dds\",\n \"gta3.img/cuntwbt.txd/des_greyslats.dds\",\"gta3.img/conhooses.txd/des_greyslats.dds\",\n \"gta3.img/cuntwbtxcs_t.txd/des_greyslats.dds\",\"gta3.img/conhooses.txd/des_greyslats.dds\",\n \"gta3.img/cuntwshopscs_t.txd/des_greyslats.dds\",\"gta3.img/conhooses.txd/des_greyslats.dds\",\n \"gta3.img/cxref_oldwest.txd/des_greyslats.dds\",\"gta3.img/conhooses.txd/des_greyslats.dds\",\n \"gta3.img/des_baitshop.txd/des_greyslats.dds\",\"gta3.img/conhooses.txd/des_greyslats.dds\",\n \"gta3.img/des_bighus.txd/des_greyslats.dds\",\"gta3.img/conhooses.txd/des_greyslats.dds\",\n \"gta3.img/des_farmstuff.txd/des_greyslats.dds\",\"gta3.img/conhooses.txd/des_greyslats.dds\",\n \"gta3.img/des_geyser.txd/des_greyslats.dds\",\"gta3.img/conhooses.txd/des_greyslats.dds\",\n \"gta3.img/des_nstuff.txd/des_greyslats.dds\",\"gta3.img/conhooses.txd/des_greyslats.dds\",\n \"gta3.img/des_ntown.txd/des_greyslats.dds\",\"gta3.img/conhooses.txd/des_greyslats.dds\",\n \"gta3.img/des_nwtownclinic.txd/des_greyslats.dds\",\"gta3.img/conhooses.txd/des_greyslats.dds\",\n \"gta3.img/des_nwtown.txd/des_greyslats.dds\",\"gta3.img/conhooses.txd/des_greyslats.dds\",\n \"gta3.img/des_nwtownw.txd/des_greyslats.dds\",\"gta3.img/conhooses.txd/des_greyslats.dds\",\n \"gta3.img/des_wtownmain.txd/des_greyslats.dds\",\"gta3.img/conhooses.txd/des_greyslats.dds\",\n \"gta3.img/oldwest.txd/des_greyslats.dds\",\"gta3.img/conhooses.txd/des_greyslats.dds\",\n \"gta3.img/cunte_bar1.txd/alleydoor4.dds\",\"gta3.img/conhooses.txd/trail_door.dds\",\n \"gta3.img/ganton01_lae2.txd/alleydoor4.dds\",\"gta3.img/conhooses.txd/trail_door.dds\",\n \"gta3.img/ground5_las.txd/alleydoor4.dds\",\"gta3.img/conhooses.txd/trail_door.dds\",\n \"gta3.img/sfn_caravansfn.txd/trail_door.dds\",\"gta3.img/conhooses.txd/trail_door.dds\",\n \"gta3.img/shopliquor_las.txd/alleydoor4.dds\",\"gta3.img/conhooses.txd/trail_door.dds\",\n \"gta3.img/slapart01sfe.txd/alleydoor4.dds\",\"gta3.img/conhooses.txd/trail_door.dds\",\n \"gta3.img/studio01_lawn.txd/alleydoor4.dds\",\"gta3.img/conhooses.txd/trail_door.dds\",\n \"gta3.img/sw_block06.txd/alleydoor4.dds\",\"gta3.img/conhooses.txd/trail_door.dds\",\n \"gta3.img/trailers.txd/trail_door.dds\",\"gta3.img/conhooses.txd/trail_door.dds\",\n \"gta3.img/vgnfremnt1.txd/alleydoor4.dds\",\"gta3.img/conhooses.txd/trail_door.dds\",\n \"gta3.img/vgnretail5.txd/alleydoor4.dds\",\"gta3.img/conhooses.txd/trail_door.dds\",\n \"gta_int.img/int_tatoo.txd/alleydoor4.dds\",\"gta3.img/conhooses.txd/trail_door.dds\",\n \"gta3.img/des_stownmain1.txd/sanruf.dds\",\"gta3.img/conhooses.txd/sanruf.dds\",\n \"gta3.img/des_stownmain2.txd/sanruf.dds\",\"gta3.img/conhooses.txd/sanruf.dds\",\n \"gta3.img/desn2_stud.txd/des_hooswin1.dds\",\"gta3.img/conhooses.txd/des_hooswin1.dds\",\n \"gta3.img/cuntwshopscs_t.txd/des_adobedoor1.dds\",\"gta3.img/conhooses.txd/des_adobedoor1.dds\",\n \"gta3.img/cxref_oldwest.txd/des_adobedoor1.dds\",\"gta3.img/conhooses.txd/des_adobedoor1.dds\",\n \"gta3.img/cxref_savhus.txd/des_adobedoor1.dds\",\"gta3.img/conhooses.txd/des_adobedoor1.dds\",\n \"gta3.img/des_baitshop.txd/des_adobedoor1.dds\",\"gta3.img/conhooses.txd/des_adobedoor1.dds\",\n \"gta3.img/des_bighus.txd/des_adobedoor1.dds\",\"gta3.img/conhooses.txd/des_adobedoor1.dds\",\n \"gta3.img/des_clifftown.txd/des_adobedoor1.dds\",\"gta3.img/conhooses.txd/des_adobedoor1.dds\",\n \"gta3.img/des_farmstuff.txd/des_adobedoor1.dds\",\"gta3.img/conhooses.txd/des_adobedoor1.dds\",\n \"gta3.img/des_ntown.txd/des_adobedoor1.dds\",\"gta3.img/conhooses.txd/des_adobedoor1.dds\",\n \"gta3.img/des_nwtown.txd/des_adobedoor1.dds\",\"gta3.img/conhooses.txd/des_adobedoor1.dds\",\n \"gta3.img/des_pueblo.txd/des_adobedoor1.dds\",\"gta3.img/conhooses.txd/des_adobedoor1.dds\",\n \"gta3.img/des_wtownmain.txd/des_adobedoor1.dds\",\"gta3.img/conhooses.txd/des_adobedoor1.dds\",\n \"gta3.img/oldwest.txd/des_adobedoor1.dds\",\"gta3.img/conhooses.txd/des_adobedoor1.dds\",\n \"gta3.img/cxref_savhus.txd/des_dustconc.dds\",\"gta3.img/conhooses.txd/des_dustconc.dds\",\n \"gta3.img/des_cen.txd/des_dustconc.dds\",\"gta3.img/conhooses.txd/des_dustconc.dds\",\n \"gta3.img/des_clifftown.txd/des_dustconc.dds\",\"gta3.img/conhooses.txd/des_dustconc.dds\",\n \"gta3.img/des_cn2_dam.txd/des_dustconc.dds\",\"gta3.img/conhooses.txd/des_dustconc.dds\",\n \"gta3.img/des_geyser.txd/des_dustconc.dds\",\"gta3.img/conhooses.txd/des_dustconc.dds\",\n \"gta3.img/desn_teepee.txd/des_dustconc.dds\",\"gta3.img/conhooses.txd/des_dustconc.dds\",\n \"gta3.img/des_ntown.txd/des_dustconc.dds\",\"gta3.img/conhooses.txd/des_dustconc.dds\",\n \"gta3.img/des_n.txd/des_dustconc.dds\",\"gta3.img/conhooses.txd/des_dustconc.dds\",\n \"gta3.img/des_nwtownclinic.txd/des_dustconc.dds\",\"gta3.img/conhooses.txd/des_dustconc.dds\",\n \"gta3.img/des_nwtownpolice.txd/des_dustconc.dds\",\"gta3.img/conhooses.txd/des_dustconc.dds\",\n \"gta3.img/des_nwtown.txd/des_dustconc.dds\",\"gta3.img/conhooses.txd/des_dustconc.dds\",\n \"gta3.img/des_stownmain1.txd/des_dustconc.dds\",\"gta3.img/conhooses.txd/des_dustconc.dds\",\n \"gta3.img/des_stownmain2.txd/des_dustconc.dds\",\"gta3.img/conhooses.txd/des_dustconc.dds\",\n \"gta3.img/des_stownstrip2.txd/des_dustconc.dds\",\"gta3.img/conhooses.txd/des_dustconc.dds\",\n \"gta3.img/des_s.txd/des_dustconc.dds\",\"gta3.img/conhooses.txd/des_dustconc.dds\",\n \"gta3.img/des_sw.txd/des_dustconc.dds\",\"gta3.img/conhooses.txd/des_dustconc.dds\",\n \"gta3.img/des_teepee.txd/des_dustconc.dds\",\"gta3.img/conhooses.txd/des_dustconc.dds\",\n \"gta3.img/des_wdam.txd/des_dustconc.dds\",\"gta3.img/conhooses.txd/des_dustconc.dds\",\n \"gta3.img/des_wtownmain.txd/des_dustconc.dds\",\"gta3.img/conhooses.txd/des_dustconc.dds\",\n \"gta3.img/con_stuff.txd/trail_wall1.dds\",\"gta3.img/conhooses.txd/trail_wall1.dds\",\n \"gta3.img/counte_bridge.txd/trail_wall1.dds\",\"gta3.img/conhooses.txd/trail_wall1.dds\",\n \"gta3.img/cunteroads4.txd/trail_wall1.dds\",\"gta3.img/conhooses.txd/trail_wall1.dds\",\n \"gta3.img/dk_midbuilds.txd/trail_wall1.dds\",\"gta3.img/conhooses.txd/trail_wall1.dds\",\n \"gta3.img/lahillslaroads.txd/trail_wall1.dds\",\"gta3.img/conhooses.txd/trail_wall1.dds\",\n \"gta3.img/sfn_caravansfn.txd/trail_wall1.dds\",\"gta3.img/conhooses.txd/trail_wall1.dds\",\n \"gta3.img/trailers.txd/trail_wall1.dds\",\"gta3.img/conhooses.txd/trail_wall1.dds\",\n \"gta3.img/des_telescopestuff.txd/4winscurt_law.dds\",\"gta3.img/contachou1_lae2.txd/4winscurt_law.dds\",\n \"gta3.img/glenpark6d_lae.txd/4winscurt_law.dds\",\"gta3.img/contachou1_lae2.txd/4winscurt_law.dds\",\n \"gta3.img/sw_apartments.txd/4winscurt_law.dds\",\"gta3.img/contachou1_lae2.txd/4winscurt_law.dds\",\n \"gta3.img/sw_block11a.txd/4winscurt_law.dds\",\"gta3.img/contachou1_lae2.txd/4winscurt_law.dds\",\n \"gta3.img/pirateland.txd/pierplanks02_128.dds\",\"gta3.img/contachou1_lae2.txd/pierplanks02_128.dds\",\n \"gta3.img/pirateship01.txd/pierplanks02_128.dds\",\"gta3.img/contachou1_lae2.txd/pierplanks02_128.dds\",\n \"gta3.img/tikibridge.txd/pierplanks02_128.dds\",\"gta3.img/contachou1_lae2.txd/pierplanks02_128.dds\",\n \"gta_int.img/starps_ext.txd/pierplanks02_128.dds\",\"gta3.img/contachou1_lae2.txd/pierplanks02_128.dds\",\n \"gta3.img/coochieghous.txd/gangwin1_lae.dds\",\"gta3.img/contachou1_lae2.txd/gangwin1_lae.dds\",\n \"gta3.img/gang2hous1_lae.txd/gangwin1_lae.dds\",\"gta3.img/contachou1_lae2.txd/gangwin1_lae.dds\",\n \"gta3.img/ganghouse1_lax.txd/gangwin1_lae.dds\",\"gta3.img/contachou1_lae2.txd/gangwin1_lae.dds\",\n \"gta3.img/cw_truckstopcs_t.txd/shingles5.dds\",\"gta3.img/contachou1_lae2.txd/shingles5.dds\",\n \"gta3.img/desn_truckstop.txd/shingles5.dds\",\"gta3.img/contachou1_lae2.txd/shingles5.dds\",\n \"gta3.img/hillhousex_la1_2.txd/shingles5.dds\",\"gta3.img/contachou1_lae2.txd/shingles5.dds\",\n \"gta3.img/sunset02_law2.txd/shingles5.dds\",\"gta3.img/contachou1_lae2.txd/shingles5.dds\",\n \"gta_int.img/lamidint2.txd/mp_apt1_woodpanel.dds\",\"gta3.img/contachou1_lae2.txd/mp_apt1_woodpanel.dds\",\n \"gta3.img/eastshops1_lae.txd/woodwarewall1.dds\",\"gta3.img/contachou1_lae2.txd/woodwarewall1.dds\",\n \"gta3.img/wddngchpl02.txd/shingles6.dds\",\"gta3.img/contachou1_lae2.txd/shingles6.dds\",\n \"gta3.img/eastls1b_lae2.txd/comptwall16.dds\",\"gta3.img/coochieghous.txd/comptwall16.dds\",\n \"gta3.img/gang2hous1_lae.txd/comptwall16.dds\",\"gta3.img/coochieghous.txd/comptwall16.dds\",\n \"gta3.img/ganghouse1_lax.txd/comptwall16.dds\",\"gta3.img/coochieghous.txd/comptwall16.dds\",\n \"gta3.img/ganton02_lae2.txd/comptwall16.dds\",\"gta3.img/coochieghous.txd/comptwall16.dds\",\n \"gta3.img/lae2bigblock.txd/comptwall16.dds\",\"gta3.img/coochieghous.txd/comptwall16.dds\",\n \"gta3.img/lae2grnd.txd/comptwall16.dds\",\"gta3.img/coochieghous.txd/comptwall16.dds\",\n \"gta3.img/gang2hous1_lae.txd/sanpednhus1r.dds\",\"gta3.img/coochieghous.txd/sanpednhus1r.dds\",\n \"gta3.img/ganghouse1_lax.txd/sanpednhus1r.dds\",\"gta3.img/coochieghous.txd/sanpednhus1r.dds\",\n \"gta3.img/ground4_las.txd/sanpednhus1r.dds\",\"gta3.img/coochieghous.txd/sanpednhus1r.dds\",\n \"gta3.img/ground5_las.txd/sanpednhus1r.dds\",\"gta3.img/coochieghous.txd/sanpednhus1r.dds\",\n \"gta3.img/jeffers4_lae.txd/sanpednhus1r.dds\",\"gta3.img/coochieghous.txd/sanpednhus1r.dds\",\n \"gta3.img/mulhousclahills.txd/sanpednhus1r.dds\",\"gta3.img/coochieghous.txd/sanpednhus1r.dds\",\n \"gta3.img/snpedhusxref.txd/sanpednhus1r.dds\",\"gta3.img/coochieghous.txd/sanpednhus1r.dds\",\n \"gta3.img/fbitruck.txd/fbitruck92decalsa64.dds\",\"gta3.img/copbike.txd/copbike92decalsa64.dds\",\n \"gta3.img/copcarsf.txd/copcarla92interior128.dds\",\"gta3.img/copcarla.txd/copcarla92interior128.dds\",\n \"gta3.img/copcarvg.txd/copcarvg92interior128.dds\",\"gta3.img/copcarla.txd/copcarla92interior128.dds\",\n \"gta3.img/copcarvg.txd/copcarla92interior128.dds\",\"gta3.img/copcarla.txd/copcarla92interior128.dds\",\n \"gta3.img/odnrooft.txd/dt_fire_escape_shit_texture.dds\",\"gta3.img/copshop_sfe.txd/dt_fire_escape_shit_texture.dds\",\n \"gta3.img/roofbit_lawn.txd/dt_fire_escape_shit_texture.dds\",\"gta3.img/copshop_sfe.txd/dt_fire_escape_shit_texture.dds\",\n \"gta3.img/sfroofshit.txd/dt_fire_escape_shit_texture.dds\",\"gta3.img/copshop_sfe.txd/dt_fire_escape_shit_texture.dds\",\n \"gta3.img/stolenbuild01.txd/dt_fire_escape_shit_texture.dds\",\"gta3.img/copshop_sfe.txd/dt_fire_escape_shit_texture.dds\",\n \"gta3.img/sfroofshit.txd/dt_scyscrap_door2.dds\",\"gta3.img/copshop_sfe.txd/dt_scyscrap_door2.dds\",\n \"gta3.img/hosbibalsfw.txd/dt_cops_us_flag.dds\",\"gta3.img/copshop_sfe.txd/dt_cops_us_flag.dds\",\n \"gta3.img/cuntclub_law2.txd/shutters.dds\",\"gta3.img/corvinsign_sfse.txd/shutters.dds\",\n \"gta3.img/docklight.txd/shutters.dds\",\"gta3.img/corvinsign_sfse.txd/shutters.dds\",\n \"gta3.img/docks2refl_sfse.txd/shutters.dds\",\"gta3.img/corvinsign_sfse.txd/shutters.dds\",\n \"gta3.img/escstep.txd/shutters.dds\",\"gta3.img/corvinsign_sfse.txd/shutters.dds\",\n \"gta3.img/kmb_shut.txd/shutters.dds\",\"gta3.img/corvinsign_sfse.txd/shutters.dds\",\n \"gta3.img/la_props1.txd/shutters2.dds\",\"gta3.img/corvinsign_sfse.txd/shutters.dds\",\n \"gta3.img/milbase.txd/shutters2.dds\",\"gta3.img/corvinsign_sfse.txd/shutters.dds\",\n \"gta3.img/quarry.txd/shutters.dds\",\"gta3.img/corvinsign_sfse.txd/shutters.dds\",\n \"gta3.img/santamopollaw2.txd/shutters2.dds\",\"gta3.img/corvinsign_sfse.txd/shutters.dds\",\n \"gta3.img/sprunkworks.txd/shutters2.dds\",\"gta3.img/corvinsign_sfse.txd/shutters.dds\",\n \"gta3.img/vgnglfcrse1.txd/shutters.dds\",\"gta3.img/corvinsign_sfse.txd/shutters.dds\",\n \"gta3.img/dkcargoshp_las2.txd/rustb256128.dds\",\"gta3.img/corvinsign_sfse.txd/rustb256128.dds\",\n \"gta3.img/helixbarrier.txd/rustb256128.dds\",\"gta3.img/corvinsign_sfse.txd/rustb256128.dds\",\n \"gta3.img/hubint1_sfse.txd/rustb256128.dds\",\"gta3.img/corvinsign_sfse.txd/rustb256128.dds\",\n \"gta3.img/vgssairport02.txd/rustb256128.dds\",\"gta3.img/corvinsign_sfse.txd/rustb256128.dds\",\n \"gta3.img/des_byofficeint.txd/ham_radio.dds\",\"gta3.img/cos_liquorstore.txd/ham_radio.dds\",\n \"gta3.img/mp_ranchcut.txd/ham_radio.dds\",\"gta3.img/cos_liquorstore.txd/ham_radio.dds\",\n \"gta3.img/ufo_barbakroom.txd/ham_radio.dds\",\"gta3.img/cos_liquorstore.txd/ham_radio.dds\",\n \"gta3.img/cunte_gas01.txd/cos_liqcounter.dds\",\"gta3.img/cos_liquorstore.txd/cos_liqcounter.dds\",\n \"gta3.img/ufo_bar.txd/cos_liqbots.dds\",\"gta3.img/cos_liquorstore.txd/cos_liqbots.dds\",\n \"gta3.img/ufo_bar.txd/cos_beercab.dds\",\"gta3.img/cos_liquorstore.txd/cos_beercab.dds\",\n \"gta3.img/vegashse4.txd/ws_cleanblock.dds\",\"gta3.img/cos_liquorstore.txd/ws_cleanblock.dds\",\n \"gta3.img/cos_pizzaplace.txd/b_wtilesreflect.dds\",\"gta3.img/cos_liquorstore.txd/b_wtilesreflect.dds\",\n \"gta3.img/cuntwrestcs_t.txd/ws_greymetal.dds\",\"gta3.img/cos_pizzaplace.txd/ws_greymetal.dds\",\n \"gta3.img/des_trainstuff.txd/ws_greymetal.dds\",\"gta3.img/cos_pizzaplace.txd/ws_greymetal.dds\",\n \"gta3.img/garage_sfw.txd/ws_greymetal.dds\",\"gta3.img/cos_pizzaplace.txd/ws_greymetal.dds\",\n \"gta3.img/la_props1.txd/ws_greymetal.dds\",\"gta3.img/cos_pizzaplace.txd/ws_greymetal.dds\",\n \"gta3.img/refinery.txd/ws_greymetal.dds\",\"gta3.img/cos_pizzaplace.txd/ws_greymetal.dds\",\n \"gta3.img/traintrafficsign.txd/ws_greymetal.dds\",\"gta3.img/cos_pizzaplace.txd/ws_greymetal.dds\",\n \"gta3.img/vgssairport.txd/ws_greymetal.dds\",\"gta3.img/cos_pizzaplace.txd/ws_greymetal.dds\",\n \"gta3.img/melrose13_lawn.txd/shutter_64.dds\",\"gta3.img/cos_pizzaplace.txd/shutter_64.dds\",\n \"gta3.img/wngdishx.txd/shutter_64.dds\",\"gta3.img/cos_pizzaplace.txd/shutter_64.dds\",\n \"gta3.img/sfn_apart02sfn.txd/roughmotwall1.dds\",\"gta3.img/cos_pizzaplace.txd/roughmotwall1.dds\",\n \"gta3.img/vgsebuild01.txd/roughmotwall1.dds\",\"gta3.img/cos_pizzaplace.txd/roughmotwall1.dds\",\n \"gta3.img/countryclbtnis_sfs.txd/tennisnet_64.dds\",\"gta3.img/councl_law2.txd/tennisnet_64.dds\",\n \"gta3.img/vgncondos1.txd/tennisnet_64.dds\",\"gta3.img/councl_law2.txd/tennisnet_64.dds\",\n \"gta3.img/laealpha.txd/lanlabra1_m.dds\",\"gta3.img/councl_law2.txd/lanlabra1_m.dds\",\n \"gta3.img/rodeo01_law2.txd/rodwall12_law2.dds\",\"gta3.img/councl_law2.txd/rodwall12_law2.dds\",\n \"gta3.img/rodeo01_law2.txd/rodwall11_law2.dds\",\"gta3.img/councl_law2.txd/rodwall11_law2.dds\",\n \"gta3.img/rodeo01_law2.txd/rodeo5sjm.dds\",\"gta3.img/councl_law2.txd/rodeo5sjm.dds\",\n \"gta3.img/sunset02_law2.txd/rodeo5sjm.dds\",\"gta3.img/councl_law2.txd/rodeo5sjm.dds\",\n \"gta3.img/cuntwshopscs_t.txd/711shop1.dds\",\"gta3.img/councl_law2.txd/711shop1.dds\",\n \"gta3.img/garag3_lawn.txd/tarmacplain2_bank.dds\",\"gta3.img/councl_law2.txd/tarmacplain2_bank.dds\",\n \"gta3.img/hospital_lawn.txd/tarmacplain2_bank.dds\",\"gta3.img/councl_law2.txd/tarmacplain2_bank.dds\",\n \"gta3.img/lawnstripm.txd/tarmacplain2_bank.dds\",\"gta3.img/councl_law2.txd/tarmacplain2_bank.dds\",\n \"gta3.img/mainlcawn.txd/tarmacplain2_bank.dds\",\"gta3.img/councl_law2.txd/tarmacplain2_bank.dds\",\n \"gta3.img/melrose11_lawn.txd/tarmacplain2_bank.dds\",\"gta3.img/councl_law2.txd/tarmacplain2_bank.dds\",\n \"gta3.img/melrose12_lawn.txd/tarmacplain2_bank.dds\",\"gta3.img/councl_law2.txd/tarmacplain2_bank.dds\",\n \"gta3.img/rodeo02_law2.txd/tarmacplain2_bank.dds\",\"gta3.img/councl_law2.txd/tarmacplain2_bank.dds\",\n \"gta3.img/rodeo05_law2.txd/tarmacplain2_bank.dds\",\"gta3.img/councl_law2.txd/tarmacplain2_bank.dds\",\n \"gta3.img/sunrise01_lawn.txd/tarmacplain2_bank.dds\",\"gta3.img/councl_law2.txd/tarmacplain2_bank.dds\",\n \"gta3.img/sunrise11_lawn.txd/tarmacplain2_bank.dds\",\"gta3.img/councl_law2.txd/tarmacplain2_bank.dds\",\n \"gta3.img/sunset01_lawn.txd/tarmacplain2_bank.dds\",\"gta3.img/councl_law2.txd/tarmacplain2_bank.dds\",\n \"gta3.img/sunset02_law2.txd/tarmacplain2_bank.dds\",\"gta3.img/councl_law2.txd/tarmacplain2_bank.dds\",\n \"gta3.img/sunset04_law2.txd/tarmacplain2_bank.dds\",\"gta3.img/councl_law2.txd/tarmacplain2_bank.dds\",\n \"gta3.img/sunst18_lawn.txd/tarmacplain2_bank.dds\",\"gta3.img/councl_law2.txd/tarmacplain2_bank.dds\",\n \"gta3.img/law2_roadsb.txd/rodeo3sjm.dds\",\"gta3.img/councl_law2.txd/rodeo3sjm.dds\",\n \"gta3.img/cuntwland.txd/grassdeep256.dds\",\"gta3.img/councl_law2.txd/grassdeep256.dds\",\n \"gta3.img/sunset02_law2.txd/grassdeep256.dds\",\"gta3.img/councl_law2.txd/grassdeep256.dds\",\n \"gta3.img/park_sfw.txd/stonewall2_la.dds\",\"gta3.img/councl_law2.txd/stonewall2_la.dds\",\n \"gta3.img/ufo_bar.txd/stonewall2_la.dds\",\"gta3.img/councl_law2.txd/stonewall2_la.dds\",\n \"gta3.img/countryclbtnis_sfs.txd/tenniscourt1_256.dds\",\"gta3.img/councl_law2.txd/tenniscourt1_256.dds\",\n \"gta3.img/vgncondos1.txd/tenniscourt1_256.dds\",\"gta3.img/councl_law2.txd/tenniscourt1_256.dds\",\n \"gta3.img/nicepark_sfe.txd/grass_lawn_128hv.dds\",\"gta3.img/councl_law2.txd/grass_lawn_128hv.dds\",\n \"gta3.img/vgnbball.txd/grass_lawn_128hv.dds\",\"gta3.img/councl_law2.txd/grass_lawn_128hv.dds\",\n \"gta3.img/sw_farm1.txd/sw_barnwood3.dds\",\"gta3.img/counte_b2.txd/sw_barnwood3.dds\",\n \"gta3.img/sw_farm1.txd/sw_watower01.dds\",\"gta3.img/counte_b2.txd/sw_watower01.dds\",\n \"gta3.img/sawmillcs_t.txd/corrugated5_64hv.dds\",\"gta3.img/counthousmisc.txd/corrugated5_64hv.dds\",\n \"gta3.img/w_town2cs_t.txd/corrugated5_64hv.dds\",\"gta3.img/counthousmisc.txd/corrugated5_64hv.dds\",\n \"gta3.img/des_ufoinn.txd/shackdoor01.dds\",\"gta3.img/counthousmisc.txd/shackdoor01.dds\",\n \"gta3.img/factorycuntw.txd/banding7_64hv.dds\",\"gta3.img/country_breakable.txd/banding7_64hv.dds\",\n \"gta3.img/satdish.txd/banding7_64hv.dds\",\"gta3.img/country_breakable.txd/banding7_64hv.dds\",\n \"gta3.img/vgnpwroutbld2.txd/banding7_64hv.dds\",\"gta3.img/country_breakable.txd/banding7_64hv.dds\",\n \"gta3.img/countryclbtnis_sfs.txd/road2_256.dds\",\"gta3.img/countryclbgnd_sfs.txd/road2_256.dds\",\n \"gta3.img/hotelbackpool_sfs.txd/ws_tantiles1btm.dds\",\"gta3.img/countryclbgnd_sfs.txd/ws_tantiles1btm.dds\",\n \"gta3.img/landhub.txd/grass_path_128hv.dds\",\"gta3.img/countryclbtnis_sfs.txd/grass_path_128hv.dds\",\n \"gta3.img/lahillshilhs1e.txd/monobloc_16.dds\",\"gta3.img/countryclbtnis_sfs.txd/monobloc_16.dds\",\n \"gta3.img/sfe_builda.txd/monobloc_16.dds\",\"gta3.img/countryclbtnis_sfs.txd/monobloc_16.dds\",\n \"gta3.img/smallertxd.txd/monobloc_16.dds\",\"gta3.img/countryclbtnis_sfs.txd/monobloc_16.dds\",\n \"gta3.img/lawwhitebuilds.txd/pinkpave.dds\",\"gta3.img/countryclbtnis_sfs.txd/pinkpave.dds\",\n \"gta3.img/ferry_building.txd/ferry_build4.dds\",\"gta3.img/countryclub_sfs.txd/ferry_build4.dds\",\n \"gta3.img/pier_sfe.txd/ferry_build4.dds\",\"gta3.img/countryclub_sfs.txd/ferry_build4.dds\",\n \"gta3.img/cs_coast.txd/des_dam_conc.dds\",\"gta3.img/countrys_pch.txd/des_dam_conc.dds\",\n \"gta3.img/cs_mountain.txd/des_dam_conc.dds\",\"gta3.img/countrys_pch.txd/des_dam_conc.dds\",\n \"gta3.img/cs_town.txd/des_dam_conc.dds\",\"gta3.img/countrys_pch.txd/des_dam_conc.dds\",\n \"gta3.img/cuntwlandse.txd/des_dam_conc.dds\",\"gta3.img/countrys_pch.txd/des_dam_conc.dds\",\n \"gta3.img/cuntwlandwest.txd/des_dam_conc.dds\",\"gta3.img/countrys_pch.txd/des_dam_conc.dds\",\n \"gta3.img/cuntwroad.txd/des_dam_conc.dds\",\"gta3.img/countrys_pch.txd/des_dam_conc.dds\",\n \"gta3.img/dam_genroom.txd/des_dam_conc.dds\",\"gta3.img/countrys_pch.txd/des_dam_conc.dds\",\n \"gta3.img/des_cn2_dam.txd/des_dam_conc.dds\",\"gta3.img/countrys_pch.txd/des_dam_conc.dds\",\n \"gta3.img/desertdam.txd/des_dam_conc.dds\",\"gta3.img/countrys_pch.txd/des_dam_conc.dds\",\n \"gta3.img/des_geyser.txd/des_dam_conc.dds\",\"gta3.img/countrys_pch.txd/des_dam_conc.dds\",\n \"gta3.img/des_nstuff.txd/des_dam_conc.dds\",\"gta3.img/countrys_pch.txd/des_dam_conc.dds\",\n \"gta3.img/des_ntown.txd/des_dam_conc.dds\",\"gta3.img/countrys_pch.txd/des_dam_conc.dds\",\n \"gta3.img/des_nw.txd/des_dam_conc.dds\",\"gta3.img/countrys_pch.txd/des_dam_conc.dds\",\n \"gta3.img/des_stownw.txd/des_dam_conc.dds\",\"gta3.img/countrys_pch.txd/des_dam_conc.dds\",\n \"gta3.img/des_wdam.txd/des_dam_conc.dds\",\"gta3.img/countrys_pch.txd/des_dam_conc.dds\",\n \"gta3.img/des_wtownmain.txd/des_dam_conc.dds\",\"gta3.img/countrys_pch.txd/des_dam_conc.dds\",\n \"gta3.img/freeways_sfse.txd/des_dam_conc.dds\",\"gta3.img/countrys_pch.txd/des_dam_conc.dds\",\n \"gta3.img/oldwest.txd/des_dam_conc.dds\",\"gta3.img/countrys_pch.txd/des_dam_conc.dds\",\n \"gta3.img/cw_farm.txd/rustc256128.dds\",\"gta3.img/countrys.txd/rustc256128.dds\",\n \"gta3.img/des_ranch.txd/rustc256128.dds\",\"gta3.img/countrys.txd/rustc256128.dds\",\n \"gta3.img/jettycw.txd/rustc256128.dds\",\"gta3.img/countrys.txd/rustc256128.dds\",\n \"gta3.img/qrydrx.txd/rustc256128.dds\",\"gta3.img/countrys.txd/rustc256128.dds\",\n \"gta3.img/sw_oldshack.txd/rustc256128.dds\",\"gta3.img/countrys.txd/rustc256128.dds\",\n \"gta3.img/scum2_sfs.txd/ws_woodenscreen1.dds\",\"gta3.img/coveredpath_sfs.txd/ws_woodenscreen1.dds\",\n \"gta3.img/hubprops1_sfse.txd/ws_carskidmarks.dds\",\"gta3.img/crackdrive_sfse.txd/ws_carskidmarks.dds\",\n \"gta3.img/subshops_sfs.txd/ws_carskidmarks.dds\",\"gta3.img/crackdrive_sfse.txd/ws_carskidmarks.dds\",\n \"gta3.img/crackfact_sfse.txd/ws_dampdoubledoor.dds\",\"gta3.img/crackfactdem_sfs.txd/ws_dampdoubledoor.dds\",\n \"gta3.img/crackfact_sfse.txd/ws_corr_plastic.dds\",\"gta3.img/crackfactdem_sfs.txd/ws_corr_plastic.dds\",\n \"gta3.img/crack_intkb.txd/ws_corr_plastic.dds\",\"gta3.img/crackfactdem_sfs.txd/ws_corr_plastic.dds\",\n \"gta3.img/newhubgrg1_sfse.txd/ws_corr_plastic.dds\",\"gta3.img/crackfactdem_sfs.txd/ws_corr_plastic.dds\",\n \"gta3.img/crack_int_sfse.txd/ws_fuckedwin2.dds\",\"gta3.img/crackfact_sfse.txd/ws_fuckedwin2.dds\",\n \"gta3.img/hubint2.txd/ws_fuckedwin2.dds\",\"gta3.img/crackfact_sfse.txd/ws_fuckedwin2.dds\",\n \"gta3.img/mission2_sfse.txd/ws_emptywarehouse.dds\",\"gta3.img/crackfact_sfse.txd/ws_emptywarehouse.dds\",\n \"gta3.img/scum2_sfs.txd/ws_emptywarehouse.dds\",\"gta3.img/crackfact_sfse.txd/ws_emptywarehouse.dds\",\n \"gta_int.img/ab_sfammuitems01.txd/ammu_ammo.dds\",\"gta3.img/crack_intkb.txd/ammu_ammo.dds\",\n \"gta_int.img/ab_sfammuitems02.txd/ammu_ammo.dds\",\"gta3.img/crack_intkb.txd/ammu_ammo.dds\",\n \"gta_int.img/ammu_2flrprops.txd/ammu_ammo.dds\",\"gta3.img/crack_intkb.txd/ammu_ammo.dds\",\n \"gta_int.img/cj_ammun_extra.txd/ammu_ammo.dds\",\"gta3.img/crack_intkb.txd/ammu_ammo.dds\",\n \"gta_int.img/munation_xtras2.txd/ammu_ammo.dds\",\"gta3.img/crack_intkb.txd/ammu_ammo.dds\",\n \"gta3.img/cranes_dyn2.txd/ws_oldpaintedyello_b.dds\",\"gta3.img/cranes_dyn2_cj.txd/ws_oldpaintedyello_b.dds\",\n \"gta3.img/des_quarrycrane.txd/ws_oldpaintedyello_b.dds\",\"gta3.img/cranes_dyn2_cj.txd/ws_oldpaintedyello_b.dds\",\n \"gta3.img/cuntwf.txd/block2_high.dds\",\"gta3.img/cranes_dyn2_cj.txd/block2_high.dds\",\n \"gta3.img/cranes_dyn2.txd/ws_oldpaintedyello.dds\",\"gta3.img/cranes_dyn2_cj.txd/ws_oldpaintedyello.dds\",\n \"gta3.img/des_quarrycrane.txd/ws_oldpaintedyello.dds\",\"gta3.img/cranes_dyn2_cj.txd/ws_oldpaintedyello.dds\",\n \"gta3.img/freightcrane.txd/ws_oldpaintedyello.dds\",\"gta3.img/cranes_dyn2_cj.txd/ws_oldpaintedyello.dds\",\n \"gta3.img/imrancomp_las2.txd/ws_cablehang.dds\",\"gta3.img/cranes_dyn2_cj.txd/ws_cablehang.dds\",\n \"gta_int.img/genintwarehsint3.txd/ws_cablehang.dds\",\"gta3.img/cranes_dyn2_cj.txd/ws_cablehang.dds\",\n \"gta_int.img/smashtv.txd/ws_cablehang.dds\",\"gta3.img/cranes_dyn2_cj.txd/ws_cablehang.dds\",\n \"gta3.img/cranes_dyn2.txd/ws_dudelogo.dds\",\"gta3.img/cranes_dyn2_cj.txd/ws_dudelogo.dds\",\n \"gta3.img/imrancomp_las2.txd/ws_oldpaintedblue.dds\",\"gta3.img/cranes_dyn2_cj.txd/ws_oldpaintedblue.dds\",\n \"gta_int.img/genintwarehsint3.txd/ws_oldpaintedblue.dds\",\"gta3.img/cranes_dyn2_cj.txd/ws_oldpaintedblue.dds\",\n \"gta_int.img/smashtv.txd/ws_oldpaintedblue.dds\",\"gta3.img/cranes_dyn2_cj.txd/ws_oldpaintedblue.dds\",\n \"gta3.img/portakabin.txd/ws_finalbuild.dds\",\"gta3.img/cranes_dyn2.txd/ws_finalbuild.dds\",\n \"gta3.img/scum2_sfs.txd/ws_finalbuild.dds\",\"gta3.img/cranes_dyn2.txd/ws_finalbuild.dds\",\n \"gta3.img/vgnbballsign2.txd/ws_finalbuild.dds\",\"gta3.img/cranes_dyn2.txd/ws_finalbuild.dds\",\n \"gta3.img/vgncnstrct1.txd/ws_finalbuild.dds\",\"gta3.img/cranes_dyn2.txd/ws_finalbuild.dds\",\n \"gta3.img/vgssairportcpark.txd/ws_finalbuild.dds\",\"gta3.img/cranes_dyn2.txd/ws_finalbuild.dds\",\n \"gta3.img/cw2_storesnstuff.txd/block.dds\",\"gta3.img/cranes_dyn2.txd/block.dds\",\n \"gta3.img/factorycuntw.txd/block.dds\",\"gta3.img/cranes_dyn2.txd/block.dds\",\n \"gta3.img/laeroads.txd/block.dds\",\"gta3.img/cranes_dyn2.txd/block.dds\",\n \"gta_int.img/8bars.txd/bridgeconc.dds\",\"gta3.img/cranes_dyn2.txd/block.dds\",\n \"gta_int.img/bridge.txd/bridgeconc.dds\",\"gta3.img/cranes_dyn2.txd/block.dds\",\n \"gta_int.img/innertrak.txd/bridgeconc.dds\",\"gta3.img/cranes_dyn2.txd/block.dds\",\n \"gta_int.img/kickstart.txd/bridgeconc.dds\",\"gta3.img/cranes_dyn2.txd/block.dds\",\n \"gta3.img/cunte_lik.txd/duskyred_64.dds\",\"gta3.img/cranes_dyn2.txd/duskyred_64.dds\",\n \"gta3.img/cuntwrestcs_t.txd/duskyred_64.dds\",\"gta3.img/cranes_dyn2.txd/duskyred_64.dds\",\n \"gta3.img/cuntwshopscs_t.txd/duskyred_64.dds\",\"gta3.img/cranes_dyn2.txd/duskyred_64.dds\",\n \"gta3.img/cw2_photoblockcs_t.txd/duskyred_64.dds\",\"gta3.img/cranes_dyn2.txd/duskyred_64.dds\",\n \"gta3.img/des_boneyard.txd/duskyred_64.dds\",\"gta3.img/cranes_dyn2.txd/duskyred_64.dds\",\n \"gta3.img/des_stownmain2.txd/duskyred_64.dds\",\"gta3.img/cranes_dyn2.txd/duskyred_64.dds\",\n \"gta3.img/des_stownmain3.txd/duskyred_64.dds\",\"gta3.img/cranes_dyn2.txd/duskyred_64.dds\",\n \"gta3.img/lodvgsslod.txd/duskyred_64.dds\",\"gta3.img/cranes_dyn2.txd/duskyred_64.dds\",\n \"gta3.img/pershingsq.txd/duskyred_64.dds\",\"gta3.img/cranes_dyn2.txd/duskyred_64.dds\",\n \"gta3.img/sunrise02_lawn.txd/duskyred_64.dds\",\"gta3.img/cranes_dyn2.txd/duskyred_64.dds\",\n \"gta3.img/vgnbball.txd/duskyred_64.dds\",\"gta3.img/cranes_dyn2.txd/duskyred_64.dds\",\n \"gta3.img/vgncircir.txd/duskyred_64.dds\",\"gta3.img/cranes_dyn2.txd/duskyred_64.dds\",\n \"gta3.img/vgnretail4.txd/duskyred_64.dds\",\"gta3.img/cranes_dyn2.txd/duskyred_64.dds\",\n \"gta3.img/vgnretail72.txd/duskyred_64.dds\",\"gta3.img/cranes_dyn2.txd/duskyred_64.dds\",\n \"gta3.img/vgsswarehse02.txd/duskyred_64.dds\",\"gta3.img/cranes_dyn2.txd/duskyred_64.dds\",\n \"gta3.img/vgsswrehse03.txd/duskyred_64.dds\",\"gta3.img/cranes_dyn2.txd/duskyred_64.dds\",\n \"gta3.img/cw2_logcabins.txd/villagreen128256.dds\",\"gta3.img/crash3doorx.txd/villagreen128256.dds\",\n \"gta3.img/glenpark1x_lae.txd/villagreen128256.dds\",\"gta3.img/crash3doorx.txd/villagreen128256.dds\",\n \"gta3.img/ground4_las.txd/villagreen128256.dds\",\"gta3.img/crash3doorx.txd/villagreen128256.dds\",\n \"gta3.img/ground5_las.txd/villagreen128256.dds\",\"gta3.img/crash3doorx.txd/villagreen128256.dds\",\n \"gta3.img/idlewood3_lae.txd/villagreen128256.dds\",\"gta3.img/crash3doorx.txd/villagreen128256.dds\",\n \"gta3.img/imrancomp_kmb.txd/villagreen128256.dds\",\"gta3.img/crash3doorx.txd/villagreen128256.dds\",\n \"gta3.img/jeffers4_lae.txd/villagreen128256.dds\",\"gta3.img/crash3doorx.txd/villagreen128256.dds\",\n \"gta3.img/mulhousclahills.txd/villagreen128256.dds\",\"gta3.img/crash3doorx.txd/villagreen128256.dds\",\n \"gta3.img/snpedhusxref.txd/villagreen128256.dds\",\"gta3.img/crash3doorx.txd/villagreen128256.dds\",\n \"gta3.img/sunrise01_lawn.txd/villagreen128256.dds\",\"gta3.img/crash3doorx.txd/villagreen128256.dds\",\n \"gta3.img/sw_block09.txd/villagreen128256.dds\",\"gta3.img/crash3doorx.txd/villagreen128256.dds\",\n \"gta3.img/sw_block12.txd/villagreen128256.dds\",\"gta3.img/crash3doorx.txd/villagreen128256.dds\",\n \"gta3.img/vegashse2.txd/villagreen128256.dds\",\"gta3.img/crash3doorx.txd/villagreen128256.dds\",\n \"gta3.img/vgwsavehses.txd/villagreen128256.dds\",\"gta3.img/crash3doorx.txd/villagreen128256.dds\",\n \"gta3.img/wshxrefhse2.txd/villagreen128256.dds\",\"gta3.img/crash3doorx.txd/villagreen128256.dds\",\n \"gta_int.img/genintwarehsint3.txd/villagreen128256.dds\",\"gta3.img/crash3doorx.txd/villagreen128256.dds\",\n \"gta3.img/hubprops2_sfse.txd/cj_oil_drum_l0.dds\",\"gta3.img/crates_n_stuffext.txd/cj_oil_drum_l0.dds\",\n \"gta_int.img/cj_ammo.txd/cj_oil_drum_l0.dds\",\"gta3.img/crates_n_stuffext.txd/cj_oil_drum_l0.dds\",\n \"gta_int.img/mafcasgenstuff.txd/cj_oil_drum_l0.dds\",\"gta3.img/crates_n_stuffext.txd/cj_oil_drum_l0.dds\",\n \"gta3.img/rustler.txd/rustler92prop64.dds\",\"gta3.img/cropdust.txd/cropdustprop4bit64.dds\",\n \"gta3.img/easthills_lahills.txd/pavetilealley256128.dds\",\"gta3.img/crparkgm_lan2.txd/pavetilealley256128.dds\",\n \"gta3.img/landhub.txd/pavetilealley256128.dds\",\"gta3.img/crparkgm_lan2.txd/pavetilealley256128.dds\",\n \"gta3.img/landlae2c.txd/pavetilealley256128.dds\",\"gta3.img/crparkgm_lan2.txd/pavetilealley256128.dds\",\n \"gta3.img/mullho03a_lahills.txd/pavetilealley256128.dds\",\"gta3.img/crparkgm_lan2.txd/pavetilealley256128.dds\",\n \"gta3.img/mullho03_lahills.txd/pavetilealley256128.dds\",\"gta3.img/crparkgm_lan2.txd/pavetilealley256128.dds\",\n \"gta3.img/rock_coastsfw.txd/pavetilealley256128.dds\",\"gta3.img/crparkgm_lan2.txd/pavetilealley256128.dds\",\n \"gta3.img/shops_sfse.txd/pavetilealley256128.dds\",\"gta3.img/crparkgm_lan2.txd/pavetilealley256128.dds\",\n \"gta3.img/vinewood01_lahills.txd/pavetilealley256128.dds\",\"gta3.img/crparkgm_lan2.txd/pavetilealley256128.dds\",\n \"gta3.img/vgsswrehse03.txd/parking01_law.dds\",\"gta3.img/crparkgm_lan2.txd/parking01_law.dds\",\n \"gta3.img/roads_lawn.txd/gm_lacarpark1.dds\",\"gta3.img/crparkgm_lan2.txd/gm_lacarpark1.dds\",\n \"gta3.img/stadium_lae2.txd/gm_lacarpark1.dds\",\"gta3.img/crparkgm_lan2.txd/gm_lacarpark1.dds\",\n \"gta_int.img/cj_bandit.txd/slot_bit3.dds\",\"gta3.img/cr_slotsx.txd/slot_bit3.dds\",\n \"gta_int.img/kbslotmchines.txd/slot_bit3.dds\",\"gta3.img/cr_slotsx.txd/slot_bit3.dds\",\n \"gta_int.img/mafcasgenstuff.txd/slot_bit3.dds\",\"gta3.img/cr_slotsx.txd/slot_bit3.dds\",\n \"gta_int.img/maint1.txd/slot_bit3.dds\",\"gta3.img/cr_slotsx.txd/slot_bit3.dds\",\n \"gta_int.img/slotsx.txd/slot_bit3.dds\",\"gta3.img/cr_slotsx.txd/slot_bit3.dds\",\n \"gta_int.img/slotsx.txd/slot5_ind.dds\",\"gta3.img/cr_slotsx.txd/slot5_ind.dds\",\n \"gta_int.img/kbslotnu2.txd/slot_fr_9.dds\",\"gta3.img/cr_slotsx.txd/slot_fr_9.dds\",\n \"gta_int.img/slotsx.txd/slot_fr_9.dds\",\"gta3.img/cr_slotsx.txd/slot_fr_9.dds\",\n \"gta_int.img/kbslotnu2.txd/slot_fr_8.dds\",\"gta3.img/cr_slotsx.txd/slot_fr_8.dds\",\n \"gta_int.img/slotsx.txd/slot_fr_8.dds\",\"gta3.img/cr_slotsx.txd/slot_fr_8.dds\",\n \"gta_int.img/kbslotnu2.txd/slot_fr_7.dds\",\"gta3.img/cr_slotsx.txd/slot_fr_7.dds\",\n \"gta_int.img/slotsx.txd/slot_fr_7.dds\",\"gta3.img/cr_slotsx.txd/slot_fr_7.dds\",\n \"gta_int.img/kbslotnu2.txd/slot_fr_6.dds\",\"gta3.img/cr_slotsx.txd/slot_fr_6.dds\",\n \"gta_int.img/slotsx.txd/slot_fr_6.dds\",\"gta3.img/cr_slotsx.txd/slot_fr_6.dds\",\n \"gta_int.img/kbslotnu2.txd/slot_fr_5.dds\",\"gta3.img/cr_slotsx.txd/slot_fr_5.dds\",\n \"gta_int.img/slotsx.txd/slot_fr_5.dds\",\"gta3.img/cr_slotsx.txd/slot_fr_5.dds\",\n \"gta_int.img/kbslotnu2.txd/slot_fr_4.dds\",\"gta3.img/cr_slotsx.txd/slot_fr_4.dds\",\n \"gta_int.img/slotsx.txd/slot_fr_4.dds\",\"gta3.img/cr_slotsx.txd/slot_fr_4.dds\",\n \"gta_int.img/kbslotnu2.txd/slot_fr_3.dds\",\"gta3.img/cr_slotsx.txd/slot_fr_3.dds\",\n \"gta_int.img/slotsx.txd/slot_fr_3.dds\",\"gta3.img/cr_slotsx.txd/slot_fr_3.dds\",\n \"gta_int.img/kbslotnu2.txd/slot_fr_2.dds\",\"gta3.img/cr_slotsx.txd/slot_fr_2.dds\",\n \"gta_int.img/slotsx.txd/slot_fr_2.dds\",\"gta3.img/cr_slotsx.txd/slot_fr_2.dds\",\n \"gta_int.img/kbslotnu2.txd/slot_fr_1.dds\",\"gta3.img/cr_slotsx.txd/slot_fr_1.dds\",\n \"gta_int.img/kbslotnu.txd/slot_fr_1.dds\",\"gta3.img/cr_slotsx.txd/slot_fr_1.dds\",\n \"gta_int.img/slotsx.txd/slot_fr_1.dds\",\"gta3.img/cr_slotsx.txd/slot_fr_1.dds\",\n \"gta3.img/cs_town.txd/des_dirt2trackr.dds\",\"gta3.img/cs_coast.txd/des_dirt2trackr.dds\",\n \"gta3.img/des_ne.txd/des_dirt2trackr.dds\",\"gta3.img/cs_coast.txd/des_dirt2trackr.dds\",\n \"gta3.img/des_n.txd/des_dirt2trackr.dds\",\"gta3.img/cs_coast.txd/des_dirt2trackr.dds\",\n \"gta3.img/des_se1.txd/des_dirt2trackr.dds\",\"gta3.img/cs_coast.txd/des_dirt2trackr.dds\",\n \"gta3.img/des_se4.txd/des_dirt2trackr.dds\",\"gta3.img/cs_coast.txd/des_dirt2trackr.dds\",\n \"gta3.img/des_s.txd/des_dirt2trackr.dds\",\"gta3.img/cs_coast.txd/des_dirt2trackr.dds\",\n \"gta3.img/des_sw.txd/des_dirt2trackr.dds\",\"gta3.img/cs_coast.txd/des_dirt2trackr.dds\",\n \"gta3.img/des2vegas_join.txd/des_dirt2blend.dds\",\"gta3.img/cs_coast.txd/des_dirt2blend.dds\",\n \"gta3.img/des_bighus.txd/des_dirt2blend.dds\",\"gta3.img/cs_coast.txd/des_dirt2blend.dds\",\n \"gta3.img/des_ne.txd/des_dirt2blend.dds\",\"gta3.img/cs_coast.txd/des_dirt2blend.dds\",\n \"gta3.img/des_n.txd/des_dirt2blend.dds\",\"gta3.img/cs_coast.txd/des_dirt2blend.dds\",\n \"gta3.img/des_nw.txd/des_dirt2blend.dds\",\"gta3.img/cs_coast.txd/des_dirt2blend.dds\",\n \"gta3.img/des_se1.txd/des_dirt2blend.dds\",\"gta3.img/cs_coast.txd/des_dirt2blend.dds\",\n \"gta3.img/des_se3.txd/des_dirt2blend.dds\",\"gta3.img/cs_coast.txd/des_dirt2blend.dds\",\n \"gta3.img/des_se4.txd/des_dirt2blend.dds\",\"gta3.img/cs_coast.txd/des_dirt2blend.dds\",\n \"gta3.img/des_s.txd/des_dirt2blend.dds\",\"gta3.img/cs_coast.txd/des_dirt2blend.dds\",\n \"gta3.img/des_sw.txd/des_dirt2blend.dds\",\"gta3.img/cs_coast.txd/des_dirt2blend.dds\",\n \"gta_int.img/dirtrack.txd/des_dirt2blend.dds\",\"gta3.img/cs_coast.txd/des_dirt2blend.dds\",\n \"gta3.img/cs_mountain.txd/des_dirt2grgrass.dds\",\"gta3.img/cs_coast.txd/des_dirt2grgrass.dds\",\n \"gta3.img/cs_forest.txd/rocktq128_grass4blend.dds\",\"gta3.img/cs_coast.txd/rocktq128_grass4blend.dds\",\n \"gta3.img/cs_town.txd/rocktq128_grass4blend.dds\",\"gta3.img/cs_coast.txd/rocktq128_grass4blend.dds\",\n \"gta3.img/cuntwlandcarparks.txd/rocktq128_grass4blend.dds\",\"gta3.img/cs_coast.txd/rocktq128_grass4blend.dds\",\n \"gta3.img/cuntwlandse.txd/rocktq128_grass4blend.dds\",\"gta3.img/cs_coast.txd/rocktq128_grass4blend.dds\",\n \"gta3.img/cuntwland.txd/rocktq128_grass4blend.dds\",\"gta3.img/cs_coast.txd/rocktq128_grass4blend.dds\",\n \"gta3.img/cuntwlandwest.txd/rocktq128_grass4blend.dds\",\"gta3.img/cs_coast.txd/rocktq128_grass4blend.dds\",\n \"gta3.img/mountainsfs.txd/rocktq128_grass4blend.dds\",\"gta3.img/cs_coast.txd/rocktq128_grass4blend.dds\",\n \"gta3.img/silconland_sfse.txd/rocktq128_grass4blend.dds\",\"gta3.img/cs_coast.txd/rocktq128_grass4blend.dds\",\n \"gta3.img/cs_forest.txd/grasstype4.dds\",\"gta3.img/cs_coast.txd/grasstype4.dds\",\n \"gta3.img/cs_mountain.txd/grasstype4.dds\",\"gta3.img/cs_coast.txd/grasstype4.dds\",\n \"gta3.img/cs_roads.txd/grasstype4.dds\",\"gta3.img/cs_coast.txd/grasstype4.dds\",\n \"gta3.img/cs_town.txd/grasstype4.dds\",\"gta3.img/cs_coast.txd/grasstype4.dds\",\n \"gta3.img/cuntwlandcarparks.txd/grasstype4.dds\",\"gta3.img/cs_coast.txd/grasstype4.dds\",\n \"gta3.img/cuntwlandse.txd/grasstype4.dds\",\"gta3.img/cs_coast.txd/grasstype4.dds\",\n \"gta3.img/cuntwland.txd/grasstype4.dds\",\"gta3.img/cs_coast.txd/grasstype4.dds\",\n \"gta3.img/cuntwlandwest.txd/grasstype4.dds\",\"gta3.img/cs_coast.txd/grasstype4.dds\",\n \"gta3.img/des_se3.txd/grasstype4.dds\",\"gta3.img/cs_coast.txd/grasstype4.dds\",\n \"gta3.img/freeway2_sfs.txd/grasstype4.dds\",\"gta3.img/cs_coast.txd/grasstype4.dds\",\n \"gta3.img/freeway_sfs.txd/grasstype4.dds\",\"gta3.img/cs_coast.txd/grasstype4.dds\",\n \"gta3.img/mountainsfs.txd/grasstype4.dds\",\"gta3.img/cs_coast.txd/grasstype4.dds\",\n \"gta3.img/silconland_sfse.txd/grasstype4.dds\",\"gta3.img/cs_coast.txd/grasstype4.dds\",\n \"gta3.img/sunrise01_lawn.txd/grasstype4.dds\",\"gta3.img/cs_coast.txd/grasstype4.dds\",\n \"gta3.img/sunrise11_lawn.txd/grasstype4.dds\",\"gta3.img/cs_coast.txd/grasstype4.dds\",\n \"gta3.img/sunset01_lawn.txd/grasstype4.dds\",\"gta3.img/cs_coast.txd/grasstype4.dds\",\n \"gta3.img/cs_forest.txd/grasstype4_mudblend.dds\",\"gta3.img/cs_coast.txd/grasstype4_mudblend.dds\",\n \"gta3.img/cs_mountain.txd/grasstype4_mudblend.dds\",\"gta3.img/cs_coast.txd/grasstype4_mudblend.dds\",\n \"gta3.img/cs_roads.txd/grasstype4_mudblend.dds\",\"gta3.img/cs_coast.txd/grasstype4_mudblend.dds\",\n \"gta3.img/cs_town.txd/grasstype4_mudblend.dds\",\"gta3.img/cs_coast.txd/grasstype4_mudblend.dds\",\n \"gta3.img/cuntwlandse.txd/grasstype4_mudblend.dds\",\"gta3.img/cs_coast.txd/grasstype4_mudblend.dds\",\n \"gta3.img/cuntwland.txd/grasstype4_mudblend.dds\",\"gta3.img/cs_coast.txd/grasstype4_mudblend.dds\",\n \"gta3.img/cuntwlandwest.txd/grasstype4_mudblend.dds\",\"gta3.img/cs_coast.txd/grasstype4_mudblend.dds\",\n \"gta3.img/cs_forest.txd/rocktq128.dds\",\"gta3.img/cs_coast.txd/rocktq128.dds\",\n \"gta3.img/cs_town.txd/rocktq128.dds\",\"gta3.img/cs_coast.txd/rocktq128.dds\",\n \"gta3.img/cuntrockcs_t.txd/rocktq128.dds\",\"gta3.img/cs_coast.txd/rocktq128.dds\",\n \"gta3.img/cuntrock.txd/rocktq128.dds\",\"gta3.img/cs_coast.txd/rocktq128.dds\",\n \"gta3.img/cuntwlandcarparks.txd/rocktq128.dds\",\"gta3.img/cs_coast.txd/rocktq128.dds\",\n \"gta3.img/cuntwlandcent.txd/rocktq128.dds\",\"gta3.img/cs_coast.txd/rocktq128.dds\",\n \"gta3.img/cuntwlandse.txd/rocktq128.dds\",\"gta3.img/cs_coast.txd/rocktq128.dds\",\n \"gta3.img/cuntwland.txd/rocktq128.dds\",\"gta3.img/cs_coast.txd/rocktq128.dds\",\n \"gta3.img/cuntwlandwest.txd/rocktq128.dds\",\"gta3.img/cs_coast.txd/rocktq128.dds\",\n \"gta3.img/cuntwtunnel.txd/rocktq128.dds\",\"gta3.img/cs_coast.txd/rocktq128.dds\",\n \"gta3.img/gta_brokentrees.txd/rocktq128.dds\",\"gta3.img/cs_coast.txd/rocktq128.dds\",\n \"gta3.img/gta_rockcuntry.txd/rocktq128.dds\",\"gta3.img/cs_coast.txd/rocktq128.dds\",\n \"gta3.img/mountainsfs.txd/rocktq128.dds\",\"gta3.img/cs_coast.txd/rocktq128.dds\",\n \"gta3.img/cs_wbridge.txd/stormdrain4_nt.dds\",\"gta3.img/cs_ebridge.txd/stormdrain4_nt.dds\",\n \"gta3.img/des_ebridge.txd/stormdrain4_nt.dds\",\"gta3.img/cs_ebridge.txd/stormdrain4_nt.dds\",\n \"gta3.img/des_stownw.txd/stormdrain4_nt.dds\",\"gta3.img/cs_ebridge.txd/stormdrain4_nt.dds\",\n \"gta3.img/lanriver.txd/stormdrain4_nt.dds\",\"gta3.img/cs_ebridge.txd/stormdrain4_nt.dds\",\n \"gta3.img/cuntwlandwest.txd/cuntbrncliffbtmbmp.dds\",\"gta3.img/cs_forest.txd/cuntbrncliffbtmbmp.dds\",\n \"gta3.img/cuntwlandwest.txd/cuntbrnclifftop.dds\",\"gta3.img/cs_forest.txd/cuntbrnclifftop.dds\",\n \"gta3.img/cuntwlandse.txd/forestfloorblendded.dds\",\"gta3.img/cs_forest.txd/forestfloorblendded.dds\",\n \"gta3.img/cuntwlandwest.txd/forestfloorblendded.dds\",\"gta3.img/cs_forest.txd/forestfloorblendded.dds\",\n \"gta3.img/cs_town.txd/grasstype4_forestblend.dds\",\"gta3.img/cs_forest.txd/grasstype4_forestblend.dds\",\n \"gta3.img/cuntwlandcarparks.txd/grasstype4_forestblend.dds\",\"gta3.img/cs_forest.txd/grasstype4_forestblend.dds\",\n \"gta3.img/cuntwlandse.txd/grasstype4_forestblend.dds\",\"gta3.img/cs_forest.txd/grasstype4_forestblend.dds\",\n \"gta3.img/cuntwland.txd/grasstype4_forestblend.dds\",\"gta3.img/cs_forest.txd/grasstype4_forestblend.dds\",\n \"gta3.img/cuntwlandwest.txd/grasstype4_forestblend.dds\",\"gta3.img/cs_forest.txd/grasstype4_forestblend.dds\",\n \"gta3.img/cs_mountain.txd/cw2_mountroad.dds\",\"gta3.img/cs_forest.txd/cw2_mountroad.dds\",\n \"gta3.img/cs_town.txd/cw2_mountroad.dds\",\"gta3.img/cs_forest.txd/cw2_mountroad.dds\",\n \"gta3.img/cs_mountain.txd/cw2_mountdirtscree.dds\",\"gta3.img/cs_forest.txd/cw2_mountdirtscree.dds\",\n \"gta3.img/cs_town.txd/cw2_mountdirtscree.dds\",\"gta3.img/cs_forest.txd/cw2_mountdirtscree.dds\",\n \"gta3.img/des_nw2.txd/cw2_mountdirtscree.dds\",\"gta3.img/cs_forest.txd/cw2_mountdirtscree.dds\",\n \"gta3.img/junkpiles.txd/cw2_mountdirtscree.dds\",\"gta3.img/cs_forest.txd/cw2_mountdirtscree.dds\",\n \"gta3.img/cs_mountain.txd/rocktq128_forestblend.dds\",\"gta3.img/cs_forest.txd/rocktq128_forestblend.dds\",\n \"gta3.img/cs_town.txd/rocktq128_forestblend.dds\",\"gta3.img/cs_forest.txd/rocktq128_forestblend.dds\",\n \"gta3.img/cuntwlandcarparks.txd/rocktq128_forestblend.dds\",\"gta3.img/cs_forest.txd/rocktq128_forestblend.dds\",\n \"gta3.img/cuntwlandcent.txd/rocktq128_forestblend.dds\",\"gta3.img/cs_forest.txd/rocktq128_forestblend.dds\",\n \"gta3.img/cuntwland.txd/rocktq128_forestblend.dds\",\"gta3.img/cs_forest.txd/rocktq128_forestblend.dds\",\n \"gta3.img/cuntwlandwest.txd/rocktq128_forestblend.dds\",\"gta3.img/cs_forest.txd/rocktq128_forestblend.dds\",\n \"gta3.img/cs_mountain.txd/forestfloor256_blenddirt.dds\",\"gta3.img/cs_forest.txd/forestfloor256_blenddirt.dds\",\n \"gta3.img/cs_town.txd/forestfloor256_blenddirt.dds\",\"gta3.img/cs_forest.txd/forestfloor256_blenddirt.dds\",\n \"gta3.img/cuntwlandcent.txd/forestfloor256_blenddirt.dds\",\"gta3.img/cs_forest.txd/forestfloor256_blenddirt.dds\",\n \"gta3.img/cuntwland.txd/forestfloor256_blenddirt.dds\",\"gta3.img/cs_forest.txd/forestfloor256_blenddirt.dds\",\n \"gta3.img/cuntwlandwest.txd/forestfloor256_blenddirt.dds\",\"gta3.img/cs_forest.txd/forestfloor256_blenddirt.dds\",\n \"gta3.img/lod_countryn.txd/cuntw_town_lod.dds\",\"gta3.img/cs_lod_town.txd/cuntw_town_lod.dds\",\n \"gta3.img/lod_countryn.txd/cuntw_troof_lod.dds\",\"gta3.img/cs_lod_town.txd/cuntw_troof_lod.dds\",\n \"gta3.img/lod_countryn.txd/cuntw_restrnt1_lod.dds\",\"gta3.img/cs_lod_town.txd/cuntw_restrnt1_lod.dds\",\n \"gta3.img/lod_countryn.txd/cuntw_dinerwst_lod.dds\",\"gta3.img/cs_lod_town.txd/cuntw_dinerwst_lod.dds\",\n \"gta3.img/lod_countryn.txd/cuntw_dinerroof_lod.dds\",\"gta3.img/cs_lod_town.txd/cuntw_dinerroof_lod.dds\",\n \"gta3.img/lod_countn2.txd/des_dirt2=trackl.dds\",\"gta3.img/cs_lod.txd/des_dirt2=trackl.dds\",\n \"gta3.img/lod_countn2.txd/des_dirt2blend.dds\",\"gta3.img/cs_lod.txd/des_dirt2blend.dds\",\n \"gta3.img/lod_countryn.txd/des_dirt2blend.dds\",\"gta3.img/cs_lod.txd/des_dirt2blend.dds\",\n \"gta3.img/lod_cxref.txd/des_factower.dds\",\"gta3.img/cs_lod.txd/des_factower.dds\",\n \"gta3.img/lod_cxref.txd/des_facmetalsoild.dds\",\"gta3.img/cs_lod.txd/des_facmetalsoild.dds\",\n \"gta3.img/lod_cn2_stown.txd/concretemanky.dds\",\"gta3.img/cs_lod.txd/concretemankylod.dds\",\n \"gta3.img/lod_countn2.txd/concretemanky.dds\",\"gta3.img/cs_lod.txd/concretemankylod.dds\",\n \"gta3.img/lod_countryn.txd/concretemankylod.dds\",\"gta3.img/cs_lod.txd/concretemankylod.dds\",\n \"gta3.img/lod_lan2.txd/concretemanky.dds\",\"gta3.img/cs_lod.txd/concretemankylod.dds\",\n \"gta3.img/lod_countryn.txd/des_facmetalsoildlod.dds\",\"gta3.img/cs_lod.txd/des_facmetalsoildlod.dds\",\n \"gta3.img/lod_countryn.txd/a51_labwall1lod.dds\",\"gta3.img/cs_lod.txd/a51_labwall1lod.dds\",\n \"gta3.img/lod_countryn.txd/desn_fuelpay_lod.dds\",\"gta3.img/cs_lod.txd/desn_fuelpay_lod.dds\",\n \"gta3.img/lod_countryn.txd/desn_tsblock_lod.dds\",\"gta3.img/cs_lod.txd/desn_tsblock_lod.dds\",\n \"gta3.img/lod_countryn.txd/desn_tsblockr_lod.dds\",\"gta3.img/cs_lod.txd/desn_tsblockr_lod.dds\",\n \"gta3.img/lod_countn2.txd/tar_freewyleft.dds\",\"gta3.img/cs_lod.txd/tar_freewyleft.dds\",\n \"gta3.img/lod_countn2.txd/tar_1line256hv_lod.dds\",\"gta3.img/cs_lod.txd/tar_1line256hv_lod.dds\",\n \"gta3.img/lod_countryn.txd/tar_1line256hv_lod.dds\",\"gta3.img/cs_lod.txd/tar_1line256hv_lod.dds\",\n \"gta3.img/lahillsa_lod.txd/pavebsand256.dds\",\"gta3.img/cs_lod.txd/pavebsand256.dds\",\n \"gta3.img/lod_countn2.txd/pavebsand256.dds\",\"gta3.img/cs_lod.txd/pavebsand256.dds\",\n \"gta3.img/lod_countn2.txd/roadnew4_256.dds\",\"gta3.img/cs_lod.txd/roadnew4_256.dds\",\n \"gta3.img/lod_countn2.txd/block2.dds\",\"gta3.img/cs_lod.txd/block2.dds\",\n \"gta3.img/lod_sfse2.txd/lodconcrete.dds\",\"gta3.img/cs_lod.txd/block2.dds\",\n \"gta3.img/lod_sfse3.txd/block2.dds\",\"gta3.img/cs_lod.txd/block2.dds\",\n \"gta3.img/lodcunty.txd/forestfloorblendded.dds\",\"gta3.img/cs_lod.txd/forestfloorblendded.dds\",\n \"gta3.img/lod_countn2.txd/grassdeadbrn256.dds\",\"gta3.img/cs_lod.txd/grassdeadbrn256.dds\",\n \"gta3.img/lod4sfw.txd/ws_carpark2.dds\",\"gta3.img/cs_lod.txd/ws_carpark2.dds\",\n \"gta3.img/lod4sfw.txd/lodws_carpark2.dds\",\"gta3.img/cs_lod.txd/ws_carpark2.dds\",\n \"gta3.img/lod5sfw.txd/lod_carpark2.dds\",\"gta3.img/cs_lod.txd/ws_carpark2.dds\",\n \"gta3.img/lod6sfw.txd/lod_carpark2.dds\",\"gta3.img/cs_lod.txd/ws_carpark2.dds\",\n \"gta3.img/lod_sfse3.txd/ws_carpark2.dds\",\"gta3.img/cs_lod.txd/ws_carpark2.dds\",\n \"gta3.img/lodcunty.txd/grasstype10.dds\",\"gta3.img/cs_lod.txd/grasstype10.dds\",\n \"gta3.img/lodcunty.txd/grasstype4blndtomud.dds\",\"gta3.img/cs_lod.txd/grasstype4blndtomud.dds\",\n \"gta3.img/lodcunty.txd/grass4_des_dirt2.dds\",\"gta3.img/cs_lod.txd/grass4_des_dirt2.dds\",\n \"gta3.img/lod_countn2.txd/des_dirt2trackr.dds\",\"gta3.img/cs_lod.txd/des_dirt2trackr.dds\",\n \"gta3.img/lod_countn2.txd/des_dirt2track.dds\",\"gta3.img/cs_lod.txd/des_dirt2track.dds\",\n \"gta3.img/lod_countn2.txd/des_dirt2.dds\",\"gta3.img/cs_lod.txd/des_dirt2.dds\",\n \"gta3.img/lod_countryn.txd/des_dirt2.dds\",\"gta3.img/cs_lod.txd/des_dirt2.dds\",\n \"gta3.img/lodcunty.txd/des_dirt2.dds\",\"gta3.img/cs_lod.txd/des_dirt2.dds\",\n \"gta3.img/lodcunty.txd/dirttracksgrass256.dds\",\"gta3.img/cs_lod.txd/dirttracksgrass256.dds\",\n \"gta3.img/lodcunty.txd/desmud.dds\",\"gta3.img/cs_lod.txd/desmud.dds\",\n \"gta3.img/lodcunty.txd/ws_sandstone1.dds\",\"gta3.img/cs_lod.txd/ws_sandstone1.dds\",\n \"gta3.img/lodlawnland.txd/ws_sandstone1.dds\",\"gta3.img/cs_lod.txd/ws_sandstone1.dds\",\n \"gta3.img/lod_sfs3.txd/ws_sandstone1.dds\",\"gta3.img/cs_lod.txd/ws_sandstone1.dds\",\n \"gta3.img/lod_sfse3.txd/ws_sandstone1.dds\",\"gta3.img/cs_lod.txd/ws_sandstone1.dds\",\n \"gta3.img/lodvgswestout.txd/ws_sandstone128.dds\",\"gta3.img/cs_lod.txd/ws_sandstone1.dds\",\n \"gta3.img/lod_sfse3.txd/was_scrpyd_floor_hangar.dds\",\"gta3.img/cs_lod.txd/was_scrpyd_floor_hangar.dds\",\n \"gta3.img/lod_countn2.txd/des_dam_conc.dds\",\"gta3.img/cs_lod.txd/des_dam_conc.dds\",\n \"gta3.img/lodcunty.txd/des_dam_conc.dds\",\"gta3.img/cs_lod.txd/des_dam_conc.dds\",\n \"gta3.img/lodlawnland.txd/des_dam_conc.dds\",\"gta3.img/cs_lod.txd/des_dam_conc.dds\",\n \"gta3.img/lod_countn2.txd/plaintarmac1.dds\",\"gta3.img/cs_lod.txd/plaintarmac1.dds\",\n \"gta3.img/lodcunty.txd/plaintarmac1.dds\",\"gta3.img/cs_lod.txd/plaintarmac1.dds\",\n \"gta3.img/lod_countn2.txd/parking2plain.dds\",\"gta3.img/cs_lod.txd/parking2plain.dds\",\n \"gta3.img/lodcunty.txd/parking2plain.dds\",\"gta3.img/cs_lod.txd/parking2plain.dds\",\n \"gta3.img/lodcunty.txd/cuntbrncliffbtmbmp.dds\",\"gta3.img/cs_lod.txd/cuntbrncliffbtmbmp.dds\",\n \"gta3.img/lodcunty.txd/cuntbrnclifftop.dds\",\"gta3.img/cs_lod.txd/cuntbrnclifftop.dds\",\n \"gta3.img/lod_countn2.txd/des_dirt1.dds\",\"gta3.img/cs_lod.txd/des_dirt1.dds\",\n \"gta3.img/lodvgsslod01.txd/des_dirt1.dds\",\"gta3.img/cs_lod.txd/des_dirt1.dds\",\n \"gta3.img/lodvgswestout.txd/des_dirt1.dds\",\"gta3.img/cs_lod.txd/des_dirt1.dds\",\n \"gta3.img/lodcunty.txd/rocktq128_grass4blend.dds\",\"gta3.img/cs_lod.txd/rocktq128_grass4blend.dds\",\n \"gta3.img/lod_mount_sfs.txd/rocktq128_grass4blend.dds\",\"gta3.img/cs_lod.txd/rocktq128_grass4blend.dds\",\n \"gta3.img/lod_sfse2.txd/rocktq128_grass4blend.dds\",\"gta3.img/cs_lod.txd/rocktq128_grass4blend.dds\",\n \"gta3.img/lodcunty.txd/rocktq128.dds\",\"gta3.img/cs_lod.txd/rocktq128.dds\",\n \"gta3.img/lod_mount_sfs.txd/rocktq128.dds\",\"gta3.img/cs_lod.txd/rocktq128.dds\",\n \"gta3.img/lod_countryn.txd/tar_1lineblenddrt_lod.dds\",\"gta3.img/cs_lod.txd/tar_1lineblenddrt_lod.dds\",\n \"gta3.img/lod_sfse2.txd/rocktbrn128blnd.dds\",\"gta3.img/cs_lod.txd/rocktbrn128blnd.dds\",\n \"gta3.img/lodcunty.txd/grasstype4_forestblend.dds\",\"gta3.img/cs_lod.txd/grasstype4_forestblend.dds\",\n \"gta3.img/lod_countn2.txd/grasstype4.dds\",\"gta3.img/cs_lod.txd/grasstype4.dds\",\n \"gta3.img/lodcunty.txd/grasstype4.dds\",\"gta3.img/cs_lod.txd/grasstype4.dds\",\n \"gta3.img/lod_mount_sfs.txd/grasstype4.dds\",\"gta3.img/cs_lod.txd/grasstype4.dds\",\n \"gta3.img/lod_sfs6.txd/grasstype4.dds\",\"gta3.img/cs_lod.txd/grasstype4.dds\",\n \"gta3.img/lod_sfse2.txd/grasstype4.dds\",\"gta3.img/cs_lod.txd/grasstype4.dds\",\n \"gta3.img/lodcunty.txd/grasstype4_mudblend.dds\",\"gta3.img/cs_lod.txd/grasstype4_mudblend.dds\",\n \"gta3.img/lodcunty.txd/rocktq128_forestblend.dds\",\"gta3.img/cs_lod.txd/rocktq128_forestblend.dds\",\n \"gta3.img/lodcunty.txd/forestfloor256_blenddirt.dds\",\"gta3.img/cs_lod.txd/forestfloor256_blenddirt.dds\",\n \"gta3.img/lod_countn2.txd/desertstones256.dds\",\"gta3.img/cs_lod.txd/desertstones256.dds\",\n \"gta3.img/lodcunty.txd/desertstones256.dds\",\"gta3.img/cs_lod.txd/desertstones256.dds\",\n \"gta3.img/lod_sfse2.txd/desertstones256.dds\",\"gta3.img/cs_lod.txd/desertstones256.dds\",\n \"gta3.img/lod_sfse3.txd/desertstones256.dds\",\"gta3.img/cs_lod.txd/desertstones256.dds\",\n \"gta3.img/lodvegaswest1.txd/desertstoneslod.dds\",\"gta3.img/cs_lod.txd/desertstones256.dds\",\n \"gta3.img/lodcunty.txd/ws_rottenwall.dds\",\"gta3.img/cs_lod.txd/ws_rottenwall.dds\",\n \"gta3.img/lodlawnland.txd/ws_rottenwall.dds\",\"gta3.img/cs_lod.txd/ws_rottenwall.dds\",\n \"gta3.img/cs_scrapyard.txd/was_scrpyd_ground_mud_edge.dds\",\"gta3.img/cs_lod.txd/was_scrpyd_ground_mud_edge.dds\",\n \"gta3.img/cw_junkyardccs_t.txd/was_scrpyd_ground_mud_edge.dds\",\"gta3.img/cs_lod.txd/was_scrpyd_ground_mud_edge.dds\",\n \"gta3.img/cs_scrapyard.txd/was_scrpyd_ground_mud_cnr.dds\",\"gta3.img/cs_lod.txd/was_scrpyd_ground_mud_cnr.dds\",\n \"gta3.img/cw_junkyardccs_t.txd/was_scrpyd_ground_mud_cnr.dds\",\"gta3.img/cs_lod.txd/was_scrpyd_ground_mud_cnr.dds\",\n \"gta3.img/cs_scrapyard.txd/was_scrpyd_ground_muddark.dds\",\"gta3.img/cs_lod.txd/was_scrpyd_ground_muddark.dds\",\n \"gta3.img/cw_junkyardmachin.txd/was_scrpyd_ground_muddark.dds\",\"gta3.img/cs_lod.txd/was_scrpyd_ground_muddark.dds\",\n \"gta3.img/cs_scrapyard.txd/was_scrpyd_ground_mudedge.dds\",\"gta3.img/cs_lod.txd/was_scrpyd_ground_mudedge.dds\",\n \"gta3.img/cs_scrapyard.txd/was_scrpyd_ground_mudcorner.dds\",\"gta3.img/cs_lod.txd/was_scrpyd_ground_mudcorner.dds\",\n \"gta3.img/cs_scrapyard.txd/was_scrpyd_ground_engblox.dds\",\"gta3.img/cs_lod.txd/was_scrpyd_ground_engblox.dds\",\n \"gta3.img/cw_junkyard2cs_t.txd/was_scrpyd_ground_engblox.dds\",\"gta3.img/cs_lod.txd/was_scrpyd_ground_engblox.dds\",\n \"gta3.img/lodcunty.txd/desgreengrass.dds\",\"gta3.img/cs_lod.txd/desgreengrass.dds\",\n \"gta3.img/lod_sfs2.txd/loddesgreengrass.dds\",\"gta3.img/cs_lod.txd/desgreengrass.dds\",\n \"gta3.img/lod_sfs2.txd/desgreengrass.dds\",\"gta3.img/cs_lod.txd/desgreengrass.dds\",\n \"gta3.img/lod_sfs3.txd/desgreengrass.dds\",\"gta3.img/cs_lod.txd/desgreengrass.dds\",\n \"gta3.img/lod_sfs4.txd/loddesgreengrass.dds\",\"gta3.img/cs_lod.txd/desgreengrass.dds\",\n \"gta3.img/lod_sfse2.txd/desgreengrass.dds\",\"gta3.img/cs_lod.txd/desgreengrass.dds\",\n \"gta3.img/lod_sfse3.txd/desgreengrass.dds\",\"gta3.img/cs_lod.txd/desgreengrass.dds\",\n \"gta3.img/lod_sfse.txd/desgreengrass.dds\",\"gta3.img/cs_lod.txd/desgreengrass.dds\",\n \"gta3.img/lodvgsslod02.txd/desgreengrass.dds\",\"gta3.img/cs_lod.txd/desgreengrass.dds\",\n \"gta3.img/welod_law2.txd/loddesgreengrass.dds\",\"gta3.img/cs_lod.txd/desgreengrass.dds\",\n \"gta3.img/lodcunty.txd/forestfloor256.dds\",\"gta3.img/cs_lod.txd/forestfloor256.dds\",\n \"gta3.img/lodcunty.txd/cw2_mounttrail.dds\",\"gta3.img/cs_lod.txd/cw2_mounttrail.dds\",\n \"gta3.img/lod_countryn.txd/cw2_mountrock.dds\",\"gta3.img/cs_lod.txd/cw2_mountrock.dds\",\n \"gta3.img/lodcunty.txd/cw2_mountdirt.dds\",\"gta3.img/cs_lod.txd/cw2_mountdirt.dds\",\n \"gta3.img/lod_countn2.txd/tar_leftright_lod.dds\",\"gta3.img/cs_lod.txd/tar_leftright_lod.dds\",\n \"gta3.img/lod_countryn.txd/tar_leftright_lod.dds\",\"gta3.img/cs_lod.txd/tar_leftright_lod.dds\",\n \"gta3.img/lafuckar.txd/car2_128.dds\",\"gta3.img/cs_misc.txd/car2_128.dds\",\n \"gta3.img/lashops1b_las2.txd/car2_128.dds\",\"gta3.img/cs_misc.txd/car2_128.dds\",\n \"gta_int.img/kickstart.txd/car2_128.dds\",\"gta3.img/cs_misc.txd/car2_128.dds\",\n \"gta3.img/lafuckar.txd/car1_128.dds\",\"gta3.img/cs_misc.txd/car1_128.dds\",\n \"gta3.img/lashops1b_las2.txd/car1_128.dds\",\"gta3.img/cs_misc.txd/car1_128.dds\",\n \"gta3.img/petrol.txd/car1_128.dds\",\"gta3.img/cs_misc.txd/car1_128.dds\",\n \"gta_int.img/kickstart.txd/car1_128.dds\",\"gta3.img/cs_misc.txd/car1_128.dds\",\n \"gta3.img/cunte_house1.txd/sw_flag01.dds\",\"gta3.img/cs_mountaintop.txd/sw_flag01.dds\",\n \"gta3.img/des_bighus.txd/sw_flag01.dds\",\"gta3.img/cs_mountaintop.txd/sw_flag01.dds\",\n \"gta3.img/sw_med1.txd/sw_flag01.dds\",\"gta3.img/cs_mountaintop.txd/sw_flag01.dds\",\n \"gta3.img/sw_poorhouse.txd/sw_flag01.dds\",\"gta3.img/cs_mountaintop.txd/sw_flag01.dds\",\n \"gta3.img/w_towncs_t.txd/sw_flag01.dds\",\"gta3.img/cs_mountaintop.txd/sw_flag01.dds\",\n \"gta3.img/desertdam.txd/dam_statbase.dds\",\"gta3.img/cs_mountaintop.txd/dam_statbase.dds\",\n \"gta3.img/cxref_desert.txd/des_flatlogs.dds\",\"gta3.img/cs_mountaintop.txd/des_flatlogs.dds\",\n \"gta3.img/des_ranch.txd/des_flatlogs.dds\",\"gta3.img/cs_mountaintop.txd/des_flatlogs.dds\",\n \"gta3.img/mullho03_lahills.txd/des_flatlogs.dds\",\"gta3.img/cs_mountaintop.txd/des_flatlogs.dds\",\n \"gta3.img/cxref_desert.txd/des_woodrails.dds\",\"gta3.img/cs_mountaintop.txd/des_woodrails.dds\",\n \"gta3.img/des_ranch.txd/des_woodrails.dds\",\"gta3.img/cs_mountaintop.txd/des_woodrails.dds\",\n \"gta3.img/mullho03_lahills.txd/des_woodrails.dds\",\"gta3.img/cs_mountaintop.txd/des_woodrails.dds\",\n \"gta3.img/cs_town.txd/grasstype4blndtomud.dds\",\"gta3.img/cs_mountain.txd/grasstype4blndtomud.dds\",\n \"gta3.img/cuntwlandwest.txd/grasstype4blndtomud.dds\",\"gta3.img/cs_mountain.txd/grasstype4blndtomud.dds\",\n \"gta3.img/cs_scrapyard.txd/was_scrpyd_ground_muddier.dds\",\"gta3.img/cs_mountain.txd/was_scrpyd_ground_muddier.dds\",\n \"gta3.img/cw_junkyardccs_t.txd/was_scrpyd_ground_muddier.dds\",\"gta3.img/cs_mountain.txd/was_scrpyd_ground_muddier.dds\",\n \"gta3.img/cw_junkyardcs_t.txd/was_scrpyd_ground_muddier.dds\",\"gta3.img/cs_mountain.txd/was_scrpyd_ground_muddier.dds\",\n \"gta3.img/cuntwlandwest.txd/cw2_mounttrail.dds\",\"gta3.img/cs_mountain.txd/cw2_mounttrail.dds\",\n \"gta3.img/cunteroads1.txd/pavebsand256.dds\",\"gta3.img/cs_roads.txd/pavebsand256.dds\",\n \"gta3.img/cunteroads2.txd/pavebsand256.dds\",\"gta3.img/cs_roads.txd/pavebsand256.dds\",\n \"gta3.img/cunteroads3.txd/pavebsand256.dds\",\"gta3.img/cs_roads.txd/pavebsand256.dds\",\n \"gta3.img/cunteroads4.txd/pavebsand256.dds\",\"gta3.img/cs_roads.txd/pavebsand256.dds\",\n \"gta3.img/cunteroads5.txd/pavebsand256.dds\",\"gta3.img/cs_roads.txd/pavebsand256.dds\",\n \"gta3.img/cunteroads6.txd/pavebsand256.dds\",\"gta3.img/cs_roads.txd/pavebsand256.dds\",\n \"gta3.img/des_n.txd/pavebsand256.dds\",\"gta3.img/cs_roads.txd/pavebsand256.dds\",\n \"gta3.img/des_nw2.txd/pavebsand256.dds\",\"gta3.img/cs_roads.txd/pavebsand256.dds\",\n \"gta3.img/des_nw.txd/pavebsand256.dds\",\"gta3.img/cs_roads.txd/pavebsand256.dds\",\n \"gta3.img/des_se1.txd/pavebsand256.dds\",\"gta3.img/cs_roads.txd/pavebsand256.dds\",\n \"gta3.img/des_s.txd/pavebsand256.dds\",\"gta3.img/cs_roads.txd/pavebsand256.dds\",\n \"gta3.img/des_sw.txd/pavebsand256.dds\",\"gta3.img/cs_roads.txd/pavebsand256.dds\",\n \"gta3.img/lae2roads.txd/pavebsand256.dds\",\"gta3.img/cs_roads.txd/pavebsand256.dds\",\n \"gta3.img/mullho03_lahills.txd/pavebsand256.dds\",\"gta3.img/cs_roads.txd/pavebsand256.dds\",\n \"gta3.img/roads_lahills.txd/pavebsand256.dds\",\"gta3.img/cs_roads.txd/pavebsand256.dds\",\n \"gta3.img/roadslahills.txd/pavebsand256.dds\",\"gta3.img/cs_roads.txd/pavebsand256.dds\",\n \"gta3.img/cuntwroad.txd/tar_1line256hvblenddrt.dds\",\"gta3.img/cs_roads.txd/tar_1line256hvblenddrt.dds\",\n \"gta3.img/cuntwtunnel.txd/tar_1line256hvblenddrt.dds\",\"gta3.img/cs_roads.txd/tar_1line256hvblenddrt.dds\",\n \"gta3.img/cw_road.txd/tar_1line256hvblenddrt.dds\",\"gta3.img/cs_roads.txd/tar_1line256hvblenddrt.dds\",\n \"gta3.img/des_ne.txd/tar_freewyright.dds\",\"gta3.img/cs_roads.txd/tar_freewyright.dds\",\n \"gta3.img/roadslahills.txd/tar_freewyright.dds\",\"gta3.img/cs_roads.txd/tar_freewyright.dds\",\n \"gta3.img/des_ne.txd/tar_freewyleft.dds\",\"gta3.img/cs_roads.txd/tar_freewyleft.dds\",\n \"gta3.img/csrspalace01.txd/ceaserwall06_128.dds\",\"gta3.img/csrsfence01.txd/ceaserwall06_128.dds\",\n \"gta3.img/csrspalace02.txd/ceaserwall06_128.dds\",\"gta3.img/csrsfence01.txd/ceaserwall06_128.dds\",\n \"gta3.img/tikigrass.txd/ceaserwall06_128.dds\",\"gta3.img/csrsfence01.txd/ceaserwall06_128.dds\",\n \"gta3.img/vgseland03_lvs.txd/ceaserwall06_128.dds\",\"gta3.img/csrsfence01.txd/ceaserwall06_128.dds\",\n \"gta_int.img/mafcassigns1.txd/sign_caligulas.dds\",\"gta3.img/csrsfence01.txd/sign_caligulas.dds\",\n \"gta3.img/csrspalace02.txd/ceaserwall04_256.dds\",\"gta3.img/csrspalace01.txd/ceaserwall04_256.dds\",\n \"gta3.img/vgndwntwn23.txd/vgspawnroof02_128.dds\",\"gta3.img/csrspalace01.txd/vgspawnroof02_128.dds\",\n \"gta3.img/vgnlowbild.txd/vgspawnroof02_128.dds\",\"gta3.img/csrspalace01.txd/vgspawnroof02_128.dds\",\n \"gta3.img/vgse24hr.txd/vgspawnroof02_128.dds\",\"gta3.img/csrspalace01.txd/vgspawnroof02_128.dds\",\n \"gta3.img/vgshpground.txd/vgspawnroof02_128.dds\",\"gta3.img/csrspalace01.txd/vgspawnroof02_128.dds\",\n \"gta3.img/vgs_shop5.txd/vgspawnroof02_128.dds\",\"gta3.img/csrspalace01.txd/vgspawnroof02_128.dds\",\n \"gta3.img/vgs_shops.txd/vgspawnroof02_128.dds\",\"gta3.img/csrspalace01.txd/vgspawnroof02_128.dds\",\n \"gta3.img/csrspalace02.txd/ceasersledge03_128.dds\",\"gta3.img/csrspalace01.txd/ceasersledge03_128.dds\",\n \"gta3.img/vgseland03_lvs.txd/ceasersledge01_128.dds\",\"gta3.img/csrspalace01.txd/ceasersledge01_128.dds\",\n \"gta3.img/csrspalace02.txd/black32.dds\",\"gta3.img/csrspalace01.txd/black32.dds\",\n \"gta3.img/des_airfieldhus.txd/black32.dds\",\"gta3.img/csrspalace01.txd/black32.dds\",\n \"gta3.img/des_nwtownpolice.txd/black32.dds\",\"gta3.img/csrspalace01.txd/black32.dds\",\n \"gta3.img/des_stownmain2.txd/black32.dds\",\"gta3.img/csrspalace01.txd/black32.dds\",\n \"gta3.img/des_stownmots1.txd/black32.dds\",\"gta3.img/csrspalace01.txd/black32.dds\",\n \"gta3.img/des_stownstrip2.txd/black32.dds\",\"gta3.img/csrspalace01.txd/black32.dds\",\n \"gta3.img/des_ufoinn.txd/black32.dds\",\"gta3.img/csrspalace01.txd/black32.dds\",\n \"gta3.img/gayclub_sfs.txd/black32.dds\",\"gta3.img/csrspalace01.txd/black32.dds\",\n \"gta3.img/hashblock2_sfs.txd/black32.dds\",\"gta3.img/csrspalace01.txd/black32.dds\",\n \"gta3.img/hotel1.txd/black32.dds\",\"gta3.img/csrspalace01.txd/black32.dds\",\n \"gta3.img/kbmiscfrn1.txd/wee_blak_32.dds\",\"gta3.img/csrspalace01.txd/black32.dds\",\n \"gta3.img/pirateship01.txd/black32.dds\",\"gta3.img/csrspalace01.txd/black32.dds\",\n \"gta3.img/queens2_sfs.txd/black32.dds\",\"gta3.img/csrspalace01.txd/black32.dds\",\n \"gta3.img/queensammo_sfs.txd/black32.dds\",\"gta3.img/csrspalace01.txd/black32.dds\",\n \"gta3.img/scum2_sfs.txd/black32.dds\",\"gta3.img/csrspalace01.txd/black32.dds\",\n \"gta3.img/sphinx01.txd/black32.dds\",\"gta3.img/csrspalace01.txd/black32.dds\",\n \"gta3.img/triadcasino.txd/black32.dds\",\"gta3.img/csrspalace01.txd/black32.dds\",\n \"gta3.img/ufo_bar.txd/black32.dds\",\"gta3.img/csrspalace01.txd/black32.dds\",\n \"gta3.img/vgesvhouse01.txd/black32.dds\",\"gta3.img/csrspalace01.txd/black32.dds\",\n \"gta3.img/vgsbldng1.txd/black32.dds\",\"gta3.img/csrspalace01.txd/black32.dds\",\n \"gta3.img/vgsshospshop.txd/black32.dds\",\"gta3.img/csrspalace01.txd/black32.dds\",\n \"gta3.img/vgsssignage04.txd/black32.dds\",\"gta3.img/csrspalace01.txd/black32.dds\",\n \"gta_int.img/cuntcuts.txd/black32.dds\",\"gta3.img/csrspalace01.txd/black32.dds\",\n \"gta_int.img/gb_ornaments01.txd/black32.dds\",\"gta3.img/csrspalace01.txd/black32.dds\",\n \"gta_int.img/kbmiscfrn2.txd/wee_blak_32.dds\",\"gta3.img/csrspalace01.txd/black32.dds\",\n \"gta_int.img/savesfmid.txd/black32.dds\",\"gta3.img/csrspalace01.txd/black32.dds\",\n \"gta_int.img/svbits.txd/black32.dds\",\"gta3.img/csrspalace01.txd/black32.dds\",\n \"gta3.img/vgsschurch.txd/marble01_128.dds\",\"gta3.img/csrspalace02.txd/marble01_128.dds\",\n \"gta3.img/vgnfremnt1.txd/casinolightsyel_128.dds\",\"gta3.img/csrspalace02.txd/casinolightsyel_128.dds\",\n \"gta3.img/vgnfremnt2.txd/casinolightsyel_128.dds\",\"gta3.img/csrspalace02.txd/casinolightsyel_128.dds\",\n \"gta3.img/vgsairport.txd/casinolightsyel_128.dds\",\"gta3.img/csrspalace02.txd/casinolightsyel_128.dds\",\n \"gta3.img/vgwwelcome.txd/casinolightsyel_128.dds\",\"gta3.img/csrspalace02.txd/casinolightsyel_128.dds\",\n \"gta_int.img/gb_books01.txd/gb_magazine01.dds\",\"gta3.img/cs_ry_props.txd/gb_magazine01.dds\",\n \"gta_int.img/gb_magazines01.txd/gb_magazine01.dds\",\"gta3.img/cs_ry_props.txd/gb_magazine01.dds\",\n \"gta_int.img/labig3int2.txd/gb_magazine01.dds\",\"gta3.img/cs_ry_props.txd/gb_magazine01.dds\",\n \"gta_int.img/lee_studhall.txd/gb_magazine01.dds\",\"gta3.img/cs_ry_props.txd/gb_magazine01.dds\",\n \"gta_int.img/gb_books01.txd/gb_magazine07.dds\",\"gta3.img/cs_ry_props.txd/gb_magazine07.dds\",\n \"gta_int.img/labig3int2.txd/gb_magazine07.dds\",\"gta3.img/cs_ry_props.txd/gb_magazine07.dds\",\n \"gta_int.img/lee_studhall.txd/gb_magazine07.dds\",\"gta3.img/cs_ry_props.txd/gb_magazine07.dds\",\n \"gta_int.img/lee_strip2_1.txd/whiskybottle.dds\",\"gta3.img/cs_ry_props.txd/whiskybottle.dds\",\n \"gta_int.img/gb_books01.txd/gb_magazine04.dds\",\"gta3.img/cs_ry_props.txd/gb_magazine04.dds\",\n \"gta_int.img/labig1int2.txd/gb_magazine04.dds\",\"gta3.img/cs_ry_props.txd/gb_magazine04.dds\",\n \"gta_int.img/lee_studhall.txd/gb_magazine04.dds\",\"gta3.img/cs_ry_props.txd/gb_magazine04.dds\",\n \"gta3.img/cw_junkyarddigcs_t.txd/was_scrpyd_bale_exh.dds\",\"gta3.img/cs_scrapyard.txd/was_scrpyd_bale_exh.dds\",\n \"gta3.img/firehouse_sfse.txd/gb_sandstwall01.dds\",\"gta3.img/cs_town.txd/gb_sandstwall01.dds\",\n \"gta3.img/cw_junkbuildcs_t.txd/was_scrpyd_floor_hangar.dds\",\"gta3.img/cs_town.txd/was_scrpyd_floor_hangar.dds\",\n \"gta3.img/haight1_sfs.txd/was_scrpyd_floor_hangar.dds\",\"gta3.img/cs_town.txd/was_scrpyd_floor_hangar.dds\",\n \"gta3.img/mission3ground_sfse.txd/was_scrpyd_floor_hangar.dds\",\"gta3.img/cs_town.txd/was_scrpyd_floor_hangar.dds\",\n \"gta3.img/mission_sfse.txd/was_scrpyd_floor_hangar.dds\",\"gta3.img/cs_town.txd/was_scrpyd_floor_hangar.dds\",\n \"gta3.img/scum_sfse.txd/was_scrpyd_floor_hangar.dds\",\"gta3.img/cs_town.txd/was_scrpyd_floor_hangar.dds\",\n \"gta3.img/cuntwland.txd/grasstype4_10.dds\",\"gta3.img/cs_town.txd/grasstype4_10.dds\",\n \"gta3.img/cuntwlandcent.txd/grasstype10.dds\",\"gta3.img/cs_town.txd/grasstype10.dds\",\n \"gta3.img/cuntwland.txd/grasstype10.dds\",\"gta3.img/cs_town.txd/grasstype10.dds\",\n \"gta3.img/cuntwlandwest.txd/grasstype10.dds\",\"gta3.img/cs_town.txd/grasstype10.dds\",\n \"gta3.img/cuntwtunnel.txd/grasstype10.dds\",\"gta3.img/cs_town.txd/grasstype10.dds\",\n \"gta3.img/lan2_gm1.txd/grasstype10.dds\",\"gta3.img/cs_town.txd/grasstype10.dds\",\n \"gta3.img/sunrise09_lawn.txd/grasstype10.dds\",\"gta3.img/cs_town.txd/grasstype10.dds\",\n \"gta3.img/vgnvrock.txd/grasstype10.dds\",\"gta3.img/cs_town.txd/grasstype10.dds\",\n \"gta3.img/cuntwlandcarparks.txd/grass4_des_dirt2.dds\",\"gta3.img/cs_town.txd/grass4_des_dirt2.dds\",\n \"gta3.img/cuntwland.txd/grass4_des_dirt2.dds\",\"gta3.img/cs_town.txd/grass4_des_dirt2.dds\",\n \"gta3.img/cuntwlandwest.txd/grass4_des_dirt2.dds\",\"gta3.img/cs_town.txd/grass4_des_dirt2.dds\",\n \"gta3.img/cxrf_indstuff.txd/des_byframe1.dds\",\"gta3.img/cs_wbridge.txd/des_byframe1.dds\",\n \"gta3.img/des_boneyard.txd/des_byframe1.dds\",\"gta3.img/cs_wbridge.txd/des_byframe1.dds\",\n \"gta3.img/des_byoffice.txd/des_byframe1.dds\",\"gta3.img/cs_wbridge.txd/des_byframe1.dds\",\n \"gta3.img/desertmisc.txd/des_byframe1.dds\",\"gta3.img/cs_wbridge.txd/des_byframe1.dds\",\n \"gta3.img/des_telescopestuff.txd/des_byframe1.dds\",\"gta3.img/cs_wbridge.txd/des_byframe1.dds\",\n \"gta3.img/cw_truckstopcs_t.txd/des_facmetalsoild.dds\",\"gta3.img/cs_wbridge.txd/des_facmetalsoild.dds\",\n \"gta3.img/des_byoffice.txd/des_facmetalsoild.dds\",\"gta3.img/cs_wbridge.txd/des_facmetalsoild.dds\",\n \"gta3.img/desertmisc.txd/des_facmetalsoild.dds\",\"gta3.img/cs_wbridge.txd/des_facmetalsoild.dds\",\n \"gta3.img/des_factory.txd/des_facmetalsoild.dds\",\"gta3.img/cs_wbridge.txd/des_facmetalsoild.dds\",\n \"gta3.img/desn_truckstop.txd/des_facmetalsoild.dds\",\"gta3.img/cs_wbridge.txd/des_facmetalsoild.dds\",\n \"gta3.img/wiresetc2_las.txd/ruffroadlas.dds\",\"gta3.img/ctscene_las.txd/ruffroadlas.dds\",\n \"gta3.img/wiresetc_las.txd/ruffroadlas.dds\",\"gta3.img/ctscene_las.txd/ruffroadlas.dds\",\n \"gta3.img/xenon_sfse.txd/ruffroadlas.dds\",\"gta3.img/ctscene_las.txd/ruffroadlas.dds\",\n \"gta3.img/stormd_filllas2.txd/cleargraf02_la.dds\",\"gta3.img/ctscene_las.txd/cleargraf02_la.dds\",\n \"gta3.img/wiresetc_las2.txd/cleargraf02_la.dds\",\"gta3.img/ctscene_las.txd/cleargraf02_la.dds\",\n \"gta3.img/odnrooft.txd/dt_compound_fanvent.dds\",\"gta3.img/ct_stabx.txd/dt_compound_fanvent.dds\",\n \"gta3.img/roofbit_lawn.txd/dt_compound_fanvent.dds\",\"gta3.img/ct_stabx.txd/dt_compound_fanvent.dds\",\n \"gta_int.img/ab_vegasgymmain.txd/dt_compound_fanvent.dds\",\"gta3.img/ct_stabx.txd/dt_compound_fanvent.dds\",\n \"gta_int.img/gf3.txd/dt_compound_fanvent.dds\",\"gta3.img/ct_stabx.txd/dt_compound_fanvent.dds\",\n \"gta3.img/lawest1.txd/glass_fence_64hv.dds\",\"gta3.img/cuntclub_law2.txd/glass_fence_64hv.dds\",\n \"gta3.img/mall_law.txd/glass_fence_64hv.dds\",\"gta3.img/cuntclub_law2.txd/glass_fence_64hv.dds\",\n \"gta3.img/hospital_lae.txd/marinadoor1_256.dds\",\"gta3.img/cuntclub_law2.txd/marinadoor1_256.dds\",\n \"gta3.img/vgnglfcrse1.txd/marinadoor1_256.dds\",\"gta3.img/cuntclub_law2.txd/marinadoor1_256.dds\",\n \"gta3.img/vgnhseing1.txd/marinadoor1_256.dds\",\"gta3.img/cuntclub_law2.txd/marinadoor1_256.dds\",\n \"gta3.img/vgnlowbild.txd/marinadoor1_256.dds\",\"gta3.img/cuntclub_law2.txd/marinadoor1_256.dds\",\n \"gta3.img/vgnretail72.txd/marinadoor1_256.dds\",\"gta3.img/cuntclub_law2.txd/marinadoor1_256.dds\",\n \"gta3.img/vgsecarshow.txd/marinadoor1_256.dds\",\"gta3.img/cuntclub_law2.txd/marinadoor1_256.dds\",\n \"gta3.img/vgssairport02.txd/marinadoor1_256.dds\",\"gta3.img/cuntclub_law2.txd/marinadoor1_256.dds\",\n \"gta3.img/vgsshospshop.txd/marinadoor1_256.dds\",\"gta3.img/cuntclub_law2.txd/marinadoor1_256.dds\",\n \"gta3.img/vgsswarhse04.txd/marinadoor1_256.dds\",\"gta3.img/cuntclub_law2.txd/marinadoor1_256.dds\",\n \"gta3.img/vgwestretail1.txd/marinadoor1_256.dds\",\"gta3.img/cuntclub_law2.txd/marinadoor1_256.dds\",\n \"gta3.img/cuntwshopscs_t.txd/marinawindow1_256.dds\",\"gta3.img/cuntclub_law2.txd/marinawindow1_256.dds\",\n \"gta3.img/lahillshilhs1b.txd/marinawindow1_256.dds\",\"gta3.img/cuntclub_law2.txd/marinawindow1_256.dds\",\n \"gta3.img/lahillshilhs1d.txd/marinawindow1_256.dds\",\"gta3.img/cuntclub_law2.txd/marinawindow1_256.dds\",\n \"gta3.img/lahillshilhs1z.txd/marinawindow1_256.dds\",\"gta3.img/cuntclub_law2.txd/marinawindow1_256.dds\",\n \"gta3.img/lahillshilhse.txd/marinawindow1_256.dds\",\"gta3.img/cuntclub_law2.txd/marinawindow1_256.dds\",\n \"gta3.img/pyramid.txd/marinawindow1_256.dds\",\"gta3.img/cuntclub_law2.txd/marinawindow1_256.dds\",\n \"gta3.img/vegasbuild.txd/marinawindow1_256.dds\",\"gta3.img/cuntclub_law2.txd/marinawindow1_256.dds\",\n \"gta3.img/vgnbball.txd/marinawindow1_256.dds\",\"gta3.img/cuntclub_law2.txd/marinawindow1_256.dds\",\n \"gta3.img/vgnglfcrse1.txd/marinawindow1_256.dds\",\"gta3.img/cuntclub_law2.txd/marinawindow1_256.dds\",\n \"gta3.img/vgnhseing1.txd/marinawindow1_256.dds\",\"gta3.img/cuntclub_law2.txd/marinawindow1_256.dds\",\n \"gta3.img/vgnhseland.txd/marinawindow1_256.dds\",\"gta3.img/cuntclub_law2.txd/marinawindow1_256.dds\",\n \"gta3.img/vgnlowbild.txd/marinawindow1_256.dds\",\"gta3.img/cuntclub_law2.txd/marinawindow1_256.dds\",\n \"gta3.img/vgnptrlpmp.txd/marinawindow1_256.dds\",\"gta3.img/cuntclub_law2.txd/marinawindow1_256.dds\",\n \"gta3.img/vgnretail72.txd/marinawindow1_256.dds\",\"gta3.img/cuntclub_law2.txd/marinawindow1_256.dds\",\n \"gta3.img/vgsecarshow.txd/marinawindow1_256.dds\",\"gta3.img/cuntclub_law2.txd/marinawindow1_256.dds\",\n \"gta3.img/vgsehseing1.txd/marinawindow1_256.dds\",\"gta3.img/cuntclub_law2.txd/marinawindow1_256.dds\",\n \"gta3.img/vgslowbuild.txd/marinawindow1_256.dds\",\"gta3.img/cuntclub_law2.txd/marinawindow1_256.dds\",\n \"gta3.img/vgssairport02.txd/marinawindow1_256.dds\",\"gta3.img/cuntclub_law2.txd/marinawindow1_256.dds\",\n \"gta3.img/vgssairport.txd/marinawindow1_256.dds\",\"gta3.img/cuntclub_law2.txd/marinawindow1_256.dds\",\n \"gta3.img/vgsswarhse04.txd/marinawindow1_256.dds\",\"gta3.img/cuntclub_law2.txd/marinawindow1_256.dds\",\n \"gta3.img/vgwestretail1.txd/marinawindow1_256.dds\",\"gta3.img/cuntclub_law2.txd/marinawindow1_256.dds\",\n \"gta3.img/law2misc_lax.txd/countclu01_law2.dds\",\"gta3.img/cuntclub_law2.txd/countclu01_law2.dds\",\n \"gta3.img/law2misc_lax.txd/helipad_grey1.dds\",\"gta3.img/cuntclub_law2.txd/helipad_grey1.dds\",\n \"gta3.img/libhelipad_lan2.txd/helipad_grey1.dds\",\"gta3.img/cuntclub_law2.txd/helipad_grey1.dds\",\n \"gta3.img/sfe_copchop.txd/helipad_grey1.dds\",\"gta3.img/cuntclub_law2.txd/helipad_grey1.dds\",\n \"gta3.img/sfn_helipad.txd/helipad_grey1.dds\",\"gta3.img/cuntclub_law2.txd/helipad_grey1.dds\",\n \"gta3.img/vgnhelipad1.txd/helipad_grey1.dds\",\"gta3.img/cuntclub_law2.txd/helipad_grey1.dds\",\n \"gta3.img/wddngchplgrnd01.txd/vgschapelwall01_128.dds\",\"gta3.img/cuntclub_law2.txd/vgschapelwall01_128.dds\",\n \"gta3.img/law2misc_lax.txd/countclu02_law2.dds\",\"gta3.img/cuntclub_law2.txd/countclu02_law2.dds\",\n \"gta3.img/vgsecnstrct02.txd/desmudtrail2.dds\",\"gta3.img/cunte1_lahills.txd/desmudtrail2.dds\",\n \"gta_int.img/cj_bar2.txd/bbar_stuff2.dds\",\"gta3.img/cunte_bar1.txd/bbar_stuff2.dds\",\n \"gta3.img/cunte_blockammo.txd/black16.dds\",\"gta3.img/cunte_bar1.txd/black16.dds\",\n \"gta3.img/cunte_cop.txd/black16.dds\",\"gta3.img/cunte_bar1.txd/black16.dds\",\n \"gta3.img/lahills_safe1.txd/black16.dds\",\"gta3.img/cunte_bar1.txd/black16.dds\",\n \"gta3.img/nfpedcx.txd/black16.dds\",\"gta3.img/cunte_bar1.txd/black16.dds\",\n \"gta3.img/sw_apartments.txd/black16.dds\",\"gta3.img/cunte_bar1.txd/black16.dds\",\n \"gta3.img/sw_block03.txd/black16.dds\",\"gta3.img/cunte_bar1.txd/black16.dds\",\n \"gta3.img/sw_oldshack.txd/black16.dds\",\"gta3.img/cunte_bar1.txd/black16.dds\",\n \"gta3.img/eastbeach3c_lae2.txd/alleydoorb256.dds\",\"gta3.img/cunte_bar1.txd/alleydoorb256.dds\",\n \"gta3.img/sunrise10_lawn.txd/alleydoorb256.dds\",\"gta3.img/cunte_bar1.txd/alleydoorb256.dds\",\n \"gta3.img/vgncorp1.txd/alleydoorb256.dds\",\"gta3.img/cunte_bar1.txd/alleydoorb256.dds\",\n \"gta3.img/vgnpwrwhse.txd/alleydoorb256.dds\",\"gta3.img/cunte_bar1.txd/alleydoorb256.dds\",\n \"gta3.img/vgsewrehse.txd/alleydoorb256.dds\",\"gta3.img/cunte_bar1.txd/alleydoorb256.dds\",\n \"gta3.img/vgsswarehse01.txd/alleydoorb256.dds\",\"gta3.img/cunte_bar1.txd/alleydoorb256.dds\",\n \"gta3.img/vgsswarehse02.txd/alleydoorb256.dds\",\"gta3.img/cunte_bar1.txd/alleydoorb256.dds\",\n \"gta3.img/vgwestabats.txd/alleydoorb256.dds\",\"gta3.img/cunte_bar1.txd/alleydoorb256.dds\",\n \"gta3.img/cunte_blockammo.txd/sjmbwall2.dds\",\"gta3.img/cunte_block1.txd/sjmbwall2.dds\",\n \"gta3.img/des_ranch.txd/sw_window02.dds\",\"gta3.img/cunte_block1.txd/sw_window02.dds\",\n \"gta3.img/sw_block11a.txd/sw_window02.dds\",\"gta3.img/cunte_block1.txd/sw_window02.dds\",\n \"gta3.img/cw2_photoblockcs_t.txd/sw_hardware02.dds\",\"gta3.img/cunte_block1.txd/sw_hardware02.dds\",\n \"gta3.img/w_towncs_t.txd/sw_hardware02.dds\",\"gta3.img/cunte_block1.txd/sw_hardware02.dds\",\n \"gta3.img/cunte_blockammo.txd/ws_ornatewall1.dds\",\"gta3.img/cunte_block1.txd/ws_ornatewall1.dds\",\n \"gta3.img/subshops_sfs.txd/ws_ornatewall1.dds\",\"gta3.img/cunte_block1.txd/ws_ornatewall1.dds\",\n \"gta3.img/cunte_town1.txd/shoptopa128.dds\",\"gta3.img/cunte_block1.txd/shoptopa128.dds\",\n \"gta3.img/des_clifftown.txd/des_indsign1.dds\",\"gta3.img/cunte_block1.txd/des_indsign1.dds\",\n \"gta3.img/sw_fact02.txd/lightwall256.dds\",\"gta3.img/cunte_block1.txd/lightwall256.dds\",\n \"gta3.img/w_town2cs_t.txd/lightwall256.dds\",\"gta3.img/cunte_block1.txd/lightwall256.dds\",\n \"gta3.img/w_towncs_t.txd/shph3r1hi.dds\",\"gta3.img/cunte_block1.txd/shph3r1hi.dds\",\n \"gta3.img/sw_apartflat5.txd/ablusrip.dds\",\"gta3.img/cunte_block1.txd/ablusrip.dds\",\n \"gta3.img/sw_block09.txd/ablusrip.dds\",\"gta3.img/cunte_block1.txd/ablusrip.dds\",\n \"gta3.img/cunte_town1.txd/ws_redbrickold.dds\",\"gta3.img/cunte_block1.txd/ws_redbrickold.dds\",\n \"gta3.img/cw2_cinemablockcs_t.txd/ws_redbrickold.dds\",\"gta3.img/cunte_block1.txd/ws_redbrickold.dds\",\n \"gta3.img/lawnpark.txd/ws_redbrickold.dds\",\"gta3.img/cunte_block1.txd/ws_redbrickold.dds\",\n \"gta3.img/officeground.txd/ws_redbrickold.dds\",\"gta3.img/cunte_block1.txd/ws_redbrickold.dds\",\n \"gta3.img/sw_block09.txd/ws_redbrickold.dds\",\"gta3.img/cunte_block1.txd/ws_redbrickold.dds\",\n \"gta3.img/w_town3cs_t.txd/ws_redbrickold.dds\",\"gta3.img/cunte_block1.txd/ws_redbrickold.dds\",\n \"gta3.img/cw2_photoblockcs_t.txd/sw_door10.dds\",\"gta3.img/cunte_block1.txd/sw_door10.dds\",\n \"gta3.img/shop_doors2.txd/sw_door10.dds\",\"gta3.img/cunte_block1.txd/sw_door10.dds\",\n \"gta3.img/vgsswarehse02c.txd/sw_door10.dds\",\"gta3.img/cunte_block1.txd/sw_door10.dds\",\n \"gta_int.img/genintint711_1.txd/sw_door10.dds\",\"gta3.img/cunte_block1.txd/sw_door10.dds\",\n \"gta3.img/cuntwlandcarparks.txd/ws_patchygravel.dds\",\"gta3.img/cunte_blockammo.txd/ws_patchygravel.dds\",\n \"gta3.img/cuntwlandcent.txd/ws_patchygravel.dds\",\"gta3.img/cunte_blockammo.txd/ws_patchygravel.dds\",\n \"gta3.img/cuntwlandse.txd/ws_patchygravel.dds\",\"gta3.img/cunte_blockammo.txd/ws_patchygravel.dds\",\n \"gta3.img/cuntwland.txd/ws_patchygravel.dds\",\"gta3.img/cunte_blockammo.txd/ws_patchygravel.dds\",\n \"gta3.img/cuntwlandwest.txd/ws_patchygravel.dds\",\"gta3.img/cunte_blockammo.txd/ws_patchygravel.dds\",\n \"gta3.img/gardencentre_sfs.txd/ws_patchygravel.dds\",\"gta3.img/cunte_blockammo.txd/ws_patchygravel.dds\",\n \"gta_int.img/gen_mun_xtars2.txd/mp_gun_targets.dds\",\"gta3.img/cunte_blockammo.txd/mp_gun_targets.dds\",\n \"gta_int.img/posters.txd/mp_gun_targets.dds\",\"gta3.img/cunte_blockammo.txd/mp_gun_targets.dds\",\n \"gta3.img/sw_block11.txd/sw_locals.dds\",\"gta3.img/cunte_blockammo.txd/sw_locals.dds\",\n \"gta3.img/sw_block12.txd/sw_locals.dds\",\"gta3.img/cunte_blockammo.txd/sw_locals.dds\",\n \"gta_int.img/gen_offtrackint.txd/sw_door15.dds\",\"gta3.img/cunte_blockammo.txd/sw_door15.dds\",\n \"gta3.img/desn_decocafe.txd/wallwindblank_256.dds\",\"gta3.img/cunte_blockammo.txd/wallwindblank_256.dds\",\n \"gta3.img/landhub.txd/wallwindblank_256.dds\",\"gta3.img/cunte_blockammo.txd/wallwindblank_256.dds\",\n \"gta3.img/sfvictorian.txd/wallwindblank_256.dds\",\"gta3.img/cunte_blockammo.txd/wallwindblank_256.dds\",\n \"gta3.img/sunrise10_lawn.txd/wallwindblank_256.dds\",\"gta3.img/cunte_blockammo.txd/wallwindblank_256.dds\",\n \"gta3.img/sfn_helipad.txd/mp_bluemetaldoor_256.dds\",\"gta3.img/cunte_blockammo.txd/mp_bluemetaldoor_256.dds\",\n \"gta3.img/sw_block01.txd/mp_bluemetaldoor_256.dds\",\"gta3.img/cunte_blockammo.txd/mp_bluemetaldoor_256.dds\",\n \"gta3.img/vegaswrehse1.txd/mp_bluemetaldoor_256.dds\",\"gta3.img/cunte_blockammo.txd/mp_bluemetaldoor_256.dds\",\n \"gta3.img/vgntrainstat.txd/mp_bluemetaldoor_256.dds\",\"gta3.img/cunte_blockammo.txd/mp_bluemetaldoor_256.dds\",\n \"gta3.img/cunts_gunclub.txd/newall10.dds\",\"gta3.img/cunte_blockammo.txd/newall10.dds\",\n \"gta3.img/dingbat01_la.txd/newall10.dds\",\"gta3.img/cunte_blockammo.txd/newall10.dds\",\n \"gta3.img/downtown_las.txd/newall10.dds\",\"gta3.img/cunte_blockammo.txd/newall10.dds\",\n \"gta3.img/hotelback_sfs.txd/newall10.dds\",\"gta3.img/cunte_blockammo.txd/newall10.dds\",\n \"gta3.img/landlae2e.txd/newall10.dds\",\"gta3.img/cunte_blockammo.txd/newall10.dds\",\n \"gta3.img/sw_block11.txd/newall10.dds\",\"gta3.img/cunte_blockammo.txd/newall10.dds\",\n \"gta3.img/sw_block9.txd/newall10.dds\",\"gta3.img/cunte_blockammo.txd/newall10.dds\",\n \"gta3.img/vgsswarehse02b.txd/newall10.dds\",\"gta3.img/cunte_blockammo.txd/newall10.dds\",\n \"gta3.img/cunts_gunclub.txd/dt_ammu_sign2.dds\",\"gta3.img/cunte_blockammo.txd/dt_ammu_sign2.dds\",\n \"gta3.img/des_gunclub.txd/dt_ammu_sign2.dds\",\"gta3.img/cunte_blockammo.txd/dt_ammu_sign2.dds\",\n \"gta3.img/des_nwtownw.txd/dt_ammu_sign2.dds\",\"gta3.img/cunte_blockammo.txd/dt_ammu_sign2.dds\",\n \"gta3.img/lasraodnshops.txd/dt_ammu_sign2.dds\",\"gta3.img/cunte_blockammo.txd/dt_ammu_sign2.dds\",\n \"gta3.img/cunts_gunclub.txd/dt_ammu_sign1.dds\",\"gta3.img/cunte_blockammo.txd/dt_ammu_sign1.dds\",\n \"gta3.img/des_gunclub.txd/dt_ammu_sign1.dds\",\"gta3.img/cunte_blockammo.txd/dt_ammu_sign1.dds\",\n \"gta3.img/des_nwtownw.txd/dt_ammu_sign1.dds\",\"gta3.img/cunte_blockammo.txd/dt_ammu_sign1.dds\",\n \"gta3.img/lasraodnshops.txd/dt_ammu_sign1.dds\",\"gta3.img/cunte_blockammo.txd/dt_ammu_sign1.dds\",\n \"gta3.img/sw_block06.txd/sw_shutters1.dds\",\"gta3.img/cunte_cop.txd/sw_shutters1.dds\",\n \"gta3.img/sw_brewery.txd/sw_shutters1.dds\",\"gta3.img/cunte_cop.txd/sw_shutters1.dds\",\n \"gta3.img/sw_genstore1.txd/sw_shutters1.dds\",\"gta3.img/cunte_cop.txd/sw_shutters1.dds\",\n \"gta3.img/sw_genstore.txd/sw_shutters1.dds\",\"gta3.img/cunte_cop.txd/sw_shutters1.dds\",\n \"gta3.img/sw_roadgas.txd/sw_shutters1.dds\",\"gta3.img/cunte_cop.txd/sw_shutters1.dds\",\n \"gta3.img/sw_railbridge1.txd/sw_pdground.dds\",\"gta3.img/cunte_cop.txd/sw_pdground.dds\",\n \"gta3.img/ground3_las.txd/ws_bigstones.dds\",\"gta3.img/cunte_cop.txd/ws_bigstones.dds\",\n \"gta3.img/jeffers4_lae.txd/ws_bigstones.dds\",\"gta3.img/cunte_cop.txd/ws_bigstones.dds\",\n \"gta3.img/lae2newtempbx.txd/ws_bigstones.dds\",\"gta3.img/cunte_cop.txd/ws_bigstones.dds\",\n \"gta3.img/subshops_sfs.txd/ws_bigstones.dds\",\"gta3.img/cunte_cop.txd/ws_bigstones.dds\",\n \"gta3.img/vgnshopnmall.txd/ws_bigstones.dds\",\"gta3.img/cunte_cop.txd/ws_bigstones.dds\",\n \"gta3.img/wasteland_las2.txd/ws_bigstones.dds\",\"gta3.img/cunte_cop.txd/ws_bigstones.dds\",\n \"gta3.img/sw_library.txd/sw_brick05.dds\",\"gta3.img/cunte_cop.txd/sw_brick05.dds\",\n \"gta3.img/cw_roofbitcs_t.txd/aroofbit93.dds\",\"gta3.img/cunte_gas01.txd/aroofbit93.dds\",\n \"gta3.img/genroofbits.txd/aroofbit93.dds\",\"gta3.img/cunte_gas01.txd/aroofbit93.dds\",\n \"gta3.img/mainlcawn.txd/downtsign13_la.dds\",\"gta3.img/cunte_gas01.txd/downtsign13_la.dds\",\n \"gta3.img/melrose03_lawn.txd/downtsign13_la.dds\",\"gta3.img/cunte_gas01.txd/downtsign13_la.dds\",\n \"gta3.img/eastls4_lae2.txd/comptsign8_lae.dds\",\"gta3.img/cunte_gas01.txd/comptsign8_lae.dds\",\n \"gta3.img/vegasbuild.txd/comptsign8_lae.dds\",\"gta3.img/cunte_gas01.txd/comptsign8_lae.dds\",\n \"gta3.img/vgsespras.txd/comptsign8_lae.dds\",\"gta3.img/cunte_gas01.txd/comptsign8_lae.dds\",\n \"gta3.img/vegasflag.txd/starspangban1_256.dds\",\"gta3.img/cunte_gas01.txd/starspangban1_256.dds\",\n \"gta3.img/vgnfirestat.txd/starspangban1_256.dds\",\"gta3.img/cunte_gas01.txd/starspangban1_256.dds\",\n \"gta_int.img/cj_ammo_posters.txd/cj_flag2.dds\",\"gta3.img/cunte_gas01.txd/cj_flag2.dds\",\n \"gta3.img/sw_roadgas.txd/sw_gasso2.dds\",\"gta3.img/cunte_gas01.txd/sw_gasso2.dds\",\n \"gta3.img/des_ntown.txd/des_ntwnwall1.dds\",\"gta3.img/cunte_house1.txd/des_ntwnwall1.dds\",\n \"gta3.img/des_steakhouse.txd/des_ntwnwall1.dds\",\"gta3.img/cunte_house1.txd/des_ntwnwall1.dds\",\n \"gta3.img/sunst18_lawn.txd/sw_patiodoors.dds\",\"gta3.img/cunte_house1.txd/sw_patiodoors.dds\",\n \"gta3.img/sw_fact02alt.txd/sw_patiodoors.dds\",\"gta3.img/cunte_house1.txd/sw_patiodoors.dds\",\n \"gta3.img/vegashse5.txd/sw_patiodoors.dds\",\"gta3.img/cunte_house1.txd/sw_patiodoors.dds\",\n \"gta3.img/vegashse6.txd/sw_patiodoors.dds\",\"gta3.img/cunte_house1.txd/sw_patiodoors.dds\",\n \"gta3.img/vegashse7.txd/sw_patiodoors.dds\",\"gta3.img/cunte_house1.txd/sw_patiodoors.dds\",\n \"gta3.img/vegassvehse7.txd/sw_patiodoors.dds\",\"gta3.img/cunte_house1.txd/sw_patiodoors.dds\",\n \"gta3.img/sw_apartflat.txd/ws_boxhouse_wins6.dds\",\"gta3.img/cunte_house1.txd/ws_boxhouse_wins6.dds\",\n \"gta3.img/fishwarf.txd/garargeb2.dds\",\"gta3.img/cunte_house1.txd/garargeb2.dds\",\n \"gta3.img/garage_sfw.txd/garargeb2.dds\",\"gta3.img/cunte_house1.txd/garargeb2.dds\",\n \"gta3.img/laesmokecnthus.txd/garargeb2.dds\",\"gta3.img/cunte_house1.txd/garargeb2.dds\",\n \"gta3.img/oldgarage_sfse.txd/garargeb2.dds\",\"gta3.img/cunte_house1.txd/garargeb2.dds\",\n \"gta3.img/vgndwntwn22.txd/garargeb2.dds\",\"gta3.img/cunte_house1.txd/garargeb2.dds\",\n \"gta3.img/vgnptrlpmp.txd/garargeb2.dds\",\"gta3.img/cunte_house1.txd/garargeb2.dds\",\n \"gta3.img/vgsegarage.txd/garargeb2.dds\",\"gta3.img/cunte_house1.txd/garargeb2.dds\",\n \"gta3.img/vgsespras.txd/garargeb2.dds\",\"gta3.img/cunte_house1.txd/garargeb2.dds\",\n \"gta3.img/vgslowbuild.txd/garargeb2.dds\",\"gta3.img/cunte_house1.txd/garargeb2.dds\",\n \"gta3.img/smallertxd.txd/tilered.dds\",\"gta3.img/cunte_house1.txd/tilered.dds\",\n \"gta3.img/hillhousex_la1_2.txd/darkplanks1.dds\",\"gta3.img/cunte_house1.txd/darkplanks1.dds\",\n \"gta3.img/hillhousex_la9.txd/darkplanks1.dds\",\"gta3.img/cunte_house1.txd/darkplanks1.dds\",\n \"gta_int.img/int_brothelint3.txd/darkplanks1.dds\",\"gta3.img/cunte_house1.txd/darkplanks1.dds\",\n \"gta3.img/melrose02_lawn.txd/lastripmall1.dds\",\"gta3.img/cunte_lik.txd/lastripmall1.dds\",\n \"gta3.img/cuntwshopscs_t.txd/des_rosigns1.dds\",\"gta3.img/cunte_lik.txd/des_rosigns1.dds\",\n \"gta3.img/des_stownmain2.txd/des_rosigns1.dds\",\"gta3.img/cunte_lik.txd/des_rosigns1.dds\",\n \"gta3.img/cuntwshopscs_t.txd/crencouwall1.dds\",\"gta3.img/cunte_lik.txd/crencouwall1.dds\",\n \"gta3.img/des_stownmain2.txd/crencouwall1.dds\",\"gta3.img/cunte_lik.txd/crencouwall1.dds\",\n \"gta3.img/eastls4_lae2.txd/crencouwall1.dds\",\"gta3.img/cunte_lik.txd/crencouwall1.dds\",\n \"gta3.img/ground4_las.txd/crencouwall1.dds\",\"gta3.img/cunte_lik.txd/crencouwall1.dds\",\n \"gta3.img/imrancomp_las2.txd/crencouwall1.dds\",\"gta3.img/cunte_lik.txd/crencouwall1.dds\",\n \"gta_int.img/genintwarehsint3.txd/crencouwall1.dds\",\"gta3.img/cunte_lik.txd/crencouwall1.dds\",\n \"gta3.img/des_n.txd/des_1linetar.dds\",\"gta3.img/cunteroads1.txd/des_1linetar.dds\",\n \"gta3.img/des_ne.txd/des_1line256.dds\",\"gta3.img/cunteroads1.txd/des_1line256.dds\",\n \"gta3.img/des_n.txd/des_1line256.dds\",\"gta3.img/cunteroads1.txd/des_1line256.dds\",\n \"gta3.img/sw_block03.txd/sw_gasground.dds\",\"gta3.img/cunteroads2.txd/sw_gasground.dds\",\n \"gta3.img/cunteroads4.txd/roadnew4_256.dds\",\"gta3.img/cunteroads2.txd/roadnew4_512.dds\",\n \"gta3.img/cunteroads5.txd/roadnew4_256.dds\",\"gta3.img/cunteroads2.txd/roadnew4_512.dds\",\n \"gta3.img/cunteroads6.txd/roadnew4_512.dds\",\"gta3.img/cunteroads2.txd/roadnew4_512.dds\",\n \"gta3.img/des_ebridge.txd/roadnew4_256.dds\",\"gta3.img/cunteroads2.txd/roadnew4_512.dds\",\n \"gta3.img/des_ne.txd/roadnew4_256.dds\",\"gta3.img/cunteroads2.txd/roadnew4_512.dds\",\n \"gta3.img/des_n.txd/roadnew4_256.dds\",\"gta3.img/cunteroads2.txd/roadnew4_512.dds\",\n \"gta3.img/des_nw2.txd/roadnew4_256.dds\",\"gta3.img/cunteroads2.txd/roadnew4_512.dds\",\n \"gta3.img/des_nw.txd/roadnew4_256.dds\",\"gta3.img/cunteroads2.txd/roadnew4_512.dds\",\n \"gta3.img/des_se1.txd/roadnew4_256.dds\",\"gta3.img/cunteroads2.txd/roadnew4_512.dds\",\n \"gta3.img/des_s.txd/roadnew4_256.dds\",\"gta3.img/cunteroads2.txd/roadnew4_512.dds\",\n \"gta3.img/des_sw.txd/roadnew4_256.dds\",\"gta3.img/cunteroads2.txd/roadnew4_512.dds\",\n \"gta3.img/lahillslaroads.txd/roadnew4_256.dds\",\"gta3.img/cunteroads2.txd/roadnew4_512.dds\",\n \"gta3.img/mullho05_lahills.txd/roadnew4_256.dds\",\"gta3.img/cunteroads2.txd/roadnew4_512.dds\",\n \"gta3.img/richman04_lahills.txd/roadnew4_256.dds\",\"gta3.img/cunteroads2.txd/roadnew4_512.dds\",\n \"gta3.img/roads_cunte.txd/roadnew4_256.dds\",\"gta3.img/cunteroads2.txd/roadnew4_512.dds\",\n \"gta3.img/roads_lahills.txd/roadnew4_256.dds\",\"gta3.img/cunteroads2.txd/roadnew4_512.dds\",\n \"gta3.img/roadslahills.txd/roadnew4_256.dds\",\"gta3.img/cunteroads2.txd/roadnew4_512.dds\",\n \"gta3.img/roads_lawn.txd/roadnew4_256.dds\",\"gta3.img/cunteroads2.txd/roadnew4_512.dds\",\n \"gta3.img/cunteroads4.txd/cos_hiwayins_256.dds\",\"gta3.img/cunteroads3.txd/cos_hiwayins_256.dds\",\n \"gta3.img/cunteroads5.txd/cos_hiwayins_256.dds\",\"gta3.img/cunteroads3.txd/cos_hiwayins_256.dds\",\n \"gta3.img/lahillsroadscoast.txd/cos_hiwayins_256.dds\",\"gta3.img/cunteroads3.txd/cos_hiwayins_256.dds\",\n \"gta3.img/vgsehighways.txd/concreteblock_256.dds\",\"gta3.img/cunteroads5.txd/concreteblock_256.dds\",\n \"gta3.img/vgsnhighway.txd/concreteblock_256.dds\",\"gta3.img/cunteroads5.txd/concreteblock_256.dds\",\n \"gta3.img/vgsshiways.txd/concreteblock_256.dds\",\"gta3.img/cunteroads5.txd/concreteblock_256.dds\",\n \"gta3.img/vgwsthiway1.txd/concreteblock_256.dds\",\"gta3.img/cunteroads5.txd/concreteblock_256.dds\",\n \"gta3.img/vgsehighways.txd/hiwayinside5_256.dds\",\"gta3.img/cunteroads5.txd/hiwayinside5_256.dds\",\n \"gta3.img/vgsnhighway.txd/hiwayinside5_256.dds\",\"gta3.img/cunteroads5.txd/hiwayinside5_256.dds\",\n \"gta3.img/vgsshiways.txd/hiwayinside5_256.dds\",\"gta3.img/cunteroads5.txd/hiwayinside5_256.dds\",\n \"gta3.img/vgwsthiway1.txd/hiwayinside5_256.dds\",\"gta3.img/cunteroads5.txd/hiwayinside5_256.dds\",\n \"gta3.img/vgsehighways.txd/hiwayoutside_256.dds\",\"gta3.img/cunteroads5.txd/hiwayoutside_256.dds\",\n \"gta3.img/vgsnhighway.txd/hiwayoutside_256.dds\",\"gta3.img/cunteroads5.txd/hiwayoutside_256.dds\",\n \"gta3.img/vgsshiways.txd/hiwayoutside_256.dds\",\"gta3.img/cunteroads5.txd/hiwayoutside_256.dds\",\n \"gta3.img/vgwsthiway1.txd/hiwayoutside_256.dds\",\"gta3.img/cunteroads5.txd/hiwayoutside_256.dds\",\n \"gta3.img/sw_block11a.txd/wall256hi.dds\",\"gta3.img/cunte_town1.txd/wall256hi.dds\",\n \"gta3.img/w_towncs_t.txd/wall256hi.dds\",\"gta3.img/cunte_town1.txd/wall256hi.dds\",\n \"gta3.img/cw2_photoblockcs_t.txd/newall9-1.dds\",\"gta3.img/cunte_town1.txd/newall9-1.dds\",\n \"gta3.img/downtown_las.txd/newall9-1.dds\",\"gta3.img/cunte_town1.txd/newall9-1.dds\",\n \"gta3.img/sw_apartflat5.txd/newall9-1.dds\",\"gta3.img/cunte_town1.txd/newall9-1.dds\",\n \"gta3.img/sprunkworks.txd/sprunk_temp.dds\",\"gta3.img/cunte_town1.txd/sprunk_temp.dds\",\n \"gta3.img/sw_block05.txd/sprunk_temp.dds\",\"gta3.img/cunte_town1.txd/sprunk_temp.dds\",\n \"gta3.img/xenon_sfse.txd/ws_doubledoor3.dds\",\"gta3.img/cunte_town1.txd/ws_doubledoor3.dds\",\n \"gta3.img/dtbuil1_lan2.txd/pinkshop.dds\",\"gta3.img/cunte_town1.txd/pinkshop.dds\",\n \"gta3.img/vgsswarehse02c.txd/pinkshop.dds\",\"gta3.img/cunte_town1.txd/pinkshop.dds\",\n \"gta3.img/sw_poorhouse.txd/rufwallb256hi.dds\",\"gta3.img/cunte_town1.txd/rufwallb256hi.dds\",\n \"gta3.img/cuntywire.txd/telewireslong2.dds\",\"gta3.img/cunte_wires.txd/telewireslong.dds\",\n \"gta3.img/cw_wires2cs_t.txd/telewireslong.dds\",\"gta3.img/cunte_wires.txd/telewireslong.dds\",\n \"gta3.img/desn2_alphabits.txd/telewireslong.dds\",\"gta3.img/cunte_wires.txd/telewireslong.dds\",\n \"gta3.img/des_stwnsigns1.txd/telewireslong.dds\",\"gta3.img/cunte_wires.txd/telewireslong.dds\",\n \"gta3.img/des_wires.txd/telewireslong.dds\",\"gta3.img/cunte_wires.txd/telewireslong.dds\",\n \"gta3.img/eastlstr2_lae2.txd/telewireslong.dds\",\"gta3.img/cunte_wires.txd/telewireslong.dds\",\n \"gta3.img/eastlstr_lae2.txd/telewireslong.dds\",\"gta3.img/cunte_wires.txd/telewireslong.dds\",\n \"gta3.img/hub_alpha.txd/telewireslong.dds\",\"gta3.img/cunte_wires.txd/telewireslong.dds\",\n \"gta3.img/lae2_alphabits.txd/telewireslong.dds\",\"gta3.img/cunte_wires.txd/telewireslong.dds\",\n \"gta3.img/lae2coast_alpha.txd/telewireslong.dds\",\"gta3.img/cunte_wires.txd/telewireslong.dds\",\n \"gta3.img/laealpha.txd/telewireslong.dds\",\"gta3.img/cunte_wires.txd/telewireslong.dds\",\n \"gta3.img/lahillstr_lawn.txd/telewireslong.dds\",\"gta3.img/cunte_wires.txd/telewireslong.dds\",\n \"gta3.img/mulveg2lahills.txd/telewireslong.dds\",\"gta3.img/cunte_wires.txd/telewireslong.dds\",\n \"gta3.img/telewirelawn.txd/telewireslong.dds\",\"gta3.img/cunte_wires.txd/telewireslong.dds\",\n \"gta3.img/wiresetc2_las.txd/telewireslong2.dds\",\"gta3.img/cunte_wires.txd/telewireslong.dds\",\n \"gta3.img/wiresetc_las2.txd/telewireslong2.dds\",\"gta3.img/cunte_wires.txd/telewireslong.dds\",\n \"gta3.img/wiresetc_las.txd/telewireslong2.dds\",\"gta3.img/cunte_wires.txd/telewireslong.dds\",\n \"gta3.img/wires_sfs.txd/telewireslong.dds\",\"gta3.img/cunte_wires.txd/telewireslong.dds\",\n \"gta3.img/vgetrainfnce.txd/steel64.dds\",\"gta3.img/cuntplntfnce.txd/steel64.dds\",\n \"gta3.img/vgnntrainfnce.txd/steel64.dds\",\"gta3.img/cuntplntfnce.txd/steel64.dds\",\n \"gta3.img/vgnpwrmainbld.txd/steel64.dds\",\"gta3.img/cuntplntfnce.txd/steel64.dds\",\n \"gta3.img/vgnshopnmall.txd/steel64.dds\",\"gta3.img/cuntplntfnce.txd/steel64.dds\",\n \"gta3.img/vgwestrailrd.txd/steel64.dds\",\"gta3.img/cuntplntfnce.txd/steel64.dds\",\n \"gta3.img/golf_sfs.txd/rock_country128.dds\",\"gta3.img/cuntrockcs_t.txd/rock_country128.dds\",\n \"gta3.img/cuntwlandcarparks.txd/rock_country128.dds\",\"gta3.img/cuntrock.txd/rock_country128.dds\",\n \"gta3.img/cuntwlandse.txd/rock_country128.dds\",\"gta3.img/cuntrock.txd/rock_country128.dds\",\n \"gta3.img/cuntwland.txd/rock_country128.dds\",\"gta3.img/cuntrock.txd/rock_country128.dds\",\n \"gta3.img/cuntwlandwest.txd/rock_country128.dds\",\"gta3.img/cuntrock.txd/rock_country128.dds\",\n \"gta3.img/rockdetail.txd/rock_country128.dds\",\"gta3.img/cuntrock.txd/rock_country128.dds\",\n \"gta3.img/underwater.txd/rock_country128.dds\",\"gta3.img/cuntrock.txd/rock_country128.dds\",\n \"gta_int.img/kickstart.txd/rock_country128.dds\",\"gta3.img/cuntrock.txd/rock_country128.dds\",\n \"gta3.img/des_gunclub.txd/ws_corr_1_tan.dds\",\"gta3.img/cunts_gunclub.txd/ws_corr_1_tan.dds\",\n \"gta3.img/docks2refl_sfse.txd/ws_corr_1_tan.dds\",\"gta3.img/cunts_gunclub.txd/ws_corr_1_tan.dds\",\n \"gta3.img/drydockshed_sfse.txd/ws_corr_1_tan.dds\",\"gta3.img/cunts_gunclub.txd/ws_corr_1_tan.dds\",\n \"gta3.img/laeroads2s.txd/gb_nastybar02.dds\",\"gta3.img/cuntwbridges.txd/gb_nastybar02.dds\",\n \"gta_int.img/cj_bar2.txd/gb_nastybar02.dds\",\"gta3.img/cuntwbridges.txd/gb_nastybar02.dds\",\n \"gta3.img/desn2_peckers.txd/carparkdoor1_256.dds\",\"gta3.img/cuntwbt.txd/carparkdoor1_256.dds\",\n \"gta3.img/des_stownmain3.txd/carparkdoor1_256.dds\",\"gta3.img/cuntwbt.txd/carparkdoor1_256.dds\",\n \"gta3.img/desn2_peckers.txd/corugwall2-1.dds\",\"gta3.img/cuntwbt.txd/corugwall2-1.dds\",\n \"gta3.img/des_stownmain3.txd/corugwall2-1.dds\",\"gta3.img/cuntwbt.txd/corugwall2-1.dds\",\n \"gta3.img/dockcargo1_las.txd/corugwall2-1.dds\",\"gta3.img/cuntwbt.txd/corugwall2-1.dds\",\n \"gta3.img/sw_med1.txd/corugwall2-1.dds\",\"gta3.img/cuntwbt.txd/corugwall2-1.dds\",\n \"gta3.img/xenon_sfse.txd/corugwall2-1.dds\",\"gta3.img/cuntwbt.txd/corugwall2-1.dds\",\n \"gta3.img/cxref_quarrytest.txd/bluemetal05.dds\",\"gta3.img/cuntwbt.txd/bluemetal05.dds\",\n \"gta3.img/desn2_peckers.txd/bluemetal05.dds\",\"gta3.img/cuntwbt.txd/bluemetal05.dds\",\n \"gta3.img/des_stownmain3.txd/bluemetal05.dds\",\"gta3.img/cuntwbt.txd/bluemetal05.dds\",\n \"gta3.img/cw2_storesnstuff.txd/des_woodslats2.dds\",\"gta3.img/cuntwbt.txd/des_woodslats2.dds\",\n \"gta3.img/cxref_oldwest.txd/des_woodslats2.dds\",\"gta3.img/cuntwbt.txd/des_woodslats2.dds\",\n \"gta3.img/cxref_savhus.txd/des_woodslats2.dds\",\"gta3.img/cuntwbt.txd/des_woodslats2.dds\",\n \"gta3.img/des_farmstuff.txd/des_woodslats2.dds\",\"gta3.img/cuntwbt.txd/des_woodslats2.dds\",\n \"gta3.img/des_nstuff.txd/des_woodslats2.dds\",\"gta3.img/cuntwbt.txd/des_woodslats2.dds\",\n \"gta3.img/des_ranch.txd/des_woodslats2.dds\",\"gta3.img/cuntwbt.txd/des_woodslats2.dds\",\n \"gta3.img/des_wtownmain.txd/des_woodslats2.dds\",\"gta3.img/cuntwbt.txd/des_woodslats2.dds\",\n \"gta3.img/oldwest.txd/des_woodslats2.dds\",\"gta3.img/cuntwbt.txd/des_woodslats2.dds\",\n \"gta3.img/sw_smlfarm.txd/des_woodslats2.dds\",\"gta3.img/cuntwbt.txd/des_woodslats2.dds\",\n \"gta3.img/cuntwshopscs_t.txd/des_woodslats1.dds\",\"gta3.img/cuntwbt.txd/des_woodslats1.dds\",\n \"gta3.img/cw2_storesnstuff.txd/des_woodslats1.dds\",\"gta3.img/cuntwbt.txd/des_woodslats1.dds\",\n \"gta3.img/cxref_oldwest.txd/des_woodslats1.dds\",\"gta3.img/cuntwbt.txd/des_woodslats1.dds\",\n \"gta3.img/des_baitshop.txd/des_woodslats1.dds\",\"gta3.img/cuntwbt.txd/des_woodslats1.dds\",\n \"gta3.img/des_farmstuff.txd/des_woodslats1.dds\",\"gta3.img/cuntwbt.txd/des_woodslats1.dds\",\n \"gta3.img/des_nstuff.txd/des_woodslats1.dds\",\"gta3.img/cuntwbt.txd/des_woodslats1.dds\",\n \"gta3.img/des_ranch.txd/des_woodslats1.dds\",\"gta3.img/cuntwbt.txd/des_woodslats1.dds\",\n \"gta3.img/des_wtownmain.txd/des_woodslats1.dds\",\"gta3.img/cuntwbt.txd/des_woodslats1.dds\",\n \"gta3.img/oldwest.txd/des_woodslats1.dds\",\"gta3.img/cuntwbt.txd/des_woodslats1.dds\",\n \"gta3.img/sw_smlfarm.txd/des_woodslats1.dds\",\"gta3.img/cuntwbt.txd/des_woodslats1.dds\",\n \"gta3.img/cxref_oldwest.txd/des_cornices.dds\",\"gta3.img/cuntwbtxcs_t.txd/des_cornices.dds\",\n \"gta3.img/des_nwtown.txd/des_cornices.dds\",\"gta3.img/cuntwbtxcs_t.txd/des_cornices.dds\",\n \"gta3.img/des_stownmain1.txd/des_cornices.dds\",\"gta3.img/cuntwbtxcs_t.txd/des_cornices.dds\",\n \"gta3.img/des_stownmain2.txd/des_cornices.dds\",\"gta3.img/cuntwbtxcs_t.txd/des_cornices.dds\",\n \"gta3.img/des_wtownmain.txd/des_cornices.dds\",\"gta3.img/cuntwbtxcs_t.txd/des_cornices.dds\",\n \"gta3.img/oldwest.txd/des_cornices.dds\",\"gta3.img/cuntwbtxcs_t.txd/des_cornices.dds\",\n \"gta3.img/des_clifftown.txd/des_thfdoor.dds\",\"gta3.img/cuntwbtxcs_t.txd/des_thfdoor.dds\",\n \"gta3.img/des_stownmain1.txd/des_thfdoor.dds\",\"gta3.img/cuntwbtxcs_t.txd/des_thfdoor.dds\",\n \"gta3.img/des_bigearstuff.txd/offwhitebrix.dds\",\"gta3.img/cuntwbtxcs_t.txd/offwhitebrix.dds\",\n \"gta3.img/des_bighus.txd/offwhitebrix.dds\",\"gta3.img/cuntwbtxcs_t.txd/offwhitebrix.dds\",\n \"gta3.img/des_gunclub.txd/offwhitebrix.dds\",\"gta3.img/cuntwbtxcs_t.txd/offwhitebrix.dds\",\n \"gta3.img/desn2_peckers.txd/offwhitebrix.dds\",\"gta3.img/cuntwbtxcs_t.txd/offwhitebrix.dds\",\n \"gta3.img/desn2_truckstop.txd/offwhitebrix.dds\",\"gta3.img/cuntwbtxcs_t.txd/offwhitebrix.dds\",\n \"gta3.img/des_n.txd/offwhitebrix.dds\",\"gta3.img/cuntwbtxcs_t.txd/offwhitebrix.dds\",\n \"gta3.img/des_ufoinn.txd/offwhitebrix.dds\",\"gta3.img/cuntwbtxcs_t.txd/offwhitebrix.dds\",\n \"gta3.img/jeffers4_lae.txd/offwhitebrix.dds\",\"gta3.img/cuntwbtxcs_t.txd/offwhitebrix.dds\",\n \"gta3.img/ufo_bar.txd/offwhitebrix.dds\",\"gta3.img/cuntwbtxcs_t.txd/offwhitebrix.dds\",\n \"gta3.img/vegasbuild.txd/offwhitebrix.dds\",\"gta3.img/cuntwbtxcs_t.txd/offwhitebrix.dds\",\n \"gta3.img/cw2_storesnstuff.txd/des_door2.dds\",\"gta3.img/cuntwbtxcs_t.txd/des_door2.dds\",\n \"gta3.img/cw_truckstopcs_t.txd/des_door2.dds\",\"gta3.img/cuntwbtxcs_t.txd/des_door2.dds\",\n \"gta3.img/des_bigearstuff.txd/des_door2.dds\",\"gta3.img/cuntwbtxcs_t.txd/des_door2.dds\",\n \"gta3.img/des_clifftown.txd/des_door2.dds\",\"gta3.img/cuntwbtxcs_t.txd/des_door2.dds\",\n \"gta3.img/desn2_peckers.txd/des_door2.dds\",\"gta3.img/cuntwbtxcs_t.txd/des_door2.dds\",\n \"gta3.img/des_nstuff.txd/des_door2.dds\",\"gta3.img/cuntwbtxcs_t.txd/des_door2.dds\",\n \"gta3.img/des_nwtownw.txd/des_door2.dds\",\"gta3.img/cuntwbtxcs_t.txd/des_door2.dds\",\n \"gta3.img/des_stownmain2.txd/des_door2.dds\",\"gta3.img/cuntwbtxcs_t.txd/des_door2.dds\",\n \"gta3.img/des_stownstrip1.txd/des_door2.dds\",\"gta3.img/cuntwbtxcs_t.txd/des_door2.dds\",\n \"gta3.img/des_stownstrip2.txd/des_door2.dds\",\"gta3.img/cuntwbtxcs_t.txd/des_door2.dds\",\n \"gta3.img/des_wgarage.txd/des_door2.dds\",\"gta3.img/cuntwbtxcs_t.txd/des_door2.dds\",\n \"gta3.img/des_wtownmain.txd/des_door2.dds\",\"gta3.img/cuntwbtxcs_t.txd/des_door2.dds\",\n \"gta3.img/w_town3cs_t.txd/des_door2.dds\",\"gta3.img/cuntwbtxcs_t.txd/des_door2.dds\",\n \"gta3.img/des_dinerw.txd/metaldoor01_256.dds\",\"gta3.img/cuntwbtzzcs_t.txd/metaldoor01_256.dds\",\n \"gta3.img/des_ufoinn.txd/metaldoor01_256.dds\",\"gta3.img/cuntwbtzzcs_t.txd/metaldoor01_256.dds\",\n \"gta3.img/ebeachcineblok.txd/metaldoor01_256.dds\",\"gta3.img/cuntwbtzzcs_t.txd/metaldoor01_256.dds\",\n \"gta3.img/garage_sfw.txd/metaldoor01_256.dds\",\"gta3.img/cuntwbtzzcs_t.txd/metaldoor01_256.dds\",\n \"gta3.img/imrancomp_las2.txd/metaldoor01_256.dds\",\"gta3.img/cuntwbtzzcs_t.txd/metaldoor01_256.dds\",\n \"gta3.img/imyladrx.txd/metaldoor01_256.dds\",\"gta3.img/cuntwbtzzcs_t.txd/metaldoor01_256.dds\",\n \"gta3.img/vegasairprtland.txd/metaldoor01_256.dds\",\"gta3.img/cuntwbtzzcs_t.txd/metaldoor01_256.dds\",\n \"gta3.img/vgnbball.txd/metaldoor01_256.dds\",\"gta3.img/cuntwbtzzcs_t.txd/metaldoor01_256.dds\",\n \"gta3.img/vgnfrates.txd/metaldoor01_256.dds\",\"gta3.img/cuntwbtzzcs_t.txd/metaldoor01_256.dds\",\n \"gta3.img/vgsbikeschool.txd/metaldoor01_256.dds\",\"gta3.img/cuntwbtzzcs_t.txd/metaldoor01_256.dds\",\n \"gta3.img/vgsespras.txd/metaldoor01_256.dds\",\"gta3.img/cuntwbtzzcs_t.txd/metaldoor01_256.dds\",\n \"gta3.img/vgsewrehse.txd/metaldoor01_256.dds\",\"gta3.img/cuntwbtzzcs_t.txd/metaldoor01_256.dds\",\n \"gta3.img/vgsswarehse02.txd/metaldoor01_256.dds\",\"gta3.img/cuntwbtzzcs_t.txd/metaldoor01_256.dds\",\n \"gta_int.img/genintwarehsint3.txd/metaldoor01_256.dds\",\"gta3.img/cuntwbtzzcs_t.txd/metaldoor01_256.dds\",\n \"gta3.img/cw2_storesnstuff.txd/des_dinerwall.dds\",\"gta3.img/cuntwbtzzcs_t.txd/des_dinerwall.dds\",\n \"gta3.img/cw_truckstopcs_t.txd/des_dinerwall.dds\",\"gta3.img/cuntwbtzzcs_t.txd/des_dinerwall.dds\",\n \"gta3.img/des_dinerw.txd/des_dinerwall.dds\",\"gta3.img/cuntwbtzzcs_t.txd/des_dinerwall.dds\",\n \"gta3.img/desn2_truckstop.txd/des_dinerwall.dds\",\"gta3.img/cuntwbtzzcs_t.txd/des_dinerwall.dds\",\n \"gta3.img/desn_decocafe.txd/des_dinerwall.dds\",\"gta3.img/cuntwbtzzcs_t.txd/des_dinerwall.dds\",\n \"gta3.img/desn_truckstop.txd/des_dinerwall.dds\",\"gta3.img/cuntwbtzzcs_t.txd/des_dinerwall.dds\",\n \"gta3.img/des_stownstrip2.txd/des_dinerwall.dds\",\"gta3.img/cuntwbtzzcs_t.txd/des_dinerwall.dds\",\n \"gta3.img/des_wgarage.txd/des_dinerwall.dds\",\"gta3.img/cuntwbtzzcs_t.txd/des_dinerwall.dds\",\n \"gta3.img/des_dinerw.txd/corugwallnew6_128.dds\",\"gta3.img/cuntwbtzzcs_t.txd/corugwallnew6_128.dds\",\n \"gta3.img/des_stownmots1.txd/corugwallnew6_128.dds\",\"gta3.img/cuntwbtzzcs_t.txd/corugwallnew6_128.dds\",\n \"gta3.img/vgslowbuild1.txd/corugwallnew6_128.dds\",\"gta3.img/cuntwbtzzcs_t.txd/corugwallnew6_128.dds\",\n \"gta3.img/sw_farm1.txd/sw_vane01.dds\",\"gta3.img/cuntwf.txd/sw_vane01.dds\",\n \"gta3.img/sw_farm1.txd/ws_corrugated3.dds\",\"gta3.img/cuntwf.txd/ws_corrugated3.dds\",\n \"gta3.img/sw_farm1.txd/sw_walltile.dds\",\"gta3.img/cuntwf.txd/sw_walltile.dds\",\n \"gta3.img/cuntwlandse.txd/sw_sandgrass4.dds\",\"gta3.img/cuntwlandcarparks.txd/sw_sandgrass4.dds\",\n \"gta3.img/cuntwlandwest.txd/sw_sandgrass4.dds\",\"gta3.img/cuntwlandcarparks.txd/sw_sandgrass4.dds\",\n \"gta3.img/cuntwland.txd/grasstype3dirt.dds\",\"gta3.img/cuntwlandcarparks.txd/grasstype3dirt.dds\",\n \"gta3.img/cuntwlandse.txd/grasstype5_4.dds\",\"gta3.img/cuntwlandcarparks.txd/grasstype5_4.dds\",\n \"gta3.img/cuntwland.txd/grasstype5_4.dds\",\"gta3.img/cuntwlandcarparks.txd/grasstype5_4.dds\",\n \"gta3.img/des_se3.txd/grasstype5_4.dds\",\"gta3.img/cuntwlandcarparks.txd/grasstype5_4.dds\",\n \"gta3.img/cuntwlandse.txd/grasstype5.dds\",\"gta3.img/cuntwlandcarparks.txd/grasstype5.dds\",\n \"gta3.img/cuntwland.txd/grasstype5.dds\",\"gta3.img/cuntwlandcarparks.txd/grasstype5.dds\",\n \"gta3.img/des_n.txd/grasstype5.dds\",\"gta3.img/cuntwlandcarparks.txd/grasstype5.dds\",\n \"gta3.img/des_se3.txd/grasstype5.dds\",\"gta3.img/cuntwlandcarparks.txd/grasstype5.dds\",\n \"gta3.img/des_se4.txd/grasstype5.dds\",\"gta3.img/cuntwlandcarparks.txd/grasstype5.dds\",\n \"gta3.img/des_s.txd/grasstype5.dds\",\"gta3.img/cuntwlandcarparks.txd/grasstype5.dds\",\n \"gta3.img/cuntwlandse.txd/grasstype4-3.dds\",\"gta3.img/cuntwlandcarparks.txd/grasstype4-3.dds\",\n \"gta3.img/cuntwland.txd/grasstype4-3.dds\",\"gta3.img/cuntwlandcarparks.txd/grasstype4-3.dds\",\n \"gta3.img/landcoast_lae2.txd/grasstype4-3.dds\",\"gta3.img/cuntwlandcarparks.txd/grasstype4-3.dds\",\n \"gta3.img/glenpark6d_lae.txd/grassdeep1.dds\",\"gta3.img/cuntwlandcent.txd/grassdeep1.dds\",\n \"gta3.img/cuntwlandse.txd/desmudtrail.dds\",\"gta3.img/cuntwlandcent.txd/desmudtrail.dds\",\n \"gta3.img/cuntwland.txd/forest_rocks.dds\",\"gta3.img/cuntwlandcent.txd/forest_rocks.dds\",\n \"gta3.img/cuntwlandwest.txd/forest_rocks.dds\",\"gta3.img/cuntwlandcent.txd/forest_rocks.dds\",\n \"gta3.img/railwaycuntw.txd/rail_stones256.dds\",\"gta3.img/cuntwlandcent.txd/rail_stones256.dds\",\n \"gta3.img/cuntwland.txd/grass10forest.dds\",\"gta3.img/cuntwlandcent.txd/grass10forest.dds\",\n \"gta3.img/desn_trainstuff.txd/ws_traingravel.dds\",\"gta3.img/cuntwlandcent.txd/ws_traingravel.dds\",\n \"gta3.img/des_se1.txd/ws_traingravel.dds\",\"gta3.img/cuntwlandcent.txd/ws_traingravel.dds\",\n \"gta3.img/des_trainstuff.txd/ws_traingravel.dds\",\"gta3.img/cuntwlandcent.txd/ws_traingravel.dds\",\n \"gta3.img/railbridge_sfse.txd/ws_traingravel.dds\",\"gta3.img/cuntwlandcent.txd/ws_traingravel.dds\",\n \"gta3.img/railtracklae.txd/ws_traingravel.dds\",\"gta3.img/cuntwlandcent.txd/ws_traingravel.dds\",\n \"gta3.img/railtunn1_law2.txd/ws_traingravel.dds\",\"gta3.img/cuntwlandcent.txd/ws_traingravel.dds\",\n \"gta3.img/railwaycuntw.txd/ws_traingravel.dds\",\"gta3.img/cuntwlandcent.txd/ws_traingravel.dds\",\n \"gta3.img/railway_las.txd/ws_traingravel.dds\",\"gta3.img/cuntwlandcent.txd/ws_traingravel.dds\",\n \"gta3.img/silicon_sfse.txd/ws_traingravel.dds\",\"gta3.img/cuntwlandcent.txd/ws_traingravel.dds\",\n \"gta3.img/stationtunnel.txd/ws_traingravel.dds\",\"gta3.img/cuntwlandcent.txd/ws_traingravel.dds\",\n \"gta3.img/sw_church.txd/ws_traingravel.dds\",\"gta3.img/cuntwlandcent.txd/ws_traingravel.dds\",\n \"gta3.img/traindocks_sfse.txd/ws_traingravel.dds\",\"gta3.img/cuntwlandcent.txd/ws_traingravel.dds\",\n \"gta3.img/traingen_sfse.txd/ws_traingravel.dds\",\"gta3.img/cuntwlandcent.txd/ws_traingravel.dds\",\n \"gta3.img/trainplatform_sfse.txd/ws_traingravel.dds\",\"gta3.img/cuntwlandcent.txd/ws_traingravel.dds\",\n \"gta3.img/traintrack_las2.txd/ws_traingravel.dds\",\"gta3.img/cuntwlandcent.txd/ws_traingravel.dds\",\n \"gta3.img/traintrack_las.txd/ws_traingravel.dds\",\"gta3.img/cuntwlandcent.txd/ws_traingravel.dds\",\n \"gta3.img/traintunnel1_sfse.txd/ws_traingravel.dds\",\"gta3.img/cuntwlandcent.txd/ws_traingravel.dds\",\n \"gta3.img/traintunnel2_sfse.txd/ws_traingravel.dds\",\"gta3.img/cuntwlandcent.txd/ws_traingravel.dds\",\n \"gta3.img/tunnel_law.txd/ws_traingravel.dds\",\"gta3.img/cuntwlandcent.txd/ws_traingravel.dds\",\n \"gta3.img/vgnland.txd/hiwaygravel1_256.dds\",\"gta3.img/cuntwlandcent.txd/ws_traingravel.dds\",\n \"gta3.img/vgnrailroad.txd/ws_traingravel.dds\",\"gta3.img/cuntwlandcent.txd/ws_traingravel.dds\",\n \"gta3.img/vgsecoast.txd/ws_traingravel.dds\",\"gta3.img/cuntwlandcent.txd/ws_traingravel.dds\",\n \"gta3.img/vgsrailroad.txd/ws_traingravel.dds\",\"gta3.img/cuntwlandcent.txd/ws_traingravel.dds\",\n \"gta3.img/vgssland01.txd/hiwaygravel1_256.dds\",\"gta3.img/cuntwlandcent.txd/ws_traingravel.dds\",\n \"gta3.img/vgssland03.txd/hiwaygravel1_256.dds\",\"gta3.img/cuntwlandcent.txd/ws_traingravel.dds\",\n \"gta3.img/vgssland.txd/hiwaygravel1_256.dds\",\"gta3.img/cuntwlandcent.txd/ws_traingravel.dds\",\n \"gta3.img/vgwestland2.txd/hiwaygravel1_256.dds\",\"gta3.img/cuntwlandcent.txd/ws_traingravel.dds\",\n \"gta3.img/vgwestland.txd/hiwaygravel1_256.dds\",\"gta3.img/cuntwlandcent.txd/ws_traingravel.dds\",\n \"gta3.img/vgwestrailrd.txd/ws_traingravel.dds\",\"gta3.img/cuntwlandcent.txd/ws_traingravel.dds\",\n \"gta3.img/cuntwland.txd/stones256.dds\",\"gta3.img/cuntwlandcent.txd/stones256.dds\",\n \"gta3.img/cuntwlandwest.txd/stones256.dds\",\"gta3.img/cuntwlandcent.txd/stones256.dds\",\n \"gta3.img/fosterroads_sfse.txd/stones256.dds\",\"gta3.img/cuntwlandcent.txd/stones256.dds\",\n \"gta3.img/hotel1.txd/stones256.dds\",\"gta3.img/cuntwlandcent.txd/stones256.dds\",\n \"gta3.img/silconland_sfse.txd/stones256.dds\",\"gta3.img/cuntwlandcent.txd/stones256.dds\",\n \"gta3.img/silicon2_sfse.txd/stones256.dds\",\"gta3.img/cuntwlandcent.txd/stones256.dds\",\n \"gta3.img/silicon_sfse.txd/stones256.dds\",\"gta3.img/cuntwlandcent.txd/stones256.dds\",\n \"gta3.img/stadiumground_sfse.txd/stones256.dds\",\"gta3.img/cuntwlandcent.txd/stones256.dds\",\n \"gta3.img/stadjunct_sfse.txd/stones256.dds\",\"gta3.img/cuntwlandcent.txd/stones256.dds\",\n \"gta3.img/cuntwland.txd/rocktq128_dirt.dds\",\"gta3.img/cuntwlandcent.txd/rocktq128_dirt.dds\",\n \"gta3.img/cuntwlandwest.txd/rocktq128_dirt.dds\",\"gta3.img/cuntwlandcent.txd/rocktq128_dirt.dds\",\n \"gta3.img/des_se4.txd/rocktq128_dirt.dds\",\"gta3.img/cuntwlandcent.txd/rocktq128_dirt.dds\",\n \"gta3.img/des_s.txd/rocktq128_dirt.dds\",\"gta3.img/cuntwlandcent.txd/rocktq128_dirt.dds\",\n \"gta3.img/mountainsfs.txd/rocktq128_dirt.dds\",\"gta3.img/cuntwlandcent.txd/rocktq128_dirt.dds\",\n \"gta3.img/cuntwland.txd/grass10dirt.dds\",\"gta3.img/cuntwlandcent.txd/grass10dirt.dds\",\n \"gta3.img/cuntwlandwest.txd/rocktq128_forestblend2.dds\",\"gta3.img/cuntwlandcent.txd/rocktq128_forestblend2.dds\",\n \"gta3.img/cuntwland.txd/rocktq128blender.dds\",\"gta3.img/cuntwlandcent.txd/rocktq128blender.dds\",\n \"gta3.img/cuntwtunnel.txd/rocktq128blender.dds\",\"gta3.img/cuntwlandcent.txd/rocktq128blender.dds\",\n \"gta3.img/silconland_sfse.txd/rocktq128blender.dds\",\"gta3.img/cuntwlandcent.txd/rocktq128blender.dds\",\n \"gta3.img/cuntwland.txd/roadblendcunt.dds\",\"gta3.img/cuntwlandcent.txd/roadblendcunt.dds\",\n \"gta3.img/cuntwtunnel.txd/roadblendcunt.dds\",\"gta3.img/cuntwlandcent.txd/roadblendcunt.dds\",\n \"gta3.img/freeways2_sfse.txd/roadblendcunt.dds\",\"gta3.img/cuntwlandcent.txd/roadblendcunt.dds\",\n \"gta3.img/cuntwlandwest.txd/des_crackeddirt1.dds\",\"gta3.img/cuntwlandse.txd/des_crackeddirt1.dds\",\n \"gta3.img/des_cen.txd/des_crackeddirt1.dds\",\"gta3.img/cuntwlandse.txd/des_crackeddirt1.dds\",\n \"gta3.img/des_se1.txd/des_crackeddirt1.dds\",\"gta3.img/cuntwlandse.txd/des_crackeddirt1.dds\",\n \"gta3.img/stormdra1_lae.txd/des_crackeddirt1.dds\",\"gta3.img/cuntwlandse.txd/des_crackeddirt1.dds\",\n \"gta3.img/sunset1alp_lan2.txd/des_crackeddirt1.dds\",\"gta3.img/cuntwlandse.txd/des_crackeddirt1.dds\",\n \"gta3.img/cuntwland.txd/parking2.dds\",\"gta3.img/cuntwlandse.txd/parking2.dds\",\n \"gta3.img/des_cen.txd/parking2.dds\",\"gta3.img/cuntwlandse.txd/parking2.dds\",\n \"gta3.img/des_ne.txd/parking2.dds\",\"gta3.img/cuntwlandse.txd/parking2.dds\",\n \"gta3.img/des_n.txd/parking2.dds\",\"gta3.img/cuntwlandse.txd/parking2.dds\",\n \"gta3.img/des_se1.txd/parking2.dds\",\"gta3.img/cuntwlandse.txd/parking2.dds\",\n \"gta3.img/des_s.txd/parking2.dds\",\"gta3.img/cuntwlandse.txd/parking2.dds\",\n \"gta3.img/cuntwland.txd/ws_sub_pen_conc2.dds\",\"gta3.img/cuntwlandse.txd/ws_sub_pen_conc2.dds\",\n \"gta3.img/hubint1_sfse.txd/ws_sub_pen_conc2.dds\",\"gta3.img/cuntwlandse.txd/ws_sub_pen_conc2.dds\",\n \"gta3.img/subpen1_sfse.txd/ws_sub_pen_conc2.dds\",\"gta3.img/cuntwlandse.txd/ws_sub_pen_conc2.dds\",\n \"gta3.img/cuntwland.txd/sw_stones.dds\",\"gta3.img/cuntwlandse.txd/sw_stones.dds\",\n \"gta3.img/cuntwlandwest.txd/sw_stones.dds\",\"gta3.img/cuntwlandse.txd/sw_stones.dds\",\n \"gta3.img/des_se3.txd/grasstype5_dirt.dds\",\"gta3.img/cuntwlandse.txd/grasstype5_dirt.dds\",\n \"gta3.img/des_se4.txd/grasstype5_dirt.dds\",\"gta3.img/cuntwlandse.txd/grasstype5_dirt.dds\",\n \"gta3.img/des_s.txd/grasstype5_dirt.dds\",\"gta3.img/cuntwlandse.txd/grasstype5_dirt.dds\",\n \"gta3.img/sancliff02_law2.txd/grassshort2long256.dds\",\"gta3.img/cuntwland.txd/grassshort2long256.dds\",\n \"gta3.img/sancliff_law2.txd/grassshort2long256.dds\",\"gta3.img/cuntwland.txd/grassshort2long256.dds\",\n \"gta3.img/cuntwtunnel.txd/ws_freeway4.dds\",\"gta3.img/cuntwland.txd/ws_freeway4.dds\",\n \"gta3.img/golftunnel_sfs.txd/ws_freeway4.dds\",\"gta3.img/cuntwland.txd/ws_freeway4.dds\",\n \"gta3.img/vgssairportcpark.txd/ws_freeway4.dds\",\"gta3.img/cuntwland.txd/ws_freeway4.dds\",\n \"gta3.img/cuntwtunnel.txd/ws_tunnelwall2.dds\",\"gta3.img/cuntwland.txd/ws_tunnelwall2.dds\",\n \"gta3.img/des_nbridge.txd/ws_tunnelwall2.dds\",\"gta3.img/cuntwland.txd/ws_tunnelwall2.dds\",\n \"gta3.img/desn_trainstuff.txd/ws_tunnelwall2.dds\",\"gta3.img/cuntwland.txd/ws_tunnelwall2.dds\",\n \"gta3.img/des_railbr.txd/ws_tunnelwall2.dds\",\"gta3.img/cuntwland.txd/ws_tunnelwall2.dds\",\n \"gta3.img/des_trainstuff.txd/ws_tunnelwall2.dds\",\"gta3.img/cuntwland.txd/ws_tunnelwall2.dds\",\n \"gta3.img/firehouse_sfse.txd/ws_tunnelwall2.dds\",\"gta3.img/cuntwland.txd/ws_tunnelwall2.dds\",\n \"gta3.img/freeways2_sfse.txd/ws_tunnelwall2.dds\",\"gta3.img/cuntwland.txd/ws_tunnelwall2.dds\",\n \"gta3.img/freeway_sfs.txd/ws_tunnelwall2.dds\",\"gta3.img/cuntwland.txd/ws_tunnelwall2.dds\",\n \"gta3.img/freeways_sfse.txd/ws_tunnelwall2.dds\",\"gta3.img/cuntwland.txd/ws_tunnelwall2.dds\",\n \"gta3.img/golf_sfs.txd/ws_tunnelwall2.dds\",\"gta3.img/cuntwland.txd/ws_tunnelwall2.dds\",\n \"gta3.img/golftunnel_sfs.txd/ws_tunnelwall2.dds\",\"gta3.img/cuntwland.txd/ws_tunnelwall2.dds\",\n \"gta3.img/railbridge_sfse.txd/ws_tunnelwall2.dds\",\"gta3.img/cuntwland.txd/ws_tunnelwall2.dds\",\n \"gta3.img/railtunn1_law2.txd/ws_tunnelwall2.dds\",\"gta3.img/cuntwland.txd/ws_tunnelwall2.dds\",\n \"gta3.img/railwaycuntw.txd/ws_tunnelwall2.dds\",\"gta3.img/cuntwland.txd/ws_tunnelwall2.dds\",\n \"gta3.img/skyscrapper_sfs.txd/ws_tunnelwall2.dds\",\"gta3.img/cuntwland.txd/ws_tunnelwall2.dds\",\n \"gta3.img/stadiumground_sfse.txd/ws_tunnelwall2.dds\",\"gta3.img/cuntwland.txd/ws_tunnelwall2.dds\",\n \"gta3.img/stationtunnel.txd/ws_tunnelwall2.dds\",\"gta3.img/cuntwland.txd/ws_tunnelwall2.dds\",\n \"gta3.img/traintunnel1_sfse.txd/ws_tunnelwall2.dds\",\"gta3.img/cuntwland.txd/ws_tunnelwall2.dds\",\n \"gta3.img/traintunnel2_sfse.txd/ws_tunnelwall2.dds\",\"gta3.img/cuntwland.txd/ws_tunnelwall2.dds\",\n \"gta3.img/vgnrailroad.txd/ws_tunnelwall2.dds\",\"gta3.img/cuntwland.txd/ws_tunnelwall2.dds\",\n \"gta3.img/vgsebuild01.txd/ws_tunnelwall2.dds\",\"gta3.img/cuntwland.txd/ws_tunnelwall2.dds\",\n \"gta3.img/vgsebuild02.txd/ws_tunnelwall2.dds\",\"gta3.img/cuntwland.txd/ws_tunnelwall2.dds\",\n \"gta3.img/cuntwtunnel.txd/ws_tunnelwall1.dds\",\"gta3.img/cuntwland.txd/ws_tunnelwall1.dds\",\n \"gta3.img/desn_trainstuff.txd/ws_tunnelwall1.dds\",\"gta3.img/cuntwland.txd/ws_tunnelwall1.dds\",\n \"gta3.img/freeway_sfs.txd/ws_tunnelwall1.dds\",\"gta3.img/cuntwland.txd/ws_tunnelwall1.dds\",\n \"gta3.img/freeways_sfse.txd/ws_tunnelwall1.dds\",\"gta3.img/cuntwland.txd/ws_tunnelwall1.dds\",\n \"gta3.img/golf_sfs.txd/ws_tunnelwall1.dds\",\"gta3.img/cuntwland.txd/ws_tunnelwall1.dds\",\n \"gta3.img/golftunnel_sfs.txd/ws_tunnelwall1.dds\",\"gta3.img/cuntwland.txd/ws_tunnelwall1.dds\",\n \"gta3.img/skyscrapper_sfs.txd/ws_tunnelwall1.dds\",\"gta3.img/cuntwland.txd/ws_tunnelwall1.dds\",\n \"gta3.img/stadiumground_sfse.txd/ws_tunnelwall1.dds\",\"gta3.img/cuntwland.txd/ws_tunnelwall1.dds\",\n \"gta3.img/stadjunct_sfse.txd/ws_tunnelwall1.dds\",\"gta3.img/cuntwland.txd/ws_tunnelwall1.dds\",\n \"gta3.img/traintunnel1_sfse.txd/ws_tunnelwall1.dds\",\"gta3.img/cuntwland.txd/ws_tunnelwall1.dds\",\n \"gta3.img/vgndwntwn5.txd/ws_tunnelwall1.dds\",\"gta3.img/cuntwland.txd/ws_tunnelwall1.dds\",\n \"gta_int.img/sumostad.txd/plaintarmac1.dds\",\"gta3.img/cuntwlandwest.txd/plaintarmac1.dds\",\n \"gta3.img/des_bighus.txd/des_dirtgrassmixb.dds\",\"gta3.img/cuntwlandwest.txd/des_dirtgrassmixb.dds\",\n \"gta3.img/des_bighus.txd/des_dirtgrassmixc.dds\",\"gta3.img/cuntwlandwest.txd/des_dirtgrassmixc.dds\",\n \"gta3.img/dirtyoverlay.txd/cw2_mounttrailblank.dds\",\"gta3.img/cuntwlandwest.txd/cw2_mounttrailblank.dds\",\n \"gta3.img/docks2_las2.txd/mountainskree_stones256.dds\",\"gta3.img/cuntwlandwest.txd/mountainskree_stones256.dds\",\n \"gta3.img/docks_las2.txd/mountainskree_stones256.dds\",\"gta3.img/cuntwlandwest.txd/mountainskree_stones256.dds\",\n \"gta3.img/hub_sfse.txd/mountainskree_stones256.dds\",\"gta3.img/cuntwlandwest.txd/mountainskree_stones256.dds\",\n \"gta3.img/stormd_filllas2.txd/mountainskree_stones256.dds\",\"gta3.img/cuntwlandwest.txd/mountainskree_stones256.dds\",\n \"gta3.img/stormd_fill.txd/mountainskree_stones256.dds\",\"gta3.img/cuntwlandwest.txd/mountainskree_stones256.dds\",\n \"gta3.img/mountainsfs.txd/des_dirtgrassmix_grass4.dds\",\"gta3.img/cuntwlandwest.txd/des_dirtgrassmix_grass4.dds\",\n \"gta3.img/des_bighus.txd/des_dirtgrassmixbmp.dds\",\"gta3.img/cuntwlandwest.txd/des_dirtgrassmixbmp.dds\",\n \"gta3.img/des_s.txd/des_dirtgrassmixbmp.dds\",\"gta3.img/cuntwlandwest.txd/des_dirtgrassmixbmp.dds\",\n \"gta3.img/des_nstuff.txd/des_metalwinwee.dds\",\"gta3.img/cuntwrestcs_t.txd/des_metalwinwee.dds\",\n \"gta3.img/des_nwtownpolice.txd/des_metalwinwee.dds\",\"gta3.img/cuntwrestcs_t.txd/des_metalwinwee.dds\",\n \"gta3.img/melrose17_lawn.txd/shopdoor02_law.dds\",\"gta3.img/cuntwrestcs_t.txd/shopdoor02_law.dds\",\n \"gta3.img/shops2_law.txd/shopdoor02_law.dds\",\"gta3.img/cuntwrestcs_t.txd/shopdoor02_law.dds\",\n \"gta3.img/des_sw.txd/ws_drain_small.dds\",\"gta3.img/cuntwroad.txd/ws_drain_small.dds\",\n \"gta3.img/hotelback_sfs.txd/ws_drain_small.dds\",\"gta3.img/cuntwroad.txd/ws_drain_small.dds\",\n \"gta3.img/laeroads.txd/ws_drain_small.dds\",\"gta3.img/cuntwroad.txd/ws_drain_small.dds\",\n \"gta3.img/lanroad.txd/ws_drain_small.dds\",\"gta3.img/cuntwroad.txd/ws_drain_small.dds\",\n \"gta3.img/law2_roadsb.txd/ws_drain_small.dds\",\"gta3.img/cuntwroad.txd/ws_drain_small.dds\",\n \"gta3.img/roadlan2.txd/ws_drain_small.dds\",\"gta3.img/cuntwroad.txd/ws_drain_small.dds\",\n \"gta3.img/roadslahills.txd/ws_drain_small.dds\",\"gta3.img/cuntwroad.txd/ws_drain_small.dds\",\n \"gta3.img/roads_tunnellahills.txd/ws_drain_small.dds\",\"gta3.img/cuntwroad.txd/ws_drain_small.dds\",\n \"gta3.img/des_ne.txd/tar_lineslipway.dds\",\"gta3.img/cuntwroad.txd/tar_lineslipway.dds\",\n \"gta3.img/des_se4.txd/tar_lineslipway.dds\",\"gta3.img/cuntwroad.txd/tar_lineslipway.dds\",\n \"gta3.img/des_s.txd/tar_lineslipway.dds\",\"gta3.img/cuntwroad.txd/tar_lineslipway.dds\",\n \"gta3.img/des_sw.txd/tar_lineslipway.dds\",\"gta3.img/cuntwroad.txd/tar_lineslipway.dds\",\n \"gta3.img/des_stownmain2.txd/snpdwhit3.dds\",\"gta3.img/cuntwshopscs_t.txd/snpdwhit3.dds\",\n \"gta3.img/eastls1_lae2.txd/snpdwhit3.dds\",\"gta3.img/cuntwshopscs_t.txd/snpdwhit3.dds\",\n \"gta3.img/ground2_las2.txd/snpdwhit3.dds\",\"gta3.img/cuntwshopscs_t.txd/snpdwhit3.dds\",\n \"gta3.img/industry3_las2.txd/snpdwhit3.dds\",\"gta3.img/cuntwshopscs_t.txd/snpdwhit3.dds\",\n \"gta3.img/lae2newtempbx.txd/snpdwhit3.dds\",\"gta3.img/cuntwshopscs_t.txd/snpdwhit3.dds\",\n \"gta3.img/lanblokb.txd/snpdwhit3.dds\",\"gta3.img/cuntwshopscs_t.txd/snpdwhit3.dds\",\n \"gta3.img/lashops1b_las2.txd/snpdwhit3.dds\",\"gta3.img/cuntwshopscs_t.txd/snpdwhit3.dds\",\n \"gta3.img/lashops1_las2.txd/snpdwhit3.dds\",\"gta3.img/cuntwshopscs_t.txd/snpdwhit3.dds\",\n \"gta3.img/lashops93_las2.txd/snpdwhit3.dds\",\"gta3.img/cuntwshopscs_t.txd/snpdwhit3.dds\",\n \"gta3.img/sunrise01_lawn.txd/snpdwhit3.dds\",\"gta3.img/cuntwshopscs_t.txd/snpdwhit3.dds\",\n \"gta3.img/sunrise10_lawn.txd/snpdwhit3.dds\",\"gta3.img/cuntwshopscs_t.txd/snpdwhit3.dds\",\n \"gta3.img/vgnbball.txd/vgngewall1_256.dds\",\"gta3.img/cuntwshopscs_t.txd/vgngewall1_256.dds\",\n \"gta3.img/vgngebuild.txd/vgngewall1_256.dds\",\"gta3.img/cuntwshopscs_t.txd/vgngewall1_256.dds\",\n \"gta3.img/des_stownstrip2.txd/des_shopsigns1.dds\",\"gta3.img/cuntwshopscs_t.txd/des_shopsigns1.dds\",\n \"gta3.img/des_baitshop.txd/des_baitsign.dds\",\"gta3.img/cuntwshopscs_t.txd/des_baitsign.dds\",\n \"gta3.img/des_airfieldhus.txd/des_ntwnwin5.dds\",\"gta3.img/cuntwshopscs_t.txd/des_ntwnwin5.dds\",\n \"gta3.img/des_baitshop.txd/des_ntwnwin5.dds\",\"gta3.img/cuntwshopscs_t.txd/des_ntwnwin5.dds\",\n \"gta3.img/des_byoffice.txd/des_ntwnwin5.dds\",\"gta3.img/cuntwshopscs_t.txd/des_ntwnwin5.dds\",\n \"gta3.img/des_ntown.txd/des_ntwnwin5.dds\",\"gta3.img/cuntwshopscs_t.txd/des_ntwnwin5.dds\",\n \"gta3.img/sfn_office.txd/des_ntwnwin5.dds\",\"gta3.img/cuntwshopscs_t.txd/des_ntwnwin5.dds\",\n \"gta3.img/w_town3cs_t.txd/des_ntwnwin5.dds\",\"gta3.img/cuntwshopscs_t.txd/des_ntwnwin5.dds\",\n \"gta3.img/cxref_oldwest.txd/des_ntwnwin2.dds\",\"gta3.img/cuntwshopscs_t.txd/des_ntwnwin2.dds\",\n \"gta3.img/cxref_savhus.txd/des_ntwnwin2.dds\",\"gta3.img/cuntwshopscs_t.txd/des_ntwnwin2.dds\",\n \"gta3.img/des_baitshop.txd/des_ntwnwin2.dds\",\"gta3.img/cuntwshopscs_t.txd/des_ntwnwin2.dds\",\n \"gta3.img/des_farmstuff.txd/des_ntwnwin2.dds\",\"gta3.img/cuntwshopscs_t.txd/des_ntwnwin2.dds\",\n \"gta3.img/des_nstuff.txd/des_ntwnwin2.dds\",\"gta3.img/cuntwshopscs_t.txd/des_ntwnwin2.dds\",\n \"gta3.img/oldwest.txd/des_ntwnwin2.dds\",\"gta3.img/cuntwshopscs_t.txd/des_ntwnwin2.dds\",\n \"gta3.img/sw_smlfarm.txd/des_ntwnwin2.dds\",\"gta3.img/cuntwshopscs_t.txd/des_ntwnwin2.dds\",\n \"gta3.img/cxref_oldwest.txd/des_adobedoor3.dds\",\"gta3.img/cuntwshopscs_t.txd/des_adobedoor3.dds\",\n \"gta3.img/cxref_savhus.txd/des_adobedoor3.dds\",\"gta3.img/cuntwshopscs_t.txd/des_adobedoor3.dds\",\n \"gta3.img/des_baitshop.txd/des_adobedoor3.dds\",\"gta3.img/cuntwshopscs_t.txd/des_adobedoor3.dds\",\n \"gta3.img/des_clifftown.txd/des_adobedoor3.dds\",\"gta3.img/cuntwshopscs_t.txd/des_adobedoor3.dds\",\n \"gta3.img/des_farmstuff.txd/des_adobedoor3.dds\",\"gta3.img/cuntwshopscs_t.txd/des_adobedoor3.dds\",\n \"gta3.img/desn2_minestuff.txd/des_adobedoor3.dds\",\"gta3.img/cuntwshopscs_t.txd/des_adobedoor3.dds\",\n \"gta3.img/des_pueblo.txd/des_adobedoor3.dds\",\"gta3.img/cuntwshopscs_t.txd/des_adobedoor3.dds\",\n \"gta3.img/des_quarrybelts.txd/des_adobedoor3.dds\",\"gta3.img/cuntwshopscs_t.txd/des_adobedoor3.dds\",\n \"gta3.img/oldwest.txd/des_adobedoor3.dds\",\"gta3.img/cuntwshopscs_t.txd/des_adobedoor3.dds\",\n \"gta3.img/sw_smlfarm.txd/des_adobedoor3.dds\",\"gta3.img/cuntwshopscs_t.txd/des_adobedoor3.dds\",\n \"gta3.img/cxref_oldwest.txd/des_oldtinroof.dds\",\"gta3.img/cuntwshopscs_t.txd/des_oldtinroof.dds\",\n \"gta3.img/des_baitshop.txd/des_oldtinroof.dds\",\"gta3.img/cuntwshopscs_t.txd/des_oldtinroof.dds\",\n \"gta3.img/des_boneyard.txd/des_oldtinroof.dds\",\"gta3.img/cuntwshopscs_t.txd/des_oldtinroof.dds\",\n \"gta3.img/des_farmstuff.txd/des_oldtinroof.dds\",\"gta3.img/cuntwshopscs_t.txd/des_oldtinroof.dds\",\n \"gta3.img/des_nstuff.txd/des_oldtinroof.dds\",\"gta3.img/cuntwshopscs_t.txd/des_oldtinroof.dds\",\n \"gta3.img/des_quarrybelts.txd/des_oldtinroof.dds\",\"gta3.img/cuntwshopscs_t.txd/des_oldtinroof.dds\",\n \"gta3.img/oldwest.txd/des_oldtinroof.dds\",\"gta3.img/cuntwshopscs_t.txd/des_oldtinroof.dds\",\n \"gta3.img/des_baitshop.txd/des_baitshop.dds\",\"gta3.img/cuntwshopscs_t.txd/des_baitshop.dds\",\n \"gta_int.img/kbeer.txd/bottles_kb1.dds\",\"gta3.img/cut_beer.txd/bottles_kb1.dds\",\n \"gta3.img/sw_block12.txd/sw_storewin03.dds\",\"gta3.img/cw2_cinemablockcs_t.txd/sw_storewin03.dds\",\n \"gta3.img/desn_decocafe.txd/corporate2.dds\",\"gta3.img/cw2_cinemablockcs_t.txd/corporate2.dds\",\n \"gta3.img/dingbat01_la.txd/corporate2.dds\",\"gta3.img/cw2_cinemablockcs_t.txd/corporate2.dds\",\n \"gta3.img/rodeo01_law2.txd/corporate2.dds\",\"gta3.img/cw2_cinemablockcs_t.txd/corporate2.dds\",\n \"gta3.img/sunrise02_lawn.txd/corporate2.dds\",\"gta3.img/cw2_cinemablockcs_t.txd/corporate2.dds\",\n \"gta3.img/eastshops1_lae.txd/laglaswall1.dds\",\"gta3.img/cw2_cinemablockcs_t.txd/laglaswall1.dds\",\n \"gta3.img/fort_sfw.txd/laglaswall1.dds\",\"gta3.img/cw2_cinemablockcs_t.txd/laglaswall1.dds\",\n \"gta3.img/vgssland01.txd/laglaswall1.dds\",\"gta3.img/cw2_cinemablockcs_t.txd/laglaswall1.dds\",\n \"gta3.img/vgsswarhse04.txd/laglaswall1.dds\",\"gta3.img/cw2_cinemablockcs_t.txd/laglaswall1.dds\",\n \"gta3.img/donut_sfw.txd/pcut_band_law.dds\",\"gta3.img/cw2_cinemablockcs_t.txd/pcut_band_law.dds\",\n \"gta3.img/shops2_law.txd/pcut_band_law.dds\",\"gta3.img/cw2_cinemablockcs_t.txd/pcut_band_law.dds\",\n \"gta3.img/sfn_caravansfn.txd/trail_win3.dds\",\"gta3.img/cw2_logcabins.txd/trail_win3.dds\",\n \"gta3.img/trailers.txd/trail_win3.dds\",\"gta3.img/cw2_logcabins.txd/trail_win3.dds\",\n \"gta3.img/cw_truckstopcs_t.txd/cw2_logwall.dds\",\"gta3.img/cw2_logcabins.txd/cw2_logwall.dds\",\n \"gta3.img/desn_truckstop.txd/cw2_logwall.dds\",\"gta3.img/cw2_logcabins.txd/cw2_logwall.dds\",\n \"gta3.img/cwsbarn.txd/sw_cabinroof.dds\",\"gta3.img/cw2_logcabins.txd/sw_cabinroof.dds\",\n \"gta3.img/desn2_minestuff.txd/sw_cabinroof.dds\",\"gta3.img/cw2_logcabins.txd/sw_cabinroof.dds\",\n \"gta3.img/sw_oldshack.txd/sw_cabinroof.dds\",\"gta3.img/cw2_logcabins.txd/sw_cabinroof.dds\",\n \"gta3.img/des_stownstrip2.txd/cw_loansign.dds\",\"gta3.img/cw2_photoblockcs_t.txd/cw_loansign.dds\",\n \"gta3.img/cw_landnorth.txd/sw_wallbrick_04.dds\",\"gta3.img/cw2_photoblockcs_t.txd/sw_wallbrick_04.dds\",\n \"gta3.img/sw_block03.txd/sw_wallbrick_04.dds\",\"gta3.img/cw2_photoblockcs_t.txd/sw_wallbrick_04.dds\",\n \"gta3.img/sw_block05.txd/sw_wallbrick_04.dds\",\"gta3.img/cw2_photoblockcs_t.txd/sw_wallbrick_04.dds\",\n \"gta3.img/vegashse6.txd/sw_wallbrick_04.dds\",\"gta3.img/cw2_photoblockcs_t.txd/sw_wallbrick_04.dds\",\n \"gta3.img/des_wgarage.txd/comptdoor4.dds\",\"gta3.img/cw2_storesnstuff.txd/comptdoor4.dds\",\n \"gta3.img/dts_bbx.txd/comptdoor4.dds\",\"gta3.img/cw2_storesnstuff.txd/comptdoor4.dds\",\n \"gta3.img/lanbloke.txd/comptdoor4.dds\",\"gta3.img/cw2_storesnstuff.txd/comptdoor4.dds\",\n \"gta3.img/stationsfse_1.txd/comptdoor4.dds\",\"gta3.img/cw2_storesnstuff.txd/comptdoor4.dds\",\n \"gta3.img/station_sfse.txd/comptdoor4.dds\",\"gta3.img/cw2_storesnstuff.txd/comptdoor4.dds\",\n \"gta3.img/sw_apartflat5.txd/comptdoor4.dds\",\"gta3.img/cw2_storesnstuff.txd/comptdoor4.dds\",\n \"gta3.img/sw_apartflat.txd/comptdoor4.dds\",\"gta3.img/cw2_storesnstuff.txd/comptdoor4.dds\",\n \"gta3.img/sw_apartflatx.txd/comptdoor4.dds\",\"gta3.img/cw2_storesnstuff.txd/comptdoor4.dds\",\n \"gta3.img/sw_apartments.txd/comptdoor4.dds\",\"gta3.img/cw2_storesnstuff.txd/comptdoor4.dds\",\n \"gta3.img/sw_diner1.txd/comptdoor4.dds\",\"gta3.img/cw2_storesnstuff.txd/comptdoor4.dds\",\n \"gta3.img/sw_doors.txd/comptdoor4.dds\",\"gta3.img/cw2_storesnstuff.txd/comptdoor4.dds\",\n \"gta3.img/vgncircir.txd/comptdoor4.dds\",\"gta3.img/cw2_storesnstuff.txd/comptdoor4.dds\",\n \"gta3.img/xre_petdoor.txd/comptdoor4.dds\",\"gta3.img/cw2_storesnstuff.txd/comptdoor4.dds\",\n \"gta3.img/cw_truckstopcs_t.txd/des_garagedoor1.dds\",\"gta3.img/cw2_storesnstuff.txd/des_garagedoor1.dds\",\n \"gta3.img/des_nstuff.txd/des_garagedoor1.dds\",\"gta3.img/cw2_storesnstuff.txd/des_garagedoor1.dds\",\n \"gta3.img/des_nwtownw.txd/des_garagedoor1.dds\",\"gta3.img/cw2_storesnstuff.txd/des_garagedoor1.dds\",\n \"gta3.img/des_stownstrip1.txd/des_garagedoor1.dds\",\"gta3.img/cw2_storesnstuff.txd/des_garagedoor1.dds\",\n \"gta3.img/des_wgarage.txd/des_garagedoor1.dds\",\"gta3.img/cw2_storesnstuff.txd/des_garagedoor1.dds\",\n \"gta3.img/des_wtownmain.txd/des_garagedoor1.dds\",\"gta3.img/cw2_storesnstuff.txd/des_garagedoor1.dds\",\n \"gta3.img/des_stownmots1.txd/latranswall1.dds\",\"gta3.img/cw2_storesnstuff.txd/latranswall1.dds\",\n \"gta3.img/des_wgarage.txd/latranswall1.dds\",\"gta3.img/cw2_storesnstuff.txd/latranswall1.dds\",\n \"gta3.img/eastshops1_lae.txd/latranswall1.dds\",\"gta3.img/cw2_storesnstuff.txd/latranswall1.dds\",\n \"gta3.img/ottos_sfw.txd/latranswall1.dds\",\"gta3.img/cw2_storesnstuff.txd/latranswall1.dds\",\n \"gta3.img/pirateship01.txd/latranswall1.dds\",\"gta3.img/cw2_storesnstuff.txd/latranswall1.dds\",\n \"gta3.img/sw_apartflat.txd/latranswall1.dds\",\"gta3.img/cw2_storesnstuff.txd/latranswall1.dds\",\n \"gta3.img/sw_apartflatx.txd/latranswall1.dds\",\"gta3.img/cw2_storesnstuff.txd/latranswall1.dds\",\n \"gta3.img/mtbfencecs_t.txd/plasfence2_256.dds\",\"gta3.img/cw_changemecs_t.txd/plasfence2_256.dds\",\n \"gta3.img/mtbfencecs_t.txd/plasfence1_256.dds\",\"gta3.img/cw_changemecs_t.txd/plasfence1_256.dds\",\n \"gta3.img/vgnfrates.txd/vnghse6_128.dds\",\"gta3.img/cwestfac.txd/vnghse6_128.dds\",\n \"gta3.img/vgnretail2.txd/vnghse6_128.dds\",\"gta3.img/cwestfac.txd/vnghse6_128.dds\",\n \"gta3.img/vgnshopnmall.txd/vnghse6_128.dds\",\"gta3.img/cwestfac.txd/vnghse6_128.dds\",\n \"gta3.img/vgsewrehse.txd/vnghse6_128.dds\",\"gta3.img/cwestfac.txd/vnghse6_128.dds\",\n \"gta3.img/vgsswrehse03.txd/vnghse6_128.dds\",\"gta3.img/cwestfac.txd/vnghse6_128.dds\",\n \"gta3.img/vgnfrates.txd/vgnwrehse4_256.dds\",\"gta3.img/cwestfac.txd/vgnwrehse4_256.dds\",\n \"gta3.img/vgnretail2.txd/vgnwrehse4_256.dds\",\"gta3.img/cwestfac.txd/vgnwrehse4_256.dds\",\n \"gta3.img/vgsewrehse.txd/vgnwrehse4_256.dds\",\"gta3.img/cwestfac.txd/vgnwrehse4_256.dds\",\n \"gta3.img/vgsswrehse03.txd/vgnwrehse4_256.dds\",\"gta3.img/cwestfac.txd/vgnwrehse4_256.dds\",\n \"gta3.img/vgnfrates.txd/vgnwrehse2_256.dds\",\"gta3.img/cwestfac.txd/vgnwrehse2_256.dds\",\n \"gta3.img/vgnshopnmall.txd/vgnwrehse2_256.dds\",\"gta3.img/cwestfac.txd/vgnwrehse2_256.dds\",\n \"gta3.img/vgsewrehse.txd/vgnwrehse2_256.dds\",\"gta3.img/cwestfac.txd/vgnwrehse2_256.dds\",\n \"gta3.img/vgsswrehse03.txd/vgnwrehse2_256.dds\",\"gta3.img/cwestfac.txd/vgnwrehse2_256.dds\",\n \"gta3.img/vgnfrates.txd/vgnwrehse3_256.dds\",\"gta3.img/cwestfac.txd/vgnwrehse3_256.dds\",\n \"gta3.img/vgnretail2.txd/vgnwrehse3_256.dds\",\"gta3.img/cwestfac.txd/vgnwrehse3_256.dds\",\n \"gta3.img/vgnshopnmall.txd/vgnwrehse3_256.dds\",\"gta3.img/cwestfac.txd/vgnwrehse3_256.dds\",\n \"gta3.img/vgsewrehse.txd/vgnwrehse3_256.dds\",\"gta3.img/cwestfac.txd/vgnwrehse3_256.dds\",\n \"gta3.img/vgsswrehse03.txd/vgnwrehse3_256.dds\",\"gta3.img/cwestfac.txd/vgnwrehse3_256.dds\",\n \"gta3.img/motel_lae.txd/bow_abpave_gen.dds\",\"gta3.img/cw_farm.txd/bow_abpave_gen.dds\",\n \"gta3.img/dynbarrels.txd/barrel_64hv.dds\",\"gta3.img/cw_farm.txd/barrel_64hv.dds\",\n \"gta3.img/helimagnet.txd/barrel_64hv.dds\",\"gta3.img/cw_farm.txd/barrel_64hv.dds\",\n \"gta_int.img/ab_vegasgymmain.txd/barrel_64hv.dds\",\"gta3.img/cw_farm.txd/barrel_64hv.dds\",\n \"gta_int.img/kickstart.txd/barrel_64hv.dds\",\"gta3.img/cw_farm.txd/barrel_64hv.dds\",\n \"gta3.img/cw_junkyard2cs_t.txd/was_scrpyd_shack_wall.dds\",\"gta3.img/cw_junkbuildcs_t.txd/was_scrpyd_shack_wall.dds\",\n \"gta3.img/cw_junkyardcs_t.txd/was_scrpyd_shack_wall.dds\",\"gta3.img/cw_junkbuildcs_t.txd/was_scrpyd_shack_wall.dds\",\n \"gta3.img/cw_junkyard2cs_t.txd/was_scrpyd_shack_win.dds\",\"gta3.img/cw_junkbuildcs_t.txd/was_scrpyd_shack_win.dds\",\n \"gta3.img/cw_junkyard2cs_t.txd/was_scrpyd_shack.dds\",\"gta3.img/cw_junkbuildcs_t.txd/was_scrpyd_shack.dds\",\n \"gta3.img/cw_junkyardccs_t.txd/was_graffiti.dds\",\"gta3.img/cw_junkbuildcs_t.txd/was_graffiti.dds\",\n \"gta3.img/cw_junkyarddigcs_t.txd/was_graffiti.dds\",\"gta3.img/cw_junkbuildcs_t.txd/was_graffiti.dds\",\n \"gta3.img/cw_junkyarddigcs_t.txd/was_scrpyd_rustmetal.dds\",\"gta3.img/cw_junkbuildcs_t.txd/was_scrpyd_rustmetal.dds\",\n \"gta3.img/cw_junkyard2cs_t.txd/was_scrpyd_fence_wd_stain.dds\",\"gta3.img/cw_junkbuildcs_t.txd/was_scrpyd_fence_wd_stain.dds\",\n \"gta3.img/cw_junkyard2cs_t.txd/was_scrpyd_wall_crgated.dds\",\"gta3.img/cw_junkbuildcs_t.txd/was_scrpyd_wall_crgated.dds\",\n \"gta3.img/cw_junkyardmachin.txd/was_scrpyd_baler_wallgrime.dds\",\"gta3.img/cw_junkbuildcs_t.txd/was_scrpyd_baler_wallgrime.dds\",\n \"gta3.img/cw_junkyardmachin.txd/was_scrpyd_switch.dds\",\"gta3.img/cw_junkbuildcs_t.txd/was_scrpyd_switch.dds\",\n \"gta3.img/cw_junkyardmachin.txd/was_scrpyd_baler_locker.dds\",\"gta3.img/cw_junkbuildcs_t.txd/was_scrpyd_baler_locker.dds\",\n \"gta3.img/sw_block10.txd/was_scrpyd_door_dbl_grey.dds\",\"gta3.img/cw_junkyard2cs_t.txd/was_scrpyd_door_dbl_grey.dds\",\n \"gta3.img/cw_junkyardmachin.txd/was_scrpyd_step.dds\",\"gta3.img/cw_junkyarddigcs_t.txd/was_scrpyd_step.dds\",\n \"gta3.img/cw_motel2cs_t.txd/des_motelsigns1.dds\",\"gta3.img/cw_motel1.txd/des_motelsigns1.dds\",\n \"gta3.img/des_nstuff.txd/des_motelsigns1.dds\",\"gta3.img/cw_motel1.txd/des_motelsigns1.dds\",\n \"gta3.img/des_southtown.txd/des_motelsigns1.dds\",\"gta3.img/cw_motel1.txd/des_motelsigns1.dds\",\n \"gta3.img/des_stownstrip1.txd/des_motelsigns1.dds\",\"gta3.img/cw_motel1.txd/des_motelsigns1.dds\",\n \"gta3.img/des_stownstrip1.txd/des_motelsigns3.dds\",\"gta3.img/cw_motel1.txd/des_motelsigns3.dds\",\n \"gta3.img/des_stownstrip1.txd/des_motelwall5.dds\",\"gta3.img/cw_motel1.txd/des_motelwall5.dds\",\n \"gta3.img/des_stownstrip1.txd/des_motelwall4.dds\",\"gta3.img/cw_motel1.txd/des_motelwall4.dds\",\n \"gta3.img/des_nstuff.txd/des_motelsigns2.dds\",\"gta3.img/cw_motel2cs_t.txd/des_motelsigns2.dds\",\n \"gta3.img/des_southtown.txd/des_motelsigns2.dds\",\"gta3.img/cw_motel2cs_t.txd/des_motelsigns2.dds\",\n \"gta3.img/des_stownmots1.txd/des_motelsigns2.dds\",\"gta3.img/cw_motel2cs_t.txd/des_motelsigns2.dds\",\n \"gta3.img/des_stownstrip1.txd/des_motelsigns2.dds\",\"gta3.img/cw_motel2cs_t.txd/des_motelsigns2.dds\",\n \"gta3.img/des_nstuff.txd/des_motelwall1.dds\",\"gta3.img/cw_motel2cs_t.txd/des_motelwall1.dds\",\n \"gta3.img/des_stownmots1.txd/des_motelwall1.dds\",\"gta3.img/cw_motel2cs_t.txd/des_motelwall1.dds\",\n \"gta3.img/des_stownstrip1.txd/des_motelwall1.dds\",\"gta3.img/cw_motel2cs_t.txd/des_motelwall1.dds\",\n \"gta3.img/des_nstuff.txd/des_motelwall2.dds\",\"gta3.img/cw_motel2cs_t.txd/des_motelwall2.dds\",\n \"gta3.img/des_stownmots1.txd/des_motelwall2.dds\",\"gta3.img/cw_motel2cs_t.txd/des_motelwall2.dds\",\n \"gta3.img/des_stownstrip1.txd/des_motelwall2.dds\",\"gta3.img/cw_motel2cs_t.txd/des_motelwall2.dds\",\n \"gta3.img/des_nstuff.txd/des_motelwall3.dds\",\"gta3.img/cw_motel2cs_t.txd/des_motelwall3.dds\",\n \"gta3.img/des_stownmots1.txd/des_motelwall3.dds\",\"gta3.img/cw_motel2cs_t.txd/des_motelwall3.dds\",\n \"gta3.img/des_stownstrip1.txd/des_motelwall3.dds\",\"gta3.img/cw_motel2cs_t.txd/des_motelwall3.dds\",\n \"gta3.img/genroofbits.txd/aroofbit1.dds\",\"gta3.img/cw_roofbitcs_t.txd/aroofbit1.dds\",\n \"gta3.img/genroofbits.txd/aroofbit4.dds\",\"gta3.img/cw_roofbitcs_t.txd/aroofbit4.dds\",\n \"gta3.img/genroofbits.txd/aroofbit2.dds\",\"gta3.img/cw_roofbitcs_t.txd/aroofbit2.dds\",\n \"gta3.img/genroofbits.txd/aroofbit3.dds\",\"gta3.img/cw_roofbitcs_t.txd/aroofbit3.dds\",\n \"gta3.img/genroofbits.txd/aroofbit5.dds\",\"gta3.img/cw_roofbitcs_t.txd/aroofbit5.dds\",\n \"gta3.img/genroofbits.txd/aroofbit6.dds\",\"gta3.img/cw_roofbitcs_t.txd/aroofbit6.dds\",\n \"gta3.img/genroofbits.txd/aroofbit7.dds\",\"gta3.img/cw_roofbitcs_t.txd/aroofbit7.dds\",\n \"gta3.img/genroofbits.txd/aroofbit8.dds\",\"gta3.img/cw_roofbitcs_t.txd/aroofbit8.dds\",\n \"gta3.img/genroofbits.txd/aroofbit9.dds\",\"gta3.img/cw_roofbitcs_t.txd/aroofbit9.dds\",\n \"gta3.img/genroofbits.txd/aroofbit91.dds\",\"gta3.img/cw_roofbitcs_t.txd/aroofbit91.dds\",\n \"gta3.img/cxref_savhus.txd/des_bullboards.dds\",\"gta3.img/cwsbarn.txd/des_bullboards.dds\",\n \"gta3.img/des_steakhouse.txd/des_bullboards.dds\",\"gta3.img/cwsbarn.txd/des_bullboards.dds\",\n \"gta3.img/des_ranch.txd/des_ranchwall2.dds\",\"gta3.img/cwsbarn.txd/des_ranchwall2.dds\",\n \"gta3.img/des_stownmain2.txd/des_redslats.dds\",\"gta3.img/cwsbarn.txd/des_redslats.dds\",\n \"gta3.img/des_stownmots1.txd/des_redslats.dds\",\"gta3.img/cwsbarn.txd/des_redslats.dds\",\n \"gta3.img/des_geyser.txd/des_metaldoor1.dds\",\"gta3.img/cw_tempstuffcs_t.txd/des_metaldoor1.dds\",\n \"gta3.img/des_nstuff.txd/des_metaldoor1.dds\",\"gta3.img/cw_tempstuffcs_t.txd/des_metaldoor1.dds\",\n \"gta3.img/des_ntown.txd/des_metaldoor1.dds\",\"gta3.img/cw_tempstuffcs_t.txd/des_metaldoor1.dds\",\n \"gta3.img/des_nwtownpolice.txd/des_metaldoor1.dds\",\"gta3.img/cw_tempstuffcs_t.txd/des_metaldoor1.dds\",\n \"gta3.img/des_dinerw.txd/bluemetal03.dds\",\"gta3.img/cw_tempstuffcs_t.txd/bluemetal03.dds\",\n \"gta3.img/des_stownmots1.txd/bluemetal03.dds\",\"gta3.img/cw_tempstuffcs_t.txd/bluemetal03.dds\",\n \"gta3.img/dockcargo1_las.txd/bluemetal03.dds\",\"gta3.img/cw_tempstuffcs_t.txd/bluemetal03.dds\",\n \"gta3.img/factorycuntw.txd/bluemetal03.dds\",\"gta3.img/cw_tempstuffcs_t.txd/bluemetal03.dds\",\n \"gta3.img/ground3_las2.txd/bluemetal03.dds\",\"gta3.img/cw_tempstuffcs_t.txd/bluemetal03.dds\",\n \"gta3.img/imrancomp_las2.txd/bluemetal03.dds\",\"gta3.img/cw_tempstuffcs_t.txd/bluemetal03.dds\",\n \"gta3.img/lanbloke.txd/bluemetal03.dds\",\"gta3.img/cw_tempstuffcs_t.txd/bluemetal03.dds\",\n \"gta3.img/lanriver.txd/bluemetal03.dds\",\"gta3.img/cw_tempstuffcs_t.txd/bluemetal03.dds\",\n \"gta3.img/lasxrefdock.txd/bluemetal03.dds\",\"gta3.img/cw_tempstuffcs_t.txd/bluemetal03.dds\",\n \"gta3.img/union_las.txd/bluemetal03.dds\",\"gta3.img/cw_tempstuffcs_t.txd/bluemetal03.dds\",\n \"gta3.img/vgnpwrmainbld.txd/bluemetal03.dds\",\"gta3.img/cw_tempstuffcs_t.txd/bluemetal03.dds\",\n \"gta3.img/vgnpwroutbld1.txd/bluemetal03.dds\",\"gta3.img/cw_tempstuffcs_t.txd/bluemetal03.dds\",\n \"gta_int.img/genintwarehsint3.txd/bluemetal03.dds\",\"gta3.img/cw_tempstuffcs_t.txd/bluemetal03.dds\",\n \"gta3.img/desn2_truckstop.txd/wlinebits_law.dds\",\"gta3.img/cw_truckstopcs_t.txd/wlinebits_law.dds\",\n \"gta3.img/desn_truckstop.txd/wlinebits_law.dds\",\"gta3.img/cw_truckstopcs_t.txd/wlinebits_law.dds\",\n \"gta3.img/studio01_lawn.txd/wlinebits_law.dds\",\"gta3.img/cw_truckstopcs_t.txd/wlinebits_law.dds\",\n \"gta3.img/lomall.txd/ws_xenon_old_dirty.dds\",\"gta3.img/cw_truckstopcs_t.txd/ws_xenon_old_dirty.dds\",\n \"gta3.img/cxref_oldwest.txd/des_adobewall3.dds\",\"gta3.img/cw_truckstopcs_t.txd/des_adobewall3.dds\",\n \"gta3.img/des_clifftown.txd/des_adobewall3.dds\",\"gta3.img/cw_truckstopcs_t.txd/des_adobewall3.dds\",\n \"gta3.img/desn_truckstop.txd/des_adobewall3.dds\",\"gta3.img/cw_truckstopcs_t.txd/des_adobewall3.dds\",\n \"gta3.img/des_pueblo.txd/des_adobewall3.dds\",\"gta3.img/cw_truckstopcs_t.txd/des_adobewall3.dds\",\n \"gta3.img/oldwest.txd/des_adobewall3.dds\",\"gta3.img/cw_truckstopcs_t.txd/des_adobewall3.dds\",\n \"gta3.img/cxref_desert.txd/des_wigwamdoor.dds\",\"gta3.img/cw_truckstopcs_t.txd/des_wigwamdoor.dds\",\n \"gta3.img/des_clifftown.txd/des_wigwamdoor.dds\",\"gta3.img/cw_truckstopcs_t.txd/des_wigwamdoor.dds\",\n \"gta3.img/des_nstuff.txd/des_wigwamdoor.dds\",\"gta3.img/cw_truckstopcs_t.txd/des_wigwamdoor.dds\",\n \"gta3.img/desn_teepee.txd/des_wigwamdoor.dds\",\"gta3.img/cw_truckstopcs_t.txd/des_wigwamdoor.dds\",\n \"gta3.img/des_nwtownw.txd/des_wigwamdoor.dds\",\"gta3.img/cw_truckstopcs_t.txd/des_wigwamdoor.dds\",\n \"gta3.img/des_teepee.txd/des_wigwamdoor.dds\",\"gta3.img/cw_truckstopcs_t.txd/des_wigwamdoor.dds\",\n \"gta3.img/des_geyser.txd/des_roswin3.dds\",\"gta3.img/cw_truckstopcs_t.txd/des_roswin3.dds\",\n \"gta3.img/des_nstuff.txd/des_roswin3.dds\",\"gta3.img/cw_truckstopcs_t.txd/des_roswin3.dds\",\n \"gta3.img/des_nwtownpolice.txd/des_roswin3.dds\",\"gta3.img/cw_truckstopcs_t.txd/des_roswin3.dds\",\n \"gta3.img/des_nwtownw.txd/des_roswin3.dds\",\"gta3.img/cw_truckstopcs_t.txd/des_roswin3.dds\",\n \"gta3.img/des_wtownmain.txd/des_roswin3.dds\",\"gta3.img/cw_truckstopcs_t.txd/des_roswin3.dds\",\n \"gta3.img/laesmokecnthus.txd/pierplanks_128.dds\",\"gta3.img/cxref_desert.txd/pierplanks_128.dds\",\n \"gta3.img/pierb_law2.txd/pierplanks_128.dds\",\"gta3.img/cxref_desert.txd/pierplanks_128.dds\",\n \"gta3.img/pierc_law2.txd/pierplanks_128.dds\",\"gta3.img/cxref_desert.txd/pierplanks_128.dds\",\n \"gta3.img/santamonicalaw2.txd/pierplanks_128.dds\",\"gta3.img/cxref_desert.txd/pierplanks_128.dds\",\n \"gta3.img/sw_block03.txd/sw_woodslat01.dds\",\"gta3.img/cxref_desert.txd/sw_woodslat01.dds\",\n \"gta3.img/sw_shack2.txd/sw_woodslat01.dds\",\"gta3.img/cxref_desert.txd/sw_woodslat01.dds\",\n \"gta3.img/cxref_savhus.txd/des_bywall1.dds\",\"gta3.img/cxref_desert.txd/des_bywall1.dds\",\n \"gta3.img/des_byoffice.txd/des_bywall1.dds\",\"gta3.img/cxref_desert.txd/des_bywall1.dds\",\n \"gta3.img/des_damquay.txd/des_bywall1.dds\",\"gta3.img/cxref_desert.txd/des_bywall1.dds\",\n \"gta3.img/jeffers5a_lae.txd/grilldoors1nt.dds\",\"gta3.img/cxref_desert.txd/grilldoors1nt.dds\",\n \"gta3.img/cxrf_payspray.txd/sw_cabwin01.dds\",\"gta3.img/cxref_desert.txd/sw_cabwin01.dds\",\n \"gta3.img/sw_oldshack.txd/sw_cabwin01.dds\",\"gta3.img/cxref_desert.txd/sw_cabwin01.dds\",\n \"gta3.img/cxrf_indstuff.txd/des_rustpanel.dds\",\"gta3.img/cxref_desert.txd/des_rustpanel.dds\",\n \"gta3.img/des_damquay.txd/des_rustpanel.dds\",\"gta3.img/cxref_desert.txd/des_rustpanel.dds\",\n \"gta3.img/dyn_objects.txd/cj_chromepipe.dds\",\"gta3.img/cxref_desert.txd/cj_chromepipe.dds\",\n \"gta3.img/externalext.txd/cj_chromepipe.dds\",\"gta3.img/cxref_desert.txd/cj_chromepipe.dds\",\n \"gta3.img/freightcrane.txd/cj_chromepipe.dds\",\"gta3.img/cxref_desert.txd/cj_chromepipe.dds\",\n \"gta3.img/industrialext.txd/cj_chromepipe.dds\",\"gta3.img/cxref_desert.txd/cj_chromepipe.dds\",\n \"gta3.img/magnetx.txd/cj_chromepipe.dds\",\"gta3.img/cxref_desert.txd/cj_chromepipe.dds\",\n \"gta3.img/totoie.txd/cj_chromepipe.dds\",\"gta3.img/cxref_desert.txd/cj_chromepipe.dds\",\n \"gta_int.img/airp_prop.txd/cj_chromepipe.dds\",\"gta3.img/cxref_desert.txd/cj_chromepipe.dds\",\n \"gta_int.img/carter_block.txd/cj_chromepipe.dds\",\"gta3.img/cxref_desert.txd/cj_chromepipe.dds\",\n \"gta_int.img/cj_anim.txd/cj_chromepipe.dds\",\"gta3.img/cxref_desert.txd/cj_chromepipe.dds\",\n \"gta_int.img/cj_bathroom.txd/cj_chromepipe.dds\",\"gta3.img/cxref_desert.txd/cj_chromepipe.dds\",\n \"gta_int.img/cj_binc.txd/cj_chromepipe.dds\",\"gta3.img/cxref_desert.txd/cj_chromepipe.dds\",\n \"gta_int.img/cj_bs_bathroom.txd/cj_chromepipe.dds\",\"gta3.img/cxref_desert.txd/cj_chromepipe.dds\",\n \"gta_int.img/cj_ds_door.txd/cj_chromepipe.dds\",\"gta3.img/cxref_desert.txd/cj_chromepipe.dds\",\n \"gta_int.img/cj_exp.txd/cj_chromepipe.dds\",\"gta3.img/cxref_desert.txd/cj_chromepipe.dds\",\n \"gta_int.img/cj_ff_acc1.txd/cj_chromepipe.dds\",\"gta3.img/cxref_desert.txd/cj_chromepipe.dds\",\n \"gta_int.img/cj_ff_counters.txd/cj_chromepipe.dds\",\"gta3.img/cxref_desert.txd/cj_chromepipe.dds\",\n \"gta_int.img/cj_gash.txd/cj_chromepipe.dds\",\"gta3.img/cxref_desert.txd/cj_chromepipe.dds\",\n \"gta_int.img/cj_hair.txd/cj_chromepipe.dds\",\"gta3.img/cxref_desert.txd/cj_chromepipe.dds\",\n \"gta_int.img/cj_lighting.txd/cj_chromepipe.dds\",\"gta3.img/cxref_desert.txd/cj_chromepipe.dds\",\n \"gta_int.img/cj_pro.txd/cj_chromepipe.dds\",\"gta3.img/cxref_desert.txd/cj_chromepipe.dds\",\n \"gta_int.img/cj_urb.txd/cj_chromepipe.dds\",\"gta3.img/cxref_desert.txd/cj_chromepipe.dds\",\n \"gta_int.img/cj_vic.txd/cj_chromepipe.dds\",\"gta3.img/cxref_desert.txd/cj_chromepipe.dds\",\n \"gta_int.img/cloth_trackies.txd/cj_chromepipe.dds\",\"gta3.img/cxref_desert.txd/cj_chromepipe.dds\",\n \"gta_int.img/cloth_track_t.txd/cj_chromepipe.dds\",\"gta3.img/cxref_desert.txd/cj_chromepipe.dds\",\n \"gta_int.img/genhotelsave.txd/cj_chromepipe.dds\",\"gta3.img/cxref_desert.txd/cj_chromepipe.dds\",\n \"gta_int.img/genintclothessport.txd/cj_chromepipe.dds\",\"gta3.img/cxref_desert.txd/cj_chromepipe.dds\",\n \"gta_int.img/newcrak.txd/cj_chromepipe.dds\",\"gta3.img/cxref_desert.txd/cj_chromepipe.dds\",\n \"gta_int.img/sfhss2.txd/cj_chromepipe.dds\",\"gta3.img/cxref_desert.txd/cj_chromepipe.dds\",\n \"gta_int.img/shopping.txd/cj_chromepipe.dds\",\"gta3.img/cxref_desert.txd/cj_chromepipe.dds\",\n \"gta_int.img/skate_shop.txd/cj_chromepipe.dds\",\"gta3.img/cxref_desert.txd/cj_chromepipe.dds\",\n \"gta_int.img/smallsfhs.txd/cj_chromepipe.dds\",\"gta3.img/cxref_desert.txd/cj_chromepipe.dds\",\n \"gta_int.img/svcunthoose.txd/cj_chromepipe.dds\",\"gta3.img/cxref_desert.txd/cj_chromepipe.dds\",\n \"gta_int.img/sweetshall.txd/cj_chromepipe.dds\",\"gta3.img/cxref_desert.txd/cj_chromepipe.dds\",\n \"gta_int.img/sweetsmain.txd/cj_chromepipe.dds\",\"gta3.img/cxref_desert.txd/cj_chromepipe.dds\",\n \"gta_int.img/zip_clothes.txd/cj_chromepipe.dds\",\"gta3.img/cxref_desert.txd/cj_chromepipe.dds\",\n \"gta3.img/des_clifftown.txd/des_wigwam.dds\",\"gta3.img/cxref_desert.txd/des_wigwam.dds\",\n \"gta3.img/desn_teepee.txd/des_wigwam.dds\",\"gta3.img/cxref_desert.txd/des_wigwam.dds\",\n \"gta3.img/des_stownmots1.txd/des_wigwam.dds\",\"gta3.img/cxref_desert.txd/des_wigwam.dds\",\n \"gta3.img/des_teepee.txd/des_wigwam.dds\",\"gta3.img/cxref_desert.txd/des_wigwam.dds\",\n \"gta3.img/laeroads.txd/roadsback01_la.dds\",\"gta3.img/cxref_freeway.txd/roadsback01_la.dds\",\n \"gta3.img/laroadsigcunt.txd/roadsback01_la.dds\",\"gta3.img/cxref_freeway.txd/roadsback01_la.dds\",\n \"gta3.img/laroadsig_la_cj.txd/roadsback01_la.dds\",\"gta3.img/cxref_freeway.txd/roadsback01_la.dds\",\n \"gta3.img/laroadsig_la.txd/roadsback01_la.dds\",\"gta3.img/cxref_freeway.txd/roadsback01_la.dds\",\n \"gta3.img/law2_roadsb.txd/roadsback01_la.dds\",\"gta3.img/cxref_freeway.txd/roadsback01_la.dds\",\n \"gta3.img/sfroadsign.txd/roadsback01_la.dds\",\"gta3.img/cxref_freeway.txd/roadsback01_la.dds\",\n \"gta3.img/des_farmstuff.txd/des_ntwnwin6.dds\",\"gta3.img/cxref_oldwest.txd/des_ntwnwin6.dds\",\n \"gta3.img/des_nstuff.txd/des_ntwnwin6.dds\",\"gta3.img/cxref_oldwest.txd/des_ntwnwin6.dds\",\n \"gta3.img/des_ntown.txd/des_ntwnwin6.dds\",\"gta3.img/cxref_oldwest.txd/des_ntwnwin6.dds\",\n \"gta3.img/oldwest.txd/des_ntwnwin6.dds\",\"gta3.img/cxref_oldwest.txd/des_ntwnwin6.dds\",\n \"gta3.img/des_ntown.txd/des_ntwnwin3.dds\",\"gta3.img/cxref_oldwest.txd/des_ntwnwin3.dds\",\n \"gta3.img/des_steakhouse.txd/des_ntwnwin3.dds\",\"gta3.img/cxref_oldwest.txd/des_ntwnwin3.dds\",\n \"gta3.img/oldwest.txd/des_ntwnwin3.dds\",\"gta3.img/cxref_oldwest.txd/des_ntwnwin3.dds\",\n \"gta3.img/des_ntown.txd/des_ntwndoor2.dds\",\"gta3.img/cxref_oldwest.txd/des_ntwndoor2.dds\",\n \"gta3.img/oldwest.txd/des_ntwndoor2.dds\",\"gta3.img/cxref_oldwest.txd/des_ntwndoor2.dds\",\n \"gta3.img/des_byoffice.txd/des_bywall2.dds\",\"gta3.img/cxref_savhus.txd/des_bywall2.dds\",\n \"gta3.img/des_damquay.txd/des_bywall2.dds\",\"gta3.img/cxref_savhus.txd/des_bywall2.dds\",\n \"gta3.img/sfn_apart02sfn.txd/sw_wind07.dds\",\"gta3.img/cxref_savhus.txd/sw_wind07.dds\",\n \"gta3.img/vegirlfr01.txd/sw_wind07.dds\",\"gta3.img/cxref_savhus.txd/sw_wind07.dds\",\n \"gta3.img/vgnretail5.txd/sw_wind07.dds\",\"gta3.img/cxref_savhus.txd/sw_wind07.dds\",\n \"gta3.img/vgnretail6.txd/sw_wind07.dds\",\"gta3.img/cxref_savhus.txd/sw_wind07.dds\",\n \"gta3.img/wddngchpl.txd/sw_wind07.dds\",\"gta3.img/cxref_savhus.txd/sw_wind07.dds\",\n \"gta3.img/des_ntown.txd/des_brick1.dds\",\"gta3.img/cxref_savhus.txd/des_brick1.dds\",\n \"gta3.img/des_nwtownclinic.txd/des_brick1.dds\",\"gta3.img/cxref_savhus.txd/des_brick1.dds\",\n \"gta3.img/des_nwtownpolice.txd/des_brick1.dds\",\"gta3.img/cxref_savhus.txd/des_brick1.dds\",\n \"gta3.img/des_nwtown.txd/des_brick1.dds\",\"gta3.img/cxref_savhus.txd/des_brick1.dds\",\n \"gta3.img/des_nwtownw.txd/des_brick1.dds\",\"gta3.img/cxref_savhus.txd/des_brick1.dds\",\n \"gta3.img/des_stownmain1.txd/des_brick1.dds\",\"gta3.img/cxref_savhus.txd/des_brick1.dds\",\n \"gta3.img/des_stownmain2.txd/des_brick1.dds\",\"gta3.img/cxref_savhus.txd/des_brick1.dds\",\n \"gta3.img/des_stownstrip2.txd/des_brick1.dds\",\"gta3.img/cxref_savhus.txd/des_brick1.dds\",\n \"gta3.img/des_wtownmain.txd/des_brick1.dds\",\"gta3.img/cxref_savhus.txd/des_brick1.dds\",\n \"gta3.img/des_boneyard.txd/des_bytower1.dds\",\"gta3.img/cxrf_indstuff.txd/des_bytower1.dds\",\n \"gta3.img/des_byoffice.txd/des_bytower1.dds\",\"gta3.img/cxrf_indstuff.txd/des_bytower1.dds\",\n \"gta3.img/desertmisc.txd/des_bytower1.dds\",\"gta3.img/cxrf_indstuff.txd/des_bytower1.dds\",\n \"gta3.img/des_telescopestuff.txd/des_bytower1.dds\",\"gta3.img/cxrf_indstuff.txd/des_bytower1.dds\",\n \"gta3.img/hubprops2_sfse.txd/welder.dds\",\"gta3.img/cxrf_payspray.txd/welder.dds\",\n \"gta3.img/lvse_spray1.txd/welder.dds\",\"gta3.img/cxrf_payspray.txd/welder.dds\",\n \"gta3.img/michgar.txd/welder.dds\",\"gta3.img/cxrf_payspray.txd/welder.dds\",\n \"gta3.img/sfe_spray1.txd/welder.dds\",\"gta3.img/cxrf_payspray.txd/welder.dds\",\n \"gta3.img/sprayshp_sfse.txd/welder.dds\",\"gta3.img/cxrf_payspray.txd/welder.dds\",\n \"gta3.img/vegasbuild.txd/welder.dds\",\"gta3.img/cxrf_payspray.txd/welder.dds\",\n \"gta_int.img/genintintcarint3.txd/welder.dds\",\"gta3.img/cxrf_payspray.txd/welder.dds\",\n \"gta3.img/hubint1_sfse.txd/panel2_64a.dds\",\"gta3.img/cxrf_payspray.txd/panel2_64a.dds\",\n \"gta3.img/lvse_spray1.txd/panel2_64a.dds\",\"gta3.img/cxrf_payspray.txd/panel2_64a.dds\",\n \"gta3.img/paynspray_lae.txd/panel2_64a.dds\",\"gta3.img/cxrf_payspray.txd/panel2_64a.dds\",\n \"gta3.img/sfe_spray1.txd/panel2_64a.dds\",\"gta3.img/cxrf_payspray.txd/panel2_64a.dds\",\n \"gta3.img/sprayshp_sfse.txd/panel2_64a.dds\",\"gta3.img/cxrf_payspray.txd/panel2_64a.dds\",\n \"gta3.img/vegasbuild.txd/panel2_64a.dds\",\"gta3.img/cxrf_payspray.txd/panel2_64a.dds\",\n \"gta_int.img/genintintcarint3.txd/panel2_64a.dds\",\"gta3.img/cxrf_payspray.txd/panel2_64a.dds\",\n \"gta3.img/lvse_spray1.txd/compressor.dds\",\"gta3.img/cxrf_payspray.txd/compressor.dds\",\n \"gta3.img/michgar.txd/compressor.dds\",\"gta3.img/cxrf_payspray.txd/compressor.dds\",\n \"gta3.img/paynspray_lae.txd/compressor.dds\",\"gta3.img/cxrf_payspray.txd/compressor.dds\",\n \"gta3.img/sfe_spray1.txd/compressor.dds\",\"gta3.img/cxrf_payspray.txd/compressor.dds\",\n \"gta3.img/sprayshp_sfse.txd/compressor.dds\",\"gta3.img/cxrf_payspray.txd/compressor.dds\",\n \"gta3.img/vegasbuild.txd/compressor.dds\",\"gta3.img/cxrf_payspray.txd/compressor.dds\",\n \"gta_int.img/genintintcarint3.txd/compressor.dds\",\"gta3.img/cxrf_payspray.txd/compressor.dds\",\n \"gta_int.img/genintintgarage2.txd/compressor.dds\",\"gta3.img/cxrf_payspray.txd/compressor.dds\",\n \"gta_int.img/genintintgarage3b.txd/compressor.dds\",\"gta3.img/cxrf_payspray.txd/compressor.dds\",\n \"gta3.img/docks2_sfse.txd/alumox64b.dds\",\"gta3.img/cxrf_payspray.txd/alumox64b.dds\",\n \"gta3.img/electricgate.txd/alumox64b.dds\",\"gta3.img/cxrf_payspray.txd/alumox64b.dds\",\n \"gta3.img/hubint1_sfse.txd/alumox64b.dds\",\"gta3.img/cxrf_payspray.txd/alumox64b.dds\",\n \"gta3.img/hubprops2_sfse.txd/alumox64b.dds\",\"gta3.img/cxrf_payspray.txd/alumox64b.dds\",\n \"gta3.img/lvse_spray1.txd/alumox64b.dds\",\"gta3.img/cxrf_payspray.txd/alumox64b.dds\",\n \"gta3.img/metalbarrier.txd/alumox64b.dds\",\"gta3.img/cxrf_payspray.txd/alumox64b.dds\",\n \"gta3.img/michgar.txd/alumox64b.dds\",\"gta3.img/cxrf_payspray.txd/alumox64b.dds\",\n \"gta3.img/paynspray_lae.txd/alumox64b.dds\",\"gta3.img/cxrf_payspray.txd/alumox64b.dds\",\n \"gta3.img/sfe_spray1.txd/alumox64b.dds\",\"gta3.img/cxrf_payspray.txd/alumox64b.dds\",\n \"gta3.img/signs.txd/alumox64b.dds\",\"gta3.img/cxrf_payspray.txd/alumox64b.dds\",\n \"gta3.img/sprayshp_sfse.txd/alumox64b.dds\",\"gta3.img/cxrf_payspray.txd/alumox64b.dds\",\n \"gta3.img/vegasbuild.txd/alumox64b.dds\",\"gta3.img/cxrf_payspray.txd/alumox64b.dds\",\n \"gta_int.img/genintintcarint3.txd/alumox64b.dds\",\"gta3.img/cxrf_payspray.txd/alumox64b.dds\",\n \"gta_int.img/kickstart.txd/alumox64b.dds\",\"gta3.img/cxrf_payspray.txd/alumox64b.dds\",\n \"gta3.img/lvse_spray1.txd/sf_spraydoor1.dds\",\"gta3.img/cxrf_payspray.txd/sf_spraydoor1.dds\",\n \"gta3.img/paynspray_lae.txd/sf_spraydoor1.dds\",\"gta3.img/cxrf_payspray.txd/sf_spraydoor1.dds\",\n \"gta3.img/sfe_spray1.txd/sf_spraydoor1.dds\",\"gta3.img/cxrf_payspray.txd/sf_spraydoor1.dds\",\n \"gta3.img/sprayshp_sfse.txd/sf_spraydoor1.dds\",\"gta3.img/cxrf_payspray.txd/sf_spraydoor1.dds\",\n \"gta3.img/vegasbuild.txd/sf_spraydoor1.dds\",\"gta3.img/cxrf_payspray.txd/sf_spraydoor1.dds\",\n \"gta3.img/lvse_spray1.txd/sf_spray1.dds\",\"gta3.img/cxrf_payspray.txd/sf_spray1.dds\",\n \"gta3.img/paynspray_lae.txd/sf_spray1.dds\",\"gta3.img/cxrf_payspray.txd/sf_spray1.dds\",\n \"gta3.img/sfe_spray1.txd/sf_spray1.dds\",\"gta3.img/cxrf_payspray.txd/sf_spray1.dds\",\n \"gta3.img/sprayshp_sfse.txd/sf_spray1.dds\",\"gta3.img/cxrf_payspray.txd/sf_spray1.dds\",\n \"gta3.img/vegasbuild.txd/sf_spray1.dds\",\"gta3.img/cxrf_payspray.txd/sf_spray1.dds\",\n \"gta3.img/vgsespras.txd/sf_spray1.dds\",\"gta3.img/cxrf_payspray.txd/sf_spray1.dds\",\n \"gta3.img/hospital_lawn.txd/newindow4.dds\",\"gta3.img/cxrf_payspray.txd/newindow4.dds\",\n \"gta3.img/hubint1_sfse.txd/newindow4.dds\",\"gta3.img/cxrf_payspray.txd/newindow4.dds\",\n \"gta3.img/lvse_spray1.txd/newindow4.dds\",\"gta3.img/cxrf_payspray.txd/newindow4.dds\",\n \"gta3.img/paynspray_lae.txd/newindow4.dds\",\"gta3.img/cxrf_payspray.txd/newindow4.dds\",\n \"gta3.img/sfe_spray1.txd/newindow4.dds\",\"gta3.img/cxrf_payspray.txd/newindow4.dds\",\n \"gta3.img/shops2_law.txd/newindow4.dds\",\"gta3.img/cxrf_payspray.txd/newindow4.dds\",\n \"gta3.img/sprayshp_sfse.txd/newindow4.dds\",\"gta3.img/cxrf_payspray.txd/newindow4.dds\",\n \"gta3.img/xenon_sfse.txd/newindow4.dds\",\"gta3.img/cxrf_payspray.txd/newindow4.dds\",\n \"gta_int.img/genintintcarint3.txd/newindow4.dds\",\"gta3.img/cxrf_payspray.txd/newindow4.dds\",\n \"gta3.img/kb_skip_txd.txd/walldirtynewa256.dds\",\"gta3.img/cxrf_payspray.txd/walldirtynewa256.dds\",\n \"gta3.img/roadbridge_sfse.txd/ws_drain.dds\",\"gta3.img/dam_genroom.txd/ws_drain.dds\",\n \"gta3.img/dk_midbuilds.txd/dam_genrail.dds\",\"gta3.img/dam_genroom.txd/dam_genrail.dds\",\n \"gta3.img/lahills_wiresnshit3.txd/dam_genrail.dds\",\"gta3.img/dam_genroom.txd/dam_genrail.dds\",\n \"gta3.img/sw_brewery.txd/dam_genrail.dds\",\"gta3.img/dam_genroom.txd/dam_genrail.dds\",\n \"gta3.img/des_ufoinn.txd/dam_turbine.dds\",\"gta3.img/dam_genroom.txd/dam_turbine.dds\",\n \"gta3.img/des_wdam.txd/des_dam_wall.dds\",\"gta3.img/dam_genroom.txd/des_dam_wall.dds\",\n \"gta3.img/sw_apartflat5.txd/des_dam_wall.dds\",\"gta3.img/dam_genroom.txd/des_dam_wall.dds\",\n \"gta3.img/sphinx01.txd/casinodoor1_128.dds\",\"gta3.img/dave_door_2a.txd/casinodoor1_128.dds\",\n \"gta3.img/vgnfremnt2.txd/casinodoor1_128.dds\",\"gta3.img/dave_door_2a.txd/casinodoor1_128.dds\",\n \"gta3.img/miragecasino2.txd/miragedoor1_256.dds\",\"gta3.img/dave_door_2b.txd/miragedoor1_256.dds\",\n \"gta3.img/vgncircir.txd/miragedoor1_256.dds\",\"gta3.img/dave_door_2b.txd/miragedoor1_256.dds\",\n \"gta3.img/vgwestretail1.txd/miragedoor1_256.dds\",\"gta3.img/dave_door_2b.txd/miragedoor1_256.dds\",\n \"gta3.img/lawnapartxref.txd/vgnhsedor1_256.dds\",\"gta3.img/dave_door_2c.txd/vgnhsedor1_256.dds\",\n \"gta3.img/vegashse5.txd/vgnhsedor1_256.dds\",\"gta3.img/dave_door_2c.txd/vgnhsedor1_256.dds\",\n \"gta3.img/vegashse6.txd/vgnhsedor1_256.dds\",\"gta3.img/dave_door_2c.txd/vgnhsedor1_256.dds\",\n \"gta3.img/vegashse7.txd/vgnhsedor1_256.dds\",\"gta3.img/dave_door_2c.txd/vgnhsedor1_256.dds\",\n \"gta3.img/vgnhseing1.txd/vgnhsedor1_256.dds\",\"gta3.img/dave_door_2c.txd/vgnhsedor1_256.dds\",\n \"gta3.img/vgnxrefhse1.txd/vgnhsedor1_256.dds\",\"gta3.img/dave_door_2c.txd/vgnhsedor1_256.dds\",\n \"gta3.img/dem4_sfxrf.txd/ws_flooredge.dds\",\"gta3.img/dem1_sfxrf.txd/ws_flooredge.dds\",\n \"gta3.img/hotel2_sfs.txd/ws_oldoffice3.dds\",\"gta3.img/dem1_sfxrf.txd/ws_oldoffice3.dds\",\n \"gta3.img/queens3_sfs.txd/ws_oldoffice3.dds\",\"gta3.img/dem1_sfxrf.txd/ws_oldoffice3.dds\",\n \"gta3.img/shops_sfse.txd/ws_oldoffice3.dds\",\"gta3.img/dem1_sfxrf.txd/ws_oldoffice3.dds\",\n \"gta3.img/shops2extra_sfse.txd/ws_apartmenttan1.dds\",\"gta3.img/dem4_sfxrf.txd/ws_apartmenttan1.dds\",\n \"gta3.img/mission2apts_sfse.txd/ws_classyshop2.dds\",\"gta3.img/dem4_sfxrf.txd/ws_classyshop2.dds\",\n \"gta3.img/mission3_sfse.txd/ws_classyshop2.dds\",\"gta3.img/dem4_sfxrf.txd/ws_classyshop2.dds\",\n \"gta3.img/mission_sfse.txd/ws_classyshop2.dds\",\"gta3.img/dem4_sfxrf.txd/ws_classyshop2.dds\",\n \"gta3.img/shops2extra_sfse.txd/ws_classyshop2.dds\",\"gta3.img/dem4_sfxrf.txd/ws_classyshop2.dds\",\n \"gta3.img/des_cen.txd/des_rocky1.dds\",\"gta3.img/des2vegas_join.txd/des_rocky1.dds\",\n \"gta3.img/des_ne.txd/des_rocky1.dds\",\"gta3.img/des2vegas_join.txd/des_rocky1.dds\",\n \"gta3.img/des_n.txd/des_rocky1.dds\",\"gta3.img/des2vegas_join.txd/des_rocky1.dds\",\n \"gta3.img/des_se1.txd/des_rocky1.dds\",\"gta3.img/des2vegas_join.txd/des_rocky1.dds\",\n \"gta3.img/des_ne.txd/rocktbrn_dirt2.dds\",\"gta3.img/des2vegas_join.txd/rocktbrn_dirt2.dds\",\n \"gta3.img/des_n.txd/rocktbrn_dirt2.dds\",\"gta3.img/des2vegas_join.txd/rocktbrn_dirt2.dds\",\n \"gta3.img/des_nw.txd/rocktbrn_dirt2.dds\",\"gta3.img/des2vegas_join.txd/rocktbrn_dirt2.dds\",\n \"gta3.img/des_cen.txd/des_scrub1_dirt1.dds\",\"gta3.img/des2vegas_join.txd/des_scrub1_dirt1.dds\",\n \"gta3.img/des_ne.txd/des_scrub1_dirt1.dds\",\"gta3.img/des2vegas_join.txd/des_scrub1_dirt1.dds\",\n \"gta3.img/des_n.txd/des_scrub1_dirt1.dds\",\"gta3.img/des2vegas_join.txd/des_scrub1_dirt1.dds\",\n \"gta3.img/des_nw2.txd/des_scrub1_dirt1.dds\",\"gta3.img/des2vegas_join.txd/des_scrub1_dirt1.dds\",\n \"gta3.img/des_nw.txd/des_scrub1_dirt1.dds\",\"gta3.img/des2vegas_join.txd/des_scrub1_dirt1.dds\",\n \"gta3.img/des_se3.txd/des_scrub1_dirt1.dds\",\"gta3.img/des2vegas_join.txd/des_scrub1_dirt1.dds\",\n \"gta3.img/vgnland.txd/des_scrub1_dirt1.dds\",\"gta3.img/des2vegas_join.txd/des_scrub1_dirt1.dds\",\n \"gta3.img/vgsecoast.txd/des_scrub1_dirt1.dds\",\"gta3.img/des2vegas_join.txd/des_scrub1_dirt1.dds\",\n \"gta3.img/vgssland02.txd/des_scrub1_dirt1.dds\",\"gta3.img/des2vegas_join.txd/des_scrub1_dirt1.dds\",\n \"gta3.img/vgwestcoast.txd/des_scrub1_dirt1.dds\",\"gta3.img/des2vegas_join.txd/des_scrub1_dirt1.dds\",\n \"gta3.img/des_cen.txd/des_redrockbot.dds\",\"gta3.img/des2vegas_join.txd/des_redrockbot.dds\",\n \"gta3.img/des_ne.txd/des_redrockbot.dds\",\"gta3.img/des2vegas_join.txd/des_redrockbot.dds\",\n \"gta3.img/des_n.txd/des_redrockbot.dds\",\"gta3.img/des2vegas_join.txd/des_redrockbot.dds\",\n \"gta3.img/des_nw.txd/des_redrockbot.dds\",\"gta3.img/des2vegas_join.txd/des_redrockbot.dds\",\n \"gta3.img/des_se1.txd/des_redrockbot.dds\",\"gta3.img/des2vegas_join.txd/des_redrockbot.dds\",\n \"gta3.img/des_cen.txd/des_redrockmid.dds\",\"gta3.img/des2vegas_join.txd/des_redrockmid.dds\",\n \"gta3.img/des_ne.txd/des_redrockmid.dds\",\"gta3.img/des2vegas_join.txd/des_redrockmid.dds\",\n \"gta3.img/des_n.txd/des_redrockmid.dds\",\"gta3.img/des2vegas_join.txd/des_redrockmid.dds\",\n \"gta3.img/des_nw.txd/des_redrockmid.dds\",\"gta3.img/des2vegas_join.txd/des_redrockmid.dds\",\n \"gta3.img/des_se1.txd/des_redrockmid.dds\",\"gta3.img/des2vegas_join.txd/des_redrockmid.dds\",\n \"gta3.img/des_sw.txd/des_redrockmid.dds\",\"gta3.img/des2vegas_join.txd/des_redrockmid.dds\",\n \"gta3.img/vgncoast.txd/vgs_rockbot1a.dds\",\"gta3.img/des2vegas_join.txd/vgs_rockbot1a.dds\",\n \"gta3.img/vgsecoast.txd/vgs_rockbot1a.dds\",\"gta3.img/des2vegas_join.txd/vgs_rockbot1a.dds\",\n \"gta3.img/vgwestcoast.txd/vgs_rockbot1a.dds\",\"gta3.img/des2vegas_join.txd/vgs_rockbot1a.dds\",\n \"gta3.img/vgncoast.txd/vgs_rockmid1a.dds\",\"gta3.img/des2vegas_join.txd/vgs_rockmid1a.dds\",\n \"gta3.img/vgsecoast.txd/vgs_rockmid1a.dds\",\"gta3.img/des2vegas_join.txd/vgs_rockmid1a.dds\",\n \"gta3.img/vgseseabed.txd/vgs_rockmid1a.dds\",\"gta3.img/des2vegas_join.txd/vgs_rockmid1a.dds\",\n \"gta3.img/vgsssignage02.txd/vgs_rockmid1a.dds\",\"gta3.img/des2vegas_join.txd/vgs_rockmid1a.dds\",\n \"gta3.img/vgwestcoast.txd/vgs_rockmid1a.dds\",\"gta3.img/des2vegas_join.txd/vgs_rockmid1a.dds\",\n \"gta3.img/ufo_bar.txd/kb_flykiller1.dds\",\"gta3.img/des_airfieldhus.txd/kb_flykiller1.dds\",\n \"gta_int.img/flykiller.txd/kb_flykiller1.dds\",\"gta3.img/des_airfieldhus.txd/kb_flykiller1.dds\",\n \"gta_int.img/int_brothelint3.txd/kb_flykiller1.dds\",\"gta3.img/des_airfieldhus.txd/kb_flykiller1.dds\",\n \"gta_int.img/cj_barb2.txd/cj_socket.dds\",\"gta3.img/des_airfieldhus.txd/cj_socket.dds\",\n \"gta_int.img/cj_hotel_sw.txd/cj_socket.dds\",\"gta3.img/des_airfieldhus.txd/cj_socket.dds\",\n \"gta_int.img/cj_hotel.txd/cj_socket.dds\",\"gta3.img/des_airfieldhus.txd/cj_socket.dds\",\n \"gta3.img/mp_ranchcut.txd/btdeck256.dds\",\"gta3.img/des_airfieldhus.txd/btdeck256.dds\",\n \"gta3.img/ufo_barbakroom.txd/btdeck256.dds\",\"gta3.img/des_airfieldhus.txd/btdeck256.dds\",\n \"gta_int.img/burger_tray.txd/btdeck256.dds\",\"gta3.img/des_airfieldhus.txd/btdeck256.dds\",\n \"gta_int.img/cb_details.txd/btdeck256.dds\",\"gta3.img/des_airfieldhus.txd/btdeck256.dds\",\n \"gta_int.img/chick_tray.txd/btdeck256.dds\",\"gta3.img/des_airfieldhus.txd/btdeck256.dds\",\n \"gta_int.img/donut_tray.txd/btdeck256.dds\",\"gta3.img/des_airfieldhus.txd/btdeck256.dds\",\n \"gta_int.img/gb_ornaments01.txd/btdeck256.dds\",\"gta3.img/des_airfieldhus.txd/btdeck256.dds\",\n \"gta_int.img/labig1int2.txd/btdeck256.dds\",\"gta3.img/des_airfieldhus.txd/btdeck256.dds\",\n \"gta_int.img/lahss2int2.txd/btdeck256.dds\",\"gta3.img/des_airfieldhus.txd/btdeck256.dds\",\n \"gta_int.img/lee_studhall.txd/btdeck256.dds\",\"gta3.img/des_airfieldhus.txd/btdeck256.dds\",\n \"gta_int.img/masmall3int2.txd/btdeck256.dds\",\"gta3.img/des_airfieldhus.txd/btdeck256.dds\",\n \"gta_int.img/rystuff.txd/btdeck256.dds\",\"gta3.img/des_airfieldhus.txd/btdeck256.dds\",\n \"gta_int.img/svcunthoose.txd/btdeck256.dds\",\"gta3.img/des_airfieldhus.txd/btdeck256.dds\",\n \"gta_int.img/vghsb3int2.txd/btdeck256.dds\",\"gta3.img/des_airfieldhus.txd/btdeck256.dds\",\n \"gta_int.img/vghss1int2.txd/btdeck256.dds\",\"gta3.img/des_airfieldhus.txd/btdeck256.dds\",\n \"gta_int.img/casinovault01.txd/compound_roof1.dds\",\"gta3.img/des_airfieldhus.txd/compound_roof1.dds\",\n \"gta3.img/des_quarrybits.txd/dirtyledge_law.dds\",\"gta3.img/des_bigearstuff.txd/dirtyledge_law.dds\",\n \"gta3.img/melrose06_lawn.txd/dirtyledge_law.dds\",\"gta3.img/des_bigearstuff.txd/dirtyledge_law.dds\",\n \"gta3.img/santamonicalaw2.txd/dirtyledge_law.dds\",\"gta3.img/des_bigearstuff.txd/dirtyledge_law.dds\",\n \"gta3.img/sunstrans_law2.txd/dirtyledge_law.dds\",\"gta3.img/des_bigearstuff.txd/dirtyledge_law.dds\",\n \"gta3.img/venicegb02_law.txd/dirtyledge_law.dds\",\"gta3.img/des_bigearstuff.txd/dirtyledge_law.dds\",\n \"gta3.img/vgsebuild01.txd/dirtyledge_law.dds\",\"gta3.img/des_bigearstuff.txd/dirtyledge_law.dds\",\n \"gta3.img/des_stownmain3.txd/dirty01.dds\",\"gta3.img/des_bigearstuff.txd/dirty01.dds\",\n \"gta3.img/newstuff_sfn.txd/dirty01.dds\",\"gta3.img/des_bigearstuff.txd/dirty01.dds\",\n \"gta3.img/des_byoffice.txd/gb_nastybar08.dds\",\"gta3.img/des_bighus.txd/gb_nastybar08.dds\",\n \"gta3.img/lae2roadscoast.txd/gb_nastybar08.dds\",\"gta3.img/des_bighus.txd/gb_nastybar08.dds\",\n \"gta3.img/sfn_office.txd/gb_nastybar08.dds\",\"gta3.img/des_bighus.txd/gb_nastybar08.dds\",\n \"gta3.img/sw_poorhouse.txd/gb_nastybar08.dds\",\"gta3.img/des_bighus.txd/gb_nastybar08.dds\",\n \"gta_int.img/cj_bar2.txd/gb_nastybar08.dds\",\"gta3.img/des_bighus.txd/gb_nastybar08.dds\",\n \"gta3.img/desn2_minestuff.txd/des_woodfence1.dds\",\"gta3.img/des_bighus.txd/des_woodfence1.dds\",\n \"gta3.img/mulveg2lahills.txd/des_woodfence1.dds\",\"gta3.img/des_bighus.txd/des_woodfence1.dds\",\n \"gta3.img/sw_diner1.txd/sw_wind09.dds\",\"gta3.img/des_bighus.txd/sw_wind09.dds\",\n \"gta3.img/sw_poorhouse.txd/sw_wind09.dds\",\"gta3.img/des_bighus.txd/sw_wind09.dds\",\n \"gta3.img/sfeship1.txd/cj_wood5.dds\",\"gta3.img/des_byofficeint.txd/cj_wood5.dds\",\n \"gta3.img/sfn_byofficeint.txd/cj_wood5.dds\",\"gta3.img/des_byofficeint.txd/cj_wood5.dds\",\n \"gta3.img/sw_furniture.txd/cj_wood5.dds\",\"gta3.img/des_byofficeint.txd/cj_wood5.dds\",\n \"gta3.img/vgsbikesclint.txd/cj_wood5.dds\",\"gta3.img/des_byofficeint.txd/cj_wood5.dds\",\n \"gta_int.img/cj_furniture.txd/cj_wood5.dds\",\"gta3.img/des_byofficeint.txd/cj_wood5.dds\",\n \"gta_int.img/cj_kitchen.txd/cj_wood5.dds\",\"gta3.img/des_byofficeint.txd/cj_wood5.dds\",\n \"gta_int.img/cj_office.txd/cj_wood5.dds\",\"gta3.img/des_byofficeint.txd/cj_wood5.dds\",\n \"gta_int.img/cj_s_beds.txd/cj_wood5.dds\",\"gta3.img/des_byofficeint.txd/cj_wood5.dds\",\n \"gta_int.img/cj_tables.txd/cj_wood5.dds\",\"gta3.img/des_byofficeint.txd/cj_wood5.dds\",\n \"gta_int.img/genhotelsave.txd/cj_wood5.dds\",\"gta3.img/des_byofficeint.txd/cj_wood5.dds\",\n \"gta_int.img/lasmalldesk.txd/cj_wood5.dds\",\"gta3.img/des_byofficeint.txd/cj_wood5.dds\",\n \"gta_int.img/papaerchaseoffice.txd/cj_wood5.dds\",\"gta3.img/des_byofficeint.txd/cj_wood5.dds\",\n \"gta_int.img/police_props.txd/cj_wood5.dds\",\"gta3.img/des_byofficeint.txd/cj_wood5.dds\",\n \"gta_int.img/vegassavesmal.txd/cj_wood5.dds\",\"gta3.img/des_byofficeint.txd/cj_wood5.dds\",\n \"gta3.img/mp_ranchcut.txd/ufo_pics2.dds\",\"gta3.img/des_byofficeint.txd/ufo_pics2.dds\",\n \"gta3.img/ufo_barbakroom.txd/ufo_pics2.dds\",\"gta3.img/des_byofficeint.txd/ufo_pics2.dds\",\n \"gta_int.img/nu_filing.txd/water_cool2.dds\",\"gta3.img/des_byofficeint.txd/water_cool2.dds\",\n \"gta_int.img/nu_filing.txd/water_cool1.dds\",\"gta3.img/des_byofficeint.txd/water_cool1.dds\",\n \"gta3.img/sfn_byofficeint.txd/est_chair.dds\",\"gta3.img/des_byofficeint.txd/est_chair.dds\",\n \"gta3.img/vgsbikesclint.txd/est_chair.dds\",\"gta3.img/des_byofficeint.txd/est_chair.dds\",\n \"gta_int.img/cj_office.txd/est_chair.dds\",\"gta3.img/des_byofficeint.txd/est_chair.dds\",\n \"gta_int.img/crlsbits.txd/est_chair.dds\",\"gta3.img/des_byofficeint.txd/est_chair.dds\",\n \"gta3.img/recroomsfse.txd/chromepipe2_32hv.dds\",\"gta3.img/des_byofficeint.txd/chromepipe2_32hv.dds\",\n \"gta3.img/sfn_byofficeint.txd/chromepipe2_32hv.dds\",\"gta3.img/des_byofficeint.txd/chromepipe2_32hv.dds\",\n \"gta3.img/vgsbikesclint.txd/chromepipe2_32hv.dds\",\"gta3.img/des_byofficeint.txd/chromepipe2_32hv.dds\",\n \"gta_int.img/cj_office.txd/chromepipe2_32hv.dds\",\"gta3.img/des_byofficeint.txd/chromepipe2_32hv.dds\",\n \"gta_int.img/cj_tv.txd/chromepipe2_32hv.dds\",\"gta3.img/des_byofficeint.txd/chromepipe2_32hv.dds\",\n \"gta_int.img/crlsbits.txd/chromepipe2_32hv.dds\",\"gta3.img/des_byofficeint.txd/chromepipe2_32hv.dds\",\n \"gta_int.img/estateprops.txd/chromepipe2_32hv.dds\",\"gta3.img/des_byofficeint.txd/chromepipe2_32hv.dds\",\n \"gta3.img/mp_ranchcut.txd/nt_phone2.dds\",\"gta3.img/des_byofficeint.txd/nt_phone2.dds\",\n \"gta3.img/sw_bankint.txd/nt_phone2.dds\",\"gta3.img/des_byofficeint.txd/nt_phone2.dds\",\n \"gta3.img/ufo_barbakroom.txd/nt_phone2.dds\",\"gta3.img/des_byofficeint.txd/nt_phone2.dds\",\n \"gta_int.img/cj_hotel_poor.txd/nt_phone2.dds\",\"gta3.img/des_byofficeint.txd/nt_phone2.dds\",\n \"gta_int.img/cj_hotel_sw.txd/nt_phone2.dds\",\"gta3.img/des_byofficeint.txd/nt_phone2.dds\",\n \"gta_int.img/cj_hotel.txd/nt_phone2.dds\",\"gta3.img/des_byofficeint.txd/nt_phone2.dds\",\n \"gta_int.img/cj_office.txd/nt_phone2.dds\",\"gta3.img/des_byofficeint.txd/nt_phone2.dds\",\n \"gta_int.img/estateprops.txd/nt_phone2.dds\",\"gta3.img/des_byofficeint.txd/nt_phone2.dds\",\n \"gta_int.img/whore_furn.txd/nt_phone2.dds\",\"gta3.img/des_byofficeint.txd/nt_phone2.dds\",\n \"gta3.img/mp_ranchcut.txd/nt_phone1.dds\",\"gta3.img/des_byofficeint.txd/nt_phone1.dds\",\n \"gta3.img/sw_bankint.txd/nt_phone1.dds\",\"gta3.img/des_byofficeint.txd/nt_phone1.dds\",\n \"gta3.img/ufo_barbakroom.txd/nt_phone1.dds\",\"gta3.img/des_byofficeint.txd/nt_phone1.dds\",\n \"gta_int.img/cj_hotel_poor.txd/nt_phone1.dds\",\"gta3.img/des_byofficeint.txd/nt_phone1.dds\",\n \"gta_int.img/cj_hotel_sw.txd/nt_phone1.dds\",\"gta3.img/des_byofficeint.txd/nt_phone1.dds\",\n \"gta_int.img/cj_hotel.txd/nt_phone1.dds\",\"gta3.img/des_byofficeint.txd/nt_phone1.dds\",\n \"gta_int.img/cj_office.txd/nt_phone1.dds\",\"gta3.img/des_byofficeint.txd/nt_phone1.dds\",\n \"gta_int.img/estateprops.txd/nt_phone1.dds\",\"gta3.img/des_byofficeint.txd/nt_phone1.dds\",\n \"gta_int.img/whore_furn.txd/nt_phone1.dds\",\"gta3.img/des_byofficeint.txd/nt_phone1.dds\",\n \"gta3.img/hubprops2_sfse.txd/cj_filling2.dds\",\"gta3.img/des_byofficeint.txd/cj_filling2.dds\",\n \"gta_int.img/cj_off_new.txd/cj_filling2.dds\",\"gta3.img/des_byofficeint.txd/cj_filling2.dds\",\n \"gta_int.img/police_props.txd/cj_filling2.dds\",\"gta3.img/des_byofficeint.txd/cj_filling2.dds\",\n \"gta3.img/horse_shoe_pick.txd/cj_polished.dds\",\"gta3.img/des_byofficeint.txd/cj_polished.dds\",\n \"gta3.img/hubprops2_sfse.txd/cj_polished.dds\",\"gta3.img/des_byofficeint.txd/cj_polished.dds\",\n \"gta_int.img/cb_bar_bits.txd/cj_polished.dds\",\"gta3.img/des_byofficeint.txd/cj_polished.dds\",\n \"gta_int.img/cj_bathroom.txd/cj_polished.dds\",\"gta3.img/des_byofficeint.txd/cj_polished.dds\",\n \"gta_int.img/cj_bs_bathroom.txd/cj_polished.dds\",\"gta3.img/des_byofficeint.txd/cj_polished.dds\",\n \"gta_int.img/cj_ff.txd/cj_polished.dds\",\"gta3.img/des_byofficeint.txd/cj_polished.dds\",\n \"gta_int.img/cj_hi_fi2.txd/cj_polished.dds\",\"gta3.img/des_byofficeint.txd/cj_polished.dds\",\n \"gta_int.img/cj_off_lic.txd/cj_polished.dds\",\"gta3.img/des_byofficeint.txd/cj_polished.dds\",\n \"gta_int.img/cj_off_new.txd/cj_polished.dds\",\"gta3.img/des_byofficeint.txd/cj_polished.dds\",\n \"gta_int.img/cj_ss_1.txd/cj_polished.dds\",\"gta3.img/des_byofficeint.txd/cj_polished.dds\",\n \"gta_int.img/cj_ss_2.txd/cj_polished.dds\",\"gta3.img/des_byofficeint.txd/cj_polished.dds\",\n \"gta_int.img/cj_ss_3.txd/cj_polished.dds\",\"gta3.img/des_byofficeint.txd/cj_polished.dds\",\n \"gta_int.img/cj_ss_4.txd/cj_polished.dds\",\"gta3.img/des_byofficeint.txd/cj_polished.dds\",\n \"gta_int.img/cuntcuts.txd/cj_polished.dds\",\"gta3.img/des_byofficeint.txd/cj_polished.dds\",\n \"gta_int.img/ds_sign.txd/cj_polished.dds\",\"gta3.img/des_byofficeint.txd/cj_polished.dds\",\n \"gta_int.img/police_props.txd/cj_polished.dds\",\"gta3.img/des_byofficeint.txd/cj_polished.dds\",\n \"gta_int.img/rc_shop_figure.txd/cj_polished.dds\",\"gta3.img/des_byofficeint.txd/cj_polished.dds\",\n \"gta3.img/hubprops2_sfse.txd/filling.dds\",\"gta3.img/des_byofficeint.txd/filling.dds\",\n \"gta_int.img/cj_off_new.txd/filling.dds\",\"gta3.img/des_byofficeint.txd/filling.dds\",\n \"gta_int.img/police_props.txd/filling.dds\",\"gta3.img/des_byofficeint.txd/filling.dds\",\n \"gta3.img/sfn_byofficeint.txd/hectics_text.dds\",\"gta3.img/des_byofficeint.txd/hectics_text.dds\",\n \"gta3.img/vgsbikesclint.txd/hectics_text.dds\",\"gta3.img/des_byofficeint.txd/hectics_text.dds\",\n \"gta_int.img/drivingbit.txd/hectics_text.dds\",\"gta3.img/des_byofficeint.txd/hectics_text.dds\",\n \"gta_int.img/mixkb1.txd/hectics_text.dds\",\"gta3.img/des_byofficeint.txd/hectics_text.dds\",\n \"gta3.img/sfn_byofficeint.txd/blak_1.dds\",\"gta3.img/des_byofficeint.txd/blak_1.dds\",\n \"gta3.img/vgsbikesclint.txd/blak_1.dds\",\"gta3.img/des_byofficeint.txd/blak_1.dds\",\n \"gta_int.img/drivingbit.txd/blak_1.dds\",\"gta3.img/des_byofficeint.txd/blak_1.dds\",\n \"gta_int.img/mixkb1.txd/blak_1.dds\",\"gta3.img/des_byofficeint.txd/blak_1.dds\",\n \"gta3.img/sfn_byofficeint.txd/chrome_tube4.dds\",\"gta3.img/des_byofficeint.txd/chrome_tube4.dds\",\n \"gta3.img/vgsbikesclint.txd/chrome_tube4.dds\",\"gta3.img/des_byofficeint.txd/chrome_tube4.dds\",\n \"gta_int.img/cuntcuts.txd/chrome_tube4.dds\",\"gta3.img/des_byofficeint.txd/chrome_tube4.dds\",\n \"gta_int.img/drivingbit.txd/chrome_tube4.dds\",\"gta3.img/des_byofficeint.txd/chrome_tube4.dds\",\n \"gta3.img/sfn_byofficeint.txd/cj_video5.dds\",\"gta3.img/des_byofficeint.txd/cj_video5.dds\",\n \"gta3.img/vgsbikesclint.txd/cj_video5.dds\",\"gta3.img/des_byofficeint.txd/cj_video5.dds\",\n \"gta_int.img/cj_video.txd/cj_video5.dds\",\"gta3.img/des_byofficeint.txd/cj_video5.dds\",\n \"gta_int.img/drivingbit.txd/cj_video5.dds\",\"gta3.img/des_byofficeint.txd/cj_video5.dds\",\n \"gta3.img/hubprops2_sfse.txd/cj_video3(top).dds\",\"gta3.img/des_byofficeint.txd/cj_video3(top).dds\",\n \"gta3.img/recroomsfse.txd/cj_video3(top).dds\",\"gta3.img/des_byofficeint.txd/cj_video3(top).dds\",\n \"gta3.img/sfn_byofficeint.txd/cj_video3(top).dds\",\"gta3.img/des_byofficeint.txd/cj_video3(top).dds\",\n \"gta3.img/vgsbikesclint.txd/cj_video3(top).dds\",\"gta3.img/des_byofficeint.txd/cj_video3(top).dds\",\n \"gta_int.img/cj_electrical.txd/cj_video3(top).dds\",\"gta3.img/des_byofficeint.txd/cj_video3(top).dds\",\n \"gta_int.img/cj_furniture.txd/cj_video3(top).dds\",\"gta3.img/des_byofficeint.txd/cj_video3(top).dds\",\n \"gta_int.img/cj_games.txd/cj_video3(top).dds\",\"gta3.img/des_byofficeint.txd/cj_video3(top).dds\",\n \"gta_int.img/cj_hi_fi.txd/cj_video3(top).dds\",\"gta3.img/des_byofficeint.txd/cj_video3(top).dds\",\n \"gta_int.img/cj_tv_stand.txd/cj_video3(top).dds\",\"gta3.img/des_byofficeint.txd/cj_video3(top).dds\",\n \"gta_int.img/cj_video.txd/cj_video3(top).dds\",\"gta3.img/des_byofficeint.txd/cj_video3(top).dds\",\n \"gta_int.img/drivingbit.txd/cj_video3(top).dds\",\"gta3.img/des_byofficeint.txd/cj_video3(top).dds\",\n \"gta_int.img/sweetshall.txd/cj_video3(top).dds\",\"gta3.img/des_byofficeint.txd/cj_video3(top).dds\",\n \"gta_int.img/vegassavesmal.txd/cj_video3(top).dds\",\"gta3.img/des_byofficeint.txd/cj_video3(top).dds\",\n \"gta3.img/dsfs.txd/cj_tv1.dds\",\"gta3.img/des_byofficeint.txd/cj_tv1.dds\",\n \"gta3.img/dyn_elec.txd/cj_tv1.dds\",\"gta3.img/des_byofficeint.txd/cj_tv1.dds\",\n \"gta3.img/pedalsx.txd/cj_tv1.dds\",\"gta3.img/des_byofficeint.txd/cj_tv1.dds\",\n \"gta3.img/sfn_byofficeint.txd/cj_tv1.dds\",\"gta3.img/des_byofficeint.txd/cj_tv1.dds\",\n \"gta3.img/vgsbikesclint.txd/cj_tv1.dds\",\"gta3.img/des_byofficeint.txd/cj_tv1.dds\",\n \"gta_int.img/cj_coin_op_2.txd/cj_tv1.dds\",\"gta3.img/des_byofficeint.txd/cj_tv1.dds\",\n \"gta_int.img/cj_furniture.txd/cj_tv1.dds\",\"gta3.img/des_byofficeint.txd/cj_tv1.dds\",\n \"gta_int.img/cj_games.txd/cj_tv1.dds\",\"gta3.img/des_byofficeint.txd/cj_tv1.dds\",\n \"gta_int.img/cj_s_beds.txd/cj_tv1.dds\",\"gta3.img/des_byofficeint.txd/cj_tv1.dds\",\n \"gta_int.img/cj_sex.txd/cj_tv1.dds\",\"gta3.img/des_byofficeint.txd/cj_tv1.dds\",\n \"gta_int.img/cj_steal_tv.txd/cj_tv1.dds\",\"gta3.img/des_byofficeint.txd/cj_tv1.dds\",\n \"gta_int.img/cj_tables.txd/cj_tv1.dds\",\"gta3.img/des_byofficeint.txd/cj_tv1.dds\",\n \"gta_int.img/cj_tv_stand.txd/cj_tv1.dds\",\"gta3.img/des_byofficeint.txd/cj_tv1.dds\",\n \"gta_int.img/cj_tv.txd/cj_tv1.dds\",\"gta3.img/des_byofficeint.txd/cj_tv1.dds\",\n \"gta_int.img/drivingbit.txd/cj_tv1.dds\",\"gta3.img/des_byofficeint.txd/cj_tv1.dds\",\n \"gta_int.img/genhotelsave.txd/cj_tv1.dds\",\"gta3.img/des_byofficeint.txd/cj_tv1.dds\",\n \"gta_int.img/genintint_gym.txd/cj_tv1.dds\",\"gta3.img/des_byofficeint.txd/cj_tv1.dds\",\n \"gta_int.img/immy_furn.txd/cj_tv1.dds\",\"gta3.img/des_byofficeint.txd/cj_tv1.dds\",\n \"gta_int.img/savegenmotel.txd/cj_tv1.dds\",\"gta3.img/des_byofficeint.txd/cj_tv1.dds\",\n \"gta_int.img/slot_bank.txd/cj_tv1.dds\",\"gta3.img/des_byofficeint.txd/cj_tv1.dds\",\n \"gta3.img/dyn_elec.txd/cj_moniter1.dds\",\"gta3.img/des_byofficeint.txd/cj_moniter1.dds\",\n \"gta3.img/sfn_byofficeint.txd/cj_moniter1.dds\",\"gta3.img/des_byofficeint.txd/cj_moniter1.dds\",\n \"gta3.img/vgsbikesclint.txd/cj_moniter1.dds\",\"gta3.img/des_byofficeint.txd/cj_moniter1.dds\",\n \"gta_int.img/cj_electrical.txd/cj_moniter1.dds\",\"gta3.img/des_byofficeint.txd/cj_moniter1.dds\",\n \"gta_int.img/cj_sex.txd/cj_moniter1.dds\",\"gta3.img/des_byofficeint.txd/cj_moniter1.dds\",\n \"gta_int.img/cj_steal_tv.txd/cj_moniter1.dds\",\"gta3.img/des_byofficeint.txd/cj_moniter1.dds\",\n \"gta_int.img/cj_tables.txd/cj_moniter1.dds\",\"gta3.img/des_byofficeint.txd/cj_moniter1.dds\",\n \"gta_int.img/cj_tv_stand.txd/cj_moniter1.dds\",\"gta3.img/des_byofficeint.txd/cj_moniter1.dds\",\n \"gta_int.img/cj_tv.txd/cj_moniter1.dds\",\"gta3.img/des_byofficeint.txd/cj_moniter1.dds\",\n \"gta_int.img/cj_video.txd/cj_moniter1.dds\",\"gta3.img/des_byofficeint.txd/cj_moniter1.dds\",\n \"gta_int.img/drivingbit.txd/cj_moniter1.dds\",\"gta3.img/des_byofficeint.txd/cj_moniter1.dds\",\n \"gta_int.img/lasmalldesk.txd/cj_moniter1.dds\",\"gta3.img/des_byofficeint.txd/cj_moniter1.dds\",\n \"gta_int.img/police_props.txd/cj_moniter1.dds\",\"gta3.img/des_byofficeint.txd/cj_moniter1.dds\",\n \"gta3.img/lahillstxd1a.txd/plainwoodenfence1_256.dds\",\"gta3.img/des_byoffice.txd/plainwoodenfence1_256.dds\",\n \"gta3.img/oc_flats_gnd_sfs.txd/plainwoodenfence1_256.dds\",\"gta3.img/des_byoffice.txd/plainwoodenfence1_256.dds\",\n \"gta3.img/sw_fact02alt.txd/plainwoodenfence1_256.dds\",\"gta3.img/des_byoffice.txd/plainwoodenfence1_256.dds\",\n \"gta3.img/tcenewhillhus02.txd/plainwoodenfence1_256.dds\",\"gta3.img/des_byoffice.txd/plainwoodenfence1_256.dds\",\n \"gta3.img/sfn_office.txd/des_bywin1.dds\",\"gta3.img/des_byoffice.txd/des_bywin1.dds\",\n \"gta_int.img/cj_furniture.txd/cj-couchl2.dds\",\"gta3.img/des_cen.txd/cj-couchl2.dds\",\n \"gta_int.img/cj_sofa.txd/cj-couchl2.dds\",\"gta3.img/des_cen.txd/cj-couchl2.dds\",\n \"gta_int.img/cj_tables.txd/cj-couchl2.dds\",\"gta3.img/des_cen.txd/cj-couchl2.dds\",\n \"gta_int.img/lasmalldesk.txd/cj-couchl2.dds\",\"gta3.img/des_cen.txd/cj-couchl2.dds\",\n \"gta3.img/des_ne.txd/des_dirttrackl.dds\",\"gta3.img/des_cen.txd/des_dirttrackl.dds\",\n \"gta3.img/des_n.txd/des_dirttrackl.dds\",\"gta3.img/des_cen.txd/des_dirttrackl.dds\",\n \"gta3.img/des_nw.txd/des_dirttrackl.dds\",\"gta3.img/des_cen.txd/des_dirttrackl.dds\",\n \"gta3.img/des_se2.txd/des_dirttrackl.dds\",\"gta3.img/des_cen.txd/des_dirttrackl.dds\",\n \"gta3.img/des_se3.txd/des_dirttrackl.dds\",\"gta3.img/des_cen.txd/des_dirttrackl.dds\",\n \"gta3.img/des_s.txd/des_dirttrackl.dds\",\"gta3.img/des_cen.txd/des_dirttrackl.dds\",\n \"gta3.img/des_sw.txd/des_dirttrackl.dds\",\"gta3.img/des_cen.txd/des_dirttrackl.dds\",\n \"gta3.img/des_n.txd/des_ripplsand.dds\",\"gta3.img/des_cen.txd/des_ripplsand.dds\",\n \"gta3.img/des_refinery.txd/des_ripplsand.dds\",\"gta3.img/des_cen.txd/des_ripplsand.dds\",\n \"gta3.img/des_se1.txd/des_ripplsand.dds\",\"gta3.img/des_cen.txd/des_ripplsand.dds\",\n \"gta3.img/vgnbball.txd/sandgrnd128.dds\",\"gta3.img/des_cen.txd/sandgrnd128.dds\",\n \"gta3.img/vgnfirestat.txd/sandgrnd128.dds\",\"gta3.img/des_cen.txd/sandgrnd128.dds\",\n \"gta3.img/vgwestland2.txd/sandgrnd128.dds\",\"gta3.img/des_cen.txd/sandgrnd128.dds\",\n \"gta3.img/vgwestland.txd/sandgrnd128.dds\",\"gta3.img/des_cen.txd/sandgrnd128.dds\",\n \"gta3.img/des_ne.txd/desstones_dirt1.dds\",\"gta3.img/des_cen.txd/desstones_dirt1.dds\",\n \"gta3.img/des_se1.txd/desstones_dirt1.dds\",\"gta3.img/des_cen.txd/desstones_dirt1.dds\",\n \"gta3.img/des_se3.txd/desstones_dirt1.dds\",\"gta3.img/des_cen.txd/desstones_dirt1.dds\",\n \"gta3.img/des_se4.txd/desstones_dirt1.dds\",\"gta3.img/des_cen.txd/desstones_dirt1.dds\",\n \"gta3.img/des_s.txd/desstones_dirt1.dds\",\"gta3.img/des_cen.txd/desstones_dirt1.dds\",\n \"gta3.img/des_ne.txd/des_scrub1.dds\",\"gta3.img/des_cen.txd/des_scrub1.dds\",\n \"gta3.img/des_n.txd/des_scrub1.dds\",\"gta3.img/des_cen.txd/des_scrub1.dds\",\n \"gta3.img/des_nw2.txd/des_scrub1.dds\",\"gta3.img/des_cen.txd/des_scrub1.dds\",\n \"gta3.img/des_nw.txd/des_scrub1.dds\",\"gta3.img/des_cen.txd/des_scrub1.dds\",\n \"gta3.img/des_se3.txd/des_scrub1.dds\",\"gta3.img/des_cen.txd/des_scrub1.dds\",\n \"gta3.img/vgnland.txd/des_scrub1.dds\",\"gta3.img/des_cen.txd/des_scrub1.dds\",\n \"gta3.img/vgsecoast.txd/des_scrub1.dds\",\"gta3.img/des_cen.txd/des_scrub1.dds\",\n \"gta3.img/vgssland02.txd/des_scrub1.dds\",\"gta3.img/des_cen.txd/des_scrub1.dds\",\n \"gta3.img/des_ne.txd/des_rocky1_dirt1.dds\",\"gta3.img/des_cen.txd/des_rocky1_dirt1.dds\",\n \"gta3.img/des_n.txd/des_rocky1_dirt1.dds\",\"gta3.img/des_cen.txd/des_rocky1_dirt1.dds\",\n \"gta3.img/des_se1.txd/des_rocky1_dirt1.dds\",\"gta3.img/des_cen.txd/des_rocky1_dirt1.dds\",\n \"gta3.img/oldwest.txd/des_cemgates.dds\",\"gta3.img/des_clifftown.txd/des_cemgates.dds\",\n \"gta3.img/des_pueblo.txd/des_adobewin3.dds\",\"gta3.img/des_clifftown.txd/des_adobewin3.dds\",\n \"gta3.img/des_nwtownw.txd/des_shopwin1.dds\",\"gta3.img/des_clifftown.txd/des_shopwin1.dds\",\n \"gta3.img/des_nwtownclinic.txd/ros_thwin1.dds\",\"gta3.img/des_clifftown.txd/ros_thwin1.dds\",\n \"gta3.img/des_steakhouse.txd/ros_thwin1.dds\",\"gta3.img/des_clifftown.txd/ros_thwin1.dds\",\n \"gta3.img/des_stownmain1.txd/ros_thwin1.dds\",\"gta3.img/des_clifftown.txd/ros_thwin1.dds\",\n \"gta3.img/des_stownmain2.txd/ros_thwin1.dds\",\"gta3.img/des_clifftown.txd/ros_thwin1.dds\",\n \"gta3.img/des_pueblo.txd/des_adobewin2.dds\",\"gta3.img/des_clifftown.txd/des_adobewin2.dds\",\n \"gta3.img/des_pueblo.txd/des_adobewin1.dds\",\"gta3.img/des_clifftown.txd/des_adobewin1.dds\",\n \"gta3.img/des_pueblo.txd/des_adobedoor2.dds\",\"gta3.img/des_clifftown.txd/des_adobedoor2.dds\",\n \"gta3.img/des_ntown.txd/des_dam_wins.dds\",\"gta3.img/des_cn2_dam.txd/des_dam_wins.dds\",\n \"gta3.img/des_nwtown.txd/des_dam_wins.dds\",\"gta3.img/des_cn2_dam.txd/des_dam_wins.dds\",\n \"gta3.img/des_wdam.txd/des_dam_wins.dds\",\"gta3.img/des_cn2_dam.txd/des_dam_wins.dds\",\n \"gta3.img/des_wdam.txd/des_dam_detail1.dds\",\"gta3.img/des_cn2_dam.txd/des_dam_detail1.dds\",\n \"gta3.img/laeroads2s.txd/pierdoor01_law.dds\",\"gta3.img/des_damquay.txd/pierdoor01_law.dds\",\n \"gta3.img/pierc_law2.txd/pierdoor01_law.dds\",\"gta3.img/des_damquay.txd/pierdoor01_law.dds\",\n \"gta3.img/des_ntown.txd/des_creamshopdoor.dds\",\"gta3.img/des_damquay.txd/des_creamshopdoor.dds\",\n \"gta3.img/des_nwtownclinic.txd/des_creamshopdoor.dds\",\"gta3.img/des_damquay.txd/des_creamshopdoor.dds\",\n \"gta3.img/des_nwtown.txd/des_creamshopdoor.dds\",\"gta3.img/des_damquay.txd/des_creamshopdoor.dds\",\n \"gta3.img/des_nwtownw.txd/des_creamshopdoor.dds\",\"gta3.img/des_damquay.txd/des_creamshopdoor.dds\",\n \"gta3.img/des_steakhouse.txd/des_creamshopdoor.dds\",\"gta3.img/des_damquay.txd/des_creamshopdoor.dds\",\n \"gta3.img/des_stownmain1.txd/des_creamshopdoor.dds\",\"gta3.img/des_damquay.txd/des_creamshopdoor.dds\",\n \"gta3.img/des_stownstrip2.txd/des_creamshopdoor.dds\",\"gta3.img/des_damquay.txd/des_creamshopdoor.dds\",\n \"gta3.img/des_wtownmain.txd/des_creamshopdoor.dds\",\"gta3.img/des_damquay.txd/des_creamshopdoor.dds\",\n \"gta3.img/sw_apartflatx.txd/sw_dinewin.dds\",\"gta3.img/des_damquay.txd/sw_dinewin.dds\",\n \"gta3.img/sw_diner1.txd/sw_dinewin.dds\",\"gta3.img/des_damquay.txd/sw_dinewin.dds\",\n \"gta3.img/des_stownmain3.txd/des_radiomast.dds\",\"gta3.img/desertmisc.txd/des_radiomast.dds\",\n \"gta3.img/gravblokmast.txd/des_radiomast.dds\",\"gta3.img/desertmisc.txd/des_radiomast.dds\",\n \"gta3.img/hospital_lae.txd/des_radiomast.dds\",\"gta3.img/desertmisc.txd/des_radiomast.dds\",\n \"gta3.img/laradarmast.txd/des_radiomast.dds\",\"gta3.img/desertmisc.txd/des_radiomast.dds\",\n \"gta3.img/wong_twx.txd/des_radiomast.dds\",\"gta3.img/desertmisc.txd/des_radiomast.dds\",\n \"gta3.img/desn2_minestuff.txd/des_redrock2.dds\",\"gta3.img/desert.txd/des_redrock2.dds\",\n \"gta3.img/desn_desert.txd/des_redrock2.dds\",\"gta3.img/desert.txd/des_redrock2.dds\",\n \"gta3.img/des_se1.txd/des_redrock2.dds\",\"gta3.img/desert.txd/des_redrock2.dds\",\n \"gta3.img/desn_desert.txd/des_redrock1.dds\",\"gta3.img/desert.txd/des_redrock1.dds\",\n \"gta3.img/des_quarrybelts.txd/sm_quarry_conv_belt_empty.dds\",\"gta3.img/des_factory.txd/sm_quarry_conv_belt_empty.dds\",\n \"gta3.img/des_quarrybits.txd/sm_quarry_conv_belt_empty.dds\",\"gta3.img/des_factory.txd/sm_quarry_conv_belt_empty.dds\",\n \"gta3.img/des_geyser.txd/sm_quarry_crusher1.dds\",\"gta3.img/des_factory.txd/sm_quarry_crusher1.dds\",\n \"gta3.img/des_nwtown.txd/sm_quarry_crusher1.dds\",\"gta3.img/des_factory.txd/sm_quarry_crusher1.dds\",\n \"gta3.img/des_quarrybelts.txd/sm_quarry_crusher1.dds\",\"gta3.img/des_factory.txd/sm_quarry_crusher1.dds\",\n \"gta3.img/des_quarrybits.txd/sm_quarry_crusher1.dds\",\"gta3.img/des_factory.txd/sm_quarry_crusher1.dds\",\n \"gta3.img/des_refinery.txd/sm_quarry_crusher1.dds\",\"gta3.img/des_factory.txd/sm_quarry_crusher1.dds\",\n \"gta3.img/quarry.txd/sm_quarry_crusher1.dds\",\"gta3.img/des_factory.txd/sm_quarry_crusher1.dds\",\n \"gta3.img/refinery.txd/sm_quarry_crusher1.dds\",\"gta3.img/des_factory.txd/sm_quarry_crusher1.dds\",\n \"gta3.img/des_quarrybits.txd/des_facwin.dds\",\"gta3.img/des_factory.txd/des_facwin.dds\",\n \"gta3.img/des_telescopestuff.txd/dish_cylinder_a.dds\",\"gta3.img/des_factory.txd/dish_cylinder_a.dds\",\n \"gta3.img/des_ntown.txd/sjmbigold1.dds\",\"gta3.img/des_geyser.txd/sjmbigold1.dds\",\n \"gta3.img/des_nwtown.txd/sjmbigold1.dds\",\"gta3.img/des_geyser.txd/sjmbigold1.dds\",\n \"gta3.img/des_nwtownw.txd/sjmbigold1.dds\",\"gta3.img/des_geyser.txd/sjmbigold1.dds\",\n \"gta3.img/weefarmcuntw.txd/sjmbigold1.dds\",\"gta3.img/des_geyser.txd/sjmbigold1.dds\",\n \"gta3.img/des_stownmain1.txd/woodenpanels256.dds\",\"gta3.img/des_gunclub.txd/woodenpanels256.dds\",\n \"gta3.img/des_stownmain2.txd/woodenpanels256.dds\",\"gta3.img/des_gunclub.txd/woodenpanels256.dds\",\n \"gta3.img/des_stownstrip1.txd/woodenpanels256.dds\",\"gta3.img/des_gunclub.txd/woodenpanels256.dds\",\n \"gta3.img/mtbtrackcs_t.txd/cw2_mountboards1.dds\",\"gta3.img/desn2_minestuff.txd/cw2_mountboards1.dds\",\n \"gta3.img/santamonhus1.txd/pierwall06_law.dds\",\"gta3.img/desn2_peckers.txd/pierwall06_law.dds\",\n \"gta3.img/w_town3cs_t.txd/pierwall06_law.dds\",\"gta3.img/desn2_peckers.txd/pierwall06_law.dds\",\n \"gta3.img/law_coffinmu.txd/tarp_law.dds\",\"gta3.img/desn2_peckers.txd/tarp_law.dds\",\n \"gta3.img/exclibrland.txd/vgs_shopwall02_128.dds\",\"gta3.img/desn2_peckers.txd/vgs_shopwall02_128.dds\",\n \"gta3.img/vgs_shops.txd/vgs_shopwall02_128.dds\",\"gta3.img/desn2_peckers.txd/vgs_shopwall02_128.dds\",\n \"gta3.img/shops01_law.txd/simplewall256.dds\",\"gta3.img/desn2_stud.txd/simplewall256.dds\",\n \"gta3.img/vegashse4.txd/simplewall256.dds\",\"gta3.img/desn2_stud.txd/simplewall256.dds\",\n \"gta3.img/vegirlfr01.txd/simplewall256.dds\",\"gta3.img/desn2_stud.txd/simplewall256.dds\",\n \"gta3.img/vgssairport02.txd/simplewall256.dds\",\"gta3.img/desn2_stud.txd/simplewall256.dds\",\n \"gta3.img/tempo22_law.txd/sw_wind17.dds\",\"gta3.img/desn2_truckstop.txd/sw_wind17.dds\",\n \"gta3.img/vgsswarehse02c.txd/sw_wind17.dds\",\"gta3.img/desn2_truckstop.txd/sw_wind17.dds\",\n \"gta3.img/vgsswrehse03.txd/sw_wind17.dds\",\"gta3.img/desn2_truckstop.txd/sw_wind17.dds\",\n \"gta3.img/w_town3cs_t.txd/sw_wind17.dds\",\"gta3.img/desn2_truckstop.txd/sw_wind17.dds\",\n \"gta3.img/lahillshilhs1c.txd/roof04l256.dds\",\"gta3.img/desn2_truckstop.txd/roof04l256.dds\",\n \"gta3.img/lahillshilhs1x.txd/roof04l256.dds\",\"gta3.img/desn2_truckstop.txd/roof04l256.dds\",\n \"gta3.img/lanbloki.txd/roof04l256.dds\",\"gta3.img/desn2_truckstop.txd/roof04l256.dds\",\n \"gta3.img/lodvgswestout.txd/roof04l256.dds\",\"gta3.img/desn2_truckstop.txd/roof04l256.dds\",\n \"gta3.img/pierc_law2.txd/roof04l256.dds\",\"gta3.img/desn2_truckstop.txd/roof04l256.dds\",\n \"gta3.img/stripshop1.txd/roof04l256.dds\",\"gta3.img/desn2_truckstop.txd/roof04l256.dds\",\n \"gta3.img/vegashse2.txd/roof04l256.dds\",\"gta3.img/desn2_truckstop.txd/roof04l256.dds\",\n \"gta3.img/vegashselod1.txd/roof04l256.dds\",\"gta3.img/desn2_truckstop.txd/roof04l256.dds\",\n \"gta3.img/vegastemp1.txd/roof04l256.dds\",\"gta3.img/desn2_truckstop.txd/roof04l256.dds\",\n \"gta3.img/vgeretail1.txd/roof04l256.dds\",\"gta3.img/desn2_truckstop.txd/roof04l256.dds\",\n \"gta3.img/vgndwntwn23.txd/roof04l256.dds\",\"gta3.img/desn2_truckstop.txd/roof04l256.dds\",\n \"gta3.img/vgndwntwn5.txd/roof04l256.dds\",\"gta3.img/desn2_truckstop.txd/roof04l256.dds\",\n \"gta3.img/vgnretail4.txd/roof04l256.dds\",\"gta3.img/desn2_truckstop.txd/roof04l256.dds\",\n \"gta3.img/vgnretail5.txd/roof04l256.dds\",\"gta3.img/desn2_truckstop.txd/roof04l256.dds\",\n \"gta3.img/vgnretail6.txd/roof04l256.dds\",\"gta3.img/desn2_truckstop.txd/roof04l256.dds\",\n \"gta3.img/vgnretail7.txd/roof04l256.dds\",\"gta3.img/desn2_truckstop.txd/roof04l256.dds\",\n \"gta3.img/vgsebuild01.txd/roof04l256.dds\",\"gta3.img/desn2_truckstop.txd/roof04l256.dds\",\n \"gta3.img/vgsebuild02.txd/roof04l256.dds\",\"gta3.img/desn2_truckstop.txd/roof04l256.dds\",\n \"gta3.img/wshxrefhse.txd/roof04l256.dds\",\"gta3.img/desn2_truckstop.txd/roof04l256.dds\",\n \"gta3.img/w_town3cs_t.txd/roof04l256.dds\",\"gta3.img/desn2_truckstop.txd/roof04l256.dds\",\n \"gta3.img/garage_sfw.txd/ws_xenon_1.dds\",\"gta3.img/desn2_truckstop.txd/ws_xenon_1.dds\",\n \"gta3.img/sw_fact02alt.txd/ws_xenon_1.dds\",\"gta3.img/desn2_truckstop.txd/ws_xenon_1.dds\",\n \"gta3.img/vgegassign.txd/ws_xenon_1.dds\",\"gta3.img/desn2_truckstop.txd/ws_xenon_1.dds\",\n \"gta3.img/vgnbballsign2.txd/ws_xenon_1.dds\",\"gta3.img/desn2_truckstop.txd/ws_xenon_1.dds\",\n \"gta3.img/vgngassign.txd/ws_xenon_1.dds\",\"gta3.img/desn2_truckstop.txd/ws_xenon_1.dds\",\n \"gta3.img/vgnretail72.txd/ws_xenon_1.dds\",\"gta3.img/desn2_truckstop.txd/ws_xenon_1.dds\",\n \"gta3.img/xenon_sfse.txd/ws_xenon_1.dds\",\"gta3.img/desn2_truckstop.txd/ws_xenon_1.dds\",\n \"gta3.img/imrancomp_las2.txd/girder2_red_64hv.dds\",\"gta3.img/des_nbridge.txd/girder2_red_64hv.dds\",\n \"gta_int.img/genintwarehsint3.txd/girder2_red_64hv.dds\",\"gta3.img/des_nbridge.txd/girder2_red_64hv.dds\",\n \"gta_int.img/smashtv.txd/girder2_red_64hv.dds\",\"gta3.img/des_nbridge.txd/girder2_red_64hv.dds\",\n \"gta3.img/w_town2cs_t.txd/wallwhtwind256.dds\",\"gta3.img/desn_decocafe.txd/wallwhtwind256.dds\",\n \"gta_int.img/inneroval.txd/wallwhtwind256.dds\",\"gta3.img/desn_decocafe.txd/wallwhtwind256.dds\",\n \"gta_int.img/ovalsurround.txd/wallwhtwind256.dds\",\"gta3.img/desn_decocafe.txd/wallwhtwind256.dds\",\n \"gta_int.img/stadstunt.txd/wallwhtwind256.dds\",\"gta3.img/desn_decocafe.txd/wallwhtwind256.dds\",\n \"gta3.img/des_nw2.txd/des_yelrock.dds\",\"gta3.img/des_ne.txd/des_yelrock.dds\",\n \"gta3.img/des_nw.txd/des_yelrock.dds\",\"gta3.img/des_ne.txd/des_yelrock.dds\",\n \"gta3.img/des_sw.txd/des_yelrock.dds\",\"gta3.img/des_ne.txd/des_yelrock.dds\",\n \"gta3.img/des_se4.txd/venturas_fwend.dds\",\"gta3.img/des_ne.txd/venturas_fwend.dds\",\n \"gta3.img/des_se4.txd/tar_venturasjoin.dds\",\"gta3.img/des_ne.txd/tar_venturasjoin.dds\",\n \"gta3.img/des_se4.txd/vgs_rockwall01_128.dds\",\"gta3.img/des_ne.txd/vgs_rockwall01_128.dds\",\n \"gta3.img/lawnabv.txd/vgs_rockwall01_128.dds\",\"gta3.img/des_ne.txd/vgs_rockwall01_128.dds\",\n \"gta3.img/miragecasino2.txd/vgs_rockwall01_128.dds\",\"gta3.img/des_ne.txd/vgs_rockwall01_128.dds\",\n \"gta3.img/vgncircir.txd/vgs_rockwall01_128.dds\",\"gta3.img/des_ne.txd/vgs_rockwall01_128.dds\",\n \"gta3.img/des_quarry.txd/des_dirt2stones.dds\",\"gta3.img/des_ne.txd/des_dirt2stones.dds\",\n \"gta3.img/des_se4.txd/des_dirt2stones.dds\",\"gta3.img/des_ne.txd/des_dirt2stones.dds\",\n \"gta3.img/des_s.txd/des_dirt2stones.dds\",\"gta3.img/des_ne.txd/des_dirt2stones.dds\",\n \"gta3.img/des_se3.txd/des_dirttrackx.dds\",\"gta3.img/des_ne.txd/des_dirttrackx.dds\",\n \"gta3.img/des_n.txd/des_roadedge1.dds\",\"gta3.img/des_ne.txd/des_roadedge1.dds\",\n \"gta3.img/des_nw2.txd/des_roadedge1.dds\",\"gta3.img/des_ne.txd/des_roadedge1.dds\",\n \"gta3.img/des_nw.txd/des_roadedge1.dds\",\"gta3.img/des_ne.txd/des_roadedge1.dds\",\n \"gta3.img/des_se4.txd/des_roadedge1.dds\",\"gta3.img/des_ne.txd/des_roadedge1.dds\",\n \"gta3.img/des_s.txd/des_roadedge1.dds\",\"gta3.img/des_ne.txd/des_roadedge1.dds\",\n \"gta3.img/des_sw.txd/des_roadedge1.dds\",\"gta3.img/des_ne.txd/des_roadedge1.dds\",\n \"gta3.img/des_se1.txd/des_dirtgravel.dds\",\"gta3.img/des_ne.txd/des_dirtgravel.dds\",\n \"gta3.img/des_se2.txd/des_dirtgravel.dds\",\"gta3.img/des_ne.txd/des_dirtgravel.dds\",\n \"gta3.img/des_se3.txd/des_dirtgravel.dds\",\"gta3.img/des_ne.txd/des_dirtgravel.dds\",\n \"gta3.img/vgwestcoast.txd/des_dirtgravel.dds\",\"gta3.img/des_ne.txd/des_dirtgravel.dds\",\n \"gta3.img/vgwestland.txd/des_dirtgravel.dds\",\"gta3.img/des_ne.txd/des_dirtgravel.dds\",\n \"gta3.img/des_ntown.txd/des_metalwinbig.dds\",\"gta3.img/des_nstuff.txd/des_metalwinbig.dds\",\n \"gta3.img/des_nwtownpolice.txd/des_metalwinbig.dds\",\"gta3.img/des_nstuff.txd/des_metalwinbig.dds\",\n \"gta3.img/des_stownmain1.txd/des_tepesign.dds\",\"gta3.img/desn_teepee.txd/des_tepesign.dds\",\n \"gta3.img/des_stwnsigns1.txd/des_tepesign.dds\",\"gta3.img/desn_teepee.txd/des_tepesign.dds\",\n \"gta3.img/des_teepee.txd/des_tepesign.dds\",\"gta3.img/desn_teepee.txd/des_tepesign.dds\",\n \"gta3.img/des_nwtownclinic.txd/des_creamshopwin.dds\",\"gta3.img/des_ntown.txd/des_creamshopwin.dds\",\n \"gta3.img/des_nwtown.txd/des_creamshopwin.dds\",\"gta3.img/des_ntown.txd/des_creamshopwin.dds\",\n \"gta3.img/des_nwtownw.txd/des_creamshopwin.dds\",\"gta3.img/des_ntown.txd/des_creamshopwin.dds\",\n \"gta3.img/des_steakhouse.txd/des_creamshopwin.dds\",\"gta3.img/des_ntown.txd/des_creamshopwin.dds\",\n \"gta3.img/des_stownmain1.txd/des_creamshopwin.dds\",\"gta3.img/des_ntown.txd/des_creamshopwin.dds\",\n \"gta3.img/des_stownstrip2.txd/des_creamshopwin.dds\",\"gta3.img/des_ntown.txd/des_creamshopwin.dds\",\n \"gta3.img/des_wtownmain.txd/des_creamshopwin.dds\",\"gta3.img/des_ntown.txd/des_creamshopwin.dds\",\n \"gta3.img/des_wtownmain.txd/des_ntwnwin4.dds\",\"gta3.img/des_ntown.txd/des_ntwnwin4.dds\",\n \"gta3.img/oldwest.txd/des_ntwndoor3.dds\",\"gta3.img/des_ntown.txd/des_ntwndoor3.dds\",\n \"gta3.img/factorycuntw.txd/alleydoor1.dds\",\"gta3.img/desn_trainstuff.txd/alleydoor1.dds\",\n \"gta3.img/tvtower_sfs.txd/alleydoor1.dds\",\"gta3.img/desn_trainstuff.txd/alleydoor1.dds\",\n \"gta3.img/vgnpwrmainbld.txd/alleydoor1.dds\",\"gta3.img/desn_trainstuff.txd/alleydoor1.dds\",\n \"gta3.img/vgnpwroutbld2.txd/alleydoor1.dds\",\"gta3.img/desn_trainstuff.txd/alleydoor1.dds\",\n \"gta3.img/vgsebuild01.txd/alleydoor1.dds\",\"gta3.img/desn_trainstuff.txd/alleydoor1.dds\",\n \"gta3.img/freeways_sfse.txd/ws_tunnelwall2smoked.dds\",\"gta3.img/desn_trainstuff.txd/ws_tunnelwall2smoked.dds\",\n \"gta3.img/garage_sfw.txd/ws_xenon_3.dds\",\"gta3.img/desn_truckstop.txd/ws_xenon_3.dds\",\n \"gta3.img/vgegassign.txd/ws_xenon_3.dds\",\"gta3.img/desn_truckstop.txd/ws_xenon_3.dds\",\n \"gta3.img/vgngassign.txd/ws_xenon_3.dds\",\"gta3.img/desn_truckstop.txd/ws_xenon_3.dds\",\n \"gta3.img/vgnretail72.txd/ws_xenon_3.dds\",\"gta3.img/desn_truckstop.txd/ws_xenon_3.dds\",\n \"gta3.img/xenon_sfse.txd/ws_xenon_3.dds\",\"gta3.img/desn_truckstop.txd/ws_xenon_3.dds\",\n \"gta_int.img/cj_bar2.txd/gb_nastybar15.dds\",\"gta3.img/desn_truckstop.txd/gb_nastybar15.dds\",\n \"gta_int.img/genintintsmallrest.txd/gb_nastybar15.dds\",\"gta3.img/desn_truckstop.txd/gb_nastybar15.dds\",\n \"gta3.img/garage_sfw.txd/ws_xenon_2.dds\",\"gta3.img/desn_truckstop.txd/ws_xenon_2.dds\",\n \"gta3.img/vgegassign.txd/ws_xenon_2.dds\",\"gta3.img/desn_truckstop.txd/ws_xenon_2.dds\",\n \"gta3.img/vgngassign.txd/ws_xenon_2.dds\",\"gta3.img/desn_truckstop.txd/ws_xenon_2.dds\",\n \"gta3.img/vgnretail72.txd/ws_xenon_2.dds\",\"gta3.img/desn_truckstop.txd/ws_xenon_2.dds\",\n \"gta3.img/xenon_sfse.txd/ws_xenon_2.dds\",\"gta3.img/desn_truckstop.txd/ws_xenon_2.dds\",\n \"gta_int.img/ovalsurround.txd/motocross_256.dds\",\"gta3.img/des_n.txd/motocross_256.dds\",\n \"gta_int.img/stadstunt.txd/motocross_256.dds\",\"gta3.img/des_n.txd/motocross_256.dds\",\n \"gta3.img/des_s.txd/pavebsandend.dds\",\"gta3.img/des_n.txd/pavebsandend.dds\",\n \"gta3.img/des_se3.txd/drvin_ground1.dds\",\"gta3.img/des_n.txd/drvin_ground1.dds\",\n \"gta3.img/des_s.txd/drvin_ground1.dds\",\"gta3.img/des_n.txd/drvin_ground1.dds\",\n \"gta3.img/des_sw.txd/drvin_ground1.dds\",\"gta3.img/des_n.txd/drvin_ground1.dds\",\n \"gta3.img/des_nw.txd/des_grass2scrub.dds\",\"gta3.img/des_nw2.txd/des_grass2scrub.dds\",\n \"gta3.img/vgsecoast.txd/des_grass2scrub.dds\",\"gta3.img/des_nw2.txd/des_grass2scrub.dds\",\n \"gta3.img/vgssland02.txd/des_grass2scrub.dds\",\"gta3.img/des_nw2.txd/des_grass2scrub.dds\",\n \"gta3.img/lahillsla_roads.txd/cuntroad01_law.dds\",\"gta3.img/des_nw2.txd/cuntroad01_law.dds\",\n \"gta3.img/law2_roadsb.txd/cuntroad01_law.dds\",\"gta3.img/des_nw2.txd/cuntroad01_law.dds\",\n \"gta3.img/law_beach1.txd/cuntroad01_law.dds\",\"gta3.img/des_nw2.txd/cuntroad01_law.dds\",\n \"gta3.img/law_beach2.txd/cuntroad01_law.dds\",\"gta3.img/des_nw2.txd/cuntroad01_law.dds\",\n \"gta3.img/piera_law2.txd/cuntroad01_law.dds\",\"gta3.img/des_nw2.txd/cuntroad01_law.dds\",\n \"gta3.img/pierb_law2.txd/cuntroad01_law.dds\",\"gta3.img/des_nw2.txd/cuntroad01_law.dds\",\n \"gta3.img/pierc_law2.txd/cuntroad01_law.dds\",\"gta3.img/des_nw2.txd/cuntroad01_law.dds\",\n \"gta3.img/roads_law.txd/cuntroad01_law.dds\",\"gta3.img/des_nw2.txd/cuntroad01_law.dds\",\n \"gta3.img/santamonicalaw2.txd/cuntroad01_law.dds\",\"gta3.img/des_nw2.txd/cuntroad01_law.dds\",\n \"gta3.img/des_nw.txd/des_roadedge2.dds\",\"gta3.img/des_nw2.txd/des_roadedge2.dds\",\n \"gta3.img/des_se4.txd/des_roadedge2.dds\",\"gta3.img/des_nw2.txd/des_roadedge2.dds\",\n \"gta3.img/des_s.txd/des_roadedge2.dds\",\"gta3.img/des_nw2.txd/des_roadedge2.dds\",\n \"gta3.img/des_sw.txd/des_roadedge2.dds\",\"gta3.img/des_nw2.txd/des_roadedge2.dds\",\n \"gta3.img/des_nw.txd/des_grass2dirt1.dds\",\"gta3.img/des_nw2.txd/des_grass2dirt1.dds\",\n \"gta3.img/des_se4.txd/des_grass2dirt1.dds\",\"gta3.img/des_nw2.txd/des_grass2dirt1.dds\",\n \"gta3.img/des_sw.txd/des_grass2dirt1.dds\",\"gta3.img/des_nw2.txd/des_grass2dirt1.dds\",\n \"gta3.img/pierb_law2.txd/brdwalkwater_la.dds\",\"gta3.img/des_nwstuff.txd/brdwalkwater_la.dds\",\n \"gta3.img/pierc_law2.txd/brdwalkwater_la.dds\",\"gta3.img/des_nwstuff.txd/brdwalkwater_la.dds\",\n \"gta3.img/des_stownmain2.txd/des_sheriffsign.dds\",\"gta3.img/des_nwtownpolice.txd/des_sheriffsign.dds\",\n \"gta3.img/des_stownmain2.txd/des_hotelsigns.dds\",\"gta3.img/des_nwtown.txd/des_hotelsigns.dds\",\n \"gta3.img/des_nwtownw.txd/gymtop1c_lae.dds\",\"gta3.img/des_nwtown.txd/gymtop1c_lae.dds\",\n \"gta3.img/lawnabv.txd/gymtop1c_lae.dds\",\"gta3.img/des_nwtown.txd/gymtop1c_lae.dds\",\n \"gta3.img/des_nwtownw.txd/gymtop1b_lae.dds\",\"gta3.img/des_nwtown.txd/gymtop1b_lae.dds\",\n \"gta3.img/des_nwtownw.txd/des_woodshopdoor1.dds\",\"gta3.img/des_nwtown.txd/des_woodshopdoor1.dds\",\n \"gta3.img/des_wtownmain.txd/des_woodshopdoor1.dds\",\"gta3.img/des_nwtown.txd/des_woodshopdoor1.dds\",\n \"gta3.img/des_nwtownw.txd/des_woodshopwin1.dds\",\"gta3.img/des_nwtown.txd/des_woodshopwin1.dds\",\n \"gta3.img/des_wtownmain.txd/des_woodshopwin1.dds\",\"gta3.img/des_nwtown.txd/des_woodshopwin1.dds\",\n \"gta3.img/des_nwtownw.txd/des_greendoor.dds\",\"gta3.img/des_nwtown.txd/des_greendoor.dds\",\n \"gta3.img/des_wtownmain.txd/des_greendoor.dds\",\"gta3.img/des_nwtown.txd/des_greendoor.dds\",\n \"gta3.img/des_nwtownw.txd/des_greenwin.dds\",\"gta3.img/des_nwtown.txd/des_greenwin.dds\",\n \"gta3.img/des_stownmain1.txd/des_greenwin.dds\",\"gta3.img/des_nwtown.txd/des_greenwin.dds\",\n \"gta3.img/des_wtownmain.txd/des_nwwatower.dds\",\"gta3.img/des_nwtown.txd/des_nwwatower.dds\",\n \"gta3.img/rodeo05_law2.txd/gymtop1_lae.dds\",\"gta3.img/des_nwtown.txd/gymtop1_lae.dds\",\n \"gta3.img/sunrise01_lawn.txd/gymtop1_lae.dds\",\"gta3.img/des_nwtown.txd/gymtop1_lae.dds\",\n \"gta3.img/sunrise11_lawn.txd/gymtop1_lae.dds\",\"gta3.img/des_nwtown.txd/gymtop1_lae.dds\",\n \"gta3.img/des_stownmots1.txd/des_rosmot1.dds\",\"gta3.img/des_nwtownw.txd/des_rosmot1.dds\",\n \"gta3.img/refinery.txd/des_reftower2.dds\",\"gta3.img/des_oilfield.txd/des_reftower2.dds\",\n \"gta3.img/des_quarrybits.txd/sm_quarry_crusher2.dds\",\"gta3.img/des_quarrybelts.txd/sm_quarry_crusher2.dds\",\n \"gta3.img/des_quarrycrane.txd/sm_quarry_crusher2.dds\",\"gta3.img/des_quarrybelts.txd/sm_quarry_crusher2.dds\",\n \"gta3.img/quarry.txd/sm_quarry_crusher2.dds\",\"gta3.img/des_quarrybelts.txd/sm_quarry_crusher2.dds\",\n \"gta3.img/refinery.txd/sm_quarry_crusher2.dds\",\"gta3.img/des_quarrybelts.txd/sm_quarry_crusher2.dds\",\n \"gta3.img/des_quarrybits.txd/sm_quarry_conv_belt.dds\",\"gta3.img/des_quarrybelts.txd/sm_quarry_conv_belt.dds\",\n \"gta3.img/des_quarrybits.txd/sm_quarry_handrail.dds\",\"gta3.img/des_quarrybelts.txd/sm_quarry_handrail.dds\",\n \"gta3.img/quarry.txd/sm_quarry_handrail.dds\",\"gta3.img/des_quarrybelts.txd/sm_quarry_handrail.dds\",\n \"gta3.img/des_quarrybits.txd/sjmlawarwall5.dds\",\"gta3.img/des_quarrybelts.txd/sjmlawarwall5.dds\",\n \"gta3.img/ground4_las.txd/sjmlawarwall5.dds\",\"gta3.img/des_quarrybelts.txd/sjmlawarwall5.dds\",\n \"gta3.img/imrancomp_las2.txd/sjmlawarwall5.dds\",\"gta3.img/des_quarrybelts.txd/sjmlawarwall5.dds\",\n \"gta3.img/kbgarage_las2.txd/sjmlawarwall5.dds\",\"gta3.img/des_quarrybelts.txd/sjmlawarwall5.dds\",\n \"gta3.img/kbgarage_las.txd/sjmlawarwall5.dds\",\"gta3.img/des_quarrybelts.txd/sjmlawarwall5.dds\",\n \"gta3.img/lasground2_las2.txd/sjmlawarwall5.dds\",\"gta3.img/des_quarrybelts.txd/sjmlawarwall5.dds\",\n \"gta3.img/quarry.txd/sjmlawarwall5.dds\",\"gta3.img/des_quarrybelts.txd/sjmlawarwall5.dds\",\n \"gta3.img/sjmla_las.txd/sjmlawarwall5.dds\",\"gta3.img/des_quarrybelts.txd/sjmlawarwall5.dds\",\n \"gta_int.img/genintwarehsint3.txd/sjmlawarwall5.dds\",\"gta3.img/des_quarrybelts.txd/sjmlawarwall5.dds\",\n \"gta_int.img/smashtv.txd/sjmlawarwall5.dds\",\"gta3.img/des_quarrybelts.txd/sjmlawarwall5.dds\",\n \"gta3.img/quarry.txd/sm_crusher_rollers.dds\",\"gta3.img/des_quarrybits.txd/sm_crusher_rollers.dds\",\n \"gta3.img/quarry.txd/redvertical_64hv.dds\",\"gta3.img/des_quarrybits.txd/redvertical_64hv.dds\",\n \"gta3.img/des_quarry.txd/des_quarryrdr.dds\",\"gta3.img/des_quarrybits.txd/des_quarryrdr.dds\",\n \"gta3.img/des_quarry.txd/des_quarryrd.dds\",\"gta3.img/des_quarrybits.txd/des_quarryrd.dds\",\n \"gta3.img/des_quarry.txd/des_quarryrdl.dds\",\"gta3.img/des_quarrybits.txd/des_quarryrdl.dds\",\n \"gta3.img/des_stownmots1.txd/quar_cranerail.dds\",\"gta3.img/des_quarrycrane.txd/quar_cranerail.dds\",\n \"gta3.img/dockcargo1_las.txd/lasdkcrtgr1111.dds\",\"gta3.img/des_quarry.txd/lasdkcrtgr1111.dds\",\n \"gta3.img/dockcargof_las.txd/lasdkcrtgr1111.dds\",\"gta3.img/des_quarry.txd/lasdkcrtgr1111.dds\",\n \"gta3.img/stormdrain_las2.txd/lasdkcrtgr1111.dds\",\"gta3.img/des_quarry.txd/lasdkcrtgr1111.dds\",\n \"gta3.img/dockcargo1_las.txd/lasdkcrtgr1ssss.dds\",\"gta3.img/des_quarry.txd/lasdkcrtgr1ssss.dds\",\n \"gta3.img/dockcargof_las.txd/lasdkcrtgr1ssss.dds\",\"gta3.img/des_quarry.txd/lasdkcrtgr1ssss.dds\",\n \"gta3.img/stormdrain_las2.txd/lasdkcrtgr1ssss.dds\",\"gta3.img/des_quarry.txd/lasdkcrtgr1ssss.dds\",\n \"gta3.img/sw_block03.txd/desgrns256.dds\",\"gta3.img/des_quarry.txd/desgrns256.dds\",\n \"gta3.img/des_ufoinn.txd/newindow11128.dds\",\"gta3.img/des_ranch.txd/newindow11128.dds\",\n \"gta3.img/furniture_lae2.txd/newindow11128.dds\",\"gta3.img/des_ranch.txd/newindow11128.dds\",\n \"gta3.img/des_xoilfield.txd/des_pylon2.dds\",\"gta3.img/des_refinery.txd/des_pylon2.dds\",\n \"gta3.img/factorycuntw.txd/des_pylon2.dds\",\"gta3.img/des_refinery.txd/des_pylon2.dds\",\n \"gta3.img/laealpha.txd/des_pylon2.dds\",\"gta3.img/des_refinery.txd/des_pylon2.dds\",\n \"gta3.img/pylons.txd/des_pylon2.dds\",\"gta3.img/des_refinery.txd/des_pylon2.dds\",\n \"gta3.img/des_se3.txd/des_dirt2dedgrass.dds\",\"gta3.img/des_se2.txd/des_dirt2dedgrass.dds\",\n \"gta3.img/des_stownmots1.txd/des_bullheid.dds\",\"gta3.img/des_steakhouse.txd/des_bullheid.dds\",\n \"gta3.img/des_stownmots1.txd/des_bull.dds\",\"gta3.img/des_steakhouse.txd/des_bull.dds\",\n \"gta3.img/des_stownmain1.txd/des_thrails.dds\",\"gta3.img/des_steakhouse.txd/des_thrails.dds\",\n \"gta3.img/lahillstxd1a.txd/roof10l256.dds\",\"gta3.img/des_stownmain1.txd/roof10l256.dds\",\n \"gta3.img/lanblokg.txd/roof10l256.dds\",\"gta3.img/des_stownmain1.txd/roof10l256.dds\",\n \"gta3.img/pierc_law2.txd/roof10l256.dds\",\"gta3.img/des_stownmain1.txd/roof10l256.dds\",\n \"gta3.img/vgnfremnt1.txd/roof10l256.dds\",\"gta3.img/des_stownmain1.txd/roof10l256.dds\",\n \"gta3.img/vgnfremnt2.txd/roof10l256.dds\",\"gta3.img/des_stownmain1.txd/roof10l256.dds\",\n \"gta3.img/vgnmall.txd/roof10l256.dds\",\"gta3.img/des_stownmain1.txd/roof10l256.dds\",\n \"gta3.img/vgnshopnmall.txd/roof10l256.dds\",\"gta3.img/des_stownmain1.txd/roof10l256.dds\",\n \"gta3.img/vgsebuild02.txd/roof10l256.dds\",\"gta3.img/des_stownmain1.txd/roof10l256.dds\",\n \"gta3.img/vgsnbuild07.txd/roof10l256.dds\",\"gta3.img/des_stownmain1.txd/roof10l256.dds\",\n \"gta3.img/w_town2cs_t.txd/roof10l256.dds\",\"gta3.img/des_stownmain1.txd/roof10l256.dds\",\n \"gta3.img/des_stownmain2.txd/des_roswin4.dds\",\"gta3.img/des_stownmain1.txd/des_roswin4.dds\",\n \"gta3.img/des_stownstrip2.txd/des_roswin4.dds\",\"gta3.img/des_stownmain1.txd/des_roswin4.dds\",\n \"gta3.img/des_stownmain2.txd/des_thwin2.dds\",\"gta3.img/des_stownmain1.txd/des_thwin2.dds\",\n \"gta3.img/des_stownstrip2.txd/des_roswin2.dds\",\"gta3.img/des_stownmain2.txd/des_roswin2.dds\",\n \"gta3.img/des_stownmots1.txd/sw_door19.dds\",\"gta3.img/des_stownmain2.txd/sw_door19.dds\",\n \"gta3.img/sw_block09.txd/sw_door19.dds\",\"gta3.img/des_stownmain2.txd/sw_door19.dds\",\n \"gta3.img/des_stownw.txd/newall11-1.dds\",\"gta3.img/des_stownmain3.txd/newall11-1.dds\",\n \"gta3.img/vgsebuild02.txd/newall11-1.dds\",\"gta3.img/des_stownmain3.txd/newall11-1.dds\",\n \"gta3.img/stormd_fill.txd/sw_metalgate1.dds\",\"gta3.img/des_stownstrip1.txd/sw_metalgate1.dds\",\n \"gta3.img/tvstudio_law2.txd/sw_metalgate1.dds\",\"gta3.img/des_stownstrip1.txd/sw_metalgate1.dds\",\n \"gta3.img/mtbtrackcs_t.txd/des_radiomast.dds\",\"gta3.img/des_stownstrip1.txd/des_radiomast.dds\",\n \"gta3.img/dingbat01_la.txd/yellowall_la.dds\",\"gta3.img/des_stownstrip2.txd/yellowall_la.dds\",\n \"gta3.img/gardencentre_sfs.txd/yellowall_la.dds\",\"gta3.img/des_stownstrip2.txd/yellowall_la.dds\",\n \"gta3.img/vegashse4.txd/yellowall_la.dds\",\"gta3.img/des_stownstrip2.txd/yellowall_la.dds\",\n \"gta3.img/vgsshospshop.txd/yellowall_la.dds\",\"gta3.img/des_stownstrip2.txd/yellowall_la.dds\",\n \"gta3.img/des_wtownmain.txd/des_banksign.dds\",\"gta3.img/des_stwnsigns1.txd/des_banksign.dds\",\n \"gta3.img/hosbibalsfw.txd/carparkdoor3_256.dds\",\"gta3.img/des_telescopestuff.txd/carparkdoor3_256.dds\",\n \"gta3.img/jeffers5a_lae.txd/poshentrance2_256.dds\",\"gta3.img/des_telescopestuff.txd/poshentrance2_256.dds\",\n \"gta3.img/lan2_gm1.txd/poshentrance2_256.dds\",\"gta3.img/des_telescopestuff.txd/poshentrance2_256.dds\",\n \"gta3.img/vgsnbuild07.txd/poshentrance2_256.dds\",\"gta3.img/des_telescopestuff.txd/poshentrance2_256.dds\",\n \"gta3.img/rodeo03_law2.txd/ws_palebrickwall1.dds\",\"gta3.img/des_telescopestuff.txd/ws_palebrickwall1.dds\",\n \"gta3.img/rodeost01_lax.txd/ws_palebrickwall1.dds\",\"gta3.img/des_telescopestuff.txd/ws_palebrickwall1.dds\",\n \"gta3.img/des_ufoinn.txd/stoneclad1.dds\",\"gta3.img/des_telescopestuff.txd/stoneclad1.dds\",\n \"gta3.img/dingbat01_la.txd/stoneclad1.dds\",\"gta3.img/des_telescopestuff.txd/stoneclad1.dds\",\n \"gta3.img/landhub.txd/stoneclad1.dds\",\"gta3.img/des_telescopestuff.txd/stoneclad1.dds\",\n \"gta3.img/jeffers4_lae.txd/metpat64shadow.dds\",\"gta3.img/des_trainstuff.txd/metpat64shadow.dds\",\n \"gta3.img/lasroads_las2.txd/metpat64shadow.dds\",\"gta3.img/des_trainstuff.txd/metpat64shadow.dds\",\n \"gta3.img/railtracklae.txd/metpat64shadow.dds\",\"gta3.img/des_trainstuff.txd/metpat64shadow.dds\",\n \"gta3.img/traintrack_las2.txd/metpat64shadow.dds\",\"gta3.img/des_trainstuff.txd/metpat64shadow.dds\",\n \"gta3.img/vgnrailroad.txd/metpat64shadow.dds\",\"gta3.img/des_trainstuff.txd/metpat64shadow.dds\",\n \"gta3.img/vgsrailroad.txd/metpat64shadow.dds\",\"gta3.img/des_trainstuff.txd/metpat64shadow.dds\",\n \"gta3.img/vgwestrailrd.txd/metpat64shadow.dds\",\"gta3.img/des_trainstuff.txd/metpat64shadow.dds\",\n \"gta3.img/railbridge_sfse.txd/ws_stoneblock.dds\",\"gta3.img/des_trainstuff.txd/ws_stoneblock.dds\",\n \"gta3.img/traintunnel1_sfse.txd/ws_stoneblock.dds\",\"gta3.img/des_trainstuff.txd/ws_stoneblock.dds\",\n \"gta3.img/traintrafficsign.txd/railxing3.dds\",\"gta3.img/des_trainstuff.txd/railxing3.dds\",\n \"gta3.img/furniture_lae2.txd/clukpost1_lae2.dds\",\"gta3.img/des_ufoinn.txd/clukpost1_lae2.dds\",\n \"gta3.img/lashops6_las2.txd/clukpost1_lae2.dds\",\"gta3.img/des_ufoinn.txd/clukpost1_lae2.dds\",\n \"gta3.img/shops2_law.txd/orange2.dds\",\"gta3.img/des_wtownmain.txd/orange2.dds\",\n \"gta3.img/indust_lax.txd/oilband_64.dds\",\"gta3.img/des_xoilfield.txd/oilband_64.dds\",\n \"gta3.img/lahillshilhs1d.txd/oilband_64.dds\",\"gta3.img/des_xoilfield.txd/oilband_64.dds\",\n \"gta3.img/ingame.txd/cj_w_grad.dds\",\"gta3.img/diamond.txd/cj_w_grad.dds\",\n \"gta3.img/eastls3_lae2.txd/comptwall20.dds\",\"gta3.img/dingbat01_la.txd/comptwall20.dds\",\n \"gta3.img/furniture_lae2.txd/comptwall20.dds\",\"gta3.img/dingbat01_la.txd/comptwall20.dds\",\n \"gta3.img/eastshops1_lae.txd/lapinkwall1.dds\",\"gta3.img/dingbat01_la.txd/lapinkwall1.dds\",\n \"gta3.img/melrose12_lawn.txd/lapinkwall1.dds\",\"gta3.img/dingbat01_la.txd/lapinkwall1.dds\",\n \"gta3.img/sunrise09_lawn.txd/mosaic1_lawn.dds\",\"gta3.img/dingbat01_la.txd/mosaic1_lawn.dds\",\n \"gta3.img/dockcargo2_las.txd/diamondp64.dds\",\"gta3.img/dkcargoshp_las2.txd/diamondp64.dds\",\n \"gta3.img/imrancompyard_las.txd/diamondp64.dds\",\"gta3.img/dkcargoshp_las2.txd/diamondp64.dds\",\n \"gta3.img/submarine.txd/diamondp64.dds\",\"gta3.img/dkcargoshp_las2.txd/diamondp64.dds\",\n \"gta3.img/hillhousex13_6.txd/wallbluetinge256.dds\",\"gta3.img/dkcargoshp_las2.txd/wallbluetinge256.dds\",\n \"gta3.img/lahillshilhs1b.txd/wallbluetinge256.dds\",\"gta3.img/dkcargoshp_las2.txd/wallbluetinge256.dds\",\n \"gta3.img/lahillshilhs1d.txd/wallbluetinge256.dds\",\"gta3.img/dkcargoshp_las2.txd/wallbluetinge256.dds\",\n \"gta3.img/lahillshilhs1z.txd/wallbluetinge256.dds\",\"gta3.img/dkcargoshp_las2.txd/wallbluetinge256.dds\",\n \"gta3.img/lahillshilhse.txd/wallbluetinge256.dds\",\"gta3.img/dkcargoshp_las2.txd/wallbluetinge256.dds\",\n \"gta3.img/newstuff_sfn.txd/wallbluetinge256.dds\",\"gta3.img/dkcargoshp_las2.txd/wallbluetinge256.dds\",\n \"gta3.img/queensammo_sfs.txd/wallbluetinge256.dds\",\"gta3.img/dkcargoshp_las2.txd/wallbluetinge256.dds\",\n \"gta3.img/vgnretail4.txd/wallbluetinge256.dds\",\"gta3.img/dkcargoshp_las2.txd/wallbluetinge256.dds\",\n \"gta3.img/lasxrefdock.txd/mp_cellwalla_256.dds\",\"gta3.img/dkcargoshp_las2.txd/mp_cellwalla_256.dds\",\n \"gta3.img/lasxrefdock.txd/mp_cellwall_256.dds\",\"gta3.img/dkcargoshp_las2.txd/mp_cellwall_256.dds\",\n \"gta3.img/freight_sfe.txd/boatrailing_128.dds\",\"gta3.img/dkcargoshp_las2.txd/boatrailing_128.dds\",\n \"gta3.img/frieghter2sfe.txd/boatrailing_128.dds\",\"gta3.img/dkcargoshp_las2.txd/boatrailing_128.dds\",\n \"gta3.img/docg01_lahills.txd/plaster256i.dds\",\"gta3.img/docg01alfa_lahills.txd/plaster256i.dds\",\n \"gta3.img/eastshops1_lae.txd/plaster256i.dds\",\"gta3.img/docg01alfa_lahills.txd/plaster256i.dds\",\n \"gta3.img/olympic01.txd/plaster256i.dds\",\"gta3.img/docg01alfa_lahills.txd/plaster256i.dds\",\n \"gta3.img/templae2land.txd/plaster256i.dds\",\"gta3.img/docg01alfa_lahills.txd/plaster256i.dds\",\n \"gta_int.img/madpoolbit.txd/marbletile8b.dds\",\"gta3.img/docg01_lahills.txd/marbletile8b.dds\",\n \"gta_int.img/sfhsmedium1.txd/marbletile8b.dds\",\"gta3.img/docg01_lahills.txd/marbletile8b.dds\",\n \"gta_int.img/traidman.txd/marbletile8b.dds\",\"gta3.img/docg01_lahills.txd/marbletile8b.dds\",\n \"gta3.img/gravblok01_lahills.txd/sw_mansionwin.dds\",\"gta3.img/docg01_lahills.txd/sw_mansionwin.dds\",\n \"gta3.img/lahills_safe1.txd/sw_mansionwin.dds\",\"gta3.img/docg01_lahills.txd/sw_mansionwin.dds\",\n \"gta3.img/garag3_lawn.txd/glassblock4_law.dds\",\"gta3.img/docg01_lahills.txd/glassblock4_law.dds\",\n \"gta3.img/sw_block9.txd/glassblock4_law.dds\",\"gta3.img/docg01_lahills.txd/glassblock4_law.dds\",\n \"gta3.img/vgsshospshop.txd/chr_flags_256.dds\",\"gta3.img/docg01_lahills.txd/chr_flags_256.dds\",\n \"gta_int.img/dr_gsnew.txd/ab_tile2.dds\",\"gta3.img/docg01_lahills.txd/ab_tile2.dds\",\n \"gta_int.img/gen_pol_vegas.txd/ab_tile2.dds\",\"gta3.img/docg01_lahills.txd/ab_tile2.dds\",\n \"gta_int.img/madbedrooms.txd/ab_tile2.dds\",\"gta3.img/docg01_lahills.txd/ab_tile2.dds\",\n \"gta_int.img/madpoolbit.txd/ab_tile2.dds\",\"gta3.img/docg01_lahills.txd/ab_tile2.dds\",\n \"gta_int.img/newcrak.txd/ab_tile2.dds\",\"gta3.img/docg01_lahills.txd/ab_tile2.dds\",\n \"gta_int.img/sweetsbits.txd/ab_tile2.dds\",\"gta3.img/docg01_lahills.txd/ab_tile2.dds\",\n \"gta3.img/xenon_sfse.txd/meshwiny.dds\",\"gta3.img/dockcargo1_las.txd/meshwiny.dds\",\n \"gta3.img/xrf_refineryla.txd/meshwiny.dds\",\"gta3.img/dockcargo1_las.txd/meshwiny.dds\",\n \"gta3.img/imrancomp_las2.txd/dt_ceiling1.dds\",\"gta3.img/dockcargo1_las.txd/dt_ceiling1.dds\",\n \"gta3.img/xenon_sfse.txd/dt_ceiling1.dds\",\"gta3.img/dockcargo1_las.txd/dt_ceiling1.dds\",\n \"gta_int.img/genintwarehsint3.txd/dt_ceiling1.dds\",\"gta3.img/dockcargo1_las.txd/dt_ceiling1.dds\",\n \"gta3.img/glenpark1x_lae.txd/sjmpostback.dds\",\"gta3.img/dockcargo1_las.txd/sjmpostback.dds\",\n \"gta3.img/snpedhusxref.txd/sjmpostback.dds\",\"gta3.img/dockcargo1_las.txd/sjmpostback.dds\",\n \"gta_int.img/lee_bdupsmain.txd/sjmpostback.dds\",\"gta3.img/dockcargo1_las.txd/sjmpostback.dds\",\n \"gta3.img/groundb_las2.txd/sanpedock2.dds\",\"gta3.img/dockcargo1_las.txd/sanpedock2.dds\",\n \"gta3.img/ground_las2.txd/sanpedock2.dds\",\"gta3.img/dockcargo1_las.txd/sanpedock2.dds\",\n \"gta3.img/lasxrefdock.txd/sanpedock2.dds\",\"gta3.img/dockcargo1_las.txd/sanpedock2.dds\",\n \"gta3.img/sw_sheds2.txd/sanpedock2.dds\",\"gta3.img/dockcargo1_las.txd/sanpedock2.dds\",\n \"gta3.img/groundb_las2.txd/sanpedock1.dds\",\"gta3.img/dockcargo1_las.txd/sanpedock1.dds\",\n \"gta3.img/ground_las2.txd/sanpedock1.dds\",\"gta3.img/dockcargo1_las.txd/sanpedock1.dds\",\n \"gta3.img/lasxrefdock.txd/sanpedock1.dds\",\"gta3.img/dockcargo1_las.txd/sanpedock1.dds\",\n \"gta3.img/sw_sheds2.txd/sanpedock1.dds\",\"gta3.img/dockcargo1_las.txd/sanpedock1.dds\",\n \"gta3.img/dockcargof_las.txd/lasdkcrtgr1.dds\",\"gta3.img/dockcargo1_las.txd/lasdkcrtgr1.dds\",\n \"gta3.img/stormdrain_las2.txd/lasdkcrtgr1.dds\",\"gta3.img/dockcargo1_las.txd/lasdkcrtgr1.dds\",\n \"gta3.img/dockcargof_las.txd/lasdkcrtgr1ss.dds\",\"gta3.img/dockcargo1_las.txd/lasdkcrtgr1ss.dds\",\n \"gta3.img/stormdrain_las2.txd/lasdkcrtgr1ss.dds\",\"gta3.img/dockcargo1_las.txd/lasdkcrtgr1ss.dds\",\n \"gta3.img/dockcargof_las.txd/lasdkcrtgr11.dds\",\"gta3.img/dockcargo1_las.txd/lasdkcrtgr11.dds\",\n \"gta3.img/stormdrain_las2.txd/lasdkcrtgr11.dds\",\"gta3.img/dockcargo1_las.txd/lasdkcrtgr11.dds\",\n \"gta3.img/dockcargof_las.txd/lasdkcrtgr1sss.dds\",\"gta3.img/dockcargo1_las.txd/lasdkcrtgr1sss.dds\",\n \"gta3.img/stormdrain_las2.txd/lasdkcrtgr1sss.dds\",\"gta3.img/dockcargo1_las.txd/lasdkcrtgr1sss.dds\",\n \"gta3.img/dockcargof_las.txd/lasdkcrtgr111.dds\",\"gta3.img/dockcargo1_las.txd/lasdkcrtgr111.dds\",\n \"gta3.img/stormdrain_las2.txd/lasdkcrtgr111.dds\",\"gta3.img/dockcargo1_las.txd/lasdkcrtgr111.dds\",\n \"gta3.img/dockcargof_las.txd/lasdkcrtgr1s.dds\",\"gta3.img/dockcargo1_las.txd/lasdkcrtgr1s.dds\",\n \"gta3.img/stormdrain_las2.txd/lasdkcrtgr1s.dds\",\"gta3.img/dockcargo1_las.txd/lasdkcrtgr1s.dds\",\n \"gta3.img/imrancompyard_las.txd/steelgirder_64v.dds\",\"gta3.img/dockcargo2_las.txd/steelgirder_64v.dds\",\n \"gta3.img/imrancompyard_las.txd/lastrk7.dds\",\"gta3.img/dockcargo2_las.txd/lastrk7.dds\",\n \"gta3.img/imrancompyard_las.txd/lastrk5.dds\",\"gta3.img/dockcargo2_las.txd/lastrk5.dds\",\n \"gta_int.img/imrancomp_las.txd/lastrk5.dds\",\"gta3.img/dockcargo2_las.txd/lastrk5.dds\",\n \"gta_int.img/steve_doors.txd/lastrk5.dds\",\"gta3.img/dockcargo2_las.txd/lastrk5.dds\",\n \"gta3.img/imrancompyard_las.txd/lastrk3.dds\",\"gta3.img/dockcargo2_las.txd/lastrk3.dds\",\n \"gta3.img/imrancompyard_las.txd/lastrk2.dds\",\"gta3.img/dockcargo2_las.txd/lastrk2.dds\",\n \"gta3.img/imrancompyard_las.txd/lastrk1.dds\",\"gta3.img/dockcargo2_las.txd/lastrk1.dds\",\n \"gta3.img/docks2refl_sfse.txd/aascaff.dds\",\"gta3.img/docklight.txd/aascaff.dds\",\n \"gta3.img/quarry.txd/aascaff.dds\",\"gta3.img/docklight.txd/aascaff.dds\",\n \"gta3.img/vgncnstrct1.txd/aascaff.dds\",\"gta3.img/docklight.txd/aascaff.dds\",\n \"gta3.img/traindocks_sfse.txd/dt_bmx_grass.dds\",\"gta3.img/dockroad_sfse.txd/dt_bmx_grass.dds\",\n \"gta3.img/genroads_sfse.txd/sf_junction3.dds\",\"gta3.img/dockroad_sfse.txd/sf_junction3.dds\",\n \"gta3.img/road2sfe.txd/sf_junction3.dds\",\"gta3.img/dockroad_sfse.txd/sf_junction3.dds\",\n \"gta3.img/roadsfe.txd/sf_junction3.dds\",\"gta3.img/dockroad_sfse.txd/sf_junction3.dds\",\n \"gta3.img/smallertxd.txd/sf_junction3.dds\",\"gta3.img/dockroad_sfse.txd/sf_junction3.dds\",\n \"gta3.img/lanlacma_lan2.txd/laslacma1.dds\",\"gta3.img/docks2_las2.txd/laslacma1.dds\",\n \"gta3.img/docks_las2.txd/sjmndukwal2.dds\",\"gta3.img/docks2_las2.txd/sjmndukwal2.dds\",\n \"gta3.img/docks_las2.txd/sjmndukwal1.dds\",\"gta3.img/docks2_las2.txd/sjmndukwal1.dds\",\n \"gta3.img/lasxrefdock.txd/sjmndukwal1.dds\",\"gta3.img/docks2_las2.txd/sjmndukwal1.dds\",\n \"gta3.img/docks_las2.txd/concroadslab_256.dds\",\"gta3.img/docks2_las2.txd/concroadslab_256.dds\",\n \"gta3.img/lan2freeway.txd/concroadslab_256.dds\",\"gta3.img/docks2_las2.txd/concroadslab_256.dds\",\n \"gta3.img/lasxrefdock.txd/concroadslab_256.dds\",\"gta3.img/docks2_las2.txd/concroadslab_256.dds\",\n \"gta3.img/sw_block06.txd/concroadslab_256.dds\",\"gta3.img/docks2_las2.txd/concroadslab_256.dds\",\n \"gta3.img/drydockshed_sfse.txd/ws_corr_2_blu.dds\",\"gta3.img/docks2refl_sfse.txd/ws_corr_2_blu.dds\",\n \"gta3.img/vgnpwrwhse.txd/ws_corr_2_blu.dds\",\"gta3.img/docks2refl_sfse.txd/ws_corr_2_blu.dds\",\n \"gta3.img/docks2_sfse.txd/support_256.dds\",\"gta3.img/docks2refl_sfse.txd/support_256.dds\",\n \"gta3.img/sfroadsign.txd/support_256.dds\",\"gta3.img/docks2refl_sfse.txd/support_256.dds\",\n \"gta3.img/docks2_sfse.txd/ws_drain.dds\",\"gta3.img/docks2refl_sfse.txd/ws_drain.dds\",\n \"gta3.img/docks_las2.txd/ws_drain.dds\",\"gta3.img/docks2refl_sfse.txd/ws_drain.dds\",\n \"gta3.img/eastls4_lae2.txd/ws_drain.dds\",\"gta3.img/docks2refl_sfse.txd/ws_drain.dds\",\n \"gta3.img/hashupass_sfs.txd/ws_drain.dds\",\"gta3.img/docks2refl_sfse.txd/ws_drain.dds\",\n \"gta3.img/docks2_sfse.txd/ws_sub_pen_conc3.dds\",\"gta3.img/docks2refl_sfse.txd/ws_sub_pen_conc3.dds\",\n \"gta3.img/navyroad_sfse.txd/ws_sub_pen_conc3.dds\",\"gta3.img/docks2refl_sfse.txd/ws_sub_pen_conc3.dds\",\n \"gta3.img/subpen1_sfse.txd/ws_sub_pen_conc3.dds\",\"gta3.img/docks2refl_sfse.txd/ws_sub_pen_conc3.dds\",\n \"gta3.img/docks2_sfse.txd/ws_sub_pen_conc4.dds\",\"gta3.img/docks2refl_sfse.txd/ws_sub_pen_conc4.dds\",\n \"gta3.img/navyroad_sfse.txd/ws_sub_pen_conc4.dds\",\"gta3.img/docks2refl_sfse.txd/ws_sub_pen_conc4.dds\",\n \"gta3.img/subpen1_sfse.txd/ws_sub_pen_conc4.dds\",\"gta3.img/docks2refl_sfse.txd/ws_sub_pen_conc4.dds\",\n \"gta3.img/vgnpwroutbld2.txd/ws_sub_pen_conc4.dds\",\"gta3.img/docks2refl_sfse.txd/ws_sub_pen_conc4.dds\",\n \"gta3.img/drydockgate_sfse.txd/ws_drydockdoors.dds\",\"gta3.img/docks2refl_sfse.txd/ws_drydockdoors.dds\",\n \"gta3.img/navybasefence.txd/ws_navystation.dds\",\"gta3.img/docks2_sfse.txd/ws_navystation.dds\",\n \"gta3.img/subpen1_sfse.txd/ws_navystation.dds\",\"gta3.img/docks2_sfse.txd/ws_navystation.dds\",\n \"gta3.img/ground5_las.txd/dukbridmet1_las.dds\",\"gta3.img/docks_las2.txd/dukbridmet1_las.dds\",\n \"gta3.img/lasxrefdock.txd/sjmndukwal3.dds\",\"gta3.img/docks_las2.txd/sjmndukwal3.dds\",\n \"gta3.img/forklift.txd/forklift92wheel64.dds\",\"gta3.img/dodo.txd/dodo92wheel64.dds\",\n \"gta3.img/rdtraint.txd/rdtraint92wheel64.dds\",\"gta3.img/dodo.txd/dodo92wheel64.dds\",\n \"gta3.img/melrose12_lawn.txd/donut1_sfw.dds\",\"gta3.img/donut_sfw.txd/donut1_sfw.dds\",\n \"gta3.img/park_sfw.txd/grass128hv_blend_.dds\",\"gta3.img/donut_sfw.txd/grass128hv_blend_.dds\",\n \"gta3.img/vgncoast.txd/ws_alley2_128_dirt.dds\",\"gta3.img/donut_sfw.txd/ws_alley2_128_dirt.dds\",\n \"gta3.img/vgspumphse.txd/ws_alley2_128_dirt.dds\",\"gta3.img/donut_sfw.txd/ws_alley2_128_dirt.dds\",\n \"gta3.img/lanblokb.txd/ablndwall1_lae.dds\",\"gta3.img/downtown1_las.txd/ablndwall1_lae.dds\",\n \"gta3.img/ebeachcineblok.txd/hotdoor01_law.dds\",\"gta3.img/downtown1_las.txd/hotdoor01_law.dds\",\n \"gta3.img/melrose07_lawn.txd/hotdoor01_law.dds\",\"gta3.img/downtown1_las.txd/hotdoor01_law.dds\",\n \"gta3.img/law_doontoon.txd/gz_lawbuilda_4.dds\",\"gta3.img/downtown3_las.txd/gz_lawbuilda_4.dds\",\n \"gta3.img/law_doontoon.txd/gz_lawbuilda_5.dds\",\"gta3.img/downtown3_las.txd/gz_lawbuilda_5.dds\",\n \"gta3.img/ebeachcineblok.txd/downtshop1_lan.dds\",\"gta3.img/downtown3_las.txd/downtshop1_lan.dds\",\n \"gta3.img/lae2newtempbx.txd/downtshop1_lan.dds\",\"gta3.img/downtown3_las.txd/downtshop1_lan.dds\",\n \"gta3.img/melrose03_lawn.txd/downtshop1_lan.dds\",\"gta3.img/downtown3_las.txd/downtshop1_lan.dds\",\n \"gta3.img/melrose19_lawn.txd/downtshop1_lan.dds\",\"gta3.img/downtown3_las.txd/downtshop1_lan.dds\",\n \"gta3.img/lanbloka.txd/downtshop3_lan.dds\",\"gta3.img/downtown3_las.txd/downtshop3_lan.dds\",\n \"gta3.img/lngblok_lae2.txd/downtshop3_lan.dds\",\"gta3.img/downtown3_las.txd/downtshop3_lan.dds\",\n \"gta3.img/melrose03_lawn.txd/downtshop3_lan.dds\",\"gta3.img/downtown3_las.txd/downtshop3_lan.dds\",\n \"gta3.img/melrose11_lawn.txd/downtshop3_lan.dds\",\"gta3.img/downtown3_las.txd/downtshop3_lan.dds\",\n \"gta3.img/sunrise09_lawn.txd/downtshop3_lan.dds\",\"gta3.img/downtown3_las.txd/downtshop3_lan.dds\",\n \"gta3.img/sunset04_law2.txd/downtshop3_lan.dds\",\"gta3.img/downtown3_las.txd/downtshop3_lan.dds\",\n \"gta3.img/pershingsq.txd/pershing1_lan.dds\",\"gta3.img/downtown_las.txd/pershing1_lan.dds\",\n \"gta3.img/smallertxd.txd/ws_glassnbrassdoor.dds\",\"gta3.img/downtown_las.txd/ws_glassnbrassdoor.dds\",\n \"gta3.img/sunrise08_lawn.txd/holpac02_law.dds\",\"gta3.img/downtown_las.txd/holpac02_law.dds\",\n \"gta3.img/dumper.txd/dumper92wheel.dds\",\"gta3.img/dozer.txd/dozer92wheel.dds\",\n \"gta3.img/factorycunte.txd/inwindow1shdw.dds\",\"gta3.img/drivingschool_sfse.txd/inwindow1shdw.dds\",\n \"gta3.img/projects_la.txd/inwindow1shdw.dds\",\"gta3.img/drivingschool_sfse.txd/inwindow1shdw.dds\",\n \"gta3.img/vgsbikeschool.txd/inwindow1shdw.dds\",\"gta3.img/drivingschool_sfse.txd/inwindow1shdw.dds\",\n \"gta3.img/hashblock2_sfs.txd/ws_turningtricks1_small.dds\",\"gta3.img/drivingschool_sfse.txd/ws_turningtricks1_small.dds\",\n \"gta3.img/vgsbikeschool.txd/ws_turningtricks1_small.dds\",\"gta3.img/drivingschool_sfse.txd/ws_turningtricks1_small.dds\",\n \"gta_int.img/ab_trukstpa.txd/cj_wood6.dds\",\"gta3.img/dsfs.txd/cj_wood6.dds\",\n \"gta_int.img/ab_trukstpc.txd/mp_cj_wood5.dds\",\"gta3.img/dsfs.txd/cj_wood6.dds\",\n \"gta_int.img/cj_cb_sign.txd/cj_wood6.dds\",\"gta3.img/dsfs.txd/cj_wood6.dds\",\n \"gta_int.img/cj_coin_op_2.txd/cj_wood6.dds\",\"gta3.img/dsfs.txd/cj_wood6.dds\",\n \"gta_int.img/cj_don_sign.txd/cj_wood6.dds\",\"gta3.img/dsfs.txd/cj_wood6.dds\",\n \"gta_int.img/cj_ff_acc1.txd/cj_wood6.dds\",\"gta3.img/dsfs.txd/cj_wood6.dds\",\n \"gta_int.img/cj_ff_counters.txd/cj_wood6.dds\",\"gta3.img/dsfs.txd/cj_wood6.dds\",\n \"gta_int.img/cj_furniture.txd/cj_wood6.dds\",\"gta3.img/dsfs.txd/cj_wood6.dds\",\n \"gta_int.img/cj_hotel_poor.txd/cj_wood6.dds\",\"gta3.img/dsfs.txd/cj_wood6.dds\",\n \"gta_int.img/cj_tables.txd/cj_wood6.dds\",\"gta3.img/dsfs.txd/cj_wood6.dds\",\n \"gta_int.img/cj_tv_stand.txd/cj_wood6.dds\",\"gta3.img/dsfs.txd/cj_wood6.dds\",\n \"gta_int.img/jet_interior.txd/mp_cj_wood5.dds\",\"gta3.img/dsfs.txd/cj_wood6.dds\",\n \"gta_int.img/pizza_furn.txd/cj_wood6.dds\",\"gta3.img/dsfs.txd/cj_wood6.dds\",\n \"gta_int.img/slot_bank.txd/cj_wood6.dds\",\"gta3.img/dsfs.txd/cj_wood6.dds\",\n \"gta_int.img/cj_coin_op_2.txd/cj_pokerscreen.dds\",\"gta3.img/dsfs.txd/cj_pokerscreen.dds\",\n \"gta_int.img/slot_bank.txd/cj_pokerscreen.dds\",\"gta3.img/dsfs.txd/cj_pokerscreen.dds\",\n \"gta_int.img/cj_coin_op_2.txd/cj_pokerscreen2.dds\",\"gta3.img/dsfs.txd/cj_pokerscreen2.dds\",\n \"gta_int.img/slot_bank.txd/cj_pokerscreen2.dds\",\"gta3.img/dsfs.txd/cj_pokerscreen2.dds\",\n \"gta3.img/sanpedhse_1x.txd/laspedhus7.dds\",\"gta3.img/dtbuil1_lan2.txd/laspedhus7.dds\",\n \"gta3.img/rodeo01_law2.txd/jewlers1_256.dds\",\"gta3.img/dtbuil1_lan2.txd/jewlers1_256.dds\",\n \"gta3.img/sanpedhse_1x.txd/laspedhus2.dds\",\"gta3.img/dtbuil1_lan2.txd/laspedhus2.dds\",\n \"gta3.img/sanpedhse_1x.txd/laspedhus3.dds\",\"gta3.img/dtbuil1_lan2.txd/laspedhus3.dds\",\n \"gta3.img/flatbed.txd/bodykitmesh64.dds\",\"gta3.img/duneride.txd/bodykitmesh64.dds\",\n \"gta3.img/speeder.txd/bodykitmesh64.dds\",\"gta3.img/duneride.txd/bodykitmesh64.dds\",\n \"gta3.img/petrolcan.txd/redcan.dds\",\"gta3.img/dynamite.txd/redcan.dds\",\n \"gta3.img/helimagnet.txd/redallu.dds\",\"gta3.img/dynbarrels.txd/redallu.dds\",\n \"gta3.img/lashops1b_las2.txd/metal4_256.dds\",\"gta3.img/dynbuket.txd/metal4_256.dds\",\n \"gta3.img/player_props.txd/cj_bottle3.dds\",\"gta3.img/dyn_objects.txd/cj_bottle3.dds\",\n \"gta3.img/ship_brijsfw.txd/bincover_64hv.dds\",\"gta3.img/dynrecycle.txd/bincover_64hv.dds\",\n \"gta3.img/lodlawnsmall.txd/lasjmflood1lod.dds\",\"gta3.img/ealod_law2.txd/lasjmflood1lod.dds\",\n \"gta3.img/lod2_las.txd/wstunnel_lod.dds\",\"gta3.img/ealod_law2.txd/wstunnel_lod.dds\",\n \"gta3.img/lod_sfse2.txd/wstunnel_lod.dds\",\"gta3.img/ealod_law2.txd/wstunnel_lod.dds\",\n \"gta3.img/tunnelod_law.txd/wstunnel_lod.dds\",\"gta3.img/ealod_law2.txd/wstunnel_lod.dds\",\n \"gta3.img/welod_law2.txd/wstunnel_lod.dds\",\"gta3.img/ealod_law2.txd/wstunnel_lod.dds\",\n \"gta3.img/lod2_las.txd/sjmlodb4.dds\",\"gta3.img/ealod_law2.txd/sjmlodb4.dds\",\n \"gta3.img/lod_las2.txd/sjmlodb4.dds\",\"gta3.img/ealod_law2.txd/sjmlodb4.dds\",\n \"gta3.img/tunnelod_law.txd/sjmlodb4.dds\",\"gta3.img/ealod_law2.txd/sjmlodb4.dds\",\n \"gta3.img/welod_law2.txd/sjmlodb4.dds\",\"gta3.img/ealod_law2.txd/sjmlodb4.dds\",\n \"gta3.img/welod_law2.txd/count02_law2lod.dds\",\"gta3.img/ealod_law2.txd/count02_law2lod.dds\",\n \"gta3.img/welod_law2.txd/suns9blaw2_lod.dds\",\"gta3.img/ealod_law2.txd/suns9blaw2_lod.dds\",\n \"gta3.img/lodlawnsmall.txd/carpark_lod.dds\",\"gta3.img/ealod_law2.txd/carpark_lod.dds\",\n \"gta3.img/vegaselod2.txd/carpark_lod.dds\",\"gta3.img/ealod_law2.txd/carpark_lod.dds\",\n \"gta3.img/welod_law2.txd/carpark_lod.dds\",\"gta3.img/ealod_law2.txd/carpark_lod.dds\",\n \"gta3.img/welod_law2.txd/beachlod01_law2.dds\",\"gta3.img/ealod_law2.txd/beachlod01_law2.dds\",\n \"gta3.img/lodtnsfn.txd/sandnew_law.dds\",\"gta3.img/ealod_law2.txd/sandnew_law.dds\",\n \"gta3.img/welod_law2.txd/sandnew_law.dds\",\"gta3.img/ealod_law2.txd/sandnew_law.dds\",\n \"gta3.img/welod_law2.txd/freewaylaw2_lod.dds\",\"gta3.img/ealod_law2.txd/freewaylaw2_lod.dds\",\n \"gta3.img/vegaselod1.txd/boardwalk_la_lod.dds\",\"gta3.img/ealod_law2.txd/boardwalk_la_lod.dds\",\n \"gta3.img/lodvegaswest2.txd/redclifftoplod.dds\",\"gta3.img/ealod_law2.txd/redclifftoplod.dds\",\n \"gta3.img/welod_law2.txd/redclifftoplod.dds\",\"gta3.img/ealod_law2.txd/redclifftoplod.dds\",\n \"gta3.img/laeast2_lod.txd/grassdry_lod.dds\",\"gta3.img/ealod_law2.txd/grassdry_lod.dds\",\n \"gta3.img/lawnlodbig.txd/grassdry_lod.dds\",\"gta3.img/ealod_law2.txd/grassdry_lod.dds\",\n \"gta3.img/lodlawnsmall.txd/grassdry_lod.dds\",\"gta3.img/ealod_law2.txd/grassdry_lod.dds\",\n \"gta3.img/lodvgwstcoast.txd/grassdry_lod.dds\",\"gta3.img/ealod_law2.txd/grassdry_lod.dds\",\n \"gta3.img/sunst18_lawn.txd/grassdry_lod.dds\",\"gta3.img/ealod_law2.txd/grassdry_lod.dds\",\n \"gta3.img/vegaselod2.txd/grassdry_lod.dds\",\"gta3.img/ealod_law2.txd/grassdry_lod.dds\",\n \"gta3.img/vegasnlod1.txd/grassdry_lod.dds\",\"gta3.img/ealod_law2.txd/grassdry_lod.dds\",\n \"gta3.img/welod_law2.txd/grassdry_lod.dds\",\"gta3.img/ealod_law2.txd/grassdry_lod.dds\",\n \"gta3.img/welod_law2.txd/dualroadlod01.dds\",\"gta3.img/ealod_law2.txd/dualroadlod01.dds\",\n \"gta3.img/lod_a_law.txd/lawroad1_lod.dds\",\"gta3.img/ealod_law2.txd/lawroad1_lod.dds\",\n \"gta3.img/welod_law2.txd/lawroad1_lod.dds\",\"gta3.img/ealod_law2.txd/lawroad1_lod.dds\",\n \"gta3.img/laeast2_lod.txd/roof06_lod.dds\",\"gta3.img/ealod_law2.txd/roof06_lod.dds\",\n \"gta3.img/welod_law2.txd/roof06_lod.dds\",\"gta3.img/ealod_law2.txd/roof06_lod.dds\",\n \"gta3.img/lod_a_law.txd/newhedgea_lod.dds\",\"gta3.img/ealod_law2.txd/newhedgea_lod.dds\",\n \"gta3.img/lodlawnsmall.txd/aptarmac_lod.dds\",\"gta3.img/ealod_law2.txd/aptarmac_lod.dds\",\n \"gta3.img/vegaselod2.txd/aptarmac_lod.dds\",\"gta3.img/ealod_law2.txd/aptarmac_lod.dds\",\n \"gta3.img/vegaselod3.txd/aptarmac_lod.dds\",\"gta3.img/ealod_law2.txd/aptarmac_lod.dds\",\n \"gta3.img/welod_law2.txd/aptarmac_lod.dds\",\"gta3.img/ealod_law2.txd/aptarmac_lod.dds\",\n \"gta3.img/welod_law2.txd/rodeo04dlaw2_lod.dds\",\"gta3.img/ealod_law2.txd/rodeo04dlaw2_lod.dds\",\n \"gta3.img/welod_law2.txd/rodeo01blaw2_lod.dds\",\"gta3.img/ealod_law2.txd/rodeo01blaw2_lod.dds\",\n \"gta3.img/lawartg.txd/airportwind02.dds\",\"gta3.img/eastbeach2a_lae2.txd/airportwind02.dds\",\n \"gta3.img/milbase.txd/lights_64hv.dds\",\"gta3.img/eastbeach2a_lae2.txd/lights_64hv.dds\",\n \"gta_int.img/genintintcarint3.txd/lights_64hv.dds\",\"gta3.img/eastbeach2a_lae2.txd/lights_64hv.dds\",\n \"gta_int.img/genintintgarage2.txd/lights_64hv.dds\",\"gta3.img/eastbeach2a_lae2.txd/lights_64hv.dds\",\n \"gta_int.img/genintintgarage3b.txd/lights_64hv.dds\",\"gta3.img/eastbeach2a_lae2.txd/lights_64hv.dds\",\n \"gta_int.img/genintwarehsint3.txd/lights_64hv.dds\",\"gta3.img/eastbeach2a_lae2.txd/lights_64hv.dds\",\n \"gta3.img/jeffers5a_lae.txd/gangsign1_lae.dds\",\"gta3.img/eastbeach2a_lae2.txd/gangsign1_lae.dds\",\n \"gta3.img/eastlstr_lae2.txd/hedge1.dds\",\"gta3.img/eastbeach2a_lae2.txd/hedge1.dds\",\n \"gta3.img/lae2grnd.txd/hedge1.dds\",\"gta3.img/eastbeach2a_lae2.txd/hedge1.dds\",\n \"gta3.img/miragecasino2.txd/hedge1.dds\",\"gta3.img/eastbeach2a_lae2.txd/hedge1.dds\",\n \"gta3.img/newstuff_sfn.txd/hedge1.dds\",\"gta3.img/eastbeach2a_lae2.txd/hedge1.dds\",\n \"gta3.img/stuff2_sfn.txd/hedge1.dds\",\"gta3.img/eastbeach2a_lae2.txd/hedge1.dds\",\n \"gta3.img/sunrise05_lawn.txd/hedge1.dds\",\"gta3.img/eastbeach2a_lae2.txd/hedge1.dds\",\n \"gta3.img/vgncircir.txd/hedge1.dds\",\"gta3.img/eastbeach2a_lae2.txd/hedge1.dds\",\n \"gta3.img/eastls1_lae2.txd/gangshop5_lae.dds\",\"gta3.img/eastbeach2a_lae2.txd/gangshop5_lae.dds\",\n \"gta3.img/jeffers4_lae.txd/gangshop5_lae.dds\",\"gta3.img/eastbeach2a_lae2.txd/gangshop5_lae.dds\",\n \"gta3.img/melrose12_lawn.txd/gangshop5_lae.dds\",\"gta3.img/eastbeach2a_lae2.txd/gangshop5_lae.dds\",\n \"gta3.img/lae2bigblock.txd/downtwin17.dds\",\"gta3.img/eastbeach2a_lae2.txd/downtwin17.dds\",\n \"gta3.img/lanblokd.txd/downtwin17.dds\",\"gta3.img/eastbeach2a_lae2.txd/downtwin17.dds\",\n \"gta3.img/fishwarf.txd/sfe_nicearch6.dds\",\"gta3.img/eastbeach2a_lae2.txd/sfe_nicearch6.dds\",\n \"gta3.img/lae2bigblock.txd/sfe_nicearch6.dds\",\"gta3.img/eastbeach2a_lae2.txd/sfe_nicearch6.dds\",\n \"gta3.img/melrose19_lawn.txd/sfe_nicearch6.dds\",\"gta3.img/eastbeach2a_lae2.txd/sfe_nicearch6.dds\",\n \"gta3.img/sfe_swank1.txd/sfe_nicearch6.dds\",\"gta3.img/eastbeach2a_lae2.txd/sfe_nicearch6.dds\",\n \"gta3.img/smallertxd.txd/sfe_nicearch6.dds\",\"gta3.img/eastbeach2a_lae2.txd/sfe_nicearch6.dds\",\n \"gta3.img/lae2roads.txd/craproad5_lae.dds\",\"gta3.img/eastbeach2a_lae2.txd/craproad5_lae.dds\",\n \"gta3.img/lahillsroadscoast.txd/craproad5_lae.dds\",\"gta3.img/eastbeach2a_lae2.txd/craproad5_lae.dds\",\n \"gta3.img/landlae2b.txd/craproad5_lae.dds\",\"gta3.img/eastbeach2a_lae2.txd/craproad5_lae.dds\",\n \"gta3.img/industry3_las2.txd/lastat1.dds\",\"gta3.img/eastbeach3c_lae2.txd/lastat1.dds\",\n \"gta3.img/lashops93_las2.txd/lastat1.dds\",\"gta3.img/eastbeach3c_lae2.txd/lastat1.dds\",\n \"gta3.img/oldshops_las.txd/lastat1.dds\",\"gta3.img/eastbeach3c_lae2.txd/lastat1.dds\",\n \"gta3.img/wasteland_las2.txd/lastat1.dds\",\"gta3.img/eastbeach3c_lae2.txd/lastat1.dds\",\n \"gta3.img/lanlacmab_lan2.txd/laslacma992.dds\",\"gta3.img/eastbeach3c_lae2.txd/laslacma992.dds\",\n \"gta3.img/sfe_builda.txd/deisel_2sfs.dds\",\"gta3.img/eastbeach3c_lae2.txd/deisel_2sfs.dds\",\n \"gta3.img/vgnabatoir.txd/ws_chipboard.dds\",\"gta3.img/eastbeach3c_lae2.txd/ws_chipboard.dds\",\n \"gta3.img/vgnscaffold.txd/ws_chipboard.dds\",\"gta3.img/eastbeach3c_lae2.txd/ws_chipboard.dds\",\n \"gta3.img/vgsecnstrct01.txd/ws_chipboard.dds\",\"gta3.img/eastbeach3c_lae2.txd/ws_chipboard.dds\",\n \"gta3.img/vgssairportcpark.txd/ws_chipboard.dds\",\"gta3.img/eastbeach3c_lae2.txd/ws_chipboard.dds\",\n \"gta_int.img/cuntcuts.txd/ws_chipboard.dds\",\"gta3.img/eastbeach3c_lae2.txd/ws_chipboard.dds\",\n \"gta_int.img/savesfmid.txd/ws_chipboard.dds\",\"gta3.img/eastbeach3c_lae2.txd/ws_chipboard.dds\",\n \"gta_int.img/svsfsm.txd/ws_chipboard.dds\",\"gta3.img/eastbeach3c_lae2.txd/ws_chipboard.dds\",\n \"gta3.img/gazlaw3.txd/metpull_law.dds\",\"gta3.img/eastbeach3c_lae2.txd/metpull_law.dds\",\n \"gta3.img/mall_law.txd/metpull_law.dds\",\"gta3.img/eastbeach3c_lae2.txd/metpull_law.dds\",\n \"gta3.img/stationsfse_1.txd/metpull_law.dds\",\"gta3.img/eastbeach3c_lae2.txd/metpull_law.dds\",\n \"gta3.img/sunrise01_lawn.txd/metpull_law.dds\",\"gta3.img/eastbeach3c_lae2.txd/metpull_law.dds\",\n \"gta3.img/vgshpground.txd/vgs_shpfrnt03_128.dds\",\"gta3.img/eastbeach3c_lae2.txd/vgs_shpfrnt03_128.dds\",\n \"gta3.img/vgs_shop5.txd/vgs_shpfrnt03_128.dds\",\"gta3.img/eastbeach3c_lae2.txd/vgs_shpfrnt03_128.dds\",\n \"gta3.img/ebeachcineblok.txd/decobuild2d_lan.dds\",\"gta3.img/eastbeach3c_lae2.txd/decobuild2d_lan.dds\",\n \"gta3.img/lanblokd.txd/decobuild2d_lan.dds\",\"gta3.img/eastbeach3c_lae2.txd/decobuild2d_lan.dds\",\n \"gta3.img/filmstud.txd/dryhedge_128.dds\",\"gta3.img/eastbeach4a_lae2.txd/dryhedge_128.dds\",\n \"gta3.img/landhub.txd/dryhedge_128.dds\",\"gta3.img/eastbeach4a_lae2.txd/dryhedge_128.dds\",\n \"gta3.img/melrose07_lawn.txd/dryhedge_128.dds\",\"gta3.img/eastbeach4a_lae2.txd/dryhedge_128.dds\",\n \"gta3.img/vgnboiga1.txd/dryhedge_128.dds\",\"gta3.img/eastbeach4a_lae2.txd/dryhedge_128.dds\",\n \"gta3.img/vgnlowwall.txd/dryhedge_128.dds\",\"gta3.img/eastbeach4a_lae2.txd/dryhedge_128.dds\",\n \"gta3.img/vgnretail6.txd/dryhedge_128.dds\",\"gta3.img/eastbeach4a_lae2.txd/dryhedge_128.dds\",\n \"gta3.img/vgwestboiga1.txd/dryhedge_128.dds\",\"gta3.img/eastbeach4a_lae2.txd/dryhedge_128.dds\",\n \"gta3.img/lawnxref.txd/lastaco6.dds\",\"gta3.img/eastbeach4a_lae2.txd/lastaco6.dds\",\n \"gta3.img/lae2bigblock.txd/ladtbuilding3.dds\",\"gta3.img/eastbeach4a_lae2.txd/ladtbuilding3.dds\",\n \"gta_int.img/svsfsm.txd/ltgreenwallc1.dds\",\"gta3.img/eastbeach4a_lae2.txd/ltgreenwallc1.dds\",\n \"gta3.img/garag3_lawn.txd/bluestucco1.dds\",\"gta3.img/eastbeach4a_lae2.txd/bluestucco1.dds\",\n \"gta3.img/vgntamotel.txd/bluestucco1.dds\",\"gta3.img/eastbeach4a_lae2.txd/bluestucco1.dds\",\n \"gta3.img/eastbeach7_lae2.txd/greywallb256.dds\",\"gta3.img/eastbeach4a_lae2.txd/greywallb256.dds\",\n \"gta3.img/hosbibalsfw.txd/policeha02_128.dds\",\"gta3.img/eastbeach4a_lae2.txd/policeha02_128.dds\",\n \"gta3.img/lahillsground4.txd/sand256.dds\",\"gta3.img/eastbeach4a_lae2.txd/sand256.dds\",\n \"gta3.img/flamingo1.txd/shopwindowlow2_256.dds\",\"gta3.img/eastbeach7_lae2.txd/shopwindowlow2_256.dds\",\n \"gta3.img/stripshop1.txd/shopwindowlow2_256.dds\",\"gta3.img/eastbeach7_lae2.txd/shopwindowlow2_256.dds\",\n \"gta3.img/vgnretail4.txd/shopwindowlow2_256.dds\",\"gta3.img/eastbeach7_lae2.txd/shopwindowlow2_256.dds\",\n \"gta3.img/glenpark6d_lae.txd/bluewin1.dds\",\"gta3.img/eastbeach7_lae2.txd/bluewin1.dds\",\n \"gta3.img/lngblok_lae2.txd/downtshop7_lan.dds\",\"gta3.img/eastbeach8_lae2.txd/downtshop7_lan.dds\",\n \"gta3.img/sw_block11.txd/sjmoran4.dds\",\"gta3.img/easthills_lahills.txd/sjmoran4.dds\",\n \"gta3.img/gangblok1_lae2.txd/bricksign1_lae.dds\",\"gta3.img/eastls1b_lae2.txd/bricksign1_lae.dds\",\n \"gta3.img/lae2bigblock.txd/bricksign1_lae.dds\",\"gta3.img/eastls1b_lae2.txd/bricksign1_lae.dds\",\n \"gta3.img/eastls1_lae2.txd/gangshtop1_lae.dds\",\"gta3.img/eastls1b_lae2.txd/gangshtop1_lae.dds\",\n \"gta3.img/eastls1_lae2.txd/gangshop4_lae.dds\",\"gta3.img/eastls1b_lae2.txd/gangshop4_lae.dds\",\n \"gta3.img/eastls1_lae2.txd/gangshop3_lae.dds\",\"gta3.img/eastls1b_lae2.txd/gangshop3_lae.dds\",\n \"gta3.img/eastls1_lae2.txd/gangshop7_lae.dds\",\"gta3.img/eastls1b_lae2.txd/gangshop7_lae.dds\",\n \"gta3.img/gangblok1_lae2.txd/comptwall3.dds\",\"gta3.img/eastls1b_lae2.txd/comptwall3.dds\",\n \"gta3.img/ganghouse1_lax.txd/comptwall3.dds\",\"gta3.img/eastls1b_lae2.txd/comptwall3.dds\",\n \"gta3.img/ground4_las.txd/comptwall3.dds\",\"gta3.img/eastls1b_lae2.txd/comptwall3.dds\",\n \"gta3.img/kbgarage_las.txd/comptwall3.dds\",\"gta3.img/eastls1b_lae2.txd/comptwall3.dds\",\n \"gta3.img/lasground2_las2.txd/comptwall3.dds\",\"gta3.img/eastls1b_lae2.txd/comptwall3.dds\",\n \"gta3.img/melrose03_lawn.txd/comptwall3.dds\",\"gta3.img/eastls1b_lae2.txd/comptwall3.dds\",\n \"gta3.img/sjmla_las.txd/comptwall3.dds\",\"gta3.img/eastls1b_lae2.txd/comptwall3.dds\",\n \"gta3.img/sunrise01_lawn.txd/comptwall3.dds\",\"gta3.img/eastls1b_lae2.txd/comptwall3.dds\",\n \"gta3.img/sunrise02_lawn.txd/comptwall3.dds\",\"gta3.img/eastls1b_lae2.txd/comptwall3.dds\",\n \"gta3.img/sunrise10_lawn.txd/comptwall3.dds\",\"gta3.img/eastls1b_lae2.txd/comptwall3.dds\",\n \"gta_int.img/intgarage2aint3.txd/comptwall3.dds\",\"gta3.img/eastls1b_lae2.txd/comptwall3.dds\",\n \"gta_int.img/int_kbsgarage3.txd/comptwall3.dds\",\"gta3.img/eastls1b_lae2.txd/comptwall3.dds\",\n \"gta3.img/eastls1_lae2.txd/tanstucco1_la.dds\",\"gta3.img/eastls1b_lae2.txd/tanstucco1_la.dds\",\n \"gta3.img/ganton02_lae2.txd/tanstucco1_la.dds\",\"gta3.img/eastls1b_lae2.txd/tanstucco1_la.dds\",\n \"gta3.img/pershingsq.txd/tanstucco1_la.dds\",\"gta3.img/eastls1b_lae2.txd/tanstucco1_la.dds\",\n \"gta3.img/ganton02_lae2.txd/papershop_law.dds\",\"gta3.img/eastls1b_lae2.txd/papershop_law.dds\",\n \"gta3.img/jeffers4_lae.txd/gangshop6_lae.dds\",\"gta3.img/eastls1_lae2.txd/gangshop6_lae.dds\",\n \"gta3.img/tvstudio_law2.txd/gangshop6_lae.dds\",\"gta3.img/eastls1_lae2.txd/gangshop6_lae.dds\",\n \"gta3.img/furniture_lae2.txd/comptsign2_lae.dds\",\"gta3.img/eastls1_lae2.txd/comptsign2_lae.dds\",\n \"gta3.img/templae2land.txd/comptsign2_lae.dds\",\"gta3.img/eastls1_lae2.txd/comptsign2_lae.dds\",\n \"gta3.img/furniture_lae2.txd/comptsign1_lae.dds\",\"gta3.img/eastls1_lae2.txd/comptsign1_lae.dds\",\n \"gta3.img/idlewood6_lae.txd/comptsign3_lae.dds\",\"gta3.img/eastls1_lae2.txd/comptsign3_lae.dds\",\n \"gta3.img/vgssland01.txd/alleywall5.dds\",\"gta3.img/eastls1_lae2.txd/alleywall5.dds\",\n \"gta3.img/vgntrainstat.txd/alleywall1.dds\",\"gta3.img/eastls1_lae2.txd/alleywall1.dds\",\n \"gta3.img/vgsetrainstn.txd/alleywall1.dds\",\"gta3.img/eastls1_lae2.txd/alleywall1.dds\",\n \"gta3.img/gangblok1_lae2.txd/spanshop2_lae.dds\",\"gta3.img/eastls1_lae2.txd/spanshop2_lae.dds\",\n \"gta_int.img/bikeskool.txd/motel_wall3.dds\",\"gta3.img/eastls3_lae2.txd/motel_wall3.dds\",\n \"gta_int.img/estate2.txd/motel_wall3.dds\",\"gta3.img/eastls3_lae2.txd/motel_wall3.dds\",\n \"gta_int.img/ganghoos.txd/motel_wall3.dds\",\"gta3.img/eastls3_lae2.txd/motel_wall3.dds\",\n \"gta_int.img/imm_rooms.txd/motel_wall3.dds\",\"gta3.img/eastls3_lae2.txd/motel_wall3.dds\",\n \"gta_int.img/imy_motel2.txd/motel_wall3.dds\",\"gta3.img/eastls3_lae2.txd/motel_wall3.dds\",\n \"gta_int.img/lasmall1int2.txd/motel_wall3.dds\",\"gta3.img/eastls3_lae2.txd/motel_wall3.dds\",\n \"gta_int.img/lasmallsave.txd/motel_wall3.dds\",\"gta3.img/eastls3_lae2.txd/motel_wall3.dds\",\n \"gta_int.img/savegenmotel.txd/motel_wall3.dds\",\"gta3.img/eastls3_lae2.txd/motel_wall3.dds\",\n \"gta_int.img/sweets_roon.txd/motel_wall3.dds\",\"gta3.img/eastls3_lae2.txd/motel_wall3.dds\",\n \"gta3.img/landhub.txd/backalley3_lae.dds\",\"gta3.img/eastls4_lae2.txd/backalley3_lae.dds\",\n \"gta3.img/gangblok1_lae2.txd/spanishwin1_lae.dds\",\"gta3.img/eastls4_lae2.txd/spanishwin1_lae.dds\",\n \"gta3.img/ganghouse1_lax.txd/gangwin2_lae.dds\",\"gta3.img/eastls4_lae2.txd/gangwin2_lae.dds\",\n \"gta_int.img/carter_outside.txd/gangwin2_lae.dds\",\"gta3.img/eastls4_lae2.txd/gangwin2_lae.dds\",\n \"gta3.img/oldshops_las.txd/mural04_la.dds\",\"gta3.img/eastls4_lae2.txd/mural04_la.dds\",\n \"gta3.img/sw_block11a.txd/alley256.dds\",\"gta3.img/eastls4_lae2.txd/alley256.dds\",\n \"gta3.img/sw_block11.txd/alley256.dds\",\"gta3.img/eastls4_lae2.txd/alley256.dds\",\n \"gta3.img/sunrise04_lawn.txd/cinboard_law.dds\",\"gta3.img/eastls4_lae2.txd/cinboard_law.dds\",\n \"gta3.img/sunrise08_lawn.txd/cinboard_law.dds\",\"gta3.img/eastls4_lae2.txd/cinboard_law.dds\",\n \"gta3.img/ebeachcineblok.txd/stripsign_lae2.dds\",\"gta3.img/eastls4_lae2.txd/stripsign_lae2.dds\",\n \"gta3.img/santavenice3.txd/venblock01c.dds\",\"gta3.img/eastls4_lae2.txd/venblock01c.dds\",\n \"gta3.img/lashops1_las2.txd/sjmhicut2las.dds\",\"gta3.img/eastls4_lae2.txd/sjmhicut2las.dds\",\n \"gta3.img/hub_alpha.txd/deadpalm01.dds\",\"gta3.img/eastlstr2_lae2.txd/deadpalm01.dds\",\n \"gta3.img/lae2coast_alpha.txd/deadpalm01.dds\",\"gta3.img/eastlstr2_lae2.txd/deadpalm01.dds\",\n \"gta3.img/lawnbush.txd/deadpalm01.dds\",\"gta3.img/eastlstr2_lae2.txd/deadpalm01.dds\",\n \"gta3.img/veg_fuzzyplant.txd/deadpalm01.dds\",\"gta3.img/eastlstr2_lae2.txd/deadpalm01.dds\",\n \"gta3.img/hub_alpha.txd/dead_fuzzy.dds\",\"gta3.img/eastlstr2_lae2.txd/dead_fuzzy.dds\",\n \"gta3.img/lae2coast_alpha.txd/dead_fuzzy.dds\",\"gta3.img/eastlstr2_lae2.txd/dead_fuzzy.dds\",\n \"gta3.img/laealpha.txd/dead_fuzzy.dds\",\"gta3.img/eastlstr2_lae2.txd/dead_fuzzy.dds\",\n \"gta3.img/lawnbush.txd/dead_fuzzy.dds\",\"gta3.img/eastlstr2_lae2.txd/dead_fuzzy.dds\",\n \"gta3.img/sunrise05_lawn.txd/dead_fuzzy.dds\",\"gta3.img/eastlstr2_lae2.txd/dead_fuzzy.dds\",\n \"gta3.img/hub_alpha.txd/dead_agave.dds\",\"gta3.img/eastlstr2_lae2.txd/dead_agave.dds\",\n \"gta3.img/lae2coast_alpha.txd/dead_agave.dds\",\"gta3.img/eastlstr2_lae2.txd/dead_agave.dds\",\n \"gta3.img/laealpha.txd/dead_agave.dds\",\"gta3.img/eastlstr2_lae2.txd/dead_agave.dds\",\n \"gta3.img/lawnbush.txd/dead_agave.dds\",\"gta3.img/eastlstr2_lae2.txd/dead_agave.dds\",\n \"gta3.img/stormd_filllas2.txd/dead_agave.dds\",\"gta3.img/eastlstr2_lae2.txd/dead_agave.dds\",\n \"gta3.img/stormd_fill.txd/dead_agave.dds\",\"gta3.img/eastlstr2_lae2.txd/dead_agave.dds\",\n \"gta3.img/sunrise05_lawn.txd/dead_agave.dds\",\"gta3.img/eastlstr2_lae2.txd/dead_agave.dds\",\n \"gta3.img/wiresetc_las2.txd/dead_agave.dds\",\"gta3.img/eastlstr2_lae2.txd/dead_agave.dds\",\n \"gta3.img/hub_alpha.txd/antenna1.dds\",\"gta3.img/eastlstr2_lae2.txd/antenna1.dds\",\n \"gta3.img/lae2coast_alpha.txd/antenna1.dds\",\"gta3.img/eastlstr2_lae2.txd/antenna1.dds\",\n \"gta3.img/laealpha.txd/antenna1.dds\",\"gta3.img/eastlstr2_lae2.txd/antenna1.dds\",\n \"gta3.img/wiresetc2_las.txd/antenna1.dds\",\"gta3.img/eastlstr2_lae2.txd/antenna1.dds\",\n \"gta3.img/wiresetc_las2.txd/antenna1.dds\",\"gta3.img/eastlstr2_lae2.txd/antenna1.dds\",\n \"gta3.img/wiresetc_las.txd/antenna1.dds\",\"gta3.img/eastlstr2_lae2.txd/antenna1.dds\",\n \"gta3.img/furniture_lae2.txd/shopdoors1_lae.dds\",\"gta3.img/eastshops1_lae.txd/shopdoors1_lae.dds\",\n \"gta3.img/gangblok1_lae2.txd/shopdoors1_lae.dds\",\"gta3.img/eastshops1_lae.txd/shopdoors1_lae.dds\",\n \"gta3.img/shops01_law.txd/shopdoors1_lae.dds\",\"gta3.img/eastshops1_lae.txd/shopdoors1_lae.dds\",\n \"gta3.img/templae2land.txd/shopdoors1_lae.dds\",\"gta3.img/eastshops1_lae.txd/shopdoors1_lae.dds\",\n \"gta3.img/lashops91_las2.txd/glasprinshop1lae.dds\",\"gta3.img/eastshops1_lae.txd/glasprinshop1lae.dds\",\n \"gta3.img/furniture_lae2.txd/lastripmall1.dds\",\"gta3.img/eastshops1_lae.txd/lastripmall1.dds\",\n \"gta3.img/templae2land.txd/lastripmall1.dds\",\"gta3.img/eastshops1_lae.txd/lastripmall1.dds\",\n \"gta3.img/hillhousex_la10_12.txd/3winstone_law.dds\",\"gta3.img/ebeachcineblok.txd/3winstone_law.dds\",\n \"gta3.img/lae2bigblock.txd/3winstone_law.dds\",\"gta3.img/ebeachcineblok.txd/3winstone_law.dds\",\n \"gta3.img/glenpark6d_lae.txd/downtwin21.dds\",\"gta3.img/ebeachcineblok.txd/downtwin21.dds\",\n \"gta3.img/hillhousex_la9.txd/downtwin21.dds\",\"gta3.img/ebeachcineblok.txd/downtwin21.dds\",\n \"gta3.img/idlewood46_lae.txd/downtwin21.dds\",\"gta3.img/ebeachcineblok.txd/downtwin21.dds\",\n \"gta3.img/lae2bigblock.txd/downtwin21.dds\",\"gta3.img/ebeachcineblok.txd/downtwin21.dds\",\n \"gta3.img/rodeo02_law2.txd/downtwin21.dds\",\"gta3.img/ebeachcineblok.txd/downtwin21.dds\",\n \"gta3.img/sunset1_lan2.txd/downtwin21.dds\",\"gta3.img/ebeachcineblok.txd/downtwin21.dds\",\n \"gta3.img/ws_apgatex.txd/wheel02_64.dds\",\"gta3.img/electricgate.txd/wheel02_64.dds\",\n \"gta_int.img/kickstart.txd/banding6_64hv.dds\",\"gta3.img/electricgate.txd/banding6_64hv.dds\",\n \"gta3.img/vgsswarehse02c.txd/notice01.dds\",\"gta3.img/electricgate.txd/notice01.dds\",\n \"gta3.img/sawmillcs_t.txd/keepout_64.dds\",\"gta3.img/electricgate.txd/keepout_64.dds\",\n \"gta3.img/vgsswarehse02c.txd/keepout_64.dds\",\"gta3.img/electricgate.txd/keepout_64.dds\",\n \"gta3.img/vgsswarehse02.txd/keepout_64.dds\",\"gta3.img/electricgate.txd/keepout_64.dds\",\n \"gta3.img/wiresnshit.txd/keepout_64.dds\",\"gta3.img/electricgate.txd/keepout_64.dds\",\n \"gta3.img/sunrise.txd/remapelegybody128.dds\",\"gta3.img/elegy.txd/remapelegybody128.dds\",\n \"gta3.img/indust_lax.txd/lasjmpow2.dds\",\"gta3.img/ele_substation.txd/lasjmpow2.dds\",\n \"gta3.img/transformer_sfs.txd/lasjmpow2.dds\",\"gta3.img/ele_substation.txd/lasjmpow2.dds\",\n \"gta3.img/indust_lax.txd/lasjmpow1.dds\",\"gta3.img/ele_substation.txd/lasjmpow1.dds\",\n \"gta3.img/transformer_sfs.txd/lasjmpow1.dds\",\"gta3.img/ele_substation.txd/lasjmpow1.dds\",\n \"gta3.img/factorycuntw.txd/cabin2.dds\",\"gta3.img/ele_substation.txd/cabin2.dds\",\n \"gta3.img/lodchem.txd/cabin2.dds\",\"gta3.img/ele_substation.txd/cabin2.dds\",\n \"gta3.img/vegaswrehse1.txd/cabin2.dds\",\"gta3.img/ele_substation.txd/cabin2.dds\",\n \"gta3.img/indust_lax.txd/lasjmpow6.dds\",\"gta3.img/ele_substation.txd/lasjmpow6.dds\",\n \"gta3.img/transformer_sfs.txd/lasjmpow6.dds\",\"gta3.img/ele_substation.txd/lasjmpow6.dds\",\n \"gta3.img/indust_lax.txd/lasjmpow92.dds\",\"gta3.img/ele_substation.txd/lasjmpow92.dds\",\n \"gta3.img/transformer_sfs.txd/lasjmpow92.dds\",\"gta3.img/ele_substation.txd/lasjmpow92.dds\",\n \"gta3.img/tahoma.txd/tahoma92interior128.dds\",\"gta3.img/esperant.txd/esperant92interior128.dds\",\n \"gta3.img/triadcasino.txd/imperial05_128.dds\",\"gta3.img/excalibursign.txd/imperial05_128.dds\",\n \"gta3.img/vgndwntwn21.txd/vgsclubwall05_128.dds\",\"gta3.img/excalibursign.txd/vgsclubwall05_128.dds\",\n \"gta3.img/vgs_shops.txd/vgsclubwall05_128.dds\",\"gta3.img/excalibursign.txd/vgsclubwall05_128.dds\",\n \"gta3.img/excalibur.txd/excalibur05_64.dds\",\"gta3.img/excalibursign.txd/excalibur05_64.dds\",\n \"gta3.img/vgeamun.txd/excalibur05_64.dds\",\"gta3.img/excalibursign.txd/excalibur05_64.dds\",\n \"gta3.img/sw_oldshack.txd/sw_cabinwall01.dds\",\"gta3.img/excaliburtorch.txd/sw_cabinwall01.dds\",\n \"gta3.img/pirateship01.txd/tislndshpillar01_128.dds\",\"gta3.img/excaliburtorch.txd/tislndshpillar01_128.dds\",\n \"gta3.img/skullpillar.txd/tislndshpillar01_128.dds\",\"gta3.img/excaliburtorch.txd/tislndshpillar01_128.dds\",\n \"gta3.img/tikibridge.txd/tislndshpillar01_128.dds\",\"gta3.img/excaliburtorch.txd/tislndshpillar01_128.dds\",\n \"gta3.img/woodpillar01_lvs.txd/tislndshpillar01_128.dds\",\"gta3.img/excaliburtorch.txd/tislndshpillar01_128.dds\",\n \"gta3.img/skullpillar.txd/northwood3_128.dds\",\"gta3.img/excaliburtorch.txd/northwood3_128.dds\",\n \"gta3.img/woodpillar01_lvs.txd/northwood3_128.dds\",\"gta3.img/excaliburtorch.txd/northwood3_128.dds\",\n \"gta_int.img/svcunthoose.txd/northwood3_128.dds\",\"gta3.img/excaliburtorch.txd/northwood3_128.dds\",\n \"gta3.img/vgnground2.txd/vegasroad1_256.dds\",\"gta3.img/excalibur.txd/vegasroad1_256.dds\",\n \"gta3.img/vgnground.txd/vegasroad1_256.dds\",\"gta3.img/excalibur.txd/vegasroad1_256.dds\",\n \"gta3.img/vgsehighways.txd/vegasroad1_256.dds\",\"gta3.img/excalibur.txd/vegasroad1_256.dds\",\n \"gta3.img/vgseroads.txd/vegasroad1_256.dds\",\"gta3.img/excalibur.txd/vegasroad1_256.dds\",\n \"gta3.img/vgsnhighway.txd/vegasroad1_256.dds\",\"gta3.img/excalibur.txd/vegasroad1_256.dds\",\n \"gta3.img/vgssdrtyroads.txd/vegasroad1_256.dds\",\"gta3.img/excalibur.txd/vegasroad1_256.dds\",\n \"gta3.img/vgssroads.txd/vegasroad1_256.dds\",\"gta3.img/excalibur.txd/vegasroad1_256.dds\",\n \"gta3.img/vgwestground.txd/vegasroad1_256.dds\",\"gta3.img/excalibur.txd/vegasroad1_256.dds\",\n \"gta3.img/vgwstdirtyrd.txd/vegasroad1_256.dds\",\"gta3.img/excalibur.txd/vegasroad1_256.dds\",\n \"gta3.img/vgwsthiway1.txd/vegasroad1_256.dds\",\"gta3.img/excalibur.txd/vegasroad1_256.dds\",\n \"gta3.img/fctrygrnd01.txd/vegaspavement2_256.dds\",\"gta3.img/excalibur.txd/vegaspavement2_256.dds\",\n \"gta3.img/lahillsroads6.txd/vegaspavement2_256.dds\",\"gta3.img/excalibur.txd/vegaspavement2_256.dds\",\n \"gta3.img/lan2freeway.txd/vegaspavement2_256.dds\",\"gta3.img/excalibur.txd/vegaspavement2_256.dds\",\n \"gta3.img/trnstnground.txd/vegaspavement2_256.dds\",\"gta3.img/excalibur.txd/vegaspavement2_256.dds\",\n \"gta3.img/vgnground2.txd/vegaspavement2_256.dds\",\"gta3.img/excalibur.txd/vegaspavement2_256.dds\",\n \"gta3.img/vgnground.txd/vegaspavement2_256.dds\",\"gta3.img/excalibur.txd/vegaspavement2_256.dds\",\n \"gta3.img/vgsehighways.txd/vegaspavement2_256.dds\",\"gta3.img/excalibur.txd/vegaspavement2_256.dds\",\n \"gta3.img/vgseroads.txd/vegaspavement2_256.dds\",\"gta3.img/excalibur.txd/vegaspavement2_256.dds\",\n \"gta3.img/vgsnhighway.txd/vegaspavement2_256.dds\",\"gta3.img/excalibur.txd/vegaspavement2_256.dds\",\n \"gta3.img/vgssdrtyroads.txd/vegaspavement2_256.dds\",\"gta3.img/excalibur.txd/vegaspavement2_256.dds\",\n \"gta3.img/vgsshiways.txd/vegaspavement2_256.dds\",\"gta3.img/excalibur.txd/vegaspavement2_256.dds\",\n \"gta3.img/vgssland03.txd/vegaspavement2_256.dds\",\"gta3.img/excalibur.txd/vegaspavement2_256.dds\",\n \"gta3.img/vgssland.txd/vegaspavement2_256.dds\",\"gta3.img/excalibur.txd/vegaspavement2_256.dds\",\n \"gta3.img/vgssmulticarprk.txd/vegaspavement2_256.dds\",\"gta3.img/excalibur.txd/vegaspavement2_256.dds\",\n \"gta3.img/vgssroads.txd/vegaspavement2_256.dds\",\"gta3.img/excalibur.txd/vegaspavement2_256.dds\",\n \"gta3.img/vgwestground.txd/vegaspavement2_256.dds\",\"gta3.img/excalibur.txd/vegaspavement2_256.dds\",\n \"gta3.img/vgwstdirtyrd.txd/vegaspavement2_256.dds\",\"gta3.img/excalibur.txd/vegaspavement2_256.dds\",\n \"gta3.img/vgwsthiway1.txd/vegaspavement2_256.dds\",\"gta3.img/excalibur.txd/vegaspavement2_256.dds\",\n \"gta3.img/vgsdwntwn2.txd/excaliburwall02_128.dds\",\"gta3.img/excalibur.txd/excaliburwall02_128.dds\",\n \"gta3.img/vgnground.txd/bow_grass_gryard.dds\",\"gta3.img/exclibrland.txd/bow_grass_gryard.dds\",\n \"gta3.img/vgseroads.txd/bow_grass_gryard.dds\",\"gta3.img/exclibrland.txd/bow_grass_gryard.dds\",\n \"gta3.img/vgwestground.txd/bow_grass_gryard.dds\",\"gta3.img/exclibrland.txd/bow_grass_gryard.dds\",\n \"gta_int.img/gf3.txd/cj_wooddoor4.dds\",\"gta3.img/ext_doors2.txd/cj_wooddoor4.dds\",\n \"gta3.img/int_doors.txd/cj_scor_door.dds\",\"gta3.img/ext_doors2.txd/cj_scor_door.dds\",\n \"gta3.img/queensammo_sfs.txd/cj_scor_door.dds\",\"gta3.img/ext_doors2.txd/cj_scor_door.dds\",\n \"gta3.img/shop_doors.txd/cj_scor_door.dds\",\"gta3.img/ext_doors2.txd/cj_scor_door.dds\",\n \"gta_int.img/tsdinerxitbox.txd/cj_door6.dds\",\"gta3.img/ext_doors_old.txd/cj_door6.dds\",\n \"gta_int.img/external.txd/cj_lamppost4.dds\",\"gta3.img/externalext.txd/cj_lamppost4.dds\",\n \"gta_int.img/external.txd/cj_lens.dds\",\"gta3.img/externalext.txd/cj_lens.dds\",\n \"gta_int.img/external.txd/cj_lamppost3.dds\",\"gta3.img/externalext.txd/cj_lamppost3.dds\",\n \"gta3.img/w_town2cs_t.txd/inddoor1.dds\",\"gta3.img/factorycunte.txd/inddoor1.dds\",\n \"gta3.img/w_town2cs_t.txd/dirtgrn128.dds\",\"gta3.img/factorycunte.txd/dirtgrn128.dds\",\n \"gta3.img/lashops93_las2.txd/hi_nopark1_256128.dds\",\"gta3.img/factorycunte.txd/hi_nopark1_256128.dds\",\n \"gta3.img/sawmillcs_t.txd/hi_nopark1_256128.dds\",\"gta3.img/factorycunte.txd/hi_nopark1_256128.dds\",\n \"gta3.img/w_town2cs_t.txd/hi_nopark1_256128.dds\",\"gta3.img/factorycunte.txd/hi_nopark1_256128.dds\",\n \"gta3.img/losflor4_lae2.txd/newall3_16c128.dds\",\"gta3.img/factorycunte.txd/newall3_16c128.dds\",\n \"gta3.img/w_town2cs_t.txd/newall3_16c128.dds\",\"gta3.img/factorycunte.txd/newall3_16c128.dds\",\n \"gta_int.img/genintintcarint3.txd/newall3_16c128.dds\",\"gta3.img/factorycunte.txd/newall3_16c128.dds\",\n \"gta3.img/plantbox.txd/frate_doors64128.dds\",\"gta3.img/factorycuntw.txd/frate_doors64128.dds\",\n \"gta3.img/vegaswrehse1.txd/frate_doors64128.dds\",\"gta3.img/factorycuntw.txd/frate_doors64128.dds\",\n \"gta3.img/vgnfrates.txd/frate_doors64128.dds\",\"gta3.img/factorycuntw.txd/frate_doors64128.dds\",\n \"gta3.img/vgnpwroutbld3.txd/frate_doors64128.dds\",\"gta3.img/factorycuntw.txd/frate_doors64128.dds\",\n \"gta3.img/vgsefreight.txd/frate_doors64128.dds\",\"gta3.img/factorycuntw.txd/frate_doors64128.dds\",\n \"gta3.img/vgsswarehse01.txd/frate_doors64128.dds\",\"gta3.img/factorycuntw.txd/frate_doors64128.dds\",\n \"gta3.img/vgsswarehse02b.txd/frate_doors64128.dds\",\"gta3.img/factorycuntw.txd/frate_doors64128.dds\",\n \"gta3.img/vgsswarehse02.txd/frate_doors64128.dds\",\"gta3.img/factorycuntw.txd/frate_doors64128.dds\",\n \"gta3.img/vgsswrehse03.txd/frate_doors64128.dds\",\"gta3.img/factorycuntw.txd/frate_doors64128.dds\",\n \"gta3.img/vgwestoutwn2.txd/frate_doors64128.dds\",\"gta3.img/factorycuntw.txd/frate_doors64128.dds\",\n \"gta3.img/vgnpwroutbld1.txd/ladder64.dds\",\"gta3.img/factorycuntw.txd/ladder64.dds\",\n \"gta3.img/vgnpwroutbld2.txd/ladder64.dds\",\"gta3.img/factorycuntw.txd/ladder64.dds\",\n \"gta3.img/vgnpwroutbld3.txd/ladder64.dds\",\"gta3.img/factorycuntw.txd/ladder64.dds\",\n \"gta_int.img/genintintcarint3.txd/ladder64.dds\",\"gta3.img/factorycuntw.txd/ladder64.dds\",\n \"gta_int.img/genintintgarage3b.txd/ladder64.dds\",\"gta3.img/factorycuntw.txd/ladder64.dds\",\n \"gta3.img/factory_sfse.txd/ws_oldwarehouse10.dds\",\"gta3.img/factorynewsfse.txd/ws_oldwarehouse10.dds\",\n \"gta3.img/genwhse_sfse.txd/ws_oldwarehouse10.dds\",\"gta3.img/factorynewsfse.txd/ws_oldwarehouse10.dds\",\n \"gta3.img/genwhse_sfs.txd/ws_oldwarehouse10.dds\",\"gta3.img/factorynewsfse.txd/ws_oldwarehouse10.dds\",\n \"gta3.img/tempstuff_lae.txd/examwind1_lae.dds\",\"gta3.img/farmhouse.txd/examwind1_lae.dds\",\n \"gta3.img/hashblock1b_sfs.txd/gz_vic3d.dds\",\"gta3.img/farmhouse.txd/gz_vic3d.dds\",\n \"gta3.img/hashhouses1_sfs.txd/gz_vic3d.dds\",\"gta3.img/farmhouse.txd/gz_vic3d.dds\",\n \"gta3.img/sfvictorian.txd/gz_vic3d.dds\",\"gta3.img/farmhouse.txd/gz_vic3d.dds\",\n \"gta3.img/vict_sfw.txd/gz_vic3d.dds\",\"gta3.img/farmhouse.txd/gz_vic3d.dds\",\n \"gta3.img/weefarmcuntw.txd/sjmbigold2.dds\",\"gta3.img/farmhouse.txd/sjmbigold2.dds\",\n \"gta3.img/tractor.txd/tractor128.dds\",\"gta3.img/farmtr1.txd/tractor128.dds\",\n \"gta3.img/rancher.txd/rancher92interior128.dds\",\"gta3.img/fbiranch.txd/rancher92interior128.dds\",\n \"gta3.img/rnchlure.txd/rancher92interior128.dds\",\"gta3.img/fbiranch.txd/rancher92interior128.dds\",\n \"gta3.img/trnstnground.txd/vgsclubpllr01_64.dds\",\"gta3.img/fctrygrnd01.txd/vgsclubpllr01_64.dds\",\n \"gta3.img/vegassland62.txd/vgsclubpllr01_64.dds\",\"gta3.img/fctrygrnd01.txd/vgsclubpllr01_64.dds\",\n \"gta3.img/vgsmotelgrnd.txd/vgsclubpllr01_64.dds\",\"gta3.img/fctrygrnd01.txd/vgsclubpllr01_64.dds\",\n \"gta3.img/vgs_shops.txd/vgsclubpllr01_64.dds\",\"gta3.img/fctrygrnd01.txd/vgsclubpllr01_64.dds\",\n \"gta3.img/vgsecarshow.txd/ws_rollerdoor_blue.dds\",\"gta3.img/fedmint_sfs.txd/ws_rollerdoor_blue.dds\",\n \"gta3.img/gazlaw3.txd/ws_security_door.dds\",\"gta3.img/fedmint_sfs.txd/ws_security_door.dds\",\n \"gta3.img/gazsfn1.txd/ws_security_door.dds\",\"gta3.img/fedmint_sfs.txd/ws_security_door.dds\",\n \"gta3.img/sfn_helipad.txd/ws_security_door.dds\",\"gta3.img/fedmint_sfs.txd/ws_security_door.dds\",\n \"gta3.img/lomall.txd/skylight_windows.dds\",\"gta3.img/ferry_building.txd/skylight_windows.dds\",\n \"gta3.img/moregenroofstuff.txd/skylight_windows.dds\",\"gta3.img/ferry_building.txd/skylight_windows.dds\",\n \"gta3.img/sfe_copchop.txd/skylight_windows.dds\",\"gta3.img/ferry_building.txd/skylight_windows.dds\",\n \"gta3.img/sunset1_lan2.txd/skylight_windows.dds\",\"gta3.img/ferry_building.txd/skylight_windows.dds\",\n \"gta3.img/vgnhelipad1.txd/skylight_windows.dds\",\"gta3.img/ferry_building.txd/skylight_windows.dds\",\n \"gta3.img/law_doontoon.txd/ferry_build12.dds\",\"gta3.img/ferry_building.txd/ferry_build12.dds\",\n \"gta3.img/pier_sfe.txd/ferry_build76.dds\",\"gta3.img/ferry_building.txd/ferry_build76.dds\",\n \"gta3.img/pier_sfe.txd/ferry_build8.dds\",\"gta3.img/ferry_building.txd/ferry_build8.dds\",\n \"gta3.img/smallertxd.txd/ferry_build5.dds\",\"gta3.img/ferry_building.txd/ferry_build5.dds\",\n \"gta3.img/pier_sfe.txd/ferry_build2.dds\",\"gta3.img/ferry_building.txd/ferry_build2.dds\",\n \"gta3.img/pier_sfe.txd/ferry_build1.dds\",\"gta3.img/ferry_building.txd/ferry_build1.dds\",\n \"gta3.img/fhandr.txd/blue3.dds\",\"gta3.img/fhandl.txd/blue3.dds\",\n \"gta3.img/lanfireesc_tr.txd/sl_lavicdtdecor1.dds\",\"gta3.img/fighot.txd/sl_lavicdtdecor1.dds\",\n \"gta3.img/lanblokb2.txd/sl_lavicdtwin3.dds\",\"gta3.img/fighot.txd/sl_lavicdtwin3.dds\",\n \"gta3.img/lanblokb2.txd/sl_lavicdtcnr.dds\",\"gta3.img/fighot.txd/sl_lavicdtcnr.dds\",\n \"gta3.img/lanlacmab_lan2.txd/sl_lavicdtcnr.dds\",\"gta3.img/fighot.txd/sl_lavicdtcnr.dds\",\n \"gta3.img/lanlacmab_lan2.txd/sl_lavicdtwin2.dds\",\"gta3.img/fighot.txd/sl_lavicdtwin2.dds\",\n \"gta3.img/lahillsads.txd/victim_bboard.dds\",\"gta3.img/filmstud.txd/victim_bboard.dds\",\n \"gta3.img/vgnshopnmall.txd/victim_bboard.dds\",\"gta3.img/filmstud.txd/victim_bboard.dds\",\n \"gta3.img/vgsn_billboard.txd/victim_bboard.dds\",\"gta3.img/filmstud.txd/victim_bboard.dds\",\n \"gta_int.img/savesfmid.txd/victim_bboard.dds\",\"gta3.img/filmstud.txd/victim_bboard.dds\",\n \"gta_int.img/svsfsm.txd/victim_bboard.dds\",\"gta3.img/filmstud.txd/victim_bboard.dds\",\n \"gta3.img/golf_sfs.txd/golf_heavygrass.dds\",\"gta3.img/filmstud.txd/golf_heavygrass.dds\",\n \"gta3.img/landlae2.txd/golf_heavygrass.dds\",\"gta3.img/filmstud.txd/golf_heavygrass.dds\",\n \"gta3.img/rodeoprk_law2.txd/golf_heavygrass.dds\",\"gta3.img/filmstud.txd/golf_heavygrass.dds\",\n \"gta3.img/stormdrain.txd/golf_heavygrass.dds\",\"gta3.img/filmstud.txd/golf_heavygrass.dds\",\n \"gta3.img/sw_church.txd/golf_heavygrass.dds\",\"gta3.img/filmstud.txd/golf_heavygrass.dds\",\n \"gta3.img/sw_library.txd/golf_heavygrass.dds\",\"gta3.img/filmstud.txd/golf_heavygrass.dds\",\n \"gta3.img/vgnglfcrse1.txd/golf_heavygrass.dds\",\"gta3.img/filmstud.txd/golf_heavygrass.dds\",\n \"gta3.img/vgwestcoast.txd/golf_heavygrass.dds\",\"gta3.img/filmstud.txd/golf_heavygrass.dds\",\n \"gta3.img/vgwestland.txd/golf_heavygrass.dds\",\"gta3.img/filmstud.txd/golf_heavygrass.dds\",\n \"gta3.img/hotel1.txd/ws_usflagcrumpled.dds\",\"gta3.img/firehouse_sfse.txd/ws_usflagcrumpled.dds\",\n \"gta3.img/lae2bigblock.txd/halldoor01_law.dds\",\"gta3.img/firehouse_sfse.txd/halldoor01_law.dds\",\n \"gta3.img/securica.txd/securica92plate32.dds\",\"gta3.img/firetruk.txd/firetruk92plate32.dds\",\n \"gta3.img/lae2bigblock.txd/sfe_nicearch5.dds\",\"gta3.img/fishwarf.txd/sfe_nicearch5.dds\",\n \"gta3.img/law_doontoon.txd/sfe_nicearch5.dds\",\"gta3.img/fishwarf.txd/sfe_nicearch5.dds\",\n \"gta3.img/lngblok_lae2.txd/sfe_nicearch5.dds\",\"gta3.img/fishwarf.txd/sfe_nicearch5.dds\",\n \"gta3.img/sfe_swank1.txd/sfe_nicearch5.dds\",\"gta3.img/fishwarf.txd/sfe_nicearch5.dds\",\n \"gta3.img/smallertxd.txd/sfe_nicearch5.dds\",\"gta3.img/fishwarf.txd/sfe_nicearch5.dds\",\n \"gta3.img/mall_law.txd/sw_realty.dds\",\"gta3.img/fishwarf.txd/sw_realty.dds\",\n \"gta3.img/sw_apartflat.txd/sw_realty.dds\",\"gta3.img/fishwarf.txd/sw_realty.dds\",\n \"gta3.img/sw_block12.txd/sw_realty.dds\",\"gta3.img/fishwarf.txd/sw_realty.dds\",\n \"gta3.img/hashblock1b_sfs.txd/gz_vic3b.dds\",\"gta3.img/fishwarf.txd/gz_vic3b.dds\",\n \"gta3.img/hashhouses1_sfs.txd/gz_vic3b.dds\",\"gta3.img/fishwarf.txd/gz_vic3b.dds\",\n \"gta3.img/law_doontoon.txd/gz_vic3b.dds\",\"gta3.img/fishwarf.txd/gz_vic3b.dds\",\n \"gta3.img/sfe_swank1.txd/gz_vic3b.dds\",\"gta3.img/fishwarf.txd/gz_vic3b.dds\",\n \"gta3.img/sfvictorian.txd/gz_vic3b.dds\",\"gta3.img/fishwarf.txd/gz_vic3b.dds\",\n \"gta3.img/stolenbuild02.txd/gz_vic3b.dds\",\"gta3.img/fishwarf.txd/gz_vic3b.dds\",\n \"gta3.img/vict_sfw.txd/gz_vic3b.dds\",\"gta3.img/fishwarf.txd/gz_vic3b.dds\",\n \"gta3.img/flmngoland.txd/flmngo10_128.dds\",\"gta3.img/flamingo1.txd/flmngo10_128.dds\",\n \"gta3.img/flmngoland.txd/flmngo06_128.dds\",\"gta3.img/flamingo1.txd/flmngo06_128.dds\",\n \"gta3.img/vgncircir.txd/casinolights4_128.dds\",\"gta3.img/flamingo1.txd/casinolights4_128.dds\",\n \"gta3.img/vgnfremnt1.txd/casinolights4_128.dds\",\"gta3.img/flamingo1.txd/casinolights4_128.dds\",\n \"gta3.img/vgnfremnt2.txd/casinolights4_128.dds\",\"gta3.img/flamingo1.txd/casinolights4_128.dds\",\n \"gta3.img/vgsschurch.txd/vgschurchwall05_128.dds\",\"gta3.img/flmngoland.txd/vgschurchwall05_128.dds\",\n \"gta3.img/wddngchplgrnd01.txd/vgschurchwall05_128.dds\",\"gta3.img/flmngoland.txd/vgschurchwall05_128.dds\",\n \"gta3.img/roads_law.txd/newhedgea.dds\",\"gta3.img/flmngoland.txd/newhedgea.dds\",\n \"gta3.img/sunset02_law2.txd/newhedgea.dds\",\"gta3.img/flmngoland.txd/newhedgea.dds\",\n \"gta3.img/vegasroads.txd/newhedgea.dds\",\"gta3.img/flmngoland.txd/newhedgea.dds\",\n \"gta3.img/vgsestriphedge.txd/newhedgea.dds\",\"gta3.img/flmngoland.txd/newhedgea.dds\",\n \"gta3.img/vgsmotelgrnd.txd/newhedgea.dds\",\"gta3.img/flmngoland.txd/newhedgea.dds\",\n \"gta3.img/vgwestground.txd/newhedgea.dds\",\"gta3.img/flmngoland.txd/newhedgea.dds\",\n \"gta3.img/wddngchplgrnd01.txd/newhedgea.dds\",\"gta3.img/flmngoland.txd/newhedgea.dds\",\n \"gta3.img/lahills_safe1.txd/la_tilered.dds\",\"gta3.img/flmngoland.txd/la_tilered.dds\",\n \"gta3.img/flowerb.txd/flowerbicon.dds\",\"gta3.img/flowera.txd/floweraicon.dds\",\n \"gta3.img/stalks.txd/flowert.dds\",\"gta3.img/flowerb.txd/flowert.dds\",\n \"gta3.img/pierb_law2.txd/dogcart02.dds\",\"gta3.img/foodkarts.txd/dogcart02.dds\",\n \"gta3.img/pierc_law2.txd/dogcart02.dds\",\"gta3.img/foodkarts.txd/dogcart02.dds\",\n \"gta3.img/lanblokb2.txd/foodmartla2.dds\",\"gta3.img/foodlawn.txd/foodmartla2.dds\",\n \"gta_int.img/pleas_dome.txd/club_roofwin_sfw.dds\",\"gta3.img/fort_sfw.txd/club_roofwin_sfw.dds\",\n \"gta3.img/hubint1_sfse.txd/cj_door6.dds\",\"gta3.img/fort_sfw.txd/cj_door6.dds\",\n \"gta3.img/triadbush_lvs.txd/starflower1.dds\",\"gta3.img/fosterflowers.txd/starflower1.dds\",\n \"gta3.img/vegashse2.txd/starflower1.dds\",\"gta3.img/fosterflowers.txd/starflower1.dds\",\n \"gta3.img/vegashse5.txd/starflower1.dds\",\"gta3.img/fosterflowers.txd/starflower1.dds\",\n \"gta3.img/vegashse6.txd/starflower1.dds\",\"gta3.img/fosterflowers.txd/starflower1.dds\",\n \"gta3.img/vegashse7.txd/starflower1.dds\",\"gta3.img/fosterflowers.txd/starflower1.dds\",\n \"gta3.img/vegassvehse7.txd/starflower1.dds\",\"gta3.img/fosterflowers.txd/starflower1.dds\",\n \"gta3.img/vgndwntwn2.txd/starflower1.dds\",\"gta3.img/fosterflowers.txd/starflower1.dds\",\n \"gta3.img/vgnglfcrse1.txd/starflower1.dds\",\"gta3.img/fosterflowers.txd/starflower1.dds\",\n \"gta3.img/vgsebushes.txd/starflower1.dds\",\"gta3.img/fosterflowers.txd/starflower1.dds\",\n \"gta3.img/vgseflowers.txd/starflower1.dds\",\"gta3.img/fosterflowers.txd/starflower1.dds\",\n \"gta3.img/vgsn_flowers.txd/starflower1.dds\",\"gta3.img/fosterflowers.txd/starflower1.dds\",\n \"gta3.img/rodeo04_law2.txd/starflower3.dds\",\"gta3.img/fosterflowers.txd/starflower3.dds\",\n \"gta3.img/triadbush_lvs.txd/starflower3.dds\",\"gta3.img/fosterflowers.txd/starflower3.dds\",\n \"gta3.img/vegashse2.txd/starflower3.dds\",\"gta3.img/fosterflowers.txd/starflower3.dds\",\n \"gta3.img/vegashse3.txd/starflower3.dds\",\"gta3.img/fosterflowers.txd/starflower3.dds\",\n \"gta3.img/vegashse5.txd/starflower3.dds\",\"gta3.img/fosterflowers.txd/starflower3.dds\",\n \"gta3.img/vegashse6.txd/starflower3.dds\",\"gta3.img/fosterflowers.txd/starflower3.dds\",\n \"gta3.img/vegashse7.txd/starflower3.dds\",\"gta3.img/fosterflowers.txd/starflower3.dds\",\n \"gta3.img/vegassvehse7.txd/starflower3.dds\",\"gta3.img/fosterflowers.txd/starflower3.dds\",\n \"gta3.img/vegstadplants.txd/starflower3.dds\",\"gta3.img/fosterflowers.txd/starflower3.dds\",\n \"gta3.img/vgndwntwn2.txd/starflower3.dds\",\"gta3.img/fosterflowers.txd/starflower3.dds\",\n \"gta3.img/vgnglfcrse1.txd/starflower3.dds\",\"gta3.img/fosterflowers.txd/starflower3.dds\",\n \"gta3.img/vgsebushes.txd/starflower3.dds\",\"gta3.img/fosterflowers.txd/starflower3.dds\",\n \"gta3.img/vgseflowers.txd/starflower3.dds\",\"gta3.img/fosterflowers.txd/starflower3.dds\",\n \"gta3.img/vgsn_flowers.txd/starflower3.dds\",\"gta3.img/fosterflowers.txd/starflower3.dds\",\n \"gta3.img/freeway2_sfs.txd/ws_freeway3.dds\",\"gta3.img/fosterroads_sfse.txd/ws_freeway3.dds\",\n \"gta3.img/freeways2_sfse.txd/ws_freeway3.dds\",\"gta3.img/fosterroads_sfse.txd/ws_freeway3.dds\",\n \"gta3.img/freeways3_sfse.txd/ws_freeway3.dds\",\"gta3.img/fosterroads_sfse.txd/ws_freeway3.dds\",\n \"gta3.img/freeway_sfs.txd/ws_freeway3.dds\",\"gta3.img/fosterroads_sfse.txd/ws_freeway3.dds\",\n \"gta3.img/freeways_sfse.txd/ws_freeway3.dds\",\"gta3.img/fosterroads_sfse.txd/ws_freeway3.dds\",\n \"gta3.img/golftunnel_sfs.txd/ws_freeway3.dds\",\"gta3.img/fosterroads_sfse.txd/ws_freeway3.dds\",\n \"gta3.img/gymblok2_lae2.txd/ws_freeway3.dds\",\"gta3.img/fosterroads_sfse.txd/ws_freeway3.dds\",\n \"gta3.img/lae2roads.txd/ws_freeway3.dds\",\"gta3.img/fosterroads_sfse.txd/ws_freeway3.dds\",\n \"gta3.img/oldfreeway_sfse.txd/ws_freeway3.dds\",\"gta3.img/fosterroads_sfse.txd/ws_freeway3.dds\",\n \"gta3.img/roadbridge_sfse.txd/ws_freeway3.dds\",\"gta3.img/fosterroads_sfse.txd/ws_freeway3.dds\",\n \"gta3.img/rodeo03_law2.txd/ws_freeway3.dds\",\"gta3.img/fosterroads_sfse.txd/ws_freeway3.dds\",\n \"gta3.img/freeways2_sfse.txd/ws_freeway2.dds\",\"gta3.img/freeway2_sfs.txd/ws_freeway2.dds\",\n \"gta3.img/freeways3_sfse.txd/ws_freeway2.dds\",\"gta3.img/freeway2_sfs.txd/ws_freeway2.dds\",\n \"gta3.img/freeway_sfs.txd/ws_freeway2.dds\",\"gta3.img/freeway2_sfs.txd/ws_freeway2.dds\",\n \"gta3.img/freeways_sfse.txd/ws_freeway2.dds\",\"gta3.img/freeway2_sfs.txd/ws_freeway2.dds\",\n \"gta3.img/sanfranfreeway.txd/ws_freeway2.dds\",\"gta3.img/freeway2_sfs.txd/ws_freeway2.dds\",\n \"gta3.img/stadjunct_sfse.txd/ws_freeway2.dds\",\"gta3.img/freeway2_sfs.txd/ws_freeway2.dds\",\n \"gta3.img/groundb_las2.txd/metal_stair_64h.dds\",\"gta3.img/freeway_las.txd/metal_stair_64h.dds\",\n \"gta3.img/ground_las2.txd/metal_stair_64h.dds\",\"gta3.img/freeway_las.txd/metal_stair_64h.dds\",\n \"gta3.img/imrancomp_las2.txd/metal_stair_64h.dds\",\"gta3.img/freeway_las.txd/metal_stair_64h.dds\",\n \"gta3.img/indust_lax.txd/metal_stair_64h.dds\",\"gta3.img/freeway_las.txd/metal_stair_64h.dds\",\n \"gta3.img/lasxrefdock.txd/metal_stair_64h.dds\",\"gta3.img/freeway_las.txd/metal_stair_64h.dds\",\n \"gta_int.img/genintwarehsint3.txd/metal_stair_64h.dds\",\"gta3.img/freeway_las.txd/metal_stair_64h.dds\",\n \"gta_int.img/smashtv.txd/metal_stair_64h.dds\",\"gta3.img/freeway_las.txd/metal_stair_64h.dds\",\n \"gta3.img/melrose13_lawn.txd/whitetile_plain_hi.dds\",\"gta3.img/freeway_las.txd/whitetile_plain_hi.dds\",\n \"gta3.img/stationtunnel.txd/whitetile_plain_hi.dds\",\"gta3.img/freeway_las.txd/whitetile_plain_hi.dds\",\n \"gta3.img/lae2roads.txd/pavemiddirt_law.dds\",\"gta3.img/freeway_las.txd/pavemiddirt_law.dds\",\n \"gta3.img/lanroad.txd/pavemiddirt_law.dds\",\"gta3.img/freeway_las.txd/pavemiddirt_law.dds\",\n \"gta3.img/law2_roadsb.txd/pavemiddirt_law.dds\",\"gta3.img/freeway_las.txd/pavemiddirt_law.dds\",\n \"gta3.img/roads_lawn.txd/pavemiddirt_law.dds\",\"gta3.img/freeway_las.txd/pavemiddirt_law.dds\",\n \"gta3.img/roads_law.txd/pavemiddirt_law.dds\",\"gta3.img/freeway_las.txd/pavemiddirt_law.dds\",\n \"gta3.img/mountainsfs.txd/dt_road2grasstype4.dds\",\"gta3.img/freeways2_sfse.txd/dt_road2grasstype4.dds\",\n \"gta3.img/mountroads_sfse.txd/dt_road2grasstype4.dds\",\"gta3.img/freeways2_sfse.txd/dt_road2grasstype4.dds\",\n \"gta3.img/roads_sfs.txd/dt_road2grasstype4.dds\",\"gta3.img/freeways2_sfse.txd/dt_road2grasstype4.dds\",\n \"gta3.img/silconland_sfse.txd/dt_road2grasstype4.dds\",\"gta3.img/freeways2_sfse.txd/dt_road2grasstype4.dds\",\n \"gta3.img/sv_ground_sfs.txd/dt_road2grasstype4.dds\",\"gta3.img/freeways2_sfse.txd/dt_road2grasstype4.dds\",\n \"gta3.img/roadbridge_sfse.txd/ws_bridgepavement.dds\",\"gta3.img/freeways3_sfse.txd/ws_bridgepavement.dds\",\n \"gta3.img/freeways_sfse.txd/ws_freeway1.dds\",\"gta3.img/freeways3_sfse.txd/ws_freeway1.dds\",\n \"gta3.img/sanfranfreeway.txd/ws_freeway1.dds\",\"gta3.img/freeways3_sfse.txd/ws_freeway1.dds\",\n \"gta3.img/stadjunct_sfse.txd/ws_freeway1.dds\",\"gta3.img/freeways3_sfse.txd/ws_freeway1.dds\",\n \"gta3.img/junk.txd/junk_tyre.dds\",\"gta3.img/freightcrane.txd/junk_tyre.dds\",\n \"gta3.img/smallertxd.txd/sfmast2.dds\",\"gta3.img/frieghter2sfe.txd/sfmast2.dds\",\n \"gta3.img/vegasemulticar.txd/sfmast2.dds\",\"gta3.img/frieghter2sfe.txd/sfmast2.dds\",\n \"gta3.img/sfeship1.txd/sf_shipbulklight.dds\",\"gta3.img/frieghter2sfe.txd/sf_shipbulklight.dds\",\n \"gta3.img/ship_brijsfw.txd/sf_shipbulklight.dds\",\"gta3.img/frieghter2sfe.txd/sf_shipbulklight.dds\",\n \"gta_int.img/ab_sfammumain.txd/gun_floor1.dds\",\"gta3.img/frieghter2sfe.txd/gun_floor1.dds\",\n \"gta_int.img/ammu_twofloor.txd/gun_floor1.dds\",\"gta3.img/frieghter2sfe.txd/gun_floor1.dds\",\n \"gta_int.img/papaerchaseoffice.txd/gun_floor1.dds\",\"gta3.img/frieghter2sfe.txd/gun_floor1.dds\",\n \"gta_int.img/range_main.txd/gun_floor1.dds\",\"gta3.img/frieghter2sfe.txd/gun_floor1.dds\",\n \"gta3.img/lashops6_las2.txd/ammu_airvent.dds\",\"gta3.img/furniture_lae2.txd/ammu_airvent.dds\",\n \"gta3.img/lae2roads.txd/craproad6_lae.dds\",\"gta3.img/furniture_lae2.txd/craproad6_lae.dds\",\n \"gta3.img/package1.txd/totem64.dds\",\"gta3.img/furniture_lae2.txd/totem64.dds\",\n \"gta3.img/melrose05_lawn.txd/brckwht128.dds\",\"gta3.img/furniture_lae2.txd/brckwht128.dds\",\n \"gta3.img/sunst18_lawn.txd/inwindow4.dds\",\"gta3.img/furniture_lae2.txd/inwindow4.dds\",\n \"gta3.img/vgncoast.txd/inwindow4.dds\",\"gta3.img/furniture_lae2.txd/inwindow4.dds\",\n \"gta3.img/vgspumphse.txd/inwindow4.dds\",\"gta3.img/furniture_lae2.txd/inwindow4.dds\",\n \"gta3.img/railtracklae.txd/heliconcrete.dds\",\"gta3.img/gang2hous1_lae.txd/heliconcrete.dds\",\n \"gta3.img/vegashse2.txd/heliconcrete.dds\",\"gta3.img/gang2hous1_lae.txd/heliconcrete.dds\",\n \"gta3.img/vegashse3.txd/heliconcrete.dds\",\"gta3.img/gang2hous1_lae.txd/heliconcrete.dds\",\n \"gta3.img/vegashse4.txd/heliconcrete.dds\",\"gta3.img/gang2hous1_lae.txd/heliconcrete.dds\",\n \"gta3.img/vegashse5.txd/heliconcrete.dds\",\"gta3.img/gang2hous1_lae.txd/heliconcrete.dds\",\n \"gta3.img/vegashse6.txd/heliconcrete.dds\",\"gta3.img/gang2hous1_lae.txd/heliconcrete.dds\",\n \"gta3.img/vegashse7.txd/heliconcrete.dds\",\"gta3.img/gang2hous1_lae.txd/heliconcrete.dds\",\n \"gta3.img/vegashse8.txd/heliconcrete.dds\",\"gta3.img/gang2hous1_lae.txd/heliconcrete.dds\",\n \"gta_int.img/sumostad.txd/heliconcrete.dds\",\"gta3.img/gang2hous1_lae.txd/heliconcrete.dds\",\n \"gta3.img/hashhouses1_sfs.txd/gz_vic3c.dds\",\"gta3.img/gangblok1_lae2.txd/gz_vic3c.dds\",\n \"gta3.img/sfvictorian.txd/gz_vic3c.dds\",\"gta3.img/gangblok1_lae2.txd/gz_vic3c.dds\",\n \"gta3.img/vict_sfw.txd/gz_vic3c.dds\",\"gta3.img/gangblok1_lae2.txd/gz_vic3c.dds\",\n \"gta3.img/ground3_las.txd/mural01_la.dds\",\"gta3.img/gangblok1_lae2.txd/mural01_la.dds\",\n \"gta3.img/lasground_las2.txd/mural01_la.dds\",\"gta3.img/gangblok1_lae2.txd/mural01_la.dds\",\n \"gta3.img/laeast2_lod.txd/drugdlrshoos_lod.dds\",\"gta3.img/gangholod1_lax.txd/drugdlrshoos_lod.dds\",\n \"gta3.img/laeast2_lod.txd/grassdeadbrn_lod.dds\",\"gta3.img/gangholod1_lax.txd/grassdeadbrn_lod.dds\",\n \"gta3.img/lod2lae1.txd/grassdeadbrn_lod.dds\",\"gta3.img/gangholod1_lax.txd/grassdeadbrn_lod.dds\",\n \"gta3.img/laeast2_lod.txd/beachapa5b_lod.dds\",\"gta3.img/gangholod1_lax.txd/beachapa5b_lod.dds\",\n \"gta3.img/laealpha.txd/compfence1_lae.dds\",\"gta3.img/ganghouse1_lax.txd/compfence1_lae.dds\",\n \"gta3.img/lawland2.txd/snpdhus2.dds\",\"gta3.img/ganghouse1_lax.txd/snpdhus2.dds\",\n \"gta3.img/sanpedh22_1x.txd/snpdhus2.dds\",\"gta3.img/ganghouse1_lax.txd/snpdhus2.dds\",\n \"gta3.img/glenpark6_lae.txd/chipboard_256128.dds\",\"gta3.img/ganton01_lae2.txd/chipboard_256128.dds\",\n \"gta3.img/templae2land.txd/chipboard_256128.dds\",\"gta3.img/ganton01_lae2.txd/chipboard_256128.dds\",\n \"gta3.img/vegasdwntwn1.txd/chipboard_256128.dds\",\"gta3.img/ganton01_lae2.txd/chipboard_256128.dds\",\n \"gta_int.img/ammu_2flrprops.txd/chipboard_256128.dds\",\"gta3.img/ganton01_lae2.txd/chipboard_256128.dds\",\n \"gta_int.img/cj_ammun_extra.txd/chipboard_256128.dds\",\"gta3.img/ganton01_lae2.txd/chipboard_256128.dds\",\n \"gta_int.img/munation_xtras2.txd/chipboard_256128.dds\",\"gta3.img/ganton01_lae2.txd/chipboard_256128.dds\",\n \"gta3.img/vgsebuild01.txd/yelloplaster1.dds\",\"gta3.img/ganton01_lae2.txd/yelloplaster1.dds\",\n \"gta3.img/rodeo03_law2.txd/century02_la.dds\",\"gta3.img/ganton02_lae2.txd/century02_la.dds\",\n \"gta3.img/paynspray_lae.txd/bigblue3.dds\",\"gta3.img/garag3_lawn.txd/bigblue3.dds\",\n \"gta3.img/motel_lae.txd/ws_warehswin2.dds\",\"gta3.img/garag3_lawn.txd/ws_warehswin2.dds\",\n \"gta3.img/vegaswrehse1.txd/ws_warehswin2.dds\",\"gta3.img/garag3_lawn.txd/ws_warehswin2.dds\",\n \"gta3.img/vgnfremnt1.txd/ws_warehswin2.dds\",\"gta3.img/garag3_lawn.txd/ws_warehswin2.dds\",\n \"gta3.img/vgnretail4.txd/ws_warehswin2.dds\",\"gta3.img/garag3_lawn.txd/ws_warehswin2.dds\",\n \"gta3.img/vgnretail6.txd/ws_warehswin2.dds\",\"gta3.img/garag3_lawn.txd/ws_warehswin2.dds\",\n \"gta3.img/vgnretail4.txd/orngpartwall1_256.dds\",\"gta3.img/garag3_lawn.txd/orngpartwall1_256.dds\",\n \"gta3.img/toll_sfw.txd/toll_sfw4.dds\",\"gta3.img/garage_sfw.txd/toll_sfw4.dds\",\n \"gta3.img/vgsespras.txd/toll_sfw4.dds\",\"gta3.img/garage_sfw.txd/toll_sfw4.dds\",\n \"gta3.img/vgsespras.txd/garage1b_sfw.dds\",\"gta3.img/garage_sfw.txd/garage1b_sfw.dds\",\n \"gta3.img/vgsespras.txd/garage2b_sfw.dds\",\"gta3.img/garage_sfw.txd/garage2b_sfw.dds\",\n \"gta3.img/vgsespras.txd/garage3b_sfw.dds\",\"gta3.img/garage_sfw.txd/garage3b_sfw.dds\",\n \"gta3.img/teargas.txd/gun_teargas_2.dds\",\"gta3.img/gasgren.txd/gun_teargas_2.dds\",\n \"gta3.img/vegaswrehse1.txd/trespasign1_256.dds\",\"gta3.img/gategen.txd/trespasign1_256.dds\",\n \"gta3.img/sfvictorian.txd/ws_plasterwall1.dds\",\"gta3.img/gayclub_sfs.txd/ws_plasterwall1.dds\",\n \"gta3.img/sw_diner1.txd/ws_plasterwall1.dds\",\"gta3.img/gayclub_sfs.txd/ws_plasterwall1.dds\",\n \"gta3.img/sw_med1.txd/ws_plasterwall1.dds\",\"gta3.img/gayclub_sfs.txd/ws_plasterwall1.dds\",\n \"gta3.img/new_shop_door.txd/cj_gen_glass2.dds\",\"gta3.img/gayclub_sfs.txd/cj_gen_glass2.dds\",\n \"gta3.img/shop_int_d.txd/cj_gen_glass2.dds\",\"gta3.img/gayclub_sfs.txd/cj_gen_glass2.dds\",\n \"gta_int.img/genintintbarb.txd/cj_gen_glass2.dds\",\"gta3.img/gayclub_sfs.txd/cj_gen_glass2.dds\",\n \"gta3.img/shop_int_d.txd/cj_pizza_door.dds\",\"gta3.img/gayclub_sfs.txd/cj_pizza_door.dds\",\n \"gta_int.img/genintintfasta.txd/cj_pizza_door.dds\",\"gta3.img/gayclub_sfs.txd/cj_pizza_door.dds\",\n \"gta_int.img/genintintfastc.txd/cj_pizza_door.dds\",\"gta3.img/gayclub_sfs.txd/cj_pizza_door.dds\",\n \"gta_int.img/genintintfastd.txd/cj_pizza_door.dds\",\"gta3.img/gayclub_sfs.txd/cj_pizza_door.dds\",\n \"gta3.img/sf_telpole.txd/teleconect2.dds\",\"gta3.img/gay_xref.txd/teleconect2.dds\",\n \"gta3.img/telegraph.txd/teleconect2.dds\",\"gta3.img/gay_xref.txd/teleconect2.dds\",\n \"gta3.img/vgntelepole.txd/teleconect2.dds\",\"gta3.img/gay_xref.txd/teleconect2.dds\",\n \"gta3.img/sf_telpole.txd/steel64.dds\",\"gta3.img/gay_xref.txd/steel64.dds\",\n \"gta3.img/telegraph.txd/steel64.dds\",\"gta3.img/gay_xref.txd/steel64.dds\",\n \"gta3.img/vgntelepole.txd/steel64.dds\",\"gta3.img/gay_xref.txd/steel64.dds\",\n \"gta3.img/sf_telpole.txd/metatelepole1.dds\",\"gta3.img/gay_xref.txd/metatelepole1.dds\",\n \"gta3.img/telegraph.txd/metatelepole1.dds\",\"gta3.img/gay_xref.txd/metatelepole1.dds\",\n \"gta3.img/vgntelepole.txd/metatelepole1.dds\",\"gta3.img/gay_xref.txd/metatelepole1.dds\",\n \"gta3.img/vgstlgraphpole.txd/metatelepole1.dds\",\"gta3.img/gay_xref.txd/metatelepole1.dds\",\n \"gta3.img/gazlaw2.txd/law_gazgrn7.dds\",\"gta3.img/gazlaw1.txd/law_gazgrn7.dds\",\n \"gta3.img/gazlaw2.txd/pawn_door01.dds\",\"gta3.img/gazlaw1.txd/pawn_door01.dds\",\n \"gta3.img/gazsfn2.txd/pawn_door01.dds\",\"gta3.img/gazlaw1.txd/pawn_door01.dds\",\n \"gta3.img/melrose12_lawn.txd/pawn_door01.dds\",\"gta3.img/gazlaw1.txd/pawn_door01.dds\",\n \"gta3.img/vgshpground.txd/pawn_door01.dds\",\"gta3.img/gazlaw1.txd/pawn_door01.dds\",\n \"gta3.img/vgs_shop5.txd/pawn_door01.dds\",\"gta3.img/gazlaw1.txd/pawn_door01.dds\",\n \"gta3.img/gazlaw2.txd/lawshopwall4c.dds\",\"gta3.img/gazlaw1.txd/lawshopwall4c.dds\",\n \"gta3.img/gazsfn1.txd/lawshopwall4c.dds\",\"gta3.img/gazlaw1.txd/lawshopwall4c.dds\",\n \"gta3.img/gazlaw2.txd/lawshopwall4b.dds\",\"gta3.img/gazlaw1.txd/lawshopwall4b.dds\",\n \"gta3.img/gazsfn1.txd/lawshopwall4b.dds\",\"gta3.img/gazlaw1.txd/lawshopwall4b.dds\",\n \"gta3.img/law_beach2.txd/lawshopwall4b.dds\",\"gta3.img/gazlaw1.txd/lawshopwall4b.dds\",\n \"gta3.img/gazlaw2.txd/lawshopwall3b.dds\",\"gta3.img/gazlaw1.txd/lawshopwall3b.dds\",\n \"gta3.img/gazsfn1.txd/lawshopwall3b.dds\",\"gta3.img/gazlaw1.txd/lawshopwall3b.dds\",\n \"gta3.img/law_beach2.txd/lawshopwall3b.dds\",\"gta3.img/gazlaw1.txd/lawshopwall3b.dds\",\n \"gta3.img/gazlaw2.txd/lawshopwall2b.dds\",\"gta3.img/gazlaw1.txd/lawshopwall2b.dds\",\n \"gta3.img/gazsfn1.txd/lawshopwall2b.dds\",\"gta3.img/gazlaw1.txd/lawshopwall2b.dds\",\n \"gta3.img/law_beach2.txd/lawshopwall2b.dds\",\"gta3.img/gazlaw1.txd/lawshopwall2b.dds\",\n \"gta3.img/gazlaw2.txd/lawshopwall1b.dds\",\"gta3.img/gazlaw1.txd/lawshopwall1b.dds\",\n \"gta3.img/gazsfn1.txd/lawshopwall1b.dds\",\"gta3.img/gazlaw1.txd/lawshopwall1b.dds\",\n \"gta3.img/law_beach2.txd/lawshopwall1b.dds\",\"gta3.img/gazlaw1.txd/lawshopwall1b.dds\",\n \"gta3.img/melrose08_lawn.txd/lawshopwall1b.dds\",\"gta3.img/gazlaw1.txd/lawshopwall1b.dds\",\n \"gta3.img/melrose15_lawn.txd/lawshopwall1b.dds\",\"gta3.img/gazlaw1.txd/lawshopwall1b.dds\",\n \"gta3.img/melrose19_lawn.txd/lawshopwall1b.dds\",\"gta3.img/gazlaw1.txd/lawshopwall1b.dds\",\n \"gta3.img/sunsetbittyu.txd/lawshopwall1b.dds\",\"gta3.img/gazlaw1.txd/lawshopwall1b.dds\",\n \"gta3.img/gazlaw2.txd/bow_bar_entrance_door.dds\",\"gta3.img/gazlaw1.txd/bow_bar_entrance_door.dds\",\n \"gta3.img/gazsfn1.txd/bow_bar_entrance_door.dds\",\"gta3.img/gazlaw1.txd/bow_bar_entrance_door.dds\",\n \"gta3.img/law_beach2.txd/bow_bar_entrance_door.dds\",\"gta3.img/gazlaw1.txd/bow_bar_entrance_door.dds\",\n \"gta3.img/melrose05_lawn.txd/bow_bar_entrance_door.dds\",\"gta3.img/gazlaw1.txd/bow_bar_entrance_door.dds\",\n \"gta3.img/sunsetbittyu.txd/bow_bar_entrance_door.dds\",\"gta3.img/gazlaw1.txd/bow_bar_entrance_door.dds\",\n \"gta3.img/vgnretail4.txd/bow_bar_entrance_door.dds\",\"gta3.img/gazlaw1.txd/bow_bar_entrance_door.dds\",\n \"gta3.img/gazsfn1.txd/lawshop2.dds\",\"gta3.img/gazlaw1.txd/lawshop2.dds\",\n \"gta3.img/law_beach2.txd/lawshop2.dds\",\"gta3.img/gazlaw1.txd/lawshop2.dds\",\n \"gta3.img/mall_law.txd/lawshop2.dds\",\"gta3.img/gazlaw1.txd/lawshop2.dds\",\n \"gta3.img/shops2_law.txd/lawshop2.dds\",\"gta3.img/gazlaw1.txd/lawshop2.dds\",\n \"gta3.img/gazlaw2.txd/lawshop3.dds\",\"gta3.img/gazlaw1.txd/lawshop3.dds\",\n \"gta3.img/gazlaw3.txd/lawshop3.dds\",\"gta3.img/gazlaw1.txd/lawshop3.dds\",\n \"gta3.img/gazsfn1.txd/lawshop3.dds\",\"gta3.img/gazlaw1.txd/lawshop3.dds\",\n \"gta3.img/law_beach2.txd/lawshop3.dds\",\"gta3.img/gazlaw1.txd/lawshop3.dds\",\n \"gta3.img/mall_law.txd/lawshop3.dds\",\"gta3.img/gazlaw1.txd/lawshop3.dds\",\n \"gta3.img/shops2_law.txd/lawshop3.dds\",\"gta3.img/gazlaw1.txd/lawshop3.dds\",\n \"gta3.img/gazlaw2.txd/lawshopwall3.dds\",\"gta3.img/gazlaw1.txd/lawshopwall3.dds\",\n \"gta3.img/gazsfn1.txd/lawshopwall3.dds\",\"gta3.img/gazlaw1.txd/lawshopwall3.dds\",\n \"gta3.img/law_beach2.txd/lawshopwall3.dds\",\"gta3.img/gazlaw1.txd/lawshopwall3.dds\",\n \"gta3.img/gazlaw2.txd/lawshopwall2.dds\",\"gta3.img/gazlaw1.txd/lawshopwall2.dds\",\n \"gta3.img/gazsfn1.txd/lawshopwall2.dds\",\"gta3.img/gazlaw1.txd/lawshopwall2.dds\",\n \"gta3.img/law_beach2.txd/lawshopwall2.dds\",\"gta3.img/gazlaw1.txd/lawshopwall2.dds\",\n \"gta3.img/melrose12_lawn.txd/lawshopwall2.dds\",\"gta3.img/gazlaw1.txd/lawshopwall2.dds\",\n \"gta3.img/gazlaw2.txd/lawshopwall1.dds\",\"gta3.img/gazlaw1.txd/lawshopwall1.dds\",\n \"gta3.img/gazsfn1.txd/lawshopwall1.dds\",\"gta3.img/gazlaw1.txd/lawshopwall1.dds\",\n \"gta3.img/law_beach2.txd/lawshopwall1.dds\",\"gta3.img/gazlaw1.txd/lawshopwall1.dds\",\n \"gta3.img/melrose05_lawn.txd/lawshopwall1.dds\",\"gta3.img/gazlaw1.txd/lawshopwall1.dds\",\n \"gta3.img/melrose08_lawn.txd/lawshopwall1.dds\",\"gta3.img/gazlaw1.txd/lawshopwall1.dds\",\n \"gta3.img/melrose15_lawn.txd/lawshopwall1.dds\",\"gta3.img/gazlaw1.txd/lawshopwall1.dds\",\n \"gta3.img/melrose19_lawn.txd/lawshopwall1.dds\",\"gta3.img/gazlaw1.txd/lawshopwall1.dds\",\n \"gta3.img/sunsetbittyu.txd/lawshopwall1.dds\",\"gta3.img/gazlaw1.txd/lawshopwall1.dds\",\n \"gta3.img/sfn_office.txd/law_gazwhite1.dds\",\"gta3.img/gazlaw1.txd/law_gazwhite1.dds\",\n \"gta3.img/sfn_office.txd/law_gazwhite2.dds\",\"gta3.img/gazlaw1.txd/law_gazwhite2.dds\",\n \"gta3.img/gazlaw3.txd/lawshop1.dds\",\"gta3.img/gazlaw2.txd/lawshop1.dds\",\n \"gta3.img/gazsfn1.txd/lawshop1.dds\",\"gta3.img/gazlaw2.txd/lawshop1.dds\",\n \"gta3.img/law_beach2.txd/lawshop1.dds\",\"gta3.img/gazlaw2.txd/lawshop1.dds\",\n \"gta3.img/mall_law.txd/lawshop1.dds\",\"gta3.img/gazlaw2.txd/lawshop1.dds\",\n \"gta3.img/law_doontoon.txd/gm_labuld4_d.dds\",\"gta3.img/gazlaw2.txd/gm_labuld4_d.dds\",\n \"gta3.img/laland1_lan2.txd/gm_labuld4_a.dds\",\"gta3.img/gazlaw2.txd/gm_labuld4_a.dds\",\n \"gta3.img/law_doontoon.txd/gm_labuld4_a.dds\",\"gta3.img/gazlaw2.txd/gm_labuld4_a.dds\",\n \"gta3.img/law_doontoon.txd/gm_labuld4_f.dds\",\"gta3.img/gazlaw2.txd/gm_labuld4_f.dds\",\n \"gta3.img/laland1_lan2.txd/gm_labuld4_b.dds\",\"gta3.img/gazlaw2.txd/gm_labuld4_b.dds\",\n \"gta3.img/law_doontoon.txd/gm_labuld4_b.dds\",\"gta3.img/gazlaw2.txd/gm_labuld4_b.dds\",\n \"gta3.img/libhelipad_lan2.txd/gm_labuld4_b.dds\",\"gta3.img/gazlaw2.txd/gm_labuld4_b.dds\",\n \"gta3.img/skyscr1_lan2.txd/gm_labuld4_b.dds\",\"gta3.img/gazlaw2.txd/gm_labuld4_b.dds\",\n \"gta3.img/gazsfn2.txd/sw_wind19.dds\",\"gta3.img/gazlaw2.txd/sw_wind19.dds\",\n \"gta3.img/sw_block04.txd/sw_wind19.dds\",\"gta3.img/gazlaw2.txd/sw_wind19.dds\",\n \"gta3.img/gazsfn2.txd/sw_storewin05.dds\",\"gta3.img/gazlaw2.txd/sw_storewin05.dds\",\n \"gta3.img/sw_apartflatx.txd/sw_storewin05.dds\",\"gta3.img/gazlaw2.txd/sw_storewin05.dds\",\n \"gta3.img/pier69.txd/pier69_planter.dds\",\"gta3.img/gazlaw3.txd/pier69_planter.dds\",\n \"gta3.img/smallertxd.txd/pier69_planter.dds\",\"gta3.img/gazlaw3.txd/pier69_planter.dds\",\n \"gta3.img/mall_law.txd/mono3_sfe.dds\",\"gta3.img/gazlaw3.txd/mono3_sfe.dds\",\n \"gta3.img/mall_law.txd/mono4_sfe.dds\",\"gta3.img/gazlaw3.txd/mono4_sfe.dds\",\n \"gta3.img/glenpark6_lae.txd/churchdoor1_lan.dds\",\"gta3.img/gazlaw3.txd/churchdoor1_lan.dds\",\n \"gta3.img/lanbloki.txd/churchdoor1_lan.dds\",\"gta3.img/gazlaw3.txd/churchdoor1_lan.dds\",\n \"gta3.img/sw_med1.txd/churchdoor1_lan.dds\",\"gta3.img/gazlaw3.txd/churchdoor1_lan.dds\",\n \"gta3.img/vgsscollege.txd/churchdoor1_lan.dds\",\"gta3.img/gazlaw3.txd/churchdoor1_lan.dds\",\n \"gta3.img/gazsfn1.txd/swintops01_law.dds\",\"gta3.img/gazlaw3.txd/swintops01_law.dds\",\n \"gta3.img/gazsfn1.txd/lawbanding1.dds\",\"gta3.img/gazlaw3.txd/lawbanding1.dds\",\n \"gta3.img/gazsfn1.txd/swintops01d_law.dds\",\"gta3.img/gazlaw3.txd/swintops01d_law.dds\",\n \"gta3.img/gazsfn1.txd/swintops01c_law.dds\",\"gta3.img/gazlaw3.txd/swintops01c_law.dds\",\n \"gta3.img/smallertxd.txd/sfe_bigbuild3.dds\",\"gta3.img/gazlaw3.txd/sfe_bigbuild3.dds\",\n \"gta3.img/law_beach2.txd/fillerbase01_law.dds\",\"gta3.img/gazsfn1.txd/fillerbase01_law.dds\",\n \"gta3.img/lawest1.txd/fillerbase01_law.dds\",\"gta3.img/gazsfn1.txd/fillerbase01_law.dds\",\n \"gta3.img/law_beach2.txd/fillerdoor_law.dds\",\"gta3.img/gazsfn1.txd/fillerdoor_law.dds\",\n \"gta3.img/lawest1.txd/fillerdoor_law.dds\",\"gta3.img/gazsfn1.txd/fillerdoor_law.dds\",\n \"gta3.img/law_beach2.txd/fillerbase02_law.dds\",\"gta3.img/gazsfn1.txd/fillerbase02_law.dds\",\n \"gta3.img/lawest1.txd/fillerbase02_law.dds\",\"gta3.img/gazsfn1.txd/fillerbase02_law.dds\",\n \"gta3.img/law_beach2.txd/fillerbase_law.dds\",\"gta3.img/gazsfn1.txd/fillerbase_law.dds\",\n \"gta3.img/lawest1.txd/fillerbase_law.dds\",\"gta3.img/gazsfn1.txd/fillerbase_law.dds\",\n \"gta3.img/law_beach2.txd/law_gazcoast2.dds\",\"gta3.img/gazsfn1.txd/law_gazcoast2.dds\",\n \"gta3.img/law_beach2.txd/law_gazcoast1.dds\",\"gta3.img/gazsfn1.txd/law_gazcoast1.dds\",\n \"gta3.img/law2_roadsb.txd/bow_smear_cement.dds\",\"gta3.img/gazsfn2.txd/bow_smear_cement.dds\",\n \"gta3.img/mullho03a_lahills.txd/bow_smear_cement.dds\",\"gta3.img/gazsfn2.txd/bow_smear_cement.dds\",\n \"gta3.img/vgnland.txd/bow_smear_cement.dds\",\"gta3.img/gazsfn2.txd/bow_smear_cement.dds\",\n \"gta3.img/vgwestland.txd/bow_smear_cement.dds\",\"gta3.img/gazsfn2.txd/bow_smear_cement.dds\",\n \"gta3.img/venice_law.txd/law_gazgrn1.dds\",\"gta3.img/gazsfn2.txd/law_gazgrn1.dds\",\n \"gta3.img/sfnlites.txd/fusebox1_128.dds\",\"gta3.img/gazsfnlite.txd/fusebox1_128.dds\",\n \"gta3.img/sfnlites.txd/sfxref_lite2c.dds\",\"gta3.img/gazsfnlite.txd/sfxref_lite2c.dds\",\n \"gta3.img/sfroofshit.txd/sfxref_lite2c.dds\",\"gta3.img/gazsfnlite.txd/sfxref_lite2c.dds\",\n \"gta3.img/sfxref.txd/sfxref_lite2c.dds\",\"gta3.img/gazsfnlite.txd/sfxref_lite2c.dds\",\n \"gta3.img/sfnlites.txd/sfxref_flagpole.dds\",\"gta3.img/gazsfnlite.txd/sfxref_flagpole.dds\",\n \"gta3.img/sfroofshit.txd/sfxref_flagpole.dds\",\"gta3.img/gazsfnlite.txd/sfxref_flagpole.dds\",\n \"gta3.img/sfxref.txd/sfxref_flagpole.dds\",\"gta3.img/gazsfnlite.txd/sfxref_flagpole.dds\",\n \"gta3.img/rock_coastsfw.txd/cst_bollard_sfw.dds\",\"gta3.img/gazsfnlite.txd/cst_bollard_sfw.dds\",\n \"gta3.img/sfnlites.txd/cst_bollard_sfw.dds\",\"gta3.img/gazsfnlite.txd/cst_bollard_sfw.dds\",\n \"gta3.img/immcrax.txd/snpedtest1.dds\",\"gta3.img/gb_laroads.txd/snpedtest1.dds\",\n \"gta3.img/temproadtxd.txd/snpedtest1.dds\",\"gta3.img/gb_laroads.txd/snpedtest1.dds\",\n \"gta3.img/vegasroads.txd/crossing_law.dds\",\"gta3.img/gb_laroads.txd/crossing_law.dds\",\n \"gta3.img/vegashiways.txd/hiwaymidlle_256.dds\",\"gta3.img/gb_laroads.txd/cos_hiwaymid_256.dds\",\n \"gta3.img/petrolpump.txd/vgnptrpump2_128.dds\",\"gta3.img/gen_petrol.txd/vgnptrpump2_128.dds\",\n \"gta3.img/petrolpump.txd/vgnptrpump1_256.dds\",\"gta3.img/gen_petrol.txd/vgnptrpump1_256.dds\",\n \"gta3.img/road2sfe.txd/sf_tramline2.dds\",\"gta3.img/genroads_sfse.txd/sf_tramline2.dds\",\n \"gta3.img/roadsanfranse.txd/sf_tramline2.dds\",\"gta3.img/genroads_sfse.txd/sf_tramline2.dds\",\n \"gta3.img/roadsfe.txd/sf_tramline2.dds\",\"gta3.img/genroads_sfse.txd/sf_tramline2.dds\",\n \"gta3.img/tramstatsfw.txd/sf_tramline2.dds\",\"gta3.img/genroads_sfse.txd/sf_tramline2.dds\",\n \"gta3.img/sfn_apart02sfn.txd/slab64.dds\",\"gta3.img/genwhse_sfse.txd/slab64.dds\",\n \"gta3.img/shops_sfse.txd/slab64.dds\",\"gta3.img/genwhse_sfse.txd/slab64.dds\",\n \"gta3.img/vgnfirestat.txd/slab64.dds\",\"gta3.img/genwhse_sfse.txd/slab64.dds\",\n \"gta3.img/vgnretail5.txd/slab64.dds\",\"gta3.img/genwhse_sfse.txd/slab64.dds\",\n \"gta3.img/xenon_sfse.txd/slab64.dds\",\"gta3.img/genwhse_sfse.txd/slab64.dds\",\n \"gta_int.img/genintintbarb.txd/gen_gantry_rust.dds\",\"gta3.img/genwhse_sfse.txd/gen_gantry_rust.dds\",\n \"gta3.img/goldengate_sfw.txd/ws_goldengate5.dds\",\"gta3.img/ggatepark.txd/ws_goldengate5.dds\",\n \"gta3.img/landsfw.txd/ws_goldengate5.dds\",\"gta3.img/ggatepark.txd/ws_goldengate5.dds\",\n \"gta3.img/lasxrefdock.txd/ws_goldengate5b.dds\",\"gta3.img/ggatepark.txd/ws_goldengate5.dds\",\n \"gta3.img/railbridge_sfse.txd/ws_goldengate5bnoalpha.dds\",\"gta3.img/ggatepark.txd/ws_goldengate5.dds\",\n \"gta3.img/goldengate_sfw.txd/stonesandkb2_128.dds\",\"gta3.img/ggbridge_sfn.txd/stonesandkb2_128.dds\",\n \"gta3.img/lanblokc.txd/stonesandkb2_128.dds\",\"gta3.img/ggbridge_sfn.txd/stonesandkb2_128.dds\",\n \"gta3.img/vgsscollege.txd/stonesandkb2_128.dds\",\"gta3.img/ggbridge_sfn.txd/stonesandkb2_128.dds\",\n \"gta3.img/goldengate_sfw.txd/ws_goldengate2.dds\",\"gta3.img/ggbridge_sfn.txd/ws_goldengate2.dds\",\n \"gta3.img/landsfw.txd/ws_goldengate2.dds\",\"gta3.img/ggbridge_sfn.txd/ws_goldengate2.dds\",\n \"gta3.img/glenpark1x_lae.txd/hedgealphad1.dds\",\"gta3.img/glenpark1_lae.txd/hedgealphad1.dds\",\n \"gta3.img/jeffers4_lae.txd/hedgealphad1.dds\",\"gta3.img/glenpark1_lae.txd/hedgealphad1.dds\",\n \"gta3.img/laeroads2s.txd/hedgealphad1.dds\",\"gta3.img/glenpark1_lae.txd/hedgealphad1.dds\",\n \"gta3.img/lawnbit.txd/hedgealphad1.dds\",\"gta3.img/glenpark1_lae.txd/hedgealphad1.dds\",\n \"gta3.img/lawngrnd.txd/hedgealphad1.dds\",\"gta3.img/glenpark1_lae.txd/hedgealphad1.dds\",\n \"gta3.img/lawngrn.txd/hedgealphad1.dds\",\"gta3.img/glenpark1_lae.txd/hedgealphad1.dds\",\n \"gta3.img/lawnshite2n.txd/hedgealphad1.dds\",\"gta3.img/glenpark1_lae.txd/hedgealphad1.dds\",\n \"gta3.img/roads_lawn.txd/hedgealphad1.dds\",\"gta3.img/glenpark1_lae.txd/hedgealphad1.dds\",\n \"gta3.img/sunrise11_lawn.txd/hedgealphad1.dds\",\"gta3.img/glenpark1_lae.txd/hedgealphad1.dds\",\n \"gta3.img/tempstuff_lae.txd/hedgealphad1.dds\",\"gta3.img/glenpark1_lae.txd/hedgealphad1.dds\",\n \"gta3.img/laeroads2s.txd/mudyforest256.dds\",\"gta3.img/glenpark1_lae.txd/mudyforest256.dds\",\n \"gta3.img/macpark1tr_lae.txd/mudyforest256.dds\",\"gta3.img/glenpark1_lae.txd/mudyforest256.dds\",\n \"gta3.img/lae2roads.txd/craproad1_lae.dds\",\"gta3.img/glenpark1x_lae.txd/craproad1_lae.dds\",\n \"gta3.img/idlewood3_lae.txd/savtop.dds\",\"gta3.img/glenpark1x_lae.txd/savtop.dds\",\n \"gta3.img/idlewood3_lae.txd/lasclean1.dds\",\"gta3.img/glenpark1x_lae.txd/lasclean1.dds\",\n \"gta3.img/lae2newtempbx.txd/lasclean1.dds\",\"gta3.img/glenpark1x_lae.txd/lasclean1.dds\",\n \"gta3.img/lasraodnshops.txd/lasclean1.dds\",\"gta3.img/glenpark1x_lae.txd/lasclean1.dds\",\n \"gta3.img/ground3_las2.txd/lasjmscruffwall1.dds\",\"gta3.img/glenpark1x_lae.txd/lasjmscruffwall1.dds\",\n \"gta3.img/lasroads_las2.txd/lasjmscruffwall1.dds\",\"gta3.img/glenpark1x_lae.txd/lasjmscruffwall1.dds\",\n \"gta3.img/lashops1b_las2.txd/sjmhoodlawn4.dds\",\"gta3.img/glenpark1x_lae.txd/sjmhoodlawn4.dds\",\n \"gta3.img/shopliquor_las.txd/sjmhoodlawn4.dds\",\"gta3.img/glenpark1x_lae.txd/sjmhoodlawn4.dds\",\n \"gta3.img/ground2_las2.txd/ahoodfence2.dds\",\"gta3.img/glenpark1x_lae.txd/ahoodfence2.dds\",\n \"gta3.img/lae2newtempbx.txd/ahoodfence2.dds\",\"gta3.img/glenpark1x_lae.txd/ahoodfence2.dds\",\n \"gta3.img/laesmokecnthus.txd/ahoodfence2.dds\",\"gta3.img/glenpark1x_lae.txd/ahoodfence2.dds\",\n \"gta3.img/newstuff_sfn.txd/ahoodfence2.dds\",\"gta3.img/glenpark1x_lae.txd/ahoodfence2.dds\",\n \"gta3.img/pirateland.txd/ahoodfence2.dds\",\"gta3.img/glenpark1x_lae.txd/ahoodfence2.dds\",\n \"gta3.img/sfn_apart02sfn.txd/ahoodfence2.dds\",\"gta3.img/glenpark1x_lae.txd/ahoodfence2.dds\",\n \"gta3.img/stuff2_sfn.txd/ahoodfence2.dds\",\"gta3.img/glenpark1x_lae.txd/ahoodfence2.dds\",\n \"gta3.img/vegaswrehse1.txd/ahoodfence2.dds\",\"gta3.img/glenpark1x_lae.txd/ahoodfence2.dds\",\n \"gta3.img/vgeretl1grnd.txd/ahoodfence2.dds\",\"gta3.img/glenpark1x_lae.txd/ahoodfence2.dds\",\n \"gta3.img/vgnbball.txd/ahoodfence2.dds\",\"gta3.img/glenpark1x_lae.txd/ahoodfence2.dds\",\n \"gta3.img/vgsetrainstn.txd/ahoodfence2.dds\",\"gta3.img/glenpark1x_lae.txd/ahoodfence2.dds\",\n \"gta3.img/w_towncs_t.txd/ahoodfence2.dds\",\"gta3.img/glenpark1x_lae.txd/ahoodfence2.dds\",\n \"gta3.img/shutters_lawn.txd/shutter01la.dds\",\"gta3.img/glenpark6d_lae.txd/shutter01la.dds\",\n \"gta3.img/melrose02_lawn.txd/gymshops1_lae.dds\",\"gta3.img/glenpark6d_lae.txd/gymshops1_lae.dds\",\n \"gta3.img/sunset04_law2.txd/gymshops1_lae.dds\",\"gta3.img/glenpark6d_lae.txd/gymshops1_lae.dds\",\n \"gta3.img/sunst18_lawn.txd/tiledwall01_la.dds\",\"gta3.img/glenpark6d_lae.txd/tiledwall01_la.dds\",\n \"gta3.img/glenpark6_lae.txd/shopint2_lae.dds\",\"gta3.img/glenpark6d_lae.txd/shopint2_lae.dds\",\n \"gta3.img/glenpark6_lae.txd/shopint1_lae.dds\",\"gta3.img/glenpark6d_lae.txd/shopint1_lae.dds\",\n \"gta3.img/melrose02_lawn.txd/shopint1_lae.dds\",\"gta3.img/glenpark6d_lae.txd/shopint1_lae.dds\",\n \"gta3.img/melrose19_lawn.txd/shopint1_lae.dds\",\"gta3.img/glenpark6d_lae.txd/shopint1_lae.dds\",\n \"gta3.img/sunset04_law2.txd/shopint1_lae.dds\",\"gta3.img/glenpark6d_lae.txd/shopint1_lae.dds\",\n \"gta3.img/idlewood46_lae.txd/downtwin21b.dds\",\"gta3.img/glenpark6d_lae.txd/downtwin21b.dds\",\n \"gta3.img/rodeo02_law2.txd/downtwin21b.dds\",\"gta3.img/glenpark6d_lae.txd/downtwin21b.dds\",\n \"gta3.img/lngblok_lae2.txd/hillshop4_la.dds\",\"gta3.img/glenpark6_lae.txd/hillshop4_la.dds\",\n \"gta3.img/sunst18_lawn.txd/hillshop4_la.dds\",\"gta3.img/glenpark6_lae.txd/hillshop4_la.dds\",\n \"gta3.img/lae2bigblock.txd/hillshop2_la.dds\",\"gta3.img/glenpark6_lae.txd/hillshop2_la.dds\",\n \"gta3.img/lngblok_lae2.txd/hillshop2_la.dds\",\"gta3.img/glenpark6_lae.txd/hillshop2_la.dds\",\n \"gta3.img/golf_sfs.txd/dirty256.dds\",\"gta3.img/glenpark6_lae.txd/dirty256.dds\",\n \"gta3.img/hubhole_sfse.txd/dirty256.dds\",\"gta3.img/glenpark6_lae.txd/dirty256.dds\",\n \"gta3.img/jeffers5a_lae.txd/dirty256.dds\",\"gta3.img/glenpark6_lae.txd/dirty256.dds\",\n \"gta3.img/oc_flats_gnd_sfs.txd/dirty256.dds\",\"gta3.img/glenpark6_lae.txd/dirty256.dds\",\n \"gta3.img/skyscrap_sfse.txd/dirty256.dds\",\"gta3.img/glenpark6_lae.txd/dirty256.dds\",\n \"gta3.img/lae2bigblock.txd/wareh3_lae.dds\",\"gta3.img/glenpark6_lae.txd/wareh3_lae.dds\",\n \"gta3.img/sancliff_law2.txd/hwtopwin01_law.dds\",\"gta3.img/glenpark6_lae.txd/hwtopwin01_law.dds\",\n \"gta3.img/sunrise08_lawn.txd/hwtopwin01_law.dds\",\"gta3.img/glenpark6_lae.txd/hwtopwin01_law.dds\",\n \"gta3.img/vgsebuild01.txd/hwtopwin01_law.dds\",\"gta3.img/glenpark6_lae.txd/hwtopwin01_law.dds\",\n \"gta3.img/graffiti_lan01.txd/ganggraf01_la.dds\",\"gta3.img/glenpark7_lae.txd/ganggraf01_la.dds\",\n \"gta3.img/stormd_fill.txd/ganggraf01_la.dds\",\"gta3.img/glenpark7_lae.txd/ganggraf01_la.dds\",\n \"gta3.img/sunstr_lawn.txd/ganggraf01_la.dds\",\"gta3.img/glenpark7_lae.txd/ganggraf01_la.dds\",\n \"gta3.img/laealpha.txd/compfence5_lae.dds\",\"gta3.img/glenpark7_lae.txd/compfence5_lae.dds\",\n \"gta3.img/landlae2b.txd/compfence5b_lae.dds\",\"gta3.img/glenpark7_lae.txd/compfence5_lae.dds\",\n \"gta3.img/logcabincs_t.txd/compfence5_lae.dds\",\"gta3.img/glenpark7_lae.txd/compfence5_lae.dds\",\n \"gta3.img/sunset01_lawn.txd/compfence5b_lae.dds\",\"gta3.img/glenpark7_lae.txd/compfence5_lae.dds\",\n \"gta3.img/lomall.txd/bboardblank_law.dds\",\"gta3.img/glenpark7_lae.txd/bboardblank_law.dds\",\n \"gta3.img/w_towncs_t.txd/concretebig4256128.dds\",\"gta3.img/glenpark7_lae.txd/concretebig4256128.dds\",\n \"gta_int.img/ammu_twofloor.txd/concretebig4256128.dds\",\"gta3.img/glenpark7_lae.txd/concretebig4256128.dds\",\n \"gta_int.img/range_main.txd/concretebig4256128.dds\",\"gta3.img/glenpark7_lae.txd/concretebig4256128.dds\",\n \"gta_int.img/vegas_munation.txd/concretebig4256128.dds\",\"gta3.img/glenpark7_lae.txd/concretebig4256128.dds\",\n \"gta3.img/vgsshospshop.txd/gnhoteldoor05_128.dds\",\"gta3.img/gnhotel1.txd/gnhoteldoor05_128.dds\",\n \"gta3.img/smashbarr.txd/redstuff.dds\",\"gta3.img/gnhotel1.txd/redstuff.dds\",\n \"gta3.img/vgssairport02.txd/redstuff.dds\",\"gta3.img/gnhotel1.txd/redstuff.dds\",\n \"gta3.img/vgssmulticarprk.txd/redstuff.dds\",\"gta3.img/gnhotel1.txd/redstuff.dds\",\n \"gta_int.img/svcunthoose.txd/redstuff.dds\",\"gta3.img/gnhotel1.txd/redstuff.dds\",\n \"gta3.img/vgssairport02.txd/carpark1_64.dds\",\"gta3.img/gnhotel1.txd/carpark1_64.dds\",\n \"gta3.img/vgssmulticarprk.txd/carpark1_64.dds\",\"gta3.img/gnhotel1.txd/carpark1_64.dds\",\n \"gta3.img/vgssairport02.txd/step_64hv.dds\",\"gta3.img/gnhotel1.txd/step_64hv.dds\",\n \"gta3.img/vgssmulticarprk.txd/step_64hv.dds\",\"gta3.img/gnhotel1.txd/step_64hv.dds\",\n \"gta3.img/vgssairport02.txd/glass_64.dds\",\"gta3.img/gnhotel1.txd/glass_64.dds\",\n \"gta3.img/vgssmulticarprk.txd/glass_64.dds\",\"gta3.img/gnhotel1.txd/glass_64.dds\",\n \"gta3.img/vgssairport02.txd/old_corugwal_256.dds\",\"gta3.img/gnhotel1.txd/old_corugwal_256.dds\",\n \"gta3.img/vgssmulticarprk.txd/old_corugwal_256.dds\",\"gta3.img/gnhotel1.txd/old_corugwal_256.dds\",\n \"gta3.img/vgssairport02.txd/plaindoorblue_128.dds\",\"gta3.img/gnhotel1.txd/plaindoorblue_128.dds\",\n \"gta3.img/vgssmulticarprk.txd/plaindoorblue_128.dds\",\"gta3.img/gnhotel1.txd/plaindoorblue_128.dds\",\n \"gta3.img/vgsshospshop.txd/gnhoteldoor03_128.dds\",\"gta3.img/gnhotel1.txd/gnhoteldoor03_128.dds\",\n \"gta3.img/vgsbldng1.txd/ap_tarmac.dds\",\"gta3.img/gnhotel1.txd/ap_tarmac.dds\",\n \"gta3.img/vgshpground.txd/ap_tarmac.dds\",\"gta3.img/gnhotel1.txd/ap_tarmac.dds\",\n \"gta3.img/vgs_shops.txd/ap_tarmac.dds\",\"gta3.img/gnhotel1.txd/ap_tarmac.dds\",\n \"gta3.img/vgwestland.txd/ap_tarmac.dds\",\"gta3.img/gnhotel1.txd/ap_tarmac.dds\",\n \"gta3.img/pirateland.txd/gnhotelwall06_128.dds\",\"gta3.img/gnhotel1.txd/gnhotelwall06_128.dds\",\n \"gta3.img/rcflagx.txd/goflag.dds\",\"gta3.img/goflagx.txd/goflag.dds\",\n \"gta3.img/irgoggles.txd/nightvision.dds\",\"gta3.img/gogsx.txd/nightvision.dds\",\n \"gta3.img/nvgoggles.txd/nightvision.dds\",\"gta3.img/gogsx.txd/nightvision.dds\",\n \"gta3.img/vgnglfcrse1.txd/golf_greengrass.dds\",\"gta3.img/golf_sfs.txd/golf_greengrass.dds\",\n \"gta3.img/vgnglfcrse1.txd/golf_fairway1.dds\",\"gta3.img/golf_sfs.txd/golf_fairway1.dds\",\n \"gta3.img/sw_church.txd/golf_gravelpath.dds\",\"gta3.img/golf_sfs.txd/golf_gravelpath.dds\",\n \"gta3.img/hospital_lawn.txd/hosp03_law.dds\",\"gta3.img/gravblok01_lahills.txd/hosp03_law.dds\",\n \"gta_int.img/imy_motel.txd/ws_graveydfence.dds\",\"gta3.img/graveyard_sfs.txd/ws_graveydfence.dds\",\n \"gta3.img/sawmillcs_t.txd/sm_pinetreebit.dds\",\"gta3.img/griffobs_las.txd/sm_pinetreebit.dds\",\n \"gta3.img/sw_logcamp.txd/sm_pinetreebit.dds\",\"gta3.img/griffobs_las.txd/sm_pinetreebit.dds\",\n \"gta3.img/oc_flats_gnd_sfs.txd/ws_neatwoodfence.dds\",\"gta3.img/griffobs_las.txd/ws_neatwoodfence.dds\",\n \"gta3.img/sw_block06.txd/ws_neatwoodfence.dds\",\"gta3.img/griffobs_las.txd/ws_neatwoodfence.dds\",\n \"gta3.img/vegashse2.txd/ws_neatwoodfence.dds\",\"gta3.img/griffobs_las.txd/ws_neatwoodfence.dds\",\n \"gta3.img/vgsswarehse02c.txd/ws_neatwoodfence.dds\",\"gta3.img/griffobs_las.txd/ws_neatwoodfence.dds\",\n \"gta3.img/kbgarage_las2.txd/lasjmslumruf.dds\",\"gta3.img/griffobs_las.txd/lasjmslumruf.dds\",\n \"gta3.img/kbgarage_las.txd/lasjmslumruf.dds\",\"gta3.img/griffobs_las.txd/lasjmslumruf.dds\",\n \"gta3.img/lasground2_las2.txd/lasjmslumruf.dds\",\"gta3.img/griffobs_las.txd/lasjmslumruf.dds\",\n \"gta3.img/sjmla_las.txd/lasjmslumruf.dds\",\"gta3.img/griffobs_las.txd/lasjmslumruf.dds\",\n \"gta3.img/logcabincs_t.txd/gen_log_end.dds\",\"gta3.img/griffobs_las.txd/gen_log_end.dds\",\n \"gta3.img/mtbtrackcs_t.txd/gen_log_end.dds\",\"gta3.img/griffobs_las.txd/gen_log_end.dds\",\n \"gta3.img/sawmillcs_t.txd/gen_log_end.dds\",\"gta3.img/griffobs_las.txd/gen_log_end.dds\",\n \"gta3.img/sw_logcamp.txd/gen_log_end.dds\",\"gta3.img/griffobs_las.txd/gen_log_end.dds\",\n \"gta3.img/sw_oldshack.txd/gen_log_end.dds\",\"gta3.img/griffobs_las.txd/gen_log_end.dds\",\n \"gta3.img/tikibridge.txd/gen_log_end.dds\",\"gta3.img/griffobs_las.txd/gen_log_end.dds\",\n \"gta3.img/woodpillar01_lvs.txd/gen_log_end.dds\",\"gta3.img/griffobs_las.txd/gen_log_end.dds\",\n \"gta3.img/gta_tree_oak.txd/gen_log.dds\",\"gta3.img/griffobs_las.txd/gen_log.dds\",\n \"gta3.img/logcabincs_t.txd/gen_log.dds\",\"gta3.img/griffobs_las.txd/gen_log.dds\",\n \"gta3.img/sawmillcs_t.txd/gen_log.dds\",\"gta3.img/griffobs_las.txd/gen_log.dds\",\n \"gta3.img/sw_logcamp.txd/gen_log.dds\",\"gta3.img/griffobs_las.txd/gen_log.dds\",\n \"gta3.img/rodeot01_law2.txd/vic01_la.dds\",\"gta3.img/grnwht_sfe.txd/vic01_la.dds\",\n \"gta3.img/smallertxd.txd/sfe_wall_1.dds\",\"gta3.img/grnwht_sfe.txd/sfe_wall_1.dds\",\n \"gta3.img/shop_doors2.txd/sl_dtdoor1.dds\",\"gta3.img/grnwht_sfe.txd/sl_dtdoor1.dds\",\n \"gta3.img/stolenbuild02.txd/sl_dtdoor1.dds\",\"gta3.img/grnwht_sfe.txd/sl_dtdoor1.dds\",\n \"gta3.img/skyscrap2_lan2.txd/whitgrn_sfe4.dds\",\"gta3.img/grnwht_sfe.txd/whitgrn_sfe4.dds\",\n \"gta3.img/skyscrap2_lan2.txd/whitgrn_sfe5.dds\",\"gta3.img/grnwht_sfe.txd/whitgrn_sfe5.dds\",\n \"gta3.img/skyscrap2_lan2.txd/whitgrn_sfe3.dds\",\"gta3.img/grnwht_sfe.txd/whitgrn_sfe3.dds\",\n \"gta3.img/skyscrap2_lan2.txd/whitgrn_sfe2.dds\",\"gta3.img/grnwht_sfe.txd/whitgrn_sfe2.dds\",\n \"gta3.img/skyscrap2_lan2.txd/whitgrn_sfe1.dds\",\"gta3.img/grnwht_sfe.txd/whitgrn_sfe1.dds\",\n \"gta3.img/hosbibalsfw.txd/sf_hospitaldr2.dds\",\"gta3.img/grnwht_sfe.txd/sf_hospitaldr2.dds\",\n \"gta3.img/lomall.txd/sf_hospitaldr2.dds\",\"gta3.img/grnwht_sfe.txd/sf_hospitaldr2.dds\",\n \"gta3.img/hosbibalsfw.txd/sf_hospitaldr1.dds\",\"gta3.img/grnwht_sfe.txd/sf_hospitaldr1.dds\",\n \"gta3.img/lomall.txd/sf_hospitaldr1.dds\",\"gta3.img/grnwht_sfe.txd/sf_hospitaldr1.dds\",\n \"gta3.img/imrancomp_las2.txd/sjmlawarhustrim.dds\",\"gta3.img/ground2_las2.txd/sjmlawarhustrim.dds\",\n \"gta3.img/industry3_las2.txd/sanpedcorn1.dds\",\"gta3.img/ground2_las2.txd/sanpedcorn1.dds\",\n \"gta3.img/lashops1_las2.txd/sanpedcorn1.dds\",\"gta3.img/ground2_las2.txd/sanpedcorn1.dds\",\n \"gta3.img/lashops93_las2.txd/sanpedcorn1.dds\",\"gta3.img/ground2_las2.txd/sanpedcorn1.dds\",\n \"gta3.img/lasraodnshops.txd/sanpedcorn1.dds\",\"gta3.img/ground2_las2.txd/sanpedcorn1.dds\",\n \"gta3.img/industry3_las2.txd/sanpedpawn1a.dds\",\"gta3.img/ground2_las2.txd/sanpedpawn1a.dds\",\n \"gta3.img/lae2newtempbx.txd/sanpedpawn1a.dds\",\"gta3.img/ground2_las2.txd/sanpedpawn1a.dds\",\n \"gta3.img/lasground_las2.txd/sanpedpawn1a.dds\",\"gta3.img/ground2_las2.txd/sanpedpawn1a.dds\",\n \"gta3.img/lashops1b_las2.txd/sanpedpawn1a.dds\",\"gta3.img/ground2_las2.txd/sanpedpawn1a.dds\",\n \"gta3.img/lashops93_las2.txd/sanpedpawn1a.dds\",\"gta3.img/ground2_las2.txd/sanpedpawn1a.dds\",\n \"gta3.img/ground5_las.txd/grass_dirt_64hv.dds\",\"gta3.img/ground2_las2.txd/grass_dirt_64hv.dds\",\n \"gta3.img/lasroads_las.txd/grass_dirt_64hv.dds\",\"gta3.img/ground2_las2.txd/grass_dirt_64hv.dds\",\n \"gta3.img/santavenice3.txd/grass_dirt_64hv.dds\",\"gta3.img/ground2_las2.txd/grass_dirt_64hv.dds\",\n \"gta3.img/ground3_las.txd/backalley1_lae.dds\",\"gta3.img/ground3_las2.txd/backalley1_lae.dds\",\n \"gta3.img/ground5_las.txd/backalley1_lae.dds\",\"gta3.img/ground3_las2.txd/backalley1_lae.dds\",\n \"gta3.img/ground_las2.txd/backalley1_lae.dds\",\"gta3.img/ground3_las2.txd/backalley1_lae.dds\",\n \"gta3.img/jeffers4_lae.txd/backalley1_lae.dds\",\"gta3.img/ground3_las2.txd/backalley1_lae.dds\",\n \"gta3.img/lae2grnd.txd/backalley1_lae.dds\",\"gta3.img/ground3_las2.txd/backalley1_lae.dds\",\n \"gta3.img/lae2roads.txd/backalley1_lae.dds\",\"gta3.img/ground3_las2.txd/backalley1_lae.dds\",\n \"gta3.img/laeroads2s.txd/backalley1_lae.dds\",\"gta3.img/ground3_las2.txd/backalley1_lae.dds\",\n \"gta3.img/landhub.txd/backalley1_lae.dds\",\"gta3.img/ground3_las2.txd/backalley1_lae.dds\",\n \"gta3.img/landlae2b.txd/backalley1_lae.dds\",\"gta3.img/ground3_las2.txd/backalley1_lae.dds\",\n \"gta3.img/landlae2c.txd/backalley1_lae.dds\",\"gta3.img/ground3_las2.txd/backalley1_lae.dds\",\n \"gta3.img/landlae2.txd/backalley1_lae.dds\",\"gta3.img/ground3_las2.txd/backalley1_lae.dds\",\n \"gta3.img/lashops6_las2.txd/backalley1_lae.dds\",\"gta3.img/ground3_las2.txd/backalley1_lae.dds\",\n \"gta3.img/traintrack_las2.txd/backalley1_lae.dds\",\"gta3.img/ground3_las2.txd/backalley1_lae.dds\",\n \"gta3.img/indust_lax.txd/fossiloil_128.dds\",\"gta3.img/ground3_las2.txd/fossiloil_128.dds\",\n \"gta3.img/jeffers4_lae.txd/floorboard256128.dds\",\"gta3.img/ground3_las.txd/floorboard256128.dds\",\n \"gta3.img/lae2newtempbx.txd/floorboard256128.dds\",\"gta3.img/ground3_las.txd/floorboard256128.dds\",\n \"gta3.img/laealpha.txd/floorboard256128.dds\",\"gta3.img/ground3_las.txd/floorboard256128.dds\",\n \"gta3.img/pirateship01.txd/floorboard256128.dds\",\"gta3.img/ground3_las.txd/floorboard256128.dds\",\n \"gta3.img/skullsign.txd/floorboard256128.dds\",\"gta3.img/ground3_las.txd/floorboard256128.dds\",\n \"gta3.img/wasteland_las2.txd/floorboard256128.dds\",\"gta3.img/ground3_las.txd/floorboard256128.dds\",\n \"gta3.img/lanbloki.txd/sanpedowd5.dds\",\"gta3.img/ground3_las.txd/sanpedowd5.dds\",\n \"gta3.img/sunst18_lawn.txd/sanpedowd5.dds\",\"gta3.img/ground3_las.txd/sanpedowd5.dds\",\n \"gta3.img/laealpha.txd/hollysign05_law.dds\",\"gta3.img/ground3_las.txd/hollysign05_law.dds\",\n \"gta3.img/kbgarage_las2.txd/sjmlahus232.dds\",\"gta3.img/ground4_las.txd/sjmlahus232.dds\",\n \"gta3.img/kbgarage_las.txd/sjmlahus232.dds\",\"gta3.img/ground4_las.txd/sjmlahus232.dds\",\n \"gta3.img/lasground2_las2.txd/sjmlahus232.dds\",\"gta3.img/ground4_las.txd/sjmlahus232.dds\",\n \"gta3.img/sjmla_las.txd/sjmlahus232.dds\",\"gta3.img/ground4_las.txd/sjmlahus232.dds\",\n \"gta3.img/sjmla_las.txd/ahoodnewwi2.dds\",\"gta3.img/ground4_las.txd/ahoodnewwi2.dds\",\n \"gta3.img/sjmla_las.txd/lasjmscruffwall5.dds\",\"gta3.img/ground4_las.txd/lasjmscruffwall5.dds\",\n \"gta3.img/ground5_las.txd/sanpednhus2.dds\",\"gta3.img/ground4_las.txd/sanpednhus2.dds\",\n \"gta3.img/jeffers4_lae.txd/sanpednhus2.dds\",\"gta3.img/ground4_las.txd/sanpednhus2.dds\",\n \"gta3.img/mulhousclahills.txd/sanpednhus2.dds\",\"gta3.img/ground4_las.txd/sanpednhus2.dds\",\n \"gta3.img/snpedhusxref.txd/sanpednhus2.dds\",\"gta3.img/ground4_las.txd/sanpednhus2.dds\",\n \"gta3.img/ground5_las.txd/hedge.dds\",\"gta3.img/ground4_las.txd/hedge.dds\",\n \"gta3.img/ground5_las.txd/adet.dds\",\"gta3.img/ground4_las.txd/adet.dds\",\n \"gta3.img/mulhousclahills.txd/adet.dds\",\"gta3.img/ground4_las.txd/adet.dds\",\n \"gta3.img/snpedhusxref.txd/adet.dds\",\"gta3.img/ground4_las.txd/adet.dds\",\n \"gta3.img/kbgarage_las.txd/driveway_128.dds\",\"gta3.img/ground4_las.txd/driveway_128.dds\",\n \"gta3.img/railtracklae.txd/combrd1.dds\",\"gta3.img/ground5_las.txd/combrd1.dds\",\n \"gta3.img/vegascourtbld.txd/roof11l256.dds\",\"gta3.img/ground5_las.txd/roof11l256.dds\",\n \"gta3.img/vegastemp1.txd/roof11l256.dds\",\"gta3.img/ground5_las.txd/roof11l256.dds\",\n \"gta3.img/vgndwntwn22.txd/roof11l256.dds\",\"gta3.img/ground5_las.txd/roof11l256.dds\",\n \"gta3.img/vgnhseblk1.txd/roof11l256.dds\",\"gta3.img/ground5_las.txd/roof11l256.dds\",\n \"gta3.img/vgnhseing1.txd/roof11l256.dds\",\"gta3.img/ground5_las.txd/roof11l256.dds\",\n \"gta3.img/vgsswarehse02.txd/roof11l256.dds\",\"gta3.img/ground5_las.txd/roof11l256.dds\",\n \"gta3.img/mountainsfs.txd/ws_altz_wall6big.dds\",\"gta3.img/groundbit_sfse.txd/ws_altz_wall6big.dds\",\n \"gta3.img/skyscrap_sfse.txd/ws_altz_wall6big.dds\",\"gta3.img/groundbit_sfse.txd/ws_altz_wall6big.dds\",\n \"gta3.img/hotelbackpool_sfs.txd/ws_hextile.dds\",\"gta3.img/groundbit_sfs.txd/ws_hextile.dds\",\n \"gta3.img/lanriver.txd/ws_hextile.dds\",\"gta3.img/groundbit_sfs.txd/ws_hextile.dds\",\n \"gta3.img/ground_las2.txd/sanpedock95.dds\",\"gta3.img/groundb_las2.txd/sanpedock95.dds\",\n \"gta3.img/lasxrefdock.txd/sanpedock95.dds\",\"gta3.img/groundb_las2.txd/sanpedock95.dds\",\n \"gta3.img/ground_las2.txd/sanpedock97.dds\",\"gta3.img/groundb_las2.txd/sanpedock97.dds\",\n \"gta3.img/kmb_metaldoorx.txd/sanpedock97.dds\",\"gta3.img/groundb_las2.txd/sanpedock97.dds\",\n \"gta3.img/lasxrefdock.txd/sanpedock97.dds\",\"gta3.img/groundb_las2.txd/sanpedock97.dds\",\n \"gta3.img/ground_las2.txd/cmpwarhus2.dds\",\"gta3.img/groundb_las2.txd/cmpwarhus2.dds\",\n \"gta3.img/idlewood6_detail.txd/cmpwarhus2.dds\",\"gta3.img/groundb_las2.txd/cmpwarhus2.dds\",\n \"gta3.img/warehus_las2.txd/cmpwarhus2.dds\",\"gta3.img/groundb_las2.txd/cmpwarhus2.dds\",\n \"gta3.img/ground_las2.txd/sjmdockral1.dds\",\"gta3.img/groundb_las2.txd/sjmdockral1.dds\",\n \"gta3.img/imrancomp_las2.txd/sjmdockral1.dds\",\"gta3.img/groundb_las2.txd/sjmdockral1.dds\",\n \"gta3.img/indust_lax.txd/sjmdockral1.dds\",\"gta3.img/groundb_las2.txd/sjmdockral1.dds\",\n \"gta3.img/lasxrefdock.txd/sjmdockral1.dds\",\"gta3.img/groundb_las2.txd/sjmdockral1.dds\",\n \"gta3.img/pierb_law2.txd/sjmdockral1.dds\",\"gta3.img/groundb_las2.txd/sjmdockral1.dds\",\n \"gta3.img/wiresetc2_las.txd/sjmdockral1.dds\",\"gta3.img/groundb_las2.txd/sjmdockral1.dds\",\n \"gta_int.img/genintwarehsint3.txd/sjmdockral1.dds\",\"gta3.img/groundb_las2.txd/sjmdockral1.dds\",\n \"gta_int.img/smashtv.txd/sjmdockral1.dds\",\"gta3.img/groundb_las2.txd/sjmdockral1.dds\",\n \"gta3.img/lasxrefdock.txd/sanpedock3.dds\",\"gta3.img/ground_las2.txd/sanpedock3.dds\",\n \"gta_int.img/gf3.txd/tree_stub1.dds\",\"gta3.img/gta_brokentrees.txd/tree_stub1.dds\",\n \"gta3.img/gta_tree_pineprc.txd/gen_log.dds\",\"gta3.img/gta_brokentrees.txd/gen_log.dds\",\n \"gta3.img/gta_potplants.txd/yuka256.dds\",\"gta3.img/gta_potplants2.txd/yuka256.dds\",\n \"gta3.img/gta_potplantsaa.txd/kb_teracota_pot64.dds\",\"gta3.img/gta_potplants2.txd/kb_teracota_pot64.dds\",\n \"gta3.img/gta_potplants.txd/kb_teracota_pot64.dds\",\"gta3.img/gta_potplants2.txd/kb_teracota_pot64.dds\",\n \"gta3.img/gta_potplantsx.txd/kb_teracota_pot64.dds\",\"gta3.img/gta_potplants2.txd/kb_teracota_pot64.dds\",\n \"gta3.img/kbplantssmz.txd/kb_teracota_pot64.dds\",\"gta3.img/gta_potplants2.txd/kb_teracota_pot64.dds\",\n \"gta3.img/gta_potplantsaa.txd/dirtgaz64b.dds\",\"gta3.img/gta_potplants2.txd/dirtgaz64b.dds\",\n \"gta3.img/gta_potplants.txd/dirtgaz64b.dds\",\"gta3.img/gta_potplants2.txd/dirtgaz64b.dds\",\n \"gta3.img/gta_potplantsx.txd/dirtgaz64b.dds\",\"gta3.img/gta_potplants2.txd/dirtgaz64b.dds\",\n \"gta3.img/kbplantssmz2.txd/dirtgaz64b.dds\",\"gta3.img/gta_potplants2.txd/dirtgaz64b.dds\",\n \"gta3.img/kbplantssmz.txd/dirtgaz64b.dds\",\"gta3.img/gta_potplants2.txd/dirtgaz64b.dds\",\n \"gta3.img/gta_tree_bevhills.txd/planta256.dds\",\"gta3.img/gta_potplants.txd/planta256.dds\",\n \"gta3.img/gta_tree_palm.txd/planta256.dds\",\"gta3.img/gta_potplants.txd/planta256.dds\",\n \"gta3.img/gta_tree_bevhills.txd/kbtree3_test.dds\",\"gta3.img/gta_potplants.txd/kbtree3_test.dds\",\n \"gta3.img/gta_tree_palm.txd/kbtree3_test.dds\",\"gta3.img/gta_potplants.txd/kbtree3_test.dds\",\n \"gta3.img/kbplantssmz2.txd/kbtree3_test.dds\",\"gta3.img/gta_potplants.txd/kbtree3_test.dds\",\n \"gta3.img/gta_potplantsx.txd/greekurn.dds\",\"gta3.img/gta_potplants.txd/greekurn.dds\",\n \"gta_int.img/civic02cj.txd/sm_agave_1.dds\",\"gta3.img/gta_procdesert.txd/sm_agave_1.dds\",\n \"gta3.img/law_coffintxd.txd/starflower1.dds\",\"gta3.img/gta_procflowers.txd/starflower1.dds\",\n \"gta3.img/veg_fuzzyplant.txd/starflower1.dds\",\"gta3.img/gta_procflowers.txd/starflower1.dds\",\n \"gta3.img/gta_proc_rushes.txd/gras07si.dds\",\"gta3.img/gta_procflowers.txd/gras07si.dds\",\n \"gta3.img/law_coffintxd.txd/starflower2.dds\",\"gta3.img/gta_procflowers.txd/starflower2.dds\",\n \"gta3.img/gta_tree_palm.txd/vegaspalm01_128.dds\",\"gta3.img/gta_tree_bevhills.txd/vegaspalm01_128.dds\",\n \"gta3.img/gta_tree_palm.txd/trunk5.dds\",\"gta3.img/gta_tree_bevhills.txd/trunk5.dds\",\n \"gta3.img/gta_tree_palm.txd/trunk3.dds\",\"gta3.img/gta_tree_bevhills.txd/trunk3.dds\",\n \"gta3.img/gta_tree_boak.txd/sm_bark_light.dds\",\"gta3.img/gta_tree_bevhills.txd/sm_bark_light.dds\",\n \"gta3.img/gta_tree_pine.txd/sm_redwood_bark.dds\",\"gta3.img/gta_tree_boak.txd/sm_redwood_bark.dds\",\n \"gta3.img/gta_tree_pine.txd/kb_ivy2_256.dds\",\"gta3.img/gta_tree_boak.txd/kb_ivy2_256.dds\",\n \"gta3.img/veg_leaves.txd/kb_ivy2_256.dds\",\"gta3.img/gta_tree_boak.txd/kb_ivy2_256.dds\",\n \"gta3.img/gta_tree_oldpine.txd/gen_log.dds\",\"gta3.img/gta_tree_boak.txd/gen_log.dds\",\n \"gta3.img/gta_tree_pine.txd/gen_log.dds\",\"gta3.img/gta_tree_boak.txd/gen_log.dds\",\n \"gta3.img/gta_tree_pine.txd/tree19mi.dds\",\"gta3.img/gta_tree_oldpine.txd/tree19mi.dds\",\n \"gta3.img/kbplantssmz2.txd/kbtree4_test.dds\",\"gta3.img/gta_tree_palm.txd/kbtree4_test.dds\",\n \"gta3.img/gtatreeshifir.txd/oakbark64.dds\",\"gta3.img/gtatreeshi7.txd/oakbark64.dds\",\n \"gta3.img/gtatreesh.txd/oakbark64.dds\",\"gta3.img/gtatreeshi7.txd/oakbark64.dds\",\n \"gta3.img/vegtresshi9b.txd/oakbark64.dds\",\"gta3.img/gtatreeshi7.txd/oakbark64.dds\",\n \"gta3.img/tree2.txd/bthuja1.dds\",\"gta3.img/gtatreeshifir.txd/bthuja1.dds\",\n \"gta3.img/gun_boxwee.txd/gun_box1.dds\",\"gta3.img/gun_boxbig.txd/gun_box1.dds\",\n \"gta3.img/michgar.txd/gun_dildo3.dds\",\"gta3.img/gun_dildo1.txd/gun_dildo3.dds\",\n \"gta_int.img/cj_sex.txd/gun_dildo3.dds\",\"gta3.img/gun_dildo1.txd/gun_dildo3.dds\",\n \"gta_int.img/genintintsex.txd/gun_dildo3.dds\",\"gta3.img/gun_dildo1.txd/gun_dildo3.dds\",\n \"gta_int.img/gf6.txd/gun_dildo3.dds\",\"gta3.img/gun_dildo1.txd/gun_dildo3.dds\",\n \"gta3.img/michgar.txd/gun_dildo1.dds\",\"gta3.img/gun_dildo2.txd/gun_dildo1.dds\",\n \"gta_int.img/cj_sex.txd/gun_dildo1.dds\",\"gta3.img/gun_dildo2.txd/gun_dildo1.dds\",\n \"gta_int.img/gf6.txd/gun_dildo1.dds\",\"gta3.img/gun_dildo2.txd/gun_dildo1.dds\",\n \"gta3.img/michgar.txd/gun_dildo4.dds\",\"gta3.img/gun_vibe1.txd/gun_dildo4.dds\",\n \"gta_int.img/cj_sex.txd/gun_dildo4.dds\",\"gta3.img/gun_vibe1.txd/gun_dildo4.dds\",\n \"gta_int.img/genintintsex.txd/gun_dildo4.dds\",\"gta3.img/gun_vibe1.txd/gun_dildo4.dds\",\n \"gta_int.img/gf6.txd/gun_dildo4.dds\",\"gta3.img/gun_vibe1.txd/gun_dildo4.dds\",\n \"gta_int.img/sexdetail.txd/gun_dildo4.dds\",\"gta3.img/gun_vibe1.txd/gun_dildo4.dds\",\n \"gta3.img/michgar.txd/gun_dildo2.dds\",\"gta3.img/gun_vibe2.txd/gun_dildo2.dds\",\n \"gta_int.img/cj_sex.txd/gun_dildo2.dds\",\"gta3.img/gun_vibe2.txd/gun_dildo2.dds\",\n \"gta_int.img/genintintsex.txd/gun_dildo2.dds\",\"gta3.img/gun_vibe2.txd/gun_dildo2.dds\",\n \"gta_int.img/gf6.txd/gun_dildo2.dds\",\"gta3.img/gun_vibe2.txd/gun_dildo2.dds\",\n \"gta3.img/landlae2c.txd/roadsignbackground128.dds\",\"gta3.img/gymblok2_lae2.txd/roadsignbackground128.dds\",\n \"gta3.img/roadsign.txd/roadsignbackground128.dds\",\"gta3.img/gymblok2_lae2.txd/roadsignbackground128.dds\",\n \"gta3.img/vgsroadsign.txd/roadsignbackground128.dds\",\"gta3.img/gymblok2_lae2.txd/roadsignbackground128.dds\",\n \"gta3.img/kmb_cratex.txd/cheerybox01.dds\",\"gta3.img/gym_weights.txd/cheerybox01.dds\",\n \"gta3.img/kmbjumpx.txd/cheerybox01.dds\",\"gta3.img/gym_weights.txd/cheerybox01.dds\",\n \"gta3.img/hashblock4_sfs.txd/ws_apartmentpink2.dds\",\"gta3.img/haight1_sfs.txd/ws_apartmentpink2.dds\",\n \"gta3.img/mission4_sfs.txd/ws_apartmentpink2.dds\",\"gta3.img/haight1_sfs.txd/ws_apartmentpink2.dds\",\n \"gta3.img/scum_sfse.txd/ws_apartmentpink2.dds\",\"gta3.img/haight1_sfs.txd/ws_apartmentpink2.dds\",\n \"gta3.img/shops2_sfse.txd/ws_apartmentpink2.dds\",\"gta3.img/haight1_sfs.txd/ws_apartmentpink2.dds\",\n \"gta3.img/hashblock1z_sfs.txd/ws_apartmentmankyb2.dds\",\"gta3.img/haight1_sfs.txd/ws_apartmentmankyb2.dds\",\n \"gta3.img/hashblock4_sfs.txd/ws_apartmentmankyb2.dds\",\"gta3.img/haight1_sfs.txd/ws_apartmentmankyb2.dds\",\n \"gta3.img/midtownshops_sfs.txd/ws_apartmentmankyb2.dds\",\"gta3.img/haight1_sfs.txd/ws_apartmentmankyb2.dds\",\n \"gta3.img/mission2apts_sfse.txd/ws_apartmentmankyb2.dds\",\"gta3.img/haight1_sfs.txd/ws_apartmentmankyb2.dds\",\n \"gta3.img/mission3_sfse.txd/ws_apartmentmankyb2.dds\",\"gta3.img/haight1_sfs.txd/ws_apartmentmankyb2.dds\",\n \"gta3.img/mission3z_sfse.txd/ws_apartmentmankyb2.dds\",\"gta3.img/haight1_sfs.txd/ws_apartmentmankyb2.dds\",\n \"gta3.img/mission4_sfs.txd/ws_apartmentmankyb2.dds\",\"gta3.img/haight1_sfs.txd/ws_apartmentmankyb2.dds\",\n \"gta3.img/mission_sfse.txd/ws_apartmentmankyb2.dds\",\"gta3.img/haight1_sfs.txd/ws_apartmentmankyb2.dds\",\n \"gta3.img/queens2_sfs.txd/ws_apartmentmankyb2.dds\",\"gta3.img/haight1_sfs.txd/ws_apartmentmankyb2.dds\",\n \"gta3.img/scum_sfse.txd/ws_apartmentmankyb2.dds\",\"gta3.img/haight1_sfs.txd/ws_apartmentmankyb2.dds\",\n \"gta3.img/shops2extra_sfse.txd/ws_apartmentmankyb2.dds\",\"gta3.img/haight1_sfs.txd/ws_apartmentmankyb2.dds\",\n \"gta3.img/shops2_sfse.txd/ws_apartmentmankyb2.dds\",\"gta3.img/haight1_sfs.txd/ws_apartmentmankyb2.dds\",\n \"gta3.img/hashblock4_sfs.txd/ws_apartmentmankyb1.dds\",\"gta3.img/haight1_sfs.txd/ws_apartmentmankyb1.dds\",\n \"gta3.img/midtownshops_sfs.txd/ws_apartmentmankyb1.dds\",\"gta3.img/haight1_sfs.txd/ws_apartmentmankyb1.dds\",\n \"gta3.img/mission2apts_sfse.txd/ws_apartmentmankyb1.dds\",\"gta3.img/haight1_sfs.txd/ws_apartmentmankyb1.dds\",\n \"gta3.img/mission3_sfse.txd/ws_apartmentmankyb1.dds\",\"gta3.img/haight1_sfs.txd/ws_apartmentmankyb1.dds\",\n \"gta3.img/mission3z_sfse.txd/ws_apartmentmankyb1.dds\",\"gta3.img/haight1_sfs.txd/ws_apartmentmankyb1.dds\",\n \"gta3.img/mission4_sfs.txd/ws_apartmentmankyb1.dds\",\"gta3.img/haight1_sfs.txd/ws_apartmentmankyb1.dds\",\n \"gta3.img/mission_sfse.txd/ws_apartmentmankyb1.dds\",\"gta3.img/haight1_sfs.txd/ws_apartmentmankyb1.dds\",\n \"gta3.img/queens2_sfs.txd/ws_apartmentmankyb1.dds\",\"gta3.img/haight1_sfs.txd/ws_apartmentmankyb1.dds\",\n \"gta3.img/scum_sfse.txd/ws_apartmentmankyb1.dds\",\"gta3.img/haight1_sfs.txd/ws_apartmentmankyb1.dds\",\n \"gta3.img/shops2_sfse.txd/ws_apartmentmankyb1.dds\",\"gta3.img/haight1_sfs.txd/ws_apartmentmankyb1.dds\",\n \"gta3.img/hashblock4_sfs.txd/ws_dom's.dds\",\"gta3.img/haight1_sfs.txd/ws_dom's.dds\",\n \"gta3.img/mission4_sfs.txd/ws_dom's.dds\",\"gta3.img/haight1_sfs.txd/ws_dom's.dds\",\n \"gta3.img/scum_sfse.txd/ws_dom's.dds\",\"gta3.img/haight1_sfs.txd/ws_dom's.dds\",\n \"gta3.img/shops2_sfse.txd/ws_dom's.dds\",\"gta3.img/haight1_sfs.txd/ws_dom's.dds\",\n \"gta3.img/hashblock1_sfs.txd/ws_hashbanner.dds\",\"gta3.img/haight1_sfs.txd/ws_hashbanner.dds\",\n \"gta3.img/hashblock2b_sfs.txd/ws_hashbanner.dds\",\"gta3.img/haight1_sfs.txd/ws_hashbanner.dds\",\n \"gta3.img/hashblock4_sfs.txd/ws_hashbanner.dds\",\"gta3.img/haight1_sfs.txd/ws_hashbanner.dds\",\n \"gta3.img/hashblock4_sfs.txd/ws_apartmentpink1.dds\",\"gta3.img/haight1_sfs.txd/ws_apartmentpink1.dds\",\n \"gta3.img/mission4_sfs.txd/ws_apartmentpink1.dds\",\"gta3.img/haight1_sfs.txd/ws_apartmentpink1.dds\",\n \"gta3.img/scum_sfse.txd/ws_apartmentpink1.dds\",\"gta3.img/haight1_sfs.txd/ws_apartmentpink1.dds\",\n \"gta3.img/shops2_sfse.txd/ws_apartmentpink1.dds\",\"gta3.img/haight1_sfs.txd/ws_apartmentpink1.dds\",\n \"gta3.img/sunset01_law2.txd/beigeledge.dds\",\"gta3.img/haight1_sfs.txd/beigeledge.dds\",\n \"gta3.img/sw_church.txd/beigeledge.dds\",\"gta3.img/haight1_sfs.txd/beigeledge.dds\",\n \"gta3.img/hashblock1b_sfs.txd/ws_apartmentred2.dds\",\"gta3.img/haight1_sfs.txd/ws_apartmentred2.dds\",\n \"gta3.img/hashblock4_sfs.txd/ws_apartmentred2.dds\",\"gta3.img/haight1_sfs.txd/ws_apartmentred2.dds\",\n \"gta3.img/mission4_sfs.txd/ws_apartmentred2.dds\",\"gta3.img/haight1_sfs.txd/ws_apartmentred2.dds\",\n \"gta3.img/shops2_sfse.txd/ws_apartmentred2.dds\",\"gta3.img/haight1_sfs.txd/ws_apartmentred2.dds\",\n \"gta3.img/hashblock1b_sfs.txd/ws_apartmentred1.dds\",\"gta3.img/haight1_sfs.txd/ws_apartmentred1.dds\",\n \"gta3.img/hashblock4_sfs.txd/ws_apartmentred1.dds\",\"gta3.img/haight1_sfs.txd/ws_apartmentred1.dds\",\n \"gta3.img/mission4_sfs.txd/ws_apartmentred1.dds\",\"gta3.img/haight1_sfs.txd/ws_apartmentred1.dds\",\n \"gta3.img/scum_sfse.txd/ws_apartmentred1.dds\",\"gta3.img/haight1_sfs.txd/ws_apartmentred1.dds\",\n \"gta3.img/shops2_sfse.txd/ws_apartmentred1.dds\",\"gta3.img/haight1_sfs.txd/ws_apartmentred1.dds\",\n \"gta3.img/hashblock4_sfs.txd/ws_japwin.dds\",\"gta3.img/haight1_sfs.txd/ws_japwin.dds\",\n \"gta3.img/mission4_sfs.txd/ws_japwin.dds\",\"gta3.img/haight1_sfs.txd/ws_japwin.dds\",\n \"gta3.img/mission_sfse.txd/ws_japwin.dds\",\"gta3.img/haight1_sfs.txd/ws_japwin.dds\",\n \"gta3.img/queens2_sfs.txd/ws_japwin.dds\",\"gta3.img/haight1_sfs.txd/ws_japwin.dds\",\n \"gta3.img/scum_sfse.txd/ws_japwin.dds\",\"gta3.img/haight1_sfs.txd/ws_japwin.dds\",\n \"gta3.img/shops2_sfse.txd/ws_japwin.dds\",\"gta3.img/haight1_sfs.txd/ws_japwin.dds\",\n \"gta3.img/queens2_sfs.txd/ws_apartmentmankyblue1.dds\",\"gta3.img/haight1_sfs.txd/ws_apartmentmankyblue1.dds\",\n \"gta3.img/scum_sfse.txd/ws_apartmentmankyblue1.dds\",\"gta3.img/haight1_sfs.txd/ws_apartmentmankyblue1.dds\",\n \"gta3.img/hashblock2_sfs.txd/ws_apartmentwhite3.dds\",\"gta3.img/haight1_sfs.txd/ws_apartmentwhite3.dds\",\n \"gta3.img/mission3_sfse.txd/ws_apartmentwhite3.dds\",\"gta3.img/haight1_sfs.txd/ws_apartmentwhite3.dds\",\n \"gta3.img/hashblock2_sfs.txd/ws_apartmentwhite2.dds\",\"gta3.img/haight1_sfs.txd/ws_apartmentwhite2.dds\",\n \"gta3.img/mission3_sfse.txd/ws_apartmentwhite2.dds\",\"gta3.img/haight1_sfs.txd/ws_apartmentwhite2.dds\",\n \"gta3.img/hashblock2_sfs.txd/ws_apartmentwhite1.dds\",\"gta3.img/haight1_sfs.txd/ws_apartmentwhite1.dds\",\n \"gta3.img/mission3_sfse.txd/ws_apartmentwhite1.dds\",\"gta3.img/haight1_sfs.txd/ws_apartmentwhite1.dds\",\n \"gta3.img/hashblock2_sfs.txd/ws_ed_shop2.dds\",\"gta3.img/haight1_sfs.txd/ws_ed_shop2.dds\",\n \"gta3.img/subshops_sfs.txd/ws_ed_shop2.dds\",\"gta3.img/haight1_sfs.txd/ws_ed_shop2.dds\",\n \"gta3.img/hashblock2_sfs.txd/ws_ed_shop10.dds\",\"gta3.img/haight1_sfs.txd/ws_ed_shop10.dds\",\n \"gta3.img/hashblock2_sfs.txd/ws_ed_shop3.dds\",\"gta3.img/haight1_sfs.txd/ws_ed_shop3.dds\",\n \"gta3.img/mission3_sfse.txd/ws_ed_shop3.dds\",\"gta3.img/haight1_sfs.txd/ws_ed_shop3.dds\",\n \"gta3.img/mission_sfse.txd/ws_ed_shop3.dds\",\"gta3.img/haight1_sfs.txd/ws_ed_shop3.dds\",\n \"gta3.img/hashblock2_sfs.txd/ws_ed_shop4.dds\",\"gta3.img/haight1_sfs.txd/ws_ed_shop4.dds\",\n \"gta3.img/mission3z_sfse.txd/ws_ed_shop4.dds\",\"gta3.img/haight1_sfs.txd/ws_ed_shop4.dds\",\n \"gta3.img/mission2apts_sfse.txd/ws_apartmentmankygreen1.dds\",\"gta3.img/haight1_sfs.txd/ws_apartmentmankygreen1.dds\",\n \"gta3.img/queens2_sfs.txd/ws_apartmentmankygreen1.dds\",\"gta3.img/haight1_sfs.txd/ws_apartmentmankygreen1.dds\",\n \"gta3.img/mission2apts_sfse.txd/ws_ed_shop12.dds\",\"gta3.img/haight1_sfs.txd/ws_ed_shop12.dds\",\n \"gta3.img/scum_sfse.txd/ws_ed_shop12.dds\",\"gta3.img/haight1_sfs.txd/ws_ed_shop12.dds\",\n \"gta3.img/sunset03_law2.txd/ws_ed_shop12.dds\",\"gta3.img/haight1_sfs.txd/ws_ed_shop12.dds\",\n \"gta3.img/hashhouses1_sfs.txd/gz_vic3a.dds\",\"gta3.img/hashblock1b_sfs.txd/gz_vic3a.dds\",\n \"gta3.img/sfvictorian.txd/gz_vic3a.dds\",\"gta3.img/hashblock1b_sfs.txd/gz_vic3a.dds\",\n \"gta3.img/vict_sfw.txd/gz_vic3a.dds\",\"gta3.img/hashblock1b_sfs.txd/gz_vic3a.dds\",\n \"gta3.img/hashblock1z_sfs.txd/ws_haight2btom.dds\",\"gta3.img/hashblock1b_sfs.txd/ws_haight2btom.dds\",\n \"gta3.img/hashblock2b_sfs.txd/ws_haight2btom.dds\",\"gta3.img/hashblock1b_sfs.txd/ws_haight2btom.dds\",\n \"gta3.img/hashblock1z_sfs.txd/ws_haight2top5.dds\",\"gta3.img/hashblock1b_sfs.txd/ws_haight2top5.dds\",\n \"gta3.img/hashblock2b_sfs.txd/ws_haight2top5.dds\",\"gta3.img/hashblock1b_sfs.txd/ws_haight2top5.dds\",\n \"gta3.img/lanbloke.txd/bow_concrete_drip.dds\",\"gta3.img/hashblock1_sfs.txd/bow_concrete_drip.dds\",\n \"gta3.img/lashops93_las2.txd/bow_concrete_drip.dds\",\"gta3.img/hashblock1_sfs.txd/bow_concrete_drip.dds\",\n \"gta3.img/stormdrain_las2.txd/bow_concrete_drip.dds\",\"gta3.img/hashblock1_sfs.txd/bow_concrete_drip.dds\",\n \"gta3.img/sw_block01.txd/bow_concrete_drip.dds\",\"gta3.img/hashblock1_sfs.txd/bow_concrete_drip.dds\",\n \"gta3.img/mission2apts_sfse.txd/ws_streak_billbd.dds\",\"gta3.img/hashblock1_sfs.txd/ws_streak_billbd.dds\",\n \"gta3.img/stadiumground_sfse.txd/ws_streak_billbd.dds\",\"gta3.img/hashblock1_sfs.txd/ws_streak_billbd.dds\",\n \"gta3.img/stationsfse_1.txd/ws_streak_billbd.dds\",\"gta3.img/hashblock1_sfs.txd/ws_streak_billbd.dds\",\n \"gta3.img/hashblock2b_sfs.txd/ws_apartmentblue2.dds\",\"gta3.img/hashblock1_sfs.txd/ws_apartmentblue2.dds\",\n \"gta3.img/hashupass_sfs.txd/ws_apartmentblue2.dds\",\"gta3.img/hashblock1_sfs.txd/ws_apartmentblue2.dds\",\n \"gta3.img/scum_sfse.txd/ws_apartmentblue2.dds\",\"gta3.img/hashblock1_sfs.txd/ws_apartmentblue2.dds\",\n \"gta3.img/hashblock3_sfs.txd/ws_haight3btm.dds\",\"gta3.img/hashblock1_sfs.txd/ws_haight3btm.dds\",\n \"gta3.img/hashhouses1_sfs.txd/ws_haight3btm.dds\",\"gta3.img/hashblock1_sfs.txd/ws_haight3btm.dds\",\n \"gta3.img/hashblock1z_sfs.txd/ws_apartmentblue1.dds\",\"gta3.img/hashblock1_sfs.txd/ws_apartmentblue1.dds\",\n \"gta3.img/hashblock2b_sfs.txd/ws_apartmentblue1.dds\",\"gta3.img/hashblock1_sfs.txd/ws_apartmentblue1.dds\",\n \"gta3.img/hashblock3_sfs.txd/ws_apartmentblue1.dds\",\"gta3.img/hashblock1_sfs.txd/ws_apartmentblue1.dds\",\n \"gta3.img/hashupass_sfs.txd/ws_apartmentblue1.dds\",\"gta3.img/hashblock1_sfs.txd/ws_apartmentblue1.dds\",\n \"gta3.img/queens3_sfs.txd/ws_apartmentblue1.dds\",\"gta3.img/hashblock1_sfs.txd/ws_apartmentblue1.dds\",\n \"gta3.img/queensammo_sfs.txd/ws_apartmentblue1.dds\",\"gta3.img/hashblock1_sfs.txd/ws_apartmentblue1.dds\",\n \"gta3.img/scum_sfse.txd/ws_apartmentblue1.dds\",\"gta3.img/hashblock1_sfs.txd/ws_apartmentblue1.dds\",\n \"gta3.img/hashblock3_sfs.txd/ws_haight2top6.dds\",\"gta3.img/hashblock1_sfs.txd/ws_haight2top6.dds\",\n \"gta3.img/hashhouses1_sfs.txd/ws_haight2top6.dds\",\"gta3.img/hashblock1_sfs.txd/ws_haight2top6.dds\",\n \"gta3.img/hashblock2_sfs.txd/ws_haight4.dds\",\"gta3.img/hashblock1_sfs.txd/ws_haight4.dds\",\n \"gta3.img/midtownshops_sfs.txd/ws_apartmentmankyc1.dds\",\"gta3.img/hashblock1z_sfs.txd/ws_apartmentmankyc1.dds\",\n \"gta3.img/mission_sfse.txd/ws_apartmentmankyc1.dds\",\"gta3.img/hashblock1z_sfs.txd/ws_apartmentmankyc1.dds\",\n \"gta3.img/queens2_sfs.txd/ws_apartmentmankyc1.dds\",\"gta3.img/hashblock1z_sfs.txd/ws_apartmentmankyc1.dds\",\n \"gta3.img/scum_sfse.txd/ws_apartmentmankyc1.dds\",\"gta3.img/hashblock1z_sfs.txd/ws_apartmentmankyc1.dds\",\n \"gta3.img/mission_sfse.txd/ws_ed_shop13_door.dds\",\"gta3.img/hashblock1z_sfs.txd/ws_ed_shop13_door.dds\",\n \"gta3.img/mission_sfse.txd/ws_ed_shop13.dds\",\"gta3.img/hashblock1z_sfs.txd/ws_ed_shop13.dds\",\n \"gta3.img/hashblock3_sfs.txd/ws_apartmentgrn2.dds\",\"gta3.img/hashblock2b_sfs.txd/ws_apartmentgrn2.dds\",\n \"gta3.img/hashblock3_sfs.txd/ws_apartmentgrn1.dds\",\"gta3.img/hashblock2b_sfs.txd/ws_apartmentgrn1.dds\",\n \"gta3.img/hashblock3_sfs.txd/ws_haightshop1alt.dds\",\"gta3.img/hashblock2b_sfs.txd/ws_haightshop1alt.dds\",\n \"gta3.img/hashupass_sfs.txd/ws_haightshop1alt.dds\",\"gta3.img/hashblock2b_sfs.txd/ws_haightshop1alt.dds\",\n \"gta3.img/queens3_sfs.txd/ws_haightshop1alt.dds\",\"gta3.img/hashblock2b_sfs.txd/ws_haightshop1alt.dds\",\n \"gta3.img/hashblock3_sfs.txd/ws_emg_awning.dds\",\"gta3.img/hashblock2b_sfs.txd/ws_emg_awning.dds\",\n \"gta3.img/queens3_sfs.txd/ws_emg_awning.dds\",\"gta3.img/hashblock2b_sfs.txd/ws_emg_awning.dds\",\n \"gta3.img/hashblock3_sfs.txd/ws_haightshop1altdoor.dds\",\"gta3.img/hashblock2b_sfs.txd/ws_haightshop1altdoor.dds\",\n \"gta3.img/hashupass_sfs.txd/ws_haightshop1altdoor.dds\",\"gta3.img/hashblock2b_sfs.txd/ws_haightshop1altdoor.dds\",\n \"gta3.img/queens3_sfs.txd/ws_haightshop1altdoor.dds\",\"gta3.img/hashblock2b_sfs.txd/ws_haightshop1altdoor.dds\",\n \"gta3.img/queens3_sfs.txd/ws_w's_shopfront_top.dds\",\"gta3.img/hashblock2_sfs.txd/ws_w's_shopfront_top.dds\",\n \"gta3.img/shops_sfse.txd/ws_w's_shopfront_top.dds\",\"gta3.img/hashblock2_sfs.txd/ws_w's_shopfront_top.dds\",\n \"gta3.img/queens3_sfs.txd/ws_w's_shopfront.dds\",\"gta3.img/hashblock2_sfs.txd/ws_w's_shopfront.dds\",\n \"gta3.img/shops_sfse.txd/ws_w's_shopfront.dds\",\"gta3.img/hashblock2_sfs.txd/ws_w's_shopfront.dds\",\n \"gta3.img/hashupass_sfs.txd/ws_hs_awning.dds\",\"gta3.img/hashblock3_sfs.txd/ws_hs_awning.dds\",\n \"gta3.img/hotel2_sfs.txd/redshade2_64.dds\",\"gta3.img/hashblock4_sfs.txd/redshade2_64.dds\",\n \"gta3.img/mission3_sfse.txd/ws_apartmentmint2.dds\",\"gta3.img/hashblock4_sfs.txd/ws_apartmentmint2.dds\",\n \"gta3.img/mission4_sfs.txd/ws_apartmentmint2.dds\",\"gta3.img/hashblock4_sfs.txd/ws_apartmentmint2.dds\",\n \"gta3.img/scum2_sfs.txd/ws_apartmentmint2.dds\",\"gta3.img/hashblock4_sfs.txd/ws_apartmentmint2.dds\",\n \"gta3.img/shops2_sfse.txd/ws_apartmentmint2.dds\",\"gta3.img/hashblock4_sfs.txd/ws_apartmentmint2.dds\",\n \"gta3.img/mission3_sfse.txd/ws_apartmentmint3.dds\",\"gta3.img/hashblock4_sfs.txd/ws_apartmentmint3.dds\",\n \"gta3.img/mission4_sfs.txd/ws_apartmentmint3.dds\",\"gta3.img/hashblock4_sfs.txd/ws_apartmentmint3.dds\",\n \"gta3.img/scum2_sfs.txd/ws_apartmentmint3.dds\",\"gta3.img/hashblock4_sfs.txd/ws_apartmentmint3.dds\",\n \"gta3.img/shops2_sfse.txd/ws_apartmentmint3.dds\",\"gta3.img/hashblock4_sfs.txd/ws_apartmentmint3.dds\",\n \"gta3.img/mission3_sfse.txd/ws_apartmentmint1.dds\",\"gta3.img/hashblock4_sfs.txd/ws_apartmentmint1.dds\",\n \"gta3.img/mission4_sfs.txd/ws_apartmentmint1.dds\",\"gta3.img/hashblock4_sfs.txd/ws_apartmentmint1.dds\",\n \"gta3.img/scum2_sfs.txd/ws_apartmentmint1.dds\",\"gta3.img/hashblock4_sfs.txd/ws_apartmentmint1.dds\",\n \"gta3.img/shops2_sfse.txd/ws_apartmentmint1.dds\",\"gta3.img/hashblock4_sfs.txd/ws_apartmentmint1.dds\",\n \"gta3.img/lahillshilhs1e.txd/woodboards2.dds\",\"gta3.img/hashmarket1_sfs.txd/woodboards2.dds\",\n \"gta3.img/silicon2_sfse.txd/woodboards2.dds\",\"gta3.img/hashmarket1_sfs.txd/woodboards2.dds\",\n \"gta3.img/hillhousex4_5.txd/curb_64h.dds\",\"gta3.img/helixbarrier.txd/curb_64h.dds\",\n \"gta3.img/lahillshilhs1x.txd/curb_64h.dds\",\"gta3.img/helixbarrier.txd/curb_64h.dds\",\n \"gta3.img/lanbloki.txd/curb_64h.dds\",\"gta3.img/helixbarrier.txd/curb_64h.dds\",\n \"gta3.img/vgnbball.txd/curb_64h.dds\",\"gta3.img/helixbarrier.txd/curb_64h.dds\",\n \"gta3.img/vgssland01.txd/curb_64h.dds\",\"gta3.img/helixbarrier.txd/curb_64h.dds\",\n \"gta3.img/lawland2.txd/cobbles_kb_256.dds\",\"gta3.img/hillcliff_lahills.txd/cobbles_kb_256.dds\",\n \"gta3.img/sw_well1.txd/cobbles_kb_256.dds\",\"gta3.img/hillcliff_lahills.txd/cobbles_kb_256.dds\",\n \"gta3.img/lahillsa_lodw.txd/lahillhouse05lod.dds\",\"gta3.img/hillhoulod2_la.txd/lahillhouse05lod.dds\",\n \"gta3.img/lahillsa_lodw.txd/lahillhouse06lod.dds\",\"gta3.img/hillhoulod2_la.txd/lahillhouse06lod.dds\",\n \"gta3.img/pierc_law2.txd/roof01l256.dds\",\"gta3.img/hillhousex13_6.txd/roof01l256.dds\",\n \"gta3.img/vegenmotel.txd/roof01l256.dds\",\"gta3.img/hillhousex13_6.txd/roof01l256.dds\",\n \"gta3.img/vgndwntwn1.txd/roof01l256.dds\",\"gta3.img/hillhousex13_6.txd/roof01l256.dds\",\n \"gta3.img/vgnretail4.txd/roof01l256.dds\",\"gta3.img/hillhousex13_6.txd/roof01l256.dds\",\n \"gta3.img/vgnretail5.txd/roof01l256.dds\",\"gta3.img/hillhousex13_6.txd/roof01l256.dds\",\n \"gta3.img/vgsewrehse.txd/roof01l256.dds\",\"gta3.img/hillhousex13_6.txd/roof01l256.dds\",\n \"gta3.img/vgsswarehse02.txd/roof01l256.dds\",\"gta3.img/hillhousex13_6.txd/roof01l256.dds\",\n \"gta3.img/w_town2cs_t.txd/roof01l256.dds\",\"gta3.img/hillhousex13_6.txd/roof01l256.dds\",\n \"gta3.img/vgncorp1.txd/courthsewin_128.dds\",\"gta3.img/hillhousex13_6.txd/courthsewin_128.dds\",\n \"gta3.img/vgnfrates.txd/courthsewin_128.dds\",\"gta3.img/hillhousex13_6.txd/courthsewin_128.dds\",\n \"gta3.img/vgsewrehse.txd/courthsewin_128.dds\",\"gta3.img/hillhousex13_6.txd/courthsewin_128.dds\",\n \"gta3.img/vgsswarehse02.txd/courthsewin_128.dds\",\"gta3.img/hillhousex13_6.txd/courthsewin_128.dds\",\n \"gta3.img/mullholl_lahills.txd/mulhuose01_law.dds\",\"gta3.img/hillhousex2_us.txd/mulhuose01_law.dds\",\n \"gta3.img/tcecen4law.txd/mulhuose01_law.dds\",\"gta3.img/hillhousex2_us.txd/mulhuose01_law.dds\",\n \"gta3.img/lahillshilhs1x.txd/inwindow1.dds\",\"gta3.img/hillhousex4_5.txd/inwindow1.dds\",\n \"gta3.img/motel_lae.txd/inwindow1.dds\",\"gta3.img/hillhousex4_5.txd/inwindow1.dds\",\n \"gta3.img/skyscrap2_lan2.txd/downtwin20.dds\",\"gta3.img/hillhousex_la10_12.txd/downtwin20.dds\",\n \"gta3.img/sunset01_law2.txd/downtwin20.dds\",\"gta3.img/hillhousex_la10_12.txd/downtwin20.dds\",\n \"gta3.img/hillhousex_la9.txd/shingleslah.dds\",\"gta3.img/hillhousex_la1_2.txd/shingleslah.dds\",\n \"gta3.img/lanbloke.txd/ceiling_256.dds\",\"gta3.img/hosbibalsfw.txd/ceiling_256.dds\",\n \"gta_int.img/genintintfastd.txd/ceiling_256.dds\",\"gta3.img/hosbibalsfw.txd/ceiling_256.dds\",\n \"gta_int.img/genintintsex.txd/ceiling_256.dds\",\"gta3.img/hosbibalsfw.txd/ceiling_256.dds\",\n \"gta_int.img/scummy.txd/ceiling_256.dds\",\"gta3.img/hosbibalsfw.txd/ceiling_256.dds\",\n \"gta3.img/santamonicalaw2.txd/paveslab1.dds\",\"gta3.img/hosbibalsfw.txd/paveslab1.dds\",\n \"gta3.img/sunst18_lawn.txd/paveslab1.dds\",\"gta3.img/hosbibalsfw.txd/paveslab1.dds\",\n \"gta3.img/vegassland62.txd/paveslab1.dds\",\"gta3.img/hosbibalsfw.txd/paveslab1.dds\",\n \"gta3.img/inditaly.txd/alumox64.dds\",\"gta3.img/hospital2.txd/alumox64.dds\",\n \"gta3.img/motel_lae.txd/ws_carpark2.dds\",\"gta3.img/hospital_lae.txd/ws_carpark2.dds\",\n \"gta3.img/shamcpark.txd/ws_carpark2.dds\",\"gta3.img/hospital_lae.txd/ws_carpark2.dds\",\n \"gta3.img/vgncondos1.txd/grasslawnfade_256.dds\",\"gta3.img/hotel1.txd/grasslawnfade_256.dds\",\n \"gta3.img/queens2_sfs.txd/ws_awning.dds\",\"gta3.img/hotel1.txd/ws_awning.dds\",\n \"gta_int.img/labig2int2.txd/gold128.dds\",\"gta3.img/hotel1.txd/gold128.dds\",\n \"gta_int.img/labig3int2.txd/gold128.dds\",\"gta3.img/hotel1.txd/gold128.dds\",\n \"gta_int.img/sfhsb2bits.txd/gold128.dds\",\"gta3.img/hotel1.txd/gold128.dds\",\n \"gta_int.img/svbits.txd/gold128.dds\",\"gta3.img/hotel1.txd/gold128.dds\",\n \"gta3.img/stadium_sfse.txd/ws_hotel5.dds\",\"gta3.img/hotel1.txd/ws_hotel5.dds\",\n \"gta3.img/vgnshambild1.txd/carpet_red_256.dds\",\"gta3.img/hotel1.txd/carpet_red_256.dds\",\n \"gta3.img/queens1_sfs.txd/ws_hoteldoor1.dds\",\"gta3.img/hotel2_sfs.txd/ws_hoteldoor1.dds\",\n \"gta3.img/stadium_sfse.txd/ws_hotel7.dds\",\"gta3.img/hotelbackpool_sfs.txd/ws_hotel7.dds\",\n \"gta3.img/hotrinb.txd/hotrinb92web32.dds\",\"gta3.img/hotrina.txd/hotrina92web32.dds\",\n \"gta3.img/hotring.txd/hotring92web32.dds\",\"gta3.img/hotrina.txd/hotrina92web32.dds\",\n \"gta3.img/hotrinb.txd/hotrinb92tyre32.dds\",\"gta3.img/hotrina.txd/hotrina92tyre32.dds\",\n \"gta3.img/hotring.txd/hotring92tyre32.dds\",\"gta3.img/hotrina.txd/hotrina92tyre32.dds\",\n \"gta3.img/hotrinb.txd/hotrinb92interior64.dds\",\"gta3.img/hotrina.txd/hotrina92interior64.dds\",\n \"gta3.img/hotring.txd/hotring92interior64.dds\",\"gta3.img/hotrina.txd/hotrina92interior64.dds\",\n \"gta3.img/lod2lae1.txd/sjmlaelodg4.dds\",\"gta3.img/houselod_lax.txd/sjmlaelodg4.dds\",\n \"gta3.img/lod2lae1.txd/sjmlaelodg3.dds\",\"gta3.img/houselod_lax.txd/sjmlaelodg3.dds\",\n \"gta3.img/libhelipad_lan2.txd/dt_bridge_rail_texture.dds\",\"gta3.img/hrbr_sfn.txd/dt_bridge_rail_texture.dds\",\n \"gta3.img/odnrooft.txd/dt_bridge_rail_texture.dds\",\"gta3.img/hrbr_sfn.txd/dt_bridge_rail_texture.dds\",\n \"gta3.img/roofbit_lawn.txd/dt_bridge_rail_texture.dds\",\"gta3.img/hrbr_sfn.txd/dt_bridge_rail_texture.dds\",\n \"gta3.img/sfe_copchop.txd/dt_bridge_rail_texture.dds\",\"gta3.img/hrbr_sfn.txd/dt_bridge_rail_texture.dds\",\n \"gta3.img/sfn_helipad.txd/dt_bridge_rail_texture.dds\",\"gta3.img/hrbr_sfn.txd/dt_bridge_rail_texture.dds\",\n \"gta3.img/jeffers4_lae.txd/macbrij1_lae.dds\",\"gta3.img/hub_alpha.txd/macbrij1_lae.dds\",\n \"gta3.img/laeroads.txd/macbrij1_lae.dds\",\"gta3.img/hub_alpha.txd/macbrij1_lae.dds\",\n \"gta3.img/roadstr_lae.txd/macbrij1_lae.dds\",\"gta3.img/hub_alpha.txd/macbrij1_lae.dds\",\n \"gta3.img/laealpha.txd/clothline1_lae.dds\",\"gta3.img/hub_alpha.txd/clothline1_lae.dds\",\n \"gta3.img/wiresetc_las.txd/clothline1_lae.dds\",\"gta3.img/hub_alpha.txd/clothline1_lae.dds\",\n \"gta_int.img/ab_abbatoir01.txd/ab_ceiling1.dds\",\"gta3.img/hubint1_sfse.txd/ab_ceiling1.dds\",\n \"gta_int.img/sweetshall.txd/ab_ceiling1.dds\",\"gta3.img/hubint1_sfse.txd/ab_ceiling1.dds\",\n \"gta_int.img/sweetsmain.txd/ab_ceiling1.dds\",\"gta3.img/hubint1_sfse.txd/ab_ceiling1.dds\",\n \"gta3.img/ws_jetty_sfx.txd/ws_greymetal_small.dds\",\"gta3.img/hubint2.txd/ws_greymetal_small.dds\",\n \"gta_int.img/proc_rub.txd/cj_fire.dds\",\"gta3.img/hubprops2_sfse.txd/cj_fire.dds\",\n \"gta3.img/recroomsfse.txd/cj_speaker4.dds\",\"gta3.img/hubprops2_sfse.txd/cj_speaker4.dds\",\n \"gta_int.img/cj_games.txd/cj_speaker4.dds\",\"gta3.img/hubprops2_sfse.txd/cj_speaker4.dds\",\n \"gta_int.img/cj_hi_fi2.txd/cj_speaker4.dds\",\"gta3.img/hubprops2_sfse.txd/cj_speaker4.dds\",\n \"gta_int.img/cj_hi_fi.txd/cj_speaker4.dds\",\"gta3.img/hubprops2_sfse.txd/cj_speaker4.dds\",\n \"gta3.img/recroomsfse.txd/cj_hi_fi_1.dds\",\"gta3.img/hubprops2_sfse.txd/cj_hi_fi_1.dds\",\n \"gta_int.img/cj_hi_fi.txd/cj_hi_fi_1.dds\",\"gta3.img/hubprops2_sfse.txd/cj_hi_fi_1.dds\",\n \"gta3.img/michgar.txd/yellowvertical_64hv.dds\",\"gta3.img/hubprops2_sfse.txd/yellowvertical_64hv.dds\",\n \"gta_int.img/genintintcarint3.txd/yellowvertical_64hv.dds\",\"gta3.img/hubprops2_sfse.txd/yellowvertical_64hv.dds\",\n \"gta3.img/junk.txd/tyretread_64h.dds\",\"gta3.img/hubprops2_sfse.txd/tyretread_64h.dds\",\n \"gta_int.img/genintintcarint3.txd/tyretread_64h.dds\",\"gta3.img/hubprops2_sfse.txd/tyretread_64h.dds\",\n \"gta3.img/michgar.txd/auto_tune2.dds\",\"gta3.img/hubprops2_sfse.txd/auto_tune2.dds\",\n \"gta_int.img/dr_gsmix.txd/auto_tune2.dds\",\"gta3.img/hubprops2_sfse.txd/auto_tune2.dds\",\n \"gta_int.img/genintintcarint3.txd/auto_tune2.dds\",\"gta3.img/hubprops2_sfse.txd/auto_tune2.dds\",\n \"gta_int.img/genintintgarage2.txd/auto_tune2.dds\",\"gta3.img/hubprops2_sfse.txd/auto_tune2.dds\",\n \"gta_int.img/genintintgarage3b.txd/auto_tune2.dds\",\"gta3.img/hubprops2_sfse.txd/auto_tune2.dds\",\n \"gta3.img/michgar.txd/auto_tune1.dds\",\"gta3.img/hubprops2_sfse.txd/auto_tune1.dds\",\n \"gta_int.img/genintintcarint3.txd/auto_tune1.dds\",\"gta3.img/hubprops2_sfse.txd/auto_tune1.dds\",\n \"gta_int.img/genintintgarage2.txd/auto_tune1.dds\",\"gta3.img/hubprops2_sfse.txd/auto_tune1.dds\",\n \"gta_int.img/genintintgarage3b.txd/auto_tune1.dds\",\"gta3.img/hubprops2_sfse.txd/auto_tune1.dds\",\n \"gta_int.img/genintintcarint3.txd/toolwall1.dds\",\"gta3.img/hubprops2_sfse.txd/toolwall1.dds\",\n \"gta3.img/michgar.txd/auto_tune3.dds\",\"gta3.img/hubprops2_sfse.txd/auto_tune3.dds\",\n \"gta_int.img/genintintcarint3.txd/auto_tune3.dds\",\"gta3.img/hubprops2_sfse.txd/auto_tune3.dds\",\n \"gta_int.img/genintintgarage2.txd/auto_tune3.dds\",\"gta3.img/hubprops2_sfse.txd/auto_tune3.dds\",\n \"gta_int.img/genintintgarage3b.txd/auto_tune3.dds\",\"gta3.img/hubprops2_sfse.txd/auto_tune3.dds\",\n \"gta3.img/michgar.txd/tool_store.dds\",\"gta3.img/hubprops2_sfse.txd/tool_store.dds\",\n \"gta_int.img/genintintcarint3.txd/tool_store.dds\",\"gta3.img/hubprops2_sfse.txd/tool_store.dds\",\n \"gta_int.img/genintintgarage2.txd/tool_store.dds\",\"gta3.img/hubprops2_sfse.txd/tool_store.dds\",\n \"gta_int.img/genintintgarage3b.txd/tool_store.dds\",\"gta3.img/hubprops2_sfse.txd/tool_store.dds\",\n \"gta3.img/michgar.txd/porta_256128.dds\",\"gta3.img/hubprops2_sfse.txd/porta_256128.dds\",\n \"gta_int.img/genintintcarint3.txd/porta_256128.dds\",\"gta3.img/hubprops2_sfse.txd/porta_256128.dds\",\n \"gta_int.img/genintintgarage2.txd/porta_256128.dds\",\"gta3.img/hubprops2_sfse.txd/porta_256128.dds\",\n \"gta_int.img/genintintgarage3b.txd/porta_256128.dds\",\"gta3.img/hubprops2_sfse.txd/porta_256128.dds\",\n \"gta_int.img/genintintcarint3.txd/metpat_64.dds\",\"gta3.img/hubprops2_sfse.txd/metpat_64.dds\",\n \"gta3.img/michgar.txd/leccy_cables.dds\",\"gta3.img/hubprops2_sfse.txd/leccy_cables.dds\",\n \"gta_int.img/genintintcarint3.txd/leccy_cables.dds\",\"gta3.img/hubprops2_sfse.txd/leccy_cables.dds\",\n \"gta_int.img/genintintgarage2.txd/leccy_cables.dds\",\"gta3.img/hubprops2_sfse.txd/leccy_cables.dds\",\n \"gta_int.img/genintintgarage3b.txd/leccy_cables.dds\",\"gta3.img/hubprops2_sfse.txd/leccy_cables.dds\",\n \"gta3.img/michgar.txd/tool_store2.dds\",\"gta3.img/hubprops2_sfse.txd/tool_store2.dds\",\n \"gta_int.img/genintintcarint3.txd/tool_store2.dds\",\"gta3.img/hubprops2_sfse.txd/tool_store2.dds\",\n \"gta3.img/michgar.txd/metal2_256128.dds\",\"gta3.img/hubprops2_sfse.txd/metal2_256128.dds\",\n \"gta_int.img/genintintcarint3.txd/metal2_256128.dds\",\"gta3.img/hubprops2_sfse.txd/metal2_256128.dds\",\n \"gta_int.img/genintintgarage2.txd/metal2_256128.dds\",\"gta3.img/hubprops2_sfse.txd/metal2_256128.dds\",\n \"gta_int.img/genintintgarage3b.txd/metal2_256128.dds\",\"gta3.img/hubprops2_sfse.txd/metal2_256128.dds\",\n \"gta3.img/icons5.txd/heart.dds\",\"gta3.img/icons4.txd/heart.dds\",\n \"gta3.img/icons8.txd/pill_32.dds\",\"gta3.img/icons5.txd/pill_32.dds\",\n \"gta3.img/icons.txd/pill_32.dds\",\"gta3.img/icons5.txd/pill_32.dds\",\n \"gta3.img/laealpha.txd/lasjmrail1.dds\",\"gta3.img/idlewood3_lae.txd/lasjmrail1.dds\",\n \"gta3.img/industry3_las2.txd/sanpedmot4.dds\",\"gta3.img/idlewood3_lae.txd/sanpedmot4.dds\",\n \"gta3.img/lasraodnshops.txd/sanpedmot4.dds\",\"gta3.img/idlewood3_lae.txd/sanpedmot4.dds\",\n \"gta3.img/lasraodnshops.txd/sanpedmot3.dds\",\"gta3.img/idlewood3_lae.txd/sanpedmot3.dds\",\n \"gta3.img/oldshops_las.txd/sanpedmot3.dds\",\"gta3.img/idlewood3_lae.txd/sanpedmot3.dds\",\n \"gta3.img/lasraodnshops.txd/sanpedmot1.dds\",\"gta3.img/idlewood3_lae.txd/sanpedmot1.dds\",\n \"gta3.img/lashops93_las2.txd/sanpedton5.dds\",\"gta3.img/idlewood3_lae.txd/sanpedton5.dds\",\n \"gta3.img/idlewood6_lae.txd/sanpedton1.dds\",\"gta3.img/idlewood3_lae.txd/sanpedton1.dds\",\n \"gta3.img/lashops93_las2.txd/sanpedton1.dds\",\"gta3.img/idlewood3_lae.txd/sanpedton1.dds\",\n \"gta3.img/lasraodnshops.txd/sanpedton1.dds\",\"gta3.img/idlewood3_lae.txd/sanpedton1.dds\",\n \"gta3.img/vgnretail5.txd/ws_vic_wood1.dds\",\"gta3.img/idlewood3_lae.txd/ws_vic_wood1.dds\",\n \"gta3.img/shops01_law.txd/redresdoor.dds\",\"gta3.img/idlewood46_lae.txd/redresdoor.dds\",\n \"gta3.img/idlewood6_tr.txd/ladocksig1.dds\",\"gta3.img/idlewood6_detail.txd/ladocksig1.dds\",\n \"gta3.img/warehus_las2.txd/ladocksig1.dds\",\"gta3.img/idlewood6_detail.txd/ladocksig1.dds\",\n \"gta3.img/wiresetc_las2.txd/ladocksig1.dds\",\"gta3.img/idlewood6_detail.txd/ladocksig1.dds\",\n \"gta3.img/warehus_las2.txd/snpedwar4b.dds\",\"gta3.img/idlewood6_detail.txd/snpedwar4b.dds\",\n \"gta3.img/oldshops_las.txd/sanpshop2.dds\",\"gta3.img/idlewood6_lae.txd/sanpshop2.dds\",\n \"gta3.img/lawnstripm.txd/liqdel1.dds\",\"gta3.img/idlewood6_lae.txd/liqdel1.dds\",\n \"gta3.img/lashops91_las2.txd/sjmhicut1las.dds\",\"gta3.img/idlewood6_lae.txd/sjmhicut1las.dds\",\n \"gta3.img/lashops93_las2.txd/sjmhicut1las.dds\",\"gta3.img/idlewood6_lae.txd/sjmhicut1las.dds\",\n \"gta3.img/shopliquor_las.txd/las69str2.dds\",\"gta3.img/idlewood6_lae.txd/las69str2.dds\",\n \"gta3.img/landhub.txd/concretebigc256128.dds\",\"gta3.img/idlewood6_lae.txd/concretebigc256128.dds\",\n \"gta3.img/melrose05_lawn.txd/gangshop9_lae.dds\",\"gta3.img/idlewood6_lae.txd/gangshop9_lae.dds\",\n \"gta3.img/melrose19_lawn.txd/barberpole1.dds\",\"gta3.img/idlewood6_lae.txd/barberpole1.dds\",\n \"gta3.img/shops01_law.txd/barberpole1.dds\",\"gta3.img/idlewood6_lae.txd/barberpole1.dds\",\n \"gta3.img/templae2land.txd/barberpole1.dds\",\"gta3.img/idlewood6_lae.txd/barberpole1.dds\",\n \"gta3.img/wiresetc_las2.txd/ladocksig3.dds\",\"gta3.img/idlewood6_tr.txd/ladocksig3.dds\",\n \"gta3.img/warehus_las2.txd/ladocksig2.dds\",\"gta3.img/idlewood6_tr.txd/ladocksig2.dds\",\n \"gta3.img/wiresetc_las2.txd/ladocksig2.dds\",\"gta3.img/idlewood6_tr.txd/ladocksig2.dds\",\n \"gta_int.img/imy_motel2.txd/kb_imvent.dds\",\"gta3.img/imm_roomx.txd/kb_imvent.dds\",\n \"gta_int.img/imy_motel.txd/kb_imvent.dds\",\"gta3.img/imm_roomx.txd/kb_imvent.dds\",\n \"gta_int.img/genintwarehsint3.txd/lastat97.dds\",\"gta3.img/imrancomp_las2.txd/lastat97.dds\",\n \"gta3.img/vgnretail72.txd/lightwallba256.dds\",\"gta3.img/imrancomp_las2.txd/lightwallba256.dds\",\n \"gta3.img/vgwestretail1.txd/lightwallba256.dds\",\"gta3.img/imrancomp_las2.txd/lightwallba256.dds\",\n \"gta_int.img/genintwarehsint3.txd/lightwallba256.dds\",\"gta3.img/imrancomp_las2.txd/lightwallba256.dds\",\n \"gta_int.img/smashtv.txd/lightwallba256.dds\",\"gta3.img/imrancomp_las2.txd/lightwallba256.dds\",\n \"gta_int.img/genintwarehsint3.txd/sjmlawardra1.dds\",\"gta3.img/imrancomp_las2.txd/sjmlawardra1.dds\",\n \"gta_int.img/smashtv.txd/sjmlawardra1.dds\",\"gta3.img/imrancomp_las2.txd/sjmlawardra1.dds\",\n \"gta3.img/imstuff_las2.txd/sanpdconv.dds\",\"gta3.img/imrancomp_las2.txd/sanpdconv.dds\",\n \"gta3.img/lasxrefdock.txd/sjmlawarwall2.dds\",\"gta3.img/imrancomp_las2.txd/sjmlawarwall2.dds\",\n \"gta_int.img/genintwarehsint3.txd/sjmlawarwall2.dds\",\"gta3.img/imrancomp_las2.txd/sjmlawarwall2.dds\",\n \"gta_int.img/smashtv.txd/sjmlawarwall2.dds\",\"gta3.img/imrancomp_las2.txd/sjmlawarwall2.dds\",\n \"gta3.img/mulhousclahills.txd/lasjmflood2.dds\",\"gta3.img/imrancomp_las2.txd/lasjmflood2.dds\",\n \"gta3.img/sjmla_las.txd/lasjmflood2.dds\",\"gta3.img/imrancomp_las2.txd/lasjmflood2.dds\",\n \"gta_int.img/genintwarehsint3.txd/lasjmflood2.dds\",\"gta3.img/imrancomp_las2.txd/lasjmflood2.dds\",\n \"gta_int.img/smashtv.txd/lasjmflood2.dds\",\"gta3.img/imrancomp_las2.txd/lasjmflood2.dds\",\n \"gta_int.img/genintwarehsint3.txd/sjmlawarwall4.dds\",\"gta3.img/imrancomp_las2.txd/sjmlawarwall4.dds\",\n \"gta_int.img/smashtv.txd/sjmlawarwall4.dds\",\"gta3.img/imrancomp_las2.txd/sjmlawarwall4.dds\",\n \"gta3.img/kmb_alleytxd.txd/cardbrdirty128.dds\",\"gta3.img/imstuff_las2.txd/cardbrdirty128.dds\",\n \"gta3.img/sjmla_las.txd/sjmlawarshcrategen.dds\",\"gta3.img/imstuff_las2.txd/sjmlawarshcrategen.dds\",\n \"gta3.img/sjmla_las.txd/sjmlawarplt2.dds\",\"gta3.img/imstuff_las2.txd/sjmlawarplt2.dds\",\n \"gta_int.img/genintintsex.txd/backdoor_128.dds\",\"gta3.img/imy_motex.txd/backdoor_128.dds\",\n \"gta_int.img/imm_roomss.txd/backdoor_128.dds\",\"gta3.img/imy_motex.txd/backdoor_128.dds\",\n \"gta_int.img/imy_motel2.txd/backdoor_128.dds\",\"gta3.img/imy_motex.txd/backdoor_128.dds\",\n \"gta_int.img/imy_motel.txd/backdoor_128.dds\",\"gta3.img/imy_motex.txd/backdoor_128.dds\",\n \"gta_int.img/savegenmotel.txd/backdoor_128.dds\",\"gta3.img/imy_motex.txd/backdoor_128.dds\",\n \"gta3.img/libertyfar.txd/tarmac_64hv.dds\",\"gta3.img/indust1.txd/tarmac_64hv.dds\",\n \"gta3.img/libertyfar.txd/lo1road_128.dds\",\"gta3.img/indust1.txd/lo1road_128.dds\",\n \"gta3.img/libertyfar.txd/indsmallwall64.dds\",\"gta3.img/indust1.txd/indsmallwall64.dds\",\n \"gta3.img/libertyfar.txd/grass_32.dds\",\"gta3.img/indust1.txd/grass_32.dds\",\n \"gta3.img/libertyfar.txd/grass_128hv.dds\",\"gta3.img/indust1.txd/grass_128hv.dds\",\n \"gta3.img/indust2.txd/firewall.dds\",\"gta3.img/indust1.txd/firewall.dds\",\n \"gta3.img/transformer_sfs.txd/lasjmpow4.dds\",\"gta3.img/indust_lax.txd/lasjmpow4.dds\",\n \"gta3.img/transformer_sfs.txd/lasjmpow91.dds\",\"gta3.img/indust_lax.txd/lasjmpow91.dds\",\n \"gta3.img/transformer_sfs.txd/lasjmpow95.dds\",\"gta3.img/indust_lax.txd/lasjmpow95.dds\",\n \"gta3.img/transformer_sfs.txd/lasjmpow94.dds\",\"gta3.img/indust_lax.txd/lasjmpow94.dds\",\n \"gta3.img/transformer_sfs.txd/lasjmpow93.dds\",\"gta3.img/indust_lax.txd/lasjmpow93.dds\",\n \"gta3.img/sfroadsign.txd/cj_panel.dds\",\"gta3.img/industrialext.txd/cj_panel.dds\",\n \"gta_int.img/maint1.txd/lecybox.dds\",\"gta3.img/industrialext.txd/lecybox.dds\",\n \"gta3.img/plants_officeext.txd/cj_pail.dds\",\"gta3.img/industrialext.txd/cj_pail.dds\",\n \"gta3.img/totoie.txd/cj_pail.dds\",\"gta3.img/industrialext.txd/cj_pail.dds\",\n \"gta3.img/vgsbikesclint.txd/cj_pail.dds\",\"gta3.img/industrialext.txd/cj_pail.dds\",\n \"gta_int.img/cj_ammo.txd/cj_pail.dds\",\"gta3.img/industrialext.txd/cj_pail.dds\",\n \"gta_int.img/cj_anim.txd/cj_pail.dds\",\"gta3.img/industrialext.txd/cj_pail.dds\",\n \"gta_int.img/cj_commercial.txd/cj_pail.dds\",\"gta3.img/industrialext.txd/cj_pail.dds\",\n \"gta_int.img/cj_hair.txd/cj_spec.dds\",\"gta3.img/industrialext.txd/cj_spec.dds\",\n \"gta_int.img/cj_tv.txd/cj_spec.dds\",\"gta3.img/industrialext.txd/cj_spec.dds\",\n \"gta_int.img/cj_urb.txd/cj_spec.dds\",\"gta3.img/industrialext.txd/cj_spec.dds\",\n \"gta_int.img/ds_sign.txd/cj_spec.dds\",\"gta3.img/industrialext.txd/cj_spec.dds\",\n \"gta_int.img/pdomes_logo.txd/cj_spec.dds\",\"gta3.img/industrialext.txd/cj_spec.dds\",\n \"gta_int.img/ryfurn2.txd/cj_spec.dds\",\"gta3.img/industrialext.txd/cj_spec.dds\",\n \"gta_int.img/skate_shop.txd/cj_spec.dds\",\"gta3.img/industrialext.txd/cj_spec.dds\",\n \"gta_int.img/svsfsmbits.txd/cj_spec.dds\",\"gta3.img/industrialext.txd/cj_spec.dds\",\n \"gta_int.img/triad_big.txd/cj_spec.dds\",\"gta3.img/industrialext.txd/cj_spec.dds\",\n \"gta_int.img/shopping_acc.txd/cj_gen_glass2.dds\",\"gta3.img/industrialext.txd/cj_gen_glass2.dds\",\n \"gta_int.img/shopping_freezers.txd/cj_gen_glass2.dds\",\"gta3.img/industrialext.txd/cj_gen_glass2.dds\",\n \"gta_int.img/maint1.txd/cj_yellowgenerator.dds\",\"gta3.img/industrialext.txd/cj_yellowgenerator.dds\",\n \"gta_int.img/maint1.txd/cj_vent1.dds\",\"gta3.img/industrialext.txd/cj_vent1.dds\",\n \"gta_int.img/maint3.txd/cj_vent1.dds\",\"gta3.img/industrialext.txd/cj_vent1.dds\",\n \"gta3.img/lashops93_las2.txd/snpedshptst3.dds\",\"gta3.img/industry3_las2.txd/snpedshptst3.dds\",\n \"gta3.img/wasteland_las2.txd/sjmlashopsig2.dds\",\"gta3.img/industry3_las2.txd/sjmlashopsig2.dds\",\n \"gta_int.img/ab_wooziea.txd/cj_wooddoor5.dds\",\"gta3.img/int_doors.txd/cj_wooddoor5.dds\",\n \"gta_int.img/labigsave.txd/cj_wooddoor5.dds\",\"gta3.img/int_doors.txd/cj_wooddoor5.dds\",\n \"gta_int.img/rywins.txd/mp_cj_wooddoor2.dds\",\"gta3.img/int_doors.txd/cj_wooddoor5.dds\",\n \"gta_int.img/savesfmid.txd/cj_wooddoor5.dds\",\"gta3.img/int_doors.txd/cj_wooddoor5.dds\",\n \"gta_int.img/sfhosemed2.txd/cj_wooddoor5.dds\",\"gta3.img/int_doors.txd/cj_wooddoor5.dds\",\n \"gta_int.img/sfhsm2.txd/cj_wooddoor5.dds\",\"gta3.img/int_doors.txd/cj_wooddoor5.dds\",\n \"gta_int.img/sfhsmedium1.txd/cj_wooddoor5.dds\",\"gta3.img/int_doors.txd/cj_wooddoor5.dds\",\n \"gta_int.img/skuzzy_motelmain.txd/mp_cj_wooddoor2.dds\",\"gta3.img/int_doors.txd/cj_wooddoor5.dds\",\n \"gta_int.img/smallsfhs.txd/cj_wooddoor5.dds\",\"gta3.img/int_doors.txd/cj_wooddoor5.dds\",\n \"gta_int.img/vgshm2int2.txd/cj_wooddoor5.dds\",\"gta3.img/int_doors.txd/cj_wooddoor5.dds\",\n \"gta_int.img/maddogsdoors.txd/cj_wooddoor2.dds\",\"gta3.img/int_doors.txd/cj_wooddoor2.dds\",\n \"gta_int.img/sfmansion1.txd/cj_wooddoor2.dds\",\"gta3.img/int_doors.txd/cj_wooddoor2.dds\",\n \"gta_int.img/traidman.txd/cj_wooddoor2.dds\",\"gta3.img/int_doors.txd/cj_wooddoor2.dds\",\n \"gta_int.img/triad_main.txd/cj_wooddoor2.dds\",\"gta3.img/int_doors.txd/cj_wooddoor2.dds\",\n \"gta3.img/nvgoggles.txd/nvgogglesicon.dds\",\"gta3.img/irgoggles.txd/irgogglesicon.dds\",\n \"gta3.img/lae2roadshub.txd/sidewgrass1.dds\",\"gta3.img/jeffers4_lae.txd/sidewgrass1.dds\",\n \"gta3.img/lae2roads.txd/sidewgrass1.dds\",\"gta3.img/jeffers4_lae.txd/sidewgrass1.dds\",\n \"gta_int.img/labig1int2.txd/flooringwd01_int.dds\",\"gta3.img/jeffers4_lae.txd/flooringwd01_int.dds\",\n \"gta_int.img/whore_rms.txd/flooringwd01_int.dds\",\"gta3.img/jeffers4_lae.txd/flooringwd01_int.dds\",\n \"gta3.img/law_beach2.txd/newall9b_16c128.dds\",\"gta3.img/jeffers4_lae.txd/newall9b_16c128.dds\",\n \"gta3.img/lawnabv.txd/discwa1_lae2.dds\",\"gta3.img/jeffers5a_lae.txd/discwa1_lae2.dds\",\n \"gta3.img/melrose05_lawn.txd/gangshop13_lae.dds\",\"gta3.img/jeffers5a_lae.txd/gangshop13_lae.dds\",\n \"gta3.img/lowbuild03_lvs.txd/vgshopwall05_64.dds\",\"gta3.img/jeffers5a_lae.txd/vgshopwall05_64.dds\",\n \"gta3.img/vgndwntwn21.txd/vgnshopwal1_256.dds\",\"gta3.img/jeffers5a_lae.txd/vgnshopwal1_256.dds\",\n \"gta3.img/melrose06_lawn.txd/heat_01.dds\",\"gta3.img/jeffers5a_lae.txd/heat_01.dds\",\n \"gta3.img/sunbill_law2.txd/heat_01.dds\",\"gta3.img/jeffers5a_lae.txd/heat_01.dds\",\n \"gta3.img/vgsssignage03.txd/heat_01.dds\",\"gta3.img/jeffers5a_lae.txd/heat_01.dds\",\n \"gta3.img/lan2_gm1.txd/poshentrance1_256.dds\",\"gta3.img/jeffers5a_lae.txd/poshentrance1_256.dds\",\n \"gta3.img/vgsnbuild07.txd/poshentrance1_256.dds\",\"gta3.img/jeffers5a_lae.txd/poshentrance1_256.dds\",\n \"gta_int.img/jet_interior.txd/mp_jet_roof.dds\",\"gta3.img/jetdx.txd/mp_jet_roof.dds\",\n \"gta3.img/trolex.txd/trolley02.dds\",\"gta3.img/jt_doorx.txd/trolley02.dds\",\n \"gta3.img/shamal.txd/shamalbody256.dds\",\"gta3.img/jt_doorx.txd/shamalbody256.dds\",\n \"gta3.img/pier_law.txd/rooftop_pipes.dds\",\"gta3.img/jump_sfxref.txd/rooftop_pipes.dds\",\n \"gta3.img/lashops93_las2.txd/ws_oldredbrick.dds\",\"gta3.img/junkpiles.txd/ws_oldredbrick.dds\",\n \"gta3.img/ottos2_sfw.txd/cjgrass.dds\",\"gta3.img/junkpiles.txd/cjgrass.dds\",\n \"gta3.img/plants_officeext.txd/cjgrass.dds\",\"gta3.img/junkpiles.txd/cjgrass.dds\",\n \"gta3.img/vgsbikesclint.txd/cjgrass.dds\",\"gta3.img/junkpiles.txd/cjgrass.dds\",\n \"gta_int.img/plants_designer.txd/cjgrass.dds\",\"gta3.img/junkpiles.txd/cjgrass.dds\",\n \"gta3.img/kmb_waredoorx.txd/garage_docks.dds\",\"gta3.img/kb_ctdoorx.txd/garage_docks.dds\",\n \"gta3.img/kbgarage_las.txd/ahoodnewdr1.dds\",\"gta3.img/kbgarage_las2.txd/ahoodnewdr1.dds\",\n \"gta3.img/lasground2_las2.txd/ahoodnewdr1.dds\",\"gta3.img/kbgarage_las2.txd/ahoodnewdr1.dds\",\n \"gta3.img/sjmla_las.txd/ahoodnewdr1.dds\",\"gta3.img/kbgarage_las2.txd/ahoodnewdr1.dds\",\n \"gta3.img/kbgarage_las.txd/aanewwin.dds\",\"gta3.img/kbgarage_las2.txd/aanewwin.dds\",\n \"gta3.img/lasground2_las2.txd/aanewwin.dds\",\"gta3.img/kbgarage_las2.txd/aanewwin.dds\",\n \"gta3.img/sjmla_las.txd/aanewwin.dds\",\"gta3.img/kbgarage_las2.txd/aanewwin.dds\",\n \"gta3.img/lasground2_las2.txd/gragedoorkb2.dds\",\"gta3.img/kbgarage_las.txd/gragedoorkb2.dds\",\n \"gta_int.img/intgarage2aint3.txd/gragedoorkb2.dds\",\"gta3.img/kbgarage_las.txd/gragedoorkb2.dds\",\n \"gta_int.img/int_kbsgarage3.txd/gragedoorkb2.dds\",\"gta3.img/kbgarage_las.txd/gragedoorkb2.dds\",\n \"gta_int.img/kbmiscfrn2.txd/man_mny2.dds\",\"gta3.img/kbmiscfrn1.txd/man_mny2.dds\",\n \"gta_int.img/ab_cargo_int.txd/747_freight1.dds\",\"gta3.img/k_cratesx.txd/747_freight1.dds\",\n \"gta3.img/lodvgsslod01.txd/yellow_64.dds\",\"gta3.img/kei_wnchx.txd/yellow_64.dds\",\n \"gta3.img/lodvgsslod.txd/yellow_64.dds\",\"gta3.img/kei_wnchx.txd/yellow_64.dds\",\n \"gta3.img/missiles_sfs.txd/yellow_64.dds\",\"gta3.img/kei_wnchx.txd/yellow_64.dds\",\n \"gta3.img/vgsshospshop.txd/yellow_64.dds\",\"gta3.img/kei_wnchx.txd/yellow_64.dds\",\n \"gta3.img/vgsssignage03.txd/yellow_64.dds\",\"gta3.img/kei_wnchx.txd/yellow_64.dds\",\n \"gta3.img/vgsswarehse02c.txd/yellow_64.dds\",\"gta3.img/kei_wnchx.txd/yellow_64.dds\",\n \"gta3.img/vgsswrehse03.txd/yellow_64.dds\",\"gta3.img/kei_wnchx.txd/yellow_64.dds\",\n \"gta3.img/k_pool.txd/trilby04.dds\",\"gta3.img/kei_wnchx.txd/trilby04.dds\",\n \"gta3.img/missiles_sfs.txd/trilby04.dds\",\"gta3.img/kei_wnchx.txd/trilby04.dds\",\n \"gta_int.img/cooler1.txd/kb_vend1.dds\",\"gta3.img/keypad.txd/kb_vend1.dds\",\n \"gta_int.img/ab_woozieb.txd/otb_numbers.dds\",\"gta3.img/kmb_offdoorx.txd/otb_numbers.dds\",\n \"gta_int.img/gen_offtrackint.txd/otb_numbers.dds\",\"gta3.img/kmb_offdoorx.txd/otb_numbers.dds\",\n \"gta_int.img/gen_offtrackint.txd/otb_rooftile2.dds\",\"gta3.img/kmb_offdoorx.txd/otb_rooftile2.dds\",\n \"gta_int.img/lee_studhall.txd/otb_rooftile2.dds\",\"gta3.img/kmb_offdoorx.txd/otb_rooftile2.dds\",\n \"gta3.img/vgnfirestat.txd/larock256.dds\",\"gta3.img/kmb_rckx.txd/larock256.dds\",\n \"gta_int.img/ab_trukstpd.txd/bow_bar_tabletop_wood.dds\",\"gta3.img/k_pool.txd/bow_bar_tabletop_wood.dds\",\n \"gta_int.img/genintintsex.txd/bow_bar_tabletop_wood.dds\",\"gta3.img/k_pool.txd/bow_bar_tabletop_wood.dds\",\n \"gta_int.img/ab_trukstpd.txd/bow_bar_metal_cabinet.dds\",\"gta3.img/k_pool.txd/bow_bar_metal_cabinet.dds\",\n \"gta_int.img/int_brothelint3.txd/bow_bar_metal_cabinet.dds\",\"gta3.img/k_pool.txd/bow_bar_metal_cabinet.dds\",\n \"gta_int.img/whore_furn.txd/bow_bar_metal_cabinet.dds\",\"gta3.img/k_pool.txd/bow_bar_metal_cabinet.dds\",\n \"gta3.img/sniper.txd/ak47_all.dds\",\"gta3.img/ksnipx.txd/ak47_all.dds\",\n \"gta3.img/vgshpground.txd/vegaspawnwall_128.dds\",\"gta3.img/laconcha.txd/vegaspawnwall_128.dds\",\n \"gta3.img/vgs_shop5.txd/vegaspawnwall_128.dds\",\"gta3.img/laconcha.txd/vegaspawnwall_128.dds\",\n \"gta3.img/lae2coast_alpha.txd/compcourtrail1_m.dds\",\"gta3.img/lae2_alphabits.txd/compcourtrail1_m.dds\",\n \"gta3.img/lngblok_lae2.txd/ja_multisign_lae2.dds\",\"gta3.img/lae2bigblock.txd/ja_multisign_lae2.dds\",\n \"gta3.img/sunrise05_lawn.txd/hollywin03_law.dds\",\"gta3.img/lae2bigblock.txd/hollywin03_law.dds\",\n \"gta3.img/sunrise11_lawn.txd/hillshop1_la.dds\",\"gta3.img/lae2bigblock.txd/hillshop1_la.dds\",\n \"gta3.img/sunst18_lawn.txd/hillshop1_la.dds\",\"gta3.img/lae2bigblock.txd/hillshop1_la.dds\",\n \"gta3.img/lngblok_lae2.txd/hillshop3_la.dds\",\"gta3.img/lae2bigblock.txd/hillshop3_la.dds\",\n \"gta3.img/sunbill_law2.txd/sunbillb03.dds\",\"gta3.img/lae2billboards.txd/sunbillb03.dds\",\n \"gta3.img/wiresetc_las.txd/sunbillb03.dds\",\"gta3.img/lae2billboards.txd/sunbillb03.dds\",\n \"gta3.img/lae2roadscoast.txd/macbrij4_lae.dds\",\"gta3.img/lae2bridge.txd/macbrij4_lae.dds\",\n \"gta3.img/lae2roads.txd/macbrij4_lae.dds\",\"gta3.img/lae2bridge.txd/macbrij4_lae.dds\",\n \"gta3.img/laeroads.txd/macbrij4_lae.dds\",\"gta3.img/lae2bridge.txd/macbrij4_lae.dds\",\n \"gta3.img/stormdrain.txd/macbrij4_lae.dds\",\"gta3.img/lae2bridge.txd/macbrij4_lae.dds\",\n \"gta3.img/lae2roads.txd/newpavement.dds\",\"gta3.img/lae2bridge.txd/newpavement.dds\",\n \"gta3.img/roads_lawn.txd/newpavement.dds\",\"gta3.img/lae2bridge.txd/newpavement.dds\",\n \"gta3.img/sunrise01_lawn.txd/plainglass.dds\",\"gta3.img/lae2coast_alpha.txd/plainglass.dds\",\n \"gta3.img/rodeost01_lax.txd/lashad1.dds\",\"gta3.img/lae2coast_alpha.txd/lashad1.dds\",\n \"gta3.img/sanclifbal1_lax.txd/lashad1.dds\",\"gta3.img/lae2coast_alpha.txd/lashad1.dds\",\n \"gta3.img/sancliff_law2.txd/lashad1.dds\",\"gta3.img/lae2coast_alpha.txd/lashad1.dds\",\n \"gta3.img/sunrise01_lawn.txd/lashad1.dds\",\"gta3.img/lae2coast_alpha.txd/lashad1.dds\",\n \"gta3.img/sunset01_lawn.txd/lashad1.dds\",\"gta3.img/lae2coast_alpha.txd/lashad1.dds\",\n \"gta3.img/sunstr_lawn.txd/lashad1.dds\",\"gta3.img/lae2coast_alpha.txd/lashad1.dds\",\n \"gta_int.img/ganghoos.txd/ab_wall3.dds\",\"gta3.img/lae2fake_int.txd/ab_wall3.dds\",\n \"gta_int.img/rylounge.txd/ab_wall3.dds\",\"gta3.img/lae2fake_int.txd/ab_wall3.dds\",\n \"gta_int.img/lasmall2int2.txd/carpet1kb.dds\",\"gta3.img/lae2fake_int.txd/carpet1kb.dds\",\n \"gta3.img/lanbloki.txd/redcanopything.dds\",\"gta3.img/lae2grnd.txd/redcanopything.dds\",\n \"gta3.img/sunst18_lawn.txd/redcanopything.dds\",\"gta3.img/lae2grnd.txd/redcanopything.dds\",\n \"gta3.img/shopliquor_las.txd/roof11l256.dds\",\"gta3.img/lae2newtempbx.txd/roof11l256.dds\",\n \"gta3.img/skyscrapelawn.txd/roof11l256.dds\",\"gta3.img/lae2newtempbx.txd/roof11l256.dds\",\n \"gta3.img/lasground_las2.txd/sanpedpawn2c.dds\",\"gta3.img/lae2newtempbx.txd/sanpedpawn2c.dds\",\n \"gta3.img/lashops1b_las2.txd/sanpedpawn2c.dds\",\"gta3.img/lae2newtempbx.txd/sanpedpawn2c.dds\",\n \"gta3.img/lashops1_las2.txd/sanpedpawn2c.dds\",\"gta3.img/lae2newtempbx.txd/sanpedpawn2c.dds\",\n \"gta3.img/lashops93_las2.txd/sanpedpawn2c.dds\",\"gta3.img/lae2newtempbx.txd/sanpedpawn2c.dds\",\n \"gta3.img/lasground_las2.txd/sanpedpawn2.dds\",\"gta3.img/lae2newtempbx.txd/sanpedpawn2.dds\",\n \"gta3.img/lashops1b_las2.txd/sanpedpawn2.dds\",\"gta3.img/lae2newtempbx.txd/sanpedpawn2.dds\",\n \"gta3.img/lasground_las2.txd/sanpedpawn1d.dds\",\"gta3.img/lae2newtempbx.txd/sanpedpawn1d.dds\",\n \"gta3.img/lashops1b_las2.txd/sanpedpawn1d.dds\",\"gta3.img/lae2newtempbx.txd/sanpedpawn1d.dds\",\n \"gta3.img/lasground_las2.txd/sanpedpawn1.dds\",\"gta3.img/lae2newtempbx.txd/sanpedpawn1.dds\",\n \"gta3.img/lashops1b_las2.txd/sanpedpawn1.dds\",\"gta3.img/lae2newtempbx.txd/sanpedpawn1.dds\",\n \"gta3.img/lashops93_las2.txd/sjmlashop5.dds\",\"gta3.img/lae2newtempbx.txd/sjmlashop5.dds\",\n \"gta3.img/shopliquor_las.txd/sjmlashop5.dds\",\"gta3.img/lae2newtempbx.txd/sjmlashop5.dds\",\n \"gta3.img/vegastemp1.txd/carlot1.dds\",\"gta3.img/lae2newtempbx.txd/carlot1.dds\",\n \"gta3.img/wasteland_las2.txd/carlot1.dds\",\"gta3.img/lae2newtempbx.txd/carlot1.dds\",\n \"gta3.img/lashops1b_las2.txd/snpedpost1.dds\",\"gta3.img/lae2newtempbx.txd/snpedpost1.dds\",\n \"gta3.img/lashops1b_las2.txd/snpedpost1a.dds\",\"gta3.img/lae2newtempbx.txd/snpedpost1a.dds\",\n \"gta3.img/lashops1b_las2.txd/snpedpost1b.dds\",\"gta3.img/lae2newtempbx.txd/snpedpost1b.dds\",\n \"gta3.img/lashops1b_las2.txd/asanpdshpsh1.dds\",\"gta3.img/lae2newtempbx.txd/asanpdshpsh1.dds\",\n \"gta3.img/lahillsroadscoast.txd/laroad_centre1.dds\",\"gta3.img/lae2roadscoast.txd/laroad_centre1.dds\",\n \"gta3.img/lanroad.txd/laroad_centre1.dds\",\"gta3.img/lae2roadscoast.txd/laroad_centre1.dds\",\n \"gta3.img/roads_lahills.txd/laroad_centre1.dds\",\"gta3.img/lae2roadscoast.txd/laroad_centre1.dds\",\n \"gta3.img/roads_lawn.txd/laroad_centre1.dds\",\"gta3.img/lae2roadscoast.txd/laroad_centre1.dds\",\n \"gta_int.img/stad_tag.txd/was_scrpyd_wall_in_hngr.dds\",\"gta3.img/lae2roadscoast.txd/was_scrpyd_wall_in_hngr.dds\",\n \"gta3.img/mullho03a_lahills.txd/stonewalls1_la.dds\",\"gta3.img/lae2roadscoast.txd/stonewalls1_la.dds\",\n \"gta3.img/miragecasino2.txd/concretedust2_256128.dds\",\"gta3.img/lae2roadscoast.txd/concretedust2_256128.dds\",\n \"gta3.img/vgnland.txd/concretedust2_256128.dds\",\"gta3.img/lae2roadscoast.txd/concretedust2_256128.dds\",\n \"gta3.img/vgnretail2.txd/concretedust2_256128.dds\",\"gta3.img/lae2roadscoast.txd/concretedust2_256128.dds\",\n \"gta3.img/vgs_shops.txd/concretedust2_256128.dds\",\"gta3.img/lae2roadscoast.txd/concretedust2_256128.dds\",\n \"gta3.img/vgwestcoast.txd/concretedust2_256128.dds\",\"gta3.img/lae2roadscoast.txd/concretedust2_256128.dds\",\n \"gta3.img/vgwestland2.txd/concretedust2_256128.dds\",\"gta3.img/lae2roadscoast.txd/concretedust2_256128.dds\",\n \"gta3.img/vgwestland.txd/concretedust2_256128.dds\",\"gta3.img/lae2roadscoast.txd/concretedust2_256128.dds\",\n \"gta3.img/landhub.txd/sidewgrass_fuked.dds\",\"gta3.img/lae2roadshub.txd/sidewgrass_fuked.dds\",\n \"gta3.img/templae2land.txd/sidewgrass5.dds\",\"gta3.img/lae2roadshub.txd/sidewgrass5.dds\",\n \"gta3.img/landlae2.txd/grass_concpath2.dds\",\"gta3.img/lae2roadshub.txd/grass_concpath2.dds\",\n \"gta3.img/laeroads2s.txd/trainground1.dds\",\"gta3.img/lae2roadshub.txd/trainground1.dds\",\n \"gta3.img/lae2roads.txd/grassdry_path_128hv.dds\",\"gta3.img/lae2roadshub.txd/grassdry_path_128hv.dds\",\n \"gta3.img/landlae2.txd/grassdry_path_128hv.dds\",\"gta3.img/lae2roadshub.txd/grassdry_path_128hv.dds\",\n \"gta3.img/laeroads2s.txd/macbrij2_lae.dds\",\"gta3.img/lae2roads.txd/macbrij2_lae.dds\",\n \"gta3.img/laeroads.txd/macbrij2_lae.dds\",\"gta3.img/lae2roads.txd/macbrij2_lae.dds\",\n \"gta3.img/piera_law2.txd/macbrij2_lae.dds\",\"gta3.img/lae2roads.txd/macbrij2_lae.dds\",\n \"gta3.img/pierc_law2.txd/macbrij2_lae.dds\",\"gta3.img/lae2roads.txd/macbrij2_lae.dds\",\n \"gta3.img/stormdrain.txd/macbrij2_lae.dds\",\"gta3.img/lae2roads.txd/macbrij2_lae.dds\",\n \"gta3.img/landlae2b.txd/craproad3_lae.dds\",\"gta3.img/lae2roads.txd/craproad3_lae.dds\",\n \"gta3.img/stormdrain.txd/craproad3_lae.dds\",\"gta3.img/lae2roads.txd/craproad3_lae.dds\",\n \"gta3.img/motelalpha.txd/compfence2_lae.dds\",\"gta3.img/laealpha.txd/compfence2_lae.dds\",\n \"gta3.img/lod2lae1.txd/ads003=copylod.dds\",\"gta3.img/laeast2_lod.txd/ads003=copylod.dds\",\n \"gta3.img/lodlawnsmall.txd/ads003=copylod.dds\",\"gta3.img/laeast2_lod.txd/ads003=copylod.dds\",\n \"gta3.img/laeast2_lod.txd/dritkb64_lod.dds\",\"gta3.img/laeast2_lod.txd/dirtkb_64hv_lod.dds\",\n \"gta3.img/lodlawnsmall.txd/coastapt2_lod.dds\",\"gta3.img/laeast2_lod.txd/coastapt2_lod.dds\",\n \"gta3.img/lodlawnsmall.txd/hospunder_lod.dds\",\"gta3.img/laeast2_lod.txd/hospunder_lod.dds\",\n \"gta3.img/lodlawnsmall.txd/coastapt_lod.dds\",\"gta3.img/laeast2_lod.txd/coastapt_lod.dds\",\n \"gta3.img/lod3_las.txd/indund_lod.dds\",\"gta3.img/laeast2_lod.txd/indund_lod.dds\",\n \"gta3.img/vegasnlod1.txd/indund_lod.dds\",\"gta3.img/laeast2_lod.txd/indund_lod.dds\",\n \"gta3.img/vegasnlod4.txd/indund_lod.dds\",\"gta3.img/laeast2_lod.txd/indund_lod.dds\",\n \"gta3.img/lawnlodbig.txd/desgrassbrn_lod.dds\",\"gta3.img/laeast2_lod.txd/desgrassbrn_lod.dds\",\n \"gta3.img/lod2lae1.txd/desgrassbrn_lod.dds\",\"gta3.img/laeast2_lod.txd/desgrassbrn_lod.dds\",\n \"gta3.img/lodlawnsmall.txd/desgrassbrn_lod.dds\",\"gta3.img/laeast2_lod.txd/desgrassbrn_lod.dds\",\n \"gta3.img/lodvgsslod02.txd/desgrassbrn_lod.dds\",\"gta3.img/laeast2_lod.txd/desgrassbrn_lod.dds\",\n \"gta3.img/vegaselod1.txd/desgrassbrn_lod.dds\",\"gta3.img/laeast2_lod.txd/desgrassbrn_lod.dds\",\n \"gta3.img/vegaselod3.txd/desgrassbrn_lod.dds\",\"gta3.img/laeast2_lod.txd/desgrassbrn_lod.dds\",\n \"gta3.img/vegasnlod1.txd/desgrassbrn_lod.dds\",\"gta3.img/laeast2_lod.txd/desgrassbrn_lod.dds\",\n \"gta3.img/vegasnlod4.txd/desgrassbrn_lod.dds\",\"gta3.img/laeast2_lod.txd/desgrassbrn_lod.dds\",\n \"gta3.img/lanlod.txd/grasstype7_lod.dds\",\"gta3.img/laeast2_lod.txd/grasstype7_lod.dds\",\n \"gta3.img/lod_lan2.txd/grasstype7_lod.dds\",\"gta3.img/laeast2_lod.txd/grasstype7_lod.dds\",\n \"gta3.img/vegaselod1.txd/grasstype7_lod.dds\",\"gta3.img/laeast2_lod.txd/grasstype7_lod.dds\",\n \"gta3.img/lod_dem_sfxrf.txd/lod_concretenewb256.dds\",\"gta3.img/laeast2_lod.txd/lod_concretenewb256.dds\",\n \"gta3.img/lodlawnsmall.txd/lod_concretenewb256.dds\",\"gta3.img/laeast2_lod.txd/lod_concretenewb256.dds\",\n \"gta3.img/lod_mount_sfs.txd/lod_concretenewb256.dds\",\"gta3.img/laeast2_lod.txd/lod_concretenewb256.dds\",\n \"gta3.img/lod_sfs2.txd/lod_concretenewb256.dds\",\"gta3.img/laeast2_lod.txd/lod_concretenewb256.dds\",\n \"gta3.img/lod_sfs3.txd/lod_concretenewb256.dds\",\"gta3.img/laeast2_lod.txd/lod_concretenewb256.dds\",\n \"gta3.img/lod_sfs4.txd/lod_concretenewb256.dds\",\"gta3.img/laeast2_lod.txd/lod_concretenewb256.dds\",\n \"gta3.img/lod_sfse2.txd/lod_concretenewb256.dds\",\"gta3.img/laeast2_lod.txd/lod_concretenewb256.dds\",\n \"gta3.img/lod_sfse3.txd/lod_concretenewb256.dds\",\"gta3.img/laeast2_lod.txd/lod_concretenewb256.dds\",\n \"gta3.img/lod_sfse.txd/lod_concretenewb256.dds\",\"gta3.img/laeast2_lod.txd/lod_concretenewb256.dds\",\n \"gta3.img/lawnlodbig.txd/sjmloda991.dds\",\"gta3.img/laeast2_lod.txd/sjmloda991.dds\",\n \"gta3.img/lod2lae1.txd/sjmloda991.dds\",\"gta3.img/laeast2_lod.txd/sjmloda991.dds\",\n \"gta3.img/lod2_las.txd/sjmloda991.dds\",\"gta3.img/laeast2_lod.txd/sjmloda991.dds\",\n \"gta3.img/lod3_las.txd/sjmloda991.dds\",\"gta3.img/laeast2_lod.txd/sjmloda991.dds\",\n \"gta3.img/lod_las2.txd/sjmloda991.dds\",\"gta3.img/laeast2_lod.txd/sjmloda991.dds\",\n \"gta3.img/lodlawnsmall.txd/sjmloda991.dds\",\"gta3.img/laeast2_lod.txd/sjmloda991.dds\",\n \"gta3.img/laeast2_lod.txd/freewaylae2_lod.dds\",\"gta3.img/laeast2_lod.txd/freeway_lod.dds\",\n \"gta3.img/lod_las2.txd/freeway_lod.dds\",\"gta3.img/laeast2_lod.txd/freeway_lod.dds\",\n \"gta3.img/lod2_las.txd/sjmlodd5.dds\",\"gta3.img/laeast2_lod.txd/sjmlodd5.dds\",\n \"gta3.img/lod_cn2_stown.txd/clukinbell2_lod.dds\",\"gta3.img/laeast2_lod.txd/clukinbell2_lod.dds\",\n \"gta3.img/lod_las2.txd/clukinbell2_lod.dds\",\"gta3.img/laeast2_lod.txd/clukinbell2_lod.dds\",\n \"gta3.img/lod_cn2_stown.txd/clukinbell1_lod.dds\",\"gta3.img/laeast2_lod.txd/clukinbell1_lod.dds\",\n \"gta3.img/lod_las2.txd/clukinbell1_lod.dds\",\"gta3.img/laeast2_lod.txd/clukinbell1_lod.dds\",\n \"gta3.img/lawnlodbig.txd/carpark1_lod.dds\",\"gta3.img/laeast2_lod.txd/carpark1_lod.dds\",\n \"gta3.img/lod2lae1.txd/carpark1_lod.dds\",\"gta3.img/laeast2_lod.txd/carpark1_lod.dds\",\n \"gta3.img/lod_countn2.txd/carpark1_lod.dds\",\"gta3.img/laeast2_lod.txd/carpark1_lod.dds\",\n \"gta3.img/lod_cxrf.txd/carpark1_lod.dds\",\"gta3.img/laeast2_lod.txd/carpark1_lod.dds\",\n \"gta3.img/lodvgsslod.txd/carpark1_lod.dds\",\"gta3.img/laeast2_lod.txd/carpark1_lod.dds\",\n \"gta3.img/vegaselod1.txd/carpark1_lod.dds\",\"gta3.img/laeast2_lod.txd/carpark1_lod.dds\",\n \"gta3.img/lodlawnsmall.txd/tarmacplain_lod.dds\",\"gta3.img/laeast2_lod.txd/tarmacplain_lod.dds\",\n \"gta3.img/lod_laxrf.txd/tarmacplain_lod.dds\",\"gta3.img/laeast2_lod.txd/tarmacplain_lod.dds\",\n \"gta3.img/lodvgsslod.txd/block_lod.dds\",\"gta3.img/laeast2_lod.txd/block_lod.dds\",\n \"gta3.img/lodlawnsmall.txd/corclawn_lod.dds\",\"gta3.img/laeast2_lod.txd/corclawn_lod.dds\",\n \"gta3.img/lahills_lod.txd/laroadscentre1_lod.dds\",\"gta3.img/laeast2_lod.txd/laroadscentre1_lod.dds\",\n \"gta3.img/lahillsa_lod.txd/lhroadlod.dds\",\"gta3.img/laeast2_lod.txd/lhroadlod.dds\",\n \"gta3.img/lod2lae1.txd/lhroadlod.dds\",\"gta3.img/laeast2_lod.txd/lhroadlod.dds\",\n \"gta3.img/lod_lan2.txd/lhroadlod.dds\",\"gta3.img/laeast2_lod.txd/lhroadlod.dds\",\n \"gta3.img/lod_las2.txd/lhroadlod.dds\",\"gta3.img/laeast2_lod.txd/lhroadlod.dds\",\n \"gta3.img/lodlawnsmall.txd/lhroadlod.dds\",\"gta3.img/laeast2_lod.txd/lhroadlod.dds\",\n \"gta3.img/lod_sfse3.txd/lhroadlod.dds\",\"gta3.img/laeast2_lod.txd/lhroadlod.dds\",\n \"gta3.img/lod_sfse.txd/lhroadlod.dds\",\"gta3.img/laeast2_lod.txd/lhroadlod.dds\",\n \"gta3.img/lahills_lod.txd/pinkpavroadlod.dds\",\"gta3.img/laeast2_lod.txd/pinkpavroadlod.dds\",\n \"gta3.img/lod_sfse2.txd/pinkpavroadlod.dds\",\"gta3.img/laeast2_lod.txd/pinkpavroadlod.dds\",\n \"gta3.img/lod_sfse3.txd/pinkpavroadlod.dds\",\"gta3.img/laeast2_lod.txd/pinkpavroadlod.dds\",\n \"gta3.img/lod_las2.txd/pawnshp_lod.dds\",\"gta3.img/laeast2_lod.txd/pawnshp_lod.dds\",\n \"gta3.img/lawnlodbig.txd/grasslod.dds\",\"gta3.img/laeast2_lod.txd/sjmloda994.dds\",\n \"gta3.img/lod2lae1.txd/grasslod.dds\",\"gta3.img/laeast2_lod.txd/sjmloda994.dds\",\n \"gta3.img/lod3_las.txd/grasslod.dds\",\"gta3.img/laeast2_lod.txd/sjmloda994.dds\",\n \"gta3.img/lod3_las.txd/sjmloda994.dds\",\"gta3.img/laeast2_lod.txd/sjmloda994.dds\",\n \"gta3.img/lod_a_law.txd/grasslod.dds\",\"gta3.img/laeast2_lod.txd/sjmloda994.dds\",\n \"gta3.img/lod_a_law.txd/sjmloda994.dds\",\"gta3.img/laeast2_lod.txd/sjmloda994.dds\",\n \"gta3.img/lodlawnsmall.txd/grasslod.dds\",\"gta3.img/laeast2_lod.txd/sjmloda994.dds\",\n \"gta3.img/lod_sfse2.txd/grasslod.dds\",\"gta3.img/laeast2_lod.txd/sjmloda994.dds\",\n \"gta3.img/lod_sfse3.txd/grasslod.dds\",\"gta3.img/laeast2_lod.txd/sjmloda994.dds\",\n \"gta3.img/lodvegaswest2.txd/grasslod.dds\",\"gta3.img/laeast2_lod.txd/sjmloda994.dds\",\n \"gta3.img/vegaselod2.txd/grasslod.dds\",\"gta3.img/laeast2_lod.txd/sjmloda994.dds\",\n \"gta3.img/lod_las2.txd/stormdrain_lod.dds\",\"gta3.img/laeast2_lod.txd/stormdrain_lod.dds\",\n \"gta3.img/lod_las2.txd/projhoos_lod.dds\",\"gta3.img/laeast2_lodx.txd/projhoos_lod.dds\",\n \"gta3.img/vgsehighways.txd/hiwaymidlle_256.dds\",\"gta3.img/laeroads.txd/hiwaymidlle_256.dds\",\n \"gta3.img/vgsnhighway.txd/hiwaymidlle_256.dds\",\"gta3.img/laeroads.txd/hiwaymidlle_256.dds\",\n \"gta3.img/vgsshiways.txd/hiwaymidlle_256.dds\",\"gta3.img/laeroads.txd/hiwaymidlle_256.dds\",\n \"gta3.img/vgwsthiway1.txd/hiwaymidlle_256.dds\",\"gta3.img/laeroads.txd/hiwaymidlle_256.dds\",\n \"gta3.img/lodvegaswest2.txd/concretewall22_lod.dds\",\"gta3.img/lahillsa_lod.txd/concretewall22_lod.dds\",\n \"gta3.img/lodvgsslod02.txd/concretewall22_lod.dds\",\"gta3.img/lahillsa_lod.txd/concretewall22_lod.dds\",\n \"gta3.img/lodvgwstcoast.txd/concretewall22_lod.dds\",\"gta3.img/lahillsa_lod.txd/concretewall22_lod.dds\",\n \"gta3.img/vegaselod3.txd/concretewall22_lod.dds\",\"gta3.img/lahillsa_lod.txd/concretewall22_lod.dds\",\n \"gta3.img/vegasnlod3.txd/concretewall22_lod.dds\",\"gta3.img/lahillsa_lod.txd/concretewall22_lod.dds\",\n \"gta3.img/lahillsa_lodw.txd/stonewall3_lalod.dds\",\"gta3.img/lahillsa_lod.txd/stonewall3_lalod.dds\",\n \"gta3.img/lahills_lod.txd/pavetilealleylod.dds\",\"gta3.img/lahillsa_lod.txd/pavetilealleylod.dds\",\n \"gta3.img/lahillsa_lodw.txd/stormdrain5_ntlod.dds\",\"gta3.img/lahillsa_lod.txd/stormdrain5_ntlod.dds\",\n \"gta3.img/lahills_lod.txd/stormdrain5_ntlod.dds\",\"gta3.img/lahillsa_lod.txd/stormdrain5_ntlod.dds\",\n \"gta3.img/lod_countryn.txd/stormdrain5_ntlod.dds\",\"gta3.img/lahillsa_lod.txd/stormdrain5_ntlod.dds\",\n \"gta3.img/lod2_las.txd/sjmloda992.dds\",\"gta3.img/lahillsa_lod.txd/sjmloda992.dds\",\n \"gta3.img/lod3_las.txd/sjmloda992.dds\",\"gta3.img/lahillsa_lod.txd/sjmloda992.dds\",\n \"gta3.img/lod_las2.txd/sjmloda992.dds\",\"gta3.img/lahillsa_lod.txd/sjmloda992.dds\",\n \"gta3.img/lahillsa_lodw.txd/crazypavelod.dds\",\"gta3.img/lahillsa_lod.txd/crazypavelod.dds\",\n \"gta3.img/lahillsa_lodw.txd/bevr03b_lawlod.dds\",\"gta3.img/lahillsa_lod.txd/bevr03b_lawlod.dds\",\n \"gta3.img/lahillsa_lodw.txd/grass_128hvlod.dds\",\"gta3.img/lahillsa_lod.txd/grass_128hvlod.dds\",\n \"gta3.img/lahillsa_lodw.txd/adetalod.dds\",\"gta3.img/lahillsa_lod.txd/adetalod.dds\",\n \"gta3.img/lahillsa_lodw.txd/aamanbev96xlod.dds\",\"gta3.img/lahillsa_lod.txd/aamanbev96xlod.dds\",\n \"gta3.img/lahillsa_lodw.txd/stilthouse3lod.dds\",\"gta3.img/lahillsa_lod.txd/stilthouse3lod.dds\",\n \"gta3.img/lahillsa_lodw.txd/vgsroad01_lod.dds\",\"gta3.img/lahillsa_lod.txd/vgsroad01_lod.dds\",\n \"gta3.img/lodvegaswest1.txd/vgsroad01_lod.dds\",\"gta3.img/lahillsa_lod.txd/vgsroad01_lod.dds\",\n \"gta3.img/lodvgsslod01.txd/vgsroad01_lod.dds\",\"gta3.img/lahillsa_lod.txd/vgsroad01_lod.dds\",\n \"gta3.img/lodvgsslod02.txd/vgsroad01_lod.dds\",\"gta3.img/lahillsa_lod.txd/vgsroad01_lod.dds\",\n \"gta3.img/lodvgsslod.txd/vgsroad01_lod.dds\",\"gta3.img/lahillsa_lod.txd/vgsroad01_lod.dds\",\n \"gta3.img/lodvgswestout.txd/vgsroad01_lod.dds\",\"gta3.img/lahillsa_lod.txd/vgsroad01_lod.dds\",\n \"gta3.img/vegaselod1.txd/vgsroad01_lod.dds\",\"gta3.img/lahillsa_lod.txd/vgsroad01_lod.dds\",\n \"gta3.img/vegaselod2.txd/vgsroad01_lod.dds\",\"gta3.img/lahillsa_lod.txd/vgsroad01_lod.dds\",\n \"gta3.img/vegaselod3.txd/vgsroad01_lod.dds\",\"gta3.img/lahillsa_lod.txd/vgsroad01_lod.dds\",\n \"gta3.img/vegasnlod1.txd/vgsroad01_lod.dds\",\"gta3.img/lahillsa_lod.txd/vgsroad01_lod.dds\",\n \"gta3.img/vegasnlod2.txd/vgsroad01_lod.dds\",\"gta3.img/lahillsa_lod.txd/vgsroad01_lod.dds\",\n \"gta3.img/vegasnlod4.txd/vgsroad01_lod.dds\",\"gta3.img/lahillsa_lod.txd/vgsroad01_lod.dds\",\n \"gta3.img/lahills_lod.txd/tar_1linex2lod.dds\",\"gta3.img/lahillsa_lod.txd/tar_1linex2lod.dds\",\n \"gta3.img/lahillsa_lodw.txd/snpedtest1x2.dds\",\"gta3.img/lahillsa_lod.txd/snpedtest1x2.dds\",\n \"gta3.img/lod_sfse.txd/concpanel_lalod.dds\",\"gta3.img/lahillsa_lod.txd/concpanel_lalod.dds\",\n \"gta3.img/lahillsa_lodw.txd/bevpoollod.dds\",\"gta3.img/lahillsa_lod.txd/bevpoollod.dds\",\n \"gta3.img/lahillsa_lodw.txd/hedge2lod.dds\",\"gta3.img/lahillsa_lod.txd/hedge2lod.dds\",\n \"gta3.img/lod_countryn.txd/rocktbrn128blndlitlod.dds\",\"gta3.img/lahillsa_lod.txd/rocktbrn128blndlitlod.dds\",\n \"gta3.img/lahooslod.txd/stilthouse1lod.dds\",\"gta3.img/lahillsa_lodw.txd/stilthouse1lod.dds\",\n \"gta3.img/welod_law2.txd/cobbles_kb_256lod.dds\",\"gta3.img/lahillsa_lodw.txd/cobbles_kb_256lod.dds\",\n \"gta3.img/richman02_lahills.txd/bevpool.dds\",\"gta3.img/lahillsgrounds.txd/bevpool.dds\",\n \"gta3.img/santamonhus1.txd/bevpool.dds\",\"gta3.img/lahillsgrounds.txd/bevpool.dds\",\n \"gta3.img/richman02_lahills.txd/bevr03b_law.dds\",\"gta3.img/lahillsgrounds.txd/bevr03b_law.dds\",\n \"gta3.img/oc_flats_gnd_sfs.txd/veg_hedge1_256.dds\",\"gta3.img/lahillshilhs1e.txd/veg_hedge1_256.dds\",\n \"gta3.img/sfn_apart02sfn.txd/veg_hedge1_256.dds\",\"gta3.img/lahillshilhs1e.txd/veg_hedge1_256.dds\",\n \"gta3.img/vegashse4.txd/veg_hedge1_256.dds\",\"gta3.img/lahillshilhs1e.txd/veg_hedge1_256.dds\",\n \"gta3.img/vegashse5.txd/veg_hedge1_256.dds\",\"gta3.img/lahillshilhs1e.txd/veg_hedge1_256.dds\",\n \"gta3.img/vegashse6.txd/veg_hedge1_256.dds\",\"gta3.img/lahillshilhs1e.txd/veg_hedge1_256.dds\",\n \"gta3.img/vegirlfr01.txd/veg_hedge1_256.dds\",\"gta3.img/lahillshilhs1e.txd/veg_hedge1_256.dds\",\n \"gta3.img/vgnboiga1.txd/veg_hedge1_256.dds\",\"gta3.img/lahillshilhs1e.txd/veg_hedge1_256.dds\",\n \"gta3.img/vgncorp1.txd/veg_hedge1_256.dds\",\"gta3.img/lahillshilhs1e.txd/veg_hedge1_256.dds\",\n \"gta3.img/vgnpwroutbld1.txd/veg_hedge1_256.dds\",\"gta3.img/lahillshilhs1e.txd/veg_hedge1_256.dds\",\n \"gta3.img/vgnshopnmall.txd/veg_hedge1_256.dds\",\"gta3.img/lahillshilhs1e.txd/veg_hedge1_256.dds\",\n \"gta3.img/vgnvrock.txd/veg_hedge1_256.dds\",\"gta3.img/lahillshilhs1e.txd/veg_hedge1_256.dds\",\n \"gta3.img/vgsswarehse01.txd/veg_hedge1_256.dds\",\"gta3.img/lahillshilhs1e.txd/veg_hedge1_256.dds\",\n \"gta3.img/vgwestland.txd/veg_hedge1_256.dds\",\"gta3.img/lahillshilhs1e.txd/veg_hedge1_256.dds\",\n \"gta_int.img/bikeskool.txd/door_pan1_64_128.dds\",\"gta3.img/lahills_safe1.txd/door_pan1_64_128.dds\",\n \"gta_int.img/crlsbits.txd/door_pan1_64_128.dds\",\"gta3.img/lahills_safe1.txd/door_pan1_64_128.dds\",\n \"gta_int.img/estate2.txd/door_pan1_64_128.dds\",\"gta3.img/lahills_safe1.txd/door_pan1_64_128.dds\",\n \"gta_int.img/genintrestrest1.txd/door_pan1_64_128.dds\",\"gta3.img/lahills_safe1.txd/door_pan1_64_128.dds\",\n \"gta_int.img/int_tatoo.txd/door_pan1_64_128.dds\",\"gta3.img/lahills_safe1.txd/door_pan1_64_128.dds\",\n \"gta_int.img/bikeskool.txd/dor_slider_16_32b.dds\",\"gta3.img/lahills_safe1.txd/dor_slider_16_32b.dds\",\n \"gta3.img/tcenewhillhus02.txd/glasswindow2_256.dds\",\"gta3.img/lahillstxd1a.txd/glasswindow2_256.dds\",\n \"gta3.img/vgndwntwn5.txd/glasswindow2_256.dds\",\"gta3.img/lahillstxd1a.txd/glasswindow2_256.dds\",\n \"gta_int.img/destructo.txd/exploder1.dds\",\"gta3.img/lahills_whisky.txd/exploder1.dds\",\n \"gta_int.img/stadstunt.txd/exploder1.dds\",\"gta3.img/lahills_whisky.txd/exploder1.dds\",\n \"gta_int.img/sumostands.txd/exploder1.dds\",\"gta3.img/lahills_whisky.txd/exploder1.dds\",\n \"gta3.img/lanblokb.txd/discharger.dds\",\"gta3.img/lahills_whisky.txd/discharger.dds\",\n \"gta3.img/landlae2b.txd/scumtiles2_lae.dds\",\"gta3.img/lahills_wiresnshit3.txd/scumtiles2_lae.dds\",\n \"gta3.img/sw_library.txd/sjmornfnce.dds\",\"gta3.img/lahills_wiresnshit3.txd/sjmornfnce.dds\",\n \"gta3.img/skyscr1_lan2.txd/gm_labuld2_a.dds\",\"gta3.img/laland1_lan2.txd/gm_labuld2_a.dds\",\n \"gta3.img/sw_office.txd/gm_labuld2_a.dds\",\"gta3.img/laland1_lan2.txd/gm_labuld2_a.dds\",\n \"gta3.img/theatrelan2.txd/gm_labuld2_a.dds\",\"gta3.img/laland1_lan2.txd/gm_labuld2_a.dds\",\n \"gta3.img/stolenbuild03.txd/sl_blokpave2.dds\",\"gta3.img/laland1_lan2.txd/sl_blokpave2.dds\",\n \"gta3.img/lanblokb2.txd/sl_dwntwndecor1.dds\",\"gta3.img/lanbloka.txd/sl_dwntwndecor1.dds\",\n \"gta3.img/lanblokb.txd/sl_dwntwndecor1.dds\",\"gta3.img/lanbloka.txd/sl_dwntwndecor1.dds\",\n \"gta3.img/vgndwntwn21.txd/newall4-1.dds\",\"gta3.img/lanbloka.txd/newall4-1.dds\",\n \"gta3.img/wasteland_las2.txd/newall4-1.dds\",\"gta3.img/lanbloka.txd/newall4-1.dds\",\n \"gta3.img/lanblokb.txd/sl_rotnbrikwin1.dds\",\"gta3.img/lanblokb2.txd/sl_rotnbrikwin1.dds\",\n \"gta3.img/lanblokb.txd/sl_rotnbrikvent.dds\",\"gta3.img/lanblokb2.txd/sl_rotnbrikvent.dds\",\n \"gta3.img/shops01_law.txd/deptstore2_lan.dds\",\"gta3.img/lanblokd.txd/deptstore2_lan.dds\",\n \"gta3.img/sancliff_law2.txd/decobuild2b_lan.dds\",\"gta3.img/lanblokd.txd/decobuild2b_lan.dds\",\n \"gta3.img/sunst18_lawn.txd/decobuild2b_lan.dds\",\"gta3.img/lanblokd.txd/decobuild2b_lan.dds\",\n \"gta3.img/melrose13_lawn.txd/decobuild2_lan.dds\",\"gta3.img/lanblokd.txd/decobuild2_lan.dds\",\n \"gta3.img/sancliff_law2.txd/decobuild2_lan.dds\",\"gta3.img/lanblokd.txd/decobuild2_lan.dds\",\n \"gta3.img/union_las.txd/lasunion95.dds\",\"gta3.img/lanbloke.txd/lasunion95.dds\",\n \"gta3.img/ottos_sfw.txd/ottos_sfe.dds\",\"gta3.img/lanbloke.txd/ottos_sfe.dds\",\n \"gta_int.img/genintintpoliceb.txd/p_floor3.dds\",\"gta3.img/lanbloke.txd/p_floor3.dds\",\n \"gta_int.img/traidman.txd/darkgrey_carpet_256.dds\",\"gta3.img/lanbloke.txd/p_floor3.dds\",\n \"gta3.img/ufo_barbakroom.txd/filing_cabnu.dds\",\"gta3.img/lanbloke.txd/filing_cabnu.dds\",\n \"gta_int.img/genintintpolicea.txd/filing_cabnu.dds\",\"gta3.img/lanbloke.txd/filing_cabnu.dds\",\n \"gta_int.img/mp_policesf.txd/filing_cabnu.dds\",\"gta3.img/lanbloke.txd/filing_cabnu.dds\",\n \"gta_int.img/nu_filing.txd/filing_cabnu.dds\",\"gta3.img/lanbloke.txd/filing_cabnu.dds\",\n \"gta3.img/sunst18_lawn.txd/bookwindowshigh.dds\",\"gta3.img/lanbloki.txd/bookwindowshigh.dds\",\n \"gta3.img/station_sfse.txd/ws_sandstone2b.dds\",\"gta3.img/lanbloki.txd/ws_sandstone2b.dds\",\n \"gta3.img/sw_fact02.txd/ws_sandstone2b.dds\",\"gta3.img/lanbloki.txd/ws_sandstone2b.dds\",\n \"gta3.img/vegashse2.txd/ws_sandstone2b.dds\",\"gta3.img/lanbloki.txd/ws_sandstone2b.dds\",\n \"gta3.img/vgwestland.txd/ws_sandstone2b.dds\",\"gta3.img/lanbloki.txd/ws_sandstone2b.dds\",\n \"gta3.img/plaza1_lan2.txd/greytile_la.dds\",\"gta3.img/lanbloki.txd/greytile_la.dds\",\n \"gta3.img/vgnvrock.txd/yardgrass2.dds\",\"gta3.img/landhub.txd/yardgrass2.dds\",\n \"gta3.img/landlae2c.txd/grasspave256.dds\",\"gta3.img/landhub.txd/grasspave256.dds\",\n \"gta3.img/landlae2c.txd/grasspatch_64hv.dds\",\"gta3.img/landhub.txd/grasspatch_64hv.dds\",\n \"gta3.img/lashops93_las2.txd/grasspatch_64hv.dds\",\"gta3.img/landhub.txd/grasspatch_64hv.dds\",\n \"gta3.img/macpark1tr_lae.txd/roughwall_kb_semless.dds\",\"gta3.img/landlae2c.txd/roughwall_kb_semless.dds\",\n \"gta3.img/lasground_las2.txd/basketballcourt1.dds\",\"gta3.img/landlae2e.txd/basketballcourt1.dds\",\n \"gta3.img/sw_block11a.txd/gb_nastybar20.dds\",\"gta3.img/landsfe.txd/gb_nastybar20.dds\",\n \"gta3.img/vegasdwntwn1.txd/gb_nastybar20.dds\",\"gta3.img/landsfe.txd/gb_nastybar20.dds\",\n \"gta3.img/vgsshospshop.txd/gb_nastybar20.dds\",\"gta3.img/landsfe.txd/gb_nastybar20.dds\",\n \"gta3.img/tvstudio_law2.txd/barbwire1.dds\",\"gta3.img/lanfireesc_tr.txd/barbwire1.dds\",\n \"gta3.img/vgncoast.txd/sl_metalwalk.dds\",\"gta3.img/lanfireesc_tr.txd/sl_metalwalk.dds\",\n \"gta3.img/vgnpwroutbld2.txd/sl_metalwalk.dds\",\"gta3.img/lanfireesc_tr.txd/sl_metalwalk.dds\",\n \"gta3.img/vgspumphse.txd/sl_metalwalk.dds\",\"gta3.img/lanfireesc_tr.txd/sl_metalwalk.dds\",\n \"gta3.img/parktunnel_sfs.txd/sl_metaledge.dds\",\"gta3.img/lanfireesc_tr.txd/sl_metaledge.dds\",\n \"gta3.img/subpen1_sfse.txd/sl_metaledge.dds\",\"gta3.img/lanfireesc_tr.txd/sl_metaledge.dds\",\n \"gta3.img/stolenbuild01.txd/sl_plazatile02.dds\",\"gta3.img/lanlacmab_lan2.txd/sl_plazatile02.dds\",\n \"gta3.img/tempstuff_lae.txd/sl_plazatile02.dds\",\"gta3.img/lanlacmab_lan2.txd/sl_plazatile02.dds\",\n \"gta3.img/lanlacma_lan2.txd/sl_stapldoor1.dds\",\"gta3.img/lanlacmab_lan2.txd/sl_stapldoor1.dds\",\n \"gta3.img/skyscrap3_lan2.txd/sl_stapldoor1.dds\",\"gta3.img/lanlacmab_lan2.txd/sl_stapldoor1.dds\",\n \"gta3.img/skyscrapelan2.txd/sl_stapldoor1.dds\",\"gta3.img/lanlacmab_lan2.txd/sl_stapldoor1.dds\",\n \"gta3.img/lanlacma_lan2.txd/lasbrwnhus3.dds\",\"gta3.img/lanlacmab_lan2.txd/lasbrwnhus3.dds\",\n \"gta3.img/lanlacma_lan2.txd/sl_galleryplaza1.dds\",\"gta3.img/lanlacmab_lan2.txd/sl_galleryplaza1.dds\",\n \"gta3.img/lanlacma_lan2.txd/sl_gallerywall1.dds\",\"gta3.img/lanlacmab_lan2.txd/sl_gallerywall1.dds\",\n \"gta_int.img/svcunthoose.txd/sl_gallerywall1.dds\",\"gta3.img/lanlacmab_lan2.txd/sl_gallerywall1.dds\",\n \"gta3.img/lanlacma_lan2.txd/laslacma9.dds\",\"gta3.img/lanlacmab_lan2.txd/laslacma9.dds\",\n \"gta3.img/lanlacma_lan2.txd/sjmmetrail.dds\",\"gta3.img/lanlacmab_lan2.txd/sjmmetrail.dds\",\n \"gta3.img/lod2lae1.txd/cokopops_1lod.dds\",\"gta3.img/lanlod.txd/cokopops_1lod.dds\",\n \"gta3.img/lodlawnsmall.txd/lanlodbuild36.dds\",\"gta3.img/lanlod.txd/lanlodbuild36.dds\",\n \"gta3.img/lod_las2.txd/las2_dirtlod.dds\",\"gta3.img/lanlod.txd/las2_dirtlod.dds\",\n \"gta3.img/lod_lan2.txd/lanlodblokwall1.dds\",\"gta3.img/lanlod.txd/lanlodblokwall1.dds\",\n \"gta3.img/lodhuge_lan2.txd/lanlodblokwall1.dds\",\"gta3.img/lanlod.txd/lanlodblokwall1.dds\",\n \"gta3.img/lod_las2.txd/lanlodblokwall1.dds\",\"gta3.img/lanlod.txd/lanlodblokwall1.dds\",\n \"gta3.img/lod2_las.txd/sjmlas2lod5n.dds\",\"gta3.img/lanlod.txd/sjmlas2lod5n.dds\",\n \"gta3.img/lod3_las.txd/sjmlas2lod5n.dds\",\"gta3.img/lanlod.txd/sjmlas2lod5n.dds\",\n \"gta3.img/lod_las2.txd/sjmlas2lod5n.dds\",\"gta3.img/lanlod.txd/sjmlas2lod5n.dds\",\n \"gta3.img/lod_lan2.txd/lanlodroadjunc2.dds\",\"gta3.img/lanlod.txd/lanlodroadjunc2.dds\",\n \"gta3.img/lod_lan2.txd/lanlodroad1.dds\",\"gta3.img/lanlod.txd/lanlodroad1.dds\",\n \"gta3.img/welod_law2.txd/lanlodroad1.dds\",\"gta3.img/lanlod.txd/lanlodroad1.dds\",\n \"gta3.img/lod_lan2.txd/lanlodroadjunc1.dds\",\"gta3.img/lanlod.txd/lanlodroadjunc1.dds\",\n \"gta3.img/lod_lan2.txd/lanstormdrn2lod.dds\",\"gta3.img/lanlod.txd/lanstormdrn2lod.dds\",\n \"gta3.img/lod_las2.txd/lanstormdrn2lod.dds\",\"gta3.img/lanlod.txd/lanstormdrn2lod.dds\",\n \"gta3.img/lod_lan2.txd/lanstormdrn1lod.dds\",\"gta3.img/lanlod.txd/lanstormdrn1lod.dds\",\n \"gta3.img/lod2lae1.txd/lanroof1lod.dds\",\"gta3.img/lanlod.txd/lanroof1lod.dds\",\n \"gta3.img/lod_a_law.txd/lanroof1lod.dds\",\"gta3.img/lanlod.txd/lanroof1lod.dds\",\n \"gta3.img/lod_lan2.txd/lanroof1lod.dds\",\"gta3.img/lanlod.txd/lanroof1lod.dds\",\n \"gta3.img/lod_cn2_stown.txd/roof10l_lod.dds\",\"gta3.img/lanlod.txd/roof10l_lod.dds\",\n \"gta3.img/vegaselod3.txd/roof10l_lod.dds\",\"gta3.img/lanlod.txd/roof10l_lod.dds\",\n \"gta3.img/vegasnlod1.txd/roof10l_lod.dds\",\"gta3.img/lanlod.txd/roof10l_lod.dds\",\n \"gta3.img/vegasnlod2.txd/roof10l_lod.dds\",\"gta3.img/lanlod.txd/roof10l_lod.dds\",\n \"gta3.img/vegasnlod4.txd/roof10l_lod.dds\",\"gta3.img/lanlod.txd/roof10l_lod.dds\",\n \"gta3.img/welod_law2.txd/roof10l_lod.dds\",\"gta3.img/lanlod.txd/roof10l_lod.dds\",\n \"gta3.img/lod2lae1.txd/lanconcmanklod.dds\",\"gta3.img/lanlod.txd/lanconcmanklod.dds\",\n \"gta3.img/lod_lan2.txd/lanconcmanklod.dds\",\"gta3.img/lanlod.txd/lanconcmanklod.dds\",\n \"gta3.img/lodhuge_lan2.txd/lanconcmanklod.dds\",\"gta3.img/lanlod.txd/lanconcmanklod.dds\",\n \"gta3.img/lod_las2.txd/lanconcmanklod.dds\",\"gta3.img/lanlod.txd/lanconcmanklod.dds\",\n \"gta3.img/lodlawnsmall.txd/lanconcmanklod.dds\",\"gta3.img/lanlod.txd/lanconcmanklod.dds\",\n \"gta3.img/sunset1_lan2.txd/stormdrain1b_sl.dds\",\"gta3.img/lanriver.txd/stormdrain1b_sl.dds\",\n \"gta3.img/stormdrain2_las2.txd/stormdrain1_nt.dds\",\"gta3.img/lanriver.txd/stormdrain1_nt.dds\",\n \"gta3.img/stormdrain_las2.txd/stormdrain1_nt.dds\",\"gta3.img/lanriver.txd/stormdrain1_nt.dds\",\n \"gta3.img/stormdrain.txd/stormdrain1_nt.dds\",\"gta3.img/lanriver.txd/stormdrain1_nt.dds\",\n \"gta3.img/sunset1_lan2.txd/stormdrain1_nt.dds\",\"gta3.img/lanriver.txd/stormdrain1_nt.dds\",\n \"gta3.img/ottos2_sfw.txd/cl_highbak.dds\",\"gta3.img/las2_dockoff.txd/cl_highbak.dds\",\n \"gta_int.img/cj_office.txd/cl_highbak.dds\",\"gta3.img/las2_dockoff.txd/cl_highbak.dds\",\n \"gta3.img/ottos2_sfw.txd/bnk_dsk_2.dds\",\"gta3.img/las2_dockoff.txd/bnk_dsk_2.dds\",\n \"gta_int.img/kbmiscfrn1.txd/bnk_dsk_2.dds\",\"gta3.img/las2_dockoff.txd/bnk_dsk_2.dds\",\n \"gta3.img/sjmla_las.txd/gragewinkb1.dds\",\"gta3.img/lasground2_las2.txd/gragewinkb1.dds\",\n \"gta3.img/sjmla_las.txd/garage_roof.dds\",\"gta3.img/lasground2_las2.txd/garage_roof.dds\",\n \"gta3.img/sjmla_las.txd/rooftoprd128.dds\",\"gta3.img/lasground2_las2.txd/rooftoprd128.dds\",\n \"gta_int.img/cj_bar2.txd/gb_nastybar07.dds\",\"gta3.img/lasground_las2.txd/gb_nastybar07.dds\",\n \"gta3.img/law_beach2.txd/general01_law.dds\",\"gta3.img/lasground_las2.txd/general01_law.dds\",\n \"gta3.img/lashops1_las2.txd/sanpedshpito.dds\",\"gta3.img/lashops1b_las2.txd/sanpedshpito.dds\",\n \"gta3.img/vgsssignage03.txd/yellow2_128.dds\",\"gta3.img/lashops6_las2.txd/yellow2_128.dds\",\n \"gta3.img/vgsssignage04.txd/yellow2_128.dds\",\"gta3.img/lashops6_las2.txd/yellow2_128.dds\",\n \"gta3.img/sw_apartflat.txd/sw_wind12.dds\",\"gta3.img/lashops6_las2.txd/sw_wind12.dds\",\n \"gta3.img/vegasdwntwn1.txd/sw_wind12.dds\",\"gta3.img/lashops6_las2.txd/sw_wind12.dds\",\n \"gta3.img/vgntrainstat.txd/sw_wind12.dds\",\"gta3.img/lashops6_las2.txd/sw_wind12.dds\",\n \"gta3.img/shopliquor_las.txd/laspowrec2.dds\",\"gta3.img/lashops91_las2.txd/laspowrec2.dds\",\n \"gta3.img/sunst18_lawn.txd/laspowrec2.dds\",\"gta3.img/lashops91_las2.txd/laspowrec2.dds\",\n \"gta3.img/wasteland_las2.txd/snpedshptst2.dds\",\"gta3.img/lashops93_las2.txd/snpedshptst2.dds\",\n \"gta3.img/losflor4_lae2.txd/window1164hv.dds\",\"gta3.img/lashops93_las2.txd/window1164hv.dds\",\n \"gta3.img/railway_las.txd/lasunion994.dds\",\"gta3.img/lasroads_las2.txd/lasunion994.dds\",\n \"gta3.img/traintrack_las.txd/lasunion994.dds\",\"gta3.img/lasroads_las2.txd/lasunion994.dds\",\n \"gta3.img/union_las.txd/lasunion994.dds\",\"gta3.img/lasroads_las2.txd/lasunion994.dds\",\n \"gta3.img/stormdrain_las2.txd/sanpedock6.dds\",\"gta3.img/lasxrefdock.txd/sanpedock6.dds\",\n \"gta3.img/shops01_law.txd/sanpedock96.dds\",\"gta3.img/lasxrefdock.txd/sanpedock96.dds\",\n \"gta3.img/sw_sheds2.txd/sanpedock96.dds\",\"gta3.img/lasxrefdock.txd/sanpedock96.dds\",\n \"gta3.img/subpen2_sfse.txd/lastran8.dds\",\"gta3.img/lasxrefdock.txd/lastran8.dds\",\n \"gta3.img/welod_law2.txd/malibulod01_law2.dds\",\"gta3.img/law2lod_lax.txd/malibulod01_law2.dds\",\n \"gta_int.img/cj_hotel_sw.txd/cj-couchl1.dds\",\"gta3.img/law2misc_lax.txd/cj-couchl1.dds\",\n \"gta_int.img/cj_sofa.txd/cj-couchl1.dds\",\"gta3.img/law2misc_lax.txd/cj-couchl1.dds\",\n \"gta3.img/santamonicalaw2a.txd/anwfrntbev6.dds\",\"gta3.img/law2_roadsb.txd/anwfrntbev6.dds\",\n \"gta3.img/luxorland.txd/luxorwall01_128.dds\",\"gta3.img/lawartg.txd/luxorwall01_128.dds\",\n \"gta3.img/vgseland.txd/luxorwall01_128.dds\",\"gta3.img/lawartg.txd/luxorwall01_128.dds\",\n \"gta3.img/vgsnbuild07.txd/luxorwall01_128.dds\",\"gta3.img/lawartg.txd/luxorwall01_128.dds\",\n \"gta3.img/lawwhitebuilds.txd/musk3.dds\",\"gta3.img/law_beach1.txd/musk3.dds\",\n \"gta3.img/vgsbballnet1.txd/sw_barnfence01.dds\",\"gta3.img/law_beach1.txd/sw_barnfence01.dds\",\n \"gta3.img/santamopollaw2.txd/avenpol4.dds\",\"gta3.img/law_beach1.txd/avenpol4.dds\",\n \"gta3.img/sunset01_lawn.txd/compcourtrail2.dds\",\"gta3.img/law_beach1.txd/compcourtrail2.dds\",\n \"gta3.img/law_beach2.txd/beachwalk_law.dds\",\"gta3.img/law_beach1.txd/beachwalk_law.dds\",\n \"gta3.img/pier_law.txd/beachwalk_law.dds\",\"gta3.img/law_beach1.txd/beachwalk_law.dds\",\n \"gta3.img/santamonicalaw2a.txd/beachwalk_law.dds\",\"gta3.img/law_beach1.txd/beachwalk_law.dds\",\n \"gta3.img/santamonicalaw2.txd/beachwalk_law.dds\",\"gta3.img/law_beach1.txd/beachwalk_law.dds\",\n \"gta3.img/lombard.txd/lombard_build2_3.dds\",\"gta3.img/law_beach2.txd/lombard_build2_3.dds\",\n \"gta3.img/lombard.txd/lombard_door1.dds\",\"gta3.img/law_beach2.txd/lombard_door1.dds\",\n \"gta3.img/slapart01sfe.txd/lombard_door1.dds\",\"gta3.img/law_beach2.txd/lombard_door1.dds\",\n \"gta3.img/sunrise01_lawn.txd/blueshade3_64.dds\",\"gta3.img/law_beach2.txd/blueshade3_64.dds\",\n \"gta3.img/sunrise10_lawn.txd/blueshade3_64.dds\",\"gta3.img/law_beach2.txd/blueshade3_64.dds\",\n \"gta3.img/vgnretail4.txd/blueshade3_64.dds\",\"gta3.img/law_beach2.txd/blueshade3_64.dds\",\n \"gta3.img/melrose05_lawn.txd/greenshade_64.dds\",\"gta3.img/law_beach2.txd/greenshade_64.dds\",\n \"gta3.img/sunset01_law2.txd/greenshade_64.dds\",\"gta3.img/law_beach2.txd/greenshade_64.dds\",\n \"gta3.img/telewirelawn.txd/greenshade_64.dds\",\"gta3.img/law_beach2.txd/greenshade_64.dds\",\n \"gta3.img/luxorland.txd/luxorwall02_128.dds\",\"gta3.img/law_beach2.txd/luxorwall02_128.dds\",\n \"gta3.img/santavenice3.txd/luxorwall02_128.dds\",\"gta3.img/law_beach2.txd/luxorwall02_128.dds\",\n \"gta3.img/sphinx01.txd/luxorwall02_128.dds\",\"gta3.img/law_beach2.txd/luxorwall02_128.dds\",\n \"gta3.img/melrose16_lawn.txd/creamshop1_lae.dds\",\"gta3.img/law_cnrtplaz.txd/creamshop1_lae.dds\",\n \"gta3.img/lawest1.txd/shoptop01_law.dds\",\"gta3.img/law_cnrtplaz.txd/shoptop01_law.dds\",\n \"gta3.img/melrose17_lawn.txd/shoptop01_law.dds\",\"gta3.img/law_cnrtplaz.txd/shoptop01_law.dds\",\n \"gta3.img/ottos2_sfw.txd/hot_flowers1.dds\",\"gta3.img/law_coffinfl.txd/hot_flowers1.dds\",\n \"gta_int.img/plants_galss.txd/hot_flowers1.dds\",\"gta3.img/law_coffinfl.txd/hot_flowers1.dds\",\n \"gta3.img/sfe_swank1.txd/sf_windos_10b.dds\",\"gta3.img/law_doontoon.txd/sf_windos_10b.dds\",\n \"gta3.img/smallertxd.txd/sf_windos_10b.dds\",\"gta3.img/law_doontoon.txd/sf_windos_10b.dds\",\n \"gta3.img/sfe_swank1.txd/sfe_nicearch2.dds\",\"gta3.img/law_doontoon.txd/sfe_nicearch2.dds\",\n \"gta3.img/stolenbuild02.txd/sfe_nicearch2.dds\",\"gta3.img/law_doontoon.txd/sfe_nicearch2.dds\",\n \"gta3.img/sfe_swank1.txd/sfe_nicearch3.dds\",\"gta3.img/law_doontoon.txd/sfe_nicearch3.dds\",\n \"gta3.img/stolenbuild02.txd/sfe_nicearch3.dds\",\"gta3.img/law_doontoon.txd/sfe_nicearch3.dds\",\n \"gta3.img/lomall.txd/sf_window_mod1.dds\",\"gta3.img/law_doontoon.txd/sf_window_mod1.dds\",\n \"gta3.img/vgsnbuild07.txd/vgndwntwn2_256_256.dds\",\"gta3.img/law_doontoon.txd/sf_window_mod1.dds\",\n \"gta3.img/snpedhusxref.txd/lasjmflat1.dds\",\"gta3.img/lawland2.txd/lasjmflat1.dds\",\n \"gta3.img/vgndwntwn23.txd/nudexxxsign1_256.dds\",\"gta3.img/lawnabv.txd/nudexxxsign1_256.dds\",\n \"gta3.img/vgndwntwn23.txd/bargainpawn1_256.dds\",\"gta3.img/lawnabv.txd/bargainpawn1_256.dds\",\n \"gta3.img/vgndwntwn23.txd/ws_corr_wall1.dds\",\"gta3.img/lawnabv.txd/ws_corr_wall1.dds\",\n \"gta3.img/vgnretail7.txd/ws_corr_wall1.dds\",\"gta3.img/lawnabv.txd/ws_corr_wall1.dds\",\n \"gta3.img/vegasdwntwn1.txd/dwntwnvgn1_128].dds\",\"gta3.img/lawnabv.txd/dwntwnvgn1_128].dds\",\n \"gta3.img/vgndwntwn23.txd/dwntwnvgn1_128].dds\",\"gta3.img/lawnabv.txd/dwntwnvgn1_128].dds\",\n \"gta3.img/vgsebuild01.txd/vgnwstshop4_256.dds\",\"gta3.img/lawnabv.txd/vgnwstshop4_256.dds\",\n \"gta3.img/vgsshospshop.txd/vgnwstshop4_256.dds\",\"gta3.img/lawnabv.txd/vgnwstshop4_256.dds\",\n \"gta3.img/vgsswarehse02c.txd/vgnwstshop4_256.dds\",\"gta3.img/lawnabv.txd/vgnwstshop4_256.dds\",\n \"gta3.img/vgndwntwn23.txd/vgnwstshoptop_256.dds\",\"gta3.img/lawnabv.txd/vgnwstshoptop_256.dds\",\n \"gta3.img/vgnfrates.txd/vgnwstshop1_256.dds\",\"gta3.img/lawnabv.txd/vgnwstshop1_256.dds\",\n \"gta3.img/vgnretail5.txd/vgnwstshop1_256.dds\",\"gta3.img/lawnabv.txd/vgnwstshop1_256.dds\",\n \"gta3.img/vgnretail7.txd/vgnwstshop1_256.dds\",\"gta3.img/lawnabv.txd/vgnwstshop1_256.dds\",\n \"gta3.img/vgnhseing1.txd/vgnbalcony1_256.dds\",\"gta3.img/lawnapartxref.txd/vgnbalcony1_256.dds\",\n \"gta3.img/vgnxrefhse1.txd/vgnbalcony1_256.dds\",\"gta3.img/lawnapartxref.txd/vgnbalcony1_256.dds\",\n \"gta3.img/vegashse3.txd/genroof03_128.dds\",\"gta3.img/lawnapartxref.txd/genroof03_128.dds\",\n \"gta3.img/vgnhseland.txd/genroof03_128.dds\",\"gta3.img/lawnapartxref.txd/genroof03_128.dds\",\n \"gta3.img/vgntrainstat.txd/genroof03_128.dds\",\"gta3.img/lawnapartxref.txd/genroof03_128.dds\",\n \"gta3.img/vgnxrefhse1.txd/genroof03_128.dds\",\"gta3.img/lawnapartxref.txd/genroof03_128.dds\",\n \"gta3.img/vgsehseing1.txd/genroof03_128.dds\",\"gta3.img/lawnapartxref.txd/genroof03_128.dds\",\n \"gta3.img/vgsetrainstn.txd/genroof03_128.dds\",\"gta3.img/lawnapartxref.txd/genroof03_128.dds\",\n \"gta3.img/vgnhseing1.txd/vnghse4_256.dds\",\"gta3.img/lawnapartxref.txd/vnghse4_256.dds\",\n \"gta3.img/vgnhseland.txd/vnghse4_256.dds\",\"gta3.img/lawnapartxref.txd/vnghse4_256.dds\",\n \"gta3.img/vgnxrefhse1.txd/vnghse4_256.dds\",\"gta3.img/lawnapartxref.txd/vnghse4_256.dds\",\n \"gta3.img/vgsehseing1.txd/vnghse4_256.dds\",\"gta3.img/lawnapartxref.txd/vnghse4_256.dds\",\n \"gta3.img/vgnhseing1.txd/vnghse5_256.dds\",\"gta3.img/lawnapartxref.txd/vnghse5_256.dds\",\n \"gta3.img/vgnxrefhse1.txd/vnghse5_256.dds\",\"gta3.img/lawnapartxref.txd/vnghse5_256.dds\",\n \"gta_int.img/cj_jucie.txd/cj_sprunk_front2.dds\",\"gta3.img/lawnbillbrd.txd/cj_sprunk_front2.dds\",\n \"gta_int.img/cj_off_lic.txd/cj_sprunk_front2.dds\",\"gta3.img/lawnbillbrd.txd/cj_sprunk_front2.dds\",\n \"gta3.img/pershingsq.txd/frostedglass256128.dds\",\"gta3.img/lawnbit.txd/frostedglass256128.dds\",\n \"gta3.img/rodeo01_law2.txd/frostedglass256128.dds\",\"gta3.img/lawnbit.txd/frostedglass256128.dds\",\n \"gta3.img/rodeo05_law2.txd/frostedglass256128.dds\",\"gta3.img/lawnbit.txd/frostedglass256128.dds\",\n \"gta3.img/sunset01_law2.txd/frostedglass256128.dds\",\"gta3.img/lawnbit.txd/frostedglass256128.dds\",\n \"gta3.img/park_sfw.txd/concrete_64hv.dds\",\"gta3.img/lawnest2.txd/concrete_64hv.dds\",\n \"gta3.img/residnce01.txd/concrete_64hv.dds\",\"gta3.img/lawnest2.txd/concrete_64hv.dds\",\n \"gta3.img/smallertxd.txd/concrete_64hv.dds\",\"gta3.img/lawnest2.txd/concrete_64hv.dds\",\n \"gta3.img/vgnrailroad.txd/concrete_64hv.dds\",\"gta3.img/lawnest2.txd/concrete_64hv.dds\",\n \"gta3.img/vgntamotel.txd/concrete_64hv.dds\",\"gta3.img/lawnest2.txd/concrete_64hv.dds\",\n \"gta3.img/vgsetrainstn.txd/concrete_64hv.dds\",\"gta3.img/lawnest2.txd/concrete_64hv.dds\",\n \"gta3.img/vgwestrailrd.txd/concrete_64hv.dds\",\"gta3.img/lawnest2.txd/concrete_64hv.dds\",\n \"gta3.img/lodlawnsmall.txd/lawngrnd12.dds\",\"gta3.img/lawnlodbig.txd/lawngrnd12.dds\",\n \"gta3.img/sunrise08_lawn.txd/sodom_law.dds\",\"gta3.img/lawnstripm.txd/sodom_law.dds\",\n \"gta3.img/vgnretail2.txd/savsig4.dds\",\"gta3.img/lawnstripm.txd/savsig4.dds\",\n \"gta3.img/shops2_law.txd/papercuts.dds\",\"gta3.img/lawnstripm.txd/papercuts.dds\",\n \"gta3.img/sw_apartflat5.txd/papercuts.dds\",\"gta3.img/lawnstripm.txd/papercuts.dds\",\n \"gta3.img/sunrise09_lawn.txd/lasthoose6.dds\",\"gta3.img/lawnxref.txd/lasthoose6.dds\",\n \"gta3.img/venicegb02_law.txd/gb_blend01.dds\",\"gta3.img/lawwhitebuilds.txd/gb_blend01.dds\",\n \"gta3.img/subpen2_sfse.txd/buzzer_law.dds\",\"gta3.img/lawwhitebuilds.txd/buzzer_law.dds\",\n \"gta3.img/venicegb02_law.txd/plantertop_law.dds\",\"gta3.img/lawwhitebuilds.txd/plantertop_law.dds\",\n \"gta3.img/venicegb02_law.txd/planterside_law.dds\",\"gta3.img/lawwhitebuilds.txd/planterside_law.dds\",\n \"gta3.img/vgnretail72.txd/gasstopwall1_256.dds\",\"gta3.img/lawwhitebuilds.txd/gasstopwall1_256.dds\",\n \"gta3.img/lod2_las.txd/sjmloda4.dds\",\"gta3.img/laxref_lod.txd/sjmloda4.dds\",\n \"gta3.img/lod3_las.txd/sjmloda4.dds\",\"gta3.img/laxref_lod.txd/sjmloda4.dds\",\n \"gta3.img/lod_las2.txd/sjmloda4.dds\",\"gta3.img/laxref_lod.txd/sjmloda4.dds\",\n \"gta3.img/lod2_las.txd/sjmlodb91.dds\",\"gta3.img/laxref_lod.txd/sjmlodb91.dds\",\n \"gta3.img/libertyhi.txd/grass.dds\",\"gta3.img/lee_kitch.txd/grass.dds\",\n \"gta3.img/librest.txd/grass.dds\",\"gta3.img/lee_kitch.txd/grass.dds\",\n \"gta3.img/libertyhi.txd/banding3c_64hv.dds\",\"gta3.img/lee_kitch.txd/banding3c_64hv.dds\",\n \"gta3.img/rhand.txd/torso8bit.dds\",\"gta3.img/lhand.txd/torso8bit.dds\",\n \"gta3.img/libertyhi3.txd/tenbeigebrick64.dds\",\"gta3.img/libertyhi2.txd/tenbeigebrick64.dds\",\n \"gta3.img/libertyhi5.txd/tenabrick64.dds\",\"gta3.img/libertyhi2.txd/tenabrick64.dds\",\n \"gta3.img/libertyhi5.txd/ledge_uni_64h.dds\",\"gta3.img/libertyhi2.txd/ledge_uni_64h.dds\",\n \"gta3.img/libertyhi5.txd/ind_tentop128.dds\",\"gta3.img/libertyhi2.txd/ind_tentop128.dds\",\n \"gta3.img/libertyhi5.txd/indtena128.dds\",\"gta3.img/libertyhi2.txd/indtena128.dds\",\n \"gta3.img/station.txd/taxi_256128.dds\",\"gta3.img/libertyhi3.txd/taxi_256128.dds\",\n \"gta3.img/libertyhi.txd/newall9-1.dds\",\"gta3.img/libertyhi5.txd/newall9-1.dds\",\n \"gta3.img/libertyhi.txd/ledge4_64h.dds\",\"gta3.img/libertyhi5.txd/ledge4_64h.dds\",\n \"gta3.img/libertyhi.txd/indtendark64.dds\",\"gta3.img/libertyhi5.txd/indtendark64.dds\",\n \"gta3.img/libertyhi.txd/concretebuild64.dds\",\"gta3.img/libertyhi5.txd/concretebuild64.dds\",\n \"gta3.img/station.txd/rustybolts.dds\",\"gta3.img/libertyhi.txd/rustybolts.dds\",\n \"gta3.img/trees2.txd/newtreeb256.dds\",\"gta3.img/libertyhi.txd/newtreeb256.dds\",\n \"gta3.img/trees2.txd/newtreea128.dds\",\"gta3.img/libertyhi.txd/newtreea128.dds\",\n \"gta3.img/sfe_copchop.txd/footplate_gz.dds\",\"gta3.img/libhelipad_lan2.txd/footplate_gz.dds\",\n \"gta3.img/sfn_helipad.txd/footplate_gz.dds\",\"gta3.img/libhelipad_lan2.txd/footplate_gz.dds\",\n \"gta3.img/sfe_copchop.txd/helipad_basepanel.dds\",\"gta3.img/libhelipad_lan2.txd/helipad_basepanel.dds\",\n \"gta3.img/sfn_helipad.txd/helipad_basepanel.dds\",\"gta3.img/libhelipad_lan2.txd/helipad_basepanel.dds\",\n \"gta3.img/vgnhelipad1.txd/helipad_basepanel.dds\",\"gta3.img/libhelipad_lan2.txd/helipad_basepanel.dds\",\n \"gta3.img/sfe_copchop.txd/partition_gz.dds\",\"gta3.img/libhelipad_lan2.txd/partition_gz.dds\",\n \"gta3.img/sfn_helipad.txd/partition_gz.dds\",\"gta3.img/libhelipad_lan2.txd/partition_gz.dds\",\n \"gta3.img/nitelites.txd/dt_twinklylites.dds\",\"gta3.img/libhelipad_lan2.txd/dt_twinklylites.dds\",\n \"gta3.img/sfe_copchop.txd/dt_twinklylites.dds\",\"gta3.img/libhelipad_lan2.txd/dt_twinklylites.dds\",\n \"gta3.img/sfroadsign.txd/dt_twinklylites.dds\",\"gta3.img/libhelipad_lan2.txd/dt_twinklylites.dds\",\n \"gta3.img/sfe_copchop.txd/helipad_whitelines.dds\",\"gta3.img/libhelipad_lan2.txd/helipad_whitelines.dds\",\n \"gta3.img/sfn_helipad.txd/helipad_whitelines.dds\",\"gta3.img/libhelipad_lan2.txd/helipad_whitelines.dds\",\n \"gta3.img/vgnhelipad1.txd/helipad_whitelines.dds\",\"gta3.img/libhelipad_lan2.txd/helipad_whitelines.dds\",\n \"gta3.img/sfe_copchop.txd/helipad_yellowline.dds\",\"gta3.img/libhelipad_lan2.txd/helipad_yellowline.dds\",\n \"gta3.img/sfn_helipad.txd/helipad_yellowline.dds\",\"gta3.img/libhelipad_lan2.txd/helipad_yellowline.dds\",\n \"gta3.img/vgnhelipad1.txd/helipad_yellowline.dds\",\"gta3.img/libhelipad_lan2.txd/helipad_yellowline.dds\",\n \"gta3.img/sw_fact02alt.txd/sw_wind22.dds\",\"gta3.img/lngblok_lae2.txd/sw_wind22.dds\",\n \"gta3.img/sw_fact02.txd/sw_wind22.dds\",\"gta3.img/lngblok_lae2.txd/sw_wind22.dds\",\n \"gta3.img/melrose19_lawn.txd/downtsign14_la.dds\",\"gta3.img/lngblok_lae2.txd/downtsign14_la.dds\",\n \"gta3.img/lod_countryn.txd/ws_tunnelwall1lod.dds\",\"gta3.img/lod2lae1.txd/ws_tunnelwall1lod.dds\",\n \"gta3.img/lod_sfse.txd/ws_tunnelwall1lod.dds\",\"gta3.img/lod2lae1.txd/ws_tunnelwall1lod.dds\",\n \"gta3.img/lod2_las.txd/sjmlodd7.dds\",\"gta3.img/lod2lae1.txd/sjmlodd7.dds\",\n \"gta3.img/lod_las2.txd/sjmlodd7.dds\",\"gta3.img/lod2lae1.txd/sjmlodd7.dds\",\n \"gta3.img/lod_lan2.txd/prolaps01lod.dds\",\"gta3.img/lod2lae1.txd/prolaps01lod.dds\",\n \"gta3.img/lod_cn2_stown.txd/roof06l256lod.dds\",\"gta3.img/lod2lae1.txd/roof06l256lod.dds\",\n \"gta3.img/lod_countn2.txd/roof06l256lod.dds\",\"gta3.img/lod2lae1.txd/roof06l256lod.dds\",\n \"gta3.img/lod_countryn.txd/roof06l256lod.dds\",\"gta3.img/lod2lae1.txd/roof06l256lod.dds\",\n \"gta3.img/lodlawnsmall.txd/roof06llod.dds\",\"gta3.img/lod2lae1.txd/roof06l256lod.dds\",\n \"gta3.img/lodlawnsxref.txd/roof06l256lod.dds\",\"gta3.img/lod2lae1.txd/roof06l256lod.dds\",\n \"gta3.img/lod_sfs4.txd/roof06llod.dds\",\"gta3.img/lod2lae1.txd/roof06l256lod.dds\",\n \"gta3.img/lodvegaswest2.txd/roof06llod.dds\",\"gta3.img/lod2lae1.txd/roof06l256lod.dds\",\n \"gta3.img/lodvegaswest3.txd/roof06llod.dds\",\"gta3.img/lod2lae1.txd/roof06l256lod.dds\",\n \"gta3.img/lodvegaswest4.txd/roof06llod.dds\",\"gta3.img/lod2lae1.txd/roof06l256lod.dds\",\n \"gta3.img/lodvgswestout.txd/roof06llod.dds\",\"gta3.img/lod2lae1.txd/roof06l256lod.dds\",\n \"gta3.img/lodxrefhse1.txd/roof06llod.dds\",\"gta3.img/lod2lae1.txd/roof06l256lod.dds\",\n \"gta3.img/vegaselod2.txd/roof06l256lod.dds\",\"gta3.img/lod2lae1.txd/roof06l256lod.dds\",\n \"gta3.img/vegaselod3.txd/roof06l256lod.dds\",\"gta3.img/lod2lae1.txd/roof06l256lod.dds\",\n \"gta3.img/vegasnlod1.txd/roof06l256lod.dds\",\"gta3.img/lod2lae1.txd/roof06l256lod.dds\",\n \"gta3.img/vegasnlod4.txd/roof06llod.dds\",\"gta3.img/lod2lae1.txd/roof06l256lod.dds\",\n \"gta3.img/vegasnlod4.txd/roof06l256lod.dds\",\"gta3.img/lod2lae1.txd/roof06l256lod.dds\",\n \"gta3.img/lod3_las.txd/sjmlodc94.dds\",\"gta3.img/lod2lae1.txd/sjmlodc94.dds\",\n \"gta3.img/lod2_las.txd/sjmlodb9.dds\",\"gta3.img/lod2lae1.txd/sjmlodb9.dds\",\n \"gta3.img/lod2_las.txd/sjmlodd92.dds\",\"gta3.img/lod2lae1.txd/sjmlodd92.dds\",\n \"gta3.img/lod_countn2.txd/sjmlodd92.dds\",\"gta3.img/lod2lae1.txd/sjmlodd92.dds\",\n \"gta3.img/lodlawnland.txd/sjmlodd92.dds\",\"gta3.img/lod2lae1.txd/sjmlodd92.dds\",\n \"gta3.img/lod_las2.txd/sjmlaeloda4.dds\",\"gta3.img/lod2lae1.txd/sjmlaeloda4.dds\",\n \"gta3.img/lod2_las.txd/sjmloda5.dds\",\"gta3.img/lod2lae1.txd/sjmloda5.dds\",\n \"gta3.img/lod3_las.txd/sjmloda5.dds\",\"gta3.img/lod2lae1.txd/sjmloda5.dds\",\n \"gta3.img/lod_las2.txd/las2_greygrnd.dds\",\"gta3.img/lod2lae1.txd/las2_greygrnd.dds\",\n \"gta3.img/lod3_las.txd/sjmlodc91.dds\",\"gta3.img/lod2_las.txd/sjmlodc91.dds\",\n \"gta3.img/lod3_las.txd/sjmlode94.dds\",\"gta3.img/lod2_las.txd/sjmlode94.dds\",\n \"gta3.img/lod_las2.txd/sjmlodd2.dds\",\"gta3.img/lod2_las.txd/sjmlodd2.dds\",\n \"gta3.img/lod3_las.txd/sjmloda93.dds\",\"gta3.img/lod2_las.txd/sjmloda93.dds\",\n \"gta3.img/lod3_las.txd/sjmloda993.dds\",\"gta3.img/lod2_las.txd/sjmloda993.dds\",\n \"gta3.img/lod3_las.txd/las2_dokwal.dds\",\"gta3.img/lod2_las.txd/las2_dokwal.dds\",\n \"gta3.img/lod_las2.txd/las2_dokwal.dds\",\"gta3.img/lod2_las.txd/las2_dokwal.dds\",\n \"gta3.img/lod3_las.txd/sjmlodf5.dds\",\"gta3.img/lod2_las.txd/sjmlodf5.dds\",\n \"gta3.img/lod3_las.txd/sjmloda996.dds\",\"gta3.img/lod2_las.txd/sjmloda996.dds\",\n \"gta3.img/lod3_las.txd/laroof1lod.dds\",\"gta3.img/lod2_las.txd/laroof1lod.dds\",\n \"gta3.img/lod_cxref.txd/laroof1lod.dds\",\"gta3.img/lod2_las.txd/laroof1lod.dds\",\n \"gta3.img/lod_las2.txd/laroof1lod.dds\",\"gta3.img/lod2_las.txd/laroof1lod.dds\",\n \"gta3.img/lod9sfw.txd/tunn_sfw_lod3.dds\",\"gta3.img/lod2_sfe.txd/tunn_sfw_lod3.dds\",\n \"gta3.img/lod_sfse3.txd/tunn_sfw_lod2.dds\",\"gta3.img/lod2_sfe.txd/tunn_sfw_lod3.dds\",\n \"gta3.img/lod_sfe.txd/loda27_e.dds\",\"gta3.img/lod2_sfe.txd/loda27_e.dds\",\n \"gta3.img/lod6_sfe.txd/tempgrasslod1.dds\",\"gta3.img/lod2_sfe.txd/tempgrasslod1.dds\",\n \"gta3.img/lod3_sfe.txd/sfroad1_lod.dds\",\"gta3.img/lod2_sfe.txd/sfroad1_lod.dds\",\n \"gta3.img/lod4_sfe.txd/sfroad1_lod.dds\",\"gta3.img/lod2_sfe.txd/sfroad1_lod.dds\",\n \"gta3.img/lod5_sfe.txd/sfroad1_lod.dds\",\"gta3.img/lod2_sfe.txd/sfroad1_lod.dds\",\n \"gta3.img/lod6_sfe.txd/sfroad1_lod.dds\",\"gta3.img/lod2_sfe.txd/sfroad1_lod.dds\",\n \"gta3.img/lod6sfw.txd/sfroad1_lod.dds\",\"gta3.img/lod2_sfe.txd/sfroad1_lod.dds\",\n \"gta3.img/lod7sfw.txd/sfroad1_lod.dds\",\"gta3.img/lod2_sfe.txd/sfroad1_lod.dds\",\n \"gta3.img/lod_sfe.txd/sfroad1_lod.dds\",\"gta3.img/lod2_sfe.txd/sfroad1_lod.dds\",\n \"gta3.img/lod3_sfe.txd/sfroad2_lod.dds\",\"gta3.img/lod2_sfe.txd/sfroad2_lod.dds\",\n \"gta3.img/lod4_sfe.txd/sfroad2_lod.dds\",\"gta3.img/lod2_sfe.txd/sfroad2_lod.dds\",\n \"gta3.img/lod4sfw.txd/sfroad2_lod.dds\",\"gta3.img/lod2_sfe.txd/sfroad2_lod.dds\",\n \"gta3.img/lod5_sfe.txd/sfroad2_lod.dds\",\"gta3.img/lod2_sfe.txd/sfroad2_lod.dds\",\n \"gta3.img/lod5sfw.txd/sfroad2_lod.dds\",\"gta3.img/lod2_sfe.txd/sfroad2_lod.dds\",\n \"gta3.img/lod6_sfe.txd/sfroad2_lod.dds\",\"gta3.img/lod2_sfe.txd/sfroad2_lod.dds\",\n \"gta3.img/lod6sfw.txd/sfroad2_lod.dds\",\"gta3.img/lod2_sfe.txd/sfroad2_lod.dds\",\n \"gta3.img/lod7_sfe.txd/sfroad2_lod.dds\",\"gta3.img/lod2_sfe.txd/sfroad2_lod.dds\",\n \"gta3.img/lod7sfw.txd/sfroad2_lod.dds\",\"gta3.img/lod2_sfe.txd/sfroad2_lod.dds\",\n \"gta3.img/lod8sfw.txd/sfroad2_lod.dds\",\"gta3.img/lod2_sfe.txd/sfroad2_lod.dds\",\n \"gta3.img/lod9sfw.txd/sfroad2_lod.dds\",\"gta3.img/lod2_sfe.txd/sfroad2_lod.dds\",\n \"gta3.img/lod_sfe.txd/sfroad2_lod.dds\",\"gta3.img/lod2_sfe.txd/sfroad2_lod.dds\",\n \"gta3.img/lod_sfs1.txd/sfroad2_lod.dds\",\"gta3.img/lod2_sfe.txd/sfroad2_lod.dds\",\n \"gta3.img/lod_sfs2.txd/sfroad2_lod.dds\",\"gta3.img/lod2_sfe.txd/sfroad2_lod.dds\",\n \"gta3.img/lod_sfs3.txd/sfroad2_lod.dds\",\"gta3.img/lod2_sfe.txd/sfroad2_lod.dds\",\n \"gta3.img/lod_sfs4.txd/sfroad2_lod.dds\",\"gta3.img/lod2_sfe.txd/sfroad2_lod.dds\",\n \"gta3.img/lod_sfs6.txd/sfroad2_lod.dds\",\"gta3.img/lod2_sfe.txd/sfroad2_lod.dds\",\n \"gta3.img/lod_sfse2.txd/sfroad2_lod.dds\",\"gta3.img/lod2_sfe.txd/sfroad2_lod.dds\",\n \"gta3.img/lod_sfse3.txd/sfroad2_lod.dds\",\"gta3.img/lod2_sfe.txd/sfroad2_lod.dds\",\n \"gta3.img/lod_sfse69.txd/sfroad2_lod.dds\",\"gta3.img/lod2_sfe.txd/sfroad2_lod.dds\",\n \"gta3.img/lod_sfse.txd/sfroad2_lod.dds\",\"gta3.img/lod2_sfe.txd/sfroad2_lod.dds\",\n \"gta3.img/lod4_sfe.txd/lod_pyramid1.dds\",\"gta3.img/lod2_sfe.txd/lod_pyramid1.dds\",\n \"gta3.img/lod7_sfe.txd/lod_pyramid1.dds\",\"gta3.img/lod2_sfe.txd/lod_pyramid1.dds\",\n \"gta3.img/lod4sfw.txd/concretebigb_lod.dds\",\"gta3.img/lod3_las.txd/lodconcbigb256128.dds\",\n \"gta3.img/lod6sfw.txd/concretebigb_lod.dds\",\"gta3.img/lod3_las.txd/lodconcbigb256128.dds\",\n \"gta3.img/lod_a_law.txd/lodconcbigb256128.dds\",\"gta3.img/lod3_las.txd/lodconcbigb256128.dds\",\n \"gta3.img/lod_cn2_stown.txd/lodconcbigb256128.dds\",\"gta3.img/lod3_las.txd/lodconcbigb256128.dds\",\n \"gta3.img/lod_countn2.txd/lodconcbigb256128.dds\",\"gta3.img/lod3_las.txd/lodconcbigb256128.dds\",\n \"gta3.img/lodlawnsmall.txd/lodconcbigb256128.dds\",\"gta3.img/lod3_las.txd/lodconcbigb256128.dds\",\n \"gta3.img/lod_las2.txd/concpanel_lod.dds\",\"gta3.img/lod3_las.txd/concpanel_lod.dds\",\n \"gta3.img/lodvgsslod01.txd/concpanel_lod.dds\",\"gta3.img/lod3_las.txd/concpanel_lod.dds\",\n \"gta3.img/vegaselod2.txd/concpanel_lod.dds\",\"gta3.img/lod3_las.txd/concpanel_lod.dds\",\n \"gta3.img/lodvgsslod.txd/newall10_lod.dds\",\"gta3.img/lod3_las.txd/newall10_lod.dds\",\n \"gta3.img/lodcunty.txd/dirt64b2.dds\",\"gta3.img/lod3_las.txd/dirt64b2_lod.dds\",\n \"gta3.img/lodlawnsmall.txd/dirt64b2_lod.dds\",\"gta3.img/lod3_las.txd/dirt64b2_lod.dds\",\n \"gta3.img/lodvgsslod01.txd/dirt64b2_lod.dds\",\"gta3.img/lod3_las.txd/dirt64b2_lod.dds\",\n \"gta3.img/lodvgsslod02.txd/dirt64b2_lod.dds\",\"gta3.img/lod3_las.txd/dirt64b2_lod.dds\",\n \"gta3.img/lodvgsslod.txd/dirt64b2_lod.dds\",\"gta3.img/lod3_las.txd/dirt64b2_lod.dds\",\n \"gta3.img/lod4_sfe.txd/lodr69_sfe2_a.dds\",\"gta3.img/lod3_sfe.txd/lodr69_sfe2_a.dds\",\n \"gta3.img/lod4_sfe.txd/seawall_lod.dds\",\"gta3.img/lod3_sfe.txd/seawall_lod.dds\",\n \"gta3.img/lod4sfw.txd/seawall_lod.dds\",\"gta3.img/lod3_sfe.txd/seawall_lod.dds\",\n \"gta3.img/lod6sfw.txd/seawall_lod.dds\",\"gta3.img/lod3_sfe.txd/seawall_lod.dds\",\n \"gta3.img/lod4_sfe.txd/newferrylod2.dds\",\"gta3.img/lod3_sfe.txd/newferrylod2.dds\",\n \"gta3.img/lod4_sfe.txd/lod_pierbuild3.dds\",\"gta3.img/lod3_sfe.txd/lod_pierbuild3.dds\",\n \"gta3.img/lod4_sfe.txd/lod_pierbuild1.dds\",\"gta3.img/lod3_sfe.txd/lod_pierbuild1.dds\",\n \"gta3.img/lod4_sfe.txd/lod_pierbuild2.dds\",\"gta3.img/lod3_sfe.txd/lod_pierbuild2.dds\",\n \"gta3.img/lod_sfs4.txd/bow_church_dirt_lod.dds\",\"gta3.img/lod4sfw.txd/lod_sfse_dirt.dds\",\n \"gta3.img/lod_sfse.txd/lod_sfse_dirt.dds\",\"gta3.img/lod4sfw.txd/lod_sfse_dirt.dds\",\n \"gta3.img/lodvegaswest3.txd/lod_church_dirt2.dds\",\"gta3.img/lod4sfw.txd/lod_sfse_dirt.dds\",\n \"gta3.img/vegaselod2.txd/bow_church_dirt_lod.dds\",\"gta3.img/lod4sfw.txd/lod_sfse_dirt.dds\",\n \"gta3.img/vegashselod1.txd/lod_church_dirt.dds\",\"gta3.img/lod4sfw.txd/lod_sfse_dirt.dds\",\n \"gta3.img/lod5sfw.txd/asfnsjm3.dds\",\"gta3.img/lod4sfw.txd/asfnsjm3.dds\",\n \"gta3.img/lod_sfse.txd/asfnsjm3.dds\",\"gta3.img/lod4sfw.txd/asfnsjm3.dds\",\n \"gta3.img/lodtnsfn.txd/asfnsjm3.dds\",\"gta3.img/lod4sfw.txd/asfnsjm3.dds\",\n \"gta3.img/lod5sfw.txd/woodboards1_lod.dds\",\"gta3.img/lod4sfw.txd/woodboards1_lod.dds\",\n \"gta3.img/lod6sfw.txd/lodbox_sfw4.dds\",\"gta3.img/lod4sfw.txd/lodbox_sfw4.dds\",\n \"gta3.img/lod9sfw.txd/lodbox_sfw4.dds\",\"gta3.img/lod4sfw.txd/lodbox_sfw4.dds\",\n \"gta3.img/lod5sfw.txd/lodbox_sfw2.dds\",\"gta3.img/lod4sfw.txd/lodbox_sfw2.dds\",\n \"gta3.img/lod6sfw.txd/lodbox_sfw2.dds\",\"gta3.img/lod4sfw.txd/lodbox_sfw2.dds\",\n \"gta3.img/lod9sfw.txd/lodbox_sfw2.dds\",\"gta3.img/lod4sfw.txd/lodbox_sfw2.dds\",\n \"gta3.img/lod5sfw.txd/lodbox_sfw3.dds\",\"gta3.img/lod4sfw.txd/lodbox_sfw3.dds\",\n \"gta3.img/lod6sfw.txd/lodbox_sfw3.dds\",\"gta3.img/lod4sfw.txd/lodbox_sfw3.dds\",\n \"gta3.img/lod9sfw.txd/lodbox_sfw3.dds\",\"gta3.img/lod4sfw.txd/lodbox_sfw3.dds\",\n \"gta3.img/lod9sfw.txd/lodbox_sfw5.dds\",\"gta3.img/lod4sfw.txd/lodbox_sfw5.dds\",\n \"gta3.img/lod5sfw.txd/lodbox_sfw1.dds\",\"gta3.img/lod4sfw.txd/lodbox_sfw1.dds\",\n \"gta3.img/lod6sfw.txd/lodbox_sfw1.dds\",\"gta3.img/lod4sfw.txd/lodbox_sfw1.dds\",\n \"gta3.img/lod9sfw.txd/lodbox_sfw1.dds\",\"gta3.img/lod4sfw.txd/lodbox_sfw1.dds\",\n \"gta3.img/lod6sfw.txd/lodbox_sfw6.dds\",\"gta3.img/lod4sfw.txd/lodbox_sfw6.dds\",\n \"gta3.img/lod9sfw.txd/lodbox_sfw6.dds\",\"gta3.img/lod4sfw.txd/lodbox_sfw6.dds\",\n \"gta3.img/lod9sfw.txd/lodbox_sfw9.dds\",\"gta3.img/lod4sfw.txd/lodbox_sfw9.dds\",\n \"gta3.img/lod5sfw.txd/lodgrass_128hv.dds\",\"gta3.img/lod4sfw.txd/lodgrass_128hv.dds\",\n \"gta3.img/lod6sfw.txd/lodgrass_128hv.dds\",\"gta3.img/lod4sfw.txd/lodgrass_128hv.dds\",\n \"gta3.img/lod7sfw.txd/lodgrass_128hv.dds\",\"gta3.img/lod4sfw.txd/lodgrass_128hv.dds\",\n \"gta3.img/lod8sfw.txd/lodgrass_128hv.dds\",\"gta3.img/lod4sfw.txd/lodgrass_128hv.dds\",\n \"gta3.img/lod9sfw.txd/lodgrass_128hv.dds\",\"gta3.img/lod4sfw.txd/lodgrass_128hv.dds\",\n \"gta3.img/lod5sfw.txd/lod_newrockgrass_sfw.dds\",\"gta3.img/lod4sfw.txd/lod_newrockgrass_sfw.dds\",\n \"gta3.img/lod6sfw.txd/lod_newrockgrass_sfw.dds\",\"gta3.img/lod4sfw.txd/lod_newrockgrass_sfw.dds\",\n \"gta3.img/lod5sfw.txd/lod_rock_coast_sfw.dds\",\"gta3.img/lod4sfw.txd/lod_rock_coast_sfw.dds\",\n \"gta3.img/lod6sfw.txd/lod_rock_coast_sfw.dds\",\"gta3.img/lod4sfw.txd/lod_rock_coast_sfw.dds\",\n \"gta3.img/lod_sfs2.txd/lod_sfs01_roof.dds\",\"gta3.img/lod4sfw.txd/lod_sfs01_roof.dds\",\n \"gta3.img/lod_sfs4.txd/lod_sfs01_roof.dds\",\"gta3.img/lod4sfw.txd/lod_sfs01_roof.dds\",\n \"gta3.img/lod6sfw.txd/lod_another_sfe_b.dds\",\"gta3.img/lod5_sfe.txd/lod_another_sfe_b.dds\",\n \"gta3.img/lod6sfw.txd/lodrock_usea_sfw.dds\",\"gta3.img/lod5sfw.txd/lodrock_usea_sfw.dds\",\n \"gta3.img/lod6sfw.txd/lodrocksea_sfw.dds\",\"gta3.img/lod5sfw.txd/lodrocksea_sfw.dds\",\n \"gta3.img/lod6sfw.txd/lodpavetilealley.dds\",\"gta3.img/lod5sfw.txd/lodpavetilealley.dds\",\n \"gta3.img/lodsfn.txd/gg_end_lod_3.dds\",\"gta3.img/lod5sfw.txd/gg_end_lod_3.dds\",\n \"gta3.img/lodsfn.txd/sfwbridgelod.dds\",\"gta3.img/lod5sfw.txd/sfwbridgelod.dds\",\n \"gta3.img/lod6sfw.txd/sf_elevator_grey1.dds\",\"gta3.img/lod5sfw.txd/sf_elevator_grey1.dds\",\n \"gta3.img/lod7sfw.txd/sf_elevator_grey1.dds\",\"gta3.img/lod5sfw.txd/sf_elevator_grey1.dds\",\n \"gta3.img/lod9sfw.txd/sf_elevator_grey1.dds\",\"gta3.img/lod5sfw.txd/sf_elevator_grey1.dds\",\n \"gta3.img/lod9sfw.txd/lodbox_sfw11.dds\",\"gta3.img/lod5sfw.txd/lodbox_sfw11.dds\",\n \"gta3.img/lod6sfw.txd/lodkmod2_sfw03_f.dds\",\"gta3.img/lod5sfw.txd/lodkmod2_sfw03_f.dds\",\n \"gta3.img/lod6sfw.txd/lodkmod2_sfw03_e.dds\",\"gta3.img/lod5sfw.txd/lodkmod2_sfw03_e.dds\",\n \"gta3.img/lod6sfw.txd/lodkmod2_sfw03_c.dds\",\"gta3.img/lod5sfw.txd/lodkmod2_sfw03_c.dds\",\n \"gta3.img/lodtnsfn.txd/lodkmod2_sfw03_c.dds\",\"gta3.img/lod5sfw.txd/lodkmod2_sfw03_c.dds\",\n \"gta3.img/lod6sfw.txd/lodkmod2_sfw03_a.dds\",\"gta3.img/lod5sfw.txd/lodkmod2_sfw03_a.dds\",\n \"gta3.img/lod6sfw.txd/lodkmod2_sfw03_d.dds\",\"gta3.img/lod5sfw.txd/lodkmod2_sfw03_d.dds\",\n \"gta3.img/lod6sfw.txd/lodkmod2_sfw03_b.dds\",\"gta3.img/lod5sfw.txd/lodkmod2_sfw03_b.dds\",\n \"gta3.img/lodtnsfn.txd/lodnel_sfw.dds\",\"gta3.img/lod6sfw.txd/lodnel_sfw.dds\",\n \"gta3.img/lod7sfw.txd/lodkmod3_sfw69_f.dds\",\"gta3.img/lod6sfw.txd/lodkmod3_sfw69_f.dds\",\n \"gta3.img/lod7sfw.txd/lodkmod3_sfw69_a.dds\",\"gta3.img/lod6sfw.txd/lodkmod3_sfw69_a.dds\",\n \"gta3.img/lod7sfw.txd/lodkmod3_sfw69_b.dds\",\"gta3.img/lod6sfw.txd/lodkmod3_sfw69_b.dds\",\n \"gta3.img/lod7sfw.txd/lodkmod3_sfw69_c.dds\",\"gta3.img/lod6sfw.txd/lodkmod3_sfw69_c.dds\",\n \"gta3.img/lod_sfse2.txd/lodkmod1_sfwb_c.dds\",\"gta3.img/lod6sfw.txd/lodkmod1_sfwb_c.dds\",\n \"gta3.img/lodtnsfn.txd/lodkmod1_sfwb_c.dds\",\"gta3.img/lod6sfw.txd/lodkmod1_sfwb_c.dds\",\n \"gta3.img/lod9sfw.txd/loddiner.dds\",\"gta3.img/lod6sfw.txd/loddiner.dds\",\n \"gta3.img/lod9sfw.txd/lodboxtmp20.dds\",\"gta3.img/lod6sfw.txd/lodboxtmp20.dds\",\n \"gta3.img/lod7sfw.txd/ws_carpark2lod.dds\",\"gta3.img/lod6sfw.txd/ws_carpark2lod.dds\",\n \"gta3.img/lodvegaswest1.txd/ws_carpark2lod.dds\",\"gta3.img/lod6sfw.txd/ws_carpark2lod.dds\",\n \"gta3.img/lodvegaswest3.txd/ws_carpark2lod.dds\",\"gta3.img/lod6sfw.txd/ws_carpark2lod.dds\",\n \"gta3.img/lodvgsslod02.txd/ws_carpark2lod.dds\",\"gta3.img/lod6sfw.txd/ws_carpark2lod.dds\",\n \"gta3.img/lodvgswestout.txd/ws_carpark2lod.dds\",\"gta3.img/lod6sfw.txd/ws_carpark2lod.dds\",\n \"gta3.img/lod9sfw.txd/lodbox_sfw7.dds\",\"gta3.img/lod6sfw.txd/lodbox_sfw7.dds\",\n \"gta3.img/lod7sfw.txd/lodkmod1_sfw_e.dds\",\"gta3.img/lod6sfw.txd/lodkmod1_sfw_e.dds\",\n \"gta3.img/lod7sfw.txd/lodkmod1_sfw_c.dds\",\"gta3.img/lod6sfw.txd/lodkmod1_sfw_c.dds\",\n \"gta3.img/lod7sfw.txd/lodkmod1_sfw_d.dds\",\"gta3.img/lod6sfw.txd/lodkmod1_sfw_d.dds\",\n \"gta3.img/lod9sfw.txd/lodpbuild_sfw42_d.dds\",\"gta3.img/lod7sfw.txd/lodpbuild_sfw42_d.dds\",\n \"gta3.img/lodtnsfn.txd/asfnsjm2.dds\",\"gta3.img/lod8sfw.txd/asfnsjm2.dds\",\n \"gta3.img/lodtnsfn.txd/asfnsjm1.dds\",\"gta3.img/lod8sfw.txd/asfnsjm1.dds\",\n \"gta3.img/lod_sfe.txd/lodboxtmp03_a.dds\",\"gta3.img/lod9sfw.txd/lodboxtmp03_a.dds\",\n \"gta3.img/vegaselod1.txd/metalic_lod.dds\",\"gta3.img/lod_a_law.txd/metalic_lod.dds\",\n \"gta3.img/lodlawnsmall.txd/concretebuild_lod.dds\",\"gta3.img/lod_a_law.txd/concretebuild_lod.dds\",\n \"gta3.img/lod_sfse3.txd/concretebuild_lod.dds\",\"gta3.img/lod_a_law.txd/concretebuild_lod.dds\",\n \"gta3.img/lod_sfse.txd/concretebuild_lod.dds\",\"gta3.img/lod_a_law.txd/concretebuild_lod.dds\",\n \"gta3.img/lodvegaswest3.txd/concretebuild_lod.dds\",\"gta3.img/lod_a_law.txd/concretebuild_lod.dds\",\n \"gta3.img/vegaselod2.txd/concretebuild_lod.dds\",\"gta3.img/lod_a_law.txd/concretebuild_lod.dds\",\n \"gta3.img/vegaselod3.txd/concretebuild_lod.dds\",\"gta3.img/lod_a_law.txd/concretebuild_lod.dds\",\n \"gta3.img/lod_cn2_stown.txd/concretenewb256.dds\",\"gta3.img/lod_a_law.txd/concretenewb256.dds\",\n \"gta3.img/lod_countn2.txd/concretenewb256.dds\",\"gta3.img/lod_a_law.txd/concretenewb256.dds\",\n \"gta3.img/lodcunty.txd/concretenewb256.dds\",\"gta3.img/lod_a_law.txd/concretenewb256.dds\",\n \"gta3.img/lod_mount_sfs.txd/concretenewb256.dds\",\"gta3.img/lod_a_law.txd/concretenewb256.dds\",\n \"gta3.img/lod_sfs2.txd/concretenewb256.dds\",\"gta3.img/lod_a_law.txd/concretenewb256.dds\",\n \"gta3.img/lod_sfs3.txd/concretenewb256.dds\",\"gta3.img/lod_a_law.txd/concretenewb256.dds\",\n \"gta3.img/lod_sfs4.txd/concretenewb256.dds\",\"gta3.img/lod_a_law.txd/concretenewb256.dds\",\n \"gta3.img/lod_sfs6.txd/concretenewb256.dds\",\"gta3.img/lod_a_law.txd/concretenewb256.dds\",\n \"gta3.img/lod_sfse.txd/concretenewb256.dds\",\"gta3.img/lod_a_law.txd/concretenewb256.dds\",\n \"gta3.img/lod_countn2.txd/block.dds\",\"gta3.img/lodchem.txd/block.dds\",\n \"gta3.img/lod_cxref.txd/block.dds\",\"gta3.img/lodchem.txd/block.dds\",\n \"gta3.img/lod_sfs5.txd/lod_block.dds\",\"gta3.img/lodchem.txd/block.dds\",\n \"gta3.img/lod_countn2.txd/lod_cn2motel3.dds\",\"gta3.img/lod_cn2_stown.txd/lod_cn2motel3.dds\",\n \"gta3.img/lod_countn2.txd/lod_teleshed2.dds\",\"gta3.img/lod_cn2_stown.txd/lod_teleshed2.dds\",\n \"gta3.img/lod_countn2.txd/lod_cn2_weefact.dds\",\"gta3.img/lod_cn2_stown.txd/lod_cn2_weefact.dds\",\n \"gta3.img/lod_countn2.txd/lod_teleshed3.dds\",\"gta3.img/lod_cn2_stown.txd/lod_teleshed3.dds\",\n \"gta3.img/lod_countn2.txd/des_dustconc.dds\",\"gta3.img/lod_cn2_stown.txd/des_dustconc.dds\",\n \"gta3.img/lod_countryn.txd/des_dustconclod.dds\",\"gta3.img/lod_cn2_stown.txd/des_dustconc.dds\",\n \"gta3.img/lod_countryn.txd/corr_roof1_lod.dds\",\"gta3.img/lod_cn2_stown.txd/corr_roof1_lod.dds\",\n \"gta3.img/vegaselod2.txd/corr_roof1_lod.dds\",\"gta3.img/lod_cn2_stown.txd/corr_roof1_lod.dds\",\n \"gta3.img/lod_countn2.txd/lod_cn2blok2.dds\",\"gta3.img/lod_cn2_stown.txd/lod_cn2blok2.dds\",\n \"gta3.img/lodhangar_sfsxref.txd/wslod_hangar2d.dds\",\"gta3.img/lod_countn2.txd/wslod_hangar2d.dds\",\n \"gta3.img/lodvgshangar.txd/wslod_hangar2d.dds\",\"gta3.img/lod_countn2.txd/wslod_hangar2d.dds\",\n \"gta3.img/lodvgsslod.txd/wslod_hangar2d.dds\",\"gta3.img/lod_countn2.txd/wslod_hangar2d.dds\",\n \"gta3.img/lodhangar_sfsxref.txd/wslod_hangar2c.dds\",\"gta3.img/lod_countn2.txd/wslod_hangar2c.dds\",\n \"gta3.img/lodvgshangar.txd/wslod_hangar2c.dds\",\"gta3.img/lod_countn2.txd/wslod_hangar2c.dds\",\n \"gta3.img/lodvgsslod.txd/wslod_hangar2c.dds\",\"gta3.img/lod_countn2.txd/wslod_hangar2c.dds\",\n \"gta3.img/lodhangar_sfsxref.txd/wslod_hangar2b.dds\",\"gta3.img/lod_countn2.txd/wslod_hangar2b.dds\",\n \"gta3.img/lodvgshangar.txd/wslod_hangar2b.dds\",\"gta3.img/lod_countn2.txd/wslod_hangar2b.dds\",\n \"gta3.img/lodvgsslod.txd/wslod_hangar2b.dds\",\"gta3.img/lod_countn2.txd/wslod_hangar2b.dds\",\n \"gta3.img/lodhangar_sfsxref.txd/wslod_hangar2.dds\",\"gta3.img/lod_countn2.txd/wslod_hangar2.dds\",\n \"gta3.img/lodvgshangar.txd/wslod_hangar2.dds\",\"gta3.img/lod_countn2.txd/wslod_hangar2.dds\",\n \"gta3.img/lodvgsslod.txd/wslod_hangar2.dds\",\"gta3.img/lod_countn2.txd/wslod_hangar2.dds\",\n \"gta3.img/lod_countryn.txd/lod_cn_stown2.dds\",\"gta3.img/lod_countn2.txd/lod_cn_stown2.dds\",\n \"gta3.img/lod_sfs3.txd/roof04l256_lod.dds\",\"gta3.img/lod_countn2.txd/roof04l256_lod.dds\",\n \"gta3.img/lodvegaswest2.txd/roof04l256_lod.dds\",\"gta3.img/lod_countn2.txd/roof04l256_lod.dds\",\n \"gta3.img/vegaselod2.txd/roof04l256_lod.dds\",\"gta3.img/lod_countn2.txd/roof04l256_lod.dds\",\n \"gta3.img/vegaselod3.txd/roof04l256_lod.dds\",\"gta3.img/lod_countn2.txd/roof04l256_lod.dds\",\n \"gta3.img/vegasnlod1.txd/roof04l256_lod.dds\",\"gta3.img/lod_countn2.txd/roof04l256_lod.dds\",\n \"gta3.img/vegasnlod4.txd/roof04l256_lod.dds\",\"gta3.img/lod_countn2.txd/roof04l256_lod.dds\",\n \"gta3.img/lod_counxref.txd/cxrf_bytower1.dds\",\"gta3.img/lod_countn2.txd/cxrf_bytower1.dds\",\n \"gta3.img/lod_cxrf.txd/cxrf_bytower1.dds\",\"gta3.img/lod_countn2.txd/cxrf_bytower1.dds\",\n \"gta3.img/lodvgsslod01.txd/bow_sub_walltiles.dds\",\"gta3.img/lod_countn2.txd/bow_sub_walltiles.dds\",\n \"gta3.img/lodtnsfn.txd/desertgryard256.dds\",\"gta3.img/lod_countn2.txd/desertgryard256.dds\",\n \"gta3.img/lodcunty.txd/grassdead1.dds\",\"gta3.img/lod_countn2.txd/grassdead1.dds\",\n \"gta3.img/lodcunty.txd/ws_traingravel.dds\",\"gta3.img/lod_countn2.txd/ws_traingravel.dds\",\n \"gta3.img/lodvgwstcoast.txd/ws_traingravel.dds\",\"gta3.img/lod_countn2.txd/ws_traingravel.dds\",\n \"gta3.img/lod_countryn.txd/parking1plain.dds\",\"gta3.img/lod_countn2.txd/parking1plain.dds\",\n \"gta3.img/lod_countryn.txd/parking1plainlod.dds\",\"gta3.img/lod_countn2.txd/parking1plain.dds\",\n \"gta3.img/lodcunty.txd/ws_tunnelwall2.dds\",\"gta3.img/lod_countn2.txd/ws_tunnelwall2.dds\",\n \"gta3.img/lod_sfse2.txd/ws_tunnelwall2.dds\",\"gta3.img/lod_countn2.txd/ws_tunnelwall2.dds\",\n \"gta3.img/lod_las2.txd/las2_xing.dds\",\"gta3.img/lod_countn2.txd/las2_xing.dds\",\n \"gta3.img/lod_countryn.txd/rocktbrn_dirt2.dds\",\"gta3.img/lod_countn2.txd/rocktbrn_dirt2.dds\",\n \"gta3.img/lodvgwstcoast.txd/vgs_rockmid1a.dds\",\"gta3.img/lod_countn2.txd/vgs_rockmid1a.dds\",\n \"gta3.img/vegaselod3.txd/vgs_rockmid1a.dds\",\"gta3.img/lod_countn2.txd/vgs_rockmid1a.dds\",\n \"gta3.img/vegasnlod3.txd/vgs_rockmid1a.dds\",\"gta3.img/lod_countn2.txd/vgs_rockmid1a.dds\",\n \"gta3.img/lod_countryn.txd/des_redrock2.dds\",\"gta3.img/lod_countn2.txd/des_redrock2.dds\",\n \"gta3.img/lod_countryn.txd/block2_highlod.dds\",\"gta3.img/lod_countn2.txd/block2_high.dds\",\n \"gta3.img/lod_sfse2.txd/rocktbrn128.dds\",\"gta3.img/lod_countn2.txd/rocktbrn128.dds\",\n \"gta3.img/lodtnsfn.txd/rocktbrn128.dds\",\"gta3.img/lod_countn2.txd/rocktbrn128.dds\",\n \"gta3.img/lodcunty.txd/grasstype5_4.dds\",\"gta3.img/lod_countn2.txd/grasstype5_4.dds\",\n \"gta3.img/lod_countryn.txd/des_yelrocklod.dds\",\"gta3.img/lod_countn2.txd/des_yelrock.dds\",\n \"gta3.img/lodvgwstcoast.txd/des_dirtgravel.dds\",\"gta3.img/lod_countn2.txd/des_dirtgravel.dds\",\n \"gta3.img/lodvegaswest2.txd/vgs_rockwall01_128.dds\",\"gta3.img/lod_countn2.txd/vgs_rockwall01_128.dds\",\n \"gta3.img/lod_countryn.txd/des_scrub1lod.dds\",\"gta3.img/lod_countn2.txd/des_scrub1.dds\",\n \"gta3.img/lodvgsslod02.txd/des_scrub1.dds\",\"gta3.img/lod_countn2.txd/des_scrub1.dds\",\n \"gta3.img/lod_countryn.txd/des_scrub1_dirt1lod.dds\",\"gta3.img/lod_countn2.txd/des_scrub1_dirt1.dds\",\n \"gta3.img/lodvgsslod02.txd/des_scrub1_dirt1.dds\",\"gta3.img/lod_countn2.txd/des_scrub1_dirt1.dds\",\n \"gta3.img/lodcunty.txd/parking2.dds\",\"gta3.img/lod_countn2.txd/parking2.dds\",\n \"gta3.img/lodcunty.txd/des_dirtgrassmixbmp.dds\",\"gta3.img/lod_countn2.txd/des_dirtgrassmixbmp.dds\",\n \"gta3.img/lodcunty.txd/stormdrain5_nt.dds\",\"gta3.img/lod_countn2.txd/stormdrain5_nt.dds\",\n \"gta3.img/lod_countryn.txd/drvin_ground1lod.dds\",\"gta3.img/lod_countn2.txd/drvin_ground1.dds\",\n \"gta3.img/vegaselod2.txd/taxi_256.dds\",\"gta3.img/lod_countn2.txd/taxi_256.dds\",\n \"gta3.img/lod_sfse2.txd/tar_1line256hv.dds\",\"gta3.img/lod_countn2.txd/tar_1line256hv.dds\",\n \"gta3.img/lod_countryn.txd/des_roadedge2lod.dds\",\"gta3.img/lod_countn2.txd/des_roadedge2.dds\",\n \"gta3.img/lodvegaswest1.txd/concretedust2_lod.dds\",\"gta3.img/lod_countn2.txd/concretedust2_256128.dds\",\n \"gta3.img/lodvegaswest2.txd/concretedust2_lod.dds\",\"gta3.img/lod_countn2.txd/concretedust2_256128.dds\",\n \"gta3.img/lodvegaswest3.txd/concretedust2_lod.dds\",\"gta3.img/lod_countn2.txd/concretedust2_256128.dds\",\n \"gta3.img/lodvgsslod01.txd/concretedust2_lod.dds\",\"gta3.img/lod_countn2.txd/concretedust2_256128.dds\",\n \"gta3.img/lodvgswestout.txd/concretedust2_lod.dds\",\"gta3.img/lod_countn2.txd/concretedust2_256128.dds\",\n \"gta3.img/lodcunty.txd/grasstype5.dds\",\"gta3.img/lod_countn2.txd/grasstype5.dds\",\n \"gta3.img/lodcunty.txd/grasstype5_dirt.dds\",\"gta3.img/lod_countn2.txd/grasstype5_dirt.dds\",\n \"gta3.img/lodcunty.txd/rocktq128_dirt.dds\",\"gta3.img/lod_countn2.txd/rocktq128_dirt.dds\",\n \"gta3.img/lod_mount_sfs.txd/rocktq128_dirt.dds\",\"gta3.img/lod_countn2.txd/rocktq128_dirt.dds\",\n \"gta3.img/lod_countryn.txd/des_dirttrack1lod.dds\",\"gta3.img/lod_countn2.txd/des_dirttrack1.dds\",\n \"gta3.img/lod_countryn.txd/vgs_shopwall01_128lod.dds\",\"gta3.img/lod_countn2.txd/vgs_shopwall01_128.dds\",\n \"gta3.img/lod_countryn.txd/des_redrockmidlod.dds\",\"gta3.img/lod_countn2.txd/des_redrockmid.dds\",\n \"gta3.img/lod_countryn.txd/des_redrockbotlod.dds\",\"gta3.img/lod_countn2.txd/des_redrockbot.dds\",\n \"gta3.img/lod_countryn.txd/des_roadedge1lod.dds\",\"gta3.img/lod_countn2.txd/des_roadedge1.dds\",\n \"gta3.img/lod_countryn.txd/des_dirttrack1rlod.dds\",\"gta3.img/lod_countn2.txd/des_dirttrack1r.dds\",\n \"gta3.img/lod_countryn.txd/des_dirttrackllod.dds\",\"gta3.img/lod_countn2.txd/des_dirttrackl.dds\",\n \"gta3.img/lodvegaswest1.txd/sandgrndlod.dds\",\"gta3.img/lod_countn2.txd/sandgrnd128.dds\",\n \"gta3.img/lodvgswestout.txd/sandgrndlod.dds\",\"gta3.img/lod_countn2.txd/sandgrnd128.dds\",\n \"gta3.img/lodvegaswest2.txd/offwhitebrix_lod.dds\",\"gta3.img/lod_countn2.txd/offwhitebrix.dds\",\n \"gta3.img/lod_countryn.txd/lod_genhall.dds\",\"gta3.img/lod_countn2.txd/lod_genhall.dds\",\n \"gta3.img/lod_sfse.txd/lodgoldengate5.dds\",\"gta3.img/lod_countryn.txd/lodgoldengate5.dds\",\n \"gta3.img/lodvgwstcoast.txd/vgs_railway03_lod.dds\",\"gta3.img/lod_countryn.txd/vgs_railway03_lod.dds\",\n \"gta3.img/vegasnlod4.txd/vgs_railway03_lod.dds\",\"gta3.img/lod_countryn.txd/vgs_railway03_lod.dds\",\n \"gta3.img/lodvegaswest3.txd/block2lod.dds\",\"gta3.img/lod_countryn.txd/block2lod.dds\",\n \"gta3.img/lod_cxrf.txd/redmetal.dds\",\"gta3.img/lod_counxref.txd/redmetal.dds\",\n \"gta3.img/lodcranes_dyn2.txd/lodoldpaintedyello_b.dds\",\"gta3.img/lodcranes_dyn2_cj.txd/lodoldpaintedyello_b.dds\",\n \"gta3.img/lodcranes_dyn2.txd/lodblock2_high.dds\",\"gta3.img/lodcranes_dyn2_cj.txd/lodblock2_high.dds\",\n \"gta3.img/lodcranes_dyn2.txd/lodoldpaintedyello.dds\",\"gta3.img/lodcranes_dyn2_cj.txd/lodoldpaintedyello.dds\",\n \"gta3.img/lod_mount_sfs.txd/des_dirtgrassmix_grass4.dds\",\"gta3.img/lodcunty.txd/des_dirtgrassmix_grass4.dds\",\n \"gta3.img/loddsfn_sfn.txd/sw_sand.dds\",\"gta3.img/lodcunty.txd/sw_sand.dds\",\n \"gta3.img/vegaselod3.txd/sw_sand.dds\",\"gta3.img/lodcunty.txd/sw_sand.dds\",\n \"gta3.img/lod_sfs2.txd/ws_carparknew2.dds\",\"gta3.img/lodcunty.txd/ws_carparknew2.dds\",\n \"gta3.img/lodvgsslod01.txd/ws_carparknew2.dds\",\"gta3.img/lodcunty.txd/ws_carparknew2.dds\",\n \"gta3.img/lodvegaswest2.txd/stonewall3_la.dds\",\"gta3.img/lodcunty.txd/stonewall3_la.dds\",\n \"gta3.img/lodvegaswest2.txd/lodnewall3_la.dds\",\"gta3.img/lodcunty.txd/stonewall3_la.dds\",\n \"gta3.img/lod_sfse3.txd/stones256.dds\",\"gta3.img/lodcunty.txd/stones256.dds\",\n \"gta3.img/lod_sfse2.txd/rocktq128blender.dds\",\"gta3.img/lodcunty.txd/rocktq128blender.dds\",\n \"gta3.img/lod_sfse2.txd/ws_tunnelwall1.dds\",\"gta3.img/lodcunty.txd/ws_tunnelwall1.dds\",\n \"gta3.img/lodtnsfn.txd/lod_trailer6.dds\",\"gta3.img/lod_cxref.txd/lod_trailer6.dds\",\n \"gta3.img/lodtnsfn.txd/lod_traillrg1.dds\",\"gta3.img/lod_cxref.txd/lod_traillrg1.dds\",\n \"gta3.img/lodtnsfn.txd/lod_traillrg2.dds\",\"gta3.img/lod_cxref.txd/lod_traillrg2.dds\",\n \"gta3.img/lod_laxrf.txd/lod_pylon1.dds\",\"gta3.img/lod_cxref.txd/lod_pylon1.dds\",\n \"gta3.img/lod_sfse2.txd/lod_oldpainted2.dds\",\"gta3.img/lod_cxref.txd/lod_oldpainted2.dds\",\n \"gta3.img/lod_las2.txd/las2_concnw.dds\",\"gta3.img/lod_cxref.txd/las2_concnw.dds\",\n \"gta3.img/lod_laxrf.txd/lod_was_sd.dds\",\"gta3.img/lod_cxrf.txd/lod_was_sd.dds\",\n \"gta3.img/lodhuge_lan2.txd/lan2skyscra7_lodb.dds\",\"gta3.img/lod_lan2.txd/lan2skyscra7_lodb.dds\",\n \"gta3.img/lodhuge_lan2.txd/lan2skyscra2_lod.dds\",\"gta3.img/lod_lan2.txd/lan2skyscra2_lod.dds\",\n \"gta3.img/lodhuge_lan2.txd/lan2lodplaza4.dds\",\"gta3.img/lod_lan2.txd/lan2lodplaza4.dds\",\n \"gta3.img/lodvgshangar.txd/wslod_hangar1b.dds\",\"gta3.img/lodhangar_sfsxref.txd/wslod_hangar1b.dds\",\n \"gta3.img/lodvgshangar.txd/wslod_hangar1.dds\",\"gta3.img/lodhangar_sfsxref.txd/wslod_hangar1.dds\",\n \"gta3.img/lod_las2.txd/lan2_scraper02lod.dds\",\"gta3.img/lodhuge_lan2.txd/lan2_scraper02lod.dds\",\n \"gta3.img/lod_laxrf.txd/laxrf_rdwarhusbig.dds\",\"gta3.img/lod_las2.txd/laxrf_rdwarhusbig.dds\",\n \"gta3.img/lod_laxrf.txd/las2_dukwal1.dds\",\"gta3.img/lod_las2.txd/las2_dukwal1.dds\",\n \"gta3.img/lod_laxrf.txd/lod_redmetal.dds\",\"gta3.img/lod_las2.txd/lod_redmetal.dds\",\n \"gta3.img/lodvegaswest3.txd/lodjmscruffwall3.dds\",\"gta3.img/lodlawnland.txd/lasjmscruffwall3lod.dds\",\n \"gta3.img/lod_sfs2.txd/ws_rooftarmac2lod.dds\",\"gta3.img/lodlawnsmall.txd/ws_rooftarmac2lod.dds\",\n \"gta3.img/lod_sfs5.txd/ws_rooftarmac2lod.dds\",\"gta3.img/lodlawnsmall.txd/ws_rooftarmac2lod.dds\",\n \"gta3.img/lod_sfse3.txd/ws_rooftarmac2lod.dds\",\"gta3.img/lodlawnsmall.txd/ws_rooftarmac2lod.dds\",\n \"gta3.img/lod_sfse.txd/ws_rooftarmac2lod.dds\",\"gta3.img/lodlawnsmall.txd/ws_rooftarmac2lod.dds\",\n \"gta3.img/lodvegaswest1.txd/concretenewb256_lod.dds\",\"gta3.img/lodlawnsmall.txd/concretenewb256_lod.dds\",\n \"gta3.img/lodvgsslod02.txd/concretenewb256_lod.dds\",\"gta3.img/lodlawnsmall.txd/concretenewb256_lod.dds\",\n \"gta3.img/lodvgsslod.txd/concretenewb256_lod.dds\",\"gta3.img/lodlawnsmall.txd/concretenewb256_lod.dds\",\n \"gta3.img/lodvgswestout.txd/concretenewb256_lod.dds\",\"gta3.img/lodlawnsmall.txd/concretenewb256_lod.dds\",\n \"gta3.img/vegasnlod1.txd/concretenewb256_lod.dds\",\"gta3.img/lodlawnsmall.txd/concretenewb256_lod.dds\",\n \"gta3.img/vegasnlod4.txd/concretenewb256_lod.dds\",\"gta3.img/lodlawnsmall.txd/concretenewb256_lod.dds\",\n \"gta3.img/lod_sfs4.txd/vgnburger_lod.dds\",\"gta3.img/lodlawnsmall.txd/vgnburger_lod.dds\",\n \"gta3.img/lodvegaswest2.txd/vgnburger_lod.dds\",\"gta3.img/lodlawnsmall.txd/vgnburger_lod.dds\",\n \"gta3.img/lodvegaswest4.txd/vgnburger_lod.dds\",\"gta3.img/lodlawnsmall.txd/vgnburger_lod.dds\",\n \"gta3.img/lod_sfs4.txd/burgershotsign1_lod.dds\",\"gta3.img/lodlawnsmall.txd/burgershotsign1_lod.dds\",\n \"gta3.img/lodvegaswest2.txd/burgershotsign1_lod.dds\",\"gta3.img/lodlawnsmall.txd/burgershotsign1_lod.dds\",\n \"gta3.img/lodvegaswest4.txd/burgershotsign1_lod.dds\",\"gta3.img/lodlawnsmall.txd/burgershotsign1_lod.dds\",\n \"gta3.img/lod_sfs4.txd/vgnburgwal3_lod.dds\",\"gta3.img/lodlawnsmall.txd/vgnburgwal3_lod.dds\",\n \"gta3.img/lodvegaswest2.txd/vgnburgwal3_lod.dds\",\"gta3.img/lodlawnsmall.txd/vgnburgwal3_lod.dds\",\n \"gta3.img/lodvegaswest4.txd/vgnburgwal3_lod.dds\",\"gta3.img/lodlawnsmall.txd/vgnburgwal3_lod.dds\",\n \"gta3.img/lodvgsslod.txd/vgnburgwal3_lod.dds\",\"gta3.img/lodlawnsmall.txd/vgnburgwal3_lod.dds\",\n \"gta3.img/lod_sfs4.txd/gewhite1_lod.dds\",\"gta3.img/lodlawnsmall.txd/gewhite1_lod.dds\",\n \"gta3.img/lodvegaswest2.txd/gewhite1_lod.dds\",\"gta3.img/lodlawnsmall.txd/gewhite1_lod.dds\",\n \"gta3.img/lodvegaswest4.txd/gewhite1_lod.dds\",\"gta3.img/lodlawnsmall.txd/gewhite1_lod.dds\",\n \"gta3.img/lod_sfs4.txd/vgnburgwal5_lod.dds\",\"gta3.img/lodlawnsmall.txd/vgnburgwal5_lod.dds\",\n \"gta3.img/lodvegaswest2.txd/vgnburgwal5_lod.dds\",\"gta3.img/lodlawnsmall.txd/vgnburgwal5_lod.dds\",\n \"gta3.img/lodvegaswest4.txd/vgnburgwal5_lod.dds\",\"gta3.img/lodlawnsmall.txd/vgnburgwal5_lod.dds\",\n \"gta3.img/lod_sfs4.txd/vgnburgwal2_lod.dds\",\"gta3.img/lodlawnsmall.txd/vgnburgwal2_lod.dds\",\n \"gta3.img/lodvegaswest2.txd/vgnburgwal2_lod.dds\",\"gta3.img/lodlawnsmall.txd/vgnburgwal2_lod.dds\",\n \"gta3.img/lodvegaswest4.txd/vgnburgwal2_lod.dds\",\"gta3.img/lodlawnsmall.txd/vgnburgwal2_lod.dds\",\n \"gta3.img/lod_sfs4.txd/vgnburgwal4_lod.dds\",\"gta3.img/lodlawnsmall.txd/vgnburgwal4_lod.dds\",\n \"gta3.img/lodvegaswest2.txd/vgnburgwal4_lod.dds\",\"gta3.img/lodlawnsmall.txd/vgnburgwal4_lod.dds\",\n \"gta3.img/lodvegaswest4.txd/vgnburgwal4_lod.dds\",\"gta3.img/lodlawnsmall.txd/vgnburgwal4_lod.dds\",\n \"gta3.img/lod_sfs4.txd/burgerlod1.dds\",\"gta3.img/lodlawnsmall.txd/burgerlod1.dds\",\n \"gta3.img/lodvegaswest2.txd/burgerlod1.dds\",\"gta3.img/lodlawnsmall.txd/burgerlod1.dds\",\n \"gta3.img/lodvegaswest4.txd/burgerlod1.dds\",\"gta3.img/lodlawnsmall.txd/burgerlod1.dds\",\n \"gta3.img/lod_sfs4.txd/vgnburgwal6_lod.dds\",\"gta3.img/lodlawnsmall.txd/vgnburgwal6_lod.dds\",\n \"gta3.img/lodvegaswest2.txd/vgnburgwal6_lod.dds\",\"gta3.img/lodlawnsmall.txd/vgnburgwal6_lod.dds\",\n \"gta3.img/lodvegaswest4.txd/vgnburgwal6_lod.dds\",\"gta3.img/lodlawnsmall.txd/vgnburgwal6_lod.dds\",\n \"gta3.img/lod_sfs4.txd/genroof01_lod.dds\",\"gta3.img/lodlawnsmall.txd/genroof01_lod.dds\",\n \"gta3.img/lodvegashse5.txd/genroof01_lod.dds\",\"gta3.img/lodlawnsmall.txd/genroof01_lod.dds\",\n \"gta3.img/lodvegaswest2.txd/genroof01_lod.dds\",\"gta3.img/lodlawnsmall.txd/genroof01_lod.dds\",\n \"gta3.img/lodvegaswest4.txd/genroof01_lod.dds\",\"gta3.img/lodlawnsmall.txd/genroof01_lod.dds\",\n \"gta3.img/lod_sfs4.txd/vgnburgwal1_lod.dds\",\"gta3.img/lodlawnsmall.txd/vgnburgwal1_lod.dds\",\n \"gta3.img/lodvegaswest2.txd/vgnburgwal1_lod.dds\",\"gta3.img/lodlawnsmall.txd/vgnburgwal1_lod.dds\",\n \"gta3.img/lodvegaswest4.txd/vgnburgwal1_lod.dds\",\"gta3.img/lodlawnsmall.txd/vgnburgwal1_lod.dds\",\n \"gta3.img/vegaselod1.txd/concretegroundl1_lod.dds\",\"gta3.img/lodlawnsmall.txd/concretegroundl1_lod.dds\",\n \"gta3.img/vegaselod3.txd/concretegroundl1_lod.dds\",\"gta3.img/lodlawnsmall.txd/concretegroundl1_lod.dds\",\n \"gta3.img/lodvgsslod.txd/gb_nastybar03_lod.dds\",\"gta3.img/lodlawnsmall.txd/gb_nastybar03_lod.dds\",\n \"gta3.img/lodvgwstcoast.txd/steel_lod.dds\",\"gta3.img/lod_laxrf.txd/steel_lod.dds\",\n \"gta3.img/vegaselod2.txd/steel_lod.dds\",\"gta3.img/lod_laxrf.txd/steel_lod.dds\",\n \"gta3.img/vegasnlod3.txd/steel_lod.dds\",\"gta3.img/lod_laxrf.txd/steel_lod.dds\",\n \"gta3.img/vegaselod3.txd/vgsefrght02_lod.dds\",\"gta3.img/lod_laxrf.txd/vgsefrght02_lod.dds\",\n \"gta3.img/lod_sfse2.txd/dt_road2grasstype4.dds\",\"gta3.img/lod_mount_sfs.txd/dt_road2grasstype4.dds\",\n \"gta3.img/lod_sfs2.txd/road_junction2.dds\",\"gta3.img/lod_sfe.txd/road_junction2.dds\",\n \"gta3.img/lod_sfs3.txd/road_junction2.dds\",\"gta3.img/lod_sfe.txd/road_junction2.dds\",\n \"gta3.img/lod_sfs4.txd/road_junction2.dds\",\"gta3.img/lod_sfe.txd/road_junction2.dds\",\n \"gta3.img/lod_sfs6.txd/road_junction2.dds\",\"gta3.img/lod_sfe.txd/road_junction2.dds\",\n \"gta3.img/lod_sfs2.txd/road_junction.dds\",\"gta3.img/lod_sfe.txd/road_junction.dds\",\n \"gta3.img/lod_sfs3.txd/road_junction.dds\",\"gta3.img/lod_sfe.txd/road_junction.dds\",\n \"gta3.img/lod_sfs4.txd/road_junction.dds\",\"gta3.img/lod_sfe.txd/road_junction.dds\",\n \"gta3.img/lod_sfs6.txd/road_junction.dds\",\"gta3.img/lod_sfe.txd/road_junction.dds\",\n \"gta3.img/lodtnsfn.txd/roads_sfnlod64.dds\",\"gta3.img/lodsfn.txd/roads_sfnlod64.dds\",\n \"gta3.img/lod_sfs2.txd/lodsfsbeach5.dds\",\"gta3.img/lod_sfs1.txd/lodsfsbeach5.dds\",\n \"gta3.img/lod_sfs3.txd/lodsfsbeach5.dds\",\"gta3.img/lod_sfs1.txd/lodsfsbeach5.dds\",\n \"gta3.img/lod_sfs4.txd/lodsfsbeach5.dds\",\"gta3.img/lod_sfs1.txd/lodsfsbeach5.dds\",\n \"gta3.img/lod_sfs6.txd/lodsfsbeach5.dds\",\"gta3.img/lod_sfs1.txd/lodsfsbeach5.dds\",\n \"gta3.img/lod_sfs4.txd/lodbbgroundbit_sfs01.dds\",\"gta3.img/lod_sfs2.txd/lodbbgroundbit_sfs01.dds\",\n \"gta3.img/vegaselod2.txd/ws_altz_wall10_lod.dds\",\"gta3.img/lod_sfs2.txd/ws_altz_wall10_lod.dds\",\n \"gta3.img/lod_sfs3.txd/lod_queenshop7.dds\",\"gta3.img/lod_sfs2.txd/lod_queenshop7.dds\",\n \"gta3.img/lod_sfs3.txd/lod_queenshop3.dds\",\"gta3.img/lod_sfs2.txd/lod_queenshop3.dds\",\n \"gta3.img/lod_sfs3.txd/lod_queenapt11.dds\",\"gta3.img/lod_sfs2.txd/lod_queenapt11.dds\",\n \"gta3.img/lod_sfs3.txd/lod_queenapt03.dds\",\"gta3.img/lod_sfs2.txd/lod_queenapt03.dds\",\n \"gta3.img/lod_sfs3.txd/lod_queenapt12.dds\",\"gta3.img/lod_sfs2.txd/lod_queenapt12.dds\",\n \"gta3.img/lod_sfs3.txd/lod_queenapt09.dds\",\"gta3.img/lod_sfs2.txd/lod_queenapt09.dds\",\n \"gta3.img/lod_sfs3.txd/lod_queenapt13.dds\",\"gta3.img/lod_sfs2.txd/lod_queenapt13.dds\",\n \"gta3.img/lod_sfs3.txd/lod_queenapt07.dds\",\"gta3.img/lod_sfs2.txd/lod_queenapt07.dds\",\n \"gta3.img/lod_sfs3.txd/lod_queenapt02.dds\",\"gta3.img/lod_sfs2.txd/lod_queenapt02.dds\",\n \"gta3.img/lod_sfs3.txd/lod_queenapt08.dds\",\"gta3.img/lod_sfs2.txd/lod_queenapt08.dds\",\n \"gta3.img/lod_sfs3.txd/lod_queenapt10.dds\",\"gta3.img/lod_sfs2.txd/lod_queenapt10.dds\",\n \"gta3.img/lod_sfse.txd/wslod_elecfence.dds\",\"gta3.img/lod_sfs2.txd/wslod_elecfence.dds\",\n \"gta3.img/lod_sfse.txd/whitebuildsfselongb.dds\",\"gta3.img/lod_sfs2.txd/whitebuildsfselongb.dds\",\n \"gta3.img/lod_sfse.txd/ws_coppersheetlod.dds\",\"gta3.img/lod_sfs2.txd/ws_coppersheetlod.dds\",\n \"gta3.img/lod_sfse.txd/whitebuildsfselong.dds\",\"gta3.img/lod_sfs2.txd/whitebuildsfselong.dds\",\n \"gta3.img/lod_sfs4.txd/lodshoppie6_sfs05c.dds\",\"gta3.img/lod_sfs2.txd/lodshoppie6_sfs05c.dds\",\n \"gta3.img/lod_sfs4.txd/lodshoppie6_sfs05b.dds\",\"gta3.img/lod_sfs2.txd/lodshoppie6_sfs05b.dds\",\n \"gta3.img/lod_sfs4.txd/lodsfshoppie6a_cm04.dds\",\"gta3.img/lod_sfs2.txd/lodsfshoppie6a_cm04.dds\",\n \"gta3.img/lod_sfs3.txd/wslodsub_pen_conc2.dds\",\"gta3.img/lod_sfs2.txd/wslodsub_pen_conc2.dds\",\n \"gta3.img/lod_sfs4.txd/wslodsub_pen_conc2.dds\",\"gta3.img/lod_sfs2.txd/wslodsub_pen_conc2.dds\",\n \"gta3.img/lod_sfse69.txd/wslodsub_pen_conc2.dds\",\"gta3.img/lod_sfs2.txd/wslodsub_pen_conc2.dds\",\n \"gta3.img/lod_sfse.txd/wslodsub_pen_conc2.dds\",\"gta3.img/lod_sfs2.txd/wslodsub_pen_conc2.dds\",\n \"gta3.img/lod_sfs3.txd/asfsssjm1.dds\",\"gta3.img/lod_sfs2.txd/asfsssjm1.dds\",\n \"gta3.img/vegasnlod1.txd/vgndwntwnshop1b_lod.dds\",\"gta3.img/lod_sfs3.txd/vgndwntwnshop1b_lod.dds\",\n \"gta3.img/vegasnlod1.txd/vgndwntwnshop1_lod.dds\",\"gta3.img/lod_sfs3.txd/vgndwntwnshop1_lod.dds\",\n \"gta3.img/lod_sfs6.txd/lodeyfuckingway_sfs.dds\",\"gta3.img/lod_sfs3.txd/lodeyfuckingway_sfs.dds\",\n \"gta3.img/lod_sfs6.txd/lod_freewayroads.dds\",\"gta3.img/lod_sfs4.txd/lod_freewayroads.dds\",\n \"gta3.img/lod_sfse2.txd/lod_freewayroads.dds\",\"gta3.img/lod_sfs4.txd/lod_freewayroads.dds\",\n \"gta3.img/lod_sfse3.txd/lod_freewayroads.dds\",\"gta3.img/lod_sfs4.txd/lod_freewayroads.dds\",\n \"gta3.img/lod_sfse.txd/lod_freewayroads.dds\",\"gta3.img/lod_sfs4.txd/lod_freewayroads.dds\",\n \"gta3.img/lod_sfs6.txd/lodtunnelwall2.dds\",\"gta3.img/lod_sfs4.txd/lodtunnelwall2.dds\",\n \"gta3.img/lod_sfse.txd/lodtunnelwall2.dds\",\"gta3.img/lod_sfs4.txd/lodtunnelwall2.dds\",\n \"gta3.img/lod_sfse.txd/lodtunnel.dds\",\"gta3.img/lod_sfse2.txd/lodtunnel.dds\",\n \"gta3.img/lod_sfse.txd/lod_rail.dds\",\"gta3.img/lod_sfse2.txd/lod_rail.dds\",\n \"gta3.img/lodvgsslod02.txd/desgrasandblend_lod.dds\",\"gta3.img/lod_sfse2.txd/desgrasandblend_lod.dds\",\n \"gta3.img/lod_sfse.txd/ws_rotten_concrete1lod.dds\",\"gta3.img/lod_sfse2.txd/ws_rotten_concrete1lod.dds\",\n \"gta3.img/lod_sfse3.txd/gb_nastybar20lod.dds\",\"gta3.img/lod_sfse2.txd/gb_nastybar20lod.dds\",\n \"gta3.img/lod_sfse3.txd/wslod_seawall1.dds\",\"gta3.img/lod_sfse2.txd/wslod_seawall1.dds\",\n \"gta3.img/lod_sfse69.txd/wslod_seawall1.dds\",\"gta3.img/lod_sfse2.txd/wslod_seawall1.dds\",\n \"gta3.img/lod_sfse3.txd/wslodairpt_concrete.dds\",\"gta3.img/lod_sfse2.txd/wslodairpt_concrete.dds\",\n \"gta3.img/lod_sfse3.txd/ws_freeway1.dds\",\"gta3.img/lod_sfse2.txd/ws_freeway1.dds\",\n \"gta3.img/lod_sfse.txd/ws_freeway1.dds\",\"gta3.img/lod_sfse2.txd/ws_freeway1.dds\",\n \"gta3.img/lod_sfse3.txd/lod_freewaysliproads.dds\",\"gta3.img/lod_sfse2.txd/lod_freewaysliproads.dds\",\n \"gta3.img/lod_sfse.txd/lod_freewaysliproads.dds\",\"gta3.img/lod_sfse2.txd/lod_freewaysliproads.dds\",\n \"gta3.img/lod_sfse3.txd/lod_freewayconcrete.dds\",\"gta3.img/lod_sfse2.txd/lod_freewayconcrete.dds\",\n \"gta3.img/lod_sfse.txd/lod_freewayconcrete.dds\",\"gta3.img/lod_sfse2.txd/lod_freewayconcrete.dds\",\n \"gta3.img/lod_sfse.txd/lodhubgrgesfse02.dds\",\"gta3.img/lod_sfse3.txd/lodhubgrgesfse02.dds\",\n \"gta3.img/lod_sfse.txd/lodhubgrgesfse01.dds\",\"gta3.img/lod_sfse3.txd/lodhubgrgesfse01.dds\",\n \"gta3.img/lodvgsslod.txd/dustyconcrete_lod.dds\",\"gta3.img/lod_sfse3.txd/dustyconcrete_lod.dds\",\n \"gta3.img/lod_sfse.txd/bluebuildsfse.dds\",\"gta3.img/lod_sfse3.txd/bluebuildsfse.dds\",\n \"gta3.img/lod_sfse.txd/berigelodsfse.dds\",\"gta3.img/lod_sfse3.txd/berigelodsfse.dds\",\n \"gta3.img/lod_sfse.txd/redbuildsfselod.dds\",\"gta3.img/lod_sfse3.txd/redbuildsfselod.dds\",\n \"gta3.img/lod_sfse.txd/ws_asphaltlod.dds\",\"gta3.img/lod_sfse3.txd/ws_asphaltlod.dds\",\n \"gta3.img/lod_sfse69.txd/lod_wsdocksides.dds\",\"gta3.img/lod_sfse3.txd/lod_wsdocksides.dds\",\n \"gta3.img/lod_sfse.txd/lod_wsdocksides.dds\",\"gta3.img/lod_sfse3.txd/lod_wsdocksides.dds\",\n \"gta3.img/lod_sfse69.txd/wslod_seawall2.dds\",\"gta3.img/lod_sfse3.txd/wslod_seawall2.dds\",\n \"gta3.img/lod_sfse.txd/wslod_seawall2.dds\",\"gta3.img/lod_sfse3.txd/wslod_seawall2.dds\",\n \"gta3.img/lod_sfse.txd/lod_cracktanks.dds\",\"gta3.img/lod_sfse3.txd/lod_cracktanks.dds\",\n \"gta3.img/lod_sfse.txd/sjmsfse1.dds\",\"gta3.img/lod_sfse69.txd/sjmsfse1.dds\",\n \"gta3.img/lod_sfse.txd/wslod_sub_pen_conc3.dds\",\"gta3.img/lod_sfse69.txd/wslod_sub_pen_conc3.dds\",\n \"gta3.img/lodvgsslod02.txd/heliconcrete.dds\",\"gta3.img/lodtnsfn.txd/heliconcrete.dds\",\n \"gta3.img/lodvgwstcoast.txd/vegasxrefhse11.dds\",\"gta3.img/lodvegashse5.txd/vegasxrefhse11.dds\",\n \"gta3.img/lodvgwstcoast.txd/vegasxrefhse12.dds\",\"gta3.img/lodvegashse5.txd/vegasxrefhse12.dds\",\n \"gta3.img/lodvgwstcoast.txd/vegasxrefhse17.dds\",\"gta3.img/lodvegashse5.txd/vegasxrefhse17.dds\",\n \"gta3.img/lodvgwstcoast.txd/vegasxrefhse10.dds\",\"gta3.img/lodvegashse5.txd/vegasxrefhse10.dds\",\n \"gta3.img/lodvgwstcoast.txd/shingles4_128.dds\",\"gta3.img/lodvegashse5.txd/shingles4_128.dds\",\n \"gta3.img/lodvegassvehse5.txd/vegasxrefhse3.dds\",\"gta3.img/lodvegashse5.txd/vegasxrefhse3.dds\",\n \"gta3.img/lodvegassvehse5.txd/shingles1_lod.dds\",\"gta3.img/lodvegashse5.txd/shingles1_lod.dds\",\n \"gta3.img/lodvegaswest3.txd/genroof02_lod.dds\",\"gta3.img/lodvegashse5.txd/genroof02_lod.dds\",\n \"gta3.img/lodvegaswest4.txd/genroof02_lod.dds\",\"gta3.img/lodvegashse5.txd/genroof02_lod.dds\",\n \"gta3.img/lodxrefhse1.txd/genroof02_lod.dds\",\"gta3.img/lodvegashse5.txd/genroof02_lod.dds\",\n \"gta3.img/vegaselod2.txd/genroof02_lod.dds\",\"gta3.img/lodvegashse5.txd/genroof02_lod.dds\",\n \"gta3.img/vegaselod3.txd/genroof02_lod.dds\",\"gta3.img/lodvegashse5.txd/genroof02_lod.dds\",\n \"gta3.img/vegashselod1.txd/genroof02_lod.dds\",\"gta3.img/lodvegashse5.txd/genroof02_lod.dds\",\n \"gta3.img/lodvegassvehse5.txd/badhousewall01_lod.dds\",\"gta3.img/lodvegashse5.txd/badhousewall01_lod.dds\",\n \"gta3.img/lodvegaswest4.txd/lodhousewall01_128.dds\",\"gta3.img/lodvegashse5.txd/badhousewall01_lod.dds\",\n \"gta3.img/lodvgsslod02.txd/badhousewall01_lod.dds\",\"gta3.img/lodvegashse5.txd/badhousewall01_lod.dds\",\n \"gta3.img/lodvgswestout.txd/badhousewall01_lod.dds\",\"gta3.img/lodvegashse5.txd/badhousewall01_lod.dds\",\n \"gta3.img/lodvgwstcoast.txd/badhousewall01_lod.dds\",\"gta3.img/lodvegashse5.txd/badhousewall01_lod.dds\",\n \"gta3.img/vegaselod3.txd/lodhousewall01_128.dds\",\"gta3.img/lodvegashse5.txd/badhousewall01_lod.dds\",\n \"gta3.img/vegashselod1.txd/lodhousewall01_128.dds\",\"gta3.img/lodvegashse5.txd/badhousewall01_lod.dds\",\n \"gta3.img/lodvegaswest3.txd/blueroof_lod.dds\",\"gta3.img/lodvegashse5.txd/blueroof_lod.dds\",\n \"gta3.img/lodvgswestout.txd/blueroof_lod.dds\",\"gta3.img/lodvegashse5.txd/blueroof_lod.dds\",\n \"gta3.img/lodxrefhse1.txd/blueroof_lod.dds\",\"gta3.img/lodvegashse5.txd/blueroof_lod.dds\",\n \"gta3.img/vegaselod3.txd/blueroof_lod.dds\",\"gta3.img/lodvegashse5.txd/blueroof_lod.dds\",\n \"gta3.img/vegasnlod4.txd/blueroof_lod.dds\",\"gta3.img/lodvegashse5.txd/blueroof_lod.dds\",\n \"gta3.img/lodvegaswest2.txd/lod_hedge1_256.dds\",\"gta3.img/lodvegashse5.txd/lod_hedge1_256.dds\",\n \"gta3.img/lodvegaswest3.txd/lod_hedge1_256.dds\",\"gta3.img/lodvegashse5.txd/lod_hedge1_256.dds\",\n \"gta3.img/lodvgswestout.txd/lod_hedge1_256.dds\",\"gta3.img/lodvegashse5.txd/lod_hedge1_256.dds\",\n \"gta3.img/lodvgwstcoast.txd/rooftiles1_lod.dds\",\"gta3.img/lodvegashse5.txd/rooftiles1_lod.dds\",\n \"gta3.img/vegaselod2.txd/rooftiles1_lod.dds\",\"gta3.img/lodvegashse5.txd/rooftiles1_lod.dds\",\n \"gta3.img/lodvegaswest3.txd/lodwrehse15_lod.dds\",\"gta3.img/lodvegashse5.txd/lodwrehse15_lod.dds\",\n \"gta3.img/lodvegassvehse5.txd/vegasxrefhse5.dds\",\"gta3.img/lodvegashse5.txd/vegasxrefhse5.dds\",\n \"gta3.img/lodvegassvehse5.txd/vegasxrefhse1.dds\",\"gta3.img/lodvegashse5.txd/vegasxrefhse1.dds\",\n \"gta3.img/stripxreflod.txd/vegasvisagesign1.dds\",\"gta3.img/lodvegaswest1.txd/vegasvisagesign1.dds\",\n \"gta3.img/lodvegaswest3.txd/banditsign_lod.dds\",\"gta3.img/lodvegaswest1.txd/banditsign_lod.dds\",\n \"gta3.img/lodvgswestout.txd/banditsign_lod.dds\",\"gta3.img/lodvegaswest1.txd/banditsign_lod.dds\",\n \"gta3.img/lodvgsslod02.txd/lod_sub_pen_conc.dds\",\"gta3.img/lodvegaswest1.txd/lod_sub_pen_conc.dds\",\n \"gta3.img/lodvgswestout.txd/lod_sub_pen_conc.dds\",\"gta3.img/lodvegaswest1.txd/lod_sub_pen_conc.dds\",\n \"gta3.img/vegaselod2.txd/lod_sub_pen_conc.dds\",\"gta3.img/lodvegaswest1.txd/lod_sub_pen_conc.dds\",\n \"gta3.img/vegaselod3.txd/lod_sub_pen_conc.dds\",\"gta3.img/lodvegaswest1.txd/lod_sub_pen_conc.dds\",\n \"gta3.img/lodvgsslod02.txd/highshopwall1lod.dds\",\"gta3.img/lodvegaswest1.txd/highshopwall1lod.dds\",\n \"gta3.img/lodvgswestout.txd/highshopwall1lod.dds\",\"gta3.img/lodvegaswest1.txd/highshopwall1lod.dds\",\n \"gta3.img/vegaselod2.txd/highshopwall1lod.dds\",\"gta3.img/lodvegaswest1.txd/highshopwall1lod.dds\",\n \"gta3.img/vegaselod3.txd/highshopwall1lod.dds\",\"gta3.img/lodvegaswest1.txd/highshopwall1lod.dds\",\n \"gta3.img/lodvgswestout.txd/ap_tarmaclod.dds\",\"gta3.img/lodvegaswest1.txd/ap_tarmaclod.dds\",\n \"gta3.img/lodvegaswest2.txd/grass_lod.dds\",\"gta3.img/lodvegaswest1.txd/grass_lod.dds\",\n \"gta3.img/lodvegaswest3.txd/grass_lod.dds\",\"gta3.img/lodvegaswest1.txd/grass_lod.dds\",\n \"gta3.img/lodvgswestout.txd/grass_lod.dds\",\"gta3.img/lodvegaswest1.txd/grass_lod.dds\",\n \"gta3.img/vegashselod1.txd/grass_lod.dds\",\"gta3.img/lodvegaswest1.txd/grass_lod.dds\",\n \"gta3.img/lodvegaswest2.txd/bow_church_grass_lod.dds\",\"gta3.img/lodvegaswest1.txd/bow_church_grass_lod.dds\",\n \"gta3.img/lodvgsslod01.txd/bow_church_grass_lod.dds\",\"gta3.img/lodvegaswest1.txd/bow_church_grass_lod.dds\",\n \"gta3.img/lodvgswestout.txd/bow_church_grass_lod.dds\",\"gta3.img/lodvegaswest1.txd/bow_church_grass_lod.dds\",\n \"gta3.img/lodvgwstcoast.txd/bow_church_grass_lod.dds\",\"gta3.img/lodvegaswest1.txd/bow_church_grass_lod.dds\",\n \"gta3.img/vegasnlod4.txd/bow_church_grass_lod.dds\",\"gta3.img/lodvegaswest1.txd/bow_church_grass_lod.dds\",\n \"gta3.img/lodvgsslod01.txd/hiwaygravel1_lod.dds\",\"gta3.img/lodvegaswest1.txd/hiwaygravel1_lod.dds\",\n \"gta3.img/lodvgsslod02.txd/hiwaygravel1_lod.dds\",\"gta3.img/lodvegaswest1.txd/hiwaygravel1_lod.dds\",\n \"gta3.img/lodvgsslod.txd/hiwaygravel1_lod.dds\",\"gta3.img/lodvegaswest1.txd/hiwaygravel1_lod.dds\",\n \"gta3.img/lodvgswestout.txd/hiwaygravel1_lod.dds\",\"gta3.img/lodvegaswest1.txd/hiwaygravel1_lod.dds\",\n \"gta3.img/vegasnlod4.txd/hiwaygravel1_lod.dds\",\"gta3.img/lodvegaswest1.txd/hiwaygravel1_lod.dds\",\n \"gta3.img/lodvgsslod01.txd/vgsroad02c_lod.dds\",\"gta3.img/lodvegaswest1.txd/vgsroad02c_lod.dds\",\n \"gta3.img/lodvgswestout.txd/vgsroad02c_lod.dds\",\"gta3.img/lodvegaswest1.txd/vgsroad02c_lod.dds\",\n \"gta3.img/vegaselod3.txd/vgsroad02c_lod.dds\",\"gta3.img/lodvegaswest1.txd/vgsroad02c_lod.dds\",\n \"gta3.img/vegasnlod1.txd/vgsroad02c_lod.dds\",\"gta3.img/lodvegaswest1.txd/vgsroad02c_lod.dds\",\n \"gta3.img/vegasnlod4.txd/vgsroad02c_lod.dds\",\"gta3.img/lodvegaswest1.txd/vgsroad02c_lod.dds\",\n \"gta3.img/lodvgsslod01.txd/vgsroad02_lod.dds\",\"gta3.img/lodvegaswest1.txd/vgsroad02_lod.dds\",\n \"gta3.img/lodvgsslod02.txd/vgsroad02_lod.dds\",\"gta3.img/lodvegaswest1.txd/vgsroad02_lod.dds\",\n \"gta3.img/lodvgsslod.txd/vgsroad02_lod.dds\",\"gta3.img/lodvegaswest1.txd/vgsroad02_lod.dds\",\n \"gta3.img/lodvgswestout.txd/vgsroad02_lod.dds\",\"gta3.img/lodvegaswest1.txd/vgsroad02_lod.dds\",\n \"gta3.img/vegaselod3.txd/vgsroad02_lod.dds\",\"gta3.img/lodvegaswest1.txd/vgsroad02_lod.dds\",\n \"gta3.img/vegaselod2.txd/striproadlod1_64.dds\",\"gta3.img/lodvegaswest1.txd/striproadlod1_64.dds\",\n \"gta3.img/lodvgsslod01.txd/vgstjunction01_lod.dds\",\"gta3.img/lodvegaswest1.txd/vgstjunction01_lod.dds\",\n \"gta3.img/lodvgsslod02.txd/vgstjunction01_lod.dds\",\"gta3.img/lodvegaswest1.txd/vgstjunction01_lod.dds\",\n \"gta3.img/lodvgsslod.txd/vgstjunction01_lod.dds\",\"gta3.img/lodvegaswest1.txd/vgstjunction01_lod.dds\",\n \"gta3.img/lodvgswestout.txd/vgstjunction01_lod.dds\",\"gta3.img/lodvegaswest1.txd/vgstjunction01_lod.dds\",\n \"gta3.img/vegaselod2.txd/vgstjunction01_lod.dds\",\"gta3.img/lodvegaswest1.txd/vgstjunction01_lod.dds\",\n \"gta3.img/vegaselod3.txd/vgstjunction01_lod.dds\",\"gta3.img/lodvegaswest1.txd/vgstjunction01_lod.dds\",\n \"gta3.img/vegasnlod1.txd/vgstjunction01_lod.dds\",\"gta3.img/lodvegaswest1.txd/vgstjunction01_lod.dds\",\n \"gta3.img/vegasnlod4.txd/vgstjunction01_lod.dds\",\"gta3.img/lodvegaswest1.txd/vgstjunction01_lod.dds\",\n \"gta3.img/lodvegaswest3.txd/dryhedge_lod.dds\",\"gta3.img/lodvegaswest2.txd/dryhedge_lod.dds\",\n \"gta3.img/lodvegaswest3.txd/yardgrass1_lod.dds\",\"gta3.img/lodvegaswest2.txd/yardgrass1_lod.dds\",\n \"gta3.img/lodvgswestout.txd/yardgrass1_lod.dds\",\"gta3.img/lodvegaswest2.txd/yardgrass1_lod.dds\",\n \"gta3.img/lodvgsxref1.txd/yardgrass1_lod.dds\",\"gta3.img/lodvegaswest2.txd/yardgrass1_lod.dds\",\n \"gta3.img/lodvgwstcoast.txd/yardgrass1_lod.dds\",\"gta3.img/lodvegaswest2.txd/yardgrass1_lod.dds\",\n \"gta3.img/vegasnlod1.txd/yardgrass1_lod.dds\",\"gta3.img/lodvegaswest2.txd/yardgrass1_lod.dds\",\n \"gta3.img/lodvegaswest3.txd/ws_carparknew2lod.dds\",\"gta3.img/lodvegaswest2.txd/ws_carparknew2lod.dds\",\n \"gta3.img/lodvegaswest4.txd/lodcarparknew2.dds\",\"gta3.img/lodvegaswest2.txd/ws_carparknew2lod.dds\",\n \"gta3.img/lodvgswestout.txd/ws_carparknew2lod.dds\",\"gta3.img/lodvegaswest2.txd/ws_carparknew2lod.dds\",\n \"gta3.img/lodvegaswest3.txd/roof01llod.dds\",\"gta3.img/lodvegaswest2.txd/roof01llod.dds\",\n \"gta3.img/lodvgsxref1.txd/roof01llod.dds\",\"gta3.img/lodvegaswest2.txd/roof01llod.dds\",\n \"gta3.img/lodvgwstcoast.txd/roof01llod.dds\",\"gta3.img/lodvegaswest2.txd/roof01llod.dds\",\n \"gta3.img/lodvegaswest3.txd/roof01l256_lod.dds\",\"gta3.img/lodvegaswest2.txd/roof01l256_lod.dds\",\n \"gta3.img/lodvgswestout.txd/roof01l256_lod.dds\",\"gta3.img/lodvegaswest2.txd/roof01l256_lod.dds\",\n \"gta3.img/vegasnlod4.txd/roof01l256_lod.dds\",\"gta3.img/lodvegaswest2.txd/roof01l256_lod.dds\",\n \"gta3.img/vgsn_motel_lod.txd/roof01l256_lod.dds\",\"gta3.img/lodvegaswest2.txd/roof01l256_lod.dds\",\n \"gta3.img/lodvegaswest4.txd/courthsewin2_lod.dds\",\"gta3.img/lodvegaswest2.txd/courthsewin2_lod.dds\",\n \"gta3.img/vegasnlod4.txd/vgnlowbuild3_lod.dds\",\"gta3.img/lodvegaswest2.txd/vgnlowbuild3_lod.dds\",\n \"gta3.img/lodvegaswest3.txd/lodalleywall3.dds\",\"gta3.img/lodvegaswest2.txd/lodalleywall3.dds\",\n \"gta3.img/lodvegaswest4.txd/lodalleywall3.dds\",\"gta3.img/lodvegaswest2.txd/lodalleywall3.dds\",\n \"gta3.img/lodvgswestout.txd/lodalleywall3.dds\",\"gta3.img/lodvegaswest2.txd/lodalleywall3.dds\",\n \"gta3.img/lodvegaswest3.txd/lod_abattoir_conc2.dds\",\"gta3.img/lodvegaswest2.txd/lod_abattoir_conc2.dds\",\n \"gta3.img/lodvegaswest3.txd/lodhse6_128.dds\",\"gta3.img/lodvegaswest2.txd/lodhse6_128.dds\",\n \"gta3.img/lodvegaswest4.txd/lodroof09l256.dds\",\"gta3.img/lodvegaswest2.txd/lodroof09l256.dds\",\n \"gta3.img/lodvgsslod.txd/lodroof09l256.dds\",\"gta3.img/lodvegaswest2.txd/lodroof09l256.dds\",\n \"gta3.img/lodvgswestout.txd/bluapartwall1_lod.dds\",\"gta3.img/lodvegaswest2.txd/bluapartwall1_lod.dds\",\n \"gta3.img/vegashselod1.txd/bluapartwall1_lod.dds\",\"gta3.img/lodvegaswest2.txd/bluapartwall1_lod.dds\",\n \"gta3.img/lodvegaswest3.txd/vgndwntwnrf1_lod.dds\",\"gta3.img/lodvegaswest2.txd/vgndwntwnrf1_lod.dds\",\n \"gta3.img/lodvgswestout.txd/vgndwntwnrf1_lod.dds\",\"gta3.img/lodvegaswest2.txd/vgndwntwnrf1_lod.dds\",\n \"gta3.img/lodvegaswest3.txd/lodeywall2.dds\",\"gta3.img/lodvegaswest2.txd/lodeywall2.dds\",\n \"gta3.img/lodvegaswest3.txd/roof04llod.dds\",\"gta3.img/lodvegaswest2.txd/roof04llod.dds\",\n \"gta3.img/vegashselod1.txd/roof04llod.dds\",\"gta3.img/lodvegaswest2.txd/roof04llod.dds\",\n \"gta3.img/lodvegaswest3.txd/redshade2_lod.dds\",\"gta3.img/lodvegaswest2.txd/redshade2_lod.dds\",\n \"gta3.img/lodvegaswest3.txd/vgndwntwnrf2_lod.dds\",\"gta3.img/lodvegaswest2.txd/vgndwntwnrf2_lod.dds\",\n \"gta3.img/lodvgsslod01.txd/ws_carparknew2_lod.dds\",\"gta3.img/lodvegaswest2.txd/ws_carparknew2_lod.dds\",\n \"gta3.img/lodvgsslod.txd/ws_carparknew2_lod.dds\",\"gta3.img/lodvegaswest2.txd/ws_carparknew2_lod.dds\",\n \"gta3.img/lodvgswestout.txd/ws_carparknew2_lod.dds\",\"gta3.img/lodvegaswest2.txd/ws_carparknew2_lod.dds\",\n \"gta3.img/lodvgwstcoast.txd/ws_carparknew2_lod.dds\",\"gta3.img/lodvegaswest2.txd/ws_carparknew2_lod.dds\",\n \"gta3.img/shamcparklod.txd/ws_carparknew2_lod.dds\",\"gta3.img/lodvegaswest2.txd/ws_carparknew2_lod.dds\",\n \"gta3.img/vegasnlod1.txd/ws_carparknew2_lod.dds\",\"gta3.img/lodvegaswest2.txd/ws_carparknew2_lod.dds\",\n \"gta3.img/vegasnlod4.txd/ws_carparknew2_lod.dds\",\"gta3.img/lodvegaswest2.txd/ws_carparknew2_lod.dds\",\n \"gta3.img/lodvgsslod02.txd/vgnhsewall1_lod.dds\",\"gta3.img/lodvegaswest3.txd/vgnhsewall1_lod.dds\",\n \"gta3.img/lodvgswestout.txd/vgnhsewall1_lod.dds\",\"gta3.img/lodvegaswest3.txd/vgnhsewall1_lod.dds\",\n \"gta3.img/lodvegaswest4.txd/redstones01_lod.dds\",\"gta3.img/lodvegaswest3.txd/redstones01_lod.dds\",\n \"gta3.img/lodvgsslod02.txd/redstones01_lod.dds\",\"gta3.img/lodvegaswest3.txd/redstones01_lod.dds\",\n \"gta3.img/vegaselod3.txd/redstones01_lod.dds\",\"gta3.img/lodvegaswest3.txd/redstones01_lod.dds\",\n \"gta3.img/vegashselod1.txd/redstones01_lod.dds\",\"gta3.img/lodvegaswest3.txd/redstones01_lod.dds\",\n \"gta3.img/lodvegaswest4.txd/badhousewallc01_lod.dds\",\"gta3.img/lodvegaswest3.txd/badhousewallc01_lod.dds\",\n \"gta3.img/vegaselod3.txd/badhousewallc01_lod.dds\",\"gta3.img/lodvegaswest3.txd/badhousewallc01_lod.dds\",\n \"gta3.img/vegashselod1.txd/badhousewallc01_lod.dds\",\"gta3.img/lodvegaswest3.txd/badhousewallc01_lod.dds\",\n \"gta3.img/lodvegaswest4.txd/lodasheddoor2.dds\",\"gta3.img/lodvegaswest3.txd/lodasheddoor2.dds\",\n \"gta3.img/vegaselod3.txd/lodasheddoor2.dds\",\"gta3.img/lodvegaswest3.txd/lodasheddoor2.dds\",\n \"gta3.img/vegashselod1.txd/lodasheddoor2.dds\",\"gta3.img/lodvegaswest3.txd/lodasheddoor2.dds\",\n \"gta3.img/lodvegaswest4.txd/badhousegttrng03_lod.dds\",\"gta3.img/lodvegaswest3.txd/badhousegttrng03_lod.dds\",\n \"gta3.img/vegaselod3.txd/badhousegttrng03_lod.dds\",\"gta3.img/lodvegaswest3.txd/badhousegttrng03_lod.dds\",\n \"gta3.img/vegashselod1.txd/badhousegttrng03_lod.dds\",\"gta3.img/lodvegaswest3.txd/badhousegttrng03_lod.dds\",\n \"gta3.img/lodvegaswest4.txd/venbuildwh_law2lod.dds\",\"gta3.img/lodvegaswest3.txd/venbuildwh_law2lod.dds\",\n \"gta3.img/vegaselod3.txd/venbuildwh_law2lod.dds\",\"gta3.img/lodvegaswest3.txd/venbuildwh_law2lod.dds\",\n \"gta3.img/vegashselod1.txd/venbuildwh_law2lod.dds\",\"gta3.img/lodvegaswest3.txd/venbuildwh_law2lod.dds\",\n \"gta3.img/lodvegaswest4.txd/badhousewallb02_lod.dds\",\"gta3.img/lodvegaswest3.txd/badhousewallb02_lod.dds\",\n \"gta3.img/vegaselod3.txd/badhousewallb02_lod.dds\",\"gta3.img/lodvegaswest3.txd/badhousewallb02_lod.dds\",\n \"gta3.img/vegashselod1.txd/badhousewallb02_lod.dds\",\"gta3.img/lodvegaswest3.txd/badhousewallb02_lod.dds\",\n \"gta3.img/lodvegaswest4.txd/badhousewallb01_lod.dds\",\"gta3.img/lodvegaswest3.txd/badhousewallb01_lod.dds\",\n \"gta3.img/vegaselod3.txd/badhousewallb01_lod.dds\",\"gta3.img/lodvegaswest3.txd/badhousewallb01_lod.dds\",\n \"gta3.img/vegashselod1.txd/badhousewallb01_lod.dds\",\"gta3.img/lodvegaswest3.txd/badhousewallb01_lod.dds\",\n \"gta3.img/vegashselod1.txd/lodneatwoodfence.dds\",\"gta3.img/lodvegaswest3.txd/lodneatwoodfence.dds\",\n \"gta3.img/vegaselod3.txd/lodhousewal1.dds\",\"gta3.img/lodvegaswest3.txd/lodhousewal1.dds\",\n \"gta3.img/vegashselod1.txd/lodhousewal1.dds\",\"gta3.img/lodvegaswest3.txd/lodhousewal1.dds\",\n \"gta3.img/vegashselod1.txd/villagreenlodlod.dds\",\"gta3.img/lodvegaswest3.txd/villagreenlodlod.dds\",\n \"gta3.img/vegashselod1.txd/badhousewalld05_lod.dds\",\"gta3.img/lodvegaswest3.txd/badhousewalld05_lod.dds\",\n \"gta3.img/vegashselod1.txd/pinkwall01_lod.dds\",\"gta3.img/lodvegaswest3.txd/pinkwall01_lod.dds\",\n \"gta3.img/vegashselod1.txd/badhousewalld04_lod.dds\",\"gta3.img/lodvegaswest3.txd/badhousewalld04_lod.dds\",\n \"gta3.img/vegashselod1.txd/badhousewalld02_lod.dds\",\"gta3.img/lodvegaswest3.txd/badhousewalld02_lod.dds\",\n \"gta3.img/vegashselod1.txd/badhousewalld01_lod.dds\",\"gta3.img/lodvegaswest3.txd/badhousewalld01_lod.dds\",\n \"gta3.img/lodvegaswest4.txd/ws_alley2_lod_plain.dds\",\"gta3.img/lodvegaswest3.txd/ws_alley2_lod_plain.dds\",\n \"gta3.img/vegaselod3.txd/ws_alley2_lod_plain.dds\",\"gta3.img/lodvegaswest3.txd/ws_alley2_lod_plain.dds\",\n \"gta3.img/vegashselod1.txd/ws_alley2_lod_plain.dds\",\"gta3.img/lodvegaswest3.txd/ws_alley2_lod_plain.dds\",\n \"gta3.img/vegaselod3.txd/vgstrainstation3_lod.dds\",\"gta3.img/lodvegaswest3.txd/vgstrainstation3_lod.dds\",\n \"gta3.img/lodvgsslod01.txd/des_dirt1_lod.dds\",\"gta3.img/lodvegaswest3.txd/des_dirt1_lod.dds\",\n \"gta3.img/lodvgsslod02.txd/des_dirt1_lod.dds\",\"gta3.img/lodvegaswest3.txd/des_dirt1_lod.dds\",\n \"gta3.img/lodvgsslod.txd/des_dirt1_lod.dds\",\"gta3.img/lodvegaswest3.txd/des_dirt1_lod.dds\",\n \"gta3.img/lodvgwstcoast.txd/des_dirt1_lod.dds\",\"gta3.img/lodvegaswest3.txd/des_dirt1_lod.dds\",\n \"gta3.img/vegaselod2.txd/des_dirt1_lod.dds\",\"gta3.img/lodvegaswest3.txd/des_dirt1_lod.dds\",\n \"gta3.img/vegaselod3.txd/des_dirt1_lod.dds\",\"gta3.img/lodvegaswest3.txd/des_dirt1_lod.dds\",\n \"gta3.img/vegasnlod4.txd/des_dirt1_lod.dds\",\"gta3.img/lodvegaswest3.txd/des_dirt1_lod.dds\",\n \"gta3.img/vegaselod1.txd/ahoodfence2_lod.dds\",\"gta3.img/lodvegaswest3.txd/ahoodfence2_lod.dds\",\n \"gta3.img/vegaselod3.txd/ahoodfence2_lod.dds\",\"gta3.img/lodvegaswest3.txd/ahoodfence2_lod.dds\",\n \"gta3.img/lodvgsslod.txd/ws_chipboard_lod.dds\",\"gta3.img/lodvegaswest3.txd/ws_chipboard_lod.dds\",\n \"gta3.img/vegasnlod1.txd/ws_chipboard_lod.dds\",\"gta3.img/lodvegaswest3.txd/ws_chipboard_lod.dds\",\n \"gta3.img/lodvegaswest4.txd/lodroof05l256.dds\",\"gta3.img/lodvegaswest3.txd/lodroof05l256.dds\",\n \"gta3.img/lodvgsslod01.txd/marinawindow1_lod.dds\",\"gta3.img/lodvegaswest3.txd/marinawindow1_lod.dds\",\n \"gta3.img/vegaselod1.txd/marinawindow1_lod.dds\",\"gta3.img/lodvegaswest3.txd/marinawindow1_lod.dds\",\n \"gta3.img/vegaselod2.txd/marinawindow1_lod.dds\",\"gta3.img/lodvegaswest3.txd/marinawindow1_lod.dds\",\n \"gta3.img/lodvgswestout.txd/curbyell_lod.dds\",\"gta3.img/lodvegaswest3.txd/curbyell_lod.dds\",\n \"gta3.img/lodvgswestout.txd/conc_slabgrey_lodlod.dds\",\"gta3.img/lodvegaswest3.txd/conc_slabgrey_lodlod.dds\",\n \"gta3.img/lodvegaswest4.txd/lodfrateyellow1_32.dds\",\"gta3.img/lodvegaswest3.txd/lodfrateyellow1_32.dds\",\n \"gta3.img/lodvgsslod.txd/lodfrateyellow1_32.dds\",\"gta3.img/lodvegaswest3.txd/lodfrateyellow1_32.dds\",\n \"gta3.img/vegasnlod4.txd/lodfrateyellow1_32.dds\",\"gta3.img/lodvegaswest3.txd/lodfrateyellow1_32.dds\",\n \"gta3.img/lodvegaswest4.txd/lodfrateyellow2_32.dds\",\"gta3.img/lodvegaswest3.txd/lodfrateyellow2_32.dds\",\n \"gta3.img/lodvgsslod.txd/lodfrateyellow2_32.dds\",\"gta3.img/lodvegaswest3.txd/lodfrateyellow2_32.dds\",\n \"gta3.img/vegasnlod4.txd/lodfrateyellow2_32.dds\",\"gta3.img/lodvegaswest3.txd/lodfrateyellow2_32.dds\",\n \"gta3.img/lodvegaswest4.txd/lodfratered1_32.dds\",\"gta3.img/lodvegaswest3.txd/lodfratered1_32.dds\",\n \"gta3.img/lodvgsslod.txd/lodfratered1_32.dds\",\"gta3.img/lodvegaswest3.txd/lodfratered1_32.dds\",\n \"gta3.img/vegasnlod4.txd/lodfratered1_32.dds\",\"gta3.img/lodvegaswest3.txd/lodfratered1_32.dds\",\n \"gta3.img/lodvegaswest4.txd/lodfratered2_32.dds\",\"gta3.img/lodvegaswest3.txd/lodfratered2_32.dds\",\n \"gta3.img/lodvgsslod.txd/lodfratered2_32.dds\",\"gta3.img/lodvegaswest3.txd/lodfratered2_32.dds\",\n \"gta3.img/vegasnlod4.txd/lodfratered2_32.dds\",\"gta3.img/lodvegaswest3.txd/lodfratered2_32.dds\",\n \"gta3.img/lodvegaswest4.txd/lodfrateblue1_32.dds\",\"gta3.img/lodvegaswest3.txd/lodfrateblue1_32.dds\",\n \"gta3.img/lodvgsslod.txd/lodfrateblue1_32.dds\",\"gta3.img/lodvegaswest3.txd/lodfrateblue1_32.dds\",\n \"gta3.img/vegasnlod4.txd/lodfrateblue1_32.dds\",\"gta3.img/lodvegaswest3.txd/lodfrateblue1_32.dds\",\n \"gta3.img/lodvegaswest4.txd/lodfrateblue2_32.dds\",\"gta3.img/lodvegaswest3.txd/lodfrateblue2_32.dds\",\n \"gta3.img/lodvgsslod.txd/lodfrateblue2_32.dds\",\"gta3.img/lodvegaswest3.txd/lodfrateblue2_32.dds\",\n \"gta3.img/vegasnlod4.txd/lodfrateblue2_32.dds\",\"gta3.img/lodvegaswest3.txd/lodfrateblue2_32.dds\",\n \"gta3.img/lodvgwstcoast.txd/vgngewall1_256.dds\",\"gta3.img/lodvegaswest4.txd/vgngewall1_256.dds\",\n \"gta3.img/lodxrefhse1.txd/roof11llod.dds\",\"gta3.img/lodvegaswest4.txd/roof11llod.dds\",\n \"gta3.img/lodvgsslod.txd/ws_sandstone1_lod.dds\",\"gta3.img/lodvegaswest4.txd/ws_sandstone1_lod.dds\",\n \"gta3.img/vegashselod1.txd/lod_load_door.dds\",\"gta3.img/lodvegaswest4.txd/lod_load_door.dds\",\n \"gta3.img/lodvgsslod.txd/lodwrehse8_256.dds\",\"gta3.img/lodvegaswest4.txd/lodwrehse8_256.dds\",\n \"gta3.img/lodvgsslod.txd/lodwrehse7_256.dds\",\"gta3.img/lodvegaswest4.txd/lodwrehse7_256.dds\",\n \"gta3.img/lodvgsslod.txd/lodwrehse6_256.dds\",\"gta3.img/lodvegaswest4.txd/lodwrehse6_256.dds\",\n \"gta3.img/lodvgsslod.txd/lodwrehse5_256.dds\",\"gta3.img/lodvegaswest4.txd/lodwrehse5_256.dds\",\n \"gta3.img/lodvgsslod02.txd/concretenew_lod.dds\",\"gta3.img/lodvgsslod01.txd/concretenew_lod.dds\",\n \"gta3.img/stripxreflod.txd/block2bb_lod.dds\",\"gta3.img/lodvgsslod01.txd/block2bb_lod.dds\",\n \"gta3.img/lodvgsslod.txd/vgsspltshanger02_lod.dds\",\"gta3.img/lodvgsslod01.txd/vgsspltshanger02_lod.dds\",\n \"gta3.img/lodvgswestout.txd/vgsjunction01_lod.dds\",\"gta3.img/lodvgsslod01.txd/vgsjunction01_lod.dds\",\n \"gta3.img/vegaselod1.txd/vgsjunction01_lod.dds\",\"gta3.img/lodvgsslod01.txd/vgsjunction01_lod.dds\",\n \"gta3.img/vegaselod2.txd/vgsjunction01_lod.dds\",\"gta3.img/lodvgsslod01.txd/vgsjunction01_lod.dds\",\n \"gta3.img/vegaselod3.txd/vgsjunction01_lod.dds\",\"gta3.img/lodvgsslod01.txd/vgsjunction01_lod.dds\",\n \"gta3.img/vegasnlod4.txd/vgsjunction01_lod.dds\",\"gta3.img/lodvgsslod01.txd/vgsjunction01_lod.dds\",\n \"gta3.img/lodvgsslod.txd/brickred_lod.dds\",\"gta3.img/lodvgsslod01.txd/brickred_lod.dds\",\n \"gta3.img/lodvgsslod02.txd/bow_church_grass_gen_lod.dds\",\"gta3.img/lodvgsslod01.txd/bow_church_grass_gen_lod.dds\",\n \"gta3.img/vegasnlod2.txd/bow_church_grass_gen_lod.dds\",\"gta3.img/lodvgsslod01.txd/bow_church_grass_gen_lod.dds\",\n \"gta3.img/vegaselod3.txd/sf_pave2_lod.dds\",\"gta3.img/lodvgsslod02.txd/sf_pave2_lod.dds\",\n \"gta3.img/vegaselod3.txd/coasty_bit3_lod.dds\",\"gta3.img/lodvgsslod02.txd/coasty_bit3_lod.dds\",\n \"gta3.img/vegaselod3.txd/vgeferryland_lod.dds\",\"gta3.img/lodvgsslod02.txd/vgeferryland_lod.dds\",\n \"gta3.img/lodvgswestout.txd/vgshiwaygras_lod.dds\",\"gta3.img/lodvgsslod02.txd/vgshiwaygras_lod.dds\",\n \"gta3.img/vegasnlod4.txd/vgshiwaygras_lod.dds\",\"gta3.img/lodvgsslod02.txd/vgshiwaygras_lod.dds\",\n \"gta3.img/lodvgsslod.txd/grassgrn_lod.dds\",\"gta3.img/lodvgsslod02.txd/grassgrn_lod.dds\",\n \"gta3.img/lodvgsslod.txd/grassgrn256.dds\",\"gta3.img/lodvgsslod02.txd/grassgrn256.dds\",\n \"gta3.img/lodvgsslod.txd/vgsroad03_lod.dds\",\"gta3.img/lodvgsslod02.txd/vgsroad03_lod.dds\",\n \"gta3.img/vegasnlod1.txd/vgsroad03_lod.dds\",\"gta3.img/lodvgsslod02.txd/vgsroad03_lod.dds\",\n \"gta3.img/vegasnlod4.txd/vgsroad03_lod.dds\",\"gta3.img/lodvgsslod02.txd/vgsroad03_lod.dds\",\n \"gta3.img/vegaselod1.txd/rocktbrn128_lod.dds\",\"gta3.img/lodvgsslod02.txd/rocktbrn128_lod.dds\",\n \"gta3.img/vegaselod2.txd/rocktbrn128_lod.dds\",\"gta3.img/lodvgsslod02.txd/rocktbrn128_lod.dds\",\n \"gta3.img/vegaselod3.txd/rocktbrn128_lod.dds\",\"gta3.img/lodvgsslod02.txd/rocktbrn128_lod.dds\",\n \"gta3.img/vegaselod1.txd/des_scrub1_lod.dds\",\"gta3.img/lodvgsslod02.txd/des_scrub1_lod.dds\",\n \"gta3.img/vegaselod2.txd/des_scrub1_lod.dds\",\"gta3.img/lodvgsslod02.txd/des_scrub1_lod.dds\",\n \"gta3.img/vegaselod3.txd/des_scrub1_lod.dds\",\"gta3.img/lodvgsslod02.txd/des_scrub1_lod.dds\",\n \"gta3.img/vegasnlod4.txd/des_scrub1_lod.dds\",\"gta3.img/lodvgsslod02.txd/des_scrub1_lod.dds\",\n \"gta3.img/lodvgsslod.txd/vgstjunction02_lod.dds\",\"gta3.img/lodvgsslod02.txd/vgstjunction02_lod.dds\",\n \"gta3.img/vegasnlod1.txd/vgstjunction02_lod.dds\",\"gta3.img/lodvgsslod02.txd/vgstjunction02_lod.dds\",\n \"gta3.img/vegasnlod1.txd/monobloc_256128_lod.dds\",\"gta3.img/lodvgsslod.txd/monobloc_256128_lod.dds\",\n \"gta3.img/vegasnlod4.txd/monobloc_256128_lod.dds\",\"gta3.img/lodvgsslod.txd/monobloc_256128_lod.dds\",\n \"gta3.img/vegasnlod4.txd/vgstjunction06_lod.dds\",\"gta3.img/lodvgsslod.txd/vgstjunction06_lod.dds\",\n \"gta3.img/lodvgswestout.txd/vegdirtyroad2_lod.dds\",\"gta3.img/lodvgsslod.txd/vegdirtyroad2_lod.dds\",\n \"gta3.img/lodvgswestout.txd/vegroadjunc1_lod.dds\",\"gta3.img/lodvgsslod.txd/vegroadjunc1_lod.dds\",\n \"gta3.img/vegaselod3.txd/vgsewrehse02_lod.dds\",\"gta3.img/lodvgsslod.txd/vgsewrehse02_lod.dds\",\n \"gta3.img/vegaselod1.txd/electrics01_lod.dds\",\"gta3.img/lodvgsslod.txd/electrics01_lod.dds\",\n \"gta3.img/vegasnlod4.txd/vgstjunction04_lod.dds\",\"gta3.img/lodvgsslod.txd/vgstjunction04_lod.dds\",\n \"gta3.img/vegasnlod4.txd/vgsroad05_lod.dds\",\"gta3.img/lodvgsslod.txd/vgsroad05_lod.dds\",\n \"gta3.img/vegaselod3.txd/vgsroad02b_lod.dds\",\"gta3.img/lodvgswestout.txd/vgsroad02b_lod.dds\",\n \"gta3.img/vegasnlod4.txd/vgsroad02b_lod.dds\",\"gta3.img/lodvgswestout.txd/vgsroad02b_lod.dds\",\n \"gta3.img/lodvgwstcoast.txd/brickredlod.dds\",\"gta3.img/lodvgsxref1.txd/brickredlod.dds\",\n \"gta3.img/vegasnlod1.txd/brickredlod.dds\",\"gta3.img/lodvgsxref1.txd/brickredlod.dds\",\n \"gta3.img/vegasnlod4.txd/brickredlod.dds\",\"gta3.img/lodvgsxref1.txd/brickredlod.dds\",\n \"gta3.img/lodvgwstcoast.txd/vgwestbildlod1.dds\",\"gta3.img/lodvgsxref1.txd/vgwestbildlod1.dds\",\n \"gta3.img/lodvgwstcoast.txd/vgwestbildlod2.dds\",\"gta3.img/lodvgsxref1.txd/vgwestbildlod2.dds\",\n \"gta3.img/vegasnlod4.txd/vgs_railway01_lod.dds\",\"gta3.img/lodvgwstcoast.txd/vgs_railway01_lod.dds\",\n \"gta3.img/vegasnlod4.txd/vgs_railway02_lod.dds\",\"gta3.img/lodvgwstcoast.txd/vgs_railway02_lod.dds\",\n \"gta3.img/vegasnlod4.txd/vgs_railcrss_lod.dds\",\"gta3.img/lodvgwstcoast.txd/vgs_railcrss_lod.dds\",\n \"gta3.img/vegaselod3.txd/des_scrub1_dirt1_lod.dds\",\"gta3.img/lodvgwstcoast.txd/des_scrub1_dirt1_lod.dds\",\n \"gta3.img/vegaselod3.txd/vgs_rockbot1a_lod.dds\",\"gta3.img/lodvgwstcoast.txd/vgs_rockbot1a_lod.dds\",\n \"gta3.img/vegasnlod3.txd/vgs_rockbot1a_lod.dds\",\"gta3.img/lodvgwstcoast.txd/vgs_rockbot1a_lod.dds\",\n \"gta3.img/vegasnlod4.txd/vgnbalcony1_lod.dds\",\"gta3.img/lodxrefhse1.txd/vgnbalcony1_lod.dds\",\n \"gta3.img/vegasnlod4.txd/xrefhselod2.dds\",\"gta3.img/lodxrefhse1.txd/xrefhselod2.dds\",\n \"gta3.img/melrose13_lawn.txd/tileornateg256.dds\",\"gta3.img/lomall.txd/tileornateg256.dds\",\n \"gta3.img/venicegb02_law.txd/tileornateg256.dds\",\"gta3.img/lomall.txd/tileornateg256.dds\",\n \"gta3.img/sunrise10_lawn.txd/zombiegeddon.dds\",\"gta3.img/lomall.txd/zombiegeddon.dds\",\n \"gta3.img/sunst18_lawn.txd/zombiegeddon.dds\",\"gta3.img/lomall.txd/zombiegeddon.dds\",\n \"gta3.img/moregenroofstuff.txd/helipad_leg.dds\",\"gta3.img/lomall.txd/helipad_leg.dds\",\n \"gta3.img/sfe_copchop.txd/helipad_leg.dds\",\"gta3.img/lomall.txd/helipad_leg.dds\",\n \"gta3.img/vgnhelipad1.txd/helipad_leg.dds\",\"gta3.img/lomall.txd/helipad_leg.dds\",\n \"gta3.img/pier69.txd/pier69_ground1.dds\",\"gta3.img/lombard.txd/pier69_ground1.dds\",\n \"gta3.img/pier_law.txd/pier69_ground1.dds\",\"gta3.img/lombard.txd/pier69_ground1.dds\",\n \"gta3.img/sfvictorian2.txd/pier69_ground1.dds\",\"gta3.img/lombard.txd/pier69_ground1.dds\",\n \"gta3.img/sfvictorian.txd/windy_sf.dds\",\"gta3.img/lombard.txd/windy_sf.dds\",\n \"gta3.img/w_town2cs_t.txd/doornvent256128.dds\",\"gta3.img/losflor4_lae2.txd/doornvent256128.dds\",\n \"gta_int.img/genintintcarint3.txd/doornvent256128.dds\",\"gta3.img/losflor4_lae2.txd/doornvent256128.dds\",\n \"gta_int.img/genintwarehsint3.txd/doornvent256128.dds\",\"gta3.img/losflor4_lae2.txd/doornvent256128.dds\",\n \"gta3.img/piera_law2.txd/macbrij1_lae.dds\",\"gta3.img/macpark1tr_lae.txd/macbrij1_lae.dds\",\n \"gta_int.img/casinovault01.txd/cof_wood1.dds\",\"gta3.img/mafcasx.txd/cof_wood1.dds\",\n \"gta_int.img/mafiacasino01.txd/cof_wood1.dds\",\"gta3.img/mafcasx.txd/cof_wood1.dds\",\n \"gta_int.img/mafiacasinovault01.txd/cof_wood1.dds\",\"gta3.img/mafcasx.txd/cof_wood1.dds\",\n \"gta_int.img/ab_abbatoir01.txd/ab_sheetsteel.dds\",\"gta3.img/mafcasx.txd/ab_sheetsteel.dds\",\n \"gta_int.img/ab_ab.txd/ab_sheetsteel.dds\",\"gta3.img/mafcasx.txd/ab_sheetsteel.dds\",\n \"gta_int.img/ab_sfammumain.txd/ab_sheetsteel.dds\",\"gta3.img/mafcasx.txd/ab_sheetsteel.dds\",\n \"gta_int.img/casinovault01.txd/ab_sheetsteel.dds\",\"gta3.img/mafcasx.txd/ab_sheetsteel.dds\",\n \"gta_int.img/mafcaspipesa.txd/ab_sheetsteel.dds\",\"gta3.img/mafcasx.txd/ab_sheetsteel.dds\",\n \"gta_int.img/mafiacasino01.txd/ab_sheetsteel.dds\",\"gta3.img/mafcasx.txd/ab_sheetsteel.dds\",\n \"gta_int.img/mafiacasinovault01.txd/ab_sheetsteel.dds\",\"gta3.img/mafcasx.txd/ab_sheetsteel.dds\",\n \"gta_int.img/papaerchaseoffice.txd/ab_sheetsteel.dds\",\"gta3.img/mafcasx.txd/ab_sheetsteel.dds\",\n \"gta3.img/vgsairprtlight.txd/striplight01_128.dds\",\"gta3.img/mainlcawn.txd/striplight01_128.dds\",\n \"gta3.img/vgsscollege.txd/striplight01_128.dds\",\"gta3.img/mainlcawn.txd/striplight01_128.dds\",\n \"gta3.img/vgsswarhse04.txd/striplight01_128.dds\",\"gta3.img/mainlcawn.txd/striplight01_128.dds\",\n \"gta3.img/mission2_sfse.txd/ws_shopfront1a.dds\",\"gta3.img/mall_sfse.txd/ws_shopfront1a.dds\",\n \"gta3.img/mission3_sfse.txd/ws_shopfront1a.dds\",\"gta3.img/mall_sfse.txd/ws_shopfront1a.dds\",\n \"gta3.img/scum_sfse.txd/ws_shopfront1a.dds\",\"gta3.img/mall_sfse.txd/ws_shopfront1a.dds\",\n \"gta3.img/shops_sfse.txd/ws_shopfront1a.dds\",\"gta3.img/mall_sfse.txd/ws_shopfront1a.dds\",\n \"gta3.img/shopszz_sfse.txd/ws_shopfront1a.dds\",\"gta3.img/mall_sfse.txd/ws_shopfront1a.dds\",\n \"gta3.img/silicon2_sfse.txd/ws_grilleshade.dds\",\"gta3.img/mall_sfse.txd/ws_grilleshade.dds\",\n \"gta3.img/wiresnshit.txd/ws_grilleshade.dds\",\"gta3.img/mall_sfse.txd/ws_grilleshade.dds\",\n \"gta3.img/vgnglfcrse1.txd/mallfloor3.dds\",\"gta3.img/mall_sfse.txd/mallfloor3.dds\",\n \"gta3.img/skimmer.txd/cargobobrotorblack128.dds\",\"gta3.img/maverick.txd/cargobobrotorblack128.dds\",\n \"gta3.img/polmav.txd/polmav92texpage128.dds\",\"gta3.img/maverick.txd/maverick92texpage128.dds\",\n \"gta3.img/vcnmav.txd/polmav92texpage128.dds\",\"gta3.img/maverick.txd/maverick92texpage128.dds\",\n \"gta3.img/vcnmav.txd/polmavbody128a.dds\",\"gta3.img/maverick.txd/maverick92body128.dds\",\n \"gta3.img/melrose13_lawn.txd/shopfr02_la.dds\",\"gta3.img/melrose02_lawn.txd/shopfr02_la.dds\",\n \"gta3.img/melrose13_lawn.txd/shopfr01_la.dds\",\"gta3.img/melrose02_lawn.txd/shopfr01_la.dds\",\n \"gta3.img/rodeo02_law2.txd/shopfr01_la.dds\",\"gta3.img/melrose02_lawn.txd/shopfr01_la.dds\",\n \"gta3.img/rodeo05_law2.txd/shopfr01_la.dds\",\"gta3.img/melrose02_lawn.txd/shopfr01_la.dds\",\n \"gta3.img/sunset02_law2.txd/shopfr01_la.dds\",\"gta3.img/melrose02_lawn.txd/shopfr01_la.dds\",\n \"gta3.img/templae2land.txd/lastripmall2.dds\",\"gta3.img/melrose02_lawn.txd/lastripmall2.dds\",\n \"gta3.img/melrose08_lawn.txd/melrgren2_law.dds\",\"gta3.img/melrose02_lawn.txd/melrgren2_law.dds\",\n \"gta3.img/melrose19_lawn.txd/melrgren2_law.dds\",\"gta3.img/melrose02_lawn.txd/melrgren2_law.dds\",\n \"gta3.img/sunset04_law2.txd/melrgren2_law.dds\",\"gta3.img/melrose02_lawn.txd/melrgren2_law.dds\",\n \"gta3.img/melrose05_lawn.txd/melrgr01_law.dds\",\"gta3.img/melrose02_lawn.txd/melrgr01_law.dds\",\n \"gta3.img/melrose08_lawn.txd/melrgr01_law.dds\",\"gta3.img/melrose02_lawn.txd/melrgr01_law.dds\",\n \"gta3.img/melrose15_lawn.txd/melrgr01_law.dds\",\"gta3.img/melrose02_lawn.txd/melrgr01_law.dds\",\n \"gta3.img/melrose19_lawn.txd/melrgr01_law.dds\",\"gta3.img/melrose02_lawn.txd/melrgr01_law.dds\",\n \"gta3.img/sunset01_law2.txd/melrgr01_law.dds\",\"gta3.img/melrose02_lawn.txd/melrgr01_law.dds\",\n \"gta3.img/sunset04_law2.txd/melrgr01_law.dds\",\"gta3.img/melrose02_lawn.txd/melrgr01_law.dds\",\n \"gta3.img/sunsetbittyu.txd/melrgr01_law.dds\",\"gta3.img/melrose02_lawn.txd/melrgr01_law.dds\",\n \"gta3.img/melrose15_lawn.txd/melrblu_law.dds\",\"gta3.img/melrose02_lawn.txd/melrblu_law.dds\",\n \"gta3.img/sunset04_law2.txd/melrblu_law.dds\",\"gta3.img/melrose02_lawn.txd/melrblu_law.dds\",\n \"gta3.img/melrose08_lawn.txd/melrpurp2_law.dds\",\"gta3.img/melrose02_lawn.txd/melrpurp2_law.dds\",\n \"gta3.img/melrose19_lawn.txd/melrpurp2_law.dds\",\"gta3.img/melrose02_lawn.txd/melrpurp2_law.dds\",\n \"gta3.img/sunset04_law2.txd/melrpurp2_law.dds\",\"gta3.img/melrose02_lawn.txd/melrpurp2_law.dds\",\n \"gta3.img/mission2apts_sfse.txd/ws_apartmentmankypeach1.dds\",\"gta3.img/melrose03_lawn.txd/ws_apartmentmankypeach1.dds\",\n \"gta3.img/queens2_sfs.txd/ws_apartmentmankypeach1.dds\",\"gta3.img/melrose03_lawn.txd/ws_apartmentmankypeach1.dds\",\n \"gta3.img/scum_sfse.txd/ws_apartmentmankypeach1.dds\",\"gta3.img/melrose03_lawn.txd/ws_apartmentmankypeach1.dds\",\n \"gta3.img/sunrise05_lawn.txd/hollyshop03_lawn.dds\",\"gta3.img/melrose03_lawn.txd/hollyshop03_lawn.dds\",\n \"gta3.img/sunrise05_lawn.txd/hollyshop04_lawn.dds\",\"gta3.img/melrose03_lawn.txd/hollyshop04_lawn.dds\",\n \"gta3.img/sunrise11_lawn.txd/hollyshop04_lawn.dds\",\"gta3.img/melrose03_lawn.txd/hollyshop04_lawn.dds\",\n \"gta3.img/sunrise05_lawn.txd/hollyshop02_lawn.dds\",\"gta3.img/melrose03_lawn.txd/hollyshop02_lawn.dds\",\n \"gta3.img/sunrise05_lawn.txd/hollyshop01_lawn.dds\",\"gta3.img/melrose03_lawn.txd/hollyshop01_lawn.dds\",\n \"gta3.img/sunset01_law2.txd/melrbr02_law.dds\",\"gta3.img/melrose05_lawn.txd/melrbr02_law.dds\",\n \"gta3.img/sunsetbittyu.txd/melrbr02_law.dds\",\"gta3.img/melrose05_lawn.txd/melrbr02_law.dds\",\n \"gta3.img/sunset01_law2.txd/melrbr01_law.dds\",\"gta3.img/melrose05_lawn.txd/melrbr01_law.dds\",\n \"gta3.img/sunsetbittyu.txd/melrbr01_law.dds\",\"gta3.img/melrose05_lawn.txd/melrbr01_law.dds\",\n \"gta3.img/sunrise11_lawn.txd/shopdeco03b_law.dds\",\"gta3.img/melrose07_lawn.txd/shopdeco03b_law.dds\",\n \"gta3.img/sunrise11_lawn.txd/shopdeco03_law.dds\",\"gta3.img/melrose07_lawn.txd/shopdeco03_law.dds\",\n \"gta3.img/melrose19_lawn.txd/melryel_law.dds\",\"gta3.img/melrose08_lawn.txd/melryel_law.dds\",\n \"gta3.img/melrose19_lawn.txd/malawn02_lawn.dds\",\"gta3.img/melrose08_lawn.txd/malawn02_lawn.dds\",\n \"gta3.img/sunset01_law2.txd/malawn02_lawn.dds\",\"gta3.img/melrose08_lawn.txd/malawn02_lawn.dds\",\n \"gta3.img/melrose19_lawn.txd/malawn01_lawn.dds\",\"gta3.img/melrose08_lawn.txd/malawn01_lawn.dds\",\n \"gta3.img/rodeo05_law2.txd/malawn01_lawn.dds\",\"gta3.img/melrose08_lawn.txd/malawn01_lawn.dds\",\n \"gta3.img/sancliff_law2.txd/malawn01_lawn.dds\",\"gta3.img/melrose08_lawn.txd/malawn01_lawn.dds\",\n \"gta3.img/sunset02_law2.txd/malawn01_lawn.dds\",\"gta3.img/melrose08_lawn.txd/malawn01_lawn.dds\",\n \"gta3.img/melrose19_lawn.txd/melroran2_law.dds\",\"gta3.img/melrose08_lawn.txd/melroran2_law.dds\",\n \"gta3.img/melrose15_lawn.txd/melrdoor01_law.dds\",\"gta3.img/melrose08_lawn.txd/melrdoor01_law.dds\",\n \"gta3.img/vgebillboards.txd/base5_1.dds\",\"gta3.img/melrose08_lawn.txd/base5_1.dds\",\n \"gta3.img/vgnfirestat.txd/base5_1.dds\",\"gta3.img/melrose08_lawn.txd/base5_1.dds\",\n \"gta3.img/vgsssignage03.txd/base5_1.dds\",\"gta3.img/melrose08_lawn.txd/base5_1.dds\",\n \"gta_int.img/cj_banner2.txd/base5_1.dds\",\"gta3.img/melrose08_lawn.txd/base5_1.dds\",\n \"gta3.img/rodeo01_law2.txd/downtwin22.dds\",\"gta3.img/melrose13_lawn.txd/downtwin22.dds\",\n \"gta3.img/sunset01_law2.txd/downtwin22.dds\",\"gta3.img/melrose13_lawn.txd/downtwin22.dds\",\n \"gta3.img/rodeo02_law2.txd/shopfr03_la.dds\",\"gta3.img/melrose13_lawn.txd/shopfr03_la.dds\",\n \"gta3.img/sunset01_law2.txd/shopfr03_la.dds\",\"gta3.img/melrose13_lawn.txd/shopfr03_la.dds\",\n \"gta3.img/sunstrans_law2.txd/recshop02_la.dds\",\"gta3.img/melrose13_lawn.txd/recshop02_la.dds\",\n \"gta3.img/rodeo02_law2.txd/downtwin19.dds\",\"gta3.img/melrose13_lawn.txd/downtwin19.dds\",\n \"gta3.img/sunrise11_lawn.txd/downtwin19.dds\",\"gta3.img/melrose13_lawn.txd/downtwin19.dds\",\n \"gta3.img/sunset02_law2.txd/downtwin19.dds\",\"gta3.img/melrose13_lawn.txd/downtwin19.dds\",\n \"gta3.img/melrosetr_lawn.txd/melrsign05_la.dds\",\"gta3.img/melrose15_lawn.txd/melrsign05_la.dds\",\n \"gta3.img/sunset04_law2.txd/melrsign05_la.dds\",\"gta3.img/melrose15_lawn.txd/melrsign05_la.dds\",\n \"gta3.img/melrosetr1_lawn.txd/melrsign03_la.dds\",\"gta3.img/melrose15_lawn.txd/melrsign03_la.dds\",\n \"gta3.img/melrosetr_lawn.txd/melrsign03_la.dds\",\"gta3.img/melrose15_lawn.txd/melrsign03_la.dds\",\n \"gta3.img/sunrise10_lawn.txd/frostwin01_law.dds\",\"gta3.img/melrose16_lawn.txd/frostwin01_law.dds\",\n \"gta3.img/vgse24hr.txd/frostwin01_law.dds\",\"gta3.img/melrose16_lawn.txd/frostwin01_law.dds\",\n \"gta3.img/roadside.txd/cj_frame_glass.dds\",\"gta3.img/metal.txd/cj_frame_glass.dds\",\n \"gta_int.img/cj_bathroom.txd/cj_frame_glass.dds\",\"gta3.img/metal.txd/cj_frame_glass.dds\",\n \"gta_int.img/cj_commercial.txd/cj_frame_glass.dds\",\"gta3.img/metal.txd/cj_frame_glass.dds\",\n \"gta_int.img/cj_hi_fi.txd/cj_frame_glass.dds\",\"gta3.img/metal.txd/cj_frame_glass.dds\",\n \"gta_int.img/cj_lighting.txd/cj_frame_glass.dds\",\"gta3.img/metal.txd/cj_frame_glass.dds\",\n \"gta_int.img/cj_sex.txd/cj_frame_glass.dds\",\"gta3.img/metal.txd/cj_frame_glass.dds\",\n \"gta_int.img/rc_shop_figure.txd/cj_frame_glass.dds\",\"gta3.img/metal.txd/cj_frame_glass.dds\",\n \"gta3.img/vgnusedcar.txd/lightblue_64.dds\",\"gta3.img/milbase.txd/lightblue_64.dds\",\n \"gta3.img/vgsecarshow.txd/lightblue_64.dds\",\"gta3.img/milbase.txd/lightblue_64.dds\",\n \"gta3.img/vgsssignage03.txd/midgrey64.dds\",\"gta3.img/milbase.txd/midgrey64.dds\",\n \"gta3.img/vgsssignage04.txd/midgrey64.dds\",\"gta3.img/milbase.txd/midgrey64.dds\",\n \"gta_int.img/gb_foodwrap01.txd/midgrey64.dds\",\"gta3.img/milbase.txd/midgrey64.dds\",\n \"gta3.img/vgnusedcar.txd/lightred2_32.dds\",\"gta3.img/milbase.txd/lightred2_32.dds\",\n \"gta3.img/vgsecarshow.txd/lightred2_32.dds\",\"gta3.img/milbase.txd/lightred2_32.dds\",\n \"gta3.img/samsite_sfxrf.txd/sam_camobits.dds\",\"gta3.img/milbase.txd/sam_camobits.dds\",\n \"gta3.img/minigx.txd/minigun_2.dds\",\"gta3.img/minigun.txd/minigun_2.dds\",\n \"gta3.img/minigx.txd/bulletbelt.dds\",\"gta3.img/minigun.txd/bulletbelt.dds\",\n \"gta3.img/pierc_law2.txd/maxhead4.dds\",\"gta3.img/miragecasino1.txd/maxhead4.dds\",\n \"gta3.img/skullsign.txd/miragesign2_256.dds\",\"gta3.img/miragecasino2.txd/miragesign2_256.dds\",\n \"gta3.img/skullsign.txd/miragesign1_256.dds\",\"gta3.img/miragecasino2.txd/miragesign1_256.dds\",\n \"gta3.img/skullsign.txd/miragepillar2_256.dds\",\"gta3.img/miragecasino2.txd/miragepillar2_256.dds\",\n \"gta3.img/rocketla.txd/gun_rocket_launcher.dds\",\"gta3.img/missile.txd/gun_rocket_launcher.dds\",\n \"gta3.img/sunrise11_lawn.txd/ws_ed_shop5.dds\",\"gta3.img/mission2apts_sfse.txd/ws_ed_shop5.dds\",\n \"gta3.img/mission3_sfse.txd/ws_aptwin.dds\",\"gta3.img/mission2apts_sfse.txd/ws_aptwin.dds\",\n \"gta3.img/mission3z_sfse.txd/ws_aptwin.dds\",\"gta3.img/mission2apts_sfse.txd/ws_aptwin.dds\",\n \"gta3.img/mission_sfse.txd/ws_aptwin.dds\",\"gta3.img/mission2apts_sfse.txd/ws_aptwin.dds\",\n \"gta3.img/mission3_sfse.txd/ws_buildblock1b.dds\",\"gta3.img/mission2_sfse.txd/ws_buildblock1b.dds\",\n \"gta3.img/queens3_sfs.txd/ws_buildblock1b.dds\",\"gta3.img/mission2_sfse.txd/ws_buildblock1b.dds\",\n \"gta3.img/shops_sfse.txd/ws_buildblock1b.dds\",\"gta3.img/mission2_sfse.txd/ws_buildblock1b.dds\",\n \"gta3.img/shopszz_sfse.txd/ws_buildblock1b.dds\",\"gta3.img/mission2_sfse.txd/ws_buildblock1b.dds\",\n \"gta3.img/mission3_sfse.txd/ws_shopfront1b.dds\",\"gta3.img/mission2_sfse.txd/ws_shopfront1b.dds\",\n \"gta3.img/scum_sfse.txd/ws_shopfront1b.dds\",\"gta3.img/mission2_sfse.txd/ws_shopfront1b.dds\",\n \"gta3.img/shops_sfse.txd/ws_shopfront1b.dds\",\"gta3.img/mission2_sfse.txd/ws_shopfront1b.dds\",\n \"gta3.img/shopszz_sfse.txd/ws_shopfront1b.dds\",\"gta3.img/mission2_sfse.txd/ws_shopfront1b.dds\",\n \"gta3.img/scum_sfse.txd/ws_fancywallpink.dds\",\"gta3.img/mission2_sfse.txd/ws_fancywallpink.dds\",\n \"gta3.img/shops_sfse.txd/ws_fancywallpink.dds\",\"gta3.img/mission2_sfse.txd/ws_fancywallpink.dds\",\n \"gta3.img/scum_sfse.txd/ws_fancywindowpink.dds\",\"gta3.img/mission2_sfse.txd/ws_fancywindowpink.dds\",\n \"gta3.img/shops_sfse.txd/ws_fancywindowpink.dds\",\"gta3.img/mission2_sfse.txd/ws_fancywindowpink.dds\",\n \"gta3.img/scum_sfse.txd/ws_buildblock1a.dds\",\"gta3.img/mission2_sfse.txd/ws_buildblock1a.dds\",\n \"gta3.img/shops_sfse.txd/ws_buildblock1a.dds\",\"gta3.img/mission2_sfse.txd/ws_buildblock1a.dds\",\n \"gta3.img/shopszz_sfse.txd/ws_buildblock1a.dds\",\"gta3.img/mission2_sfse.txd/ws_buildblock1a.dds\",\n \"gta3.img/mission_sfse.txd/ws_classyshop1.dds\",\"gta3.img/mission3_sfse.txd/ws_classyshop1.dds\",\n \"gta3.img/shops2extra_sfse.txd/ws_classyshop1.dds\",\"gta3.img/mission3_sfse.txd/ws_classyshop1.dds\",\n \"gta3.img/mission_sfse.txd/ws_buildblock2c.dds\",\"gta3.img/mission3_sfse.txd/ws_buildblock2c.dds\",\n \"gta3.img/mission_sfse.txd/ws_buildblock2a.dds\",\"gta3.img/mission3_sfse.txd/ws_buildblock2a.dds\",\n \"gta3.img/mission_sfse.txd/ws_buildblock2b.dds\",\"gta3.img/mission3_sfse.txd/ws_buildblock2b.dds\",\n \"gta3.img/mission_sfse.txd/ws_ed_shop1.dds\",\"gta3.img/mission3_sfse.txd/ws_ed_shop1.dds\",\n \"gta3.img/queens2_sfs.txd/ws_ed_shop1.dds\",\"gta3.img/mission3_sfse.txd/ws_ed_shop1.dds\",\n \"gta_int.img/int_zerosrca.txd/ws_ed_zeroshop.dds\",\"gta3.img/mission3z_sfse.txd/ws_ed_zeroshop.dds\",\n \"gta3.img/scum_sfse.txd/ws_apartmentbrown2.dds\",\"gta3.img/mission_sfse.txd/ws_apartmentbrown2.dds\",\n \"gta3.img/scum_sfse.txd/ws_apartmentbrown1.dds\",\"gta3.img/mission_sfse.txd/ws_apartmentbrown1.dds\",\n \"gta3.img/signs.txd/lamppost.dds\",\"gta3.img/mitraffic.txd/lamppost.dds\",\n \"gta3.img/streetlights.txd/lamppost.dds\",\"gta3.img/mitraffic.txd/lamppost.dds\",\n \"gta3.img/vegtrafic2.txd/lamppost.dds\",\"gta3.img/mitraffic.txd/lamppost.dds\",\n \"gta3.img/vegtrafic2.txd/tafficlights.dds\",\"gta3.img/mitraffic.txd/tafficlights.dds\",\n \"gta3.img/theatrelan2.txd/sf_windos_4.dds\",\"gta3.img/monlith_sfe.txd/sf_windos_4.dds\",\n \"gta3.img/monsterb.txd/monsterb92wheel64.dds\",\"gta3.img/monstera.txd/monstera92wheel64.dds\",\n \"gta3.img/monsterb.txd/monsterb92tyre64.dds\",\"gta3.img/monstera.txd/monstera92tyre64.dds\",\n \"gta3.img/monsterb.txd/monsterb92stuff64.dds\",\"gta3.img/monstera.txd/monstera92stuff64.dds\",\n \"gta3.img/monsterb.txd/monsterb92interior128.dds\",\"gta3.img/monstera.txd/monstera92interior128.dds\",\n \"gta3.img/vincent.txd/vincent92interior128.dds\",\"gta3.img/moonbeam.txd/moonbeam92interior128.dds\",\n \"gta3.img/windsor.txd/vincent92interior128.dds\",\"gta3.img/moonbeam.txd/moonbeam92interior128.dds\",\n \"gta3.img/vgnhelipad1.txd/skylight_meshed.dds\",\"gta3.img/moregenroofstuff.txd/skylight_meshed.dds\",\n \"gta3.img/vgnlpost.txd/skylight_scum.dds\",\"gta3.img/moregenroofstuff.txd/skylight_scum.dds\",\n \"gta3.img/sfe_copchop.txd/mast_shadow_t.dds\",\"gta3.img/moregenroofstuff.txd/mast_shadow_t.dds\",\n \"gta3.img/sfe_copchop.txd/airvent_shadowt_gz.dds\",\"gta3.img/moregenroofstuff.txd/airvent_shadowt_gz.dds\",\n \"gta3.img/vgnhelipad1.txd/airvent_shadowt_gz.dds\",\"gta3.img/moregenroofstuff.txd/airvent_shadowt_gz.dds\",\n \"gta3.img/sunset03_law2.txd/vegasmotelsign03_128.dds\",\"gta3.img/motel01sign.txd/vegasmotelsign03_128.dds\",\n \"gta3.img/sunset04_law2.txd/vegasmotelsign03_128.dds\",\"gta3.img/motel01sign.txd/vegasmotelsign03_128.dds\",\n \"gta3.img/vgbndsign.txd/vegasmotelsign03_128.dds\",\"gta3.img/motel01sign.txd/vegasmotelsign03_128.dds\",\n \"gta3.img/sunset03_law2.txd/vegasmotelsign02_128.dds\",\"gta3.img/motel01sign.txd/vegasmotelsign02_128.dds\",\n \"gta3.img/sunset04_law2.txd/vegasmotelsign02_128.dds\",\"gta3.img/motel01sign.txd/vegasmotelsign02_128.dds\",\n \"gta3.img/vgbndsign.txd/vegasmotelsign02_128.dds\",\"gta3.img/motel01sign.txd/vegasmotelsign02_128.dds\",\n \"gta3.img/residnce01.txd/vegasfence01_64.dds\",\"gta3.img/motel01.txd/vegasfence01_64.dds\",\n \"gta3.img/vagabond.txd/vegasfence01_64.dds\",\"gta3.img/motel01.txd/vegasfence01_64.dds\",\n \"gta3.img/vgs_shops.txd/vegasfence01_64.dds\",\"gta3.img/motel01.txd/vegasfence01_64.dds\",\n \"gta3.img/vgsswarhse04.txd/vegasfence01_64.dds\",\"gta3.img/motel01.txd/vegasfence01_64.dds\",\n \"gta3.img/vagabond.txd/vegasmotelwind01_128.dds\",\"gta3.img/motel01.txd/vegasmotelwind01_128.dds\",\n \"gta3.img/vgnretail7.txd/vegasmotelwind01_128.dds\",\"gta3.img/motel01.txd/vegasmotelwind01_128.dds\",\n \"gta3.img/vagabond.txd/vegasmoteldoor01_128.dds\",\"gta3.img/motel01.txd/vegasmoteldoor01_128.dds\",\n \"gta3.img/vgnhseland.txd/vegasmoteldoor01_128.dds\",\"gta3.img/motel01.txd/vegasmoteldoor01_128.dds\",\n \"gta3.img/vgnretail7.txd/vegasmoteldoor01_128.dds\",\"gta3.img/motel01.txd/vegasmoteldoor01_128.dds\",\n \"gta3.img/vgsehseing1.txd/vegasmoteldoor01_128.dds\",\"gta3.img/motel01.txd/vegasmoteldoor01_128.dds\",\n \"gta3.img/vagabond.txd/vegasmotel03_64.dds\",\"gta3.img/motel01.txd/vegasmotel03_64.dds\",\n \"gta3.img/vagabond.txd/vegasmotel02_128.dds\",\"gta3.img/motel01.txd/vegasmotel02_128.dds\",\n \"gta3.img/vagabond.txd/vegasmotel01_128.dds\",\"gta3.img/motel01.txd/vegasmotel01_128.dds\",\n \"gta3.img/shamcpark.txd/ws_carpark1.dds\",\"gta3.img/motel_lae.txd/ws_carpark1.dds\",\n \"gta3.img/vegassland62.txd/ws_stonewall.dds\",\"gta3.img/mountainsfs.txd/ws_stonewall.dds\",\n \"gta3.img/vgsebuild01.txd/ws_stonewall.dds\",\"gta3.img/mountainsfs.txd/ws_stonewall.dds\",\n \"gta_int.img/picture_frame.txd/cj_painting22.dds\",\"gta3.img/mp_ranchcut.txd/cj_painting22.dds\",\n \"gta_int.img/picture_frame_clip.txd/cj_painting20.dds\",\"gta3.img/mp_ranchcut.txd/cj_painting20.dds\",\n \"gta_int.img/picture_frame_clip.txd/cj_painting6.dds\",\"gta3.img/mp_ranchcut.txd/cj_painting6.dds\",\n \"gta3.img/ottos2_sfw.txd/kb_sofaside2.dds\",\"gta3.img/mp_ranchcut.txd/kb_sofaside2.dds\",\n \"gta_int.img/kbcouch1.txd/kb_sofaside2.dds\",\"gta3.img/mp_ranchcut.txd/kb_sofaside2.dds\",\n \"gta_int.img/kb_parker.txd/kb_sofaside2.dds\",\"gta3.img/mp_ranchcut.txd/kb_sofaside2.dds\",\n \"gta3.img/ottos2_sfw.txd/of_monitor_256.dds\",\"gta3.img/mp_ranchcut.txd/of_monitor_256.dds\",\n \"gta3.img/ufo_barbakroom.txd/of_monitor_256.dds\",\"gta3.img/mp_ranchcut.txd/of_monitor_256.dds\",\n \"gta_int.img/cj_office.txd/of_monitor_256.dds\",\"gta3.img/mp_ranchcut.txd/of_monitor_256.dds\",\n \"gta_int.img/mp_policesf.txd/of_monitor_256.dds\",\"gta3.img/mp_ranchcut.txd/of_monitor_256.dds\",\n \"gta3.img/ottos2_sfw.txd/of_key_256.dds\",\"gta3.img/mp_ranchcut.txd/of_key_256.dds\",\n \"gta3.img/ufo_barbakroom.txd/of_key_256.dds\",\"gta3.img/mp_ranchcut.txd/of_key_256.dds\",\n \"gta_int.img/cj_office.txd/of_key_256.dds\",\"gta3.img/mp_ranchcut.txd/of_key_256.dds\",\n \"gta_int.img/mp_policesf.txd/of_key_256.dds\",\"gta3.img/mp_ranchcut.txd/of_key_256.dds\",\n \"gta3.img/ufo_barbakroom.txd/gen_quallity_hifi_side.dds\",\"gta3.img/mp_ranchcut.txd/gen_quallity_hifi_side.dds\",\n \"gta3.img/vgnbballsign2.txd/xtreme_prolaps.dds\",\"gta3.img/mtb_banners.txd/xtreme_prolaps.dds\",\n \"gta_int.img/carter_block_2.txd/mp_carter_cage.dds\",\"gta3.img/mtbtrackcs_t.txd/mp_carter_cage.dds\",\n \"gta3.img/patriot.txd/patriot92wheel64.dds\",\"gta3.img/mule.txd/mule92wheel64.dds\",\n \"gta3.img/mullho03_lahills.txd/desegravelgrassroadla.dds\",\"gta3.img/mullho03a_lahills.txd/desegravelgrassroadla.dds\",\n \"gta3.img/mullho03_lahills.txd/gravelkb2_128.dds\",\"gta3.img/mullho03a_lahills.txd/gravelkb2_128.dds\",\n \"gta3.img/richman04_lahills.txd/sw_wall02.dds\",\"gta3.img/mullho03a_lahills.txd/sw_wall02.dds\",\n \"gta3.img/sw_block03.txd/sw_wall02.dds\",\"gta3.img/mullho03a_lahills.txd/sw_wall02.dds\",\n \"gta3.img/tcecen4law.txd/redslates64_law.dds\",\"gta3.img/mullholl_lahills.txd/redslates64_law.dds\",\n \"gta_int.img/donut_tray.txd/donut2_rb.dds\",\"gta3.img/munchyx.txd/donut2_rb.dds\",\n \"gta3.img/presidio01_sfn.txd/sl_preswallbot01.dds\",\"gta3.img/newstuff_sfn.txd/sl_preswallbot01.dds\",\n \"gta3.img/sfn_apart02sfn.txd/sl_preswallbot01.dds\",\"gta3.img/newstuff_sfn.txd/sl_preswallbot01.dds\",\n \"gta3.img/stuff2_sfn.txd/sl_preswallbot01.dds\",\"gta3.img/newstuff_sfn.txd/sl_preswallbot01.dds\",\n \"gta3.img/stuff2_sfn.txd/carlot1_lan.dds\",\"gta3.img/newstuff_sfn.txd/carlot1_lan.dds\",\n \"gta3.img/nightlights1_law2.txd/sl_dtwinlights1.dds\",\"gta3.img/nightlights1_lan2.txd/sl_dtwinlights1.dds\",\n \"gta3.img/nitelites_lae2.txd/sl_dtwinlights1.dds\",\"gta3.img/nightlights1_lan2.txd/sl_dtwinlights1.dds\",\n \"gta3.img/nitelites_law.txd/sl_dtwinlights1.dds\",\"gta3.img/nightlights1_lan2.txd/sl_dtwinlights1.dds\",\n \"gta3.img/nitewin_lan.txd/sl_dtwinlights1.dds\",\"gta3.img/nightlights1_lan2.txd/sl_dtwinlights1.dds\",\n \"gta3.img/sunstr_lawn.txd/sl_dtwinlights1.dds\",\"gta3.img/nightlights1_lan2.txd/sl_dtwinlights1.dds\",\n \"gta3.img/vgsnnitwin.txd/sl_dtwinlights2.dds\",\"gta3.img/nightlts_lae.txd/sl_dtwinlights2.dds\",\n \"gta3.img/nitewin_lan.txd/nitwin01_la.dds\",\"gta3.img/nitelites_lae2.txd/nitwin01_la.dds\",\n \"gta3.img/sfwngtlites.txd/sfnitewindows.dds\",\"gta3.img/nitelites.txd/sfnitewindows.dds\",\n \"gta3.img/vgsenitwin.txd/sfnitewindows.dds\",\"gta3.img/nitelites.txd/sfnitewindows.dds\",\n \"gta3.img/nitewin_las.txd/neonwin1.dds\",\"gta3.img/nitewin_lan.txd/neonwin1.dds\",\n \"gta3.img/sawmillcs_t.txd/concretebuild64.dds\",\"gta3.img/nuhotel01.txd/concretebuild64.dds\",\n \"gta3.img/vgsschurch.txd/nuhotel05_64.dds\",\"gta3.img/nuhotel01.txd/nuhotel05_64.dds\",\n \"gta3.img/santamonhus1.txd/lasmulap7.dds\",\"gta3.img/oldshops_las.txd/lasmulap7.dds\",\n \"gta3.img/sw_church.txd/sw_hedstones.dds\",\"gta3.img/oldwest.txd/sw_hedstones.dds\",\n \"gta_int.img/plants_galss.txd/pinebranch1.dds\",\"gta3.img/ottos2_sfw.txd/pinebranch1.dds\",\n \"gta3.img/recroomsfse.txd/kb_sofa555c.dds\",\"gta3.img/ottos2_sfw.txd/kb_sofa555c.dds\",\n \"gta_int.img/kbcouch1.txd/kb_sofa555c.dds\",\"gta3.img/ottos2_sfw.txd/kb_sofa555c.dds\",\n \"gta3.img/recroomsfse.txd/kb_sofa555d.dds\",\"gta3.img/ottos2_sfw.txd/kb_sofa555d.dds\",\n \"gta_int.img/kbcouch1.txd/kb_sofa555d.dds\",\"gta3.img/ottos2_sfw.txd/kb_sofa555d.dds\",\n \"gta_int.img/cj_lighting.txd/cj_plant_pot.dds\",\"gta3.img/ottos2_sfw.txd/cj_plant_pot.dds\",\n \"gta_int.img/plants_designer.txd/cj_plant_pot.dds\",\"gta3.img/ottos2_sfw.txd/cj_plant_pot.dds\",\n \"gta3.img/ottos_sfw.txd/carshowroom1.dds\",\"gta3.img/ottos_glass.txd/carshowroom1.dds\",\n \"gta3.img/sanchez.txd/sanchez92gear64.dds\",\"gta3.img/pcj600.txd/pcj60092gear64.dds\",\n \"gta3.img/sanchez.txd/sanchez92brakes64.dds\",\"gta3.img/pcj600.txd/pcj60092brakes64.dds\",\n \"gta3.img/smallertxd.txd/posh_eagle9_sfe.dds\",\"gta3.img/pershingsq.txd/posh_eagle9_sfe.dds\",\n \"gta3.img/venice_law.txd/rooftop_gz4.dds\",\"gta3.img/pier69.txd/rooftop_gz4.dds\",\n \"gta3.img/pierc_law2.txd/gen_crain_mast.dds\",\"gta3.img/piera_law2.txd/gen_crain_mast.dds\",\n \"gta3.img/pierc_law2.txd/beachpiersign1_256.dds\",\"gta3.img/piera_law2.txd/beachpiersign1_256.dds\",\n \"gta3.img/pierc_law2.txd/pierfenc_law2.dds\",\"gta3.img/pierb_law2.txd/pierfenc_law2.dds\",\n \"gta3.img/ufo_bar.txd/vgsclubdoor01_128.dds\",\"gta3.img/pierb_law2.txd/vgsclubdoor01_128.dds\",\n \"gta3.img/vgs_shops.txd/vgsclubdoor01_128.dds\",\"gta3.img/pierb_law2.txd/vgsclubdoor01_128.dds\",\n \"gta_int.img/labig1int2.txd/vgsclubdoor01_128.dds\",\"gta3.img/pierb_law2.txd/vgsclubdoor01_128.dds\",\n \"gta_int.img/labig2int2.txd/vgsclubdoor01_128.dds\",\"gta3.img/pierb_law2.txd/vgsclubdoor01_128.dds\",\n \"gta_int.img/labig3int2.txd/vgsclubdoor01_128.dds\",\"gta3.img/pierb_law2.txd/vgsclubdoor01_128.dds\",\n \"gta3.img/pierc_law2.txd/sanice5.dds\",\"gta3.img/pierb_law2.txd/sanice5.dds\",\n \"gta3.img/pierc_law2.txd/sanice4.dds\",\"gta3.img/pierb_law2.txd/sanice4.dds\",\n \"gta3.img/pierc_law2.txd/sanice3.dds\",\"gta3.img/pierb_law2.txd/sanice3.dds\",\n \"gta3.img/pierc_law2.txd/sanice2.dds\",\"gta3.img/pierb_law2.txd/sanice2.dds\",\n \"gta3.img/pierc_law2.txd/sanice1.dds\",\"gta3.img/pierb_law2.txd/sanice1.dds\",\n \"gta3.img/pierc_law2.txd/sanpiz4.dds\",\"gta3.img/pierb_law2.txd/sanpiz4.dds\",\n \"gta3.img/pierc_law2.txd/sancorn5.dds\",\"gta3.img/pierb_law2.txd/sancorn5.dds\",\n \"gta3.img/pierc_law2.txd/sancorn6.dds\",\"gta3.img/pierb_law2.txd/sancorn6.dds\",\n \"gta3.img/pierc_law2.txd/pierlegbot_law.dds\",\"gta3.img/pierb_law2.txd/pierlegbot_law.dds\",\n \"gta3.img/pierc_law2.txd/pierlegtop_law.dds\",\"gta3.img/pierb_law2.txd/pierlegtop_law.dds\",\n \"gta3.img/pierc_law2.txd/pierends_law.dds\",\"gta3.img/pierb_law2.txd/pierends_law.dds\",\n \"gta3.img/vegashse6.txd/blueroof_128.dds\",\"gta3.img/pierc_law2.txd/blueroof_128.dds\",\n \"gta3.img/vgsswarehse02c.txd/blueroof_128.dds\",\"gta3.img/pierc_law2.txd/blueroof_128.dds\",\n \"gta3.img/vgnfremnt1.txd/vegparking2_256.dds\",\"gta3.img/pinkcarpark_sfs.txd/vegparking2_256.dds\",\n \"gta3.img/vgssairportcpark.txd/vegparking2_256.dds\",\"gta3.img/pinkcarpark_sfs.txd/vegparking2_256.dds\",\n \"gta3.img/sunset03_law2.txd/ws_fmaparking.dds\",\"gta3.img/pinkcarpark_sfs.txd/ws_fmaparking.dds\",\n \"gta3.img/tikibridge.txd/tislandledge01_64.dds\",\"gta3.img/pirateland.txd/tislandledge01_64.dds\",\n \"gta3.img/pirateship01.txd/tislandbanister.dds\",\"gta3.img/pirateland.txd/tislandbanister.dds\",\n \"gta3.img/pirateship01.txd/tislandledge03_128.dds\",\"gta3.img/pirateland.txd/tislandledge03_128.dds\",\n \"gta_int.img/dr_gsnew.txd/ab_wood_pot.dds\",\"gta3.img/pirateship01.txd/ab_wood_pot.dds\",\n \"gta_int.img/madbedrooms.txd/ab_wood_pot.dds\",\"gta3.img/pirateship01.txd/ab_wood_pot.dds\",\n \"gta_int.img/madpoolbit.txd/ab_wood_pot.dds\",\"gta3.img/pirateship01.txd/ab_wood_pot.dds\",\n \"gta_int.img/ab_mafiasuitea.txd/ab_wood01.dds\",\"gta3.img/pirateship01.txd/ab_wood01.dds\",\n \"gta_int.img/ab_wooziec.txd/ab_wood01.dds\",\"gta3.img/pirateship01.txd/ab_wood01.dds\",\n \"gta3.img/sunst18_lawn.txd/tislandwall02_128.dds\",\"gta3.img/pirateship01.txd/tislandwall02_128.dds\",\n \"gta_int.img/cuntcuts.txd/piratesign01_128.dds\",\"gta3.img/pirateship01.txd/piratesign01_128.dds\",\n \"gta_int.img/savesfmid.txd/piratesign01_128.dds\",\"gta3.img/pirateship01.txd/piratesign01_128.dds\",\n \"gta_int.img/svsfsm.txd/piratesign01_128.dds\",\"gta3.img/pirateship01.txd/piratesign01_128.dds\",\n \"gta3.img/vgsbikesclint.txd/newtreeleavesb128.dds\",\"gta3.img/plants_officeext.txd/newtreeleavesb128.dds\",\n \"gta_int.img/crlsbits.txd/newtreeleavesb128.dds\",\"gta3.img/plants_officeext.txd/newtreeleavesb128.dds\",\n \"gta_int.img/genhotelsave.txd/newtreeleavesb128.dds\",\"gta3.img/plants_officeext.txd/newtreeleavesb128.dds\",\n \"gta_int.img/im_xtra.txd/newtreeleavesb128.dds\",\"gta3.img/plants_officeext.txd/newtreeleavesb128.dds\",\n \"gta_int.img/plants.txd/newtreeleavesb128.dds\",\"gta3.img/plants_officeext.txd/newtreeleavesb128.dds\",\n \"gta_int.img/plants_office.txd/cooker3.dds\",\"gta3.img/plants_officeext.txd/cooker3.dds\",\n \"gta3.img/skyscrap2_lan2.txd/sl_blokpave1.dds\",\"gta3.img/plaza1_lan2.txd/sl_blokpave1.dds\",\n \"gta3.img/stolenbuild03.txd/sl_blokpave1.dds\",\"gta3.img/plaza1_lan2.txd/sl_blokpave1.dds\",\n \"gta3.img/pyr_roof.txd/ws_trans_block.dds\",\"gta3.img/pointysfe.txd/ws_trans_block.dds\",\n \"gta3.img/seaspar.txd/sparrow92texpage64.dds\",\"gta3.img/polmav.txd/polmav92texpageb64.dds\",\n \"gta3.img/sparrow.txd/sparrow92texpage64.dds\",\"gta3.img/polmav.txd/polmav92texpageb64.dds\",\n \"gta3.img/vcnmav.txd/polmav92texpageb64.dds\",\"gta3.img/polmav.txd/polmav92texpageb64.dds\",\n \"gta3.img/topfun.txd/pony92interior128.dds\",\"gta3.img/pony.txd/pony92interior128.dds\",\n \"gta3.img/vgsbikeschool.txd/ws_portacabin3.dds\",\"gta3.img/portakabin.txd/ws_portacabin3.dds\",\n \"gta3.img/vgsbikeschool.txd/ws_portacabin2.dds\",\"gta3.img/portakabin.txd/ws_portacabin2.dds\",\n \"gta3.img/smallertxd.txd/posh_eagle5_sfe.dds\",\"gta3.img/posh_sfe.txd/posh_eagle5_sfe.dds\",\n \"gta3.img/vgesvhouse01.txd/ws_alley2_128_plain.dds\",\"gta3.img/posh_sfe.txd/ws_alley2_128_plain.dds\",\n \"gta3.img/vgwsavehses.txd/ws_alley2_128_plain.dds\",\"gta3.img/posh_sfe.txd/ws_alley2_128_plain.dds\",\n \"gta3.img/vgsncircon.txd/chemtoilet2256.dds\",\"gta3.img/potax.txd/chemtoilet2256.dds\",\n \"gta3.img/vgsncircon.txd/chemtoilet1256.dds\",\"gta3.img/potax.txd/chemtoilet1256.dds\",\n \"gta3.img/rodeo02_law2.txd/yelloconc_la.dds\",\"gta3.img/presidio01_sfn.txd/yelloconc_la.dds\",\n \"gta3.img/rodeo03_law2.txd/yelloconc_la.dds\",\"gta3.img/presidio01_sfn.txd/yelloconc_la.dds\",\n \"gta3.img/rodeo05_law2.txd/yelloconc_la.dds\",\"gta3.img/presidio01_sfn.txd/yelloconc_la.dds\",\n \"gta3.img/sancliff_law2.txd/yelloconc_la.dds\",\"gta3.img/presidio01_sfn.txd/yelloconc_la.dds\",\n \"gta3.img/sunset03_law2.txd/yelloconc_la.dds\",\"gta3.img/presidio01_sfn.txd/yelloconc_la.dds\",\n \"gta3.img/sfn_apart02sfn.txd/sl_presdoor02.dds\",\"gta3.img/presidio01_sfn.txd/sl_presdoor02.dds\",\n \"gta3.img/stuff2_sfn.txd/sl_presdoor02.dds\",\"gta3.img/presidio01_sfn.txd/sl_presdoor02.dds\",\n \"gta3.img/sfn_apart02sfn.txd/sl_presdoor01.dds\",\"gta3.img/presidio01_sfn.txd/sl_presdoor01.dds\",\n \"gta3.img/sfn_apart02sfn.txd/sl_whitewood01.dds\",\"gta3.img/presidio01_sfn.txd/sl_whitewood01.dds\",\n \"gta3.img/stuff2_sfn.txd/sl_whitewood01.dds\",\"gta3.img/presidio01_sfn.txd/sl_whitewood01.dds\",\n \"gta3.img/stuff2_sfn.txd/sl_presroofedg01.dds\",\"gta3.img/presidio01_sfn.txd/sl_presroofedg01.dds\",\n \"gta3.img/stuff2_sfn.txd/sl_clayroof01.dds\",\"gta3.img/presidio01_sfn.txd/sl_clayroof01.dds\",\n \"gta3.img/tampa.txd/tampa92wheel64.dds\",\"gta3.img/previon.txd/previon92wheel64.dds\",\n \"gta3.img/vincent.txd/vincent92wheel64.dds\",\"gta3.img/previon.txd/previon92wheel64.dds\",\n \"gta_int.img/castable.txd/cl_winebtl2.dds\",\"gta3.img/propbarstuff.txd/cl_winebtl2.dds\",\n \"gta_int.img/castable.txd/cl_redwine_gls.dds\",\"gta3.img/propbarstuff.txd/cl_redwine_gls.dds\",\n \"gta_int.img/castable.txd/cl_hiball2.dds\",\"gta3.img/propbarstuff.txd/cl_hiball2.dds\",\n \"gta_int.img/castable.txd/cl_cigar_1.dds\",\"gta3.img/propbarstuff.txd/cl_cigar_1.dds\",\n \"gta_int.img/castable.txd/cl_cig.dds\",\"gta3.img/propbarstuff.txd/cl_cig.dds\",\n \"gta_int.img/castable.txd/cl_ashtray.dds\",\"gta3.img/propbarstuff.txd/cl_ashtray.dds\",\n \"gta_int.img/castable.txd/cl_winebtl1.dds\",\"gta3.img/propbarstuff.txd/cl_winebtl1.dds\",\n \"gta3.img/vgnpwrwhse.txd/ws_corr_1_red.dds\",\"gta3.img/qrydrx.txd/ws_corr_1_red.dds\",\n \"gta3.img/subshops_sfs.txd/ws_fancyshop1c.dds\",\"gta3.img/queens1_sfs.txd/ws_fancyshop1c.dds\",\n \"gta3.img/queens2_sfs.txd/ws_fancyshop1.dds\",\"gta3.img/queens1_sfs.txd/ws_fancyshop1.dds\",\n \"gta3.img/queens2_sfs.txd/ws_fancyshop1b.dds\",\"gta3.img/queens1_sfs.txd/ws_fancyshop1b.dds\",\n \"gta3.img/subshops_sfs.txd/ws_fancyshop1b.dds\",\"gta3.img/queens1_sfs.txd/ws_fancyshop1b.dds\",\n \"gta3.img/subshops_sfs.txd/ws_fancyshop1e.dds\",\"gta3.img/queens1_sfs.txd/ws_fancyshop1e.dds\",\n \"gta3.img/sancliff_law2.txd/ws_apartmentmankypeach2.dds\",\"gta3.img/queens2_sfs.txd/ws_apartmentmankypeach2.dds\",\n \"gta_int.img/ab_sfammuitems01.txd/ammu_gunboard3.dds\",\"gta3.img/queensammo_sfs.txd/ammu_gunboard3.dds\",\n \"gta_int.img/ammu_2flrprops.txd/ammu_gunboard3.dds\",\"gta3.img/queensammo_sfs.txd/ammu_gunboard3.dds\",\n \"gta_int.img/cj_ammun_extra.txd/ammu_gunboard3.dds\",\"gta3.img/queensammo_sfs.txd/ammu_gunboard3.dds\",\n \"gta_int.img/munation_xtras2.txd/ammu_gunboard3.dds\",\"gta3.img/queensammo_sfs.txd/ammu_gunboard3.dds\",\n \"gta3.img/traintrack_las.txd/lasjmroof.dds\",\"gta3.img/railway_las.txd/lasjmroof.dds\",\n \"gta3.img/union_las.txd/lasjmroof.dds\",\"gta3.img/railway_las.txd/lasjmroof.dds\",\n \"gta3.img/traintrack_las.txd/lasunion7.dds\",\"gta3.img/railway_las.txd/lasunion7.dds\",\n \"gta3.img/union_las.txd/lasunion7.dds\",\"gta3.img/railway_las.txd/lasunion7.dds\",\n \"gta3.img/wiresetc2_las.txd/lasunion7.dds\",\"gta3.img/railway_las.txd/lasunion7.dds\",\n \"gta3.img/traintrack_las.txd/lasunion5.dds\",\"gta3.img/railway_las.txd/lasunion5.dds\",\n \"gta3.img/union_las.txd/lasunion5.dds\",\"gta3.img/railway_las.txd/lasunion5.dds\",\n \"gta3.img/traintrack_las.txd/lasunion2.dds\",\"gta3.img/railway_las.txd/lasunion2.dds\",\n \"gta3.img/union_las.txd/lasunion2.dds\",\"gta3.img/railway_las.txd/lasunion2.dds\",\n \"gta3.img/wiresetc2_las.txd/lasunion2.dds\",\"gta3.img/railway_las.txd/lasunion2.dds\",\n \"gta3.img/trainplatform_sfse.txd/railplatformwall.dds\",\"gta3.img/railway_las.txd/railplatformwall.dds\",\n \"gta3.img/vgnrailroad.txd/railplatformwall.dds\",\"gta3.img/railway_las.txd/railplatformwall.dds\",\n \"gta3.img/vgsrailroad.txd/railplatformwall.dds\",\"gta3.img/railway_las.txd/railplatformwall.dds\",\n \"gta3.img/vgwestrailrd.txd/railplatformwall.dds\",\"gta3.img/railway_las.txd/railplatformwall.dds\",\n \"gta3.img/rccam.txd/rcbandit92wheel32.dds\",\"gta3.img/rcbandit.txd/rcbandit92wheel32.dds\",\n \"gta3.img/rcgoblin.txd/rcgoblin92rotor64.dds\",\"gta3.img/rcbaron.txd/rcbaron92rotor64.dds\",\n \"gta3.img/rcraider.txd/rcraider92rotor64.dds\",\"gta3.img/rcbaron.txd/rcbaron92rotor64.dds\",\n \"gta3.img/rcraider.txd/rcraider92texpage32.dds\",\"gta3.img/rcgoblin.txd/rcgoblin92texpage32.dds\",\n \"gta3.img/weemap.txd/steel256128.dds\",\"gta3.img/rczero4.txd/steel256128.dds\",\n \"gta3.img/vgnretail72.txd/solairtyre64.dds\",\"gta3.img/rdtraint.txd/rdtraint92tyre64.dds\",\n \"gta_int.img/cj_tv.txd/tv_1.dds\",\"gta3.img/recroomsfse.txd/tv_1.dds\",\n \"gta_int.img/crlsbits.txd/tv_1.dds\",\"gta3.img/recroomsfse.txd/tv_1.dds\",\n \"gta3.img/stallion.txd/stallion92wheel64.dds\",\"gta3.img/regina.txd/regina92wheel64.dds\",\n \"gta3.img/vgsshospshop.txd/residential02_256.dds\",\"gta3.img/residential01.txd/residential02_256.dds\",\n \"gta3.img/vgntamotel.txd/residence03_128.dds\",\"gta3.img/residnce01.txd/residence03_128.dds\",\n \"gta3.img/tikimotel.txd/residence02_256.dds\",\"gta3.img/residnce01.txd/residence02_256.dds\",\n \"gta3.img/tikimotel.txd/residence01_256.dds\",\"gta3.img/residnce01.txd/residence01_256.dds\",\n \"gta3.img/sfsroadshotel.txd/monobloc_256128.dds\",\"gta3.img/richman02_lahills.txd/monobloc_256128.dds\",\n \"gta3.img/vgnland.txd/monobloc_256128.dds\",\"gta3.img/richman02_lahills.txd/monobloc_256128.dds\",\n \"gta3.img/vgssland01.txd/monobloc_256128.dds\",\"gta3.img/richman02_lahills.txd/monobloc_256128.dds\",\n \"gta3.img/vgsswarehse02c.txd/monobloc_256128.dds\",\"gta3.img/richman02_lahills.txd/monobloc_256128.dds\",\n \"gta3.img/seabedcs.txd/sw_sand.dds\",\"gta3.img/roadblkx.txd/sw_sand.dds\",\n \"gta3.img/seabed.txd/sw_sand.dds\",\"gta3.img/roadblkx.txd/sw_sand.dds\",\n \"gta3.img/roadslahills.txd/roadnew4blend_256.dds\",\"gta3.img/roads_lahills.txd/roadnew4blend_256.dds\",\n \"gta3.img/sunrise01_lawn.txd/starpave_law.dds\",\"gta3.img/roads_lawn.txd/starpave_law.dds\",\n \"gta3.img/vgseroads.txd/crossing2_law.dds\",\"gta3.img/roads_law.txd/crossing2_law.dds\",\n \"gta3.img/rodeo05_law2.txd/glassentrace2.dds\",\"gta3.img/rodeo01_law2.txd/glassentrace2.dds\",\n \"gta3.img/rodeo05_law2.txd/rodwall10_law2.dds\",\"gta3.img/rodeo01_law2.txd/rodwall10_law2.dds\",\n \"gta3.img/sunset02_law2.txd/rodwall10_law2.dds\",\"gta3.img/rodeo01_law2.txd/rodwall10_law2.dds\",\n \"gta3.img/sunset01_law2.txd/rodwall09_law2.dds\",\"gta3.img/rodeo01_law2.txd/rodwall09_law2.dds\",\n \"gta3.img/rodeo05_law2.txd/ceaserpillar01_256.dds\",\"gta3.img/rodeo01_law2.txd/ceaserpillar01_256.dds\",\n \"gta3.img/sunset01_law2.txd/rodwall07_law2.dds\",\"gta3.img/rodeo01_law2.txd/rodwall07_law2.dds\",\n \"gta3.img/sunset02_law2.txd/rodwall07_law2.dds\",\"gta3.img/rodeo01_law2.txd/rodwall07_law2.dds\",\n \"gta3.img/rodeo05_law2.txd/rodesign02_la.dds\",\"gta3.img/rodeo01_law2.txd/rodesign02_la.dds\",\n \"gta3.img/rodeo02_law2.txd/rodesign01_la.dds\",\"gta3.img/rodeo01_law2.txd/rodesign01_la.dds\",\n \"gta3.img/rodeo05_law2.txd/rodesign01_la.dds\",\"gta3.img/rodeo01_law2.txd/rodesign01_la.dds\",\n \"gta3.img/rodeot01_law2.txd/rodesign01_la.dds\",\"gta3.img/rodeo01_law2.txd/rodesign01_la.dds\",\n \"gta3.img/rodeo05_law2.txd/rodeowind3.dds\",\"gta3.img/rodeo01_law2.txd/rodeowind3.dds\",\n \"gta3.img/sunset01_law2.txd/rodwall01_law2.dds\",\"gta3.img/rodeo01_law2.txd/rodwall01_law2.dds\",\n \"gta3.img/ufo_bar.txd/woodboards1.dds\",\"gta3.img/rodeo02_law2.txd/woodboards1.dds\",\n \"gta3.img/sunrise09_lawn.txd/hollywall02_law.dds\",\"gta3.img/rodeo02_law2.txd/hollywall02_law.dds\",\n \"gta3.img/sancliff02_law2.txd/oranconc01_la.dds\",\"gta3.img/rodeo02_law2.txd/oranconc01_la.dds\",\n \"gta3.img/sunset01_law2.txd/century01_la.dds\",\"gta3.img/rodeo03_law2.txd/century01_la.dds\",\n \"gta3.img/rodeost01_lax.txd/sl_hirisergrnconc.dds\",\"gta3.img/rodeo03_law2.txd/sl_hirisergrnconc.dds\",\n \"gta3.img/slapart01sfe.txd/sl_hirisergrnconc.dds\",\"gta3.img/rodeo03_law2.txd/sl_hirisergrnconc.dds\",\n \"gta3.img/rodeo05_law2.txd/golf_hedge1.dds\",\"gta3.img/rodeo04_law2.txd/golf_hedge1.dds\",\n \"gta3.img/sancliff02_law2.txd/golf_hedge1.dds\",\"gta3.img/rodeo04_law2.txd/golf_hedge1.dds\",\n \"gta3.img/vegashse8.txd/golf_hedge1.dds\",\"gta3.img/rodeo04_law2.txd/golf_hedge1.dds\",\n \"gta3.img/sunset02_law2.txd/airportwind04.dds\",\"gta3.img/rodeo05_law2.txd/airportwind04.dds\",\n \"gta3.img/sunst18_lawn.txd/citywall6.dds\",\"gta3.img/rodeo05_law2.txd/citywall6.dds\",\n \"gta3.img/sunset02_law2.txd/rodeowin02.dds\",\"gta3.img/rodeo05_law2.txd/rodeowin02.dds\",\n \"gta3.img/silicon2_sfse.txd/siliconvalleywins1.dds\",\"gta3.img/rodeo05_law2.txd/siliconvalleywins1.dds\",\n \"gta3.img/sancliff02_law2.txd/ab_shinypanel.dds\",\"gta3.img/rodeo05_law2.txd/ab_shinypanel.dds\",\n \"gta3.img/sunset02_law2.txd/ab_shinypanel.dds\",\"gta3.img/rodeo05_law2.txd/ab_shinypanel.dds\",\n \"gta_int.img/otb_machine.txd/ab_shinypanel.dds\",\"gta3.img/rodeo05_law2.txd/ab_shinypanel.dds\",\n \"gta3.img/ryder.txd/ryder.dds\",\"gta3.img/ryder2.txd/ryder2.dds\",\n \"gta3.img/sadlshit.txd/sadler92extra64.dds\",\"gta3.img/sadler.txd/sadler92extra64.dds\",\n \"gta3.img/sadlshit.txd/sadler92interior128.dds\",\"gta3.img/sadler.txd/sadler92interior128.dds\",\n \"gta3.img/sadlshit.txd/sadler92wheel64.dds\",\"gta3.img/sadler.txd/sadler92wheel64.dds\",\n \"gta3.img/sancliff02_law2.txd/sanmonwin01.dds\",\"gta3.img/sanclifbal1_lax.txd/sanmonwin01.dds\",\n \"gta3.img/sancliff_law2.txd/yelloconcw_la.dds\",\"gta3.img/sanclifbal1_lax.txd/yelloconcw_la.dds\",\n \"gta3.img/sancliff02_law2.txd/whiteconc01.dds\",\"gta3.img/sanclifbal1_lax.txd/whiteconc01.dds\",\n \"gta3.img/sancliff_law2.txd/whiteconc01.dds\",\"gta3.img/sanclifbal1_lax.txd/whiteconc01.dds\",\n \"gta3.img/sunrise11_lawn.txd/whiteconc01.dds\",\"gta3.img/sanclifbal1_lax.txd/whiteconc01.dds\",\n \"gta3.img/sunset02_law2.txd/whiteconc01.dds\",\"gta3.img/sanclifbal1_lax.txd/whiteconc01.dds\",\n \"gta3.img/sunrise08_lawn.txd/windblind_law.dds\",\"gta3.img/sancliff_law2.txd/windblind_law.dds\",\n \"gta3.img/sf_roads.txd/sf_tramline2.dds\",\"gta3.img/sanfranroads.txd/sf_tramline2.dds\",\n \"gta3.img/sf_roads.txd/sf_road5.dds\",\"gta3.img/sanfranroads.txd/sf_road5.dds\",\n \"gta3.img/sf_roads.txd/sf_pave6.dds\",\"gta3.img/sanfranroads.txd/sf_pave6.dds\",\n \"gta3.img/sf_roads.txd/sf_junction5.dds\",\"gta3.img/sanfranroads.txd/sf_junction5.dds\",\n \"gta3.img/sf_roads.txd/sf_junction3.dds\",\"gta3.img/sanfranroads.txd/sf_junction3.dds\",\n \"gta3.img/sfvictorian.txd/gz_vic8a.dds\",\"gta3.img/sanfranvictorian.txd/gz_vic8a.dds\",\n \"gta3.img/santamonhus1.txd/lasmulap4.dds\",\"gta3.img/sanpedhse_1x.txd/lasmulap4.dds\",\n \"gta3.img/santamonhus1.txd/lasmulap5.dds\",\"gta3.img/sanpedhse_1x.txd/lasmulap5.dds\",\n \"gta3.img/santamonhus.txd/lasmulap5.dds\",\"gta3.img/sanpedhse_1x.txd/lasmulap5.dds\",\n \"gta3.img/vgse24hr.txd/snpedflatt2.dds\",\"gta3.img/sanpedhse_1x.txd/snpedflatt2.dds\",\n \"gta3.img/shops01_law.txd/laspedhus91.dds\",\"gta3.img/sanpedhse_1x.txd/laspedhus91.dds\",\n \"gta3.img/santamopollaw2.txd/asanwall1.dds\",\"gta3.img/santamonicalaw2.txd/asanwall1.dds\",\n \"gta3.img/tornado.txd/tornado92wheel64.dds\",\"gta3.img/savanna.txd/savanna92wheel64.dds\",\n \"gta3.img/wmotrm2.txd/tramp2.dds\",\"gta3.img/sbmotr3.txd/tramp2.dds\",\n \"gta3.img/vgnscaffold.txd/gen_scaffold_wood.dds\",\"gta3.img/scaffolding_sfx.txd/gen_scaffold_wood.dds\",\n \"gta_int.img/pleas_dome.txd/timber_gz.dds\",\"gta3.img/scaff_sfw.txd/timber_gz.dds\",\n \"gta_int.img/pleas_dome.txd/scaffold_stuff.dds\",\"gta3.img/scaff_sfw.txd/scaffold_stuff.dds\",\n \"gta3.img/seabed.txd/rocktq128_dirt.dds\",\"gta3.img/seabedcs.txd/rocktq128_dirt.dds\",\n \"gta3.img/seabed.txd/cw2_mounttrailblank.dds\",\"gta3.img/seabedcs.txd/cw2_mounttrailblank.dds\",\n \"gta3.img/sparrow.txd/sparrow92texpage128.dds\",\"gta3.img/seaspar.txd/sparrow92texpage128.dds\",\n \"gta3.img/sparrow.txd/sparrow92tail64.dds\",\"gta3.img/seaspar.txd/sparrow92tail64.dds\",\n \"gta3.img/sfn_helipad.txd/helipad_base.dds\",\"gta3.img/sfe_copchop.txd/helipad_base.dds\",\n \"gta3.img/vgnhelipad1.txd/helipad_base.dds\",\"gta3.img/sfe_copchop.txd/helipad_base.dds\",\n \"gta3.img/ship_brijsfw.txd/cop_notice.dds\",\"gta3.img/sfeship1.txd/cop_notice.dds\",\n \"gta_int.img/genintintpolicea.txd/cop_notice.dds\",\"gta3.img/sfeship1.txd/cop_notice.dds\",\n \"gta3.img/ship_brijsfw.txd/sf_ship_generic28.dds\",\"gta3.img/sfeship1.txd/sf_ship_generic28.dds\",\n \"gta3.img/ship_brijsfw.txd/sf_ship_generic27.dds\",\"gta3.img/sfeship1.txd/sf_ship_generic27.dds\",\n \"gta3.img/sw_block01.txd/cj_plantpot.dds\",\"gta3.img/sfeship1.txd/cj_plantpot.dds\",\n \"gta_int.img/cj_lighting.txd/cj_plantpot.dds\",\"gta3.img/sfeship1.txd/cj_plantpot.dds\",\n \"gta_int.img/crlsbits.txd/cj_plantpot.dds\",\"gta3.img/sfeship1.txd/cj_plantpot.dds\",\n \"gta_int.img/gb_ornaments01.txd/cj_plantpot.dds\",\"gta3.img/sfeship1.txd/cj_plantpot.dds\",\n \"gta_int.img/genhotelsave.txd/cj_plantpot.dds\",\"gta3.img/sfeship1.txd/cj_plantpot.dds\",\n \"gta_int.img/im_xtra.txd/cj_plantpot.dds\",\"gta3.img/sfeship1.txd/cj_plantpot.dds\",\n \"gta_int.img/labig1int2.txd/cj_plantpot.dds\",\"gta3.img/sfeship1.txd/cj_plantpot.dds\",\n \"gta_int.img/plants_office.txd/cj_plantpot.dds\",\"gta3.img/sfeship1.txd/cj_plantpot.dds\",\n \"gta_int.img/plants_tabletop.txd/cj_plantpot.dds\",\"gta3.img/sfeship1.txd/cj_plantpot.dds\",\n \"gta_int.img/plants.txd/cj_plantpot.dds\",\"gta3.img/sfeship1.txd/cj_plantpot.dds\",\n \"gta_int.img/rystuff.txd/cj_plantpot.dds\",\"gta3.img/sfeship1.txd/cj_plantpot.dds\",\n \"gta_int.img/vegassavesmal.txd/cj_plantpot.dds\",\"gta3.img/sfeship1.txd/cj_plantpot.dds\",\n \"gta3.img/ship_brijsfw.txd/sf_shipcomp2.dds\",\"gta3.img/sfeship1.txd/sf_shipcomp2.dds\",\n \"gta3.img/ship_brijsfw.txd/sf_shipcomp.dds\",\"gta3.img/sfeship1.txd/sf_shipcomp.dds\",\n \"gta3.img/ship_brijsfw.txd/sf_ship_screen1.dds\",\"gta3.img/sfeship1.txd/sf_ship_screen1.dds\",\n \"gta3.img/ship_brijsfw.txd/sf_ship_generic5.dds\",\"gta3.img/sfeship1.txd/sf_ship_generic5.dds\",\n \"gta3.img/ship_brijsfw.txd/sf_ship_generic4.dds\",\"gta3.img/sfeship1.txd/sf_ship_generic4.dds\",\n \"gta3.img/ship_brijsfw.txd/sf_ship_generic24.dds\",\"gta3.img/sfeship1.txd/sf_ship_generic24.dds\",\n \"gta3.img/ship_brijsfw.txd/sf_ship_generic21.dds\",\"gta3.img/sfeship1.txd/sf_ship_generic21.dds\",\n \"gta3.img/ship_brijsfw.txd/sf_ship_generic15.dds\",\"gta3.img/sfeship1.txd/sf_ship_generic15.dds\",\n \"gta3.img/ship_brijsfw.txd/sf_ship_generic14.dds\",\"gta3.img/sfeship1.txd/sf_ship_generic14.dds\",\n \"gta3.img/ship_brijsfw.txd/cj_plastic.dds\",\"gta3.img/sfeship1.txd/cj_plastic.dds\",\n \"gta_int.img/cj_office.txd/cj_plastic.dds\",\"gta3.img/sfeship1.txd/cj_plastic.dds\",\n \"gta3.img/ship_brijsfw.txd/cj_cushion2.dds\",\"gta3.img/sfeship1.txd/cj_cushion2.dds\",\n \"gta_int.img/cj_office.txd/cj_cushion2.dds\",\"gta3.img/sfeship1.txd/cj_cushion2.dds\",\n \"gta3.img/ship_brijsfw.txd/sf_ship_generic8.dds\",\"gta3.img/sfeship1.txd/sf_ship_generic8.dds\",\n \"gta3.img/ship_brijsfw.txd/sf_ship_door.dds\",\"gta3.img/sfeship1.txd/sf_ship_door.dds\",\n \"gta3.img/ship_brijsfw.txd/sf_ship_generic3.dds\",\"gta3.img/sfeship1.txd/sf_ship_generic3.dds\",\n \"gta3.img/ship_brijsfw.txd/sf_ship_generic22.dds\",\"gta3.img/sfeship1.txd/sf_ship_generic22.dds\",\n \"gta3.img/ship_brijsfw.txd/sf_ship_generic20.dds\",\"gta3.img/sfeship1.txd/sf_ship_generic20.dds\",\n \"gta3.img/ship_brijsfw.txd/sf_ship_generic19.dds\",\"gta3.img/sfeship1.txd/sf_ship_generic19.dds\",\n \"gta3.img/ship_brijsfw.txd/sf_ship_generic18.dds\",\"gta3.img/sfeship1.txd/sf_ship_generic18.dds\",\n \"gta3.img/ship_brijsfw.txd/sf_ship_generic16.dds\",\"gta3.img/sfeship1.txd/sf_ship_generic16.dds\",\n \"gta3.img/ship_brijsfw.txd/sf_ship_generic11.dds\",\"gta3.img/sfeship1.txd/sf_ship_generic11.dds\",\n \"gta3.img/ship_brijsfw.txd/sf_ship_generic1.dds\",\"gta3.img/sfeship1.txd/sf_ship_generic1.dds\",\n \"gta3.img/smallertxd.txd/sf_shop1.dds\",\"gta3.img/sfe_swank1.txd/sf_shop1.dds\",\n \"gta3.img/stuff2_sfn.txd/fencewhta256.dds\",\"gta3.img/sfn_apart02sfn.txd/fencewhta256.dds\",\n \"gta3.img/sw_apartments.txd/fencewhta256.dds\",\"gta3.img/sfn_apart02sfn.txd/fencewhta256.dds\",\n \"gta3.img/vegashse5.txd/newindow12.dds\",\"gta3.img/sfn_apart02sfn.txd/newindow12.dds\",\n \"gta3.img/vegashse7.txd/newindow12.dds\",\"gta3.img/sfn_apart02sfn.txd/newindow12.dds\",\n \"gta3.img/vegassvehse7.txd/newindow12.dds\",\"gta3.img/sfn_apart02sfn.txd/newindow12.dds\",\n \"gta3.img/sw_apartflatx.txd/newindow10.dds\",\"gta3.img/sfn_apart02sfn.txd/newindow10.dds\",\n \"gta3.img/trailers.txd/trail_wall4.dds\",\"gta3.img/sfn_caravansfn.txd/trail_wall4.dds\",\n \"gta3.img/vgnfremnt1.txd/scmgarage1_128.dds\",\"gta3.img/sfn_caravansfn.txd/trail_wall4.dds\",\n \"gta3.img/vgnfremnt2.txd/scmgarage1_128.dds\",\"gta3.img/sfn_caravansfn.txd/trail_wall4.dds\",\n \"gta3.img/trailers.txd/trail_vent.dds\",\"gta3.img/sfn_caravansfn.txd/trail_vent.dds\",\n \"gta3.img/trailers.txd/trail_wall3.dds\",\"gta3.img/sfn_caravansfn.txd/trail_wall3.dds\",\n \"gta3.img/trailers.txd/trail_side1.dds\",\"gta3.img/sfn_caravansfn.txd/trail_side1.dds\",\n \"gta3.img/vgwstdirtyrd.txd/sfn_crashbar.dds\",\"gta3.img/sfn_crashbar.txd/sfn_crashbar.dds\",\n \"gta3.img/vgsshospshop.txd/genwndw01_128.dds\",\"gta3.img/sfn_helipad.txd/genwndw01_128.dds\",\n \"gta3.img/smallertxd.txd/law_gazwhite3.dds\",\"gta3.img/sfn_office.txd/law_gazwhite3.dds\",\n \"gta3.img/vict_sfw.txd/gz_sf_door12b.dds\",\"gta3.img/sfvictorian.txd/gz_sf_door12b.dds\",\n \"gta3.img/vict_sfw.txd/gz_vic7d.dds\",\"gta3.img/sfvictorian.txd/gz_vic7d.dds\",\n \"gta3.img/vict_sfw.txd/gz_vic7c.dds\",\"gta3.img/sfvictorian.txd/gz_vic7c.dds\",\n \"gta3.img/vict_sfw.txd/gz_vic7b.dds\",\"gta3.img/sfvictorian.txd/gz_vic7b.dds\",\n \"gta3.img/vict_sfw.txd/gz_vic7a.dds\",\"gta3.img/sfvictorian.txd/gz_vic7a.dds\",\n \"gta3.img/vict_sfw.txd/gz_vic5d.dds\",\"gta3.img/sfvictorian.txd/gz_vic5d.dds\",\n \"gta3.img/vict_sfw.txd/gz_vic5b.dds\",\"gta3.img/sfvictorian.txd/gz_vic5b.dds\",\n \"gta3.img/vict_sfw.txd/gz_vic5c.dds\",\"gta3.img/sfvictorian.txd/gz_vic5c.dds\",\n \"gta3.img/vict_sfw.txd/gz_vic5a.dds\",\"gta3.img/sfvictorian.txd/gz_vic5a.dds\",\n \"gta3.img/vict_sfw.txd/gz_vic6d.dds\",\"gta3.img/sfvictorian.txd/gz_vic6d.dds\",\n \"gta3.img/vict_sfw.txd/gz_vic6c.dds\",\"gta3.img/sfvictorian.txd/gz_vic6c.dds\",\n \"gta3.img/vict_sfw.txd/gz_vic6b.dds\",\"gta3.img/sfvictorian.txd/gz_vic6b.dds\",\n \"gta3.img/vict_sfw.txd/gz_vic6a.dds\",\"gta3.img/sfvictorian.txd/gz_vic6a.dds\",\n \"gta3.img/vgsenitwin.txd/vgsn_nl_strip.dds\",\"gta3.img/sfwngtlites.txd/vgsn_nl_strip.dds\",\n \"gta3.img/vgsnnitwin.txd/vgsn_nl_strip.dds\",\"gta3.img/sfwngtlites.txd/vgsn_nl_strip.dds\",\n \"gta3.img/vegashse3.txd/concretewall1_256.dds\",\"gta3.img/shamcpark.txd/concretewall1_256.dds\",\n \"gta3.img/vgnshamcpark.txd/concretewall1_256.dds\",\"gta3.img/shamcpark.txd/concretewall1_256.dds\",\n \"gta3.img/vgssairport02.txd/concretewall1_256.dds\",\"gta3.img/shamcpark.txd/concretewall1_256.dds\",\n \"gta3.img/vgs_stadium.txd/concretewall1_256.dds\",\"gta3.img/shamcpark.txd/concretewall1_256.dds\",\n \"gta3.img/shandr.txd/blue2.dds\",\"gta3.img/shandl.txd/blue2.dds\",\n \"gta3.img/shop09.txd/vegashops03_128.dds\",\"gta3.img/shop06_lvs.txd/vegashops03_128.dds\",\n \"gta3.img/vgsswarehse02c.txd/vegashops02_128.dds\",\"gta3.img/shop06_lvs.txd/vegashops02_128.dds\",\n \"gta3.img/sunrise04_lawn.txd/greenshade2_64.dds\",\"gta3.img/shops01_law.txd/greenshade2_64.dds\",\n \"gta3.img/tempo22_law.txd/gb_shopdoor01.dds\",\"gta3.img/shops01_law.txd/gb_shopdoor01.dds\",\n \"gta3.img/venicegb02_law.txd/gb_shopdoor01.dds\",\"gta3.img/shops01_law.txd/gb_shopdoor01.dds\",\n \"gta3.img/vgsswarehse02c.txd/gb_shopdoor01.dds\",\"gta3.img/shops01_law.txd/gb_shopdoor01.dds\",\n \"gta3.img/sw_fact01.txd/biffoffwin_law.dds\",\"gta3.img/shops2_law.txd/biffoffwin_law.dds\",\n \"gta_int.img/ab_sfammumain.txd/gun_ceiling1.dds\",\"gta3.img/shops2_law.txd/gun_ceiling1.dds\",\n \"gta_int.img/ab_sfgymmain.txd/gun_ceiling1.dds\",\"gta3.img/shops2_law.txd/gun_ceiling1.dds\",\n \"gta_int.img/ammu_twofloor.txd/gun_ceiling1.dds\",\"gta3.img/shops2_law.txd/gun_ceiling1.dds\",\n \"gta_int.img/bikeskool.txd/gun_ceiling1.dds\",\"gta3.img/shops2_law.txd/gun_ceiling1.dds\",\n \"gta_int.img/estate2.txd/gun_ceiling1.dds\",\"gta3.img/shops2_law.txd/gun_ceiling1.dds\",\n \"gta_int.img/munation1.txd/gun_ceiling1.dds\",\"gta3.img/shops2_law.txd/gun_ceiling1.dds\",\n \"gta_int.img/papaerchaseoffice.txd/gun_ceiling1.dds\",\"gta3.img/shops2_law.txd/gun_ceiling1.dds\",\n \"gta_int.img/range_main.txd/gun_ceiling1.dds\",\"gta3.img/shops2_law.txd/gun_ceiling1.dds\",\n \"gta_int.img/vegas_munation.txd/gun_ceiling1.dds\",\"gta3.img/shops2_law.txd/gun_ceiling1.dds\",\n \"gta3.img/tempo22_law.txd/newall8-1blue.dds\",\"gta3.img/shops2_law.txd/newall8-1blue.dds\",\n \"gta3.img/vgnpwrwhse.txd/ws_girderhole.dds\",\"gta3.img/silicon2_sfse.txd/ws_girderhole.dds\",\n \"gta3.img/vgwestabats.txd/ws_girderhole.dds\",\"gta3.img/silicon2_sfse.txd/ws_girderhole.dds\",\n \"gta3.img/traingen_sfse.txd/ws_traingravelblend.dds\",\"gta3.img/silicon_sfse.txd/ws_traingravelblend.dds\",\n \"gta3.img/skyscrap2_lan2.txd/pavementhexagon.dds\",\"gta3.img/silicon_sfse.txd/pavementhexagon.dds\",\n \"gta3.img/stolenbuild02.txd/pavementhexagon.dds\",\"gta3.img/silicon_sfse.txd/pavementhexagon.dds\",\n \"gta3.img/theatrelan2.txd/pavementhexagon.dds\",\"gta3.img/silicon_sfse.txd/pavementhexagon.dds\",\n \"gta3.img/vgncorp1.txd/pavementhexagon.dds\",\"gta3.img/silicon_sfse.txd/pavementhexagon.dds\",\n \"gta3.img/vgseland.txd/pavementhexagon.dds\",\"gta3.img/silicon_sfse.txd/pavementhexagon.dds\",\n \"gta3.img/vgssland01.txd/pavementhexagon.dds\",\"gta3.img/silicon_sfse.txd/pavementhexagon.dds\",\n \"gta3.img/vgs_stadium.txd/pavementhexagon.dds\",\"gta3.img/silicon_sfse.txd/pavementhexagon.dds\",\n \"gta3.img/vgnfremnt2.txd/vgsn_scrollsgn.dds\",\"gta3.img/skullsign.txd/vgsn_scrollsgn.dds\",\n \"gta3.img/stolenbuild01.txd/gm_labuld3_b.dds\",\"gta3.img/skyscr1_lan2.txd/gm_labuld3_b.dds\",\n \"gta3.img/stolenbuild02.txd/gm_labuld3_b.dds\",\"gta3.img/skyscr1_lan2.txd/gm_labuld3_b.dds\",\n \"gta3.img/stolenbuild01.txd/gm_labuld3_a.dds\",\"gta3.img/skyscr1_lan2.txd/gm_labuld3_a.dds\",\n \"gta3.img/theatrelan2.txd/gm_labuld2_b.dds\",\"gta3.img/skyscr1_lan2.txd/gm_labuld2_b.dds\",\n \"gta3.img/stadium_sfse.txd/ws_skywins4.dds\",\"gta3.img/skyscrapper_sfs.txd/ws_skywins4.dds\",\n \"gta3.img/vegasemulticar.txd/bigpark_sfe.dds\",\"gta3.img/smallertxd.txd/bigpark_sfe.dds\",\n \"gta3.img/vegashse2.txd/wash_grnd_mess1_128.dds\",\"gta3.img/smallertxd.txd/wash_grnd_mess1_128.dds\",\n \"gta_int.img/lee_bdupsmain.txd/lasjmslumwin1.dds\",\"gta3.img/snpedhusxref.txd/lasjmslumwin1.dds\",\n \"gta3.img/vgsswarhse04.txd/vgsclubwall08_128.dds\",\"gta3.img/snpedhusxref.txd/vgsclubwall08_128.dds\",\n \"gta3.img/sw_fact01a.txd/kickbarrier.dds\",\"gta3.img/stadium_lae2.txd/kickbarrier.dds\",\n \"gta3.img/sw_fact01.txd/kickbarrier.dds\",\"gta3.img/stadium_lae2.txd/kickbarrier.dds\",\n \"gta3.img/vegasneon.txd/neon.dds\",\"gta3.img/station_sfse.txd/neon.dds\",\n \"gta3.img/vgnfremnt2.txd/neon.dds\",\"gta3.img/station_sfse.txd/neon.dds\",\n \"gta3.img/vgnvrock.txd/neon.dds\",\"gta3.img/station_sfse.txd/neon.dds\",\n \"gta3.img/vgseneonwires.txd/neon.dds\",\"gta3.img/station_sfse.txd/neon.dds\",\n \"gta3.img/vgssairport.txd/neon.dds\",\"gta3.img/station_sfse.txd/neon.dds\",\n \"gta_int.img/lamidint2.txd/mp_apt1_bathfloor1.dds\",\"gta3.img/stationtunnel.txd/mp_apt1_bathfloor1.dds\",\n \"gta_int.img/rybath.txd/mp_apt1_bathfloor1.dds\",\"gta3.img/stationtunnel.txd/mp_apt1_bathfloor1.dds\",\n \"gta_int.img/rylounge.txd/mp_apt1_bathfloor1.dds\",\"gta3.img/stationtunnel.txd/mp_apt1_bathfloor1.dds\",\n \"gta3.img/stolenbuild02.txd/sl_dtbuild1win1.dds\",\"gta3.img/stolenbuild01.txd/sl_dtbuild1win1.dds\",\n \"gta3.img/sultan.txd/sultan92stickers128.dds\",\"gta3.img/stratum.txd/sultan92stickers128.dds\",\n \"gta3.img/streak.txd/streaklogoside128x256.dds\",\"gta3.img/streakc.txd/streakclogoside128x256.dds\",\n \"gta3.img/vegaselod1.txd/ballywall01_lod.dds\",\"gta3.img/stripxreflod.txd/ballywall01_lod.dds\",\n \"gta3.img/vgnpwroutbld2.txd/ws_sub_pen_conc.dds\",\"gta3.img/subpen1_sfse.txd/ws_sub_pen_conc.dds\",\n \"gta3.img/vgseroads.txd/ws_sub_pen_conc.dds\",\"gta3.img/subpen1_sfse.txd/ws_sub_pen_conc.dds\",\n \"gta3.img/vgsshiways.txd/ws_sub_pen_conc.dds\",\"gta3.img/subpen1_sfse.txd/ws_sub_pen_conc.dds\",\n \"gta3.img/vgwestground.txd/ws_sub_pen_conc.dds\",\"gta3.img/subpen1_sfse.txd/ws_sub_pen_conc.dds\",\n \"gta3.img/vgwstdirtyrd.txd/ws_sub_pen_conc.dds\",\"gta3.img/subpen1_sfse.txd/ws_sub_pen_conc.dds\",\n \"gta3.img/vgwsthiway1.txd/ws_sub_pen_conc.dds\",\"gta3.img/subpen1_sfse.txd/ws_sub_pen_conc.dds\",\n \"gta3.img/sunrise10_lawn.txd/holshop_law.dds\",\"gta3.img/sunrise01_lawn.txd/holshop_law.dds\",\n \"gta3.img/sunrise08_lawn.txd/windowbot01_law.dds\",\"gta3.img/sunrise04_lawn.txd/windowbot01_law.dds\",\n \"gta3.img/sunrise08_lawn.txd/lasjmflood1.dds\",\"gta3.img/sunrise04_lawn.txd/lasjmflood1.dds\",\n \"gta3.img/sunst18_lawn.txd/tikboxwall_law.dds\",\"gta3.img/sunrise08_lawn.txd/tikboxwall_law.dds\",\n \"gta3.img/sunset03_law2.txd/downtwin18.dds\",\"gta3.img/sunset01_law2.txd/downtwin18.dds\",\n \"gta_int.img/burger_tray.txd/sprunk_cb.dds\",\"gta3.img/sunset01_law2.txd/sprunk_cb.dds\",\n \"gta_int.img/chick_tray.txd/sprunk_cb.dds\",\"gta3.img/sunset01_law2.txd/sprunk_cb.dds\",\n \"gta_int.img/gb_kitchtake.txd/sprunk_cb.dds\",\"gta3.img/sunset01_law2.txd/sprunk_cb.dds\",\n \"gta_int.img/gb_takeaway01.txd/sprunk_cb.dds\",\"gta3.img/sunset01_law2.txd/sprunk_cb.dds\",\n \"gta_int.img/pizza_tray.txd/sprunk_cb.dds\",\"gta3.img/sunset01_law2.txd/sprunk_cb.dds\",\n \"gta3.img/sunset04_law2.txd/melrorg_law.dds\",\"gta3.img/sunset01_law2.txd/melrorg_law.dds\",\n \"gta3.img/sw_block01.txd/comptwindo5.dds\",\"gta3.img/sunset01_lawn.txd/comptwindo5.dds\",\n \"gta3.img/sw_block09.txd/comptwindo5.dds\",\"gta3.img/sunset01_lawn.txd/comptwindo5.dds\",\n \"gta3.img/sw_roadgas.txd/coinlaundry2_256.dds\",\"gta3.img/sunset03_law2.txd/coinlaundry2_256.dds\",\n \"gta3.img/vegstreetsign.txd/streetsign1_256.dds\",\"gta3.img/sunset03_law2.txd/streetsign1_256.dds\",\n \"gta3.img/sw_block09.txd/pawnsigns01_128.dds\",\"gta3.img/sunset04_law2.txd/pawnsigns01_128.dds\",\n \"gta3.img/vgnfirestat.txd/pawnsigns01_128.dds\",\"gta3.img/sunset04_law2.txd/pawnsigns01_128.dds\",\n \"gta3.img/vgnretail7.txd/pawnsigns01_128.dds\",\"gta3.img/sunset04_law2.txd/pawnsigns01_128.dds\",\n \"gta3.img/vgsebuild02.txd/pawnsigns01_128.dds\",\"gta3.img/sunset04_law2.txd/pawnsigns01_128.dds\",\n \"gta3.img/vgshpground.txd/pawnsigns01_128.dds\",\"gta3.img/sunset04_law2.txd/pawnsigns01_128.dds\",\n \"gta3.img/vgsswarehse02c.txd/pawnsigns01_128.dds\",\"gta3.img/sunset04_law2.txd/pawnsigns01_128.dds\",\n \"gta3.img/vgssland03.txd/concretenew256.dds\",\"gta3.img/sw_apartflat5.txd/concretenew256.dds\",\n \"gta_int.img/intclotheshiphop.txd/concretecj256.dds\",\"gta3.img/sw_apartflat5.txd/concretenew256.dds\",\n \"gta3.img/sw_ware01.txd/sw_lastdrop.dds\",\"gta3.img/sw_apartflat5.txd/sw_lastdrop.dds\",\n \"gta3.img/vgnbballsign2.txd/sw_lastdrop.dds\",\"gta3.img/sw_apartflat5.txd/sw_lastdrop.dds\",\n \"gta3.img/sw_block10.txd/sw_genstore2.dds\",\"gta3.img/sw_apartflat.txd/sw_genstore2.dds\",\n \"gta3.img/sw_block11.txd/sw_genstore2.dds\",\"gta3.img/sw_apartflat.txd/sw_genstore2.dds\",\n \"gta3.img/sw_block04.txd/sw_hardware.dds\",\"gta3.img/sw_apartflat.txd/sw_hardware.dds\",\n \"gta3.img/vgsshospshop.txd/sw_hardware.dds\",\"gta3.img/sw_apartflat.txd/sw_hardware.dds\",\n \"gta3.img/sw_block12.txd/sw_realtywin.dds\",\"gta3.img/sw_apartflat.txd/sw_realtywin.dds\",\n \"gta_int.img/estateprops.txd/bnk_ppr_64.dds\",\"gta3.img/sw_bankint.txd/bnk_ppr_64.dds\",\n \"gta_int.img/estateprops.txd/red_cyl_32.dds\",\"gta3.img/sw_bankint.txd/red_cyl_32.dds\",\n \"gta_int.img/cj_office.txd/beige_64.dds\",\"gta3.img/sw_bankint.txd/beige_64.dds\",\n \"gta_int.img/dr_gsstudio.txd/beige_64.dds\",\"gta3.img/sw_bankint.txd/beige_64.dds\",\n \"gta_int.img/estateprops.txd/beige_64.dds\",\"gta3.img/sw_bankint.txd/beige_64.dds\",\n \"gta_int.img/cj_office.txd/filing_cab_mtl.dds\",\"gta3.img/sw_bankint.txd/filing_cab_mtl.dds\",\n \"gta_int.img/estateprops.txd/filing_cab_mtl.dds\",\"gta3.img/sw_bankint.txd/filing_cab_mtl.dds\",\n \"gta_int.img/kbcouch1.txd/kb_sofa_256.dds\",\"gta3.img/sw_bankint.txd/kb_sofa_256.dds\",\n \"gta3.img/sw_block11.txd/black256.dds\",\"gta3.img/sw_block01.txd/black256.dds\",\n \"gta3.img/sw_diner1.txd/black256.dds\",\"gta3.img/sw_block01.txd/black256.dds\",\n \"gta3.img/vgsssignage03.txd/black256.dds\",\"gta3.img/sw_block01.txd/black256.dds\",\n \"gta3.img/sw_block11a.txd/sw_cafedoor1.dds\",\"gta3.img/sw_block01.txd/sw_cafedoor1.dds\",\n \"gta3.img/sw_roadgas.txd/sw_cafedoor1.dds\",\"gta3.img/sw_block01.txd/sw_cafedoor1.dds\",\n \"gta3.img/sw_block05.txd/sw_wind02.dds\",\"gta3.img/sw_block03.txd/sw_wind02.dds\",\n \"gta3.img/sw_block10.txd/sw_woodwall1.dds\",\"gta3.img/sw_block03.txd/sw_woodwall1.dds\",\n \"gta3.img/sw_block05.txd/sw_wind06.dds\",\"gta3.img/sw_block04.txd/sw_wind06.dds\",\n \"gta3.img/sw_block11.txd/gb_nastybar21.dds\",\"gta3.img/sw_block04.txd/gb_nastybar21.dds\",\n \"gta3.img/sw_block05.txd/sw_wallbrick_03.dds\",\"gta3.img/sw_block04.txd/sw_wallbrick_03.dds\",\n \"gta3.img/sw_genstore.txd/sw_wallbrick_03.dds\",\"gta3.img/sw_block04.txd/sw_wallbrick_03.dds\",\n \"gta3.img/sw_brewery.txd/sw_wallbrick_07.dds\",\"gta3.img/sw_block06.txd/sw_wallbrick_07.dds\",\n \"gta3.img/sw_genstore1.txd/sw_genstore.dds\",\"gta3.img/sw_block09.txd/sw_genstore.dds\",\n \"gta3.img/vgnhseing1.txd/sw_genstore.dds\",\"gta3.img/sw_block09.txd/sw_genstore.dds\",\n \"gta3.img/vgsswarehse02c.txd/gb_truckdepot18.dds\",\"gta3.img/sw_block09.txd/gb_truckdepot18.dds\",\n \"gta3.img/vgsswrehse03.txd/gb_truckdepot18.dds\",\"gta3.img/sw_block09.txd/gb_truckdepot18.dds\",\n \"gta3.img/sw_roadgas.txd/sw_oldpump.dds\",\"gta3.img/sw_diner1.txd/sw_oldpump.dds\",\n \"gta3.img/trash.txd/trash92decal128.dds\",\"gta3.img/sweeper.txd/sweeper92decal128.dds\",\n \"gta3.img/vgnbballsign2.txd/sw_bioeng.dds\",\"gta3.img/sw_fact02.txd/sw_bioeng.dds\",\n \"gta_int.img/cj_beds.txd/cj_matress2.dds\",\"gta3.img/sw_furniture.txd/cj_matress2.dds\",\n \"gta_int.img/cj_s_beds.txd/cj_matress2.dds\",\"gta3.img/sw_furniture.txd/cj_matress2.dds\",\n \"gta3.img/wfyst.txd/earing.dds\",\"gta3.img/swfyst.txd/earing.dds\",\n \"gta_int.img/svcunthoose.txd/oakbark64.dds\",\"gta3.img/sw_oldshack.txd/oakbark64.dds\",\n \"gta3.img/vgsbballnet1.txd/bballboard3_256.dds\",\"gta3.img/sw_roadgas.txd/bballboard3_256.dds\",\n \"gta_int.img/sweetsmain.txd/metal3_64_hole.dds\",\"gta3.img/sw_sheds.txd/metal3_64_hole.dds\",\n \"gta_int.img/destructo.txd/sjmfnce.dds\",\"gta3.img/sw_well1.txd/sjmfnce.dds\",\n \"gta_int.img/ovalsurround.txd/sjmfnce.dds\",\"gta3.img/sw_well1.txd/sjmfnce.dds\",\n \"gta_int.img/stadstunt.txd/sjmfnce.dds\",\"gta3.img/sw_well1.txd/sjmfnce.dds\",\n \"gta_int.img/sumoback.txd/sjmfnce.dds\",\"gta3.img/sw_well1.txd/sjmfnce.dds\",\n \"gta3.img/tags_laazteca.txd/grove.dds\",\"gta3.img/tags2_lalae.txd/grove.dds\",\n \"gta3.img/tags_lafront.txd/grove.dds\",\"gta3.img/tags2_lalae.txd/grove.dds\",\n \"gta3.img/tags_lakilo.txd/grove.dds\",\"gta3.img/tags2_lalae.txd/grove.dds\",\n \"gta3.img/tags_larifa.txd/grove.dds\",\"gta3.img/tags2_lalae.txd/grove.dds\",\n \"gta3.img/tags_larollin.txd/grove.dds\",\"gta3.img/tags2_lalae.txd/grove.dds\",\n \"gta3.img/tags_laseville.txd/grove.dds\",\"gta3.img/tags2_lalae.txd/grove.dds\",\n \"gta3.img/tags_latemple.txd/grove.dds\",\"gta3.img/tags2_lalae.txd/grove.dds\",\n \"gta3.img/tags_lavagos.txd/grove.dds\",\"gta3.img/tags2_lalae.txd/grove.dds\",\n \"gta3.img/tags_lafront.txd/frontyard.dds\",\"gta3.img/tags2_lalae.txd/frontyard.dds\",\n \"gta3.img/targets.txd/target4.dds\",\"gta3.img/targetmx.txd/target4.dds\",\n \"gta3.img/vgnvrock.txd/vgsndivebrd.dds\",\"gta3.img/tikigrass.txd/vgsndivebrd.dds\",\n \"gta3.img/tree2prc.txd/bzelka1.dds\",\"gta3.img/tree1prc.txd/bzelka1.dds\",\n \"gta3.img/tree2.txd/bzelka1.dds\",\"gta3.img/tree1.txd/bzelka1.dds\",\n \"gta3.img/triadprops_lvs.txd/fourdragons01_256.dds\",\"gta3.img/triadcasino.txd/fourdragons01_256.dds\",\n \"gta_int.img/traidman.txd/pagodaroof4.dds\",\"gta3.img/triadprops_lvs.txd/pagodaroof4.dds\",\n \"gta_int.img/triad_bar.txd/pagodaroof4.dds\",\"gta3.img/triadprops_lvs.txd/pagodaroof4.dds\",\n \"gta_int.img/triad_main.txd/pagodaroof4.dds\",\"gta3.img/triadprops_lvs.txd/pagodaroof4.dds\",\n \"gta_int.img/traidman.txd/walpaper_dragn.dds\",\"gta3.img/triadprops_lvs.txd/walpaper_dragn.dds\",\n \"gta_int.img/triad_main.txd/walpaper_dragn.dds\",\"gta3.img/triadprops_lvs.txd/walpaper_dragn.dds\",\n \"gta_int.img/triad_bar.txd/casinowall1.dds\",\"gta3.img/triadprops_lvs.txd/casinowall1.dds\",\n \"gta_int.img/triad_main.txd/casinowall1.dds\",\"gta3.img/triadprops_lvs.txd/casinowall1.dds\",\n \"gta_int.img/cj_int.txd/cj_green_wood.dds\",\"gta3.img/triadprops_lvs.txd/cj_green_wood.dds\",\n \"gta_int.img/triad_main.txd/cj_green_wood.dds\",\"gta3.img/triadprops_lvs.txd/cj_green_wood.dds\",\n \"gta_int.img/cj_int.txd/cj_china_script.dds\",\"gta3.img/triadprops_lvs.txd/cj_china_script.dds\",\n \"gta_int.img/triad_main.txd/cj_china_script.dds\",\"gta3.img/triadprops_lvs.txd/cj_china_script.dds\",\n \"gta_int.img/triad_main.txd/chinese1.dds\",\"gta3.img/triadprops_lvs.txd/chinese1.dds\",\n \"gta_int.img/cj_int.txd/cj_red_wood.dds\",\"gta3.img/triadprops_lvs.txd/cj_red_wood.dds\",\n \"gta_int.img/cuntcuts.txd/cj_red_wood.dds\",\"gta3.img/triadprops_lvs.txd/cj_red_wood.dds\",\n \"gta_int.img/savesfmid.txd/cj_red_wood.dds\",\"gta3.img/triadprops_lvs.txd/cj_red_wood.dds\",\n \"gta_int.img/svsfsm.txd/cj_red_wood.dds\",\"gta3.img/triadprops_lvs.txd/cj_red_wood.dds\",\n \"gta_int.img/triad_main.txd/cj_red_wood.dds\",\"gta3.img/triadprops_lvs.txd/cj_red_wood.dds\",\n \"gta3.img/vgssairport.txd/concretenew256128.dds\",\"gta3.img/trnstnground.txd/concretenew256128.dds\",\n \"gta3.img/vgssland03.txd/concretenew256128.dds\",\"gta3.img/trnstnground.txd/concretenew256128.dds\",\n \"gta_int.img/int_brothelint3.txd/gb_midbar15.dds\",\"gta3.img/truckedepotlawn.txd/gb_truckdepot08.dds\",\n \"gta_int.img/int_casinoint3.txd/gb_midbar15.dds\",\"gta3.img/truckedepotlawn.txd/gb_truckdepot08.dds\",\n \"gta3.img/vegasairprtland.txd/gb_truckdepot04.dds\",\"gta3.img/truckedepotlawn.txd/gb_truckdepot04.dds\",\n \"gta3.img/vgsswarehse02.txd/gb_truckdepot04.dds\",\"gta3.img/truckedepotlawn.txd/gb_truckdepot04.dds\",\n \"gta3.img/vgsswarhse04.txd/gb_truckdepot04.dds\",\"gta3.img/truckedepotlawn.txd/gb_truckdepot04.dds\",\n \"gta3.img/vegasairprtland.txd/gb_truckdepot03.dds\",\"gta3.img/truckedepotlawn.txd/gb_truckdepot03.dds\",\n \"gta3.img/vgsswarhse04.txd/gb_truckdepot03.dds\",\"gta3.img/truckedepotlawn.txd/gb_truckdepot03.dds\",\n \"gta3.img/ufo_bar.txd/ufo_pics1.dds\",\"gta3.img/ufo_barbakroom.txd/ufo_pics1.dds\",\n \"gta3.img/vgsbikeschool.txd/beigehotel_128.dds\",\"gta3.img/ufo_bar.txd/beigehotel_128.dds\",\n \"gta3.img/vgssairportcpark.txd/beigehotel_128.dds\",\"gta3.img/ufo_bar.txd/beigehotel_128.dds\",\n \"gta_int.img/gb_ornaments01.txd/beigehotel_128.dds\",\"gta3.img/ufo_bar.txd/beigehotel_128.dds\",\n \"gta_int.img/labig1int2.txd/beigehotel_128.dds\",\"gta3.img/ufo_bar.txd/beigehotel_128.dds\",\n \"gta_int.img/labig3int2.txd/beigehotel_128.dds\",\"gta3.img/ufo_bar.txd/beigehotel_128.dds\",\n \"gta_int.img/ab_trukstpc.txd/gen_sacki.dds\",\"gta3.img/ufo_bar.txd/gen_sacki.dds\",\n \"gta_int.img/ab_trukstpc.txd/sa_wood08_128.dds\",\"gta3.img/ufo_bar.txd/sa_wood08_128.dds\",\n \"gta_int.img/mp_diner1.txd/dinerfloor01_128.dds\",\"gta3.img/ufo_bar.txd/dinerfloor01_128.dds\",\n \"gta3.img/vgsswarhse04.txd/hangerlight01_64.dds\",\"gta3.img/vegasairprtland.txd/hangerlight01_64.dds\",\n \"gta3.img/vgnplantgen.txd/vegaselecbloc_256.dds\",\"gta3.img/vegascourtbld.txd/vegaselecbloc_256.dds\",\n \"gta3.img/vgnretail7.txd/vegaselecbloc_256.dds\",\"gta3.img/vegascourtbld.txd/vegaselecbloc_256.dds\",\n \"gta3.img/vgsdwntwn2.txd/courthsedor2_256.dds\",\"gta3.img/vegascourtbld.txd/courthsedor2_256.dds\",\n \"gta3.img/vgnfirestat.txd/courthsewin2_128.dds\",\"gta3.img/vegascourtbld.txd/courthsewin2_128.dds\",\n \"gta3.img/vgngebuild.txd/courthsewin2_128.dds\",\"gta3.img/vegascourtbld.txd/courthsewin2_128.dds\",\n \"gta3.img/vgntamotel.txd/courthsewin2_128.dds\",\"gta3.img/vegascourtbld.txd/courthsewin2_128.dds\",\n \"gta3.img/vgsdwntwn2.txd/courthsewin2_128.dds\",\"gta3.img/vegascourtbld.txd/courthsewin2_128.dds\",\n \"gta3.img/vgsdwntwn2.txd/marbletilewal1_256.dds\",\"gta3.img/vegascourtbld.txd/marbletilewal1_256.dds\",\n \"gta3.img/vgsdwntwn2.txd/courthse3_256.dds\",\"gta3.img/vegascourtbld.txd/courthse3_256.dds\",\n \"gta3.img/vgsdwntwn2.txd/courthse2_256.dds\",\"gta3.img/vegascourtbld.txd/courthse2_256.dds\",\n \"gta3.img/vgsdwntwn2.txd/courthse1_256.dds\",\"gta3.img/vegascourtbld.txd/courthse1_256.dds\",\n \"gta3.img/vgnhseing1.txd/dwntwnvgnawn1_128.dds\",\"gta3.img/vegasdwntwn1.txd/dwntwnvgnawn1_128.dds\",\n \"gta3.img/vgndwntwn23.txd/dwntwnvgn2_256.dds\",\"gta3.img/vegasdwntwn1.txd/dwntwnvgn2_256.dds\",\n \"gta3.img/vgslockup.txd/villainnwall02_128.dds\",\"gta3.img/vegasdwntwn1.txd/villainnwall02_128.dds\",\n \"gta3.img/vgsoffice1.txd/villainnwall02_128.dds\",\"gta3.img/vegasdwntwn1.txd/villainnwall02_128.dds\",\n \"gta3.img/vgs_shops.txd/villainnwall02_128.dds\",\"gta3.img/vegasdwntwn1.txd/villainnwall02_128.dds\",\n \"gta3.img/vegaselod2.txd/residence01_lod.dds\",\"gta3.img/vegaselod1.txd/residence01_lod.dds\",\n \"gta3.img/vegaselod3.txd/residence01_lod.dds\",\"gta3.img/vegaselod1.txd/residence01_lod.dds\",\n \"gta3.img/vegaselod2.txd/pierplanks02_lod.dds\",\"gta3.img/vegaselod1.txd/pierplanks02_lod.dds\",\n \"gta3.img/vegaselod2.txd/tisland02_lod.dds\",\"gta3.img/vegaselod1.txd/tisland02_lod.dds\",\n \"gta3.img/vegaselod2.txd/excalibur01_lod.dds\",\"gta3.img/vegaselod1.txd/excalibur01_lod.dds\",\n \"gta3.img/vegaselod2.txd/flmngo06_lod.dds\",\"gta3.img/vegaselod1.txd/flmngo06_lod.dds\",\n \"gta3.img/vegaselod2.txd/ws_floortiles4_lod.dds\",\"gta3.img/vegaselod1.txd/ws_floortiles4_lod.dds\",\n \"gta3.img/vegaselod2.txd/vgsresidntial01_lod.dds\",\"gta3.img/vegaselod1.txd/vgsresidntial01_lod.dds\",\n \"gta3.img/vegaselod3.txd/vgsresidntial01_lod.dds\",\"gta3.img/vegaselod1.txd/vgsresidntial01_lod.dds\",\n \"gta3.img/vegaselod2.txd/pirates03_lod.dds\",\"gta3.img/vegaselod1.txd/pirates03_lod.dds\",\n \"gta3.img/vegaselod2.txd/ceaserwall06_lod.dds\",\"gta3.img/vegaselod1.txd/ceaserwall06_lod.dds\",\n \"gta3.img/vegaselod2.txd/vgspawnroof02_lod.dds\",\"gta3.img/vegaselod1.txd/vgspawnroof02_lod.dds\",\n \"gta3.img/vegaselod3.txd/vgspawnroof02_lod.dds\",\"gta3.img/vegaselod1.txd/vgspawnroof02_lod.dds\",\n \"gta3.img/vegaselod3.txd/vgnprtlstation_lod.dds\",\"gta3.img/vegaselod2.txd/vgnprtlstation_lod.dds\",\n \"gta3.img/vegasnlod4.txd/vgnprtlstation_lod.dds\",\"gta3.img/vegaselod2.txd/vgnprtlstation_lod.dds\",\n \"gta3.img/vegasnlod1.txd/vgsnbuild07b_lod.dds\",\"gta3.img/vegaselod2.txd/vgsnbuild07b_lod.dds\",\n \"gta3.img/vegasnlod2.txd/vgsnbuild07b_lod.dds\",\"gta3.img/vegaselod2.txd/vgsnbuild07b_lod.dds\",\n \"gta3.img/vegasnlod1.txd/vgnamunation1_lod.dds\",\"gta3.img/vegaselod2.txd/vgnamunation1_lod.dds\",\n \"gta3.img/vegasnlod1.txd/vgsnwedchap1_lod.dds\",\"gta3.img/vegaselod2.txd/vgsnwedchap1_lod.dds\",\n \"gta3.img/vegaselod3.txd/vgsoffice01_lod.dds\",\"gta3.img/vegaselod2.txd/vgsoffice01_lod.dds\",\n \"gta3.img/vegasnlod1.txd/ws_carpark2_lod.dds\",\"gta3.img/vegaselod2.txd/ws_carpark2_lod.dds\",\n \"gta3.img/vegasnlod2.txd/ws_carpark2_lod.dds\",\"gta3.img/vegaselod2.txd/ws_carpark2_lod.dds\",\n \"gta3.img/vegasnlod4.txd/ws_carpark2_lod.dds\",\"gta3.img/vegaselod2.txd/ws_carpark2_lod.dds\",\n \"gta3.img/vegaselod3.txd/vgsgnhotel01a_lod.dds\",\"gta3.img/vegaselod2.txd/vgsgnhotel01a_lod.dds\",\n \"gta3.img/vegaselod3.txd/villa_inn02_lod.dds\",\"gta3.img/vegaselod2.txd/villa_inn02_lod.dds\",\n \"gta3.img/vegaselod3.txd/vgsshop01_lod.dds\",\"gta3.img/vegaselod2.txd/vgsshop01_lod.dds\",\n \"gta3.img/vegaselod3.txd/vgelwbld15_lod.dds\",\"gta3.img/vegaselod2.txd/vgelwbld15_lod.dds\",\n \"gta3.img/vegasnlod1.txd/vgelwbld15_lod.dds\",\"gta3.img/vegaselod2.txd/vgelwbld15_lod.dds\",\n \"gta3.img/vegaselod3.txd/vgsecarshow1_lod.dds\",\"gta3.img/vegaselod2.txd/vgsecarshow1_lod.dds\",\n \"gta3.img/vegaselod3.txd/vgsshop06_lod.dds\",\"gta3.img/vegaselod2.txd/vgsshop06_lod.dds\",\n \"gta3.img/vegasnlod1.txd/desmud_lod.dds\",\"gta3.img/vegaselod3.txd/desmud_lod.dds\",\n \"gta3.img/welod_law2.txd/roof01l_lod.dds\",\"gta3.img/vegaselod3.txd/roof01l_lod.dds\",\n \"gta3.img/vegashsetx.txd/badhousewalld06_128.dds\",\"gta3.img/vegashse2.txd/badhousewalld06_128.dds\",\n \"gta3.img/vgwestland.txd/badhousewalld06_128.dds\",\"gta3.img/vegashse2.txd/badhousewalld06_128.dds\",\n \"gta3.img/vegashse8.txd/badhousewall01_128.dds\",\"gta3.img/vegashse2.txd/badhousewall01_128.dds\",\n \"gta3.img/vegashsetx.txd/badhousewall01_128.dds\",\"gta3.img/vegashse2.txd/badhousewall01_128.dds\",\n \"gta3.img/vgnfirestat.txd/badhousewall01_128.dds\",\"gta3.img/vegashse2.txd/badhousewall01_128.dds\",\n \"gta3.img/vgnoutown2.txd/badhousewall01_128.dds\",\"gta3.img/vegashse2.txd/badhousewall01_128.dds\",\n \"gta3.img/vgsswarehse01.txd/badhousewall01_128.dds\",\"gta3.img/vegashse2.txd/badhousewall01_128.dds\",\n \"gta3.img/vgsswarehse02b.txd/badhousewall01_128.dds\",\"gta3.img/vegashse2.txd/badhousewall01_128.dds\",\n \"gta3.img/vgsswarehse02c.txd/badhousewall01_128.dds\",\"gta3.img/vegashse2.txd/badhousewall01_128.dds\",\n \"gta3.img/vgsswrehse03.txd/badhousewall01_128.dds\",\"gta3.img/vegashse2.txd/badhousewall01_128.dds\",\n \"gta3.img/vgwestabats.txd/badhousewall01_128.dds\",\"gta3.img/vegashse2.txd/badhousewall01_128.dds\",\n \"gta3.img/vgwestland.txd/badhousewall01_128.dds\",\"gta3.img/vegashse2.txd/badhousewall01_128.dds\",\n \"gta3.img/vgwestoutwn2.txd/badhousewall01_128.dds\",\"gta3.img/vegashse2.txd/badhousewall01_128.dds\",\n \"gta3.img/vgwsavehses.txd/badhousewalld05_128.dds\",\"gta3.img/vegashse2.txd/badhousewalld05_128.dds\",\n \"gta3.img/vegashse4.txd/pinkwall01_64.dds\",\"gta3.img/vegashse2.txd/pinkwall01_64.dds\",\n \"gta3.img/vegirlfr01.txd/pinkwall01_64.dds\",\"gta3.img/vegashse2.txd/pinkwall01_64.dds\",\n \"gta3.img/vgwsavehses.txd/pinkwall01_64.dds\",\"gta3.img/vegashse2.txd/pinkwall01_64.dds\",\n \"gta3.img/vgwestretail1.txd/badhousewalld02_128.dds\",\"gta3.img/vegashse2.txd/badhousewalld02_128.dds\",\n \"gta3.img/vgwsavehses.txd/badhousewalld02_128.dds\",\"gta3.img/vegashse2.txd/badhousewalld02_128.dds\",\n \"gta3.img/vgwestretail1.txd/badhousewalld01_128.dds\",\"gta3.img/vegashse2.txd/badhousewalld01_128.dds\",\n \"gta3.img/vegashse8.txd/airconditioner02_128.dds\",\"gta3.img/vegashse2.txd/airconditioner02_128.dds\",\n \"gta3.img/vgesvhouse01.txd/airconditioner02_128.dds\",\"gta3.img/vegashse2.txd/airconditioner02_128.dds\",\n \"gta3.img/vgwsavehses.txd/airconditioner02_128.dds\",\"gta3.img/vegashse2.txd/airconditioner02_128.dds\",\n \"gta3.img/vegashse3.txd/hseconcblend1_256.dds\",\"gta3.img/vegashse2.txd/hseconcblend1_256.dds\",\n \"gta3.img/vegashse4.txd/hseconcblend1_256.dds\",\"gta3.img/vegashse2.txd/hseconcblend1_256.dds\",\n \"gta3.img/vegashse5.txd/hseconcblend1_256.dds\",\"gta3.img/vegashse2.txd/hseconcblend1_256.dds\",\n \"gta3.img/vegashse6.txd/hseconcblend1_256.dds\",\"gta3.img/vegashse2.txd/hseconcblend1_256.dds\",\n \"gta3.img/vegashse7.txd/hseconcblend1_256.dds\",\"gta3.img/vegashse2.txd/hseconcblend1_256.dds\",\n \"gta3.img/vegashse8.txd/hseconcblend1_256.dds\",\"gta3.img/vegashse2.txd/hseconcblend1_256.dds\",\n \"gta3.img/vegashse5.txd/vgnhseledgw1_64.dds\",\"gta3.img/vegashse3.txd/vgnhseledgw1_64.dds\",\n \"gta3.img/vegashse6.txd/vgnhseledgw1_64.dds\",\"gta3.img/vegashse3.txd/vgnhseledgw1_64.dds\",\n \"gta3.img/vegashse7.txd/vgnhseledgw1_64.dds\",\"gta3.img/vegashse3.txd/vgnhseledgw1_64.dds\",\n \"gta3.img/vegassvehse7.txd/vgnhseledgw1_64.dds\",\"gta3.img/vegashse3.txd/vgnhseledgw1_64.dds\",\n \"gta3.img/vgncondos1.txd/vgnhseledgw1_64.dds\",\"gta3.img/vegashse3.txd/vgnhseledgw1_64.dds\",\n \"gta3.img/vgncorp1.txd/vgnhseledgw1_64.dds\",\"gta3.img/vegashse3.txd/vgnhseledgw1_64.dds\",\n \"gta3.img/vgntamotel.txd/vgnhseledgw1_64.dds\",\"gta3.img/vegashse3.txd/vgnhseledgw1_64.dds\",\n \"gta3.img/vgsxrefpart1.txd/vgnhseledgw1_64.dds\",\"gta3.img/vegashse3.txd/vgnhseledgw1_64.dds\",\n \"gta3.img/vegashse5.txd/starhedge2.dds\",\"gta3.img/vegashse3.txd/starhedge2.dds\",\n \"gta3.img/vegashse6.txd/starhedge2.dds\",\"gta3.img/vegashse3.txd/starhedge2.dds\",\n \"gta3.img/vegashse7.txd/starhedge2.dds\",\"gta3.img/vegashse3.txd/starhedge2.dds\",\n \"gta3.img/vegassvehse7.txd/starhedge2.dds\",\"gta3.img/vegashse3.txd/starhedge2.dds\",\n \"gta3.img/vegirlfr01.txd/vgnlowbuild3_256.dds\",\"gta3.img/vegashse4.txd/vgnlowbuild3_256.dds\",\n \"gta3.img/vgndwntwn22.txd/vgnlowbuild3_256.dds\",\"gta3.img/vegashse4.txd/vgnlowbuild3_256.dds\",\n \"gta3.img/vgnewfence.txd/vgnlowbuild3_256.dds\",\"gta3.img/vegashse4.txd/vgnlowbuild3_256.dds\",\n \"gta3.img/vegirlfr01.txd/est_gen_stone.dds\",\"gta3.img/vegashse4.txd/est_gen_stone.dds\",\n \"gta3.img/vegirlfr01.txd/est_corridor_ceiling.dds\",\"gta3.img/vegashse4.txd/est_corridor_ceiling.dds\",\n \"gta3.img/vegashse6.txd/vgnhsepsh4_256.dds\",\"gta3.img/vegashse5.txd/vgnhsepsh4_256.dds\",\n \"gta3.img/vegashse7.txd/vgnhsepsh4_256.dds\",\"gta3.img/vegashse5.txd/vgnhsepsh4_256.dds\",\n \"gta3.img/vegassvehse7.txd/vgnhsepsh4_256.dds\",\"gta3.img/vegashse5.txd/vgnhsepsh4_256.dds\",\n \"gta3.img/vegashse7.txd/sw_wind10.dds\",\"gta3.img/vegashse6.txd/sw_wind10.dds\",\n \"gta3.img/vegassvehse7.txd/vgnhsepsh7_128.dds\",\"gta3.img/vegashse7.txd/vgnhsepsh7_128.dds\",\n \"gta3.img/vegassvehse7.txd/vegashousewal5_256.dds\",\"gta3.img/vegashse7.txd/vegashousewal5_256.dds\",\n \"gta3.img/vegassvehse7.txd/vegashousewal6_256.dds\",\"gta3.img/vegashse7.txd/vegashousewal6_256.dds\",\n \"gta3.img/vgwestland.txd/badhousewall02_256.dds\",\"gta3.img/vegashse8.txd/badhousewall02_256.dds\",\n \"gta3.img/vgsebuild01.txd/badhousewall07_128.dds\",\"gta3.img/vegashse8.txd/badhousewall07_128.dds\",\n \"gta3.img/vgsebuild02.txd/badhousewall07_128.dds\",\"gta3.img/vegashse8.txd/badhousewall07_128.dds\",\n \"gta3.img/vegashsetx.txd/badhousewallc02_128.dds\",\"gta3.img/vegashse8.txd/badhousewallc02_128.dds\",\n \"gta3.img/vgesvhouse01.txd/badhousewallc02_128.dds\",\"gta3.img/vegashse8.txd/badhousewallc02_128.dds\",\n \"gta3.img/vgnsqrfnce.txd/badhousewallc02_128.dds\",\"gta3.img/vegashse8.txd/badhousewallc02_128.dds\",\n \"gta3.img/vgwestland.txd/badhousewallc02_128.dds\",\"gta3.img/vegashse8.txd/badhousewallc02_128.dds\",\n \"gta3.img/vegashsetx.txd/badhousewallc01_128.dds\",\"gta3.img/vegashse8.txd/badhousewallc01_128.dds\",\n \"gta3.img/vgesvhouse01.txd/badhousewallc01_128.dds\",\"gta3.img/vegashse8.txd/badhousewallc01_128.dds\",\n \"gta3.img/vgnsqrfnce.txd/badhousewallc01_128.dds\",\"gta3.img/vegashse8.txd/badhousewallc01_128.dds\",\n \"gta3.img/vgwestland.txd/badhousewallc01_128.dds\",\"gta3.img/vegashse8.txd/badhousewallc01_128.dds\",\n \"gta3.img/vgwsavehses.txd/badhousewallc01_128.dds\",\"gta3.img/vegashse8.txd/badhousewallc01_128.dds\",\n \"gta3.img/vgesvhouse01.txd/airconditioner01_128.dds\",\"gta3.img/vegashse8.txd/airconditioner01_128.dds\",\n \"gta3.img/vgesvhouse01.txd/redstones01_256.dds\",\"gta3.img/vegashse8.txd/redstones01_256.dds\",\n \"gta3.img/vgnhseland.txd/redstones01_256.dds\",\"gta3.img/vegashse8.txd/redstones01_256.dds\",\n \"gta3.img/vgsschurch.txd/redstones01_256.dds\",\"gta3.img/vegashse8.txd/redstones01_256.dds\",\n \"gta3.img/vgwsavehses.txd/redstones01_256.dds\",\"gta3.img/vegashse8.txd/redstones01_256.dds\",\n \"gta3.img/vgesvhouse01.txd/venbuildwh_law2.dds\",\"gta3.img/vegashse8.txd/venbuildwh_law2.dds\",\n \"gta3.img/vgsebuild02.txd/venbuildwh_law2.dds\",\"gta3.img/vegashse8.txd/venbuildwh_law2.dds\",\n \"gta3.img/vgwsavehses.txd/venbuildwh_law2.dds\",\"gta3.img/vegashse8.txd/venbuildwh_law2.dds\",\n \"gta3.img/vgesvhouse01.txd/badhousegttrng03_128.dds\",\"gta3.img/vegashse8.txd/badhousegttrng03_128.dds\",\n \"gta3.img/vgesvhouse01.txd/badhousewallb02_128.dds\",\"gta3.img/vegashse8.txd/badhousewallb02_128.dds\",\n \"gta3.img/vgwsavehses.txd/badhousewallb02_128.dds\",\"gta3.img/vegashse8.txd/badhousewallb02_128.dds\",\n \"gta3.img/vgesvhouse01.txd/badhousewallb01_256.dds\",\"gta3.img/vegashse8.txd/badhousewallb01_256.dds\",\n \"gta3.img/vgwsavehses.txd/badhousewallb01_256.dds\",\"gta3.img/vegashse8.txd/badhousewallb01_256.dds\",\n \"gta3.img/vgndwntwn1.txd/brickvgn1_128.dds\",\"gta3.img/vegasnbuild1.txd/brickvgn1_128.dds\",\n \"gta3.img/vgnfremnt2.txd/brickvgn1_128.dds\",\"gta3.img/vegasnbuild1.txd/brickvgn1_128.dds\",\n \"gta3.img/vgsn_fncelec_pst.txd/ws_griddyfence_64.dds\",\"gta3.img/vegasnefnc.txd/ws_griddyfence_64.dds\",\n \"gta3.img/vegasntwires.txd/vgntelewires1.dds\",\"gta3.img/vegasneon.txd/vgntelewires1.dds\",\n \"gta3.img/vgseneonwires.txd/vgntelewires1.dds\",\"gta3.img/vegasneon.txd/vgntelewires1.dds\",\n \"gta3.img/vgsstwires.txd/vgntelewires1.dds\",\"gta3.img/vegasneon.txd/vgntelewires1.dds\",\n \"gta3.img/vegasnlod4.txd/helipad_lod.dds\",\"gta3.img/vegasnlod1.txd/helipad_lod.dds\",\n \"gta3.img/vegasnlod4.txd/vgsroad04_lod.dds\",\"gta3.img/vegasnlod1.txd/vgsroad04_lod.dds\",\n \"gta3.img/vegasnlod2.txd/roof11l256_lod.dds\",\"gta3.img/vegasnlod1.txd/roof11l256_lod.dds\",\n \"gta3.img/vegasnlod4.txd/roof11l256_lod.dds\",\"gta3.img/vegasnlod1.txd/roof11l256_lod.dds\",\n \"gta3.img/vegasnlod4.txd/vgnboigashot25b_lod.dds\",\"gta3.img/vegasnlod1.txd/vgnboigashot25b_lod.dds\",\n \"gta3.img/vegasnlod4.txd/vgnboigashot25a_lod.dds\",\"gta3.img/vegasnlod1.txd/vgnboigashot25a_lod.dds\",\n \"gta3.img/vegasnlod4.txd/vgnvrock_lod.dds\",\"gta3.img/vegasnlod1.txd/vgnvrock_lod.dds\",\n \"gta3.img/vegasnlod2.txd/vegastemp1a_lod.dds\",\"gta3.img/vegasnlod1.txd/vegastemp1a_lod.dds\",\n \"gta3.img/vegasnlod4.txd/vegastemp1a_lod.dds\",\"gta3.img/vegasnlod1.txd/vegastemp1a_lod.dds\",\n \"gta3.img/vegasnlod4.txd/vegasnclub03_lod.dds\",\"gta3.img/vegasnlod1.txd/vegasnclub03_lod.dds\",\n \"gta3.img/vegasnlod4.txd/casinoblock4d_lod.dds\",\"gta3.img/vegasnlod1.txd/casinoblock4d_lod.dds\",\n \"gta3.img/vegasnlod2.txd/casinoblock3a_lod.dds\",\"gta3.img/vegasnlod1.txd/casinoblock3a_lod.dds\",\n \"gta3.img/vegasnlod4.txd/casinoblock3a_lod.dds\",\"gta3.img/vegasnlod1.txd/casinoblock3a_lod.dds\",\n \"gta3.img/vgsn_fncelec_lod.txd/superlowlod_grey.dds\",\"gta3.img/vegasnlod2.txd/superlowlod_grey.dds\",\n \"gta3.img/vgsseleclod.txd/vgsnelec_fence_lod.dds\",\"gta3.img/vegasnlod4.txd/vgsnelec_fence_lod.dds\",\n \"gta3.img/vgnabatoir.txd/roof05l256.dds\",\"gta3.img/vegaswrehse1.txd/roof05l256.dds\",\n \"gta3.img/vgwestabats.txd/roof05l256.dds\",\"gta3.img/vegaswrehse1.txd/roof05l256.dds\",\n \"gta3.img/vgwestoutwn2.txd/roof05l256.dds\",\"gta3.img/vegaswrehse1.txd/roof05l256.dds\",\n \"gta3.img/veg_leaves.txd/planterbox128.dds\",\"gta3.img/veg_leavesplnt.txd/planterbox128.dds\",\n \"gta3.img/veg_leaves.txd/kbplanter_plants1.dds\",\"gta3.img/veg_leavesplnt.txd/kbplanter_plants1.dds\",\n \"gta3.img/vgsswarehse02c.txd/streetsign2_256.dds\",\"gta3.img/vegstreetsign.txd/streetsign2_256.dds\",\n \"gta_int.img/kickarse.txd/law_blue1.dds\",\"gta3.img/venice_law.txd/law_blue1.dds\",\n \"gta3.img/vgsbikeschool.txd/newlawdoor.dds\",\"gta3.img/venice_law.txd/newlawdoor.dds\",\n \"gta3.img/vgnamun.txd/vgnammuwal3.dds\",\"gta3.img/vgeamun.txd/vgnammuwal3.dds\",\n \"gta3.img/vgnamun.txd/vgnammuwal2.dds\",\"gta3.img/vgeamun.txd/vgnammuwal2.dds\",\n \"gta3.img/vgnamun.txd/blueroof_64.dds\",\"gta3.img/vgeamun.txd/blueroof_64.dds\",\n \"gta3.img/vgnhseing1.txd/blueroof_64.dds\",\"gta3.img/vgeamun.txd/blueroof_64.dds\",\n \"gta3.img/vgnretail5.txd/blueroof_64.dds\",\"gta3.img/vgeamun.txd/blueroof_64.dds\",\n \"gta3.img/vgnamun.txd/hirisedoor1_256.dds\",\"gta3.img/vgeamun.txd/hirisedoor1_256.dds\",\n \"gta3.img/vgndwntwn5.txd/hirisedoor1_256.dds\",\"gta3.img/vgeamun.txd/hirisedoor1_256.dds\",\n \"gta3.img/vgsn_billboard.txd/cokopops_2.dds\",\"gta3.img/vgebillboards.txd/cokopops_2.dds\",\n \"gta3.img/vgsssignage03.txd/cokopops_2.dds\",\"gta3.img/vgebillboards.txd/cokopops_2.dds\",\n \"gta3.img/vgwestabats.txd/cokopops_2.dds\",\"gta3.img/vgebillboards.txd/cokopops_2.dds\",\n \"gta3.img/vgnbballsign2.txd/eris_4.dds\",\"gta3.img/vgebillboards.txd/eris_4.dds\",\n \"gta3.img/vgsssignage03.txd/eris_4.dds\",\"gta3.img/vgebillboards.txd/eris_4.dds\",\n \"gta3.img/vgnfremnt1.txd/casinoshop31_256.dds\",\"gta3.img/vgeretail1.txd/casinoshop31_256.dds\",\n \"gta3.img/vgnfremnt2.txd/casinoshop31_256.dds\",\"gta3.img/vgeretail1.txd/casinoshop31_256.dds\",\n \"gta3.img/vgsebuild01.txd/casinoshop31_256.dds\",\"gta3.img/vgeretail1.txd/casinoshop31_256.dds\",\n \"gta3.img/vgsebuild02.txd/casinoshop31_256.dds\",\"gta3.img/vgeretail1.txd/casinoshop31_256.dds\",\n \"gta3.img/vgnretail2.txd/zippizzaco_256.dds\",\"gta3.img/vgeretail1.txd/zippizzaco_256.dds\",\n \"gta3.img/vgnretail5.txd/zippizzaco_256.dds\",\"gta3.img/vgeretail1.txd/zippizzaco_256.dds\",\n \"gta3.img/vgsebuild01.txd/zippizzaco_256.dds\",\"gta3.img/vgeretail1.txd/zippizzaco_256.dds\",\n \"gta3.img/vgsebuild02.txd/zippizzaco_256.dds\",\"gta3.img/vgeretail1.txd/zippizzaco_256.dds\",\n \"gta3.img/vgnretail4.txd/alleywallyell.dds\",\"gta3.img/vgeretail1.txd/alleywallyell.dds\",\n \"gta3.img/vgnretail5.txd/alleywallyell.dds\",\"gta3.img/vgeretail1.txd/alleywallyell.dds\",\n \"gta3.img/vgnretail7.txd/alleywallyell.dds\",\"gta3.img/vgeretail1.txd/alleywallyell.dds\",\n \"gta3.img/vgsebuild01.txd/alleywallyell.dds\",\"gta3.img/vgeretail1.txd/alleywallyell.dds\",\n \"gta3.img/vgsebuild02.txd/alleywallyell.dds\",\"gta3.img/vgeretail1.txd/alleywallyell.dds\",\n \"gta3.img/vgnntrainfnce.txd/wire_sm.dds\",\"gta3.img/vgetrainfnce.txd/wire_sm.dds\",\n \"gta3.img/vgnpwrmainbld.txd/wire_sm.dds\",\"gta3.img/vgetrainfnce.txd/wire_sm.dds\",\n \"gta3.img/vgnshopnmall.txd/wire_sm.dds\",\"gta3.img/vgetrainfnce.txd/wire_sm.dds\",\n \"gta3.img/vgnntrainfnce.txd/gb_nastybar05.dds\",\"gta3.img/vgetrainfnce.txd/gb_nastybar05.dds\",\n \"gta3.img/vgnusedcar.txd/gb_nastybar05.dds\",\"gta3.img/vgetrainfnce.txd/gb_nastybar05.dds\",\n \"gta3.img/vgwestrailrd.txd/gb_nastybar05.dds\",\"gta3.img/vgetrainfnce.txd/gb_nastybar05.dds\",\n \"gta_int.img/cj_bar2.txd/gb_nastybar05.dds\",\"gta3.img/vgetrainfnce.txd/gb_nastybar05.dds\",\n \"gta3.img/vgsbballcrt.txd/yellowbball.dds\",\"gta3.img/vgnbasktball.txd/yellowbball.dds\",\n \"gta3.img/vgnfirestat.txd/frogspawn1_256.dds\",\"gta3.img/vgnbballsign2.txd/frogspawn1_256.dds\",\n \"gta3.img/vgnlowbild.txd/tattoosignvgn_256.dds\",\"gta3.img/vgnbballsign2.txd/tattoosignvgn_256.dds\",\n \"gta3.img/vgnfirestat.txd/weldwed1_256.dds\",\"gta3.img/vgnbballsign2.txd/weldwed1_256.dds\",\n \"gta3.img/vgnretail3.txd/weldwed1_256.dds\",\"gta3.img/vgnbballsign2.txd/weldwed1_256.dds\",\n \"gta3.img/vgwestretail1.txd/steakhouse_256.dds\",\"gta3.img/vgnbballsign2.txd/steakhouse_256.dds\",\n \"gta3.img/vgndwntwn2.txd/bailbondvg_256.dds\",\"gta3.img/vgnbballsign2.txd/bailbondvg_256.dds\",\n \"gta3.img/vgnpwrentrnce.txd/kaccdepot_256.dds\",\"gta3.img/vgnbballsign2.txd/kaccdepot_256.dds\",\n \"gta3.img/vgnpwrmainbld.txd/kaccdepot_256.dds\",\"gta3.img/vgnbballsign2.txd/kaccdepot_256.dds\",\n \"gta3.img/vgnlowbild.txd/autobahn3_256.dds\",\"gta3.img/vgnbballsign2.txd/autobahn3_256.dds\",\n \"gta3.img/vgsecarshow.txd/autobahn3_256.dds\",\"gta3.img/vgnbballsign2.txd/autobahn3_256.dds\",\n \"gta3.img/vgngebuild.txd/vgngewall2_256.dds\",\"gta3.img/vgnbball.txd/vgngewall2_256.dds\",\n \"gta3.img/vgnfremnt1.txd/actopblank_256.dds\",\"gta3.img/vgnbball.txd/actopblank_256.dds\",\n \"gta3.img/vgnstrfshsign.txd/vgncasign12_256.dds\",\"gta3.img/vgncastext02.txd/vgncasign12_256.dds\",\n \"gta3.img/vgnstrfshsign.txd/vgncasign42_256.dds\",\"gta3.img/vgncastext02.txd/vgncasign42_256.dds\",\n \"gta3.img/vgnstrfshsign.txd/vgncasign22_256.dds\",\"gta3.img/vgncastext02.txd/vgncasign22_256.dds\",\n \"gta3.img/vgnvrock.txd/neon_centrala.dds\",\"gta3.img/vgncircir.txd/neon_centrala.dds\",\n \"gta3.img/vgsecnstrct02.txd/desmudtrail3.dds\",\"gta3.img/vgncnstrct1.txd/desmudtrail3.dds\",\n \"gta3.img/vgndwntwn23.txd/vegasclubdoor_128.dds\",\"gta3.img/vgncnstrct1.txd/vegasclubdoor_128.dds\",\n \"gta3.img/vgnretail5.txd/vegasclubdoor_128.dds\",\"gta3.img/vgncnstrct1.txd/vegasclubdoor_128.dds\",\n \"gta3.img/vgnplantgen.txd/metalwheel1_128.dds\",\"gta3.img/vgncoast.txd/metalwheel1_128.dds\",\n \"gta3.img/vgspumphse.txd/metalwheel1_128.dds\",\"gta3.img/vgncoast.txd/metalwheel1_128.dds\",\n \"gta3.img/willvax.txd/metalwheel1_128.dds\",\"gta3.img/vgncoast.txd/metalwheel1_128.dds\",\n \"gta3.img/vgnplantgen.txd/metalwheel2_128.dds\",\"gta3.img/vgncoast.txd/metalwheel2_128.dds\",\n \"gta3.img/vgspumphse.txd/metalwheel2_128.dds\",\"gta3.img/vgncoast.txd/metalwheel2_128.dds\",\n \"gta3.img/willvax.txd/metalwheel2_128.dds\",\"gta3.img/vgncoast.txd/metalwheel2_128.dds\",\n \"gta3.img/vgspumphse.txd/concretewall22b.dds\",\"gta3.img/vgncoast.txd/concretewall22b.dds\",\n \"gta3.img/vgspumphse.txd/mp_bigmetaldoor_256.dds\",\"gta3.img/vgncoast.txd/mp_bigmetaldoor_256.dds\",\n \"gta3.img/vgnfremnt2.txd/casinowall6_256.dds\",\"gta3.img/vgncondos1.txd/casinowall6_256.dds\",\n \"gta3.img/vgntamotel.txd/vgnmotel3_256.dds\",\"gta3.img/vgncondos1.txd/vgnmotel3_256.dds\",\n \"gta3.img/vgnfrates.txd/roof01l256.dds\",\"gta3.img/vgncondos1.txd/roof01l256.dds\",\n \"gta3.img/vgngebuild.txd/roof01l256.dds\",\"gta3.img/vgncondos1.txd/roof01l256.dds\",\n \"gta3.img/vgnlowbild.txd/roof01l256.dds\",\"gta3.img/vgncondos1.txd/roof01l256.dds\",\n \"gta3.img/vgntrainstat.txd/roof01l256.dds\",\"gta3.img/vgncondos1.txd/roof01l256.dds\",\n \"gta3.img/vgsxrefpart1.txd/roof01l256.dds\",\"gta3.img/vgncondos1.txd/roof01l256.dds\",\n \"gta3.img/vgwestretail1.txd/roof01l256.dds\",\"gta3.img/vgncondos1.txd/roof01l256.dds\",\n \"gta3.img/vgsxrefpart1.txd/vgnmotel2_256.dds\",\"gta3.img/vgncondos1.txd/vgnmotel2_256.dds\",\n \"gta3.img/vgntamotel.txd/vgnmotel1_256.dds\",\"gta3.img/vgncondos1.txd/vgnmotel1_256.dds\",\n \"gta3.img/vgsxrefpart1.txd/vgnmotel1_256.dds\",\"gta3.img/vgncondos1.txd/vgnmotel1_256.dds\",\n \"gta3.img/vgnretail7.txd/vgnbuild2_128.dds\",\"gta3.img/vgncorp1.txd/vgnbuild2_128.dds\",\n \"gta3.img/vgnptrlpmp.txd/vgndwntwnrf2_128.dds\",\"gta3.img/vgncorp1.txd/vgndwntwnrf2_128.dds\",\n \"gta3.img/vgslowbuild.txd/vgndwntwnrf2_128.dds\",\"gta3.img/vgncorp1.txd/vgndwntwnrf2_128.dds\",\n \"gta3.img/vgnshambild1.txd/vgnbankbld6_256.dds\",\"gta3.img/vgndwntwn1.txd/vgnbankbld6_256.dds\",\n \"gta3.img/vgnshambild1.txd/vgnbankbld5_256.dds\",\"gta3.img/vgndwntwn1.txd/vgnbankbld5_256.dds\",\n \"gta3.img/vgnshambild1.txd/vgnbankbld4_256.dds\",\"gta3.img/vgndwntwn1.txd/vgnbankbld4_256.dds\",\n \"gta3.img/vgsebuild02.txd/newbank.dds\",\"gta3.img/vgndwntwn21.txd/newbank.dds\",\n \"gta3.img/vgsebuild01.txd/fighotwin1_lan.dds\",\"gta3.img/vgndwntwn21.txd/fighotwin1_lan.dds\",\n \"gta3.img/vgsebuild02.txd/fighotwin1_lan.dds\",\"gta3.img/vgndwntwn21.txd/fighotwin1_lan.dds\",\n \"gta3.img/vgndwntwn23.txd/vgnwstshop3_256.dds\",\"gta3.img/vgndwntwn21.txd/vgnwstshop3_256.dds\",\n \"gta3.img/vgs_shops.txd/vgnbuild5top_256.dds\",\"gta3.img/vgndwntwn21.txd/vgnbuild5top_256.dds\",\n \"gta3.img/vgnfremnt2.txd/vgnpawnshrt_256.dds\",\"gta3.img/vgndwntwn23.txd/vgnpawnshrt_256.dds\",\n \"gta3.img/vgnusedcar.txd/gravelkb_128b.dds\",\"gta3.img/vgndwntwn2.txd/gravelkb_128b.dds\",\n \"gta3.img/vgwestland.txd/gravelkb_128b.dds\",\"gta3.img/vgndwntwn2.txd/gravelkb_128b.dds\",\n \"gta3.img/vgsebuild02.txd/vgnalleywall1_256.dds\",\"gta3.img/vgndwntwn2.txd/vgnalleywall1_256.dds\",\n \"gta3.img/vgnlowbild.txd/vegaswigshop1_256.dds\",\"gta3.img/vgndwntwn2.txd/vegaswigshop1_256.dds\",\n \"gta3.img/vgsebuild01.txd/vegaswigshop1_256.dds\",\"gta3.img/vgndwntwn2.txd/vegaswigshop1_256.dds\",\n \"gta3.img/vgsebuild02.txd/vegaswigshop1_256.dds\",\"gta3.img/vgndwntwn2.txd/vegaswigshop1_256.dds\",\n \"gta3.img/vgsswarehse02c.txd/vgssshopnew01.dds\",\"gta3.img/vgndwntwn2.txd/vgssshopnew01.dds\",\n \"gta3.img/vgsfountain.txd/venetfount1_256.dds\",\"gta3.img/vgndwntwn5.txd/venetfount1_256.dds\",\n \"gta3.img/vgnshambild1.txd/fitzwallvgn2_256.dds\",\"gta3.img/vgndwntwn5.txd/fitzwallvgn2_256.dds\",\n \"gta3.img/vgsswarhse04.txd/fitzwallvgn2_256.dds\",\"gta3.img/vgndwntwn5.txd/fitzwallvgn2_256.dds\",\n \"gta3.img/vgsebuild02.txd/hangersign01_256.dds\",\"gta3.img/vgnfirestat.txd/hangersign01_256.dds\",\n \"gta3.img/vgnoutown2.txd/vgnwrehse1_256.dds\",\"gta3.img/vgnfirestat.txd/vgnwrehse1_256.dds\",\n \"gta3.img/vgsswarehse02b.txd/vgnwrehse1_256.dds\",\"gta3.img/vgnfirestat.txd/vgnwrehse1_256.dds\",\n \"gta3.img/vgsswarehse02c.txd/vgnwrehse1_256.dds\",\"gta3.img/vgnfirestat.txd/vgnwrehse1_256.dds\",\n \"gta3.img/vgsswrehse03.txd/vgnwrehse1_256.dds\",\"gta3.img/vgnfirestat.txd/vgnwrehse1_256.dds\",\n \"gta3.img/vgwestabats.txd/vgnwrehse1_256.dds\",\"gta3.img/vgnfirestat.txd/vgnwrehse1_256.dds\",\n \"gta3.img/vgwestoutwn2.txd/vgnwrehse1_256.dds\",\"gta3.img/vgnfirestat.txd/vgnwrehse1_256.dds\",\n \"gta3.img/vgnshopnmall.txd/vgn_pinkfirestat_256.dds\",\"gta3.img/vgnfirestat.txd/vgn_pinkfirestat_256.dds\",\n \"gta3.img/vgsewrehse.txd/vgnwrehsewal2_256.dds\",\"gta3.img/vgnfrates.txd/vgnwrehsewal2_256.dds\",\n \"gta3.img/vgsswarehse02.txd/vgnwrehsewal2_256.dds\",\"gta3.img/vgnfrates.txd/vgnwrehsewal2_256.dds\",\n \"gta3.img/vgsewrehse.txd/vgnwrehsewal1_256.dds\",\"gta3.img/vgnfrates.txd/vgnwrehsewal1_256.dds\",\n \"gta3.img/vgsswarehse02.txd/vgnwrehsewal1_256.dds\",\"gta3.img/vgnfrates.txd/vgnwrehsewal1_256.dds\",\n \"gta3.img/vgnfremnt2.txd/casinolit2_128.dds\",\"gta3.img/vgnfremnt1.txd/casinolit2_128.dds\",\n \"gta3.img/vgsairport.txd/casinolit2_128.dds\",\"gta3.img/vgnfremnt1.txd/casinolit2_128.dds\",\n \"gta3.img/vgnfremnt2.txd/casinolights3_128.dds\",\"gta3.img/vgnfremnt1.txd/casinolights3_128.dds\",\n \"gta3.img/vgnvrock.txd/casinolights2_128.dds\",\"gta3.img/vgnfremnt1.txd/casinolights2_128.dds\",\n \"gta3.img/vgnfremnt2.txd/casinobulb2_128n.dds\",\"gta3.img/vgnfremnt1.txd/casinobulb2_128n.dds\",\n \"gta3.img/vgwestretail1.txd/casinosign1_256.dds\",\"gta3.img/vgnfremnt1.txd/casinosign1_256.dds\",\n \"gta3.img/vgnfremnt2.txd/casinoshop32_256.dds\",\"gta3.img/vgnfremnt1.txd/casinoshop32_256.dds\",\n \"gta3.img/vgnretail5.txd/casinoshop32_256.dds\",\"gta3.img/vgnfremnt1.txd/casinoshop32_256.dds\",\n \"gta3.img/vgnretail7.txd/casinoshop32_256.dds\",\"gta3.img/vgnfremnt1.txd/casinoshop32_256.dds\",\n \"gta3.img/vgsebuild02.txd/casinoshop32_256.dds\",\"gta3.img/vgnfremnt1.txd/casinoshop32_256.dds\",\n \"gta3.img/vgnfremnt2.txd/goldframe_256.dds\",\"gta3.img/vgnfremnt1.txd/goldframe_256.dds\",\n \"gta3.img/vgnretail3.txd/freemontsign1_256.dds\",\"gta3.img/vgnfremnt1.txd/freemontsign1_256.dds\",\n \"gta3.img/vgntrainstat.txd/fence_iron_256.dds\",\"gta3.img/vgnglfcrse1.txd/fence_iron_256.dds\",\n \"gta3.img/vgwestcoast.txd/des_dirt1_glfhvy.dds\",\"gta3.img/vgnglfcrse1.txd/des_dirt1_glfhvy.dds\",\n \"gta3.img/vgwestland.txd/des_dirt1_glfhvy.dds\",\"gta3.img/vgnglfcrse1.txd/des_dirt1_glfhvy.dds\",\n \"gta3.img/vgnground.txd/vegasroad3_256.dds\",\"gta3.img/vgnground2.txd/vegasroad3_256.dds\",\n \"gta3.img/vgssdrtyroads.txd/vegasroad3_256.dds\",\"gta3.img/vgnground2.txd/vegasroad3_256.dds\",\n \"gta3.img/vgssroads.txd/vegasroad3_256.dds\",\"gta3.img/vgnground2.txd/vegasroad3_256.dds\",\n \"gta3.img/vgnground.txd/crossing_law2.dds\",\"gta3.img/vgnground2.txd/crossing_law2.dds\",\n \"gta3.img/vgsehighways.txd/crossing_law2.dds\",\"gta3.img/vgnground2.txd/crossing_law2.dds\",\n \"gta3.img/vgssdrtyroads.txd/crossing_law2.dds\",\"gta3.img/vgnground2.txd/crossing_law2.dds\",\n \"gta3.img/vgsshiways.txd/crossing_law2.dds\",\"gta3.img/vgnground2.txd/crossing_law2.dds\",\n \"gta3.img/vgssroads.txd/crossing_law2.dds\",\"gta3.img/vgnground2.txd/crossing_law2.dds\",\n \"gta3.img/vgwstdirtyrd.txd/crossing_law3.dds\",\"gta3.img/vgnground3.txd/crossing_law3.dds\",\n \"gta3.img/vgssdrtyroads.txd/vegasdirtypave2_256.dds\",\"gta3.img/vgnground3.txd/vegasdirtypave2_256.dds\",\n \"gta3.img/vgwstdirtyrd.txd/vegasdirtypave2_256.dds\",\"gta3.img/vgnground3.txd/vegasdirtypave2_256.dds\",\n \"gta3.img/vgssdrtyroads.txd/vegasdirtypave1_256.dds\",\"gta3.img/vgnground3.txd/vegasdirtypave1_256.dds\",\n \"gta3.img/vgwstdirtyrd.txd/vegasdirtypave1_256.dds\",\"gta3.img/vgnground3.txd/vegasdirtypave1_256.dds\",\n \"gta3.img/vgssdrtyroads.txd/vegasdirtyroad2_256.dds\",\"gta3.img/vgnground3.txd/vegasdirtyroad2_256.dds\",\n \"gta3.img/vgwstdirtyrd.txd/vegasdirtyroad2_256.dds\",\"gta3.img/vgnground3.txd/vegasdirtyroad2_256.dds\",\n \"gta3.img/vgssdrtyroads.txd/vegasdirtyroad1_256.dds\",\"gta3.img/vgnground3.txd/vegasdirtyroad1_256.dds\",\n \"gta3.img/vgwstdirtyrd.txd/vegasdirtyroad1_256.dds\",\"gta3.img/vgnground3.txd/vegasdirtyroad1_256.dds\",\n \"gta3.img/vgseroads.txd/vegastriproad1_256.dds\",\"gta3.img/vgnground.txd/vegastriproad1_256.dds\",\n \"gta3.img/vgwestground.txd/vegastriproad1_256.dds\",\"gta3.img/vgnground.txd/vegastriproad1_256.dds\",\n \"gta3.img/vgwestground.txd/vegaspavement3_256.dds\",\"gta3.img/vgnground.txd/vegaspavement3_256.dds\",\n \"gta3.img/vgsecoast.txd/des_scrub1_dirt1a.dds\",\"gta3.img/vgnland.txd/des_scrub1_dirt1a.dds\",\n \"gta3.img/vgwestland.txd/ws_carparknew2b.dds\",\"gta3.img/vgnland.txd/ws_carparknew2b.dds\",\n \"gta3.img/vgsecoast.txd/hiway2sand1a.dds\",\"gta3.img/vgnland.txd/hiway2sand1a.dds\",\n \"gta3.img/vgwestland.txd/hiway2sand1a.dds\",\"gta3.img/vgnland.txd/hiway2sand1a.dds\",\n \"gta3.img/vgsecoast.txd/des_scrub1_dirt1b.dds\",\"gta3.img/vgnland.txd/des_scrub1_dirt1b.dds\",\n \"gta3.img/vgnhseing1.txd/vnghse3_128.dds\",\"gta3.img/vgnhseblk1.txd/vnghse3_128.dds\",\n \"gta3.img/vgnhseing1.txd/vnghse1_256.dds\",\"gta3.img/vgnhseblk1.txd/vnghse1_256.dds\",\n \"gta3.img/vgnhseing1.txd/vnghse2_256.dds\",\"gta3.img/vgnhseblk1.txd/vnghse2_256.dds\",\n \"gta3.img/vgnhseland.txd/vgnhseledgw2_64.dds\",\"gta3.img/vgnhseing1.txd/vgnhseledgw2_64.dds\",\n \"gta3.img/vgsehseing1.txd/vgnhseledgw2_64.dds\",\"gta3.img/vgnhseing1.txd/vgnhseledgw2_64.dds\",\n \"gta3.img/vgnoutown2.txd/vgnwrehse8_256.dds\",\"gta3.img/vgnhseing1.txd/vgnwrehse8_256.dds\",\n \"gta3.img/vgsswarehse02.txd/vgnwrehse8_256.dds\",\"gta3.img/vgnhseing1.txd/vgnwrehse8_256.dds\",\n \"gta3.img/vgsswrehse03.txd/vgnwrehse8_256.dds\",\"gta3.img/vgnhseing1.txd/vgnwrehse8_256.dds\",\n \"gta3.img/vgwestabats.txd/vgnwrehse8_256.dds\",\"gta3.img/vgnhseing1.txd/vgnwrehse8_256.dds\",\n \"gta3.img/vgwestoutwn2.txd/vgnwrehse8_256.dds\",\"gta3.img/vgnhseing1.txd/vgnwrehse8_256.dds\",\n \"gta3.img/vgssland02.txd/vgnhsewall1_256.dds\",\"gta3.img/vgnhseland.txd/vgnhsewall1_256.dds\",\n \"gta3.img/vgwesthseing1.txd/vgnhsewall1_256.dds\",\"gta3.img/vgnhseland.txd/vgnhsewall1_256.dds\",\n \"gta3.img/vgse24hr.txd/cashloans1_256.dds\",\"gta3.img/vgnlowbild.txd/cashloans1_256.dds\",\n \"gta3.img/vgsswarehse02c.txd/cashloans1_256.dds\",\"gta3.img/vgnlowbild.txd/cashloans1_256.dds\",\n \"gta3.img/vgse24hr.txd/24hoursign1_256.dds\",\"gta3.img/vgnlowbild.txd/24hoursign1_256.dds\",\n \"gta3.img/vgse24hr.txd/touristbureau_256.dds\",\"gta3.img/vgnlowbild.txd/touristbureau_256.dds\",\n \"gta3.img/vgse24hr.txd/vgnlowbildwal1_256.dds\",\"gta3.img/vgnlowbild.txd/vgnlowbildwal1_256.dds\",\n \"gta3.img/vgse24hr.txd/pavedark128.dds\",\"gta3.img/vgnlowbild.txd/pavedark128.dds\",\n \"gta3.img/vgsmall.txd/vgncarwash2_128.dds\",\"gta3.img/vgnmall.txd/vgncarwash2_128.dds\",\n \"gta3.img/vgsswarehse02.txd/vgnwrehse7_256.dds\",\"gta3.img/vgnoutown2.txd/vgnwrehse7_256.dds\",\n \"gta3.img/vgsswrehse03.txd/vgnwrehse7_256.dds\",\"gta3.img/vgnoutown2.txd/vgnwrehse7_256.dds\",\n \"gta3.img/vgwestabats.txd/vgnwrehse7_256.dds\",\"gta3.img/vgnoutown2.txd/vgnwrehse7_256.dds\",\n \"gta3.img/vgwestoutwn2.txd/vgnwrehse7_256.dds\",\"gta3.img/vgnoutown2.txd/vgnwrehse7_256.dds\",\n \"gta3.img/vgsswarehse02.txd/vgnwrehse6_256.dds\",\"gta3.img/vgnoutown2.txd/vgnwrehse6_256.dds\",\n \"gta3.img/vgsswrehse03.txd/vgnwrehse6_256.dds\",\"gta3.img/vgnoutown2.txd/vgnwrehse6_256.dds\",\n \"gta3.img/vgwestabats.txd/vgnwrehse6_256.dds\",\"gta3.img/vgnoutown2.txd/vgnwrehse6_256.dds\",\n \"gta3.img/vgwestoutwn2.txd/vgnwrehse6_256.dds\",\"gta3.img/vgnoutown2.txd/vgnwrehse6_256.dds\",\n \"gta3.img/vgsswarehse02.txd/vgnwrehse5_256.dds\",\"gta3.img/vgnoutown2.txd/vgnwrehse5_256.dds\",\n \"gta3.img/vgsswrehse03.txd/vgnwrehse5_256.dds\",\"gta3.img/vgnoutown2.txd/vgnwrehse5_256.dds\",\n \"gta3.img/vgwestabats.txd/vgnwrehse5_256.dds\",\"gta3.img/vgnoutown2.txd/vgnwrehse5_256.dds\",\n \"gta3.img/vgwestoutwn2.txd/vgnwrehse5_256.dds\",\"gta3.img/vgnoutown2.txd/vgnwrehse5_256.dds\",\n \"gta3.img/vgsswarehse02b.txd/roof05l256.dds\",\"gta3.img/vgnoutown2.txd/roof05l256.dds\",\n \"gta3.img/vgsswrehse03.txd/roof05l256.dds\",\"gta3.img/vgnoutown2.txd/roof05l256.dds\",\n \"gta3.img/willvax.txd/metalwheel4_128.dds\",\"gta3.img/vgnplantgen.txd/metalwheel4_128.dds\",\n \"gta3.img/vgslowbuild.txd/vgnstripwal1_128.dds\",\"gta3.img/vgnptrlpmp.txd/vgnstripwal1_128.dds\",\n \"gta3.img/vgnpwroutbld1.txd/hazwaste1_256.dds\",\"gta3.img/vgnpwrmainbld.txd/hazwaste1_256.dds\",\n \"gta3.img/vgsswarehse02b.txd/sw_stresswall1.dds\",\"gta3.img/vgnpwroutbld1.txd/sw_stresswall1.dds\",\n \"gta3.img/vgsswarehse02c.txd/sw_stresswall1.dds\",\"gta3.img/vgnpwroutbld1.txd/sw_stresswall1.dds\",\n \"gta3.img/vgwestabats.txd/bow_load_door.dds\",\"gta3.img/vgnpwrwhse.txd/bow_load_door.dds\",\n \"gta3.img/vgwestrailrd.txd/conchev_64hv.dds\",\"gta3.img/vgnrailroad.txd/conchev_64hv.dds\",\n \"gta3.img/vgslowbuild1.txd/vgnmetalwall5_256.dds\",\"gta3.img/vgnretail2.txd/vgnmetalwall5_256.dds\",\n \"gta3.img/vgnretail72.txd/vgnmetalwall6_256.dds\",\"gta3.img/vgnretail2.txd/vgnmetalwall6_256.dds\",\n \"gta3.img/vgslowbuild1.txd/vgnmetalwall6_256.dds\",\"gta3.img/vgnretail2.txd/vgnmetalwall6_256.dds\",\n \"gta3.img/vgslowbuild1.txd/vgnmetalwall1_256.dds\",\"gta3.img/vgnretail2.txd/vgnmetalwall1_256.dds\",\n \"gta3.img/vgslowbuild1.txd/vgnmetalwall2_256.dds\",\"gta3.img/vgnretail2.txd/vgnmetalwall2_256.dds\",\n \"gta3.img/w_towncs_t.txd/counter01_law.dds\",\"gta3.img/vgnretail3.txd/counter01_law.dds\",\n \"gta3.img/vgnretail7.txd/carparksign02_128.dds\",\"gta3.img/vgnretail5.txd/carparksign02_128.dds\",\n \"gta3.img/vgshpground.txd/carparksign02_128.dds\",\"gta3.img/vgnretail5.txd/carparksign02_128.dds\",\n \"gta3.img/vgsswarehse02c.txd/carparksign02_128.dds\",\"gta3.img/vgnretail5.txd/carparksign02_128.dds\",\n \"gta3.img/vgs_shops.txd/vgsclubwall01_128.dds\",\"gta3.img/vgnretail5.txd/vgsclubwall01_128.dds\",\n \"gta3.img/vgs_shops.txd/vegasclubledge_128.dds\",\"gta3.img/vgnretail5.txd/vegasclubledge_128.dds\",\n \"gta3.img/vgs_shops.txd/vegasclub02_128.dds\",\"gta3.img/vgnretail5.txd/vegasclub02_128.dds\",\n \"gta3.img/vgs_shops.txd/vegasclub01_128.dds\",\"gta3.img/vgnretail5.txd/vegasclub01_128.dds\",\n \"gta3.img/vgnusedcar.txd/marinawindow2_256.dds\",\"gta3.img/vgnretail6.txd/marinawindow2_256.dds\",\n \"gta3.img/vgnvrock.txd/marinawindow2_256.dds\",\"gta3.img/vgnretail6.txd/marinawindow2_256.dds\",\n \"gta3.img/wddngchpl.txd/wddngchapelsign04_128.dds\",\"gta3.img/vgnretail6.txd/wddngchapelsign04_128.dds\",\n \"gta3.img/wddngchpl.txd/vgsn_chplroof.dds\",\"gta3.img/vgnretail6.txd/vgsn_chplroof.dds\",\n \"gta3.img/wddngchpl02.txd/vgsn_chplwall.dds\",\"gta3.img/vgnretail6.txd/vgsn_chplwall.dds\",\n \"gta3.img/wddngchpl.txd/vgsn_chplwall.dds\",\"gta3.img/vgnretail6.txd/vgsn_chplwall.dds\",\n \"gta3.img/wddngchpl.txd/wddngchapel03_64.dds\",\"gta3.img/vgnretail6.txd/wddngchapel03_64.dds\",\n \"gta3.img/wddngchpl.txd/wddngchapel02_64.dds\",\"gta3.img/vgnretail6.txd/wddngchapel02_64.dds\",\n \"gta3.img/wddngchpl.txd/wddngchplldge03_64.dds\",\"gta3.img/vgnretail6.txd/wddngchplldge03_64.dds\",\n \"gta3.img/wddngchpl.txd/wddngchplldge01_64.dds\",\"gta3.img/vgnretail6.txd/wddngchplldge01_64.dds\",\n \"gta3.img/wddngchpl.txd/wddngchapelsign03_128.dds\",\"gta3.img/vgnretail6.txd/wddngchapelsign03_128.dds\",\n \"gta3.img/wddngchpl.txd/vegdoor1_int.dds\",\"gta3.img/vgnretail6.txd/vegdoor1_int.dds\",\n \"gta_int.img/labig2int2.txd/vegdoor1_int.dds\",\"gta3.img/vgnretail6.txd/vegdoor1_int.dds\",\n \"gta3.img/vgslowbuild1.txd/vgnmetalwall4_256.dds\",\"gta3.img/vgnretail72.txd/vgnmetalwall4_256.dds\",\n \"gta3.img/vgsecnstrct03.txd/scafoldclear_256.dds\",\"gta3.img/vgnscaffold.txd/vgsnscfldclr_256.dds\",\n \"gta3.img/vgsecnstrct03.txd/newscafold_256.dds\",\"gta3.img/vgnscaffold.txd/vgsnscafold_256.dds\",\n \"gta3.img/vgsswarhse04.txd/fitzwallvgn3_256.dds\",\"gta3.img/vgnshambild1.txd/fitzwallvgn3_256.dds\",\n \"gta3.img/vgslowbuild1.txd/vgnmetalwall3_256.dds\",\"gta3.img/vgnshopnmall.txd/vgnmetalwall3_256.dds\",\n \"gta3.img/vgsecarshow.txd/lightyellow2_32.dds\",\"gta3.img/vgnusedcar.txd/lightyellow2_32.dds\",\n \"gta3.img/vgsecarshow.txd/lightpurple2_32.dds\",\"gta3.img/vgnusedcar.txd/lightpurple2_32.dds\",\n \"gta3.img/vgsecarshow.txd/lightblue2_32.dds\",\"gta3.img/vgnusedcar.txd/lightblue2_32.dds\",\n \"gta3.img/vgsecarshow.txd/lightgreen2_32.dds\",\"gta3.img/vgnusedcar.txd/lightgreen2_32.dds\",\n \"gta3.img/vgnvrock.txd/marinadoor2_256.dds\",\"gta3.img/vgnusedcar.txd/marinadoor2_256.dds\",\n \"gta3.img/vgwestabats.txd/greenshade4_64.dds\",\"gta3.img/vgnusedcar.txd/greenshade4_64.dds\",\n \"gta_int.img/dr_gsstudio.txd/flyingv_256.dds\",\"gta3.img/vgnvrock.txd/flyingv_256.dds\",\n \"gta_int.img/imy_motel2.txd/ab_tile1.dds\",\"gta3.img/vgsbikeschool.txd/ab_tile1.dds\",\n \"gta_int.img/imy_motel.txd/ab_tile1.dds\",\"gta3.img/vgsbikeschool.txd/ab_tile1.dds\",\n \"gta_int.img/labig2int2.txd/ab_tile1.dds\",\"gta3.img/vgsbikeschool.txd/ab_tile1.dds\",\n \"gta_int.img/sweetsmain.txd/ab_tile1.dds\",\"gta3.img/vgsbikeschool.txd/ab_tile1.dds\",\n \"gta_int.img/triadinteriorn.txd/vgnchinlion1_512.dds\",\"gta3.img/vgschinalion.txd/vgnchinlion1_512.dds\",\n \"gta_int.img/plants.txd/plantc256.dds\",\"gta3.img/vgsebushes.txd/plantc256.dds\",\n \"gta_int.img/triad_big.txd/buddha_gold.dds\",\"gta3.img/vgsedragon.txd/buddha_gold.dds\",\n \"gta_int.img/triad_main.txd/buddha_gold.dds\",\"gta3.img/vgsedragon.txd/buddha_gold.dds\",\n \"gta3.img/vgsnhighway.txd/hiwayend_256.dds\",\"gta3.img/vgsehighways.txd/hiwayend_256.dds\",\n \"gta3.img/vgsshiways.txd/hiwayend_256.dds\",\"gta3.img/vgsehighways.txd/hiwayend_256.dds\",\n \"gta3.img/vgwsthiway1.txd/hiwayend_256.dds\",\"gta3.img/vgsehighways.txd/hiwayend_256.dds\",\n \"gta3.img/vgsnhighway.txd/hiwayinside3_256.dds\",\"gta3.img/vgsehighways.txd/hiwayinside3_256.dds\",\n \"gta3.img/vgsshiways.txd/hiwayinside3_256.dds\",\"gta3.img/vgsehighways.txd/hiwayinside3_256.dds\",\n \"gta3.img/vgwsthiway1.txd/hiwayinside3_256.dds\",\"gta3.img/vgsehighways.txd/hiwayinside3_256.dds\",\n \"gta3.img/vgsnhighway.txd/hiwayinside2_256.dds\",\"gta3.img/vgsehighways.txd/hiwayinside2_256.dds\",\n \"gta3.img/vgsshiways.txd/hiwayinside2_256.dds\",\"gta3.img/vgsehighways.txd/hiwayinside2_256.dds\",\n \"gta3.img/vgwsthiway1.txd/hiwayinside2_256.dds\",\"gta3.img/vgsehighways.txd/hiwayinside2_256.dds\",\n \"gta_int.img/ab_wooziea.txd/ab_tilediamond.dds\",\"gta3.img/vgseland.txd/ab_tilediamond.dds\",\n \"gta_int.img/sfhosemed2.txd/ab_tilediamond.dds\",\"gta3.img/vgseland.txd/ab_tilediamond.dds\",\n \"gta3.img/vgwestground.txd/vegasroad2_256.dds\",\"gta3.img/vgseroads.txd/vegasroad2_256.dds\",\n \"gta3.img/vgssdrtyroads.txd/blendpavement2b_256.dds\",\"gta3.img/vgseroads.txd/blendpavement2b_256.dds\",\n \"gta3.img/vgssroads.txd/blendpavement2b_256.dds\",\"gta3.img/vgseroads.txd/blendpavement2b_256.dds\",\n \"gta3.img/vgs_shop5.txd/vegaspawnwall02_128.dds\",\"gta3.img/vgshpground.txd/vegaspawnwall02_128.dds\",\n \"gta3.img/vgs_shop5.txd/vgspawnroof01_128.dds\",\"gta3.img/vgshpground.txd/vgspawnroof01_128.dds\",\n \"gta3.img/vgs_shop5.txd/vegaspawn01_128.dds\",\"gta3.img/vgshpground.txd/vegaspawn01_128.dds\",\n \"gta3.img/vgsoffice1.txd/vegasoffice05_128.dds\",\"gta3.img/vgslockup.txd/vegasoffice05_128.dds\",\n \"gta3.img/vgwestretail1.txd/homies_1_128.dds\",\"gta3.img/vgsn_billboard.txd/homies_1_128.dds\",\n \"gta3.img/warehus_las2.txd/homies_1_128.dds\",\"gta3.img/vgsn_billboard.txd/homies_1_128.dds\",\n \"gta3.img/vgsshiways.txd/hiwayinside4_256.dds\",\"gta3.img/vgsnhighway.txd/hiwayinside4_256.dds\",\n \"gta3.img/vgwsthiway1.txd/hiwayinside4_256.dds\",\"gta3.img/vgsnhighway.txd/hiwayinside4_256.dds\",\n \"gta_int.img/genintgeneric.txd/kbtree3_test.dds\",\"gta3.img/vgsn_nitree.txd/kbtree3_test.dds\",\n \"gta_int.img/plants.txd/kbtree3_test.dds\",\"gta3.img/vgsn_nitree.txd/kbtree3_test.dds\",\n \"gta_int.img/cj_ammo_posters.txd/cj_mantarget.dds\",\"gta3.img/vgsn_polnb.txd/cj_mantarget.dds\",\n \"gta_int.img/cj_ammo.txd/cj_mantarget.dds\",\"gta3.img/vgsn_polnb.txd/cj_mantarget.dds\",\n \"gta_int.img/police_props_un.txd/cj_mantarget.dds\",\"gta3.img/vgsn_polnb.txd/cj_mantarget.dds\",\n \"gta_int.img/cuntcuts.txd/newspaper1.dds\",\"gta3.img/vgsn_polnb.txd/newspaper1.dds\",\n \"gta_int.img/police_props_un.txd/newspaper1.dds\",\"gta3.img/vgsn_polnb.txd/newspaper1.dds\",\n \"gta_int.img/savesfmid.txd/newspaper1.dds\",\"gta3.img/vgsn_polnb.txd/newspaper1.dds\",\n \"gta_int.img/svsfsm.txd/newspaper1.dds\",\"gta3.img/vgsn_polnb.txd/newspaper1.dds\",\n \"gta_int.img/cj_office.txd/blue_fabric.dds\",\"gta3.img/vgsn_polnb.txd/blue_fabric.dds\",\n \"gta_int.img/police_props.txd/blue_fabric.dds\",\"gta3.img/vgsn_polnb.txd/blue_fabric.dds\",\n \"gta_int.img/police_props_un.txd/blue_fabric.dds\",\"gta3.img/vgsn_polnb.txd/blue_fabric.dds\",\n \"gta3.img/vgssairportcpark.txd/exit_noexit128.dds\",\"gta3.img/vgssairport02.txd/exit_noexit128.dds\",\n \"gta3.img/vgssmulticarprk.txd/exit_noexit128.dds\",\"gta3.img/vgssairport02.txd/exit_noexit128.dds\",\n \"gta3.img/vgssairportcpark.txd/chevronyb_64.dds\",\"gta3.img/vgssairport02.txd/chevronyb_64.dds\",\n \"gta3.img/vgssmulticarprk.txd/chevronyb_64.dds\",\"gta3.img/vgssairport02.txd/chevronyb_64.dds\",\n \"gta3.img/vgssmulticarprk.txd/metalcopy.dds\",\"gta3.img/vgssairport02.txd/metalcopy.dds\",\n \"gta3.img/vgssmulticarprk.txd/drivecare_64.dds\",\"gta3.img/vgssairport02.txd/drivecare_64.dds\",\n \"gta3.img/vgssmulticarprk.txd/airsign2_64.dds\",\"gta3.img/vgssairport02.txd/airsign2_64.dds\",\n \"gta3.img/vgsswarhse04.txd/ws_airsecurity.dds\",\"gta3.img/vgssairport02.txd/ws_airsecurity.dds\",\n \"gta3.img/ws_apgatex.txd/ws_airsecurity.dds\",\"gta3.img/vgssairport02.txd/ws_airsecurity.dds\",\n \"gta3.img/wddngchpl02.txd/vgschapelwall01_64.dds\",\"gta3.img/vgsschurch.txd/vgschapelwall01_64.dds\",\n \"gta3.img/vgwsthiway1.txd/hiwayinsideblend2_256.dds\",\"gta3.img/vgsshiways.txd/hiwayinsideblend2_256.dds\",\n \"gta3.img/vgssland.txd/desgrasandblend.dds\",\"gta3.img/vgssland02.txd/desgrasandblend.dds\",\n \"gta3.img/vgsswarehse01.txd/upt_conc=floor.dds\",\"gta3.img/vgssland03.txd/upt_conc=floor.dds\",\n \"gta3.img/vgsswarehse02.txd/electrics01.dds\",\"gta3.img/vgsssignage03.txd/electrics01.dds\",\n \"gta3.img/vgsswrehse03.txd/electrics01.dds\",\"gta3.img/vgsssignage03.txd/electrics01.dds\",\n \"gta3.img/vgwestabats.txd/vgswrehouse01_128.dds\",\"gta3.img/vgsswarehse01.txd/vgswrehouse01_128.dds\",\n \"gta3.img/wddngchplsign2.txd/wddngchapelsign06_128.dds\",\"gta3.img/vgsswarehse02c.txd/wddngchapelsign06_128.dds\",\n \"gta3.img/wiresetc_las2.txd/ganggraf03_la.dds\",\"gta3.img/wiresetc2_las.txd/ganggraf03_la.dds\",\n \"gta3.img/wiresetc_las.txd/ganggraf03_la.dds\",\"gta3.img/wiresetc2_las.txd/ganggraf03_la.dds\",\n \"gta3.img/wmotrm1.txd/tramp1.dds\",\"gta3.img/wmotr1.txd/tramp1.dds\",\n \"gta_int.img/genintint711_1.txd/cj_7_11_tile.dds\",\"gta_int.img/711c.txd/cj_7_11_tile.dds\",\n \"gta_int.img/genintint711_1.txd/bwtilebroth.dds\",\"gta_int.img/711c.txd/bwtilebroth.dds\",\n \"gta_int.img/int_brothelint3.txd/bwtilebroth.dds\",\"gta_int.img/711c.txd/bwtilebroth.dds\",\n \"gta_int.img/casinovault01.txd/gun_ceiling1128.dds\",\"gta_int.img/711c.txd/gun_ceiling1128.dds\",\n \"gta_int.img/genintint711_1.txd/gun_ceiling1128.dds\",\"gta_int.img/711c.txd/gun_ceiling1128.dds\",\n \"gta_int.img/gen_pol_vegas.txd/gun_ceiling1128.dds\",\"gta_int.img/711c.txd/gun_ceiling1128.dds\",\n \"gta_int.img/mp_diner1.txd/gun_ceiling1128.dds\",\"gta_int.img/711c.txd/gun_ceiling1128.dds\",\n \"gta_int.img/genintint711_1.txd/sec_camera1.dds\",\"gta_int.img/711c.txd/sec_camera1.dds\",\n \"gta_int.img/temp_shop.txd/sec_camera1.dds\",\"gta_int.img/711c.txd/sec_camera1.dds\",\n \"gta_int.img/ab_sfammumain.txd/gun_ceiling3.dds\",\"gta_int.img/711c.txd/gun_ceiling3.dds\",\n \"gta_int.img/ammu_twofloor.txd/gun_ceiling3.dds\",\"gta_int.img/711c.txd/gun_ceiling3.dds\",\n \"gta_int.img/casinovault01.txd/gun_ceiling3.dds\",\"gta_int.img/711c.txd/gun_ceiling3.dds\",\n \"gta_int.img/genintint711_1.txd/gun_ceiling3.dds\",\"gta_int.img/711c.txd/gun_ceiling3.dds\",\n \"gta_int.img/gen_munation.txd/gun_ceiling3.dds\",\"gta_int.img/711c.txd/gun_ceiling3.dds\",\n \"gta_int.img/mp_diner1.txd/gun_ceiling3.dds\",\"gta_int.img/711c.txd/gun_ceiling3.dds\",\n \"gta_int.img/munation1.txd/gun_ceiling3.dds\",\"gta_int.img/711c.txd/gun_ceiling3.dds\",\n \"gta_int.img/range_main.txd/gun_ceiling3.dds\",\"gta_int.img/711c.txd/gun_ceiling3.dds\",\n \"gta_int.img/vegas_munation.txd/gun_ceiling3.dds\",\"gta_int.img/711c.txd/gun_ceiling3.dds\",\n \"gta_int.img/road.txd/barrier.dds\",\"gta_int.img/8bars.txd/barrier.dds\",\n \"gta_int.img/dirtstad.txd/stadroof.dds\",\"gta_int.img/8stad.txd/stadroof.dds\",\n \"gta_int.img/kickarse.txd/stadroof.dds\",\"gta_int.img/8stad.txd/stadroof.dds\",\n \"gta_int.img/mafcasgenstuff.txd/pipes_csite_256.dds\",\"gta_int.img/ab_abattoir_box.txd/pipes_csite_256.dds\",\n \"gta_int.img/maint1.txd/pipes_csite_256.dds\",\"gta_int.img/ab_abattoir_box.txd/pipes_csite_256.dds\",\n \"gta_int.img/mafcasgenstuff.txd/ab_airconunit.dds\",\"gta_int.img/ab_abattoir_box.txd/ab_airconunit.dds\",\n \"gta_int.img/maint1.txd/ab_airconunit.dds\",\"gta_int.img/ab_abattoir_box.txd/ab_airconunit.dds\",\n \"gta_int.img/pleas_dome.txd/ab_walldamage.dds\",\"gta_int.img/ab_abattoir_box.txd/ab_walldamage.dds\",\n \"gta_int.img/tri_holes.txd/ab_walldamage.dds\",\"gta_int.img/ab_abattoir_box.txd/ab_walldamage.dds\",\n \"gta_int.img/burglry1.txd/ab_wall1b.dds\",\"gta_int.img/ab_abbatoir01.txd/ab_wall1b.dds\",\n \"gta_int.img/ganghoos.txd/ab_wall1b.dds\",\"gta_int.img/ab_abbatoir01.txd/ab_wall1b.dds\",\n \"gta_int.img/bikeskool.txd/carpet5kb.dds\",\"gta_int.img/ab_abbatoir01.txd/carpet5kb.dds\",\n \"gta_int.img/estate2.txd/carpet5kb.dds\",\"gta_int.img/ab_abbatoir01.txd/carpet5kb.dds\",\n \"gta_int.img/ab_sfammumain.txd/ab_vent1.dds\",\"gta_int.img/ab_abbatoir01.txd/ab_vent1.dds\",\n \"gta_int.img/ab_vegasgymmain.txd/ab_vent1.dds\",\"gta_int.img/ab_abbatoir01.txd/ab_vent1.dds\",\n \"gta_int.img/casinovault01.txd/ab_vent1.dds\",\"gta_int.img/ab_abbatoir01.txd/ab_vent1.dds\",\n \"gta_int.img/dogsgym.txd/ab_vent1.dds\",\"gta_int.img/ab_abbatoir01.txd/ab_vent1.dds\",\n \"gta_int.img/mafiacasinovault01.txd/ab_vent1.dds\",\"gta_int.img/ab_abbatoir01.txd/ab_vent1.dds\",\n \"gta_int.img/papaerchaseoffice.txd/ab_vent1.dds\",\"gta_int.img/ab_abbatoir01.txd/ab_vent1.dds\",\n \"gta_int.img/blindinglite2.txd/ab_volumelight.dds\",\"gta_int.img/abatoir_daylite.txd/ab_volumelight.dds\",\n \"gta_int.img/ab_sfammuunits.txd/cargo_gir1.dds\",\"gta_int.img/ab_cargo_int.txd/cargo_gir1.dds\",\n \"gta_int.img/pleas_dome.txd/ab_gembead.dds\",\"gta_int.img/ab_chande.txd/ab_gembead.dds\",\n \"gta_int.img/mafcasmain.txd/ab_goldpipe.dds\",\"gta_int.img/ab_chande.txd/ab_goldpipe.dds\",\n \"gta_int.img/mafcassigns1.txd/ab_goldpipe.dds\",\"gta_int.img/ab_chande.txd/ab_goldpipe.dds\",\n \"gta_int.img/mafiacasino01.txd/ab_goldpipe.dds\",\"gta_int.img/ab_chande.txd/ab_goldpipe.dds\",\n \"gta_int.img/sweetshall.txd/ab_goldpipe.dds\",\"gta_int.img/ab_chande.txd/ab_goldpipe.dds\",\n \"gta_int.img/sweetsmain.txd/ab_goldpipe.dds\",\"gta_int.img/ab_chande.txd/ab_goldpipe.dds\",\n \"gta_int.img/ab_woozieb.txd/ab_trellis.dds\",\"gta_int.img/ab_dojowall.txd/ab_trellis.dds\",\n \"gta_int.img/ab_wooziea.txd/mp_apt1_roomfloor.dds\",\"gta_int.img/ab_dojowall.txd/mp_apt1_roomfloor.dds\",\n \"gta_int.img/lamidint2.txd/mp_apt1_roomfloor.dds\",\"gta_int.img/ab_dojowall.txd/mp_apt1_roomfloor.dds\",\n \"gta_int.img/mp_diner1.txd/mp_apt1_roomfloor.dds\",\"gta_int.img/ab_dojowall.txd/mp_apt1_roomfloor.dds\",\n \"gta_int.img/mp_diner2.txd/mp_apt1_roomfloor.dds\",\"gta_int.img/ab_dojowall.txd/mp_apt1_roomfloor.dds\",\n \"gta_int.img/rylounge.txd/mp_apt1_roomfloor.dds\",\"gta_int.img/ab_dojowall.txd/mp_apt1_roomfloor.dds\",\n \"gta_int.img/hos_trolley.txd/hospital_trolley.dds\",\"gta_int.img/ab_mafcaslaund.txd/hospital_trolley.dds\",\n \"gta_int.img/mafcasmain.txd/golddecal.dds\",\"gta_int.img/ab_mafiasuitea.txd/golddecal.dds\",\n \"gta_int.img/mafcastopfoor.txd/golddecal.dds\",\"gta_int.img/ab_mafiasuitea.txd/golddecal.dds\",\n \"gta_int.img/mafiacasino01.txd/golddecal.dds\",\"gta_int.img/ab_mafiasuitea.txd/golddecal.dds\",\n \"gta_int.img/ab_wooziea.txd/walp45s.dds\",\"gta_int.img/ab_mafiasuitea.txd/walp45s.dds\",\n \"gta_int.img/gen_offtrackint.txd/barbersmir1.dds\",\"gta_int.img/ab_mafiasuitea.txd/barbersmir1.dds\",\n \"gta_int.img/papaerchaseoffice.txd/barbersmir1.dds\",\"gta_int.img/ab_mafiasuitea.txd/barbersmir1.dds\",\n \"gta_int.img/ab_partition1.txd/goldpillar.dds\",\"gta_int.img/ab_mafiasuitea.txd/goldpillar.dds\",\n \"gta_int.img/casino_props.txd/goldpillar.dds\",\"gta_int.img/ab_mafiasuitea.txd/goldpillar.dds\",\n \"gta_int.img/casmafbar.txd/goldpillar.dds\",\"gta_int.img/ab_mafiasuitea.txd/goldpillar.dds\",\n \"gta_int.img/mafcasmain.txd/goldpillar.dds\",\"gta_int.img/ab_mafiasuitea.txd/goldpillar.dds\",\n \"gta_int.img/mafcastopfoor.txd/goldpillar.dds\",\"gta_int.img/ab_mafiasuitea.txd/goldpillar.dds\",\n \"gta_int.img/mafiacasino01.txd/goldpillar.dds\",\"gta_int.img/ab_mafiasuitea.txd/goldpillar.dds\",\n \"gta_int.img/mafiacasino02.txd/goldpillar.dds\",\"gta_int.img/ab_mafiasuitea.txd/goldpillar.dds\",\n \"gta_int.img/ab_sfgymmain.txd/kit_door1.dds\",\"gta_int.img/ab_mafiasuitea.txd/kit_door1.dds\",\n \"gta_int.img/ab_wooziea.txd/kit_door1.dds\",\"gta_int.img/ab_mafiasuitea.txd/kit_door1.dds\",\n \"gta_int.img/burg_1.txd/kit_door1.dds\",\"gta_int.img/ab_mafiasuitea.txd/kit_door1.dds\",\n \"gta_int.img/carlslounge.txd/kit_door1.dds\",\"gta_int.img/ab_mafiasuitea.txd/kit_door1.dds\",\n \"gta_int.img/lasmall2int2.txd/kit_door1.dds\",\"gta_int.img/ab_mafiasuitea.txd/kit_door1.dds\",\n \"gta_int.img/casino_props.txd/ceilinglite.dds\",\"gta_int.img/ab_mafiasuitea.txd/ceilinglite.dds\",\n \"gta_int.img/mafcaslites01.txd/ceilinglite.dds\",\"gta_int.img/ab_mafiasuitea.txd/ceilinglite.dds\",\n \"gta_int.img/mafcastopfoor.txd/ceilinglite.dds\",\"gta_int.img/ab_mafiasuitea.txd/ceilinglite.dds\",\n \"gta_int.img/mafiacasino01.txd/ceilinglite.dds\",\"gta_int.img/ab_mafiasuitea.txd/ceilinglite.dds\",\n \"gta_int.img/dr_gsbits.txd/ab_books.dds\",\"gta_int.img/ab_mafiasuitea.txd/ab_books.dds\",\n \"gta_int.img/dr_gsnew.txd/ab_books.dds\",\"gta_int.img/ab_mafiasuitea.txd/ab_books.dds\",\n \"gta_int.img/casmafbar.txd/cof_wood2.dds\",\"gta_int.img/ab_mafiasuitea.txd/cof_wood2.dds\",\n \"gta_int.img/mafcasmain.txd/cof_wood2.dds\",\"gta_int.img/ab_mafiasuitea.txd/cof_wood2.dds\",\n \"gta_int.img/mafiacasino01.txd/cof_wood2.dds\",\"gta_int.img/ab_mafiasuitea.txd/cof_wood2.dds\",\n \"gta_int.img/papaerchaseoffice.txd/cof_wood2.dds\",\"gta_int.img/ab_mafiasuitea.txd/cof_wood2.dds\",\n \"gta_int.img/paperchase_bits2.txd/cof_wood2.dds\",\"gta_int.img/ab_mafiasuitea.txd/cof_wood2.dds\",\n \"gta_int.img/ab_wooziea.txd/ab_picframe.dds\",\"gta_int.img/ab_mafiasuitea.txd/ab_picframe.dds\",\n \"gta_int.img/traidman.txd/ab_blind.dds\",\"gta_int.img/ab_mafiasuitea.txd/ab_blind.dds\",\n \"gta_int.img/mafcasspiral.txd/ab_optilite.dds\",\"gta_int.img/ab_optilite.txd/ab_optilite.dds\",\n \"gta_int.img/mafiacasino01.txd/ab_optilite.dds\",\"gta_int.img/ab_optilite.txd/ab_optilite.dds\",\n \"gta_int.img/triad_main.txd/ab_optilite.dds\",\"gta_int.img/ab_optilite.txd/ab_optilite.dds\",\n \"gta_int.img/tricas_neon.txd/ab_optilite.dds\",\"gta_int.img/ab_optilite.txd/ab_optilite.dds\",\n \"gta_int.img/ammu_2flrprops.txd/gun_guns4a.dds\",\"gta_int.img/ab_sfammuitems01.txd/gun_guns4a.dds\",\n \"gta_int.img/cj_ammun_extra.txd/gun_guns4a.dds\",\"gta_int.img/ab_sfammuitems01.txd/gun_guns4a.dds\",\n \"gta_int.img/gen_mun_xtars2.txd/gun_guns4a.dds\",\"gta_int.img/ab_sfammuitems01.txd/gun_guns4a.dds\",\n \"gta_int.img/ammu_2flrprops.txd/gun_guns3a.dds\",\"gta_int.img/ab_sfammuitems01.txd/gun_guns3a.dds\",\n \"gta_int.img/cj_ammun_extra.txd/gun_guns3a.dds\",\"gta_int.img/ab_sfammuitems01.txd/gun_guns3a.dds\",\n \"gta_int.img/gen_mun_xtars2.txd/gun_guns3a.dds\",\"gta_int.img/ab_sfammuitems01.txd/gun_guns3a.dds\",\n \"gta_int.img/ammu_2flrprops.txd/ammu_clothes.dds\",\"gta_int.img/ab_sfammuitems01.txd/ammu_clothes.dds\",\n \"gta_int.img/cj_ammun_extra.txd/ammu_clothes.dds\",\"gta_int.img/ab_sfammuitems01.txd/ammu_clothes.dds\",\n \"gta_int.img/ammu_2flrprops.txd/ammu_gunboard4.dds\",\"gta_int.img/ab_sfammuitems01.txd/ammu_gunboard4.dds\",\n \"gta_int.img/cj_ammun_extra.txd/ammu_gunboard4.dds\",\"gta_int.img/ab_sfammuitems01.txd/ammu_gunboard4.dds\",\n \"gta_int.img/munation_xtras2.txd/ammu_gunboard4.dds\",\"gta_int.img/ab_sfammuitems01.txd/ammu_gunboard4.dds\",\n \"gta_int.img/ammu_2flrprops.txd/ammu_gunboard2.dds\",\"gta_int.img/ab_sfammuitems01.txd/ammu_gunboard2.dds\",\n \"gta_int.img/cj_ammun_extra.txd/ammu_gunboard2.dds\",\"gta_int.img/ab_sfammuitems01.txd/ammu_gunboard2.dds\",\n \"gta_int.img/munation_xtras2.txd/ammu_gunboard2.dds\",\"gta_int.img/ab_sfammuitems01.txd/ammu_gunboard2.dds\",\n \"gta_int.img/ammu_2flrprops.txd/ammo_gunboard.dds\",\"gta_int.img/ab_sfammuitems01.txd/ammo_gunboard.dds\",\n \"gta_int.img/cj_ammun_extra.txd/ammo_gunboard.dds\",\"gta_int.img/ab_sfammuitems01.txd/ammo_gunboard.dds\",\n \"gta_int.img/munation_xtras2.txd/ammo_gunboard.dds\",\"gta_int.img/ab_sfammuitems01.txd/ammo_gunboard.dds\",\n \"gta_int.img/ammu_2flrprops.txd/gun_sign_txta.dds\",\"gta_int.img/ab_sfammuitems02.txd/gun_sign_txta.dds\",\n \"gta_int.img/cj_ammun_extra.txd/gun_sign_txta.dds\",\"gta_int.img/ab_sfammuitems02.txd/gun_sign_txta.dds\",\n \"gta_int.img/ammu_2flrprops.txd/gun_xtra2.dds\",\"gta_int.img/ab_sfammuitems02.txd/gun_xtra2.dds\",\n \"gta_int.img/cj_ammun_extra.txd/gun_xtra2.dds\",\"gta_int.img/ab_sfammuitems02.txd/gun_xtra2.dds\",\n \"gta_int.img/ammu_2flrprops.txd/gun_xtra1.dds\",\"gta_int.img/ab_sfammuitems02.txd/gun_xtra1.dds\",\n \"gta_int.img/cj_ammun_extra.txd/gun_xtra1.dds\",\"gta_int.img/ab_sfammuitems02.txd/gun_xtra1.dds\",\n \"gta_int.img/ammu_2flrprops.txd/1_to_8.dds\",\"gta_int.img/ab_sfammuitems02.txd/1_to_8.dds\",\n \"gta_int.img/genintamm.txd/1_to_8.dds\",\"gta_int.img/ab_sfammuitems02.txd/1_to_8.dds\",\n \"gta_int.img/vg_mun_extars5.txd/1_to_8.dds\",\"gta_int.img/ab_sfammuitems02.txd/1_to_8.dds\",\n \"gta_int.img/kbroul1.txd/shelf_glas.dds\",\"gta_int.img/ab_sfammumain.txd/shelf_glas.dds\",\n \"gta_int.img/new_cabinets3.txd/shelf_glas.dds\",\"gta_int.img/ab_sfammumain.txd/shelf_glas.dds\",\n \"gta_int.img/new_cabinets.txd/shelf_glas.dds\",\"gta_int.img/ab_sfammumain.txd/shelf_glas.dds\",\n \"gta_int.img/shop_shelf1.txd/shelf_glas.dds\",\"gta_int.img/ab_sfammumain.txd/shelf_glas.dds\",\n \"gta_int.img/skuzzy_motelmain.txd/carp20s.dds\",\"gta_int.img/ab_sfammumain.txd/carp20s.dds\",\n \"gta_int.img/ammu_twofloor.txd/mp_gun_wall.dds\",\"gta_int.img/ab_sfammumain.txd/mp_gun_wall.dds\",\n \"gta_int.img/gen_munation.txd/mp_gun_wall.dds\",\"gta_int.img/ab_sfammumain.txd/mp_gun_wall.dds\",\n \"gta_int.img/ammu_twofloor.txd/gun_door1.dds\",\"gta_int.img/ab_sfammumain.txd/gun_door1.dds\",\n \"gta_int.img/munation1.txd/gun_door1.dds\",\"gta_int.img/ab_sfammumain.txd/gun_door1.dds\",\n \"gta_int.img/range_main.txd/gun_door1.dds\",\"gta_int.img/ab_sfammumain.txd/gun_door1.dds\",\n \"gta_int.img/vegas_munation.txd/gun_door1.dds\",\"gta_int.img/ab_sfammumain.txd/gun_door1.dds\",\n \"gta_int.img/ammu_twofloor.txd/breezewall.dds\",\"gta_int.img/ab_sfammumain.txd/breezewall.dds\",\n \"gta_int.img/genintintpoliceb.txd/breezewall.dds\",\"gta_int.img/ab_sfammumain.txd/breezewall.dds\",\n \"gta_int.img/gen_munation.txd/breezewall.dds\",\"gta_int.img/ab_sfammumain.txd/breezewall.dds\",\n \"gta_int.img/gen_offtrackint.txd/breezewall.dds\",\"gta_int.img/ab_sfammumain.txd/breezewall.dds\",\n \"gta_int.img/int_zerosrca.txd/breezewall.dds\",\"gta_int.img/ab_sfammumain.txd/breezewall.dds\",\n \"gta_int.img/munation1.txd/breezewall.dds\",\"gta_int.img/ab_sfammumain.txd/breezewall.dds\",\n \"gta_int.img/papaerchaseoffice.txd/breezewall.dds\",\"gta_int.img/ab_sfammumain.txd/breezewall.dds\",\n \"gta_int.img/range_main.txd/breezewall.dds\",\"gta_int.img/ab_sfammumain.txd/breezewall.dds\",\n \"gta_int.img/vegas_munation.txd/breezewall.dds\",\"gta_int.img/ab_sfammumain.txd/breezewall.dds\",\n \"gta_int.img/ab_sfammuunits.txd/plywood_gym.dds\",\"gta_int.img/ab_sfammumain.txd/plywood_gym.dds\",\n \"gta_int.img/ammu_twofloor.txd/plywood_gym.dds\",\"gta_int.img/ab_sfammumain.txd/plywood_gym.dds\",\n \"gta_int.img/munation1.txd/plywood_gym.dds\",\"gta_int.img/ab_sfammumain.txd/plywood_gym.dds\",\n \"gta_int.img/range_main.txd/plywood_gym.dds\",\"gta_int.img/ab_sfammumain.txd/plywood_gym.dds\",\n \"gta_int.img/vegas_munation.txd/plywood_gym.dds\",\"gta_int.img/ab_sfammumain.txd/plywood_gym.dds\",\n \"gta_int.img/ammu_twofloor.txd/gun_floor2.dds\",\"gta_int.img/ab_sfammumain.txd/gun_floor2.dds\",\n \"gta_int.img/munation1.txd/gun_floor2.dds\",\"gta_int.img/ab_sfammumain.txd/gun_floor2.dds\",\n \"gta_int.img/ammu_2flrprops.txd/gun_blackbox.dds\",\"gta_int.img/ab_sfammuunits.txd/gun_blackbox.dds\",\n \"gta_int.img/range_xtras2.txd/gun_blackbox.dds\",\"gta_int.img/ab_sfammuunits.txd/gun_blackbox.dds\",\n \"gta_int.img/vg_xtras1.txd/gun_blackbox.dds\",\"gta_int.img/ab_sfammuunits.txd/gun_blackbox.dds\",\n \"gta_int.img/ammu_2flrprops.txd/rubber_mat.dds\",\"gta_int.img/ab_sfammuunits.txd/rubber_mat.dds\",\n \"gta_int.img/range_xtras2.txd/rubber_mat.dds\",\"gta_int.img/ab_sfammuunits.txd/rubber_mat.dds\",\n \"gta_int.img/vg_xtras1.txd/rubber_mat.dds\",\"gta_int.img/ab_sfammuunits.txd/rubber_mat.dds\",\n \"gta_int.img/ammu_2flrprops.txd/gun_divider2.dds\",\"gta_int.img/ab_sfammuunits.txd/gun_divider2.dds\",\n \"gta_int.img/range_xtras2.txd/gun_divider2.dds\",\"gta_int.img/ab_sfammuunits.txd/gun_divider2.dds\",\n \"gta_int.img/vg_xtras1.txd/gun_divider2.dds\",\"gta_int.img/ab_sfammuunits.txd/gun_divider2.dds\",\n \"gta_int.img/ab_sfgymbits01.txd/knot_wood128.dds\",\"gta_int.img/ab_sfgymbeams.txd/knot_wood128.dds\",\n \"gta_int.img/ab_sfgymmain.txd/knot_wood128.dds\",\"gta_int.img/ab_sfgymbeams.txd/knot_wood128.dds\",\n \"gta_int.img/ab_trukstpa.txd/knot_wood128.dds\",\"gta_int.img/ab_sfgymbeams.txd/knot_wood128.dds\",\n \"gta_int.img/ab_trukstpd.txd/knot_wood128.dds\",\"gta_int.img/ab_sfgymbeams.txd/knot_wood128.dds\",\n \"gta_int.img/kickstart.txd/knot_wood128.dds\",\"gta_int.img/ab_sfgymbeams.txd/knot_wood128.dds\",\n \"gta_int.img/stad_tag.txd/knot_wood128.dds\",\"gta_int.img/ab_sfgymbeams.txd/knot_wood128.dds\",\n \"gta_int.img/ab_sfgymmain.txd/gym_floor5.dds\",\"gta_int.img/ab_sfgymbeams.txd/gym_floor5.dds\",\n \"gta_int.img/genintint2_gym.txd/gym_floor5.dds\",\"gta_int.img/ab_sfgymbeams.txd/gym_floor5.dds\",\n \"gta_int.img/lasmall1int2.txd/gym_floor5.dds\",\"gta_int.img/ab_sfgymbeams.txd/gym_floor5.dds\",\n \"gta_int.img/lasmallsave.txd/gym_floor5.dds\",\"gta_int.img/ab_sfgymbeams.txd/gym_floor5.dds\",\n \"gta_int.img/pdomebar.txd/gym_floor5.dds\",\"gta_int.img/ab_sfgymbeams.txd/gym_floor5.dds\",\n \"gta_int.img/pleas_dome.txd/gym_floor5.dds\",\"gta_int.img/ab_sfgymbeams.txd/gym_floor5.dds\",\n \"gta_int.img/straps_int.txd/gym_floor5.dds\",\"gta_int.img/ab_sfgymbeams.txd/gym_floor5.dds\",\n \"gta_int.img/ab_sfgymbits02.txd/ab_rollmat01.dds\",\"gta_int.img/ab_sfgymbits01.txd/ab_rollmat01.dds\",\n \"gta_int.img/genintint_gym.txd/ab_rollmat01.dds\",\"gta_int.img/ab_sfgymbits01.txd/ab_rollmat01.dds\",\n \"gta_int.img/ab_vegasgymbits01.txd/lockers.dds\",\"gta_int.img/ab_sfgymbits01.txd/lockers.dds\",\n \"gta_int.img/ab_vgsgymbits01.txd/lockers.dds\",\"gta_int.img/ab_sfgymbits01.txd/lockers.dds\",\n \"gta_int.img/genintintpoliceb.txd/lockers.dds\",\"gta_int.img/ab_sfgymbits01.txd/lockers.dds\",\n \"gta_int.img/intring_gymint3.txd/lockers.dds\",\"gta_int.img/ab_sfgymbits01.txd/lockers.dds\",\n \"gta_int.img/genintint_gym.txd/ab_rollmat02.dds\",\"gta_int.img/ab_sfgymbits02.txd/ab_rollmat02.dds\",\n \"gta_int.img/ab_vegasgymmain.txd/gymwinodow3.dds\",\"gta_int.img/ab_sfgymmain.txd/gymwinodow3.dds\",\n \"gta_int.img/dogsgym.txd/gymwinodow3.dds\",\"gta_int.img/ab_sfgymmain.txd/gymwinodow3.dds\",\n \"gta_int.img/genintint2_gym.txd/gymwinodow3.dds\",\"gta_int.img/ab_sfgymmain.txd/gymwinodow3.dds\",\n \"gta_int.img/ab_wooziea.txd/ab_wood02.dds\",\"gta_int.img/ab_sfgymmain.txd/ab_wood02.dds\",\n \"gta_int.img/ab_woozieb.txd/ab_wood02.dds\",\"gta_int.img/ab_sfgymmain.txd/ab_wood02.dds\",\n \"gta_int.img/ab_wooziec.txd/ab_wood02.dds\",\"gta_int.img/ab_sfgymmain.txd/ab_wood02.dds\",\n \"gta_int.img/gf4.txd/gym_floor6.dds\",\"gta_int.img/ab_sfgymmain.txd/gym_floor6.dds\",\n \"gta_int.img/sfhsm1.txd/gun_ceiling2_128.dds\",\"gta_int.img/ab_sfgymmain.txd/gun_ceiling2_128.dds\",\n \"gta_int.img/svlamid.txd/gun_ceiling2_128.dds\",\"gta_int.img/ab_sfgymmain.txd/gun_ceiling2_128.dds\",\n \"gta_int.img/ab_vegasgymmain.txd/cbchallenge_256.dds\",\"gta_int.img/ab_sfgymmain.txd/cbchallenge_256.dds\",\n \"gta_int.img/genintint2_gym.txd/cbchallenge_256.dds\",\"gta_int.img/ab_sfgymmain.txd/cbchallenge_256.dds\",\n \"gta_int.img/burg_furn.txd/cj_wood1(edge).dds\",\"gta_int.img/ab_trukstpa.txd/cj_wood1(edge).dds\",\n \"gta_int.img/cj_ammun_extra.txd/cj_wood1(edge).dds\",\"gta_int.img/ab_trukstpa.txd/cj_wood1(edge).dds\",\n \"gta_int.img/cj_barb2.txd/cj_wood1(edge).dds\",\"gta_int.img/ab_trukstpa.txd/cj_wood1(edge).dds\",\n \"gta_int.img/cj_bed_furn.txd/cj_wood1(edge).dds\",\"gta_int.img/ab_trukstpa.txd/cj_wood1(edge).dds\",\n \"gta_int.img/cj_binc.txd/cj_wood1(edge).dds\",\"gta_int.img/ab_trukstpa.txd/cj_wood1(edge).dds\",\n \"gta_int.img/cj_change_room.txd/cj_wood1(edge).dds\",\"gta_int.img/ab_trukstpa.txd/cj_wood1(edge).dds\",\n \"gta_int.img/cj_ds_door.txd/cj_wood1(edge).dds\",\"gta_int.img/ab_trukstpa.txd/cj_wood1(edge).dds\",\n \"gta_int.img/cj_furniture.txd/cj_wood1(edge).dds\",\"gta_int.img/ab_trukstpa.txd/cj_wood1(edge).dds\",\n \"gta_int.img/cj_gash.txd/cj_wood1(edge).dds\",\"gta_int.img/ab_trukstpa.txd/cj_wood1(edge).dds\",\n \"gta_int.img/cj_hi_fi2.txd/cj_wood1(edge).dds\",\"gta_int.img/ab_trukstpa.txd/cj_wood1(edge).dds\",\n \"gta_int.img/cj_hotel_sw.txd/cj_wood1(edge).dds\",\"gta_int.img/ab_trukstpa.txd/cj_wood1(edge).dds\",\n \"gta_int.img/cj_hotel.txd/cj_wood1(edge).dds\",\"gta_int.img/ab_trukstpa.txd/cj_wood1(edge).dds\",\n \"gta_int.img/cj_kitchen.txd/cj_wood1(edge).dds\",\"gta_int.img/ab_trukstpa.txd/cj_wood1(edge).dds\",\n \"gta_int.img/cj_med_beds.txd/cj_wood1(edge).dds\",\"gta_int.img/ab_trukstpa.txd/cj_wood1(edge).dds\",\n \"gta_int.img/cj_pro.txd/cj_wood1(edge).dds\",\"gta_int.img/ab_trukstpa.txd/cj_wood1(edge).dds\",\n \"gta_int.img/cj_s_beds.txd/cj_wood1(edge).dds\",\"gta_int.img/ab_trukstpa.txd/cj_wood1(edge).dds\",\n \"gta_int.img/cj_sex.txd/cj_wood1(edge).dds\",\"gta_int.img/ab_trukstpa.txd/cj_wood1(edge).dds\",\n \"gta_int.img/cj_urb.txd/cj_wood1(edge).dds\",\"gta_int.img/ab_trukstpa.txd/cj_wood1(edge).dds\",\n \"gta_int.img/gap.txd/cj_wood1(edge).dds\",\"gta_int.img/ab_trukstpa.txd/cj_wood1(edge).dds\",\n \"gta_int.img/genintclothessport.txd/cj_wood1(edge).dds\",\"gta_int.img/ab_trukstpa.txd/cj_wood1(edge).dds\",\n \"gta_int.img/gf2.txd/cj_wood1(edge).dds\",\"gta_int.img/ab_trukstpa.txd/cj_wood1(edge).dds\",\n \"gta_int.img/int_zerosrca.txd/cj_wood1(edge).dds\",\"gta_int.img/ab_trukstpa.txd/cj_wood1(edge).dds\",\n \"gta_int.img/pizza_furn.txd/cj_wood1(edge).dds\",\"gta_int.img/ab_trukstpa.txd/cj_wood1(edge).dds\",\n \"gta_int.img/rc_shop.txd/cj_wood1(edge).dds\",\"gta_int.img/ab_trukstpa.txd/cj_wood1(edge).dds\",\n \"gta_int.img/sexdetail.txd/cj_wood1(edge).dds\",\"gta_int.img/ab_trukstpa.txd/cj_wood1(edge).dds\",\n \"gta_int.img/shopping.txd/cj_wood1(edge).dds\",\"gta_int.img/ab_trukstpa.txd/cj_wood1(edge).dds\",\n \"gta_int.img/vegassavesmal.txd/cj_wood1(edge).dds\",\"gta_int.img/ab_trukstpa.txd/cj_wood1(edge).dds\",\n \"gta_int.img/whore_furn.txd/cj_wood1(edge).dds\",\"gta_int.img/ab_trukstpa.txd/cj_wood1(edge).dds\",\n \"gta_int.img/pizza_furn.txd/cj_cord.dds\",\"gta_int.img/ab_trukstpa.txd/cj_cord.dds\",\n \"gta_int.img/genintintbarbera.txd/barberswindo.dds\",\"gta_int.img/ab_trukstpa.txd/barberswindo.dds\",\n \"gta_int.img/int_cutbar3.txd/barberswindo.dds\",\"gta_int.img/ab_trukstpa.txd/barberswindo.dds\",\n \"gta_int.img/gf2.txd/bbar_door1.dds\",\"gta_int.img/ab_trukstpa.txd/bbar_door1.dds\",\n \"gta_int.img/gamingtble.txd/wood01.dds\",\"gta_int.img/ab_trukstpa.txd/wood01.dds\",\n \"gta_int.img/ab_trukstpb.txd/diner_tbl3.dds\",\"gta_int.img/ab_trukstpa.txd/diner_tbl3.dds\",\n \"gta_int.img/dinerseat3.txd/diner_tbl3.dds\",\"gta_int.img/ab_trukstpa.txd/diner_tbl3.dds\",\n \"gta_int.img/dinerseat3.txd/diner_seat3.dds\",\"gta_int.img/ab_trukstpb.txd/diner_seat3.dds\",\n \"gta_int.img/dinerseat1.txd/mustard.dds\",\"gta_int.img/ab_trukstpb.txd/mustard.dds\",\n \"gta_int.img/dinerseat3.txd/mustard.dds\",\"gta_int.img/ab_trukstpb.txd/mustard.dds\",\n \"gta_int.img/genintintfasta.txd/mustard.dds\",\"gta_int.img/ab_trukstpb.txd/mustard.dds\",\n \"gta_int.img/genintintfastc.txd/mustard.dds\",\"gta_int.img/ab_trukstpb.txd/mustard.dds\",\n \"gta_int.img/genintintfastd.txd/mustard.dds\",\"gta_int.img/ab_trukstpb.txd/mustard.dds\",\n \"gta_int.img/genintsmlrst_split.txd/mustard.dds\",\"gta_int.img/ab_trukstpb.txd/mustard.dds\",\n \"gta_int.img/mp_diner2.txd/mustard.dds\",\"gta_int.img/ab_trukstpb.txd/mustard.dds\",\n \"gta_int.img/burger_tray.txd/ketchup.dds\",\"gta_int.img/ab_trukstpb.txd/ketchup.dds\",\n \"gta_int.img/dinerseat1.txd/ketchup.dds\",\"gta_int.img/ab_trukstpb.txd/ketchup.dds\",\n \"gta_int.img/dinerseat3.txd/ketchup.dds\",\"gta_int.img/ab_trukstpb.txd/ketchup.dds\",\n \"gta_int.img/genintintfasta.txd/ketchup.dds\",\"gta_int.img/ab_trukstpb.txd/ketchup.dds\",\n \"gta_int.img/genintintfastc.txd/ketchup.dds\",\"gta_int.img/ab_trukstpb.txd/ketchup.dds\",\n \"gta_int.img/genintintfastd.txd/ketchup.dds\",\"gta_int.img/ab_trukstpb.txd/ketchup.dds\",\n \"gta_int.img/genintsmlrst_split.txd/ketchup.dds\",\"gta_int.img/ab_trukstpb.txd/ketchup.dds\",\n \"gta_int.img/lee_bdupsflat.txd/ketchup.dds\",\"gta_int.img/ab_trukstpb.txd/ketchup.dds\",\n \"gta_int.img/mp_diner2.txd/ketchup.dds\",\"gta_int.img/ab_trukstpb.txd/ketchup.dds\",\n \"gta_int.img/proc_rub.txd/ketchup.dds\",\"gta_int.img/ab_trukstpb.txd/ketchup.dds\",\n \"gta_int.img/ryfurn2.txd/ketchup.dds\",\"gta_int.img/ab_trukstpb.txd/ketchup.dds\",\n \"gta_int.img/dinerseat1.txd/napkin_disp.dds\",\"gta_int.img/ab_trukstpb.txd/napkin_disp.dds\",\n \"gta_int.img/dinerseat3.txd/napkin_disp.dds\",\"gta_int.img/ab_trukstpb.txd/napkin_disp.dds\",\n \"gta_int.img/genintintfasta.txd/napkin_disp.dds\",\"gta_int.img/ab_trukstpb.txd/napkin_disp.dds\",\n \"gta_int.img/genintintfastc.txd/napkin_disp.dds\",\"gta_int.img/ab_trukstpb.txd/napkin_disp.dds\",\n \"gta_int.img/genintintfastd.txd/napkin_disp.dds\",\"gta_int.img/ab_trukstpb.txd/napkin_disp.dds\",\n \"gta_int.img/genintsmlrst_split.txd/napkin_disp.dds\",\"gta_int.img/ab_trukstpb.txd/napkin_disp.dds\",\n \"gta_int.img/mp_diner2.txd/napkin_disp.dds\",\"gta_int.img/ab_trukstpb.txd/napkin_disp.dds\",\n \"gta_int.img/dinerseat1.txd/met_supp.dds\",\"gta_int.img/ab_trukstpb.txd/met_supp.dds\",\n \"gta_int.img/dinerseat2.txd/met_supp.dds\",\"gta_int.img/ab_trukstpb.txd/met_supp.dds\",\n \"gta_int.img/dinerseat3.txd/met_supp.dds\",\"gta_int.img/ab_trukstpb.txd/met_supp.dds\",\n \"gta_int.img/genintintfastb.txd/met_supp.dds\",\"gta_int.img/ab_trukstpb.txd/met_supp.dds\",\n \"gta_int.img/cj_seating.txd/bras_base.dds\",\"gta_int.img/ab_trukstpc.txd/bras_base.dds\",\n \"gta_int.img/dinerseat3b.txd/bras_base.dds\",\"gta_int.img/ab_trukstpc.txd/bras_base.dds\",\n \"gta_int.img/lring_gmint3.txd/bras_base.dds\",\"gta_int.img/ab_trukstpc.txd/bras_base.dds\",\n \"gta_int.img/l_vggybox.txd/bras_base.dds\",\"gta_int.img/ab_trukstpc.txd/bras_base.dds\",\n \"gta_int.img/cj_bar2.txd/bbar_signs1.dds\",\"gta_int.img/ab_trukstpe.txd/bbar_signs1.dds\",\n \"gta_int.img/cj_bar2.txd/bbar_plates2.dds\",\"gta_int.img/ab_trukstpe.txd/bbar_plates2.dds\",\n \"gta_int.img/ab_vgsgymbits01.txd/bbar_wall2.dds\",\"gta_int.img/ab_vegasgymbits01.txd/bbar_wall2.dds\",\n \"gta_int.img/l_vggybox.txd/bbar_wall2.dds\",\"gta_int.img/ab_vegasgymbits01.txd/bbar_wall2.dds\",\n \"gta_int.img/dogsgym.txd/gym_pipes.dds\",\"gta_int.img/ab_vegasgymmain.txd/gym_pipes.dds\",\n \"gta_int.img/genintint2_gym.txd/gym_pipes.dds\",\"gta_int.img/ab_vegasgymmain.txd/gym_pipes.dds\",\n \"gta_int.img/dogsgym.txd/mp_cj_sheet2.dds\",\"gta_int.img/ab_vegasgymmain.txd/mp_cj_sheet2.dds\",\n \"gta_int.img/ab_vgsgymbits01.txd/bbar_wall3.dds\",\"gta_int.img/ab_vegasgymmain.txd/bbar_wall3.dds\",\n \"gta_int.img/dogsgym.txd/bbar_wall3.dds\",\"gta_int.img/ab_vegasgymmain.txd/bbar_wall3.dds\",\n \"gta_int.img/dogsgym.txd/gym_rope.dds\",\"gta_int.img/ab_vegasgymmain.txd/gym_rope.dds\",\n \"gta_int.img/intring_gymint3.txd/gym_rope.dds\",\"gta_int.img/ab_vegasgymmain.txd/gym_rope.dds\",\n \"gta_int.img/casino_props.txd/tubelite.dds\",\"gta_int.img/ab_veg.txd/tubelite.dds\",\n \"gta_int.img/casmafbar.txd/tubelite.dds\",\"gta_int.img/ab_veg.txd/tubelite.dds\",\n \"gta_int.img/cj_bandit.txd/tubelite.dds\",\"gta_int.img/ab_veg.txd/tubelite.dds\",\n \"gta_int.img/casmafbar.txd/ab_slotbase.dds\",\"gta_int.img/ab_veg.txd/ab_slotbase.dds\",\n \"gta_int.img/cj_bandit.txd/ab_slotbase.dds\",\"gta_int.img/ab_veg.txd/ab_slotbase.dds\",\n \"gta_int.img/ab_wooziec.txd/ab_fabricred.dds\",\"gta_int.img/ab_wooziea.txd/ab_fabricred.dds\",\n \"gta_int.img/mafcasmain.txd/walp72s.dds\",\"gta_int.img/ab_wooziea.txd/walp72s.dds\",\n \"gta_int.img/mafiacasino01.txd/walp72s.dds\",\"gta_int.img/ab_wooziea.txd/walp72s.dds\",\n \"gta_int.img/bikeskool.txd/light_full.dds\",\"gta_int.img/ab_wooziea.txd/light_full.dds\",\n \"gta_int.img/papaerchaseoffice.txd/light_full.dds\",\"gta_int.img/ab_wooziea.txd/light_full.dds\",\n \"gta_int.img/sweetshall.txd/mcstraps_window.dds\",\"gta_int.img/ab_wooziea.txd/mcstraps_window.dds\",\n \"gta_int.img/sweetsmain.txd/mcstraps_window.dds\",\"gta_int.img/ab_wooziea.txd/mcstraps_window.dds\",\n \"gta_int.img/gen_offtrackint.txd/golf_secgates1.dds\",\"gta_int.img/ab_woozieb.txd/golf_secgates1.dds\",\n \"gta_int.img/gen_offtrackint.txd/otb_signs.dds\",\"gta_int.img/ab_woozieb.txd/otb_signs.dds\",\n \"gta_int.img/gen_offtrackint.txd/ap_screens1.dds\",\"gta_int.img/ab_woozieb.txd/ap_screens1.dds\",\n \"gta_int.img/otb_machine.txd/ap_screens1.dds\",\"gta_int.img/ab_woozieb.txd/ap_screens1.dds\",\n \"gta_int.img/gen_offtrackint.txd/otb_mach1.dds\",\"gta_int.img/ab_woozieb.txd/otb_mach1.dds\",\n \"gta_int.img/newcrak.txd/ab_wallpaper01.dds\",\"gta_int.img/ab_wooziec.txd/ab_wallpaper01.dds\",\n \"gta_int.img/sfhss2.txd/ab_wallpaper01.dds\",\"gta_int.img/ab_wooziec.txd/ab_wallpaper01.dds\",\n \"gta_int.img/carls_kit2.txd/sink1.dds\",\"gta_int.img/ab_wooziec.txd/sink1.dds\",\n \"gta_int.img/kit3hghg.txd/sink1.dds\",\"gta_int.img/ab_wooziec.txd/sink1.dds\",\n \"gta_int.img/lasmall2int2.txd/sink1.dds\",\"gta_int.img/ab_wooziec.txd/sink1.dds\",\n \"gta_int.img/sweetsmain.txd/sink1.dds\",\"gta_int.img/ab_wooziec.txd/sink1.dds\",\n \"gta_int.img/tr_kb_bits.txd/sink1.dds\",\"gta_int.img/ab_wooziec.txd/sink1.dds\",\n \"gta_int.img/sweetsmain.txd/wall4.dds\",\"gta_int.img/ab_wooziec.txd/wall4.dds\",\n \"gta_int.img/cj_chris.txd/cj_bandedmetal.dds\",\"gta_int.img/airp_prop.txd/cj_bandedmetal.dds\",\n \"gta_int.img/skate_shop.txd/cj_bandedmetal.dds\",\"gta_int.img/airp_prop.txd/cj_bandedmetal.dds\",\n \"gta_int.img/cj_ff_acc1.txd/cj_till2.dds\",\"gta_int.img/airp_prop.txd/cj_till2.dds\",\n \"gta_int.img/burg_furn.txd/cj_red_counter.dds\",\"gta_int.img/airp_prop.txd/cj_red_counter.dds\",\n \"gta_int.img/cb_details.txd/cj_red_counter.dds\",\"gta_int.img/airp_prop.txd/cj_red_counter.dds\",\n \"gta_int.img/cj_ff_counters.txd/cj_red_counter.dds\",\"gta_int.img/airp_prop.txd/cj_red_counter.dds\",\n \"gta_int.img/cj_hi_fi2.txd/cj_red_counter.dds\",\"gta_int.img/airp_prop.txd/cj_red_counter.dds\",\n \"gta_int.img/genintintfastb2.txd/cj_red_counter.dds\",\"gta_int.img/airp_prop.txd/cj_red_counter.dds\",\n \"gta_int.img/pizza_furn.txd/cj_red_counter.dds\",\"gta_int.img/airp_prop.txd/cj_red_counter.dds\",\n \"gta_int.img/gen_mun_xtars2.txd/mp_gun_man1.dds\",\"gta_int.img/ammounique.txd/mp_gun_man1.dds\",\n \"gta_int.img/posters.txd/mp_gun_man1.dds\",\"gta_int.img/ammounique.txd/mp_gun_man1.dds\",\n \"gta_int.img/cj_ammun_extra.txd/gun_xtra4.dds\",\"gta_int.img/ammu_2flrprops.txd/gun_xtra4.dds\",\n \"gta_int.img/cj_ammun_extra.txd/gun_target3.dds\",\"gta_int.img/ammu_2flrprops.txd/gun_target3.dds\",\n \"gta_int.img/posters.txd/gun_target3.dds\",\"gta_int.img/ammu_2flrprops.txd/gun_target3.dds\",\n \"gta_int.img/cj_ammun_extra.txd/gun_target2.dds\",\"gta_int.img/ammu_2flrprops.txd/gun_target2.dds\",\n \"gta_int.img/posters.txd/gun_target2.dds\",\"gta_int.img/ammu_2flrprops.txd/gun_target2.dds\",\n \"gta_int.img/cj_ammun_extra.txd/gun_target1.dds\",\"gta_int.img/ammu_2flrprops.txd/gun_target1.dds\",\n \"gta_int.img/posters.txd/gun_target1.dds\",\"gta_int.img/ammu_2flrprops.txd/gun_target1.dds\",\n \"gta_int.img/cj_ammun_extra.txd/ammu_boots3.dds\",\"gta_int.img/ammu_2flrprops.txd/ammu_boots3.dds\",\n \"gta_int.img/munation_xtras2.txd/ammu_boots3.dds\",\"gta_int.img/ammu_2flrprops.txd/ammu_boots3.dds\",\n \"gta_int.img/munation_xtras2.txd/ammu_hats.dds\",\"gta_int.img/ammu_2flrprops.txd/ammu_hats.dds\",\n \"gta_int.img/vegas_munation.txd/gun_bacboard.dds\",\"gta_int.img/ammu_twofloor.txd/gun_bacboard.dds\",\n \"gta_int.img/carter_block_2.txd/mp_gun_stairs.dds\",\"gta_int.img/ammu_twofloor.txd/mp_gun_stairs.dds\",\n \"gta_int.img/carter_block.txd/mp_gun_stairs.dds\",\"gta_int.img/ammu_twofloor.txd/mp_gun_stairs.dds\",\n \"gta_int.img/munation1.txd/gun_windo.dds\",\"gta_int.img/ammu_twofloor.txd/gun_windo.dds\",\n \"gta_int.img/range_main.txd/gun_windo.dds\",\"gta_int.img/ammu_twofloor.txd/gun_windo.dds\",\n \"gta_int.img/vegas_munation.txd/gun_windo.dds\",\"gta_int.img/ammu_twofloor.txd/gun_windo.dds\",\n \"gta_int.img/gen_munation.txd/gun_ceiling2.dds\",\"gta_int.img/ammu_twofloor.txd/gun_ceiling2.dds\",\n \"gta_int.img/mafiacasinovault01.txd/gun_ceiling2.dds\",\"gta_int.img/ammu_twofloor.txd/gun_ceiling2.dds\",\n \"gta_int.img/range_main.txd/gun_ceiling2.dds\",\"gta_int.img/ammu_twofloor.txd/gun_ceiling2.dds\",\n \"gta_int.img/vegas_munation.txd/gun_ceiling2.dds\",\"gta_int.img/ammu_twofloor.txd/gun_ceiling2.dds\",\n \"gta_int.img/cj_ammun_extra.txd/cj_back_board.dds\",\"gta_int.img/ammu_twofloor.txd/cj_back_board.dds\",\n \"gta_int.img/cj_sex.txd/cj_back_board.dds\",\"gta_int.img/ammu_twofloor.txd/cj_back_board.dds\",\n \"gta_int.img/gen_munation.txd/cj_back_board.dds\",\"gta_int.img/ammu_twofloor.txd/cj_back_board.dds\",\n \"gta_int.img/munation1.txd/cj_back_board.dds\",\"gta_int.img/ammu_twofloor.txd/cj_back_board.dds\",\n \"gta_int.img/rc_shop.txd/cj_back_board.dds\",\"gta_int.img/ammu_twofloor.txd/cj_back_board.dds\",\n \"gta_int.img/scummy.txd/cj_back_board.dds\",\"gta_int.img/ammu_twofloor.txd/cj_back_board.dds\",\n \"gta_int.img/skate_shop.txd/cj_back_board.dds\",\"gta_int.img/ammu_twofloor.txd/cj_back_board.dds\",\n \"gta_int.img/sport_cloth.txd/cj_back_board.dds\",\"gta_int.img/ammu_twofloor.txd/cj_back_board.dds\",\n \"gta_int.img/vegas_munation.txd/cj_back_board.dds\",\"gta_int.img/ammu_twofloor.txd/cj_back_board.dds\",\n \"gta_int.img/sports.txd/basketball2.dds\",\"gta_int.img/bball1.txd/basketball2.dds\",\n \"gta_int.img/crlsbits.txd/sideboard1.dds\",\"gta_int.img/bdcabinets.txd/sideboard1.dds\",\n \"gta_int.img/genhotelsave.txd/sideboard1.dds\",\"gta_int.img/bdcabinets.txd/sideboard1.dds\",\n \"gta_int.img/immy_furn.txd/sideboard1.dds\",\"gta_int.img/bdcabinets.txd/sideboard1.dds\",\n \"gta_int.img/labits.txd/sideboard1.dds\",\"gta_int.img/bdcabinets.txd/sideboard1.dds\",\n \"gta_int.img/savegenmotel.txd/sideboard1.dds\",\"gta_int.img/bdcabinets.txd/sideboard1.dds\",\n \"gta_int.img/sweets_roon.txd/sideboard1.dds\",\"gta_int.img/bdcabinets.txd/sideboard1.dds\",\n \"gta_int.img/vegassavesmal.txd/sideboard1.dds\",\"gta_int.img/bdcabinets.txd/sideboard1.dds\",\n \"gta_int.img/lee_bdupsflat.txd/bdup_caps.dds\",\"gta_int.img/bdupsfurn.txd/bdup_caps.dds\",\n \"gta_int.img/lee_bdupsflat.txd/bdup_pills.dds\",\"gta_int.img/bdupsfurn.txd/bdup_pills.dds\",\n \"gta_int.img/lee_bdupsflat.txd/bdup_crackpipe.dds\",\"gta_int.img/bdupsfurn.txd/bdup_crackpipe.dds\",\n \"gta_int.img/lee_bdupsflat.txd/bdup_crack.dds\",\"gta_int.img/bdupsfurn.txd/bdup_crack.dds\",\n \"gta_int.img/lee_bdupsflat.txd/bdup_ashtray.dds\",\"gta_int.img/bdupsfurn.txd/bdup_ashtray.dds\",\n \"gta_int.img/lee_studhall.txd/blacksofa01.dds\",\"gta_int.img/bdupsfurn.txd/blacksofa01.dds\",\n \"gta_int.img/whore_rms.txd/bdup2_plantstalk.dds\",\"gta_int.img/bdupsnew.txd/bdup2_plantstalk.dds\",\n \"gta_int.img/whore_rms.txd/bdup2_plant.dds\",\"gta_int.img/bdupsnew.txd/bdup2_plant.dds\",\n \"gta_int.img/dr_gsnew.txd/windo_blinds.dds\",\"gta_int.img/bigsfsave.txd/windo_blinds.dds\",\n \"gta_int.img/gf2.txd/windo_blinds.dds\",\"gta_int.img/bigsfsave.txd/windo_blinds.dds\",\n \"gta_int.img/gf4.txd/windo_blinds.dds\",\"gta_int.img/bigsfsave.txd/windo_blinds.dds\",\n \"gta_int.img/labig1int2.txd/windo_blinds.dds\",\"gta_int.img/bigsfsave.txd/windo_blinds.dds\",\n \"gta_int.img/labig2int2.txd/windo_blinds.dds\",\"gta_int.img/bigsfsave.txd/windo_blinds.dds\",\n \"gta_int.img/labig3int2.txd/windo_blinds.dds\",\"gta_int.img/bigsfsave.txd/windo_blinds.dds\",\n \"gta_int.img/labigsave.txd/windo_blinds.dds\",\"gta_int.img/bigsfsave.txd/windo_blinds.dds\",\n \"gta_int.img/masmall3int2.txd/windo_blinds.dds\",\"gta_int.img/bigsfsave.txd/windo_blinds.dds\",\n \"gta_int.img/savesfmid.txd/windo_blinds.dds\",\"gta_int.img/bigsfsave.txd/windo_blinds.dds\",\n \"gta_int.img/sfhosemed2.txd/windo_blinds.dds\",\"gta_int.img/bigsfsave.txd/windo_blinds.dds\",\n \"gta_int.img/sfhsb3.txd/windo_blinds.dds\",\"gta_int.img/bigsfsave.txd/windo_blinds.dds\",\n \"gta_int.img/sfhsm2.txd/windo_blinds.dds\",\"gta_int.img/bigsfsave.txd/windo_blinds.dds\",\n \"gta_int.img/sfhsmedium1.txd/windo_blinds.dds\",\"gta_int.img/bigsfsave.txd/windo_blinds.dds\",\n \"gta_int.img/sfmansion1.txd/windo_blinds.dds\",\"gta_int.img/bigsfsave.txd/windo_blinds.dds\",\n \"gta_int.img/svsfsm.txd/windo_blinds.dds\",\"gta_int.img/bigsfsave.txd/windo_blinds.dds\",\n \"gta_int.img/svvgmid.txd/windo_blinds.dds\",\"gta_int.img/bigsfsave.txd/windo_blinds.dds\",\n \"gta_int.img/vghotelnice.txd/windo_blinds.dds\",\"gta_int.img/bigsfsave.txd/windo_blinds.dds\",\n \"gta_int.img/vghsb3int2.txd/windo_blinds.dds\",\"gta_int.img/bigsfsave.txd/windo_blinds.dds\",\n \"gta_int.img/vgshm2int2.txd/windo_blinds.dds\",\"gta_int.img/bigsfsave.txd/windo_blinds.dds\",\n \"gta_int.img/vgshm3int2.txd/windo_blinds.dds\",\"gta_int.img/bigsfsave.txd/windo_blinds.dds\",\n \"gta_int.img/savegenmotel.txd/ah_wrnplnks.dds\",\"gta_int.img/bigsfsave.txd/ah_wrnplnks.dds\",\n \"gta_int.img/svcunthoose.txd/ah_wrnplnks.dds\",\"gta_int.img/bigsfsave.txd/ah_wrnplnks.dds\",\n \"gta_int.img/svlamid.txd/ah_skt5.dds\",\"gta_int.img/bigsfsave.txd/ah_skt5.dds\",\n \"gta_int.img/vghotelnice.txd/ah_skt5.dds\",\"gta_int.img/bigsfsave.txd/ah_skt5.dds\",\n \"gta_int.img/carlslounge.txd/ah_utilbor1.dds\",\"gta_int.img/bigsfsave.txd/ah_utilbor1.dds\",\n \"gta_int.img/cj_change_room.txd/ah_utilbor1.dds\",\"gta_int.img/bigsfsave.txd/ah_utilbor1.dds\",\n \"gta_int.img/labigsave.txd/ah_utilbor1.dds\",\"gta_int.img/bigsfsave.txd/ah_utilbor1.dds\",\n \"gta_int.img/savesfmid.txd/ah_utilbor1.dds\",\"gta_int.img/bigsfsave.txd/ah_utilbor1.dds\",\n \"gta_int.img/sfhsb3.txd/ah_utilbor1.dds\",\"gta_int.img/bigsfsave.txd/ah_utilbor1.dds\",\n \"gta_int.img/sfhsm2.txd/ah_utilbor1.dds\",\"gta_int.img/bigsfsave.txd/ah_utilbor1.dds\",\n \"gta_int.img/sfhsmedium1.txd/ah_utilbor1.dds\",\"gta_int.img/bigsfsave.txd/ah_utilbor1.dds\",\n \"gta_int.img/sfmansion1.txd/ah_utilbor1.dds\",\"gta_int.img/bigsfsave.txd/ah_utilbor1.dds\",\n \"gta_int.img/svcunthoose.txd/ah_utilbor1.dds\",\"gta_int.img/bigsfsave.txd/ah_utilbor1.dds\",\n \"gta_int.img/svlamid.txd/ah_utilbor1.dds\",\"gta_int.img/bigsfsave.txd/ah_utilbor1.dds\",\n \"gta_int.img/svvgmid.txd/ah_utilbor1.dds\",\"gta_int.img/bigsfsave.txd/ah_utilbor1.dds\",\n \"gta_int.img/vghotelnice.txd/ah_utilbor1.dds\",\"gta_int.img/bigsfsave.txd/ah_utilbor1.dds\",\n \"gta_int.img/cj_change_room.txd/carp11s.dds\",\"gta_int.img/bigsfsave.txd/carp11s.dds\",\n \"gta_int.img/labigsave.txd/carp11s.dds\",\"gta_int.img/bigsfsave.txd/carp11s.dds\",\n \"gta_int.img/savesfmid.txd/carp11s.dds\",\"gta_int.img/bigsfsave.txd/carp11s.dds\",\n \"gta_int.img/svcunthoose.txd/carp11s.dds\",\"gta_int.img/bigsfsave.txd/carp11s.dds\",\n \"gta_int.img/svlamid.txd/carp11s.dds\",\"gta_int.img/bigsfsave.txd/carp11s.dds\",\n \"gta_int.img/svvgmid.txd/carp11s.dds\",\"gta_int.img/bigsfsave.txd/carp11s.dds\",\n \"gta_int.img/vghotelnice.txd/carp11s.dds\",\"gta_int.img/bigsfsave.txd/carp11s.dds\",\n \"gta_int.img/savesfmid.txd/ah_strntiles.dds\",\"gta_int.img/bigsfsave.txd/ah_strntiles.dds\",\n \"gta_int.img/sfhsm1.txd/ah_strntiles.dds\",\"gta_int.img/bigsfsave.txd/ah_strntiles.dds\",\n \"gta_int.img/carter_block_2.txd/mp_carter_tilewall.dds\",\"gta_int.img/bigsfsave.txd/mp_carter_tilewall.dds\",\n \"gta_int.img/savesfmid.txd/mp_carter_tilewall.dds\",\"gta_int.img/bigsfsave.txd/mp_carter_tilewall.dds\",\n \"gta_int.img/sfhss2.txd/mp_carter_tilewall.dds\",\"gta_int.img/bigsfsave.txd/mp_carter_tilewall.dds\",\n \"gta_int.img/smallsfhs.txd/mp_carter_tilewall.dds\",\"gta_int.img/bigsfsave.txd/mp_carter_tilewall.dds\",\n \"gta_int.img/vghotelnice.txd/mp_carter_tilewall.dds\",\"gta_int.img/bigsfsave.txd/mp_carter_tilewall.dds\",\n \"gta_int.img/sfhsm2.txd/ah_greencarp.dds\",\"gta_int.img/bigsfsave.txd/ah_greencarp.dds\",\n \"gta_int.img/sfhsmedium1.txd/ah_greencarp.dds\",\"gta_int.img/bigsfsave.txd/ah_greencarp.dds\",\n \"gta_int.img/sweetsmain.txd/ah_walltile6.dds\",\"gta_int.img/bigsfsave.txd/ah_walltile6.dds\",\n \"gta_int.img/sfhss2.txd/ah_flroortile9.dds\",\"gta_int.img/bigsfsave.txd/ah_flroortile9.dds\",\n \"gta_int.img/carlspics.txd/ah_ceilpan1.dds\",\"gta_int.img/bigsfsave.txd/ah_ceilpan1.dds\",\n \"gta_int.img/dr_gsnew.txd/ah_ceilpan1.dds\",\"gta_int.img/bigsfsave.txd/ah_ceilpan1.dds\",\n \"gta_int.img/savesfmid.txd/ah_ceilpan1.dds\",\"gta_int.img/bigsfsave.txd/ah_ceilpan1.dds\",\n \"gta_int.img/sweetsmain.txd/ah_ceilpan1.dds\",\"gta_int.img/bigsfsave.txd/ah_ceilpan1.dds\",\n \"gta_int.img/vghotelnice.txd/ah_ceilpan1.dds\",\"gta_int.img/bigsfsave.txd/ah_ceilpan1.dds\",\n \"gta_int.img/carlslounge.txd/ah_grepaper2.dds\",\"gta_int.img/bigsfsave.txd/ah_grepaper2.dds\",\n \"gta_int.img/sfhsm1.txd/ah_grepaper2.dds\",\"gta_int.img/bigsfsave.txd/ah_grepaper2.dds\",\n \"gta_int.img/svlamid.txd/ah_grepaper2.dds\",\"gta_int.img/bigsfsave.txd/ah_grepaper2.dds\",\n \"gta_int.img/vghotelnice.txd/ah_grepaper2.dds\",\"gta_int.img/bigsfsave.txd/ah_grepaper2.dds\",\n \"gta_int.img/vghotelnice.txd/ah_flrdiamonds.dds\",\"gta_int.img/bigsfsave.txd/ah_flrdiamonds.dds\",\n \"gta_int.img/newcrak.txd/ah_wdpanscum.dds\",\"gta_int.img/bigsfsave.txd/ah_wdpanscum.dds\",\n \"gta_int.img/savesfmid.txd/ah_wdpanscum.dds\",\"gta_int.img/bigsfsave.txd/ah_wdpanscum.dds\",\n \"gta_int.img/vghotelnice.txd/ah_wdpanscum.dds\",\"gta_int.img/bigsfsave.txd/ah_wdpanscum.dds\",\n \"gta_int.img/savesfmid.txd/ah_flroortile5.dds\",\"gta_int.img/bigsfsave.txd/ah_flroortile5.dds\",\n \"gta_int.img/sfhss2.txd/ah_flroortile5.dds\",\"gta_int.img/bigsfsave.txd/ah_flroortile5.dds\",\n \"gta_int.img/smallsfhs.txd/ah_flroortile5.dds\",\"gta_int.img/bigsfsave.txd/ah_flroortile5.dds\",\n \"gta_int.img/svcunthoose.txd/ah_flroortile5.dds\",\"gta_int.img/bigsfsave.txd/ah_flroortile5.dds\",\n \"gta_int.img/svsfsm.txd/ah_flroortile5.dds\",\"gta_int.img/bigsfsave.txd/ah_flroortile5.dds\",\n \"gta_int.img/svvgmid.txd/ah_flroortile5.dds\",\"gta_int.img/bigsfsave.txd/ah_flroortile5.dds\",\n \"gta_int.img/vghotelnice.txd/ah_flroortile5.dds\",\"gta_int.img/bigsfsave.txd/ah_flroortile5.dds\",\n \"gta_int.img/sfhsm2.txd/walp73s.dds\",\"gta_int.img/bigsfsave.txd/walp73s.dds\",\n \"gta_int.img/sfmansion1.txd/walp73s.dds\",\"gta_int.img/bigsfsave.txd/walp73s.dds\",\n \"gta_int.img/labigsave.txd/wall6.dds\",\"gta_int.img/bigsfsave.txd/wall6.dds\",\n \"gta_int.img/lasmall2int2.txd/wall6.dds\",\"gta_int.img/bigsfsave.txd/wall6.dds\",\n \"gta_int.img/savesfmid.txd/wall6.dds\",\"gta_int.img/bigsfsave.txd/wall6.dds\",\n \"gta_int.img/svcunthoose.txd/wall6.dds\",\"gta_int.img/bigsfsave.txd/wall6.dds\",\n \"gta_int.img/svlamid.txd/wall6.dds\",\"gta_int.img/bigsfsave.txd/wall6.dds\",\n \"gta_int.img/svsfsm.txd/wall6.dds\",\"gta_int.img/bigsfsave.txd/wall6.dds\",\n \"gta_int.img/svvgmid.txd/wall6.dds\",\"gta_int.img/bigsfsave.txd/wall6.dds\",\n \"gta_int.img/vghotelnice.txd/wall6.dds\",\"gta_int.img/bigsfsave.txd/wall6.dds\",\n \"gta_int.img/estate2.txd/lw_pistol_128.dds\",\"gta_int.img/bikeskool.txd/lw_pistol_128.dds\",\n \"gta_int.img/carls_kit1.txd/wall6.dds\",\"gta_int.img/burg_1.txd/wall6.dds\",\n \"gta_int.img/sfhsb3.txd/wall6.dds\",\"gta_int.img/burg_1.txd/wall6.dds\",\n \"gta_int.img/sfhsm2.txd/wall6.dds\",\"gta_int.img/burg_1.txd/wall6.dds\",\n \"gta_int.img/sfhss2.txd/wall6.dds\",\"gta_int.img/burg_1.txd/wall6.dds\",\n \"gta_int.img/smallsfhs.txd/wall6.dds\",\"gta_int.img/burg_1.txd/wall6.dds\",\n \"gta_int.img/sfhsm1.txd/carpet4kb.dds\",\"gta_int.img/burg_1.txd/carpet4kb.dds\",\n \"gta_int.img/svlamid.txd/carpet4kb.dds\",\"gta_int.img/burg_1.txd/carpet4kb.dds\",\n \"gta_int.img/carlslounge.txd/burglry_wall3.dds\",\"gta_int.img/burg_1.txd/burglry_wall3.dds\",\n \"gta_int.img/carls_kit2.txd/curtain_sink2.dds\",\"gta_int.img/burg_1.txd/curtain_sink2.dds\",\n \"gta_int.img/immy_furn.txd/curtain_sink2.dds\",\"gta_int.img/burg_1.txd/curtain_sink2.dds\",\n \"gta_int.img/sweets_roon.txd/curtain_sink2.dds\",\"gta_int.img/burg_1.txd/curtain_sink2.dds\",\n \"gta_int.img/trailerkb.txd/curtain_sink2.dds\",\"gta_int.img/burg_1.txd/curtain_sink2.dds\",\n \"gta_int.img/tr_kb_bits.txd/curtain_sink2.dds\",\"gta_int.img/burg_1.txd/curtain_sink2.dds\",\n \"gta_int.img/carls_kit2.txd/kit_windo_12.dds\",\"gta_int.img/burg_1.txd/kit_windo_12.dds\",\n \"gta_int.img/carlslounge.txd/kit_windo_12.dds\",\"gta_int.img/burg_1.txd/kit_windo_12.dds\",\n \"gta_int.img/ganghoos.txd/kit_windo_12.dds\",\"gta_int.img/burg_1.txd/kit_windo_12.dds\",\n \"gta_int.img/gf1.txd/kit_windo_12.dds\",\"gta_int.img/burg_1.txd/kit_windo_12.dds\",\n \"gta_int.img/gf2.txd/kit_windo_12.dds\",\"gta_int.img/burg_1.txd/kit_windo_12.dds\",\n \"gta_int.img/gf4.txd/kit_windo_12.dds\",\"gta_int.img/burg_1.txd/kit_windo_12.dds\",\n \"gta_int.img/imm_rooms.txd/kit_windo_12.dds\",\"gta_int.img/burg_1.txd/kit_windo_12.dds\",\n \"gta_int.img/imy_motel2.txd/kit_windo_12.dds\",\"gta_int.img/burg_1.txd/kit_windo_12.dds\",\n \"gta_int.img/lasmall1int2.txd/kit_windo_12.dds\",\"gta_int.img/burg_1.txd/kit_windo_12.dds\",\n \"gta_int.img/lasmall2int2.txd/kit_windo_12.dds\",\"gta_int.img/burg_1.txd/kit_windo_12.dds\",\n \"gta_int.img/lasmallsave.txd/kit_windo_12.dds\",\"gta_int.img/burg_1.txd/kit_windo_12.dds\",\n \"gta_int.img/motel_skuzwin.txd/kit_windo_12.dds\",\"gta_int.img/burg_1.txd/kit_windo_12.dds\",\n \"gta_int.img/savegenmotel.txd/kit_windo_12.dds\",\"gta_int.img/burg_1.txd/kit_windo_12.dds\",\n \"gta_int.img/sweets_roon.txd/kit_windo_12.dds\",\"gta_int.img/burg_1.txd/kit_windo_12.dds\",\n \"gta_int.img/vgshm2int2.txd/kit_windo_12.dds\",\"gta_int.img/burg_1.txd/kit_windo_12.dds\",\n \"gta_int.img/vgshm3int2.txd/kit_windo_12.dds\",\"gta_int.img/burg_1.txd/kit_windo_12.dds\",\n \"gta_int.img/carlslounge.txd/mp_diner_woodwall.dds\",\"gta_int.img/burg_1.txd/mp_diner_woodwall.dds\",\n \"gta_int.img/dr_gsnew.txd/mp_diner_woodwall.dds\",\"gta_int.img/burg_1.txd/mp_diner_woodwall.dds\",\n \"gta_int.img/lasmall2int2.txd/mp_diner_woodwall.dds\",\"gta_int.img/burg_1.txd/mp_diner_woodwall.dds\",\n \"gta_int.img/mp_diner2.txd/mp_diner_woodwall.dds\",\"gta_int.img/burg_1.txd/mp_diner_woodwall.dds\",\n \"gta_int.img/rybath.txd/mp_diner_woodwall.dds\",\"gta_int.img/burg_1.txd/mp_diner_woodwall.dds\",\n \"gta_int.img/ryhall.txd/mp_diner_woodwall.dds\",\"gta_int.img/burg_1.txd/mp_diner_woodwall.dds\",\n \"gta_int.img/rylounge.txd/mp_diner_woodwall.dds\",\"gta_int.img/burg_1.txd/mp_diner_woodwall.dds\",\n \"gta_int.img/rystuff.txd/mp_diner_woodwall.dds\",\"gta_int.img/burg_1.txd/mp_diner_woodwall.dds\",\n \"gta_int.img/sfhosemed2.txd/mp_diner_woodwall.dds\",\"gta_int.img/burg_1.txd/mp_diner_woodwall.dds\",\n \"gta_int.img/sfhsb3.txd/mp_diner_woodwall.dds\",\"gta_int.img/burg_1.txd/mp_diner_woodwall.dds\",\n \"gta_int.img/sfhsmedium1.txd/mp_diner_woodwall.dds\",\"gta_int.img/burg_1.txd/mp_diner_woodwall.dds\",\n \"gta_int.img/svvgmid.txd/mp_diner_woodwall.dds\",\"gta_int.img/burg_1.txd/mp_diner_woodwall.dds\",\n \"gta_int.img/vgshs2int2.txd/mp_diner_woodwall.dds\",\"gta_int.img/burg_1.txd/mp_diner_woodwall.dds\",\n \"gta_int.img/carlslounge.txd/la_carp3.dds\",\"gta_int.img/burg_1.txd/la_carp3.dds\",\n \"gta_int.img/cj_barb2.txd/la_carp3.dds\",\"gta_int.img/burg_1.txd/la_carp3.dds\",\n \"gta_int.img/crlsbits.txd/la_carp3.dds\",\"gta_int.img/burg_1.txd/la_carp3.dds\",\n \"gta_int.img/dr_gsstudio.txd/la_carp3.dds\",\"gta_int.img/burg_1.txd/la_carp3.dds\",\n \"gta_int.img/genintclothessport.txd/la_carp3.dds\",\"gta_int.img/burg_1.txd/la_carp3.dds\",\n \"gta_int.img/genintintsex.txd/la_carp3.dds\",\"gta_int.img/burg_1.txd/la_carp3.dds\",\n \"gta_int.img/lasmall1int2.txd/la_carp3.dds\",\"gta_int.img/burg_1.txd/la_carp3.dds\",\n \"gta_int.img/lasmall2int2.txd/la_carp3.dds\",\"gta_int.img/burg_1.txd/la_carp3.dds\",\n \"gta_int.img/lasmallsave.txd/la_carp3.dds\",\"gta_int.img/burg_1.txd/la_carp3.dds\",\n \"gta_int.img/scummy.txd/la_carp3.dds\",\"gta_int.img/burg_1.txd/la_carp3.dds\",\n \"gta_int.img/carlslounge.txd/wallpapkb1.dds\",\"gta_int.img/burg_1.txd/wallpapkb1.dds\",\n \"gta_int.img/chick_tray.txd/salad.dds\",\"gta_int.img/burger_tray.txd/salad.dds\",\n \"gta_int.img/pizza_tray.txd/salad.dds\",\"gta_int.img/burger_tray.txd/salad.dds\",\n \"gta_int.img/chick_tray.txd/pplate.dds\",\"gta_int.img/burger_tray.txd/pplate.dds\",\n \"gta_int.img/pizza_tray.txd/pplate.dds\",\"gta_int.img/burger_tray.txd/pplate.dds\",\n \"gta_int.img/chick_tray.txd/chickenskin.dds\",\"gta_int.img/burger_tray.txd/chickenskin.dds\",\n \"gta_int.img/pizza_tray.txd/chickenskin.dds\",\"gta_int.img/burger_tray.txd/chickenskin.dds\",\n \"gta_int.img/cj_ff.txd/burgerfront.dds\",\"gta_int.img/burger_tray.txd/burgerfront.dds\",\n \"gta_int.img/cj_ff.txd/burgertop.dds\",\"gta_int.img/burger_tray.txd/burgertop.dds\",\n \"gta_int.img/chick_tray.txd/fries_cb.dds\",\"gta_int.img/burger_tray.txd/fries_cb.dds\",\n \"gta_int.img/gb_takeaway01.txd/fries_cb.dds\",\"gta_int.img/burger_tray.txd/fries_cb.dds\",\n \"gta_int.img/pizza_tray.txd/fries_cb.dds\",\"gta_int.img/burger_tray.txd/fries_cb.dds\",\n \"gta_int.img/chick_tray.txd/drinktop_cb.dds\",\"gta_int.img/burger_tray.txd/drinktop_cb.dds\",\n \"gta_int.img/gb_kitchtake.txd/drinktop_cb.dds\",\"gta_int.img/burger_tray.txd/drinktop_cb.dds\",\n \"gta_int.img/gb_takeaway01.txd/drinktop_cb.dds\",\"gta_int.img/burger_tray.txd/drinktop_cb.dds\",\n \"gta_int.img/pizza_tray.txd/drinktop_cb.dds\",\"gta_int.img/burger_tray.txd/drinktop_cb.dds\",\n \"gta_int.img/papaerchaseoffice.txd/kit_table.dds\",\"gta_int.img/carls_kit1.txd/kit_table.dds\",\n \"gta_int.img/ganghoos.txd/barbersflr1.dds\",\"gta_int.img/carls_kit1.txd/barbersflr1.dds\",\n \"gta_int.img/int_cutbar3.txd/barbersflr1.dds\",\"gta_int.img/carls_kit1.txd/barbersflr1.dds\",\n \"gta_int.img/int_tatoo.txd/barbersflr1.dds\",\"gta_int.img/carls_kit1.txd/barbersflr1.dds\",\n \"gta_int.img/lasmall2int2.txd/barbersflr1.dds\",\"gta_int.img/carls_kit1.txd/barbersflr1.dds\",\n \"gta_int.img/lee_bdupsmain.txd/barbersflr1_la.dds\",\"gta_int.img/carls_kit1.txd/barbersflr1.dds\",\n \"gta_int.img/carls_kit2.txd/wall3.dds\",\"gta_int.img/carls_kit1.txd/wall3.dds\",\n \"gta_int.img/kit3hghg.txd/stove_1.dds\",\"gta_int.img/carls_kit2.txd/stove_1.dds\",\n \"gta_int.img/kit3hghg.txd/micro1.dds\",\"gta_int.img/carls_kit2.txd/micro1.dds\",\n \"gta_int.img/tr_kb_bits.txd/micro1.dds\",\"gta_int.img/carls_kit2.txd/micro1.dds\",\n \"gta_int.img/ganghoos.txd/wall5b.dds\",\"gta_int.img/carls_kit2.txd/wall5b.dds\",\n \"gta_int.img/kit3hghg.txd/wall5b.dds\",\"gta_int.img/carls_kit2.txd/wall5b.dds\",\n \"gta_int.img/lasmall2int2.txd/wall5b.dds\",\"gta_int.img/carls_kit2.txd/wall5b.dds\",\n \"gta_int.img/kit3hghg.txd/fridge_1b.dds\",\"gta_int.img/carls_kit2.txd/fridge_1b.dds\",\n \"gta_int.img/kit3hghg.txd/wall4b.dds\",\"gta_int.img/carls_kit2.txd/wall4b.dds\",\n \"gta_int.img/kit3hghg.txd/wall2b.dds\",\"gta_int.img/carls_kit2.txd/wall2b.dds\",\n \"gta_int.img/lasmall2int2.txd/burg_curt_1.dds\",\"gta_int.img/carlslounge.txd/burg_curt_1.dds\",\n \"gta_int.img/genintintpoliceb.txd/breezewallbse.dds\",\"gta_int.img/carlslounge.txd/breezewallbse.dds\",\n \"gta_int.img/munation1.txd/breezewallbse.dds\",\"gta_int.img/carlslounge.txd/breezewallbse.dds\",\n \"gta_int.img/range_main.txd/breezewallbse.dds\",\"gta_int.img/carlslounge.txd/breezewallbse.dds\",\n \"gta_int.img/sfhsm1.txd/ah_blu_paper.dds\",\"gta_int.img/carlslounge.txd/ah_blu_paper.dds\",\n \"gta_int.img/svlamid.txd/ah_blu_paper.dds\",\"gta_int.img/carlslounge.txd/ah_blu_paper.dds\",\n \"gta_int.img/labigsave.txd/ah_plnskirting.dds\",\"gta_int.img/carlslounge.txd/ah_plnskirting.dds\",\n \"gta_int.img/sfmansion1.txd/ah_plnskirting.dds\",\"gta_int.img/carlslounge.txd/ah_plnskirting.dds\",\n \"gta_int.img/sfhsm1.txd/ah_blu_paper2.dds\",\"gta_int.img/carlslounge.txd/ah_blu_paper2.dds\",\n \"gta_int.img/svlamid.txd/ah_blu_paper2.dds\",\"gta_int.img/carlslounge.txd/ah_blu_paper2.dds\",\n \"gta_int.img/ganghoos.txd/ah_cheapredcarpet.dds\",\"gta_int.img/carlslounge.txd/ah_cheapredcarpet.dds\",\n \"gta_int.img/savesfmid.txd/ah_cheapredcarpet.dds\",\"gta_int.img/carlslounge.txd/ah_cheapredcarpet.dds\",\n \"gta_int.img/sfhss2.txd/ah_cheapredcarpet.dds\",\"gta_int.img/carlslounge.txd/ah_cheapredcarpet.dds\",\n \"gta_int.img/smallsfhs.txd/ah_cheapredcarpet.dds\",\"gta_int.img/carlslounge.txd/ah_cheapredcarpet.dds\",\n \"gta_int.img/whorebar.txd/ah_cheapredcarpet.dds\",\"gta_int.img/carlslounge.txd/ah_cheapredcarpet.dds\",\n \"gta_int.img/whorerooms.txd/ah_cheapredcarpet.dds\",\"gta_int.img/carlslounge.txd/ah_cheapredcarpet.dds\",\n \"gta_int.img/madpoolbit.txd/ah_flroortile7.dds\",\"gta_int.img/carlspics.txd/ah_flroortile7.dds\",\n \"gta_int.img/ganghoos.txd/ah_bdflwd.dds\",\"gta_int.img/carlspics.txd/ah_bdflwd.dds\",\n \"gta_int.img/sweetshall.txd/ah_bdflwd.dds\",\"gta_int.img/carlspics.txd/ah_bdflwd.dds\",\n \"gta_int.img/vgshs2int2.txd/ah_bdflwd.dds\",\"gta_int.img/carlspics.txd/ah_bdflwd.dds\",\n \"gta_int.img/sweetsmain.txd/ah_picture2.dds\",\"gta_int.img/carlspics.txd/ah_picture2.dds\",\n \"gta_int.img/dogsgym.txd/ah_wdpanelend.dds\",\"gta_int.img/carlspics.txd/ah_wdpanelend.dds\",\n \"gta_int.img/labigsave.txd/ah_wdpanelend.dds\",\"gta_int.img/carlspics.txd/ah_wdpanelend.dds\",\n \"gta_int.img/sweetsmain.txd/ah_wdpanelend.dds\",\"gta_int.img/carlspics.txd/ah_wdpanelend.dds\",\n \"gta_int.img/dr_gsbits.txd/mp_gs_woodpanel.dds\",\"gta_int.img/carter_block_2.txd/mp_gs_woodpanel.dds\",\n \"gta_int.img/dr_gsnew.txd/mp_gs_woodpanel.dds\",\"gta_int.img/carter_block_2.txd/mp_gs_woodpanel.dds\",\n \"gta_int.img/carter_block.txd/mp_carter_girder.dds\",\"gta_int.img/carter_block_2.txd/mp_carter_girder.dds\",\n \"gta_int.img/jet_interior.txd/mp_shop_floor2.dds\",\"gta_int.img/carter_block_2.txd/mp_shop_floor2.dds\",\n \"gta_int.img/carter_outside.txd/mp_carter_floor.dds\",\"gta_int.img/carter_block_2.txd/mp_carter_floor.dds\",\n \"gta_int.img/carter_block.txd/mp_carter_wall.dds\",\"gta_int.img/carter_block_2.txd/mp_carter_wall.dds\",\n \"gta_int.img/gen_pol_vegas.txd/mp_carter_wall.dds\",\"gta_int.img/carter_block_2.txd/mp_carter_wall.dds\",\n \"gta_int.img/dr_gsbits.txd/mp_gs_woodpanel1.dds\",\"gta_int.img/carter_block_2.txd/mp_gs_woodpanel1.dds\",\n \"gta_int.img/dr_gsnew.txd/mp_gs_woodpanel1.dds\",\"gta_int.img/carter_block_2.txd/mp_gs_woodpanel1.dds\",\n \"gta_int.img/carter_block.txd/mp_carter_ceiling.dds\",\"gta_int.img/carter_block_2.txd/mp_carter_ceiling.dds\",\n \"gta_int.img/carter_block.txd/mp_carter_sep.dds\",\"gta_int.img/carter_block_2.txd/mp_carter_sep.dds\",\n \"gta_int.img/carter_block.txd/mp_carter_bwall.dds\",\"gta_int.img/carter_block_2.txd/mp_carter_bwall.dds\",\n \"gta_int.img/carter_block.txd/ab_stripped_floor2.dds\",\"gta_int.img/carter_block_2.txd/ab_stripped_floor2.dds\",\n \"gta_int.img/dr_gsbits.txd/mp_motel_carpet1.dds\",\"gta_int.img/carter_block_2.txd/mp_motel_carpet1.dds\",\n \"gta_int.img/dr_gsnew.txd/mp_motel_carpet1.dds\",\"gta_int.img/carter_block_2.txd/mp_motel_carpet1.dds\",\n \"gta_int.img/imy_motel2.txd/mp_motel_carpet1.dds\",\"gta_int.img/carter_block_2.txd/mp_motel_carpet1.dds\",\n \"gta_int.img/imy_motel.txd/mp_motel_carpet1.dds\",\"gta_int.img/carter_block_2.txd/mp_motel_carpet1.dds\",\n \"gta_int.img/carter_block.txd/mp_carter_smoothwall.dds\",\"gta_int.img/carter_block_2.txd/mp_carter_smoothwall.dds\",\n \"gta_int.img/gf6.txd/mp_carter_tramp.dds\",\"gta_int.img/carter_block.txd/mp_carter_tramp.dds\",\n \"gta_int.img/lee_stripclub.txd/zebra_skin.dds\",\"gta_int.img/carter_block.txd/zebra_skin.dds\",\n \"gta_int.img/dr_gsnew.txd/andydark.dds\",\"gta_int.img/carter_block.txd/andydark.dds\",\n \"gta_int.img/imy_motel2.txd/andydark.dds\",\"gta_int.img/carter_block.txd/andydark.dds\",\n \"gta_int.img/mafcastopfoor.txd/ab_shutter1.dds\",\"gta_int.img/casinovault01.txd/ab_shutter1.dds\",\n \"gta_int.img/mafcastopfoor.txd/vaultwall.dds\",\"gta_int.img/casinovault01.txd/vaultwall.dds\",\n \"gta_int.img/mafiacasinovault01.txd/vaultwall.dds\",\"gta_int.img/casinovault01.txd/vaultwall.dds\",\n \"gta_int.img/mafcastopfoor.txd/ab_mottlesteps.dds\",\"gta_int.img/casinovault01.txd/ab_mottlesteps.dds\",\n \"gta_int.img/mafiacasinovault01.txd/ab_mottlesteps.dds\",\"gta_int.img/casinovault01.txd/ab_mottlesteps.dds\",\n \"gta_int.img/mafiacasinovault01.txd/copbtm_brown.dds\",\"gta_int.img/casinovault01.txd/copbtm_brown.dds\",\n \"gta_int.img/mafcasmain.txd/dts_elevator_door.dds\",\"gta_int.img/casinovault01.txd/dts_elevator_door.dds\",\n \"gta_int.img/mafcastopfoor.txd/dts_elevator_door.dds\",\"gta_int.img/casinovault01.txd/dts_elevator_door.dds\",\n \"gta_int.img/mafiacasino01.txd/dts_elevator_door.dds\",\"gta_int.img/casinovault01.txd/dts_elevator_door.dds\",\n \"gta_int.img/papaerchaseoffice.txd/dts_elevator_door.dds\",\"gta_int.img/casinovault01.txd/dts_elevator_door.dds\",\n \"gta_int.img/mafiacasino01.txd/walltrim2.dds\",\"gta_int.img/casinovault01.txd/walltrim2.dds\",\n \"gta_int.img/mafiacasinovault01.txd/walltrim2.dds\",\"gta_int.img/casinovault01.txd/walltrim2.dds\",\n \"gta_int.img/mafcastopfoor.txd/ab_corwalllwr.dds\",\"gta_int.img/casinovault01.txd/ab_corwalllwr.dds\",\n \"gta_int.img/mafiacasino01.txd/ab_corwalllwr.dds\",\"gta_int.img/casinovault01.txd/ab_corwalllwr.dds\",\n \"gta_int.img/mafiacasinovault01.txd/ab_corwalllwr.dds\",\"gta_int.img/casinovault01.txd/ab_corwalllwr.dds\",\n \"gta_int.img/labig3int2.txd/ab_corwallupr.dds\",\"gta_int.img/casinovault01.txd/ab_corwallupr.dds\",\n \"gta_int.img/mafiacasinovault01.txd/ab_corwallupr.dds\",\"gta_int.img/casinovault01.txd/ab_corwallupr.dds\",\n \"gta_int.img/mafcasmain.txd/vaultfloor.dds\",\"gta_int.img/casinovault01.txd/vaultfloor.dds\",\n \"gta_int.img/mafcastopfoor.txd/vaultfloor.dds\",\"gta_int.img/casinovault01.txd/vaultfloor.dds\",\n \"gta_int.img/mafiacasinovault01.txd/vaultfloor.dds\",\"gta_int.img/casinovault01.txd/vaultfloor.dds\",\n \"gta_int.img/mafiacasinovault01.txd/ab_concrete.dds\",\"gta_int.img/casinovault01.txd/ab_concrete.dds\",\n \"gta_int.img/triad_bar2.txd/beerfridge128.dds\",\"gta_int.img/casmafbar.txd/beerfridge128.dds\",\n \"gta_int.img/mafcasmain.txd/ab_casromceil.dds\",\"gta_int.img/casmafbar.txd/ab_casromceil.dds\",\n \"gta_int.img/mafiacasino01.txd/ab_casromceil.dds\",\"gta_int.img/casmafbar.txd/ab_casromceil.dds\",\n \"gta_int.img/mafcasmain.txd/ab_casromtile1.dds\",\"gta_int.img/casmafbar.txd/ab_casromtile1.dds\",\n \"gta_int.img/mafiacasino01.txd/ab_casromtile1.dds\",\"gta_int.img/casmafbar.txd/ab_casromtile1.dds\",\n \"gta_int.img/triad_bar2.txd/bottlestacked256.dds\",\"gta_int.img/casmafbar.txd/bottlestacked256.dds\",\n \"gta_int.img/triad_bar2.txd/ginoptic128.dds\",\"gta_int.img/casmafbar.txd/ginoptic128.dds\",\n \"gta_int.img/triad_bar2.txd/vodkaoptic128.dds\",\"gta_int.img/casmafbar.txd/vodkaoptic128.dds\",\n \"gta_int.img/triad_bar2.txd/whiskyoptic128.dds\",\"gta_int.img/casmafbar.txd/whiskyoptic128.dds\",\n \"gta_int.img/triad_bar2.txd/martinioptic128.dds\",\"gta_int.img/casmafbar.txd/martinioptic128.dds\",\n \"gta_int.img/triad_bar2.txd/opticbracket128.dds\",\"gta_int.img/casmafbar.txd/opticbracket128.dds\",\n \"gta_int.img/kbmiscfrn1cj.txd/chrome_pipe_32.dds\",\"gta_int.img/castable.txd/chrome_pipe_32.dds\",\n \"gta_int.img/chick_tray.txd/wrapper_cb.dds\",\"gta_int.img/cb_details.txd/wrapper_cb.dds\",\n \"gta_int.img/chick_tray.txd/wrapfood_cb.dds\",\"gta_int.img/cb_details.txd/wrapfood_cb.dds\",\n \"gta_int.img/chick_tray.txd/kidsfront_cb.dds\",\"gta_int.img/cb_details.txd/kidsfront_cb.dds\",\n \"gta_int.img/gb_kitchtake.txd/kidsfront_cb.dds\",\"gta_int.img/cb_details.txd/kidsfront_cb.dds\",\n \"gta_int.img/gb_takeaway01.txd/kidsfront_cb.dds\",\"gta_int.img/cb_details.txd/kidsfront_cb.dds\",\n \"gta_int.img/chick_tray.txd/fillets_cb.dds\",\"gta_int.img/cb_details.txd/fillets_cb.dds\",\n \"gta_int.img/gb_kitchtake.txd/fillets_cb.dds\",\"gta_int.img/cb_details.txd/fillets_cb.dds\",\n \"gta_int.img/gb_takeaway01.txd/fillets_cb.dds\",\"gta_int.img/cb_details.txd/fillets_cb.dds\",\n \"gta_int.img/chick_tray.txd/cluckinbig_cb.dds\",\"gta_int.img/cb_details.txd/cluckinbig_cb.dds\",\n \"gta_int.img/gb_kitchtake.txd/cluckinbig_cb.dds\",\"gta_int.img/cb_details.txd/cluckinbig_cb.dds\",\n \"gta_int.img/gb_takeaway01.txd/cluckinbig_cb.dds\",\"gta_int.img/cb_details.txd/cluckinbig_cb.dds\",\n \"gta_int.img/chick_tray.txd/100%fowl_cb.dds\",\"gta_int.img/cb_details.txd/100%fowl_cb.dds\",\n \"gta_int.img/gb_kitchtake.txd/100%fowl_cb.dds\",\"gta_int.img/cb_details.txd/100%fowl_cb.dds\",\n \"gta_int.img/gb_takeaway01.txd/100%fowl_cb.dds\",\"gta_int.img/cb_details.txd/100%fowl_cb.dds\",\n \"gta_int.img/chick_tray.txd/fillet_cb.dds\",\"gta_int.img/cb_details.txd/fillet_cb.dds\",\n \"gta_int.img/chick_tray.txd/pattern1_cb.dds\",\"gta_int.img/cb_details.txd/pattern1_cb.dds\",\n \"gta_int.img/gb_kitchtake.txd/pattern1_cb.dds\",\"gta_int.img/cb_details.txd/pattern1_cb.dds\",\n \"gta_int.img/gb_takeaway01.txd/pattern1_cb.dds\",\"gta_int.img/cb_details.txd/pattern1_cb.dds\",\n \"gta_int.img/chick_tray.txd/cluckbell02_law.dds\",\"gta_int.img/cb_details.txd/cluckbell02_law.dds\",\n \"gta_int.img/pizza_tray.txd/dip32.dds\",\"gta_int.img/chick_tray.txd/dip32.dds\",\n \"gta_int.img/pizza_tray.txd/plaincup_cb.dds\",\"gta_int.img/chick_tray.txd/plaincup_cb.dds\",\n \"gta_int.img/gb_kitchtake.txd/friesbox_cb.dds\",\"gta_int.img/chick_tray.txd/friesbox_cb.dds\",\n \"gta_int.img/kbchips1.txd/indx_chip3.dds\",\"gta_int.img/chips2.txd/indx_chip364.dds\",\n \"gta_int.img/mafcasmain.txd/ab_hoswallupr.dds\",\"gta_int.img/civic02cj.txd/ab_hoswallupr.dds\",\n \"gta_int.img/papaerchaseoffice.txd/ab_hoswallupr.dds\",\"gta_int.img/civic02cj.txd/ab_hoswallupr.dds\",\n \"gta_int.img/paperchasebits.txd/ab_hoswallupr.dds\",\"gta_int.img/civic02cj.txd/ab_hoswallupr.dds\",\n \"gta_int.img/police_props_un.txd/cj_gunbook1.dds\",\"gta_int.img/cj_ammo2.txd/cj_gunbook1.dds\",\n \"gta_int.img/cj_don_sign.txd/cj_don_post_1.dds\",\"gta_int.img/cj_ammo2.txd/cj_don_post_1.dds\",\n \"gta_int.img/lee_bdupsflat.txd/cj_rubbish2.dds\",\"gta_int.img/cj_ammo2.txd/cj_rubbish2.dds\",\n \"gta_int.img/police_props.txd/cj_rubbish2.dds\",\"gta_int.img/cj_ammo2.txd/cj_rubbish2.dds\",\n \"gta_int.img/proc_rub.txd/cj_rubbish2.dds\",\"gta_int.img/cj_ammo2.txd/cj_rubbish2.dds\",\n \"gta_int.img/ryfurn2.txd/cj_rubbish2.dds\",\"gta_int.img/cj_ammo2.txd/cj_rubbish2.dds\",\n \"gta_int.img/cj_games.txd/cj_speaker_c.dds\",\"gta_int.img/cj_ammo.txd/cj_speaker_c.dds\",\n \"gta_int.img/cj_hi_fi2.txd/cj_speaker_c.dds\",\"gta_int.img/cj_ammo.txd/cj_speaker_c.dds\",\n \"gta_int.img/cj_hi_fi.txd/cj_speaker_c.dds\",\"gta_int.img/cj_ammo.txd/cj_speaker_c.dds\",\n \"gta_int.img/cj_kitchen.txd/cj_bulletbrass.dds\",\"gta_int.img/cj_ammo.txd/cj_bulletbrass.dds\",\n \"gta_int.img/shopping.txd/cj_bulletbrass.dds\",\"gta_int.img/cj_ammo.txd/cj_bulletbrass.dds\",\n \"gta_int.img/posters.txd/mp_gun_box.dds\",\"gta_int.img/cj_ammun_extra.txd/mp_gun_box.dds\",\n \"gta_int.img/posters.txd/mp_gun_neon.dds\",\"gta_int.img/cj_ammun_extra.txd/mp_gun_neon.dds\",\n \"gta_int.img/kbslotmchines.txd/slot6.dds\",\"gta_int.img/cj_bandit.txd/slot6.dds\",\n \"gta_int.img/cj_ss_1.txd/cj_cardboard.dds\",\"gta_int.img/cj_banner2.txd/cj_cardboard.dds\",\n \"gta_int.img/int_zerosrca.txd/cj_cardboard.dds\",\"gta_int.img/cj_banner2.txd/cj_cardboard.dds\",\n \"gta_int.img/rc_shop_acc.txd/cj_cardboard.dds\",\"gta_int.img/cj_banner2.txd/cj_cardboard.dds\",\n \"gta_int.img/rc_shop_figure.txd/cj_cardboard.dds\",\"gta_int.img/cj_banner2.txd/cj_cardboard.dds\",\n \"gta_int.img/cj_urb.txd/cj_heat1.dds\",\"gta_int.img/cj_banner.txd/cj_heat1.dds\",\n \"gta_int.img/skate_shop.txd/cj_heat1.dds\",\"gta_int.img/cj_banner.txd/cj_heat1.dds\",\n \"gta_int.img/cj_urb.txd/cj_suburban_1.dds\",\"gta_int.img/cj_banner.txd/cj_suburban_1.dds\",\n \"gta_int.img/skate_shop.txd/cj_heat2.dds\",\"gta_int.img/cj_banner.txd/cj_heat2.dds\",\n \"gta_int.img/skate_shop.txd/cj_pro_2.dds\",\"gta_int.img/cj_banner.txd/cj_pro_2.dds\",\n \"gta_int.img/cj_urb.txd/cj_eris1.dds\",\"gta_int.img/cj_banner.txd/cj_eris1.dds\",\n \"gta_int.img/skate_shop.txd/cj_eris1.dds\",\"gta_int.img/cj_banner.txd/cj_eris1.dds\",\n \"gta_int.img/genintintbarb.txd/gb_nastybar13.dds\",\"gta_int.img/cj_bar2.txd/gb_nastybar13.dds\",\n \"gta_int.img/int_brothelint3.txd/gb_nastybar13.dds\",\"gta_int.img/cj_bar2.txd/gb_nastybar13.dds\",\n \"gta_int.img/int_casinoint3.txd/gb_nastybar13.dds\",\"gta_int.img/cj_bar2.txd/gb_nastybar13.dds\",\n \"gta_int.img/lee_stripclub1.txd/gb_nastybar13.dds\",\"gta_int.img/cj_bar2.txd/gb_nastybar13.dds\",\n \"gta_int.img/whore_furn.txd/gb_nastybar13.dds\",\"gta_int.img/cj_bar2.txd/gb_nastybar13.dds\",\n \"gta_int.img/svvgmid.txd/gb_nastybar06.dds\",\"gta_int.img/cj_bar2.txd/gb_nastybar06.dds\",\n \"gta_int.img/sweetshall.txd/gb_nastybar06.dds\",\"gta_int.img/cj_bar2.txd/gb_nastybar06.dds\",\n \"gta_int.img/sweetsmain.txd/gb_nastybar06.dds\",\"gta_int.img/cj_bar2.txd/gb_nastybar06.dds\",\n \"gta_int.img/svvgmid.txd/gb_nastybar01.dds\",\"gta_int.img/cj_bar2.txd/gb_nastybar01.dds\",\n \"gta_int.img/int_brothelint3.txd/interiordoor1_256.dds\",\"gta_int.img/cj_barb2.txd/interiordoor1_256.dds\",\n \"gta_int.img/genintintfastd.txd/tile_test3.dds\",\"gta_int.img/cj_barb2.txd/tile_test3.dds\",\n \"gta_int.img/cj_barb.txd/cj_white_wall.dds\",\"gta_int.img/cj_barb2.txd/cj_white_wall.dds\",\n \"gta_int.img/gap.txd/cj_white_wall.dds\",\"gta_int.img/cj_barb2.txd/cj_white_wall.dds\",\n \"gta_int.img/scummy.txd/cj_white_wall.dds\",\"gta_int.img/cj_barb2.txd/cj_white_wall.dds\",\n \"gta_int.img/genintintgarage2.txd/ab_panel_woodgrime.dds\",\"gta_int.img/cj_barb.txd/ab_panel_woodgrime.dds\",\n \"gta_int.img/intgarage2aint3.txd/ab_panel_woodgrime.dds\",\"gta_int.img/cj_barb.txd/ab_panel_woodgrime.dds\",\n \"gta_int.img/int_kbsgarage3.txd/ab_panel_woodgrime.dds\",\"gta_int.img/cj_barb.txd/ab_panel_woodgrime.dds\",\n \"gta_int.img/lasmallsave.txd/ab_marble_checks.dds\",\"gta_int.img/cj_barb.txd/ab_marble_checks.dds\",\n \"gta_int.img/cj_change_room.txd/whiteceil_int.dds\",\"gta_int.img/cj_barb.txd/whiteceil_int.dds\",\n \"gta_int.img/sfhosemed2.txd/whiteceil_int.dds\",\"gta_int.img/cj_barb.txd/whiteceil_int.dds\",\n \"gta_int.img/sfhsb3.txd/whiteceil_int.dds\",\"gta_int.img/cj_barb.txd/whiteceil_int.dds\",\n \"gta_int.img/sfhsm1.txd/whiteceil_int.dds\",\"gta_int.img/cj_barb.txd/whiteceil_int.dds\",\n \"gta_int.img/sfhsm2.txd/whiteceil_int.dds\",\"gta_int.img/cj_barb.txd/whiteceil_int.dds\",\n \"gta_int.img/sfhsmedium1.txd/whiteceil_int.dds\",\"gta_int.img/cj_barb.txd/whiteceil_int.dds\",\n \"gta_int.img/svlamid.txd/whiteceil_int.dds\",\"gta_int.img/cj_barb.txd/whiteceil_int.dds\",\n \"gta_int.img/svvgmid.txd/whiteceil_int.dds\",\"gta_int.img/cj_barb.txd/whiteceil_int.dds\",\n \"gta_int.img/genintintbarbera.txd/barberspic3.dds\",\"gta_int.img/cj_barb.txd/barberspic3.dds\",\n \"gta_int.img/genintintbarbera.txd/barberspic1.dds\",\"gta_int.img/cj_barb.txd/barberspic1.dds\",\n \"gta_int.img/genintintbarbera.txd/barberspic2.dds\",\"gta_int.img/cj_barb.txd/barberspic2.dds\",\n \"gta_int.img/genintintbarbera.txd/barberschr7b.dds\",\"gta_int.img/cj_barb.txd/barberschr7b.dds\",\n \"gta_int.img/genintintbarbera.txd/barberschr6.dds\",\"gta_int.img/cj_barb.txd/barberschr6.dds\",\n \"gta_int.img/genintintbarbera.txd/barberschr5.dds\",\"gta_int.img/cj_barb.txd/barberschr5.dds\",\n \"gta_int.img/genintintbarbera.txd/barberschr4.dds\",\"gta_int.img/cj_barb.txd/barberschr4.dds\",\n \"gta_int.img/genintintbarbera.txd/barberschr3.dds\",\"gta_int.img/cj_barb.txd/barberschr3.dds\",\n \"gta_int.img/genintintbarbera.txd/barberschr2.dds\",\"gta_int.img/cj_barb.txd/barberschr2.dds\",\n \"gta_int.img/genintintbarbera.txd/barberschr1.dds\",\"gta_int.img/cj_barb.txd/barberschr1.dds\",\n \"gta_int.img/cj_beds.txd/cj_pillowcase.dds\",\"gta_int.img/cj_bathroom.txd/cj_pillowcase.dds\",\n \"gta_int.img/cj_med_beds.txd/cj_pillowcase.dds\",\"gta_int.img/cj_bathroom.txd/cj_pillowcase.dds\",\n \"gta_int.img/trailerkb.txd/cj_pillowcase.dds\",\"gta_int.img/cj_bathroom.txd/cj_pillowcase.dds\",\n \"gta_int.img/cj_bs_bathroom.txd/cj_toilet.dds\",\"gta_int.img/cj_bathroom.txd/cj_toilet.dds\",\n \"gta_int.img/cj_furniture.txd/cj_mat1.dds\",\"gta_int.img/cj_beds.txd/cj_mat1.dds\",\n \"gta_int.img/cj_s_beds.txd/cj_mat1.dds\",\"gta_int.img/cj_beds.txd/cj_mat1.dds\",\n \"gta_int.img/cjtemp.txd/cj_mat1.dds\",\"gta_int.img/cj_beds.txd/cj_mat1.dds\",\n \"gta_int.img/immy_furn.txd/kbedside.dds\",\"gta_int.img/cj_beds.txd/kbedside.dds\",\n \"gta_int.img/labits.txd/kbedside.dds\",\"gta_int.img/cj_beds.txd/kbedside.dds\",\n \"gta_int.img/savegenmotel.txd/kbedside.dds\",\"gta_int.img/cj_beds.txd/kbedside.dds\",\n \"gta_int.img/sweets_roon.txd/kbedside.dds\",\"gta_int.img/cj_beds.txd/kbedside.dds\",\n \"gta_int.img/immy_furn.txd/kbedhead.dds\",\"gta_int.img/cj_beds.txd/kbedhead.dds\",\n \"gta_int.img/labits.txd/kbedhead.dds\",\"gta_int.img/cj_beds.txd/kbedhead.dds\",\n \"gta_int.img/savegenmotel.txd/kbedhead.dds\",\"gta_int.img/cj_beds.txd/kbedhead.dds\",\n \"gta_int.img/sweets_roon.txd/kbedhead.dds\",\"gta_int.img/cj_beds.txd/kbedhead.dds\",\n \"gta_int.img/immy_furn.txd/kb_sheet_pilay2.dds\",\"gta_int.img/cj_beds.txd/kb_sheet_pilay2.dds\",\n \"gta_int.img/labits.txd/kb_sheet_pilay2.dds\",\"gta_int.img/cj_beds.txd/kb_sheet_pilay2.dds\",\n \"gta_int.img/savegenmotel.txd/kb_sheet_pilay2.dds\",\"gta_int.img/cj_beds.txd/kb_sheet_pilay2.dds\",\n \"gta_int.img/sweets_roon.txd/kb_sheet_pilay2.dds\",\"gta_int.img/cj_beds.txd/kb_sheet_pilay2.dds\",\n \"gta_int.img/immy_furn.txd/bed_test.dds\",\"gta_int.img/cj_beds.txd/bed_test.dds\",\n \"gta_int.img/cj_burg_sign.txd/cj_bs_menu4.dds\",\"gta_int.img/cj_burg_sign2.txd/cj_bs_menu4.dds\",\n \"gta_int.img/gb_kitchtake.txd/cj_bs_menu4.dds\",\"gta_int.img/cj_burg_sign2.txd/cj_bs_menu4.dds\",\n \"gta_int.img/gb_takeaway01.txd/cj_bs_menu4.dds\",\"gta_int.img/cj_burg_sign2.txd/cj_bs_menu4.dds\",\n \"gta_int.img/lee_bdupsflat.txd/cj_bs_bag.dds\",\"gta_int.img/cj_burg_sign.txd/cj_bs_bag.dds\",\n \"gta_int.img/proc_rub.txd/cj_bs_bag.dds\",\"gta_int.img/cj_burg_sign.txd/cj_bs_bag.dds\",\n \"gta_int.img/ryfurn2.txd/cj_bs_bag.dds\",\"gta_int.img/cj_burg_sign.txd/cj_bs_bag.dds\",\n \"gta_int.img/cj_ff_acc1.txd/cj_bs_cup.dds\",\"gta_int.img/cj_burg_sign.txd/cj_bs_cup.dds\",\n \"gta_int.img/lee_bdupsflat.txd/cj_bs_cup.dds\",\"gta_int.img/cj_burg_sign.txd/cj_bs_cup.dds\",\n \"gta_int.img/proc_rub.txd/cj_bs_cup.dds\",\"gta_int.img/cj_burg_sign.txd/cj_bs_cup.dds\",\n \"gta_int.img/ryfurn2.txd/cj_bs_cup.dds\",\"gta_int.img/cj_burg_sign.txd/cj_bs_cup.dds\",\n \"gta_int.img/cj_piz_sign.txd/cj_pizza_menu2.dds\",\"gta_int.img/cj_cb_sign.txd/cj_pizza_menu2.dds\",\n \"gta_int.img/cj_med_beds.txd/cj_floral.dds\",\"gta_int.img/cj_chris.txd/cj_floral.dds\",\n \"gta_int.img/cj_sofa.txd/cj_floral.dds\",\"gta_int.img/cj_chris.txd/cj_floral.dds\",\n \"gta_int.img/cj_tables.txd/cj_floral.dds\",\"gta_int.img/cj_chris.txd/cj_floral.dds\",\n \"gta_int.img/immy_furn.txd/cj_floral.dds\",\"gta_int.img/cj_chris.txd/cj_floral.dds\",\n \"gta_int.img/rystuff.txd/cj_floral.dds\",\"gta_int.img/cj_chris.txd/cj_floral.dds\",\n \"gta_int.img/savegenmotel.txd/cj_floral.dds\",\"gta_int.img/cj_chris.txd/cj_floral.dds\",\n \"gta_int.img/sweets_roon.txd/cj_floral.dds\",\"gta_int.img/cj_chris.txd/cj_floral.dds\",\n \"gta_int.img/trailerkb.txd/cj_floral.dds\",\"gta_int.img/cj_chris.txd/cj_floral.dds\",\n \"gta_int.img/cj_disco.txd/cj_grate.dds\",\"gta_int.img/cj_chris.txd/cj_grate.dds\",\n \"gta_int.img/cj_dl2.txd/cj_grate.dds\",\"gta_int.img/cj_chris.txd/cj_grate.dds\",\n \"gta_int.img/cj_ff_acc1.txd/cj_grate.dds\",\"gta_int.img/cj_chris.txd/cj_grate.dds\",\n \"gta_int.img/cj_jucie.txd/cj_grate.dds\",\"gta_int.img/cj_chris.txd/cj_grate.dds\",\n \"gta_int.img/cj_kitchen.txd/cj_grate.dds\",\"gta_int.img/cj_chris.txd/cj_grate.dds\",\n \"gta_int.img/cjtemp.txd/cj_radiatorold.dds\",\"gta_int.img/cj_commercial.txd/cj_radiatorold.dds\",\n \"gta_int.img/cj_furniture.txd/cj_sprunk_front.dds\",\"gta_int.img/cj_commercial.txd/cj_sprunk_front.dds\",\n \"gta_int.img/cj_furniture.txd/cj_videofronts.dds\",\"gta_int.img/cj_electrical.txd/cj_videofronts.dds\",\n \"gta_int.img/cj_hi_fi2.txd/cj_videofronts.dds\",\"gta_int.img/cj_electrical.txd/cj_videofronts.dds\",\n \"gta_int.img/cj_hi_fi.txd/cj_videofronts.dds\",\"gta_int.img/cj_electrical.txd/cj_videofronts.dds\",\n \"gta_int.img/cj_sex.txd/cj_videofronts.dds\",\"gta_int.img/cj_electrical.txd/cj_videofronts.dds\",\n \"gta_int.img/cj_tv_stand.txd/cj_videofronts.dds\",\"gta_int.img/cj_electrical.txd/cj_videofronts.dds\",\n \"gta_int.img/cj_video.txd/cj_videofronts.dds\",\"gta_int.img/cj_electrical.txd/cj_videofronts.dds\",\n \"gta_int.img/lasmalldesk.txd/cj_videofronts.dds\",\"gta_int.img/cj_electrical.txd/cj_videofronts.dds\",\n \"gta_int.img/sweetshall.txd/cj_videofronts.dds\",\"gta_int.img/cj_electrical.txd/cj_videofronts.dds\",\n \"gta_int.img/vegassavesmal.txd/cj_videofronts.dds\",\"gta_int.img/cj_electrical.txd/cj_videofronts.dds\",\n \"gta_int.img/zip_clothes.txd/chinosblue.dds\",\"gta_int.img/cj_exp.txd/chinosblue.dds\",\n \"gta_int.img/shopping.txd/chinosbiege.dds\",\"gta_int.img/cj_exp.txd/chinosbiege.dds\",\n \"gta_int.img/zip_clothes.txd/chinosbiege.dds\",\"gta_int.img/cj_exp.txd/chinosbiege.dds\",\n \"gta_int.img/dr_gsnew.txd/mp_furn_floor.dds\",\"gta_int.img/cj_exp.txd/mp_furn_floor.dds\",\n \"gta_int.img/gap.txd/mp_furn_floor.dds\",\"gta_int.img/cj_exp.txd/mp_furn_floor.dds\",\n \"gta_int.img/scummy.txd/mp_furn_floor.dds\",\"gta_int.img/cj_exp.txd/mp_furn_floor.dds\",\n \"gta_int.img/intclothesa.txd/mp_cloth_wall.dds\",\"gta_int.img/cj_exp.txd/mp_cloth_wall.dds\",\n \"gta_int.img/gb_kitchtake.txd/pepperonip.dds\",\"gta_int.img/cj_ff_acc1.txd/pepperonip.dds\",\n \"gta_int.img/gb_takeaway01.txd/pepperonip.dds\",\"gta_int.img/cj_ff_acc1.txd/pepperonip.dds\",\n \"gta_int.img/pick_up.txd/pepperonip.dds\",\"gta_int.img/cj_ff_acc1.txd/pepperonip.dds\",\n \"gta_int.img/pizza_tray.txd/pepperonip.dds\",\"gta_int.img/cj_ff_acc1.txd/pepperonip.dds\",\n \"gta_int.img/cj_kitchen.txd/cj_micropanel.dds\",\"gta_int.img/cj_ff_acc1.txd/cj_micropanel.dds\",\n \"gta_int.img/papaerchaseoffice.txd/cj_worktop.dds\",\"gta_int.img/cj_ff_counters.txd/cj_worktop.dds\",\n \"gta_int.img/intclothesa.txd/shop_floor1.dds\",\"gta_int.img/cj_ff_counters.txd/shop_floor1.dds\",\n \"gta_int.img/cj_zip_sign.txd/cj_zip_3.dds\",\"gta_int.img/cj_gash.txd/cj_zip_3.dds\",\n \"gta_int.img/cj_ss_1.txd/hair_stuff.dds\",\"gta_int.img/cj_hair.txd/hair_stuff.dds\",\n \"gta_int.img/cj_hi_fi.txd/cj_speaker_6.dds\",\"gta_int.img/cj_hi_fi2.txd/cj_speaker_6.dds\",\n \"gta_int.img/cj_hi_fi.txd/cj_speaker1.dds\",\"gta_int.img/cj_hi_fi2.txd/cj_speaker1.dds\",\n \"gta_int.img/cj_hi_fi.txd/cj_hi_fi.dds\",\"gta_int.img/cj_hi_fi2.txd/cj_hi_fi.dds\",\n \"gta_int.img/rystuff.txd/mp_cj_hi_fi.dds\",\"gta_int.img/cj_hi_fi2.txd/cj_hi_fi.dds\",\n \"gta_int.img/ryfurn2.txd/formica2.dds\",\"gta_int.img/cj_kitchen.txd/formica2.dds\",\n \"gta_int.img/labig3int2.txd/marble2.dds\",\"gta_int.img/cj_kitchen.txd/marble2.dds\",\n \"gta_int.img/whore_furn.txd/marble2.dds\",\"gta_int.img/cj_kitchen.txd/marble2.dds\",\n \"gta_int.img/gs_mansion_lights.txd/cj_filliment.dds\",\"gta_int.img/cj_lighting.txd/cj_filliment.dds\",\n \"gta_int.img/mansionlights.txd/cj_filliment.dds\",\"gta_int.img/cj_lighting.txd/cj_filliment.dds\",\n \"gta_int.img/newcrak.txd/cj_filliment.dds\",\"gta_int.img/cj_lighting.txd/cj_filliment.dds\",\n \"gta_int.img/sfhsm1.txd/cj_filliment.dds\",\"gta_int.img/cj_lighting.txd/cj_filliment.dds\",\n \"gta_int.img/sfhsm2bits.txd/cj_filliment.dds\",\"gta_int.img/cj_lighting.txd/cj_filliment.dds\",\n \"gta_int.img/smallsfhs.txd/cj_filliment.dds\",\"gta_int.img/cj_lighting.txd/cj_filliment.dds\",\n \"gta_int.img/svlabigbits.txd/cj_filliment.dds\",\"gta_int.img/cj_lighting.txd/cj_filliment.dds\",\n \"gta_int.img/gs_mansion_lights.txd/cj_lightshade.dds\",\"gta_int.img/cj_lighting.txd/cj_lightshade.dds\",\n \"gta_int.img/mansionlights.txd/cj_lightshade.dds\",\"gta_int.img/cj_lighting.txd/cj_lightshade.dds\",\n \"gta_int.img/sfhsm1.txd/cj_lightshade.dds\",\"gta_int.img/cj_lighting.txd/cj_lightshade.dds\",\n \"gta_int.img/sfhsm2bits.txd/cj_lightshade.dds\",\"gta_int.img/cj_lighting.txd/cj_lightshade.dds\",\n \"gta_int.img/svlabigbits.txd/cj_lightshade.dds\",\"gta_int.img/cj_lighting.txd/cj_lightshade.dds\",\n \"gta_int.img/svlamid.txd/cj_lightshade.dds\",\"gta_int.img/cj_lighting.txd/cj_lightshade.dds\",\n \"gta_int.img/plants_tabletop.txd/cj_basket.dds\",\"gta_int.img/cj_lighting.txd/cj_basket.dds\",\n \"gta_int.img/rystuff.txd/cj_basket.dds\",\"gta_int.img/cj_lighting.txd/cj_basket.dds\",\n \"gta_int.img/svsfsm.txd/cj_linen1.dds\",\"gta_int.img/cj_med_beds.txd/cj_linen1.dds\",\n \"gta_int.img/cj_s_beds.txd/cj_brown_wool.dds\",\"gta_int.img/cj_med_beds.txd/cj_brown_wool.dds\",\n \"gta_int.img/cj_seating.txd/cj_brown_wool.dds\",\"gta_int.img/cj_med_beds.txd/cj_brown_wool.dds\",\n \"gta_int.img/genhotelsave.txd/kb_bed_final2.dds\",\"gta_int.img/cj_med_beds.txd/kb_bed_final2.dds\",\n \"gta_int.img/vegassavesmal.txd/kb_bed_final2.dds\",\"gta_int.img/cj_med_beds.txd/kb_bed_final2.dds\",\n \"gta_int.img/police_props.txd/cj_desk.dds\",\"gta_int.img/cj_office.txd/cj_desk.dds\",\n \"gta_int.img/police_props_un.txd/cj_desk.dds\",\"gta_int.img/cj_office.txd/cj_desk.dds\",\n \"gta_int.img/whore_furn.txd/cj_desk.dds\",\"gta_int.img/cj_office.txd/cj_desk.dds\",\n \"gta_int.img/police_props.txd/cj_photocopier.dds\",\"gta_int.img/cj_office.txd/cj_photocopier.dds\",\n \"gta_int.img/police_props.txd/white32.dds\",\"gta_int.img/cj_office.txd/white32.dds\",\n \"gta_int.img/police_props.txd/cj_binders.dds\",\"gta_int.img/cj_office.txd/cj_binders.dds\",\n \"gta_int.img/genintintpolicea.txd/la_kitch3.dds\",\"gta_int.img/cj_office.txd/la_kitch3.dds\",\n \"gta_int.img/lasmall1int2.txd/la_kitch3.dds\",\"gta_int.img/cj_office.txd/la_kitch3.dds\",\n \"gta_int.img/lasmallkitch.txd/la_kitch3.dds\",\"gta_int.img/cj_office.txd/la_kitch3.dds\",\n \"gta_int.img/mp_policesf.txd/la_kitch3.dds\",\"gta_int.img/cj_office.txd/la_kitch3.dds\",\n \"gta_int.img/mrk_kitstuf.txd/la_kitch3.dds\",\"gta_int.img/cj_office.txd/la_kitch3.dds\",\n \"gta_int.img/genintintpolicea.txd/la_kitch2.dds\",\"gta_int.img/cj_office.txd/la_kitch2.dds\",\n \"gta_int.img/lasmall1int2.txd/la_kitch2.dds\",\"gta_int.img/cj_office.txd/la_kitch2.dds\",\n \"gta_int.img/lasmallkitch.txd/la_kitch2.dds\",\"gta_int.img/cj_office.txd/la_kitch2.dds\",\n \"gta_int.img/mp_policesf.txd/la_kitch2.dds\",\"gta_int.img/cj_office.txd/la_kitch2.dds\",\n \"gta_int.img/mrk_kitstuf.txd/la_kitch2.dds\",\"gta_int.img/cj_office.txd/la_kitch2.dds\",\n \"gta_int.img/genintintpolicea.txd/la_kitch1.dds\",\"gta_int.img/cj_office.txd/la_kitch1.dds\",\n \"gta_int.img/lasmall1int2.txd/la_kitch1.dds\",\"gta_int.img/cj_office.txd/la_kitch1.dds\",\n \"gta_int.img/lasmallkitch.txd/la_kitch1.dds\",\"gta_int.img/cj_office.txd/la_kitch1.dds\",\n \"gta_int.img/mp_policesf.txd/la_kitch1.dds\",\"gta_int.img/cj_office.txd/la_kitch1.dds\",\n \"gta_int.img/mrk_kitstuf.txd/la_kitch1.dds\",\"gta_int.img/cj_office.txd/la_kitch1.dds\",\n \"gta_int.img/pizza_furn.txd/cj_pizza_menu1.dds\",\"gta_int.img/cj_piz_sign.txd/cj_pizza_menu1.dds\",\n \"gta_int.img/genintclothessport.txd/cj_pro_door_256_.dds\",\"gta_int.img/cj_pro.txd/cj_pro_door_256_.dds\",\n \"gta_int.img/cj_tv_stand.txd/cj_cushion1.dds\",\"gta_int.img/cj_seating.txd/cj_cushion1.dds\",\n \"gta_int.img/cj_tv.txd/cj_cushion1.dds\",\"gta_int.img/cj_seating.txd/cj_cushion1.dds\",\n \"gta_int.img/genhotelsave.txd/cj_cushion1.dds\",\"gta_int.img/cj_seating.txd/cj_cushion1.dds\",\n \"gta_int.img/kbmiscfrn1cj.txd/deco_chair_1.dds\",\"gta_int.img/cj_seating.txd/deco_chair_1.dds\",\n \"gta_int.img/dinerseat3b.txd/bras2_base.dds\",\"gta_int.img/cj_seating.txd/bras2_base.dds\",\n \"gta_int.img/sexdetail.txd/cj_porn_signs2.dds\",\"gta_int.img/cj_sex.txd/cj_porn_signs2.dds\",\n \"gta_int.img/whorewallstuff.txd/cj_porno_vids2.dds\",\"gta_int.img/cj_sex.txd/cj_porno_vids2.dds\",\n \"gta_int.img/whorewallstuff.txd/cj_porno_vids.dds\",\"gta_int.img/cj_sex.txd/cj_porno_vids.dds\",\n \"gta_int.img/picture_frame_clip.txd/cj_painting9.dds\",\"gta_int.img/cj_sex.txd/cj_painting9.dds\",\n \"gta_int.img/gb_foodwrap01.txd/gb_foodwrap01.dds\",\"gta_int.img/cj_ss_1.txd/gb_foodwrap01.dds\",\n \"gta_int.img/cj_ss_2.txd/cj_7_11_edge.dds\",\"gta_int.img/cj_ss_1.txd/cj_7_11_edge.dds\",\n \"gta_int.img/cj_ss_3.txd/cj_7_11_edge.dds\",\"gta_int.img/cj_ss_1.txd/cj_7_11_edge.dds\",\n \"gta_int.img/cj_ss_4.txd/cj_icecream.dds\",\"gta_int.img/cj_ss_2.txd/cj_icecream.dds\",\n \"gta_int.img/pizza_tray.txd/pizzalid.dds\",\"gta_int.img/cj_ss_2.txd/pizzalid.dds\",\n \"gta_int.img/gb_foodwrap01.txd/cj_milk.dds\",\"gta_int.img/cj_ss_2.txd/cj_milk.dds\",\n \"gta_int.img/svsfsmbits.txd/formica1.dds\",\"gta_int.img/cj_tables.txd/formica1.dds\",\n \"gta_int.img/cj_tv.txd/cj_steel.dds\",\"gta_int.img/cj_tv_stand.txd/cj_steel.dds\",\n \"gta_int.img/lasmalldesk.txd/cj_tv2.dds\",\"gta_int.img/cj_tv.txd/cj_tv2.dds\",\n \"gta_int.img/crlsbits.txd/green_glass_64.dds\",\"gta_int.img/cj_tv.txd/green_glass_64.dds\",\n \"gta_int.img/kbmiscfrn2.txd/green_glass_64.dds\",\"gta_int.img/cj_tv.txd/green_glass_64.dds\",\n \"gta_int.img/intclotheshiphop.txd/cj_bricks.dds\",\"gta_int.img/cj_urb.txd/cj_bricks.dds\",\n \"gta_int.img/skate_shop.txd/cj_pro_1.dds\",\"gta_int.img/cj_urb.txd/cj_pro_1.dds\",\n \"gta_int.img/intclothesa.txd/cj_vict_door.dds\",\"gta_int.img/cj_vic.txd/cj_vict_door.dds\",\n \"gta_int.img/dr_gsmix.txd/kb_vend2.dds\",\"gta_int.img/cooler1.txd/kb_vend2.dds\",\n \"gta_int.img/dr_gsstudio.txd/kb_vend2.dds\",\"gta_int.img/cooler1.txd/kb_vend2.dds\",\n \"gta_int.img/display1.txd/koen_win.dds\",\"gta_int.img/cooler1.txd/koen_win.dds\",\n \"gta_int.img/intclothesa.txd/koen_win.dds\",\"gta_int.img/cooler1.txd/koen_win.dds\",\n \"gta_int.img/genhotelsave.txd/lightbulb.dds\",\"gta_int.img/crlsbits.txd/lightbulb.dds\",\n \"gta_int.img/immy_furn.txd/lightbulb.dds\",\"gta_int.img/crlsbits.txd/lightbulb.dds\",\n \"gta_int.img/labits.txd/lightbulb.dds\",\"gta_int.img/crlsbits.txd/lightbulb.dds\",\n \"gta_int.img/lasmall1int2.txd/lightbulb.dds\",\"gta_int.img/crlsbits.txd/lightbulb.dds\",\n \"gta_int.img/savegenmotel.txd/lightbulb.dds\",\"gta_int.img/crlsbits.txd/lightbulb.dds\",\n \"gta_int.img/shadetmp.txd/lightbulb.dds\",\"gta_int.img/crlsbits.txd/lightbulb.dds\",\n \"gta_int.img/sweets_roon.txd/lightbulb.dds\",\"gta_int.img/crlsbits.txd/lightbulb.dds\",\n \"gta_int.img/vegassavesmal.txd/lightbulb.dds\",\"gta_int.img/crlsbits.txd/lightbulb.dds\",\n \"gta_int.img/genhotelsave.txd/kb_lightshade.dds\",\"gta_int.img/crlsbits.txd/kb_lightshade.dds\",\n \"gta_int.img/immy_furn.txd/kb_lightshade.dds\",\"gta_int.img/crlsbits.txd/kb_lightshade.dds\",\n \"gta_int.img/labits.txd/kb_lightshade.dds\",\"gta_int.img/crlsbits.txd/kb_lightshade.dds\",\n \"gta_int.img/lasmall1int2.txd/kb_lightshade.dds\",\"gta_int.img/crlsbits.txd/kb_lightshade.dds\",\n \"gta_int.img/savegenmotel.txd/kb_lightshade.dds\",\"gta_int.img/crlsbits.txd/kb_lightshade.dds\",\n \"gta_int.img/shadetmp.txd/kb_lightshade.dds\",\"gta_int.img/crlsbits.txd/kb_lightshade.dds\",\n \"gta_int.img/sweets_roon.txd/kb_lightshade.dds\",\"gta_int.img/crlsbits.txd/kb_lightshade.dds\",\n \"gta_int.img/vegassavesmal.txd/kb_lightshade.dds\",\"gta_int.img/crlsbits.txd/kb_lightshade.dds\",\n \"gta_int.img/kickarse.txd/ahsjmlabeam.dds\",\"gta_int.img/crowds.txd/ahsjmlabeam.dds\",\n \"gta_int.img/stands.txd/ahsjmlabeam.dds\",\"gta_int.img/crowds.txd/ahsjmlabeam.dds\",\n \"gta_int.img/kickarse.txd/ahsjmpostbarx.dds\",\"gta_int.img/crowds.txd/ahsjmpostbarx.dds\",\n \"gta_int.img/stands.txd/ahsjmpostbarx.dds\",\"gta_int.img/crowds.txd/ahsjmpostbarx.dds\",\n \"gta_int.img/kickarse.txd/ahstandside.dds\",\"gta_int.img/crowds.txd/ahstandside.dds\",\n \"gta_int.img/stands.txd/ahstandside.dds\",\"gta_int.img/crowds.txd/ahstandside.dds\",\n \"gta_int.img/kickarse.txd/crowd.dds\",\"gta_int.img/crowds.txd/crowd.dds\",\n \"gta_int.img/stands.txd/crowd.dds\",\"gta_int.img/crowds.txd/crowd.dds\",\n \"gta_int.img/savesfmid.txd/gb_tile01.dds\",\"gta_int.img/cuntcuts.txd/gb_tile01.dds\",\n \"gta_int.img/svsfsm.txd/gb_tile01.dds\",\"gta_int.img/cuntcuts.txd/gb_tile01.dds\",\n \"gta_int.img/savesfmid.txd/gb_canvas18.dds\",\"gta_int.img/cuntcuts.txd/gb_canvas18.dds\",\n \"gta_int.img/svsfsm.txd/gb_canvas18.dds\",\"gta_int.img/cuntcuts.txd/gb_canvas18.dds\",\n \"gta_int.img/savesfmid.txd/gb_canvas17.dds\",\"gta_int.img/cuntcuts.txd/gb_canvas17.dds\",\n \"gta_int.img/svsfsm.txd/gb_canvas17.dds\",\"gta_int.img/cuntcuts.txd/gb_canvas17.dds\",\n \"gta_int.img/savesfmid.txd/gb_canvas06.dds\",\"gta_int.img/cuntcuts.txd/gb_canvas06.dds\",\n \"gta_int.img/svsfsm.txd/gb_canvas06.dds\",\"gta_int.img/cuntcuts.txd/gb_canvas06.dds\",\n \"gta_int.img/savesfmid.txd/csnewspaper02.dds\",\"gta_int.img/cuntcuts.txd/csnewspaper02.dds\",\n \"gta_int.img/svsfsm.txd/csnewspaper02.dds\",\"gta_int.img/cuntcuts.txd/csnewspaper02.dds\",\n \"gta_int.img/savesfmid.txd/gb_pendantlmp01.dds\",\"gta_int.img/cuntcuts.txd/gb_pendantlmp01.dds\",\n \"gta_int.img/sfhosemed2.txd/gb_pendantlmp01.dds\",\"gta_int.img/cuntcuts.txd/gb_pendantlmp01.dds\",\n \"gta_int.img/svsfsm.txd/gb_pendantlmp01.dds\",\"gta_int.img/cuntcuts.txd/gb_pendantlmp01.dds\",\n \"gta_int.img/savesfmid.txd/csnewspaper.dds\",\"gta_int.img/cuntcuts.txd/csnewspaper.dds\",\n \"gta_int.img/svsfsm.txd/csnewspaper.dds\",\"gta_int.img/cuntcuts.txd/csnewspaper.dds\",\n \"gta_int.img/gb_books01.txd/gb_novels06.dds\",\"gta_int.img/cuntcuts.txd/gb_novels06.dds\",\n \"gta_int.img/savesfmid.txd/gb_novels06.dds\",\"gta_int.img/cuntcuts.txd/gb_novels06.dds\",\n \"gta_int.img/svsfsm.txd/gb_novels06.dds\",\"gta_int.img/cuntcuts.txd/gb_novels06.dds\",\n \"gta_int.img/savesfmid.txd/gb_canvas15.dds\",\"gta_int.img/cuntcuts.txd/gb_canvas15.dds\",\n \"gta_int.img/svsfsm.txd/gb_canvas15.dds\",\"gta_int.img/cuntcuts.txd/gb_canvas15.dds\",\n \"gta_int.img/svcunthoose.txd/cszerocupboard.dds\",\"gta_int.img/cuntcuts.txd/cszerocupboard.dds\",\n \"gta_int.img/labig2int2.txd/cscrackpipe01.dds\",\"gta_int.img/cuntcuts.txd/cscrackpipe01.dds\",\n \"gta_int.img/labig3int2.txd/cscrackpipe01.dds\",\"gta_int.img/cuntcuts.txd/cscrackpipe01.dds\",\n \"gta_int.img/savesfmid.txd/cscrackpipe01.dds\",\"gta_int.img/cuntcuts.txd/cscrackpipe01.dds\",\n \"gta_int.img/sfhsb2bits.txd/cscrackpipe01.dds\",\"gta_int.img/cuntcuts.txd/cscrackpipe01.dds\",\n \"gta_int.img/svbits.txd/cscrackpipe01.dds\",\"gta_int.img/cuntcuts.txd/cscrackpipe01.dds\",\n \"gta_int.img/svvgmid.txd/cscrackpipe01.dds\",\"gta_int.img/cuntcuts.txd/cscrackpipe01.dds\",\n \"gta_int.img/sweetsmain.txd/gb_swingbin01.dds\",\"gta_int.img/cuntcuts.txd/gb_swingbin01.dds\",\n \"gta_int.img/stadstunt.txd/pendantlight_128.dds\",\"gta_int.img/destructo.txd/pendantlight_128.dds\",\n \"gta_int.img/sumo.txd/pendantlight_128.dds\",\"gta_int.img/destructo.txd/pendantlight_128.dds\",\n \"gta_int.img/stadstunt.txd/knifeafterdark.dds\",\"gta_int.img/destructo.txd/knifeafterdark.dds\",\n \"gta_int.img/sumostands.txd/knifeafterdark.dds\",\"gta_int.img/destructo.txd/knifeafterdark.dds\",\n \"gta_int.img/sumostands.txd/vsrbanner.dds\",\"gta_int.img/destructo.txd/vsrbanner.dds\",\n \"gta_int.img/stadstunt.txd/sunshinebillboard.dds\",\"gta_int.img/destructo.txd/sunshinebillboard.dds\",\n \"gta_int.img/sumostands.txd/sunshinebillboard.dds\",\"gta_int.img/destructo.txd/sunshinebillboard.dds\",\n \"gta_int.img/genintintfastb.txd/diner_seat1.dds\",\"gta_int.img/dinerseat1.txd/diner_seat1.dds\",\n \"gta_int.img/dirtrack.txd/ahbobo_1.dds\",\"gta_int.img/dirtouter.txd/ahbobo_1.dds\",\n \"gta_int.img/stadstunt.txd/ahbobo_1.dds\",\"gta_int.img/dirtouter.txd/ahbobo_1.dds\",\n \"gta_int.img/kickstart.txd/ah_ramp.dds\",\"gta_int.img/dirtrack.txd/ah_ramp.dds\",\n \"gta_int.img/madpoolbit.txd/ah_bgmartiles.dds\",\"gta_int.img/dogsgym.txd/ah_bgmartiles.dds\",\n \"gta_int.img/labigsave.txd/ah_grnplstr.dds\",\"gta_int.img/dogsgym.txd/ah_grnplstr.dds\",\n \"gta_int.img/sfhosemed2.txd/ah_grnplstr.dds\",\"gta_int.img/dogsgym.txd/ah_grnplstr.dds\",\n \"gta_int.img/sfhsm1.txd/ah_grnplstr.dds\",\"gta_int.img/dogsgym.txd/ah_grnplstr.dds\",\n \"gta_int.img/sfhsm2.txd/ah_grnplstr.dds\",\"gta_int.img/dogsgym.txd/ah_grnplstr.dds\",\n \"gta_int.img/sfhsmedium1.txd/ah_grnplstr.dds\",\"gta_int.img/dogsgym.txd/ah_grnplstr.dds\",\n \"gta_int.img/sfmansion1.txd/ah_grnplstr.dds\",\"gta_int.img/dogsgym.txd/ah_grnplstr.dds\",\n \"gta_int.img/svlamid.txd/ah_grnplstr.dds\",\"gta_int.img/dogsgym.txd/ah_grnplstr.dds\",\n \"gta_int.img/vgshs2int2.txd/ah_grnplstr.dds\",\"gta_int.img/dogsgym.txd/ah_grnplstr.dds\",\n \"gta_int.img/labigsave.txd/ah_yelplnks.dds\",\"gta_int.img/dogsgym.txd/ah_yelplnks.dds\",\n \"gta_int.img/savesfmid.txd/ah_yelplnks.dds\",\"gta_int.img/dogsgym.txd/ah_yelplnks.dds\",\n \"gta_int.img/sfhsm1.txd/ah_yelplnks.dds\",\"gta_int.img/dogsgym.txd/ah_yelplnks.dds\",\n \"gta_int.img/sfhsm2.txd/ah_yelplnks.dds\",\"gta_int.img/dogsgym.txd/ah_yelplnks.dds\",\n \"gta_int.img/sfmansion1.txd/ah_yelplnks.dds\",\"gta_int.img/dogsgym.txd/ah_yelplnks.dds\",\n \"gta_int.img/svlamid.txd/ah_yelplnks.dds\",\"gta_int.img/dogsgym.txd/ah_yelplnks.dds\",\n \"gta_int.img/svsfsm.txd/ah_yelplnks.dds\",\"gta_int.img/dogsgym.txd/ah_yelplnks.dds\",\n \"gta_int.img/sweetshall.txd/ah_yelplnks.dds\",\"gta_int.img/dogsgym.txd/ah_yelplnks.dds\",\n \"gta_int.img/sweetsmain.txd/ah_yelplnks.dds\",\"gta_int.img/dogsgym.txd/ah_yelplnks.dds\",\n \"gta_int.img/labigsave.txd/ah_stolewindow.dds\",\"gta_int.img/dogsgym.txd/ah_stolewindow.dds\",\n \"gta_int.img/d_s.txd/rustyside_rb.dds\",\"gta_int.img/donut_tray.txd/rustyside_rb.dds\",\n \"gta_int.img/d_s.txd/rustynap_rb.dds\",\"gta_int.img/donut_tray.txd/rustynap_rb.dds\",\n \"gta_int.img/rystuff.txd/rustynap_rb.dds\",\"gta_int.img/donut_tray.txd/rustynap_rb.dds\",\n \"gta_int.img/rystuff.txd/bagel_rb.dds\",\"gta_int.img/donut_tray.txd/bagel_rb.dds\",\n \"gta_int.img/d_s.txd/cupside_rb.dds\",\"gta_int.img/donut_tray.txd/cupside_rb.dds\",\n \"gta_int.img/d_s.txd/coffeetop_rb.dds\",\"gta_int.img/donut_tray.txd/coffeetop_rb.dds\",\n \"gta_int.img/d_s.txd/rustycoffeerap_rb.dds\",\"gta_int.img/donut_tray.txd/rustycoffeerap_rb.dds\",\n \"gta_int.img/mp3.txd/mp_apt1_pic5.dds\",\"gta_int.img/dr_gsbits.txd/mp_apt1_pic5.dds\",\n \"gta_int.img/mp3.txd/mp_apt1_pic8.dds\",\"gta_int.img/dr_gsbits.txd/mp_apt1_pic8.dds\",\n \"gta_int.img/mp3.txd/mp_apt1_pic7.dds\",\"gta_int.img/dr_gsbits.txd/mp_apt1_pic7.dds\",\n \"gta_int.img/mp3.txd/mp_apt1_pic6.dds\",\"gta_int.img/dr_gsbits.txd/mp_apt1_pic6.dds\",\n \"gta_int.img/genintintfastd.txd/mp_shop_window.dds\",\"gta_int.img/dr_gsbits.txd/mp_shop_window.dds\",\n \"gta_int.img/genintintpoliceb.txd/mp_shop_window.dds\",\"gta_int.img/dr_gsbits.txd/mp_shop_window.dds\",\n \"gta_int.img/int_tatoo.txd/mp_shop_window.dds\",\"gta_int.img/dr_gsbits.txd/mp_shop_window.dds\",\n \"gta_int.img/madpoolbit.txd/mp_shop_window.dds\",\"gta_int.img/dr_gsbits.txd/mp_shop_window.dds\",\n \"gta_int.img/mp_policesf.txd/mp_shop_window.dds\",\"gta_int.img/dr_gsbits.txd/mp_shop_window.dds\",\n \"gta_int.img/mp3.txd/mp_apt1_pic4.dds\",\"gta_int.img/dr_gsbits.txd/mp_apt1_pic4.dds\",\n \"gta_int.img/mp3.txd/mp_apt1_pic3.dds\",\"gta_int.img/dr_gsbits.txd/mp_apt1_pic3.dds\",\n \"gta_int.img/picture_frame.txd/cj_painting7.dds\",\"gta_int.img/dr_gsbits.txd/mp_apt1_pic3.dds\",\n \"gta_int.img/mp3.txd/mp_apt1_pic2.dds\",\"gta_int.img/dr_gsbits.txd/mp_apt1_pic2.dds\",\n \"gta_int.img/mp3.txd/mp_apt1_pic1.dds\",\"gta_int.img/dr_gsbits.txd/mp_apt1_pic1.dds\",\n \"gta_int.img/mp3.txd/mp_apt1_frame4.dds\",\"gta_int.img/dr_gsbits.txd/mp_apt1_frame4.dds\",\n \"gta_int.img/mp3.txd/mp_apt1_frame3.dds\",\"gta_int.img/dr_gsbits.txd/mp_apt1_frame3.dds\",\n \"gta_int.img/mp3.txd/mp_apt1_frame2.dds\",\"gta_int.img/dr_gsbits.txd/mp_apt1_frame2.dds\",\n \"gta_int.img/mp3.txd/mp_apt1_frame1.dds\",\"gta_int.img/dr_gsbits.txd/mp_apt1_frame1.dds\",\n \"gta_int.img/dr_gsnew.txd/ah_corn1.dds\",\"gta_int.img/dr_gsbits.txd/ah_corn1.dds\",\n \"gta_int.img/madbedrooms.txd/ah_corn1.dds\",\"gta_int.img/dr_gsbits.txd/ah_corn1.dds\",\n \"gta_int.img/madpoolbit.txd/ah_corn1.dds\",\"gta_int.img/dr_gsbits.txd/ah_corn1.dds\",\n \"gta_int.img/dr_gsnew.txd/mp_gs_libwall.dds\",\"gta_int.img/dr_gsbits.txd/mp_gs_libwall.dds\",\n \"gta_int.img/dr_gsnew.txd/mp_gs_border.dds\",\"gta_int.img/dr_gsbits.txd/mp_gs_border.dds\",\n \"gta_int.img/dr_gsnew.txd/mp_gs_carpet.dds\",\"gta_int.img/dr_gsbits.txd/mp_gs_carpet.dds\",\n \"gta_int.img/dr_gsstudio.txd/reel01.dds\",\"gta_int.img/dr_gsmix.txd/reel01.dds\",\n \"gta_int.img/dr_gsstudio.txd/speaker04.dds\",\"gta_int.img/dr_gsmix.txd/speaker04.dds\",\n \"gta_int.img/dr_gsstudio.txd/chromecabinet01side_128.dds\",\"gta_int.img/dr_gsmix.txd/chromecabinet01side_128.dds\",\n \"gta_int.img/madpoolbit.txd/mp_gs_pooltiles.dds\",\"gta_int.img/dr_gsnew.txd/mp_gs_pooltiles.dds\",\n \"gta_int.img/madpoolbit.txd/mp_gs_flowerwall.dds\",\"gta_int.img/dr_gsnew.txd/mp_gs_flowerwall.dds\",\n \"gta_int.img/madpoolbit.txd/mp_gs_mud.dds\",\"gta_int.img/dr_gsnew.txd/mp_gs_mud.dds\",\n \"gta_int.img/madbedrooms.txd/ah_flroortile12.dds\",\"gta_int.img/dr_gsnew.txd/ah_flroortile12.dds\",\n \"gta_int.img/madpoolbit.txd/ah_flroortile12.dds\",\"gta_int.img/dr_gsnew.txd/ah_flroortile12.dds\",\n \"gta_int.img/imy_motel2.txd/firextingtemp.dds\",\"gta_int.img/estate2.txd/firextingtemp.dds\",\n \"gta_int.img/imy_motel.txd/firextingtemp.dds\",\"gta_int.img/estate2.txd/firextingtemp.dds\",\n \"gta_int.img/maint1.txd/firextingtemp.dds\",\"gta_int.img/estate2.txd/firextingtemp.dds\",\n \"gta_int.img/imm_roomss.txd/mp_motel_carpet.dds\",\"gta_int.img/ganghoos.txd/mp_burn_carpet.dds\",\n \"gta_int.img/vgshs2int2.txd/ah_flkwin.dds\",\"gta_int.img/ganghoos.txd/ah_flkwin.dds\",\n \"gta_int.img/imm_roomss.txd/motel_bathfloor.dds\",\"gta_int.img/ganghoos.txd/motel_bathfloor.dds\",\n \"gta_int.img/savegenmotel.txd/motel_bathfloor.dds\",\"gta_int.img/ganghoos.txd/motel_bathfloor.dds\",\n \"gta_int.img/skuzzy_motelmain.txd/motel_bathfloor.dds\",\"gta_int.img/ganghoos.txd/motel_bathfloor.dds\",\n \"gta_int.img/kickstart.txd/ah_yelbadwall.dds\",\"gta_int.img/ganghoos.txd/ah_yelbadwall.dds\",\n \"gta_int.img/vgshs2int2.txd/ah_yelbadwall.dds\",\"gta_int.img/ganghoos.txd/ah_yelbadwall.dds\",\n \"gta_int.img/papaerchaseoffice.txd/ab_wallpanel.dds\",\"gta_int.img/ganghoos.txd/ab_wallpanel.dds\",\n \"gta_int.img/sfhosemed2.txd/ah_crakplnk.dds\",\"gta_int.img/ganghoos.txd/ah_crakplnk.dds\",\n \"gta_int.img/sfhsb3.txd/ah_crakplnk.dds\",\"gta_int.img/ganghoos.txd/ah_crakplnk.dds\",\n \"gta_int.img/sfhsm2.txd/ah_crakplnk.dds\",\"gta_int.img/ganghoos.txd/ah_crakplnk.dds\",\n \"gta_int.img/sfhsmedium1.txd/ah_crakplnk.dds\",\"gta_int.img/ganghoos.txd/ah_crakplnk.dds\",\n \"gta_int.img/svvgmid.txd/ah_crakplnk.dds\",\"gta_int.img/ganghoos.txd/ah_crakplnk.dds\",\n \"gta_int.img/vgshs2int2.txd/ah_crakplnk.dds\",\"gta_int.img/ganghoos.txd/ah_crakplnk.dds\",\n \"gta_int.img/vgshs2int2.txd/ah_oldwdpan.dds\",\"gta_int.img/ganghoos.txd/ah_oldwdpan.dds\",\n \"gta_int.img/sfhss2.txd/ah_badceil.dds\",\"gta_int.img/ganghoos.txd/ah_badceil.dds\",\n \"gta_int.img/smallsfhs.txd/ah_badceil.dds\",\"gta_int.img/ganghoos.txd/ah_badceil.dds\",\n \"gta_int.img/svcunthoose.txd/ah_badceil.dds\",\"gta_int.img/ganghoos.txd/ah_badceil.dds\",\n \"gta_int.img/svsfsm.txd/ah_badceil.dds\",\"gta_int.img/ganghoos.txd/ah_badceil.dds\",\n \"gta_int.img/vgshs2int2.txd/ah_badceil.dds\",\"gta_int.img/ganghoos.txd/ah_badceil.dds\",\n \"gta_int.img/rybath.txd/ah_bathwalls.dds\",\"gta_int.img/ganghoos.txd/ah_bathwalls.dds\",\n \"gta_int.img/rylounge.txd/ah_bathwalls.dds\",\"gta_int.img/ganghoos.txd/ah_bathwalls.dds\",\n \"gta_int.img/vgshs2int2.txd/ah_bathwalls.dds\",\"gta_int.img/ganghoos.txd/ah_bathwalls.dds\",\n \"gta_int.img/whorerooms.txd/ah_bathwalls.dds\",\"gta_int.img/ganghoos.txd/ah_bathwalls.dds\",\n \"gta_int.img/sweetsmain.txd/ah_mikebindsarse.dds\",\"gta_int.img/ganghoos.txd/ah_mikebindsarse.dds\",\n \"gta_int.img/sfhsb3bits.txd/ah_curtains1.dds\",\"gta_int.img/ganghoos.txd/ah_curtains1.dds\",\n \"gta_int.img/sfhsm1bits.txd/ah_curtains1.dds\",\"gta_int.img/ganghoos.txd/ah_curtains1.dds\",\n \"gta_int.img/sfhsm1.txd/ah_curtains1.dds\",\"gta_int.img/ganghoos.txd/ah_curtains1.dds\",\n \"gta_int.img/sfhsmedium1.txd/ah_curtains1.dds\",\"gta_int.img/ganghoos.txd/ah_curtains1.dds\",\n \"gta_int.img/sfhss2.txd/ah_curtains1.dds\",\"gta_int.img/ganghoos.txd/ah_curtains1.dds\",\n \"gta_int.img/svcunthoose.txd/ah_curtains1.dds\",\"gta_int.img/ganghoos.txd/ah_curtains1.dds\",\n \"gta_int.img/svlabigbits.txd/ah_curtains1.dds\",\"gta_int.img/ganghoos.txd/ah_curtains1.dds\",\n \"gta_int.img/svsfsmbits.txd/ah_curtains1.dds\",\"gta_int.img/ganghoos.txd/ah_curtains1.dds\",\n \"gta_int.img/vgshm3int2.txd/ah_curtains1.dds\",\"gta_int.img/ganghoos.txd/ah_curtains1.dds\",\n \"gta_int.img/gb_rugs01.txd/gb_livingrug03.dds\",\"gta_int.img/gb_bedrmrugs01.txd/gb_livingrug03.dds\",\n \"gta_int.img/labig2int2.txd/gb_rugbedroom01.dds\",\"gta_int.img/gb_bedrmrugs01.txd/gb_rugbedroom01.dds\",\n \"gta_int.img/labig3int2.txd/gb_rugbedroom01.dds\",\"gta_int.img/gb_bedrmrugs01.txd/gb_rugbedroom01.dds\",\n \"gta_int.img/labig3int2.txd/gb_novels12.dds\",\"gta_int.img/gb_books01.txd/gb_novels12.dds\",\n \"gta_int.img/labig3int2.txd/gb_novels11.dds\",\"gta_int.img/gb_books01.txd/gb_novels11.dds\",\n \"gta_int.img/labig3int2.txd/gb_magazine06.dds\",\"gta_int.img/gb_books01.txd/gb_magazine06.dds\",\n \"gta_int.img/lee_studhall.txd/gb_magazine06.dds\",\"gta_int.img/gb_books01.txd/gb_magazine06.dds\",\n \"gta_int.img/labig3int2.txd/gb_magazine05.dds\",\"gta_int.img/gb_books01.txd/gb_magazine05.dds\",\n \"gta_int.img/lee_studhall.txd/gb_magazine05.dds\",\"gta_int.img/gb_books01.txd/gb_magazine05.dds\",\n \"gta_int.img/gb_magazines01.txd/gb_magazine02.dds\",\"gta_int.img/gb_books01.txd/gb_magazine02.dds\",\n \"gta_int.img/labig3int2.txd/gb_magazine02.dds\",\"gta_int.img/gb_books01.txd/gb_magazine02.dds\",\n \"gta_int.img/lee_studhall.txd/gb_magazine02.dds\",\"gta_int.img/gb_books01.txd/gb_magazine02.dds\",\n \"gta_int.img/labig3int2.txd/gb_novels04.dds\",\"gta_int.img/gb_books01.txd/gb_novels04.dds\",\n \"gta_int.img/labig3int2.txd/gb_novels03.dds\",\"gta_int.img/gb_books01.txd/gb_novels03.dds\",\n \"gta_int.img/labig3int2.txd/gb_novels02.dds\",\"gta_int.img/gb_books01.txd/gb_novels02.dds\",\n \"gta_int.img/labig3int2.txd/gb_novels01.dds\",\"gta_int.img/gb_books01.txd/gb_novels01.dds\",\n \"gta_int.img/labig3int2.txd/gb_platedirty03.dds\",\"gta_int.img/gb_dirtycrock01.txd/gb_platedirty03.dds\",\n \"gta_int.img/labig3int2.txd/gb_mug01.dds\",\"gta_int.img/gb_dirtycrock01.txd/gb_mug01.dds\",\n \"gta_int.img/labig3int2.txd/gb_bowldirty01.dds\",\"gta_int.img/gb_dirtycrock01.txd/gb_bowldirty01.dds\",\n \"gta_int.img/svcunthoose.txd/gb_bowldirty01.dds\",\"gta_int.img/gb_dirtycrock01.txd/gb_bowldirty01.dds\",\n \"gta_int.img/labig3int2.txd/gb_platedirty01.dds\",\"gta_int.img/gb_dirtycrock01.txd/gb_platedirty01.dds\",\n \"gta_int.img/gb_kitchtake.txd/cj_napkin.dds\",\"gta_int.img/gb_foodwrap01.txd/cj_napkin.dds\",\n \"gta_int.img/proc_rub.txd/cj_napkin.dds\",\"gta_int.img/gb_foodwrap01.txd/cj_napkin.dds\",\n \"gta_int.img/rubb.txd/cj_napkin.dds\",\"gta_int.img/gb_foodwrap01.txd/cj_napkin.dds\",\n \"gta_int.img/ryfurn2.txd/cj_napkin.dds\",\"gta_int.img/gb_foodwrap01.txd/cj_napkin.dds\",\n \"gta_int.img/gb_takeaway01.txd/cj_bs2.dds\",\"gta_int.img/gb_kitchtake.txd/cj_bs2.dds\",\n \"gta_int.img/gb_takeaway01.txd/gb_takeaway03.dds\",\"gta_int.img/gb_kitchtake.txd/gb_takeaway03.dds\",\n \"gta_int.img/maint1.txd/gb_takeaway03.dds\",\"gta_int.img/gb_kitchtake.txd/gb_takeaway03.dds\",\n \"gta_int.img/gb_takeaway01.txd/gb_takeaway02.dds\",\"gta_int.img/gb_kitchtake.txd/gb_takeaway02.dds\",\n \"gta_int.img/maint1.txd/gb_takeaway02.dds\",\"gta_int.img/gb_kitchtake.txd/gb_takeaway02.dds\",\n \"gta_int.img/gb_takeaway01.txd/gb_takeaway04.dds\",\"gta_int.img/gb_kitchtake.txd/gb_takeaway04.dds\",\n \"gta_int.img/gb_takeaway01.txd/deep_red64.dds\",\"gta_int.img/gb_kitchtake.txd/deep_red64.dds\",\n \"gta_int.img/gb_takeaway01.txd/gb_takeaway01.dds\",\"gta_int.img/gb_kitchtake.txd/gb_takeaway01.dds\",\n \"gta_int.img/gb_takeaway01.txd/gb_pizzabox01.dds\",\"gta_int.img/gb_kitchtake.txd/gb_pizzabox01.dds\",\n \"gta_int.img/labig1int2.txd/gb_vase01.dds\",\"gta_int.img/gb_ornaments01.txd/gb_vase01.dds\",\n \"gta_int.img/labig1int2.txd/gb_photo02.dds\",\"gta_int.img/gb_ornaments01.txd/gb_photo02.dds\",\n \"gta_int.img/labig1int2.txd/gb_photo01.dds\",\"gta_int.img/gb_ornaments01.txd/gb_photo01.dds\",\n \"gta_int.img/labig1int2.txd/gb_plant02.dds\",\"gta_int.img/gb_ornaments01.txd/gb_plant02.dds\",\n \"gta_int.img/labig1int2.txd/gb_rug01.dds\",\"gta_int.img/gb_rugs01.txd/gb_rug01.dds\",\n \"gta_int.img/vgsvmdshad.txd/andydark2.dds\",\"gta_int.img/genhotelsave.txd/andydark2.dds\",\n \"gta_int.img/immy_furn.txd/lw_desklamp_128_256.dds\",\"gta_int.img/genhotelsave.txd/lw_desklamp_128_256.dds\",\n \"gta_int.img/savegenmotel.txd/lw_desklamp_128_256.dds\",\"gta_int.img/genhotelsave.txd/lw_desklamp_128_256.dds\",\n \"gta_int.img/picture_frame_clip.txd/cj_painting8.dds\",\"gta_int.img/genhotelsave.txd/cj_painting8.dds\",\n \"gta_int.img/vegassavesmal.txd/ab_mottlewhite.dds\",\"gta_int.img/genhotelsave.txd/ab_mottlewhite.dds\",\n \"gta_int.img/labigsave.txd/ah_windows.dds\",\"gta_int.img/genhotelsave.txd/ah_windows.dds\",\n \"gta_int.img/gen_pol_vegas.txd/mp_cop_sep.dds\",\"gta_int.img/genintclothessport.txd/mp_cop_sep.dds\",\n \"gta_int.img/mp_policesf.txd/mp_cop_sep.dds\",\"gta_int.img/genintclothessport.txd/mp_cop_sep.dds\",\n \"gta_int.img/plants.txd/kb_teracota_pot2_64.dds\",\"gta_int.img/genintgeneric.txd/kb_teracota_pot2_64.dds\",\n \"gta_int.img/int_brothelint3.txd/gb_midbar04.dds\",\"gta_int.img/genintgenintint3.txd/gb_midbar04.dds\",\n \"gta_int.img/int_casinoint3.txd/gb_midbar04.dds\",\"gta_int.img/genintgenintint3.txd/gb_midbar04.dds\",\n \"gta_int.img/lee_stripclub1.txd/gb_midbar04.dds\",\"gta_int.img/genintgenintint3.txd/gb_midbar04.dds\",\n \"gta_int.img/whore_furn.txd/gb_midbar04.dds\",\"gta_int.img/genintgenintint3.txd/gb_midbar04.dds\",\n \"gta_int.img/int_casinoint3.txd/gb_midbar03.dds\",\"gta_int.img/genintgenintint3.txd/gb_midbar03.dds\",\n \"gta_int.img/lee_stripclub1.txd/gb_midbar03.dds\",\"gta_int.img/genintgenintint3.txd/gb_midbar03.dds\",\n \"gta_int.img/int_brothelint3.txd/brothredleth.dds\",\"gta_int.img/genintgenintint3.txd/brothredleth.dds\",\n \"gta_int.img/int_casinoint3.txd/brothredleth.dds\",\"gta_int.img/genintgenintint3.txd/brothredleth.dds\",\n \"gta_int.img/lee_stripclub1.txd/brothredleth.dds\",\"gta_int.img/genintgenintint3.txd/brothredleth.dds\",\n \"gta_int.img/genintintfastd.txd/711_walltemp.dds\",\"gta_int.img/genintint711_1.txd/711_walltemp.dds\",\n \"gta_int.img/int_zerosrca.txd/711_walltemp.dds\",\"gta_int.img/genintint711_1.txd/711_walltemp.dds\",\n \"gta_int.img/gen_mun_xtra1.txd/mp_gun_mat.dds\",\"gta_int.img/genintint711_1.txd/mp_gun_mat.dds\",\n \"gta_int.img/vg_xtras1.txd/mp_gun_mat.dds\",\"gta_int.img/genintint711_1.txd/mp_gun_mat.dds\",\n \"gta_int.img/int_tatoo.txd/barbersmir1.dds\",\"gta_int.img/genintintbarbera.txd/barbersmir1.dds\",\n \"gta_int.img/int_casinoint3.txd/gb_midbar12.dds\",\"gta_int.img/genintintbarb.txd/gb_midbar12.dds\",\n \"gta_int.img/int_casinoint3.txd/gb_midbar07.dds\",\"gta_int.img/genintintbarb.txd/gb_midbar07.dds\",\n \"gta_int.img/int_casinoint3.txd/gb_midbar01.dds\",\"gta_int.img/genintintbarb.txd/gb_midbar01.dds\",\n \"gta_int.img/lee_stripclub1.txd/gb_midbar01.dds\",\"gta_int.img/genintintbarb.txd/gb_midbar01.dds\",\n \"gta_int.img/genintintgarage2.txd/posh1_128.dds\",\"gta_int.img/genintintcarint3.txd/posh1_128.dds\",\n \"gta_int.img/genintwarehsint3.txd/concretebigc256.dds\",\"gta_int.img/genintintcarint3.txd/concretebigc256.dds\",\n \"gta_int.img/genintintfastb2.txd/ceilingtile1_128.dds\",\"gta_int.img/genintintfasta.txd/ceilingtile1_128.dds\",\n \"gta_int.img/genintintfastc.txd/ceilingtile1_128.dds\",\"gta_int.img/genintintfasta.txd/ceilingtile1_128.dds\",\n \"gta_int.img/int_cutbar3.txd/ceilingtile1_128.dds\",\"gta_int.img/genintintfasta.txd/ceilingtile1_128.dds\",\n \"gta_int.img/genintintfastb2.txd/cj_tile1.dds\",\"gta_int.img/genintintfasta.txd/cj_tile1.dds\",\n \"gta_int.img/svcunthoose.txd/ws_terratiles.dds\",\"gta_int.img/genintintfastb2.txd/ws_terratiles.dds\",\n \"gta_int.img/int_cutbar3.txd/barbers_wall1.dds\",\"gta_int.img/genintintfastd.txd/barbers_wall1.dds\",\n \"gta_int.img/mp_diner1.txd/cj_don_win.dds\",\"gta_int.img/genintintfastd.txd/cj_don_win.dds\",\n \"gta_int.img/mp_diner2.txd/cj_don_win.dds\",\"gta_int.img/genintintfastd.txd/cj_don_win.dds\",\n \"gta_int.img/int_kbsgarage3.txd/car_jack.dds\",\"gta_int.img/genintintgarage2a.txd/car_jack.dds\",\n \"gta_int.img/intgarage2aint3.txd/kb_tyre.dds\",\"gta_int.img/genintintgarage2a.txd/kb_tyre.dds\",\n \"gta_int.img/int_kbsgarage3.txd/kb_tyre.dds\",\"gta_int.img/genintintgarage2a.txd/kb_tyre.dds\",\n \"gta_int.img/int_kbsgarage3.txd/remingtonkb1.dds\",\"gta_int.img/genintintgarage2a.txd/remingtonkb1.dds\",\n \"gta_int.img/kb_wheel1.txd/bench_test2b.dds\",\"gta_int.img/genintint_gym.txd/bench_test2b.dds\",\n \"gta_int.img/temp_shop.txd/bench_test2b.dds\",\"gta_int.img/genintint_gym.txd/bench_test2b.dds\",\n \"gta_int.img/mixkb1.txd/chrome_tube1.dds\",\"gta_int.img/genintint_gym.txd/chrome_tube1.dds\",\n \"gta_int.img/mp_policesf.txd/copstuff.dds\",\"gta_int.img/genintintpolicea.txd/copstuff.dds\",\n \"gta_int.img/mp_policesf.txd/poldesktop.dds\",\"gta_int.img/genintintpolicea.txd/poldesktop.dds\",\n \"gta_int.img/mp_policesf.txd/poldesk.dds\",\"gta_int.img/genintintpolicea.txd/poldesk.dds\",\n \"gta_int.img/papaerchaseoffice.txd/breezewall2.dds\",\"gta_int.img/genintintpoliceb.txd/breezewall2.dds\",\n \"gta_int.img/mp_policesf.txd/pol_stairs2.dds\",\"gta_int.img/genintintpoliceb.txd/pol_stairs2.dds\",\n \"gta_int.img/gen_pol_vegas.txd/mp_cop_floor2.dds\",\"gta_int.img/genintintsex.txd/mp_cop_floor2.dds\",\n \"gta_int.img/mp_policesf.txd/mp_cop_floor2.dds\",\"gta_int.img/genintintsex.txd/mp_cop_floor2.dds\",\n \"gta_int.img/genintsmlrst_split.txd/gb_restaursmll08.dds\",\"gta_int.img/genintintsmallrest.txd/gb_restaursmll08.dds\",\n \"gta_int.img/genintsmlrst_split.txd/gb_restaursmll04.dds\",\"gta_int.img/genintintsmallrest.txd/gb_restaursmll04.dds\",\n \"gta_int.img/labig1int2.txd/gb_restaursmll03.dds\",\"gta_int.img/genintintsmallrest.txd/gb_restaursmll03.dds\",\n \"gta_int.img/genintsmlrst_split.txd/gb_restaursmll16b.dds\",\"gta_int.img/genintintsmallrest.txd/gb_restaursmll16b.dds\",\n \"gta_int.img/genintsmlrst_split.txd/gb_restaursmll02.dds\",\"gta_int.img/genintintsmallrest.txd/gb_restaursmll02.dds\",\n \"gta_int.img/genintsmlrst_split.txd/gb_restaursmll11.dds\",\"gta_int.img/genintintsmallrest.txd/gb_restaursmll11.dds\",\n \"gta_int.img/genintrestrest2.txd/rest_wall5.dds\",\"gta_int.img/genintrestrest1.txd/rest_wall5.dds\",\n \"gta_int.img/kb_parker.txd/kbsofa333c.dds\",\"gta_int.img/genintrestrest2.txd/kbsofa333c.dds\",\n \"gta_int.img/smashtv.txd/sjmpostbar2.dds\",\"gta_int.img/genintwarehsint3.txd/sjmpostbar2.dds\",\n \"gta_int.img/vg_mun_counter.txd/mp_gun_cabinet.dds\",\"gta_int.img/gen_mun_counter.txd/mp_gun_cabinet.dds\",\n \"gta_int.img/vg_mun_counter.txd/mp_gun_metal.dds\",\"gta_int.img/gen_mun_counter.txd/mp_gun_metal.dds\",\n \"gta_int.img/mp_diner2.txd/mp_diner_counttop.dds\",\"gta_int.img/gen_mun_counter.txd/mp_gun_counter.dds\",\n \"gta_int.img/vg_mun_counter.txd/mp_gun_counter.dds\",\"gta_int.img/gen_mun_counter.txd/mp_gun_counter.dds\",\n \"gta_int.img/posters.txd/mp_gun_man3.dds\",\"gta_int.img/gen_mun_xtars2.txd/mp_gun_man3.dds\",\n \"gta_int.img/posters.txd/mp_gun_man2.dds\",\"gta_int.img/gen_mun_xtars2.txd/mp_gun_man2.dds\",\n \"gta_int.img/posters.txd/mp_gun_man.dds\",\"gta_int.img/gen_mun_xtars2.txd/mp_gun_man.dds\",\n \"gta_int.img/intring_gymint3.txd/star_spang.dds\",\"gta_int.img/gen_mun_xtars2.txd/star_spang.dds\",\n \"gta_int.img/ovalsurround.txd/exitgreen_64.dds\",\"gta_int.img/gen_offtrackint.txd/exitgreen_64.dds\",\n \"gta_int.img/otb_machine.txd/otb_mural3.dds\",\"gta_int.img/gen_offtrackint.txd/otb_mural3.dds\",\n \"gta_int.img/paperchase_bits2.txd/ab_boxstack.dds\",\"gta_int.img/gen_otb_bits.txd/ab_boxstack.dds\",\n \"gta_int.img/paperchasebits.txd/ab_boxstack.dds\",\"gta_int.img/gen_otb_bits.txd/ab_boxstack.dds\",\n \"gta_int.img/mp_policesf.txd/mp_cop_signs.dds\",\"gta_int.img/gen_pol_vegas.txd/mp_cop_signs.dds\",\n \"gta_int.img/mp_policesf.txd/mp_cop_pinboard.dds\",\"gta_int.img/gen_pol_vegas.txd/mp_cop_pinboard.dds\",\n \"gta_int.img/mp_policesf.txd/mp_cop_whiteboard.dds\",\"gta_int.img/gen_pol_vegas.txd/mp_cop_whiteboard.dds\",\n \"gta_int.img/mp_policesf.txd/mp_cop_chief.dds\",\"gta_int.img/gen_pol_vegas.txd/mp_cop_chief.dds\",\n \"gta_int.img/mp_policesf.txd/mp_cop_panel.dds\",\"gta_int.img/gen_pol_vegas.txd/mp_cop_panel.dds\",\n \"gta_int.img/gf5.txd/mp_cop_bars.dds\",\"gta_int.img/gen_pol_vegas.txd/mp_cop_bars.dds\",\n \"gta_int.img/mp_policesf.txd/mp_cop_bars.dds\",\"gta_int.img/gen_pol_vegas.txd/mp_cop_bars.dds\",\n \"gta_int.img/skuzzy_motelmain.txd/burglry_wall5b.dds\",\"gta_int.img/gen_pol_vegas.txd/burglry_wall5b.dds\",\n \"gta_int.img/gf6.txd/mp_police_win.dds\",\"gta_int.img/gen_pol_vegas.txd/mp_police_win.dds\",\n \"gta_int.img/mp_policesf.txd/mp_cop_wall.dds\",\"gta_int.img/gen_pol_vegas.txd/mp_cop_wall.dds\",\n \"gta_int.img/mp_policesf.txd/mp_cop_frame.dds\",\"gta_int.img/gen_pol_vegas.txd/mp_cop_frame.dds\",\n \"gta_int.img/immy_furn.txd/mp_cooch_clothes.dds\",\"gta_int.img/gf1.txd/mp_cooch_clothes.dds\",\n \"gta_int.img/savegenmotel.txd/mp_cooch_clothes.dds\",\"gta_int.img/gf1.txd/mp_cooch_clothes.dds\",\n \"gta_int.img/gf4.txd/cj_mat2dirt.dds\",\"gta_int.img/gf1.txd/cj_mat2dirt.dds\",\n \"gta_int.img/mp3.txd/mp_apt1_pos4.dds\",\"gta_int.img/gf1.txd/mp_apt1_pos4.dds\",\n \"gta_int.img/mp3.txd/mp_apt1_pos3.dds\",\"gta_int.img/gf1.txd/mp_apt1_pos3.dds\",\n \"gta_int.img/gf6.txd/mp_cooch_carp.dds\",\"gta_int.img/gf1.txd/mp_cooch_carp.dds\",\n \"gta_int.img/gf2.txd/mp_cop_ceiling.dds\",\"gta_int.img/gf1.txd/mp_cop_ceiling.dds\",\n \"gta_int.img/mp_policesf.txd/mp_cop_ceiling.dds\",\"gta_int.img/gf1.txd/mp_cop_ceiling.dds\",\n \"gta_int.img/gf2.txd/mp_cooch_frame.dds\",\"gta_int.img/gf1.txd/mp_cooch_frame.dds\",\n \"gta_int.img/gf4.txd/mp_cooch_frame.dds\",\"gta_int.img/gf1.txd/mp_cooch_frame.dds\",\n \"gta_int.img/gf6.txd/mp_cooch_frame.dds\",\"gta_int.img/gf1.txd/mp_cooch_frame.dds\",\n \"gta_int.img/jet_interior.txd/mp_bobbie_carpwhite.dds\",\"gta_int.img/gf2.txd/mp_bobbie_carpwhite.dds\",\n \"gta_int.img/gf5.txd/mp_diner_sawdust.dds\",\"gta_int.img/gf4.txd/mp_diner_sawdust.dds\",\n \"gta_int.img/intclothes_acc.txd/mp_vicgrill.dds\",\"gta_int.img/gf6.txd/mp_vicgrill.dds\",\n \"gta_int.img/mansionlights.txd/mp_cj_light.dds\",\"gta_int.img/gs_mansion_lights.txd/mp_cj_light.dds\",\n \"gta_int.img/sfhsm1.txd/mp_cj_light.dds\",\"gta_int.img/gs_mansion_lights.txd/mp_cj_light.dds\",\n \"gta_int.img/sfhsm2bits.txd/mp_cj_light.dds\",\"gta_int.img/gs_mansion_lights.txd/mp_cj_light.dds\",\n \"gta_int.img/svlabigbits.txd/mp_cj_light.dds\",\"gta_int.img/gs_mansion_lights.txd/mp_cj_light.dds\",\n \"gta_int.img/mansionlights.txd/mp_cj_light_fitting.dds\",\"gta_int.img/gs_mansion_lights.txd/mp_cj_light_fitting.dds\",\n \"gta_int.img/sfhsm1.txd/mp_cj_light_fitting.dds\",\"gta_int.img/gs_mansion_lights.txd/mp_cj_light_fitting.dds\",\n \"gta_int.img/sfhsm2bits.txd/mp_cj_light_fitting.dds\",\"gta_int.img/gs_mansion_lights.txd/mp_cj_light_fitting.dds\",\n \"gta_int.img/svlabigbits.txd/mp_cj_light_fitting.dds\",\"gta_int.img/gs_mansion_lights.txd/mp_cj_light_fitting.dds\",\n \"gta_int.img/papaerchaseoffice.txd/ab_hexi_lite.dds\",\"gta_int.img/hexi_lite.txd/ab_hexi_lite.dds\",\n \"gta_int.img/imy_motel.txd/motel_wall2.dds\",\"gta_int.img/imm_roomss.txd/motel_wall2.dds\",\n \"gta_int.img/savegenmotel.txd/motel_wall2.dds\",\"gta_int.img/imm_roomss.txd/motel_wall2.dds\",\n \"gta_int.img/straps_int.txd/motel_wall2.dds\",\"gta_int.img/imm_roomss.txd/motel_wall2.dds\",\n \"gta_int.img/imy_motel2.txd/bow_bar_top.dds\",\"gta_int.img/imm_roomss.txd/bow_bar_top.dds\",\n \"gta_int.img/imy_motel.txd/bow_bar_top.dds\",\"gta_int.img/imm_roomss.txd/bow_bar_top.dds\",\n \"gta_int.img/lasmall1int2.txd/bow_bar_top.dds\",\"gta_int.img/imm_roomss.txd/bow_bar_top.dds\",\n \"gta_int.img/lasmallsave.txd/bow_bar_top.dds\",\"gta_int.img/imm_roomss.txd/bow_bar_top.dds\",\n \"gta_int.img/savegenmotel.txd/bow_bar_top.dds\",\"gta_int.img/imm_roomss.txd/bow_bar_top.dds\",\n \"gta_int.img/sweets_roon.txd/bow_bar_top.dds\",\"gta_int.img/imm_roomss.txd/bow_bar_top.dds\",\n \"gta_int.img/triad_bar2.txd/bow_bar_top.dds\",\"gta_int.img/imm_roomss.txd/bow_bar_top.dds\",\n \"gta_int.img/imy_motel2.txd/ab_tilehex2.dds\",\"gta_int.img/imm_roomss.txd/ab_tilehex2.dds\",\n \"gta_int.img/imy_motel.txd/ab_tilehex2.dds\",\"gta_int.img/imm_roomss.txd/ab_tilehex2.dds\",\n \"gta_int.img/savegenmotel.txd/ab_tilehex2.dds\",\"gta_int.img/imm_roomss.txd/ab_tilehex2.dds\",\n \"gta_int.img/sweetshall.txd/ab_tilehex2.dds\",\"gta_int.img/imm_roomss.txd/ab_tilehex2.dds\",\n \"gta_int.img/savegenmotel.txd/mp_motel_wallpaper1.dds\",\"gta_int.img/imm_roomss.txd/mp_motel_wallpaper1.dds\",\n \"gta_int.img/savegenmotel.txd/mp_motel_wallpaper.dds\",\"gta_int.img/imm_roomss.txd/mp_motel_wallpaper.dds\",\n \"gta_int.img/savegenmotel.txd/mp_motel_bluewalt.dds\",\"gta_int.img/imm_roomss.txd/mp_motel_bluewalt.dds\",\n \"gta_int.img/imy_motel2.txd/mp_motel_bluew.dds\",\"gta_int.img/imm_roomss.txd/mp_motel_bluew.dds\",\n \"gta_int.img/savegenmotel.txd/mp_motel_bluew.dds\",\"gta_int.img/imm_roomss.txd/mp_motel_bluew.dds\",\n \"gta_int.img/sweets_roon.txd/mp_motel_bluew.dds\",\"gta_int.img/imm_roomss.txd/mp_motel_bluew.dds\",\n \"gta_int.img/lasmall1int2.txd/venetian_blind.dds\",\"gta_int.img/imm_rooms.txd/venetian_blind.dds\",\n \"gta_int.img/lasmallsave.txd/venetian_blind.dds\",\"gta_int.img/imm_rooms.txd/venetian_blind.dds\",\n \"gta_int.img/savegenmotel.txd/venetian_blind.dds\",\"gta_int.img/imm_rooms.txd/venetian_blind.dds\",\n \"gta_int.img/vegassavesmal.txd/venetian_blind.dds\",\"gta_int.img/imm_rooms.txd/venetian_blind.dds\",\n \"gta_int.img/savegenmotel.txd/mp_motel_bed2.dds\",\"gta_int.img/immy_furn.txd/mp_motel_bed2.dds\",\n \"gta_int.img/labits.txd/mp_motel_bed1.dds\",\"gta_int.img/immy_furn.txd/mp_motel_bed1.dds\",\n \"gta_int.img/savegenmotel.txd/mp_motel_bed1.dds\",\"gta_int.img/immy_furn.txd/mp_motel_bed1.dds\",\n \"gta_int.img/sweets_roon.txd/mp_motel_bed1.dds\",\"gta_int.img/immy_furn.txd/mp_motel_bed1.dds\",\n \"gta_int.img/labits.txd/ab_pipe.dds\",\"gta_int.img/immy_furn.txd/ab_pipe.dds\",\n \"gta_int.img/lasmall1int2.txd/ab_pipe.dds\",\"gta_int.img/immy_furn.txd/ab_pipe.dds\",\n \"gta_int.img/savegenmotel.txd/ab_pipe.dds\",\"gta_int.img/immy_furn.txd/ab_pipe.dds\",\n \"gta_int.img/sweets_bit2.txd/ab_pipe.dds\",\"gta_int.img/immy_furn.txd/ab_pipe.dds\",\n \"gta_int.img/sweetshall.txd/ab_pipe.dds\",\"gta_int.img/immy_furn.txd/ab_pipe.dds\",\n \"gta_int.img/savegenmotel.txd/mp_motel_bed.dds\",\"gta_int.img/immy_furn.txd/mp_motel_bed.dds\",\n \"gta_int.img/picture_frame.txd/cj_painting13.dds\",\"gta_int.img/im_xtra.txd/cj_painting13.dds\",\n \"gta_int.img/imy_motel.txd/mp_motel_rooms.dds\",\"gta_int.img/imy_motel2.txd/mp_motel_rooms.dds\",\n \"gta_int.img/imy_motel.txd/mp_motel_numbers.dds\",\"gta_int.img/imy_motel2.txd/mp_motel_numbers.dds\",\n \"gta_int.img/imy_motel.txd/mp_motel_whitewallalt.dds\",\"gta_int.img/imy_motel2.txd/mp_motel_whitewallalt.dds\",\n \"gta_int.img/imy_motel.txd/mp_motel_whitewall.dds\",\"gta_int.img/imy_motel2.txd/mp_motel_whitewall.dds\",\n \"gta_int.img/imy_motel.txd/mp_motel_pinkwalt.dds\",\"gta_int.img/imy_motel2.txd/mp_motel_pinkwalt.dds\",\n \"gta_int.img/imy_motel.txd/mp_motel_pinkw.dds\",\"gta_int.img/imy_motel2.txd/mp_motel_pinkw.dds\",\n \"gta_int.img/imy_motel.txd/ah_exit.dds\",\"gta_int.img/imy_motel2.txd/ah_exit.dds\",\n \"gta_int.img/ovalsurround.txd/greyground256sand.dds\",\"gta_int.img/inneroval.txd/greyground256sand.dds\",\n \"gta_int.img/stadstunt.txd/greyground256sand.dds\",\"gta_int.img/inneroval.txd/greyground256sand.dds\",\n \"gta_int.img/stadstunt.txd/newgrnd1brntrk_128.dds\",\"gta_int.img/inneroval.txd/newgrnd1brntrk_128.dds\",\n \"gta_int.img/ovalsurround.txd/loadbay64.dds\",\"gta_int.img/inneroval.txd/loadbay64.dds\",\n \"gta_int.img/stadstunt.txd/loadbay64.dds\",\"gta_int.img/inneroval.txd/loadbay64.dds\",\n \"gta_int.img/innertrak.txd/billdetaily.dds\",\"gta_int.img/innertrack.txd/billdetaily.dds\",\n \"gta_int.img/sumoback.txd/dirtmix_128.dds\",\"gta_int.img/innertrak.txd/ah_dirtmix_128.dds\",\n \"gta_int.img/whore_furn.txd/gb_nastybar12.dds\",\"gta_int.img/int_brothelint3.txd/gb_nastybar12.dds\",\n \"gta_int.img/whore_furn.txd/bow_bar_panelfront.dds\",\"gta_int.img/int_brothelint3.txd/bow_bar_panelfront.dds\",\n \"gta_int.img/whore_furn.txd/bow_bar_cooler_upr.dds\",\"gta_int.img/int_brothelint3.txd/bow_bar_cooler_upr.dds\",\n \"gta_int.img/triad_bar2.txd/bow_bar_cooler_lwr.dds\",\"gta_int.img/int_brothelint3.txd/bow_bar_cooler_lwr.dds\",\n \"gta_int.img/whore_furn.txd/bow_bar_cooler_lwr.dds\",\"gta_int.img/int_brothelint3.txd/bow_bar_cooler_lwr.dds\",\n \"gta_int.img/int_zerosrca.txd/carpbroth1.dds\",\"gta_int.img/int_brothelint3.txd/carpbroth1.dds\",\n \"gta_int.img/vgshs2int2.txd/carpbroth1.dds\",\"gta_int.img/int_brothelint3.txd/carpbroth1.dds\",\n \"gta_int.img/int_casinoint3.txd/gb_midbar10.dds\",\"gta_int.img/int_brothelint3.txd/gb_midbar10.dds\",\n \"gta_int.img/lee_stripclub1.txd/gb_midbar10.dds\",\"gta_int.img/int_brothelint3.txd/gb_midbar10.dds\",\n \"gta_int.img/whore_furn.txd/gb_midbar10.dds\",\"gta_int.img/int_brothelint3.txd/gb_midbar10.dds\",\n \"gta_int.img/int_casinoint3.txd/gb_midbar09.dds\",\"gta_int.img/int_brothelint3.txd/gb_midbar09.dds\",\n \"gta_int.img/lee_stripclub1.txd/gb_midbar09.dds\",\"gta_int.img/int_brothelint3.txd/gb_midbar09.dds\",\n \"gta_int.img/whore_furn.txd/gb_midbar09.dds\",\"gta_int.img/int_brothelint3.txd/gb_midbar09.dds\",\n \"gta_int.img/int_casinoint3.txd/gb_midbar06.dds\",\"gta_int.img/int_brothelint3.txd/gb_midbar06.dds\",\n \"gta_int.img/lee_stripclub1.txd/gb_midbar06.dds\",\"gta_int.img/int_brothelint3.txd/gb_midbar06.dds\",\n \"gta_int.img/lee_stripclub1.txd/gb_midbar08.dds\",\"gta_int.img/int_casinoint3.txd/gb_midbar08.dds\",\n \"gta_int.img/lee_stripclub1.txd/gb_midbar05.dds\",\"gta_int.img/int_casinoint3.txd/gb_midbar05.dds\",\n \"gta_int.img/shopping.txd/denims.dds\",\"gta_int.img/intclothesa2.txd/denims.dds\",\n \"gta_int.img/zip_clothes.txd/denims.dds\",\"gta_int.img/intclothesa2.txd/denims.dds\",\n \"gta_int.img/mp_policesf.txd/mp_cop_light.dds\",\"gta_int.img/intclotheshiphop.txd/mp_cop_light.dds\",\n \"gta_int.img/inttattoobits.txd/tatoo_chair3.dds\",\"gta_int.img/int_tatoo.txd/tatoo_chair3.dds\",\n \"gta_int.img/proc_rub.txd/sprunk2dirty.dds\",\"gta_int.img/juice.txd/sprunk2dirty2.dds\",\n \"gta_int.img/kbroul1.txd/roulette_6_256.dds\",\"gta_int.img/kbblackjack.txd/roulette_6_256.dds\",\n \"gta_int.img/kb_wheel1.txd/roulette_6_256.dds\",\"gta_int.img/kbblackjack.txd/roulette_6_256.dds\",\n \"gta_int.img/kb_wheel1.txd/chip_tray_gry.dds\",\"gta_int.img/kbblackjack.txd/chip_tray_gry.dds\",\n \"gta_int.img/kb_wheel1.txd/chip_tray_1.dds\",\"gta_int.img/kbblackjack.txd/chip_tray_1.dds\",\n \"gta_int.img/kbroul1.txd/roulette_4_256.dds\",\"gta_int.img/kbblackjack.txd/roulette_4_256.dds\",\n \"gta_int.img/kb_wheel1.txd/roulette_4_256.dds\",\"gta_int.img/kbblackjack.txd/roulette_4_256.dds\",\n \"gta_int.img/kb_wheel1.txd/wheel_o_2b.dds\",\"gta_int.img/kbblackjack.txd/wheel_o_2b.dds\",\n \"gta_int.img/kbroul1.txd/roulette_wood.dds\",\"gta_int.img/kbblackjack.txd/roulette_wood.dds\",\n \"gta_int.img/kb_wheel1.txd/roulette_wood.dds\",\"gta_int.img/kbblackjack.txd/roulette_wood.dds\",\n \"gta_int.img/mrk_couches2.txd/kbcornice_2_128.dds\",\"gta_int.img/kbcouch1.txd/kbcornice_2_128.dds\",\n \"gta_int.img/tr_kb_bits.txd/blak_speaker.dds\",\"gta_int.img/kb_hifi.txd/blak_speaker.dds\",\n \"gta_int.img/tr_kb_bits.txd/hifi_2.dds\",\"gta_int.img/kb_hifi.txd/hifi_2.dds\",\n \"gta_int.img/tr_kb_bits.txd/hifi_1.dds\",\"gta_int.img/kb_hifi.txd/hifi_1.dds\",\n \"gta_int.img/mafcasgenstuff.txd/slot7.dds\",\"gta_int.img/kbslotmchines.txd/slot7.dds\",\n \"gta_int.img/maint1.txd/slot7.dds\",\"gta_int.img/kbslotmchines.txd/slot7.dds\",\n \"gta_int.img/mafcasgenstuff.txd/slot5.dds\",\"gta_int.img/kbslotmchines.txd/slot5.dds\",\n \"gta_int.img/maint1.txd/slot5.dds\",\"gta_int.img/kbslotmchines.txd/slot5.dds\",\n \"gta_int.img/lee_strippriv.txd/man_tigr_rug.dds\",\"gta_int.img/kbtgr_rug.txd/man_tigr_rug.dds\",\n \"gta_int.img/sumostad.txd/upt_precinct_woodledge.dds\",\"gta_int.img/kickstart.txd/upt_precinct_woodledge.dds\",\n \"gta_int.img/labigsave.txd/ah_barpanelm.dds\",\"gta_int.img/kickstart.txd/ah_barpanelm.dds\",\n \"gta_int.img/newcrak.txd/ah_barpanelm.dds\",\"gta_int.img/kickstart.txd/ah_barpanelm.dds\",\n \"gta_int.img/road.txd/midtrack.dds\",\"gta_int.img/kickstart.txd/midtrack.dds\",\n \"gta_int.img/sfhss2.txd/ah_fitlhskirting.dds\",\"gta_int.img/kickstart.txd/ah_fitlhskirting.dds\",\n \"gta_int.img/smallsfhs.txd/ah_fitlhskirting.dds\",\"gta_int.img/kickstart.txd/ah_fitlhskirting.dds\",\n \"gta_int.img/svcunthoose.txd/ah_fitlhskirting.dds\",\"gta_int.img/kickstart.txd/ah_fitlhskirting.dds\",\n \"gta_int.img/svsfsm.txd/ah_fitlhskirting.dds\",\"gta_int.img/kickstart.txd/ah_fitlhskirting.dds\",\n \"gta_int.img/lahss2_2int2.txd/hs_wood1.dds\",\"gta_int.img/labig1int2.txd/hs_wood1.dds\",\n \"gta_int.img/lamidint2.txd/mp_apt1_ceiling.dds\",\"gta_int.img/labig1int2.txd/mp_apt1_ceiling.dds\",\n \"gta_int.img/rybath.txd/mp_apt1_ceiling.dds\",\"gta_int.img/labig1int2.txd/mp_apt1_ceiling.dds\",\n \"gta_int.img/ryhall.txd/mp_apt1_ceiling.dds\",\"gta_int.img/labig1int2.txd/mp_apt1_ceiling.dds\",\n \"gta_int.img/rylounge.txd/mp_apt1_ceiling.dds\",\"gta_int.img/labig1int2.txd/mp_apt1_ceiling.dds\",\n \"gta_int.img/papaerchaseoffice.txd/ab_mottlegrey.dds\",\"gta_int.img/labig1int2.txd/ab_mottlegrey.dds\",\n \"gta_int.img/paperchasebits.txd/ab_mottlegrey.dds\",\"gta_int.img/labig1int2.txd/ab_mottlegrey.dds\",\n \"gta_int.img/labig3int2.txd/hs_vase.dds\",\"gta_int.img/labig1int2.txd/hs_vase.dds\",\n \"gta_int.img/labig2int2.txd/doorframew.dds\",\"gta_int.img/labig1int2.txd/doorframew.dds\",\n \"gta_int.img/labig3int2.txd/doorframew.dds\",\"gta_int.img/labig1int2.txd/doorframew.dds\",\n \"gta_int.img/labig2int2.txd/skirtingw.dds\",\"gta_int.img/labig1int2.txd/skirtingw.dds\",\n \"gta_int.img/labig3int2.txd/skirtingw.dds\",\"gta_int.img/labig1int2.txd/skirtingw.dds\",\n \"gta_int.img/labig2int2.txd/hs2_artex5.dds\",\"gta_int.img/labig1int2.txd/hs2_artex5.dds\",\n \"gta_int.img/labig3int2.txd/hs2_artex5.dds\",\"gta_int.img/labig1int2.txd/hs2_artex5.dds\",\n \"gta_int.img/lahss2aint2.txd/hs2_artex5.dds\",\"gta_int.img/labig1int2.txd/hs2_artex5.dds\",\n \"gta_int.img/lahss2bint2.txd/hs2_artex5.dds\",\"gta_int.img/labig1int2.txd/hs2_artex5.dds\",\n \"gta_int.img/masmall3int2.txd/hs2_artex5.dds\",\"gta_int.img/labig1int2.txd/hs2_artex5.dds\",\n \"gta_int.img/vghsb3int2.txd/hs2_artex5.dds\",\"gta_int.img/labig1int2.txd/hs2_artex5.dds\",\n \"gta_int.img/vghss1int2.txd/hs2_artex5.dds\",\"gta_int.img/labig1int2.txd/hs2_artex5.dds\",\n \"gta_int.img/lahss2aint2.txd/wh_skirt.dds\",\"gta_int.img/labig1int2.txd/wh_skirt.dds\",\n \"gta_int.img/lahss2bint2.txd/wh_skirt.dds\",\"gta_int.img/labig1int2.txd/wh_skirt.dds\",\n \"gta_int.img/lahss2int2.txd/wh_skirt.dds\",\"gta_int.img/labig1int2.txd/wh_skirt.dds\",\n \"gta_int.img/masmall3int2.txd/wh_skirt.dds\",\"gta_int.img/labig1int2.txd/wh_skirt.dds\",\n \"gta_int.img/vghsb3int2.txd/wh_skirt.dds\",\"gta_int.img/labig1int2.txd/wh_skirt.dds\",\n \"gta_int.img/vghss1int2.txd/wh_skirt.dds\",\"gta_int.img/labig1int2.txd/wh_skirt.dds\",\n \"gta_int.img/whore_main.txd/wh_skirt.dds\",\"gta_int.img/labig1int2.txd/wh_skirt.dds\",\n \"gta_int.img/lahss2int2.txd/hs1_wall5.dds\",\"gta_int.img/labig1int2.txd/hs1_wall5.dds\",\n \"gta_int.img/vghss1int2.txd/hs1_wall5.dds\",\"gta_int.img/labig1int2.txd/hs1_wall5.dds\",\n \"gta_int.img/labig2int2.txd/hs2_floor3.dds\",\"gta_int.img/labig1int2.txd/hs2_floor3.dds\",\n \"gta_int.img/lahss2aint2.txd/hs2_floor3.dds\",\"gta_int.img/labig1int2.txd/hs2_floor3.dds\",\n \"gta_int.img/lahss2bint2.txd/hs2_floor3.dds\",\"gta_int.img/labig1int2.txd/hs2_floor3.dds\",\n \"gta_int.img/lahss2aint2.txd/hs2_floor2.dds\",\"gta_int.img/labig1int2.txd/hs2_floor2.dds\",\n \"gta_int.img/lahss2bint2.txd/hs2_floor2.dds\",\"gta_int.img/labig1int2.txd/hs2_floor2.dds\",\n \"gta_int.img/vghss1int2.txd/hs2_floor2.dds\",\"gta_int.img/labig1int2.txd/hs2_floor2.dds\",\n \"gta_int.img/lahss2aint2.txd/hs1_2wall5.dds\",\"gta_int.img/labig1int2.txd/hs1_2wall5.dds\",\n \"gta_int.img/labig2int2.txd/studiowall.dds\",\"gta_int.img/labig1int2.txd/studiowall.dds\",\n \"gta_int.img/labig3int2.txd/studiowall.dds\",\"gta_int.img/labig1int2.txd/studiowall.dds\",\n \"gta_int.img/lee_studhall.txd/studiowall.dds\",\"gta_int.img/labig1int2.txd/studiowall.dds\",\n \"gta_int.img/masmall3int2.txd/hs3_wall9.dds\",\"gta_int.img/labig1int2.txd/hs3_wall9.dds\",\n \"gta_int.img/vghsb3int2.txd/hs3_wall9.dds\",\"gta_int.img/labig1int2.txd/hs3_wall9.dds\",\n \"gta_int.img/vghsb3int2.txd/hs2_3wall2.dds\",\"gta_int.img/labig1int2.txd/hs2_3wall2.dds\",\n \"gta_int.img/vgshm3int2.txd/hsv_3wall3.dds\",\"gta_int.img/labig1int2.txd/hs2_3wall2.dds\",\n \"gta_int.img/lahss2aint2.txd/hs2_floor4.dds\",\"gta_int.img/labig1int2.txd/hs2_floor4.dds\",\n \"gta_int.img/lahss2bint2.txd/hs2_floor4.dds\",\"gta_int.img/labig1int2.txd/hs2_floor4.dds\",\n \"gta_int.img/labig3int2.txd/lightswitch01_int.dds\",\"gta_int.img/labig2int2.txd/lightswitch01_int.dds\",\n \"gta_int.img/labig3int2.txd/flooringwd02_int.dds\",\"gta_int.img/labig2int2.txd/flooringwd02_int.dds\",\n \"gta_int.img/labig3int2.txd/carpet1aw.dds\",\"gta_int.img/labig2int2.txd/carpet1aw.dds\",\n \"gta_int.img/labig3int2.txd/skirtingb.dds\",\"gta_int.img/labig2int2.txd/skirtingb.dds\",\n \"gta_int.img/lamidint2.txd/mp_apt1_kitchwallpaper.dds\",\"gta_int.img/labig2int2.txd/mp_apt1_kitchwallpaper.dds\",\n \"gta_int.img/lahss2bint2.txd/hs2_2wall1.dds\",\"gta_int.img/labig2int2.txd/hs2_2wall1.dds\",\n \"gta_int.img/whore_main.txd/hs2_2wall1.dds\",\"gta_int.img/labig2int2.txd/hs2_2wall1.dds\",\n \"gta_int.img/labig3int2.txd/hs3_wall7.dds\",\"gta_int.img/labig2int2.txd/hs3_wall7.dds\",\n \"gta_int.img/lahss2bint2.txd/hs3_wall7.dds\",\"gta_int.img/labig2int2.txd/hs3_wall7.dds\",\n \"gta_int.img/masmall3int2.txd/hs3_wall7.dds\",\"gta_int.img/labig2int2.txd/hs3_wall7.dds\",\n \"gta_int.img/lahss2aint2.txd/hs3_wall5.dds\",\"gta_int.img/labig2int2.txd/hs3_wall5.dds\",\n \"gta_int.img/lee_strip2.txd/hs3_wall5.dds\",\"gta_int.img/labig2int2.txd/hs3_wall5.dds\",\n \"gta_int.img/masmall3int2.txd/hs3_wall5.dds\",\"gta_int.img/labig2int2.txd/hs3_wall5.dds\",\n \"gta_int.img/vghsb3int2.txd/hs3_wall5.dds\",\"gta_int.img/labig2int2.txd/hs3_wall5.dds\",\n \"gta_int.img/whore_main.txd/hs3_wall5.dds\",\"gta_int.img/labig2int2.txd/hs3_wall5.dds\",\n \"gta_int.img/lahss2bint2.txd/hs3_wall2.dds\",\"gta_int.img/labig2int2.txd/hs3_wall2.dds\",\n \"gta_int.img/masmall3int2.txd/hs3_wall2.dds\",\"gta_int.img/labig2int2.txd/hs3_wall2.dds\",\n \"gta_int.img/labig3int2.txd/hs2_3wall6.dds\",\"gta_int.img/labig2int2.txd/hs2_3wall6.dds\",\n \"gta_int.img/vghsb3int2.txd/hs2_3wall6.dds\",\"gta_int.img/labig2int2.txd/hs2_3wall6.dds\",\n \"gta_int.img/lahss2aint2.txd/soil.dds\",\"gta_int.img/labig3int2.txd/soil.dds\",\n \"gta_int.img/lahss2bint2.txd/soil.dds\",\"gta_int.img/labig3int2.txd/soil.dds\",\n \"gta_int.img/lee_studhall.txd/soil.dds\",\"gta_int.img/labig3int2.txd/soil.dds\",\n \"gta_int.img/lahss2aint2.txd/planpot.dds\",\"gta_int.img/labig3int2.txd/planpot.dds\",\n \"gta_int.img/lahss2bint2.txd/planpot.dds\",\"gta_int.img/labig3int2.txd/planpot.dds\",\n \"gta_int.img/lee_studhall.txd/planpot.dds\",\"gta_int.img/labig3int2.txd/planpot.dds\",\n \"gta_int.img/lahss2aint2.txd/cactusl.dds\",\"gta_int.img/labig3int2.txd/cactusl.dds\",\n \"gta_int.img/lahss2bint2.txd/cactusl.dds\",\"gta_int.img/labig3int2.txd/cactusl.dds\",\n \"gta_int.img/lee_studhall.txd/cactusl.dds\",\"gta_int.img/labig3int2.txd/cactusl.dds\",\n \"gta_int.img/whore_furn.txd/cactusl.dds\",\"gta_int.img/labig3int2.txd/cactusl.dds\",\n \"gta_int.img/mafcastopfoor.txd/aptdoor01_int.dds\",\"gta_int.img/labig3int2.txd/aptdoor01_int.dds\",\n \"gta_int.img/whore_main.txd/wh_walls.dds\",\"gta_int.img/labig3int2.txd/wh_walls.dds\",\n \"gta_int.img/whore_rms.txd/wh_walls.dds\",\"gta_int.img/labig3int2.txd/wh_walls.dds\",\n \"gta_int.img/vghsb3int2.txd/hs2_3carpet1.dds\",\"gta_int.img/labig3int2.txd/hs2_3carpet1.dds\",\n \"gta_int.img/vgshm2int2.txd/hs2_3carpet1.dds\",\"gta_int.img/labig3int2.txd/hs2_3carpet1.dds\",\n \"gta_int.img/vghsb3int2.txd/hs2_3wall5.dds\",\"gta_int.img/labig3int2.txd/hs2_3wall5.dds\",\n \"gta_int.img/svvgmid.txd/ah_carpet4kb.dds\",\"gta_int.img/labigsave.txd/ah_carpet4kb.dds\",\n \"gta_int.img/sfhosemed2.txd/ah_gryskt.dds\",\"gta_int.img/labigsave.txd/ah_gryskt.dds\",\n \"gta_int.img/sfhsb3.txd/ah_gryskt.dds\",\"gta_int.img/labigsave.txd/ah_gryskt.dds\",\n \"gta_int.img/sfhsm2.txd/ah_gryskt.dds\",\"gta_int.img/labigsave.txd/ah_gryskt.dds\",\n \"gta_int.img/sfhsmedium1.txd/ah_gryskt.dds\",\"gta_int.img/labigsave.txd/ah_gryskt.dds\",\n \"gta_int.img/sfhss2.txd/ah_gryskt.dds\",\"gta_int.img/labigsave.txd/ah_gryskt.dds\",\n \"gta_int.img/smallsfhs.txd/ah_gryskt.dds\",\"gta_int.img/labigsave.txd/ah_gryskt.dds\",\n \"gta_int.img/svcunthoose.txd/ah_gryskt.dds\",\"gta_int.img/labigsave.txd/ah_gryskt.dds\",\n \"gta_int.img/svsfsm.txd/ah_gryskt.dds\",\"gta_int.img/labigsave.txd/ah_gryskt.dds\",\n \"gta_int.img/svvgmid.txd/ah_gryskt.dds\",\"gta_int.img/labigsave.txd/ah_gryskt.dds\",\n \"gta_int.img/madbedrooms.txd/ah_fancyceil.dds\",\"gta_int.img/labigsave.txd/ah_fancyceil.dds\",\n \"gta_int.img/sfmansion1.txd/ah_fancyceil.dds\",\"gta_int.img/labigsave.txd/ah_fancyceil.dds\",\n \"gta_int.img/sfmansion1.txd/ah_pineceiling.dds\",\"gta_int.img/labigsave.txd/ah_pineceiling.dds\",\n \"gta_int.img/sfmansion1.txd/ah_wpaper8.dds\",\"gta_int.img/labigsave.txd/ah_wpaper8.dds\",\n \"gta_int.img/sfhsb3.txd/ah_pluskirt.dds\",\"gta_int.img/labigsave.txd/ah_pluskirt.dds\",\n \"gta_int.img/sfhsm1.txd/ah_pluskirt.dds\",\"gta_int.img/labigsave.txd/ah_pluskirt.dds\",\n \"gta_int.img/sfhsm2.txd/ah_pluskirt.dds\",\"gta_int.img/labigsave.txd/ah_pluskirt.dds\",\n \"gta_int.img/sfhsmedium1.txd/ah_pluskirt.dds\",\"gta_int.img/labigsave.txd/ah_pluskirt.dds\",\n \"gta_int.img/sfmansion1.txd/ah_pluskirt.dds\",\"gta_int.img/labigsave.txd/ah_pluskirt.dds\",\n \"gta_int.img/svlamid.txd/ah_pluskirt.dds\",\"gta_int.img/labigsave.txd/ah_pluskirt.dds\",\n \"gta_int.img/svvgmid.txd/ah_pluskirt.dds\",\"gta_int.img/labigsave.txd/ah_pluskirt.dds\",\n \"gta_int.img/sfhsb3.txd/ah_walltile1.dds\",\"gta_int.img/labigsave.txd/ah_walltile1.dds\",\n \"gta_int.img/madbedrooms.txd/ah_wallstyle1.dds\",\"gta_int.img/labigsave.txd/ah_wallstyle1.dds\",\n \"gta_int.img/madpoolbit.txd/ah_wallstyle1.dds\",\"gta_int.img/labigsave.txd/ah_wallstyle1.dds\",\n \"gta_int.img/sfmansion1.txd/ah_wallstyle1.dds\",\"gta_int.img/labigsave.txd/ah_wallstyle1.dds\",\n \"gta_int.img/sfmansion1.txd/ah_flroortile1.dds\",\"gta_int.img/labigsave.txd/ah_flroortile1.dds\",\n \"gta_int.img/sfhosemed2.txd/ah_curwall.dds\",\"gta_int.img/labigsave.txd/ah_curwall.dds\",\n \"gta_int.img/sfhsm2.txd/ah_curwall.dds\",\"gta_int.img/labigsave.txd/ah_curwall.dds\",\n \"gta_int.img/sfhsmedium1.txd/ah_curwall.dds\",\"gta_int.img/labigsave.txd/ah_curwall.dds\",\n \"gta_int.img/sfmansion1.txd/ah_curwall.dds\",\"gta_int.img/labigsave.txd/ah_curwall.dds\",\n \"gta_int.img/sfhsb2bits.txd/ah_posmarskirt.dds\",\"gta_int.img/labigsave.txd/ah_posmarskirt.dds\",\n \"gta_int.img/sfhsm1.txd/ah_posmarskirt.dds\",\"gta_int.img/labigsave.txd/ah_posmarskirt.dds\",\n \"gta_int.img/sfmansion1.txd/ah_posmarskirt.dds\",\"gta_int.img/labigsave.txd/ah_posmarskirt.dds\",\n \"gta_int.img/svlamid.txd/ah_posmarskirt.dds\",\"gta_int.img/labigsave.txd/ah_posmarskirt.dds\",\n \"gta_int.img/lahss2aint2.txd/hs3_light3.dds\",\"gta_int.img/lahss2_2int2.txd/hs3_light3.dds\",\n \"gta_int.img/vgshm3int2.txd/hs3_light3.dds\",\"gta_int.img/lahss2_2int2.txd/hs3_light3.dds\",\n \"gta_int.img/lahss2bint2.txd/hs2_blind3.dds\",\"gta_int.img/lahss2aint2.txd/hs2_blind3.dds\",\n \"gta_int.img/masmall3int2.txd/hs2_blind3.dds\",\"gta_int.img/lahss2aint2.txd/hs2_blind3.dds\",\n \"gta_int.img/vghsb3int2.txd/hs2_blind3.dds\",\"gta_int.img/lahss2aint2.txd/hs2_blind3.dds\",\n \"gta_int.img/vghss1int2.txd/hs2_blind3.dds\",\"gta_int.img/lahss2aint2.txd/hs2_blind3.dds\",\n \"gta_int.img/lahss2bint2.txd/hs2_wall6.dds\",\"gta_int.img/lahss2aint2.txd/hs2_wall6.dds\",\n \"gta_int.img/lahss2int2.txd/hs2_wall6.dds\",\"gta_int.img/lahss2aint2.txd/hs2_wall6.dds\",\n \"gta_int.img/masmall3int2.txd/hs2_wall6.dds\",\"gta_int.img/lahss2aint2.txd/hs2_wall6.dds\",\n \"gta_int.img/vghsb3int2.txd/hs2_wall6.dds\",\"gta_int.img/lahss2aint2.txd/hs2_wall6.dds\",\n \"gta_int.img/vghss1int2.txd/hs2_wall6.dds\",\"gta_int.img/lahss2aint2.txd/hs2_wall6.dds\",\n \"gta_int.img/vgshm2int2.txd/hs2_wall6.dds\",\"gta_int.img/lahss2aint2.txd/hs2_wall6.dds\",\n \"gta_int.img/lahss2bint2.txd/hs2_curt3.dds\",\"gta_int.img/lahss2aint2.txd/hs2_curt3.dds\",\n \"gta_int.img/lahss2int2.txd/hs2_curt3.dds\",\"gta_int.img/lahss2aint2.txd/hs2_curt3.dds\",\n \"gta_int.img/vghss1int2.txd/hs2_curt3.dds\",\"gta_int.img/lahss2aint2.txd/hs2_curt3.dds\",\n \"gta_int.img/lahss2bint2.txd/hs2_blind1.dds\",\"gta_int.img/lahss2aint2.txd/hs2_blind1.dds\",\n \"gta_int.img/masmall3int2.txd/hs2_blind1.dds\",\"gta_int.img/lahss2aint2.txd/hs2_blind1.dds\",\n \"gta_int.img/vghsb3int2.txd/hs2_blind1.dds\",\"gta_int.img/lahss2aint2.txd/hs2_blind1.dds\",\n \"gta_int.img/vghss1int2.txd/hs2_blind1.dds\",\"gta_int.img/lahss2aint2.txd/hs2_blind1.dds\",\n \"gta_int.img/lahss2bint2.txd/hs1_shade.dds\",\"gta_int.img/lahss2aint2.txd/hs1_shade.dds\",\n \"gta_int.img/masmall3int2.txd/hs1_shade.dds\",\"gta_int.img/lahss2aint2.txd/hs1_shade.dds\",\n \"gta_int.img/vghsb3int2.txd/hs1_shade.dds\",\"gta_int.img/lahss2aint2.txd/hs1_shade.dds\",\n \"gta_int.img/vghss1int2.txd/hs1_shade.dds\",\"gta_int.img/lahss2aint2.txd/hs1_shade.dds\",\n \"gta_int.img/vgshm2int2.txd/hs1_shade.dds\",\"gta_int.img/lahss2aint2.txd/hs1_shade.dds\",\n \"gta_int.img/vgshm3int2.txd/hs1_shade.dds\",\"gta_int.img/lahss2aint2.txd/hs1_shade.dds\",\n \"gta_int.img/lahss2bint2.txd/hs2_artex4.dds\",\"gta_int.img/lahss2aint2.txd/hs2_artex4.dds\",\n \"gta_int.img/lahss2bint2.txd/hs2_artex2.dds\",\"gta_int.img/lahss2aint2.txd/hs2_artex2.dds\",\n \"gta_int.img/lahss2int2.txd/hs2_artex2.dds\",\"gta_int.img/lahss2aint2.txd/hs2_artex2.dds\",\n \"gta_int.img/masmall3int2.txd/hs2_artex2.dds\",\"gta_int.img/lahss2aint2.txd/hs2_artex2.dds\",\n \"gta_int.img/vghsb3int2.txd/hs2_artex2.dds\",\"gta_int.img/lahss2aint2.txd/hs2_artex2.dds\",\n \"gta_int.img/vghss1int2.txd/hs2_artex2.dds\",\"gta_int.img/lahss2aint2.txd/hs2_artex2.dds\",\n \"gta_int.img/vgshm2int2.txd/hs2_artex2.dds\",\"gta_int.img/lahss2aint2.txd/hs2_artex2.dds\",\n \"gta_int.img/vgshm3int2.txd/hs2_artex2.dds\",\"gta_int.img/lahss2aint2.txd/hs2_artex2.dds\",\n \"gta_int.img/vghss1int2.txd/hs2_wall4.dds\",\"gta_int.img/lahss2aint2.txd/hs2_wall4.dds\",\n \"gta_int.img/lahss2bint2.txd/hs2_floor1.dds\",\"gta_int.img/lahss2aint2.txd/hs2_floor1.dds\",\n \"gta_int.img/vghss1int2.txd/hs2_floor1.dds\",\"gta_int.img/lahss2aint2.txd/hs2_floor1.dds\",\n \"gta_int.img/lahss2bint2.txd/hs1_2wall3.dds\",\"gta_int.img/lahss2aint2.txd/hs1_2wall3.dds\",\n \"gta_int.img/masmall3int2.txd/hs1_2wall3.dds\",\"gta_int.img/lahss2aint2.txd/hs1_2wall3.dds\",\n \"gta_int.img/vghsb3int2.txd/hs1_2wall3.dds\",\"gta_int.img/lahss2aint2.txd/hs1_2wall3.dds\",\n \"gta_int.img/vghss1int2.txd/hs1_2wall3.dds\",\"gta_int.img/lahss2aint2.txd/hs1_2wall3.dds\",\n \"gta_int.img/lahss2bint2.txd/hs_plug.dds\",\"gta_int.img/lahss2aint2.txd/hs_plug.dds\",\n \"gta_int.img/lahss2int2.txd/hs_plug.dds\",\"gta_int.img/lahss2aint2.txd/hs_plug.dds\",\n \"gta_int.img/lamidint2.txd/hs_plug.dds\",\"gta_int.img/lahss2aint2.txd/hs_plug.dds\",\n \"gta_int.img/lasmall2int2.txd/hs_plug.dds\",\"gta_int.img/lahss2aint2.txd/hs_plug.dds\",\n \"gta_int.img/masmall3int2.txd/hs_plug.dds\",\"gta_int.img/lahss2aint2.txd/hs_plug.dds\",\n \"gta_int.img/vghsb3int2.txd/hs_plug.dds\",\"gta_int.img/lahss2aint2.txd/hs_plug.dds\",\n \"gta_int.img/vghss1int2.txd/hs_plug.dds\",\"gta_int.img/lahss2aint2.txd/hs_plug.dds\",\n \"gta_int.img/vgshm2int2.txd/hs_plug.dds\",\"gta_int.img/lahss2aint2.txd/hs_plug.dds\",\n \"gta_int.img/vgshm3int2.txd/hs_plug.dds\",\"gta_int.img/lahss2aint2.txd/hs_plug.dds\",\n \"gta_int.img/vgshs2int2.txd/hs_plug.dds\",\"gta_int.img/lahss2aint2.txd/hs_plug.dds\",\n \"gta_int.img/lahss2bint2.txd/hs1_wall2.dds\",\"gta_int.img/lahss2aint2.txd/hs1_wall2.dds\",\n \"gta_int.img/lahss2int2.txd/hs1_wall2.dds\",\"gta_int.img/lahss2aint2.txd/hs1_wall2.dds\",\n \"gta_int.img/masmall3int2.txd/hs1_wall2.dds\",\"gta_int.img/lahss2aint2.txd/hs1_wall2.dds\",\n \"gta_int.img/vghsb3int2.txd/hs1_wall2.dds\",\"gta_int.img/lahss2aint2.txd/hs1_wall2.dds\",\n \"gta_int.img/vghss1int2.txd/hs1_wall2.dds\",\"gta_int.img/lahss2aint2.txd/hs1_wall2.dds\",\n \"gta_int.img/lahss2int2.txd/hs1_carpet1.dds\",\"gta_int.img/lahss2aint2.txd/hs1_carpet1.dds\",\n \"gta_int.img/masmall3int2.txd/hs1_carpet1.dds\",\"gta_int.img/lahss2aint2.txd/hs1_carpet1.dds\",\n \"gta_int.img/vghss1int2.txd/hs1_carpet1.dds\",\"gta_int.img/lahss2aint2.txd/hs1_carpet1.dds\",\n \"gta_int.img/vgshm3int2.txd/hs1_shade3.dds\",\"gta_int.img/lahss2bint2.txd/hs1_shade3.dds\",\n \"gta_int.img/lahss2int2.txd/hs2_artex6.dds\",\"gta_int.img/lahss2bint2.txd/hs2_artex6.dds\",\n \"gta_int.img/vghss1int2.txd/hs2_artex6.dds\",\"gta_int.img/lahss2bint2.txd/hs2_artex6.dds\",\n \"gta_int.img/vgshm2int2.txd/hs2_artex6.dds\",\"gta_int.img/lahss2bint2.txd/hs2_artex6.dds\",\n \"gta_int.img/masmall3int2.txd/hs3_wall8.dds\",\"gta_int.img/lahss2bint2.txd/hs3_wall8.dds\",\n \"gta_int.img/masmall3int2.txd/dinerfloor.dds\",\"gta_int.img/lahss2bint2.txd/dinerfloor.dds\",\n \"gta_int.img/vghsb3int2.txd/dinerfloor.dds\",\"gta_int.img/lahss2bint2.txd/dinerfloor.dds\",\n \"gta_int.img/vghss1int2.txd/dinerfloor.dds\",\"gta_int.img/lahss2bint2.txd/dinerfloor.dds\",\n \"gta_int.img/vgshm2int2.txd/dinerfloor.dds\",\"gta_int.img/lahss2bint2.txd/dinerfloor.dds\",\n \"gta_int.img/lahss2int2.txd/wh_carpet2.dds\",\"gta_int.img/lahss2bint2.txd/wh_carpet2.dds\",\n \"gta_int.img/vghsb3int2.txd/wh_carpet2.dds\",\"gta_int.img/lahss2bint2.txd/wh_carpet2.dds\",\n \"gta_int.img/whore_main.txd/wh_carpet2.dds\",\"gta_int.img/lahss2bint2.txd/wh_carpet2.dds\",\n \"gta_int.img/masmall3int2.txd/hs2_artex3.dds\",\"gta_int.img/lahss2int2.txd/hs2_artex3.dds\",\n \"gta_int.img/vghsb3int2.txd/hs2_artex3.dds\",\"gta_int.img/lahss2int2.txd/hs2_artex3.dds\",\n \"gta_int.img/vghss1int2.txd/hs2_artex3.dds\",\"gta_int.img/lahss2int2.txd/hs2_artex3.dds\",\n \"gta_int.img/vghss1int2.txd/hs2_artex1.dds\",\"gta_int.img/lahss2int2.txd/hs2_artex1.dds\",\n \"gta_int.img/vgshm2int2.txd/hs2_artex1.dds\",\"gta_int.img/lahss2int2.txd/hs2_artex1.dds\",\n \"gta_int.img/vgshm3int2.txd/hs2_artex1.dds\",\"gta_int.img/lahss2int2.txd/hs2_artex1.dds\",\n \"gta_int.img/vghss1int2.txd/hs2_wall2.dds\",\"gta_int.img/lahss2int2.txd/hs2_wall2.dds\",\n \"gta_int.img/whore_main.txd/hs2_wall2.dds\",\"gta_int.img/lahss2int2.txd/hs2_wall2.dds\",\n \"gta_int.img/masmall3int2.txd/hs2_curt5.dds\",\"gta_int.img/lahss2int2.txd/hs2_curt5.dds\",\n \"gta_int.img/vghsb3int2.txd/hs2_curt5.dds\",\"gta_int.img/lahss2int2.txd/hs2_curt5.dds\",\n \"gta_int.img/lee_strip2.txd/wh_carpet1.dds\",\"gta_int.img/lahss2int2.txd/wh_carpet1.dds\",\n \"gta_int.img/masmall3int2.txd/wh_carpet1.dds\",\"gta_int.img/lahss2int2.txd/wh_carpet1.dds\",\n \"gta_int.img/vghss1int2.txd/wh_carpet1.dds\",\"gta_int.img/lahss2int2.txd/wh_carpet1.dds\",\n \"gta_int.img/whore_main.txd/wh_carpet1.dds\",\"gta_int.img/lahss2int2.txd/wh_carpet1.dds\",\n \"gta_int.img/whore_rms.txd/wh_carpet1.dds\",\"gta_int.img/lahss2int2.txd/wh_carpet1.dds\",\n \"gta_int.img/masmall3int2.txd/hs1_wall3.dds\",\"gta_int.img/lahss2int2.txd/hs1_wall3.dds\",\n \"gta_int.img/vghsb3int2.txd/hs1_wall3.dds\",\"gta_int.img/lahss2int2.txd/hs1_wall3.dds\",\n \"gta_int.img/vghss1int2.txd/hs1_wall3.dds\",\"gta_int.img/lahss2int2.txd/hs1_wall3.dds\",\n \"gta_int.img/masmall3int2.txd/hs1_wall1.dds\",\"gta_int.img/lahss2int2.txd/hs1_wall1.dds\",\n \"gta_int.img/vghsb3int2.txd/hs1_wall1.dds\",\"gta_int.img/lahss2int2.txd/hs1_wall1.dds\",\n \"gta_int.img/vghss1int2.txd/hs1_wall1.dds\",\"gta_int.img/lahss2int2.txd/hs1_wall1.dds\",\n \"gta_int.img/masmall3int2.txd/wh_carpet4.dds\",\"gta_int.img/lahss2int2.txd/wh_carpet4.dds\",\n \"gta_int.img/vghsb3int2.txd/wh_carpet4.dds\",\"gta_int.img/lahss2int2.txd/wh_carpet4.dds\",\n \"gta_int.img/vghss1int2.txd/wh_carpet4.dds\",\"gta_int.img/lahss2int2.txd/wh_carpet4.dds\",\n \"gta_int.img/vgshm2int2.txd/wh_carpet4.dds\",\"gta_int.img/lahss2int2.txd/wh_carpet4.dds\",\n \"gta_int.img/vgshm3int2.txd/wh_carpet4.dds\",\"gta_int.img/lahss2int2.txd/wh_carpet4.dds\",\n \"gta_int.img/rystuff.txd/mp_apt1_roomwall.dds\",\"gta_int.img/lamidint2.txd/mp_apt1_roomwall.dds\",\n \"gta_int.img/ryhall.txd/mp_apt1_door.dds\",\"gta_int.img/lamidint2.txd/mp_apt1_door.dds\",\n \"gta_int.img/rylounge.txd/mp_apt1_kitchfloor.dds\",\"gta_int.img/lamidint2.txd/mp_apt1_kitchfloor.dds\",\n \"gta_int.img/rystuff.txd/mp_apt1_kitchfloor.dds\",\"gta_int.img/lamidint2.txd/mp_apt1_kitchfloor.dds\",\n \"gta_int.img/lasmallkitch.txd/washmchne_1.dds\",\"gta_int.img/lasmall1int2.txd/washmchne_1.dds\",\n \"gta_int.img/mrk_kitstuf.txd/washmchne_1.dds\",\"gta_int.img/lasmall1int2.txd/washmchne_1.dds\",\n \"gta_int.img/tr_kb_bits.txd/washmchne_1.dds\",\"gta_int.img/lasmall1int2.txd/washmchne_1.dds\",\n \"gta_int.img/lasmallkitch.txd/cooker1.dds\",\"gta_int.img/lasmall1int2.txd/cooker1.dds\",\n \"gta_int.img/mrk_kitstuf.txd/cooker1.dds\",\"gta_int.img/lasmall1int2.txd/cooker1.dds\",\n \"gta_int.img/trailerkb.txd/cooker1.dds\",\"gta_int.img/lasmall1int2.txd/cooker1.dds\",\n \"gta_int.img/lasmallkitch.txd/hob_1.dds\",\"gta_int.img/lasmall1int2.txd/hob_1.dds\",\n \"gta_int.img/mrk_kitstuf.txd/hob_1.dds\",\"gta_int.img/lasmall1int2.txd/hob_1.dds\",\n \"gta_int.img/lasmallkitch.txd/kb_sink2.dds\",\"gta_int.img/lasmall1int2.txd/kb_sink2.dds\",\n \"gta_int.img/mrk_kitstuf.txd/kb_sink2.dds\",\"gta_int.img/lasmall1int2.txd/kb_sink2.dds\",\n \"gta_int.img/lasmallkitch.txd/la_kitch4.dds\",\"gta_int.img/lasmall1int2.txd/la_kitch4.dds\",\n \"gta_int.img/mrk_kitstuf.txd/la_kitch4.dds\",\"gta_int.img/lasmall1int2.txd/la_kitch4.dds\",\n \"gta_int.img/lasmallsave.txd/burglry_wall7.dds\",\"gta_int.img/lasmall1int2.txd/burglry_wall7.dds\",\n \"gta_int.img/sweetshall.txd/ab_tile4.dds\",\"gta_int.img/lasmallsave.txd/ab_tile4.dds\",\n \"gta_int.img/lee_strip2_1.txd/bdup_wine.dds\",\"gta_int.img/lee_bdupsflat.txd/bdup_wine.dds\",\n \"gta_int.img/ryfurn2.txd/mp_sprunk2dirty.dds\",\"gta_int.img/lee_bdupsflat.txd/mp_sprunk2dirty.dds\",\n \"gta_int.img/ryfurn2.txd/mp_gen_bin_bag.dds\",\"gta_int.img/lee_bdupsflat.txd/mp_gen_bin_bag.dds\",\n \"gta_int.img/proc_rub.txd/cj_lid.dds\",\"gta_int.img/lee_bdupsflat.txd/cj_lid.dds\",\n \"gta_int.img/ryfurn2.txd/cj_lid.dds\",\"gta_int.img/lee_bdupsflat.txd/cj_lid.dds\",\n \"gta_int.img/police_props_un.txd/usaflag.dds\",\"gta_int.img/lee_bdupsflat.txd/usaflag.dds\",\n \"gta_int.img/proc_rub.txd/usaflag.dds\",\"gta_int.img/lee_bdupsflat.txd/usaflag.dds\",\n \"gta_int.img/ryfurn2.txd/usaflag.dds\",\"gta_int.img/lee_bdupsflat.txd/usaflag.dds\",\n \"gta_int.img/lee_txd.txd/strip_chair.dds\",\"gta_int.img/lee_chair1.txd/strip_chair.dds\",\n \"gta_int.img/shop_shelf1.txd/till1.dds\",\"gta_int.img/lee_strip2_1.txd/till1.dds\",\n \"gta_int.img/shop_till.txd/till1.dds\",\"gta_int.img/lee_strip2_1.txd/till1.dds\",\n \"gta_int.img/lee_stripclub1.txd/cj_neon_heart.dds\",\"gta_int.img/lee_strip2_1.txd/cj_neon_heart.dds\",\n \"gta_int.img/whore_rms.txd/wh_hbo1.dds\",\"gta_int.img/lee_strip2.txd/wh_hbo1.dds\",\n \"gta_int.img/whore_main.txd/wh_hbed.dds\",\"gta_int.img/lee_strip2.txd/wh_hbed.dds\",\n \"gta_int.img/whore_rms.txd/wh_hbed.dds\",\"gta_int.img/lee_strip2.txd/wh_hbed.dds\",\n \"gta_int.img/lee_stripclub.txd/strip_neon2.dds\",\"gta_int.img/lee_strip2.txd/strip_neon2.dds\",\n \"gta_int.img/lee_stripclub.txd/strip_neon1.dds\",\"gta_int.img/lee_strip2.txd/strip_neon1.dds\",\n \"gta_int.img/masmall3int2.txd/hs3_wall1.dds\",\"gta_int.img/lee_strip2.txd/hs3_wall1.dds\",\n \"gta_int.img/vgshm2int2.txd/hs3_wall1.dds\",\"gta_int.img/lee_strip2.txd/hs3_wall1.dds\",\n \"gta_int.img/whore_main.txd/hs3_wall1.dds\",\"gta_int.img/lee_strip2.txd/hs3_wall1.dds\",\n \"gta_int.img/lee_stripclub.txd/strip_ceiling.dds\",\"gta_int.img/lee_strip2.txd/strip_ceiling.dds\",\n \"gta_int.img/lee_studhall.txd/strip_ceiling.dds\",\"gta_int.img/lee_strip2.txd/strip_ceiling.dds\",\n \"gta_int.img/whore_main.txd/strip_ceiling.dds\",\"gta_int.img/lee_strip2.txd/strip_ceiling.dds\",\n \"gta_int.img/lee_stripclub.txd/cl_of_wltemp.dds\",\"gta_int.img/lee_strip2.txd/strip_wall.dds\",\n \"gta_int.img/svsfsm.txd/strip_carpet.dds\",\"gta_int.img/lee_strip2.txd/strip_carpet.dds\",\n \"gta_int.img/lee_strippriv.txd/strip_plantpot.dds\",\"gta_int.img/lee_stripclub.txd/strip_plantpot.dds\",\n \"gta_int.img/lee_strippriv.txd/strip_plantbark.dds\",\"gta_int.img/lee_stripclub.txd/strip_plantbark.dds\",\n \"gta_int.img/lee_strippriv.txd/strip_plant.dds\",\"gta_int.img/lee_stripclub.txd/strip_plant.dds\",\n \"gta_int.img/whore_furn.txd/strip_sofa.dds\",\"gta_int.img/lee_stripclub.txd/strip_sofa.dds\",\n \"gta_int.img/whore_furn.txd/wh_curtains.dds\",\"gta_int.img/lee_strippriv.txd/wh_curtains.dds\",\n \"gta_int.img/whore_furn.txd/wh_sofa.dds\",\"gta_int.img/lee_strippriv.txd/wh_sofa.dds\",\n \"gta_int.img/whore_rms.txd/wh_chang1.dds\",\"gta_int.img/lee_strippriv.txd/wh_chang1.dds\",\n \"gta_int.img/whore_rms.txd/wh_chang.dds\",\"gta_int.img/lee_strippriv.txd/wh_chang.dds\",\n \"gta_int.img/whore_rms.txd/wh_fan.dds\",\"gta_int.img/lee_strippriv.txd/wh_fan.dds\",\n \"gta_int.img/whore_rms.txd/wh_cpik.dds\",\"gta_int.img/lee_strippriv.txd/wh_cpik.dds\",\n \"gta_int.img/l_vggybox.txd/crash_pad.dds\",\"gta_int.img/lring_gmint3.txd/crash_pad.dds\",\n \"gta_int.img/l_vggybox.txd/crash_pad_red.dds\",\"gta_int.img/lring_gmint3.txd/crash_pad_red.dds\",\n \"gta_int.img/l_vggybox.txd/clamp.dds\",\"gta_int.img/lring_gmint3.txd/clamp.dds\",\n \"gta_int.img/l_vggybox.txd/rope_1.dds\",\"gta_int.img/lring_gmint3.txd/rope_1.dds\",\n \"gta_int.img/l_vggybox.txd/nuringtest.dds\",\"gta_int.img/lring_gmint3.txd/nuringtest.dds\",\n \"gta_int.img/madpoolbit.txd/ah_wallstyle2.dds\",\"gta_int.img/madbedrooms.txd/ah_wallstyle2.dds\",\n \"gta_int.img/vegassavesmal.txd/ah_wallstyle2.dds\",\"gta_int.img/madbedrooms.txd/ah_wallstyle2.dds\",\n \"gta_int.img/sfhsb3.txd/ah_flroortile4.dds\",\"gta_int.img/madpoolbit.txd/ah_flroortile4.dds\",\n \"gta_int.img/sfmansion1.txd/ah_flroortile4.dds\",\"gta_int.img/madpoolbit.txd/ah_flroortile4.dds\",\n \"gta_int.img/svvgmid.txd/ah_flroortile4.dds\",\"gta_int.img/madpoolbit.txd/ah_flroortile4.dds\",\n \"gta_int.img/vegassavesmal.txd/ah_flroortile4.dds\",\"gta_int.img/madpoolbit.txd/ah_flroortile4.dds\",\n \"gta_int.img/mafcasmain.txd/ab_tilestar.dds\",\"gta_int.img/mafcasmain.txd/ab_tilestar2.dds\",\n \"gta_int.img/mafiacasino01.txd/ab_marblediamond.dds\",\"gta_int.img/mafcasmain.txd/ab_marblediamond.dds\",\n \"gta_int.img/mafcastopfoor.txd/ele_flr.dds\",\"gta_int.img/mafcasmain.txd/ele_flr.dds\",\n \"gta_int.img/mafiacasino01.txd/ele_flr.dds\",\"gta_int.img/mafcasmain.txd/ele_flr.dds\",\n \"gta_int.img/mafiacasino01.txd/ab_panel5.dds\",\"gta_int.img/mafcasmain.txd/ab_panel5.dds\",\n \"gta_int.img/triad_main.txd/sign_managersuite.dds\",\"gta_int.img/mafcasmain.txd/sign_managersuite.dds\",\n \"gta_int.img/mafiacasino01.txd/casino_carp.dds\",\"gta_int.img/mafcasmain.txd/casino_carp.dds\",\n \"gta_int.img/mafiacasino01.txd/marble_wall.dds\",\"gta_int.img/mafcasmain.txd/marble_wall.dds\",\n \"gta_int.img/mafiacasino01.txd/marble_wall2.dds\",\"gta_int.img/mafcasmain.txd/marble_wall2.dds\",\n \"gta_int.img/mafiacasino01.txd/ab_carpgreenedge.dds\",\"gta_int.img/mafcasmain.txd/ab_carpgreenedge.dds\",\n \"gta_int.img/maint3.txd/sign_caution.dds\",\"gta_int.img/mafcas_signs.txd/sign_caution.dds\",\n \"gta_int.img/paperchasebits.txd/sign_caution.dds\",\"gta_int.img/mafcas_signs.txd/sign_caution.dds\",\n \"gta_int.img/maint3.txd/sign_donot.dds\",\"gta_int.img/mafcas_signs.txd/sign_donot.dds\",\n \"gta_int.img/paperchasebits.txd/sign_donot.dds\",\"gta_int.img/mafcas_signs.txd/sign_donot.dds\",\n \"gta_int.img/paperchasebits.txd/sign_notice.dds\",\"gta_int.img/mafcas_signs.txd/sign_notice.dds\",\n \"gta_int.img/papaerchaseoffice.txd/cop_ceiling1.dds\",\"gta_int.img/mafcastopfoor.txd/cop_ceiling1.dds\",\n \"gta_int.img/traidman.txd/cof_wind1.dds\",\"gta_int.img/mafiacasinodl.txd/cof_wind1.dds\",\n \"gta_int.img/vghsb3int2.txd/hs2_curt2.dds\",\"gta_int.img/masmall3int2.txd/hs2_curt2.dds\",\n \"gta_int.img/vghss1int2.txd/hs2_curt2.dds\",\"gta_int.img/masmall3int2.txd/hs2_curt2.dds\",\n \"gta_int.img/vghsb3int2.txd/hs2_wall3.dds\",\"gta_int.img/masmall3int2.txd/hs2_wall3.dds\",\n \"gta_int.img/vghss1int2.txd/hs2_wall3.dds\",\"gta_int.img/masmall3int2.txd/hs2_wall3.dds\",\n \"gta_int.img/vghsb3int2.txd/hs3_light.dds\",\"gta_int.img/masmall3int2.txd/hs3_light.dds\",\n \"gta_int.img/whore_main.txd/hs3_light.dds\",\"gta_int.img/masmall3int2.txd/hs3_light.dds\",\n \"gta_int.img/vghsb3int2.txd/hs3_wall3.dds\",\"gta_int.img/masmall3int2.txd/hs3_wall3.dds\",\n \"gta_int.img/sfhsmedium1.txd/motel_curt1.dds\",\"gta_int.img/motel_skuzwin.txd/motel_curt1.dds\",\n \"gta_int.img/smallsfhs.txd/motel_curt1.dds\",\"gta_int.img/motel_skuzwin.txd/motel_curt1.dds\",\n \"gta_int.img/sweetsmain.txd/motel_curt1.dds\",\"gta_int.img/motel_skuzwin.txd/motel_curt1.dds\",\n \"gta_int.img/mp_diner2.txd/mp_cj_sheetmetal.dds\",\"gta_int.img/mp_diner1.txd/mp_cj_sheetmetal.dds\",\n \"gta_int.img/rystuff.txd/mp_cj_cardboard128.dds\",\"gta_int.img/mp_diner1.txd/mp_cj_cardboard128.dds\",\n \"gta_int.img/mp_diner2.txd/mp_diner_swing.dds\",\"gta_int.img/mp_diner1.txd/mp_diner_swing.dds\",\n \"gta_int.img/mp_diner2.txd/mp_diner_wall.dds\",\"gta_int.img/mp_diner1.txd/mp_diner_wall.dds\",\n \"gta_int.img/sweetslites.txd/mp_diner_table.dds\",\"gta_int.img/mp_diner2.txd/mp_diner_table.dds\",\n \"gta_int.img/whorebits.txd/mp_diner_table.dds\",\"gta_int.img/mp_diner2.txd/mp_diner_table.dds\",\n \"gta_int.img/new_cabinets.txd/meat1.dds\",\"gta_int.img/new_cabinets3.txd/meat1.dds\",\n \"gta_int.img/new_cabinets.txd/meat2.dds\",\"gta_int.img/new_cabinets3.txd/meat2.dds\",\n \"gta_int.img/new_cabinets.txd/cabinet_hilite.dds\",\"gta_int.img/new_cabinets3.txd/cabinet_hilite.dds\",\n \"gta_int.img/new_cabinets.txd/cabinet_hi3.dds\",\"gta_int.img/new_cabinets3.txd/cabinet_hi3.dds\",\n \"gta_int.img/new_cabinets.txd/cabinet_hi1b.dds\",\"gta_int.img/new_cabinets3.txd/cabinet_hi1b.dds\",\n \"gta_int.img/shop_shelf1.txd/cabinet_hi1b.dds\",\"gta_int.img/new_cabinets3.txd/cabinet_hi1b.dds\",\n \"gta_int.img/new_cabinets.txd/cabinet_hi1.dds\",\"gta_int.img/new_cabinets3.txd/cabinet_hi1.dds\",\n \"gta_int.img/shop_shelf1.txd/cabinet_hi1.dds\",\"gta_int.img/new_cabinets3.txd/cabinet_hi1.dds\",\n \"gta_int.img/shop_shelf1.txd/shelf4.dds\",\"gta_int.img/new_cabinets.txd/shelf4.dds\",\n \"gta_int.img/whorerooms.txd/ah_stripwallcln.dds\",\"gta_int.img/newcrak.txd/ah_stripwallcln.dds\",\n \"gta_int.img/sfhsm2.txd/carp21s.dds\",\"gta_int.img/newcrak.txd/carp21s.dds\",\n \"gta_int.img/sfmansion1.txd/carp21s.dds\",\"gta_int.img/newcrak.txd/carp21s.dds\",\n \"gta_int.img/vgshs2int2.txd/carp21s.dds\",\"gta_int.img/newcrak.txd/carp21s.dds\",\n \"gta_int.img/sweetsbits.txd/ab_wall2.dds\",\"gta_int.img/newcrak.txd/ab_wall2.dds\",\n \"gta_int.img/sweetshall.txd/ab_wall2.dds\",\"gta_int.img/newcrak.txd/ab_wall2.dds\",\n \"gta_int.img/rystuff.txd/ab_rug.dds\",\"gta_int.img/newcrak.txd/ab_rug.dds\",\n \"gta_int.img/svlabigbits.txd/ah_blindsm.dds\",\"gta_int.img/newcrak.txd/ah_blindsm.dds\",\n \"gta_int.img/sfhsm1.txd/carpet-tile.dds\",\"gta_int.img/newcrak.txd/carpet-tile.dds\",\n \"gta_int.img/sfmansion1.txd/carpet-tile.dds\",\"gta_int.img/newcrak.txd/carpet-tile.dds\",\n \"gta_int.img/svlamid.txd/carpet-tile.dds\",\"gta_int.img/newcrak.txd/carpet-tile.dds\",\n \"gta_int.img/vgshs2int2.txd/carpet-tile.dds\",\"gta_int.img/newcrak.txd/carpet-tile.dds\",\n \"gta_int.img/stadstunt.txd/dresswall1_256.dds\",\"gta_int.img/ovalsurround.txd/dresswall1_256.dds\",\n \"gta_int.img/pleas_dome.txd/club_floor2_sfwtest.dds\",\"gta_int.img/pdomebar.txd/club_floor2_sfwtest.dds\",\n \"gta_int.img/pleas_dome.txd/club_wood1_sfw.dds\",\"gta_int.img/pdomebar.txd/club_wood1_sfw.dds\",\n \"gta_int.img/pleas_dome.txd/ab_weelite.dds\",\"gta_int.img/pdomebar.txd/ab_weelite.dds\",\n \"gta_int.img/vghotelnice.txd/cj_painting27.dds\",\"gta_int.img/picture_frame_clip.txd/cj_painting27.dds\",\n \"gta_int.img/picture_frame.txd/cj_painting3.dds\",\"gta_int.img/picture_frame_clip.txd/cj_painting3.dds\",\n \"gta_int.img/sfhsb2bits.txd/cj_painting3.dds\",\"gta_int.img/picture_frame_clip.txd/cj_painting3.dds\",\n \"gta_int.img/sfhsb2bits.txd/cj_painting17.dds\",\"gta_int.img/picture_frame.txd/cj_painting17.dds\",\n \"gta_int.img/sfhsb2bits.txd/cj_painting31.dds\",\"gta_int.img/picture_frame.txd/cj_painting31.dds\",\n \"gta_int.img/sweetsmain.txd/cj_painting1.dds\",\"gta_int.img/picture_frame.txd/cj_painting1.dds\",\n \"gta_int.img/sweetsmain.txd/cj_painting18.dds\",\"gta_int.img/picture_frame.txd/cj_painting18.dds\",\n \"gta_int.img/sfhsb2bits.txd/cj_painting19.dds\",\"gta_int.img/picture_frame.txd/cj_painting19.dds\",\n \"gta_int.img/skate_shop.txd/cj_fag_but.dds\",\"gta_int.img/proc_rub.txd/cj_fag_but.dds\",\n \"gta_int.img/rc_shop_trains.txd/cj_rc_13.dds\",\"gta_int.img/rc_shop_acc.txd/cj_rc_13.dds\",\n \"gta_int.img/rc_shop_trains.txd/cj_train_set.dds\",\"gta_int.img/rc_shop_acc.txd/cj_train_set.dds\",\n \"gta_int.img/rc_shop_hanger.txd/cj_biplane1.dds\",\"gta_int.img/rc_shop_acc.txd/cj_biplane1.dds\",\n \"gta_int.img/rc_shop_hanger.txd/cj_wing.dds\",\"gta_int.img/rc_shop_acc.txd/cj_wing.dds\",\n \"gta_int.img/svcunthoose.txd/cj_kite3.dds\",\"gta_int.img/rc_shop_hanger.txd/cj_kite3.dds\",\n \"gta_int.img/ryhall.txd/ah_rywood.dds\",\"gta_int.img/rybath.txd/ah_rywood.dds\",\n \"gta_int.img/rylounge.txd/ah_rywood.dds\",\"gta_int.img/rybath.txd/ah_rywood.dds\",\n \"gta_int.img/sfhsb3.txd/ah_rywood.dds\",\"gta_int.img/rybath.txd/ah_rywood.dds\",\n \"gta_int.img/svvgmid.txd/ah_rywood.dds\",\"gta_int.img/rybath.txd/ah_rywood.dds\",\n \"gta_int.img/vgshs2int2.txd/ah_rywood.dds\",\"gta_int.img/rybath.txd/ah_rywood.dds\",\n \"gta_int.img/rylounge.txd/gb_midbarand.dds\",\"gta_int.img/ryhall.txd/gb_midbarand.dds\",\n \"gta_int.img/rylounge.txd/ah_ryskirt.dds\",\"gta_int.img/ryhall.txd/ah_ryskirt.dds\",\n \"gta_int.img/rywins.txd/windo_blinds.dds\",\"gta_int.img/rylounge.txd/windo_blinds.dds\",\n \"gta_int.img/vgshs2int2.txd/ah_rykitiles.dds\",\"gta_int.img/rylounge.txd/ah_rykitiles.dds\",\n \"gta_int.img/sweetsmain.txd/mp_cj_chrome2.dds\",\"gta_int.img/rystuff.txd/mp_cj_chrome2.dds\",\n \"gta_int.img/svsfsm.txd/cspornmag.dds\",\"gta_int.img/savesfmid.txd/cspornmag.dds\",\n \"gta_int.img/sfhsm1.txd/ah_pnwainscot.dds\",\"gta_int.img/savesfmid.txd/ah_pnwainscot.dds\",\n \"gta_int.img/svlamid.txd/ah_pnwainscot.dds\",\"gta_int.img/savesfmid.txd/ah_pnwainscot.dds\",\n \"gta_int.img/sfhsm1.txd/ah_blackmar.dds\",\"gta_int.img/savesfmid.txd/ah_blackmar.dds\",\n \"gta_int.img/svlamid.txd/ah_blackmar.dds\",\"gta_int.img/savesfmid.txd/ah_blackmar.dds\",\n \"gta_int.img/vghotelnice.txd/ah_blackmar.dds\",\"gta_int.img/savesfmid.txd/ah_blackmar.dds\",\n \"gta_int.img/sfhsm2.txd/ah_pnwainscot3.dds\",\"gta_int.img/sfhosemed2.txd/ah_pnwainscot3.dds\",\n \"gta_int.img/sfhsmedium1.txd/ah_pnwainscot3.dds\",\"gta_int.img/sfhosemed2.txd/ah_pnwainscot3.dds\",\n \"gta_int.img/svvgmid.txd/ah_pnwainscot3.dds\",\"gta_int.img/sfhosemed2.txd/ah_pnwainscot3.dds\",\n \"gta_int.img/svvgmid.txd/ah_pnwainskt.dds\",\"gta_int.img/sfhosemed2.txd/ah_pnwainskt.dds\",\n \"gta_int.img/sfhsb3.txd/ah_whtcorn.dds\",\"gta_int.img/sfhosemed2.txd/ah_whtcorn.dds\",\n \"gta_int.img/sfhsm2.txd/ah_whtcorn.dds\",\"gta_int.img/sfhosemed2.txd/ah_whtcorn.dds\",\n \"gta_int.img/sfhsmedium1.txd/ah_whtcorn.dds\",\"gta_int.img/sfhosemed2.txd/ah_whtcorn.dds\",\n \"gta_int.img/sfhss2.txd/ah_whtcorn.dds\",\"gta_int.img/sfhosemed2.txd/ah_whtcorn.dds\",\n \"gta_int.img/smallsfhs.txd/ah_whtcorn.dds\",\"gta_int.img/sfhosemed2.txd/ah_whtcorn.dds\",\n \"gta_int.img/svcunthoose.txd/ah_whtcorn.dds\",\"gta_int.img/sfhosemed2.txd/ah_whtcorn.dds\",\n \"gta_int.img/svsfsm.txd/ah_whtcorn.dds\",\"gta_int.img/sfhosemed2.txd/ah_whtcorn.dds\",\n \"gta_int.img/svvgmid.txd/ah_whtcorn.dds\",\"gta_int.img/sfhosemed2.txd/ah_whtcorn.dds\",\n \"gta_int.img/sweetshall.txd/ah_whtcorn.dds\",\"gta_int.img/sfhosemed2.txd/ah_whtcorn.dds\",\n \"gta_int.img/sweetsmain.txd/ah_whtcorn.dds\",\"gta_int.img/sfhosemed2.txd/ah_whtcorn.dds\",\n \"gta_int.img/sfhsb3.txd/ah_rfplstr.dds\",\"gta_int.img/sfhosemed2.txd/ah_rfplstr.dds\",\n \"gta_int.img/sfhsm2.txd/ah_rfplstr.dds\",\"gta_int.img/sfhosemed2.txd/ah_rfplstr.dds\",\n \"gta_int.img/sfhsmedium1.txd/ah_rfplstr.dds\",\"gta_int.img/sfhosemed2.txd/ah_rfplstr.dds\",\n \"gta_int.img/svvgmid.txd/ah_rfplstr.dds\",\"gta_int.img/sfhosemed2.txd/ah_rfplstr.dds\",\n \"gta_int.img/vgshs2int2.txd/ah_rfplstr.dds\",\"gta_int.img/sfhosemed2.txd/ah_rfplstr.dds\",\n \"gta_int.img/sfmansion1.txd/ah_walltile2.dds\",\"gta_int.img/sfhosemed2.txd/ah_walltile2.dds\",\n \"gta_int.img/svsfsm.txd/ah_walltile2.dds\",\"gta_int.img/sfhosemed2.txd/ah_walltile2.dds\",\n \"gta_int.img/svvgmid.txd/ah_wpaper5.dds\",\"gta_int.img/sfhosemed2.txd/ah_wpaper5.dds\",\n \"gta_int.img/sfmansion1.txd/walp40s.dds\",\"gta_int.img/sfhosemed2.txd/walp40s.dds\",\n \"gta_int.img/sfhsm1.txd/ah_marcorn1.dds\",\"gta_int.img/sfhosemed2.txd/ah_marcorn1.dds\",\n \"gta_int.img/sfhsm2.txd/ah_marcorn1.dds\",\"gta_int.img/sfhosemed2.txd/ah_marcorn1.dds\",\n \"gta_int.img/sfhsmedium1.txd/ah_marcorn1.dds\",\"gta_int.img/sfhosemed2.txd/ah_marcorn1.dds\",\n \"gta_int.img/sfmansion1.txd/ah_marcorn1.dds\",\"gta_int.img/sfhosemed2.txd/ah_marcorn1.dds\",\n \"gta_int.img/svlamid.txd/ah_marcorn1.dds\",\"gta_int.img/sfhosemed2.txd/ah_marcorn1.dds\",\n \"gta_int.img/sfhsb3.txd/ah_ironbal.dds\",\"gta_int.img/sfhosemed2.txd/ah_ironbal.dds\",\n \"gta_int.img/sfhsm2.txd/ah_ironbal.dds\",\"gta_int.img/sfhosemed2.txd/ah_ironbal.dds\",\n \"gta_int.img/sfhsmedium1.txd/ah_ironbal.dds\",\"gta_int.img/sfhosemed2.txd/ah_ironbal.dds\",\n \"gta_int.img/sfrails.txd/ah_ironbal.dds\",\"gta_int.img/sfhosemed2.txd/ah_ironbal.dds\",\n \"gta_int.img/svrails.txd/ah_ironbal.dds\",\"gta_int.img/sfhosemed2.txd/ah_ironbal.dds\",\n \"gta_int.img/svvgmid.txd/ah_ironbal.dds\",\"gta_int.img/sfhosemed2.txd/ah_ironbal.dds\",\n \"gta_int.img/sfhsb3.txd/ah_poshwdflr1.dds\",\"gta_int.img/sfhosemed2.txd/ah_poshwdflr1.dds\",\n \"gta_int.img/sfhsm1.txd/ah_poshwdflr1.dds\",\"gta_int.img/sfhosemed2.txd/ah_poshwdflr1.dds\",\n \"gta_int.img/svlamid.txd/ah_poshwdflr1.dds\",\"gta_int.img/sfhosemed2.txd/ah_poshwdflr1.dds\",\n \"gta_int.img/svvgmid.txd/ah_poshwdflr1.dds\",\"gta_int.img/sfhosemed2.txd/ah_poshwdflr1.dds\",\n \"gta_int.img/sfhsb3.txd/carp19s.dds\",\"gta_int.img/sfhosemed2.txd/carp19s.dds\",\n \"gta_int.img/svvgmid.txd/carp19s.dds\",\"gta_int.img/sfhosemed2.txd/carp19s.dds\",\n \"gta_int.img/trailerkb.txd/carp19s.dds\",\"gta_int.img/sfhosemed2.txd/carp19s.dds\",\n \"gta_int.img/sfhsb2bits.txd/cj_w_grad.dds\",\"gta_int.img/sfhosemed2.txd/cj_w_grad.dds\",\n \"gta_int.img/svbits.txd/cj_w_grad.dds\",\"gta_int.img/sfhosemed2.txd/cj_w_grad.dds\",\n \"gta_int.img/sfhsm2bits.txd/ah_blucurtain.dds\",\"gta_int.img/sfhosemed2.txd/ah_blucurtain.dds\",\n \"gta_int.img/svbits.txd/ah_blucurtain.dds\",\"gta_int.img/sfhosemed2.txd/ah_blucurtain.dds\",\n \"gta_int.img/svlamid.txd/ah_blucurtain.dds\",\"gta_int.img/sfhosemed2.txd/ah_blucurtain.dds\",\n \"gta_int.img/sfmansion1.txd/ah_halltiles.dds\",\"gta_int.img/sfhsb3.txd/ah_halltiles.dds\",\n \"gta_int.img/sweetsmain.txd/ah_skrtmorebroon.dds\",\"gta_int.img/sfhsb3.txd/ah_skrtmorebroon.dds\",\n \"gta_int.img/sweetsmain.txd/ah_pnwainscotbroon.dds\",\"gta_int.img/sfhsb3.txd/ah_pnwainscotbroon.dds\",\n \"gta_int.img/sfhsm2.txd/ah_wpaper6.dds\",\"gta_int.img/sfhsb3.txd/ah_wpaper6.dds\",\n \"gta_int.img/sfhsmedium1.txd/ah_wpaper6.dds\",\"gta_int.img/sfhsb3.txd/ah_wpaper6.dds\",\n \"gta_int.img/sfhsmedium1.txd/ah_flrtile1.dds\",\"gta_int.img/sfhsb3.txd/ah_flrtile1.dds\",\n \"gta_int.img/svvgmid.txd/ah_wpaper4.dds\",\"gta_int.img/sfhsb3.txd/ah_wpaper4.dds\",\n \"gta_int.img/vegassavesmal.txd/ah_wpaper4.dds\",\"gta_int.img/sfhsb3.txd/ah_wpaper4.dds\",\n \"gta_int.img/svvgmid.txd/ah_plnks1.dds\",\"gta_int.img/sfhsb3.txd/ah_plnks1.dds\",\n \"gta_int.img/svlamid.txd/diner_wall1.dds\",\"gta_int.img/sfhsm1.txd/diner_wall1.dds\",\n \"gta_int.img/svlamid.txd/ah_windows1.dds\",\"gta_int.img/sfhsm1.txd/ah_windows1.dds\",\n \"gta_int.img/svlamid.txd/carpet3kb.dds\",\"gta_int.img/sfhsm1.txd/carpet3kb.dds\",\n \"gta_int.img/sfhsm2.txd/ah_pnwainscot6.dds\",\"gta_int.img/sfhsm1.txd/ah_pnwainscot6.dds\",\n \"gta_int.img/sfhsmedium1.txd/ah_pnwainscot6.dds\",\"gta_int.img/sfhsm1.txd/ah_pnwainscot6.dds\",\n \"gta_int.img/sfmansion1.txd/ah_pnwainscot6.dds\",\"gta_int.img/sfhsm1.txd/ah_pnwainscot6.dds\",\n \"gta_int.img/svlamid.txd/ah_pnwainscot6.dds\",\"gta_int.img/sfhsm1.txd/ah_pnwainscot6.dds\",\n \"gta_int.img/svlamid.txd/ah_pnwainscot5.dds\",\"gta_int.img/sfhsm1.txd/ah_pnwainscot5.dds\",\n \"gta_int.img/sfhsm2.txd/ah_bigwoodthing.dds\",\"gta_int.img/sfhsm1.txd/ah_bigwoodthing.dds\",\n \"gta_int.img/svlamid.txd/ah_bigwoodthing.dds\",\"gta_int.img/sfhsm1.txd/ah_bigwoodthing.dds\",\n \"gta_int.img/svlamid.txd/ah_orncorn.dds\",\"gta_int.img/sfhsm1.txd/ah_orncorn.dds\",\n \"gta_int.img/svbits.txd/ah_redcurtain.dds\",\"gta_int.img/sfhsm2bits.txd/ah_redcurtain.dds\",\n \"gta_int.img/svlamid.txd/ah_redcurtain.dds\",\"gta_int.img/sfhsm2bits.txd/ah_redcurtain.dds\",\n \"gta_int.img/sfhsmedium1.txd/wallpnice06.dds\",\"gta_int.img/sfhsm2.txd/wallpnice06.dds\",\n \"gta_int.img/sfhsmedium1.txd/ston09s.dds\",\"gta_int.img/sfhsm2.txd/ston09s.dds\",\n \"gta_int.img/svvgmid.txd/ah_wpaper3.dds\",\"gta_int.img/sfhsmedium1.txd/ah_wpaper3.dds\",\n \"gta_int.img/smallsfhs.txd/mcstraps_wall2.dds\",\"gta_int.img/sfhss2.txd/mcstraps_wall2.dds\",\n \"gta_int.img/svcunthoose.txd/mcstraps_wall2.dds\",\"gta_int.img/sfhss2.txd/mcstraps_wall2.dds\",\n \"gta_int.img/svsfsm.txd/ah_utilbor4.dds\",\"gta_int.img/sfhss2.txd/ah_utilbor4.dds\",\n \"gta_int.img/smallsfhs.txd/ah_rotwindow.dds\",\"gta_int.img/sfhss2.txd/ah_rotwindow.dds\",\n \"gta_int.img/svcunthoose.txd/ah_rotwindow.dds\",\"gta_int.img/sfhss2.txd/ah_rotwindow.dds\",\n \"gta_int.img/smallsfhs.txd/ah_pnwainscot12.dds\",\"gta_int.img/sfhss2.txd/ah_pnwainscot12.dds\",\n \"gta_int.img/svcunthoose.txd/ah_pnwainscot12.dds\",\"gta_int.img/sfhss2.txd/ah_pnwainscot12.dds\",\n \"gta_int.img/svsfsm.txd/ah_pnwainscot12.dds\",\"gta_int.img/sfhss2.txd/ah_pnwainscot12.dds\",\n \"gta_int.img/vegassavesmal.txd/ah_cornice.dds\",\"gta_int.img/sfmansion1.txd/ah_cornice.dds\",\n \"gta_int.img/whorebar.txd/ah_cornice.dds\",\"gta_int.img/sfmansion1.txd/ah_cornice.dds\",\n \"gta_int.img/svsfsm.txd/ah_flroortiledirt1.dds\",\"gta_int.img/smallsfhs.txd/ah_flroortiledirt1.dds\",\n \"gta_int.img/vgshs2int2.txd/ah_whitiles.dds\",\"gta_int.img/smallsfhs.txd/ah_whitiles.dds\",\n \"gta_int.img/sweetsmain.txd/ab_flakeywall.dds\",\"gta_int.img/svcunthoose.txd/ab_flakeywall.dds\",\n \"gta_int.img/svvgmid.txd/ah_flroortile3.dds\",\"gta_int.img/svlamid.txd/ah_flroortile3.dds\",\n \"gta_int.img/vghotelnice.txd/ah_flroortile3.dds\",\"gta_int.img/svlamid.txd/ah_flroortile3.dds\",\n \"gta_int.img/sweets_roon.txd/mcstraps_door1.dds\",\"gta_int.img/sweetshall.txd/mcstraps_door1.dds\",\n \"gta_int.img/sweetsmain.txd/mp_cooker1.dds\",\"gta_int.img/sweetshall.txd/mp_cooker1.dds\",\n \"gta_int.img/sweetsmain.txd/gb_nastybar25.dds\",\"gta_int.img/sweetshall.txd/gb_nastybar25.dds\",\n \"gta_int.img/sweetsmain.txd/ah_dirtywalls8bit2.dds\",\"gta_int.img/sweetshall.txd/ah_dirtywalls8bit2.dds\",\n \"gta_int.img/whorebits.txd/mp_diner_fan.dds\",\"gta_int.img/sweetslites.txd/mp_diner_fan.dds\",\n \"gta_int.img/triad_main.txd/chinese3.dds\",\"gta_int.img/traidman.txd/chinese3.dds\",\n \"gta_int.img/triad_main.txd/chinese8.dds\",\"gta_int.img/traidman.txd/chinese8.dds\",\n \"gta_int.img/triad_main.txd/luxebrown_law.dds\",\"gta_int.img/traidman.txd/luxebrown_law.dds\",\n \"gta_int.img/triad_main.txd/pagodaroof2.dds\",\"gta_int.img/triad_bar.txd/pagodaroof2.dds\",\n \"gta_int.img/triad_main.txd/triad_decor1.dds\",\"gta_int.img/triad_bar.txd/triad_decor1.dds\",\n \"gta_int.img/triad_neon.txd/triad_decor1.dds\",\"gta_int.img/triad_bar.txd/triad_decor1.dds\",\n \"gta_int.img/tricas_neon.txd/triad_decor1.dds\",\"gta_int.img/triad_bar.txd/triad_decor1.dds\",\n \"gta_int.img/vgshm3int2.txd/hs2_2carpet1.dds\",\"gta_int.img/vgshm2int2.txd/hs2_2carpet1.dds\",\n \"gta_int.img/vgshm3int2.txd/hs2_4wall1.dds\",\"gta_int.img/vgshm2int2.txd/hs2_4wall1.dds\",\n \"gta_int.img/vgshm3int2.txd/hs2_wall5.dds\",\"gta_int.img/vgshm2int2.txd/hs2_wall5.dds\",\n \"gta_int.img/vgshm3int2.txd/hsv_carpet2.dds\",\"gta_int.img/vgshm2int2.txd/hsv_carpet2.dds\",\n \"gta_int.img/whorerooms.txd/skirting.dds\",\"gta_int.img/whorebar.txd/skirting.dds\",\n \"gta_int.img/whorewallstuff.txd/skirting.dds\",\"gta_int.img/whorebar.txd/skirting.dds\",\n \"gta_int.img/whorerooms.txd/ah_cheapwindow.dds\",\"gta_int.img/whorebar.txd/ah_cheapwindow.dds\",\n \"gta_int.img/whorerooms.txd/ah_architrave.dds\",\"gta_int.img/whorebar.txd/ah_architrave.dds\",\n \"gta_int.img/whorewallstuff.txd/ah_architrave.dds\",\"gta_int.img/whorebar.txd/ah_architrave.dds\",\n \"gta_int.img/whorerooms.txd/ah_wdblinds.dds\",\"gta_int.img/whorebar.txd/ah_wdblinds.dds\",\n \"gta_int.img/whore_rms.txd/wh_tiles.dds\",\"gta_int.img/whore_main.txd/wh_tiles.dds\",\n \"gta_int.img/whorewallstuff.txd/ah_dirt1.dds\",\"gta_int.img/whorerooms.txd/ah_dirt1.dds\",\n\n // gostown txds\n \"gostown6.img/gp_lots.txd/inferno_material_210.dds\", \"gostown6.img/gp_dt_45.txd/inferno_material_210.dds\",\n \"gta3.img/cj_street_props.txd/cj_plating.dds\", \"gta3.img/break_garden.txd/cj_plating.dds\",\n \"gta3.img/tags_laazteca.txd/grove.dds\", \"gta3.img/tags2_lalae.txd/grove.dds\",\n \"gta3.img/tags_lafront.txd/grove.dds\", \"gta3.img/tags2_lalae.txd/grove.dds\",\n \"gta3.img/tags_lakilo.txd/grove.dds\", \"gta3.img/tags2_lalae.txd/grove.dds\",\n \"gta3.img/tags_larifa.txd/grove.dds\", \"gta3.img/tags2_lalae.txd/grove.dds\",\n \"gta3.img/tags_larollin.txd/grove.dds\", \"gta3.img/tags2_lalae.txd/grove.dds\",\n \"gta3.img/tags_laseville.txd/grove.dds\", \"gta3.img/tags2_lalae.txd/grove.dds\",\n \"gta3.img/tags_latemple.txd/grove.dds\", \"gta3.img/tags2_lalae.txd/grove.dds\",\n \"gta3.img/tags_lavagos.txd/grove.dds\", \"gta3.img/tags2_lalae.txd/grove.dds\",\n \"gta3.img/col_wall2x.txd/wall1.dds\", \"gta3.img/col_wall1x.txd/wall1.dds\",\n \"gta3.img/col_wall3x.txd/wall1.dds\", \"gta3.img/col_wall1x.txd/wall1.dds\",\n \"gostown6.img/gp_dt_45.txd/newall5-2.dds\", \"gostown6.img/gp_dt2930.txd/newall5-2.dds\",\n \"gostown6.img/gp_indubridge.txd/newall5-2.dds\", \"gostown6.img/gp_dt2930.txd/newall5-2.dds\",\n \"gta3.img/break_garden.txd/cj_slatedwood.dds\", \"gta3.img/break_f_w.txd/cj_slatedwood.dds\",\n \"gta3.img/break_s_bins.txd/cj_slatedwood.dds\", \"gta3.img/break_f_w.txd/cj_slatedwood.dds\",\n \"gta3.img/break_s_box.txd/cj_slatedwood.dds\", \"gta3.img/break_f_w.txd/cj_slatedwood.dds\",\n \"gta3.img/break_scaffold.txd/cj_slatedwood.dds\", \"gta3.img/break_f_w.txd/cj_slatedwood.dds\",\n \"gta3.img/break_street1.txd/cj_slatedwood.dds\", \"gta3.img/break_f_w.txd/cj_slatedwood.dds\",\n \"gta3.img/break_street2.txd/cj_slatedwood.dds\", \"gta3.img/break_f_w.txd/cj_slatedwood.dds\",\n \"gta3.img/cart.txd/cj_slatedwood.dds\", \"gta3.img/break_f_w.txd/cj_slatedwood.dds\",\n \"gta3.img/cj_benches.txd/cj_slatedwood.dds\", \"gta3.img/break_f_w.txd/cj_slatedwood.dds\",\n \"gta3.img/cj_bins.txd/cj_slatedwood.dds\", \"gta3.img/break_f_w.txd/cj_slatedwood.dds\",\n \"gta3.img/cj_noodle_1.txd/cj_slatedwood.dds\", \"gta3.img/break_f_w.txd/cj_slatedwood.dds\",\n \"gta3.img/cj_plant_props.txd/cj_slatedwood.dds\", \"gta3.img/break_f_w.txd/cj_slatedwood.dds\",\n \"gta3.img/cr_boxes.txd/cj_slatedwood.dds\", \"gta3.img/break_f_w.txd/cj_slatedwood.dds\",\n \"gta3.img/db_ammo.txd/cj_slatedwood.dds\", \"gta3.img/break_f_w.txd/cj_slatedwood.dds\",\n \"gta3.img/kfencex.txd/cj_slatedwood.dds\", \"gta3.img/break_f_w.txd/cj_slatedwood.dds\",\n \"gta3.img/lv_ammo.txd/cj_slatedwood.dds\", \"gta3.img/break_f_w.txd/cj_slatedwood.dds\",\n \"gostown6.img/gp_dt_45.txd/downtshop9_lan.dds\", \"gostown6.img/gp_dt2930.txd/downtshop9_lan.dds\",\n \"gta3.img/cj_box1.txd/cardboxes_128.dds\", \"gta3.img/boxes.txd/cardboxes_128.dds\",\n \"gta3.img/cm_bxx.txd/cardboxes_128.dds\", \"gta3.img/boxes.txd/cardboxes_128.dds\",\n \"gta3.img/k_boxes.txd/cardboxes_128.dds\", \"gta3.img/boxes.txd/cardboxes_128.dds\",\n \"gta3.img/smash_bxx.txd/cardboxes_128.dds\", \"gta3.img/boxes.txd/cardboxes_128.dds\",\n \"gta3.img/radar43.txd/radar43.dds\", \"gta3.img/radar42.txd/radar42.dds\",\n \"gta3.img/premier.txd/policemiami86body128.dds\", \"gta3.img/copcarla.txd/policemiami86body128.dds\",\n \"gta3.img/taxi.txd/policemiami86body128.dds\", \"gta3.img/copcarla.txd/policemiami86body128.dds\",\n \"gta3.img/impexpx.txd/ws_cargoshipdoor.dds\", \"gta3.img/ad_rmx.txd/ws_cargoshipdoor.dds\",\n \"gta3.img/mdlckdx.txd/ws_cargoshipdoor.dds\", \"gta3.img/ad_rmx.txd/ws_cargoshipdoor.dds\",\n \"gta3.img/rider1dr.txd/ws_basheddoor2.dds\", \"gta3.img/cr1_drx.txd/ws_basheddoor2.dds\",\n \"gta3.img/hotring.txd/hotring92web32.dds\", \"gta3.img/hotrinb.txd/hotrinb92web32.dds\",\n \"gta3.img/genalley.txd/hoteldetails2.dds\", \"gta3.img/alleyprop.txd/hoteldetails2.dds\",\n \"gta3.img/lawnburg.txd/genroof01_128.dds\", \"gta3.img/bs_sfs.txd/genroof01_128.dds\",\n \"gostown6.img/laguna.txd/rocktbrn128.dds\", \"gostown6.img/laguna.txd/roche1.dds\",\n \"gostown6.img/gp_tunnels.txd/metal022.dds\", \"gostown6.img/gp_landbig.txd/metal022.dds\",\n \"gta3.img/cranes_dyn2.txd/ws_oldpaintedyello_b.dds\", \"gta3.img/cranes_dyn2_cj.txd/ws_oldpaintedyello_b.dds\",\n \"gta3.img/jetpack.txd/vehiclegeneric256.dds\", \"gta3.img/hotrina.txd/vehiclegeneric256.dds\",\n \"gta3.img/sanchez.txd/sanchez92gear64.dds\", \"gta3.img/pcj600.txd/pcj60092gear64.dds\",\n \"gta3.img/bball_hpx.txd/gen_chrome.dds\", \"gta3.img/adjumpx.txd/gen_chrome.dds\",\n \"gta3.img/boigas_sfe.txd/gen_chrome.dds\", \"gta3.img/adjumpx.txd/gen_chrome.dds\",\n \"gta3.img/bs_sfs.txd/gen_chrome.dds\", \"gta3.img/adjumpx.txd/gen_chrome.dds\",\n \"gta3.img/burgsh01_law.txd/gen_chrome.dds\", \"gta3.img/adjumpx.txd/gen_chrome.dds\",\n \"gta3.img/cranes_dyn2_cj.txd/gen_chrome.dds\", \"gta3.img/adjumpx.txd/gen_chrome.dds\",\n \"gta3.img/landjump.txd/gen_chrome.dds\", \"gta3.img/adjumpx.txd/gen_chrome.dds\",\n \"gta3.img/lawnburg.txd/gen_chrome.dds\", \"gta3.img/adjumpx.txd/gen_chrome.dds\",\n \"gta3.img/satdish.txd/gen_chrome.dds\", \"gta3.img/adjumpx.txd/gen_chrome.dds\",\n \"gta3.img/wshxrefhse2.txd/gen_chrome.dds\", \"gta3.img/adjumpx.txd/gen_chrome.dds\",\n \"gta3.img/wshxrefpump.txd/metalic128.dds\", \"gta3.img/cs_ry_props.txd/metalic128.dds\",\n \"gostown6.img/gp_tunnels.txd/prxnewall.dds\", \"gostown6.img/gp_landbig.txd/prxnewall.dds\",\n \"gta3.img/icons7.txd/gun_armour.dds\", \"gta3.img/armour.txd/gun_armour.dds\",\n \"gostown6.img/gp_lots.txd/metropillar5.dds\", \"gostown6.img/gp_gss.txd/metropillar5.dds\",\n \"gostown6.img/gp_tunnels.txd/metropillar5.dds\", \"gostown6.img/gp_gss.txd/metropillar5.dds\",\n \"gta3.img/dynbarrels.txd/redmetal.dds\", \"gta3.img/des_xoilfield.txd/redmetal.dds\",\n \"gta3.img/immcrax.txd/redmetal.dds\", \"gta3.img/des_xoilfield.txd/redmetal.dds\",\n \"gta3.img/billbrd.txd/iron.dds\", \"gta3.img/billbox.txd/iron.dds\",\n \"gta3.img/monsterb.txd/monsterb92tyre64.dds\", \"gta3.img/monstera.txd/monstera92tyre64.dds\",\n \"gta3.img/kei_wnchx.txd/noodpot_64.dds\", \"gta3.img/foodkarts.txd/noodpot_64.dds\",\n \"gta3.img/radar09.txd/radar09.dds\", \"gta3.img/radar08.txd/radar08.dds\",\n \"gta3.img/radar10.txd/radar10.dds\", \"gta3.img/radar08.txd/radar08.dds\",\n \"gta3.img/radar11.txd/radar11.dds\", \"gta3.img/radar08.txd/radar08.dds\",\n \"gta3.img/radar134.txd/radar134.dds\", \"gta3.img/radar08.txd/radar08.dds\",\n \"gta3.img/radar06.txd/radar06.dds\", \"gta3.img/radar02.txd/radar02.dds\",\n \"gostown6.img/yacht.txd/yacht_sidnw1.dds\", \"gostown6.img/yachttings.txd/yacht_sidnw1.dds\",\n \"gta3.img/break_road.txd/cj_greenwood.dds\", \"gta3.img/break_f_w.txd/cj_greenwood.dds\",\n \"gta3.img/break_s_fillers.txd/cj_greenwood.dds\", \"gta3.img/break_f_w.txd/cj_greenwood.dds\",\n \"gta3.img/cj_benches.txd/cj_greenwood.dds\", \"gta3.img/break_f_w.txd/cj_greenwood.dds\",\n \"gta3.img/lodcranes_dyn2.txd/lodoldpaintedyello.dds\", \"gta3.img/lodcranes_dyn2_cj.txd/lodoldpaintedyello.dds\",\n \"gostown6.img/gp_landbig.txd/rockwall_moss.dds\", \"gostown6.img/gp_lake.txd/rockwall_moss.dds\",\n \"gta3.img/lawnburg.txd/vgnburgwal3_256.dds\", \"gta3.img/bs_sfs.txd/vgnburgwal3_256.dds\",\n \"gta3.img/tree2prc.txd/bzelka1.dds\", \"gta3.img/tree2prc.txd/bthuja1.dds\",\n \"gta3.img/veg_leaves.txd/kbplanter_plants1.dds\", \"gta3.img/veg_leavesplnt.txd/kbplanter_plants1.dds\",\n \"gta3.img/wshxrefhse2.txd/villagreen128256.dds\", \"gta3.img/imrancomp_kmb.txd/villagreen128256.dds\",\n \"gta3.img/shop_int_d.txd/cj_gen_glass2.dds\", \"gta3.img/new_shop_door.txd/cj_gen_glass2.dds\",\n \"gta3.img/gta_potplantsaa.txd/dirtgaz64b.dds\", \"gta3.img/gta_potplants2.txd/dirtgaz64b.dds\",\n \"gta3.img/gta_potplants.txd/dirtgaz64b.dds\", \"gta3.img/gta_potplants2.txd/dirtgaz64b.dds\",\n \"gta3.img/gta_potplantsx.txd/dirtgaz64b.dds\", \"gta3.img/gta_potplants2.txd/dirtgaz64b.dds\",\n \"gta3.img/kbplantssmz2.txd/dirtgaz64b.dds\", \"gta3.img/gta_potplants2.txd/dirtgaz64b.dds\",\n \"gta3.img/kbplantssmz.txd/dirtgaz64b.dds\", \"gta3.img/gta_potplants2.txd/dirtgaz64b.dds\",\n \"gta3.img/lawnburg.txd/vgnburgwal5_256.dds\", \"gta3.img/bs_sfs.txd/vgnburgwal5_256.dds\",\n \"gostown6.img/gp_paradbridge.txd/alpha02.dds\", \"gostown6.img/gp_mansiongen.txd/alpha02.dds\",\n \"gta3.img/bikera.txd/bikera.dds\", \"gta3.img/bikdrug.txd/bikera.dds\",\n \"gta3.img/gta_tree_palm.txd/trunk3.dds\", \"gta3.img/gta_tree_bevhills.txd/trunk3.dds\",\n \"gostown6.img/gp_roofs.txd/bridgewall.dds\", \"gostown6.img/gp_baybridge.txd/bridgewall.dds\",\n \"gostown6.img/gp_dt_19.txd/asphalt-parkinglot01_1024x512.dds\", \"gostown6.img/gp_divinyl_prx.txd/asphalt-parkinglot01_1024x512.dds\",\n \"gostown6.img/gp_landbig.txd/ter_sand1.dds\", \"gostown6.img/gp_lake.txd/ter_sand1.dds\",\n \"gta3.img/dyntraffic.txd/lampost_16clr.dds\", \"gta3.img/dynsigns.txd/lampost_16clr.dds\",\n \"gta3.img/polmav.txd/cargo_wall2.dds\", \"gta3.img/nevada.txd/cargo_wall2.dds\",\n \"gta3.img/vgngassign.txd/ws_xenon_2.dds\", \"gta3.img/vgegassign.txd/ws_xenon_2.dds\",\n \"gta3.img/junkpiles.txd/cj_tyre.dds\", \"gta3.img/cart.txd/cj_tyre.dds\",\n \"gta3.img/monsterb.txd/monsterb92stuff64.dds\", \"gta3.img/monstera.txd/monstera92stuff64.dds\",\n \"gta3.img/break_fen_mesh.txd/cj_sheetmetal.dds\", \"gta3.img/break_fen_mesh2.txd/cj_sheetmetal.dds\",\n \"gta3.img/break_f_mesh.txd/cj_sheetmetal.dds\", \"gta3.img/break_fen_mesh2.txd/cj_sheetmetal.dds\",\n \"gta3.img/break_garden.txd/cj_sheetmetal.dds\", \"gta3.img/break_fen_mesh2.txd/cj_sheetmetal.dds\",\n \"gta3.img/break_s_bins.txd/cj_sheetmetal.dds\", \"gta3.img/break_fen_mesh2.txd/cj_sheetmetal.dds\",\n \"gta3.img/break_s_fillers.txd/cj_sheetmetal.dds\", \"gta3.img/break_fen_mesh2.txd/cj_sheetmetal.dds\",\n \"gta3.img/break_s_sf.txd/cj_sheetmetal.dds\", \"gta3.img/break_fen_mesh2.txd/cj_sheetmetal.dds\",\n \"gta3.img/break_street2.txd/cj_sheetmetal.dds\", \"gta3.img/break_fen_mesh2.txd/cj_sheetmetal.dds\",\n \"gta3.img/cj_bins2.txd/cj_sheetmetal.dds\", \"gta3.img/break_fen_mesh2.txd/cj_sheetmetal.dds\",\n \"gta3.img/dsfs.txd/cj_sheetmetal.dds\", \"gta3.img/break_fen_mesh2.txd/cj_sheetmetal.dds\",\n \"gta3.img/dyn_objects.txd/cj_sheetmetal.dds\", \"gta3.img/break_fen_mesh2.txd/cj_sheetmetal.dds\",\n \"gta3.img/junkpiles.txd/cj_sheetmetal.dds\", \"gta3.img/break_fen_mesh2.txd/cj_sheetmetal.dds\",\n \"gta3.img/pedalsx.txd/cj_sheetmetal.dds\", \"gta3.img/break_fen_mesh2.txd/cj_sheetmetal.dds\",\n \"gta3.img/ws_apgatex.txd/cj_sheetmetal.dds\", \"gta3.img/break_fen_mesh2.txd/cj_sheetmetal.dds\",\n \"gta3.img/metalbarrier_cj.txd/cj_galvanised.dds\", \"gta3.img/cj_carter.txd/cj_galvanised.dds\",\n \"gostown6.img/gp_dt_45.txd/odddoor1_lan.dds\", \"gostown6.img/gp_dt2930.txd/odddoor1_lan.dds\",\n \"gostown6.img/gp_dt_45.txd/des_hooswin2.dds\", \"gostown6.img/gp_dt2930.txd/inferno_material_396.dds\",\n \"gta3.img/broadway.txd/broadway92wheel64.dds\", \"gta3.img/blade.txd/blade92wheel64.dds\",\n \"gta3.img/cabbie.txd/cabbie92wheel64.dds\", \"gta3.img/blade.txd/blade92wheel64.dds\",\n \"gta3.img/copcarvg.txd/cabbie92wheel64.dds\", \"gta3.img/blade.txd/blade92wheel64.dds\",\n \"gta3.img/dozer.txd/glendale92wheel64.dds\", \"gta3.img/blade.txd/blade92wheel64.dds\",\n \"gta3.img/glendale.txd/blade92wheel64.dds\", \"gta3.img/blade.txd/blade92wheel64.dds\",\n \"gta3.img/oceanic.txd/blade92wheel64.dds\", \"gta3.img/blade.txd/blade92wheel64.dds\",\n \"gta3.img/voodoo.txd/voodoo92wheel64.dds\", \"gta3.img/blade.txd/blade92wheel64.dds\",\n \"gta3.img/tahoma.txd/tahoma92interior128.dds\", \"gta3.img/esperant.txd/esperant92interior128.dds\",\n \"gostown6.img/gp_dt_19.txd/yellow_plaques.dds\", \"gostown6.img/gp_dam.txd/yellow_plaques.dds\",\n \"gta3.img/od_beachstuff.txd/wood02.dds\", \"gta3.img/chairsntable.txd/wood02.dds\",\n \"gta3.img/cranes_dyn2.txd/ws_dudelogo.dds\", \"gta3.img/cranes_dyn2_cj.txd/ws_dudelogo.dds\",\n \"gta3.img/copcarsf.txd/copcarla92interior128.dds\", \"gta3.img/copcarla.txd/copcarla92interior128.dds\",\n \"gta3.img/vgngassign.txd/ws_xenon_3.dds\", \"gta3.img/vgegassign.txd/ws_xenon_3.dds\",\n \"gta3.img/gta_tree_pine.txd/kb_ivy2_256.dds\", \"gta3.img/gta_tree_boak.txd/kb_ivy2_256.dds\",\n \"gta3.img/veg_leaves.txd/kb_ivy2_256.dds\", \"gta3.img/gta_tree_boak.txd/kb_ivy2_256.dds\",\n \"gta3.img/sadlshit.txd/sadler92wheel64.dds\", \"gta3.img/sadler.txd/sadler92wheel64.dds\",\n \"gta3.img/gun_boxwee.txd/gun_box1.dds\", \"gta3.img/gun_boxbig.txd/gun_box1.dds\",\n \"gta3.img/gta_tree_pine.txd/sm_redwood_bark.dds\", \"gta3.img/gta_tree_boak.txd/sm_redwood_bark.dds\",\n \"gostown6.img/gp_tunnels.txd/route_01_blenddirt.dds\", \"gostown6.img/gp_landbig.txd/route_01_blenddirt.dds\",\n \"gta3.img/roadblkx.txd/yellow_64.dds\", \"gta3.img/barrierblk.txd/yellow_64.dds\",\n \"gta3.img/patriot.txd/patriot92wheel64.dds\", \"gta3.img/mule.txd/mule92wheel64.dds\",\n \"gostown6.img/gp_dt2930.txd/trim_wall.dds\", \"gostown6.img/gp_divinyl_prx.txd/trim_wall.dds\",\n \"gostown6.img/gp_dt_45.txd/shopfr03_la.dds\", \"gostown6.img/gp_dt2930.txd/shopfr03_la.dds\",\n \"gta3.img/cranes_dyn2.txd/ws_oldpaintedyello.dds\", \"gta3.img/cranes_dyn2_cj.txd/ws_oldpaintedyello.dds\",\n \"gta3.img/artict2.txd/artict2wheel64.dds\", \"gta3.img/artict1.txd/artict1wheel64.dds\",\n \"gta3.img/artict3.txd/artict3wheel64.dds\", \"gta3.img/artict1.txd/artict1wheel64.dds\",\n \"gta3.img/bagboxa.txd/bagboxa92wheel.dds\", \"gta3.img/artict1.txd/artict1wheel64.dds\",\n \"gta3.img/bagboxb.txd/bagboxb92wheel.dds\", \"gta3.img/artict1.txd/artict1wheel64.dds\",\n \"gta3.img/cement.txd/cement92wheel.dds\", \"gta3.img/artict1.txd/artict1wheel64.dds\",\n \"gta3.img/duneride.txd/dunerider92wheel.dds\", \"gta3.img/artict1.txd/artict1wheel64.dds\",\n \"gta3.img/firela.txd/firela92wheel64.dds\", \"gta3.img/artict1.txd/artict1wheel64.dds\",\n \"gta3.img/linerun.txd/linerun92wheel64.dds\", \"gta3.img/artict1.txd/artict1wheel64.dds\",\n \"gta3.img/packer.txd/packer92wheel.dds\", \"gta3.img/artict1.txd/artict1wheel64.dds\",\n \"gta3.img/petrotr.txd/petrotr92wheel.dds\", \"gta3.img/artict1.txd/artict1wheel64.dds\",\n \"gta3.img/petro.txd/petro92wheel.dds\", \"gta3.img/artict1.txd/artict1wheel64.dds\",\n \"gta3.img/swatvan.txd/swatvan92wheel.dds\", \"gta3.img/artict1.txd/artict1wheel64.dds\",\n \"gta3.img/tugstair.txd/tugstair92wheel.dds\", \"gta3.img/artict1.txd/artict1wheel64.dds\",\n \"gta3.img/tug.txd/tug92wheel.dds\", \"gta3.img/artict1.txd/artict1wheel64.dds\",\n \"gta3.img/cj_box1.txd/slated.dds\", \"gta3.img/break_pallet.txd/slated.dds\",\n \"gta3.img/junkpiles.txd/slated.dds\", \"gta3.img/break_pallet.txd/slated.dds\",\n \"gostown6.img/gp_dt_45.txd/brickwall.dds\", \"gostown6.img/gp_dt2930.txd/brickwall.dds\",\n \"gta3.img/billbrd.txd/addwood.dds\", \"gta3.img/billbox.txd/addwood.dds\",\n \"gta3.img/nvgoggles.txd/nvgogglesicon.dds\", \"gta3.img/irgoggles.txd/irgogglesicon.dds\",\n \"gta3.img/immcrax.txd/snpedtest1.dds\", \"gta3.img/gb_laroads.txd/snpedtest1.dds\",\n \"gta3.img/temproadtxd.txd/snpedtest1.dds\", \"gta3.img/gb_laroads.txd/snpedtest1.dds\",\n \"gta3.img/dumper.txd/dumper92logo.dds\", \"gta3.img/cement.txd/cement92logo.dds\",\n \"gta3.img/kei_wnchx.txd/yellowscum64.dds\", \"gta3.img/cranes_dyn2.txd/yellowscum64.dds\",\n \"gta3.img/wmotrm1.txd/tramp1.dds\", \"gta3.img/wmotr1.txd/tramp1.dds\",\n \"gta3.img/ramp2.txd/conc_slabgrey_256128.dds\", \"gta3.img/bs_sfs.txd/conc_slabgrey_256128.dds\",\n \"gostown6.img/gp_dt2930.txd/sw_door17.dds\", \"gostown6.img/gp_dt2930.txd/sw_door16.dds\",\n \"gostown6.img/lodcity.txd/route_05.dds\", \"gostown6.img/lodbaybridge.txd/route_06.dds\",\n \"gostown6.img/loddttunnel.txd/route_05.dds\", \"gostown6.img/lodbaybridge.txd/route_06.dds\",\n \"gostown6.img/lodindubridge.txd/route_05.dds\", \"gostown6.img/lodbaybridge.txd/route_06.dds\",\n \"gostown6.img/lodlake.txd/route_05.dds\", \"gostown6.img/lodbaybridge.txd/route_06.dds\",\n \"gostown6.img/lodlotsbeach.txd/route_05.dds\", \"gostown6.img/lodbaybridge.txd/route_06.dds\",\n \"gostown6.img/lodparadbridge.txd/route_06.dds\", \"gostown6.img/lodbaybridge.txd/route_06.dds\",\n \"gta3.img/cj_bar.txd/cj_sheetmetal2.dds\", \"gta3.img/7_11_door.txd/cj_sheetmetal2.dds\",\n \"gta3.img/new_shop_door.txd/cj_sheetmetal2.dds\", \"gta3.img/7_11_door.txd/cj_sheetmetal2.dds\",\n \"gta3.img/shop_doors2.txd/cj_sheetmetal2.dds\", \"gta3.img/7_11_door.txd/cj_sheetmetal2.dds\",\n \"gta3.img/totoie.txd/cj_sheetmetal2.dds\", \"gta3.img/7_11_door.txd/cj_sheetmetal2.dds\",\n \"gta3.img/hfyri.txd/watchcro.dds\", \"gta3.img/bfyri.txd/watchcro.dds\",\n \"gta3.img/hmyri.txd/watchcro.dds\", \"gta3.img/bfyri.txd/watchcro.dds\",\n \"gta3.img/ofyri.txd/watchcro.dds\", \"gta3.img/bfyri.txd/watchcro.dds\",\n \"gta3.img/shmycr.txd/watchcro.dds\", \"gta3.img/bfyri.txd/watchcro.dds\",\n \"gta3.img/wfyri.txd/watchcro.dds\", \"gta3.img/bfyri.txd/watchcro.dds\",\n \"gta3.img/wmyri.txd/watchcro.dds\", \"gta3.img/bfyri.txd/watchcro.dds\",\n \"gostown6.img/gp_tunnels.txd/sf_pave6 copie.dds\", \"gostown6.img/gp_landbig.txd/sf_pave6 copie.dds\",\n \"gta3.img/cj_bar.txd/metalox64.dds\", \"gta3.img/a51_crane.txd/metalox64.dds\",\n \"gta3.img/cranes_dyn2.txd/metalox64.dds\", \"gta3.img/a51_crane.txd/metalox64.dds\",\n \"gta3.img/immcrax.txd/metalox64.dds\", \"gta3.img/a51_crane.txd/metalox64.dds\",\n \"gta3.img/ramp2.txd/metalox64.dds\", \"gta3.img/a51_crane.txd/metalox64.dds\",\n \"gta3.img/wfyst.txd/earing.dds\", \"gta3.img/swfyst.txd/earing.dds\",\n \"gostown6.img/gp_dt_45.txd/doore.dds\", \"gostown6.img/gp_dt_19.txd/doore.dds\",\n \"gostown6.img/gp_tunnels.txd/metal024.dds\", \"gostown6.img/gp_landbig.txd/metal024.dds\",\n \"gta3.img/dynbarrels.txd/alumplat64.dds\", \"gta3.img/cgo_barx.txd/alumplat64.dds\",\n \"gta3.img/cj_bins.txd/cj_dump3.dds\", \"gta3.img/break_fence3.txd/cj_dump3.dds\",\n \"gta3.img/cj_street_props.txd/cj_dump3.dds\", \"gta3.img/break_fence3.txd/cj_dump3.dds\",\n \"gta3.img/roadside.txd/cj_dump3.dds\", \"gta3.img/break_fence3.txd/cj_dump3.dds\",\n \"gta3.img/lawnburg.txd/vgnburgwal4_128.dds\", \"gta3.img/bs_sfs.txd/vgnburgwal4_128.dds\",\n \"gta3.img/helimagnet.txd/barrel_64hv.dds\", \"gta3.img/dynbarrels.txd/barrel_64hv.dds\",\n \"gta3.img/cj_street_props.txd/cj_skip.dds\", \"gta3.img/break_s_ws.txd/cj_skip.dds\",\n \"gta3.img/dyntraffic.txd/black64.dds\", \"gta3.img/ap_learjets.txd/black64.dds\",\n \"gta3.img/freight.txd/freight92window64.dds\", \"gta3.img/ap_learjets.txd/black64.dds\",\n \"gta3.img/kei_wnchx.txd/black64.dds\", \"gta3.img/ap_learjets.txd/black64.dds\",\n \"gta3.img/wshxrefpump.txd/black64.dds\", \"gta3.img/ap_learjets.txd/black64.dds\",\n \"gta3.img/dynbarrels.txd/yellowmetal.dds\", \"gta3.img/cgo_barx.txd/yellowmetal.dds\",\n \"gostown6.img/gp_dt_45.txd/gen_chrome.dds\", \"gostown6.img/gp_dt_19.txd/gen_chrome.dds\",\n \"gta3.img/cj_bins.txd/dirt64b.dds\", \"gta3.img/break_s_bins.txd/dirt64b.dds\",\n \"gta3.img/cj_plant_props.txd/dirt64b.dds\", \"gta3.img/break_s_bins.txd/dirt64b.dds\",\n \"gta3.img/gta_brokentrees.txd/dirt64b.dds\", \"gta3.img/break_s_bins.txd/dirt64b.dds\",\n \"gta3.img/rancher.txd/rancher92interior128.dds\", \"gta3.img/fbiranch.txd/rancher92interior128.dds\",\n \"gta3.img/sanchez.txd/sanchez92brakes64.dds\", \"gta3.img/pcj600.txd/pcj60092brakes64.dds\",\n \"gostown6.img/gp_electric.txd/bridge5.dds\", \"gostown6.img/gp_dt_19.txd/bridge5.dds\",\n \"gostown6.img/gp_roofs.txd/bridge5.dds\", \"gostown6.img/gp_dt_19.txd/bridge5.dds\",\n \"gostown6.img/gp_landbig.txd/route_02stopline.dds\", \"gostown6.img/gp_lake.txd/route_02stopline.dds\",\n \"gostown6.img/gp_lotsbeach.txd/route_02stopline.dds\", \"gostown6.img/gp_lake.txd/route_02stopline.dds\",\n \"gostown6.img/gp_lots.txd/route_02stopline.dds\", \"gostown6.img/gp_lake.txd/route_02stopline.dds\",\n \"gta3.img/player_props.txd/cj_kitchdoor.dds\", \"gta3.img/ciggarx.txd/cj_kitchdoor.dds\",\n \"gta3.img/lawnburg.txd/vgnburgwal1_128.dds\", \"gta3.img/bs_sfs.txd/vgnburgwal1_128.dds\",\n \"gta3.img/break_street1.txd/cj_dump2.dds\", \"gta3.img/break_fence3.txd/cj_dump2.dds\",\n \"gta3.img/cj_bins2.txd/cj_dump2.dds\", \"gta3.img/break_fence3.txd/cj_dump2.dds\",\n \"gta3.img/cj_street_props.txd/cj_dump2.dds\", \"gta3.img/break_fence3.txd/cj_dump2.dds\",\n \"gta3.img/landjump.txd/rustyboltpanel.dds\", \"gta3.img/adjumpx.txd/rustyboltpanel.dds\",\n \"gostown6.img/gp_dt2930.txd/newall5-3.dds\", \"gostown6.img/gp_dt_19.txd/newall5-3.dds\",\n \"gostown6.img/gp_dt_45.txd/newall5-3.dds\", \"gostown6.img/gp_dt_19.txd/newall5-3.dds\",\n \"gta3.img/buffalo.txd/buffalo92wheel32.dds\", \"gta3.img/banshee.txd/banshee92wheel32.dds\",\n \"gta3.img/comet.txd/comet92wheel32.dds\", \"gta3.img/banshee.txd/banshee92wheel32.dds\",\n \"gta3.img/lawnburg.txd/roof06l256.dds\", \"gta3.img/bs_sfs.txd/roof06l256.dds\",\n \"gta3.img/gta_tree_pine.txd/tree19mi.dds\", \"gta3.img/gta_tree_oldpine.txd/tree19mi.dds\",\n \"gta3.img/bluebr.txd/blue2.dds\", \"gta3.img/bluebl.txd/blue2.dds\",\n \"gostown6.img/gp_paradbridge.txd/bois01.dds\", \"gostown6.img/gp_dt_45.txd/bois01.dds\",\n \"gta3.img/genalley.txd/stuffdirtcol.dds\", \"gta3.img/alleyprop.txd/stuffdirtcol.dds\",\n \"gta3.img/lawnburg.txd/vgnburgwal6_256.dds\", \"gta3.img/bs_sfs.txd/vgnburgwal6_256.dds\",\n \"gta3.img/premier.txd/policemiami868bit128.dds\", \"gta3.img/copcarla.txd/policemiami868bit128.dds\",\n \"gta3.img/taxi.txd/policemiami868bit128.dds\", \"gta3.img/copcarla.txd/policemiami868bit128.dds\",\n \"gta3.img/wmotrm2.txd/tramp2.dds\", \"gta3.img/sbmotr3.txd/tramp2.dds\",\n \"gostown6.img/gp_tunnels.txd/airvent_gz.dds\", \"gostown6.img/area13.txd/airvent_gz.dds\",\n \"gta3.img/hotrina.txd/glass.dds\", \"gta3.img/dodo.txd/glass.dds\",\n \"gta3.img/col_wall5x.txd/mp_burn_wall2.dds\", \"gta3.img/col_wall2x.txd/mp_burn_wall2.dds\",\n \"gta3.img/icons1.txd/blugrad32.dds\", \"gta3.img/bbpcpx.txd/blugrad32.dds\",\n \"gta3.img/icons4.txd/blugrad32.dds\", \"gta3.img/bbpcpx.txd/blugrad32.dds\",\n \"gta3.img/farmstuff.txd/cratetop128.dds\", \"gta3.img/cj_barr_set_1.txd/cratetop128.dds\",\n \"gta3.img/newramp.txd/cratetop128.dds\", \"gta3.img/cj_barr_set_1.txd/cratetop128.dds\",\n \"gta3.img/securica.txd/securica92wheel64.dds\", \"gta3.img/coach.txd/coach92wheel64.dds\",\n \"gta3.img/fencehaiti.txd/sjmshopbk.dds\", \"gta3.img/bar_chainlink.txd/sjmshopbk.dds\",\n \"gta3.img/hotring.txd/hotring92tyre32.dds\", \"gta3.img/bravura.txd/hotrina92tyre32.dds\",\n \"gta3.img/sparrow.txd/polmavbody128a.dds\", \"gta3.img/maverick.txd/maverick92body128.dds\",\n \"gta3.img/vcnmav.txd/polmavbody128a.dds\", \"gta3.img/maverick.txd/maverick92body128.dds\",\n \"gta3.img/jester.txd/stratum92interior128.dds\", \"gta3.img/club.txd/club92interior128.dds\",\n \"gta3.img/phoenix.txd/phoenix92interior128.dds\", \"gta3.img/club.txd/club92interior128.dds\",\n \"gta3.img/sandking.txd/sandking92interior128.dds\", \"gta3.img/club.txd/club92interior128.dds\",\n \"gta3.img/stratum.txd/stratum92interior128.dds\", \"gta3.img/club.txd/club92interior128.dds\",\n \"gta3.img/sultan.txd/sultan92interior128.dds\", \"gta3.img/club.txd/club92interior128.dds\",\n \"gta3.img/uranus.txd/uranus92interior128.dds\", \"gta3.img/club.txd/club92interior128.dds\",\n \"gta3.img/monsterb.txd/monsterb92interior128.dds\", \"gta3.img/monstera.txd/monstera92interior128.dds\",\n \"gta3.img/flowerb.txd/flowerbicon.dds\", \"gta3.img/flowera.txd/floweraicon.dds\",\n \"gta3.img/ammocapx.txd/ammo_tube.dds\", \"gta3.img/ad_rmx.txd/ammo_tube.dds\",\n \"gta3.img/securica.txd/securica92plate32.dds\", \"gta3.img/firetruk.txd/firetruk92plate32.dds\",\n \"gta3.img/cj_street_props.txd/cj_trafficlights.dds\", \"gta3.img/break_fence3.txd/cj_trafficlights.dds\",\n \"gta3.img/cj_traffic.txd/cj_trafficlights.dds\", \"gta3.img/break_fence3.txd/cj_trafficlights.dds\",\n \"gta3.img/col_wall2x.txd/mp_diner_ceilingdirt.dds\", \"gta3.img/col_wall1x.txd/mp_diner_ceilingdirt.dds\",\n \"gta3.img/col_wall5x.txd/mp_diner_ceilingdirt.dds\", \"gta3.img/col_wall1x.txd/mp_diner_ceilingdirt.dds\",\n \"gta3.img/roadblkx.txd/warnsigns2.dds\", \"gta3.img/barrierblk.txd/warnsigns2.dds\",\n \"gta3.img/artict2.txd/artict2_128x64.dds\", \"gta3.img/artict1.txd/artict1_128x64.dds\",\n \"gta3.img/artict3.txd/artict3_128x64.dds\", \"gta3.img/artict1.txd/artict1_128x64.dds\",\n \"gta3.img/gta_tree_palm.txd/vegaspalm01_128.dds\", \"gta3.img/gta_tree_bevhills.txd/vegaspalm01_128.dds\",\n \"gta3.img/taxi.txd/black.dds\", \"gta3.img/premier.txd/black.dds\",\n \"gta3.img/sparrow.txd/minigun_2.dds\", \"gta3.img/seaspar.txd/minigun_2.dds\",\n \"gta3.img/sw_doors.txd/comptdoor4.dds\", \"gta3.img/dts_bbx.txd/comptdoor4.dds\",\n \"gta3.img/gta_rockcuntry.txd/rocktq128.dds\", \"gta3.img/gta_brokentrees.txd/rocktq128.dds\",\n \"gostown6.img/gp_landbig.txd/ter_moss1.dds\", \"gostown6.img/gp_lake.txd/ter_moss1.dds\",\n \"gostown6.img/gp_lotsbeach.txd/ter_moss1.dds\", \"gostown6.img/gp_lake.txd/ter_moss1.dds\",\n \"gostown6.img/gp_lots.txd/ter_moss1.dds\", \"gostown6.img/gp_lake.txd/ter_moss1.dds\",\n \"gta3.img/gb_lageneric.txd/telewires_law.dds\", \"gta3.img/cranes_dyn2.txd/telewires_law.dds\",\n \"gta3.img/wong_twx.txd/telewires_law.dds\", \"gta3.img/cranes_dyn2.txd/telewires_law.dds\",\n \"gta3.img/sf_roads.txd/sf_road5.dds\", \"gta3.img/sanfranroads.txd/sf_road5.dds\",\n \"gta3.img/irgoggles.txd/nightvision.dds\", \"gta3.img/gogsx.txd/nightvision.dds\",\n \"gta3.img/nvgoggles.txd/nightvision.dds\", \"gta3.img/gogsx.txd/nightvision.dds\",\n \"gostown6.img/gp_gss.txd/metropillar3.dds\", \"gostown6.img/gp_dt_19.txd/bridge4.dds\",\n \"gta3.img/gtarock_deserts.txd/newtreeleaves128.dds\", \"gta3.img/badlands.txd/newtreeleaves128.dds\",\n \"gta3.img/gta_tree_bevhills.txd/newtreeleaves128.dds\", \"gta3.img/badlands.txd/newtreeleaves128.dds\",\n \"gta3.img/gta_tree_boak.txd/newtreeleaves128.dds\", \"gta3.img/badlands.txd/newtreeleaves128.dds\",\n \"gta3.img/chromegun.txd/muzzle_texture4.dds\", \"gta3.img/ak47.txd/muzzle_texture4.dds\",\n \"gta3.img/colt45.txd/muzzle_texture4.dds\", \"gta3.img/ak47.txd/muzzle_texture4.dds\",\n \"gta3.img/desert_eagle.txd/muzzle_texture4.dds\", \"gta3.img/ak47.txd/muzzle_texture4.dds\",\n \"gta3.img/m4.txd/muzzle_texture4.dds\", \"gta3.img/ak47.txd/muzzle_texture4.dds\",\n \"gta3.img/micro_uzi.txd/muzzle_texture4.dds\", \"gta3.img/ak47.txd/muzzle_texture4.dds\",\n \"gta3.img/minigun.txd/muzzle_texture4.dds\", \"gta3.img/ak47.txd/muzzle_texture4.dds\",\n \"gta3.img/mp5lng.txd/muzzle_texture4.dds\", \"gta3.img/ak47.txd/muzzle_texture4.dds\",\n \"gta3.img/shotgspa.txd/muzzle_texture4.dds\", \"gta3.img/ak47.txd/muzzle_texture4.dds\",\n \"gta3.img/silenced.txd/muzzle_texture4.dds\", \"gta3.img/ak47.txd/muzzle_texture4.dds\",\n \"gta3.img/tec9.txd/muzzle_texture4.dds\", \"gta3.img/ak47.txd/muzzle_texture4.dds\",\n \"gta3.img/break_scaffold.txd/cj_lamppost1.dds\", \"gta3.img/break_s_bins.txd/cj_lamppost1.dds\",\n \"gta3.img/break_street2.txd/cj_lamppost1.dds\", \"gta3.img/break_s_bins.txd/cj_lamppost1.dds\",\n \"gta3.img/cj_bins.txd/cj_lamppost1.dds\", \"gta3.img/break_s_bins.txd/cj_lamppost1.dds\",\n \"gta3.img/cj_dyn_prop.txd/cj_lamppost1.dds\", \"gta3.img/break_s_bins.txd/cj_lamppost1.dds\",\n \"gta3.img/cj_street_props.txd/cj_lamppost1.dds\", \"gta3.img/break_s_bins.txd/cj_lamppost1.dds\",\n \"gta3.img/cj_traffic.txd/cj_lamppost1.dds\", \"gta3.img/break_s_bins.txd/cj_lamppost1.dds\",\n \"gta3.img/docklight.txd/cj_lamppost1.dds\", \"gta3.img/break_s_bins.txd/cj_lamppost1.dds\",\n \"gta3.img/dyn_objects.txd/cj_lamppost1.dds\", \"gta3.img/break_s_bins.txd/cj_lamppost1.dds\",\n \"gta3.img/roadside.txd/cj_lamppost1.dds\", \"gta3.img/break_s_bins.txd/cj_lamppost1.dds\",\n \"gta3.img/silenced.txd/v_usp2.dds\", \"gta3.img/colt45.txd/v_usp2.dds\",\n \"gta3.img/totoie.txd/cj_hay2.dds\", \"gta3.img/break_farm.txd/cj_hay2.dds\",\n \"gta3.img/gta_proc_rushes.txd/gras07si.dds\", \"gta3.img/gta_procflowers.txd/gras07si.dds\",\n \"gta3.img/sultan.txd/sultan92stickers128.dds\", \"gta3.img/stratum.txd/sultan92stickers128.dds\",\n \"gta3.img/dyn_elec.txd/cj_tv1.dds\", \"gta3.img/dsfs.txd/cj_tv1.dds\",\n \"gta3.img/pedalsx.txd/cj_tv1.dds\", \"gta3.img/dsfs.txd/cj_tv1.dds\",\n \"gta3.img/icons5.txd/heart.dds\", \"gta3.img/icons4.txd/heart.dds\",\n \"gta3.img/stallion.txd/stallion92wheel64.dds\", \"gta3.img/regina.txd/regina92wheel64.dds\",\n \"gta3.img/bus.txd/metalic_64.dds\", \"gta3.img/barracks.txd/metalic_64.dds\",\n \"gta3.img/yosemite.txd/metalic_64.dds\", \"gta3.img/barracks.txd/metalic_64.dds\",\n \"gta3.img/seabedcs.txd/sw_sand.dds\", \"gta3.img/roadblkx.txd/sw_sand.dds\",\n \"gta3.img/seabed.txd/sw_sand.dds\", \"gta3.img/roadblkx.txd/sw_sand.dds\",\n \"gta3.img/break_s_sf.txd/cj_bin_lid.dds\", \"gta3.img/break_fence3.txd/cj_bin_lid.dds\",\n \"gta3.img/cj_bins.txd/cj_bin_lid.dds\", \"gta3.img/break_fence3.txd/cj_bin_lid.dds\",\n \"gta3.img/cj_street_props.txd/cj_bin_lid.dds\", \"gta3.img/break_fence3.txd/cj_bin_lid.dds\",\n \"gta3.img/roadside.txd/cj_bin_lid.dds\", \"gta3.img/break_fence3.txd/cj_bin_lid.dds\",\n \"gta3.img/tree2.txd/bthuja1.dds\", \"gta3.img/gtatreeshifir.txd/bthuja1.dds\",\n \"gta3.img/raindanc.txd/raindance92body128.dds\", \"gta3.img/polmav.txd/raindance92body128.dds\",\n \"gta3.img/vgngassign.txd/ws_xenon_1.dds\", \"gta3.img/vgegassign.txd/ws_xenon_1.dds\",\n \"gta3.img/gtatreeshifir.txd/oakbark64.dds\", \"gta3.img/gtatreeshi7.txd/oakbark64.dds\",\n \"gta3.img/gtatreesh.txd/oakbark64.dds\", \"gta3.img/gtatreeshi7.txd/oakbark64.dds\",\n \"gta3.img/vegtresshi9b.txd/oakbark64.dds\", \"gta3.img/gtatreeshi7.txd/oakbark64.dds\",\n \"gta3.img/lawnburg.txd/burgershotmenu256.dds\", \"gta3.img/bs_sfs.txd/burgershotmenu256.dds\",\n \"gta3.img/clover.txd/vehicleinterior.dds\", \"gta3.img/bus.txd/vehicleinterior.dds\",\n \"gta3.img/tram.txd/vehicleinterior.dds\", \"gta3.img/bus.txd/vehicleinterior.dds\",\n \"gta3.img/yosemite.txd/vehicleinterior.dds\", \"gta3.img/bus.txd/vehicleinterior.dds\",\n \"gta3.img/cj_bar.txd/cj_bottle2.dds\", \"gta3.img/break_bar.txd/cj_bottle2.dds\",\n \"gta3.img/fencehaiti.txd/awirex2.dds\", \"gta3.img/bar_chainlink.txd/awirex2.dds\",\n \"gta3.img/roadblkx.txd/block.dds\", \"gta3.img/barrierblk.txd/block.dds\",\n \"gta3.img/willard.txd/willard92wheel64.dds\", \"gta3.img/previon.txd/willard92wheel64.dds\",\n \"gta3.img/nevada.txd/cgaurdtailinner.dds\", \"gta3.img/nevada.txd/cgaurdnose.dds\",\n \"gta3.img/ingame.txd/cj_w_grad.dds\", \"gta3.img/diamond.txd/cj_w_grad.dds\",\n \"gta3.img/shamal.txd/shamalbody256.dds\", \"gta3.img/jt_doorx.txd/shamalbody256.dds\",\n \"gta3.img/radar07.txd/radar07.dds\", \"gta3.img/radar04.txd/radar04.dds\",\n \"gta3.img/gta_potplantsx.txd/greekurn.dds\", \"gta3.img/gta_potplants.txd/greekurn.dds\",\n \"gta3.img/teargas.txd/gun_teargas_2.dds\", \"gta3.img/gasgren.txd/gun_teargas_2.dds\",\n \"gostown6.img/gp_lake.txd/metropillar5.dds\", \"gostown6.img/gp_indust_42.txd/metropillar5.dds\",\n \"gostown6.img/gp_dt_27.txd/ws_corr_plastic.dds\", \"gostown6.img/gp_dt_19.txd/woodbeam.dds\",\n \"gostown6.img/gp_roofs.txd/woodbeam.dds\", \"gostown6.img/gp_dt_19.txd/woodbeam.dds\",\n \"gostown6.img/gp_scaffolding.txd/bridge5.dds\", \"gostown6.img/gp_dt_45.txd/bridge5.dds\",\n \"gta3.img/magnetx.txd/cj_chromepipe.dds\", \"gta3.img/dyn_objects.txd/cj_chromepipe.dds\",\n \"gta3.img/totoie.txd/cj_chromepipe.dds\", \"gta3.img/dyn_objects.txd/cj_chromepipe.dds\",\n \"gostown6.img/lodlake.txd/metalgrate013b.dds\", \"gostown6.img/lodcity.txd/metalgrate013b.dds\",\n \"gta3.img/petrolcan.txd/redcan.dds\", \"gta3.img/dynamite.txd/redcan.dds\",\n \"gta3.img/fbitruck.txd/fbitruck92wheel64.dds\", \"gta3.img/benson.txd/benson92wheel64.dds\",\n \"gta3.img/flatbed.txd/flatbed92wheel64.dds\", \"gta3.img/benson.txd/benson92wheel64.dds\",\n \"gta3.img/rdtrain.txd/flatbed92wheel64.dds\", \"gta3.img/benson.txd/benson92wheel64.dds\",\n \"gta3.img/trash.txd/trash92wheel64.dds\", \"gta3.img/benson.txd/benson92wheel64.dds\",\n \"gta3.img/silenced.txd/v_usp0.dds\", \"gta3.img/colt45.txd/v_usp0.dds\",\n \"gta3.img/fbitruck.txd/fbitruck92decalsa64.dds\", \"gta3.img/copbike.txd/copbike92decalsa64.dds\",\n \"gta3.img/landjump.txd/telepole128.dds\", \"gta3.img/benches_cj.txd/telepole128.dds\",\n \"gostown6.img/gp_dt_47.txd/scaffold2.dds\", \"gostown6.img/gp_dt_40.txd/scaffold2.dds\",\n \"gta3.img/sf_roads.txd/sf_junction5.dds\", \"gta3.img/sanfranroads.txd/sf_junction5.dds\",\n \"gta3.img/raindanc.txd/raindance92bits128.dds\", \"gta3.img/polmav.txd/raindance92bits128.dds\",\n \"gta3.img/cj_till_break.txd/money_128.dds\", \"gta3.img/cj_money_bags.txd/money_128.dds\",\n \"gta3.img/dyn_cash.txd/money_128.dds\", \"gta3.img/cj_money_bags.txd/money_128.dds\",\n \"gta3.img/break_street2.txd/cj_darkwood.dds\", \"gta3.img/break_farm.txd/cj_darkwood.dds\",\n \"gta3.img/cart.txd/cj_darkwood.dds\", \"gta3.img/break_farm.txd/cj_darkwood.dds\",\n \"gta3.img/gta_brokentrees.txd/cj_darkwood.dds\", \"gta3.img/break_farm.txd/cj_darkwood.dds\",\n \"gta3.img/break_road_ws.txd/cj_orangebarrier2.dds\", \"gta3.img/break_road.txd/cj_orangebarrier2.dds\",\n \"gta3.img/imy_trx.txd/cj_orangebarrier2.dds\", \"gta3.img/break_road.txd/cj_orangebarrier2.dds\",\n \"gta3.img/vegashiways.txd/hiwaymidlle_256.dds\", \"gta3.img/gb_laroads.txd/cos_hiwaymid_256.dds\",\n \"gta3.img/portakabin.txd/ws_finalbuild.dds\", \"gta3.img/cranes_dyn2.txd/ws_finalbuild.dds\",\n \"gta3.img/rnchlure.txd/mesa92interior128.dds\", \"gta3.img/mesa.txd/mesa92interior128.dds\",\n \"gostown6.img/gp_lotsbeach.txd/bridgewall3.dds\", \"gostown6.img/gp_baybridge.txd/bridgewall3.dds\",\n \"gostown6.img/gp_landbig.txd/route_05.dds\", \"gostown6.img/gp_dttunnel.txd/route_05.dds\",\n \"gostown6.img/gp_tunnels.txd/route_02.dds\", \"gostown6.img/gp_dttunnel.txd/route_05.dds\",\n \"gostown6.img/gp_tunnels.txd/route_05.dds\", \"gostown6.img/gp_dttunnel.txd/route_05.dds\",\n \"gta3.img/rhand.txd/torso8bit.dds\", \"gta3.img/lhand.txd/torso8bit.dds\",\n \"gta3.img/cabbie.txd/cabbie92interior128.dds\", \"gta3.img/admiral.txd/admiral92interior128.dds\",\n \"gta3.img/copcarvg.txd/cabbie92interior128.dds\", \"gta3.img/admiral.txd/admiral92interior128.dds\",\n \"gta3.img/elegant.txd/elegant92interior128.dds\", \"gta3.img/admiral.txd/admiral92interior128.dds\",\n \"gta3.img/fortune.txd/fortune92interior128.dds\", \"gta3.img/admiral.txd/admiral92interior128.dds\",\n \"gta3.img/glendale.txd/glendale92interior128.dds\", \"gta3.img/admiral.txd/admiral92interior128.dds\",\n \"gta3.img/greenwoo.txd/greenwoo92interior128.dds\", \"gta3.img/admiral.txd/admiral92interior128.dds\",\n \"gta3.img/journey.txd/journey92interior128.dds\", \"gta3.img/admiral.txd/admiral92interior128.dds\",\n \"gta3.img/monster.txd/monster92interior128.dds\", \"gta3.img/admiral.txd/admiral92interior128.dds\",\n \"gta3.img/oceanic.txd/oceanic92interior128.dds\", \"gta3.img/admiral.txd/admiral92interior128.dds\",\n \"gta3.img/sabre.txd/sabre92interior128.dds\", \"gta3.img/admiral.txd/admiral92interior128.dds\",\n \"gta3.img/voodoo.txd/voodoo92interior128.dds\", \"gta3.img/admiral.txd/admiral92interior128.dds\",\n \"gostown6.img/lodcity.txd/rocktbrn128.dds\", \"gostown6.img/gp_lodbig.txd/rocktbrn128.dds\",\n \"gostown6.img/lodlake.txd/rocktbrn128.dds\", \"gostown6.img/gp_lodbig.txd/rocktbrn128.dds\",\n \"gta3.img/junkpiles.txd/cj_rubbish1.dds\", \"gta3.img/cj_bins2.txd/cj_rubbish1.dds\",\n \"gta3.img/landjump.txd/planks01.dds\", \"gta3.img/benches.txd/planks01.dds\",\n \"gta3.img/woodpanels.txd/planks01.dds\", \"gta3.img/benches.txd/planks01.dds\",\n \"gta3.img/sadlshit.txd/sadler92extra64.dds\", \"gta3.img/sadler.txd/sadler92extra64.dds\",\n \"gta3.img/icons8.txd/pill_32.dds\", \"gta3.img/icons5.txd/pill_32.dds\",\n \"gta3.img/icons.txd/pill_32.dds\", \"gta3.img/icons5.txd/pill_32.dds\",\n \"gta3.img/metalbarrier.txd/alumox64b.dds\", \"gta3.img/electricgate.txd/alumox64b.dds\",\n \"gta3.img/signs.txd/alumox64b.dds\", \"gta3.img/electricgate.txd/alumox64b.dds\",\n \"gta3.img/roadside.txd/cj_frame_glass.dds\", \"gta3.img/metal.txd/cj_frame_glass.dds\",\n \"gta3.img/sunrise.txd/sentinel92interior128.dds\", \"gta3.img/sentinel.txd/sentinel92interior128.dds\",\n \"gta3.img/savanna2.txd/savanna92body256b.dds\", \"gta3.img/blade2.txd/blade92body256b.dds\",\n \"gta3.img/lawnburg.txd/burgershotsign1_256.dds\", \"gta3.img/bs_sfs.txd/burgershotsign1_256.dds\",\n \"gta3.img/sadlshit.txd/sadler92interior128.dds\", \"gta3.img/sadler.txd/sadler92interior128.dds\",\n \"gostown6.img/laguna.txd/garage_rich3.dds\", \"gostown6.img/gp_dt_45.txd/retainwall1.dds\",\n \"gta3.img/gta_brokentrees.txd/cj_bark.dds\", \"gta3.img/ciggarx.txd/cj_bark.dds\",\n \"gta3.img/player_props.txd/cj_bark.dds\", \"gta3.img/ciggarx.txd/cj_bark.dds\",\n \"gostown6.img/gp_gss.txd/metropillar4.dds\", \"gostown6.img/gp_baybridge.txd/metropillar4.dds\",\n \"gostown6.img/gp_tunnels.txd/metropillar4.dds\", \"gostown6.img/gp_baybridge.txd/metropillar4.dds\",\n \"gta3.img/sparrow.txd/bulletbelt.dds\", \"gta3.img/seaspar.txd/bulletbelt.dds\",\n \"gta3.img/dynsigns.txd/trim3.dds\", \"gostown6.img/gp_scaffolding.txd/trim3.dds\",\n \"gostown6.img/gp_landbig.txd/route_02b.dds\", \"gostown6.img/gp_lake.txd/route_02b.dds\",\n \"gostown6.img/gp_lotsbeach.txd/route_02b.dds\", \"gostown6.img/gp_lake.txd/route_02b.dds\",\n \"gostown6.img/gp_lots.txd/route_02b.dds\", \"gostown6.img/gp_lake.txd/route_02b.dds\",\n \"gostown6.img/gp_tunnels.txd/route_02b.dds\", \"gostown6.img/gp_lake.txd/route_02b.dds\",\n \"gostown6.img/gp_tunnels.txd/route_02props.dds\", \"gostown6.img/gp_lake.txd/route_02b.dds\",\n \"gta3.img/break_scaffold.txd/cj_s_pole.dds\", \"gta3.img/break_road.txd/cj_s_pole.dds\",\n \"gta3.img/break_s_fillers.txd/cj_s_pole.dds\", \"gta3.img/break_road.txd/cj_s_pole.dds\",\n \"gta3.img/metal.txd/bluemetal.dds\", \"gta3.img/helimagnet.txd/bluemetal.dds\",\n \"gta3.img/cj_bar.txd/cj_chrome2.dds\", \"gta3.img/7_11_door.txd/cj_chrome2.dds\",\n \"gta3.img/cj_street_props.txd/cj_chrome2.dds\", \"gta3.img/7_11_door.txd/cj_chrome2.dds\",\n \"gta3.img/ext_doors2.txd/cj_chrome2.dds\", \"gta3.img/7_11_door.txd/cj_chrome2.dds\",\n \"gta3.img/ext_doors_old.txd/cj_chrome2.dds\", \"gta3.img/7_11_door.txd/cj_chrome2.dds\",\n \"gta3.img/int_doors.txd/cj_chrome2.dds\", \"gta3.img/7_11_door.txd/cj_chrome2.dds\",\n \"gta3.img/new_shop_door.txd/cj_chrome2.dds\", \"gta3.img/7_11_door.txd/cj_chrome2.dds\",\n \"gta3.img/shop_doors2.txd/cj_chrome2.dds\", \"gta3.img/7_11_door.txd/cj_chrome2.dds\",\n \"gta3.img/shop_doors.txd/cj_chrome2.dds\", \"gta3.img/7_11_door.txd/cj_chrome2.dds\",\n \"gta3.img/rcgoblin.txd/rcgoblin92rotor64.dds\", \"gta3.img/rcbaron.txd/rcbaron92rotor64.dds\",\n \"gta3.img/rcraider.txd/rcraider92rotor64.dds\", \"gta3.img/rcbaron.txd/rcbaron92rotor64.dds\",\n \"gta3.img/k_militx.txd/billdetaily.dds\", \"gta3.img/billbrd.txd/billdetaily.dds\",\n \"gta3.img/fences.txd/alumox64.dds\", \"gta3.img/carrierxr.txd/alumox64.dds\",\n \"gta3.img/goflagx.txd/alumox64.dds\", \"gta3.img/carrierxr.txd/alumox64.dds\",\n \"gta3.img/metal.txd/alumox64.dds\", \"gta3.img/carrierxr.txd/alumox64.dds\",\n \"gta3.img/traincross.txd/alumox64.dds\", \"gta3.img/carrierxr.txd/alumox64.dds\",\n \"gta3.img/vgegassign.txd/alumox64.dds\", \"gta3.img/carrierxr.txd/alumox64.dds\",\n \"gta3.img/vgngassign.txd/alumox64.dds\", \"gta3.img/carrierxr.txd/alumox64.dds\",\n \"gta3.img/ws_roadside_dyn1.txd/alumox64.dds\", \"gta3.img/carrierxr.txd/alumox64.dds\",\n \"gta3.img/sf_roads.txd/sf_pave6.dds\", \"gta3.img/sanfranroads.txd/sf_pave6.dds\",\n \"gostown6.img/gp_dt_45.txd/trim5.dds\", \"gostown6.img/gp_dt2930.txd/trim5.dds\",\n \"gta3.img/rocketla.txd/gun_rocket_launcher.dds\", \"gta3.img/missile.txd/gun_rocket_launcher.dds\",\n \"gta3.img/tree2.txd/bzelka1.dds\", \"gta3.img/tree1.txd/bzelka1.dds\",\n \"gta3.img/gta_tree_palm.txd/trunk5.dds\", \"gta3.img/gta_tree_bevhills.txd/trunk5.dds\",\n \"gta3.img/billbox.txd/banding9_64hv.dds\", \"gta3.img/a51vntcvx.txd/banding9_64hv.dds\",\n \"gta3.img/billbrd.txd/banding9_64hv.dds\", \"gta3.img/a51vntcvx.txd/banding9_64hv.dds\",\n \"gta3.img/laroadsig_la_cj.txd/banding9_64hv.dds\", \"gta3.img/a51vntcvx.txd/banding9_64hv.dds\",\n \"gta3.img/signs.txd/banding9_64hv.dds\", \"gta3.img/a51vntcvx.txd/banding9_64hv.dds\",\n \"gostown6.img/gp_landbig.txd/dev_plasterwall001c.dds\", \"gostown6.img/gp_indubridge.txd/dev_plasterwall001c.dds\",\n \"gostown6.img/gp_lotsbeach.txd/dev_plasterwall001c.dds\", \"gostown6.img/gp_indubridge.txd/dev_plasterwall001c.dds\",\n \"gostown6.img/gp_lotsbeach.txd/mp_bigmetaldoor_256.dds\", \"gostown6.img/gp_dam.txd/mp_bigmetaldoor_256.dds\",\n \"gta3.img/rccam.txd/rcbandit92wheel32.dds\", \"gta3.img/rcbandit.txd/rcbandit92wheel32.dds\",\n \"gostown6.img/gp_tunnels.txd/m?tal_sale512.dds\", \"gostown6.img/gp_landbig.txd/m?tal_sale512.dds\",\n \"gta3.img/int_doors(cj).txd/cj_metaldoor1.dds\", \"gta3.img/dyn_garage.txd/cj_metaldoor1.dds\",\n \"gta3.img/stalks.txd/flowert.dds\", \"gta3.img/flowerb.txd/flowert.dds\",\n \"gta3.img/shandr.txd/blue2.dds\", \"gta3.img/shandl.txd/blue2.dds\",\n \"gta3.img/gta_tree_pineprc.txd/gen_log.dds\", \"gta3.img/gta_brokentrees.txd/gen_log.dds\",\n \"gostown6.img/gp_paradbridge.txd/inferno_material_28.dds\", \"gostown6.img/area13.txd/step.dds\",\n \"gta3.img/gta_tree_bevhills.txd/planta256.dds\", \"gta3.img/gta_potplants.txd/planta256.dds\",\n \"gta3.img/gta_tree_palm.txd/planta256.dds\", \"gta3.img/gta_potplants.txd/planta256.dds\",\n \"gta3.img/col_wall3x.txd/curtain_sink2.dds\", \"gta3.img/col_wall2x.txd/curtain_sink2.dds\",\n \"gta3.img/dyn_elec.txd/cj_lightwood.dds\", \"gta3.img/break_street1.txd/cj_lightwood.dds\",\n \"gta3.img/totoie.txd/cj_lightwood.dds\", \"gta3.img/break_street1.txd/cj_lightwood.dds\",\n \"gta3.img/dynpostbx.txd/bluemetal02.dds\", \"gta3.img/billbrd.txd/bluemetal02.dds\",\n \"gta3.img/dynrecycle.txd/bluemetal02.dds\", \"gta3.img/billbrd.txd/bluemetal02.dds\",\n \"gta3.img/break_fen_mesh.txd/gen_meshfencing.dds\", \"gta3.img/break_fen_mesh2.txd/gen_meshfencing.dds\",\n \"gta3.img/break_f_mesh.txd/gen_meshfencing.dds\", \"gta3.img/break_fen_mesh2.txd/gen_meshfencing.dds\",\n \"gta3.img/cj_street_props.txd/gen_meshfencing.dds\", \"gta3.img/break_fen_mesh2.txd/gen_meshfencing.dds\",\n \"gta3.img/ext_doors2.txd/gen_meshfencing.dds\", \"gta3.img/break_fen_mesh2.txd/gen_meshfencing.dds\",\n \"gta3.img/gategen.txd/gen_meshfencing.dds\", \"gta3.img/break_fen_mesh2.txd/gen_meshfencing.dds\",\n \"gta3.img/junkpiles.txd/gen_meshfencing.dds\", \"gta3.img/break_fen_mesh2.txd/gen_meshfencing.dds\",\n \"gta3.img/ws_apgatex.txd/gen_meshfencing.dds\", \"gta3.img/break_fen_mesh2.txd/gen_meshfencing.dds\",\n \"gostown6.img/gp_dt_45.txd/bridgewall2.dds\", \"gostown6.img/gp_baybridge.txd/bridgewall2.dds\",\n \"gta3.img/tractor.txd/tractor128.dds\", \"gta3.img/farmtr1.txd/tractor128.dds\",\n \"gta3.img/signs.txd/lamppost.dds\", \"gta3.img/mitraffic.txd/lamppost.dds\",\n \"gta3.img/streetlights.txd/lamppost.dds\", \"gta3.img/mitraffic.txd/lamppost.dds\",\n \"gta3.img/boxville.txd/boxville92crate128.dds\", \"gta3.img/boxburg.txd/boxville92crate128.dds\",\n \"gta3.img/bloodra.txd/black_carpet_256.dds\", \"gta3.img/barracks.txd/black_carpet_256.dds\",\n \"gta3.img/bus.txd/black_carpet_256.dds\", \"gta3.img/barracks.txd/black_carpet_256.dds\",\n \"gta3.img/clover.txd/black_carpet_256.dds\", \"gta3.img/barracks.txd/black_carpet_256.dds\",\n \"gta3.img/law_coffintxd.txd/starflower1.dds\", \"gta3.img/gta_procflowers.txd/starflower1.dds\",\n \"gta3.img/veg_fuzzyplant.txd/starflower1.dds\", \"gta3.img/gta_procflowers.txd/starflower1.dds\",\n \"gta3.img/lodcranes_dyn2.txd/lodblock2_high.dds\", \"gta3.img/lodcranes_dyn2_cj.txd/lodblock2_high.dds\",\n \"gta3.img/cranes_dyn2.txd/ws_bridgewins.dds\", \"gta3.img/cranes_dyn2_cj.txd/ws_bridgewins.dds\",\n \"gta3.img/polmav.txd/metpat64.dds\", \"gta3.img/nevada.txd/metpat64.dds\",\n \"gta3.img/break_street1.txd/cj_crates.dds\", \"gta3.img/break_s_box.txd/cj_crates.dds\",\n \"gta3.img/ramp1.txd/cj_crates.dds\", \"gta3.img/break_s_box.txd/cj_crates.dds\",\n \"gostown6.img/gp_lake.txd/route_05.dds\", \"gostown6.img/gp_indubridge.txd/route_05.dds\",\n \"gostown6.img/gp_landbig.txd/route_02stop.dds\", \"gostown6.img/gp_indubridge.txd/route_05.dds\",\n \"gostown6.img/gp_lotsbeach.txd/route_05.dds\", \"gostown6.img/gp_indubridge.txd/route_05.dds\",\n \"gostown6.img/gp_lots.txd/route_05.dds\", \"gostown6.img/gp_indubridge.txd/route_05.dds\",\n \"gostown6.img/gp_scaffolding.txd/scaffold2.dds\", \"gostown6.img/gp_electric.txd/scaffold2.dds\",\n \"gta3.img/boxburg.txd/boxville92wheel64.dds\", \"gta3.img/bobcat.txd/bobcat92wheel64.dds\",\n \"gta3.img/boxville.txd/boxville92wheel64.dds\", \"gta3.img/bobcat.txd/bobcat92wheel64.dds\",\n \"gta3.img/hotdog.txd/hotdog92wheel64.dds\", \"gta3.img/bobcat.txd/bobcat92wheel64.dds\",\n \"gta3.img/moonbeam.txd/bobcat92wheel64.dds\", \"gta3.img/bobcat.txd/bobcat92wheel64.dds\",\n \"gta3.img/mrwhoop.txd/mrwhoo92wheel64.dds\", \"gta3.img/bobcat.txd/bobcat92wheel64.dds\",\n \"gta3.img/utiltr1.txd/utiltr192wheel64.dds\", \"gta3.img/bobcat.txd/bobcat92wheel64.dds\",\n \"gta3.img/walton.txd/walton92wheel64.dds\", \"gta3.img/bobcat.txd/bobcat92wheel64.dds\",\n \"gta3.img/yankee.txd/yankee92wheel64.dds\", \"gta3.img/bobcat.txd/bobcat92wheel64.dds\",\n \"gta3.img/foodkarts.txd/beachwalkway.dds\", \"gta3.img/ct_stabx.txd/beachwalkway.dds\",\n \"gta3.img/a51_labdoor.txd/girder2_grey_64hv.dds\", \"gta3.img/a51_crane.txd/girder2_grey_64hv.dds\",\n \"gta3.img/targetmx.txd/girder2_grey_64hv.dds\", \"gta3.img/a51_crane.txd/girder2_grey_64hv.dds\",\n \"gta3.img/seabed.txd/rocktq128_dirt.dds\", \"gta3.img/seabedcs.txd/rocktq128_dirt.dds\",\n \"gta3.img/bmydrug.txd/neckcross.dds\", \"gta3.img/bmycr.txd/neckcross.dds\",\n \"gta3.img/hmycr.txd/neckcross.dds\", \"gta3.img/bmycr.txd/neckcross.dds\",\n \"gta3.img/hmydrug.txd/neckcross.dds\", \"gta3.img/bmycr.txd/neckcross.dds\",\n \"gta3.img/lsv3.txd/neckcross.dds\", \"gta3.img/bmycr.txd/neckcross.dds\",\n \"gta3.img/sfr2.txd/neckcross.dds\", \"gta3.img/bmycr.txd/neckcross.dds\",\n \"gta3.img/vla2.txd/neckcross.dds\", \"gta3.img/bmycr.txd/neckcross.dds\",\n \"gta3.img/vla3.txd/neckcross.dds\", \"gta3.img/bmycr.txd/neckcross.dds\",\n \"gta3.img/wmycr.txd/neckcross.dds\", \"gta3.img/bmycr.txd/neckcross.dds\",\n \"gta3.img/radar85.txd/radar85.dds\", \"gta3.img/radar84.txd/radar84.dds\",\n \"gta3.img/dyn_elec.txd/cj_tv_screen.dds\", \"gta3.img/break_street1.txd/cj_tv_screen.dds\",\n \"gta3.img/break_road.txd/cj_corrigated.dds\", \"gta3.img/break_f_mesh.txd/cj_corrigated.dds\",\n \"gta3.img/break_street1.txd/cj_corrigated.dds\", \"gta3.img/break_f_mesh.txd/cj_corrigated.dds\",\n \"gta3.img/break_street2.txd/cj_corrigated.dds\", \"gta3.img/break_f_mesh.txd/cj_corrigated.dds\",\n \"gta3.img/imy_trx.txd/cj_corrigated.dds\", \"gta3.img/break_f_mesh.txd/cj_corrigated.dds\",\n \"gta3.img/junkpiles.txd/cj_corrigated.dds\", \"gta3.img/break_f_mesh.txd/cj_corrigated.dds\",\n \"gta3.img/ramp1.txd/cj_corrigated.dds\", \"gta3.img/break_f_mesh.txd/cj_corrigated.dds\",\n \"gta3.img/premier.txd/policemiami86body128b.dds\", \"gta3.img/copcarla.txd/policemiami86body128b.dds\",\n \"gta3.img/taxi.txd/policemiami86body128b.dds\", \"gta3.img/copcarla.txd/policemiami86body128b.dds\",\n \"gta3.img/dyn_objects.txd/cj_o2tank.dds\", \"gta3.img/cj_street_props.txd/cj_o2tank.dds\",\n \"gta3.img/break_scaffold.txd/cheerybox03.dds\", \"gta3.img/b_fen_wood.txd/cheerybox03.dds\",\n \"gta3.img/elegy.txd/infernus92handle32.dds\", \"gta3.img/banshee.txd/banshee92handle32.dds\",\n \"gta3.img/picador.txd/picador92interior128.dds\", \"gta3.img/burrito.txd/burrito92interior128.dds\",\n \"gta3.img/k_pool.txd/trilby04.dds\", \"gta3.img/kei_wnchx.txd/trilby04.dds\",\n \"gta3.img/mule.txd/mule92interior128.dds\", \"gta3.img/benson.txd/mule92interior128.dds\",\n \"gta3.img/lawnburg.txd/vgnburgwal2_128.dds\", \"gta3.img/bs_sfs.txd/vgnburgwal2_128.dds\",\n \"gta3.img/seabed.txd/cw2_mounttrailblank.dds\", \"gta3.img/seabedcs.txd/cw2_mounttrailblank.dds\",\n \"gta3.img/veg_leaves.txd/planterbox128.dds\", \"gta3.img/veg_leavesplnt.txd/planterbox128.dds\",\n \"gta3.img/telegraph.txd/board64_law.dds\", \"gta3.img/farmstuff.txd/board64_law.dds\",\n \"gta3.img/skimmer.txd/cargobobrotorblack128.dds\", \"gta3.img/maverick.txd/cargobobrotorblack128.dds\",\n \"gta3.img/gta_deserttrees.txd/sm_des_bush1.dds\", \"gta3.img/badlands.txd/sm_des_bush1.dds\",\n \"gta3.img/gtarock_deserts.txd/sm_des_bush1.dds\", \"gta3.img/badlands.txd/sm_des_bush1.dds\",\n \"gta3.img/dyncones.txd/redwhite_stripe.dds\", \"gta3.img/benches.txd/redwhite_stripe.dds\",\n \"gta3.img/foodkarts.txd/redwhite_stripe.dds\", \"gta3.img/benches.txd/redwhite_stripe.dds\",\n \"gta3.img/smashbarr.txd/redwhite_stripe.dds\", \"gta3.img/benches.txd/redwhite_stripe.dds\",\n \"gostown6.img/gp_landbig.txd/rocktbrn128.dds\", \"gostown6.img/gp_lake.txd/rocktbrn128.dds\",\n \"gostown6.img/gp_lots.txd/rocktbrn128.dds\", \"gostown6.img/gp_lake.txd/rocktbrn128.dds\",\n \"gostown6.img/gp_tunnels.txd/rockwall.dds\", \"gostown6.img/gp_lake.txd/rocktbrn128.dds\",\n \"gta3.img/savanna.txd/savanna92interior128.dds\", \"gta3.img/broadway.txd/broadway92interior128.dds\",\n \"gta3.img/break_s_box.txd/gen_box.dds\", \"gta3.img/break_s_bins.txd/gen_box.dds\",\n \"gta3.img/junkpiles.txd/gen_box.dds\", \"gta3.img/break_s_bins.txd/gen_box.dds\",\n \"gostown6.img/gp_dttunnel.txd/a51_wall2.dds\", \"gostown6.img/area13.txd/a51_wall2.dds\",\n \"gta3.img/gta_potplants.txd/yuka256.dds\", \"gta3.img/gta_potplants2.txd/yuka256.dds\",\n \"gta3.img/seaspar.txd/polmav92texpage128.dds\", \"gta3.img/maverick.txd/maverick92texpage128.dds\",\n \"gta3.img/sparrow.txd/polmav92texpage128.dds\", \"gta3.img/maverick.txd/maverick92texpage128.dds\",\n \"gta3.img/vcnmav.txd/polmav92texpage128.dds\", \"gta3.img/maverick.txd/maverick92texpage128.dds\",\n \"gta3.img/elegant.txd/elegant92wheel64.dds\", \"gta3.img/admiral.txd/admiral92wheel64.dds\",\n \"gta3.img/lawnburg.txd/vgnburger_256.dds\", \"gta3.img/bs_sfs.txd/vgnburger_256.dds\",\n \"gta3.img/katana.txd/gun_katana.dds\", \"gta3.img/adswrdx.txd/gun_katana.dds\",\n \"gostown6.img/gp_tunnels.txd/prx_subway.dds\", \"gostown6.img/gp_landbig.txd/prx_subway.dds\",\n \"gta3.img/rcraider.txd/rcraider92texpage32.dds\", \"gta3.img/rcgoblin.txd/rcgoblin92texpage32.dds\",\n \"gta3.img/law_coffintxd.txd/starflower2.dds\", \"gta3.img/gta_procflowers.txd/starflower2.dds\",\n \"gostown6.img/gp_lotsbeach.txd/sf_pave6 copie.dds\", \"gostown6.img/gp_indubridge.txd/sf_pave6 copie.dds\",\n \"gostown6.img/gp_lots.txd/sf_pave6 copie.dds\", \"gostown6.img/gp_indubridge.txd/sf_pave6 copie.dds\",\n \"gta3.img/vegasroads.txd/crossing_law.dds\", \"gta3.img/gb_laroads.txd/crossing_law.dds\",\n \"gta3.img/cargobob.txd/cargobobrotorblack128.dds\", \"gta3.img/beagle.txd/cargobobrotorblack128.dds\",\n \"gta3.img/hunter.txd/cargobobrotorblack128.dds\", \"gta3.img/beagle.txd/cargobobrotorblack128.dds\",\n \"gta3.img/leviathn.txd/cargobobrotorblack128.dds\", \"gta3.img/beagle.txd/cargobobrotorblack128.dds\",\n \"gta3.img/polmav.txd/cargobobrotorblack128.dds\", \"gta3.img/beagle.txd/cargobobrotorblack128.dds\",\n \"gta3.img/raindanc.txd/cargobobrotorblack128.dds\", \"gta3.img/beagle.txd/cargobobrotorblack128.dds\",\n \"gta3.img/seaspar.txd/cargobobrotorblack128.dds\", \"gta3.img/beagle.txd/cargobobrotorblack128.dds\",\n \"gta3.img/sparrow.txd/cargobobrotorblack128.dds\", \"gta3.img/beagle.txd/cargobobrotorblack128.dds\",\n \"gta3.img/vcnmav.txd/cargobobrotorblack128.dds\", \"gta3.img/beagle.txd/cargobobrotorblack128.dds\",\n \"gostown6.img/gp_dt2930.txd/alpha02.dds\", \"gostown6.img/gp_dam.txd/alpha02.dds\",\n \"gostown6.img/gp_ind37.txd/metalgrate013b.dds\", \"gostown6.img/gp_dam.txd/alpha02.dds\",\n \"gostown6.img/gp_landbig.txd/metaltube.dds\", \"gostown6.img/gp_baybridge.txd/metaltube.dds\",\n \"gostown6.img/gp_tunnels.txd/metaltube.dds\", \"gostown6.img/gp_baybridge.txd/metaltube.dds\",\n \"gostown6.img/lodcity.txd/route_02stopline.dds\", \"gostown6.img/gp_lodbig.txd/route_02stopline.dds\",\n \"gostown6.img/lodlake.txd/route_02stopline.dds\", \"gostown6.img/gp_lodbig.txd/route_02stopline.dds\",\n \"gostown6.img/lodlotsbeach.txd/route_02stopline.dds\", \"gostown6.img/gp_lodbig.txd/route_02stopline.dds\",\n \"gostown6.img/gp_dttunnel.txd/girder2_grey_64hv.dds\", \"gostown6.img/area13.txd/girder2_grey_64hv.dds\",\n \"gta3.img/imy_bbox.txd/crate_b.dds\", \"gta3.img/gunbox.txd/crate_b.dds\",\n \"gostown6.img/laguna.txd/desgreengrass.dds\", \"gostown6.img/laguna.txd/desertgryard256.dds\",\n \"gostown6.img/laguna.txd/grassdeep256.dds\", \"gostown6.img/laguna.txd/desertgryard256.dds\",\n \"gostown6.img/laguna.txd/grassmixdirt.dds\", \"gostown6.img/laguna.txd/desertgryard256.dds\",\n \"gta3.img/ct_stabx.txd/ct_canopy.dds\", \"gta3.img/bdwinx.txd/ct_canopy.dds\",\n \"gta3.img/dyn_objects.txd/cj_bottle.dds\", \"gta3.img/break_bar.txd/cj_bottle.dds\",\n \"gta3.img/radar51.txd/radar51.dds\", \"gta3.img/radar50.txd/radar50.dds\",\n \"gta3.img/trash.txd/trash92decal128.dds\", \"gta3.img/sweeper.txd/sweeper92decal128.dds\",\n \"gostown6.img/lodcity.txd/ter_rock3.dds\", \"gostown6.img/gp_lodbig.txd/ter_rock3 copie.dds\",\n \"gostown6.img/lodlake.txd/ter_rock3.dds\", \"gostown6.img/gp_lodbig.txd/ter_rock3 copie.dds\",\n \"gostown6.img/lodlake.txd/ter_moss1.dds\", \"gostown6.img/lodcity.txd/ter_moss1.dds\",\n \"gostown6.img/lodlotsbeach.txd/ter_moss1.dds\", \"gostown6.img/lodcity.txd/ter_moss1.dds\",\n \"gta3.img/sf_roads.txd/sf_junction3.dds\", \"gta3.img/sanfranroads.txd/sf_junction3.dds\",\n \"gta3.img/emperor.txd/stafford92interior128.dds\", \"gta3.img/blistac.txd/blistac92interior128.dds\",\n \"gta3.img/previon.txd/willard92interior128.dds\", \"gta3.img/blistac.txd/blistac92interior128.dds\",\n \"gta3.img/stafford.txd/stafford92interior128.dds\", \"gta3.img/blistac.txd/blistac92interior128.dds\",\n \"gta3.img/turismo.txd/stafford92interior128.dds\", \"gta3.img/blistac.txd/blistac92interior128.dds\",\n \"gta3.img/willard.txd/willard92interior128.dds\", \"gta3.img/blistac.txd/blistac92interior128.dds\",\n \"gostown6.img/gp_paradbridge.txd/bridge5.dds\", \"gostown6.img/gp_dt2930.txd/bridge5.dds\",\n \"gta3.img/farmstuff.txd/gen_rusty_poll.dds\", \"gta3.img/des_xoilfield.txd/gen_rusty_poll.dds\",\n \"gta3.img/streak.txd/streaklogoside128x256.dds\", \"gta3.img/streakc.txd/streakclogoside128x256.dds\",\n \"gta3.img/break_street1.txd/cj_dump.dds\", \"gta3.img/break_fence3.txd/cj_dump.dds\",\n \"gta3.img/cj_bins2.txd/cj_dump.dds\", \"gta3.img/break_fence3.txd/cj_dump.dds\",\n \"gta3.img/cj_bins.txd/cj_dump.dds\", \"gta3.img/break_fence3.txd/cj_dump.dds\",\n \"gta3.img/tmbinx.txd/cj_dump.dds\", \"gta3.img/break_fence3.txd/cj_dump.dds\",\n \"gta3.img/vcnmav.txd/gtv logo 1.dds\", \"gta3.img/sparrow.txd/gtv logo 1.dds\",\n \"gta3.img/int_doors.txd/cj_scor_door.dds\", \"gta3.img/ext_doors2.txd/cj_scor_door.dds\",\n \"gta3.img/shop_doors.txd/cj_scor_door.dds\", \"gta3.img/ext_doors2.txd/cj_scor_door.dds\",\n \"gta3.img/fam3.txd/neckcross.dds\", \"gta3.img/bmydj.txd/neckcross.dds\",\n \"gta3.img/ryder.txd/ryder.dds\", \"gta3.img/ryder2.txd/ryder2.dds\",\n \"gta3.img/junkpiles.txd/cj_strolly.dds\", \"gta3.img/cj_dyn_prop.txd/cj_strolly.dds\",\n \"gta3.img/topfun.txd/pony92interior128.dds\", \"gta3.img/pony.txd/pony92interior128.dds\",\n \"gta3.img/cj_street_props.txd/cj_plating3.dds\", \"gta3.img/break_street2.txd/cj_plating3.dds\",\n \"gostown6.img/gp_landbig.txd/sable_b_grass.dds\", \"gostown6.img/gp_lake.txd/sable_b_grass.dds\",\n \"gta3.img/gategen.txd/ws_leccyfncetop.dds\", \"gta3.img/elecfence_bar.txd/ws_leccyfncetop.dds\",\n \"gta3.img/gta_tree_boak.txd/sm_bark_light.dds\", \"gta3.img/gta_tree_bevhills.txd/sm_bark_light.dds\",\n \"gostown6.img/gp_paradbridge.txd/bridge1.dds\", \"gostown6.img/gp_dt_45.txd/bridge1.dds\",\n \"gostown6.img/lodlake.txd/sf_pave6 copie.dds\", \"gostown6.img/lodcity.txd/sf_pave6 copie.dds\",\n \"gostown6.img/lodlotsbeach.txd/sf_pave6 copie.dds\", \"gostown6.img/lodcity.txd/sf_pave6 copie.dds\",\n \"gta3.img/electricgate.txd/fencekb_64h.dds\", \"gta3.img/ctgtxx.txd/fencekb_64h.dds\",\n \"gta3.img/fences.txd/fencekb_64h.dds\", \"gta3.img/ctgtxx.txd/fencekb_64h.dds\",\n \"gta3.img/flatbed.txd/bodykitmesh64.dds\", \"gta3.img/duneride.txd/bodykitmesh64.dds\",\n \"gta3.img/speeder.txd/bodykitmesh64.dds\", \"gta3.img/duneride.txd/bodykitmesh64.dds\",\n \"gta3.img/sentinel.txd/sentinel92wheel64.dds\", \"gta3.img/romero.txd/romero92wheel64.dds\",\n \"gta3.img/washing.txd/washing92wheel64.dds\", \"gta3.img/romero.txd/romero92wheel64.dds\",\n \"gta3.img/bustopm.txd/cj_frame_glass.dds\", \"gta3.img/break_fence3.txd/cj_frame_glass.dds\",\n \"gta3.img/comet.txd/comet92interior128.dds\", \"gta3.img/buffalo.txd/buffalo92interior128.dds\",\n \"gta3.img/sf_roads.txd/sf_tramline2.dds\", \"gta3.img/sanfranroads.txd/sf_tramline2.dds\",\n \"gta3.img/ws_apgatex.txd/wheel02_64.dds\", \"gta3.img/electricgate.txd/wheel02_64.dds\",\n \"gta3.img/gta_potplantsaa.txd/kb_teracota_pot64.dds\", \"gta3.img/gta_potplants2.txd/kb_teracota_pot64.dds\",\n \"gta3.img/gta_potplants.txd/kb_teracota_pot64.dds\", \"gta3.img/gta_potplants2.txd/kb_teracota_pot64.dds\",\n \"gta3.img/gta_potplantsx.txd/kb_teracota_pot64.dds\", \"gta3.img/gta_potplants2.txd/kb_teracota_pot64.dds\",\n \"gta3.img/kbplantssmz.txd/kb_teracota_pot64.dds\", \"gta3.img/gta_potplants2.txd/kb_teracota_pot64.dds\",\n \"gta3.img/gta_tree_oldpine.txd/gen_log.dds\", \"gta3.img/gta_tree_boak.txd/gen_log.dds\",\n \"gta3.img/gta_tree_pine.txd/gen_log.dds\", \"gta3.img/gta_tree_boak.txd/gen_log.dds\",\n \"gta3.img/gta_brokentrees.txd/cj_plant.dds\", \"gta3.img/cj_plant_props.txd/cj_plant.dds\",\n \"gta3.img/firetruk.txd/firetruk92wheel.dds\", \"gta3.img/ambulan.txd/ambulan92wheel.dds\",\n \"gta3.img/newsvan.txd/newsvan92wheel64.dds\", \"gta3.img/ambulan.txd/ambulan92wheel.dds\",\n \"gta3.img/pony.txd/pony92wheel64.dds\", \"gta3.img/ambulan.txd/ambulan92wheel.dds\",\n \"gta3.img/topfun.txd/pony92wheel64.dds\", \"gta3.img/ambulan.txd/ambulan92wheel.dds\",\n \"gta3.img/kbplantssmz2.txd/kbtree4_test.dds\", \"gta3.img/gta_tree_palm.txd/kbtree4_test.dds\",\n \"gta3.img/sparrow.txd/camo 4.dds\", \"gta3.img/baggage.txd/camo 4.dds\",\n \"gta3.img/col_wall2x.txd/ab_wood1.dds\", \"gta3.img/col_wall1x.txd/ab_wood1.dds\",\n \"gta3.img/col_wall3x.txd/ab_wood1.dds\", \"gta3.img/col_wall1x.txd/ab_wood1.dds\",\n \"gta3.img/rdtraint.txd/rdtraint92wheel64.dds\", \"gta3.img/forklift.txd/forklift92wheel64.dds\",\n \"gta3.img/escstep.txd/shutters.dds\", \"gta3.img/docklight.txd/shutters.dds\",\n \"gostown6.img/gp_dt2930.txd/17nyst_06.dds\", \"gostown6.img/gp_dt_19.txd/17nyst_06.dds\",\n \"gostown6.img/lodlotsbeach.txd/mp_bigmetaldoor_256.dds\", \"gostown6.img/loddam.txd/mp_bigmetaldoor_256.dds\",\n \"gta3.img/monsterb.txd/monsterb92wheel64.dds\", \"gta3.img/monstera.txd/monstera92wheel64.dds\",\n \"gta3.img/lodcranes_dyn2.txd/lodoldpaintedyello_b.dds\", \"gta3.img/lodcranes_dyn2_cj.txd/lodoldpaintedyello_b.dds\",\n \"gta3.img/fhandr.txd/blue3.dds\", \"gta3.img/fhandl.txd/blue3.dds\",\n \"gta3.img/break_scaffold.txd/cj_w_wood.dds\", \"gta3.img/break_fence1.txd/cj_w_wood.dds\",\n \"gta3.img/break_street2.txd/cj_w_wood.dds\", \"gta3.img/break_fence1.txd/cj_w_wood.dds\",\n \"gta3.img/gazebo.txd/cj_w_wood.dds\", \"gta3.img/break_fence1.txd/cj_w_wood.dds\",\n \"gta3.img/int_doors.txd/cj_w_wood.dds\", \"gta3.img/break_fence1.txd/cj_w_wood.dds\",\n \"gta3.img/boxville.txd/boxville92interior128.dds\", \"gta3.img/boxburg.txd/boxville92interior128.dds\",\n \"gta3.img/duneride.txd/dunerider92interior128.dds\", \"gta3.img/boxburg.txd/boxville92interior128.dds\",\n \"gta3.img/hotring.txd/hotring92interior64.dds\", \"gta3.img/bravura.txd/hotrina92interior64.dds\",\n \"gta3.img/cj_barr_set_1.txd/chevron_red_64hva.dds\", \"gta3.img/barrier.txd/chevron_red_64hva.dds\",\n \"gta3.img/helixbarrier.txd/chevron_red_64hva.dds\", \"gta3.img/barrier.txd/chevron_red_64hva.dds\",\n \"gta3.img/metalbarrier.txd/chevron_red_64hva.dds\", \"gta3.img/barrier.txd/chevron_red_64hva.dds\",\n \"gta3.img/tags_lafront.txd/frontyard.dds\", \"gta3.img/tags2_lalae.txd/frontyard.dds\",\n \"gta3.img/player_props.txd/cj_bottle3.dds\", \"gta3.img/dyn_objects.txd/cj_bottle3.dds\",\n \"gta3.img/targets.txd/target4.dds\", \"gta3.img/targetmx.txd/target4.dds\",\n \"gostown6.img/gp_lots.txd/metalgrate013b.dds\", \"gostown6.img/gp_lake.txd/metalgrate013b.dds\",\n \"gostown6.img/gp_paradbridge.txd/bridge7.dds\", \"gostown6.img/gp_dt2930.txd/bridge7.dds\",\n \"gostown6.img/gp_scaffolding.txd/bridge7.dds\", \"gostown6.img/gp_dt2930.txd/bridge7.dds\",\n \"gta3.img/dynsigns.txd/bridge7.dds\", \"gostown6.img/gp_dt2930.txd/bridge7.dds\",\n \"gta3.img/dynsigns.txd/metal1_128.dds\", \"gostown6.img/gp_dt2930.txd/bridge7.dds\",\n \"gta3.img/col_wall2x.txd/mp_burn_wall4.dds\", \"gta3.img/col_wall1x.txd/mp_burn_wall4.dds\",\n \"gta3.img/col_wall5x.txd/mp_burn_wall4.dds\", \"gta3.img/col_wall1x.txd/mp_burn_wall4.dds\",\n \"gostown6.img/lodlake.txd/metropillar5.dds\", \"gostown6.img/lodgss.txd/metropillar5.dds\",\n \"gta3.img/labins01_la.txd/metal1_128.dds\", \"gta3.img/des_xoilfield.txd/metal1_128.dds\",\n \"gta3.img/maingatetxd.txd/metal1_128.dds\", \"gta3.img/des_xoilfield.txd/metal1_128.dds\",\n \"gta3.img/roadsign.txd/metal1_128.dds\", \"gta3.img/des_xoilfield.txd/metal1_128.dds\",\n \"gta3.img/telegraph.txd/metal1_128.dds\", \"gta3.img/des_xoilfield.txd/metal1_128.dds\",\n \"gta3.img/silenced.txd/v_usp1.dds\", \"gta3.img/colt45.txd/v_usp1.dds\",\n \"gta3.img/portakabin.txd/ws_oldpainted.dds\", \"gta3.img/elecfence_bar.txd/ws_oldpainted.dds\",\n \"gta3.img/copcarla.txd/copcarla92wheel64.dds\", \"gta3.img/bfinject.txd/emperor92wheel64.dds\",\n \"gta3.img/copcarsf.txd/copcarla92wheel64.dds\", \"gta3.img/bfinject.txd/emperor92wheel64.dds\",\n \"gta3.img/emperor.txd/emperor92wheel64.dds\", \"gta3.img/bfinject.txd/emperor92wheel64.dds\",\n \"gta3.img/feltzer.txd/feltzer92wheel64.dds\", \"gta3.img/bfinject.txd/emperor92wheel64.dds\",\n \"gta3.img/fortune.txd/fortune92wheel64.dds\", \"gta3.img/bfinject.txd/emperor92wheel64.dds\",\n \"gta3.img/hotknife.txd/emperor92wheel64.dds\", \"gta3.img/bfinject.txd/emperor92wheel64.dds\",\n \"gta3.img/premier.txd/copcarla92wheel64.dds\", \"gta3.img/bfinject.txd/emperor92wheel64.dds\",\n \"gta3.img/sandking.txd/emperor92wheel64.dds\", \"gta3.img/bfinject.txd/emperor92wheel64.dds\",\n \"gta3.img/taxi.txd/copcarla92wheel64.dds\", \"gta3.img/bfinject.txd/emperor92wheel64.dds\",\n \"gta3.img/lawnburg.txd/gewhite1_64.dds\", \"gta3.img/bs_sfs.txd/gewhite1_64.dds\",\n \"gostown6.img/gp_lots.txd/trim3.dds\", \"gostown6.img/gp_dt_45.txd/trim3.dds\",\n \"gostown6.img/gp_landbig.txd/ter_rock3 copie.dds\", \"gostown6.img/gp_lake.txd/ter_rock3.dds\",\n \"gostown6.img/gp_lots.txd/ter_rock3.dds\", \"gostown6.img/gp_lake.txd/ter_rock3.dds\",\n \"gta3.img/break_s_box.txd/gen_bin_bag.dds\", \"gta3.img/break_pallet.txd/gen_bin_bag.dds\",\n \"gta3.img/drubish.txd/gen_bin_bag.dds\", \"gta3.img/break_pallet.txd/gen_bin_bag.dds\",\n \"gostown6.img/gp_lake.txd/sf_pave6 copie.dds\", \"gostown6.img/gp_indust_42.txd/sf_pave6 copie.dds\",\n \"gostown6.img/gp_landbig.txd/ter_sand1tomoss.dds\", \"gostown6.img/gp_lake.txd/ter_sand1tomoss.dds\",\n \"gta3.img/break_street1.txd/cj_sheet2.dds\", \"gta3.img/break_road_ws.txd/cj_sheet2.dds\",\n \"gta3.img/cj_street_props.txd/cj_sheet2.dds\", \"gta3.img/break_road_ws.txd/cj_sheet2.dds\",\n \"gta3.img/trolex.txd/trolley02.dds\", \"gta3.img/jt_doorx.txd/trolley02.dds\",\n \"gta3.img/gta_tree_bevhills.txd/kbtree3_test.dds\", \"gta3.img/gta_potplants.txd/kbtree3_test.dds\",\n \"gta3.img/gta_tree_palm.txd/kbtree3_test.dds\", \"gta3.img/gta_potplants.txd/kbtree3_test.dds\",\n \"gta3.img/kbplantssmz2.txd/kbtree3_test.dds\", \"gta3.img/gta_potplants.txd/kbtree3_test.dds\",\n \"gta3.img/dft30.txd/yankee92interior128.dds\", \"gta3.img/barracks.txd/yankee92interior128.dds\",\n \"gta3.img/polmav.txd/cargo_ceil2.dds\", \"gta3.img/nevada.txd/cargo_ceil2.dds\",\n \"gta3.img/copcarru.txd/rancher92wheel64.dds\", \"gta3.img/burrito.txd/burrito92wheel64.dds\",\n \"gta3.img/fbiranch.txd/rancher92wheel64.dds\", \"gta3.img/burrito.txd/burrito92wheel64.dds\",\n \"gta3.img/picador.txd/utility92wheel64.dds\", \"gta3.img/burrito.txd/burrito92wheel64.dds\",\n \"gta3.img/rancher.txd/rancher92wheel64.dds\", \"gta3.img/burrito.txd/burrito92wheel64.dds\",\n \"gta3.img/utility.txd/utility92wheel64.dds\", \"gta3.img/burrito.txd/burrito92wheel64.dds\",\n \"gostown6.img/gp_scaffolding.txd/sprunky.dds\", \"gostown6.img/gp_dt_40.txd/postersprn.dds\",\n \"gta3.img/sparrow.txd/polmav92texpageb64.dds\", \"gta3.img/seaspar.txd/polmav92texpageb64.dds\",\n \"gta3.img/vcnmav.txd/polmav92texpageb64.dds\", \"gta3.img/seaspar.txd/polmav92texpageb64.dds\",\n \"gostown6.img/gp_roofs.txd/porte_roof.dds\", \"gostown6.img/gp_dt_19.txd/porte_roof.dds\",\n \"gostown6.img/gp_dt_40.txd/roof1.dds\", \"gostown6.img/gp_dt_19.txd/roofground.dds\",\n \"gostown6.img/gp_dt_45.txd/roofground.dds\", \"gostown6.img/gp_dt_19.txd/roofground.dds\",\n \"gostown6.img/gp_lots.txd/roofground.dds\", \"gostown6.img/gp_dt_19.txd/roofground.dds\",\n \"gostown6.img/gp_scaffolding.txd/boulona.dds\", \"gostown6.img/gp_dt_45.txd/boulona.dds\",\n \"gostown6.img/laguna.txd/ws_alley2_128_dirt.dds\", \"gostown6.img/laguna.txd/tarmac_4a.dds\",\n \"gta3.img/vincent.txd/vincent92interior128.dds\", \"gta3.img/moonbeam.txd/moonbeam92interior128.dds\",\n \"gta3.img/windsor.txd/vincent92interior128.dds\", \"gta3.img/moonbeam.txd/moonbeam92interior128.dds\",\n \"gta3.img/dynsigns.txd/planche.dds\", \"gostown6.img/gp_scaffolding.txd/planche.dds\",\n \"gta3.img/roadblkx.txd/warnsigns1.dds\", \"gta3.img/barrierblk.txd/warnsigns1.dds\",\n \"gta3.img/elecfence_bar.txd/ws_griddyfence.dds\", \"gta3.img/arsex.txd/ws_griddyfence.dds\",\n \"gta3.img/helimagnet.txd/redallu.dds\", \"gta3.img/dynbarrels.txd/redallu.dds\",\n \"gostown6.img/gp_lodbig.txd/route_02stop.dds\", \"gostown6.img/gp_lodbig.txd/route_02b.dds\",\n \"gostown6.img/lodcity.txd/route_02b.dds\", \"gostown6.img/gp_lodbig.txd/route_02b.dds\",\n \"gostown6.img/lodlake.txd/route_02b.dds\", \"gostown6.img/gp_lodbig.txd/route_02b.dds\",\n \"gostown6.img/lodlotsbeach.txd/route_02b.dds\", \"gostown6.img/gp_lodbig.txd/route_02b.dds\",\n \"gta3.img/dynsigns.txd/white64.dds\", \"gta3.img/cj_traffic.txd/white.dds\",\n \"gta3.img/kei_wnchx.txd/white.dds\", \"gta3.img/cj_traffic.txd/white.dds\",\n \"gta3.img/des_xoilfield.txd/fire_esc_fence.dds\", \"gta3.img/cranes_dyn2_cj.txd/fire_esc_fence.dds\",\n\n\n}; // }}}\n\n\nvoid init_tex_dup_map()\n{\n size_t c = sizeof(massive_array)/sizeof(*massive_array);\n if (c%2) {\n std::cerr << \"The massive array in tex_dups.c++ does not have \"\n << \"an even number of elements.\" << std::endl;\n exit(EXIT_FAILURE);\n }\n for (size_t i=0 ; i<c ; i+=2) {\n const char *a = massive_array[i];\n const char *b = massive_array[i+1];\n tex_dup_map[a] = b;\n }\n initialised = true;\n}\n\nstd::string tex_dup (const std::string &in) \n{\n if (!initialised) return in;\n TexDupMap::iterator i = tex_dup_map.find(in);\n if (i==tex_dup_map.end()) return in;\n return i->second;\n}\n\n\n// vim: shiftwidth=8:tabstop=8:expandtab\n" }, { "alpha_fraction": 0.5723101496696472, "alphanum_fraction": 0.5744566917419434, "avg_line_length": 41.839080810546875, "blob_id": "a695667db1aff167061925129ab4dbf44bedd400", "content_id": "561010931875664709cae95b8becbba8850356e3", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 3727, "license_type": "permissive", "max_line_length": 94, "num_lines": 87, "path": "/dependencies/quex-0.34.1/quex/code_base/template/buffer_access.i", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "// -*- C++ -*- vim:set syntax=cpp:\nnamespace quex { \n\n inline bool \n CLASS::buffer_copy(QUEX_CHARACTER_TYPE* Content, const size_t Size)\n {\n QuexBuffer* buffer = &this->buffer;\n size_t copy_size = Size;\n const size_t ContentSize = QuexBuffer_content_size(buffer);\n QUEX_CHARACTER_TYPE* front = QuexBuffer_content_front(buffer);\n\n if( copy_size > ContentSize ) copy_size = ContentSize;\n /* Let us use 'move', because we can never know if the user might want\n * to copy arround content from inside the buffer. 'copy' would assume\n * that the target and source do not overlap. */\n __QUEX_STD_memmove(front, Content, copy_size);\n\n /* Initiate the lexing process */\n this->buffer_prepare(copy_size);\n\n return copy_size == Size;\n }\n\n inline bool \n CLASS::buffer_append(QUEX_CHARACTER_TYPE* Content, const size_t Size)\n /* NOTE: It is not necessary after a call to this function to do buffer_prepare() */\n {\n QuexBuffer* buffer = &this->buffer;\n size_t copy_size = Size;\n const size_t RemainingSize = QuexBuffer_content_back(buffer)\n - QuexBuffer_text_end(buffer) + 1;\n QUEX_CHARACTER_TYPE* text_end = QuexBuffer_text_end(buffer);\n\n /* Asserts ensure, that we are running in 'buffer-based-mode' */\n __quex_assert(this->buffer._content_first_character_index == 0); \n __quex_assert(this->buffer._end_of_file_p != 0x0); \n\n if( copy_size > RemainingSize ) copy_size = RemainingSize;\n /* Let us use 'move', because we can never know if the user might want\n * to copy arround content from inside the buffer. 'copy' would assume\n * that the target and source do not overlap. */\n __QUEX_STD_memmove(text_end, Content, copy_size);\n\n /* When lexing directly on the buffer, the end of file pointer is always set. */\n QuexBuffer_end_of_file_set(buffer, text_end + copy_size - 1);\n\n /* NOT:\n * buffer->_input_p = front;\n * buffer->_lexeme_start_p = front; \n *\n * (we might want to allow to append during lexical analysis)\n */\n return copy_size == Size;\n }\n\n inline void\n CLASS::buffer_prepare(const size_t CharacterN)\n {\n /* When lexing directly on the buffer, the end of file pointer is always set. */\n QuexBuffer_end_of_file_set(&this->buffer, \n QuexBuffer_content_front(&this->buffer) + CharacterN - 1); \n\n this->buffer._content_first_character_index = 0;\n this->buffer._input_p = QuexBuffer_content_front(&this->buffer);\n this->buffer._lexeme_start_p = QuexBuffer_content_front(&this->buffer);\n /**/\n this->buffer._character_before_lexeme_start = '\\n';\n this->buffer._character_at_lexeme_start = *this->buffer._input_p;\n }\n\n inline QUEX_CHARACTER_TYPE* CLASS::buffer_begin()\n { return QuexBuffer_content_front(&this->buffer); }\n \n inline QUEX_CHARACTER_TYPE* CLASS::buffer_end()\n { return QuexBuffer_content_back(&this->buffer) + 1; }\n \n inline size_t CLASS::buffer_size()\n { return QuexBuffer_content_size(&this->buffer); }\n\n inline QUEX_CHARACTER_TYPE* CLASS::buffer_text_end()\n { return QuexBuffer_text_end(&this->buffer); }\n\n inline size_t \n CLASS::buffer_distance_to_text_end()\n { return QuexBuffer_distance_input_to_text_end(&this->buffer); }\n\n}\n" }, { "alpha_fraction": 0.6525673866271973, "alphanum_fraction": 0.6584693789482117, "avg_line_length": 29.43712615966797, "blob_id": "49109854b3ee0b207805f22c87513513c2cfff3d", "content_id": "59b6dbfcf46d1d43a160982b031ae6517c39c549", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 5083, "license_type": "permissive", "max_line_length": 89, "num_lines": 167, "path": "/engine/gfx/gfx_tracer_body.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to\n * deal in the Software without restriction, including without limitation the\n * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\n * sell copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n\n#ifndef GfxTracerBody_h\n#define GfxTracerBody_h\n\nclass GfxPipeline;\n\n#include <utility>\n\n#include <math_util.h>\n\n#include \"../vect_util.h\"\n#include \"../shared_ptr.h\"\n\n#include \"gfx.h\"\n#include \"gfx_disk_resource.h\"\n#include \"gfx_node.h\"\n#include \"gfx_shader.h\"\n\nclass GfxTracerBody : public GfxNode {\n\n protected:\n static const std::string className;\n bool enabled;\n DiskResourcePtr<GfxTextureDiskResource> texture;\n float length;\n\n Vector3 diffuseColour;\n Vector3 emissiveColour;\n float fade;\n float alpha;\n float size;\n\n struct Element {\n Vector3 diffuseColour;\n Vector3 emissiveColour;\n float alpha;\n float size;\n Vector3 pos;\n bool skip;\n float timestamp;\n float distance;\n Element (void) { }\n Element (const Vector3 &diffuse_colour, const Vector3 &emissive_colour,\n float alpha, float size, const Vector3 &pos, float timestamp)\n : diffuseColour(diffuse_colour), emissiveColour(emissive_colour), alpha(alpha),\n size(size), pos(pos), timestamp(timestamp)\n { }\n };\n\n /** Handles the GPU stuff -- geometry, rendering, etc. */\n class Buffer {\n const GfxTracerBody * const body;\n\n Ogre::HardwareVertexBufferSharedPtr vertexBuffer;\n Ogre::RenderOperation renderOp;\n Ogre::VertexData vertexData;\n Ogre::IndexData indexData;\n unsigned elementVertexSize;\n\n float *vertexPtr, *vertexPtr0;\n uint16_t *indexPtr, *indexPtr0;\n unsigned maxElements;\n unsigned counter;\n Vector3 lastPos;\n float trailFade;\n\n public:\n\n Buffer (const GfxTracerBody *body);\n\n void beginTrace (unsigned elements);\n\n void addTraceElement (const Element &element, const Vector3 &rib);\n void addOnlyTwoTraceElements (const Vector3 &cam_pos,\n const Element &element0,\n const Element &element1);\n void addFirstTraceElement (const Vector3 &cam_pos,\n const Element &element0,\n const Element &element1);\n void addMiddleTraceElement (const Vector3 &cam_pos,\n const Element &element,\n const Element &element_next);\n void addLastTraceElement (const Vector3 &cam_pos,\n const Element &element);\n\n void endTrace (void);\n\n const Ogre::RenderOperation &getRenderOperation (void) { return renderOp; }\n\n };\n\n Buffer buffer;\n\n std::vector<Element> elements;\n\n GfxTracerBody (const GfxNodePtr &par_);\n ~GfxTracerBody (void);\n\n public:\n static SharedPtr<GfxTracerBody> make (const GfxNodePtr &par_=GfxNodePtr(NULL))\n { return SharedPtr<GfxTracerBody>(new GfxTracerBody(par_)); }\n\n bool isEnabled (void) const;\n void setEnabled (bool v);\n\n Vector3 getDiffuseColour (void) const;\n void setDiffuseColour (const Vector3 &f);\n\n Vector3 getEmissiveColour (void) const;\n void setEmissiveColour (const Vector3 &f);\n\n float getAlpha (void) const;\n void setAlpha (float f);\n\n float getFade (void) const;\n void setFade (float f);\n\n float getSize (void) const;\n void setSize (float f);\n\n float getLength (void) const;\n void setLength (float v);\n\n GfxTextureDiskResource *getTexture (void) const;\n void setTexture (const DiskResourcePtr<GfxTextureDiskResource> &v);\n\n void render (const GfxPipeline *pipe, const GfxShaderGlobals &g);\n\n void pump (void);\n\n void destroy (void);\n\n void assertAlive (void) const;\n\n friend class SharedPtr<GfxTracerBody>;\n};\n\n// Called every frame.\nvoid gfx_tracer_body_render (GfxPipeline *p);\n\nvoid gfx_tracer_body_pump (float elapsed);\n\nvoid gfx_tracer_body_set_left_over_time (float left_over_time);\n\nvoid gfx_tracer_body_init (void);\n\n#endif\n" }, { "alpha_fraction": 0.5761975049972534, "alphanum_fraction": 0.5837036967277527, "avg_line_length": 38.24031066894531, "blob_id": "249f147afb23649fb4987a7d27277b0e2df00210", "content_id": "4fe9ee80227ea61c3fe7972492621cc8cf1bfe46", "detected_licenses": [ "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer", "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 10125, "license_type": "permissive", "max_line_length": 120, "num_lines": 258, "path": "/dependencies/quex-0.34.1/quex/input/code_fragment.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "from quex.frs_py.file_in import *\nimport quex.lexer_mode as lexer_mode\nfrom quex.token_id_maker import TokenInfo\nfrom quex.input.setup import setup as Setup\nfrom quex.input.ucs_db_parser import ucs_property_db\nfrom quex.core_engine.utf8 import __read_one_utf8_code_from_stream\nfrom quex.core_engine.generator.action_info import *\n\nLanguageDB = Setup.language_db\n\n\ndef parse(fh, CodeFragmentName, \n ErrorOnFailureF=True, AllowBriefTokenSenderF=True):\n \"\"\"RETURNS: An object of class UserCodeFragment containing\n line number, filename, and the code fragment.\n\n None in case of failure.\n \"\"\"\n assert Setup.__class__.__name__ == \"something\"\n assert type(ErrorOnFailureF) == bool\n assert type(AllowBriefTokenSenderF) == bool\n\n skip_whitespace(fh)\n position = fh.tell()\n\n word = fh.read(2)\n if len(word) >= 1 and word[0] == \"{\":\n fh.seek(-1, 1) # unput the second character\n return __parse_normal(fh, CodeFragmentName)\n\n elif AllowBriefTokenSenderF and word == \"=>\":\n return __parse_brief_token_sender(fh)\n\n elif not ErrorOnFailureF:\n fh.seek(-2,1)\n return None\n else:\n error_msg(\"missing code fragment after %s definition.\" % CodeFragmentName, fh)\n\ndef __parse_normal(fh, code_fragment_name):\n line_n = get_current_line_info_number(fh) + 1\n code = read_until_closing_bracket(fh, \"{\", \"}\")\n return UserCodeFragment(code, fh.name, line_n, LanguageDB, AddReferenceCodeF=True)\n\ndef __parse_brief_token_sender(fh):\n # shorthand for { self.send(TKN_SOMETHING); RETURN; }\n \n position = fh.tell()\n line_n = get_current_line_info_number(fh) + 1\n try: \n skip_whitespace(fh)\n position = fh.tell()\n\n code = __parse_token_id_specification_by_character_code(fh)\n if code != \"\": return UserCodeFragment(code, fh.name, line_n, LanguageDB, AddReferenceCodeF=True)\n\n identifier, arg_list_str = __parse_function_call(fh)\n if identifier in [\"GOTO\", \"GOSUB\", \"GOUP\"]:\n code = __create_mode_transition_and_token_sender(fh, identifier, arg_list_str)\n else:\n code = __create_token_sender_by_token_name(fh, identifier, arg_list_str)\n\n if code != \"\": \n return UserCodeFragment(code, fh.name, line_n, LanguageDB, AddReferenceCodeF=True)\n else:\n return None\n\n except EndOfStreamException:\n fh.seek(position)\n error_msg(\"End of file reached while parsing token shortcut.\", fh)\n\ndef read_character_code(fh):\n # NOTE: This function is tested with the regeression test for feature request 2251359.\n # See directory $QUEX_PATH/TEST/2251359.\n pos = fh.tell()\n \n start = fh.read(1)\n if start == \"\": \n seek(pos); return -1\n\n elif start == \"'\": \n # read an utf-8 char an get the token-id\n # Example: '+'\n character_code = __read_one_utf8_code_from_stream(fh)\n if character_code == 0xFF:\n error_msg(\"Missing utf8-character for definition of character code by character.\", fh)\n\n elif fh.read(1) != '\\'':\n error_msg(\"Missing closing ' for definition of character code by character.\", fh)\n\n return character_code\n\n if start == \"U\":\n if fh.read(1) != \"C\": seek(pos); return -1\n # read Unicode Name \n # Example: UC MATHEMATICAL_MONOSPACE_DIGIT_FIVE\n skip_whitespace(fh)\n ucs_name = read_identifier(fh)\n if ucs_name == \"\": seek(pos); return -1\n # Get the character set related to the given name. Note, the size of the set\n # is supposed to be one.\n character_code = ucs_property_db.get_character_set(\"Name\", ucs_name)\n if type(character_code) in [str, unicode]:\n error_msg(\"%s does not identify a known unicode character.\" % ucs_name, fh) \n if type(character_code) not in [int, long]:\n error_msg(\"%s relates to more than one character in unicode database.\" % ucs_name, fh) \n return character_code\n\n second = fh.read(1)\n if start == \"0\" and second.isdigit() == False:\n base = second\n if base not in [\"x\", \"o\", \"b\"]: \n error_msg(\"Number base '0%s' is unknown, please use '0x' for hexidecimal,\\n\" % base + \\\n \"'0o' for octal, or '0b' for binary.\", fh)\n number_txt = read_integer(fh)\n if number_txt == \"\":\n error_msg(\"Missing integer number after '0%s'\" % base, fh)\n try: \n if base == \"x\": character_code = int(\"0x\" + number_txt, 16) \n elif base == \"o\": character_code = int(number_txt, 8) \n elif base == \"b\": \n character_code = 0\n for letter in number_txt:\n character_code = character_code << 1\n if letter == \"1\": character_code += 1\n elif letter != \"0\":\n error_msg(\"Letter '%s' not permitted in binary number (something start with '0b')\" % letter, fh)\n else:\n # A normal integer number (starting with '0' though)\n character_code = int(base + number_text)\n except:\n error_msg(\"The string '%s' is not appropriate for number base '0%s'.\" % (number_txt, base), fh)\n\n return character_code\n\n elif start.isdigit():\n fh.seek(-2, 1) # undo 'start' and 'second'\n # All that remains is that it is a 'normal' integer\n number_txt = read_integer(fh)\n\n if number_txt == \"\": fh.seek(pos); return -1\n \n try: return int(number_txt)\n except: error_msg(\"The string '%s' is not appropriate for number base '10'.\" % number_txt, fh)\n\n else:\n # Try to interpret it as something else ...\n fh.seek(pos); return -1 \n\ndef __parse_function_call(fh):\n position = fh.tell()\n try:\n skip_whitespace(fh)\n identifier = read_identifier(fh)\n skip_whitespace(fh)\n\n tmp = fh.read(1)\n if tmp not in [\"(\", \";\"]:\n error_msg(\"Missing '(' or ';' after '%s'.\" % identifier, fh)\n if tmp == \";\":\n return identifier, \"\" # No argument list, \";\" arrived immediately\n\n arg_list_str = read_until_closing_bracket(fh, \"(\", \")\")\n verify_next_word(fh, \";\")\n \n return identifier, arg_list_str\n\n except EndOfStreamException:\n fh.seek(position)\n error_msg(\"End of file reached while parsing token shortcut.\", fh)\n\ndef __parse_token_id_specification_by_character_code(fh):\n character_code = read_character_code(fh)\n if character_code == -1: return \"\"\n\n verify_next_word(fh, \";\")\n prefix_less_token_name = \"UCS_0x%06X\" % character_code\n token_id_str = Setup.input_token_id_prefix + prefix_less_token_name\n lexer_mode.token_id_db[prefix_less_token_name] = \\\n TokenInfo(prefix_less_token_name, character_code, None, fh.name, get_current_line_info_number(fh)) \n txt = \"#ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\\n\"\n txt += \"self.send(%s); return;\\n\" % token_id_str\n txt += \"#else\\n\"\n txt += \"self.send(%s); return %s;\\n\" % (token_id_str, token_id_str)\n txt += \"#endif\\n\"\n return txt\n\ndef __create_token_sender_by_token_name(fh, TokenName, ArgListStr):\n assert type(ArgListStr) == str\n\n # after 'send' the token queue is filled and one can safely return\n if TokenName.find(Setup.input_token_id_prefix) != 0:\n error_msg(\"token identifier does not begin with token prefix '%s'\\n\" % Setup.input_token_id_prefix + \\\n \"found: '%s'\" % TokenName, fh)\n\n # occasionally add token id automatically to database\n prefix_less_TokenName = TokenName[len(Setup.input_token_id_prefix):]\n if not lexer_mode.token_id_db.has_key(prefix_less_TokenName):\n msg = \"Token id '%s' defined implicitly.\" % TokenName\n if TokenName in lexer_mode.token_id_db.keys():\n msg += \"\\nNOTE: '%s' has been defined in a token { ... } section!\" % \\\n (Setup.input_token_id_prefix + TokenName)\n msg += \"\\nNote, that tokens in the token { ... } section are automatically prefixed.\"\n error_msg(msg, fh, DontExitF=True)\n\n lexer_mode.token_id_db[prefix_less_TokenName] = \\\n TokenInfo(prefix_less_TokenName, None, None, fh.name, get_current_line_info_number(fh)) \n\n tail = ArgListStr\n if tail != \"\": tail = \", \" + tail\n txt = \"#ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\\n\"\n txt += \"self.send(%s%s); return;\\n\" % (TokenName, tail)\n txt += \"#else\\n\"\n txt += \"self.send(%s); return %s;\\n\" % (ArgListStr, TokenName)\n txt += \"#endif\\n\"\n\n return txt\n\n\ndef __create_mode_transition_and_token_sender(fh, Command, ArgListStr):\n assert Command in [\"GOTO\", \"GOSUB\", \"GOUP\"]\n assert type(ArgListStr) == str\n\n arg_list = ArgListStr.split(\",\")\n arg_list = filter(lambda arg: arg != \"\", arg_list)\n L = len(arg_list)\n target_mode = None\n token_name = None\n tail = []\n if Command in [\"GOTO\", \"GOSUB\"]:\n if L < 1: \n error_msg(\"The %s mode short cut requires at least one argument: The target mode.\" % Command, fh)\n target_mode = arg_list[0]\n if L > 1: token_name = arg_list[1]\n if L > 2: tail = arg_list[2:]\n else: # Command == \"GOUP\"\n if L > 0: token_name = arg_list[0]\n if L > 1: tail = arg_list[1:]\n\n mode_change_str = { \"GOTO\": lambda Mode: \"self << \" + Mode + \";\\n\",\n \"GOSUB\": lambda Mode: \"self.push_mode(\" + Mode + \");\\n\",\n \"GOUP\": lambda Mode: \"self.pop_mode();\\n\"\n }[Command](target_mode)\n\n tail_str = \"\"\n for element in tail:\n tail_str += \", \" + element\n\n if token_name != None: send_str = \"self.send(%s%s); \"% (token_name, tail_str)\n else: send_str = \"\" \n\n txt = mode_change_str\n txt += \"#ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\\n\"\n txt += send_str + \"return;\\n\" \n txt += \"#else\\n\"\n txt += send_str + \"return %s;\\n\" % token_name\n txt += \"#endif\\n\"\n return txt\n\n" }, { "alpha_fraction": 0.5820708274841309, "alphanum_fraction": 0.5852552056312561, "avg_line_length": 34.6116828918457, "blob_id": "10a184c322f77ec7ff01ff96a7c3dbda70406f54", "content_id": "e6946e4cfe63044a93c23bfee4b7e4b71869d34d", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 10363, "license_type": "permissive", "max_line_length": 99, "num_lines": 291, "path": "/engine/streamer.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include \"cache_friendly_range_space_simd.h\"\n#include \"core_option.h\"\n#include \"grit_class.h\"\n#include \"main.h\"\n#include \"streamer.h\"\n\nfloat streamer_visibility;\nfloat streamer_prepare_distance_factor;\nfloat streamer_fade_out_factor;\nfloat streamer_fade_overlap_factor;\n\ntypedef CacheFriendlyRangeSpace<GritObjectPtr> Space;\nstatic Space rs;\n\nstatic GObjPtrs activated;\nstatic GObjPtrs loaded;\nstatic GObjPtrs fresh; // just been added - skip the queue for activation\n\ntypedef std::vector<StreamerCallback*> StreamerCallbacks;\nStreamerCallbacks streamer_callbacks;\n\nstatic void remove_if_exists (GObjPtrs &list, const GritObjectPtr &o)\n{\n GObjPtrs::iterator iter = find(list.begin(), list.end(), o);\n if (iter!=list.end()) {\n size_t offset = iter - list.begin();\n list[offset] = list[list.size()-1];\n list.pop_back();\n }\n}\n\nvoid streamer_init (void)\n{\n}\n\n\nvoid streamer_centre (lua_State *L, const Vector3 &new_pos, bool everything)\n{\n int step_size = everything ? INT_MAX : core_option(CORE_STEP_SIZE);\n\n Space::Cargo fnd = fresh;\n fresh.clear();\n\n const float visibility = streamer_visibility;\n\n const float pF = streamer_prepare_distance_factor;\n const float tpF = pF * visibility; // prepare and visibility factors\n const float vis2 = visibility * visibility;\n\n typedef GObjPtrs::iterator I;\n\n // iterate through, deactivating things\n\n\n ////////////////////////////////////////////////////////////////////////\n // DEACTIVATE DISTANT GRIT OBJECTS /////////////////////////////////////\n ////////////////////////////////////////////////////////////////////////\n // use victims because deactivate() changes the 'activated' list\n // and so does notifyRange2 if the callback raises an error\n GObjPtrs victims = activated;\n for (I i=victims.begin(), i_=victims.end() ; i!=i_ ; ++i) {\n const GritObjectPtr &o = *i;\n //note we use vis2 not visibility\n float range2 = o->range2(new_pos) / vis2;\n // sometimes deactivation of an object can cause the deletion of other objects\n // if those objects are also in the victims list, this can become a problem\n // so just skip them\n if (o->getClass()==NULL) continue;\n o->notifyRange2(L, o, range2);\n const GritObjectPtr &the_far = o->getFarObj();\n if (!the_far.isNull()) {\n // update the far (perhaps for a second time this frame)\n // to make sure it has picked up the fade imposed by o\n float range2 = the_far->range2(new_pos) / vis2;\n the_far->notifyRange2(L, the_far, range2);\n }\n if (range2 > 1) {\n // now out of range\n const GritObjectPtr &o = *i;\n const GritObjectPtr &the_far = o->getFarObj();\n bool killme = o->deactivate(L, o);\n if (!the_far.isNull()) {\n // we're deactivating and we have a far,\n // so make sure it gets considered this frame\n fnd.push_back(the_far);\n }\n if (killme) {\n object_del(L, o);\n }\n }\n }\n\n ////////////////////////////////////////////////////////////////////////\n // UNLOAD RESOURCES FOR VERY DISTANT GRIT OBJECTS //////////////////////\n ////////////////////////////////////////////////////////////////////////\n for (size_t i=0, i_=loaded.size(); i<i_ ;) {\n // Iteration should be fast for removal of significant number of\n // elements. Don't do this if it ever stops being a vector.\n const GritObjectPtr &o = loaded[i];\n if (!o->withinRange(new_pos, tpF)) {\n // unregister demand...\n // we deactivated first so this should\n // unload any resources we were using\n o->tryUnloadResources();\n loaded[i] = loaded[i_-1];\n loaded.pop_back();\n --i_;\n } else {\n ++i;\n }\n }\n\n\n GObjPtrs must_kill;\n\n ////////////////////////////////////////////////////////////////////////\n // LOAD RESOURCES FOR APPROACHING GRIT OBJECTS /////////////////////////\n // AND... ACTIVATE ARRIVING GRIT OBJECTS ///////////////////////////////\n ////////////////////////////////////////////////////////////////////////\n // note: since fnd is prepopulated by new objects and the lods of deactivated objects\n // it may have duplicates after the rangespace has gone through\n rs.getPresent(new_pos.x, new_pos.y, new_pos.z, step_size, tpF, fnd);\n for (Space::Cargo::iterator i=fnd.begin(), i_=fnd.end() ; i!=i_ ; ++i) {\n const GritObjectPtr &o = *i;\n\n // this can happen if there is a duplicate in the list and it gets destroyed\n // the first time due to an error in the activation function\n // but is eventually processed a second time after being destroyed\n if (o->getClass()==NULL) continue;\n if (o->isActivated()) continue;\n\n float range2 = o->range2(new_pos) / vis2;\n // not in range yet\n if (range2 > 1) continue;\n\n //CVERB << \"Preparing for activation: \" << o->name << std::endl;\n\n // consider background loading\n if (o->backgroundLoadingCausedError()) {\n must_kill.push_back(o);\n continue;\n }\n if (o->requestLoad(new_pos)) {\n // this means we weren't already in the queue.\n // we may still not be in the queue, if all resources are loaded\n\n // note 'loaded' includes things which have started\n // but not finished loading...\n loaded.push_back(o);\n }\n if (o->isInBackgroundQueue()) {\n // if we're in the queue we probably have to wait longer\n // before all the resources are loaded\n continue;\n }\n if (o->backgroundLoadingCausedError()) {\n must_kill.push_back(o);\n continue;\n }\n\n // if we get this far, we should be displayed but there might be\n // a near object in the way\n GritObjectPtr the_near = o->getNearObj();\n while (!the_near.isNull()) {\n if (the_near->withinRange(new_pos, visibility * streamer_fade_overlap_factor)) {\n if (the_near->isActivated()) {\n // why deactivate?\n // we already ensured it is not activated above...\n o->deactivate(L, o);\n // don't activate, near gobj is\n // in the way\n goto skip;\n }\n }\n the_near = the_near->getNearObj();\n }\n \n\n // ok there wasn't so activate\n o->activate(L, o);\n\n // activation can result in a lua error which triggers the destruction of the\n // object 'o' so we test for that here before doing more stuff\n if (o->getClass()==NULL) continue;\n\n o->notifyRange2(L, o, range2);\n\n skip:;\n }\n\n for (GObjPtrs::iterator i=must_kill.begin(), i_=must_kill.end() ; i!=i_ ; ++i) {\n CERR << \"Object: \\\"\" << (*i)->name << \"\\\" raised an error while background loading \"\n << \"resources, so destroying it.\" << std::endl;\n object_del(L, *i);\n }\n\n bgl->handleBastards();\n bgl->checkRAMHost();\n bgl->checkRAMGPU();\n\n for (auto i=streamer_callbacks.begin(), i_=streamer_callbacks.end() ; i!=i_ ; ++i) {\n (*i)->update(new_pos);\n }\n\n}\n\nvoid streamer_update_sphere (size_t index, const Vector3 &pos, float d)\n{\n rs.updateSphere(index, pos.x, pos.y, pos.z, d);\n}\n\nvoid streamer_object_activated (GObjPtrs::iterator &begin, GObjPtrs::iterator &end)\n{\n begin = activated.begin();\n end = activated.end();\n}\n\nint streamer_object_activated_count (void)\n{\n return activated.size();\n}\n\nvoid streamer_list(const GritObjectPtr &o)\n{\n rs.add(o);\n fresh.push_back(o);\n}\n\nvoid streamer_unlist(const GritObjectPtr &o)\n{\n rs.remove(o);\n remove_if_exists(fresh, o);\n}\n\nvoid streamer_list_as_activated (const GritObjectPtr &o)\n{\n GObjPtrs::iterator begin = activated.begin(), end = activated.end();\n GObjPtrs::iterator iter = find(begin, end, o);\n if (iter!=end) return;\n activated.push_back(o);\n}\n\nvoid streamer_unlist_as_activated (const GritObjectPtr &o)\n{\n GObjPtrs::iterator begin = activated.begin(), end = activated.end();\n GObjPtrs::iterator iter = find(begin, end, o);\n if (iter==end) return;\n size_t index = iter - begin;\n activated[index] = activated[activated.size()-1];\n activated.pop_back();\n}\n\n\nvoid streamer_callback_register (StreamerCallback *rc)\n{\n StreamerCallbacks::iterator begin = streamer_callbacks.begin(), end = streamer_callbacks.end();\n StreamerCallbacks::iterator iter = find(begin, end, rc);\n if (iter!=end) return;\n streamer_callbacks.push_back(rc);\n}\n\nvoid streamer_callback_unregister (StreamerCallback *rc)\n{\n StreamerCallbacks::iterator begin = streamer_callbacks.begin(), end = streamer_callbacks.end();\n StreamerCallbacks::iterator iter = find(begin, end, rc);\n if (iter==end) return;\n size_t index = iter - begin;\n streamer_callbacks[index] = streamer_callbacks[streamer_callbacks.size()-1];\n streamer_callbacks.pop_back();\n}\n" }, { "alpha_fraction": 0.5858676433563232, "alphanum_fraction": 0.5858676433563232, "avg_line_length": 22.29166603088379, "blob_id": "f41cf675a5a220e21be9da87293530fa691a5221", "content_id": "f67dc32752bc7a18467202b545440d6724be9d3e", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 1118, "license_type": "permissive", "max_line_length": 65, "num_lines": 48, "path": "/dependencies/quex-0.34.1/quex/code_base/template/misc.i", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "// -*- C++ -*- vim: set syntax=cpp:\n\nnamespace quex { \n inline void \n CLASS::move_forward(const size_t CharacterN)\n {\n QuexBuffer_move_forward(&this->buffer, CharacterN);\n }\n\n inline void \n CLASS::move_backward(const size_t CharacterN)\n {\n QuexBuffer_move_backward(&this->buffer, CharacterN);\n }\n\n \n inline size_t \n CLASS::tell()\n {\n return QuexBuffer_tell(&this->buffer);\n }\n\n inline void \n CLASS::seek(const size_t CharacterIndex)\n {\n QuexBuffer_seek(&this->buffer, CharacterIndex);\n }\n\n inline void\n CLASS::_reset()\n {\n QuexAnalyser_reset((QuexAnalyser*)this);\n\n# if defined(QUEX_OPTION_LINE_NUMBER_COUNTING) \\\n | defined(QUEX_OPTION_COLUMN_NUMBER_COUNTING) \\\n | defined(__QUEX_OPTION_INDENTATION_TRIGGER_SUPPORT)\n counter.init();\n# endif\n\n // empty the token queue\n# ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n this->_token_queue->reset();\n# endif\n\n set_mode_brutally(__QUEX_SETTING_INITIAL_LEXER_MODE_ID);\n }\n\n} // namespace quex\n" }, { "alpha_fraction": 0.5155258178710938, "alphanum_fraction": 0.5274419188499451, "avg_line_length": 40.2078857421875, "blob_id": "afd89ee39bb74010e110a7989b0dc264281a515e", "content_id": "576c0cc78b3ef0c55e061602faedcad2b857086a", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 11497, "license_type": "permissive", "max_line_length": 100, "num_lines": 279, "path": "/engine/gfx/gfx_gasoline_standalone.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <fstream>\n#include <string>\n#include <vector>\n\n#include \"gfx_gasoline.h\"\n\n#include <exception.h>\n\nconst char *info =\n \"Gasoline (c) Dave Cunningham 2015 (version: 0.1)\\n\"\n \"A command-line compiler for the Grit Shading Language.\\n\"\n;\n\nconst char *usage =\n \"Usage: gsl { <opt> } <vert.gsl> <dangs.gsl> <add.gsl> <kind> <vert.out> <frag.out>\\n\\n\"\n \"where <opt> ::= -h | --help This message\\n\"\n \" | -C | --cg Target CG\\n\"\n \" | -p | --param <var> <type> Declare a parameter\\n\"\n \" | -u | --unbind <tex> Unbind a texture (will be all 1s)\\n\"\n \" | -d | --alpha_dither Enable dithering via alpha texture\\n\"\n \" | -i | --instanced Enable instanced\\n\"\n \" | -e | --env1 One env box\\n\"\n \" | -E | --env2 Two env boxes\\n\"\n \" | -b | --bones <n> Number of blended bones\\n\"\n \" | -- End options passing\\n\"\n;\n\n\nstd::string next_arg(int& so_far, int argc, char **argv)\n{\n if (so_far==argc) {\n std::cerr<<\"ERROR: Not enough commandline arguments...\\n\"<<std::endl;\n std::cerr<<usage<<std::endl;\n exit(EXIT_FAILURE);\n }\n return argv[so_far++];\n}\n\nenum FileOrSnippet { F, S };\n\nstatic GfxGslParam from_string (const std::string &type_name)\n{\n if (type_name == \"Float\") return GfxGslParam::float1(0);\n if (type_name == \"Float2\") return GfxGslParam::float2(0, 0);;\n if (type_name == \"Float3\") return GfxGslParam::float3(0, 0, 0);;\n if (type_name == \"Float4\") return GfxGslParam::float4(0, 0, 0, 0);\n if (type_name == \"Int\") return GfxGslParam::int1(0);\n if (type_name == \"Int2\") return GfxGslParam::int2(0, 0);\n if (type_name == \"Int3\") return GfxGslParam::int3(0, 0, 0);\n if (type_name == \"Int4\") return GfxGslParam::int4(0, 0, 0, 0);\n if (type_name == \"FloatTexture1\") return GfxGslParam(GFX_GSL_FLOAT_TEXTURE1, 0,0,0,0);\n if (type_name == \"FloatTexture2\") return GfxGslParam(GFX_GSL_FLOAT_TEXTURE2, 0,0,0,0);\n if (type_name == \"FloatTexture3\") return GfxGslParam(GFX_GSL_FLOAT_TEXTURE3, 0,0,0,0);\n if (type_name == \"FloatTexture4\") return GfxGslParam(GFX_GSL_FLOAT_TEXTURE4, 0,0,0,0);\n if (type_name == \"FloatTextureCube\") return GfxGslParam(GFX_GSL_FLOAT_TEXTURE_CUBE, 0,0,0,0);\n if (type_name == \"StaticFloat\") return GfxGslParam::float1(0).setStatic();\n if (type_name == \"StaticFloat2\") return GfxGslParam::float2(0, 0).setStatic();\n if (type_name == \"StaticFloat3\") return GfxGslParam::float3(0, 0, 0).setStatic();\n if (type_name == \"StaticFloat4\") return GfxGslParam::float4(0, 0, 0, 0).setStatic();\n if (type_name == \"StaticInt\") return GfxGslParam::int1(0).setStatic();\n if (type_name == \"StaticInt2\") return GfxGslParam::int2(0, 0).setStatic();\n if (type_name == \"StaticInt3\") return GfxGslParam::int3(0, 0, 0).setStatic();\n if (type_name == \"StaticInt4\") return GfxGslParam::int4(0, 0, 0, 0).setStatic();\n EXCEPT << \"Not a Gasoline type: \" << type_name << ENDL;\n}\n\n\nCentralisedLog clog;\nvoid assert_triggered (void) { }\n\nint main (int argc, char **argv)\n{\n\n try {\n int so_far = 1;\n bool no_more_switches = false;\n bool instanced = false;\n bool alpha_dither = false;\n bool internal = false;\n unsigned env_boxes = 0;\n unsigned bones = 0;\n std::vector<std::string> args;\n std::string language = \"GLSL33\";\n GfxGslRunParams params;\n GfxGslUnboundTextures ubt;\n GfxGslRunParams static_values;\n while (so_far < argc) {\n std::string arg = next_arg(so_far, argc, argv);\n if (no_more_switches) {\n args.push_back(arg);\n } else if (arg==\"-h\" || arg==\"--help\") {\n std::cout<<info<<std::endl;\n std::cout<<usage<<std::endl;\n exit(EXIT_SUCCESS);\n } else if (arg==\"--\") {\n no_more_switches = true;\n } else if (arg==\"-C\" || arg==\"--cg\") {\n language = \"CG\";\n } else if (arg==\"-p\" || arg==\"--param\") {\n std::string name = next_arg(so_far, argc, argv);\n std::string type_name = next_arg(so_far, argc, argv);\n GfxGslParam param = from_string(type_name);\n params[name] = param;\n if (gfx_gasoline_param_is_static(param)) {\n static_values[name] = param; // Use the default colour.\n }\n } else if (arg==\"-u\" || arg==\"--unbind\") {\n std::string name = next_arg(so_far, argc, argv);\n ubt[name] = false;\n } else if (arg==\"-U\" || arg==\"--unbind-to-uniform\") {\n std::string name = next_arg(so_far, argc, argv);\n ubt[name] = true;\n } else if (arg==\"-I\" || arg==\"--internal\") {\n internal = true;\n } else if (arg==\"-i\" || arg==\"--instanced\") {\n instanced = true;\n } else if (arg==\"-d\" || arg==\"--alpha_dither\") {\n alpha_dither = true;\n } else if (arg==\"-e\" || arg==\"--env1\") {\n env_boxes = 1;\n } else if (arg==\"-E\" || arg==\"--env2\") {\n env_boxes = 2;\n } else if (arg==\"-b\" || arg==\"--bones\") {\n std::string num_str = next_arg(so_far, argc, argv);\n char **nptr = nullptr;\n long long num = strtoll(num_str.c_str(), nptr, 10);\n if (num < 0 || num > 4) {\n std::cerr<<\"Number of bones must be in [0,4] range.\" << std::endl;\n return EXIT_FAILURE;\n }\n bones = unsigned(num);\n } else {\n args.push_back(arg);\n }\n }\n\n if (args.size() != 6) {\n std::cerr << info << std::endl;\n std::cerr << usage << std::endl;\n return EXIT_FAILURE;\n }\n\n const std::string vert_in_filename = args[0];\n const std::string dangs_in_filename = args[1];\n const std::string additional_in_filename = args[2];\n const std::string kind = args[3];\n const std::string vert_out_filename = args[4];\n const std::string frag_out_filename = args[5];\n\n std::ifstream f;\n\n std::string vert_code;\n f.open(vert_in_filename);\n if (!f.good()) {\n std::cerr << \"Opening file: \";\n perror(vert_in_filename.c_str());\n return EXIT_FAILURE;\n }\n vert_code.assign(std::istreambuf_iterator<char>(f), std::istreambuf_iterator<char>());\n f.close();\n\n std::string dangs_code;\n f.open(dangs_in_filename);\n if (!f.good()) {\n std::cerr << \"Opening file: \";\n perror(dangs_in_filename.c_str());\n return EXIT_FAILURE;\n }\n dangs_code.assign(std::istreambuf_iterator<char>(f), std::istreambuf_iterator<char>());\n f.close();\n\n f.open(additional_in_filename);\n if (!f.good()) {\n std::cerr << \"Opening file: \";\n perror(additional_in_filename.c_str());\n return EXIT_FAILURE;\n }\n std::string additional_code;\n additional_code.assign(std::istreambuf_iterator<char>(f), std::istreambuf_iterator<char>());\n f.close();\n\n GfxGslBackend backend;\n if (language == \"CG\") {\n backend = GFX_GSL_BACKEND_CG;\n } else if (language == \"GLSL33\") {\n backend = GFX_GSL_BACKEND_GLSL33;\n } else {\n std::cerr << \"Unrecognised shader target language: \" << language << std::endl;\n return EXIT_FAILURE;\n }\n\n\n GfxGasolineResult shaders;\n try {\n GfxGslPurpose purpose;\n if (kind == \"SKY\") {\n purpose = GFX_GSL_PURPOSE_SKY;\n } else if (kind == \"HUD\") {\n purpose = GFX_GSL_PURPOSE_HUD;\n } else if (kind == \"FORWARD\") {\n purpose = GFX_GSL_PURPOSE_FORWARD;\n } else if (kind == \"ALPHA\") {\n purpose = GFX_GSL_PURPOSE_ALPHA;\n } else if (kind == \"FIRST_PERSON\") {\n purpose = GFX_GSL_PURPOSE_FIRST_PERSON;\n } else if (kind == \"FIRST_PERSON_WIREFRAME\") {\n purpose = GFX_GSL_PURPOSE_FIRST_PERSON_WIREFRAME;\n } else if (kind == \"DECAL\") {\n purpose = GFX_GSL_PURPOSE_DECAL;\n } else if (kind == \"CAST\") {\n purpose = GFX_GSL_PURPOSE_CAST;\n } else {\n std::cerr << \"Unrecognised shader kind language: \" << kind << std::endl;\n return EXIT_FAILURE;\n }\n GfxGslMetadata md;\n md.params = params;\n md.matEnv.ubt = ubt;\n md.matEnv.staticValues = static_values;\n md.matEnv.fadeDither = alpha_dither;\n md.cfgEnv.envBoxes = env_boxes;\n md.meshEnv.instanced = instanced;\n md.meshEnv.boneWeights = bones;\n md.d3d9 = true;\n md.internal = internal;\n md.lightingTextures = gfx_gasoline_does_lighting(purpose);\n shaders = gfx_gasoline_compile(purpose, backend, vert_code, dangs_code,\n additional_code, md);\n } catch (const Exception &e) {\n EXCEPT << vert_in_filename << \", \" << dangs_in_filename << \", \"\n << additional_in_filename << \": \" << e.msg << ENDL;\n }\n\n std::ofstream of;\n of.open(vert_out_filename);\n if (!of.good()) {\n std::cerr << \"Opening file: \";\n perror(vert_out_filename.c_str());\n return EXIT_FAILURE;\n }\n of << shaders.vertexShader;\n of.close();\n \n of.open(frag_out_filename);\n if (!of.good()) {\n std::cerr << \"Opening file: \";\n perror(frag_out_filename.c_str());\n return EXIT_FAILURE;\n }\n of << shaders.fragmentShader;\n of.close();\n return EXIT_SUCCESS;\n\n } catch (const Exception &e) {\n std::cerr << e << std::endl;\n return EXIT_FAILURE;\n\n }\n}\n" }, { "alpha_fraction": 0.6396551728248596, "alphanum_fraction": 0.6491379141807556, "avg_line_length": 35.82539749145508, "blob_id": "3bfa5ec3d8609e1aa46c28439929b5458ae0ba74", "content_id": "2fa6de7aab9c3bcce2a9532c7761aeddefe44124", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 2320, "license_type": "permissive", "max_line_length": 80, "num_lines": 63, "path": "/gtasa/ios_util.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <sstream>\n#include <iostream>\n\n#include <cstdlib>\n#include <cstring>\n#include <cerrno>\n\n#include <portable_io.h>\n#include <console.h>\n\n#ifndef ios_util_h\n#define ios_util_h\n\n#define ios_read_header(f,type,size,ver,vercheck) \\\n ios_read_header_(f,type,size,ver,vercheck,__FILE__,__LINE__)\n\nstatic inline void ios_read_header_(std::istream &f,\n unsigned long *type, unsigned long *size,\n unsigned long *ver, unsigned long *vercheck,\n const char *file, int line)\n{{{\n *type = ios_read_u32(f);\n unsigned long size2 = ios_read_u32(f);\n if (size) *size = size2;\n unsigned long ver2 = ios_read_u32(f);\n if (ver) *ver=ver2;\n //std::cout<<\"version: \"<<DECHEX(ver2)<<std::endl;\n if(vercheck && ver2!=*vercheck) {\n std::stringstream s;\n s<<\"Expected version \"<<*vercheck\n <<\" (0x\"<<std::hex<<*vercheck<<std::dec<<\"), \"\n <<\"got version \"<<ver2\n <<\" (0x\"<<std::hex<<ver2<<std::dec<<\"), \"\n <<\"at \" <<file<<\":\"<<line<<\".\";\n GRIT_EXCEPT(s.str());\n }\n}}}\n\n\n#endif\n\n// vim: shiftwidth=8:tabstop=8:expandtab\n" }, { "alpha_fraction": 0.7146569490432739, "alphanum_fraction": 0.7195945978164673, "avg_line_length": 25.356164932250977, "blob_id": "2b9c5f0b7efa6cff2c776c2528836207c0da45fe", "content_id": "f9f8810a552a536a65584b872d82cef69fdda552", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 3848, "license_type": "permissive", "max_line_length": 86, "num_lines": 146, "path": "/engine/physics/tcol_parser.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <string>\n\n#include <math_util.h>\n\n#include \"tcol_lexer\"\n\nstruct TColFile;\n\nvoid parse_tcol_1_0 (const std::string &name, quex::tcol_lexer* qlex, TColFile &file);\n\nvoid pretty_print_tcol (std::ostream &o, TColFile &f);\n\ntypedef std::vector<Vector3> Vertexes;\n\n\n#ifndef TColParser_h\n#define TColParser_h\n\n\nstruct TColHasMargin {\n float margin;\n};\n\nstruct TColHasMaterial {\n TColHasMaterial () { }\n TColHasMaterial (const std::string &material_) : material(material_) { }\n std::string material;\n};\n\nstruct TColHull : public TColHasMargin, public TColHasMaterial {\n Vertexes vertexes;\n};\ntypedef std::vector<TColHull> TColHulls;\n\n\nstruct TColBox : public TColHasMargin, public TColHasMaterial {\n float px, py, pz;\n float qw, qx, qy, qz;\n float dx, dy, dz;\n};\ntypedef std::vector<TColBox> TColBoxes;\n\n\nstruct TColCylinder : public TColHasMargin, public TColHasMaterial {\n float px, py, pz;\n float qw, qx, qy, qz;\n float dx, dy, dz;\n};\ntypedef std::vector<TColCylinder> TColCylinders;\n\n\nstruct TColCone : public TColHasMargin, public TColHasMaterial {\n float px, py, pz;\n float qw, qx, qy, qz;\n float radius;\n float height;\n};\ntypedef std::vector<TColCone> TColCones;\n\n\nstruct TColPlane : public TColHasMaterial {\n float nx, ny, nz, d;\n};\ntypedef std::vector<TColPlane> TColPlanes;\n\n\nstruct TColSphere : public TColHasMaterial {\n float px, py, pz;\n float radius;\n};\ntypedef std::vector<TColSphere> TColSpheres;\n\n\nstruct TColCompound {\n TColHulls hulls;\n TColBoxes boxes;\n TColCylinders cylinders;\n TColCones cones;\n TColPlanes planes;\n TColSpheres spheres;\n};\n\n\nstruct TColFace : TColHasMaterial {\n TColFace (int v1_, int v2_, int v3_, const std::string &material_)\n : TColHasMaterial(material_), v1(v1_), v2(v2_), v3(v3_) { }\n int v1, v2, v3;\n};\ntypedef std::vector<TColFace> TColFaces;\n\n\nstruct TColTriMesh {\n float margin;\n float edgeDistanceThreshold;\n Vertexes vertexes;\n TColFaces faces;\n};\n\n\nstruct TColFile {\n float mass;\n bool hasInertia;\n float inertia_x;\n float inertia_y;\n float inertia_z;\n float linearDamping;\n float angularDamping;\n float linearSleepThreshold;\n float angularSleepThreshold;\n float ccdMotionThreshold;\n float ccdSweptSphereRadius;\n bool usingCompound;\n bool usingTriMesh;\n TColCompound compound;\n TColTriMesh triMesh;\n};\n\n// useful help with using a different centre of mass\nvoid tcol_offset (TColFile &tcol, float x, float y, float z);\n\n// If someone is using polys in a non-meshy fashion then they might be better off\n// extruded into individual hulls\nvoid tcol_triangles_to_hulls (TColFile &tcol, float extrude_by, float margin);\n\n#endif\n" }, { "alpha_fraction": 0.7239180207252502, "alphanum_fraction": 0.7257403135299683, "avg_line_length": 29.48611068725586, "blob_id": "c5f3bcd023d775d8d82c51fb19bf60a8ed49868f", "content_id": "8bc456f55cd52abc0540fa30d165fbcab2f6fdc7", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 2195, "license_type": "permissive", "max_line_length": 92, "num_lines": 72, "path": "/engine/gfx/gfx_decal.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\nclass GfxDecal;\ntypedef SharedPtr<GfxDecal> GfxDecalPtr;\n\n#ifndef GFX_DECAL_H\n#define GFX_DECAL_H\n\n#include \"gfx.h\"\n#include \"gfx_fertile_node.h\"\n#include \"gfx_material.h\"\n#include \"gfx_particle_system.h\"\n\nclass GfxDecal : public GfxNode {\n\n protected:\n static const std::string className;\n bool enabled;\n float fade;\n GfxMaterial *material;\n \n protected:\n\n GfxDecal (GfxMaterial *material, const GfxNodePtr &par_);\n ~GfxDecal ();\n\n public:\n static GfxDecalPtr make (GfxMaterial *material, const GfxNodePtr &par_=GfxNodePtr(NULL))\n { return GfxDecalPtr(new GfxDecal(material, par_)); }\n \n bool isEnabled (void);\n void setEnabled (bool v);\n\n float getFade (void);\n void setFade (float f);\n\n GfxMaterial *getMaterial (void);\n void setMaterial (GfxMaterial *m);\n\n void render (const GfxShaderGlobals &g);\n\n void destroy (void);\n\n friend class SharedPtr<GfxDecal>;\n};\n\n// called every frame\nvoid gfx_decal_render (GfxPipeline *p);\n\nvoid gfx_decal_init (void);\nvoid gfx_decal_shutdown (void);\n\n#endif\n" }, { "alpha_fraction": 0.7847533822059631, "alphanum_fraction": 0.7892376780509949, "avg_line_length": 43.599998474121094, "blob_id": "ed1818b88f2126363862ed2f4901f0bd96636427", "content_id": "bc6e6ee430e124d3d94e59b3c0f2df4b8575a2db", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Shell", "length_bytes": 223, "license_type": "permissive", "max_line_length": 62, "num_lines": 5, "path": "/cp2media.sh", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "# bash cp2media.sh\ncp Normal/launcher/launcher.exe ../media/Grit.exe\ncp Normal/engine/engine.exe ../media/Grit.dat\ncp Normal/extract/extract.exe ../media/Tools\ncp Normal/GritXMLConverter/GritXMLConverter.exe ../media/Tools\n" }, { "alpha_fraction": 0.8065359592437744, "alphanum_fraction": 0.8078431487083435, "avg_line_length": 62.75, "blob_id": "22cca8b273b353c84e2f30811484872693ca87b9", "content_id": "8ea19ce870541b2a2befc647ce37dce99e672a7f", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 765, "license_type": "permissive", "max_line_length": 100, "num_lines": 12, "path": "/dependencies/README.md", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "There are 3 types of dependencies.\n\nDependencies prefixed by grit- are owned by the Grit project. They may be forks or from-scratch\ndependencies. They live in their own repos but contain grit-compatible build scripts.\n\nDependencies suffixed by a version code are included not as submodules but directories within the\ngrit-engine repo. This means there was no repo to clone but we did not want to create one as we had\nnot modified these dependencies and did not share this dependency among many projects. We do\nhowever include added build scripts within the dirs.\n\nThe remaining dependencies are clones of projects not owned by the Grit project. To avoid forking\nthem to simply add build scripts, these scripts are added in the dependencies/ directory instead.\n" }, { "alpha_fraction": 0.5471237301826477, "alphanum_fraction": 0.5479117631912231, "avg_line_length": 42.45890426635742, "blob_id": "9afbe9243763837a3100b0f23c763b4908a181bd", "content_id": "2b85219702f07a503514005f5740a45fa70ab036", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 12690, "license_type": "permissive", "max_line_length": 108, "num_lines": 292, "path": "/dependencies/quex-0.34.1/quex/output/c/core.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "#! /usr/bin/env python\nfrom copy import copy\nimport time\n\nfrom quex.frs_py.string_handling import blue_print\nfrom quex.frs_py.file_in import open_file_or_die, \\\n get_include_guard_extension\n\nimport quex.lexer_mode as lexer_mode\nimport quex.output.c.mode_classes as mode_classes\n\n\ndef do(Modes, setup):\n\n QuexClassHeaderFileTemplate = (setup.QUEX_TEMPLATE_DB_DIR \n + \"/template/lexical_analyzer_class-C\").replace(\"//\",\"/\")\n CoreEngineDefinitionsHeader = (setup.QUEX_TEMPLATE_DB_DIR + \"/core_engine/\").replace(\"//\",\"/\")\n if setup.plain_memory_f: CoreEngineDefinitionsHeader += \"definitions-quex-buffer.h\"\n else: CoreEngineDefinitionsHeader += \"definitions-plain-memory.h\"\n QuexClassHeaderFileOutput = setup.output_file_stem\n LexerClassName = setup.output_engine_name\n VersionID = setup.input_application_version_id\n QuexVersionID = setup.QUEX_VERSION\n DerivedClassHeaderFileName = setup.input_derived_class_file\n ModeClassImplementationFile = setup.output_code_file\n\n\n # -- determine whether the lexical analyser needs indentation counting\n # support. if one mode has an indentation handler, than indentation\n # support must be provided.\n indentation_support_f = False\n for mode in Modes.values():\n if mode.on_indentation.line_n != -1:\n indentation_support_f = True\n break\n\n lex_id_definitions_str = \"\" \n # NOTE: First mode-id needs to be '1' for compatibility with flex generated engines\n i = 0\n for name in Modes.keys():\n i += 1\n lex_id_definitions_str += \"const int LEX_ID_%s = %i;\\n\" % (name, i)\n\n include_guard_extension = get_include_guard_extension(setup.output_file_stem)\n\n # -- mode class member function definitions (on_entry, on_exit, has_base, ...)\n mode_class_member_functions_txt = mode_classes.do(Modes.values())\n\n # -- instances of mode classes as members of the lexer\n mode_object_members_txt, \\\n constructor_txt, \\\n mode_specific_functions_txt, \\\n friend_txt = \\\n get_mode_class_related_code_fragments(Modes.values())\n\n # -- get the code for the user defined all-match actions\n try:\n fh_aux = open(setup.output.user_match_action)\n user_match_action_str = fh_aux.read()\n fh_aux.close()\n except:\n user_match_action_str = \"/* no extra class content */\"\n\n # -- define a pointer that directly has the type of the derived class\n if setup.input_derived_class_name == \"\":\n setup.input_derived_class_name = LexerClassName\n derived_class_type_declaration = \"\"\n else:\n derived_class_type_declaration = \"class %s;\" % setup.input_derived_class_name\n\n # -- the friends of the class\n friends_str = \"\"\n for friend in setup.input_lexer_class_friends:\n friends_str += \" friend class %s;\\n\" % friend\n\n # -- the class body extension\n class_body_extension_str = lexer_mode.class_body.get_code()\n\n # -- the class constructor extension\n class_constructor_extension_str = lexer_mode.class_init.get_code()\n\n fh = open_file_or_die(QuexClassHeaderFileTemplate)\n template_code_txt = fh.read()\n fh.close()\n\n # -- check if exit/entry handlers have to be active\n entry_handler_active_f = False\n exit_handler_active_f = False\n for mode in Modes.values():\n if mode.on_entry_code_fragments() != []: entry_handler_active_f = True\n if mode.on_exit_code_fragments() != []: exit_handler_active_f = True\n\n txt = template_code_txt\n def set_switch(txt, SwitchF, Name):\n if SwitchF: txt = txt.replace(\"%%%%SWITCH%%%% %s\" % Name, \"#define %s\" % Name)\n else: txt = txt.replace(\"%%%%SWITCH%%%% %s\" % Name, \"// #define %s\" % Name)\n return txt\n \n txt = set_switch(txt, entry_handler_active_f, \"__QUEX_OPTION_ON_ENTRY_HANDLER_PRESENT\")\n txt = set_switch(txt, exit_handler_active_f, \"__QUEX_OPTION_ON_EXIT_HANDLER_PRESENT\")\n txt = set_switch(txt, indentation_support_f, \"__QUEX_OPTION_INDENTATION_TRIGGER_SUPPORT\") \n txt = set_switch(txt, setup.plain_memory_f, \"__QUEX_CORE_OPTION_PLAIN_MEMORY_BASED\") \n txt = set_switch(txt, True, \"__QUEX_CORE_OPTION_SUPPORT_BEGIN_OF_LINE_PRE_CONDITION\")\n txt = set_switch(txt, True, \"QUEX_OPTION_VIRTUAL_FUNCTION_ON_ACTION_ENTRY\") \n txt = set_switch(txt, False, \"QUEX_OPTION_NO_LINE_NUMBER_COUNTING\") \n txt = set_switch(txt, False, \"QUEX_OPTION_NO_COLUMN_NUMBER_COUNTING\") \n \n txt = blue_print(txt,\n [\n [\"%%CONSTRUCTOR_EXTENSTION%%\", class_constructor_extension_str],\n [\"%%CONSTRUCTOR_MODE_DB_INITIALIZATION_CODE%%\", constructor_txt],\n [\"%%CORE_ENGINE_DEFINITIONS_HEADER%%\", CoreEngineDefinitionsHeader],\n [\"%%CLASS_BODY_EXTENSION%%\", class_body_extension_str],\n [\"%%INCLUDE_GUARD_EXTENSION%%\", include_guard_extension],\n [\"%%INITIAL_LEXER_MODE_ID%%\", \"LEX_ID_\" + lexer_mode.initial_mode.get_code()],\n [\"%%LEXER_BUILD_DATE%%\", time.asctime()],\n [\"%%LEXER_BUILD_VERSION%%\", VersionID],\n [\"%%LEXER_CLASS_FRIENDS%%\", friends_str],\n [\"$$LEXER_CLASS_NAME$$\", LexerClassName],\n [\"%%LEXER_DERIVED_CLASS_DECL%%\", derived_class_type_declaration],\n [\"%%LEXER_DERIVED_CLASS_NAME%%\", setup.input_derived_class_name],\n [\"%%LEX_ID_DEFINITIONS%%\", lex_id_definitions_str],\n [\"%%MAX_MODE_CLASS_N%%\", repr(len(Modes))],\n [\"%%MODE_CLASS_FRIENDS%%\", friend_txt],\n [\"%%MODE_OBJECT_MEMBERS%%\", mode_object_members_txt],\n [\"%%MODE_SPECIFIC_ANALYSER_FUNCTIONS%%\", mode_specific_functions_txt],\n [\"%%PRETTY_INDENTATION%%\", \" \" + \" \" * (len(LexerClassName)*2 + 2)],\n [\"%%QUEX_TEMPLATE_DIR%%\", setup.QUEX_TEMPLATE_DB_DIR],\n [\"%%QUEX_VERSION%%\", QuexVersionID],\n [\"%%TOKEN_CLASS%%\", setup.input_token_class_name],\n [\"%%TOKEN_CLASS_DEFINITION_FILE%%\", setup.input_token_class_file.replace(\"//\",\"/\")],\n [\"%%TOKEN_ID_DEFINITION_FILE%%\", setup.output_token_id_file.replace(\"//\",\"/\")],\n [\"%%QUEX_OUTPUT_FILESTEM%%\", setup.output_file_stem],\n ])\n\n fh_out = open(QuexClassHeaderFileOutput, \"w\")\n fh_out.write(txt)\n fh_out.close()\n\n fh_out = open(ModeClassImplementationFile, \"w\")\n fh_out.write(lexer_mode.header.get() + \"\\n\")\n \n if DerivedClassHeaderFileName != \"\":\n fh_out.write(\"#include<\" + DerivedClassHeaderFileName +\">\\n\")\n else:\n fh_out.write(\"#include<\" + setup.output_file_stem +\">\\n\")\n \n fh_out.write(\"namespace quex {\\n\")\n\n mode_class_member_functions_txt = \\\n blue_print(mode_class_member_functions_txt,\n [[\"$$LEXER_CLASS_NAME$$\", LexerClassName],\n [\"%%TOKEN_CLASS%%\", setup.input_token_class_name],\n [\"%%LEXER_DERIVED_CLASS_NAME%%\", setup.input_derived_class_name]])\n \n fh_out.write(mode_class_member_functions_txt)\n fh_out.write(\"} // END: namespace quex\\n\")\n fh_out.close()\n\n\nquex_mode_init_call_str = \"\"\"\n quex_mode_init(&%%MN%%, this, \n LEX_ID_%%MN%%, \"%%MN%%\",\n $analyser_function,\n#ifdef __QUEX_OPTION_INDENTATION_TRIGGER_SUPPORT \n $on_indentation,\n#endif\n $on_entry,\n $on_exit\n#ifdef __QUEX_OPTION_RUNTIME_MODE_TRANSITION_CHECK\n ,\n $has_base,\n $has_entry_from,\n $has_exit_to\n#endif\n );\n\"\"\"\n\ndef __get_mode_init_call(mode):\n\n analyser_function = \"$$LEXER_CLASS_NAME$$__%s_analyser_function\" % mode.name\n on_indentation = \"$$LEXER_CLASS_NAME$$__%s_on_indentation\" % mode.name\n on_entry = \"$$LEXER_CLASS_NAME$$__%s_on_entry\" % mode.name\n on_exit = \"$$LEXER_CLASS_NAME$$__%s_on_exit\" % mode.name\n has_base = \"$$LEXER_CLASS_NAME$$__%s_has_base\" % mode.name\n has_entry_from = \"$$LEXER_CLASS_NAME$$__%s_has_entry_from\" % mode.name\n has_exit_to = \"$$LEXER_CLASS_NAME$$__%s_has_exit_to\" % mode.name\n\n if mode.options[\"inheritable\"] == \"only\": \n analyser_function = \"/* %s = */ 0x0\" % analyser_function\n\n if mode.on_entry_code_fragments() == []:\n on_entry = \"/* %s = */ $$LEXER_CLASS_NAME$$_on_entry_exit_null_function\" % on_entry\n\n if mode.on_exit_code_fragments() == []:\n on_exit = \"/* %s = */ $$LEXER_CLASS_NAME$$_on_entry_exit_null_function\" % on_exit\n\n if mode.on_indentation_code_fragments() == []:\n on_indentation = \"/* %s = */ 0x0\" % on_indentation\n\n txt = blue_print(quex_mode_init_call_str,\n [[\"%%MN%%\", mode.name],\n [\"$analyser_function\", analyser_function],\n [\"$on_indentation\", on_indentation],\n [\"$on_entry\", on_entry],\n [\"$on_exit\", on_exit],\n [\"$has_base\", has_base],\n [\"$has_entry_from\", has_entry_from],\n [\"$has_exit_to\", has_exit_to]])\n return txt\n\n\n\ndef __get_mode_function_declaration(Modes, FriendF=False):\n if FriendF: prolog = \" friend \"\n else: prolog = \" extern \"\n\n def __mode_functions(Prolog, ReturnType, NameList, ArgList):\n txt = \"\"\n for name in NameList:\n function_signature = \"%s $$LEXER_CLASS_NAME$$__%s_%s(%s);\" % \\\n (ReturnType, mode.name, name, ArgList)\n txt += \"%s\" % Prolog + \" \" + function_signature + \"\\n\"\n return txt\n\n txt = \"\"\n for mode in Modes:\n if mode.options[\"inheritable\"] != \"only\": \n txt += __mode_functions(prolog, \n \"__QUEX_SETTING_ANALYSER_FUNCTION_RETURN_TYPE\", [\"analyser_function\"], \n \"$$LEXER_CLASS_NAME$$*\")\n\n for mode in Modes:\n if mode.on_indentation_code_fragments() != []:\n txt += __mode_functions(prolog, \"void\", [\"on_indentation\"], \n \"$$LEXER_CLASS_NAME$$*, const quex_mode*\")\n\n for mode in Modes:\n if mode.on_entry_code_fragments() != []:\n txt += __mode_functions(prolog, \"void\", [\"on_entry\"], \n \"$$LEXER_CLASS_NAME$$*, const quex_mode*\")\n if mode.on_exit_code_fragments() != []:\n txt += __mode_functions(prolog, \"void\", [\"on_exit\"], \n \"$$LEXER_CLASS_NAME$$*, const quex_mode*\")\n\n txt += \"#ifdef __QUEX_OPTION_RUNTIME_MODE_TRANSITION_CHECK\\n\"\n for mode in Modes:\n txt += __mode_functions(prolog, \"bool\", [\"has_base\", \"has_entry_from\", \"has_exit_to\"], \n \"const quex_mode*\")\n \n txt += \"#endif\\n\"\n txt += \"\\n\"\n\n return txt\n\n\ndef get_mode_class_related_code_fragments(Modes):\n \"\"\"\n RETURNS: -- members of the lexical analyzer class for the mode classes\n -- static member functions declaring the analyzer functions for he mode classes \n -- constructor init expressions (before '{'), \n -- constructor text to be executed at construction time \n -- friend declarations for the mode classes/functions\n\n \"\"\"\n\n L = max(map(lambda m: len(m.name), Modes))\n\n members_txt = \"\" \n for mode in Modes:\n members_txt += \" quex_mode %s;\\n\" % mode.name\n\n\n # constructor code\n txt = \"\"\n for mode in Modes:\n txt += \" assert(LEX_ID_%s %s<= %i);\\n\" % (mode.name, \" \" * (L-len(mode.name)), len(Modes))\n\n for mode in Modes:\n txt += __get_mode_init_call(mode)\n\n for mode in Modes:\n txt += \" mode_db[LEX_ID_%s]%s = &%s;\\n\" % (mode.name, \" \" * (L-len(mode.name)), mode.name)\n constructor_txt = txt\n\n mode_functions_txt = __get_mode_function_declaration(Modes, FriendF=False)\n friends_txt = __get_mode_function_declaration(Modes, FriendF=True)\n\n return members_txt, \\\n constructor_txt, \\\n mode_functions_txt, \\\n friends_txt\n" }, { "alpha_fraction": 0.6319640874862671, "alphanum_fraction": 0.6329619288444519, "avg_line_length": 41.33802795410156, "blob_id": "866bdbfe314219b288592d929c418044c20f5c07", "content_id": "3e26c41c0e3b7856651a58947cb31c8f642a508a", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 6013, "license_type": "permissive", "max_line_length": 109, "num_lines": 142, "path": "/dependencies/quex-0.34.1/quex/output/cpp/action_code_formatter.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "import quex.core_engine.state_machine.character_counter as pattern_analyzer\nfrom quex.core_engine.interval_handling import NumberSet\nfrom quex.core_engine.generator.action_info import *\nfrom quex.input.setup import setup as Setup\n\ndef do(Mode, CodeFragment_or_CodeFragments, SafePatternStr, PatternStateMachine, \n Default_ActionF=False, EOF_ActionF=False):\n \"\"\"-- If there are multiple handlers for a single event they are combined\n \n -- Adding debug information printer (if desired)\n \n -- The task of this function is it to adorn the action code for each pattern with\n code for line and column number counting.\n \"\"\"\n assert Mode.__class__.__name__ == \"LexMode\"\n assert type(SafePatternStr) == str\n assert PatternStateMachine.__class__.__name__ == \"StateMachine\" or PatternStateMachine == None\n assert type(Default_ActionF) == bool\n assert type(EOF_ActionF) == bool\n\n if type(CodeFragment_or_CodeFragments) == list:\n assert Default_ActionF or EOF_ActionF, \\\n \"Action code formatting: Multiple Code Fragments can only be specified for default or\\n\" + \\\n \"end of stream action.\"\n CodeFragmentList = CodeFragment_or_CodeFragments\n else:\n CodeFragmentList = [ CodeFragment_or_CodeFragments ]\n\n on_every_match_code = \"\"\n lc_count_code = \"\"\n debug_code = \"\"\n user_code = \"\"\n\n # (*) Code to be performed on every match -- before the related action\n for code_info in Mode.on_match_code_fragments():\n on_every_match_code += code_info.get_code()\n\n # (*) Code to count line and column numbers\n if Mode.on_indentation.get_code() != \"\":\n lc_count_code = __get_line_and_column_counting_with_indentation(PatternStateMachine, EOF_ActionF)\n\n else:\n lc_count_code = __get_line_and_column_counting(PatternStateMachine, EOF_ActionF)\n\n # (*) debug prints -- if desired\n if Setup.output_debug_f == True:\n txt = '#ifdef QUEX_OPTION_DEBUG_QUEX_PATTERN_MATCHES\\n'\n txt += ' std::cerr << \"(\" << self.line_number_at_begin() << \", \" << self.column_number_at_begin()'\n txt += '<< \") %s: %s \\'\" << Lexeme << \"\\'\\\\n\";\\n' % (Mode.name, SafePatternStr)\n txt += '#endif\\n'\n debug_code = txt\n \n # (*) THE user defined action to be performed in case of a match\n require_terminating_zero_preparation_f = False\n for code_info in CodeFragmentList:\n user_code += code_info.get_code()\n if code_info.require_terminating_zero_f():\n require_terminating_zero_preparation_f = True\n\n txt = \"{\\n\"\n txt += on_every_match_code\n txt += lc_count_code\n txt += debug_code\n txt += user_code\n txt += \"\\n}\"\n\n return CodeFragment(txt, require_terminating_zero_preparation_f)\n\n\ndef __get_line_and_column_counting_with_indentation(PatternStateMachine, EOF_ActionF):\n\n # shift the values for line and column numbering\n txt = \"self.counter.__shift_end_values_to_start_values();\\n\"\n\n if EOF_ActionF:\n txt += \"#ifdef __QUEX_OPTION_INDENTATION_TRIGGER_SUPPORT\\n\"\n txt += \" self.counter.on_end_of_file();\\n\"\n txt += \"#endif\\n\"\n return txt\n\n if PatternStateMachine == None:\n return txt + \"self.counter.icount(Lexeme, LexemeEnd);\\n\"\n\n newline_n = pattern_analyzer.get_newline_n(PatternStateMachine)\n character_n = pattern_analyzer.get_character_n(PatternStateMachine)\n\n # later implementations may consider '\\t' also for indentation counting\n whitespace_set = NumberSet(ord(' '))\n initial_triggers = PatternStateMachine.get_init_state().transitions().get_trigger_set_union()\n\n starts_never_on_whitespace_f = not initial_triggers.has_intersection(whitespace_set)\n contains_only_spaces_f = pattern_analyzer.contains_only_spaces(PatternStateMachine)\n\n if newline_n != 0:\n # IDEA: (case newline_n > 0) \n # Try to determine number of characters backwards to newline directly\n # from the pattern state machine.\n func = \"self.counter.icount(Lexeme, LexemeEnd);\" \n\n else:\n if character_n == -1: column_increment = \"LexemeL\" # based on matched lexeme\n else: column_increment = \"%i\" % character_n # fixed length\n \n if starts_never_on_whitespace_f:\n func = \"self.counter.icount_NoNewline_NeverStartOnWhitespace(%s);\" % column_increment\n elif contains_only_spaces_f:\n func = \"self.counter.icount_NoNewline_ContainsOnlySpaces(%s);\" % column_increment\n else:\n func = \"self.counter.icount_NoNewline(Lexeme, LexemeEnd);\"\n\n return txt + func + \"\\n\"\n\ndef __get_line_and_column_counting(PatternStateMachine, EOF_ActionF):\n\n # shift the values for line and column numbering\n txt = \"self.counter.__shift_end_values_to_start_values();\\n\"\n\n if EOF_ActionF:\n return txt\n\n if PatternStateMachine == None:\n return txt + \"self.counter.count(Lexeme, LexemeEnd);\\n\"\n\n newline_n = pattern_analyzer.get_newline_n(PatternStateMachine)\n character_n = pattern_analyzer.get_character_n(PatternStateMachine)\n\n if newline_n == -1:\n # run the general algorithm, since not even the number of newlines in the \n # pattern can be determined directly from the pattern\n return txt + \"self.counter.count(Lexeme, LexemeEnd);\\n\"\n\n elif newline_n != 0:\n # TODO: Try to determine number of characters backwards to newline directly\n # from the pattern state machine. (Those seldom cases won't bring much\n # speed-up)\n return txt + \"self.counter.count_FixNewlineN(Lexeme, LexemeEnd, %i);\\n\" % newline_n\n\n else:\n if character_n == -1: incr_str = \"LexemeL\"\n else: incr_str = repr(character_n) \n\n return txt + \"self.counter.count_NoNewline(%s);\\n\" % incr_str\n\n" }, { "alpha_fraction": 0.5912758111953735, "alphanum_fraction": 0.5968064069747925, "avg_line_length": 43.85634231567383, "blob_id": "6b4538a028006b56948d3796231c8a03b3e0afa8", "content_id": "e6b41c0fdbda9cac7de11944a2c58bed7446cf15", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 24048, "license_type": "permissive", "max_line_length": 119, "num_lines": 536, "path": "/dependencies/quex-0.34.1/quex/core_engine/regular_expression/core.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "# The 'grammar' of quex's regular expressions:\n#\n# complete expression: expression\n# expression / expression = post conditioned expression\n# expression / expression / = pre conditioned expression\n# expression / expression / expression = pre and post conditioned expression\n# \n# expression: term\n# term | expression\n# \n# term: primary\n# primary term\n# \n# primary: \" non_double_quote * \" = character string\n# [ non_rect_bracket_close ] = set of characters\n# { identifier } = pattern replacement\n# ( expression )\n# non_control_character+ = lonely characters\n# primary repetition_cmd\n# \n# non_double_quote: 'anything but an unbackslashed double quote, i.e. \\\" is ok, \n# but \" is not.' \n# non_rect_bracket_close: 'anything but an unbackslashed rectangular bracket, i.e.\n# \\] is ok, but ] is not.' \n# non_control_character: 'anything but (, \", [, or {'\n# \n# repetition_cmd: 'a repetition command such as +, *, {2}, {,2}, {2,5}' \n#\n######################################################################################### \nimport sys\nimport StringIO\n\nfrom quex.frs_py.file_in import *\n\nfrom quex.exception import RegularExpressionException\nfrom quex.core_engine.interval_handling import *\nfrom quex.core_engine.state_machine.core import StateMachine\nfrom quex.core_engine.regular_expression.auxiliary import __snap_until, \\\n __debug_entry, \\\n __debug_exit, \\\n __debug_print\n\nimport quex.core_engine.utf8 as utf8\nimport quex.core_engine.regular_expression.character_set_expression as character_set_expression\nimport quex.core_engine.regular_expression.snap_backslashed_character as snap_backslashed_character\nimport quex.core_engine.regular_expression.snap_character_string as snap_character_string\nimport quex.core_engine.state_machine.sequentialize as sequentialize\nimport quex.core_engine.state_machine.parallelize as parallelize\nimport quex.core_engine.state_machine.repeat as repeat\nimport quex.core_engine.state_machine.setup_post_context as setup_post_context\nimport quex.core_engine.state_machine.setup_pre_context as setup_pre_context\nimport quex.core_engine.state_machine.setup_border_conditions as setup_border_conditions\nimport quex.core_engine.state_machine.nfa_to_dfa as nfa_to_dfa\nimport quex.core_engine.state_machine.hopcroft_minimization as hopcroft\n\n\nCONTROL_CHARACTERS = [ \"+\", \"*\", \"\\\"\", \"/\", \"(\", \")\", \"{\", \"}\", \"|\", \"[\", \"]\", \"$\"] \n\ndef __clean_and_validate(sm, BufferLimitCode, AllowNothingIsFineF):\n \"\"\"This function is to be used by the outer shell to the user. It ensures that \n the state machine which is returned is conform to some assumptions.\n\n BLC == -1: means that there is no buffer limit code.\n \"\"\"\n\n # (*) The buffer limit code has to appear absolutely nowhere!\n if BufferLimitCode != -1:\n __delete_BLC_except_at_end_of_post_context(sm, BufferLimitCode)\n\n # (*) Delete transitions that make practically no sense\n __delete_transitions_on_code_points_below_zero(sm)\n\n\n # (*) 'Nothing is fine' is not a pattern that we can accept. See the discussion\n # in the module \"quex.core_engine.generator.core.py\"\n if sm.get_init_state().core().is_acceptance() and AllowNothingIsFineF == False: \n raise RegularExpressionException(\n \"Pattern results in a 'nothing is acceptable' state machine.\\n\" + \\\n \"This means, that no step forward in the input still sets the analyzer\\n\" + \\\n \"into an acceptance state. Thus, as soon as no other input matches\\n\" + \\\n \"the analyzer ends up in an infinite loop.\")\n\n # (*) double check for orphan states\n orphan_state_list = sm.get_orphaned_state_index_list()\n if orphan_state_list != []:\n error_msg(\"Orphaned state(s) detected in regular expression (optimization lack).\\n\" + \\\n \"Please, log a defect at the projects website quex.sourceforge.net.\\n\" + \\\n \"Orphan state(s) = \" + repr(orphan_state_list) + \"\\n\", \n fh, DontExitF=True)\n\n # (*) It is essential that state machines defined as patterns do not \n # have origins.\n if sm.has_origins():\n error_msg(\"Regular expression parsing resulted in state machine with origins.\\n\" + \\\n \"Please, log a defect at the projects website quex.sourceforge.net.\\n\", fh)\n \n return sm\n\ndef __delete_BLC_except_at_end_of_post_context(sm, BLC):\n \"\"\"The buffer limit code is something that **needs** to cause a drop out.\n In the drop out handling, the buffer is reloaded.\n \"\"\"\n for state in sm.states.values():\n for target_state_index, trigger_set in state.transitions().get_map().items():\n if trigger_set.contains(BLC):\n trigger_set.cut_interval(Interval(BLC, BLC+1))\n\ndef __delete_transitions_on_code_points_below_zero(sm):\n \"\"\"Unicode does define all code points >= 0. Thus there can be no code points\n below zero as it might result from some number set operations.\n \"\"\"\n for state in sm.states.values():\n for target_state_index, trigger_set in state.transitions().get_map().items():\n if trigger_set.minimum() < 0:\n # NOTE: '0' is the end, meaning that it has is not part of the interval to be cut.\n trigger_set.cut_interval(Interval(-sys.maxint, 0))\n\ndef do(UTF8_String_or_Stream, PatternDict, BufferLimitCode,\n DOS_CarriageReturnNewlineF=False, AllowNothingIsFineF=False):\n\n\n if type(UTF8_String_or_Stream) == str: stream = StringIO.StringIO(UTF8_String_or_Stream)\n else: stream = UTF8_String_or_Stream \n\n if PatternDict == None: PatternDict = {}\n\n initial_position = stream.tell()\n\n # -- check for the begin of line condition (BOL)\n if stream.read(1) == '^': begin_of_line_f = True\n else: stream.seek(-1, 1); begin_of_line_f = False\n \n # -- MAIN: transform the pattern into a state machine\n sm = snap_conditional_expression(stream, PatternDict)\n if sm == None: \n stream.seek(initial_position)\n return None\n \n # -- check for end of line condition (EOL)\n if stream.read(1) == '$': end_of_line_f = True\n else: stream.seek(-1, 1); end_of_line_f = False\n\n # -- set begin of line/end of line conditions\n if begin_of_line_f or end_of_line_f: \n sm = setup_border_conditions.do(sm, begin_of_line_f, end_of_line_f,\n DOS_CarriageReturnNewlineF)\n sm = __beautify(sm)\n\n return __clean_and_validate(sm, BufferLimitCode, AllowNothingIsFineF)\n\ndef snap_conditional_expression(stream, PatternDict):\n \"\"\"conditional expression: expression\n expression / expression = post conditioned expression\n expression / expression / = pre conditioned expression\n expression / expression / expression = pre and post conditioned expression\n TODO: <- ($8592) for pre-conditions\n -> ($8594) for post-conditions\n\n \"\"\" \n __debug_entry(\"conditional expression\", stream) \n\n # -- expression\n pattern_0 = snap_expression(stream, PatternDict) \n if pattern_0 == None: return __debug_exit(None, stream)\n \n # -- '/'\n if stream.read(1) != '/': \n # (1) expression without pre and post condition\n stream.seek(-1, 1)\n # pattern_0 is already beautified by 'snap_expression()'\n result = __construct(pattern_0)\n return __debug_exit(result, stream)\n \n # -- expression\n pattern_1 = snap_expression(stream, PatternDict) \n if pattern_1 == None: return __debug_exit(pattern_0, stream)\n \n # -- '/'\n if stream.read(1) != '/': \n # (2) expression with only a post condition\n stream.seek(-1, 1)\n # NOTE: setup_post_context() marks state origins!\n result = __construct(pattern_0, post_context=pattern_1)\n return __debug_exit(result, stream)\n\n # -- expression\n pattern_2 = snap_expression(stream, PatternDict) \n if pattern_2 == None: \n # (3) expression with only a pre condition\n # NOTE: setup_pre_context() marks the state origins!\n result = __construct(pattern_1, pre_context=pattern_0)\n return __debug_exit(result, stream)\n\n # (4) expression with post and pre-condition\n result = __construct(pattern_1, pre_context=pattern_0, post_context=pattern_2)\n return __debug_exit(result, stream)\n\ndef snap_expression(stream, PatternDict):\n \"\"\"expression: term\n term | expression\n \"\"\" \n __debug_entry(\"expression\", stream) \n # -- term\n result = snap_term(stream, PatternDict) \n if result == None: \n return __debug_exit(None, stream)\n\n # -- optional '|'\n if stream.read(1) != '|': \n stream.seek(-1, 1)\n return __debug_exit(result, stream)\n \n position_1 = stream.tell()\n __debug_print(\"'|' (in expression)\")\n\n # -- expression\n result_2 = snap_expression(stream, PatternDict) \n __debug_print(\"expression(in expression):\", result_2)\n if result_2 == None:\n stream.seek(position_1) \n return __debug_exit(result, stream)\n\n result = parallelize.do([result, result_2]) \n return __debug_exit(__beautify(result), stream)\n \ndef snap_term(stream, PatternDict):\n \"\"\"term: primary\n primary term \n \"\"\"\n __debug_entry(\"term\", stream) \n\n # -- primary\n result = snap_primary(stream, PatternDict) \n __debug_print(\"##primary(in term):\", result)\n if result == None: return __debug_exit(None, stream)\n position_1 = stream.tell()\n\n # -- optional 'term' \n result_2 = snap_term(stream, PatternDict) \n __debug_print(\"##term(in term):\", result_2)\n if result_2 == None: \n stream.seek(position_1)\n return __debug_exit(result, stream)\n \n result = sequentialize.do([result, result_2], \n MountToFirstStateMachineF=True, \n CloneRemainingStateMachinesF=False) \n\n return __debug_exit(__beautify(result), stream)\n \ndef snap_primary(stream, PatternDict):\n \"\"\"primary: \" non_double_quote * \" = character string\n [ non_rect_bracket_close ] = set of characters\n { identifier } = pattern replacement\n ( expression )\n non_control_character+ = lonely characters\n primary repetition_cmd\n \"\"\"\n __debug_entry(\"primary\", stream) \n x = stream.read(1)\n if x == \"\": return __debug_exit(None, stream)\n\n def eat_this(supposed_first_char, the_string):\n if len(the_string) < 1 or the_string[0] != supposed_first_char:\n raise RegularExpressionException(\"missing '%s'\" % supposed_first_char + \"\\n\" + \\\n \"remaining string = '%s'\" % the_string) \n return the_string[1:] \n\n # -- 'primary' primary\n if x == \"\\\"\": result = snap_character_string.do(stream)\n elif x == \"[\": \n stream.seek(-1, 1); \n result = character_set_expression.do(stream)\n elif x == \"{\": result = snap_replacement(stream, PatternDict)\n elif x == \".\": result = create_ALL_BUT_NEWLINE_state_machine()\n elif x == \"(\": \n __start_position = stream.tell()\n result = snap_expression(stream, PatternDict)\n if stream.read(1) != \")\": \n stream.seek(-1, 1)\n raise RegularExpressionException(\"missing closing ')' after expression. found '%s'\" % stream.read())\n\n if result == None:\n __expression_length = stream.tell() - __start_position\n stream.seek(__start_position)\n raise RegularExpressionException(\"expression in brackets has invalid syntax '%s'\" % \\\n stream.read(__expression_length))\n\n elif x.isspace():\n # a lonestanding space ends the regular expression\n stream.seek(-1, 1)\n return __debug_exit(None, stream)\n\n elif x in [\"*\", \"+\", \"?\"]:\n raise RegularExpressionException(\"lonely operator '%s' without expression proceeding.\" % x) \n\n elif x not in CONTROL_CHARACTERS:\n # NOTE: The '\\' is not inside the control characters---for a reason.\n # It is used to define for example character codes using '\\x' etc.\n stream.seek(-1, 1)\n result = snap_non_control_characters(stream)\n\n else:\n # NOTE: This includes the '$' sign which means 'end of line'\n # because the '$' sign is in CONTROL_CHARACTERS, but is not checked\n # against. Thus, it it good to leave here on '$' because the\n # '$' sign is handled on the very top level.\n # this is not a valid primary\n stream.seek(-1, 1)\n return __debug_exit(None, stream)\n\n # -- optional repetition command? \n result_repeated = __snap_repetition_range(result, stream) \n ## print \"##imr:\", result.get_string(NormalizeF=False)\n if result_repeated != None: result = result_repeated\n return __debug_exit(__beautify(result), stream)\n \ndef snap_non_control_characters(stream):\n \"\"\"Snaps any 'non_control_character' using UTF8 encoding from the given string. Note, that \n in UTF8 a character may consist of more than one byte. Creates a state machine \n that contains solely one trigger for each character to a acceptance state.\n\n This function **concatinates** incoming characters, but **repetition** has preceedence\n over concatination, so it checks after each character whether it is followed by\n a repetition ('*', '+', '?', '{..}'). In such a case, the repetition of the character\n is appended.\n \"\"\"\n __debug_entry(\"non-control characters\", stream)\n\n result = StateMachine()\n state_index = result.init_state_index\n # (*) read first character\n position = stream.tell()\n char_code = utf8.__read_one_utf8_code_from_stream(stream)\n while char_code != 0xFF:\n # (1) check against occurence of control characters\n # this needs to come **before** the backslashed character interpretation.\n # NOTE: A backslashed character can be a whitespace (for example '\\n'). \n # (check against 0xFF to avoid overflow in function 'chr()') \n if char_code < 0xFF \\\n and (chr(char_code) in CONTROL_CHARACTERS or chr(char_code).isspace()):\n stream.seek(-1, 1) \n break \n\n # (2) treat backslashed characters\n if char_code == ord('\\\\'):\n stream.seek(-1, 1)\n trigger_set = character_set_expression.snap_property_set(stream)\n if trigger_set == None:\n stream.seek(1, 1) # snap_property_set() leaves tream right before '\\\\'\n char_code = snap_backslashed_character.do(stream)\n if char_code == None:\n raise RegularExpressionException(\"Backslash followed by unrecognized character code.\")\n trigger_set = char_code\n else:\n trigger_set = char_code\n\n # (3) read next character\n position = stream.tell()\n next_char_code = utf8.__read_one_utf8_code_from_stream(stream)\n # -- check for repetition (repetition has preceedence over concatination)\n if next_char_code in [ord(\"+\"), ord(\"*\"), ord(\"?\"), ord(\"{\")]:\n # (*) create state machine that consist of a single transition \n tmp = StateMachine()\n tmp.add_transition(tmp.init_state_index, trigger_set, AcceptanceF=True)\n # -- repeat the single character state machine\n stream.seek(position)\n tmp_repeated = __snap_repetition_range(tmp, stream) \n # -- append it to the result (last state must be set to acceptance for concatenation)\n result.states[state_index].set_acceptance()\n result = sequentialize.do([result, tmp_repeated], MountToFirstStateMachineF=True)\n # as soon as there is repetition there might be more than one acceptance\n # state and thus simple concatination via 'add_transition' fails.\n # let us return and check treat the remaining chars\n # at the next call to this function.\n return __debug_exit(result, stream)\n\n else:\n # (*) add new transition from current state to a new state triggering\n # on the given character.\n state_index = result.add_transition(state_index, trigger_set)\n\n char_code = next_char_code\n\n # last character in the chain triggers an 'acceptance state'\n result.states[state_index].set_acceptance()\n \n return __debug_exit(result, stream)\n \ndef snap_replacement(stream, PatternDict):\n \"\"\"Snaps a predefined pattern from the input string and returns the resulting\n state machine.\n \"\"\" \n skip_whitespace(stream)\n pattern_name = read_identifier(stream) \n if pattern_name == \"\":\n raise RegularExpressionException(\"Pattern replacement expression misses identifier after '{'.\")\n skip_whitespace(stream)\n\n letter = stream.read(1)\n if letter != \"}\":\n raise RegularExpressionException(\"Pattern replacement expression misses closing '}' after '%s'.\" \\\n % pattern_name)\n\n if PatternDict.has_key(pattern_name) == False:\n raise RegularExpressionException(\"Pattern of name '%s' was not defined in any preceding 'define { }' section\" \\\n % pattern_name)\n\n state_machine = PatternDict[pattern_name].state_machine\n # It is essential that state machines defined as patterns do not \n # have origins. Otherwise, the optimization of patterns that\n # contain pattern replacements might get confused and can\n # not find all optimizations.\n assert state_machine.has_origins() == False\n \n return state_machine\n\ndef __snap_repetition_range(the_state_machine, stream): \n \"\"\"Snaps a string that represents a repetition range. The following \n syntaxes are supported:\n '?' one or none repetition\n '+' one or arbitrary repetition\n '*' arbitrary repetition (even zero)\n '{n}' exactly 'n' repetitions\n '{m,n}' from 'm' to 'n' repetitions\n '{n,}' arbitrary, but at least 'n' repetitions\n \"\"\" \n assert the_state_machine.__class__.__name__ == \"StateMachine\", \\\n \"received object of type '%s'\" % the_state_machine.__class__.__name__ + \"\\n\" + \\\n repr(the_state_machine)\n\n position_0 = stream.tell()\n x = stream.read(1)\n if x == \"+\": result = repeat.do(the_state_machine, 1)\n elif x == \"*\": result = repeat.do(the_state_machine)\n elif x == \"?\": result = repeat.do(the_state_machine, 0, 1)\n elif x == \"{\":\n repetition_range_str = __snap_until(stream, \"}\")\n if len(repetition_range_str) and not repetition_range_str[0].isdigit():\n # no repetition range, so everything remains as it is\n stream.seek(position_0)\n return the_state_machine\n \n try:\n if repetition_range_str.find(\",\") == -1:\n # no ',' thus \"match exactly a certain number\": \n # e.g. {4} = match exactly four repetitions\n number = int(repetition_range_str)\n result = repeat.do(the_state_machine, number, number)\n return result\n # a range of numbers is given \n fields = repetition_range_str.split(\",\")\n fields = map(lambda x: x.strip(), fields)\n\n number_1 = int(fields[0].strip())\n if fields[1] == \"\": number_2 = -1 # e.g. {2,}\n else: number_2 = int(fields[1].strip()) # e.g. {2,5} \n # produce repeated state machine \n result = repeat.do(the_state_machine, number_1, number_2)\n return result\n except:\n raise RegularExpressionException(\"error while parsing repetition range expression '%s'\" \\\n % repetition_range_str)\n else:\n # no repetition range, so everything remains as it is\n stream.seek(position_0)\n return the_state_machine\n \n return result\n\ndef __set_end_of_line_post_context(sm, EndOfFileCode=0):\n \"\"\"Appends a post condition to the state machine to handle the end of line\n statement. This consists in translating 'EndOfLine' into a state machine\n with 'Newline' or 'EndOfFile'. Thus, when one of both follows the current\n character is at the end of a line.\n\n If you want to use a different code for end of file, specify it via the\n first argument 'EndOfFile'.\n\n NOTE: This is fundamentally different from beginning of line (BOL). BOL\n can be achieved by letting the state machine raise the corresponding\n flag. End of line post conditions rely on external algorithms for\n mounting a post-condition.\n \"\"\"\n post_context_sm = StateMachine()\n post_context_sm.add_transition(post_context_sm.init_state_index, ord('\\n'), AcceptanceF=True)\n post_context_sm.add_transition(post_context_sm.init_state_index, EndOfFileCode, AcceptanceF=True)\n\n result = setup_post_context.do(sm, post_context_sm)\n\n return result\n\ndef __beautify(the_state_machine):\n ## assert the_state_machine.get_orphaned_state_index_list() == [], \\\n ## \"before conversion to DFA: orphaned states \" + repr(the_state_machine)\n result = nfa_to_dfa.do(the_state_machine)\n ## assert the_state_machine.get_orphaned_state_index_list() == [], \\\n ## \"after conversion to DFA: orphaned states \" + repr(the_state_machine)\n result = hopcroft.do(result)#, CreateNewStateMachineF=False)\n ## assert the_state_machine.get_orphaned_state_index_list() == [], \\\n ## \"after hopcroft minimization: orphaned states \" + repr(the_state_machine)\n\n return result\n\ndef __construct(core_sm, pre_context=None, post_context=None):\n\n if pre_context == None and post_context == None:\n result = core_sm\n # -- can't get more beautiful ...\n \n elif pre_context == None and post_context != None:\n result = setup_post_context.do(core_sm, post_context)\n result = __beautify(result)\n\n elif pre_context != None and post_context == None:\n result = setup_pre_context.do(core_sm, pre_context)\n result = __beautify(result)\n\n elif pre_context != None and post_context != None:\n # NOTE: pre-condition needs to be setup **after** post condition, because\n # post condition deletes all origins!\n # (is this still so? 07y7m6d fschaef)\n result = setup_post_context.do(core_sm, post_context)\n result = setup_pre_context.do(result, pre_context)\n result = __beautify(result)\n\n return result\n \ndef create_ALL_BUT_NEWLINE_state_machine():\n result = StateMachine()\n # NOTE: Buffer control characters are supposed to be filtered out by the code\n # generator.\n trigger_set = NumberSet(Interval(ord(\"\\n\")).inverse()) \n\n result.add_transition(result.init_state_index, trigger_set, AcceptanceF=True) \n return result\n \n" }, { "alpha_fraction": 0.7048762440681458, "alphanum_fraction": 0.7060765027999878, "avg_line_length": 32.492462158203125, "blob_id": "c735e83d2c950bc7ef63d6702cb50afdd0906103", "content_id": "b5ebcc3b6c5d44b5456add4600c7e0e163d30616", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 6665, "license_type": "permissive", "max_line_length": 118, "num_lines": 199, "path": "/engine/gfx/gfx_disk_resource.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\nclass GfxTextureDiskResource;\nclass GfxMeshDiskResource;\nclass GfxEnvCubeDiskResource;\nclass GfxColourGradeLUTDiskResource;\n\n#ifndef GFX_DISK_RESOURCE_H\n#define GFX_DISK_RESOURCE_H\n\n#include <math_util.h>\n\n#include <centralised_log.h>\n#include \"../background_loader.h\"\n\n/** Representation for Ogre resources. Just hold the name, leave the rest to subclasses\n *\n * A loaded disk resource is only 'prepared' in Ogre parlance. The actual Ogre\n * load, i.e. the movement of data from system memory to GPU memory, is done on\n * the render of the first frame where the resource is actually used.\n */\nclass GfxBaseDiskResource : public DiskResource {\n\n public:\n\n /** Use disk_resource_get_or_make to create a new disk resource. */\n GfxBaseDiskResource (const std::string &name)\n : name(name)\n {\n if (name[0] != '/')\n EXCEPT << \"Path must be absolute: \" << name << ENDL;\n } \n\n /** Return Grit name for the resource, e.g. \"/system/blah.dds\". */\n virtual const std::string &getName (void) const { return name; }\n\n private:\n\n /** A cache of the Grit name, which is different to the Ogre name. */\n const std::string name;\n};\n\n/** Representation for GPU resources. Just declare we are a\n * GPU resource. Leave the rest to subclasses\n */\nclass GfxGPUDiskResource : public GfxBaseDiskResource {\n\n public:\n\n /** Use disk_resource_get_or_make to create a new disk resource. */\n GfxGPUDiskResource (const std::string &name)\n : GfxBaseDiskResource(name)\n { } \n /** Returns true. */\n virtual bool isGPUResource (void) const { return true; }\n\n};\n\n/** Base representation for textures. Textures have no dependencies.\n */\nclass GfxBaseTextureDiskResource : public GfxGPUDiskResource {\n\n public:\n /** Use disk_resource_get_or_make to create a new disk resource. */\n GfxBaseTextureDiskResource (const std::string &name)\n : GfxGPUDiskResource(name) { }\n\n /** Return the internal Ogre object. */\n const Ogre::TexturePtr &getOgreTexturePtr (void) { return rp; }\n\n protected:\n /** The ogre representaiton. */\n Ogre::TexturePtr rp;\n\n};\n\n/** Representation for textures. Textures have no dependencies.\n */\nclass GfxTextureDiskResource : public GfxBaseTextureDiskResource {\n\n public:\n /** Use disk_resource_get_or_make to create a new disk resource. */\n GfxTextureDiskResource (const std::string &name);\n\n protected:\n\n /** Load via Ogre (i.e. prepare it in Ogre terminology). */\n virtual void loadImpl (void);\n /** Reload from disk via Ogre calls. */\n virtual void reloadImpl (void);\n /** Unload via Ogre. */\n virtual void unloadImpl (void);\n\n};\n\n/** Representation for meshes.\n * Meshes depend on textures via materials, so the material database is used\n * while loading meshes to determine the textures used. For background\n * loading, this has concurrency implications. Also, if the material changes\n * to use a different texture, the list of dependencies may become stale. This\n * is not currently handled correctly.\n */\nclass GfxMeshDiskResource : public GfxGPUDiskResource {\n\n public:\n /** Use disk_resource_get_or_make to create a new disk resource. */\n GfxMeshDiskResource (const std::string &name);\n\n /** Return the internal Ogre object. */\n const Ogre::MeshPtr &getOgreMeshPtr (void) { return rp; }\n\n private:\n /** The ogre representation. */\n Ogre::MeshPtr rp;\n\n /** Load via Ogre (i.e. prepare it in Ogre terminology). */\n virtual void loadImpl (void);\n /** Reload from disk via Ogre calls. */\n virtual void reloadImpl (void);\n /** Unload via Ogre. */\n virtual void unloadImpl (void);\n\n};\n\n/** Representation for environmental lighting cubes.\n */\nclass GfxEnvCubeDiskResource : public GfxBaseTextureDiskResource {\n\n public:\n /** Use disk_resource_get_or_make to create a new disk resource. */\n GfxEnvCubeDiskResource (const std::string &name);\n\n private:\n\n /** Load via Ogre (i.e. prepare it in Ogre terminology). */\n virtual void loadImpl (void);\n /** Unload via Ogre. */\n virtual void unloadImpl (void);\n\n};\n\n/** Representation for colour grading 3D LUT.\n */\nclass GfxColourGradeLUTDiskResource : public GfxBaseTextureDiskResource {\n\n public:\n /** Use disk_resource_get_or_make to create a new disk resource. */\n GfxColourGradeLUTDiskResource (const std::string &name);\n\n /** Look up a single colour in the LUT. The resource must be loaded (onto the GPU). */\n Vector3 lookUp (const Vector3 &v) const;\n\n private:\n /** The original image, kept on the CPU for lua or c++ lookups. */\n Ogre::Image img;\n\n /** Load via Ogre (i.e. prepare it in Ogre terminology). */\n virtual void loadImpl (void);\n /** Unload via Ogre. */\n virtual void unloadImpl (void);\n\n};\n\n// Necessary modifications to children due to material changes\n// * When a material changes texture, iterate through all meshes to find users of this material\n// * For each mesh that uses the material:\n// * * calculate: New set of children, old set of children\n// * * new set of children are incremented, and loaded (foreground thread) if needed\n// * * old set of children are decremented\n\n/** How much RAM is available on the GPU. This is actually a number provided by the user, via gfx_option(GFX_RAM). */\ndouble gfx_gpu_ram_available (void);\n\n/** How much RAM is used on the GPU. */\ndouble gfx_gpu_ram_used (void);\n\n/** Should additional log messages specifically about graphics resource loading/unloaded be emitted? */\nextern bool gfx_disk_resource_verbose_loads;\n\n#endif\n" }, { "alpha_fraction": 0.5751489996910095, "alphanum_fraction": 0.5775165557861328, "avg_line_length": 42.74285888671875, "blob_id": "ac0e3d0d843d039d40782e088bb17994f16ca8b9", "content_id": "bb75c846e757ba6b3a643be1d9a50825bd9808ed", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 12249, "license_type": "permissive", "max_line_length": 255, "num_lines": 280, "path": "/dependencies/quex-0.34.1/quex/token_id_maker.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "#! /usr/bin/env python\nimport time\nimport os\nimport sys\nimport re\n\nfrom GetPot import GetPot\n\nimport quex.frs_py.file_in as file_in\nimport quex.lexer_mode as lexer_mode\n\nfrom quex.frs_py.string_handling import blue_print\n\nclass TokenInfo:\n def __init__(self, Name, ID, TypeName=None, Filename=\"\", LineN=-1):\n self.name = Name\n self.number = ID\n self.related_type = TypeName\n self.positions = [ Filename, LineN ]\n self.id = None\n\nclass Setup:\n def __init__(self, GlobalSetup):\n\n self.input_files = GlobalSetup.input_token_id_db\n self.output_file = GlobalSetup.output_token_id_file\n self.token_class_file = GlobalSetup.input_token_class_file\n self.token_class = GlobalSetup.input_token_class_name\n self.token_prefix = GlobalSetup.input_token_id_prefix\n self.id_count_offset = GlobalSetup.input_token_counter_offset\n self.input_foreign_token_id_file = GlobalSetup.input_foreign_token_id_file\n \nfile_str = \\\n\"\"\"// -*- C++ -*- vim: set syntax=cpp:\n// PURPOSE: File containing definition of token-identifier and\n// a function that maps token identifiers to a string\n// name.\n//\n// NOTE: This file has been created automatically by a\n// quex program.\n//\n// DATE: $$DATE$$\n//\n/////////////////////////////////////////////////////////////////////////////////////////\n#ifndef __INCLUDE_GUARD__QUEX__TOKEN_IDS__AUTO_$$DATE_IG$$__\n#define __INCLUDE_GUARD__QUEX__TOKEN_IDS__AUTO_$$DATE_IG$$__\n\n#include<cstdio> // for: 'std::sprintf'\n#include<map> // for: 'token-id' <-> 'name map'\n\n/* Definition of essential token identifiers that the analyser engine requires. */\n#if defined(__QUEX_TOKEN_ID_TERMINATION) || defined(__QUEX_TOKEN_ID_UNINITIALIZED)\n# error \\\"Token identifiers for 'termination' and/or 'unilitialized' have been defined previously. This indicates that the inclusion sequence is incorrect. For example the file 'quex/code_base/descriptions' shall **not** be included before this file.\\\"\n#endif\n/* Note, we can very well refer in macros to things that are defined below. */\n#define __QUEX_TOKEN_ID_TERMINATION ($$TOKEN_PREFIX$$TERMINATION)\n#define __QUEX_TOKEN_ID_UNINITIALIZED ($$TOKEN_PREFIX$$UNINITIALIZED)\n\n/* The token class definition file can only be included after the two token identifiers have\n * been defined. Otherwise, it would rely on default values. */\n#include \"$$TOKEN_CLASS_DEFINITION_FILE$$\"\n\n$$TOKEN_ID_DEFINITIONS$$\n\nnamespace quex {\n\n$$CONTENT$$\n\n}\n#endif // __INCLUDE_GUARD__QUEX__TOKEN_IDS__AUTO_GENERATED__\n\"\"\"\n\nfunc_str = \\\n\"\"\"\n inline const std::string&\n $$TOKEN_CLASS$$::map_id_to_name(const QUEX_TOKEN_ID_TYPE TokenID)\n {\n static bool virginity_f = true;\n static std::map<QUEX_TOKEN_ID_TYPE, std::string> db;\n static std::string error_string(\"\");\n static std::string uninitialized_string(\"<UNINITIALIZED>\");\n static std::string termination_string(\"<TERMINATION>\");\n \n // NOTE: In general no assumptions can be made that the QUEX_TOKEN_ID_TYPE\n // is an integer. Thus, no switch statement is used. \n if( virginity_f ) {\n virginity_f = false;\n // Create the Database mapping TokenID -> TokenName\n $$TOKEN_ID_CASES$$\n }\n\n if ( TokenID == __QUEX_TOKEN_ID_TERMINATION ) return termination_string;\n else if( TokenID == __QUEX_TOKEN_ID_UNINITIALIZED ) return uninitialized_string;\n std::map<QUEX_TOKEN_ID_TYPE, std::string>::const_iterator it = db.find(TokenID);\n if( it != db.end() ) return (*it).second;\n else {\n char tmp[64];\n std::sprintf(tmp, \"<UNKNOWN TOKEN-ID: %i>\", int(TokenID));\n error_string = std::string(tmp);\n return error_string;\n }\n }\n\"\"\"\n\ndef do(global_setup):\n \"\"\"Creates a file of token-ids from a given set of names.\n Creates also a function:\n\n const string& $$token$$::map_id_to_name().\n \"\"\"\n # file contains simply a whitespace separated list of token-names\n output(global_setup)\n return\n\n # THIS IS A FIRST ATTEMPT TO PARSE FOREIGN TOKEN ID DEFINITIONS\n for input_file in global_setup.input_token_id_db:\n curr_tokens = file_in.open_file_or_die(input_file).read().split(\";\") \n curr_token_infos = map(lambda x: TokenInfo(x.split(), input_file), curr_tokens)\n\n for token_info in curr_token_infos:\n if token_info.name == \"\": continue\n \n if token_info.name in lexer_mode.token_id_db.keys():\n print \"%s:0:error: token name '%s' defined twice.\" % (input_file, token_info.name)\n print \"%s:0:error: previously defined here.\" % lexer_mode.token_id_db[token_info.name].filename\n sys.exit(-1)\n\n lexer_mode.token_id_db[token_info.name] = token_info\n\ndef output(global_setup):\n global file_str\n assert lexer_mode.token_id_db.has_key(\"TERMINATION\"), \\\n \"TERMINATION token id must be defined by setup or user.\"\n assert lexer_mode.token_id_db.has_key(\"UNINITIALIZED\"), \\\n \"UNINITIALIZED token id must be defined by setup or user.\"\n # (*) Token ID File ________________________________________________________________\n #\n # The token id file can either be specified as database of\n # token-id names, or as a file that directly assigns the token-ids\n # to variables. If the flag '--user-token-id-file' is defined, then\n # then the token-id file is provided by the user. Otherwise, the\n # token id file is created by the token-id maker.\n #\n # The token id maker considers the file passed by the option '-t'\n # as the database file and creates a C++ file with the output filestem\n # plus the suffix \"--token-ids\". Note, that the token id file is a\n # header file.\n #\n setup = Setup(global_setup)\n if len(lexer_mode.token_id_db.keys()) == 2:\n # TERMINATION + UNINITIALIZED = 2 token ids. If they are the only ones nothing can be done.\n print \"error: No token id other than %sTERMINATION and %sUNINITIALIZED are defined. \" % \\\n (setup.token_prefix, setup.token_prefix)\n print \"error: Quex refuses to proceed. Please, use the 'token { ... }' section to \"\n print \"error: specify at least one other token id.\"\n sys.exit(-1)\n\n if global_setup.input_user_token_id_file != \"\":\n ## print \"(0) token ids provided by user\"\n ## print \" '%s'\" % global_setup.input_user_token_id_file\n global_setup.output_token_id_file = global_setup.input_user_token_id_file\n return\n \n if global_setup.input_token_id_db == \"\":\n print \"error: token-id database not specified\"\n sys.exit(-1)\n \n ## print \" token class file = '%s'\" % global_setup.input_token_class_file\n ## print \" => '%s'\" % global_setup.output_token_id_file\n \n #______________________________________________________________________________________\n L = max(map(lambda name: len(name), lexer_mode.token_id_db.keys()))\n def space(Name):\n return \" \" * (L - len(Name))\n\n # -- define values for the token ids\n # NO LONGER: token_id_txt = \"namespace quex {\\n\" \n token_id_txt = \"\"\n if setup.input_foreign_token_id_file != \"\":\n token_id_txt += \"#include\\\"%s\\\"\\n\" % setup.input_foreign_token_id_file\n\n else:\n token_names = lexer_mode.token_id_db.keys()\n token_names.sort()\n\n i = setup.id_count_offset\n for token_name in token_names:\n token_info = lexer_mode.token_id_db[token_name] \n if token_info.number == None: \n token_info.number = i; i+= 1\n token_id_txt += \"#define %s%s %s((QUEX_TOKEN_ID_TYPE)%i)\\n\" % (setup.token_prefix,\n token_name, space(token_name), \n token_info.number)\n # NO LONGER: token_id_txt += \"} // namespace quex\\n\" \n\n # -- define the function for token names\n db_build_txt = \"\"\n for token_name in lexer_mode.token_id_db.keys():\n db_build_txt += '\\n db[%s%s] %s= std::string(\"%s\");' % (setup.token_prefix,\n token_name,\n space(token_name),\n token_name)\n \n t = time.localtime()\n date_str = \"%iy%im%id_%ih%02im%02is\" % (t[0], t[1], t[2], t[3], t[4], t[5])\n\n \n file_str = file_str.replace(\"$$CONTENT$$\", func_str)\n content = blue_print(file_str,\n [[\"$$TOKEN_ID_DEFINITIONS$$\", token_id_txt],\n [\"$$DATE$$\", time.asctime()],\n [\"$$TOKEN_CLASS_DEFINITION_FILE$$\", setup.token_class_file],\n [\"$$DATE_IG$$\", date_str],\n [\"$$TOKEN_ID_CASES$$\", db_build_txt],\n [\"$$TOKEN_PREFIX$$\", setup.token_prefix],\n [\"$$TOKEN_CLASS$$\", setup.token_class]])\n\n fh = open(setup.output_file, \"wb\")\n if os.linesep != \"\\n\": content = content.replace(\"\\n\", os.linesep)\n fh.write(content)\n fh.close()\n\ndef parse_token_id_file(ForeignTokenIdFile, TokenPrefix, CommentDelimiterList, IncludeRE):\n \"\"\"This function somehow interprets the user defined token id file--if there is\n one. It does this in order to find the names of defined token ids. It does\n some basic interpretation and include file following, but: **it is in no\n way perfect**. Since its only purpose is to avoid warnings about token ids\n that are not defined it is not essential that it may fail sometimes.\n\n It is more like a nice feature that quex tries to find definitions on its own.\n \n Nevertheless, it should work in the large majority of cases.\n \"\"\"\n include_re_obj = re.compile(IncludeRE)\n\n # validate(...) ensured, that the file exists.\n work_list = [ ForeignTokenIdFile ] \n done_list = []\n unfound_list = []\n while work_list != []:\n fh = open(work_list.pop())\n content = fh.read()\n fh.close()\n\n # delete any comment inside the file\n for opener, closer in CommentDelimiterList:\n content = file_in.delete_comment(content, opener, closer, LeaveNewlineDelimiter=True)\n\n # add any found token id to the list\n token_id_finding_list = file_in.extract_identifiers_with_specific_prefix(content, TokenPrefix)\n for token_name, line_n in token_id_finding_list:\n prefix_less_token_name = token_name[len(TokenPrefix):]\n # NOTE: The line number might be wrong, because of the comment deletion\n lexer_mode.token_id_db[prefix_less_token_name] = \\\n TokenInfo(prefix_less_token_name, None, None, fh.name, line_n) \n \n # find \"#include\" statements\n include_file_list = include_re_obj.findall(content)\n include_file_list = filter(lambda file: file not in done_list, include_file_list)\n include_file_list = filter(lambda file: os.access(file, os.F_OK), include_file_list)\n work_list.extend(include_file_list)\n\nif __name__ == \"__main__\":\n if len(sys.argv) < 2:\n print \"error: missing command line parameter: input 'token file'\"\n sys.exit(-1)\n\n cl = GetPot(sys.argv)\n input_file = cl.follow(\"\", \"-i\")\n token_class_file = cl.follow(\"\", \"-t\")\n token_class = cl.follow(\"token\", \"--token-class-name\")\n token_counter_offset = cl.follow(1000, \"--offset\")\n output_file = cl.follow(\"\", \"-o\")\n token_prefix = cl.follow(\"TKN_\", \"--tp\")\n \n if \"\" in [input_file, output_file]:\n print \"error: please specify input (option '-i') and output file (option '-o')\"\n sys.exit(-1)\n \n do(Setup(input_file, output_file, token_class_file, token_class, token_prefix, token_counter_offset))\n\n" }, { "alpha_fraction": 0.7293635606765747, "alphanum_fraction": 0.7369250059127808, "avg_line_length": 34.266666412353516, "blob_id": "fdd3ca8fcb772bc7b39051983051fed46cd23bbb", "content_id": "83f30b04f4f85862201ac3def38140f380c14924", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 3174, "license_type": "permissive", "max_line_length": 106, "num_lines": 90, "path": "/engine/navigation/navigation.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#ifndef NAVIGATION_H\n#define NAVIGATION_H\n\n#include\"navigation_system.h\"\n#include\"navigation_manager.h\"\n\nclass NavigationSystem\n{\npublic:\n\n NavigationSystem(void);\n ~NavigationSystem(void);\n\n void init();\n void Update(const Ogre::Real tslf);\n void updateDebug(const Ogre::Real tslf);\n\n void reset(void);\n\n void set_dest_pos(Ogre::Vector3 pos);\n void buildNavMesh();\n\n void addObj(const char* mesh_name);\n void addGfxBody(GfxBodyPtr bd);\n void addGfxBodies(std::vector<GfxBodyPtr> bds);\n void addRigidBody(RigidBody *bd);\n\n void addTempObstacle(Ogre::Vector3 pos);\n void removeTempObstacle(Ogre::Vector3 pos);\n\n void addOffmeshConection(Ogre::Vector3 pos, Ogre::Vector3 pos2, bool bidir);\n void removeOffmeshConection(Ogre::Vector3 pos);\n\n void removeConvexVolume(Ogre::Vector3 pos);\n void createConvexVolume(Ogre::Vector3 pos);\n\n bool saveNavmesh(const char* path);\n bool loadNavmesh(const char* path);\n\n bool findNearestPointOnNavmesh(Ogre::Vector3 pos, dtPolyRef& m_targetRef, Ogre::Vector3 &resultPoint);\n bool getRandomNavMeshPoint(Ogre::Vector3 &resultPoint);\n bool getRandomNavMeshPointInCircle(Ogre::Vector3 point, float radius, Ogre::Vector3 &resultPoint);\n\n bool anyNavmeshLoaded(void) { return navMeshLoaded; };\n\n // Agent:\n int addAgent(Ogre::Vector3 pos);\n void removeAgent(int idx);\n bool isAgentActive(int idx);\n void agentStop(int idx);\n Ogre::Vector3 getAgentPosition(int idx);\n void setAgentPosition(int idx, Ogre::Vector3 pos);\n Ogre::Vector3 getAgentVelocity(int idx);\n void agentRequestVelocity(int idx, Ogre::Vector3 vel);\n void setAgentMoveTarget(int idx, Ogre::Vector3 pos, bool adjust);\n float getAgentHeight(int idx);\n float getAgentRadius(int idx);\n float getDistanceToGoal(int idx, const float maxRange);\n\n InputGeom* geom;\n\n NavigationManager* getNavigationManager(void) { return nvmgr; };\nprotected:\n NavigationManager* nvmgr;\n BuildContext ctx;\n\n bool navMeshLoaded = false;\n};\n#endif\n" }, { "alpha_fraction": 0.5451852083206177, "alphanum_fraction": 0.5451852083206177, "avg_line_length": 22.241378784179688, "blob_id": "ac73e42e1a515490dc3ef00a292bc66d4532e598", "content_id": "a97cb6b7e0a6cab1865969501fdbb2c663cb42ea", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 675, "license_type": "permissive", "max_line_length": 46, "num_lines": 29, "path": "/dependencies/quex-0.34.1/quex/core_engine/state_machine/dumpster.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "\nclass CachedValue:\n def __init__(self):\n self.__value = None\n self.__valid_f = False\n\n def __call__(self):\n return __value\n\n def set(self, Value):\n self.__value = Value\n self.__valid_f = True\n\n def invalid(self):\n self.__valid_f = False\n\n def is_valid():\n return self.__valid_f\n\n\nclass TransitionMapValueCache:\n def __init__(self):\n self.trigger_set_union = CachedValue()\n self.trigger_map = CachedValue()\n self.is_dfa_f = CachedValue()\n\n def invalid(self):\n self.trigger_set_union.invalid()\n self.trigger_map.invalid()\n self.is_dfa_f.invalid()\n" }, { "alpha_fraction": 0.6012033820152283, "alphanum_fraction": 0.6057161688804626, "avg_line_length": 42.671531677246094, "blob_id": "fd086aefbb4bdf0d652ffb6bc200497fc4dd5863", "content_id": "44726b510f23d2e9de52ecd916fd6a02f1feacc4", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 5983, "license_type": "permissive", "max_line_length": 114, "num_lines": 137, "path": "/dependencies/quex-0.34.1/quex/code_base/buffer/plain/BufferFiller_Plain.i", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* -*- C++ -*- vim: set syntax=cpp: */\n/* (C) 2008 Frank-Rene Schaefer*/\n#ifndef __INCLUDE_GUARD__QUEX_BUFFER__BUFFER_FILLER_PLAIN_I__\n#define __INCLUDE_GUARD__QUEX_BUFFER__BUFFER_FILLER_PLAIN_I__\n/**/\n\n#if ! defined (__QUEX_SETTING_PLAIN_C)\n# include <iostream> \n# include <cerrno>\n# include <stdexcept>\n#endif\n#include <quex/code_base/definitions>\n#include <quex/code_base/buffer/InputPolicy>\n#include <quex/code_base/buffer/Buffer>\n#include <quex/code_base/buffer/BufferFiller>\n#include <quex/code_base/MemoryManager>\n\n#include <quex/code_base/temporary_macros_on>\n\n#if ! defined (__QUEX_SETTING_PLAIN_C)\nnamespace quex {\n#endif\n\n# ifndef __QUEX_SETTING_PLAIN_C\n# define TEMPLATED(CLASS) CLASS<InputHandleT>\n# else\n# define TEMPLATED(CLASS) CLASS\n# endif\n\n TEMPLATE_IN(InputHandleT) size_t __BufferFiller_Plain_tell_character_index(QuexBufferFiller* alter_ego);\n TEMPLATE_IN(InputHandleT) void __BufferFiller_Plain_seek_character_index(QuexBufferFiller* alter_ego, \n const size_t CharacterIndex); \n TEMPLATE_IN(InputHandleT) size_t __BufferFiller_Plain_read_characters(QuexBufferFiller* alter_ego,\n QUEX_CHARACTER_TYPE* start_of_buffer, \n const size_t N);\n TEMPLATE_IN(InputHandleT) void __BufferFiller_Plain_destroy(QuexBufferFiller* alter_ego);\n\n TEMPLATE_IN(InputHandleT) void\n QuexBufferFiller_Plain_init(TEMPLATED(QuexBufferFiller_Plain)* me, \n InputHandleT* input_handle)\n {\n __quex_assert(me != 0x0);\n __quex_assert(input_handle != 0x0);\n\n __QuexBufferFiller_init_functions(&me->base,\n TEMPLATED(__BufferFiller_Plain_tell_character_index),\n TEMPLATED(__BufferFiller_Plain_seek_character_index), \n TEMPLATED(__BufferFiller_Plain_read_characters),\n TEMPLATED(__BufferFiller_Plain_destroy));\n /**/\n me->ih = input_handle;\n me->start_position = QUEX_INPUT_POLICY_TELL(me->ih, InputHandleT);\n }\n\n TEMPLATE_IN(InputHandleT) void \n __BufferFiller_Plain_destroy(QuexBufferFiller* alter_ego) \n {\n /* The memory manager allocated the space required for a buffer filler of this\n * type. Somewhere down the road it is known what size of memory belongs to this\n * pointer. */\n MemoryManager_free_BufferFiller(alter_ego);\n\n }\n\n TEMPLATE_IN(InputHandleT) size_t \n __BufferFiller_Plain_tell_character_index(QuexBufferFiller* alter_ego) \n { \n __quex_assert(alter_ego != 0x0); \n /* The type cast is necessary, since the function signature needs to \n * work with the first argument being of base class type. */\n TEMPLATED(QuexBufferFiller_Plain)* me = (TEMPLATED(QuexBufferFiller_Plain)*)alter_ego;\n\n __quex_assert(me->ih != 0x0); \n return (QUEX_INPUT_POLICY_TELL(me->ih, InputHandleT) - me->start_position) / sizeof(QUEX_CHARACTER_TYPE); \n }\n\n TEMPLATE_IN(InputHandleT) void \n __BufferFiller_Plain_seek_character_index(QuexBufferFiller* alter_ego, const size_t CharacterIndex) \n { \n /* NOTE: This differs from QuexBuffer_seek(...) in the sense, that it only sets the\n * stream to a particular position given by a character index. QuexBuffer_seek(..)\n * sets the _input_p to a particular position. */\n __quex_assert(alter_ego != 0x0); \n /* The type cast is necessary, since the function signature needs to \n * work with the first argument being of base class type. */\n TEMPLATED(QuexBufferFiller_Plain)* me = (TEMPLATED(QuexBufferFiller_Plain)*)alter_ego;\n __quex_assert(me->ih != 0x0); \n\n long avoid_tmp_arg = (long)(CharacterIndex * sizeof(QUEX_CHARACTER_TYPE) + me->start_position); \n QUEX_INPUT_POLICY_SEEK(me->ih, InputHandleT, avoid_tmp_arg);\n }\n\n TEMPLATE_IN(InputHandleT) size_t \n __BufferFiller_Plain_read_characters(QuexBufferFiller* alter_ego,\n QUEX_CHARACTER_TYPE* buffer_memory, const size_t N) \n { \n __quex_assert(alter_ego != 0x0); \n __quex_assert(buffer_memory != 0x0); \n /* The type cast is necessary, since the function signature needs to \n * work with the first argument being of base class type. */\n TEMPLATED(QuexBufferFiller_Plain)* me = (TEMPLATED(QuexBufferFiller_Plain)*)alter_ego;\n\n __quex_assert(me->ih != 0x0); \n const size_t ByteN = QUEX_INPUT_POLICY_LOAD_BYTES(me->ih, InputHandleT, \n buffer_memory, N * sizeof(QUEX_CHARACTER_TYPE));\n\n if( ByteN % sizeof(QUEX_CHARACTER_TYPE) != 0 ) {\n QUEX_ERROR_EXIT(\n \"Error: Plain character encoding: End of file cuts in the middle a multi-byte character.\");\n }\n return ByteN / sizeof(QUEX_CHARACTER_TYPE); \n }\n\n TEMPLATE_IN(InputHandleT) void \n __BufferFiller_Plain_mark_start_position(TEMPLATED(QuexBufferFiller_Plain)* me) \n { \n __quex_assert(me != 0x0); \n me->start_position = QUEX_INPUT_POLICY_TELL(me->ih, InputHandleT);\n }\n\n TEMPLATE_IN(InputHandleT) void \n __BufferFiller_Plain_reset_start_position(TEMPLATED(QuexBufferFiller_Plain)* me) \n {\n __quex_assert(me != 0x0); \n QUEX_INPUT_POLICY_SEEK(me->ih, InputHandleT, me->start_position);\n }\n\n# undef TEMPLATED_CLASS\n\n#if ! defined (__QUEX_SETTING_PLAIN_C)\n} /* namespace quex*/\n#endif\n\n#include <quex/code_base/temporary_macros_off>\n\n#include <quex/code_base/buffer/BufferFiller.i>\n#endif /* __INCLUDE_GUARD__QUEX_BUFFER_INPUT_STRATEGY_PLAIN_I__ */\n" }, { "alpha_fraction": 0.6411184668540955, "alphanum_fraction": 0.6467511653900146, "avg_line_length": 34.25531768798828, "blob_id": "09af487407bcf6d7a7a06c560c150f3c344136eb", "content_id": "57cc6ac0503d97546a298eb005b31eba7e2b3fb3", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 4971, "license_type": "permissive", "max_line_length": 118, "num_lines": 141, "path": "/dependencies/quex-0.34.1/quex/code_base/template/constructor.i", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "// -*- C++ -*- vim:set syntax=cpp:\n#include <quex/code_base/buffer/Buffer.i>\nnamespace quex { \n\ninline\nCLASS::CLASS()\n: \n // NOTE: dynamic_cast<>() would request derived class to be **defined**! \n // Decision: \"ease-of-use preceeds protection against a tremendous stupidity.\"\n self(*((__QUEX_SETTING_DERIVED_CLASS_NAME*)this)),\n __file_handle_allocated_by_constructor(0x0)\n# ifdef QUEX_OPTION_INCLUDE_STACK_SUPPORT\n , include_stack(this)\n# endif\n# ifdef QUEX_OPTION_STRING_ACCUMULATOR\n , accumulator(this)\n# endif\n# ifdef __QUEX_OPTION_INDENTATION_TRIGGER_SUPPORT\n , counter(this)\n# endif\n{\n CLASS::__constructor_core<FILE>(0x0, QUEX_PLAIN, 0x0);\n QuexBuffer_setup_memory(&this->buffer, \n MemoryManager_get_BufferMemory(QUEX_SETTING_BUFFER_SIZE), QUEX_SETTING_BUFFER_SIZE); \n}\n\ninline\nCLASS::CLASS(const std::string& Filename, \n const char* InputCodingName /* = 0x0 */, \n QuexBufferFillerTypeEnum BFT /* = QUEX_AUTO */)\n: \n // NOTE: dynamic_cast<>() would request derived class to be **defined**! \n // Decision: \"ease-of-use preceeds protection against a tremendous stupidity.\"\n self(*((__QUEX_SETTING_DERIVED_CLASS_NAME*)this)),\n __file_handle_allocated_by_constructor(0x0)\n# ifdef QUEX_OPTION_INCLUDE_STACK_SUPPORT\n , include_stack(this)\n# endif\n# ifdef QUEX_OPTION_STRING_ACCUMULATOR\n , accumulator(this)\n# endif\n# ifdef __QUEX_OPTION_INDENTATION_TRIGGER_SUPPORT\n , counter(this)\n# endif\n{\n // Buffer: Size = (see macro def.), Fallback = 10 Characters\n // prefer FILE* based buffers, because we can turn low-level buffering off.\n // ownership of FILE* id passed to the input strategy of the buffer\n std::FILE* fh = std::fopen(Filename.c_str(), \"r\");\n if( fh == NULL ) QUEX_ERROR_EXIT(\"Error on attempt to open specified file.\");\n setbuf(fh, 0); // turn off system based buffering!\n // // this is essential to profit from the quex buffer!\n __constructor_core(fh, BFT, InputCodingName);\n // Recall, that this thing as to be deleted/closed\n __file_handle_allocated_by_constructor = fh;\n}\n\ninline\nCLASS::CLASS(std::istream* p_input_stream, \n const char* InputCodingName /* = 0x0 */,\n QuexBufferFillerTypeEnum BFT /* = QUEX_AUTO */)\n:\n // NOTE: dynamic_cast<>() would request derived class to be **defined**! \n // Decision: \"ease-of-use preceeds protection against a tremendous stupidity.\"\n self(*((__QUEX_SETTING_DERIVED_CLASS_NAME*)this)),\n __file_handle_allocated_by_constructor(0x0)\n# ifdef QUEX_OPTION_INCLUDE_STACK_SUPPORT\n , include_stack(this)\n# endif\n# ifdef QUEX_OPTION_STRING_ACCUMULATOR\n , accumulator(this)\n# endif\n# ifdef __QUEX_OPTION_INDENTATION_TRIGGER_SUPPORT\n , counter(this)\n# endif\n{\n if( p_input_stream == NULL ) QUEX_ERROR_EXIT(\"Error: received NULL as pointer to input stream.\");\n __constructor_core(p_input_stream, BFT, InputCodingName);\n}\n\ninline\nCLASS::CLASS(std::wistream* p_input_stream, \n const char* InputCodingName /* = 0x0 */,\n QuexBufferFillerTypeEnum BFT /* = QUEX_AUTO */)\n:\n // NOTE: dynamic_cast<>() would request derived class to be **defined**! \n // Decision: \"ease-of-use preceeds protection against a tremendous stupidity.\"\n self(*((__QUEX_SETTING_DERIVED_CLASS_NAME*)this)),\n __file_handle_allocated_by_constructor(0x0)\n# ifdef QUEX_OPTION_INCLUDE_STACK_SUPPORT\n , include_stack(this)\n# endif\n# ifdef QUEX_OPTION_STRING_ACCUMULATOR\n , accumulator(this)\n# endif\n# ifdef __QUEX_OPTION_INDENTATION_TRIGGER_SUPPORT\n , counter(this)\n# endif\n{\n if( p_input_stream == NULL ) QUEX_ERROR_EXIT(\"Error: received NULL as pointer to input stream.\");\n __constructor_core(p_input_stream, BFT, InputCodingName);\n}\n\n\ninline\nCLASS::CLASS(std::FILE* fh, \n const char* InputCodingName /* = 0x0 */,\n QuexBufferFillerTypeEnum BFT /* = QUEX_AUTO */)\n: \n self(*((__QUEX_SETTING_DERIVED_CLASS_NAME*)this)),\n __file_handle_allocated_by_constructor(0x0)\n# ifdef QUEX_OPTION_INCLUDE_STACK_SUPPORT\n , include_stack(this)\n# endif\n# ifdef QUEX_OPTION_STRING_ACCUMULATOR\n , accumulator(this)\n# endif\n# ifdef __QUEX_OPTION_INDENTATION_TRIGGER_SUPPORT\n , counter(this)\n# endif\n{\n if( fh == NULL ) QUEX_ERROR_EXIT(\"Error: received NULL as a file handle.\");\n setbuf(fh, 0); // turn off system based buffering!\n // // this is essential to profit from the quex buffer!\n __constructor_core(fh, BFT, InputCodingName);\n}\n\n\ninline\nCLASS::~CLASS() \n{\n QuexAnalyser_destruct(this);\n# ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE \n delete _token_queue;\n# endif\n if( __file_handle_allocated_by_constructor != 0x0 ) {\n std::fclose(__file_handle_allocated_by_constructor); \n }\n}\n\n} // namespace quex\n" }, { "alpha_fraction": 0.6974148154258728, "alphanum_fraction": 0.7003525495529175, "avg_line_length": 37.2471923828125, "blob_id": "4b61e4f52e4456fb2201a6c9ec1cb3e18626e2ac", "content_id": "5076782988892c371d4cf61d094bc0ad84e06ac6", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 3404, "license_type": "permissive", "max_line_length": 93, "num_lines": 89, "path": "/engine/core_option.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#ifndef CORE_OPTION_h\n#define CORE_OPTION_h\n\n#include <map>\n\n#include \"option.h\"\n\nenum CoreBoolOption {\n\n /** Whether or not setting the next option will cause fresh option values to be\n * processed (default true). To update more than one option concurrently, set\n * autoupdate to false, set the options, then set it to true. */\n CORE_AUTOUPDATE,\n\n /** Whether to issue warnings if disk resources are loaded in the rendering thread. */\n CORE_FOREGROUND_WARNINGS\n};\n\nenum CoreFloatOption {\n /** A factor that is globally applied to object rendering distances. */\n CORE_VISIBILITY,\n\n /** The proportion of grit object rendering distance at which background\n * loading of disk resources is triggered. */\n CORE_PREPARE_DISTANCE_FACTOR,\n\n /** The proportion of rendering distance at which fading out begins. */\n CORE_FADE_OUT_FACTOR,\n\n /** The proportion of rendering distance at which fading to the next lod level begins. */\n CORE_FADE_OVERLAP_FACTOR\n};\n\nenum CoreIntOption {\n /** The number of objects per frame considered for streaming in. */\n CORE_STEP_SIZE,\n /** The number of megabytes of host RAM to use for cached disk resources. */\n CORE_RAM\n};\n\n/** Returns the enum value of the option described by s. Only one of o0, o1,\n * o2 is modified, and t is used to tell the caller which one. */\nvoid core_option_from_string (const std::string &s,\n int &t,\n CoreBoolOption &o0,\n CoreIntOption &o1,\n CoreFloatOption &o2);\n\n/** Set the option to a particular value. */\nvoid core_option (CoreBoolOption o, bool v);\n/** Return the current value of the option. */\nbool core_option (CoreBoolOption o);\n/** Set the option to a particular value. */\nvoid core_option (CoreIntOption o, int v);\n/** Return the current value of the option. */\nint core_option (CoreIntOption o);\n/** Set the option to a particular value. */\nvoid core_option (CoreFloatOption o, float v);\n/** Return the current value of the option. */\nfloat core_option (CoreFloatOption o);\n\n/** Initialise these options. */\nvoid core_option_init (void);\n\n/** Set every option to its default value. */\nvoid core_option_reset (void);\n\n#endif\n" }, { "alpha_fraction": 0.6113169193267822, "alphanum_fraction": 0.6217581629753113, "avg_line_length": 28.10784339904785, "blob_id": "67e9e086f96a2c1e9ac10c8ba6403bda45e20dbf", "content_id": "cc0c721263020b199311fe7aafd30324772fc628", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 5938, "license_type": "permissive", "max_line_length": 94, "num_lines": 204, "path": "/engine/audio/ogg_vorbis_decoder.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include \"ogg_vorbis_decoder.h\"\n\nstatic size_t read_callback (void *ptr, size_t size, size_t nmemb, void *datasource)\n{\n Ogre::DataStreamPtr &file = *static_cast<Ogre::DataStreamPtr*>(datasource);\n return file->read(ptr, size*nmemb);\n}\n\nstatic int seek_callback (void *datasource, ogg_int64_t offset, int type)\n{\n Ogre::DataStreamPtr &file = *static_cast<Ogre::DataStreamPtr*>(datasource);\n \n switch (type) {\n case SEEK_CUR:\n file->seek(file->tell()+offset);\n break;\n\n case SEEK_END:\n file->seek(file->size());\n break;\n\n case SEEK_SET:\n file->seek(offset);\n break;\n }\n return 0;\n}\nstatic long tell_callback (void *datasource)\n{\n const Ogre::DataStreamPtr &file = *static_cast<const Ogre::DataStreamPtr*>(datasource);\n return file->tell();\n}\n\nOggVorbisDecoder::OggVorbisDecoder(const std::string &name, const Ogre::DataStreamPtr &file)\n : name(name), file(file), prepared(false)\n{\n callbacks.read_func = read_callback;\n callbacks.seek_func = seek_callback;\n callbacks.close_func = NULL; // do nothing, the file is assumed to be closed by our caller\n callbacks.tell_func = tell_callback;\n}\n\nOggVorbisDecoder::~OggVorbisDecoder()\n{\n // ov_clear should also clean up info\n ov_clear(&vf);\n}\n\nvoid OggVorbisDecoder::prepare()\n{\n if (ov_open_callbacks(const_cast<void*>((const void*)&file), &vf, NULL, 0, callbacks) < 0)\n GRIT_EXCEPT(\"File \\\"\"+name+\"\\\" is not in Ogg format.\");\n \n info = ov_info(&vf, -1);\n if (info->channels > 2)\n GRIT_EXCEPT(\"Ogg Vorbis file \\\"\"+name+\"\\\" has more than two channels.\");\n \n prepared = true;\n}\n\nbool OggVorbisDecoder::isOggVorbis()\n{\n // if we passed initialization successfully then we're definitely an ogg vorbis file\n if (prepared) return true; \n if (ov_test_callbacks(&file, &vf, NULL, 0, callbacks) == 0) return true;\n return false;\n}\n \nbool OggVorbisDecoder::stereo()\n{\n if (!prepared) prepare();\n return (info->channels == 2);\n}\n\nint OggVorbisDecoder::rate()\n{\n if (!prepared) prepare();\n return info->rate;\n}\n\nuint32_t OggVorbisDecoder::total_decoded_size()\n{\n if (!prepared) prepare();\n int r = ov_pcm_total(&vf, -1);\n if (r < 0)\n GRIT_EXCEPT(\"error getting total decoded size for file \\\"\"+name+\"\\\"\");\n return r * info->channels * 2;\n}\n\nuint32_t OggVorbisDecoder::raw_total()\n{\n if (!prepared) prepare();\n int r = ov_raw_total(&vf, -1);\n if (r < 0)\n GRIT_EXCEPT(\"error getting raw total size for file \\\"\"+name+\"\\\"\");\n return r;\n}\nuint32_t OggVorbisDecoder::pcm_total()\n{\n if (!prepared) prepare();\n int r = ov_pcm_total(&vf, -1);\n if (r < 0)\n GRIT_EXCEPT(\"error getting pcm total size for file \\\"\"+name+\"\\\"\");\n return r;\n\n}\ndouble OggVorbisDecoder::time_total()\n{\n if (!prepared) prepare();\n double r = ov_pcm_total(&vf, -1);\n if (r < 0)\n GRIT_EXCEPT(\"error getting time total size for file \\\"\"+name+\"\\\"\");\n return r;\n}\n\nuint32_t OggVorbisDecoder::raw_seek(uint32_t pos)\n{\n if (!prepared) prepare();\n int r = ov_raw_seek(&vf, pos);\n if (r != 0)\n GRIT_EXCEPT(\"error raw seek for file \\\"\"+name+\"\\\"\");\n return r;\n}\nuint32_t OggVorbisDecoder::pcm_seek(uint32_t pos)\n{\n if (!prepared) prepare();\n int r = ov_pcm_seek(&vf, pos);\n if (r != 0)\n GRIT_EXCEPT(\"error pcm seek for file \\\"\"+name+\"\\\"\");\n return r;\n}\nuint32_t OggVorbisDecoder::time_seek(double pos)\n{\n if (!prepared) prepare();\n int r = ov_time_seek(&vf, pos);\n if (r != 0)\n GRIT_EXCEPT(\"error time seek for file \\\"\"+name+\"\\\"\");\n return r;\n}\n\nuint32_t OggVorbisDecoder::raw_tell()\n{\n if (!prepared) prepare();\n int r = ov_raw_tell(&vf);\n if (r < 0)\n GRIT_EXCEPT(\"error raw tell for file \\\"\"+name+\"\\\"\");\n return r;\n}\nuint32_t OggVorbisDecoder::pcm_tell()\n{\n if (!prepared) prepare();\n int r = ov_pcm_tell(&vf);\n if (r < 0)\n GRIT_EXCEPT(\"error pcm tell for file \\\"\"+name+\"\\\"\");\n return r;\n}\ndouble OggVorbisDecoder::time_tell()\n{\n if (!prepared) prepare();\n double r = ov_time_tell(&vf);\n if(r < 0)\n GRIT_EXCEPT(\"error time tell for file \\\"\"+name+\"\\\"\");\n return r;\n}\n\nlong OggVorbisDecoder::read(char *buffer, int length)\n{\n if (!prepared) prepare();\n\n int current_section;\n\n long bytes_read = ov_read(&vf, buffer, length,\n 0/*0 = little endian, 1 = big endian*/,\n 2/*1 = 8 bit samples, 2 = 16 bit samples*/,\n 1/*0 = unsigned samples, 1 = signed samples*/,\n &current_section);\n \n if (bytes_read < 0){ \n GRIT_EXCEPT(\"Error during decoding Ogg Vorbis file \\\"\"+name+\"\\\"\");\n }\n \n return bytes_read;\n}\n" }, { "alpha_fraction": 0.8078324198722839, "alphanum_fraction": 0.8078324198722839, "avg_line_length": 32.272727966308594, "blob_id": "343a6af60aadbc5aa702532b4e29fe1c549f88a0", "content_id": "2895cc887d21fef000a45fc0d34605779b2b80f3", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Makefile", "length_bytes": 2196, "license_type": "permissive", "max_line_length": 52, "num_lines": 66, "path": "/dependencies/recastnavigation_grit.mk", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "RECAST_WEAK_CPP_SRCS= \\\n\tDebugUtils/Source/DebugDraw.cpp \\\n\tDebugUtils/Source/DetourDebugDraw.cpp \\\n\tDebugUtils/Source/RecastDebugDraw.cpp \\\n\tDebugUtils/Source/RecastDump.cpp \\\n\tDetourCrowd/Source/DetourCrowd.cpp \\\n\tDetourCrowd/Source/DetourLocalBoundary.cpp \\\n\tDetourCrowd/Source/DetourObstacleAvoidance.cpp \\\n\tDetourCrowd/Source/DetourPathCorridor.cpp \\\n\tDetourCrowd/Source/DetourPathQueue.cpp \\\n\tDetourCrowd/Source/DetourProximityGrid.cpp \\\n\tDetour/Source/DetourAlloc.cpp \\\n\tDetour/Source/DetourCommon.cpp \\\n\tDetour/Source/DetourNavMeshBuilder.cpp \\\n\tDetour/Source/DetourNavMesh.cpp \\\n\tDetour/Source/DetourNavMeshQuery.cpp \\\n\tDetour/Source/DetourNode.cpp \\\n\tDetourTileCache/Source/DetourTileCacheBuilder.cpp \\\n\tDetourTileCache/Source/DetourTileCache.cpp \\\n\tRecast/Source/RecastAlloc.cpp \\\n\tRecast/Source/RecastArea.cpp \\\n\tRecast/Source/RecastContour.cpp \\\n\tRecast/Source/Recast.cpp \\\n\tRecast/Source/RecastFilter.cpp \\\n\tRecast/Source/RecastLayers.cpp \\\n\tRecast/Source/RecastMesh.cpp \\\n\tRecast/Source/RecastMeshDetail.cpp \\\n\tRecast/Source/RecastRasterization.cpp \\\n\tRecast/Source/RecastRegion.cpp \\\n\nRECAST_INCLUDE_SRCS= \\\n\tDetourCrowd/Include/DetourPathCorridor.h \\\n\tDetourCrowd/Include/DetourLocalBoundary.h \\\n\tDetourCrowd/Include/DetourProximityGrid.h \\\n\tDetourCrowd/Include/DetourCrowd.h \\\n\tDetourCrowd/Include/DetourPathQueue.h \\\n\tDetourCrowd/Include/DetourObstacleAvoidance.h \\\n\tDetourTileCache/Include/DetourTileCacheBuilder.h \\\n\tDetourTileCache/Include/DetourTileCache.h \\\n\tRecast/Include/RecastAssert.h \\\n\tRecast/Include/RecastAlloc.h \\\n\tRecast/Include/Recast.h \\\n\tDebugUtils/Include/DebugDraw.h \\\n\tDebugUtils/Include/RecastDump.h \\\n\tDebugUtils/Include/RecastDebugDraw.h \\\n\tDebugUtils/Include/DetourDebugDraw.h \\\n\tDetour/Include/DetourNavMesh.h \\\n\tDetour/Include/DetourStatus.h \\\n\tDetour/Include/DetourCommon.h \\\n\tDetour/Include/DetourAlloc.h \\\n\tDetour/Include/DetourNavMeshBuilder.h \\\n\tDetour/Include/DetourMath.h \\\n\tDetour/Include/DetourAssert.h \\\n\tDetour/Include/DetourNavMeshQuery.h \\\n\tDetour/Include/DetourNode.h \\\n\nRECAST_INCLUDE_DIRS= \\\n\tDebugUtils/Include \\\n\tDetour/Include \\\n\tDetourTileCache/Include \\\n\tDetourCrowd/Include \\\n\tRecast/Include \\\n\nRECAST_DEFS= \\\n\nRECAST_LDLIBS= \\\n" }, { "alpha_fraction": 0.6577966809272766, "alphanum_fraction": 0.6638727188110352, "avg_line_length": 24.657028198242188, "blob_id": "c1a525a7548005f28f5ade511d0b898b789a4490", "content_id": "7572769546ff85f4b1fc125ba2d2a99efe914cf0", "detected_licenses": [ "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer", "MIT" ], "is_generated": false, "is_vendor": false, "language": "C", "length_bytes": 1582937, "license_type": "permissive", "max_line_length": 109, "num_lines": 61696, "path": "/dependencies/quex-0.34.1/demo/004/benchmark/linux-2.6.22.17-kernel-dir.c", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/*\n * linux/kernel/acct.c\n *\n * BSD Process Accounting for Linux\n *\n * Author: Marco van Wieringen <mvw@planets.elm.net>\n *\n * Some code based on ideas and code from:\n * Thomas K. Dyas <tdyas@eden.rutgers.edu>\n *\n * This file implements BSD-style process accounting. Whenever any\n * process exits, an accounting record of type \"struct acct\" is\n * written to the file specified with the acct() system call. It is\n * up to user-level programs to do useful things with the accounting\n * log. The kernel just provides the raw accounting information.\n *\n * (C) Copyright 1995 - 1997 Marco van Wieringen - ELM Consultancy B.V.\n *\n * Plugged two leaks. 1) It didn't return acct_file into the free_filps if\n * the file happened to be read-only. 2) If the accounting was suspended\n * due to the lack of space it happily allowed to reopen it and completely\n * lost the old acct_file. 3/10/98, Al Viro.\n *\n * Now we silently close acct_file on attempt to reopen. Cleaned sys_acct().\n * XTerms and EMACS are manifestations of pure evil. 21/10/98, AV.\n *\n * Fixed a nasty interaction with with sys_umount(). If the accointing\n * was suspeneded we failed to stop it on umount(). Messy.\n * Another one: remount to readonly didn't stop accounting.\n *\tQuestion: what should we do if we have CAP_SYS_ADMIN but not\n * CAP_SYS_PACCT? Current code does the following: umount returns -EBUSY\n * unless we are messing with the root. In that case we are getting a\n * real mess with do_remount_sb(). 9/11/98, AV.\n *\n * Fixed a bunch of races (and pair of leaks). Probably not the best way,\n * but this one obviously doesn't introduce deadlocks. Later. BTW, found\n * one race (and leak) in BSD implementation.\n * OK, that's better. ANOTHER race and leak in BSD variant. There always\n * is one more bug... 10/11/98, AV.\n *\n *\tOh, fsck... Oopsable SMP race in do_process_acct() - we must hold\n * ->mmap_sem to walk the vma list of current->mm. Nasty, since it leaks\n * a struct file opened for write. Fixed. 2/6/2000, AV.\n */\n\n#include <linux/mm.h>\n#include <linux/slab.h>\n#include <linux/acct.h>\n#include <linux/capability.h>\n#include <linux/file.h>\n#include <linux/tty.h>\n#include <linux/security.h>\n#include <linux/vfs.h>\n#include <linux/jiffies.h>\n#include <linux/times.h>\n#include <linux/syscalls.h>\n#include <linux/mount.h>\n#include <asm/uaccess.h>\n#include <asm/div64.h>\n#include <linux/blkdev.h> /* sector_div */\n\n/*\n * These constants control the amount of freespace that suspend and\n * resume the process accounting system, and the time delay between\n * each check.\n * Turned into sysctl-controllable parameters. AV, 12/11/98\n */\n\nint acct_parm[3] = {4, 2, 30};\n#define RESUME\t\t(acct_parm[0])\t/* >foo% free space - resume */\n#define SUSPEND\t\t(acct_parm[1])\t/* <foo% free space - suspend */\n#define ACCT_TIMEOUT\t(acct_parm[2])\t/* foo second timeout between checks */\n\n/*\n * External references and all of the globals.\n */\nstatic void do_acct_process(struct file *);\n\n/*\n * This structure is used so that all the data protected by lock\n * can be placed in the same cache line as the lock. This primes\n * the cache line to have the data after getting the lock.\n */\nstruct acct_glbs {\n\tspinlock_t\t\tlock;\n\tvolatile int\t\tactive;\n\tvolatile int\t\tneedcheck;\n\tstruct file\t\t*file;\n\tstruct timer_list\ttimer;\n};\n\nstatic struct acct_glbs acct_globals __cacheline_aligned =\n\t{__SPIN_LOCK_UNLOCKED(acct_globals.lock)};\n\n/*\n * Called whenever the timer says to check the free space.\n */\nstatic void acct_timeout(unsigned long unused)\n{\n\tacct_globals.needcheck = 1;\n}\n\n/*\n * Check the amount of free space and suspend/resume accordingly.\n */\nstatic int check_free_space(struct file *file)\n{\n\tstruct kstatfs sbuf;\n\tint res;\n\tint act;\n\tsector_t resume;\n\tsector_t suspend;\n\n\tspin_lock(&acct_globals.lock);\n\tres = acct_globals.active;\n\tif (!file || !acct_globals.needcheck)\n\t\tgoto out;\n\tspin_unlock(&acct_globals.lock);\n\n\t/* May block */\n\tif (vfs_statfs(file->f_path.dentry, &sbuf))\n\t\treturn res;\n\tsuspend = sbuf.f_blocks * SUSPEND;\n\tresume = sbuf.f_blocks * RESUME;\n\n\tsector_div(suspend, 100);\n\tsector_div(resume, 100);\n\n\tif (sbuf.f_bavail <= suspend)\n\t\tact = -1;\n\telse if (sbuf.f_bavail >= resume)\n\t\tact = 1;\n\telse\n\t\tact = 0;\n\n\t/*\n\t * If some joker switched acct_globals.file under us we'ld better be\n\t * silent and _not_ touch anything.\n\t */\n\tspin_lock(&acct_globals.lock);\n\tif (file != acct_globals.file) {\n\t\tif (act)\n\t\t\tres = act>0;\n\t\tgoto out;\n\t}\n\n\tif (acct_globals.active) {\n\t\tif (act < 0) {\n\t\t\tacct_globals.active = 0;\n\t\t\tprintk(KERN_INFO \"Process accounting paused\\n\");\n\t\t}\n\t} else {\n\t\tif (act > 0) {\n\t\t\tacct_globals.active = 1;\n\t\t\tprintk(KERN_INFO \"Process accounting resumed\\n\");\n\t\t}\n\t}\n\n\tdel_timer(&acct_globals.timer);\n\tacct_globals.needcheck = 0;\n\tacct_globals.timer.expires = jiffies + ACCT_TIMEOUT*HZ;\n\tadd_timer(&acct_globals.timer);\n\tres = acct_globals.active;\nout:\n\tspin_unlock(&acct_globals.lock);\n\treturn res;\n}\n\n/*\n * Close the old accounting file (if currently open) and then replace\n * it with file (if non-NULL).\n *\n * NOTE: acct_globals.lock MUST be held on entry and exit.\n */\nstatic void acct_file_reopen(struct file *file)\n{\n\tstruct file *old_acct = NULL;\n\n\tif (acct_globals.file) {\n\t\told_acct = acct_globals.file;\n\t\tdel_timer(&acct_globals.timer);\n\t\tacct_globals.active = 0;\n\t\tacct_globals.needcheck = 0;\n\t\tacct_globals.file = NULL;\n\t}\n\tif (file) {\n\t\tacct_globals.file = file;\n\t\tacct_globals.needcheck = 0;\n\t\tacct_globals.active = 1;\n\t\t/* It's been deleted if it was used before so this is safe */\n\t\tinit_timer(&acct_globals.timer);\n\t\tacct_globals.timer.function = acct_timeout;\n\t\tacct_globals.timer.expires = jiffies + ACCT_TIMEOUT*HZ;\n\t\tadd_timer(&acct_globals.timer);\n\t}\n\tif (old_acct) {\n\t\tmnt_unpin(old_acct->f_path.mnt);\n\t\tspin_unlock(&acct_globals.lock);\n\t\tdo_acct_process(old_acct);\n\t\tfilp_close(old_acct, NULL);\n\t\tspin_lock(&acct_globals.lock);\n\t}\n}\n\nstatic int acct_on(char *name)\n{\n\tstruct file *file;\n\tint error;\n\n\t/* Difference from BSD - they don't do O_APPEND */\n\tfile = filp_open(name, O_WRONLY|O_APPEND|O_LARGEFILE, 0);\n\tif (IS_ERR(file))\n\t\treturn PTR_ERR(file);\n\n\tif (!S_ISREG(file->f_path.dentry->d_inode->i_mode)) {\n\t\tfilp_close(file, NULL);\n\t\treturn -EACCES;\n\t}\n\n\tif (!file->f_op->write) {\n\t\tfilp_close(file, NULL);\n\t\treturn -EIO;\n\t}\n\n\terror = security_acct(file);\n\tif (error) {\n\t\tfilp_close(file, NULL);\n\t\treturn error;\n\t}\n\n\tspin_lock(&acct_globals.lock);\n\tmnt_pin(file->f_path.mnt);\n\tacct_file_reopen(file);\n\tspin_unlock(&acct_globals.lock);\n\n\tmntput(file->f_path.mnt); /* it's pinned, now give up active reference */\n\n\treturn 0;\n}\n\n/**\n * sys_acct - enable/disable process accounting\n * @name: file name for accounting records or NULL to shutdown accounting\n *\n * Returns 0 for success or negative errno values for failure.\n *\n * sys_acct() is the only system call needed to implement process\n * accounting. It takes the name of the file where accounting records\n * should be written. If the filename is NULL, accounting will be\n * shutdown.\n */\nasmlinkage long sys_acct(const char __user *name)\n{\n\tint error;\n\n\tif (!capable(CAP_SYS_PACCT))\n\t\treturn -EPERM;\n\n\tif (name) {\n\t\tchar *tmp = getname(name);\n\t\tif (IS_ERR(tmp))\n\t\t\treturn (PTR_ERR(tmp));\n\t\terror = acct_on(tmp);\n\t\tputname(tmp);\n\t} else {\n\t\terror = security_acct(NULL);\n\t\tif (!error) {\n\t\t\tspin_lock(&acct_globals.lock);\n\t\t\tacct_file_reopen(NULL);\n\t\t\tspin_unlock(&acct_globals.lock);\n\t\t}\n\t}\n\treturn error;\n}\n\n/**\n * acct_auto_close - turn off a filesystem's accounting if it is on\n * @m: vfsmount being shut down\n *\n * If the accounting is turned on for a file in the subtree pointed to\n * to by m, turn accounting off. Done when m is about to die.\n */\nvoid acct_auto_close_mnt(struct vfsmount *m)\n{\n\tspin_lock(&acct_globals.lock);\n\tif (acct_globals.file && acct_globals.file->f_path.mnt == m)\n\t\tacct_file_reopen(NULL);\n\tspin_unlock(&acct_globals.lock);\n}\n\n/**\n * acct_auto_close - turn off a filesystem's accounting if it is on\n * @sb: super block for the filesystem\n *\n * If the accounting is turned on for a file in the filesystem pointed\n * to by sb, turn accounting off.\n */\nvoid acct_auto_close(struct super_block *sb)\n{\n\tspin_lock(&acct_globals.lock);\n\tif (acct_globals.file &&\n\t acct_globals.file->f_path.mnt->mnt_sb == sb) {\n\t\tacct_file_reopen(NULL);\n\t}\n\tspin_unlock(&acct_globals.lock);\n}\n\n/*\n * encode an unsigned long into a comp_t\n *\n * This routine has been adopted from the encode_comp_t() function in\n * the kern_acct.c file of the FreeBSD operating system. The encoding\n * is a 13-bit fraction with a 3-bit (base 8) exponent.\n */\n\n#define\tMANTSIZE\t13\t\t\t/* 13 bit mantissa. */\n#define\tEXPSIZE\t\t3\t\t\t/* Base 8 (3 bit) exponent. */\n#define\tMAXFRACT\t((1 << MANTSIZE) - 1)\t/* Maximum fractional value. */\n\nstatic comp_t encode_comp_t(unsigned long value)\n{\n\tint exp, rnd;\n\n\texp = rnd = 0;\n\twhile (value > MAXFRACT) {\n\t\trnd = value & (1 << (EXPSIZE - 1));\t/* Round up? */\n\t\tvalue >>= EXPSIZE;\t/* Base 8 exponent == 3 bit shift. */\n\t\texp++;\n\t}\n\n\t/*\n * If we need to round up, do it (and handle overflow correctly).\n */\n\tif (rnd && (++value > MAXFRACT)) {\n\t\tvalue >>= EXPSIZE;\n\t\texp++;\n\t}\n\n\t/*\n * Clean it up and polish it off.\n */\n\texp <<= MANTSIZE;\t\t/* Shift the exponent into place */\n\texp += value;\t\t\t/* and add on the mantissa. */\n\treturn exp;\n}\n\n#if ACCT_VERSION==1 || ACCT_VERSION==2\n/*\n * encode an u64 into a comp2_t (24 bits)\n *\n * Format: 5 bit base 2 exponent, 20 bits mantissa.\n * The leading bit of the mantissa is not stored, but implied for\n * non-zero exponents.\n * Largest encodable value is 50 bits.\n */\n\n#define MANTSIZE2 20 /* 20 bit mantissa. */\n#define EXPSIZE2 5 /* 5 bit base 2 exponent. */\n#define MAXFRACT2 ((1ul << MANTSIZE2) - 1) /* Maximum fractional value. */\n#define MAXEXP2 ((1 <<EXPSIZE2) - 1) /* Maximum exponent. */\n\nstatic comp2_t encode_comp2_t(u64 value)\n{\n int exp, rnd;\n\n exp = (value > (MAXFRACT2>>1));\n rnd = 0;\n while (value > MAXFRACT2) {\n rnd = value & 1;\n value >>= 1;\n exp++;\n }\n\n /*\n * If we need to round up, do it (and handle overflow correctly).\n */\n if (rnd && (++value > MAXFRACT2)) {\n value >>= 1;\n exp++;\n }\n\n if (exp > MAXEXP2) {\n /* Overflow. Return largest representable number instead. */\n return (1ul << (MANTSIZE2+EXPSIZE2-1)) - 1;\n } else {\n return (value & (MAXFRACT2>>1)) | (exp << (MANTSIZE2-1));\n }\n}\n#endif\n\n#if ACCT_VERSION==3\n/*\n * encode an u64 into a 32 bit IEEE float\n */\nstatic u32 encode_float(u64 value)\n{\n\tunsigned exp = 190;\n\tunsigned u;\n\n\tif (value==0) return 0;\n\twhile ((s64)value > 0){\n\t\tvalue <<= 1;\n\t\texp--;\n\t}\n\tu = (u32)(value >> 40) & 0x7fffffu;\n\treturn u | (exp << 23);\n}\n#endif\n\n/*\n * Write an accounting entry for an exiting process\n *\n * The acct_process() call is the workhorse of the process\n * accounting system. The struct acct is built here and then written\n * into the accounting file. This function should only be called from\n * do_exit().\n */\n\n/*\n * do_acct_process does all actual work. Caller holds the reference to file.\n */\nstatic void do_acct_process(struct file *file)\n{\n\tstruct pacct_struct *pacct = &current->signal->pacct;\n\tacct_t ac;\n\tmm_segment_t fs;\n\tunsigned long flim;\n\tu64 elapsed;\n\tu64 run_time;\n\tstruct timespec uptime;\n\tstruct tty_struct *tty;\n\n\t/*\n\t * First check to see if there is enough free_space to continue\n\t * the process accounting system.\n\t */\n\tif (!check_free_space(file))\n\t\treturn;\n\n\t/*\n\t * Fill the accounting struct with the needed info as recorded\n\t * by the different kernel functions.\n\t */\n\tmemset((caddr_t)&ac, 0, sizeof(acct_t));\n\n\tac.ac_version = ACCT_VERSION | ACCT_BYTEORDER;\n\tstrlcpy(ac.ac_comm, current->comm, sizeof(ac.ac_comm));\n\n\t/* calculate run_time in nsec*/\n\tdo_posix_clock_monotonic_gettime(&uptime);\n\trun_time = (u64)uptime.tv_sec*NSEC_PER_SEC + uptime.tv_nsec;\n\trun_time -= (u64)current->group_leader->start_time.tv_sec * NSEC_PER_SEC\n\t\t + current->group_leader->start_time.tv_nsec;\n\t/* convert nsec -> AHZ */\n\telapsed = nsec_to_AHZ(run_time);\n#if ACCT_VERSION==3\n\tac.ac_etime = encode_float(elapsed);\n#else\n\tac.ac_etime = encode_comp_t(elapsed < (unsigned long) -1l ?\n\t (unsigned long) elapsed : (unsigned long) -1l);\n#endif\n#if ACCT_VERSION==1 || ACCT_VERSION==2\n\t{\n\t\t/* new enlarged etime field */\n\t\tcomp2_t etime = encode_comp2_t(elapsed);\n\t\tac.ac_etime_hi = etime >> 16;\n\t\tac.ac_etime_lo = (u16) etime;\n\t}\n#endif\n\tdo_div(elapsed, AHZ);\n\tac.ac_btime = xtime.tv_sec - elapsed;\n\t/* we really need to bite the bullet and change layout */\n\tac.ac_uid = current->uid;\n\tac.ac_gid = current->gid;\n#if ACCT_VERSION==2\n\tac.ac_ahz = AHZ;\n#endif\n#if ACCT_VERSION==1 || ACCT_VERSION==2\n\t/* backward-compatible 16 bit fields */\n\tac.ac_uid16 = current->uid;\n\tac.ac_gid16 = current->gid;\n#endif\n#if ACCT_VERSION==3\n\tac.ac_pid = current->tgid;\n\tac.ac_ppid = current->parent->tgid;\n#endif\n\n\tspin_lock_irq(&current->sighand->siglock);\n\ttty = current->signal->tty;\n\tac.ac_tty = tty ? old_encode_dev(tty_devnum(tty)) : 0;\n\tac.ac_utime = encode_comp_t(jiffies_to_AHZ(cputime_to_jiffies(pacct->ac_utime)));\n\tac.ac_stime = encode_comp_t(jiffies_to_AHZ(cputime_to_jiffies(pacct->ac_stime)));\n\tac.ac_flag = pacct->ac_flag;\n\tac.ac_mem = encode_comp_t(pacct->ac_mem);\n\tac.ac_minflt = encode_comp_t(pacct->ac_minflt);\n\tac.ac_majflt = encode_comp_t(pacct->ac_majflt);\n\tac.ac_exitcode = pacct->ac_exitcode;\n\tspin_unlock_irq(&current->sighand->siglock);\n\tac.ac_io = encode_comp_t(0 /* current->io_usage */);\t/* %% */\n\tac.ac_rw = encode_comp_t(ac.ac_io / 1024);\n\tac.ac_swaps = encode_comp_t(0);\n\n\t/*\n * Kernel segment override to datasegment and write it\n * to the accounting file.\n */\n\tfs = get_fs();\n\tset_fs(KERNEL_DS);\n\t/*\n \t * Accounting records are not subject to resource limits.\n \t */\n\tflim = current->signal->rlim[RLIMIT_FSIZE].rlim_cur;\n\tcurrent->signal->rlim[RLIMIT_FSIZE].rlim_cur = RLIM_INFINITY;\n\tfile->f_op->write(file, (char *)&ac,\n\t\t\t sizeof(acct_t), &file->f_pos);\n\tcurrent->signal->rlim[RLIMIT_FSIZE].rlim_cur = flim;\n\tset_fs(fs);\n}\n\n/**\n * acct_init_pacct - initialize a new pacct_struct\n * @pacct: per-process accounting info struct to initialize\n */\nvoid acct_init_pacct(struct pacct_struct *pacct)\n{\n\tmemset(pacct, 0, sizeof(struct pacct_struct));\n\tpacct->ac_utime = pacct->ac_stime = cputime_zero;\n}\n\n/**\n * acct_collect - collect accounting information into pacct_struct\n * @exitcode: task exit code\n * @group_dead: not 0, if this thread is the last one in the process.\n */\nvoid acct_collect(long exitcode, int group_dead)\n{\n\tstruct pacct_struct *pacct = &current->signal->pacct;\n\tunsigned long vsize = 0;\n\n\tif (group_dead && current->mm) {\n\t\tstruct vm_area_struct *vma;\n\t\tdown_read(&current->mm->mmap_sem);\n\t\tvma = current->mm->mmap;\n\t\twhile (vma) {\n\t\t\tvsize += vma->vm_end - vma->vm_start;\n\t\t\tvma = vma->vm_next;\n\t\t}\n\t\tup_read(&current->mm->mmap_sem);\n\t}\n\n\tspin_lock_irq(&current->sighand->siglock);\n\tif (group_dead)\n\t\tpacct->ac_mem = vsize / 1024;\n\tif (thread_group_leader(current)) {\n\t\tpacct->ac_exitcode = exitcode;\n\t\tif (current->flags & PF_FORKNOEXEC)\n\t\t\tpacct->ac_flag |= AFORK;\n\t}\n\tif (current->flags & PF_SUPERPRIV)\n\t\tpacct->ac_flag |= ASU;\n\tif (current->flags & PF_DUMPCORE)\n\t\tpacct->ac_flag |= ACORE;\n\tif (current->flags & PF_SIGNALED)\n\t\tpacct->ac_flag |= AXSIG;\n\tpacct->ac_utime = cputime_add(pacct->ac_utime, current->utime);\n\tpacct->ac_stime = cputime_add(pacct->ac_stime, current->stime);\n\tpacct->ac_minflt += current->min_flt;\n\tpacct->ac_majflt += current->maj_flt;\n\tspin_unlock_irq(&current->sighand->siglock);\n}\n\n/**\n * acct_process - now just a wrapper around do_acct_process\n * @exitcode: task exit code\n *\n * handles process accounting for an exiting task\n */\nvoid acct_process(void)\n{\n\tstruct file *file = NULL;\n\n\t/*\n\t * accelerate the common fastpath:\n\t */\n\tif (!acct_globals.file)\n\t\treturn;\n\n\tspin_lock(&acct_globals.lock);\n\tfile = acct_globals.file;\n\tif (unlikely(!file)) {\n\t\tspin_unlock(&acct_globals.lock);\n\t\treturn;\n\t}\n\tget_file(file);\n\tspin_unlock(&acct_globals.lock);\n\n\tdo_acct_process(file);\n\tfput(file);\n}\n/* audit.c -- Auditing support\n * Gateway between the kernel (e.g., selinux) and the user-space audit daemon.\n * System-call specific features have moved to auditsc.c\n *\n * Copyright 2003-2007 Red Hat Inc., Durham, North Carolina.\n * All Rights Reserved.\n *\n * This program is free software; you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation; either version 2 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program; if not, write to the Free Software\n * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n *\n * Written by Rickard E. (Rik) Faith <faith@redhat.com>\n *\n * Goals: 1) Integrate fully with SELinux.\n *\t 2) Minimal run-time overhead:\n *\t a) Minimal when syscall auditing is disabled (audit_enable=0).\n *\t b) Small when syscall auditing is enabled and no audit record\n *\t\tis generated (defer as much work as possible to record\n *\t\tgeneration time):\n *\t\ti) context is allocated,\n *\t\tii) names from getname are stored without a copy, and\n *\t\tiii) inode information stored from path_lookup.\n *\t 3) Ability to disable syscall auditing at boot time (audit=0).\n *\t 4) Usable by other parts of the kernel (if audit_log* is called,\n *\t then a syscall record will be generated automatically for the\n *\t current syscall).\n *\t 5) Netlink interface to user-space.\n *\t 6) Support low-overhead kernel-based filtering to minimize the\n *\t information that must be passed to user-space.\n *\n * Example user-space utilities: http://people.redhat.com/sgrubb/audit/\n */\n\n#include <linux/init.h>\n#include <asm/types.h>\n#include <asm/atomic.h>\n#include <linux/mm.h>\n#include <linux/module.h>\n#include <linux/err.h>\n#include <linux/kthread.h>\n\n#include <linux/audit.h>\n\n#include <net/sock.h>\n#include <net/netlink.h>\n#include <linux/skbuff.h>\n#include <linux/netlink.h>\n#include <linux/selinux.h>\n#include <linux/inotify.h>\n#include <linux/freezer.h>\n\n#include \"audit.h\"\n\n/* No auditing will take place until audit_initialized != 0.\n * (Initialization happens after skb_init is called.) */\nstatic int\taudit_initialized;\n\n/* 0 - no auditing\n * 1 - auditing enabled\n * 2 - auditing enabled and configuration is locked/unchangeable. */\nint\t\taudit_enabled;\n\n/* Default state when kernel boots without any parameters. */\nstatic int\taudit_default;\n\n/* If auditing cannot proceed, audit_failure selects what happens. */\nstatic int\taudit_failure = AUDIT_FAIL_PRINTK;\n\n/* If audit records are to be written to the netlink socket, audit_pid\n * contains the (non-zero) pid. */\nint\t\taudit_pid;\n\n/* If audit_rate_limit is non-zero, limit the rate of sending audit records\n * to that number per second. This prevents DoS attacks, but results in\n * audit records being dropped. */\nstatic int\taudit_rate_limit;\n\n/* Number of outstanding audit_buffers allowed. */\nstatic int\taudit_backlog_limit = 64;\nstatic int\taudit_backlog_wait_time = 60 * HZ;\nstatic int\taudit_backlog_wait_overflow = 0;\n\n/* The identity of the user shutting down the audit system. */\nuid_t\t\taudit_sig_uid = -1;\npid_t\t\taudit_sig_pid = -1;\nu32\t\taudit_sig_sid = 0;\n\n/* Records can be lost in several ways:\n 0) [suppressed in audit_alloc]\n 1) out of memory in audit_log_start [kmalloc of struct audit_buffer]\n 2) out of memory in audit_log_move [alloc_skb]\n 3) suppressed due to audit_rate_limit\n 4) suppressed due to audit_backlog_limit\n*/\nstatic atomic_t audit_lost = ATOMIC_INIT(0);\n\n/* The netlink socket. */\nstatic struct sock *audit_sock;\n\n/* Inotify handle. */\nstruct inotify_handle *audit_ih;\n\n/* Hash for inode-based rules */\nstruct list_head audit_inode_hash[AUDIT_INODE_BUCKETS];\n\n/* The audit_freelist is a list of pre-allocated audit buffers (if more\n * than AUDIT_MAXFREE are in use, the audit buffer is freed instead of\n * being placed on the freelist). */\nstatic DEFINE_SPINLOCK(audit_freelist_lock);\nstatic int\t audit_freelist_count;\nstatic LIST_HEAD(audit_freelist);\n\nstatic struct sk_buff_head audit_skb_queue;\nstatic struct task_struct *kauditd_task;\nstatic DECLARE_WAIT_QUEUE_HEAD(kauditd_wait);\nstatic DECLARE_WAIT_QUEUE_HEAD(audit_backlog_wait);\n\n/* Serialize requests from userspace. */\nstatic DEFINE_MUTEX(audit_cmd_mutex);\n\n/* AUDIT_BUFSIZ is the size of the temporary buffer used for formatting\n * audit records. Since printk uses a 1024 byte buffer, this buffer\n * should be at least that large. */\n#define AUDIT_BUFSIZ 1024\n\n/* AUDIT_MAXFREE is the number of empty audit_buffers we keep on the\n * audit_freelist. Doing so eliminates many kmalloc/kfree calls. */\n#define AUDIT_MAXFREE (2*NR_CPUS)\n\n/* The audit_buffer is used when formatting an audit record. The caller\n * locks briefly to get the record off the freelist or to allocate the\n * buffer, and locks briefly to send the buffer to the netlink layer or\n * to place it on a transmit queue. Multiple audit_buffers can be in\n * use simultaneously. */\nstruct audit_buffer {\n\tstruct list_head list;\n\tstruct sk_buff *skb;\t/* formatted skb ready to send */\n\tstruct audit_context *ctx;\t/* NULL or associated context */\n\tgfp_t\t\t gfp_mask;\n};\n\nstatic void audit_set_pid(struct audit_buffer *ab, pid_t pid)\n{\n\tstruct nlmsghdr *nlh = nlmsg_hdr(ab->skb);\n\tnlh->nlmsg_pid = pid;\n}\n\nvoid audit_panic(const char *message)\n{\n\tswitch (audit_failure)\n\t{\n\tcase AUDIT_FAIL_SILENT:\n\t\tbreak;\n\tcase AUDIT_FAIL_PRINTK:\n\t\tprintk(KERN_ERR \"audit: %s\\n\", message);\n\t\tbreak;\n\tcase AUDIT_FAIL_PANIC:\n\t\tpanic(\"audit: %s\\n\", message);\n\t\tbreak;\n\t}\n}\n\nstatic inline int audit_rate_check(void)\n{\n\tstatic unsigned long\tlast_check = 0;\n\tstatic int\t\tmessages = 0;\n\tstatic DEFINE_SPINLOCK(lock);\n\tunsigned long\t\tflags;\n\tunsigned long\t\tnow;\n\tunsigned long\t\telapsed;\n\tint\t\t\tretval\t = 0;\n\n\tif (!audit_rate_limit) return 1;\n\n\tspin_lock_irqsave(&lock, flags);\n\tif (++messages < audit_rate_limit) {\n\t\tretval = 1;\n\t} else {\n\t\tnow = jiffies;\n\t\telapsed = now - last_check;\n\t\tif (elapsed > HZ) {\n\t\t\tlast_check = now;\n\t\t\tmessages = 0;\n\t\t\tretval = 1;\n\t\t}\n\t}\n\tspin_unlock_irqrestore(&lock, flags);\n\n\treturn retval;\n}\n\n/**\n * audit_log_lost - conditionally log lost audit message event\n * @message: the message stating reason for lost audit message\n *\n * Emit at least 1 message per second, even if audit_rate_check is\n * throttling.\n * Always increment the lost messages counter.\n*/\nvoid audit_log_lost(const char *message)\n{\n\tstatic unsigned long\tlast_msg = 0;\n\tstatic DEFINE_SPINLOCK(lock);\n\tunsigned long\t\tflags;\n\tunsigned long\t\tnow;\n\tint\t\t\tprint;\n\n\tatomic_inc(&audit_lost);\n\n\tprint = (audit_failure == AUDIT_FAIL_PANIC || !audit_rate_limit);\n\n\tif (!print) {\n\t\tspin_lock_irqsave(&lock, flags);\n\t\tnow = jiffies;\n\t\tif (now - last_msg > HZ) {\n\t\t\tprint = 1;\n\t\t\tlast_msg = now;\n\t\t}\n\t\tspin_unlock_irqrestore(&lock, flags);\n\t}\n\n\tif (print) {\n\t\tprintk(KERN_WARNING\n\t\t \"audit: audit_lost=%d audit_rate_limit=%d audit_backlog_limit=%d\\n\",\n\t\t atomic_read(&audit_lost),\n\t\t audit_rate_limit,\n\t\t audit_backlog_limit);\n\t\taudit_panic(message);\n\t}\n}\n\nstatic int audit_set_rate_limit(int limit, uid_t loginuid, u32 sid)\n{\n\tint res, rc = 0, old = audit_rate_limit;\n\n\t/* check if we are locked */\n\tif (audit_enabled == 2)\n\t\tres = 0;\n\telse\n\t\tres = 1;\n\n\tif (sid) {\n\t\tchar *ctx = NULL;\n\t\tu32 len;\n\t\tif ((rc = selinux_sid_to_string(sid, &ctx, &len)) == 0) {\n\t\t\taudit_log(NULL, GFP_KERNEL, AUDIT_CONFIG_CHANGE,\n\t\t\t\t\"audit_rate_limit=%d old=%d by auid=%u\"\n\t\t\t\t\" subj=%s res=%d\",\n\t\t\t\tlimit, old, loginuid, ctx, res);\n\t\t\tkfree(ctx);\n\t\t} else\n\t\t\tres = 0; /* Something weird, deny request */\n\t}\n\taudit_log(NULL, GFP_KERNEL, AUDIT_CONFIG_CHANGE,\n\t\t\"audit_rate_limit=%d old=%d by auid=%u res=%d\",\n\t\tlimit, old, loginuid, res);\n\n\t/* If we are allowed, make the change */\n\tif (res == 1)\n\t\taudit_rate_limit = limit;\n\t/* Not allowed, update reason */\n\telse if (rc == 0)\n\t\trc = -EPERM;\n\treturn rc;\n}\n\nstatic int audit_set_backlog_limit(int limit, uid_t loginuid, u32 sid)\n{\n\tint res, rc = 0, old = audit_backlog_limit;\n\n\t/* check if we are locked */\n\tif (audit_enabled == 2)\n\t\tres = 0;\n\telse\n\t\tres = 1;\n\n\tif (sid) {\n\t\tchar *ctx = NULL;\n\t\tu32 len;\n\t\tif ((rc = selinux_sid_to_string(sid, &ctx, &len)) == 0) {\n\t\t\taudit_log(NULL, GFP_KERNEL, AUDIT_CONFIG_CHANGE,\n\t\t\t\t\"audit_backlog_limit=%d old=%d by auid=%u\"\n\t\t\t\t\" subj=%s res=%d\",\n\t\t\t\tlimit, old, loginuid, ctx, res);\n\t\t\tkfree(ctx);\n\t\t} else\n\t\t\tres = 0; /* Something weird, deny request */\n\t}\n\taudit_log(NULL, GFP_KERNEL, AUDIT_CONFIG_CHANGE,\n\t\t\"audit_backlog_limit=%d old=%d by auid=%u res=%d\",\n\t\tlimit, old, loginuid, res);\n\n\t/* If we are allowed, make the change */\n\tif (res == 1)\n\t\taudit_backlog_limit = limit;\n\t/* Not allowed, update reason */\n\telse if (rc == 0)\n\t\trc = -EPERM;\n\treturn rc;\n}\n\nstatic int audit_set_enabled(int state, uid_t loginuid, u32 sid)\n{\n\tint res, rc = 0, old = audit_enabled;\n\n\tif (state < 0 || state > 2)\n\t\treturn -EINVAL;\n\n\t/* check if we are locked */\n\tif (audit_enabled == 2)\n\t\tres = 0;\n\telse\n\t\tres = 1;\n\n\tif (sid) {\n\t\tchar *ctx = NULL;\n\t\tu32 len;\n\t\tif ((rc = selinux_sid_to_string(sid, &ctx, &len)) == 0) {\n\t\t\taudit_log(NULL, GFP_KERNEL, AUDIT_CONFIG_CHANGE,\n\t\t\t\t\"audit_enabled=%d old=%d by auid=%u\"\n\t\t\t\t\" subj=%s res=%d\",\n\t\t\t\tstate, old, loginuid, ctx, res);\n\t\t\tkfree(ctx);\n\t\t} else\n\t\t\tres = 0; /* Something weird, deny request */\n\t}\n\taudit_log(NULL, GFP_KERNEL, AUDIT_CONFIG_CHANGE,\n\t\t\"audit_enabled=%d old=%d by auid=%u res=%d\",\n\t\tstate, old, loginuid, res);\n\n\t/* If we are allowed, make the change */\n\tif (res == 1)\n\t\taudit_enabled = state;\n\t/* Not allowed, update reason */\n\telse if (rc == 0)\n\t\trc = -EPERM;\n\treturn rc;\n}\n\nstatic int audit_set_failure(int state, uid_t loginuid, u32 sid)\n{\n\tint res, rc = 0, old = audit_failure;\n\n\tif (state != AUDIT_FAIL_SILENT\n\t && state != AUDIT_FAIL_PRINTK\n\t && state != AUDIT_FAIL_PANIC)\n\t\treturn -EINVAL;\n\n\t/* check if we are locked */\n\tif (audit_enabled == 2)\n\t\tres = 0;\n\telse\n\t\tres = 1;\n\n\tif (sid) {\n\t\tchar *ctx = NULL;\n\t\tu32 len;\n\t\tif ((rc = selinux_sid_to_string(sid, &ctx, &len)) == 0) {\n\t\t\taudit_log(NULL, GFP_KERNEL, AUDIT_CONFIG_CHANGE,\n\t\t\t\t\"audit_failure=%d old=%d by auid=%u\"\n\t\t\t\t\" subj=%s res=%d\",\n\t\t\t\tstate, old, loginuid, ctx, res);\n\t\t\tkfree(ctx);\n\t\t} else\n\t\t\tres = 0; /* Something weird, deny request */\n\t}\n\taudit_log(NULL, GFP_KERNEL, AUDIT_CONFIG_CHANGE,\n\t\t\"audit_failure=%d old=%d by auid=%u res=%d\",\n\t\tstate, old, loginuid, res);\n\n\t/* If we are allowed, make the change */\n\tif (res == 1)\n\t\taudit_failure = state;\n\t/* Not allowed, update reason */\n\telse if (rc == 0)\n\t\trc = -EPERM;\n\treturn rc;\n}\n\nstatic int kauditd_thread(void *dummy)\n{\n\tstruct sk_buff *skb;\n\n\twhile (!kthread_should_stop()) {\n\t\tskb = skb_dequeue(&audit_skb_queue);\n\t\twake_up(&audit_backlog_wait);\n\t\tif (skb) {\n\t\t\tif (audit_pid) {\n\t\t\t\tint err = netlink_unicast(audit_sock, skb, audit_pid, 0);\n\t\t\t\tif (err < 0) {\n\t\t\t\t\tBUG_ON(err != -ECONNREFUSED); /* Shoudn't happen */\n\t\t\t\t\tprintk(KERN_ERR \"audit: *NO* daemon at audit_pid=%d\\n\", audit_pid);\n\t\t\t\t\taudit_pid = 0;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tprintk(KERN_NOTICE \"%s\\n\", skb->data + NLMSG_SPACE(0));\n\t\t\t\tkfree_skb(skb);\n\t\t\t}\n\t\t} else {\n\t\t\tDECLARE_WAITQUEUE(wait, current);\n\t\t\tset_current_state(TASK_INTERRUPTIBLE);\n\t\t\tadd_wait_queue(&kauditd_wait, &wait);\n\n\t\t\tif (!skb_queue_len(&audit_skb_queue)) {\n\t\t\t\ttry_to_freeze();\n\t\t\t\tschedule();\n\t\t\t}\n\n\t\t\t__set_current_state(TASK_RUNNING);\n\t\t\tremove_wait_queue(&kauditd_wait, &wait);\n\t\t}\n\t}\n\treturn 0;\n}\n\nint audit_send_list(void *_dest)\n{\n\tstruct audit_netlink_list *dest = _dest;\n\tint pid = dest->pid;\n\tstruct sk_buff *skb;\n\n\t/* wait for parent to finish and send an ACK */\n\tmutex_lock(&audit_cmd_mutex);\n\tmutex_unlock(&audit_cmd_mutex);\n\n\twhile ((skb = __skb_dequeue(&dest->q)) != NULL)\n\t\tnetlink_unicast(audit_sock, skb, pid, 0);\n\n\tkfree(dest);\n\n\treturn 0;\n}\n\nstruct sk_buff *audit_make_reply(int pid, int seq, int type, int done,\n\t\t\t\t int multi, void *payload, int size)\n{\n\tstruct sk_buff\t*skb;\n\tstruct nlmsghdr\t*nlh;\n\tint\t\tlen = NLMSG_SPACE(size);\n\tvoid\t\t*data;\n\tint\t\tflags = multi ? NLM_F_MULTI : 0;\n\tint\t\tt = done ? NLMSG_DONE : type;\n\n\tskb = alloc_skb(len, GFP_KERNEL);\n\tif (!skb)\n\t\treturn NULL;\n\n\tnlh\t\t = NLMSG_PUT(skb, pid, seq, t, size);\n\tnlh->nlmsg_flags = flags;\n\tdata\t\t = NLMSG_DATA(nlh);\n\tmemcpy(data, payload, size);\n\treturn skb;\n\nnlmsg_failure:\t\t\t/* Used by NLMSG_PUT */\n\tif (skb)\n\t\tkfree_skb(skb);\n\treturn NULL;\n}\n\n/**\n * audit_send_reply - send an audit reply message via netlink\n * @pid: process id to send reply to\n * @seq: sequence number\n * @type: audit message type\n * @done: done (last) flag\n * @multi: multi-part message flag\n * @payload: payload data\n * @size: payload size\n *\n * Allocates an skb, builds the netlink message, and sends it to the pid.\n * No failure notifications.\n */\nvoid audit_send_reply(int pid, int seq, int type, int done, int multi,\n\t\t void *payload, int size)\n{\n\tstruct sk_buff\t*skb;\n\tskb = audit_make_reply(pid, seq, type, done, multi, payload, size);\n\tif (!skb)\n\t\treturn;\n\t/* Ignore failure. It'll only happen if the sender goes away,\n\t because our timeout is set to infinite. */\n\tnetlink_unicast(audit_sock, skb, pid, 0);\n\treturn;\n}\n\n/*\n * Check for appropriate CAP_AUDIT_ capabilities on incoming audit\n * control messages.\n */\nstatic int audit_netlink_ok(struct sk_buff *skb, u16 msg_type)\n{\n\tint err = 0;\n\n\tswitch (msg_type) {\n\tcase AUDIT_GET:\n\tcase AUDIT_LIST:\n\tcase AUDIT_LIST_RULES:\n\tcase AUDIT_SET:\n\tcase AUDIT_ADD:\n\tcase AUDIT_ADD_RULE:\n\tcase AUDIT_DEL:\n\tcase AUDIT_DEL_RULE:\n\tcase AUDIT_SIGNAL_INFO:\n\t\tif (security_netlink_recv(skb, CAP_AUDIT_CONTROL))\n\t\t\terr = -EPERM;\n\t\tbreak;\n\tcase AUDIT_USER:\n\tcase AUDIT_FIRST_USER_MSG ... AUDIT_LAST_USER_MSG:\n\tcase AUDIT_FIRST_USER_MSG2 ... AUDIT_LAST_USER_MSG2:\n\t\tif (security_netlink_recv(skb, CAP_AUDIT_WRITE))\n\t\t\terr = -EPERM;\n\t\tbreak;\n\tdefault: /* bad msg */\n\t\terr = -EINVAL;\n\t}\n\n\treturn err;\n}\n\nstatic int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)\n{\n\tu32\t\t\tuid, pid, seq, sid;\n\tvoid\t\t\t*data;\n\tstruct audit_status\t*status_get, status_set;\n\tint\t\t\terr;\n\tstruct audit_buffer\t*ab;\n\tu16\t\t\tmsg_type = nlh->nlmsg_type;\n\tuid_t\t\t\tloginuid; /* loginuid of sender */\n\tstruct audit_sig_info *sig_data;\n\tchar\t\t\t*ctx;\n\tu32\t\t\tlen;\n\n\terr = audit_netlink_ok(skb, msg_type);\n\tif (err)\n\t\treturn err;\n\n\t/* As soon as there's any sign of userspace auditd,\n\t * start kauditd to talk to it */\n\tif (!kauditd_task)\n\t\tkauditd_task = kthread_run(kauditd_thread, NULL, \"kauditd\");\n\tif (IS_ERR(kauditd_task)) {\n\t\terr = PTR_ERR(kauditd_task);\n\t\tkauditd_task = NULL;\n\t\treturn err;\n\t}\n\n\tpid = NETLINK_CREDS(skb)->pid;\n\tuid = NETLINK_CREDS(skb)->uid;\n\tloginuid = NETLINK_CB(skb).loginuid;\n\tsid = NETLINK_CB(skb).sid;\n\tseq = nlh->nlmsg_seq;\n\tdata = NLMSG_DATA(nlh);\n\n\tswitch (msg_type) {\n\tcase AUDIT_GET:\n\t\tstatus_set.enabled\t = audit_enabled;\n\t\tstatus_set.failure\t = audit_failure;\n\t\tstatus_set.pid\t\t = audit_pid;\n\t\tstatus_set.rate_limit\t = audit_rate_limit;\n\t\tstatus_set.backlog_limit = audit_backlog_limit;\n\t\tstatus_set.lost\t\t = atomic_read(&audit_lost);\n\t\tstatus_set.backlog\t = skb_queue_len(&audit_skb_queue);\n\t\taudit_send_reply(NETLINK_CB(skb).pid, seq, AUDIT_GET, 0, 0,\n\t\t\t\t &status_set, sizeof(status_set));\n\t\tbreak;\n\tcase AUDIT_SET:\n\t\tif (nlh->nlmsg_len < sizeof(struct audit_status))\n\t\t\treturn -EINVAL;\n\t\tstatus_get = (struct audit_status *)data;\n\t\tif (status_get->mask & AUDIT_STATUS_ENABLED) {\n\t\t\terr = audit_set_enabled(status_get->enabled,\n\t\t\t\t\t\t\tloginuid, sid);\n\t\t\tif (err < 0) return err;\n\t\t}\n\t\tif (status_get->mask & AUDIT_STATUS_FAILURE) {\n\t\t\terr = audit_set_failure(status_get->failure,\n\t\t\t\t\t\t\t loginuid, sid);\n\t\t\tif (err < 0) return err;\n\t\t}\n\t\tif (status_get->mask & AUDIT_STATUS_PID) {\n\t\t\tint old = audit_pid;\n\t\t\tif (sid) {\n\t\t\t\tif ((err = selinux_sid_to_string(\n\t\t\t\t\t\tsid, &ctx, &len)))\n\t\t\t\t\treturn err;\n\t\t\t\telse\n\t\t\t\t\taudit_log(NULL, GFP_KERNEL,\n\t\t\t\t\t\tAUDIT_CONFIG_CHANGE,\n\t\t\t\t\t\t\"audit_pid=%d old=%d by auid=%u subj=%s\",\n\t\t\t\t\t\tstatus_get->pid, old,\n\t\t\t\t\t\tloginuid, ctx);\n\t\t\t\tkfree(ctx);\n\t\t\t} else\n\t\t\t\taudit_log(NULL, GFP_KERNEL, AUDIT_CONFIG_CHANGE,\n\t\t\t\t\t\"audit_pid=%d old=%d by auid=%u\",\n\t\t\t\t\t status_get->pid, old, loginuid);\n\t\t\taudit_pid = status_get->pid;\n\t\t}\n\t\tif (status_get->mask & AUDIT_STATUS_RATE_LIMIT)\n\t\t\terr = audit_set_rate_limit(status_get->rate_limit,\n\t\t\t\t\t\t\t loginuid, sid);\n\t\tif (status_get->mask & AUDIT_STATUS_BACKLOG_LIMIT)\n\t\t\terr = audit_set_backlog_limit(status_get->backlog_limit,\n\t\t\t\t\t\t\tloginuid, sid);\n\t\tbreak;\n\tcase AUDIT_USER:\n\tcase AUDIT_FIRST_USER_MSG ... AUDIT_LAST_USER_MSG:\n\tcase AUDIT_FIRST_USER_MSG2 ... AUDIT_LAST_USER_MSG2:\n\t\tif (!audit_enabled && msg_type != AUDIT_USER_AVC)\n\t\t\treturn 0;\n\n\t\terr = audit_filter_user(&NETLINK_CB(skb), msg_type);\n\t\tif (err == 1) {\n\t\t\terr = 0;\n\t\t\tab = audit_log_start(NULL, GFP_KERNEL, msg_type);\n\t\t\tif (ab) {\n\t\t\t\taudit_log_format(ab,\n\t\t\t\t\t\t \"user pid=%d uid=%u auid=%u\",\n\t\t\t\t\t\t pid, uid, loginuid);\n\t\t\t\tif (sid) {\n\t\t\t\t\tif (selinux_sid_to_string(\n\t\t\t\t\t\t\tsid, &ctx, &len)) {\n\t\t\t\t\t\taudit_log_format(ab, \n\t\t\t\t\t\t\t\" ssid=%u\", sid);\n\t\t\t\t\t\t/* Maybe call audit_panic? */\n\t\t\t\t\t} else\n\t\t\t\t\t\taudit_log_format(ab, \n\t\t\t\t\t\t\t\" subj=%s\", ctx);\n\t\t\t\t\tkfree(ctx);\n\t\t\t\t}\n\t\t\t\taudit_log_format(ab, \" msg='%.1024s'\",\n\t\t\t\t\t (char *)data);\n\t\t\t\taudit_set_pid(ab, pid);\n\t\t\t\taudit_log_end(ab);\n\t\t\t}\n\t\t}\n\t\tbreak;\n\tcase AUDIT_ADD:\n\tcase AUDIT_DEL:\n\t\tif (nlmsg_len(nlh) < sizeof(struct audit_rule))\n\t\t\treturn -EINVAL;\n\t\tif (audit_enabled == 2) {\n\t\t\tab = audit_log_start(NULL, GFP_KERNEL,\n\t\t\t\t\tAUDIT_CONFIG_CHANGE);\n\t\t\tif (ab) {\n\t\t\t\taudit_log_format(ab,\n\t\t\t\t\t\t \"pid=%d uid=%u auid=%u\",\n\t\t\t\t\t\t pid, uid, loginuid);\n\t\t\t\tif (sid) {\n\t\t\t\t\tif (selinux_sid_to_string(\n\t\t\t\t\t\t\tsid, &ctx, &len)) {\n\t\t\t\t\t\taudit_log_format(ab,\n\t\t\t\t\t\t\t\" ssid=%u\", sid);\n\t\t\t\t\t\t/* Maybe call audit_panic? */\n\t\t\t\t\t} else\n\t\t\t\t\t\taudit_log_format(ab,\n\t\t\t\t\t\t\t\" subj=%s\", ctx);\n\t\t\t\t\tkfree(ctx);\n\t\t\t\t}\n\t\t\t\taudit_log_format(ab, \" audit_enabled=%d res=0\",\n\t\t\t\t\taudit_enabled);\n\t\t\t\taudit_log_end(ab);\n\t\t\t}\n\t\t\treturn -EPERM;\n\t\t}\n\t\t/* fallthrough */\n\tcase AUDIT_LIST:\n\t\terr = audit_receive_filter(nlh->nlmsg_type, NETLINK_CB(skb).pid,\n\t\t\t\t\t uid, seq, data, nlmsg_len(nlh),\n\t\t\t\t\t loginuid, sid);\n\t\tbreak;\n\tcase AUDIT_ADD_RULE:\n\tcase AUDIT_DEL_RULE:\n\t\tif (nlmsg_len(nlh) < sizeof(struct audit_rule_data))\n\t\t\treturn -EINVAL;\n\t\tif (audit_enabled == 2) {\n\t\t\tab = audit_log_start(NULL, GFP_KERNEL,\n\t\t\t\t\tAUDIT_CONFIG_CHANGE);\n\t\t\tif (ab) {\n\t\t\t\taudit_log_format(ab,\n\t\t\t\t\t\t \"pid=%d uid=%u auid=%u\",\n\t\t\t\t\t\t pid, uid, loginuid);\n\t\t\t\tif (sid) {\n\t\t\t\t\tif (selinux_sid_to_string(\n\t\t\t\t\t\t\tsid, &ctx, &len)) {\n\t\t\t\t\t\taudit_log_format(ab,\n\t\t\t\t\t\t\t\" ssid=%u\", sid);\n\t\t\t\t\t\t/* Maybe call audit_panic? */\n\t\t\t\t\t} else\n\t\t\t\t\t\taudit_log_format(ab,\n\t\t\t\t\t\t\t\" subj=%s\", ctx);\n\t\t\t\t\tkfree(ctx);\n\t\t\t\t}\n\t\t\t\taudit_log_format(ab, \" audit_enabled=%d res=0\",\n\t\t\t\t\taudit_enabled);\n\t\t\t\taudit_log_end(ab);\n\t\t\t}\n\t\t\treturn -EPERM;\n\t\t}\n\t\t/* fallthrough */\n\tcase AUDIT_LIST_RULES:\n\t\terr = audit_receive_filter(nlh->nlmsg_type, NETLINK_CB(skb).pid,\n\t\t\t\t\t uid, seq, data, nlmsg_len(nlh),\n\t\t\t\t\t loginuid, sid);\n\t\tbreak;\n\tcase AUDIT_SIGNAL_INFO:\n\t\terr = selinux_sid_to_string(audit_sig_sid, &ctx, &len);\n\t\tif (err)\n\t\t\treturn err;\n\t\tsig_data = kmalloc(sizeof(*sig_data) + len, GFP_KERNEL);\n\t\tif (!sig_data) {\n\t\t\tkfree(ctx);\n\t\t\treturn -ENOMEM;\n\t\t}\n\t\tsig_data->uid = audit_sig_uid;\n\t\tsig_data->pid = audit_sig_pid;\n\t\tmemcpy(sig_data->ctx, ctx, len);\n\t\tkfree(ctx);\n\t\taudit_send_reply(NETLINK_CB(skb).pid, seq, AUDIT_SIGNAL_INFO, \n\t\t\t\t0, 0, sig_data, sizeof(*sig_data) + len);\n\t\tkfree(sig_data);\n\t\tbreak;\n\tdefault:\n\t\terr = -EINVAL;\n\t\tbreak;\n\t}\n\n\treturn err < 0 ? err : 0;\n}\n\n/*\n * Get message from skb (based on rtnetlink_rcv_skb). Each message is\n * processed by audit_receive_msg. Malformed skbs with wrong length are\n * discarded silently.\n */\nstatic void audit_receive_skb(struct sk_buff *skb)\n{\n\tint\t\terr;\n\tstruct nlmsghdr\t*nlh;\n\tu32\t\trlen;\n\n\twhile (skb->len >= NLMSG_SPACE(0)) {\n\t\tnlh = nlmsg_hdr(skb);\n\t\tif (nlh->nlmsg_len < sizeof(*nlh) || skb->len < nlh->nlmsg_len)\n\t\t\treturn;\n\t\trlen = NLMSG_ALIGN(nlh->nlmsg_len);\n\t\tif (rlen > skb->len)\n\t\t\trlen = skb->len;\n\t\tif ((err = audit_receive_msg(skb, nlh))) {\n\t\t\tnetlink_ack(skb, nlh, err);\n\t\t} else if (nlh->nlmsg_flags & NLM_F_ACK)\n\t\t\tnetlink_ack(skb, nlh, 0);\n\t\tskb_pull(skb, rlen);\n\t}\n}\n\n/* Receive messages from netlink socket. */\nstatic void audit_receive(struct sock *sk, int length)\n{\n\tstruct sk_buff *skb;\n\tunsigned int qlen;\n\n\tmutex_lock(&audit_cmd_mutex);\n\n\tfor (qlen = skb_queue_len(&sk->sk_receive_queue); qlen; qlen--) {\n\t\tskb = skb_dequeue(&sk->sk_receive_queue);\n\t\taudit_receive_skb(skb);\n\t\tkfree_skb(skb);\n\t}\n\tmutex_unlock(&audit_cmd_mutex);\n}\n\n#ifdef CONFIG_AUDITSYSCALL\nstatic const struct inotify_operations audit_inotify_ops = {\n\t.handle_event\t= audit_handle_ievent,\n\t.destroy_watch\t= audit_free_parent,\n};\n#endif\n\n/* Initialize audit support at boot time. */\nstatic int __init audit_init(void)\n{\n\tint i;\n\n\tprintk(KERN_INFO \"audit: initializing netlink socket (%s)\\n\",\n\t audit_default ? \"enabled\" : \"disabled\");\n\taudit_sock = netlink_kernel_create(NETLINK_AUDIT, 0, audit_receive,\n\t\t\t\t\t NULL, THIS_MODULE);\n\tif (!audit_sock)\n\t\taudit_panic(\"cannot initialize netlink socket\");\n\telse\n\t\taudit_sock->sk_sndtimeo = MAX_SCHEDULE_TIMEOUT;\n\n\tskb_queue_head_init(&audit_skb_queue);\n\taudit_initialized = 1;\n\taudit_enabled = audit_default;\n\n\t/* Register the callback with selinux. This callback will be invoked\n\t * when a new policy is loaded. */\n\tselinux_audit_set_callback(&selinux_audit_rule_update);\n\n\taudit_log(NULL, GFP_KERNEL, AUDIT_KERNEL, \"initialized\");\n\n#ifdef CONFIG_AUDITSYSCALL\n\taudit_ih = inotify_init(&audit_inotify_ops);\n\tif (IS_ERR(audit_ih))\n\t\taudit_panic(\"cannot initialize inotify handle\");\n#endif\n\n\tfor (i = 0; i < AUDIT_INODE_BUCKETS; i++)\n\t\tINIT_LIST_HEAD(&audit_inode_hash[i]);\n\n\treturn 0;\n}\n__initcall(audit_init);\n\n/* Process kernel command-line parameter at boot time. audit=0 or audit=1. */\nstatic int __init audit_enable(char *str)\n{\n\taudit_default = !!simple_strtol(str, NULL, 0);\n\tprintk(KERN_INFO \"audit: %s%s\\n\",\n\t audit_default ? \"enabled\" : \"disabled\",\n\t audit_initialized ? \"\" : \" (after initialization)\");\n\tif (audit_initialized)\n\t\taudit_enabled = audit_default;\n\treturn 1;\n}\n\n__setup(\"audit=\", audit_enable);\n\nstatic void audit_buffer_free(struct audit_buffer *ab)\n{\n\tunsigned long flags;\n\n\tif (!ab)\n\t\treturn;\n\n\tif (ab->skb)\n\t\tkfree_skb(ab->skb);\n\n\tspin_lock_irqsave(&audit_freelist_lock, flags);\n\tif (audit_freelist_count > AUDIT_MAXFREE)\n\t\tkfree(ab);\n\telse {\n\t\taudit_freelist_count++;\n\t\tlist_add(&ab->list, &audit_freelist);\n\t}\n\tspin_unlock_irqrestore(&audit_freelist_lock, flags);\n}\n\nstatic struct audit_buffer * audit_buffer_alloc(struct audit_context *ctx,\n\t\t\t\t\t\tgfp_t gfp_mask, int type)\n{\n\tunsigned long flags;\n\tstruct audit_buffer *ab = NULL;\n\tstruct nlmsghdr *nlh;\n\n\tspin_lock_irqsave(&audit_freelist_lock, flags);\n\tif (!list_empty(&audit_freelist)) {\n\t\tab = list_entry(audit_freelist.next,\n\t\t\t\tstruct audit_buffer, list);\n\t\tlist_del(&ab->list);\n\t\t--audit_freelist_count;\n\t}\n\tspin_unlock_irqrestore(&audit_freelist_lock, flags);\n\n\tif (!ab) {\n\t\tab = kmalloc(sizeof(*ab), gfp_mask);\n\t\tif (!ab)\n\t\t\tgoto err;\n\t}\n\n\tab->skb = alloc_skb(AUDIT_BUFSIZ, gfp_mask);\n\tif (!ab->skb)\n\t\tgoto err;\n\n\tab->ctx = ctx;\n\tab->gfp_mask = gfp_mask;\n\tnlh = (struct nlmsghdr *)skb_put(ab->skb, NLMSG_SPACE(0));\n\tnlh->nlmsg_type = type;\n\tnlh->nlmsg_flags = 0;\n\tnlh->nlmsg_pid = 0;\n\tnlh->nlmsg_seq = 0;\n\treturn ab;\nerr:\n\taudit_buffer_free(ab);\n\treturn NULL;\n}\n\n/**\n * audit_serial - compute a serial number for the audit record\n *\n * Compute a serial number for the audit record. Audit records are\n * written to user-space as soon as they are generated, so a complete\n * audit record may be written in several pieces. The timestamp of the\n * record and this serial number are used by the user-space tools to\n * determine which pieces belong to the same audit record. The\n * (timestamp,serial) tuple is unique for each syscall and is live from\n * syscall entry to syscall exit.\n *\n * NOTE: Another possibility is to store the formatted records off the\n * audit context (for those records that have a context), and emit them\n * all at syscall exit. However, this could delay the reporting of\n * significant errors until syscall exit (or never, if the system\n * halts).\n */\nunsigned int audit_serial(void)\n{\n\tstatic DEFINE_SPINLOCK(serial_lock);\n\tstatic unsigned int serial = 0;\n\n\tunsigned long flags;\n\tunsigned int ret;\n\n\tspin_lock_irqsave(&serial_lock, flags);\n\tdo {\n\t\tret = ++serial;\n\t} while (unlikely(!ret));\n\tspin_unlock_irqrestore(&serial_lock, flags);\n\n\treturn ret;\n}\n\nstatic inline void audit_get_stamp(struct audit_context *ctx, \n\t\t\t\t struct timespec *t, unsigned int *serial)\n{\n\tif (ctx)\n\t\tauditsc_get_stamp(ctx, t, serial);\n\telse {\n\t\t*t = CURRENT_TIME;\n\t\t*serial = audit_serial();\n\t}\n}\n\n/* Obtain an audit buffer. This routine does locking to obtain the\n * audit buffer, but then no locking is required for calls to\n * audit_log_*format. If the tsk is a task that is currently in a\n * syscall, then the syscall is marked as auditable and an audit record\n * will be written at syscall exit. If there is no associated task, tsk\n * should be NULL. */\n\n/**\n * audit_log_start - obtain an audit buffer\n * @ctx: audit_context (may be NULL)\n * @gfp_mask: type of allocation\n * @type: audit message type\n *\n * Returns audit_buffer pointer on success or NULL on error.\n *\n * Obtain an audit buffer. This routine does locking to obtain the\n * audit buffer, but then no locking is required for calls to\n * audit_log_*format. If the task (ctx) is a task that is currently in a\n * syscall, then the syscall is marked as auditable and an audit record\n * will be written at syscall exit. If there is no associated task, then\n * task context (ctx) should be NULL.\n */\nstruct audit_buffer *audit_log_start(struct audit_context *ctx, gfp_t gfp_mask,\n\t\t\t\t int type)\n{\n\tstruct audit_buffer\t*ab\t= NULL;\n\tstruct timespec\t\tt;\n\tunsigned int\t\tserial;\n\tint reserve;\n\tunsigned long timeout_start = jiffies;\n\n\tif (!audit_initialized)\n\t\treturn NULL;\n\n\tif (unlikely(audit_filter_type(type)))\n\t\treturn NULL;\n\n\tif (gfp_mask & __GFP_WAIT)\n\t\treserve = 0;\n\telse\n\t\treserve = 5; /* Allow atomic callers to go up to five \n\t\t\t\tentries over the normal backlog limit */\n\n\twhile (audit_backlog_limit\n\t && skb_queue_len(&audit_skb_queue) > audit_backlog_limit + reserve) {\n\t\tif (gfp_mask & __GFP_WAIT && audit_backlog_wait_time\n\t\t && time_before(jiffies, timeout_start + audit_backlog_wait_time)) {\n\n\t\t\t/* Wait for auditd to drain the queue a little */\n\t\t\tDECLARE_WAITQUEUE(wait, current);\n\t\t\tset_current_state(TASK_INTERRUPTIBLE);\n\t\t\tadd_wait_queue(&audit_backlog_wait, &wait);\n\n\t\t\tif (audit_backlog_limit &&\n\t\t\t skb_queue_len(&audit_skb_queue) > audit_backlog_limit)\n\t\t\t\tschedule_timeout(timeout_start + audit_backlog_wait_time - jiffies);\n\n\t\t\t__set_current_state(TASK_RUNNING);\n\t\t\tremove_wait_queue(&audit_backlog_wait, &wait);\n\t\t\tcontinue;\n\t\t}\n\t\tif (audit_rate_check())\n\t\t\tprintk(KERN_WARNING\n\t\t\t \"audit: audit_backlog=%d > \"\n\t\t\t \"audit_backlog_limit=%d\\n\",\n\t\t\t skb_queue_len(&audit_skb_queue),\n\t\t\t audit_backlog_limit);\n\t\taudit_log_lost(\"backlog limit exceeded\");\n\t\taudit_backlog_wait_time = audit_backlog_wait_overflow;\n\t\twake_up(&audit_backlog_wait);\n\t\treturn NULL;\n\t}\n\n\tab = audit_buffer_alloc(ctx, gfp_mask, type);\n\tif (!ab) {\n\t\taudit_log_lost(\"out of memory in audit_log_start\");\n\t\treturn NULL;\n\t}\n\n\taudit_get_stamp(ab->ctx, &t, &serial);\n\n\taudit_log_format(ab, \"audit(%lu.%03lu:%u): \",\n\t\t\t t.tv_sec, t.tv_nsec/1000000, serial);\n\treturn ab;\n}\n\n/**\n * audit_expand - expand skb in the audit buffer\n * @ab: audit_buffer\n * @extra: space to add at tail of the skb\n *\n * Returns 0 (no space) on failed expansion, or available space if\n * successful.\n */\nstatic inline int audit_expand(struct audit_buffer *ab, int extra)\n{\n\tstruct sk_buff *skb = ab->skb;\n\tint ret = pskb_expand_head(skb, skb_headroom(skb), extra,\n\t\t\t\t ab->gfp_mask);\n\tif (ret < 0) {\n\t\taudit_log_lost(\"out of memory in audit_expand\");\n\t\treturn 0;\n\t}\n\treturn skb_tailroom(skb);\n}\n\n/*\n * Format an audit message into the audit buffer. If there isn't enough\n * room in the audit buffer, more room will be allocated and vsnprint\n * will be called a second time. Currently, we assume that a printk\n * can't format message larger than 1024 bytes, so we don't either.\n */\nvoid audit_log_vformat(struct audit_buffer *ab, const char *fmt, va_list args)\n{\n\tint len, avail;\n\tstruct sk_buff *skb;\n\tva_list args2;\n\n\tif (!ab)\n\t\treturn;\n\n\tBUG_ON(!ab->skb);\n\tskb = ab->skb;\n\tavail = skb_tailroom(skb);\n\tif (avail == 0) {\n\t\tavail = audit_expand(ab, AUDIT_BUFSIZ);\n\t\tif (!avail)\n\t\t\tgoto out;\n\t}\n\tva_copy(args2, args);\n\tlen = vsnprintf(skb_tail_pointer(skb), avail, fmt, args);\n\tif (len >= avail) {\n\t\t/* The printk buffer is 1024 bytes long, so if we get\n\t\t * here and AUDIT_BUFSIZ is at least 1024, then we can\n\t\t * log everything that printk could have logged. */\n\t\tavail = audit_expand(ab,\n\t\t\tmax_t(unsigned, AUDIT_BUFSIZ, 1+len-avail));\n\t\tif (!avail)\n\t\t\tgoto out;\n\t\tlen = vsnprintf(skb_tail_pointer(skb), avail, fmt, args2);\n\t}\n\tif (len > 0)\n\t\tskb_put(skb, len);\nout:\n\treturn;\n}\n\n/**\n * audit_log_format - format a message into the audit buffer.\n * @ab: audit_buffer\n * @fmt: format string\n * @...: optional parameters matching @fmt string\n *\n * All the work is done in audit_log_vformat.\n */\nvoid audit_log_format(struct audit_buffer *ab, const char *fmt, ...)\n{\n\tva_list args;\n\n\tif (!ab)\n\t\treturn;\n\tva_start(args, fmt);\n\taudit_log_vformat(ab, fmt, args);\n\tva_end(args);\n}\n\n/**\n * audit_log_hex - convert a buffer to hex and append it to the audit skb\n * @ab: the audit_buffer\n * @buf: buffer to convert to hex\n * @len: length of @buf to be converted\n *\n * No return value; failure to expand is silently ignored.\n *\n * This function will take the passed buf and convert it into a string of\n * ascii hex digits. The new string is placed onto the skb.\n */\nvoid audit_log_hex(struct audit_buffer *ab, const unsigned char *buf,\n\t\tsize_t len)\n{\n\tint i, avail, new_len;\n\tunsigned char *ptr;\n\tstruct sk_buff *skb;\n\tstatic const unsigned char *hex = \"0123456789ABCDEF\";\n\n\tif (!ab)\n\t\treturn;\n\n\tBUG_ON(!ab->skb);\n\tskb = ab->skb;\n\tavail = skb_tailroom(skb);\n\tnew_len = len<<1;\n\tif (new_len >= avail) {\n\t\t/* Round the buffer request up to the next multiple */\n\t\tnew_len = AUDIT_BUFSIZ*(((new_len-avail)/AUDIT_BUFSIZ) + 1);\n\t\tavail = audit_expand(ab, new_len);\n\t\tif (!avail)\n\t\t\treturn;\n\t}\n\n\tptr = skb_tail_pointer(skb);\n\tfor (i=0; i<len; i++) {\n\t\t*ptr++ = hex[(buf[i] & 0xF0)>>4]; /* Upper nibble */\n\t\t*ptr++ = hex[buf[i] & 0x0F];\t /* Lower nibble */\n\t}\n\t*ptr = 0;\n\tskb_put(skb, len << 1); /* new string is twice the old string */\n}\n\n/*\n * Format a string of no more than slen characters into the audit buffer,\n * enclosed in quote marks.\n */\nstatic void audit_log_n_string(struct audit_buffer *ab, size_t slen,\n\t\t\t const char *string)\n{\n\tint avail, new_len;\n\tunsigned char *ptr;\n\tstruct sk_buff *skb;\n\n\tif (!ab)\n\t\treturn;\n\n\tBUG_ON(!ab->skb);\n\tskb = ab->skb;\n\tavail = skb_tailroom(skb);\n\tnew_len = slen + 3;\t/* enclosing quotes + null terminator */\n\tif (new_len > avail) {\n\t\tavail = audit_expand(ab, new_len);\n\t\tif (!avail)\n\t\t\treturn;\n\t}\n\tptr = skb_tail_pointer(skb);\n\t*ptr++ = '\"';\n\tmemcpy(ptr, string, slen);\n\tptr += slen;\n\t*ptr++ = '\"';\n\t*ptr = 0;\n\tskb_put(skb, slen + 2);\t/* don't include null terminator */\n}\n\n/**\n * audit_log_n_unstrustedstring - log a string that may contain random characters\n * @ab: audit_buffer\n * @len: lenth of string (not including trailing null)\n * @string: string to be logged\n *\n * This code will escape a string that is passed to it if the string\n * contains a control character, unprintable character, double quote mark,\n * or a space. Unescaped strings will start and end with a double quote mark.\n * Strings that are escaped are printed in hex (2 digits per char).\n *\n * The caller specifies the number of characters in the string to log, which may\n * or may not be the entire string.\n */\nconst char *audit_log_n_untrustedstring(struct audit_buffer *ab, size_t len,\n\t\t\t\t\tconst char *string)\n{\n\tconst unsigned char *p = string;\n\n\twhile (*p) {\n\t\tif (*p == '\"' || *p < 0x21 || *p > 0x7f) {\n\t\t\taudit_log_hex(ab, string, len);\n\t\t\treturn string + len + 1;\n\t\t}\n\t\tp++;\n\t}\n\taudit_log_n_string(ab, len, string);\n\treturn p + 1;\n}\n\n/**\n * audit_log_unstrustedstring - log a string that may contain random characters\n * @ab: audit_buffer\n * @string: string to be logged\n *\n * Same as audit_log_n_unstrustedstring(), except that strlen is used to\n * determine string length.\n */\nconst char *audit_log_untrustedstring(struct audit_buffer *ab, const char *string)\n{\n\treturn audit_log_n_untrustedstring(ab, strlen(string), string);\n}\n\n/* This is a helper-function to print the escaped d_path */\nvoid audit_log_d_path(struct audit_buffer *ab, const char *prefix,\n\t\t struct dentry *dentry, struct vfsmount *vfsmnt)\n{\n\tchar *p, *path;\n\n\tif (prefix)\n\t\taudit_log_format(ab, \" %s\", prefix);\n\n\t/* We will allow 11 spaces for ' (deleted)' to be appended */\n\tpath = kmalloc(PATH_MAX+11, ab->gfp_mask);\n\tif (!path) {\n\t\taudit_log_format(ab, \"<no memory>\");\n\t\treturn;\n\t}\n\tp = d_path(dentry, vfsmnt, path, PATH_MAX+11);\n\tif (IS_ERR(p)) { /* Should never happen since we send PATH_MAX */\n\t\t/* FIXME: can we save some information here? */\n\t\taudit_log_format(ab, \"<too long>\");\n\t} else \n\t\taudit_log_untrustedstring(ab, p);\n\tkfree(path);\n}\n\n/**\n * audit_log_end - end one audit record\n * @ab: the audit_buffer\n *\n * The netlink_* functions cannot be called inside an irq context, so\n * the audit buffer is placed on a queue and a tasklet is scheduled to\n * remove them from the queue outside the irq context. May be called in\n * any context.\n */\nvoid audit_log_end(struct audit_buffer *ab)\n{\n\tif (!ab)\n\t\treturn;\n\tif (!audit_rate_check()) {\n\t\taudit_log_lost(\"rate limit exceeded\");\n\t} else {\n\t\tif (audit_pid) {\n\t\t\tstruct nlmsghdr *nlh = nlmsg_hdr(ab->skb);\n\t\t\tnlh->nlmsg_len = ab->skb->len - NLMSG_SPACE(0);\n\t\t\tskb_queue_tail(&audit_skb_queue, ab->skb);\n\t\t\tab->skb = NULL;\n\t\t\twake_up_interruptible(&kauditd_wait);\n\t\t} else {\n\t\t\tprintk(KERN_NOTICE \"%s\\n\", ab->skb->data + NLMSG_SPACE(0));\n\t\t}\n\t}\n\taudit_buffer_free(ab);\n}\n\n/**\n * audit_log - Log an audit record\n * @ctx: audit context\n * @gfp_mask: type of allocation\n * @type: audit message type\n * @fmt: format string to use\n * @...: variable parameters matching the format string\n *\n * This is a convenience function that calls audit_log_start,\n * audit_log_vformat, and audit_log_end. It may be called\n * in any context.\n */\nvoid audit_log(struct audit_context *ctx, gfp_t gfp_mask, int type, \n\t const char *fmt, ...)\n{\n\tstruct audit_buffer *ab;\n\tva_list args;\n\n\tab = audit_log_start(ctx, gfp_mask, type);\n\tif (ab) {\n\t\tva_start(args, fmt);\n\t\taudit_log_vformat(ab, fmt, args);\n\t\tva_end(args);\n\t\taudit_log_end(ab);\n\t}\n}\n\nEXPORT_SYMBOL(audit_log_start);\nEXPORT_SYMBOL(audit_log_end);\nEXPORT_SYMBOL(audit_log_format);\nEXPORT_SYMBOL(audit_log);\nEXPORT_SYMBOL_GPL(audit_log_vformat);\nEXPORT_SYMBOL_GPL(audit_log_untrustedstring);\nEXPORT_SYMBOL_GPL(audit_log_d_path);\n/* auditfilter.c -- filtering of audit events\n *\n * Copyright 2003-2004 Red Hat, Inc.\n * Copyright 2005 Hewlett-Packard Development Company, L.P.\n * Copyright 2005 IBM Corporation\n *\n * This program is free software; you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation; either version 2 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program; if not, write to the Free Software\n * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n */\n\n#include <linux/kernel.h>\n#include <linux/audit.h>\n#include <linux/kthread.h>\n#include <linux/mutex.h>\n#include <linux/fs.h>\n#include <linux/namei.h>\n#include <linux/netlink.h>\n#include <linux/sched.h>\n#include <linux/inotify.h>\n#include <linux/selinux.h>\n#include \"audit.h\"\n\n/*\n * Locking model:\n *\n * audit_filter_mutex:\n * \t\tSynchronizes writes and blocking reads of audit's filterlist\n * \t\tdata. Rcu is used to traverse the filterlist and access\n * \t\tcontents of structs audit_entry, audit_watch and opaque\n * \t\tselinux rules during filtering. If modified, these structures\n * \t\tmust be copied and replace their counterparts in the filterlist.\n * \t\tAn audit_parent struct is not accessed during filtering, so may\n * \t\tbe written directly provided audit_filter_mutex is held.\n */\n\n/*\n * Reference counting:\n *\n * audit_parent: lifetime is from audit_init_parent() to receipt of an IN_IGNORED\n * \tevent. Each audit_watch holds a reference to its associated parent.\n *\n * audit_watch: if added to lists, lifetime is from audit_init_watch() to\n * \taudit_remove_watch(). Additionally, an audit_watch may exist\n * \ttemporarily to assist in searching existing filter data. Each\n * \taudit_krule holds a reference to its associated watch.\n */\n\nstruct audit_parent {\n\tstruct list_head\tilist;\t/* entry in inotify registration list */\n\tstruct list_head\twatches; /* associated watches */\n\tstruct inotify_watch\twdata;\t/* inotify watch data */\n\tunsigned\t\tflags;\t/* status flags */\n};\n\n/*\n * audit_parent status flags:\n *\n * AUDIT_PARENT_INVALID - set anytime rules/watches are auto-removed due to\n * a filesystem event to ensure we're adding audit watches to a valid parent.\n * Technically not needed for IN_DELETE_SELF or IN_UNMOUNT events, as we cannot\n * receive them while we have nameidata, but must be used for IN_MOVE_SELF which\n * we can receive while holding nameidata.\n */\n#define AUDIT_PARENT_INVALID\t0x001\n\n/* Audit filter lists, defined in <linux/audit.h> */\nstruct list_head audit_filter_list[AUDIT_NR_FILTERS] = {\n\tLIST_HEAD_INIT(audit_filter_list[0]),\n\tLIST_HEAD_INIT(audit_filter_list[1]),\n\tLIST_HEAD_INIT(audit_filter_list[2]),\n\tLIST_HEAD_INIT(audit_filter_list[3]),\n\tLIST_HEAD_INIT(audit_filter_list[4]),\n\tLIST_HEAD_INIT(audit_filter_list[5]),\n#if AUDIT_NR_FILTERS != 6\n#error Fix audit_filter_list initialiser\n#endif\n};\n\nstatic DEFINE_MUTEX(audit_filter_mutex);\n\n/* Inotify handle */\nextern struct inotify_handle *audit_ih;\n\n/* Inotify events we care about. */\n#define AUDIT_IN_WATCH IN_MOVE|IN_CREATE|IN_DELETE|IN_DELETE_SELF|IN_MOVE_SELF\n\nvoid audit_free_parent(struct inotify_watch *i_watch)\n{\n\tstruct audit_parent *parent;\n\n\tparent = container_of(i_watch, struct audit_parent, wdata);\n\tWARN_ON(!list_empty(&parent->watches));\n\tkfree(parent);\n}\n\nstatic inline void audit_get_watch(struct audit_watch *watch)\n{\n\tatomic_inc(&watch->count);\n}\n\nstatic void audit_put_watch(struct audit_watch *watch)\n{\n\tif (atomic_dec_and_test(&watch->count)) {\n\t\tWARN_ON(watch->parent);\n\t\tWARN_ON(!list_empty(&watch->rules));\n\t\tkfree(watch->path);\n\t\tkfree(watch);\n\t}\n}\n\nstatic void audit_remove_watch(struct audit_watch *watch)\n{\n\tlist_del(&watch->wlist);\n\tput_inotify_watch(&watch->parent->wdata);\n\twatch->parent = NULL;\n\taudit_put_watch(watch); /* match initial get */\n}\n\nstatic inline void audit_free_rule(struct audit_entry *e)\n{\n\tint i;\n\n\t/* some rules don't have associated watches */\n\tif (e->rule.watch)\n\t\taudit_put_watch(e->rule.watch);\n\tif (e->rule.fields)\n\t\tfor (i = 0; i < e->rule.field_count; i++) {\n\t\t\tstruct audit_field *f = &e->rule.fields[i];\n\t\t\tkfree(f->se_str);\n\t\t\tselinux_audit_rule_free(f->se_rule);\n\t\t}\n\tkfree(e->rule.fields);\n\tkfree(e->rule.filterkey);\n\tkfree(e);\n}\n\nstatic inline void audit_free_rule_rcu(struct rcu_head *head)\n{\n\tstruct audit_entry *e = container_of(head, struct audit_entry, rcu);\n\taudit_free_rule(e);\n}\n\n/* Initialize a parent watch entry. */\nstatic struct audit_parent *audit_init_parent(struct nameidata *ndp)\n{\n\tstruct audit_parent *parent;\n\ts32 wd;\n\n\tparent = kzalloc(sizeof(*parent), GFP_KERNEL);\n\tif (unlikely(!parent))\n\t\treturn ERR_PTR(-ENOMEM);\n\n\tINIT_LIST_HEAD(&parent->watches);\n\tparent->flags = 0;\n\n\tinotify_init_watch(&parent->wdata);\n\t/* grab a ref so inotify watch hangs around until we take audit_filter_mutex */\n\tget_inotify_watch(&parent->wdata);\n\twd = inotify_add_watch(audit_ih, &parent->wdata, ndp->dentry->d_inode,\n\t\t\t AUDIT_IN_WATCH);\n\tif (wd < 0) {\n\t\taudit_free_parent(&parent->wdata);\n\t\treturn ERR_PTR(wd);\n\t}\n\n\treturn parent;\n}\n\n/* Initialize a watch entry. */\nstatic struct audit_watch *audit_init_watch(char *path)\n{\n\tstruct audit_watch *watch;\n\n\twatch = kzalloc(sizeof(*watch), GFP_KERNEL);\n\tif (unlikely(!watch))\n\t\treturn ERR_PTR(-ENOMEM);\n\n\tINIT_LIST_HEAD(&watch->rules);\n\tatomic_set(&watch->count, 1);\n\twatch->path = path;\n\twatch->dev = (dev_t)-1;\n\twatch->ino = (unsigned long)-1;\n\n\treturn watch;\n}\n\n/* Initialize an audit filterlist entry. */\nstatic inline struct audit_entry *audit_init_entry(u32 field_count)\n{\n\tstruct audit_entry *entry;\n\tstruct audit_field *fields;\n\n\tentry = kzalloc(sizeof(*entry), GFP_KERNEL);\n\tif (unlikely(!entry))\n\t\treturn NULL;\n\n\tfields = kzalloc(sizeof(*fields) * field_count, GFP_KERNEL);\n\tif (unlikely(!fields)) {\n\t\tkfree(entry);\n\t\treturn NULL;\n\t}\n\tentry->rule.fields = fields;\n\n\treturn entry;\n}\n\n/* Unpack a filter field's string representation from user-space\n * buffer. */\nstatic char *audit_unpack_string(void **bufp, size_t *remain, size_t len)\n{\n\tchar *str;\n\n\tif (!*bufp || (len == 0) || (len > *remain))\n\t\treturn ERR_PTR(-EINVAL);\n\n\t/* Of the currently implemented string fields, PATH_MAX\n\t * defines the longest valid length.\n\t */\n\tif (len > PATH_MAX)\n\t\treturn ERR_PTR(-ENAMETOOLONG);\n\n\tstr = kmalloc(len + 1, GFP_KERNEL);\n\tif (unlikely(!str))\n\t\treturn ERR_PTR(-ENOMEM);\n\n\tmemcpy(str, *bufp, len);\n\tstr[len] = 0;\n\t*bufp += len;\n\t*remain -= len;\n\n\treturn str;\n}\n\n/* Translate an inode field to kernel respresentation. */\nstatic inline int audit_to_inode(struct audit_krule *krule,\n\t\t\t\t struct audit_field *f)\n{\n\tif (krule->listnr != AUDIT_FILTER_EXIT ||\n\t krule->watch || krule->inode_f)\n\t\treturn -EINVAL;\n\n\tkrule->inode_f = f;\n\treturn 0;\n}\n\n/* Translate a watch string to kernel respresentation. */\nstatic int audit_to_watch(struct audit_krule *krule, char *path, int len,\n\t\t\t u32 op)\n{\n\tstruct audit_watch *watch;\n\n\tif (!audit_ih)\n\t\treturn -EOPNOTSUPP;\n\n\tif (path[0] != '/' || path[len-1] == '/' ||\n\t krule->listnr != AUDIT_FILTER_EXIT ||\n\t op & ~AUDIT_EQUAL ||\n\t krule->inode_f || krule->watch) /* 1 inode # per rule, for hash */\n\t\treturn -EINVAL;\n\n\twatch = audit_init_watch(path);\n\tif (unlikely(IS_ERR(watch)))\n\t\treturn PTR_ERR(watch);\n\n\taudit_get_watch(watch);\n\tkrule->watch = watch;\n\n\treturn 0;\n}\n\nstatic __u32 *classes[AUDIT_SYSCALL_CLASSES];\n\nint __init audit_register_class(int class, unsigned *list)\n{\n\t__u32 *p = kzalloc(AUDIT_BITMASK_SIZE * sizeof(__u32), GFP_KERNEL);\n\tif (!p)\n\t\treturn -ENOMEM;\n\twhile (*list != ~0U) {\n\t\tunsigned n = *list++;\n\t\tif (n >= AUDIT_BITMASK_SIZE * 32 - AUDIT_SYSCALL_CLASSES) {\n\t\t\tkfree(p);\n\t\t\treturn -EINVAL;\n\t\t}\n\t\tp[AUDIT_WORD(n)] |= AUDIT_BIT(n);\n\t}\n\tif (class >= AUDIT_SYSCALL_CLASSES || classes[class]) {\n\t\tkfree(p);\n\t\treturn -EINVAL;\n\t}\n\tclasses[class] = p;\n\treturn 0;\n}\n\nint audit_match_class(int class, unsigned syscall)\n{\n\tif (unlikely(syscall >= AUDIT_BITMASK_SIZE * sizeof(__u32)))\n\t\treturn 0;\n\tif (unlikely(class >= AUDIT_SYSCALL_CLASSES || !classes[class]))\n\t\treturn 0;\n\treturn classes[class][AUDIT_WORD(syscall)] & AUDIT_BIT(syscall);\n}\n\n#ifdef CONFIG_AUDITSYSCALL\nstatic inline int audit_match_class_bits(int class, u32 *mask)\n{\n\tint i;\n\n\tif (classes[class]) {\n\t\tfor (i = 0; i < AUDIT_BITMASK_SIZE; i++)\n\t\t\tif (mask[i] & classes[class][i])\n\t\t\t\treturn 0;\n\t}\n\treturn 1;\n}\n\nstatic int audit_match_signal(struct audit_entry *entry)\n{\n\tstruct audit_field *arch = entry->rule.arch_f;\n\n\tif (!arch) {\n\t\t/* When arch is unspecified, we must check both masks on biarch\n\t\t * as syscall number alone is ambiguous. */\n\t\treturn (audit_match_class_bits(AUDIT_CLASS_SIGNAL,\n\t\t\t\t\t entry->rule.mask) &&\n\t\t\taudit_match_class_bits(AUDIT_CLASS_SIGNAL_32,\n\t\t\t\t\t entry->rule.mask));\n\t}\n\n\tswitch(audit_classify_arch(arch->val)) {\n\tcase 0: /* native */\n\t\treturn (audit_match_class_bits(AUDIT_CLASS_SIGNAL,\n\t\t\t\t\t entry->rule.mask));\n\tcase 1: /* 32bit on biarch */\n\t\treturn (audit_match_class_bits(AUDIT_CLASS_SIGNAL_32,\n\t\t\t\t\t entry->rule.mask));\n\tdefault:\n\t\treturn 1;\n\t}\n}\n#endif\n\n/* Common user-space to kernel rule translation. */\nstatic inline struct audit_entry *audit_to_entry_common(struct audit_rule *rule)\n{\n\tunsigned listnr;\n\tstruct audit_entry *entry;\n\tint i, err;\n\n\terr = -EINVAL;\n\tlistnr = rule->flags & ~AUDIT_FILTER_PREPEND;\n\tswitch(listnr) {\n\tdefault:\n\t\tgoto exit_err;\n\tcase AUDIT_FILTER_USER:\n\tcase AUDIT_FILTER_TYPE:\n#ifdef CONFIG_AUDITSYSCALL\n\tcase AUDIT_FILTER_ENTRY:\n\tcase AUDIT_FILTER_EXIT:\n\tcase AUDIT_FILTER_TASK:\n#endif\n\t\t;\n\t}\n\tif (unlikely(rule->action == AUDIT_POSSIBLE)) {\n\t\tprintk(KERN_ERR \"AUDIT_POSSIBLE is deprecated\\n\");\n\t\tgoto exit_err;\n\t}\n\tif (rule->action != AUDIT_NEVER && rule->action != AUDIT_ALWAYS)\n\t\tgoto exit_err;\n\tif (rule->field_count > AUDIT_MAX_FIELDS)\n\t\tgoto exit_err;\n\n\terr = -ENOMEM;\n\tentry = audit_init_entry(rule->field_count);\n\tif (!entry)\n\t\tgoto exit_err;\n\n\tentry->rule.flags = rule->flags & AUDIT_FILTER_PREPEND;\n\tentry->rule.listnr = listnr;\n\tentry->rule.action = rule->action;\n\tentry->rule.field_count = rule->field_count;\n\n\tfor (i = 0; i < AUDIT_BITMASK_SIZE; i++)\n\t\tentry->rule.mask[i] = rule->mask[i];\n\n\tfor (i = 0; i < AUDIT_SYSCALL_CLASSES; i++) {\n\t\tint bit = AUDIT_BITMASK_SIZE * 32 - i - 1;\n\t\t__u32 *p = &entry->rule.mask[AUDIT_WORD(bit)];\n\t\t__u32 *class;\n\n\t\tif (!(*p & AUDIT_BIT(bit)))\n\t\t\tcontinue;\n\t\t*p &= ~AUDIT_BIT(bit);\n\t\tclass = classes[i];\n\t\tif (class) {\n\t\t\tint j;\n\t\t\tfor (j = 0; j < AUDIT_BITMASK_SIZE; j++)\n\t\t\t\tentry->rule.mask[j] |= class[j];\n\t\t}\n\t}\n\n\treturn entry;\n\nexit_err:\n\treturn ERR_PTR(err);\n}\n\n/* Translate struct audit_rule to kernel's rule respresentation.\n * Exists for backward compatibility with userspace. */\nstatic struct audit_entry *audit_rule_to_entry(struct audit_rule *rule)\n{\n\tstruct audit_entry *entry;\n\tstruct audit_field *f;\n\tint err = 0;\n\tint i;\n\n\tentry = audit_to_entry_common(rule);\n\tif (IS_ERR(entry))\n\t\tgoto exit_nofree;\n\n\tfor (i = 0; i < rule->field_count; i++) {\n\t\tstruct audit_field *f = &entry->rule.fields[i];\n\n\t\tf->op = rule->fields[i] & (AUDIT_NEGATE|AUDIT_OPERATORS);\n\t\tf->type = rule->fields[i] & ~(AUDIT_NEGATE|AUDIT_OPERATORS);\n\t\tf->val = rule->values[i];\n\n\t\terr = -EINVAL;\n\t\tswitch(f->type) {\n\t\tdefault:\n\t\t\tgoto exit_free;\n\t\tcase AUDIT_PID:\n\t\tcase AUDIT_UID:\n\t\tcase AUDIT_EUID:\n\t\tcase AUDIT_SUID:\n\t\tcase AUDIT_FSUID:\n\t\tcase AUDIT_GID:\n\t\tcase AUDIT_EGID:\n\t\tcase AUDIT_SGID:\n\t\tcase AUDIT_FSGID:\n\t\tcase AUDIT_LOGINUID:\n\t\tcase AUDIT_PERS:\n\t\tcase AUDIT_MSGTYPE:\n\t\tcase AUDIT_PPID:\n\t\tcase AUDIT_DEVMAJOR:\n\t\tcase AUDIT_DEVMINOR:\n\t\tcase AUDIT_EXIT:\n\t\tcase AUDIT_SUCCESS:\n\t\tcase AUDIT_ARG0:\n\t\tcase AUDIT_ARG1:\n\t\tcase AUDIT_ARG2:\n\t\tcase AUDIT_ARG3:\n\t\t\tbreak;\n\t\t/* arch is only allowed to be = or != */\n\t\tcase AUDIT_ARCH:\n\t\t\tif ((f->op != AUDIT_NOT_EQUAL) && (f->op != AUDIT_EQUAL)\n\t\t\t\t\t&& (f->op != AUDIT_NEGATE) && (f->op)) {\n\t\t\t\terr = -EINVAL;\n\t\t\t\tgoto exit_free;\n\t\t\t}\n\t\t\tentry->rule.arch_f = f;\n\t\t\tbreak;\n\t\tcase AUDIT_PERM:\n\t\t\tif (f->val & ~15)\n\t\t\t\tgoto exit_free;\n\t\t\tbreak;\n\t\tcase AUDIT_INODE:\n\t\t\terr = audit_to_inode(&entry->rule, f);\n\t\t\tif (err)\n\t\t\t\tgoto exit_free;\n\t\t\tbreak;\n\t\t}\n\n\t\tentry->rule.vers_ops = (f->op & AUDIT_OPERATORS) ? 2 : 1;\n\n\t\t/* Support for legacy operators where\n\t\t * AUDIT_NEGATE bit signifies != and otherwise assumes == */\n\t\tif (f->op & AUDIT_NEGATE)\n\t\t\tf->op = AUDIT_NOT_EQUAL;\n\t\telse if (!f->op)\n\t\t\tf->op = AUDIT_EQUAL;\n\t\telse if (f->op == AUDIT_OPERATORS) {\n\t\t\terr = -EINVAL;\n\t\t\tgoto exit_free;\n\t\t}\n\t}\n\n\tf = entry->rule.inode_f;\n\tif (f) {\n\t\tswitch(f->op) {\n\t\tcase AUDIT_NOT_EQUAL:\n\t\t\tentry->rule.inode_f = NULL;\n\t\tcase AUDIT_EQUAL:\n\t\t\tbreak;\n\t\tdefault:\n\t\t\terr = -EINVAL;\n\t\t\tgoto exit_free;\n\t\t}\n\t}\n\nexit_nofree:\n\treturn entry;\n\nexit_free:\n\taudit_free_rule(entry);\n\treturn ERR_PTR(err);\n}\n\n/* Translate struct audit_rule_data to kernel's rule respresentation. */\nstatic struct audit_entry *audit_data_to_entry(struct audit_rule_data *data,\n\t\t\t\t\t size_t datasz)\n{\n\tint err = 0;\n\tstruct audit_entry *entry;\n\tstruct audit_field *f;\n\tvoid *bufp;\n\tsize_t remain = datasz - sizeof(struct audit_rule_data);\n\tint i;\n\tchar *str;\n\n\tentry = audit_to_entry_common((struct audit_rule *)data);\n\tif (IS_ERR(entry))\n\t\tgoto exit_nofree;\n\n\tbufp = data->buf;\n\tentry->rule.vers_ops = 2;\n\tfor (i = 0; i < data->field_count; i++) {\n\t\tstruct audit_field *f = &entry->rule.fields[i];\n\n\t\terr = -EINVAL;\n\t\tif (!(data->fieldflags[i] & AUDIT_OPERATORS) ||\n\t\t data->fieldflags[i] & ~AUDIT_OPERATORS)\n\t\t\tgoto exit_free;\n\n\t\tf->op = data->fieldflags[i] & AUDIT_OPERATORS;\n\t\tf->type = data->fields[i];\n\t\tf->val = data->values[i];\n\t\tf->se_str = NULL;\n\t\tf->se_rule = NULL;\n\t\tswitch(f->type) {\n\t\tcase AUDIT_PID:\n\t\tcase AUDIT_UID:\n\t\tcase AUDIT_EUID:\n\t\tcase AUDIT_SUID:\n\t\tcase AUDIT_FSUID:\n\t\tcase AUDIT_GID:\n\t\tcase AUDIT_EGID:\n\t\tcase AUDIT_SGID:\n\t\tcase AUDIT_FSGID:\n\t\tcase AUDIT_LOGINUID:\n\t\tcase AUDIT_PERS:\n\t\tcase AUDIT_MSGTYPE:\n\t\tcase AUDIT_PPID:\n\t\tcase AUDIT_DEVMAJOR:\n\t\tcase AUDIT_DEVMINOR:\n\t\tcase AUDIT_EXIT:\n\t\tcase AUDIT_SUCCESS:\n\t\tcase AUDIT_ARG0:\n\t\tcase AUDIT_ARG1:\n\t\tcase AUDIT_ARG2:\n\t\tcase AUDIT_ARG3:\n\t\t\tbreak;\n\t\tcase AUDIT_ARCH:\n\t\t\tentry->rule.arch_f = f;\n\t\t\tbreak;\n\t\tcase AUDIT_SUBJ_USER:\n\t\tcase AUDIT_SUBJ_ROLE:\n\t\tcase AUDIT_SUBJ_TYPE:\n\t\tcase AUDIT_SUBJ_SEN:\n\t\tcase AUDIT_SUBJ_CLR:\n\t\tcase AUDIT_OBJ_USER:\n\t\tcase AUDIT_OBJ_ROLE:\n\t\tcase AUDIT_OBJ_TYPE:\n\t\tcase AUDIT_OBJ_LEV_LOW:\n\t\tcase AUDIT_OBJ_LEV_HIGH:\n\t\t\tstr = audit_unpack_string(&bufp, &remain, f->val);\n\t\t\tif (IS_ERR(str))\n\t\t\t\tgoto exit_free;\n\t\t\tentry->rule.buflen += f->val;\n\n\t\t\terr = selinux_audit_rule_init(f->type, f->op, str,\n\t\t\t\t\t\t &f->se_rule);\n\t\t\t/* Keep currently invalid fields around in case they\n\t\t\t * become valid after a policy reload. */\n\t\t\tif (err == -EINVAL) {\n\t\t\t\tprintk(KERN_WARNING \"audit rule for selinux \"\n\t\t\t\t \"\\'%s\\' is invalid\\n\", str);\n\t\t\t\terr = 0;\n\t\t\t}\n\t\t\tif (err) {\n\t\t\t\tkfree(str);\n\t\t\t\tgoto exit_free;\n\t\t\t} else\n\t\t\t\tf->se_str = str;\n\t\t\tbreak;\n\t\tcase AUDIT_WATCH:\n\t\t\tstr = audit_unpack_string(&bufp, &remain, f->val);\n\t\t\tif (IS_ERR(str))\n\t\t\t\tgoto exit_free;\n\t\t\tentry->rule.buflen += f->val;\n\n\t\t\terr = audit_to_watch(&entry->rule, str, f->val, f->op);\n\t\t\tif (err) {\n\t\t\t\tkfree(str);\n\t\t\t\tgoto exit_free;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase AUDIT_INODE:\n\t\t\terr = audit_to_inode(&entry->rule, f);\n\t\t\tif (err)\n\t\t\t\tgoto exit_free;\n\t\t\tbreak;\n\t\tcase AUDIT_FILTERKEY:\n\t\t\terr = -EINVAL;\n\t\t\tif (entry->rule.filterkey || f->val > AUDIT_MAX_KEY_LEN)\n\t\t\t\tgoto exit_free;\n\t\t\tstr = audit_unpack_string(&bufp, &remain, f->val);\n\t\t\tif (IS_ERR(str))\n\t\t\t\tgoto exit_free;\n\t\t\tentry->rule.buflen += f->val;\n\t\t\tentry->rule.filterkey = str;\n\t\t\tbreak;\n\t\tcase AUDIT_PERM:\n\t\t\tif (f->val & ~15)\n\t\t\t\tgoto exit_free;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tgoto exit_free;\n\t\t}\n\t}\n\n\tf = entry->rule.inode_f;\n\tif (f) {\n\t\tswitch(f->op) {\n\t\tcase AUDIT_NOT_EQUAL:\n\t\t\tentry->rule.inode_f = NULL;\n\t\tcase AUDIT_EQUAL:\n\t\t\tbreak;\n\t\tdefault:\n\t\t\terr = -EINVAL;\n\t\t\tgoto exit_free;\n\t\t}\n\t}\n\nexit_nofree:\n\treturn entry;\n\nexit_free:\n\taudit_free_rule(entry);\n\treturn ERR_PTR(err);\n}\n\n/* Pack a filter field's string representation into data block. */\nstatic inline size_t audit_pack_string(void **bufp, char *str)\n{\n\tsize_t len = strlen(str);\n\n\tmemcpy(*bufp, str, len);\n\t*bufp += len;\n\n\treturn len;\n}\n\n/* Translate kernel rule respresentation to struct audit_rule.\n * Exists for backward compatibility with userspace. */\nstatic struct audit_rule *audit_krule_to_rule(struct audit_krule *krule)\n{\n\tstruct audit_rule *rule;\n\tint i;\n\n\trule = kzalloc(sizeof(*rule), GFP_KERNEL);\n\tif (unlikely(!rule))\n\t\treturn NULL;\n\n\trule->flags = krule->flags | krule->listnr;\n\trule->action = krule->action;\n\trule->field_count = krule->field_count;\n\tfor (i = 0; i < rule->field_count; i++) {\n\t\trule->values[i] = krule->fields[i].val;\n\t\trule->fields[i] = krule->fields[i].type;\n\n\t\tif (krule->vers_ops == 1) {\n\t\t\tif (krule->fields[i].op & AUDIT_NOT_EQUAL)\n\t\t\t\trule->fields[i] |= AUDIT_NEGATE;\n\t\t} else {\n\t\t\trule->fields[i] |= krule->fields[i].op;\n\t\t}\n\t}\n\tfor (i = 0; i < AUDIT_BITMASK_SIZE; i++) rule->mask[i] = krule->mask[i];\n\n\treturn rule;\n}\n\n/* Translate kernel rule respresentation to struct audit_rule_data. */\nstatic struct audit_rule_data *audit_krule_to_data(struct audit_krule *krule)\n{\n\tstruct audit_rule_data *data;\n\tvoid *bufp;\n\tint i;\n\n\tdata = kmalloc(sizeof(*data) + krule->buflen, GFP_KERNEL);\n\tif (unlikely(!data))\n\t\treturn NULL;\n\tmemset(data, 0, sizeof(*data));\n\n\tdata->flags = krule->flags | krule->listnr;\n\tdata->action = krule->action;\n\tdata->field_count = krule->field_count;\n\tbufp = data->buf;\n\tfor (i = 0; i < data->field_count; i++) {\n\t\tstruct audit_field *f = &krule->fields[i];\n\n\t\tdata->fields[i] = f->type;\n\t\tdata->fieldflags[i] = f->op;\n\t\tswitch(f->type) {\n\t\tcase AUDIT_SUBJ_USER:\n\t\tcase AUDIT_SUBJ_ROLE:\n\t\tcase AUDIT_SUBJ_TYPE:\n\t\tcase AUDIT_SUBJ_SEN:\n\t\tcase AUDIT_SUBJ_CLR:\n\t\tcase AUDIT_OBJ_USER:\n\t\tcase AUDIT_OBJ_ROLE:\n\t\tcase AUDIT_OBJ_TYPE:\n\t\tcase AUDIT_OBJ_LEV_LOW:\n\t\tcase AUDIT_OBJ_LEV_HIGH:\n\t\t\tdata->buflen += data->values[i] =\n\t\t\t\taudit_pack_string(&bufp, f->se_str);\n\t\t\tbreak;\n\t\tcase AUDIT_WATCH:\n\t\t\tdata->buflen += data->values[i] =\n\t\t\t\taudit_pack_string(&bufp, krule->watch->path);\n\t\t\tbreak;\n\t\tcase AUDIT_FILTERKEY:\n\t\t\tdata->buflen += data->values[i] =\n\t\t\t\taudit_pack_string(&bufp, krule->filterkey);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tdata->values[i] = f->val;\n\t\t}\n\t}\n\tfor (i = 0; i < AUDIT_BITMASK_SIZE; i++) data->mask[i] = krule->mask[i];\n\n\treturn data;\n}\n\n/* Compare two rules in kernel format. Considered success if rules\n * don't match. */\nstatic int audit_compare_rule(struct audit_krule *a, struct audit_krule *b)\n{\n\tint i;\n\n\tif (a->flags != b->flags ||\n\t a->listnr != b->listnr ||\n\t a->action != b->action ||\n\t a->field_count != b->field_count)\n\t\treturn 1;\n\n\tfor (i = 0; i < a->field_count; i++) {\n\t\tif (a->fields[i].type != b->fields[i].type ||\n\t\t a->fields[i].op != b->fields[i].op)\n\t\t\treturn 1;\n\n\t\tswitch(a->fields[i].type) {\n\t\tcase AUDIT_SUBJ_USER:\n\t\tcase AUDIT_SUBJ_ROLE:\n\t\tcase AUDIT_SUBJ_TYPE:\n\t\tcase AUDIT_SUBJ_SEN:\n\t\tcase AUDIT_SUBJ_CLR:\n\t\tcase AUDIT_OBJ_USER:\n\t\tcase AUDIT_OBJ_ROLE:\n\t\tcase AUDIT_OBJ_TYPE:\n\t\tcase AUDIT_OBJ_LEV_LOW:\n\t\tcase AUDIT_OBJ_LEV_HIGH:\n\t\t\tif (strcmp(a->fields[i].se_str, b->fields[i].se_str))\n\t\t\t\treturn 1;\n\t\t\tbreak;\n\t\tcase AUDIT_WATCH:\n\t\t\tif (strcmp(a->watch->path, b->watch->path))\n\t\t\t\treturn 1;\n\t\t\tbreak;\n\t\tcase AUDIT_FILTERKEY:\n\t\t\t/* both filterkeys exist based on above type compare */\n\t\t\tif (strcmp(a->filterkey, b->filterkey))\n\t\t\t\treturn 1;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tif (a->fields[i].val != b->fields[i].val)\n\t\t\t\treturn 1;\n\t\t}\n\t}\n\n\tfor (i = 0; i < AUDIT_BITMASK_SIZE; i++)\n\t\tif (a->mask[i] != b->mask[i])\n\t\t\treturn 1;\n\n\treturn 0;\n}\n\n/* Duplicate the given audit watch. The new watch's rules list is initialized\n * to an empty list and wlist is undefined. */\nstatic struct audit_watch *audit_dupe_watch(struct audit_watch *old)\n{\n\tchar *path;\n\tstruct audit_watch *new;\n\n\tpath = kstrdup(old->path, GFP_KERNEL);\n\tif (unlikely(!path))\n\t\treturn ERR_PTR(-ENOMEM);\n\n\tnew = audit_init_watch(path);\n\tif (unlikely(IS_ERR(new))) {\n\t\tkfree(path);\n\t\tgoto out;\n\t}\n\n\tnew->dev = old->dev;\n\tnew->ino = old->ino;\n\tget_inotify_watch(&old->parent->wdata);\n\tnew->parent = old->parent;\n\nout:\n\treturn new;\n}\n\n/* Duplicate selinux field information. The se_rule is opaque, so must be\n * re-initialized. */\nstatic inline int audit_dupe_selinux_field(struct audit_field *df,\n\t\t\t\t\t struct audit_field *sf)\n{\n\tint ret = 0;\n\tchar *se_str;\n\n\t/* our own copy of se_str */\n\tse_str = kstrdup(sf->se_str, GFP_KERNEL);\n\tif (unlikely(!se_str))\n\t\treturn -ENOMEM;\n\tdf->se_str = se_str;\n\n\t/* our own (refreshed) copy of se_rule */\n\tret = selinux_audit_rule_init(df->type, df->op, df->se_str,\n\t\t\t\t &df->se_rule);\n\t/* Keep currently invalid fields around in case they\n\t * become valid after a policy reload. */\n\tif (ret == -EINVAL) {\n\t\tprintk(KERN_WARNING \"audit rule for selinux \\'%s\\' is \"\n\t\t \"invalid\\n\", df->se_str);\n\t\tret = 0;\n\t}\n\n\treturn ret;\n}\n\n/* Duplicate an audit rule. This will be a deep copy with the exception\n * of the watch - that pointer is carried over. The selinux specific fields\n * will be updated in the copy. The point is to be able to replace the old\n * rule with the new rule in the filterlist, then free the old rule.\n * The rlist element is undefined; list manipulations are handled apart from\n * the initial copy. */\nstatic struct audit_entry *audit_dupe_rule(struct audit_krule *old,\n\t\t\t\t\t struct audit_watch *watch)\n{\n\tu32 fcount = old->field_count;\n\tstruct audit_entry *entry;\n\tstruct audit_krule *new;\n\tchar *fk;\n\tint i, err = 0;\n\n\tentry = audit_init_entry(fcount);\n\tif (unlikely(!entry))\n\t\treturn ERR_PTR(-ENOMEM);\n\n\tnew = &entry->rule;\n\tnew->vers_ops = old->vers_ops;\n\tnew->flags = old->flags;\n\tnew->listnr = old->listnr;\n\tnew->action = old->action;\n\tfor (i = 0; i < AUDIT_BITMASK_SIZE; i++)\n\t\tnew->mask[i] = old->mask[i];\n\tnew->buflen = old->buflen;\n\tnew->inode_f = old->inode_f;\n\tnew->watch = NULL;\n\tnew->field_count = old->field_count;\n\tmemcpy(new->fields, old->fields, sizeof(struct audit_field) * fcount);\n\n\t/* deep copy this information, updating the se_rule fields, because\n\t * the originals will all be freed when the old rule is freed. */\n\tfor (i = 0; i < fcount; i++) {\n\t\tswitch (new->fields[i].type) {\n\t\tcase AUDIT_SUBJ_USER:\n\t\tcase AUDIT_SUBJ_ROLE:\n\t\tcase AUDIT_SUBJ_TYPE:\n\t\tcase AUDIT_SUBJ_SEN:\n\t\tcase AUDIT_SUBJ_CLR:\n\t\tcase AUDIT_OBJ_USER:\n\t\tcase AUDIT_OBJ_ROLE:\n\t\tcase AUDIT_OBJ_TYPE:\n\t\tcase AUDIT_OBJ_LEV_LOW:\n\t\tcase AUDIT_OBJ_LEV_HIGH:\n\t\t\terr = audit_dupe_selinux_field(&new->fields[i],\n\t\t\t\t\t\t &old->fields[i]);\n\t\t\tbreak;\n\t\tcase AUDIT_FILTERKEY:\n\t\t\tfk = kstrdup(old->filterkey, GFP_KERNEL);\n\t\t\tif (unlikely(!fk))\n\t\t\t\terr = -ENOMEM;\n\t\t\telse\n\t\t\t\tnew->filterkey = fk;\n\t\t}\n\t\tif (err) {\n\t\t\taudit_free_rule(entry);\n\t\t\treturn ERR_PTR(err);\n\t\t}\n\t}\n\n\tif (watch) {\n\t\taudit_get_watch(watch);\n\t\tnew->watch = watch;\n\t}\n\n\treturn entry;\n}\n\n/* Update inode info in audit rules based on filesystem event. */\nstatic void audit_update_watch(struct audit_parent *parent,\n\t\t\t const char *dname, dev_t dev,\n\t\t\t unsigned long ino, unsigned invalidating)\n{\n\tstruct audit_watch *owatch, *nwatch, *nextw;\n\tstruct audit_krule *r, *nextr;\n\tstruct audit_entry *oentry, *nentry;\n\tstruct audit_buffer *ab;\n\n\tmutex_lock(&audit_filter_mutex);\n\tlist_for_each_entry_safe(owatch, nextw, &parent->watches, wlist) {\n\t\tif (audit_compare_dname_path(dname, owatch->path, NULL))\n\t\t\tcontinue;\n\n\t\t/* If the update involves invalidating rules, do the inode-based\n\t\t * filtering now, so we don't omit records. */\n\t\tif (invalidating && current->audit_context &&\n\t\t audit_filter_inodes(current, current->audit_context) == AUDIT_RECORD_CONTEXT)\n\t\t\taudit_set_auditable(current->audit_context);\n\n\t\tnwatch = audit_dupe_watch(owatch);\n\t\tif (unlikely(IS_ERR(nwatch))) {\n\t\t\tmutex_unlock(&audit_filter_mutex);\n\t\t\taudit_panic(\"error updating watch, skipping\");\n\t\t\treturn;\n\t\t}\n\t\tnwatch->dev = dev;\n\t\tnwatch->ino = ino;\n\n\t\tlist_for_each_entry_safe(r, nextr, &owatch->rules, rlist) {\n\n\t\t\toentry = container_of(r, struct audit_entry, rule);\n\t\t\tlist_del(&oentry->rule.rlist);\n\t\t\tlist_del_rcu(&oentry->list);\n\n\t\t\tnentry = audit_dupe_rule(&oentry->rule, nwatch);\n\t\t\tif (unlikely(IS_ERR(nentry)))\n\t\t\t\taudit_panic(\"error updating watch, removing\");\n\t\t\telse {\n\t\t\t\tint h = audit_hash_ino((u32)ino);\n\t\t\t\tlist_add(&nentry->rule.rlist, &nwatch->rules);\n\t\t\t\tlist_add_rcu(&nentry->list, &audit_inode_hash[h]);\n\t\t\t}\n\n\t\t\tcall_rcu(&oentry->rcu, audit_free_rule_rcu);\n\t\t}\n\n\t\tab = audit_log_start(NULL, GFP_KERNEL, AUDIT_CONFIG_CHANGE);\n\t\taudit_log_format(ab, \"op=updated rules specifying path=\");\n\t\taudit_log_untrustedstring(ab, owatch->path);\n\t\taudit_log_format(ab, \" with dev=%u ino=%lu\\n\", dev, ino);\n\t\taudit_log_format(ab, \" list=%d res=1\", r->listnr);\n\t\taudit_log_end(ab);\n\n\t\taudit_remove_watch(owatch);\n\t\tgoto add_watch_to_parent; /* event applies to a single watch */\n\t}\n\tmutex_unlock(&audit_filter_mutex);\n\treturn;\n\nadd_watch_to_parent:\n\tlist_add(&nwatch->wlist, &parent->watches);\n\tmutex_unlock(&audit_filter_mutex);\n\treturn;\n}\n\n/* Remove all watches & rules associated with a parent that is going away. */\nstatic void audit_remove_parent_watches(struct audit_parent *parent)\n{\n\tstruct audit_watch *w, *nextw;\n\tstruct audit_krule *r, *nextr;\n\tstruct audit_entry *e;\n\tstruct audit_buffer *ab;\n\n\tmutex_lock(&audit_filter_mutex);\n\tparent->flags |= AUDIT_PARENT_INVALID;\n\tlist_for_each_entry_safe(w, nextw, &parent->watches, wlist) {\n\t\tlist_for_each_entry_safe(r, nextr, &w->rules, rlist) {\n\t\t\te = container_of(r, struct audit_entry, rule);\n\n\t\t\tab = audit_log_start(NULL, GFP_KERNEL, AUDIT_CONFIG_CHANGE);\n\t\t\taudit_log_format(ab, \"op=remove rule path=\");\n\t\t\taudit_log_untrustedstring(ab, w->path);\n\t\t\tif (r->filterkey) {\n\t\t\t\taudit_log_format(ab, \" key=\");\n\t\t\t\taudit_log_untrustedstring(ab, r->filterkey);\n\t\t\t} else\n\t\t\t\taudit_log_format(ab, \" key=(null)\");\n\t\t\taudit_log_format(ab, \" list=%d res=1\", r->listnr);\n\t\t\taudit_log_end(ab);\n\n\t\t\tlist_del(&r->rlist);\n\t\t\tlist_del_rcu(&e->list);\n\t\t\tcall_rcu(&e->rcu, audit_free_rule_rcu);\n\t\t}\n\t\taudit_remove_watch(w);\n\t}\n\tmutex_unlock(&audit_filter_mutex);\n}\n\n/* Unregister inotify watches for parents on in_list.\n * Generates an IN_IGNORED event. */\nstatic void audit_inotify_unregister(struct list_head *in_list)\n{\n\tstruct audit_parent *p, *n;\n\n\tlist_for_each_entry_safe(p, n, in_list, ilist) {\n\t\tlist_del(&p->ilist);\n\t\tinotify_rm_watch(audit_ih, &p->wdata);\n\t\t/* the put matching the get in audit_do_del_rule() */\n\t\tput_inotify_watch(&p->wdata);\n\t}\n}\n\n/* Find an existing audit rule.\n * Caller must hold audit_filter_mutex to prevent stale rule data. */\nstatic struct audit_entry *audit_find_rule(struct audit_entry *entry,\n\t\t\t\t\t struct list_head *list)\n{\n\tstruct audit_entry *e, *found = NULL;\n\tint h;\n\n\tif (entry->rule.watch) {\n\t\t/* we don't know the inode number, so must walk entire hash */\n\t\tfor (h = 0; h < AUDIT_INODE_BUCKETS; h++) {\n\t\t\tlist = &audit_inode_hash[h];\n\t\t\tlist_for_each_entry(e, list, list)\n\t\t\t\tif (!audit_compare_rule(&entry->rule, &e->rule)) {\n\t\t\t\t\tfound = e;\n\t\t\t\t\tgoto out;\n\t\t\t\t}\n\t\t}\n\t\tgoto out;\n\t}\n\n\tlist_for_each_entry(e, list, list)\n\t\tif (!audit_compare_rule(&entry->rule, &e->rule)) {\n\t\t\tfound = e;\n\t\t\tgoto out;\n\t\t}\n\nout:\n\treturn found;\n}\n\n/* Get path information necessary for adding watches. */\nstatic int audit_get_nd(char *path, struct nameidata **ndp,\n\t\t\tstruct nameidata **ndw)\n{\n\tstruct nameidata *ndparent, *ndwatch;\n\tint err;\n\n\tndparent = kmalloc(sizeof(*ndparent), GFP_KERNEL);\n\tif (unlikely(!ndparent))\n\t\treturn -ENOMEM;\n\n\tndwatch = kmalloc(sizeof(*ndwatch), GFP_KERNEL);\n\tif (unlikely(!ndwatch)) {\n\t\tkfree(ndparent);\n\t\treturn -ENOMEM;\n\t}\n\n\terr = path_lookup(path, LOOKUP_PARENT, ndparent);\n\tif (err) {\n\t\tkfree(ndparent);\n\t\tkfree(ndwatch);\n\t\treturn err;\n\t}\n\n\terr = path_lookup(path, 0, ndwatch);\n\tif (err) {\n\t\tkfree(ndwatch);\n\t\tndwatch = NULL;\n\t}\n\n\t*ndp = ndparent;\n\t*ndw = ndwatch;\n\n\treturn 0;\n}\n\n/* Release resources used for watch path information. */\nstatic void audit_put_nd(struct nameidata *ndp, struct nameidata *ndw)\n{\n\tif (ndp) {\n\t\tpath_release(ndp);\n\t\tkfree(ndp);\n\t}\n\tif (ndw) {\n\t\tpath_release(ndw);\n\t\tkfree(ndw);\n\t}\n}\n\n/* Associate the given rule with an existing parent inotify_watch.\n * Caller must hold audit_filter_mutex. */\nstatic void audit_add_to_parent(struct audit_krule *krule,\n\t\t\t\tstruct audit_parent *parent)\n{\n\tstruct audit_watch *w, *watch = krule->watch;\n\tint watch_found = 0;\n\n\tlist_for_each_entry(w, &parent->watches, wlist) {\n\t\tif (strcmp(watch->path, w->path))\n\t\t\tcontinue;\n\n\t\twatch_found = 1;\n\n\t\t/* put krule's and initial refs to temporary watch */\n\t\taudit_put_watch(watch);\n\t\taudit_put_watch(watch);\n\n\t\taudit_get_watch(w);\n\t\tkrule->watch = watch = w;\n\t\tbreak;\n\t}\n\n\tif (!watch_found) {\n\t\tget_inotify_watch(&parent->wdata);\n\t\twatch->parent = parent;\n\n\t\tlist_add(&watch->wlist, &parent->watches);\n\t}\n\tlist_add(&krule->rlist, &watch->rules);\n}\n\n/* Find a matching watch entry, or add this one.\n * Caller must hold audit_filter_mutex. */\nstatic int audit_add_watch(struct audit_krule *krule, struct nameidata *ndp,\n\t\t\t struct nameidata *ndw)\n{\n\tstruct audit_watch *watch = krule->watch;\n\tstruct inotify_watch *i_watch;\n\tstruct audit_parent *parent;\n\tint ret = 0;\n\n\t/* update watch filter fields */\n\tif (ndw) {\n\t\twatch->dev = ndw->dentry->d_inode->i_sb->s_dev;\n\t\twatch->ino = ndw->dentry->d_inode->i_ino;\n\t}\n\n\t/* The audit_filter_mutex must not be held during inotify calls because\n\t * we hold it during inotify event callback processing. If an existing\n\t * inotify watch is found, inotify_find_watch() grabs a reference before\n\t * returning.\n\t */\n\tmutex_unlock(&audit_filter_mutex);\n\n\tif (inotify_find_watch(audit_ih, ndp->dentry->d_inode, &i_watch) < 0) {\n\t\tparent = audit_init_parent(ndp);\n\t\tif (IS_ERR(parent)) {\n\t\t\t/* caller expects mutex locked */\n\t\t\tmutex_lock(&audit_filter_mutex);\n\t\t\treturn PTR_ERR(parent);\n\t\t}\n\t} else\n\t\tparent = container_of(i_watch, struct audit_parent, wdata);\n\n\tmutex_lock(&audit_filter_mutex);\n\n\t/* parent was moved before we took audit_filter_mutex */\n\tif (parent->flags & AUDIT_PARENT_INVALID)\n\t\tret = -ENOENT;\n\telse\n\t\taudit_add_to_parent(krule, parent);\n\n\t/* match get in audit_init_parent or inotify_find_watch */\n\tput_inotify_watch(&parent->wdata);\n\treturn ret;\n}\n\n/* Add rule to given filterlist if not a duplicate. */\nstatic inline int audit_add_rule(struct audit_entry *entry,\n\t\t\t\t struct list_head *list)\n{\n\tstruct audit_entry *e;\n\tstruct audit_field *inode_f = entry->rule.inode_f;\n\tstruct audit_watch *watch = entry->rule.watch;\n\tstruct nameidata *ndp, *ndw;\n\tint h, err, putnd_needed = 0;\n#ifdef CONFIG_AUDITSYSCALL\n\tint dont_count = 0;\n\n\t/* If either of these, don't count towards total */\n\tif (entry->rule.listnr == AUDIT_FILTER_USER ||\n\t\tentry->rule.listnr == AUDIT_FILTER_TYPE)\n\t\tdont_count = 1;\n#endif\n\n\tif (inode_f) {\n\t\th = audit_hash_ino(inode_f->val);\n\t\tlist = &audit_inode_hash[h];\n\t}\n\n\tmutex_lock(&audit_filter_mutex);\n\te = audit_find_rule(entry, list);\n\tmutex_unlock(&audit_filter_mutex);\n\tif (e) {\n\t\terr = -EEXIST;\n\t\tgoto error;\n\t}\n\n\t/* Avoid calling path_lookup under audit_filter_mutex. */\n\tif (watch) {\n\t\terr = audit_get_nd(watch->path, &ndp, &ndw);\n\t\tif (err)\n\t\t\tgoto error;\n\t\tputnd_needed = 1;\n\t}\n\n\tmutex_lock(&audit_filter_mutex);\n\tif (watch) {\n\t\t/* audit_filter_mutex is dropped and re-taken during this call */\n\t\terr = audit_add_watch(&entry->rule, ndp, ndw);\n\t\tif (err) {\n\t\t\tmutex_unlock(&audit_filter_mutex);\n\t\t\tgoto error;\n\t\t}\n\t\th = audit_hash_ino((u32)watch->ino);\n\t\tlist = &audit_inode_hash[h];\n\t}\n\n\tif (entry->rule.flags & AUDIT_FILTER_PREPEND) {\n\t\tlist_add_rcu(&entry->list, list);\n\t\tentry->rule.flags &= ~AUDIT_FILTER_PREPEND;\n\t} else {\n\t\tlist_add_tail_rcu(&entry->list, list);\n\t}\n#ifdef CONFIG_AUDITSYSCALL\n\tif (!dont_count)\n\t\taudit_n_rules++;\n\n\tif (!audit_match_signal(entry))\n\t\taudit_signals++;\n#endif\n\tmutex_unlock(&audit_filter_mutex);\n\n\tif (putnd_needed)\n\t\taudit_put_nd(ndp, ndw);\n\n \treturn 0;\n\nerror:\n\tif (putnd_needed)\n\t\taudit_put_nd(ndp, ndw);\n\tif (watch)\n\t\taudit_put_watch(watch); /* tmp watch, matches initial get */\n\treturn err;\n}\n\n/* Remove an existing rule from filterlist. */\nstatic inline int audit_del_rule(struct audit_entry *entry,\n\t\t\t\t struct list_head *list)\n{\n\tstruct audit_entry *e;\n\tstruct audit_field *inode_f = entry->rule.inode_f;\n\tstruct audit_watch *watch, *tmp_watch = entry->rule.watch;\n\tLIST_HEAD(inotify_list);\n\tint h, ret = 0;\n#ifdef CONFIG_AUDITSYSCALL\n\tint dont_count = 0;\n\n\t/* If either of these, don't count towards total */\n\tif (entry->rule.listnr == AUDIT_FILTER_USER ||\n\t\tentry->rule.listnr == AUDIT_FILTER_TYPE)\n\t\tdont_count = 1;\n#endif\n\n\tif (inode_f) {\n\t\th = audit_hash_ino(inode_f->val);\n\t\tlist = &audit_inode_hash[h];\n\t}\n\n\tmutex_lock(&audit_filter_mutex);\n\te = audit_find_rule(entry, list);\n\tif (!e) {\n\t\tmutex_unlock(&audit_filter_mutex);\n\t\tret = -ENOENT;\n\t\tgoto out;\n\t}\n\n\twatch = e->rule.watch;\n\tif (watch) {\n\t\tstruct audit_parent *parent = watch->parent;\n\n\t\tlist_del(&e->rule.rlist);\n\n\t\tif (list_empty(&watch->rules)) {\n\t\t\taudit_remove_watch(watch);\n\n\t\t\tif (list_empty(&parent->watches)) {\n\t\t\t\t/* Put parent on the inotify un-registration\n\t\t\t\t * list. Grab a reference before releasing\n\t\t\t\t * audit_filter_mutex, to be released in\n\t\t\t\t * audit_inotify_unregister(). */\n\t\t\t\tlist_add(&parent->ilist, &inotify_list);\n\t\t\t\tget_inotify_watch(&parent->wdata);\n\t\t\t}\n\t\t}\n\t}\n\n\tlist_del_rcu(&e->list);\n\tcall_rcu(&e->rcu, audit_free_rule_rcu);\n\n#ifdef CONFIG_AUDITSYSCALL\n\tif (!dont_count)\n\t\taudit_n_rules--;\n\n\tif (!audit_match_signal(entry))\n\t\taudit_signals--;\n#endif\n\tmutex_unlock(&audit_filter_mutex);\n\n\tif (!list_empty(&inotify_list))\n\t\taudit_inotify_unregister(&inotify_list);\n\nout:\n\tif (tmp_watch)\n\t\taudit_put_watch(tmp_watch); /* match initial get */\n\n\treturn ret;\n}\n\n/* List rules using struct audit_rule. Exists for backward\n * compatibility with userspace. */\nstatic void audit_list(int pid, int seq, struct sk_buff_head *q)\n{\n\tstruct sk_buff *skb;\n\tstruct audit_entry *entry;\n\tint i;\n\n\t/* This is a blocking read, so use audit_filter_mutex instead of rcu\n\t * iterator to sync with list writers. */\n\tfor (i=0; i<AUDIT_NR_FILTERS; i++) {\n\t\tlist_for_each_entry(entry, &audit_filter_list[i], list) {\n\t\t\tstruct audit_rule *rule;\n\n\t\t\trule = audit_krule_to_rule(&entry->rule);\n\t\t\tif (unlikely(!rule))\n\t\t\t\tbreak;\n\t\t\tskb = audit_make_reply(pid, seq, AUDIT_LIST, 0, 1,\n\t\t\t\t\t rule, sizeof(*rule));\n\t\t\tif (skb)\n\t\t\t\tskb_queue_tail(q, skb);\n\t\t\tkfree(rule);\n\t\t}\n\t}\n\tfor (i = 0; i < AUDIT_INODE_BUCKETS; i++) {\n\t\tlist_for_each_entry(entry, &audit_inode_hash[i], list) {\n\t\t\tstruct audit_rule *rule;\n\n\t\t\trule = audit_krule_to_rule(&entry->rule);\n\t\t\tif (unlikely(!rule))\n\t\t\t\tbreak;\n\t\t\tskb = audit_make_reply(pid, seq, AUDIT_LIST, 0, 1,\n\t\t\t\t\t rule, sizeof(*rule));\n\t\t\tif (skb)\n\t\t\t\tskb_queue_tail(q, skb);\n\t\t\tkfree(rule);\n\t\t}\n\t}\n\tskb = audit_make_reply(pid, seq, AUDIT_LIST, 1, 1, NULL, 0);\n\tif (skb)\n\t\tskb_queue_tail(q, skb);\n}\n\n/* List rules using struct audit_rule_data. */\nstatic void audit_list_rules(int pid, int seq, struct sk_buff_head *q)\n{\n\tstruct sk_buff *skb;\n\tstruct audit_entry *e;\n\tint i;\n\n\t/* This is a blocking read, so use audit_filter_mutex instead of rcu\n\t * iterator to sync with list writers. */\n\tfor (i=0; i<AUDIT_NR_FILTERS; i++) {\n\t\tlist_for_each_entry(e, &audit_filter_list[i], list) {\n\t\t\tstruct audit_rule_data *data;\n\n\t\t\tdata = audit_krule_to_data(&e->rule);\n\t\t\tif (unlikely(!data))\n\t\t\t\tbreak;\n\t\t\tskb = audit_make_reply(pid, seq, AUDIT_LIST_RULES, 0, 1,\n\t\t\t\t\t data, sizeof(*data) + data->buflen);\n\t\t\tif (skb)\n\t\t\t\tskb_queue_tail(q, skb);\n\t\t\tkfree(data);\n\t\t}\n\t}\n\tfor (i=0; i< AUDIT_INODE_BUCKETS; i++) {\n\t\tlist_for_each_entry(e, &audit_inode_hash[i], list) {\n\t\t\tstruct audit_rule_data *data;\n\n\t\t\tdata = audit_krule_to_data(&e->rule);\n\t\t\tif (unlikely(!data))\n\t\t\t\tbreak;\n\t\t\tskb = audit_make_reply(pid, seq, AUDIT_LIST_RULES, 0, 1,\n\t\t\t\t\t data, sizeof(*data) + data->buflen);\n\t\t\tif (skb)\n\t\t\t\tskb_queue_tail(q, skb);\n\t\t\tkfree(data);\n\t\t}\n\t}\n\tskb = audit_make_reply(pid, seq, AUDIT_LIST_RULES, 1, 1, NULL, 0);\n\tif (skb)\n\t\tskb_queue_tail(q, skb);\n}\n\n/* Log rule additions and removals */\nstatic void audit_log_rule_change(uid_t loginuid, u32 sid, char *action,\n\t\t\t\t struct audit_krule *rule, int res)\n{\n\tstruct audit_buffer *ab;\n\n\tab = audit_log_start(NULL, GFP_KERNEL, AUDIT_CONFIG_CHANGE);\n\tif (!ab)\n\t\treturn;\n\taudit_log_format(ab, \"auid=%u\", loginuid);\n\tif (sid) {\n\t\tchar *ctx = NULL;\n\t\tu32 len;\n\t\tif (selinux_sid_to_string(sid, &ctx, &len))\n\t\t\taudit_log_format(ab, \" ssid=%u\", sid);\n\t\telse\n\t\t\taudit_log_format(ab, \" subj=%s\", ctx);\n\t\tkfree(ctx);\n\t}\n\taudit_log_format(ab, \" op=%s rule key=\", action);\n\tif (rule->filterkey)\n\t\taudit_log_untrustedstring(ab, rule->filterkey);\n\telse\n\t\taudit_log_format(ab, \"(null)\");\n\taudit_log_format(ab, \" list=%d res=%d\", rule->listnr, res);\n\taudit_log_end(ab);\n}\n\n/**\n * audit_receive_filter - apply all rules to the specified message type\n * @type: audit message type\n * @pid: target pid for netlink audit messages\n * @uid: target uid for netlink audit messages\n * @seq: netlink audit message sequence (serial) number\n * @data: payload data\n * @datasz: size of payload data\n * @loginuid: loginuid of sender\n * @sid: SE Linux Security ID of sender\n */\nint audit_receive_filter(int type, int pid, int uid, int seq, void *data,\n\t\t\t size_t datasz, uid_t loginuid, u32 sid)\n{\n\tstruct task_struct *tsk;\n\tstruct audit_netlink_list *dest;\n\tint err = 0;\n\tstruct audit_entry *entry;\n\n\tswitch (type) {\n\tcase AUDIT_LIST:\n\tcase AUDIT_LIST_RULES:\n\t\t/* We can't just spew out the rules here because we might fill\n\t\t * the available socket buffer space and deadlock waiting for\n\t\t * auditctl to read from it... which isn't ever going to\n\t\t * happen if we're actually running in the context of auditctl\n\t\t * trying to _send_ the stuff */\n\t\t \n\t\tdest = kmalloc(sizeof(struct audit_netlink_list), GFP_KERNEL);\n\t\tif (!dest)\n\t\t\treturn -ENOMEM;\n\t\tdest->pid = pid;\n\t\tskb_queue_head_init(&dest->q);\n\n\t\tmutex_lock(&audit_filter_mutex);\n\t\tif (type == AUDIT_LIST)\n\t\t\taudit_list(pid, seq, &dest->q);\n\t\telse\n\t\t\taudit_list_rules(pid, seq, &dest->q);\n\t\tmutex_unlock(&audit_filter_mutex);\n\n\t\ttsk = kthread_run(audit_send_list, dest, \"audit_send_list\");\n\t\tif (IS_ERR(tsk)) {\n\t\t\tskb_queue_purge(&dest->q);\n\t\t\tkfree(dest);\n\t\t\terr = PTR_ERR(tsk);\n\t\t}\n\t\tbreak;\n\tcase AUDIT_ADD:\n\tcase AUDIT_ADD_RULE:\n\t\tif (type == AUDIT_ADD)\n\t\t\tentry = audit_rule_to_entry(data);\n\t\telse\n\t\t\tentry = audit_data_to_entry(data, datasz);\n\t\tif (IS_ERR(entry))\n\t\t\treturn PTR_ERR(entry);\n\n\t\terr = audit_add_rule(entry,\n\t\t\t\t &audit_filter_list[entry->rule.listnr]);\n\t\taudit_log_rule_change(loginuid, sid, \"add\", &entry->rule, !err);\n\n\t\tif (err)\n\t\t\taudit_free_rule(entry);\n\t\tbreak;\n\tcase AUDIT_DEL:\n\tcase AUDIT_DEL_RULE:\n\t\tif (type == AUDIT_DEL)\n\t\t\tentry = audit_rule_to_entry(data);\n\t\telse\n\t\t\tentry = audit_data_to_entry(data, datasz);\n\t\tif (IS_ERR(entry))\n\t\t\treturn PTR_ERR(entry);\n\n\t\terr = audit_del_rule(entry,\n\t\t\t\t &audit_filter_list[entry->rule.listnr]);\n\t\taudit_log_rule_change(loginuid, sid, \"remove\", &entry->rule,\n\t\t\t\t !err);\n\n\t\taudit_free_rule(entry);\n\t\tbreak;\n\tdefault:\n\t\treturn -EINVAL;\n\t}\n\n\treturn err;\n}\n\nint audit_comparator(const u32 left, const u32 op, const u32 right)\n{\n\tswitch (op) {\n\tcase AUDIT_EQUAL:\n\t\treturn (left == right);\n\tcase AUDIT_NOT_EQUAL:\n\t\treturn (left != right);\n\tcase AUDIT_LESS_THAN:\n\t\treturn (left < right);\n\tcase AUDIT_LESS_THAN_OR_EQUAL:\n\t\treturn (left <= right);\n\tcase AUDIT_GREATER_THAN:\n\t\treturn (left > right);\n\tcase AUDIT_GREATER_THAN_OR_EQUAL:\n\t\treturn (left >= right);\n\t}\n\tBUG();\n\treturn 0;\n}\n\n/* Compare given dentry name with last component in given path,\n * return of 0 indicates a match. */\nint audit_compare_dname_path(const char *dname, const char *path,\n\t\t\t int *dirlen)\n{\n\tint dlen, plen;\n\tconst char *p;\n\n\tif (!dname || !path)\n\t\treturn 1;\n\n\tdlen = strlen(dname);\n\tplen = strlen(path);\n\tif (plen < dlen)\n\t\treturn 1;\n\n\t/* disregard trailing slashes */\n\tp = path + plen - 1;\n\twhile ((*p == '/') && (p > path))\n\t\tp--;\n\n\t/* find last path component */\n\tp = p - dlen + 1;\n\tif (p < path)\n\t\treturn 1;\n\telse if (p > path) {\n\t\tif (*--p != '/')\n\t\t\treturn 1;\n\t\telse\n\t\t\tp++;\n\t}\n\n\t/* return length of path's directory component */\n\tif (dirlen)\n\t\t*dirlen = p - path;\n\treturn strncmp(p, dname, dlen);\n}\n\nstatic int audit_filter_user_rules(struct netlink_skb_parms *cb,\n\t\t\t\t struct audit_krule *rule,\n\t\t\t\t enum audit_state *state)\n{\n\tint i;\n\n\tfor (i = 0; i < rule->field_count; i++) {\n\t\tstruct audit_field *f = &rule->fields[i];\n\t\tint result = 0;\n\n\t\tswitch (f->type) {\n\t\tcase AUDIT_PID:\n\t\t\tresult = audit_comparator(cb->creds.pid, f->op, f->val);\n\t\t\tbreak;\n\t\tcase AUDIT_UID:\n\t\t\tresult = audit_comparator(cb->creds.uid, f->op, f->val);\n\t\t\tbreak;\n\t\tcase AUDIT_GID:\n\t\t\tresult = audit_comparator(cb->creds.gid, f->op, f->val);\n\t\t\tbreak;\n\t\tcase AUDIT_LOGINUID:\n\t\t\tresult = audit_comparator(cb->loginuid, f->op, f->val);\n\t\t\tbreak;\n\t\t}\n\n\t\tif (!result)\n\t\t\treturn 0;\n\t}\n\tswitch (rule->action) {\n\tcase AUDIT_NEVER: *state = AUDIT_DISABLED;\t break;\n\tcase AUDIT_ALWAYS: *state = AUDIT_RECORD_CONTEXT; break;\n\t}\n\treturn 1;\n}\n\nint audit_filter_user(struct netlink_skb_parms *cb, int type)\n{\n\tenum audit_state state = AUDIT_DISABLED;\n\tstruct audit_entry *e;\n\tint ret = 1;\n\n\trcu_read_lock();\n\tlist_for_each_entry_rcu(e, &audit_filter_list[AUDIT_FILTER_USER], list) {\n\t\tif (audit_filter_user_rules(cb, &e->rule, &state)) {\n\t\t\tif (state == AUDIT_DISABLED)\n\t\t\t\tret = 0;\n\t\t\tbreak;\n\t\t}\n\t}\n\trcu_read_unlock();\n\n\treturn ret; /* Audit by default */\n}\n\nint audit_filter_type(int type)\n{\n\tstruct audit_entry *e;\n\tint result = 0;\n\t\n\trcu_read_lock();\n\tif (list_empty(&audit_filter_list[AUDIT_FILTER_TYPE]))\n\t\tgoto unlock_and_return;\n\n\tlist_for_each_entry_rcu(e, &audit_filter_list[AUDIT_FILTER_TYPE],\n\t\t\t\tlist) {\n\t\tint i;\n\t\tfor (i = 0; i < e->rule.field_count; i++) {\n\t\t\tstruct audit_field *f = &e->rule.fields[i];\n\t\t\tif (f->type == AUDIT_MSGTYPE) {\n\t\t\t\tresult = audit_comparator(type, f->op, f->val);\n\t\t\t\tif (!result)\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (result)\n\t\t\tgoto unlock_and_return;\n\t}\nunlock_and_return:\n\trcu_read_unlock();\n\treturn result;\n}\n\n/* Check to see if the rule contains any selinux fields. Returns 1 if there\n are selinux fields specified in the rule, 0 otherwise. */\nstatic inline int audit_rule_has_selinux(struct audit_krule *rule)\n{\n\tint i;\n\n\tfor (i = 0; i < rule->field_count; i++) {\n\t\tstruct audit_field *f = &rule->fields[i];\n\t\tswitch (f->type) {\n\t\tcase AUDIT_SUBJ_USER:\n\t\tcase AUDIT_SUBJ_ROLE:\n\t\tcase AUDIT_SUBJ_TYPE:\n\t\tcase AUDIT_SUBJ_SEN:\n\t\tcase AUDIT_SUBJ_CLR:\n\t\tcase AUDIT_OBJ_USER:\n\t\tcase AUDIT_OBJ_ROLE:\n\t\tcase AUDIT_OBJ_TYPE:\n\t\tcase AUDIT_OBJ_LEV_LOW:\n\t\tcase AUDIT_OBJ_LEV_HIGH:\n\t\t\treturn 1;\n\t\t}\n\t}\n\n\treturn 0;\n}\n\n/* This function will re-initialize the se_rule field of all applicable rules.\n * It will traverse the filter lists serarching for rules that contain selinux\n * specific filter fields. When such a rule is found, it is copied, the\n * selinux field is re-initialized, and the old rule is replaced with the\n * updated rule. */\nint selinux_audit_rule_update(void)\n{\n\tstruct audit_entry *entry, *n, *nentry;\n\tstruct audit_watch *watch;\n\tint i, err = 0;\n\n\t/* audit_filter_mutex synchronizes the writers */\n\tmutex_lock(&audit_filter_mutex);\n\n\tfor (i = 0; i < AUDIT_NR_FILTERS; i++) {\n\t\tlist_for_each_entry_safe(entry, n, &audit_filter_list[i], list) {\n\t\t\tif (!audit_rule_has_selinux(&entry->rule))\n\t\t\t\tcontinue;\n\n\t\t\twatch = entry->rule.watch;\n\t\t\tnentry = audit_dupe_rule(&entry->rule, watch);\n\t\t\tif (unlikely(IS_ERR(nentry))) {\n\t\t\t\t/* save the first error encountered for the\n\t\t\t\t * return value */\n\t\t\t\tif (!err)\n\t\t\t\t\terr = PTR_ERR(nentry);\n\t\t\t\taudit_panic(\"error updating selinux filters\");\n\t\t\t\tif (watch)\n\t\t\t\t\tlist_del(&entry->rule.rlist);\n\t\t\t\tlist_del_rcu(&entry->list);\n\t\t\t} else {\n\t\t\t\tif (watch) {\n\t\t\t\t\tlist_add(&nentry->rule.rlist,\n\t\t\t\t\t\t &watch->rules);\n\t\t\t\t\tlist_del(&entry->rule.rlist);\n\t\t\t\t}\n\t\t\t\tlist_replace_rcu(&entry->list, &nentry->list);\n\t\t\t}\n\t\t\tcall_rcu(&entry->rcu, audit_free_rule_rcu);\n\t\t}\n\t}\n\n\tmutex_unlock(&audit_filter_mutex);\n\n\treturn err;\n}\n\n/* Update watch data in audit rules based on inotify events. */\nvoid audit_handle_ievent(struct inotify_watch *i_watch, u32 wd, u32 mask,\n\t\t\t u32 cookie, const char *dname, struct inode *inode)\n{\n\tstruct audit_parent *parent;\n\n\tparent = container_of(i_watch, struct audit_parent, wdata);\n\n\tif (mask & (IN_CREATE|IN_MOVED_TO) && inode)\n\t\taudit_update_watch(parent, dname, inode->i_sb->s_dev,\n\t\t\t\t inode->i_ino, 0);\n\telse if (mask & (IN_DELETE|IN_MOVED_FROM))\n\t\taudit_update_watch(parent, dname, (dev_t)-1, (unsigned long)-1, 1);\n\t/* inotify automatically removes the watch and sends IN_IGNORED */\n\telse if (mask & (IN_DELETE_SELF|IN_UNMOUNT))\n\t\taudit_remove_parent_watches(parent);\n\t/* inotify does not remove the watch, so remove it manually */\n\telse if(mask & IN_MOVE_SELF) {\n\t\taudit_remove_parent_watches(parent);\n\t\tinotify_remove_watch_locked(audit_ih, i_watch);\n\t} else if (mask & IN_IGNORED)\n\t\tput_inotify_watch(i_watch);\n}\n/* auditsc.c -- System-call auditing support\n * Handles all system-call specific auditing features.\n *\n * Copyright 2003-2004 Red Hat Inc., Durham, North Carolina.\n * Copyright 2005 Hewlett-Packard Development Company, L.P.\n * Copyright (C) 2005, 2006 IBM Corporation\n * All Rights Reserved.\n *\n * This program is free software; you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation; either version 2 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program; if not, write to the Free Software\n * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n *\n * Written by Rickard E. (Rik) Faith <faith@redhat.com>\n *\n * Many of the ideas implemented here are from Stephen C. Tweedie,\n * especially the idea of avoiding a copy by using getname.\n *\n * The method for actual interception of syscall entry and exit (not in\n * this file -- see entry.S) is based on a GPL'd patch written by\n * okir@suse.de and Copyright 2003 SuSE Linux AG.\n *\n * POSIX message queue support added by George Wilson <ltcgcw@us.ibm.com>,\n * 2006.\n *\n * The support of additional filter rules compares (>, <, >=, <=) was\n * added by Dustin Kirkland <dustin.kirkland@us.ibm.com>, 2005.\n *\n * Modified by Amy Griffis <amy.griffis@hp.com> to collect additional\n * filesystem information.\n *\n * Subject and object context labeling support added by <danjones@us.ibm.com>\n * and <dustin.kirkland@us.ibm.com> for LSPP certification compliance.\n */\n\n#include <linux/init.h>\n#include <asm/types.h>\n#include <asm/atomic.h>\n#include <asm/types.h>\n#include <linux/fs.h>\n#include <linux/namei.h>\n#include <linux/mm.h>\n#include <linux/module.h>\n#include <linux/mount.h>\n#include <linux/socket.h>\n#include <linux/mqueue.h>\n#include <linux/audit.h>\n#include <linux/personality.h>\n#include <linux/time.h>\n#include <linux/netlink.h>\n#include <linux/compiler.h>\n#include <asm/unistd.h>\n#include <linux/security.h>\n#include <linux/list.h>\n#include <linux/tty.h>\n#include <linux/selinux.h>\n#include <linux/binfmts.h>\n#include <linux/highmem.h>\n#include <linux/syscalls.h>\n\n#include \"audit.h\"\n\nextern struct list_head audit_filter_list[];\n\n/* No syscall auditing will take place unless audit_enabled != 0. */\nextern int audit_enabled;\n\n/* AUDIT_NAMES is the number of slots we reserve in the audit_context\n * for saving names from getname(). */\n#define AUDIT_NAMES 20\n\n/* Indicates that audit should log the full pathname. */\n#define AUDIT_NAME_FULL -1\n\n/* number of audit rules */\nint audit_n_rules;\n\n/* determines whether we collect data for signals sent */\nint audit_signals;\n\n/* When fs/namei.c:getname() is called, we store the pointer in name and\n * we don't let putname() free it (instead we free all of the saved\n * pointers at syscall exit time).\n *\n * Further, in fs/namei.c:path_lookup() we store the inode and device. */\nstruct audit_names {\n\tconst char\t*name;\n\tint\t\tname_len;\t/* number of name's characters to log */\n\tunsigned\tname_put;\t/* call __putname() for this name */\n\tunsigned long\tino;\n\tdev_t\t\tdev;\n\tumode_t\t\tmode;\n\tuid_t\t\tuid;\n\tgid_t\t\tgid;\n\tdev_t\t\trdev;\n\tu32\t\tosid;\n};\n\nstruct audit_aux_data {\n\tstruct audit_aux_data\t*next;\n\tint\t\t\ttype;\n};\n\n#define AUDIT_AUX_IPCPERM\t0\n\n/* Number of target pids per aux struct. */\n#define AUDIT_AUX_PIDS\t16\n\nstruct audit_aux_data_mq_open {\n\tstruct audit_aux_data\td;\n\tint\t\t\toflag;\n\tmode_t\t\t\tmode;\n\tstruct mq_attr\t\tattr;\n};\n\nstruct audit_aux_data_mq_sendrecv {\n\tstruct audit_aux_data\td;\n\tmqd_t\t\t\tmqdes;\n\tsize_t\t\t\tmsg_len;\n\tunsigned int\t\tmsg_prio;\n\tstruct timespec\t\tabs_timeout;\n};\n\nstruct audit_aux_data_mq_notify {\n\tstruct audit_aux_data\td;\n\tmqd_t\t\t\tmqdes;\n\tstruct sigevent \tnotification;\n};\n\nstruct audit_aux_data_mq_getsetattr {\n\tstruct audit_aux_data\td;\n\tmqd_t\t\t\tmqdes;\n\tstruct mq_attr \t\tmqstat;\n};\n\nstruct audit_aux_data_ipcctl {\n\tstruct audit_aux_data\td;\n\tstruct ipc_perm\t\tp;\n\tunsigned long\t\tqbytes;\n\tuid_t\t\t\tuid;\n\tgid_t\t\t\tgid;\n\tmode_t\t\t\tmode;\n\tu32\t\t\tosid;\n};\n\nstruct audit_aux_data_execve {\n\tstruct audit_aux_data\td;\n\tint argc;\n\tint envc;\n\tchar mem[0];\n};\n\nstruct audit_aux_data_socketcall {\n\tstruct audit_aux_data\td;\n\tint\t\t\tnargs;\n\tunsigned long\t\targs[0];\n};\n\nstruct audit_aux_data_sockaddr {\n\tstruct audit_aux_data\td;\n\tint\t\t\tlen;\n\tchar\t\t\ta[0];\n};\n\nstruct audit_aux_data_fd_pair {\n\tstruct\taudit_aux_data d;\n\tint\tfd[2];\n};\n\nstruct audit_aux_data_path {\n\tstruct audit_aux_data\td;\n\tstruct dentry\t\t*dentry;\n\tstruct vfsmount\t\t*mnt;\n};\n\nstruct audit_aux_data_pids {\n\tstruct audit_aux_data\td;\n\tpid_t\t\t\ttarget_pid[AUDIT_AUX_PIDS];\n\tu32\t\t\ttarget_sid[AUDIT_AUX_PIDS];\n\tint\t\t\tpid_count;\n};\n\n/* The per-task audit context. */\nstruct audit_context {\n\tint\t\t dummy;\t/* must be the first element */\n\tint\t\t in_syscall;\t/* 1 if task is in a syscall */\n\tenum audit_state state;\n\tunsigned int\t serial; /* serial number for record */\n\tstruct timespec\t ctime; /* time of syscall entry */\n\tuid_t\t\t loginuid; /* login uid (identity) */\n\tint\t\t major; /* syscall number */\n\tunsigned long\t argv[4]; /* syscall arguments */\n\tint\t\t return_valid; /* return code is valid */\n\tlong\t\t return_code;/* syscall return code */\n\tint\t\t auditable; /* 1 if record should be written */\n\tint\t\t name_count;\n\tstruct audit_names names[AUDIT_NAMES];\n\tchar *\t\t filterkey;\t/* key for rule that triggered record */\n\tstruct dentry *\t pwd;\n\tstruct vfsmount * pwdmnt;\n\tstruct audit_context *previous; /* For nested syscalls */\n\tstruct audit_aux_data *aux;\n\tstruct audit_aux_data *aux_pids;\n\n\t\t\t\t/* Save things to print about task_struct */\n\tpid_t\t\t pid, ppid;\n\tuid_t\t\t uid, euid, suid, fsuid;\n\tgid_t\t\t gid, egid, sgid, fsgid;\n\tunsigned long\t personality;\n\tint\t\t arch;\n\n\tpid_t\t\t target_pid;\n\tu32\t\t target_sid;\n\n#if AUDIT_DEBUG\n\tint\t\t put_count;\n\tint\t\t ino_count;\n#endif\n};\n\n#define ACC_MODE(x) (\"\\004\\002\\006\\006\"[(x)&O_ACCMODE])\nstatic inline int open_arg(int flags, int mask)\n{\n\tint n = ACC_MODE(flags);\n\tif (flags & (O_TRUNC | O_CREAT))\n\t\tn |= AUDIT_PERM_WRITE;\n\treturn n & mask;\n}\n\nstatic int audit_match_perm(struct audit_context *ctx, int mask)\n{\n\tunsigned n = ctx->major;\n\tswitch (audit_classify_syscall(ctx->arch, n)) {\n\tcase 0:\t/* native */\n\t\tif ((mask & AUDIT_PERM_WRITE) &&\n\t\t audit_match_class(AUDIT_CLASS_WRITE, n))\n\t\t\treturn 1;\n\t\tif ((mask & AUDIT_PERM_READ) &&\n\t\t audit_match_class(AUDIT_CLASS_READ, n))\n\t\t\treturn 1;\n\t\tif ((mask & AUDIT_PERM_ATTR) &&\n\t\t audit_match_class(AUDIT_CLASS_CHATTR, n))\n\t\t\treturn 1;\n\t\treturn 0;\n\tcase 1: /* 32bit on biarch */\n\t\tif ((mask & AUDIT_PERM_WRITE) &&\n\t\t audit_match_class(AUDIT_CLASS_WRITE_32, n))\n\t\t\treturn 1;\n\t\tif ((mask & AUDIT_PERM_READ) &&\n\t\t audit_match_class(AUDIT_CLASS_READ_32, n))\n\t\t\treturn 1;\n\t\tif ((mask & AUDIT_PERM_ATTR) &&\n\t\t audit_match_class(AUDIT_CLASS_CHATTR_32, n))\n\t\t\treturn 1;\n\t\treturn 0;\n\tcase 2: /* open */\n\t\treturn mask & ACC_MODE(ctx->argv[1]);\n\tcase 3: /* openat */\n\t\treturn mask & ACC_MODE(ctx->argv[2]);\n\tcase 4: /* socketcall */\n\t\treturn ((mask & AUDIT_PERM_WRITE) && ctx->argv[0] == SYS_BIND);\n\tcase 5: /* execve */\n\t\treturn mask & AUDIT_PERM_EXEC;\n\tdefault:\n\t\treturn 0;\n\t}\n}\n\n/* Determine if any context name data matches a rule's watch data */\n/* Compare a task_struct with an audit_rule. Return 1 on match, 0\n * otherwise. */\nstatic int audit_filter_rules(struct task_struct *tsk,\n\t\t\t struct audit_krule *rule,\n\t\t\t struct audit_context *ctx,\n\t\t\t struct audit_names *name,\n\t\t\t enum audit_state *state)\n{\n\tint i, j, need_sid = 1;\n\tu32 sid;\n\n\tfor (i = 0; i < rule->field_count; i++) {\n\t\tstruct audit_field *f = &rule->fields[i];\n\t\tint result = 0;\n\n\t\tswitch (f->type) {\n\t\tcase AUDIT_PID:\n\t\t\tresult = audit_comparator(tsk->pid, f->op, f->val);\n\t\t\tbreak;\n\t\tcase AUDIT_PPID:\n\t\t\tif (ctx) {\n\t\t\t\tif (!ctx->ppid)\n\t\t\t\t\tctx->ppid = sys_getppid();\n\t\t\t\tresult = audit_comparator(ctx->ppid, f->op, f->val);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase AUDIT_UID:\n\t\t\tresult = audit_comparator(tsk->uid, f->op, f->val);\n\t\t\tbreak;\n\t\tcase AUDIT_EUID:\n\t\t\tresult = audit_comparator(tsk->euid, f->op, f->val);\n\t\t\tbreak;\n\t\tcase AUDIT_SUID:\n\t\t\tresult = audit_comparator(tsk->suid, f->op, f->val);\n\t\t\tbreak;\n\t\tcase AUDIT_FSUID:\n\t\t\tresult = audit_comparator(tsk->fsuid, f->op, f->val);\n\t\t\tbreak;\n\t\tcase AUDIT_GID:\n\t\t\tresult = audit_comparator(tsk->gid, f->op, f->val);\n\t\t\tbreak;\n\t\tcase AUDIT_EGID:\n\t\t\tresult = audit_comparator(tsk->egid, f->op, f->val);\n\t\t\tbreak;\n\t\tcase AUDIT_SGID:\n\t\t\tresult = audit_comparator(tsk->sgid, f->op, f->val);\n\t\t\tbreak;\n\t\tcase AUDIT_FSGID:\n\t\t\tresult = audit_comparator(tsk->fsgid, f->op, f->val);\n\t\t\tbreak;\n\t\tcase AUDIT_PERS:\n\t\t\tresult = audit_comparator(tsk->personality, f->op, f->val);\n\t\t\tbreak;\n\t\tcase AUDIT_ARCH:\n \t\t\tif (ctx)\n\t\t\t\tresult = audit_comparator(ctx->arch, f->op, f->val);\n\t\t\tbreak;\n\n\t\tcase AUDIT_EXIT:\n\t\t\tif (ctx && ctx->return_valid)\n\t\t\t\tresult = audit_comparator(ctx->return_code, f->op, f->val);\n\t\t\tbreak;\n\t\tcase AUDIT_SUCCESS:\n\t\t\tif (ctx && ctx->return_valid) {\n\t\t\t\tif (f->val)\n\t\t\t\t\tresult = audit_comparator(ctx->return_valid, f->op, AUDITSC_SUCCESS);\n\t\t\t\telse\n\t\t\t\t\tresult = audit_comparator(ctx->return_valid, f->op, AUDITSC_FAILURE);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase AUDIT_DEVMAJOR:\n\t\t\tif (name)\n\t\t\t\tresult = audit_comparator(MAJOR(name->dev),\n\t\t\t\t\t\t\t f->op, f->val);\n\t\t\telse if (ctx) {\n\t\t\t\tfor (j = 0; j < ctx->name_count; j++) {\n\t\t\t\t\tif (audit_comparator(MAJOR(ctx->names[j].dev),\tf->op, f->val)) {\n\t\t\t\t\t\t++result;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\tcase AUDIT_DEVMINOR:\n\t\t\tif (name)\n\t\t\t\tresult = audit_comparator(MINOR(name->dev),\n\t\t\t\t\t\t\t f->op, f->val);\n\t\t\telse if (ctx) {\n\t\t\t\tfor (j = 0; j < ctx->name_count; j++) {\n\t\t\t\t\tif (audit_comparator(MINOR(ctx->names[j].dev), f->op, f->val)) {\n\t\t\t\t\t\t++result;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\tcase AUDIT_INODE:\n\t\t\tif (name)\n\t\t\t\tresult = (name->ino == f->val);\n\t\t\telse if (ctx) {\n\t\t\t\tfor (j = 0; j < ctx->name_count; j++) {\n\t\t\t\t\tif (audit_comparator(ctx->names[j].ino, f->op, f->val)) {\n\t\t\t\t\t\t++result;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\tcase AUDIT_WATCH:\n\t\t\tif (name && rule->watch->ino != (unsigned long)-1)\n\t\t\t\tresult = (name->dev == rule->watch->dev &&\n\t\t\t\t\t name->ino == rule->watch->ino);\n\t\t\tbreak;\n\t\tcase AUDIT_LOGINUID:\n\t\t\tresult = 0;\n\t\t\tif (ctx)\n\t\t\t\tresult = audit_comparator(ctx->loginuid, f->op, f->val);\n\t\t\tbreak;\n\t\tcase AUDIT_SUBJ_USER:\n\t\tcase AUDIT_SUBJ_ROLE:\n\t\tcase AUDIT_SUBJ_TYPE:\n\t\tcase AUDIT_SUBJ_SEN:\n\t\tcase AUDIT_SUBJ_CLR:\n\t\t\t/* NOTE: this may return negative values indicating\n\t\t\t a temporary error. We simply treat this as a\n\t\t\t match for now to avoid losing information that\n\t\t\t may be wanted. An error message will also be\n\t\t\t logged upon error */\n\t\t\tif (f->se_rule) {\n\t\t\t\tif (need_sid) {\n\t\t\t\t\tselinux_get_task_sid(tsk, &sid);\n\t\t\t\t\tneed_sid = 0;\n\t\t\t\t}\n\t\t\t\tresult = selinux_audit_rule_match(sid, f->type,\n\t\t\t\t f->op,\n\t\t\t\t f->se_rule,\n\t\t\t\t ctx);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase AUDIT_OBJ_USER:\n\t\tcase AUDIT_OBJ_ROLE:\n\t\tcase AUDIT_OBJ_TYPE:\n\t\tcase AUDIT_OBJ_LEV_LOW:\n\t\tcase AUDIT_OBJ_LEV_HIGH:\n\t\t\t/* The above note for AUDIT_SUBJ_USER...AUDIT_SUBJ_CLR\n\t\t\t also applies here */\n\t\t\tif (f->se_rule) {\n\t\t\t\t/* Find files that match */\n\t\t\t\tif (name) {\n\t\t\t\t\tresult = selinux_audit_rule_match(\n\t\t\t\t\t name->osid, f->type, f->op,\n\t\t\t\t\t f->se_rule, ctx);\n\t\t\t\t} else if (ctx) {\n\t\t\t\t\tfor (j = 0; j < ctx->name_count; j++) {\n\t\t\t\t\t\tif (selinux_audit_rule_match(\n\t\t\t\t\t\t ctx->names[j].osid,\n\t\t\t\t\t\t f->type, f->op,\n\t\t\t\t\t\t f->se_rule, ctx)) {\n\t\t\t\t\t\t\t++result;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t/* Find ipc objects that match */\n\t\t\t\tif (ctx) {\n\t\t\t\t\tstruct audit_aux_data *aux;\n\t\t\t\t\tfor (aux = ctx->aux; aux;\n\t\t\t\t\t aux = aux->next) {\n\t\t\t\t\t\tif (aux->type == AUDIT_IPC) {\n\t\t\t\t\t\t\tstruct audit_aux_data_ipcctl *axi = (void *)aux;\n\t\t\t\t\t\t\tif (selinux_audit_rule_match(axi->osid, f->type, f->op, f->se_rule, ctx)) {\n\t\t\t\t\t\t\t\t++result;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\tcase AUDIT_ARG0:\n\t\tcase AUDIT_ARG1:\n\t\tcase AUDIT_ARG2:\n\t\tcase AUDIT_ARG3:\n\t\t\tif (ctx)\n\t\t\t\tresult = audit_comparator(ctx->argv[f->type-AUDIT_ARG0], f->op, f->val);\n\t\t\tbreak;\n\t\tcase AUDIT_FILTERKEY:\n\t\t\t/* ignore this field for filtering */\n\t\t\tresult = 1;\n\t\t\tbreak;\n\t\tcase AUDIT_PERM:\n\t\t\tresult = audit_match_perm(ctx, f->val);\n\t\t\tbreak;\n\t\t}\n\n\t\tif (!result)\n\t\t\treturn 0;\n\t}\n\tif (rule->filterkey)\n\t\tctx->filterkey = kstrdup(rule->filterkey, GFP_ATOMIC);\n\tswitch (rule->action) {\n\tcase AUDIT_NEVER: *state = AUDIT_DISABLED;\t break;\n\tcase AUDIT_ALWAYS: *state = AUDIT_RECORD_CONTEXT; break;\n\t}\n\treturn 1;\n}\n\n/* At process creation time, we can determine if system-call auditing is\n * completely disabled for this task. Since we only have the task\n * structure at this point, we can only check uid and gid.\n */\nstatic enum audit_state audit_filter_task(struct task_struct *tsk)\n{\n\tstruct audit_entry *e;\n\tenum audit_state state;\n\n\trcu_read_lock();\n\tlist_for_each_entry_rcu(e, &audit_filter_list[AUDIT_FILTER_TASK], list) {\n\t\tif (audit_filter_rules(tsk, &e->rule, NULL, NULL, &state)) {\n\t\t\trcu_read_unlock();\n\t\t\treturn state;\n\t\t}\n\t}\n\trcu_read_unlock();\n\treturn AUDIT_BUILD_CONTEXT;\n}\n\n/* At syscall entry and exit time, this filter is called if the\n * audit_state is not low enough that auditing cannot take place, but is\n * also not high enough that we already know we have to write an audit\n * record (i.e., the state is AUDIT_SETUP_CONTEXT or AUDIT_BUILD_CONTEXT).\n */\nstatic enum audit_state audit_filter_syscall(struct task_struct *tsk,\n\t\t\t\t\t struct audit_context *ctx,\n\t\t\t\t\t struct list_head *list)\n{\n\tstruct audit_entry *e;\n\tenum audit_state state;\n\n\tif (audit_pid && tsk->tgid == audit_pid)\n\t\treturn AUDIT_DISABLED;\n\n\trcu_read_lock();\n\tif (!list_empty(list)) {\n\t\tint word = AUDIT_WORD(ctx->major);\n\t\tint bit = AUDIT_BIT(ctx->major);\n\n\t\tlist_for_each_entry_rcu(e, list, list) {\n\t\t\tif ((e->rule.mask[word] & bit) == bit &&\n\t\t\t audit_filter_rules(tsk, &e->rule, ctx, NULL,\n\t\t\t\t\t &state)) {\n\t\t\t\trcu_read_unlock();\n\t\t\t\treturn state;\n\t\t\t}\n\t\t}\n\t}\n\trcu_read_unlock();\n\treturn AUDIT_BUILD_CONTEXT;\n}\n\n/* At syscall exit time, this filter is called if any audit_names[] have been\n * collected during syscall processing. We only check rules in sublists at hash\n * buckets applicable to the inode numbers in audit_names[].\n * Regarding audit_state, same rules apply as for audit_filter_syscall().\n */\nenum audit_state audit_filter_inodes(struct task_struct *tsk,\n\t\t\t\t struct audit_context *ctx)\n{\n\tint i;\n\tstruct audit_entry *e;\n\tenum audit_state state;\n\n\tif (audit_pid && tsk->tgid == audit_pid)\n\t\treturn AUDIT_DISABLED;\n\n\trcu_read_lock();\n\tfor (i = 0; i < ctx->name_count; i++) {\n\t\tint word = AUDIT_WORD(ctx->major);\n\t\tint bit = AUDIT_BIT(ctx->major);\n\t\tstruct audit_names *n = &ctx->names[i];\n\t\tint h = audit_hash_ino((u32)n->ino);\n\t\tstruct list_head *list = &audit_inode_hash[h];\n\n\t\tif (list_empty(list))\n\t\t\tcontinue;\n\n\t\tlist_for_each_entry_rcu(e, list, list) {\n\t\t\tif ((e->rule.mask[word] & bit) == bit &&\n\t\t\t audit_filter_rules(tsk, &e->rule, ctx, n, &state)) {\n\t\t\t\trcu_read_unlock();\n\t\t\t\treturn state;\n\t\t\t}\n\t\t}\n\t}\n\trcu_read_unlock();\n\treturn AUDIT_BUILD_CONTEXT;\n}\n\nvoid audit_set_auditable(struct audit_context *ctx)\n{\n\tctx->auditable = 1;\n}\n\nstatic inline struct audit_context *audit_get_context(struct task_struct *tsk,\n\t\t\t\t\t\t int return_valid,\n\t\t\t\t\t\t int return_code)\n{\n\tstruct audit_context *context = tsk->audit_context;\n\n\tif (likely(!context))\n\t\treturn NULL;\n\tcontext->return_valid = return_valid;\n\tcontext->return_code = return_code;\n\n\tif (context->in_syscall && !context->dummy && !context->auditable) {\n\t\tenum audit_state state;\n\n\t\tstate = audit_filter_syscall(tsk, context, &audit_filter_list[AUDIT_FILTER_EXIT]);\n\t\tif (state == AUDIT_RECORD_CONTEXT) {\n\t\t\tcontext->auditable = 1;\n\t\t\tgoto get_context;\n\t\t}\n\n\t\tstate = audit_filter_inodes(tsk, context);\n\t\tif (state == AUDIT_RECORD_CONTEXT)\n\t\t\tcontext->auditable = 1;\n\n\t}\n\nget_context:\n\n\ttsk->audit_context = NULL;\n\treturn context;\n}\n\nstatic inline void audit_free_names(struct audit_context *context)\n{\n\tint i;\n\n#if AUDIT_DEBUG == 2\n\tif (context->auditable\n\t ||context->put_count + context->ino_count != context->name_count) {\n\t\tprintk(KERN_ERR \"%s:%d(:%d): major=%d in_syscall=%d\"\n\t\t \" name_count=%d put_count=%d\"\n\t\t \" ino_count=%d [NOT freeing]\\n\",\n\t\t __FILE__, __LINE__,\n\t\t context->serial, context->major, context->in_syscall,\n\t\t context->name_count, context->put_count,\n\t\t context->ino_count);\n\t\tfor (i = 0; i < context->name_count; i++) {\n\t\t\tprintk(KERN_ERR \"names[%d] = %p = %s\\n\", i,\n\t\t\t context->names[i].name,\n\t\t\t context->names[i].name ?: \"(null)\");\n\t\t}\n\t\tdump_stack();\n\t\treturn;\n\t}\n#endif\n#if AUDIT_DEBUG\n\tcontext->put_count = 0;\n\tcontext->ino_count = 0;\n#endif\n\n\tfor (i = 0; i < context->name_count; i++) {\n\t\tif (context->names[i].name && context->names[i].name_put)\n\t\t\t__putname(context->names[i].name);\n\t}\n\tcontext->name_count = 0;\n\tif (context->pwd)\n\t\tdput(context->pwd);\n\tif (context->pwdmnt)\n\t\tmntput(context->pwdmnt);\n\tcontext->pwd = NULL;\n\tcontext->pwdmnt = NULL;\n}\n\nstatic inline void audit_free_aux(struct audit_context *context)\n{\n\tstruct audit_aux_data *aux;\n\n\twhile ((aux = context->aux)) {\n\t\tif (aux->type == AUDIT_AVC_PATH) {\n\t\t\tstruct audit_aux_data_path *axi = (void *)aux;\n\t\t\tdput(axi->dentry);\n\t\t\tmntput(axi->mnt);\n\t\t}\n\n\t\tcontext->aux = aux->next;\n\t\tkfree(aux);\n\t}\n\twhile ((aux = context->aux_pids)) {\n\t\tcontext->aux_pids = aux->next;\n\t\tkfree(aux);\n\t}\n}\n\nstatic inline void audit_zero_context(struct audit_context *context,\n\t\t\t\t enum audit_state state)\n{\n\tuid_t loginuid = context->loginuid;\n\n\tmemset(context, 0, sizeof(*context));\n\tcontext->state = state;\n\tcontext->loginuid = loginuid;\n}\n\nstatic inline struct audit_context *audit_alloc_context(enum audit_state state)\n{\n\tstruct audit_context *context;\n\n\tif (!(context = kmalloc(sizeof(*context), GFP_KERNEL)))\n\t\treturn NULL;\n\taudit_zero_context(context, state);\n\treturn context;\n}\n\n/**\n * audit_alloc - allocate an audit context block for a task\n * @tsk: task\n *\n * Filter on the task information and allocate a per-task audit context\n * if necessary. Doing so turns on system call auditing for the\n * specified task. This is called from copy_process, so no lock is\n * needed.\n */\nint audit_alloc(struct task_struct *tsk)\n{\n\tstruct audit_context *context;\n\tenum audit_state state;\n\n\tif (likely(!audit_enabled))\n\t\treturn 0; /* Return if not auditing. */\n\n\tstate = audit_filter_task(tsk);\n\tif (likely(state == AUDIT_DISABLED))\n\t\treturn 0;\n\n\tif (!(context = audit_alloc_context(state))) {\n\t\taudit_log_lost(\"out of memory in audit_alloc\");\n\t\treturn -ENOMEM;\n\t}\n\n\t\t\t\t/* Preserve login uid */\n\tcontext->loginuid = -1;\n\tif (current->audit_context)\n\t\tcontext->loginuid = current->audit_context->loginuid;\n\n\ttsk->audit_context = context;\n\tset_tsk_thread_flag(tsk, TIF_SYSCALL_AUDIT);\n\treturn 0;\n}\n\nstatic inline void audit_free_context(struct audit_context *context)\n{\n\tstruct audit_context *previous;\n\tint\t\t count = 0;\n\n\tdo {\n\t\tprevious = context->previous;\n\t\tif (previous || (count && count < 10)) {\n\t\t\t++count;\n\t\t\tprintk(KERN_ERR \"audit(:%d): major=%d name_count=%d:\"\n\t\t\t \" freeing multiple contexts (%d)\\n\",\n\t\t\t context->serial, context->major,\n\t\t\t context->name_count, count);\n\t\t}\n\t\taudit_free_names(context);\n\t\taudit_free_aux(context);\n\t\tkfree(context->filterkey);\n\t\tkfree(context);\n\t\tcontext = previous;\n\t} while (context);\n\tif (count >= 10)\n\t\tprintk(KERN_ERR \"audit: freed %d contexts\\n\", count);\n}\n\nvoid audit_log_task_context(struct audit_buffer *ab)\n{\n\tchar *ctx = NULL;\n\tunsigned len;\n\tint error;\n\tu32 sid;\n\n\tselinux_get_task_sid(current, &sid);\n\tif (!sid)\n\t\treturn;\n\n\terror = selinux_sid_to_string(sid, &ctx, &len);\n\tif (error) {\n\t\tif (error != -EINVAL)\n\t\t\tgoto error_path;\n\t\treturn;\n\t}\n\n\taudit_log_format(ab, \" subj=%s\", ctx);\n\tkfree(ctx);\n\treturn;\n\nerror_path:\n\taudit_panic(\"error in audit_log_task_context\");\n\treturn;\n}\n\nEXPORT_SYMBOL(audit_log_task_context);\n\nstatic void audit_log_task_info(struct audit_buffer *ab, struct task_struct *tsk)\n{\n\tchar name[sizeof(tsk->comm)];\n\tstruct mm_struct *mm = tsk->mm;\n\tstruct vm_area_struct *vma;\n\n\t/* tsk == current */\n\n\tget_task_comm(name, tsk);\n\taudit_log_format(ab, \" comm=\");\n\taudit_log_untrustedstring(ab, name);\n\n\tif (mm) {\n\t\tdown_read(&mm->mmap_sem);\n\t\tvma = mm->mmap;\n\t\twhile (vma) {\n\t\t\tif ((vma->vm_flags & VM_EXECUTABLE) &&\n\t\t\t vma->vm_file) {\n\t\t\t\taudit_log_d_path(ab, \"exe=\",\n\t\t\t\t\t\t vma->vm_file->f_path.dentry,\n\t\t\t\t\t\t vma->vm_file->f_path.mnt);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tvma = vma->vm_next;\n\t\t}\n\t\tup_read(&mm->mmap_sem);\n\t}\n\taudit_log_task_context(ab);\n}\n\nstatic int audit_log_pid_context(struct audit_context *context, pid_t pid,\n\t\t\t\t u32 sid)\n{\n\tstruct audit_buffer *ab;\n\tchar *s = NULL;\n\tu32 len;\n\tint rc = 0;\n\n\tab = audit_log_start(context, GFP_KERNEL, AUDIT_OBJ_PID);\n\tif (!ab)\n\t\treturn 1;\n\n\tif (selinux_sid_to_string(sid, &s, &len)) {\n\t\taudit_log_format(ab, \"opid=%d obj=(none)\", pid);\n\t\trc = 1;\n\t} else\n\t\taudit_log_format(ab, \"opid=%d obj=%s\", pid, s);\n\taudit_log_end(ab);\n\tkfree(s);\n\n\treturn rc;\n}\n\nstatic void audit_log_exit(struct audit_context *context, struct task_struct *tsk)\n{\n\tint i, call_panic = 0;\n\tstruct audit_buffer *ab;\n\tstruct audit_aux_data *aux;\n\tconst char *tty;\n\n\t/* tsk == current */\n\tcontext->pid = tsk->pid;\n\tif (!context->ppid)\n\t\tcontext->ppid = sys_getppid();\n\tcontext->uid = tsk->uid;\n\tcontext->gid = tsk->gid;\n\tcontext->euid = tsk->euid;\n\tcontext->suid = tsk->suid;\n\tcontext->fsuid = tsk->fsuid;\n\tcontext->egid = tsk->egid;\n\tcontext->sgid = tsk->sgid;\n\tcontext->fsgid = tsk->fsgid;\n\tcontext->personality = tsk->personality;\n\n\tab = audit_log_start(context, GFP_KERNEL, AUDIT_SYSCALL);\n\tif (!ab)\n\t\treturn;\t\t/* audit_panic has been called */\n\taudit_log_format(ab, \"arch=%x syscall=%d\",\n\t\t\t context->arch, context->major);\n\tif (context->personality != PER_LINUX)\n\t\taudit_log_format(ab, \" per=%lx\", context->personality);\n\tif (context->return_valid)\n\t\taudit_log_format(ab, \" success=%s exit=%ld\", \n\t\t\t\t (context->return_valid==AUDITSC_SUCCESS)?\"yes\":\"no\",\n\t\t\t\t context->return_code);\n\n\tmutex_lock(&tty_mutex);\n\tread_lock(&tasklist_lock);\n\tif (tsk->signal && tsk->signal->tty && tsk->signal->tty->name)\n\t\ttty = tsk->signal->tty->name;\n\telse\n\t\ttty = \"(none)\";\n\tread_unlock(&tasklist_lock);\n\taudit_log_format(ab,\n\t\t \" a0=%lx a1=%lx a2=%lx a3=%lx items=%d\"\n\t\t \" ppid=%d pid=%d auid=%u uid=%u gid=%u\"\n\t\t \" euid=%u suid=%u fsuid=%u\"\n\t\t \" egid=%u sgid=%u fsgid=%u tty=%s\",\n\t\t context->argv[0],\n\t\t context->argv[1],\n\t\t context->argv[2],\n\t\t context->argv[3],\n\t\t context->name_count,\n\t\t context->ppid,\n\t\t context->pid,\n\t\t context->loginuid,\n\t\t context->uid,\n\t\t context->gid,\n\t\t context->euid, context->suid, context->fsuid,\n\t\t context->egid, context->sgid, context->fsgid, tty);\n\n\tmutex_unlock(&tty_mutex);\n\n\taudit_log_task_info(ab, tsk);\n\tif (context->filterkey) {\n\t\taudit_log_format(ab, \" key=\");\n\t\taudit_log_untrustedstring(ab, context->filterkey);\n\t} else\n\t\taudit_log_format(ab, \" key=(null)\");\n\taudit_log_end(ab);\n\n\tfor (aux = context->aux; aux; aux = aux->next) {\n\n\t\tab = audit_log_start(context, GFP_KERNEL, aux->type);\n\t\tif (!ab)\n\t\t\tcontinue; /* audit_panic has been called */\n\n\t\tswitch (aux->type) {\n\t\tcase AUDIT_MQ_OPEN: {\n\t\t\tstruct audit_aux_data_mq_open *axi = (void *)aux;\n\t\t\taudit_log_format(ab,\n\t\t\t\t\"oflag=0x%x mode=%#o mq_flags=0x%lx mq_maxmsg=%ld \"\n\t\t\t\t\"mq_msgsize=%ld mq_curmsgs=%ld\",\n\t\t\t\taxi->oflag, axi->mode, axi->attr.mq_flags,\n\t\t\t\taxi->attr.mq_maxmsg, axi->attr.mq_msgsize,\n\t\t\t\taxi->attr.mq_curmsgs);\n\t\t\tbreak; }\n\n\t\tcase AUDIT_MQ_SENDRECV: {\n\t\t\tstruct audit_aux_data_mq_sendrecv *axi = (void *)aux;\n\t\t\taudit_log_format(ab,\n\t\t\t\t\"mqdes=%d msg_len=%zd msg_prio=%u \"\n\t\t\t\t\"abs_timeout_sec=%ld abs_timeout_nsec=%ld\",\n\t\t\t\taxi->mqdes, axi->msg_len, axi->msg_prio,\n\t\t\t\taxi->abs_timeout.tv_sec, axi->abs_timeout.tv_nsec);\n\t\t\tbreak; }\n\n\t\tcase AUDIT_MQ_NOTIFY: {\n\t\t\tstruct audit_aux_data_mq_notify *axi = (void *)aux;\n\t\t\taudit_log_format(ab,\n\t\t\t\t\"mqdes=%d sigev_signo=%d\",\n\t\t\t\taxi->mqdes,\n\t\t\t\taxi->notification.sigev_signo);\n\t\t\tbreak; }\n\n\t\tcase AUDIT_MQ_GETSETATTR: {\n\t\t\tstruct audit_aux_data_mq_getsetattr *axi = (void *)aux;\n\t\t\taudit_log_format(ab,\n\t\t\t\t\"mqdes=%d mq_flags=0x%lx mq_maxmsg=%ld mq_msgsize=%ld \"\n\t\t\t\t\"mq_curmsgs=%ld \",\n\t\t\t\taxi->mqdes,\n\t\t\t\taxi->mqstat.mq_flags, axi->mqstat.mq_maxmsg,\n\t\t\t\taxi->mqstat.mq_msgsize, axi->mqstat.mq_curmsgs);\n\t\t\tbreak; }\n\n\t\tcase AUDIT_IPC: {\n\t\t\tstruct audit_aux_data_ipcctl *axi = (void *)aux;\n\t\t\taudit_log_format(ab, \n\t\t\t\t \"ouid=%u ogid=%u mode=%x\",\n\t\t\t\t axi->uid, axi->gid, axi->mode);\n\t\t\tif (axi->osid != 0) {\n\t\t\t\tchar *ctx = NULL;\n\t\t\t\tu32 len;\n\t\t\t\tif (selinux_sid_to_string(\n\t\t\t\t\t\taxi->osid, &ctx, &len)) {\n\t\t\t\t\taudit_log_format(ab, \" osid=%u\",\n\t\t\t\t\t\t\taxi->osid);\n\t\t\t\t\tcall_panic = 1;\n\t\t\t\t} else\n\t\t\t\t\taudit_log_format(ab, \" obj=%s\", ctx);\n\t\t\t\tkfree(ctx);\n\t\t\t}\n\t\t\tbreak; }\n\n\t\tcase AUDIT_IPC_SET_PERM: {\n\t\t\tstruct audit_aux_data_ipcctl *axi = (void *)aux;\n\t\t\taudit_log_format(ab,\n\t\t\t\t\"qbytes=%lx ouid=%u ogid=%u mode=%x\",\n\t\t\t\taxi->qbytes, axi->uid, axi->gid, axi->mode);\n\t\t\tbreak; }\n\n\t\tcase AUDIT_EXECVE: {\n\t\t\tstruct audit_aux_data_execve *axi = (void *)aux;\n\t\t\tint i;\n\t\t\tconst char *p;\n\t\t\tfor (i = 0, p = axi->mem; i < axi->argc; i++) {\n\t\t\t\taudit_log_format(ab, \"a%d=\", i);\n\t\t\t\tp = audit_log_untrustedstring(ab, p);\n\t\t\t\taudit_log_format(ab, \"\\n\");\n\t\t\t}\n\t\t\tbreak; }\n\n\t\tcase AUDIT_SOCKETCALL: {\n\t\t\tint i;\n\t\t\tstruct audit_aux_data_socketcall *axs = (void *)aux;\n\t\t\taudit_log_format(ab, \"nargs=%d\", axs->nargs);\n\t\t\tfor (i=0; i<axs->nargs; i++)\n\t\t\t\taudit_log_format(ab, \" a%d=%lx\", i, axs->args[i]);\n\t\t\tbreak; }\n\n\t\tcase AUDIT_SOCKADDR: {\n\t\t\tstruct audit_aux_data_sockaddr *axs = (void *)aux;\n\n\t\t\taudit_log_format(ab, \"saddr=\");\n\t\t\taudit_log_hex(ab, axs->a, axs->len);\n\t\t\tbreak; }\n\n\t\tcase AUDIT_AVC_PATH: {\n\t\t\tstruct audit_aux_data_path *axi = (void *)aux;\n\t\t\taudit_log_d_path(ab, \"path=\", axi->dentry, axi->mnt);\n\t\t\tbreak; }\n\n\t\tcase AUDIT_FD_PAIR: {\n\t\t\tstruct audit_aux_data_fd_pair *axs = (void *)aux;\n\t\t\taudit_log_format(ab, \"fd0=%d fd1=%d\", axs->fd[0], axs->fd[1]);\n\t\t\tbreak; }\n\n\t\t}\n\t\taudit_log_end(ab);\n\t}\n\n\tfor (aux = context->aux_pids; aux; aux = aux->next) {\n\t\tstruct audit_aux_data_pids *axs = (void *)aux;\n\t\tint i;\n\n\t\tfor (i = 0; i < axs->pid_count; i++)\n\t\t\tif (audit_log_pid_context(context, axs->target_pid[i],\n\t\t\t\t\t\t axs->target_sid[i]))\n\t\t\t\tcall_panic = 1;\n\t}\n\n\tif (context->target_pid &&\n\t audit_log_pid_context(context, context->target_pid,\n\t\t\t\t context->target_sid))\n\t\t\tcall_panic = 1;\n\n\tif (context->pwd && context->pwdmnt) {\n\t\tab = audit_log_start(context, GFP_KERNEL, AUDIT_CWD);\n\t\tif (ab) {\n\t\t\taudit_log_d_path(ab, \"cwd=\", context->pwd, context->pwdmnt);\n\t\t\taudit_log_end(ab);\n\t\t}\n\t}\n\tfor (i = 0; i < context->name_count; i++) {\n\t\tstruct audit_names *n = &context->names[i];\n\n\t\tab = audit_log_start(context, GFP_KERNEL, AUDIT_PATH);\n\t\tif (!ab)\n\t\t\tcontinue; /* audit_panic has been called */\n\n\t\taudit_log_format(ab, \"item=%d\", i);\n\n\t\tif (n->name) {\n\t\t\tswitch(n->name_len) {\n\t\t\tcase AUDIT_NAME_FULL:\n\t\t\t\t/* log the full path */\n\t\t\t\taudit_log_format(ab, \" name=\");\n\t\t\t\taudit_log_untrustedstring(ab, n->name);\n\t\t\t\tbreak;\n\t\t\tcase 0:\n\t\t\t\t/* name was specified as a relative path and the\n\t\t\t\t * directory component is the cwd */\n\t\t\t\taudit_log_d_path(ab, \" name=\", context->pwd,\n\t\t\t\t\t\t context->pwdmnt);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t/* log the name's directory component */\n\t\t\t\taudit_log_format(ab, \" name=\");\n\t\t\t\taudit_log_n_untrustedstring(ab, n->name_len,\n\t\t\t\t\t\t\t n->name);\n\t\t\t}\n\t\t} else\n\t\t\taudit_log_format(ab, \" name=(null)\");\n\n\t\tif (n->ino != (unsigned long)-1) {\n\t\t\taudit_log_format(ab, \" inode=%lu\"\n\t\t\t\t\t \" dev=%02x:%02x mode=%#o\"\n\t\t\t\t\t \" ouid=%u ogid=%u rdev=%02x:%02x\",\n\t\t\t\t\t n->ino,\n\t\t\t\t\t MAJOR(n->dev),\n\t\t\t\t\t MINOR(n->dev),\n\t\t\t\t\t n->mode,\n\t\t\t\t\t n->uid,\n\t\t\t\t\t n->gid,\n\t\t\t\t\t MAJOR(n->rdev),\n\t\t\t\t\t MINOR(n->rdev));\n\t\t}\n\t\tif (n->osid != 0) {\n\t\t\tchar *ctx = NULL;\n\t\t\tu32 len;\n\t\t\tif (selinux_sid_to_string(\n\t\t\t\tn->osid, &ctx, &len)) {\n\t\t\t\taudit_log_format(ab, \" osid=%u\", n->osid);\n\t\t\t\tcall_panic = 2;\n\t\t\t} else\n\t\t\t\taudit_log_format(ab, \" obj=%s\", ctx);\n\t\t\tkfree(ctx);\n\t\t}\n\n\t\taudit_log_end(ab);\n\t}\n\tif (call_panic)\n\t\taudit_panic(\"error converting sid to string\");\n}\n\n/**\n * audit_free - free a per-task audit context\n * @tsk: task whose audit context block to free\n *\n * Called from copy_process and do_exit\n */\nvoid audit_free(struct task_struct *tsk)\n{\n\tstruct audit_context *context;\n\n\tcontext = audit_get_context(tsk, 0, 0);\n\tif (likely(!context))\n\t\treturn;\n\n\t/* Check for system calls that do not go through the exit\n\t * function (e.g., exit_group), then free context block. \n\t * We use GFP_ATOMIC here because we might be doing this \n\t * in the context of the idle thread */\n\t/* that can happen only if we are called from do_exit() */\n\tif (context->in_syscall && context->auditable)\n\t\taudit_log_exit(context, tsk);\n\n\taudit_free_context(context);\n}\n\n/**\n * audit_syscall_entry - fill in an audit record at syscall entry\n * @tsk: task being audited\n * @arch: architecture type\n * @major: major syscall type (function)\n * @a1: additional syscall register 1\n * @a2: additional syscall register 2\n * @a3: additional syscall register 3\n * @a4: additional syscall register 4\n *\n * Fill in audit context at syscall entry. This only happens if the\n * audit context was created when the task was created and the state or\n * filters demand the audit context be built. If the state from the\n * per-task filter or from the per-syscall filter is AUDIT_RECORD_CONTEXT,\n * then the record will be written at syscall exit time (otherwise, it\n * will only be written if another part of the kernel requests that it\n * be written).\n */\nvoid audit_syscall_entry(int arch, int major,\n\t\t\t unsigned long a1, unsigned long a2,\n\t\t\t unsigned long a3, unsigned long a4)\n{\n\tstruct task_struct *tsk = current;\n\tstruct audit_context *context = tsk->audit_context;\n\tenum audit_state state;\n\n\tBUG_ON(!context);\n\n\t/*\n\t * This happens only on certain architectures that make system\n\t * calls in kernel_thread via the entry.S interface, instead of\n\t * with direct calls. (If you are porting to a new\n\t * architecture, hitting this condition can indicate that you\n\t * got the _exit/_leave calls backward in entry.S.)\n\t *\n\t * i386 no\n\t * x86_64 no\n\t * ppc64 yes (see arch/powerpc/platforms/iseries/misc.S)\n\t *\n\t * This also happens with vm86 emulation in a non-nested manner\n\t * (entries without exits), so this case must be caught.\n\t */\n\tif (context->in_syscall) {\n\t\tstruct audit_context *newctx;\n\n#if AUDIT_DEBUG\n\t\tprintk(KERN_ERR\n\t\t \"audit(:%d) pid=%d in syscall=%d;\"\n\t\t \" entering syscall=%d\\n\",\n\t\t context->serial, tsk->pid, context->major, major);\n#endif\n\t\tnewctx = audit_alloc_context(context->state);\n\t\tif (newctx) {\n\t\t\tnewctx->previous = context;\n\t\t\tcontext\t\t = newctx;\n\t\t\ttsk->audit_context = newctx;\n\t\t} else\t{\n\t\t\t/* If we can't alloc a new context, the best we\n\t\t\t * can do is to leak memory (any pending putname\n\t\t\t * will be lost). The only other alternative is\n\t\t\t * to abandon auditing. */\n\t\t\taudit_zero_context(context, context->state);\n\t\t}\n\t}\n\tBUG_ON(context->in_syscall || context->name_count);\n\n\tif (!audit_enabled)\n\t\treturn;\n\n\tcontext->arch\t = arch;\n\tcontext->major = major;\n\tcontext->argv[0] = a1;\n\tcontext->argv[1] = a2;\n\tcontext->argv[2] = a3;\n\tcontext->argv[3] = a4;\n\n\tstate = context->state;\n\tcontext->dummy = !audit_n_rules;\n\tif (!context->dummy && (state == AUDIT_SETUP_CONTEXT || state == AUDIT_BUILD_CONTEXT))\n\t\tstate = audit_filter_syscall(tsk, context, &audit_filter_list[AUDIT_FILTER_ENTRY]);\n\tif (likely(state == AUDIT_DISABLED))\n\t\treturn;\n\n\tcontext->serial = 0;\n\tcontext->ctime = CURRENT_TIME;\n\tcontext->in_syscall = 1;\n\tcontext->auditable = !!(state == AUDIT_RECORD_CONTEXT);\n\tcontext->ppid = 0;\n}\n\n/**\n * audit_syscall_exit - deallocate audit context after a system call\n * @tsk: task being audited\n * @valid: success/failure flag\n * @return_code: syscall return value\n *\n * Tear down after system call. If the audit context has been marked as\n * auditable (either because of the AUDIT_RECORD_CONTEXT state from\n * filtering, or because some other part of the kernel write an audit\n * message), then write out the syscall information. In call cases,\n * free the names stored from getname().\n */\nvoid audit_syscall_exit(int valid, long return_code)\n{\n\tstruct task_struct *tsk = current;\n\tstruct audit_context *context;\n\n\tcontext = audit_get_context(tsk, valid, return_code);\n\n\tif (likely(!context))\n\t\treturn;\n\n\tif (context->in_syscall && context->auditable)\n\t\taudit_log_exit(context, tsk);\n\n\tcontext->in_syscall = 0;\n\tcontext->auditable = 0;\n\n\tif (context->previous) {\n\t\tstruct audit_context *new_context = context->previous;\n\t\tcontext->previous = NULL;\n\t\taudit_free_context(context);\n\t\ttsk->audit_context = new_context;\n\t} else {\n\t\taudit_free_names(context);\n\t\taudit_free_aux(context);\n\t\tcontext->aux = NULL;\n\t\tcontext->aux_pids = NULL;\n\t\tcontext->target_pid = 0;\n\t\tcontext->target_sid = 0;\n\t\tkfree(context->filterkey);\n\t\tcontext->filterkey = NULL;\n\t\ttsk->audit_context = context;\n\t}\n}\n\n/**\n * audit_getname - add a name to the list\n * @name: name to add\n *\n * Add a name to the list of audit names for this context.\n * Called from fs/namei.c:getname().\n */\nvoid __audit_getname(const char *name)\n{\n\tstruct audit_context *context = current->audit_context;\n\n\tif (IS_ERR(name) || !name)\n\t\treturn;\n\n\tif (!context->in_syscall) {\n#if AUDIT_DEBUG == 2\n\t\tprintk(KERN_ERR \"%s:%d(:%d): ignoring getname(%p)\\n\",\n\t\t __FILE__, __LINE__, context->serial, name);\n\t\tdump_stack();\n#endif\n\t\treturn;\n\t}\n\tBUG_ON(context->name_count >= AUDIT_NAMES);\n\tcontext->names[context->name_count].name = name;\n\tcontext->names[context->name_count].name_len = AUDIT_NAME_FULL;\n\tcontext->names[context->name_count].name_put = 1;\n\tcontext->names[context->name_count].ino = (unsigned long)-1;\n\tcontext->names[context->name_count].osid = 0;\n\t++context->name_count;\n\tif (!context->pwd) {\n\t\tread_lock(&current->fs->lock);\n\t\tcontext->pwd = dget(current->fs->pwd);\n\t\tcontext->pwdmnt = mntget(current->fs->pwdmnt);\n\t\tread_unlock(&current->fs->lock);\n\t}\n\t\t\n}\n\n/* audit_putname - intercept a putname request\n * @name: name to intercept and delay for putname\n *\n * If we have stored the name from getname in the audit context,\n * then we delay the putname until syscall exit.\n * Called from include/linux/fs.h:putname().\n */\nvoid audit_putname(const char *name)\n{\n\tstruct audit_context *context = current->audit_context;\n\n\tBUG_ON(!context);\n\tif (!context->in_syscall) {\n#if AUDIT_DEBUG == 2\n\t\tprintk(KERN_ERR \"%s:%d(:%d): __putname(%p)\\n\",\n\t\t __FILE__, __LINE__, context->serial, name);\n\t\tif (context->name_count) {\n\t\t\tint i;\n\t\t\tfor (i = 0; i < context->name_count; i++)\n\t\t\t\tprintk(KERN_ERR \"name[%d] = %p = %s\\n\", i,\n\t\t\t\t context->names[i].name,\n\t\t\t\t context->names[i].name ?: \"(null)\");\n\t\t}\n#endif\n\t\t__putname(name);\n\t}\n#if AUDIT_DEBUG\n\telse {\n\t\t++context->put_count;\n\t\tif (context->put_count > context->name_count) {\n\t\t\tprintk(KERN_ERR \"%s:%d(:%d): major=%d\"\n\t\t\t \" in_syscall=%d putname(%p) name_count=%d\"\n\t\t\t \" put_count=%d\\n\",\n\t\t\t __FILE__, __LINE__,\n\t\t\t context->serial, context->major,\n\t\t\t context->in_syscall, name, context->name_count,\n\t\t\t context->put_count);\n\t\t\tdump_stack();\n\t\t}\n\t}\n#endif\n}\n\nstatic int audit_inc_name_count(struct audit_context *context,\n\t\t\t\tconst struct inode *inode)\n{\n\tif (context->name_count >= AUDIT_NAMES) {\n\t\tif (inode)\n\t\t\tprintk(KERN_DEBUG \"name_count maxed, losing inode data: \"\n\t\t\t \"dev=%02x:%02x, inode=%lu\",\n\t\t\t MAJOR(inode->i_sb->s_dev),\n\t\t\t MINOR(inode->i_sb->s_dev),\n\t\t\t inode->i_ino);\n\n\t\telse\n\t\t\tprintk(KERN_DEBUG \"name_count maxed, losing inode data\");\n\t\treturn 1;\n\t}\n\tcontext->name_count++;\n#if AUDIT_DEBUG\n\tcontext->ino_count++;\n#endif\n\treturn 0;\n}\n\n/* Copy inode data into an audit_names. */\nstatic void audit_copy_inode(struct audit_names *name, const struct inode *inode)\n{\n\tname->ino = inode->i_ino;\n\tname->dev = inode->i_sb->s_dev;\n\tname->mode = inode->i_mode;\n\tname->uid = inode->i_uid;\n\tname->gid = inode->i_gid;\n\tname->rdev = inode->i_rdev;\n\tselinux_get_inode_sid(inode, &name->osid);\n}\n\n/**\n * audit_inode - store the inode and device from a lookup\n * @name: name being audited\n * @inode: inode being audited\n *\n * Called from fs/namei.c:path_lookup().\n */\nvoid __audit_inode(const char *name, const struct inode *inode)\n{\n\tint idx;\n\tstruct audit_context *context = current->audit_context;\n\n\tif (!context->in_syscall)\n\t\treturn;\n\tif (context->name_count\n\t && context->names[context->name_count-1].name\n\t && context->names[context->name_count-1].name == name)\n\t\tidx = context->name_count - 1;\n\telse if (context->name_count > 1\n\t\t && context->names[context->name_count-2].name\n\t\t && context->names[context->name_count-2].name == name)\n\t\tidx = context->name_count - 2;\n\telse {\n\t\t/* FIXME: how much do we care about inodes that have no\n\t\t * associated name? */\n\t\tif (audit_inc_name_count(context, inode))\n\t\t\treturn;\n\t\tidx = context->name_count - 1;\n\t\tcontext->names[idx].name = NULL;\n\t}\n\taudit_copy_inode(&context->names[idx], inode);\n}\n\n/**\n * audit_inode_child - collect inode info for created/removed objects\n * @dname: inode's dentry name\n * @inode: inode being audited\n * @parent: inode of dentry parent\n *\n * For syscalls that create or remove filesystem objects, audit_inode\n * can only collect information for the filesystem object's parent.\n * This call updates the audit context with the child's information.\n * Syscalls that create a new filesystem object must be hooked after\n * the object is created. Syscalls that remove a filesystem object\n * must be hooked prior, in order to capture the target inode during\n * unsuccessful attempts.\n */\nvoid __audit_inode_child(const char *dname, const struct inode *inode,\n\t\t\t const struct inode *parent)\n{\n\tint idx;\n\tstruct audit_context *context = current->audit_context;\n\tconst char *found_parent = NULL, *found_child = NULL;\n\tint dirlen = 0;\n\n\tif (!context->in_syscall)\n\t\treturn;\n\n\t/* determine matching parent */\n\tif (!dname)\n\t\tgoto add_names;\n\n\t/* parent is more likely, look for it first */\n\tfor (idx = 0; idx < context->name_count; idx++) {\n\t\tstruct audit_names *n = &context->names[idx];\n\n\t\tif (!n->name)\n\t\t\tcontinue;\n\n\t\tif (n->ino == parent->i_ino &&\n\t\t !audit_compare_dname_path(dname, n->name, &dirlen)) {\n\t\t\tn->name_len = dirlen; /* update parent data in place */\n\t\t\tfound_parent = n->name;\n\t\t\tgoto add_names;\n\t\t}\n\t}\n\n\t/* no matching parent, look for matching child */\n\tfor (idx = 0; idx < context->name_count; idx++) {\n\t\tstruct audit_names *n = &context->names[idx];\n\n\t\tif (!n->name)\n\t\t\tcontinue;\n\n\t\t/* strcmp() is the more likely scenario */\n\t\tif (!strcmp(dname, n->name) ||\n\t\t !audit_compare_dname_path(dname, n->name, &dirlen)) {\n\t\t\tif (inode)\n\t\t\t\taudit_copy_inode(n, inode);\n\t\t\telse\n\t\t\t\tn->ino = (unsigned long)-1;\n\t\t\tfound_child = n->name;\n\t\t\tgoto add_names;\n\t\t}\n\t}\n\nadd_names:\n\tif (!found_parent) {\n\t\tif (audit_inc_name_count(context, parent))\n\t\t\treturn;\n\t\tidx = context->name_count - 1;\n\t\tcontext->names[idx].name = NULL;\n\t\taudit_copy_inode(&context->names[idx], parent);\n\t}\n\n\tif (!found_child) {\n\t\tif (audit_inc_name_count(context, inode))\n\t\t\treturn;\n\t\tidx = context->name_count - 1;\n\n\t\t/* Re-use the name belonging to the slot for a matching parent\n\t\t * directory. All names for this context are relinquished in\n\t\t * audit_free_names() */\n\t\tif (found_parent) {\n\t\t\tcontext->names[idx].name = found_parent;\n\t\t\tcontext->names[idx].name_len = AUDIT_NAME_FULL;\n\t\t\t/* don't call __putname() */\n\t\t\tcontext->names[idx].name_put = 0;\n\t\t} else {\n\t\t\tcontext->names[idx].name = NULL;\n\t\t}\n\n\t\tif (inode)\n\t\t\taudit_copy_inode(&context->names[idx], inode);\n\t\telse\n\t\t\tcontext->names[idx].ino = (unsigned long)-1;\n\t}\n}\n\n/**\n * auditsc_get_stamp - get local copies of audit_context values\n * @ctx: audit_context for the task\n * @t: timespec to store time recorded in the audit_context\n * @serial: serial value that is recorded in the audit_context\n *\n * Also sets the context as auditable.\n */\nvoid auditsc_get_stamp(struct audit_context *ctx,\n\t\t struct timespec *t, unsigned int *serial)\n{\n\tif (!ctx->serial)\n\t\tctx->serial = audit_serial();\n\tt->tv_sec = ctx->ctime.tv_sec;\n\tt->tv_nsec = ctx->ctime.tv_nsec;\n\t*serial = ctx->serial;\n\tctx->auditable = 1;\n}\n\n/**\n * audit_set_loginuid - set a task's audit_context loginuid\n * @task: task whose audit context is being modified\n * @loginuid: loginuid value\n *\n * Returns 0.\n *\n * Called (set) from fs/proc/base.c::proc_loginuid_write().\n */\nint audit_set_loginuid(struct task_struct *task, uid_t loginuid)\n{\n\tstruct audit_context *context = task->audit_context;\n\n\tif (context) {\n\t\t/* Only log if audit is enabled */\n\t\tif (context->in_syscall) {\n\t\t\tstruct audit_buffer *ab;\n\n\t\t\tab = audit_log_start(NULL, GFP_KERNEL, AUDIT_LOGIN);\n\t\t\tif (ab) {\n\t\t\t\taudit_log_format(ab, \"login pid=%d uid=%u \"\n\t\t\t\t\t\"old auid=%u new auid=%u\",\n\t\t\t\t\ttask->pid, task->uid,\n\t\t\t\t\tcontext->loginuid, loginuid);\n\t\t\t\taudit_log_end(ab);\n\t\t\t}\n\t\t}\n\t\tcontext->loginuid = loginuid;\n\t}\n\treturn 0;\n}\n\n/**\n * audit_get_loginuid - get the loginuid for an audit_context\n * @ctx: the audit_context\n *\n * Returns the context's loginuid or -1 if @ctx is NULL.\n */\nuid_t audit_get_loginuid(struct audit_context *ctx)\n{\n\treturn ctx ? ctx->loginuid : -1;\n}\n\nEXPORT_SYMBOL(audit_get_loginuid);\n\n/**\n * __audit_mq_open - record audit data for a POSIX MQ open\n * @oflag: open flag\n * @mode: mode bits\n * @u_attr: queue attributes\n *\n * Returns 0 for success or NULL context or < 0 on error.\n */\nint __audit_mq_open(int oflag, mode_t mode, struct mq_attr __user *u_attr)\n{\n\tstruct audit_aux_data_mq_open *ax;\n\tstruct audit_context *context = current->audit_context;\n\n\tif (!audit_enabled)\n\t\treturn 0;\n\n\tif (likely(!context))\n\t\treturn 0;\n\n\tax = kmalloc(sizeof(*ax), GFP_ATOMIC);\n\tif (!ax)\n\t\treturn -ENOMEM;\n\n\tif (u_attr != NULL) {\n\t\tif (copy_from_user(&ax->attr, u_attr, sizeof(ax->attr))) {\n\t\t\tkfree(ax);\n\t\t\treturn -EFAULT;\n\t\t}\n\t} else\n\t\tmemset(&ax->attr, 0, sizeof(ax->attr));\n\n\tax->oflag = oflag;\n\tax->mode = mode;\n\n\tax->d.type = AUDIT_MQ_OPEN;\n\tax->d.next = context->aux;\n\tcontext->aux = (void *)ax;\n\treturn 0;\n}\n\n/**\n * __audit_mq_timedsend - record audit data for a POSIX MQ timed send\n * @mqdes: MQ descriptor\n * @msg_len: Message length\n * @msg_prio: Message priority\n * @u_abs_timeout: Message timeout in absolute time\n *\n * Returns 0 for success or NULL context or < 0 on error.\n */\nint __audit_mq_timedsend(mqd_t mqdes, size_t msg_len, unsigned int msg_prio,\n\t\t\tconst struct timespec __user *u_abs_timeout)\n{\n\tstruct audit_aux_data_mq_sendrecv *ax;\n\tstruct audit_context *context = current->audit_context;\n\n\tif (!audit_enabled)\n\t\treturn 0;\n\n\tif (likely(!context))\n\t\treturn 0;\n\n\tax = kmalloc(sizeof(*ax), GFP_ATOMIC);\n\tif (!ax)\n\t\treturn -ENOMEM;\n\n\tif (u_abs_timeout != NULL) {\n\t\tif (copy_from_user(&ax->abs_timeout, u_abs_timeout, sizeof(ax->abs_timeout))) {\n\t\t\tkfree(ax);\n\t\t\treturn -EFAULT;\n\t\t}\n\t} else\n\t\tmemset(&ax->abs_timeout, 0, sizeof(ax->abs_timeout));\n\n\tax->mqdes = mqdes;\n\tax->msg_len = msg_len;\n\tax->msg_prio = msg_prio;\n\n\tax->d.type = AUDIT_MQ_SENDRECV;\n\tax->d.next = context->aux;\n\tcontext->aux = (void *)ax;\n\treturn 0;\n}\n\n/**\n * __audit_mq_timedreceive - record audit data for a POSIX MQ timed receive\n * @mqdes: MQ descriptor\n * @msg_len: Message length\n * @u_msg_prio: Message priority\n * @u_abs_timeout: Message timeout in absolute time\n *\n * Returns 0 for success or NULL context or < 0 on error.\n */\nint __audit_mq_timedreceive(mqd_t mqdes, size_t msg_len,\n\t\t\t\tunsigned int __user *u_msg_prio,\n\t\t\t\tconst struct timespec __user *u_abs_timeout)\n{\n\tstruct audit_aux_data_mq_sendrecv *ax;\n\tstruct audit_context *context = current->audit_context;\n\n\tif (!audit_enabled)\n\t\treturn 0;\n\n\tif (likely(!context))\n\t\treturn 0;\n\n\tax = kmalloc(sizeof(*ax), GFP_ATOMIC);\n\tif (!ax)\n\t\treturn -ENOMEM;\n\n\tif (u_msg_prio != NULL) {\n\t\tif (get_user(ax->msg_prio, u_msg_prio)) {\n\t\t\tkfree(ax);\n\t\t\treturn -EFAULT;\n\t\t}\n\t} else\n\t\tax->msg_prio = 0;\n\n\tif (u_abs_timeout != NULL) {\n\t\tif (copy_from_user(&ax->abs_timeout, u_abs_timeout, sizeof(ax->abs_timeout))) {\n\t\t\tkfree(ax);\n\t\t\treturn -EFAULT;\n\t\t}\n\t} else\n\t\tmemset(&ax->abs_timeout, 0, sizeof(ax->abs_timeout));\n\n\tax->mqdes = mqdes;\n\tax->msg_len = msg_len;\n\n\tax->d.type = AUDIT_MQ_SENDRECV;\n\tax->d.next = context->aux;\n\tcontext->aux = (void *)ax;\n\treturn 0;\n}\n\n/**\n * __audit_mq_notify - record audit data for a POSIX MQ notify\n * @mqdes: MQ descriptor\n * @u_notification: Notification event\n *\n * Returns 0 for success or NULL context or < 0 on error.\n */\n\nint __audit_mq_notify(mqd_t mqdes, const struct sigevent __user *u_notification)\n{\n\tstruct audit_aux_data_mq_notify *ax;\n\tstruct audit_context *context = current->audit_context;\n\n\tif (!audit_enabled)\n\t\treturn 0;\n\n\tif (likely(!context))\n\t\treturn 0;\n\n\tax = kmalloc(sizeof(*ax), GFP_ATOMIC);\n\tif (!ax)\n\t\treturn -ENOMEM;\n\n\tif (u_notification != NULL) {\n\t\tif (copy_from_user(&ax->notification, u_notification, sizeof(ax->notification))) {\n\t\t\tkfree(ax);\n\t\t\treturn -EFAULT;\n\t\t}\n\t} else\n\t\tmemset(&ax->notification, 0, sizeof(ax->notification));\n\n\tax->mqdes = mqdes;\n\n\tax->d.type = AUDIT_MQ_NOTIFY;\n\tax->d.next = context->aux;\n\tcontext->aux = (void *)ax;\n\treturn 0;\n}\n\n/**\n * __audit_mq_getsetattr - record audit data for a POSIX MQ get/set attribute\n * @mqdes: MQ descriptor\n * @mqstat: MQ flags\n *\n * Returns 0 for success or NULL context or < 0 on error.\n */\nint __audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat)\n{\n\tstruct audit_aux_data_mq_getsetattr *ax;\n\tstruct audit_context *context = current->audit_context;\n\n\tif (!audit_enabled)\n\t\treturn 0;\n\n\tif (likely(!context))\n\t\treturn 0;\n\n\tax = kmalloc(sizeof(*ax), GFP_ATOMIC);\n\tif (!ax)\n\t\treturn -ENOMEM;\n\n\tax->mqdes = mqdes;\n\tax->mqstat = *mqstat;\n\n\tax->d.type = AUDIT_MQ_GETSETATTR;\n\tax->d.next = context->aux;\n\tcontext->aux = (void *)ax;\n\treturn 0;\n}\n\n/**\n * audit_ipc_obj - record audit data for ipc object\n * @ipcp: ipc permissions\n *\n * Returns 0 for success or NULL context or < 0 on error.\n */\nint __audit_ipc_obj(struct kern_ipc_perm *ipcp)\n{\n\tstruct audit_aux_data_ipcctl *ax;\n\tstruct audit_context *context = current->audit_context;\n\n\tax = kmalloc(sizeof(*ax), GFP_ATOMIC);\n\tif (!ax)\n\t\treturn -ENOMEM;\n\n\tax->uid = ipcp->uid;\n\tax->gid = ipcp->gid;\n\tax->mode = ipcp->mode;\n\tselinux_get_ipc_sid(ipcp, &ax->osid);\n\n\tax->d.type = AUDIT_IPC;\n\tax->d.next = context->aux;\n\tcontext->aux = (void *)ax;\n\treturn 0;\n}\n\n/**\n * audit_ipc_set_perm - record audit data for new ipc permissions\n * @qbytes: msgq bytes\n * @uid: msgq user id\n * @gid: msgq group id\n * @mode: msgq mode (permissions)\n *\n * Returns 0 for success or NULL context or < 0 on error.\n */\nint __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode)\n{\n\tstruct audit_aux_data_ipcctl *ax;\n\tstruct audit_context *context = current->audit_context;\n\n\tax = kmalloc(sizeof(*ax), GFP_ATOMIC);\n\tif (!ax)\n\t\treturn -ENOMEM;\n\n\tax->qbytes = qbytes;\n\tax->uid = uid;\n\tax->gid = gid;\n\tax->mode = mode;\n\n\tax->d.type = AUDIT_IPC_SET_PERM;\n\tax->d.next = context->aux;\n\tcontext->aux = (void *)ax;\n\treturn 0;\n}\n\nint audit_bprm(struct linux_binprm *bprm)\n{\n\tstruct audit_aux_data_execve *ax;\n\tstruct audit_context *context = current->audit_context;\n\tunsigned long p, next;\n\tvoid *to;\n\n\tif (likely(!audit_enabled || !context || context->dummy))\n\t\treturn 0;\n\n\tax = kmalloc(sizeof(*ax) + PAGE_SIZE * MAX_ARG_PAGES - bprm->p,\n\t\t\t\tGFP_KERNEL);\n\tif (!ax)\n\t\treturn -ENOMEM;\n\n\tax->argc = bprm->argc;\n\tax->envc = bprm->envc;\n\tfor (p = bprm->p, to = ax->mem; p < MAX_ARG_PAGES*PAGE_SIZE; p = next) {\n\t\tstruct page *page = bprm->page[p / PAGE_SIZE];\n\t\tvoid *kaddr = kmap(page);\n\t\tnext = (p + PAGE_SIZE) & ~(PAGE_SIZE - 1);\n\t\tmemcpy(to, kaddr + (p & (PAGE_SIZE - 1)), next - p);\n\t\tto += next - p;\n\t\tkunmap(page);\n\t}\n\n\tax->d.type = AUDIT_EXECVE;\n\tax->d.next = context->aux;\n\tcontext->aux = (void *)ax;\n\treturn 0;\n}\n\n\n/**\n * audit_socketcall - record audit data for sys_socketcall\n * @nargs: number of args\n * @args: args array\n *\n * Returns 0 for success or NULL context or < 0 on error.\n */\nint audit_socketcall(int nargs, unsigned long *args)\n{\n\tstruct audit_aux_data_socketcall *ax;\n\tstruct audit_context *context = current->audit_context;\n\n\tif (likely(!context || context->dummy))\n\t\treturn 0;\n\n\tax = kmalloc(sizeof(*ax) + nargs * sizeof(unsigned long), GFP_KERNEL);\n\tif (!ax)\n\t\treturn -ENOMEM;\n\n\tax->nargs = nargs;\n\tmemcpy(ax->args, args, nargs * sizeof(unsigned long));\n\n\tax->d.type = AUDIT_SOCKETCALL;\n\tax->d.next = context->aux;\n\tcontext->aux = (void *)ax;\n\treturn 0;\n}\n\n/**\n * __audit_fd_pair - record audit data for pipe and socketpair\n * @fd1: the first file descriptor\n * @fd2: the second file descriptor\n *\n * Returns 0 for success or NULL context or < 0 on error.\n */\nint __audit_fd_pair(int fd1, int fd2)\n{\n\tstruct audit_context *context = current->audit_context;\n\tstruct audit_aux_data_fd_pair *ax;\n\n\tif (likely(!context)) {\n\t\treturn 0;\n\t}\n\n\tax = kmalloc(sizeof(*ax), GFP_KERNEL);\n\tif (!ax) {\n\t\treturn -ENOMEM;\n\t}\n\n\tax->fd[0] = fd1;\n\tax->fd[1] = fd2;\n\n\tax->d.type = AUDIT_FD_PAIR;\n\tax->d.next = context->aux;\n\tcontext->aux = (void *)ax;\n\treturn 0;\n}\n\n/**\n * audit_sockaddr - record audit data for sys_bind, sys_connect, sys_sendto\n * @len: data length in user space\n * @a: data address in kernel space\n *\n * Returns 0 for success or NULL context or < 0 on error.\n */\nint audit_sockaddr(int len, void *a)\n{\n\tstruct audit_aux_data_sockaddr *ax;\n\tstruct audit_context *context = current->audit_context;\n\n\tif (likely(!context || context->dummy))\n\t\treturn 0;\n\n\tax = kmalloc(sizeof(*ax) + len, GFP_KERNEL);\n\tif (!ax)\n\t\treturn -ENOMEM;\n\n\tax->len = len;\n\tmemcpy(ax->a, a, len);\n\n\tax->d.type = AUDIT_SOCKADDR;\n\tax->d.next = context->aux;\n\tcontext->aux = (void *)ax;\n\treturn 0;\n}\n\nvoid __audit_ptrace(struct task_struct *t)\n{\n\tstruct audit_context *context = current->audit_context;\n\n\tcontext->target_pid = t->pid;\n\tselinux_get_task_sid(t, &context->target_sid);\n}\n\n/**\n * audit_avc_path - record the granting or denial of permissions\n * @dentry: dentry to record\n * @mnt: mnt to record\n *\n * Returns 0 for success or NULL context or < 0 on error.\n *\n * Called from security/selinux/avc.c::avc_audit()\n */\nint audit_avc_path(struct dentry *dentry, struct vfsmount *mnt)\n{\n\tstruct audit_aux_data_path *ax;\n\tstruct audit_context *context = current->audit_context;\n\n\tif (likely(!context))\n\t\treturn 0;\n\n\tax = kmalloc(sizeof(*ax), GFP_ATOMIC);\n\tif (!ax)\n\t\treturn -ENOMEM;\n\n\tax->dentry = dget(dentry);\n\tax->mnt = mntget(mnt);\n\n\tax->d.type = AUDIT_AVC_PATH;\n\tax->d.next = context->aux;\n\tcontext->aux = (void *)ax;\n\treturn 0;\n}\n\n/**\n * audit_signal_info - record signal info for shutting down audit subsystem\n * @sig: signal value\n * @t: task being signaled\n *\n * If the audit subsystem is being terminated, record the task (pid)\n * and uid that is doing that.\n */\nint __audit_signal_info(int sig, struct task_struct *t)\n{\n\tstruct audit_aux_data_pids *axp;\n\tstruct task_struct *tsk = current;\n\tstruct audit_context *ctx = tsk->audit_context;\n\textern pid_t audit_sig_pid;\n\textern uid_t audit_sig_uid;\n\textern u32 audit_sig_sid;\n\n\tif (audit_pid && t->tgid == audit_pid) {\n\t\tif (sig == SIGTERM || sig == SIGHUP || sig == SIGUSR1) {\n\t\t\taudit_sig_pid = tsk->pid;\n\t\t\tif (ctx)\n\t\t\t\taudit_sig_uid = ctx->loginuid;\n\t\t\telse\n\t\t\t\taudit_sig_uid = tsk->uid;\n\t\t\tselinux_get_task_sid(tsk, &audit_sig_sid);\n\t\t}\n\t\tif (!audit_signals || audit_dummy_context())\n\t\t\treturn 0;\n\t}\n\n\t/* optimize the common case by putting first signal recipient directly\n\t * in audit_context */\n\tif (!ctx->target_pid) {\n\t\tctx->target_pid = t->tgid;\n\t\tselinux_get_task_sid(t, &ctx->target_sid);\n\t\treturn 0;\n\t}\n\n\taxp = (void *)ctx->aux_pids;\n\tif (!axp || axp->pid_count == AUDIT_AUX_PIDS) {\n\t\taxp = kzalloc(sizeof(*axp), GFP_ATOMIC);\n\t\tif (!axp)\n\t\t\treturn -ENOMEM;\n\n\t\taxp->d.type = AUDIT_OBJ_PID;\n\t\taxp->d.next = ctx->aux_pids;\n\t\tctx->aux_pids = (void *)axp;\n\t}\n\tBUG_ON(axp->pid_count > AUDIT_AUX_PIDS);\n\n\taxp->target_pid[axp->pid_count] = t->tgid;\n\tselinux_get_task_sid(t, &axp->target_sid[axp->pid_count]);\n\taxp->pid_count++;\n\n\treturn 0;\n}\n\n/**\n * audit_core_dumps - record information about processes that end abnormally\n * @sig: signal value\n *\n * If a process ends with a core dump, something fishy is going on and we\n * should record the event for investigation.\n */\nvoid audit_core_dumps(long signr)\n{\n\tstruct audit_buffer *ab;\n\tu32 sid;\n\n\tif (!audit_enabled)\n\t\treturn;\n\n\tif (signr == SIGQUIT)\t/* don't care for those */\n\t\treturn;\n\n\tab = audit_log_start(NULL, GFP_KERNEL, AUDIT_ANOM_ABEND);\n\taudit_log_format(ab, \"auid=%u uid=%u gid=%u\",\n\t\t\taudit_get_loginuid(current->audit_context),\n\t\t\tcurrent->uid, current->gid);\n\tselinux_get_task_sid(current, &sid);\n\tif (sid) {\n\t\tchar *ctx = NULL;\n\t\tu32 len;\n\n\t\tif (selinux_sid_to_string(sid, &ctx, &len))\n\t\t\taudit_log_format(ab, \" ssid=%u\", sid);\n\t\telse\n\t\t\taudit_log_format(ab, \" subj=%s\", ctx);\n\t\tkfree(ctx);\n\t}\n\taudit_log_format(ab, \" pid=%d comm=\", current->pid);\n\taudit_log_untrustedstring(ab, current->comm);\n\taudit_log_format(ab, \" sig=%ld\", signr);\n\taudit_log_end(ab);\n}\n/*\n * linux/kernel/capability.c\n *\n * Copyright (C) 1997 Andrew Main <zefram@fysh.org>\n *\n * Integrated into 2.1.97+, Andrew G. Morgan <morgan@transmeta.com>\n * 30 May 2002:\tCleanup, Robert M. Love <rml@tech9.net>\n */ \n\n#include <linux/capability.h>\n#include <linux/mm.h>\n#include <linux/module.h>\n#include <linux/security.h>\n#include <linux/syscalls.h>\n#include <asm/uaccess.h>\n\nunsigned securebits = SECUREBITS_DEFAULT; /* systemwide security settings */\nkernel_cap_t cap_bset = CAP_INIT_EFF_SET;\n\nEXPORT_SYMBOL(securebits);\nEXPORT_SYMBOL(cap_bset);\n\n/*\n * This lock protects task->cap_* for all tasks including current.\n * Locking rule: acquire this prior to tasklist_lock.\n */\nstatic DEFINE_SPINLOCK(task_capability_lock);\n\n/*\n * For sys_getproccap() and sys_setproccap(), any of the three\n * capability set pointers may be NULL -- indicating that that set is\n * uninteresting and/or not to be changed.\n */\n\n/**\n * sys_capget - get the capabilities of a given process.\n * @header: pointer to struct that contains capability version and\n *\ttarget pid data\n * @dataptr: pointer to struct that contains the effective, permitted,\n *\tand inheritable capabilities that are returned\n *\n * Returns 0 on success and < 0 on error.\n */\nasmlinkage long sys_capget(cap_user_header_t header, cap_user_data_t dataptr)\n{\n int ret = 0;\n pid_t pid;\n __u32 version;\n struct task_struct *target;\n struct __user_cap_data_struct data;\n\n if (get_user(version, &header->version))\n\t return -EFAULT;\n\n if (version != _LINUX_CAPABILITY_VERSION) {\n\t if (put_user(_LINUX_CAPABILITY_VERSION, &header->version))\n\t\t return -EFAULT; \n return -EINVAL;\n }\n\n if (get_user(pid, &header->pid))\n\t return -EFAULT;\n\n if (pid < 0) \n return -EINVAL;\n\n spin_lock(&task_capability_lock);\n read_lock(&tasklist_lock); \n\n if (pid && pid != current->pid) {\n\t target = find_task_by_pid(pid);\n\t if (!target) {\n\t ret = -ESRCH;\n\t goto out;\n\t }\n } else\n\t target = current;\n\n ret = security_capget(target, &data.effective, &data.inheritable, &data.permitted);\n\nout:\n read_unlock(&tasklist_lock); \n spin_unlock(&task_capability_lock);\n\n if (!ret && copy_to_user(dataptr, &data, sizeof data))\n return -EFAULT; \n\n return ret;\n}\n\n/*\n * cap_set_pg - set capabilities for all processes in a given process\n * group. We call this holding task_capability_lock and tasklist_lock.\n */\nstatic inline int cap_set_pg(int pgrp_nr, kernel_cap_t *effective,\n\t\t\t kernel_cap_t *inheritable,\n\t\t\t kernel_cap_t *permitted)\n{\n\tstruct task_struct *g, *target;\n\tint ret = -EPERM;\n\tint found = 0;\n\tstruct pid *pgrp;\n\n\tpgrp = find_pid(pgrp_nr);\n\tdo_each_pid_task(pgrp, PIDTYPE_PGID, g) {\n\t\ttarget = g;\n\t\twhile_each_thread(g, target) {\n\t\t\tif (!security_capset_check(target, effective,\n\t\t\t\t\t\t\tinheritable,\n\t\t\t\t\t\t\tpermitted)) {\n\t\t\t\tsecurity_capset_set(target, effective,\n\t\t\t\t\t\t\tinheritable,\n\t\t\t\t\t\t\tpermitted);\n\t\t\t\tret = 0;\n\t\t\t}\n\t\t\tfound = 1;\n\t\t}\n\t} while_each_pid_task(pgrp, PIDTYPE_PGID, g);\n\n\tif (!found)\n\t ret = 0;\n\treturn ret;\n}\n\n/*\n * cap_set_all - set capabilities for all processes other than init\n * and self. We call this holding task_capability_lock and tasklist_lock.\n */\nstatic inline int cap_set_all(kernel_cap_t *effective,\n\t\t\t kernel_cap_t *inheritable,\n\t\t\t kernel_cap_t *permitted)\n{\n struct task_struct *g, *target;\n int ret = -EPERM;\n int found = 0;\n\n do_each_thread(g, target) {\n if (target == current || is_init(target))\n continue;\n found = 1;\n\t if (security_capset_check(target, effective, inheritable,\n\t\t\t\t\t\tpermitted))\n\t\t continue;\n\t ret = 0;\n\t security_capset_set(target, effective, inheritable, permitted);\n } while_each_thread(g, target);\n\n if (!found)\n\t ret = 0;\n return ret;\n}\n\n/**\n * sys_capset - set capabilities for a process or a group of processes\n * @header: pointer to struct that contains capability version and\n *\ttarget pid data\n * @data: pointer to struct that contains the effective, permitted,\n *\tand inheritable capabilities\n *\n * Set capabilities for a given process, all processes, or all\n * processes in a given process group.\n *\n * The restrictions on setting capabilities are specified as:\n *\n * [pid is for the 'target' task. 'current' is the calling task.]\n *\n * I: any raised capabilities must be a subset of the (old current) permitted\n * P: any raised capabilities must be a subset of the (old current) permitted\n * E: must be set to a subset of (new target) permitted\n *\n * Returns 0 on success and < 0 on error.\n */\nasmlinkage long sys_capset(cap_user_header_t header, const cap_user_data_t data)\n{\n kernel_cap_t inheritable, permitted, effective;\n __u32 version;\n struct task_struct *target;\n int ret;\n pid_t pid;\n\n if (get_user(version, &header->version))\n\t return -EFAULT; \n\n if (version != _LINUX_CAPABILITY_VERSION) {\n\t if (put_user(_LINUX_CAPABILITY_VERSION, &header->version))\n\t\t return -EFAULT; \n return -EINVAL;\n }\n\n if (get_user(pid, &header->pid))\n\t return -EFAULT; \n\n if (pid && pid != current->pid && !capable(CAP_SETPCAP))\n return -EPERM;\n\n if (copy_from_user(&effective, &data->effective, sizeof(effective)) ||\n\t copy_from_user(&inheritable, &data->inheritable, sizeof(inheritable)) ||\n\t copy_from_user(&permitted, &data->permitted, sizeof(permitted)))\n\t return -EFAULT; \n\n spin_lock(&task_capability_lock);\n read_lock(&tasklist_lock);\n\n if (pid > 0 && pid != current->pid) {\n target = find_task_by_pid(pid);\n if (!target) {\n ret = -ESRCH;\n goto out;\n }\n } else\n target = current;\n\n ret = 0;\n\n /* having verified that the proposed changes are legal,\n we now put them into effect. */\n if (pid < 0) {\n if (pid == -1) /* all procs other than current and init */\n ret = cap_set_all(&effective, &inheritable, &permitted);\n\n else /* all procs in process group */\n ret = cap_set_pg(-pid, &effective, &inheritable,\n\t\t \t\t\t\t\t&permitted);\n } else {\n\t ret = security_capset_check(target, &effective, &inheritable,\n\t \t\t\t\t\t\t&permitted);\n\t if (!ret)\n\t\t security_capset_set(target, &effective, &inheritable,\n\t\t \t\t\t\t\t&permitted);\n }\n\nout:\n read_unlock(&tasklist_lock);\n spin_unlock(&task_capability_lock);\n\n return ret;\n}\n\nint __capable(struct task_struct *t, int cap)\n{\n\tif (security_capable(t, cap) == 0) {\n\t\tt->flags |= PF_SUPERPRIV;\n\t\treturn 1;\n\t}\n\treturn 0;\n}\nEXPORT_SYMBOL(__capable);\n\nint capable(int cap)\n{\n\treturn __capable(current, cap);\n}\nEXPORT_SYMBOL(capable);\n/*\n * linux/kernel/compat.c\n *\n * Kernel compatibililty routines for e.g. 32 bit syscall support\n * on 64 bit kernels.\n *\n * Copyright (C) 2002-2003 Stephen Rothwell, IBM Corporation\n *\n * This program is free software; you can redistribute it and/or modify\n * it under the terms of the GNU General Public License version 2 as\n * published by the Free Software Foundation.\n */\n\n#include <linux/linkage.h>\n#include <linux/compat.h>\n#include <linux/errno.h>\n#include <linux/time.h>\n#include <linux/signal.h>\n#include <linux/sched.h>\t/* for MAX_SCHEDULE_TIMEOUT */\n#include <linux/syscalls.h>\n#include <linux/unistd.h>\n#include <linux/security.h>\n#include <linux/timex.h>\n#include <linux/migrate.h>\n#include <linux/posix-timers.h>\n\n#include <asm/uaccess.h>\n\nint get_compat_timespec(struct timespec *ts, const struct compat_timespec __user *cts)\n{\n\treturn (!access_ok(VERIFY_READ, cts, sizeof(*cts)) ||\n\t\t\t__get_user(ts->tv_sec, &cts->tv_sec) ||\n\t\t\t__get_user(ts->tv_nsec, &cts->tv_nsec)) ? -EFAULT : 0;\n}\n\nint put_compat_timespec(const struct timespec *ts, struct compat_timespec __user *cts)\n{\n\treturn (!access_ok(VERIFY_WRITE, cts, sizeof(*cts)) ||\n\t\t\t__put_user(ts->tv_sec, &cts->tv_sec) ||\n\t\t\t__put_user(ts->tv_nsec, &cts->tv_nsec)) ? -EFAULT : 0;\n}\n\nstatic long compat_nanosleep_restart(struct restart_block *restart)\n{\n\tunsigned long expire = restart->arg0, now = jiffies;\n\tstruct compat_timespec __user *rmtp;\n\n\t/* Did it expire while we handled signals? */\n\tif (!time_after(expire, now))\n\t\treturn 0;\n\n\texpire = schedule_timeout_interruptible(expire - now);\n\tif (expire == 0)\n\t\treturn 0;\n\n\trmtp = (struct compat_timespec __user *)restart->arg1;\n\tif (rmtp) {\n\t\tstruct compat_timespec ct;\n\t\tstruct timespec t;\n\n\t\tjiffies_to_timespec(expire, &t);\n\t\tct.tv_sec = t.tv_sec;\n\t\tct.tv_nsec = t.tv_nsec;\n\t\tif (copy_to_user(rmtp, &ct, sizeof(ct)))\n\t\t\treturn -EFAULT;\n\t}\n\t/* The 'restart' block is already filled in */\n\treturn -ERESTART_RESTARTBLOCK;\n}\n\nasmlinkage long compat_sys_nanosleep(struct compat_timespec __user *rqtp,\n\t\tstruct compat_timespec __user *rmtp)\n{\n\tstruct timespec t;\n\tstruct restart_block *restart;\n\tunsigned long expire;\n\n\tif (get_compat_timespec(&t, rqtp))\n\t\treturn -EFAULT;\n\n\tif ((t.tv_nsec >= 1000000000L) || (t.tv_nsec < 0) || (t.tv_sec < 0))\n\t\treturn -EINVAL;\n\n\texpire = timespec_to_jiffies(&t) + (t.tv_sec || t.tv_nsec);\n\texpire = schedule_timeout_interruptible(expire);\n\tif (expire == 0)\n\t\treturn 0;\n\n\tif (rmtp) {\n\t\tjiffies_to_timespec(expire, &t);\n\t\tif (put_compat_timespec(&t, rmtp))\n\t\t\treturn -EFAULT;\n\t}\n\trestart = &current_thread_info()->restart_block;\n\trestart->fn = compat_nanosleep_restart;\n\trestart->arg0 = jiffies + expire;\n\trestart->arg1 = (unsigned long) rmtp;\n\treturn -ERESTART_RESTARTBLOCK;\n}\n\nstatic inline long get_compat_itimerval(struct itimerval *o,\n\t\tstruct compat_itimerval __user *i)\n{\n\treturn (!access_ok(VERIFY_READ, i, sizeof(*i)) ||\n\t\t(__get_user(o->it_interval.tv_sec, &i->it_interval.tv_sec) |\n\t\t __get_user(o->it_interval.tv_usec, &i->it_interval.tv_usec) |\n\t\t __get_user(o->it_value.tv_sec, &i->it_value.tv_sec) |\n\t\t __get_user(o->it_value.tv_usec, &i->it_value.tv_usec)));\n}\n\nstatic inline long put_compat_itimerval(struct compat_itimerval __user *o,\n\t\tstruct itimerval *i)\n{\n\treturn (!access_ok(VERIFY_WRITE, o, sizeof(*o)) ||\n\t\t(__put_user(i->it_interval.tv_sec, &o->it_interval.tv_sec) |\n\t\t __put_user(i->it_interval.tv_usec, &o->it_interval.tv_usec) |\n\t\t __put_user(i->it_value.tv_sec, &o->it_value.tv_sec) |\n\t\t __put_user(i->it_value.tv_usec, &o->it_value.tv_usec)));\n}\n\nasmlinkage long compat_sys_getitimer(int which,\n\t\tstruct compat_itimerval __user *it)\n{\n\tstruct itimerval kit;\n\tint error;\n\n\terror = do_getitimer(which, &kit);\n\tif (!error && put_compat_itimerval(it, &kit))\n\t\terror = -EFAULT;\n\treturn error;\n}\n\nasmlinkage long compat_sys_setitimer(int which,\n\t\tstruct compat_itimerval __user *in,\n\t\tstruct compat_itimerval __user *out)\n{\n\tstruct itimerval kin, kout;\n\tint error;\n\n\tif (in) {\n\t\tif (get_compat_itimerval(&kin, in))\n\t\t\treturn -EFAULT;\n\t} else\n\t\tmemset(&kin, 0, sizeof(kin));\n\n\terror = do_setitimer(which, &kin, out ? &kout : NULL);\n\tif (error || !out)\n\t\treturn error;\n\tif (put_compat_itimerval(out, &kout))\n\t\treturn -EFAULT;\n\treturn 0;\n}\n\nasmlinkage long compat_sys_times(struct compat_tms __user *tbuf)\n{\n\t/*\n\t *\tIn the SMP world we might just be unlucky and have one of\n\t *\tthe times increment as we use it. Since the value is an\n\t *\tatomically safe type this is just fine. Conceptually its\n\t *\tas if the syscall took an instant longer to occur.\n\t */\n\tif (tbuf) {\n\t\tstruct compat_tms tmp;\n\t\tstruct task_struct *tsk = current;\n\t\tstruct task_struct *t;\n\t\tcputime_t utime, stime, cutime, cstime;\n\n\t\tread_lock(&tasklist_lock);\n\t\tutime = tsk->signal->utime;\n\t\tstime = tsk->signal->stime;\n\t\tt = tsk;\n\t\tdo {\n\t\t\tutime = cputime_add(utime, t->utime);\n\t\t\tstime = cputime_add(stime, t->stime);\n\t\t\tt = next_thread(t);\n\t\t} while (t != tsk);\n\n\t\t/*\n\t\t * While we have tasklist_lock read-locked, no dying thread\n\t\t * can be updating current->signal->[us]time. Instead,\n\t\t * we got their counts included in the live thread loop.\n\t\t * However, another thread can come in right now and\n\t\t * do a wait call that updates current->signal->c[us]time.\n\t\t * To make sure we always see that pair updated atomically,\n\t\t * we take the siglock around fetching them.\n\t\t */\n\t\tspin_lock_irq(&tsk->sighand->siglock);\n\t\tcutime = tsk->signal->cutime;\n\t\tcstime = tsk->signal->cstime;\n\t\tspin_unlock_irq(&tsk->sighand->siglock);\n\t\tread_unlock(&tasklist_lock);\n\n\t\ttmp.tms_utime = compat_jiffies_to_clock_t(cputime_to_jiffies(utime));\n\t\ttmp.tms_stime = compat_jiffies_to_clock_t(cputime_to_jiffies(stime));\n\t\ttmp.tms_cutime = compat_jiffies_to_clock_t(cputime_to_jiffies(cutime));\n\t\ttmp.tms_cstime = compat_jiffies_to_clock_t(cputime_to_jiffies(cstime));\n\t\tif (copy_to_user(tbuf, &tmp, sizeof(tmp)))\n\t\t\treturn -EFAULT;\n\t}\n\treturn compat_jiffies_to_clock_t(jiffies);\n}\n\n/*\n * Assumption: old_sigset_t and compat_old_sigset_t are both\n * types that can be passed to put_user()/get_user().\n */\n\nasmlinkage long compat_sys_sigpending(compat_old_sigset_t __user *set)\n{\n\told_sigset_t s;\n\tlong ret;\n\tmm_segment_t old_fs = get_fs();\n\n\tset_fs(KERNEL_DS);\n\tret = sys_sigpending((old_sigset_t __user *) &s);\n\tset_fs(old_fs);\n\tif (ret == 0)\n\t\tret = put_user(s, set);\n\treturn ret;\n}\n\nasmlinkage long compat_sys_sigprocmask(int how, compat_old_sigset_t __user *set,\n\t\tcompat_old_sigset_t __user *oset)\n{\n\told_sigset_t s;\n\tlong ret;\n\tmm_segment_t old_fs;\n\n\tif (set && get_user(s, set))\n\t\treturn -EFAULT;\n\told_fs = get_fs();\n\tset_fs(KERNEL_DS);\n\tret = sys_sigprocmask(how,\n\t\t\t set ? (old_sigset_t __user *) &s : NULL,\n\t\t\t oset ? (old_sigset_t __user *) &s : NULL);\n\tset_fs(old_fs);\n\tif (ret == 0)\n\t\tif (oset)\n\t\t\tret = put_user(s, oset);\n\treturn ret;\n}\n\nasmlinkage long compat_sys_setrlimit(unsigned int resource,\n\t\tstruct compat_rlimit __user *rlim)\n{\n\tstruct rlimit r;\n\tint ret;\n\tmm_segment_t old_fs = get_fs ();\n\n\tif (resource >= RLIM_NLIMITS) \n\t\treturn -EINVAL;\t\n\n\tif (!access_ok(VERIFY_READ, rlim, sizeof(*rlim)) ||\n\t __get_user(r.rlim_cur, &rlim->rlim_cur) ||\n\t __get_user(r.rlim_max, &rlim->rlim_max))\n\t\treturn -EFAULT;\n\n\tif (r.rlim_cur == COMPAT_RLIM_INFINITY)\n\t\tr.rlim_cur = RLIM_INFINITY;\n\tif (r.rlim_max == COMPAT_RLIM_INFINITY)\n\t\tr.rlim_max = RLIM_INFINITY;\n\tset_fs(KERNEL_DS);\n\tret = sys_setrlimit(resource, (struct rlimit __user *) &r);\n\tset_fs(old_fs);\n\treturn ret;\n}\n\n#ifdef COMPAT_RLIM_OLD_INFINITY\n\nasmlinkage long compat_sys_old_getrlimit(unsigned int resource,\n\t\tstruct compat_rlimit __user *rlim)\n{\n\tstruct rlimit r;\n\tint ret;\n\tmm_segment_t old_fs = get_fs();\n\n\tset_fs(KERNEL_DS);\n\tret = sys_old_getrlimit(resource, &r);\n\tset_fs(old_fs);\n\n\tif (!ret) {\n\t\tif (r.rlim_cur > COMPAT_RLIM_OLD_INFINITY)\n\t\t\tr.rlim_cur = COMPAT_RLIM_INFINITY;\n\t\tif (r.rlim_max > COMPAT_RLIM_OLD_INFINITY)\n\t\t\tr.rlim_max = COMPAT_RLIM_INFINITY;\n\n\t\tif (!access_ok(VERIFY_WRITE, rlim, sizeof(*rlim)) ||\n\t\t __put_user(r.rlim_cur, &rlim->rlim_cur) ||\n\t\t __put_user(r.rlim_max, &rlim->rlim_max))\n\t\t\treturn -EFAULT;\n\t}\n\treturn ret;\n}\n\n#endif\n\nasmlinkage long compat_sys_getrlimit (unsigned int resource,\n\t\tstruct compat_rlimit __user *rlim)\n{\n\tstruct rlimit r;\n\tint ret;\n\tmm_segment_t old_fs = get_fs();\n\n\tset_fs(KERNEL_DS);\n\tret = sys_getrlimit(resource, (struct rlimit __user *) &r);\n\tset_fs(old_fs);\n\tif (!ret) {\n\t\tif (r.rlim_cur > COMPAT_RLIM_INFINITY)\n\t\t\tr.rlim_cur = COMPAT_RLIM_INFINITY;\n\t\tif (r.rlim_max > COMPAT_RLIM_INFINITY)\n\t\t\tr.rlim_max = COMPAT_RLIM_INFINITY;\n\n\t\tif (!access_ok(VERIFY_WRITE, rlim, sizeof(*rlim)) ||\n\t\t __put_user(r.rlim_cur, &rlim->rlim_cur) ||\n\t\t __put_user(r.rlim_max, &rlim->rlim_max))\n\t\t\treturn -EFAULT;\n\t}\n\treturn ret;\n}\n\nint put_compat_rusage(const struct rusage *r, struct compat_rusage __user *ru)\n{\n\tif (!access_ok(VERIFY_WRITE, ru, sizeof(*ru)) ||\n\t __put_user(r->ru_utime.tv_sec, &ru->ru_utime.tv_sec) ||\n\t __put_user(r->ru_utime.tv_usec, &ru->ru_utime.tv_usec) ||\n\t __put_user(r->ru_stime.tv_sec, &ru->ru_stime.tv_sec) ||\n\t __put_user(r->ru_stime.tv_usec, &ru->ru_stime.tv_usec) ||\n\t __put_user(r->ru_maxrss, &ru->ru_maxrss) ||\n\t __put_user(r->ru_ixrss, &ru->ru_ixrss) ||\n\t __put_user(r->ru_idrss, &ru->ru_idrss) ||\n\t __put_user(r->ru_isrss, &ru->ru_isrss) ||\n\t __put_user(r->ru_minflt, &ru->ru_minflt) ||\n\t __put_user(r->ru_majflt, &ru->ru_majflt) ||\n\t __put_user(r->ru_nswap, &ru->ru_nswap) ||\n\t __put_user(r->ru_inblock, &ru->ru_inblock) ||\n\t __put_user(r->ru_oublock, &ru->ru_oublock) ||\n\t __put_user(r->ru_msgsnd, &ru->ru_msgsnd) ||\n\t __put_user(r->ru_msgrcv, &ru->ru_msgrcv) ||\n\t __put_user(r->ru_nsignals, &ru->ru_nsignals) ||\n\t __put_user(r->ru_nvcsw, &ru->ru_nvcsw) ||\n\t __put_user(r->ru_nivcsw, &ru->ru_nivcsw))\n\t\treturn -EFAULT;\n\treturn 0;\n}\n\nasmlinkage long compat_sys_getrusage(int who, struct compat_rusage __user *ru)\n{\n\tstruct rusage r;\n\tint ret;\n\tmm_segment_t old_fs = get_fs();\n\n\tset_fs(KERNEL_DS);\n\tret = sys_getrusage(who, (struct rusage __user *) &r);\n\tset_fs(old_fs);\n\n\tif (ret)\n\t\treturn ret;\n\n\tif (put_compat_rusage(&r, ru))\n\t\treturn -EFAULT;\n\n\treturn 0;\n}\n\nasmlinkage long\ncompat_sys_wait4(compat_pid_t pid, compat_uint_t __user *stat_addr, int options,\n\tstruct compat_rusage __user *ru)\n{\n\tif (!ru) {\n\t\treturn sys_wait4(pid, stat_addr, options, NULL);\n\t} else {\n\t\tstruct rusage r;\n\t\tint ret;\n\t\tunsigned int status;\n\t\tmm_segment_t old_fs = get_fs();\n\n\t\tset_fs (KERNEL_DS);\n\t\tret = sys_wait4(pid,\n\t\t\t\t(stat_addr ?\n\t\t\t\t (unsigned int __user *) &status : NULL),\n\t\t\t\toptions, (struct rusage __user *) &r);\n\t\tset_fs (old_fs);\n\n\t\tif (ret > 0) {\n\t\t\tif (put_compat_rusage(&r, ru))\n\t\t\t\treturn -EFAULT;\n\t\t\tif (stat_addr && put_user(status, stat_addr))\n\t\t\t\treturn -EFAULT;\n\t\t}\n\t\treturn ret;\n\t}\n}\n\nasmlinkage long compat_sys_waitid(int which, compat_pid_t pid,\n\t\tstruct compat_siginfo __user *uinfo, int options,\n\t\tstruct compat_rusage __user *uru)\n{\n\tsiginfo_t info;\n\tstruct rusage ru;\n\tlong ret;\n\tmm_segment_t old_fs = get_fs();\n\n\tmemset(&info, 0, sizeof(info));\n\n\tset_fs(KERNEL_DS);\n\tret = sys_waitid(which, pid, (siginfo_t __user *)&info, options,\n\t\t\t uru ? (struct rusage __user *)&ru : NULL);\n\tset_fs(old_fs);\n\n\tif ((ret < 0) || (info.si_signo == 0))\n\t\treturn ret;\n\n\tif (uru) {\n\t\tret = put_compat_rusage(&ru, uru);\n\t\tif (ret)\n\t\t\treturn ret;\n\t}\n\n\tBUG_ON(info.si_code & __SI_MASK);\n\tinfo.si_code |= __SI_CHLD;\n\treturn copy_siginfo_to_user32(uinfo, &info);\n}\n\nstatic int compat_get_user_cpu_mask(compat_ulong_t __user *user_mask_ptr,\n\t\t\t\t unsigned len, cpumask_t *new_mask)\n{\n\tunsigned long *k;\n\n\tif (len < sizeof(cpumask_t))\n\t\tmemset(new_mask, 0, sizeof(cpumask_t));\n\telse if (len > sizeof(cpumask_t))\n\t\tlen = sizeof(cpumask_t);\n\n\tk = cpus_addr(*new_mask);\n\treturn compat_get_bitmap(k, user_mask_ptr, len * 8);\n}\n\nasmlinkage long compat_sys_sched_setaffinity(compat_pid_t pid,\n\t\t\t\t\t unsigned int len,\n\t\t\t\t\t compat_ulong_t __user *user_mask_ptr)\n{\n\tcpumask_t new_mask;\n\tint retval;\n\n\tretval = compat_get_user_cpu_mask(user_mask_ptr, len, &new_mask);\n\tif (retval)\n\t\treturn retval;\n\n\treturn sched_setaffinity(pid, new_mask);\n}\n\nasmlinkage long compat_sys_sched_getaffinity(compat_pid_t pid, unsigned int len,\n\t\t\t\t\t compat_ulong_t __user *user_mask_ptr)\n{\n\tint ret;\n\tcpumask_t mask;\n\tunsigned long *k;\n\tunsigned int min_length = sizeof(cpumask_t);\n\n\tif (NR_CPUS <= BITS_PER_COMPAT_LONG)\n\t\tmin_length = sizeof(compat_ulong_t);\n\n\tif (len < min_length)\n\t\treturn -EINVAL;\n\n\tret = sched_getaffinity(pid, &mask);\n\tif (ret < 0)\n\t\treturn ret;\n\n\tk = cpus_addr(mask);\n\tret = compat_put_bitmap(user_mask_ptr, k, min_length * 8);\n\tif (ret)\n\t\treturn ret;\n\n\treturn min_length;\n}\n\nint get_compat_itimerspec(struct itimerspec *dst,\n\t\t\t const struct compat_itimerspec __user *src)\n{ \n\tif (get_compat_timespec(&dst->it_interval, &src->it_interval) ||\n\t get_compat_timespec(&dst->it_value, &src->it_value))\n\t\treturn -EFAULT;\n\treturn 0;\n} \n\nint put_compat_itimerspec(struct compat_itimerspec __user *dst,\n\t\t\t const struct itimerspec *src)\n{ \n\tif (put_compat_timespec(&src->it_interval, &dst->it_interval) ||\n\t put_compat_timespec(&src->it_value, &dst->it_value))\n\t\treturn -EFAULT;\n\treturn 0;\n} \n\nlong compat_sys_timer_create(clockid_t which_clock,\n\t\t\tstruct compat_sigevent __user *timer_event_spec,\n\t\t\ttimer_t __user *created_timer_id)\n{\n\tstruct sigevent __user *event = NULL;\n\n\tif (timer_event_spec) {\n\t\tstruct sigevent kevent;\n\n\t\tevent = compat_alloc_user_space(sizeof(*event));\n\t\tif (get_compat_sigevent(&kevent, timer_event_spec) ||\n\t\t copy_to_user(event, &kevent, sizeof(*event)))\n\t\t\treturn -EFAULT;\n\t}\n\n\treturn sys_timer_create(which_clock, event, created_timer_id);\n}\n\nlong compat_sys_timer_settime(timer_t timer_id, int flags,\n\t\t\t struct compat_itimerspec __user *new, \n\t\t\t struct compat_itimerspec __user *old)\n{ \n\tlong err;\n\tmm_segment_t oldfs;\n\tstruct itimerspec newts, oldts;\n\n\tif (!new)\n\t\treturn -EINVAL;\n\tif (get_compat_itimerspec(&newts, new))\n\t\treturn -EFAULT;\t\n\toldfs = get_fs();\n\tset_fs(KERNEL_DS);\n\terr = sys_timer_settime(timer_id, flags,\n\t\t\t\t(struct itimerspec __user *) &newts,\n\t\t\t\t(struct itimerspec __user *) &oldts);\n\tset_fs(oldfs); \n\tif (!err && old && put_compat_itimerspec(old, &oldts))\n\t\treturn -EFAULT;\n\treturn err;\n} \n\nlong compat_sys_timer_gettime(timer_t timer_id,\n\t\tstruct compat_itimerspec __user *setting)\n{ \n\tlong err;\n\tmm_segment_t oldfs;\n\tstruct itimerspec ts; \n\n\toldfs = get_fs();\n\tset_fs(KERNEL_DS);\n\terr = sys_timer_gettime(timer_id,\n\t\t\t\t(struct itimerspec __user *) &ts); \n\tset_fs(oldfs); \n\tif (!err && put_compat_itimerspec(setting, &ts))\n\t\treturn -EFAULT;\n\treturn err;\n} \n\nlong compat_sys_clock_settime(clockid_t which_clock,\n\t\tstruct compat_timespec __user *tp)\n{\n\tlong err;\n\tmm_segment_t oldfs;\n\tstruct timespec ts; \n\n\tif (get_compat_timespec(&ts, tp))\n\t\treturn -EFAULT; \n\toldfs = get_fs();\n\tset_fs(KERNEL_DS);\t\n\terr = sys_clock_settime(which_clock,\n\t\t\t\t(struct timespec __user *) &ts);\n\tset_fs(oldfs);\n\treturn err;\n} \n\nlong compat_sys_clock_gettime(clockid_t which_clock,\n\t\tstruct compat_timespec __user *tp)\n{\n\tlong err;\n\tmm_segment_t oldfs;\n\tstruct timespec ts; \n\n\toldfs = get_fs();\n\tset_fs(KERNEL_DS);\n\terr = sys_clock_gettime(which_clock,\n\t\t\t\t(struct timespec __user *) &ts);\n\tset_fs(oldfs);\n\tif (!err && put_compat_timespec(&ts, tp))\n\t\treturn -EFAULT; \n\treturn err;\n} \n\nlong compat_sys_clock_getres(clockid_t which_clock,\n\t\tstruct compat_timespec __user *tp)\n{\n\tlong err;\n\tmm_segment_t oldfs;\n\tstruct timespec ts; \n\n\toldfs = get_fs();\n\tset_fs(KERNEL_DS);\n\terr = sys_clock_getres(which_clock,\n\t\t\t (struct timespec __user *) &ts);\n\tset_fs(oldfs);\n\tif (!err && tp && put_compat_timespec(&ts, tp))\n\t\treturn -EFAULT; \n\treturn err;\n} \n\nstatic long compat_clock_nanosleep_restart(struct restart_block *restart)\n{\n\tlong err;\n\tmm_segment_t oldfs;\n\tstruct timespec tu;\n\tstruct compat_timespec *rmtp = (struct compat_timespec *)(restart->arg1);\n\n\trestart->arg1 = (unsigned long) &tu;\n\toldfs = get_fs();\n\tset_fs(KERNEL_DS);\n\terr = clock_nanosleep_restart(restart);\n\tset_fs(oldfs);\n\n\tif ((err == -ERESTART_RESTARTBLOCK) && rmtp &&\n\t put_compat_timespec(&tu, rmtp))\n\t\treturn -EFAULT;\n\n\tif (err == -ERESTART_RESTARTBLOCK) {\n\t\trestart->fn = compat_clock_nanosleep_restart;\n\t\trestart->arg1 = (unsigned long) rmtp;\n\t}\n\treturn err;\n}\n\nlong compat_sys_clock_nanosleep(clockid_t which_clock, int flags,\n\t\t\t struct compat_timespec __user *rqtp,\n\t\t\t struct compat_timespec __user *rmtp)\n{\n\tlong err;\n\tmm_segment_t oldfs;\n\tstruct timespec in, out; \n\tstruct restart_block *restart;\n\n\tif (get_compat_timespec(&in, rqtp)) \n\t\treturn -EFAULT;\n\n\toldfs = get_fs();\n\tset_fs(KERNEL_DS);\n\terr = sys_clock_nanosleep(which_clock, flags,\n\t\t\t\t (struct timespec __user *) &in,\n\t\t\t\t (struct timespec __user *) &out);\n\tset_fs(oldfs);\n\n\tif ((err == -ERESTART_RESTARTBLOCK) && rmtp &&\n\t put_compat_timespec(&out, rmtp))\n\t\treturn -EFAULT;\n\n\tif (err == -ERESTART_RESTARTBLOCK) {\n\t\trestart = &current_thread_info()->restart_block;\n\t\trestart->fn = compat_clock_nanosleep_restart;\n\t\trestart->arg1 = (unsigned long) rmtp;\n\t}\n\treturn err;\t\n} \n\n/*\n * We currently only need the following fields from the sigevent\n * structure: sigev_value, sigev_signo, sig_notify and (sometimes\n * sigev_notify_thread_id). The others are handled in user mode.\n * We also assume that copying sigev_value.sival_int is sufficient\n * to keep all the bits of sigev_value.sival_ptr intact.\n */\nint get_compat_sigevent(struct sigevent *event,\n\t\tconst struct compat_sigevent __user *u_event)\n{\n\tmemset(event, 0, sizeof(*event));\n\treturn (!access_ok(VERIFY_READ, u_event, sizeof(*u_event)) ||\n\t\t__get_user(event->sigev_value.sival_int,\n\t\t\t&u_event->sigev_value.sival_int) ||\n\t\t__get_user(event->sigev_signo, &u_event->sigev_signo) ||\n\t\t__get_user(event->sigev_notify, &u_event->sigev_notify) ||\n\t\t__get_user(event->sigev_notify_thread_id,\n\t\t\t&u_event->sigev_notify_thread_id))\n\t\t? -EFAULT : 0;\n}\n\nlong compat_get_bitmap(unsigned long *mask, const compat_ulong_t __user *umask,\n\t\t unsigned long bitmap_size)\n{\n\tint i, j;\n\tunsigned long m;\n\tcompat_ulong_t um;\n\tunsigned long nr_compat_longs;\n\n\t/* align bitmap up to nearest compat_long_t boundary */\n\tbitmap_size = ALIGN(bitmap_size, BITS_PER_COMPAT_LONG);\n\n\tif (!access_ok(VERIFY_READ, umask, bitmap_size / 8))\n\t\treturn -EFAULT;\n\n\tnr_compat_longs = BITS_TO_COMPAT_LONGS(bitmap_size);\n\n\tfor (i = 0; i < BITS_TO_LONGS(bitmap_size); i++) {\n\t\tm = 0;\n\n\t\tfor (j = 0; j < sizeof(m)/sizeof(um); j++) {\n\t\t\t/*\n\t\t\t * We dont want to read past the end of the userspace\n\t\t\t * bitmap. We must however ensure the end of the\n\t\t\t * kernel bitmap is zeroed.\n\t\t\t */\n\t\t\tif (nr_compat_longs-- > 0) {\n\t\t\t\tif (__get_user(um, umask))\n\t\t\t\t\treturn -EFAULT;\n\t\t\t} else {\n\t\t\t\tum = 0;\n\t\t\t}\n\n\t\t\tumask++;\n\t\t\tm |= (long)um << (j * BITS_PER_COMPAT_LONG);\n\t\t}\n\t\t*mask++ = m;\n\t}\n\n\treturn 0;\n}\n\nlong compat_put_bitmap(compat_ulong_t __user *umask, unsigned long *mask,\n\t\t unsigned long bitmap_size)\n{\n\tint i, j;\n\tunsigned long m;\n\tcompat_ulong_t um;\n\tunsigned long nr_compat_longs;\n\n\t/* align bitmap up to nearest compat_long_t boundary */\n\tbitmap_size = ALIGN(bitmap_size, BITS_PER_COMPAT_LONG);\n\n\tif (!access_ok(VERIFY_WRITE, umask, bitmap_size / 8))\n\t\treturn -EFAULT;\n\n\tnr_compat_longs = BITS_TO_COMPAT_LONGS(bitmap_size);\n\n\tfor (i = 0; i < BITS_TO_LONGS(bitmap_size); i++) {\n\t\tm = *mask++;\n\n\t\tfor (j = 0; j < sizeof(m)/sizeof(um); j++) {\n\t\t\tum = m;\n\n\t\t\t/*\n\t\t\t * We dont want to write past the end of the userspace\n\t\t\t * bitmap.\n\t\t\t */\n\t\t\tif (nr_compat_longs-- > 0) {\n\t\t\t\tif (__put_user(um, umask))\n\t\t\t\t\treturn -EFAULT;\n\t\t\t}\n\n\t\t\tumask++;\n\t\t\tm >>= 4*sizeof(um);\n\t\t\tm >>= 4*sizeof(um);\n\t\t}\n\t}\n\n\treturn 0;\n}\n\nvoid\nsigset_from_compat (sigset_t *set, compat_sigset_t *compat)\n{\n\tswitch (_NSIG_WORDS) {\n\tcase 4: set->sig[3] = compat->sig[6] | (((long)compat->sig[7]) << 32 );\n\tcase 3: set->sig[2] = compat->sig[4] | (((long)compat->sig[5]) << 32 );\n\tcase 2: set->sig[1] = compat->sig[2] | (((long)compat->sig[3]) << 32 );\n\tcase 1: set->sig[0] = compat->sig[0] | (((long)compat->sig[1]) << 32 );\n\t}\n}\n\nasmlinkage long\ncompat_sys_rt_sigtimedwait (compat_sigset_t __user *uthese,\n\t\tstruct compat_siginfo __user *uinfo,\n\t\tstruct compat_timespec __user *uts, compat_size_t sigsetsize)\n{\n\tcompat_sigset_t s32;\n\tsigset_t s;\n\tint sig;\n\tstruct timespec t;\n\tsiginfo_t info;\n\tlong ret, timeout = 0;\n\n\tif (sigsetsize != sizeof(sigset_t))\n\t\treturn -EINVAL;\n\n\tif (copy_from_user(&s32, uthese, sizeof(compat_sigset_t)))\n\t\treturn -EFAULT;\n\tsigset_from_compat(&s, &s32);\n\tsigdelsetmask(&s,sigmask(SIGKILL)|sigmask(SIGSTOP));\n\tsignotset(&s);\n\n\tif (uts) {\n\t\tif (get_compat_timespec (&t, uts))\n\t\t\treturn -EFAULT;\n\t\tif (t.tv_nsec >= 1000000000L || t.tv_nsec < 0\n\t\t\t\t|| t.tv_sec < 0)\n\t\t\treturn -EINVAL;\n\t}\n\n\tspin_lock_irq(&current->sighand->siglock);\n\tsig = dequeue_signal(current, &s, &info);\n\tif (!sig) {\n\t\ttimeout = MAX_SCHEDULE_TIMEOUT;\n\t\tif (uts)\n\t\t\ttimeout = timespec_to_jiffies(&t)\n\t\t\t\t+(t.tv_sec || t.tv_nsec);\n\t\tif (timeout) {\n\t\t\tcurrent->real_blocked = current->blocked;\n\t\t\tsigandsets(&current->blocked, &current->blocked, &s);\n\n\t\t\trecalc_sigpending();\n\t\t\tspin_unlock_irq(&current->sighand->siglock);\n\n\t\t\ttimeout = schedule_timeout_interruptible(timeout);\n\n\t\t\tspin_lock_irq(&current->sighand->siglock);\n\t\t\tsig = dequeue_signal(current, &s, &info);\n\t\t\tcurrent->blocked = current->real_blocked;\n\t\t\tsiginitset(&current->real_blocked, 0);\n\t\t\trecalc_sigpending();\n\t\t}\n\t}\n\tspin_unlock_irq(&current->sighand->siglock);\n\n\tif (sig) {\n\t\tret = sig;\n\t\tif (uinfo) {\n\t\t\tif (copy_siginfo_to_user32(uinfo, &info))\n\t\t\t\tret = -EFAULT;\n\t\t}\n\t}else {\n\t\tret = timeout?-EINTR:-EAGAIN;\n\t}\n\treturn ret;\n\n}\n\n#ifdef __ARCH_WANT_COMPAT_SYS_TIME\n\n/* compat_time_t is a 32 bit \"long\" and needs to get converted. */\n\nasmlinkage long compat_sys_time(compat_time_t __user * tloc)\n{\n\tcompat_time_t i;\n\tstruct timeval tv;\n\n\tdo_gettimeofday(&tv);\n\ti = tv.tv_sec;\n\n\tif (tloc) {\n\t\tif (put_user(i,tloc))\n\t\t\ti = -EFAULT;\n\t}\n\treturn i;\n}\n\nasmlinkage long compat_sys_stime(compat_time_t __user *tptr)\n{\n\tstruct timespec tv;\n\tint err;\n\n\tif (get_user(tv.tv_sec, tptr))\n\t\treturn -EFAULT;\n\n\ttv.tv_nsec = 0;\n\n\terr = security_settime(&tv, NULL);\n\tif (err)\n\t\treturn err;\n\n\tdo_settimeofday(&tv);\n\treturn 0;\n}\n\n#endif /* __ARCH_WANT_COMPAT_SYS_TIME */\n\n#ifdef __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND\nasmlinkage long compat_sys_rt_sigsuspend(compat_sigset_t __user *unewset, compat_size_t sigsetsize)\n{\n\tsigset_t newset;\n\tcompat_sigset_t newset32;\n\n\t/* XXX: Don't preclude handling different sized sigset_t's. */\n\tif (sigsetsize != sizeof(sigset_t))\n\t\treturn -EINVAL;\n\n\tif (copy_from_user(&newset32, unewset, sizeof(compat_sigset_t)))\n\t\treturn -EFAULT;\n\tsigset_from_compat(&newset, &newset32);\n\tsigdelsetmask(&newset, sigmask(SIGKILL)|sigmask(SIGSTOP));\n\n\tspin_lock_irq(&current->sighand->siglock);\n\tcurrent->saved_sigmask = current->blocked;\n\tcurrent->blocked = newset;\n\trecalc_sigpending();\n\tspin_unlock_irq(&current->sighand->siglock);\n\n\tcurrent->state = TASK_INTERRUPTIBLE;\n\tschedule();\n\tset_thread_flag(TIF_RESTORE_SIGMASK);\n\treturn -ERESTARTNOHAND;\n}\n#endif /* __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND */\n\nasmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp)\n{\n\tstruct timex txc;\n\tint ret;\n\n\tmemset(&txc, 0, sizeof(struct timex));\n\n\tif (!access_ok(VERIFY_READ, utp, sizeof(struct compat_timex)) ||\n\t\t\t__get_user(txc.modes, &utp->modes) ||\n\t\t\t__get_user(txc.offset, &utp->offset) ||\n\t\t\t__get_user(txc.freq, &utp->freq) ||\n\t\t\t__get_user(txc.maxerror, &utp->maxerror) ||\n\t\t\t__get_user(txc.esterror, &utp->esterror) ||\n\t\t\t__get_user(txc.status, &utp->status) ||\n\t\t\t__get_user(txc.constant, &utp->constant) ||\n\t\t\t__get_user(txc.precision, &utp->precision) ||\n\t\t\t__get_user(txc.tolerance, &utp->tolerance) ||\n\t\t\t__get_user(txc.time.tv_sec, &utp->time.tv_sec) ||\n\t\t\t__get_user(txc.time.tv_usec, &utp->time.tv_usec) ||\n\t\t\t__get_user(txc.tick, &utp->tick) ||\n\t\t\t__get_user(txc.ppsfreq, &utp->ppsfreq) ||\n\t\t\t__get_user(txc.jitter, &utp->jitter) ||\n\t\t\t__get_user(txc.shift, &utp->shift) ||\n\t\t\t__get_user(txc.stabil, &utp->stabil) ||\n\t\t\t__get_user(txc.jitcnt, &utp->jitcnt) ||\n\t\t\t__get_user(txc.calcnt, &utp->calcnt) ||\n\t\t\t__get_user(txc.errcnt, &utp->errcnt) ||\n\t\t\t__get_user(txc.stbcnt, &utp->stbcnt))\n\t\treturn -EFAULT;\n\n\tret = do_adjtimex(&txc);\n\n\tif (!access_ok(VERIFY_WRITE, utp, sizeof(struct compat_timex)) ||\n\t\t\t__put_user(txc.modes, &utp->modes) ||\n\t\t\t__put_user(txc.offset, &utp->offset) ||\n\t\t\t__put_user(txc.freq, &utp->freq) ||\n\t\t\t__put_user(txc.maxerror, &utp->maxerror) ||\n\t\t\t__put_user(txc.esterror, &utp->esterror) ||\n\t\t\t__put_user(txc.status, &utp->status) ||\n\t\t\t__put_user(txc.constant, &utp->constant) ||\n\t\t\t__put_user(txc.precision, &utp->precision) ||\n\t\t\t__put_user(txc.tolerance, &utp->tolerance) ||\n\t\t\t__put_user(txc.time.tv_sec, &utp->time.tv_sec) ||\n\t\t\t__put_user(txc.time.tv_usec, &utp->time.tv_usec) ||\n\t\t\t__put_user(txc.tick, &utp->tick) ||\n\t\t\t__put_user(txc.ppsfreq, &utp->ppsfreq) ||\n\t\t\t__put_user(txc.jitter, &utp->jitter) ||\n\t\t\t__put_user(txc.shift, &utp->shift) ||\n\t\t\t__put_user(txc.stabil, &utp->stabil) ||\n\t\t\t__put_user(txc.jitcnt, &utp->jitcnt) ||\n\t\t\t__put_user(txc.calcnt, &utp->calcnt) ||\n\t\t\t__put_user(txc.errcnt, &utp->errcnt) ||\n\t\t\t__put_user(txc.stbcnt, &utp->stbcnt))\n\t\tret = -EFAULT;\n\n\treturn ret;\n}\n\n#ifdef CONFIG_NUMA\nasmlinkage long compat_sys_move_pages(pid_t pid, unsigned long nr_pages,\n\t\tcompat_uptr_t __user *pages32,\n\t\tconst int __user *nodes,\n\t\tint __user *status,\n\t\tint flags)\n{\n\tconst void __user * __user *pages;\n\tint i;\n\n\tpages = compat_alloc_user_space(nr_pages * sizeof(void *));\n\tfor (i = 0; i < nr_pages; i++) {\n\t\tcompat_uptr_t p;\n\n\t\tif (get_user(p, pages32 + i) ||\n\t\t\tput_user(compat_ptr(p), pages + i))\n\t\t\treturn -EFAULT;\n\t}\n\treturn sys_move_pages(pid, nr_pages, pages, nodes, status, flags);\n}\n\nasmlinkage long compat_sys_migrate_pages(compat_pid_t pid,\n\t\t\tcompat_ulong_t maxnode,\n\t\t\tconst compat_ulong_t __user *old_nodes,\n\t\t\tconst compat_ulong_t __user *new_nodes)\n{\n\tunsigned long __user *old = NULL;\n\tunsigned long __user *new = NULL;\n\tnodemask_t tmp_mask;\n\tunsigned long nr_bits;\n\tunsigned long size;\n\n\tnr_bits = min_t(unsigned long, maxnode - 1, MAX_NUMNODES);\n\tsize = ALIGN(nr_bits, BITS_PER_LONG) / 8;\n\tif (old_nodes) {\n\t\tif (compat_get_bitmap(nodes_addr(tmp_mask), old_nodes, nr_bits))\n\t\t\treturn -EFAULT;\n\t\told = compat_alloc_user_space(new_nodes ? size * 2 : size);\n\t\tif (new_nodes)\n\t\t\tnew = old + size / sizeof(unsigned long);\n\t\tif (copy_to_user(old, nodes_addr(tmp_mask), size))\n\t\t\treturn -EFAULT;\n\t}\n\tif (new_nodes) {\n\t\tif (compat_get_bitmap(nodes_addr(tmp_mask), new_nodes, nr_bits))\n\t\t\treturn -EFAULT;\n\t\tif (new == NULL)\n\t\t\tnew = compat_alloc_user_space(size);\n\t\tif (copy_to_user(new, nodes_addr(tmp_mask), size))\n\t\t\treturn -EFAULT;\n\t}\n\treturn sys_migrate_pages(pid, nr_bits + 1, old, new);\n}\n#endif\n\nstruct compat_sysinfo {\n\ts32 uptime;\n\tu32 loads[3];\n\tu32 totalram;\n\tu32 freeram;\n\tu32 sharedram;\n\tu32 bufferram;\n\tu32 totalswap;\n\tu32 freeswap;\n\tu16 procs;\n\tu16 pad;\n\tu32 totalhigh;\n\tu32 freehigh;\n\tu32 mem_unit;\n\tchar _f[20-2*sizeof(u32)-sizeof(int)];\n};\n\nasmlinkage long\ncompat_sys_sysinfo(struct compat_sysinfo __user *info)\n{\n\tstruct sysinfo s;\n\n\tdo_sysinfo(&s);\n\n\t/* Check to see if any memory value is too large for 32-bit and scale\n\t * down if needed\n\t */\n\tif ((s.totalram >> 32) || (s.totalswap >> 32)) {\n\t\tint bitcount = 0;\n\n\t\twhile (s.mem_unit < PAGE_SIZE) {\n\t\t\ts.mem_unit <<= 1;\n\t\t\tbitcount++;\n\t\t}\n\n\t\ts.totalram >>= bitcount;\n\t\ts.freeram >>= bitcount;\n\t\ts.sharedram >>= bitcount;\n\t\ts.bufferram >>= bitcount;\n\t\ts.totalswap >>= bitcount;\n\t\ts.freeswap >>= bitcount;\n\t\ts.totalhigh >>= bitcount;\n\t\ts.freehigh >>= bitcount;\n\t}\n\n\tif (!access_ok(VERIFY_WRITE, info, sizeof(struct compat_sysinfo)) ||\n\t __put_user (s.uptime, &info->uptime) ||\n\t __put_user (s.loads[0], &info->loads[0]) ||\n\t __put_user (s.loads[1], &info->loads[1]) ||\n\t __put_user (s.loads[2], &info->loads[2]) ||\n\t __put_user (s.totalram, &info->totalram) ||\n\t __put_user (s.freeram, &info->freeram) ||\n\t __put_user (s.sharedram, &info->sharedram) ||\n\t __put_user (s.bufferram, &info->bufferram) ||\n\t __put_user (s.totalswap, &info->totalswap) ||\n\t __put_user (s.freeswap, &info->freeswap) ||\n\t __put_user (s.procs, &info->procs) ||\n\t __put_user (s.totalhigh, &info->totalhigh) ||\n\t __put_user (s.freehigh, &info->freehigh) ||\n\t __put_user (s.mem_unit, &info->mem_unit))\n\t\treturn -EFAULT;\n\n\treturn 0;\n}\n\n/*\n * kernel/configs.c\n * Echo the kernel .config file used to build the kernel\n *\n * Copyright (C) 2002 Khalid Aziz <khalid_aziz@hp.com>\n * Copyright (C) 2002 Randy Dunlap <rdunlap@xenotime.net>\n * Copyright (C) 2002 Al Stone <ahs3@fc.hp.com>\n * Copyright (C) 2002 Hewlett-Packard Company\n *\n * This program is free software; you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation; either version 2 of the License, or (at\n * your option) any later version.\n *\n * This program is distributed in the hope that it will be useful, but\n * WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or\n * NON INFRINGEMENT. See the GNU General Public License for more\n * details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program; if not, write to the Free Software\n * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\n */\n\n#include <linux/kernel.h>\n#include <linux/module.h>\n#include <linux/proc_fs.h>\n#include <linux/seq_file.h>\n#include <linux/init.h>\n#include <asm/uaccess.h>\n\n/**************************************************/\n/* the actual current config file */\n\n/*\n * Define kernel_config_data and kernel_config_data_size, which contains the\n * wrapped and compressed configuration file. The file is first compressed\n * with gzip and then bounded by two eight byte magic numbers to allow\n * extraction from a binary kernel image:\n *\n * IKCFG_ST\n * <image>\n * IKCFG_ED\n */\n#define MAGIC_START\t\"IKCFG_ST\"\n#define MAGIC_END\t\"IKCFG_ED\"\n#include \"config_data.h\"\n\n\n#define MAGIC_SIZE (sizeof(MAGIC_START) - 1)\n#define kernel_config_data_size \\\n\t(sizeof(kernel_config_data) - 1 - MAGIC_SIZE * 2)\n\n#ifdef CONFIG_IKCONFIG_PROC\n\n/**************************************************/\n/* globals and useful constants */\n\nstatic ssize_t\nikconfig_read_current(struct file *file, char __user *buf,\n\t\t size_t len, loff_t * offset)\n{\n\treturn simple_read_from_buffer(buf, len, offset,\n\t\t\t\t kernel_config_data + MAGIC_SIZE,\n\t\t\t\t kernel_config_data_size);\n}\n\nstatic const struct file_operations ikconfig_file_ops = {\n\t.owner = THIS_MODULE,\n\t.read = ikconfig_read_current,\n};\n\n/***************************************************/\n/* ikconfig_init: start up everything we need to */\n\nstatic int __init ikconfig_init(void)\n{\n\tstruct proc_dir_entry *entry;\n\n\t/* create the current config file */\n\tentry = create_proc_entry(\"config.gz\", S_IFREG | S_IRUGO,\n\t\t\t\t &proc_root);\n\tif (!entry)\n\t\treturn -ENOMEM;\n\n\tentry->proc_fops = &ikconfig_file_ops;\n\tentry->size = kernel_config_data_size;\n\n\treturn 0;\n}\n\n/***************************************************/\n/* ikconfig_cleanup: clean up our mess */\n\nstatic void __exit ikconfig_cleanup(void)\n{\n\tremove_proc_entry(\"config.gz\", &proc_root);\n}\n\nmodule_init(ikconfig_init);\nmodule_exit(ikconfig_cleanup);\n\nMODULE_LICENSE(\"GPL\");\nMODULE_AUTHOR(\"Randy Dunlap\");\nMODULE_DESCRIPTION(\"Echo the kernel .config file used to build the kernel\");\n\n#endif /* CONFIG_IKCONFIG_PROC */\n/* CPU control.\n * (C) 2001, 2002, 2003, 2004 Rusty Russell\n *\n * This code is licenced under the GPL.\n */\n#include <linux/proc_fs.h>\n#include <linux/smp.h>\n#include <linux/init.h>\n#include <linux/notifier.h>\n#include <linux/sched.h>\n#include <linux/unistd.h>\n#include <linux/cpu.h>\n#include <linux/module.h>\n#include <linux/kthread.h>\n#include <linux/stop_machine.h>\n#include <linux/mutex.h>\n\n/* This protects CPUs going up and down... */\nstatic DEFINE_MUTEX(cpu_add_remove_lock);\nstatic DEFINE_MUTEX(cpu_bitmask_lock);\n\nstatic __cpuinitdata RAW_NOTIFIER_HEAD(cpu_chain);\n\n/* If set, cpu_up and cpu_down will return -EBUSY and do nothing.\n * Should always be manipulated under cpu_add_remove_lock\n */\nstatic int cpu_hotplug_disabled;\n\n#ifdef CONFIG_HOTPLUG_CPU\n\n/* Crappy recursive lock-takers in cpufreq! Complain loudly about idiots */\nstatic struct task_struct *recursive;\nstatic int recursive_depth;\n\nvoid lock_cpu_hotplug(void)\n{\n\tstruct task_struct *tsk = current;\n\n\tif (tsk == recursive) {\n\t\tstatic int warnings = 10;\n\t\tif (warnings) {\n\t\t\tprintk(KERN_ERR \"Lukewarm IQ detected in hotplug locking\\n\");\n\t\t\tWARN_ON(1);\n\t\t\twarnings--;\n\t\t}\n\t\trecursive_depth++;\n\t\treturn;\n\t}\n\tmutex_lock(&cpu_bitmask_lock);\n\trecursive = tsk;\n}\nEXPORT_SYMBOL_GPL(lock_cpu_hotplug);\n\nvoid unlock_cpu_hotplug(void)\n{\n\tWARN_ON(recursive != current);\n\tif (recursive_depth) {\n\t\trecursive_depth--;\n\t\treturn;\n\t}\n\trecursive = NULL;\n\tmutex_unlock(&cpu_bitmask_lock);\n}\nEXPORT_SYMBOL_GPL(unlock_cpu_hotplug);\n\n#endif\t/* CONFIG_HOTPLUG_CPU */\n\n/* Need to know about CPUs going up/down? */\nint __cpuinit register_cpu_notifier(struct notifier_block *nb)\n{\n\tint ret;\n\tmutex_lock(&cpu_add_remove_lock);\n\tret = raw_notifier_chain_register(&cpu_chain, nb);\n\tmutex_unlock(&cpu_add_remove_lock);\n\treturn ret;\n}\n\n#ifdef CONFIG_HOTPLUG_CPU\n\nEXPORT_SYMBOL(register_cpu_notifier);\n\nvoid unregister_cpu_notifier(struct notifier_block *nb)\n{\n\tmutex_lock(&cpu_add_remove_lock);\n\traw_notifier_chain_unregister(&cpu_chain, nb);\n\tmutex_unlock(&cpu_add_remove_lock);\n}\nEXPORT_SYMBOL(unregister_cpu_notifier);\n\nstatic inline void check_for_tasks(int cpu)\n{\n\tstruct task_struct *p;\n\n\twrite_lock_irq(&tasklist_lock);\n\tfor_each_process(p) {\n\t\tif (task_cpu(p) == cpu &&\n\t\t (!cputime_eq(p->utime, cputime_zero) ||\n\t\t !cputime_eq(p->stime, cputime_zero)))\n\t\t\tprintk(KERN_WARNING \"Task %s (pid = %d) is on cpu %d\\\n\t\t\t\t(state = %ld, flags = %x) \\n\",\n\t\t\t\t p->comm, p->pid, cpu, p->state, p->flags);\n\t}\n\twrite_unlock_irq(&tasklist_lock);\n}\n\n/* Take this CPU down. */\nstatic int take_cpu_down(void *unused)\n{\n\tint err;\n\n\t/* Ensure this CPU doesn't handle any more interrupts. */\n\terr = __cpu_disable();\n\tif (err < 0)\n\t\treturn err;\n\n\t/* Force idle task to run as soon as we yield: it should\n\t immediately notice cpu is offline and die quickly. */\n\tsched_idle_next();\n\treturn 0;\n}\n\n/* Requires cpu_add_remove_lock to be held */\nstatic int _cpu_down(unsigned int cpu, int tasks_frozen)\n{\n\tint err, nr_calls = 0;\n\tstruct task_struct *p;\n\tcpumask_t old_allowed, tmp;\n\tvoid *hcpu = (void *)(long)cpu;\n\tunsigned long mod = tasks_frozen ? CPU_TASKS_FROZEN : 0;\n\n\tif (num_online_cpus() == 1)\n\t\treturn -EBUSY;\n\n\tif (!cpu_online(cpu))\n\t\treturn -EINVAL;\n\n\traw_notifier_call_chain(&cpu_chain, CPU_LOCK_ACQUIRE, hcpu);\n\terr = __raw_notifier_call_chain(&cpu_chain, CPU_DOWN_PREPARE | mod,\n\t\t\t\t\thcpu, -1, &nr_calls);\n\tif (err == NOTIFY_BAD) {\n\t\t__raw_notifier_call_chain(&cpu_chain, CPU_DOWN_FAILED | mod,\n\t\t\t\t\t hcpu, nr_calls, NULL);\n\t\tprintk(\"%s: attempt to take down CPU %u failed\\n\",\n\t\t\t\t__FUNCTION__, cpu);\n\t\terr = -EINVAL;\n\t\tgoto out_release;\n\t}\n\n\t/* Ensure that we are not runnable on dying cpu */\n\told_allowed = current->cpus_allowed;\n\ttmp = CPU_MASK_ALL;\n\tcpu_clear(cpu, tmp);\n\tset_cpus_allowed(current, tmp);\n\n\tmutex_lock(&cpu_bitmask_lock);\n\tp = __stop_machine_run(take_cpu_down, NULL, cpu);\n\tmutex_unlock(&cpu_bitmask_lock);\n\n\tif (IS_ERR(p) || cpu_online(cpu)) {\n\t\t/* CPU didn't die: tell everyone. Can't complain. */\n\t\tif (raw_notifier_call_chain(&cpu_chain, CPU_DOWN_FAILED | mod,\n\t\t\t\t\t hcpu) == NOTIFY_BAD)\n\t\t\tBUG();\n\n\t\tif (IS_ERR(p)) {\n\t\t\terr = PTR_ERR(p);\n\t\t\tgoto out_allowed;\n\t\t}\n\t\tgoto out_thread;\n\t}\n\n\t/* Wait for it to sleep (leaving idle task). */\n\twhile (!idle_cpu(cpu))\n\t\tyield();\n\n\t/* This actually kills the CPU. */\n\t__cpu_die(cpu);\n\n\t/* CPU is completely dead: tell everyone. Too late to complain. */\n\tif (raw_notifier_call_chain(&cpu_chain, CPU_DEAD | mod,\n\t\t\t\t hcpu) == NOTIFY_BAD)\n\t\tBUG();\n\n\tcheck_for_tasks(cpu);\n\nout_thread:\n\terr = kthread_stop(p);\nout_allowed:\n\tset_cpus_allowed(current, old_allowed);\nout_release:\n\traw_notifier_call_chain(&cpu_chain, CPU_LOCK_RELEASE, hcpu);\n\treturn err;\n}\n\nint cpu_down(unsigned int cpu)\n{\n\tint err = 0;\n\n\tmutex_lock(&cpu_add_remove_lock);\n\tif (cpu_hotplug_disabled)\n\t\terr = -EBUSY;\n\telse\n\t\terr = _cpu_down(cpu, 0);\n\n\tmutex_unlock(&cpu_add_remove_lock);\n\treturn err;\n}\n#endif /*CONFIG_HOTPLUG_CPU*/\n\n/* Requires cpu_add_remove_lock to be held */\nstatic int __cpuinit _cpu_up(unsigned int cpu, int tasks_frozen)\n{\n\tint ret, nr_calls = 0;\n\tvoid *hcpu = (void *)(long)cpu;\n\tunsigned long mod = tasks_frozen ? CPU_TASKS_FROZEN : 0;\n\n\tif (cpu_online(cpu) || !cpu_present(cpu))\n\t\treturn -EINVAL;\n\n\traw_notifier_call_chain(&cpu_chain, CPU_LOCK_ACQUIRE, hcpu);\n\tret = __raw_notifier_call_chain(&cpu_chain, CPU_UP_PREPARE | mod, hcpu,\n\t\t\t\t\t\t\t-1, &nr_calls);\n\tif (ret == NOTIFY_BAD) {\n\t\tprintk(\"%s: attempt to bring up CPU %u failed\\n\",\n\t\t\t\t__FUNCTION__, cpu);\n\t\tret = -EINVAL;\n\t\tgoto out_notify;\n\t}\n\n\t/* Arch-specific enabling code. */\n\tmutex_lock(&cpu_bitmask_lock);\n\tret = __cpu_up(cpu);\n\tmutex_unlock(&cpu_bitmask_lock);\n\tif (ret != 0)\n\t\tgoto out_notify;\n\tBUG_ON(!cpu_online(cpu));\n\n\t/* Now call notifier in preparation. */\n\traw_notifier_call_chain(&cpu_chain, CPU_ONLINE | mod, hcpu);\n\nout_notify:\n\tif (ret != 0)\n\t\t__raw_notifier_call_chain(&cpu_chain,\n\t\t\t\tCPU_UP_CANCELED | mod, hcpu, nr_calls, NULL);\n\traw_notifier_call_chain(&cpu_chain, CPU_LOCK_RELEASE, hcpu);\n\n\treturn ret;\n}\n\nint __cpuinit cpu_up(unsigned int cpu)\n{\n\tint err = 0;\n\n\tmutex_lock(&cpu_add_remove_lock);\n\tif (cpu_hotplug_disabled)\n\t\terr = -EBUSY;\n\telse\n\t\terr = _cpu_up(cpu, 0);\n\n\tmutex_unlock(&cpu_add_remove_lock);\n\treturn err;\n}\n\n#ifdef CONFIG_SUSPEND_SMP\nstatic cpumask_t frozen_cpus;\n\nint disable_nonboot_cpus(void)\n{\n\tint cpu, first_cpu, error = 0;\n\n\tmutex_lock(&cpu_add_remove_lock);\n\tfirst_cpu = first_cpu(cpu_online_map);\n\t/* We take down all of the non-boot CPUs in one shot to avoid races\n\t * with the userspace trying to use the CPU hotplug at the same time\n\t */\n\tcpus_clear(frozen_cpus);\n\tprintk(\"Disabling non-boot CPUs ...\\n\");\n\tfor_each_online_cpu(cpu) {\n\t\tif (cpu == first_cpu)\n\t\t\tcontinue;\n\t\terror = _cpu_down(cpu, 1);\n\t\tif (!error) {\n\t\t\tcpu_set(cpu, frozen_cpus);\n\t\t\tprintk(\"CPU%d is down\\n\", cpu);\n\t\t} else {\n\t\t\tprintk(KERN_ERR \"Error taking CPU%d down: %d\\n\",\n\t\t\t\tcpu, error);\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (!error) {\n\t\tBUG_ON(num_online_cpus() > 1);\n\t\t/* Make sure the CPUs won't be enabled by someone else */\n\t\tcpu_hotplug_disabled = 1;\n\t} else {\n\t\tprintk(KERN_ERR \"Non-boot CPUs are not disabled\\n\");\n\t}\n\tmutex_unlock(&cpu_add_remove_lock);\n\treturn error;\n}\n\nvoid enable_nonboot_cpus(void)\n{\n\tint cpu, error;\n\n\t/* Allow everyone to use the CPU hotplug again */\n\tmutex_lock(&cpu_add_remove_lock);\n\tcpu_hotplug_disabled = 0;\n\tif (cpus_empty(frozen_cpus))\n\t\tgoto out;\n\n\tprintk(\"Enabling non-boot CPUs ...\\n\");\n\tfor_each_cpu_mask(cpu, frozen_cpus) {\n\t\terror = _cpu_up(cpu, 1);\n\t\tif (!error) {\n\t\t\tprintk(\"CPU%d is up\\n\", cpu);\n\t\t\tcontinue;\n\t\t}\n\t\tprintk(KERN_WARNING \"Error taking CPU%d up: %d\\n\", cpu, error);\n\t}\n\tcpus_clear(frozen_cpus);\nout:\n\tmutex_unlock(&cpu_add_remove_lock);\n}\n#endif\n/*\n * kernel/cpuset.c\n *\n * Processor and Memory placement constraints for sets of tasks.\n *\n * Copyright (C) 2003 BULL SA.\n * Copyright (C) 2004-2006 Silicon Graphics, Inc.\n *\n * Portions derived from Patrick Mochel's sysfs code.\n * sysfs is Copyright (c) 2001-3 Patrick Mochel\n *\n * 2003-10-10 Written by Simon Derr.\n * 2003-10-22 Updates by Stephen Hemminger.\n * 2004 May-July Rework by Paul Jackson.\n *\n * This file is subject to the terms and conditions of the GNU General Public\n * License. See the file COPYING in the main directory of the Linux\n * distribution for more details.\n */\n\n#include <linux/cpu.h>\n#include <linux/cpumask.h>\n#include <linux/cpuset.h>\n#include <linux/err.h>\n#include <linux/errno.h>\n#include <linux/file.h>\n#include <linux/fs.h>\n#include <linux/init.h>\n#include <linux/interrupt.h>\n#include <linux/kernel.h>\n#include <linux/kmod.h>\n#include <linux/list.h>\n#include <linux/mempolicy.h>\n#include <linux/mm.h>\n#include <linux/module.h>\n#include <linux/mount.h>\n#include <linux/namei.h>\n#include <linux/pagemap.h>\n#include <linux/proc_fs.h>\n#include <linux/rcupdate.h>\n#include <linux/sched.h>\n#include <linux/seq_file.h>\n#include <linux/security.h>\n#include <linux/slab.h>\n#include <linux/spinlock.h>\n#include <linux/stat.h>\n#include <linux/string.h>\n#include <linux/time.h>\n#include <linux/backing-dev.h>\n#include <linux/sort.h>\n\n#include <asm/uaccess.h>\n#include <asm/atomic.h>\n#include <linux/mutex.h>\n\n#define CPUSET_SUPER_MAGIC\t\t0x27e0eb\n\n/*\n * Tracks how many cpusets are currently defined in system.\n * When there is only one cpuset (the root cpuset) we can\n * short circuit some hooks.\n */\nint number_of_cpusets __read_mostly;\n\n/* See \"Frequency meter\" comments, below. */\n\nstruct fmeter {\n\tint cnt;\t\t/* unprocessed events count */\n\tint val;\t\t/* most recent output value */\n\ttime_t time;\t\t/* clock (secs) when val computed */\n\tspinlock_t lock;\t/* guards read or write of above */\n};\n\nstruct cpuset {\n\tunsigned long flags;\t\t/* \"unsigned long\" so bitops work */\n\tcpumask_t cpus_allowed;\t\t/* CPUs allowed to tasks in cpuset */\n\tnodemask_t mems_allowed;\t/* Memory Nodes allowed to tasks */\n\n\t/*\n\t * Count is atomic so can incr (fork) or decr (exit) without a lock.\n\t */\n\tatomic_t count;\t\t\t/* count tasks using this cpuset */\n\n\t/*\n\t * We link our 'sibling' struct into our parents 'children'.\n\t * Our children link their 'sibling' into our 'children'.\n\t */\n\tstruct list_head sibling;\t/* my parents children */\n\tstruct list_head children;\t/* my children */\n\n\tstruct cpuset *parent;\t\t/* my parent */\n\tstruct dentry *dentry;\t\t/* cpuset fs entry */\n\n\t/*\n\t * Copy of global cpuset_mems_generation as of the most\n\t * recent time this cpuset changed its mems_allowed.\n\t */\n\tint mems_generation;\n\n\tstruct fmeter fmeter;\t\t/* memory_pressure filter */\n};\n\n/* bits in struct cpuset flags field */\ntypedef enum {\n\tCS_CPU_EXCLUSIVE,\n\tCS_MEM_EXCLUSIVE,\n\tCS_MEMORY_MIGRATE,\n\tCS_REMOVED,\n\tCS_NOTIFY_ON_RELEASE,\n\tCS_SPREAD_PAGE,\n\tCS_SPREAD_SLAB,\n} cpuset_flagbits_t;\n\n/* convenient tests for these bits */\nstatic inline int is_cpu_exclusive(const struct cpuset *cs)\n{\n\treturn test_bit(CS_CPU_EXCLUSIVE, &cs->flags);\n}\n\nstatic inline int is_mem_exclusive(const struct cpuset *cs)\n{\n\treturn test_bit(CS_MEM_EXCLUSIVE, &cs->flags);\n}\n\nstatic inline int is_removed(const struct cpuset *cs)\n{\n\treturn test_bit(CS_REMOVED, &cs->flags);\n}\n\nstatic inline int notify_on_release(const struct cpuset *cs)\n{\n\treturn test_bit(CS_NOTIFY_ON_RELEASE, &cs->flags);\n}\n\nstatic inline int is_memory_migrate(const struct cpuset *cs)\n{\n\treturn test_bit(CS_MEMORY_MIGRATE, &cs->flags);\n}\n\nstatic inline int is_spread_page(const struct cpuset *cs)\n{\n\treturn test_bit(CS_SPREAD_PAGE, &cs->flags);\n}\n\nstatic inline int is_spread_slab(const struct cpuset *cs)\n{\n\treturn test_bit(CS_SPREAD_SLAB, &cs->flags);\n}\n\n/*\n * Increment this integer everytime any cpuset changes its\n * mems_allowed value. Users of cpusets can track this generation\n * number, and avoid having to lock and reload mems_allowed unless\n * the cpuset they're using changes generation.\n *\n * A single, global generation is needed because attach_task() could\n * reattach a task to a different cpuset, which must not have its\n * generation numbers aliased with those of that tasks previous cpuset.\n *\n * Generations are needed for mems_allowed because one task cannot\n * modify anothers memory placement. So we must enable every task,\n * on every visit to __alloc_pages(), to efficiently check whether\n * its current->cpuset->mems_allowed has changed, requiring an update\n * of its current->mems_allowed.\n *\n * Since cpuset_mems_generation is guarded by manage_mutex,\n * there is no need to mark it atomic.\n */\nstatic int cpuset_mems_generation;\n\nstatic struct cpuset top_cpuset = {\n\t.flags = ((1 << CS_CPU_EXCLUSIVE) | (1 << CS_MEM_EXCLUSIVE)),\n\t.cpus_allowed = CPU_MASK_ALL,\n\t.mems_allowed = NODE_MASK_ALL,\n\t.count = ATOMIC_INIT(0),\n\t.sibling = LIST_HEAD_INIT(top_cpuset.sibling),\n\t.children = LIST_HEAD_INIT(top_cpuset.children),\n};\n\nstatic struct vfsmount *cpuset_mount;\nstatic struct super_block *cpuset_sb;\n\n/*\n * We have two global cpuset mutexes below. They can nest.\n * It is ok to first take manage_mutex, then nest callback_mutex. We also\n * require taking task_lock() when dereferencing a tasks cpuset pointer.\n * See \"The task_lock() exception\", at the end of this comment.\n *\n * A task must hold both mutexes to modify cpusets. If a task\n * holds manage_mutex, then it blocks others wanting that mutex,\n * ensuring that it is the only task able to also acquire callback_mutex\n * and be able to modify cpusets. It can perform various checks on\n * the cpuset structure first, knowing nothing will change. It can\n * also allocate memory while just holding manage_mutex. While it is\n * performing these checks, various callback routines can briefly\n * acquire callback_mutex to query cpusets. Once it is ready to make\n * the changes, it takes callback_mutex, blocking everyone else.\n *\n * Calls to the kernel memory allocator can not be made while holding\n * callback_mutex, as that would risk double tripping on callback_mutex\n * from one of the callbacks into the cpuset code from within\n * __alloc_pages().\n *\n * If a task is only holding callback_mutex, then it has read-only\n * access to cpusets.\n *\n * The task_struct fields mems_allowed and mems_generation may only\n * be accessed in the context of that task, so require no locks.\n *\n * Any task can increment and decrement the count field without lock.\n * So in general, code holding manage_mutex or callback_mutex can't rely\n * on the count field not changing. However, if the count goes to\n * zero, then only attach_task(), which holds both mutexes, can\n * increment it again. Because a count of zero means that no tasks\n * are currently attached, therefore there is no way a task attached\n * to that cpuset can fork (the other way to increment the count).\n * So code holding manage_mutex or callback_mutex can safely assume that\n * if the count is zero, it will stay zero. Similarly, if a task\n * holds manage_mutex or callback_mutex on a cpuset with zero count, it\n * knows that the cpuset won't be removed, as cpuset_rmdir() needs\n * both of those mutexes.\n *\n * The cpuset_common_file_write handler for operations that modify\n * the cpuset hierarchy holds manage_mutex across the entire operation,\n * single threading all such cpuset modifications across the system.\n *\n * The cpuset_common_file_read() handlers only hold callback_mutex across\n * small pieces of code, such as when reading out possibly multi-word\n * cpumasks and nodemasks.\n *\n * The fork and exit callbacks cpuset_fork() and cpuset_exit(), don't\n * (usually) take either mutex. These are the two most performance\n * critical pieces of code here. The exception occurs on cpuset_exit(),\n * when a task in a notify_on_release cpuset exits. Then manage_mutex\n * is taken, and if the cpuset count is zero, a usermode call made\n * to /sbin/cpuset_release_agent with the name of the cpuset (path\n * relative to the root of cpuset file system) as the argument.\n *\n * A cpuset can only be deleted if both its 'count' of using tasks\n * is zero, and its list of 'children' cpusets is empty. Since all\n * tasks in the system use _some_ cpuset, and since there is always at\n * least one task in the system (init), therefore, top_cpuset\n * always has either children cpusets and/or using tasks. So we don't\n * need a special hack to ensure that top_cpuset cannot be deleted.\n *\n * The above \"Tale of Two Semaphores\" would be complete, but for:\n *\n *\tThe task_lock() exception\n *\n * The need for this exception arises from the action of attach_task(),\n * which overwrites one tasks cpuset pointer with another. It does\n * so using both mutexes, however there are several performance\n * critical places that need to reference task->cpuset without the\n * expense of grabbing a system global mutex. Therefore except as\n * noted below, when dereferencing or, as in attach_task(), modifying\n * a tasks cpuset pointer we use task_lock(), which acts on a spinlock\n * (task->alloc_lock) already in the task_struct routinely used for\n * such matters.\n *\n * P.S. One more locking exception. RCU is used to guard the\n * update of a tasks cpuset pointer by attach_task() and the\n * access of task->cpuset->mems_generation via that pointer in\n * the routine cpuset_update_task_memory_state().\n */\n\nstatic DEFINE_MUTEX(manage_mutex);\nstatic DEFINE_MUTEX(callback_mutex);\n\n/*\n * A couple of forward declarations required, due to cyclic reference loop:\n * cpuset_mkdir -> cpuset_create -> cpuset_populate_dir -> cpuset_add_file\n * -> cpuset_create_file -> cpuset_dir_inode_operations -> cpuset_mkdir.\n */\n\nstatic int cpuset_mkdir(struct inode *dir, struct dentry *dentry, int mode);\nstatic int cpuset_rmdir(struct inode *unused_dir, struct dentry *dentry);\n\nstatic struct backing_dev_info cpuset_backing_dev_info = {\n\t.ra_pages = 0,\t\t/* No readahead */\n\t.capabilities\t= BDI_CAP_NO_ACCT_DIRTY | BDI_CAP_NO_WRITEBACK,\n};\n\nstatic struct inode *cpuset_new_inode(mode_t mode)\n{\n\tstruct inode *inode = new_inode(cpuset_sb);\n\n\tif (inode) {\n\t\tinode->i_mode = mode;\n\t\tinode->i_uid = current->fsuid;\n\t\tinode->i_gid = current->fsgid;\n\t\tinode->i_blocks = 0;\n\t\tinode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;\n\t\tinode->i_mapping->backing_dev_info = &cpuset_backing_dev_info;\n\t}\n\treturn inode;\n}\n\nstatic void cpuset_diput(struct dentry *dentry, struct inode *inode)\n{\n\t/* is dentry a directory ? if so, kfree() associated cpuset */\n\tif (S_ISDIR(inode->i_mode)) {\n\t\tstruct cpuset *cs = dentry->d_fsdata;\n\t\tBUG_ON(!(is_removed(cs)));\n\t\tkfree(cs);\n\t}\n\tiput(inode);\n}\n\nstatic struct dentry_operations cpuset_dops = {\n\t.d_iput = cpuset_diput,\n};\n\nstatic struct dentry *cpuset_get_dentry(struct dentry *parent, const char *name)\n{\n\tstruct dentry *d = lookup_one_len(name, parent, strlen(name));\n\tif (!IS_ERR(d))\n\t\td->d_op = &cpuset_dops;\n\treturn d;\n}\n\nstatic void remove_dir(struct dentry *d)\n{\n\tstruct dentry *parent = dget(d->d_parent);\n\n\td_delete(d);\n\tsimple_rmdir(parent->d_inode, d);\n\tdput(parent);\n}\n\n/*\n * NOTE : the dentry must have been dget()'ed\n */\nstatic void cpuset_d_remove_dir(struct dentry *dentry)\n{\n\tstruct list_head *node;\n\n\tspin_lock(&dcache_lock);\n\tnode = dentry->d_subdirs.next;\n\twhile (node != &dentry->d_subdirs) {\n\t\tstruct dentry *d = list_entry(node, struct dentry, d_u.d_child);\n\t\tlist_del_init(node);\n\t\tif (d->d_inode) {\n\t\t\td = dget_locked(d);\n\t\t\tspin_unlock(&dcache_lock);\n\t\t\td_delete(d);\n\t\t\tsimple_unlink(dentry->d_inode, d);\n\t\t\tdput(d);\n\t\t\tspin_lock(&dcache_lock);\n\t\t}\n\t\tnode = dentry->d_subdirs.next;\n\t}\n\tlist_del_init(&dentry->d_u.d_child);\n\tspin_unlock(&dcache_lock);\n\tremove_dir(dentry);\n}\n\nstatic struct super_operations cpuset_ops = {\n\t.statfs = simple_statfs,\n\t.drop_inode = generic_delete_inode,\n};\n\nstatic int cpuset_fill_super(struct super_block *sb, void *unused_data,\n\t\t\t\t\t\t\tint unused_silent)\n{\n\tstruct inode *inode;\n\tstruct dentry *root;\n\n\tsb->s_blocksize = PAGE_CACHE_SIZE;\n\tsb->s_blocksize_bits = PAGE_CACHE_SHIFT;\n\tsb->s_magic = CPUSET_SUPER_MAGIC;\n\tsb->s_op = &cpuset_ops;\n\tcpuset_sb = sb;\n\n\tinode = cpuset_new_inode(S_IFDIR | S_IRUGO | S_IXUGO | S_IWUSR);\n\tif (inode) {\n\t\tinode->i_op = &simple_dir_inode_operations;\n\t\tinode->i_fop = &simple_dir_operations;\n\t\t/* directories start off with i_nlink == 2 (for \".\" entry) */\n\t\tinc_nlink(inode);\n\t} else {\n\t\treturn -ENOMEM;\n\t}\n\n\troot = d_alloc_root(inode);\n\tif (!root) {\n\t\tiput(inode);\n\t\treturn -ENOMEM;\n\t}\n\tsb->s_root = root;\n\treturn 0;\n}\n\nstatic int cpuset_get_sb(struct file_system_type *fs_type,\n\t\t\t int flags, const char *unused_dev_name,\n\t\t\t void *data, struct vfsmount *mnt)\n{\n\treturn get_sb_single(fs_type, flags, data, cpuset_fill_super, mnt);\n}\n\nstatic struct file_system_type cpuset_fs_type = {\n\t.name = \"cpuset\",\n\t.get_sb = cpuset_get_sb,\n\t.kill_sb = kill_litter_super,\n};\n\n/* struct cftype:\n *\n * The files in the cpuset filesystem mostly have a very simple read/write\n * handling, some common function will take care of it. Nevertheless some cases\n * (read tasks) are special and therefore I define this structure for every\n * kind of file.\n *\n *\n * When reading/writing to a file:\n *\t- the cpuset to use in file->f_path.dentry->d_parent->d_fsdata\n *\t- the 'cftype' of the file is file->f_path.dentry->d_fsdata\n */\n\nstruct cftype {\n\tchar *name;\n\tint private;\n\tint (*open) (struct inode *inode, struct file *file);\n\tssize_t (*read) (struct file *file, char __user *buf, size_t nbytes,\n\t\t\t\t\t\t\tloff_t *ppos);\n\tint (*write) (struct file *file, const char __user *buf, size_t nbytes,\n\t\t\t\t\t\t\tloff_t *ppos);\n\tint (*release) (struct inode *inode, struct file *file);\n};\n\nstatic inline struct cpuset *__d_cs(struct dentry *dentry)\n{\n\treturn dentry->d_fsdata;\n}\n\nstatic inline struct cftype *__d_cft(struct dentry *dentry)\n{\n\treturn dentry->d_fsdata;\n}\n\n/*\n * Call with manage_mutex held. Writes path of cpuset into buf.\n * Returns 0 on success, -errno on error.\n */\n\nstatic int cpuset_path(const struct cpuset *cs, char *buf, int buflen)\n{\n\tchar *start;\n\n\tstart = buf + buflen;\n\n\t*--start = '\\0';\n\tfor (;;) {\n\t\tint len = cs->dentry->d_name.len;\n\t\tif ((start -= len) < buf)\n\t\t\treturn -ENAMETOOLONG;\n\t\tmemcpy(start, cs->dentry->d_name.name, len);\n\t\tcs = cs->parent;\n\t\tif (!cs)\n\t\t\tbreak;\n\t\tif (!cs->parent)\n\t\t\tcontinue;\n\t\tif (--start < buf)\n\t\t\treturn -ENAMETOOLONG;\n\t\t*start = '/';\n\t}\n\tmemmove(buf, start, buf + buflen - start);\n\treturn 0;\n}\n\n/*\n * Notify userspace when a cpuset is released, by running\n * /sbin/cpuset_release_agent with the name of the cpuset (path\n * relative to the root of cpuset file system) as the argument.\n *\n * Most likely, this user command will try to rmdir this cpuset.\n *\n * This races with the possibility that some other task will be\n * attached to this cpuset before it is removed, or that some other\n * user task will 'mkdir' a child cpuset of this cpuset. That's ok.\n * The presumed 'rmdir' will fail quietly if this cpuset is no longer\n * unused, and this cpuset will be reprieved from its death sentence,\n * to continue to serve a useful existence. Next time it's released,\n * we will get notified again, if it still has 'notify_on_release' set.\n *\n * The final arg to call_usermodehelper() is 0, which means don't\n * wait. The separate /sbin/cpuset_release_agent task is forked by\n * call_usermodehelper(), then control in this thread returns here,\n * without waiting for the release agent task. We don't bother to\n * wait because the caller of this routine has no use for the exit\n * status of the /sbin/cpuset_release_agent task, so no sense holding\n * our caller up for that.\n *\n * When we had only one cpuset mutex, we had to call this\n * without holding it, to avoid deadlock when call_usermodehelper()\n * allocated memory. With two locks, we could now call this while\n * holding manage_mutex, but we still don't, so as to minimize\n * the time manage_mutex is held.\n */\n\nstatic void cpuset_release_agent(const char *pathbuf)\n{\n\tchar *argv[3], *envp[3];\n\tint i;\n\n\tif (!pathbuf)\n\t\treturn;\n\n\ti = 0;\n\targv[i++] = \"/sbin/cpuset_release_agent\";\n\targv[i++] = (char *)pathbuf;\n\targv[i] = NULL;\n\n\ti = 0;\n\t/* minimal command environment */\n\tenvp[i++] = \"HOME=/\";\n\tenvp[i++] = \"PATH=/sbin:/bin:/usr/sbin:/usr/bin\";\n\tenvp[i] = NULL;\n\n\tcall_usermodehelper(argv[0], argv, envp, 0);\n\tkfree(pathbuf);\n}\n\n/*\n * Either cs->count of using tasks transitioned to zero, or the\n * cs->children list of child cpusets just became empty. If this\n * cs is notify_on_release() and now both the user count is zero and\n * the list of children is empty, prepare cpuset path in a kmalloc'd\n * buffer, to be returned via ppathbuf, so that the caller can invoke\n * cpuset_release_agent() with it later on, once manage_mutex is dropped.\n * Call here with manage_mutex held.\n *\n * This check_for_release() routine is responsible for kmalloc'ing\n * pathbuf. The above cpuset_release_agent() is responsible for\n * kfree'ing pathbuf. The caller of these routines is responsible\n * for providing a pathbuf pointer, initialized to NULL, then\n * calling check_for_release() with manage_mutex held and the address\n * of the pathbuf pointer, then dropping manage_mutex, then calling\n * cpuset_release_agent() with pathbuf, as set by check_for_release().\n */\n\nstatic void check_for_release(struct cpuset *cs, char **ppathbuf)\n{\n\tif (notify_on_release(cs) && atomic_read(&cs->count) == 0 &&\n\t list_empty(&cs->children)) {\n\t\tchar *buf;\n\n\t\tbuf = kmalloc(PAGE_SIZE, GFP_KERNEL);\n\t\tif (!buf)\n\t\t\treturn;\n\t\tif (cpuset_path(cs, buf, PAGE_SIZE) < 0)\n\t\t\tkfree(buf);\n\t\telse\n\t\t\t*ppathbuf = buf;\n\t}\n}\n\n/*\n * Return in *pmask the portion of a cpusets's cpus_allowed that\n * are online. If none are online, walk up the cpuset hierarchy\n * until we find one that does have some online cpus. If we get\n * all the way to the top and still haven't found any online cpus,\n * return cpu_online_map. Or if passed a NULL cs from an exit'ing\n * task, return cpu_online_map.\n *\n * One way or another, we guarantee to return some non-empty subset\n * of cpu_online_map.\n *\n * Call with callback_mutex held.\n */\n\nstatic void guarantee_online_cpus(const struct cpuset *cs, cpumask_t *pmask)\n{\n\twhile (cs && !cpus_intersects(cs->cpus_allowed, cpu_online_map))\n\t\tcs = cs->parent;\n\tif (cs)\n\t\tcpus_and(*pmask, cs->cpus_allowed, cpu_online_map);\n\telse\n\t\t*pmask = cpu_online_map;\n\tBUG_ON(!cpus_intersects(*pmask, cpu_online_map));\n}\n\n/*\n * Return in *pmask the portion of a cpusets's mems_allowed that\n * are online. If none are online, walk up the cpuset hierarchy\n * until we find one that does have some online mems. If we get\n * all the way to the top and still haven't found any online mems,\n * return node_online_map.\n *\n * One way or another, we guarantee to return some non-empty subset\n * of node_online_map.\n *\n * Call with callback_mutex held.\n */\n\nstatic void guarantee_online_mems(const struct cpuset *cs, nodemask_t *pmask)\n{\n\twhile (cs && !nodes_intersects(cs->mems_allowed, node_online_map))\n\t\tcs = cs->parent;\n\tif (cs)\n\t\tnodes_and(*pmask, cs->mems_allowed, node_online_map);\n\telse\n\t\t*pmask = node_online_map;\n\tBUG_ON(!nodes_intersects(*pmask, node_online_map));\n}\n\n/**\n * cpuset_update_task_memory_state - update task memory placement\n *\n * If the current tasks cpusets mems_allowed changed behind our\n * backs, update current->mems_allowed, mems_generation and task NUMA\n * mempolicy to the new value.\n *\n * Task mempolicy is updated by rebinding it relative to the\n * current->cpuset if a task has its memory placement changed.\n * Do not call this routine if in_interrupt().\n *\n * Call without callback_mutex or task_lock() held. May be\n * called with or without manage_mutex held. Thanks in part to\n * 'the_top_cpuset_hack', the tasks cpuset pointer will never\n * be NULL. This routine also might acquire callback_mutex and\n * current->mm->mmap_sem during call.\n *\n * Reading current->cpuset->mems_generation doesn't need task_lock\n * to guard the current->cpuset derefence, because it is guarded\n * from concurrent freeing of current->cpuset by attach_task(),\n * using RCU.\n *\n * The rcu_dereference() is technically probably not needed,\n * as I don't actually mind if I see a new cpuset pointer but\n * an old value of mems_generation. However this really only\n * matters on alpha systems using cpusets heavily. If I dropped\n * that rcu_dereference(), it would save them a memory barrier.\n * For all other arch's, rcu_dereference is a no-op anyway, and for\n * alpha systems not using cpusets, another planned optimization,\n * avoiding the rcu critical section for tasks in the root cpuset\n * which is statically allocated, so can't vanish, will make this\n * irrelevant. Better to use RCU as intended, than to engage in\n * some cute trick to save a memory barrier that is impossible to\n * test, for alpha systems using cpusets heavily, which might not\n * even exist.\n *\n * This routine is needed to update the per-task mems_allowed data,\n * within the tasks context, when it is trying to allocate memory\n * (in various mm/mempolicy.c routines) and notices that some other\n * task has been modifying its cpuset.\n */\n\nvoid cpuset_update_task_memory_state(void)\n{\n\tint my_cpusets_mem_gen;\n\tstruct task_struct *tsk = current;\n\tstruct cpuset *cs;\n\n\tif (tsk->cpuset == &top_cpuset) {\n\t\t/* Don't need rcu for top_cpuset. It's never freed. */\n\t\tmy_cpusets_mem_gen = top_cpuset.mems_generation;\n\t} else {\n\t\trcu_read_lock();\n\t\tcs = rcu_dereference(tsk->cpuset);\n\t\tmy_cpusets_mem_gen = cs->mems_generation;\n\t\trcu_read_unlock();\n\t}\n\n\tif (my_cpusets_mem_gen != tsk->cpuset_mems_generation) {\n\t\tmutex_lock(&callback_mutex);\n\t\ttask_lock(tsk);\n\t\tcs = tsk->cpuset;\t/* Maybe changed when task not locked */\n\t\tguarantee_online_mems(cs, &tsk->mems_allowed);\n\t\ttsk->cpuset_mems_generation = cs->mems_generation;\n\t\tif (is_spread_page(cs))\n\t\t\ttsk->flags |= PF_SPREAD_PAGE;\n\t\telse\n\t\t\ttsk->flags &= ~PF_SPREAD_PAGE;\n\t\tif (is_spread_slab(cs))\n\t\t\ttsk->flags |= PF_SPREAD_SLAB;\n\t\telse\n\t\t\ttsk->flags &= ~PF_SPREAD_SLAB;\n\t\ttask_unlock(tsk);\n\t\tmutex_unlock(&callback_mutex);\n\t\tmpol_rebind_task(tsk, &tsk->mems_allowed);\n\t}\n}\n\n/*\n * is_cpuset_subset(p, q) - Is cpuset p a subset of cpuset q?\n *\n * One cpuset is a subset of another if all its allowed CPUs and\n * Memory Nodes are a subset of the other, and its exclusive flags\n * are only set if the other's are set. Call holding manage_mutex.\n */\n\nstatic int is_cpuset_subset(const struct cpuset *p, const struct cpuset *q)\n{\n\treturn\tcpus_subset(p->cpus_allowed, q->cpus_allowed) &&\n\t\tnodes_subset(p->mems_allowed, q->mems_allowed) &&\n\t\tis_cpu_exclusive(p) <= is_cpu_exclusive(q) &&\n\t\tis_mem_exclusive(p) <= is_mem_exclusive(q);\n}\n\n/*\n * validate_change() - Used to validate that any proposed cpuset change\n *\t\t follows the structural rules for cpusets.\n *\n * If we replaced the flag and mask values of the current cpuset\n * (cur) with those values in the trial cpuset (trial), would\n * our various subset and exclusive rules still be valid? Presumes\n * manage_mutex held.\n *\n * 'cur' is the address of an actual, in-use cpuset. Operations\n * such as list traversal that depend on the actual address of the\n * cpuset in the list must use cur below, not trial.\n *\n * 'trial' is the address of bulk structure copy of cur, with\n * perhaps one or more of the fields cpus_allowed, mems_allowed,\n * or flags changed to new, trial values.\n *\n * Return 0 if valid, -errno if not.\n */\n\nstatic int validate_change(const struct cpuset *cur, const struct cpuset *trial)\n{\n\tstruct cpuset *c, *par;\n\n\t/* Each of our child cpusets must be a subset of us */\n\tlist_for_each_entry(c, &cur->children, sibling) {\n\t\tif (!is_cpuset_subset(c, trial))\n\t\t\treturn -EBUSY;\n\t}\n\n\t/* Remaining checks don't apply to root cpuset */\n\tif (cur == &top_cpuset)\n\t\treturn 0;\n\n\tpar = cur->parent;\n\n\t/* We must be a subset of our parent cpuset */\n\tif (!is_cpuset_subset(trial, par))\n\t\treturn -EACCES;\n\n\t/* If either I or some sibling (!= me) is exclusive, we can't overlap */\n\tlist_for_each_entry(c, &par->children, sibling) {\n\t\tif ((is_cpu_exclusive(trial) || is_cpu_exclusive(c)) &&\n\t\t c != cur &&\n\t\t cpus_intersects(trial->cpus_allowed, c->cpus_allowed))\n\t\t\treturn -EINVAL;\n\t\tif ((is_mem_exclusive(trial) || is_mem_exclusive(c)) &&\n\t\t c != cur &&\n\t\t nodes_intersects(trial->mems_allowed, c->mems_allowed))\n\t\t\treturn -EINVAL;\n\t}\n\n\treturn 0;\n}\n\n/*\n * For a given cpuset cur, partition the system as follows\n * a. All cpus in the parent cpuset's cpus_allowed that are not part of any\n * exclusive child cpusets\n * b. All cpus in the current cpuset's cpus_allowed that are not part of any\n * exclusive child cpusets\n * Build these two partitions by calling partition_sched_domains\n *\n * Call with manage_mutex held. May nest a call to the\n * lock_cpu_hotplug()/unlock_cpu_hotplug() pair.\n * Must not be called holding callback_mutex, because we must\n * not call lock_cpu_hotplug() while holding callback_mutex.\n */\n\nstatic void update_cpu_domains(struct cpuset *cur)\n{\n\tstruct cpuset *c, *par = cur->parent;\n\tcpumask_t pspan, cspan;\n\n\tif (par == NULL || cpus_empty(cur->cpus_allowed))\n\t\treturn;\n\n\t/*\n\t * Get all cpus from parent's cpus_allowed not part of exclusive\n\t * children\n\t */\n\tpspan = par->cpus_allowed;\n\tlist_for_each_entry(c, &par->children, sibling) {\n\t\tif (is_cpu_exclusive(c))\n\t\t\tcpus_andnot(pspan, pspan, c->cpus_allowed);\n\t}\n\tif (!is_cpu_exclusive(cur)) {\n\t\tcpus_or(pspan, pspan, cur->cpus_allowed);\n\t\tif (cpus_equal(pspan, cur->cpus_allowed))\n\t\t\treturn;\n\t\tcspan = CPU_MASK_NONE;\n\t} else {\n\t\tif (cpus_empty(pspan))\n\t\t\treturn;\n\t\tcspan = cur->cpus_allowed;\n\t\t/*\n\t\t * Get all cpus from current cpuset's cpus_allowed not part\n\t\t * of exclusive children\n\t\t */\n\t\tlist_for_each_entry(c, &cur->children, sibling) {\n\t\t\tif (is_cpu_exclusive(c))\n\t\t\t\tcpus_andnot(cspan, cspan, c->cpus_allowed);\n\t\t}\n\t}\n\n\tlock_cpu_hotplug();\n\tpartition_sched_domains(&pspan, &cspan);\n\tunlock_cpu_hotplug();\n}\n\n/*\n * Call with manage_mutex held. May take callback_mutex during call.\n */\n\nstatic int update_cpumask(struct cpuset *cs, char *buf)\n{\n\tstruct cpuset trialcs;\n\tint retval, cpus_unchanged;\n\n\t/* top_cpuset.cpus_allowed tracks cpu_online_map; it's read-only */\n\tif (cs == &top_cpuset)\n\t\treturn -EACCES;\n\n\ttrialcs = *cs;\n\n\t/*\n\t * We allow a cpuset's cpus_allowed to be empty; if it has attached\n\t * tasks, we'll catch it later when we validate the change and return\n\t * -ENOSPC.\n\t */\n\tif (!buf[0] || (buf[0] == '\\n' && !buf[1])) {\n\t\tcpus_clear(trialcs.cpus_allowed);\n\t} else {\n\t\tretval = cpulist_parse(buf, trialcs.cpus_allowed);\n\t\tif (retval < 0)\n\t\t\treturn retval;\n\t}\n\tcpus_and(trialcs.cpus_allowed, trialcs.cpus_allowed, cpu_online_map);\n\t/* cpus_allowed cannot be empty for a cpuset with attached tasks. */\n\tif (atomic_read(&cs->count) && cpus_empty(trialcs.cpus_allowed))\n\t\treturn -ENOSPC;\n\tretval = validate_change(cs, &trialcs);\n\tif (retval < 0)\n\t\treturn retval;\n\tcpus_unchanged = cpus_equal(cs->cpus_allowed, trialcs.cpus_allowed);\n\tmutex_lock(&callback_mutex);\n\tcs->cpus_allowed = trialcs.cpus_allowed;\n\tmutex_unlock(&callback_mutex);\n\tif (is_cpu_exclusive(cs) && !cpus_unchanged)\n\t\tupdate_cpu_domains(cs);\n\treturn 0;\n}\n\n/*\n * cpuset_migrate_mm\n *\n * Migrate memory region from one set of nodes to another.\n *\n * Temporarilly set tasks mems_allowed to target nodes of migration,\n * so that the migration code can allocate pages on these nodes.\n *\n * Call holding manage_mutex, so our current->cpuset won't change\n * during this call, as manage_mutex holds off any attach_task()\n * calls. Therefore we don't need to take task_lock around the\n * call to guarantee_online_mems(), as we know no one is changing\n * our tasks cpuset.\n *\n * Hold callback_mutex around the two modifications of our tasks\n * mems_allowed to synchronize with cpuset_mems_allowed().\n *\n * While the mm_struct we are migrating is typically from some\n * other task, the task_struct mems_allowed that we are hacking\n * is for our current task, which must allocate new pages for that\n * migrating memory region.\n *\n * We call cpuset_update_task_memory_state() before hacking\n * our tasks mems_allowed, so that we are assured of being in\n * sync with our tasks cpuset, and in particular, callbacks to\n * cpuset_update_task_memory_state() from nested page allocations\n * won't see any mismatch of our cpuset and task mems_generation\n * values, so won't overwrite our hacked tasks mems_allowed\n * nodemask.\n */\n\nstatic void cpuset_migrate_mm(struct mm_struct *mm, const nodemask_t *from,\n\t\t\t\t\t\t\tconst nodemask_t *to)\n{\n\tstruct task_struct *tsk = current;\n\n\tcpuset_update_task_memory_state();\n\n\tmutex_lock(&callback_mutex);\n\ttsk->mems_allowed = *to;\n\tmutex_unlock(&callback_mutex);\n\n\tdo_migrate_pages(mm, from, to, MPOL_MF_MOVE_ALL);\n\n\tmutex_lock(&callback_mutex);\n\tguarantee_online_mems(tsk->cpuset, &tsk->mems_allowed);\n\tmutex_unlock(&callback_mutex);\n}\n\n/*\n * Handle user request to change the 'mems' memory placement\n * of a cpuset. Needs to validate the request, update the\n * cpusets mems_allowed and mems_generation, and for each\n * task in the cpuset, rebind any vma mempolicies and if\n * the cpuset is marked 'memory_migrate', migrate the tasks\n * pages to the new memory.\n *\n * Call with manage_mutex held. May take callback_mutex during call.\n * Will take tasklist_lock, scan tasklist for tasks in cpuset cs,\n * lock each such tasks mm->mmap_sem, scan its vma's and rebind\n * their mempolicies to the cpusets new mems_allowed.\n */\n\nstatic int update_nodemask(struct cpuset *cs, char *buf)\n{\n\tstruct cpuset trialcs;\n\tnodemask_t oldmem;\n\tstruct task_struct *g, *p;\n\tstruct mm_struct **mmarray;\n\tint i, n, ntasks;\n\tint migrate;\n\tint fudge;\n\tint retval;\n\n\t/* top_cpuset.mems_allowed tracks node_online_map; it's read-only */\n\tif (cs == &top_cpuset)\n\t\treturn -EACCES;\n\n\ttrialcs = *cs;\n\n\t/*\n\t * We allow a cpuset's mems_allowed to be empty; if it has attached\n\t * tasks, we'll catch it later when we validate the change and return\n\t * -ENOSPC.\n\t */\n\tif (!buf[0] || (buf[0] == '\\n' && !buf[1])) {\n\t\tnodes_clear(trialcs.mems_allowed);\n\t} else {\n\t\tretval = nodelist_parse(buf, trialcs.mems_allowed);\n\t\tif (retval < 0)\n\t\t\tgoto done;\n\t}\n\tnodes_and(trialcs.mems_allowed, trialcs.mems_allowed, node_online_map);\n\toldmem = cs->mems_allowed;\n\tif (nodes_equal(oldmem, trialcs.mems_allowed)) {\n\t\tretval = 0;\t\t/* Too easy - nothing to do */\n\t\tgoto done;\n\t}\n\t/* mems_allowed cannot be empty for a cpuset with attached tasks. */\n\tif (atomic_read(&cs->count) && nodes_empty(trialcs.mems_allowed)) {\n\t\tretval = -ENOSPC;\n\t\tgoto done;\n\t}\n\tretval = validate_change(cs, &trialcs);\n\tif (retval < 0)\n\t\tgoto done;\n\n\tmutex_lock(&callback_mutex);\n\tcs->mems_allowed = trialcs.mems_allowed;\n\tcs->mems_generation = cpuset_mems_generation++;\n\tmutex_unlock(&callback_mutex);\n\n\tset_cpuset_being_rebound(cs);\t\t/* causes mpol_copy() rebind */\n\n\tfudge = 10;\t\t\t\t/* spare mmarray[] slots */\n\tfudge += cpus_weight(cs->cpus_allowed);\t/* imagine one fork-bomb/cpu */\n\tretval = -ENOMEM;\n\n\t/*\n\t * Allocate mmarray[] to hold mm reference for each task\n\t * in cpuset cs. Can't kmalloc GFP_KERNEL while holding\n\t * tasklist_lock. We could use GFP_ATOMIC, but with a\n\t * few more lines of code, we can retry until we get a big\n\t * enough mmarray[] w/o using GFP_ATOMIC.\n\t */\n\twhile (1) {\n\t\tntasks = atomic_read(&cs->count);\t/* guess */\n\t\tntasks += fudge;\n\t\tmmarray = kmalloc(ntasks * sizeof(*mmarray), GFP_KERNEL);\n\t\tif (!mmarray)\n\t\t\tgoto done;\n\t\twrite_lock_irq(&tasklist_lock);\t\t/* block fork */\n\t\tif (atomic_read(&cs->count) <= ntasks)\n\t\t\tbreak;\t\t\t\t/* got enough */\n\t\twrite_unlock_irq(&tasklist_lock);\t/* try again */\n\t\tkfree(mmarray);\n\t}\n\n\tn = 0;\n\n\t/* Load up mmarray[] with mm reference for each task in cpuset. */\n\tdo_each_thread(g, p) {\n\t\tstruct mm_struct *mm;\n\n\t\tif (n >= ntasks) {\n\t\t\tprintk(KERN_WARNING\n\t\t\t\t\"Cpuset mempolicy rebind incomplete.\\n\");\n\t\t\tcontinue;\n\t\t}\n\t\tif (p->cpuset != cs)\n\t\t\tcontinue;\n\t\tmm = get_task_mm(p);\n\t\tif (!mm)\n\t\t\tcontinue;\n\t\tmmarray[n++] = mm;\n\t} while_each_thread(g, p);\n\twrite_unlock_irq(&tasklist_lock);\n\n\t/*\n\t * Now that we've dropped the tasklist spinlock, we can\n\t * rebind the vma mempolicies of each mm in mmarray[] to their\n\t * new cpuset, and release that mm. The mpol_rebind_mm()\n\t * call takes mmap_sem, which we couldn't take while holding\n\t * tasklist_lock. Forks can happen again now - the mpol_copy()\n\t * cpuset_being_rebound check will catch such forks, and rebind\n\t * their vma mempolicies too. Because we still hold the global\n\t * cpuset manage_mutex, we know that no other rebind effort will\n\t * be contending for the global variable cpuset_being_rebound.\n\t * It's ok if we rebind the same mm twice; mpol_rebind_mm()\n\t * is idempotent. Also migrate pages in each mm to new nodes.\n\t */\n\tmigrate = is_memory_migrate(cs);\n\tfor (i = 0; i < n; i++) {\n\t\tstruct mm_struct *mm = mmarray[i];\n\n\t\tmpol_rebind_mm(mm, &cs->mems_allowed);\n\t\tif (migrate)\n\t\t\tcpuset_migrate_mm(mm, &oldmem, &cs->mems_allowed);\n\t\tmmput(mm);\n\t}\n\n\t/* We're done rebinding vma's to this cpusets new mems_allowed. */\n\tkfree(mmarray);\n\tset_cpuset_being_rebound(NULL);\n\tretval = 0;\ndone:\n\treturn retval;\n}\n\n/*\n * Call with manage_mutex held.\n */\n\nstatic int update_memory_pressure_enabled(struct cpuset *cs, char *buf)\n{\n\tif (simple_strtoul(buf, NULL, 10) != 0)\n\t\tcpuset_memory_pressure_enabled = 1;\n\telse\n\t\tcpuset_memory_pressure_enabled = 0;\n\treturn 0;\n}\n\n/*\n * update_flag - read a 0 or a 1 in a file and update associated flag\n * bit:\tthe bit to update (CS_CPU_EXCLUSIVE, CS_MEM_EXCLUSIVE,\n *\t\t\t\tCS_NOTIFY_ON_RELEASE, CS_MEMORY_MIGRATE,\n *\t\t\t\tCS_SPREAD_PAGE, CS_SPREAD_SLAB)\n * cs:\tthe cpuset to update\n * buf:\tthe buffer where we read the 0 or 1\n *\n * Call with manage_mutex held.\n */\n\nstatic int update_flag(cpuset_flagbits_t bit, struct cpuset *cs, char *buf)\n{\n\tint turning_on;\n\tstruct cpuset trialcs;\n\tint err, cpu_exclusive_changed;\n\n\tturning_on = (simple_strtoul(buf, NULL, 10) != 0);\n\n\ttrialcs = *cs;\n\tif (turning_on)\n\t\tset_bit(bit, &trialcs.flags);\n\telse\n\t\tclear_bit(bit, &trialcs.flags);\n\n\terr = validate_change(cs, &trialcs);\n\tif (err < 0)\n\t\treturn err;\n\tcpu_exclusive_changed =\n\t\t(is_cpu_exclusive(cs) != is_cpu_exclusive(&trialcs));\n\tmutex_lock(&callback_mutex);\n\tcs->flags = trialcs.flags;\n\tmutex_unlock(&callback_mutex);\n\n\tif (cpu_exclusive_changed)\n update_cpu_domains(cs);\n\treturn 0;\n}\n\n/*\n * Frequency meter - How fast is some event occurring?\n *\n * These routines manage a digitally filtered, constant time based,\n * event frequency meter. There are four routines:\n * fmeter_init() - initialize a frequency meter.\n * fmeter_markevent() - called each time the event happens.\n * fmeter_getrate() - returns the recent rate of such events.\n * fmeter_update() - internal routine used to update fmeter.\n *\n * A common data structure is passed to each of these routines,\n * which is used to keep track of the state required to manage the\n * frequency meter and its digital filter.\n *\n * The filter works on the number of events marked per unit time.\n * The filter is single-pole low-pass recursive (IIR). The time unit\n * is 1 second. Arithmetic is done using 32-bit integers scaled to\n * simulate 3 decimal digits of precision (multiplied by 1000).\n *\n * With an FM_COEF of 933, and a time base of 1 second, the filter\n * has a half-life of 10 seconds, meaning that if the events quit\n * happening, then the rate returned from the fmeter_getrate()\n * will be cut in half each 10 seconds, until it converges to zero.\n *\n * It is not worth doing a real infinitely recursive filter. If more\n * than FM_MAXTICKS ticks have elapsed since the last filter event,\n * just compute FM_MAXTICKS ticks worth, by which point the level\n * will be stable.\n *\n * Limit the count of unprocessed events to FM_MAXCNT, so as to avoid\n * arithmetic overflow in the fmeter_update() routine.\n *\n * Given the simple 32 bit integer arithmetic used, this meter works\n * best for reporting rates between one per millisecond (msec) and\n * one per 32 (approx) seconds. At constant rates faster than one\n * per msec it maxes out at values just under 1,000,000. At constant\n * rates between one per msec, and one per second it will stabilize\n * to a value N*1000, where N is the rate of events per second.\n * At constant rates between one per second and one per 32 seconds,\n * it will be choppy, moving up on the seconds that have an event,\n * and then decaying until the next event. At rates slower than\n * about one in 32 seconds, it decays all the way back to zero between\n * each event.\n */\n\n#define FM_COEF 933\t\t/* coefficient for half-life of 10 secs */\n#define FM_MAXTICKS ((time_t)99) /* useless computing more ticks than this */\n#define FM_MAXCNT 1000000\t/* limit cnt to avoid overflow */\n#define FM_SCALE 1000\t\t/* faux fixed point scale */\n\n/* Initialize a frequency meter */\nstatic void fmeter_init(struct fmeter *fmp)\n{\n\tfmp->cnt = 0;\n\tfmp->val = 0;\n\tfmp->time = 0;\n\tspin_lock_init(&fmp->lock);\n}\n\n/* Internal meter update - process cnt events and update value */\nstatic void fmeter_update(struct fmeter *fmp)\n{\n\ttime_t now = get_seconds();\n\ttime_t ticks = now - fmp->time;\n\n\tif (ticks == 0)\n\t\treturn;\n\n\tticks = min(FM_MAXTICKS, ticks);\n\twhile (ticks-- > 0)\n\t\tfmp->val = (FM_COEF * fmp->val) / FM_SCALE;\n\tfmp->time = now;\n\n\tfmp->val += ((FM_SCALE - FM_COEF) * fmp->cnt) / FM_SCALE;\n\tfmp->cnt = 0;\n}\n\n/* Process any previous ticks, then bump cnt by one (times scale). */\nstatic void fmeter_markevent(struct fmeter *fmp)\n{\n\tspin_lock(&fmp->lock);\n\tfmeter_update(fmp);\n\tfmp->cnt = min(FM_MAXCNT, fmp->cnt + FM_SCALE);\n\tspin_unlock(&fmp->lock);\n}\n\n/* Process any previous ticks, then return current value. */\nstatic int fmeter_getrate(struct fmeter *fmp)\n{\n\tint val;\n\n\tspin_lock(&fmp->lock);\n\tfmeter_update(fmp);\n\tval = fmp->val;\n\tspin_unlock(&fmp->lock);\n\treturn val;\n}\n\n/*\n * Attack task specified by pid in 'pidbuf' to cpuset 'cs', possibly\n * writing the path of the old cpuset in 'ppathbuf' if it needs to be\n * notified on release.\n *\n * Call holding manage_mutex. May take callback_mutex and task_lock of\n * the task 'pid' during call.\n */\n\nstatic int attach_task(struct cpuset *cs, char *pidbuf, char **ppathbuf)\n{\n\tpid_t pid;\n\tstruct task_struct *tsk;\n\tstruct cpuset *oldcs;\n\tcpumask_t cpus;\n\tnodemask_t from, to;\n\tstruct mm_struct *mm;\n\tint retval;\n\n\tif (sscanf(pidbuf, \"%d\", &pid) != 1)\n\t\treturn -EIO;\n\tif (cpus_empty(cs->cpus_allowed) || nodes_empty(cs->mems_allowed))\n\t\treturn -ENOSPC;\n\n\tif (pid) {\n\t\tread_lock(&tasklist_lock);\n\n\t\ttsk = find_task_by_pid(pid);\n\t\tif (!tsk || tsk->flags & PF_EXITING) {\n\t\t\tread_unlock(&tasklist_lock);\n\t\t\treturn -ESRCH;\n\t\t}\n\n\t\tget_task_struct(tsk);\n\t\tread_unlock(&tasklist_lock);\n\n\t\tif ((current->euid) && (current->euid != tsk->uid)\n\t\t && (current->euid != tsk->suid)) {\n\t\t\tput_task_struct(tsk);\n\t\t\treturn -EACCES;\n\t\t}\n\t} else {\n\t\ttsk = current;\n\t\tget_task_struct(tsk);\n\t}\n\n\tretval = security_task_setscheduler(tsk, 0, NULL);\n\tif (retval) {\n\t\tput_task_struct(tsk);\n\t\treturn retval;\n\t}\n\n\tmutex_lock(&callback_mutex);\n\n\ttask_lock(tsk);\n\toldcs = tsk->cpuset;\n\t/*\n\t * After getting 'oldcs' cpuset ptr, be sure still not exiting.\n\t * If 'oldcs' might be the top_cpuset due to the_top_cpuset_hack\n\t * then fail this attach_task(), to avoid breaking top_cpuset.count.\n\t */\n\tif (tsk->flags & PF_EXITING) {\n\t\ttask_unlock(tsk);\n\t\tmutex_unlock(&callback_mutex);\n\t\tput_task_struct(tsk);\n\t\treturn -ESRCH;\n\t}\n\tatomic_inc(&cs->count);\n\trcu_assign_pointer(tsk->cpuset, cs);\n\ttask_unlock(tsk);\n\n\tguarantee_online_cpus(cs, &cpus);\n\tset_cpus_allowed(tsk, cpus);\n\n\tfrom = oldcs->mems_allowed;\n\tto = cs->mems_allowed;\n\n\tmutex_unlock(&callback_mutex);\n\n\tmm = get_task_mm(tsk);\n\tif (mm) {\n\t\tmpol_rebind_mm(mm, &to);\n\t\tif (is_memory_migrate(cs))\n\t\t\tcpuset_migrate_mm(mm, &from, &to);\n\t\tmmput(mm);\n\t}\n\n\tput_task_struct(tsk);\n\tsynchronize_rcu();\n\tif (atomic_dec_and_test(&oldcs->count))\n\t\tcheck_for_release(oldcs, ppathbuf);\n\treturn 0;\n}\n\n/* The various types of files and directories in a cpuset file system */\n\ntypedef enum {\n\tFILE_ROOT,\n\tFILE_DIR,\n\tFILE_MEMORY_MIGRATE,\n\tFILE_CPULIST,\n\tFILE_MEMLIST,\n\tFILE_CPU_EXCLUSIVE,\n\tFILE_MEM_EXCLUSIVE,\n\tFILE_NOTIFY_ON_RELEASE,\n\tFILE_MEMORY_PRESSURE_ENABLED,\n\tFILE_MEMORY_PRESSURE,\n\tFILE_SPREAD_PAGE,\n\tFILE_SPREAD_SLAB,\n\tFILE_TASKLIST,\n} cpuset_filetype_t;\n\nstatic ssize_t cpuset_common_file_write(struct file *file,\n\t\t\t\t\tconst char __user *userbuf,\n\t\t\t\t\tsize_t nbytes, loff_t *unused_ppos)\n{\n\tstruct cpuset *cs = __d_cs(file->f_path.dentry->d_parent);\n\tstruct cftype *cft = __d_cft(file->f_path.dentry);\n\tcpuset_filetype_t type = cft->private;\n\tchar *buffer;\n\tchar *pathbuf = NULL;\n\tint retval = 0;\n\n\t/* Crude upper limit on largest legitimate cpulist user might write. */\n\tif (nbytes > 100 + 6 * max(NR_CPUS, MAX_NUMNODES))\n\t\treturn -E2BIG;\n\n\t/* +1 for nul-terminator */\n\tif ((buffer = kmalloc(nbytes + 1, GFP_KERNEL)) == 0)\n\t\treturn -ENOMEM;\n\n\tif (copy_from_user(buffer, userbuf, nbytes)) {\n\t\tretval = -EFAULT;\n\t\tgoto out1;\n\t}\n\tbuffer[nbytes] = 0;\t/* nul-terminate */\n\n\tmutex_lock(&manage_mutex);\n\n\tif (is_removed(cs)) {\n\t\tretval = -ENODEV;\n\t\tgoto out2;\n\t}\n\n\tswitch (type) {\n\tcase FILE_CPULIST:\n\t\tretval = update_cpumask(cs, buffer);\n\t\tbreak;\n\tcase FILE_MEMLIST:\n\t\tretval = update_nodemask(cs, buffer);\n\t\tbreak;\n\tcase FILE_CPU_EXCLUSIVE:\n\t\tretval = update_flag(CS_CPU_EXCLUSIVE, cs, buffer);\n\t\tbreak;\n\tcase FILE_MEM_EXCLUSIVE:\n\t\tretval = update_flag(CS_MEM_EXCLUSIVE, cs, buffer);\n\t\tbreak;\n\tcase FILE_NOTIFY_ON_RELEASE:\n\t\tretval = update_flag(CS_NOTIFY_ON_RELEASE, cs, buffer);\n\t\tbreak;\n\tcase FILE_MEMORY_MIGRATE:\n\t\tretval = update_flag(CS_MEMORY_MIGRATE, cs, buffer);\n\t\tbreak;\n\tcase FILE_MEMORY_PRESSURE_ENABLED:\n\t\tretval = update_memory_pressure_enabled(cs, buffer);\n\t\tbreak;\n\tcase FILE_MEMORY_PRESSURE:\n\t\tretval = -EACCES;\n\t\tbreak;\n\tcase FILE_SPREAD_PAGE:\n\t\tretval = update_flag(CS_SPREAD_PAGE, cs, buffer);\n\t\tcs->mems_generation = cpuset_mems_generation++;\n\t\tbreak;\n\tcase FILE_SPREAD_SLAB:\n\t\tretval = update_flag(CS_SPREAD_SLAB, cs, buffer);\n\t\tcs->mems_generation = cpuset_mems_generation++;\n\t\tbreak;\n\tcase FILE_TASKLIST:\n\t\tretval = attach_task(cs, buffer, &pathbuf);\n\t\tbreak;\n\tdefault:\n\t\tretval = -EINVAL;\n\t\tgoto out2;\n\t}\n\n\tif (retval == 0)\n\t\tretval = nbytes;\nout2:\n\tmutex_unlock(&manage_mutex);\n\tcpuset_release_agent(pathbuf);\nout1:\n\tkfree(buffer);\n\treturn retval;\n}\n\nstatic ssize_t cpuset_file_write(struct file *file, const char __user *buf,\n\t\t\t\t\t\tsize_t nbytes, loff_t *ppos)\n{\n\tssize_t retval = 0;\n\tstruct cftype *cft = __d_cft(file->f_path.dentry);\n\tif (!cft)\n\t\treturn -ENODEV;\n\n\t/* special function ? */\n\tif (cft->write)\n\t\tretval = cft->write(file, buf, nbytes, ppos);\n\telse\n\t\tretval = cpuset_common_file_write(file, buf, nbytes, ppos);\n\n\treturn retval;\n}\n\n/*\n * These ascii lists should be read in a single call, by using a user\n * buffer large enough to hold the entire map. If read in smaller\n * chunks, there is no guarantee of atomicity. Since the display format\n * used, list of ranges of sequential numbers, is variable length,\n * and since these maps can change value dynamically, one could read\n * gibberish by doing partial reads while a list was changing.\n * A single large read to a buffer that crosses a page boundary is\n * ok, because the result being copied to user land is not recomputed\n * across a page fault.\n */\n\nstatic int cpuset_sprintf_cpulist(char *page, struct cpuset *cs)\n{\n\tcpumask_t mask;\n\n\tmutex_lock(&callback_mutex);\n\tmask = cs->cpus_allowed;\n\tmutex_unlock(&callback_mutex);\n\n\treturn cpulist_scnprintf(page, PAGE_SIZE, mask);\n}\n\nstatic int cpuset_sprintf_memlist(char *page, struct cpuset *cs)\n{\n\tnodemask_t mask;\n\n\tmutex_lock(&callback_mutex);\n\tmask = cs->mems_allowed;\n\tmutex_unlock(&callback_mutex);\n\n\treturn nodelist_scnprintf(page, PAGE_SIZE, mask);\n}\n\nstatic ssize_t cpuset_common_file_read(struct file *file, char __user *buf,\n\t\t\t\tsize_t nbytes, loff_t *ppos)\n{\n\tstruct cftype *cft = __d_cft(file->f_path.dentry);\n\tstruct cpuset *cs = __d_cs(file->f_path.dentry->d_parent);\n\tcpuset_filetype_t type = cft->private;\n\tchar *page;\n\tssize_t retval = 0;\n\tchar *s;\n\n\tif (!(page = (char *)__get_free_page(GFP_KERNEL)))\n\t\treturn -ENOMEM;\n\n\ts = page;\n\n\tswitch (type) {\n\tcase FILE_CPULIST:\n\t\ts += cpuset_sprintf_cpulist(s, cs);\n\t\tbreak;\n\tcase FILE_MEMLIST:\n\t\ts += cpuset_sprintf_memlist(s, cs);\n\t\tbreak;\n\tcase FILE_CPU_EXCLUSIVE:\n\t\t*s++ = is_cpu_exclusive(cs) ? '1' : '0';\n\t\tbreak;\n\tcase FILE_MEM_EXCLUSIVE:\n\t\t*s++ = is_mem_exclusive(cs) ? '1' : '0';\n\t\tbreak;\n\tcase FILE_NOTIFY_ON_RELEASE:\n\t\t*s++ = notify_on_release(cs) ? '1' : '0';\n\t\tbreak;\n\tcase FILE_MEMORY_MIGRATE:\n\t\t*s++ = is_memory_migrate(cs) ? '1' : '0';\n\t\tbreak;\n\tcase FILE_MEMORY_PRESSURE_ENABLED:\n\t\t*s++ = cpuset_memory_pressure_enabled ? '1' : '0';\n\t\tbreak;\n\tcase FILE_MEMORY_PRESSURE:\n\t\ts += sprintf(s, \"%d\", fmeter_getrate(&cs->fmeter));\n\t\tbreak;\n\tcase FILE_SPREAD_PAGE:\n\t\t*s++ = is_spread_page(cs) ? '1' : '0';\n\t\tbreak;\n\tcase FILE_SPREAD_SLAB:\n\t\t*s++ = is_spread_slab(cs) ? '1' : '0';\n\t\tbreak;\n\tdefault:\n\t\tretval = -EINVAL;\n\t\tgoto out;\n\t}\n\t*s++ = '\\n';\n\n\tretval = simple_read_from_buffer(buf, nbytes, ppos, page, s - page);\nout:\n\tfree_page((unsigned long)page);\n\treturn retval;\n}\n\nstatic ssize_t cpuset_file_read(struct file *file, char __user *buf, size_t nbytes,\n\t\t\t\t\t\t\t\tloff_t *ppos)\n{\n\tssize_t retval = 0;\n\tstruct cftype *cft = __d_cft(file->f_path.dentry);\n\tif (!cft)\n\t\treturn -ENODEV;\n\n\t/* special function ? */\n\tif (cft->read)\n\t\tretval = cft->read(file, buf, nbytes, ppos);\n\telse\n\t\tretval = cpuset_common_file_read(file, buf, nbytes, ppos);\n\n\treturn retval;\n}\n\nstatic int cpuset_file_open(struct inode *inode, struct file *file)\n{\n\tint err;\n\tstruct cftype *cft;\n\n\terr = generic_file_open(inode, file);\n\tif (err)\n\t\treturn err;\n\n\tcft = __d_cft(file->f_path.dentry);\n\tif (!cft)\n\t\treturn -ENODEV;\n\tif (cft->open)\n\t\terr = cft->open(inode, file);\n\telse\n\t\terr = 0;\n\n\treturn err;\n}\n\nstatic int cpuset_file_release(struct inode *inode, struct file *file)\n{\n\tstruct cftype *cft = __d_cft(file->f_path.dentry);\n\tif (cft->release)\n\t\treturn cft->release(inode, file);\n\treturn 0;\n}\n\n/*\n * cpuset_rename - Only allow simple rename of directories in place.\n */\nstatic int cpuset_rename(struct inode *old_dir, struct dentry *old_dentry,\n struct inode *new_dir, struct dentry *new_dentry)\n{\n\tif (!S_ISDIR(old_dentry->d_inode->i_mode))\n\t\treturn -ENOTDIR;\n\tif (new_dentry->d_inode)\n\t\treturn -EEXIST;\n\tif (old_dir != new_dir)\n\t\treturn -EIO;\n\treturn simple_rename(old_dir, old_dentry, new_dir, new_dentry);\n}\n\nstatic const struct file_operations cpuset_file_operations = {\n\t.read = cpuset_file_read,\n\t.write = cpuset_file_write,\n\t.llseek = generic_file_llseek,\n\t.open = cpuset_file_open,\n\t.release = cpuset_file_release,\n};\n\nstatic const struct inode_operations cpuset_dir_inode_operations = {\n\t.lookup = simple_lookup,\n\t.mkdir = cpuset_mkdir,\n\t.rmdir = cpuset_rmdir,\n\t.rename = cpuset_rename,\n};\n\nstatic int cpuset_create_file(struct dentry *dentry, int mode)\n{\n\tstruct inode *inode;\n\n\tif (!dentry)\n\t\treturn -ENOENT;\n\tif (dentry->d_inode)\n\t\treturn -EEXIST;\n\n\tinode = cpuset_new_inode(mode);\n\tif (!inode)\n\t\treturn -ENOMEM;\n\n\tif (S_ISDIR(mode)) {\n\t\tinode->i_op = &cpuset_dir_inode_operations;\n\t\tinode->i_fop = &simple_dir_operations;\n\n\t\t/* start off with i_nlink == 2 (for \".\" entry) */\n\t\tinc_nlink(inode);\n\t} else if (S_ISREG(mode)) {\n\t\tinode->i_size = 0;\n\t\tinode->i_fop = &cpuset_file_operations;\n\t}\n\n\td_instantiate(dentry, inode);\n\tdget(dentry);\t/* Extra count - pin the dentry in core */\n\treturn 0;\n}\n\n/*\n *\tcpuset_create_dir - create a directory for an object.\n *\tcs:\tthe cpuset we create the directory for.\n *\t\tIt must have a valid ->parent field\n *\t\tAnd we are going to fill its ->dentry field.\n *\tname:\tThe name to give to the cpuset directory. Will be copied.\n *\tmode:\tmode to set on new directory.\n */\n\nstatic int cpuset_create_dir(struct cpuset *cs, const char *name, int mode)\n{\n\tstruct dentry *dentry = NULL;\n\tstruct dentry *parent;\n\tint error = 0;\n\n\tparent = cs->parent->dentry;\n\tdentry = cpuset_get_dentry(parent, name);\n\tif (IS_ERR(dentry))\n\t\treturn PTR_ERR(dentry);\n\terror = cpuset_create_file(dentry, S_IFDIR | mode);\n\tif (!error) {\n\t\tdentry->d_fsdata = cs;\n\t\tinc_nlink(parent->d_inode);\n\t\tcs->dentry = dentry;\n\t}\n\tdput(dentry);\n\n\treturn error;\n}\n\nstatic int cpuset_add_file(struct dentry *dir, const struct cftype *cft)\n{\n\tstruct dentry *dentry;\n\tint error;\n\n\tmutex_lock(&dir->d_inode->i_mutex);\n\tdentry = cpuset_get_dentry(dir, cft->name);\n\tif (!IS_ERR(dentry)) {\n\t\terror = cpuset_create_file(dentry, 0644 | S_IFREG);\n\t\tif (!error)\n\t\t\tdentry->d_fsdata = (void *)cft;\n\t\tdput(dentry);\n\t} else\n\t\terror = PTR_ERR(dentry);\n\tmutex_unlock(&dir->d_inode->i_mutex);\n\treturn error;\n}\n\n/*\n * Stuff for reading the 'tasks' file.\n *\n * Reading this file can return large amounts of data if a cpuset has\n * *lots* of attached tasks. So it may need several calls to read(),\n * but we cannot guarantee that the information we produce is correct\n * unless we produce it entirely atomically.\n *\n * Upon tasks file open(), a struct ctr_struct is allocated, that\n * will have a pointer to an array (also allocated here). The struct\n * ctr_struct * is stored in file->private_data. Its resources will\n * be freed by release() when the file is closed. The array is used\n * to sprintf the PIDs and then used by read().\n */\n\n/* cpusets_tasks_read array */\n\nstruct ctr_struct {\n\tchar *buf;\n\tint bufsz;\n};\n\n/*\n * Load into 'pidarray' up to 'npids' of the tasks using cpuset 'cs'.\n * Return actual number of pids loaded. No need to task_lock(p)\n * when reading out p->cpuset, as we don't really care if it changes\n * on the next cycle, and we are not going to try to dereference it.\n */\nstatic int pid_array_load(pid_t *pidarray, int npids, struct cpuset *cs)\n{\n\tint n = 0;\n\tstruct task_struct *g, *p;\n\n\tread_lock(&tasklist_lock);\n\n\tdo_each_thread(g, p) {\n\t\tif (p->cpuset == cs) {\n\t\t\tif (unlikely(n == npids))\n\t\t\t\tgoto array_full;\n\t\t\tpidarray[n++] = p->pid;\n\t\t}\n\t} while_each_thread(g, p);\n\narray_full:\n\tread_unlock(&tasklist_lock);\n\treturn n;\n}\n\nstatic int cmppid(const void *a, const void *b)\n{\n\treturn *(pid_t *)a - *(pid_t *)b;\n}\n\n/*\n * Convert array 'a' of 'npids' pid_t's to a string of newline separated\n * decimal pids in 'buf'. Don't write more than 'sz' chars, but return\n * count 'cnt' of how many chars would be written if buf were large enough.\n */\nstatic int pid_array_to_buf(char *buf, int sz, pid_t *a, int npids)\n{\n\tint cnt = 0;\n\tint i;\n\n\tfor (i = 0; i < npids; i++)\n\t\tcnt += snprintf(buf + cnt, max(sz - cnt, 0), \"%d\\n\", a[i]);\n\treturn cnt;\n}\n\n/*\n * Handle an open on 'tasks' file. Prepare a buffer listing the\n * process id's of tasks currently attached to the cpuset being opened.\n *\n * Does not require any specific cpuset mutexes, and does not take any.\n */\nstatic int cpuset_tasks_open(struct inode *unused, struct file *file)\n{\n\tstruct cpuset *cs = __d_cs(file->f_path.dentry->d_parent);\n\tstruct ctr_struct *ctr;\n\tpid_t *pidarray;\n\tint npids;\n\tchar c;\n\n\tif (!(file->f_mode & FMODE_READ))\n\t\treturn 0;\n\n\tctr = kmalloc(sizeof(*ctr), GFP_KERNEL);\n\tif (!ctr)\n\t\tgoto err0;\n\n\t/*\n\t * If cpuset gets more users after we read count, we won't have\n\t * enough space - tough. This race is indistinguishable to the\n\t * caller from the case that the additional cpuset users didn't\n\t * show up until sometime later on.\n\t */\n\tnpids = atomic_read(&cs->count);\n\tpidarray = kmalloc(npids * sizeof(pid_t), GFP_KERNEL);\n\tif (!pidarray)\n\t\tgoto err1;\n\n\tnpids = pid_array_load(pidarray, npids, cs);\n\tsort(pidarray, npids, sizeof(pid_t), cmppid, NULL);\n\n\t/* Call pid_array_to_buf() twice, first just to get bufsz */\n\tctr->bufsz = pid_array_to_buf(&c, sizeof(c), pidarray, npids) + 1;\n\tctr->buf = kmalloc(ctr->bufsz, GFP_KERNEL);\n\tif (!ctr->buf)\n\t\tgoto err2;\n\tctr->bufsz = pid_array_to_buf(ctr->buf, ctr->bufsz, pidarray, npids);\n\n\tkfree(pidarray);\n\tfile->private_data = ctr;\n\treturn 0;\n\nerr2:\n\tkfree(pidarray);\nerr1:\n\tkfree(ctr);\nerr0:\n\treturn -ENOMEM;\n}\n\nstatic ssize_t cpuset_tasks_read(struct file *file, char __user *buf,\n\t\t\t\t\t\tsize_t nbytes, loff_t *ppos)\n{\n\tstruct ctr_struct *ctr = file->private_data;\n\n\treturn simple_read_from_buffer(buf, nbytes, ppos, ctr->buf, ctr->bufsz);\n}\n\nstatic int cpuset_tasks_release(struct inode *unused_inode, struct file *file)\n{\n\tstruct ctr_struct *ctr;\n\n\tif (file->f_mode & FMODE_READ) {\n\t\tctr = file->private_data;\n\t\tkfree(ctr->buf);\n\t\tkfree(ctr);\n\t}\n\treturn 0;\n}\n\n/*\n * for the common functions, 'private' gives the type of file\n */\n\nstatic struct cftype cft_tasks = {\n\t.name = \"tasks\",\n\t.open = cpuset_tasks_open,\n\t.read = cpuset_tasks_read,\n\t.release = cpuset_tasks_release,\n\t.private = FILE_TASKLIST,\n};\n\nstatic struct cftype cft_cpus = {\n\t.name = \"cpus\",\n\t.private = FILE_CPULIST,\n};\n\nstatic struct cftype cft_mems = {\n\t.name = \"mems\",\n\t.private = FILE_MEMLIST,\n};\n\nstatic struct cftype cft_cpu_exclusive = {\n\t.name = \"cpu_exclusive\",\n\t.private = FILE_CPU_EXCLUSIVE,\n};\n\nstatic struct cftype cft_mem_exclusive = {\n\t.name = \"mem_exclusive\",\n\t.private = FILE_MEM_EXCLUSIVE,\n};\n\nstatic struct cftype cft_notify_on_release = {\n\t.name = \"notify_on_release\",\n\t.private = FILE_NOTIFY_ON_RELEASE,\n};\n\nstatic struct cftype cft_memory_migrate = {\n\t.name = \"memory_migrate\",\n\t.private = FILE_MEMORY_MIGRATE,\n};\n\nstatic struct cftype cft_memory_pressure_enabled = {\n\t.name = \"memory_pressure_enabled\",\n\t.private = FILE_MEMORY_PRESSURE_ENABLED,\n};\n\nstatic struct cftype cft_memory_pressure = {\n\t.name = \"memory_pressure\",\n\t.private = FILE_MEMORY_PRESSURE,\n};\n\nstatic struct cftype cft_spread_page = {\n\t.name = \"memory_spread_page\",\n\t.private = FILE_SPREAD_PAGE,\n};\n\nstatic struct cftype cft_spread_slab = {\n\t.name = \"memory_spread_slab\",\n\t.private = FILE_SPREAD_SLAB,\n};\n\nstatic int cpuset_populate_dir(struct dentry *cs_dentry)\n{\n\tint err;\n\n\tif ((err = cpuset_add_file(cs_dentry, &cft_cpus)) < 0)\n\t\treturn err;\n\tif ((err = cpuset_add_file(cs_dentry, &cft_mems)) < 0)\n\t\treturn err;\n\tif ((err = cpuset_add_file(cs_dentry, &cft_cpu_exclusive)) < 0)\n\t\treturn err;\n\tif ((err = cpuset_add_file(cs_dentry, &cft_mem_exclusive)) < 0)\n\t\treturn err;\n\tif ((err = cpuset_add_file(cs_dentry, &cft_notify_on_release)) < 0)\n\t\treturn err;\n\tif ((err = cpuset_add_file(cs_dentry, &cft_memory_migrate)) < 0)\n\t\treturn err;\n\tif ((err = cpuset_add_file(cs_dentry, &cft_memory_pressure)) < 0)\n\t\treturn err;\n\tif ((err = cpuset_add_file(cs_dentry, &cft_spread_page)) < 0)\n\t\treturn err;\n\tif ((err = cpuset_add_file(cs_dentry, &cft_spread_slab)) < 0)\n\t\treturn err;\n\tif ((err = cpuset_add_file(cs_dentry, &cft_tasks)) < 0)\n\t\treturn err;\n\treturn 0;\n}\n\n/*\n *\tcpuset_create - create a cpuset\n *\tparent:\tcpuset that will be parent of the new cpuset.\n *\tname:\t\tname of the new cpuset. Will be strcpy'ed.\n *\tmode:\t\tmode to set on new inode\n *\n *\tMust be called with the mutex on the parent inode held\n */\n\nstatic long cpuset_create(struct cpuset *parent, const char *name, int mode)\n{\n\tstruct cpuset *cs;\n\tint err;\n\n\tcs = kmalloc(sizeof(*cs), GFP_KERNEL);\n\tif (!cs)\n\t\treturn -ENOMEM;\n\n\tmutex_lock(&manage_mutex);\n\tcpuset_update_task_memory_state();\n\tcs->flags = 0;\n\tif (notify_on_release(parent))\n\t\tset_bit(CS_NOTIFY_ON_RELEASE, &cs->flags);\n\tif (is_spread_page(parent))\n\t\tset_bit(CS_SPREAD_PAGE, &cs->flags);\n\tif (is_spread_slab(parent))\n\t\tset_bit(CS_SPREAD_SLAB, &cs->flags);\n\tcs->cpus_allowed = CPU_MASK_NONE;\n\tcs->mems_allowed = NODE_MASK_NONE;\n\tatomic_set(&cs->count, 0);\n\tINIT_LIST_HEAD(&cs->sibling);\n\tINIT_LIST_HEAD(&cs->children);\n\tcs->mems_generation = cpuset_mems_generation++;\n\tfmeter_init(&cs->fmeter);\n\n\tcs->parent = parent;\n\n\tmutex_lock(&callback_mutex);\n\tlist_add(&cs->sibling, &cs->parent->children);\n\tnumber_of_cpusets++;\n\tmutex_unlock(&callback_mutex);\n\n\terr = cpuset_create_dir(cs, name, mode);\n\tif (err < 0)\n\t\tgoto err;\n\n\t/*\n\t * Release manage_mutex before cpuset_populate_dir() because it\n\t * will down() this new directory's i_mutex and if we race with\n\t * another mkdir, we might deadlock.\n\t */\n\tmutex_unlock(&manage_mutex);\n\n\terr = cpuset_populate_dir(cs->dentry);\n\t/* If err < 0, we have a half-filled directory - oh well ;) */\n\treturn 0;\nerr:\n\tlist_del(&cs->sibling);\n\tmutex_unlock(&manage_mutex);\n\tkfree(cs);\n\treturn err;\n}\n\nstatic int cpuset_mkdir(struct inode *dir, struct dentry *dentry, int mode)\n{\n\tstruct cpuset *c_parent = dentry->d_parent->d_fsdata;\n\n\t/* the vfs holds inode->i_mutex already */\n\treturn cpuset_create(c_parent, dentry->d_name.name, mode | S_IFDIR);\n}\n\n/*\n * Locking note on the strange update_flag() call below:\n *\n * If the cpuset being removed is marked cpu_exclusive, then simulate\n * turning cpu_exclusive off, which will call update_cpu_domains().\n * The lock_cpu_hotplug() call in update_cpu_domains() must not be\n * made while holding callback_mutex. Elsewhere the kernel nests\n * callback_mutex inside lock_cpu_hotplug() calls. So the reverse\n * nesting would risk an ABBA deadlock.\n */\n\nstatic int cpuset_rmdir(struct inode *unused_dir, struct dentry *dentry)\n{\n\tstruct cpuset *cs = dentry->d_fsdata;\n\tstruct dentry *d;\n\tstruct cpuset *parent;\n\tchar *pathbuf = NULL;\n\n\t/* the vfs holds both inode->i_mutex already */\n\n\tmutex_lock(&manage_mutex);\n\tcpuset_update_task_memory_state();\n\tif (atomic_read(&cs->count) > 0) {\n\t\tmutex_unlock(&manage_mutex);\n\t\treturn -EBUSY;\n\t}\n\tif (!list_empty(&cs->children)) {\n\t\tmutex_unlock(&manage_mutex);\n\t\treturn -EBUSY;\n\t}\n\tif (is_cpu_exclusive(cs)) {\n\t\tint retval = update_flag(CS_CPU_EXCLUSIVE, cs, \"0\");\n\t\tif (retval < 0) {\n\t\t\tmutex_unlock(&manage_mutex);\n\t\t\treturn retval;\n\t\t}\n\t}\n\tparent = cs->parent;\n\tmutex_lock(&callback_mutex);\n\tset_bit(CS_REMOVED, &cs->flags);\n\tlist_del(&cs->sibling);\t/* delete my sibling from parent->children */\n\tspin_lock(&cs->dentry->d_lock);\n\td = dget(cs->dentry);\n\tcs->dentry = NULL;\n\tspin_unlock(&d->d_lock);\n\tcpuset_d_remove_dir(d);\n\tdput(d);\n\tnumber_of_cpusets--;\n\tmutex_unlock(&callback_mutex);\n\tif (list_empty(&parent->children))\n\t\tcheck_for_release(parent, &pathbuf);\n\tmutex_unlock(&manage_mutex);\n\tcpuset_release_agent(pathbuf);\n\treturn 0;\n}\n\n/*\n * cpuset_init_early - just enough so that the calls to\n * cpuset_update_task_memory_state() in early init code\n * are harmless.\n */\n\nint __init cpuset_init_early(void)\n{\n\tstruct task_struct *tsk = current;\n\n\ttsk->cpuset = &top_cpuset;\n\ttsk->cpuset->mems_generation = cpuset_mems_generation++;\n\treturn 0;\n}\n\n/**\n * cpuset_init - initialize cpusets at system boot\n *\n * Description: Initialize top_cpuset and the cpuset internal file system,\n **/\n\nint __init cpuset_init(void)\n{\n\tstruct dentry *root;\n\tint err;\n\n\ttop_cpuset.cpus_allowed = CPU_MASK_ALL;\n\ttop_cpuset.mems_allowed = NODE_MASK_ALL;\n\n\tfmeter_init(&top_cpuset.fmeter);\n\ttop_cpuset.mems_generation = cpuset_mems_generation++;\n\n\tinit_task.cpuset = &top_cpuset;\n\n\terr = register_filesystem(&cpuset_fs_type);\n\tif (err < 0)\n\t\tgoto out;\n\tcpuset_mount = kern_mount(&cpuset_fs_type);\n\tif (IS_ERR(cpuset_mount)) {\n\t\tprintk(KERN_ERR \"cpuset: could not mount!\\n\");\n\t\terr = PTR_ERR(cpuset_mount);\n\t\tcpuset_mount = NULL;\n\t\tgoto out;\n\t}\n\troot = cpuset_mount->mnt_sb->s_root;\n\troot->d_fsdata = &top_cpuset;\n\tinc_nlink(root->d_inode);\n\ttop_cpuset.dentry = root;\n\troot->d_inode->i_op = &cpuset_dir_inode_operations;\n\tnumber_of_cpusets = 1;\n\terr = cpuset_populate_dir(root);\n\t/* memory_pressure_enabled is in root cpuset only */\n\tif (err == 0)\n\t\terr = cpuset_add_file(root, &cft_memory_pressure_enabled);\nout:\n\treturn err;\n}\n\n/*\n * If common_cpu_mem_hotplug_unplug(), below, unplugs any CPUs\n * or memory nodes, we need to walk over the cpuset hierarchy,\n * removing that CPU or node from all cpusets. If this removes the\n * last CPU or node from a cpuset, then the guarantee_online_cpus()\n * or guarantee_online_mems() code will use that emptied cpusets\n * parent online CPUs or nodes. Cpusets that were already empty of\n * CPUs or nodes are left empty.\n *\n * This routine is intentionally inefficient in a couple of regards.\n * It will check all cpusets in a subtree even if the top cpuset of\n * the subtree has no offline CPUs or nodes. It checks both CPUs and\n * nodes, even though the caller could have been coded to know that\n * only one of CPUs or nodes needed to be checked on a given call.\n * This was done to minimize text size rather than cpu cycles.\n *\n * Call with both manage_mutex and callback_mutex held.\n *\n * Recursive, on depth of cpuset subtree.\n */\n\nstatic void guarantee_online_cpus_mems_in_subtree(const struct cpuset *cur)\n{\n\tstruct cpuset *c;\n\n\t/* Each of our child cpusets mems must be online */\n\tlist_for_each_entry(c, &cur->children, sibling) {\n\t\tguarantee_online_cpus_mems_in_subtree(c);\n\t\tif (!cpus_empty(c->cpus_allowed))\n\t\t\tguarantee_online_cpus(c, &c->cpus_allowed);\n\t\tif (!nodes_empty(c->mems_allowed))\n\t\t\tguarantee_online_mems(c, &c->mems_allowed);\n\t}\n}\n\n/*\n * The cpus_allowed and mems_allowed nodemasks in the top_cpuset track\n * cpu_online_map and node_online_map. Force the top cpuset to track\n * whats online after any CPU or memory node hotplug or unplug event.\n *\n * To ensure that we don't remove a CPU or node from the top cpuset\n * that is currently in use by a child cpuset (which would violate\n * the rule that cpusets must be subsets of their parent), we first\n * call the recursive routine guarantee_online_cpus_mems_in_subtree().\n *\n * Since there are two callers of this routine, one for CPU hotplug\n * events and one for memory node hotplug events, we could have coded\n * two separate routines here. We code it as a single common routine\n * in order to minimize text size.\n */\n\nstatic void common_cpu_mem_hotplug_unplug(void)\n{\n\tmutex_lock(&manage_mutex);\n\tmutex_lock(&callback_mutex);\n\n\tguarantee_online_cpus_mems_in_subtree(&top_cpuset);\n\ttop_cpuset.cpus_allowed = cpu_online_map;\n\ttop_cpuset.mems_allowed = node_online_map;\n\n\tmutex_unlock(&callback_mutex);\n\tmutex_unlock(&manage_mutex);\n}\n\n/*\n * The top_cpuset tracks what CPUs and Memory Nodes are online,\n * period. This is necessary in order to make cpusets transparent\n * (of no affect) on systems that are actively using CPU hotplug\n * but making no active use of cpusets.\n *\n * This routine ensures that top_cpuset.cpus_allowed tracks\n * cpu_online_map on each CPU hotplug (cpuhp) event.\n */\n\nstatic int cpuset_handle_cpuhp(struct notifier_block *nb,\n\t\t\t\tunsigned long phase, void *cpu)\n{\n\tcommon_cpu_mem_hotplug_unplug();\n\treturn 0;\n}\n\n#ifdef CONFIG_MEMORY_HOTPLUG\n/*\n * Keep top_cpuset.mems_allowed tracking node_online_map.\n * Call this routine anytime after you change node_online_map.\n * See also the previous routine cpuset_handle_cpuhp().\n */\n\nvoid cpuset_track_online_nodes(void)\n{\n\tcommon_cpu_mem_hotplug_unplug();\n}\n#endif\n\n/**\n * cpuset_init_smp - initialize cpus_allowed\n *\n * Description: Finish top cpuset after cpu, node maps are initialized\n **/\n\nvoid __init cpuset_init_smp(void)\n{\n\ttop_cpuset.cpus_allowed = cpu_online_map;\n\ttop_cpuset.mems_allowed = node_online_map;\n\n\thotcpu_notifier(cpuset_handle_cpuhp, 0);\n}\n\n/**\n * cpuset_fork - attach newly forked task to its parents cpuset.\n * @tsk: pointer to task_struct of forking parent process.\n *\n * Description: A task inherits its parent's cpuset at fork().\n *\n * A pointer to the shared cpuset was automatically copied in fork.c\n * by dup_task_struct(). However, we ignore that copy, since it was\n * not made under the protection of task_lock(), so might no longer be\n * a valid cpuset pointer. attach_task() might have already changed\n * current->cpuset, allowing the previously referenced cpuset to\n * be removed and freed. Instead, we task_lock(current) and copy\n * its present value of current->cpuset for our freshly forked child.\n *\n * At the point that cpuset_fork() is called, 'current' is the parent\n * task, and the passed argument 'child' points to the child task.\n **/\n\nvoid cpuset_fork(struct task_struct *child)\n{\n\ttask_lock(current);\n\tchild->cpuset = current->cpuset;\n\tatomic_inc(&child->cpuset->count);\n\ttask_unlock(current);\n}\n\n/**\n * cpuset_exit - detach cpuset from exiting task\n * @tsk: pointer to task_struct of exiting process\n *\n * Description: Detach cpuset from @tsk and release it.\n *\n * Note that cpusets marked notify_on_release force every task in\n * them to take the global manage_mutex mutex when exiting.\n * This could impact scaling on very large systems. Be reluctant to\n * use notify_on_release cpusets where very high task exit scaling\n * is required on large systems.\n *\n * Don't even think about derefencing 'cs' after the cpuset use count\n * goes to zero, except inside a critical section guarded by manage_mutex\n * or callback_mutex. Otherwise a zero cpuset use count is a license to\n * any other task to nuke the cpuset immediately, via cpuset_rmdir().\n *\n * This routine has to take manage_mutex, not callback_mutex, because\n * it is holding that mutex while calling check_for_release(),\n * which calls kmalloc(), so can't be called holding callback_mutex().\n *\n * the_top_cpuset_hack:\n *\n * Set the exiting tasks cpuset to the root cpuset (top_cpuset).\n *\n * Don't leave a task unable to allocate memory, as that is an\n * accident waiting to happen should someone add a callout in\n * do_exit() after the cpuset_exit() call that might allocate.\n * If a task tries to allocate memory with an invalid cpuset,\n * it will oops in cpuset_update_task_memory_state().\n *\n * We call cpuset_exit() while the task is still competent to\n * handle notify_on_release(), then leave the task attached to\n * the root cpuset (top_cpuset) for the remainder of its exit.\n *\n * To do this properly, we would increment the reference count on\n * top_cpuset, and near the very end of the kernel/exit.c do_exit()\n * code we would add a second cpuset function call, to drop that\n * reference. This would just create an unnecessary hot spot on\n * the top_cpuset reference count, to no avail.\n *\n * Normally, holding a reference to a cpuset without bumping its\n * count is unsafe. The cpuset could go away, or someone could\n * attach us to a different cpuset, decrementing the count on\n * the first cpuset that we never incremented. But in this case,\n * top_cpuset isn't going away, and either task has PF_EXITING set,\n * which wards off any attach_task() attempts, or task is a failed\n * fork, never visible to attach_task.\n *\n * Another way to do this would be to set the cpuset pointer\n * to NULL here, and check in cpuset_update_task_memory_state()\n * for a NULL pointer. This hack avoids that NULL check, for no\n * cost (other than this way too long comment ;).\n **/\n\nvoid cpuset_exit(struct task_struct *tsk)\n{\n\tstruct cpuset *cs;\n\n\ttask_lock(current);\n\tcs = tsk->cpuset;\n\ttsk->cpuset = &top_cpuset;\t/* the_top_cpuset_hack - see above */\n\ttask_unlock(current);\n\n\tif (notify_on_release(cs)) {\n\t\tchar *pathbuf = NULL;\n\n\t\tmutex_lock(&manage_mutex);\n\t\tif (atomic_dec_and_test(&cs->count))\n\t\t\tcheck_for_release(cs, &pathbuf);\n\t\tmutex_unlock(&manage_mutex);\n\t\tcpuset_release_agent(pathbuf);\n\t} else {\n\t\tatomic_dec(&cs->count);\n\t}\n}\n\n/**\n * cpuset_cpus_allowed - return cpus_allowed mask from a tasks cpuset.\n * @tsk: pointer to task_struct from which to obtain cpuset->cpus_allowed.\n *\n * Description: Returns the cpumask_t cpus_allowed of the cpuset\n * attached to the specified @tsk. Guaranteed to return some non-empty\n * subset of cpu_online_map, even if this means going outside the\n * tasks cpuset.\n **/\n\ncpumask_t cpuset_cpus_allowed(struct task_struct *tsk)\n{\n\tcpumask_t mask;\n\n\tmutex_lock(&callback_mutex);\n\ttask_lock(tsk);\n\tguarantee_online_cpus(tsk->cpuset, &mask);\n\ttask_unlock(tsk);\n\tmutex_unlock(&callback_mutex);\n\n\treturn mask;\n}\n\nvoid cpuset_init_current_mems_allowed(void)\n{\n\tcurrent->mems_allowed = NODE_MASK_ALL;\n}\n\n/**\n * cpuset_mems_allowed - return mems_allowed mask from a tasks cpuset.\n * @tsk: pointer to task_struct from which to obtain cpuset->mems_allowed.\n *\n * Description: Returns the nodemask_t mems_allowed of the cpuset\n * attached to the specified @tsk. Guaranteed to return some non-empty\n * subset of node_online_map, even if this means going outside the\n * tasks cpuset.\n **/\n\nnodemask_t cpuset_mems_allowed(struct task_struct *tsk)\n{\n\tnodemask_t mask;\n\n\tmutex_lock(&callback_mutex);\n\ttask_lock(tsk);\n\tguarantee_online_mems(tsk->cpuset, &mask);\n\ttask_unlock(tsk);\n\tmutex_unlock(&callback_mutex);\n\n\treturn mask;\n}\n\n/**\n * cpuset_zonelist_valid_mems_allowed - check zonelist vs. curremt mems_allowed\n * @zl: the zonelist to be checked\n *\n * Are any of the nodes on zonelist zl allowed in current->mems_allowed?\n */\nint cpuset_zonelist_valid_mems_allowed(struct zonelist *zl)\n{\n\tint i;\n\n\tfor (i = 0; zl->zones[i]; i++) {\n\t\tint nid = zone_to_nid(zl->zones[i]);\n\n\t\tif (node_isset(nid, current->mems_allowed))\n\t\t\treturn 1;\n\t}\n\treturn 0;\n}\n\n/*\n * nearest_exclusive_ancestor() - Returns the nearest mem_exclusive\n * ancestor to the specified cpuset. Call holding callback_mutex.\n * If no ancestor is mem_exclusive (an unusual configuration), then\n * returns the root cpuset.\n */\nstatic const struct cpuset *nearest_exclusive_ancestor(const struct cpuset *cs)\n{\n\twhile (!is_mem_exclusive(cs) && cs->parent)\n\t\tcs = cs->parent;\n\treturn cs;\n}\n\n/**\n * cpuset_zone_allowed_softwall - Can we allocate on zone z's memory node?\n * @z: is this zone on an allowed node?\n * @gfp_mask: memory allocation flags\n *\n * If we're in interrupt, yes, we can always allocate. If\n * __GFP_THISNODE is set, yes, we can always allocate. If zone\n * z's node is in our tasks mems_allowed, yes. If it's not a\n * __GFP_HARDWALL request and this zone's nodes is in the nearest\n * mem_exclusive cpuset ancestor to this tasks cpuset, yes.\n * If the task has been OOM killed and has access to memory reserves\n * as specified by the TIF_MEMDIE flag, yes.\n * Otherwise, no.\n *\n * If __GFP_HARDWALL is set, cpuset_zone_allowed_softwall()\n * reduces to cpuset_zone_allowed_hardwall(). Otherwise,\n * cpuset_zone_allowed_softwall() might sleep, and might allow a zone\n * from an enclosing cpuset.\n *\n * cpuset_zone_allowed_hardwall() only handles the simpler case of\n * hardwall cpusets, and never sleeps.\n *\n * The __GFP_THISNODE placement logic is really handled elsewhere,\n * by forcibly using a zonelist starting at a specified node, and by\n * (in get_page_from_freelist()) refusing to consider the zones for\n * any node on the zonelist except the first. By the time any such\n * calls get to this routine, we should just shut up and say 'yes'.\n *\n * GFP_USER allocations are marked with the __GFP_HARDWALL bit,\n * and do not allow allocations outside the current tasks cpuset\n * unless the task has been OOM killed as is marked TIF_MEMDIE.\n * GFP_KERNEL allocations are not so marked, so can escape to the\n * nearest enclosing mem_exclusive ancestor cpuset.\n *\n * Scanning up parent cpusets requires callback_mutex. The\n * __alloc_pages() routine only calls here with __GFP_HARDWALL bit\n * _not_ set if it's a GFP_KERNEL allocation, and all nodes in the\n * current tasks mems_allowed came up empty on the first pass over\n * the zonelist. So only GFP_KERNEL allocations, if all nodes in the\n * cpuset are short of memory, might require taking the callback_mutex\n * mutex.\n *\n * The first call here from mm/page_alloc:get_page_from_freelist()\n * has __GFP_HARDWALL set in gfp_mask, enforcing hardwall cpusets,\n * so no allocation on a node outside the cpuset is allowed (unless\n * in interrupt, of course).\n *\n * The second pass through get_page_from_freelist() doesn't even call\n * here for GFP_ATOMIC calls. For those calls, the __alloc_pages()\n * variable 'wait' is not set, and the bit ALLOC_CPUSET is not set\n * in alloc_flags. That logic and the checks below have the combined\n * affect that:\n *\tin_interrupt - any node ok (current task context irrelevant)\n *\tGFP_ATOMIC - any node ok\n *\tTIF_MEMDIE - any node ok\n *\tGFP_KERNEL - any node in enclosing mem_exclusive cpuset ok\n *\tGFP_USER - only nodes in current tasks mems allowed ok.\n *\n * Rule:\n * Don't call cpuset_zone_allowed_softwall if you can't sleep, unless you\n * pass in the __GFP_HARDWALL flag set in gfp_flag, which disables\n * the code that might scan up ancestor cpusets and sleep.\n */\n\nint __cpuset_zone_allowed_softwall(struct zone *z, gfp_t gfp_mask)\n{\n\tint node;\t\t\t/* node that zone z is on */\n\tconst struct cpuset *cs;\t/* current cpuset ancestors */\n\tint allowed;\t\t\t/* is allocation in zone z allowed? */\n\n\tif (in_interrupt() || (gfp_mask & __GFP_THISNODE))\n\t\treturn 1;\n\tnode = zone_to_nid(z);\n\tmight_sleep_if(!(gfp_mask & __GFP_HARDWALL));\n\tif (node_isset(node, current->mems_allowed))\n\t\treturn 1;\n\t/*\n\t * Allow tasks that have access to memory reserves because they have\n\t * been OOM killed to get memory anywhere.\n\t */\n\tif (unlikely(test_thread_flag(TIF_MEMDIE)))\n\t\treturn 1;\n\tif (gfp_mask & __GFP_HARDWALL)\t/* If hardwall request, stop here */\n\t\treturn 0;\n\n\tif (current->flags & PF_EXITING) /* Let dying task have memory */\n\t\treturn 1;\n\n\t/* Not hardwall and node outside mems_allowed: scan up cpusets */\n\tmutex_lock(&callback_mutex);\n\n\ttask_lock(current);\n\tcs = nearest_exclusive_ancestor(current->cpuset);\n\ttask_unlock(current);\n\n\tallowed = node_isset(node, cs->mems_allowed);\n\tmutex_unlock(&callback_mutex);\n\treturn allowed;\n}\n\n/*\n * cpuset_zone_allowed_hardwall - Can we allocate on zone z's memory node?\n * @z: is this zone on an allowed node?\n * @gfp_mask: memory allocation flags\n *\n * If we're in interrupt, yes, we can always allocate.\n * If __GFP_THISNODE is set, yes, we can always allocate. If zone\n * z's node is in our tasks mems_allowed, yes. If the task has been\n * OOM killed and has access to memory reserves as specified by the\n * TIF_MEMDIE flag, yes. Otherwise, no.\n *\n * The __GFP_THISNODE placement logic is really handled elsewhere,\n * by forcibly using a zonelist starting at a specified node, and by\n * (in get_page_from_freelist()) refusing to consider the zones for\n * any node on the zonelist except the first. By the time any such\n * calls get to this routine, we should just shut up and say 'yes'.\n *\n * Unlike the cpuset_zone_allowed_softwall() variant, above,\n * this variant requires that the zone be in the current tasks\n * mems_allowed or that we're in interrupt. It does not scan up the\n * cpuset hierarchy for the nearest enclosing mem_exclusive cpuset.\n * It never sleeps.\n */\n\nint __cpuset_zone_allowed_hardwall(struct zone *z, gfp_t gfp_mask)\n{\n\tint node;\t\t\t/* node that zone z is on */\n\n\tif (in_interrupt() || (gfp_mask & __GFP_THISNODE))\n\t\treturn 1;\n\tnode = zone_to_nid(z);\n\tif (node_isset(node, current->mems_allowed))\n\t\treturn 1;\n /*\n * Allow tasks that have access to memory reserves because they have\n * been OOM killed to get memory anywhere.\n */\n if (unlikely(test_thread_flag(TIF_MEMDIE)))\n return 1;\n\treturn 0;\n}\n\n/**\n * cpuset_lock - lock out any changes to cpuset structures\n *\n * The out of memory (oom) code needs to mutex_lock cpusets\n * from being changed while it scans the tasklist looking for a\n * task in an overlapping cpuset. Expose callback_mutex via this\n * cpuset_lock() routine, so the oom code can lock it, before\n * locking the task list. The tasklist_lock is a spinlock, so\n * must be taken inside callback_mutex.\n */\n\nvoid cpuset_lock(void)\n{\n\tmutex_lock(&callback_mutex);\n}\n\n/**\n * cpuset_unlock - release lock on cpuset changes\n *\n * Undo the lock taken in a previous cpuset_lock() call.\n */\n\nvoid cpuset_unlock(void)\n{\n\tmutex_unlock(&callback_mutex);\n}\n\n/**\n * cpuset_mem_spread_node() - On which node to begin search for a page\n *\n * If a task is marked PF_SPREAD_PAGE or PF_SPREAD_SLAB (as for\n * tasks in a cpuset with is_spread_page or is_spread_slab set),\n * and if the memory allocation used cpuset_mem_spread_node()\n * to determine on which node to start looking, as it will for\n * certain page cache or slab cache pages such as used for file\n * system buffers and inode caches, then instead of starting on the\n * local node to look for a free page, rather spread the starting\n * node around the tasks mems_allowed nodes.\n *\n * We don't have to worry about the returned node being offline\n * because \"it can't happen\", and even if it did, it would be ok.\n *\n * The routines calling guarantee_online_mems() are careful to\n * only set nodes in task->mems_allowed that are online. So it\n * should not be possible for the following code to return an\n * offline node. But if it did, that would be ok, as this routine\n * is not returning the node where the allocation must be, only\n * the node where the search should start. The zonelist passed to\n * __alloc_pages() will include all nodes. If the slab allocator\n * is passed an offline node, it will fall back to the local node.\n * See kmem_cache_alloc_node().\n */\n\nint cpuset_mem_spread_node(void)\n{\n\tint node;\n\n\tnode = next_node(current->cpuset_mem_spread_rotor, current->mems_allowed);\n\tif (node == MAX_NUMNODES)\n\t\tnode = first_node(current->mems_allowed);\n\tcurrent->cpuset_mem_spread_rotor = node;\n\treturn node;\n}\nEXPORT_SYMBOL_GPL(cpuset_mem_spread_node);\n\n/**\n * cpuset_excl_nodes_overlap - Do we overlap @p's mem_exclusive ancestors?\n * @p: pointer to task_struct of some other task.\n *\n * Description: Return true if the nearest mem_exclusive ancestor\n * cpusets of tasks @p and current overlap. Used by oom killer to\n * determine if task @p's memory usage might impact the memory\n * available to the current task.\n *\n * Call while holding callback_mutex.\n **/\n\nint cpuset_excl_nodes_overlap(const struct task_struct *p)\n{\n\tconst struct cpuset *cs1, *cs2;\t/* my and p's cpuset ancestors */\n\tint overlap = 1;\t\t/* do cpusets overlap? */\n\n\ttask_lock(current);\n\tif (current->flags & PF_EXITING) {\n\t\ttask_unlock(current);\n\t\tgoto done;\n\t}\n\tcs1 = nearest_exclusive_ancestor(current->cpuset);\n\ttask_unlock(current);\n\n\ttask_lock((struct task_struct *)p);\n\tif (p->flags & PF_EXITING) {\n\t\ttask_unlock((struct task_struct *)p);\n\t\tgoto done;\n\t}\n\tcs2 = nearest_exclusive_ancestor(p->cpuset);\n\ttask_unlock((struct task_struct *)p);\n\n\toverlap = nodes_intersects(cs1->mems_allowed, cs2->mems_allowed);\ndone:\n\treturn overlap;\n}\n\n/*\n * Collection of memory_pressure is suppressed unless\n * this flag is enabled by writing \"1\" to the special\n * cpuset file 'memory_pressure_enabled' in the root cpuset.\n */\n\nint cpuset_memory_pressure_enabled __read_mostly;\n\n/**\n * cpuset_memory_pressure_bump - keep stats of per-cpuset reclaims.\n *\n * Keep a running average of the rate of synchronous (direct)\n * page reclaim efforts initiated by tasks in each cpuset.\n *\n * This represents the rate at which some task in the cpuset\n * ran low on memory on all nodes it was allowed to use, and\n * had to enter the kernels page reclaim code in an effort to\n * create more free memory by tossing clean pages or swapping\n * or writing dirty pages.\n *\n * Display to user space in the per-cpuset read-only file\n * \"memory_pressure\". Value displayed is an integer\n * representing the recent rate of entry into the synchronous\n * (direct) page reclaim by any task attached to the cpuset.\n **/\n\nvoid __cpuset_memory_pressure_bump(void)\n{\n\tstruct cpuset *cs;\n\n\ttask_lock(current);\n\tcs = current->cpuset;\n\tfmeter_markevent(&cs->fmeter);\n\ttask_unlock(current);\n}\n\n/*\n * proc_cpuset_show()\n * - Print tasks cpuset path into seq_file.\n * - Used for /proc/<pid>/cpuset.\n * - No need to task_lock(tsk) on this tsk->cpuset reference, as it\n * doesn't really matter if tsk->cpuset changes after we read it,\n * and we take manage_mutex, keeping attach_task() from changing it\n * anyway. No need to check that tsk->cpuset != NULL, thanks to\n * the_top_cpuset_hack in cpuset_exit(), which sets an exiting tasks\n * cpuset to top_cpuset.\n */\nstatic int proc_cpuset_show(struct seq_file *m, void *v)\n{\n\tstruct pid *pid;\n\tstruct task_struct *tsk;\n\tchar *buf;\n\tint retval;\n\n\tretval = -ENOMEM;\n\tbuf = kmalloc(PAGE_SIZE, GFP_KERNEL);\n\tif (!buf)\n\t\tgoto out;\n\n\tretval = -ESRCH;\n\tpid = m->private;\n\ttsk = get_pid_task(pid, PIDTYPE_PID);\n\tif (!tsk)\n\t\tgoto out_free;\n\n\tretval = -EINVAL;\n\tmutex_lock(&manage_mutex);\n\n\tretval = cpuset_path(tsk->cpuset, buf, PAGE_SIZE);\n\tif (retval < 0)\n\t\tgoto out_unlock;\n\tseq_puts(m, buf);\n\tseq_putc(m, '\\n');\nout_unlock:\n\tmutex_unlock(&manage_mutex);\n\tput_task_struct(tsk);\nout_free:\n\tkfree(buf);\nout:\n\treturn retval;\n}\n\nstatic int cpuset_open(struct inode *inode, struct file *file)\n{\n\tstruct pid *pid = PROC_I(inode)->pid;\n\treturn single_open(file, proc_cpuset_show, pid);\n}\n\nconst struct file_operations proc_cpuset_operations = {\n\t.open\t\t= cpuset_open,\n\t.read\t\t= seq_read,\n\t.llseek\t\t= seq_lseek,\n\t.release\t= single_release,\n};\n\n/* Display task cpus_allowed, mems_allowed in /proc/<pid>/status file. */\nchar *cpuset_task_status_allowed(struct task_struct *task, char *buffer)\n{\n\tbuffer += sprintf(buffer, \"Cpus_allowed:\\t\");\n\tbuffer += cpumask_scnprintf(buffer, PAGE_SIZE, task->cpus_allowed);\n\tbuffer += sprintf(buffer, \"\\n\");\n\tbuffer += sprintf(buffer, \"Mems_allowed:\\t\");\n\tbuffer += nodemask_scnprintf(buffer, PAGE_SIZE, task->mems_allowed);\n\tbuffer += sprintf(buffer, \"\\n\");\n\treturn buffer;\n}\n/* delayacct.c - per-task delay accounting\n *\n * Copyright (C) Shailabh Nagar, IBM Corp. 2006\n *\n * This program is free software; you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation; either version 2 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it would be useful, but\n * WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See\n * the GNU General Public License for more details.\n */\n\n#include <linux/sched.h>\n#include <linux/slab.h>\n#include <linux/time.h>\n#include <linux/sysctl.h>\n#include <linux/delayacct.h>\n\nint delayacct_on __read_mostly = 1;\t/* Delay accounting turned on/off */\nstruct kmem_cache *delayacct_cache;\n\nstatic int __init delayacct_setup_disable(char *str)\n{\n\tdelayacct_on = 0;\n\treturn 1;\n}\n__setup(\"nodelayacct\", delayacct_setup_disable);\n\nvoid delayacct_init(void)\n{\n\tdelayacct_cache = KMEM_CACHE(task_delay_info, SLAB_PANIC);\n\tdelayacct_tsk_init(&init_task);\n}\n\nvoid __delayacct_tsk_init(struct task_struct *tsk)\n{\n\ttsk->delays = kmem_cache_zalloc(delayacct_cache, GFP_KERNEL);\n\tif (tsk->delays)\n\t\tspin_lock_init(&tsk->delays->lock);\n}\n\n/*\n * Start accounting for a delay statistic using\n * its starting timestamp (@start)\n */\n\nstatic inline void delayacct_start(struct timespec *start)\n{\n\tdo_posix_clock_monotonic_gettime(start);\n}\n\n/*\n * Finish delay accounting for a statistic using\n * its timestamps (@start, @end), accumalator (@total) and @count\n */\n\nstatic void delayacct_end(struct timespec *start, struct timespec *end,\n\t\t\t\tu64 *total, u32 *count)\n{\n\tstruct timespec ts;\n\ts64 ns;\n\tunsigned long flags;\n\n\tdo_posix_clock_monotonic_gettime(end);\n\tts = timespec_sub(*end, *start);\n\tns = timespec_to_ns(&ts);\n\tif (ns < 0)\n\t\treturn;\n\n\tspin_lock_irqsave(&current->delays->lock, flags);\n\t*total += ns;\n\t(*count)++;\n\tspin_unlock_irqrestore(&current->delays->lock, flags);\n}\n\nvoid __delayacct_blkio_start(void)\n{\n\tdelayacct_start(&current->delays->blkio_start);\n}\n\nvoid __delayacct_blkio_end(void)\n{\n\tif (current->delays->flags & DELAYACCT_PF_SWAPIN)\n\t\t/* Swapin block I/O */\n\t\tdelayacct_end(&current->delays->blkio_start,\n\t\t\t&current->delays->blkio_end,\n\t\t\t&current->delays->swapin_delay,\n\t\t\t&current->delays->swapin_count);\n\telse\t/* Other block I/O */\n\t\tdelayacct_end(&current->delays->blkio_start,\n\t\t\t&current->delays->blkio_end,\n\t\t\t&current->delays->blkio_delay,\n\t\t\t&current->delays->blkio_count);\n}\n\nint __delayacct_add_tsk(struct taskstats *d, struct task_struct *tsk)\n{\n\ts64 tmp;\n\tstruct timespec ts;\n\tunsigned long t1,t2,t3;\n\tunsigned long flags;\n\n\t/* Though tsk->delays accessed later, early exit avoids\n\t * unnecessary returning of other data\n\t */\n\tif (!tsk->delays)\n\t\tgoto done;\n\n\ttmp = (s64)d->cpu_run_real_total;\n\tcputime_to_timespec(tsk->utime + tsk->stime, &ts);\n\ttmp += timespec_to_ns(&ts);\n\td->cpu_run_real_total = (tmp < (s64)d->cpu_run_real_total) ? 0 : tmp;\n\n\t/*\n\t * No locking available for sched_info (and too expensive to add one)\n\t * Mitigate by taking snapshot of values\n\t */\n\tt1 = tsk->sched_info.pcnt;\n\tt2 = tsk->sched_info.run_delay;\n\tt3 = tsk->sched_info.cpu_time;\n\n\td->cpu_count += t1;\n\n\tjiffies_to_timespec(t2, &ts);\n\ttmp = (s64)d->cpu_delay_total + timespec_to_ns(&ts);\n\td->cpu_delay_total = (tmp < (s64)d->cpu_delay_total) ? 0 : tmp;\n\n\ttmp = (s64)d->cpu_run_virtual_total + (s64)jiffies_to_usecs(t3) * 1000;\n\td->cpu_run_virtual_total =\n\t\t(tmp < (s64)d->cpu_run_virtual_total) ?\t0 : tmp;\n\n\t/* zero XXX_total, non-zero XXX_count implies XXX stat overflowed */\n\n\tspin_lock_irqsave(&tsk->delays->lock, flags);\n\ttmp = d->blkio_delay_total + tsk->delays->blkio_delay;\n\td->blkio_delay_total = (tmp < d->blkio_delay_total) ? 0 : tmp;\n\ttmp = d->swapin_delay_total + tsk->delays->swapin_delay;\n\td->swapin_delay_total = (tmp < d->swapin_delay_total) ? 0 : tmp;\n\td->blkio_count += tsk->delays->blkio_count;\n\td->swapin_count += tsk->delays->swapin_count;\n\tspin_unlock_irqrestore(&tsk->delays->lock, flags);\n\ndone:\n\treturn 0;\n}\n\n__u64 __delayacct_blkio_ticks(struct task_struct *tsk)\n{\n\t__u64 ret;\n\tunsigned long flags;\n\n\tspin_lock_irqsave(&tsk->delays->lock, flags);\n\tret = nsec_to_clock_t(tsk->delays->blkio_delay +\n\t\t\t\ttsk->delays->swapin_delay);\n\tspin_unlock_irqrestore(&tsk->delays->lock, flags);\n\treturn ret;\n}\n\n\n#include <linux/module.h>\n#include <linux/notifier.h>\n#include <linux/vmalloc.h>\n#include <linux/kdebug.h>\n\n\nstatic ATOMIC_NOTIFIER_HEAD(die_chain);\n\nint notify_die(enum die_val val, const char *str,\n\t struct pt_regs *regs, long err, int trap, int sig)\n{\n\tstruct die_args args = {\n\t\t.regs\t\t= regs,\n\t\t.str\t\t= str,\n\t\t.err\t\t= err,\n\t\t.trapnr\t\t= trap,\n\t\t.signr\t\t= sig,\n\n\t};\n\n\treturn atomic_notifier_call_chain(&die_chain, val, &args);\n}\n\nint register_die_notifier(struct notifier_block *nb)\n{\n\tvmalloc_sync_all();\n\treturn atomic_notifier_chain_register(&die_chain, nb);\n}\nEXPORT_SYMBOL_GPL(register_die_notifier);\n\nint unregister_die_notifier(struct notifier_block *nb)\n{\n\treturn atomic_notifier_chain_unregister(&die_chain, nb);\n}\nEXPORT_SYMBOL_GPL(unregister_die_notifier);\n\n\n/* $Id: dma.c,v 1.7 1994/12/28 03:35:33 root Exp root $\n * linux/kernel/dma.c: A DMA channel allocator. Inspired by linux/kernel/irq.c.\n *\n * Written by Hennus Bergman, 1992.\n *\n * 1994/12/26: Changes by Alex Nash to fix a minor bug in /proc/dma.\n * In the previous version the reported device could end up being wrong,\n * if a device requested a DMA channel that was already in use.\n * [It also happened to remove the sizeof(char *) == sizeof(int)\n * assumption introduced because of those /proc/dma patches. -- Hennus]\n */\n#include <linux/module.h>\n#include <linux/kernel.h>\n#include <linux/errno.h>\n#include <linux/spinlock.h>\n#include <linux/string.h>\n#include <linux/seq_file.h>\n#include <linux/proc_fs.h>\n#include <linux/init.h>\n#include <asm/dma.h>\n#include <asm/system.h>\n\n \n\n/* A note on resource allocation:\n *\n * All drivers needing DMA channels, should allocate and release them\n * through the public routines `request_dma()' and `free_dma()'.\n *\n * In order to avoid problems, all processes should allocate resources in\n * the same sequence and release them in the reverse order.\n *\n * So, when allocating DMAs and IRQs, first allocate the IRQ, then the DMA.\n * When releasing them, first release the DMA, then release the IRQ.\n * If you don't, you may cause allocation requests to fail unnecessarily.\n * This doesn't really matter now, but it will once we get real semaphores\n * in the kernel.\n */\n\n\nDEFINE_SPINLOCK(dma_spin_lock);\n\n/*\n *\tIf our port doesn't define this it has no PC like DMA\n */\n\n#ifdef MAX_DMA_CHANNELS\n\n\n/* Channel n is busy iff dma_chan_busy[n].lock != 0.\n * DMA0 used to be reserved for DRAM refresh, but apparently not any more...\n * DMA4 is reserved for cascading.\n */\n\nstruct dma_chan {\n\tint lock;\n\tconst char *device_id;\n};\n\nstatic struct dma_chan dma_chan_busy[MAX_DMA_CHANNELS] = {\n\t[4] = { 1, \"cascade\" },\n};\n\n\n/**\n * request_dma - request and reserve a system DMA channel\n * @dmanr: DMA channel number\n * @device_id: reserving device ID string, used in /proc/dma\n */\nint request_dma(unsigned int dmanr, const char * device_id)\n{\n\tif (dmanr >= MAX_DMA_CHANNELS)\n\t\treturn -EINVAL;\n\n\tif (xchg(&dma_chan_busy[dmanr].lock, 1) != 0)\n\t\treturn -EBUSY;\n\n\tdma_chan_busy[dmanr].device_id = device_id;\n\n\t/* old flag was 0, now contains 1 to indicate busy */\n\treturn 0;\n} /* request_dma */\n\n/**\n * free_dma - free a reserved system DMA channel\n * @dmanr: DMA channel number\n */\nvoid free_dma(unsigned int dmanr)\n{\n\tif (dmanr >= MAX_DMA_CHANNELS) {\n\t\tprintk(KERN_WARNING \"Trying to free DMA%d\\n\", dmanr);\n\t\treturn;\n\t}\n\n\tif (xchg(&dma_chan_busy[dmanr].lock, 0) == 0) {\n\t\tprintk(KERN_WARNING \"Trying to free free DMA%d\\n\", dmanr);\n\t\treturn;\n\t}\t\n\n} /* free_dma */\n\n#else\n\nint request_dma(unsigned int dmanr, const char *device_id)\n{\n\treturn -EINVAL;\n}\n\nvoid free_dma(unsigned int dmanr)\n{\n}\n\n#endif\n\n#ifdef CONFIG_PROC_FS\n\n#ifdef MAX_DMA_CHANNELS\nstatic int proc_dma_show(struct seq_file *m, void *v)\n{\n\tint i;\n\n\tfor (i = 0 ; i < MAX_DMA_CHANNELS ; i++) {\n\t\tif (dma_chan_busy[i].lock) {\n\t\t seq_printf(m, \"%2d: %s\\n\", i,\n\t\t\t dma_chan_busy[i].device_id);\n\t\t}\n\t}\n\treturn 0;\n}\n#else\nstatic int proc_dma_show(struct seq_file *m, void *v)\n{\n\tseq_puts(m, \"No DMA\\n\");\n\treturn 0;\n}\n#endif /* MAX_DMA_CHANNELS */\n\nstatic int proc_dma_open(struct inode *inode, struct file *file)\n{\n\treturn single_open(file, proc_dma_show, NULL);\n}\n\nstatic const struct file_operations proc_dma_operations = {\n\t.open\t\t= proc_dma_open,\n\t.read\t\t= seq_read,\n\t.llseek\t\t= seq_lseek,\n\t.release\t= single_release,\n};\n\nstatic int __init proc_dma_init(void)\n{\n\tstruct proc_dir_entry *e;\n\n\te = create_proc_entry(\"dma\", 0, NULL);\n\tif (e)\n\t\te->proc_fops = &proc_dma_operations;\n\n\treturn 0;\n}\n\n__initcall(proc_dma_init);\n#endif\n\nEXPORT_SYMBOL(request_dma);\nEXPORT_SYMBOL(free_dma);\nEXPORT_SYMBOL(dma_spin_lock);\n/*\n * Handling of different ABIs (personalities).\n *\n * We group personalities into execution domains which have their\n * own handlers for kernel entry points, signal mapping, etc...\n *\n * 2001-05-06\tComplete rewrite, Christoph Hellwig (hch@infradead.org)\n */\n\n#include <linux/init.h>\n#include <linux/kernel.h>\n#include <linux/kmod.h>\n#include <linux/module.h>\n#include <linux/personality.h>\n#include <linux/sched.h>\n#include <linux/syscalls.h>\n#include <linux/sysctl.h>\n#include <linux/types.h>\n\n\nstatic void default_handler(int, struct pt_regs *);\n\nstatic struct exec_domain *exec_domains = &default_exec_domain;\nstatic DEFINE_RWLOCK(exec_domains_lock);\n\n\nstatic u_long ident_map[32] = {\n\t0,\t1,\t2,\t3,\t4,\t5,\t6,\t7,\n\t8,\t9,\t10,\t11,\t12,\t13,\t14,\t15,\n\t16,\t17,\t18,\t19,\t20,\t21,\t22,\t23,\n\t24,\t25,\t26,\t27,\t28,\t29,\t30,\t31\n};\n\nstruct exec_domain default_exec_domain = {\n\t.name\t\t= \"Linux\",\t\t/* name */\n\t.handler\t= default_handler,\t/* lcall7 causes a seg fault. */\n\t.pers_low\t= 0, \t\t\t/* PER_LINUX personality. */\n\t.pers_high\t= 0,\t\t\t/* PER_LINUX personality. */\n\t.signal_map\t= ident_map,\t\t/* Identity map signals. */\n\t.signal_invmap\t= ident_map,\t\t/* - both ways. */\n};\n\n\nstatic void\ndefault_handler(int segment, struct pt_regs *regp)\n{\n\tset_personality(0);\n\n\tif (current_thread_info()->exec_domain->handler != default_handler)\n\t\tcurrent_thread_info()->exec_domain->handler(segment, regp);\n\telse\n\t\tsend_sig(SIGSEGV, current, 1);\n}\n\nstatic struct exec_domain *\nlookup_exec_domain(u_long personality)\n{\n\tstruct exec_domain *\tep;\n\tu_long\t\t\tpers = personality(personality);\n\t\t\n\tread_lock(&exec_domains_lock);\n\tfor (ep = exec_domains; ep; ep = ep->next) {\n\t\tif (pers >= ep->pers_low && pers <= ep->pers_high)\n\t\t\tif (try_module_get(ep->module))\n\t\t\t\tgoto out;\n\t}\n\n#ifdef CONFIG_KMOD\n\tread_unlock(&exec_domains_lock);\n\trequest_module(\"personality-%ld\", pers);\n\tread_lock(&exec_domains_lock);\n\n\tfor (ep = exec_domains; ep; ep = ep->next) {\n\t\tif (pers >= ep->pers_low && pers <= ep->pers_high)\n\t\t\tif (try_module_get(ep->module))\n\t\t\t\tgoto out;\n\t}\n#endif\n\n\tep = &default_exec_domain;\nout:\n\tread_unlock(&exec_domains_lock);\n\treturn (ep);\n}\n\nint\nregister_exec_domain(struct exec_domain *ep)\n{\n\tstruct exec_domain\t*tmp;\n\tint\t\t\terr = -EBUSY;\n\n\tif (ep == NULL)\n\t\treturn -EINVAL;\n\n\tif (ep->next != NULL)\n\t\treturn -EBUSY;\n\n\twrite_lock(&exec_domains_lock);\n\tfor (tmp = exec_domains; tmp; tmp = tmp->next) {\n\t\tif (tmp == ep)\n\t\t\tgoto out;\n\t}\n\n\tep->next = exec_domains;\n\texec_domains = ep;\n\terr = 0;\n\nout:\n\twrite_unlock(&exec_domains_lock);\n\treturn (err);\n}\n\nint\nunregister_exec_domain(struct exec_domain *ep)\n{\n\tstruct exec_domain\t**epp;\n\n\tepp = &exec_domains;\n\twrite_lock(&exec_domains_lock);\n\tfor (epp = &exec_domains; *epp; epp = &(*epp)->next) {\n\t\tif (ep == *epp)\n\t\t\tgoto unregister;\n\t}\n\twrite_unlock(&exec_domains_lock);\n\treturn -EINVAL;\n\nunregister:\n\t*epp = ep->next;\n\tep->next = NULL;\n\twrite_unlock(&exec_domains_lock);\n\treturn 0;\n}\n\nint\n__set_personality(u_long personality)\n{\n\tstruct exec_domain\t*ep, *oep;\n\n\tep = lookup_exec_domain(personality);\n\tif (ep == current_thread_info()->exec_domain) {\n\t\tcurrent->personality = personality;\n\t\tmodule_put(ep->module);\n\t\treturn 0;\n\t}\n\n\tif (atomic_read(&current->fs->count) != 1) {\n\t\tstruct fs_struct *fsp, *ofsp;\n\n\t\tfsp = copy_fs_struct(current->fs);\n\t\tif (fsp == NULL) {\n\t\t\tmodule_put(ep->module);\n\t\t\treturn -ENOMEM;\n\t\t}\n\n\t\ttask_lock(current);\n\t\tofsp = current->fs;\n\t\tcurrent->fs = fsp;\n\t\ttask_unlock(current);\n\n\t\tput_fs_struct(ofsp);\n\t}\n\n\t/*\n\t * At that point we are guaranteed to be the sole owner of\n\t * current->fs.\n\t */\n\n\tcurrent->personality = personality;\n\toep = current_thread_info()->exec_domain;\n\tcurrent_thread_info()->exec_domain = ep;\n\tset_fs_altroot();\n\n\tmodule_put(oep->module);\n\treturn 0;\n}\n\nint\nget_exec_domain_list(char *page)\n{\n\tstruct exec_domain\t*ep;\n\tint\t\t\tlen = 0;\n\n\tread_lock(&exec_domains_lock);\n\tfor (ep = exec_domains; ep && len < PAGE_SIZE - 80; ep = ep->next)\n\t\tlen += sprintf(page + len, \"%d-%d\\t%-16s\\t[%s]\\n\",\n\t\t\t ep->pers_low, ep->pers_high, ep->name,\n\t\t\t module_name(ep->module));\n\tread_unlock(&exec_domains_lock);\n\treturn (len);\n}\n\nasmlinkage long\nsys_personality(u_long personality)\n{\n\tu_long old = current->personality;\n\n\tif (personality != 0xffffffff) {\n\t\tset_personality(personality);\n\t\tif (current->personality != personality)\n\t\t\treturn -EINVAL;\n\t}\n\n\treturn (long)old;\n}\n\n\nEXPORT_SYMBOL(register_exec_domain);\nEXPORT_SYMBOL(unregister_exec_domain);\nEXPORT_SYMBOL(__set_personality);\n/*\n * linux/kernel/exit.c\n *\n * Copyright (C) 1991, 1992 Linus Torvalds\n */\n\n#ifdef\tCONFIG_KDB\n#include <linux/kdb.h>\n#endif\n#include <linux/mm.h>\n#include <linux/slab.h>\n#include <linux/interrupt.h>\n#include <linux/module.h>\n#include <linux/capability.h>\n#include <linux/completion.h>\n#include <linux/personality.h>\n#include <linux/tty.h>\n#include <linux/mnt_namespace.h>\n#include <linux/key.h>\n#include <linux/security.h>\n#include <linux/cpu.h>\n#include <linux/acct.h>\n#include <linux/tsacct_kern.h>\n#include <linux/file.h>\n#include <linux/binfmts.h>\n#include <linux/nsproxy.h>\n#include <linux/pid_namespace.h>\n#include <linux/ptrace.h>\n#include <linux/profile.h>\n#include <linux/signalfd.h>\n#include <linux/mount.h>\n#include <linux/proc_fs.h>\n#include <linux/kthread.h>\n#include <linux/mempolicy.h>\n#include <linux/taskstats_kern.h>\n#include <linux/delayacct.h>\n#include <linux/cpuset.h>\n#include <linux/syscalls.h>\n#include <linux/signal.h>\n#include <linux/posix-timers.h>\n#include <linux/cn_proc.h>\n#include <linux/mutex.h>\n#include <linux/futex.h>\n#include <linux/compat.h>\n#include <linux/pipe_fs_i.h>\n#include <linux/audit.h> /* for audit_free() */\n#include <linux/resource.h>\n#include <linux/blkdev.h>\n#include <linux/task_io_accounting_ops.h>\n\n#include <asm/uaccess.h>\n#include <asm/unistd.h>\n#include <asm/pgtable.h>\n#include <asm/mmu_context.h>\n\nextern void sem_exit (void);\n\nstatic void exit_mm(struct task_struct * tsk);\n\nstatic void __unhash_process(struct task_struct *p)\n{\n\tnr_threads--;\n\tdetach_pid(p, PIDTYPE_PID);\n\tif (thread_group_leader(p)) {\n\t\tdetach_pid(p, PIDTYPE_PGID);\n\t\tdetach_pid(p, PIDTYPE_SID);\n\n\t\tlist_del_rcu(&p->tasks);\n\t\t__get_cpu_var(process_counts)--;\n\t}\n\tlist_del_rcu(&p->thread_group);\n\tremove_parent(p);\n}\n\n/*\n * This function expects the tasklist_lock write-locked.\n */\nstatic void __exit_signal(struct task_struct *tsk)\n{\n\tstruct signal_struct *sig = tsk->signal;\n\tstruct sighand_struct *sighand;\n\n\tBUG_ON(!sig);\n\tBUG_ON(!atomic_read(&sig->count));\n\n\trcu_read_lock();\n\tsighand = rcu_dereference(tsk->sighand);\n\tspin_lock(&sighand->siglock);\n\n\t/*\n\t * Notify that this sighand has been detached. This must\n\t * be called with the tsk->sighand lock held. Also, this\n\t * access tsk->sighand internally, so it must be called\n\t * before tsk->sighand is reset.\n\t */\n\tsignalfd_detach_locked(tsk);\n\n\tposix_cpu_timers_exit(tsk);\n\tif (atomic_dec_and_test(&sig->count))\n\t\tposix_cpu_timers_exit_group(tsk);\n\telse {\n\t\t/*\n\t\t * If there is any task waiting for the group exit\n\t\t * then notify it:\n\t\t */\n\t\tif (sig->group_exit_task && atomic_read(&sig->count) == sig->notify_count) {\n\t\t\twake_up_process(sig->group_exit_task);\n\t\t\tsig->group_exit_task = NULL;\n\t\t}\n\t\tif (tsk == sig->curr_target)\n\t\t\tsig->curr_target = next_thread(tsk);\n\t\t/*\n\t\t * Accumulate here the counters for all threads but the\n\t\t * group leader as they die, so they can be added into\n\t\t * the process-wide totals when those are taken.\n\t\t * The group leader stays around as a zombie as long\n\t\t * as there are other threads. When it gets reaped,\n\t\t * the exit.c code will add its counts into these totals.\n\t\t * We won't ever get here for the group leader, since it\n\t\t * will have been the last reference on the signal_struct.\n\t\t */\n\t\tsig->utime = cputime_add(sig->utime, tsk->utime);\n\t\tsig->stime = cputime_add(sig->stime, tsk->stime);\n\t\tsig->min_flt += tsk->min_flt;\n\t\tsig->maj_flt += tsk->maj_flt;\n\t\tsig->nvcsw += tsk->nvcsw;\n\t\tsig->nivcsw += tsk->nivcsw;\n\t\tsig->sched_time += tsk->sched_time;\n\t\tsig->inblock += task_io_get_inblock(tsk);\n\t\tsig->oublock += task_io_get_oublock(tsk);\n\t\tsig = NULL; /* Marker for below. */\n\t}\n\n\t__unhash_process(tsk);\n\n\ttsk->signal = NULL;\n\ttsk->sighand = NULL;\n\tspin_unlock(&sighand->siglock);\n\trcu_read_unlock();\n\n\t__cleanup_sighand(sighand);\n\tclear_tsk_thread_flag(tsk,TIF_SIGPENDING);\n\tflush_sigqueue(&tsk->pending);\n\tif (sig) {\n\t\tflush_sigqueue(&sig->shared_pending);\n\t\ttaskstats_tgid_free(sig);\n\t\t__cleanup_signal(sig);\n\t}\n}\n\nstatic void delayed_put_task_struct(struct rcu_head *rhp)\n{\n\tput_task_struct(container_of(rhp, struct task_struct, rcu));\n}\n\nvoid release_task(struct task_struct * p)\n{\n\tstruct task_struct *leader;\n\tint zap_leader;\nrepeat:\n\tatomic_dec(&p->user->processes);\n\twrite_lock_irq(&tasklist_lock);\n\tptrace_unlink(p);\n\tBUG_ON(!list_empty(&p->ptrace_list) || !list_empty(&p->ptrace_children));\n\t__exit_signal(p);\n\n\t/*\n\t * If we are the last non-leader member of the thread\n\t * group, and the leader is zombie, then notify the\n\t * group leader's parent process. (if it wants notification.)\n\t */\n\tzap_leader = 0;\n\tleader = p->group_leader;\n\tif (leader != p && thread_group_empty(leader) && leader->exit_state == EXIT_ZOMBIE) {\n\t\tBUG_ON(leader->exit_signal == -1);\n\t\tdo_notify_parent(leader, leader->exit_signal);\n\t\t/*\n\t\t * If we were the last child thread and the leader has\n\t\t * exited already, and the leader's parent ignores SIGCHLD,\n\t\t * then we are the one who should release the leader.\n\t\t *\n\t\t * do_notify_parent() will have marked it self-reaping in\n\t\t * that case.\n\t\t */\n\t\tzap_leader = (leader->exit_signal == -1);\n\t}\n\n\tsched_exit(p);\n\twrite_unlock_irq(&tasklist_lock);\n\tproc_flush_task(p);\n\trelease_thread(p);\n\tcall_rcu(&p->rcu, delayed_put_task_struct);\n\n\tp = leader;\n\tif (unlikely(zap_leader))\n\t\tgoto repeat;\n}\n\n/*\n * This checks not only the pgrp, but falls back on the pid if no\n * satisfactory pgrp is found. I dunno - gdb doesn't work correctly\n * without this...\n *\n * The caller must hold rcu lock or the tasklist lock.\n */\nstruct pid *session_of_pgrp(struct pid *pgrp)\n{\n\tstruct task_struct *p;\n\tstruct pid *sid = NULL;\n\n\tp = pid_task(pgrp, PIDTYPE_PGID);\n\tif (p == NULL)\n\t\tp = pid_task(pgrp, PIDTYPE_PID);\n\tif (p != NULL)\n\t\tsid = task_session(p);\n\n\treturn sid;\n}\n\n/*\n * Determine if a process group is \"orphaned\", according to the POSIX\n * definition in 2.2.2.52. Orphaned process groups are not to be affected\n * by terminal-generated stop signals. Newly orphaned process groups are\n * to receive a SIGHUP and a SIGCONT.\n *\n * \"I ask you, have you ever known what it is to be an orphan?\"\n */\nstatic int will_become_orphaned_pgrp(struct pid *pgrp, struct task_struct *ignored_task)\n{\n\tstruct task_struct *p;\n\tint ret = 1;\n\n\tdo_each_pid_task(pgrp, PIDTYPE_PGID, p) {\n\t\tif (p == ignored_task\n\t\t\t\t|| p->exit_state\n\t\t\t\t|| is_init(p->real_parent))\n\t\t\tcontinue;\n\t\tif (task_pgrp(p->real_parent) != pgrp &&\n\t\t task_session(p->real_parent) == task_session(p)) {\n\t\t\tret = 0;\n\t\t\tbreak;\n\t\t}\n\t} while_each_pid_task(pgrp, PIDTYPE_PGID, p);\n\treturn ret;\t/* (sighing) \"Often!\" */\n}\n\nint is_current_pgrp_orphaned(void)\n{\n\tint retval;\n\n\tread_lock(&tasklist_lock);\n\tretval = will_become_orphaned_pgrp(task_pgrp(current), NULL);\n\tread_unlock(&tasklist_lock);\n\n\treturn retval;\n}\n\nstatic int has_stopped_jobs(struct pid *pgrp)\n{\n\tint retval = 0;\n\tstruct task_struct *p;\n\n\tdo_each_pid_task(pgrp, PIDTYPE_PGID, p) {\n\t\tif (p->state != TASK_STOPPED)\n\t\t\tcontinue;\n\t\tretval = 1;\n\t\tbreak;\n\t} while_each_pid_task(pgrp, PIDTYPE_PGID, p);\n\treturn retval;\n}\n\n/**\n * reparent_to_kthreadd - Reparent the calling kernel thread to kthreadd\n *\n * If a kernel thread is launched as a result of a system call, or if\n * it ever exits, it should generally reparent itself to kthreadd so it\n * isn't in the way of other processes and is correctly cleaned up on exit.\n *\n * The various task state such as scheduling policy and priority may have\n * been inherited from a user process, so we reset them to sane values here.\n *\n * NOTE that reparent_to_kthreadd() gives the caller full capabilities.\n */\nstatic void reparent_to_kthreadd(void)\n{\n\twrite_lock_irq(&tasklist_lock);\n\n\tptrace_unlink(current);\n\t/* Reparent to init */\n\tremove_parent(current);\n\tcurrent->real_parent = current->parent = kthreadd_task;\n\tadd_parent(current);\n\n\t/* Set the exit signal to SIGCHLD so we signal init on exit */\n\tcurrent->exit_signal = SIGCHLD;\n\n\tif (!has_rt_policy(current) && (task_nice(current) < 0))\n\t\tset_user_nice(current, 0);\n\t/* cpus_allowed? */\n\t/* rt_priority? */\n\t/* signals? */\n\tsecurity_task_reparent_to_init(current);\n\tmemcpy(current->signal->rlim, init_task.signal->rlim,\n\t sizeof(current->signal->rlim));\n\tatomic_inc(&(INIT_USER->__count));\n\twrite_unlock_irq(&tasklist_lock);\n\tswitch_uid(INIT_USER);\n}\n\nvoid __set_special_pids(pid_t session, pid_t pgrp)\n{\n\tstruct task_struct *curr = current->group_leader;\n\n\tif (process_session(curr) != session) {\n\t\tdetach_pid(curr, PIDTYPE_SID);\n\t\tset_signal_session(curr->signal, session);\n\t\tattach_pid(curr, PIDTYPE_SID, find_pid(session));\n\t}\n\tif (process_group(curr) != pgrp) {\n\t\tdetach_pid(curr, PIDTYPE_PGID);\n\t\tcurr->signal->pgrp = pgrp;\n\t\tattach_pid(curr, PIDTYPE_PGID, find_pid(pgrp));\n\t}\n}\n\nstatic void set_special_pids(pid_t session, pid_t pgrp)\n{\n\twrite_lock_irq(&tasklist_lock);\n\t__set_special_pids(session, pgrp);\n\twrite_unlock_irq(&tasklist_lock);\n}\n\n/*\n * Let kernel threads use this to say that they\n * allow a certain signal (since daemonize() will\n * have disabled all of them by default).\n */\nint allow_signal(int sig)\n{\n\tif (!valid_signal(sig) || sig < 1)\n\t\treturn -EINVAL;\n\n\tspin_lock_irq(&current->sighand->siglock);\n\tsigdelset(&current->blocked, sig);\n\tif (!current->mm) {\n\t\t/* Kernel threads handle their own signals.\n\t\t Let the signal code know it'll be handled, so\n\t\t that they don't get converted to SIGKILL or\n\t\t just silently dropped */\n\t\tcurrent->sighand->action[(sig)-1].sa.sa_handler = (void __user *)2;\n\t}\n\trecalc_sigpending();\n\tspin_unlock_irq(&current->sighand->siglock);\n\treturn 0;\n}\n\nEXPORT_SYMBOL(allow_signal);\n\nint disallow_signal(int sig)\n{\n\tif (!valid_signal(sig) || sig < 1)\n\t\treturn -EINVAL;\n\n\tspin_lock_irq(&current->sighand->siglock);\n\tcurrent->sighand->action[(sig)-1].sa.sa_handler = SIG_IGN;\n\trecalc_sigpending();\n\tspin_unlock_irq(&current->sighand->siglock);\n\treturn 0;\n}\n\nEXPORT_SYMBOL(disallow_signal);\n\n/*\n *\tPut all the gunge required to become a kernel thread without\n *\tattached user resources in one place where it belongs.\n */\n\nvoid daemonize(const char *name, ...)\n{\n\tva_list args;\n\tstruct fs_struct *fs;\n\tsigset_t blocked;\n\n\tva_start(args, name);\n\tvsnprintf(current->comm, sizeof(current->comm), name, args);\n\tva_end(args);\n\n\t/*\n\t * If we were started as result of loading a module, close all of the\n\t * user space pages. We don't need them, and if we didn't close them\n\t * they would be locked into memory.\n\t */\n\texit_mm(current);\n\n\tset_special_pids(1, 1);\n\tproc_clear_tty(current);\n\n\t/* Block and flush all signals */\n\tsigfillset(&blocked);\n\tsigprocmask(SIG_BLOCK, &blocked, NULL);\n\tflush_signals(current);\n\n\t/* Become as one with the init task */\n\n\texit_fs(current);\t/* current->fs->count--; */\n\tfs = init_task.fs;\n\tcurrent->fs = fs;\n\tatomic_inc(&fs->count);\n\n\texit_task_namespaces(current);\n\tcurrent->nsproxy = init_task.nsproxy;\n\tget_task_namespaces(current);\n\n \texit_files(current);\n\tcurrent->files = init_task.files;\n\tatomic_inc(&current->files->count);\n\n\treparent_to_kthreadd();\n}\n\nEXPORT_SYMBOL(daemonize);\n\nstatic void close_files(struct files_struct * files)\n{\n\tint i, j;\n\tstruct fdtable *fdt;\n\n\tj = 0;\n\n\t/*\n\t * It is safe to dereference the fd table without RCU or\n\t * ->file_lock because this is the last reference to the\n\t * files structure.\n\t */\n\tfdt = files_fdtable(files);\n\tfor (;;) {\n\t\tunsigned long set;\n\t\ti = j * __NFDBITS;\n\t\tif (i >= fdt->max_fds)\n\t\t\tbreak;\n\t\tset = fdt->open_fds->fds_bits[j++];\n\t\twhile (set) {\n\t\t\tif (set & 1) {\n\t\t\t\tstruct file * file = xchg(&fdt->fd[i], NULL);\n\t\t\t\tif (file) {\n\t\t\t\t\tfilp_close(file, files);\n\t\t\t\t\tcond_resched();\n\t\t\t\t}\n\t\t\t}\n\t\t\ti++;\n\t\t\tset >>= 1;\n\t\t}\n\t}\n}\n\nstruct files_struct *get_files_struct(struct task_struct *task)\n{\n\tstruct files_struct *files;\n\n\ttask_lock(task);\n\tfiles = task->files;\n\tif (files)\n\t\tatomic_inc(&files->count);\n\ttask_unlock(task);\n\n\treturn files;\n}\n\nvoid fastcall put_files_struct(struct files_struct *files)\n{\n\tstruct fdtable *fdt;\n\n\tif (atomic_dec_and_test(&files->count)) {\n\t\tclose_files(files);\n\t\t/*\n\t\t * Free the fd and fdset arrays if we expanded them.\n\t\t * If the fdtable was embedded, pass files for freeing\n\t\t * at the end of the RCU grace period. Otherwise,\n\t\t * you can free files immediately.\n\t\t */\n\t\tfdt = files_fdtable(files);\n\t\tif (fdt != &files->fdtab)\n\t\t\tkmem_cache_free(files_cachep, files);\n\t\tfree_fdtable(fdt);\n\t}\n}\n\nEXPORT_SYMBOL(put_files_struct);\n\nvoid reset_files_struct(struct task_struct *tsk, struct files_struct *files)\n{\n\tstruct files_struct *old;\n\n\told = tsk->files;\n\ttask_lock(tsk);\n\ttsk->files = files;\n\ttask_unlock(tsk);\n\tput_files_struct(old);\n}\nEXPORT_SYMBOL(reset_files_struct);\n\nstatic inline void __exit_files(struct task_struct *tsk)\n{\n\tstruct files_struct * files = tsk->files;\n\n\tif (files) {\n\t\ttask_lock(tsk);\n\t\ttsk->files = NULL;\n\t\ttask_unlock(tsk);\n\t\tput_files_struct(files);\n\t}\n}\n\nvoid exit_files(struct task_struct *tsk)\n{\n\t__exit_files(tsk);\n}\n\nstatic inline void __put_fs_struct(struct fs_struct *fs)\n{\n\t/* No need to hold fs->lock if we are killing it */\n\tif (atomic_dec_and_test(&fs->count)) {\n\t\tdput(fs->root);\n\t\tmntput(fs->rootmnt);\n\t\tdput(fs->pwd);\n\t\tmntput(fs->pwdmnt);\n\t\tif (fs->altroot) {\n\t\t\tdput(fs->altroot);\n\t\t\tmntput(fs->altrootmnt);\n\t\t}\n\t\tkmem_cache_free(fs_cachep, fs);\n\t}\n}\n\nvoid put_fs_struct(struct fs_struct *fs)\n{\n\t__put_fs_struct(fs);\n}\n\nstatic inline void __exit_fs(struct task_struct *tsk)\n{\n\tstruct fs_struct * fs = tsk->fs;\n\n\tif (fs) {\n\t\ttask_lock(tsk);\n\t\ttsk->fs = NULL;\n\t\ttask_unlock(tsk);\n\t\t__put_fs_struct(fs);\n\t}\n}\n\nvoid exit_fs(struct task_struct *tsk)\n{\n\t__exit_fs(tsk);\n}\n\nEXPORT_SYMBOL_GPL(exit_fs);\n\n/*\n * Turn us into a lazy TLB process if we\n * aren't already..\n */\nstatic void exit_mm(struct task_struct * tsk)\n{\n\tstruct mm_struct *mm = tsk->mm;\n\n\tmm_release(tsk, mm);\n\tif (!mm)\n\t\treturn;\n\t/*\n\t * Serialize with any possible pending coredump.\n\t * We must hold mmap_sem around checking core_waiters\n\t * and clearing tsk->mm. The core-inducing thread\n\t * will increment core_waiters for each thread in the\n\t * group with ->mm != NULL.\n\t */\n\tdown_read(&mm->mmap_sem);\n\tif (mm->core_waiters) {\n\t\tup_read(&mm->mmap_sem);\n\t\tdown_write(&mm->mmap_sem);\n\t\tif (!--mm->core_waiters)\n\t\t\tcomplete(mm->core_startup_done);\n\t\tup_write(&mm->mmap_sem);\n\n\t\twait_for_completion(&mm->core_done);\n\t\tdown_read(&mm->mmap_sem);\n\t}\n\tatomic_inc(&mm->mm_count);\n\tBUG_ON(mm != tsk->active_mm);\n\t/* more a memory barrier than a real lock */\n\ttask_lock(tsk);\n\ttsk->mm = NULL;\n\tup_read(&mm->mmap_sem);\n\tenter_lazy_tlb(mm, current);\n\ttask_unlock(tsk);\n\tmmput(mm);\n}\n\nstatic inline void\nchoose_new_parent(struct task_struct *p, struct task_struct *reaper)\n{\n\t/*\n\t * Make sure we're not reparenting to ourselves and that\n\t * the parent is not a zombie.\n\t */\n\tBUG_ON(p == reaper || reaper->exit_state);\n\tp->real_parent = reaper;\n}\n\nstatic void\nreparent_thread(struct task_struct *p, struct task_struct *father, int traced)\n{\n\tif (p->pdeath_signal)\n\t\t/* We already hold the tasklist_lock here. */\n\t\tgroup_send_sig_info(p->pdeath_signal, SEND_SIG_NOINFO, p);\n\n\t/* Move the child from its dying parent to the new one. */\n\tif (unlikely(traced)) {\n\t\t/* Preserve ptrace links if someone else is tracing this child. */\n\t\tlist_del_init(&p->ptrace_list);\n\t\tif (p->parent != p->real_parent)\n\t\t\tlist_add(&p->ptrace_list, &p->real_parent->ptrace_children);\n\t} else {\n\t\t/* If this child is being traced, then we're the one tracing it\n\t\t * anyway, so let go of it.\n\t\t */\n\t\tp->ptrace = 0;\n\t\tremove_parent(p);\n\t\tp->parent = p->real_parent;\n\t\tadd_parent(p);\n\n\t\tif (p->state == TASK_TRACED) {\n\t\t\t/*\n\t\t\t * If it was at a trace stop, turn it into\n\t\t\t * a normal stop since it's no longer being\n\t\t\t * traced.\n\t\t\t */\n\t\t\tptrace_untrace(p);\n\t\t}\n\t}\n\n\t/* If this is a threaded reparent there is no need to\n\t * notify anyone anything has happened.\n\t */\n\tif (p->real_parent->group_leader == father->group_leader)\n\t\treturn;\n\n\t/* We don't want people slaying init. */\n\tif (p->exit_signal != -1)\n\t\tp->exit_signal = SIGCHLD;\n\n\t/* If we'd notified the old parent about this child's death,\n\t * also notify the new parent.\n\t */\n\tif (!traced && p->exit_state == EXIT_ZOMBIE &&\n\t p->exit_signal != -1 && thread_group_empty(p))\n\t\tdo_notify_parent(p, p->exit_signal);\n\n\t/*\n\t * process group orphan check\n\t * Case ii: Our child is in a different pgrp\n\t * than we are, and it was the only connection\n\t * outside, so the child pgrp is now orphaned.\n\t */\n\tif ((task_pgrp(p) != task_pgrp(father)) &&\n\t (task_session(p) == task_session(father))) {\n\t\tstruct pid *pgrp = task_pgrp(p);\n\n\t\tif (will_become_orphaned_pgrp(pgrp, NULL) &&\n\t\t has_stopped_jobs(pgrp)) {\n\t\t\t__kill_pgrp_info(SIGHUP, SEND_SIG_PRIV, pgrp);\n\t\t\t__kill_pgrp_info(SIGCONT, SEND_SIG_PRIV, pgrp);\n\t\t}\n\t}\n}\n\n/*\n * When we die, we re-parent all our children.\n * Try to give them to another thread in our thread\n * group, and if no such member exists, give it to\n * the child reaper process (ie \"init\") in our pid\n * space.\n */\nstatic void\nforget_original_parent(struct task_struct *father, struct list_head *to_release)\n{\n\tstruct task_struct *p, *reaper = father;\n\tstruct list_head *_p, *_n;\n\n\tdo {\n\t\treaper = next_thread(reaper);\n\t\tif (reaper == father) {\n\t\t\treaper = child_reaper(father);\n\t\t\tbreak;\n\t\t}\n\t} while (reaper->exit_state);\n\n\t/*\n\t * There are only two places where our children can be:\n\t *\n\t * - in our child list\n\t * - in our ptraced child list\n\t *\n\t * Search them and reparent children.\n\t */\n\tlist_for_each_safe(_p, _n, &father->children) {\n\t\tint ptrace;\n\t\tp = list_entry(_p, struct task_struct, sibling);\n\n\t\tptrace = p->ptrace;\n\n\t\t/* if father isn't the real parent, then ptrace must be enabled */\n\t\tBUG_ON(father != p->real_parent && !ptrace);\n\n\t\tif (father == p->real_parent) {\n\t\t\t/* reparent with a reaper, real father it's us */\n\t\t\tchoose_new_parent(p, reaper);\n\t\t\treparent_thread(p, father, 0);\n\t\t} else {\n\t\t\t/* reparent ptraced task to its real parent */\n\t\t\t__ptrace_unlink (p);\n\t\t\tif (p->exit_state == EXIT_ZOMBIE && p->exit_signal != -1 &&\n\t\t\t thread_group_empty(p))\n\t\t\t\tdo_notify_parent(p, p->exit_signal);\n\t\t}\n\n\t\t/*\n\t\t * if the ptraced child is a zombie with exit_signal == -1\n\t\t * we must collect it before we exit, or it will remain\n\t\t * zombie forever since we prevented it from self-reap itself\n\t\t * while it was being traced by us, to be able to see it in wait4.\n\t\t */\n\t\tif (unlikely(ptrace && p->exit_state == EXIT_ZOMBIE && p->exit_signal == -1))\n\t\t\tlist_add(&p->ptrace_list, to_release);\n\t}\n\tlist_for_each_safe(_p, _n, &father->ptrace_children) {\n\t\tp = list_entry(_p, struct task_struct, ptrace_list);\n\t\tchoose_new_parent(p, reaper);\n\t\treparent_thread(p, father, 1);\n\t}\n}\n\n/*\n * Send signals to all our closest relatives so that they know\n * to properly mourn us..\n */\nstatic void exit_notify(struct task_struct *tsk)\n{\n\tint state;\n\tstruct task_struct *t;\n\tstruct list_head ptrace_dead, *_p, *_n;\n\tstruct pid *pgrp;\n\n\tif (signal_pending(tsk) && !(tsk->signal->flags & SIGNAL_GROUP_EXIT)\n\t && !thread_group_empty(tsk)) {\n\t\t/*\n\t\t * This occurs when there was a race between our exit\n\t\t * syscall and a group signal choosing us as the one to\n\t\t * wake up. It could be that we are the only thread\n\t\t * alerted to check for pending signals, but another thread\n\t\t * should be woken now to take the signal since we will not.\n\t\t * Now we'll wake all the threads in the group just to make\n\t\t * sure someone gets all the pending signals.\n\t\t */\n\t\tread_lock(&tasklist_lock);\n\t\tspin_lock_irq(&tsk->sighand->siglock);\n\t\tfor (t = next_thread(tsk); t != tsk; t = next_thread(t))\n\t\t\tif (!signal_pending(t) && !(t->flags & PF_EXITING))\n\t\t\t\trecalc_sigpending_and_wake(t);\n\t\tspin_unlock_irq(&tsk->sighand->siglock);\n\t\tread_unlock(&tasklist_lock);\n\t}\n\n\twrite_lock_irq(&tasklist_lock);\n\n\t/*\n\t * This does two things:\n\t *\n \t * A. Make init inherit all the child processes\n\t * B. Check to see if any process groups have become orphaned\n\t *\tas a result of our exiting, and if they have any stopped\n\t *\tjobs, send them a SIGHUP and then a SIGCONT. (POSIX 3.2.2.2)\n\t */\n\n\tINIT_LIST_HEAD(&ptrace_dead);\n\tforget_original_parent(tsk, &ptrace_dead);\n\tBUG_ON(!list_empty(&tsk->children));\n\tBUG_ON(!list_empty(&tsk->ptrace_children));\n\n\t/*\n\t * Check to see if any process groups have become orphaned\n\t * as a result of our exiting, and if they have any stopped\n\t * jobs, send them a SIGHUP and then a SIGCONT. (POSIX 3.2.2.2)\n\t *\n\t * Case i: Our father is in a different pgrp than we are\n\t * and we were the only connection outside, so our pgrp\n\t * is about to become orphaned.\n\t */\n\t \n\tt = tsk->real_parent;\n\t\n\tpgrp = task_pgrp(tsk);\n\tif ((task_pgrp(t) != pgrp) &&\n\t (task_session(t) == task_session(tsk)) &&\n\t will_become_orphaned_pgrp(pgrp, tsk) &&\n\t has_stopped_jobs(pgrp)) {\n\t\t__kill_pgrp_info(SIGHUP, SEND_SIG_PRIV, pgrp);\n\t\t__kill_pgrp_info(SIGCONT, SEND_SIG_PRIV, pgrp);\n\t}\n\n\t/* Let father know we died \n\t *\n\t * Thread signals are configurable, but you aren't going to use\n\t * that to send signals to arbitary processes. \n\t * That stops right now.\n\t *\n\t * If the parent exec id doesn't match the exec id we saved\n\t * when we started then we know the parent has changed security\n\t * domain.\n\t *\n\t * If our self_exec id doesn't match our parent_exec_id then\n\t * we have changed execution domain as these two values started\n\t * the same after a fork.\n\t *\t\n\t */\n\t\n\tif (tsk->exit_signal != SIGCHLD && tsk->exit_signal != -1 &&\n\t ( tsk->parent_exec_id != t->self_exec_id ||\n\t tsk->self_exec_id != tsk->parent_exec_id)\n\t && !capable(CAP_KILL))\n\t\ttsk->exit_signal = SIGCHLD;\n\n\n\t/* If something other than our normal parent is ptracing us, then\n\t * send it a SIGCHLD instead of honoring exit_signal. exit_signal\n\t * only has special meaning to our real parent.\n\t */\n\tif (tsk->exit_signal != -1 && thread_group_empty(tsk)) {\n\t\tint signal = tsk->parent == tsk->real_parent ? tsk->exit_signal : SIGCHLD;\n\t\tdo_notify_parent(tsk, signal);\n\t} else if (tsk->ptrace) {\n\t\tdo_notify_parent(tsk, SIGCHLD);\n\t}\n\n\tstate = EXIT_ZOMBIE;\n\tif (tsk->exit_signal == -1 &&\n\t (likely(tsk->ptrace == 0) ||\n\t unlikely(tsk->parent->signal->flags & SIGNAL_GROUP_EXIT)))\n\t\tstate = EXIT_DEAD;\n\ttsk->exit_state = state;\n\n\twrite_unlock_irq(&tasklist_lock);\n\n\tlist_for_each_safe(_p, _n, &ptrace_dead) {\n\t\tlist_del_init(_p);\n\t\tt = list_entry(_p, struct task_struct, ptrace_list);\n\t\trelease_task(t);\n\t}\n\n\t/* If the process is dead, release it - nobody will wait for it */\n\tif (state == EXIT_DEAD)\n\t\trelease_task(tsk);\n}\n\nfastcall NORET_TYPE void do_exit(long code)\n{\n\tstruct task_struct *tsk = current;\n\tint group_dead;\n\n\tprofile_task_exit(tsk);\n\n\tWARN_ON(atomic_read(&tsk->fs_excl));\n\n\tif (unlikely(in_interrupt()))\n\t\tpanic(\"Aiee, killing interrupt handler!\");\n\tif (unlikely(!tsk->pid))\n\t\tpanic(\"Attempted to kill the idle task!\");\n\tif (unlikely(tsk == child_reaper(tsk))) {\n\t\tif (tsk->nsproxy->pid_ns != &init_pid_ns)\n\t\t\ttsk->nsproxy->pid_ns->child_reaper = init_pid_ns.child_reaper;\n\t\telse\n\t\t\tpanic(\"Attempted to kill init!\");\n\t}\n\n\n\tif (unlikely(current->ptrace & PT_TRACE_EXIT)) {\n\t\tcurrent->ptrace_message = code;\n\t\tptrace_notify((PTRACE_EVENT_EXIT << 8) | SIGTRAP);\n\t}\n\n\t/*\n\t * We're taking recursive faults here in do_exit. Safest is to just\n\t * leave this task alone and wait for reboot.\n\t */\n\tif (unlikely(tsk->flags & PF_EXITING)) {\n\t\tprintk(KERN_ALERT\n\t\t\t\"Fixing recursive fault but reboot is needed!\\n\");\n\t\t/*\n\t\t * We can do this unlocked here. The futex code uses\n\t\t * this flag just to verify whether the pi state\n\t\t * cleanup has been done or not. In the worst case it\n\t\t * loops once more. We pretend that the cleanup was\n\t\t * done as there is no way to return. Either the\n\t\t * OWNER_DIED bit is set by now or we push the blocked\n\t\t * task into the wait for ever nirwana as well.\n\t\t */\n\t\ttsk->flags |= PF_EXITPIDONE;\n\t\tif (tsk->io_context)\n\t\t\texit_io_context();\n\t\tset_current_state(TASK_UNINTERRUPTIBLE);\n\t\tschedule();\n\t}\n\n\t/*\n\t * tsk->flags are checked in the futex code to protect against\n\t * an exiting task cleaning up the robust pi futexes.\n\t */\n\tspin_lock_irq(&tsk->pi_lock);\n\ttsk->flags |= PF_EXITING;\n\tspin_unlock_irq(&tsk->pi_lock);\n\n\tif (unlikely(in_atomic()))\n\t\tprintk(KERN_INFO \"note: %s[%d] exited with preempt_count %d\\n\",\n\t\t\t\tcurrent->comm, current->pid,\n\t\t\t\tpreempt_count());\n\n\tacct_update_integrals(tsk);\n\tif (tsk->mm) {\n\t\tupdate_hiwater_rss(tsk->mm);\n\t\tupdate_hiwater_vm(tsk->mm);\n\t}\n\tgroup_dead = atomic_dec_and_test(&tsk->signal->live);\n\tif (group_dead) {\n\t\thrtimer_cancel(&tsk->signal->real_timer);\n\t\texit_itimers(tsk->signal);\n\t}\n\tacct_collect(code, group_dead);\n\tif (unlikely(tsk->robust_list))\n\t\texit_robust_list(tsk);\n#if defined(CONFIG_FUTEX) && defined(CONFIG_COMPAT)\n\tif (unlikely(tsk->compat_robust_list))\n\t\tcompat_exit_robust_list(tsk);\n#endif\n\tif (unlikely(tsk->audit_context))\n\t\taudit_free(tsk);\n\n\ttaskstats_exit(tsk, group_dead);\n\n\texit_mm(tsk);\n\n\tif (group_dead)\n\t\tacct_process();\n\texit_sem(tsk);\n\t__exit_files(tsk);\n\t__exit_fs(tsk);\n\texit_thread();\n\tcpuset_exit(tsk);\n\texit_keys(tsk);\n\n\tif (group_dead && tsk->signal->leader)\n\t\tdisassociate_ctty(1);\n\n\tmodule_put(task_thread_info(tsk)->exec_domain->module);\n\tif (tsk->binfmt)\n\t\tmodule_put(tsk->binfmt->module);\n\n\ttsk->exit_code = code;\n\tproc_exit_connector(tsk);\n\texit_task_namespaces(tsk);\n\texit_notify(tsk);\n#ifdef CONFIG_NUMA\n\tmpol_free(tsk->mempolicy);\n\ttsk->mempolicy = NULL;\n#endif\n\t/*\n\t * This must happen late, after the PID is not\n\t * hashed anymore:\n\t */\n\tif (unlikely(!list_empty(&tsk->pi_state_list)))\n\t\texit_pi_state_list(tsk);\n\tif (unlikely(current->pi_state_cache))\n\t\tkfree(current->pi_state_cache);\n\t/*\n\t * Make sure we are holding no locks:\n\t */\n\tdebug_check_no_locks_held(tsk);\n\t/*\n\t * We can do this unlocked here. The futex code uses this flag\n\t * just to verify whether the pi state cleanup has been done\n\t * or not. In the worst case it loops once more.\n\t */\n\ttsk->flags |= PF_EXITPIDONE;\n\n\tif (tsk->io_context)\n\t\texit_io_context();\n\n\tif (tsk->splice_pipe)\n\t\t__free_pipe_info(tsk->splice_pipe);\n\n\tpreempt_disable();\n\t/* causes final put_task_struct in finish_task_switch(). */\n\ttsk->state = TASK_DEAD;\n\n\tschedule();\n\tBUG();\n\t/* Avoid \"noreturn function does return\". */\n\tfor (;;)\n\t\tcpu_relax();\t/* For when BUG is null */\n}\n\nEXPORT_SYMBOL_GPL(do_exit);\n\nNORET_TYPE void complete_and_exit(struct completion *comp, long code)\n{\n\tif (comp)\n\t\tcomplete(comp);\n\n\tdo_exit(code);\n}\n\nEXPORT_SYMBOL(complete_and_exit);\n\nasmlinkage long sys_exit(int error_code)\n{\n\tdo_exit((error_code&0xff)<<8);\n}\n\n/*\n * Take down every thread in the group. This is called by fatal signals\n * as well as by sys_exit_group (below).\n */\nNORET_TYPE void\ndo_group_exit(int exit_code)\n{\n\tBUG_ON(exit_code & 0x80); /* core dumps don't get here */\n\n\tif (current->signal->flags & SIGNAL_GROUP_EXIT)\n\t\texit_code = current->signal->group_exit_code;\n\telse if (!thread_group_empty(current)) {\n\t\tstruct signal_struct *const sig = current->signal;\n\t\tstruct sighand_struct *const sighand = current->sighand;\n\t\tspin_lock_irq(&sighand->siglock);\n\t\tif (sig->flags & SIGNAL_GROUP_EXIT)\n\t\t\t/* Another thread got here before we took the lock. */\n\t\t\texit_code = sig->group_exit_code;\n\t\telse {\n\t\t\tsig->group_exit_code = exit_code;\n\t\t\tzap_other_threads(current);\n\t\t}\n\t\tspin_unlock_irq(&sighand->siglock);\n\t}\n\n\tdo_exit(exit_code);\n\t/* NOTREACHED */\n}\n\n/*\n * this kills every thread in the thread group. Note that any externally\n * wait4()-ing process will get the correct exit code - even if this\n * thread is not the thread group leader.\n */\nasmlinkage void sys_exit_group(int error_code)\n{\n\tdo_group_exit((error_code & 0xff) << 8);\n}\n\nstatic int eligible_child(pid_t pid, int options, struct task_struct *p)\n{\n\tint err;\n\n\tif (pid > 0) {\n\t\tif (p->pid != pid)\n\t\t\treturn 0;\n\t} else if (!pid) {\n\t\tif (process_group(p) != process_group(current))\n\t\t\treturn 0;\n\t} else if (pid != -1) {\n\t\tif (process_group(p) != -pid)\n\t\t\treturn 0;\n\t}\n\n\t/*\n\t * Do not consider detached threads that are\n\t * not ptraced:\n\t */\n\tif (p->exit_signal == -1 && !p->ptrace)\n\t\treturn 0;\n\n\t/* Wait for all children (clone and not) if __WALL is set;\n\t * otherwise, wait for clone children *only* if __WCLONE is\n\t * set; otherwise, wait for non-clone children *only*. (Note:\n\t * A \"clone\" child here is one that reports to its parent\n\t * using a signal other than SIGCHLD.) */\n\tif (((p->exit_signal != SIGCHLD) ^ ((options & __WCLONE) != 0))\n\t && !(options & __WALL))\n\t\treturn 0;\n\t/*\n\t * Do not consider thread group leaders that are\n\t * in a non-empty thread group:\n\t */\n\tif (delay_group_leader(p))\n\t\treturn 2;\n\n\terr = security_task_wait(p);\n\tif (err)\n\t\treturn err;\n\n\treturn 1;\n}\n\nstatic int wait_noreap_copyout(struct task_struct *p, pid_t pid, uid_t uid,\n\t\t\t int why, int status,\n\t\t\t struct siginfo __user *infop,\n\t\t\t struct rusage __user *rusagep)\n{\n\tint retval = rusagep ? getrusage(p, RUSAGE_BOTH, rusagep) : 0;\n\n\tput_task_struct(p);\n\tif (!retval)\n\t\tretval = put_user(SIGCHLD, &infop->si_signo);\n\tif (!retval)\n\t\tretval = put_user(0, &infop->si_errno);\n\tif (!retval)\n\t\tretval = put_user((short)why, &infop->si_code);\n\tif (!retval)\n\t\tretval = put_user(pid, &infop->si_pid);\n\tif (!retval)\n\t\tretval = put_user(uid, &infop->si_uid);\n\tif (!retval)\n\t\tretval = put_user(status, &infop->si_status);\n\tif (!retval)\n\t\tretval = pid;\n\treturn retval;\n}\n\n/*\n * Handle sys_wait4 work for one task in state EXIT_ZOMBIE. We hold\n * read_lock(&tasklist_lock) on entry. If we return zero, we still hold\n * the lock and this task is uninteresting. If we return nonzero, we have\n * released the lock and the system call should return.\n */\nstatic int wait_task_zombie(struct task_struct *p, int noreap,\n\t\t\t struct siginfo __user *infop,\n\t\t\t int __user *stat_addr, struct rusage __user *ru)\n{\n\tunsigned long state;\n\tint retval;\n\tint status;\n\n\tif (unlikely(noreap)) {\n\t\tpid_t pid = p->pid;\n\t\tuid_t uid = p->uid;\n\t\tint exit_code = p->exit_code;\n\t\tint why, status;\n\n\t\tif (unlikely(p->exit_state != EXIT_ZOMBIE))\n\t\t\treturn 0;\n\t\tif (unlikely(p->exit_signal == -1 && p->ptrace == 0))\n\t\t\treturn 0;\n\t\tget_task_struct(p);\n\t\tread_unlock(&tasklist_lock);\n\t\tif ((exit_code & 0x7f) == 0) {\n\t\t\twhy = CLD_EXITED;\n\t\t\tstatus = exit_code >> 8;\n\t\t} else {\n\t\t\twhy = (exit_code & 0x80) ? CLD_DUMPED : CLD_KILLED;\n\t\t\tstatus = exit_code & 0x7f;\n\t\t}\n\t\treturn wait_noreap_copyout(p, pid, uid, why,\n\t\t\t\t\t status, infop, ru);\n\t}\n\n\t/*\n\t * Try to move the task's state to DEAD\n\t * only one thread is allowed to do this:\n\t */\n\tstate = xchg(&p->exit_state, EXIT_DEAD);\n\tif (state != EXIT_ZOMBIE) {\n\t\tBUG_ON(state != EXIT_DEAD);\n\t\treturn 0;\n\t}\n\tif (unlikely(p->exit_signal == -1 && p->ptrace == 0)) {\n\t\t/*\n\t\t * This can only happen in a race with a ptraced thread\n\t\t * dying on another processor.\n\t\t */\n\t\treturn 0;\n\t}\n\n\tif (likely(p->real_parent == p->parent) && likely(p->signal)) {\n\t\tstruct signal_struct *psig;\n\t\tstruct signal_struct *sig;\n\n\t\t/*\n\t\t * The resource counters for the group leader are in its\n\t\t * own task_struct. Those for dead threads in the group\n\t\t * are in its signal_struct, as are those for the child\n\t\t * processes it has previously reaped. All these\n\t\t * accumulate in the parent's signal_struct c* fields.\n\t\t *\n\t\t * We don't bother to take a lock here to protect these\n\t\t * p->signal fields, because they are only touched by\n\t\t * __exit_signal, which runs with tasklist_lock\n\t\t * write-locked anyway, and so is excluded here. We do\n\t\t * need to protect the access to p->parent->signal fields,\n\t\t * as other threads in the parent group can be right\n\t\t * here reaping other children at the same time.\n\t\t */\n\t\tspin_lock_irq(&p->parent->sighand->siglock);\n\t\tpsig = p->parent->signal;\n\t\tsig = p->signal;\n\t\tpsig->cutime =\n\t\t\tcputime_add(psig->cutime,\n\t\t\tcputime_add(p->utime,\n\t\t\tcputime_add(sig->utime,\n\t\t\t\t sig->cutime)));\n\t\tpsig->cstime =\n\t\t\tcputime_add(psig->cstime,\n\t\t\tcputime_add(p->stime,\n\t\t\tcputime_add(sig->stime,\n\t\t\t\t sig->cstime)));\n\t\tpsig->cmin_flt +=\n\t\t\tp->min_flt + sig->min_flt + sig->cmin_flt;\n\t\tpsig->cmaj_flt +=\n\t\t\tp->maj_flt + sig->maj_flt + sig->cmaj_flt;\n\t\tpsig->cnvcsw +=\n\t\t\tp->nvcsw + sig->nvcsw + sig->cnvcsw;\n\t\tpsig->cnivcsw +=\n\t\t\tp->nivcsw + sig->nivcsw + sig->cnivcsw;\n\t\tpsig->cinblock +=\n\t\t\ttask_io_get_inblock(p) +\n\t\t\tsig->inblock + sig->cinblock;\n\t\tpsig->coublock +=\n\t\t\ttask_io_get_oublock(p) +\n\t\t\tsig->oublock + sig->coublock;\n\t\tspin_unlock_irq(&p->parent->sighand->siglock);\n\t}\n\n\t/*\n\t * Now we are sure this task is interesting, and no other\n\t * thread can reap it because we set its state to EXIT_DEAD.\n\t */\n\tread_unlock(&tasklist_lock);\n\n\tretval = ru ? getrusage(p, RUSAGE_BOTH, ru) : 0;\n\tstatus = (p->signal->flags & SIGNAL_GROUP_EXIT)\n\t\t? p->signal->group_exit_code : p->exit_code;\n\tif (!retval && stat_addr)\n\t\tretval = put_user(status, stat_addr);\n\tif (!retval && infop)\n\t\tretval = put_user(SIGCHLD, &infop->si_signo);\n\tif (!retval && infop)\n\t\tretval = put_user(0, &infop->si_errno);\n\tif (!retval && infop) {\n\t\tint why;\n\n\t\tif ((status & 0x7f) == 0) {\n\t\t\twhy = CLD_EXITED;\n\t\t\tstatus >>= 8;\n\t\t} else {\n\t\t\twhy = (status & 0x80) ? CLD_DUMPED : CLD_KILLED;\n\t\t\tstatus &= 0x7f;\n\t\t}\n\t\tretval = put_user((short)why, &infop->si_code);\n\t\tif (!retval)\n\t\t\tretval = put_user(status, &infop->si_status);\n\t}\n\tif (!retval && infop)\n\t\tretval = put_user(p->pid, &infop->si_pid);\n\tif (!retval && infop)\n\t\tretval = put_user(p->uid, &infop->si_uid);\n\tif (retval) {\n\t\t// TODO: is this safe?\n\t\tp->exit_state = EXIT_ZOMBIE;\n\t\treturn retval;\n\t}\n\tretval = p->pid;\n\tif (p->real_parent != p->parent) {\n\t\twrite_lock_irq(&tasklist_lock);\n\t\t/* Double-check with lock held. */\n\t\tif (p->real_parent != p->parent) {\n\t\t\t__ptrace_unlink(p);\n\t\t\t// TODO: is this safe?\n\t\t\tp->exit_state = EXIT_ZOMBIE;\n\t\t\t/*\n\t\t\t * If this is not a detached task, notify the parent.\n\t\t\t * If it's still not detached after that, don't release\n\t\t\t * it now.\n\t\t\t */\n\t\t\tif (p->exit_signal != -1) {\n\t\t\t\tdo_notify_parent(p, p->exit_signal);\n\t\t\t\tif (p->exit_signal != -1)\n\t\t\t\t\tp = NULL;\n\t\t\t}\n\t\t}\n\t\twrite_unlock_irq(&tasklist_lock);\n\t}\n\tif (p != NULL)\n\t\trelease_task(p);\n\tBUG_ON(!retval);\n\treturn retval;\n}\n\n/*\n * Handle sys_wait4 work for one task in state TASK_STOPPED. We hold\n * read_lock(&tasklist_lock) on entry. If we return zero, we still hold\n * the lock and this task is uninteresting. If we return nonzero, we have\n * released the lock and the system call should return.\n */\nstatic int wait_task_stopped(struct task_struct *p, int delayed_group_leader,\n\t\t\t int noreap, struct siginfo __user *infop,\n\t\t\t int __user *stat_addr, struct rusage __user *ru)\n{\n\tint retval, exit_code;\n\n\tif (!p->exit_code)\n\t\treturn 0;\n\tif (delayed_group_leader && !(p->ptrace & PT_PTRACED) &&\n\t p->signal && p->signal->group_stop_count > 0)\n\t\t/*\n\t\t * A group stop is in progress and this is the group leader.\n\t\t * We won't report until all threads have stopped.\n\t\t */\n\t\treturn 0;\n\n\t/*\n\t * Now we are pretty sure this task is interesting.\n\t * Make sure it doesn't get reaped out from under us while we\n\t * give up the lock and then examine it below. We don't want to\n\t * keep holding onto the tasklist_lock while we call getrusage and\n\t * possibly take page faults for user memory.\n\t */\n\tget_task_struct(p);\n\tread_unlock(&tasklist_lock);\n\n\tif (unlikely(noreap)) {\n\t\tpid_t pid = p->pid;\n\t\tuid_t uid = p->uid;\n\t\tint why = (p->ptrace & PT_PTRACED) ? CLD_TRAPPED : CLD_STOPPED;\n\n\t\texit_code = p->exit_code;\n\t\tif (unlikely(!exit_code) || unlikely(p->exit_state))\n\t\t\tgoto bail_ref;\n\t\treturn wait_noreap_copyout(p, pid, uid,\n\t\t\t\t\t why, exit_code,\n\t\t\t\t\t infop, ru);\n\t}\n\n\twrite_lock_irq(&tasklist_lock);\n\n\t/*\n\t * This uses xchg to be atomic with the thread resuming and setting\n\t * it. It must also be done with the write lock held to prevent a\n\t * race with the EXIT_ZOMBIE case.\n\t */\n\texit_code = xchg(&p->exit_code, 0);\n\tif (unlikely(p->exit_state)) {\n\t\t/*\n\t\t * The task resumed and then died. Let the next iteration\n\t\t * catch it in EXIT_ZOMBIE. Note that exit_code might\n\t\t * already be zero here if it resumed and did _exit(0).\n\t\t * The task itself is dead and won't touch exit_code again;\n\t\t * other processors in this function are locked out.\n\t\t */\n\t\tp->exit_code = exit_code;\n\t\texit_code = 0;\n\t}\n\tif (unlikely(exit_code == 0)) {\n\t\t/*\n\t\t * Another thread in this function got to it first, or it\n\t\t * resumed, or it resumed and then died.\n\t\t */\n\t\twrite_unlock_irq(&tasklist_lock);\nbail_ref:\n\t\tput_task_struct(p);\n\t\t/*\n\t\t * We are returning to the wait loop without having successfully\n\t\t * removed the process and having released the lock. We cannot\n\t\t * continue, since the \"p\" task pointer is potentially stale.\n\t\t *\n\t\t * Return -EAGAIN, and do_wait() will restart the loop from the\n\t\t * beginning. Do _not_ re-acquire the lock.\n\t\t */\n\t\treturn -EAGAIN;\n\t}\n\n\t/* move to end of parent's list to avoid starvation */\n\tremove_parent(p);\n\tadd_parent(p);\n\n\twrite_unlock_irq(&tasklist_lock);\n\n\tretval = ru ? getrusage(p, RUSAGE_BOTH, ru) : 0;\n\tif (!retval && stat_addr)\n\t\tretval = put_user((exit_code << 8) | 0x7f, stat_addr);\n\tif (!retval && infop)\n\t\tretval = put_user(SIGCHLD, &infop->si_signo);\n\tif (!retval && infop)\n\t\tretval = put_user(0, &infop->si_errno);\n\tif (!retval && infop)\n\t\tretval = put_user((short)((p->ptrace & PT_PTRACED)\n\t\t\t\t\t ? CLD_TRAPPED : CLD_STOPPED),\n\t\t\t\t &infop->si_code);\n\tif (!retval && infop)\n\t\tretval = put_user(exit_code, &infop->si_status);\n\tif (!retval && infop)\n\t\tretval = put_user(p->pid, &infop->si_pid);\n\tif (!retval && infop)\n\t\tretval = put_user(p->uid, &infop->si_uid);\n\tif (!retval)\n\t\tretval = p->pid;\n\tput_task_struct(p);\n\n\tBUG_ON(!retval);\n\treturn retval;\n}\n\n/*\n * Handle do_wait work for one task in a live, non-stopped state.\n * read_lock(&tasklist_lock) on entry. If we return zero, we still hold\n * the lock and this task is uninteresting. If we return nonzero, we have\n * released the lock and the system call should return.\n */\nstatic int wait_task_continued(struct task_struct *p, int noreap,\n\t\t\t struct siginfo __user *infop,\n\t\t\t int __user *stat_addr, struct rusage __user *ru)\n{\n\tint retval;\n\tpid_t pid;\n\tuid_t uid;\n\n\tif (unlikely(!p->signal))\n\t\treturn 0;\n\n\tif (!(p->signal->flags & SIGNAL_STOP_CONTINUED))\n\t\treturn 0;\n\n\tspin_lock_irq(&p->sighand->siglock);\n\t/* Re-check with the lock held. */\n\tif (!(p->signal->flags & SIGNAL_STOP_CONTINUED)) {\n\t\tspin_unlock_irq(&p->sighand->siglock);\n\t\treturn 0;\n\t}\n\tif (!noreap)\n\t\tp->signal->flags &= ~SIGNAL_STOP_CONTINUED;\n\tspin_unlock_irq(&p->sighand->siglock);\n\n\tpid = p->pid;\n\tuid = p->uid;\n\tget_task_struct(p);\n\tread_unlock(&tasklist_lock);\n\n\tif (!infop) {\n\t\tretval = ru ? getrusage(p, RUSAGE_BOTH, ru) : 0;\n\t\tput_task_struct(p);\n\t\tif (!retval && stat_addr)\n\t\t\tretval = put_user(0xffff, stat_addr);\n\t\tif (!retval)\n\t\t\tretval = p->pid;\n\t} else {\n\t\tretval = wait_noreap_copyout(p, pid, uid,\n\t\t\t\t\t CLD_CONTINUED, SIGCONT,\n\t\t\t\t\t infop, ru);\n\t\tBUG_ON(retval == 0);\n\t}\n\n\treturn retval;\n}\n\n\nstatic inline int my_ptrace_child(struct task_struct *p)\n{\n\tif (!(p->ptrace & PT_PTRACED))\n\t\treturn 0;\n\tif (!(p->ptrace & PT_ATTACHED))\n\t\treturn 1;\n\t/*\n\t * This child was PTRACE_ATTACH'd. We should be seeing it only if\n\t * we are the attacher. If we are the real parent, this is a race\n\t * inside ptrace_attach. It is waiting for the tasklist_lock,\n\t * which we have to switch the parent links, but has already set\n\t * the flags in p->ptrace.\n\t */\n\treturn (p->parent != p->real_parent);\n}\n\nstatic long do_wait(pid_t pid, int options, struct siginfo __user *infop,\n\t\t int __user *stat_addr, struct rusage __user *ru)\n{\n\tDECLARE_WAITQUEUE(wait, current);\n\tstruct task_struct *tsk;\n\tint flag, retval;\n\tint allowed, denied;\n\n\tadd_wait_queue(&current->signal->wait_chldexit,&wait);\nrepeat:\n\t/*\n\t * We will set this flag if we see any child that might later\n\t * match our criteria, even if we are not able to reap it yet.\n\t */\n\tflag = 0;\n\tallowed = denied = 0;\n\tcurrent->state = TASK_INTERRUPTIBLE;\n\tread_lock(&tasklist_lock);\n\ttsk = current;\n\tdo {\n\t\tstruct task_struct *p;\n\t\tstruct list_head *_p;\n\t\tint ret;\n\n\t\tlist_for_each(_p,&tsk->children) {\n\t\t\tp = list_entry(_p, struct task_struct, sibling);\n\n\t\t\tret = eligible_child(pid, options, p);\n\t\t\tif (!ret)\n\t\t\t\tcontinue;\n\n\t\t\tif (unlikely(ret < 0)) {\n\t\t\t\tdenied = ret;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tallowed = 1;\n\n\t\t\tswitch (p->state) {\n\t\t\tcase TASK_TRACED:\n\t\t\t\t/*\n\t\t\t\t * When we hit the race with PTRACE_ATTACH,\n\t\t\t\t * we will not report this child. But the\n\t\t\t\t * race means it has not yet been moved to\n\t\t\t\t * our ptrace_children list, so we need to\n\t\t\t\t * set the flag here to avoid a spurious ECHILD\n\t\t\t\t * when the race happens with the only child.\n\t\t\t\t */\n\t\t\t\tflag = 1;\n\t\t\t\tif (!my_ptrace_child(p))\n\t\t\t\t\tcontinue;\n\t\t\t\t/*FALLTHROUGH*/\n\t\t\tcase TASK_STOPPED:\n\t\t\t\t/*\n\t\t\t\t * It's stopped now, so it might later\n\t\t\t\t * continue, exit, or stop again.\n\t\t\t\t */\n\t\t\t\tflag = 1;\n\t\t\t\tif (!(options & WUNTRACED) &&\n\t\t\t\t !my_ptrace_child(p))\n\t\t\t\t\tcontinue;\n\t\t\t\tretval = wait_task_stopped(p, ret == 2,\n\t\t\t\t\t\t\t (options & WNOWAIT),\n\t\t\t\t\t\t\t infop,\n\t\t\t\t\t\t\t stat_addr, ru);\n\t\t\t\tif (retval == -EAGAIN)\n\t\t\t\t\tgoto repeat;\n\t\t\t\tif (retval != 0) /* He released the lock. */\n\t\t\t\t\tgoto end;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t// case EXIT_DEAD:\n\t\t\t\tif (p->exit_state == EXIT_DEAD)\n\t\t\t\t\tcontinue;\n\t\t\t// case EXIT_ZOMBIE:\n\t\t\t\tif (p->exit_state == EXIT_ZOMBIE) {\n\t\t\t\t\t/*\n\t\t\t\t\t * Eligible but we cannot release\n\t\t\t\t\t * it yet:\n\t\t\t\t\t */\n\t\t\t\t\tif (ret == 2)\n\t\t\t\t\t\tgoto check_continued;\n\t\t\t\t\tif (!likely(options & WEXITED))\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\tretval = wait_task_zombie(\n\t\t\t\t\t\tp, (options & WNOWAIT),\n\t\t\t\t\t\tinfop, stat_addr, ru);\n\t\t\t\t\t/* He released the lock. */\n\t\t\t\t\tif (retval != 0)\n\t\t\t\t\t\tgoto end;\n\t\t\t\t\tbreak;\n\t\t\t\t}\ncheck_continued:\n\t\t\t\t/*\n\t\t\t\t * It's running now, so it might later\n\t\t\t\t * exit, stop, or stop and then continue.\n\t\t\t\t */\n\t\t\t\tflag = 1;\n\t\t\t\tif (!unlikely(options & WCONTINUED))\n\t\t\t\t\tcontinue;\n\t\t\t\tretval = wait_task_continued(\n\t\t\t\t\tp, (options & WNOWAIT),\n\t\t\t\t\tinfop, stat_addr, ru);\n\t\t\t\tif (retval != 0) /* He released the lock. */\n\t\t\t\t\tgoto end;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (!flag) {\n\t\t\tlist_for_each(_p, &tsk->ptrace_children) {\n\t\t\t\tp = list_entry(_p, struct task_struct,\n\t\t\t\t\t\tptrace_list);\n\t\t\t\tif (!eligible_child(pid, options, p))\n\t\t\t\t\tcontinue;\n\t\t\t\tflag = 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (options & __WNOTHREAD)\n\t\t\tbreak;\n\t\ttsk = next_thread(tsk);\n\t\tBUG_ON(tsk->signal != current->signal);\n\t} while (tsk != current);\n\n\tread_unlock(&tasklist_lock);\n\tif (flag) {\n\t\tretval = 0;\n\t\tif (options & WNOHANG)\n\t\t\tgoto end;\n\t\tretval = -ERESTARTSYS;\n\t\tif (signal_pending(current))\n\t\t\tgoto end;\n\t\tschedule();\n\t\tgoto repeat;\n\t}\n\tretval = -ECHILD;\n\tif (unlikely(denied) && !allowed)\n\t\tretval = denied;\nend:\n\tcurrent->state = TASK_RUNNING;\n\tremove_wait_queue(&current->signal->wait_chldexit,&wait);\n\tif (infop) {\n\t\tif (retval > 0)\n\t\tretval = 0;\n\t\telse {\n\t\t\t/*\n\t\t\t * For a WNOHANG return, clear out all the fields\n\t\t\t * we would set so the user can easily tell the\n\t\t\t * difference.\n\t\t\t */\n\t\t\tif (!retval)\n\t\t\t\tretval = put_user(0, &infop->si_signo);\n\t\t\tif (!retval)\n\t\t\t\tretval = put_user(0, &infop->si_errno);\n\t\t\tif (!retval)\n\t\t\t\tretval = put_user(0, &infop->si_code);\n\t\t\tif (!retval)\n\t\t\t\tretval = put_user(0, &infop->si_pid);\n\t\t\tif (!retval)\n\t\t\t\tretval = put_user(0, &infop->si_uid);\n\t\t\tif (!retval)\n\t\t\t\tretval = put_user(0, &infop->si_status);\n\t\t}\n\t}\n\treturn retval;\n}\n\nasmlinkage long sys_waitid(int which, pid_t pid,\n\t\t\t struct siginfo __user *infop, int options,\n\t\t\t struct rusage __user *ru)\n{\n\tlong ret;\n\n\tif (options & ~(WNOHANG|WNOWAIT|WEXITED|WSTOPPED|WCONTINUED))\n\t\treturn -EINVAL;\n\tif (!(options & (WEXITED|WSTOPPED|WCONTINUED)))\n\t\treturn -EINVAL;\n\n\tswitch (which) {\n\tcase P_ALL:\n\t\tpid = -1;\n\t\tbreak;\n\tcase P_PID:\n\t\tif (pid <= 0)\n\t\t\treturn -EINVAL;\n\t\tbreak;\n\tcase P_PGID:\n\t\tif (pid <= 0)\n\t\t\treturn -EINVAL;\n\t\tpid = -pid;\n\t\tbreak;\n\tdefault:\n\t\treturn -EINVAL;\n\t}\n\n\tret = do_wait(pid, options, infop, NULL, ru);\n\n\t/* avoid REGPARM breakage on x86: */\n\tprevent_tail_call(ret);\n\treturn ret;\n}\n\nasmlinkage long sys_wait4(pid_t pid, int __user *stat_addr,\n\t\t\t int options, struct rusage __user *ru)\n{\n\tlong ret;\n\n\tif (options & ~(WNOHANG|WUNTRACED|WCONTINUED|\n\t\t\t__WNOTHREAD|__WCLONE|__WALL))\n\t\treturn -EINVAL;\n\tret = do_wait(pid, options | WEXITED, NULL, stat_addr, ru);\n\n\t/* avoid REGPARM breakage on x86: */\n\tprevent_tail_call(ret);\n\treturn ret;\n}\n\n#ifdef __ARCH_WANT_SYS_WAITPID\n\n/*\n * sys_waitpid() remains for compatibility. waitpid() should be\n * implemented by calling sys_wait4() from libc.a.\n */\nasmlinkage long sys_waitpid(pid_t pid, int __user *stat_addr, int options)\n{\n\treturn sys_wait4(pid, stat_addr, options, NULL);\n}\n\n#endif\n/* Rewritten by Rusty Russell, on the backs of many others...\n Copyright (C) 2001 Rusty Russell, 2002 Rusty Russell IBM.\n\n This program is free software; you can redistribute it and/or modify\n it under the terms of the GNU General Public License as published by\n the Free Software Foundation; either version 2 of the License, or\n (at your option) any later version.\n\n This program is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License\n along with this program; if not, write to the Free Software\n Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n*/\n#include <linux/module.h>\n#include <linux/init.h>\n#include <asm/uaccess.h>\n#include <asm/sections.h>\n\nextern struct exception_table_entry __start___ex_table[];\nextern struct exception_table_entry __stop___ex_table[];\n\n/* Sort the kernel's built-in exception table */\nvoid __init sort_main_extable(void)\n{\n\tsort_extable(__start___ex_table, __stop___ex_table);\n}\n\n/* Given an address, look for it in the exception tables. */\nconst struct exception_table_entry *search_exception_tables(unsigned long addr)\n{\n\tconst struct exception_table_entry *e;\n\n\te = search_extable(__start___ex_table, __stop___ex_table-1, addr);\n\tif (!e)\n\t\te = search_module_extables(addr);\n\treturn e;\n}\n\nint core_kernel_text(unsigned long addr)\n{\n\tif (addr >= (unsigned long)_stext &&\n\t addr <= (unsigned long)_etext)\n\t\treturn 1;\n\n\tif (addr >= (unsigned long)_sinittext &&\n\t addr <= (unsigned long)_einittext)\n\t\treturn 1;\n\treturn 0;\n}\n\nint __kernel_text_address(unsigned long addr)\n{\n\tif (core_kernel_text(addr))\n\t\treturn 1;\n\treturn __module_text_address(addr) != NULL;\n}\n\nint kernel_text_address(unsigned long addr)\n{\n\tif (core_kernel_text(addr))\n\t\treturn 1;\n\treturn module_text_address(addr) != NULL;\n}\n/*\n * linux/kernel/fork.c\n *\n * Copyright (C) 1991, 1992 Linus Torvalds\n */\n\n/*\n * 'fork.c' contains the help-routines for the 'fork' system call\n * (see also entry.S and others).\n * Fork is rather simple, once you get the hang of it, but the memory\n * management can be a bitch. See 'mm/memory.c': 'copy_page_range()'\n */\n\n#include <linux/slab.h>\n#include <linux/init.h>\n#include <linux/unistd.h>\n#include <linux/module.h>\n#include <linux/vmalloc.h>\n#include <linux/completion.h>\n#include <linux/mnt_namespace.h>\n#include <linux/personality.h>\n#include <linux/mempolicy.h>\n#include <linux/sem.h>\n#include <linux/file.h>\n#include <linux/key.h>\n#include <linux/binfmts.h>\n#include <linux/mman.h>\n#include <linux/fs.h>\n#include <linux/nsproxy.h>\n#include <linux/capability.h>\n#include <linux/cpu.h>\n#include <linux/cpuset.h>\n#include <linux/security.h>\n#include <linux/swap.h>\n#include <linux/syscalls.h>\n#include <linux/jiffies.h>\n#include <linux/futex.h>\n#include <linux/task_io_accounting_ops.h>\n#include <linux/rcupdate.h>\n#include <linux/ptrace.h>\n#include <linux/mount.h>\n#include <linux/audit.h>\n#include <linux/profile.h>\n#include <linux/rmap.h>\n#include <linux/acct.h>\n#include <linux/tsacct_kern.h>\n#include <linux/cn_proc.h>\n#include <linux/freezer.h>\n#include <linux/delayacct.h>\n#include <linux/taskstats_kern.h>\n#include <linux/random.h>\n\n#include <asm/pgtable.h>\n#include <asm/pgalloc.h>\n#include <asm/uaccess.h>\n#include <asm/mmu_context.h>\n#include <asm/cacheflush.h>\n#include <asm/tlbflush.h>\n\n/*\n * Protected counters by write_lock_irq(&tasklist_lock)\n */\nunsigned long total_forks;\t/* Handle normal Linux uptimes. */\nint nr_threads; \t\t/* The idle threads do not count.. */\n\nint max_threads;\t\t/* tunable limit on nr_threads */\n\nDEFINE_PER_CPU(unsigned long, process_counts) = 0;\n\n__cacheline_aligned DEFINE_RWLOCK(tasklist_lock); /* outer */\n\nint nr_processes(void)\n{\n\tint cpu;\n\tint total = 0;\n\n\tfor_each_online_cpu(cpu)\n\t\ttotal += per_cpu(process_counts, cpu);\n\n\treturn total;\n}\n\n#ifndef __HAVE_ARCH_TASK_STRUCT_ALLOCATOR\n# define alloc_task_struct()\tkmem_cache_alloc(task_struct_cachep, GFP_KERNEL)\n# define free_task_struct(tsk)\tkmem_cache_free(task_struct_cachep, (tsk))\nstatic struct kmem_cache *task_struct_cachep;\n#endif\n\n/* SLAB cache for signal_struct structures (tsk->signal) */\nstatic struct kmem_cache *signal_cachep;\n\n/* SLAB cache for sighand_struct structures (tsk->sighand) */\nstruct kmem_cache *sighand_cachep;\n\n/* SLAB cache for files_struct structures (tsk->files) */\nstruct kmem_cache *files_cachep;\n\n/* SLAB cache for fs_struct structures (tsk->fs) */\nstruct kmem_cache *fs_cachep;\n\n/* SLAB cache for vm_area_struct structures */\nstruct kmem_cache *vm_area_cachep;\n\n/* SLAB cache for mm_struct structures (tsk->mm) */\nstatic struct kmem_cache *mm_cachep;\n\nvoid free_task(struct task_struct *tsk)\n{\n\tfree_thread_info(tsk->stack);\n\trt_mutex_debug_task_free(tsk);\n\tfree_task_struct(tsk);\n}\nEXPORT_SYMBOL(free_task);\n\nvoid __put_task_struct(struct task_struct *tsk)\n{\n\tWARN_ON(!(tsk->exit_state & (EXIT_DEAD | EXIT_ZOMBIE)));\n\tWARN_ON(atomic_read(&tsk->usage));\n\tWARN_ON(tsk == current);\n\n\tsecurity_task_free(tsk);\n\tfree_uid(tsk->user);\n\tput_group_info(tsk->group_info);\n\tdelayacct_tsk_free(tsk);\n\n\tif (!profile_handoff_task(tsk))\n\t\tfree_task(tsk);\n}\n\nvoid __init fork_init(unsigned long mempages)\n{\n#ifndef __HAVE_ARCH_TASK_STRUCT_ALLOCATOR\n#ifndef ARCH_MIN_TASKALIGN\n#define ARCH_MIN_TASKALIGN\tL1_CACHE_BYTES\n#endif\n\t/* create a slab on which task_structs can be allocated */\n\ttask_struct_cachep =\n\t\tkmem_cache_create(\"task_struct\", sizeof(struct task_struct),\n\t\t\tARCH_MIN_TASKALIGN, SLAB_PANIC, NULL, NULL);\n#endif\n\n\t/*\n\t * The default maximum number of threads is set to a safe\n\t * value: the thread structures can take up at most half\n\t * of memory.\n\t */\n\tmax_threads = mempages / (8 * THREAD_SIZE / PAGE_SIZE);\n\n\t/*\n\t * we need to allow at least 20 threads to boot a system\n\t */\n\tif(max_threads < 20)\n\t\tmax_threads = 20;\n\n\tinit_task.signal->rlim[RLIMIT_NPROC].rlim_cur = max_threads/2;\n\tinit_task.signal->rlim[RLIMIT_NPROC].rlim_max = max_threads/2;\n\tinit_task.signal->rlim[RLIMIT_SIGPENDING] =\n\t\tinit_task.signal->rlim[RLIMIT_NPROC];\n}\n\nstatic struct task_struct *dup_task_struct(struct task_struct *orig)\n{\n\tstruct task_struct *tsk;\n\tstruct thread_info *ti;\n\n\tprepare_to_copy(orig);\n\n\ttsk = alloc_task_struct();\n\tif (!tsk)\n\t\treturn NULL;\n\n\tti = alloc_thread_info(tsk);\n\tif (!ti) {\n\t\tfree_task_struct(tsk);\n\t\treturn NULL;\n\t}\n\n\t*tsk = *orig;\n\ttsk->stack = ti;\n\tsetup_thread_stack(tsk, orig);\n\n#ifdef CONFIG_CC_STACKPROTECTOR\n\ttsk->stack_canary = get_random_int();\n#endif\n\n\t/* One for us, one for whoever does the \"release_task()\" (usually parent) */\n\tatomic_set(&tsk->usage,2);\n\tatomic_set(&tsk->fs_excl, 0);\n#ifdef CONFIG_BLK_DEV_IO_TRACE\n\ttsk->btrace_seq = 0;\n#endif\n\ttsk->splice_pipe = NULL;\n\treturn tsk;\n}\n\n#ifdef CONFIG_MMU\nstatic inline int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm)\n{\n\tstruct vm_area_struct *mpnt, *tmp, **pprev;\n\tstruct rb_node **rb_link, *rb_parent;\n\tint retval;\n\tunsigned long charge;\n\tstruct mempolicy *pol;\n\n\tdown_write(&oldmm->mmap_sem);\n\tflush_cache_dup_mm(oldmm);\n\t/*\n\t * Not linked in yet - no deadlock potential:\n\t */\n\tdown_write_nested(&mm->mmap_sem, SINGLE_DEPTH_NESTING);\n\n\tmm->locked_vm = 0;\n\tmm->mmap = NULL;\n\tmm->mmap_cache = NULL;\n\tmm->free_area_cache = oldmm->mmap_base;\n\tmm->cached_hole_size = ~0UL;\n\tmm->map_count = 0;\n\tcpus_clear(mm->cpu_vm_mask);\n\tmm->mm_rb = RB_ROOT;\n\trb_link = &mm->mm_rb.rb_node;\n\trb_parent = NULL;\n\tpprev = &mm->mmap;\n\n\tfor (mpnt = oldmm->mmap; mpnt; mpnt = mpnt->vm_next) {\n\t\tstruct file *file;\n\n\t\tif (mpnt->vm_flags & VM_DONTCOPY) {\n\t\t\tlong pages = vma_pages(mpnt);\n\t\t\tmm->total_vm -= pages;\n\t\t\tvm_stat_account(mm, mpnt->vm_flags, mpnt->vm_file,\n\t\t\t\t\t\t\t\t-pages);\n\t\t\tcontinue;\n\t\t}\n\t\tcharge = 0;\n\t\tif (mpnt->vm_flags & VM_ACCOUNT) {\n\t\t\tunsigned int len = (mpnt->vm_end - mpnt->vm_start) >> PAGE_SHIFT;\n\t\t\tif (security_vm_enough_memory(len))\n\t\t\t\tgoto fail_nomem;\n\t\t\tcharge = len;\n\t\t}\n\t\ttmp = kmem_cache_alloc(vm_area_cachep, GFP_KERNEL);\n\t\tif (!tmp)\n\t\t\tgoto fail_nomem;\n\t\t*tmp = *mpnt;\n\t\tpol = mpol_copy(vma_policy(mpnt));\n\t\tretval = PTR_ERR(pol);\n\t\tif (IS_ERR(pol))\n\t\t\tgoto fail_nomem_policy;\n\t\tvma_set_policy(tmp, pol);\n\t\ttmp->vm_flags &= ~VM_LOCKED;\n\t\ttmp->vm_mm = mm;\n\t\ttmp->vm_next = NULL;\n\t\tanon_vma_link(tmp);\n\t\tfile = tmp->vm_file;\n\t\tif (file) {\n\t\t\tstruct inode *inode = file->f_path.dentry->d_inode;\n\t\t\tget_file(file);\n\t\t\tif (tmp->vm_flags & VM_DENYWRITE)\n\t\t\t\tatomic_dec(&inode->i_writecount);\n \n\t\t\t/* insert tmp into the share list, just after mpnt */\n\t\t\tspin_lock(&file->f_mapping->i_mmap_lock);\n\t\t\ttmp->vm_truncate_count = mpnt->vm_truncate_count;\n\t\t\tflush_dcache_mmap_lock(file->f_mapping);\n\t\t\tvma_prio_tree_add(tmp, mpnt);\n\t\t\tflush_dcache_mmap_unlock(file->f_mapping);\n\t\t\tspin_unlock(&file->f_mapping->i_mmap_lock);\n\t\t}\n\n\t\t/*\n\t\t * Link in the new vma and copy the page table entries.\n\t\t */\n\t\t*pprev = tmp;\n\t\tpprev = &tmp->vm_next;\n\n\t\t__vma_link_rb(mm, tmp, rb_link, rb_parent);\n\t\trb_link = &tmp->vm_rb.rb_right;\n\t\trb_parent = &tmp->vm_rb;\n\n\t\tmm->map_count++;\n\t\tretval = copy_page_range(mm, oldmm, mpnt);\n\n\t\tif (tmp->vm_ops && tmp->vm_ops->open)\n\t\t\ttmp->vm_ops->open(tmp);\n\n\t\tif (retval)\n\t\t\tgoto out;\n\t}\n\t/* a new mm has just been created */\n\tarch_dup_mmap(oldmm, mm);\n\tretval = 0;\nout:\n\tup_write(&mm->mmap_sem);\n\tflush_tlb_mm(oldmm);\n\tup_write(&oldmm->mmap_sem);\n\treturn retval;\nfail_nomem_policy:\n\tkmem_cache_free(vm_area_cachep, tmp);\nfail_nomem:\n\tretval = -ENOMEM;\n\tvm_unacct_memory(charge);\n\tgoto out;\n}\n\nstatic inline int mm_alloc_pgd(struct mm_struct * mm)\n{\n\tmm->pgd = pgd_alloc(mm);\n\tif (unlikely(!mm->pgd))\n\t\treturn -ENOMEM;\n\treturn 0;\n}\n\nstatic inline void mm_free_pgd(struct mm_struct * mm)\n{\n\tpgd_free(mm->pgd);\n}\n#else\n#define dup_mmap(mm, oldmm)\t(0)\n#define mm_alloc_pgd(mm)\t(0)\n#define mm_free_pgd(mm)\n#endif /* CONFIG_MMU */\n\n __cacheline_aligned_in_smp DEFINE_SPINLOCK(mmlist_lock);\n\n#define allocate_mm()\t(kmem_cache_alloc(mm_cachep, GFP_KERNEL))\n#define free_mm(mm)\t(kmem_cache_free(mm_cachep, (mm)))\n\n#include <linux/init_task.h>\n\nstatic struct mm_struct * mm_init(struct mm_struct * mm)\n{\n\tatomic_set(&mm->mm_users, 1);\n\tatomic_set(&mm->mm_count, 1);\n\tinit_rwsem(&mm->mmap_sem);\n\tINIT_LIST_HEAD(&mm->mmlist);\n\tmm->core_waiters = 0;\n\tmm->nr_ptes = 0;\n\tset_mm_counter(mm, file_rss, 0);\n\tset_mm_counter(mm, anon_rss, 0);\n\tspin_lock_init(&mm->page_table_lock);\n\trwlock_init(&mm->ioctx_list_lock);\n\tmm->ioctx_list = NULL;\n\tmm->free_area_cache = TASK_UNMAPPED_BASE;\n\tmm->cached_hole_size = ~0UL;\n\n\tif (likely(!mm_alloc_pgd(mm))) {\n\t\tmm->def_flags = 0;\n\t\treturn mm;\n\t}\n\tfree_mm(mm);\n\treturn NULL;\n}\n\n/*\n * Allocate and initialize an mm_struct.\n */\nstruct mm_struct * mm_alloc(void)\n{\n\tstruct mm_struct * mm;\n\n\tmm = allocate_mm();\n\tif (mm) {\n\t\tmemset(mm, 0, sizeof(*mm));\n\t\tmm = mm_init(mm);\n\t}\n\treturn mm;\n}\n\n/*\n * Called when the last reference to the mm\n * is dropped: either by a lazy thread or by\n * mmput. Free the page directory and the mm.\n */\nvoid fastcall __mmdrop(struct mm_struct *mm)\n{\n\tBUG_ON(mm == &init_mm);\n\tmm_free_pgd(mm);\n\tdestroy_context(mm);\n\tfree_mm(mm);\n}\n\n/*\n * Decrement the use count and release all resources for an mm.\n */\nvoid mmput(struct mm_struct *mm)\n{\n\tmight_sleep();\n\n\tif (atomic_dec_and_test(&mm->mm_users)) {\n\t\texit_aio(mm);\n\t\texit_mmap(mm);\n\t\tif (!list_empty(&mm->mmlist)) {\n\t\t\tspin_lock(&mmlist_lock);\n\t\t\tlist_del(&mm->mmlist);\n\t\t\tspin_unlock(&mmlist_lock);\n\t\t}\n\t\tput_swap_token(mm);\n\t\tmmdrop(mm);\n\t}\n}\nEXPORT_SYMBOL_GPL(mmput);\n\n/**\n * get_task_mm - acquire a reference to the task's mm\n *\n * Returns %NULL if the task has no mm. Checks PF_BORROWED_MM (meaning\n * this kernel workthread has transiently adopted a user mm with use_mm,\n * to do its AIO) is not set and if so returns a reference to it, after\n * bumping up the use count. User must release the mm via mmput()\n * after use. Typically used by /proc and ptrace.\n */\nstruct mm_struct *get_task_mm(struct task_struct *task)\n{\n\tstruct mm_struct *mm;\n\n\ttask_lock(task);\n\tmm = task->mm;\n\tif (mm) {\n\t\tif (task->flags & PF_BORROWED_MM)\n\t\t\tmm = NULL;\n\t\telse\n\t\t\tatomic_inc(&mm->mm_users);\n\t}\n\ttask_unlock(task);\n\treturn mm;\n}\nEXPORT_SYMBOL_GPL(get_task_mm);\n\n/* Please note the differences between mmput and mm_release.\n * mmput is called whenever we stop holding onto a mm_struct,\n * error success whatever.\n *\n * mm_release is called after a mm_struct has been removed\n * from the current process.\n *\n * This difference is important for error handling, when we\n * only half set up a mm_struct for a new process and need to restore\n * the old one. Because we mmput the new mm_struct before\n * restoring the old one. . .\n * Eric Biederman 10 January 1998\n */\nvoid mm_release(struct task_struct *tsk, struct mm_struct *mm)\n{\n\tstruct completion *vfork_done = tsk->vfork_done;\n\n\t/* Get rid of any cached register state */\n\tdeactivate_mm(tsk, mm);\n\n\t/* notify parent sleeping on vfork() */\n\tif (vfork_done) {\n\t\ttsk->vfork_done = NULL;\n\t\tcomplete(vfork_done);\n\t}\n\n\t/*\n\t * If we're exiting normally, clear a user-space tid field if\n\t * requested. We leave this alone when dying by signal, to leave\n\t * the value intact in a core dump, and to save the unnecessary\n\t * trouble otherwise. Userland only wants this done for a sys_exit.\n\t */\n\tif (tsk->clear_child_tid\n\t && !(tsk->flags & PF_SIGNALED)\n\t && atomic_read(&mm->mm_users) > 1) {\n\t\tu32 __user * tidptr = tsk->clear_child_tid;\n\t\ttsk->clear_child_tid = NULL;\n\n\t\t/*\n\t\t * We don't check the error code - if userspace has\n\t\t * not set up a proper pointer then tough luck.\n\t\t */\n\t\tput_user(0, tidptr);\n\t\tsys_futex(tidptr, FUTEX_WAKE, 1, NULL, NULL, 0);\n\t}\n}\n\n/*\n * Allocate a new mm structure and copy contents from the\n * mm structure of the passed in task structure.\n */\nstatic struct mm_struct *dup_mm(struct task_struct *tsk)\n{\n\tstruct mm_struct *mm, *oldmm = current->mm;\n\tint err;\n\n\tif (!oldmm)\n\t\treturn NULL;\n\n\tmm = allocate_mm();\n\tif (!mm)\n\t\tgoto fail_nomem;\n\n\tmemcpy(mm, oldmm, sizeof(*mm));\n\n\t/* Initializing for Swap token stuff */\n\tmm->token_priority = 0;\n\tmm->last_interval = 0;\n\n\tif (!mm_init(mm))\n\t\tgoto fail_nomem;\n\n\tif (init_new_context(tsk, mm))\n\t\tgoto fail_nocontext;\n\n\terr = dup_mmap(mm, oldmm);\n\tif (err)\n\t\tgoto free_pt;\n\n\tmm->hiwater_rss = get_mm_rss(mm);\n\tmm->hiwater_vm = mm->total_vm;\n\n\treturn mm;\n\nfree_pt:\n\tmmput(mm);\n\nfail_nomem:\n\treturn NULL;\n\nfail_nocontext:\n\t/*\n\t * If init_new_context() failed, we cannot use mmput() to free the mm\n\t * because it calls destroy_context()\n\t */\n\tmm_free_pgd(mm);\n\tfree_mm(mm);\n\treturn NULL;\n}\n\nstatic int copy_mm(unsigned long clone_flags, struct task_struct * tsk)\n{\n\tstruct mm_struct * mm, *oldmm;\n\tint retval;\n\n\ttsk->min_flt = tsk->maj_flt = 0;\n\ttsk->nvcsw = tsk->nivcsw = 0;\n\n\ttsk->mm = NULL;\n\ttsk->active_mm = NULL;\n\n\t/*\n\t * Are we cloning a kernel thread?\n\t *\n\t * We need to steal a active VM for that..\n\t */\n\toldmm = current->mm;\n\tif (!oldmm)\n\t\treturn 0;\n\n\tif (clone_flags & CLONE_VM) {\n\t\tatomic_inc(&oldmm->mm_users);\n\t\tmm = oldmm;\n\t\tgoto good_mm;\n\t}\n\n\tretval = -ENOMEM;\n\tmm = dup_mm(tsk);\n\tif (!mm)\n\t\tgoto fail_nomem;\n\ngood_mm:\n\t/* Initializing for Swap token stuff */\n\tmm->token_priority = 0;\n\tmm->last_interval = 0;\n\n\ttsk->mm = mm;\n\ttsk->active_mm = mm;\n\treturn 0;\n\nfail_nomem:\n\treturn retval;\n}\n\nstatic inline struct fs_struct *__copy_fs_struct(struct fs_struct *old)\n{\n\tstruct fs_struct *fs = kmem_cache_alloc(fs_cachep, GFP_KERNEL);\n\t/* We don't need to lock fs - think why ;-) */\n\tif (fs) {\n\t\tatomic_set(&fs->count, 1);\n\t\trwlock_init(&fs->lock);\n\t\tfs->umask = old->umask;\n\t\tread_lock(&old->lock);\n\t\tfs->rootmnt = mntget(old->rootmnt);\n\t\tfs->root = dget(old->root);\n\t\tfs->pwdmnt = mntget(old->pwdmnt);\n\t\tfs->pwd = dget(old->pwd);\n\t\tif (old->altroot) {\n\t\t\tfs->altrootmnt = mntget(old->altrootmnt);\n\t\t\tfs->altroot = dget(old->altroot);\n\t\t} else {\n\t\t\tfs->altrootmnt = NULL;\n\t\t\tfs->altroot = NULL;\n\t\t}\n\t\tread_unlock(&old->lock);\n\t}\n\treturn fs;\n}\n\nstruct fs_struct *copy_fs_struct(struct fs_struct *old)\n{\n\treturn __copy_fs_struct(old);\n}\n\nEXPORT_SYMBOL_GPL(copy_fs_struct);\n\nstatic inline int copy_fs(unsigned long clone_flags, struct task_struct * tsk)\n{\n\tif (clone_flags & CLONE_FS) {\n\t\tatomic_inc(&current->fs->count);\n\t\treturn 0;\n\t}\n\ttsk->fs = __copy_fs_struct(current->fs);\n\tif (!tsk->fs)\n\t\treturn -ENOMEM;\n\treturn 0;\n}\n\nstatic int count_open_files(struct fdtable *fdt)\n{\n\tint size = fdt->max_fds;\n\tint i;\n\n\t/* Find the last open fd */\n\tfor (i = size/(8*sizeof(long)); i > 0; ) {\n\t\tif (fdt->open_fds->fds_bits[--i])\n\t\t\tbreak;\n\t}\n\ti = (i+1) * 8 * sizeof(long);\n\treturn i;\n}\n\nstatic struct files_struct *alloc_files(void)\n{\n\tstruct files_struct *newf;\n\tstruct fdtable *fdt;\n\n\tnewf = kmem_cache_alloc(files_cachep, GFP_KERNEL);\n\tif (!newf)\n\t\tgoto out;\n\n\tatomic_set(&newf->count, 1);\n\n\tspin_lock_init(&newf->file_lock);\n\tnewf->next_fd = 0;\n\tfdt = &newf->fdtab;\n\tfdt->max_fds = NR_OPEN_DEFAULT;\n\tfdt->close_on_exec = (fd_set *)&newf->close_on_exec_init;\n\tfdt->open_fds = (fd_set *)&newf->open_fds_init;\n\tfdt->fd = &newf->fd_array[0];\n\tINIT_RCU_HEAD(&fdt->rcu);\n\tfdt->next = NULL;\n\trcu_assign_pointer(newf->fdt, fdt);\nout:\n\treturn newf;\n}\n\n/*\n * Allocate a new files structure and copy contents from the\n * passed in files structure.\n * errorp will be valid only when the returned files_struct is NULL.\n */\nstatic struct files_struct *dup_fd(struct files_struct *oldf, int *errorp)\n{\n\tstruct files_struct *newf;\n\tstruct file **old_fds, **new_fds;\n\tint open_files, size, i;\n\tstruct fdtable *old_fdt, *new_fdt;\n\n\t*errorp = -ENOMEM;\n\tnewf = alloc_files();\n\tif (!newf)\n\t\tgoto out;\n\n\tspin_lock(&oldf->file_lock);\n\told_fdt = files_fdtable(oldf);\n\tnew_fdt = files_fdtable(newf);\n\topen_files = count_open_files(old_fdt);\n\n\t/*\n\t * Check whether we need to allocate a larger fd array and fd set.\n\t * Note: we're not a clone task, so the open count won't change.\n\t */\n\tif (open_files > new_fdt->max_fds) {\n\t\tnew_fdt->max_fds = 0;\n\t\tspin_unlock(&oldf->file_lock);\n\t\tspin_lock(&newf->file_lock);\n\t\t*errorp = expand_files(newf, open_files-1);\n\t\tspin_unlock(&newf->file_lock);\n\t\tif (*errorp < 0)\n\t\t\tgoto out_release;\n\t\tnew_fdt = files_fdtable(newf);\n\t\t/*\n\t\t * Reacquire the oldf lock and a pointer to its fd table\n\t\t * who knows it may have a new bigger fd table. We need\n\t\t * the latest pointer.\n\t\t */\n\t\tspin_lock(&oldf->file_lock);\n\t\told_fdt = files_fdtable(oldf);\n\t}\n\n\told_fds = old_fdt->fd;\n\tnew_fds = new_fdt->fd;\n\n\tmemcpy(new_fdt->open_fds->fds_bits,\n\t\told_fdt->open_fds->fds_bits, open_files/8);\n\tmemcpy(new_fdt->close_on_exec->fds_bits,\n\t\told_fdt->close_on_exec->fds_bits, open_files/8);\n\n\tfor (i = open_files; i != 0; i--) {\n\t\tstruct file *f = *old_fds++;\n\t\tif (f) {\n\t\t\tget_file(f);\n\t\t} else {\n\t\t\t/*\n\t\t\t * The fd may be claimed in the fd bitmap but not yet\n\t\t\t * instantiated in the files array if a sibling thread\n\t\t\t * is partway through open(). So make sure that this\n\t\t\t * fd is available to the new process.\n\t\t\t */\n\t\t\tFD_CLR(open_files - i, new_fdt->open_fds);\n\t\t}\n\t\trcu_assign_pointer(*new_fds++, f);\n\t}\n\tspin_unlock(&oldf->file_lock);\n\n\t/* compute the remainder to be cleared */\n\tsize = (new_fdt->max_fds - open_files) * sizeof(struct file *);\n\n\t/* This is long word aligned thus could use a optimized version */ \n\tmemset(new_fds, 0, size); \n\n\tif (new_fdt->max_fds > open_files) {\n\t\tint left = (new_fdt->max_fds-open_files)/8;\n\t\tint start = open_files / (8 * sizeof(unsigned long));\n\n\t\tmemset(&new_fdt->open_fds->fds_bits[start], 0, left);\n\t\tmemset(&new_fdt->close_on_exec->fds_bits[start], 0, left);\n\t}\n\n\treturn newf;\n\nout_release:\n\tkmem_cache_free(files_cachep, newf);\nout:\n\treturn NULL;\n}\n\nstatic int copy_files(unsigned long clone_flags, struct task_struct * tsk)\n{\n\tstruct files_struct *oldf, *newf;\n\tint error = 0;\n\n\t/*\n\t * A background process may not have any files ...\n\t */\n\toldf = current->files;\n\tif (!oldf)\n\t\tgoto out;\n\n\tif (clone_flags & CLONE_FILES) {\n\t\tatomic_inc(&oldf->count);\n\t\tgoto out;\n\t}\n\n\t/*\n\t * Note: we may be using current for both targets (See exec.c)\n\t * This works because we cache current->files (old) as oldf. Don't\n\t * break this.\n\t */\n\ttsk->files = NULL;\n\tnewf = dup_fd(oldf, &error);\n\tif (!newf)\n\t\tgoto out;\n\n\ttsk->files = newf;\n\terror = 0;\nout:\n\treturn error;\n}\n\n/*\n *\tHelper to unshare the files of the current task.\n *\tWe don't want to expose copy_files internals to\n *\tthe exec layer of the kernel.\n */\n\nint unshare_files(void)\n{\n\tstruct files_struct *files = current->files;\n\tint rc;\n\n\tBUG_ON(!files);\n\n\t/* This can race but the race causes us to copy when we don't\n\t need to and drop the copy */\n\tif(atomic_read(&files->count) == 1)\n\t{\n\t\tatomic_inc(&files->count);\n\t\treturn 0;\n\t}\n\trc = copy_files(0, current);\n\tif(rc)\n\t\tcurrent->files = files;\n\treturn rc;\n}\n\nEXPORT_SYMBOL(unshare_files);\n\nstatic inline int copy_sighand(unsigned long clone_flags, struct task_struct * tsk)\n{\n\tstruct sighand_struct *sig;\n\n\tif (clone_flags & (CLONE_SIGHAND | CLONE_THREAD)) {\n\t\tatomic_inc(&current->sighand->count);\n\t\treturn 0;\n\t}\n\tsig = kmem_cache_alloc(sighand_cachep, GFP_KERNEL);\n\trcu_assign_pointer(tsk->sighand, sig);\n\tif (!sig)\n\t\treturn -ENOMEM;\n\tatomic_set(&sig->count, 1);\n\tmemcpy(sig->action, current->sighand->action, sizeof(sig->action));\n\treturn 0;\n}\n\nvoid __cleanup_sighand(struct sighand_struct *sighand)\n{\n\tif (atomic_dec_and_test(&sighand->count))\n\t\tkmem_cache_free(sighand_cachep, sighand);\n}\n\nstatic inline int copy_signal(unsigned long clone_flags, struct task_struct * tsk)\n{\n\tstruct signal_struct *sig;\n\tint ret;\n\n\tif (clone_flags & CLONE_THREAD) {\n\t\tatomic_inc(&current->signal->count);\n\t\tatomic_inc(&current->signal->live);\n\t\treturn 0;\n\t}\n\tsig = kmem_cache_alloc(signal_cachep, GFP_KERNEL);\n\ttsk->signal = sig;\n\tif (!sig)\n\t\treturn -ENOMEM;\n\n\tret = copy_thread_group_keys(tsk);\n\tif (ret < 0) {\n\t\tkmem_cache_free(signal_cachep, sig);\n\t\treturn ret;\n\t}\n\n\tatomic_set(&sig->count, 1);\n\tatomic_set(&sig->live, 1);\n\tinit_waitqueue_head(&sig->wait_chldexit);\n\tsig->flags = 0;\n\tsig->group_exit_code = 0;\n\tsig->group_exit_task = NULL;\n\tsig->group_stop_count = 0;\n\tsig->curr_target = NULL;\n\tinit_sigpending(&sig->shared_pending);\n\tINIT_LIST_HEAD(&sig->posix_timers);\n\n\thrtimer_init(&sig->real_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);\n\tsig->it_real_incr.tv64 = 0;\n\tsig->real_timer.function = it_real_fn;\n\tsig->tsk = tsk;\n\n\tsig->it_virt_expires = cputime_zero;\n\tsig->it_virt_incr = cputime_zero;\n\tsig->it_prof_expires = cputime_zero;\n\tsig->it_prof_incr = cputime_zero;\n\n\tsig->leader = 0;\t/* session leadership doesn't inherit */\n\tsig->tty_old_pgrp = NULL;\n\n\tsig->utime = sig->stime = sig->cutime = sig->cstime = cputime_zero;\n\tsig->nvcsw = sig->nivcsw = sig->cnvcsw = sig->cnivcsw = 0;\n\tsig->min_flt = sig->maj_flt = sig->cmin_flt = sig->cmaj_flt = 0;\n\tsig->inblock = sig->oublock = sig->cinblock = sig->coublock = 0;\n\tsig->sched_time = 0;\n\tINIT_LIST_HEAD(&sig->cpu_timers[0]);\n\tINIT_LIST_HEAD(&sig->cpu_timers[1]);\n\tINIT_LIST_HEAD(&sig->cpu_timers[2]);\n\ttaskstats_tgid_init(sig);\n\n\ttask_lock(current->group_leader);\n\tmemcpy(sig->rlim, current->signal->rlim, sizeof sig->rlim);\n\ttask_unlock(current->group_leader);\n\n\tif (sig->rlim[RLIMIT_CPU].rlim_cur != RLIM_INFINITY) {\n\t\t/*\n\t\t * New sole thread in the process gets an expiry time\n\t\t * of the whole CPU time limit.\n\t\t */\n\t\ttsk->it_prof_expires =\n\t\t\tsecs_to_cputime(sig->rlim[RLIMIT_CPU].rlim_cur);\n\t}\n\tacct_init_pacct(&sig->pacct);\n\n\treturn 0;\n}\n\nvoid __cleanup_signal(struct signal_struct *sig)\n{\n\texit_thread_group_keys(sig);\n\tkmem_cache_free(signal_cachep, sig);\n}\n\nstatic inline void cleanup_signal(struct task_struct *tsk)\n{\n\tstruct signal_struct *sig = tsk->signal;\n\n\tatomic_dec(&sig->live);\n\n\tif (atomic_dec_and_test(&sig->count))\n\t\t__cleanup_signal(sig);\n}\n\nstatic inline void copy_flags(unsigned long clone_flags, struct task_struct *p)\n{\n\tunsigned long new_flags = p->flags;\n\n\tnew_flags &= ~(PF_SUPERPRIV | PF_NOFREEZE);\n\tnew_flags |= PF_FORKNOEXEC;\n\tif (!(clone_flags & CLONE_PTRACE))\n\t\tp->ptrace = 0;\n\tp->flags = new_flags;\n}\n\nasmlinkage long sys_set_tid_address(int __user *tidptr)\n{\n\tcurrent->clear_child_tid = tidptr;\n\n\treturn current->pid;\n}\n\nstatic inline void rt_mutex_init_task(struct task_struct *p)\n{\n\tspin_lock_init(&p->pi_lock);\n#ifdef CONFIG_RT_MUTEXES\n\tplist_head_init(&p->pi_waiters, &p->pi_lock);\n\tp->pi_blocked_on = NULL;\n#endif\n}\n\n/*\n * This creates a new process as a copy of the old one,\n * but does not actually start it yet.\n *\n * It copies the registers, and all the appropriate\n * parts of the process environment (as per the clone\n * flags). The actual kick-off is left to the caller.\n */\nstatic struct task_struct *copy_process(unsigned long clone_flags,\n\t\t\t\t\tunsigned long stack_start,\n\t\t\t\t\tstruct pt_regs *regs,\n\t\t\t\t\tunsigned long stack_size,\n\t\t\t\t\tint __user *parent_tidptr,\n\t\t\t\t\tint __user *child_tidptr,\n\t\t\t\t\tstruct pid *pid)\n{\n\tint retval;\n\tstruct task_struct *p = NULL;\n\n\tif ((clone_flags & (CLONE_NEWNS|CLONE_FS)) == (CLONE_NEWNS|CLONE_FS))\n\t\treturn ERR_PTR(-EINVAL);\n\n\t/*\n\t * Thread groups must share signals as well, and detached threads\n\t * can only be started up within the thread group.\n\t */\n\tif ((clone_flags & CLONE_THREAD) && !(clone_flags & CLONE_SIGHAND))\n\t\treturn ERR_PTR(-EINVAL);\n\n\t/*\n\t * Shared signal handlers imply shared VM. By way of the above,\n\t * thread groups also imply shared VM. Blocking this case allows\n\t * for various simplifications in other code.\n\t */\n\tif ((clone_flags & CLONE_SIGHAND) && !(clone_flags & CLONE_VM))\n\t\treturn ERR_PTR(-EINVAL);\n\n\tretval = security_task_create(clone_flags);\n\tif (retval)\n\t\tgoto fork_out;\n\n\tretval = -ENOMEM;\n\tp = dup_task_struct(current);\n\tif (!p)\n\t\tgoto fork_out;\n\n\trt_mutex_init_task(p);\n\n#ifdef CONFIG_TRACE_IRQFLAGS\n\tDEBUG_LOCKS_WARN_ON(!p->hardirqs_enabled);\n\tDEBUG_LOCKS_WARN_ON(!p->softirqs_enabled);\n#endif\n\tretval = -EAGAIN;\n\tif (atomic_read(&p->user->processes) >=\n\t\t\tp->signal->rlim[RLIMIT_NPROC].rlim_cur) {\n\t\tif (!capable(CAP_SYS_ADMIN) && !capable(CAP_SYS_RESOURCE) &&\n\t\t\t\tp->user != &root_user)\n\t\t\tgoto bad_fork_free;\n\t}\n\n\tatomic_inc(&p->user->__count);\n\tatomic_inc(&p->user->processes);\n\tget_group_info(p->group_info);\n\n\t/*\n\t * If multiple threads are within copy_process(), then this check\n\t * triggers too late. This doesn't hurt, the check is only there\n\t * to stop root fork bombs.\n\t */\n\tif (nr_threads >= max_threads)\n\t\tgoto bad_fork_cleanup_count;\n\n\tif (!try_module_get(task_thread_info(p)->exec_domain->module))\n\t\tgoto bad_fork_cleanup_count;\n\n\tif (p->binfmt && !try_module_get(p->binfmt->module))\n\t\tgoto bad_fork_cleanup_put_domain;\n\n\tp->did_exec = 0;\n\tdelayacct_tsk_init(p);\t/* Must remain after dup_task_struct() */\n\tcopy_flags(clone_flags, p);\n\tp->pid = pid_nr(pid);\n\tretval = -EFAULT;\n\tif (clone_flags & CLONE_PARENT_SETTID)\n\t\tif (put_user(p->pid, parent_tidptr))\n\t\t\tgoto bad_fork_cleanup_delays_binfmt;\n\n\tINIT_LIST_HEAD(&p->children);\n\tINIT_LIST_HEAD(&p->sibling);\n\tp->vfork_done = NULL;\n\tspin_lock_init(&p->alloc_lock);\n\n\tclear_tsk_thread_flag(p, TIF_SIGPENDING);\n\tinit_sigpending(&p->pending);\n\n\tp->utime = cputime_zero;\n\tp->stime = cputime_zero;\n \tp->sched_time = 0;\n#ifdef CONFIG_TASK_XACCT\n\tp->rchar = 0;\t\t/* I/O counter: bytes read */\n\tp->wchar = 0;\t\t/* I/O counter: bytes written */\n\tp->syscr = 0;\t\t/* I/O counter: read syscalls */\n\tp->syscw = 0;\t\t/* I/O counter: write syscalls */\n#endif\n\ttask_io_accounting_init(p);\n\tacct_clear_integrals(p);\n\n \tp->it_virt_expires = cputime_zero;\n\tp->it_prof_expires = cputime_zero;\n \tp->it_sched_expires = 0;\n \tINIT_LIST_HEAD(&p->cpu_timers[0]);\n \tINIT_LIST_HEAD(&p->cpu_timers[1]);\n \tINIT_LIST_HEAD(&p->cpu_timers[2]);\n\n\tp->lock_depth = -1;\t\t/* -1 = no lock */\n\tdo_posix_clock_monotonic_gettime(&p->start_time);\n\tp->security = NULL;\n\tp->io_context = NULL;\n\tp->io_wait = NULL;\n\tp->audit_context = NULL;\n\tcpuset_fork(p);\n#ifdef CONFIG_NUMA\n \tp->mempolicy = mpol_copy(p->mempolicy);\n \tif (IS_ERR(p->mempolicy)) {\n \t\tretval = PTR_ERR(p->mempolicy);\n \t\tp->mempolicy = NULL;\n \t\tgoto bad_fork_cleanup_cpuset;\n \t}\n\tmpol_fix_fork_child_flag(p);\n#endif\n#ifdef CONFIG_TRACE_IRQFLAGS\n\tp->irq_events = 0;\n#ifdef __ARCH_WANT_INTERRUPTS_ON_CTXSW\n\tp->hardirqs_enabled = 1;\n#else\n\tp->hardirqs_enabled = 0;\n#endif\n\tp->hardirq_enable_ip = 0;\n\tp->hardirq_enable_event = 0;\n\tp->hardirq_disable_ip = _THIS_IP_;\n\tp->hardirq_disable_event = 0;\n\tp->softirqs_enabled = 1;\n\tp->softirq_enable_ip = _THIS_IP_;\n\tp->softirq_enable_event = 0;\n\tp->softirq_disable_ip = 0;\n\tp->softirq_disable_event = 0;\n\tp->hardirq_context = 0;\n\tp->softirq_context = 0;\n#endif\n#ifdef CONFIG_LOCKDEP\n\tp->lockdep_depth = 0; /* no locks held yet */\n\tp->curr_chain_key = 0;\n\tp->lockdep_recursion = 0;\n#endif\n\n#ifdef CONFIG_DEBUG_MUTEXES\n\tp->blocked_on = NULL; /* not blocked yet */\n#endif\n\n\tp->tgid = p->pid;\n\tif (clone_flags & CLONE_THREAD)\n\t\tp->tgid = current->tgid;\n\n\tif ((retval = security_task_alloc(p)))\n\t\tgoto bad_fork_cleanup_policy;\n\tif ((retval = audit_alloc(p)))\n\t\tgoto bad_fork_cleanup_security;\n\t/* copy all the process information */\n\tif ((retval = copy_semundo(clone_flags, p)))\n\t\tgoto bad_fork_cleanup_audit;\n\tif ((retval = copy_files(clone_flags, p)))\n\t\tgoto bad_fork_cleanup_semundo;\n\tif ((retval = copy_fs(clone_flags, p)))\n\t\tgoto bad_fork_cleanup_files;\n\tif ((retval = copy_sighand(clone_flags, p)))\n\t\tgoto bad_fork_cleanup_fs;\n\tif ((retval = copy_signal(clone_flags, p)))\n\t\tgoto bad_fork_cleanup_sighand;\n\tif ((retval = copy_mm(clone_flags, p)))\n\t\tgoto bad_fork_cleanup_signal;\n\tif ((retval = copy_keys(clone_flags, p)))\n\t\tgoto bad_fork_cleanup_mm;\n\tif ((retval = copy_namespaces(clone_flags, p)))\n\t\tgoto bad_fork_cleanup_keys;\n\tretval = copy_thread(0, clone_flags, stack_start, stack_size, p, regs);\n\tif (retval)\n\t\tgoto bad_fork_cleanup_namespaces;\n\n\tp->set_child_tid = (clone_flags & CLONE_CHILD_SETTID) ? child_tidptr : NULL;\n\t/*\n\t * Clear TID on mm_release()?\n\t */\n\tp->clear_child_tid = (clone_flags & CLONE_CHILD_CLEARTID) ? child_tidptr: NULL;\n\tp->robust_list = NULL;\n#ifdef CONFIG_COMPAT\n\tp->compat_robust_list = NULL;\n#endif\n\tINIT_LIST_HEAD(&p->pi_state_list);\n\tp->pi_state_cache = NULL;\n\n\t/*\n\t * sigaltstack should be cleared when sharing the same VM\n\t */\n\tif ((clone_flags & (CLONE_VM|CLONE_VFORK)) == CLONE_VM)\n\t\tp->sas_ss_sp = p->sas_ss_size = 0;\n\n\t/*\n\t * Syscall tracing should be turned off in the child regardless\n\t * of CLONE_PTRACE.\n\t */\n\tclear_tsk_thread_flag(p, TIF_SYSCALL_TRACE);\n#ifdef TIF_SYSCALL_EMU\n\tclear_tsk_thread_flag(p, TIF_SYSCALL_EMU);\n#endif\n\n\t/* Our parent execution domain becomes current domain\n\t These must match for thread signalling to apply */\n\tp->parent_exec_id = p->self_exec_id;\n\n\t/* ok, now we should be set up.. */\n\tp->exit_signal = (clone_flags & CLONE_THREAD) ? -1 : (clone_flags & CSIGNAL);\n\tp->pdeath_signal = 0;\n\tp->exit_state = 0;\n\n\t/*\n\t * Ok, make it visible to the rest of the system.\n\t * We dont wake it up yet.\n\t */\n\tp->group_leader = p;\n\tINIT_LIST_HEAD(&p->thread_group);\n\tINIT_LIST_HEAD(&p->ptrace_children);\n\tINIT_LIST_HEAD(&p->ptrace_list);\n\n\t/* Perform scheduler related setup. Assign this task to a CPU. */\n\tsched_fork(p, clone_flags);\n\n\t/* Need tasklist lock for parent etc handling! */\n\twrite_lock_irq(&tasklist_lock);\n\n\t/* for sys_ioprio_set(IOPRIO_WHO_PGRP) */\n\tp->ioprio = current->ioprio;\n\n\t/*\n\t * The task hasn't been attached yet, so its cpus_allowed mask will\n\t * not be changed, nor will its assigned CPU.\n\t *\n\t * The cpus_allowed mask of the parent may have changed after it was\n\t * copied first time - so re-copy it here, then check the child's CPU\n\t * to ensure it is on a valid CPU (and if not, just force it back to\n\t * parent's CPU). This avoids alot of nasty races.\n\t */\n\tp->cpus_allowed = current->cpus_allowed;\n\tif (unlikely(!cpu_isset(task_cpu(p), p->cpus_allowed) ||\n\t\t\t!cpu_online(task_cpu(p))))\n\t\tset_task_cpu(p, smp_processor_id());\n\n\t/* CLONE_PARENT re-uses the old parent */\n\tif (clone_flags & (CLONE_PARENT|CLONE_THREAD))\n\t\tp->real_parent = current->real_parent;\n\telse\n\t\tp->real_parent = current;\n\tp->parent = p->real_parent;\n\n\tspin_lock(&current->sighand->siglock);\n\n\t/*\n\t * Process group and session signals need to be delivered to just the\n\t * parent before the fork or both the parent and the child after the\n\t * fork. Restart if a signal comes in before we add the new process to\n\t * it's process group.\n\t * A fatal signal pending means that current will exit, so the new\n\t * thread can't slip out of an OOM kill (or normal SIGKILL).\n \t */\n \trecalc_sigpending();\n\tif (signal_pending(current)) {\n\t\tspin_unlock(&current->sighand->siglock);\n\t\twrite_unlock_irq(&tasklist_lock);\n\t\tretval = -ERESTARTNOINTR;\n\t\tgoto bad_fork_cleanup_namespaces;\n\t}\n\n\tif (clone_flags & CLONE_THREAD) {\n\t\tp->group_leader = current->group_leader;\n\t\tlist_add_tail_rcu(&p->thread_group, &p->group_leader->thread_group);\n\n\t\tif (!cputime_eq(current->signal->it_virt_expires,\n\t\t\t\tcputime_zero) ||\n\t\t !cputime_eq(current->signal->it_prof_expires,\n\t\t\t\tcputime_zero) ||\n\t\t current->signal->rlim[RLIMIT_CPU].rlim_cur != RLIM_INFINITY ||\n\t\t !list_empty(&current->signal->cpu_timers[0]) ||\n\t\t !list_empty(&current->signal->cpu_timers[1]) ||\n\t\t !list_empty(&current->signal->cpu_timers[2])) {\n\t\t\t/*\n\t\t\t * Have child wake up on its first tick to check\n\t\t\t * for process CPU timers.\n\t\t\t */\n\t\t\tp->it_prof_expires = jiffies_to_cputime(1);\n\t\t}\n\t}\n\n\tif (likely(p->pid)) {\n\t\tadd_parent(p);\n\t\tif (unlikely(p->ptrace & PT_PTRACED))\n\t\t\t__ptrace_link(p, current->parent);\n\n\t\tif (thread_group_leader(p)) {\n\t\t\tp->signal->tty = current->signal->tty;\n\t\t\tp->signal->pgrp = process_group(current);\n\t\t\tset_signal_session(p->signal, process_session(current));\n\t\t\tattach_pid(p, PIDTYPE_PGID, task_pgrp(current));\n\t\t\tattach_pid(p, PIDTYPE_SID, task_session(current));\n\n\t\t\tlist_add_tail_rcu(&p->tasks, &init_task.tasks);\n\t\t\t__get_cpu_var(process_counts)++;\n\t\t}\n\t\tattach_pid(p, PIDTYPE_PID, pid);\n\t\tnr_threads++;\n\t}\n\n\ttotal_forks++;\n\tspin_unlock(&current->sighand->siglock);\n\twrite_unlock_irq(&tasklist_lock);\n\tproc_fork_connector(p);\n\treturn p;\n\nbad_fork_cleanup_namespaces:\n\texit_task_namespaces(p);\nbad_fork_cleanup_keys:\n\texit_keys(p);\nbad_fork_cleanup_mm:\n\tif (p->mm)\n\t\tmmput(p->mm);\nbad_fork_cleanup_signal:\n\tcleanup_signal(p);\nbad_fork_cleanup_sighand:\n\t__cleanup_sighand(p->sighand);\nbad_fork_cleanup_fs:\n\texit_fs(p); /* blocking */\nbad_fork_cleanup_files:\n\texit_files(p); /* blocking */\nbad_fork_cleanup_semundo:\n\texit_sem(p);\nbad_fork_cleanup_audit:\n\taudit_free(p);\nbad_fork_cleanup_security:\n\tsecurity_task_free(p);\nbad_fork_cleanup_policy:\n#ifdef CONFIG_NUMA\n\tmpol_free(p->mempolicy);\nbad_fork_cleanup_cpuset:\n#endif\n\tcpuset_exit(p);\nbad_fork_cleanup_delays_binfmt:\n\tdelayacct_tsk_free(p);\n\tif (p->binfmt)\n\t\tmodule_put(p->binfmt->module);\nbad_fork_cleanup_put_domain:\n\tmodule_put(task_thread_info(p)->exec_domain->module);\nbad_fork_cleanup_count:\n\tput_group_info(p->group_info);\n\tatomic_dec(&p->user->processes);\n\tfree_uid(p->user);\nbad_fork_free:\n\tfree_task(p);\nfork_out:\n\treturn ERR_PTR(retval);\n}\n\nnoinline struct pt_regs * __devinit __attribute__((weak)) idle_regs(struct pt_regs *regs)\n{\n\tmemset(regs, 0, sizeof(struct pt_regs));\n\treturn regs;\n}\n\nstruct task_struct * __cpuinit fork_idle(int cpu)\n{\n\tstruct task_struct *task;\n\tstruct pt_regs regs;\n\n\ttask = copy_process(CLONE_VM, 0, idle_regs(&regs), 0, NULL, NULL,\n\t\t\t\t&init_struct_pid);\n\tif (!IS_ERR(task))\n\t\tinit_idle(task, cpu);\n\n\treturn task;\n}\n\nstatic inline int fork_traceflag (unsigned clone_flags)\n{\n\tif (clone_flags & CLONE_UNTRACED)\n\t\treturn 0;\n\telse if (clone_flags & CLONE_VFORK) {\n\t\tif (current->ptrace & PT_TRACE_VFORK)\n\t\t\treturn PTRACE_EVENT_VFORK;\n\t} else if ((clone_flags & CSIGNAL) != SIGCHLD) {\n\t\tif (current->ptrace & PT_TRACE_CLONE)\n\t\t\treturn PTRACE_EVENT_CLONE;\n\t} else if (current->ptrace & PT_TRACE_FORK)\n\t\treturn PTRACE_EVENT_FORK;\n\n\treturn 0;\n}\n\n/*\n * Ok, this is the main fork-routine.\n *\n * It copies the process, and if successful kick-starts\n * it and waits for it to finish using the VM if required.\n */\nlong do_fork(unsigned long clone_flags,\n\t unsigned long stack_start,\n\t struct pt_regs *regs,\n\t unsigned long stack_size,\n\t int __user *parent_tidptr,\n\t int __user *child_tidptr)\n{\n\tstruct task_struct *p;\n\tint trace = 0;\n\tstruct pid *pid = alloc_pid();\n\tlong nr;\n\n\tif (!pid)\n\t\treturn -EAGAIN;\n\tnr = pid->nr;\n\tif (unlikely(current->ptrace)) {\n\t\ttrace = fork_traceflag (clone_flags);\n\t\tif (trace)\n\t\t\tclone_flags |= CLONE_PTRACE;\n\t}\n\n\tp = copy_process(clone_flags, stack_start, regs, stack_size, parent_tidptr, child_tidptr, pid);\n\t/*\n\t * Do this prior waking up the new thread - the thread pointer\n\t * might get invalid after that point, if the thread exits quickly.\n\t */\n\tif (!IS_ERR(p)) {\n\t\tstruct completion vfork;\n\n\t\tif (clone_flags & CLONE_VFORK) {\n\t\t\tp->vfork_done = &vfork;\n\t\t\tinit_completion(&vfork);\n\t\t}\n\n\t\tif ((p->ptrace & PT_PTRACED) || (clone_flags & CLONE_STOPPED)) {\n\t\t\t/*\n\t\t\t * We'll start up with an immediate SIGSTOP.\n\t\t\t */\n\t\t\tsigaddset(&p->pending.signal, SIGSTOP);\n\t\t\tset_tsk_thread_flag(p, TIF_SIGPENDING);\n\t\t}\n\n\t\tif (!(clone_flags & CLONE_STOPPED))\n\t\t\twake_up_new_task(p, clone_flags);\n\t\telse\n\t\t\tp->state = TASK_STOPPED;\n\n\t\tif (unlikely (trace)) {\n\t\t\tcurrent->ptrace_message = nr;\n\t\t\tptrace_notify ((trace << 8) | SIGTRAP);\n\t\t}\n\n\t\tif (clone_flags & CLONE_VFORK) {\n\t\t\tfreezer_do_not_count();\n\t\t\twait_for_completion(&vfork);\n\t\t\tfreezer_count();\n\t\t\tif (unlikely (current->ptrace & PT_TRACE_VFORK_DONE)) {\n\t\t\t\tcurrent->ptrace_message = nr;\n\t\t\t\tptrace_notify ((PTRACE_EVENT_VFORK_DONE << 8) | SIGTRAP);\n\t\t\t}\n\t\t}\n\t} else {\n\t\tfree_pid(pid);\n\t\tnr = PTR_ERR(p);\n\t}\n\treturn nr;\n}\n\n#ifndef ARCH_MIN_MMSTRUCT_ALIGN\n#define ARCH_MIN_MMSTRUCT_ALIGN 0\n#endif\n\nstatic void sighand_ctor(void *data, struct kmem_cache *cachep,\n\t\t\tunsigned long flags)\n{\n\tstruct sighand_struct *sighand = data;\n\n\tspin_lock_init(&sighand->siglock);\n\tINIT_LIST_HEAD(&sighand->signalfd_list);\n}\n\nvoid __init proc_caches_init(void)\n{\n\tsighand_cachep = kmem_cache_create(\"sighand_cache\",\n\t\t\tsizeof(struct sighand_struct), 0,\n\t\t\tSLAB_HWCACHE_ALIGN|SLAB_PANIC|SLAB_DESTROY_BY_RCU,\n\t\t\tsighand_ctor, NULL);\n\tsignal_cachep = kmem_cache_create(\"signal_cache\",\n\t\t\tsizeof(struct signal_struct), 0,\n\t\t\tSLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL);\n\tfiles_cachep = kmem_cache_create(\"files_cache\", \n\t\t\tsizeof(struct files_struct), 0,\n\t\t\tSLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL);\n\tfs_cachep = kmem_cache_create(\"fs_cache\", \n\t\t\tsizeof(struct fs_struct), 0,\n\t\t\tSLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL);\n\tvm_area_cachep = kmem_cache_create(\"vm_area_struct\",\n\t\t\tsizeof(struct vm_area_struct), 0,\n\t\t\tSLAB_PANIC, NULL, NULL);\n\tmm_cachep = kmem_cache_create(\"mm_struct\",\n\t\t\tsizeof(struct mm_struct), ARCH_MIN_MMSTRUCT_ALIGN,\n\t\t\tSLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL);\n}\n\n/*\n * Check constraints on flags passed to the unshare system call and\n * force unsharing of additional process context as appropriate.\n */\nstatic inline void check_unshare_flags(unsigned long *flags_ptr)\n{\n\t/*\n\t * If unsharing a thread from a thread group, must also\n\t * unshare vm.\n\t */\n\tif (*flags_ptr & CLONE_THREAD)\n\t\t*flags_ptr |= CLONE_VM;\n\n\t/*\n\t * If unsharing vm, must also unshare signal handlers.\n\t */\n\tif (*flags_ptr & CLONE_VM)\n\t\t*flags_ptr |= CLONE_SIGHAND;\n\n\t/*\n\t * If unsharing signal handlers and the task was created\n\t * using CLONE_THREAD, then must unshare the thread\n\t */\n\tif ((*flags_ptr & CLONE_SIGHAND) &&\n\t (atomic_read(&current->signal->count) > 1))\n\t\t*flags_ptr |= CLONE_THREAD;\n\n\t/*\n\t * If unsharing namespace, must also unshare filesystem information.\n\t */\n\tif (*flags_ptr & CLONE_NEWNS)\n\t\t*flags_ptr |= CLONE_FS;\n}\n\n/*\n * Unsharing of tasks created with CLONE_THREAD is not supported yet\n */\nstatic int unshare_thread(unsigned long unshare_flags)\n{\n\tif (unshare_flags & CLONE_THREAD)\n\t\treturn -EINVAL;\n\n\treturn 0;\n}\n\n/*\n * Unshare the filesystem structure if it is being shared\n */\nstatic int unshare_fs(unsigned long unshare_flags, struct fs_struct **new_fsp)\n{\n\tstruct fs_struct *fs = current->fs;\n\n\tif ((unshare_flags & CLONE_FS) &&\n\t (fs && atomic_read(&fs->count) > 1)) {\n\t\t*new_fsp = __copy_fs_struct(current->fs);\n\t\tif (!*new_fsp)\n\t\t\treturn -ENOMEM;\n\t}\n\n\treturn 0;\n}\n\n/*\n * Unsharing of sighand is not supported yet\n */\nstatic int unshare_sighand(unsigned long unshare_flags, struct sighand_struct **new_sighp)\n{\n\tstruct sighand_struct *sigh = current->sighand;\n\n\tif ((unshare_flags & CLONE_SIGHAND) && atomic_read(&sigh->count) > 1)\n\t\treturn -EINVAL;\n\telse\n\t\treturn 0;\n}\n\n/*\n * Unshare vm if it is being shared\n */\nstatic int unshare_vm(unsigned long unshare_flags, struct mm_struct **new_mmp)\n{\n\tstruct mm_struct *mm = current->mm;\n\n\tif ((unshare_flags & CLONE_VM) &&\n\t (mm && atomic_read(&mm->mm_users) > 1)) {\n\t\treturn -EINVAL;\n\t}\n\n\treturn 0;\n}\n\n/*\n * Unshare file descriptor table if it is being shared\n */\nstatic int unshare_fd(unsigned long unshare_flags, struct files_struct **new_fdp)\n{\n\tstruct files_struct *fd = current->files;\n\tint error = 0;\n\n\tif ((unshare_flags & CLONE_FILES) &&\n\t (fd && atomic_read(&fd->count) > 1)) {\n\t\t*new_fdp = dup_fd(fd, &error);\n\t\tif (!*new_fdp)\n\t\t\treturn error;\n\t}\n\n\treturn 0;\n}\n\n/*\n * Unsharing of semundo for tasks created with CLONE_SYSVSEM is not\n * supported yet\n */\nstatic int unshare_semundo(unsigned long unshare_flags, struct sem_undo_list **new_ulistp)\n{\n\tif (unshare_flags & CLONE_SYSVSEM)\n\t\treturn -EINVAL;\n\n\treturn 0;\n}\n\n/*\n * unshare allows a process to 'unshare' part of the process\n * context which was originally shared using clone. copy_*\n * functions used by do_fork() cannot be used here directly\n * because they modify an inactive task_struct that is being\n * constructed. Here we are modifying the current, active,\n * task_struct.\n */\nasmlinkage long sys_unshare(unsigned long unshare_flags)\n{\n\tint err = 0;\n\tstruct fs_struct *fs, *new_fs = NULL;\n\tstruct sighand_struct *new_sigh = NULL;\n\tstruct mm_struct *mm, *new_mm = NULL, *active_mm = NULL;\n\tstruct files_struct *fd, *new_fd = NULL;\n\tstruct sem_undo_list *new_ulist = NULL;\n\tstruct nsproxy *new_nsproxy = NULL, *old_nsproxy = NULL;\n\n\tcheck_unshare_flags(&unshare_flags);\n\n\t/* Return -EINVAL for all unsupported flags */\n\terr = -EINVAL;\n\tif (unshare_flags & ~(CLONE_THREAD|CLONE_FS|CLONE_NEWNS|CLONE_SIGHAND|\n\t\t\t\tCLONE_VM|CLONE_FILES|CLONE_SYSVSEM|\n\t\t\t\tCLONE_NEWUTS|CLONE_NEWIPC))\n\t\tgoto bad_unshare_out;\n\n\tif ((err = unshare_thread(unshare_flags)))\n\t\tgoto bad_unshare_out;\n\tif ((err = unshare_fs(unshare_flags, &new_fs)))\n\t\tgoto bad_unshare_cleanup_thread;\n\tif ((err = unshare_sighand(unshare_flags, &new_sigh)))\n\t\tgoto bad_unshare_cleanup_fs;\n\tif ((err = unshare_vm(unshare_flags, &new_mm)))\n\t\tgoto bad_unshare_cleanup_sigh;\n\tif ((err = unshare_fd(unshare_flags, &new_fd)))\n\t\tgoto bad_unshare_cleanup_vm;\n\tif ((err = unshare_semundo(unshare_flags, &new_ulist)))\n\t\tgoto bad_unshare_cleanup_fd;\n\tif ((err = unshare_nsproxy_namespaces(unshare_flags, &new_nsproxy,\n\t\t\tnew_fs)))\n\t\tgoto bad_unshare_cleanup_semundo;\n\n\tif (new_fs || new_mm || new_fd || new_ulist || new_nsproxy) {\n\n\t\ttask_lock(current);\n\n\t\tif (new_nsproxy) {\n\t\t\told_nsproxy = current->nsproxy;\n\t\t\tcurrent->nsproxy = new_nsproxy;\n\t\t\tnew_nsproxy = old_nsproxy;\n\t\t}\n\n\t\tif (new_fs) {\n\t\t\tfs = current->fs;\n\t\t\tcurrent->fs = new_fs;\n\t\t\tnew_fs = fs;\n\t\t}\n\n\t\tif (new_mm) {\n\t\t\tmm = current->mm;\n\t\t\tactive_mm = current->active_mm;\n\t\t\tcurrent->mm = new_mm;\n\t\t\tcurrent->active_mm = new_mm;\n\t\t\tactivate_mm(active_mm, new_mm);\n\t\t\tnew_mm = mm;\n\t\t}\n\n\t\tif (new_fd) {\n\t\t\tfd = current->files;\n\t\t\tcurrent->files = new_fd;\n\t\t\tnew_fd = fd;\n\t\t}\n\n\t\ttask_unlock(current);\n\t}\n\n\tif (new_nsproxy)\n\t\tput_nsproxy(new_nsproxy);\n\nbad_unshare_cleanup_semundo:\nbad_unshare_cleanup_fd:\n\tif (new_fd)\n\t\tput_files_struct(new_fd);\n\nbad_unshare_cleanup_vm:\n\tif (new_mm)\n\t\tmmput(new_mm);\n\nbad_unshare_cleanup_sigh:\n\tif (new_sigh)\n\t\tif (atomic_dec_and_test(&new_sigh->count))\n\t\t\tkmem_cache_free(sighand_cachep, new_sigh);\n\nbad_unshare_cleanup_fs:\n\tif (new_fs)\n\t\tput_fs_struct(new_fs);\n\nbad_unshare_cleanup_thread:\nbad_unshare_out:\n\treturn err;\n}\n/*\n * Fast Userspace Mutexes (which I call \"Futexes!\").\n * (C) Rusty Russell, IBM 2002\n *\n * Generalized futexes, futex requeueing, misc fixes by Ingo Molnar\n * (C) Copyright 2003 Red Hat Inc, All Rights Reserved\n *\n * Removed page pinning, fix privately mapped COW pages and other cleanups\n * (C) Copyright 2003, 2004 Jamie Lokier\n *\n * Robust futex support started by Ingo Molnar\n * (C) Copyright 2006 Red Hat Inc, All Rights Reserved\n * Thanks to Thomas Gleixner for suggestions, analysis and fixes.\n *\n * PI-futex support started by Ingo Molnar and Thomas Gleixner\n * Copyright (C) 2006 Red Hat, Inc., Ingo Molnar <mingo@redhat.com>\n * Copyright (C) 2006 Timesys Corp., Thomas Gleixner <tglx@timesys.com>\n *\n * PRIVATE futexes by Eric Dumazet\n * Copyright (C) 2007 Eric Dumazet <dada1@cosmosbay.com>\n *\n * Thanks to Ben LaHaise for yelling \"hashed waitqueues\" loudly\n * enough at me, Linus for the original (flawed) idea, Matthew\n * Kirkwood for proof-of-concept implementation.\n *\n * \"The futexes are also cursed.\"\n * \"But they come in a choice of three flavours!\"\n *\n * This program is free software; you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation; either version 2 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program; if not, write to the Free Software\n * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n */\n#include <linux/slab.h>\n#include <linux/poll.h>\n#include <linux/fs.h>\n#include <linux/file.h>\n#include <linux/jhash.h>\n#include <linux/init.h>\n#include <linux/futex.h>\n#include <linux/mount.h>\n#include <linux/pagemap.h>\n#include <linux/syscalls.h>\n#include <linux/signal.h>\n#include <linux/module.h>\n#include <asm/futex.h>\n\n#include \"rtmutex_common.h\"\n\n#define FUTEX_HASHBITS (CONFIG_BASE_SMALL ? 4 : 8)\n\n/*\n * Priority Inheritance state:\n */\nstruct futex_pi_state {\n\t/*\n\t * list of 'owned' pi_state instances - these have to be\n\t * cleaned up in do_exit() if the task exits prematurely:\n\t */\n\tstruct list_head list;\n\n\t/*\n\t * The PI object:\n\t */\n\tstruct rt_mutex pi_mutex;\n\n\tstruct task_struct *owner;\n\tatomic_t refcount;\n\n\tunion futex_key key;\n};\n\n/*\n * We use this hashed waitqueue instead of a normal wait_queue_t, so\n * we can wake only the relevant ones (hashed queues may be shared).\n *\n * A futex_q has a woken state, just like tasks have TASK_RUNNING.\n * It is considered woken when plist_node_empty(&q->list) || q->lock_ptr == 0.\n * The order of wakup is always to make the first condition true, then\n * wake up q->waiters, then make the second condition true.\n */\nstruct futex_q {\n\tstruct plist_node list;\n\twait_queue_head_t waiters;\n\n\t/* Which hash list lock to use: */\n\tspinlock_t *lock_ptr;\n\n\t/* Key which the futex is hashed on: */\n\tunion futex_key key;\n\n\t/* For fd, sigio sent using these: */\n\tint fd;\n\tstruct file *filp;\n\n\t/* Optional priority inheritance state: */\n\tstruct futex_pi_state *pi_state;\n\tstruct task_struct *task;\n};\n\n/*\n * Split the global futex_lock into every hash list lock.\n */\nstruct futex_hash_bucket {\n\tspinlock_t lock;\n\tstruct plist_head chain;\n};\n\nstatic struct futex_hash_bucket futex_queues[1<<FUTEX_HASHBITS];\n\n/* Futex-fs vfsmount entry: */\nstatic struct vfsmount *futex_mnt;\n\n/*\n * We hash on the keys returned from get_futex_key (see below).\n */\nstatic struct futex_hash_bucket *hash_futex(union futex_key *key)\n{\n\tu32 hash = jhash2((u32*)&key->both.word,\n\t\t\t (sizeof(key->both.word)+sizeof(key->both.ptr))/4,\n\t\t\t key->both.offset);\n\treturn &futex_queues[hash & ((1 << FUTEX_HASHBITS)-1)];\n}\n\n/*\n * Return 1 if two futex_keys are equal, 0 otherwise.\n */\nstatic inline int match_futex(union futex_key *key1, union futex_key *key2)\n{\n\treturn (key1->both.word == key2->both.word\n\t\t&& key1->both.ptr == key2->both.ptr\n\t\t&& key1->both.offset == key2->both.offset);\n}\n\n/**\n * get_futex_key - Get parameters which are the keys for a futex.\n * @uaddr: virtual address of the futex\n * @shared: NULL for a PROCESS_PRIVATE futex,\n *\t&current->mm->mmap_sem for a PROCESS_SHARED futex\n * @key: address where result is stored.\n *\n * Returns a negative error code or 0\n * The key words are stored in *key on success.\n *\n * For shared mappings, it's (page->index, vma->vm_file->f_path.dentry->d_inode,\n * offset_within_page). For private mappings, it's (uaddr, current->mm).\n * We can usually work out the index without swapping in the page.\n *\n * fshared is NULL for PROCESS_PRIVATE futexes\n * For other futexes, it points to &current->mm->mmap_sem and\n * caller must have taken the reader lock. but NOT any spinlocks.\n */\nint get_futex_key(u32 __user *uaddr, struct rw_semaphore *fshared,\n\t\t union futex_key *key)\n{\n\tunsigned long address = (unsigned long)uaddr;\n\tstruct mm_struct *mm = current->mm;\n\tstruct vm_area_struct *vma;\n\tstruct page *page;\n\tint err;\n\n\t/*\n\t * The futex address must be \"naturally\" aligned.\n\t */\n\tkey->both.offset = address % PAGE_SIZE;\n\tif (unlikely((address % sizeof(u32)) != 0))\n\t\treturn -EINVAL;\n\taddress -= key->both.offset;\n\n\t/*\n\t * PROCESS_PRIVATE futexes are fast.\n\t * As the mm cannot disappear under us and the 'key' only needs\n\t * virtual address, we dont even have to find the underlying vma.\n\t * Note : We do have to check 'uaddr' is a valid user address,\n\t * but access_ok() should be faster than find_vma()\n\t */\n\tif (!fshared) {\n\t\tif (unlikely(!access_ok(VERIFY_WRITE, uaddr, sizeof(u32))))\n\t\t\treturn -EFAULT;\n\t\tkey->private.mm = mm;\n\t\tkey->private.address = address;\n\t\treturn 0;\n\t}\n\t/*\n\t * The futex is hashed differently depending on whether\n\t * it's in a shared or private mapping. So check vma first.\n\t */\n\tvma = find_extend_vma(mm, address);\n\tif (unlikely(!vma))\n\t\treturn -EFAULT;\n\n\t/*\n\t * Permissions.\n\t */\n\tif (unlikely((vma->vm_flags & (VM_IO|VM_READ)) != VM_READ))\n\t\treturn (vma->vm_flags & VM_IO) ? -EPERM : -EACCES;\n\n\t/*\n\t * Private mappings are handled in a simple way.\n\t *\n\t * NOTE: When userspace waits on a MAP_SHARED mapping, even if\n\t * it's a read-only handle, it's expected that futexes attach to\n\t * the object not the particular process. Therefore we use\n\t * VM_MAYSHARE here, not VM_SHARED which is restricted to shared\n\t * mappings of _writable_ handles.\n\t */\n\tif (likely(!(vma->vm_flags & VM_MAYSHARE))) {\n\t\tkey->both.offset |= FUT_OFF_MMSHARED; /* reference taken on mm */\n\t\tkey->private.mm = mm;\n\t\tkey->private.address = address;\n\t\treturn 0;\n\t}\n\n\t/*\n\t * Linear file mappings are also simple.\n\t */\n\tkey->shared.inode = vma->vm_file->f_path.dentry->d_inode;\n\tkey->both.offset |= FUT_OFF_INODE; /* inode-based key. */\n\tif (likely(!(vma->vm_flags & VM_NONLINEAR))) {\n\t\tkey->shared.pgoff = (((address - vma->vm_start) >> PAGE_SHIFT)\n\t\t\t\t + vma->vm_pgoff);\n\t\treturn 0;\n\t}\n\n\t/*\n\t * We could walk the page table to read the non-linear\n\t * pte, and get the page index without fetching the page\n\t * from swap. But that's a lot of code to duplicate here\n\t * for a rare case, so we simply fetch the page.\n\t */\n\terr = get_user_pages(current, mm, address, 1, 0, 0, &page, NULL);\n\tif (err >= 0) {\n\t\tkey->shared.pgoff =\n\t\t\tpage->index << (PAGE_CACHE_SHIFT - PAGE_SHIFT);\n\t\tput_page(page);\n\t\treturn 0;\n\t}\n\treturn err;\n}\nEXPORT_SYMBOL_GPL(get_futex_key);\n\n/*\n * Take a reference to the resource addressed by a key.\n * Can be called while holding spinlocks.\n *\n */\ninline void get_futex_key_refs(union futex_key *key)\n{\n\tif (key->both.ptr == 0)\n\t\treturn;\n\tswitch (key->both.offset & (FUT_OFF_INODE|FUT_OFF_MMSHARED)) {\n\t\tcase FUT_OFF_INODE:\n\t\t\tatomic_inc(&key->shared.inode->i_count);\n\t\t\tbreak;\n\t\tcase FUT_OFF_MMSHARED:\n\t\t\tatomic_inc(&key->private.mm->mm_count);\n\t\t\tbreak;\n\t}\n}\nEXPORT_SYMBOL_GPL(get_futex_key_refs);\n\n/*\n * Drop a reference to the resource addressed by a key.\n * The hash bucket spinlock must not be held.\n */\nvoid drop_futex_key_refs(union futex_key *key)\n{\n\tif (key->both.ptr == 0)\n\t\treturn;\n\tswitch (key->both.offset & (FUT_OFF_INODE|FUT_OFF_MMSHARED)) {\n\t\tcase FUT_OFF_INODE:\n\t\t\tiput(key->shared.inode);\n\t\t\tbreak;\n\t\tcase FUT_OFF_MMSHARED:\n\t\t\tmmdrop(key->private.mm);\n\t\t\tbreak;\n\t}\n}\nEXPORT_SYMBOL_GPL(drop_futex_key_refs);\n\nstatic inline int get_futex_value_locked(u32 *dest, u32 __user *from)\n{\n\tint ret;\n\n\tpagefault_disable();\n\tret = __copy_from_user_inatomic(dest, from, sizeof(u32));\n\tpagefault_enable();\n\n\treturn ret ? -EFAULT : 0;\n}\n\n/*\n * Fault handling.\n * if fshared is non NULL, current->mm->mmap_sem is already held\n */\nstatic int futex_handle_fault(unsigned long address,\n\t\t\t struct rw_semaphore *fshared, int attempt)\n{\n\tstruct vm_area_struct * vma;\n\tstruct mm_struct *mm = current->mm;\n\tint ret = -EFAULT;\n\n\tif (attempt > 2)\n\t\treturn ret;\n\n\tif (!fshared)\n\t\tdown_read(&mm->mmap_sem);\n\tvma = find_vma(mm, address);\n\tif (vma && address >= vma->vm_start &&\n\t (vma->vm_flags & VM_WRITE)) {\n\t\tswitch (handle_mm_fault(mm, vma, address, 1)) {\n\t\tcase VM_FAULT_MINOR:\n\t\t\tret = 0;\n\t\t\tcurrent->min_flt++;\n\t\t\tbreak;\n\t\tcase VM_FAULT_MAJOR:\n\t\t\tret = 0;\n\t\t\tcurrent->maj_flt++;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (!fshared)\n\t\tup_read(&mm->mmap_sem);\n\treturn ret;\n}\n\n/*\n * PI code:\n */\nstatic int refill_pi_state_cache(void)\n{\n\tstruct futex_pi_state *pi_state;\n\n\tif (likely(current->pi_state_cache))\n\t\treturn 0;\n\n\tpi_state = kzalloc(sizeof(*pi_state), GFP_KERNEL);\n\n\tif (!pi_state)\n\t\treturn -ENOMEM;\n\n\tINIT_LIST_HEAD(&pi_state->list);\n\t/* pi_mutex gets initialized later */\n\tpi_state->owner = NULL;\n\tatomic_set(&pi_state->refcount, 1);\n\n\tcurrent->pi_state_cache = pi_state;\n\n\treturn 0;\n}\n\nstatic struct futex_pi_state * alloc_pi_state(void)\n{\n\tstruct futex_pi_state *pi_state = current->pi_state_cache;\n\n\tWARN_ON(!pi_state);\n\tcurrent->pi_state_cache = NULL;\n\n\treturn pi_state;\n}\n\nstatic void free_pi_state(struct futex_pi_state *pi_state)\n{\n\tif (!atomic_dec_and_test(&pi_state->refcount))\n\t\treturn;\n\n\t/*\n\t * If pi_state->owner is NULL, the owner is most probably dying\n\t * and has cleaned up the pi_state already\n\t */\n\tif (pi_state->owner) {\n\t\tspin_lock_irq(&pi_state->owner->pi_lock);\n\t\tlist_del_init(&pi_state->list);\n\t\tspin_unlock_irq(&pi_state->owner->pi_lock);\n\n\t\trt_mutex_proxy_unlock(&pi_state->pi_mutex, pi_state->owner);\n\t}\n\n\tif (current->pi_state_cache)\n\t\tkfree(pi_state);\n\telse {\n\t\t/*\n\t\t * pi_state->list is already empty.\n\t\t * clear pi_state->owner.\n\t\t * refcount is at 0 - put it back to 1.\n\t\t */\n\t\tpi_state->owner = NULL;\n\t\tatomic_set(&pi_state->refcount, 1);\n\t\tcurrent->pi_state_cache = pi_state;\n\t}\n}\n\n/*\n * Look up the task based on what TID userspace gave us.\n * We dont trust it.\n */\nstatic struct task_struct * futex_find_get_task(pid_t pid)\n{\n\tstruct task_struct *p;\n\n\trcu_read_lock();\n\tp = find_task_by_pid(pid);\n\n\tif (!p || ((current->euid != p->euid) && (current->euid != p->uid)))\n\t\tp = ERR_PTR(-ESRCH);\n\telse\n\t\tget_task_struct(p);\n\n\trcu_read_unlock();\n\n\treturn p;\n}\n\n/*\n * This task is holding PI mutexes at exit time => bad.\n * Kernel cleans up PI-state, but userspace is likely hosed.\n * (Robust-futex cleanup is separate and might save the day for userspace.)\n */\nvoid exit_pi_state_list(struct task_struct *curr)\n{\n\tstruct list_head *next, *head = &curr->pi_state_list;\n\tstruct futex_pi_state *pi_state;\n\tstruct futex_hash_bucket *hb;\n\tunion futex_key key;\n\n\t/*\n\t * We are a ZOMBIE and nobody can enqueue itself on\n\t * pi_state_list anymore, but we have to be careful\n\t * versus waiters unqueueing themselves:\n\t */\n\tspin_lock_irq(&curr->pi_lock);\n\twhile (!list_empty(head)) {\n\n\t\tnext = head->next;\n\t\tpi_state = list_entry(next, struct futex_pi_state, list);\n\t\tkey = pi_state->key;\n\t\thb = hash_futex(&key);\n\t\tspin_unlock_irq(&curr->pi_lock);\n\n\t\tspin_lock(&hb->lock);\n\n\t\tspin_lock_irq(&curr->pi_lock);\n\t\t/*\n\t\t * We dropped the pi-lock, so re-check whether this\n\t\t * task still owns the PI-state:\n\t\t */\n\t\tif (head->next != next) {\n\t\t\tspin_unlock(&hb->lock);\n\t\t\tcontinue;\n\t\t}\n\n\t\tWARN_ON(pi_state->owner != curr);\n\t\tWARN_ON(list_empty(&pi_state->list));\n\t\tlist_del_init(&pi_state->list);\n\t\tpi_state->owner = NULL;\n\t\tspin_unlock_irq(&curr->pi_lock);\n\n\t\trt_mutex_unlock(&pi_state->pi_mutex);\n\n\t\tspin_unlock(&hb->lock);\n\n\t\tspin_lock_irq(&curr->pi_lock);\n\t}\n\tspin_unlock_irq(&curr->pi_lock);\n}\n\nstatic int\nlookup_pi_state(u32 uval, struct futex_hash_bucket *hb,\n\t\tunion futex_key *key, struct futex_pi_state **ps)\n{\n\tstruct futex_pi_state *pi_state = NULL;\n\tstruct futex_q *this, *next;\n\tstruct plist_head *head;\n\tstruct task_struct *p;\n\tpid_t pid = uval & FUTEX_TID_MASK;\n\n\thead = &hb->chain;\n\n\tplist_for_each_entry_safe(this, next, head, list) {\n\t\tif (match_futex(&this->key, key)) {\n\t\t\t/*\n\t\t\t * Another waiter already exists - bump up\n\t\t\t * the refcount and return its pi_state:\n\t\t\t */\n\t\t\tpi_state = this->pi_state;\n\t\t\t/*\n\t\t\t * Userspace might have messed up non PI and PI futexes\n\t\t\t */\n\t\t\tif (unlikely(!pi_state))\n\t\t\t\treturn -EINVAL;\n\n\t\t\tWARN_ON(!atomic_read(&pi_state->refcount));\n\t\t\tWARN_ON(pid && pi_state->owner &&\n\t\t\t\tpi_state->owner->pid != pid);\n\n\t\t\tatomic_inc(&pi_state->refcount);\n\t\t\t*ps = pi_state;\n\n\t\t\treturn 0;\n\t\t}\n\t}\n\n\t/*\n\t * We are the first waiter - try to look up the real owner and attach\n\t * the new pi_state to it, but bail out when TID = 0\n\t */\n\tif (!pid)\n\t\treturn -ESRCH;\n\tp = futex_find_get_task(pid);\n\tif (IS_ERR(p))\n\t\treturn PTR_ERR(p);\n\n\t/*\n\t * We need to look at the task state flags to figure out,\n\t * whether the task is exiting. To protect against the do_exit\n\t * change of the task flags, we do this protected by\n\t * p->pi_lock:\n\t */\n\tspin_lock_irq(&p->pi_lock);\n\tif (unlikely(p->flags & PF_EXITING)) {\n\t\t/*\n\t\t * The task is on the way out. When PF_EXITPIDONE is\n\t\t * set, we know that the task has finished the\n\t\t * cleanup:\n\t\t */\n\t\tint ret = (p->flags & PF_EXITPIDONE) ? -ESRCH : -EAGAIN;\n\n\t\tspin_unlock_irq(&p->pi_lock);\n\t\tput_task_struct(p);\n\t\treturn ret;\n\t}\n\n\tpi_state = alloc_pi_state();\n\n\t/*\n\t * Initialize the pi_mutex in locked state and make 'p'\n\t * the owner of it:\n\t */\n\trt_mutex_init_proxy_locked(&pi_state->pi_mutex, p);\n\n\t/* Store the key for possible exit cleanups: */\n\tpi_state->key = *key;\n\n\tWARN_ON(!list_empty(&pi_state->list));\n\tlist_add(&pi_state->list, &p->pi_state_list);\n\tpi_state->owner = p;\n\tspin_unlock_irq(&p->pi_lock);\n\n\tput_task_struct(p);\n\n\t*ps = pi_state;\n\n\treturn 0;\n}\n\n/*\n * The hash bucket lock must be held when this is called.\n * Afterwards, the futex_q must not be accessed.\n */\nstatic void wake_futex(struct futex_q *q)\n{\n\tplist_del(&q->list, &q->list.plist);\n\tif (q->filp)\n\t\tsend_sigio(&q->filp->f_owner, q->fd, POLL_IN);\n\t/*\n\t * The lock in wake_up_all() is a crucial memory barrier after the\n\t * plist_del() and also before assigning to q->lock_ptr.\n\t */\n\twake_up_all(&q->waiters);\n\t/*\n\t * The waiting task can free the futex_q as soon as this is written,\n\t * without taking any locks. This must come last.\n\t *\n\t * A memory barrier is required here to prevent the following store\n\t * to lock_ptr from getting ahead of the wakeup. Clearing the lock\n\t * at the end of wake_up_all() does not prevent this store from\n\t * moving.\n\t */\n\tsmp_wmb();\n\tq->lock_ptr = NULL;\n}\n\nstatic int wake_futex_pi(u32 __user *uaddr, u32 uval, struct futex_q *this)\n{\n\tstruct task_struct *new_owner;\n\tstruct futex_pi_state *pi_state = this->pi_state;\n\tu32 curval, newval;\n\n\tif (!pi_state)\n\t\treturn -EINVAL;\n\n\tspin_lock(&pi_state->pi_mutex.wait_lock);\n\tnew_owner = rt_mutex_next_owner(&pi_state->pi_mutex);\n\n\t/*\n\t * This happens when we have stolen the lock and the original\n\t * pending owner did not enqueue itself back on the rt_mutex.\n\t * Thats not a tragedy. We know that way, that a lock waiter\n\t * is on the fly. We make the futex_q waiter the pending owner.\n\t */\n\tif (!new_owner)\n\t\tnew_owner = this->task;\n\n\t/*\n\t * We pass it to the next owner. (The WAITERS bit is always\n\t * kept enabled while there is PI state around. We must also\n\t * preserve the owner died bit.)\n\t */\n\tif (!(uval & FUTEX_OWNER_DIED)) {\n\t\tint ret = 0;\n\n\t\tnewval = FUTEX_WAITERS | new_owner->pid;\n\n\t\tpagefault_disable();\n\t\tcurval = futex_atomic_cmpxchg_inatomic(uaddr, uval, newval);\n\t\tpagefault_enable();\n\n\t\tif (curval == -EFAULT)\n\t\t\tret = -EFAULT;\n\t\tif (curval != uval)\n\t\t\tret = -EINVAL;\n\t\tif (ret) {\n\t\t\tspin_unlock(&pi_state->pi_mutex.wait_lock);\n\t\t\treturn ret;\n\t\t}\n\t}\n\n\tspin_lock_irq(&pi_state->owner->pi_lock);\n\tWARN_ON(list_empty(&pi_state->list));\n\tlist_del_init(&pi_state->list);\n\tspin_unlock_irq(&pi_state->owner->pi_lock);\n\n\tspin_lock_irq(&new_owner->pi_lock);\n\tWARN_ON(!list_empty(&pi_state->list));\n\tlist_add(&pi_state->list, &new_owner->pi_state_list);\n\tpi_state->owner = new_owner;\n\tspin_unlock_irq(&new_owner->pi_lock);\n\n\tspin_unlock(&pi_state->pi_mutex.wait_lock);\n\trt_mutex_unlock(&pi_state->pi_mutex);\n\n\treturn 0;\n}\n\nstatic int unlock_futex_pi(u32 __user *uaddr, u32 uval)\n{\n\tu32 oldval;\n\n\t/*\n\t * There is no waiter, so we unlock the futex. The owner died\n\t * bit has not to be preserved here. We are the owner:\n\t */\n\tpagefault_disable();\n\toldval = futex_atomic_cmpxchg_inatomic(uaddr, uval, 0);\n\tpagefault_enable();\n\n\tif (oldval == -EFAULT)\n\t\treturn oldval;\n\tif (oldval != uval)\n\t\treturn -EAGAIN;\n\n\treturn 0;\n}\n\n/*\n * Express the locking dependencies for lockdep:\n */\nstatic inline void\ndouble_lock_hb(struct futex_hash_bucket *hb1, struct futex_hash_bucket *hb2)\n{\n\tif (hb1 <= hb2) {\n\t\tspin_lock(&hb1->lock);\n\t\tif (hb1 < hb2)\n\t\t\tspin_lock_nested(&hb2->lock, SINGLE_DEPTH_NESTING);\n\t} else { /* hb1 > hb2 */\n\t\tspin_lock(&hb2->lock);\n\t\tspin_lock_nested(&hb1->lock, SINGLE_DEPTH_NESTING);\n\t}\n}\n\n/*\n * Wake up all waiters hashed on the physical page that is mapped\n * to this virtual address:\n */\nstatic int futex_wake(u32 __user *uaddr, struct rw_semaphore *fshared,\n\t\t int nr_wake)\n{\n\tstruct futex_hash_bucket *hb;\n\tstruct futex_q *this, *next;\n\tstruct plist_head *head;\n\tunion futex_key key;\n\tint ret;\n\n\tif (fshared)\n\t\tdown_read(fshared);\n\n\tret = get_futex_key(uaddr, fshared, &key);\n\tif (unlikely(ret != 0))\n\t\tgoto out;\n\n\thb = hash_futex(&key);\n\tspin_lock(&hb->lock);\n\thead = &hb->chain;\n\n\tplist_for_each_entry_safe(this, next, head, list) {\n\t\tif (match_futex (&this->key, &key)) {\n\t\t\tif (this->pi_state) {\n\t\t\t\tret = -EINVAL;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\twake_futex(this);\n\t\t\tif (++ret >= nr_wake)\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tspin_unlock(&hb->lock);\nout:\n\tif (fshared)\n\t\tup_read(fshared);\n\treturn ret;\n}\n\n/*\n * Wake up all waiters hashed on the physical page that is mapped\n * to this virtual address:\n */\nstatic int\nfutex_wake_op(u32 __user *uaddr1, struct rw_semaphore *fshared,\n\t u32 __user *uaddr2,\n\t int nr_wake, int nr_wake2, int op)\n{\n\tunion futex_key key1, key2;\n\tstruct futex_hash_bucket *hb1, *hb2;\n\tstruct plist_head *head;\n\tstruct futex_q *this, *next;\n\tint ret, op_ret, attempt = 0;\n\nretryfull:\n\tif (fshared)\n\t\tdown_read(fshared);\n\n\tret = get_futex_key(uaddr1, fshared, &key1);\n\tif (unlikely(ret != 0))\n\t\tgoto out;\n\tret = get_futex_key(uaddr2, fshared, &key2);\n\tif (unlikely(ret != 0))\n\t\tgoto out;\n\n\thb1 = hash_futex(&key1);\n\thb2 = hash_futex(&key2);\n\nretry:\n\tdouble_lock_hb(hb1, hb2);\n\n\top_ret = futex_atomic_op_inuser(op, uaddr2);\n\tif (unlikely(op_ret < 0)) {\n\t\tu32 dummy;\n\n\t\tspin_unlock(&hb1->lock);\n\t\tif (hb1 != hb2)\n\t\t\tspin_unlock(&hb2->lock);\n\n#ifndef CONFIG_MMU\n\t\t/*\n\t\t * we don't get EFAULT from MMU faults if we don't have an MMU,\n\t\t * but we might get them from range checking\n\t\t */\n\t\tret = op_ret;\n\t\tgoto out;\n#endif\n\n\t\tif (unlikely(op_ret != -EFAULT)) {\n\t\t\tret = op_ret;\n\t\t\tgoto out;\n\t\t}\n\n\t\t/*\n\t\t * futex_atomic_op_inuser needs to both read and write\n\t\t * *(int __user *)uaddr2, but we can't modify it\n\t\t * non-atomically. Therefore, if get_user below is not\n\t\t * enough, we need to handle the fault ourselves, while\n\t\t * still holding the mmap_sem.\n\t\t */\n\t\tif (attempt++) {\n\t\t\tret = futex_handle_fault((unsigned long)uaddr2,\n\t\t\t\t\t\tfshared, attempt);\n\t\t\tif (ret)\n\t\t\t\tgoto out;\n\t\t\tgoto retry;\n\t\t}\n\n\t\t/*\n\t\t * If we would have faulted, release mmap_sem,\n\t\t * fault it in and start all over again.\n\t\t */\n\t\tif (fshared)\n\t\t\tup_read(fshared);\n\n\t\tret = get_user(dummy, uaddr2);\n\t\tif (ret)\n\t\t\treturn ret;\n\n\t\tgoto retryfull;\n\t}\n\n\thead = &hb1->chain;\n\n\tplist_for_each_entry_safe(this, next, head, list) {\n\t\tif (match_futex (&this->key, &key1)) {\n\t\t\twake_futex(this);\n\t\t\tif (++ret >= nr_wake)\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tif (op_ret > 0) {\n\t\thead = &hb2->chain;\n\n\t\top_ret = 0;\n\t\tplist_for_each_entry_safe(this, next, head, list) {\n\t\t\tif (match_futex (&this->key, &key2)) {\n\t\t\t\twake_futex(this);\n\t\t\t\tif (++op_ret >= nr_wake2)\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tret += op_ret;\n\t}\n\n\tspin_unlock(&hb1->lock);\n\tif (hb1 != hb2)\n\t\tspin_unlock(&hb2->lock);\nout:\n\tif (fshared)\n\t\tup_read(fshared);\n\treturn ret;\n}\n\n/*\n * Requeue all waiters hashed on one physical page to another\n * physical page.\n */\nstatic int futex_requeue(u32 __user *uaddr1, struct rw_semaphore *fshared,\n\t\t\t u32 __user *uaddr2,\n\t\t\t int nr_wake, int nr_requeue, u32 *cmpval)\n{\n\tunion futex_key key1, key2;\n\tstruct futex_hash_bucket *hb1, *hb2;\n\tstruct plist_head *head1;\n\tstruct futex_q *this, *next;\n\tint ret, drop_count = 0;\n\n retry:\n\tif (fshared)\n\t\tdown_read(fshared);\n\n\tret = get_futex_key(uaddr1, fshared, &key1);\n\tif (unlikely(ret != 0))\n\t\tgoto out;\n\tret = get_futex_key(uaddr2, fshared, &key2);\n\tif (unlikely(ret != 0))\n\t\tgoto out;\n\n\thb1 = hash_futex(&key1);\n\thb2 = hash_futex(&key2);\n\n\tdouble_lock_hb(hb1, hb2);\n\n\tif (likely(cmpval != NULL)) {\n\t\tu32 curval;\n\n\t\tret = get_futex_value_locked(&curval, uaddr1);\n\n\t\tif (unlikely(ret)) {\n\t\t\tspin_unlock(&hb1->lock);\n\t\t\tif (hb1 != hb2)\n\t\t\t\tspin_unlock(&hb2->lock);\n\n\t\t\t/*\n\t\t\t * If we would have faulted, release mmap_sem, fault\n\t\t\t * it in and start all over again.\n\t\t\t */\n\t\t\tif (fshared)\n\t\t\t\tup_read(fshared);\n\n\t\t\tret = get_user(curval, uaddr1);\n\n\t\t\tif (!ret)\n\t\t\t\tgoto retry;\n\n\t\t\treturn ret;\n\t\t}\n\t\tif (curval != *cmpval) {\n\t\t\tret = -EAGAIN;\n\t\t\tgoto out_unlock;\n\t\t}\n\t}\n\n\thead1 = &hb1->chain;\n\tplist_for_each_entry_safe(this, next, head1, list) {\n\t\tif (!match_futex (&this->key, &key1))\n\t\t\tcontinue;\n\t\tif (++ret <= nr_wake) {\n\t\t\twake_futex(this);\n\t\t} else {\n\t\t\t/*\n\t\t\t * If key1 and key2 hash to the same bucket, no need to\n\t\t\t * requeue.\n\t\t\t */\n\t\t\tif (likely(head1 != &hb2->chain)) {\n\t\t\t\tplist_del(&this->list, &hb1->chain);\n\t\t\t\tplist_add(&this->list, &hb2->chain);\n\t\t\t\tthis->lock_ptr = &hb2->lock;\n#ifdef CONFIG_DEBUG_PI_LIST\n\t\t\t\tthis->list.plist.lock = &hb2->lock;\n#endif\n\t\t\t}\n\t\t\tthis->key = key2;\n\t\t\tget_futex_key_refs(&key2);\n\t\t\tdrop_count++;\n\n\t\t\tif (ret - nr_wake >= nr_requeue)\n\t\t\t\tbreak;\n\t\t}\n\t}\n\nout_unlock:\n\tspin_unlock(&hb1->lock);\n\tif (hb1 != hb2)\n\t\tspin_unlock(&hb2->lock);\n\n\t/* drop_futex_key_refs() must be called outside the spinlocks. */\n\twhile (--drop_count >= 0)\n\t\tdrop_futex_key_refs(&key1);\n\nout:\n\tif (fshared)\n\t\tup_read(fshared);\n\treturn ret;\n}\n\n/* The key must be already stored in q->key. */\nstatic inline struct futex_hash_bucket *\nqueue_lock(struct futex_q *q, int fd, struct file *filp)\n{\n\tstruct futex_hash_bucket *hb;\n\n\tq->fd = fd;\n\tq->filp = filp;\n\n\tinit_waitqueue_head(&q->waiters);\n\n\tget_futex_key_refs(&q->key);\n\thb = hash_futex(&q->key);\n\tq->lock_ptr = &hb->lock;\n\n\tspin_lock(&hb->lock);\n\treturn hb;\n}\n\nstatic inline void __queue_me(struct futex_q *q, struct futex_hash_bucket *hb)\n{\n\tint prio;\n\n\t/*\n\t * The priority used to register this element is\n\t * - either the real thread-priority for the real-time threads\n\t * (i.e. threads with a priority lower than MAX_RT_PRIO)\n\t * - or MAX_RT_PRIO for non-RT threads.\n\t * Thus, all RT-threads are woken first in priority order, and\n\t * the others are woken last, in FIFO order.\n\t */\n\tprio = min(current->normal_prio, MAX_RT_PRIO);\n\n\tplist_node_init(&q->list, prio);\n#ifdef CONFIG_DEBUG_PI_LIST\n\tq->list.plist.lock = &hb->lock;\n#endif\n\tplist_add(&q->list, &hb->chain);\n\tq->task = current;\n\tspin_unlock(&hb->lock);\n}\n\nstatic inline void\nqueue_unlock(struct futex_q *q, struct futex_hash_bucket *hb)\n{\n\tspin_unlock(&hb->lock);\n\tdrop_futex_key_refs(&q->key);\n}\n\n/*\n * queue_me and unqueue_me must be called as a pair, each\n * exactly once. They are called with the hashed spinlock held.\n */\n\n/* The key must be already stored in q->key. */\nstatic void queue_me(struct futex_q *q, int fd, struct file *filp)\n{\n\tstruct futex_hash_bucket *hb;\n\n\thb = queue_lock(q, fd, filp);\n\t__queue_me(q, hb);\n}\n\n/* Return 1 if we were still queued (ie. 0 means we were woken) */\nstatic int unqueue_me(struct futex_q *q)\n{\n\tspinlock_t *lock_ptr;\n\tint ret = 0;\n\n\t/* In the common case we don't take the spinlock, which is nice. */\n retry:\n\tlock_ptr = q->lock_ptr;\n\tbarrier();\n\tif (lock_ptr != 0) {\n\t\tspin_lock(lock_ptr);\n\t\t/*\n\t\t * q->lock_ptr can change between reading it and\n\t\t * spin_lock(), causing us to take the wrong lock. This\n\t\t * corrects the race condition.\n\t\t *\n\t\t * Reasoning goes like this: if we have the wrong lock,\n\t\t * q->lock_ptr must have changed (maybe several times)\n\t\t * between reading it and the spin_lock(). It can\n\t\t * change again after the spin_lock() but only if it was\n\t\t * already changed before the spin_lock(). It cannot,\n\t\t * however, change back to the original value. Therefore\n\t\t * we can detect whether we acquired the correct lock.\n\t\t */\n\t\tif (unlikely(lock_ptr != q->lock_ptr)) {\n\t\t\tspin_unlock(lock_ptr);\n\t\t\tgoto retry;\n\t\t}\n\t\tWARN_ON(plist_node_empty(&q->list));\n\t\tplist_del(&q->list, &q->list.plist);\n\n\t\tBUG_ON(q->pi_state);\n\n\t\tspin_unlock(lock_ptr);\n\t\tret = 1;\n\t}\n\n\tdrop_futex_key_refs(&q->key);\n\treturn ret;\n}\n\n/*\n * PI futexes can not be requeued and must remove themself from the\n * hash bucket. The hash bucket lock (i.e. lock_ptr) is held on entry\n * and dropped here.\n */\nstatic void unqueue_me_pi(struct futex_q *q)\n{\n\tWARN_ON(plist_node_empty(&q->list));\n\tplist_del(&q->list, &q->list.plist);\n\n\tBUG_ON(!q->pi_state);\n\tfree_pi_state(q->pi_state);\n\tq->pi_state = NULL;\n\n\tspin_unlock(q->lock_ptr);\n\n\tdrop_futex_key_refs(&q->key);\n}\n\n/*\n * Fixup the pi_state owner with current.\n *\n * Must be called with hash bucket lock held and mm->sem held for non\n * private futexes.\n */\nstatic int fixup_pi_state_owner(u32 __user *uaddr, struct futex_q *q,\n\t\t\t\tstruct task_struct *curr)\n{\n\tu32 newtid = curr->pid | FUTEX_WAITERS;\n\tstruct futex_pi_state *pi_state = q->pi_state;\n\tu32 uval, curval, newval;\n\tint ret;\n\n\t/* Owner died? */\n\tif (pi_state->owner != NULL) {\n\t\tspin_lock_irq(&pi_state->owner->pi_lock);\n\t\tWARN_ON(list_empty(&pi_state->list));\n\t\tlist_del_init(&pi_state->list);\n\t\tspin_unlock_irq(&pi_state->owner->pi_lock);\n\t} else\n\t\tnewtid |= FUTEX_OWNER_DIED;\n\n\tpi_state->owner = curr;\n\n\tspin_lock_irq(&curr->pi_lock);\n\tWARN_ON(!list_empty(&pi_state->list));\n\tlist_add(&pi_state->list, &curr->pi_state_list);\n\tspin_unlock_irq(&curr->pi_lock);\n\n\t/*\n\t * We own it, so we have to replace the pending owner\n\t * TID. This must be atomic as we have preserve the\n\t * owner died bit here.\n\t */\n\tret = get_futex_value_locked(&uval, uaddr);\n\n\twhile (!ret) {\n\t\tnewval = (uval & FUTEX_OWNER_DIED) | newtid;\n\n\t\tpagefault_disable();\n\t\tcurval = futex_atomic_cmpxchg_inatomic(uaddr,\n\t\t\t\t\t\t uval, newval);\n\t\tpagefault_enable();\n\n\t\tif (curval == -EFAULT)\n\t\t\tret = -EFAULT;\n\t\tif (curval == uval)\n\t\t\tbreak;\n\t\tuval = curval;\n\t}\n\treturn ret;\n}\n\n/*\n * In case we must use restart_block to restart a futex_wait,\n * we encode in the 'flags' shared capability\n */\n#define FLAGS_SHARED 1\n\nstatic long futex_wait_restart(struct restart_block *restart);\nstatic int futex_wait(u32 __user *uaddr, struct rw_semaphore *fshared,\n\t\t u32 val, ktime_t *abs_time)\n{\n\tstruct task_struct *curr = current;\n\tDECLARE_WAITQUEUE(wait, curr);\n\tstruct futex_hash_bucket *hb;\n\tstruct futex_q q;\n\tu32 uval;\n\tint ret;\n\tstruct hrtimer_sleeper t;\n\tint rem = 0;\n\n\tq.pi_state = NULL;\n retry:\n\tif (fshared)\n\t\tdown_read(fshared);\n\n\tret = get_futex_key(uaddr, fshared, &q.key);\n\tif (unlikely(ret != 0))\n\t\tgoto out_release_sem;\n\n\thb = queue_lock(&q, -1, NULL);\n\n\t/*\n\t * Access the page AFTER the futex is queued.\n\t * Order is important:\n\t *\n\t * Userspace waiter: val = var; if (cond(val)) futex_wait(&var, val);\n\t * Userspace waker: if (cond(var)) { var = new; futex_wake(&var); }\n\t *\n\t * The basic logical guarantee of a futex is that it blocks ONLY\n\t * if cond(var) is known to be true at the time of blocking, for\n\t * any cond. If we queued after testing *uaddr, that would open\n\t * a race condition where we could block indefinitely with\n\t * cond(var) false, which would violate the guarantee.\n\t *\n\t * A consequence is that futex_wait() can return zero and absorb\n\t * a wakeup when *uaddr != val on entry to the syscall. This is\n\t * rare, but normal.\n\t *\n\t * for shared futexes, we hold the mmap semaphore, so the mapping\n\t * cannot have changed since we looked it up in get_futex_key.\n\t */\n\tret = get_futex_value_locked(&uval, uaddr);\n\n\tif (unlikely(ret)) {\n\t\tqueue_unlock(&q, hb);\n\n\t\t/*\n\t\t * If we would have faulted, release mmap_sem, fault it in and\n\t\t * start all over again.\n\t\t */\n\t\tif (fshared)\n\t\t\tup_read(fshared);\n\n\t\tret = get_user(uval, uaddr);\n\n\t\tif (!ret)\n\t\t\tgoto retry;\n\t\treturn ret;\n\t}\n\tret = -EWOULDBLOCK;\n\tif (uval != val)\n\t\tgoto out_unlock_release_sem;\n\n\t/* Only actually queue if *uaddr contained val. */\n\t__queue_me(&q, hb);\n\n\t/*\n\t * Now the futex is queued and we have checked the data, we\n\t * don't want to hold mmap_sem while we sleep.\n\t */\n\tif (fshared)\n\t\tup_read(fshared);\n\n\t/*\n\t * There might have been scheduling since the queue_me(), as we\n\t * cannot hold a spinlock across the get_user() in case it\n\t * faults, and we cannot just set TASK_INTERRUPTIBLE state when\n\t * queueing ourselves into the futex hash. This code thus has to\n\t * rely on the futex_wake() code removing us from hash when it\n\t * wakes us up.\n\t */\n\n\t/* add_wait_queue is the barrier after __set_current_state. */\n\t__set_current_state(TASK_INTERRUPTIBLE);\n\tadd_wait_queue(&q.waiters, &wait);\n\t/*\n\t * !plist_node_empty() is safe here without any lock.\n\t * q.lock_ptr != 0 is not safe, because of ordering against wakeup.\n\t */\n\tif (likely(!plist_node_empty(&q.list))) {\n\t\tif (!abs_time)\n\t\t\tschedule();\n\t\telse {\n\t\t\thrtimer_init(&t.timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS);\n\t\t\thrtimer_init_sleeper(&t, current);\n\t\t\tt.timer.expires = *abs_time;\n\n\t\t\thrtimer_start(&t.timer, t.timer.expires, HRTIMER_MODE_ABS);\n\n\t\t\t/*\n\t\t\t * the timer could have already expired, in which\n\t\t\t * case current would be flagged for rescheduling.\n\t\t\t * Don't bother calling schedule.\n\t\t\t */\n\t\t\tif (likely(t.task))\n\t\t\t\tschedule();\n\n\t\t\thrtimer_cancel(&t.timer);\n\n\t\t\t/* Flag if a timeout occured */\n\t\t\trem = (t.task == NULL);\n\t\t}\n\t}\n\t__set_current_state(TASK_RUNNING);\n\n\t/*\n\t * NOTE: we don't remove ourselves from the waitqueue because\n\t * we are the only user of it.\n\t */\n\n\t/* If we were woken (and unqueued), we succeeded, whatever. */\n\tif (!unqueue_me(&q))\n\t\treturn 0;\n\tif (rem)\n\t\treturn -ETIMEDOUT;\n\n\t/*\n\t * We expect signal_pending(current), but another thread may\n\t * have handled it for us already.\n\t */\n\tif (!abs_time)\n\t\treturn -ERESTARTSYS;\n\telse {\n\t\tstruct restart_block *restart;\n\t\trestart = &current_thread_info()->restart_block;\n\t\trestart->fn = futex_wait_restart;\n\t\trestart->futex.uaddr = (u32 *)uaddr;\n\t\trestart->futex.val = val;\n\t\trestart->futex.time = abs_time->tv64;\n\t\trestart->futex.flags = 0;\n\n\t\tif (fshared)\n\t\t\trestart->futex.flags |= FLAGS_SHARED;\n\t\treturn -ERESTART_RESTARTBLOCK;\n\t}\n\n out_unlock_release_sem:\n\tqueue_unlock(&q, hb);\n\n out_release_sem:\n\tif (fshared)\n\t\tup_read(fshared);\n\treturn ret;\n}\n\n\nstatic long futex_wait_restart(struct restart_block *restart)\n{\n\tu32 __user *uaddr = (u32 __user *)restart->futex.uaddr;\n\tstruct rw_semaphore *fshared = NULL;\n\tktime_t t;\n\n\tt.tv64 = restart->futex.time;\n\trestart->fn = do_no_restart_syscall;\n\tif (restart->futex.flags & FLAGS_SHARED)\n\t\tfshared = &current->mm->mmap_sem;\n\treturn (long)futex_wait(uaddr, fshared, restart->futex.val, &t);\n}\n\n\n/*\n * Userspace tried a 0 -> TID atomic transition of the futex value\n * and failed. The kernel side here does the whole locking operation:\n * if there are waiters then it will block, it does PI, etc. (Due to\n * races the kernel might see a 0 value of the futex too.)\n */\nstatic int futex_lock_pi(u32 __user *uaddr, struct rw_semaphore *fshared,\n\t\t\t int detect, ktime_t *time, int trylock)\n{\n\tstruct hrtimer_sleeper timeout, *to = NULL;\n\tstruct task_struct *curr = current;\n\tstruct futex_hash_bucket *hb;\n\tu32 uval, newval, curval;\n\tstruct futex_q q;\n\tint ret, lock_taken, ownerdied = 0, attempt = 0;\n\n\tif (refill_pi_state_cache())\n\t\treturn -ENOMEM;\n\n\tif (time) {\n\t\tto = &timeout;\n\t\thrtimer_init(&to->timer, CLOCK_REALTIME, HRTIMER_MODE_ABS);\n\t\thrtimer_init_sleeper(to, current);\n\t\tto->timer.expires = *time;\n\t}\n\n\tq.pi_state = NULL;\n retry:\n\tif (fshared)\n\t\tdown_read(fshared);\n\n\tret = get_futex_key(uaddr, fshared, &q.key);\n\tif (unlikely(ret != 0))\n\t\tgoto out_release_sem;\n\n retry_unlocked:\n\thb = queue_lock(&q, -1, NULL);\n\n retry_locked:\n\tret = lock_taken = 0;\n\n\t/*\n\t * To avoid races, we attempt to take the lock here again\n\t * (by doing a 0 -> TID atomic cmpxchg), while holding all\n\t * the locks. It will most likely not succeed.\n\t */\n\tnewval = current->pid;\n\n\tpagefault_disable();\n\tcurval = futex_atomic_cmpxchg_inatomic(uaddr, 0, newval);\n\tpagefault_enable();\n\n\tif (unlikely(curval == -EFAULT))\n\t\tgoto uaddr_faulted;\n\n\t/*\n\t * Detect deadlocks. In case of REQUEUE_PI this is a valid\n\t * situation and we return success to user space.\n\t */\n\tif (unlikely((curval & FUTEX_TID_MASK) == current->pid)) {\n\t\tret = -EDEADLK;\n\t\tgoto out_unlock_release_sem;\n\t}\n\n\t/*\n\t * Surprise - we got the lock. Just return to userspace:\n\t */\n\tif (unlikely(!curval))\n\t\tgoto out_unlock_release_sem;\n\n\tuval = curval;\n\n\t/*\n\t * Set the WAITERS flag, so the owner will know it has someone\n\t * to wake at next unlock\n\t */\n\tnewval = curval | FUTEX_WAITERS;\n\n\t/*\n\t * There are two cases, where a futex might have no owner (the\n\t * owner TID is 0): OWNER_DIED. We take over the futex in this\n\t * case. We also do an unconditional take over, when the owner\n\t * of the futex died.\n\t *\n\t * This is safe as we are protected by the hash bucket lock !\n\t */\n\tif (unlikely(ownerdied || !(curval & FUTEX_TID_MASK))) {\n\t\t/* Keep the OWNER_DIED bit */\n\t\tnewval = (curval & ~FUTEX_TID_MASK) | current->pid;\n\t\townerdied = 0;\n\t\tlock_taken = 1;\n\t}\n\n\tpagefault_disable();\n\tcurval = futex_atomic_cmpxchg_inatomic(uaddr, uval, newval);\n\tpagefault_enable();\n\n\tif (unlikely(curval == -EFAULT))\n\t\tgoto uaddr_faulted;\n\tif (unlikely(curval != uval))\n\t\tgoto retry_locked;\n\n\t/*\n\t * We took the lock due to owner died take over.\n\t */\n\tif (unlikely(lock_taken))\n\t\tgoto out_unlock_release_sem;\n\n\t/*\n\t * We dont have the lock. Look up the PI state (or create it if\n\t * we are the first waiter):\n\t */\n\tret = lookup_pi_state(uval, hb, &q.key, &q.pi_state);\n\n\tif (unlikely(ret)) {\n\t\tswitch (ret) {\n\n\t\tcase -EAGAIN:\n\t\t\t/*\n\t\t\t * Task is exiting and we just wait for the\n\t\t\t * exit to complete.\n\t\t\t */\n\t\t\tqueue_unlock(&q, hb);\n\t\t\tif (fshared)\n\t\t\t\tup_read(fshared);\n\t\t\tcond_resched();\n\t\t\tgoto retry;\n\n\t\tcase -ESRCH:\n\t\t\t/*\n\t\t\t * No owner found for this futex. Check if the\n\t\t\t * OWNER_DIED bit is set to figure out whether\n\t\t\t * this is a robust futex or not.\n\t\t\t */\n\t\t\tif (get_futex_value_locked(&curval, uaddr))\n\t\t\t\tgoto uaddr_faulted;\n\n\t\t\t/*\n\t\t\t * We simply start over in case of a robust\n\t\t\t * futex. The code above will take the futex\n\t\t\t * and return happy.\n\t\t\t */\n\t\t\tif (curval & FUTEX_OWNER_DIED) {\n\t\t\t\townerdied = 1;\n\t\t\t\tgoto retry_locked;\n\t\t\t}\n\t\tdefault:\n\t\t\tgoto out_unlock_release_sem;\n\t\t}\n\t}\n\n\t/*\n\t * Only actually queue now that the atomic ops are done:\n\t */\n\t__queue_me(&q, hb);\n\n\t/*\n\t * Now the futex is queued and we have checked the data, we\n\t * don't want to hold mmap_sem while we sleep.\n\t */\n\tif (fshared)\n\t\tup_read(fshared);\n\n\tWARN_ON(!q.pi_state);\n\t/*\n\t * Block on the PI mutex:\n\t */\n\tif (!trylock)\n\t\tret = rt_mutex_timed_lock(&q.pi_state->pi_mutex, to, 1);\n\telse {\n\t\tret = rt_mutex_trylock(&q.pi_state->pi_mutex);\n\t\t/* Fixup the trylock return value: */\n\t\tret = ret ? 0 : -EWOULDBLOCK;\n\t}\n\n\tif (fshared)\n\t\tdown_read(fshared);\n\tspin_lock(q.lock_ptr);\n\n\tif (!ret) {\n\t\t/*\n\t\t * Got the lock. We might not be the anticipated owner\n\t\t * if we did a lock-steal - fix up the PI-state in\n\t\t * that case:\n\t\t */\n\t\tif (q.pi_state->owner != curr)\n\t\t\tret = fixup_pi_state_owner(uaddr, &q, curr);\n\t} else {\n\t\t/*\n\t\t * Catch the rare case, where the lock was released\n\t\t * when we were on the way back before we locked the\n\t\t * hash bucket.\n\t\t */\n\t\tif (q.pi_state->owner == curr &&\n\t\t rt_mutex_trylock(&q.pi_state->pi_mutex)) {\n\t\t\tret = 0;\n\t\t} else {\n\t\t\t/*\n\t\t\t * Paranoia check. If we did not take the lock\n\t\t\t * in the trylock above, then we should not be\n\t\t\t * the owner of the rtmutex, neither the real\n\t\t\t * nor the pending one:\n\t\t\t */\n\t\t\tif (rt_mutex_owner(&q.pi_state->pi_mutex) == curr)\n\t\t\t\tprintk(KERN_ERR \"futex_lock_pi: ret = %d \"\n\t\t\t\t \"pi-mutex: %p pi-state %p\\n\", ret,\n\t\t\t\t q.pi_state->pi_mutex.owner,\n\t\t\t\t q.pi_state->owner);\n\t\t}\n\t}\n\n\t/* Unqueue and drop the lock */\n\tunqueue_me_pi(&q);\n\tif (fshared)\n\t\tup_read(fshared);\n\n\treturn ret != -EINTR ? ret : -ERESTARTNOINTR;\n\n out_unlock_release_sem:\n\tqueue_unlock(&q, hb);\n\n out_release_sem:\n\tif (fshared)\n\t\tup_read(fshared);\n\treturn ret;\n\n uaddr_faulted:\n\t/*\n\t * We have to r/w *(int __user *)uaddr, but we can't modify it\n\t * non-atomically. Therefore, if get_user below is not\n\t * enough, we need to handle the fault ourselves, while\n\t * still holding the mmap_sem.\n\t *\n\t * ... and hb->lock. :-) --ANK\n\t */\n\tqueue_unlock(&q, hb);\n\n\tif (attempt++) {\n\t\tret = futex_handle_fault((unsigned long)uaddr, fshared,\n\t\t\t\t\t attempt);\n\t\tif (ret)\n\t\t\tgoto out_release_sem;\n\t\tgoto retry_unlocked;\n\t}\n\n\tif (fshared)\n\t\tup_read(fshared);\n\n\tret = get_user(uval, uaddr);\n\tif (!ret && (uval != -EFAULT))\n\t\tgoto retry;\n\n\treturn ret;\n}\n\n/*\n * Userspace attempted a TID -> 0 atomic transition, and failed.\n * This is the in-kernel slowpath: we look up the PI state (if any),\n * and do the rt-mutex unlock.\n */\nstatic int futex_unlock_pi(u32 __user *uaddr, struct rw_semaphore *fshared)\n{\n\tstruct futex_hash_bucket *hb;\n\tstruct futex_q *this, *next;\n\tu32 uval;\n\tstruct plist_head *head;\n\tunion futex_key key;\n\tint ret, attempt = 0;\n\nretry:\n\tif (get_user(uval, uaddr))\n\t\treturn -EFAULT;\n\t/*\n\t * We release only a lock we actually own:\n\t */\n\tif ((uval & FUTEX_TID_MASK) != current->pid)\n\t\treturn -EPERM;\n\t/*\n\t * First take all the futex related locks:\n\t */\n\tif (fshared)\n\t\tdown_read(fshared);\n\n\tret = get_futex_key(uaddr, fshared, &key);\n\tif (unlikely(ret != 0))\n\t\tgoto out;\n\n\thb = hash_futex(&key);\nretry_unlocked:\n\tspin_lock(&hb->lock);\n\n\t/*\n\t * To avoid races, try to do the TID -> 0 atomic transition\n\t * again. If it succeeds then we can return without waking\n\t * anyone else up:\n\t */\n\tif (!(uval & FUTEX_OWNER_DIED)) {\n\t\tpagefault_disable();\n\t\tuval = futex_atomic_cmpxchg_inatomic(uaddr, current->pid, 0);\n\t\tpagefault_enable();\n\t}\n\n\tif (unlikely(uval == -EFAULT))\n\t\tgoto pi_faulted;\n\t/*\n\t * Rare case: we managed to release the lock atomically,\n\t * no need to wake anyone else up:\n\t */\n\tif (unlikely(uval == current->pid))\n\t\tgoto out_unlock;\n\n\t/*\n\t * Ok, other tasks may need to be woken up - check waiters\n\t * and do the wakeup if necessary:\n\t */\n\thead = &hb->chain;\n\n\tplist_for_each_entry_safe(this, next, head, list) {\n\t\tif (!match_futex (&this->key, &key))\n\t\t\tcontinue;\n\t\tret = wake_futex_pi(uaddr, uval, this);\n\t\t/*\n\t\t * The atomic access to the futex value\n\t\t * generated a pagefault, so retry the\n\t\t * user-access and the wakeup:\n\t\t */\n\t\tif (ret == -EFAULT)\n\t\t\tgoto pi_faulted;\n\t\tgoto out_unlock;\n\t}\n\t/*\n\t * No waiters - kernel unlocks the futex:\n\t */\n\tif (!(uval & FUTEX_OWNER_DIED)) {\n\t\tret = unlock_futex_pi(uaddr, uval);\n\t\tif (ret == -EFAULT)\n\t\t\tgoto pi_faulted;\n\t}\n\nout_unlock:\n\tspin_unlock(&hb->lock);\nout:\n\tif (fshared)\n\t\tup_read(fshared);\n\n\treturn ret;\n\npi_faulted:\n\t/*\n\t * We have to r/w *(int __user *)uaddr, but we can't modify it\n\t * non-atomically. Therefore, if get_user below is not\n\t * enough, we need to handle the fault ourselves, while\n\t * still holding the mmap_sem.\n\t *\n\t * ... and hb->lock. --ANK\n\t */\n\tspin_unlock(&hb->lock);\n\n\tif (attempt++) {\n\t\tret = futex_handle_fault((unsigned long)uaddr, fshared,\n\t\t\t\t\t attempt);\n\t\tif (ret)\n\t\t\tgoto out;\n\t\tgoto retry_unlocked;\n\t}\n\n\tif (fshared)\n\t\tup_read(fshared);\n\n\tret = get_user(uval, uaddr);\n\tif (!ret && (uval != -EFAULT))\n\t\tgoto retry;\n\n\treturn ret;\n}\n\nstatic int futex_close(struct inode *inode, struct file *filp)\n{\n\tstruct futex_q *q = filp->private_data;\n\n\tunqueue_me(q);\n\tkfree(q);\n\n\treturn 0;\n}\n\n/* This is one-shot: once it's gone off you need a new fd */\nstatic unsigned int futex_poll(struct file *filp,\n\t\t\t struct poll_table_struct *wait)\n{\n\tstruct futex_q *q = filp->private_data;\n\tint ret = 0;\n\n\tpoll_wait(filp, &q->waiters, wait);\n\n\t/*\n\t * plist_node_empty() is safe here without any lock.\n\t * q->lock_ptr != 0 is not safe, because of ordering against wakeup.\n\t */\n\tif (plist_node_empty(&q->list))\n\t\tret = POLLIN | POLLRDNORM;\n\n\treturn ret;\n}\n\nstatic const struct file_operations futex_fops = {\n\t.release\t= futex_close,\n\t.poll\t\t= futex_poll,\n};\n\n/*\n * Signal allows caller to avoid the race which would occur if they\n * set the sigio stuff up afterwards.\n */\nstatic int futex_fd(u32 __user *uaddr, int signal)\n{\n\tstruct futex_q *q;\n\tstruct file *filp;\n\tint ret, err;\n\tstruct rw_semaphore *fshared;\n\tstatic unsigned long printk_interval;\n\n\tif (printk_timed_ratelimit(&printk_interval, 60 * 60 * 1000)) {\n\t\tprintk(KERN_WARNING \"Process `%s' used FUTEX_FD, which \"\n\t\t \t\"will be removed from the kernel in June 2007\\n\",\n\t\t\tcurrent->comm);\n\t}\n\n\tret = -EINVAL;\n\tif (!valid_signal(signal))\n\t\tgoto out;\n\n\tret = get_unused_fd();\n\tif (ret < 0)\n\t\tgoto out;\n\tfilp = get_empty_filp();\n\tif (!filp) {\n\t\tput_unused_fd(ret);\n\t\tret = -ENFILE;\n\t\tgoto out;\n\t}\n\tfilp->f_op = &futex_fops;\n\tfilp->f_path.mnt = mntget(futex_mnt);\n\tfilp->f_path.dentry = dget(futex_mnt->mnt_root);\n\tfilp->f_mapping = filp->f_path.dentry->d_inode->i_mapping;\n\n\tif (signal) {\n\t\terr = __f_setown(filp, task_pid(current), PIDTYPE_PID, 1);\n\t\tif (err < 0) {\n\t\t\tgoto error;\n\t\t}\n\t\tfilp->f_owner.signum = signal;\n\t}\n\n\tq = kmalloc(sizeof(*q), GFP_KERNEL);\n\tif (!q) {\n\t\terr = -ENOMEM;\n\t\tgoto error;\n\t}\n\tq->pi_state = NULL;\n\n\tfshared = &current->mm->mmap_sem;\n\tdown_read(fshared);\n\terr = get_futex_key(uaddr, fshared, &q->key);\n\n\tif (unlikely(err != 0)) {\n\t\tup_read(fshared);\n\t\tkfree(q);\n\t\tgoto error;\n\t}\n\n\t/*\n\t * queue_me() must be called before releasing mmap_sem, because\n\t * key->shared.inode needs to be referenced while holding it.\n\t */\n\tfilp->private_data = q;\n\n\tqueue_me(q, ret, filp);\n\tup_read(fshared);\n\n\t/* Now we map fd to filp, so userspace can access it */\n\tfd_install(ret, filp);\nout:\n\treturn ret;\nerror:\n\tput_unused_fd(ret);\n\tput_filp(filp);\n\tret = err;\n\tgoto out;\n}\n\n/*\n * Support for robust futexes: the kernel cleans up held futexes at\n * thread exit time.\n *\n * Implementation: user-space maintains a per-thread list of locks it\n * is holding. Upon do_exit(), the kernel carefully walks this list,\n * and marks all locks that are owned by this thread with the\n * FUTEX_OWNER_DIED bit, and wakes up a waiter (if any). The list is\n * always manipulated with the lock held, so the list is private and\n * per-thread. Userspace also maintains a per-thread 'list_op_pending'\n * field, to allow the kernel to clean up if the thread dies after\n * acquiring the lock, but just before it could have added itself to\n * the list. There can only be one such pending lock.\n */\n\n/**\n * sys_set_robust_list - set the robust-futex list head of a task\n * @head: pointer to the list-head\n * @len: length of the list-head, as userspace expects\n */\nasmlinkage long\nsys_set_robust_list(struct robust_list_head __user *head,\n\t\t size_t len)\n{\n\t/*\n\t * The kernel knows only one size for now:\n\t */\n\tif (unlikely(len != sizeof(*head)))\n\t\treturn -EINVAL;\n\n\tcurrent->robust_list = head;\n\n\treturn 0;\n}\n\n/**\n * sys_get_robust_list - get the robust-futex list head of a task\n * @pid: pid of the process [zero for current task]\n * @head_ptr: pointer to a list-head pointer, the kernel fills it in\n * @len_ptr: pointer to a length field, the kernel fills in the header size\n */\nasmlinkage long\nsys_get_robust_list(int pid, struct robust_list_head __user * __user *head_ptr,\n\t\t size_t __user *len_ptr)\n{\n\tstruct robust_list_head __user *head;\n\tunsigned long ret;\n\n\tif (!pid)\n\t\thead = current->robust_list;\n\telse {\n\t\tstruct task_struct *p;\n\n\t\tret = -ESRCH;\n\t\trcu_read_lock();\n\t\tp = find_task_by_pid(pid);\n\t\tif (!p)\n\t\t\tgoto err_unlock;\n\t\tret = -EPERM;\n\t\tif ((current->euid != p->euid) && (current->euid != p->uid) &&\n\t\t\t\t!capable(CAP_SYS_PTRACE))\n\t\t\tgoto err_unlock;\n\t\thead = p->robust_list;\n\t\trcu_read_unlock();\n\t}\n\n\tif (put_user(sizeof(*head), len_ptr))\n\t\treturn -EFAULT;\n\treturn put_user(head, head_ptr);\n\nerr_unlock:\n\trcu_read_unlock();\n\n\treturn ret;\n}\n\n/*\n * Process a futex-list entry, check whether it's owned by the\n * dying task, and do notification if so:\n */\nint handle_futex_death(u32 __user *uaddr, struct task_struct *curr, int pi)\n{\n\tu32 uval, nval, mval;\n\nretry:\n\tif (get_user(uval, uaddr))\n\t\treturn -1;\n\n\tif ((uval & FUTEX_TID_MASK) == curr->pid) {\n\t\t/*\n\t\t * Ok, this dying thread is truly holding a futex\n\t\t * of interest. Set the OWNER_DIED bit atomically\n\t\t * via cmpxchg, and if the value had FUTEX_WAITERS\n\t\t * set, wake up a waiter (if any). (We have to do a\n\t\t * futex_wake() even if OWNER_DIED is already set -\n\t\t * to handle the rare but possible case of recursive\n\t\t * thread-death.) The rest of the cleanup is done in\n\t\t * userspace.\n\t\t */\n\t\tmval = (uval & FUTEX_WAITERS) | FUTEX_OWNER_DIED;\n\t\tnval = futex_atomic_cmpxchg_inatomic(uaddr, uval, mval);\n\n\t\tif (nval == -EFAULT)\n\t\t\treturn -1;\n\n\t\tif (nval != uval)\n\t\t\tgoto retry;\n\n\t\t/*\n\t\t * Wake robust non-PI futexes here. The wakeup of\n\t\t * PI futexes happens in exit_pi_state():\n\t\t */\n\t\tif (!pi) {\n\t\t\tif (uval & FUTEX_WAITERS)\n\t\t\t\tfutex_wake(uaddr, &curr->mm->mmap_sem, 1);\n\t\t}\n\t}\n\treturn 0;\n}\n\n/*\n * Fetch a robust-list pointer. Bit 0 signals PI futexes:\n */\nstatic inline int fetch_robust_entry(struct robust_list __user **entry,\n\t\t\t\t struct robust_list __user * __user *head,\n\t\t\t\t int *pi)\n{\n\tunsigned long uentry;\n\n\tif (get_user(uentry, (unsigned long __user *)head))\n\t\treturn -EFAULT;\n\n\t*entry = (void __user *)(uentry & ~1UL);\n\t*pi = uentry & 1;\n\n\treturn 0;\n}\n\n/*\n * Walk curr->robust_list (very carefully, it's a userspace list!)\n * and mark any locks found there dead, and notify any waiters.\n *\n * We silently return on any sign of list-walking problem.\n */\nvoid exit_robust_list(struct task_struct *curr)\n{\n\tstruct robust_list_head __user *head = curr->robust_list;\n\tstruct robust_list __user *entry, *pending;\n\tunsigned int limit = ROBUST_LIST_LIMIT, pi, pip;\n\tunsigned long futex_offset;\n\n\t/*\n\t * Fetch the list head (which was registered earlier, via\n\t * sys_set_robust_list()):\n\t */\n\tif (fetch_robust_entry(&entry, &head->list.next, &pi))\n\t\treturn;\n\t/*\n\t * Fetch the relative futex offset:\n\t */\n\tif (get_user(futex_offset, &head->futex_offset))\n\t\treturn;\n\t/*\n\t * Fetch any possibly pending lock-add first, and handle it\n\t * if it exists:\n\t */\n\tif (fetch_robust_entry(&pending, &head->list_op_pending, &pip))\n\t\treturn;\n\n\tif (pending)\n\t\thandle_futex_death((void __user *)pending + futex_offset,\n\t\t\t\t curr, pip);\n\n\twhile (entry != &head->list) {\n\t\t/*\n\t\t * A pending lock might already be on the list, so\n\t\t * don't process it twice:\n\t\t */\n\t\tif (entry != pending)\n\t\t\tif (handle_futex_death((void __user *)entry + futex_offset,\n\t\t\t\t\t\tcurr, pi))\n\t\t\t\treturn;\n\t\t/*\n\t\t * Fetch the next entry in the list:\n\t\t */\n\t\tif (fetch_robust_entry(&entry, &entry->next, &pi))\n\t\t\treturn;\n\t\t/*\n\t\t * Avoid excessively long or circular lists:\n\t\t */\n\t\tif (!--limit)\n\t\t\tbreak;\n\n\t\tcond_resched();\n\t}\n}\n\nlong do_futex(u32 __user *uaddr, int op, u32 val, ktime_t *timeout,\n\t\tu32 __user *uaddr2, u32 val2, u32 val3)\n{\n\tint ret;\n\tint cmd = op & FUTEX_CMD_MASK;\n\tstruct rw_semaphore *fshared = NULL;\n\n\tif (!(op & FUTEX_PRIVATE_FLAG))\n\t\tfshared = &current->mm->mmap_sem;\n\n\tswitch (cmd) {\n\tcase FUTEX_WAIT:\n\t\tret = futex_wait(uaddr, fshared, val, timeout);\n\t\tbreak;\n\tcase FUTEX_WAKE:\n\t\tret = futex_wake(uaddr, fshared, val);\n\t\tbreak;\n\tcase FUTEX_FD:\n\t\t/* non-zero val means F_SETOWN(getpid()) & F_SETSIG(val) */\n\t\tret = futex_fd(uaddr, val);\n\t\tbreak;\n\tcase FUTEX_REQUEUE:\n\t\tret = futex_requeue(uaddr, fshared, uaddr2, val, val2, NULL);\n\t\tbreak;\n\tcase FUTEX_CMP_REQUEUE:\n\t\tret = futex_requeue(uaddr, fshared, uaddr2, val, val2, &val3);\n\t\tbreak;\n\tcase FUTEX_WAKE_OP:\n\t\tret = futex_wake_op(uaddr, fshared, uaddr2, val, val2, val3);\n\t\tbreak;\n\tcase FUTEX_LOCK_PI:\n\t\tret = futex_lock_pi(uaddr, fshared, val, timeout, 0);\n\t\tbreak;\n\tcase FUTEX_UNLOCK_PI:\n\t\tret = futex_unlock_pi(uaddr, fshared);\n\t\tbreak;\n\tcase FUTEX_TRYLOCK_PI:\n\t\tret = futex_lock_pi(uaddr, fshared, 0, timeout, 1);\n\t\tbreak;\n\tdefault:\n\t\tret = -ENOSYS;\n\t}\n\treturn ret;\n}\n\n\nasmlinkage long sys_futex(u32 __user *uaddr, int op, u32 val,\n\t\t\t struct timespec __user *utime, u32 __user *uaddr2,\n\t\t\t u32 val3)\n{\n\tstruct timespec ts;\n\tktime_t t, *tp = NULL;\n\tu32 val2 = 0;\n\tint cmd = op & FUTEX_CMD_MASK;\n\n\tif (utime && (cmd == FUTEX_WAIT || cmd == FUTEX_LOCK_PI)) {\n\t\tif (copy_from_user(&ts, utime, sizeof(ts)) != 0)\n\t\t\treturn -EFAULT;\n\t\tif (!timespec_valid(&ts))\n\t\t\treturn -EINVAL;\n\n\t\tt = timespec_to_ktime(ts);\n\t\tif (cmd == FUTEX_WAIT)\n\t\t\tt = ktime_add(ktime_get(), t);\n\t\ttp = &t;\n\t}\n\t/*\n\t * requeue parameter in 'utime' if cmd == FUTEX_REQUEUE.\n\t * number of waiters to wake in 'utime' if cmd == FUTEX_WAKE_OP.\n\t */\n\tif (cmd == FUTEX_REQUEUE || cmd == FUTEX_CMP_REQUEUE ||\n\t cmd == FUTEX_WAKE_OP)\n\t\tval2 = (u32) (unsigned long) utime;\n\n\treturn do_futex(uaddr, op, val, tp, uaddr2, val2, val3);\n}\n\nstatic int futexfs_get_sb(struct file_system_type *fs_type,\n\t\t\t int flags, const char *dev_name, void *data,\n\t\t\t struct vfsmount *mnt)\n{\n\treturn get_sb_pseudo(fs_type, \"futex\", NULL, 0xBAD1DEA, mnt);\n}\n\nstatic struct file_system_type futex_fs_type = {\n\t.name\t\t= \"futexfs\",\n\t.get_sb\t\t= futexfs_get_sb,\n\t.kill_sb\t= kill_anon_super,\n};\n\nstatic int __init init(void)\n{\n\tint i = register_filesystem(&futex_fs_type);\n\n\tif (i)\n\t\treturn i;\n\n\tfutex_mnt = kern_mount(&futex_fs_type);\n\tif (IS_ERR(futex_mnt)) {\n\t\tunregister_filesystem(&futex_fs_type);\n\t\treturn PTR_ERR(futex_mnt);\n\t}\n\n\tfor (i = 0; i < ARRAY_SIZE(futex_queues); i++) {\n\t\tplist_head_init(&futex_queues[i].chain, &futex_queues[i].lock);\n\t\tspin_lock_init(&futex_queues[i].lock);\n\t}\n\treturn 0;\n}\n__initcall(init);\n/*\n * linux/kernel/futex_compat.c\n *\n * Futex compatibililty routines.\n *\n * Copyright 2006, Red Hat, Inc., Ingo Molnar\n */\n\n#include <linux/linkage.h>\n#include <linux/compat.h>\n#include <linux/futex.h>\n\n#include <asm/uaccess.h>\n\n\n/*\n * Fetch a robust-list pointer. Bit 0 signals PI futexes:\n */\nstatic inline int\nfetch_robust_entry(compat_uptr_t *uentry, struct robust_list __user **entry,\n\t\t compat_uptr_t __user *head, int *pi)\n{\n\tif (get_user(*uentry, head))\n\t\treturn -EFAULT;\n\n\t*entry = compat_ptr((*uentry) & ~1);\n\t*pi = (unsigned int)(*uentry) & 1;\n\n\treturn 0;\n}\n\nstatic void __user *futex_uaddr(struct robust_list *entry,\n\t\t\t\tcompat_long_t futex_offset)\n{\n\tcompat_uptr_t base = ptr_to_compat(entry);\n\tvoid __user *uaddr = compat_ptr(base + futex_offset);\n\n\treturn uaddr;\n}\n\n/*\n * Walk curr->robust_list (very carefully, it's a userspace list!)\n * and mark any locks found there dead, and notify any waiters.\n *\n * We silently return on any sign of list-walking problem.\n */\nvoid compat_exit_robust_list(struct task_struct *curr)\n{\n\tstruct compat_robust_list_head __user *head = curr->compat_robust_list;\n\tstruct robust_list __user *entry, *pending;\n\tunsigned int limit = ROBUST_LIST_LIMIT, pi, pip;\n\tcompat_uptr_t uentry, upending;\n\tcompat_long_t futex_offset;\n\n\t/*\n\t * Fetch the list head (which was registered earlier, via\n\t * sys_set_robust_list()):\n\t */\n\tif (fetch_robust_entry(&uentry, &entry, &head->list.next, &pi))\n\t\treturn;\n\t/*\n\t * Fetch the relative futex offset:\n\t */\n\tif (get_user(futex_offset, &head->futex_offset))\n\t\treturn;\n\t/*\n\t * Fetch any possibly pending lock-add first, and handle it\n\t * if it exists:\n\t */\n\tif (fetch_robust_entry(&upending, &pending,\n\t\t\t &head->list_op_pending, &pip))\n\t\treturn;\n\tif (pending) {\n\t\tvoid __user *uaddr = futex_uaddr(pending,\n\t\t\t\t\t\t futex_offset);\n\t\thandle_futex_death(uaddr, curr, pip);\n\t}\n\n\twhile (entry != (struct robust_list __user *) &head->list) {\n\t\t/*\n\t\t * A pending lock might already be on the list, so\n\t\t * dont process it twice:\n\t\t */\n\t\tif (entry != pending) {\n\t\t\tvoid __user *uaddr = futex_uaddr(entry,\n\t\t\t\t\t\t\t futex_offset);\n\t\t\tif (handle_futex_death(uaddr, curr, pi))\n\t\t\t\treturn;\n\t\t}\n\n\t\t/*\n\t\t * Fetch the next entry in the list:\n\t\t */\n\t\tif (fetch_robust_entry(&uentry, &entry,\n\t\t\t\t (compat_uptr_t __user *)&entry->next, &pi))\n\t\t\treturn;\n\t\t/*\n\t\t * Avoid excessively long or circular lists:\n\t\t */\n\t\tif (!--limit)\n\t\t\tbreak;\n\n\t\tcond_resched();\n\t}\n}\n\nasmlinkage long\ncompat_sys_set_robust_list(struct compat_robust_list_head __user *head,\n\t\t\t compat_size_t len)\n{\n\tif (unlikely(len != sizeof(*head)))\n\t\treturn -EINVAL;\n\n\tcurrent->compat_robust_list = head;\n\n\treturn 0;\n}\n\nasmlinkage long\ncompat_sys_get_robust_list(int pid, compat_uptr_t __user *head_ptr,\n\t\t\t compat_size_t __user *len_ptr)\n{\n\tstruct compat_robust_list_head __user *head;\n\tunsigned long ret;\n\n\tif (!pid)\n\t\thead = current->compat_robust_list;\n\telse {\n\t\tstruct task_struct *p;\n\n\t\tret = -ESRCH;\n\t\tread_lock(&tasklist_lock);\n\t\tp = find_task_by_pid(pid);\n\t\tif (!p)\n\t\t\tgoto err_unlock;\n\t\tret = -EPERM;\n\t\tif ((current->euid != p->euid) && (current->euid != p->uid) &&\n\t\t\t\t!capable(CAP_SYS_PTRACE))\n\t\t\tgoto err_unlock;\n\t\thead = p->compat_robust_list;\n\t\tread_unlock(&tasklist_lock);\n\t}\n\n\tif (put_user(sizeof(*head), len_ptr))\n\t\treturn -EFAULT;\n\treturn put_user(ptr_to_compat(head), head_ptr);\n\nerr_unlock:\n\tread_unlock(&tasklist_lock);\n\n\treturn ret;\n}\n\nasmlinkage long compat_sys_futex(u32 __user *uaddr, int op, u32 val,\n\t\tstruct compat_timespec __user *utime, u32 __user *uaddr2,\n\t\tu32 val3)\n{\n\tstruct timespec ts;\n\tktime_t t, *tp = NULL;\n\tint val2 = 0;\n\tint cmd = op & FUTEX_CMD_MASK;\n\n\tif (utime && (cmd == FUTEX_WAIT || cmd == FUTEX_LOCK_PI)) {\n\t\tif (get_compat_timespec(&ts, utime))\n\t\t\treturn -EFAULT;\n\t\tif (!timespec_valid(&ts))\n\t\t\treturn -EINVAL;\n\n\t\tt = timespec_to_ktime(ts);\n\t\tif (cmd == FUTEX_WAIT)\n\t\t\tt = ktime_add(ktime_get(), t);\n\t\ttp = &t;\n\t}\n\tif (cmd == FUTEX_REQUEUE || cmd == FUTEX_CMP_REQUEUE)\n\t\tval2 = (int) (unsigned long) utime;\n\n\treturn do_futex(uaddr, op, val, tp, uaddr2, val2, val3);\n}\n/*\n * linux/kernel/hrtimer.c\n *\n * Copyright(C) 2005-2006, Thomas Gleixner <tglx@linutronix.de>\n * Copyright(C) 2005-2007, Red Hat, Inc., Ingo Molnar\n * Copyright(C) 2006-2007 Timesys Corp., Thomas Gleixner\n *\n * High-resolution kernel timers\n *\n * In contrast to the low-resolution timeout API implemented in\n * kernel/timer.c, hrtimers provide finer resolution and accuracy\n * depending on system configuration and capabilities.\n *\n * These timers are currently used for:\n * - itimers\n * - POSIX timers\n * - nanosleep\n * - precise in-kernel timing\n *\n * Started by: Thomas Gleixner and Ingo Molnar\n *\n * Credits:\n *\tbased on kernel/timer.c\n *\n *\tHelp, testing, suggestions, bugfixes, improvements were\n *\tprovided by:\n *\n *\tGeorge Anzinger, Andrew Morton, Steven Rostedt, Roman Zippel\n *\tet. al.\n *\n * For licencing details see kernel-base/COPYING\n */\n\n#include <linux/cpu.h>\n#include <linux/irq.h>\n#include <linux/module.h>\n#include <linux/percpu.h>\n#include <linux/hrtimer.h>\n#include <linux/notifier.h>\n#include <linux/syscalls.h>\n#include <linux/kallsyms.h>\n#include <linux/interrupt.h>\n#include <linux/tick.h>\n#include <linux/seq_file.h>\n#include <linux/err.h>\n\n#include <asm/uaccess.h>\n\n/**\n * ktime_get - get the monotonic time in ktime_t format\n *\n * returns the time in ktime_t format\n */\nktime_t ktime_get(void)\n{\n\tstruct timespec now;\n\n\tktime_get_ts(&now);\n\n\treturn timespec_to_ktime(now);\n}\nEXPORT_SYMBOL_GPL(ktime_get);\n\n/**\n * ktime_get_real - get the real (wall-) time in ktime_t format\n *\n * returns the time in ktime_t format\n */\nktime_t ktime_get_real(void)\n{\n\tstruct timespec now;\n\n\tgetnstimeofday(&now);\n\n\treturn timespec_to_ktime(now);\n}\n\nEXPORT_SYMBOL_GPL(ktime_get_real);\n\n/*\n * The timer bases:\n *\n * Note: If we want to add new timer bases, we have to skip the two\n * clock ids captured by the cpu-timers. We do this by holding empty\n * entries rather than doing math adjustment of the clock ids.\n * This ensures that we capture erroneous accesses to these clock ids\n * rather than moving them into the range of valid clock id's.\n */\nDEFINE_PER_CPU(struct hrtimer_cpu_base, hrtimer_bases) =\n{\n\n\t.clock_base =\n\t{\n\t\t{\n\t\t\t.index = CLOCK_REALTIME,\n\t\t\t.get_time = &ktime_get_real,\n\t\t\t.resolution = KTIME_LOW_RES,\n\t\t},\n\t\t{\n\t\t\t.index = CLOCK_MONOTONIC,\n\t\t\t.get_time = &ktime_get,\n\t\t\t.resolution = KTIME_LOW_RES,\n\t\t},\n\t}\n};\n\n/**\n * ktime_get_ts - get the monotonic clock in timespec format\n * @ts:\t\tpointer to timespec variable\n *\n * The function calculates the monotonic clock from the realtime\n * clock and the wall_to_monotonic offset and stores the result\n * in normalized timespec format in the variable pointed to by @ts.\n */\nvoid ktime_get_ts(struct timespec *ts)\n{\n\tstruct timespec tomono;\n\tunsigned long seq;\n\n\tdo {\n\t\tseq = read_seqbegin(&xtime_lock);\n\t\tgetnstimeofday(ts);\n\t\ttomono = wall_to_monotonic;\n\n\t} while (read_seqretry(&xtime_lock, seq));\n\n\tset_normalized_timespec(ts, ts->tv_sec + tomono.tv_sec,\n\t\t\t\tts->tv_nsec + tomono.tv_nsec);\n}\nEXPORT_SYMBOL_GPL(ktime_get_ts);\n\n/*\n * Get the coarse grained time at the softirq based on xtime and\n * wall_to_monotonic.\n */\nstatic void hrtimer_get_softirq_time(struct hrtimer_cpu_base *base)\n{\n\tktime_t xtim, tomono;\n\tstruct timespec xts, tom;\n\tunsigned long seq;\n\n\tdo {\n\t\tseq = read_seqbegin(&xtime_lock);\n#ifdef CONFIG_NO_HZ\n\t\tgetnstimeofday(&xts);\n#else\n\t\txts = xtime;\n#endif\n\t\ttom = wall_to_monotonic;\n\t} while (read_seqretry(&xtime_lock, seq));\n\n\txtim = timespec_to_ktime(xts);\n\ttomono = timespec_to_ktime(tom);\n\tbase->clock_base[CLOCK_REALTIME].softirq_time = xtim;\n\tbase->clock_base[CLOCK_MONOTONIC].softirq_time =\n\t\tktime_add(xtim, tomono);\n}\n\n/*\n * Helper function to check, whether the timer is running the callback\n * function\n */\nstatic inline int hrtimer_callback_running(struct hrtimer *timer)\n{\n\treturn timer->state & HRTIMER_STATE_CALLBACK;\n}\n\n/*\n * Functions and macros which are different for UP/SMP systems are kept in a\n * single place\n */\n#ifdef CONFIG_SMP\n\n/*\n * We are using hashed locking: holding per_cpu(hrtimer_bases)[n].lock\n * means that all timers which are tied to this base via timer->base are\n * locked, and the base itself is locked too.\n *\n * So __run_timers/migrate_timers can safely modify all timers which could\n * be found on the lists/queues.\n *\n * When the timer's base is locked, and the timer removed from list, it is\n * possible to set timer->base = NULL and drop the lock: the timer remains\n * locked.\n */\nstatic\nstruct hrtimer_clock_base *lock_hrtimer_base(const struct hrtimer *timer,\n\t\t\t\t\t unsigned long *flags)\n{\n\tstruct hrtimer_clock_base *base;\n\n\tfor (;;) {\n\t\tbase = timer->base;\n\t\tif (likely(base != NULL)) {\n\t\t\tspin_lock_irqsave(&base->cpu_base->lock, *flags);\n\t\t\tif (likely(base == timer->base))\n\t\t\t\treturn base;\n\t\t\t/* The timer has migrated to another CPU: */\n\t\t\tspin_unlock_irqrestore(&base->cpu_base->lock, *flags);\n\t\t}\n\t\tcpu_relax();\n\t}\n}\n\n/*\n * Switch the timer base to the current CPU when possible.\n */\nstatic inline struct hrtimer_clock_base *\nswitch_hrtimer_base(struct hrtimer *timer, struct hrtimer_clock_base *base)\n{\n\tstruct hrtimer_clock_base *new_base;\n\tstruct hrtimer_cpu_base *new_cpu_base;\n\n\tnew_cpu_base = &__get_cpu_var(hrtimer_bases);\n\tnew_base = &new_cpu_base->clock_base[base->index];\n\n\tif (base != new_base) {\n\t\t/*\n\t\t * We are trying to schedule the timer on the local CPU.\n\t\t * However we can't change timer's base while it is running,\n\t\t * so we keep it on the same CPU. No hassle vs. reprogramming\n\t\t * the event source in the high resolution case. The softirq\n\t\t * code will take care of this when the timer function has\n\t\t * completed. There is no conflict as we hold the lock until\n\t\t * the timer is enqueued.\n\t\t */\n\t\tif (unlikely(hrtimer_callback_running(timer)))\n\t\t\treturn base;\n\n\t\t/* See the comment in lock_timer_base() */\n\t\ttimer->base = NULL;\n\t\tspin_unlock(&base->cpu_base->lock);\n\t\tspin_lock(&new_base->cpu_base->lock);\n\t\ttimer->base = new_base;\n\t}\n\treturn new_base;\n}\n\n#else /* CONFIG_SMP */\n\nstatic inline struct hrtimer_clock_base *\nlock_hrtimer_base(const struct hrtimer *timer, unsigned long *flags)\n{\n\tstruct hrtimer_clock_base *base = timer->base;\n\n\tspin_lock_irqsave(&base->cpu_base->lock, *flags);\n\n\treturn base;\n}\n\n# define switch_hrtimer_base(t, b)\t(b)\n\n#endif\t/* !CONFIG_SMP */\n\n/*\n * Functions for the union type storage format of ktime_t which are\n * too large for inlining:\n */\n#if BITS_PER_LONG < 64\n# ifndef CONFIG_KTIME_SCALAR\n/**\n * ktime_add_ns - Add a scalar nanoseconds value to a ktime_t variable\n * @kt:\t\taddend\n * @nsec:\tthe scalar nsec value to add\n *\n * Returns the sum of kt and nsec in ktime_t format\n */\nktime_t ktime_add_ns(const ktime_t kt, u64 nsec)\n{\n\tktime_t tmp;\n\n\tif (likely(nsec < NSEC_PER_SEC)) {\n\t\ttmp.tv64 = nsec;\n\t} else {\n\t\tunsigned long rem = do_div(nsec, NSEC_PER_SEC);\n\n\t\ttmp = ktime_set((long)nsec, rem);\n\t}\n\n\treturn ktime_add(kt, tmp);\n}\n\nEXPORT_SYMBOL_GPL(ktime_add_ns);\n# endif /* !CONFIG_KTIME_SCALAR */\n\n/*\n * Divide a ktime value by a nanosecond value\n */\nunsigned long ktime_divns(const ktime_t kt, s64 div)\n{\n\tu64 dclc, inc, dns;\n\tint sft = 0;\n\n\tdclc = dns = ktime_to_ns(kt);\n\tinc = div;\n\t/* Make sure the divisor is less than 2^32: */\n\twhile (div >> 32) {\n\t\tsft++;\n\t\tdiv >>= 1;\n\t}\n\tdclc >>= sft;\n\tdo_div(dclc, (unsigned long) div);\n\n\treturn (unsigned long) dclc;\n}\n#endif /* BITS_PER_LONG >= 64 */\n\n/* High resolution timer related functions */\n#ifdef CONFIG_HIGH_RES_TIMERS\n\n/*\n * High resolution timer enabled ?\n */\nstatic int hrtimer_hres_enabled __read_mostly = 1;\n\n/*\n * Enable / Disable high resolution mode\n */\nstatic int __init setup_hrtimer_hres(char *str)\n{\n\tif (!strcmp(str, \"off\"))\n\t\thrtimer_hres_enabled = 0;\n\telse if (!strcmp(str, \"on\"))\n\t\thrtimer_hres_enabled = 1;\n\telse\n\t\treturn 0;\n\treturn 1;\n}\n\n__setup(\"highres=\", setup_hrtimer_hres);\n\n/*\n * hrtimer_high_res_enabled - query, if the highres mode is enabled\n */\nstatic inline int hrtimer_is_hres_enabled(void)\n{\n\treturn hrtimer_hres_enabled;\n}\n\n/*\n * Is the high resolution mode active ?\n */\nstatic inline int hrtimer_hres_active(void)\n{\n\treturn __get_cpu_var(hrtimer_bases).hres_active;\n}\n\n/*\n * Reprogram the event source with checking both queues for the\n * next event\n * Called with interrupts disabled and base->lock held\n */\nstatic void hrtimer_force_reprogram(struct hrtimer_cpu_base *cpu_base)\n{\n\tint i;\n\tstruct hrtimer_clock_base *base = cpu_base->clock_base;\n\tktime_t expires;\n\n\tcpu_base->expires_next.tv64 = KTIME_MAX;\n\n\tfor (i = 0; i < HRTIMER_MAX_CLOCK_BASES; i++, base++) {\n\t\tstruct hrtimer *timer;\n\n\t\tif (!base->first)\n\t\t\tcontinue;\n\t\ttimer = rb_entry(base->first, struct hrtimer, node);\n\t\texpires = ktime_sub(timer->expires, base->offset);\n\t\tif (expires.tv64 < cpu_base->expires_next.tv64)\n\t\t\tcpu_base->expires_next = expires;\n\t}\n\n\tif (cpu_base->expires_next.tv64 != KTIME_MAX)\n\t\ttick_program_event(cpu_base->expires_next, 1);\n}\n\n/*\n * Shared reprogramming for clock_realtime and clock_monotonic\n *\n * When a timer is enqueued and expires earlier than the already enqueued\n * timers, we have to check, whether it expires earlier than the timer for\n * which the clock event device was armed.\n *\n * Called with interrupts disabled and base->cpu_base.lock held\n */\nstatic int hrtimer_reprogram(struct hrtimer *timer,\n\t\t\t struct hrtimer_clock_base *base)\n{\n\tktime_t *expires_next = &__get_cpu_var(hrtimer_bases).expires_next;\n\tktime_t expires = ktime_sub(timer->expires, base->offset);\n\tint res;\n\n\t/*\n\t * When the callback is running, we do not reprogram the clock event\n\t * device. The timer callback is either running on a different CPU or\n\t * the callback is executed in the hrtimer_interupt context. The\n\t * reprogramming is handled either by the softirq, which called the\n\t * callback or at the end of the hrtimer_interrupt.\n\t */\n\tif (hrtimer_callback_running(timer))\n\t\treturn 0;\n\n\tif (expires.tv64 >= expires_next->tv64)\n\t\treturn 0;\n\n\t/*\n\t * Clockevents returns -ETIME, when the event was in the past.\n\t */\n\tres = tick_program_event(expires, 0);\n\tif (!IS_ERR_VALUE(res))\n\t\t*expires_next = expires;\n\treturn res;\n}\n\n\n/*\n * Retrigger next event is called after clock was set\n *\n * Called with interrupts disabled via on_each_cpu()\n */\nstatic void retrigger_next_event(void *arg)\n{\n\tstruct hrtimer_cpu_base *base;\n\tstruct timespec realtime_offset;\n\tunsigned long seq;\n\n\tif (!hrtimer_hres_active())\n\t\treturn;\n\n\tdo {\n\t\tseq = read_seqbegin(&xtime_lock);\n\t\tset_normalized_timespec(&realtime_offset,\n\t\t\t\t\t-wall_to_monotonic.tv_sec,\n\t\t\t\t\t-wall_to_monotonic.tv_nsec);\n\t} while (read_seqretry(&xtime_lock, seq));\n\n\tbase = &__get_cpu_var(hrtimer_bases);\n\n\t/* Adjust CLOCK_REALTIME offset */\n\tspin_lock(&base->lock);\n\tbase->clock_base[CLOCK_REALTIME].offset =\n\t\ttimespec_to_ktime(realtime_offset);\n\n\thrtimer_force_reprogram(base);\n\tspin_unlock(&base->lock);\n}\n\n/*\n * Clock realtime was set\n *\n * Change the offset of the realtime clock vs. the monotonic\n * clock.\n *\n * We might have to reprogram the high resolution timer interrupt. On\n * SMP we call the architecture specific code to retrigger _all_ high\n * resolution timer interrupts. On UP we just disable interrupts and\n * call the high resolution interrupt code.\n */\nvoid clock_was_set(void)\n{\n\t/* Retrigger the CPU local events everywhere */\n\ton_each_cpu(retrigger_next_event, NULL, 0, 1);\n}\n\n/*\n * During resume we might have to reprogram the high resolution timer\n * interrupt (on the local CPU):\n */\nvoid hres_timers_resume(void)\n{\n\tWARN_ON_ONCE(num_online_cpus() > 1);\n\n\t/* Retrigger the CPU local events: */\n\tretrigger_next_event(NULL);\n}\n\n/*\n * Check, whether the timer is on the callback pending list\n */\nstatic inline int hrtimer_cb_pending(const struct hrtimer *timer)\n{\n\treturn timer->state & HRTIMER_STATE_PENDING;\n}\n\n/*\n * Remove a timer from the callback pending list\n */\nstatic inline void hrtimer_remove_cb_pending(struct hrtimer *timer)\n{\n\tlist_del_init(&timer->cb_entry);\n}\n\n/*\n * Initialize the high resolution related parts of cpu_base\n */\nstatic inline void hrtimer_init_hres(struct hrtimer_cpu_base *base)\n{\n\tbase->expires_next.tv64 = KTIME_MAX;\n\tbase->hres_active = 0;\n\tINIT_LIST_HEAD(&base->cb_pending);\n}\n\n/*\n * Initialize the high resolution related parts of a hrtimer\n */\nstatic inline void hrtimer_init_timer_hres(struct hrtimer *timer)\n{\n\tINIT_LIST_HEAD(&timer->cb_entry);\n}\n\n/*\n * When High resolution timers are active, try to reprogram. Note, that in case\n * the state has HRTIMER_STATE_CALLBACK set, no reprogramming and no expiry\n * check happens. The timer gets enqueued into the rbtree. The reprogramming\n * and expiry check is done in the hrtimer_interrupt or in the softirq.\n */\nstatic inline int hrtimer_enqueue_reprogram(struct hrtimer *timer,\n\t\t\t\t\t struct hrtimer_clock_base *base)\n{\n\tif (base->cpu_base->hres_active && hrtimer_reprogram(timer, base)) {\n\n\t\t/* Timer is expired, act upon the callback mode */\n\t\tswitch(timer->cb_mode) {\n\t\tcase HRTIMER_CB_IRQSAFE_NO_RESTART:\n\t\t\t/*\n\t\t\t * We can call the callback from here. No restart\n\t\t\t * happens, so no danger of recursion\n\t\t\t */\n\t\t\tBUG_ON(timer->function(timer) != HRTIMER_NORESTART);\n\t\t\treturn 1;\n\t\tcase HRTIMER_CB_IRQSAFE_NO_SOFTIRQ:\n\t\t\t/*\n\t\t\t * This is solely for the sched tick emulation with\n\t\t\t * dynamic tick support to ensure that we do not\n\t\t\t * restart the tick right on the edge and end up with\n\t\t\t * the tick timer in the softirq ! The calling site\n\t\t\t * takes care of this.\n\t\t\t */\n\t\t\treturn 1;\n\t\tcase HRTIMER_CB_IRQSAFE:\n\t\tcase HRTIMER_CB_SOFTIRQ:\n\t\t\t/*\n\t\t\t * Move everything else into the softirq pending list !\n\t\t\t */\n\t\t\tlist_add_tail(&timer->cb_entry,\n\t\t\t\t &base->cpu_base->cb_pending);\n\t\t\ttimer->state = HRTIMER_STATE_PENDING;\n\t\t\traise_softirq(HRTIMER_SOFTIRQ);\n\t\t\treturn 1;\n\t\tdefault:\n\t\t\tBUG();\n\t\t}\n\t}\n\treturn 0;\n}\n\n/*\n * Switch to high resolution mode\n */\nstatic int hrtimer_switch_to_hres(void)\n{\n\tstruct hrtimer_cpu_base *base = &__get_cpu_var(hrtimer_bases);\n\tunsigned long flags;\n\n\tif (base->hres_active)\n\t\treturn 1;\n\n\tlocal_irq_save(flags);\n\n\tif (tick_init_highres()) {\n\t\tlocal_irq_restore(flags);\n\t\treturn 0;\n\t}\n\tbase->hres_active = 1;\n\tbase->clock_base[CLOCK_REALTIME].resolution = KTIME_HIGH_RES;\n\tbase->clock_base[CLOCK_MONOTONIC].resolution = KTIME_HIGH_RES;\n\n\ttick_setup_sched_timer();\n\n\t/* \"Retrigger\" the interrupt to get things going */\n\tretrigger_next_event(NULL);\n\tlocal_irq_restore(flags);\n\tprintk(KERN_INFO \"Switched to high resolution mode on CPU %d\\n\",\n\t smp_processor_id());\n\treturn 1;\n}\n\n#else\n\nstatic inline int hrtimer_hres_active(void) { return 0; }\nstatic inline int hrtimer_is_hres_enabled(void) { return 0; }\nstatic inline int hrtimer_switch_to_hres(void) { return 0; }\nstatic inline void hrtimer_force_reprogram(struct hrtimer_cpu_base *base) { }\nstatic inline int hrtimer_enqueue_reprogram(struct hrtimer *timer,\n\t\t\t\t\t struct hrtimer_clock_base *base)\n{\n\treturn 0;\n}\nstatic inline int hrtimer_cb_pending(struct hrtimer *timer) { return 0; }\nstatic inline void hrtimer_remove_cb_pending(struct hrtimer *timer) { }\nstatic inline void hrtimer_init_hres(struct hrtimer_cpu_base *base) { }\nstatic inline void hrtimer_init_timer_hres(struct hrtimer *timer) { }\n\n#endif /* CONFIG_HIGH_RES_TIMERS */\n\n#ifdef CONFIG_TIMER_STATS\nvoid __timer_stats_hrtimer_set_start_info(struct hrtimer *timer, void *addr)\n{\n\tif (timer->start_site)\n\t\treturn;\n\n\ttimer->start_site = addr;\n\tmemcpy(timer->start_comm, current->comm, TASK_COMM_LEN);\n\ttimer->start_pid = current->pid;\n}\n#endif\n\n/*\n * Counterpart to lock_timer_base above:\n */\nstatic inline\nvoid unlock_hrtimer_base(const struct hrtimer *timer, unsigned long *flags)\n{\n\tspin_unlock_irqrestore(&timer->base->cpu_base->lock, *flags);\n}\n\n/**\n * hrtimer_forward - forward the timer expiry\n * @timer:\thrtimer to forward\n * @now:\tforward past this time\n * @interval:\tthe interval to forward\n *\n * Forward the timer expiry so it will expire in the future.\n * Returns the number of overruns.\n */\nunsigned long\nhrtimer_forward(struct hrtimer *timer, ktime_t now, ktime_t interval)\n{\n\tunsigned long orun = 1;\n\tktime_t delta;\n\n\tdelta = ktime_sub(now, timer->expires);\n\n\tif (delta.tv64 < 0)\n\t\treturn 0;\n\n\tif (interval.tv64 < timer->base->resolution.tv64)\n\t\tinterval.tv64 = timer->base->resolution.tv64;\n\n\tif (unlikely(delta.tv64 >= interval.tv64)) {\n\t\ts64 incr = ktime_to_ns(interval);\n\n\t\torun = ktime_divns(delta, incr);\n\t\ttimer->expires = ktime_add_ns(timer->expires, incr * orun);\n\t\tif (timer->expires.tv64 > now.tv64)\n\t\t\treturn orun;\n\t\t/*\n\t\t * This (and the ktime_add() below) is the\n\t\t * correction for exact:\n\t\t */\n\t\torun++;\n\t}\n\ttimer->expires = ktime_add(timer->expires, interval);\n\t/*\n\t * Make sure, that the result did not wrap with a very large\n\t * interval.\n\t */\n\tif (timer->expires.tv64 < 0)\n\t\ttimer->expires = ktime_set(KTIME_SEC_MAX, 0);\n\n\treturn orun;\n}\nEXPORT_SYMBOL_GPL(hrtimer_forward);\n\n/*\n * enqueue_hrtimer - internal function to (re)start a timer\n *\n * The timer is inserted in expiry order. Insertion into the\n * red black tree is O(log(n)). Must hold the base lock.\n */\nstatic void enqueue_hrtimer(struct hrtimer *timer,\n\t\t\t struct hrtimer_clock_base *base, int reprogram)\n{\n\tstruct rb_node **link = &base->active.rb_node;\n\tstruct rb_node *parent = NULL;\n\tstruct hrtimer *entry;\n\n\t/*\n\t * Find the right place in the rbtree:\n\t */\n\twhile (*link) {\n\t\tparent = *link;\n\t\tentry = rb_entry(parent, struct hrtimer, node);\n\t\t/*\n\t\t * We dont care about collisions. Nodes with\n\t\t * the same expiry time stay together.\n\t\t */\n\t\tif (timer->expires.tv64 < entry->expires.tv64)\n\t\t\tlink = &(*link)->rb_left;\n\t\telse\n\t\t\tlink = &(*link)->rb_right;\n\t}\n\n\t/*\n\t * Insert the timer to the rbtree and check whether it\n\t * replaces the first pending timer\n\t */\n\tif (!base->first || timer->expires.tv64 <\n\t rb_entry(base->first, struct hrtimer, node)->expires.tv64) {\n\t\t/*\n\t\t * Reprogram the clock event device. When the timer is already\n\t\t * expired hrtimer_enqueue_reprogram has either called the\n\t\t * callback or added it to the pending list and raised the\n\t\t * softirq.\n\t\t *\n\t\t * This is a NOP for !HIGHRES\n\t\t */\n\t\tif (reprogram && hrtimer_enqueue_reprogram(timer, base))\n\t\t\treturn;\n\n\t\tbase->first = &timer->node;\n\t}\n\n\trb_link_node(&timer->node, parent, link);\n\trb_insert_color(&timer->node, &base->active);\n\t/*\n\t * HRTIMER_STATE_ENQUEUED is or'ed to the current state to preserve the\n\t * state of a possibly running callback.\n\t */\n\ttimer->state |= HRTIMER_STATE_ENQUEUED;\n}\n\n/*\n * __remove_hrtimer - internal function to remove a timer\n *\n * Caller must hold the base lock.\n *\n * High resolution timer mode reprograms the clock event device when the\n * timer is the one which expires next. The caller can disable this by setting\n * reprogram to zero. This is useful, when the context does a reprogramming\n * anyway (e.g. timer interrupt)\n */\nstatic void __remove_hrtimer(struct hrtimer *timer,\n\t\t\t struct hrtimer_clock_base *base,\n\t\t\t unsigned long newstate, int reprogram)\n{\n\t/* High res. callback list. NOP for !HIGHRES */\n\tif (hrtimer_cb_pending(timer))\n\t\thrtimer_remove_cb_pending(timer);\n\telse {\n\t\t/*\n\t\t * Remove the timer from the rbtree and replace the\n\t\t * first entry pointer if necessary.\n\t\t */\n\t\tif (base->first == &timer->node) {\n\t\t\tbase->first = rb_next(&timer->node);\n\t\t\t/* Reprogram the clock event device. if enabled */\n\t\t\tif (reprogram && hrtimer_hres_active())\n\t\t\t\thrtimer_force_reprogram(base->cpu_base);\n\t\t}\n\t\trb_erase(&timer->node, &base->active);\n\t}\n\ttimer->state = newstate;\n}\n\n/*\n * remove hrtimer, called with base lock held\n */\nstatic inline int\nremove_hrtimer(struct hrtimer *timer, struct hrtimer_clock_base *base)\n{\n\tif (hrtimer_is_queued(timer)) {\n\t\tint reprogram;\n\n\t\t/*\n\t\t * Remove the timer and force reprogramming when high\n\t\t * resolution mode is active and the timer is on the current\n\t\t * CPU. If we remove a timer on another CPU, reprogramming is\n\t\t * skipped. The interrupt event on this CPU is fired and\n\t\t * reprogramming happens in the interrupt handler. This is a\n\t\t * rare case and less expensive than a smp call.\n\t\t */\n\t\ttimer_stats_hrtimer_clear_start_info(timer);\n\t\treprogram = base->cpu_base == &__get_cpu_var(hrtimer_bases);\n\t\t__remove_hrtimer(timer, base, HRTIMER_STATE_INACTIVE,\n\t\t\t\t reprogram);\n\t\treturn 1;\n\t}\n\treturn 0;\n}\n\n/**\n * hrtimer_start - (re)start an relative timer on the current CPU\n * @timer:\tthe timer to be added\n * @tim:\texpiry time\n * @mode:\texpiry mode: absolute (HRTIMER_ABS) or relative (HRTIMER_REL)\n *\n * Returns:\n * 0 on success\n * 1 when the timer was active\n */\nint\nhrtimer_start(struct hrtimer *timer, ktime_t tim, const enum hrtimer_mode mode)\n{\n\tstruct hrtimer_clock_base *base, *new_base;\n\tunsigned long flags;\n\tint ret;\n\n\tbase = lock_hrtimer_base(timer, &flags);\n\n\t/* Remove an active timer from the queue: */\n\tret = remove_hrtimer(timer, base);\n\n\t/* Switch the timer base, if necessary: */\n\tnew_base = switch_hrtimer_base(timer, base);\n\n\tif (mode == HRTIMER_MODE_REL) {\n\t\ttim = ktime_add(tim, new_base->get_time());\n\t\t/*\n\t\t * CONFIG_TIME_LOW_RES is a temporary way for architectures\n\t\t * to signal that they simply return xtime in\n\t\t * do_gettimeoffset(). In this case we want to round up by\n\t\t * resolution when starting a relative timer, to avoid short\n\t\t * timeouts. This will go away with the GTOD framework.\n\t\t */\n#ifdef CONFIG_TIME_LOW_RES\n\t\ttim = ktime_add(tim, base->resolution);\n#endif\n\t\t/*\n\t\t * Careful here: User space might have asked for a\n\t\t * very long sleep, so the add above might result in a\n\t\t * negative number, which enqueues the timer in front\n\t\t * of the queue.\n\t\t */\n\t\tif (tim.tv64 < 0)\n\t\t\ttim.tv64 = KTIME_MAX;\n\t}\n\ttimer->expires = tim;\n\n\ttimer_stats_hrtimer_set_start_info(timer);\n\n\t/*\n\t * Only allow reprogramming if the new base is on this CPU.\n\t * (it might still be on another CPU if the timer was pending)\n\t */\n\tenqueue_hrtimer(timer, new_base,\n\t\t\tnew_base->cpu_base == &__get_cpu_var(hrtimer_bases));\n\n\tunlock_hrtimer_base(timer, &flags);\n\n\treturn ret;\n}\nEXPORT_SYMBOL_GPL(hrtimer_start);\n\n/**\n * hrtimer_try_to_cancel - try to deactivate a timer\n * @timer:\thrtimer to stop\n *\n * Returns:\n * 0 when the timer was not active\n * 1 when the timer was active\n * -1 when the timer is currently excuting the callback function and\n * cannot be stopped\n */\nint hrtimer_try_to_cancel(struct hrtimer *timer)\n{\n\tstruct hrtimer_clock_base *base;\n\tunsigned long flags;\n\tint ret = -1;\n\n\tbase = lock_hrtimer_base(timer, &flags);\n\n\tif (!hrtimer_callback_running(timer))\n\t\tret = remove_hrtimer(timer, base);\n\n\tunlock_hrtimer_base(timer, &flags);\n\n\treturn ret;\n\n}\nEXPORT_SYMBOL_GPL(hrtimer_try_to_cancel);\n\n/**\n * hrtimer_cancel - cancel a timer and wait for the handler to finish.\n * @timer:\tthe timer to be cancelled\n *\n * Returns:\n * 0 when the timer was not active\n * 1 when the timer was active\n */\nint hrtimer_cancel(struct hrtimer *timer)\n{\n\tfor (;;) {\n\t\tint ret = hrtimer_try_to_cancel(timer);\n\n\t\tif (ret >= 0)\n\t\t\treturn ret;\n\t\tcpu_relax();\n\t}\n}\nEXPORT_SYMBOL_GPL(hrtimer_cancel);\n\n/**\n * hrtimer_get_remaining - get remaining time for the timer\n * @timer:\tthe timer to read\n */\nktime_t hrtimer_get_remaining(const struct hrtimer *timer)\n{\n\tstruct hrtimer_clock_base *base;\n\tunsigned long flags;\n\tktime_t rem;\n\n\tbase = lock_hrtimer_base(timer, &flags);\n\trem = ktime_sub(timer->expires, base->get_time());\n\tunlock_hrtimer_base(timer, &flags);\n\n\treturn rem;\n}\nEXPORT_SYMBOL_GPL(hrtimer_get_remaining);\n\n#if defined(CONFIG_NO_IDLE_HZ) || defined(CONFIG_NO_HZ)\n/**\n * hrtimer_get_next_event - get the time until next expiry event\n *\n * Returns the delta to the next expiry event or KTIME_MAX if no timer\n * is pending.\n */\nktime_t hrtimer_get_next_event(void)\n{\n\tstruct hrtimer_cpu_base *cpu_base = &__get_cpu_var(hrtimer_bases);\n\tstruct hrtimer_clock_base *base = cpu_base->clock_base;\n\tktime_t delta, mindelta = { .tv64 = KTIME_MAX };\n\tunsigned long flags;\n\tint i;\n\n\tspin_lock_irqsave(&cpu_base->lock, flags);\n\n\tif (!hrtimer_hres_active()) {\n\t\tfor (i = 0; i < HRTIMER_MAX_CLOCK_BASES; i++, base++) {\n\t\t\tstruct hrtimer *timer;\n\n\t\t\tif (!base->first)\n\t\t\t\tcontinue;\n\n\t\t\ttimer = rb_entry(base->first, struct hrtimer, node);\n\t\t\tdelta.tv64 = timer->expires.tv64;\n\t\t\tdelta = ktime_sub(delta, base->get_time());\n\t\t\tif (delta.tv64 < mindelta.tv64)\n\t\t\t\tmindelta.tv64 = delta.tv64;\n\t\t}\n\t}\n\n\tspin_unlock_irqrestore(&cpu_base->lock, flags);\n\n\tif (mindelta.tv64 < 0)\n\t\tmindelta.tv64 = 0;\n\treturn mindelta;\n}\n#endif\n\n/**\n * hrtimer_init - initialize a timer to the given clock\n * @timer:\tthe timer to be initialized\n * @clock_id:\tthe clock to be used\n * @mode:\ttimer mode abs/rel\n */\nvoid hrtimer_init(struct hrtimer *timer, clockid_t clock_id,\n\t\t enum hrtimer_mode mode)\n{\n\tstruct hrtimer_cpu_base *cpu_base;\n\n\tmemset(timer, 0, sizeof(struct hrtimer));\n\n\tcpu_base = &__raw_get_cpu_var(hrtimer_bases);\n\n\tif (clock_id == CLOCK_REALTIME && mode != HRTIMER_MODE_ABS)\n\t\tclock_id = CLOCK_MONOTONIC;\n\n\ttimer->base = &cpu_base->clock_base[clock_id];\n\thrtimer_init_timer_hres(timer);\n\n#ifdef CONFIG_TIMER_STATS\n\ttimer->start_site = NULL;\n\ttimer->start_pid = -1;\n\tmemset(timer->start_comm, 0, TASK_COMM_LEN);\n#endif\n}\nEXPORT_SYMBOL_GPL(hrtimer_init);\n\n/**\n * hrtimer_get_res - get the timer resolution for a clock\n * @which_clock: which clock to query\n * @tp:\t\t pointer to timespec variable to store the resolution\n *\n * Store the resolution of the clock selected by @which_clock in the\n * variable pointed to by @tp.\n */\nint hrtimer_get_res(const clockid_t which_clock, struct timespec *tp)\n{\n\tstruct hrtimer_cpu_base *cpu_base;\n\n\tcpu_base = &__raw_get_cpu_var(hrtimer_bases);\n\t*tp = ktime_to_timespec(cpu_base->clock_base[which_clock].resolution);\n\n\treturn 0;\n}\nEXPORT_SYMBOL_GPL(hrtimer_get_res);\n\n#ifdef CONFIG_HIGH_RES_TIMERS\n\n/*\n * High resolution timer interrupt\n * Called with interrupts disabled\n */\nvoid hrtimer_interrupt(struct clock_event_device *dev)\n{\n\tstruct hrtimer_cpu_base *cpu_base = &__get_cpu_var(hrtimer_bases);\n\tstruct hrtimer_clock_base *base;\n\tktime_t expires_next, now;\n\tint i, raise = 0;\n\n\tBUG_ON(!cpu_base->hres_active);\n\tcpu_base->nr_events++;\n\tdev->next_event.tv64 = KTIME_MAX;\n\n retry:\n\tnow = ktime_get();\n\n\texpires_next.tv64 = KTIME_MAX;\n\n\tbase = cpu_base->clock_base;\n\n\tfor (i = 0; i < HRTIMER_MAX_CLOCK_BASES; i++) {\n\t\tktime_t basenow;\n\t\tstruct rb_node *node;\n\n\t\tspin_lock(&cpu_base->lock);\n\n\t\tbasenow = ktime_add(now, base->offset);\n\n\t\twhile ((node = base->first)) {\n\t\t\tstruct hrtimer *timer;\n\n\t\t\ttimer = rb_entry(node, struct hrtimer, node);\n\n\t\t\tif (basenow.tv64 < timer->expires.tv64) {\n\t\t\t\tktime_t expires;\n\n\t\t\t\texpires = ktime_sub(timer->expires,\n\t\t\t\t\t\t base->offset);\n\t\t\t\tif (expires.tv64 < expires_next.tv64)\n\t\t\t\t\texpires_next = expires;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t/* Move softirq callbacks to the pending list */\n\t\t\tif (timer->cb_mode == HRTIMER_CB_SOFTIRQ) {\n\t\t\t\t__remove_hrtimer(timer, base,\n\t\t\t\t\t\t HRTIMER_STATE_PENDING, 0);\n\t\t\t\tlist_add_tail(&timer->cb_entry,\n\t\t\t\t\t &base->cpu_base->cb_pending);\n\t\t\t\traise = 1;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t__remove_hrtimer(timer, base,\n\t\t\t\t\t HRTIMER_STATE_CALLBACK, 0);\n\t\t\ttimer_stats_account_hrtimer(timer);\n\n\t\t\t/*\n\t\t\t * Note: We clear the CALLBACK bit after\n\t\t\t * enqueue_hrtimer to avoid reprogramming of\n\t\t\t * the event hardware. This happens at the end\n\t\t\t * of this function anyway.\n\t\t\t */\n\t\t\tif (timer->function(timer) != HRTIMER_NORESTART) {\n\t\t\t\tBUG_ON(timer->state != HRTIMER_STATE_CALLBACK);\n\t\t\t\tenqueue_hrtimer(timer, base, 0);\n\t\t\t}\n\t\t\ttimer->state &= ~HRTIMER_STATE_CALLBACK;\n\t\t}\n\t\tspin_unlock(&cpu_base->lock);\n\t\tbase++;\n\t}\n\n\tcpu_base->expires_next = expires_next;\n\n\t/* Reprogramming necessary ? */\n\tif (expires_next.tv64 != KTIME_MAX) {\n\t\tif (tick_program_event(expires_next, 0))\n\t\t\tgoto retry;\n\t}\n\n\t/* Raise softirq ? */\n\tif (raise)\n\t\traise_softirq(HRTIMER_SOFTIRQ);\n}\n\nstatic void run_hrtimer_softirq(struct softirq_action *h)\n{\n\tstruct hrtimer_cpu_base *cpu_base = &__get_cpu_var(hrtimer_bases);\n\n\tspin_lock_irq(&cpu_base->lock);\n\n\twhile (!list_empty(&cpu_base->cb_pending)) {\n\t\tenum hrtimer_restart (*fn)(struct hrtimer *);\n\t\tstruct hrtimer *timer;\n\t\tint restart;\n\n\t\ttimer = list_entry(cpu_base->cb_pending.next,\n\t\t\t\t struct hrtimer, cb_entry);\n\n\t\ttimer_stats_account_hrtimer(timer);\n\n\t\tfn = timer->function;\n\t\t__remove_hrtimer(timer, timer->base, HRTIMER_STATE_CALLBACK, 0);\n\t\tspin_unlock_irq(&cpu_base->lock);\n\n\t\trestart = fn(timer);\n\n\t\tspin_lock_irq(&cpu_base->lock);\n\n\t\ttimer->state &= ~HRTIMER_STATE_CALLBACK;\n\t\tif (restart == HRTIMER_RESTART) {\n\t\t\tBUG_ON(hrtimer_active(timer));\n\t\t\t/*\n\t\t\t * Enqueue the timer, allow reprogramming of the event\n\t\t\t * device\n\t\t\t */\n\t\t\tenqueue_hrtimer(timer, timer->base, 1);\n\t\t} else if (hrtimer_active(timer)) {\n\t\t\t/*\n\t\t\t * If the timer was rearmed on another CPU, reprogram\n\t\t\t * the event device.\n\t\t\t */\n\t\t\tif (timer->base->first == &timer->node)\n\t\t\t\thrtimer_reprogram(timer, timer->base);\n\t\t}\n\t}\n\tspin_unlock_irq(&cpu_base->lock);\n}\n\n#endif\t/* CONFIG_HIGH_RES_TIMERS */\n\n/*\n * Expire the per base hrtimer-queue:\n */\nstatic inline void run_hrtimer_queue(struct hrtimer_cpu_base *cpu_base,\n\t\t\t\t int index)\n{\n\tstruct rb_node *node;\n\tstruct hrtimer_clock_base *base = &cpu_base->clock_base[index];\n\n\tif (!base->first)\n\t\treturn;\n\n\tif (base->get_softirq_time)\n\t\tbase->softirq_time = base->get_softirq_time();\n\n\tspin_lock_irq(&cpu_base->lock);\n\n\twhile ((node = base->first)) {\n\t\tstruct hrtimer *timer;\n\t\tenum hrtimer_restart (*fn)(struct hrtimer *);\n\t\tint restart;\n\n\t\ttimer = rb_entry(node, struct hrtimer, node);\n\t\tif (base->softirq_time.tv64 <= timer->expires.tv64)\n\t\t\tbreak;\n\n#ifdef CONFIG_HIGH_RES_TIMERS\n\t\tWARN_ON_ONCE(timer->cb_mode == HRTIMER_CB_IRQSAFE_NO_SOFTIRQ);\n#endif\n\t\ttimer_stats_account_hrtimer(timer);\n\n\t\tfn = timer->function;\n\t\t__remove_hrtimer(timer, base, HRTIMER_STATE_CALLBACK, 0);\n\t\tspin_unlock_irq(&cpu_base->lock);\n\n\t\trestart = fn(timer);\n\n\t\tspin_lock_irq(&cpu_base->lock);\n\n\t\ttimer->state &= ~HRTIMER_STATE_CALLBACK;\n\t\tif (restart != HRTIMER_NORESTART) {\n\t\t\tBUG_ON(hrtimer_active(timer));\n\t\t\tenqueue_hrtimer(timer, base, 0);\n\t\t}\n\t}\n\tspin_unlock_irq(&cpu_base->lock);\n}\n\n/*\n * Called from timer softirq every jiffy, expire hrtimers:\n *\n * For HRT its the fall back code to run the softirq in the timer\n * softirq context in case the hrtimer initialization failed or has\n * not been done yet.\n */\nvoid hrtimer_run_queues(void)\n{\n\tstruct hrtimer_cpu_base *cpu_base = &__get_cpu_var(hrtimer_bases);\n\tint i;\n\n\tif (hrtimer_hres_active())\n\t\treturn;\n\n\t/*\n\t * This _is_ ugly: We have to check in the softirq context,\n\t * whether we can switch to highres and / or nohz mode. The\n\t * clocksource switch happens in the timer interrupt with\n\t * xtime_lock held. Notification from there only sets the\n\t * check bit in the tick_oneshot code, otherwise we might\n\t * deadlock vs. xtime_lock.\n\t */\n\tif (tick_check_oneshot_change(!hrtimer_is_hres_enabled()))\n\t\tif (hrtimer_switch_to_hres())\n\t\t\treturn;\n\n\thrtimer_get_softirq_time(cpu_base);\n\n\tfor (i = 0; i < HRTIMER_MAX_CLOCK_BASES; i++)\n\t\trun_hrtimer_queue(cpu_base, i);\n}\n\n/*\n * Sleep related functions:\n */\nstatic enum hrtimer_restart hrtimer_wakeup(struct hrtimer *timer)\n{\n\tstruct hrtimer_sleeper *t =\n\t\tcontainer_of(timer, struct hrtimer_sleeper, timer);\n\tstruct task_struct *task = t->task;\n\n\tt->task = NULL;\n\tif (task)\n\t\twake_up_process(task);\n\n\treturn HRTIMER_NORESTART;\n}\n\nvoid hrtimer_init_sleeper(struct hrtimer_sleeper *sl, struct task_struct *task)\n{\n\tsl->timer.function = hrtimer_wakeup;\n\tsl->task = task;\n#ifdef CONFIG_HIGH_RES_TIMERS\n\tsl->timer.cb_mode = HRTIMER_CB_IRQSAFE_NO_RESTART;\n#endif\n}\n\nstatic int __sched do_nanosleep(struct hrtimer_sleeper *t, enum hrtimer_mode mode)\n{\n\thrtimer_init_sleeper(t, current);\n\n\tdo {\n\t\tset_current_state(TASK_INTERRUPTIBLE);\n\t\thrtimer_start(&t->timer, t->timer.expires, mode);\n\n\t\tif (likely(t->task))\n\t\t\tschedule();\n\n\t\thrtimer_cancel(&t->timer);\n\t\tmode = HRTIMER_MODE_ABS;\n\n\t} while (t->task && !signal_pending(current));\n\n\treturn t->task == NULL;\n}\n\nlong __sched hrtimer_nanosleep_restart(struct restart_block *restart)\n{\n\tstruct hrtimer_sleeper t;\n\tstruct timespec __user *rmtp;\n\tstruct timespec tu;\n\tktime_t time;\n\n\trestart->fn = do_no_restart_syscall;\n\n\thrtimer_init(&t.timer, restart->arg0, HRTIMER_MODE_ABS);\n\tt.timer.expires.tv64 = ((u64)restart->arg3 << 32) | (u64) restart->arg2;\n\n\tif (do_nanosleep(&t, HRTIMER_MODE_ABS))\n\t\treturn 0;\n\n\trmtp = (struct timespec __user *) restart->arg1;\n\tif (rmtp) {\n\t\ttime = ktime_sub(t.timer.expires, t.timer.base->get_time());\n\t\tif (time.tv64 <= 0)\n\t\t\treturn 0;\n\t\ttu = ktime_to_timespec(time);\n\t\tif (copy_to_user(rmtp, &tu, sizeof(tu)))\n\t\t\treturn -EFAULT;\n\t}\n\n\trestart->fn = hrtimer_nanosleep_restart;\n\n\t/* The other values in restart are already filled in */\n\treturn -ERESTART_RESTARTBLOCK;\n}\n\nlong hrtimer_nanosleep(struct timespec *rqtp, struct timespec __user *rmtp,\n\t\t const enum hrtimer_mode mode, const clockid_t clockid)\n{\n\tstruct restart_block *restart;\n\tstruct hrtimer_sleeper t;\n\tstruct timespec tu;\n\tktime_t rem;\n\n\thrtimer_init(&t.timer, clockid, mode);\n\tt.timer.expires = timespec_to_ktime(*rqtp);\n\tif (do_nanosleep(&t, mode))\n\t\treturn 0;\n\n\t/* Absolute timers do not update the rmtp value and restart: */\n\tif (mode == HRTIMER_MODE_ABS)\n\t\treturn -ERESTARTNOHAND;\n\n\tif (rmtp) {\n\t\trem = ktime_sub(t.timer.expires, t.timer.base->get_time());\n\t\tif (rem.tv64 <= 0)\n\t\t\treturn 0;\n\t\ttu = ktime_to_timespec(rem);\n\t\tif (copy_to_user(rmtp, &tu, sizeof(tu)))\n\t\t\treturn -EFAULT;\n\t}\n\n\trestart = &current_thread_info()->restart_block;\n\trestart->fn = hrtimer_nanosleep_restart;\n\trestart->arg0 = (unsigned long) t.timer.base->index;\n\trestart->arg1 = (unsigned long) rmtp;\n\trestart->arg2 = t.timer.expires.tv64 & 0xFFFFFFFF;\n\trestart->arg3 = t.timer.expires.tv64 >> 32;\n\n\treturn -ERESTART_RESTARTBLOCK;\n}\n\nasmlinkage long\nsys_nanosleep(struct timespec __user *rqtp, struct timespec __user *rmtp)\n{\n\tstruct timespec tu;\n\n\tif (copy_from_user(&tu, rqtp, sizeof(tu)))\n\t\treturn -EFAULT;\n\n\tif (!timespec_valid(&tu))\n\t\treturn -EINVAL;\n\n\treturn hrtimer_nanosleep(&tu, rmtp, HRTIMER_MODE_REL, CLOCK_MONOTONIC);\n}\n\n/*\n * Functions related to boot-time initialization:\n */\nstatic void __devinit init_hrtimers_cpu(int cpu)\n{\n\tstruct hrtimer_cpu_base *cpu_base = &per_cpu(hrtimer_bases, cpu);\n\tint i;\n\n\tspin_lock_init(&cpu_base->lock);\n\tlockdep_set_class(&cpu_base->lock, &cpu_base->lock_key);\n\n\tfor (i = 0; i < HRTIMER_MAX_CLOCK_BASES; i++)\n\t\tcpu_base->clock_base[i].cpu_base = cpu_base;\n\n\thrtimer_init_hres(cpu_base);\n}\n\n#ifdef CONFIG_HOTPLUG_CPU\n\nstatic void migrate_hrtimer_list(struct hrtimer_clock_base *old_base,\n\t\t\t\tstruct hrtimer_clock_base *new_base)\n{\n\tstruct hrtimer *timer;\n\tstruct rb_node *node;\n\n\twhile ((node = rb_first(&old_base->active))) {\n\t\ttimer = rb_entry(node, struct hrtimer, node);\n\t\tBUG_ON(hrtimer_callback_running(timer));\n\t\t__remove_hrtimer(timer, old_base, HRTIMER_STATE_INACTIVE, 0);\n\t\ttimer->base = new_base;\n\t\t/*\n\t\t * Enqueue the timer. Allow reprogramming of the event device\n\t\t */\n\t\tenqueue_hrtimer(timer, new_base, 1);\n\t}\n}\n\nstatic void migrate_hrtimers(int cpu)\n{\n\tstruct hrtimer_cpu_base *old_base, *new_base;\n\tint i;\n\n\tBUG_ON(cpu_online(cpu));\n\told_base = &per_cpu(hrtimer_bases, cpu);\n\tnew_base = &get_cpu_var(hrtimer_bases);\n\n\ttick_cancel_sched_timer(cpu);\n\n\tlocal_irq_disable();\n\tdouble_spin_lock(&new_base->lock, &old_base->lock,\n\t\t\t smp_processor_id() < cpu);\n\n\tfor (i = 0; i < HRTIMER_MAX_CLOCK_BASES; i++) {\n\t\tmigrate_hrtimer_list(&old_base->clock_base[i],\n\t\t\t\t &new_base->clock_base[i]);\n\t}\n\n\tdouble_spin_unlock(&new_base->lock, &old_base->lock,\n\t\t\t smp_processor_id() < cpu);\n\tlocal_irq_enable();\n\tput_cpu_var(hrtimer_bases);\n}\n#endif /* CONFIG_HOTPLUG_CPU */\n\nstatic int __cpuinit hrtimer_cpu_notify(struct notifier_block *self,\n\t\t\t\t\tunsigned long action, void *hcpu)\n{\n\tunsigned int cpu = (long)hcpu;\n\n\tswitch (action) {\n\n\tcase CPU_UP_PREPARE:\n\tcase CPU_UP_PREPARE_FROZEN:\n\t\tinit_hrtimers_cpu(cpu);\n\t\tbreak;\n\n#ifdef CONFIG_HOTPLUG_CPU\n\tcase CPU_DEAD:\n\tcase CPU_DEAD_FROZEN:\n\t\tclockevents_notify(CLOCK_EVT_NOTIFY_CPU_DEAD, &cpu);\n\t\tmigrate_hrtimers(cpu);\n\t\tbreak;\n#endif\n\n\tdefault:\n\t\tbreak;\n\t}\n\n\treturn NOTIFY_OK;\n}\n\nstatic struct notifier_block __cpuinitdata hrtimers_nb = {\n\t.notifier_call = hrtimer_cpu_notify,\n};\n\nvoid __init hrtimers_init(void)\n{\n\thrtimer_cpu_notify(&hrtimers_nb, (unsigned long)CPU_UP_PREPARE,\n\t\t\t (void *)(long)smp_processor_id());\n\tregister_cpu_notifier(&hrtimers_nb);\n#ifdef CONFIG_HIGH_RES_TIMERS\n\topen_softirq(HRTIMER_SOFTIRQ, run_hrtimer_softirq, NULL);\n#endif\n}\n\n/*\n * linux/kernel/itimer.c\n *\n * Copyright (C) 1992 Darren Senn\n */\n\n/* These are all the functions necessary to implement itimers */\n\n#include <linux/mm.h>\n#include <linux/interrupt.h>\n#include <linux/syscalls.h>\n#include <linux/time.h>\n#include <linux/posix-timers.h>\n#include <linux/hrtimer.h>\n\n#include <asm/uaccess.h>\n\n/**\n * itimer_get_remtime - get remaining time for the timer\n *\n * @timer: the timer to read\n *\n * Returns the delta between the expiry time and now, which can be\n * less than zero or 1usec for an pending expired timer\n */\nstatic struct timeval itimer_get_remtime(struct hrtimer *timer)\n{\n\tktime_t rem = hrtimer_get_remaining(timer);\n\n\t/*\n\t * Racy but safe: if the itimer expires after the above\n\t * hrtimer_get_remtime() call but before this condition\n\t * then we return 0 - which is correct.\n\t */\n\tif (hrtimer_active(timer)) {\n\t\tif (rem.tv64 <= 0)\n\t\t\trem.tv64 = NSEC_PER_USEC;\n\t} else\n\t\trem.tv64 = 0;\n\n\treturn ktime_to_timeval(rem);\n}\n\nint do_getitimer(int which, struct itimerval *value)\n{\n\tstruct task_struct *tsk = current;\n\tcputime_t cinterval, cval;\n\n\tswitch (which) {\n\tcase ITIMER_REAL:\n\t\tspin_lock_irq(&tsk->sighand->siglock);\n\t\tvalue->it_value = itimer_get_remtime(&tsk->signal->real_timer);\n\t\tvalue->it_interval =\n\t\t\tktime_to_timeval(tsk->signal->it_real_incr);\n\t\tspin_unlock_irq(&tsk->sighand->siglock);\n\t\tbreak;\n\tcase ITIMER_VIRTUAL:\n\t\tread_lock(&tasklist_lock);\n\t\tspin_lock_irq(&tsk->sighand->siglock);\n\t\tcval = tsk->signal->it_virt_expires;\n\t\tcinterval = tsk->signal->it_virt_incr;\n\t\tif (!cputime_eq(cval, cputime_zero)) {\n\t\t\tstruct task_struct *t = tsk;\n\t\t\tcputime_t utime = tsk->signal->utime;\n\t\t\tdo {\n\t\t\t\tutime = cputime_add(utime, t->utime);\n\t\t\t\tt = next_thread(t);\n\t\t\t} while (t != tsk);\n\t\t\tif (cputime_le(cval, utime)) { /* about to fire */\n\t\t\t\tcval = jiffies_to_cputime(1);\n\t\t\t} else {\n\t\t\t\tcval = cputime_sub(cval, utime);\n\t\t\t}\n\t\t}\n\t\tspin_unlock_irq(&tsk->sighand->siglock);\n\t\tread_unlock(&tasklist_lock);\n\t\tcputime_to_timeval(cval, &value->it_value);\n\t\tcputime_to_timeval(cinterval, &value->it_interval);\n\t\tbreak;\n\tcase ITIMER_PROF:\n\t\tread_lock(&tasklist_lock);\n\t\tspin_lock_irq(&tsk->sighand->siglock);\n\t\tcval = tsk->signal->it_prof_expires;\n\t\tcinterval = tsk->signal->it_prof_incr;\n\t\tif (!cputime_eq(cval, cputime_zero)) {\n\t\t\tstruct task_struct *t = tsk;\n\t\t\tcputime_t ptime = cputime_add(tsk->signal->utime,\n\t\t\t\t\t\t tsk->signal->stime);\n\t\t\tdo {\n\t\t\t\tptime = cputime_add(ptime,\n\t\t\t\t\t\t cputime_add(t->utime,\n\t\t\t\t\t\t\t\tt->stime));\n\t\t\t\tt = next_thread(t);\n\t\t\t} while (t != tsk);\n\t\t\tif (cputime_le(cval, ptime)) { /* about to fire */\n\t\t\t\tcval = jiffies_to_cputime(1);\n\t\t\t} else {\n\t\t\t\tcval = cputime_sub(cval, ptime);\n\t\t\t}\n\t\t}\n\t\tspin_unlock_irq(&tsk->sighand->siglock);\n\t\tread_unlock(&tasklist_lock);\n\t\tcputime_to_timeval(cval, &value->it_value);\n\t\tcputime_to_timeval(cinterval, &value->it_interval);\n\t\tbreak;\n\tdefault:\n\t\treturn(-EINVAL);\n\t}\n\treturn 0;\n}\n\nasmlinkage long sys_getitimer(int which, struct itimerval __user *value)\n{\n\tint error = -EFAULT;\n\tstruct itimerval get_buffer;\n\n\tif (value) {\n\t\terror = do_getitimer(which, &get_buffer);\n\t\tif (!error &&\n\t\t copy_to_user(value, &get_buffer, sizeof(get_buffer)))\n\t\t\terror = -EFAULT;\n\t}\n\treturn error;\n}\n\n\n/*\n * The timer is automagically restarted, when interval != 0\n */\nenum hrtimer_restart it_real_fn(struct hrtimer *timer)\n{\n\tstruct signal_struct *sig =\n\t container_of(timer, struct signal_struct, real_timer);\n\n\tsend_group_sig_info(SIGALRM, SEND_SIG_PRIV, sig->tsk);\n\n\treturn HRTIMER_NORESTART;\n}\n\n/*\n * Returns true if the timeval is in canonical form\n */\n#define timeval_valid(t) \\\n\t(((t)->tv_sec >= 0) && (((unsigned long) (t)->tv_usec) < USEC_PER_SEC))\n\nint do_setitimer(int which, struct itimerval *value, struct itimerval *ovalue)\n{\n\tstruct task_struct *tsk = current;\n\tstruct hrtimer *timer;\n\tktime_t expires;\n\tcputime_t cval, cinterval, nval, ninterval;\n\n\t/*\n\t * Validate the timevals in value.\n\t */\n\tif (!timeval_valid(&value->it_value) ||\n\t !timeval_valid(&value->it_interval))\n\t\treturn -EINVAL;\n\n\tswitch (which) {\n\tcase ITIMER_REAL:\nagain:\n\t\tspin_lock_irq(&tsk->sighand->siglock);\n\t\ttimer = &tsk->signal->real_timer;\n\t\tif (ovalue) {\n\t\t\tovalue->it_value = itimer_get_remtime(timer);\n\t\t\tovalue->it_interval\n\t\t\t\t= ktime_to_timeval(tsk->signal->it_real_incr);\n\t\t}\n\t\t/* We are sharing ->siglock with it_real_fn() */\n\t\tif (hrtimer_try_to_cancel(timer) < 0) {\n\t\t\tspin_unlock_irq(&tsk->sighand->siglock);\n\t\t\tgoto again;\n\t\t}\n\t\texpires = timeval_to_ktime(value->it_value);\n\t\tif (expires.tv64 != 0) {\n\t\t\ttsk->signal->it_real_incr =\n\t\t\t\ttimeval_to_ktime(value->it_interval);\n\t\t\thrtimer_start(timer, expires, HRTIMER_MODE_REL);\n\t\t} else\n\t\t\ttsk->signal->it_real_incr.tv64 = 0;\n\n\t\tspin_unlock_irq(&tsk->sighand->siglock);\n\t\tbreak;\n\tcase ITIMER_VIRTUAL:\n\t\tnval = timeval_to_cputime(&value->it_value);\n\t\tninterval = timeval_to_cputime(&value->it_interval);\n\t\tread_lock(&tasklist_lock);\n\t\tspin_lock_irq(&tsk->sighand->siglock);\n\t\tcval = tsk->signal->it_virt_expires;\n\t\tcinterval = tsk->signal->it_virt_incr;\n\t\tif (!cputime_eq(cval, cputime_zero) ||\n\t\t !cputime_eq(nval, cputime_zero)) {\n\t\t\tif (cputime_gt(nval, cputime_zero))\n\t\t\t\tnval = cputime_add(nval,\n\t\t\t\t\t\t jiffies_to_cputime(1));\n\t\t\tset_process_cpu_timer(tsk, CPUCLOCK_VIRT,\n\t\t\t\t\t &nval, &cval);\n\t\t}\n\t\ttsk->signal->it_virt_expires = nval;\n\t\ttsk->signal->it_virt_incr = ninterval;\n\t\tspin_unlock_irq(&tsk->sighand->siglock);\n\t\tread_unlock(&tasklist_lock);\n\t\tif (ovalue) {\n\t\t\tcputime_to_timeval(cval, &ovalue->it_value);\n\t\t\tcputime_to_timeval(cinterval, &ovalue->it_interval);\n\t\t}\n\t\tbreak;\n\tcase ITIMER_PROF:\n\t\tnval = timeval_to_cputime(&value->it_value);\n\t\tninterval = timeval_to_cputime(&value->it_interval);\n\t\tread_lock(&tasklist_lock);\n\t\tspin_lock_irq(&tsk->sighand->siglock);\n\t\tcval = tsk->signal->it_prof_expires;\n\t\tcinterval = tsk->signal->it_prof_incr;\n\t\tif (!cputime_eq(cval, cputime_zero) ||\n\t\t !cputime_eq(nval, cputime_zero)) {\n\t\t\tif (cputime_gt(nval, cputime_zero))\n\t\t\t\tnval = cputime_add(nval,\n\t\t\t\t\t\t jiffies_to_cputime(1));\n\t\t\tset_process_cpu_timer(tsk, CPUCLOCK_PROF,\n\t\t\t\t\t &nval, &cval);\n\t\t}\n\t\ttsk->signal->it_prof_expires = nval;\n\t\ttsk->signal->it_prof_incr = ninterval;\n\t\tspin_unlock_irq(&tsk->sighand->siglock);\n\t\tread_unlock(&tasklist_lock);\n\t\tif (ovalue) {\n\t\t\tcputime_to_timeval(cval, &ovalue->it_value);\n\t\t\tcputime_to_timeval(cinterval, &ovalue->it_interval);\n\t\t}\n\t\tbreak;\n\tdefault:\n\t\treturn -EINVAL;\n\t}\n\treturn 0;\n}\n\n/**\n * alarm_setitimer - set alarm in seconds\n *\n * @seconds:\tnumber of seconds until alarm\n *\t\t0 disables the alarm\n *\n * Returns the remaining time in seconds of a pending timer or 0 when\n * the timer is not active.\n *\n * On 32 bit machines the seconds value is limited to (INT_MAX/2) to avoid\n * negative timeval settings which would cause immediate expiry.\n */\nunsigned int alarm_setitimer(unsigned int seconds)\n{\n\tstruct itimerval it_new, it_old;\n\n#if BITS_PER_LONG < 64\n\tif (seconds > INT_MAX)\n\t\tseconds = INT_MAX;\n#endif\n\tit_new.it_value.tv_sec = seconds;\n\tit_new.it_value.tv_usec = 0;\n\tit_new.it_interval.tv_sec = it_new.it_interval.tv_usec = 0;\n\n\tdo_setitimer(ITIMER_REAL, &it_new, &it_old);\n\n\t/*\n\t * We can't return 0 if we have an alarm pending ... And we'd\n\t * better return too much than too little anyway\n\t */\n\tif ((!it_old.it_value.tv_sec && it_old.it_value.tv_usec) ||\n\t it_old.it_value.tv_usec >= 500000)\n\t\tit_old.it_value.tv_sec++;\n\n\treturn it_old.it_value.tv_sec;\n}\n\nasmlinkage long sys_setitimer(int which,\n\t\t\t struct itimerval __user *value,\n\t\t\t struct itimerval __user *ovalue)\n{\n\tstruct itimerval set_buffer, get_buffer;\n\tint error;\n\n\tif (value) {\n\t\tif(copy_from_user(&set_buffer, value, sizeof(set_buffer)))\n\t\t\treturn -EFAULT;\n\t} else\n\t\tmemset((char *) &set_buffer, 0, sizeof(set_buffer));\n\n\terror = do_setitimer(which, &set_buffer, ovalue ? &get_buffer : NULL);\n\tif (error || !ovalue)\n\t\treturn error;\n\n\tif (copy_to_user(ovalue, &get_buffer, sizeof(get_buffer)))\n\t\treturn -EFAULT; \n\treturn 0;\n}\n/*\n * kallsyms.c: in-kernel printing of symbolic oopses and stack traces.\n *\n * Rewritten and vastly simplified by Rusty Russell for in-kernel\n * module loader:\n * Copyright 2002 Rusty Russell <rusty@rustcorp.com.au> IBM Corporation\n *\n * ChangeLog:\n *\n * (25/Aug/2004) Paulo Marques <pmarques@grupopie.com>\n * Changed the compression method from stem compression to \"table lookup\"\n * compression (see scripts/kallsyms.c for a more complete description)\n */\n#include <linux/kallsyms.h>\n#include <linux/module.h>\n#include <linux/init.h>\n#include <linux/seq_file.h>\n#include <linux/fs.h>\n#include <linux/err.h>\n#include <linux/proc_fs.h>\n#include <linux/sched.h>\t/* for cond_resched */\n#include <linux/mm.h>\n#include <linux/ctype.h>\n\n#include <asm/sections.h>\n\n#ifdef CONFIG_KALLSYMS_ALL\n#define all_var 1\n#else\n#define all_var 0\n#endif\n\n/* These will be re-linked against their real values during the second link stage */\nextern const unsigned long kallsyms_addresses[] __attribute__((weak));\nextern const unsigned long kallsyms_num_syms __attribute__((weak));\nextern const u8 kallsyms_names[] __attribute__((weak));\n\nextern const u8 kallsyms_token_table[] __attribute__((weak));\nextern const u16 kallsyms_token_index[] __attribute__((weak));\n\nextern const unsigned long kallsyms_markers[] __attribute__((weak));\n\nstatic inline int is_kernel_inittext(unsigned long addr)\n{\n\tif (addr >= (unsigned long)_sinittext\n\t && addr <= (unsigned long)_einittext)\n\t\treturn 1;\n\treturn 0;\n}\n\nstatic inline int is_kernel_extratext(unsigned long addr)\n{\n\tif (addr >= (unsigned long)_sextratext\n\t && addr <= (unsigned long)_eextratext)\n\t\treturn 1;\n\treturn 0;\n}\n\nstatic inline int is_kernel_text(unsigned long addr)\n{\n\tif (addr >= (unsigned long)_stext && addr <= (unsigned long)_etext)\n\t\treturn 1;\n\treturn in_gate_area_no_task(addr);\n}\n\nstatic inline int is_kernel(unsigned long addr)\n{\n\tif (addr >= (unsigned long)_stext && addr <= (unsigned long)_end)\n\t\treturn 1;\n\treturn in_gate_area_no_task(addr);\n}\n\nstatic int is_ksym_addr(unsigned long addr)\n{\n\tif (all_var)\n\t\treturn is_kernel(addr);\n\n\treturn is_kernel_text(addr) || is_kernel_inittext(addr) ||\n\t\tis_kernel_extratext(addr);\n}\n\n/* expand a compressed symbol data into the resulting uncompressed string,\n given the offset to where the symbol is in the compressed stream */\nstatic unsigned int kallsyms_expand_symbol(unsigned int off, char *result)\n{\n\tint len, skipped_first = 0;\n\tconst u8 *tptr, *data;\n\n\t/* get the compressed symbol length from the first symbol byte */\n\tdata = &kallsyms_names[off];\n\tlen = *data;\n\tdata++;\n\n\t/* update the offset to return the offset for the next symbol on\n\t * the compressed stream */\n\toff += len + 1;\n\n\t/* for every byte on the compressed symbol data, copy the table\n\t entry for that byte */\n\twhile(len) {\n\t\ttptr = &kallsyms_token_table[ kallsyms_token_index[*data] ];\n\t\tdata++;\n\t\tlen--;\n\n\t\twhile (*tptr) {\n\t\t\tif(skipped_first) {\n\t\t\t\t*result = *tptr;\n\t\t\t\tresult++;\n\t\t\t} else\n\t\t\t\tskipped_first = 1;\n\t\t\ttptr++;\n\t\t}\n\t}\n\n\t*result = '\\0';\n\n\t/* return to offset to the next symbol */\n\treturn off;\n}\n\n/* get symbol type information. This is encoded as a single char at the\n * begining of the symbol name */\nstatic char kallsyms_get_symbol_type(unsigned int off)\n{\n\t/* get just the first code, look it up in the token table, and return the\n\t * first char from this token */\n\treturn kallsyms_token_table[ kallsyms_token_index[ kallsyms_names[off+1] ] ];\n}\n\n\n/* find the offset on the compressed stream given and index in the\n * kallsyms array */\nstatic unsigned int get_symbol_offset(unsigned long pos)\n{\n\tconst u8 *name;\n\tint i;\n\n\t/* use the closest marker we have. We have markers every 256 positions,\n\t * so that should be close enough */\n\tname = &kallsyms_names[ kallsyms_markers[pos>>8] ];\n\n\t/* sequentially scan all the symbols up to the point we're searching for.\n\t * Every symbol is stored in a [<len>][<len> bytes of data] format, so we\n\t * just need to add the len to the current pointer for every symbol we\n\t * wish to skip */\n\tfor(i = 0; i < (pos&0xFF); i++)\n\t\tname = name + (*name) + 1;\n\n\treturn name - kallsyms_names;\n}\n\n/* Lookup the address for this symbol. Returns 0 if not found. */\nunsigned long kallsyms_lookup_name(const char *name)\n{\n\tchar namebuf[KSYM_NAME_LEN+1];\n\tunsigned long i;\n\tunsigned int off;\n\n\tfor (i = 0, off = 0; i < kallsyms_num_syms; i++) {\n\t\toff = kallsyms_expand_symbol(off, namebuf);\n\n\t\tif (strcmp(namebuf, name) == 0)\n\t\t\treturn kallsyms_addresses[i];\n\t}\n\treturn module_kallsyms_lookup_name(name);\n}\n\nstatic unsigned long get_symbol_pos(unsigned long addr,\n\t\t\t\t unsigned long *symbolsize,\n\t\t\t\t unsigned long *offset)\n{\n\tunsigned long symbol_start = 0, symbol_end = 0;\n\tunsigned long i, low, high, mid;\n\n\t/* This kernel should never had been booted. */\n\tBUG_ON(!kallsyms_addresses);\n\n\t/* do a binary search on the sorted kallsyms_addresses array */\n\tlow = 0;\n\thigh = kallsyms_num_syms;\n\n\twhile (high - low > 1) {\n\t\tmid = (low + high) / 2;\n\t\tif (kallsyms_addresses[mid] <= addr)\n\t\t\tlow = mid;\n\t\telse\n\t\t\thigh = mid;\n\t}\n\n\t/*\n\t * search for the first aliased symbol. Aliased\n\t * symbols are symbols with the same address\n\t */\n\twhile (low && kallsyms_addresses[low-1] == kallsyms_addresses[low])\n\t\t--low;\n\n\tsymbol_start = kallsyms_addresses[low];\n\n\t/* Search for next non-aliased symbol */\n\tfor (i = low + 1; i < kallsyms_num_syms; i++) {\n\t\tif (kallsyms_addresses[i] > symbol_start) {\n\t\t\tsymbol_end = kallsyms_addresses[i];\n\t\t\tbreak;\n\t\t}\n\t}\n\n\t/* if we found no next symbol, we use the end of the section */\n\tif (!symbol_end) {\n\t\tif (is_kernel_inittext(addr))\n\t\t\tsymbol_end = (unsigned long)_einittext;\n\t\telse if (all_var)\n\t\t\tsymbol_end = (unsigned long)_end;\n\t\telse\n\t\t\tsymbol_end = (unsigned long)_etext;\n\t}\n\n\tif (symbolsize)\n\t\t*symbolsize = symbol_end - symbol_start;\n\tif (offset)\n\t\t*offset = addr - symbol_start;\n\n\treturn low;\n}\n\n/*\n * Lookup an address but don't bother to find any names.\n */\nint kallsyms_lookup_size_offset(unsigned long addr, unsigned long *symbolsize,\n\t\t\t\tunsigned long *offset)\n{\n\tif (is_ksym_addr(addr))\n\t\treturn !!get_symbol_pos(addr, symbolsize, offset);\n\n\treturn !!module_address_lookup(addr, symbolsize, offset, NULL);\n}\n\n/*\n * Lookup an address\n * - modname is set to NULL if it's in the kernel\n * - we guarantee that the returned name is valid until we reschedule even if\n * it resides in a module\n * - we also guarantee that modname will be valid until rescheduled\n */\nconst char *kallsyms_lookup(unsigned long addr,\n\t\t\t unsigned long *symbolsize,\n\t\t\t unsigned long *offset,\n\t\t\t char **modname, char *namebuf)\n{\n\tconst char *msym;\n\n\tnamebuf[KSYM_NAME_LEN] = 0;\n\tnamebuf[0] = 0;\n\n\tif (is_ksym_addr(addr)) {\n\t\tunsigned long pos;\n\n\t\tpos = get_symbol_pos(addr, symbolsize, offset);\n\t\t/* Grab name */\n\t\tkallsyms_expand_symbol(get_symbol_offset(pos), namebuf);\n\t\tif (modname)\n\t\t\t*modname = NULL;\n\t\treturn namebuf;\n\t}\n\n\t/* see if it's in a module */\n\tmsym = module_address_lookup(addr, symbolsize, offset, modname);\n\tif (msym)\n\t\treturn strncpy(namebuf, msym, KSYM_NAME_LEN);\n\n\treturn NULL;\n}\n\nint lookup_symbol_name(unsigned long addr, char *symname)\n{\n\tsymname[0] = '\\0';\n\tsymname[KSYM_NAME_LEN] = '\\0';\n\n\tif (is_ksym_addr(addr)) {\n\t\tunsigned long pos;\n\n\t\tpos = get_symbol_pos(addr, NULL, NULL);\n\t\t/* Grab name */\n\t\tkallsyms_expand_symbol(get_symbol_offset(pos), symname);\n\t\treturn 0;\n\t}\n\t/* see if it's in a module */\n\treturn lookup_module_symbol_name(addr, symname);\n}\n\nint lookup_symbol_attrs(unsigned long addr, unsigned long *size,\n\t\t\tunsigned long *offset, char *modname, char *name)\n{\n\tname[0] = '\\0';\n\tname[KSYM_NAME_LEN] = '\\0';\n\n\tif (is_ksym_addr(addr)) {\n\t\tunsigned long pos;\n\n\t\tpos = get_symbol_pos(addr, size, offset);\n\t\t/* Grab name */\n\t\tkallsyms_expand_symbol(get_symbol_offset(pos), name);\n\t\tmodname[0] = '\\0';\n\t\treturn 0;\n\t}\n\t/* see if it's in a module */\n\treturn lookup_module_symbol_attrs(addr, size, offset, modname, name);\n}\n\n/* Look up a kernel symbol and return it in a text buffer. */\nint sprint_symbol(char *buffer, unsigned long address)\n{\n\tchar *modname;\n\tconst char *name;\n\tunsigned long offset, size;\n\tchar namebuf[KSYM_NAME_LEN+1];\n\n\tname = kallsyms_lookup(address, &size, &offset, &modname, namebuf);\n\tif (!name)\n\t\treturn sprintf(buffer, \"0x%lx\", address);\n\telse {\n\t\tif (modname)\n\t\t\treturn sprintf(buffer, \"%s+%#lx/%#lx [%s]\", name, offset,\n\t\t\t\tsize, modname);\n\t\telse\n\t\t\treturn sprintf(buffer, \"%s+%#lx/%#lx\", name, offset, size);\n\t}\n}\n\n/* Look up a kernel symbol and print it to the kernel messages. */\nvoid __print_symbol(const char *fmt, unsigned long address)\n{\n\tchar buffer[KSYM_SYMBOL_LEN];\n\n\tsprint_symbol(buffer, address);\n\n\tprintk(fmt, buffer);\n}\n\n/* To avoid using get_symbol_offset for every symbol, we carry prefix along. */\nstruct kallsym_iter\n{\n\tloff_t pos;\n\tunsigned long value;\n\tunsigned int nameoff; /* If iterating in core kernel symbols */\n\tchar type;\n\tchar name[KSYM_NAME_LEN+1];\n\tchar module_name[MODULE_NAME_LEN + 1];\n\tint exported;\n};\n\nstatic int get_ksymbol_mod(struct kallsym_iter *iter)\n{\n\tif (module_get_kallsym(iter->pos - kallsyms_num_syms, &iter->value,\n\t\t\t\t&iter->type, iter->name, iter->module_name,\n\t\t\t\t&iter->exported) < 0)\n\t\treturn 0;\n\treturn 1;\n}\n\n/* Returns space to next name. */\nstatic unsigned long get_ksymbol_core(struct kallsym_iter *iter)\n{\n\tunsigned off = iter->nameoff;\n\n\titer->module_name[0] = '\\0';\n\titer->value = kallsyms_addresses[iter->pos];\n\n\titer->type = kallsyms_get_symbol_type(off);\n\n\toff = kallsyms_expand_symbol(off, iter->name);\n\n\treturn off - iter->nameoff;\n}\n\nstatic void reset_iter(struct kallsym_iter *iter, loff_t new_pos)\n{\n\titer->name[0] = '\\0';\n\titer->nameoff = get_symbol_offset(new_pos);\n\titer->pos = new_pos;\n}\n\n/* Returns false if pos at or past end of file. */\nstatic int update_iter(struct kallsym_iter *iter, loff_t pos)\n{\n\t/* Module symbols can be accessed randomly. */\n\tif (pos >= kallsyms_num_syms) {\n\t\titer->pos = pos;\n\t\treturn get_ksymbol_mod(iter);\n\t}\n\t\n\t/* If we're not on the desired position, reset to new position. */\n\tif (pos != iter->pos)\n\t\treset_iter(iter, pos);\n\n\titer->nameoff += get_ksymbol_core(iter);\n\titer->pos++;\n\n\treturn 1;\n}\n\nstatic void *s_next(struct seq_file *m, void *p, loff_t *pos)\n{\n\t(*pos)++;\n\n\tif (!update_iter(m->private, *pos))\n\t\treturn NULL;\n\treturn p;\n}\n\nstatic void *s_start(struct seq_file *m, loff_t *pos)\n{\n\tif (!update_iter(m->private, *pos))\n\t\treturn NULL;\n\treturn m->private;\n}\n\nstatic void s_stop(struct seq_file *m, void *p)\n{\n}\n\nstatic int s_show(struct seq_file *m, void *p)\n{\n\tstruct kallsym_iter *iter = m->private;\n\n\t/* Some debugging symbols have no name. Ignore them. */ \n\tif (!iter->name[0])\n\t\treturn 0;\n\n\tif (iter->module_name[0]) {\n\t\tchar type;\n\n\t\t/* Label it \"global\" if it is exported,\n\t\t * \"local\" if not exported. */\n\t\ttype = iter->exported ? toupper(iter->type) :\n\t\t\t\t\ttolower(iter->type);\n\t\tseq_printf(m, \"%0*lx %c %s\\t[%s]\\n\",\n\t\t\t (int)(2*sizeof(void*)),\n\t\t\t iter->value, type, iter->name, iter->module_name);\n\t} else\n\t\tseq_printf(m, \"%0*lx %c %s\\n\",\n\t\t\t (int)(2*sizeof(void*)),\n\t\t\t iter->value, iter->type, iter->name);\n\treturn 0;\n}\n\nstatic const struct seq_operations kallsyms_op = {\n\t.start = s_start,\n\t.next = s_next,\n\t.stop = s_stop,\n\t.show = s_show\n};\n\nstatic int kallsyms_open(struct inode *inode, struct file *file)\n{\n\t/* We keep iterator in m->private, since normal case is to\n\t * s_start from where we left off, so we avoid doing\n\t * using get_symbol_offset for every symbol */\n\tstruct kallsym_iter *iter;\n\tint ret;\n\n\titer = kmalloc(sizeof(*iter), GFP_KERNEL);\n\tif (!iter)\n\t\treturn -ENOMEM;\n\treset_iter(iter, 0);\n\n\tret = seq_open(file, &kallsyms_op);\n\tif (ret == 0)\n\t\t((struct seq_file *)file->private_data)->private = iter;\n\telse\n\t\tkfree(iter);\n\treturn ret;\n}\n\nstatic const struct file_operations kallsyms_operations = {\n\t.open = kallsyms_open,\n\t.read = seq_read,\n\t.llseek = seq_lseek,\n\t.release = seq_release_private,\n};\n\nstatic int __init kallsyms_init(void)\n{\n\tstruct proc_dir_entry *entry;\n\n\tentry = create_proc_entry(\"kallsyms\", 0444, NULL);\n\tif (entry)\n\t\tentry->proc_fops = &kallsyms_operations;\n\treturn 0;\n}\n__initcall(kallsyms_init);\n\nEXPORT_SYMBOL(__print_symbol);\nEXPORT_SYMBOL_GPL(sprint_symbol);\n\n#ifdef\tCONFIG_KDB\n#include <linux/kdb.h>\n#include <linux/kdbprivate.h>\n\nconst char *kdb_walk_kallsyms(loff_t *pos)\n{\n\tstatic struct kallsym_iter kdb_walk_kallsyms_iter;\n\tif (*pos == 0) {\n\t\tmemset(&kdb_walk_kallsyms_iter, 0, sizeof(kdb_walk_kallsyms_iter));\n\t\treset_iter(&kdb_walk_kallsyms_iter, 0);\n\t}\n\twhile (1) {\n\t\tif (!update_iter(&kdb_walk_kallsyms_iter, *pos))\n\t\t\treturn NULL;\n\t\t++*pos;\n\t\t/* Some debugging symbols have no name. Ignore them. */\n\t\tif (kdb_walk_kallsyms_iter.name[0])\n\t\t\treturn kdb_walk_kallsyms_iter.name;\n\t}\n}\n#endif\t/* CONFIG_KDB */\n/*\n * kexec.c - kexec system call\n * Copyright (C) 2002-2004 Eric Biederman <ebiederm@xmission.com>\n *\n * This source code is licensed under the GNU General Public License,\n * Version 2. See the file COPYING for more details.\n */\n\n#include <linux/capability.h>\n#include <linux/mm.h>\n#include <linux/file.h>\n#include <linux/slab.h>\n#include <linux/fs.h>\n#include <linux/kexec.h>\n#include <linux/spinlock.h>\n#include <linux/list.h>\n#include <linux/highmem.h>\n#include <linux/syscalls.h>\n#include <linux/reboot.h>\n#include <linux/syscalls.h>\n#include <linux/ioport.h>\n#include <linux/hardirq.h>\n#include <linux/elf.h>\n#include <linux/elfcore.h>\n\n#include <asm/page.h>\n#include <asm/uaccess.h>\n#include <asm/io.h>\n#include <asm/system.h>\n#include <asm/semaphore.h>\n\n/* Per cpu memory for storing cpu states in case of system crash. */\nnote_buf_t* crash_notes;\n\n/* Location of the reserved area for the crash kernel */\nstruct resource crashk_res = {\n\t.name = \"Crash kernel\",\n\t.start = 0,\n\t.end = 0,\n\t.flags = IORESOURCE_BUSY | IORESOURCE_MEM\n};\n\nint kexec_should_crash(struct task_struct *p)\n{\n\tif (in_interrupt() || !p->pid || is_init(p) || panic_on_oops)\n\t\treturn 1;\n\treturn 0;\n}\n\n/*\n * When kexec transitions to the new kernel there is a one-to-one\n * mapping between physical and virtual addresses. On processors\n * where you can disable the MMU this is trivial, and easy. For\n * others it is still a simple predictable page table to setup.\n *\n * In that environment kexec copies the new kernel to its final\n * resting place. This means I can only support memory whose\n * physical address can fit in an unsigned long. In particular\n * addresses where (pfn << PAGE_SHIFT) > ULONG_MAX cannot be handled.\n * If the assembly stub has more restrictive requirements\n * KEXEC_SOURCE_MEMORY_LIMIT and KEXEC_DEST_MEMORY_LIMIT can be\n * defined more restrictively in <asm/kexec.h>.\n *\n * The code for the transition from the current kernel to the\n * the new kernel is placed in the control_code_buffer, whose size\n * is given by KEXEC_CONTROL_CODE_SIZE. In the best case only a single\n * page of memory is necessary, but some architectures require more.\n * Because this memory must be identity mapped in the transition from\n * virtual to physical addresses it must live in the range\n * 0 - TASK_SIZE, as only the user space mappings are arbitrarily\n * modifiable.\n *\n * The assembly stub in the control code buffer is passed a linked list\n * of descriptor pages detailing the source pages of the new kernel,\n * and the destination addresses of those source pages. As this data\n * structure is not used in the context of the current OS, it must\n * be self-contained.\n *\n * The code has been made to work with highmem pages and will use a\n * destination page in its final resting place (if it happens\n * to allocate it). The end product of this is that most of the\n * physical address space, and most of RAM can be used.\n *\n * Future directions include:\n * - allocating a page table with the control code buffer identity\n * mapped, to simplify machine_kexec and make kexec_on_panic more\n * reliable.\n */\n\n/*\n * KIMAGE_NO_DEST is an impossible destination address..., for\n * allocating pages whose destination address we do not care about.\n */\n#define KIMAGE_NO_DEST (-1UL)\n\nstatic int kimage_is_destination_range(struct kimage *image,\n\t\t\t\t unsigned long start, unsigned long end);\nstatic struct page *kimage_alloc_page(struct kimage *image,\n\t\t\t\t gfp_t gfp_mask,\n\t\t\t\t unsigned long dest);\n\nstatic int do_kimage_alloc(struct kimage **rimage, unsigned long entry,\n\t unsigned long nr_segments,\n struct kexec_segment __user *segments)\n{\n\tsize_t segment_bytes;\n\tstruct kimage *image;\n\tunsigned long i;\n\tint result;\n\n\t/* Allocate a controlling structure */\n\tresult = -ENOMEM;\n\timage = kzalloc(sizeof(*image), GFP_KERNEL);\n\tif (!image)\n\t\tgoto out;\n\n\timage->head = 0;\n\timage->entry = &image->head;\n\timage->last_entry = &image->head;\n\timage->control_page = ~0; /* By default this does not apply */\n\timage->start = entry;\n\timage->type = KEXEC_TYPE_DEFAULT;\n\n\t/* Initialize the list of control pages */\n\tINIT_LIST_HEAD(&image->control_pages);\n\n\t/* Initialize the list of destination pages */\n\tINIT_LIST_HEAD(&image->dest_pages);\n\n\t/* Initialize the list of unuseable pages */\n\tINIT_LIST_HEAD(&image->unuseable_pages);\n\n\t/* Read in the segments */\n\timage->nr_segments = nr_segments;\n\tsegment_bytes = nr_segments * sizeof(*segments);\n\tresult = copy_from_user(image->segment, segments, segment_bytes);\n\tif (result)\n\t\tgoto out;\n\n\t/*\n\t * Verify we have good destination addresses. The caller is\n\t * responsible for making certain we don't attempt to load\n\t * the new image into invalid or reserved areas of RAM. This\n\t * just verifies it is an address we can use.\n\t *\n\t * Since the kernel does everything in page size chunks ensure\n\t * the destination addreses are page aligned. Too many\n\t * special cases crop of when we don't do this. The most\n\t * insidious is getting overlapping destination addresses\n\t * simply because addresses are changed to page size\n\t * granularity.\n\t */\n\tresult = -EADDRNOTAVAIL;\n\tfor (i = 0; i < nr_segments; i++) {\n\t\tunsigned long mstart, mend;\n\n\t\tmstart = image->segment[i].mem;\n\t\tmend = mstart + image->segment[i].memsz;\n\t\tif ((mstart & ~PAGE_MASK) || (mend & ~PAGE_MASK))\n\t\t\tgoto out;\n\t\tif (mend >= KEXEC_DESTINATION_MEMORY_LIMIT)\n\t\t\tgoto out;\n\t}\n\n\t/* Verify our destination addresses do not overlap.\n\t * If we alloed overlapping destination addresses\n\t * through very weird things can happen with no\n\t * easy explanation as one segment stops on another.\n\t */\n\tresult = -EINVAL;\n\tfor (i = 0; i < nr_segments; i++) {\n\t\tunsigned long mstart, mend;\n\t\tunsigned long j;\n\n\t\tmstart = image->segment[i].mem;\n\t\tmend = mstart + image->segment[i].memsz;\n\t\tfor (j = 0; j < i; j++) {\n\t\t\tunsigned long pstart, pend;\n\t\t\tpstart = image->segment[j].mem;\n\t\t\tpend = pstart + image->segment[j].memsz;\n\t\t\t/* Do the segments overlap ? */\n\t\t\tif ((mend > pstart) && (mstart < pend))\n\t\t\t\tgoto out;\n\t\t}\n\t}\n\n\t/* Ensure our buffer sizes are strictly less than\n\t * our memory sizes. This should always be the case,\n\t * and it is easier to check up front than to be surprised\n\t * later on.\n\t */\n\tresult = -EINVAL;\n\tfor (i = 0; i < nr_segments; i++) {\n\t\tif (image->segment[i].bufsz > image->segment[i].memsz)\n\t\t\tgoto out;\n\t}\n\n\tresult = 0;\nout:\n\tif (result == 0)\n\t\t*rimage = image;\n\telse\n\t\tkfree(image);\n\n\treturn result;\n\n}\n\nstatic int kimage_normal_alloc(struct kimage **rimage, unsigned long entry,\n\t\t\t\tunsigned long nr_segments,\n\t\t\t\tstruct kexec_segment __user *segments)\n{\n\tint result;\n\tstruct kimage *image;\n\n\t/* Allocate and initialize a controlling structure */\n\timage = NULL;\n\tresult = do_kimage_alloc(&image, entry, nr_segments, segments);\n\tif (result)\n\t\tgoto out;\n\n\t*rimage = image;\n\n\t/*\n\t * Find a location for the control code buffer, and add it\n\t * the vector of segments so that it's pages will also be\n\t * counted as destination pages.\n\t */\n\tresult = -ENOMEM;\n\timage->control_code_page = kimage_alloc_control_pages(image,\n\t\t\t\t\t get_order(KEXEC_CONTROL_CODE_SIZE));\n\tif (!image->control_code_page) {\n\t\tprintk(KERN_ERR \"Could not allocate control_code_buffer\\n\");\n\t\tgoto out;\n\t}\n\n\tresult = 0;\n out:\n\tif (result == 0)\n\t\t*rimage = image;\n\telse\n\t\tkfree(image);\n\n\treturn result;\n}\n\nstatic int kimage_crash_alloc(struct kimage **rimage, unsigned long entry,\n\t\t\t\tunsigned long nr_segments,\n\t\t\t\tstruct kexec_segment __user *segments)\n{\n\tint result;\n\tstruct kimage *image;\n\tunsigned long i;\n\n\timage = NULL;\n\t/* Verify we have a valid entry point */\n\tif ((entry < crashk_res.start) || (entry > crashk_res.end)) {\n\t\tresult = -EADDRNOTAVAIL;\n\t\tgoto out;\n\t}\n\n\t/* Allocate and initialize a controlling structure */\n\tresult = do_kimage_alloc(&image, entry, nr_segments, segments);\n\tif (result)\n\t\tgoto out;\n\n\t/* Enable the special crash kernel control page\n\t * allocation policy.\n\t */\n\timage->control_page = crashk_res.start;\n\timage->type = KEXEC_TYPE_CRASH;\n\n\t/*\n\t * Verify we have good destination addresses. Normally\n\t * the caller is responsible for making certain we don't\n\t * attempt to load the new image into invalid or reserved\n\t * areas of RAM. But crash kernels are preloaded into a\n\t * reserved area of ram. We must ensure the addresses\n\t * are in the reserved area otherwise preloading the\n\t * kernel could corrupt things.\n\t */\n\tresult = -EADDRNOTAVAIL;\n\tfor (i = 0; i < nr_segments; i++) {\n\t\tunsigned long mstart, mend;\n\n\t\tmstart = image->segment[i].mem;\n\t\tmend = mstart + image->segment[i].memsz - 1;\n\t\t/* Ensure we are within the crash kernel limits */\n\t\tif ((mstart < crashk_res.start) || (mend > crashk_res.end))\n\t\t\tgoto out;\n\t}\n\n\t/*\n\t * Find a location for the control code buffer, and add\n\t * the vector of segments so that it's pages will also be\n\t * counted as destination pages.\n\t */\n\tresult = -ENOMEM;\n\timage->control_code_page = kimage_alloc_control_pages(image,\n\t\t\t\t\t get_order(KEXEC_CONTROL_CODE_SIZE));\n\tif (!image->control_code_page) {\n\t\tprintk(KERN_ERR \"Could not allocate control_code_buffer\\n\");\n\t\tgoto out;\n\t}\n\n\tresult = 0;\nout:\n\tif (result == 0)\n\t\t*rimage = image;\n\telse\n\t\tkfree(image);\n\n\treturn result;\n}\n\nstatic int kimage_is_destination_range(struct kimage *image,\n\t\t\t\t\tunsigned long start,\n\t\t\t\t\tunsigned long end)\n{\n\tunsigned long i;\n\n\tfor (i = 0; i < image->nr_segments; i++) {\n\t\tunsigned long mstart, mend;\n\n\t\tmstart = image->segment[i].mem;\n\t\tmend = mstart + image->segment[i].memsz;\n\t\tif ((end > mstart) && (start < mend))\n\t\t\treturn 1;\n\t}\n\n\treturn 0;\n}\n\nstatic struct page *kimage_alloc_pages(gfp_t gfp_mask, unsigned int order, unsigned long limit)\n{\n\tstruct page *pages;\n\n\tpages = alloc_pages(gfp_mask, order);\n\tif (pages) {\n\t\tunsigned int count, i;\n#ifdef CONFIG_XEN\n\t\tint address_bits;\n\n\t\tif (limit == ~0UL)\n\t\t\taddress_bits = BITS_PER_LONG;\n\t\telse\n\t\t\taddress_bits = ilog2(limit);\n\n\t\tif (xen_create_contiguous_region((unsigned long)page_address(pages),\n\t\t\t\t\t\t order, address_bits) < 0) {\n\t\t\t__free_pages(pages, order);\n\t\t\treturn NULL;\n\t\t}\n#endif\n\t\tpages->mapping = NULL;\n\t\tset_page_private(pages, order);\n\t\tcount = 1 << order;\n\t\tfor (i = 0; i < count; i++)\n\t\t\tSetPageReserved(pages + i);\n\t}\n\n\treturn pages;\n}\n\nstatic void kimage_free_pages(struct page *page)\n{\n\tunsigned int order, count, i;\n\n\torder = page_private(page);\n\tcount = 1 << order;\n\tfor (i = 0; i < count; i++)\n\t\tClearPageReserved(page + i);\n#ifdef CONFIG_XEN\n\txen_destroy_contiguous_region((unsigned long)page_address(page), order);\n#endif\n\t__free_pages(page, order);\n}\n\nstatic void kimage_free_page_list(struct list_head *list)\n{\n\tstruct list_head *pos, *next;\n\n\tlist_for_each_safe(pos, next, list) {\n\t\tstruct page *page;\n\n\t\tpage = list_entry(pos, struct page, lru);\n\t\tlist_del(&page->lru);\n\t\tkimage_free_pages(page);\n\t}\n}\n\nstatic struct page *kimage_alloc_normal_control_pages(struct kimage *image,\n\t\t\t\t\t\t\tunsigned int order)\n{\n\t/* Control pages are special, they are the intermediaries\n\t * that are needed while we copy the rest of the pages\n\t * to their final resting place. As such they must\n\t * not conflict with either the destination addresses\n\t * or memory the kernel is already using.\n\t *\n\t * The only case where we really need more than one of\n\t * these are for architectures where we cannot disable\n\t * the MMU and must instead generate an identity mapped\n\t * page table for all of the memory.\n\t *\n\t * At worst this runs in O(N) of the image size.\n\t */\n\tstruct list_head extra_pages;\n\tstruct page *pages;\n\tunsigned int count;\n\n\tcount = 1 << order;\n\tINIT_LIST_HEAD(&extra_pages);\n\n\t/* Loop while I can allocate a page and the page allocated\n\t * is a destination page.\n\t */\n\tdo {\n\t\tunsigned long pfn, epfn, addr, eaddr;\n\n\t\tpages = kimage_alloc_pages(GFP_KERNEL, order, KEXEC_CONTROL_MEMORY_LIMIT);\n\t\tif (!pages)\n\t\t\tbreak;\n\t\tpfn = kexec_page_to_pfn(pages);\n\t\tepfn = pfn + count;\n\t\taddr = pfn << PAGE_SHIFT;\n\t\teaddr = epfn << PAGE_SHIFT;\n\t\tif ((epfn >= (KEXEC_CONTROL_MEMORY_LIMIT >> PAGE_SHIFT)) ||\n\t\t\t kimage_is_destination_range(image, addr, eaddr)) {\n\t\t\tlist_add(&pages->lru, &extra_pages);\n\t\t\tpages = NULL;\n\t\t}\n\t} while (!pages);\n\n\tif (pages) {\n\t\t/* Remember the allocated page... */\n\t\tlist_add(&pages->lru, &image->control_pages);\n\n\t\t/* Because the page is already in it's destination\n\t\t * location we will never allocate another page at\n\t\t * that address. Therefore kimage_alloc_pages\n\t\t * will not return it (again) and we don't need\n\t\t * to give it an entry in image->segment[].\n\t\t */\n\t}\n\t/* Deal with the destination pages I have inadvertently allocated.\n\t *\n\t * Ideally I would convert multi-page allocations into single\n\t * page allocations, and add everyting to image->dest_pages.\n\t *\n\t * For now it is simpler to just free the pages.\n\t */\n\tkimage_free_page_list(&extra_pages);\n\n\treturn pages;\n}\n\n#ifndef CONFIG_XEN\nstatic struct page *kimage_alloc_crash_control_pages(struct kimage *image,\n\t\t\t\t\t\t unsigned int order)\n{\n\t/* Control pages are special, they are the intermediaries\n\t * that are needed while we copy the rest of the pages\n\t * to their final resting place. As such they must\n\t * not conflict with either the destination addresses\n\t * or memory the kernel is already using.\n\t *\n\t * Control pages are also the only pags we must allocate\n\t * when loading a crash kernel. All of the other pages\n\t * are specified by the segments and we just memcpy\n\t * into them directly.\n\t *\n\t * The only case where we really need more than one of\n\t * these are for architectures where we cannot disable\n\t * the MMU and must instead generate an identity mapped\n\t * page table for all of the memory.\n\t *\n\t * Given the low demand this implements a very simple\n\t * allocator that finds the first hole of the appropriate\n\t * size in the reserved memory region, and allocates all\n\t * of the memory up to and including the hole.\n\t */\n\tunsigned long hole_start, hole_end, size;\n\tstruct page *pages;\n\n\tpages = NULL;\n\tsize = (1 << order) << PAGE_SHIFT;\n\thole_start = (image->control_page + (size - 1)) & ~(size - 1);\n\thole_end = hole_start + size - 1;\n\twhile (hole_end <= crashk_res.end) {\n\t\tunsigned long i;\n\n\t\tif (hole_end > KEXEC_CONTROL_MEMORY_LIMIT)\n\t\t\tbreak;\n\t\tif (hole_end > crashk_res.end)\n\t\t\tbreak;\n\t\t/* See if I overlap any of the segments */\n\t\tfor (i = 0; i < image->nr_segments; i++) {\n\t\t\tunsigned long mstart, mend;\n\n\t\t\tmstart = image->segment[i].mem;\n\t\t\tmend = mstart + image->segment[i].memsz - 1;\n\t\t\tif ((hole_end >= mstart) && (hole_start <= mend)) {\n\t\t\t\t/* Advance the hole to the end of the segment */\n\t\t\t\thole_start = (mend + (size - 1)) & ~(size - 1);\n\t\t\t\thole_end = hole_start + size - 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t/* If I don't overlap any segments I have found my hole! */\n\t\tif (i == image->nr_segments) {\n\t\t\tpages = kexec_pfn_to_page(hole_start >> PAGE_SHIFT);\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (pages)\n\t\timage->control_page = hole_end;\n\n\treturn pages;\n}\n\n\nstruct page *kimage_alloc_control_pages(struct kimage *image,\n\t\t\t\t\t unsigned int order)\n{\n\tstruct page *pages = NULL;\n\n\tswitch (image->type) {\n\tcase KEXEC_TYPE_DEFAULT:\n\t\tpages = kimage_alloc_normal_control_pages(image, order);\n\t\tbreak;\n\tcase KEXEC_TYPE_CRASH:\n\t\tpages = kimage_alloc_crash_control_pages(image, order);\n\t\tbreak;\n\t}\n\n\treturn pages;\n}\n#else /* !CONFIG_XEN */\nstruct page *kimage_alloc_control_pages(struct kimage *image,\n\t\t\t\t\t unsigned int order)\n{\n\treturn kimage_alloc_normal_control_pages(image, order);\n}\n#endif\n\nstatic int kimage_add_entry(struct kimage *image, kimage_entry_t entry)\n{\n\tif (*image->entry != 0)\n\t\timage->entry++;\n\n\tif (image->entry == image->last_entry) {\n\t\tkimage_entry_t *ind_page;\n\t\tstruct page *page;\n\n\t\tpage = kimage_alloc_page(image, GFP_KERNEL, KIMAGE_NO_DEST);\n\t\tif (!page)\n\t\t\treturn -ENOMEM;\n\n\t\tind_page = page_address(page);\n\t\t*image->entry = kexec_virt_to_phys(ind_page) | IND_INDIRECTION;\n\t\timage->entry = ind_page;\n\t\timage->last_entry = ind_page +\n\t\t\t\t ((PAGE_SIZE/sizeof(kimage_entry_t)) - 1);\n\t}\n\t*image->entry = entry;\n\timage->entry++;\n\t*image->entry = 0;\n\n\treturn 0;\n}\n\nstatic int kimage_set_destination(struct kimage *image,\n\t\t\t\t unsigned long destination)\n{\n\tint result;\n\n\tdestination &= PAGE_MASK;\n\tresult = kimage_add_entry(image, destination | IND_DESTINATION);\n\tif (result == 0)\n\t\timage->destination = destination;\n\n\treturn result;\n}\n\n\nstatic int kimage_add_page(struct kimage *image, unsigned long page)\n{\n\tint result;\n\n\tpage &= PAGE_MASK;\n\tresult = kimage_add_entry(image, page | IND_SOURCE);\n\tif (result == 0)\n\t\timage->destination += PAGE_SIZE;\n\n\treturn result;\n}\n\n\nstatic void kimage_free_extra_pages(struct kimage *image)\n{\n\t/* Walk through and free any extra destination pages I may have */\n\tkimage_free_page_list(&image->dest_pages);\n\n\t/* Walk through and free any unuseable pages I have cached */\n\tkimage_free_page_list(&image->unuseable_pages);\n\n}\nstatic int kimage_terminate(struct kimage *image)\n{\n\tif (*image->entry != 0)\n\t\timage->entry++;\n\n\t*image->entry = IND_DONE;\n\n\treturn 0;\n}\n\n#define for_each_kimage_entry(image, ptr, entry) \\\n\tfor (ptr = &image->head; (entry = *ptr) && !(entry & IND_DONE); \\\n\t\tptr = (entry & IND_INDIRECTION)? \\\n\t\t\tkexec_phys_to_virt((entry & PAGE_MASK)): ptr +1)\n\nstatic void kimage_free_entry(kimage_entry_t entry)\n{\n\tstruct page *page;\n\n\tpage = kexec_pfn_to_page(entry >> PAGE_SHIFT);\n\tkimage_free_pages(page);\n}\n\nstatic void kimage_free(struct kimage *image)\n{\n\tkimage_entry_t *ptr, entry;\n\tkimage_entry_t ind = 0;\n\n\tif (!image)\n\t\treturn;\n\n#ifdef CONFIG_XEN\n\txen_machine_kexec_unload(image);\n#endif\n\n\tkimage_free_extra_pages(image);\n\tfor_each_kimage_entry(image, ptr, entry) {\n\t\tif (entry & IND_INDIRECTION) {\n\t\t\t/* Free the previous indirection page */\n\t\t\tif (ind & IND_INDIRECTION)\n\t\t\t\tkimage_free_entry(ind);\n\t\t\t/* Save this indirection page until we are\n\t\t\t * done with it.\n\t\t\t */\n\t\t\tind = entry;\n\t\t}\n\t\telse if (entry & IND_SOURCE)\n\t\t\tkimage_free_entry(entry);\n\t}\n\t/* Free the final indirection page */\n\tif (ind & IND_INDIRECTION)\n\t\tkimage_free_entry(ind);\n\n\t/* Handle any machine specific cleanup */\n\tmachine_kexec_cleanup(image);\n\n\t/* Free the kexec control pages... */\n\tkimage_free_page_list(&image->control_pages);\n\tkfree(image);\n}\n\nstatic kimage_entry_t *kimage_dst_used(struct kimage *image,\n\t\t\t\t\tunsigned long page)\n{\n\tkimage_entry_t *ptr, entry;\n\tunsigned long destination = 0;\n\n\tfor_each_kimage_entry(image, ptr, entry) {\n\t\tif (entry & IND_DESTINATION)\n\t\t\tdestination = entry & PAGE_MASK;\n\t\telse if (entry & IND_SOURCE) {\n\t\t\tif (page == destination)\n\t\t\t\treturn ptr;\n\t\t\tdestination += PAGE_SIZE;\n\t\t}\n\t}\n\n\treturn NULL;\n}\n\nstatic struct page *kimage_alloc_page(struct kimage *image,\n\t\t\t\t\tgfp_t gfp_mask,\n\t\t\t\t\tunsigned long destination)\n{\n\t/*\n\t * Here we implement safeguards to ensure that a source page\n\t * is not copied to its destination page before the data on\n\t * the destination page is no longer useful.\n\t *\n\t * To do this we maintain the invariant that a source page is\n\t * either its own destination page, or it is not a\n\t * destination page at all.\n\t *\n\t * That is slightly stronger than required, but the proof\n\t * that no problems will not occur is trivial, and the\n\t * implementation is simply to verify.\n\t *\n\t * When allocating all pages normally this algorithm will run\n\t * in O(N) time, but in the worst case it will run in O(N^2)\n\t * time. If the runtime is a problem the data structures can\n\t * be fixed.\n\t */\n\tstruct page *page;\n\tunsigned long addr;\n\n\t/*\n\t * Walk through the list of destination pages, and see if I\n\t * have a match.\n\t */\n\tlist_for_each_entry(page, &image->dest_pages, lru) {\n\t\taddr = kexec_page_to_pfn(page) << PAGE_SHIFT;\n\t\tif (addr == destination) {\n\t\t\tlist_del(&page->lru);\n\t\t\treturn page;\n\t\t}\n\t}\n\tpage = NULL;\n\twhile (1) {\n\t\tkimage_entry_t *old;\n\n\t\t/* Allocate a page, if we run out of memory give up */\n\t\tpage = kimage_alloc_pages(gfp_mask, 0, KEXEC_SOURCE_MEMORY_LIMIT);\n\t\tif (!page)\n\t\t\treturn NULL;\n\t\t/* If the page cannot be used file it away */\n\t\tif (kexec_page_to_pfn(page) >\n\t\t\t\t(KEXEC_SOURCE_MEMORY_LIMIT >> PAGE_SHIFT)) {\n\t\t\tlist_add(&page->lru, &image->unuseable_pages);\n\t\t\tcontinue;\n\t\t}\n\t\taddr = kexec_page_to_pfn(page) << PAGE_SHIFT;\n\n\t\t/* If it is the destination page we want use it */\n\t\tif (addr == destination)\n\t\t\tbreak;\n\n\t\t/* If the page is not a destination page use it */\n\t\tif (!kimage_is_destination_range(image, addr,\n\t\t\t\t\t\t addr + PAGE_SIZE))\n\t\t\tbreak;\n\n\t\t/*\n\t\t * I know that the page is someones destination page.\n\t\t * See if there is already a source page for this\n\t\t * destination page. And if so swap the source pages.\n\t\t */\n\t\told = kimage_dst_used(image, addr);\n\t\tif (old) {\n\t\t\t/* If so move it */\n\t\t\tunsigned long old_addr;\n\t\t\tstruct page *old_page;\n\n\t\t\told_addr = *old & PAGE_MASK;\n\t\t\told_page = kexec_pfn_to_page(old_addr >> PAGE_SHIFT);\n\t\t\tcopy_highpage(page, old_page);\n\t\t\t*old = addr | (*old & ~PAGE_MASK);\n\n\t\t\t/* The old page I have found cannot be a\n\t\t\t * destination page, so return it.\n\t\t\t */\n\t\t\taddr = old_addr;\n\t\t\tpage = old_page;\n\t\t\tbreak;\n\t\t}\n\t\telse {\n\t\t\t/* Place the page on the destination list I\n\t\t\t * will use it later.\n\t\t\t */\n\t\t\tlist_add(&page->lru, &image->dest_pages);\n\t\t}\n\t}\n\n\treturn page;\n}\n\nstatic int kimage_load_normal_segment(struct kimage *image,\n\t\t\t\t\t struct kexec_segment *segment)\n{\n\tunsigned long maddr;\n\tunsigned long ubytes, mbytes;\n\tint result;\n\tunsigned char __user *buf;\n\n\tresult = 0;\n\tbuf = segment->buf;\n\tubytes = segment->bufsz;\n\tmbytes = segment->memsz;\n\tmaddr = segment->mem;\n\n\tresult = kimage_set_destination(image, maddr);\n\tif (result < 0)\n\t\tgoto out;\n\n\twhile (mbytes) {\n\t\tstruct page *page;\n\t\tchar *ptr;\n\t\tsize_t uchunk, mchunk;\n\n\t\tpage = kimage_alloc_page(image, GFP_HIGHUSER, maddr);\n\t\tif (page == 0) {\n\t\t\tresult = -ENOMEM;\n\t\t\tgoto out;\n\t\t}\n\t\tresult = kimage_add_page(image, kexec_page_to_pfn(page)\n\t\t\t\t\t\t\t\t<< PAGE_SHIFT);\n\t\tif (result < 0)\n\t\t\tgoto out;\n\n\t\tptr = kmap(page);\n\t\t/* Start with a clear page */\n\t\tmemset(ptr, 0, PAGE_SIZE);\n\t\tptr += maddr & ~PAGE_MASK;\n\t\tmchunk = PAGE_SIZE - (maddr & ~PAGE_MASK);\n\t\tif (mchunk > mbytes)\n\t\t\tmchunk = mbytes;\n\n\t\tuchunk = mchunk;\n\t\tif (uchunk > ubytes)\n\t\t\tuchunk = ubytes;\n\n\t\tresult = copy_from_user(ptr, buf, uchunk);\n\t\tkunmap(page);\n\t\tif (result) {\n\t\t\tresult = (result < 0) ? result : -EIO;\n\t\t\tgoto out;\n\t\t}\n\t\tubytes -= uchunk;\n\t\tmaddr += mchunk;\n\t\tbuf += mchunk;\n\t\tmbytes -= mchunk;\n\t}\nout:\n\treturn result;\n}\n\n#ifndef CONFIG_XEN\nstatic int kimage_load_crash_segment(struct kimage *image,\n\t\t\t\t\tstruct kexec_segment *segment)\n{\n\t/* For crash dumps kernels we simply copy the data from\n\t * user space to it's destination.\n\t * We do things a page at a time for the sake of kmap.\n\t */\n\tunsigned long maddr;\n\tunsigned long ubytes, mbytes;\n\tint result;\n\tunsigned char __user *buf;\n\n\tresult = 0;\n\tbuf = segment->buf;\n\tubytes = segment->bufsz;\n\tmbytes = segment->memsz;\n\tmaddr = segment->mem;\n\twhile (mbytes) {\n\t\tstruct page *page;\n\t\tchar *ptr;\n\t\tsize_t uchunk, mchunk;\n\n\t\tpage = kexec_pfn_to_page(maddr >> PAGE_SHIFT);\n\t\tif (page == 0) {\n\t\t\tresult = -ENOMEM;\n\t\t\tgoto out;\n\t\t}\n\t\tptr = kmap(page);\n\t\tptr += maddr & ~PAGE_MASK;\n\t\tmchunk = PAGE_SIZE - (maddr & ~PAGE_MASK);\n\t\tif (mchunk > mbytes)\n\t\t\tmchunk = mbytes;\n\n\t\tuchunk = mchunk;\n\t\tif (uchunk > ubytes) {\n\t\t\tuchunk = ubytes;\n\t\t\t/* Zero the trailing part of the page */\n\t\t\tmemset(ptr + uchunk, 0, mchunk - uchunk);\n\t\t}\n\t\tresult = copy_from_user(ptr, buf, uchunk);\n\t\tkexec_flush_icache_page(page);\n\t\tkunmap(page);\n\t\tif (result) {\n\t\t\tresult = (result < 0) ? result : -EIO;\n\t\t\tgoto out;\n\t\t}\n\t\tubytes -= uchunk;\n\t\tmaddr += mchunk;\n\t\tbuf += mchunk;\n\t\tmbytes -= mchunk;\n\t}\nout:\n\treturn result;\n}\n\nstatic int kimage_load_segment(struct kimage *image,\n\t\t\t\tstruct kexec_segment *segment)\n{\n\tint result = -ENOMEM;\n\n\tswitch (image->type) {\n\tcase KEXEC_TYPE_DEFAULT:\n\t\tresult = kimage_load_normal_segment(image, segment);\n\t\tbreak;\n\tcase KEXEC_TYPE_CRASH:\n\t\tresult = kimage_load_crash_segment(image, segment);\n\t\tbreak;\n\t}\n\n\treturn result;\n}\n#else /* CONFIG_XEN */\nstatic int kimage_load_segment(struct kimage *image,\n\t\t\t\tstruct kexec_segment *segment)\n{\n\treturn kimage_load_normal_segment(image, segment);\n}\n#endif\n\n/*\n * Exec Kernel system call: for obvious reasons only root may call it.\n *\n * This call breaks up into three pieces.\n * - A generic part which loads the new kernel from the current\n * address space, and very carefully places the data in the\n * allocated pages.\n *\n * - A generic part that interacts with the kernel and tells all of\n * the devices to shut down. Preventing on-going dmas, and placing\n * the devices in a consistent state so a later kernel can\n * reinitialize them.\n *\n * - A machine specific part that includes the syscall number\n * and the copies the image to it's final destination. And\n * jumps into the image at entry.\n *\n * kexec does not sync, or unmount filesystems so if you need\n * that to happen you need to do that yourself.\n */\nstruct kimage *kexec_image;\nstruct kimage *kexec_crash_image;\n/*\n * A home grown binary mutex.\n * Nothing can wait so this mutex is safe to use\n * in interrupt context :)\n */\nstatic int kexec_lock;\n\nasmlinkage long sys_kexec_load(unsigned long entry, unsigned long nr_segments,\n\t\t\t\tstruct kexec_segment __user *segments,\n\t\t\t\tunsigned long flags)\n{\n\tstruct kimage **dest_image, *image;\n\tint locked;\n\tint result;\n\n\t/* We only trust the superuser with rebooting the system. */\n\tif (!capable(CAP_SYS_BOOT))\n\t\treturn -EPERM;\n\n\t/*\n\t * Verify we have a legal set of flags\n\t * This leaves us room for future extensions.\n\t */\n\tif ((flags & KEXEC_FLAGS) != (flags & ~KEXEC_ARCH_MASK))\n\t\treturn -EINVAL;\n\n\t/* Verify we are on the appropriate architecture */\n\tif (((flags & KEXEC_ARCH_MASK) != KEXEC_ARCH) &&\n\t\t((flags & KEXEC_ARCH_MASK) != KEXEC_ARCH_DEFAULT))\n\t\treturn -EINVAL;\n\n\t/* Put an artificial cap on the number\n\t * of segments passed to kexec_load.\n\t */\n\tif (nr_segments > KEXEC_SEGMENT_MAX)\n\t\treturn -EINVAL;\n\n\timage = NULL;\n\tresult = 0;\n\n\t/* Because we write directly to the reserved memory\n\t * region when loading crash kernels we need a mutex here to\n\t * prevent multiple crash kernels from attempting to load\n\t * simultaneously, and to prevent a crash kernel from loading\n\t * over the top of a in use crash kernel.\n\t *\n\t * KISS: always take the mutex.\n\t */\n\tlocked = xchg(&kexec_lock, 1);\n\tif (locked)\n\t\treturn -EBUSY;\n\n\tdest_image = &kexec_image;\n\tif (flags & KEXEC_ON_CRASH)\n\t\tdest_image = &kexec_crash_image;\n\tif (nr_segments > 0) {\n\t\tunsigned long i;\n\n\t\t/* Loading another kernel to reboot into */\n\t\tif ((flags & KEXEC_ON_CRASH) == 0)\n\t\t\tresult = kimage_normal_alloc(&image, entry,\n\t\t\t\t\t\t\tnr_segments, segments);\n\t\t/* Loading another kernel to switch to if this one crashes */\n\t\telse if (flags & KEXEC_ON_CRASH) {\n\t\t\t/* Free any current crash dump kernel before\n\t\t\t * we corrupt it.\n\t\t\t */\n\t\t\tkimage_free(xchg(&kexec_crash_image, NULL));\n\t\t\tresult = kimage_crash_alloc(&image, entry,\n\t\t\t\t\t\t nr_segments, segments);\n\t\t}\n\t\tif (result)\n\t\t\tgoto out;\n\n\t\tresult = machine_kexec_prepare(image);\n\t\tif (result)\n\t\t\tgoto out;\n\n\t\tfor (i = 0; i < nr_segments; i++) {\n\t\t\tresult = kimage_load_segment(image, &image->segment[i]);\n\t\t\tif (result)\n\t\t\t\tgoto out;\n\t\t}\n\t\tresult = kimage_terminate(image);\n\t\tif (result)\n\t\t\tgoto out;\n\t}\n#ifdef CONFIG_XEN\n\tif (image) {\n\t\tresult = xen_machine_kexec_load(image);\n\t\tif (result)\n\t\t\tgoto out;\n\t}\n#endif\n\t/* Install the new kernel, and Uninstall the old */\n\timage = xchg(dest_image, image);\n\nout:\n\tlocked = xchg(&kexec_lock, 0); /* Release the mutex */\n\tBUG_ON(!locked);\n\tkimage_free(image);\n\n\treturn result;\n}\n\n#ifdef CONFIG_COMPAT\nasmlinkage long compat_sys_kexec_load(unsigned long entry,\n\t\t\t\tunsigned long nr_segments,\n\t\t\t\tstruct compat_kexec_segment __user *segments,\n\t\t\t\tunsigned long flags)\n{\n\tstruct compat_kexec_segment in;\n\tstruct kexec_segment out, __user *ksegments;\n\tunsigned long i, result;\n\n\t/* Don't allow clients that don't understand the native\n\t * architecture to do anything.\n\t */\n\tif ((flags & KEXEC_ARCH_MASK) == KEXEC_ARCH_DEFAULT)\n\t\treturn -EINVAL;\n\n\tif (nr_segments > KEXEC_SEGMENT_MAX)\n\t\treturn -EINVAL;\n\n\tksegments = compat_alloc_user_space(nr_segments * sizeof(out));\n\tfor (i=0; i < nr_segments; i++) {\n\t\tresult = copy_from_user(&in, &segments[i], sizeof(in));\n\t\tif (result)\n\t\t\treturn -EFAULT;\n\n\t\tout.buf = compat_ptr(in.buf);\n\t\tout.bufsz = in.bufsz;\n\t\tout.mem = in.mem;\n\t\tout.memsz = in.memsz;\n\n\t\tresult = copy_to_user(&ksegments[i], &out, sizeof(out));\n\t\tif (result)\n\t\t\treturn -EFAULT;\n\t}\n\n\treturn sys_kexec_load(entry, nr_segments, ksegments, flags);\n}\n#endif\n\nvoid crash_kexec(struct pt_regs *regs)\n{\n\tint locked;\n\n\t/* Take the kexec_lock here to prevent sys_kexec_load\n\t * running on one cpu from replacing the crash kernel\n\t * we are using after a panic on a different cpu.\n\t *\n\t * If the crash kernel was not located in a fixed area\n\t * of memory the xchg(&kexec_crash_image) would be\n\t * sufficient. But since I reuse the memory...\n\t */\n\tlocked = xchg(&kexec_lock, 1);\n\tif (!locked) {\n\t\tif (kexec_crash_image) {\n\t\t\tstruct pt_regs fixed_regs;\n\t\t\tcrash_setup_regs(&fixed_regs, regs);\n\t\t\tmachine_crash_shutdown(&fixed_regs);\n\t\t\tmachine_kexec(kexec_crash_image);\n\t\t}\n\t\tlocked = xchg(&kexec_lock, 0);\n\t\tBUG_ON(!locked);\n\t}\n}\n\nstatic u32 *append_elf_note(u32 *buf, char *name, unsigned type, void *data,\n\t\t\t size_t data_len)\n{\n\tstruct elf_note note;\n\n\tnote.n_namesz = strlen(name) + 1;\n\tnote.n_descsz = data_len;\n\tnote.n_type = type;\n\tmemcpy(buf, &note, sizeof(note));\n\tbuf += (sizeof(note) + 3)/4;\n\tmemcpy(buf, name, note.n_namesz);\n\tbuf += (note.n_namesz + 3)/4;\n\tmemcpy(buf, data, note.n_descsz);\n\tbuf += (note.n_descsz + 3)/4;\n\n\treturn buf;\n}\n\nstatic void final_note(u32 *buf)\n{\n\tstruct elf_note note;\n\n\tnote.n_namesz = 0;\n\tnote.n_descsz = 0;\n\tnote.n_type = 0;\n\tmemcpy(buf, &note, sizeof(note));\n}\n\nvoid crash_save_cpu(struct pt_regs *regs, int cpu)\n{\n\tstruct elf_prstatus prstatus;\n\tu32 *buf;\n\n\tif ((cpu < 0) || (cpu >= NR_CPUS))\n\t\treturn;\n\n\t/* Using ELF notes here is opportunistic.\n\t * I need a well defined structure format\n\t * for the data I pass, and I need tags\n\t * on the data to indicate what information I have\n\t * squirrelled away. ELF notes happen to provide\n\t * all of that, so there is no need to invent something new.\n\t */\n\tbuf = (u32*)per_cpu_ptr(crash_notes, cpu);\n\tif (!buf)\n\t\treturn;\n\tmemset(&prstatus, 0, sizeof(prstatus));\n\tprstatus.pr_pid = current->pid;\n\telf_core_copy_regs(&prstatus.pr_reg, regs);\n\tbuf = append_elf_note(buf, KEXEC_CORE_NOTE_NAME, NT_PRSTATUS,\n\t\t \t &prstatus, sizeof(prstatus));\n\tfinal_note(buf);\n}\n\nstatic int __init crash_notes_memory_init(void)\n{\n\t/* Allocate memory for saving cpu registers. */\n\tcrash_notes = alloc_percpu(note_buf_t);\n\tif (!crash_notes) {\n\t\tprintk(\"Kexec: Memory allocation for saving cpu register\"\n\t\t\" states failed\\n\");\n\t\treturn -ENOMEM;\n\t}\n\treturn 0;\n}\nmodule_init(crash_notes_memory_init)\n/*\n * A simple kernel FIFO implementation.\n *\n * Copyright (C) 2004 Stelian Pop <stelian@popies.net>\n *\n * This program is free software; you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation; either version 2 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program; if not, write to the Free Software\n * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\n *\n */\n\n#include <linux/kernel.h>\n#include <linux/module.h>\n#include <linux/slab.h>\n#include <linux/err.h>\n#include <linux/kfifo.h>\n\n/**\n * kfifo_init - allocates a new FIFO using a preallocated buffer\n * @buffer: the preallocated buffer to be used.\n * @size: the size of the internal buffer, this have to be a power of 2.\n * @gfp_mask: get_free_pages mask, passed to kmalloc()\n * @lock: the lock to be used to protect the fifo buffer\n *\n * Do NOT pass the kfifo to kfifo_free() after use! Simply free the\n * &struct kfifo with kfree().\n */\nstruct kfifo *kfifo_init(unsigned char *buffer, unsigned int size,\n\t\t\t gfp_t gfp_mask, spinlock_t *lock)\n{\n\tstruct kfifo *fifo;\n\n\t/* size must be a power of 2 */\n\tBUG_ON(size & (size - 1));\n\n\tfifo = kmalloc(sizeof(struct kfifo), gfp_mask);\n\tif (!fifo)\n\t\treturn ERR_PTR(-ENOMEM);\n\n\tfifo->buffer = buffer;\n\tfifo->size = size;\n\tfifo->in = fifo->out = 0;\n\tfifo->lock = lock;\n\n\treturn fifo;\n}\nEXPORT_SYMBOL(kfifo_init);\n\n/**\n * kfifo_alloc - allocates a new FIFO and its internal buffer\n * @size: the size of the internal buffer to be allocated.\n * @gfp_mask: get_free_pages mask, passed to kmalloc()\n * @lock: the lock to be used to protect the fifo buffer\n *\n * The size will be rounded-up to a power of 2.\n */\nstruct kfifo *kfifo_alloc(unsigned int size, gfp_t gfp_mask, spinlock_t *lock)\n{\n\tunsigned char *buffer;\n\tstruct kfifo *ret;\n\n\t/*\n\t * round up to the next power of 2, since our 'let the indices\n\t * wrap' tachnique works only in this case.\n\t */\n\tif (size & (size - 1)) {\n\t\tBUG_ON(size > 0x80000000);\n\t\tsize = roundup_pow_of_two(size);\n\t}\n\n\tbuffer = kmalloc(size, gfp_mask);\n\tif (!buffer)\n\t\treturn ERR_PTR(-ENOMEM);\n\n\tret = kfifo_init(buffer, size, gfp_mask, lock);\n\n\tif (IS_ERR(ret))\n\t\tkfree(buffer);\n\n\treturn ret;\n}\nEXPORT_SYMBOL(kfifo_alloc);\n\n/**\n * kfifo_free - frees the FIFO\n * @fifo: the fifo to be freed.\n */\nvoid kfifo_free(struct kfifo *fifo)\n{\n\tkfree(fifo->buffer);\n\tkfree(fifo);\n}\nEXPORT_SYMBOL(kfifo_free);\n\n/**\n * __kfifo_put - puts some data into the FIFO, no locking version\n * @fifo: the fifo to be used.\n * @buffer: the data to be added.\n * @len: the length of the data to be added.\n *\n * This function copies at most @len bytes from the @buffer into\n * the FIFO depending on the free space, and returns the number of\n * bytes copied.\n *\n * Note that with only one concurrent reader and one concurrent\n * writer, you don't need extra locking to use these functions.\n */\nunsigned int __kfifo_put(struct kfifo *fifo,\n\t\t\t unsigned char *buffer, unsigned int len)\n{\n\tunsigned int l;\n\n\tlen = min(len, fifo->size - fifo->in + fifo->out);\n\n\t/*\n\t * Ensure that we sample the fifo->out index -before- we\n\t * start putting bytes into the kfifo.\n\t */\n\n\tsmp_mb();\n\n\t/* first put the data starting from fifo->in to buffer end */\n\tl = min(len, fifo->size - (fifo->in & (fifo->size - 1)));\n\tmemcpy(fifo->buffer + (fifo->in & (fifo->size - 1)), buffer, l);\n\n\t/* then put the rest (if any) at the beginning of the buffer */\n\tmemcpy(fifo->buffer, buffer + l, len - l);\n\n\t/*\n\t * Ensure that we add the bytes to the kfifo -before-\n\t * we update the fifo->in index.\n\t */\n\n\tsmp_wmb();\n\n\tfifo->in += len;\n\n\treturn len;\n}\nEXPORT_SYMBOL(__kfifo_put);\n\n/**\n * __kfifo_get - gets some data from the FIFO, no locking version\n * @fifo: the fifo to be used.\n * @buffer: where the data must be copied.\n * @len: the size of the destination buffer.\n *\n * This function copies at most @len bytes from the FIFO into the\n * @buffer and returns the number of copied bytes.\n *\n * Note that with only one concurrent reader and one concurrent\n * writer, you don't need extra locking to use these functions.\n */\nunsigned int __kfifo_get(struct kfifo *fifo,\n\t\t\t unsigned char *buffer, unsigned int len)\n{\n\tunsigned int l;\n\n\tlen = min(len, fifo->in - fifo->out);\n\n\t/*\n\t * Ensure that we sample the fifo->in index -before- we\n\t * start removing bytes from the kfifo.\n\t */\n\n\tsmp_rmb();\n\n\t/* first get the data from fifo->out until the end of the buffer */\n\tl = min(len, fifo->size - (fifo->out & (fifo->size - 1)));\n\tmemcpy(buffer, fifo->buffer + (fifo->out & (fifo->size - 1)), l);\n\n\t/* then get the rest (if any) from the beginning of the buffer */\n\tmemcpy(buffer + l, fifo->buffer, len - l);\n\n\t/*\n\t * Ensure that we remove the bytes from the kfifo -before-\n\t * we update the fifo->out index.\n\t */\n\n\tsmp_mb();\n\n\tfifo->out += len;\n\n\treturn len;\n}\nEXPORT_SYMBOL(__kfifo_get);\n/*\n\tkmod, the new module loader (replaces kerneld)\n\tKirk Petersen\n\n\tReorganized not to be a daemon by Adam Richter, with guidance\n\tfrom Greg Zornetzer.\n\n\tModified to avoid chroot and file sharing problems.\n\tMikael Pettersson\n\n\tLimit the concurrent number of kmod modprobes to catch loops from\n\t\"modprobe needs a service that is in a module\".\n\tKeith Owens <kaos@ocs.com.au> December 1999\n\n\tUnblock all signals when we exec a usermode process.\n\tShuu Yamaguchi <shuu@wondernetworkresources.com> December 2000\n\n\tcall_usermodehelper wait flag, and remove exec_usermodehelper.\n\tRusty Russell <rusty@rustcorp.com.au> Jan 2003\n*/\n#include <linux/module.h>\n#include <linux/sched.h>\n#include <linux/syscalls.h>\n#include <linux/unistd.h>\n#include <linux/kmod.h>\n#include <linux/slab.h>\n#include <linux/mnt_namespace.h>\n#include <linux/completion.h>\n#include <linux/file.h>\n#include <linux/workqueue.h>\n#include <linux/security.h>\n#include <linux/mount.h>\n#include <linux/kernel.h>\n#include <linux/init.h>\n#include <linux/resource.h>\n#include <asm/uaccess.h>\n\nextern int max_threads;\n\nstatic struct workqueue_struct *khelper_wq;\n\n#ifdef CONFIG_KMOD\n\n/*\n\tmodprobe_path is set via /proc/sys.\n*/\nchar modprobe_path[KMOD_PATH_LEN] = \"/sbin/modprobe\";\n\n/**\n * request_module - try to load a kernel module\n * @fmt: printf style format string for the name of the module\n * @varargs: arguements as specified in the format string\n *\n * Load a module using the user mode module loader. The function returns\n * zero on success or a negative errno code on failure. Note that a\n * successful module load does not mean the module did not then unload\n * and exit on an error of its own. Callers must check that the service\n * they requested is now available not blindly invoke it.\n *\n * If module auto-loading support is disabled then this function\n * becomes a no-operation.\n */\nint request_module(const char *fmt, ...)\n{\n\tva_list args;\n\tchar module_name[MODULE_NAME_LEN];\n\tunsigned int max_modprobes;\n\tint ret;\n\tchar *argv[] = { modprobe_path, \"-q\", \"--\", module_name, NULL };\n\tstatic char *envp[] = { \"HOME=/\",\n\t\t\t\t\"TERM=linux\",\n\t\t\t\t\"PATH=/sbin:/usr/sbin:/bin:/usr/bin\",\n\t\t\t\tNULL };\n\tstatic atomic_t kmod_concurrent = ATOMIC_INIT(0);\n#define MAX_KMOD_CONCURRENT 50\t/* Completely arbitrary value - KAO */\n\tstatic int kmod_loop_msg;\n\n\tva_start(args, fmt);\n\tret = vsnprintf(module_name, MODULE_NAME_LEN, fmt, args);\n\tva_end(args);\n\tif (ret >= MODULE_NAME_LEN)\n\t\treturn -ENAMETOOLONG;\n\n\t/* If modprobe needs a service that is in a module, we get a recursive\n\t * loop. Limit the number of running kmod threads to max_threads/2 or\n\t * MAX_KMOD_CONCURRENT, whichever is the smaller. A cleaner method\n\t * would be to run the parents of this process, counting how many times\n\t * kmod was invoked. That would mean accessing the internals of the\n\t * process tables to get the command line, proc_pid_cmdline is static\n\t * and it is not worth changing the proc code just to handle this case. \n\t * KAO.\n\t *\n\t * \"trace the ppid\" is simple, but will fail if someone's\n\t * parent exits. I think this is as good as it gets. --RR\n\t */\n\tmax_modprobes = min(max_threads/2, MAX_KMOD_CONCURRENT);\n\tatomic_inc(&kmod_concurrent);\n\tif (atomic_read(&kmod_concurrent) > max_modprobes) {\n\t\t/* We may be blaming an innocent here, but unlikely */\n\t\tif (kmod_loop_msg++ < 5)\n\t\t\tprintk(KERN_ERR\n\t\t\t \"request_module: runaway loop modprobe %s\\n\",\n\t\t\t module_name);\n\t\tatomic_dec(&kmod_concurrent);\n\t\treturn -ENOMEM;\n\t}\n\n\tret = call_usermodehelper(modprobe_path, argv, envp, 1);\n\tatomic_dec(&kmod_concurrent);\n\treturn ret;\n}\nEXPORT_SYMBOL(request_module);\n#endif /* CONFIG_KMOD */\n\nstruct subprocess_info {\n\tstruct work_struct work;\n\tstruct completion *complete;\n\tchar *path;\n\tchar **argv;\n\tchar **envp;\n\tstruct key *ring;\n\tint wait;\n\tint retval;\n\tstruct file *stdin;\n};\n\n/*\n * This is the task which runs the usermode application\n */\nstatic int ____call_usermodehelper(void *data)\n{\n\tstruct subprocess_info *sub_info = data;\n\tstruct key *new_session, *old_session;\n\tint retval;\n\n\t/* Unblock all signals and set the session keyring. */\n\tnew_session = key_get(sub_info->ring);\n\tspin_lock_irq(&current->sighand->siglock);\n\told_session = __install_session_keyring(current, new_session);\n\tflush_signal_handlers(current, 1);\n\tsigemptyset(&current->blocked);\n\trecalc_sigpending();\n\tspin_unlock_irq(&current->sighand->siglock);\n\n\tkey_put(old_session);\n\n\t/* Install input pipe when needed */\n\tif (sub_info->stdin) {\n\t\tstruct files_struct *f = current->files;\n\t\tstruct fdtable *fdt;\n\t\t/* no races because files should be private here */\n\t\tsys_close(0);\n\t\tfd_install(0, sub_info->stdin);\n\t\tspin_lock(&f->file_lock);\n\t\tfdt = files_fdtable(f);\n\t\tFD_SET(0, fdt->open_fds);\n\t\tFD_CLR(0, fdt->close_on_exec);\n\t\tspin_unlock(&f->file_lock);\n\n\t\t/* and disallow core files too */\n\t\tcurrent->signal->rlim[RLIMIT_CORE] = (struct rlimit){0, 0};\n\t}\n\n\t/* We can run anywhere, unlike our parent keventd(). */\n\tset_cpus_allowed(current, CPU_MASK_ALL);\n\n\t/*\n\t * Our parent is keventd, which runs with elevated scheduling priority.\n\t * Avoid propagating that into the userspace child.\n\t */\n\tset_user_nice(current, 0);\n\n\tretval = -EPERM;\n\tif (current->fs->root)\n\t\tretval = kernel_execve(sub_info->path,\n\t\t\t\tsub_info->argv, sub_info->envp);\n\n\t/* Exec failed? */\n\tsub_info->retval = retval;\n\tdo_exit(0);\n}\n\n/* Keventd can't block, but this (a child) can. */\nstatic int wait_for_helper(void *data)\n{\n\tstruct subprocess_info *sub_info = data;\n\tpid_t pid;\n\n\t/* Install a handler: if SIGCLD isn't handled sys_wait4 won't\n\t * populate the status, but will return -ECHILD. */\n\tallow_signal(SIGCHLD);\n\n\tpid = kernel_thread(____call_usermodehelper, sub_info, SIGCHLD);\n\tif (pid < 0) {\n\t\tsub_info->retval = pid;\n\t} else {\n\t\tint ret;\n\n\t\t/*\n\t\t * Normally it is bogus to call wait4() from in-kernel because\n\t\t * wait4() wants to write the exit code to a userspace address.\n\t\t * But wait_for_helper() always runs as keventd, and put_user()\n\t\t * to a kernel address works OK for kernel threads, due to their\n\t\t * having an mm_segment_t which spans the entire address space.\n\t\t *\n\t\t * Thus the __user pointer cast is valid here.\n\t\t */\n\t\tsys_wait4(pid, (int __user *)&ret, 0, NULL);\n\n\t\t/*\n\t\t * If ret is 0, either ____call_usermodehelper failed and the\n\t\t * real error code is already in sub_info->retval or\n\t\t * sub_info->retval is 0 anyway, so don't mess with it then.\n\t\t */\n\t\tif (ret)\n\t\t\tsub_info->retval = ret;\n\t}\n\n\tif (sub_info->wait < 0)\n\t\tkfree(sub_info);\n\telse\n\t\tcomplete(sub_info->complete);\n\treturn 0;\n}\n\n/* This is run by khelper thread */\nstatic void __call_usermodehelper(struct work_struct *work)\n{\n\tstruct subprocess_info *sub_info =\n\t\tcontainer_of(work, struct subprocess_info, work);\n\tpid_t pid;\n\tint wait = sub_info->wait;\n\n\t/* CLONE_VFORK: wait until the usermode helper has execve'd\n\t * successfully We need the data structures to stay around\n\t * until that is done. */\n\tif (wait)\n\t\tpid = kernel_thread(wait_for_helper, sub_info,\n\t\t\t\t CLONE_FS | CLONE_FILES | SIGCHLD);\n\telse\n\t\tpid = kernel_thread(____call_usermodehelper, sub_info,\n\t\t\t\t CLONE_VFORK | SIGCHLD);\n\n\tif (wait < 0)\n\t\treturn;\n\n\tif (pid < 0) {\n\t\tsub_info->retval = pid;\n\t\tcomplete(sub_info->complete);\n\t} else if (!wait)\n\t\tcomplete(sub_info->complete);\n}\n\n/**\n * call_usermodehelper_keys - start a usermode application\n * @path: pathname for the application\n * @argv: null-terminated argument list\n * @envp: null-terminated environment list\n * @session_keyring: session keyring for process (NULL for an empty keyring)\n * @wait: wait for the application to finish and return status.\n * when -1 don't wait at all, but you get no useful error back when\n * the program couldn't be exec'ed. This makes it safe to call\n * from interrupt context.\n *\n * Runs a user-space application. The application is started\n * asynchronously if wait is not set, and runs as a child of keventd.\n * (ie. it runs with full root capabilities).\n *\n * Must be called from process context. Returns a negative error code\n * if program was not execed successfully, or 0.\n */\nint call_usermodehelper_keys(char *path, char **argv, char **envp,\n\t\t\t struct key *session_keyring, int wait)\n{\n\tDECLARE_COMPLETION_ONSTACK(done);\n\tstruct subprocess_info *sub_info;\n\tint retval;\n\n\tif (!khelper_wq)\n\t\treturn -EBUSY;\n\n\tif (path[0] == '\\0')\n\t\treturn 0;\n\n\tsub_info = kzalloc(sizeof(struct subprocess_info), GFP_ATOMIC);\n\tif (!sub_info)\n\t\treturn -ENOMEM;\n\n\tINIT_WORK(&sub_info->work, __call_usermodehelper);\n\tsub_info->complete = &done;\n\tsub_info->path = path;\n\tsub_info->argv = argv;\n\tsub_info->envp = envp;\n\tsub_info->ring = session_keyring;\n\tsub_info->wait = wait;\n\n\tqueue_work(khelper_wq, &sub_info->work);\n\tif (wait < 0) /* task has freed sub_info */\n\t\treturn 0;\n\twait_for_completion(&done);\n\tretval = sub_info->retval;\n\tkfree(sub_info);\n\treturn retval;\n}\nEXPORT_SYMBOL(call_usermodehelper_keys);\n\nint call_usermodehelper_pipe(char *path, char **argv, char **envp,\n\t\t\t struct file **filp)\n{\n\tDECLARE_COMPLETION(done);\n\tstruct subprocess_info sub_info = {\n\t\t.work\t\t= __WORK_INITIALIZER(sub_info.work,\n\t\t\t\t\t\t __call_usermodehelper),\n\t\t.complete\t= &done,\n\t\t.path\t\t= path,\n\t\t.argv\t\t= argv,\n\t\t.envp\t\t= envp,\n\t\t.retval\t\t= 0,\n\t};\n\tstruct file *f;\n\n\tif (!khelper_wq)\n\t\treturn -EBUSY;\n\n\tif (path[0] == '\\0')\n\t\treturn 0;\n\n\tf = create_write_pipe();\n\tif (IS_ERR(f))\n\t\treturn PTR_ERR(f);\n\t*filp = f;\n\n\tf = create_read_pipe(f);\n\tif (IS_ERR(f)) {\n\t\tfree_write_pipe(*filp);\n\t\treturn PTR_ERR(f);\n\t}\n\tsub_info.stdin = f;\n\n\tqueue_work(khelper_wq, &sub_info.work);\n\twait_for_completion(&done);\n\treturn sub_info.retval;\n}\nEXPORT_SYMBOL(call_usermodehelper_pipe);\n\nvoid __init usermodehelper_init(void)\n{\n\tkhelper_wq = create_singlethread_workqueue(\"khelper\");\n\tBUG_ON(!khelper_wq);\n}\n/*\n * Kernel Probes (KProbes)\n * kernel/kprobes.c\n *\n * This program is free software; you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation; either version 2 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program; if not, write to the Free Software\n * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n *\n * Copyright (C) IBM Corporation, 2002, 2004\n *\n * 2002-Oct\tCreated by Vamsi Krishna S <vamsi_krishna@in.ibm.com> Kernel\n *\t\tProbes initial implementation (includes suggestions from\n *\t\tRusty Russell).\n * 2004-Aug\tUpdated by Prasanna S Panchamukhi <prasanna@in.ibm.com> with\n *\t\thlists and exceptions notifier as suggested by Andi Kleen.\n * 2004-July\tSuparna Bhattacharya <suparna@in.ibm.com> added jumper probes\n *\t\tinterface to access function arguments.\n * 2004-Sep\tPrasanna S Panchamukhi <prasanna@in.ibm.com> Changed Kprobes\n *\t\texceptions notifier to be first on the priority list.\n * 2005-May\tHien Nguyen <hien@us.ibm.com>, Jim Keniston\n *\t\t<jkenisto@us.ibm.com> and Prasanna S Panchamukhi\n *\t\t<prasanna@in.ibm.com> added function-return probes.\n */\n#include <linux/kprobes.h>\n#include <linux/hash.h>\n#include <linux/init.h>\n#include <linux/slab.h>\n#include <linux/stddef.h>\n#include <linux/module.h>\n#include <linux/moduleloader.h>\n#include <linux/kallsyms.h>\n#include <linux/freezer.h>\n#include <linux/seq_file.h>\n#include <linux/debugfs.h>\n#include <linux/kdebug.h>\n\n#include <asm-generic/sections.h>\n#include <asm/cacheflush.h>\n#include <asm/errno.h>\n#include <asm/uaccess.h>\n\n#define KPROBE_HASH_BITS 6\n#define KPROBE_TABLE_SIZE (1 << KPROBE_HASH_BITS)\n\n\n/*\n * Some oddball architectures like 64bit powerpc have function descriptors\n * so this must be overridable.\n */\n#ifndef kprobe_lookup_name\n#define kprobe_lookup_name(name, addr) \\\n\taddr = ((kprobe_opcode_t *)(kallsyms_lookup_name(name)))\n#endif\n\nstatic struct hlist_head kprobe_table[KPROBE_TABLE_SIZE];\nstatic struct hlist_head kretprobe_inst_table[KPROBE_TABLE_SIZE];\nstatic atomic_t kprobe_count;\n\n/* NOTE: change this value only with kprobe_mutex held */\nstatic bool kprobe_enabled;\n\nDEFINE_MUTEX(kprobe_mutex);\t\t/* Protects kprobe_table */\nDEFINE_SPINLOCK(kretprobe_lock);\t/* Protects kretprobe_inst_table */\nstatic DEFINE_PER_CPU(struct kprobe *, kprobe_instance) = NULL;\n\nstatic struct notifier_block kprobe_page_fault_nb = {\n\t.notifier_call = kprobe_exceptions_notify,\n\t.priority = 0x7fffffff /* we need to notified first */\n};\n\n#ifdef __ARCH_WANT_KPROBES_INSN_SLOT\n/*\n * kprobe->ainsn.insn points to the copy of the instruction to be\n * single-stepped. x86_64, POWER4 and above have no-exec support and\n * stepping on the instruction on a vmalloced/kmalloced/data page\n * is a recipe for disaster\n */\n#define INSNS_PER_PAGE\t(PAGE_SIZE/(MAX_INSN_SIZE * sizeof(kprobe_opcode_t)))\n\nstruct kprobe_insn_page {\n\tstruct hlist_node hlist;\n\tkprobe_opcode_t *insns;\t\t/* Page of instruction slots */\n\tchar slot_used[INSNS_PER_PAGE];\n\tint nused;\n\tint ngarbage;\n};\n\nenum kprobe_slot_state {\n\tSLOT_CLEAN = 0,\n\tSLOT_DIRTY = 1,\n\tSLOT_USED = 2,\n};\n\nstatic struct hlist_head kprobe_insn_pages;\nstatic int kprobe_garbage_slots;\nstatic int collect_garbage_slots(void);\n\nstatic int __kprobes check_safety(void)\n{\n\tint ret = 0;\n#if defined(CONFIG_PREEMPT) && defined(CONFIG_PM)\n\tret = freeze_processes();\n\tif (ret == 0) {\n\t\tstruct task_struct *p, *q;\n\t\tdo_each_thread(p, q) {\n\t\t\tif (p != current && p->state == TASK_RUNNING &&\n\t\t\t p->pid != 0) {\n\t\t\t\tprintk(\"Check failed: %s is running\\n\",p->comm);\n\t\t\t\tret = -1;\n\t\t\t\tgoto loop_end;\n\t\t\t}\n\t\t} while_each_thread(p, q);\n\t}\nloop_end:\n\tthaw_processes();\n#else\n\tsynchronize_sched();\n#endif\n\treturn ret;\n}\n\n/**\n * get_insn_slot() - Find a slot on an executable page for an instruction.\n * We allocate an executable page if there's no room on existing ones.\n */\nkprobe_opcode_t __kprobes *get_insn_slot(void)\n{\n\tstruct kprobe_insn_page *kip;\n\tstruct hlist_node *pos;\n\n retry:\n\thlist_for_each_entry(kip, pos, &kprobe_insn_pages, hlist) {\n\t\tif (kip->nused < INSNS_PER_PAGE) {\n\t\t\tint i;\n\t\t\tfor (i = 0; i < INSNS_PER_PAGE; i++) {\n\t\t\t\tif (kip->slot_used[i] == SLOT_CLEAN) {\n\t\t\t\t\tkip->slot_used[i] = SLOT_USED;\n\t\t\t\t\tkip->nused++;\n\t\t\t\t\treturn kip->insns + (i * MAX_INSN_SIZE);\n\t\t\t\t}\n\t\t\t}\n\t\t\t/* Surprise! No unused slots. Fix kip->nused. */\n\t\t\tkip->nused = INSNS_PER_PAGE;\n\t\t}\n\t}\n\n\t/* If there are any garbage slots, collect it and try again. */\n\tif (kprobe_garbage_slots && collect_garbage_slots() == 0) {\n\t\tgoto retry;\n\t}\n\t/* All out of space. Need to allocate a new page. Use slot 0. */\n\tkip = kmalloc(sizeof(struct kprobe_insn_page), GFP_KERNEL);\n\tif (!kip)\n\t\treturn NULL;\n\n\t/*\n\t * Use module_alloc so this page is within +/- 2GB of where the\n\t * kernel image and loaded module images reside. This is required\n\t * so x86_64 can correctly handle the %rip-relative fixups.\n\t */\n\tkip->insns = module_alloc(PAGE_SIZE);\n\tif (!kip->insns) {\n\t\tkfree(kip);\n\t\treturn NULL;\n\t}\n\tINIT_HLIST_NODE(&kip->hlist);\n\thlist_add_head(&kip->hlist, &kprobe_insn_pages);\n\tmemset(kip->slot_used, SLOT_CLEAN, INSNS_PER_PAGE);\n\tkip->slot_used[0] = SLOT_USED;\n\tkip->nused = 1;\n\tkip->ngarbage = 0;\n\treturn kip->insns;\n}\n\n/* Return 1 if all garbages are collected, otherwise 0. */\nstatic int __kprobes collect_one_slot(struct kprobe_insn_page *kip, int idx)\n{\n\tkip->slot_used[idx] = SLOT_CLEAN;\n\tkip->nused--;\n\tif (kip->nused == 0) {\n\t\t/*\n\t\t * Page is no longer in use. Free it unless\n\t\t * it's the last one. We keep the last one\n\t\t * so as not to have to set it up again the\n\t\t * next time somebody inserts a probe.\n\t\t */\n\t\thlist_del(&kip->hlist);\n\t\tif (hlist_empty(&kprobe_insn_pages)) {\n\t\t\tINIT_HLIST_NODE(&kip->hlist);\n\t\t\thlist_add_head(&kip->hlist,\n\t\t\t\t &kprobe_insn_pages);\n\t\t} else {\n\t\t\tmodule_free(NULL, kip->insns);\n\t\t\tkfree(kip);\n\t\t}\n\t\treturn 1;\n\t}\n\treturn 0;\n}\n\nstatic int __kprobes collect_garbage_slots(void)\n{\n\tstruct kprobe_insn_page *kip;\n\tstruct hlist_node *pos, *next;\n\n\t/* Ensure no-one is preepmted on the garbages */\n\tif (check_safety() != 0)\n\t\treturn -EAGAIN;\n\n\thlist_for_each_entry_safe(kip, pos, next, &kprobe_insn_pages, hlist) {\n\t\tint i;\n\t\tif (kip->ngarbage == 0)\n\t\t\tcontinue;\n\t\tkip->ngarbage = 0;\t/* we will collect all garbages */\n\t\tfor (i = 0; i < INSNS_PER_PAGE; i++) {\n\t\t\tif (kip->slot_used[i] == SLOT_DIRTY &&\n\t\t\t collect_one_slot(kip, i))\n\t\t\t\tbreak;\n\t\t}\n\t}\n\tkprobe_garbage_slots = 0;\n\treturn 0;\n}\n\nvoid __kprobes free_insn_slot(kprobe_opcode_t * slot, int dirty)\n{\n\tstruct kprobe_insn_page *kip;\n\tstruct hlist_node *pos;\n\n\thlist_for_each_entry(kip, pos, &kprobe_insn_pages, hlist) {\n\t\tif (kip->insns <= slot &&\n\t\t slot < kip->insns + (INSNS_PER_PAGE * MAX_INSN_SIZE)) {\n\t\t\tint i = (slot - kip->insns) / MAX_INSN_SIZE;\n\t\t\tif (dirty) {\n\t\t\t\tkip->slot_used[i] = SLOT_DIRTY;\n\t\t\t\tkip->ngarbage++;\n\t\t\t} else {\n\t\t\t\tcollect_one_slot(kip, i);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tif (dirty && ++kprobe_garbage_slots > INSNS_PER_PAGE)\n\t\tcollect_garbage_slots();\n}\n#endif\n\n/* We have preemption disabled.. so it is safe to use __ versions */\nstatic inline void set_kprobe_instance(struct kprobe *kp)\n{\n\t__get_cpu_var(kprobe_instance) = kp;\n}\n\nstatic inline void reset_kprobe_instance(void)\n{\n\t__get_cpu_var(kprobe_instance) = NULL;\n}\n\n/*\n * This routine is called either:\n * \t- under the kprobe_mutex - during kprobe_[un]register()\n * \t\t\t\tOR\n * \t- with preemption disabled - from arch/xxx/kernel/kprobes.c\n */\nstruct kprobe __kprobes *get_kprobe(void *addr)\n{\n\tstruct hlist_head *head;\n\tstruct hlist_node *node;\n\tstruct kprobe *p;\n\n\thead = &kprobe_table[hash_ptr(addr, KPROBE_HASH_BITS)];\n\thlist_for_each_entry_rcu(p, node, head, hlist) {\n\t\tif (p->addr == addr)\n\t\t\treturn p;\n\t}\n\treturn NULL;\n}\n\n/*\n * Aggregate handlers for multiple kprobes support - these handlers\n * take care of invoking the individual kprobe handlers on p->list\n */\nstatic int __kprobes aggr_pre_handler(struct kprobe *p, struct pt_regs *regs)\n{\n\tstruct kprobe *kp;\n\n\tlist_for_each_entry_rcu(kp, &p->list, list) {\n\t\tif (kp->pre_handler) {\n\t\t\tset_kprobe_instance(kp);\n\t\t\tif (kp->pre_handler(kp, regs))\n\t\t\t\treturn 1;\n\t\t}\n\t\treset_kprobe_instance();\n\t}\n\treturn 0;\n}\n\nstatic void __kprobes aggr_post_handler(struct kprobe *p, struct pt_regs *regs,\n\t\t\t\t\tunsigned long flags)\n{\n\tstruct kprobe *kp;\n\n\tlist_for_each_entry_rcu(kp, &p->list, list) {\n\t\tif (kp->post_handler) {\n\t\t\tset_kprobe_instance(kp);\n\t\t\tkp->post_handler(kp, regs, flags);\n\t\t\treset_kprobe_instance();\n\t\t}\n\t}\n}\n\nstatic int __kprobes aggr_fault_handler(struct kprobe *p, struct pt_regs *regs,\n\t\t\t\t\tint trapnr)\n{\n\tstruct kprobe *cur = __get_cpu_var(kprobe_instance);\n\n\t/*\n\t * if we faulted \"during\" the execution of a user specified\n\t * probe handler, invoke just that probe's fault handler\n\t */\n\tif (cur && cur->fault_handler) {\n\t\tif (cur->fault_handler(cur, regs, trapnr))\n\t\t\treturn 1;\n\t}\n\treturn 0;\n}\n\nstatic int __kprobes aggr_break_handler(struct kprobe *p, struct pt_regs *regs)\n{\n\tstruct kprobe *cur = __get_cpu_var(kprobe_instance);\n\tint ret = 0;\n\n\tif (cur && cur->break_handler) {\n\t\tif (cur->break_handler(cur, regs))\n\t\t\tret = 1;\n\t}\n\treset_kprobe_instance();\n\treturn ret;\n}\n\n/* Walks the list and increments nmissed count for multiprobe case */\nvoid __kprobes kprobes_inc_nmissed_count(struct kprobe *p)\n{\n\tstruct kprobe *kp;\n\tif (p->pre_handler != aggr_pre_handler) {\n\t\tp->nmissed++;\n\t} else {\n\t\tlist_for_each_entry_rcu(kp, &p->list, list)\n\t\t\tkp->nmissed++;\n\t}\n\treturn;\n}\n\n/* Called with kretprobe_lock held */\nvoid __kprobes recycle_rp_inst(struct kretprobe_instance *ri,\n\t\t\t\tstruct hlist_head *head)\n{\n\t/* remove rp inst off the rprobe_inst_table */\n\thlist_del(&ri->hlist);\n\tif (ri->rp) {\n\t\t/* remove rp inst off the used list */\n\t\thlist_del(&ri->uflist);\n\t\t/* put rp inst back onto the free list */\n\t\tINIT_HLIST_NODE(&ri->uflist);\n\t\thlist_add_head(&ri->uflist, &ri->rp->free_instances);\n\t} else\n\t\t/* Unregistering */\n\t\thlist_add_head(&ri->hlist, head);\n}\n\nstruct hlist_head __kprobes *kretprobe_inst_table_head(struct task_struct *tsk)\n{\n\treturn &kretprobe_inst_table[hash_ptr(tsk, KPROBE_HASH_BITS)];\n}\n\n/*\n * This function is called from finish_task_switch when task tk becomes dead,\n * so that we can recycle any function-return probe instances associated\n * with this task. These left over instances represent probed functions\n * that have been called but will never return.\n */\nvoid __kprobes kprobe_flush_task(struct task_struct *tk)\n{\n\tstruct kretprobe_instance *ri;\n\tstruct hlist_head *head, empty_rp;\n\tstruct hlist_node *node, *tmp;\n\tunsigned long flags = 0;\n\n\tINIT_HLIST_HEAD(&empty_rp);\n\tspin_lock_irqsave(&kretprobe_lock, flags);\n\thead = kretprobe_inst_table_head(tk);\n\thlist_for_each_entry_safe(ri, node, tmp, head, hlist) {\n\t\tif (ri->task == tk)\n\t\t\trecycle_rp_inst(ri, &empty_rp);\n\t}\n\tspin_unlock_irqrestore(&kretprobe_lock, flags);\n\n\thlist_for_each_entry_safe(ri, node, tmp, &empty_rp, hlist) {\n\t\thlist_del(&ri->hlist);\n\t\tkfree(ri);\n\t}\n}\n\nstatic inline void free_rp_inst(struct kretprobe *rp)\n{\n\tstruct kretprobe_instance *ri;\n\tstruct hlist_node *pos, *next;\n\n\thlist_for_each_entry_safe(ri, pos, next, &rp->free_instances, uflist) {\n\t\thlist_del(&ri->uflist);\n\t\tkfree(ri);\n\t}\n}\n\n/*\n * Keep all fields in the kprobe consistent\n */\nstatic inline void copy_kprobe(struct kprobe *old_p, struct kprobe *p)\n{\n\tmemcpy(&p->opcode, &old_p->opcode, sizeof(kprobe_opcode_t));\n\tmemcpy(&p->ainsn, &old_p->ainsn, sizeof(struct arch_specific_insn));\n}\n\n/*\n* Add the new probe to old_p->list. Fail if this is the\n* second jprobe at the address - two jprobes can't coexist\n*/\nstatic int __kprobes add_new_kprobe(struct kprobe *old_p, struct kprobe *p)\n{\n\tif (p->break_handler) {\n\t\tif (old_p->break_handler)\n\t\t\treturn -EEXIST;\n\t\tlist_add_tail_rcu(&p->list, &old_p->list);\n\t\told_p->break_handler = aggr_break_handler;\n\t} else\n\t\tlist_add_rcu(&p->list, &old_p->list);\n\tif (p->post_handler && !old_p->post_handler)\n\t\told_p->post_handler = aggr_post_handler;\n\treturn 0;\n}\n\n/*\n * Fill in the required fields of the \"manager kprobe\". Replace the\n * earlier kprobe in the hlist with the manager kprobe\n */\nstatic inline void add_aggr_kprobe(struct kprobe *ap, struct kprobe *p)\n{\n\tcopy_kprobe(p, ap);\n\tflush_insn_slot(ap);\n\tap->addr = p->addr;\n\tap->pre_handler = aggr_pre_handler;\n\tap->fault_handler = aggr_fault_handler;\n\tif (p->post_handler)\n\t\tap->post_handler = aggr_post_handler;\n\tif (p->break_handler)\n\t\tap->break_handler = aggr_break_handler;\n\n\tINIT_LIST_HEAD(&ap->list);\n\tlist_add_rcu(&p->list, &ap->list);\n\n\thlist_replace_rcu(&p->hlist, &ap->hlist);\n}\n\n/*\n * This is the second or subsequent kprobe at the address - handle\n * the intricacies\n */\nstatic int __kprobes register_aggr_kprobe(struct kprobe *old_p,\n\t\t\t\t\t struct kprobe *p)\n{\n\tint ret = 0;\n\tstruct kprobe *ap;\n\n\tif (old_p->pre_handler == aggr_pre_handler) {\n\t\tcopy_kprobe(old_p, p);\n\t\tret = add_new_kprobe(old_p, p);\n\t} else {\n\t\tap = kzalloc(sizeof(struct kprobe), GFP_KERNEL);\n\t\tif (!ap)\n\t\t\treturn -ENOMEM;\n\t\tadd_aggr_kprobe(ap, old_p);\n\t\tcopy_kprobe(ap, p);\n\t\tret = add_new_kprobe(ap, p);\n\t}\n\treturn ret;\n}\n\nstatic int __kprobes in_kprobes_functions(unsigned long addr)\n{\n\tif (addr >= (unsigned long)__kprobes_text_start &&\n\t addr < (unsigned long)__kprobes_text_end)\n\t\treturn -EINVAL;\n\treturn 0;\n}\n\nstatic int __kprobes __register_kprobe(struct kprobe *p,\n\tunsigned long called_from)\n{\n\tint ret = 0;\n\tstruct kprobe *old_p;\n\tstruct module *probed_mod;\n\n\t/*\n\t * If we have a symbol_name argument look it up,\n\t * and add it to the address. That way the addr\n\t * field can either be global or relative to a symbol.\n\t */\n\tif (p->symbol_name) {\n\t\tif (p->addr)\n\t\t\treturn -EINVAL;\n\t\tkprobe_lookup_name(p->symbol_name, p->addr);\n\t}\n\n\tif (!p->addr)\n\t\treturn -EINVAL;\n\tp->addr = (kprobe_opcode_t *)(((char *)p->addr)+ p->offset);\n\n\tif (!kernel_text_address((unsigned long) p->addr) ||\n\t in_kprobes_functions((unsigned long) p->addr))\n\t\treturn -EINVAL;\n\n\tp->mod_refcounted = 0;\n\n\t/*\n\t * Check if are we probing a module.\n\t */\n\tprobed_mod = module_text_address((unsigned long) p->addr);\n\tif (probed_mod) {\n\t\tstruct module *calling_mod = module_text_address(called_from);\n\t\t/*\n\t\t * We must allow modules to probe themself and in this case\n\t\t * avoid incrementing the module refcount, so as to allow\n\t\t * unloading of self probing modules.\n\t\t */\n\t\tif (calling_mod && calling_mod != probed_mod) {\n\t\t\tif (unlikely(!try_module_get(probed_mod)))\n\t\t\t\treturn -EINVAL;\n\t\t\tp->mod_refcounted = 1;\n\t\t} else\n\t\t\tprobed_mod = NULL;\n\t}\n\n\tp->nmissed = 0;\n\tmutex_lock(&kprobe_mutex);\n\told_p = get_kprobe(p->addr);\n\tif (old_p) {\n\t\tret = register_aggr_kprobe(old_p, p);\n\t\tif (!ret)\n\t\t\tatomic_inc(&kprobe_count);\n\t\tgoto out;\n\t}\n\n\tret = arch_prepare_kprobe(p);\n\tif (ret)\n\t\tgoto out;\n\n\tINIT_HLIST_NODE(&p->hlist);\n\thlist_add_head_rcu(&p->hlist,\n\t\t &kprobe_table[hash_ptr(p->addr, KPROBE_HASH_BITS)]);\n\n\tif (kprobe_enabled) {\n\t\tif (atomic_add_return(1, &kprobe_count) == \\\n\t\t\t\t(ARCH_INACTIVE_KPROBE_COUNT + 1))\n\t\t\tregister_page_fault_notifier(&kprobe_page_fault_nb);\n\n\t\tarch_arm_kprobe(p);\n\t}\nout:\n\tmutex_unlock(&kprobe_mutex);\n\n\tif (ret && probed_mod)\n\t\tmodule_put(probed_mod);\n\treturn ret;\n}\n\nint __kprobes register_kprobe(struct kprobe *p)\n{\n\treturn __register_kprobe(p, (unsigned long)__builtin_return_address(0));\n}\n\nvoid __kprobes unregister_kprobe(struct kprobe *p)\n{\n\tstruct module *mod;\n\tstruct kprobe *old_p, *list_p;\n\tint cleanup_p;\n\n\tmutex_lock(&kprobe_mutex);\n\told_p = get_kprobe(p->addr);\n\tif (unlikely(!old_p)) {\n\t\tmutex_unlock(&kprobe_mutex);\n\t\treturn;\n\t}\n\tif (p != old_p) {\n\t\tlist_for_each_entry_rcu(list_p, &old_p->list, list)\n\t\t\tif (list_p == p)\n\t\t\t/* kprobe p is a valid probe */\n\t\t\t\tgoto valid_p;\n\t\tmutex_unlock(&kprobe_mutex);\n\t\treturn;\n\t}\nvalid_p:\n\tif (old_p == p ||\n\t (old_p->pre_handler == aggr_pre_handler &&\n\t p->list.next == &old_p->list && p->list.prev == &old_p->list)) {\n\t\t/*\n\t\t * Only probe on the hash list. Disarm only if kprobes are\n\t\t * enabled - otherwise, the breakpoint would already have\n\t\t * been removed. We save on flushing icache.\n\t\t */\n\t\tif (kprobe_enabled)\n\t\t\tarch_disarm_kprobe(p);\n\t\thlist_del_rcu(&old_p->hlist);\n\t\tcleanup_p = 1;\n\t} else {\n\t\tlist_del_rcu(&p->list);\n\t\tcleanup_p = 0;\n\t}\n\n\tmutex_unlock(&kprobe_mutex);\n\n\tsynchronize_sched();\n\tif (p->mod_refcounted) {\n\t\tmod = module_text_address((unsigned long)p->addr);\n\t\tif (mod)\n\t\t\tmodule_put(mod);\n\t}\n\n\tif (cleanup_p) {\n\t\tif (p != old_p) {\n\t\t\tlist_del_rcu(&p->list);\n\t\t\tkfree(old_p);\n\t\t}\n\t\tarch_remove_kprobe(p);\n\t} else {\n\t\tmutex_lock(&kprobe_mutex);\n\t\tif (p->break_handler)\n\t\t\told_p->break_handler = NULL;\n\t\tif (p->post_handler){\n\t\t\tlist_for_each_entry_rcu(list_p, &old_p->list, list){\n\t\t\t\tif (list_p->post_handler){\n\t\t\t\t\tcleanup_p = 2;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (cleanup_p == 0)\n\t\t\t\told_p->post_handler = NULL;\n\t\t}\n\t\tmutex_unlock(&kprobe_mutex);\n\t}\n\n\t/* Call unregister_page_fault_notifier()\n\t * if no probes are active\n\t */\n\tmutex_lock(&kprobe_mutex);\n\tif (atomic_add_return(-1, &kprobe_count) == \\\n\t\t\t\tARCH_INACTIVE_KPROBE_COUNT)\n\t\tunregister_page_fault_notifier(&kprobe_page_fault_nb);\n\tmutex_unlock(&kprobe_mutex);\n\treturn;\n}\n\nstatic struct notifier_block kprobe_exceptions_nb = {\n\t.notifier_call = kprobe_exceptions_notify,\n\t.priority = 0x7fffffff /* we need to be notified first */\n};\n\n\nint __kprobes register_jprobe(struct jprobe *jp)\n{\n\t/* Todo: Verify probepoint is a function entry point */\n\tjp->kp.pre_handler = setjmp_pre_handler;\n\tjp->kp.break_handler = longjmp_break_handler;\n\n\treturn __register_kprobe(&jp->kp,\n\t\t(unsigned long)__builtin_return_address(0));\n}\n\nvoid __kprobes unregister_jprobe(struct jprobe *jp)\n{\n\tunregister_kprobe(&jp->kp);\n}\n\n#ifdef ARCH_SUPPORTS_KRETPROBES\n\n/*\n * This kprobe pre_handler is registered with every kretprobe. When probe\n * hits it will set up the return probe.\n */\nstatic int __kprobes pre_handler_kretprobe(struct kprobe *p,\n\t\t\t\t\t struct pt_regs *regs)\n{\n\tstruct kretprobe *rp = container_of(p, struct kretprobe, kp);\n\tunsigned long flags = 0;\n\n\t/*TODO: consider to only swap the RA after the last pre_handler fired */\n\tspin_lock_irqsave(&kretprobe_lock, flags);\n\tif (!hlist_empty(&rp->free_instances)) {\n\t\tstruct kretprobe_instance *ri;\n\n\t\tri = hlist_entry(rp->free_instances.first,\n\t\t\t\t struct kretprobe_instance, uflist);\n\t\tri->rp = rp;\n\t\tri->task = current;\n\t\tarch_prepare_kretprobe(ri, regs);\n\n\t\t/* XXX(hch): why is there no hlist_move_head? */\n\t\thlist_del(&ri->uflist);\n\t\thlist_add_head(&ri->uflist, &ri->rp->used_instances);\n\t\thlist_add_head(&ri->hlist, kretprobe_inst_table_head(ri->task));\n\t} else\n\t\trp->nmissed++;\n\tspin_unlock_irqrestore(&kretprobe_lock, flags);\n\treturn 0;\n}\n\nint __kprobes register_kretprobe(struct kretprobe *rp)\n{\n\tint ret = 0;\n\tstruct kretprobe_instance *inst;\n\tint i;\n\n\trp->kp.pre_handler = pre_handler_kretprobe;\n\trp->kp.post_handler = NULL;\n\trp->kp.fault_handler = NULL;\n\trp->kp.break_handler = NULL;\n\n\t/* Pre-allocate memory for max kretprobe instances */\n\tif (rp->maxactive <= 0) {\n#ifdef CONFIG_PREEMPT\n\t\trp->maxactive = max(10, 2 * NR_CPUS);\n#else\n\t\trp->maxactive = NR_CPUS;\n#endif\n\t}\n\tINIT_HLIST_HEAD(&rp->used_instances);\n\tINIT_HLIST_HEAD(&rp->free_instances);\n\tfor (i = 0; i < rp->maxactive; i++) {\n\t\tinst = kmalloc(sizeof(struct kretprobe_instance), GFP_KERNEL);\n\t\tif (inst == NULL) {\n\t\t\tfree_rp_inst(rp);\n\t\t\treturn -ENOMEM;\n\t\t}\n\t\tINIT_HLIST_NODE(&inst->uflist);\n\t\thlist_add_head(&inst->uflist, &rp->free_instances);\n\t}\n\n\trp->nmissed = 0;\n\t/* Establish function entry probe point */\n\tif ((ret = __register_kprobe(&rp->kp,\n\t\t(unsigned long)__builtin_return_address(0))) != 0)\n\t\tfree_rp_inst(rp);\n\treturn ret;\n}\n\n#else /* ARCH_SUPPORTS_KRETPROBES */\n\nint __kprobes register_kretprobe(struct kretprobe *rp)\n{\n\treturn -ENOSYS;\n}\n\nstatic int __kprobes pre_handler_kretprobe(struct kprobe *p,\n\t\t\t\t\t struct pt_regs *regs)\n{\n\treturn 0;\n}\n\n#endif /* ARCH_SUPPORTS_KRETPROBES */\n\nvoid __kprobes unregister_kretprobe(struct kretprobe *rp)\n{\n\tunsigned long flags;\n\tstruct kretprobe_instance *ri;\n\tstruct hlist_node *pos, *next;\n\n\tunregister_kprobe(&rp->kp);\n\n\t/* No race here */\n\tspin_lock_irqsave(&kretprobe_lock, flags);\n\thlist_for_each_entry_safe(ri, pos, next, &rp->used_instances, uflist) {\n\t\tri->rp = NULL;\n\t\thlist_del(&ri->uflist);\n\t}\n\tspin_unlock_irqrestore(&kretprobe_lock, flags);\n\tfree_rp_inst(rp);\n}\n\nstatic int __init init_kprobes(void)\n{\n\tint i, err = 0;\n\n\t/* FIXME allocate the probe table, currently defined statically */\n\t/* initialize all list heads */\n\tfor (i = 0; i < KPROBE_TABLE_SIZE; i++) {\n\t\tINIT_HLIST_HEAD(&kprobe_table[i]);\n\t\tINIT_HLIST_HEAD(&kretprobe_inst_table[i]);\n\t}\n\tatomic_set(&kprobe_count, 0);\n\n\t/* By default, kprobes are enabled */\n\tkprobe_enabled = true;\n\n\terr = arch_init_kprobes();\n\tif (!err)\n\t\terr = register_die_notifier(&kprobe_exceptions_nb);\n\n\treturn err;\n}\n\n#ifdef CONFIG_DEBUG_FS\nstatic void __kprobes report_probe(struct seq_file *pi, struct kprobe *p,\n\t\tconst char *sym, int offset,char *modname)\n{\n\tchar *kprobe_type;\n\n\tif (p->pre_handler == pre_handler_kretprobe)\n\t\tkprobe_type = \"r\";\n\telse if (p->pre_handler == setjmp_pre_handler)\n\t\tkprobe_type = \"j\";\n\telse\n\t\tkprobe_type = \"k\";\n\tif (sym)\n\t\tseq_printf(pi, \"%p %s %s+0x%x %s\\n\", p->addr, kprobe_type,\n\t\t\tsym, offset, (modname ? modname : \" \"));\n\telse\n\t\tseq_printf(pi, \"%p %s %p\\n\", p->addr, kprobe_type, p->addr);\n}\n\nstatic void __kprobes *kprobe_seq_start(struct seq_file *f, loff_t *pos)\n{\n\treturn (*pos < KPROBE_TABLE_SIZE) ? pos : NULL;\n}\n\nstatic void __kprobes *kprobe_seq_next(struct seq_file *f, void *v, loff_t *pos)\n{\n\t(*pos)++;\n\tif (*pos >= KPROBE_TABLE_SIZE)\n\t\treturn NULL;\n\treturn pos;\n}\n\nstatic void __kprobes kprobe_seq_stop(struct seq_file *f, void *v)\n{\n\t/* Nothing to do */\n}\n\nstatic int __kprobes show_kprobe_addr(struct seq_file *pi, void *v)\n{\n\tstruct hlist_head *head;\n\tstruct hlist_node *node;\n\tstruct kprobe *p, *kp;\n\tconst char *sym = NULL;\n\tunsigned int i = *(loff_t *) v;\n\tunsigned long offset = 0;\n\tchar *modname, namebuf[128];\n\n\thead = &kprobe_table[i];\n\tpreempt_disable();\n\thlist_for_each_entry_rcu(p, node, head, hlist) {\n\t\tsym = kallsyms_lookup((unsigned long)p->addr, NULL,\n\t\t\t\t\t&offset, &modname, namebuf);\n\t\tif (p->pre_handler == aggr_pre_handler) {\n\t\t\tlist_for_each_entry_rcu(kp, &p->list, list)\n\t\t\t\treport_probe(pi, kp, sym, offset, modname);\n\t\t} else\n\t\t\treport_probe(pi, p, sym, offset, modname);\n\t}\n\tpreempt_enable();\n\treturn 0;\n}\n\nstatic struct seq_operations kprobes_seq_ops = {\n\t.start = kprobe_seq_start,\n\t.next = kprobe_seq_next,\n\t.stop = kprobe_seq_stop,\n\t.show = show_kprobe_addr\n};\n\nstatic int __kprobes kprobes_open(struct inode *inode, struct file *filp)\n{\n\treturn seq_open(filp, &kprobes_seq_ops);\n}\n\nstatic struct file_operations debugfs_kprobes_operations = {\n\t.open = kprobes_open,\n\t.read = seq_read,\n\t.llseek = seq_lseek,\n\t.release = seq_release,\n};\n\nstatic void __kprobes enable_all_kprobes(void)\n{\n\tstruct hlist_head *head;\n\tstruct hlist_node *node;\n\tstruct kprobe *p;\n\tunsigned int i;\n\n\tmutex_lock(&kprobe_mutex);\n\n\t/* If kprobes are already enabled, just return */\n\tif (kprobe_enabled)\n\t\tgoto already_enabled;\n\n\t/*\n\t * Re-register the page fault notifier only if there are any\n\t * active probes at the time of enabling kprobes globally\n\t */\n\tif (atomic_read(&kprobe_count) > ARCH_INACTIVE_KPROBE_COUNT)\n\t\tregister_page_fault_notifier(&kprobe_page_fault_nb);\n\n\tfor (i = 0; i < KPROBE_TABLE_SIZE; i++) {\n\t\thead = &kprobe_table[i];\n\t\thlist_for_each_entry_rcu(p, node, head, hlist)\n\t\t\tarch_arm_kprobe(p);\n\t}\n\n\tkprobe_enabled = true;\n\tprintk(KERN_INFO \"Kprobes globally enabled\\n\");\n\nalready_enabled:\n\tmutex_unlock(&kprobe_mutex);\n\treturn;\n}\n\nstatic void __kprobes disable_all_kprobes(void)\n{\n\tstruct hlist_head *head;\n\tstruct hlist_node *node;\n\tstruct kprobe *p;\n\tunsigned int i;\n\n\tmutex_lock(&kprobe_mutex);\n\n\t/* If kprobes are already disabled, just return */\n\tif (!kprobe_enabled)\n\t\tgoto already_disabled;\n\n\tkprobe_enabled = false;\n\tprintk(KERN_INFO \"Kprobes globally disabled\\n\");\n\tfor (i = 0; i < KPROBE_TABLE_SIZE; i++) {\n\t\thead = &kprobe_table[i];\n\t\thlist_for_each_entry_rcu(p, node, head, hlist) {\n\t\t\tif (!arch_trampoline_kprobe(p))\n\t\t\t\tarch_disarm_kprobe(p);\n\t\t}\n\t}\n\n\tmutex_unlock(&kprobe_mutex);\n\t/* Allow all currently running kprobes to complete */\n\tsynchronize_sched();\n\n\tmutex_lock(&kprobe_mutex);\n\t/* Unconditionally unregister the page_fault notifier */\n\tunregister_page_fault_notifier(&kprobe_page_fault_nb);\n\nalready_disabled:\n\tmutex_unlock(&kprobe_mutex);\n\treturn;\n}\n\n/*\n * XXX: The debugfs bool file interface doesn't allow for callbacks\n * when the bool state is switched. We can reuse that facility when\n * available\n */\nstatic ssize_t read_enabled_file_bool(struct file *file,\n\t char __user *user_buf, size_t count, loff_t *ppos)\n{\n\tchar buf[3];\n\n\tif (kprobe_enabled)\n\t\tbuf[0] = '1';\n\telse\n\t\tbuf[0] = '0';\n\tbuf[1] = '\\n';\n\tbuf[2] = 0x00;\n\treturn simple_read_from_buffer(user_buf, count, ppos, buf, 2);\n}\n\nstatic ssize_t write_enabled_file_bool(struct file *file,\n\t const char __user *user_buf, size_t count, loff_t *ppos)\n{\n\tchar buf[32];\n\tint buf_size;\n\n\tbuf_size = min(count, (sizeof(buf)-1));\n\tif (copy_from_user(buf, user_buf, buf_size))\n\t\treturn -EFAULT;\n\n\tswitch (buf[0]) {\n\tcase 'y':\n\tcase 'Y':\n\tcase '1':\n\t\tenable_all_kprobes();\n\t\tbreak;\n\tcase 'n':\n\tcase 'N':\n\tcase '0':\n\t\tdisable_all_kprobes();\n\t\tbreak;\n\t}\n\n\treturn count;\n}\n\nstatic struct file_operations fops_kp = {\n\t.read = read_enabled_file_bool,\n\t.write = write_enabled_file_bool,\n};\n\nstatic int __kprobes debugfs_kprobe_init(void)\n{\n\tstruct dentry *dir, *file;\n\tunsigned int value = 1;\n\n\tdir = debugfs_create_dir(\"kprobes\", NULL);\n\tif (!dir)\n\t\treturn -ENOMEM;\n\n\tfile = debugfs_create_file(\"list\", 0444, dir, NULL,\n\t\t\t\t&debugfs_kprobes_operations);\n\tif (!file) {\n\t\tdebugfs_remove(dir);\n\t\treturn -ENOMEM;\n\t}\n\n\tfile = debugfs_create_file(\"enabled\", 0600, dir,\n\t\t\t\t\t&value, &fops_kp);\n\tif (!file) {\n\t\tdebugfs_remove(dir);\n\t\treturn -ENOMEM;\n\t}\n\n\treturn 0;\n}\n\nlate_initcall(debugfs_kprobe_init);\n#endif /* CONFIG_DEBUG_FS */\n\nmodule_init(init_kprobes);\n\nEXPORT_SYMBOL_GPL(register_kprobe);\nEXPORT_SYMBOL_GPL(unregister_kprobe);\nEXPORT_SYMBOL_GPL(register_jprobe);\nEXPORT_SYMBOL_GPL(unregister_jprobe);\nEXPORT_SYMBOL_GPL(jprobe_return);\nEXPORT_SYMBOL_GPL(register_kretprobe);\nEXPORT_SYMBOL_GPL(unregister_kretprobe);\n/*\n * kernel/ksysfs.c - sysfs attributes in /sys/kernel, which\n * \t\t are not related to any other subsystem\n *\n * Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>\n * \n * This file is release under the GPLv2\n *\n */\n\n#include <linux/kobject.h>\n#include <linux/string.h>\n#include <linux/sysfs.h>\n#include <linux/module.h>\n#include <linux/init.h>\n#include <linux/kexec.h>\n\n#define KERNEL_ATTR_RO(_name) \\\nstatic struct subsys_attribute _name##_attr = __ATTR_RO(_name)\n\n#define KERNEL_ATTR_RW(_name) \\\nstatic struct subsys_attribute _name##_attr = \\\n\t__ATTR(_name, 0644, _name##_show, _name##_store)\n\n#if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET)\n/* current uevent sequence number */\nstatic ssize_t uevent_seqnum_show(struct kset *kset, char *page)\n{\n\treturn sprintf(page, \"%llu\\n\", (unsigned long long)uevent_seqnum);\n}\nKERNEL_ATTR_RO(uevent_seqnum);\n\n/* uevent helper program, used during early boo */\nstatic ssize_t uevent_helper_show(struct kset *kset, char *page)\n{\n\treturn sprintf(page, \"%s\\n\", uevent_helper);\n}\nstatic ssize_t uevent_helper_store(struct kset *kset, const char *page, size_t count)\n{\n\tif (count+1 > UEVENT_HELPER_PATH_LEN)\n\t\treturn -ENOENT;\n\tmemcpy(uevent_helper, page, count);\n\tuevent_helper[count] = '\\0';\n\tif (count && uevent_helper[count-1] == '\\n')\n\t\tuevent_helper[count-1] = '\\0';\n\treturn count;\n}\nKERNEL_ATTR_RW(uevent_helper);\n#endif\n\n#ifdef CONFIG_KEXEC\nstatic ssize_t kexec_loaded_show(struct kset *kset, char *page)\n{\n\treturn sprintf(page, \"%d\\n\", !!kexec_image);\n}\nKERNEL_ATTR_RO(kexec_loaded);\n\nstatic ssize_t kexec_crash_loaded_show(struct kset *kset, char *page)\n{\n\treturn sprintf(page, \"%d\\n\", !!kexec_crash_image);\n}\nKERNEL_ATTR_RO(kexec_crash_loaded);\n#endif /* CONFIG_KEXEC */\n\ndecl_subsys(kernel, NULL, NULL);\nEXPORT_SYMBOL_GPL(kernel_subsys);\n\nstatic struct attribute * kernel_attrs[] = {\n#if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET)\n\t&uevent_seqnum_attr.attr,\n\t&uevent_helper_attr.attr,\n#endif\n#ifdef CONFIG_KEXEC\n\t&kexec_loaded_attr.attr,\n\t&kexec_crash_loaded_attr.attr,\n#endif\n\tNULL\n};\n\nstatic struct attribute_group kernel_attr_group = {\n\t.attrs = kernel_attrs,\n};\n\nstatic int __init ksysfs_init(void)\n{\n\tint error = subsystem_register(&kernel_subsys);\n\tif (!error)\n\t\terror = sysfs_create_group(&kernel_subsys.kobj,\n\t\t\t\t\t &kernel_attr_group);\n\n\treturn error;\n}\n\ncore_initcall(ksysfs_init);\n/* Kernel thread helper functions.\n * Copyright (C) 2004 IBM Corporation, Rusty Russell.\n *\n * Creation is done via kthreadd, so that we get a clean environment\n * even if we're invoked from userspace (think modprobe, hotplug cpu,\n * etc.).\n */\n#include <linux/sched.h>\n#include <linux/kthread.h>\n#include <linux/completion.h>\n#include <linux/err.h>\n#include <linux/unistd.h>\n#include <linux/file.h>\n#include <linux/module.h>\n#include <linux/mutex.h>\n#include <asm/semaphore.h>\n\nstatic DEFINE_SPINLOCK(kthread_create_lock);\nstatic LIST_HEAD(kthread_create_list);\nstruct task_struct *kthreadd_task;\n\nstruct kthread_create_info\n{\n\t/* Information passed to kthread() from kthreadd. */\n\tint (*threadfn)(void *data);\n\tvoid *data;\n\tstruct completion started;\n\n\t/* Result passed back to kthread_create() from kthreadd. */\n\tstruct task_struct *result;\n\tstruct completion done;\n\n\tstruct list_head list;\n};\n\nstruct kthread_stop_info\n{\n\tstruct task_struct *k;\n\tint err;\n\tstruct completion done;\n};\n\n/* Thread stopping is done by setthing this var: lock serializes\n * multiple kthread_stop calls. */\nstatic DEFINE_MUTEX(kthread_stop_lock);\nstatic struct kthread_stop_info kthread_stop_info;\n\n/**\n * kthread_should_stop - should this kthread return now?\n *\n * When someone calls kthread_stop() on your kthread, it will be woken\n * and this will return true. You should then return, and your return\n * value will be passed through to kthread_stop().\n */\nint kthread_should_stop(void)\n{\n\treturn (kthread_stop_info.k == current);\n}\nEXPORT_SYMBOL(kthread_should_stop);\n\nstatic int kthread(void *_create)\n{\n\tstruct kthread_create_info *create = _create;\n\tint (*threadfn)(void *data);\n\tvoid *data;\n\tint ret = -EINTR;\n\n\t/* Copy data: it's on kthread's stack */\n\tthreadfn = create->threadfn;\n\tdata = create->data;\n\n\t/* OK, tell user we're spawned, wait for stop or wakeup */\n\t__set_current_state(TASK_UNINTERRUPTIBLE);\n\tcomplete(&create->started);\n\tschedule();\n\n\tif (!kthread_should_stop())\n\t\tret = threadfn(data);\n\n\t/* It might have exited on its own, w/o kthread_stop. Check. */\n\tif (kthread_should_stop()) {\n\t\tkthread_stop_info.err = ret;\n\t\tcomplete(&kthread_stop_info.done);\n\t}\n\treturn 0;\n}\n\nstatic void create_kthread(struct kthread_create_info *create)\n{\n\tint pid;\n\n\t/* We want our own signal handler (we take no signals by default). */\n\tpid = kernel_thread(kthread, create, CLONE_FS | CLONE_FILES | SIGCHLD);\n\tif (pid < 0) {\n\t\tcreate->result = ERR_PTR(pid);\n\t} else {\n\t\twait_for_completion(&create->started);\n\t\tread_lock(&tasklist_lock);\n\t\tcreate->result = find_task_by_pid(pid);\n\t\tread_unlock(&tasklist_lock);\n\t}\n\tcomplete(&create->done);\n}\n\n/**\n * kthread_create - create a kthread.\n * @threadfn: the function to run until signal_pending(current).\n * @data: data ptr for @threadfn.\n * @namefmt: printf-style name for the thread.\n *\n * Description: This helper function creates and names a kernel\n * thread. The thread will be stopped: use wake_up_process() to start\n * it. See also kthread_run(), kthread_create_on_cpu().\n *\n * When woken, the thread will run @threadfn() with @data as its\n * argument. @threadfn() can either call do_exit() directly if it is a\n * standalone thread for which noone will call kthread_stop(), or\n * return when 'kthread_should_stop()' is true (which means\n * kthread_stop() has been called). The return value should be zero\n * or a negative error number; it will be passed to kthread_stop().\n *\n * Returns a task_struct or ERR_PTR(-ENOMEM).\n */\nstruct task_struct *kthread_create(int (*threadfn)(void *data),\n\t\t\t\t void *data,\n\t\t\t\t const char namefmt[],\n\t\t\t\t ...)\n{\n\tstruct kthread_create_info create;\n\n\tcreate.threadfn = threadfn;\n\tcreate.data = data;\n\tinit_completion(&create.started);\n\tinit_completion(&create.done);\n\n\tspin_lock(&kthread_create_lock);\n\tlist_add_tail(&create.list, &kthread_create_list);\n\twake_up_process(kthreadd_task);\n\tspin_unlock(&kthread_create_lock);\n\n\twait_for_completion(&create.done);\n\n\tif (!IS_ERR(create.result)) {\n\t\tva_list args;\n\t\tva_start(args, namefmt);\n\t\tvsnprintf(create.result->comm, sizeof(create.result->comm),\n\t\t\t namefmt, args);\n\t\tva_end(args);\n\t}\n\treturn create.result;\n}\nEXPORT_SYMBOL(kthread_create);\n\n/**\n * kthread_bind - bind a just-created kthread to a cpu.\n * @k: thread created by kthread_create().\n * @cpu: cpu (might not be online, must be possible) for @k to run on.\n *\n * Description: This function is equivalent to set_cpus_allowed(),\n * except that @cpu doesn't need to be online, and the thread must be\n * stopped (i.e., just returned from kthread_create()).\n */\nvoid kthread_bind(struct task_struct *k, unsigned int cpu)\n{\n\tif (k->state != TASK_UNINTERRUPTIBLE) {\n\t\tWARN_ON(1);\n\t\treturn;\n\t}\n\t/* Must have done schedule() in kthread() before we set_task_cpu */\n\twait_task_inactive(k);\n\tset_task_cpu(k, cpu);\n\tk->cpus_allowed = cpumask_of_cpu(cpu);\n}\nEXPORT_SYMBOL(kthread_bind);\n\n/**\n * kthread_stop - stop a thread created by kthread_create().\n * @k: thread created by kthread_create().\n *\n * Sets kthread_should_stop() for @k to return true, wakes it, and\n * waits for it to exit. Your threadfn() must not call do_exit()\n * itself if you use this function! This can also be called after\n * kthread_create() instead of calling wake_up_process(): the thread\n * will exit without calling threadfn().\n *\n * Returns the result of threadfn(), or %-EINTR if wake_up_process()\n * was never called.\n */\nint kthread_stop(struct task_struct *k)\n{\n\tint ret;\n\n\tmutex_lock(&kthread_stop_lock);\n\n\t/* It could exit after stop_info.k set, but before wake_up_process. */\n\tget_task_struct(k);\n\n\t/* Must init completion *before* thread sees kthread_stop_info.k */\n\tinit_completion(&kthread_stop_info.done);\n\tsmp_wmb();\n\n\t/* Now set kthread_should_stop() to true, and wake it up. */\n\tkthread_stop_info.k = k;\n\twake_up_process(k);\n\tput_task_struct(k);\n\n\t/* Once it dies, reset stop ptr, gather result and we're done. */\n\twait_for_completion(&kthread_stop_info.done);\n\tkthread_stop_info.k = NULL;\n\tret = kthread_stop_info.err;\n\tmutex_unlock(&kthread_stop_lock);\n\n\treturn ret;\n}\nEXPORT_SYMBOL(kthread_stop);\n\n\nstatic __init void kthreadd_setup(void)\n{\n\tstruct task_struct *tsk = current;\n\n\tset_task_comm(tsk, \"kthreadd\");\n\n\tignore_signals(tsk);\n\n\tset_user_nice(tsk, -5);\n\tset_cpus_allowed(tsk, CPU_MASK_ALL);\n}\n\nint kthreadd(void *unused)\n{\n\t/* Setup a clean context for our children to inherit. */\n\tkthreadd_setup();\n\n\tcurrent->flags |= PF_NOFREEZE;\n\n\tfor (;;) {\n\t\tset_current_state(TASK_INTERRUPTIBLE);\n\t\tif (list_empty(&kthread_create_list))\n\t\t\tschedule();\n\t\t__set_current_state(TASK_RUNNING);\n\n\t\tspin_lock(&kthread_create_lock);\n\t\twhile (!list_empty(&kthread_create_list)) {\n\t\t\tstruct kthread_create_info *create;\n\n\t\t\tcreate = list_entry(kthread_create_list.next,\n\t\t\t\t\t struct kthread_create_info, list);\n\t\t\tlist_del_init(&create->list);\n\t\t\tspin_unlock(&kthread_create_lock);\n\n\t\t\tcreate_kthread(create);\n\n\t\t\tspin_lock(&kthread_create_lock);\n\t\t}\n\t\tspin_unlock(&kthread_create_lock);\n\t}\n\n\treturn 0;\n}\n/*\n * latency.c: Explicit system-wide latency-expectation infrastructure\n *\n * The purpose of this infrastructure is to allow device drivers to set\n * latency constraint they have and to collect and summarize these\n * expectations globally. The cummulated result can then be used by\n * power management and similar users to make decisions that have\n * tradoffs with a latency component.\n *\n * An example user of this are the x86 C-states; each higher C state saves\n * more power, but has a higher exit latency. For the idle loop power\n * code to make a good decision which C-state to use, information about\n * acceptable latencies is required.\n *\n * An example announcer of latency is an audio driver that knowns it\n * will get an interrupt when the hardware has 200 usec of samples\n * left in the DMA buffer; in that case the driver can set a latency\n * constraint of, say, 150 usec.\n *\n * Multiple drivers can each announce their maximum accepted latency,\n * to keep these appart, a string based identifier is used.\n *\n *\n * (C) Copyright 2006 Intel Corporation\n * Author: Arjan van de Ven <arjan@linux.intel.com>\n *\n * This program is free software; you can redistribute it and/or\n * modify it under the terms of the GNU General Public License\n * as published by the Free Software Foundation; version 2\n * of the License.\n */\n\n#include <linux/latency.h>\n#include <linux/list.h>\n#include <linux/spinlock.h>\n#include <linux/slab.h>\n#include <linux/module.h>\n#include <linux/notifier.h>\n#include <linux/jiffies.h>\n#include <asm/atomic.h>\n\nstruct latency_info {\n\tstruct list_head list;\n\tint usecs;\n\tchar *identifier;\n};\n\n/*\n * locking rule: all modifications to current_max_latency and\n * latency_list need to be done while holding the latency_lock.\n * latency_lock needs to be taken _irqsave.\n */\nstatic atomic_t current_max_latency;\nstatic DEFINE_SPINLOCK(latency_lock);\n\nstatic LIST_HEAD(latency_list);\nstatic BLOCKING_NOTIFIER_HEAD(latency_notifier);\n\n/*\n * This function returns the maximum latency allowed, which\n * happens to be the minimum of all maximum latencies on the\n * list.\n */\nstatic int __find_max_latency(void)\n{\n\tint min = INFINITE_LATENCY;\n\tstruct latency_info *info;\n\n\tlist_for_each_entry(info, &latency_list, list) {\n\t\tif (info->usecs < min)\n\t\t\tmin = info->usecs;\n\t}\n\treturn min;\n}\n\n/**\n * set_acceptable_latency - sets the maximum latency acceptable\n * @identifier: string that identifies this driver\n * @usecs: maximum acceptable latency for this driver\n *\n * This function informs the kernel that this device(driver)\n * can accept at most usecs latency. This setting is used for\n * power management and similar tradeoffs.\n *\n * This function sleeps and can only be called from process\n * context.\n * Calling this function with an existing identifier is valid\n * and will cause the existing latency setting to be changed.\n */\nvoid set_acceptable_latency(char *identifier, int usecs)\n{\n\tstruct latency_info *info, *iter;\n\tunsigned long flags;\n\tint found_old = 0;\n\n\tinfo = kzalloc(sizeof(struct latency_info), GFP_KERNEL);\n\tif (!info)\n\t\treturn;\n\tinfo->usecs = usecs;\n\tinfo->identifier = kstrdup(identifier, GFP_KERNEL);\n\tif (!info->identifier)\n\t\tgoto free_info;\n\n\tspin_lock_irqsave(&latency_lock, flags);\n\tlist_for_each_entry(iter, &latency_list, list) {\n\t\tif (strcmp(iter->identifier, identifier)==0) {\n\t\t\tfound_old = 1;\n\t\t\titer->usecs = usecs;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (!found_old)\n\t\tlist_add(&info->list, &latency_list);\n\n\tif (usecs < atomic_read(&current_max_latency))\n\t\tatomic_set(&current_max_latency, usecs);\n\n\tspin_unlock_irqrestore(&latency_lock, flags);\n\n\tblocking_notifier_call_chain(&latency_notifier,\n\t\tatomic_read(&current_max_latency), NULL);\n\n\t/*\n\t * if we inserted the new one, we're done; otherwise there was\n\t * an existing one so we need to free the redundant data\n\t */\n\tif (!found_old)\n\t\treturn;\n\n\tkfree(info->identifier);\nfree_info:\n\tkfree(info);\n}\nEXPORT_SYMBOL_GPL(set_acceptable_latency);\n\n/**\n * modify_acceptable_latency - changes the maximum latency acceptable\n * @identifier: string that identifies this driver\n * @usecs: maximum acceptable latency for this driver\n *\n * This function informs the kernel that this device(driver)\n * can accept at most usecs latency. This setting is used for\n * power management and similar tradeoffs.\n *\n * This function does not sleep and can be called in any context.\n * Trying to use a non-existing identifier silently gets ignored.\n *\n * Due to the atomic nature of this function, the modified latency\n * value will only be used for future decisions; past decisions\n * can still lead to longer latencies in the near future.\n */\nvoid modify_acceptable_latency(char *identifier, int usecs)\n{\n\tstruct latency_info *iter;\n\tunsigned long flags;\n\n\tspin_lock_irqsave(&latency_lock, flags);\n\tlist_for_each_entry(iter, &latency_list, list) {\n\t\tif (strcmp(iter->identifier, identifier) == 0) {\n\t\t\titer->usecs = usecs;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (usecs < atomic_read(&current_max_latency))\n\t\tatomic_set(&current_max_latency, usecs);\n\tspin_unlock_irqrestore(&latency_lock, flags);\n}\nEXPORT_SYMBOL_GPL(modify_acceptable_latency);\n\n/**\n * remove_acceptable_latency - removes the maximum latency acceptable\n * @identifier: string that identifies this driver\n *\n * This function removes a previously set maximum latency setting\n * for the driver and frees up any resources associated with the\n * bookkeeping needed for this.\n *\n * This function does not sleep and can be called in any context.\n * Trying to use a non-existing identifier silently gets ignored.\n */\nvoid remove_acceptable_latency(char *identifier)\n{\n\tunsigned long flags;\n\tint newmax = 0;\n\tstruct latency_info *iter, *temp;\n\n\tspin_lock_irqsave(&latency_lock, flags);\n\n\tlist_for_each_entry_safe(iter, temp, &latency_list, list) {\n\t\tif (strcmp(iter->identifier, identifier) == 0) {\n\t\t\tlist_del(&iter->list);\n\t\t\tnewmax = iter->usecs;\n\t\t\tkfree(iter->identifier);\n\t\t\tkfree(iter);\n\t\t\tbreak;\n\t\t}\n\t}\n\n\t/* If we just deleted the system wide value, we need to\n\t * recalculate with a full search\n\t */\n\tif (newmax == atomic_read(&current_max_latency)) {\n\t\tnewmax = __find_max_latency();\n\t\tatomic_set(&current_max_latency, newmax);\n\t}\n\tspin_unlock_irqrestore(&latency_lock, flags);\n}\nEXPORT_SYMBOL_GPL(remove_acceptable_latency);\n\n/**\n * system_latency_constraint - queries the system wide latency maximum\n *\n * This function returns the system wide maximum latency in\n * microseconds.\n *\n * This function does not sleep and can be called in any context.\n */\nint system_latency_constraint(void)\n{\n\treturn atomic_read(&current_max_latency);\n}\nEXPORT_SYMBOL_GPL(system_latency_constraint);\n\n/**\n * synchronize_acceptable_latency - recalculates all latency decisions\n *\n * This function will cause a callback to various kernel pieces that\n * will make those pieces rethink their latency decisions. This implies\n * that if there are overlong latencies in hardware state already, those\n * latencies get taken right now. When this call completes no overlong\n * latency decisions should be active anymore.\n *\n * Typical usecase of this is after a modify_acceptable_latency() call,\n * which in itself is non-blocking and non-synchronizing.\n *\n * This function blocks and should not be called with locks held.\n */\n\nvoid synchronize_acceptable_latency(void)\n{\n\tblocking_notifier_call_chain(&latency_notifier,\n\t\tatomic_read(&current_max_latency), NULL);\n}\nEXPORT_SYMBOL_GPL(synchronize_acceptable_latency);\n\n/*\n * Latency notifier: this notifier gets called when a non-atomic new\n * latency value gets set. The expectation nof the caller of the\n * non-atomic set is that when the call returns, future latencies\n * are within bounds, so the functions on the notifier list are\n * expected to take the overlong latencies immediately, inside the\n * callback, and not make a overlong latency decision anymore.\n *\n * The callback gets called when the new latency value is made\n * active so system_latency_constraint() returns the new latency.\n */\nint register_latency_notifier(struct notifier_block * nb)\n{\n\treturn blocking_notifier_chain_register(&latency_notifier, nb);\n}\nEXPORT_SYMBOL_GPL(register_latency_notifier);\n\nint unregister_latency_notifier(struct notifier_block * nb)\n{\n\treturn blocking_notifier_chain_unregister(&latency_notifier, nb);\n}\nEXPORT_SYMBOL_GPL(unregister_latency_notifier);\n\nstatic __init int latency_init(void)\n{\n\tatomic_set(&current_max_latency, INFINITE_LATENCY);\n\t/*\n\t * we don't want by default to have longer latencies than 2 ticks,\n\t * since that would cause lost ticks\n\t */\n\tset_acceptable_latency(\"kernel\", 2*1000000/HZ);\n\treturn 0;\n}\n\nmodule_init(latency_init);\n/*\n * kernel/lockdep.c\n *\n * Runtime locking correctness validator\n *\n * Started by Ingo Molnar:\n *\n * Copyright (C) 2006 Red Hat, Inc., Ingo Molnar <mingo@redhat.com>\n *\n * this code maps all the lock dependencies as they occur in a live kernel\n * and will warn about the following classes of locking bugs:\n *\n * - lock inversion scenarios\n * - circular lock dependencies\n * - hardirq/softirq safe/unsafe locking bugs\n *\n * Bugs are reported even if the current locking scenario does not cause\n * any deadlock at this point.\n *\n * I.e. if anytime in the past two locks were taken in a different order,\n * even if it happened for another task, even if those were different\n * locks (but of the same class as this lock), this code will detect it.\n *\n * Thanks to Arjan van de Ven for coming up with the initial idea of\n * mapping lock dependencies runtime.\n */\n#include <linux/mutex.h>\n#include <linux/sched.h>\n#include <linux/delay.h>\n#include <linux/module.h>\n#include <linux/proc_fs.h>\n#include <linux/seq_file.h>\n#include <linux/spinlock.h>\n#include <linux/kallsyms.h>\n#include <linux/interrupt.h>\n#include <linux/stacktrace.h>\n#include <linux/debug_locks.h>\n#include <linux/irqflags.h>\n#include <linux/utsname.h>\n\n#include <asm/sections.h>\n\n#include \"lockdep_internals.h\"\n\n/*\n * lockdep_lock: protects the lockdep graph, the hashes and the\n * class/list/hash allocators.\n *\n * This is one of the rare exceptions where it's justified\n * to use a raw spinlock - we really dont want the spinlock\n * code to recurse back into the lockdep code...\n */\nstatic raw_spinlock_t lockdep_lock = (raw_spinlock_t)__RAW_SPIN_LOCK_UNLOCKED;\n\nstatic int graph_lock(void)\n{\n\t__raw_spin_lock(&lockdep_lock);\n\t/*\n\t * Make sure that if another CPU detected a bug while\n\t * walking the graph we dont change it (while the other\n\t * CPU is busy printing out stuff with the graph lock\n\t * dropped already)\n\t */\n\tif (!debug_locks) {\n\t\t__raw_spin_unlock(&lockdep_lock);\n\t\treturn 0;\n\t}\n\treturn 1;\n}\n\nstatic inline int graph_unlock(void)\n{\n\tif (debug_locks && !__raw_spin_is_locked(&lockdep_lock))\n\t\treturn DEBUG_LOCKS_WARN_ON(1);\n\n\t__raw_spin_unlock(&lockdep_lock);\n\treturn 0;\n}\n\n/*\n * Turn lock debugging off and return with 0 if it was off already,\n * and also release the graph lock:\n */\nstatic inline int debug_locks_off_graph_unlock(void)\n{\n\tint ret = debug_locks_off();\n\n\t__raw_spin_unlock(&lockdep_lock);\n\n\treturn ret;\n}\n\nstatic int lockdep_initialized;\n\nunsigned long nr_list_entries;\nstatic struct lock_list list_entries[MAX_LOCKDEP_ENTRIES];\n\n/*\n * Allocate a lockdep entry. (assumes the graph_lock held, returns\n * with NULL on failure)\n */\nstatic struct lock_list *alloc_list_entry(void)\n{\n\tif (nr_list_entries >= MAX_LOCKDEP_ENTRIES) {\n\t\tif (!debug_locks_off_graph_unlock())\n\t\t\treturn NULL;\n\n\t\tprintk(\"BUG: MAX_LOCKDEP_ENTRIES too low!\\n\");\n\t\tprintk(\"turning off the locking correctness validator.\\n\");\n\t\treturn NULL;\n\t}\n\treturn list_entries + nr_list_entries++;\n}\n\n/*\n * All data structures here are protected by the global debug_lock.\n *\n * Mutex key structs only get allocated, once during bootup, and never\n * get freed - this significantly simplifies the debugging code.\n */\nunsigned long nr_lock_classes;\nstatic struct lock_class lock_classes[MAX_LOCKDEP_KEYS];\n\n/*\n * We keep a global list of all lock classes. The list only grows,\n * never shrinks. The list is only accessed with the lockdep\n * spinlock lock held.\n */\nLIST_HEAD(all_lock_classes);\n\n/*\n * The lockdep classes are in a hash-table as well, for fast lookup:\n */\n#define CLASSHASH_BITS\t\t(MAX_LOCKDEP_KEYS_BITS - 1)\n#define CLASSHASH_SIZE\t\t(1UL << CLASSHASH_BITS)\n#define CLASSHASH_MASK\t\t(CLASSHASH_SIZE - 1)\n#define __classhashfn(key)\t((((unsigned long)key >> CLASSHASH_BITS) + (unsigned long)key) & CLASSHASH_MASK)\n#define classhashentry(key)\t(classhash_table + __classhashfn((key)))\n\nstatic struct list_head classhash_table[CLASSHASH_SIZE];\n\nunsigned long nr_lock_chains;\nstatic struct lock_chain lock_chains[MAX_LOCKDEP_CHAINS];\n\n/*\n * We put the lock dependency chains into a hash-table as well, to cache\n * their existence:\n */\n#define CHAINHASH_BITS\t\t(MAX_LOCKDEP_CHAINS_BITS-1)\n#define CHAINHASH_SIZE\t\t(1UL << CHAINHASH_BITS)\n#define CHAINHASH_MASK\t\t(CHAINHASH_SIZE - 1)\n#define __chainhashfn(chain) \\\n\t\t(((chain >> CHAINHASH_BITS) + chain) & CHAINHASH_MASK)\n#define chainhashentry(chain)\t(chainhash_table + __chainhashfn((chain)))\n\nstatic struct list_head chainhash_table[CHAINHASH_SIZE];\n\n/*\n * The hash key of the lock dependency chains is a hash itself too:\n * it's a hash of all locks taken up to that lock, including that lock.\n * It's a 64-bit hash, because it's important for the keys to be\n * unique.\n */\n#define iterate_chain_key(key1, key2) \\\n\t(((key1) << MAX_LOCKDEP_KEYS_BITS) ^ \\\n\t((key1) >> (64-MAX_LOCKDEP_KEYS_BITS)) ^ \\\n\t(key2))\n\nvoid lockdep_off(void)\n{\n\tcurrent->lockdep_recursion++;\n}\n\nEXPORT_SYMBOL(lockdep_off);\n\nvoid lockdep_on(void)\n{\n\tcurrent->lockdep_recursion--;\n}\n\nEXPORT_SYMBOL(lockdep_on);\n\n/*\n * Debugging switches:\n */\n\n#define VERBOSE\t\t\t0\n#define VERY_VERBOSE\t\t0\n\n#if VERBOSE\n# define HARDIRQ_VERBOSE\t1\n# define SOFTIRQ_VERBOSE\t1\n#else\n# define HARDIRQ_VERBOSE\t0\n# define SOFTIRQ_VERBOSE\t0\n#endif\n\n#if VERBOSE || HARDIRQ_VERBOSE || SOFTIRQ_VERBOSE\n/*\n * Quick filtering for interesting events:\n */\nstatic int class_filter(struct lock_class *class)\n{\n#if 0\n\t/* Example */\n\tif (class->name_version == 1 &&\n\t\t\t!strcmp(class->name, \"lockname\"))\n\t\treturn 1;\n\tif (class->name_version == 1 &&\n\t\t\t!strcmp(class->name, \"&struct->lockfield\"))\n\t\treturn 1;\n#endif\n\t/* Filter everything else. 1 would be to allow everything else */\n\treturn 0;\n}\n#endif\n\nstatic int verbose(struct lock_class *class)\n{\n#if VERBOSE\n\treturn class_filter(class);\n#endif\n\treturn 0;\n}\n\n#ifdef CONFIG_TRACE_IRQFLAGS\n\nstatic int hardirq_verbose(struct lock_class *class)\n{\n#if HARDIRQ_VERBOSE\n\treturn class_filter(class);\n#endif\n\treturn 0;\n}\n\nstatic int softirq_verbose(struct lock_class *class)\n{\n#if SOFTIRQ_VERBOSE\n\treturn class_filter(class);\n#endif\n\treturn 0;\n}\n\n#endif\n\n/*\n * Stack-trace: tightly packed array of stack backtrace\n * addresses. Protected by the graph_lock.\n */\nunsigned long nr_stack_trace_entries;\nstatic unsigned long stack_trace[MAX_STACK_TRACE_ENTRIES];\n\nstatic int save_trace(struct stack_trace *trace)\n{\n\ttrace->nr_entries = 0;\n\ttrace->max_entries = MAX_STACK_TRACE_ENTRIES - nr_stack_trace_entries;\n\ttrace->entries = stack_trace + nr_stack_trace_entries;\n\n\ttrace->skip = 3;\n\n\tsave_stack_trace(trace);\n\n\ttrace->max_entries = trace->nr_entries;\n\n\tnr_stack_trace_entries += trace->nr_entries;\n\n\tif (nr_stack_trace_entries == MAX_STACK_TRACE_ENTRIES) {\n\t\tif (!debug_locks_off_graph_unlock())\n\t\t\treturn 0;\n\n\t\tprintk(\"BUG: MAX_STACK_TRACE_ENTRIES too low!\\n\");\n\t\tprintk(\"turning off the locking correctness validator.\\n\");\n\t\tdump_stack();\n\n\t\treturn 0;\n\t}\n\n\treturn 1;\n}\n\nunsigned int nr_hardirq_chains;\nunsigned int nr_softirq_chains;\nunsigned int nr_process_chains;\nunsigned int max_lockdep_depth;\nunsigned int max_recursion_depth;\n\n#ifdef CONFIG_DEBUG_LOCKDEP\n/*\n * We cannot printk in early bootup code. Not even early_printk()\n * might work. So we mark any initialization errors and printk\n * about it later on, in lockdep_info().\n */\nstatic int lockdep_init_error;\n\n/*\n * Various lockdep statistics:\n */\natomic_t chain_lookup_hits;\natomic_t chain_lookup_misses;\natomic_t hardirqs_on_events;\natomic_t hardirqs_off_events;\natomic_t redundant_hardirqs_on;\natomic_t redundant_hardirqs_off;\natomic_t softirqs_on_events;\natomic_t softirqs_off_events;\natomic_t redundant_softirqs_on;\natomic_t redundant_softirqs_off;\natomic_t nr_unused_locks;\natomic_t nr_cyclic_checks;\natomic_t nr_cyclic_check_recursions;\natomic_t nr_find_usage_forwards_checks;\natomic_t nr_find_usage_forwards_recursions;\natomic_t nr_find_usage_backwards_checks;\natomic_t nr_find_usage_backwards_recursions;\n# define debug_atomic_inc(ptr)\t\tatomic_inc(ptr)\n# define debug_atomic_dec(ptr)\t\tatomic_dec(ptr)\n# define debug_atomic_read(ptr)\t\tatomic_read(ptr)\n#else\n# define debug_atomic_inc(ptr)\t\tdo { } while (0)\n# define debug_atomic_dec(ptr)\t\tdo { } while (0)\n# define debug_atomic_read(ptr)\t\t0\n#endif\n\n/*\n * Locking printouts:\n */\n\nstatic const char *usage_str[] =\n{\n\t[LOCK_USED] =\t\t\t\"initial-use \",\n\t[LOCK_USED_IN_HARDIRQ] =\t\"in-hardirq-W\",\n\t[LOCK_USED_IN_SOFTIRQ] =\t\"in-softirq-W\",\n\t[LOCK_ENABLED_SOFTIRQS] =\t\"softirq-on-W\",\n\t[LOCK_ENABLED_HARDIRQS] =\t\"hardirq-on-W\",\n\t[LOCK_USED_IN_HARDIRQ_READ] =\t\"in-hardirq-R\",\n\t[LOCK_USED_IN_SOFTIRQ_READ] =\t\"in-softirq-R\",\n\t[LOCK_ENABLED_SOFTIRQS_READ] =\t\"softirq-on-R\",\n\t[LOCK_ENABLED_HARDIRQS_READ] =\t\"hardirq-on-R\",\n};\n\nconst char * __get_key_name(struct lockdep_subclass_key *key, char *str)\n{\n\treturn kallsyms_lookup((unsigned long)key, NULL, NULL, NULL, str);\n}\n\nvoid\nget_usage_chars(struct lock_class *class, char *c1, char *c2, char *c3, char *c4)\n{\n\t*c1 = '.', *c2 = '.', *c3 = '.', *c4 = '.';\n\n\tif (class->usage_mask & LOCKF_USED_IN_HARDIRQ)\n\t\t*c1 = '+';\n\telse\n\t\tif (class->usage_mask & LOCKF_ENABLED_HARDIRQS)\n\t\t\t*c1 = '-';\n\n\tif (class->usage_mask & LOCKF_USED_IN_SOFTIRQ)\n\t\t*c2 = '+';\n\telse\n\t\tif (class->usage_mask & LOCKF_ENABLED_SOFTIRQS)\n\t\t\t*c2 = '-';\n\n\tif (class->usage_mask & LOCKF_ENABLED_HARDIRQS_READ)\n\t\t*c3 = '-';\n\tif (class->usage_mask & LOCKF_USED_IN_HARDIRQ_READ) {\n\t\t*c3 = '+';\n\t\tif (class->usage_mask & LOCKF_ENABLED_HARDIRQS_READ)\n\t\t\t*c3 = '?';\n\t}\n\n\tif (class->usage_mask & LOCKF_ENABLED_SOFTIRQS_READ)\n\t\t*c4 = '-';\n\tif (class->usage_mask & LOCKF_USED_IN_SOFTIRQ_READ) {\n\t\t*c4 = '+';\n\t\tif (class->usage_mask & LOCKF_ENABLED_SOFTIRQS_READ)\n\t\t\t*c4 = '?';\n\t}\n}\n\nstatic void print_lock_name(struct lock_class *class)\n{\n\tchar str[KSYM_NAME_LEN + 1], c1, c2, c3, c4;\n\tconst char *name;\n\n\tget_usage_chars(class, &c1, &c2, &c3, &c4);\n\n\tname = class->name;\n\tif (!name) {\n\t\tname = __get_key_name(class->key, str);\n\t\tprintk(\" (%s\", name);\n\t} else {\n\t\tprintk(\" (%s\", name);\n\t\tif (class->name_version > 1)\n\t\t\tprintk(\"#%d\", class->name_version);\n\t\tif (class->subclass)\n\t\t\tprintk(\"/%d\", class->subclass);\n\t}\n\tprintk(\"){%c%c%c%c}\", c1, c2, c3, c4);\n}\n\nstatic void print_lockdep_cache(struct lockdep_map *lock)\n{\n\tconst char *name;\n\tchar str[KSYM_NAME_LEN + 1];\n\n\tname = lock->name;\n\tif (!name)\n\t\tname = __get_key_name(lock->key->subkeys, str);\n\n\tprintk(\"%s\", name);\n}\n\nstatic void print_lock(struct held_lock *hlock)\n{\n\tprint_lock_name(hlock->class);\n\tprintk(\", at: \");\n\tprint_ip_sym(hlock->acquire_ip);\n}\n\nstatic void lockdep_print_held_locks(struct task_struct *curr)\n{\n\tint i, depth = curr->lockdep_depth;\n\n\tif (!depth) {\n\t\tprintk(\"no locks held by %s/%d.\\n\", curr->comm, curr->pid);\n\t\treturn;\n\t}\n\tprintk(\"%d lock%s held by %s/%d:\\n\",\n\t\tdepth, depth > 1 ? \"s\" : \"\", curr->comm, curr->pid);\n\n\tfor (i = 0; i < depth; i++) {\n\t\tprintk(\" #%d: \", i);\n\t\tprint_lock(curr->held_locks + i);\n\t}\n}\n\nstatic void print_lock_class_header(struct lock_class *class, int depth)\n{\n\tint bit;\n\n\tprintk(\"%*s->\", depth, \"\");\n\tprint_lock_name(class);\n\tprintk(\" ops: %lu\", class->ops);\n\tprintk(\" {\\n\");\n\n\tfor (bit = 0; bit < LOCK_USAGE_STATES; bit++) {\n\t\tif (class->usage_mask & (1 << bit)) {\n\t\t\tint len = depth;\n\n\t\t\tlen += printk(\"%*s %s\", depth, \"\", usage_str[bit]);\n\t\t\tlen += printk(\" at:\\n\");\n\t\t\tprint_stack_trace(class->usage_traces + bit, len);\n\t\t}\n\t}\n\tprintk(\"%*s }\\n\", depth, \"\");\n\n\tprintk(\"%*s ... key at: \",depth,\"\");\n\tprint_ip_sym((unsigned long)class->key);\n}\n\n/*\n * printk all lock dependencies starting at <entry>:\n */\nstatic void print_lock_dependencies(struct lock_class *class, int depth)\n{\n\tstruct lock_list *entry;\n\n\tif (DEBUG_LOCKS_WARN_ON(depth >= 20))\n\t\treturn;\n\n\tprint_lock_class_header(class, depth);\n\n\tlist_for_each_entry(entry, &class->locks_after, entry) {\n\t\tif (DEBUG_LOCKS_WARN_ON(!entry->class))\n\t\t\treturn;\n\n\t\tprint_lock_dependencies(entry->class, depth + 1);\n\n\t\tprintk(\"%*s ... acquired at:\\n\",depth,\"\");\n\t\tprint_stack_trace(&entry->trace, 2);\n\t\tprintk(\"\\n\");\n\t}\n}\n\n/*\n * Add a new dependency to the head of the list:\n */\nstatic int add_lock_to_list(struct lock_class *class, struct lock_class *this,\n\t\t\t struct list_head *head, unsigned long ip, int distance)\n{\n\tstruct lock_list *entry;\n\t/*\n\t * Lock not present yet - get a new dependency struct and\n\t * add it to the list:\n\t */\n\tentry = alloc_list_entry();\n\tif (!entry)\n\t\treturn 0;\n\n\tentry->class = this;\n\tentry->distance = distance;\n\tif (!save_trace(&entry->trace))\n\t\treturn 0;\n\n\t/*\n\t * Since we never remove from the dependency list, the list can\n\t * be walked lockless by other CPUs, it's only allocation\n\t * that must be protected by the spinlock. But this also means\n\t * we must make new entries visible only once writes to the\n\t * entry become visible - hence the RCU op:\n\t */\n\tlist_add_tail_rcu(&entry->entry, head);\n\n\treturn 1;\n}\n\n/*\n * Recursive, forwards-direction lock-dependency checking, used for\n * both noncyclic checking and for hardirq-unsafe/softirq-unsafe\n * checking.\n *\n * (to keep the stackframe of the recursive functions small we\n * use these global variables, and we also mark various helper\n * functions as noinline.)\n */\nstatic struct held_lock *check_source, *check_target;\n\n/*\n * Print a dependency chain entry (this is only done when a deadlock\n * has been detected):\n */\nstatic noinline int\nprint_circular_bug_entry(struct lock_list *target, unsigned int depth)\n{\n\tif (debug_locks_silent)\n\t\treturn 0;\n\tprintk(\"\\n-> #%u\", depth);\n\tprint_lock_name(target->class);\n\tprintk(\":\\n\");\n\tprint_stack_trace(&target->trace, 6);\n\n\treturn 0;\n}\n\nstatic void print_kernel_version(void)\n{\n\tprintk(\"%s %.*s\\n\", init_utsname()->release,\n\t\t(int)strcspn(init_utsname()->version, \" \"),\n\t\tinit_utsname()->version);\n}\n\n/*\n * When a circular dependency is detected, print the\n * header first:\n */\nstatic noinline int\nprint_circular_bug_header(struct lock_list *entry, unsigned int depth)\n{\n\tstruct task_struct *curr = current;\n\n\tif (!debug_locks_off_graph_unlock() || debug_locks_silent)\n\t\treturn 0;\n\n\tprintk(\"\\n=======================================================\\n\");\n\tprintk( \"[ INFO: possible circular locking dependency detected ]\\n\");\n\tprint_kernel_version();\n\tprintk( \"-------------------------------------------------------\\n\");\n\tprintk(\"%s/%d is trying to acquire lock:\\n\",\n\t\tcurr->comm, curr->pid);\n\tprint_lock(check_source);\n\tprintk(\"\\nbut task is already holding lock:\\n\");\n\tprint_lock(check_target);\n\tprintk(\"\\nwhich lock already depends on the new lock.\\n\\n\");\n\tprintk(\"\\nthe existing dependency chain (in reverse order) is:\\n\");\n\n\tprint_circular_bug_entry(entry, depth);\n\n\treturn 0;\n}\n\nstatic noinline int print_circular_bug_tail(void)\n{\n\tstruct task_struct *curr = current;\n\tstruct lock_list this;\n\n\tif (debug_locks_silent)\n\t\treturn 0;\n\n\tthis.class = check_source->class;\n\tif (!save_trace(&this.trace))\n\t\treturn 0;\n\n\tprint_circular_bug_entry(&this, 0);\n\n\tprintk(\"\\nother info that might help us debug this:\\n\\n\");\n\tlockdep_print_held_locks(curr);\n\n\tprintk(\"\\nstack backtrace:\\n\");\n\tdump_stack();\n\n\treturn 0;\n}\n\n#define RECURSION_LIMIT 40\n\nstatic int noinline print_infinite_recursion_bug(void)\n{\n\tif (!debug_locks_off_graph_unlock())\n\t\treturn 0;\n\n\tWARN_ON(1);\n\n\treturn 0;\n}\n\n/*\n * Prove that the dependency graph starting at <entry> can not\n * lead to <target>. Print an error and return 0 if it does.\n */\nstatic noinline int\ncheck_noncircular(struct lock_class *source, unsigned int depth)\n{\n\tstruct lock_list *entry;\n\n\tdebug_atomic_inc(&nr_cyclic_check_recursions);\n\tif (depth > max_recursion_depth)\n\t\tmax_recursion_depth = depth;\n\tif (depth >= RECURSION_LIMIT)\n\t\treturn print_infinite_recursion_bug();\n\t/*\n\t * Check this lock's dependency list:\n\t */\n\tlist_for_each_entry(entry, &source->locks_after, entry) {\n\t\tif (entry->class == check_target->class)\n\t\t\treturn print_circular_bug_header(entry, depth+1);\n\t\tdebug_atomic_inc(&nr_cyclic_checks);\n\t\tif (!check_noncircular(entry->class, depth+1))\n\t\t\treturn print_circular_bug_entry(entry, depth+1);\n\t}\n\treturn 1;\n}\n\nstatic int very_verbose(struct lock_class *class)\n{\n#if VERY_VERBOSE\n\treturn class_filter(class);\n#endif\n\treturn 0;\n}\n#ifdef CONFIG_TRACE_IRQFLAGS\n\n/*\n * Forwards and backwards subgraph searching, for the purposes of\n * proving that two subgraphs can be connected by a new dependency\n * without creating any illegal irq-safe -> irq-unsafe lock dependency.\n */\nstatic enum lock_usage_bit find_usage_bit;\nstatic struct lock_class *forwards_match, *backwards_match;\n\n/*\n * Find a node in the forwards-direction dependency sub-graph starting\n * at <source> that matches <find_usage_bit>.\n *\n * Return 2 if such a node exists in the subgraph, and put that node\n * into <forwards_match>.\n *\n * Return 1 otherwise and keep <forwards_match> unchanged.\n * Return 0 on error.\n */\nstatic noinline int\nfind_usage_forwards(struct lock_class *source, unsigned int depth)\n{\n\tstruct lock_list *entry;\n\tint ret;\n\n\tif (depth > max_recursion_depth)\n\t\tmax_recursion_depth = depth;\n\tif (depth >= RECURSION_LIMIT)\n\t\treturn print_infinite_recursion_bug();\n\n\tdebug_atomic_inc(&nr_find_usage_forwards_checks);\n\tif (source->usage_mask & (1 << find_usage_bit)) {\n\t\tforwards_match = source;\n\t\treturn 2;\n\t}\n\n\t/*\n\t * Check this lock's dependency list:\n\t */\n\tlist_for_each_entry(entry, &source->locks_after, entry) {\n\t\tdebug_atomic_inc(&nr_find_usage_forwards_recursions);\n\t\tret = find_usage_forwards(entry->class, depth+1);\n\t\tif (ret == 2 || ret == 0)\n\t\t\treturn ret;\n\t}\n\treturn 1;\n}\n\n/*\n * Find a node in the backwards-direction dependency sub-graph starting\n * at <source> that matches <find_usage_bit>.\n *\n * Return 2 if such a node exists in the subgraph, and put that node\n * into <backwards_match>.\n *\n * Return 1 otherwise and keep <backwards_match> unchanged.\n * Return 0 on error.\n */\nstatic noinline int\nfind_usage_backwards(struct lock_class *source, unsigned int depth)\n{\n\tstruct lock_list *entry;\n\tint ret;\n\n\tif (!__raw_spin_is_locked(&lockdep_lock))\n\t\treturn DEBUG_LOCKS_WARN_ON(1);\n\n\tif (depth > max_recursion_depth)\n\t\tmax_recursion_depth = depth;\n\tif (depth >= RECURSION_LIMIT)\n\t\treturn print_infinite_recursion_bug();\n\n\tdebug_atomic_inc(&nr_find_usage_backwards_checks);\n\tif (source->usage_mask & (1 << find_usage_bit)) {\n\t\tbackwards_match = source;\n\t\treturn 2;\n\t}\n\n\t/*\n\t * Check this lock's dependency list:\n\t */\n\tlist_for_each_entry(entry, &source->locks_before, entry) {\n\t\tdebug_atomic_inc(&nr_find_usage_backwards_recursions);\n\t\tret = find_usage_backwards(entry->class, depth+1);\n\t\tif (ret == 2 || ret == 0)\n\t\t\treturn ret;\n\t}\n\treturn 1;\n}\n\nstatic int\nprint_bad_irq_dependency(struct task_struct *curr,\n\t\t\t struct held_lock *prev,\n\t\t\t struct held_lock *next,\n\t\t\t enum lock_usage_bit bit1,\n\t\t\t enum lock_usage_bit bit2,\n\t\t\t const char *irqclass)\n{\n\tif (!debug_locks_off_graph_unlock() || debug_locks_silent)\n\t\treturn 0;\n\n\tprintk(\"\\n======================================================\\n\");\n\tprintk( \"[ INFO: %s-safe -> %s-unsafe lock order detected ]\\n\",\n\t\tirqclass, irqclass);\n\tprint_kernel_version();\n\tprintk( \"------------------------------------------------------\\n\");\n\tprintk(\"%s/%d [HC%u[%lu]:SC%u[%lu]:HE%u:SE%u] is trying to acquire:\\n\",\n\t\tcurr->comm, curr->pid,\n\t\tcurr->hardirq_context, hardirq_count() >> HARDIRQ_SHIFT,\n\t\tcurr->softirq_context, softirq_count() >> SOFTIRQ_SHIFT,\n\t\tcurr->hardirqs_enabled,\n\t\tcurr->softirqs_enabled);\n\tprint_lock(next);\n\n\tprintk(\"\\nand this task is already holding:\\n\");\n\tprint_lock(prev);\n\tprintk(\"which would create a new lock dependency:\\n\");\n\tprint_lock_name(prev->class);\n\tprintk(\" ->\");\n\tprint_lock_name(next->class);\n\tprintk(\"\\n\");\n\n\tprintk(\"\\nbut this new dependency connects a %s-irq-safe lock:\\n\",\n\t\tirqclass);\n\tprint_lock_name(backwards_match);\n\tprintk(\"\\n... which became %s-irq-safe at:\\n\", irqclass);\n\n\tprint_stack_trace(backwards_match->usage_traces + bit1, 1);\n\n\tprintk(\"\\nto a %s-irq-unsafe lock:\\n\", irqclass);\n\tprint_lock_name(forwards_match);\n\tprintk(\"\\n... which became %s-irq-unsafe at:\\n\", irqclass);\n\tprintk(\"...\");\n\n\tprint_stack_trace(forwards_match->usage_traces + bit2, 1);\n\n\tprintk(\"\\nother info that might help us debug this:\\n\\n\");\n\tlockdep_print_held_locks(curr);\n\n\tprintk(\"\\nthe %s-irq-safe lock's dependencies:\\n\", irqclass);\n\tprint_lock_dependencies(backwards_match, 0);\n\n\tprintk(\"\\nthe %s-irq-unsafe lock's dependencies:\\n\", irqclass);\n\tprint_lock_dependencies(forwards_match, 0);\n\n\tprintk(\"\\nstack backtrace:\\n\");\n\tdump_stack();\n\n\treturn 0;\n}\n\nstatic int\ncheck_usage(struct task_struct *curr, struct held_lock *prev,\n\t struct held_lock *next, enum lock_usage_bit bit_backwards,\n\t enum lock_usage_bit bit_forwards, const char *irqclass)\n{\n\tint ret;\n\n\tfind_usage_bit = bit_backwards;\n\t/* fills in <backwards_match> */\n\tret = find_usage_backwards(prev->class, 0);\n\tif (!ret || ret == 1)\n\t\treturn ret;\n\n\tfind_usage_bit = bit_forwards;\n\tret = find_usage_forwards(next->class, 0);\n\tif (!ret || ret == 1)\n\t\treturn ret;\n\t/* ret == 2 */\n\treturn print_bad_irq_dependency(curr, prev, next,\n\t\t\tbit_backwards, bit_forwards, irqclass);\n}\n\n#endif\n\nstatic int\nprint_deadlock_bug(struct task_struct *curr, struct held_lock *prev,\n\t\t struct held_lock *next)\n{\n\tif (!debug_locks_off_graph_unlock() || debug_locks_silent)\n\t\treturn 0;\n\n\tprintk(\"\\n=============================================\\n\");\n\tprintk( \"[ INFO: possible recursive locking detected ]\\n\");\n\tprint_kernel_version();\n\tprintk( \"---------------------------------------------\\n\");\n\tprintk(\"%s/%d is trying to acquire lock:\\n\",\n\t\tcurr->comm, curr->pid);\n\tprint_lock(next);\n\tprintk(\"\\nbut task is already holding lock:\\n\");\n\tprint_lock(prev);\n\n\tprintk(\"\\nother info that might help us debug this:\\n\");\n\tlockdep_print_held_locks(curr);\n\n\tprintk(\"\\nstack backtrace:\\n\");\n\tdump_stack();\n\n\treturn 0;\n}\n\n/*\n * Check whether we are holding such a class already.\n *\n * (Note that this has to be done separately, because the graph cannot\n * detect such classes of deadlocks.)\n *\n * Returns: 0 on deadlock detected, 1 on OK, 2 on recursive read\n */\nstatic int\ncheck_deadlock(struct task_struct *curr, struct held_lock *next,\n\t struct lockdep_map *next_instance, int read)\n{\n\tstruct held_lock *prev;\n\tint i;\n\n\tfor (i = 0; i < curr->lockdep_depth; i++) {\n\t\tprev = curr->held_locks + i;\n\t\tif (prev->class != next->class)\n\t\t\tcontinue;\n\t\t/*\n\t\t * Allow read-after-read recursion of the same\n\t\t * lock class (i.e. read_lock(lock)+read_lock(lock)):\n\t\t */\n\t\tif ((read == 2) && prev->read)\n\t\t\treturn 2;\n\t\treturn print_deadlock_bug(curr, prev, next);\n\t}\n\treturn 1;\n}\n\n/*\n * There was a chain-cache miss, and we are about to add a new dependency\n * to a previous lock. We recursively validate the following rules:\n *\n * - would the adding of the <prev> -> <next> dependency create a\n * circular dependency in the graph? [== circular deadlock]\n *\n * - does the new prev->next dependency connect any hardirq-safe lock\n * (in the full backwards-subgraph starting at <prev>) with any\n * hardirq-unsafe lock (in the full forwards-subgraph starting at\n * <next>)? [== illegal lock inversion with hardirq contexts]\n *\n * - does the new prev->next dependency connect any softirq-safe lock\n * (in the full backwards-subgraph starting at <prev>) with any\n * softirq-unsafe lock (in the full forwards-subgraph starting at\n * <next>)? [== illegal lock inversion with softirq contexts]\n *\n * any of these scenarios could lead to a deadlock.\n *\n * Then if all the validations pass, we add the forwards and backwards\n * dependency.\n */\nstatic int\ncheck_prev_add(struct task_struct *curr, struct held_lock *prev,\n\t struct held_lock *next, int distance)\n{\n\tstruct lock_list *entry;\n\tint ret;\n\n\t/*\n\t * Prove that the new <prev> -> <next> dependency would not\n\t * create a circular dependency in the graph. (We do this by\n\t * forward-recursing into the graph starting at <next>, and\n\t * checking whether we can reach <prev>.)\n\t *\n\t * We are using global variables to control the recursion, to\n\t * keep the stackframe size of the recursive functions low:\n\t */\n\tcheck_source = next;\n\tcheck_target = prev;\n\tif (!(check_noncircular(next->class, 0)))\n\t\treturn print_circular_bug_tail();\n\n#ifdef CONFIG_TRACE_IRQFLAGS\n\t/*\n\t * Prove that the new dependency does not connect a hardirq-safe\n\t * lock with a hardirq-unsafe lock - to achieve this we search\n\t * the backwards-subgraph starting at <prev>, and the\n\t * forwards-subgraph starting at <next>:\n\t */\n\tif (!check_usage(curr, prev, next, LOCK_USED_IN_HARDIRQ,\n\t\t\t\t\tLOCK_ENABLED_HARDIRQS, \"hard\"))\n\t\treturn 0;\n\n\t/*\n\t * Prove that the new dependency does not connect a hardirq-safe-read\n\t * lock with a hardirq-unsafe lock - to achieve this we search\n\t * the backwards-subgraph starting at <prev>, and the\n\t * forwards-subgraph starting at <next>:\n\t */\n\tif (!check_usage(curr, prev, next, LOCK_USED_IN_HARDIRQ_READ,\n\t\t\t\t\tLOCK_ENABLED_HARDIRQS, \"hard-read\"))\n\t\treturn 0;\n\n\t/*\n\t * Prove that the new dependency does not connect a softirq-safe\n\t * lock with a softirq-unsafe lock - to achieve this we search\n\t * the backwards-subgraph starting at <prev>, and the\n\t * forwards-subgraph starting at <next>:\n\t */\n\tif (!check_usage(curr, prev, next, LOCK_USED_IN_SOFTIRQ,\n\t\t\t\t\tLOCK_ENABLED_SOFTIRQS, \"soft\"))\n\t\treturn 0;\n\t/*\n\t * Prove that the new dependency does not connect a softirq-safe-read\n\t * lock with a softirq-unsafe lock - to achieve this we search\n\t * the backwards-subgraph starting at <prev>, and the\n\t * forwards-subgraph starting at <next>:\n\t */\n\tif (!check_usage(curr, prev, next, LOCK_USED_IN_SOFTIRQ_READ,\n\t\t\t\t\tLOCK_ENABLED_SOFTIRQS, \"soft\"))\n\t\treturn 0;\n#endif\n\t/*\n\t * For recursive read-locks we do all the dependency checks,\n\t * but we dont store read-triggered dependencies (only\n\t * write-triggered dependencies). This ensures that only the\n\t * write-side dependencies matter, and that if for example a\n\t * write-lock never takes any other locks, then the reads are\n\t * equivalent to a NOP.\n\t */\n\tif (next->read == 2 || prev->read == 2)\n\t\treturn 1;\n\t/*\n\t * Is the <prev> -> <next> dependency already present?\n\t *\n\t * (this may occur even though this is a new chain: consider\n\t * e.g. the L1 -> L2 -> L3 -> L4 and the L5 -> L1 -> L2 -> L3\n\t * chains - the second one will be new, but L1 already has\n\t * L2 added to its dependency list, due to the first chain.)\n\t */\n\tlist_for_each_entry(entry, &prev->class->locks_after, entry) {\n\t\tif (entry->class == next->class) {\n\t\t\tif (distance == 1)\n\t\t\t\tentry->distance = 1;\n\t\t\treturn 2;\n\t\t}\n\t}\n\n\t/*\n\t * Ok, all validations passed, add the new lock\n\t * to the previous lock's dependency list:\n\t */\n\tret = add_lock_to_list(prev->class, next->class,\n\t\t\t &prev->class->locks_after, next->acquire_ip, distance);\n\n\tif (!ret)\n\t\treturn 0;\n\n\tret = add_lock_to_list(next->class, prev->class,\n\t\t\t &next->class->locks_before, next->acquire_ip, distance);\n\tif (!ret)\n\t\treturn 0;\n\n\t/*\n\t * Debugging printouts:\n\t */\n\tif (verbose(prev->class) || verbose(next->class)) {\n\t\tgraph_unlock();\n\t\tprintk(\"\\n new dependency: \");\n\t\tprint_lock_name(prev->class);\n\t\tprintk(\" => \");\n\t\tprint_lock_name(next->class);\n\t\tprintk(\"\\n\");\n\t\tdump_stack();\n\t\treturn graph_lock();\n\t}\n\treturn 1;\n}\n\n/*\n * Add the dependency to all directly-previous locks that are 'relevant'.\n * The ones that are relevant are (in increasing distance from curr):\n * all consecutive trylock entries and the final non-trylock entry - or\n * the end of this context's lock-chain - whichever comes first.\n */\nstatic int\ncheck_prevs_add(struct task_struct *curr, struct held_lock *next)\n{\n\tint depth = curr->lockdep_depth;\n\tstruct held_lock *hlock;\n\n\t/*\n\t * Debugging checks.\n\t *\n\t * Depth must not be zero for a non-head lock:\n\t */\n\tif (!depth)\n\t\tgoto out_bug;\n\t/*\n\t * At least two relevant locks must exist for this\n\t * to be a head:\n\t */\n\tif (curr->held_locks[depth].irq_context !=\n\t\t\tcurr->held_locks[depth-1].irq_context)\n\t\tgoto out_bug;\n\n\tfor (;;) {\n\t\tint distance = curr->lockdep_depth - depth + 1;\n\t\thlock = curr->held_locks + depth-1;\n\t\t/*\n\t\t * Only non-recursive-read entries get new dependencies\n\t\t * added:\n\t\t */\n\t\tif (hlock->read != 2) {\n\t\t\tif (!check_prev_add(curr, hlock, next, distance))\n\t\t\t\treturn 0;\n\t\t\t/*\n\t\t\t * Stop after the first non-trylock entry,\n\t\t\t * as non-trylock entries have added their\n\t\t\t * own direct dependencies already, so this\n\t\t\t * lock is connected to them indirectly:\n\t\t\t */\n\t\t\tif (!hlock->trylock)\n\t\t\t\tbreak;\n\t\t}\n\t\tdepth--;\n\t\t/*\n\t\t * End of lock-stack?\n\t\t */\n\t\tif (!depth)\n\t\t\tbreak;\n\t\t/*\n\t\t * Stop the search if we cross into another context:\n\t\t */\n\t\tif (curr->held_locks[depth].irq_context !=\n\t\t\t\tcurr->held_locks[depth-1].irq_context)\n\t\t\tbreak;\n\t}\n\treturn 1;\nout_bug:\n\tif (!debug_locks_off_graph_unlock())\n\t\treturn 0;\n\n\tWARN_ON(1);\n\n\treturn 0;\n}\n\n\n/*\n * Is this the address of a static object:\n */\nstatic int static_obj(void *obj)\n{\n\tunsigned long start = (unsigned long) &_stext,\n\t\t end = (unsigned long) &_end,\n\t\t addr = (unsigned long) obj;\n#ifdef CONFIG_SMP\n\tint i;\n#endif\n\n\t/*\n\t * static variable?\n\t */\n\tif ((addr >= start) && (addr < end))\n\t\treturn 1;\n\n#ifdef CONFIG_SMP\n\t/*\n\t * percpu var?\n\t */\n\tfor_each_possible_cpu(i) {\n\t\tstart = (unsigned long) &__per_cpu_start + per_cpu_offset(i);\n\t\tend = (unsigned long) &__per_cpu_start + PERCPU_ENOUGH_ROOM\n\t\t\t\t\t+ per_cpu_offset(i);\n\n\t\tif ((addr >= start) && (addr < end))\n\t\t\treturn 1;\n\t}\n#endif\n\n\t/*\n\t * module var?\n\t */\n\treturn is_module_address(addr);\n}\n\n/*\n * To make lock name printouts unique, we calculate a unique\n * class->name_version generation counter:\n */\nstatic int count_matching_names(struct lock_class *new_class)\n{\n\tstruct lock_class *class;\n\tint count = 0;\n\n\tif (!new_class->name)\n\t\treturn 0;\n\n\tlist_for_each_entry(class, &all_lock_classes, lock_entry) {\n\t\tif (new_class->key - new_class->subclass == class->key)\n\t\t\treturn class->name_version;\n\t\tif (class->name && !strcmp(class->name, new_class->name))\n\t\t\tcount = max(count, class->name_version);\n\t}\n\n\treturn count + 1;\n}\n\n/*\n * Register a lock's class in the hash-table, if the class is not present\n * yet. Otherwise we look it up. We cache the result in the lock object\n * itself, so actual lookup of the hash should be once per lock object.\n */\nstatic inline struct lock_class *\nlook_up_lock_class(struct lockdep_map *lock, unsigned int subclass)\n{\n\tstruct lockdep_subclass_key *key;\n\tstruct list_head *hash_head;\n\tstruct lock_class *class;\n\n#ifdef CONFIG_DEBUG_LOCKDEP\n\t/*\n\t * If the architecture calls into lockdep before initializing\n\t * the hashes then we'll warn about it later. (we cannot printk\n\t * right now)\n\t */\n\tif (unlikely(!lockdep_initialized)) {\n\t\tlockdep_init();\n\t\tlockdep_init_error = 1;\n\t}\n#endif\n\n\t/*\n\t * Static locks do not have their class-keys yet - for them the key\n\t * is the lock object itself:\n\t */\n\tif (unlikely(!lock->key))\n\t\tlock->key = (void *)lock;\n\n\t/*\n\t * NOTE: the class-key must be unique. For dynamic locks, a static\n\t * lock_class_key variable is passed in through the mutex_init()\n\t * (or spin_lock_init()) call - which acts as the key. For static\n\t * locks we use the lock object itself as the key.\n\t */\n\tBUILD_BUG_ON(sizeof(struct lock_class_key) > sizeof(struct lock_class));\n\n\tkey = lock->key->subkeys + subclass;\n\n\thash_head = classhashentry(key);\n\n\t/*\n\t * We can walk the hash lockfree, because the hash only\n\t * grows, and we are careful when adding entries to the end:\n\t */\n\tlist_for_each_entry(class, hash_head, hash_entry)\n\t\tif (class->key == key)\n\t\t\treturn class;\n\n\treturn NULL;\n}\n\n/*\n * Register a lock's class in the hash-table, if the class is not present\n * yet. Otherwise we look it up. We cache the result in the lock object\n * itself, so actual lookup of the hash should be once per lock object.\n */\nstatic inline struct lock_class *\nregister_lock_class(struct lockdep_map *lock, unsigned int subclass, int force)\n{\n\tstruct lockdep_subclass_key *key;\n\tstruct list_head *hash_head;\n\tstruct lock_class *class;\n\tunsigned long flags;\n\n\tclass = look_up_lock_class(lock, subclass);\n\tif (likely(class))\n\t\treturn class;\n\n\t/*\n\t * Debug-check: all keys must be persistent!\n \t */\n\tif (!static_obj(lock->key)) {\n\t\tdebug_locks_off();\n\t\tprintk(\"INFO: trying to register non-static key.\\n\");\n\t\tprintk(\"the code is fine but needs lockdep annotation.\\n\");\n\t\tprintk(\"turning off the locking correctness validator.\\n\");\n\t\tdump_stack();\n\n\t\treturn NULL;\n\t}\n\n\tkey = lock->key->subkeys + subclass;\n\thash_head = classhashentry(key);\n\n\traw_local_irq_save(flags);\n\tif (!graph_lock()) {\n\t\traw_local_irq_restore(flags);\n\t\treturn NULL;\n\t}\n\t/*\n\t * We have to do the hash-walk again, to avoid races\n\t * with another CPU:\n\t */\n\tlist_for_each_entry(class, hash_head, hash_entry)\n\t\tif (class->key == key)\n\t\t\tgoto out_unlock_set;\n\t/*\n\t * Allocate a new key from the static array, and add it to\n\t * the hash:\n\t */\n\tif (nr_lock_classes >= MAX_LOCKDEP_KEYS) {\n\t\tif (!debug_locks_off_graph_unlock()) {\n\t\t\traw_local_irq_restore(flags);\n\t\t\treturn NULL;\n\t\t}\n\t\traw_local_irq_restore(flags);\n\n\t\tprintk(\"BUG: MAX_LOCKDEP_KEYS too low!\\n\");\n\t\tprintk(\"turning off the locking correctness validator.\\n\");\n\t\treturn NULL;\n\t}\n\tclass = lock_classes + nr_lock_classes++;\n\tdebug_atomic_inc(&nr_unused_locks);\n\tclass->key = key;\n\tclass->name = lock->name;\n\tclass->subclass = subclass;\n\tINIT_LIST_HEAD(&class->lock_entry);\n\tINIT_LIST_HEAD(&class->locks_before);\n\tINIT_LIST_HEAD(&class->locks_after);\n\tclass->name_version = count_matching_names(class);\n\t/*\n\t * We use RCU's safe list-add method to make\n\t * parallel walking of the hash-list safe:\n\t */\n\tlist_add_tail_rcu(&class->hash_entry, hash_head);\n\n\tif (verbose(class)) {\n\t\tgraph_unlock();\n\t\traw_local_irq_restore(flags);\n\n\t\tprintk(\"\\nnew class %p: %s\", class->key, class->name);\n\t\tif (class->name_version > 1)\n\t\t\tprintk(\"#%d\", class->name_version);\n\t\tprintk(\"\\n\");\n\t\tdump_stack();\n\n\t\traw_local_irq_save(flags);\n\t\tif (!graph_lock()) {\n\t\t\traw_local_irq_restore(flags);\n\t\t\treturn NULL;\n\t\t}\n\t}\nout_unlock_set:\n\tgraph_unlock();\n\traw_local_irq_restore(flags);\n\n\tif (!subclass || force)\n\t\tlock->class_cache = class;\n\n\tif (DEBUG_LOCKS_WARN_ON(class->subclass != subclass))\n\t\treturn NULL;\n\n\treturn class;\n}\n\n/*\n * Look up a dependency chain. If the key is not present yet then\n * add it and return 1 - in this case the new dependency chain is\n * validated. If the key is already hashed, return 0.\n * (On return with 1 graph_lock is held.)\n */\nstatic inline int lookup_chain_cache(u64 chain_key, struct lock_class *class)\n{\n\tstruct list_head *hash_head = chainhashentry(chain_key);\n\tstruct lock_chain *chain;\n\n\tif (DEBUG_LOCKS_WARN_ON(!irqs_disabled()))\n\t\treturn 0;\n\t/*\n\t * We can walk it lock-free, because entries only get added\n\t * to the hash:\n\t */\n\tlist_for_each_entry(chain, hash_head, entry) {\n\t\tif (chain->chain_key == chain_key) {\ncache_hit:\n\t\t\tdebug_atomic_inc(&chain_lookup_hits);\n\t\t\tif (very_verbose(class))\n\t\t\t\tprintk(\"\\nhash chain already cached, key: \"\n\t\t\t\t\t\"%016Lx tail class: [%p] %s\\n\",\n\t\t\t\t\t(unsigned long long)chain_key,\n\t\t\t\t\tclass->key, class->name);\n\t\t\treturn 0;\n\t\t}\n\t}\n\tif (very_verbose(class))\n\t\tprintk(\"\\nnew hash chain, key: %016Lx tail class: [%p] %s\\n\",\n\t\t\t(unsigned long long)chain_key, class->key, class->name);\n\t/*\n\t * Allocate a new chain entry from the static array, and add\n\t * it to the hash:\n\t */\n\tif (!graph_lock())\n\t\treturn 0;\n\t/*\n\t * We have to walk the chain again locked - to avoid duplicates:\n\t */\n\tlist_for_each_entry(chain, hash_head, entry) {\n\t\tif (chain->chain_key == chain_key) {\n\t\t\tgraph_unlock();\n\t\t\tgoto cache_hit;\n\t\t}\n\t}\n\tif (unlikely(nr_lock_chains >= MAX_LOCKDEP_CHAINS)) {\n\t\tif (!debug_locks_off_graph_unlock())\n\t\t\treturn 0;\n\n\t\tprintk(\"BUG: MAX_LOCKDEP_CHAINS too low!\\n\");\n\t\tprintk(\"turning off the locking correctness validator.\\n\");\n\t\treturn 0;\n\t}\n\tchain = lock_chains + nr_lock_chains++;\n\tchain->chain_key = chain_key;\n\tlist_add_tail_rcu(&chain->entry, hash_head);\n\tdebug_atomic_inc(&chain_lookup_misses);\n#ifdef CONFIG_TRACE_IRQFLAGS\n\tif (current->hardirq_context)\n\t\tnr_hardirq_chains++;\n\telse {\n\t\tif (current->softirq_context)\n\t\t\tnr_softirq_chains++;\n\t\telse\n\t\t\tnr_process_chains++;\n\t}\n#else\n\tnr_process_chains++;\n#endif\n\n\treturn 1;\n}\n\n/*\n * We are building curr_chain_key incrementally, so double-check\n * it from scratch, to make sure that it's done correctly:\n */\nstatic void check_chain_key(struct task_struct *curr)\n{\n#ifdef CONFIG_DEBUG_LOCKDEP\n\tstruct held_lock *hlock, *prev_hlock = NULL;\n\tunsigned int i, id;\n\tu64 chain_key = 0;\n\n\tfor (i = 0; i < curr->lockdep_depth; i++) {\n\t\thlock = curr->held_locks + i;\n\t\tif (chain_key != hlock->prev_chain_key) {\n\t\t\tdebug_locks_off();\n\t\t\tprintk(\"hm#1, depth: %u [%u], %016Lx != %016Lx\\n\",\n\t\t\t\tcurr->lockdep_depth, i,\n\t\t\t\t(unsigned long long)chain_key,\n\t\t\t\t(unsigned long long)hlock->prev_chain_key);\n\t\t\tWARN_ON(1);\n\t\t\treturn;\n\t\t}\n\t\tid = hlock->class - lock_classes;\n\t\tif (DEBUG_LOCKS_WARN_ON(id >= MAX_LOCKDEP_KEYS))\n\t\t\treturn;\n\n\t\tif (prev_hlock && (prev_hlock->irq_context !=\n\t\t\t\t\t\t\thlock->irq_context))\n\t\t\tchain_key = 0;\n\t\tchain_key = iterate_chain_key(chain_key, id);\n\t\tprev_hlock = hlock;\n\t}\n\tif (chain_key != curr->curr_chain_key) {\n\t\tdebug_locks_off();\n\t\tprintk(\"hm#2, depth: %u [%u], %016Lx != %016Lx\\n\",\n\t\t\tcurr->lockdep_depth, i,\n\t\t\t(unsigned long long)chain_key,\n\t\t\t(unsigned long long)curr->curr_chain_key);\n\t\tWARN_ON(1);\n\t}\n#endif\n}\n\n#ifdef CONFIG_TRACE_IRQFLAGS\n\n/*\n * print irq inversion bug:\n */\nstatic int\nprint_irq_inversion_bug(struct task_struct *curr, struct lock_class *other,\n\t\t\tstruct held_lock *this, int forwards,\n\t\t\tconst char *irqclass)\n{\n\tif (!debug_locks_off_graph_unlock() || debug_locks_silent)\n\t\treturn 0;\n\n\tprintk(\"\\n=========================================================\\n\");\n\tprintk( \"[ INFO: possible irq lock inversion dependency detected ]\\n\");\n\tprint_kernel_version();\n\tprintk( \"---------------------------------------------------------\\n\");\n\tprintk(\"%s/%d just changed the state of lock:\\n\",\n\t\tcurr->comm, curr->pid);\n\tprint_lock(this);\n\tif (forwards)\n\t\tprintk(\"but this lock took another, %s-irq-unsafe lock in the past:\\n\", irqclass);\n\telse\n\t\tprintk(\"but this lock was taken by another, %s-irq-safe lock in the past:\\n\", irqclass);\n\tprint_lock_name(other);\n\tprintk(\"\\n\\nand interrupts could create inverse lock ordering between them.\\n\\n\");\n\n\tprintk(\"\\nother info that might help us debug this:\\n\");\n\tlockdep_print_held_locks(curr);\n\n\tprintk(\"\\nthe first lock's dependencies:\\n\");\n\tprint_lock_dependencies(this->class, 0);\n\n\tprintk(\"\\nthe second lock's dependencies:\\n\");\n\tprint_lock_dependencies(other, 0);\n\n\tprintk(\"\\nstack backtrace:\\n\");\n\tdump_stack();\n\n\treturn 0;\n}\n\n/*\n * Prove that in the forwards-direction subgraph starting at <this>\n * there is no lock matching <mask>:\n */\nstatic int\ncheck_usage_forwards(struct task_struct *curr, struct held_lock *this,\n\t\t enum lock_usage_bit bit, const char *irqclass)\n{\n\tint ret;\n\n\tfind_usage_bit = bit;\n\t/* fills in <forwards_match> */\n\tret = find_usage_forwards(this->class, 0);\n\tif (!ret || ret == 1)\n\t\treturn ret;\n\n\treturn print_irq_inversion_bug(curr, forwards_match, this, 1, irqclass);\n}\n\n/*\n * Prove that in the backwards-direction subgraph starting at <this>\n * there is no lock matching <mask>:\n */\nstatic int\ncheck_usage_backwards(struct task_struct *curr, struct held_lock *this,\n\t\t enum lock_usage_bit bit, const char *irqclass)\n{\n\tint ret;\n\n\tfind_usage_bit = bit;\n\t/* fills in <backwards_match> */\n\tret = find_usage_backwards(this->class, 0);\n\tif (!ret || ret == 1)\n\t\treturn ret;\n\n\treturn print_irq_inversion_bug(curr, backwards_match, this, 0, irqclass);\n}\n\nvoid print_irqtrace_events(struct task_struct *curr)\n{\n\tprintk(\"irq event stamp: %u\\n\", curr->irq_events);\n\tprintk(\"hardirqs last enabled at (%u): \", curr->hardirq_enable_event);\n\tprint_ip_sym(curr->hardirq_enable_ip);\n\tprintk(\"hardirqs last disabled at (%u): \", curr->hardirq_disable_event);\n\tprint_ip_sym(curr->hardirq_disable_ip);\n\tprintk(\"softirqs last enabled at (%u): \", curr->softirq_enable_event);\n\tprint_ip_sym(curr->softirq_enable_ip);\n\tprintk(\"softirqs last disabled at (%u): \", curr->softirq_disable_event);\n\tprint_ip_sym(curr->softirq_disable_ip);\n}\n\n#endif\n\nstatic int\nprint_usage_bug(struct task_struct *curr, struct held_lock *this,\n\t\tenum lock_usage_bit prev_bit, enum lock_usage_bit new_bit)\n{\n\tif (!debug_locks_off_graph_unlock() || debug_locks_silent)\n\t\treturn 0;\n\n\tprintk(\"\\n=================================\\n\");\n\tprintk( \"[ INFO: inconsistent lock state ]\\n\");\n\tprint_kernel_version();\n\tprintk( \"---------------------------------\\n\");\n\n\tprintk(\"inconsistent {%s} -> {%s} usage.\\n\",\n\t\tusage_str[prev_bit], usage_str[new_bit]);\n\n\tprintk(\"%s/%d [HC%u[%lu]:SC%u[%lu]:HE%u:SE%u] takes:\\n\",\n\t\tcurr->comm, curr->pid,\n\t\ttrace_hardirq_context(curr), hardirq_count() >> HARDIRQ_SHIFT,\n\t\ttrace_softirq_context(curr), softirq_count() >> SOFTIRQ_SHIFT,\n\t\ttrace_hardirqs_enabled(curr),\n\t\ttrace_softirqs_enabled(curr));\n\tprint_lock(this);\n\n\tprintk(\"{%s} state was registered at:\\n\", usage_str[prev_bit]);\n\tprint_stack_trace(this->class->usage_traces + prev_bit, 1);\n\n\tprint_irqtrace_events(curr);\n\tprintk(\"\\nother info that might help us debug this:\\n\");\n\tlockdep_print_held_locks(curr);\n\n\tprintk(\"\\nstack backtrace:\\n\");\n\tdump_stack();\n\n\treturn 0;\n}\n\n/*\n * Print out an error if an invalid bit is set:\n */\nstatic inline int\nvalid_state(struct task_struct *curr, struct held_lock *this,\n\t enum lock_usage_bit new_bit, enum lock_usage_bit bad_bit)\n{\n\tif (unlikely(this->class->usage_mask & (1 << bad_bit)))\n\t\treturn print_usage_bug(curr, this, bad_bit, new_bit);\n\treturn 1;\n}\n\n#define STRICT_READ_CHECKS\t1\n\n/*\n * Mark a lock with a usage bit, and validate the state transition:\n */\nstatic int mark_lock(struct task_struct *curr, struct held_lock *this,\n\t\t enum lock_usage_bit new_bit)\n{\n\tunsigned int new_mask = 1 << new_bit, ret = 1;\n\n\t/*\n\t * If already set then do not dirty the cacheline,\n\t * nor do any checks:\n\t */\n\tif (likely(this->class->usage_mask & new_mask))\n\t\treturn 1;\n\n\tif (!graph_lock())\n\t\treturn 0;\n\t/*\n\t * Make sure we didnt race:\n\t */\n\tif (unlikely(this->class->usage_mask & new_mask)) {\n\t\tgraph_unlock();\n\t\treturn 1;\n\t}\n\n\tthis->class->usage_mask |= new_mask;\n\n\tif (!save_trace(this->class->usage_traces + new_bit))\n\t\treturn 0;\n\n\tswitch (new_bit) {\n#ifdef CONFIG_TRACE_IRQFLAGS\n\tcase LOCK_USED_IN_HARDIRQ:\n\t\tif (!valid_state(curr, this, new_bit, LOCK_ENABLED_HARDIRQS))\n\t\t\treturn 0;\n\t\tif (!valid_state(curr, this, new_bit,\n\t\t\t\t LOCK_ENABLED_HARDIRQS_READ))\n\t\t\treturn 0;\n\t\t/*\n\t\t * just marked it hardirq-safe, check that this lock\n\t\t * took no hardirq-unsafe lock in the past:\n\t\t */\n\t\tif (!check_usage_forwards(curr, this,\n\t\t\t\t\t LOCK_ENABLED_HARDIRQS, \"hard\"))\n\t\t\treturn 0;\n#if STRICT_READ_CHECKS\n\t\t/*\n\t\t * just marked it hardirq-safe, check that this lock\n\t\t * took no hardirq-unsafe-read lock in the past:\n\t\t */\n\t\tif (!check_usage_forwards(curr, this,\n\t\t\t\tLOCK_ENABLED_HARDIRQS_READ, \"hard-read\"))\n\t\t\treturn 0;\n#endif\n\t\tif (hardirq_verbose(this->class))\n\t\t\tret = 2;\n\t\tbreak;\n\tcase LOCK_USED_IN_SOFTIRQ:\n\t\tif (!valid_state(curr, this, new_bit, LOCK_ENABLED_SOFTIRQS))\n\t\t\treturn 0;\n\t\tif (!valid_state(curr, this, new_bit,\n\t\t\t\t LOCK_ENABLED_SOFTIRQS_READ))\n\t\t\treturn 0;\n\t\t/*\n\t\t * just marked it softirq-safe, check that this lock\n\t\t * took no softirq-unsafe lock in the past:\n\t\t */\n\t\tif (!check_usage_forwards(curr, this,\n\t\t\t\t\t LOCK_ENABLED_SOFTIRQS, \"soft\"))\n\t\t\treturn 0;\n#if STRICT_READ_CHECKS\n\t\t/*\n\t\t * just marked it softirq-safe, check that this lock\n\t\t * took no softirq-unsafe-read lock in the past:\n\t\t */\n\t\tif (!check_usage_forwards(curr, this,\n\t\t\t\tLOCK_ENABLED_SOFTIRQS_READ, \"soft-read\"))\n\t\t\treturn 0;\n#endif\n\t\tif (softirq_verbose(this->class))\n\t\t\tret = 2;\n\t\tbreak;\n\tcase LOCK_USED_IN_HARDIRQ_READ:\n\t\tif (!valid_state(curr, this, new_bit, LOCK_ENABLED_HARDIRQS))\n\t\t\treturn 0;\n\t\t/*\n\t\t * just marked it hardirq-read-safe, check that this lock\n\t\t * took no hardirq-unsafe lock in the past:\n\t\t */\n\t\tif (!check_usage_forwards(curr, this,\n\t\t\t\t\t LOCK_ENABLED_HARDIRQS, \"hard\"))\n\t\t\treturn 0;\n\t\tif (hardirq_verbose(this->class))\n\t\t\tret = 2;\n\t\tbreak;\n\tcase LOCK_USED_IN_SOFTIRQ_READ:\n\t\tif (!valid_state(curr, this, new_bit, LOCK_ENABLED_SOFTIRQS))\n\t\t\treturn 0;\n\t\t/*\n\t\t * just marked it softirq-read-safe, check that this lock\n\t\t * took no softirq-unsafe lock in the past:\n\t\t */\n\t\tif (!check_usage_forwards(curr, this,\n\t\t\t\t\t LOCK_ENABLED_SOFTIRQS, \"soft\"))\n\t\t\treturn 0;\n\t\tif (softirq_verbose(this->class))\n\t\t\tret = 2;\n\t\tbreak;\n\tcase LOCK_ENABLED_HARDIRQS:\n\t\tif (!valid_state(curr, this, new_bit, LOCK_USED_IN_HARDIRQ))\n\t\t\treturn 0;\n\t\tif (!valid_state(curr, this, new_bit,\n\t\t\t\t LOCK_USED_IN_HARDIRQ_READ))\n\t\t\treturn 0;\n\t\t/*\n\t\t * just marked it hardirq-unsafe, check that no hardirq-safe\n\t\t * lock in the system ever took it in the past:\n\t\t */\n\t\tif (!check_usage_backwards(curr, this,\n\t\t\t\t\t LOCK_USED_IN_HARDIRQ, \"hard\"))\n\t\t\treturn 0;\n#if STRICT_READ_CHECKS\n\t\t/*\n\t\t * just marked it hardirq-unsafe, check that no\n\t\t * hardirq-safe-read lock in the system ever took\n\t\t * it in the past:\n\t\t */\n\t\tif (!check_usage_backwards(curr, this,\n\t\t\t\t LOCK_USED_IN_HARDIRQ_READ, \"hard-read\"))\n\t\t\treturn 0;\n#endif\n\t\tif (hardirq_verbose(this->class))\n\t\t\tret = 2;\n\t\tbreak;\n\tcase LOCK_ENABLED_SOFTIRQS:\n\t\tif (!valid_state(curr, this, new_bit, LOCK_USED_IN_SOFTIRQ))\n\t\t\treturn 0;\n\t\tif (!valid_state(curr, this, new_bit,\n\t\t\t\t LOCK_USED_IN_SOFTIRQ_READ))\n\t\t\treturn 0;\n\t\t/*\n\t\t * just marked it softirq-unsafe, check that no softirq-safe\n\t\t * lock in the system ever took it in the past:\n\t\t */\n\t\tif (!check_usage_backwards(curr, this,\n\t\t\t\t\t LOCK_USED_IN_SOFTIRQ, \"soft\"))\n\t\t\treturn 0;\n#if STRICT_READ_CHECKS\n\t\t/*\n\t\t * just marked it softirq-unsafe, check that no\n\t\t * softirq-safe-read lock in the system ever took\n\t\t * it in the past:\n\t\t */\n\t\tif (!check_usage_backwards(curr, this,\n\t\t\t\t LOCK_USED_IN_SOFTIRQ_READ, \"soft-read\"))\n\t\t\treturn 0;\n#endif\n\t\tif (softirq_verbose(this->class))\n\t\t\tret = 2;\n\t\tbreak;\n\tcase LOCK_ENABLED_HARDIRQS_READ:\n\t\tif (!valid_state(curr, this, new_bit, LOCK_USED_IN_HARDIRQ))\n\t\t\treturn 0;\n#if STRICT_READ_CHECKS\n\t\t/*\n\t\t * just marked it hardirq-read-unsafe, check that no\n\t\t * hardirq-safe lock in the system ever took it in the past:\n\t\t */\n\t\tif (!check_usage_backwards(curr, this,\n\t\t\t\t\t LOCK_USED_IN_HARDIRQ, \"hard\"))\n\t\t\treturn 0;\n#endif\n\t\tif (hardirq_verbose(this->class))\n\t\t\tret = 2;\n\t\tbreak;\n\tcase LOCK_ENABLED_SOFTIRQS_READ:\n\t\tif (!valid_state(curr, this, new_bit, LOCK_USED_IN_SOFTIRQ))\n\t\t\treturn 0;\n#if STRICT_READ_CHECKS\n\t\t/*\n\t\t * just marked it softirq-read-unsafe, check that no\n\t\t * softirq-safe lock in the system ever took it in the past:\n\t\t */\n\t\tif (!check_usage_backwards(curr, this,\n\t\t\t\t\t LOCK_USED_IN_SOFTIRQ, \"soft\"))\n\t\t\treturn 0;\n#endif\n\t\tif (softirq_verbose(this->class))\n\t\t\tret = 2;\n\t\tbreak;\n#endif\n\tcase LOCK_USED:\n\t\t/*\n\t\t * Add it to the global list of classes:\n\t\t */\n\t\tlist_add_tail_rcu(&this->class->lock_entry, &all_lock_classes);\n\t\tdebug_atomic_dec(&nr_unused_locks);\n\t\tbreak;\n\tdefault:\n\t\tif (!debug_locks_off_graph_unlock())\n\t\t\treturn 0;\n\t\tWARN_ON(1);\n\t\treturn 0;\n\t}\n\n\tgraph_unlock();\n\n\t/*\n\t * We must printk outside of the graph_lock:\n\t */\n\tif (ret == 2) {\n\t\tprintk(\"\\nmarked lock as {%s}:\\n\", usage_str[new_bit]);\n\t\tprint_lock(this);\n\t\tprint_irqtrace_events(curr);\n\t\tdump_stack();\n\t}\n\n\treturn ret;\n}\n\n#ifdef CONFIG_TRACE_IRQFLAGS\n/*\n * Mark all held locks with a usage bit:\n */\nstatic int\nmark_held_locks(struct task_struct *curr, int hardirq)\n{\n\tenum lock_usage_bit usage_bit;\n\tstruct held_lock *hlock;\n\tint i;\n\n\tfor (i = 0; i < curr->lockdep_depth; i++) {\n\t\thlock = curr->held_locks + i;\n\n\t\tif (hardirq) {\n\t\t\tif (hlock->read)\n\t\t\t\tusage_bit = LOCK_ENABLED_HARDIRQS_READ;\n\t\t\telse\n\t\t\t\tusage_bit = LOCK_ENABLED_HARDIRQS;\n\t\t} else {\n\t\t\tif (hlock->read)\n\t\t\t\tusage_bit = LOCK_ENABLED_SOFTIRQS_READ;\n\t\t\telse\n\t\t\t\tusage_bit = LOCK_ENABLED_SOFTIRQS;\n\t\t}\n\t\tif (!mark_lock(curr, hlock, usage_bit))\n\t\t\treturn 0;\n\t}\n\n\treturn 1;\n}\n\n/*\n * Debugging helper: via this flag we know that we are in\n * 'early bootup code', and will warn about any invalid irqs-on event:\n */\nstatic int early_boot_irqs_enabled;\n\nvoid early_boot_irqs_off(void)\n{\n\tearly_boot_irqs_enabled = 0;\n}\n\nvoid early_boot_irqs_on(void)\n{\n\tearly_boot_irqs_enabled = 1;\n}\n\n/*\n * Hardirqs will be enabled:\n */\nvoid trace_hardirqs_on(void)\n{\n\tstruct task_struct *curr = current;\n\tunsigned long ip;\n\n\tif (unlikely(!debug_locks || current->lockdep_recursion))\n\t\treturn;\n\n\tif (DEBUG_LOCKS_WARN_ON(unlikely(!early_boot_irqs_enabled)))\n\t\treturn;\n\n\tif (unlikely(curr->hardirqs_enabled)) {\n\t\tdebug_atomic_inc(&redundant_hardirqs_on);\n\t\treturn;\n\t}\n\t/* we'll do an OFF -> ON transition: */\n\tcurr->hardirqs_enabled = 1;\n\tip = (unsigned long) __builtin_return_address(0);\n\n\tif (DEBUG_LOCKS_WARN_ON(!irqs_disabled()))\n\t\treturn;\n\tif (DEBUG_LOCKS_WARN_ON(current->hardirq_context))\n\t\treturn;\n\t/*\n\t * We are going to turn hardirqs on, so set the\n\t * usage bit for all held locks:\n\t */\n\tif (!mark_held_locks(curr, 1))\n\t\treturn;\n\t/*\n\t * If we have softirqs enabled, then set the usage\n\t * bit for all held locks. (disabled hardirqs prevented\n\t * this bit from being set before)\n\t */\n\tif (curr->softirqs_enabled)\n\t\tif (!mark_held_locks(curr, 0))\n\t\t\treturn;\n\n\tcurr->hardirq_enable_ip = ip;\n\tcurr->hardirq_enable_event = ++curr->irq_events;\n\tdebug_atomic_inc(&hardirqs_on_events);\n}\n\nEXPORT_SYMBOL(trace_hardirqs_on);\n\n/*\n * Hardirqs were disabled:\n */\nvoid trace_hardirqs_off(void)\n{\n\tstruct task_struct *curr = current;\n\n\tif (unlikely(!debug_locks || current->lockdep_recursion))\n\t\treturn;\n\n\tif (DEBUG_LOCKS_WARN_ON(!irqs_disabled()))\n\t\treturn;\n\n\tif (curr->hardirqs_enabled) {\n\t\t/*\n\t\t * We have done an ON -> OFF transition:\n\t\t */\n\t\tcurr->hardirqs_enabled = 0;\n\t\tcurr->hardirq_disable_ip = _RET_IP_;\n\t\tcurr->hardirq_disable_event = ++curr->irq_events;\n\t\tdebug_atomic_inc(&hardirqs_off_events);\n\t} else\n\t\tdebug_atomic_inc(&redundant_hardirqs_off);\n}\n\nEXPORT_SYMBOL(trace_hardirqs_off);\n\n/*\n * Softirqs will be enabled:\n */\nvoid trace_softirqs_on(unsigned long ip)\n{\n\tstruct task_struct *curr = current;\n\n\tif (unlikely(!debug_locks))\n\t\treturn;\n\n\tif (DEBUG_LOCKS_WARN_ON(!irqs_disabled()))\n\t\treturn;\n\n\tif (curr->softirqs_enabled) {\n\t\tdebug_atomic_inc(&redundant_softirqs_on);\n\t\treturn;\n\t}\n\n\t/*\n\t * We'll do an OFF -> ON transition:\n\t */\n\tcurr->softirqs_enabled = 1;\n\tcurr->softirq_enable_ip = ip;\n\tcurr->softirq_enable_event = ++curr->irq_events;\n\tdebug_atomic_inc(&softirqs_on_events);\n\t/*\n\t * We are going to turn softirqs on, so set the\n\t * usage bit for all held locks, if hardirqs are\n\t * enabled too:\n\t */\n\tif (curr->hardirqs_enabled)\n\t\tmark_held_locks(curr, 0);\n}\n\n/*\n * Softirqs were disabled:\n */\nvoid trace_softirqs_off(unsigned long ip)\n{\n\tstruct task_struct *curr = current;\n\n\tif (unlikely(!debug_locks))\n\t\treturn;\n\n\tif (DEBUG_LOCKS_WARN_ON(!irqs_disabled()))\n\t\treturn;\n\n\tif (curr->softirqs_enabled) {\n\t\t/*\n\t\t * We have done an ON -> OFF transition:\n\t\t */\n\t\tcurr->softirqs_enabled = 0;\n\t\tcurr->softirq_disable_ip = ip;\n\t\tcurr->softirq_disable_event = ++curr->irq_events;\n\t\tdebug_atomic_inc(&softirqs_off_events);\n\t\tDEBUG_LOCKS_WARN_ON(!softirq_count());\n\t} else\n\t\tdebug_atomic_inc(&redundant_softirqs_off);\n}\n\n#endif\n\n/*\n * Initialize a lock instance's lock-class mapping info:\n */\nvoid lockdep_init_map(struct lockdep_map *lock, const char *name,\n\t\t struct lock_class_key *key, int subclass)\n{\n\tif (unlikely(!debug_locks))\n\t\treturn;\n\n\tif (DEBUG_LOCKS_WARN_ON(!key))\n\t\treturn;\n\tif (DEBUG_LOCKS_WARN_ON(!name))\n\t\treturn;\n\t/*\n\t * Sanity check, the lock-class key must be persistent:\n\t */\n\tif (!static_obj(key)) {\n\t\tprintk(\"BUG: key %p not in .data!\\n\", key);\n\t\tDEBUG_LOCKS_WARN_ON(1);\n\t\treturn;\n\t}\n\tlock->name = name;\n\tlock->key = key;\n\tlock->class_cache = NULL;\n\tif (subclass)\n\t\tregister_lock_class(lock, subclass, 1);\n}\n\nEXPORT_SYMBOL_GPL(lockdep_init_map);\n\n/*\n * This gets called for every mutex_lock*()/spin_lock*() operation.\n * We maintain the dependency maps and validate the locking attempt:\n */\nstatic int __lock_acquire(struct lockdep_map *lock, unsigned int subclass,\n\t\t\t int trylock, int read, int check, int hardirqs_off,\n\t\t\t unsigned long ip)\n{\n\tstruct task_struct *curr = current;\n\tstruct lock_class *class = NULL;\n\tstruct held_lock *hlock;\n\tunsigned int depth, id;\n\tint chain_head = 0;\n\tu64 chain_key;\n\n\tif (unlikely(!debug_locks))\n\t\treturn 0;\n\n\tif (DEBUG_LOCKS_WARN_ON(!irqs_disabled()))\n\t\treturn 0;\n\n\tif (unlikely(subclass >= MAX_LOCKDEP_SUBCLASSES)) {\n\t\tdebug_locks_off();\n\t\tprintk(\"BUG: MAX_LOCKDEP_SUBCLASSES too low!\\n\");\n\t\tprintk(\"turning off the locking correctness validator.\\n\");\n\t\treturn 0;\n\t}\n\n\tif (!subclass)\n\t\tclass = lock->class_cache;\n\t/*\n\t * Not cached yet or subclass?\n\t */\n\tif (unlikely(!class)) {\n\t\tclass = register_lock_class(lock, subclass, 0);\n\t\tif (!class)\n\t\t\treturn 0;\n\t}\n\tdebug_atomic_inc((atomic_t *)&class->ops);\n\tif (very_verbose(class)) {\n\t\tprintk(\"\\nacquire class [%p] %s\", class->key, class->name);\n\t\tif (class->name_version > 1)\n\t\t\tprintk(\"#%d\", class->name_version);\n\t\tprintk(\"\\n\");\n\t\tdump_stack();\n\t}\n\n\t/*\n\t * Add the lock to the list of currently held locks.\n\t * (we dont increase the depth just yet, up until the\n\t * dependency checks are done)\n\t */\n\tdepth = curr->lockdep_depth;\n\tif (DEBUG_LOCKS_WARN_ON(depth >= MAX_LOCK_DEPTH))\n\t\treturn 0;\n\n\thlock = curr->held_locks + depth;\n\n\thlock->class = class;\n\thlock->acquire_ip = ip;\n\thlock->instance = lock;\n\thlock->trylock = trylock;\n\thlock->read = read;\n\thlock->check = check;\n\thlock->hardirqs_off = hardirqs_off;\n\n\tif (check != 2)\n\t\tgoto out_calc_hash;\n#ifdef CONFIG_TRACE_IRQFLAGS\n\t/*\n\t * If non-trylock use in a hardirq or softirq context, then\n\t * mark the lock as used in these contexts:\n\t */\n\tif (!trylock) {\n\t\tif (read) {\n\t\t\tif (curr->hardirq_context)\n\t\t\t\tif (!mark_lock(curr, hlock,\n\t\t\t\t\t\tLOCK_USED_IN_HARDIRQ_READ))\n\t\t\t\t\treturn 0;\n\t\t\tif (curr->softirq_context)\n\t\t\t\tif (!mark_lock(curr, hlock,\n\t\t\t\t\t\tLOCK_USED_IN_SOFTIRQ_READ))\n\t\t\t\t\treturn 0;\n\t\t} else {\n\t\t\tif (curr->hardirq_context)\n\t\t\t\tif (!mark_lock(curr, hlock, LOCK_USED_IN_HARDIRQ))\n\t\t\t\t\treturn 0;\n\t\t\tif (curr->softirq_context)\n\t\t\t\tif (!mark_lock(curr, hlock, LOCK_USED_IN_SOFTIRQ))\n\t\t\t\t\treturn 0;\n\t\t}\n\t}\n\tif (!hardirqs_off) {\n\t\tif (read) {\n\t\t\tif (!mark_lock(curr, hlock,\n\t\t\t\t\tLOCK_ENABLED_HARDIRQS_READ))\n\t\t\t\treturn 0;\n\t\t\tif (curr->softirqs_enabled)\n\t\t\t\tif (!mark_lock(curr, hlock,\n\t\t\t\t\t\tLOCK_ENABLED_SOFTIRQS_READ))\n\t\t\t\t\treturn 0;\n\t\t} else {\n\t\t\tif (!mark_lock(curr, hlock,\n\t\t\t\t\tLOCK_ENABLED_HARDIRQS))\n\t\t\t\treturn 0;\n\t\t\tif (curr->softirqs_enabled)\n\t\t\t\tif (!mark_lock(curr, hlock,\n\t\t\t\t\t\tLOCK_ENABLED_SOFTIRQS))\n\t\t\t\t\treturn 0;\n\t\t}\n\t}\n#endif\n\t/* mark it as used: */\n\tif (!mark_lock(curr, hlock, LOCK_USED))\n\t\treturn 0;\nout_calc_hash:\n\t/*\n\t * Calculate the chain hash: it's the combined has of all the\n\t * lock keys along the dependency chain. We save the hash value\n\t * at every step so that we can get the current hash easily\n\t * after unlock. The chain hash is then used to cache dependency\n\t * results.\n\t *\n\t * The 'key ID' is what is the most compact key value to drive\n\t * the hash, not class->key.\n\t */\n\tid = class - lock_classes;\n\tif (DEBUG_LOCKS_WARN_ON(id >= MAX_LOCKDEP_KEYS))\n\t\treturn 0;\n\n\tchain_key = curr->curr_chain_key;\n\tif (!depth) {\n\t\tif (DEBUG_LOCKS_WARN_ON(chain_key != 0))\n\t\t\treturn 0;\n\t\tchain_head = 1;\n\t}\n\n\thlock->prev_chain_key = chain_key;\n\n#ifdef CONFIG_TRACE_IRQFLAGS\n\t/*\n\t * Keep track of points where we cross into an interrupt context:\n\t */\n\thlock->irq_context = 2*(curr->hardirq_context ? 1 : 0) +\n\t\t\t\tcurr->softirq_context;\n\tif (depth) {\n\t\tstruct held_lock *prev_hlock;\n\n\t\tprev_hlock = curr->held_locks + depth-1;\n\t\t/*\n\t\t * If we cross into another context, reset the\n\t\t * hash key (this also prevents the checking and the\n\t\t * adding of the dependency to 'prev'):\n\t\t */\n\t\tif (prev_hlock->irq_context != hlock->irq_context) {\n\t\t\tchain_key = 0;\n\t\t\tchain_head = 1;\n\t\t}\n\t}\n#endif\n\tchain_key = iterate_chain_key(chain_key, id);\n\n\t/*\n\t * Trylock needs to maintain the stack of held locks, but it\n\t * does not add new dependencies, because trylock can be done\n\t * in any order.\n\t *\n\t * We look up the chain_key and do the O(N^2) check and update of\n\t * the dependencies only if this is a new dependency chain.\n\t * (If lookup_chain_cache() returns with 1 it acquires\n\t * graph_lock for us)\n\t */\n\tif (!trylock && (check == 2) && lookup_chain_cache(chain_key, class)) {\n\t\t/*\n\t\t * Check whether last held lock:\n\t\t *\n\t\t * - is irq-safe, if this lock is irq-unsafe\n\t\t * - is softirq-safe, if this lock is hardirq-unsafe\n\t\t *\n\t\t * And check whether the new lock's dependency graph\n\t\t * could lead back to the previous lock.\n\t\t *\n\t\t * any of these scenarios could lead to a deadlock. If\n\t\t * All validations\n\t\t */\n\t\tint ret = check_deadlock(curr, hlock, lock, read);\n\n\t\tif (!ret)\n\t\t\treturn 0;\n\t\t/*\n\t\t * Mark recursive read, as we jump over it when\n\t\t * building dependencies (just like we jump over\n\t\t * trylock entries):\n\t\t */\n\t\tif (ret == 2)\n\t\t\thlock->read = 2;\n\t\t/*\n\t\t * Add dependency only if this lock is not the head\n\t\t * of the chain, and if it's not a secondary read-lock:\n\t\t */\n\t\tif (!chain_head && ret != 2)\n\t\t\tif (!check_prevs_add(curr, hlock))\n\t\t\t\treturn 0;\n\t\tgraph_unlock();\n\t} else\n\t\t/* after lookup_chain_cache(): */\n\t\tif (unlikely(!debug_locks))\n\t\t\treturn 0;\n\n\tcurr->curr_chain_key = chain_key;\n\tcurr->lockdep_depth++;\n\tcheck_chain_key(curr);\n#ifdef CONFIG_DEBUG_LOCKDEP\n\tif (unlikely(!debug_locks))\n\t\treturn 0;\n#endif\n\tif (unlikely(curr->lockdep_depth >= MAX_LOCK_DEPTH)) {\n\t\tdebug_locks_off();\n\t\tprintk(\"BUG: MAX_LOCK_DEPTH too low!\\n\");\n\t\tprintk(\"turning off the locking correctness validator.\\n\");\n\t\treturn 0;\n\t}\n\n\tif (unlikely(curr->lockdep_depth > max_lockdep_depth))\n\t\tmax_lockdep_depth = curr->lockdep_depth;\n\n\treturn 1;\n}\n\nstatic int\nprint_unlock_inbalance_bug(struct task_struct *curr, struct lockdep_map *lock,\n\t\t\t unsigned long ip)\n{\n\tif (!debug_locks_off())\n\t\treturn 0;\n\tif (debug_locks_silent)\n\t\treturn 0;\n\n\tprintk(\"\\n=====================================\\n\");\n\tprintk( \"[ BUG: bad unlock balance detected! ]\\n\");\n\tprintk( \"-------------------------------------\\n\");\n\tprintk(\"%s/%d is trying to release lock (\",\n\t\tcurr->comm, curr->pid);\n\tprint_lockdep_cache(lock);\n\tprintk(\") at:\\n\");\n\tprint_ip_sym(ip);\n\tprintk(\"but there are no more locks to release!\\n\");\n\tprintk(\"\\nother info that might help us debug this:\\n\");\n\tlockdep_print_held_locks(curr);\n\n\tprintk(\"\\nstack backtrace:\\n\");\n\tdump_stack();\n\n\treturn 0;\n}\n\n/*\n * Common debugging checks for both nested and non-nested unlock:\n */\nstatic int check_unlock(struct task_struct *curr, struct lockdep_map *lock,\n\t\t\tunsigned long ip)\n{\n\tif (unlikely(!debug_locks))\n\t\treturn 0;\n\tif (DEBUG_LOCKS_WARN_ON(!irqs_disabled()))\n\t\treturn 0;\n\n\tif (curr->lockdep_depth <= 0)\n\t\treturn print_unlock_inbalance_bug(curr, lock, ip);\n\n\treturn 1;\n}\n\n/*\n * Remove the lock to the list of currently held locks in a\n * potentially non-nested (out of order) manner. This is a\n * relatively rare operation, as all the unlock APIs default\n * to nested mode (which uses lock_release()):\n */\nstatic int\nlock_release_non_nested(struct task_struct *curr,\n\t\t\tstruct lockdep_map *lock, unsigned long ip)\n{\n\tstruct held_lock *hlock, *prev_hlock;\n\tunsigned int depth;\n\tint i;\n\n\t/*\n\t * Check whether the lock exists in the current stack\n\t * of held locks:\n\t */\n\tdepth = curr->lockdep_depth;\n\tif (DEBUG_LOCKS_WARN_ON(!depth))\n\t\treturn 0;\n\n\tprev_hlock = NULL;\n\tfor (i = depth-1; i >= 0; i--) {\n\t\thlock = curr->held_locks + i;\n\t\t/*\n\t\t * We must not cross into another context:\n\t\t */\n\t\tif (prev_hlock && prev_hlock->irq_context != hlock->irq_context)\n\t\t\tbreak;\n\t\tif (hlock->instance == lock)\n\t\t\tgoto found_it;\n\t\tprev_hlock = hlock;\n\t}\n\treturn print_unlock_inbalance_bug(curr, lock, ip);\n\nfound_it:\n\t/*\n\t * We have the right lock to unlock, 'hlock' points to it.\n\t * Now we remove it from the stack, and add back the other\n\t * entries (if any), recalculating the hash along the way:\n\t */\n\tcurr->lockdep_depth = i;\n\tcurr->curr_chain_key = hlock->prev_chain_key;\n\n\tfor (i++; i < depth; i++) {\n\t\thlock = curr->held_locks + i;\n\t\tif (!__lock_acquire(hlock->instance,\n\t\t\thlock->class->subclass, hlock->trylock,\n\t\t\t\thlock->read, hlock->check, hlock->hardirqs_off,\n\t\t\t\thlock->acquire_ip))\n\t\t\treturn 0;\n\t}\n\n\tif (DEBUG_LOCKS_WARN_ON(curr->lockdep_depth != depth - 1))\n\t\treturn 0;\n\treturn 1;\n}\n\n/*\n * Remove the lock to the list of currently held locks - this gets\n * called on mutex_unlock()/spin_unlock*() (or on a failed\n * mutex_lock_interruptible()). This is done for unlocks that nest\n * perfectly. (i.e. the current top of the lock-stack is unlocked)\n */\nstatic int lock_release_nested(struct task_struct *curr,\n\t\t\t struct lockdep_map *lock, unsigned long ip)\n{\n\tstruct held_lock *hlock;\n\tunsigned int depth;\n\n\t/*\n\t * Pop off the top of the lock stack:\n\t */\n\tdepth = curr->lockdep_depth - 1;\n\thlock = curr->held_locks + depth;\n\n\t/*\n\t * Is the unlock non-nested:\n\t */\n\tif (hlock->instance != lock)\n\t\treturn lock_release_non_nested(curr, lock, ip);\n\tcurr->lockdep_depth--;\n\n\tif (DEBUG_LOCKS_WARN_ON(!depth && (hlock->prev_chain_key != 0)))\n\t\treturn 0;\n\n\tcurr->curr_chain_key = hlock->prev_chain_key;\n\n#ifdef CONFIG_DEBUG_LOCKDEP\n\thlock->prev_chain_key = 0;\n\thlock->class = NULL;\n\thlock->acquire_ip = 0;\n\thlock->irq_context = 0;\n#endif\n\treturn 1;\n}\n\n/*\n * Remove the lock to the list of currently held locks - this gets\n * called on mutex_unlock()/spin_unlock*() (or on a failed\n * mutex_lock_interruptible()). This is done for unlocks that nest\n * perfectly. (i.e. the current top of the lock-stack is unlocked)\n */\nstatic void\n__lock_release(struct lockdep_map *lock, int nested, unsigned long ip)\n{\n\tstruct task_struct *curr = current;\n\n\tif (!check_unlock(curr, lock, ip))\n\t\treturn;\n\n\tif (nested) {\n\t\tif (!lock_release_nested(curr, lock, ip))\n\t\t\treturn;\n\t} else {\n\t\tif (!lock_release_non_nested(curr, lock, ip))\n\t\t\treturn;\n\t}\n\n\tcheck_chain_key(curr);\n}\n\n/*\n * Check whether we follow the irq-flags state precisely:\n */\nstatic void check_flags(unsigned long flags)\n{\n#if defined(CONFIG_DEBUG_LOCKDEP) && defined(CONFIG_TRACE_IRQFLAGS)\n\tif (!debug_locks)\n\t\treturn;\n\n\tif (irqs_disabled_flags(flags))\n\t\tDEBUG_LOCKS_WARN_ON(current->hardirqs_enabled);\n\telse\n\t\tDEBUG_LOCKS_WARN_ON(!current->hardirqs_enabled);\n\n\t/*\n\t * We dont accurately track softirq state in e.g.\n\t * hardirq contexts (such as on 4KSTACKS), so only\n\t * check if not in hardirq contexts:\n\t */\n\tif (!hardirq_count()) {\n\t\tif (softirq_count())\n\t\t\tDEBUG_LOCKS_WARN_ON(current->softirqs_enabled);\n\t\telse\n\t\t\tDEBUG_LOCKS_WARN_ON(!current->softirqs_enabled);\n\t}\n\n\tif (!debug_locks)\n\t\tprint_irqtrace_events(current);\n#endif\n}\n\n/*\n * We are not always called with irqs disabled - do that here,\n * and also avoid lockdep recursion:\n */\nvoid lock_acquire(struct lockdep_map *lock, unsigned int subclass,\n\t\t int trylock, int read, int check, unsigned long ip)\n{\n\tunsigned long flags;\n\n\tif (unlikely(current->lockdep_recursion))\n\t\treturn;\n\n\traw_local_irq_save(flags);\n\tcheck_flags(flags);\n\n\tcurrent->lockdep_recursion = 1;\n\t__lock_acquire(lock, subclass, trylock, read, check,\n\t\t irqs_disabled_flags(flags), ip);\n\tcurrent->lockdep_recursion = 0;\n\traw_local_irq_restore(flags);\n}\n\nEXPORT_SYMBOL_GPL(lock_acquire);\n\nvoid lock_release(struct lockdep_map *lock, int nested, unsigned long ip)\n{\n\tunsigned long flags;\n\n\tif (unlikely(current->lockdep_recursion))\n\t\treturn;\n\n\traw_local_irq_save(flags);\n\tcheck_flags(flags);\n\tcurrent->lockdep_recursion = 1;\n\t__lock_release(lock, nested, ip);\n\tcurrent->lockdep_recursion = 0;\n\traw_local_irq_restore(flags);\n}\n\nEXPORT_SYMBOL_GPL(lock_release);\n\n/*\n * Used by the testsuite, sanitize the validator state\n * after a simulated failure:\n */\n\nvoid lockdep_reset(void)\n{\n\tunsigned long flags;\n\tint i;\n\n\traw_local_irq_save(flags);\n\tcurrent->curr_chain_key = 0;\n\tcurrent->lockdep_depth = 0;\n\tcurrent->lockdep_recursion = 0;\n\tmemset(current->held_locks, 0, MAX_LOCK_DEPTH*sizeof(struct held_lock));\n\tnr_hardirq_chains = 0;\n\tnr_softirq_chains = 0;\n\tnr_process_chains = 0;\n\tdebug_locks = 1;\n\tfor (i = 0; i < CHAINHASH_SIZE; i++)\n\t\tINIT_LIST_HEAD(chainhash_table + i);\n\traw_local_irq_restore(flags);\n}\n\nstatic void zap_class(struct lock_class *class)\n{\n\tint i;\n\n\t/*\n\t * Remove all dependencies this lock is\n\t * involved in:\n\t */\n\tfor (i = 0; i < nr_list_entries; i++) {\n\t\tif (list_entries[i].class == class)\n\t\t\tlist_del_rcu(&list_entries[i].entry);\n\t}\n\t/*\n\t * Unhash the class and remove it from the all_lock_classes list:\n\t */\n\tlist_del_rcu(&class->hash_entry);\n\tlist_del_rcu(&class->lock_entry);\n\n}\n\nstatic inline int within(void *addr, void *start, unsigned long size)\n{\n\treturn addr >= start && addr < start + size;\n}\n\nvoid lockdep_free_key_range(void *start, unsigned long size)\n{\n\tstruct lock_class *class, *next;\n\tstruct list_head *head;\n\tunsigned long flags;\n\tint i;\n\n\traw_local_irq_save(flags);\n\tgraph_lock();\n\n\t/*\n\t * Unhash all classes that were created by this module:\n\t */\n\tfor (i = 0; i < CLASSHASH_SIZE; i++) {\n\t\thead = classhash_table + i;\n\t\tif (list_empty(head))\n\t\t\tcontinue;\n\t\tlist_for_each_entry_safe(class, next, head, hash_entry)\n\t\t\tif (within(class->key, start, size))\n\t\t\t\tzap_class(class);\n\t}\n\n\tgraph_unlock();\n\traw_local_irq_restore(flags);\n}\n\nvoid lockdep_reset_lock(struct lockdep_map *lock)\n{\n\tstruct lock_class *class, *next;\n\tstruct list_head *head;\n\tunsigned long flags;\n\tint i, j;\n\n\traw_local_irq_save(flags);\n\n\t/*\n\t * Remove all classes this lock might have:\n\t */\n\tfor (j = 0; j < MAX_LOCKDEP_SUBCLASSES; j++) {\n\t\t/*\n\t\t * If the class exists we look it up and zap it:\n\t\t */\n\t\tclass = look_up_lock_class(lock, j);\n\t\tif (class)\n\t\t\tzap_class(class);\n\t}\n\t/*\n\t * Debug check: in the end all mapped classes should\n\t * be gone.\n\t */\n\tgraph_lock();\n\tfor (i = 0; i < CLASSHASH_SIZE; i++) {\n\t\thead = classhash_table + i;\n\t\tif (list_empty(head))\n\t\t\tcontinue;\n\t\tlist_for_each_entry_safe(class, next, head, hash_entry) {\n\t\t\tif (unlikely(class == lock->class_cache)) {\n\t\t\t\tif (debug_locks_off_graph_unlock())\n\t\t\t\t\tWARN_ON(1);\n\t\t\t\tgoto out_restore;\n\t\t\t}\n\t\t}\n\t}\n\tgraph_unlock();\n\nout_restore:\n\traw_local_irq_restore(flags);\n}\n\nvoid lockdep_init(void)\n{\n\tint i;\n\n\t/*\n\t * Some architectures have their own start_kernel()\n\t * code which calls lockdep_init(), while we also\n\t * call lockdep_init() from the start_kernel() itself,\n\t * and we want to initialize the hashes only once:\n\t */\n\tif (lockdep_initialized)\n\t\treturn;\n\n\tfor (i = 0; i < CLASSHASH_SIZE; i++)\n\t\tINIT_LIST_HEAD(classhash_table + i);\n\n\tfor (i = 0; i < CHAINHASH_SIZE; i++)\n\t\tINIT_LIST_HEAD(chainhash_table + i);\n\n\tlockdep_initialized = 1;\n}\n\nvoid __init lockdep_info(void)\n{\n\tprintk(\"Lock dependency validator: Copyright (c) 2006 Red Hat, Inc., Ingo Molnar\\n\");\n\n\tprintk(\"... MAX_LOCKDEP_SUBCLASSES: %lu\\n\", MAX_LOCKDEP_SUBCLASSES);\n\tprintk(\"... MAX_LOCK_DEPTH: %lu\\n\", MAX_LOCK_DEPTH);\n\tprintk(\"... MAX_LOCKDEP_KEYS: %lu\\n\", MAX_LOCKDEP_KEYS);\n\tprintk(\"... CLASSHASH_SIZE: %lu\\n\", CLASSHASH_SIZE);\n\tprintk(\"... MAX_LOCKDEP_ENTRIES: %lu\\n\", MAX_LOCKDEP_ENTRIES);\n\tprintk(\"... MAX_LOCKDEP_CHAINS: %lu\\n\", MAX_LOCKDEP_CHAINS);\n\tprintk(\"... CHAINHASH_SIZE: %lu\\n\", CHAINHASH_SIZE);\n\n\tprintk(\" memory used by lock dependency info: %lu kB\\n\",\n\t\t(sizeof(struct lock_class) * MAX_LOCKDEP_KEYS +\n\t\tsizeof(struct list_head) * CLASSHASH_SIZE +\n\t\tsizeof(struct lock_list) * MAX_LOCKDEP_ENTRIES +\n\t\tsizeof(struct lock_chain) * MAX_LOCKDEP_CHAINS +\n\t\tsizeof(struct list_head) * CHAINHASH_SIZE) / 1024);\n\n\tprintk(\" per task-struct memory footprint: %lu bytes\\n\",\n\t\tsizeof(struct held_lock) * MAX_LOCK_DEPTH);\n\n#ifdef CONFIG_DEBUG_LOCKDEP\n\tif (lockdep_init_error)\n\t\tprintk(\"WARNING: lockdep init error! Arch code didnt call lockdep_init() early enough?\\n\");\n#endif\n}\n\nstatic inline int in_range(const void *start, const void *addr, const void *end)\n{\n\treturn addr >= start && addr <= end;\n}\n\nstatic void\nprint_freed_lock_bug(struct task_struct *curr, const void *mem_from,\n\t\t const void *mem_to, struct held_lock *hlock)\n{\n\tif (!debug_locks_off())\n\t\treturn;\n\tif (debug_locks_silent)\n\t\treturn;\n\n\tprintk(\"\\n=========================\\n\");\n\tprintk( \"[ BUG: held lock freed! ]\\n\");\n\tprintk( \"-------------------------\\n\");\n\tprintk(\"%s/%d is freeing memory %p-%p, with a lock still held there!\\n\",\n\t\tcurr->comm, curr->pid, mem_from, mem_to-1);\n\tprint_lock(hlock);\n\tlockdep_print_held_locks(curr);\n\n\tprintk(\"\\nstack backtrace:\\n\");\n\tdump_stack();\n}\n\n/*\n * Called when kernel memory is freed (or unmapped), or if a lock\n * is destroyed or reinitialized - this code checks whether there is\n * any held lock in the memory range of <from> to <to>:\n */\nvoid debug_check_no_locks_freed(const void *mem_from, unsigned long mem_len)\n{\n\tconst void *mem_to = mem_from + mem_len, *lock_from, *lock_to;\n\tstruct task_struct *curr = current;\n\tstruct held_lock *hlock;\n\tunsigned long flags;\n\tint i;\n\n\tif (unlikely(!debug_locks))\n\t\treturn;\n\n\tlocal_irq_save(flags);\n\tfor (i = 0; i < curr->lockdep_depth; i++) {\n\t\thlock = curr->held_locks + i;\n\n\t\tlock_from = (void *)hlock->instance;\n\t\tlock_to = (void *)(hlock->instance + 1);\n\n\t\tif (!in_range(mem_from, lock_from, mem_to) &&\n\t\t\t\t\t!in_range(mem_from, lock_to, mem_to))\n\t\t\tcontinue;\n\n\t\tprint_freed_lock_bug(curr, mem_from, mem_to, hlock);\n\t\tbreak;\n\t}\n\tlocal_irq_restore(flags);\n}\nEXPORT_SYMBOL_GPL(debug_check_no_locks_freed);\n\nstatic void print_held_locks_bug(struct task_struct *curr)\n{\n\tif (!debug_locks_off())\n\t\treturn;\n\tif (debug_locks_silent)\n\t\treturn;\n\n\tprintk(\"\\n=====================================\\n\");\n\tprintk( \"[ BUG: lock held at task exit time! ]\\n\");\n\tprintk( \"-------------------------------------\\n\");\n\tprintk(\"%s/%d is exiting with locks still held!\\n\",\n\t\tcurr->comm, curr->pid);\n\tlockdep_print_held_locks(curr);\n\n\tprintk(\"\\nstack backtrace:\\n\");\n\tdump_stack();\n}\n\nvoid debug_check_no_locks_held(struct task_struct *task)\n{\n\tif (unlikely(task->lockdep_depth > 0))\n\t\tprint_held_locks_bug(task);\n}\n\nvoid debug_show_all_locks(void)\n{\n\tstruct task_struct *g, *p;\n\tint count = 10;\n\tint unlock = 1;\n\n\tif (unlikely(!debug_locks)) {\n\t\tprintk(\"INFO: lockdep is turned off.\\n\");\n\t\treturn;\n\t}\n\tprintk(\"\\nShowing all locks held in the system:\\n\");\n\n\t/*\n\t * Here we try to get the tasklist_lock as hard as possible,\n\t * if not successful after 2 seconds we ignore it (but keep\n\t * trying). This is to enable a debug printout even if a\n\t * tasklist_lock-holding task deadlocks or crashes.\n\t */\nretry:\n\tif (!read_trylock(&tasklist_lock)) {\n\t\tif (count == 10)\n\t\t\tprintk(\"hm, tasklist_lock locked, retrying... \");\n\t\tif (count) {\n\t\t\tcount--;\n\t\t\tprintk(\" #%d\", 10-count);\n\t\t\tmdelay(200);\n\t\t\tgoto retry;\n\t\t}\n\t\tprintk(\" ignoring it.\\n\");\n\t\tunlock = 0;\n\t}\n\tif (count != 10)\n\t\tprintk(\" locked it.\\n\");\n\n\tdo_each_thread(g, p) {\n\t\tif (p->lockdep_depth)\n\t\t\tlockdep_print_held_locks(p);\n\t\tif (!unlock)\n\t\t\tif (read_trylock(&tasklist_lock))\n\t\t\t\tunlock = 1;\n\t} while_each_thread(g, p);\n\n\tprintk(\"\\n\");\n\tprintk(\"=============================================\\n\\n\");\n\n\tif (unlock)\n\t\tread_unlock(&tasklist_lock);\n}\n\nEXPORT_SYMBOL_GPL(debug_show_all_locks);\n\nvoid debug_show_held_locks(struct task_struct *task)\n{\n\tif (unlikely(!debug_locks)) {\n\t\tprintk(\"INFO: lockdep is turned off.\\n\");\n\t\treturn;\n\t}\n\tlockdep_print_held_locks(task);\n}\n\nEXPORT_SYMBOL_GPL(debug_show_held_locks);\n/*\n * kernel/lockdep_proc.c\n *\n * Runtime locking correctness validator\n *\n * Started by Ingo Molnar:\n *\n * Copyright (C) 2006 Red Hat, Inc., Ingo Molnar <mingo@redhat.com>\n *\n * Code for /proc/lockdep and /proc/lockdep_stats:\n *\n */\n#include <linux/module.h>\n#include <linux/proc_fs.h>\n#include <linux/seq_file.h>\n#include <linux/kallsyms.h>\n#include <linux/debug_locks.h>\n\n#include \"lockdep_internals.h\"\n\nstatic void *l_next(struct seq_file *m, void *v, loff_t *pos)\n{\n\tstruct lock_class *class = v;\n\n\t(*pos)++;\n\n\tif (class->lock_entry.next != &all_lock_classes)\n\t\tclass = list_entry(class->lock_entry.next, struct lock_class,\n\t\t\t\t lock_entry);\n\telse\n\t\tclass = NULL;\n\tm->private = class;\n\n\treturn class;\n}\n\nstatic void *l_start(struct seq_file *m, loff_t *pos)\n{\n\tstruct lock_class *class = m->private;\n\n\tif (&class->lock_entry == all_lock_classes.next)\n\t\tseq_printf(m, \"all lock classes:\\n\");\n\n\treturn class;\n}\n\nstatic void l_stop(struct seq_file *m, void *v)\n{\n}\n\nstatic unsigned long count_forward_deps(struct lock_class *class)\n{\n\tstruct lock_list *entry;\n\tunsigned long ret = 1;\n\n\t/*\n\t * Recurse this class's dependency list:\n\t */\n\tlist_for_each_entry(entry, &class->locks_after, entry)\n\t\tret += count_forward_deps(entry->class);\n\n\treturn ret;\n}\n\nstatic unsigned long count_backward_deps(struct lock_class *class)\n{\n\tstruct lock_list *entry;\n\tunsigned long ret = 1;\n\n\t/*\n\t * Recurse this class's dependency list:\n\t */\n\tlist_for_each_entry(entry, &class->locks_before, entry)\n\t\tret += count_backward_deps(entry->class);\n\n\treturn ret;\n}\n\nstatic void print_name(struct seq_file *m, struct lock_class *class)\n{\n\tchar str[128];\n\tconst char *name = class->name;\n\n\tif (!name) {\n\t\tname = __get_key_name(class->key, str);\n\t\tseq_printf(m, \"%s\", name);\n\t} else{\n\t\tseq_printf(m, \"%s\", name);\n\t\tif (class->name_version > 1)\n\t\t\tseq_printf(m, \"#%d\", class->name_version);\n\t\tif (class->subclass)\n\t\t\tseq_printf(m, \"/%d\", class->subclass);\n\t}\n}\n\nstatic int l_show(struct seq_file *m, void *v)\n{\n\tunsigned long nr_forward_deps, nr_backward_deps;\n\tstruct lock_class *class = m->private;\n\tstruct lock_list *entry;\n\tchar c1, c2, c3, c4;\n\n\tseq_printf(m, \"%p\", class->key);\n#ifdef CONFIG_DEBUG_LOCKDEP\n\tseq_printf(m, \" OPS:%8ld\", class->ops);\n#endif\n\tnr_forward_deps = count_forward_deps(class);\n\tseq_printf(m, \" FD:%5ld\", nr_forward_deps);\n\n\tnr_backward_deps = count_backward_deps(class);\n\tseq_printf(m, \" BD:%5ld\", nr_backward_deps);\n\n\tget_usage_chars(class, &c1, &c2, &c3, &c4);\n\tseq_printf(m, \" %c%c%c%c\", c1, c2, c3, c4);\n\n\tseq_printf(m, \": \");\n\tprint_name(m, class);\n\tseq_puts(m, \"\\n\");\n\n\tlist_for_each_entry(entry, &class->locks_after, entry) {\n\t\tif (entry->distance == 1) {\n\t\t\tseq_printf(m, \" -> [%p] \", entry->class);\n\t\t\tprint_name(m, entry->class);\n\t\t\tseq_puts(m, \"\\n\");\n\t\t}\n\t}\n\tseq_puts(m, \"\\n\");\n\n\treturn 0;\n}\n\nstatic const struct seq_operations lockdep_ops = {\n\t.start\t= l_start,\n\t.next\t= l_next,\n\t.stop\t= l_stop,\n\t.show\t= l_show,\n};\n\nstatic int lockdep_open(struct inode *inode, struct file *file)\n{\n\tint res = seq_open(file, &lockdep_ops);\n\tif (!res) {\n\t\tstruct seq_file *m = file->private_data;\n\n\t\tif (!list_empty(&all_lock_classes))\n\t\t\tm->private = list_entry(all_lock_classes.next,\n\t\t\t\t\tstruct lock_class, lock_entry);\n\t\telse\n\t\t\tm->private = NULL;\n\t}\n\treturn res;\n}\n\nstatic const struct file_operations proc_lockdep_operations = {\n\t.open\t\t= lockdep_open,\n\t.read\t\t= seq_read,\n\t.llseek\t\t= seq_lseek,\n\t.release\t= seq_release,\n};\n\nstatic void lockdep_stats_debug_show(struct seq_file *m)\n{\n#ifdef CONFIG_DEBUG_LOCKDEP\n\tunsigned int hi1 = debug_atomic_read(&hardirqs_on_events),\n\t\t hi2 = debug_atomic_read(&hardirqs_off_events),\n\t\t hr1 = debug_atomic_read(&redundant_hardirqs_on),\n\t\t hr2 = debug_atomic_read(&redundant_hardirqs_off),\n\t\t si1 = debug_atomic_read(&softirqs_on_events),\n\t\t si2 = debug_atomic_read(&softirqs_off_events),\n\t\t sr1 = debug_atomic_read(&redundant_softirqs_on),\n\t\t sr2 = debug_atomic_read(&redundant_softirqs_off);\n\n\tseq_printf(m, \" chain lookup misses: %11u\\n\",\n\t\tdebug_atomic_read(&chain_lookup_misses));\n\tseq_printf(m, \" chain lookup hits: %11u\\n\",\n\t\tdebug_atomic_read(&chain_lookup_hits));\n\tseq_printf(m, \" cyclic checks: %11u\\n\",\n\t\tdebug_atomic_read(&nr_cyclic_checks));\n\tseq_printf(m, \" cyclic-check recursions: %11u\\n\",\n\t\tdebug_atomic_read(&nr_cyclic_check_recursions));\n\tseq_printf(m, \" find-mask forwards checks: %11u\\n\",\n\t\tdebug_atomic_read(&nr_find_usage_forwards_checks));\n\tseq_printf(m, \" find-mask forwards recursions: %11u\\n\",\n\t\tdebug_atomic_read(&nr_find_usage_forwards_recursions));\n\tseq_printf(m, \" find-mask backwards checks: %11u\\n\",\n\t\tdebug_atomic_read(&nr_find_usage_backwards_checks));\n\tseq_printf(m, \" find-mask backwards recursions:%11u\\n\",\n\t\tdebug_atomic_read(&nr_find_usage_backwards_recursions));\n\n\tseq_printf(m, \" hardirq on events: %11u\\n\", hi1);\n\tseq_printf(m, \" hardirq off events: %11u\\n\", hi2);\n\tseq_printf(m, \" redundant hardirq ons: %11u\\n\", hr1);\n\tseq_printf(m, \" redundant hardirq offs: %11u\\n\", hr2);\n\tseq_printf(m, \" softirq on events: %11u\\n\", si1);\n\tseq_printf(m, \" softirq off events: %11u\\n\", si2);\n\tseq_printf(m, \" redundant softirq ons: %11u\\n\", sr1);\n\tseq_printf(m, \" redundant softirq offs: %11u\\n\", sr2);\n#endif\n}\n\nstatic int lockdep_stats_show(struct seq_file *m, void *v)\n{\n\tstruct lock_class *class;\n\tunsigned long nr_unused = 0, nr_uncategorized = 0,\n\t\t nr_irq_safe = 0, nr_irq_unsafe = 0,\n\t\t nr_softirq_safe = 0, nr_softirq_unsafe = 0,\n\t\t nr_hardirq_safe = 0, nr_hardirq_unsafe = 0,\n\t\t nr_irq_read_safe = 0, nr_irq_read_unsafe = 0,\n\t\t nr_softirq_read_safe = 0, nr_softirq_read_unsafe = 0,\n\t\t nr_hardirq_read_safe = 0, nr_hardirq_read_unsafe = 0,\n\t\t sum_forward_deps = 0, factor = 0;\n\n\tlist_for_each_entry(class, &all_lock_classes, lock_entry) {\n\n\t\tif (class->usage_mask == 0)\n\t\t\tnr_unused++;\n\t\tif (class->usage_mask == LOCKF_USED)\n\t\t\tnr_uncategorized++;\n\t\tif (class->usage_mask & LOCKF_USED_IN_IRQ)\n\t\t\tnr_irq_safe++;\n\t\tif (class->usage_mask & LOCKF_ENABLED_IRQS)\n\t\t\tnr_irq_unsafe++;\n\t\tif (class->usage_mask & LOCKF_USED_IN_SOFTIRQ)\n\t\t\tnr_softirq_safe++;\n\t\tif (class->usage_mask & LOCKF_ENABLED_SOFTIRQS)\n\t\t\tnr_softirq_unsafe++;\n\t\tif (class->usage_mask & LOCKF_USED_IN_HARDIRQ)\n\t\t\tnr_hardirq_safe++;\n\t\tif (class->usage_mask & LOCKF_ENABLED_HARDIRQS)\n\t\t\tnr_hardirq_unsafe++;\n\t\tif (class->usage_mask & LOCKF_USED_IN_IRQ_READ)\n\t\t\tnr_irq_read_safe++;\n\t\tif (class->usage_mask & LOCKF_ENABLED_IRQS_READ)\n\t\t\tnr_irq_read_unsafe++;\n\t\tif (class->usage_mask & LOCKF_USED_IN_SOFTIRQ_READ)\n\t\t\tnr_softirq_read_safe++;\n\t\tif (class->usage_mask & LOCKF_ENABLED_SOFTIRQS_READ)\n\t\t\tnr_softirq_read_unsafe++;\n\t\tif (class->usage_mask & LOCKF_USED_IN_HARDIRQ_READ)\n\t\t\tnr_hardirq_read_safe++;\n\t\tif (class->usage_mask & LOCKF_ENABLED_HARDIRQS_READ)\n\t\t\tnr_hardirq_read_unsafe++;\n\n\t\tsum_forward_deps += count_forward_deps(class);\n\t}\n#ifdef CONFIG_DEBUG_LOCKDEP\n\tDEBUG_LOCKS_WARN_ON(debug_atomic_read(&nr_unused_locks) != nr_unused);\n#endif\n\tseq_printf(m, \" lock-classes: %11lu [max: %lu]\\n\",\n\t\t\tnr_lock_classes, MAX_LOCKDEP_KEYS);\n\tseq_printf(m, \" direct dependencies: %11lu [max: %lu]\\n\",\n\t\t\tnr_list_entries, MAX_LOCKDEP_ENTRIES);\n\tseq_printf(m, \" indirect dependencies: %11lu\\n\",\n\t\t\tsum_forward_deps);\n\n\t/*\n\t * Total number of dependencies:\n\t *\n\t * All irq-safe locks may nest inside irq-unsafe locks,\n\t * plus all the other known dependencies:\n\t */\n\tseq_printf(m, \" all direct dependencies: %11lu\\n\",\n\t\t\tnr_irq_unsafe * nr_irq_safe +\n\t\t\tnr_hardirq_unsafe * nr_hardirq_safe +\n\t\t\tnr_list_entries);\n\n\t/*\n\t * Estimated factor between direct and indirect\n\t * dependencies:\n\t */\n\tif (nr_list_entries)\n\t\tfactor = sum_forward_deps / nr_list_entries;\n\n\tseq_printf(m, \" dependency chains: %11lu [max: %lu]\\n\",\n\t\t\tnr_lock_chains, MAX_LOCKDEP_CHAINS);\n\n#ifdef CONFIG_TRACE_IRQFLAGS\n\tseq_printf(m, \" in-hardirq chains: %11u\\n\",\n\t\t\tnr_hardirq_chains);\n\tseq_printf(m, \" in-softirq chains: %11u\\n\",\n\t\t\tnr_softirq_chains);\n#endif\n\tseq_printf(m, \" in-process chains: %11u\\n\",\n\t\t\tnr_process_chains);\n\tseq_printf(m, \" stack-trace entries: %11lu [max: %lu]\\n\",\n\t\t\tnr_stack_trace_entries, MAX_STACK_TRACE_ENTRIES);\n\tseq_printf(m, \" combined max dependencies: %11u\\n\",\n\t\t\t(nr_hardirq_chains + 1) *\n\t\t\t(nr_softirq_chains + 1) *\n\t\t\t(nr_process_chains + 1)\n\t);\n\tseq_printf(m, \" hardirq-safe locks: %11lu\\n\",\n\t\t\tnr_hardirq_safe);\n\tseq_printf(m, \" hardirq-unsafe locks: %11lu\\n\",\n\t\t\tnr_hardirq_unsafe);\n\tseq_printf(m, \" softirq-safe locks: %11lu\\n\",\n\t\t\tnr_softirq_safe);\n\tseq_printf(m, \" softirq-unsafe locks: %11lu\\n\",\n\t\t\tnr_softirq_unsafe);\n\tseq_printf(m, \" irq-safe locks: %11lu\\n\",\n\t\t\tnr_irq_safe);\n\tseq_printf(m, \" irq-unsafe locks: %11lu\\n\",\n\t\t\tnr_irq_unsafe);\n\n\tseq_printf(m, \" hardirq-read-safe locks: %11lu\\n\",\n\t\t\tnr_hardirq_read_safe);\n\tseq_printf(m, \" hardirq-read-unsafe locks: %11lu\\n\",\n\t\t\tnr_hardirq_read_unsafe);\n\tseq_printf(m, \" softirq-read-safe locks: %11lu\\n\",\n\t\t\tnr_softirq_read_safe);\n\tseq_printf(m, \" softirq-read-unsafe locks: %11lu\\n\",\n\t\t\tnr_softirq_read_unsafe);\n\tseq_printf(m, \" irq-read-safe locks: %11lu\\n\",\n\t\t\tnr_irq_read_safe);\n\tseq_printf(m, \" irq-read-unsafe locks: %11lu\\n\",\n\t\t\tnr_irq_read_unsafe);\n\n\tseq_printf(m, \" uncategorized locks: %11lu\\n\",\n\t\t\tnr_uncategorized);\n\tseq_printf(m, \" unused locks: %11lu\\n\",\n\t\t\tnr_unused);\n\tseq_printf(m, \" max locking depth: %11u\\n\",\n\t\t\tmax_lockdep_depth);\n\tseq_printf(m, \" max recursion depth: %11u\\n\",\n\t\t\tmax_recursion_depth);\n\tlockdep_stats_debug_show(m);\n\tseq_printf(m, \" debug_locks: %11u\\n\",\n\t\t\tdebug_locks);\n\n\treturn 0;\n}\n\nstatic int lockdep_stats_open(struct inode *inode, struct file *file)\n{\n\treturn single_open(file, lockdep_stats_show, NULL);\n}\n\nstatic const struct file_operations proc_lockdep_stats_operations = {\n\t.open\t\t= lockdep_stats_open,\n\t.read\t\t= seq_read,\n\t.llseek\t\t= seq_lseek,\n\t.release\t= single_release,\n};\n\nstatic int __init lockdep_proc_init(void)\n{\n\tstruct proc_dir_entry *entry;\n\n\tentry = create_proc_entry(\"lockdep\", S_IRUSR, NULL);\n\tif (entry)\n\t\tentry->proc_fops = &proc_lockdep_operations;\n\n\tentry = create_proc_entry(\"lockdep_stats\", S_IRUSR, NULL);\n\tif (entry)\n\t\tentry->proc_fops = &proc_lockdep_stats_operations;\n\n\treturn 0;\n}\n\n__initcall(lockdep_proc_init);\n\n/*\n Copyright (C) 2002 Richard Henderson\n Copyright (C) 2001 Rusty Russell, 2002 Rusty Russell IBM.\n\n This program is free software; you can redistribute it and/or modify\n it under the terms of the GNU General Public License as published by\n the Free Software Foundation; either version 2 of the License, or\n (at your option) any later version.\n\n This program is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License\n along with this program; if not, write to the Free Software\n Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n*/\n#include <linux/module.h>\n#include <linux/moduleloader.h>\n#include <linux/init.h>\n#include <linux/kallsyms.h>\n#include <linux/kernel.h>\n#include <linux/slab.h>\n#include <linux/vmalloc.h>\n#include <linux/elf.h>\n#include <linux/seq_file.h>\n#include <linux/syscalls.h>\n#include <linux/fcntl.h>\n#include <linux/rcupdate.h>\n#include <linux/capability.h>\n#include <linux/cpu.h>\n#include <linux/moduleparam.h>\n#include <linux/errno.h>\n#include <linux/err.h>\n#include <linux/vermagic.h>\n#include <linux/notifier.h>\n#include <linux/sched.h>\n#include <linux/stop_machine.h>\n#include <linux/device.h>\n#include <linux/string.h>\n#include <linux/mutex.h>\n#include <linux/unwind.h>\n#include <asm/uaccess.h>\n#include <asm/semaphore.h>\n#include <asm/cacheflush.h>\n#include <linux/license.h>\n\nextern int module_sysfs_initialized;\n\n#if 0\n#define DEBUGP printk\n#else\n#define DEBUGP(fmt , a...)\n#endif\n\n#ifndef ARCH_SHF_SMALL\n#define ARCH_SHF_SMALL 0\n#endif\n\n/* If this is set, the section belongs in the init part of the module */\n#define INIT_OFFSET_MASK (1UL << (BITS_PER_LONG-1))\n\n/* Allow unsupported modules switch. */\n#ifdef UNSUPPORTED_MODULES\nint unsupported = UNSUPPORTED_MODULES;\n#else\nint unsupported = 2; /* don't warn when loading unsupported modules. */\n#endif\n\nstatic int __init unsupported_setup(char *str)\n{\n\tget_option(&str, &unsupported);\n\treturn 1;\n}\n__setup(\"unsupported=\", unsupported_setup);\n\n/* Protects module list */\nstatic DEFINE_SPINLOCK(modlist_lock);\n\n/* List of modules, protected by module_mutex AND modlist_lock */\nstatic DEFINE_MUTEX(module_mutex);\nstatic LIST_HEAD(modules);\n\nstatic BLOCKING_NOTIFIER_HEAD(module_notify_list);\n\nint register_module_notifier(struct notifier_block * nb)\n{\n\treturn blocking_notifier_chain_register(&module_notify_list, nb);\n}\nEXPORT_SYMBOL(register_module_notifier);\n\nint unregister_module_notifier(struct notifier_block * nb)\n{\n\treturn blocking_notifier_chain_unregister(&module_notify_list, nb);\n}\nEXPORT_SYMBOL(unregister_module_notifier);\n\n/* We require a truly strong try_module_get() */\nstatic inline int strong_try_module_get(struct module *mod)\n{\n\tif (mod && mod->state == MODULE_STATE_COMING)\n\t\treturn 0;\n\treturn try_module_get(mod);\n}\n\nstatic inline void add_taint_module(struct module *mod, unsigned flag)\n{\n\tadd_taint(flag);\n\tmod->taints |= flag;\n}\n\n/*\n * A thread that wants to hold a reference to a module only while it\n * is running can call this to safely exit. nfsd and lockd use this.\n */\nvoid __module_put_and_exit(struct module *mod, long code)\n{\n\tmodule_put(mod);\n\tdo_exit(code);\n}\nEXPORT_SYMBOL(__module_put_and_exit);\n\t\n/* Find a module section: 0 means not found. */\nstatic unsigned int find_sec(Elf_Ehdr *hdr,\n\t\t\t Elf_Shdr *sechdrs,\n\t\t\t const char *secstrings,\n\t\t\t const char *name)\n{\n\tunsigned int i;\n\n\tfor (i = 1; i < hdr->e_shnum; i++)\n\t\t/* Alloc bit cleared means \"ignore it.\" */\n\t\tif ((sechdrs[i].sh_flags & SHF_ALLOC)\n\t\t && strcmp(secstrings+sechdrs[i].sh_name, name) == 0)\n\t\t\treturn i;\n\treturn 0;\n}\n\n/* Provided by the linker */\nextern const struct kernel_symbol __start___ksymtab[];\nextern const struct kernel_symbol __stop___ksymtab[];\nextern const struct kernel_symbol __start___ksymtab_gpl[];\nextern const struct kernel_symbol __stop___ksymtab_gpl[];\nextern const struct kernel_symbol __start___ksymtab_gpl_future[];\nextern const struct kernel_symbol __stop___ksymtab_gpl_future[];\nextern const struct kernel_symbol __start___ksymtab_unused[];\nextern const struct kernel_symbol __stop___ksymtab_unused[];\nextern const struct kernel_symbol __start___ksymtab_unused_gpl[];\nextern const struct kernel_symbol __stop___ksymtab_unused_gpl[];\nextern const struct kernel_symbol __start___ksymtab_gpl_future[];\nextern const struct kernel_symbol __stop___ksymtab_gpl_future[];\nextern const unsigned long __start___kcrctab[];\nextern const unsigned long __start___kcrctab_gpl[];\nextern const unsigned long __start___kcrctab_gpl_future[];\nextern const unsigned long __start___kcrctab_unused[];\nextern const unsigned long __start___kcrctab_unused_gpl[];\n\n#ifndef CONFIG_MODVERSIONS\n#define symversion(base, idx) NULL\n#else\n#define symversion(base, idx) ((base != NULL) ? ((base) + (idx)) : NULL)\n#endif\n\n/* lookup symbol in given range of kernel_symbols */\nstatic const struct kernel_symbol *lookup_symbol(const char *name,\n\tconst struct kernel_symbol *start,\n\tconst struct kernel_symbol *stop)\n{\n\tconst struct kernel_symbol *ks = start;\n\tfor (; ks < stop; ks++)\n\t\tif (strcmp(ks->name, name) == 0)\n\t\t\treturn ks;\n\treturn NULL;\n}\n\nstatic void printk_unused_warning(const char *name)\n{\n\tprintk(KERN_WARNING \"Symbol %s is marked as UNUSED, \"\n\t\t\"however this module is using it.\\n\", name);\n\tprintk(KERN_WARNING \"This symbol will go away in the future.\\n\");\n\tprintk(KERN_WARNING \"Please evalute if this is the right api to use, \"\n\t\t\"and if it really is, submit a report the linux kernel \"\n\t\t\"mailinglist together with submitting your code for \"\n\t\t\"inclusion.\\n\");\n}\n\n/* Find a symbol, return value, crc and module which owns it */\nstatic unsigned long __find_symbol(const char *name,\n\t\t\t\t struct module **owner,\n\t\t\t\t const unsigned long **crc,\n\t\t\t\t int gplok)\n{\n\tstruct module *mod;\n\tconst struct kernel_symbol *ks;\n\n\t/* Core kernel first. */ \n\t*owner = NULL;\n\tks = lookup_symbol(name, __start___ksymtab, __stop___ksymtab);\n\tif (ks) {\n\t\t*crc = symversion(__start___kcrctab, (ks - __start___ksymtab));\n\t\treturn ks->value;\n\t}\n\tif (gplok) {\n\t\tks = lookup_symbol(name, __start___ksymtab_gpl,\n\t\t\t\t\t __stop___ksymtab_gpl);\n\t\tif (ks) {\n\t\t\t*crc = symversion(__start___kcrctab_gpl,\n\t\t\t\t\t (ks - __start___ksymtab_gpl));\n\t\t\treturn ks->value;\n\t\t}\n\t}\n\tks = lookup_symbol(name, __start___ksymtab_gpl_future,\n\t\t\t\t __stop___ksymtab_gpl_future);\n\tif (ks) {\n\t\tif (!gplok) {\n\t\t\tprintk(KERN_WARNING \"Symbol %s is being used \"\n\t\t\t \"by a non-GPL module, which will not \"\n\t\t\t \"be allowed in the future\\n\", name);\n\t\t\tprintk(KERN_WARNING \"Please see the file \"\n\t\t\t \"Documentation/feature-removal-schedule.txt \"\n\t\t\t \"in the kernel source tree for more \"\n\t\t\t \"details.\\n\");\n\t\t}\n\t\t*crc = symversion(__start___kcrctab_gpl_future,\n\t\t\t\t (ks - __start___ksymtab_gpl_future));\n\t\treturn ks->value;\n\t}\n\n\tks = lookup_symbol(name, __start___ksymtab_unused,\n\t\t\t\t __stop___ksymtab_unused);\n\tif (ks) {\n\t\tprintk_unused_warning(name);\n\t\t*crc = symversion(__start___kcrctab_unused,\n\t\t\t\t (ks - __start___ksymtab_unused));\n\t\treturn ks->value;\n\t}\n\n\tif (gplok)\n\t\tks = lookup_symbol(name, __start___ksymtab_unused_gpl,\n\t\t\t\t __stop___ksymtab_unused_gpl);\n\tif (ks) {\n\t\tprintk_unused_warning(name);\n\t\t*crc = symversion(__start___kcrctab_unused_gpl,\n\t\t\t\t (ks - __start___ksymtab_unused_gpl));\n\t\treturn ks->value;\n\t}\n\n\t/* Now try modules. */ \n\tlist_for_each_entry(mod, &modules, list) {\n\t\t*owner = mod;\n\t\tks = lookup_symbol(name, mod->syms, mod->syms + mod->num_syms);\n\t\tif (ks) {\n\t\t\t*crc = symversion(mod->crcs, (ks - mod->syms));\n\t\t\treturn ks->value;\n\t\t}\n\n\t\tif (gplok) {\n\t\t\tks = lookup_symbol(name, mod->gpl_syms,\n\t\t\t\t\t mod->gpl_syms + mod->num_gpl_syms);\n\t\t\tif (ks) {\n\t\t\t\t*crc = symversion(mod->gpl_crcs,\n\t\t\t\t\t\t (ks - mod->gpl_syms));\n\t\t\t\treturn ks->value;\n\t\t\t}\n\t\t}\n\t\tks = lookup_symbol(name, mod->unused_syms, mod->unused_syms + mod->num_unused_syms);\n\t\tif (ks) {\n\t\t\tprintk_unused_warning(name);\n\t\t\t*crc = symversion(mod->unused_crcs, (ks - mod->unused_syms));\n\t\t\treturn ks->value;\n\t\t}\n\n\t\tif (gplok) {\n\t\t\tks = lookup_symbol(name, mod->unused_gpl_syms,\n\t\t\t\t\t mod->unused_gpl_syms + mod->num_unused_gpl_syms);\n\t\t\tif (ks) {\n\t\t\t\tprintk_unused_warning(name);\n\t\t\t\t*crc = symversion(mod->unused_gpl_crcs,\n\t\t\t\t\t\t (ks - mod->unused_gpl_syms));\n\t\t\t\treturn ks->value;\n\t\t\t}\n\t\t}\n\t\tks = lookup_symbol(name, mod->gpl_future_syms,\n\t\t\t\t (mod->gpl_future_syms +\n\t\t\t\t mod->num_gpl_future_syms));\n\t\tif (ks) {\n\t\t\tif (!gplok) {\n\t\t\t\tprintk(KERN_WARNING \"Symbol %s is being used \"\n\t\t\t\t \"by a non-GPL module, which will not \"\n\t\t\t\t \"be allowed in the future\\n\", name);\n\t\t\t\tprintk(KERN_WARNING \"Please see the file \"\n\t\t\t\t \"Documentation/feature-removal-schedule.txt \"\n\t\t\t\t \"in the kernel source tree for more \"\n\t\t\t\t \"details.\\n\");\n\t\t\t}\n\t\t\t*crc = symversion(mod->gpl_future_crcs,\n\t\t\t\t\t (ks - mod->gpl_future_syms));\n\t\t\treturn ks->value;\n\t\t}\n\t}\n\tDEBUGP(\"Failed to find symbol %s\\n\", name);\n \treturn 0;\n}\n\n/* Search for module by name: must hold module_mutex. */\nstatic struct module *find_module(const char *name)\n{\n\tstruct module *mod;\n\n\tlist_for_each_entry(mod, &modules, list) {\n\t\tif (strcmp(mod->name, name) == 0)\n\t\t\treturn mod;\n\t}\n\treturn NULL;\n}\n\n#ifdef CONFIG_SMP\n/* Number of blocks used and allocated. */\nstatic unsigned int pcpu_num_used, pcpu_num_allocated;\n/* Size of each block. -ve means used. */\nstatic int *pcpu_size;\n\nstatic int split_block(unsigned int i, unsigned short size)\n{\n\t/* Reallocation required? */\n\tif (pcpu_num_used + 1 > pcpu_num_allocated) {\n\t\tint *new;\n\n\t\tnew = krealloc(pcpu_size, sizeof(new[0])*pcpu_num_allocated*2,\n\t\t\t GFP_KERNEL);\n\t\tif (!new)\n\t\t\treturn 0;\n\n\t\tpcpu_num_allocated *= 2;\n\t\tpcpu_size = new;\n\t}\n\n\t/* Insert a new subblock */\n\tmemmove(&pcpu_size[i+1], &pcpu_size[i],\n\t\tsizeof(pcpu_size[0]) * (pcpu_num_used - i));\n\tpcpu_num_used++;\n\n\tpcpu_size[i+1] -= size;\n\tpcpu_size[i] = size;\n\treturn 1;\n}\n\nstatic inline unsigned int block_size(int val)\n{\n\tif (val < 0)\n\t\treturn -val;\n\treturn val;\n}\n\n/* Created by linker magic */\nextern char __per_cpu_start[], __per_cpu_end[];\n\nstatic void *percpu_modalloc(unsigned long size, unsigned long align,\n\t\t\t const char *name)\n{\n\tunsigned long extra;\n\tunsigned int i;\n\tvoid *ptr;\n\n\tif (align > PAGE_SIZE) {\n\t\tprintk(KERN_WARNING \"%s: per-cpu alignment %li > %li\\n\",\n\t\t name, align, PAGE_SIZE);\n\t\talign = PAGE_SIZE;\n\t}\n\n\tptr = __per_cpu_start;\n\tfor (i = 0; i < pcpu_num_used; ptr += block_size(pcpu_size[i]), i++) {\n\t\t/* Extra for alignment requirement. */\n\t\textra = ALIGN((unsigned long)ptr, align) - (unsigned long)ptr;\n\t\tBUG_ON(i == 0 && extra != 0);\n\n\t\tif (pcpu_size[i] < 0 || pcpu_size[i] < extra + size)\n\t\t\tcontinue;\n\n\t\t/* Transfer extra to previous block. */\n\t\tif (pcpu_size[i-1] < 0)\n\t\t\tpcpu_size[i-1] -= extra;\n\t\telse\n\t\t\tpcpu_size[i-1] += extra;\n\t\tpcpu_size[i] -= extra;\n\t\tptr += extra;\n\n\t\t/* Split block if warranted */\n\t\tif (pcpu_size[i] - size > sizeof(unsigned long))\n\t\t\tif (!split_block(i, size))\n\t\t\t\treturn NULL;\n\n\t\t/* Mark allocated */\n\t\tpcpu_size[i] = -pcpu_size[i];\n\t\treturn ptr;\n\t}\n\n\tprintk(KERN_WARNING \"Could not allocate %lu bytes percpu data\\n\",\n\t size);\n\treturn NULL;\n}\n\nstatic void percpu_modfree(void *freeme)\n{\n\tunsigned int i;\n\tvoid *ptr = __per_cpu_start + block_size(pcpu_size[0]);\n\n\t/* First entry is core kernel percpu data. */\n\tfor (i = 1; i < pcpu_num_used; ptr += block_size(pcpu_size[i]), i++) {\n\t\tif (ptr == freeme) {\n\t\t\tpcpu_size[i] = -pcpu_size[i];\n\t\t\tgoto free;\n\t\t}\n\t}\n\tBUG();\n\n free:\n\t/* Merge with previous? */\n\tif (pcpu_size[i-1] >= 0) {\n\t\tpcpu_size[i-1] += pcpu_size[i];\n\t\tpcpu_num_used--;\n\t\tmemmove(&pcpu_size[i], &pcpu_size[i+1],\n\t\t\t(pcpu_num_used - i) * sizeof(pcpu_size[0]));\n\t\ti--;\n\t}\n\t/* Merge with next? */\n\tif (i+1 < pcpu_num_used && pcpu_size[i+1] >= 0) {\n\t\tpcpu_size[i] += pcpu_size[i+1];\n\t\tpcpu_num_used--;\n\t\tmemmove(&pcpu_size[i+1], &pcpu_size[i+2],\n\t\t\t(pcpu_num_used - (i+1)) * sizeof(pcpu_size[0]));\n\t}\n}\n\nstatic unsigned int find_pcpusec(Elf_Ehdr *hdr,\n\t\t\t\t Elf_Shdr *sechdrs,\n\t\t\t\t const char *secstrings)\n{\n\treturn find_sec(hdr, sechdrs, secstrings, \".data.percpu\");\n}\n\nstatic int percpu_modinit(void)\n{\n\tpcpu_num_used = 2;\n\tpcpu_num_allocated = 2;\n\tpcpu_size = kmalloc(sizeof(pcpu_size[0]) * pcpu_num_allocated,\n\t\t\t GFP_KERNEL);\n\t/* Static in-kernel percpu data (used). */\n\tpcpu_size[0] = -(__per_cpu_end-__per_cpu_start);\n\t/* Free room. */\n\tpcpu_size[1] = PERCPU_ENOUGH_ROOM + pcpu_size[0];\n\tif (pcpu_size[1] < 0) {\n\t\tprintk(KERN_ERR \"No per-cpu room for modules.\\n\");\n\t\tpcpu_num_used = 1;\n\t}\n\n\treturn 0;\n}\t\n__initcall(percpu_modinit);\n#else /* ... !CONFIG_SMP */\nstatic inline void *percpu_modalloc(unsigned long size, unsigned long align,\n\t\t\t\t const char *name)\n{\n\treturn NULL;\n}\nstatic inline void percpu_modfree(void *pcpuptr)\n{\n\tBUG();\n}\nstatic inline unsigned int find_pcpusec(Elf_Ehdr *hdr,\n\t\t\t\t\tElf_Shdr *sechdrs,\n\t\t\t\t\tconst char *secstrings)\n{\n\treturn 0;\n}\nstatic inline void percpu_modcopy(void *pcpudst, const void *src,\n\t\t\t\t unsigned long size)\n{\n\t/* pcpusec should be 0, and size of that section should be 0. */\n\tBUG_ON(size != 0);\n}\n#endif /* CONFIG_SMP */\n\n#define MODINFO_ATTR(field)\t\\\nstatic void setup_modinfo_##field(struct module *mod, const char *s) \\\n{ \\\n\tmod->field = kstrdup(s, GFP_KERNEL); \\\n} \\\nstatic ssize_t show_modinfo_##field(struct module_attribute *mattr, \\\n\t struct module *mod, char *buffer) \\\n{ \\\n\treturn sprintf(buffer, \"%s\\n\", mod->field); \\\n} \\\nstatic int modinfo_##field##_exists(struct module *mod) \\\n{ \\\n\treturn mod->field != NULL; \\\n} \\\nstatic void free_modinfo_##field(struct module *mod) \\\n{ \\\n kfree(mod->field); \\\n mod->field = NULL; \\\n} \\\nstatic struct module_attribute modinfo_##field = { \\\n\t.attr = { .name = __stringify(field), .mode = 0444, \\\n\t\t .owner = THIS_MODULE }, \\\n\t.show = show_modinfo_##field, \\\n\t.setup = setup_modinfo_##field, \\\n\t.test = modinfo_##field##_exists, \\\n\t.free = free_modinfo_##field, \\\n};\n\nMODINFO_ATTR(version);\nMODINFO_ATTR(srcversion);\n\n#ifdef CONFIG_MODULE_UNLOAD\n/* Init the unload section of the module. */\nstatic void module_unload_init(struct module *mod)\n{\n\tunsigned int i;\n\n\tINIT_LIST_HEAD(&mod->modules_which_use_me);\n\tfor (i = 0; i < NR_CPUS; i++)\n\t\tlocal_set(&mod->ref[i].count, 0);\n\t/* Hold reference count during initialization. */\n\tlocal_set(&mod->ref[raw_smp_processor_id()].count, 1);\n\t/* Backwards compatibility macros put refcount during init. */\n\tmod->waiter = current;\n}\n\n/* modules using other modules */\nstruct module_use\n{\n\tstruct list_head list;\n\tstruct module *module_which_uses;\n};\n\n/* Does a already use b? */\nstatic int already_uses(struct module *a, struct module *b)\n{\n\tstruct module_use *use;\n\n\tlist_for_each_entry(use, &b->modules_which_use_me, list) {\n\t\tif (use->module_which_uses == a) {\n\t\t\tDEBUGP(\"%s uses %s!\\n\", a->name, b->name);\n\t\t\treturn 1;\n\t\t}\n\t}\n\tDEBUGP(\"%s does not use %s!\\n\", a->name, b->name);\n\treturn 0;\n}\n\n/* Module a uses b */\nstatic int use_module(struct module *a, struct module *b)\n{\n\tstruct module_use *use;\n\tint no_warn;\n\n\tif (b == NULL || already_uses(a, b)) return 1;\n\n\tif (!strong_try_module_get(b))\n\t\treturn 0;\n\n\tDEBUGP(\"Allocating new usage for %s.\\n\", a->name);\n\tuse = kmalloc(sizeof(*use), GFP_ATOMIC);\n\tif (!use) {\n\t\tprintk(\"%s: out of memory loading\\n\", a->name);\n\t\tmodule_put(b);\n\t\treturn 0;\n\t}\n\n\tuse->module_which_uses = a;\n\tlist_add(&use->list, &b->modules_which_use_me);\n\tno_warn = sysfs_create_link(b->holders_dir, &a->mkobj.kobj, a->name);\n\treturn 1;\n}\n\n/* Clear the unload stuff of the module. */\nstatic void module_unload_free(struct module *mod)\n{\n\tstruct module *i;\n\n\tlist_for_each_entry(i, &modules, list) {\n\t\tstruct module_use *use;\n\n\t\tlist_for_each_entry(use, &i->modules_which_use_me, list) {\n\t\t\tif (use->module_which_uses == mod) {\n\t\t\t\tDEBUGP(\"%s unusing %s\\n\", mod->name, i->name);\n\t\t\t\tmodule_put(i);\n\t\t\t\tlist_del(&use->list);\n\t\t\t\tkfree(use);\n\t\t\t\tsysfs_remove_link(i->holders_dir, mod->name);\n\t\t\t\t/* There can be at most one match. */\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n}\n\n#ifdef CONFIG_MODULE_FORCE_UNLOAD\nstatic inline int try_force_unload(unsigned int flags)\n{\n\tint ret = (flags & O_TRUNC);\n\tif (ret)\n\t\tadd_taint(TAINT_FORCED_RMMOD);\n\treturn ret;\n}\n#else\nstatic inline int try_force_unload(unsigned int flags)\n{\n\treturn 0;\n}\n#endif /* CONFIG_MODULE_FORCE_UNLOAD */\n\nstruct stopref\n{\n\tstruct module *mod;\n\tint flags;\n\tint *forced;\n};\n\n/* Whole machine is stopped with interrupts off when this runs. */\nstatic int __try_stop_module(void *_sref)\n{\n\tstruct stopref *sref = _sref;\n\n\t/* If it's not unused, quit unless we are told to block. */\n\tif ((sref->flags & O_NONBLOCK) && module_refcount(sref->mod) != 0) {\n\t\tif (!(*sref->forced = try_force_unload(sref->flags)))\n\t\t\treturn -EWOULDBLOCK;\n\t}\n\n\t/* Mark it as dying. */\n\tsref->mod->state = MODULE_STATE_GOING;\n\treturn 0;\n}\n\nstatic int try_stop_module(struct module *mod, int flags, int *forced)\n{\n\tstruct stopref sref = { mod, flags, forced };\n\n\treturn stop_machine_run(__try_stop_module, &sref, NR_CPUS);\n}\n\nunsigned int module_refcount(struct module *mod)\n{\n\tunsigned int i, total = 0;\n\n\tfor (i = 0; i < NR_CPUS; i++)\n\t\ttotal += local_read(&mod->ref[i].count);\n\treturn total;\n}\nEXPORT_SYMBOL(module_refcount);\n\n/* This exists whether we can unload or not */\nstatic void free_module(struct module *mod);\n\nstatic void wait_for_zero_refcount(struct module *mod)\n{\n\t/* Since we might sleep for some time, drop the semaphore first */\n\tmutex_unlock(&module_mutex);\n\tfor (;;) {\n\t\tDEBUGP(\"Looking at refcount...\\n\");\n\t\tset_current_state(TASK_UNINTERRUPTIBLE);\n\t\tif (module_refcount(mod) == 0)\n\t\t\tbreak;\n\t\tschedule();\n\t}\n\tcurrent->state = TASK_RUNNING;\n\tmutex_lock(&module_mutex);\n}\n\nasmlinkage long\nsys_delete_module(const char __user *name_user, unsigned int flags)\n{\n\tstruct module *mod;\n\tchar name[MODULE_NAME_LEN];\n\tint ret, forced = 0;\n\n\tif (!capable(CAP_SYS_MODULE))\n\t\treturn -EPERM;\n\n\tif (strncpy_from_user(name, name_user, MODULE_NAME_LEN-1) < 0)\n\t\treturn -EFAULT;\n\tname[MODULE_NAME_LEN-1] = '\\0';\n\n\tif (mutex_lock_interruptible(&module_mutex) != 0)\n\t\treturn -EINTR;\n\n\tmod = find_module(name);\n\tif (!mod) {\n\t\tret = -ENOENT;\n\t\tgoto out;\n\t}\n\n\tif (!list_empty(&mod->modules_which_use_me)) {\n\t\t/* Other modules depend on us: get rid of them first. */\n\t\tret = -EWOULDBLOCK;\n\t\tgoto out;\n\t}\n\n\t/* Doing init or already dying? */\n\tif (mod->state != MODULE_STATE_LIVE) {\n\t\t/* FIXME: if (force), slam module count and wake up\n waiter --RR */\n\t\tDEBUGP(\"%s already dying\\n\", mod->name);\n\t\tret = -EBUSY;\n\t\tgoto out;\n\t}\n\n\t/* If it has an init func, it must have an exit func to unload */\n\tif ((mod->init != NULL && mod->exit == NULL)\n\t || mod->unsafe) {\n\t\tforced = try_force_unload(flags);\n\t\tif (!forced) {\n\t\t\t/* This module can't be removed */\n\t\t\tret = -EBUSY;\n\t\t\tgoto out;\n\t\t}\n\t}\n\n\t/* Set this up before setting mod->state */\n\tmod->waiter = current;\n\n\t/* Stop the machine so refcounts can't move and disable module. */\n\tret = try_stop_module(mod, flags, &forced);\n\tif (ret != 0)\n\t\tgoto out;\n\n\t/* Never wait if forced. */\n\tif (!forced && module_refcount(mod) != 0)\n\t\twait_for_zero_refcount(mod);\n\n\t/* Final destruction now noone is using it. */\n\tif (mod->exit != NULL) {\n\t\tmutex_unlock(&module_mutex);\n\t\tmod->exit();\n\t\tmutex_lock(&module_mutex);\n\t}\n\tfree_module(mod);\n\n out:\n\tmutex_unlock(&module_mutex);\n\treturn ret;\n}\n\nstatic void print_unload_info(struct seq_file *m, struct module *mod)\n{\n\tstruct module_use *use;\n\tint printed_something = 0;\n\n\tseq_printf(m, \" %u \", module_refcount(mod));\n\n\t/* Always include a trailing , so userspace can differentiate\n between this and the old multi-field proc format. */\n\tlist_for_each_entry(use, &mod->modules_which_use_me, list) {\n\t\tprinted_something = 1;\n\t\tseq_printf(m, \"%s,\", use->module_which_uses->name);\n\t}\n\n\tif (mod->unsafe) {\n\t\tprinted_something = 1;\n\t\tseq_printf(m, \"[unsafe],\");\n\t}\n\n\tif (mod->init != NULL && mod->exit == NULL) {\n\t\tprinted_something = 1;\n\t\tseq_printf(m, \"[permanent],\");\n\t}\n\n\tif (!printed_something)\n\t\tseq_printf(m, \"-\");\n}\n\nvoid __symbol_put(const char *symbol)\n{\n\tstruct module *owner;\n\tunsigned long flags;\n\tconst unsigned long *crc;\n\n\tspin_lock_irqsave(&modlist_lock, flags);\n\tif (!__find_symbol(symbol, &owner, &crc, 1))\n\t\tBUG();\n\tmodule_put(owner);\n\tspin_unlock_irqrestore(&modlist_lock, flags);\n}\nEXPORT_SYMBOL(__symbol_put);\n\nvoid symbol_put_addr(void *addr)\n{\n\tstruct module *modaddr;\n\n\tif (core_kernel_text((unsigned long)addr))\n\t\treturn;\n\n\tif (!(modaddr = module_text_address((unsigned long)addr)))\n\t\tBUG();\n\tmodule_put(modaddr);\n}\nEXPORT_SYMBOL_GPL(symbol_put_addr);\n\nstatic ssize_t show_refcnt(struct module_attribute *mattr,\n\t\t\t struct module *mod, char *buffer)\n{\n\t/* sysfs holds a reference */\n\treturn sprintf(buffer, \"%u\\n\", module_refcount(mod)-1);\n}\n\nstatic struct module_attribute refcnt = {\n\t.attr = { .name = \"refcnt\", .mode = 0444, .owner = THIS_MODULE },\n\t.show = show_refcnt,\n};\n\nvoid module_put(struct module *module)\n{\n\tif (module) {\n\t\tunsigned int cpu = get_cpu();\n\t\tlocal_dec(&module->ref[cpu].count);\n\t\t/* Maybe they're waiting for us to drop reference? */\n\t\tif (unlikely(!module_is_live(module)))\n\t\t\twake_up_process(module->waiter);\n\t\tput_cpu();\n\t}\n}\nEXPORT_SYMBOL(module_put);\n\n#else /* !CONFIG_MODULE_UNLOAD */\nstatic void print_unload_info(struct seq_file *m, struct module *mod)\n{\n\t/* We don't know the usage count, or what modules are using. */\n\tseq_printf(m, \" - -\");\n}\n\nstatic inline void module_unload_free(struct module *mod)\n{\n}\n\nstatic inline int use_module(struct module *a, struct module *b)\n{\n\treturn strong_try_module_get(b);\n}\n\nstatic inline void module_unload_init(struct module *mod)\n{\n}\n#endif /* CONFIG_MODULE_UNLOAD */\n\nstatic ssize_t show_initstate(struct module_attribute *mattr,\n\t\t\t struct module *mod, char *buffer)\n{\n\tconst char *state = \"unknown\";\n\n\tswitch (mod->state) {\n\tcase MODULE_STATE_LIVE:\n\t\tstate = \"live\";\n\t\tbreak;\n\tcase MODULE_STATE_COMING:\n\t\tstate = \"coming\";\n\t\tbreak;\n\tcase MODULE_STATE_GOING:\n\t\tstate = \"going\";\n\t\tbreak;\n\t}\n\treturn sprintf(buffer, \"%s\\n\", state);\n}\n\nstatic struct module_attribute initstate = {\n\t.attr = { .name = \"initstate\", .mode = 0444, .owner = THIS_MODULE },\n\t.show = show_initstate,\n};\n\nstatic struct module_attribute *modinfo_attrs[] = {\n\t&modinfo_version,\n\t&modinfo_srcversion,\n\t&initstate,\n#ifdef CONFIG_MODULE_UNLOAD\n\t&refcnt,\n#endif\n\tNULL,\n};\n\nstatic const char vermagic[] = VERMAGIC_STRING;\n\n#ifdef CONFIG_MODVERSIONS\nstatic int check_version(Elf_Shdr *sechdrs,\n\t\t\t unsigned int versindex,\n\t\t\t const char *symname,\n\t\t\t struct module *mod, \n\t\t\t const unsigned long *crc)\n{\n\tunsigned int i, num_versions;\n\tstruct modversion_info *versions;\n\n\t/* Exporting module didn't supply crcs? OK, we're already tainted. */\n\tif (!crc)\n\t\treturn 1;\n\n\tversions = (void *) sechdrs[versindex].sh_addr;\n\tnum_versions = sechdrs[versindex].sh_size\n\t\t/ sizeof(struct modversion_info);\n\n\tfor (i = 0; i < num_versions; i++) {\n\t\tif (strcmp(versions[i].name, symname) != 0)\n\t\t\tcontinue;\n\n\t\tif (versions[i].crc == *crc)\n\t\t\treturn 1;\n\t\tprintk(\"%s: disagrees about version of symbol %s\\n\",\n\t\t mod->name, symname);\n\t\tDEBUGP(\"Found checksum %lX vs module %lX\\n\",\n\t\t *crc, versions[i].crc);\n\t\treturn 0;\n\t}\n\t/* Not in module's version table. OK, but that taints the kernel. */\n\tif (!(tainted & TAINT_FORCED_MODULE))\n\t\tprintk(\"%s: no version for \\\"%s\\\" found: kernel tainted.\\n\",\n\t\t mod->name, symname);\n\tadd_taint_module(mod, TAINT_FORCED_MODULE);\n\treturn 1;\n}\n\nstatic inline int check_modstruct_version(Elf_Shdr *sechdrs,\n\t\t\t\t\t unsigned int versindex,\n\t\t\t\t\t struct module *mod)\n{\n\tconst unsigned long *crc;\n\tstruct module *owner;\n\n\tif (!__find_symbol(\"struct_module\", &owner, &crc, 1))\n\t\tBUG();\n\treturn check_version(sechdrs, versindex, \"struct_module\", mod,\n\t\t\t crc);\n}\n\n/* First part is kernel version, which we ignore. */\nstatic inline int same_magic(const char *amagic, const char *bmagic)\n{\n\tamagic += strcspn(amagic, \" \");\n\tbmagic += strcspn(bmagic, \" \");\n\treturn strcmp(amagic, bmagic) == 0;\n}\n#else\nstatic inline int check_version(Elf_Shdr *sechdrs,\n\t\t\t\tunsigned int versindex,\n\t\t\t\tconst char *symname,\n\t\t\t\tstruct module *mod, \n\t\t\t\tconst unsigned long *crc)\n{\n\treturn 1;\n}\n\nstatic inline int check_modstruct_version(Elf_Shdr *sechdrs,\n\t\t\t\t\t unsigned int versindex,\n\t\t\t\t\t struct module *mod)\n{\n\treturn 1;\n}\n\nstatic inline int same_magic(const char *amagic, const char *bmagic)\n{\n\treturn strcmp(amagic, bmagic) == 0;\n}\n#endif /* CONFIG_MODVERSIONS */\n\n/* Resolve a symbol for this module. I.e. if we find one, record usage.\n Must be holding module_mutex. */\nstatic unsigned long resolve_symbol(Elf_Shdr *sechdrs,\n\t\t\t\t unsigned int versindex,\n\t\t\t\t const char *name,\n\t\t\t\t struct module *mod)\n{\n\tstruct module *owner;\n\tunsigned long ret;\n\tconst unsigned long *crc;\n\n\tret = __find_symbol(name, &owner, &crc,\n\t\t\t!(mod->taints & TAINT_PROPRIETARY_MODULE));\n\tif (ret) {\n\t\t/* use_module can fail due to OOM, or module unloading */\n\t\tif (!check_version(sechdrs, versindex, name, mod, crc) ||\n\t\t !use_module(mod, owner))\n\t\t\tret = 0;\n\t}\n\treturn ret;\n}\n\n\n/*\n * /sys/module/foo/sections stuff\n * J. Corbet <corbet@lwn.net>\n */\n#ifdef CONFIG_KALLSYMS\nstatic ssize_t module_sect_show(struct module_attribute *mattr,\n\t\t\t\tstruct module *mod, char *buf)\n{\n\tstruct module_sect_attr *sattr =\n\t\tcontainer_of(mattr, struct module_sect_attr, mattr);\n\treturn sprintf(buf, \"0x%lx\\n\", sattr->address);\n}\n\nstatic void free_sect_attrs(struct module_sect_attrs *sect_attrs)\n{\n\tint section;\n\n\tfor (section = 0; section < sect_attrs->nsections; section++)\n\t\tkfree(sect_attrs->attrs[section].name);\n\tkfree(sect_attrs);\n}\n\nstatic void add_sect_attrs(struct module *mod, unsigned int nsect,\n\t\tchar *secstrings, Elf_Shdr *sechdrs)\n{\n\tunsigned int nloaded = 0, i, size[2];\n\tstruct module_sect_attrs *sect_attrs;\n\tstruct module_sect_attr *sattr;\n\tstruct attribute **gattr;\n\t\n\t/* Count loaded sections and allocate structures */\n\tfor (i = 0; i < nsect; i++)\n\t\tif (sechdrs[i].sh_flags & SHF_ALLOC)\n\t\t\tnloaded++;\n\tsize[0] = ALIGN(sizeof(*sect_attrs)\n\t\t\t+ nloaded * sizeof(sect_attrs->attrs[0]),\n\t\t\tsizeof(sect_attrs->grp.attrs[0]));\n\tsize[1] = (nloaded + 1) * sizeof(sect_attrs->grp.attrs[0]);\n\tsect_attrs = kzalloc(size[0] + size[1], GFP_KERNEL);\n\tif (sect_attrs == NULL)\n\t\treturn;\n\n\t/* Setup section attributes. */\n\tsect_attrs->grp.name = \"sections\";\n\tsect_attrs->grp.attrs = (void *)sect_attrs + size[0];\n\n\tsect_attrs->nsections = 0;\n\tsattr = &sect_attrs->attrs[0];\n\tgattr = &sect_attrs->grp.attrs[0];\n\tfor (i = 0; i < nsect; i++) {\n\t\tif (! (sechdrs[i].sh_flags & SHF_ALLOC))\n\t\t\tcontinue;\n\t\tsattr->address = sechdrs[i].sh_addr;\n\t\tsattr->name = kstrdup(secstrings + sechdrs[i].sh_name,\n\t\t\t\t\tGFP_KERNEL);\n\t\tif (sattr->name == NULL)\n\t\t\tgoto out;\n\t\tsect_attrs->nsections++;\n\t\tsattr->mattr.show = module_sect_show;\n\t\tsattr->mattr.store = NULL;\n\t\tsattr->mattr.attr.name = sattr->name;\n\t\tsattr->mattr.attr.owner = mod;\n\t\tsattr->mattr.attr.mode = S_IRUGO;\n\t\t*(gattr++) = &(sattr++)->mattr.attr;\n\t}\n\t*gattr = NULL;\n\n\tif (sysfs_create_group(&mod->mkobj.kobj, &sect_attrs->grp))\n\t\tgoto out;\n\n\tmod->sect_attrs = sect_attrs;\n\treturn;\n out:\n\tfree_sect_attrs(sect_attrs);\n}\n\nstatic void remove_sect_attrs(struct module *mod)\n{\n\tif (mod->sect_attrs) {\n\t\tsysfs_remove_group(&mod->mkobj.kobj,\n\t\t\t\t &mod->sect_attrs->grp);\n\t\t/* We are positive that no one is using any sect attrs\n\t\t * at this point. Deallocate immediately. */\n\t\tfree_sect_attrs(mod->sect_attrs);\n\t\tmod->sect_attrs = NULL;\n\t}\n}\n\n#else\n\nstatic inline void add_sect_attrs(struct module *mod, unsigned int nsect,\n\t\tchar *sectstrings, Elf_Shdr *sechdrs)\n{\n}\n\nstatic inline void remove_sect_attrs(struct module *mod)\n{\n}\n#endif /* CONFIG_KALLSYMS */\n\n#ifdef CONFIG_SYSFS\nint module_add_modinfo_attrs(struct module *mod)\n{\n\tstruct module_attribute *attr;\n\tstruct module_attribute *temp_attr;\n\tint error = 0;\n\tint i;\n\n\tmod->modinfo_attrs = kzalloc((sizeof(struct module_attribute) *\n\t\t\t\t\t(ARRAY_SIZE(modinfo_attrs) + 1)),\n\t\t\t\t\tGFP_KERNEL);\n\tif (!mod->modinfo_attrs)\n\t\treturn -ENOMEM;\n\n\ttemp_attr = mod->modinfo_attrs;\n\tfor (i = 0; (attr = modinfo_attrs[i]) && !error; i++) {\n\t\tif (!attr->test ||\n\t\t (attr->test && attr->test(mod))) {\n\t\t\tmemcpy(temp_attr, attr, sizeof(*temp_attr));\n\t\t\ttemp_attr->attr.owner = mod;\n\t\t\terror = sysfs_create_file(&mod->mkobj.kobj,&temp_attr->attr);\n\t\t\t++temp_attr;\n\t\t}\n\t}\n\treturn error;\n}\n\nvoid module_remove_modinfo_attrs(struct module *mod)\n{\n\tstruct module_attribute *attr;\n\tint i;\n\n\tfor (i = 0; (attr = &mod->modinfo_attrs[i]); i++) {\n\t\t/* pick a field to test for end of list */\n\t\tif (!attr->attr.name)\n\t\t\tbreak;\n\t\tsysfs_remove_file(&mod->mkobj.kobj,&attr->attr);\n\t\tif (attr->free)\n\t\t\tattr->free(mod);\n\t}\n\tkfree(mod->modinfo_attrs);\n}\n#endif\n\n#ifdef CONFIG_SYSFS\nint mod_sysfs_init(struct module *mod)\n{\n\tint err;\n\n\tif (!module_sysfs_initialized) {\n\t\tprintk(KERN_ERR \"%s: module sysfs not initialized\\n\",\n\t\t mod->name);\n\t\terr = -EINVAL;\n\t\tgoto out;\n\t}\n\tmemset(&mod->mkobj.kobj, 0, sizeof(mod->mkobj.kobj));\n\terr = kobject_set_name(&mod->mkobj.kobj, \"%s\", mod->name);\n\tif (err)\n\t\tgoto out;\n\tkobj_set_kset_s(&mod->mkobj, module_subsys);\n\tmod->mkobj.mod = mod;\n\n\tkobject_init(&mod->mkobj.kobj);\n\nout:\n\treturn err;\n}\n\nint mod_sysfs_setup(struct module *mod,\n\t\t\t struct kernel_param *kparam,\n\t\t\t unsigned int num_params)\n{\n\tint err;\n\n\t/* delay uevent until full sysfs population */\n\terr = kobject_add(&mod->mkobj.kobj);\n\tif (err)\n\t\tgoto out;\n\n\tmod->holders_dir = kobject_add_dir(&mod->mkobj.kobj, \"holders\");\n\tif (!mod->holders_dir) {\n\t\terr = -ENOMEM;\n\t\tgoto out_unreg;\n\t}\n\n\terr = module_param_sysfs_setup(mod, kparam, num_params);\n\tif (err)\n\t\tgoto out_unreg_holders;\n\n\terr = module_add_modinfo_attrs(mod);\n\tif (err)\n\t\tgoto out_unreg_param;\n\n\tkobject_uevent(&mod->mkobj.kobj, KOBJ_ADD);\n\treturn 0;\n\nout_unreg_param:\n\tmodule_param_sysfs_remove(mod);\nout_unreg_holders:\n\tkobject_unregister(mod->holders_dir);\nout_unreg:\n\tkobject_del(&mod->mkobj.kobj);\n\tkobject_put(&mod->mkobj.kobj);\nout:\n\treturn err;\n}\n#endif\n\nstatic void mod_kobject_remove(struct module *mod)\n{\n\tmodule_remove_modinfo_attrs(mod);\n\tmodule_param_sysfs_remove(mod);\n\tkobject_unregister(mod->mkobj.drivers_dir);\n\tkobject_unregister(mod->holders_dir);\n\tkobject_unregister(&mod->mkobj.kobj);\n}\n\n/*\n * unlink the module with the whole machine is stopped with interrupts off\n * - this defends against kallsyms not taking locks\n */\nstatic int __unlink_module(void *_mod)\n{\n\tstruct module *mod = _mod;\n\tlist_del(&mod->list);\n\treturn 0;\n}\n\n/* Free a module, remove from lists, etc (must hold module_mutex). */\nstatic void free_module(struct module *mod)\n{\n\t/* Delete from various lists */\n\tstop_machine_run(__unlink_module, mod, NR_CPUS);\n\tremove_sect_attrs(mod);\n\tmod_kobject_remove(mod);\n\n\tunwind_remove_table(mod->unwind_info, 0);\n\n\t/* Arch-specific cleanup. */\n\tmodule_arch_cleanup(mod);\n\n\t/* Module unload stuff */\n\tmodule_unload_free(mod);\n\n\t/* This may be NULL, but that's OK */\n\tmodule_free(mod, mod->module_init);\n\tkfree(mod->args);\n\tif (mod->percpu)\n\t\tpercpu_modfree(mod->percpu);\n\n\t/* Free lock-classes: */\n\tlockdep_free_key_range(mod->module_core, mod->core_size);\n\n\t/* Finally, free the core (containing the module structure) */\n\tmodule_free(mod, mod->module_core);\n}\n\nvoid *__symbol_get(const char *symbol)\n{\n\tstruct module *owner;\n\tunsigned long value, flags;\n\tconst unsigned long *crc;\n\n\tspin_lock_irqsave(&modlist_lock, flags);\n\tvalue = __find_symbol(symbol, &owner, &crc, 1);\n\tif (value && !strong_try_module_get(owner))\n\t\tvalue = 0;\n\tspin_unlock_irqrestore(&modlist_lock, flags);\n\n\treturn (void *)value;\n}\nEXPORT_SYMBOL_GPL(__symbol_get);\n\n/*\n * Ensure that an exported symbol [global namespace] does not already exist\n * in the kernel or in some other module's exported symbol table.\n */\nstatic int verify_export_symbols(struct module *mod)\n{\n\tconst char *name = NULL;\n\tunsigned long i, ret = 0;\n\tstruct module *owner;\n\tconst unsigned long *crc;\n\n\tfor (i = 0; i < mod->num_syms; i++)\n\t if (__find_symbol(mod->syms[i].name, &owner, &crc, 1)) {\n\t\t\tname = mod->syms[i].name;\n\t\t\tret = -ENOEXEC;\n\t\t\tgoto dup;\n\t\t}\n\n\tfor (i = 0; i < mod->num_gpl_syms; i++)\n\t if (__find_symbol(mod->gpl_syms[i].name, &owner, &crc, 1)) {\n\t\t\tname = mod->gpl_syms[i].name;\n\t\t\tret = -ENOEXEC;\n\t\t\tgoto dup;\n\t\t}\n\ndup:\n\tif (ret)\n\t\tprintk(KERN_ERR \"%s: exports duplicate symbol %s (owned by %s)\\n\",\n\t\t\tmod->name, name, module_name(owner));\n\n\treturn ret;\n}\n\n/* Change all symbols so that sh_value encodes the pointer directly. */\nstatic int simplify_symbols(Elf_Shdr *sechdrs,\n\t\t\t unsigned int symindex,\n\t\t\t const char *strtab,\n\t\t\t unsigned int versindex,\n\t\t\t unsigned int pcpuindex,\n\t\t\t struct module *mod)\n{\n\tElf_Sym *sym = (void *)sechdrs[symindex].sh_addr;\n\tunsigned long secbase;\n\tunsigned int i, n = sechdrs[symindex].sh_size / sizeof(Elf_Sym);\n\tint ret = 0;\n\n\tfor (i = 1; i < n; i++) {\n\t\tswitch (sym[i].st_shndx) {\n\t\tcase SHN_COMMON:\n\t\t\t/* We compiled with -fno-common. These are not\n\t\t\t supposed to happen. */\n\t\t\tDEBUGP(\"Common symbol: %s\\n\", strtab + sym[i].st_name);\n\t\t\tprintk(\"%s: please compile with -fno-common\\n\",\n\t\t\t mod->name);\n\t\t\tret = -ENOEXEC;\n\t\t\tbreak;\n\n\t\tcase SHN_ABS:\n\t\t\t/* Don't need to do anything */\n\t\t\tDEBUGP(\"Absolute symbol: 0x%08lx\\n\",\n\t\t\t (long)sym[i].st_value);\n\t\t\tbreak;\n\n\t\tcase SHN_UNDEF:\n\t\t\tsym[i].st_value\n\t\t\t = resolve_symbol(sechdrs, versindex,\n\t\t\t\t\t strtab + sym[i].st_name, mod);\n\n\t\t\t/* Ok if resolved. */\n\t\t\tif (sym[i].st_value != 0)\n\t\t\t\tbreak;\n\t\t\t/* Ok if weak. */\n\t\t\tif (ELF_ST_BIND(sym[i].st_info) == STB_WEAK)\n\t\t\t\tbreak;\n\n\t\t\tprintk(KERN_WARNING \"%s: Unknown symbol %s\\n\",\n\t\t\t mod->name, strtab + sym[i].st_name);\n\t\t\tret = -ENOENT;\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\t/* Divert to percpu allocation if a percpu var. */\n\t\t\tif (sym[i].st_shndx == pcpuindex)\n\t\t\t\tsecbase = (unsigned long)mod->percpu;\n\t\t\telse\n\t\t\t\tsecbase = sechdrs[sym[i].st_shndx].sh_addr;\n\t\t\tsym[i].st_value += secbase;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\treturn ret;\n}\n\n/* Update size with this section: return offset. */\nstatic long get_offset(unsigned long *size, Elf_Shdr *sechdr)\n{\n\tlong ret;\n\n\tret = ALIGN(*size, sechdr->sh_addralign ?: 1);\n\t*size = ret + sechdr->sh_size;\n\treturn ret;\n}\n\n/* Lay out the SHF_ALLOC sections in a way not dissimilar to how ld\n might -- code, read-only data, read-write data, small data. Tally\n sizes, and place the offsets into sh_entsize fields: high bit means it\n belongs in init. */\nstatic void layout_sections(struct module *mod,\n\t\t\t const Elf_Ehdr *hdr,\n\t\t\t Elf_Shdr *sechdrs,\n\t\t\t const char *secstrings)\n{\n\tstatic unsigned long const masks[][2] = {\n\t\t/* NOTE: all executable code must be the first section\n\t\t * in this array; otherwise modify the text_size\n\t\t * finder in the two loops below */\n\t\t{ SHF_EXECINSTR | SHF_ALLOC, ARCH_SHF_SMALL },\n\t\t{ SHF_ALLOC, SHF_WRITE | ARCH_SHF_SMALL },\n\t\t{ SHF_WRITE | SHF_ALLOC, ARCH_SHF_SMALL },\n\t\t{ ARCH_SHF_SMALL | SHF_ALLOC, 0 }\n\t};\n\tunsigned int m, i;\n\n\tfor (i = 0; i < hdr->e_shnum; i++)\n\t\tsechdrs[i].sh_entsize = ~0UL;\n\n\tDEBUGP(\"Core section allocation order:\\n\");\n\tfor (m = 0; m < ARRAY_SIZE(masks); ++m) {\n\t\tfor (i = 0; i < hdr->e_shnum; ++i) {\n\t\t\tElf_Shdr *s = &sechdrs[i];\n\n\t\t\tif ((s->sh_flags & masks[m][0]) != masks[m][0]\n\t\t\t || (s->sh_flags & masks[m][1])\n\t\t\t || s->sh_entsize != ~0UL\n\t\t\t || strncmp(secstrings + s->sh_name,\n\t\t\t\t \".init\", 5) == 0)\n\t\t\t\tcontinue;\n\t\t\ts->sh_entsize = get_offset(&mod->core_size, s);\n\t\t\tDEBUGP(\"\\t%s\\n\", secstrings + s->sh_name);\n\t\t}\n\t\tif (m == 0)\n\t\t\tmod->core_text_size = mod->core_size;\n\t}\n\n\tDEBUGP(\"Init section allocation order:\\n\");\n\tfor (m = 0; m < ARRAY_SIZE(masks); ++m) {\n\t\tfor (i = 0; i < hdr->e_shnum; ++i) {\n\t\t\tElf_Shdr *s = &sechdrs[i];\n\n\t\t\tif ((s->sh_flags & masks[m][0]) != masks[m][0]\n\t\t\t || (s->sh_flags & masks[m][1])\n\t\t\t || s->sh_entsize != ~0UL\n\t\t\t || strncmp(secstrings + s->sh_name,\n\t\t\t\t \".init\", 5) != 0)\n\t\t\t\tcontinue;\n\t\t\ts->sh_entsize = (get_offset(&mod->init_size, s)\n\t\t\t\t\t | INIT_OFFSET_MASK);\n\t\t\tDEBUGP(\"\\t%s\\n\", secstrings + s->sh_name);\n\t\t}\n\t\tif (m == 0)\n\t\t\tmod->init_text_size = mod->init_size;\n\t}\n}\n\nstatic void set_license(struct module *mod, const char *license)\n{\n\tif (!license)\n\t\tlicense = \"unspecified\";\n\n\tif (!license_is_gpl_compatible(license)) {\n\t\tif (!(tainted & TAINT_PROPRIETARY_MODULE))\n\t\t\tprintk(KERN_WARNING \"%s: module license '%s' taints \"\n\t\t\t\t\"kernel.\\n\", mod->name, license);\n\t\tadd_taint_module(mod, TAINT_PROPRIETARY_MODULE);\n\t}\n}\n\n/* Parse tag=value strings from .modinfo section */\nstatic char *next_string(char *string, unsigned long *secsize)\n{\n\t/* Skip non-zero chars */\n\twhile (string[0]) {\n\t\tstring++;\n\t\tif ((*secsize)-- <= 1)\n\t\t\treturn NULL;\n\t}\n\n\t/* Skip any zero padding. */\n\twhile (!string[0]) {\n\t\tstring++;\n\t\tif ((*secsize)-- <= 1)\n\t\t\treturn NULL;\n\t}\n\treturn string;\n}\n\nstatic char *get_modinfo(Elf_Shdr *sechdrs,\n\t\t\t unsigned int info,\n\t\t\t const char *tag)\n{\n\tchar *p;\n\tunsigned int taglen = strlen(tag);\n\tunsigned long size = sechdrs[info].sh_size;\n\n\tfor (p = (char *)sechdrs[info].sh_addr; p; p = next_string(p, &size)) {\n\t\tif (strncmp(p, tag, taglen) == 0 && p[taglen] == '=')\n\t\t\treturn p + taglen + 1;\n\t}\n\treturn NULL;\n}\n\nstatic void setup_modinfo(struct module *mod, Elf_Shdr *sechdrs,\n\t\t\t unsigned int infoindex)\n{\n\tstruct module_attribute *attr;\n\tint i;\n\n\tfor (i = 0; (attr = modinfo_attrs[i]); i++) {\n\t\tif (attr->setup)\n\t\t\tattr->setup(mod,\n\t\t\t\t get_modinfo(sechdrs,\n\t\t\t\t\t\tinfoindex,\n\t\t\t\t\t\tattr->attr.name));\n\t}\n}\n\n#ifdef CONFIG_KALLSYMS\nstatic int is_exported(const char *name, const struct module *mod)\n{\n\tif (!mod && lookup_symbol(name, __start___ksymtab, __stop___ksymtab))\n\t\treturn 1;\n\telse\n\t\tif (mod && lookup_symbol(name, mod->syms, mod->syms + mod->num_syms))\n\t\t\treturn 1;\n\t\telse\n\t\t\treturn 0;\n}\n\n/* As per nm */\nstatic char elf_type(const Elf_Sym *sym,\n\t\t Elf_Shdr *sechdrs,\n\t\t const char *secstrings,\n\t\t struct module *mod)\n{\n\tif (ELF_ST_BIND(sym->st_info) == STB_WEAK) {\n\t\tif (ELF_ST_TYPE(sym->st_info) == STT_OBJECT)\n\t\t\treturn 'v';\n\t\telse\n\t\t\treturn 'w';\n\t}\n\tif (sym->st_shndx == SHN_UNDEF)\n\t\treturn 'U';\n\tif (sym->st_shndx == SHN_ABS)\n\t\treturn 'a';\n\tif (sym->st_shndx >= SHN_LORESERVE)\n\t\treturn '?';\n\tif (sechdrs[sym->st_shndx].sh_flags & SHF_EXECINSTR)\n\t\treturn 't';\n\tif (sechdrs[sym->st_shndx].sh_flags & SHF_ALLOC\n\t && sechdrs[sym->st_shndx].sh_type != SHT_NOBITS) {\n\t\tif (!(sechdrs[sym->st_shndx].sh_flags & SHF_WRITE))\n\t\t\treturn 'r';\n\t\telse if (sechdrs[sym->st_shndx].sh_flags & ARCH_SHF_SMALL)\n\t\t\treturn 'g';\n\t\telse\n\t\t\treturn 'd';\n\t}\n\tif (sechdrs[sym->st_shndx].sh_type == SHT_NOBITS) {\n\t\tif (sechdrs[sym->st_shndx].sh_flags & ARCH_SHF_SMALL)\n\t\t\treturn 's';\n\t\telse\n\t\t\treturn 'b';\n\t}\n\tif (strncmp(secstrings + sechdrs[sym->st_shndx].sh_name,\n\t\t \".debug\", strlen(\".debug\")) == 0)\n\t\treturn 'n';\n\treturn '?';\n}\n\nstatic void add_kallsyms(struct module *mod,\n\t\t\t Elf_Shdr *sechdrs,\n\t\t\t unsigned int symindex,\n\t\t\t unsigned int strindex,\n\t\t\t const char *secstrings)\n{\n\tunsigned int i;\n\n\tmod->symtab = (void *)sechdrs[symindex].sh_addr;\n\tmod->num_symtab = sechdrs[symindex].sh_size / sizeof(Elf_Sym);\n\tmod->strtab = (void *)sechdrs[strindex].sh_addr;\n\n\t/* Set types up while we still have access to sections. */\n\tfor (i = 0; i < mod->num_symtab; i++)\n\t\tmod->symtab[i].st_info\n\t\t\t= elf_type(&mod->symtab[i], sechdrs, secstrings, mod);\n}\n#else\nstatic inline void add_kallsyms(struct module *mod,\n\t\t\t\tElf_Shdr *sechdrs,\n\t\t\t\tunsigned int symindex,\n\t\t\t\tunsigned int strindex,\n\t\t\t\tconst char *secstrings)\n{\n}\n#endif /* CONFIG_KALLSYMS */\n\n/* Allocate and load the module: note that size of section 0 is always\n zero, and we rely on this for optional sections. */\nstatic struct module *load_module(void __user *umod,\n\t\t\t\t unsigned long len,\n\t\t\t\t const char __user *uargs)\n{\n\tElf_Ehdr *hdr;\n\tElf_Shdr *sechdrs;\n\tchar *secstrings, *args, *modmagic, *strtab = NULL, *supported;\n\tunsigned int i;\n\tunsigned int symindex = 0;\n\tunsigned int strindex = 0;\n\tunsigned int setupindex;\n\tunsigned int exindex;\n\tunsigned int exportindex;\n\tunsigned int modindex;\n\tunsigned int obsparmindex;\n\tunsigned int infoindex;\n\tunsigned int gplindex;\n\tunsigned int crcindex;\n\tunsigned int gplcrcindex;\n\tunsigned int versindex;\n\tunsigned int pcpuindex;\n\tunsigned int gplfutureindex;\n\tunsigned int gplfuturecrcindex;\n\tunsigned int unwindex = 0;\n\tunsigned int unusedindex;\n\tunsigned int unusedcrcindex;\n\tunsigned int unusedgplindex;\n\tunsigned int unusedgplcrcindex;\n\tstruct module *mod;\n\tlong err = 0;\n\tvoid *percpu = NULL, *ptr = NULL; /* Stops spurious gcc warning */\n\tstruct exception_table_entry *extable;\n\tmm_segment_t old_fs;\n\n\tDEBUGP(\"load_module: umod=%p, len=%lu, uargs=%p\\n\",\n\t umod, len, uargs);\n\tif (len < sizeof(*hdr))\n\t\treturn ERR_PTR(-ENOEXEC);\n\n\t/* Suck in entire file: we'll want most of it. */\n\t/* vmalloc barfs on \"unusual\" numbers. Check here */\n\tif (len > 64 * 1024 * 1024 || (hdr = vmalloc(len)) == NULL)\n\t\treturn ERR_PTR(-ENOMEM);\n\tif (copy_from_user(hdr, umod, len) != 0) {\n\t\terr = -EFAULT;\n\t\tgoto free_hdr;\n\t}\n\n\t/* Sanity checks against insmoding binaries or wrong arch,\n weird elf version */\n\tif (memcmp(hdr->e_ident, ELFMAG, 4) != 0\n\t || hdr->e_type != ET_REL\n\t || !elf_check_arch(hdr)\n\t || hdr->e_shentsize != sizeof(*sechdrs)) {\n\t\terr = -ENOEXEC;\n\t\tgoto free_hdr;\n\t}\n\n\tif (len < hdr->e_shoff + hdr->e_shnum * sizeof(Elf_Shdr))\n\t\tgoto truncated;\n\n\t/* Convenience variables */\n\tsechdrs = (void *)hdr + hdr->e_shoff;\n\tsecstrings = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset;\n\tsechdrs[0].sh_addr = 0;\n\n\tfor (i = 1; i < hdr->e_shnum; i++) {\n\t\tif (sechdrs[i].sh_type != SHT_NOBITS\n\t\t && len < sechdrs[i].sh_offset + sechdrs[i].sh_size)\n\t\t\tgoto truncated;\n\n\t\t/* Mark all sections sh_addr with their address in the\n\t\t temporary image. */\n\t\tsechdrs[i].sh_addr = (size_t)hdr + sechdrs[i].sh_offset;\n\n\t\t/* Internal symbols and strings. */\n\t\tif (sechdrs[i].sh_type == SHT_SYMTAB) {\n\t\t\tsymindex = i;\n\t\t\tstrindex = sechdrs[i].sh_link;\n\t\t\tstrtab = (char *)hdr + sechdrs[strindex].sh_offset;\n\t\t}\n#ifndef CONFIG_MODULE_UNLOAD\n\t\t/* Don't load .exit sections */\n\t\tif (strncmp(secstrings+sechdrs[i].sh_name, \".exit\", 5) == 0)\n\t\t\tsechdrs[i].sh_flags &= ~(unsigned long)SHF_ALLOC;\n#endif\n\t}\n\n\tmodindex = find_sec(hdr, sechdrs, secstrings,\n\t\t\t \".gnu.linkonce.this_module\");\n\tif (!modindex) {\n\t\tprintk(KERN_WARNING \"No module found in object\\n\");\n\t\terr = -ENOEXEC;\n\t\tgoto free_hdr;\n\t}\n\tmod = (void *)sechdrs[modindex].sh_addr;\n\n\tif (symindex == 0) {\n\t\tprintk(KERN_WARNING \"%s: module has no symbols (stripped?)\\n\",\n\t\t mod->name);\n\t\terr = -ENOEXEC;\n\t\tgoto free_hdr;\n\t}\n\n\t/* Optional sections */\n\texportindex = find_sec(hdr, sechdrs, secstrings, \"__ksymtab\");\n\tgplindex = find_sec(hdr, sechdrs, secstrings, \"__ksymtab_gpl\");\n\tgplfutureindex = find_sec(hdr, sechdrs, secstrings, \"__ksymtab_gpl_future\");\n\tunusedindex = find_sec(hdr, sechdrs, secstrings, \"__ksymtab_unused\");\n\tunusedgplindex = find_sec(hdr, sechdrs, secstrings, \"__ksymtab_unused_gpl\");\n\tcrcindex = find_sec(hdr, sechdrs, secstrings, \"__kcrctab\");\n\tgplcrcindex = find_sec(hdr, sechdrs, secstrings, \"__kcrctab_gpl\");\n\tgplfuturecrcindex = find_sec(hdr, sechdrs, secstrings, \"__kcrctab_gpl_future\");\n\tunusedcrcindex = find_sec(hdr, sechdrs, secstrings, \"__kcrctab_unused\");\n\tunusedgplcrcindex = find_sec(hdr, sechdrs, secstrings, \"__kcrctab_unused_gpl\");\n\tsetupindex = find_sec(hdr, sechdrs, secstrings, \"__param\");\n\texindex = find_sec(hdr, sechdrs, secstrings, \"__ex_table\");\n\tobsparmindex = find_sec(hdr, sechdrs, secstrings, \"__obsparm\");\n\tversindex = find_sec(hdr, sechdrs, secstrings, \"__versions\");\n\tinfoindex = find_sec(hdr, sechdrs, secstrings, \".modinfo\");\n\tpcpuindex = find_pcpusec(hdr, sechdrs, secstrings);\n#ifdef ARCH_UNWIND_SECTION_NAME\n\tunwindex = find_sec(hdr, sechdrs, secstrings, ARCH_UNWIND_SECTION_NAME);\n#endif\n\n\t/* Don't keep modinfo section */\n\tsechdrs[infoindex].sh_flags &= ~(unsigned long)SHF_ALLOC;\n#ifdef CONFIG_KALLSYMS\n\t/* Keep symbol and string tables for decoding later. */\n\tsechdrs[symindex].sh_flags |= SHF_ALLOC;\n\tsechdrs[strindex].sh_flags |= SHF_ALLOC;\n#endif\n\tif (unwindex)\n\t\tsechdrs[unwindex].sh_flags |= SHF_ALLOC;\n\n\t/* Check module struct version now, before we try to use module. */\n\tif (!check_modstruct_version(sechdrs, versindex, mod)) {\n\t\terr = -ENOEXEC;\n\t\tgoto free_hdr;\n\t}\n\n\tmodmagic = get_modinfo(sechdrs, infoindex, \"vermagic\");\n\t/* This is allowed: modprobe --force will invalidate it. */\n\tif (!modmagic) {\n\t\tadd_taint_module(mod, TAINT_FORCED_MODULE);\n\t\tprintk(KERN_WARNING \"%s: no version magic, tainting kernel.\\n\",\n\t\t mod->name);\n\t} else if (!same_magic(modmagic, vermagic)) {\n\t\tprintk(KERN_ERR \"%s: version magic '%s' should be '%s'\\n\",\n\t\t mod->name, modmagic, vermagic);\n\t\terr = -ENOEXEC;\n\t\tgoto free_hdr;\n\t}\n\n\tsupported = get_modinfo(sechdrs, infoindex, \"supported\");\n\tif (supported) {\n\t\tif (!strcmp(supported, \"external\"))\n\t\t\ttainted |= TAINT_EXTERNAL_SUPPORT;\n\t\telse if (strcmp(supported, \"yes\"))\n\t\t\tsupported = NULL;\n\t}\n\tif (!supported) {\n\t\tif (unsupported == 0) {\n\t\t\tprintk(KERN_WARNING \"%s: module not supported by \"\n\t\t\t \"Novell, refusing to load. To override, echo \"\n\t\t\t \"1 > /proc/sys/kernel/unsupported\\n\", mod->name);\n\t\t\terr = -ENOEXEC;\n\t\t\tgoto free_hdr;\n\t\t}\n\t\ttainted |= TAINT_NO_SUPPORT;\n\t\tif (unsupported == 1) {\n\t\t\tprintk(KERN_WARNING \"%s: module not supported by \"\n\t\t\t \"Novell, setting U taint flag.\\n\", mod->name);\n\t\t}\n\t}\n\n\t/* Now copy in args */\n\targs = strndup_user(uargs, ~0UL >> 1);\n\tif (IS_ERR(args)) {\n\t\terr = PTR_ERR(args);\n\t\tgoto free_hdr;\n\t}\n\n\tif (find_module(mod->name)) {\n\t\terr = -EEXIST;\n\t\tgoto free_mod;\n\t}\n\n\tmod->state = MODULE_STATE_COMING;\n\n\t/* Allow arches to frob section contents and sizes. */\n\terr = module_frob_arch_sections(hdr, sechdrs, secstrings, mod);\n\tif (err < 0)\n\t\tgoto free_mod;\n\n\tif (pcpuindex) {\n\t\t/* We have a special allocation for this section. */\n\t\tpercpu = percpu_modalloc(sechdrs[pcpuindex].sh_size,\n\t\t\t\t\t sechdrs[pcpuindex].sh_addralign,\n\t\t\t\t\t mod->name);\n\t\tif (!percpu) {\n\t\t\terr = -ENOMEM;\n\t\t\tgoto free_mod;\n\t\t}\n\t\tsechdrs[pcpuindex].sh_flags &= ~(unsigned long)SHF_ALLOC;\n\t\tmod->percpu = percpu;\n\t}\n\n\t/* Determine total sizes, and put offsets in sh_entsize. For now\n\t this is done generically; there doesn't appear to be any\n\t special cases for the architectures. */\n\tlayout_sections(mod, hdr, sechdrs, secstrings);\n\n\t/* Do the allocs. */\n\tptr = module_alloc(mod->core_size);\n\tif (!ptr) {\n\t\terr = -ENOMEM;\n\t\tgoto free_percpu;\n\t}\n\tmemset(ptr, 0, mod->core_size);\n\tmod->module_core = ptr;\n\n\tptr = module_alloc(mod->init_size);\n\tif (!ptr && mod->init_size) {\n\t\terr = -ENOMEM;\n\t\tgoto free_core;\n\t}\n\tmemset(ptr, 0, mod->init_size);\n\tmod->module_init = ptr;\n\n\t/* Transfer each section which specifies SHF_ALLOC */\n\tDEBUGP(\"final section addresses:\\n\");\n\tfor (i = 0; i < hdr->e_shnum; i++) {\n\t\tvoid *dest;\n\n\t\tif (!(sechdrs[i].sh_flags & SHF_ALLOC))\n\t\t\tcontinue;\n\n\t\tif (sechdrs[i].sh_entsize & INIT_OFFSET_MASK)\n\t\t\tdest = mod->module_init\n\t\t\t\t+ (sechdrs[i].sh_entsize & ~INIT_OFFSET_MASK);\n\t\telse\n\t\t\tdest = mod->module_core + sechdrs[i].sh_entsize;\n\n\t\tif (sechdrs[i].sh_type != SHT_NOBITS)\n\t\t\tmemcpy(dest, (void *)sechdrs[i].sh_addr,\n\t\t\t sechdrs[i].sh_size);\n\t\t/* Update sh_addr to point to copy in image. */\n\t\tsechdrs[i].sh_addr = (unsigned long)dest;\n\t\tDEBUGP(\"\\t0x%lx %s\\n\", sechdrs[i].sh_addr, secstrings + sechdrs[i].sh_name);\n\t}\n\t/* Module has been moved. */\n\tmod = (void *)sechdrs[modindex].sh_addr;\n\n\t/* Now we've moved module, initialize linked lists, etc. */\n\tmodule_unload_init(mod);\n\n\t/* Initialize kobject, so we can reference it. */\n\tif (mod_sysfs_init(mod) != 0)\n\t\tgoto cleanup;\n\n\t/* Set up license info based on the info section */\n\tset_license(mod, get_modinfo(sechdrs, infoindex, \"license\"));\n\n\tif (strcmp(mod->name, \"ndiswrapper\") == 0)\n\t\tadd_taint(TAINT_PROPRIETARY_MODULE);\n\tif (strcmp(mod->name, \"driverloader\") == 0)\n\t\tadd_taint_module(mod, TAINT_PROPRIETARY_MODULE);\n\n\t/* Set up MODINFO_ATTR fields */\n\tsetup_modinfo(mod, sechdrs, infoindex);\n\n\t/* Fix up syms, so that st_value is a pointer to location. */\n\terr = simplify_symbols(sechdrs, symindex, strtab, versindex, pcpuindex,\n\t\t\t mod);\n\tif (err < 0)\n\t\tgoto cleanup;\n\n\t/* Set up EXPORTed & EXPORT_GPLed symbols (section 0 is 0 length) */\n\tmod->num_syms = sechdrs[exportindex].sh_size / sizeof(*mod->syms);\n\tmod->syms = (void *)sechdrs[exportindex].sh_addr;\n\tif (crcindex)\n\t\tmod->crcs = (void *)sechdrs[crcindex].sh_addr;\n\tmod->num_gpl_syms = sechdrs[gplindex].sh_size / sizeof(*mod->gpl_syms);\n\tmod->gpl_syms = (void *)sechdrs[gplindex].sh_addr;\n\tif (gplcrcindex)\n\t\tmod->gpl_crcs = (void *)sechdrs[gplcrcindex].sh_addr;\n\tmod->num_gpl_future_syms = sechdrs[gplfutureindex].sh_size /\n\t\t\t\t\tsizeof(*mod->gpl_future_syms);\n\tmod->num_unused_syms = sechdrs[unusedindex].sh_size /\n\t\t\t\t\tsizeof(*mod->unused_syms);\n\tmod->num_unused_gpl_syms = sechdrs[unusedgplindex].sh_size /\n\t\t\t\t\tsizeof(*mod->unused_gpl_syms);\n\tmod->gpl_future_syms = (void *)sechdrs[gplfutureindex].sh_addr;\n\tif (gplfuturecrcindex)\n\t\tmod->gpl_future_crcs = (void *)sechdrs[gplfuturecrcindex].sh_addr;\n\n\tmod->unused_syms = (void *)sechdrs[unusedindex].sh_addr;\n\tif (unusedcrcindex)\n\t\tmod->unused_crcs = (void *)sechdrs[unusedcrcindex].sh_addr;\n\tmod->unused_gpl_syms = (void *)sechdrs[unusedgplindex].sh_addr;\n\tif (unusedgplcrcindex)\n\t\tmod->unused_crcs = (void *)sechdrs[unusedgplcrcindex].sh_addr;\n\n#ifdef CONFIG_MODVERSIONS\n\tif ((mod->num_syms && !crcindex) || \n\t (mod->num_gpl_syms && !gplcrcindex) ||\n\t (mod->num_gpl_future_syms && !gplfuturecrcindex) ||\n\t (mod->num_unused_syms && !unusedcrcindex) ||\n\t (mod->num_unused_gpl_syms && !unusedgplcrcindex)) {\n\t\tprintk(KERN_WARNING \"%s: No versions for exported symbols.\"\n\t\t \" Tainting kernel.\\n\", mod->name);\n\t\tadd_taint_module(mod, TAINT_FORCED_MODULE);\n\t}\n#endif\n\n\t/* Now do relocations. */\n\tfor (i = 1; i < hdr->e_shnum; i++) {\n\t\tconst char *strtab = (char *)sechdrs[strindex].sh_addr;\n\t\tunsigned int info = sechdrs[i].sh_info;\n\n\t\t/* Not a valid relocation section? */\n\t\tif (info >= hdr->e_shnum)\n\t\t\tcontinue;\n\n\t\t/* Don't bother with non-allocated sections */\n\t\tif (!(sechdrs[info].sh_flags & SHF_ALLOC))\n\t\t\tcontinue;\n\n\t\tif (sechdrs[i].sh_type == SHT_REL)\n\t\t\terr = apply_relocate(sechdrs, strtab, symindex, i,mod);\n\t\telse if (sechdrs[i].sh_type == SHT_RELA)\n\t\t\terr = apply_relocate_add(sechdrs, strtab, symindex, i,\n\t\t\t\t\t\t mod);\n\t\tif (err < 0)\n\t\t\tgoto cleanup;\n\t}\n\n /* Find duplicate symbols */\n\terr = verify_export_symbols(mod);\n\n\tif (err < 0)\n\t\tgoto cleanup;\n\n \t/* Set up and sort exception table */\n\tmod->num_exentries = sechdrs[exindex].sh_size / sizeof(*mod->extable);\n\tmod->extable = extable = (void *)sechdrs[exindex].sh_addr;\n\tsort_extable(extable, extable + mod->num_exentries);\n\n\t/* Finally, copy percpu area over. */\n\tpercpu_modcopy(mod->percpu, (void *)sechdrs[pcpuindex].sh_addr,\n\t\t sechdrs[pcpuindex].sh_size);\n\n\tadd_kallsyms(mod, sechdrs, symindex, strindex, secstrings);\n\n\terr = module_finalize(hdr, sechdrs, mod);\n\tif (err < 0)\n\t\tgoto cleanup;\n\n\t/* flush the icache in correct context */\n\told_fs = get_fs();\n\tset_fs(KERNEL_DS);\n\n\t/*\n\t * Flush the instruction cache, since we've played with text.\n\t * Do it before processing of module parameters, so the module\n\t * can provide parameter accessor functions of its own.\n\t */\n\tif (mod->module_init)\n\t\tflush_icache_range((unsigned long)mod->module_init,\n\t\t\t\t (unsigned long)mod->module_init\n\t\t\t\t + mod->init_size);\n\tflush_icache_range((unsigned long)mod->module_core,\n\t\t\t (unsigned long)mod->module_core + mod->core_size);\n\n\tset_fs(old_fs);\n\n\tmod->args = args;\n\tif (obsparmindex)\n\t\tprintk(KERN_WARNING \"%s: Ignoring obsolete parameters\\n\",\n\t\t mod->name);\n\n\t/* Size of section 0 is 0, so this works well if no params */\n\terr = parse_args(mod->name, mod->args,\n\t\t\t (struct kernel_param *)\n\t\t\t sechdrs[setupindex].sh_addr,\n\t\t\t sechdrs[setupindex].sh_size\n\t\t\t / sizeof(struct kernel_param),\n\t\t\t NULL);\n\tif (err < 0)\n\t\tgoto arch_cleanup;\n\n\terr = mod_sysfs_setup(mod, \n\t\t\t (struct kernel_param *)\n\t\t\t sechdrs[setupindex].sh_addr,\n\t\t\t sechdrs[setupindex].sh_size\n\t\t\t / sizeof(struct kernel_param));\n\tif (err < 0)\n\t\tgoto arch_cleanup;\n\tadd_sect_attrs(mod, hdr->e_shnum, secstrings, sechdrs);\n\n\t/* Size of section 0 is 0, so this works well if no unwind info. */\n\tmod->unwind_info = unwind_add_table(mod,\n\t (void *)sechdrs[unwindex].sh_addr,\n\t sechdrs[unwindex].sh_size);\n\n\t/* Get rid of temporary copy */\n\tvfree(hdr);\n\n\t/* Done! */\n\treturn mod;\n\n arch_cleanup:\n\tmodule_arch_cleanup(mod);\n cleanup:\n\tmodule_unload_free(mod);\n\tmodule_free(mod, mod->module_init);\n free_core:\n\tmodule_free(mod, mod->module_core);\n free_percpu:\n\tif (percpu)\n\t\tpercpu_modfree(percpu);\n free_mod:\n\tkfree(args);\n free_hdr:\n\tvfree(hdr);\n\treturn ERR_PTR(err);\n\n truncated:\n\tprintk(KERN_ERR \"Module len %lu truncated\\n\", len);\n\terr = -ENOEXEC;\n\tgoto free_hdr;\n}\n\n/*\n * link the module with the whole machine is stopped with interrupts off\n * - this defends against kallsyms not taking locks\n */\nstatic int __link_module(void *_mod)\n{\n\tstruct module *mod = _mod;\n\tlist_add(&mod->list, &modules);\n\treturn 0;\n}\n\n/* This is where the real work happens */\nasmlinkage long\nsys_init_module(void __user *umod,\n\t\tunsigned long len,\n\t\tconst char __user *uargs)\n{\n\tstruct module *mod;\n\tint ret = 0;\n\n\t/* Must have permission */\n\tif (!capable(CAP_SYS_MODULE))\n\t\treturn -EPERM;\n\n\t/* Only one module load at a time, please */\n\tif (mutex_lock_interruptible(&module_mutex) != 0)\n\t\treturn -EINTR;\n\n\t/* Do all the hard work */\n\tmod = load_module(umod, len, uargs);\n\tif (IS_ERR(mod)) {\n\t\tmutex_unlock(&module_mutex);\n\t\treturn PTR_ERR(mod);\n\t}\n\n\t/* Now sew it into the lists. They won't access us, since\n strong_try_module_get() will fail. */\n\tstop_machine_run(__link_module, mod, NR_CPUS);\n\n\t/* Drop lock so they can recurse */\n\tmutex_unlock(&module_mutex);\n\n\tblocking_notifier_call_chain(&module_notify_list,\n\t\t\tMODULE_STATE_COMING, mod);\n\n\t/* Start the module */\n\tif (mod->init != NULL)\n\t\tret = mod->init();\n\tif (ret < 0) {\n\t\t/* Init routine failed: abort. Try to protect us from\n buggy refcounters. */\n\t\tmod->state = MODULE_STATE_GOING;\n\t\tsynchronize_sched();\n\t\tif (mod->unsafe)\n\t\t\tprintk(KERN_ERR \"%s: module is now stuck!\\n\",\n\t\t\t mod->name);\n\t\telse {\n\t\t\tmodule_put(mod);\n\t\t\tmutex_lock(&module_mutex);\n\t\t\tfree_module(mod);\n\t\t\tmutex_unlock(&module_mutex);\n\t\t}\n\t\treturn ret;\n\t}\n\n\t/* Now it's a first class citizen! */\n\tmutex_lock(&module_mutex);\n\tmod->state = MODULE_STATE_LIVE;\n\t/* Drop initial reference. */\n\tmodule_put(mod);\n\tunwind_remove_table(mod->unwind_info, 1);\n\tmodule_free(mod, mod->module_init);\n\tmod->module_init = NULL;\n\tmod->init_size = 0;\n\tmod->init_text_size = 0;\n\tmutex_unlock(&module_mutex);\n\n\treturn 0;\n}\n\nstatic inline int within(unsigned long addr, void *start, unsigned long size)\n{\n\treturn ((void *)addr >= start && (void *)addr < start + size);\n}\n\n#ifdef CONFIG_KALLSYMS\n/*\n * This ignores the intensely annoying \"mapping symbols\" found\n * in ARM ELF files: $a, $t and $d.\n */\nstatic inline int is_arm_mapping_symbol(const char *str)\n{\n\treturn str[0] == '$' && strchr(\"atd\", str[1]) \n\t && (str[2] == '\\0' || str[2] == '.');\n}\n\nstatic const char *get_ksymbol(struct module *mod,\n\t\t\t unsigned long addr,\n\t\t\t unsigned long *size,\n\t\t\t unsigned long *offset)\n{\n\tunsigned int i, best = 0;\n\tunsigned long nextval;\n\n\t/* At worse, next value is at end of module */\n\tif (within(addr, mod->module_init, mod->init_size))\n\t\tnextval = (unsigned long)mod->module_init+mod->init_text_size;\n\telse \n\t\tnextval = (unsigned long)mod->module_core+mod->core_text_size;\n\n\t/* Scan for closest preceeding symbol, and next symbol. (ELF\n starts real symbols at 1). */\n\tfor (i = 1; i < mod->num_symtab; i++) {\n\t\tif (mod->symtab[i].st_shndx == SHN_UNDEF)\n\t\t\tcontinue;\n\n\t\t/* We ignore unnamed symbols: they're uninformative\n\t\t * and inserted at a whim. */\n\t\tif (mod->symtab[i].st_value <= addr\n\t\t && mod->symtab[i].st_value > mod->symtab[best].st_value\n\t\t && *(mod->strtab + mod->symtab[i].st_name) != '\\0'\n\t\t && !is_arm_mapping_symbol(mod->strtab + mod->symtab[i].st_name))\n\t\t\tbest = i;\n\t\tif (mod->symtab[i].st_value > addr\n\t\t && mod->symtab[i].st_value < nextval\n\t\t && *(mod->strtab + mod->symtab[i].st_name) != '\\0'\n\t\t && !is_arm_mapping_symbol(mod->strtab + mod->symtab[i].st_name))\n\t\t\tnextval = mod->symtab[i].st_value;\n\t}\n\n\tif (!best)\n\t\treturn NULL;\n\n\tif (size)\n\t\t*size = nextval - mod->symtab[best].st_value;\n\tif (offset)\n\t\t*offset = addr - mod->symtab[best].st_value;\n\treturn mod->strtab + mod->symtab[best].st_name;\n}\n\n/* For kallsyms to ask for address resolution. NULL means not found.\n We don't lock, as this is used for oops resolution and races are a\n lesser concern. */\nconst char *module_address_lookup(unsigned long addr,\n\t\t\t\t unsigned long *size,\n\t\t\t\t unsigned long *offset,\n\t\t\t\t char **modname)\n{\n\tstruct module *mod;\n\n\tlist_for_each_entry(mod, &modules, list) {\n\t\tif (within(addr, mod->module_init, mod->init_size)\n\t\t || within(addr, mod->module_core, mod->core_size)) {\n\t\t\tif (modname)\n\t\t\t\t*modname = mod->name;\n\t\t\treturn get_ksymbol(mod, addr, size, offset);\n\t\t}\n\t}\n\treturn NULL;\n}\n\nint lookup_module_symbol_name(unsigned long addr, char *symname)\n{\n\tstruct module *mod;\n\n\tmutex_lock(&module_mutex);\n\tlist_for_each_entry(mod, &modules, list) {\n\t\tif (within(addr, mod->module_init, mod->init_size) ||\n\t\t within(addr, mod->module_core, mod->core_size)) {\n\t\t\tconst char *sym;\n\n\t\t\tsym = get_ksymbol(mod, addr, NULL, NULL);\n\t\t\tif (!sym)\n\t\t\t\tgoto out;\n\t\t\tstrlcpy(symname, sym, KSYM_NAME_LEN + 1);\n\t\t\tmutex_unlock(&module_mutex);\n\t\t\treturn 0;\n\t\t}\n\t}\nout:\n\tmutex_unlock(&module_mutex);\n\treturn -ERANGE;\n}\n\nint lookup_module_symbol_attrs(unsigned long addr, unsigned long *size,\n\t\t\tunsigned long *offset, char *modname, char *name)\n{\n\tstruct module *mod;\n\n\tmutex_lock(&module_mutex);\n\tlist_for_each_entry(mod, &modules, list) {\n\t\tif (within(addr, mod->module_init, mod->init_size) ||\n\t\t within(addr, mod->module_core, mod->core_size)) {\n\t\t\tconst char *sym;\n\n\t\t\tsym = get_ksymbol(mod, addr, size, offset);\n\t\t\tif (!sym)\n\t\t\t\tgoto out;\n\t\t\tif (modname)\n\t\t\t\tstrlcpy(modname, mod->name, MODULE_NAME_LEN + 1);\n\t\t\tif (name)\n\t\t\t\tstrlcpy(name, sym, KSYM_NAME_LEN + 1);\n\t\t\tmutex_unlock(&module_mutex);\n\t\t\treturn 0;\n\t\t}\n\t}\nout:\n\tmutex_unlock(&module_mutex);\n\treturn -ERANGE;\n}\n\n#ifdef\tCONFIG_KDB\n#include <linux/kdb.h>\nstruct list_head *kdb_modules = &modules;\t/* kdb needs the list of modules */\n#endif\t/* CONFIG_KDB */\n\nint module_get_kallsym(unsigned int symnum, unsigned long *value, char *type,\n\t\t\tchar *name, char *module_name, int *exported)\n{\n\tstruct module *mod;\n#ifdef\tCONFIG_KDB\n\tint get_lock = !KDB_IS_RUNNING();\n#else\n#define\tget_lock 1\n#endif\n\n\tif (get_lock)\n\t\tmutex_lock(&module_mutex);\n\tlist_for_each_entry(mod, &modules, list) {\n\t\tif (symnum < mod->num_symtab) {\n\t\t\t*value = mod->symtab[symnum].st_value;\n\t\t\t*type = mod->symtab[symnum].st_info;\n\t\t\tstrlcpy(name, mod->strtab + mod->symtab[symnum].st_name,\n\t\t\t\tKSYM_NAME_LEN + 1);\n\t\t\tstrlcpy(module_name, mod->name, MODULE_NAME_LEN + 1);\n\t\t\t*exported = is_exported(name, mod);\n\t\t\tif (get_lock)\n\t\t\t\tmutex_unlock(&module_mutex);\n\t\t\treturn 0;\n\t\t}\n\t\tsymnum -= mod->num_symtab;\n\t}\n\tif (get_lock)\n\t\tmutex_unlock(&module_mutex);\n\treturn -ERANGE;\n}\n\nstatic unsigned long mod_find_symname(struct module *mod, const char *name)\n{\n\tunsigned int i;\n\n\tfor (i = 0; i < mod->num_symtab; i++)\n\t\tif (strcmp(name, mod->strtab+mod->symtab[i].st_name) == 0 &&\n\t\t mod->symtab[i].st_info != 'U')\n\t\t\treturn mod->symtab[i].st_value;\n\treturn 0;\n}\n\n/* Look for this name: can be of form module:name. */\nunsigned long module_kallsyms_lookup_name(const char *name)\n{\n\tstruct module *mod;\n\tchar *colon;\n\tunsigned long ret = 0;\n\n\t/* Don't lock: we're in enough trouble already. */\n\tif ((colon = strchr(name, ':')) != NULL) {\n\t\t*colon = '\\0';\n\t\tif ((mod = find_module(name)) != NULL)\n\t\t\tret = mod_find_symname(mod, colon+1);\n\t\t*colon = ':';\n\t} else {\n\t\tlist_for_each_entry(mod, &modules, list)\n\t\t\tif ((ret = mod_find_symname(mod, name)) != 0)\n\t\t\t\tbreak;\n\t}\n\treturn ret;\n}\n#endif /* CONFIG_KALLSYMS */\n\n/* Called by the /proc file system to return a list of modules. */\nstatic void *m_start(struct seq_file *m, loff_t *pos)\n{\n\tstruct list_head *i;\n\tloff_t n = 0;\n\n\tmutex_lock(&module_mutex);\n\tlist_for_each(i, &modules) {\n\t\tif (n++ == *pos)\n\t\t\tbreak;\n\t}\n\tif (i == &modules)\n\t\treturn NULL;\n\treturn i;\n}\n\nstatic void *m_next(struct seq_file *m, void *p, loff_t *pos)\n{\n\tstruct list_head *i = p;\n\t(*pos)++;\n\tif (i->next == &modules)\n\t\treturn NULL;\n\treturn i->next;\n}\n\nstatic void m_stop(struct seq_file *m, void *p)\n{\n\tmutex_unlock(&module_mutex);\n}\n\nstatic char *taint_flags(unsigned int taints, char *buf)\n{\n\tint bx = 0;\n\n\tif (taints) {\n\t\tbuf[bx++] = '(';\n\t\tif (taints & TAINT_PROPRIETARY_MODULE)\n\t\t\tbuf[bx++] = 'P';\n\t\tif (taints & TAINT_FORCED_MODULE)\n\t\t\tbuf[bx++] = 'F';\n\t\t/*\n\t\t * TAINT_FORCED_RMMOD: could be added.\n\t\t * TAINT_UNSAFE_SMP, TAINT_MACHINE_CHECK, TAINT_BAD_PAGE don't\n\t\t * apply to modules.\n\t\t */\n\t\tbuf[bx++] = ')';\n\t}\n\tbuf[bx] = '\\0';\n\n\treturn buf;\n}\n\nstatic int m_show(struct seq_file *m, void *p)\n{\n\tstruct module *mod = list_entry(p, struct module, list);\n\tchar buf[8];\n\n\tseq_printf(m, \"%s %lu\",\n\t\t mod->name, mod->init_size + mod->core_size);\n\tprint_unload_info(m, mod);\n\n\t/* Informative for users. */\n\tseq_printf(m, \" %s\",\n\t\t mod->state == MODULE_STATE_GOING ? \"Unloading\":\n\t\t mod->state == MODULE_STATE_COMING ? \"Loading\":\n\t\t \"Live\");\n\t/* Used by oprofile and other similar tools. */\n\tseq_printf(m, \" 0x%p\", mod->module_core);\n\n\t/* Taints info */\n\tif (mod->taints)\n\t\tseq_printf(m, \" %s\", taint_flags(mod->taints, buf));\n\n\tseq_printf(m, \"\\n\");\n\treturn 0;\n}\n\n/* Format: modulename size refcount deps address\n\n Where refcount is a number or -, and deps is a comma-separated list\n of depends or -.\n*/\nconst struct seq_operations modules_op = {\n\t.start\t= m_start,\n\t.next\t= m_next,\n\t.stop\t= m_stop,\n\t.show\t= m_show\n};\n\n/* Given an address, look for it in the module exception tables. */\nconst struct exception_table_entry *search_module_extables(unsigned long addr)\n{\n\tunsigned long flags;\n\tconst struct exception_table_entry *e = NULL;\n\tstruct module *mod;\n\n\tspin_lock_irqsave(&modlist_lock, flags);\n\tlist_for_each_entry(mod, &modules, list) {\n\t\tif (mod->num_exentries == 0)\n\t\t\tcontinue;\n\t\t\t\t\n\t\te = search_extable(mod->extable,\n\t\t\t\t mod->extable + mod->num_exentries - 1,\n\t\t\t\t addr);\n\t\tif (e)\n\t\t\tbreak;\n\t}\n\tspin_unlock_irqrestore(&modlist_lock, flags);\n\n\t/* Now, if we found one, we are running inside it now, hence\n we cannot unload the module, hence no refcnt needed. */\n\treturn e;\n}\n\n/*\n * Is this a valid module address?\n */\nint is_module_address(unsigned long addr)\n{\n\tunsigned long flags;\n\tstruct module *mod;\n\n\tspin_lock_irqsave(&modlist_lock, flags);\n\n\tlist_for_each_entry(mod, &modules, list) {\n\t\tif (within(addr, mod->module_core, mod->core_size)) {\n\t\t\tspin_unlock_irqrestore(&modlist_lock, flags);\n\t\t\treturn 1;\n\t\t}\n\t}\n\n\tspin_unlock_irqrestore(&modlist_lock, flags);\n\n\treturn 0;\n}\n\n\n/* Is this a valid kernel address? We don't grab the lock: we are oopsing. */\nstruct module *__module_text_address(unsigned long addr)\n{\n\tstruct module *mod;\n\n\tlist_for_each_entry(mod, &modules, list)\n\t\tif (within(addr, mod->module_init, mod->init_text_size)\n\t\t || within(addr, mod->module_core, mod->core_text_size))\n\t\t\treturn mod;\n\treturn NULL;\n}\n\nstruct module *module_text_address(unsigned long addr)\n{\n\tstruct module *mod;\n\tunsigned long flags;\n\n\tspin_lock_irqsave(&modlist_lock, flags);\n\tmod = __module_text_address(addr);\n\tspin_unlock_irqrestore(&modlist_lock, flags);\n\n\treturn mod;\n}\n\n/* Don't grab lock, we're oopsing. */\nvoid print_modules(void)\n{\n\tstruct module *mod;\n\tchar buf[8];\n\n\tprintk(\"Modules linked in:\");\n\tlist_for_each_entry(mod, &modules, list)\n\t\tprintk(\" %s%s\", mod->name, taint_flags(mod->taints, buf));\n\tprintk(\"\\n\");\n}\n\n#ifdef CONFIG_SYSFS\nstatic char *make_driver_name(struct device_driver *drv)\n{\n\tchar *driver_name;\n\n\tdriver_name = kmalloc(strlen(drv->name) + strlen(drv->bus->name) + 2,\n\t\t\t GFP_KERNEL);\n\tif (!driver_name)\n\t\treturn NULL;\n\n\tsprintf(driver_name, \"%s:%s\", drv->bus->name, drv->name);\n\treturn driver_name;\n}\n\nstatic void module_create_drivers_dir(struct module_kobject *mk)\n{\n\tif (!mk || mk->drivers_dir)\n\t\treturn;\n\n\tmk->drivers_dir = kobject_add_dir(&mk->kobj, \"drivers\");\n}\n\nvoid module_add_driver(struct module *mod, struct device_driver *drv)\n{\n\tchar *driver_name;\n\tint no_warn;\n\tstruct module_kobject *mk = NULL;\n\n\tif (!drv)\n\t\treturn;\n\n\tif (mod)\n\t\tmk = &mod->mkobj;\n\telse if (drv->mod_name) {\n\t\tstruct kobject *mkobj;\n\n\t\t/* Lookup built-in module entry in /sys/modules */\n\t\tmkobj = kset_find_obj(&module_subsys, drv->mod_name);\n\t\tif (mkobj) {\n\t\t\tmk = container_of(mkobj, struct module_kobject, kobj);\n\t\t\t/* remember our module structure */\n\t\t\tdrv->mkobj = mk;\n\t\t\t/* kset_find_obj took a reference */\n\t\t\tkobject_put(mkobj);\n\t\t}\n\t}\n\n\tif (!mk)\n\t\treturn;\n\n\t/* Don't check return codes; these calls are idempotent */\n\tno_warn = sysfs_create_link(&drv->kobj, &mk->kobj, \"module\");\n\tdriver_name = make_driver_name(drv);\n\tif (driver_name) {\n\t\tmodule_create_drivers_dir(mk);\n\t\tno_warn = sysfs_create_link(mk->drivers_dir, &drv->kobj,\n\t\t\t\t\t driver_name);\n\t\tkfree(driver_name);\n\t}\n}\nEXPORT_SYMBOL(module_add_driver);\n\nvoid module_remove_driver(struct device_driver *drv)\n{\n\tstruct module_kobject *mk = NULL;\n\tchar *driver_name;\n\n\tif (!drv)\n\t\treturn;\n\n\tsysfs_remove_link(&drv->kobj, \"module\");\n\n\tif (drv->owner)\n\t\tmk = &drv->owner->mkobj;\n\telse if (drv->mkobj)\n\t\tmk = drv->mkobj;\n\tif (mk && mk->drivers_dir) {\n\t\tdriver_name = make_driver_name(drv);\n\t\tif (driver_name) {\n\t\t\tsysfs_remove_link(mk->drivers_dir, driver_name);\n\t\t\tkfree(driver_name);\n\t\t}\n\t}\n}\nEXPORT_SYMBOL(module_remove_driver);\n#endif\n\n#ifdef CONFIG_MODVERSIONS\n/* Generate the signature for struct module here, too, for modversions. */\nvoid struct_module(struct module *mod) { return; }\nEXPORT_SYMBOL(struct_module);\n#endif\n/*\n * kernel/mutex.c\n *\n * Mutexes: blocking mutual exclusion locks\n *\n * Started by Ingo Molnar:\n *\n * Copyright (C) 2004, 2005, 2006 Red Hat, Inc., Ingo Molnar <mingo@redhat.com>\n *\n * Many thanks to Arjan van de Ven, Thomas Gleixner, Steven Rostedt and\n * David Howells for suggestions and improvements.\n *\n * Also see Documentation/mutex-design.txt.\n */\n#include <linux/mutex.h>\n#include <linux/sched.h>\n#include <linux/module.h>\n#include <linux/spinlock.h>\n#include <linux/interrupt.h>\n#include <linux/debug_locks.h>\n\n/*\n * In the DEBUG case we are using the \"NULL fastpath\" for mutexes,\n * which forces all calls into the slowpath:\n */\n#ifdef CONFIG_DEBUG_MUTEXES\n# include \"mutex-debug.h\"\n# include <asm-generic/mutex-null.h>\n#else\n# include \"mutex.h\"\n# include <asm/mutex.h>\n#endif\n\n/***\n * mutex_init - initialize the mutex\n * @lock: the mutex to be initialized\n *\n * Initialize the mutex to unlocked state.\n *\n * It is not allowed to initialize an already locked mutex.\n */\nvoid\n__mutex_init(struct mutex *lock, const char *name, struct lock_class_key *key)\n{\n\tatomic_set(&lock->count, 1);\n\tspin_lock_init(&lock->wait_lock);\n\tINIT_LIST_HEAD(&lock->wait_list);\n\n\tdebug_mutex_init(lock, name, key);\n}\n\nEXPORT_SYMBOL(__mutex_init);\n\n/*\n * We split the mutex lock/unlock logic into separate fastpath and\n * slowpath functions, to reduce the register pressure on the fastpath.\n * We also put the fastpath first in the kernel image, to make sure the\n * branch is predicted by the CPU as default-untaken.\n */\nstatic void fastcall noinline __sched\n__mutex_lock_slowpath(atomic_t *lock_count);\n\n/***\n * mutex_lock - acquire the mutex\n * @lock: the mutex to be acquired\n *\n * Lock the mutex exclusively for this task. If the mutex is not\n * available right now, it will sleep until it can get it.\n *\n * The mutex must later on be released by the same task that\n * acquired it. Recursive locking is not allowed. The task\n * may not exit without first unlocking the mutex. Also, kernel\n * memory where the mutex resides mutex must not be freed with\n * the mutex still locked. The mutex must first be initialized\n * (or statically defined) before it can be locked. memset()-ing\n * the mutex to 0 is not allowed.\n *\n * ( The CONFIG_DEBUG_MUTEXES .config option turns on debugging\n * checks that will enforce the restrictions and will also do\n * deadlock debugging. )\n *\n * This function is similar to (but not equivalent to) down().\n */\nvoid inline fastcall __sched mutex_lock(struct mutex *lock)\n{\n\tmight_sleep();\n\t/*\n\t * The locking fastpath is the 1->0 transition from\n\t * 'unlocked' into 'locked' state.\n\t */\n\t__mutex_fastpath_lock(&lock->count, __mutex_lock_slowpath);\n}\n\nEXPORT_SYMBOL(mutex_lock);\n\nstatic void fastcall noinline __sched\n__mutex_unlock_slowpath(atomic_t *lock_count);\n\n/***\n * mutex_unlock - release the mutex\n * @lock: the mutex to be released\n *\n * Unlock a mutex that has been locked by this task previously.\n *\n * This function must not be used in interrupt context. Unlocking\n * of a not locked mutex is not allowed.\n *\n * This function is similar to (but not equivalent to) up().\n */\nvoid fastcall __sched mutex_unlock(struct mutex *lock)\n{\n\t/*\n\t * The unlocking fastpath is the 0->1 transition from 'locked'\n\t * into 'unlocked' state:\n\t */\n\t__mutex_fastpath_unlock(&lock->count, __mutex_unlock_slowpath);\n}\n\nEXPORT_SYMBOL(mutex_unlock);\n\n/*\n * Lock a mutex (possibly interruptible), slowpath:\n */\nstatic inline int __sched\n__mutex_lock_common(struct mutex *lock, long state, unsigned int subclass)\n{\n\tstruct task_struct *task = current;\n\tstruct mutex_waiter waiter;\n\tunsigned int old_val;\n\tunsigned long flags;\n\n\tspin_lock_mutex(&lock->wait_lock, flags);\n\n\tdebug_mutex_lock_common(lock, &waiter);\n\tmutex_acquire(&lock->dep_map, subclass, 0, _RET_IP_);\n\tdebug_mutex_add_waiter(lock, &waiter, task_thread_info(task));\n\n\t/* add waiting tasks to the end of the waitqueue (FIFO): */\n\tlist_add_tail(&waiter.list, &lock->wait_list);\n\twaiter.task = task;\n\n\tfor (;;) {\n\t\t/*\n\t\t * Lets try to take the lock again - this is needed even if\n\t\t * we get here for the first time (shortly after failing to\n\t\t * acquire the lock), to make sure that we get a wakeup once\n\t\t * it's unlocked. Later on, if we sleep, this is the\n\t\t * operation that gives us the lock. We xchg it to -1, so\n\t\t * that when we release the lock, we properly wake up the\n\t\t * other waiters:\n\t\t */\n\t\told_val = atomic_xchg(&lock->count, -1);\n\t\tif (old_val == 1)\n\t\t\tbreak;\n\n\t\t/*\n\t\t * got a signal? (This code gets eliminated in the\n\t\t * TASK_UNINTERRUPTIBLE case.)\n\t\t */\n\t\tif (unlikely(state == TASK_INTERRUPTIBLE &&\n\t\t\t\t\t\tsignal_pending(task))) {\n\t\t\tmutex_remove_waiter(lock, &waiter, task_thread_info(task));\n\t\t\tmutex_release(&lock->dep_map, 1, _RET_IP_);\n\t\t\tspin_unlock_mutex(&lock->wait_lock, flags);\n\n\t\t\tdebug_mutex_free_waiter(&waiter);\n\t\t\treturn -EINTR;\n\t\t}\n\t\t__set_task_state(task, state);\n\n\t\t/* didnt get the lock, go to sleep: */\n\t\tspin_unlock_mutex(&lock->wait_lock, flags);\n\t\tschedule();\n\t\tspin_lock_mutex(&lock->wait_lock, flags);\n\t}\n\n\t/* got the lock - rejoice! */\n\tmutex_remove_waiter(lock, &waiter, task_thread_info(task));\n\tdebug_mutex_set_owner(lock, task_thread_info(task));\n\n\t/* set it to 0 if there are no waiters left: */\n\tif (likely(list_empty(&lock->wait_list)))\n\t\tatomic_set(&lock->count, 0);\n\n\tspin_unlock_mutex(&lock->wait_lock, flags);\n\n\tdebug_mutex_free_waiter(&waiter);\n\n\treturn 0;\n}\n\nstatic void fastcall noinline __sched\n__mutex_lock_slowpath(atomic_t *lock_count)\n{\n\tstruct mutex *lock = container_of(lock_count, struct mutex, count);\n\n\t__mutex_lock_common(lock, TASK_UNINTERRUPTIBLE, 0);\n}\n\n#ifdef CONFIG_DEBUG_LOCK_ALLOC\nvoid __sched\nmutex_lock_nested(struct mutex *lock, unsigned int subclass)\n{\n\tmight_sleep();\n\t__mutex_lock_common(lock, TASK_UNINTERRUPTIBLE, subclass);\n}\n\nEXPORT_SYMBOL_GPL(mutex_lock_nested);\n\nint __sched\nmutex_lock_interruptible_nested(struct mutex *lock, unsigned int subclass)\n{\n\tmight_sleep();\n\treturn __mutex_lock_common(lock, TASK_INTERRUPTIBLE, subclass);\n}\n\nEXPORT_SYMBOL_GPL(mutex_lock_interruptible_nested);\n#endif\n\n/*\n * Release the lock, slowpath:\n */\nstatic fastcall inline void\n__mutex_unlock_common_slowpath(atomic_t *lock_count, int nested)\n{\n\tstruct mutex *lock = container_of(lock_count, struct mutex, count);\n\tunsigned long flags;\n\n\tspin_lock_mutex(&lock->wait_lock, flags);\n\tmutex_release(&lock->dep_map, nested, _RET_IP_);\n\tdebug_mutex_unlock(lock);\n\n\t/*\n\t * some architectures leave the lock unlocked in the fastpath failure\n\t * case, others need to leave it locked. In the later case we have to\n\t * unlock it here\n\t */\n\tif (__mutex_slowpath_needs_to_unlock())\n\t\tatomic_set(&lock->count, 1);\n\n\tif (!list_empty(&lock->wait_list)) {\n\t\t/* get the first entry from the wait-list: */\n\t\tstruct mutex_waiter *waiter =\n\t\t\t\tlist_entry(lock->wait_list.next,\n\t\t\t\t\t struct mutex_waiter, list);\n\n\t\tdebug_mutex_wake_waiter(lock, waiter);\n\n\t\twake_up_process(waiter->task);\n\t}\n\n\tdebug_mutex_clear_owner(lock);\n\n\tspin_unlock_mutex(&lock->wait_lock, flags);\n}\n\n/*\n * Release the lock, slowpath:\n */\nstatic fastcall noinline void\n__mutex_unlock_slowpath(atomic_t *lock_count)\n{\n\t__mutex_unlock_common_slowpath(lock_count, 1);\n}\n\n/*\n * Here come the less common (and hence less performance-critical) APIs:\n * mutex_lock_interruptible() and mutex_trylock().\n */\nstatic int fastcall noinline __sched\n__mutex_lock_interruptible_slowpath(atomic_t *lock_count);\n\n/***\n * mutex_lock_interruptible - acquire the mutex, interruptable\n * @lock: the mutex to be acquired\n *\n * Lock the mutex like mutex_lock(), and return 0 if the mutex has\n * been acquired or sleep until the mutex becomes available. If a\n * signal arrives while waiting for the lock then this function\n * returns -EINTR.\n *\n * This function is similar to (but not equivalent to) down_interruptible().\n */\nint fastcall __sched mutex_lock_interruptible(struct mutex *lock)\n{\n\tmight_sleep();\n\treturn __mutex_fastpath_lock_retval\n\t\t\t(&lock->count, __mutex_lock_interruptible_slowpath);\n}\n\nEXPORT_SYMBOL(mutex_lock_interruptible);\n\nstatic int fastcall noinline __sched\n__mutex_lock_interruptible_slowpath(atomic_t *lock_count)\n{\n\tstruct mutex *lock = container_of(lock_count, struct mutex, count);\n\n\treturn __mutex_lock_common(lock, TASK_INTERRUPTIBLE, 0);\n}\n\n/*\n * Spinlock based trylock, we take the spinlock and check whether we\n * can get the lock:\n */\nstatic inline int __mutex_trylock_slowpath(atomic_t *lock_count)\n{\n\tstruct mutex *lock = container_of(lock_count, struct mutex, count);\n\tunsigned long flags;\n\tint prev;\n\n\tspin_lock_mutex(&lock->wait_lock, flags);\n\n\tprev = atomic_xchg(&lock->count, -1);\n\tif (likely(prev == 1)) {\n\t\tdebug_mutex_set_owner(lock, current_thread_info());\n\t\tmutex_acquire(&lock->dep_map, 0, 1, _RET_IP_);\n\t}\n\t/* Set it back to 0 if there are no waiters: */\n\tif (likely(list_empty(&lock->wait_list)))\n\t\tatomic_set(&lock->count, 0);\n\n\tspin_unlock_mutex(&lock->wait_lock, flags);\n\n\treturn prev == 1;\n}\n\n/***\n * mutex_trylock - try acquire the mutex, without waiting\n * @lock: the mutex to be acquired\n *\n * Try to acquire the mutex atomically. Returns 1 if the mutex\n * has been acquired successfully, and 0 on contention.\n *\n * NOTE: this function follows the spin_trylock() convention, so\n * it is negated to the down_trylock() return values! Be careful\n * about this when converting semaphore users to mutexes.\n *\n * This function must not be used in interrupt context. The\n * mutex must be released by the same task that acquired it.\n */\nint fastcall __sched mutex_trylock(struct mutex *lock)\n{\n\treturn __mutex_fastpath_trylock(&lock->count,\n\t\t\t\t\t__mutex_trylock_slowpath);\n}\n\nEXPORT_SYMBOL(mutex_trylock);\n/*\n * kernel/mutex-debug.c\n *\n * Debugging code for mutexes\n *\n * Started by Ingo Molnar:\n *\n * Copyright (C) 2004, 2005, 2006 Red Hat, Inc., Ingo Molnar <mingo@redhat.com>\n *\n * lock debugging, locking tree, deadlock detection started by:\n *\n * Copyright (C) 2004, LynuxWorks, Inc., Igor Manyilov, Bill Huey\n * Released under the General Public License (GPL).\n */\n#include <linux/mutex.h>\n#include <linux/delay.h>\n#include <linux/module.h>\n#include <linux/poison.h>\n#include <linux/spinlock.h>\n#include <linux/kallsyms.h>\n#include <linux/interrupt.h>\n#include <linux/debug_locks.h>\n\n#include \"mutex-debug.h\"\n\n/*\n * Must be called with lock->wait_lock held.\n */\nvoid debug_mutex_set_owner(struct mutex *lock, struct thread_info *new_owner)\n{\n\tlock->owner = new_owner;\n}\n\nvoid debug_mutex_lock_common(struct mutex *lock, struct mutex_waiter *waiter)\n{\n\tmemset(waiter, MUTEX_DEBUG_INIT, sizeof(*waiter));\n\twaiter->magic = waiter;\n\tINIT_LIST_HEAD(&waiter->list);\n}\n\nvoid debug_mutex_wake_waiter(struct mutex *lock, struct mutex_waiter *waiter)\n{\n\tSMP_DEBUG_LOCKS_WARN_ON(!spin_is_locked(&lock->wait_lock));\n\tDEBUG_LOCKS_WARN_ON(list_empty(&lock->wait_list));\n\tDEBUG_LOCKS_WARN_ON(waiter->magic != waiter);\n\tDEBUG_LOCKS_WARN_ON(list_empty(&waiter->list));\n}\n\nvoid debug_mutex_free_waiter(struct mutex_waiter *waiter)\n{\n\tDEBUG_LOCKS_WARN_ON(!list_empty(&waiter->list));\n\tmemset(waiter, MUTEX_DEBUG_FREE, sizeof(*waiter));\n}\n\nvoid debug_mutex_add_waiter(struct mutex *lock, struct mutex_waiter *waiter,\n\t\t\t struct thread_info *ti)\n{\n\tSMP_DEBUG_LOCKS_WARN_ON(!spin_is_locked(&lock->wait_lock));\n\n\t/* Mark the current thread as blocked on the lock: */\n\tti->task->blocked_on = waiter;\n\twaiter->lock = lock;\n}\n\nvoid mutex_remove_waiter(struct mutex *lock, struct mutex_waiter *waiter,\n\t\t\t struct thread_info *ti)\n{\n\tDEBUG_LOCKS_WARN_ON(list_empty(&waiter->list));\n\tDEBUG_LOCKS_WARN_ON(waiter->task != ti->task);\n\tDEBUG_LOCKS_WARN_ON(ti->task->blocked_on != waiter);\n\tti->task->blocked_on = NULL;\n\n\tlist_del_init(&waiter->list);\n\twaiter->task = NULL;\n}\n\nvoid debug_mutex_unlock(struct mutex *lock)\n{\n\tif (unlikely(!debug_locks))\n\t\treturn;\n\n\tDEBUG_LOCKS_WARN_ON(lock->owner != current_thread_info());\n\tDEBUG_LOCKS_WARN_ON(lock->magic != lock);\n\tDEBUG_LOCKS_WARN_ON(!lock->wait_list.prev && !lock->wait_list.next);\n\tDEBUG_LOCKS_WARN_ON(lock->owner != current_thread_info());\n}\n\nvoid debug_mutex_init(struct mutex *lock, const char *name,\n\t\t struct lock_class_key *key)\n{\n#ifdef CONFIG_DEBUG_LOCK_ALLOC\n\t/*\n\t * Make sure we are not reinitializing a held lock:\n\t */\n\tdebug_check_no_locks_freed((void *)lock, sizeof(*lock));\n\tlockdep_init_map(&lock->dep_map, name, key, 0);\n#endif\n\tlock->owner = NULL;\n\tlock->magic = lock;\n}\n\n/***\n * mutex_destroy - mark a mutex unusable\n * @lock: the mutex to be destroyed\n *\n * This function marks the mutex uninitialized, and any subsequent\n * use of the mutex is forbidden. The mutex must not be locked when\n * this function is called.\n */\nvoid fastcall mutex_destroy(struct mutex *lock)\n{\n\tDEBUG_LOCKS_WARN_ON(mutex_is_locked(lock));\n\tlock->magic = NULL;\n}\n\nEXPORT_SYMBOL_GPL(mutex_destroy);\n/*\n * Copyright (C) 2006 IBM Corporation\n *\n * Author: Serge Hallyn <serue@us.ibm.com>\n *\n * This program is free software; you can redistribute it and/or\n * modify it under the terms of the GNU General Public License as\n * published by the Free Software Foundation, version 2 of the\n * License.\n *\n * Jun 2006 - namespaces support\n * OpenVZ, SWsoft Inc.\n * Pavel Emelianov <xemul@openvz.org>\n */\n\n#include <linux/module.h>\n#include <linux/version.h>\n#include <linux/nsproxy.h>\n#include <linux/init_task.h>\n#include <linux/mnt_namespace.h>\n#include <linux/utsname.h>\n#include <linux/pid_namespace.h>\n\nstruct nsproxy init_nsproxy = INIT_NSPROXY(init_nsproxy);\n\nstatic inline void get_nsproxy(struct nsproxy *ns)\n{\n\tatomic_inc(&ns->count);\n}\n\nvoid get_task_namespaces(struct task_struct *tsk)\n{\n\tstruct nsproxy *ns = tsk->nsproxy;\n\tif (ns) {\n\t\tget_nsproxy(ns);\n\t}\n}\n\n/*\n * creates a copy of \"orig\" with refcount 1.\n */\nstatic inline struct nsproxy *clone_nsproxy(struct nsproxy *orig)\n{\n\tstruct nsproxy *ns;\n\n\tns = kmemdup(orig, sizeof(struct nsproxy), GFP_KERNEL);\n\tif (ns)\n\t\tatomic_set(&ns->count, 1);\n\treturn ns;\n}\n\n/*\n * Create new nsproxy and all of its the associated namespaces.\n * Return the newly created nsproxy. Do not attach this to the task,\n * leave it to the caller to do proper locking and attach it to task.\n */\nstatic struct nsproxy *create_new_namespaces(int flags, struct task_struct *tsk,\n\t\t\tstruct fs_struct *new_fs)\n{\n\tstruct nsproxy *new_nsp;\n\n\tnew_nsp = clone_nsproxy(tsk->nsproxy);\n\tif (!new_nsp)\n\t\treturn ERR_PTR(-ENOMEM);\n\n\tnew_nsp->mnt_ns = copy_mnt_ns(flags, tsk->nsproxy->mnt_ns, new_fs);\n\tif (IS_ERR(new_nsp->mnt_ns))\n\t\tgoto out_ns;\n\n\tnew_nsp->uts_ns = copy_utsname(flags, tsk->nsproxy->uts_ns);\n\tif (IS_ERR(new_nsp->uts_ns))\n\t\tgoto out_uts;\n\n\tnew_nsp->ipc_ns = copy_ipcs(flags, tsk->nsproxy->ipc_ns);\n\tif (IS_ERR(new_nsp->ipc_ns))\n\t\tgoto out_ipc;\n\n\tnew_nsp->pid_ns = copy_pid_ns(flags, tsk->nsproxy->pid_ns);\n\tif (IS_ERR(new_nsp->pid_ns))\n\t\tgoto out_pid;\n\n\treturn new_nsp;\n\nout_pid:\n\tif (new_nsp->ipc_ns)\n\t\tput_ipc_ns(new_nsp->ipc_ns);\nout_ipc:\n\tif (new_nsp->uts_ns)\n\t\tput_uts_ns(new_nsp->uts_ns);\nout_uts:\n\tif (new_nsp->mnt_ns)\n\t\tput_mnt_ns(new_nsp->mnt_ns);\nout_ns:\n\tkfree(new_nsp);\n\treturn ERR_PTR(-ENOMEM);\n}\n\n/*\n * called from clone. This now handles copy for nsproxy and all\n * namespaces therein.\n */\nint copy_namespaces(int flags, struct task_struct *tsk)\n{\n\tstruct nsproxy *old_ns = tsk->nsproxy;\n\tstruct nsproxy *new_ns;\n\tint err = 0;\n\n\tif (!old_ns)\n\t\treturn 0;\n\n\tget_nsproxy(old_ns);\n\n\tif (!(flags & (CLONE_NEWNS | CLONE_NEWUTS | CLONE_NEWIPC)))\n\t\treturn 0;\n\n\tif (!capable(CAP_SYS_ADMIN)) {\n\t\terr = -EPERM;\n\t\tgoto out;\n\t}\n\n\tnew_ns = create_new_namespaces(flags, tsk, tsk->fs);\n\tif (IS_ERR(new_ns)) {\n\t\terr = PTR_ERR(new_ns);\n\t\tgoto out;\n\t}\n\n\ttsk->nsproxy = new_ns;\nout:\n\tput_nsproxy(old_ns);\n\treturn err;\n}\n\nvoid free_nsproxy(struct nsproxy *ns)\n{\n\tif (ns->mnt_ns)\n\t\tput_mnt_ns(ns->mnt_ns);\n\tif (ns->uts_ns)\n\t\tput_uts_ns(ns->uts_ns);\n\tif (ns->ipc_ns)\n\t\tput_ipc_ns(ns->ipc_ns);\n\tif (ns->pid_ns)\n\t\tput_pid_ns(ns->pid_ns);\n\tkfree(ns);\n}\n\n/*\n * Called from unshare. Unshare all the namespaces part of nsproxy.\n * On success, returns the new nsproxy.\n */\nint unshare_nsproxy_namespaces(unsigned long unshare_flags,\n\t\tstruct nsproxy **new_nsp, struct fs_struct *new_fs)\n{\n\tint err = 0;\n\n\tif (!(unshare_flags & (CLONE_NEWNS | CLONE_NEWUTS | CLONE_NEWIPC)))\n\t\treturn 0;\n\n#ifndef CONFIG_IPC_NS\n\tif (unshare_flags & CLONE_NEWIPC)\n\t\treturn -EINVAL;\n#endif\n\n#ifndef CONFIG_UTS_NS\n\tif (unshare_flags & CLONE_NEWUTS)\n\t\treturn -EINVAL;\n#endif\n\n\tif (!capable(CAP_SYS_ADMIN))\n\t\treturn -EPERM;\n\n\t*new_nsp = create_new_namespaces(unshare_flags, current,\n\t\t\t\tnew_fs ? new_fs : current->fs);\n\tif (IS_ERR(*new_nsp))\n\t\terr = PTR_ERR(*new_nsp);\n\treturn err;\n}\n/*\n * linux/kernel/panic.c\n *\n * Copyright (C) 1991, 1992 Linus Torvalds\n */\n\n/*\n * This function is used through-out the kernel (including mm and fs)\n * to indicate a major problem.\n */\n#include <linux/module.h>\n#include <linux/sched.h>\n#include <linux/delay.h>\n#include <linux/reboot.h>\n#include <linux/notifier.h>\n#include <linux/init.h>\n#include <linux/sysrq.h>\n#include <linux/interrupt.h>\n#include <linux/nmi.h>\n#include <linux/kexec.h>\n#include <linux/debug_locks.h>\n\nint panic_on_oops;\nint tainted;\nstatic int pause_on_oops;\nstatic int pause_on_oops_flag;\nstatic DEFINE_SPINLOCK(pause_on_oops_lock);\n\nint panic_timeout;\n\nATOMIC_NOTIFIER_HEAD(panic_notifier_list);\n\nEXPORT_SYMBOL(panic_notifier_list);\n\nstatic int __init panic_setup(char *str)\n{\n\tpanic_timeout = simple_strtoul(str, NULL, 0);\n\treturn 1;\n}\n__setup(\"panic=\", panic_setup);\n\nstatic long no_blink(long time)\n{\n\treturn 0;\n}\n\n/* Returns how long it waited in ms */\nlong (*panic_blink)(long time);\nEXPORT_SYMBOL(panic_blink);\n\n/**\n *\tpanic - halt the system\n *\t@fmt: The text string to print\n *\n *\tDisplay a message, then perform cleanups.\n *\n *\tThis function never returns.\n */\n \nNORET_TYPE void panic(const char * fmt, ...)\n{\n\tlong i;\n\tstatic char buf[1024];\n\tva_list args;\n#if defined(CONFIG_S390)\n unsigned long caller = (unsigned long) __builtin_return_address(0);\n#endif\n\n\t/*\n\t * It's possible to come here directly from a panic-assertion and not\n\t * have preempt disabled. Some functions called from here want\n\t * preempt to be disabled. No point enabling it later though...\n\t */\n\tpreempt_disable();\n\n\tbust_spinlocks(1);\n\tva_start(args, fmt);\n\tvsnprintf(buf, sizeof(buf), fmt, args);\n\tva_end(args);\n\tprintk(KERN_EMERG \"Kernel panic - not syncing: %s\\n\",buf);\n\tbust_spinlocks(0);\n\n\t/*\n\t * If we have crashed and we have a crash kernel loaded let it handle\n\t * everything else.\n\t * Do we want to call this before we try to display a message?\n\t */\n\tcrash_kexec(NULL);\n\n#ifdef CONFIG_SMP\n\t/*\n\t * Note smp_send_stop is the usual smp shutdown function, which\n\t * unfortunately means it may not be hardened to work in a panic\n\t * situation.\n\t */\n\tsmp_send_stop();\n#endif\n\n\tatomic_notifier_call_chain(&panic_notifier_list, 0, buf);\n\n\tif (!panic_blink)\n\t\tpanic_blink = no_blink;\n\n\tif (panic_timeout > 0) {\n\t\t/*\n\t \t * Delay timeout seconds before rebooting the machine. \n\t\t * We can't use the \"normal\" timers since we just panicked..\n\t \t */\n\t\tprintk(KERN_EMERG \"Rebooting in %d seconds..\",panic_timeout);\n#ifdef CONFIG_BOOTSPLASH\n\t\t{\n\t\t\textern int splash_verbose(void);\n\t\t\t(void)splash_verbose();\n\t\t}\n#endif\n\t\tfor (i = 0; i < panic_timeout*1000; ) {\n\t\t\ttouch_nmi_watchdog();\n\t\t\ti += panic_blink(i);\n\t\t\tmdelay(1);\n\t\t\ti++;\n\t\t}\n\t\t/*\tThis will not be a clean reboot, with everything\n\t\t *\tshutting down. But if there is a chance of\n\t\t *\trebooting the system it will be rebooted.\n\t\t */\n\t\temergency_restart();\n\t}\n#ifdef __sparc__\n\t{\n\t\textern int stop_a_enabled;\n\t\t/* Make sure the user can actually press Stop-A (L1-A) */\n\t\tstop_a_enabled = 1;\n\t\tprintk(KERN_EMERG \"Press Stop-A (L1-A) to return to the boot prom\\n\");\n\t}\n#endif\n#if defined(CONFIG_S390)\n disabled_wait(caller);\n#endif\n\tlocal_irq_enable();\n#ifdef CONFIG_BOOTSPLASH\n\t{\n\t\textern int splash_verbose(void);\n\t\t(void)splash_verbose();\n\t}\n#endif\n\tfor (i = 0;;) {\n\t\ttouch_softlockup_watchdog();\n\t\ti += panic_blink(i);\n\t\tmdelay(1);\n\t\ti++;\n\t}\n}\n\nEXPORT_SYMBOL(panic);\n\n/**\n *\tprint_tainted - return a string to represent the kernel taint state.\n *\n * 'P' - Proprietary module has been loaded.\n * 'F' - Module has been forcibly loaded.\n * 'S' - SMP with CPUs not designed for SMP.\n * 'R' - User forced a module unload.\n * 'M' - Machine had a machine check experience.\n * 'B' - System has hit bad_page.\n * 'U' - Userspace-defined naughtiness.\n * 'N' - Unsuported modules loaded.\n * 'X' - Modules with external support loaded.\n *\n *\tThe string is overwritten by the next call to print_taint().\n */\n \nconst char *print_tainted(void)\n{\n\tstatic char buf[20];\n\tif (tainted) {\n\t\tsnprintf(buf, sizeof(buf), \"Tainted: %c%c%c%c%c%c%c%c\",\n\t\t\ttainted & TAINT_PROPRIETARY_MODULE ? 'P' : 'G',\n\t\t\ttainted & TAINT_FORCED_MODULE ? 'F' : ' ',\n\t\t\ttainted & TAINT_UNSAFE_SMP ? 'S' : ' ',\n\t\t\ttainted & TAINT_FORCED_RMMOD ? 'R' : ' ',\n \t\t\ttainted & TAINT_MACHINE_CHECK ? 'M' : ' ',\n\t\t\ttainted & TAINT_BAD_PAGE ? 'B' : ' ',\n\t\t\ttainted & TAINT_USER ? 'U' : ' ',\n\t\t\ttainted & TAINT_NO_SUPPORT ? 'N' :\n\t\t\t\t(tainted & TAINT_EXTERNAL_SUPPORT ? 'X' : ' '));\n\t}\n\telse\n\t\tsnprintf(buf, sizeof(buf), \"Not tainted\");\n\treturn(buf);\n}\n\nvoid add_taint(unsigned flag)\n{\n\tdebug_locks = 0; /* can't trust the integrity of the kernel anymore */\n\ttainted |= flag;\n}\nEXPORT_SYMBOL(add_taint);\n\nstatic int __init pause_on_oops_setup(char *str)\n{\n\tpause_on_oops = simple_strtoul(str, NULL, 0);\n\treturn 1;\n}\n__setup(\"pause_on_oops=\", pause_on_oops_setup);\n\nstatic void spin_msec(int msecs)\n{\n\tint i;\n\n\tfor (i = 0; i < msecs; i++) {\n\t\ttouch_nmi_watchdog();\n\t\tmdelay(1);\n\t}\n}\n\n/*\n * It just happens that oops_enter() and oops_exit() are identically\n * implemented...\n */\nstatic void do_oops_enter_exit(void)\n{\n\tunsigned long flags;\n\tstatic int spin_counter;\n\n\tif (!pause_on_oops)\n\t\treturn;\n\n\tspin_lock_irqsave(&pause_on_oops_lock, flags);\n\tif (pause_on_oops_flag == 0) {\n\t\t/* This CPU may now print the oops message */\n\t\tpause_on_oops_flag = 1;\n\t} else {\n\t\t/* We need to stall this CPU */\n\t\tif (!spin_counter) {\n\t\t\t/* This CPU gets to do the counting */\n\t\t\tspin_counter = pause_on_oops;\n\t\t\tdo {\n\t\t\t\tspin_unlock(&pause_on_oops_lock);\n\t\t\t\tspin_msec(MSEC_PER_SEC);\n\t\t\t\tspin_lock(&pause_on_oops_lock);\n\t\t\t} while (--spin_counter);\n\t\t\tpause_on_oops_flag = 0;\n\t\t} else {\n\t\t\t/* This CPU waits for a different one */\n\t\t\twhile (spin_counter) {\n\t\t\t\tspin_unlock(&pause_on_oops_lock);\n\t\t\t\tspin_msec(1);\n\t\t\t\tspin_lock(&pause_on_oops_lock);\n\t\t\t}\n\t\t}\n\t}\n\tspin_unlock_irqrestore(&pause_on_oops_lock, flags);\n}\n\n/*\n * Return true if the calling CPU is allowed to print oops-related info. This\n * is a bit racy..\n */\nint oops_may_print(void)\n{\n\treturn pause_on_oops_flag == 0;\n}\n\n/*\n * Called when the architecture enters its oops handler, before it prints\n * anything. If this is the first CPU to oops, and it's oopsing the first time\n * then let it proceed.\n *\n * This is all enabled by the pause_on_oops kernel boot option. We do all this\n * to ensure that oopses don't scroll off the screen. It has the side-effect\n * of preventing later-oopsing CPUs from mucking up the display, too.\n *\n * It turns out that the CPU which is allowed to print ends up pausing for the\n * right duration, whereas all the other CPUs pause for twice as long: once in\n * oops_enter(), once in oops_exit().\n */\nvoid oops_enter(void)\n{\n\tdebug_locks_off(); /* can't trust the integrity of the kernel anymore */\n\tdo_oops_enter_exit();\n}\n\n/*\n * Called when the architecture exits its oops handler, after printing\n * everything.\n */\nvoid oops_exit(void)\n{\n\tdo_oops_enter_exit();\n}\n\n#ifdef CONFIG_CC_STACKPROTECTOR\n/*\n * Called when gcc's -fstack-protector feature is used, and\n * gcc detects corruption of the on-stack canary value\n */\nvoid __stack_chk_fail(void)\n{\n\tpanic(\"stack-protector: Kernel stack is corrupted\");\n}\nEXPORT_SYMBOL(__stack_chk_fail);\n#endif\n/* Helpers for initial module or kernel cmdline parsing\n Copyright (C) 2001 Rusty Russell.\n\n This program is free software; you can redistribute it and/or modify\n it under the terms of the GNU General Public License as published by\n the Free Software Foundation; either version 2 of the License, or\n (at your option) any later version.\n\n This program is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License\n along with this program; if not, write to the Free Software\n Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n*/\n#include <linux/moduleparam.h>\n#include <linux/kernel.h>\n#include <linux/string.h>\n#include <linux/errno.h>\n#include <linux/module.h>\n#include <linux/device.h>\n#include <linux/err.h>\n#include <linux/slab.h>\n\n#if 0\n#define DEBUGP printk\n#else\n#define DEBUGP(fmt, a...)\n#endif\n\nstatic inline char dash2underscore(char c)\n{\n\tif (c == '-')\n\t\treturn '_';\n\treturn c;\n}\n\nstatic inline int parameq(const char *input, const char *paramname)\n{\n\tunsigned int i;\n\tfor (i = 0; dash2underscore(input[i]) == paramname[i]; i++)\n\t\tif (input[i] == '\\0')\n\t\t\treturn 1;\n\treturn 0;\n}\n\nstatic int parse_one(char *param,\n\t\t char *val,\n\t\t struct kernel_param *params, \n\t\t unsigned num_params,\n\t\t int (*handle_unknown)(char *param, char *val))\n{\n\tunsigned int i;\n\n\t/* Find parameter */\n\tfor (i = 0; i < num_params; i++) {\n\t\tif (parameq(param, params[i].name)) {\n\t\t\tDEBUGP(\"They are equal! Calling %p\\n\",\n\t\t\t params[i].set);\n\t\t\treturn params[i].set(val, &params[i]);\n\t\t}\n\t}\n\n\tif (handle_unknown) {\n\t\tDEBUGP(\"Unknown argument: calling %p\\n\", handle_unknown);\n\t\treturn handle_unknown(param, val);\n\t}\n\n\tDEBUGP(\"Unknown argument `%s'\\n\", param);\n\treturn -ENOENT;\n}\n\n/* You can use \" around spaces, but can't escape \". */\n/* Hyphens and underscores equivalent in parameter names. */\nstatic char *next_arg(char *args, char **param, char **val)\n{\n\tunsigned int i, equals = 0;\n\tint in_quote = 0, quoted = 0;\n\tchar *next;\n\n\tif (*args == '\"') {\n\t\targs++;\n\t\tin_quote = 1;\n\t\tquoted = 1;\n\t}\n\n\tfor (i = 0; args[i]; i++) {\n\t\tif (args[i] == ' ' && !in_quote)\n\t\t\tbreak;\n\t\tif (equals == 0) {\n\t\t\tif (args[i] == '=')\n\t\t\t\tequals = i;\n\t\t}\n\t\tif (args[i] == '\"')\n\t\t\tin_quote = !in_quote;\n\t}\n\n\t*param = args;\n\tif (!equals)\n\t\t*val = NULL;\n\telse {\n\t\targs[equals] = '\\0';\n\t\t*val = args + equals + 1;\n\n\t\t/* Don't include quotes in value. */\n\t\tif (**val == '\"') {\n\t\t\t(*val)++;\n\t\t\tif (args[i-1] == '\"')\n\t\t\t\targs[i-1] = '\\0';\n\t\t}\n\t\tif (quoted && args[i-1] == '\"')\n\t\t\targs[i-1] = '\\0';\n\t}\n\n\tif (args[i]) {\n\t\targs[i] = '\\0';\n\t\tnext = args + i + 1;\n\t} else\n\t\tnext = args + i;\n\n\t/* Chew up trailing spaces. */\n\twhile (*next == ' ')\n\t\tnext++;\n\treturn next;\n}\n\n/* Args looks like \"foo=bar,bar2 baz=fuz wiz\". */\nint parse_args(const char *name,\n\t char *args,\n\t struct kernel_param *params,\n\t unsigned num,\n\t int (*unknown)(char *param, char *val))\n{\n\tchar *param, *val;\n\n\tDEBUGP(\"Parsing ARGS: %s\\n\", args);\n\n\t/* Chew leading spaces */\n\twhile (*args == ' ')\n\t\targs++;\n\n\twhile (*args) {\n\t\tint ret;\n\t\tint irq_was_disabled;\n\n\t\targs = next_arg(args, &param, &val);\n\t\tirq_was_disabled = irqs_disabled();\n\t\tret = parse_one(param, val, params, num, unknown);\n\t\tif (irq_was_disabled && !irqs_disabled()) {\n\t\t\tprintk(KERN_WARNING \"parse_args(): option '%s' enabled \"\n\t\t\t\t\t\"irq's!\\n\", param);\n\t\t}\n\t\tswitch (ret) {\n\t\tcase -ENOENT:\n\t\t\tprintk(KERN_ERR \"%s: Unknown parameter `%s'\\n\",\n\t\t\t name, param);\n\t\t\treturn ret;\n\t\tcase -ENOSPC:\n\t\t\tprintk(KERN_ERR\n\t\t\t \"%s: `%s' too large for parameter `%s'\\n\",\n\t\t\t name, val ?: \"\", param);\n\t\t\treturn ret;\n\t\tcase 0:\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tprintk(KERN_ERR\n\t\t\t \"%s: `%s' invalid for parameter `%s'\\n\",\n\t\t\t name, val ?: \"\", param);\n\t\t\treturn ret;\n\t\t}\n\t}\n\n\t/* All parsed OK. */\n\treturn 0;\n}\n\n/* Lazy bastard, eh? */\n#define STANDARD_PARAM_DEF(name, type, format, tmptype, strtolfn) \t\\\n\tint param_set_##name(const char *val, struct kernel_param *kp)\t\\\n\t{\t\t\t\t\t\t\t\t\\\n\t\tchar *endp;\t\t\t\t\t\t\\\n\t\ttmptype l;\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n\t\tif (!val) return -EINVAL;\t\t\t\t\\\n\t\tl = strtolfn(val, &endp, 0);\t\t\t\t\\\n\t\tif (endp == val || ((type)l != l))\t\t\t\\\n\t\t\treturn -EINVAL;\t\t\t\t\t\\\n\t\t*((type *)kp->arg) = l;\t\t\t\t\t\\\n\t\treturn 0;\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n\tint param_get_##name(char *buffer, struct kernel_param *kp)\t\\\n\t{\t\t\t\t\t\t\t\t\\\n\t\treturn sprintf(buffer, format, *((type *)kp->arg));\t\\\n\t}\n\nSTANDARD_PARAM_DEF(byte, unsigned char, \"%c\", unsigned long, simple_strtoul);\nSTANDARD_PARAM_DEF(short, short, \"%hi\", long, simple_strtol);\nSTANDARD_PARAM_DEF(ushort, unsigned short, \"%hu\", unsigned long, simple_strtoul);\nSTANDARD_PARAM_DEF(int, int, \"%i\", long, simple_strtol);\nSTANDARD_PARAM_DEF(uint, unsigned int, \"%u\", unsigned long, simple_strtoul);\nSTANDARD_PARAM_DEF(long, long, \"%li\", long, simple_strtol);\nSTANDARD_PARAM_DEF(ulong, unsigned long, \"%lu\", unsigned long, simple_strtoul);\n\nint param_set_charp(const char *val, struct kernel_param *kp)\n{\n\tif (!val) {\n\t\tprintk(KERN_ERR \"%s: string parameter expected\\n\",\n\t\t kp->name);\n\t\treturn -EINVAL;\n\t}\n\n\tif (strlen(val) > 1024) {\n\t\tprintk(KERN_ERR \"%s: string parameter too long\\n\",\n\t\t kp->name);\n\t\treturn -ENOSPC;\n\t}\n\n\t*(char **)kp->arg = (char *)val;\n\treturn 0;\n}\n\nint param_get_charp(char *buffer, struct kernel_param *kp)\n{\n\treturn sprintf(buffer, \"%s\", *((char **)kp->arg));\n}\n\nint param_set_bool(const char *val, struct kernel_param *kp)\n{\n\t/* No equals means \"set\"... */\n\tif (!val) val = \"1\";\n\n\t/* One of =[yYnN01] */\n\tswitch (val[0]) {\n\tcase 'y': case 'Y': case '1':\n\t\t*(int *)kp->arg = 1;\n\t\treturn 0;\n\tcase 'n': case 'N': case '0':\n\t\t*(int *)kp->arg = 0;\n\t\treturn 0;\n\t}\n\treturn -EINVAL;\n}\n\nint param_get_bool(char *buffer, struct kernel_param *kp)\n{\n\t/* Y and N chosen as being relatively non-coder friendly */\n\treturn sprintf(buffer, \"%c\", (*(int *)kp->arg) ? 'Y' : 'N');\n}\n\nint param_set_invbool(const char *val, struct kernel_param *kp)\n{\n\tint boolval, ret;\n\tstruct kernel_param dummy = { .arg = &boolval };\n\n\tret = param_set_bool(val, &dummy);\n\tif (ret == 0)\n\t\t*(int *)kp->arg = !boolval;\n\treturn ret;\n}\n\nint param_get_invbool(char *buffer, struct kernel_param *kp)\n{\n\tint val;\n\tstruct kernel_param dummy = { .arg = &val };\n\n\tval = !*(int *)kp->arg;\n\treturn param_get_bool(buffer, &dummy);\n}\n\n/* We break the rule and mangle the string. */\nstatic int param_array(const char *name,\n\t\t const char *val,\n\t\t unsigned int min, unsigned int max,\n\t\t void *elem, int elemsize,\n\t\t int (*set)(const char *, struct kernel_param *kp),\n\t\t int *num)\n{\n\tint ret;\n\tstruct kernel_param kp;\n\tchar save;\n\n\t/* Get the name right for errors. */\n\tkp.name = name;\n\tkp.arg = elem;\n\n\t/* No equals sign? */\n\tif (!val) {\n\t\tprintk(KERN_ERR \"%s: expects arguments\\n\", name);\n\t\treturn -EINVAL;\n\t}\n\n\t*num = 0;\n\t/* We expect a comma-separated list of values. */\n\tdo {\n\t\tint len;\n\n\t\tif (*num == max) {\n\t\t\tprintk(KERN_ERR \"%s: can only take %i arguments\\n\",\n\t\t\t name, max);\n\t\t\treturn -EINVAL;\n\t\t}\n\t\tlen = strcspn(val, \",\");\n\n\t\t/* nul-terminate and parse */\n\t\tsave = val[len];\n\t\t((char *)val)[len] = '\\0';\n\t\tret = set(val, &kp);\n\n\t\tif (ret != 0)\n\t\t\treturn ret;\n\t\tkp.arg += elemsize;\n\t\tval += len+1;\n\t\t(*num)++;\n\t} while (save == ',');\n\n\tif (*num < min) {\n\t\tprintk(KERN_ERR \"%s: needs at least %i arguments\\n\",\n\t\t name, min);\n\t\treturn -EINVAL;\n\t}\n\treturn 0;\n}\n\nint param_array_set(const char *val, struct kernel_param *kp)\n{\n\tstruct kparam_array *arr = kp->arg;\n\tunsigned int temp_num;\n\n\treturn param_array(kp->name, val, 1, arr->max, arr->elem,\n\t\t\t arr->elemsize, arr->set, arr->num ?: &temp_num);\n}\n\nint param_array_get(char *buffer, struct kernel_param *kp)\n{\n\tint i, off, ret;\n\tstruct kparam_array *arr = kp->arg;\n\tstruct kernel_param p;\n\n\tp = *kp;\n\tfor (i = off = 0; i < (arr->num ? *arr->num : arr->max); i++) {\n\t\tif (i)\n\t\t\tbuffer[off++] = ',';\n\t\tp.arg = arr->elem + arr->elemsize * i;\n\t\tret = arr->get(buffer + off, &p);\n\t\tif (ret < 0)\n\t\t\treturn ret;\n\t\toff += ret;\n\t}\n\tbuffer[off] = '\\0';\n\treturn off;\n}\n\nint param_set_copystring(const char *val, struct kernel_param *kp)\n{\n\tstruct kparam_string *kps = kp->arg;\n\n\tif (!val) {\n\t\tprintk(KERN_ERR \"%s: missing param set value\\n\", kp->name);\n\t\treturn -EINVAL;\n\t}\n\tif (strlen(val)+1 > kps->maxlen) {\n\t\tprintk(KERN_ERR \"%s: string doesn't fit in %u chars.\\n\",\n\t\t kp->name, kps->maxlen-1);\n\t\treturn -ENOSPC;\n\t}\n\tstrcpy(kps->string, val);\n\treturn 0;\n}\n\nint param_get_string(char *buffer, struct kernel_param *kp)\n{\n\tstruct kparam_string *kps = kp->arg;\n\treturn strlcpy(buffer, kps->string, kps->maxlen);\n}\n\n/* sysfs output in /sys/modules/XYZ/parameters/ */\n\nextern struct kernel_param __start___param[], __stop___param[];\n\n#define MAX_KBUILD_MODNAME KOBJ_NAME_LEN\n\nstruct param_attribute\n{\n\tstruct module_attribute mattr;\n\tstruct kernel_param *param;\n};\n\nstruct module_param_attrs\n{\n\tstruct attribute_group grp;\n\tstruct param_attribute attrs[0];\n};\n\n#ifdef CONFIG_SYSFS\n#define to_param_attr(n) container_of(n, struct param_attribute, mattr);\n\nstatic ssize_t param_attr_show(struct module_attribute *mattr,\n\t\t\t struct module *mod, char *buf)\n{\n\tint count;\n\tstruct param_attribute *attribute = to_param_attr(mattr);\n\n\tif (!attribute->param->get)\n\t\treturn -EPERM;\n\n\tcount = attribute->param->get(buf, attribute->param);\n\tif (count > 0) {\n\t\tstrcat(buf, \"\\n\");\n\t\t++count;\n\t}\n\treturn count;\n}\n\n/* sysfs always hands a nul-terminated string in buf. We rely on that. */\nstatic ssize_t param_attr_store(struct module_attribute *mattr,\n\t\t\t\tstruct module *owner,\n\t\t\t\tconst char *buf, size_t len)\n{\n \tint err;\n\tstruct param_attribute *attribute = to_param_attr(mattr);\n\n\tif (!attribute->param->set)\n\t\treturn -EPERM;\n\n\terr = attribute->param->set(buf, attribute->param);\n\tif (!err)\n\t\treturn len;\n\treturn err;\n}\n#endif\n\n#ifdef CONFIG_MODULES\n#define __modinit\n#else\n#define __modinit __init\n#endif\n\n#ifdef CONFIG_SYSFS\n/*\n * param_sysfs_setup - setup sysfs support for one module or KBUILD_MODNAME\n * @mk: struct module_kobject (contains parent kobject)\n * @kparam: array of struct kernel_param, the actual parameter definitions\n * @num_params: number of entries in array\n * @name_skip: offset where the parameter name start in kparam[].name. Needed for built-in \"modules\"\n *\n * Create a kobject for a (per-module) group of parameters, and create files\n * in sysfs. A pointer to the param_kobject is returned on success,\n * NULL if there's no parameter to export, or other ERR_PTR(err).\n */\nstatic __modinit struct module_param_attrs *\nparam_sysfs_setup(struct module_kobject *mk,\n\t\t struct kernel_param *kparam,\n\t\t unsigned int num_params,\n\t\t unsigned int name_skip)\n{\n\tstruct module_param_attrs *mp;\n\tunsigned int valid_attrs = 0;\n\tunsigned int i, size[2];\n\tstruct param_attribute *pattr;\n\tstruct attribute **gattr;\n\tint err;\n\n\tfor (i=0; i<num_params; i++) {\n\t\tif (kparam[i].perm)\n\t\t\tvalid_attrs++;\n\t}\n\n\tif (!valid_attrs)\n\t\treturn NULL;\n\n\tsize[0] = ALIGN(sizeof(*mp) +\n\t\t\tvalid_attrs * sizeof(mp->attrs[0]),\n\t\t\tsizeof(mp->grp.attrs[0]));\n\tsize[1] = (valid_attrs + 1) * sizeof(mp->grp.attrs[0]);\n\n\tmp = kmalloc(size[0] + size[1], GFP_KERNEL);\n\tif (!mp)\n\t\treturn ERR_PTR(-ENOMEM);\n\n\tmp->grp.name = \"parameters\";\n\tmp->grp.attrs = (void *)mp + size[0];\n\n\tpattr = &mp->attrs[0];\n\tgattr = &mp->grp.attrs[0];\n\tfor (i = 0; i < num_params; i++) {\n\t\tstruct kernel_param *kp = &kparam[i];\n\t\tif (kp->perm) {\n\t\t\tpattr->param = kp;\n\t\t\tpattr->mattr.show = param_attr_show;\n\t\t\tpattr->mattr.store = param_attr_store;\n\t\t\tpattr->mattr.attr.name = (char *)&kp->name[name_skip];\n\t\t\tpattr->mattr.attr.owner = mk->mod;\n\t\t\tpattr->mattr.attr.mode = kp->perm;\n\t\t\t*(gattr++) = &(pattr++)->mattr.attr;\n\t\t}\n\t}\n\t*gattr = NULL;\n\n\tif ((err = sysfs_create_group(&mk->kobj, &mp->grp))) {\n\t\tkfree(mp);\n\t\treturn ERR_PTR(err);\n\t}\n\treturn mp;\n}\n\n#ifdef CONFIG_MODULES\n/*\n * module_param_sysfs_setup - setup sysfs support for one module\n * @mod: module\n * @kparam: module parameters (array)\n * @num_params: number of module parameters\n *\n * Adds sysfs entries for module parameters, and creates a link from\n * /sys/module/[mod->name]/parameters to /sys/parameters/[mod->name]/\n */\nint module_param_sysfs_setup(struct module *mod,\n\t\t\t struct kernel_param *kparam,\n\t\t\t unsigned int num_params)\n{\n\tstruct module_param_attrs *mp;\n\n\tmp = param_sysfs_setup(&mod->mkobj, kparam, num_params, 0);\n\tif (IS_ERR(mp))\n\t\treturn PTR_ERR(mp);\n\n\tmod->param_attrs = mp;\n\treturn 0;\n}\n\n/*\n * module_param_sysfs_remove - remove sysfs support for one module\n * @mod: module\n *\n * Remove sysfs entries for module parameters and the corresponding\n * kobject.\n */\nvoid module_param_sysfs_remove(struct module *mod)\n{\n\tif (mod->param_attrs) {\n\t\tsysfs_remove_group(&mod->mkobj.kobj,\n\t\t\t\t &mod->param_attrs->grp);\n\t\t/* We are positive that no one is using any param\n\t\t * attrs at this point. Deallocate immediately. */\n\t\tkfree(mod->param_attrs);\n\t\tmod->param_attrs = NULL;\n\t}\n}\n#endif\n\n/*\n * kernel_param_sysfs_setup - wrapper for built-in params support\n */\nstatic void __init kernel_param_sysfs_setup(const char *name,\n\t\t\t\t\t struct kernel_param *kparam,\n\t\t\t\t\t unsigned int num_params,\n\t\t\t\t\t unsigned int name_skip)\n{\n\tstruct module_kobject *mk;\n\tint ret;\n\n\tmk = kzalloc(sizeof(struct module_kobject), GFP_KERNEL);\n\tBUG_ON(!mk);\n\n\tmk->mod = THIS_MODULE;\n\tkobj_set_kset_s(mk, module_subsys);\n\tkobject_set_name(&mk->kobj, name);\n\tkobject_init(&mk->kobj);\n\tret = kobject_add(&mk->kobj);\n\tBUG_ON(ret < 0);\n\tparam_sysfs_setup(mk, kparam, num_params, name_skip);\n\tkobject_uevent(&mk->kobj, KOBJ_ADD);\n}\n\n/*\n * param_sysfs_builtin - add contents in /sys/parameters for built-in modules\n *\n * Add module_parameters to sysfs for \"modules\" built into the kernel.\n *\n * The \"module\" name (KBUILD_MODNAME) is stored before a dot, the\n * \"parameter\" name is stored behind a dot in kernel_param->name. So,\n * extract the \"module\" name for all built-in kernel_param-eters,\n * and for all who have the same, call kernel_param_sysfs_setup.\n */\nstatic void __init param_sysfs_builtin(void)\n{\n\tstruct kernel_param *kp, *kp_begin = NULL;\n\tunsigned int i, name_len, count = 0;\n\tchar modname[MAX_KBUILD_MODNAME + 1] = \"\";\n\n\tfor (i=0; i < __stop___param - __start___param; i++) {\n\t\tchar *dot;\n\t\tsize_t max_name_len;\n\n\t\tkp = &__start___param[i];\n\t\tmax_name_len =\n\t\t\tmin_t(size_t, MAX_KBUILD_MODNAME, strlen(kp->name));\n\n\t\tdot = memchr(kp->name, '.', max_name_len);\n\t\tif (!dot) {\n\t\t\tDEBUGP(\"couldn't find period in first %d characters \"\n\t\t\t \"of %s\\n\", MAX_KBUILD_MODNAME, kp->name);\n\t\t\tcontinue;\n\t\t}\n\t\tname_len = dot - kp->name;\n\n \t\t/* new kbuild_modname? */\n\t\tif (strlen(modname) != name_len\n\t\t || strncmp(modname, kp->name, name_len) != 0) {\n\t\t\t/* add a new kobject for previous kernel_params. */\n\t\t\tif (count)\n\t\t\t\tkernel_param_sysfs_setup(modname,\n\t\t\t\t\t\t\t kp_begin,\n\t\t\t\t\t\t\t count,\n\t\t\t\t\t\t\t strlen(modname)+1);\n\n\t\t\tstrncpy(modname, kp->name, name_len);\n\t\t\tmodname[name_len] = '\\0';\n\t\t\tcount = 0;\n\t\t\tkp_begin = kp;\n\t\t}\n\t\tcount++;\n\t}\n\n\t/* last kernel_params need to be registered as well */\n\tif (count)\n\t\tkernel_param_sysfs_setup(modname, kp_begin, count,\n\t\t\t\t\t strlen(modname)+1);\n}\n\n\n/* module-related sysfs stuff */\n\n#define to_module_attr(n) container_of(n, struct module_attribute, attr);\n#define to_module_kobject(n) container_of(n, struct module_kobject, kobj);\n\nstatic ssize_t module_attr_show(struct kobject *kobj,\n\t\t\t\tstruct attribute *attr,\n\t\t\t\tchar *buf)\n{\n\tstruct module_attribute *attribute;\n\tstruct module_kobject *mk;\n\tint ret;\n\n\tattribute = to_module_attr(attr);\n\tmk = to_module_kobject(kobj);\n\n\tif (!attribute->show)\n\t\treturn -EIO;\n\n\tret = attribute->show(attribute, mk->mod, buf);\n\n\treturn ret;\n}\n\nstatic ssize_t module_attr_store(struct kobject *kobj,\n\t\t\t\tstruct attribute *attr,\n\t\t\t\tconst char *buf, size_t len)\n{\n\tstruct module_attribute *attribute;\n\tstruct module_kobject *mk;\n\tint ret;\n\n\tattribute = to_module_attr(attr);\n\tmk = to_module_kobject(kobj);\n\n\tif (!attribute->store)\n\t\treturn -EIO;\n\n\tret = attribute->store(attribute, mk->mod, buf, len);\n\n\treturn ret;\n}\n\nstatic struct sysfs_ops module_sysfs_ops = {\n\t.show = module_attr_show,\n\t.store = module_attr_store,\n};\n\nstatic struct kobj_type module_ktype;\n\nstatic int uevent_filter(struct kset *kset, struct kobject *kobj)\n{\n\tstruct kobj_type *ktype = get_ktype(kobj);\n\n\tif (ktype == &module_ktype)\n\t\treturn 1;\n\treturn 0;\n}\n\nstatic struct kset_uevent_ops module_uevent_ops = {\n\t.filter = uevent_filter,\n};\n\ndecl_subsys(module, &module_ktype, &module_uevent_ops);\nint module_sysfs_initialized;\n\nstatic struct kobj_type module_ktype = {\n\t.sysfs_ops =\t&module_sysfs_ops,\n};\n\n/*\n * param_sysfs_init - wrapper for built-in params support\n */\nstatic int __init param_sysfs_init(void)\n{\n\tint ret;\n\n\tret = subsystem_register(&module_subsys);\n\tif (ret < 0) {\n\t\tprintk(KERN_WARNING \"%s (%d): subsystem_register error: %d\\n\",\n\t\t\t__FILE__, __LINE__, ret);\n\t\treturn ret;\n\t}\n\tmodule_sysfs_initialized = 1;\n\n\tparam_sysfs_builtin();\n\n\treturn 0;\n}\nsubsys_initcall(param_sysfs_init);\n\n#else\n#if 0\nstatic struct sysfs_ops module_sysfs_ops = {\n\t.show = NULL,\n\t.store = NULL,\n};\n#endif\n#endif\n\nEXPORT_SYMBOL(param_set_byte);\nEXPORT_SYMBOL(param_get_byte);\nEXPORT_SYMBOL(param_set_short);\nEXPORT_SYMBOL(param_get_short);\nEXPORT_SYMBOL(param_set_ushort);\nEXPORT_SYMBOL(param_get_ushort);\nEXPORT_SYMBOL(param_set_int);\nEXPORT_SYMBOL(param_get_int);\nEXPORT_SYMBOL(param_set_uint);\nEXPORT_SYMBOL(param_get_uint);\nEXPORT_SYMBOL(param_set_long);\nEXPORT_SYMBOL(param_get_long);\nEXPORT_SYMBOL(param_set_ulong);\nEXPORT_SYMBOL(param_get_ulong);\nEXPORT_SYMBOL(param_set_charp);\nEXPORT_SYMBOL(param_get_charp);\nEXPORT_SYMBOL(param_set_bool);\nEXPORT_SYMBOL(param_get_bool);\nEXPORT_SYMBOL(param_set_invbool);\nEXPORT_SYMBOL(param_get_invbool);\nEXPORT_SYMBOL(param_array_set);\nEXPORT_SYMBOL(param_array_get);\nEXPORT_SYMBOL(param_set_copystring);\nEXPORT_SYMBOL(param_get_string);\n/*\n * Generic pidhash and scalable, time-bounded PID allocator\n *\n * (C) 2002-2003 William Irwin, IBM\n * (C) 2004 William Irwin, Oracle\n * (C) 2002-2004 Ingo Molnar, Red Hat\n *\n * pid-structures are backing objects for tasks sharing a given ID to chain\n * against. There is very little to them aside from hashing them and\n * parking tasks using given ID's on a list.\n *\n * The hash is always changed with the tasklist_lock write-acquired,\n * and the hash is only accessed with the tasklist_lock at least\n * read-acquired, so there's no additional SMP locking needed here.\n *\n * We have a list of bitmap pages, which bitmaps represent the PID space.\n * Allocating and freeing PIDs is completely lockless. The worst-case\n * allocation scenario when all but one out of 1 million PIDs possible are\n * allocated already: the scanning of 32 list entries and at most PAGE_SIZE\n * bytes. The typical fastpath is a single successful setbit. Freeing is O(1).\n */\n\n#include <linux/mm.h>\n#include <linux/module.h>\n#include <linux/slab.h>\n#include <linux/init.h>\n#include <linux/bootmem.h>\n#include <linux/hash.h>\n#include <linux/pid_namespace.h>\n#include <linux/init_task.h>\n\n#define pid_hashfn(nr) hash_long((unsigned long)nr, pidhash_shift)\nstatic struct hlist_head *pid_hash;\nstatic int pidhash_shift;\nstatic struct kmem_cache *pid_cachep;\nstruct pid init_struct_pid = INIT_STRUCT_PID;\n\nint pid_max = PID_MAX_DEFAULT;\n\n#define RESERVED_PIDS\t\t300\n\nint pid_max_min = RESERVED_PIDS + 1;\nint pid_max_max = PID_MAX_LIMIT;\n\n#define BITS_PER_PAGE\t\t(PAGE_SIZE*8)\n#define BITS_PER_PAGE_MASK\t(BITS_PER_PAGE-1)\n\nstatic inline int mk_pid(struct pid_namespace *pid_ns,\n\t\tstruct pidmap *map, int off)\n{\n\treturn (map - pid_ns->pidmap)*BITS_PER_PAGE + off;\n}\n\n#define find_next_offset(map, off)\t\t\t\t\t\\\n\t\tfind_next_zero_bit((map)->page, BITS_PER_PAGE, off)\n\n/*\n * PID-map pages start out as NULL, they get allocated upon\n * first use and are never deallocated. This way a low pid_max\n * value does not cause lots of bitmaps to be allocated, but\n * the scheme scales to up to 4 million PIDs, runtime.\n */\nstruct pid_namespace init_pid_ns = {\n\t.kref = {\n\t\t.refcount = ATOMIC_INIT(2),\n\t},\n\t.pidmap = {\n\t\t[ 0 ... PIDMAP_ENTRIES-1] = { ATOMIC_INIT(BITS_PER_PAGE), NULL }\n\t},\n\t.last_pid = 0,\n\t.child_reaper = &init_task\n};\n\n/*\n * Note: disable interrupts while the pidmap_lock is held as an\n * interrupt might come in and do read_lock(&tasklist_lock).\n *\n * If we don't disable interrupts there is a nasty deadlock between\n * detach_pid()->free_pid() and another cpu that does\n * spin_lock(&pidmap_lock) followed by an interrupt routine that does\n * read_lock(&tasklist_lock);\n *\n * After we clean up the tasklist_lock and know there are no\n * irq handlers that take it we can leave the interrupts enabled.\n * For now it is easier to be safe than to prove it can't happen.\n */\n\nstatic __cacheline_aligned_in_smp DEFINE_SPINLOCK(pidmap_lock);\n\nstatic fastcall void free_pidmap(struct pid_namespace *pid_ns, int pid)\n{\n\tstruct pidmap *map = pid_ns->pidmap + pid / BITS_PER_PAGE;\n\tint offset = pid & BITS_PER_PAGE_MASK;\n\n\tclear_bit(offset, map->page);\n\tatomic_inc(&map->nr_free);\n}\n\nstatic int alloc_pidmap(struct pid_namespace *pid_ns)\n{\n\tint i, offset, max_scan, pid, last = pid_ns->last_pid;\n\tstruct pidmap *map;\n\n\tpid = last + 1;\n\tif (pid >= pid_max)\n\t\tpid = RESERVED_PIDS;\n\toffset = pid & BITS_PER_PAGE_MASK;\n\tmap = &pid_ns->pidmap[pid/BITS_PER_PAGE];\n\tmax_scan = (pid_max + BITS_PER_PAGE - 1)/BITS_PER_PAGE - !offset;\n\tfor (i = 0; i <= max_scan; ++i) {\n\t\tif (unlikely(!map->page)) {\n\t\t\tvoid *page = kzalloc(PAGE_SIZE, GFP_KERNEL);\n\t\t\t/*\n\t\t\t * Free the page if someone raced with us\n\t\t\t * installing it:\n\t\t\t */\n\t\t\tspin_lock_irq(&pidmap_lock);\n\t\t\tif (map->page)\n\t\t\t\tkfree(page);\n\t\t\telse\n\t\t\t\tmap->page = page;\n\t\t\tspin_unlock_irq(&pidmap_lock);\n\t\t\tif (unlikely(!map->page))\n\t\t\t\tbreak;\n\t\t}\n\t\tif (likely(atomic_read(&map->nr_free))) {\n\t\t\tdo {\n\t\t\t\tif (!test_and_set_bit(offset, map->page)) {\n\t\t\t\t\tatomic_dec(&map->nr_free);\n\t\t\t\t\tpid_ns->last_pid = pid;\n\t\t\t\t\treturn pid;\n\t\t\t\t}\n\t\t\t\toffset = find_next_offset(map, offset);\n\t\t\t\tpid = mk_pid(pid_ns, map, offset);\n\t\t\t/*\n\t\t\t * find_next_offset() found a bit, the pid from it\n\t\t\t * is in-bounds, and if we fell back to the last\n\t\t\t * bitmap block and the final block was the same\n\t\t\t * as the starting point, pid is before last_pid.\n\t\t\t */\n\t\t\t} while (offset < BITS_PER_PAGE && pid < pid_max &&\n\t\t\t\t\t(i != max_scan || pid < last ||\n\t\t\t\t\t !((last+1) & BITS_PER_PAGE_MASK)));\n\t\t}\n\t\tif (map < &pid_ns->pidmap[(pid_max-1)/BITS_PER_PAGE]) {\n\t\t\t++map;\n\t\t\toffset = 0;\n\t\t} else {\n\t\t\tmap = &pid_ns->pidmap[0];\n\t\t\toffset = RESERVED_PIDS;\n\t\t\tif (unlikely(last == offset))\n\t\t\t\tbreak;\n\t\t}\n\t\tpid = mk_pid(pid_ns, map, offset);\n\t}\n\treturn -1;\n}\n\nstatic int next_pidmap(struct pid_namespace *pid_ns, int last)\n{\n\tint offset;\n\tstruct pidmap *map, *end;\n\n\toffset = (last + 1) & BITS_PER_PAGE_MASK;\n\tmap = &pid_ns->pidmap[(last + 1)/BITS_PER_PAGE];\n\tend = &pid_ns->pidmap[PIDMAP_ENTRIES];\n\tfor (; map < end; map++, offset = 0) {\n\t\tif (unlikely(!map->page))\n\t\t\tcontinue;\n\t\toffset = find_next_bit((map)->page, BITS_PER_PAGE, offset);\n\t\tif (offset < BITS_PER_PAGE)\n\t\t\treturn mk_pid(pid_ns, map, offset);\n\t}\n\treturn -1;\n}\n\nfastcall void put_pid(struct pid *pid)\n{\n\tif (!pid)\n\t\treturn;\n\tif ((atomic_read(&pid->count) == 1) ||\n\t atomic_dec_and_test(&pid->count))\n\t\tkmem_cache_free(pid_cachep, pid);\n}\nEXPORT_SYMBOL_GPL(put_pid);\n\nstatic void delayed_put_pid(struct rcu_head *rhp)\n{\n\tstruct pid *pid = container_of(rhp, struct pid, rcu);\n\tput_pid(pid);\n}\n\nfastcall void free_pid(struct pid *pid)\n{\n\t/* We can be called with write_lock_irq(&tasklist_lock) held */\n\tunsigned long flags;\n\n\tspin_lock_irqsave(&pidmap_lock, flags);\n\thlist_del_rcu(&pid->pid_chain);\n\tspin_unlock_irqrestore(&pidmap_lock, flags);\n\n\tfree_pidmap(&init_pid_ns, pid->nr);\n\tcall_rcu(&pid->rcu, delayed_put_pid);\n}\n\nstruct pid *alloc_pid(void)\n{\n\tstruct pid *pid;\n\tenum pid_type type;\n\tint nr = -1;\n\n\tpid = kmem_cache_alloc(pid_cachep, GFP_KERNEL);\n\tif (!pid)\n\t\tgoto out;\n\n\tnr = alloc_pidmap(current->nsproxy->pid_ns);\n\tif (nr < 0)\n\t\tgoto out_free;\n\n\tatomic_set(&pid->count, 1);\n\tpid->nr = nr;\n\tfor (type = 0; type < PIDTYPE_MAX; ++type)\n\t\tINIT_HLIST_HEAD(&pid->tasks[type]);\n\n\tspin_lock_irq(&pidmap_lock);\n\thlist_add_head_rcu(&pid->pid_chain, &pid_hash[pid_hashfn(pid->nr)]);\n\tspin_unlock_irq(&pidmap_lock);\n\nout:\n\treturn pid;\n\nout_free:\n\tkmem_cache_free(pid_cachep, pid);\n\tpid = NULL;\n\tgoto out;\n}\n\nstruct pid * fastcall find_pid(int nr)\n{\n\tstruct hlist_node *elem;\n\tstruct pid *pid;\n\n\thlist_for_each_entry_rcu(pid, elem,\n\t\t\t&pid_hash[pid_hashfn(nr)], pid_chain) {\n\t\tif (pid->nr == nr)\n\t\t\treturn pid;\n\t}\n\treturn NULL;\n}\nEXPORT_SYMBOL_GPL(find_pid);\n\n/*\n * attach_pid() must be called with the tasklist_lock write-held.\n */\nint fastcall attach_pid(struct task_struct *task, enum pid_type type,\n\t\tstruct pid *pid)\n{\n\tstruct pid_link *link;\n\n\tlink = &task->pids[type];\n\tlink->pid = pid;\n\thlist_add_head_rcu(&link->node, &pid->tasks[type]);\n\n\treturn 0;\n}\n\nvoid fastcall detach_pid(struct task_struct *task, enum pid_type type)\n{\n\tstruct pid_link *link;\n\tstruct pid *pid;\n\tint tmp;\n\n\tlink = &task->pids[type];\n\tpid = link->pid;\n\n\thlist_del_rcu(&link->node);\n\tlink->pid = NULL;\n\n\tfor (tmp = PIDTYPE_MAX; --tmp >= 0; )\n\t\tif (!hlist_empty(&pid->tasks[tmp]))\n\t\t\treturn;\n\n\tfree_pid(pid);\n}\n\n/* transfer_pid is an optimization of attach_pid(new), detach_pid(old) */\nvoid fastcall transfer_pid(struct task_struct *old, struct task_struct *new,\n\t\t\t enum pid_type type)\n{\n\tnew->pids[type].pid = old->pids[type].pid;\n\thlist_replace_rcu(&old->pids[type].node, &new->pids[type].node);\n\told->pids[type].pid = NULL;\n}\n\nstruct task_struct * fastcall pid_task(struct pid *pid, enum pid_type type)\n{\n\tstruct task_struct *result = NULL;\n\tif (pid) {\n\t\tstruct hlist_node *first;\n\t\tfirst = rcu_dereference(pid->tasks[type].first);\n\t\tif (first)\n\t\t\tresult = hlist_entry(first, struct task_struct, pids[(type)].node);\n\t}\n\treturn result;\n}\n\n/*\n * Must be called under rcu_read_lock() or with tasklist_lock read-held.\n */\nstruct task_struct *find_task_by_pid_type(int type, int nr)\n{\n\treturn pid_task(find_pid(nr), type);\n}\n\nEXPORT_SYMBOL(find_task_by_pid_type);\n\nstruct pid *get_task_pid(struct task_struct *task, enum pid_type type)\n{\n\tstruct pid *pid;\n\trcu_read_lock();\n\tpid = get_pid(task->pids[type].pid);\n\trcu_read_unlock();\n\treturn pid;\n}\n\nstruct task_struct *fastcall get_pid_task(struct pid *pid, enum pid_type type)\n{\n\tstruct task_struct *result;\n\trcu_read_lock();\n\tresult = pid_task(pid, type);\n\tif (result)\n\t\tget_task_struct(result);\n\trcu_read_unlock();\n\treturn result;\n}\n\nstruct pid *find_get_pid(pid_t nr)\n{\n\tstruct pid *pid;\n\n\trcu_read_lock();\n\tpid = get_pid(find_pid(nr));\n\trcu_read_unlock();\n\n\treturn pid;\n}\n\n/*\n * Used by proc to find the first pid that is greater then or equal to nr.\n *\n * If there is a pid at nr this function is exactly the same as find_pid.\n */\nstruct pid *find_ge_pid(int nr)\n{\n\tstruct pid *pid;\n\n\tdo {\n\t\tpid = find_pid(nr);\n\t\tif (pid)\n\t\t\tbreak;\n\t\tnr = next_pidmap(current->nsproxy->pid_ns, nr);\n\t} while (nr > 0);\n\n\treturn pid;\n}\nEXPORT_SYMBOL_GPL(find_get_pid);\n\nstruct pid_namespace *copy_pid_ns(int flags, struct pid_namespace *old_ns)\n{\n\tBUG_ON(!old_ns);\n\tget_pid_ns(old_ns);\n\treturn old_ns;\n}\n\nvoid free_pid_ns(struct kref *kref)\n{\n\tstruct pid_namespace *ns;\n\n\tns = container_of(kref, struct pid_namespace, kref);\n\tkfree(ns);\n}\n\n/*\n * The pid hash table is scaled according to the amount of memory in the\n * machine. From a minimum of 16 slots up to 4096 slots at one gigabyte or\n * more.\n */\nvoid __init pidhash_init(void)\n{\n\tint i, pidhash_size;\n\tunsigned long megabytes = nr_kernel_pages >> (20 - PAGE_SHIFT);\n\n\tpidhash_shift = max(4, fls(megabytes * 4));\n\tpidhash_shift = min(12, pidhash_shift);\n\tpidhash_size = 1 << pidhash_shift;\n\n\tprintk(\"PID hash table entries: %d (order: %d, %Zd bytes)\\n\",\n\t\tpidhash_size, pidhash_shift,\n\t\tpidhash_size * sizeof(struct hlist_head));\n\n\tpid_hash = alloc_bootmem(pidhash_size *\tsizeof(*(pid_hash)));\n\tif (!pid_hash)\n\t\tpanic(\"Could not alloc pidhash!\\n\");\n\tfor (i = 0; i < pidhash_size; i++)\n\t\tINIT_HLIST_HEAD(&pid_hash[i]);\n}\n\nvoid __init pidmap_init(void)\n{\n\tinit_pid_ns.pidmap[0].page = kzalloc(PAGE_SIZE, GFP_KERNEL);\n\t/* Reserve PID 0. We never call free_pidmap(0) */\n\tset_bit(0, init_pid_ns.pidmap[0].page);\n\tatomic_dec(&init_pid_ns.pidmap[0].nr_free);\n\n\tpid_cachep = KMEM_CACHE(pid, SLAB_PANIC);\n}\n/*\n * Implement CPU time clocks for the POSIX clock interface.\n */\n\n#include <linux/sched.h>\n#include <linux/posix-timers.h>\n#include <asm/uaccess.h>\n#include <linux/errno.h>\n\nstatic int check_clock(const clockid_t which_clock)\n{\n\tint error = 0;\n\tstruct task_struct *p;\n\tconst pid_t pid = CPUCLOCK_PID(which_clock);\n\n\tif (CPUCLOCK_WHICH(which_clock) >= CPUCLOCK_MAX)\n\t\treturn -EINVAL;\n\n\tif (pid == 0)\n\t\treturn 0;\n\n\tread_lock(&tasklist_lock);\n\tp = find_task_by_pid(pid);\n\tif (!p || (CPUCLOCK_PERTHREAD(which_clock) ?\n\t\t p->tgid != current->tgid : p->tgid != pid)) {\n\t\terror = -EINVAL;\n\t}\n\tread_unlock(&tasklist_lock);\n\n\treturn error;\n}\n\nstatic inline union cpu_time_count\ntimespec_to_sample(const clockid_t which_clock, const struct timespec *tp)\n{\n\tunion cpu_time_count ret;\n\tret.sched = 0;\t\t/* high half always zero when .cpu used */\n\tif (CPUCLOCK_WHICH(which_clock) == CPUCLOCK_SCHED) {\n\t\tret.sched = (unsigned long long)tp->tv_sec * NSEC_PER_SEC + tp->tv_nsec;\n\t} else {\n\t\tret.cpu = timespec_to_cputime(tp);\n\t}\n\treturn ret;\n}\n\nstatic void sample_to_timespec(const clockid_t which_clock,\n\t\t\t union cpu_time_count cpu,\n\t\t\t struct timespec *tp)\n{\n\tif (CPUCLOCK_WHICH(which_clock) == CPUCLOCK_SCHED) {\n\t\ttp->tv_sec = div_long_long_rem(cpu.sched,\n\t\t\t\t\t NSEC_PER_SEC, &tp->tv_nsec);\n\t} else {\n\t\tcputime_to_timespec(cpu.cpu, tp);\n\t}\n}\n\nstatic inline int cpu_time_before(const clockid_t which_clock,\n\t\t\t\t union cpu_time_count now,\n\t\t\t\t union cpu_time_count then)\n{\n\tif (CPUCLOCK_WHICH(which_clock) == CPUCLOCK_SCHED) {\n\t\treturn now.sched < then.sched;\n\t} else {\n\t\treturn cputime_lt(now.cpu, then.cpu);\n\t}\n}\nstatic inline void cpu_time_add(const clockid_t which_clock,\n\t\t\t\tunion cpu_time_count *acc,\n\t\t\t union cpu_time_count val)\n{\n\tif (CPUCLOCK_WHICH(which_clock) == CPUCLOCK_SCHED) {\n\t\tacc->sched += val.sched;\n\t} else {\n\t\tacc->cpu = cputime_add(acc->cpu, val.cpu);\n\t}\n}\nstatic inline union cpu_time_count cpu_time_sub(const clockid_t which_clock,\n\t\t\t\t\t\tunion cpu_time_count a,\n\t\t\t\t\t\tunion cpu_time_count b)\n{\n\tif (CPUCLOCK_WHICH(which_clock) == CPUCLOCK_SCHED) {\n\t\ta.sched -= b.sched;\n\t} else {\n\t\ta.cpu = cputime_sub(a.cpu, b.cpu);\n\t}\n\treturn a;\n}\n\n/*\n * Divide and limit the result to res >= 1\n *\n * This is necessary to prevent signal delivery starvation, when the result of\n * the division would be rounded down to 0.\n */\nstatic inline cputime_t cputime_div_non_zero(cputime_t time, unsigned long div)\n{\n\tcputime_t res = cputime_div(time, div);\n\n\treturn max_t(cputime_t, res, 1);\n}\n\n/*\n * Update expiry time from increment, and increase overrun count,\n * given the current clock sample.\n */\nstatic void bump_cpu_timer(struct k_itimer *timer,\n\t\t\t\t union cpu_time_count now)\n{\n\tint i;\n\n\tif (timer->it.cpu.incr.sched == 0)\n\t\treturn;\n\n\tif (CPUCLOCK_WHICH(timer->it_clock) == CPUCLOCK_SCHED) {\n\t\tunsigned long long delta, incr;\n\n\t\tif (now.sched < timer->it.cpu.expires.sched)\n\t\t\treturn;\n\t\tincr = timer->it.cpu.incr.sched;\n\t\tdelta = now.sched + incr - timer->it.cpu.expires.sched;\n\t\t/* Don't use (incr*2 < delta), incr*2 might overflow. */\n\t\tfor (i = 0; incr < delta - incr; i++)\n\t\t\tincr = incr << 1;\n\t\tfor (; i >= 0; incr >>= 1, i--) {\n\t\t\tif (delta < incr)\n\t\t\t\tcontinue;\n\t\t\ttimer->it.cpu.expires.sched += incr;\n\t\t\ttimer->it_overrun += 1 << i;\n\t\t\tdelta -= incr;\n\t\t}\n\t} else {\n\t\tcputime_t delta, incr;\n\n\t\tif (cputime_lt(now.cpu, timer->it.cpu.expires.cpu))\n\t\t\treturn;\n\t\tincr = timer->it.cpu.incr.cpu;\n\t\tdelta = cputime_sub(cputime_add(now.cpu, incr),\n\t\t\t\t timer->it.cpu.expires.cpu);\n\t\t/* Don't use (incr*2 < delta), incr*2 might overflow. */\n\t\tfor (i = 0; cputime_lt(incr, cputime_sub(delta, incr)); i++)\n\t\t\t incr = cputime_add(incr, incr);\n\t\tfor (; i >= 0; incr = cputime_halve(incr), i--) {\n\t\t\tif (cputime_lt(delta, incr))\n\t\t\t\tcontinue;\n\t\t\ttimer->it.cpu.expires.cpu =\n\t\t\t\tcputime_add(timer->it.cpu.expires.cpu, incr);\n\t\t\ttimer->it_overrun += 1 << i;\n\t\t\tdelta = cputime_sub(delta, incr);\n\t\t}\n\t}\n}\n\nstatic inline cputime_t prof_ticks(struct task_struct *p)\n{\n\treturn cputime_add(p->utime, p->stime);\n}\nstatic inline cputime_t virt_ticks(struct task_struct *p)\n{\n\treturn p->utime;\n}\nstatic inline unsigned long long sched_ns(struct task_struct *p)\n{\n\treturn (p == current) ? current_sched_time(p) : p->sched_time;\n}\n\nint posix_cpu_clock_getres(const clockid_t which_clock, struct timespec *tp)\n{\n\tint error = check_clock(which_clock);\n\tif (!error) {\n\t\ttp->tv_sec = 0;\n\t\ttp->tv_nsec = ((NSEC_PER_SEC + HZ - 1) / HZ);\n\t\tif (CPUCLOCK_WHICH(which_clock) == CPUCLOCK_SCHED) {\n\t\t\t/*\n\t\t\t * If sched_clock is using a cycle counter, we\n\t\t\t * don't have any idea of its true resolution\n\t\t\t * exported, but it is much more than 1s/HZ.\n\t\t\t */\n\t\t\ttp->tv_nsec = 1;\n\t\t}\n\t}\n\treturn error;\n}\n\nint posix_cpu_clock_set(const clockid_t which_clock, const struct timespec *tp)\n{\n\t/*\n\t * You can never reset a CPU clock, but we check for other errors\n\t * in the call before failing with EPERM.\n\t */\n\tint error = check_clock(which_clock);\n\tif (error == 0) {\n\t\terror = -EPERM;\n\t}\n\treturn error;\n}\n\n\n/*\n * Sample a per-thread clock for the given task.\n */\nstatic int cpu_clock_sample(const clockid_t which_clock, struct task_struct *p,\n\t\t\t union cpu_time_count *cpu)\n{\n\tswitch (CPUCLOCK_WHICH(which_clock)) {\n\tdefault:\n\t\treturn -EINVAL;\n\tcase CPUCLOCK_PROF:\n\t\tcpu->cpu = prof_ticks(p);\n\t\tbreak;\n\tcase CPUCLOCK_VIRT:\n\t\tcpu->cpu = virt_ticks(p);\n\t\tbreak;\n\tcase CPUCLOCK_SCHED:\n\t\tcpu->sched = sched_ns(p);\n\t\tbreak;\n\t}\n\treturn 0;\n}\n\n/*\n * Sample a process (thread group) clock for the given group_leader task.\n * Must be called with tasklist_lock held for reading.\n * Must be called with tasklist_lock held for reading, and p->sighand->siglock.\n */\nstatic int cpu_clock_sample_group_locked(unsigned int clock_idx,\n\t\t\t\t\t struct task_struct *p,\n\t\t\t\t\t union cpu_time_count *cpu)\n{\n\tstruct task_struct *t = p;\n \tswitch (clock_idx) {\n\tdefault:\n\t\treturn -EINVAL;\n\tcase CPUCLOCK_PROF:\n\t\tcpu->cpu = cputime_add(p->signal->utime, p->signal->stime);\n\t\tdo {\n\t\t\tcpu->cpu = cputime_add(cpu->cpu, prof_ticks(t));\n\t\t\tt = next_thread(t);\n\t\t} while (t != p);\n\t\tbreak;\n\tcase CPUCLOCK_VIRT:\n\t\tcpu->cpu = p->signal->utime;\n\t\tdo {\n\t\t\tcpu->cpu = cputime_add(cpu->cpu, virt_ticks(t));\n\t\t\tt = next_thread(t);\n\t\t} while (t != p);\n\t\tbreak;\n\tcase CPUCLOCK_SCHED:\n\t\tcpu->sched = p->signal->sched_time;\n\t\t/* Add in each other live thread. */\n\t\twhile ((t = next_thread(t)) != p) {\n\t\t\tcpu->sched += t->sched_time;\n\t\t}\n\t\tcpu->sched += sched_ns(p);\n\t\tbreak;\n\t}\n\treturn 0;\n}\n\n/*\n * Sample a process (thread group) clock for the given group_leader task.\n * Must be called with tasklist_lock held for reading.\n */\nstatic int cpu_clock_sample_group(const clockid_t which_clock,\n\t\t\t\t struct task_struct *p,\n\t\t\t\t union cpu_time_count *cpu)\n{\n\tint ret;\n\tunsigned long flags;\n\tspin_lock_irqsave(&p->sighand->siglock, flags);\n\tret = cpu_clock_sample_group_locked(CPUCLOCK_WHICH(which_clock), p,\n\t\t\t\t\t cpu);\n\tspin_unlock_irqrestore(&p->sighand->siglock, flags);\n\treturn ret;\n}\n\n\nint posix_cpu_clock_get(const clockid_t which_clock, struct timespec *tp)\n{\n\tconst pid_t pid = CPUCLOCK_PID(which_clock);\n\tint error = -EINVAL;\n\tunion cpu_time_count rtn;\n\n\tif (pid == 0) {\n\t\t/*\n\t\t * Special case constant value for our own clocks.\n\t\t * We don't have to do any lookup to find ourselves.\n\t\t */\n\t\tif (CPUCLOCK_PERTHREAD(which_clock)) {\n\t\t\t/*\n\t\t\t * Sampling just ourselves we can do with no locking.\n\t\t\t */\n\t\t\terror = cpu_clock_sample(which_clock,\n\t\t\t\t\t\t current, &rtn);\n\t\t} else {\n\t\t\tread_lock(&tasklist_lock);\n\t\t\terror = cpu_clock_sample_group(which_clock,\n\t\t\t\t\t\t current, &rtn);\n\t\t\tread_unlock(&tasklist_lock);\n\t\t}\n\t} else {\n\t\t/*\n\t\t * Find the given PID, and validate that the caller\n\t\t * should be able to see it.\n\t\t */\n\t\tstruct task_struct *p;\n\t\trcu_read_lock();\n\t\tp = find_task_by_pid(pid);\n\t\tif (p) {\n\t\t\tif (CPUCLOCK_PERTHREAD(which_clock)) {\n\t\t\t\tif (p->tgid == current->tgid) {\n\t\t\t\t\terror = cpu_clock_sample(which_clock,\n\t\t\t\t\t\t\t\t p, &rtn);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tread_lock(&tasklist_lock);\n\t\t\t\tif (p->tgid == pid && p->signal) {\n\t\t\t\t\terror =\n\t\t\t\t\t cpu_clock_sample_group(which_clock,\n\t\t\t\t\t\t\t p, &rtn);\n\t\t\t\t}\n\t\t\t\tread_unlock(&tasklist_lock);\n\t\t\t}\n\t\t}\n\t\trcu_read_unlock();\n\t}\n\n\tif (error)\n\t\treturn error;\n\tsample_to_timespec(which_clock, rtn, tp);\n\treturn 0;\n}\n\n\n/*\n * Validate the clockid_t for a new CPU-clock timer, and initialize the timer.\n * This is called from sys_timer_create with the new timer already locked.\n */\nint posix_cpu_timer_create(struct k_itimer *new_timer)\n{\n\tint ret = 0;\n\tconst pid_t pid = CPUCLOCK_PID(new_timer->it_clock);\n\tstruct task_struct *p;\n\n\tif (CPUCLOCK_WHICH(new_timer->it_clock) >= CPUCLOCK_MAX)\n\t\treturn -EINVAL;\n\n\tINIT_LIST_HEAD(&new_timer->it.cpu.entry);\n\tnew_timer->it.cpu.incr.sched = 0;\n\tnew_timer->it.cpu.expires.sched = 0;\n\n\tread_lock(&tasklist_lock);\n\tif (CPUCLOCK_PERTHREAD(new_timer->it_clock)) {\n\t\tif (pid == 0) {\n\t\t\tp = current;\n\t\t} else {\n\t\t\tp = find_task_by_pid(pid);\n\t\t\tif (p && p->tgid != current->tgid)\n\t\t\t\tp = NULL;\n\t\t}\n\t} else {\n\t\tif (pid == 0) {\n\t\t\tp = current->group_leader;\n\t\t} else {\n\t\t\tp = find_task_by_pid(pid);\n\t\t\tif (p && p->tgid != pid)\n\t\t\t\tp = NULL;\n\t\t}\n\t}\n\tnew_timer->it.cpu.task = p;\n\tif (p) {\n\t\tget_task_struct(p);\n\t} else {\n\t\tret = -EINVAL;\n\t}\n\tread_unlock(&tasklist_lock);\n\n\treturn ret;\n}\n\n/*\n * Clean up a CPU-clock timer that is about to be destroyed.\n * This is called from timer deletion with the timer already locked.\n * If we return TIMER_RETRY, it's necessary to release the timer's lock\n * and try again. (This happens when the timer is in the middle of firing.)\n */\nint posix_cpu_timer_del(struct k_itimer *timer)\n{\n\tstruct task_struct *p = timer->it.cpu.task;\n\tint ret = 0;\n\n\tif (likely(p != NULL)) {\n\t\tread_lock(&tasklist_lock);\n\t\tif (unlikely(p->signal == NULL)) {\n\t\t\t/*\n\t\t\t * We raced with the reaping of the task.\n\t\t\t * The deletion should have cleared us off the list.\n\t\t\t */\n\t\t\tBUG_ON(!list_empty(&timer->it.cpu.entry));\n\t\t} else {\n\t\t\tspin_lock(&p->sighand->siglock);\n\t\t\tif (timer->it.cpu.firing)\n\t\t\t\tret = TIMER_RETRY;\n\t\t\telse\n\t\t\t\tlist_del(&timer->it.cpu.entry);\n\t\t\tspin_unlock(&p->sighand->siglock);\n\t\t}\n\t\tread_unlock(&tasklist_lock);\n\n\t\tif (!ret)\n\t\t\tput_task_struct(p);\n\t}\n\n\treturn ret;\n}\n\n/*\n * Clean out CPU timers still ticking when a thread exited. The task\n * pointer is cleared, and the expiry time is replaced with the residual\n * time for later timer_gettime calls to return.\n * This must be called with the siglock held.\n */\nstatic void cleanup_timers(struct list_head *head,\n\t\t\t cputime_t utime, cputime_t stime,\n\t\t\t unsigned long long sched_time)\n{\n\tstruct cpu_timer_list *timer, *next;\n\tcputime_t ptime = cputime_add(utime, stime);\n\n\tlist_for_each_entry_safe(timer, next, head, entry) {\n\t\tlist_del_init(&timer->entry);\n\t\tif (cputime_lt(timer->expires.cpu, ptime)) {\n\t\t\ttimer->expires.cpu = cputime_zero;\n\t\t} else {\n\t\t\ttimer->expires.cpu = cputime_sub(timer->expires.cpu,\n\t\t\t\t\t\t\t ptime);\n\t\t}\n\t}\n\n\t++head;\n\tlist_for_each_entry_safe(timer, next, head, entry) {\n\t\tlist_del_init(&timer->entry);\n\t\tif (cputime_lt(timer->expires.cpu, utime)) {\n\t\t\ttimer->expires.cpu = cputime_zero;\n\t\t} else {\n\t\t\ttimer->expires.cpu = cputime_sub(timer->expires.cpu,\n\t\t\t\t\t\t\t utime);\n\t\t}\n\t}\n\n\t++head;\n\tlist_for_each_entry_safe(timer, next, head, entry) {\n\t\tlist_del_init(&timer->entry);\n\t\tif (timer->expires.sched < sched_time) {\n\t\t\ttimer->expires.sched = 0;\n\t\t} else {\n\t\t\ttimer->expires.sched -= sched_time;\n\t\t}\n\t}\n}\n\n/*\n * These are both called with the siglock held, when the current thread\n * is being reaped. When the final (leader) thread in the group is reaped,\n * posix_cpu_timers_exit_group will be called after posix_cpu_timers_exit.\n */\nvoid posix_cpu_timers_exit(struct task_struct *tsk)\n{\n\tcleanup_timers(tsk->cpu_timers,\n\t\t tsk->utime, tsk->stime, tsk->sched_time);\n\n}\nvoid posix_cpu_timers_exit_group(struct task_struct *tsk)\n{\n\tcleanup_timers(tsk->signal->cpu_timers,\n\t\t cputime_add(tsk->utime, tsk->signal->utime),\n\t\t cputime_add(tsk->stime, tsk->signal->stime),\n\t\t tsk->sched_time + tsk->signal->sched_time);\n}\n\n\n/*\n * Set the expiry times of all the threads in the process so one of them\n * will go off before the process cumulative expiry total is reached.\n */\nstatic void process_timer_rebalance(struct task_struct *p,\n\t\t\t\t unsigned int clock_idx,\n\t\t\t\t union cpu_time_count expires,\n\t\t\t\t union cpu_time_count val)\n{\n\tcputime_t ticks, left;\n\tunsigned long long ns, nsleft;\n \tstruct task_struct *t = p;\n\tunsigned int nthreads = atomic_read(&p->signal->live);\n\n\tif (!nthreads)\n\t\treturn;\n\n\tswitch (clock_idx) {\n\tdefault:\n\t\tBUG();\n\t\tbreak;\n\tcase CPUCLOCK_PROF:\n\t\tleft = cputime_div_non_zero(cputime_sub(expires.cpu, val.cpu),\n\t\t\t\t nthreads);\n\t\tdo {\n\t\t\tif (likely(!(t->flags & PF_EXITING))) {\n\t\t\t\tticks = cputime_add(prof_ticks(t), left);\n\t\t\t\tif (cputime_eq(t->it_prof_expires,\n\t\t\t\t\t cputime_zero) ||\n\t\t\t\t cputime_gt(t->it_prof_expires, ticks)) {\n\t\t\t\t\tt->it_prof_expires = ticks;\n\t\t\t\t}\n\t\t\t}\n\t\t\tt = next_thread(t);\n\t\t} while (t != p);\n\t\tbreak;\n\tcase CPUCLOCK_VIRT:\n\t\tleft = cputime_div_non_zero(cputime_sub(expires.cpu, val.cpu),\n\t\t\t\t nthreads);\n\t\tdo {\n\t\t\tif (likely(!(t->flags & PF_EXITING))) {\n\t\t\t\tticks = cputime_add(virt_ticks(t), left);\n\t\t\t\tif (cputime_eq(t->it_virt_expires,\n\t\t\t\t\t cputime_zero) ||\n\t\t\t\t cputime_gt(t->it_virt_expires, ticks)) {\n\t\t\t\t\tt->it_virt_expires = ticks;\n\t\t\t\t}\n\t\t\t}\n\t\t\tt = next_thread(t);\n\t\t} while (t != p);\n\t\tbreak;\n\tcase CPUCLOCK_SCHED:\n\t\tnsleft = expires.sched - val.sched;\n\t\tdo_div(nsleft, nthreads);\n\t\tnsleft = max_t(unsigned long long, nsleft, 1);\n\t\tdo {\n\t\t\tif (likely(!(t->flags & PF_EXITING))) {\n\t\t\t\tns = t->sched_time + nsleft;\n\t\t\t\tif (t->it_sched_expires == 0 ||\n\t\t\t\t t->it_sched_expires > ns) {\n\t\t\t\t\tt->it_sched_expires = ns;\n\t\t\t\t}\n\t\t\t}\n\t\t\tt = next_thread(t);\n\t\t} while (t != p);\n\t\tbreak;\n\t}\n}\n\nstatic void clear_dead_task(struct k_itimer *timer, union cpu_time_count now)\n{\n\t/*\n\t * That's all for this thread or process.\n\t * We leave our residual in expires to be reported.\n\t */\n\tput_task_struct(timer->it.cpu.task);\n\ttimer->it.cpu.task = NULL;\n\ttimer->it.cpu.expires = cpu_time_sub(timer->it_clock,\n\t\t\t\t\t timer->it.cpu.expires,\n\t\t\t\t\t now);\n}\n\n/*\n * Insert the timer on the appropriate list before any timers that\n * expire later. This must be called with the tasklist_lock held\n * for reading, and interrupts disabled.\n */\nstatic void arm_timer(struct k_itimer *timer, union cpu_time_count now)\n{\n\tstruct task_struct *p = timer->it.cpu.task;\n\tstruct list_head *head, *listpos;\n\tstruct cpu_timer_list *const nt = &timer->it.cpu;\n\tstruct cpu_timer_list *next;\n\tunsigned long i;\n\n\thead = (CPUCLOCK_PERTHREAD(timer->it_clock) ?\n\t\tp->cpu_timers : p->signal->cpu_timers);\n\thead += CPUCLOCK_WHICH(timer->it_clock);\n\n\tBUG_ON(!irqs_disabled());\n\tspin_lock(&p->sighand->siglock);\n\n\tlistpos = head;\n\tif (CPUCLOCK_WHICH(timer->it_clock) == CPUCLOCK_SCHED) {\n\t\tlist_for_each_entry(next, head, entry) {\n\t\t\tif (next->expires.sched > nt->expires.sched)\n\t\t\t\tbreak;\n\t\t\tlistpos = &next->entry;\n\t\t}\n\t} else {\n\t\tlist_for_each_entry(next, head, entry) {\n\t\t\tif (cputime_gt(next->expires.cpu, nt->expires.cpu))\n\t\t\t\tbreak;\n\t\t\tlistpos = &next->entry;\n\t\t}\n\t}\n\tlist_add(&nt->entry, listpos);\n\n\tif (listpos == head) {\n\t\t/*\n\t\t * We are the new earliest-expiring timer.\n\t\t * If we are a thread timer, there can always\n\t\t * be a process timer telling us to stop earlier.\n\t\t */\n\n\t\tif (CPUCLOCK_PERTHREAD(timer->it_clock)) {\n\t\t\tswitch (CPUCLOCK_WHICH(timer->it_clock)) {\n\t\t\tdefault:\n\t\t\t\tBUG();\n\t\t\tcase CPUCLOCK_PROF:\n\t\t\t\tif (cputime_eq(p->it_prof_expires,\n\t\t\t\t\t cputime_zero) ||\n\t\t\t\t cputime_gt(p->it_prof_expires,\n\t\t\t\t\t nt->expires.cpu))\n\t\t\t\t\tp->it_prof_expires = nt->expires.cpu;\n\t\t\t\tbreak;\n\t\t\tcase CPUCLOCK_VIRT:\n\t\t\t\tif (cputime_eq(p->it_virt_expires,\n\t\t\t\t\t cputime_zero) ||\n\t\t\t\t cputime_gt(p->it_virt_expires,\n\t\t\t\t\t nt->expires.cpu))\n\t\t\t\t\tp->it_virt_expires = nt->expires.cpu;\n\t\t\t\tbreak;\n\t\t\tcase CPUCLOCK_SCHED:\n\t\t\t\tif (p->it_sched_expires == 0 ||\n\t\t\t\t p->it_sched_expires > nt->expires.sched)\n\t\t\t\t\tp->it_sched_expires = nt->expires.sched;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t} else {\n\t\t\t/*\n\t\t\t * For a process timer, we must balance\n\t\t\t * all the live threads' expirations.\n\t\t\t */\n\t\t\tswitch (CPUCLOCK_WHICH(timer->it_clock)) {\n\t\t\tdefault:\n\t\t\t\tBUG();\n\t\t\tcase CPUCLOCK_VIRT:\n\t\t\t\tif (!cputime_eq(p->signal->it_virt_expires,\n\t\t\t\t\t\tcputime_zero) &&\n\t\t\t\t cputime_lt(p->signal->it_virt_expires,\n\t\t\t\t\t timer->it.cpu.expires.cpu))\n\t\t\t\t\tbreak;\n\t\t\t\tgoto rebalance;\n\t\t\tcase CPUCLOCK_PROF:\n\t\t\t\tif (!cputime_eq(p->signal->it_prof_expires,\n\t\t\t\t\t\tcputime_zero) &&\n\t\t\t\t cputime_lt(p->signal->it_prof_expires,\n\t\t\t\t\t timer->it.cpu.expires.cpu))\n\t\t\t\t\tbreak;\n\t\t\t\ti = p->signal->rlim[RLIMIT_CPU].rlim_cur;\n\t\t\t\tif (i != RLIM_INFINITY &&\n\t\t\t\t i <= cputime_to_secs(timer->it.cpu.expires.cpu))\n\t\t\t\t\tbreak;\n\t\t\t\tgoto rebalance;\n\t\t\tcase CPUCLOCK_SCHED:\n\t\t\trebalance:\n\t\t\t\tprocess_timer_rebalance(\n\t\t\t\t\ttimer->it.cpu.task,\n\t\t\t\t\tCPUCLOCK_WHICH(timer->it_clock),\n\t\t\t\t\ttimer->it.cpu.expires, now);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tspin_unlock(&p->sighand->siglock);\n}\n\n/*\n * The timer is locked, fire it and arrange for its reload.\n */\nstatic void cpu_timer_fire(struct k_itimer *timer)\n{\n\tif (unlikely(timer->sigq == NULL)) {\n\t\t/*\n\t\t * This a special case for clock_nanosleep,\n\t\t * not a normal timer from sys_timer_create.\n\t\t */\n\t\twake_up_process(timer->it_process);\n\t\ttimer->it.cpu.expires.sched = 0;\n\t} else if (timer->it.cpu.incr.sched == 0) {\n\t\t/*\n\t\t * One-shot timer. Clear it as soon as it's fired.\n\t\t */\n\t\tposix_timer_event(timer, 0);\n\t\ttimer->it.cpu.expires.sched = 0;\n\t} else if (posix_timer_event(timer, ++timer->it_requeue_pending)) {\n\t\t/*\n\t\t * The signal did not get queued because the signal\n\t\t * was ignored, so we won't get any callback to\n\t\t * reload the timer. But we need to keep it\n\t\t * ticking in case the signal is deliverable next time.\n\t\t */\n\t\tposix_cpu_timer_schedule(timer);\n\t}\n}\n\n/*\n * Guts of sys_timer_settime for CPU timers.\n * This is called with the timer locked and interrupts disabled.\n * If we return TIMER_RETRY, it's necessary to release the timer's lock\n * and try again. (This happens when the timer is in the middle of firing.)\n */\nint posix_cpu_timer_set(struct k_itimer *timer, int flags,\n\t\t\tstruct itimerspec *new, struct itimerspec *old)\n{\n\tstruct task_struct *p = timer->it.cpu.task;\n\tunion cpu_time_count old_expires, new_expires, val;\n\tint ret;\n\n\tif (unlikely(p == NULL)) {\n\t\t/*\n\t\t * Timer refers to a dead task's clock.\n\t\t */\n\t\treturn -ESRCH;\n\t}\n\n\tnew_expires = timespec_to_sample(timer->it_clock, &new->it_value);\n\n\tread_lock(&tasklist_lock);\n\t/*\n\t * We need the tasklist_lock to protect against reaping that\n\t * clears p->signal. If p has just been reaped, we can no\n\t * longer get any information about it at all.\n\t */\n\tif (unlikely(p->signal == NULL)) {\n\t\tread_unlock(&tasklist_lock);\n\t\tput_task_struct(p);\n\t\ttimer->it.cpu.task = NULL;\n\t\treturn -ESRCH;\n\t}\n\n\t/*\n\t * Disarm any old timer after extracting its expiry time.\n\t */\n\tBUG_ON(!irqs_disabled());\n\n\tret = 0;\n\tspin_lock(&p->sighand->siglock);\n\told_expires = timer->it.cpu.expires;\n\tif (unlikely(timer->it.cpu.firing)) {\n\t\ttimer->it.cpu.firing = -1;\n\t\tret = TIMER_RETRY;\n\t} else\n\t\tlist_del_init(&timer->it.cpu.entry);\n\tspin_unlock(&p->sighand->siglock);\n\n\t/*\n\t * We need to sample the current value to convert the new\n\t * value from to relative and absolute, and to convert the\n\t * old value from absolute to relative. To set a process\n\t * timer, we need a sample to balance the thread expiry\n\t * times (in arm_timer). With an absolute time, we must\n\t * check if it's already passed. In short, we need a sample.\n\t */\n\tif (CPUCLOCK_PERTHREAD(timer->it_clock)) {\n\t\tcpu_clock_sample(timer->it_clock, p, &val);\n\t} else {\n\t\tcpu_clock_sample_group(timer->it_clock, p, &val);\n\t}\n\n\tif (old) {\n\t\tif (old_expires.sched == 0) {\n\t\t\told->it_value.tv_sec = 0;\n\t\t\told->it_value.tv_nsec = 0;\n\t\t} else {\n\t\t\t/*\n\t\t\t * Update the timer in case it has\n\t\t\t * overrun already. If it has,\n\t\t\t * we'll report it as having overrun\n\t\t\t * and with the next reloaded timer\n\t\t\t * already ticking, though we are\n\t\t\t * swallowing that pending\n\t\t\t * notification here to install the\n\t\t\t * new setting.\n\t\t\t */\n\t\t\tbump_cpu_timer(timer, val);\n\t\t\tif (cpu_time_before(timer->it_clock, val,\n\t\t\t\t\t timer->it.cpu.expires)) {\n\t\t\t\told_expires = cpu_time_sub(\n\t\t\t\t\ttimer->it_clock,\n\t\t\t\t\ttimer->it.cpu.expires, val);\n\t\t\t\tsample_to_timespec(timer->it_clock,\n\t\t\t\t\t\t old_expires,\n\t\t\t\t\t\t &old->it_value);\n\t\t\t} else {\n\t\t\t\told->it_value.tv_nsec = 1;\n\t\t\t\told->it_value.tv_sec = 0;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (unlikely(ret)) {\n\t\t/*\n\t\t * We are colliding with the timer actually firing.\n\t\t * Punt after filling in the timer's old value, and\n\t\t * disable this firing since we are already reporting\n\t\t * it as an overrun (thanks to bump_cpu_timer above).\n\t\t */\n\t\tread_unlock(&tasklist_lock);\n\t\tgoto out;\n\t}\n\n\tif (new_expires.sched != 0 && !(flags & TIMER_ABSTIME)) {\n\t\tcpu_time_add(timer->it_clock, &new_expires, val);\n\t}\n\n\t/*\n\t * Install the new expiry time (or zero).\n\t * For a timer with no notification action, we don't actually\n\t * arm the timer (we'll just fake it for timer_gettime).\n\t */\n\ttimer->it.cpu.expires = new_expires;\n\tif (new_expires.sched != 0 &&\n\t (timer->it_sigev_notify & ~SIGEV_THREAD_ID) != SIGEV_NONE &&\n\t cpu_time_before(timer->it_clock, val, new_expires)) {\n\t\tarm_timer(timer, val);\n\t}\n\n\tread_unlock(&tasklist_lock);\n\n\t/*\n\t * Install the new reload setting, and\n\t * set up the signal and overrun bookkeeping.\n\t */\n\ttimer->it.cpu.incr = timespec_to_sample(timer->it_clock,\n\t\t\t\t\t\t&new->it_interval);\n\n\t/*\n\t * This acts as a modification timestamp for the timer,\n\t * so any automatic reload attempt will punt on seeing\n\t * that we have reset the timer manually.\n\t */\n\ttimer->it_requeue_pending = (timer->it_requeue_pending + 2) &\n\t\t~REQUEUE_PENDING;\n\ttimer->it_overrun_last = 0;\n\ttimer->it_overrun = -1;\n\n\tif (new_expires.sched != 0 &&\n\t (timer->it_sigev_notify & ~SIGEV_THREAD_ID) != SIGEV_NONE &&\n\t !cpu_time_before(timer->it_clock, val, new_expires)) {\n\t\t/*\n\t\t * The designated time already passed, so we notify\n\t\t * immediately, even if the thread never runs to\n\t\t * accumulate more time on this clock.\n\t\t */\n\t\tcpu_timer_fire(timer);\n\t}\n\n\tret = 0;\n out:\n\tif (old) {\n\t\tsample_to_timespec(timer->it_clock,\n\t\t\t\t timer->it.cpu.incr, &old->it_interval);\n\t}\n\treturn ret;\n}\n\nvoid posix_cpu_timer_get(struct k_itimer *timer, struct itimerspec *itp)\n{\n\tunion cpu_time_count now;\n\tstruct task_struct *p = timer->it.cpu.task;\n\tint clear_dead;\n\n\t/*\n\t * Easy part: convert the reload time.\n\t */\n\tsample_to_timespec(timer->it_clock,\n\t\t\t timer->it.cpu.incr, &itp->it_interval);\n\n\tif (timer->it.cpu.expires.sched == 0) {\t/* Timer not armed at all. */\n\t\titp->it_value.tv_sec = itp->it_value.tv_nsec = 0;\n\t\treturn;\n\t}\n\n\tif (unlikely(p == NULL)) {\n\t\t/*\n\t\t * This task already died and the timer will never fire.\n\t\t * In this case, expires is actually the dead value.\n\t\t */\n\tdead:\n\t\tsample_to_timespec(timer->it_clock, timer->it.cpu.expires,\n\t\t\t\t &itp->it_value);\n\t\treturn;\n\t}\n\n\t/*\n\t * Sample the clock to take the difference with the expiry time.\n\t */\n\tif (CPUCLOCK_PERTHREAD(timer->it_clock)) {\n\t\tcpu_clock_sample(timer->it_clock, p, &now);\n\t\tclear_dead = p->exit_state;\n\t} else {\n\t\tread_lock(&tasklist_lock);\n\t\tif (unlikely(p->signal == NULL)) {\n\t\t\t/*\n\t\t\t * The process has been reaped.\n\t\t\t * We can't even collect a sample any more.\n\t\t\t * Call the timer disarmed, nothing else to do.\n\t\t\t */\n\t\t\tput_task_struct(p);\n\t\t\ttimer->it.cpu.task = NULL;\n\t\t\ttimer->it.cpu.expires.sched = 0;\n\t\t\tread_unlock(&tasklist_lock);\n\t\t\tgoto dead;\n\t\t} else {\n\t\t\tcpu_clock_sample_group(timer->it_clock, p, &now);\n\t\t\tclear_dead = (unlikely(p->exit_state) &&\n\t\t\t\t thread_group_empty(p));\n\t\t}\n\t\tread_unlock(&tasklist_lock);\n\t}\n\n\tif ((timer->it_sigev_notify & ~SIGEV_THREAD_ID) == SIGEV_NONE) {\n\t\tif (timer->it.cpu.incr.sched == 0 &&\n\t\t cpu_time_before(timer->it_clock,\n\t\t\t\t timer->it.cpu.expires, now)) {\n\t\t\t/*\n\t\t\t * Do-nothing timer expired and has no reload,\n\t\t\t * so it's as if it was never set.\n\t\t\t */\n\t\t\ttimer->it.cpu.expires.sched = 0;\n\t\t\titp->it_value.tv_sec = itp->it_value.tv_nsec = 0;\n\t\t\treturn;\n\t\t}\n\t\t/*\n\t\t * Account for any expirations and reloads that should\n\t\t * have happened.\n\t\t */\n\t\tbump_cpu_timer(timer, now);\n\t}\n\n\tif (unlikely(clear_dead)) {\n\t\t/*\n\t\t * We've noticed that the thread is dead, but\n\t\t * not yet reaped. Take this opportunity to\n\t\t * drop our task ref.\n\t\t */\n\t\tclear_dead_task(timer, now);\n\t\tgoto dead;\n\t}\n\n\tif (cpu_time_before(timer->it_clock, now, timer->it.cpu.expires)) {\n\t\tsample_to_timespec(timer->it_clock,\n\t\t\t\t cpu_time_sub(timer->it_clock,\n\t\t\t\t\t\ttimer->it.cpu.expires, now),\n\t\t\t\t &itp->it_value);\n\t} else {\n\t\t/*\n\t\t * The timer should have expired already, but the firing\n\t\t * hasn't taken place yet. Say it's just about to expire.\n\t\t */\n\t\titp->it_value.tv_nsec = 1;\n\t\titp->it_value.tv_sec = 0;\n\t}\n}\n\n/*\n * Check for any per-thread CPU timers that have fired and move them off\n * the tsk->cpu_timers[N] list onto the firing list. Here we update the\n * tsk->it_*_expires values to reflect the remaining thread CPU timers.\n */\nstatic void check_thread_timers(struct task_struct *tsk,\n\t\t\t\tstruct list_head *firing)\n{\n\tint maxfire;\n\tstruct list_head *timers = tsk->cpu_timers;\n\n\tmaxfire = 20;\n\ttsk->it_prof_expires = cputime_zero;\n\twhile (!list_empty(timers)) {\n\t\tstruct cpu_timer_list *t = list_first_entry(timers,\n\t\t\t\t\t\t struct cpu_timer_list,\n\t\t\t\t\t\t entry);\n\t\tif (!--maxfire || cputime_lt(prof_ticks(tsk), t->expires.cpu)) {\n\t\t\ttsk->it_prof_expires = t->expires.cpu;\n\t\t\tbreak;\n\t\t}\n\t\tt->firing = 1;\n\t\tlist_move_tail(&t->entry, firing);\n\t}\n\n\t++timers;\n\tmaxfire = 20;\n\ttsk->it_virt_expires = cputime_zero;\n\twhile (!list_empty(timers)) {\n\t\tstruct cpu_timer_list *t = list_first_entry(timers,\n\t\t\t\t\t\t struct cpu_timer_list,\n\t\t\t\t\t\t entry);\n\t\tif (!--maxfire || cputime_lt(virt_ticks(tsk), t->expires.cpu)) {\n\t\t\ttsk->it_virt_expires = t->expires.cpu;\n\t\t\tbreak;\n\t\t}\n\t\tt->firing = 1;\n\t\tlist_move_tail(&t->entry, firing);\n\t}\n\n\t++timers;\n\tmaxfire = 20;\n\ttsk->it_sched_expires = 0;\n\twhile (!list_empty(timers)) {\n\t\tstruct cpu_timer_list *t = list_first_entry(timers,\n\t\t\t\t\t\t struct cpu_timer_list,\n\t\t\t\t\t\t entry);\n\t\tif (!--maxfire || tsk->sched_time < t->expires.sched) {\n\t\t\ttsk->it_sched_expires = t->expires.sched;\n\t\t\tbreak;\n\t\t}\n\t\tt->firing = 1;\n\t\tlist_move_tail(&t->entry, firing);\n\t}\n}\n\n/*\n * Check for any per-thread CPU timers that have fired and move them\n * off the tsk->*_timers list onto the firing list. Per-thread timers\n * have already been taken off.\n */\nstatic void check_process_timers(struct task_struct *tsk,\n\t\t\t\t struct list_head *firing)\n{\n\tint maxfire;\n\tstruct signal_struct *const sig = tsk->signal;\n\tcputime_t utime, stime, ptime, virt_expires, prof_expires;\n\tunsigned long long sched_time, sched_expires;\n\tstruct task_struct *t;\n\tstruct list_head *timers = sig->cpu_timers;\n\n\t/*\n\t * Don't sample the current process CPU clocks if there are no timers.\n\t */\n\tif (list_empty(&timers[CPUCLOCK_PROF]) &&\n\t cputime_eq(sig->it_prof_expires, cputime_zero) &&\n\t sig->rlim[RLIMIT_CPU].rlim_cur == RLIM_INFINITY &&\n\t list_empty(&timers[CPUCLOCK_VIRT]) &&\n\t cputime_eq(sig->it_virt_expires, cputime_zero) &&\n\t list_empty(&timers[CPUCLOCK_SCHED]))\n\t\treturn;\n\n\t/*\n\t * Collect the current process totals.\n\t */\n\tutime = sig->utime;\n\tstime = sig->stime;\n\tsched_time = sig->sched_time;\n\tt = tsk;\n\tdo {\n\t\tutime = cputime_add(utime, t->utime);\n\t\tstime = cputime_add(stime, t->stime);\n\t\tsched_time += t->sched_time;\n\t\tt = next_thread(t);\n\t} while (t != tsk);\n\tptime = cputime_add(utime, stime);\n\n\tmaxfire = 20;\n\tprof_expires = cputime_zero;\n\twhile (!list_empty(timers)) {\n\t\tstruct cpu_timer_list *t = list_first_entry(timers,\n\t\t\t\t\t\t struct cpu_timer_list,\n\t\t\t\t\t\t entry);\n\t\tif (!--maxfire || cputime_lt(ptime, t->expires.cpu)) {\n\t\t\tprof_expires = t->expires.cpu;\n\t\t\tbreak;\n\t\t}\n\t\tt->firing = 1;\n\t\tlist_move_tail(&t->entry, firing);\n\t}\n\n\t++timers;\n\tmaxfire = 20;\n\tvirt_expires = cputime_zero;\n\twhile (!list_empty(timers)) {\n\t\tstruct cpu_timer_list *t = list_first_entry(timers,\n\t\t\t\t\t\t struct cpu_timer_list,\n\t\t\t\t\t\t entry);\n\t\tif (!--maxfire || cputime_lt(utime, t->expires.cpu)) {\n\t\t\tvirt_expires = t->expires.cpu;\n\t\t\tbreak;\n\t\t}\n\t\tt->firing = 1;\n\t\tlist_move_tail(&t->entry, firing);\n\t}\n\n\t++timers;\n\tmaxfire = 20;\n\tsched_expires = 0;\n\twhile (!list_empty(timers)) {\n\t\tstruct cpu_timer_list *t = list_first_entry(timers,\n\t\t\t\t\t\t struct cpu_timer_list,\n\t\t\t\t\t\t entry);\n\t\tif (!--maxfire || sched_time < t->expires.sched) {\n\t\t\tsched_expires = t->expires.sched;\n\t\t\tbreak;\n\t\t}\n\t\tt->firing = 1;\n\t\tlist_move_tail(&t->entry, firing);\n\t}\n\n\t/*\n\t * Check for the special case process timers.\n\t */\n\tif (!cputime_eq(sig->it_prof_expires, cputime_zero)) {\n\t\tif (cputime_ge(ptime, sig->it_prof_expires)) {\n\t\t\t/* ITIMER_PROF fires and reloads. */\n\t\t\tsig->it_prof_expires = sig->it_prof_incr;\n\t\t\tif (!cputime_eq(sig->it_prof_expires, cputime_zero)) {\n\t\t\t\tsig->it_prof_expires = cputime_add(\n\t\t\t\t\tsig->it_prof_expires, ptime);\n\t\t\t}\n\t\t\t__group_send_sig_info(SIGPROF, SEND_SIG_PRIV, tsk);\n\t\t}\n\t\tif (!cputime_eq(sig->it_prof_expires, cputime_zero) &&\n\t\t (cputime_eq(prof_expires, cputime_zero) ||\n\t\t cputime_lt(sig->it_prof_expires, prof_expires))) {\n\t\t\tprof_expires = sig->it_prof_expires;\n\t\t}\n\t}\n\tif (!cputime_eq(sig->it_virt_expires, cputime_zero)) {\n\t\tif (cputime_ge(utime, sig->it_virt_expires)) {\n\t\t\t/* ITIMER_VIRTUAL fires and reloads. */\n\t\t\tsig->it_virt_expires = sig->it_virt_incr;\n\t\t\tif (!cputime_eq(sig->it_virt_expires, cputime_zero)) {\n\t\t\t\tsig->it_virt_expires = cputime_add(\n\t\t\t\t\tsig->it_virt_expires, utime);\n\t\t\t}\n\t\t\t__group_send_sig_info(SIGVTALRM, SEND_SIG_PRIV, tsk);\n\t\t}\n\t\tif (!cputime_eq(sig->it_virt_expires, cputime_zero) &&\n\t\t (cputime_eq(virt_expires, cputime_zero) ||\n\t\t cputime_lt(sig->it_virt_expires, virt_expires))) {\n\t\t\tvirt_expires = sig->it_virt_expires;\n\t\t}\n\t}\n\tif (sig->rlim[RLIMIT_CPU].rlim_cur != RLIM_INFINITY) {\n\t\tunsigned long psecs = cputime_to_secs(ptime);\n\t\tcputime_t x;\n\t\tif (psecs >= sig->rlim[RLIMIT_CPU].rlim_max) {\n\t\t\t/*\n\t\t\t * At the hard limit, we just die.\n\t\t\t * No need to calculate anything else now.\n\t\t\t */\n\t\t\t__group_send_sig_info(SIGKILL, SEND_SIG_PRIV, tsk);\n\t\t\treturn;\n\t\t}\n\t\tif (psecs >= sig->rlim[RLIMIT_CPU].rlim_cur) {\n\t\t\t/*\n\t\t\t * At the soft limit, send a SIGXCPU every second.\n\t\t\t */\n\t\t\t__group_send_sig_info(SIGXCPU, SEND_SIG_PRIV, tsk);\n\t\t\tif (sig->rlim[RLIMIT_CPU].rlim_cur\n\t\t\t < sig->rlim[RLIMIT_CPU].rlim_max) {\n\t\t\t\tsig->rlim[RLIMIT_CPU].rlim_cur++;\n\t\t\t}\n\t\t}\n\t\tx = secs_to_cputime(sig->rlim[RLIMIT_CPU].rlim_cur);\n\t\tif (cputime_eq(prof_expires, cputime_zero) ||\n\t\t cputime_lt(x, prof_expires)) {\n\t\t\tprof_expires = x;\n\t\t}\n\t}\n\n\tif (!cputime_eq(prof_expires, cputime_zero) ||\n\t !cputime_eq(virt_expires, cputime_zero) ||\n\t sched_expires != 0) {\n\t\t/*\n\t\t * Rebalance the threads' expiry times for the remaining\n\t\t * process CPU timers.\n\t\t */\n\n\t\tcputime_t prof_left, virt_left, ticks;\n\t\tunsigned long long sched_left, sched;\n\t\tconst unsigned int nthreads = atomic_read(&sig->live);\n\n\t\tif (!nthreads)\n\t\t\treturn;\n\n\t\tprof_left = cputime_sub(prof_expires, utime);\n\t\tprof_left = cputime_sub(prof_left, stime);\n\t\tprof_left = cputime_div_non_zero(prof_left, nthreads);\n\t\tvirt_left = cputime_sub(virt_expires, utime);\n\t\tvirt_left = cputime_div_non_zero(virt_left, nthreads);\n\t\tif (sched_expires) {\n\t\t\tsched_left = sched_expires - sched_time;\n\t\t\tdo_div(sched_left, nthreads);\n\t\t\tsched_left = max_t(unsigned long long, sched_left, 1);\n\t\t} else {\n\t\t\tsched_left = 0;\n\t\t}\n\t\tt = tsk;\n\t\tdo {\n\t\t\tif (unlikely(t->flags & PF_EXITING))\n\t\t\t\tcontinue;\n\n\t\t\tticks = cputime_add(cputime_add(t->utime, t->stime),\n\t\t\t\t\t prof_left);\n\t\t\tif (!cputime_eq(prof_expires, cputime_zero) &&\n\t\t\t (cputime_eq(t->it_prof_expires, cputime_zero) ||\n\t\t\t cputime_gt(t->it_prof_expires, ticks))) {\n\t\t\t\tt->it_prof_expires = ticks;\n\t\t\t}\n\n\t\t\tticks = cputime_add(t->utime, virt_left);\n\t\t\tif (!cputime_eq(virt_expires, cputime_zero) &&\n\t\t\t (cputime_eq(t->it_virt_expires, cputime_zero) ||\n\t\t\t cputime_gt(t->it_virt_expires, ticks))) {\n\t\t\t\tt->it_virt_expires = ticks;\n\t\t\t}\n\n\t\t\tsched = t->sched_time + sched_left;\n\t\t\tif (sched_expires && (t->it_sched_expires == 0 ||\n\t\t\t\t\t t->it_sched_expires > sched)) {\n\t\t\t\tt->it_sched_expires = sched;\n\t\t\t}\n\t\t} while ((t = next_thread(t)) != tsk);\n\t}\n}\n\n/*\n * This is called from the signal code (via do_schedule_next_timer)\n * when the last timer signal was delivered and we have to reload the timer.\n */\nvoid posix_cpu_timer_schedule(struct k_itimer *timer)\n{\n\tstruct task_struct *p = timer->it.cpu.task;\n\tunion cpu_time_count now;\n\n\tif (unlikely(p == NULL))\n\t\t/*\n\t\t * The task was cleaned up already, no future firings.\n\t\t */\n\t\tgoto out;\n\n\t/*\n\t * Fetch the current sample and update the timer's expiry time.\n\t */\n\tif (CPUCLOCK_PERTHREAD(timer->it_clock)) {\n\t\tcpu_clock_sample(timer->it_clock, p, &now);\n\t\tbump_cpu_timer(timer, now);\n\t\tif (unlikely(p->exit_state)) {\n\t\t\tclear_dead_task(timer, now);\n\t\t\tgoto out;\n\t\t}\n\t\tread_lock(&tasklist_lock); /* arm_timer needs it. */\n\t} else {\n\t\tread_lock(&tasklist_lock);\n\t\tif (unlikely(p->signal == NULL)) {\n\t\t\t/*\n\t\t\t * The process has been reaped.\n\t\t\t * We can't even collect a sample any more.\n\t\t\t */\n\t\t\tput_task_struct(p);\n\t\t\ttimer->it.cpu.task = p = NULL;\n\t\t\ttimer->it.cpu.expires.sched = 0;\n\t\t\tgoto out_unlock;\n\t\t} else if (unlikely(p->exit_state) && thread_group_empty(p)) {\n\t\t\t/*\n\t\t\t * We've noticed that the thread is dead, but\n\t\t\t * not yet reaped. Take this opportunity to\n\t\t\t * drop our task ref.\n\t\t\t */\n\t\t\tclear_dead_task(timer, now);\n\t\t\tgoto out_unlock;\n\t\t}\n\t\tcpu_clock_sample_group(timer->it_clock, p, &now);\n\t\tbump_cpu_timer(timer, now);\n\t\t/* Leave the tasklist_lock locked for the call below. */\n\t}\n\n\t/*\n\t * Now re-arm for the new expiry time.\n\t */\n\tarm_timer(timer, now);\n\nout_unlock:\n\tread_unlock(&tasklist_lock);\n\nout:\n\ttimer->it_overrun_last = timer->it_overrun;\n\ttimer->it_overrun = -1;\n\t++timer->it_requeue_pending;\n}\n\n/*\n * This is called from the timer interrupt handler. The irq handler has\n * already updated our counts. We need to check if any timers fire now.\n * Interrupts are disabled.\n */\nvoid run_posix_cpu_timers(struct task_struct *tsk)\n{\n\tLIST_HEAD(firing);\n\tstruct k_itimer *timer, *next;\n\n\tBUG_ON(!irqs_disabled());\n\n#define UNEXPIRED(clock) \\\n\t\t(cputime_eq(tsk->it_##clock##_expires, cputime_zero) || \\\n\t\t cputime_lt(clock##_ticks(tsk), tsk->it_##clock##_expires))\n\n\tif (UNEXPIRED(prof) && UNEXPIRED(virt) &&\n\t (tsk->it_sched_expires == 0 ||\n\t tsk->sched_time < tsk->it_sched_expires))\n\t\treturn;\n\n#undef\tUNEXPIRED\n\n\t/*\n\t * Double-check with locks held.\n\t */\n\tread_lock(&tasklist_lock);\n\tif (likely(tsk->signal != NULL)) {\n\t\tspin_lock(&tsk->sighand->siglock);\n\n\t\t/*\n\t\t * Here we take off tsk->cpu_timers[N] and tsk->signal->cpu_timers[N]\n\t\t * all the timers that are firing, and put them on the firing list.\n\t\t */\n\t\tcheck_thread_timers(tsk, &firing);\n\t\tcheck_process_timers(tsk, &firing);\n\n\t\t/*\n\t\t * We must release these locks before taking any timer's lock.\n\t\t * There is a potential race with timer deletion here, as the\n\t\t * siglock now protects our private firing list. We have set\n\t\t * the firing flag in each timer, so that a deletion attempt\n\t\t * that gets the timer lock before we do will give it up and\n\t\t * spin until we've taken care of that timer below.\n\t\t */\n\t\tspin_unlock(&tsk->sighand->siglock);\n\t}\n\tread_unlock(&tasklist_lock);\n\n\t/*\n\t * Now that all the timers on our list have the firing flag,\n\t * noone will touch their list entries but us. We'll take\n\t * each timer's lock before clearing its firing flag, so no\n\t * timer call will interfere.\n\t */\n\tlist_for_each_entry_safe(timer, next, &firing, it.cpu.entry) {\n\t\tint firing;\n\t\tspin_lock(&timer->it_lock);\n\t\tlist_del_init(&timer->it.cpu.entry);\n\t\tfiring = timer->it.cpu.firing;\n\t\ttimer->it.cpu.firing = 0;\n\t\t/*\n\t\t * The firing flag is -1 if we collided with a reset\n\t\t * of the timer, which already reported this\n\t\t * almost-firing as an overrun. So don't generate an event.\n\t\t */\n\t\tif (likely(firing >= 0)) {\n\t\t\tcpu_timer_fire(timer);\n\t\t}\n\t\tspin_unlock(&timer->it_lock);\n\t}\n}\n\n/*\n * Set one of the process-wide special case CPU timers.\n * The tasklist_lock and tsk->sighand->siglock must be held by the caller.\n * The oldval argument is null for the RLIMIT_CPU timer, where *newval is\n * absolute; non-null for ITIMER_*, where *newval is relative and we update\n * it to be absolute, *oldval is absolute and we update it to be relative.\n */\nvoid set_process_cpu_timer(struct task_struct *tsk, unsigned int clock_idx,\n\t\t\t cputime_t *newval, cputime_t *oldval)\n{\n\tunion cpu_time_count now;\n\tstruct list_head *head;\n\n\tBUG_ON(clock_idx == CPUCLOCK_SCHED);\n\tcpu_clock_sample_group_locked(clock_idx, tsk, &now);\n\n\tif (oldval) {\n\t\tif (!cputime_eq(*oldval, cputime_zero)) {\n\t\t\tif (cputime_le(*oldval, now.cpu)) {\n\t\t\t\t/* Just about to fire. */\n\t\t\t\t*oldval = jiffies_to_cputime(1);\n\t\t\t} else {\n\t\t\t\t*oldval = cputime_sub(*oldval, now.cpu);\n\t\t\t}\n\t\t}\n\n\t\tif (cputime_eq(*newval, cputime_zero))\n\t\t\treturn;\n\t\t*newval = cputime_add(*newval, now.cpu);\n\n\t\t/*\n\t\t * If the RLIMIT_CPU timer will expire before the\n\t\t * ITIMER_PROF timer, we have nothing else to do.\n\t\t */\n\t\tif (tsk->signal->rlim[RLIMIT_CPU].rlim_cur\n\t\t < cputime_to_secs(*newval))\n\t\t\treturn;\n\t}\n\n\t/*\n\t * Check whether there are any process timers already set to fire\n\t * before this one. If so, we don't have anything more to do.\n\t */\n\thead = &tsk->signal->cpu_timers[clock_idx];\n\tif (list_empty(head) ||\n\t cputime_ge(list_first_entry(head,\n\t\t\t\t struct cpu_timer_list, entry)->expires.cpu,\n\t\t *newval)) {\n\t\t/*\n\t\t * Rejigger each thread's expiry time so that one will\n\t\t * notice before we hit the process-cumulative expiry time.\n\t\t */\n\t\tunion cpu_time_count expires = { .sched = 0 };\n\t\texpires.cpu = *newval;\n\t\tprocess_timer_rebalance(tsk, clock_idx, expires, now);\n\t}\n}\n\nstatic int do_cpu_nanosleep(const clockid_t which_clock, int flags,\n\t\t\t struct timespec *rqtp, struct itimerspec *it)\n{\n\tstruct k_itimer timer;\n\tint error;\n\n\t/*\n\t * Set up a temporary timer and then wait for it to go off.\n\t */\n\tmemset(&timer, 0, sizeof timer);\n\tspin_lock_init(&timer.it_lock);\n\ttimer.it_clock = which_clock;\n\ttimer.it_overrun = -1;\n\terror = posix_cpu_timer_create(&timer);\n\ttimer.it_process = current;\n\tif (!error) {\n\t\tstatic struct itimerspec zero_it;\n\n\t\tmemset(it, 0, sizeof *it);\n\t\tit->it_value = *rqtp;\n\n\t\tspin_lock_irq(&timer.it_lock);\n\t\terror = posix_cpu_timer_set(&timer, flags, it, NULL);\n\t\tif (error) {\n\t\t\tspin_unlock_irq(&timer.it_lock);\n\t\t\treturn error;\n\t\t}\n\n\t\twhile (!signal_pending(current)) {\n\t\t\tif (timer.it.cpu.expires.sched == 0) {\n\t\t\t\t/*\n\t\t\t\t * Our timer fired and was reset.\n\t\t\t\t */\n\t\t\t\tspin_unlock_irq(&timer.it_lock);\n\t\t\t\treturn 0;\n\t\t\t}\n\n\t\t\t/*\n\t\t\t * Block until cpu_timer_fire (or a signal) wakes us.\n\t\t\t */\n\t\t\t__set_current_state(TASK_INTERRUPTIBLE);\n\t\t\tspin_unlock_irq(&timer.it_lock);\n\t\t\tschedule();\n\t\t\tspin_lock_irq(&timer.it_lock);\n\t\t}\n\n\t\t/*\n\t\t * We were interrupted by a signal.\n\t\t */\n\t\tsample_to_timespec(which_clock, timer.it.cpu.expires, rqtp);\n\t\tposix_cpu_timer_set(&timer, 0, &zero_it, it);\n\t\tspin_unlock_irq(&timer.it_lock);\n\n\t\tif ((it->it_value.tv_sec | it->it_value.tv_nsec) == 0) {\n\t\t\t/*\n\t\t\t * It actually did fire already.\n\t\t\t */\n\t\t\treturn 0;\n\t\t}\n\n\t\terror = -ERESTART_RESTARTBLOCK;\n\t}\n\n\treturn error;\n}\n\nint posix_cpu_nsleep(const clockid_t which_clock, int flags,\n\t\t struct timespec *rqtp, struct timespec __user *rmtp)\n{\n\tstruct restart_block *restart_block =\n\t &current_thread_info()->restart_block;\n\tstruct itimerspec it;\n\tint error;\n\n\t/*\n\t * Diagnose required errors first.\n\t */\n\tif (CPUCLOCK_PERTHREAD(which_clock) &&\n\t (CPUCLOCK_PID(which_clock) == 0 ||\n\t CPUCLOCK_PID(which_clock) == current->pid))\n\t\treturn -EINVAL;\n\n\terror = do_cpu_nanosleep(which_clock, flags, rqtp, &it);\n\n\tif (error == -ERESTART_RESTARTBLOCK) {\n\n\t \tif (flags & TIMER_ABSTIME)\n\t\t\treturn -ERESTARTNOHAND;\n\t\t/*\n\t \t * Report back to the user the time still remaining.\n\t \t */\n\t\tif (rmtp != NULL && copy_to_user(rmtp, &it.it_value, sizeof *rmtp))\n\t\t\treturn -EFAULT;\n\n\t\trestart_block->fn = posix_cpu_nsleep_restart;\n\t\trestart_block->arg0 = which_clock;\n\t\trestart_block->arg1 = (unsigned long) rmtp;\n\t\trestart_block->arg2 = rqtp->tv_sec;\n\t\trestart_block->arg3 = rqtp->tv_nsec;\n\t}\n\treturn error;\n}\n\nlong posix_cpu_nsleep_restart(struct restart_block *restart_block)\n{\n\tclockid_t which_clock = restart_block->arg0;\n\tstruct timespec __user *rmtp;\n\tstruct timespec t;\n\tstruct itimerspec it;\n\tint error;\n\n\trmtp = (struct timespec __user *) restart_block->arg1;\n\tt.tv_sec = restart_block->arg2;\n\tt.tv_nsec = restart_block->arg3;\n\n\trestart_block->fn = do_no_restart_syscall;\n\terror = do_cpu_nanosleep(which_clock, TIMER_ABSTIME, &t, &it);\n\n\tif (error == -ERESTART_RESTARTBLOCK) {\n\t\t/*\n\t \t * Report back to the user the time still remaining.\n\t \t */\n\t\tif (rmtp != NULL && copy_to_user(rmtp, &it.it_value, sizeof *rmtp))\n\t\t\treturn -EFAULT;\n\n\t\trestart_block->fn = posix_cpu_nsleep_restart;\n\t\trestart_block->arg0 = which_clock;\n\t\trestart_block->arg1 = (unsigned long) rmtp;\n\t\trestart_block->arg2 = t.tv_sec;\n\t\trestart_block->arg3 = t.tv_nsec;\n\t}\n\treturn error;\n\n}\n\n\n#define PROCESS_CLOCK\tMAKE_PROCESS_CPUCLOCK(0, CPUCLOCK_SCHED)\n#define THREAD_CLOCK\tMAKE_THREAD_CPUCLOCK(0, CPUCLOCK_SCHED)\n\nstatic int process_cpu_clock_getres(const clockid_t which_clock,\n\t\t\t\t struct timespec *tp)\n{\n\treturn posix_cpu_clock_getres(PROCESS_CLOCK, tp);\n}\nstatic int process_cpu_clock_get(const clockid_t which_clock,\n\t\t\t\t struct timespec *tp)\n{\n\treturn posix_cpu_clock_get(PROCESS_CLOCK, tp);\n}\nstatic int process_cpu_timer_create(struct k_itimer *timer)\n{\n\ttimer->it_clock = PROCESS_CLOCK;\n\treturn posix_cpu_timer_create(timer);\n}\nstatic int process_cpu_nsleep(const clockid_t which_clock, int flags,\n\t\t\t struct timespec *rqtp,\n\t\t\t struct timespec __user *rmtp)\n{\n\treturn posix_cpu_nsleep(PROCESS_CLOCK, flags, rqtp, rmtp);\n}\nstatic long process_cpu_nsleep_restart(struct restart_block *restart_block)\n{\n\treturn -EINVAL;\n}\nstatic int thread_cpu_clock_getres(const clockid_t which_clock,\n\t\t\t\t struct timespec *tp)\n{\n\treturn posix_cpu_clock_getres(THREAD_CLOCK, tp);\n}\nstatic int thread_cpu_clock_get(const clockid_t which_clock,\n\t\t\t\tstruct timespec *tp)\n{\n\treturn posix_cpu_clock_get(THREAD_CLOCK, tp);\n}\nstatic int thread_cpu_timer_create(struct k_itimer *timer)\n{\n\ttimer->it_clock = THREAD_CLOCK;\n\treturn posix_cpu_timer_create(timer);\n}\nstatic int thread_cpu_nsleep(const clockid_t which_clock, int flags,\n\t\t\t struct timespec *rqtp, struct timespec __user *rmtp)\n{\n\treturn -EINVAL;\n}\nstatic long thread_cpu_nsleep_restart(struct restart_block *restart_block)\n{\n\treturn -EINVAL;\n}\n\nstatic __init int init_posix_cpu_timers(void)\n{\n\tstruct k_clock process = {\n\t\t.clock_getres = process_cpu_clock_getres,\n\t\t.clock_get = process_cpu_clock_get,\n\t\t.clock_set = do_posix_clock_nosettime,\n\t\t.timer_create = process_cpu_timer_create,\n\t\t.nsleep = process_cpu_nsleep,\n\t\t.nsleep_restart = process_cpu_nsleep_restart,\n\t};\n\tstruct k_clock thread = {\n\t\t.clock_getres = thread_cpu_clock_getres,\n\t\t.clock_get = thread_cpu_clock_get,\n\t\t.clock_set = do_posix_clock_nosettime,\n\t\t.timer_create = thread_cpu_timer_create,\n\t\t.nsleep = thread_cpu_nsleep,\n\t\t.nsleep_restart = thread_cpu_nsleep_restart,\n\t};\n\n\tregister_posix_clock(CLOCK_PROCESS_CPUTIME_ID, &process);\n\tregister_posix_clock(CLOCK_THREAD_CPUTIME_ID, &thread);\n\n\treturn 0;\n}\n__initcall(init_posix_cpu_timers);\n/*\n * linux/kernel/posix-timers.c\n *\n *\n * 2002-10-15 Posix Clocks & timers\n * by George Anzinger george@mvista.com\n *\n *\t\t\t Copyright (C) 2002 2003 by MontaVista Software.\n *\n * 2004-06-01 Fix CLOCK_REALTIME clock/timer TIMER_ABSTIME bug.\n *\t\t\t Copyright (C) 2004 Boris Hu\n *\n * This program is free software; you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation; either version 2 of the License, or (at\n * your option) any later version.\n *\n * This program is distributed in the hope that it will be useful, but\n * WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * General Public License for more details.\n\n * You should have received a copy of the GNU General Public License\n * along with this program; if not, write to the Free Software\n * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\n *\n * MontaVista Software | 1237 East Arques Avenue | Sunnyvale | CA 94085 | USA\n */\n\n/* These are all the functions necessary to implement\n * POSIX clocks & timers\n */\n#include <linux/mm.h>\n#include <linux/interrupt.h>\n#include <linux/slab.h>\n#include <linux/time.h>\n#include <linux/mutex.h>\n\n#include <asm/uaccess.h>\n#include <asm/semaphore.h>\n#include <linux/list.h>\n#include <linux/init.h>\n#include <linux/compiler.h>\n#include <linux/idr.h>\n#include <linux/posix-timers.h>\n#include <linux/syscalls.h>\n#include <linux/wait.h>\n#include <linux/workqueue.h>\n#include <linux/module.h>\n\n/*\n * Management arrays for POSIX timers.\t Timers are kept in slab memory\n * Timer ids are allocated by an external routine that keeps track of the\n * id and the timer. The external interface is:\n *\n * void *idr_find(struct idr *idp, int id); to find timer_id <id>\n * int idr_get_new(struct idr *idp, void *ptr); to get a new id and\n * related it to <ptr>\n * void idr_remove(struct idr *idp, int id); to release <id>\n * void idr_init(struct idr *idp); to initialize <idp>\n * which we supply.\n * The idr_get_new *may* call slab for more memory so it must not be\n * called under a spin lock. Likewise idr_remore may release memory\n * (but it may be ok to do this under a lock...).\n * idr_find is just a memory look up and is quite fast. A -1 return\n * indicates that the requested id does not exist.\n */\n\n/*\n * Lets keep our timers in a slab cache :-)\n */\nstatic struct kmem_cache *posix_timers_cache;\nstatic struct idr posix_timers_id;\nstatic DEFINE_SPINLOCK(idr_lock);\n\n/*\n * we assume that the new SIGEV_THREAD_ID shares no bits with the other\n * SIGEV values. Here we put out an error if this assumption fails.\n */\n#if SIGEV_THREAD_ID != (SIGEV_THREAD_ID & \\\n ~(SIGEV_SIGNAL | SIGEV_NONE | SIGEV_THREAD))\n#error \"SIGEV_THREAD_ID must not share bit with other SIGEV values!\"\n#endif\n\n\n/*\n * The timer ID is turned into a timer address by idr_find().\n * Verifying a valid ID consists of:\n *\n * a) checking that idr_find() returns other than -1.\n * b) checking that the timer id matches the one in the timer itself.\n * c) that the timer owner is in the callers thread group.\n */\n\n/*\n * CLOCKs: The POSIX standard calls for a couple of clocks and allows us\n *\t to implement others. This structure defines the various\n *\t clocks and allows the possibility of adding others.\t We\n *\t provide an interface to add clocks to the table and expect\n *\t the \"arch\" code to add at least one clock that is high\n *\t resolution.\t Here we define the standard CLOCK_REALTIME as a\n *\t 1/HZ resolution clock.\n *\n * RESOLUTION: Clock resolution is used to round up timer and interval\n *\t times, NOT to report clock times, which are reported with as\n *\t much resolution as the system can muster. In some cases this\n *\t resolution may depend on the underlying clock hardware and\n *\t may not be quantifiable until run time, and only then is the\n *\t necessary code is written.\tThe standard says we should say\n *\t something about this issue in the documentation...\n *\n * FUNCTIONS: The CLOCKs structure defines possible functions to handle\n *\t various clock functions. For clocks that use the standard\n *\t system timer code these entries should be NULL. This will\n *\t allow dispatch without the overhead of indirect function\n *\t calls. CLOCKS that depend on other sources (e.g. WWV or GPS)\n *\t must supply functions here, even if the function just returns\n *\t ENOSYS. The standard POSIX timer management code assumes the\n *\t following: 1.) The k_itimer struct (sched.h) is used for the\n *\t timer. 2.) The list, it_lock, it_clock, it_id and it_process\n *\t fields are not modified by timer code.\n *\n * At this time all functions EXCEPT clock_nanosleep can be\n * redirected by the CLOCKS structure. Clock_nanosleep is in\n * there, but the code ignores it.\n *\n * Permissions: It is assumed that the clock_settime() function defined\n *\t for each clock will take care of permission checks.\t Some\n *\t clocks may be set able by any user (i.e. local process\n *\t clocks) others not.\t Currently the only set able clock we\n *\t have is CLOCK_REALTIME and its high res counter part, both of\n *\t which we beg off on and pass to do_sys_settimeofday().\n */\n\nstatic struct k_clock posix_clocks[MAX_CLOCKS];\n\n/*\n * These ones are defined below.\n */\nstatic int common_nsleep(const clockid_t, int flags, struct timespec *t,\n\t\t\t struct timespec __user *rmtp);\nstatic void common_timer_get(struct k_itimer *, struct itimerspec *);\nstatic int common_timer_set(struct k_itimer *, int,\n\t\t\t struct itimerspec *, struct itimerspec *);\nstatic int common_timer_del(struct k_itimer *timer);\n\nstatic enum hrtimer_restart posix_timer_fn(struct hrtimer *data);\n\nstatic struct k_itimer *lock_timer(timer_t timer_id, unsigned long *flags);\n\nstatic inline void unlock_timer(struct k_itimer *timr, unsigned long flags)\n{\n\tspin_unlock_irqrestore(&timr->it_lock, flags);\n}\n\n/*\n * Call the k_clock hook function if non-null, or the default function.\n */\n#define CLOCK_DISPATCH(clock, call, arglist) \\\n \t((clock) < 0 ? posix_cpu_##call arglist : \\\n \t (posix_clocks[clock].call != NULL \\\n \t ? (*posix_clocks[clock].call) arglist : common_##call arglist))\n\n/*\n * Default clock hook functions when the struct k_clock passed\n * to register_posix_clock leaves a function pointer null.\n *\n * The function common_CALL is the default implementation for\n * the function pointer CALL in struct k_clock.\n */\n\nstatic inline int common_clock_getres(const clockid_t which_clock,\n\t\t\t\t struct timespec *tp)\n{\n\ttp->tv_sec = 0;\n\ttp->tv_nsec = posix_clocks[which_clock].res;\n\treturn 0;\n}\n\n/*\n * Get real time for posix timers\n */\nstatic int common_clock_get(clockid_t which_clock, struct timespec *tp)\n{\n\tktime_get_real_ts(tp);\n\treturn 0;\n}\n\nstatic inline int common_clock_set(const clockid_t which_clock,\n\t\t\t\t struct timespec *tp)\n{\n\treturn do_sys_settimeofday(tp, NULL);\n}\n\nstatic int common_timer_create(struct k_itimer *new_timer)\n{\n\thrtimer_init(&new_timer->it.real.timer, new_timer->it_clock, 0);\n\treturn 0;\n}\n\n/*\n * Return nonzero if we know a priori this clockid_t value is bogus.\n */\nstatic inline int invalid_clockid(const clockid_t which_clock)\n{\n\tif (which_clock < 0)\t/* CPU clock, posix_cpu_* will check it */\n\t\treturn 0;\n\tif ((unsigned) which_clock >= MAX_CLOCKS)\n\t\treturn 1;\n\tif (posix_clocks[which_clock].clock_getres != NULL)\n\t\treturn 0;\n\tif (posix_clocks[which_clock].res != 0)\n\t\treturn 0;\n\treturn 1;\n}\n\n/*\n * Get monotonic time for posix timers\n */\nstatic int posix_ktime_get_ts(clockid_t which_clock, struct timespec *tp)\n{\n\tktime_get_ts(tp);\n\treturn 0;\n}\n\n/*\n * Initialize everything, well, just everything in Posix clocks/timers ;)\n */\nstatic __init int init_posix_timers(void)\n{\n\tstruct k_clock clock_realtime = {\n\t\t.clock_getres = hrtimer_get_res,\n\t};\n\tstruct k_clock clock_monotonic = {\n\t\t.clock_getres = hrtimer_get_res,\n\t\t.clock_get = posix_ktime_get_ts,\n\t\t.clock_set = do_posix_clock_nosettime,\n\t};\n\n\tregister_posix_clock(CLOCK_REALTIME, &clock_realtime);\n\tregister_posix_clock(CLOCK_MONOTONIC, &clock_monotonic);\n\n\tposix_timers_cache = kmem_cache_create(\"posix_timers_cache\",\n\t\t\t\t\tsizeof (struct k_itimer), 0, 0, NULL, NULL);\n\tidr_init(&posix_timers_id);\n\treturn 0;\n}\n\n__initcall(init_posix_timers);\n\nstatic void schedule_next_timer(struct k_itimer *timr)\n{\n\tstruct hrtimer *timer = &timr->it.real.timer;\n\n\tif (timr->it.real.interval.tv64 == 0)\n\t\treturn;\n\n\ttimr->it_overrun += hrtimer_forward(timer, timer->base->get_time(),\n\t\t\t\t\t timr->it.real.interval);\n\n\ttimr->it_overrun_last = timr->it_overrun;\n\ttimr->it_overrun = -1;\n\t++timr->it_requeue_pending;\n\thrtimer_restart(timer);\n}\n\n/*\n * This function is exported for use by the signal deliver code. It is\n * called just prior to the info block being released and passes that\n * block to us. It's function is to update the overrun entry AND to\n * restart the timer. It should only be called if the timer is to be\n * restarted (i.e. we have flagged this in the sys_private entry of the\n * info block).\n *\n * To protect aginst the timer going away while the interrupt is queued,\n * we require that the it_requeue_pending flag be set.\n */\nvoid do_schedule_next_timer(struct siginfo *info)\n{\n\tstruct k_itimer *timr;\n\tunsigned long flags;\n\n\ttimr = lock_timer(info->si_tid, &flags);\n\n\tif (timr && timr->it_requeue_pending == info->si_sys_private) {\n\t\tif (timr->it_clock < 0)\n\t\t\tposix_cpu_timer_schedule(timr);\n\t\telse\n\t\t\tschedule_next_timer(timr);\n\n\t\tinfo->si_overrun = timr->it_overrun_last;\n\t}\n\n\tif (timr)\n\t\tunlock_timer(timr, flags);\n}\n\nint posix_timer_event(struct k_itimer *timr,int si_private)\n{\n\tmemset(&timr->sigq->info, 0, sizeof(siginfo_t));\n\ttimr->sigq->info.si_sys_private = si_private;\n\t/* Send signal to the process that owns this timer.*/\n\n\ttimr->sigq->info.si_signo = timr->it_sigev_signo;\n\ttimr->sigq->info.si_errno = 0;\n\ttimr->sigq->info.si_code = SI_TIMER;\n\ttimr->sigq->info.si_tid = timr->it_id;\n\ttimr->sigq->info.si_value = timr->it_sigev_value;\n\n\tif (timr->it_sigev_notify & SIGEV_THREAD_ID) {\n\t\tstruct task_struct *leader;\n\t\tint ret = send_sigqueue(timr->it_sigev_signo, timr->sigq,\n\t\t\t\t\ttimr->it_process);\n\n\t\tif (likely(ret >= 0))\n\t\t\treturn ret;\n\n\t\ttimr->it_sigev_notify = SIGEV_SIGNAL;\n\t\tleader = timr->it_process->group_leader;\n\t\tput_task_struct(timr->it_process);\n\t\ttimr->it_process = leader;\n\t}\n\n\treturn send_group_sigqueue(timr->it_sigev_signo, timr->sigq,\n\t\t\t\t timr->it_process);\n}\nEXPORT_SYMBOL_GPL(posix_timer_event);\n\n/*\n * This function gets called when a POSIX.1b interval timer expires. It\n * is used as a callback from the kernel internal timer. The\n * run_timer_list code ALWAYS calls with interrupts on.\n\n * This code is for CLOCK_REALTIME* and CLOCK_MONOTONIC* timers.\n */\nstatic enum hrtimer_restart posix_timer_fn(struct hrtimer *timer)\n{\n\tstruct k_itimer *timr;\n\tunsigned long flags;\n\tint si_private = 0;\n\tenum hrtimer_restart ret = HRTIMER_NORESTART;\n\n\ttimr = container_of(timer, struct k_itimer, it.real.timer);\n\tspin_lock_irqsave(&timr->it_lock, flags);\n\n\tif (timr->it.real.interval.tv64 != 0)\n\t\tsi_private = ++timr->it_requeue_pending;\n\n\tif (posix_timer_event(timr, si_private)) {\n\t\t/*\n\t\t * signal was not sent because of sig_ignor\n\t\t * we will not get a call back to restart it AND\n\t\t * it should be restarted.\n\t\t */\n\t\tif (timr->it.real.interval.tv64 != 0) {\n\t\t\tktime_t now = hrtimer_cb_get_time(timer);\n\n\t\t\t/*\n\t\t\t * FIXME: What we really want, is to stop this\n\t\t\t * timer completely and restart it in case the\n\t\t\t * SIG_IGN is removed. This is a non trivial\n\t\t\t * change which involves sighand locking\n\t\t\t * (sigh !), which we don't want to do late in\n\t\t\t * the release cycle.\n\t\t\t *\n\t\t\t * For now we just let timers with an interval\n\t\t\t * less than a jiffie expire every jiffie to\n\t\t\t * avoid softirq starvation in case of SIG_IGN\n\t\t\t * and a very small interval, which would put\n\t\t\t * the timer right back on the softirq pending\n\t\t\t * list. By moving now ahead of time we trick\n\t\t\t * hrtimer_forward() to expire the timer\n\t\t\t * later, while we still maintain the overrun\n\t\t\t * accuracy, but have some inconsistency in\n\t\t\t * the timer_gettime() case. This is at least\n\t\t\t * better than a starved softirq. A more\n\t\t\t * complex fix which solves also another related\n\t\t\t * inconsistency is already in the pipeline.\n\t\t\t */\n#ifdef CONFIG_HIGH_RES_TIMERS\n\t\t\t{\n\t\t\t\tktime_t kj = ktime_set(0, NSEC_PER_SEC / HZ);\n\n\t\t\t\tif (timr->it.real.interval.tv64 < kj.tv64)\n\t\t\t\t\tnow = ktime_add(now, kj);\n\t\t\t}\n#endif\n\t\t\ttimr->it_overrun +=\n\t\t\t\thrtimer_forward(timer, now,\n\t\t\t\t\t\ttimr->it.real.interval);\n\t\t\tret = HRTIMER_RESTART;\n\t\t\t++timr->it_requeue_pending;\n\t\t}\n\t}\n\n\tunlock_timer(timr, flags);\n\treturn ret;\n}\n\nstatic struct task_struct * good_sigevent(sigevent_t * event)\n{\n\tstruct task_struct *rtn = current->group_leader;\n\n\tif ((event->sigev_notify & SIGEV_THREAD_ID ) &&\n\t\t(!(rtn = find_task_by_pid(event->sigev_notify_thread_id)) ||\n\t\t rtn->tgid != current->tgid ||\n\t\t (event->sigev_notify & ~SIGEV_THREAD_ID) != SIGEV_SIGNAL))\n\t\treturn NULL;\n\n\tif (((event->sigev_notify & ~SIGEV_THREAD_ID) != SIGEV_NONE) &&\n\t ((event->sigev_signo <= 0) || (event->sigev_signo > SIGRTMAX)))\n\t\treturn NULL;\n\n\treturn rtn;\n}\n\nvoid register_posix_clock(const clockid_t clock_id, struct k_clock *new_clock)\n{\n\tif ((unsigned) clock_id >= MAX_CLOCKS) {\n\t\tprintk(\"POSIX clock register failed for clock_id %d\\n\",\n\t\t clock_id);\n\t\treturn;\n\t}\n\n\tposix_clocks[clock_id] = *new_clock;\n}\nEXPORT_SYMBOL_GPL(register_posix_clock);\n\nstatic struct k_itimer * alloc_posix_timer(void)\n{\n\tstruct k_itimer *tmr;\n\ttmr = kmem_cache_zalloc(posix_timers_cache, GFP_KERNEL);\n\tif (!tmr)\n\t\treturn tmr;\n\tif (unlikely(!(tmr->sigq = sigqueue_alloc()))) {\n\t\tkmem_cache_free(posix_timers_cache, tmr);\n\t\ttmr = NULL;\n\t}\n\treturn tmr;\n}\n\n#define IT_ID_SET\t1\n#define IT_ID_NOT_SET\t0\nstatic void release_posix_timer(struct k_itimer *tmr, int it_id_set)\n{\n\tif (it_id_set) {\n\t\tunsigned long flags;\n\t\tspin_lock_irqsave(&idr_lock, flags);\n\t\tidr_remove(&posix_timers_id, tmr->it_id);\n\t\tspin_unlock_irqrestore(&idr_lock, flags);\n\t}\n\tsigqueue_free(tmr->sigq);\n\tif (unlikely(tmr->it_process) &&\n\t tmr->it_sigev_notify == (SIGEV_SIGNAL|SIGEV_THREAD_ID))\n\t\tput_task_struct(tmr->it_process);\n\tkmem_cache_free(posix_timers_cache, tmr);\n}\n\n/* Create a POSIX.1b interval timer. */\n\nasmlinkage long\nsys_timer_create(const clockid_t which_clock,\n\t\t struct sigevent __user *timer_event_spec,\n\t\t timer_t __user * created_timer_id)\n{\n\tint error = 0;\n\tstruct k_itimer *new_timer = NULL;\n\tint new_timer_id;\n\tstruct task_struct *process = NULL;\n\tunsigned long flags;\n\tsigevent_t event;\n\tint it_id_set = IT_ID_NOT_SET;\n\n\tif (invalid_clockid(which_clock))\n\t\treturn -EINVAL;\n\n\tnew_timer = alloc_posix_timer();\n\tif (unlikely(!new_timer))\n\t\treturn -EAGAIN;\n\n\tspin_lock_init(&new_timer->it_lock);\n retry:\n\tif (unlikely(!idr_pre_get(&posix_timers_id, GFP_KERNEL))) {\n\t\terror = -EAGAIN;\n\t\tgoto out;\n\t}\n\tspin_lock_irq(&idr_lock);\n\terror = idr_get_new(&posix_timers_id, (void *) new_timer,\n\t\t\t &new_timer_id);\n\tspin_unlock_irq(&idr_lock);\n\tif (error == -EAGAIN)\n\t\tgoto retry;\n\telse if (error) {\n\t\t/*\n\t\t * Wierd looking, but we return EAGAIN if the IDR is\n\t\t * full (proper POSIX return value for this)\n\t\t */\n\t\terror = -EAGAIN;\n\t\tgoto out;\n\t}\n\n\tit_id_set = IT_ID_SET;\n\tnew_timer->it_id = (timer_t) new_timer_id;\n\tnew_timer->it_clock = which_clock;\n\tnew_timer->it_overrun = -1;\n\terror = CLOCK_DISPATCH(which_clock, timer_create, (new_timer));\n\tif (error)\n\t\tgoto out;\n\n\t/*\n\t * return the timer_id now. The next step is hard to\n\t * back out if there is an error.\n\t */\n\tif (copy_to_user(created_timer_id,\n\t\t\t &new_timer_id, sizeof (new_timer_id))) {\n\t\terror = -EFAULT;\n\t\tgoto out;\n\t}\n\tif (timer_event_spec) {\n\t\tif (copy_from_user(&event, timer_event_spec, sizeof (event))) {\n\t\t\terror = -EFAULT;\n\t\t\tgoto out;\n\t\t}\n\t\tnew_timer->it_sigev_notify = event.sigev_notify;\n\t\tnew_timer->it_sigev_signo = event.sigev_signo;\n\t\tnew_timer->it_sigev_value = event.sigev_value;\n\n\t\tread_lock(&tasklist_lock);\n\t\tif ((process = good_sigevent(&event))) {\n\t\t\t/*\n\t\t\t * We may be setting up this process for another\n\t\t\t * thread. It may be exiting. To catch this\n\t\t\t * case the we check the PF_EXITING flag. If\n\t\t\t * the flag is not set, the siglock will catch\n\t\t\t * him before it is too late (in exit_itimers).\n\t\t\t *\n\t\t\t * The exec case is a bit more invloved but easy\n\t\t\t * to code. If the process is in our thread\n\t\t\t * group (and it must be or we would not allow\n\t\t\t * it here) and is doing an exec, it will cause\n\t\t\t * us to be killed. In this case it will wait\n\t\t\t * for us to die which means we can finish this\n\t\t\t * linkage with our last gasp. I.e. no code :)\n\t\t\t */\n\t\t\tspin_lock_irqsave(&process->sighand->siglock, flags);\n\t\t\tif (!(process->flags & PF_EXITING)) {\n\t\t\t\tnew_timer->it_process = process;\n\t\t\t\tlist_add(&new_timer->list,\n\t\t\t\t\t &process->signal->posix_timers);\n\t\t\t\tspin_unlock_irqrestore(&process->sighand->siglock, flags);\n\t\t\t\tif (new_timer->it_sigev_notify == (SIGEV_SIGNAL|SIGEV_THREAD_ID))\n\t\t\t\t\tget_task_struct(process);\n\t\t\t} else {\n\t\t\t\tspin_unlock_irqrestore(&process->sighand->siglock, flags);\n\t\t\t\tprocess = NULL;\n\t\t\t}\n\t\t}\n\t\tread_unlock(&tasklist_lock);\n\t\tif (!process) {\n\t\t\terror = -EINVAL;\n\t\t\tgoto out;\n\t\t}\n\t} else {\n\t\tnew_timer->it_sigev_notify = SIGEV_SIGNAL;\n\t\tnew_timer->it_sigev_signo = SIGALRM;\n\t\tnew_timer->it_sigev_value.sival_int = new_timer->it_id;\n\t\tprocess = current->group_leader;\n\t\tspin_lock_irqsave(&process->sighand->siglock, flags);\n\t\tnew_timer->it_process = process;\n\t\tlist_add(&new_timer->list, &process->signal->posix_timers);\n\t\tspin_unlock_irqrestore(&process->sighand->siglock, flags);\n\t}\n\n \t/*\n\t * In the case of the timer belonging to another task, after\n\t * the task is unlocked, the timer is owned by the other task\n\t * and may cease to exist at any time. Don't use or modify\n\t * new_timer after the unlock call.\n\t */\n\nout:\n\tif (error)\n\t\trelease_posix_timer(new_timer, it_id_set);\n\n\treturn error;\n}\n\n/*\n * Locking issues: We need to protect the result of the id look up until\n * we get the timer locked down so it is not deleted under us. The\n * removal is done under the idr spinlock so we use that here to bridge\n * the find to the timer lock. To avoid a dead lock, the timer id MUST\n * be release with out holding the timer lock.\n */\nstatic struct k_itimer * lock_timer(timer_t timer_id, unsigned long *flags)\n{\n\tstruct k_itimer *timr;\n\t/*\n\t * Watch out here. We do a irqsave on the idr_lock and pass the\n\t * flags part over to the timer lock. Must not let interrupts in\n\t * while we are moving the lock.\n\t */\n\n\tspin_lock_irqsave(&idr_lock, *flags);\n\ttimr = (struct k_itimer *) idr_find(&posix_timers_id, (int) timer_id);\n\tif (timr) {\n\t\tspin_lock(&timr->it_lock);\n\t\tspin_unlock(&idr_lock);\n\n\t\tif ((timr->it_id != timer_id) || !(timr->it_process) ||\n\t\t\t\ttimr->it_process->tgid != current->tgid) {\n\t\t\tunlock_timer(timr, *flags);\n\t\t\ttimr = NULL;\n\t\t}\n\t} else\n\t\tspin_unlock_irqrestore(&idr_lock, *flags);\n\n\treturn timr;\n}\n\n/*\n * Get the time remaining on a POSIX.1b interval timer. This function\n * is ALWAYS called with spin_lock_irq on the timer, thus it must not\n * mess with irq.\n *\n * We have a couple of messes to clean up here. First there is the case\n * of a timer that has a requeue pending. These timers should appear to\n * be in the timer list with an expiry as if we were to requeue them\n * now.\n *\n * The second issue is the SIGEV_NONE timer which may be active but is\n * not really ever put in the timer list (to save system resources).\n * This timer may be expired, and if so, we will do it here. Otherwise\n * it is the same as a requeue pending timer WRT to what we should\n * report.\n */\nstatic void\ncommon_timer_get(struct k_itimer *timr, struct itimerspec *cur_setting)\n{\n\tktime_t now, remaining, iv;\n\tstruct hrtimer *timer = &timr->it.real.timer;\n\n\tmemset(cur_setting, 0, sizeof(struct itimerspec));\n\n\tiv = timr->it.real.interval;\n\n\t/* interval timer ? */\n\tif (iv.tv64)\n\t\tcur_setting->it_interval = ktime_to_timespec(iv);\n\telse if (!hrtimer_active(timer) &&\n\t\t (timr->it_sigev_notify & ~SIGEV_THREAD_ID) != SIGEV_NONE)\n\t\treturn;\n\n\tnow = timer->base->get_time();\n\n\t/*\n\t * When a requeue is pending or this is a SIGEV_NONE\n\t * timer move the expiry time forward by intervals, so\n\t * expiry is > now.\n\t */\n\tif (iv.tv64 && (timr->it_requeue_pending & REQUEUE_PENDING ||\n\t (timr->it_sigev_notify & ~SIGEV_THREAD_ID) == SIGEV_NONE))\n\t\ttimr->it_overrun += hrtimer_forward(timer, now, iv);\n\n\tremaining = ktime_sub(timer->expires, now);\n\t/* Return 0 only, when the timer is expired and not pending */\n\tif (remaining.tv64 <= 0) {\n\t\t/*\n\t\t * A single shot SIGEV_NONE timer must return 0, when\n\t\t * it is expired !\n\t\t */\n\t\tif ((timr->it_sigev_notify & ~SIGEV_THREAD_ID) != SIGEV_NONE)\n\t\t\tcur_setting->it_value.tv_nsec = 1;\n\t} else\n\t\tcur_setting->it_value = ktime_to_timespec(remaining);\n}\n\n/* Get the time remaining on a POSIX.1b interval timer. */\nasmlinkage long\nsys_timer_gettime(timer_t timer_id, struct itimerspec __user *setting)\n{\n\tstruct k_itimer *timr;\n\tstruct itimerspec cur_setting;\n\tunsigned long flags;\n\n\ttimr = lock_timer(timer_id, &flags);\n\tif (!timr)\n\t\treturn -EINVAL;\n\n\tCLOCK_DISPATCH(timr->it_clock, timer_get, (timr, &cur_setting));\n\n\tunlock_timer(timr, flags);\n\n\tif (copy_to_user(setting, &cur_setting, sizeof (cur_setting)))\n\t\treturn -EFAULT;\n\n\treturn 0;\n}\n\n/*\n * Get the number of overruns of a POSIX.1b interval timer. This is to\n * be the overrun of the timer last delivered. At the same time we are\n * accumulating overruns on the next timer. The overrun is frozen when\n * the signal is delivered, either at the notify time (if the info block\n * is not queued) or at the actual delivery time (as we are informed by\n * the call back to do_schedule_next_timer(). So all we need to do is\n * to pick up the frozen overrun.\n */\nasmlinkage long\nsys_timer_getoverrun(timer_t timer_id)\n{\n\tstruct k_itimer *timr;\n\tint overrun;\n\tlong flags;\n\n\ttimr = lock_timer(timer_id, &flags);\n\tif (!timr)\n\t\treturn -EINVAL;\n\n\toverrun = timr->it_overrun_last;\n\tunlock_timer(timr, flags);\n\n\treturn overrun;\n}\n\n/* Set a POSIX.1b interval timer. */\n/* timr->it_lock is taken. */\nstatic int\ncommon_timer_set(struct k_itimer *timr, int flags,\n\t\t struct itimerspec *new_setting, struct itimerspec *old_setting)\n{\n\tstruct hrtimer *timer = &timr->it.real.timer;\n\tenum hrtimer_mode mode;\n\n\tif (old_setting)\n\t\tcommon_timer_get(timr, old_setting);\n\n\t/* disable the timer */\n\ttimr->it.real.interval.tv64 = 0;\n\t/*\n\t * careful here. If smp we could be in the \"fire\" routine which will\n\t * be spinning as we hold the lock. But this is ONLY an SMP issue.\n\t */\n\tif (hrtimer_try_to_cancel(timer) < 0)\n\t\treturn TIMER_RETRY;\n\n\ttimr->it_requeue_pending = (timr->it_requeue_pending + 2) & \n\t\t~REQUEUE_PENDING;\n\ttimr->it_overrun_last = 0;\n\n\t/* switch off the timer when it_value is zero */\n\tif (!new_setting->it_value.tv_sec && !new_setting->it_value.tv_nsec)\n\t\treturn 0;\n\n\tmode = flags & TIMER_ABSTIME ? HRTIMER_MODE_ABS : HRTIMER_MODE_REL;\n\thrtimer_init(&timr->it.real.timer, timr->it_clock, mode);\n\ttimr->it.real.timer.function = posix_timer_fn;\n\n\ttimer->expires = timespec_to_ktime(new_setting->it_value);\n\n\t/* Convert interval */\n\ttimr->it.real.interval = timespec_to_ktime(new_setting->it_interval);\n\n\t/* SIGEV_NONE timers are not queued ! See common_timer_get */\n\tif (((timr->it_sigev_notify & ~SIGEV_THREAD_ID) == SIGEV_NONE)) {\n\t\t/* Setup correct expiry time for relative timers */\n\t\tif (mode == HRTIMER_MODE_REL)\n\t\t\ttimer->expires = ktime_add(timer->expires,\n\t\t\t\t\t\t timer->base->get_time());\n\t\treturn 0;\n\t}\n\n\thrtimer_start(timer, timer->expires, mode);\n\treturn 0;\n}\n\n/* Set a POSIX.1b interval timer */\nasmlinkage long\nsys_timer_settime(timer_t timer_id, int flags,\n\t\t const struct itimerspec __user *new_setting,\n\t\t struct itimerspec __user *old_setting)\n{\n\tstruct k_itimer *timr;\n\tstruct itimerspec new_spec, old_spec;\n\tint error = 0;\n\tlong flag;\n\tstruct itimerspec *rtn = old_setting ? &old_spec : NULL;\n\n\tif (!new_setting)\n\t\treturn -EINVAL;\n\n\tif (copy_from_user(&new_spec, new_setting, sizeof (new_spec)))\n\t\treturn -EFAULT;\n\n\tif (!timespec_valid(&new_spec.it_interval) ||\n\t !timespec_valid(&new_spec.it_value))\n\t\treturn -EINVAL;\nretry:\n\ttimr = lock_timer(timer_id, &flag);\n\tif (!timr)\n\t\treturn -EINVAL;\n\n\terror = CLOCK_DISPATCH(timr->it_clock, timer_set,\n\t\t\t (timr, flags, &new_spec, rtn));\n\n\tunlock_timer(timr, flag);\n\tif (error == TIMER_RETRY) {\n\t\trtn = NULL;\t// We already got the old time...\n\t\tgoto retry;\n\t}\n\n\tif (old_setting && !error &&\n\t copy_to_user(old_setting, &old_spec, sizeof (old_spec)))\n\t\terror = -EFAULT;\n\n\treturn error;\n}\n\nstatic inline int common_timer_del(struct k_itimer *timer)\n{\n\ttimer->it.real.interval.tv64 = 0;\n\n\tif (hrtimer_try_to_cancel(&timer->it.real.timer) < 0)\n\t\treturn TIMER_RETRY;\n\treturn 0;\n}\n\nstatic inline int timer_delete_hook(struct k_itimer *timer)\n{\n\treturn CLOCK_DISPATCH(timer->it_clock, timer_del, (timer));\n}\n\n/* Delete a POSIX.1b interval timer. */\nasmlinkage long\nsys_timer_delete(timer_t timer_id)\n{\n\tstruct k_itimer *timer;\n\tlong flags;\n\nretry_delete:\n\ttimer = lock_timer(timer_id, &flags);\n\tif (!timer)\n\t\treturn -EINVAL;\n\n\tif (timer_delete_hook(timer) == TIMER_RETRY) {\n\t\tunlock_timer(timer, flags);\n\t\tgoto retry_delete;\n\t}\n\n\tspin_lock(&current->sighand->siglock);\n\tlist_del(&timer->list);\n\tspin_unlock(&current->sighand->siglock);\n\t/*\n\t * This keeps any tasks waiting on the spin lock from thinking\n\t * they got something (see the lock code above).\n\t */\n\tif (timer->it_process) {\n\t\tif (timer->it_sigev_notify == (SIGEV_SIGNAL|SIGEV_THREAD_ID))\n\t\t\tput_task_struct(timer->it_process);\n\t\ttimer->it_process = NULL;\n\t}\n\tunlock_timer(timer, flags);\n\trelease_posix_timer(timer, IT_ID_SET);\n\treturn 0;\n}\n\n/*\n * return timer owned by the process, used by exit_itimers\n */\nstatic void itimer_delete(struct k_itimer *timer)\n{\n\tunsigned long flags;\n\nretry_delete:\n\tspin_lock_irqsave(&timer->it_lock, flags);\n\n\tif (timer_delete_hook(timer) == TIMER_RETRY) {\n\t\tunlock_timer(timer, flags);\n\t\tgoto retry_delete;\n\t}\n\tlist_del(&timer->list);\n\t/*\n\t * This keeps any tasks waiting on the spin lock from thinking\n\t * they got something (see the lock code above).\n\t */\n\tif (timer->it_process) {\n\t\tif (timer->it_sigev_notify == (SIGEV_SIGNAL|SIGEV_THREAD_ID))\n\t\t\tput_task_struct(timer->it_process);\n\t\ttimer->it_process = NULL;\n\t}\n\tunlock_timer(timer, flags);\n\trelease_posix_timer(timer, IT_ID_SET);\n}\n\n/*\n * This is called by do_exit or de_thread, only when there are no more\n * references to the shared signal_struct.\n */\nvoid exit_itimers(struct signal_struct *sig)\n{\n\tstruct k_itimer *tmr;\n\n\twhile (!list_empty(&sig->posix_timers)) {\n\t\ttmr = list_entry(sig->posix_timers.next, struct k_itimer, list);\n\t\titimer_delete(tmr);\n\t}\n}\n\n/* Not available / possible... functions */\nint do_posix_clock_nosettime(const clockid_t clockid, struct timespec *tp)\n{\n\treturn -EINVAL;\n}\nEXPORT_SYMBOL_GPL(do_posix_clock_nosettime);\n\nint do_posix_clock_nonanosleep(const clockid_t clock, int flags,\n\t\t\t struct timespec *t, struct timespec __user *r)\n{\n#ifndef ENOTSUP\n\treturn -EOPNOTSUPP;\t/* aka ENOTSUP in userland for POSIX */\n#else /* parisc does define it separately. */\n\treturn -ENOTSUP;\n#endif\n}\nEXPORT_SYMBOL_GPL(do_posix_clock_nonanosleep);\n\nasmlinkage long sys_clock_settime(const clockid_t which_clock,\n\t\t\t\t const struct timespec __user *tp)\n{\n\tstruct timespec new_tp;\n\n\tif (invalid_clockid(which_clock))\n\t\treturn -EINVAL;\n\tif (copy_from_user(&new_tp, tp, sizeof (*tp)))\n\t\treturn -EFAULT;\n\n\treturn CLOCK_DISPATCH(which_clock, clock_set, (which_clock, &new_tp));\n}\n\nasmlinkage long\nsys_clock_gettime(const clockid_t which_clock, struct timespec __user *tp)\n{\n\tstruct timespec kernel_tp;\n\tint error;\n\n\tif (invalid_clockid(which_clock))\n\t\treturn -EINVAL;\n\terror = CLOCK_DISPATCH(which_clock, clock_get,\n\t\t\t (which_clock, &kernel_tp));\n\tif (!error && copy_to_user(tp, &kernel_tp, sizeof (kernel_tp)))\n\t\terror = -EFAULT;\n\n\treturn error;\n\n}\n\nasmlinkage long\nsys_clock_getres(const clockid_t which_clock, struct timespec __user *tp)\n{\n\tstruct timespec rtn_tp;\n\tint error;\n\n\tif (invalid_clockid(which_clock))\n\t\treturn -EINVAL;\n\n\terror = CLOCK_DISPATCH(which_clock, clock_getres,\n\t\t\t (which_clock, &rtn_tp));\n\n\tif (!error && tp && copy_to_user(tp, &rtn_tp, sizeof (rtn_tp))) {\n\t\terror = -EFAULT;\n\t}\n\n\treturn error;\n}\n\n/*\n * nanosleep for monotonic and realtime clocks\n */\nstatic int common_nsleep(const clockid_t which_clock, int flags,\n\t\t\t struct timespec *tsave, struct timespec __user *rmtp)\n{\n\treturn hrtimer_nanosleep(tsave, rmtp, flags & TIMER_ABSTIME ?\n\t\t\t\t HRTIMER_MODE_ABS : HRTIMER_MODE_REL,\n\t\t\t\t which_clock);\n}\n\nasmlinkage long\nsys_clock_nanosleep(const clockid_t which_clock, int flags,\n\t\t const struct timespec __user *rqtp,\n\t\t struct timespec __user *rmtp)\n{\n\tstruct timespec t;\n\n\tif (invalid_clockid(which_clock))\n\t\treturn -EINVAL;\n\n\tif (copy_from_user(&t, rqtp, sizeof (struct timespec)))\n\t\treturn -EFAULT;\n\n\tif (!timespec_valid(&t))\n\t\treturn -EINVAL;\n\n\treturn CLOCK_DISPATCH(which_clock, nsleep,\n\t\t\t (which_clock, flags, &t, rmtp));\n}\n\n/*\n * nanosleep_restart for monotonic and realtime clocks\n */\nstatic int common_nsleep_restart(struct restart_block *restart_block)\n{\n\treturn hrtimer_nanosleep_restart(restart_block);\n}\n\n/*\n * This will restart clock_nanosleep. This is required only by\n * compat_clock_nanosleep_restart for now.\n */\nlong\nclock_nanosleep_restart(struct restart_block *restart_block)\n{\n\tclockid_t which_clock = restart_block->arg0;\n\n\treturn CLOCK_DISPATCH(which_clock, nsleep_restart,\n\t\t\t (restart_block));\n}\n/*\n * linux/kernel/printk.c\n *\n * Copyright (C) 1991, 1992 Linus Torvalds\n *\n * Modified to make sys_syslog() more flexible: added commands to\n * return the last 4k of kernel messages, regardless of whether\n * they've been read or not. Added option to suppress kernel printk's\n * to the console. Added hook for sending the console messages\n * elsewhere, in preparation for a serial line console (someday).\n * Ted Ts'o, 2/11/93.\n * Modified for sysctl support, 1/8/97, Chris Horn.\n * Fixed SMP synchronization, 08/08/99, Manfred Spraul\n * manfred@colorfullife.com\n * Rewrote bits to get rid of console_lock\n *\t01Mar01 Andrew Morton <andrewm@uow.edu.au>\n */\n\n#include <linux/kernel.h>\n#include <linux/mm.h>\n#include <linux/tty.h>\n#include <linux/tty_driver.h>\n#include <linux/console.h>\n#include <linux/init.h>\n#include <linux/module.h>\n#include <linux/moduleparam.h>\n#include <linux/interrupt.h>\t\t\t/* For in_interrupt() */\n#include <linux/delay.h>\n#include <linux/smp.h>\n#include <linux/security.h>\n#include <linux/bootmem.h>\n#include <linux/syscalls.h>\n#include <linux/jiffies.h>\n\n#include <asm/uaccess.h>\n\n#define __LOG_BUF_LEN\t(1 << CONFIG_LOG_BUF_SHIFT)\n\n/* printk's without a loglevel use this.. */\n#define DEFAULT_MESSAGE_LOGLEVEL 4 /* KERN_WARNING */\n\n/* We show everything that is MORE important than this.. */\n#define MINIMUM_CONSOLE_LOGLEVEL 1 /* Minimum loglevel we let people use */\n#define DEFAULT_CONSOLE_LOGLEVEL 7 /* anything MORE serious than KERN_DEBUG */\n\nDECLARE_WAIT_QUEUE_HEAD(log_wait);\n\nint console_printk[4] = {\n\tDEFAULT_CONSOLE_LOGLEVEL,\t/* console_loglevel */\n\tDEFAULT_MESSAGE_LOGLEVEL,\t/* default_message_loglevel */\n\tMINIMUM_CONSOLE_LOGLEVEL,\t/* minimum_console_loglevel */\n\tDEFAULT_CONSOLE_LOGLEVEL,\t/* default_console_loglevel */\n};\n\n/*\n * Low level drivers may need that to know if they can schedule in\n * their unblank() callback or not. So let's export it.\n */\nint oops_in_progress;\nEXPORT_SYMBOL(oops_in_progress);\n\n/*\n * console_sem protects the console_drivers list, and also\n * provides serialisation for access to the entire console\n * driver system.\n */\nstatic DECLARE_MUTEX(console_sem);\nstatic DECLARE_MUTEX(secondary_console_sem);\nstruct console *console_drivers;\n/*\n * This is used for debugging the mess that is the VT code by\n * keeping track if we have the console semaphore held. It's\n * definitely not the perfect debug tool (we don't know if _WE_\n * hold it are racing, but it helps tracking those weird code\n * path in the console code where we end up in places I want\n * locked without the console sempahore held\n */\nstatic int console_locked, console_suspended;\n\n/*\n * logbuf_lock protects log_buf, log_start, log_end, con_start and logged_chars\n * It is also used in interesting ways to provide interlocking in\n * release_console_sem().\n */\nstatic DEFINE_SPINLOCK(logbuf_lock);\n\n#define LOG_BUF_MASK\t(log_buf_len-1)\n#define LOG_BUF(idx) (log_buf[(idx) & LOG_BUF_MASK])\n\n/*\n * The indices into log_buf are not constrained to log_buf_len - they\n * must be masked before subscripting\n */\nstatic unsigned long log_start;\t/* Index into log_buf: next char to be read by syslog() */\nstatic unsigned long con_start;\t/* Index into log_buf: next char to be sent to consoles */\nstatic unsigned long log_end;\t/* Index into log_buf: most-recently-written-char + 1 */\n\n/*\n *\tArray of consoles built from command line options (console=)\n */\nstruct console_cmdline\n{\n\tchar\tname[8];\t\t\t/* Name of the driver\t */\n\tint\tindex;\t\t\t\t/* Minor dev. to use\t */\n\tchar\t*options;\t\t\t/* Options for the driver */\n};\n\n#define MAX_CMDLINECONSOLES 8\n\nstatic struct console_cmdline console_cmdline[MAX_CMDLINECONSOLES];\nstatic int selected_console = -1;\nstatic int preferred_console = -1;\n\n/* Flag: console code may call schedule() */\nstatic int console_may_schedule;\n\n#ifdef CONFIG_PRINTK\n\nstatic char __log_buf[__LOG_BUF_LEN];\nstatic char *log_buf = __log_buf;\nstatic int log_buf_len = __LOG_BUF_LEN;\nstatic unsigned long logged_chars; /* Number of chars produced since last read+clear operation */\n\nstatic int __init log_buf_len_setup(char *str)\n{\n\tunsigned long size = memparse(str, &str);\n\tunsigned long flags;\n\n\tif (size)\n\t\tsize = roundup_pow_of_two(size);\n\tif (size > log_buf_len) {\n\t\tunsigned long start, dest_idx, offset;\n\t\tchar *new_log_buf;\n\n\t\tnew_log_buf = alloc_bootmem(size);\n\t\tif (!new_log_buf) {\n\t\t\tprintk(KERN_WARNING \"log_buf_len: allocation failed\\n\");\n\t\t\tgoto out;\n\t\t}\n\n\t\tspin_lock_irqsave(&logbuf_lock, flags);\n\t\tlog_buf_len = size;\n\t\tlog_buf = new_log_buf;\n\n\t\toffset = start = min(con_start, log_start);\n\t\tdest_idx = 0;\n\t\twhile (start != log_end) {\n\t\t\tlog_buf[dest_idx] = __log_buf[start & (__LOG_BUF_LEN - 1)];\n\t\t\tstart++;\n\t\t\tdest_idx++;\n\t\t}\n\t\tlog_start -= offset;\n\t\tcon_start -= offset;\n\t\tlog_end -= offset;\n\t\tspin_unlock_irqrestore(&logbuf_lock, flags);\n\n\t\tprintk(KERN_NOTICE \"log_buf_len: %d\\n\", log_buf_len);\n\t}\nout:\n\treturn 1;\n}\n\n__setup(\"log_buf_len=\", log_buf_len_setup);\n\n/*\n * Commands to do_syslog:\n *\n * \t0 -- Close the log. Currently a NOP.\n * \t1 -- Open the log. Currently a NOP.\n * \t2 -- Read from the log.\n * \t3 -- Read all messages remaining in the ring buffer.\n * \t4 -- Read and clear all messages remaining in the ring buffer\n * \t5 -- Clear ring buffer.\n * \t6 -- Disable printk's to console\n * \t7 -- Enable printk's to console\n *\t8 -- Set level of messages printed to console\n *\t9 -- Return number of unread characters in the log buffer\n * 10 -- Return size of the log buffer\n */\nint do_syslog(int type, char __user *buf, int len)\n{\n\tunsigned long i, j, limit, count;\n\tint do_clear = 0;\n\tchar c;\n\tint error = 0;\n\n\terror = security_syslog(type);\n\tif (error)\n\t\treturn error;\n\n\tswitch (type) {\n\tcase 0:\t\t/* Close log */\n\t\tbreak;\n\tcase 1:\t\t/* Open log */\n\t\tbreak;\n\tcase 2:\t\t/* Read from log */\n\t\terror = -EINVAL;\n\t\tif (!buf || len < 0)\n\t\t\tgoto out;\n\t\terror = 0;\n\t\tif (!len)\n\t\t\tgoto out;\n\t\tif (!access_ok(VERIFY_WRITE, buf, len)) {\n\t\t\terror = -EFAULT;\n\t\t\tgoto out;\n\t\t}\n\t\terror = wait_event_interruptible(log_wait,\n\t\t\t\t\t\t\t(log_start - log_end));\n\t\tif (error)\n\t\t\tgoto out;\n\t\ti = 0;\n\t\tspin_lock_irq(&logbuf_lock);\n\t\twhile (!error && (log_start != log_end) && i < len) {\n\t\t\tc = LOG_BUF(log_start);\n\t\t\tlog_start++;\n\t\t\tspin_unlock_irq(&logbuf_lock);\n\t\t\terror = __put_user(c,buf);\n\t\t\tbuf++;\n\t\t\ti++;\n\t\t\tcond_resched();\n\t\t\tspin_lock_irq(&logbuf_lock);\n\t\t}\n\t\tspin_unlock_irq(&logbuf_lock);\n\t\tif (!error)\n\t\t\terror = i;\n\t\tbreak;\n\tcase 4:\t\t/* Read/clear last kernel messages */\n\t\tdo_clear = 1;\n\t\t/* FALL THRU */\n\tcase 3:\t\t/* Read last kernel messages */\n\t\terror = -EINVAL;\n\t\tif (!buf || len < 0)\n\t\t\tgoto out;\n\t\terror = 0;\n\t\tif (!len)\n\t\t\tgoto out;\n\t\tif (!access_ok(VERIFY_WRITE, buf, len)) {\n\t\t\terror = -EFAULT;\n\t\t\tgoto out;\n\t\t}\n\t\tcount = len;\n\t\tif (count > log_buf_len)\n\t\t\tcount = log_buf_len;\n\t\tspin_lock_irq(&logbuf_lock);\n\t\tif (count > logged_chars)\n\t\t\tcount = logged_chars;\n\t\tif (do_clear)\n\t\t\tlogged_chars = 0;\n\t\tlimit = log_end;\n\t\t/*\n\t\t * __put_user() could sleep, and while we sleep\n\t\t * printk() could overwrite the messages\n\t\t * we try to copy to user space. Therefore\n\t\t * the messages are copied in reverse. <manfreds>\n\t\t */\n\t\tfor (i = 0; i < count && !error; i++) {\n\t\t\tj = limit-1-i;\n\t\t\tif (j + log_buf_len < log_end)\n\t\t\t\tbreak;\n\t\t\tc = LOG_BUF(j);\n\t\t\tspin_unlock_irq(&logbuf_lock);\n\t\t\terror = __put_user(c,&buf[count-1-i]);\n\t\t\tcond_resched();\n\t\t\tspin_lock_irq(&logbuf_lock);\n\t\t}\n\t\tspin_unlock_irq(&logbuf_lock);\n\t\tif (error)\n\t\t\tbreak;\n\t\terror = i;\n\t\tif (i != count) {\n\t\t\tint offset = count-error;\n\t\t\t/* buffer overflow during copy, correct user buffer. */\n\t\t\tfor (i = 0; i < error; i++) {\n\t\t\t\tif (__get_user(c,&buf[i+offset]) ||\n\t\t\t\t __put_user(c,&buf[i])) {\n\t\t\t\t\terror = -EFAULT;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcond_resched();\n\t\t\t}\n\t\t}\n\t\tbreak;\n\tcase 5:\t\t/* Clear ring buffer */\n\t\tlogged_chars = 0;\n\t\tbreak;\n\tcase 6:\t\t/* Disable logging to console */\n\t\tconsole_loglevel = minimum_console_loglevel;\n\t\tbreak;\n\tcase 7:\t\t/* Enable logging to console */\n\t\tconsole_loglevel = default_console_loglevel;\n\t\tbreak;\n\tcase 8:\t\t/* Set level of messages printed to console */\n\t\terror = -EINVAL;\n\t\tif (len < 1 || len > 8)\n\t\t\tgoto out;\n\t\tif (len < minimum_console_loglevel)\n\t\t\tlen = minimum_console_loglevel;\n\t\tconsole_loglevel = len;\n\t\terror = 0;\n\t\tbreak;\n\tcase 9:\t\t/* Number of chars in the log buffer */\n\t\terror = log_end - log_start;\n\t\tbreak;\n\tcase 10:\t/* Size of the log buffer */\n\t\terror = log_buf_len;\n\t\tbreak;\n\tdefault:\n\t\terror = -EINVAL;\n\t\tbreak;\n\t}\nout:\n\treturn error;\n}\n\nasmlinkage long sys_syslog(int type, char __user *buf, int len)\n{\n\treturn do_syslog(type, buf, len);\n}\n\n#ifdef CONFIG_DEBUG_KERNEL\n/* Its very handy to be able to view the syslog buffer during debug.\n * But do_syslog() uses locks so it cannot be used during debugging.\n * Instead, provide the start and end of the physical and logical logs.\n * This is equivalent to do_syslog(3).\n */\nvoid debugger_syslog_data(char *syslog_data[4])\n{\n\tsyslog_data[0] = log_buf;\n\tsyslog_data[1] = log_buf + log_buf_len;\n\tsyslog_data[2] = log_buf + log_end - (logged_chars < log_buf_len ? logged_chars : log_buf_len);\n\tsyslog_data[3] = log_buf + log_end;\n}\n#endif /* CONFIG_DEBUG_KERNEL */\n\n#ifdef\tCONFIG_KDB\n/* kdb dmesg command needs access to the syslog buffer. do_syslog() uses locks\n * so it cannot be used during debugging. Just tell kdb where the start and\n * end of the physical and logical logs are. This is equivalent to do_syslog(3).\n */\nvoid kdb_syslog_data(char *syslog_data[4])\n{\n\tsyslog_data[0] = log_buf;\n\tsyslog_data[1] = log_buf + log_buf_len;\n\tsyslog_data[2] = log_buf + log_end - (logged_chars < log_buf_len ? logged_chars : log_buf_len);\n\tsyslog_data[3] = log_buf + log_end;\n}\n#endif\t/* CONFIG_KDB */\n\n/*\n * Call the console drivers on a range of log_buf\n */\nstatic void __call_console_drivers(unsigned long start, unsigned long end)\n{\n\tstruct console *con;\n\n\tfor (con = console_drivers; con; con = con->next) {\n\t\tif ((con->flags & CON_ENABLED) && con->write &&\n\t\t\t\t(cpu_online(smp_processor_id()) ||\n\t\t\t\t(con->flags & CON_ANYTIME)))\n\t\t\tcon->write(con, &LOG_BUF(start), end - start);\n\t}\n}\n\nstatic int __read_mostly ignore_loglevel;\n\nstatic int __init ignore_loglevel_setup(char *str)\n{\n\tignore_loglevel = 1;\n\tprintk(KERN_INFO \"debug: ignoring loglevel setting.\\n\");\n\n\treturn 1;\n}\n\n__setup(\"ignore_loglevel\", ignore_loglevel_setup);\n\n/*\n * Write out chars from start to end - 1 inclusive\n */\nstatic void _call_console_drivers(unsigned long start,\n\t\t\t\tunsigned long end, int msg_log_level)\n{\n\tif ((msg_log_level < console_loglevel || ignore_loglevel) &&\n\t\t\tconsole_drivers && start != end) {\n\t\tif ((start & LOG_BUF_MASK) > (end & LOG_BUF_MASK)) {\n\t\t\t/* wrapped write */\n\t\t\t__call_console_drivers(start & LOG_BUF_MASK,\n\t\t\t\t\t\tlog_buf_len);\n\t\t\t__call_console_drivers(0, end & LOG_BUF_MASK);\n\t\t} else {\n\t\t\t__call_console_drivers(start, end);\n\t\t}\n\t}\n}\n\n/*\n * Call the console drivers, asking them to write out\n * log_buf[start] to log_buf[end - 1].\n * The console_sem must be held.\n */\nstatic void call_console_drivers(unsigned long start, unsigned long end)\n{\n\tunsigned long cur_index, start_print;\n\tstatic int msg_level = -1;\n\n\tBUG_ON(((long)(start - end)) > 0);\n\n\tcur_index = start;\n\tstart_print = start;\n\twhile (cur_index != end) {\n\t\tif (msg_level < 0 && ((end - cur_index) > 2) &&\n\t\t\t\tLOG_BUF(cur_index + 0) == '<' &&\n\t\t\t\tLOG_BUF(cur_index + 1) >= '0' &&\n\t\t\t\tLOG_BUF(cur_index + 1) <= '7' &&\n\t\t\t\tLOG_BUF(cur_index + 2) == '>') {\n\t\t\tmsg_level = LOG_BUF(cur_index + 1) - '0';\n\t\t\tcur_index += 3;\n\t\t\tstart_print = cur_index;\n\t\t}\n\t\twhile (cur_index != end) {\n\t\t\tchar c = LOG_BUF(cur_index);\n\n\t\t\tcur_index++;\n\t\t\tif (c == '\\n') {\n\t\t\t\tif (msg_level < 0) {\n\t\t\t\t\t/*\n\t\t\t\t\t * printk() has already given us loglevel tags in\n\t\t\t\t\t * the buffer. This code is here in case the\n\t\t\t\t\t * log buffer has wrapped right round and scribbled\n\t\t\t\t\t * on those tags\n\t\t\t\t\t */\n\t\t\t\t\tmsg_level = default_message_loglevel;\n\t\t\t\t}\n\t\t\t\t_call_console_drivers(start_print, cur_index, msg_level);\n\t\t\t\tmsg_level = -1;\n\t\t\t\tstart_print = cur_index;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\t_call_console_drivers(start_print, end, msg_level);\n}\n\nstatic void emit_log_char(char c)\n{\n\tLOG_BUF(log_end) = c;\n\tlog_end++;\n\tif (log_end - log_start > log_buf_len)\n\t\tlog_start = log_end - log_buf_len;\n\tif (log_end - con_start > log_buf_len)\n\t\tcon_start = log_end - log_buf_len;\n\tif (logged_chars < log_buf_len)\n\t\tlogged_chars++;\n}\n\n/*\n * Zap console related locks when oopsing. Only zap at most once\n * every 10 seconds, to leave time for slow consoles to print a\n * full oops.\n */\nstatic void zap_locks(void)\n{\n\tstatic unsigned long oops_timestamp;\n\n\tif (time_after_eq(jiffies, oops_timestamp) &&\n\t\t\t!time_after(jiffies, oops_timestamp + 30 * HZ))\n\t\treturn;\n\n\toops_timestamp = jiffies;\n\n\t/* If a crash is occurring, make sure we can't deadlock */\n\tspin_lock_init(&logbuf_lock);\n\t/* And make sure that we print immediately */\n\tinit_MUTEX(&console_sem);\n}\n\n#if defined(CONFIG_PRINTK_TIME)\nstatic int printk_time = 1;\n#else\nstatic int printk_time = 0;\n#endif\nmodule_param(printk_time, int, S_IRUGO | S_IWUSR);\n\nstatic int __init printk_time_setup(char *str)\n{\n\tif (*str)\n\t\treturn 0;\n\tprintk_time = 1;\n\treturn 1;\n}\n\n__setup(\"time\", printk_time_setup);\n\n__attribute__((weak)) unsigned long long printk_clock(void)\n{\n\treturn sched_clock();\n}\n\n/* Check if we have any console registered that can be called early in boot. */\nstatic int have_callable_console(void)\n{\n\tstruct console *con;\n\n\tfor (con = console_drivers; con; con = con->next)\n\t\tif (con->flags & CON_ANYTIME)\n\t\t\treturn 1;\n\n\treturn 0;\n}\n\n/**\n * printk - print a kernel message\n * @fmt: format string\n *\n * This is printk(). It can be called from any context. We want it to work.\n *\n * We try to grab the console_sem. If we succeed, it's easy - we log the output and\n * call the console drivers. If we fail to get the semaphore we place the output\n * into the log buffer and return. The current holder of the console_sem will\n * notice the new output in release_console_sem() and will send it to the\n * consoles before releasing the semaphore.\n *\n * One effect of this deferred printing is that code which calls printk() and\n * then changes console_loglevel may break. This is because console_loglevel\n * is inspected when the actual printing occurs.\n *\n * See also:\n * printf(3)\n */\n\nasmlinkage int printk(const char *fmt, ...)\n{\n\tva_list args;\n\tint r;\n\n\tva_start(args, fmt);\n\tr = vprintk(fmt, args);\n\tva_end(args);\n\n\treturn r;\n}\n\n/* cpu currently holding logbuf_lock */\nstatic volatile unsigned int printk_cpu = UINT_MAX;\n\nasmlinkage int vprintk(const char *fmt, va_list args)\n{\n\tunsigned long flags;\n\tint printed_len;\n\tchar *p;\n\tstatic char printk_buf[1024];\n\tstatic int log_level_unknown = 1;\n\n\tpreempt_disable();\n\tif (unlikely(oops_in_progress) && printk_cpu == smp_processor_id())\n\t\t/* If a crash is occurring during printk() on this CPU,\n\t\t * make sure we can't deadlock */\n\t\tzap_locks();\n\n\t/* This stops the holder of console_sem just where we want him */\n\traw_local_irq_save(flags);\n\tlockdep_off();\n\tspin_lock(&logbuf_lock);\n\tprintk_cpu = smp_processor_id();\n\n\t/* Emit the output into the temporary buffer */\n\tprinted_len = vscnprintf(printk_buf, sizeof(printk_buf), fmt, args);\n\n\t/*\n\t * Copy the output into log_buf. If the caller didn't provide\n\t * appropriate log level tags, we insert them here\n\t */\n\tfor (p = printk_buf; *p; p++) {\n\t\tif (log_level_unknown) {\n /* log_level_unknown signals the start of a new line */\n\t\t\tif (printk_time) {\n\t\t\t\tint loglev_char;\n\t\t\t\tchar tbuf[50], *tp;\n\t\t\t\tunsigned tlen;\n\t\t\t\tunsigned long long t;\n\t\t\t\tunsigned long nanosec_rem;\n\n\t\t\t\t/*\n\t\t\t\t * force the log level token to be\n\t\t\t\t * before the time output.\n\t\t\t\t */\n\t\t\t\tif (p[0] == '<' && p[1] >='0' &&\n\t\t\t\t p[1] <= '7' && p[2] == '>') {\n\t\t\t\t\tloglev_char = p[1];\n\t\t\t\t\tp += 3;\n\t\t\t\t\tprinted_len -= 3;\n\t\t\t\t} else {\n\t\t\t\t\tloglev_char = default_message_loglevel\n\t\t\t\t\t\t+ '0';\n\t\t\t\t}\n\t\t\t\tt = printk_clock();\n\t\t\t\tnanosec_rem = do_div(t, 1000000000);\n\t\t\t\ttlen = sprintf(tbuf,\n\t\t\t\t\t\t\"<%c>[%5lu.%06lu] \",\n\t\t\t\t\t\tloglev_char,\n\t\t\t\t\t\t(unsigned long)t,\n\t\t\t\t\t\tnanosec_rem/1000);\n\n\t\t\t\tfor (tp = tbuf; tp < tbuf + tlen; tp++)\n\t\t\t\t\temit_log_char(*tp);\n\t\t\t\tprinted_len += tlen;\n\t\t\t} else {\n\t\t\t\tif (p[0] != '<' || p[1] < '0' ||\n\t\t\t\t p[1] > '7' || p[2] != '>') {\n\t\t\t\t\temit_log_char('<');\n\t\t\t\t\temit_log_char(default_message_loglevel\n\t\t\t\t\t\t+ '0');\n\t\t\t\t\temit_log_char('>');\n\t\t\t\t\tprinted_len += 3;\n\t\t\t\t}\n\t\t\t}\n\t\t\tlog_level_unknown = 0;\n\t\t\tif (!*p)\n\t\t\t\tbreak;\n\t\t}\n\t\temit_log_char(*p);\n\t\tif (*p == '\\n')\n\t\t\tlog_level_unknown = 1;\n\t}\n\n\tif (!down_trylock(&console_sem)) {\n\t\t/*\n\t\t * We own the drivers. We can drop the spinlock and\n\t\t * let release_console_sem() print the text, maybe ...\n\t\t */\n\t\tconsole_locked = 1;\n\t\tprintk_cpu = UINT_MAX;\n\t\tspin_unlock(&logbuf_lock);\n\n\t\t/*\n\t\t * Console drivers may assume that per-cpu resources have\n\t\t * been allocated. So unless they're explicitly marked as\n\t\t * being able to cope (CON_ANYTIME) don't call them until\n\t\t * this CPU is officially up.\n\t\t */\n\t\tif (cpu_online(smp_processor_id()) || have_callable_console()) {\n\t\t\tconsole_may_schedule = 0;\n\t\t\trelease_console_sem();\n\t\t} else {\n\t\t\t/* Release by hand to avoid flushing the buffer. */\n\t\t\tconsole_locked = 0;\n\t\t\tup(&console_sem);\n\t\t}\n\t\tlockdep_on();\n\t\traw_local_irq_restore(flags);\n\t} else {\n\t\t/*\n\t\t * Someone else owns the drivers. We drop the spinlock, which\n\t\t * allows the semaphore holder to proceed and to call the\n\t\t * console drivers with the output which we just produced.\n\t\t */\n\t\tprintk_cpu = UINT_MAX;\n\t\tspin_unlock(&logbuf_lock);\n\t\tlockdep_on();\n\t\traw_local_irq_restore(flags);\n\t}\n\n\tpreempt_enable();\n\treturn printed_len;\n}\nEXPORT_SYMBOL(printk);\nEXPORT_SYMBOL(vprintk);\n\n#else\n\nasmlinkage long sys_syslog(int type, char __user *buf, int len)\n{\n\treturn -ENOSYS;\n}\n\nstatic void call_console_drivers(unsigned long start, unsigned long end)\n{\n}\n\n#endif\n\n/*\n * Set up a list of consoles. Called from init/main.c\n */\nstatic int __init console_setup(char *str)\n{\n\tchar name[sizeof(console_cmdline[0].name)];\n\tchar *s, *options;\n\tint idx;\n\n\t/*\n\t * Decode str into name, index, options.\n\t */\n\tif (str[0] >= '0' && str[0] <= '9') {\n\t\tstrcpy(name, \"ttyS\");\n\t\tstrncpy(name + 4, str, sizeof(name) - 5);\n\t} else {\n\t\tstrncpy(name, str, sizeof(name) - 1);\n\t}\n\tname[sizeof(name) - 1] = 0;\n\tif ((options = strchr(str, ',')) != NULL)\n\t\t*(options++) = 0;\n#ifdef __sparc__\n\tif (!strcmp(str, \"ttya\"))\n\t\tstrcpy(name, \"ttyS0\");\n\tif (!strcmp(str, \"ttyb\"))\n\t\tstrcpy(name, \"ttyS1\");\n#endif\n\tfor (s = name; *s; s++)\n\t\tif ((*s >= '0' && *s <= '9') || *s == ',')\n\t\t\tbreak;\n\tidx = simple_strtoul(s, NULL, 10);\n\t*s = 0;\n\n\tadd_preferred_console(name, idx, options);\n\treturn 1;\n}\n__setup(\"console=\", console_setup);\n\n/**\n * add_preferred_console - add a device to the list of preferred consoles.\n * @name: device name\n * @idx: device index\n * @options: options for this console\n *\n * The last preferred console added will be used for kernel messages\n * and stdin/out/err for init. Normally this is used by console_setup\n * above to handle user-supplied console arguments; however it can also\n * be used by arch-specific code either to override the user or more\n * commonly to provide a default console (ie from PROM variables) when\n * the user has not supplied one.\n */\nint __init add_preferred_console(char *name, int idx, char *options)\n{\n\tstruct console_cmdline *c;\n\tint i;\n\n\t/*\n\t *\tSee if this tty is not yet registered, and\n\t *\tif we have a slot free.\n\t */\n\tfor(i = 0; i < MAX_CMDLINECONSOLES && console_cmdline[i].name[0]; i++)\n\t\tif (strcmp(console_cmdline[i].name, name) == 0 &&\n\t\t\t console_cmdline[i].index == idx) {\n\t\t\t\tselected_console = i;\n\t\t\t\treturn 0;\n\t\t}\n\tif (i == MAX_CMDLINECONSOLES)\n\t\treturn -E2BIG;\n\tselected_console = i;\n\tc = &console_cmdline[i];\n\tmemcpy(c->name, name, sizeof(c->name));\n\tc->name[sizeof(c->name) - 1] = 0;\n\tc->options = options;\n\tc->index = idx;\n\treturn 0;\n}\n\n#ifndef CONFIG_DISABLE_CONSOLE_SUSPEND\n/**\n * suspend_console - suspend the console subsystem\n *\n * This disables printk() while we go into suspend states\n */\nvoid suspend_console(void)\n{\n\tprintk(\"Suspending console(s)\\n\");\n\tacquire_console_sem();\n\tconsole_suspended = 1;\n}\n\nvoid resume_console(void)\n{\n\tconsole_suspended = 0;\n\trelease_console_sem();\n}\n#endif /* CONFIG_DISABLE_CONSOLE_SUSPEND */\n\n/**\n * acquire_console_sem - lock the console system for exclusive use.\n *\n * Acquires a semaphore which guarantees that the caller has\n * exclusive access to the console system and the console_drivers list.\n *\n * Can sleep, returns nothing.\n */\nvoid acquire_console_sem(void)\n{\n\tBUG_ON(in_interrupt());\n\tif (console_suspended) {\n\t\tdown(&secondary_console_sem);\n\t\treturn;\n\t}\n\tdown(&console_sem);\n\tconsole_locked = 1;\n\tconsole_may_schedule = 1;\n}\nEXPORT_SYMBOL(acquire_console_sem);\n\nint try_acquire_console_sem(void)\n{\n\tif (down_trylock(&console_sem))\n\t\treturn -1;\n\tconsole_locked = 1;\n\tconsole_may_schedule = 0;\n\treturn 0;\n}\nEXPORT_SYMBOL(try_acquire_console_sem);\n\nint is_console_locked(void)\n{\n\treturn console_locked;\n}\n\nvoid wake_up_klogd(void)\n{\n\tif (!oops_in_progress && waitqueue_active(&log_wait))\n\t\twake_up_interruptible(&log_wait);\n}\n\n/**\n * release_console_sem - unlock the console system\n *\n * Releases the semaphore which the caller holds on the console system\n * and the console driver list.\n *\n * While the semaphore was held, console output may have been buffered\n * by printk(). If this is the case, release_console_sem() emits\n * the output prior to releasing the semaphore.\n *\n * If there is output waiting for klogd, we wake it up.\n *\n * release_console_sem() may be called from any context.\n */\nvoid release_console_sem(void)\n{\n\tunsigned long flags;\n\tunsigned long _con_start, _log_end;\n\tunsigned long wake_klogd = 0;\n\n\tif (console_suspended) {\n\t\tup(&secondary_console_sem);\n\t\treturn;\n\t}\n\n\tconsole_may_schedule = 0;\n\n\tfor ( ; ; ) {\n\t\tspin_lock_irqsave(&logbuf_lock, flags);\n\t\twake_klogd |= log_start - log_end;\n\t\tif (con_start == log_end)\n\t\t\tbreak;\t\t\t/* Nothing to print */\n\t\t_con_start = con_start;\n\t\t_log_end = log_end;\n\t\tcon_start = log_end;\t\t/* Flush */\n\t\tspin_unlock(&logbuf_lock);\n\t\tcall_console_drivers(_con_start, _log_end);\n\t\tlocal_irq_restore(flags);\n\t}\n\tconsole_locked = 0;\n\tup(&console_sem);\n\tspin_unlock_irqrestore(&logbuf_lock, flags);\n\tif (wake_klogd)\n\t\twake_up_klogd();\n}\nEXPORT_SYMBOL(release_console_sem);\n\n/**\n * console_conditional_schedule - yield the CPU if required\n *\n * If the console code is currently allowed to sleep, and\n * if this CPU should yield the CPU to another task, do\n * so here.\n *\n * Must be called within acquire_console_sem().\n */\nvoid __sched console_conditional_schedule(void)\n{\n\tif (console_may_schedule)\n\t\tcond_resched();\n}\nEXPORT_SYMBOL(console_conditional_schedule);\n\nvoid console_print(const char *s)\n{\n\tprintk(KERN_EMERG \"%s\", s);\n}\nEXPORT_SYMBOL(console_print);\n\nvoid console_unblank(void)\n{\n\tstruct console *c;\n\n\t/*\n\t * console_unblank can no longer be called in interrupt context unless\n\t * oops_in_progress is set to 1..\n\t */\n\tif (oops_in_progress) {\n\t\tif (down_trylock(&console_sem) != 0)\n\t\t\treturn;\n\t} else\n\t\tacquire_console_sem();\n\n\tconsole_locked = 1;\n\tconsole_may_schedule = 0;\n\tfor (c = console_drivers; c != NULL; c = c->next)\n\t\tif ((c->flags & CON_ENABLED) && c->unblank)\n\t\t\tc->unblank();\n\trelease_console_sem();\n}\n\n/*\n * Return the console tty driver structure and its associated index\n */\nstruct tty_driver *console_device(int *index)\n{\n\tstruct console *c;\n\tstruct tty_driver *driver = NULL;\n\n\tacquire_console_sem();\n\tfor (c = console_drivers; c != NULL; c = c->next) {\n\t\tif (!c->device)\n\t\t\tcontinue;\n\t\tdriver = c->device(c, index);\n\t\tif (driver)\n\t\t\tbreak;\n\t}\n\trelease_console_sem();\n\treturn driver;\n}\n\n/*\n * Prevent further output on the passed console device so that (for example)\n * serial drivers can disable console output before suspending a port, and can\n * re-enable output afterwards.\n */\nvoid console_stop(struct console *console)\n{\n\tacquire_console_sem();\n\tconsole->flags &= ~CON_ENABLED;\n\trelease_console_sem();\n}\nEXPORT_SYMBOL(console_stop);\n\nvoid console_start(struct console *console)\n{\n\tacquire_console_sem();\n\tconsole->flags |= CON_ENABLED;\n\trelease_console_sem();\n}\nEXPORT_SYMBOL(console_start);\n\n/*\n * The console driver calls this routine during kernel initialization\n * to register the console printing procedure with printk() and to\n * print any messages that were printed by the kernel before the\n * console driver was initialized.\n */\nvoid register_console(struct console *console)\n{\n\tint i;\n\tunsigned long flags;\n\tstruct console *bootconsole = NULL;\n\n\tif (console_drivers) {\n\t\tif (console->flags & CON_BOOT)\n\t\t\treturn;\n\t\tif (console_drivers->flags & CON_BOOT)\n\t\t\tbootconsole = console_drivers;\n\t}\n\n\tif (preferred_console < 0 || bootconsole || !console_drivers)\n\t\tpreferred_console = selected_console;\n\n\t/*\n\t *\tSee if we want to use this console driver. If we\n\t *\tdidn't select a console we take the first one\n\t *\tthat registers here.\n\t */\n\tif (preferred_console < 0) {\n\t\tif (console->index < 0)\n\t\t\tconsole->index = 0;\n\t\tif (console->setup == NULL ||\n\t\t console->setup(console, NULL) == 0) {\n\t\t\tconsole->flags |= CON_ENABLED | CON_CONSDEV;\n\t\t\tpreferred_console = 0;\n\t\t}\n\t}\n\n\t/*\n\t *\tSee if this console matches one we selected on\n\t *\tthe command line.\n\t */\n\tfor (i = 0; i < MAX_CMDLINECONSOLES && console_cmdline[i].name[0];\n\t\t\ti++) {\n\t\tif (strcmp(console_cmdline[i].name, console->name) != 0)\n\t\t\tcontinue;\n\t\tif (console->index >= 0 &&\n\t\t console->index != console_cmdline[i].index)\n\t\t\tcontinue;\n\t\tif (console->index < 0)\n\t\t\tconsole->index = console_cmdline[i].index;\n\t\tif (console->setup &&\n\t\t console->setup(console, console_cmdline[i].options) != 0)\n\t\t\tbreak;\n\t\tconsole->flags |= CON_ENABLED;\n\t\tconsole->index = console_cmdline[i].index;\n\t\tif (i == selected_console) {\n\t\t\tconsole->flags |= CON_CONSDEV;\n\t\t\tpreferred_console = selected_console;\n\t\t}\n\t\tbreak;\n\t}\n\n\tif (!(console->flags & CON_ENABLED))\n\t\treturn;\n\n\tif (bootconsole) {\n\t\tprintk(KERN_INFO \"console handover: boot [%s%d] -> real [%s%d]\\n\",\n\t\t bootconsole->name, bootconsole->index,\n\t\t console->name, console->index);\n\t\tunregister_console(bootconsole);\n\t\tconsole->flags &= ~CON_PRINTBUFFER;\n\t}\n\n\t/*\n\t *\tPut this console in the list - keep the\n\t *\tpreferred driver at the head of the list.\n\t */\n\tacquire_console_sem();\n\tif ((console->flags & CON_CONSDEV) || console_drivers == NULL) {\n\t\tconsole->next = console_drivers;\n\t\tconsole_drivers = console;\n\t\tif (console->next)\n\t\t\tconsole->next->flags &= ~CON_CONSDEV;\n\t} else {\n\t\tconsole->next = console_drivers->next;\n\t\tconsole_drivers->next = console;\n\t}\n\tif (console->flags & CON_PRINTBUFFER) {\n\t\t/*\n\t\t * release_console_sem() will print out the buffered messages\n\t\t * for us.\n\t\t */\n\t\tspin_lock_irqsave(&logbuf_lock, flags);\n\t\tcon_start = log_start;\n\t\tspin_unlock_irqrestore(&logbuf_lock, flags);\n\t}\n\trelease_console_sem();\n}\nEXPORT_SYMBOL(register_console);\n\nint unregister_console(struct console *console)\n{\n struct console *a, *b;\n\tint res = 1;\n\n\tacquire_console_sem();\n\tif (console_drivers == console) {\n\t\tconsole_drivers=console->next;\n\t\tres = 0;\n\t} else if (console_drivers) {\n\t\tfor (a=console_drivers->next, b=console_drivers ;\n\t\t a; b=a, a=b->next) {\n\t\t\tif (a == console) {\n\t\t\t\tb->next = a->next;\n\t\t\t\tres = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\t/*\n\t * If this isn't the last console and it has CON_CONSDEV set, we\n\t * need to set it on the next preferred console.\n\t */\n\tif (console_drivers != NULL && console->flags & CON_CONSDEV)\n\t\tconsole_drivers->flags |= CON_CONSDEV;\n\n\trelease_console_sem();\n\treturn res;\n}\nEXPORT_SYMBOL(unregister_console);\n\n/**\n * tty_write_message - write a message to a certain tty, not just the console.\n * @tty: the destination tty_struct\n * @msg: the message to write\n *\n * This is used for messages that need to be redirected to a specific tty.\n * We don't put it into the syslog queue right now maybe in the future if\n * really needed.\n */\nvoid tty_write_message(struct tty_struct *tty, char *msg)\n{\n\tif (tty && tty->driver->write)\n\t\ttty->driver->write(tty, msg, strlen(msg));\n\treturn;\n}\n\n/*\n * printk rate limiting, lifted from the networking subsystem.\n *\n * This enforces a rate limit: not more than one kernel message\n * every printk_ratelimit_jiffies to make a denial-of-service\n * attack impossible.\n */\nint __printk_ratelimit(int ratelimit_jiffies, int ratelimit_burst)\n{\n\tstatic DEFINE_SPINLOCK(ratelimit_lock);\n\tstatic unsigned long toks = 10 * 5 * HZ;\n\tstatic unsigned long last_msg;\n\tstatic int missed;\n\tunsigned long flags;\n\tunsigned long now = jiffies;\n\n\tspin_lock_irqsave(&ratelimit_lock, flags);\n\ttoks += now - last_msg;\n\tlast_msg = now;\n\tif (toks > (ratelimit_burst * ratelimit_jiffies))\n\t\ttoks = ratelimit_burst * ratelimit_jiffies;\n\tif (toks >= ratelimit_jiffies) {\n\t\tint lost = missed;\n\n\t\tmissed = 0;\n\t\ttoks -= ratelimit_jiffies;\n\t\tspin_unlock_irqrestore(&ratelimit_lock, flags);\n\t\tif (lost)\n\t\t\tprintk(KERN_WARNING \"printk: %d messages suppressed.\\n\", lost);\n\t\treturn 1;\n\t}\n\tmissed++;\n\tspin_unlock_irqrestore(&ratelimit_lock, flags);\n\treturn 0;\n}\nEXPORT_SYMBOL(__printk_ratelimit);\n\n/* minimum time in jiffies between messages */\nint printk_ratelimit_jiffies = 5 * HZ;\n\n/* number of messages we send before ratelimiting */\nint printk_ratelimit_burst = 10;\n\nint printk_ratelimit(void)\n{\n\treturn __printk_ratelimit(printk_ratelimit_jiffies,\n\t\t\t\tprintk_ratelimit_burst);\n}\nEXPORT_SYMBOL(printk_ratelimit);\n\n/**\n * printk_timed_ratelimit - caller-controlled printk ratelimiting\n * @caller_jiffies: pointer to caller's state\n * @interval_msecs: minimum interval between prints\n *\n * printk_timed_ratelimit() returns true if more than @interval_msecs\n * milliseconds have elapsed since the last time printk_timed_ratelimit()\n * returned true.\n */\nbool printk_timed_ratelimit(unsigned long *caller_jiffies,\n\t\t\tunsigned int interval_msecs)\n{\n\tif (*caller_jiffies == 0 || time_after(jiffies, *caller_jiffies)) {\n\t\t*caller_jiffies = jiffies + msecs_to_jiffies(interval_msecs);\n\t\treturn true;\n\t}\n\treturn false;\n}\nEXPORT_SYMBOL(printk_timed_ratelimit);\n/*\n * linux/kernel/profile.c\n * Simple profiling. Manages a direct-mapped profile hit count buffer,\n * with configurable resolution, support for restricting the cpus on\n * which profiling is done, and switching between cpu time and\n * schedule() calls via kernel command line parameters passed at boot.\n *\n * Scheduler profiling support, Arjan van de Ven and Ingo Molnar,\n *\tRed Hat, July 2004\n * Consolidation of architecture support code for profiling,\n *\tWilliam Irwin, Oracle, July 2004\n * Amortized hit count accounting via per-cpu open-addressed hashtables\n *\tto resolve timer interrupt livelocks, William Irwin, Oracle, 2004\n */\n\n#include <linux/module.h>\n#include <linux/profile.h>\n#include <linux/bootmem.h>\n#include <linux/notifier.h>\n#include <linux/mm.h>\n#include <linux/cpumask.h>\n#include <linux/cpu.h>\n#include <linux/profile.h>\n#include <linux/highmem.h>\n#include <linux/mutex.h>\n#include <asm/sections.h>\n#include <asm/semaphore.h>\n#include <asm/irq_regs.h>\n#include <asm/ptrace.h>\n\nstruct profile_hit {\n\tu32 pc, hits;\n};\n#define PROFILE_GRPSHIFT\t3\n#define PROFILE_GRPSZ\t\t(1 << PROFILE_GRPSHIFT)\n#define NR_PROFILE_HIT\t\t(PAGE_SIZE/sizeof(struct profile_hit))\n#define NR_PROFILE_GRP\t\t(NR_PROFILE_HIT/PROFILE_GRPSZ)\n\n/* Oprofile timer tick hook */\nint (*timer_hook)(struct pt_regs *) __read_mostly;\n\nstatic atomic_t *prof_buffer;\nstatic unsigned long prof_len, prof_shift;\n\nint prof_on __read_mostly;\nEXPORT_SYMBOL_GPL(prof_on);\n\nstatic cpumask_t prof_cpu_mask = CPU_MASK_ALL;\n#ifdef CONFIG_SMP\nstatic DEFINE_PER_CPU(struct profile_hit *[2], cpu_profile_hits);\nstatic DEFINE_PER_CPU(int, cpu_profile_flip);\nstatic DEFINE_MUTEX(profile_flip_mutex);\n#endif /* CONFIG_SMP */\n\nstatic int __init profile_setup(char * str)\n{\n\tstatic char __initdata schedstr[] = \"schedule\";\n\tstatic char __initdata sleepstr[] = \"sleep\";\n\tstatic char __initdata kvmstr[] = \"kvm\";\n\tint par;\n\n\tif (!strncmp(str, sleepstr, strlen(sleepstr))) {\n\t\tprof_on = SLEEP_PROFILING;\n\t\tif (str[strlen(sleepstr)] == ',')\n\t\t\tstr += strlen(sleepstr) + 1;\n\t\tif (get_option(&str, &par))\n\t\t\tprof_shift = par;\n\t\tprintk(KERN_INFO\n\t\t\t\"kernel sleep profiling enabled (shift: %ld)\\n\",\n\t\t\tprof_shift);\n\t} else if (!strncmp(str, schedstr, strlen(schedstr))) {\n\t\tprof_on = SCHED_PROFILING;\n\t\tif (str[strlen(schedstr)] == ',')\n\t\t\tstr += strlen(schedstr) + 1;\n\t\tif (get_option(&str, &par))\n\t\t\tprof_shift = par;\n\t\tprintk(KERN_INFO\n\t\t\t\"kernel schedule profiling enabled (shift: %ld)\\n\",\n\t\t\tprof_shift);\n\t} else if (!strncmp(str, kvmstr, strlen(kvmstr))) {\n\t\tprof_on = KVM_PROFILING;\n\t\tif (str[strlen(kvmstr)] == ',')\n\t\t\tstr += strlen(kvmstr) + 1;\n\t\tif (get_option(&str, &par))\n\t\t\tprof_shift = par;\n\t\tprintk(KERN_INFO\n\t\t\t\"kernel KVM profiling enabled (shift: %ld)\\n\",\n\t\t\tprof_shift);\n\t} else if (get_option(&str, &par)) {\n\t\tprof_shift = par;\n\t\tprof_on = CPU_PROFILING;\n\t\tprintk(KERN_INFO \"kernel profiling enabled (shift: %ld)\\n\",\n\t\t\tprof_shift);\n\t}\n\treturn 1;\n}\n__setup(\"profile=\", profile_setup);\n\n\nvoid __init profile_init(void)\n{\n\tif (!prof_on) \n\t\treturn;\n \n\t/* only text is profiled */\n\tprof_len = (_etext - _stext) >> prof_shift;\n\tprof_buffer = alloc_bootmem(prof_len*sizeof(atomic_t));\n}\n\n/* Profile event notifications */\n \n#ifdef CONFIG_PROFILING\n \nstatic BLOCKING_NOTIFIER_HEAD(task_exit_notifier);\nstatic ATOMIC_NOTIFIER_HEAD(task_free_notifier);\nstatic BLOCKING_NOTIFIER_HEAD(munmap_notifier);\n \nvoid profile_task_exit(struct task_struct * task)\n{\n\tblocking_notifier_call_chain(&task_exit_notifier, 0, task);\n}\n \nint profile_handoff_task(struct task_struct * task)\n{\n\tint ret;\n\tret = atomic_notifier_call_chain(&task_free_notifier, 0, task);\n\treturn (ret == NOTIFY_OK) ? 1 : 0;\n}\n\nvoid profile_munmap(unsigned long addr)\n{\n\tblocking_notifier_call_chain(&munmap_notifier, 0, (void *)addr);\n}\n\nint task_handoff_register(struct notifier_block * n)\n{\n\treturn atomic_notifier_chain_register(&task_free_notifier, n);\n}\n\nint task_handoff_unregister(struct notifier_block * n)\n{\n\treturn atomic_notifier_chain_unregister(&task_free_notifier, n);\n}\n\nint profile_event_register(enum profile_type type, struct notifier_block * n)\n{\n\tint err = -EINVAL;\n \n\tswitch (type) {\n\t\tcase PROFILE_TASK_EXIT:\n\t\t\terr = blocking_notifier_chain_register(\n\t\t\t\t\t&task_exit_notifier, n);\n\t\t\tbreak;\n\t\tcase PROFILE_MUNMAP:\n\t\t\terr = blocking_notifier_chain_register(\n\t\t\t\t\t&munmap_notifier, n);\n\t\t\tbreak;\n\t}\n \n\treturn err;\n}\n\n \nint profile_event_unregister(enum profile_type type, struct notifier_block * n)\n{\n\tint err = -EINVAL;\n \n\tswitch (type) {\n\t\tcase PROFILE_TASK_EXIT:\n\t\t\terr = blocking_notifier_chain_unregister(\n\t\t\t\t\t&task_exit_notifier, n);\n\t\t\tbreak;\n\t\tcase PROFILE_MUNMAP:\n\t\t\terr = blocking_notifier_chain_unregister(\n\t\t\t\t\t&munmap_notifier, n);\n\t\t\tbreak;\n\t}\n\n\treturn err;\n}\n\nint register_timer_hook(int (*hook)(struct pt_regs *))\n{\n\tif (timer_hook)\n\t\treturn -EBUSY;\n\ttimer_hook = hook;\n\treturn 0;\n}\n\nvoid unregister_timer_hook(int (*hook)(struct pt_regs *))\n{\n\tWARN_ON(hook != timer_hook);\n\ttimer_hook = NULL;\n\t/* make sure all CPUs see the NULL hook */\n\tsynchronize_sched(); /* Allow ongoing interrupts to complete. */\n}\n\nEXPORT_SYMBOL_GPL(register_timer_hook);\nEXPORT_SYMBOL_GPL(unregister_timer_hook);\nEXPORT_SYMBOL_GPL(task_handoff_register);\nEXPORT_SYMBOL_GPL(task_handoff_unregister);\n\n\nEXPORT_SYMBOL_GPL(profile_event_register);\nEXPORT_SYMBOL_GPL(profile_event_unregister);\n#endif /* CONFIG_PROFILING */\n\n#ifdef CONFIG_SMP\n/*\n * Each cpu has a pair of open-addressed hashtables for pending\n * profile hits. read_profile() IPI's all cpus to request them\n * to flip buffers and flushes their contents to prof_buffer itself.\n * Flip requests are serialized by the profile_flip_mutex. The sole\n * use of having a second hashtable is for avoiding cacheline\n * contention that would otherwise happen during flushes of pending\n * profile hits required for the accuracy of reported profile hits\n * and so resurrect the interrupt livelock issue.\n *\n * The open-addressed hashtables are indexed by profile buffer slot\n * and hold the number of pending hits to that profile buffer slot on\n * a cpu in an entry. When the hashtable overflows, all pending hits\n * are accounted to their corresponding profile buffer slots with\n * atomic_add() and the hashtable emptied. As numerous pending hits\n * may be accounted to a profile buffer slot in a hashtable entry,\n * this amortizes a number of atomic profile buffer increments likely\n * to be far larger than the number of entries in the hashtable,\n * particularly given that the number of distinct profile buffer\n * positions to which hits are accounted during short intervals (e.g.\n * several seconds) is usually very small. Exclusion from buffer\n * flipping is provided by interrupt disablement (note that for\n * SCHED_PROFILING or SLEEP_PROFILING profile_hit() may be called from\n * process context).\n * The hash function is meant to be lightweight as opposed to strong,\n * and was vaguely inspired by ppc64 firmware-supported inverted\n * pagetable hash functions, but uses a full hashtable full of finite\n * collision chains, not just pairs of them.\n *\n * -- wli\n */\nstatic void __profile_flip_buffers(void *unused)\n{\n\tint cpu = smp_processor_id();\n\n\tper_cpu(cpu_profile_flip, cpu) = !per_cpu(cpu_profile_flip, cpu);\n}\n\nstatic void profile_flip_buffers(void)\n{\n\tint i, j, cpu;\n\n\tmutex_lock(&profile_flip_mutex);\n\tj = per_cpu(cpu_profile_flip, get_cpu());\n\tput_cpu();\n\ton_each_cpu(__profile_flip_buffers, NULL, 0, 1);\n\tfor_each_online_cpu(cpu) {\n\t\tstruct profile_hit *hits = per_cpu(cpu_profile_hits, cpu)[j];\n\t\tfor (i = 0; i < NR_PROFILE_HIT; ++i) {\n\t\t\tif (!hits[i].hits) {\n\t\t\t\tif (hits[i].pc)\n\t\t\t\t\thits[i].pc = 0;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tatomic_add(hits[i].hits, &prof_buffer[hits[i].pc]);\n\t\t\thits[i].hits = hits[i].pc = 0;\n\t\t}\n\t}\n\tmutex_unlock(&profile_flip_mutex);\n}\n\nstatic void profile_discard_flip_buffers(void)\n{\n\tint i, cpu;\n\n\tmutex_lock(&profile_flip_mutex);\n\ti = per_cpu(cpu_profile_flip, get_cpu());\n\tput_cpu();\n\ton_each_cpu(__profile_flip_buffers, NULL, 0, 1);\n\tfor_each_online_cpu(cpu) {\n\t\tstruct profile_hit *hits = per_cpu(cpu_profile_hits, cpu)[i];\n\t\tmemset(hits, 0, NR_PROFILE_HIT*sizeof(struct profile_hit));\n\t}\n\tmutex_unlock(&profile_flip_mutex);\n}\n\nvoid profile_hits(int type, void *__pc, unsigned int nr_hits)\n{\n\tunsigned long primary, secondary, flags, pc = (unsigned long)__pc;\n\tint i, j, cpu;\n\tstruct profile_hit *hits;\n\n\tif (prof_on != type || !prof_buffer)\n\t\treturn;\n\tpc = min((pc - (unsigned long)_stext) >> prof_shift, prof_len - 1);\n\ti = primary = (pc & (NR_PROFILE_GRP - 1)) << PROFILE_GRPSHIFT;\n\tsecondary = (~(pc << 1) & (NR_PROFILE_GRP - 1)) << PROFILE_GRPSHIFT;\n\tcpu = get_cpu();\n\thits = per_cpu(cpu_profile_hits, cpu)[per_cpu(cpu_profile_flip, cpu)];\n\tif (!hits) {\n\t\tput_cpu();\n\t\treturn;\n\t}\n\t/*\n\t * We buffer the global profiler buffer into a per-CPU\n\t * queue and thus reduce the number of global (and possibly\n\t * NUMA-alien) accesses. The write-queue is self-coalescing:\n\t */\n\tlocal_irq_save(flags);\n\tdo {\n\t\tfor (j = 0; j < PROFILE_GRPSZ; ++j) {\n\t\t\tif (hits[i + j].pc == pc) {\n\t\t\t\thits[i + j].hits += nr_hits;\n\t\t\t\tgoto out;\n\t\t\t} else if (!hits[i + j].hits) {\n\t\t\t\thits[i + j].pc = pc;\n\t\t\t\thits[i + j].hits = nr_hits;\n\t\t\t\tgoto out;\n\t\t\t}\n\t\t}\n\t\ti = (i + secondary) & (NR_PROFILE_HIT - 1);\n\t} while (i != primary);\n\n\t/*\n\t * Add the current hit(s) and flush the write-queue out\n\t * to the global buffer:\n\t */\n\tatomic_add(nr_hits, &prof_buffer[pc]);\n\tfor (i = 0; i < NR_PROFILE_HIT; ++i) {\n\t\tatomic_add(hits[i].hits, &prof_buffer[hits[i].pc]);\n\t\thits[i].pc = hits[i].hits = 0;\n\t}\nout:\n\tlocal_irq_restore(flags);\n\tput_cpu();\n}\n\nstatic int __devinit profile_cpu_callback(struct notifier_block *info,\n\t\t\t\t\tunsigned long action, void *__cpu)\n{\n\tint node, cpu = (unsigned long)__cpu;\n\tstruct page *page;\n\n\tswitch (action) {\n\tcase CPU_UP_PREPARE:\n\tcase CPU_UP_PREPARE_FROZEN:\n\t\tnode = cpu_to_node(cpu);\n\t\tper_cpu(cpu_profile_flip, cpu) = 0;\n\t\tif (!per_cpu(cpu_profile_hits, cpu)[1]) {\n\t\t\tpage = alloc_pages_node(node,\n\t\t\t\t\tGFP_KERNEL | __GFP_ZERO | GFP_THISNODE,\n\t\t\t\t\t0);\n\t\t\tif (!page)\n\t\t\t\treturn NOTIFY_BAD;\n\t\t\tper_cpu(cpu_profile_hits, cpu)[1] = page_address(page);\n\t\t}\n\t\tif (!per_cpu(cpu_profile_hits, cpu)[0]) {\n\t\t\tpage = alloc_pages_node(node,\n\t\t\t\t\tGFP_KERNEL | __GFP_ZERO | GFP_THISNODE,\n\t\t\t\t\t0);\n\t\t\tif (!page)\n\t\t\t\tgoto out_free;\n\t\t\tper_cpu(cpu_profile_hits, cpu)[0] = page_address(page);\n\t\t}\n\t\tbreak;\n\tout_free:\n\t\tpage = virt_to_page(per_cpu(cpu_profile_hits, cpu)[1]);\n\t\tper_cpu(cpu_profile_hits, cpu)[1] = NULL;\n\t\t__free_page(page);\n\t\treturn NOTIFY_BAD;\n\tcase CPU_ONLINE:\n\tcase CPU_ONLINE_FROZEN:\n\t\tcpu_set(cpu, prof_cpu_mask);\n\t\tbreak;\n\tcase CPU_UP_CANCELED:\n\tcase CPU_UP_CANCELED_FROZEN:\n\tcase CPU_DEAD:\n\tcase CPU_DEAD_FROZEN:\n\t\tcpu_clear(cpu, prof_cpu_mask);\n\t\tif (per_cpu(cpu_profile_hits, cpu)[0]) {\n\t\t\tpage = virt_to_page(per_cpu(cpu_profile_hits, cpu)[0]);\n\t\t\tper_cpu(cpu_profile_hits, cpu)[0] = NULL;\n\t\t\t__free_page(page);\n\t\t}\n\t\tif (per_cpu(cpu_profile_hits, cpu)[1]) {\n\t\t\tpage = virt_to_page(per_cpu(cpu_profile_hits, cpu)[1]);\n\t\t\tper_cpu(cpu_profile_hits, cpu)[1] = NULL;\n\t\t\t__free_page(page);\n\t\t}\n\t\tbreak;\n\t}\n\treturn NOTIFY_OK;\n}\n#else /* !CONFIG_SMP */\n#define profile_flip_buffers()\t\tdo { } while (0)\n#define profile_discard_flip_buffers()\tdo { } while (0)\n#define profile_cpu_callback\t\tNULL\n\nvoid profile_hits(int type, void *__pc, unsigned int nr_hits)\n{\n\tunsigned long pc;\n\n\tif (prof_on != type || !prof_buffer)\n\t\treturn;\n\tpc = ((unsigned long)__pc - (unsigned long)_stext) >> prof_shift;\n\tatomic_add(nr_hits, &prof_buffer[min(pc, prof_len - 1)]);\n}\n#endif /* !CONFIG_SMP */\n\nEXPORT_SYMBOL_GPL(profile_hits);\n\nvoid profile_tick(int type)\n{\n\tstruct pt_regs *regs = get_irq_regs();\n\n\tif (type == CPU_PROFILING && timer_hook)\n\t\ttimer_hook(regs);\n\tif (!user_mode(regs) && cpu_isset(smp_processor_id(), prof_cpu_mask))\n\t\tprofile_hit(type, (void *)profile_pc(regs));\n}\n\n#ifdef CONFIG_PROC_FS\n#include <linux/proc_fs.h>\n#include <asm/uaccess.h>\n#include <asm/ptrace.h>\n\nstatic int prof_cpu_mask_read_proc (char *page, char **start, off_t off,\n\t\t\tint count, int *eof, void *data)\n{\n\tint len = cpumask_scnprintf(page, count, *(cpumask_t *)data);\n\tif (count - len < 2)\n\t\treturn -EINVAL;\n\tlen += sprintf(page + len, \"\\n\");\n\treturn len;\n}\n\nstatic int prof_cpu_mask_write_proc (struct file *file, const char __user *buffer,\n\t\t\t\t\tunsigned long count, void *data)\n{\n\tcpumask_t *mask = (cpumask_t *)data;\n\tunsigned long full_count = count, err;\n\tcpumask_t new_value;\n\n\terr = cpumask_parse_user(buffer, count, new_value);\n\tif (err)\n\t\treturn err;\n\n\t*mask = new_value;\n\treturn full_count;\n}\n\nvoid create_prof_cpu_mask(struct proc_dir_entry *root_irq_dir)\n{\n\tstruct proc_dir_entry *entry;\n\n\t/* create /proc/irq/prof_cpu_mask */\n\tif (!(entry = create_proc_entry(\"prof_cpu_mask\", 0600, root_irq_dir)))\n\t\treturn;\n\tentry->data = (void *)&prof_cpu_mask;\n\tentry->read_proc = prof_cpu_mask_read_proc;\n\tentry->write_proc = prof_cpu_mask_write_proc;\n}\n\n/*\n * This function accesses profiling information. The returned data is\n * binary: the sampling step and the actual contents of the profile\n * buffer. Use of the program readprofile is recommended in order to\n * get meaningful info out of these data.\n */\nstatic ssize_t\nread_profile(struct file *file, char __user *buf, size_t count, loff_t *ppos)\n{\n\tunsigned long p = *ppos;\n\tssize_t read;\n\tchar * pnt;\n\tunsigned int sample_step = 1 << prof_shift;\n\n\tprofile_flip_buffers();\n\tif (p >= (prof_len+1)*sizeof(unsigned int))\n\t\treturn 0;\n\tif (count > (prof_len+1)*sizeof(unsigned int) - p)\n\t\tcount = (prof_len+1)*sizeof(unsigned int) - p;\n\tread = 0;\n\n\twhile (p < sizeof(unsigned int) && count > 0) {\n\t\tif (put_user(*((char *)(&sample_step)+p),buf))\n\t\t\treturn -EFAULT;\n\t\tbuf++; p++; count--; read++;\n\t}\n\tpnt = (char *)prof_buffer + p - sizeof(atomic_t);\n\tif (copy_to_user(buf,(void *)pnt,count))\n\t\treturn -EFAULT;\n\tread += count;\n\t*ppos += read;\n\treturn read;\n}\n\n/*\n * Writing to /proc/profile resets the counters\n *\n * Writing a 'profiling multiplier' value into it also re-sets the profiling\n * interrupt frequency, on architectures that support this.\n */\nstatic ssize_t write_profile(struct file *file, const char __user *buf,\n\t\t\t size_t count, loff_t *ppos)\n{\n#ifdef CONFIG_SMP\n\textern int setup_profiling_timer (unsigned int multiplier);\n\n\tif (count == sizeof(int)) {\n\t\tunsigned int multiplier;\n\n\t\tif (copy_from_user(&multiplier, buf, sizeof(int)))\n\t\t\treturn -EFAULT;\n\n\t\tif (setup_profiling_timer(multiplier))\n\t\t\treturn -EINVAL;\n\t}\n#endif\n\tprofile_discard_flip_buffers();\n\tmemset(prof_buffer, 0, prof_len * sizeof(atomic_t));\n\treturn count;\n}\n\nstatic const struct file_operations proc_profile_operations = {\n\t.read\t\t= read_profile,\n\t.write\t\t= write_profile,\n};\n\n#ifdef CONFIG_SMP\nstatic void __init profile_nop(void *unused)\n{\n}\n\nstatic int __init create_hash_tables(void)\n{\n\tint cpu;\n\n\tfor_each_online_cpu(cpu) {\n\t\tint node = cpu_to_node(cpu);\n\t\tstruct page *page;\n\n\t\tpage = alloc_pages_node(node,\n\t\t\t\tGFP_KERNEL | __GFP_ZERO | GFP_THISNODE,\n\t\t\t\t0);\n\t\tif (!page)\n\t\t\tgoto out_cleanup;\n\t\tper_cpu(cpu_profile_hits, cpu)[1]\n\t\t\t\t= (struct profile_hit *)page_address(page);\n\t\tpage = alloc_pages_node(node,\n\t\t\t\tGFP_KERNEL | __GFP_ZERO | GFP_THISNODE,\n\t\t\t\t0);\n\t\tif (!page)\n\t\t\tgoto out_cleanup;\n\t\tper_cpu(cpu_profile_hits, cpu)[0]\n\t\t\t\t= (struct profile_hit *)page_address(page);\n\t}\n\treturn 0;\nout_cleanup:\n\tprof_on = 0;\n\tsmp_mb();\n\ton_each_cpu(profile_nop, NULL, 0, 1);\n\tfor_each_online_cpu(cpu) {\n\t\tstruct page *page;\n\n\t\tif (per_cpu(cpu_profile_hits, cpu)[0]) {\n\t\t\tpage = virt_to_page(per_cpu(cpu_profile_hits, cpu)[0]);\n\t\t\tper_cpu(cpu_profile_hits, cpu)[0] = NULL;\n\t\t\t__free_page(page);\n\t\t}\n\t\tif (per_cpu(cpu_profile_hits, cpu)[1]) {\n\t\t\tpage = virt_to_page(per_cpu(cpu_profile_hits, cpu)[1]);\n\t\t\tper_cpu(cpu_profile_hits, cpu)[1] = NULL;\n\t\t\t__free_page(page);\n\t\t}\n\t}\n\treturn -1;\n}\n#else\n#define create_hash_tables()\t\t\t({ 0; })\n#endif\n\nstatic int __init create_proc_profile(void)\n{\n\tstruct proc_dir_entry *entry;\n\n\tif (!prof_on)\n\t\treturn 0;\n\tif (create_hash_tables())\n\t\treturn -1;\n\tif (!(entry = create_proc_entry(\"profile\", S_IWUSR | S_IRUGO, NULL)))\n\t\treturn 0;\n\tentry->proc_fops = &proc_profile_operations;\n\tentry->size = (1+prof_len) * sizeof(atomic_t);\n\thotcpu_notifier(profile_cpu_callback, 0);\n\treturn 0;\n}\nmodule_init(create_proc_profile);\n#endif /* CONFIG_PROC_FS */\n/*\n * linux/kernel/ptrace.c\n *\n * (C) Copyright 1999 Linus Torvalds\n *\n * Common interfaces for \"ptrace()\" which we do not want\n * to continually duplicate across every architecture.\n */\n\n#include <linux/capability.h>\n#include <linux/module.h>\n#include <linux/sched.h>\n#include <linux/errno.h>\n#include <linux/mm.h>\n#include <linux/highmem.h>\n#include <linux/pagemap.h>\n#include <linux/smp_lock.h>\n#include <linux/ptrace.h>\n#include <linux/security.h>\n#include <linux/signal.h>\n#include <linux/audit.h>\n\n#include <asm/pgtable.h>\n#include <asm/uaccess.h>\n\n/*\n * ptrace a task: make the debugger its new parent and\n * move it to the ptrace list.\n *\n * Must be called with the tasklist lock write-held.\n */\nvoid __ptrace_link(struct task_struct *child, struct task_struct *new_parent)\n{\n\tBUG_ON(!list_empty(&child->ptrace_list));\n\tif (child->parent == new_parent)\n\t\treturn;\n\tlist_add(&child->ptrace_list, &child->parent->ptrace_children);\n\tremove_parent(child);\n\tchild->parent = new_parent;\n\tadd_parent(child);\n}\n \n/*\n * Turn a tracing stop into a normal stop now, since with no tracer there\n * would be no way to wake it up with SIGCONT or SIGKILL. If there was a\n * signal sent that would resume the child, but didn't because it was in\n * TASK_TRACED, resume it now.\n * Requires that irqs be disabled.\n */\nvoid ptrace_untrace(struct task_struct *child)\n{\n\tspin_lock(&child->sighand->siglock);\n\tif (child->state == TASK_TRACED) {\n\t\tif (child->signal->flags & SIGNAL_STOP_STOPPED) {\n\t\t\tchild->state = TASK_STOPPED;\n\t\t} else {\n\t\t\tsignal_wake_up(child, 1);\n\t\t}\n\t}\n\tspin_unlock(&child->sighand->siglock);\n}\n\n/*\n * unptrace a task: move it back to its original parent and\n * remove it from the ptrace list.\n *\n * Must be called with the tasklist lock write-held.\n */\nvoid __ptrace_unlink(struct task_struct *child)\n{\n\tBUG_ON(!child->ptrace);\n\n\tchild->ptrace = 0;\n\tif (!list_empty(&child->ptrace_list)) {\n\t\tlist_del_init(&child->ptrace_list);\n\t\tremove_parent(child);\n\t\tchild->parent = child->real_parent;\n\t\tadd_parent(child);\n\t}\n\n\tif (child->state == TASK_TRACED)\n\t\tptrace_untrace(child);\n}\n\n/*\n * Check that we have indeed attached to the thing..\n */\nint ptrace_check_attach(struct task_struct *child, int kill)\n{\n\tint ret = -ESRCH;\n\n\t/*\n\t * We take the read lock around doing both checks to close a\n\t * possible race where someone else was tracing our child and\n\t * detached between these two checks. After this locked check,\n\t * we are sure that this is our traced child and that can only\n\t * be changed by us so it's not changing right after this.\n\t */\n\tread_lock(&tasklist_lock);\n\tif ((child->ptrace & PT_PTRACED) && child->parent == current &&\n\t (!(child->ptrace & PT_ATTACHED) || child->real_parent != current)\n\t && child->signal != NULL) {\n\t\tret = 0;\n\t\tspin_lock_irq(&child->sighand->siglock);\n\t\tif (child->state == TASK_STOPPED) {\n\t\t\tchild->state = TASK_TRACED;\n\t\t} else if (child->state != TASK_TRACED && !kill) {\n\t\t\tret = -ESRCH;\n\t\t}\n\t\tspin_unlock_irq(&child->sighand->siglock);\n\t}\n\tread_unlock(&tasklist_lock);\n\n\tif (!ret && !kill) {\n\t\twait_task_inactive(child);\n\t}\n\n\t/* All systems go.. */\n\treturn ret;\n}\n\nstatic int may_attach(struct task_struct *task)\n{\n\t/* May we inspect the given task?\n\t * This check is used both for attaching with ptrace\n\t * and for allowing access to sensitive information in /proc.\n\t *\n\t * ptrace_attach denies several cases that /proc allows\n\t * because setting up the necessary parent/child relationship\n\t * or halting the specified task is impossible.\n\t */\n\tint dumpable = 0;\n\t/* Don't let security modules deny introspection */\n\tif (task == current)\n\t\treturn 0;\n\tif (((current->uid != task->euid) ||\n\t (current->uid != task->suid) ||\n\t (current->uid != task->uid) ||\n\t (current->gid != task->egid) ||\n\t (current->gid != task->sgid) ||\n\t (current->gid != task->gid)) && !capable(CAP_SYS_PTRACE))\n\t\treturn -EPERM;\n\tsmp_rmb();\n\tif (task->mm)\n\t\tdumpable = task->mm->dumpable;\n\tif (!dumpable && !capable(CAP_SYS_PTRACE))\n\t\treturn -EPERM;\n\n\treturn security_ptrace(current, task);\n}\n\nint ptrace_may_attach(struct task_struct *task)\n{\n\tint err;\n\ttask_lock(task);\n\terr = may_attach(task);\n\ttask_unlock(task);\n\treturn !err;\n}\n\nint ptrace_attach(struct task_struct *task)\n{\n\tint retval;\n\n\taudit_ptrace(task);\n\n\tretval = -EPERM;\n\tif (task->pid <= 1)\n\t\tgoto out;\n\tif (task->tgid == current->tgid)\n\t\tgoto out;\n\nrepeat:\n\t/*\n\t * Nasty, nasty.\n\t *\n\t * We want to hold both the task-lock and the\n\t * tasklist_lock for writing at the same time.\n\t * But that's against the rules (tasklist_lock\n\t * is taken for reading by interrupts on other\n\t * cpu's that may have task_lock).\n\t */\n\ttask_lock(task);\n\tlocal_irq_disable();\n\tif (!write_trylock(&tasklist_lock)) {\n\t\tlocal_irq_enable();\n\t\ttask_unlock(task);\n\t\tdo {\n\t\t\tcpu_relax();\n\t\t} while (!write_can_lock(&tasklist_lock));\n\t\tgoto repeat;\n\t}\n\n\tif (!task->mm)\n\t\tgoto bad;\n\t/* the same process cannot be attached many times */\n\tif (task->ptrace & PT_PTRACED)\n\t\tgoto bad;\n\tretval = may_attach(task);\n\tif (retval)\n\t\tgoto bad;\n\n\t/* Go */\n\ttask->ptrace |= PT_PTRACED | ((task->real_parent != current)\n\t\t\t\t ? PT_ATTACHED : 0);\n\tif (capable(CAP_SYS_PTRACE))\n\t\ttask->ptrace |= PT_PTRACE_CAP;\n\n\t__ptrace_link(task, current);\n\n\tforce_sig_specific(SIGSTOP, task);\n\nbad:\n\twrite_unlock_irq(&tasklist_lock);\n\ttask_unlock(task);\nout:\n\treturn retval;\n}\n\nstatic inline void __ptrace_detach(struct task_struct *child, unsigned int data)\n{\n\tchild->exit_code = data;\n\t/* .. re-parent .. */\n\t__ptrace_unlink(child);\n\t/* .. and wake it up. */\n\tif (child->exit_state != EXIT_ZOMBIE)\n\t\twake_up_process(child);\n}\n\nint ptrace_detach(struct task_struct *child, unsigned int data)\n{\n\tif (!valid_signal(data))\n\t\treturn -EIO;\n\n\t/* Architecture-specific hardware disable .. */\n\tptrace_disable(child);\n\n\twrite_lock_irq(&tasklist_lock);\n\t/* protect against de_thread()->release_task() */\n\tif (child->ptrace)\n\t\t__ptrace_detach(child, data);\n\twrite_unlock_irq(&tasklist_lock);\n\n\treturn 0;\n}\n\nint ptrace_readdata(struct task_struct *tsk, unsigned long src, char __user *dst, int len)\n{\n\tint copied = 0;\n\n\twhile (len > 0) {\n\t\tchar buf[128];\n\t\tint this_len, retval;\n\n\t\tthis_len = (len > sizeof(buf)) ? sizeof(buf) : len;\n\t\tretval = access_process_vm(tsk, src, buf, this_len, 0);\n\t\tif (!retval) {\n\t\t\tif (copied)\n\t\t\t\tbreak;\n\t\t\treturn -EIO;\n\t\t}\n\t\tif (copy_to_user(dst, buf, retval))\n\t\t\treturn -EFAULT;\n\t\tcopied += retval;\n\t\tsrc += retval;\n\t\tdst += retval;\n\t\tlen -= retval;\t\t\t\n\t}\n\treturn copied;\n}\n\nint ptrace_writedata(struct task_struct *tsk, char __user *src, unsigned long dst, int len)\n{\n\tint copied = 0;\n\n\twhile (len > 0) {\n\t\tchar buf[128];\n\t\tint this_len, retval;\n\n\t\tthis_len = (len > sizeof(buf)) ? sizeof(buf) : len;\n\t\tif (copy_from_user(buf, src, this_len))\n\t\t\treturn -EFAULT;\n\t\tretval = access_process_vm(tsk, dst, buf, this_len, 1);\n\t\tif (!retval) {\n\t\t\tif (copied)\n\t\t\t\tbreak;\n\t\t\treturn -EIO;\n\t\t}\n\t\tcopied += retval;\n\t\tsrc += retval;\n\t\tdst += retval;\n\t\tlen -= retval;\t\t\t\n\t}\n\treturn copied;\n}\n\nstatic int ptrace_setoptions(struct task_struct *child, long data)\n{\n\tchild->ptrace &= ~PT_TRACE_MASK;\n\n\tif (data & PTRACE_O_TRACESYSGOOD)\n\t\tchild->ptrace |= PT_TRACESYSGOOD;\n\n\tif (data & PTRACE_O_TRACEFORK)\n\t\tchild->ptrace |= PT_TRACE_FORK;\n\n\tif (data & PTRACE_O_TRACEVFORK)\n\t\tchild->ptrace |= PT_TRACE_VFORK;\n\n\tif (data & PTRACE_O_TRACECLONE)\n\t\tchild->ptrace |= PT_TRACE_CLONE;\n\n\tif (data & PTRACE_O_TRACEEXEC)\n\t\tchild->ptrace |= PT_TRACE_EXEC;\n\n\tif (data & PTRACE_O_TRACEVFORKDONE)\n\t\tchild->ptrace |= PT_TRACE_VFORK_DONE;\n\n\tif (data & PTRACE_O_TRACEEXIT)\n\t\tchild->ptrace |= PT_TRACE_EXIT;\n\n\treturn (data & ~PTRACE_O_MASK) ? -EINVAL : 0;\n}\n\nstatic int ptrace_getsiginfo(struct task_struct *child, siginfo_t __user * data)\n{\n\tsiginfo_t lastinfo;\n\tint error = -ESRCH;\n\n\tread_lock(&tasklist_lock);\n\tif (likely(child->sighand != NULL)) {\n\t\terror = -EINVAL;\n\t\tspin_lock_irq(&child->sighand->siglock);\n\t\tif (likely(child->last_siginfo != NULL)) {\n\t\t\tlastinfo = *child->last_siginfo;\n\t\t\terror = 0;\n\t\t}\n\t\tspin_unlock_irq(&child->sighand->siglock);\n\t}\n\tread_unlock(&tasklist_lock);\n\tif (!error)\n\t\treturn copy_siginfo_to_user(data, &lastinfo);\n\treturn error;\n}\n\nstatic int ptrace_setsiginfo(struct task_struct *child, siginfo_t __user * data)\n{\n\tsiginfo_t newinfo;\n\tint error = -ESRCH;\n\n\tif (copy_from_user(&newinfo, data, sizeof (siginfo_t)))\n\t\treturn -EFAULT;\n\n\tread_lock(&tasklist_lock);\n\tif (likely(child->sighand != NULL)) {\n\t\terror = -EINVAL;\n\t\tspin_lock_irq(&child->sighand->siglock);\n\t\tif (likely(child->last_siginfo != NULL)) {\n\t\t\t*child->last_siginfo = newinfo;\n\t\t\terror = 0;\n\t\t}\n\t\tspin_unlock_irq(&child->sighand->siglock);\n\t}\n\tread_unlock(&tasklist_lock);\n\treturn error;\n}\n\nint ptrace_request(struct task_struct *child, long request,\n\t\t long addr, long data)\n{\n\tint ret = -EIO;\n\n\tswitch (request) {\n#ifdef PTRACE_OLDSETOPTIONS\n\tcase PTRACE_OLDSETOPTIONS:\n#endif\n\tcase PTRACE_SETOPTIONS:\n\t\tret = ptrace_setoptions(child, data);\n\t\tbreak;\n\tcase PTRACE_GETEVENTMSG:\n\t\tret = put_user(child->ptrace_message, (unsigned long __user *) data);\n\t\tbreak;\n\tcase PTRACE_GETSIGINFO:\n\t\tret = ptrace_getsiginfo(child, (siginfo_t __user *) data);\n\t\tbreak;\n\tcase PTRACE_SETSIGINFO:\n\t\tret = ptrace_setsiginfo(child, (siginfo_t __user *) data);\n\t\tbreak;\n\tdefault:\n\t\tbreak;\n\t}\n\n\treturn ret;\n}\n\n/**\n * ptrace_traceme -- helper for PTRACE_TRACEME\n *\n * Performs checks and sets PT_PTRACED.\n * Should be used by all ptrace implementations for PTRACE_TRACEME.\n */\nint ptrace_traceme(void)\n{\n\tint ret = -EPERM;\n\n\t/*\n\t * Are we already being traced?\n\t */\n\ttask_lock(current);\n\tif (!(current->ptrace & PT_PTRACED)) {\n\t\tret = security_ptrace(current->parent, current);\n\t\t/*\n\t\t * Set the ptrace bit in the process ptrace flags.\n\t\t */\n\t\tif (!ret)\n\t\t\tcurrent->ptrace |= PT_PTRACED;\n\t}\n\ttask_unlock(current);\n\treturn ret;\n}\n\n/**\n * ptrace_get_task_struct -- grab a task struct reference for ptrace\n * @pid: process id to grab a task_struct reference of\n *\n * This function is a helper for ptrace implementations. It checks\n * permissions and then grabs a task struct for use of the actual\n * ptrace implementation.\n *\n * Returns the task_struct for @pid or an ERR_PTR() on failure.\n */\nstruct task_struct *ptrace_get_task_struct(pid_t pid)\n{\n\tstruct task_struct *child;\n\n\t/*\n\t * Tracing init is not allowed.\n\t */\n\tif (pid == 1)\n\t\treturn ERR_PTR(-EPERM);\n\n\tread_lock(&tasklist_lock);\n\tchild = find_task_by_pid(pid);\n\tif (child)\n\t\tget_task_struct(child);\n\n\tread_unlock(&tasklist_lock);\n\tif (!child)\n\t\treturn ERR_PTR(-ESRCH);\n\treturn child;\n}\n\n#ifndef __ARCH_SYS_PTRACE\nasmlinkage long sys_ptrace(long request, long pid, long addr, long data)\n{\n\tstruct task_struct *child;\n\tlong ret;\n\n\t/*\n\t * This lock_kernel fixes a subtle race with suid exec\n\t */\n\tlock_kernel();\n\tif (request == PTRACE_TRACEME) {\n\t\tret = ptrace_traceme();\n\t\tgoto out;\n\t}\n\n\tchild = ptrace_get_task_struct(pid);\n\tif (IS_ERR(child)) {\n\t\tret = PTR_ERR(child);\n\t\tgoto out;\n\t}\n\n\tif (request == PTRACE_ATTACH) {\n\t\tret = ptrace_attach(child);\n\t\tgoto out_put_task_struct;\n\t}\n\n\tret = ptrace_check_attach(child, request == PTRACE_KILL);\n\tif (ret < 0)\n\t\tgoto out_put_task_struct;\n\n\tret = arch_ptrace(child, request, addr, data);\n\tif (ret < 0)\n\t\tgoto out_put_task_struct;\n\n out_put_task_struct:\n\tput_task_struct(child);\n out:\n\tunlock_kernel();\n\treturn ret;\n}\n#endif /* __ARCH_SYS_PTRACE */\n/*\n * Read-Copy Update mechanism for mutual exclusion\n *\n * This program is free software; you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation; either version 2 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program; if not, write to the Free Software\n * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n *\n * Copyright (C) IBM Corporation, 2001\n *\n * Authors: Dipankar Sarma <dipankar@in.ibm.com>\n *\t Manfred Spraul <manfred@colorfullife.com>\n * \n * Based on the original work by Paul McKenney <paulmck@us.ibm.com>\n * and inputs from Rusty Russell, Andrea Arcangeli and Andi Kleen.\n * Papers:\n * http://www.rdrop.com/users/paulmck/paper/rclockpdcsproof.pdf\n * http://lse.sourceforge.net/locking/rclock_OLS.2001.05.01c.sc.pdf (OLS2001)\n *\n * For detailed explanation of Read-Copy Update mechanism see -\n * \t\thttp://lse.sourceforge.net/locking/rcupdate.html\n *\n */\n#include <linux/types.h>\n#include <linux/kernel.h>\n#include <linux/init.h>\n#include <linux/spinlock.h>\n#include <linux/smp.h>\n#include <linux/rcupdate.h>\n#include <linux/interrupt.h>\n#include <linux/sched.h>\n#include <asm/atomic.h>\n#include <linux/bitops.h>\n#include <linux/module.h>\n#include <linux/completion.h>\n#include <linux/moduleparam.h>\n#include <linux/percpu.h>\n#include <linux/notifier.h>\n#include <linux/rcupdate.h>\n#include <linux/cpu.h>\n#include <linux/mutex.h>\n\n/* Definition for rcupdate control block. */\nstatic struct rcu_ctrlblk rcu_ctrlblk = {\n\t.cur = -300,\n\t.completed = -300,\n\t.lock = __SPIN_LOCK_UNLOCKED(&rcu_ctrlblk.lock),\n\t.cpumask = CPU_MASK_NONE,\n};\nstatic struct rcu_ctrlblk rcu_bh_ctrlblk = {\n\t.cur = -300,\n\t.completed = -300,\n\t.lock = __SPIN_LOCK_UNLOCKED(&rcu_bh_ctrlblk.lock),\n\t.cpumask = CPU_MASK_NONE,\n};\n\nDEFINE_PER_CPU(struct rcu_data, rcu_data) = { 0L };\nDEFINE_PER_CPU(struct rcu_data, rcu_bh_data) = { 0L };\n\n/* Fake initialization required by compiler */\nstatic DEFINE_PER_CPU(struct tasklet_struct, rcu_tasklet) = {NULL};\nstatic int blimit = 10;\nstatic int qhimark = 10000;\nstatic int qlowmark = 100;\n\nstatic atomic_t rcu_barrier_cpu_count;\nstatic DEFINE_MUTEX(rcu_barrier_mutex);\nstatic struct completion rcu_barrier_completion;\n\n#ifdef CONFIG_SMP\nstatic void force_quiescent_state(struct rcu_data *rdp,\n\t\t\tstruct rcu_ctrlblk *rcp)\n{\n\tint cpu;\n\tcpumask_t cpumask;\n\tset_need_resched();\n\tif (unlikely(!rcp->signaled)) {\n\t\trcp->signaled = 1;\n\t\t/*\n\t\t * Don't send IPI to itself. With irqs disabled,\n\t\t * rdp->cpu is the current cpu.\n\t\t */\n\t\tcpumask = rcp->cpumask;\n\t\tcpu_clear(rdp->cpu, cpumask);\n\t\tfor_each_cpu_mask(cpu, cpumask)\n\t\t\tsmp_send_reschedule(cpu);\n\t}\n}\n#else\nstatic inline void force_quiescent_state(struct rcu_data *rdp,\n\t\t\tstruct rcu_ctrlblk *rcp)\n{\n\tset_need_resched();\n}\n#endif\n\n/**\n * call_rcu - Queue an RCU callback for invocation after a grace period.\n * @head: structure to be used for queueing the RCU updates.\n * @func: actual update function to be invoked after the grace period\n *\n * The update function will be invoked some time after a full grace\n * period elapses, in other words after all currently executing RCU\n * read-side critical sections have completed. RCU read-side critical\n * sections are delimited by rcu_read_lock() and rcu_read_unlock(),\n * and may be nested.\n */\nvoid fastcall call_rcu(struct rcu_head *head,\n\t\t\t\tvoid (*func)(struct rcu_head *rcu))\n{\n\tunsigned long flags;\n\tstruct rcu_data *rdp;\n\n\thead->func = func;\n\thead->next = NULL;\n\tlocal_irq_save(flags);\n\trdp = &__get_cpu_var(rcu_data);\n\t*rdp->nxttail = head;\n\trdp->nxttail = &head->next;\n\tif (unlikely(++rdp->qlen > qhimark)) {\n\t\trdp->blimit = INT_MAX;\n\t\tforce_quiescent_state(rdp, &rcu_ctrlblk);\n\t}\n\tlocal_irq_restore(flags);\n}\n\n/**\n * call_rcu_bh - Queue an RCU for invocation after a quicker grace period.\n * @head: structure to be used for queueing the RCU updates.\n * @func: actual update function to be invoked after the grace period\n *\n * The update function will be invoked some time after a full grace\n * period elapses, in other words after all currently executing RCU\n * read-side critical sections have completed. call_rcu_bh() assumes\n * that the read-side critical sections end on completion of a softirq\n * handler. This means that read-side critical sections in process\n * context must not be interrupted by softirqs. This interface is to be\n * used when most of the read-side critical sections are in softirq context.\n * RCU read-side critical sections are delimited by rcu_read_lock() and\n * rcu_read_unlock(), * if in interrupt context or rcu_read_lock_bh()\n * and rcu_read_unlock_bh(), if in process context. These may be nested.\n */\nvoid fastcall call_rcu_bh(struct rcu_head *head,\n\t\t\t\tvoid (*func)(struct rcu_head *rcu))\n{\n\tunsigned long flags;\n\tstruct rcu_data *rdp;\n\n\thead->func = func;\n\thead->next = NULL;\n\tlocal_irq_save(flags);\n\trdp = &__get_cpu_var(rcu_bh_data);\n\t*rdp->nxttail = head;\n\trdp->nxttail = &head->next;\n\n\tif (unlikely(++rdp->qlen > qhimark)) {\n\t\trdp->blimit = INT_MAX;\n\t\tforce_quiescent_state(rdp, &rcu_bh_ctrlblk);\n\t}\n\n\tlocal_irq_restore(flags);\n}\n\n/*\n * Return the number of RCU batches processed thus far. Useful\n * for debug and statistics.\n */\nlong rcu_batches_completed(void)\n{\n\treturn rcu_ctrlblk.completed;\n}\n\n/*\n * Return the number of RCU batches processed thus far. Useful\n * for debug and statistics.\n */\nlong rcu_batches_completed_bh(void)\n{\n\treturn rcu_bh_ctrlblk.completed;\n}\n\nstatic void rcu_barrier_callback(struct rcu_head *notused)\n{\n\tif (atomic_dec_and_test(&rcu_barrier_cpu_count))\n\t\tcomplete(&rcu_barrier_completion);\n}\n\n/*\n * Called with preemption disabled, and from cross-cpu IRQ context.\n */\nstatic void rcu_barrier_func(void *notused)\n{\n\tint cpu = smp_processor_id();\n\tstruct rcu_data *rdp = &per_cpu(rcu_data, cpu);\n\tstruct rcu_head *head;\n\n\thead = &rdp->barrier;\n\tatomic_inc(&rcu_barrier_cpu_count);\n\tcall_rcu(head, rcu_barrier_callback);\n}\n\n/**\n * rcu_barrier - Wait until all the in-flight RCUs are complete.\n */\nvoid rcu_barrier(void)\n{\n\tBUG_ON(in_interrupt());\n\t/* Take cpucontrol mutex to protect against CPU hotplug */\n\tmutex_lock(&rcu_barrier_mutex);\n\tinit_completion(&rcu_barrier_completion);\n\tatomic_set(&rcu_barrier_cpu_count, 0);\n\ton_each_cpu(rcu_barrier_func, NULL, 0, 1);\n\twait_for_completion(&rcu_barrier_completion);\n\tmutex_unlock(&rcu_barrier_mutex);\n}\nEXPORT_SYMBOL_GPL(rcu_barrier);\n\n/*\n * Invoke the completed RCU callbacks. They are expected to be in\n * a per-cpu list.\n */\nstatic void rcu_do_batch(struct rcu_data *rdp)\n{\n\tstruct rcu_head *next, *list;\n\tint count = 0;\n\n\tlist = rdp->donelist;\n\twhile (list) {\n\t\tnext = list->next;\n\t\tprefetch(next);\n\t\tlist->func(list);\n\t\tlist = next;\n\t\tif (++count >= rdp->blimit)\n\t\t\tbreak;\n\t}\n\trdp->donelist = list;\n\n\tlocal_irq_disable();\n\trdp->qlen -= count;\n\tlocal_irq_enable();\n\tif (rdp->blimit == INT_MAX && rdp->qlen <= qlowmark)\n\t\trdp->blimit = blimit;\n\n\tif (!rdp->donelist)\n\t\trdp->donetail = &rdp->donelist;\n\telse\n\t\ttasklet_schedule(&per_cpu(rcu_tasklet, rdp->cpu));\n}\n\n/*\n * Grace period handling:\n * The grace period handling consists out of two steps:\n * - A new grace period is started.\n * This is done by rcu_start_batch. The start is not broadcasted to\n * all cpus, they must pick this up by comparing rcp->cur with\n * rdp->quiescbatch. All cpus are recorded in the\n * rcu_ctrlblk.cpumask bitmap.\n * - All cpus must go through a quiescent state.\n * Since the start of the grace period is not broadcasted, at least two\n * calls to rcu_check_quiescent_state are required:\n * The first call just notices that a new grace period is running. The\n * following calls check if there was a quiescent state since the beginning\n * of the grace period. If so, it updates rcu_ctrlblk.cpumask. If\n * the bitmap is empty, then the grace period is completed.\n * rcu_check_quiescent_state calls rcu_start_batch(0) to start the next grace\n * period (if necessary).\n */\n/*\n * Register a new batch of callbacks, and start it up if there is currently no\n * active batch and the batch to be registered has not already occurred.\n * Caller must hold rcu_ctrlblk.lock.\n */\nstatic void rcu_start_batch(struct rcu_ctrlblk *rcp)\n{\n\tif (rcp->next_pending &&\n\t\t\trcp->completed == rcp->cur) {\n\t\trcp->next_pending = 0;\n\t\t/*\n\t\t * next_pending == 0 must be visible in\n\t\t * __rcu_process_callbacks() before it can see new value of cur.\n\t\t */\n\t\tsmp_wmb();\n\t\trcp->cur++;\n\n\t\t/*\n\t\t * Accessing nohz_cpu_mask before incrementing rcp->cur needs a\n\t\t * Barrier Otherwise it can cause tickless idle CPUs to be\n\t\t * included in rcp->cpumask, which will extend graceperiods\n\t\t * unnecessarily.\n\t\t */\n\t\tsmp_mb();\n\t\tcpus_andnot(rcp->cpumask, cpu_online_map, nohz_cpu_mask);\n\n\t\trcp->signaled = 0;\n\t}\n}\n\n/*\n * cpu went through a quiescent state since the beginning of the grace period.\n * Clear it from the cpu mask and complete the grace period if it was the last\n * cpu. Start another grace period if someone has further entries pending\n */\nstatic void cpu_quiet(int cpu, struct rcu_ctrlblk *rcp)\n{\n\tcpu_clear(cpu, rcp->cpumask);\n\tif (cpus_empty(rcp->cpumask)) {\n\t\t/* batch completed ! */\n\t\trcp->completed = rcp->cur;\n\t\trcu_start_batch(rcp);\n\t}\n}\n\n/*\n * Check if the cpu has gone through a quiescent state (say context\n * switch). If so and if it already hasn't done so in this RCU\n * quiescent cycle, then indicate that it has done so.\n */\nstatic void rcu_check_quiescent_state(struct rcu_ctrlblk *rcp,\n\t\t\t\t\tstruct rcu_data *rdp)\n{\n\tif (rdp->quiescbatch != rcp->cur) {\n\t\t/* start new grace period: */\n\t\trdp->qs_pending = 1;\n\t\trdp->passed_quiesc = 0;\n\t\trdp->quiescbatch = rcp->cur;\n\t\treturn;\n\t}\n\n\t/* Grace period already completed for this cpu?\n\t * qs_pending is checked instead of the actual bitmap to avoid\n\t * cacheline trashing.\n\t */\n\tif (!rdp->qs_pending)\n\t\treturn;\n\n\t/* \n\t * Was there a quiescent state since the beginning of the grace\n\t * period? If no, then exit and wait for the next call.\n\t */\n\tif (!rdp->passed_quiesc)\n\t\treturn;\n\trdp->qs_pending = 0;\n\n\tspin_lock(&rcp->lock);\n\t/*\n\t * rdp->quiescbatch/rcp->cur and the cpu bitmap can come out of sync\n\t * during cpu startup. Ignore the quiescent state.\n\t */\n\tif (likely(rdp->quiescbatch == rcp->cur))\n\t\tcpu_quiet(rdp->cpu, rcp);\n\n\tspin_unlock(&rcp->lock);\n}\n\n\n#ifdef CONFIG_HOTPLUG_CPU\n\n/* warning! helper for rcu_offline_cpu. do not use elsewhere without reviewing\n * locking requirements, the list it's pulling from has to belong to a cpu\n * which is dead and hence not processing interrupts.\n */\nstatic void rcu_move_batch(struct rcu_data *this_rdp, struct rcu_head *list,\n\t\t\t\tstruct rcu_head **tail)\n{\n\tlocal_irq_disable();\n\t*this_rdp->nxttail = list;\n\tif (list)\n\t\tthis_rdp->nxttail = tail;\n\tlocal_irq_enable();\n}\n\nstatic void __rcu_offline_cpu(struct rcu_data *this_rdp,\n\t\t\t\tstruct rcu_ctrlblk *rcp, struct rcu_data *rdp)\n{\n\t/* if the cpu going offline owns the grace period\n\t * we can block indefinitely waiting for it, so flush\n\t * it here\n\t */\n\tspin_lock_bh(&rcp->lock);\n\tif (rcp->cur != rcp->completed)\n\t\tcpu_quiet(rdp->cpu, rcp);\n\tspin_unlock_bh(&rcp->lock);\n\trcu_move_batch(this_rdp, rdp->curlist, rdp->curtail);\n\trcu_move_batch(this_rdp, rdp->nxtlist, rdp->nxttail);\n\trcu_move_batch(this_rdp, rdp->donelist, rdp->donetail);\n}\n\nstatic void rcu_offline_cpu(int cpu)\n{\n\tstruct rcu_data *this_rdp = &get_cpu_var(rcu_data);\n\tstruct rcu_data *this_bh_rdp = &get_cpu_var(rcu_bh_data);\n\n\t__rcu_offline_cpu(this_rdp, &rcu_ctrlblk,\n\t\t\t\t\t&per_cpu(rcu_data, cpu));\n\t__rcu_offline_cpu(this_bh_rdp, &rcu_bh_ctrlblk,\n\t\t\t\t\t&per_cpu(rcu_bh_data, cpu));\n\tput_cpu_var(rcu_data);\n\tput_cpu_var(rcu_bh_data);\n\ttasklet_kill_immediate(&per_cpu(rcu_tasklet, cpu), cpu);\n}\n\n#else\n\nstatic void rcu_offline_cpu(int cpu)\n{\n}\n\n#endif\n\n/*\n * This does the RCU processing work from tasklet context. \n */\nstatic void __rcu_process_callbacks(struct rcu_ctrlblk *rcp,\n\t\t\t\t\tstruct rcu_data *rdp)\n{\n\tif (rdp->curlist && !rcu_batch_before(rcp->completed, rdp->batch)) {\n\t\t*rdp->donetail = rdp->curlist;\n\t\trdp->donetail = rdp->curtail;\n\t\trdp->curlist = NULL;\n\t\trdp->curtail = &rdp->curlist;\n\t}\n\n\tif (rdp->nxtlist && !rdp->curlist) {\n\t\tlocal_irq_disable();\n\t\trdp->curlist = rdp->nxtlist;\n\t\trdp->curtail = rdp->nxttail;\n\t\trdp->nxtlist = NULL;\n\t\trdp->nxttail = &rdp->nxtlist;\n\t\tlocal_irq_enable();\n\n\t\t/*\n\t\t * start the next batch of callbacks\n\t\t */\n\n\t\t/* determine batch number */\n\t\trdp->batch = rcp->cur + 1;\n\t\t/* see the comment and corresponding wmb() in\n\t\t * the rcu_start_batch()\n\t\t */\n\t\tsmp_rmb();\n\n\t\tif (!rcp->next_pending) {\n\t\t\t/* and start it/schedule start if it's a new batch */\n\t\t\tspin_lock(&rcp->lock);\n\t\t\trcp->next_pending = 1;\n\t\t\trcu_start_batch(rcp);\n\t\t\tspin_unlock(&rcp->lock);\n\t\t}\n\t}\n\n\trcu_check_quiescent_state(rcp, rdp);\n\tif (rdp->donelist)\n\t\trcu_do_batch(rdp);\n}\n\nstatic void rcu_process_callbacks(unsigned long unused)\n{\n\t__rcu_process_callbacks(&rcu_ctrlblk, &__get_cpu_var(rcu_data));\n\t__rcu_process_callbacks(&rcu_bh_ctrlblk, &__get_cpu_var(rcu_bh_data));\n}\n\nstatic int __rcu_pending(struct rcu_ctrlblk *rcp, struct rcu_data *rdp)\n{\n\t/* This cpu has pending rcu entries and the grace period\n\t * for them has completed.\n\t */\n\tif (rdp->curlist && !rcu_batch_before(rcp->completed, rdp->batch))\n\t\treturn 1;\n\n\t/* This cpu has no pending entries, but there are new entries */\n\tif (!rdp->curlist && rdp->nxtlist)\n\t\treturn 1;\n\n\t/* This cpu has finished callbacks to invoke */\n\tif (rdp->donelist)\n\t\treturn 1;\n\n\t/* The rcu core waits for a quiescent state from the cpu */\n\tif (rdp->quiescbatch != rcp->cur || rdp->qs_pending)\n\t\treturn 1;\n\n\t/* nothing to do */\n\treturn 0;\n}\n\n/*\n * Check to see if there is any immediate RCU-related work to be done\n * by the current CPU, returning 1 if so. This function is part of the\n * RCU implementation; it is -not- an exported member of the RCU API.\n */\nint rcu_pending(int cpu)\n{\n\treturn __rcu_pending(&rcu_ctrlblk, &per_cpu(rcu_data, cpu)) ||\n\t\t__rcu_pending(&rcu_bh_ctrlblk, &per_cpu(rcu_bh_data, cpu));\n}\n\n/*\n * Check to see if any future RCU-related work will need to be done\n * by the current CPU, even if none need be done immediately, returning\n * 1 if so. This function is part of the RCU implementation; it is -not-\n * an exported member of the RCU API.\n */\nint rcu_needs_cpu(int cpu)\n{\n\tstruct rcu_data *rdp = &per_cpu(rcu_data, cpu);\n\tstruct rcu_data *rdp_bh = &per_cpu(rcu_bh_data, cpu);\n\n\treturn (!!rdp->curlist || !!rdp_bh->curlist || rcu_pending(cpu));\n}\n\nvoid rcu_check_callbacks(int cpu, int user)\n{\n\tif (user || \n\t (idle_cpu(cpu) && !in_softirq() && \n\t\t\t\thardirq_count() <= (1 << HARDIRQ_SHIFT))) {\n\t\trcu_qsctr_inc(cpu);\n\t\trcu_bh_qsctr_inc(cpu);\n\t} else if (!in_softirq())\n\t\trcu_bh_qsctr_inc(cpu);\n\ttasklet_schedule(&per_cpu(rcu_tasklet, cpu));\n}\n\nstatic void rcu_init_percpu_data(int cpu, struct rcu_ctrlblk *rcp,\n\t\t\t\t\t\tstruct rcu_data *rdp)\n{\n\tmemset(rdp, 0, sizeof(*rdp));\n\trdp->curtail = &rdp->curlist;\n\trdp->nxttail = &rdp->nxtlist;\n\trdp->donetail = &rdp->donelist;\n\trdp->quiescbatch = rcp->completed;\n\trdp->qs_pending = 0;\n\trdp->cpu = cpu;\n\trdp->blimit = blimit;\n}\n\nstatic void __devinit rcu_online_cpu(int cpu)\n{\n\tstruct rcu_data *rdp = &per_cpu(rcu_data, cpu);\n\tstruct rcu_data *bh_rdp = &per_cpu(rcu_bh_data, cpu);\n\n\trcu_init_percpu_data(cpu, &rcu_ctrlblk, rdp);\n\trcu_init_percpu_data(cpu, &rcu_bh_ctrlblk, bh_rdp);\n\ttasklet_init(&per_cpu(rcu_tasklet, cpu), rcu_process_callbacks, 0UL);\n}\n\nstatic int __cpuinit rcu_cpu_notify(struct notifier_block *self,\n\t\t\t\tunsigned long action, void *hcpu)\n{\n\tlong cpu = (long)hcpu;\n\tswitch (action) {\n\tcase CPU_UP_PREPARE:\n\tcase CPU_UP_PREPARE_FROZEN:\n\t\trcu_online_cpu(cpu);\n\t\tbreak;\n\tcase CPU_DEAD:\n\tcase CPU_DEAD_FROZEN:\n\t\trcu_offline_cpu(cpu);\n\t\tbreak;\n\tdefault:\n\t\tbreak;\n\t}\n\treturn NOTIFY_OK;\n}\n\nstatic struct notifier_block __cpuinitdata rcu_nb = {\n\t.notifier_call\t= rcu_cpu_notify,\n};\n\n/*\n * Initializes rcu mechanism. Assumed to be called early.\n * That is before local timer(SMP) or jiffie timer (uniproc) is setup.\n * Note that rcu_qsctr and friends are implicitly\n * initialized due to the choice of ``0'' for RCU_CTR_INVALID.\n */\nvoid __init rcu_init(void)\n{\n\trcu_cpu_notify(&rcu_nb, CPU_UP_PREPARE,\n\t\t\t(void *)(long)smp_processor_id());\n\t/* Register notifier for non-boot CPUs */\n\tregister_cpu_notifier(&rcu_nb);\n}\n\nstruct rcu_synchronize {\n\tstruct rcu_head head;\n\tstruct completion completion;\n};\n\n/* Because of FASTCALL declaration of complete, we use this wrapper */\nstatic void wakeme_after_rcu(struct rcu_head *head)\n{\n\tstruct rcu_synchronize *rcu;\n\n\trcu = container_of(head, struct rcu_synchronize, head);\n\tcomplete(&rcu->completion);\n}\n\n/**\n * synchronize_rcu - wait until a grace period has elapsed.\n *\n * Control will return to the caller some time after a full grace\n * period has elapsed, in other words after all currently executing RCU\n * read-side critical sections have completed. RCU read-side critical\n * sections are delimited by rcu_read_lock() and rcu_read_unlock(),\n * and may be nested.\n *\n * If your read-side code is not protected by rcu_read_lock(), do -not-\n * use synchronize_rcu().\n */\nvoid synchronize_rcu(void)\n{\n\tstruct rcu_synchronize rcu;\n\n\tinit_completion(&rcu.completion);\n\t/* Will wake me after RCU finished */\n\tcall_rcu(&rcu.head, wakeme_after_rcu);\n\n\t/* Wait for it */\n\twait_for_completion(&rcu.completion);\n}\n\nmodule_param(blimit, int, 0);\nmodule_param(qhimark, int, 0);\nmodule_param(qlowmark, int, 0);\nEXPORT_SYMBOL_GPL(rcu_batches_completed);\nEXPORT_SYMBOL_GPL(rcu_batches_completed_bh);\nEXPORT_SYMBOL_GPL(call_rcu);\nEXPORT_SYMBOL_GPL(call_rcu_bh);\nEXPORT_SYMBOL_GPL(synchronize_rcu);\n/*\n * Read-Copy Update module-based torture test facility\n *\n * This program is free software; you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation; either version 2 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program; if not, write to the Free Software\n * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n *\n * Copyright (C) IBM Corporation, 2005, 2006\n *\n * Authors: Paul E. McKenney <paulmck@us.ibm.com>\n * Josh Triplett <josh@freedesktop.org>\n *\n * See also: Documentation/RCU/torture.txt\n */\n#include <linux/types.h>\n#include <linux/kernel.h>\n#include <linux/init.h>\n#include <linux/module.h>\n#include <linux/kthread.h>\n#include <linux/err.h>\n#include <linux/spinlock.h>\n#include <linux/smp.h>\n#include <linux/rcupdate.h>\n#include <linux/interrupt.h>\n#include <linux/sched.h>\n#include <asm/atomic.h>\n#include <linux/bitops.h>\n#include <linux/module.h>\n#include <linux/completion.h>\n#include <linux/moduleparam.h>\n#include <linux/percpu.h>\n#include <linux/notifier.h>\n#include <linux/cpu.h>\n#include <linux/random.h>\n#include <linux/delay.h>\n#include <linux/byteorder/swabb.h>\n#include <linux/stat.h>\n#include <linux/srcu.h>\n\nMODULE_LICENSE(\"GPL\");\nMODULE_AUTHOR(\"Paul E. McKenney <paulmck@us.ibm.com> and \"\n \"Josh Triplett <josh@freedesktop.org>\");\n\nstatic int nreaders = -1;\t/* # reader threads, defaults to 2*ncpus */\nstatic int nfakewriters = 4;\t/* # fake writer threads */\nstatic int stat_interval;\t/* Interval between stats, in seconds. */\n\t\t\t\t/* Defaults to \"only at end of test\". */\nstatic int verbose;\t\t/* Print more debug info. */\nstatic int test_no_idle_hz;\t/* Test RCU's support for tickless idle CPUs. */\nstatic int shuffle_interval = 5; /* Interval between shuffles (in sec)*/\nstatic char *torture_type = \"rcu\"; /* What RCU implementation to torture. */\n\nmodule_param(nreaders, int, 0444);\nMODULE_PARM_DESC(nreaders, \"Number of RCU reader threads\");\nmodule_param(nfakewriters, int, 0444);\nMODULE_PARM_DESC(nfakewriters, \"Number of RCU fake writer threads\");\nmodule_param(stat_interval, int, 0444);\nMODULE_PARM_DESC(stat_interval, \"Number of seconds between stats printk()s\");\nmodule_param(verbose, bool, 0444);\nMODULE_PARM_DESC(verbose, \"Enable verbose debugging printk()s\");\nmodule_param(test_no_idle_hz, bool, 0444);\nMODULE_PARM_DESC(test_no_idle_hz, \"Test support for tickless idle CPUs\");\nmodule_param(shuffle_interval, int, 0444);\nMODULE_PARM_DESC(shuffle_interval, \"Number of seconds between shuffles\");\nmodule_param(torture_type, charp, 0444);\nMODULE_PARM_DESC(torture_type, \"Type of RCU to torture (rcu, rcu_bh, srcu)\");\n\n#define TORTURE_FLAG \"-torture:\"\n#define PRINTK_STRING(s) \\\n\tdo { printk(KERN_ALERT \"%s\" TORTURE_FLAG s \"\\n\", torture_type); } while (0)\n#define VERBOSE_PRINTK_STRING(s) \\\n\tdo { if (verbose) printk(KERN_ALERT \"%s\" TORTURE_FLAG s \"\\n\", torture_type); } while (0)\n#define VERBOSE_PRINTK_ERRSTRING(s) \\\n\tdo { if (verbose) printk(KERN_ALERT \"%s\" TORTURE_FLAG \"!!! \" s \"\\n\", torture_type); } while (0)\n\nstatic char printk_buf[4096];\n\nstatic int nrealreaders;\nstatic struct task_struct *writer_task;\nstatic struct task_struct **fakewriter_tasks;\nstatic struct task_struct **reader_tasks;\nstatic struct task_struct *stats_task;\nstatic struct task_struct *shuffler_task;\n\n#define RCU_TORTURE_PIPE_LEN 10\n\nstruct rcu_torture {\n\tstruct rcu_head rtort_rcu;\n\tint rtort_pipe_count;\n\tstruct list_head rtort_free;\n\tint rtort_mbtest;\n};\n\nstatic int fullstop = 0;\t/* stop generating callbacks at test end. */\nstatic LIST_HEAD(rcu_torture_freelist);\nstatic struct rcu_torture *rcu_torture_current = NULL;\nstatic long rcu_torture_current_version = 0;\nstatic struct rcu_torture rcu_tortures[10 * RCU_TORTURE_PIPE_LEN];\nstatic DEFINE_SPINLOCK(rcu_torture_lock);\nstatic DEFINE_PER_CPU(long [RCU_TORTURE_PIPE_LEN + 1], rcu_torture_count) =\n\t{ 0 };\nstatic DEFINE_PER_CPU(long [RCU_TORTURE_PIPE_LEN + 1], rcu_torture_batch) =\n\t{ 0 };\nstatic atomic_t rcu_torture_wcount[RCU_TORTURE_PIPE_LEN + 1];\nstatic atomic_t n_rcu_torture_alloc;\nstatic atomic_t n_rcu_torture_alloc_fail;\nstatic atomic_t n_rcu_torture_free;\nstatic atomic_t n_rcu_torture_mberror;\nstatic atomic_t n_rcu_torture_error;\nstatic struct list_head rcu_torture_removed;\n\n/*\n * Allocate an element from the rcu_tortures pool.\n */\nstatic struct rcu_torture *\nrcu_torture_alloc(void)\n{\n\tstruct list_head *p;\n\n\tspin_lock_bh(&rcu_torture_lock);\n\tif (list_empty(&rcu_torture_freelist)) {\n\t\tatomic_inc(&n_rcu_torture_alloc_fail);\n\t\tspin_unlock_bh(&rcu_torture_lock);\n\t\treturn NULL;\n\t}\n\tatomic_inc(&n_rcu_torture_alloc);\n\tp = rcu_torture_freelist.next;\n\tlist_del_init(p);\n\tspin_unlock_bh(&rcu_torture_lock);\n\treturn container_of(p, struct rcu_torture, rtort_free);\n}\n\n/*\n * Free an element to the rcu_tortures pool.\n */\nstatic void\nrcu_torture_free(struct rcu_torture *p)\n{\n\tatomic_inc(&n_rcu_torture_free);\n\tspin_lock_bh(&rcu_torture_lock);\n\tlist_add_tail(&p->rtort_free, &rcu_torture_freelist);\n\tspin_unlock_bh(&rcu_torture_lock);\n}\n\nstruct rcu_random_state {\n\tunsigned long rrs_state;\n\tlong rrs_count;\n};\n\n#define RCU_RANDOM_MULT 39916801 /* prime */\n#define RCU_RANDOM_ADD\t479001701 /* prime */\n#define RCU_RANDOM_REFRESH 10000\n\n#define DEFINE_RCU_RANDOM(name) struct rcu_random_state name = { 0, 0 }\n\n/*\n * Crude but fast random-number generator. Uses a linear congruential\n * generator, with occasional help from get_random_bytes().\n */\nstatic unsigned long\nrcu_random(struct rcu_random_state *rrsp)\n{\n\tlong refresh;\n\n\tif (--rrsp->rrs_count < 0) {\n\t\tget_random_bytes(&refresh, sizeof(refresh));\n\t\trrsp->rrs_state += refresh;\n\t\trrsp->rrs_count = RCU_RANDOM_REFRESH;\n\t}\n\trrsp->rrs_state = rrsp->rrs_state * RCU_RANDOM_MULT + RCU_RANDOM_ADD;\n\treturn swahw32(rrsp->rrs_state);\n}\n\n/*\n * Operations vector for selecting different types of tests.\n */\n\nstruct rcu_torture_ops {\n\tvoid (*init)(void);\n\tvoid (*cleanup)(void);\n\tint (*readlock)(void);\n\tvoid (*readdelay)(struct rcu_random_state *rrsp);\n\tvoid (*readunlock)(int idx);\n\tint (*completed)(void);\n\tvoid (*deferredfree)(struct rcu_torture *p);\n\tvoid (*sync)(void);\n\tint (*stats)(char *page);\n\tchar *name;\n};\nstatic struct rcu_torture_ops *cur_ops = NULL;\n\n/*\n * Definitions for rcu torture testing.\n */\n\nstatic int rcu_torture_read_lock(void) __acquires(RCU)\n{\n\trcu_read_lock();\n\treturn 0;\n}\n\nstatic void rcu_read_delay(struct rcu_random_state *rrsp)\n{\n\tlong delay;\n\tconst long longdelay = 200;\n\n\t/* We want there to be long-running readers, but not all the time. */\n\n\tdelay = rcu_random(rrsp) % (nrealreaders * 2 * longdelay);\n\tif (!delay)\n\t\tudelay(longdelay);\n}\n\nstatic void rcu_torture_read_unlock(int idx) __releases(RCU)\n{\n\trcu_read_unlock();\n}\n\nstatic int rcu_torture_completed(void)\n{\n\treturn rcu_batches_completed();\n}\n\nstatic void\nrcu_torture_cb(struct rcu_head *p)\n{\n\tint i;\n\tstruct rcu_torture *rp = container_of(p, struct rcu_torture, rtort_rcu);\n\n\tif (fullstop) {\n\t\t/* Test is ending, just drop callbacks on the floor. */\n\t\t/* The next initialization will pick up the pieces. */\n\t\treturn;\n\t}\n\ti = rp->rtort_pipe_count;\n\tif (i > RCU_TORTURE_PIPE_LEN)\n\t\ti = RCU_TORTURE_PIPE_LEN;\n\tatomic_inc(&rcu_torture_wcount[i]);\n\tif (++rp->rtort_pipe_count >= RCU_TORTURE_PIPE_LEN) {\n\t\trp->rtort_mbtest = 0;\n\t\trcu_torture_free(rp);\n\t} else\n\t\tcur_ops->deferredfree(rp);\n}\n\nstatic void rcu_torture_deferred_free(struct rcu_torture *p)\n{\n\tcall_rcu(&p->rtort_rcu, rcu_torture_cb);\n}\n\nstatic struct rcu_torture_ops rcu_ops = {\n\t.init = NULL,\n\t.cleanup = NULL,\n\t.readlock = rcu_torture_read_lock,\n\t.readdelay = rcu_read_delay,\n\t.readunlock = rcu_torture_read_unlock,\n\t.completed = rcu_torture_completed,\n\t.deferredfree = rcu_torture_deferred_free,\n\t.sync = synchronize_rcu,\n\t.stats = NULL,\n\t.name = \"rcu\"\n};\n\nstatic void rcu_sync_torture_deferred_free(struct rcu_torture *p)\n{\n\tint i;\n\tstruct rcu_torture *rp;\n\tstruct rcu_torture *rp1;\n\n\tcur_ops->sync();\n\tlist_add(&p->rtort_free, &rcu_torture_removed);\n\tlist_for_each_entry_safe(rp, rp1, &rcu_torture_removed, rtort_free) {\n\t\ti = rp->rtort_pipe_count;\n\t\tif (i > RCU_TORTURE_PIPE_LEN)\n\t\t\ti = RCU_TORTURE_PIPE_LEN;\n\t\tatomic_inc(&rcu_torture_wcount[i]);\n\t\tif (++rp->rtort_pipe_count >= RCU_TORTURE_PIPE_LEN) {\n\t\t\trp->rtort_mbtest = 0;\n\t\t\tlist_del(&rp->rtort_free);\n\t\t\trcu_torture_free(rp);\n\t\t}\n\t}\n}\n\nstatic void rcu_sync_torture_init(void)\n{\n\tINIT_LIST_HEAD(&rcu_torture_removed);\n}\n\nstatic struct rcu_torture_ops rcu_sync_ops = {\n\t.init = rcu_sync_torture_init,\n\t.cleanup = NULL,\n\t.readlock = rcu_torture_read_lock,\n\t.readdelay = rcu_read_delay,\n\t.readunlock = rcu_torture_read_unlock,\n\t.completed = rcu_torture_completed,\n\t.deferredfree = rcu_sync_torture_deferred_free,\n\t.sync = synchronize_rcu,\n\t.stats = NULL,\n\t.name = \"rcu_sync\"\n};\n\n/*\n * Definitions for rcu_bh torture testing.\n */\n\nstatic int rcu_bh_torture_read_lock(void) __acquires(RCU_BH)\n{\n\trcu_read_lock_bh();\n\treturn 0;\n}\n\nstatic void rcu_bh_torture_read_unlock(int idx) __releases(RCU_BH)\n{\n\trcu_read_unlock_bh();\n}\n\nstatic int rcu_bh_torture_completed(void)\n{\n\treturn rcu_batches_completed_bh();\n}\n\nstatic void rcu_bh_torture_deferred_free(struct rcu_torture *p)\n{\n\tcall_rcu_bh(&p->rtort_rcu, rcu_torture_cb);\n}\n\nstruct rcu_bh_torture_synchronize {\n\tstruct rcu_head head;\n\tstruct completion completion;\n};\n\nstatic void rcu_bh_torture_wakeme_after_cb(struct rcu_head *head)\n{\n\tstruct rcu_bh_torture_synchronize *rcu;\n\n\trcu = container_of(head, struct rcu_bh_torture_synchronize, head);\n\tcomplete(&rcu->completion);\n}\n\nstatic void rcu_bh_torture_synchronize(void)\n{\n\tstruct rcu_bh_torture_synchronize rcu;\n\n\tinit_completion(&rcu.completion);\n\tcall_rcu_bh(&rcu.head, rcu_bh_torture_wakeme_after_cb);\n\twait_for_completion(&rcu.completion);\n}\n\nstatic struct rcu_torture_ops rcu_bh_ops = {\n\t.init = NULL,\n\t.cleanup = NULL,\n\t.readlock = rcu_bh_torture_read_lock,\n\t.readdelay = rcu_read_delay, /* just reuse rcu's version. */\n\t.readunlock = rcu_bh_torture_read_unlock,\n\t.completed = rcu_bh_torture_completed,\n\t.deferredfree = rcu_bh_torture_deferred_free,\n\t.sync = rcu_bh_torture_synchronize,\n\t.stats = NULL,\n\t.name = \"rcu_bh\"\n};\n\nstatic struct rcu_torture_ops rcu_bh_sync_ops = {\n\t.init = rcu_sync_torture_init,\n\t.cleanup = NULL,\n\t.readlock = rcu_bh_torture_read_lock,\n\t.readdelay = rcu_read_delay, /* just reuse rcu's version. */\n\t.readunlock = rcu_bh_torture_read_unlock,\n\t.completed = rcu_bh_torture_completed,\n\t.deferredfree = rcu_sync_torture_deferred_free,\n\t.sync = rcu_bh_torture_synchronize,\n\t.stats = NULL,\n\t.name = \"rcu_bh_sync\"\n};\n\n/*\n * Definitions for srcu torture testing.\n */\n\nstatic struct srcu_struct srcu_ctl;\n\nstatic void srcu_torture_init(void)\n{\n\tinit_srcu_struct(&srcu_ctl);\n\trcu_sync_torture_init();\n}\n\nstatic void srcu_torture_cleanup(void)\n{\n\tsynchronize_srcu(&srcu_ctl);\n\tcleanup_srcu_struct(&srcu_ctl);\n}\n\nstatic int srcu_torture_read_lock(void) __acquires(&srcu_ctl)\n{\n\treturn srcu_read_lock(&srcu_ctl);\n}\n\nstatic void srcu_read_delay(struct rcu_random_state *rrsp)\n{\n\tlong delay;\n\tconst long uspertick = 1000000 / HZ;\n\tconst long longdelay = 10;\n\n\t/* We want there to be long-running readers, but not all the time. */\n\n\tdelay = rcu_random(rrsp) % (nrealreaders * 2 * longdelay * uspertick);\n\tif (!delay)\n\t\tschedule_timeout_interruptible(longdelay);\n}\n\nstatic void srcu_torture_read_unlock(int idx) __releases(&srcu_ctl)\n{\n\tsrcu_read_unlock(&srcu_ctl, idx);\n}\n\nstatic int srcu_torture_completed(void)\n{\n\treturn srcu_batches_completed(&srcu_ctl);\n}\n\nstatic void srcu_torture_synchronize(void)\n{\n\tsynchronize_srcu(&srcu_ctl);\n}\n\nstatic int srcu_torture_stats(char *page)\n{\n\tint cnt = 0;\n\tint cpu;\n\tint idx = srcu_ctl.completed & 0x1;\n\n\tcnt += sprintf(&page[cnt], \"%s%s per-CPU(idx=%d):\",\n\t\t torture_type, TORTURE_FLAG, idx);\n\tfor_each_possible_cpu(cpu) {\n\t\tcnt += sprintf(&page[cnt], \" %d(%d,%d)\", cpu,\n\t\t\t per_cpu_ptr(srcu_ctl.per_cpu_ref, cpu)->c[!idx],\n\t\t\t per_cpu_ptr(srcu_ctl.per_cpu_ref, cpu)->c[idx]);\n\t}\n\tcnt += sprintf(&page[cnt], \"\\n\");\n\treturn cnt;\n}\n\nstatic struct rcu_torture_ops srcu_ops = {\n\t.init = srcu_torture_init,\n\t.cleanup = srcu_torture_cleanup,\n\t.readlock = srcu_torture_read_lock,\n\t.readdelay = srcu_read_delay,\n\t.readunlock = srcu_torture_read_unlock,\n\t.completed = srcu_torture_completed,\n\t.deferredfree = rcu_sync_torture_deferred_free,\n\t.sync = srcu_torture_synchronize,\n\t.stats = srcu_torture_stats,\n\t.name = \"srcu\"\n};\n\n/*\n * Definitions for sched torture testing.\n */\n\nstatic int sched_torture_read_lock(void)\n{\n\tpreempt_disable();\n\treturn 0;\n}\n\nstatic void sched_torture_read_unlock(int idx)\n{\n\tpreempt_enable();\n}\n\nstatic int sched_torture_completed(void)\n{\n\treturn 0;\n}\n\nstatic void sched_torture_synchronize(void)\n{\n\tsynchronize_sched();\n}\n\nstatic struct rcu_torture_ops sched_ops = {\n\t.init = rcu_sync_torture_init,\n\t.cleanup = NULL,\n\t.readlock = sched_torture_read_lock,\n\t.readdelay = rcu_read_delay, /* just reuse rcu's version. */\n\t.readunlock = sched_torture_read_unlock,\n\t.completed = sched_torture_completed,\n\t.deferredfree = rcu_sync_torture_deferred_free,\n\t.sync = sched_torture_synchronize,\n\t.stats = NULL,\n\t.name = \"sched\"\n};\n\n/*\n * RCU torture writer kthread. Repeatedly substitutes a new structure\n * for that pointed to by rcu_torture_current, freeing the old structure\n * after a series of grace periods (the \"pipeline\").\n */\nstatic int\nrcu_torture_writer(void *arg)\n{\n\tint i;\n\tlong oldbatch = rcu_batches_completed();\n\tstruct rcu_torture *rp;\n\tstruct rcu_torture *old_rp;\n\tstatic DEFINE_RCU_RANDOM(rand);\n\n\tVERBOSE_PRINTK_STRING(\"rcu_torture_writer task started\");\n\tset_user_nice(current, 19);\n\tcurrent->flags |= PF_NOFREEZE;\n\n\tdo {\n\t\tschedule_timeout_uninterruptible(1);\n\t\tif ((rp = rcu_torture_alloc()) == NULL)\n\t\t\tcontinue;\n\t\trp->rtort_pipe_count = 0;\n\t\tudelay(rcu_random(&rand) & 0x3ff);\n\t\told_rp = rcu_torture_current;\n\t\trp->rtort_mbtest = 1;\n\t\trcu_assign_pointer(rcu_torture_current, rp);\n\t\tsmp_wmb();\n\t\tif (old_rp) {\n\t\t\ti = old_rp->rtort_pipe_count;\n\t\t\tif (i > RCU_TORTURE_PIPE_LEN)\n\t\t\t\ti = RCU_TORTURE_PIPE_LEN;\n\t\t\tatomic_inc(&rcu_torture_wcount[i]);\n\t\t\told_rp->rtort_pipe_count++;\n\t\t\tcur_ops->deferredfree(old_rp);\n\t\t}\n\t\trcu_torture_current_version++;\n\t\toldbatch = cur_ops->completed();\n\t} while (!kthread_should_stop() && !fullstop);\n\tVERBOSE_PRINTK_STRING(\"rcu_torture_writer task stopping\");\n\twhile (!kthread_should_stop())\n\t\tschedule_timeout_uninterruptible(1);\n\treturn 0;\n}\n\n/*\n * RCU torture fake writer kthread. Repeatedly calls sync, with a random\n * delay between calls.\n */\nstatic int\nrcu_torture_fakewriter(void *arg)\n{\n\tDEFINE_RCU_RANDOM(rand);\n\n\tVERBOSE_PRINTK_STRING(\"rcu_torture_fakewriter task started\");\n\tset_user_nice(current, 19);\n\tcurrent->flags |= PF_NOFREEZE;\n\n\tdo {\n\t\tschedule_timeout_uninterruptible(1 + rcu_random(&rand)%10);\n\t\tudelay(rcu_random(&rand) & 0x3ff);\n\t\tcur_ops->sync();\n\t} while (!kthread_should_stop() && !fullstop);\n\n\tVERBOSE_PRINTK_STRING(\"rcu_torture_fakewriter task stopping\");\n\twhile (!kthread_should_stop())\n\t\tschedule_timeout_uninterruptible(1);\n\treturn 0;\n}\n\n/*\n * RCU torture reader kthread. Repeatedly dereferences rcu_torture_current,\n * incrementing the corresponding element of the pipeline array. The\n * counter in the element should never be greater than 1, otherwise, the\n * RCU implementation is broken.\n */\nstatic int\nrcu_torture_reader(void *arg)\n{\n\tint completed;\n\tint idx;\n\tDEFINE_RCU_RANDOM(rand);\n\tstruct rcu_torture *p;\n\tint pipe_count;\n\n\tVERBOSE_PRINTK_STRING(\"rcu_torture_reader task started\");\n\tset_user_nice(current, 19);\n\tcurrent->flags |= PF_NOFREEZE;\n\n\tdo {\n\t\tidx = cur_ops->readlock();\n\t\tcompleted = cur_ops->completed();\n\t\tp = rcu_dereference(rcu_torture_current);\n\t\tif (p == NULL) {\n\t\t\t/* Wait for rcu_torture_writer to get underway */\n\t\t\tcur_ops->readunlock(idx);\n\t\t\tschedule_timeout_interruptible(HZ);\n\t\t\tcontinue;\n\t\t}\n\t\tif (p->rtort_mbtest == 0)\n\t\t\tatomic_inc(&n_rcu_torture_mberror);\n\t\tcur_ops->readdelay(&rand);\n\t\tpreempt_disable();\n\t\tpipe_count = p->rtort_pipe_count;\n\t\tif (pipe_count > RCU_TORTURE_PIPE_LEN) {\n\t\t\t/* Should not happen, but... */\n\t\t\tpipe_count = RCU_TORTURE_PIPE_LEN;\n\t\t}\n\t\t++__get_cpu_var(rcu_torture_count)[pipe_count];\n\t\tcompleted = cur_ops->completed() - completed;\n\t\tif (completed > RCU_TORTURE_PIPE_LEN) {\n\t\t\t/* Should not happen, but... */\n\t\t\tcompleted = RCU_TORTURE_PIPE_LEN;\n\t\t}\n\t\t++__get_cpu_var(rcu_torture_batch)[completed];\n\t\tpreempt_enable();\n\t\tcur_ops->readunlock(idx);\n\t\tschedule();\n\t} while (!kthread_should_stop() && !fullstop);\n\tVERBOSE_PRINTK_STRING(\"rcu_torture_reader task stopping\");\n\twhile (!kthread_should_stop())\n\t\tschedule_timeout_uninterruptible(1);\n\treturn 0;\n}\n\n/*\n * Create an RCU-torture statistics message in the specified buffer.\n */\nstatic int\nrcu_torture_printk(char *page)\n{\n\tint cnt = 0;\n\tint cpu;\n\tint i;\n\tlong pipesummary[RCU_TORTURE_PIPE_LEN + 1] = { 0 };\n\tlong batchsummary[RCU_TORTURE_PIPE_LEN + 1] = { 0 };\n\n\tfor_each_possible_cpu(cpu) {\n\t\tfor (i = 0; i < RCU_TORTURE_PIPE_LEN + 1; i++) {\n\t\t\tpipesummary[i] += per_cpu(rcu_torture_count, cpu)[i];\n\t\t\tbatchsummary[i] += per_cpu(rcu_torture_batch, cpu)[i];\n\t\t}\n\t}\n\tfor (i = RCU_TORTURE_PIPE_LEN - 1; i >= 0; i--) {\n\t\tif (pipesummary[i] != 0)\n\t\t\tbreak;\n\t}\n\tcnt += sprintf(&page[cnt], \"%s%s \", torture_type, TORTURE_FLAG);\n\tcnt += sprintf(&page[cnt],\n\t\t \"rtc: %p ver: %ld tfle: %d rta: %d rtaf: %d rtf: %d \"\n\t\t \"rtmbe: %d\",\n\t\t rcu_torture_current,\n\t\t rcu_torture_current_version,\n\t\t list_empty(&rcu_torture_freelist),\n\t\t atomic_read(&n_rcu_torture_alloc),\n\t\t atomic_read(&n_rcu_torture_alloc_fail),\n\t\t atomic_read(&n_rcu_torture_free),\n\t\t atomic_read(&n_rcu_torture_mberror));\n\tif (atomic_read(&n_rcu_torture_mberror) != 0)\n\t\tcnt += sprintf(&page[cnt], \" !!!\");\n\tcnt += sprintf(&page[cnt], \"\\n%s%s \", torture_type, TORTURE_FLAG);\n\tif (i > 1) {\n\t\tcnt += sprintf(&page[cnt], \"!!! \");\n\t\tatomic_inc(&n_rcu_torture_error);\n\t}\n\tcnt += sprintf(&page[cnt], \"Reader Pipe: \");\n\tfor (i = 0; i < RCU_TORTURE_PIPE_LEN + 1; i++)\n\t\tcnt += sprintf(&page[cnt], \" %ld\", pipesummary[i]);\n\tcnt += sprintf(&page[cnt], \"\\n%s%s \", torture_type, TORTURE_FLAG);\n\tcnt += sprintf(&page[cnt], \"Reader Batch: \");\n\tfor (i = 0; i < RCU_TORTURE_PIPE_LEN + 1; i++)\n\t\tcnt += sprintf(&page[cnt], \" %ld\", batchsummary[i]);\n\tcnt += sprintf(&page[cnt], \"\\n%s%s \", torture_type, TORTURE_FLAG);\n\tcnt += sprintf(&page[cnt], \"Free-Block Circulation: \");\n\tfor (i = 0; i < RCU_TORTURE_PIPE_LEN + 1; i++) {\n\t\tcnt += sprintf(&page[cnt], \" %d\",\n\t\t\t atomic_read(&rcu_torture_wcount[i]));\n\t}\n\tcnt += sprintf(&page[cnt], \"\\n\");\n\tif (cur_ops->stats)\n\t\tcnt += cur_ops->stats(&page[cnt]);\n\treturn cnt;\n}\n\n/*\n * Print torture statistics. Caller must ensure that there is only\n * one call to this function at a given time!!! This is normally\n * accomplished by relying on the module system to only have one copy\n * of the module loaded, and then by giving the rcu_torture_stats\n * kthread full control (or the init/cleanup functions when rcu_torture_stats\n * thread is not running).\n */\nstatic void\nrcu_torture_stats_print(void)\n{\n\tint cnt;\n\n\tcnt = rcu_torture_printk(printk_buf);\n\tprintk(KERN_ALERT \"%s\", printk_buf);\n}\n\n/*\n * Periodically prints torture statistics, if periodic statistics printing\n * was specified via the stat_interval module parameter.\n *\n * No need to worry about fullstop here, since this one doesn't reference\n * volatile state or register callbacks.\n */\nstatic int\nrcu_torture_stats(void *arg)\n{\n\tVERBOSE_PRINTK_STRING(\"rcu_torture_stats task started\");\n\tdo {\n\t\tschedule_timeout_interruptible(stat_interval * HZ);\n\t\trcu_torture_stats_print();\n\t} while (!kthread_should_stop());\n\tVERBOSE_PRINTK_STRING(\"rcu_torture_stats task stopping\");\n\treturn 0;\n}\n\nstatic int rcu_idle_cpu;\t/* Force all torture tasks off this CPU */\n\n/* Shuffle tasks such that we allow @rcu_idle_cpu to become idle. A special case\n * is when @rcu_idle_cpu = -1, when we allow the tasks to run on all CPUs.\n */\nstatic void rcu_torture_shuffle_tasks(void)\n{\n\tcpumask_t tmp_mask = CPU_MASK_ALL;\n\tint i;\n\n\tlock_cpu_hotplug();\n\n\t/* No point in shuffling if there is only one online CPU (ex: UP) */\n\tif (num_online_cpus() == 1) {\n\t\tunlock_cpu_hotplug();\n\t\treturn;\n\t}\n\n\tif (rcu_idle_cpu != -1)\n\t\tcpu_clear(rcu_idle_cpu, tmp_mask);\n\n\tset_cpus_allowed(current, tmp_mask);\n\n\tif (reader_tasks) {\n\t\tfor (i = 0; i < nrealreaders; i++)\n\t\t\tif (reader_tasks[i])\n\t\t\t\tset_cpus_allowed(reader_tasks[i], tmp_mask);\n\t}\n\n\tif (fakewriter_tasks) {\n\t\tfor (i = 0; i < nfakewriters; i++)\n\t\t\tif (fakewriter_tasks[i])\n\t\t\t\tset_cpus_allowed(fakewriter_tasks[i], tmp_mask);\n\t}\n\n\tif (writer_task)\n\t\tset_cpus_allowed(writer_task, tmp_mask);\n\n\tif (stats_task)\n\t\tset_cpus_allowed(stats_task, tmp_mask);\n\n\tif (rcu_idle_cpu == -1)\n\t\trcu_idle_cpu = num_online_cpus() - 1;\n\telse\n\t\trcu_idle_cpu--;\n\n\tunlock_cpu_hotplug();\n}\n\n/* Shuffle tasks across CPUs, with the intent of allowing each CPU in the\n * system to become idle at a time and cut off its timer ticks. This is meant\n * to test the support for such tickless idle CPU in RCU.\n */\nstatic int\nrcu_torture_shuffle(void *arg)\n{\n\tVERBOSE_PRINTK_STRING(\"rcu_torture_shuffle task started\");\n\tdo {\n\t\tschedule_timeout_interruptible(shuffle_interval * HZ);\n\t\trcu_torture_shuffle_tasks();\n\t} while (!kthread_should_stop());\n\tVERBOSE_PRINTK_STRING(\"rcu_torture_shuffle task stopping\");\n\treturn 0;\n}\n\nstatic inline void\nrcu_torture_print_module_parms(char *tag)\n{\n\tprintk(KERN_ALERT \"%s\" TORTURE_FLAG\n\t\t\"--- %s: nreaders=%d nfakewriters=%d \"\n\t\t\"stat_interval=%d verbose=%d test_no_idle_hz=%d \"\n\t\t\"shuffle_interval = %d\\n\",\n\t\ttorture_type, tag, nrealreaders, nfakewriters,\n\t\tstat_interval, verbose, test_no_idle_hz, shuffle_interval);\n}\n\nstatic void\nrcu_torture_cleanup(void)\n{\n\tint i;\n\n\tfullstop = 1;\n\tif (shuffler_task) {\n\t\tVERBOSE_PRINTK_STRING(\"Stopping rcu_torture_shuffle task\");\n\t\tkthread_stop(shuffler_task);\n\t}\n\tshuffler_task = NULL;\n\n\tif (writer_task) {\n\t\tVERBOSE_PRINTK_STRING(\"Stopping rcu_torture_writer task\");\n\t\tkthread_stop(writer_task);\n\t}\n\twriter_task = NULL;\n\n\tif (reader_tasks) {\n\t\tfor (i = 0; i < nrealreaders; i++) {\n\t\t\tif (reader_tasks[i]) {\n\t\t\t\tVERBOSE_PRINTK_STRING(\n\t\t\t\t\t\"Stopping rcu_torture_reader task\");\n\t\t\t\tkthread_stop(reader_tasks[i]);\n\t\t\t}\n\t\t\treader_tasks[i] = NULL;\n\t\t}\n\t\tkfree(reader_tasks);\n\t\treader_tasks = NULL;\n\t}\n\trcu_torture_current = NULL;\n\n\tif (fakewriter_tasks) {\n\t\tfor (i = 0; i < nfakewriters; i++) {\n\t\t\tif (fakewriter_tasks[i]) {\n\t\t\t\tVERBOSE_PRINTK_STRING(\n\t\t\t\t\t\"Stopping rcu_torture_fakewriter task\");\n\t\t\t\tkthread_stop(fakewriter_tasks[i]);\n\t\t\t}\n\t\t\tfakewriter_tasks[i] = NULL;\n\t\t}\n\t\tkfree(fakewriter_tasks);\n\t\tfakewriter_tasks = NULL;\n\t}\n\n\tif (stats_task) {\n\t\tVERBOSE_PRINTK_STRING(\"Stopping rcu_torture_stats task\");\n\t\tkthread_stop(stats_task);\n\t}\n\tstats_task = NULL;\n\n\t/* Wait for all RCU callbacks to fire. */\n\trcu_barrier();\n\n\trcu_torture_stats_print(); /* -After- the stats thread is stopped! */\n\n\tif (cur_ops->cleanup)\n\t\tcur_ops->cleanup();\n\tif (atomic_read(&n_rcu_torture_error))\n\t\trcu_torture_print_module_parms(\"End of test: FAILURE\");\n\telse\n\t\trcu_torture_print_module_parms(\"End of test: SUCCESS\");\n}\n\nstatic int __init\nrcu_torture_init(void)\n{\n\tint i;\n\tint cpu;\n\tint firsterr = 0;\n\tstatic struct rcu_torture_ops *torture_ops[] =\n\t\t{ &rcu_ops, &rcu_sync_ops, &rcu_bh_ops, &rcu_bh_sync_ops,\n\t\t &srcu_ops, &sched_ops, };\n\n\t/* Process args and tell the world that the torturer is on the job. */\n\tfor (i = 0; i < ARRAY_SIZE(torture_ops); i++) {\n\t\tcur_ops = torture_ops[i];\n\t\tif (strcmp(torture_type, cur_ops->name) == 0)\n\t\t\tbreak;\n\t}\n\tif (i == ARRAY_SIZE(torture_ops)) {\n\t\tprintk(KERN_ALERT \"rcutorture: invalid torture type: \\\"%s\\\"\\n\",\n\t\t torture_type);\n\t\treturn (-EINVAL);\n\t}\n\tif (cur_ops->init)\n\t\tcur_ops->init(); /* no \"goto unwind\" prior to this point!!! */\n\n\tif (nreaders >= 0)\n\t\tnrealreaders = nreaders;\n\telse\n\t\tnrealreaders = 2 * num_online_cpus();\n\trcu_torture_print_module_parms(\"Start of test\");\n\tfullstop = 0;\n\n\t/* Set up the freelist. */\n\n\tINIT_LIST_HEAD(&rcu_torture_freelist);\n\tfor (i = 0; i < ARRAY_SIZE(rcu_tortures); i++) {\n\t\trcu_tortures[i].rtort_mbtest = 0;\n\t\tlist_add_tail(&rcu_tortures[i].rtort_free,\n\t\t\t &rcu_torture_freelist);\n\t}\n\n\t/* Initialize the statistics so that each run gets its own numbers. */\n\n\trcu_torture_current = NULL;\n\trcu_torture_current_version = 0;\n\tatomic_set(&n_rcu_torture_alloc, 0);\n\tatomic_set(&n_rcu_torture_alloc_fail, 0);\n\tatomic_set(&n_rcu_torture_free, 0);\n\tatomic_set(&n_rcu_torture_mberror, 0);\n\tatomic_set(&n_rcu_torture_error, 0);\n\tfor (i = 0; i < RCU_TORTURE_PIPE_LEN + 1; i++)\n\t\tatomic_set(&rcu_torture_wcount[i], 0);\n\tfor_each_possible_cpu(cpu) {\n\t\tfor (i = 0; i < RCU_TORTURE_PIPE_LEN + 1; i++) {\n\t\t\tper_cpu(rcu_torture_count, cpu)[i] = 0;\n\t\t\tper_cpu(rcu_torture_batch, cpu)[i] = 0;\n\t\t}\n\t}\n\n\t/* Start up the kthreads. */\n\n\tVERBOSE_PRINTK_STRING(\"Creating rcu_torture_writer task\");\n\twriter_task = kthread_run(rcu_torture_writer, NULL,\n\t\t\t\t \"rcu_torture_writer\");\n\tif (IS_ERR(writer_task)) {\n\t\tfirsterr = PTR_ERR(writer_task);\n\t\tVERBOSE_PRINTK_ERRSTRING(\"Failed to create writer\");\n\t\twriter_task = NULL;\n\t\tgoto unwind;\n\t}\n\tfakewriter_tasks = kzalloc(nfakewriters * sizeof(fakewriter_tasks[0]),\n\t GFP_KERNEL);\n\tif (fakewriter_tasks == NULL) {\n\t\tVERBOSE_PRINTK_ERRSTRING(\"out of memory\");\n\t\tfirsterr = -ENOMEM;\n\t\tgoto unwind;\n\t}\n\tfor (i = 0; i < nfakewriters; i++) {\n\t\tVERBOSE_PRINTK_STRING(\"Creating rcu_torture_fakewriter task\");\n\t\tfakewriter_tasks[i] = kthread_run(rcu_torture_fakewriter, NULL,\n\t\t \"rcu_torture_fakewriter\");\n\t\tif (IS_ERR(fakewriter_tasks[i])) {\n\t\t\tfirsterr = PTR_ERR(fakewriter_tasks[i]);\n\t\t\tVERBOSE_PRINTK_ERRSTRING(\"Failed to create fakewriter\");\n\t\t\tfakewriter_tasks[i] = NULL;\n\t\t\tgoto unwind;\n\t\t}\n\t}\n\treader_tasks = kzalloc(nrealreaders * sizeof(reader_tasks[0]),\n\t\t\t GFP_KERNEL);\n\tif (reader_tasks == NULL) {\n\t\tVERBOSE_PRINTK_ERRSTRING(\"out of memory\");\n\t\tfirsterr = -ENOMEM;\n\t\tgoto unwind;\n\t}\n\tfor (i = 0; i < nrealreaders; i++) {\n\t\tVERBOSE_PRINTK_STRING(\"Creating rcu_torture_reader task\");\n\t\treader_tasks[i] = kthread_run(rcu_torture_reader, NULL,\n\t\t\t\t\t \"rcu_torture_reader\");\n\t\tif (IS_ERR(reader_tasks[i])) {\n\t\t\tfirsterr = PTR_ERR(reader_tasks[i]);\n\t\t\tVERBOSE_PRINTK_ERRSTRING(\"Failed to create reader\");\n\t\t\treader_tasks[i] = NULL;\n\t\t\tgoto unwind;\n\t\t}\n\t}\n\tif (stat_interval > 0) {\n\t\tVERBOSE_PRINTK_STRING(\"Creating rcu_torture_stats task\");\n\t\tstats_task = kthread_run(rcu_torture_stats, NULL,\n\t\t\t\t\t\"rcu_torture_stats\");\n\t\tif (IS_ERR(stats_task)) {\n\t\t\tfirsterr = PTR_ERR(stats_task);\n\t\t\tVERBOSE_PRINTK_ERRSTRING(\"Failed to create stats\");\n\t\t\tstats_task = NULL;\n\t\t\tgoto unwind;\n\t\t}\n\t}\n\tif (test_no_idle_hz) {\n\t\trcu_idle_cpu = num_online_cpus() - 1;\n\t\t/* Create the shuffler thread */\n\t\tshuffler_task = kthread_run(rcu_torture_shuffle, NULL,\n\t\t\t\t\t \"rcu_torture_shuffle\");\n\t\tif (IS_ERR(shuffler_task)) {\n\t\t\tfirsterr = PTR_ERR(shuffler_task);\n\t\t\tVERBOSE_PRINTK_ERRSTRING(\"Failed to create shuffler\");\n\t\t\tshuffler_task = NULL;\n\t\t\tgoto unwind;\n\t\t}\n\t}\n\treturn 0;\n\nunwind:\n\trcu_torture_cleanup();\n\treturn firsterr;\n}\n\nmodule_init(rcu_torture_init);\nmodule_exit(rcu_torture_cleanup);\n/*\n * Public API and common code for kernel->userspace relay file support.\n *\n * See Documentation/filesystems/relayfs.txt for an overview of relayfs.\n *\n * Copyright (C) 2002-2005 - Tom Zanussi (zanussi@us.ibm.com), IBM Corp\n * Copyright (C) 1999-2005 - Karim Yaghmour (karim@opersys.com)\n *\n * Moved to kernel/relay.c by Paul Mundt, 2006.\n * November 2006 - CPU hotplug support by Mathieu Desnoyers\n * \t(mathieu.desnoyers@polymtl.ca)\n *\n * This file is released under the GPL.\n */\n#include <linux/errno.h>\n#include <linux/stddef.h>\n#include <linux/slab.h>\n#include <linux/module.h>\n#include <linux/string.h>\n#include <linux/relay.h>\n#include <linux/vmalloc.h>\n#include <linux/mm.h>\n#include <linux/cpu.h>\n\n/* list of open channels, for cpu hotplug */\nstatic DEFINE_MUTEX(relay_channels_mutex);\nstatic LIST_HEAD(relay_channels);\n\n/*\n * close() vm_op implementation for relay file mapping.\n */\nstatic void relay_file_mmap_close(struct vm_area_struct *vma)\n{\n\tstruct rchan_buf *buf = vma->vm_private_data;\n\tbuf->chan->cb->buf_unmapped(buf, vma->vm_file);\n}\n\n/*\n * nopage() vm_op implementation for relay file mapping.\n */\nstatic struct page *relay_buf_nopage(struct vm_area_struct *vma,\n\t\t\t\t unsigned long address,\n\t\t\t\t int *type)\n{\n\tstruct page *page;\n\tstruct rchan_buf *buf = vma->vm_private_data;\n\tunsigned long offset = address - vma->vm_start;\n\n\tif (address > vma->vm_end)\n\t\treturn NOPAGE_SIGBUS; /* Disallow mremap */\n\tif (!buf)\n\t\treturn NOPAGE_OOM;\n\n\tpage = vmalloc_to_page(buf->start + offset);\n\tif (!page)\n\t\treturn NOPAGE_OOM;\n\tget_page(page);\n\n\tif (type)\n\t\t*type = VM_FAULT_MINOR;\n\n\treturn page;\n}\n\n/*\n * vm_ops for relay file mappings.\n */\nstatic struct vm_operations_struct relay_file_mmap_ops = {\n\t.nopage = relay_buf_nopage,\n\t.close = relay_file_mmap_close,\n};\n\n/**\n *\trelay_mmap_buf: - mmap channel buffer to process address space\n *\t@buf: relay channel buffer\n *\t@vma: vm_area_struct describing memory to be mapped\n *\n *\tReturns 0 if ok, negative on error\n *\n *\tCaller should already have grabbed mmap_sem.\n */\nint relay_mmap_buf(struct rchan_buf *buf, struct vm_area_struct *vma)\n{\n\tunsigned long length = vma->vm_end - vma->vm_start;\n\tstruct file *filp = vma->vm_file;\n\n\tif (!buf)\n\t\treturn -EBADF;\n\n\tif (length != (unsigned long)buf->chan->alloc_size)\n\t\treturn -EINVAL;\n\n\tvma->vm_ops = &relay_file_mmap_ops;\n\tvma->vm_flags |= VM_DONTEXPAND;\n\tvma->vm_private_data = buf;\n\tbuf->chan->cb->buf_mapped(buf, filp);\n\n\treturn 0;\n}\n\n/**\n *\trelay_alloc_buf - allocate a channel buffer\n *\t@buf: the buffer struct\n *\t@size: total size of the buffer\n *\n *\tReturns a pointer to the resulting buffer, %NULL if unsuccessful. The\n *\tpassed in size will get page aligned, if it isn't already.\n */\nstatic void *relay_alloc_buf(struct rchan_buf *buf, size_t *size)\n{\n\tvoid *mem;\n\tunsigned int i, j, n_pages;\n\n\t*size = PAGE_ALIGN(*size);\n\tn_pages = *size >> PAGE_SHIFT;\n\n\tbuf->page_array = kcalloc(n_pages, sizeof(struct page *), GFP_KERNEL);\n\tif (!buf->page_array)\n\t\treturn NULL;\n\n\tfor (i = 0; i < n_pages; i++) {\n\t\tbuf->page_array[i] = alloc_page(GFP_KERNEL);\n\t\tif (unlikely(!buf->page_array[i]))\n\t\t\tgoto depopulate;\n\t}\n\tmem = vmap(buf->page_array, n_pages, VM_MAP, PAGE_KERNEL);\n\tif (!mem)\n\t\tgoto depopulate;\n\n\tmemset(mem, 0, *size);\n\tbuf->page_count = n_pages;\n\treturn mem;\n\ndepopulate:\n\tfor (j = 0; j < i; j++)\n\t\t__free_page(buf->page_array[j]);\n\tkfree(buf->page_array);\n\treturn NULL;\n}\n\n/**\n *\trelay_create_buf - allocate and initialize a channel buffer\n *\t@chan: the relay channel\n *\n *\tReturns channel buffer if successful, %NULL otherwise.\n */\nstruct rchan_buf *relay_create_buf(struct rchan *chan)\n{\n\tstruct rchan_buf *buf = kzalloc(sizeof(struct rchan_buf), GFP_KERNEL);\n\tif (!buf)\n\t\treturn NULL;\n\n\tbuf->padding = kmalloc(chan->n_subbufs * sizeof(size_t *), GFP_KERNEL);\n\tif (!buf->padding)\n\t\tgoto free_buf;\n\n\tbuf->start = relay_alloc_buf(buf, &chan->alloc_size);\n\tif (!buf->start)\n\t\tgoto free_buf;\n\n\tbuf->chan = chan;\n\tkref_get(&buf->chan->kref);\n\treturn buf;\n\nfree_buf:\n\tkfree(buf->padding);\n\tkfree(buf);\n\treturn NULL;\n}\n\n/**\n *\trelay_destroy_channel - free the channel struct\n *\t@kref: target kernel reference that contains the relay channel\n *\n *\tShould only be called from kref_put().\n */\nvoid relay_destroy_channel(struct kref *kref)\n{\n\tstruct rchan *chan = container_of(kref, struct rchan, kref);\n\tkfree(chan);\n}\n\n/**\n *\trelay_destroy_buf - destroy an rchan_buf struct and associated buffer\n *\t@buf: the buffer struct\n */\nvoid relay_destroy_buf(struct rchan_buf *buf)\n{\n\tstruct rchan *chan = buf->chan;\n\tunsigned int i;\n\n\tif (likely(buf->start)) {\n\t\tvunmap(buf->start);\n\t\tfor (i = 0; i < buf->page_count; i++)\n\t\t\t__free_page(buf->page_array[i]);\n\t\tkfree(buf->page_array);\n\t}\n\tchan->buf[buf->cpu] = NULL;\n\tkfree(buf->padding);\n\tkfree(buf);\n\tkref_put(&chan->kref, relay_destroy_channel);\n}\n\n/**\n *\trelay_remove_buf - remove a channel buffer\n *\t@kref: target kernel reference that contains the relay buffer\n *\n *\tRemoves the file from the fileystem, which also frees the\n *\trchan_buf_struct and the channel buffer. Should only be called from\n *\tkref_put().\n */\nvoid relay_remove_buf(struct kref *kref)\n{\n\tstruct rchan_buf *buf = container_of(kref, struct rchan_buf, kref);\n\tbuf->chan->cb->remove_buf_file(buf->dentry);\n\trelay_destroy_buf(buf);\n}\n\n/**\n *\trelay_buf_empty - boolean, is the channel buffer empty?\n *\t@buf: channel buffer\n *\n *\tReturns 1 if the buffer is empty, 0 otherwise.\n */\nint relay_buf_empty(struct rchan_buf *buf)\n{\n\treturn (buf->subbufs_produced - buf->subbufs_consumed) ? 0 : 1;\n}\nEXPORT_SYMBOL_GPL(relay_buf_empty);\n\n/**\n *\trelay_buf_full - boolean, is the channel buffer full?\n *\t@buf: channel buffer\n *\n *\tReturns 1 if the buffer is full, 0 otherwise.\n */\nint relay_buf_full(struct rchan_buf *buf)\n{\n\tsize_t ready = buf->subbufs_produced - buf->subbufs_consumed;\n\treturn (ready >= buf->chan->n_subbufs) ? 1 : 0;\n}\nEXPORT_SYMBOL_GPL(relay_buf_full);\n\n/*\n * High-level relay kernel API and associated functions.\n */\n\n/*\n * rchan_callback implementations defining default channel behavior. Used\n * in place of corresponding NULL values in client callback struct.\n */\n\n/*\n * subbuf_start() default callback. Does nothing.\n */\nstatic int subbuf_start_default_callback (struct rchan_buf *buf,\n\t\t\t\t\t void *subbuf,\n\t\t\t\t\t void *prev_subbuf,\n\t\t\t\t\t size_t prev_padding)\n{\n\tif (relay_buf_full(buf))\n\t\treturn 0;\n\n\treturn 1;\n}\n\n/*\n * buf_mapped() default callback. Does nothing.\n */\nstatic void buf_mapped_default_callback(struct rchan_buf *buf,\n\t\t\t\t\tstruct file *filp)\n{\n}\n\n/*\n * buf_unmapped() default callback. Does nothing.\n */\nstatic void buf_unmapped_default_callback(struct rchan_buf *buf,\n\t\t\t\t\t struct file *filp)\n{\n}\n\n/*\n * create_buf_file_create() default callback. Does nothing.\n */\nstatic struct dentry *create_buf_file_default_callback(const char *filename,\n\t\t\t\t\t\t struct dentry *parent,\n\t\t\t\t\t\t int mode,\n\t\t\t\t\t\t struct rchan_buf *buf,\n\t\t\t\t\t\t int *is_global)\n{\n\treturn NULL;\n}\n\n/*\n * remove_buf_file() default callback. Does nothing.\n */\nstatic int remove_buf_file_default_callback(struct dentry *dentry)\n{\n\treturn -EINVAL;\n}\n\n/* relay channel default callbacks */\nstatic struct rchan_callbacks default_channel_callbacks = {\n\t.subbuf_start = subbuf_start_default_callback,\n\t.buf_mapped = buf_mapped_default_callback,\n\t.buf_unmapped = buf_unmapped_default_callback,\n\t.create_buf_file = create_buf_file_default_callback,\n\t.remove_buf_file = remove_buf_file_default_callback,\n};\n\n/**\n *\twakeup_readers - wake up readers waiting on a channel\n *\t@data: contains the channel buffer\n *\n *\tThis is the timer function used to defer reader waking.\n */\nstatic void wakeup_readers(unsigned long data)\n{\n\tstruct rchan_buf *buf = (struct rchan_buf *)data;\n\twake_up_interruptible(&buf->read_wait);\n}\n\n/**\n *\t__relay_reset - reset a channel buffer\n *\t@buf: the channel buffer\n *\t@init: 1 if this is a first-time initialization\n *\n *\tSee relay_reset() for description of effect.\n */\nstatic void __relay_reset(struct rchan_buf *buf, unsigned int init)\n{\n\tsize_t i;\n\n\tif (init) {\n\t\tinit_waitqueue_head(&buf->read_wait);\n\t\tkref_init(&buf->kref);\n\t\tsetup_timer(&buf->timer, wakeup_readers, (unsigned long)buf);\n\t} else\n\t\tdel_timer_sync(&buf->timer);\n\n\tbuf->subbufs_produced = 0;\n\tbuf->subbufs_consumed = 0;\n\tbuf->bytes_consumed = 0;\n\tbuf->finalized = 0;\n\tbuf->data = buf->start;\n\tbuf->offset = 0;\n\n\tfor (i = 0; i < buf->chan->n_subbufs; i++)\n\t\tbuf->padding[i] = 0;\n\n\tbuf->chan->cb->subbuf_start(buf, buf->data, NULL, 0);\n}\n\n/**\n *\trelay_reset - reset the channel\n *\t@chan: the channel\n *\n *\tThis has the effect of erasing all data from all channel buffers\n *\tand restarting the channel in its initial state. The buffers\n *\tare not freed, so any mappings are still in effect.\n *\n *\tNOTE. Care should be taken that the channel isn't actually\n *\tbeing used by anything when this call is made.\n */\nvoid relay_reset(struct rchan *chan)\n{\n\tunsigned int i;\n\n\tif (!chan)\n\t\treturn;\n\n \tif (chan->is_global && chan->buf[0]) {\n\t\t__relay_reset(chan->buf[0], 0);\n\t\treturn;\n\t}\n\n\tmutex_lock(&relay_channels_mutex);\n\tfor_each_online_cpu(i)\n\t\tif (chan->buf[i])\n\t\t\t__relay_reset(chan->buf[i], 0);\n\tmutex_unlock(&relay_channels_mutex);\n}\nEXPORT_SYMBOL_GPL(relay_reset);\n\n/*\n *\trelay_open_buf - create a new relay channel buffer\n *\n *\tused by relay_open() and CPU hotplug.\n */\nstatic struct rchan_buf *relay_open_buf(struct rchan *chan, unsigned int cpu)\n{\n \tstruct rchan_buf *buf = NULL;\n\tstruct dentry *dentry;\n \tchar *tmpname;\n\n \tif (chan->is_global)\n\t\treturn chan->buf[0];\n\n\ttmpname = kzalloc(NAME_MAX + 1, GFP_KERNEL);\n \tif (!tmpname)\n \t\tgoto end;\n \tsnprintf(tmpname, NAME_MAX, \"%s%d\", chan->base_filename, cpu);\n\n\tbuf = relay_create_buf(chan);\n\tif (!buf)\n \t\tgoto free_name;\n\n \tbuf->cpu = cpu;\n \t__relay_reset(buf, 1);\n\n\t/* Create file in fs */\n \tdentry = chan->cb->create_buf_file(tmpname, chan->parent, S_IRUSR,\n \t\t\t\t\t buf, &chan->is_global);\n \tif (!dentry)\n \t\tgoto free_buf;\n\n\tbuf->dentry = dentry;\n\n \tif(chan->is_global) {\n \t\tchan->buf[0] = buf;\n \t\tbuf->cpu = 0;\n \t}\n\n \tgoto free_name;\n\nfree_buf:\n \trelay_destroy_buf(buf);\nfree_name:\n \tkfree(tmpname);\nend:\n\treturn buf;\n}\n\n/**\n *\trelay_close_buf - close a channel buffer\n *\t@buf: channel buffer\n *\n *\tMarks the buffer finalized and restores the default callbacks.\n *\tThe channel buffer and channel buffer data structure are then freed\n *\tautomatically when the last reference is given up.\n */\nstatic void relay_close_buf(struct rchan_buf *buf)\n{\n\tbuf->finalized = 1;\n\tdel_timer_sync(&buf->timer);\n\tkref_put(&buf->kref, relay_remove_buf);\n}\n\nstatic void setup_callbacks(struct rchan *chan,\n\t\t\t\t struct rchan_callbacks *cb)\n{\n\tif (!cb) {\n\t\tchan->cb = &default_channel_callbacks;\n\t\treturn;\n\t}\n\n\tif (!cb->subbuf_start)\n\t\tcb->subbuf_start = subbuf_start_default_callback;\n\tif (!cb->buf_mapped)\n\t\tcb->buf_mapped = buf_mapped_default_callback;\n\tif (!cb->buf_unmapped)\n\t\tcb->buf_unmapped = buf_unmapped_default_callback;\n\tif (!cb->create_buf_file)\n\t\tcb->create_buf_file = create_buf_file_default_callback;\n\tif (!cb->remove_buf_file)\n\t\tcb->remove_buf_file = remove_buf_file_default_callback;\n\tchan->cb = cb;\n}\n\n/**\n * \trelay_hotcpu_callback - CPU hotplug callback\n * \t@nb: notifier block\n * \t@action: hotplug action to take\n * \t@hcpu: CPU number\n *\n * \tReturns the success/failure of the operation. (%NOTIFY_OK, %NOTIFY_BAD)\n */\nstatic int __cpuinit relay_hotcpu_callback(struct notifier_block *nb,\n\t\t\t\tunsigned long action,\n\t\t\t\tvoid *hcpu)\n{\n\tunsigned int hotcpu = (unsigned long)hcpu;\n\tstruct rchan *chan;\n\n\tswitch(action) {\n\tcase CPU_UP_PREPARE:\n\tcase CPU_UP_PREPARE_FROZEN:\n\t\tmutex_lock(&relay_channels_mutex);\n\t\tlist_for_each_entry(chan, &relay_channels, list) {\n\t\t\tif (chan->buf[hotcpu])\n\t\t\t\tcontinue;\n\t\t\tchan->buf[hotcpu] = relay_open_buf(chan, hotcpu);\n\t\t\tif(!chan->buf[hotcpu]) {\n\t\t\t\tprintk(KERN_ERR\n\t\t\t\t\t\"relay_hotcpu_callback: cpu %d buffer \"\n\t\t\t\t\t\"creation failed\\n\", hotcpu);\n\t\t\t\tmutex_unlock(&relay_channels_mutex);\n\t\t\t\treturn NOTIFY_BAD;\n\t\t\t}\n\t\t}\n\t\tmutex_unlock(&relay_channels_mutex);\n\t\tbreak;\n\tcase CPU_DEAD:\n\tcase CPU_DEAD_FROZEN:\n\t\t/* No need to flush the cpu : will be flushed upon\n\t\t * final relay_flush() call. */\n\t\tbreak;\n\t}\n\treturn NOTIFY_OK;\n}\n\n/**\n *\trelay_open - create a new relay channel\n *\t@base_filename: base name of files to create\n *\t@parent: dentry of parent directory, %NULL for root directory\n *\t@subbuf_size: size of sub-buffers\n *\t@n_subbufs: number of sub-buffers\n *\t@cb: client callback functions\n *\t@private_data: user-defined data\n *\n *\tReturns channel pointer if successful, %NULL otherwise.\n *\n *\tCreates a channel buffer for each cpu using the sizes and\n *\tattributes specified. The created channel buffer files\n *\twill be named base_filename0...base_filenameN-1. File\n *\tpermissions will be %S_IRUSR.\n */\nstruct rchan *relay_open(const char *base_filename,\n\t\t\t struct dentry *parent,\n\t\t\t size_t subbuf_size,\n\t\t\t size_t n_subbufs,\n\t\t\t struct rchan_callbacks *cb,\n\t\t\t void *private_data)\n{\n\tunsigned int i;\n\tstruct rchan *chan;\n\tif (!base_filename)\n\t\treturn NULL;\n\n\tif (!(subbuf_size && n_subbufs))\n\t\treturn NULL;\n\n\tchan = kzalloc(sizeof(struct rchan), GFP_KERNEL);\n\tif (!chan)\n\t\treturn NULL;\n\n\tchan->version = RELAYFS_CHANNEL_VERSION;\n\tchan->n_subbufs = n_subbufs;\n\tchan->subbuf_size = subbuf_size;\n\tchan->alloc_size = FIX_SIZE(subbuf_size * n_subbufs);\n\tchan->parent = parent;\n\tchan->private_data = private_data;\n\tstrlcpy(chan->base_filename, base_filename, NAME_MAX);\n\tsetup_callbacks(chan, cb);\n\tkref_init(&chan->kref);\n\n\tmutex_lock(&relay_channels_mutex);\n\tfor_each_online_cpu(i) {\n\t\tchan->buf[i] = relay_open_buf(chan, i);\n\t\tif (!chan->buf[i])\n\t\t\tgoto free_bufs;\n\t}\n\tlist_add(&chan->list, &relay_channels);\n\tmutex_unlock(&relay_channels_mutex);\n\n\treturn chan;\n\nfree_bufs:\n\tfor_each_online_cpu(i) {\n\t\tif (!chan->buf[i])\n\t\t\tbreak;\n\t\trelay_close_buf(chan->buf[i]);\n\t}\n\n\tkref_put(&chan->kref, relay_destroy_channel);\n\tmutex_unlock(&relay_channels_mutex);\n\treturn NULL;\n}\nEXPORT_SYMBOL_GPL(relay_open);\n\n/**\n *\trelay_switch_subbuf - switch to a new sub-buffer\n *\t@buf: channel buffer\n *\t@length: size of current event\n *\n *\tReturns either the length passed in or 0 if full.\n *\n *\tPerforms sub-buffer-switch tasks such as invoking callbacks,\n *\tupdating padding counts, waking up readers, etc.\n */\nsize_t relay_switch_subbuf(struct rchan_buf *buf, size_t length)\n{\n\tvoid *old, *new;\n\tsize_t old_subbuf, new_subbuf;\n\n\tif (unlikely(length > buf->chan->subbuf_size))\n\t\tgoto toobig;\n\n\tif (buf->offset != buf->chan->subbuf_size + 1) {\n\t\tbuf->prev_padding = buf->chan->subbuf_size - buf->offset;\n\t\told_subbuf = buf->subbufs_produced % buf->chan->n_subbufs;\n\t\tbuf->padding[old_subbuf] = buf->prev_padding;\n\t\tbuf->subbufs_produced++;\n\t\tbuf->dentry->d_inode->i_size += buf->chan->subbuf_size -\n\t\t\tbuf->padding[old_subbuf];\n\t\tsmp_mb();\n\t\tif (waitqueue_active(&buf->read_wait))\n\t\t\t/*\n\t\t\t * Calling wake_up_interruptible() from here\n\t\t\t * will deadlock if we happen to be logging\n\t\t\t * from the scheduler (trying to re-grab\n\t\t\t * rq->lock), so defer it.\n\t\t\t */\n\t\t\t__mod_timer(&buf->timer, jiffies + 1);\n\t}\n\n\told = buf->data;\n\tnew_subbuf = buf->subbufs_produced % buf->chan->n_subbufs;\n\tnew = buf->start + new_subbuf * buf->chan->subbuf_size;\n\tbuf->offset = 0;\n\tif (!buf->chan->cb->subbuf_start(buf, new, old, buf->prev_padding)) {\n\t\tbuf->offset = buf->chan->subbuf_size + 1;\n\t\treturn 0;\n\t}\n\tbuf->data = new;\n\tbuf->padding[new_subbuf] = 0;\n\n\tif (unlikely(length + buf->offset > buf->chan->subbuf_size))\n\t\tgoto toobig;\n\n\treturn length;\n\ntoobig:\n\tbuf->chan->last_toobig = length;\n\treturn 0;\n}\nEXPORT_SYMBOL_GPL(relay_switch_subbuf);\n\n/**\n *\trelay_subbufs_consumed - update the buffer's sub-buffers-consumed count\n *\t@chan: the channel\n *\t@cpu: the cpu associated with the channel buffer to update\n *\t@subbufs_consumed: number of sub-buffers to add to current buf's count\n *\n *\tAdds to the channel buffer's consumed sub-buffer count.\n *\tsubbufs_consumed should be the number of sub-buffers newly consumed,\n *\tnot the total consumed.\n *\n *\tNOTE. Kernel clients don't need to call this function if the channel\n *\tmode is 'overwrite'.\n */\nvoid relay_subbufs_consumed(struct rchan *chan,\n\t\t\t unsigned int cpu,\n\t\t\t size_t subbufs_consumed)\n{\n\tstruct rchan_buf *buf;\n\n\tif (!chan)\n\t\treturn;\n\n\tif (cpu >= NR_CPUS || !chan->buf[cpu])\n\t\treturn;\n\n\tbuf = chan->buf[cpu];\n\tbuf->subbufs_consumed += subbufs_consumed;\n\tif (buf->subbufs_consumed > buf->subbufs_produced)\n\t\tbuf->subbufs_consumed = buf->subbufs_produced;\n}\nEXPORT_SYMBOL_GPL(relay_subbufs_consumed);\n\n/**\n *\trelay_close - close the channel\n *\t@chan: the channel\n *\n *\tCloses all channel buffers and frees the channel.\n */\nvoid relay_close(struct rchan *chan)\n{\n\tunsigned int i;\n\n\tif (!chan)\n\t\treturn;\n\n\tmutex_lock(&relay_channels_mutex);\n\tif (chan->is_global && chan->buf[0])\n\t\trelay_close_buf(chan->buf[0]);\n\telse\n\t\tfor_each_possible_cpu(i)\n\t\t\tif (chan->buf[i])\n\t\t\t\trelay_close_buf(chan->buf[i]);\n\n\tif (chan->last_toobig)\n\t\tprintk(KERN_WARNING \"relay: one or more items not logged \"\n\t\t \"[item size (%Zd) > sub-buffer size (%Zd)]\\n\",\n\t\t chan->last_toobig, chan->subbuf_size);\n\n\tlist_del(&chan->list);\n\tkref_put(&chan->kref, relay_destroy_channel);\n\tmutex_unlock(&relay_channels_mutex);\n}\nEXPORT_SYMBOL_GPL(relay_close);\n\n/**\n *\trelay_flush - close the channel\n *\t@chan: the channel\n *\n *\tFlushes all channel buffers, i.e. forces buffer switch.\n */\nvoid relay_flush(struct rchan *chan)\n{\n\tunsigned int i;\n\n\tif (!chan)\n\t\treturn;\n\n\tif (chan->is_global && chan->buf[0]) {\n\t\trelay_switch_subbuf(chan->buf[0], 0);\n\t\treturn;\n\t}\n\n\tmutex_lock(&relay_channels_mutex);\n\tfor_each_possible_cpu(i)\n\t\tif (chan->buf[i])\n\t\t\trelay_switch_subbuf(chan->buf[i], 0);\n\tmutex_unlock(&relay_channels_mutex);\n}\nEXPORT_SYMBOL_GPL(relay_flush);\n\n/**\n *\trelay_file_open - open file op for relay files\n *\t@inode: the inode\n *\t@filp: the file\n *\n *\tIncrements the channel buffer refcount.\n */\nstatic int relay_file_open(struct inode *inode, struct file *filp)\n{\n\tstruct rchan_buf *buf = inode->i_private;\n\tkref_get(&buf->kref);\n\tfilp->private_data = buf;\n\n\treturn 0;\n}\n\n/**\n *\trelay_file_mmap - mmap file op for relay files\n *\t@filp: the file\n *\t@vma: the vma describing what to map\n *\n *\tCalls upon relay_mmap_buf() to map the file into user space.\n */\nstatic int relay_file_mmap(struct file *filp, struct vm_area_struct *vma)\n{\n\tstruct rchan_buf *buf = filp->private_data;\n\treturn relay_mmap_buf(buf, vma);\n}\n\n/**\n *\trelay_file_poll - poll file op for relay files\n *\t@filp: the file\n *\t@wait: poll table\n *\n *\tPoll implemention.\n */\nstatic unsigned int relay_file_poll(struct file *filp, poll_table *wait)\n{\n\tunsigned int mask = 0;\n\tstruct rchan_buf *buf = filp->private_data;\n\n\tif (buf->finalized)\n\t\treturn POLLERR;\n\n\tif (filp->f_mode & FMODE_READ) {\n\t\tpoll_wait(filp, &buf->read_wait, wait);\n\t\tif (!relay_buf_empty(buf))\n\t\t\tmask |= POLLIN | POLLRDNORM;\n\t}\n\n\treturn mask;\n}\n\n/**\n *\trelay_file_release - release file op for relay files\n *\t@inode: the inode\n *\t@filp: the file\n *\n *\tDecrements the channel refcount, as the filesystem is\n *\tno longer using it.\n */\nstatic int relay_file_release(struct inode *inode, struct file *filp)\n{\n\tstruct rchan_buf *buf = filp->private_data;\n\tkref_put(&buf->kref, relay_remove_buf);\n\n\treturn 0;\n}\n\n/*\n *\trelay_file_read_consume - update the consumed count for the buffer\n */\nstatic void relay_file_read_consume(struct rchan_buf *buf,\n\t\t\t\t size_t read_pos,\n\t\t\t\t size_t bytes_consumed)\n{\n\tsize_t subbuf_size = buf->chan->subbuf_size;\n\tsize_t n_subbufs = buf->chan->n_subbufs;\n\tsize_t read_subbuf;\n\n\tif (buf->bytes_consumed + bytes_consumed > subbuf_size) {\n\t\trelay_subbufs_consumed(buf->chan, buf->cpu, 1);\n\t\tbuf->bytes_consumed = 0;\n\t}\n\n\tbuf->bytes_consumed += bytes_consumed;\n\tif (!read_pos)\n\t\tread_subbuf = buf->subbufs_consumed % n_subbufs;\n\telse\n\t\tread_subbuf = read_pos / buf->chan->subbuf_size;\n\tif (buf->bytes_consumed + buf->padding[read_subbuf] == subbuf_size) {\n\t\tif ((read_subbuf == buf->subbufs_produced % n_subbufs) &&\n\t\t (buf->offset == subbuf_size))\n\t\t\treturn;\n\t\trelay_subbufs_consumed(buf->chan, buf->cpu, 1);\n\t\tbuf->bytes_consumed = 0;\n\t}\n}\n\n/*\n *\trelay_file_read_avail - boolean, are there unconsumed bytes available?\n */\nstatic int relay_file_read_avail(struct rchan_buf *buf, size_t read_pos)\n{\n\tsize_t subbuf_size = buf->chan->subbuf_size;\n\tsize_t n_subbufs = buf->chan->n_subbufs;\n\tsize_t produced = buf->subbufs_produced;\n\tsize_t consumed = buf->subbufs_consumed;\n\n\trelay_file_read_consume(buf, read_pos, 0);\n\n\tif (unlikely(buf->offset > subbuf_size)) {\n\t\tif (produced == consumed)\n\t\t\treturn 0;\n\t\treturn 1;\n\t}\n\n\tif (unlikely(produced - consumed >= n_subbufs)) {\n\t\tconsumed = produced - n_subbufs + 1;\n\t\tbuf->subbufs_consumed = consumed;\n\t\tbuf->bytes_consumed = 0;\n\t}\n\t\n\tproduced = (produced % n_subbufs) * subbuf_size + buf->offset;\n\tconsumed = (consumed % n_subbufs) * subbuf_size + buf->bytes_consumed;\n\n\tif (consumed > produced)\n\t\tproduced += n_subbufs * subbuf_size;\n\t\n\tif (consumed == produced)\n\t\treturn 0;\n\n\treturn 1;\n}\n\n/**\n *\trelay_file_read_subbuf_avail - return bytes available in sub-buffer\n *\t@read_pos: file read position\n *\t@buf: relay channel buffer\n */\nstatic size_t relay_file_read_subbuf_avail(size_t read_pos,\n\t\t\t\t\t struct rchan_buf *buf)\n{\n\tsize_t padding, avail = 0;\n\tsize_t read_subbuf, read_offset, write_subbuf, write_offset;\n\tsize_t subbuf_size = buf->chan->subbuf_size;\n\n\twrite_subbuf = (buf->data - buf->start) / subbuf_size;\n\twrite_offset = buf->offset > subbuf_size ? subbuf_size : buf->offset;\n\tread_subbuf = read_pos / subbuf_size;\n\tread_offset = read_pos % subbuf_size;\n\tpadding = buf->padding[read_subbuf];\n\n\tif (read_subbuf == write_subbuf) {\n\t\tif (read_offset + padding < write_offset)\n\t\t\tavail = write_offset - (read_offset + padding);\n\t} else\n\t\tavail = (subbuf_size - padding) - read_offset;\n\n\treturn avail;\n}\n\n/**\n *\trelay_file_read_start_pos - find the first available byte to read\n *\t@read_pos: file read position\n *\t@buf: relay channel buffer\n *\n *\tIf the @read_pos is in the middle of padding, return the\n *\tposition of the first actually available byte, otherwise\n *\treturn the original value.\n */\nstatic size_t relay_file_read_start_pos(size_t read_pos,\n\t\t\t\t\tstruct rchan_buf *buf)\n{\n\tsize_t read_subbuf, padding, padding_start, padding_end;\n\tsize_t subbuf_size = buf->chan->subbuf_size;\n\tsize_t n_subbufs = buf->chan->n_subbufs;\n\tsize_t consumed = buf->subbufs_consumed % n_subbufs;\n\n\tif (!read_pos)\n\t\tread_pos = consumed * subbuf_size + buf->bytes_consumed;\n\tread_subbuf = read_pos / subbuf_size;\n\tpadding = buf->padding[read_subbuf];\n\tpadding_start = (read_subbuf + 1) * subbuf_size - padding;\n\tpadding_end = (read_subbuf + 1) * subbuf_size;\n\tif (read_pos >= padding_start && read_pos < padding_end) {\n\t\tread_subbuf = (read_subbuf + 1) % n_subbufs;\n\t\tread_pos = read_subbuf * subbuf_size;\n\t}\n\n\treturn read_pos;\n}\n\n/**\n *\trelay_file_read_end_pos - return the new read position\n *\t@read_pos: file read position\n *\t@buf: relay channel buffer\n *\t@count: number of bytes to be read\n */\nstatic size_t relay_file_read_end_pos(struct rchan_buf *buf,\n\t\t\t\t size_t read_pos,\n\t\t\t\t size_t count)\n{\n\tsize_t read_subbuf, padding, end_pos;\n\tsize_t subbuf_size = buf->chan->subbuf_size;\n\tsize_t n_subbufs = buf->chan->n_subbufs;\n\n\tread_subbuf = read_pos / subbuf_size;\n\tpadding = buf->padding[read_subbuf];\n\tif (read_pos % subbuf_size + count + padding == subbuf_size)\n\t\tend_pos = (read_subbuf + 1) * subbuf_size;\n\telse\n\t\tend_pos = read_pos + count;\n\tif (end_pos >= subbuf_size * n_subbufs)\n\t\tend_pos = 0;\n\n\treturn end_pos;\n}\n\n/*\n *\tsubbuf_read_actor - read up to one subbuf's worth of data\n */\nstatic int subbuf_read_actor(size_t read_start,\n\t\t\t struct rchan_buf *buf,\n\t\t\t size_t avail,\n\t\t\t read_descriptor_t *desc,\n\t\t\t read_actor_t actor)\n{\n\tvoid *from;\n\tint ret = 0;\n\n\tfrom = buf->start + read_start;\n\tret = avail;\n\tif (copy_to_user(desc->arg.buf, from, avail)) {\n\t\tdesc->error = -EFAULT;\n\t\tret = 0;\n\t}\n\tdesc->arg.data += ret;\n\tdesc->written += ret;\n\tdesc->count -= ret;\n\n\treturn ret;\n}\n\n/*\n *\tsubbuf_send_actor - send up to one subbuf's worth of data\n */\nstatic int subbuf_send_actor(size_t read_start,\n\t\t\t struct rchan_buf *buf,\n\t\t\t size_t avail,\n\t\t\t read_descriptor_t *desc,\n\t\t\t read_actor_t actor)\n{\n\tunsigned long pidx, poff;\n\tunsigned int subbuf_pages;\n\tint ret = 0;\n\n\tsubbuf_pages = buf->chan->alloc_size >> PAGE_SHIFT;\n\tpidx = (read_start / PAGE_SIZE) % subbuf_pages;\n\tpoff = read_start & ~PAGE_MASK;\n\twhile (avail) {\n\t\tstruct page *p = buf->page_array[pidx];\n\t\tunsigned int len;\n\n\t\tlen = PAGE_SIZE - poff;\n\t\tif (len > avail)\n\t\t\tlen = avail;\n\n\t\tlen = actor(desc, p, poff, len);\n\t\tif (desc->error)\n\t\t\tbreak;\n\n\t\tavail -= len;\n\t\tret += len;\n\t\tpoff = 0;\n\t\tpidx = (pidx + 1) % subbuf_pages;\n\t}\n\n\treturn ret;\n}\n\ntypedef int (*subbuf_actor_t) (size_t read_start,\n\t\t\t struct rchan_buf *buf,\n\t\t\t size_t avail,\n\t\t\t read_descriptor_t *desc,\n\t\t\t read_actor_t actor);\n\n/*\n *\trelay_file_read_subbufs - read count bytes, bridging subbuf boundaries\n */\nstatic ssize_t relay_file_read_subbufs(struct file *filp, loff_t *ppos,\n\t\t\t\t\tsubbuf_actor_t subbuf_actor,\n\t\t\t\t\tread_actor_t actor,\n\t\t\t\t\tread_descriptor_t *desc)\n{\n\tstruct rchan_buf *buf = filp->private_data;\n\tsize_t read_start, avail;\n\tint ret;\n\n\tif (!desc->count)\n\t\treturn 0;\n\n\tmutex_lock(&filp->f_path.dentry->d_inode->i_mutex);\n\tdo {\n\t\tif (!relay_file_read_avail(buf, *ppos))\n\t\t\tbreak;\n\n\t\tread_start = relay_file_read_start_pos(*ppos, buf);\n\t\tavail = relay_file_read_subbuf_avail(read_start, buf);\n\t\tif (!avail)\n\t\t\tbreak;\n\n\t\tavail = min(desc->count, avail);\n\t\tret = subbuf_actor(read_start, buf, avail, desc, actor);\n\t\tif (desc->error < 0)\n\t\t\tbreak;\n\n\t\tif (ret) {\n\t\t\trelay_file_read_consume(buf, read_start, ret);\n\t\t\t*ppos = relay_file_read_end_pos(buf, read_start, ret);\n\t\t}\n\t} while (desc->count && ret);\n\tmutex_unlock(&filp->f_path.dentry->d_inode->i_mutex);\n\n\treturn desc->written;\n}\n\nstatic ssize_t relay_file_read(struct file *filp,\n\t\t\t char __user *buffer,\n\t\t\t size_t count,\n\t\t\t loff_t *ppos)\n{\n\tread_descriptor_t desc;\n\tdesc.written = 0;\n\tdesc.count = count;\n\tdesc.arg.buf = buffer;\n\tdesc.error = 0;\n\treturn relay_file_read_subbufs(filp, ppos, subbuf_read_actor,\n\t\t\t\t NULL, &desc);\n}\n\nstatic ssize_t relay_file_sendfile(struct file *filp,\n\t\t\t\t loff_t *ppos,\n\t\t\t\t size_t count,\n\t\t\t\t read_actor_t actor,\n\t\t\t\t void *target)\n{\n\tread_descriptor_t desc;\n\tdesc.written = 0;\n\tdesc.count = count;\n\tdesc.arg.data = target;\n\tdesc.error = 0;\n\treturn relay_file_read_subbufs(filp, ppos, subbuf_send_actor,\n\t\t\t\t actor, &desc);\n}\n\nconst struct file_operations relay_file_operations = {\n\t.open\t\t= relay_file_open,\n\t.poll\t\t= relay_file_poll,\n\t.mmap\t\t= relay_file_mmap,\n\t.read\t\t= relay_file_read,\n\t.llseek\t\t= no_llseek,\n\t.release\t= relay_file_release,\n\t.sendfile = relay_file_sendfile,\n};\nEXPORT_SYMBOL_GPL(relay_file_operations);\n\nstatic __init int relay_init(void)\n{\n\n\thotcpu_notifier(relay_hotcpu_callback, 0);\n\treturn 0;\n}\n\nmodule_init(relay_init);\n/*\n *\tlinux/kernel/resource.c\n *\n * Copyright (C) 1999\tLinus Torvalds\n * Copyright (C) 1999\tMartin Mares <mj@ucw.cz>\n *\n * Arbitrary resource management.\n */\n\n#include <linux/module.h>\n#include <linux/errno.h>\n#include <linux/ioport.h>\n#include <linux/init.h>\n#include <linux/slab.h>\n#include <linux/spinlock.h>\n#include <linux/fs.h>\n#include <linux/proc_fs.h>\n#include <linux/seq_file.h>\n#include <linux/device.h>\n#include <asm/io.h>\n\n\nstruct resource ioport_resource = {\n\t.name\t= \"PCI IO\",\n\t.start\t= 0,\n\t.end\t= IO_SPACE_LIMIT,\n\t.flags\t= IORESOURCE_IO,\n};\nEXPORT_SYMBOL(ioport_resource);\n\nstruct resource iomem_resource = {\n\t.name\t= \"PCI mem\",\n\t.start\t= 0,\n\t.end\t= -1,\n\t.flags\t= IORESOURCE_MEM,\n};\nEXPORT_SYMBOL(iomem_resource);\n\nstatic DEFINE_RWLOCK(resource_lock);\n\n#ifdef CONFIG_PROC_FS\n\nenum { MAX_IORES_LEVEL = 5 };\n\nstatic void *r_next(struct seq_file *m, void *v, loff_t *pos)\n{\n\tstruct resource *p = v;\n\t(*pos)++;\n\tif (p->child)\n\t\treturn p->child;\n\twhile (!p->sibling && p->parent)\n\t\tp = p->parent;\n\treturn p->sibling;\n}\n\nstatic void *r_start(struct seq_file *m, loff_t *pos)\n\t__acquires(resource_lock)\n{\n\tstruct resource *p = m->private;\n\tloff_t l = 0;\n\tread_lock(&resource_lock);\n\tfor (p = p->child; p && l < *pos; p = r_next(m, p, &l))\n\t\t;\n\treturn p;\n}\n\nstatic void r_stop(struct seq_file *m, void *v)\n\t__releases(resource_lock)\n{\n\tread_unlock(&resource_lock);\n}\n\nstatic int r_show(struct seq_file *m, void *v)\n{\n\tstruct resource *root = m->private;\n\tstruct resource *r = v, *p;\n\tint width = root->end < 0x10000 ? 4 : 8;\n\tint depth;\n\n\tfor (depth = 0, p = r; depth < MAX_IORES_LEVEL; depth++, p = p->parent)\n\t\tif (p->parent == root)\n\t\t\tbreak;\n\tseq_printf(m, \"%*s%0*llx-%0*llx : %s\\n\",\n\t\t\tdepth * 2, \"\",\n\t\t\twidth, (unsigned long long) r->start,\n\t\t\twidth, (unsigned long long) r->end,\n\t\t\tr->name ? r->name : \"<BAD>\");\n\treturn 0;\n}\n\nstatic const struct seq_operations resource_op = {\n\t.start\t= r_start,\n\t.next\t= r_next,\n\t.stop\t= r_stop,\n\t.show\t= r_show,\n};\n\nstatic int ioports_open(struct inode *inode, struct file *file)\n{\n\tint res = seq_open(file, &resource_op);\n\tif (!res) {\n\t\tstruct seq_file *m = file->private_data;\n\t\tm->private = &ioport_resource;\n\t}\n\treturn res;\n}\n\nstatic int iomem_open(struct inode *inode, struct file *file)\n{\n\tint res = seq_open(file, &resource_op);\n\tif (!res) {\n\t\tstruct seq_file *m = file->private_data;\n\t\tm->private = &iomem_resource;\n\t}\n\treturn res;\n}\n\nstatic const struct file_operations proc_ioports_operations = {\n\t.open\t\t= ioports_open,\n\t.read\t\t= seq_read,\n\t.llseek\t\t= seq_lseek,\n\t.release\t= seq_release,\n};\n\nstatic const struct file_operations proc_iomem_operations = {\n\t.open\t\t= iomem_open,\n\t.read\t\t= seq_read,\n\t.llseek\t\t= seq_lseek,\n\t.release\t= seq_release,\n};\n\nstatic int __init ioresources_init(void)\n{\n\tstruct proc_dir_entry *entry;\n\n\tentry = create_proc_entry(\"ioports\", 0, NULL);\n\tif (entry)\n\t\tentry->proc_fops = &proc_ioports_operations;\n\tentry = create_proc_entry(\"iomem\", 0, NULL);\n\tif (entry)\n\t\tentry->proc_fops = &proc_iomem_operations;\n\treturn 0;\n}\n__initcall(ioresources_init);\n\n#endif /* CONFIG_PROC_FS */\n\n/* Return the conflict entry if you can't request it */\nstatic struct resource * __request_resource(struct resource *root, struct resource *new)\n{\n\tresource_size_t start = new->start;\n\tresource_size_t end = new->end;\n\tstruct resource *tmp, **p;\n\n\tif (end < start)\n\t\treturn root;\n\tif (start < root->start)\n\t\treturn root;\n\tif (end > root->end)\n\t\treturn root;\n\tp = &root->child;\n\tfor (;;) {\n\t\ttmp = *p;\n\t\tif (!tmp || tmp->start > end) {\n\t\t\tnew->sibling = tmp;\n\t\t\t*p = new;\n\t\t\tnew->parent = root;\n\t\t\treturn NULL;\n\t\t}\n\t\tp = &tmp->sibling;\n\t\tif (tmp->end < start)\n\t\t\tcontinue;\n\t\treturn tmp;\n\t}\n}\n\nstatic int __release_resource(struct resource *old)\n{\n\tstruct resource *tmp, **p;\n\n\tp = &old->parent->child;\n\tfor (;;) {\n\t\ttmp = *p;\n\t\tif (!tmp)\n\t\t\tbreak;\n\t\tif (tmp == old) {\n\t\t\t*p = tmp->sibling;\n\t\t\told->parent = NULL;\n\t\t\treturn 0;\n\t\t}\n\t\tp = &tmp->sibling;\n\t}\n\treturn -EINVAL;\n}\n\n/**\n * request_resource - request and reserve an I/O or memory resource\n * @root: root resource descriptor\n * @new: resource descriptor desired by caller\n *\n * Returns 0 for success, negative error code on error.\n */\nint request_resource(struct resource *root, struct resource *new)\n{\n\tstruct resource *conflict;\n\n\twrite_lock(&resource_lock);\n\tconflict = __request_resource(root, new);\n\twrite_unlock(&resource_lock);\n\treturn conflict ? -EBUSY : 0;\n}\n\nEXPORT_SYMBOL(request_resource);\n\n/**\n * release_resource - release a previously reserved resource\n * @old: resource pointer\n */\nint release_resource(struct resource *old)\n{\n\tint retval;\n\n\twrite_lock(&resource_lock);\n\tretval = __release_resource(old);\n\twrite_unlock(&resource_lock);\n\treturn retval;\n}\n\nEXPORT_SYMBOL(release_resource);\n\n#ifdef CONFIG_MEMORY_HOTPLUG\n/*\n * Finds the lowest memory reosurce exists within [res->start.res->end)\n * the caller must specify res->start, res->end, res->flags.\n * If found, returns 0, res is overwritten, if not found, returns -1.\n */\nint find_next_system_ram(struct resource *res)\n{\n\tresource_size_t start, end;\n\tstruct resource *p;\n\n\tBUG_ON(!res);\n\n\tstart = res->start;\n\tend = res->end;\n\tBUG_ON(start >= end);\n\n\tread_lock(&resource_lock);\n\tfor (p = iomem_resource.child; p ; p = p->sibling) {\n\t\t/* system ram is just marked as IORESOURCE_MEM */\n\t\tif (p->flags != res->flags)\n\t\t\tcontinue;\n\t\tif (p->start > end) {\n\t\t\tp = NULL;\n\t\t\tbreak;\n\t\t}\n\t\tif ((p->end >= start) && (p->start < end))\n\t\t\tbreak;\n\t}\n\tread_unlock(&resource_lock);\n\tif (!p)\n\t\treturn -1;\n\t/* copy data */\n\tif (res->start < p->start)\n\t\tres->start = p->start;\n\tif (res->end > p->end)\n\t\tres->end = p->end;\n\treturn 0;\n}\n#endif\n\n/*\n * Find empty slot in the resource tree given range and alignment.\n */\nstatic int find_resource(struct resource *root, struct resource *new,\n\t\t\t resource_size_t size, resource_size_t min,\n\t\t\t resource_size_t max, resource_size_t align,\n\t\t\t void (*alignf)(void *, struct resource *,\n\t\t\t\t\tresource_size_t, resource_size_t),\n\t\t\t void *alignf_data)\n{\n\tstruct resource *this = root->child;\n\n\tnew->start = root->start;\n\t/*\n\t * Skip past an allocated resource that starts at 0, since the assignment\n\t * of this->start - 1 to new->end below would cause an underflow.\n\t */\n\tif (this && this->start == 0) {\n\t\tnew->start = this->end + 1;\n\t\tthis = this->sibling;\n\t}\n\tfor(;;) {\n\t\tif (this)\n\t\t\tnew->end = this->start - 1;\n\t\telse\n\t\t\tnew->end = root->end;\n\t\tif (new->start < min)\n\t\t\tnew->start = min;\n\t\tif (new->end > max)\n\t\t\tnew->end = max;\n\t\tnew->start = ALIGN(new->start, align);\n\t\tif (alignf)\n\t\t\talignf(alignf_data, new, size, align);\n\t\tif (new->start < new->end && new->end - new->start >= size - 1) {\n\t\t\tnew->end = new->start + size - 1;\n\t\t\treturn 0;\n\t\t}\n\t\tif (!this)\n\t\t\tbreak;\n\t\tnew->start = this->end + 1;\n\t\tthis = this->sibling;\n\t}\n\treturn -EBUSY;\n}\n\n/**\n * allocate_resource - allocate empty slot in the resource tree given range & alignment\n * @root: root resource descriptor\n * @new: resource descriptor desired by caller\n * @size: requested resource region size\n * @min: minimum size to allocate\n * @max: maximum size to allocate\n * @align: alignment requested, in bytes\n * @alignf: alignment function, optional, called if not NULL\n * @alignf_data: arbitrary data to pass to the @alignf function\n */\nint allocate_resource(struct resource *root, struct resource *new,\n\t\t resource_size_t size, resource_size_t min,\n\t\t resource_size_t max, resource_size_t align,\n\t\t void (*alignf)(void *, struct resource *,\n\t\t\t\t resource_size_t, resource_size_t),\n\t\t void *alignf_data)\n{\n\tint err;\n\n\twrite_lock(&resource_lock);\n\terr = find_resource(root, new, size, min, max, align, alignf, alignf_data);\n\tif (err >= 0 && __request_resource(root, new))\n\t\terr = -EBUSY;\n\twrite_unlock(&resource_lock);\n\treturn err;\n}\n\nEXPORT_SYMBOL(allocate_resource);\n\n/**\n * insert_resource - Inserts a resource in the resource tree\n * @parent: parent of the new resource\n * @new: new resource to insert\n *\n * Returns 0 on success, -EBUSY if the resource can't be inserted.\n *\n * This function is equivalent to request_resource when no conflict\n * happens. If a conflict happens, and the conflicting resources\n * entirely fit within the range of the new resource, then the new\n * resource is inserted and the conflicting resources become children of\n * the new resource.\n */\nint insert_resource(struct resource *parent, struct resource *new)\n{\n\tint result;\n\tstruct resource *first, *next;\n\n\twrite_lock(&resource_lock);\n\n\tfor (;; parent = first) {\n\t \tresult = 0;\n\t\tfirst = __request_resource(parent, new);\n\t\tif (!first)\n\t\t\tgoto out;\n\n\t\tresult = -EBUSY;\n\t\tif (first == parent)\n\t\t\tgoto out;\n\n\t\tif ((first->start > new->start) || (first->end < new->end))\n\t\t\tbreak;\n\t\tif ((first->start == new->start) && (first->end == new->end))\n\t\t\tbreak;\n\t}\n\n\tfor (next = first; ; next = next->sibling) {\n\t\t/* Partial overlap? Bad, and unfixable */\n\t\tif (next->start < new->start || next->end > new->end)\n\t\t\tgoto out;\n\t\tif (!next->sibling)\n\t\t\tbreak;\n\t\tif (next->sibling->start > new->end)\n\t\t\tbreak;\n\t}\n\n\tresult = 0;\n\n\tnew->parent = parent;\n\tnew->sibling = next->sibling;\n\tnew->child = first;\n\n\tnext->sibling = NULL;\n\tfor (next = first; next; next = next->sibling)\n\t\tnext->parent = new;\n\n\tif (parent->child == first) {\n\t\tparent->child = new;\n\t} else {\n\t\tnext = parent->child;\n\t\twhile (next->sibling != first)\n\t\t\tnext = next->sibling;\n\t\tnext->sibling = new;\n\t}\n\n out:\n\twrite_unlock(&resource_lock);\n\treturn result;\n}\n\n/**\n * adjust_resource - modify a resource's start and size\n * @res: resource to modify\n * @start: new start value\n * @size: new size\n *\n * Given an existing resource, change its start and size to match the\n * arguments. Returns 0 on success, -EBUSY if it can't fit.\n * Existing children of the resource are assumed to be immutable.\n */\nint adjust_resource(struct resource *res, resource_size_t start, resource_size_t size)\n{\n\tstruct resource *tmp, *parent = res->parent;\n\tresource_size_t end = start + size - 1;\n\tint result = -EBUSY;\n\n\twrite_lock(&resource_lock);\n\n\tif ((start < parent->start) || (end > parent->end))\n\t\tgoto out;\n\n\tfor (tmp = res->child; tmp; tmp = tmp->sibling) {\n\t\tif ((tmp->start < start) || (tmp->end > end))\n\t\t\tgoto out;\n\t}\n\n\tif (res->sibling && (res->sibling->start <= end))\n\t\tgoto out;\n\n\ttmp = parent->child;\n\tif (tmp != res) {\n\t\twhile (tmp->sibling != res)\n\t\t\ttmp = tmp->sibling;\n\t\tif (start <= tmp->end)\n\t\t\tgoto out;\n\t}\n\n\tres->start = start;\n\tres->end = end;\n\tresult = 0;\n\n out:\n\twrite_unlock(&resource_lock);\n\treturn result;\n}\n\nEXPORT_SYMBOL(adjust_resource);\n\n/*\n * This is compatibility stuff for IO resources.\n *\n * Note how this, unlike the above, knows about\n * the IO flag meanings (busy etc).\n *\n * request_region creates a new busy region.\n *\n * check_region returns non-zero if the area is already busy.\n *\n * release_region releases a matching busy region.\n */\n\n/**\n * __request_region - create a new busy resource region\n * @parent: parent resource descriptor\n * @start: resource start address\n * @n: resource region size\n * @name: reserving caller's ID string\n */\nstruct resource * __request_region(struct resource *parent,\n\t\t\t\t resource_size_t start, resource_size_t n,\n\t\t\t\t const char *name)\n{\n\tstruct resource *res = kzalloc(sizeof(*res), GFP_KERNEL);\n\n\tif (res) {\n\t\tres->name = name;\n\t\tres->start = start;\n\t\tres->end = start + n - 1;\n\t\tres->flags = IORESOURCE_BUSY;\n\n\t\twrite_lock(&resource_lock);\n\n\t\tfor (;;) {\n\t\t\tstruct resource *conflict;\n\n\t\t\tconflict = __request_resource(parent, res);\n\t\t\tif (!conflict)\n\t\t\t\tbreak;\n\t\t\tif (conflict != parent) {\n\t\t\t\tparent = conflict;\n\t\t\t\tif (!(conflict->flags & IORESOURCE_BUSY))\n\t\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t/* Uhhuh, that didn't work out.. */\n\t\t\tkfree(res);\n\t\t\tres = NULL;\n\t\t\tbreak;\n\t\t}\n\t\twrite_unlock(&resource_lock);\n\t}\n\treturn res;\n}\nEXPORT_SYMBOL(__request_region);\n\n/**\n * __check_region - check if a resource region is busy or free\n * @parent: parent resource descriptor\n * @start: resource start address\n * @n: resource region size\n *\n * Returns 0 if the region is free at the moment it is checked,\n * returns %-EBUSY if the region is busy.\n *\n * NOTE:\n * This function is deprecated because its use is racy.\n * Even if it returns 0, a subsequent call to request_region()\n * may fail because another driver etc. just allocated the region.\n * Do NOT use it. It will be removed from the kernel.\n */\nint __check_region(struct resource *parent, resource_size_t start,\n\t\t\tresource_size_t n)\n{\n\tstruct resource * res;\n\n\tres = __request_region(parent, start, n, \"check-region\");\n\tif (!res)\n\t\treturn -EBUSY;\n\n\trelease_resource(res);\n\tkfree(res);\n\treturn 0;\n}\nEXPORT_SYMBOL(__check_region);\n\n/**\n * __release_region - release a previously reserved resource region\n * @parent: parent resource descriptor\n * @start: resource start address\n * @n: resource region size\n *\n * The described resource region must match a currently busy region.\n */\nvoid __release_region(struct resource *parent, resource_size_t start,\n\t\t\tresource_size_t n)\n{\n\tstruct resource **p;\n\tresource_size_t end;\n\n\tp = &parent->child;\n\tend = start + n - 1;\n\n\twrite_lock(&resource_lock);\n\n\tfor (;;) {\n\t\tstruct resource *res = *p;\n\n\t\tif (!res)\n\t\t\tbreak;\n\t\tif (res->start <= start && res->end >= end) {\n\t\t\tif (!(res->flags & IORESOURCE_BUSY)) {\n\t\t\t\tp = &res->child;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (res->start != start || res->end != end)\n\t\t\t\tbreak;\n\t\t\t*p = res->sibling;\n\t\t\twrite_unlock(&resource_lock);\n\t\t\tkfree(res);\n\t\t\treturn;\n\t\t}\n\t\tp = &res->sibling;\n\t}\n\n\twrite_unlock(&resource_lock);\n\n\tprintk(KERN_WARNING \"Trying to free nonexistent resource \"\n\t\t\"<%016llx-%016llx>\\n\", (unsigned long long)start,\n\t\t(unsigned long long)end);\n}\nEXPORT_SYMBOL(__release_region);\n\n/*\n * Managed region resource\n */\nstruct region_devres {\n\tstruct resource *parent;\n\tresource_size_t start;\n\tresource_size_t n;\n};\n\nstatic void devm_region_release(struct device *dev, void *res)\n{\n\tstruct region_devres *this = res;\n\n\t__release_region(this->parent, this->start, this->n);\n}\n\nstatic int devm_region_match(struct device *dev, void *res, void *match_data)\n{\n\tstruct region_devres *this = res, *match = match_data;\n\n\treturn this->parent == match->parent &&\n\t\tthis->start == match->start && this->n == match->n;\n}\n\nstruct resource * __devm_request_region(struct device *dev,\n\t\t\t\tstruct resource *parent, resource_size_t start,\n\t\t\t\tresource_size_t n, const char *name)\n{\n\tstruct region_devres *dr = NULL;\n\tstruct resource *res;\n\n\tdr = devres_alloc(devm_region_release, sizeof(struct region_devres),\n\t\t\t GFP_KERNEL);\n\tif (!dr)\n\t\treturn NULL;\n\n\tdr->parent = parent;\n\tdr->start = start;\n\tdr->n = n;\n\n\tres = __request_region(parent, start, n, name);\n\tif (res)\n\t\tdevres_add(dev, dr);\n\telse\n\t\tdevres_free(dr);\n\n\treturn res;\n}\nEXPORT_SYMBOL(__devm_request_region);\n\nvoid __devm_release_region(struct device *dev, struct resource *parent,\n\t\t\t resource_size_t start, resource_size_t n)\n{\n\tstruct region_devres match_data = { parent, start, n };\n\n\t__release_region(parent, start, n);\n\tWARN_ON(devres_destroy(dev, devm_region_release, devm_region_match,\n\t\t\t &match_data));\n}\nEXPORT_SYMBOL(__devm_release_region);\n\n/*\n * Called from init/main.c to reserve IO ports.\n */\n#define MAXRESERVE 4\nstatic int __init reserve_setup(char *str)\n{\n\tstatic int reserved;\n\tstatic struct resource reserve[MAXRESERVE];\n\n\tfor (;;) {\n\t\tint io_start, io_num;\n\t\tint x = reserved;\n\n\t\tif (get_option (&str, &io_start) != 2)\n\t\t\tbreak;\n\t\tif (get_option (&str, &io_num) == 0)\n\t\t\tbreak;\n\t\tif (x < MAXRESERVE) {\n\t\t\tstruct resource *res = reserve + x;\n\t\t\tres->name = \"reserved\";\n\t\t\tres->start = io_start;\n\t\t\tres->end = io_start + io_num - 1;\n\t\t\tres->flags = IORESOURCE_BUSY;\n\t\t\tres->child = NULL;\n\t\t\tif (request_resource(res->start >= 0x10000 ? &iomem_resource : &ioport_resource, res) == 0)\n\t\t\t\treserved = x+1;\n\t\t}\n\t}\n\treturn 1;\n}\n\n__setup(\"reserve=\", reserve_setup);\n/*\n * RT-Mutexes: simple blocking mutual exclusion locks with PI support\n *\n * started by Ingo Molnar and Thomas Gleixner.\n *\n * Copyright (C) 2004-2006 Red Hat, Inc., Ingo Molnar <mingo@redhat.com>\n * Copyright (C) 2005-2006 Timesys Corp., Thomas Gleixner <tglx@timesys.com>\n * Copyright (C) 2005 Kihon Technologies Inc., Steven Rostedt\n * Copyright (C) 2006 Esben Nielsen\n *\n * See Documentation/rt-mutex-design.txt for details.\n */\n#include <linux/spinlock.h>\n#include <linux/module.h>\n#include <linux/sched.h>\n#include <linux/timer.h>\n\n#include \"rtmutex_common.h\"\n\n#ifdef CONFIG_DEBUG_RT_MUTEXES\n# include \"rtmutex-debug.h\"\n#else\n# include \"rtmutex.h\"\n#endif\n\n/*\n * lock->owner state tracking:\n *\n * lock->owner holds the task_struct pointer of the owner. Bit 0 and 1\n * are used to keep track of the \"owner is pending\" and \"lock has\n * waiters\" state.\n *\n * owner\tbit1\tbit0\n * NULL\t\t0\t0\tlock is free (fast acquire possible)\n * NULL\t\t0\t1\tinvalid state\n * NULL\t\t1\t0\tTransitional State*\n * NULL\t\t1\t1\tinvalid state\n * taskpointer\t0\t0\tlock is held (fast release possible)\n * taskpointer\t0\t1\ttask is pending owner\n * taskpointer\t1\t0\tlock is held and has waiters\n * taskpointer\t1\t1\ttask is pending owner and lock has more waiters\n *\n * Pending ownership is assigned to the top (highest priority)\n * waiter of the lock, when the lock is released. The thread is woken\n * up and can now take the lock. Until the lock is taken (bit 0\n * cleared) a competing higher priority thread can steal the lock\n * which puts the woken up thread back on the waiters list.\n *\n * The fast atomic compare exchange based acquire and release is only\n * possible when bit 0 and 1 of lock->owner are 0.\n *\n * (*) There's a small time where the owner can be NULL and the\n * \"lock has waiters\" bit is set. This can happen when grabbing the lock.\n * To prevent a cmpxchg of the owner releasing the lock, we need to set this\n * bit before looking at the lock, hence the reason this is a transitional\n * state.\n */\n\nstatic void\nrt_mutex_set_owner(struct rt_mutex *lock, struct task_struct *owner,\n\t\t unsigned long mask)\n{\n\tunsigned long val = (unsigned long)owner | mask;\n\n\tif (rt_mutex_has_waiters(lock))\n\t\tval |= RT_MUTEX_HAS_WAITERS;\n\n\tlock->owner = (struct task_struct *)val;\n}\n\nstatic inline void clear_rt_mutex_waiters(struct rt_mutex *lock)\n{\n\tlock->owner = (struct task_struct *)\n\t\t\t((unsigned long)lock->owner & ~RT_MUTEX_HAS_WAITERS);\n}\n\nstatic void fixup_rt_mutex_waiters(struct rt_mutex *lock)\n{\n\tif (!rt_mutex_has_waiters(lock))\n\t\tclear_rt_mutex_waiters(lock);\n}\n\n/*\n * We can speed up the acquire/release, if the architecture\n * supports cmpxchg and if there's no debugging state to be set up\n */\n#if defined(__HAVE_ARCH_CMPXCHG) && !defined(CONFIG_DEBUG_RT_MUTEXES)\n# define rt_mutex_cmpxchg(l,c,n)\t(cmpxchg(&l->owner, c, n) == c)\nstatic inline void mark_rt_mutex_waiters(struct rt_mutex *lock)\n{\n\tunsigned long owner, *p = (unsigned long *) &lock->owner;\n\n\tdo {\n\t\towner = *p;\n\t} while (cmpxchg(p, owner, owner | RT_MUTEX_HAS_WAITERS) != owner);\n}\n#else\n# define rt_mutex_cmpxchg(l,c,n)\t(0)\nstatic inline void mark_rt_mutex_waiters(struct rt_mutex *lock)\n{\n\tlock->owner = (struct task_struct *)\n\t\t\t((unsigned long)lock->owner | RT_MUTEX_HAS_WAITERS);\n}\n#endif\n\n/*\n * Calculate task priority from the waiter list priority\n *\n * Return task->normal_prio when the waiter list is empty or when\n * the waiter is not allowed to do priority boosting\n */\nint rt_mutex_getprio(struct task_struct *task)\n{\n\tif (likely(!task_has_pi_waiters(task)))\n\t\treturn task->normal_prio;\n\n\treturn min(task_top_pi_waiter(task)->pi_list_entry.prio,\n\t\t task->normal_prio);\n}\n\n/*\n * Adjust the priority of a task, after its pi_waiters got modified.\n *\n * This can be both boosting and unboosting. task->pi_lock must be held.\n */\nstatic void __rt_mutex_adjust_prio(struct task_struct *task)\n{\n\tint prio = rt_mutex_getprio(task);\n\n\tif (task->prio != prio)\n\t\trt_mutex_setprio(task, prio);\n}\n\n/*\n * Adjust task priority (undo boosting). Called from the exit path of\n * rt_mutex_slowunlock() and rt_mutex_slowlock().\n *\n * (Note: We do this outside of the protection of lock->wait_lock to\n * allow the lock to be taken while or before we readjust the priority\n * of task. We do not use the spin_xx_mutex() variants here as we are\n * outside of the debug path.)\n */\nstatic void rt_mutex_adjust_prio(struct task_struct *task)\n{\n\tunsigned long flags;\n\n\tspin_lock_irqsave(&task->pi_lock, flags);\n\t__rt_mutex_adjust_prio(task);\n\tspin_unlock_irqrestore(&task->pi_lock, flags);\n}\n\n/*\n * Max number of times we'll walk the boosting chain:\n */\nint max_lock_depth = 1024;\n\n/*\n * Adjust the priority chain. Also used for deadlock detection.\n * Decreases task's usage by one - may thus free the task.\n * Returns 0 or -EDEADLK.\n */\nstatic int rt_mutex_adjust_prio_chain(struct task_struct *task,\n\t\t\t\t int deadlock_detect,\n\t\t\t\t struct rt_mutex *orig_lock,\n\t\t\t\t struct rt_mutex_waiter *orig_waiter,\n\t\t\t\t struct task_struct *top_task)\n{\n\tstruct rt_mutex *lock;\n\tstruct rt_mutex_waiter *waiter, *top_waiter = orig_waiter;\n\tint detect_deadlock, ret = 0, depth = 0;\n\tunsigned long flags;\n\n\tdetect_deadlock = debug_rt_mutex_detect_deadlock(orig_waiter,\n\t\t\t\t\t\t\t deadlock_detect);\n\n\t/*\n\t * The (de)boosting is a step by step approach with a lot of\n\t * pitfalls. We want this to be preemptible and we want hold a\n\t * maximum of two locks per step. So we have to check\n\t * carefully whether things change under us.\n\t */\n again:\n\tif (++depth > max_lock_depth) {\n\t\tstatic int prev_max;\n\n\t\t/*\n\t\t * Print this only once. If the admin changes the limit,\n\t\t * print a new message when reaching the limit again.\n\t\t */\n\t\tif (prev_max != max_lock_depth) {\n\t\t\tprev_max = max_lock_depth;\n\t\t\tprintk(KERN_WARNING \"Maximum lock depth %d reached \"\n\t\t\t \"task: %s (%d)\\n\", max_lock_depth,\n\t\t\t top_task->comm, top_task->pid);\n\t\t}\n\t\tput_task_struct(task);\n\n\t\treturn deadlock_detect ? -EDEADLK : 0;\n\t}\n retry:\n\t/*\n\t * Task can not go away as we did a get_task() before !\n\t */\n\tspin_lock_irqsave(&task->pi_lock, flags);\n\n\twaiter = task->pi_blocked_on;\n\t/*\n\t * Check whether the end of the boosting chain has been\n\t * reached or the state of the chain has changed while we\n\t * dropped the locks.\n\t */\n\tif (!waiter || !waiter->task)\n\t\tgoto out_unlock_pi;\n\n\t/*\n\t * Check the orig_waiter state. After we dropped the locks,\n\t * the previous owner of the lock might have released the lock\n\t * and made us the pending owner:\n\t */\n\tif (orig_waiter && !orig_waiter->task)\n\t\tgoto out_unlock_pi;\n\n\t/*\n\t * Drop out, when the task has no waiters. Note,\n\t * top_waiter can be NULL, when we are in the deboosting\n\t * mode!\n\t */\n\tif (top_waiter && (!task_has_pi_waiters(task) ||\n\t\t\t top_waiter != task_top_pi_waiter(task)))\n\t\tgoto out_unlock_pi;\n\n\t/*\n\t * When deadlock detection is off then we check, if further\n\t * priority adjustment is necessary.\n\t */\n\tif (!detect_deadlock && waiter->list_entry.prio == task->prio)\n\t\tgoto out_unlock_pi;\n\n\tlock = waiter->lock;\n\tif (!spin_trylock(&lock->wait_lock)) {\n\t\tspin_unlock_irqrestore(&task->pi_lock, flags);\n\t\tcpu_relax();\n\t\tgoto retry;\n\t}\n\n\t/* Deadlock detection */\n\tif (lock == orig_lock || rt_mutex_owner(lock) == top_task) {\n\t\tdebug_rt_mutex_deadlock(deadlock_detect, orig_waiter, lock);\n\t\tspin_unlock(&lock->wait_lock);\n\t\tret = deadlock_detect ? -EDEADLK : 0;\n\t\tgoto out_unlock_pi;\n\t}\n\n\ttop_waiter = rt_mutex_top_waiter(lock);\n\n\t/* Requeue the waiter */\n\tplist_del(&waiter->list_entry, &lock->wait_list);\n\twaiter->list_entry.prio = task->prio;\n\tplist_add(&waiter->list_entry, &lock->wait_list);\n\n\t/* Release the task */\n\tspin_unlock_irqrestore(&task->pi_lock, flags);\n\tput_task_struct(task);\n\n\t/* Grab the next task */\n\ttask = rt_mutex_owner(lock);\n\tget_task_struct(task);\n\tspin_lock_irqsave(&task->pi_lock, flags);\n\n\tif (waiter == rt_mutex_top_waiter(lock)) {\n\t\t/* Boost the owner */\n\t\tplist_del(&top_waiter->pi_list_entry, &task->pi_waiters);\n\t\twaiter->pi_list_entry.prio = waiter->list_entry.prio;\n\t\tplist_add(&waiter->pi_list_entry, &task->pi_waiters);\n\t\t__rt_mutex_adjust_prio(task);\n\n\t} else if (top_waiter == waiter) {\n\t\t/* Deboost the owner */\n\t\tplist_del(&waiter->pi_list_entry, &task->pi_waiters);\n\t\twaiter = rt_mutex_top_waiter(lock);\n\t\twaiter->pi_list_entry.prio = waiter->list_entry.prio;\n\t\tplist_add(&waiter->pi_list_entry, &task->pi_waiters);\n\t\t__rt_mutex_adjust_prio(task);\n\t}\n\n\tspin_unlock_irqrestore(&task->pi_lock, flags);\n\n\ttop_waiter = rt_mutex_top_waiter(lock);\n\tspin_unlock(&lock->wait_lock);\n\n\tif (!detect_deadlock && waiter != top_waiter)\n\t\tgoto out_put_task;\n\n\tgoto again;\n\n out_unlock_pi:\n\tspin_unlock_irqrestore(&task->pi_lock, flags);\n out_put_task:\n\tput_task_struct(task);\n\n\treturn ret;\n}\n\n/*\n * Optimization: check if we can steal the lock from the\n * assigned pending owner [which might not have taken the\n * lock yet]:\n */\nstatic inline int try_to_steal_lock(struct rt_mutex *lock)\n{\n\tstruct task_struct *pendowner = rt_mutex_owner(lock);\n\tstruct rt_mutex_waiter *next;\n\tunsigned long flags;\n\n\tif (!rt_mutex_owner_pending(lock))\n\t\treturn 0;\n\n\tif (pendowner == current)\n\t\treturn 1;\n\n\tspin_lock_irqsave(&pendowner->pi_lock, flags);\n\tif (current->prio >= pendowner->prio) {\n\t\tspin_unlock_irqrestore(&pendowner->pi_lock, flags);\n\t\treturn 0;\n\t}\n\n\t/*\n\t * Check if a waiter is enqueued on the pending owners\n\t * pi_waiters list. Remove it and readjust pending owners\n\t * priority.\n\t */\n\tif (likely(!rt_mutex_has_waiters(lock))) {\n\t\tspin_unlock_irqrestore(&pendowner->pi_lock, flags);\n\t\treturn 1;\n\t}\n\n\t/* No chain handling, pending owner is not blocked on anything: */\n\tnext = rt_mutex_top_waiter(lock);\n\tplist_del(&next->pi_list_entry, &pendowner->pi_waiters);\n\t__rt_mutex_adjust_prio(pendowner);\n\tspin_unlock_irqrestore(&pendowner->pi_lock, flags);\n\n\t/*\n\t * We are going to steal the lock and a waiter was\n\t * enqueued on the pending owners pi_waiters queue. So\n\t * we have to enqueue this waiter into\n\t * current->pi_waiters list. This covers the case,\n\t * where current is boosted because it holds another\n\t * lock and gets unboosted because the booster is\n\t * interrupted, so we would delay a waiter with higher\n\t * priority as current->normal_prio.\n\t *\n\t * Note: in the rare case of a SCHED_OTHER task changing\n\t * its priority and thus stealing the lock, next->task\n\t * might be current:\n\t */\n\tif (likely(next->task != current)) {\n\t\tspin_lock_irqsave(&current->pi_lock, flags);\n\t\tplist_add(&next->pi_list_entry, &current->pi_waiters);\n\t\t__rt_mutex_adjust_prio(current);\n\t\tspin_unlock_irqrestore(&current->pi_lock, flags);\n\t}\n\treturn 1;\n}\n\n/*\n * Try to take an rt-mutex\n *\n * This fails\n * - when the lock has a real owner\n * - when a different pending owner exists and has higher priority than current\n *\n * Must be called with lock->wait_lock held.\n */\nstatic int try_to_take_rt_mutex(struct rt_mutex *lock)\n{\n\t/*\n\t * We have to be careful here if the atomic speedups are\n\t * enabled, such that, when\n\t * - no other waiter is on the lock\n\t * - the lock has been released since we did the cmpxchg\n\t * the lock can be released or taken while we are doing the\n\t * checks and marking the lock with RT_MUTEX_HAS_WAITERS.\n\t *\n\t * The atomic acquire/release aware variant of\n\t * mark_rt_mutex_waiters uses a cmpxchg loop. After setting\n\t * the WAITERS bit, the atomic release / acquire can not\n\t * happen anymore and lock->wait_lock protects us from the\n\t * non-atomic case.\n\t *\n\t * Note, that this might set lock->owner =\n\t * RT_MUTEX_HAS_WAITERS in the case the lock is not contended\n\t * any more. This is fixed up when we take the ownership.\n\t * This is the transitional state explained at the top of this file.\n\t */\n\tmark_rt_mutex_waiters(lock);\n\n\tif (rt_mutex_owner(lock) && !try_to_steal_lock(lock))\n\t\treturn 0;\n\n\t/* We got the lock. */\n\tdebug_rt_mutex_lock(lock);\n\n\trt_mutex_set_owner(lock, current, 0);\n\n\trt_mutex_deadlock_account_lock(lock, current);\n\n\treturn 1;\n}\n\n/*\n * Task blocks on lock.\n *\n * Prepare waiter and propagate pi chain\n *\n * This must be called with lock->wait_lock held.\n */\nstatic int task_blocks_on_rt_mutex(struct rt_mutex *lock,\n\t\t\t\t struct rt_mutex_waiter *waiter,\n\t\t\t\t int detect_deadlock)\n{\n\tstruct task_struct *owner = rt_mutex_owner(lock);\n\tstruct rt_mutex_waiter *top_waiter = waiter;\n\tunsigned long flags;\n\tint chain_walk = 0, res;\n\n\tspin_lock_irqsave(&current->pi_lock, flags);\n\t__rt_mutex_adjust_prio(current);\n\twaiter->task = current;\n\twaiter->lock = lock;\n\tplist_node_init(&waiter->list_entry, current->prio);\n\tplist_node_init(&waiter->pi_list_entry, current->prio);\n\n\t/* Get the top priority waiter on the lock */\n\tif (rt_mutex_has_waiters(lock))\n\t\ttop_waiter = rt_mutex_top_waiter(lock);\n\tplist_add(&waiter->list_entry, &lock->wait_list);\n\n\tcurrent->pi_blocked_on = waiter;\n\n\tspin_unlock_irqrestore(&current->pi_lock, flags);\n\n\tif (waiter == rt_mutex_top_waiter(lock)) {\n\t\tspin_lock_irqsave(&owner->pi_lock, flags);\n\t\tplist_del(&top_waiter->pi_list_entry, &owner->pi_waiters);\n\t\tplist_add(&waiter->pi_list_entry, &owner->pi_waiters);\n\n\t\t__rt_mutex_adjust_prio(owner);\n\t\tif (owner->pi_blocked_on)\n\t\t\tchain_walk = 1;\n\t\tspin_unlock_irqrestore(&owner->pi_lock, flags);\n\t}\n\telse if (debug_rt_mutex_detect_deadlock(waiter, detect_deadlock))\n\t\tchain_walk = 1;\n\n\tif (!chain_walk)\n\t\treturn 0;\n\n\t/*\n\t * The owner can't disappear while holding a lock,\n\t * so the owner struct is protected by wait_lock.\n\t * Gets dropped in rt_mutex_adjust_prio_chain()!\n\t */\n\tget_task_struct(owner);\n\n\tspin_unlock(&lock->wait_lock);\n\n\tres = rt_mutex_adjust_prio_chain(owner, detect_deadlock, lock, waiter,\n\t\t\t\t\t current);\n\n\tspin_lock(&lock->wait_lock);\n\n\treturn res;\n}\n\n/*\n * Wake up the next waiter on the lock.\n *\n * Remove the top waiter from the current tasks waiter list and from\n * the lock waiter list. Set it as pending owner. Then wake it up.\n *\n * Called with lock->wait_lock held.\n */\nstatic void wakeup_next_waiter(struct rt_mutex *lock)\n{\n\tstruct rt_mutex_waiter *waiter;\n\tstruct task_struct *pendowner;\n\tunsigned long flags;\n\n\tspin_lock_irqsave(&current->pi_lock, flags);\n\n\twaiter = rt_mutex_top_waiter(lock);\n\tplist_del(&waiter->list_entry, &lock->wait_list);\n\n\t/*\n\t * Remove it from current->pi_waiters. We do not adjust a\n\t * possible priority boost right now. We execute wakeup in the\n\t * boosted mode and go back to normal after releasing\n\t * lock->wait_lock.\n\t */\n\tplist_del(&waiter->pi_list_entry, &current->pi_waiters);\n\tpendowner = waiter->task;\n\twaiter->task = NULL;\n\n\trt_mutex_set_owner(lock, pendowner, RT_MUTEX_OWNER_PENDING);\n\n\tspin_unlock_irqrestore(&current->pi_lock, flags);\n\n\t/*\n\t * Clear the pi_blocked_on variable and enqueue a possible\n\t * waiter into the pi_waiters list of the pending owner. This\n\t * prevents that in case the pending owner gets unboosted a\n\t * waiter with higher priority than pending-owner->normal_prio\n\t * is blocked on the unboosted (pending) owner.\n\t */\n\tspin_lock_irqsave(&pendowner->pi_lock, flags);\n\n\tWARN_ON(!pendowner->pi_blocked_on);\n\tWARN_ON(pendowner->pi_blocked_on != waiter);\n\tWARN_ON(pendowner->pi_blocked_on->lock != lock);\n\n\tpendowner->pi_blocked_on = NULL;\n\n\tif (rt_mutex_has_waiters(lock)) {\n\t\tstruct rt_mutex_waiter *next;\n\n\t\tnext = rt_mutex_top_waiter(lock);\n\t\tplist_add(&next->pi_list_entry, &pendowner->pi_waiters);\n\t}\n\tspin_unlock_irqrestore(&pendowner->pi_lock, flags);\n\n\twake_up_process(pendowner);\n}\n\n/*\n * Remove a waiter from a lock\n *\n * Must be called with lock->wait_lock held\n */\nstatic void remove_waiter(struct rt_mutex *lock,\n\t\t\t struct rt_mutex_waiter *waiter)\n{\n\tint first = (waiter == rt_mutex_top_waiter(lock));\n\tstruct task_struct *owner = rt_mutex_owner(lock);\n\tunsigned long flags;\n\tint chain_walk = 0;\n\n\tspin_lock_irqsave(&current->pi_lock, flags);\n\tplist_del(&waiter->list_entry, &lock->wait_list);\n\twaiter->task = NULL;\n\tcurrent->pi_blocked_on = NULL;\n\tspin_unlock_irqrestore(&current->pi_lock, flags);\n\n\tif (first && owner != current) {\n\n\t\tspin_lock_irqsave(&owner->pi_lock, flags);\n\n\t\tplist_del(&waiter->pi_list_entry, &owner->pi_waiters);\n\n\t\tif (rt_mutex_has_waiters(lock)) {\n\t\t\tstruct rt_mutex_waiter *next;\n\n\t\t\tnext = rt_mutex_top_waiter(lock);\n\t\t\tplist_add(&next->pi_list_entry, &owner->pi_waiters);\n\t\t}\n\t\t__rt_mutex_adjust_prio(owner);\n\n\t\tif (owner->pi_blocked_on)\n\t\t\tchain_walk = 1;\n\n\t\tspin_unlock_irqrestore(&owner->pi_lock, flags);\n\t}\n\n\tWARN_ON(!plist_node_empty(&waiter->pi_list_entry));\n\n\tif (!chain_walk)\n\t\treturn;\n\n\t/* gets dropped in rt_mutex_adjust_prio_chain()! */\n\tget_task_struct(owner);\n\n\tspin_unlock(&lock->wait_lock);\n\n\trt_mutex_adjust_prio_chain(owner, 0, lock, NULL, current);\n\n\tspin_lock(&lock->wait_lock);\n}\n\n/*\n * Recheck the pi chain, in case we got a priority setting\n *\n * Called from sched_setscheduler\n */\nvoid rt_mutex_adjust_pi(struct task_struct *task)\n{\n\tstruct rt_mutex_waiter *waiter;\n\tunsigned long flags;\n\n\tspin_lock_irqsave(&task->pi_lock, flags);\n\n\twaiter = task->pi_blocked_on;\n\tif (!waiter || waiter->list_entry.prio == task->prio) {\n\t\tspin_unlock_irqrestore(&task->pi_lock, flags);\n\t\treturn;\n\t}\n\n\tspin_unlock_irqrestore(&task->pi_lock, flags);\n\n\t/* gets dropped in rt_mutex_adjust_prio_chain()! */\n\tget_task_struct(task);\n\trt_mutex_adjust_prio_chain(task, 0, NULL, NULL, task);\n}\n\n/*\n * Slow path lock function:\n */\nstatic int __sched\nrt_mutex_slowlock(struct rt_mutex *lock, int state,\n\t\t struct hrtimer_sleeper *timeout,\n\t\t int detect_deadlock)\n{\n\tstruct rt_mutex_waiter waiter;\n\tint ret = 0;\n\n\tdebug_rt_mutex_init_waiter(&waiter);\n\twaiter.task = NULL;\n\n\tspin_lock(&lock->wait_lock);\n\n\t/* Try to acquire the lock again: */\n\tif (try_to_take_rt_mutex(lock)) {\n\t\tspin_unlock(&lock->wait_lock);\n\t\treturn 0;\n\t}\n\n\tset_current_state(state);\n\n\t/* Setup the timer, when timeout != NULL */\n\tif (unlikely(timeout))\n\t\thrtimer_start(&timeout->timer, timeout->timer.expires,\n\t\t\t HRTIMER_MODE_ABS);\n\n\tfor (;;) {\n\t\t/* Try to acquire the lock: */\n\t\tif (try_to_take_rt_mutex(lock))\n\t\t\tbreak;\n\n\t\t/*\n\t\t * TASK_INTERRUPTIBLE checks for signals and\n\t\t * timeout. Ignored otherwise.\n\t\t */\n\t\tif (unlikely(state == TASK_INTERRUPTIBLE)) {\n\t\t\t/* Signal pending? */\n\t\t\tif (signal_pending(current))\n\t\t\t\tret = -EINTR;\n\t\t\tif (timeout && !timeout->task)\n\t\t\t\tret = -ETIMEDOUT;\n\t\t\tif (ret)\n\t\t\t\tbreak;\n\t\t}\n\n\t\t/*\n\t\t * waiter.task is NULL the first time we come here and\n\t\t * when we have been woken up by the previous owner\n\t\t * but the lock got stolen by a higher prio task.\n\t\t */\n\t\tif (!waiter.task) {\n\t\t\tret = task_blocks_on_rt_mutex(lock, &waiter,\n\t\t\t\t\t\t detect_deadlock);\n\t\t\t/*\n\t\t\t * If we got woken up by the owner then start loop\n\t\t\t * all over without going into schedule to try\n\t\t\t * to get the lock now:\n\t\t\t */\n\t\t\tif (unlikely(!waiter.task)) {\n\t\t\t\t/*\n\t\t\t\t * Reset the return value. We might\n\t\t\t\t * have returned with -EDEADLK and the\n\t\t\t\t * owner released the lock while we\n\t\t\t\t * were walking the pi chain.\n\t\t\t\t */\n\t\t\t\tret = 0;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (unlikely(ret))\n\t\t\t\tbreak;\n\t\t}\n\n\t\tspin_unlock(&lock->wait_lock);\n\n\t\tdebug_rt_mutex_print_deadlock(&waiter);\n\n\t\tif (waiter.task)\n\t\t\tschedule_rt_mutex(lock);\n\n\t\tspin_lock(&lock->wait_lock);\n\t\tset_current_state(state);\n\t}\n\n\tset_current_state(TASK_RUNNING);\n\n\tif (unlikely(waiter.task))\n\t\tremove_waiter(lock, &waiter);\n\n\t/*\n\t * try_to_take_rt_mutex() sets the waiter bit\n\t * unconditionally. We might have to fix that up.\n\t */\n\tfixup_rt_mutex_waiters(lock);\n\n\tspin_unlock(&lock->wait_lock);\n\n\t/* Remove pending timer: */\n\tif (unlikely(timeout))\n\t\thrtimer_cancel(&timeout->timer);\n\n\t/*\n\t * Readjust priority, when we did not get the lock. We might\n\t * have been the pending owner and boosted. Since we did not\n\t * take the lock, the PI boost has to go.\n\t */\n\tif (unlikely(ret))\n\t\trt_mutex_adjust_prio(current);\n\n\tdebug_rt_mutex_free_waiter(&waiter);\n\n\treturn ret;\n}\n\n/*\n * Slow path try-lock function:\n */\nstatic inline int\nrt_mutex_slowtrylock(struct rt_mutex *lock)\n{\n\tint ret = 0;\n\n\tspin_lock(&lock->wait_lock);\n\n\tif (likely(rt_mutex_owner(lock) != current)) {\n\n\t\tret = try_to_take_rt_mutex(lock);\n\t\t/*\n\t\t * try_to_take_rt_mutex() sets the lock waiters\n\t\t * bit unconditionally. Clean this up.\n\t\t */\n\t\tfixup_rt_mutex_waiters(lock);\n\t}\n\n\tspin_unlock(&lock->wait_lock);\n\n\treturn ret;\n}\n\n/*\n * Slow path to release a rt-mutex:\n */\nstatic void __sched\nrt_mutex_slowunlock(struct rt_mutex *lock)\n{\n\tspin_lock(&lock->wait_lock);\n\n\tdebug_rt_mutex_unlock(lock);\n\n\trt_mutex_deadlock_account_unlock(current);\n\n\tif (!rt_mutex_has_waiters(lock)) {\n\t\tlock->owner = NULL;\n\t\tspin_unlock(&lock->wait_lock);\n\t\treturn;\n\t}\n\n\twakeup_next_waiter(lock);\n\n\tspin_unlock(&lock->wait_lock);\n\n\t/* Undo pi boosting if necessary: */\n\trt_mutex_adjust_prio(current);\n}\n\n/*\n * debug aware fast / slowpath lock,trylock,unlock\n *\n * The atomic acquire/release ops are compiled away, when either the\n * architecture does not support cmpxchg or when debugging is enabled.\n */\nstatic inline int\nrt_mutex_fastlock(struct rt_mutex *lock, int state,\n\t\t int detect_deadlock,\n\t\t int (*slowfn)(struct rt_mutex *lock, int state,\n\t\t\t\tstruct hrtimer_sleeper *timeout,\n\t\t\t\tint detect_deadlock))\n{\n\tif (!detect_deadlock && likely(rt_mutex_cmpxchg(lock, NULL, current))) {\n\t\trt_mutex_deadlock_account_lock(lock, current);\n\t\treturn 0;\n\t} else\n\t\treturn slowfn(lock, state, NULL, detect_deadlock);\n}\n\nstatic inline int\nrt_mutex_timed_fastlock(struct rt_mutex *lock, int state,\n\t\t\tstruct hrtimer_sleeper *timeout, int detect_deadlock,\n\t\t\tint (*slowfn)(struct rt_mutex *lock, int state,\n\t\t\t\t struct hrtimer_sleeper *timeout,\n\t\t\t\t int detect_deadlock))\n{\n\tif (!detect_deadlock && likely(rt_mutex_cmpxchg(lock, NULL, current))) {\n\t\trt_mutex_deadlock_account_lock(lock, current);\n\t\treturn 0;\n\t} else\n\t\treturn slowfn(lock, state, timeout, detect_deadlock);\n}\n\nstatic inline int\nrt_mutex_fasttrylock(struct rt_mutex *lock,\n\t\t int (*slowfn)(struct rt_mutex *lock))\n{\n\tif (likely(rt_mutex_cmpxchg(lock, NULL, current))) {\n\t\trt_mutex_deadlock_account_lock(lock, current);\n\t\treturn 1;\n\t}\n\treturn slowfn(lock);\n}\n\nstatic inline void\nrt_mutex_fastunlock(struct rt_mutex *lock,\n\t\t void (*slowfn)(struct rt_mutex *lock))\n{\n\tif (likely(rt_mutex_cmpxchg(lock, current, NULL)))\n\t\trt_mutex_deadlock_account_unlock(current);\n\telse\n\t\tslowfn(lock);\n}\n\n/**\n * rt_mutex_lock - lock a rt_mutex\n *\n * @lock: the rt_mutex to be locked\n */\nvoid __sched rt_mutex_lock(struct rt_mutex *lock)\n{\n\tmight_sleep();\n\n\trt_mutex_fastlock(lock, TASK_UNINTERRUPTIBLE, 0, rt_mutex_slowlock);\n}\nEXPORT_SYMBOL_GPL(rt_mutex_lock);\n\n/**\n * rt_mutex_lock_interruptible - lock a rt_mutex interruptible\n *\n * @lock: \t\tthe rt_mutex to be locked\n * @detect_deadlock:\tdeadlock detection on/off\n *\n * Returns:\n * 0 \t\ton success\n * -EINTR \twhen interrupted by a signal\n * -EDEADLK\twhen the lock would deadlock (when deadlock detection is on)\n */\nint __sched rt_mutex_lock_interruptible(struct rt_mutex *lock,\n\t\t\t\t\t\t int detect_deadlock)\n{\n\tmight_sleep();\n\n\treturn rt_mutex_fastlock(lock, TASK_INTERRUPTIBLE,\n\t\t\t\t detect_deadlock, rt_mutex_slowlock);\n}\nEXPORT_SYMBOL_GPL(rt_mutex_lock_interruptible);\n\n/**\n * rt_mutex_lock_interruptible_ktime - lock a rt_mutex interruptible\n *\t\t\t\t the timeout structure is provided\n *\t\t\t\t by the caller\n *\n * @lock: \t\tthe rt_mutex to be locked\n * @timeout:\t\ttimeout structure or NULL (no timeout)\n * @detect_deadlock:\tdeadlock detection on/off\n *\n * Returns:\n * 0 \t\ton success\n * -EINTR \twhen interrupted by a signal\n * -ETIMEOUT\twhen the timeout expired\n * -EDEADLK\twhen the lock would deadlock (when deadlock detection is on)\n */\nint\nrt_mutex_timed_lock(struct rt_mutex *lock, struct hrtimer_sleeper *timeout,\n\t\t int detect_deadlock)\n{\n\tmight_sleep();\n\n\treturn rt_mutex_timed_fastlock(lock, TASK_INTERRUPTIBLE, timeout,\n\t\t\t\t detect_deadlock, rt_mutex_slowlock);\n}\nEXPORT_SYMBOL_GPL(rt_mutex_timed_lock);\n\n/**\n * rt_mutex_trylock - try to lock a rt_mutex\n *\n * @lock:\tthe rt_mutex to be locked\n *\n * Returns 1 on success and 0 on contention\n */\nint __sched rt_mutex_trylock(struct rt_mutex *lock)\n{\n\treturn rt_mutex_fasttrylock(lock, rt_mutex_slowtrylock);\n}\nEXPORT_SYMBOL_GPL(rt_mutex_trylock);\n\n/**\n * rt_mutex_unlock - unlock a rt_mutex\n *\n * @lock: the rt_mutex to be unlocked\n */\nvoid __sched rt_mutex_unlock(struct rt_mutex *lock)\n{\n\trt_mutex_fastunlock(lock, rt_mutex_slowunlock);\n}\nEXPORT_SYMBOL_GPL(rt_mutex_unlock);\n\n/***\n * rt_mutex_destroy - mark a mutex unusable\n * @lock: the mutex to be destroyed\n *\n * This function marks the mutex uninitialized, and any subsequent\n * use of the mutex is forbidden. The mutex must not be locked when\n * this function is called.\n */\nvoid rt_mutex_destroy(struct rt_mutex *lock)\n{\n\tWARN_ON(rt_mutex_is_locked(lock));\n#ifdef CONFIG_DEBUG_RT_MUTEXES\n\tlock->magic = NULL;\n#endif\n}\n\nEXPORT_SYMBOL_GPL(rt_mutex_destroy);\n\n/**\n * __rt_mutex_init - initialize the rt lock\n *\n * @lock: the rt lock to be initialized\n *\n * Initialize the rt lock to unlocked state.\n *\n * Initializing of a locked rt lock is not allowed\n */\nvoid __rt_mutex_init(struct rt_mutex *lock, const char *name)\n{\n\tlock->owner = NULL;\n\tspin_lock_init(&lock->wait_lock);\n\tplist_head_init(&lock->wait_list, &lock->wait_lock);\n\n\tdebug_rt_mutex_init(lock, name);\n}\nEXPORT_SYMBOL_GPL(__rt_mutex_init);\n\n/**\n * rt_mutex_init_proxy_locked - initialize and lock a rt_mutex on behalf of a\n *\t\t\t\tproxy owner\n *\n * @lock: \tthe rt_mutex to be locked\n * @proxy_owner:the task to set as owner\n *\n * No locking. Caller has to do serializing itself\n * Special API call for PI-futex support\n */\nvoid rt_mutex_init_proxy_locked(struct rt_mutex *lock,\n\t\t\t\tstruct task_struct *proxy_owner)\n{\n\t__rt_mutex_init(lock, NULL);\n\tdebug_rt_mutex_proxy_lock(lock, proxy_owner);\n\trt_mutex_set_owner(lock, proxy_owner, 0);\n\trt_mutex_deadlock_account_lock(lock, proxy_owner);\n}\n\n/**\n * rt_mutex_proxy_unlock - release a lock on behalf of owner\n *\n * @lock: \tthe rt_mutex to be locked\n *\n * No locking. Caller has to do serializing itself\n * Special API call for PI-futex support\n */\nvoid rt_mutex_proxy_unlock(struct rt_mutex *lock,\n\t\t\t struct task_struct *proxy_owner)\n{\n\tdebug_rt_mutex_proxy_unlock(lock);\n\trt_mutex_set_owner(lock, NULL, 0);\n\trt_mutex_deadlock_account_unlock(proxy_owner);\n}\n\n/**\n * rt_mutex_next_owner - return the next owner of the lock\n *\n * @lock: the rt lock query\n *\n * Returns the next owner of the lock or NULL\n *\n * Caller has to serialize against other accessors to the lock\n * itself.\n *\n * Special API call for PI-futex support\n */\nstruct task_struct *rt_mutex_next_owner(struct rt_mutex *lock)\n{\n\tif (!rt_mutex_has_waiters(lock))\n\t\treturn NULL;\n\n\treturn rt_mutex_top_waiter(lock)->task;\n}\n/*\n * RT-Mutexes: blocking mutual exclusion locks with PI support\n *\n * started by Ingo Molnar and Thomas Gleixner:\n *\n * Copyright (C) 2004-2006 Red Hat, Inc., Ingo Molnar <mingo@redhat.com>\n * Copyright (C) 2006 Timesys Corp., Thomas Gleixner <tglx@timesys.com>\n *\n * This code is based on the rt.c implementation in the preempt-rt tree.\n * Portions of said code are\n *\n * Copyright (C) 2004 LynuxWorks, Inc., Igor Manyilov, Bill Huey\n * Copyright (C) 2006 Esben Nielsen\n * Copyright (C) 2006 Kihon Technologies Inc.,\n *\t\t\tSteven Rostedt <rostedt@goodmis.org>\n *\n * See rt.c in preempt-rt for proper credits and further information\n */\n#include <linux/sched.h>\n#include <linux/delay.h>\n#include <linux/module.h>\n#include <linux/spinlock.h>\n#include <linux/kallsyms.h>\n#include <linux/syscalls.h>\n#include <linux/interrupt.h>\n#include <linux/plist.h>\n#include <linux/fs.h>\n#include <linux/debug_locks.h>\n\n#include \"rtmutex_common.h\"\n\n#ifdef CONFIG_DEBUG_RT_MUTEXES\n# include \"rtmutex-debug.h\"\n#else\n# include \"rtmutex.h\"\n#endif\n\n# define TRACE_WARN_ON(x)\t\t\tWARN_ON(x)\n# define TRACE_BUG_ON(x)\t\t\tBUG_ON(x)\n\n# define TRACE_OFF()\t\t\t\t\t\t\\\ndo {\t\t\t\t\t\t\t\t\\\n\tif (rt_trace_on) {\t\t\t\t\t\\\n\t\trt_trace_on = 0;\t\t\t\t\\\n\t\tconsole_verbose();\t\t\t\t\\\n\t\tif (spin_is_locked(&current->pi_lock))\t\t\\\n\t\t\tspin_unlock(&current->pi_lock);\t\t\\\n\t}\t\t\t\t\t\t\t\\\n} while (0)\n\n# define TRACE_OFF_NOLOCK()\t\t\t\t\t\\\ndo {\t\t\t\t\t\t\t\t\\\n\tif (rt_trace_on) {\t\t\t\t\t\\\n\t\trt_trace_on = 0;\t\t\t\t\\\n\t\tconsole_verbose();\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\\\n} while (0)\n\n# define TRACE_BUG_LOCKED()\t\t\t\\\ndo {\t\t\t\t\t\t\\\n\tTRACE_OFF();\t\t\t\t\\\n\tBUG();\t\t\t\t\t\\\n} while (0)\n\n# define TRACE_WARN_ON_LOCKED(c)\t\t\\\ndo {\t\t\t\t\t\t\\\n\tif (unlikely(c)) {\t\t\t\\\n\t\tTRACE_OFF();\t\t\t\\\n\t\tWARN_ON(1);\t\t\t\\\n\t}\t\t\t\t\t\\\n} while (0)\n\n# define TRACE_BUG_ON_LOCKED(c)\t\t\t\\\ndo {\t\t\t\t\t\t\\\n\tif (unlikely(c))\t\t\t\\\n\t\tTRACE_BUG_LOCKED();\t\t\\\n} while (0)\n\n#ifdef CONFIG_SMP\n# define SMP_TRACE_BUG_ON_LOCKED(c)\tTRACE_BUG_ON_LOCKED(c)\n#else\n# define SMP_TRACE_BUG_ON_LOCKED(c)\tdo { } while (0)\n#endif\n\n/*\n * deadlock detection flag. We turn it off when we detect\n * the first problem because we dont want to recurse back\n * into the tracing code when doing error printk or\n * executing a BUG():\n */\nint rt_trace_on = 1;\n\nvoid deadlock_trace_off(void)\n{\n\trt_trace_on = 0;\n}\n\nstatic void printk_task(struct task_struct *p)\n{\n\tif (p)\n\t\tprintk(\"%16s:%5d [%p, %3d]\", p->comm, p->pid, p, p->prio);\n\telse\n\t\tprintk(\"<none>\");\n}\n\nstatic void printk_lock(struct rt_mutex *lock, int print_owner)\n{\n\tif (lock->name)\n\t\tprintk(\" [%p] {%s}\\n\",\n\t\t\tlock, lock->name);\n\telse\n\t\tprintk(\" [%p] {%s:%d}\\n\",\n\t\t\tlock, lock->file, lock->line);\n\n\tif (print_owner && rt_mutex_owner(lock)) {\n\t\tprintk(\".. ->owner: %p\\n\", lock->owner);\n\t\tprintk(\".. held by: \");\n\t\tprintk_task(rt_mutex_owner(lock));\n\t\tprintk(\"\\n\");\n\t}\n}\n\nvoid rt_mutex_debug_task_free(struct task_struct *task)\n{\n\tWARN_ON(!plist_head_empty(&task->pi_waiters));\n\tWARN_ON(task->pi_blocked_on);\n}\n\n/*\n * We fill out the fields in the waiter to store the information about\n * the deadlock. We print when we return. act_waiter can be NULL in\n * case of a remove waiter operation.\n */\nvoid debug_rt_mutex_deadlock(int detect, struct rt_mutex_waiter *act_waiter,\n\t\t\t struct rt_mutex *lock)\n{\n\tstruct task_struct *task;\n\n\tif (!rt_trace_on || detect || !act_waiter)\n\t\treturn;\n\n\ttask = rt_mutex_owner(act_waiter->lock);\n\tif (task && task != current) {\n\t\tact_waiter->deadlock_task_pid = task->pid;\n\t\tact_waiter->deadlock_lock = lock;\n\t}\n}\n\nvoid debug_rt_mutex_print_deadlock(struct rt_mutex_waiter *waiter)\n{\n\tstruct task_struct *task;\n\n\tif (!waiter->deadlock_lock || !rt_trace_on)\n\t\treturn;\n\n\ttask = find_task_by_pid(waiter->deadlock_task_pid);\n\tif (!task)\n\t\treturn;\n\n\tTRACE_OFF_NOLOCK();\n\n\tprintk(\"\\n============================================\\n\");\n\tprintk( \"[ BUG: circular locking deadlock detected! ]\\n\");\n\tprintk( \"--------------------------------------------\\n\");\n\tprintk(\"%s/%d is deadlocking current task %s/%d\\n\\n\",\n\t task->comm, task->pid, current->comm, current->pid);\n\n\tprintk(\"\\n1) %s/%d is trying to acquire this lock:\\n\",\n\t current->comm, current->pid);\n\tprintk_lock(waiter->lock, 1);\n\n\tprintk(\"\\n2) %s/%d is blocked on this lock:\\n\", task->comm, task->pid);\n\tprintk_lock(waiter->deadlock_lock, 1);\n\n\tdebug_show_held_locks(current);\n\tdebug_show_held_locks(task);\n\n\tprintk(\"\\n%s/%d's [blocked] stackdump:\\n\\n\", task->comm, task->pid);\n\tshow_stack(task, NULL);\n\tprintk(\"\\n%s/%d's [current] stackdump:\\n\\n\",\n\t current->comm, current->pid);\n\tdump_stack();\n\tdebug_show_all_locks();\n\n\tprintk(\"[ turning off deadlock detection.\"\n\t \"Please report this trace. ]\\n\\n\");\n\tlocal_irq_disable();\n}\n\nvoid debug_rt_mutex_lock(struct rt_mutex *lock)\n{\n}\n\nvoid debug_rt_mutex_unlock(struct rt_mutex *lock)\n{\n\tTRACE_WARN_ON_LOCKED(rt_mutex_owner(lock) != current);\n}\n\nvoid\ndebug_rt_mutex_proxy_lock(struct rt_mutex *lock, struct task_struct *powner)\n{\n}\n\nvoid debug_rt_mutex_proxy_unlock(struct rt_mutex *lock)\n{\n\tTRACE_WARN_ON_LOCKED(!rt_mutex_owner(lock));\n}\n\nvoid debug_rt_mutex_init_waiter(struct rt_mutex_waiter *waiter)\n{\n\tmemset(waiter, 0x11, sizeof(*waiter));\n\tplist_node_init(&waiter->list_entry, MAX_PRIO);\n\tplist_node_init(&waiter->pi_list_entry, MAX_PRIO);\n}\n\nvoid debug_rt_mutex_free_waiter(struct rt_mutex_waiter *waiter)\n{\n\tTRACE_WARN_ON(!plist_node_empty(&waiter->list_entry));\n\tTRACE_WARN_ON(!plist_node_empty(&waiter->pi_list_entry));\n\tTRACE_WARN_ON(waiter->task);\n\tmemset(waiter, 0x22, sizeof(*waiter));\n}\n\nvoid debug_rt_mutex_init(struct rt_mutex *lock, const char *name)\n{\n\t/*\n\t * Make sure we are not reinitializing a held lock:\n\t */\n\tdebug_check_no_locks_freed((void *)lock, sizeof(*lock));\n\tlock->name = name;\n}\n\nvoid\nrt_mutex_deadlock_account_lock(struct rt_mutex *lock, struct task_struct *task)\n{\n}\n\nvoid rt_mutex_deadlock_account_unlock(struct task_struct *task)\n{\n}\n\n/*\n * RT-Mutex-tester: scriptable tester for rt mutexes\n *\n * started by Thomas Gleixner:\n *\n * Copyright (C) 2006, Timesys Corp., Thomas Gleixner <tglx@timesys.com>\n *\n */\n#include <linux/kthread.h>\n#include <linux/module.h>\n#include <linux/sched.h>\n#include <linux/smp_lock.h>\n#include <linux/spinlock.h>\n#include <linux/sysdev.h>\n#include <linux/timer.h>\n#include <linux/freezer.h>\n\n#include \"rtmutex.h\"\n\n#define MAX_RT_TEST_THREADS\t8\n#define MAX_RT_TEST_MUTEXES\t8\n\nstatic spinlock_t rttest_lock;\nstatic atomic_t rttest_event;\n\nstruct test_thread_data {\n\tint\t\t\topcode;\n\tint\t\t\topdata;\n\tint\t\t\tmutexes[MAX_RT_TEST_MUTEXES];\n\tint\t\t\tbkl;\n\tint\t\t\tevent;\n\tstruct sys_device\tsysdev;\n};\n\nstatic struct test_thread_data thread_data[MAX_RT_TEST_THREADS];\nstatic struct task_struct *threads[MAX_RT_TEST_THREADS];\nstatic struct rt_mutex mutexes[MAX_RT_TEST_MUTEXES];\n\nenum test_opcodes {\n\tRTTEST_NOP = 0,\n\tRTTEST_SCHEDOT,\t\t/* 1 Sched other, data = nice */\n\tRTTEST_SCHEDRT,\t\t/* 2 Sched fifo, data = prio */\n\tRTTEST_LOCK,\t\t/* 3 Lock uninterruptible, data = lockindex */\n\tRTTEST_LOCKNOWAIT,\t/* 4 Lock uninterruptible no wait in wakeup, data = lockindex */\n\tRTTEST_LOCKINT,\t\t/* 5 Lock interruptible, data = lockindex */\n\tRTTEST_LOCKINTNOWAIT,\t/* 6 Lock interruptible no wait in wakeup, data = lockindex */\n\tRTTEST_LOCKCONT,\t/* 7 Continue locking after the wakeup delay */\n\tRTTEST_UNLOCK,\t\t/* 8 Unlock, data = lockindex */\n\tRTTEST_LOCKBKL,\t\t/* 9 Lock BKL */\n\tRTTEST_UNLOCKBKL,\t/* 10 Unlock BKL */\n\tRTTEST_SIGNAL,\t\t/* 11 Signal other test thread, data = thread id */\n\tRTTEST_RESETEVENT = 98,\t/* 98 Reset event counter */\n\tRTTEST_RESET = 99,\t/* 99 Reset all pending operations */\n};\n\nstatic int handle_op(struct test_thread_data *td, int lockwakeup)\n{\n\tint i, id, ret = -EINVAL;\n\n\tswitch(td->opcode) {\n\n\tcase RTTEST_NOP:\n\t\treturn 0;\n\n\tcase RTTEST_LOCKCONT:\n\t\ttd->mutexes[td->opdata] = 1;\n\t\ttd->event = atomic_add_return(1, &rttest_event);\n\t\treturn 0;\n\n\tcase RTTEST_RESET:\n\t\tfor (i = 0; i < MAX_RT_TEST_MUTEXES; i++) {\n\t\t\tif (td->mutexes[i] == 4) {\n\t\t\t\trt_mutex_unlock(&mutexes[i]);\n\t\t\t\ttd->mutexes[i] = 0;\n\t\t\t}\n\t\t}\n\n\t\tif (!lockwakeup && td->bkl == 4) {\n\t\t\tunlock_kernel();\n\t\t\ttd->bkl = 0;\n\t\t}\n\t\treturn 0;\n\n\tcase RTTEST_RESETEVENT:\n\t\tatomic_set(&rttest_event, 0);\n\t\treturn 0;\n\n\tdefault:\n\t\tif (lockwakeup)\n\t\t\treturn ret;\n\t}\n\n\tswitch(td->opcode) {\n\n\tcase RTTEST_LOCK:\n\tcase RTTEST_LOCKNOWAIT:\n\t\tid = td->opdata;\n\t\tif (id < 0 || id >= MAX_RT_TEST_MUTEXES)\n\t\t\treturn ret;\n\n\t\ttd->mutexes[id] = 1;\n\t\ttd->event = atomic_add_return(1, &rttest_event);\n\t\trt_mutex_lock(&mutexes[id]);\n\t\ttd->event = atomic_add_return(1, &rttest_event);\n\t\ttd->mutexes[id] = 4;\n\t\treturn 0;\n\n\tcase RTTEST_LOCKINT:\n\tcase RTTEST_LOCKINTNOWAIT:\n\t\tid = td->opdata;\n\t\tif (id < 0 || id >= MAX_RT_TEST_MUTEXES)\n\t\t\treturn ret;\n\n\t\ttd->mutexes[id] = 1;\n\t\ttd->event = atomic_add_return(1, &rttest_event);\n\t\tret = rt_mutex_lock_interruptible(&mutexes[id], 0);\n\t\ttd->event = atomic_add_return(1, &rttest_event);\n\t\ttd->mutexes[id] = ret ? 0 : 4;\n\t\treturn ret ? -EINTR : 0;\n\n\tcase RTTEST_UNLOCK:\n\t\tid = td->opdata;\n\t\tif (id < 0 || id >= MAX_RT_TEST_MUTEXES || td->mutexes[id] != 4)\n\t\t\treturn ret;\n\n\t\ttd->event = atomic_add_return(1, &rttest_event);\n\t\trt_mutex_unlock(&mutexes[id]);\n\t\ttd->event = atomic_add_return(1, &rttest_event);\n\t\ttd->mutexes[id] = 0;\n\t\treturn 0;\n\n\tcase RTTEST_LOCKBKL:\n\t\tif (td->bkl)\n\t\t\treturn 0;\n\t\ttd->bkl = 1;\n\t\tlock_kernel();\n\t\ttd->bkl = 4;\n\t\treturn 0;\n\n\tcase RTTEST_UNLOCKBKL:\n\t\tif (td->bkl != 4)\n\t\t\tbreak;\n\t\tunlock_kernel();\n\t\ttd->bkl = 0;\n\t\treturn 0;\n\n\tdefault:\n\t\tbreak;\n\t}\n\treturn ret;\n}\n\n/*\n * Schedule replacement for rtsem_down(). Only called for threads with\n * PF_MUTEX_TESTER set.\n *\n * This allows us to have finegrained control over the event flow.\n *\n */\nvoid schedule_rt_mutex_test(struct rt_mutex *mutex)\n{\n\tint tid, op, dat;\n\tstruct test_thread_data *td;\n\n\t/* We have to lookup the task */\n\tfor (tid = 0; tid < MAX_RT_TEST_THREADS; tid++) {\n\t\tif (threads[tid] == current)\n\t\t\tbreak;\n\t}\n\n\tBUG_ON(tid == MAX_RT_TEST_THREADS);\n\n\ttd = &thread_data[tid];\n\n\top = td->opcode;\n\tdat = td->opdata;\n\n\tswitch (op) {\n\tcase RTTEST_LOCK:\n\tcase RTTEST_LOCKINT:\n\tcase RTTEST_LOCKNOWAIT:\n\tcase RTTEST_LOCKINTNOWAIT:\n\t\tif (mutex != &mutexes[dat])\n\t\t\tbreak;\n\n\t\tif (td->mutexes[dat] != 1)\n\t\t\tbreak;\n\n\t\ttd->mutexes[dat] = 2;\n\t\ttd->event = atomic_add_return(1, &rttest_event);\n\t\tbreak;\n\n\tcase RTTEST_LOCKBKL:\n\tdefault:\n\t\tbreak;\n\t}\n\n\tschedule();\n\n\n\tswitch (op) {\n\tcase RTTEST_LOCK:\n\tcase RTTEST_LOCKINT:\n\t\tif (mutex != &mutexes[dat])\n\t\t\treturn;\n\n\t\tif (td->mutexes[dat] != 2)\n\t\t\treturn;\n\n\t\ttd->mutexes[dat] = 3;\n\t\ttd->event = atomic_add_return(1, &rttest_event);\n\t\tbreak;\n\n\tcase RTTEST_LOCKNOWAIT:\n\tcase RTTEST_LOCKINTNOWAIT:\n\t\tif (mutex != &mutexes[dat])\n\t\t\treturn;\n\n\t\tif (td->mutexes[dat] != 2)\n\t\t\treturn;\n\n\t\ttd->mutexes[dat] = 1;\n\t\ttd->event = atomic_add_return(1, &rttest_event);\n\t\treturn;\n\n\tcase RTTEST_LOCKBKL:\n\t\treturn;\n\tdefault:\n\t\treturn;\n\t}\n\n\ttd->opcode = 0;\n\n\tfor (;;) {\n\t\tset_current_state(TASK_INTERRUPTIBLE);\n\n\t\tif (td->opcode > 0) {\n\t\t\tint ret;\n\n\t\t\tset_current_state(TASK_RUNNING);\n\t\t\tret = handle_op(td, 1);\n\t\t\tset_current_state(TASK_INTERRUPTIBLE);\n\t\t\tif (td->opcode == RTTEST_LOCKCONT)\n\t\t\t\tbreak;\n\t\t\ttd->opcode = ret;\n\t\t}\n\n\t\t/* Wait for the next command to be executed */\n\t\tschedule();\n\t}\n\n\t/* Restore previous command and data */\n\ttd->opcode = op;\n\ttd->opdata = dat;\n}\n\nstatic int test_func(void *data)\n{\n\tstruct test_thread_data *td = data;\n\tint ret;\n\n\tcurrent->flags |= PF_MUTEX_TESTER;\n\tallow_signal(SIGHUP);\n\n\tfor(;;) {\n\n\t\tset_current_state(TASK_INTERRUPTIBLE);\n\n\t\tif (td->opcode > 0) {\n\t\t\tset_current_state(TASK_RUNNING);\n\t\t\tret = handle_op(td, 0);\n\t\t\tset_current_state(TASK_INTERRUPTIBLE);\n\t\t\ttd->opcode = ret;\n\t\t}\n\n\t\t/* Wait for the next command to be executed */\n\t\tschedule();\n\t\ttry_to_freeze();\n\n\t\tif (signal_pending(current))\n\t\t\tflush_signals(current);\n\n\t\tif(kthread_should_stop())\n\t\t\tbreak;\n\t}\n\treturn 0;\n}\n\n/**\n * sysfs_test_command - interface for test commands\n * @dev:\tthread reference\n * @buf:\tcommand for actual step\n * @count:\tlength of buffer\n *\n * command syntax:\n *\n * opcode:data\n */\nstatic ssize_t sysfs_test_command(struct sys_device *dev, const char *buf,\n\t\t\t\t size_t count)\n{\n\tstruct sched_param schedpar;\n\tstruct test_thread_data *td;\n\tchar cmdbuf[32];\n\tint op, dat, tid, ret;\n\n\ttd = container_of(dev, struct test_thread_data, sysdev);\n\ttid = td->sysdev.id;\n\n\t/* strings from sysfs write are not 0 terminated! */\n\tif (count >= sizeof(cmdbuf))\n\t\treturn -EINVAL;\n\n\t/* strip of \\n: */\n\tif (buf[count-1] == '\\n')\n\t\tcount--;\n\tif (count < 1)\n\t\treturn -EINVAL;\n\n\tmemcpy(cmdbuf, buf, count);\n\tcmdbuf[count] = 0;\n\n\tif (sscanf(cmdbuf, \"%d:%d\", &op, &dat) != 2)\n\t\treturn -EINVAL;\n\n\tswitch (op) {\n\tcase RTTEST_SCHEDOT:\n\t\tschedpar.sched_priority = 0;\n\t\tret = sched_setscheduler(threads[tid], SCHED_NORMAL, &schedpar);\n\t\tif (ret)\n\t\t\treturn ret;\n\t\tset_user_nice(current, 0);\n\t\tbreak;\n\n\tcase RTTEST_SCHEDRT:\n\t\tschedpar.sched_priority = dat;\n\t\tret = sched_setscheduler(threads[tid], SCHED_FIFO, &schedpar);\n\t\tif (ret)\n\t\t\treturn ret;\n\t\tbreak;\n\n\tcase RTTEST_SIGNAL:\n\t\tsend_sig(SIGHUP, threads[tid], 0);\n\t\tbreak;\n\n\tdefault:\n\t\tif (td->opcode > 0)\n\t\t\treturn -EBUSY;\n\t\ttd->opdata = dat;\n\t\ttd->opcode = op;\n\t\twake_up_process(threads[tid]);\n\t}\n\n\treturn count;\n}\n\n/**\n * sysfs_test_status - sysfs interface for rt tester\n * @dev:\tthread to query\n * @buf:\tchar buffer to be filled with thread status info\n */\nstatic ssize_t sysfs_test_status(struct sys_device *dev, char *buf)\n{\n\tstruct test_thread_data *td;\n\tstruct task_struct *tsk;\n\tchar *curr = buf;\n\tint i;\n\n\ttd = container_of(dev, struct test_thread_data, sysdev);\n\ttsk = threads[td->sysdev.id];\n\n\tspin_lock(&rttest_lock);\n\n\tcurr += sprintf(curr,\n\t\t\"O: %4d, E:%8d, S: 0x%08lx, P: %4d, N: %4d, B: %p, K: %d, M:\",\n\t\ttd->opcode, td->event, tsk->state,\n\t\t\t(MAX_RT_PRIO - 1) - tsk->prio,\n\t\t\t(MAX_RT_PRIO - 1) - tsk->normal_prio,\n\t\ttsk->pi_blocked_on, td->bkl);\n\n\tfor (i = MAX_RT_TEST_MUTEXES - 1; i >=0 ; i--)\n\t\tcurr += sprintf(curr, \"%d\", td->mutexes[i]);\n\n\tspin_unlock(&rttest_lock);\n\n\tcurr += sprintf(curr, \", T: %p, R: %p\\n\", tsk,\n\t\t\tmutexes[td->sysdev.id].owner);\n\n\treturn curr - buf;\n}\n\nstatic SYSDEV_ATTR(status, 0600, sysfs_test_status, NULL);\nstatic SYSDEV_ATTR(command, 0600, NULL, sysfs_test_command);\n\nstatic struct sysdev_class rttest_sysclass = {\n\tset_kset_name(\"rttest\"),\n};\n\nstatic int init_test_thread(int id)\n{\n\tthread_data[id].sysdev.cls = &rttest_sysclass;\n\tthread_data[id].sysdev.id = id;\n\n\tthreads[id] = kthread_run(test_func, &thread_data[id], \"rt-test-%d\", id);\n\tif (IS_ERR(threads[id]))\n\t\treturn PTR_ERR(threads[id]);\n\n\treturn sysdev_register(&thread_data[id].sysdev);\n}\n\nstatic int init_rttest(void)\n{\n\tint ret, i;\n\n\tspin_lock_init(&rttest_lock);\n\n\tfor (i = 0; i < MAX_RT_TEST_MUTEXES; i++)\n\t\trt_mutex_init(&mutexes[i]);\n\n\tret = sysdev_class_register(&rttest_sysclass);\n\tif (ret)\n\t\treturn ret;\n\n\tfor (i = 0; i < MAX_RT_TEST_THREADS; i++) {\n\t\tret = init_test_thread(i);\n\t\tif (ret)\n\t\t\tbreak;\n\t\tret = sysdev_create_file(&thread_data[i].sysdev, &attr_status);\n\t\tif (ret)\n\t\t\tbreak;\n\t\tret = sysdev_create_file(&thread_data[i].sysdev, &attr_command);\n\t\tif (ret)\n\t\t\tbreak;\n\t}\n\n\tprintk(\"Initializing RT-Tester: %s\\n\", ret ? \"Failed\" : \"OK\" );\n\n\treturn ret;\n}\n\ndevice_initcall(init_rttest);\n/* kernel/rwsem.c: R/W semaphores, public implementation\n *\n * Written by David Howells (dhowells@redhat.com).\n * Derived from asm-i386/semaphore.h\n */\n\n#include <linux/types.h>\n#include <linux/kernel.h>\n#include <linux/module.h>\n#include <linux/rwsem.h>\n\n#include <asm/system.h>\n#include <asm/atomic.h>\n\n/*\n * lock for reading\n */\nvoid down_read(struct rw_semaphore *sem)\n{\n\tmight_sleep();\n\trwsem_acquire_read(&sem->dep_map, 0, 0, _RET_IP_);\n\n\t__down_read(sem);\n}\n\nEXPORT_SYMBOL(down_read);\n\n/*\n * trylock for reading -- returns 1 if successful, 0 if contention\n */\nint down_read_trylock(struct rw_semaphore *sem)\n{\n\tint ret = __down_read_trylock(sem);\n\n\tif (ret == 1)\n\t\trwsem_acquire_read(&sem->dep_map, 0, 1, _RET_IP_);\n\treturn ret;\n}\n\nEXPORT_SYMBOL(down_read_trylock);\n\n/*\n * lock for writing\n */\nvoid down_write(struct rw_semaphore *sem)\n{\n\tmight_sleep();\n\trwsem_acquire(&sem->dep_map, 0, 0, _RET_IP_);\n\n\t__down_write(sem);\n}\n\nEXPORT_SYMBOL(down_write);\n\n/*\n * trylock for writing -- returns 1 if successful, 0 if contention\n */\nint down_write_trylock(struct rw_semaphore *sem)\n{\n\tint ret = __down_write_trylock(sem);\n\n\tif (ret == 1)\n\t\trwsem_acquire(&sem->dep_map, 0, 1, _RET_IP_);\n\treturn ret;\n}\n\nEXPORT_SYMBOL(down_write_trylock);\n\n/*\n * release a read lock\n */\nvoid up_read(struct rw_semaphore *sem)\n{\n\trwsem_release(&sem->dep_map, 1, _RET_IP_);\n\n\t__up_read(sem);\n}\n\nEXPORT_SYMBOL(up_read);\n\n/*\n * release a write lock\n */\nvoid up_write(struct rw_semaphore *sem)\n{\n\trwsem_release(&sem->dep_map, 1, _RET_IP_);\n\n\t__up_write(sem);\n}\n\nEXPORT_SYMBOL(up_write);\n\n/*\n * downgrade write lock to read lock\n */\nvoid downgrade_write(struct rw_semaphore *sem)\n{\n\t/*\n\t * lockdep: a downgraded write will live on as a write\n\t * dependency.\n\t */\n\t__downgrade_write(sem);\n}\n\nEXPORT_SYMBOL(downgrade_write);\n\n#ifdef CONFIG_DEBUG_LOCK_ALLOC\n\nvoid down_read_nested(struct rw_semaphore *sem, int subclass)\n{\n\tmight_sleep();\n\trwsem_acquire_read(&sem->dep_map, subclass, 0, _RET_IP_);\n\n\t__down_read(sem);\n}\n\nEXPORT_SYMBOL(down_read_nested);\n\nvoid down_read_non_owner(struct rw_semaphore *sem)\n{\n\tmight_sleep();\n\n\t__down_read(sem);\n}\n\nEXPORT_SYMBOL(down_read_non_owner);\n\nvoid down_write_nested(struct rw_semaphore *sem, int subclass)\n{\n\tmight_sleep();\n\trwsem_acquire(&sem->dep_map, subclass, 0, _RET_IP_);\n\n\t__down_write_nested(sem, subclass);\n}\n\nEXPORT_SYMBOL(down_write_nested);\n\nvoid up_read_non_owner(struct rw_semaphore *sem)\n{\n\t__up_read(sem);\n}\n\nEXPORT_SYMBOL(up_read_non_owner);\n\n#endif\n\n\n/*\n * kernel/sched.c\n *\n * Kernel scheduler and related syscalls\n *\n * Copyright (C) 1991-2002 Linus Torvalds\n *\n * 1996-12-23 Modified by Dave Grothe to fix bugs in semaphores and\n *\t\tmake semaphores SMP safe\n * 1998-11-19\tImplemented schedule_timeout() and related stuff\n *\t\tby Andrea Arcangeli\n * 2002-01-04\tNew ultra-scalable O(1) scheduler by Ingo Molnar:\n *\t\thybrid priority-list and round-robin design with\n *\t\tan array-switch method of distributing timeslices\n *\t\tand per-CPU runqueues. Cleanups and useful suggestions\n *\t\tby Davide Libenzi, preemptible kernel bits by Robert Love.\n * 2003-09-03\tInteractivity tuning by Con Kolivas.\n * 2004-04-02\tScheduler domains code by Nick Piggin\n */\n\n#include <linux/mm.h>\n#include <linux/module.h>\n#include <linux/nmi.h>\n#include <linux/init.h>\n#include <asm/uaccess.h>\n#include <linux/highmem.h>\n#include <linux/smp_lock.h>\n#include <asm/mmu_context.h>\n#include <linux/interrupt.h>\n#include <linux/capability.h>\n#include <linux/completion.h>\n#include <linux/kernel_stat.h>\n#include <linux/debug_locks.h>\n#include <linux/security.h>\n#include <linux/notifier.h>\n#include <linux/profile.h>\n#include <linux/freezer.h>\n#include <linux/vmalloc.h>\n#include <linux/blkdev.h>\n#include <linux/delay.h>\n#include <linux/smp.h>\n#include <linux/threads.h>\n#include <linux/timer.h>\n#include <linux/rcupdate.h>\n#include <linux/cpu.h>\n#include <linux/cpuset.h>\n#include <linux/percpu.h>\n#include <linux/kthread.h>\n#include <linux/seq_file.h>\n#include <linux/syscalls.h>\n#include <linux/times.h>\n#include <linux/tsacct_kern.h>\n#include <linux/kprobes.h>\n#include <linux/delayacct.h>\n#include <linux/reciprocal_div.h>\n\n#include <asm/tlb.h>\n#include <asm/unistd.h>\n\n/*\n * Scheduler clock - returns current time in nanosec units.\n * This is default implementation.\n * Architectures and sub-architectures can override this.\n */\nunsigned long long __attribute__((weak)) sched_clock(void)\n{\n\treturn (unsigned long long)jiffies * (1000000000 / HZ);\n}\n\n/*\n * Convert user-nice values [ -20 ... 0 ... 19 ]\n * to static priority [ MAX_RT_PRIO..MAX_PRIO-1 ],\n * and back.\n */\n#define NICE_TO_PRIO(nice)\t(MAX_RT_PRIO + (nice) + 20)\n#define PRIO_TO_NICE(prio)\t((prio) - MAX_RT_PRIO - 20)\n#define TASK_NICE(p)\t\tPRIO_TO_NICE((p)->static_prio)\n\n/*\n * 'User priority' is the nice value converted to something we\n * can work with better when scaling various scheduler parameters,\n * it's a [ 0 ... 39 ] range.\n */\n#define USER_PRIO(p)\t\t((p)-MAX_RT_PRIO)\n#define TASK_USER_PRIO(p)\tUSER_PRIO((p)->static_prio)\n#define MAX_USER_PRIO\t\t(USER_PRIO(MAX_PRIO))\n\n/*\n * Some helpers for converting nanosecond timing to jiffy resolution\n */\n#define NS_TO_JIFFIES(TIME)\t((TIME) / (1000000000 / HZ))\n#define JIFFIES_TO_NS(TIME)\t((TIME) * (1000000000 / HZ))\n\n/*\n * These are the 'tuning knobs' of the scheduler:\n *\n * Minimum timeslice is 5 msecs (or 1 jiffy, whichever is larger),\n * default timeslice is 100 msecs, maximum timeslice is 800 msecs.\n * Timeslices get refilled after they expire.\n */\n#define MIN_TIMESLICE\t\tmax(5 * HZ / 1000, 1)\n#define DEF_TIMESLICE\t\t(100 * HZ / 1000)\n#define ON_RUNQUEUE_WEIGHT\t 30\n#define CHILD_PENALTY\t\t 95\n#define PARENT_PENALTY\t\t100\n#define EXIT_WEIGHT\t\t 3\n#define PRIO_BONUS_RATIO\t 25\n#define MAX_BONUS\t\t(MAX_USER_PRIO * PRIO_BONUS_RATIO / 100)\n#define INTERACTIVE_DELTA\t 2\n#define MAX_SLEEP_AVG\t\t(DEF_TIMESLICE * MAX_BONUS)\n#define STARVATION_LIMIT\t(MAX_SLEEP_AVG)\n#define NS_MAX_SLEEP_AVG\t(JIFFIES_TO_NS(MAX_SLEEP_AVG))\n\n/*\n * If a task is 'interactive' then we reinsert it in the active\n * array after it has expired its current timeslice. (it will not\n * continue to run immediately, it will still roundrobin with\n * other interactive tasks.)\n *\n * This part scales the interactivity limit depending on niceness.\n *\n * We scale it linearly, offset by the INTERACTIVE_DELTA delta.\n * Here are a few examples of different nice levels:\n *\n * TASK_INTERACTIVE(-20): [1,1,1,1,1,1,1,1,1,0,0]\n * TASK_INTERACTIVE(-10): [1,1,1,1,1,1,1,0,0,0,0]\n * TASK_INTERACTIVE( 0): [1,1,1,1,0,0,0,0,0,0,0]\n * TASK_INTERACTIVE( 10): [1,1,0,0,0,0,0,0,0,0,0]\n * TASK_INTERACTIVE( 19): [0,0,0,0,0,0,0,0,0,0,0]\n *\n * (the X axis represents the possible -5 ... 0 ... +5 dynamic\n * priority range a task can explore, a value of '1' means the\n * task is rated interactive.)\n *\n * Ie. nice +19 tasks can never get 'interactive' enough to be\n * reinserted into the active array. And only heavily CPU-hog nice -20\n * tasks will be expired. Default nice 0 tasks are somewhere between,\n * it takes some effort for them to get interactive, but it's not\n * too hard.\n */\n\n#define CURRENT_BONUS(p) \\\n\t(NS_TO_JIFFIES((p)->sleep_avg) * MAX_BONUS / \\\n\t\tMAX_SLEEP_AVG)\n\n#define GRANULARITY\t(10 * HZ / 1000 ? : 1)\n\n#ifdef CONFIG_SMP\n#define TIMESLICE_GRANULARITY(p)\t(GRANULARITY * \\\n\t\t(1 << (((MAX_BONUS - CURRENT_BONUS(p)) ? : 1) - 1)) * \\\n\t\t\tnum_online_cpus())\n#else\n#define TIMESLICE_GRANULARITY(p)\t(GRANULARITY * \\\n\t\t(1 << (((MAX_BONUS - CURRENT_BONUS(p)) ? : 1) - 1)))\n#endif\n\n#define SCALE(v1,v1_max,v2_max) \\\n\t(v1) * (v2_max) / (v1_max)\n\n#define DELTA(p) \\\n\t(SCALE(TASK_NICE(p) + 20, 40, MAX_BONUS) - 20 * MAX_BONUS / 40 + \\\n\t\tINTERACTIVE_DELTA)\n\n#define TASK_INTERACTIVE(p) \\\n\t((p)->prio <= (p)->static_prio - DELTA(p))\n\n#define INTERACTIVE_SLEEP(p) \\\n\t(JIFFIES_TO_NS(MAX_SLEEP_AVG * \\\n\t\t(MAX_BONUS / 2 + DELTA((p)) + 1) / MAX_BONUS - 1))\n\n#define TASK_PREEMPTS_CURR(p, rq) \\\n\t((p)->prio < (rq)->curr->prio)\n\n#define SCALE_PRIO(x, prio) \\\n\tmax(x * (MAX_PRIO - prio) / (MAX_USER_PRIO / 2), MIN_TIMESLICE)\n\nstatic unsigned int static_prio_timeslice(int static_prio)\n{\n\tif (static_prio < NICE_TO_PRIO(0))\n\t\treturn SCALE_PRIO(DEF_TIMESLICE * 4, static_prio);\n\telse\n\t\treturn SCALE_PRIO(DEF_TIMESLICE, static_prio);\n}\n\n#ifdef CONFIG_SMP\n/*\n * Divide a load by a sched group cpu_power : (load / sg->__cpu_power)\n * Since cpu_power is a 'constant', we can use a reciprocal divide.\n */\nstatic inline u32 sg_div_cpu_power(const struct sched_group *sg, u32 load)\n{\n\treturn reciprocal_divide(load, sg->reciprocal_cpu_power);\n}\n\n/*\n * Each time a sched group cpu_power is changed,\n * we must compute its reciprocal value\n */\nstatic inline void sg_inc_cpu_power(struct sched_group *sg, u32 val)\n{\n\tsg->__cpu_power += val;\n\tsg->reciprocal_cpu_power = reciprocal_value(sg->__cpu_power);\n}\n#endif\n\n/*\n * task_timeslice() scales user-nice values [ -20 ... 0 ... 19 ]\n * to time slice values: [800ms ... 100ms ... 5ms]\n *\n * The higher a thread's priority, the bigger timeslices\n * it gets during one round of execution. But even the lowest\n * priority thread gets MIN_TIMESLICE worth of execution time.\n */\n\nstatic inline unsigned int task_timeslice(struct task_struct *p)\n{\n\treturn static_prio_timeslice(p->static_prio);\n}\n\n/*\n * These are the runqueue data structures:\n */\n\nstruct prio_array {\n\tunsigned int nr_active;\n\tDECLARE_BITMAP(bitmap, MAX_PRIO+1); /* include 1 bit for delimiter */\n\tstruct list_head queue[MAX_PRIO];\n};\n\n/*\n * This is the main, per-CPU runqueue data structure.\n *\n * Locking rule: those places that want to lock multiple runqueues\n * (such as the load balancing or the thread migration code), lock\n * acquire operations must be ordered by ascending &runqueue.\n */\nstruct rq {\n\tspinlock_t lock;\n\n\t/*\n\t * nr_running and cpu_load should be in the same cacheline because\n\t * remote CPUs use both these fields when doing load calculation.\n\t */\n\tunsigned long nr_running;\n\tunsigned long raw_weighted_load;\n#ifdef CONFIG_SMP\n\tunsigned long cpu_load[3];\n\tunsigned char idle_at_tick;\n#ifdef CONFIG_NO_HZ\n\tunsigned char in_nohz_recently;\n#endif\n#endif\n\tunsigned long long nr_switches;\n\n\t/*\n\t * This is part of a global counter where only the total sum\n\t * over all CPUs matters. A task can increase this counter on\n\t * one CPU and if it got migrated afterwards it may decrease\n\t * it on another CPU. Always updated under the runqueue lock:\n\t */\n\tunsigned long nr_uninterruptible;\n\n\tunsigned long expired_timestamp;\n\t/* Cached timestamp set by update_cpu_clock() */\n\tunsigned long long most_recent_timestamp;\n\tstruct task_struct *curr, *idle;\n\tunsigned long next_balance;\n\tstruct mm_struct *prev_mm;\n\tstruct prio_array *active, *expired, arrays[2];\n\tint best_expired_prio;\n\tatomic_t nr_iowait;\n\n#ifdef CONFIG_SMP\n\tstruct sched_domain *sd;\n\n\t/* For active balancing */\n\tint active_balance;\n\tint push_cpu;\n\tint cpu;\t\t/* cpu of this runqueue */\n\n\tstruct task_struct *migration_thread;\n\tstruct list_head migration_queue;\n#endif\n\n#ifdef CONFIG_SCHEDSTATS\n\t/* latency stats */\n\tstruct sched_info rq_sched_info;\n\n\t/* sys_sched_yield() stats */\n\tunsigned long yld_exp_empty;\n\tunsigned long yld_act_empty;\n\tunsigned long yld_both_empty;\n\tunsigned long yld_cnt;\n\n\t/* schedule() stats */\n\tunsigned long sched_switch;\n\tunsigned long sched_cnt;\n\tunsigned long sched_goidle;\n\n\t/* try_to_wake_up() stats */\n\tunsigned long ttwu_cnt;\n\tunsigned long ttwu_local;\n#endif\n\tstruct lock_class_key rq_lock_key;\n};\n\nstatic DEFINE_PER_CPU(struct rq, runqueues) ____cacheline_aligned_in_smp;\nstatic DEFINE_MUTEX(sched_hotcpu_mutex);\n\nstatic inline int cpu_of(struct rq *rq)\n{\n#ifdef CONFIG_SMP\n\treturn rq->cpu;\n#else\n\treturn 0;\n#endif\n}\n\n/*\n * The domain tree (rq->sd) is protected by RCU's quiescent state transition.\n * See detach_destroy_domains: synchronize_sched for details.\n *\n * The domain tree of any CPU may only be accessed from within\n * preempt-disabled sections.\n */\n#define for_each_domain(cpu, __sd) \\\n\tfor (__sd = rcu_dereference(cpu_rq(cpu)->sd); __sd; __sd = __sd->parent)\n\n#define cpu_rq(cpu)\t\t(&per_cpu(runqueues, (cpu)))\n#define this_rq()\t\t(&__get_cpu_var(runqueues))\n#define task_rq(p)\t\tcpu_rq(task_cpu(p))\n#define cpu_curr(cpu)\t\t(cpu_rq(cpu)->curr)\n\n#ifndef prepare_arch_switch\n# define prepare_arch_switch(next)\tdo { } while (0)\n#endif\n#ifndef finish_arch_switch\n# define finish_arch_switch(prev)\tdo { } while (0)\n#endif\n\n#ifndef __ARCH_WANT_UNLOCKED_CTXSW\nstatic inline int task_running(struct rq *rq, struct task_struct *p)\n{\n\treturn rq->curr == p;\n}\n\nstatic inline void prepare_lock_switch(struct rq *rq, struct task_struct *next)\n{\n}\n\nstatic inline void finish_lock_switch(struct rq *rq, struct task_struct *prev)\n{\n#ifdef CONFIG_DEBUG_SPINLOCK\n\t/* this is a valid case when another task releases the spinlock */\n\trq->lock.owner = current;\n#endif\n\t/*\n\t * If we are tracking spinlock dependencies then we have to\n\t * fix up the runqueue lock - which gets 'carried over' from\n\t * prev into current:\n\t */\n\tspin_acquire(&rq->lock.dep_map, 0, 0, _THIS_IP_);\n\n\tspin_unlock_irq(&rq->lock);\n}\n\n#else /* __ARCH_WANT_UNLOCKED_CTXSW */\nstatic inline int task_running(struct rq *rq, struct task_struct *p)\n{\n#ifdef CONFIG_SMP\n\treturn p->oncpu;\n#else\n\treturn rq->curr == p;\n#endif\n}\n\nstatic inline void prepare_lock_switch(struct rq *rq, struct task_struct *next)\n{\n#ifdef CONFIG_SMP\n\t/*\n\t * We can optimise this out completely for !SMP, because the\n\t * SMP rebalancing from interrupt is the only thing that cares\n\t * here.\n\t */\n\tnext->oncpu = 1;\n#endif\n#ifdef __ARCH_WANT_INTERRUPTS_ON_CTXSW\n\tspin_unlock_irq(&rq->lock);\n#else\n\tspin_unlock(&rq->lock);\n#endif\n}\n\nstatic inline void finish_lock_switch(struct rq *rq, struct task_struct *prev)\n{\n#ifdef CONFIG_SMP\n\t/*\n\t * After ->oncpu is cleared, the task can be moved to a different CPU.\n\t * We must ensure this doesn't happen until the switch is completely\n\t * finished.\n\t */\n\tsmp_wmb();\n\tprev->oncpu = 0;\n#endif\n#ifndef __ARCH_WANT_INTERRUPTS_ON_CTXSW\n\tlocal_irq_enable();\n#endif\n}\n#endif /* __ARCH_WANT_UNLOCKED_CTXSW */\n\n/*\n * __task_rq_lock - lock the runqueue a given task resides on.\n * Must be called interrupts disabled.\n */\nstatic inline struct rq *__task_rq_lock(struct task_struct *p)\n\t__acquires(rq->lock)\n{\n\tstruct rq *rq;\n\nrepeat_lock_task:\n\trq = task_rq(p);\n\tspin_lock(&rq->lock);\n\tif (unlikely(rq != task_rq(p))) {\n\t\tspin_unlock(&rq->lock);\n\t\tgoto repeat_lock_task;\n\t}\n\treturn rq;\n}\n\n/*\n * task_rq_lock - lock the runqueue a given task resides on and disable\n * interrupts. Note the ordering: we can safely lookup the task_rq without\n * explicitly disabling preemption.\n */\nstatic struct rq *task_rq_lock(struct task_struct *p, unsigned long *flags)\n\t__acquires(rq->lock)\n{\n\tstruct rq *rq;\n\nrepeat_lock_task:\n\tlocal_irq_save(*flags);\n\trq = task_rq(p);\n\tspin_lock(&rq->lock);\n\tif (unlikely(rq != task_rq(p))) {\n\t\tspin_unlock_irqrestore(&rq->lock, *flags);\n\t\tgoto repeat_lock_task;\n\t}\n\treturn rq;\n}\n\nstatic inline void __task_rq_unlock(struct rq *rq)\n\t__releases(rq->lock)\n{\n\tspin_unlock(&rq->lock);\n}\n\nstatic inline void task_rq_unlock(struct rq *rq, unsigned long *flags)\n\t__releases(rq->lock)\n{\n\tspin_unlock_irqrestore(&rq->lock, *flags);\n}\n\n#ifdef CONFIG_SCHEDSTATS\n/*\n * bump this up when changing the output format or the meaning of an existing\n * format, so that tools can adapt (or abort)\n */\n#define SCHEDSTAT_VERSION 14\n\nstatic int show_schedstat(struct seq_file *seq, void *v)\n{\n\tint cpu;\n\n\tseq_printf(seq, \"version %d\\n\", SCHEDSTAT_VERSION);\n\tseq_printf(seq, \"timestamp %lu\\n\", jiffies);\n\tfor_each_online_cpu(cpu) {\n\t\tstruct rq *rq = cpu_rq(cpu);\n#ifdef CONFIG_SMP\n\t\tstruct sched_domain *sd;\n\t\tint dcnt = 0;\n#endif\n\n\t\t/* runqueue-specific stats */\n\t\tseq_printf(seq,\n\t\t \"cpu%d %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu\",\n\t\t cpu, rq->yld_both_empty,\n\t\t rq->yld_act_empty, rq->yld_exp_empty, rq->yld_cnt,\n\t\t rq->sched_switch, rq->sched_cnt, rq->sched_goidle,\n\t\t rq->ttwu_cnt, rq->ttwu_local,\n\t\t rq->rq_sched_info.cpu_time,\n\t\t rq->rq_sched_info.run_delay, rq->rq_sched_info.pcnt);\n\n\t\tseq_printf(seq, \"\\n\");\n\n#ifdef CONFIG_SMP\n\t\t/* domain-specific stats */\n\t\tpreempt_disable();\n\t\tfor_each_domain(cpu, sd) {\n\t\t\tenum idle_type itype;\n\t\t\tchar mask_str[NR_CPUS];\n\n\t\t\tcpumask_scnprintf(mask_str, NR_CPUS, sd->span);\n\t\t\tseq_printf(seq, \"domain%d %s\", dcnt++, mask_str);\n\t\t\tfor (itype = SCHED_IDLE; itype < MAX_IDLE_TYPES;\n\t\t\t\t\titype++) {\n\t\t\t\tseq_printf(seq, \" %lu %lu %lu %lu %lu %lu %lu \"\n\t\t\t\t\t\t\"%lu\",\n\t\t\t\t sd->lb_cnt[itype],\n\t\t\t\t sd->lb_balanced[itype],\n\t\t\t\t sd->lb_failed[itype],\n\t\t\t\t sd->lb_imbalance[itype],\n\t\t\t\t sd->lb_gained[itype],\n\t\t\t\t sd->lb_hot_gained[itype],\n\t\t\t\t sd->lb_nobusyq[itype],\n\t\t\t\t sd->lb_nobusyg[itype]);\n\t\t\t}\n\t\t\tseq_printf(seq, \" %lu %lu %lu %lu %lu %lu %lu %lu %lu\"\n\t\t\t \" %lu %lu %lu\\n\",\n\t\t\t sd->alb_cnt, sd->alb_failed, sd->alb_pushed,\n\t\t\t sd->sbe_cnt, sd->sbe_balanced, sd->sbe_pushed,\n\t\t\t sd->sbf_cnt, sd->sbf_balanced, sd->sbf_pushed,\n\t\t\t sd->ttwu_wake_remote, sd->ttwu_move_affine,\n\t\t\t sd->ttwu_move_balance);\n\t\t}\n\t\tpreempt_enable();\n#endif\n\t}\n\treturn 0;\n}\n\nstatic int schedstat_open(struct inode *inode, struct file *file)\n{\n\tunsigned int size = PAGE_SIZE * (1 + num_online_cpus() / 32);\n\tchar *buf = kmalloc(size, GFP_KERNEL);\n\tstruct seq_file *m;\n\tint res;\n\n\tif (!buf)\n\t\treturn -ENOMEM;\n\tres = single_open(file, show_schedstat, NULL);\n\tif (!res) {\n\t\tm = file->private_data;\n\t\tm->buf = buf;\n\t\tm->size = size;\n\t} else\n\t\tkfree(buf);\n\treturn res;\n}\n\nconst struct file_operations proc_schedstat_operations = {\n\t.open = schedstat_open,\n\t.read = seq_read,\n\t.llseek = seq_lseek,\n\t.release = single_release,\n};\n\n/*\n * Expects runqueue lock to be held for atomicity of update\n */\nstatic inline void\nrq_sched_info_arrive(struct rq *rq, unsigned long delta_jiffies)\n{\n\tif (rq) {\n\t\trq->rq_sched_info.run_delay += delta_jiffies;\n\t\trq->rq_sched_info.pcnt++;\n\t}\n}\n\n/*\n * Expects runqueue lock to be held for atomicity of update\n */\nstatic inline void\nrq_sched_info_depart(struct rq *rq, unsigned long delta_jiffies)\n{\n\tif (rq)\n\t\trq->rq_sched_info.cpu_time += delta_jiffies;\n}\n# define schedstat_inc(rq, field)\tdo { (rq)->field++; } while (0)\n# define schedstat_add(rq, field, amt)\tdo { (rq)->field += (amt); } while (0)\n#else /* !CONFIG_SCHEDSTATS */\nstatic inline void\nrq_sched_info_arrive(struct rq *rq, unsigned long delta_jiffies)\n{}\nstatic inline void\nrq_sched_info_depart(struct rq *rq, unsigned long delta_jiffies)\n{}\n# define schedstat_inc(rq, field)\tdo { } while (0)\n# define schedstat_add(rq, field, amt)\tdo { } while (0)\n#endif\n\n/*\n * this_rq_lock - lock this runqueue and disable interrupts.\n */\nstatic inline struct rq *this_rq_lock(void)\n\t__acquires(rq->lock)\n{\n\tstruct rq *rq;\n\n\tlocal_irq_disable();\n\trq = this_rq();\n\tspin_lock(&rq->lock);\n\n\treturn rq;\n}\n\n#if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT)\n/*\n * Called when a process is dequeued from the active array and given\n * the cpu. We should note that with the exception of interactive\n * tasks, the expired queue will become the active queue after the active\n * queue is empty, without explicitly dequeuing and requeuing tasks in the\n * expired queue. (Interactive tasks may be requeued directly to the\n * active queue, thus delaying tasks in the expired queue from running;\n * see scheduler_tick()).\n *\n * This function is only called from sched_info_arrive(), rather than\n * dequeue_task(). Even though a task may be queued and dequeued multiple\n * times as it is shuffled about, we're really interested in knowing how\n * long it was from the *first* time it was queued to the time that it\n * finally hit a cpu.\n */\nstatic inline void sched_info_dequeued(struct task_struct *t)\n{\n\tt->sched_info.last_queued = 0;\n}\n\n/*\n * Called when a task finally hits the cpu. We can now calculate how\n * long it was waiting to run. We also note when it began so that we\n * can keep stats on how long its timeslice is.\n */\nstatic void sched_info_arrive(struct task_struct *t)\n{\n\tunsigned long now = jiffies, delta_jiffies = 0;\n\n\tif (t->sched_info.last_queued)\n\t\tdelta_jiffies = now - t->sched_info.last_queued;\n\tsched_info_dequeued(t);\n\tt->sched_info.run_delay += delta_jiffies;\n\tt->sched_info.last_arrival = now;\n\tt->sched_info.pcnt++;\n\n\trq_sched_info_arrive(task_rq(t), delta_jiffies);\n}\n\n/*\n * Called when a process is queued into either the active or expired\n * array. The time is noted and later used to determine how long we\n * had to wait for us to reach the cpu. Since the expired queue will\n * become the active queue after active queue is empty, without dequeuing\n * and requeuing any tasks, we are interested in queuing to either. It\n * is unusual but not impossible for tasks to be dequeued and immediately\n * requeued in the same or another array: this can happen in sched_yield(),\n * set_user_nice(), and even load_balance() as it moves tasks from runqueue\n * to runqueue.\n *\n * This function is only called from enqueue_task(), but also only updates\n * the timestamp if it is already not set. It's assumed that\n * sched_info_dequeued() will clear that stamp when appropriate.\n */\nstatic inline void sched_info_queued(struct task_struct *t)\n{\n\tif (unlikely(sched_info_on()))\n\t\tif (!t->sched_info.last_queued)\n\t\t\tt->sched_info.last_queued = jiffies;\n}\n\n/*\n * Called when a process ceases being the active-running process, either\n * voluntarily or involuntarily. Now we can calculate how long we ran.\n */\nstatic inline void sched_info_depart(struct task_struct *t)\n{\n\tunsigned long delta_jiffies = jiffies - t->sched_info.last_arrival;\n\n\tt->sched_info.cpu_time += delta_jiffies;\n\trq_sched_info_depart(task_rq(t), delta_jiffies);\n}\n\n/*\n * Called when tasks are switched involuntarily due, typically, to expiring\n * their time slice. (This may also be called when switching to or from\n * the idle task.) We are only called when prev != next.\n */\nstatic inline void\n__sched_info_switch(struct task_struct *prev, struct task_struct *next)\n{\n\tstruct rq *rq = task_rq(prev);\n\n\t/*\n\t * prev now departs the cpu. It's not interesting to record\n\t * stats about how efficient we were at scheduling the idle\n\t * process, however.\n\t */\n\tif (prev != rq->idle)\n\t\tsched_info_depart(prev);\n\n\tif (next != rq->idle)\n\t\tsched_info_arrive(next);\n}\nstatic inline void\nsched_info_switch(struct task_struct *prev, struct task_struct *next)\n{\n\tif (unlikely(sched_info_on()))\n\t\t__sched_info_switch(prev, next);\n}\n#else\n#define sched_info_queued(t)\t\tdo { } while (0)\n#define sched_info_switch(t, next)\tdo { } while (0)\n#endif /* CONFIG_SCHEDSTATS || CONFIG_TASK_DELAY_ACCT */\n\n/*\n * Adding/removing a task to/from a priority array:\n */\nstatic void dequeue_task(struct task_struct *p, struct prio_array *array)\n{\n\tarray->nr_active--;\n\tlist_del(&p->run_list);\n\tif (list_empty(array->queue + p->prio))\n\t\t__clear_bit(p->prio, array->bitmap);\n}\n\nstatic void enqueue_task(struct task_struct *p, struct prio_array *array)\n{\n\tsched_info_queued(p);\n\tlist_add_tail(&p->run_list, array->queue + p->prio);\n\t__set_bit(p->prio, array->bitmap);\n\tarray->nr_active++;\n\tp->array = array;\n}\n\n/*\n * Put task to the end of the run list without the overhead of dequeue\n * followed by enqueue.\n */\nstatic void requeue_task(struct task_struct *p, struct prio_array *array)\n{\n\tlist_move_tail(&p->run_list, array->queue + p->prio);\n}\n\nstatic inline void\nenqueue_task_head(struct task_struct *p, struct prio_array *array)\n{\n\tlist_add(&p->run_list, array->queue + p->prio);\n\t__set_bit(p->prio, array->bitmap);\n\tarray->nr_active++;\n\tp->array = array;\n}\n\n/*\n * __normal_prio - return the priority that is based on the static\n * priority but is modified by bonuses/penalties.\n *\n * We scale the actual sleep average [0 .... MAX_SLEEP_AVG]\n * into the -5 ... 0 ... +5 bonus/penalty range.\n *\n * We use 25% of the full 0...39 priority range so that:\n *\n * 1) nice +19 interactive tasks do not preempt nice 0 CPU hogs.\n * 2) nice -20 CPU hogs do not get preempted by nice 0 tasks.\n *\n * Both properties are important to certain workloads.\n */\n\nstatic inline int __normal_prio(struct task_struct *p)\n{\n\tint bonus, prio;\n\n\tbonus = CURRENT_BONUS(p) - MAX_BONUS / 2;\n\n\tprio = p->static_prio - bonus;\n\tif (prio < MAX_RT_PRIO)\n\t\tprio = MAX_RT_PRIO;\n\tif (prio > MAX_PRIO-1)\n\t\tprio = MAX_PRIO-1;\n\treturn prio;\n}\n\n/*\n * To aid in avoiding the subversion of \"niceness\" due to uneven distribution\n * of tasks with abnormal \"nice\" values across CPUs the contribution that\n * each task makes to its run queue's load is weighted according to its\n * scheduling class and \"nice\" value. For SCHED_NORMAL tasks this is just a\n * scaled version of the new time slice allocation that they receive on time\n * slice expiry etc.\n */\n\n/*\n * Assume: static_prio_timeslice(NICE_TO_PRIO(0)) == DEF_TIMESLICE\n * If static_prio_timeslice() is ever changed to break this assumption then\n * this code will need modification\n */\n#define TIME_SLICE_NICE_ZERO DEF_TIMESLICE\n#define LOAD_WEIGHT(lp) \\\n\t(((lp) * SCHED_LOAD_SCALE) / TIME_SLICE_NICE_ZERO)\n#define PRIO_TO_LOAD_WEIGHT(prio) \\\n\tLOAD_WEIGHT(static_prio_timeslice(prio))\n#define RTPRIO_TO_LOAD_WEIGHT(rp) \\\n\t(PRIO_TO_LOAD_WEIGHT(MAX_RT_PRIO) + LOAD_WEIGHT(rp))\n\nstatic void set_load_weight(struct task_struct *p)\n{\n\tif (has_rt_policy(p)) {\n#ifdef CONFIG_SMP\n\t\tif (p == task_rq(p)->migration_thread)\n\t\t\t/*\n\t\t\t * The migration thread does the actual balancing.\n\t\t\t * Giving its load any weight will skew balancing\n\t\t\t * adversely.\n\t\t\t */\n\t\t\tp->load_weight = 0;\n\t\telse\n#endif\n\t\t\tp->load_weight = RTPRIO_TO_LOAD_WEIGHT(p->rt_priority);\n\t} else\n\t\tp->load_weight = PRIO_TO_LOAD_WEIGHT(p->static_prio);\n}\n\nstatic inline void\ninc_raw_weighted_load(struct rq *rq, const struct task_struct *p)\n{\n\trq->raw_weighted_load += p->load_weight;\n}\n\nstatic inline void\ndec_raw_weighted_load(struct rq *rq, const struct task_struct *p)\n{\n\trq->raw_weighted_load -= p->load_weight;\n}\n\nstatic inline void inc_nr_running(struct task_struct *p, struct rq *rq)\n{\n\trq->nr_running++;\n\tinc_raw_weighted_load(rq, p);\n}\n\nstatic inline void dec_nr_running(struct task_struct *p, struct rq *rq)\n{\n\trq->nr_running--;\n\tdec_raw_weighted_load(rq, p);\n}\n\n/*\n * Calculate the expected normal priority: i.e. priority\n * without taking RT-inheritance into account. Might be\n * boosted by interactivity modifiers. Changes upon fork,\n * setprio syscalls, and whenever the interactivity\n * estimator recalculates.\n */\nstatic inline int normal_prio(struct task_struct *p)\n{\n\tint prio;\n\n\tif (has_rt_policy(p))\n\t\tprio = MAX_RT_PRIO-1 - p->rt_priority;\n\telse\n\t\tprio = __normal_prio(p);\n\treturn prio;\n}\n\n/*\n * Calculate the current priority, i.e. the priority\n * taken into account by the scheduler. This value might\n * be boosted by RT tasks, or might be boosted by\n * interactivity modifiers. Will be RT if the task got\n * RT-boosted. If not then it returns p->normal_prio.\n */\nstatic int effective_prio(struct task_struct *p)\n{\n\tp->normal_prio = normal_prio(p);\n\t/*\n\t * If we are RT tasks or we were boosted to RT priority,\n\t * keep the priority unchanged. Otherwise, update priority\n\t * to the normal priority:\n\t */\n\tif (!rt_prio(p->prio))\n\t\treturn p->normal_prio;\n\treturn p->prio;\n}\n\n/*\n * __activate_task - move a task to the runqueue.\n */\nstatic void __activate_task(struct task_struct *p, struct rq *rq)\n{\n\tstruct prio_array *target = rq->active;\n\n\tif (batch_task(p))\n\t\ttarget = rq->expired;\n\tenqueue_task(p, target);\n\tinc_nr_running(p, rq);\n}\n\n/*\n * __activate_idle_task - move idle task to the _front_ of runqueue.\n */\nstatic inline void __activate_idle_task(struct task_struct *p, struct rq *rq)\n{\n\tenqueue_task_head(p, rq->active);\n\tinc_nr_running(p, rq);\n}\n\n/*\n * Recalculate p->normal_prio and p->prio after having slept,\n * updating the sleep-average too:\n */\nstatic int recalc_task_prio(struct task_struct *p, unsigned long long now)\n{\n\t/* Caller must always ensure 'now >= p->timestamp' */\n\tunsigned long sleep_time = now - p->timestamp;\n\n\tif (batch_task(p))\n\t\tsleep_time = 0;\n\n\tif (likely(sleep_time > 0)) {\n\t\t/*\n\t\t * This ceiling is set to the lowest priority that would allow\n\t\t * a task to be reinserted into the active array on timeslice\n\t\t * completion.\n\t\t */\n\t\tunsigned long ceiling = INTERACTIVE_SLEEP(p);\n\n\t\tif (p->mm && sleep_time > ceiling && p->sleep_avg < ceiling) {\n\t\t\t/*\n\t\t\t * Prevents user tasks from achieving best priority\n\t\t\t * with one single large enough sleep.\n\t\t\t */\n\t\t\tp->sleep_avg = ceiling;\n\t\t\t/*\n\t\t\t * Using INTERACTIVE_SLEEP() as a ceiling places a\n\t\t\t * nice(0) task 1ms sleep away from promotion, and\n\t\t\t * gives it 700ms to round-robin with no chance of\n\t\t\t * being demoted. This is more than generous, so\n\t\t\t * mark this sleep as non-interactive to prevent the\n\t\t\t * on-runqueue bonus logic from intervening should\n\t\t\t * this task not receive cpu immediately.\n\t\t\t */\n\t\t\tp->sleep_type = SLEEP_NONINTERACTIVE;\n\t\t} else {\n\t\t\t/*\n\t\t\t * Tasks waking from uninterruptible sleep are\n\t\t\t * limited in their sleep_avg rise as they\n\t\t\t * are likely to be waiting on I/O\n\t\t\t */\n\t\t\tif (p->sleep_type == SLEEP_NONINTERACTIVE && p->mm) {\n\t\t\t\tif (p->sleep_avg >= ceiling)\n\t\t\t\t\tsleep_time = 0;\n\t\t\t\telse if (p->sleep_avg + sleep_time >=\n\t\t\t\t\t ceiling) {\n\t\t\t\t\t\tp->sleep_avg = ceiling;\n\t\t\t\t\t\tsleep_time = 0;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t/*\n\t\t\t * This code gives a bonus to interactive tasks.\n\t\t\t *\n\t\t\t * The boost works by updating the 'average sleep time'\n\t\t\t * value here, based on ->timestamp. The more time a\n\t\t\t * task spends sleeping, the higher the average gets -\n\t\t\t * and the higher the priority boost gets as well.\n\t\t\t */\n\t\t\tp->sleep_avg += sleep_time;\n\n\t\t}\n\t\tif (p->sleep_avg > NS_MAX_SLEEP_AVG)\n\t\t\tp->sleep_avg = NS_MAX_SLEEP_AVG;\n\t}\n\n\treturn effective_prio(p);\n}\n\n/*\n * activate_task - move a task to the runqueue and do priority recalculation\n *\n * Update all the scheduling statistics stuff. (sleep average\n * calculation, priority modifiers, etc.)\n */\nstatic void activate_task(struct task_struct *p, struct rq *rq, int local)\n{\n\tunsigned long long now;\n\n\tif (rt_task(p))\n\t\tgoto out;\n\n\tnow = sched_clock();\n#ifdef CONFIG_SMP\n\tif (!local) {\n\t\t/* Compensate for drifting sched_clock */\n\t\tstruct rq *this_rq = this_rq();\n\t\tnow = (now - this_rq->most_recent_timestamp)\n\t\t\t+ rq->most_recent_timestamp;\n\t}\n#endif\n\n\t/*\n\t * Sleep time is in units of nanosecs, so shift by 20 to get a\n\t * milliseconds-range estimation of the amount of time that the task\n\t * spent sleeping:\n\t */\n\tif (unlikely(prof_on == SLEEP_PROFILING)) {\n\t\tif (p->state == TASK_UNINTERRUPTIBLE)\n\t\t\tprofile_hits(SLEEP_PROFILING, (void *)get_wchan(p),\n\t\t\t\t (now - p->timestamp) >> 20);\n\t}\n\n\tp->prio = recalc_task_prio(p, now);\n\n\t/*\n\t * This checks to make sure it's not an uninterruptible task\n\t * that is now waking up.\n\t */\n\tif (p->sleep_type == SLEEP_NORMAL) {\n\t\t/*\n\t\t * Tasks which were woken up by interrupts (ie. hw events)\n\t\t * are most likely of interactive nature. So we give them\n\t\t * the credit of extending their sleep time to the period\n\t\t * of time they spend on the runqueue, waiting for execution\n\t\t * on a CPU, first time around:\n\t\t */\n\t\tif (in_interrupt())\n\t\t\tp->sleep_type = SLEEP_INTERRUPTED;\n\t\telse {\n\t\t\t/*\n\t\t\t * Normal first-time wakeups get a credit too for\n\t\t\t * on-runqueue time, but it will be weighted down:\n\t\t\t */\n\t\t\tp->sleep_type = SLEEP_INTERACTIVE;\n\t\t}\n\t}\n\tp->timestamp = now;\nout:\n\t__activate_task(p, rq);\n}\n\n/*\n * deactivate_task - remove a task from the runqueue.\n */\nstatic void deactivate_task(struct task_struct *p, struct rq *rq)\n{\n\tdec_nr_running(p, rq);\n\tdequeue_task(p, p->array);\n\tp->array = NULL;\n}\n\n/*\n * resched_task - mark a task 'to be rescheduled now'.\n *\n * On UP this means the setting of the need_resched flag, on SMP it\n * might also involve a cross-CPU call to trigger the scheduler on\n * the target CPU.\n */\n#ifdef CONFIG_SMP\n\n#ifndef tsk_is_polling\n#define tsk_is_polling(t) test_tsk_thread_flag(t, TIF_POLLING_NRFLAG)\n#endif\n\nstatic void resched_task(struct task_struct *p)\n{\n\tint cpu;\n\n\tassert_spin_locked(&task_rq(p)->lock);\n\n\tif (unlikely(test_tsk_thread_flag(p, TIF_NEED_RESCHED)))\n\t\treturn;\n\n\tset_tsk_thread_flag(p, TIF_NEED_RESCHED);\n\n\tcpu = task_cpu(p);\n\tif (cpu == smp_processor_id())\n\t\treturn;\n\n\t/* NEED_RESCHED must be visible before we test polling */\n\tsmp_mb();\n\tif (!tsk_is_polling(p))\n\t\tsmp_send_reschedule(cpu);\n}\n\nstatic void resched_cpu(int cpu)\n{\n\tstruct rq *rq = cpu_rq(cpu);\n\tunsigned long flags;\n\n\tif (!spin_trylock_irqsave(&rq->lock, flags))\n\t\treturn;\n\tresched_task(cpu_curr(cpu));\n\tspin_unlock_irqrestore(&rq->lock, flags);\n}\n#else\nstatic inline void resched_task(struct task_struct *p)\n{\n\tassert_spin_locked(&task_rq(p)->lock);\n\tset_tsk_need_resched(p);\n}\n#endif\n\n/**\n * task_curr - is this task currently executing on a CPU?\n * @p: the task in question.\n */\ninline int task_curr(const struct task_struct *p)\n{\n\treturn cpu_curr(task_cpu(p)) == p;\n}\n\n/* Used instead of source_load when we know the type == 0 */\nunsigned long weighted_cpuload(const int cpu)\n{\n\treturn cpu_rq(cpu)->raw_weighted_load;\n}\n\n#ifdef CONFIG_SMP\nstruct migration_req {\n\tstruct list_head list;\n\n\tstruct task_struct *task;\n\tint dest_cpu;\n\n\tstruct completion done;\n};\n\n/*\n * The task's runqueue lock must be held.\n * Returns true if you have to wait for migration thread.\n */\nstatic int\nmigrate_task(struct task_struct *p, int dest_cpu, struct migration_req *req)\n{\n\tstruct rq *rq = task_rq(p);\n\n\t/*\n\t * If the task is not on a runqueue (and not running), then\n\t * it is sufficient to simply update the task's cpu field.\n\t */\n\tif (!p->array && !task_running(rq, p)) {\n\t\tset_task_cpu(p, dest_cpu);\n\t\treturn 0;\n\t}\n\n\tinit_completion(&req->done);\n\treq->task = p;\n\treq->dest_cpu = dest_cpu;\n\tlist_add(&req->list, &rq->migration_queue);\n\n\treturn 1;\n}\n\n/*\n * wait_task_inactive - wait for a thread to unschedule.\n *\n * The caller must ensure that the task *will* unschedule sometime soon,\n * else this function might spin for a *long* time. This function can't\n * be called with interrupts off, or it may introduce deadlock with\n * smp_call_function() if an IPI is sent by the same process we are\n * waiting to become inactive.\n */\nvoid wait_task_inactive(struct task_struct *p)\n{\n\tunsigned long flags;\n\tstruct rq *rq;\n\tstruct prio_array *array;\n\tint running;\n\nrepeat:\n\t/*\n\t * We do the initial early heuristics without holding\n\t * any task-queue locks at all. We'll only try to get\n\t * the runqueue lock when things look like they will\n\t * work out!\n\t */\n\trq = task_rq(p);\n\n\t/*\n\t * If the task is actively running on another CPU\n\t * still, just relax and busy-wait without holding\n\t * any locks.\n\t *\n\t * NOTE! Since we don't hold any locks, it's not\n\t * even sure that \"rq\" stays as the right runqueue!\n\t * But we don't care, since \"task_running()\" will\n\t * return false if the runqueue has changed and p\n\t * is actually now running somewhere else!\n\t */\n\twhile (task_running(rq, p))\n\t\tcpu_relax();\n\n\t/*\n\t * Ok, time to look more closely! We need the rq\n\t * lock now, to be *sure*. If we're wrong, we'll\n\t * just go back and repeat.\n\t */\n\trq = task_rq_lock(p, &flags);\n\trunning = task_running(rq, p);\n\tarray = p->array;\n\ttask_rq_unlock(rq, &flags);\n\n\t/*\n\t * Was it really running after all now that we\n\t * checked with the proper locks actually held?\n\t *\n\t * Oops. Go back and try again..\n\t */\n\tif (unlikely(running)) {\n\t\tcpu_relax();\n\t\tgoto repeat;\n\t}\n\n\t/*\n\t * It's not enough that it's not actively running,\n\t * it must be off the runqueue _entirely_, and not\n\t * preempted!\n\t *\n\t * So if it wa still runnable (but just not actively\n\t * running right now), it's preempted, and we should\n\t * yield - it could be a while.\n\t */\n\tif (unlikely(array)) {\n\t\tyield();\n\t\tgoto repeat;\n\t}\n\n\t/*\n\t * Ahh, all good. It wasn't running, and it wasn't\n\t * runnable, which means that it will never become\n\t * running in the future either. We're all done!\n\t */\n}\n\n/***\n * kick_process - kick a running thread to enter/exit the kernel\n * @p: the to-be-kicked thread\n *\n * Cause a process which is running on another CPU to enter\n * kernel-mode, without any delay. (to get signals handled.)\n *\n * NOTE: this function doesnt have to take the runqueue lock,\n * because all it wants to ensure is that the remote task enters\n * the kernel. If the IPI races and the task has been migrated\n * to another CPU then no harm is done and the purpose has been\n * achieved as well.\n */\nvoid kick_process(struct task_struct *p)\n{\n\tint cpu;\n\n\tpreempt_disable();\n\tcpu = task_cpu(p);\n\tif ((cpu != smp_processor_id()) && task_curr(p))\n\t\tsmp_send_reschedule(cpu);\n\tpreempt_enable();\n}\n\n/*\n * Return a low guess at the load of a migration-source cpu weighted\n * according to the scheduling class and \"nice\" value.\n *\n * We want to under-estimate the load of migration sources, to\n * balance conservatively.\n */\nstatic inline unsigned long source_load(int cpu, int type)\n{\n\tstruct rq *rq = cpu_rq(cpu);\n\n\tif (type == 0)\n\t\treturn rq->raw_weighted_load;\n\n\treturn min(rq->cpu_load[type-1], rq->raw_weighted_load);\n}\n\n/*\n * Return a high guess at the load of a migration-target cpu weighted\n * according to the scheduling class and \"nice\" value.\n */\nstatic inline unsigned long target_load(int cpu, int type)\n{\n\tstruct rq *rq = cpu_rq(cpu);\n\n\tif (type == 0)\n\t\treturn rq->raw_weighted_load;\n\n\treturn max(rq->cpu_load[type-1], rq->raw_weighted_load);\n}\n\n/*\n * Return the average load per task on the cpu's run queue\n */\nstatic inline unsigned long cpu_avg_load_per_task(int cpu)\n{\n\tstruct rq *rq = cpu_rq(cpu);\n\tunsigned long n = rq->nr_running;\n\n\treturn n ? rq->raw_weighted_load / n : SCHED_LOAD_SCALE;\n}\n\n/*\n * find_idlest_group finds and returns the least busy CPU group within the\n * domain.\n */\nstatic struct sched_group *\nfind_idlest_group(struct sched_domain *sd, struct task_struct *p, int this_cpu)\n{\n\tstruct sched_group *idlest = NULL, *this = NULL, *group = sd->groups;\n\tunsigned long min_load = ULONG_MAX, this_load = 0;\n\tint load_idx = sd->forkexec_idx;\n\tint imbalance = 100 + (sd->imbalance_pct-100)/2;\n\n\tdo {\n\t\tunsigned long load, avg_load;\n\t\tint local_group;\n\t\tint i;\n\n\t\t/* Skip over this group if it has no CPUs allowed */\n\t\tif (!cpus_intersects(group->cpumask, p->cpus_allowed))\n\t\t\tgoto nextgroup;\n\n\t\tlocal_group = cpu_isset(this_cpu, group->cpumask);\n\n\t\t/* Tally up the load of all CPUs in the group */\n\t\tavg_load = 0;\n\n\t\tfor_each_cpu_mask(i, group->cpumask) {\n\t\t\t/* Bias balancing toward cpus of our domain */\n\t\t\tif (local_group)\n\t\t\t\tload = source_load(i, load_idx);\n\t\t\telse\n\t\t\t\tload = target_load(i, load_idx);\n\n\t\t\tavg_load += load;\n\t\t}\n\n\t\t/* Adjust by relative CPU power of the group */\n\t\tavg_load = sg_div_cpu_power(group,\n\t\t\t\tavg_load * SCHED_LOAD_SCALE);\n\n\t\tif (local_group) {\n\t\t\tthis_load = avg_load;\n\t\t\tthis = group;\n\t\t} else if (avg_load < min_load) {\n\t\t\tmin_load = avg_load;\n\t\t\tidlest = group;\n\t\t}\nnextgroup:\n\t\tgroup = group->next;\n\t} while (group != sd->groups);\n\n\tif (!idlest || 100*this_load < imbalance*min_load)\n\t\treturn NULL;\n\treturn idlest;\n}\n\n/*\n * find_idlest_cpu - find the idlest cpu among the cpus in group.\n */\nstatic int\nfind_idlest_cpu(struct sched_group *group, struct task_struct *p, int this_cpu)\n{\n\tcpumask_t tmp;\n\tunsigned long load, min_load = ULONG_MAX;\n\tint idlest = -1;\n\tint i;\n\n\t/* Traverse only the allowed CPUs */\n\tcpus_and(tmp, group->cpumask, p->cpus_allowed);\n\n\tfor_each_cpu_mask(i, tmp) {\n\t\tload = weighted_cpuload(i);\n\n\t\tif (load < min_load || (load == min_load && i == this_cpu)) {\n\t\t\tmin_load = load;\n\t\t\tidlest = i;\n\t\t}\n\t}\n\n\treturn idlest;\n}\n\nstatic int\nfind_idlest_cpu_nodomain(struct task_struct *p, int this_cpu)\n{\n\tcpumask_t tmp;\n\tunsigned long load, min_load = ULONG_MAX;\n\tint idlest = -1;\n\tint i;\n\n\t/* Traverse only the allowed CPUs */\n\tcpus_and(tmp, cpu_online_map, p->cpus_allowed);\n\n\tfor_each_cpu_mask(i, tmp) {\n\t\tload = target_load(i, 1);\n\n\t\tif (load < min_load) {\n\t\t\tmin_load = load;\n\t\t\tidlest = i;\n\t\t}\n\t}\n\treturn idlest;\n}\n\n/*\n * sched_balance_self: balance the current task (running on cpu) in domains\n * that have the 'flag' flag set. In practice, this is SD_BALANCE_FORK and\n * SD_BALANCE_EXEC.\n *\n * Balance, ie. select the least loaded group.\n *\n * Returns the target CPU number, or the same CPU if no balancing is needed.\n *\n * preempt must be disabled.\n */\n\nint affinity_load_balancing = 0;\n\nstatic int sched_balance_self(int cpu, int flag)\n{\n\tstruct task_struct *t = current;\n\tstruct sched_domain *tmp, *sd = NULL;\n\n\tif (affinity_load_balancing && !cpus_full(t->cpus_allowed))\n\t\treturn find_idlest_cpu_nodomain(t, cpu);\n\n\tfor_each_domain(cpu, tmp) {\n \t\t/*\n \t \t * If power savings logic is enabled for a domain, stop there.\n \t \t */\n\t\tif (tmp->flags & SD_POWERSAVINGS_BALANCE)\n\t\t\tbreak;\n\t\tif (tmp->flags & flag)\n\t\t\tsd = tmp;\n\t}\n\n\twhile (sd) {\n\t\tcpumask_t span;\n\t\tstruct sched_group *group;\n\t\tint new_cpu, weight;\n\n\t\tif (!(sd->flags & flag)) {\n\t\t\tsd = sd->child;\n\t\t\tcontinue;\n\t\t}\n\n\t\tspan = sd->span;\n\t\tgroup = find_idlest_group(sd, t, cpu);\n\t\tif (!group) {\n\t\t\tsd = sd->child;\n\t\t\tcontinue;\n\t\t}\n\n\t\tnew_cpu = find_idlest_cpu(group, t, cpu);\n\t\tif (new_cpu == -1 || new_cpu == cpu) {\n\t\t\t/* Now try balancing at a lower domain level of cpu */\n\t\t\tsd = sd->child;\n\t\t\tcontinue;\n\t\t}\n\n\t\t/* Now try balancing at a lower domain level of new_cpu */\n\t\tcpu = new_cpu;\n\t\tsd = NULL;\n\t\tweight = cpus_weight(span);\n\t\tfor_each_domain(cpu, tmp) {\n\t\t\tif (weight <= cpus_weight(tmp->span))\n\t\t\t\tbreak;\n\t\t\tif (tmp->flags & flag)\n\t\t\t\tsd = tmp;\n\t\t}\n\t\t/* while loop will break here if sd == NULL */\n\t}\n\n\treturn cpu;\n}\n\n#endif /* CONFIG_SMP */\n\n/*\n * wake_idle() will wake a task on an idle cpu if task->cpu is\n * not idle and an idle cpu is available. The span of cpus to\n * search starts with cpus closest then further out as needed,\n * so we always favor a closer, idle cpu.\n *\n * Returns the CPU we should wake onto.\n */\n#if defined(ARCH_HAS_SCHED_WAKE_IDLE)\nstatic int wake_idle(int cpu, struct task_struct *p)\n{\n\tcpumask_t tmp;\n\tstruct sched_domain *sd;\n\tint i;\n\n\t/*\n\t * If it is idle, then it is the best cpu to run this task.\n\t *\n\t * This cpu is also the best, if it has more than one task already.\n\t * Siblings must be also busy(in most cases) as they didn't already\n\t * pickup the extra load from this cpu and hence we need not check\n\t * sibling runqueue info. This will avoid the checks and cache miss\n\t * penalities associated with that.\n\t */\n\tif (idle_cpu(cpu) || cpu_rq(cpu)->nr_running > 1)\n\t\treturn cpu;\n\n\tfor_each_domain(cpu, sd) {\n\t\tif (sd->flags & SD_WAKE_IDLE) {\n\t\t\tcpus_and(tmp, sd->span, p->cpus_allowed);\n\t\t\tfor_each_cpu_mask(i, tmp) {\n\t\t\t\tif (idle_cpu(i))\n\t\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t\tbreak;\n\t}\n\treturn cpu;\n}\n#else\nstatic inline int wake_idle(int cpu, struct task_struct *p)\n{\n\treturn cpu;\n}\n#endif\n\n/***\n * try_to_wake_up - wake up a thread\n * @p: the to-be-woken-up thread\n * @state: the mask of task states that can be woken\n * @sync: do a synchronous wakeup?\n *\n * Put it on the run-queue if it's not already there. The \"current\"\n * thread is always on the run-queue (except when the actual\n * re-schedule is in progress), and as such you're allowed to do\n * the simpler \"current->state = TASK_RUNNING\" to mark yourself\n * runnable without the overhead of this.\n *\n * returns failure only if the task is already active.\n */\nstatic int try_to_wake_up(struct task_struct *p, unsigned int state, int sync)\n{\n\tint cpu, this_cpu, success = 0;\n\tunsigned long flags;\n\tlong old_state;\n\tstruct rq *rq;\n#ifdef CONFIG_SMP\n\tstruct sched_domain *sd, *this_sd = NULL;\n\tunsigned long load, this_load;\n\tint new_cpu;\n#endif\n\n\trq = task_rq_lock(p, &flags);\n\told_state = p->state;\n\tif (!(old_state & state))\n\t\tgoto out;\n\n\tif (p->array)\n\t\tgoto out_running;\n\n\tcpu = task_cpu(p);\n\tthis_cpu = smp_processor_id();\n\n#ifdef CONFIG_SMP\n\tif (unlikely(task_running(rq, p)))\n\t\tgoto out_activate;\n\n\tnew_cpu = cpu;\n\n\tschedstat_inc(rq, ttwu_cnt);\n\tif (cpu == this_cpu) {\n\t\tschedstat_inc(rq, ttwu_local);\n\t\tgoto out_set_cpu;\n\t}\n\n\tfor_each_domain(this_cpu, sd) {\n\t\tif (cpu_isset(cpu, sd->span)) {\n\t\t\tschedstat_inc(sd, ttwu_wake_remote);\n\t\t\tthis_sd = sd;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tif (unlikely(!cpu_isset(this_cpu, p->cpus_allowed)))\n\t\tgoto out_set_cpu;\n\n\t/*\n\t * Check for affine wakeup and passive balancing possibilities.\n\t */\n\tif (this_sd) {\n\t\tint idx = this_sd->wake_idx;\n\t\tunsigned int imbalance;\n\n\t\timbalance = 100 + (this_sd->imbalance_pct - 100) / 2;\n\n\t\tload = source_load(cpu, idx);\n\t\tthis_load = target_load(this_cpu, idx);\n\n\t\tnew_cpu = this_cpu; /* Wake to this CPU if we can */\n\n\t\tif (this_sd->flags & SD_WAKE_AFFINE) {\n\t\t\tunsigned long tl = this_load;\n\t\t\tunsigned long tl_per_task;\n\n\t\t\ttl_per_task = cpu_avg_load_per_task(this_cpu);\n\n\t\t\t/*\n\t\t\t * If sync wakeup then subtract the (maximum possible)\n\t\t\t * effect of the currently running task from the load\n\t\t\t * of the current CPU:\n\t\t\t */\n\t\t\tif (sync)\n\t\t\t\ttl -= current->load_weight;\n\n\t\t\tif ((tl <= load &&\n\t\t\t\ttl + target_load(cpu, idx) <= tl_per_task) ||\n\t\t\t\t100*(tl + p->load_weight) <= imbalance*load) {\n\t\t\t\t/*\n\t\t\t\t * This domain has SD_WAKE_AFFINE and\n\t\t\t\t * p is cache cold in this domain, and\n\t\t\t\t * there is no bad imbalance.\n\t\t\t\t */\n\t\t\t\tschedstat_inc(this_sd, ttwu_move_affine);\n\t\t\t\tgoto out_set_cpu;\n\t\t\t}\n\t\t}\n\n\t\t/*\n\t\t * Start passive balancing when half the imbalance_pct\n\t\t * limit is reached.\n\t\t */\n\t\tif (this_sd->flags & SD_WAKE_BALANCE) {\n\t\t\tif (imbalance*this_load <= 100*load) {\n\t\t\t\tschedstat_inc(this_sd, ttwu_move_balance);\n\t\t\t\tgoto out_set_cpu;\n\t\t\t}\n\t\t}\n\t}\n\n\tnew_cpu = cpu; /* Could not wake to this_cpu. Wake to cpu instead */\nout_set_cpu:\n\tnew_cpu = wake_idle(new_cpu, p);\n\tif (new_cpu != cpu) {\n\t\tset_task_cpu(p, new_cpu);\n\t\ttask_rq_unlock(rq, &flags);\n\t\t/* might preempt at this point */\n\t\trq = task_rq_lock(p, &flags);\n\t\told_state = p->state;\n\t\tif (!(old_state & state))\n\t\t\tgoto out;\n\t\tif (p->array)\n\t\t\tgoto out_running;\n\n\t\tthis_cpu = smp_processor_id();\n\t\tcpu = task_cpu(p);\n\t}\n\nout_activate:\n#endif /* CONFIG_SMP */\n\tif (old_state == TASK_UNINTERRUPTIBLE) {\n\t\trq->nr_uninterruptible--;\n\t\t/*\n\t\t * Tasks on involuntary sleep don't earn\n\t\t * sleep_avg beyond just interactive state.\n\t\t */\n\t\tp->sleep_type = SLEEP_NONINTERACTIVE;\n\t} else\n\n\t/*\n\t * Tasks that have marked their sleep as noninteractive get\n\t * woken up with their sleep average not weighted in an\n\t * interactive way.\n\t */\n\t\tif (old_state & TASK_NONINTERACTIVE)\n\t\t\tp->sleep_type = SLEEP_NONINTERACTIVE;\n\n\n\tactivate_task(p, rq, cpu == this_cpu);\n\t/*\n\t * Sync wakeups (i.e. those types of wakeups where the waker\n\t * has indicated that it will leave the CPU in short order)\n\t * don't trigger a preemption, if the woken up task will run on\n\t * this cpu. (in this case the 'I will reschedule' promise of\n\t * the waker guarantees that the freshly woken up task is going\n\t * to be considered on this CPU.)\n\t */\n\tif (!sync || cpu != this_cpu) {\n\t\tif (TASK_PREEMPTS_CURR(p, rq))\n\t\t\tresched_task(rq->curr);\n\t}\n\tsuccess = 1;\n\nout_running:\n\tp->state = TASK_RUNNING;\nout:\n\ttask_rq_unlock(rq, &flags);\n\n\treturn success;\n}\n\nint fastcall wake_up_process(struct task_struct *p)\n{\n\treturn try_to_wake_up(p, TASK_STOPPED | TASK_TRACED |\n\t\t\t\t TASK_INTERRUPTIBLE | TASK_UNINTERRUPTIBLE, 0);\n}\nEXPORT_SYMBOL(wake_up_process);\n\nint fastcall wake_up_state(struct task_struct *p, unsigned int state)\n{\n\treturn try_to_wake_up(p, state, 0);\n}\n\nstatic void task_running_tick(struct rq *rq, struct task_struct *p);\n/*\n * Perform scheduler related setup for a newly forked process p.\n * p is forked by current.\n */\nvoid fastcall sched_fork(struct task_struct *p, int clone_flags)\n{\n\tint cpu = get_cpu();\n\n#ifdef CONFIG_SMP\n\tcpu = sched_balance_self(cpu, SD_BALANCE_FORK);\n#endif\n\tset_task_cpu(p, cpu);\n\n\t/*\n\t * We mark the process as running here, but have not actually\n\t * inserted it onto the runqueue yet. This guarantees that\n\t * nobody will actually run it, and a signal or other external\n\t * event cannot wake it up and insert it on the runqueue either.\n\t */\n\tp->state = TASK_RUNNING;\n\n\t/*\n\t * Make sure we do not leak PI boosting priority to the child:\n\t */\n\tp->prio = current->normal_prio;\n\n\tINIT_LIST_HEAD(&p->run_list);\n\tp->array = NULL;\n#if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT)\n\tif (unlikely(sched_info_on()))\n\t\tmemset(&p->sched_info, 0, sizeof(p->sched_info));\n#endif\n#if defined(CONFIG_SMP) && defined(__ARCH_WANT_UNLOCKED_CTXSW)\n\tp->oncpu = 0;\n#endif\n#ifdef CONFIG_PREEMPT\n\t/* Want to start with kernel preemption disabled. */\n\ttask_thread_info(p)->preempt_count = 1;\n#endif\n\t/*\n\t * Share the timeslice between parent and child, thus the\n\t * total amount of pending timeslices in the system doesn't change,\n\t * resulting in more scheduling fairness.\n\t */\n\tlocal_irq_disable();\n\tp->time_slice = (current->time_slice + 1) >> 1;\n\t/*\n\t * The remainder of the first timeslice might be recovered by\n\t * the parent if the child exits early enough.\n\t */\n\tp->first_time_slice = 1;\n\tcurrent->time_slice >>= 1;\n\tp->timestamp = sched_clock();\n\tif (unlikely(!current->time_slice)) {\n\t\t/*\n\t\t * This case is rare, it happens when the parent has only\n\t\t * a single jiffy left from its timeslice. Taking the\n\t\t * runqueue lock is not a problem.\n\t\t */\n\t\tcurrent->time_slice = 1;\n\t\ttask_running_tick(cpu_rq(cpu), current);\n\t}\n\tlocal_irq_enable();\n\tput_cpu();\n}\n\n/*\n * wake_up_new_task - wake up a newly created task for the first time.\n *\n * This function will do some initial scheduler statistics housekeeping\n * that must be done for every newly created context, then puts the task\n * on the runqueue and wakes it.\n */\nvoid fastcall wake_up_new_task(struct task_struct *p, unsigned long clone_flags)\n{\n\tstruct rq *rq, *this_rq;\n\tunsigned long flags;\n\tint this_cpu, cpu;\n\n\trq = task_rq_lock(p, &flags);\n\tBUG_ON(p->state != TASK_RUNNING);\n\tthis_cpu = smp_processor_id();\n\tcpu = task_cpu(p);\n\n\t/*\n\t * We decrease the sleep average of forking parents\n\t * and children as well, to keep max-interactive tasks\n\t * from forking tasks that are max-interactive. The parent\n\t * (current) is done further down, under its lock.\n\t */\n\tp->sleep_avg = JIFFIES_TO_NS(CURRENT_BONUS(p) *\n\t\tCHILD_PENALTY / 100 * MAX_SLEEP_AVG / MAX_BONUS);\n\n\tp->prio = effective_prio(p);\n\n\tif (likely(cpu == this_cpu)) {\n\t\tif (!(clone_flags & CLONE_VM)) {\n\t\t\t/*\n\t\t\t * The VM isn't cloned, so we're in a good position to\n\t\t\t * do child-runs-first in anticipation of an exec. This\n\t\t\t * usually avoids a lot of COW overhead.\n\t\t\t */\n\t\t\tif (unlikely(!current->array))\n\t\t\t\t__activate_task(p, rq);\n\t\t\telse {\n\t\t\t\tp->prio = current->prio;\n\t\t\t\tp->normal_prio = current->normal_prio;\n\t\t\t\tlist_add_tail(&p->run_list, &current->run_list);\n\t\t\t\tp->array = current->array;\n\t\t\t\tp->array->nr_active++;\n\t\t\t\tinc_nr_running(p, rq);\n\t\t\t}\n\t\t\tset_need_resched();\n\t\t} else\n\t\t\t/* Run child last */\n\t\t\t__activate_task(p, rq);\n\t\t/*\n\t\t * We skip the following code due to cpu == this_cpu\n\t \t *\n\t\t * task_rq_unlock(rq, &flags);\n\t\t * this_rq = task_rq_lock(current, &flags);\n\t\t */\n\t\tthis_rq = rq;\n\t} else {\n\t\tthis_rq = cpu_rq(this_cpu);\n\n\t\t/*\n\t\t * Not the local CPU - must adjust timestamp. This should\n\t\t * get optimised away in the !CONFIG_SMP case.\n\t\t */\n\t\tp->timestamp = (p->timestamp - this_rq->most_recent_timestamp)\n\t\t\t\t\t+ rq->most_recent_timestamp;\n\t\t__activate_task(p, rq);\n\t\tif (TASK_PREEMPTS_CURR(p, rq))\n\t\t\tresched_task(rq->curr);\n\n\t\t/*\n\t\t * Parent and child are on different CPUs, now get the\n\t\t * parent runqueue to update the parent's ->sleep_avg:\n\t\t */\n\t\ttask_rq_unlock(rq, &flags);\n\t\tthis_rq = task_rq_lock(current, &flags);\n\t}\n\tcurrent->sleep_avg = JIFFIES_TO_NS(CURRENT_BONUS(current) *\n\t\tPARENT_PENALTY / 100 * MAX_SLEEP_AVG / MAX_BONUS);\n\ttask_rq_unlock(this_rq, &flags);\n}\n\n/*\n * Potentially available exiting-child timeslices are\n * retrieved here - this way the parent does not get\n * penalized for creating too many threads.\n *\n * (this cannot be used to 'generate' timeslices\n * artificially, because any timeslice recovered here\n * was given away by the parent in the first place.)\n */\nvoid fastcall sched_exit(struct task_struct *p)\n{\n\tunsigned long flags;\n\tstruct rq *rq;\n\n\t/*\n\t * If the child was a (relative-) CPU hog then decrease\n\t * the sleep_avg of the parent as well.\n\t */\n\trq = task_rq_lock(p->parent, &flags);\n\tif (p->first_time_slice && task_cpu(p) == task_cpu(p->parent)) {\n\t\tp->parent->time_slice += p->time_slice;\n\t\tif (unlikely(p->parent->time_slice > task_timeslice(p)))\n\t\t\tp->parent->time_slice = task_timeslice(p);\n\t}\n\tif (p->sleep_avg < p->parent->sleep_avg)\n\t\tp->parent->sleep_avg = p->parent->sleep_avg /\n\t\t(EXIT_WEIGHT + 1) * EXIT_WEIGHT + p->sleep_avg /\n\t\t(EXIT_WEIGHT + 1);\n\ttask_rq_unlock(rq, &flags);\n}\n\n/**\n * prepare_task_switch - prepare to switch tasks\n * @rq: the runqueue preparing to switch\n * @next: the task we are going to switch to.\n *\n * This is called with the rq lock held and interrupts off. It must\n * be paired with a subsequent finish_task_switch after the context\n * switch.\n *\n * prepare_task_switch sets up locking and calls architecture specific\n * hooks.\n */\nstatic inline void prepare_task_switch(struct rq *rq, struct task_struct *next)\n{\n\tprepare_lock_switch(rq, next);\n\tprepare_arch_switch(next);\n}\n\n/**\n * finish_task_switch - clean up after a task-switch\n * @rq: runqueue associated with task-switch\n * @prev: the thread we just switched away from.\n *\n * finish_task_switch must be called after the context switch, paired\n * with a prepare_task_switch call before the context switch.\n * finish_task_switch will reconcile locking set up by prepare_task_switch,\n * and do any other architecture-specific cleanup actions.\n *\n * Note that we may have delayed dropping an mm in context_switch(). If\n * so, we finish that here outside of the runqueue lock. (Doing it\n * with the lock held can cause deadlocks; see schedule() for\n * details.)\n */\nstatic inline void finish_task_switch(struct rq *rq, struct task_struct *prev)\n\t__releases(rq->lock)\n{\n\tstruct mm_struct *mm = rq->prev_mm;\n\tlong prev_state;\n\n\trq->prev_mm = NULL;\n\n\t/*\n\t * A task struct has one reference for the use as \"current\".\n\t * If a task dies, then it sets TASK_DEAD in tsk->state and calls\n\t * schedule one last time. The schedule call will never return, and\n\t * the scheduled task must drop that reference.\n\t * The test for TASK_DEAD must occur while the runqueue locks are\n\t * still held, otherwise prev could be scheduled on another cpu, die\n\t * there before we look at prev->state, and then the reference would\n\t * be dropped twice.\n\t *\t\tManfred Spraul <manfred@colorfullife.com>\n\t */\n\tprev_state = prev->state;\n\tfinish_arch_switch(prev);\n\tfinish_lock_switch(rq, prev);\n\tif (mm)\n\t\tmmdrop(mm);\n\tif (unlikely(prev_state == TASK_DEAD)) {\n\t\t/*\n\t\t * Remove function-return probe instances associated with this\n\t\t * task and put them back on the free list.\n\t \t */\n\t\tkprobe_flush_task(prev);\n\t\tput_task_struct(prev);\n\t}\n}\n\n/**\n * schedule_tail - first thing a freshly forked thread must call.\n * @prev: the thread we just switched away from.\n */\nasmlinkage void schedule_tail(struct task_struct *prev)\n\t__releases(rq->lock)\n{\n\tstruct rq *rq = this_rq();\n\n\tfinish_task_switch(rq, prev);\n#ifdef __ARCH_WANT_UNLOCKED_CTXSW\n\t/* In this case, finish_task_switch does not reenable preemption */\n\tpreempt_enable();\n#endif\n\tif (current->set_child_tid)\n\t\tput_user(current->pid, current->set_child_tid);\n}\n\n/*\n * context_switch - switch to the new MM and the new\n * thread's register state.\n */\nstatic inline struct task_struct *\ncontext_switch(struct rq *rq, struct task_struct *prev,\n\t struct task_struct *next)\n{\n\tstruct mm_struct *mm = next->mm;\n\tstruct mm_struct *oldmm = prev->active_mm;\n\n\t/*\n\t * For paravirt, this is coupled with an exit in switch_to to\n\t * combine the page table reload and the switch backend into\n\t * one hypercall.\n\t */\n\tarch_enter_lazy_cpu_mode();\n\n\tif (!mm) {\n\t\tnext->active_mm = oldmm;\n\t\tatomic_inc(&oldmm->mm_count);\n\t\tenter_lazy_tlb(oldmm, next);\n\t} else\n\t\tswitch_mm(oldmm, mm, next);\n\n\tif (!prev->mm) {\n\t\tprev->active_mm = NULL;\n\t\tWARN_ON(rq->prev_mm);\n\t\trq->prev_mm = oldmm;\n\t}\n\t/*\n\t * Since the runqueue lock will be released by the next\n\t * task (which is an invalid locking op but in the case\n\t * of the scheduler it's an obvious special-case), so we\n\t * do an early lockdep release here:\n\t */\n#ifndef __ARCH_WANT_UNLOCKED_CTXSW\n\tspin_release(&rq->lock.dep_map, 1, _THIS_IP_);\n#endif\n\n\t/* Here we just switch the register state and the stack. */\n\tswitch_to(prev, next, prev);\n\n\treturn prev;\n}\n\n/*\n * nr_running, nr_uninterruptible and nr_context_switches:\n *\n * externally visible scheduler statistics: current number of runnable\n * threads, current number of uninterruptible-sleeping threads, total\n * number of context switches performed since bootup.\n */\nunsigned long nr_running(void)\n{\n\tunsigned long i, sum = 0;\n\n\tfor_each_online_cpu(i)\n\t\tsum += cpu_rq(i)->nr_running;\n\n\treturn sum;\n}\n\nunsigned long nr_uninterruptible(void)\n{\n\tunsigned long i, sum = 0;\n\n\tfor_each_possible_cpu(i)\n\t\tsum += cpu_rq(i)->nr_uninterruptible;\n\n\t/*\n\t * Since we read the counters lockless, it might be slightly\n\t * inaccurate. Do not allow it to go below zero though:\n\t */\n\tif (unlikely((long)sum < 0))\n\t\tsum = 0;\n\n\treturn sum;\n}\n\nunsigned long long nr_context_switches(void)\n{\n\tint i;\n\tunsigned long long sum = 0;\n\n\tfor_each_possible_cpu(i)\n\t\tsum += cpu_rq(i)->nr_switches;\n\n\treturn sum;\n}\n\nunsigned long nr_iowait(void)\n{\n\tunsigned long i, sum = 0;\n\n\tfor_each_possible_cpu(i)\n\t\tsum += atomic_read(&cpu_rq(i)->nr_iowait);\n\n\treturn sum;\n}\n\nunsigned long nr_active(void)\n{\n\tunsigned long i, running = 0, uninterruptible = 0;\n\n\tfor_each_online_cpu(i) {\n\t\trunning += cpu_rq(i)->nr_running;\n\t\tuninterruptible += cpu_rq(i)->nr_uninterruptible;\n\t}\n\n\tif (unlikely((long)uninterruptible < 0))\n\t\tuninterruptible = 0;\n\n\treturn running + uninterruptible;\n}\n\n#ifdef CONFIG_SMP\n\n/*\n * Is this task likely cache-hot:\n */\nstatic inline int\ntask_hot(struct task_struct *p, unsigned long long now, struct sched_domain *sd)\n{\n\treturn (long long)(now - p->last_ran) < (long long)sd->cache_hot_time;\n}\n\n/*\n * double_rq_lock - safely lock two runqueues\n *\n * Note this does not disable interrupts like task_rq_lock,\n * you need to do so manually before calling.\n */\nstatic void double_rq_lock(struct rq *rq1, struct rq *rq2)\n\t__acquires(rq1->lock)\n\t__acquires(rq2->lock)\n{\n\tBUG_ON(!irqs_disabled());\n\tif (rq1 == rq2) {\n\t\tspin_lock(&rq1->lock);\n\t\t__acquire(rq2->lock);\t/* Fake it out ;) */\n\t} else {\n\t\tif (rq1 < rq2) {\n\t\t\tspin_lock(&rq1->lock);\n\t\t\tspin_lock(&rq2->lock);\n\t\t} else {\n\t\t\tspin_lock(&rq2->lock);\n\t\t\tspin_lock(&rq1->lock);\n\t\t}\n\t}\n}\n\n/*\n * double_rq_unlock - safely unlock two runqueues\n *\n * Note this does not restore interrupts like task_rq_unlock,\n * you need to do so manually after calling.\n */\nstatic void double_rq_unlock(struct rq *rq1, struct rq *rq2)\n\t__releases(rq1->lock)\n\t__releases(rq2->lock)\n{\n\tspin_unlock(&rq1->lock);\n\tif (rq1 != rq2)\n\t\tspin_unlock(&rq2->lock);\n\telse\n\t\t__release(rq2->lock);\n}\n\n/*\n * double_lock_balance - lock the busiest runqueue, this_rq is locked already.\n */\nstatic void double_lock_balance(struct rq *this_rq, struct rq *busiest)\n\t__releases(this_rq->lock)\n\t__acquires(busiest->lock)\n\t__acquires(this_rq->lock)\n{\n\tif (unlikely(!irqs_disabled())) {\n\t\t/* printk() doesn't work good under rq->lock */\n\t\tspin_unlock(&this_rq->lock);\n\t\tBUG_ON(1);\n\t}\n\tif (unlikely(!spin_trylock(&busiest->lock))) {\n\t\tif (busiest < this_rq) {\n\t\t\tspin_unlock(&this_rq->lock);\n\t\t\tspin_lock(&busiest->lock);\n\t\t\tspin_lock(&this_rq->lock);\n\t\t} else\n\t\t\tspin_lock(&busiest->lock);\n\t}\n}\n\n/*\n * If dest_cpu is allowed for this process, migrate the task to it.\n * This is accomplished by forcing the cpu_allowed mask to only\n * allow dest_cpu, which will force the cpu onto dest_cpu. Then\n * the cpu_allowed mask is restored.\n */\nstatic void sched_migrate_task(struct task_struct *p, int dest_cpu)\n{\n\tstruct migration_req req;\n\tunsigned long flags;\n\tstruct rq *rq;\n\n\trq = task_rq_lock(p, &flags);\n\tif (!cpu_isset(dest_cpu, p->cpus_allowed)\n\t || unlikely(cpu_is_offline(dest_cpu)))\n\t\tgoto out;\n\n\t/* force the process onto the specified CPU */\n\tif (migrate_task(p, dest_cpu, &req)) {\n\t\t/* Need to wait for migration thread (might exit: take ref). */\n\t\tstruct task_struct *mt = rq->migration_thread;\n\n\t\tget_task_struct(mt);\n\t\ttask_rq_unlock(rq, &flags);\n\t\twake_up_process(mt);\n\t\tput_task_struct(mt);\n\t\twait_for_completion(&req.done);\n\n\t\treturn;\n\t}\nout:\n\ttask_rq_unlock(rq, &flags);\n}\n\n/*\n * sched_exec - execve() is a valuable balancing opportunity, because at\n * this point the task has the smallest effective memory and cache footprint.\n */\nvoid sched_exec(void)\n{\n\tint new_cpu, this_cpu = get_cpu();\n\tnew_cpu = sched_balance_self(this_cpu, SD_BALANCE_EXEC);\n\tput_cpu();\n\tif (new_cpu != this_cpu)\n\t\tsched_migrate_task(current, new_cpu);\n}\n\n/*\n * pull_task - move a task from a remote runqueue to the local runqueue.\n * Both runqueues must be locked.\n */\nstatic void pull_task(struct rq *src_rq, struct prio_array *src_array,\n\t\t struct task_struct *p, struct rq *this_rq,\n\t\t struct prio_array *this_array, int this_cpu)\n{\n\tdequeue_task(p, src_array);\n\tdec_nr_running(p, src_rq);\n\tset_task_cpu(p, this_cpu);\n\tinc_nr_running(p, this_rq);\n\tenqueue_task(p, this_array);\n\tp->timestamp = (p->timestamp - src_rq->most_recent_timestamp)\n\t\t\t\t+ this_rq->most_recent_timestamp;\n\t/*\n\t * Note that idle threads have a prio of MAX_PRIO, for this test\n\t * to be always true for them.\n\t */\n\tif (TASK_PREEMPTS_CURR(p, this_rq))\n\t\tresched_task(this_rq->curr);\n}\n\n/*\n * can_migrate_task - may task p from runqueue rq be migrated to this_cpu?\n */\nstatic\nint can_migrate_task(struct task_struct *p, struct rq *rq, int this_cpu,\n\t\t struct sched_domain *sd, enum idle_type idle,\n\t\t int *all_pinned)\n{\n\t/*\n\t * We do not migrate tasks that are:\n\t * 1) running (obviously), or\n\t * 2) cannot be migrated to this CPU due to cpus_allowed, or\n\t * 3) are cache-hot on their current CPU.\n\t */\n\tif (!cpu_isset(this_cpu, p->cpus_allowed))\n\t\treturn 0;\n\t*all_pinned = 0;\n\n\tif (task_running(rq, p))\n\t\treturn 0;\n\n\t/*\n\t * Aggressive migration if:\n\t * 1) task is cache cold, or\n\t * 2) too many balance attempts have failed.\n\t */\n\n\tif (sd->nr_balance_failed > sd->cache_nice_tries) {\n#ifdef CONFIG_SCHEDSTATS\n\t\tif (task_hot(p, rq->most_recent_timestamp, sd))\n\t\t\tschedstat_inc(sd, lb_hot_gained[idle]);\n#endif\n\t\treturn 1;\n\t}\n\n\tif (task_hot(p, rq->most_recent_timestamp, sd))\n\t\treturn 0;\n\treturn 1;\n}\n\n#define rq_best_prio(rq) min((rq)->curr->prio, (rq)->best_expired_prio)\n\n/*\n * move_tasks tries to move up to max_nr_move tasks and max_load_move weighted\n * load from busiest to this_rq, as part of a balancing operation within\n * \"domain\". Returns the number of tasks moved.\n *\n * Called with both runqueues locked.\n */\nstatic int move_tasks(struct rq *this_rq, int this_cpu, struct rq *busiest,\n\t\t unsigned long max_nr_move, unsigned long max_load_move,\n\t\t struct sched_domain *sd, enum idle_type idle,\n\t\t int *all_pinned)\n{\n\tint idx, pulled = 0, pinned = 0, this_best_prio, best_prio,\n\t best_prio_seen, skip_for_load;\n\tstruct prio_array *array, *dst_array;\n\tstruct list_head *head, *curr;\n\tstruct task_struct *tmp;\n\tlong rem_load_move;\n\n\tif (max_nr_move == 0 || max_load_move == 0)\n\t\tgoto out;\n\n\trem_load_move = max_load_move;\n\tpinned = 1;\n\tthis_best_prio = rq_best_prio(this_rq);\n\tbest_prio = rq_best_prio(busiest);\n\t/*\n\t * Enable handling of the case where there is more than one task\n\t * with the best priority. If the current running task is one\n\t * of those with prio==best_prio we know it won't be moved\n\t * and therefore it's safe to override the skip (based on load) of\n\t * any task we find with that prio.\n\t */\n\tbest_prio_seen = best_prio == busiest->curr->prio;\n\n\t/*\n\t * We first consider expired tasks. Those will likely not be\n\t * executed in the near future, and they are most likely to\n\t * be cache-cold, thus switching CPUs has the least effect\n\t * on them.\n\t */\n\tif (busiest->expired->nr_active) {\n\t\tarray = busiest->expired;\n\t\tdst_array = this_rq->expired;\n\t} else {\n\t\tarray = busiest->active;\n\t\tdst_array = this_rq->active;\n\t}\n\nnew_array:\n\t/* Start searching at priority 0: */\n\tidx = 0;\nskip_bitmap:\n\tif (!idx)\n\t\tidx = sched_find_first_bit(array->bitmap);\n\telse\n\t\tidx = find_next_bit(array->bitmap, MAX_PRIO, idx);\n\tif (idx >= MAX_PRIO) {\n\t\tif (array == busiest->expired && busiest->active->nr_active) {\n\t\t\tarray = busiest->active;\n\t\t\tdst_array = this_rq->active;\n\t\t\tgoto new_array;\n\t\t}\n\t\tgoto out;\n\t}\n\n\thead = array->queue + idx;\n\tcurr = head->prev;\nskip_queue:\n\ttmp = list_entry(curr, struct task_struct, run_list);\n\n\tcurr = curr->prev;\n\n\t/*\n\t * To help distribute high priority tasks accross CPUs we don't\n\t * skip a task if it will be the highest priority task (i.e. smallest\n\t * prio value) on its new queue regardless of its load weight\n\t */\n\tskip_for_load = tmp->load_weight > rem_load_move;\n\tif (skip_for_load && idx < this_best_prio)\n\t\tskip_for_load = !best_prio_seen && idx == best_prio;\n\tif (skip_for_load ||\n\t !can_migrate_task(tmp, busiest, this_cpu, sd, idle, &pinned)) {\n\n\t\tbest_prio_seen |= idx == best_prio;\n\t\tif (curr != head)\n\t\t\tgoto skip_queue;\n\t\tidx++;\n\t\tgoto skip_bitmap;\n\t}\n\n\tpull_task(busiest, array, tmp, this_rq, dst_array, this_cpu);\n\tpulled++;\n\trem_load_move -= tmp->load_weight;\n\n\t/*\n\t * We only want to steal up to the prescribed number of tasks\n\t * and the prescribed amount of weighted load.\n\t */\n\tif (pulled < max_nr_move && rem_load_move > 0) {\n\t\tif (idx < this_best_prio)\n\t\t\tthis_best_prio = idx;\n\t\tif (curr != head)\n\t\t\tgoto skip_queue;\n\t\tidx++;\n\t\tgoto skip_bitmap;\n\t}\nout:\n\t/*\n\t * Right now, this is the only place pull_task() is called,\n\t * so we can safely collect pull_task() stats here rather than\n\t * inside pull_task().\n\t */\n\tschedstat_add(sd, lb_gained[idle], pulled);\n\n\tif (all_pinned)\n\t\t*all_pinned = pinned;\n\treturn pulled;\n}\n\n/*\n * find_busiest_group finds and returns the busiest CPU group within the\n * domain. It calculates and returns the amount of weighted load which\n * should be moved to restore balance via the imbalance parameter.\n */\nstatic struct sched_group *\nfind_busiest_group(struct sched_domain *sd, int this_cpu,\n\t\t unsigned long *imbalance, enum idle_type idle, int *sd_idle,\n\t\t cpumask_t *cpus, int *balance)\n{\n\tstruct sched_group *busiest = NULL, *this = NULL, *group = sd->groups;\n\tunsigned long max_load, avg_load, total_load, this_load, total_pwr;\n\tunsigned long max_pull;\n\tunsigned long busiest_load_per_task, busiest_nr_running;\n\tunsigned long this_load_per_task, this_nr_running;\n\tint load_idx;\n#if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT)\n\tint power_savings_balance = 1;\n\tunsigned long leader_nr_running = 0, min_load_per_task = 0;\n\tunsigned long min_nr_running = ULONG_MAX;\n\tstruct sched_group *group_min = NULL, *group_leader = NULL;\n#endif\n\n\tmax_load = this_load = total_load = total_pwr = 0;\n\tbusiest_load_per_task = busiest_nr_running = 0;\n\tthis_load_per_task = this_nr_running = 0;\n\tif (idle == NOT_IDLE)\n\t\tload_idx = sd->busy_idx;\n\telse if (idle == NEWLY_IDLE)\n\t\tload_idx = sd->newidle_idx;\n\telse\n\t\tload_idx = sd->idle_idx;\n\n\tdo {\n\t\tunsigned long load, group_capacity;\n\t\tint local_group;\n\t\tint i;\n\t\tunsigned int balance_cpu = -1, first_idle_cpu = 0;\n\t\tunsigned long sum_nr_running, sum_weighted_load;\n\n\t\tlocal_group = cpu_isset(this_cpu, group->cpumask);\n\n\t\tif (local_group)\n\t\t\tbalance_cpu = first_cpu(group->cpumask);\n\n\t\t/* Tally up the load of all CPUs in the group */\n\t\tsum_weighted_load = sum_nr_running = avg_load = 0;\n\n\t\tfor_each_cpu_mask(i, group->cpumask) {\n\t\t\tstruct rq *rq;\n\n\t\t\tif (!cpu_isset(i, *cpus))\n\t\t\t\tcontinue;\n\n\t\t\trq = cpu_rq(i);\n\n\t\t\tif (*sd_idle && !idle_cpu(i))\n\t\t\t\t*sd_idle = 0;\n\n\t\t\t/* Bias balancing toward cpus of our domain */\n\t\t\tif (local_group) {\n\t\t\t\tif (idle_cpu(i) && !first_idle_cpu) {\n\t\t\t\t\tfirst_idle_cpu = 1;\n\t\t\t\t\tbalance_cpu = i;\n\t\t\t\t}\n\n\t\t\t\tload = target_load(i, load_idx);\n\t\t\t} else\n\t\t\t\tload = source_load(i, load_idx);\n\n\t\t\tavg_load += load;\n\t\t\tsum_nr_running += rq->nr_running;\n\t\t\tsum_weighted_load += rq->raw_weighted_load;\n\t\t}\n\n\t\t/*\n\t\t * First idle cpu or the first cpu(busiest) in this sched group\n\t\t * is eligible for doing load balancing at this and above\n\t\t * domains.\n\t\t */\n\t\tif (local_group && balance_cpu != this_cpu && balance) {\n\t\t\t*balance = 0;\n\t\t\tgoto ret;\n\t\t}\n\n\t\ttotal_load += avg_load;\n\t\ttotal_pwr += group->__cpu_power;\n\n\t\t/* Adjust by relative CPU power of the group */\n\t\tavg_load = sg_div_cpu_power(group,\n\t\t\t\tavg_load * SCHED_LOAD_SCALE);\n\n\t\tgroup_capacity = group->__cpu_power / SCHED_LOAD_SCALE;\n\n\t\tif (local_group) {\n\t\t\tthis_load = avg_load;\n\t\t\tthis = group;\n\t\t\tthis_nr_running = sum_nr_running;\n\t\t\tthis_load_per_task = sum_weighted_load;\n\t\t} else if (avg_load > max_load &&\n\t\t\t sum_nr_running > group_capacity) {\n\t\t\tmax_load = avg_load;\n\t\t\tbusiest = group;\n\t\t\tbusiest_nr_running = sum_nr_running;\n\t\t\tbusiest_load_per_task = sum_weighted_load;\n\t\t}\n\n#if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT)\n\t\t/*\n\t\t * Busy processors will not participate in power savings\n\t\t * balance.\n\t\t */\n \t\tif (idle == NOT_IDLE || !(sd->flags & SD_POWERSAVINGS_BALANCE))\n \t\t\tgoto group_next;\n\n\t\t/*\n\t\t * If the local group is idle or completely loaded\n\t\t * no need to do power savings balance at this domain\n\t\t */\n\t\tif (local_group && (this_nr_running >= group_capacity ||\n\t\t\t\t !this_nr_running))\n\t\t\tpower_savings_balance = 0;\n\n \t\t/*\n\t\t * If a group is already running at full capacity or idle,\n\t\t * don't include that group in power savings calculations\n \t\t */\n \t\tif (!power_savings_balance || sum_nr_running >= group_capacity\n\t\t || !sum_nr_running)\n \t\t\tgoto group_next;\n\n \t\t/*\n\t\t * Calculate the group which has the least non-idle load.\n \t\t * This is the group from where we need to pick up the load\n \t\t * for saving power\n \t\t */\n \t\tif ((sum_nr_running < min_nr_running) ||\n \t\t (sum_nr_running == min_nr_running &&\n\t\t first_cpu(group->cpumask) <\n\t\t first_cpu(group_min->cpumask))) {\n \t\t\tgroup_min = group;\n \t\t\tmin_nr_running = sum_nr_running;\n\t\t\tmin_load_per_task = sum_weighted_load /\n\t\t\t\t\t\tsum_nr_running;\n \t\t}\n\n \t\t/*\n\t\t * Calculate the group which is almost near its\n \t\t * capacity but still has some space to pick up some load\n \t\t * from other group and save more power\n \t\t */\n \t\tif (sum_nr_running <= group_capacity - 1) {\n \t\t\tif (sum_nr_running > leader_nr_running ||\n \t\t\t (sum_nr_running == leader_nr_running &&\n \t\t\t first_cpu(group->cpumask) >\n \t\t\t first_cpu(group_leader->cpumask))) {\n \t\t\t\tgroup_leader = group;\n \t\t\t\tleader_nr_running = sum_nr_running;\n \t\t\t}\n\t\t}\ngroup_next:\n#endif\n\t\tgroup = group->next;\n\t} while (group != sd->groups);\n\n\tif (!busiest || this_load >= max_load || busiest_nr_running == 0)\n\t\tgoto out_balanced;\n\n\tavg_load = (SCHED_LOAD_SCALE * total_load) / total_pwr;\n\n\tif (this_load >= avg_load ||\n\t\t\t100*max_load <= sd->imbalance_pct*this_load)\n\t\tgoto out_balanced;\n\n\tbusiest_load_per_task /= busiest_nr_running;\n\t/*\n\t * We're trying to get all the cpus to the average_load, so we don't\n\t * want to push ourselves above the average load, nor do we wish to\n\t * reduce the max loaded cpu below the average load, as either of these\n\t * actions would just result in more rebalancing later, and ping-pong\n\t * tasks around. Thus we look for the minimum possible imbalance.\n\t * Negative imbalances (*we* are more loaded than anyone else) will\n\t * be counted as no imbalance for these purposes -- we can't fix that\n\t * by pulling tasks to us. Be careful of negative numbers as they'll\n\t * appear as very large values with unsigned longs.\n\t */\n\tif (max_load <= busiest_load_per_task)\n\t\tgoto out_balanced;\n\n\t/*\n\t * In the presence of smp nice balancing, certain scenarios can have\n\t * max load less than avg load(as we skip the groups at or below\n\t * its cpu_power, while calculating max_load..)\n\t */\n\tif (max_load < avg_load) {\n\t\t*imbalance = 0;\n\t\tgoto small_imbalance;\n\t}\n\n\t/* Don't want to pull so many tasks that a group would go idle */\n\tmax_pull = min(max_load - avg_load, max_load - busiest_load_per_task);\n\n\t/* How much load to actually move to equalise the imbalance */\n\t*imbalance = min(max_pull * busiest->__cpu_power,\n\t\t\t\t(avg_load - this_load) * this->__cpu_power)\n\t\t\t/ SCHED_LOAD_SCALE;\n\n\t/*\n\t * if *imbalance is less than the average load per runnable task\n\t * there is no gaurantee that any tasks will be moved so we'll have\n\t * a think about bumping its value to force at least one task to be\n\t * moved\n\t */\n\tif (*imbalance < busiest_load_per_task) {\n\t\tunsigned long tmp, pwr_now, pwr_move;\n\t\tunsigned int imbn;\n\nsmall_imbalance:\n\t\tpwr_move = pwr_now = 0;\n\t\timbn = 2;\n\t\tif (this_nr_running) {\n\t\t\tthis_load_per_task /= this_nr_running;\n\t\t\tif (busiest_load_per_task > this_load_per_task)\n\t\t\t\timbn = 1;\n\t\t} else\n\t\t\tthis_load_per_task = SCHED_LOAD_SCALE;\n\n\t\tif (max_load - this_load >= busiest_load_per_task * imbn) {\n\t\t\t*imbalance = busiest_load_per_task;\n\t\t\treturn busiest;\n\t\t}\n\n\t\t/*\n\t\t * OK, we don't have enough imbalance to justify moving tasks,\n\t\t * however we may be able to increase total CPU power used by\n\t\t * moving them.\n\t\t */\n\n\t\tpwr_now += busiest->__cpu_power *\n\t\t\t\tmin(busiest_load_per_task, max_load);\n\t\tpwr_now += this->__cpu_power *\n\t\t\t\tmin(this_load_per_task, this_load);\n\t\tpwr_now /= SCHED_LOAD_SCALE;\n\n\t\t/* Amount of load we'd subtract */\n\t\ttmp = sg_div_cpu_power(busiest,\n\t\t\t\tbusiest_load_per_task * SCHED_LOAD_SCALE);\n\t\tif (max_load > tmp)\n\t\t\tpwr_move += busiest->__cpu_power *\n\t\t\t\tmin(busiest_load_per_task, max_load - tmp);\n\n\t\t/* Amount of load we'd add */\n\t\tif (max_load * busiest->__cpu_power <\n\t\t\t\tbusiest_load_per_task * SCHED_LOAD_SCALE)\n\t\t\ttmp = sg_div_cpu_power(this,\n\t\t\t\t\tmax_load * busiest->__cpu_power);\n\t\telse\n\t\t\ttmp = sg_div_cpu_power(this,\n\t\t\t\tbusiest_load_per_task * SCHED_LOAD_SCALE);\n\t\tpwr_move += this->__cpu_power *\n\t\t\t\tmin(this_load_per_task, this_load + tmp);\n\t\tpwr_move /= SCHED_LOAD_SCALE;\n\n\t\t/* Move if we gain throughput */\n\t\tif (pwr_move <= pwr_now)\n\t\t\tgoto out_balanced;\n\n\t\t*imbalance = busiest_load_per_task;\n\t}\n\n\treturn busiest;\n\nout_balanced:\n#if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT)\n\tif (idle == NOT_IDLE || !(sd->flags & SD_POWERSAVINGS_BALANCE))\n\t\tgoto ret;\n\n\tif (this == group_leader && group_leader != group_min) {\n\t\t*imbalance = min_load_per_task;\n\t\treturn group_min;\n\t}\n#endif\nret:\n\t*imbalance = 0;\n\treturn NULL;\n}\n\n/*\n * find_busiest_queue - find the busiest runqueue among the cpus in group.\n */\nstatic struct rq *\nfind_busiest_queue(struct sched_group *group, enum idle_type idle,\n\t\t unsigned long imbalance, cpumask_t *cpus)\n{\n\tstruct rq *busiest = NULL, *rq;\n\tunsigned long max_load = 0;\n\tint i;\n\n\tfor_each_cpu_mask(i, group->cpumask) {\n\n\t\tif (!cpu_isset(i, *cpus))\n\t\t\tcontinue;\n\n\t\trq = cpu_rq(i);\n\n\t\tif (rq->nr_running == 1 && rq->raw_weighted_load > imbalance)\n\t\t\tcontinue;\n\n\t\tif (rq->raw_weighted_load > max_load) {\n\t\t\tmax_load = rq->raw_weighted_load;\n\t\t\tbusiest = rq;\n\t\t}\n\t}\n\n\treturn busiest;\n}\n\n/*\n * Max backoff if we encounter pinned tasks. Pretty arbitrary value, but\n * so long as it is large enough.\n */\n#define MAX_PINNED_INTERVAL\t512\n\nstatic inline unsigned long minus_1_or_zero(unsigned long n)\n{\n\treturn n > 0 ? n - 1 : 0;\n}\n\n/*\n * Check this_cpu to ensure it is balanced within domain. Attempt to move\n * tasks if there is an imbalance.\n */\nstatic int load_balance(int this_cpu, struct rq *this_rq,\n\t\t\tstruct sched_domain *sd, enum idle_type idle,\n\t\t\tint *balance)\n{\n\tint nr_moved, all_pinned = 0, active_balance = 0, sd_idle = 0;\n\tstruct sched_group *group;\n\tunsigned long imbalance;\n\tstruct rq *busiest;\n\tcpumask_t cpus = CPU_MASK_ALL;\n\tunsigned long flags;\n\n\t/*\n\t * When power savings policy is enabled for the parent domain, idle\n\t * sibling can pick up load irrespective of busy siblings. In this case,\n\t * let the state of idle sibling percolate up as IDLE, instead of\n\t * portraying it as NOT_IDLE.\n\t */\n\tif (idle != NOT_IDLE && sd->flags & SD_SHARE_CPUPOWER &&\n\t !test_sd_parent(sd, SD_POWERSAVINGS_BALANCE))\n\t\tsd_idle = 1;\n\n\tschedstat_inc(sd, lb_cnt[idle]);\n\nredo:\n\tgroup = find_busiest_group(sd, this_cpu, &imbalance, idle, &sd_idle,\n\t\t\t\t &cpus, balance);\n\n\tif (*balance == 0)\n\t\tgoto out_balanced;\n\n\tif (!group) {\n\t\tschedstat_inc(sd, lb_nobusyg[idle]);\n\t\tgoto out_balanced;\n\t}\n\n\tbusiest = find_busiest_queue(group, idle, imbalance, &cpus);\n\tif (!busiest) {\n\t\tschedstat_inc(sd, lb_nobusyq[idle]);\n\t\tgoto out_balanced;\n\t}\n\n\tBUG_ON(busiest == this_rq);\n\n\tschedstat_add(sd, lb_imbalance[idle], imbalance);\n\n\tnr_moved = 0;\n\tif (busiest->nr_running > 1) {\n\t\t/*\n\t\t * Attempt to move tasks. If find_busiest_group has found\n\t\t * an imbalance but busiest->nr_running <= 1, the group is\n\t\t * still unbalanced. nr_moved simply stays zero, so it is\n\t\t * correctly treated as an imbalance.\n\t\t */\n\t\tlocal_irq_save(flags);\n\t\tdouble_rq_lock(this_rq, busiest);\n\t\tnr_moved = move_tasks(this_rq, this_cpu, busiest,\n\t\t\t\t minus_1_or_zero(busiest->nr_running),\n\t\t\t\t imbalance, sd, idle, &all_pinned);\n\t\tdouble_rq_unlock(this_rq, busiest);\n\t\tlocal_irq_restore(flags);\n\n\t\t/*\n\t\t * some other cpu did the load balance for us.\n\t\t */\n\t\tif (nr_moved && this_cpu != smp_processor_id())\n\t\t\tresched_cpu(this_cpu);\n\n\t\t/* All tasks on this runqueue were pinned by CPU affinity */\n\t\tif (unlikely(all_pinned)) {\n\t\t\tcpu_clear(cpu_of(busiest), cpus);\n\t\t\tif (!cpus_empty(cpus))\n\t\t\t\tgoto redo;\n\t\t\tgoto out_balanced;\n\t\t}\n\t}\n\n\tif (!nr_moved) {\n\t\tschedstat_inc(sd, lb_failed[idle]);\n\t\tsd->nr_balance_failed++;\n\n\t\tif (unlikely(sd->nr_balance_failed > sd->cache_nice_tries+2)) {\n\n\t\t\tspin_lock_irqsave(&busiest->lock, flags);\n\n\t\t\t/* don't kick the migration_thread, if the curr\n\t\t\t * task on busiest cpu can't be moved to this_cpu\n\t\t\t */\n\t\t\tif (!cpu_isset(this_cpu, busiest->curr->cpus_allowed)) {\n\t\t\t\tspin_unlock_irqrestore(&busiest->lock, flags);\n\t\t\t\tall_pinned = 1;\n\t\t\t\tgoto out_one_pinned;\n\t\t\t}\n\n\t\t\tif (!busiest->active_balance) {\n\t\t\t\tbusiest->active_balance = 1;\n\t\t\t\tbusiest->push_cpu = this_cpu;\n\t\t\t\tactive_balance = 1;\n\t\t\t}\n\t\t\tspin_unlock_irqrestore(&busiest->lock, flags);\n\t\t\tif (active_balance)\n\t\t\t\twake_up_process(busiest->migration_thread);\n\n\t\t\t/*\n\t\t\t * We've kicked active balancing, reset the failure\n\t\t\t * counter.\n\t\t\t */\n\t\t\tsd->nr_balance_failed = sd->cache_nice_tries+1;\n\t\t}\n\t} else\n\t\tsd->nr_balance_failed = 0;\n\n\tif (likely(!active_balance)) {\n\t\t/* We were unbalanced, so reset the balancing interval */\n\t\tsd->balance_interval = sd->min_interval;\n\t} else {\n\t\t/*\n\t\t * If we've begun active balancing, start to back off. This\n\t\t * case may not be covered by the all_pinned logic if there\n\t\t * is only 1 task on the busy runqueue (because we don't call\n\t\t * move_tasks).\n\t\t */\n\t\tif (sd->balance_interval < sd->max_interval)\n\t\t\tsd->balance_interval *= 2;\n\t}\n\n\tif (!nr_moved && !sd_idle && sd->flags & SD_SHARE_CPUPOWER &&\n\t !test_sd_parent(sd, SD_POWERSAVINGS_BALANCE))\n\t\treturn -1;\n\treturn nr_moved;\n\nout_balanced:\n\tschedstat_inc(sd, lb_balanced[idle]);\n\n\tsd->nr_balance_failed = 0;\n\nout_one_pinned:\n\t/* tune up the balancing interval */\n\tif ((all_pinned && sd->balance_interval < MAX_PINNED_INTERVAL) ||\n\t\t\t(sd->balance_interval < sd->max_interval))\n\t\tsd->balance_interval *= 2;\n\n\tif (!sd_idle && sd->flags & SD_SHARE_CPUPOWER &&\n\t !test_sd_parent(sd, SD_POWERSAVINGS_BALANCE))\n\t\treturn -1;\n\treturn 0;\n}\n\n/*\n * Check this_cpu to ensure it is balanced within domain. Attempt to move\n * tasks if there is an imbalance.\n *\n * Called from schedule when this_rq is about to become idle (NEWLY_IDLE).\n * this_rq is locked.\n */\nstatic int\nload_balance_newidle(int this_cpu, struct rq *this_rq, struct sched_domain *sd)\n{\n\tstruct sched_group *group;\n\tstruct rq *busiest = NULL;\n\tunsigned long imbalance;\n\tint nr_moved = 0;\n\tint sd_idle = 0;\n\tcpumask_t cpus = CPU_MASK_ALL;\n\n\t/*\n\t * When power savings policy is enabled for the parent domain, idle\n\t * sibling can pick up load irrespective of busy siblings. In this case,\n\t * let the state of idle sibling percolate up as IDLE, instead of\n\t * portraying it as NOT_IDLE.\n\t */\n\tif (sd->flags & SD_SHARE_CPUPOWER &&\n\t !test_sd_parent(sd, SD_POWERSAVINGS_BALANCE))\n\t\tsd_idle = 1;\n\n\tschedstat_inc(sd, lb_cnt[NEWLY_IDLE]);\nredo:\n\tgroup = find_busiest_group(sd, this_cpu, &imbalance, NEWLY_IDLE,\n\t\t\t\t &sd_idle, &cpus, NULL);\n\tif (!group) {\n\t\tschedstat_inc(sd, lb_nobusyg[NEWLY_IDLE]);\n\t\tgoto out_balanced;\n\t}\n\n\tbusiest = find_busiest_queue(group, NEWLY_IDLE, imbalance,\n\t\t\t\t&cpus);\n\tif (!busiest) {\n\t\tschedstat_inc(sd, lb_nobusyq[NEWLY_IDLE]);\n\t\tgoto out_balanced;\n\t}\n\n\tBUG_ON(busiest == this_rq);\n\n\tschedstat_add(sd, lb_imbalance[NEWLY_IDLE], imbalance);\n\n\tnr_moved = 0;\n\tif (busiest->nr_running > 1) {\n\t\t/* Attempt to move tasks */\n\t\tdouble_lock_balance(this_rq, busiest);\n\t\tnr_moved = move_tasks(this_rq, this_cpu, busiest,\n\t\t\t\t\tminus_1_or_zero(busiest->nr_running),\n\t\t\t\t\timbalance, sd, NEWLY_IDLE, NULL);\n\t\tspin_unlock(&busiest->lock);\n\n\t\tif (!nr_moved) {\n\t\t\tcpu_clear(cpu_of(busiest), cpus);\n\t\t\tif (!cpus_empty(cpus))\n\t\t\t\tgoto redo;\n\t\t}\n\t}\n\n\tif (!nr_moved) {\n\t\tschedstat_inc(sd, lb_failed[NEWLY_IDLE]);\n\t\tif (!sd_idle && sd->flags & SD_SHARE_CPUPOWER &&\n\t\t !test_sd_parent(sd, SD_POWERSAVINGS_BALANCE))\n\t\t\treturn -1;\n\t} else\n\t\tsd->nr_balance_failed = 0;\n\n\treturn nr_moved;\n\nout_balanced:\n\tschedstat_inc(sd, lb_balanced[NEWLY_IDLE]);\n\tif (!sd_idle && sd->flags & SD_SHARE_CPUPOWER &&\n\t !test_sd_parent(sd, SD_POWERSAVINGS_BALANCE))\n\t\treturn -1;\n\tsd->nr_balance_failed = 0;\n\n\treturn 0;\n}\n\n/*\n * idle_balance is called by schedule() if this_cpu is about to become\n * idle. Attempts to pull tasks from other CPUs.\n */\nstatic void idle_balance(int this_cpu, struct rq *this_rq)\n{\n\tstruct sched_domain *sd;\n\tint pulled_task = 0;\n\tunsigned long next_balance = jiffies + 60 * HZ;\n\n\tfor_each_domain(this_cpu, sd) {\n\t\tunsigned long interval;\n\n\t\tif (!(sd->flags & SD_LOAD_BALANCE))\n\t\t\tcontinue;\n\n\t\tif (sd->flags & SD_BALANCE_NEWIDLE)\n\t\t\t/* If we've pulled tasks over stop searching: */\n\t\t\tpulled_task = load_balance_newidle(this_cpu,\n\t\t\t\t\t\t\t\tthis_rq, sd);\n\n\t\tinterval = msecs_to_jiffies(sd->balance_interval);\n\t\tif (time_after(next_balance, sd->last_balance + interval))\n\t\t\tnext_balance = sd->last_balance + interval;\n\t\tif (pulled_task)\n\t\t\tbreak;\n\t}\n\tif (!pulled_task)\n\t\t/*\n\t\t * We are going idle. next_balance may be set based on\n\t\t * a busy processor. So reset next_balance.\n\t\t */\n\t\tthis_rq->next_balance = next_balance;\n}\n\n/*\n * active_load_balance is run by migration threads. It pushes running tasks\n * off the busiest CPU onto idle CPUs. It requires at least 1 task to be\n * running on each physical CPU where possible, and avoids physical /\n * logical imbalances.\n *\n * Called with busiest_rq locked.\n */\nstatic void active_load_balance(struct rq *busiest_rq, int busiest_cpu)\n{\n\tint target_cpu = busiest_rq->push_cpu;\n\tstruct sched_domain *sd;\n\tstruct rq *target_rq;\n\n\t/* Is there any task to move? */\n\tif (busiest_rq->nr_running <= 1)\n\t\treturn;\n\n\ttarget_rq = cpu_rq(target_cpu);\n\n\t/*\n\t * This condition is \"impossible\", if it occurs\n\t * we need to fix it. Originally reported by\n\t * Bjorn Helgaas on a 128-cpu setup.\n\t */\n\tBUG_ON(busiest_rq == target_rq);\n\n\t/* move a task from busiest_rq to target_rq */\n\tdouble_lock_balance(busiest_rq, target_rq);\n\n\t/* Search for an sd spanning us and the target CPU. */\n\tfor_each_domain(target_cpu, sd) {\n\t\tif ((sd->flags & SD_LOAD_BALANCE) &&\n\t\t cpu_isset(busiest_cpu, sd->span))\n\t\t\t\tbreak;\n\t}\n\n\tif (likely(sd)) {\n\t\tschedstat_inc(sd, alb_cnt);\n\n\t\tif (move_tasks(target_rq, target_cpu, busiest_rq, 1,\n\t\t\t RTPRIO_TO_LOAD_WEIGHT(100), sd, SCHED_IDLE,\n\t\t\t NULL))\n\t\t\tschedstat_inc(sd, alb_pushed);\n\t\telse\n\t\t\tschedstat_inc(sd, alb_failed);\n\t}\n\tspin_unlock(&target_rq->lock);\n}\n\nstatic void update_load(struct rq *this_rq)\n{\n\tunsigned long this_load;\n\tunsigned int i, scale;\n\n\tthis_load = this_rq->raw_weighted_load;\n\n\t/* Update our load: */\n\tfor (i = 0, scale = 1; i < 3; i++, scale += scale) {\n\t\tunsigned long old_load, new_load;\n\n\t\t/* scale is effectively 1 << i now, and >> i divides by scale */\n\n\t\told_load = this_rq->cpu_load[i];\n\t\tnew_load = this_load;\n\t\t/*\n\t\t * Round up the averaging division if load is increasing. This\n\t\t * prevents us from getting stuck on 9 if the load is 10, for\n\t\t * example.\n\t\t */\n\t\tif (new_load > old_load)\n\t\t\tnew_load += scale-1;\n\t\tthis_rq->cpu_load[i] = (old_load*(scale-1) + new_load) >> i;\n\t}\n}\n\n#ifdef CONFIG_NO_HZ\nstatic struct {\n\tatomic_t load_balancer;\n\tcpumask_t cpu_mask;\n} nohz ____cacheline_aligned = {\n\t.load_balancer = ATOMIC_INIT(-1),\n\t.cpu_mask = CPU_MASK_NONE,\n};\n\n/*\n * This routine will try to nominate the ilb (idle load balancing)\n * owner among the cpus whose ticks are stopped. ilb owner will do the idle\n * load balancing on behalf of all those cpus. If all the cpus in the system\n * go into this tickless mode, then there will be no ilb owner (as there is\n * no need for one) and all the cpus will sleep till the next wakeup event\n * arrives...\n *\n * For the ilb owner, tick is not stopped. And this tick will be used\n * for idle load balancing. ilb owner will still be part of\n * nohz.cpu_mask..\n *\n * While stopping the tick, this cpu will become the ilb owner if there\n * is no other owner. And will be the owner till that cpu becomes busy\n * or if all cpus in the system stop their ticks at which point\n * there is no need for ilb owner.\n *\n * When the ilb owner becomes busy, it nominates another owner, during the\n * next busy scheduler_tick()\n */\nint select_nohz_load_balancer(int stop_tick)\n{\n\tint cpu = smp_processor_id();\n\n\tif (stop_tick) {\n\t\tcpu_set(cpu, nohz.cpu_mask);\n\t\tcpu_rq(cpu)->in_nohz_recently = 1;\n\n\t\t/*\n\t\t * If we are going offline and still the leader, give up!\n\t\t */\n\t\tif (cpu_is_offline(cpu) &&\n\t\t atomic_read(&nohz.load_balancer) == cpu) {\n\t\t\tif (atomic_cmpxchg(&nohz.load_balancer, cpu, -1) != cpu)\n\t\t\t\tBUG();\n\t\t\treturn 0;\n\t\t}\n\n\t\t/* time for ilb owner also to sleep */\n\t\tif (cpus_weight(nohz.cpu_mask) == num_online_cpus()) {\n\t\t\tif (atomic_read(&nohz.load_balancer) == cpu)\n\t\t\t\tatomic_set(&nohz.load_balancer, -1);\n\t\t\treturn 0;\n\t\t}\n\n\t\tif (atomic_read(&nohz.load_balancer) == -1) {\n\t\t\t/* make me the ilb owner */\n\t\t\tif (atomic_cmpxchg(&nohz.load_balancer, -1, cpu) == -1)\n\t\t\t\treturn 1;\n\t\t} else if (atomic_read(&nohz.load_balancer) == cpu)\n\t\t\treturn 1;\n\t} else {\n\t\tif (!cpu_isset(cpu, nohz.cpu_mask))\n\t\t\treturn 0;\n\n\t\tcpu_clear(cpu, nohz.cpu_mask);\n\n\t\tif (atomic_read(&nohz.load_balancer) == cpu)\n\t\t\tif (atomic_cmpxchg(&nohz.load_balancer, cpu, -1) != cpu)\n\t\t\t\tBUG();\n\t}\n\treturn 0;\n}\n#endif\n\nstatic DEFINE_SPINLOCK(balancing);\n\n/*\n * It checks each scheduling domain to see if it is due to be balanced,\n * and initiates a balancing operation if so.\n *\n * Balancing parameters are set up in arch_init_sched_domains.\n */\nstatic inline void rebalance_domains(int cpu, enum idle_type idle)\n{\n\tint balance = 1;\n\tstruct rq *rq = cpu_rq(cpu);\n\tunsigned long interval;\n\tstruct sched_domain *sd;\n\t/* Earliest time when we have to do rebalance again */\n\tunsigned long next_balance = jiffies + 60*HZ;\n\n\tfor_each_domain(cpu, sd) {\n\t\tif (!(sd->flags & SD_LOAD_BALANCE))\n\t\t\tcontinue;\n\n\t\tinterval = sd->balance_interval;\n\t\tif (idle != SCHED_IDLE)\n\t\t\tinterval *= sd->busy_factor;\n\n\t\t/* scale ms to jiffies */\n\t\tinterval = msecs_to_jiffies(interval);\n\t\tif (unlikely(!interval))\n\t\t\tinterval = 1;\n\n\t\tif (sd->flags & SD_SERIALIZE) {\n\t\t\tif (!spin_trylock(&balancing))\n\t\t\t\tgoto out;\n\t\t}\n\n\t\tif (time_after_eq(jiffies, sd->last_balance + interval)) {\n\t\t\tif (load_balance(cpu, rq, sd, idle, &balance)) {\n\t\t\t\t/*\n\t\t\t\t * We've pulled tasks over so either we're no\n\t\t\t\t * longer idle, or one of our SMT siblings is\n\t\t\t\t * not idle.\n\t\t\t\t */\n\t\t\t\tidle = NOT_IDLE;\n\t\t\t}\n\t\t\tsd->last_balance = jiffies;\n\t\t}\n\t\tif (sd->flags & SD_SERIALIZE)\n\t\t\tspin_unlock(&balancing);\nout:\n\t\tif (time_after(next_balance, sd->last_balance + interval))\n\t\t\tnext_balance = sd->last_balance + interval;\n\n\t\t/*\n\t\t * Stop the load balance at this level. There is another\n\t\t * CPU in our sched group which is doing load balancing more\n\t\t * actively.\n\t\t */\n\t\tif (!balance)\n\t\t\tbreak;\n\t}\n\trq->next_balance = next_balance;\n}\n\n/*\n * run_rebalance_domains is triggered when needed from the scheduler tick.\n * In CONFIG_NO_HZ case, the idle load balance owner will do the\n * rebalancing for all the cpus for whom scheduler ticks are stopped.\n */\nstatic void run_rebalance_domains(struct softirq_action *h)\n{\n\tint local_cpu = smp_processor_id();\n\tstruct rq *local_rq = cpu_rq(local_cpu);\n\tenum idle_type idle = local_rq->idle_at_tick ? SCHED_IDLE : NOT_IDLE;\n\n\trebalance_domains(local_cpu, idle);\n\n#ifdef CONFIG_NO_HZ\n\t/*\n\t * If this cpu is the owner for idle load balancing, then do the\n\t * balancing on behalf of the other idle cpus whose ticks are\n\t * stopped.\n\t */\n\tif (local_rq->idle_at_tick &&\n\t atomic_read(&nohz.load_balancer) == local_cpu) {\n\t\tcpumask_t cpus = nohz.cpu_mask;\n\t\tstruct rq *rq;\n\t\tint balance_cpu;\n\n\t\tcpu_clear(local_cpu, cpus);\n\t\tfor_each_cpu_mask(balance_cpu, cpus) {\n\t\t\t/*\n\t\t\t * If this cpu gets work to do, stop the load balancing\n\t\t\t * work being done for other cpus. Next load\n\t\t\t * balancing owner will pick it up.\n\t\t\t */\n\t\t\tif (need_resched())\n\t\t\t\tbreak;\n\n\t\t\trebalance_domains(balance_cpu, SCHED_IDLE);\n\n\t\t\trq = cpu_rq(balance_cpu);\n\t\t\tif (time_after(local_rq->next_balance, rq->next_balance))\n\t\t\t\tlocal_rq->next_balance = rq->next_balance;\n\t\t}\n\t}\n#endif\n}\n\n/*\n * Trigger the SCHED_SOFTIRQ if it is time to do periodic load balancing.\n *\n * In case of CONFIG_NO_HZ, this is the place where we nominate a new\n * idle load balancing owner or decide to stop the periodic load balancing,\n * if the whole system is idle.\n */\nstatic inline void trigger_load_balance(int cpu)\n{\n\tstruct rq *rq = cpu_rq(cpu);\n#ifdef CONFIG_NO_HZ\n\t/*\n\t * If we were in the nohz mode recently and busy at the current\n\t * scheduler tick, then check if we need to nominate new idle\n\t * load balancer.\n\t */\n\tif (rq->in_nohz_recently && !rq->idle_at_tick) {\n\t\trq->in_nohz_recently = 0;\n\n\t\tif (atomic_read(&nohz.load_balancer) == cpu) {\n\t\t\tcpu_clear(cpu, nohz.cpu_mask);\n\t\t\tatomic_set(&nohz.load_balancer, -1);\n\t\t}\n\n\t\tif (atomic_read(&nohz.load_balancer) == -1) {\n\t\t\t/*\n\t\t\t * simple selection for now: Nominate the\n\t\t\t * first cpu in the nohz list to be the next\n\t\t\t * ilb owner.\n\t\t\t *\n\t\t\t * TBD: Traverse the sched domains and nominate\n\t\t\t * the nearest cpu in the nohz.cpu_mask.\n\t\t\t */\n\t\t\tint ilb = first_cpu(nohz.cpu_mask);\n\n\t\t\tif (ilb != NR_CPUS)\n\t\t\t\tresched_cpu(ilb);\n\t\t}\n\t}\n\n\t/*\n\t * If this cpu is idle and doing idle load balancing for all the\n\t * cpus with ticks stopped, is it time for that to stop?\n\t */\n\tif (rq->idle_at_tick && atomic_read(&nohz.load_balancer) == cpu &&\n\t cpus_weight(nohz.cpu_mask) == num_online_cpus()) {\n\t\tresched_cpu(cpu);\n\t\treturn;\n\t}\n\n\t/*\n\t * If this cpu is idle and the idle load balancing is done by\n\t * someone else, then no need raise the SCHED_SOFTIRQ\n\t */\n\tif (rq->idle_at_tick && atomic_read(&nohz.load_balancer) != cpu &&\n\t cpu_isset(cpu, nohz.cpu_mask))\n\t\treturn;\n#endif\n\tif (time_after_eq(jiffies, rq->next_balance))\n\t\traise_softirq(SCHED_SOFTIRQ);\n}\n#else\n/*\n * on UP we do not need to balance between CPUs:\n */\nstatic inline void idle_balance(int cpu, struct rq *rq)\n{\n}\n#endif\n\nDEFINE_PER_CPU(struct kernel_stat, kstat);\n\nEXPORT_PER_CPU_SYMBOL(kstat);\n\n/*\n * This is called on clock ticks and on context switches.\n * Bank in p->sched_time the ns elapsed since the last tick or switch.\n */\nstatic inline void\nupdate_cpu_clock(struct task_struct *p, struct rq *rq, unsigned long long now)\n{\n\tp->sched_time += now - p->last_ran;\n\tp->last_ran = rq->most_recent_timestamp = now;\n}\n\n/*\n * Return current->sched_time plus any more ns on the sched_clock\n * that have not yet been banked.\n */\nunsigned long long current_sched_time(const struct task_struct *p)\n{\n\tunsigned long long ns;\n\tunsigned long flags;\n\n\tlocal_irq_save(flags);\n\tns = p->sched_time + sched_clock() - p->last_ran;\n\tlocal_irq_restore(flags);\n\n\treturn ns;\n}\n\n/*\n * We place interactive tasks back into the active array, if possible.\n *\n * To guarantee that this does not starve expired tasks we ignore the\n * interactivity of a task if the first expired task had to wait more\n * than a 'reasonable' amount of time. This deadline timeout is\n * load-dependent, as the frequency of array switched decreases with\n * increasing number of running tasks. We also ignore the interactivity\n * if a better static_prio task has expired:\n */\nstatic inline int expired_starving(struct rq *rq)\n{\n\tif (rq->curr->static_prio > rq->best_expired_prio)\n\t\treturn 1;\n\tif (!STARVATION_LIMIT || !rq->expired_timestamp)\n\t\treturn 0;\n\tif (jiffies - rq->expired_timestamp > STARVATION_LIMIT * rq->nr_running)\n\t\treturn 1;\n\treturn 0;\n}\n\n/*\n * Account user cpu time to a process.\n * @p: the process that the cpu time gets accounted to\n * @hardirq_offset: the offset to subtract from hardirq_count()\n * @cputime: the cpu time spent in user space since the last update\n */\nvoid account_user_time(struct task_struct *p, cputime_t cputime)\n{\n\tstruct cpu_usage_stat *cpustat = &kstat_this_cpu.cpustat;\n\tcputime64_t tmp;\n\n\tp->utime = cputime_add(p->utime, cputime);\n\n\t/* Add user time to cpustat. */\n\ttmp = cputime_to_cputime64(cputime);\n\tif (TASK_NICE(p) > 0)\n\t\tcpustat->nice = cputime64_add(cpustat->nice, tmp);\n\telse\n\t\tcpustat->user = cputime64_add(cpustat->user, tmp);\n}\n\n/*\n * Account system cpu time to a process.\n * @p: the process that the cpu time gets accounted to\n * @hardirq_offset: the offset to subtract from hardirq_count()\n * @cputime: the cpu time spent in kernel space since the last update\n */\nvoid account_system_time(struct task_struct *p, int hardirq_offset,\n\t\t\t cputime_t cputime)\n{\n\tstruct cpu_usage_stat *cpustat = &kstat_this_cpu.cpustat;\n\tstruct rq *rq = this_rq();\n\tcputime64_t tmp;\n\n\tp->stime = cputime_add(p->stime, cputime);\n\n\t/* Add system time to cpustat. */\n\ttmp = cputime_to_cputime64(cputime);\n\tif (hardirq_count() - hardirq_offset)\n\t\tcpustat->irq = cputime64_add(cpustat->irq, tmp);\n\telse if (softirq_count())\n\t\tcpustat->softirq = cputime64_add(cpustat->softirq, tmp);\n\telse if (p != rq->idle)\n\t\tcpustat->system = cputime64_add(cpustat->system, tmp);\n\telse if (atomic_read(&rq->nr_iowait) > 0)\n\t\tcpustat->iowait = cputime64_add(cpustat->iowait, tmp);\n\telse\n\t\tcpustat->idle = cputime64_add(cpustat->idle, tmp);\n\t/* Account for system time used */\n\tacct_update_integrals(p);\n}\n\n/*\n * Account for involuntary wait time.\n * @p: the process from which the cpu time has been stolen\n * @steal: the cpu time spent in involuntary wait\n */\nvoid account_steal_time(struct task_struct *p, cputime_t steal)\n{\n\tstruct cpu_usage_stat *cpustat = &kstat_this_cpu.cpustat;\n\tcputime64_t tmp = cputime_to_cputime64(steal);\n\tstruct rq *rq = this_rq();\n\n\tif (p == rq->idle) {\n\t\tp->stime = cputime_add(p->stime, steal);\n\t\tif (atomic_read(&rq->nr_iowait) > 0)\n\t\t\tcpustat->iowait = cputime64_add(cpustat->iowait, tmp);\n\t\telse\n\t\t\tcpustat->idle = cputime64_add(cpustat->idle, tmp);\n\t} else\n\t\tcpustat->steal = cputime64_add(cpustat->steal, tmp);\n}\n\nstatic void task_running_tick(struct rq *rq, struct task_struct *p)\n{\n\tif (p->array != rq->active) {\n\t\t/* Task has expired but was not scheduled yet */\n\t\tset_tsk_need_resched(p);\n\t\treturn;\n\t}\n\tspin_lock(&rq->lock);\n\t/*\n\t * The task was running during this tick - update the\n\t * time slice counter. Note: we do not update a thread's\n\t * priority until it either goes to sleep or uses up its\n\t * timeslice. This makes it possible for interactive tasks\n\t * to use up their timeslices at their highest priority levels.\n\t */\n\tif (rt_task(p)) {\n\t\t/*\n\t\t * RR tasks need a special form of timeslice management.\n\t\t * FIFO tasks have no timeslices.\n\t\t */\n\t\tif ((p->policy == SCHED_RR) && !--p->time_slice) {\n\t\t\tp->time_slice = task_timeslice(p);\n\t\t\tp->first_time_slice = 0;\n\t\t\tset_tsk_need_resched(p);\n\n\t\t\t/* put it at the end of the queue: */\n\t\t\trequeue_task(p, rq->active);\n\t\t}\n\t\tgoto out_unlock;\n\t}\n\tif (!--p->time_slice) {\n\t\tdequeue_task(p, rq->active);\n\t\tset_tsk_need_resched(p);\n\t\tp->prio = effective_prio(p);\n\t\tp->time_slice = task_timeslice(p);\n\t\tp->first_time_slice = 0;\n\n\t\tif (!rq->expired_timestamp)\n\t\t\trq->expired_timestamp = jiffies;\n\t\tif (!TASK_INTERACTIVE(p) || expired_starving(rq)) {\n\t\t\tenqueue_task(p, rq->expired);\n\t\t\tif (p->static_prio < rq->best_expired_prio)\n\t\t\t\trq->best_expired_prio = p->static_prio;\n\t\t} else\n\t\t\tenqueue_task(p, rq->active);\n\t} else {\n\t\t/*\n\t\t * Prevent a too long timeslice allowing a task to monopolize\n\t\t * the CPU. We do this by splitting up the timeslice into\n\t\t * smaller pieces.\n\t\t *\n\t\t * Note: this does not mean the task's timeslices expire or\n\t\t * get lost in any way, they just might be preempted by\n\t\t * another task of equal priority. (one with higher\n\t\t * priority would have preempted this task already.) We\n\t\t * requeue this task to the end of the list on this priority\n\t\t * level, which is in essence a round-robin of tasks with\n\t\t * equal priority.\n\t\t *\n\t\t * This only applies to tasks in the interactive\n\t\t * delta range with at least TIMESLICE_GRANULARITY to requeue.\n\t\t */\n\t\tif (TASK_INTERACTIVE(p) && !((task_timeslice(p) -\n\t\t\tp->time_slice) % TIMESLICE_GRANULARITY(p)) &&\n\t\t\t(p->time_slice >= TIMESLICE_GRANULARITY(p)) &&\n\t\t\t(p->array == rq->active)) {\n\n\t\t\trequeue_task(p, rq->active);\n\t\t\tset_tsk_need_resched(p);\n\t\t}\n\t}\nout_unlock:\n\tspin_unlock(&rq->lock);\n}\n\n/*\n * This function gets called by the timer code, with HZ frequency.\n * We call it with interrupts disabled.\n *\n * It also gets called by the fork code, when changing the parent's\n * timeslices.\n */\nvoid scheduler_tick(void)\n{\n\tunsigned long long now = sched_clock();\n\tstruct task_struct *p = current;\n\tint cpu = smp_processor_id();\n\tint idle_at_tick = idle_cpu(cpu);\n\tstruct rq *rq = cpu_rq(cpu);\n\n\tupdate_cpu_clock(p, rq, now);\n\n\tif (!idle_at_tick)\n\t\ttask_running_tick(rq, p);\n#ifdef CONFIG_SMP\n\tupdate_load(rq);\n\trq->idle_at_tick = idle_at_tick;\n\ttrigger_load_balance(cpu);\n#endif\n}\n\n#if defined(CONFIG_PREEMPT) && defined(CONFIG_DEBUG_PREEMPT)\n\nvoid fastcall add_preempt_count(int val)\n{\n\t/*\n\t * Underflow?\n\t */\n\tif (DEBUG_LOCKS_WARN_ON((preempt_count() < 0)))\n\t\treturn;\n\tpreempt_count() += val;\n\t/*\n\t * Spinlock count overflowing soon?\n\t */\n\tDEBUG_LOCKS_WARN_ON((preempt_count() & PREEMPT_MASK) >=\n\t\t\t\tPREEMPT_MASK - 10);\n}\nEXPORT_SYMBOL(add_preempt_count);\n\nvoid fastcall sub_preempt_count(int val)\n{\n\t/*\n\t * Underflow?\n\t */\n\tif (DEBUG_LOCKS_WARN_ON(val > preempt_count()))\n\t\treturn;\n\t/*\n\t * Is the spinlock portion underflowing?\n\t */\n\tif (DEBUG_LOCKS_WARN_ON((val < PREEMPT_MASK) &&\n\t\t\t!(preempt_count() & PREEMPT_MASK)))\n\t\treturn;\n\n\tpreempt_count() -= val;\n}\nEXPORT_SYMBOL(sub_preempt_count);\n\n#endif\n\nstatic inline int interactive_sleep(enum sleep_type sleep_type)\n{\n\treturn (sleep_type == SLEEP_INTERACTIVE ||\n\t\tsleep_type == SLEEP_INTERRUPTED);\n}\n\n/*\n * schedule() is the main scheduler function.\n */\nasmlinkage void __sched schedule(void)\n{\n\tstruct task_struct *prev, *next;\n\tstruct prio_array *array;\n\tstruct list_head *queue;\n\tunsigned long long now;\n\tunsigned long run_time;\n\tint cpu, idx, new_prio;\n\tlong *switch_count;\n\tstruct rq *rq;\n\n\t/*\n\t * Test if we are atomic. Since do_exit() needs to call into\n\t * schedule() atomically, we ignore that path for now.\n\t * Otherwise, whine if we are scheduling when we should not be.\n\t */\n\tif (unlikely(in_atomic() && !current->exit_state)) {\n\t\tprintk(KERN_ERR \"BUG: scheduling while atomic: \"\n\t\t\t\"%s/0x%08x/%d\\n\",\n\t\t\tcurrent->comm, preempt_count(), current->pid);\n\t\tdebug_show_held_locks(current);\n\t\tif (irqs_disabled())\n\t\t\tprint_irqtrace_events(current);\n\t\tdump_stack();\n\t}\n\tprofile_hit(SCHED_PROFILING, __builtin_return_address(0));\n\nneed_resched:\n\tpreempt_disable();\n\tprev = current;\n\trelease_kernel_lock(prev);\nneed_resched_nonpreemptible:\n\trq = this_rq();\n\n\t/*\n\t * The idle thread is not allowed to schedule!\n\t * Remove this check after it has been exercised a bit.\n\t */\n\tif (unlikely(prev == rq->idle) && prev->state != TASK_RUNNING) {\n\t\tprintk(KERN_ERR \"bad: scheduling from the idle thread!\\n\");\n\t\tdump_stack();\n\t}\n\n\tschedstat_inc(rq, sched_cnt);\n\tnow = sched_clock();\n\tif (likely((long long)(now - prev->timestamp) < NS_MAX_SLEEP_AVG)) {\n\t\trun_time = now - prev->timestamp;\n\t\tif (unlikely((long long)(now - prev->timestamp) < 0))\n\t\t\trun_time = 0;\n\t} else\n\t\trun_time = NS_MAX_SLEEP_AVG;\n\n\t/*\n\t * Tasks charged proportionately less run_time at high sleep_avg to\n\t * delay them losing their interactive status\n\t */\n\trun_time /= (CURRENT_BONUS(prev) ? : 1);\n\n\tspin_lock_irq(&rq->lock);\n\n\tswitch_count = &prev->nivcsw;\n\tif (prev->state && !(preempt_count() & PREEMPT_ACTIVE)) {\n\t\tswitch_count = &prev->nvcsw;\n\t\tif (unlikely((prev->state & TASK_INTERRUPTIBLE) &&\n\t\t\t\tunlikely(signal_pending(prev))))\n\t\t\tprev->state = TASK_RUNNING;\n\t\telse {\n\t\t\tif (prev->state == TASK_UNINTERRUPTIBLE)\n\t\t\t\trq->nr_uninterruptible++;\n\t\t\tdeactivate_task(prev, rq);\n\t\t}\n\t}\n\n\tcpu = smp_processor_id();\n\tif (unlikely(!rq->nr_running)) {\n\t\tidle_balance(cpu, rq);\n\t\tif (!rq->nr_running) {\n\t\t\tnext = rq->idle;\n\t\t\trq->expired_timestamp = 0;\n\t\t\tgoto switch_tasks;\n\t\t}\n\t}\n\n\tarray = rq->active;\n\tif (unlikely(!array->nr_active)) {\n\t\t/*\n\t\t * Switch the active and expired arrays.\n\t\t */\n\t\tschedstat_inc(rq, sched_switch);\n\t\trq->active = rq->expired;\n\t\trq->expired = array;\n\t\tarray = rq->active;\n\t\trq->expired_timestamp = 0;\n\t\trq->best_expired_prio = MAX_PRIO;\n\t}\n\n\tidx = sched_find_first_bit(array->bitmap);\n\tqueue = array->queue + idx;\n\tnext = list_entry(queue->next, struct task_struct, run_list);\n\n\tif (!rt_task(next) && interactive_sleep(next->sleep_type)) {\n\t\tunsigned long long delta = now - next->timestamp;\n\t\tif (unlikely((long long)(now - next->timestamp) < 0))\n\t\t\tdelta = 0;\n\n\t\tif (next->sleep_type == SLEEP_INTERACTIVE)\n\t\t\tdelta = delta * (ON_RUNQUEUE_WEIGHT * 128 / 100) / 128;\n\n\t\tarray = next->array;\n\t\tnew_prio = recalc_task_prio(next, next->timestamp + delta);\n\n\t\tif (unlikely(next->prio != new_prio)) {\n\t\t\tdequeue_task(next, array);\n\t\t\tnext->prio = new_prio;\n\t\t\tenqueue_task(next, array);\n\t\t}\n\t}\n\tnext->sleep_type = SLEEP_NORMAL;\nswitch_tasks:\n\tif (next == rq->idle)\n\t\tschedstat_inc(rq, sched_goidle);\n\tprefetch(next);\n\tprefetch_stack(next);\n\tclear_tsk_need_resched(prev);\n\trcu_qsctr_inc(task_cpu(prev));\n\n\tupdate_cpu_clock(prev, rq, now);\n\n\tprev->sleep_avg -= run_time;\n\tif ((long)prev->sleep_avg <= 0)\n\t\tprev->sleep_avg = 0;\n\tprev->timestamp = prev->last_ran = now;\n\n\tsched_info_switch(prev, next);\n\tif (likely(prev != next)) {\n\t\tnext->timestamp = next->last_ran = now;\n\t\trq->nr_switches++;\n\t\trq->curr = next;\n\t\t++*switch_count;\n\n\t\tprepare_task_switch(rq, next);\n\t\tprev = context_switch(rq, prev, next);\n\t\tbarrier();\n\t\t/*\n\t\t * this_rq must be evaluated again because prev may have moved\n\t\t * CPUs since it called schedule(), thus the 'rq' on its stack\n\t\t * frame will be invalid.\n\t\t */\n\t\tfinish_task_switch(this_rq(), prev);\n\t} else\n\t\tspin_unlock_irq(&rq->lock);\n\n\tprev = current;\n\tif (unlikely(reacquire_kernel_lock(prev) < 0))\n\t\tgoto need_resched_nonpreemptible;\n\tpreempt_enable_no_resched();\n\tif (unlikely(test_thread_flag(TIF_NEED_RESCHED)))\n\t\tgoto need_resched;\n}\nEXPORT_SYMBOL(schedule);\n\n#ifdef CONFIG_PREEMPT\n/*\n * this is the entry point to schedule() from in-kernel preemption\n * off of preempt_enable. Kernel preemptions off return from interrupt\n * occur there and call schedule directly.\n */\nasmlinkage void __sched preempt_schedule(void)\n{\n\tstruct thread_info *ti = current_thread_info();\n#ifdef CONFIG_PREEMPT_BKL\n\tstruct task_struct *task = current;\n\tint saved_lock_depth;\n#endif\n\t/*\n\t * If there is a non-zero preempt_count or interrupts are disabled,\n\t * we do not want to preempt the current task. Just return..\n\t */\n\tif (likely(ti->preempt_count || irqs_disabled()))\n\t\treturn;\n\nneed_resched:\n\tadd_preempt_count(PREEMPT_ACTIVE);\n\t/*\n\t * We keep the big kernel semaphore locked, but we\n\t * clear ->lock_depth so that schedule() doesnt\n\t * auto-release the semaphore:\n\t */\n#ifdef CONFIG_PREEMPT_BKL\n\tsaved_lock_depth = task->lock_depth;\n\ttask->lock_depth = -1;\n#endif\n\tschedule();\n#ifdef CONFIG_PREEMPT_BKL\n\ttask->lock_depth = saved_lock_depth;\n#endif\n\tsub_preempt_count(PREEMPT_ACTIVE);\n\n\t/* we could miss a preemption opportunity between schedule and now */\n\tbarrier();\n\tif (unlikely(test_thread_flag(TIF_NEED_RESCHED)))\n\t\tgoto need_resched;\n}\nEXPORT_SYMBOL(preempt_schedule);\n\n/*\n * this is the entry point to schedule() from kernel preemption\n * off of irq context.\n * Note, that this is called and return with irqs disabled. This will\n * protect us against recursive calling from irq.\n */\nasmlinkage void __sched preempt_schedule_irq(void)\n{\n\tstruct thread_info *ti = current_thread_info();\n#ifdef CONFIG_PREEMPT_BKL\n\tstruct task_struct *task = current;\n\tint saved_lock_depth;\n#endif\n\t/* Catch callers which need to be fixed */\n\tBUG_ON(ti->preempt_count || !irqs_disabled());\n\nneed_resched:\n\tadd_preempt_count(PREEMPT_ACTIVE);\n\t/*\n\t * We keep the big kernel semaphore locked, but we\n\t * clear ->lock_depth so that schedule() doesnt\n\t * auto-release the semaphore:\n\t */\n#ifdef CONFIG_PREEMPT_BKL\n\tsaved_lock_depth = task->lock_depth;\n\ttask->lock_depth = -1;\n#endif\n\tlocal_irq_enable();\n\tschedule();\n\tlocal_irq_disable();\n#ifdef CONFIG_PREEMPT_BKL\n\ttask->lock_depth = saved_lock_depth;\n#endif\n\tsub_preempt_count(PREEMPT_ACTIVE);\n\n\t/* we could miss a preemption opportunity between schedule and now */\n\tbarrier();\n\tif (unlikely(test_thread_flag(TIF_NEED_RESCHED)))\n\t\tgoto need_resched;\n}\n\n#endif /* CONFIG_PREEMPT */\n\nint default_wake_function(wait_queue_t *curr, unsigned mode, int sync,\n\t\t\t void *key)\n{\n\treturn try_to_wake_up(curr->private, mode, sync);\n}\nEXPORT_SYMBOL(default_wake_function);\n\n/*\n * The core wakeup function. Non-exclusive wakeups (nr_exclusive == 0) just\n * wake everything up. If it's an exclusive wakeup (nr_exclusive == small +ve\n * number) then we wake all the non-exclusive tasks and one exclusive task.\n *\n * There are circumstances in which we can try to wake a task which has already\n * started to run but is not in state TASK_RUNNING. try_to_wake_up() returns\n * zero in this (rare) case, and we handle it by continuing to scan the queue.\n */\nstatic void __wake_up_common(wait_queue_head_t *q, unsigned int mode,\n\t\t\t int nr_exclusive, int sync, void *key)\n{\n\tstruct list_head *tmp, *next;\n\n\tlist_for_each_safe(tmp, next, &q->task_list) {\n\t\twait_queue_t *curr = list_entry(tmp, wait_queue_t, task_list);\n\t\tunsigned flags = curr->flags;\n\n\t\tif (curr->func(curr, mode, sync, key) &&\n\t\t\t\t(flags & WQ_FLAG_EXCLUSIVE) && !--nr_exclusive)\n\t\t\tbreak;\n\t}\n}\n\n/**\n * __wake_up - wake up threads blocked on a waitqueue.\n * @q: the waitqueue\n * @mode: which threads\n * @nr_exclusive: how many wake-one or wake-many threads to wake up\n * @key: is directly passed to the wakeup function\n */\nvoid fastcall __wake_up(wait_queue_head_t *q, unsigned int mode,\n\t\t\tint nr_exclusive, void *key)\n{\n\tunsigned long flags;\n\n\tspin_lock_irqsave(&q->lock, flags);\n\t__wake_up_common(q, mode, nr_exclusive, 0, key);\n\tspin_unlock_irqrestore(&q->lock, flags);\n}\nEXPORT_SYMBOL(__wake_up);\n\n/*\n * Same as __wake_up but called with the spinlock in wait_queue_head_t held.\n */\nvoid fastcall __wake_up_locked(wait_queue_head_t *q, unsigned int mode)\n{\n\t__wake_up_common(q, mode, 1, 0, NULL);\n}\n\n/**\n * __wake_up_sync - wake up threads blocked on a waitqueue.\n * @q: the waitqueue\n * @mode: which threads\n * @nr_exclusive: how many wake-one or wake-many threads to wake up\n *\n * The sync wakeup differs that the waker knows that it will schedule\n * away soon, so while the target thread will be woken up, it will not\n * be migrated to another CPU - ie. the two threads are 'synchronized'\n * with each other. This can prevent needless bouncing between CPUs.\n *\n * On UP it can prevent extra preemption.\n */\nvoid fastcall\n__wake_up_sync(wait_queue_head_t *q, unsigned int mode, int nr_exclusive)\n{\n\tunsigned long flags;\n\tint sync = 1;\n\n\tif (unlikely(!q))\n\t\treturn;\n\n\tif (unlikely(!nr_exclusive))\n\t\tsync = 0;\n\n\tspin_lock_irqsave(&q->lock, flags);\n\t__wake_up_common(q, mode, nr_exclusive, sync, NULL);\n\tspin_unlock_irqrestore(&q->lock, flags);\n}\nEXPORT_SYMBOL_GPL(__wake_up_sync);\t/* For internal use only */\n\nvoid fastcall complete(struct completion *x)\n{\n\tunsigned long flags;\n\n\tspin_lock_irqsave(&x->wait.lock, flags);\n\tx->done++;\n\t__wake_up_common(&x->wait, TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE,\n\t\t\t 1, 0, NULL);\n\tspin_unlock_irqrestore(&x->wait.lock, flags);\n}\nEXPORT_SYMBOL(complete);\n\nvoid fastcall complete_all(struct completion *x)\n{\n\tunsigned long flags;\n\n\tspin_lock_irqsave(&x->wait.lock, flags);\n\tx->done += UINT_MAX/2;\n\t__wake_up_common(&x->wait, TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE,\n\t\t\t 0, 0, NULL);\n\tspin_unlock_irqrestore(&x->wait.lock, flags);\n}\nEXPORT_SYMBOL(complete_all);\n\nvoid fastcall __sched wait_for_completion(struct completion *x)\n{\n\tmight_sleep();\n\n\tspin_lock_irq(&x->wait.lock);\n\tif (!x->done) {\n\t\tDECLARE_WAITQUEUE(wait, current);\n\n\t\twait.flags |= WQ_FLAG_EXCLUSIVE;\n\t\t__add_wait_queue_tail(&x->wait, &wait);\n\t\tdo {\n\t\t\t__set_current_state(TASK_UNINTERRUPTIBLE);\n\t\t\tspin_unlock_irq(&x->wait.lock);\n\t\t\tschedule();\n\t\t\tspin_lock_irq(&x->wait.lock);\n\t\t} while (!x->done);\n\t\t__remove_wait_queue(&x->wait, &wait);\n\t}\n\tx->done--;\n\tspin_unlock_irq(&x->wait.lock);\n}\nEXPORT_SYMBOL(wait_for_completion);\n\nunsigned long fastcall __sched\nwait_for_completion_timeout(struct completion *x, unsigned long timeout)\n{\n\tmight_sleep();\n\n\tspin_lock_irq(&x->wait.lock);\n\tif (!x->done) {\n\t\tDECLARE_WAITQUEUE(wait, current);\n\n\t\twait.flags |= WQ_FLAG_EXCLUSIVE;\n\t\t__add_wait_queue_tail(&x->wait, &wait);\n\t\tdo {\n\t\t\t__set_current_state(TASK_UNINTERRUPTIBLE);\n\t\t\tspin_unlock_irq(&x->wait.lock);\n\t\t\ttimeout = schedule_timeout(timeout);\n\t\t\tspin_lock_irq(&x->wait.lock);\n\t\t\tif (!timeout) {\n\t\t\t\t__remove_wait_queue(&x->wait, &wait);\n\t\t\t\tgoto out;\n\t\t\t}\n\t\t} while (!x->done);\n\t\t__remove_wait_queue(&x->wait, &wait);\n\t}\n\tx->done--;\nout:\n\tspin_unlock_irq(&x->wait.lock);\n\treturn timeout;\n}\nEXPORT_SYMBOL(wait_for_completion_timeout);\n\nint fastcall __sched wait_for_completion_interruptible(struct completion *x)\n{\n\tint ret = 0;\n\n\tmight_sleep();\n\n\tspin_lock_irq(&x->wait.lock);\n\tif (!x->done) {\n\t\tDECLARE_WAITQUEUE(wait, current);\n\n\t\twait.flags |= WQ_FLAG_EXCLUSIVE;\n\t\t__add_wait_queue_tail(&x->wait, &wait);\n\t\tdo {\n\t\t\tif (signal_pending(current)) {\n\t\t\t\tret = -ERESTARTSYS;\n\t\t\t\t__remove_wait_queue(&x->wait, &wait);\n\t\t\t\tgoto out;\n\t\t\t}\n\t\t\t__set_current_state(TASK_INTERRUPTIBLE);\n\t\t\tspin_unlock_irq(&x->wait.lock);\n\t\t\tschedule();\n\t\t\tspin_lock_irq(&x->wait.lock);\n\t\t} while (!x->done);\n\t\t__remove_wait_queue(&x->wait, &wait);\n\t}\n\tx->done--;\nout:\n\tspin_unlock_irq(&x->wait.lock);\n\n\treturn ret;\n}\nEXPORT_SYMBOL(wait_for_completion_interruptible);\n\nunsigned long fastcall __sched\nwait_for_completion_interruptible_timeout(struct completion *x,\n\t\t\t\t\t unsigned long timeout)\n{\n\tmight_sleep();\n\n\tspin_lock_irq(&x->wait.lock);\n\tif (!x->done) {\n\t\tDECLARE_WAITQUEUE(wait, current);\n\n\t\twait.flags |= WQ_FLAG_EXCLUSIVE;\n\t\t__add_wait_queue_tail(&x->wait, &wait);\n\t\tdo {\n\t\t\tif (signal_pending(current)) {\n\t\t\t\ttimeout = -ERESTARTSYS;\n\t\t\t\t__remove_wait_queue(&x->wait, &wait);\n\t\t\t\tgoto out;\n\t\t\t}\n\t\t\t__set_current_state(TASK_INTERRUPTIBLE);\n\t\t\tspin_unlock_irq(&x->wait.lock);\n\t\t\ttimeout = schedule_timeout(timeout);\n\t\t\tspin_lock_irq(&x->wait.lock);\n\t\t\tif (!timeout) {\n\t\t\t\t__remove_wait_queue(&x->wait, &wait);\n\t\t\t\tgoto out;\n\t\t\t}\n\t\t} while (!x->done);\n\t\t__remove_wait_queue(&x->wait, &wait);\n\t}\n\tx->done--;\nout:\n\tspin_unlock_irq(&x->wait.lock);\n\treturn timeout;\n}\nEXPORT_SYMBOL(wait_for_completion_interruptible_timeout);\n\n\n#define\tSLEEP_ON_VAR\t\t\t\t\t\\\n\tunsigned long flags;\t\t\t\t\\\n\twait_queue_t wait;\t\t\t\t\\\n\tinit_waitqueue_entry(&wait, current);\n\n#define SLEEP_ON_HEAD\t\t\t\t\t\\\n\tspin_lock_irqsave(&q->lock,flags);\t\t\\\n\t__add_wait_queue(q, &wait);\t\t\t\\\n\tspin_unlock(&q->lock);\n\n#define\tSLEEP_ON_TAIL\t\t\t\t\t\\\n\tspin_lock_irq(&q->lock);\t\t\t\\\n\t__remove_wait_queue(q, &wait);\t\t\t\\\n\tspin_unlock_irqrestore(&q->lock, flags);\n\nvoid fastcall __sched interruptible_sleep_on(wait_queue_head_t *q)\n{\n\tSLEEP_ON_VAR\n\n\tcurrent->state = TASK_INTERRUPTIBLE;\n\n\tSLEEP_ON_HEAD\n\tschedule();\n\tSLEEP_ON_TAIL\n}\nEXPORT_SYMBOL(interruptible_sleep_on);\n\nlong fastcall __sched\ninterruptible_sleep_on_timeout(wait_queue_head_t *q, long timeout)\n{\n\tSLEEP_ON_VAR\n\n\tcurrent->state = TASK_INTERRUPTIBLE;\n\n\tSLEEP_ON_HEAD\n\ttimeout = schedule_timeout(timeout);\n\tSLEEP_ON_TAIL\n\n\treturn timeout;\n}\nEXPORT_SYMBOL(interruptible_sleep_on_timeout);\n\nvoid fastcall __sched sleep_on(wait_queue_head_t *q)\n{\n\tSLEEP_ON_VAR\n\n\tcurrent->state = TASK_UNINTERRUPTIBLE;\n\n\tSLEEP_ON_HEAD\n\tschedule();\n\tSLEEP_ON_TAIL\n}\nEXPORT_SYMBOL(sleep_on);\n\nlong fastcall __sched sleep_on_timeout(wait_queue_head_t *q, long timeout)\n{\n\tSLEEP_ON_VAR\n\n\tcurrent->state = TASK_UNINTERRUPTIBLE;\n\n\tSLEEP_ON_HEAD\n\ttimeout = schedule_timeout(timeout);\n\tSLEEP_ON_TAIL\n\n\treturn timeout;\n}\n\nEXPORT_SYMBOL(sleep_on_timeout);\n\n#ifdef CONFIG_RT_MUTEXES\n\n/*\n * rt_mutex_setprio - set the current priority of a task\n * @p: task\n * @prio: prio value (kernel-internal form)\n *\n * This function changes the 'effective' priority of a task. It does\n * not touch ->normal_prio like __setscheduler().\n *\n * Used by the rt_mutex code to implement priority inheritance logic.\n */\nvoid rt_mutex_setprio(struct task_struct *p, int prio)\n{\n\tstruct prio_array *array;\n\tunsigned long flags;\n\tstruct rq *rq;\n\tint oldprio;\n\n\tBUG_ON(prio < 0 || prio > MAX_PRIO);\n\n\trq = task_rq_lock(p, &flags);\n\n\toldprio = p->prio;\n\tarray = p->array;\n\tif (array)\n\t\tdequeue_task(p, array);\n\tp->prio = prio;\n\n\tif (array) {\n\t\t/*\n\t\t * If changing to an RT priority then queue it\n\t\t * in the active array!\n\t\t */\n\t\tif (rt_task(p))\n\t\t\tarray = rq->active;\n\t\tenqueue_task(p, array);\n\t\t/*\n\t\t * Reschedule if we are currently running on this runqueue and\n\t\t * our priority decreased, or if we are not currently running on\n\t\t * this runqueue and our priority is higher than the current's\n\t\t */\n\t\tif (task_running(rq, p)) {\n\t\t\tif (p->prio > oldprio)\n\t\t\t\tresched_task(rq->curr);\n\t\t} else if (TASK_PREEMPTS_CURR(p, rq))\n\t\t\tresched_task(rq->curr);\n\t}\n\ttask_rq_unlock(rq, &flags);\n}\n\n#endif\n\nvoid set_user_nice(struct task_struct *p, long nice)\n{\n\tstruct prio_array *array;\n\tint old_prio, delta;\n\tunsigned long flags;\n\tstruct rq *rq;\n\n\tif (TASK_NICE(p) == nice || nice < -20 || nice > 19)\n\t\treturn;\n\t/*\n\t * We have to be careful, if called from sys_setpriority(),\n\t * the task might be in the middle of scheduling on another CPU.\n\t */\n\trq = task_rq_lock(p, &flags);\n\t/*\n\t * The RT priorities are set via sched_setscheduler(), but we still\n\t * allow the 'normal' nice value to be set - but as expected\n\t * it wont have any effect on scheduling until the task is\n\t * not SCHED_NORMAL/SCHED_BATCH:\n\t */\n\tif (has_rt_policy(p)) {\n\t\tp->static_prio = NICE_TO_PRIO(nice);\n\t\tgoto out_unlock;\n\t}\n\tarray = p->array;\n\tif (array) {\n\t\tdequeue_task(p, array);\n\t\tdec_raw_weighted_load(rq, p);\n\t}\n\n\tp->static_prio = NICE_TO_PRIO(nice);\n\tset_load_weight(p);\n\told_prio = p->prio;\n\tp->prio = effective_prio(p);\n\tdelta = p->prio - old_prio;\n\n\tif (array) {\n\t\tenqueue_task(p, array);\n\t\tinc_raw_weighted_load(rq, p);\n\t\t/*\n\t\t * If the task increased its priority or is running and\n\t\t * lowered its priority, then reschedule its CPU:\n\t\t */\n\t\tif (delta < 0 || (delta > 0 && task_running(rq, p)))\n\t\t\tresched_task(rq->curr);\n\t}\nout_unlock:\n\ttask_rq_unlock(rq, &flags);\n}\nEXPORT_SYMBOL(set_user_nice);\n\n/*\n * can_nice - check if a task can reduce its nice value\n * @p: task\n * @nice: nice value\n */\nint can_nice(const struct task_struct *p, const int nice)\n{\n\t/* convert nice value [19,-20] to rlimit style value [1,40] */\n\tint nice_rlim = 20 - nice;\n\n\treturn (nice_rlim <= p->signal->rlim[RLIMIT_NICE].rlim_cur ||\n\t\tcapable(CAP_SYS_NICE));\n}\n\n#ifdef __ARCH_WANT_SYS_NICE\n\n/*\n * sys_nice - change the priority of the current process.\n * @increment: priority increment\n *\n * sys_setpriority is a more generic, but much slower function that\n * does similar things.\n */\nasmlinkage long sys_nice(int increment)\n{\n\tlong nice, retval;\n\n\t/*\n\t * Setpriority might change our priority at the same moment.\n\t * We don't have to worry. Conceptually one call occurs first\n\t * and we have a single winner.\n\t */\n\tif (increment < -40)\n\t\tincrement = -40;\n\tif (increment > 40)\n\t\tincrement = 40;\n\n\tnice = PRIO_TO_NICE(current->static_prio) + increment;\n\tif (nice < -20)\n\t\tnice = -20;\n\tif (nice > 19)\n\t\tnice = 19;\n\n\tif (increment < 0 && !can_nice(current, nice))\n\t\treturn -EPERM;\n\n\tretval = security_task_setnice(current, nice);\n\tif (retval)\n\t\treturn retval;\n\n\tset_user_nice(current, nice);\n\treturn 0;\n}\n\n#endif\n\n/**\n * task_prio - return the priority value of a given task.\n * @p: the task in question.\n *\n * This is the priority value as seen by users in /proc.\n * RT tasks are offset by -200. Normal tasks are centered\n * around 0, value goes from -16 to +15.\n */\nint task_prio(const struct task_struct *p)\n{\n\treturn p->prio - MAX_RT_PRIO;\n}\n\n/**\n * task_nice - return the nice value of a given task.\n * @p: the task in question.\n */\nint task_nice(const struct task_struct *p)\n{\n\treturn TASK_NICE(p);\n}\nEXPORT_SYMBOL_GPL(task_nice);\n\n/**\n * idle_cpu - is a given cpu idle currently?\n * @cpu: the processor in question.\n */\nint idle_cpu(int cpu)\n{\n\treturn cpu_curr(cpu) == cpu_rq(cpu)->idle;\n}\n\n/**\n * idle_task - return the idle task for a given cpu.\n * @cpu: the processor in question.\n */\nstruct task_struct *idle_task(int cpu)\n{\n\treturn cpu_rq(cpu)->idle;\n}\n\n/**\n * find_process_by_pid - find a process with a matching PID value.\n * @pid: the pid in question.\n */\nstatic inline struct task_struct *find_process_by_pid(pid_t pid)\n{\n\treturn pid ? find_task_by_pid(pid) : current;\n}\n\n/* Actually do priority change: must hold rq lock. */\nstatic void __setscheduler(struct task_struct *p, int policy, int prio)\n{\n\tBUG_ON(p->array);\n\n\tp->policy = policy;\n\tp->rt_priority = prio;\n\tp->normal_prio = normal_prio(p);\n\t/* we are holding p->pi_lock already */\n\tp->prio = rt_mutex_getprio(p);\n\t/*\n\t * SCHED_BATCH tasks are treated as perpetual CPU hogs:\n\t */\n\tif (policy == SCHED_BATCH)\n\t\tp->sleep_avg = 0;\n\tset_load_weight(p);\n}\n\n/**\n * sched_setscheduler - change the scheduling policy and/or RT priority of a thread.\n * @p: the task in question.\n * @policy: new policy.\n * @param: structure containing the new RT priority.\n *\n * NOTE that the task may be already dead.\n */\nint sched_setscheduler(struct task_struct *p, int policy,\n\t\t struct sched_param *param)\n{\n\tint retval, oldprio, oldpolicy = -1;\n\tstruct prio_array *array;\n\tunsigned long flags;\n\tstruct rq *rq;\n\n\t/* may grab non-irq protected spin_locks */\n\tBUG_ON(in_interrupt());\nrecheck:\n\t/* double check policy once rq lock held */\n\tif (policy < 0)\n\t\tpolicy = oldpolicy = p->policy;\n\telse if (policy != SCHED_FIFO && policy != SCHED_RR &&\n\t\t\tpolicy != SCHED_NORMAL && policy != SCHED_BATCH)\n\t\treturn -EINVAL;\n\t/*\n\t * Valid priorities for SCHED_FIFO and SCHED_RR are\n\t * 1..MAX_USER_RT_PRIO-1, valid priority for SCHED_NORMAL and\n\t * SCHED_BATCH is 0.\n\t */\n\tif (param->sched_priority < 0 ||\n\t (p->mm && param->sched_priority > MAX_USER_RT_PRIO-1) ||\n\t (!p->mm && param->sched_priority > MAX_RT_PRIO-1))\n\t\treturn -EINVAL;\n\tif (is_rt_policy(policy) != (param->sched_priority != 0))\n\t\treturn -EINVAL;\n\n\t/*\n\t * Allow unprivileged RT tasks to decrease priority:\n\t */\n\tif (!capable(CAP_SYS_NICE)) {\n\t\tif (is_rt_policy(policy)) {\n\t\t\tunsigned long rlim_rtprio;\n\t\t\tunsigned long flags;\n\n\t\t\tif (!lock_task_sighand(p, &flags))\n\t\t\t\treturn -ESRCH;\n\t\t\trlim_rtprio = p->signal->rlim[RLIMIT_RTPRIO].rlim_cur;\n\t\t\tunlock_task_sighand(p, &flags);\n\n\t\t\t/* can't set/change the rt policy */\n\t\t\tif (policy != p->policy && !rlim_rtprio)\n\t\t\t\treturn -EPERM;\n\n\t\t\t/* can't increase priority */\n\t\t\tif (param->sched_priority > p->rt_priority &&\n\t\t\t param->sched_priority > rlim_rtprio)\n\t\t\t\treturn -EPERM;\n\t\t}\n\n\t\t/* can't change other user's priorities */\n\t\tif ((current->euid != p->euid) &&\n\t\t (current->euid != p->uid))\n\t\t\treturn -EPERM;\n\t}\n\n\tretval = security_task_setscheduler(p, policy, param);\n\tif (retval)\n\t\treturn retval;\n\t/*\n\t * make sure no PI-waiters arrive (or leave) while we are\n\t * changing the priority of the task:\n\t */\n\tspin_lock_irqsave(&p->pi_lock, flags);\n\t/*\n\t * To be able to change p->policy safely, the apropriate\n\t * runqueue lock must be held.\n\t */\n\trq = __task_rq_lock(p);\n\t/* recheck policy now with rq lock held */\n\tif (unlikely(oldpolicy != -1 && oldpolicy != p->policy)) {\n\t\tpolicy = oldpolicy = -1;\n\t\t__task_rq_unlock(rq);\n\t\tspin_unlock_irqrestore(&p->pi_lock, flags);\n\t\tgoto recheck;\n\t}\n\tarray = p->array;\n\tif (array)\n\t\tdeactivate_task(p, rq);\n\toldprio = p->prio;\n\t__setscheduler(p, policy, param->sched_priority);\n\tif (array) {\n\t\t__activate_task(p, rq);\n\t\t/*\n\t\t * Reschedule if we are currently running on this runqueue and\n\t\t * our priority decreased, or if we are not currently running on\n\t\t * this runqueue and our priority is higher than the current's\n\t\t */\n\t\tif (task_running(rq, p)) {\n\t\t\tif (p->prio > oldprio)\n\t\t\t\tresched_task(rq->curr);\n\t\t} else if (TASK_PREEMPTS_CURR(p, rq))\n\t\t\tresched_task(rq->curr);\n\t}\n\t__task_rq_unlock(rq);\n\tspin_unlock_irqrestore(&p->pi_lock, flags);\n\n\trt_mutex_adjust_pi(p);\n\n\treturn 0;\n}\nEXPORT_SYMBOL_GPL(sched_setscheduler);\n\nstatic int\ndo_sched_setscheduler(pid_t pid, int policy, struct sched_param __user *param)\n{\n\tstruct sched_param lparam;\n\tstruct task_struct *p;\n\tint retval;\n\n\tif (!param || pid < 0)\n\t\treturn -EINVAL;\n\tif (copy_from_user(&lparam, param, sizeof(struct sched_param)))\n\t\treturn -EFAULT;\n\n\trcu_read_lock();\n\tretval = -ESRCH;\n\tp = find_process_by_pid(pid);\n\tif (p != NULL)\n\t\tretval = sched_setscheduler(p, policy, &lparam);\n\trcu_read_unlock();\n\n\treturn retval;\n}\n\n/**\n * sys_sched_setscheduler - set/change the scheduler policy and RT priority\n * @pid: the pid in question.\n * @policy: new policy.\n * @param: structure containing the new RT priority.\n */\nasmlinkage long sys_sched_setscheduler(pid_t pid, int policy,\n\t\t\t\t struct sched_param __user *param)\n{\n\t/* negative values for policy are not valid */\n\tif (policy < 0)\n\t\treturn -EINVAL;\n\n\treturn do_sched_setscheduler(pid, policy, param);\n}\n\n/**\n * sys_sched_setparam - set/change the RT priority of a thread\n * @pid: the pid in question.\n * @param: structure containing the new RT priority.\n */\nasmlinkage long sys_sched_setparam(pid_t pid, struct sched_param __user *param)\n{\n\treturn do_sched_setscheduler(pid, -1, param);\n}\n\n/**\n * sys_sched_getscheduler - get the policy (scheduling class) of a thread\n * @pid: the pid in question.\n */\nasmlinkage long sys_sched_getscheduler(pid_t pid)\n{\n\tstruct task_struct *p;\n\tint retval = -EINVAL;\n\n\tif (pid < 0)\n\t\tgoto out_nounlock;\n\n\tretval = -ESRCH;\n\tread_lock(&tasklist_lock);\n\tp = find_process_by_pid(pid);\n\tif (p) {\n\t\tretval = security_task_getscheduler(p);\n\t\tif (!retval)\n\t\t\tretval = p->policy;\n\t}\n\tread_unlock(&tasklist_lock);\n\nout_nounlock:\n\treturn retval;\n}\n\n/**\n * sys_sched_getscheduler - get the RT priority of a thread\n * @pid: the pid in question.\n * @param: structure containing the RT priority.\n */\nasmlinkage long sys_sched_getparam(pid_t pid, struct sched_param __user *param)\n{\n\tstruct sched_param lp;\n\tstruct task_struct *p;\n\tint retval = -EINVAL;\n\n\tif (!param || pid < 0)\n\t\tgoto out_nounlock;\n\n\tread_lock(&tasklist_lock);\n\tp = find_process_by_pid(pid);\n\tretval = -ESRCH;\n\tif (!p)\n\t\tgoto out_unlock;\n\n\tretval = security_task_getscheduler(p);\n\tif (retval)\n\t\tgoto out_unlock;\n\n\tlp.sched_priority = p->rt_priority;\n\tread_unlock(&tasklist_lock);\n\n\t/*\n\t * This one might sleep, we cannot do it with a spinlock held ...\n\t */\n\tretval = copy_to_user(param, &lp, sizeof(*param)) ? -EFAULT : 0;\n\nout_nounlock:\n\treturn retval;\n\nout_unlock:\n\tread_unlock(&tasklist_lock);\n\treturn retval;\n}\n\nlong sched_setaffinity(pid_t pid, cpumask_t new_mask)\n{\n\tcpumask_t cpus_allowed;\n\tstruct task_struct *p;\n\tint retval;\n\n\tmutex_lock(&sched_hotcpu_mutex);\n\tread_lock(&tasklist_lock);\n\n\tp = find_process_by_pid(pid);\n\tif (!p) {\n\t\tread_unlock(&tasklist_lock);\n\t\tmutex_unlock(&sched_hotcpu_mutex);\n\t\treturn -ESRCH;\n\t}\n\n\t/*\n\t * It is not safe to call set_cpus_allowed with the\n\t * tasklist_lock held. We will bump the task_struct's\n\t * usage count and then drop tasklist_lock.\n\t */\n\tget_task_struct(p);\n\tread_unlock(&tasklist_lock);\n\n\tretval = -EPERM;\n\tif ((current->euid != p->euid) && (current->euid != p->uid) &&\n\t\t\t!capable(CAP_SYS_NICE))\n\t\tgoto out_unlock;\n\n\tretval = security_task_setscheduler(p, 0, NULL);\n\tif (retval)\n\t\tgoto out_unlock;\n\n\tcpus_allowed = cpuset_cpus_allowed(p);\n\tcpus_and(new_mask, new_mask, cpus_allowed);\n\tretval = set_cpus_allowed(p, new_mask);\n\nout_unlock:\n\tput_task_struct(p);\n\tmutex_unlock(&sched_hotcpu_mutex);\n\treturn retval;\n}\n\nstatic int get_user_cpu_mask(unsigned long __user *user_mask_ptr, unsigned len,\n\t\t\t cpumask_t *new_mask)\n{\n\tif (len < sizeof(cpumask_t)) {\n\t\tmemset(new_mask, 0, sizeof(cpumask_t));\n\t} else if (len > sizeof(cpumask_t)) {\n\t\tlen = sizeof(cpumask_t);\n\t}\n\treturn copy_from_user(new_mask, user_mask_ptr, len) ? -EFAULT : 0;\n}\n\n/**\n * sys_sched_setaffinity - set the cpu affinity of a process\n * @pid: pid of the process\n * @len: length in bytes of the bitmask pointed to by user_mask_ptr\n * @user_mask_ptr: user-space pointer to the new cpu mask\n */\nasmlinkage long sys_sched_setaffinity(pid_t pid, unsigned int len,\n\t\t\t\t unsigned long __user *user_mask_ptr)\n{\n\tcpumask_t new_mask;\n\tint retval;\n\n\tretval = get_user_cpu_mask(user_mask_ptr, len, &new_mask);\n\tif (retval)\n\t\treturn retval;\n\n\treturn sched_setaffinity(pid, new_mask);\n}\n\n/*\n * Represents all cpu's present in the system\n * In systems capable of hotplug, this map could dynamically grow\n * as new cpu's are detected in the system via any platform specific\n * method, such as ACPI for e.g.\n */\n\ncpumask_t cpu_present_map __read_mostly;\nEXPORT_SYMBOL(cpu_present_map);\n\n#ifndef CONFIG_SMP\ncpumask_t cpu_online_map __read_mostly = CPU_MASK_ALL;\nEXPORT_SYMBOL(cpu_online_map);\n\ncpumask_t cpu_possible_map __read_mostly = CPU_MASK_ALL;\nEXPORT_SYMBOL(cpu_possible_map);\n#endif\n\nlong sched_getaffinity(pid_t pid, cpumask_t *mask)\n{\n\tstruct task_struct *p;\n\tint retval;\n\n\tmutex_lock(&sched_hotcpu_mutex);\n\tread_lock(&tasklist_lock);\n\n\tretval = -ESRCH;\n\tp = find_process_by_pid(pid);\n\tif (!p)\n\t\tgoto out_unlock;\n\n\tretval = security_task_getscheduler(p);\n\tif (retval)\n\t\tgoto out_unlock;\n\n\tcpus_and(*mask, p->cpus_allowed, cpu_online_map);\n\nout_unlock:\n\tread_unlock(&tasklist_lock);\n\tmutex_unlock(&sched_hotcpu_mutex);\n\tif (retval)\n\t\treturn retval;\n\n\treturn 0;\n}\n\n/**\n * sys_sched_getaffinity - get the cpu affinity of a process\n * @pid: pid of the process\n * @len: length in bytes of the bitmask pointed to by user_mask_ptr\n * @user_mask_ptr: user-space pointer to hold the current cpu mask\n */\nasmlinkage long sys_sched_getaffinity(pid_t pid, unsigned int len,\n\t\t\t\t unsigned long __user *user_mask_ptr)\n{\n\tint ret;\n\tcpumask_t mask;\n\n\tif (len < sizeof(cpumask_t))\n\t\treturn -EINVAL;\n\n\tret = sched_getaffinity(pid, &mask);\n\tif (ret < 0)\n\t\treturn ret;\n\n\tif (copy_to_user(user_mask_ptr, &mask, sizeof(cpumask_t)))\n\t\treturn -EFAULT;\n\n\treturn sizeof(cpumask_t);\n}\n\n/**\n * sys_sched_yield - yield the current processor to other threads.\n *\n * This function yields the current CPU by moving the calling thread\n * to the expired array. If there are no other threads running on this\n * CPU then this function will return.\n */\nasmlinkage long sys_sched_yield(void)\n{\n\tstruct rq *rq = this_rq_lock();\n\tstruct prio_array *array = current->array, *target = rq->expired;\n\n\tschedstat_inc(rq, yld_cnt);\n\t/*\n\t * We implement yielding by moving the task into the expired\n\t * queue.\n\t *\n\t * (special rule: RT tasks will just roundrobin in the active\n\t * array.)\n\t */\n\tif (rt_task(current))\n\t\ttarget = rq->active;\n\n\tif (array->nr_active == 1) {\n\t\tschedstat_inc(rq, yld_act_empty);\n\t\tif (!rq->expired->nr_active)\n\t\t\tschedstat_inc(rq, yld_both_empty);\n\t} else if (!rq->expired->nr_active)\n\t\tschedstat_inc(rq, yld_exp_empty);\n\n\tif (array != target) {\n\t\tdequeue_task(current, array);\n\t\tenqueue_task(current, target);\n\t} else\n\t\t/*\n\t\t * requeue_task is cheaper so perform that if possible.\n\t\t */\n\t\trequeue_task(current, array);\n\n\t/*\n\t * Since we are going to call schedule() anyway, there's\n\t * no need to preempt or enable interrupts:\n\t */\n\t__release(rq->lock);\n\tspin_release(&rq->lock.dep_map, 1, _THIS_IP_);\n\t_raw_spin_unlock(&rq->lock);\n\tpreempt_enable_no_resched();\n\n\tschedule();\n\n\treturn 0;\n}\n\nstatic void __cond_resched(void)\n{\n#ifdef CONFIG_DEBUG_SPINLOCK_SLEEP\n\t__might_sleep(__FILE__, __LINE__);\n#endif\n\t/*\n\t * The BKS might be reacquired before we have dropped\n\t * PREEMPT_ACTIVE, which could trigger a second\n\t * cond_resched() call.\n\t */\n\tdo {\n\t\tadd_preempt_count(PREEMPT_ACTIVE);\n\t\tschedule();\n\t\tsub_preempt_count(PREEMPT_ACTIVE);\n\t} while (need_resched());\n}\n\nint __sched cond_resched(void)\n{\n\tif (need_resched() && !(preempt_count() & PREEMPT_ACTIVE) &&\n\t\t\t\t\tsystem_state == SYSTEM_RUNNING) {\n\t\t__cond_resched();\n\t\treturn 1;\n\t}\n\treturn 0;\n}\nEXPORT_SYMBOL(cond_resched);\n\n/*\n * cond_resched_lock() - if a reschedule is pending, drop the given lock,\n * call schedule, and on return reacquire the lock.\n *\n * This works OK both with and without CONFIG_PREEMPT. We do strange low-level\n * operations here to prevent schedule() from being called twice (once via\n * spin_unlock(), once by hand).\n */\nint cond_resched_lock(spinlock_t *lock)\n{\n\tint ret = 0;\n\n\tif (need_lockbreak(lock)) {\n\t\tspin_unlock(lock);\n\t\tcpu_relax();\n\t\tret = 1;\n\t\tspin_lock(lock);\n\t}\n\tif (need_resched() && system_state == SYSTEM_RUNNING) {\n\t\tspin_release(&lock->dep_map, 1, _THIS_IP_);\n\t\t_raw_spin_unlock(lock);\n\t\tpreempt_enable_no_resched();\n\t\t__cond_resched();\n\t\tret = 1;\n\t\tspin_lock(lock);\n\t}\n\treturn ret;\n}\nEXPORT_SYMBOL(cond_resched_lock);\n\nint __sched cond_resched_softirq(void)\n{\n\tBUG_ON(!in_softirq());\n\n\tif (need_resched() && system_state == SYSTEM_RUNNING) {\n\t\tlocal_bh_enable();\n\t\t__cond_resched();\n\t\tlocal_bh_disable();\n\t\treturn 1;\n\t}\n\treturn 0;\n}\nEXPORT_SYMBOL(cond_resched_softirq);\n\n/**\n * yield - yield the current processor to other threads.\n *\n * This is a shortcut for kernel-space yielding - it marks the\n * thread runnable and calls sys_sched_yield().\n */\nvoid __sched yield(void)\n{\n\tset_current_state(TASK_RUNNING);\n\tsys_sched_yield();\n}\nEXPORT_SYMBOL(yield);\n\n/*\n * This task is about to go to sleep on IO. Increment rq->nr_iowait so\n * that process accounting knows that this is a task in IO wait state.\n *\n * But don't do that if it is a deliberate, throttling IO wait (this task\n * has set its backing_dev_info: the queue against which it should throttle)\n */\nvoid __sched io_schedule(void)\n{\n\tstruct rq *rq = &__raw_get_cpu_var(runqueues);\n\n\tdelayacct_blkio_start();\n\tatomic_inc(&rq->nr_iowait);\n\tschedule();\n\tatomic_dec(&rq->nr_iowait);\n\tdelayacct_blkio_end();\n}\nEXPORT_SYMBOL(io_schedule);\n\nlong __sched io_schedule_timeout(long timeout)\n{\n\tstruct rq *rq = &__raw_get_cpu_var(runqueues);\n\tlong ret;\n\n\tdelayacct_blkio_start();\n\tatomic_inc(&rq->nr_iowait);\n\tret = schedule_timeout(timeout);\n\tatomic_dec(&rq->nr_iowait);\n\tdelayacct_blkio_end();\n\treturn ret;\n}\n\n/**\n * sys_sched_get_priority_max - return maximum RT priority.\n * @policy: scheduling class.\n *\n * this syscall returns the maximum rt_priority that can be used\n * by a given scheduling class.\n */\nasmlinkage long sys_sched_get_priority_max(int policy)\n{\n\tint ret = -EINVAL;\n\n\tswitch (policy) {\n\tcase SCHED_FIFO:\n\tcase SCHED_RR:\n\t\tret = MAX_USER_RT_PRIO-1;\n\t\tbreak;\n\tcase SCHED_NORMAL:\n\tcase SCHED_BATCH:\n\t\tret = 0;\n\t\tbreak;\n\t}\n\treturn ret;\n}\n\n/**\n * sys_sched_get_priority_min - return minimum RT priority.\n * @policy: scheduling class.\n *\n * this syscall returns the minimum rt_priority that can be used\n * by a given scheduling class.\n */\nasmlinkage long sys_sched_get_priority_min(int policy)\n{\n\tint ret = -EINVAL;\n\n\tswitch (policy) {\n\tcase SCHED_FIFO:\n\tcase SCHED_RR:\n\t\tret = 1;\n\t\tbreak;\n\tcase SCHED_NORMAL:\n\tcase SCHED_BATCH:\n\t\tret = 0;\n\t}\n\treturn ret;\n}\n\n/**\n * sys_sched_rr_get_interval - return the default timeslice of a process.\n * @pid: pid of the process.\n * @interval: userspace pointer to the timeslice value.\n *\n * this syscall writes the default timeslice value of a given process\n * into the user-space timespec buffer. A value of '0' means infinity.\n */\nasmlinkage\nlong sys_sched_rr_get_interval(pid_t pid, struct timespec __user *interval)\n{\n\tstruct task_struct *p;\n\tint retval = -EINVAL;\n\tstruct timespec t;\n\n\tif (pid < 0)\n\t\tgoto out_nounlock;\n\n\tretval = -ESRCH;\n\tread_lock(&tasklist_lock);\n\tp = find_process_by_pid(pid);\n\tif (!p)\n\t\tgoto out_unlock;\n\n\tretval = security_task_getscheduler(p);\n\tif (retval)\n\t\tgoto out_unlock;\n\n\tjiffies_to_timespec(p->policy == SCHED_FIFO ?\n\t\t\t\t0 : task_timeslice(p), &t);\n\tread_unlock(&tasklist_lock);\n\tretval = copy_to_user(interval, &t, sizeof(t)) ? -EFAULT : 0;\nout_nounlock:\n\treturn retval;\nout_unlock:\n\tread_unlock(&tasklist_lock);\n\treturn retval;\n}\n\nstatic const char stat_nam[] = \"RSDTtZX\";\n\nstatic void show_task(struct task_struct *p)\n{\n\tunsigned long free = 0;\n\tunsigned state;\n\n\tstate = p->state ? __ffs(p->state) + 1 : 0;\n\tprintk(\"%-13.13s %c\", p->comm,\n\t\tstate < sizeof(stat_nam) - 1 ? stat_nam[state] : '?');\n#if (BITS_PER_LONG == 32)\n\tif (state == TASK_RUNNING)\n\t\tprintk(\" running \");\n\telse\n\t\tprintk(\" %08lX \", thread_saved_pc(p));\n#else\n\tif (state == TASK_RUNNING)\n\t\tprintk(\" running task \");\n\telse\n\t\tprintk(\" %016lx \", thread_saved_pc(p));\n#endif\n#ifdef CONFIG_DEBUG_STACK_USAGE\n\t{\n\t\tunsigned long *n = end_of_stack(p);\n\t\twhile (!*n)\n\t\t\tn++;\n\t\tfree = (unsigned long)n - (unsigned long)end_of_stack(p);\n\t}\n#endif\n\tprintk(\"%5lu %5d %6d\", free, p->pid, p->parent->pid);\n\tif (!p->mm)\n\t\tprintk(\" (L-TLB)\\n\");\n\telse\n\t\tprintk(\" (NOTLB)\\n\");\n\n\tif (state != TASK_RUNNING)\n\t\tshow_stack(p, NULL);\n}\n\nvoid show_state_filter(unsigned long state_filter)\n{\n\tstruct task_struct *g, *p;\n\n#if (BITS_PER_LONG == 32)\n\tprintk(\"\\n\"\n\t \" free sibling\\n\");\n\tprintk(\" task PC stack pid father child younger older\\n\");\n#else\n\tprintk(\"\\n\"\n\t \" free sibling\\n\");\n\tprintk(\" task PC stack pid father child younger older\\n\");\n#endif\n\tread_lock(&tasklist_lock);\n\tdo_each_thread(g, p) {\n\t\t/*\n\t\t * reset the NMI-timeout, listing all files on a slow\n\t\t * console might take alot of time:\n\t\t */\n\t\ttouch_nmi_watchdog();\n\t\tif (!state_filter || (p->state & state_filter))\n\t\t\tshow_task(p);\n\t} while_each_thread(g, p);\n\n\ttouch_all_softlockup_watchdogs();\n\n\tread_unlock(&tasklist_lock);\n\t/*\n\t * Only show locks if all tasks are dumped:\n\t */\n\tif (state_filter == -1)\n\t\tdebug_show_all_locks();\n}\n\n/**\n * init_idle - set up an idle thread for a given CPU\n * @idle: task in question\n * @cpu: cpu the idle task belongs to\n *\n * NOTE: this function does not set the idle thread's NEED_RESCHED\n * flag, to make booting more robust.\n */\nvoid __cpuinit init_idle(struct task_struct *idle, int cpu)\n{\n\tstruct rq *rq = cpu_rq(cpu);\n\tunsigned long flags;\n\n\tidle->timestamp = sched_clock();\n\tidle->sleep_avg = 0;\n\tidle->array = NULL;\n\tidle->prio = idle->normal_prio = MAX_PRIO;\n\tidle->state = TASK_RUNNING;\n\tidle->cpus_allowed = cpumask_of_cpu(cpu);\n\tset_task_cpu(idle, cpu);\n\n\tspin_lock_irqsave(&rq->lock, flags);\n\trq->curr = rq->idle = idle;\n#if defined(CONFIG_SMP) && defined(__ARCH_WANT_UNLOCKED_CTXSW)\n\tidle->oncpu = 1;\n#endif\n\tspin_unlock_irqrestore(&rq->lock, flags);\n\n\t/* Set the preempt count _outside_ the spinlocks! */\n#if defined(CONFIG_PREEMPT) && !defined(CONFIG_PREEMPT_BKL)\n\ttask_thread_info(idle)->preempt_count = (idle->lock_depth >= 0);\n#else\n\ttask_thread_info(idle)->preempt_count = 0;\n#endif\n}\n\n/*\n * In a system that switches off the HZ timer nohz_cpu_mask\n * indicates which cpus entered this state. This is used\n * in the rcu update to wait only for active cpus. For system\n * which do not switch off the HZ timer nohz_cpu_mask should\n * always be CPU_MASK_NONE.\n */\ncpumask_t nohz_cpu_mask = CPU_MASK_NONE;\n\n#ifdef CONFIG_SMP\n/*\n * This is how migration works:\n *\n * 1) we queue a struct migration_req structure in the source CPU's\n * runqueue and wake up that CPU's migration thread.\n * 2) we down() the locked semaphore => thread blocks.\n * 3) migration thread wakes up (implicitly it forces the migrated\n * thread off the CPU)\n * 4) it gets the migration request and checks whether the migrated\n * task is still in the wrong runqueue.\n * 5) if it's in the wrong runqueue then the migration thread removes\n * it and puts it into the right queue.\n * 6) migration thread up()s the semaphore.\n * 7) we wake up and the migration is done.\n */\n\n/*\n * Change a given task's CPU affinity. Migrate the thread to a\n * proper CPU and schedule it away if the CPU it's executing on\n * is removed from the allowed bitmask.\n *\n * NOTE: the caller must have a valid reference to the task, the\n * task must not exit() & deallocate itself prematurely. The\n * call is not atomic; no spinlocks may be held.\n */\nint set_cpus_allowed(struct task_struct *p, cpumask_t new_mask)\n{\n\tstruct migration_req req;\n\tunsigned long flags;\n\tstruct rq *rq;\n\tint ret = 0;\n\n\trq = task_rq_lock(p, &flags);\n\tif (!cpus_intersects(new_mask, cpu_online_map)) {\n\t\tret = -EINVAL;\n\t\tgoto out;\n\t}\n\n\tp->cpus_allowed = new_mask;\n\t/* Can the task run on the task's current CPU? If so, we're done */\n\tif (cpu_isset(task_cpu(p), new_mask))\n\t\tgoto out;\n\n\tif (migrate_task(p, any_online_cpu(new_mask), &req)) {\n\t\t/* Need help from migration thread: drop lock and wait. */\n\t\ttask_rq_unlock(rq, &flags);\n\t\twake_up_process(rq->migration_thread);\n\t\twait_for_completion(&req.done);\n\t\ttlb_migrate_finish(p->mm);\n\t\treturn 0;\n\t}\nout:\n\ttask_rq_unlock(rq, &flags);\n\n\treturn ret;\n}\nEXPORT_SYMBOL_GPL(set_cpus_allowed);\n\n/*\n * Move (not current) task off this cpu, onto dest cpu. We're doing\n * this because either it can't run here any more (set_cpus_allowed()\n * away from this CPU, or CPU going down), or because we're\n * attempting to rebalance this task on exec (sched_exec).\n *\n * So we race with normal scheduler movements, but that's OK, as long\n * as the task is no longer on this CPU.\n *\n * Returns non-zero if task was successfully migrated.\n */\nstatic int __migrate_task(struct task_struct *p, int src_cpu, int dest_cpu)\n{\n\tstruct rq *rq_dest, *rq_src;\n\tint ret = 0;\n\n\tif (unlikely(cpu_is_offline(dest_cpu)))\n\t\treturn ret;\n\n\trq_src = cpu_rq(src_cpu);\n\trq_dest = cpu_rq(dest_cpu);\n\n\tdouble_rq_lock(rq_src, rq_dest);\n\t/* Already moved. */\n\tif (task_cpu(p) != src_cpu)\n\t\tgoto out;\n\t/* Affinity changed (again). */\n\tif (!cpu_isset(dest_cpu, p->cpus_allowed))\n\t\tgoto out;\n\n\tset_task_cpu(p, dest_cpu);\n\tif (p->array) {\n\t\t/*\n\t\t * Sync timestamp with rq_dest's before activating.\n\t\t * The same thing could be achieved by doing this step\n\t\t * afterwards, and pretending it was a local activate.\n\t\t * This way is cleaner and logically correct.\n\t\t */\n\t\tp->timestamp = p->timestamp - rq_src->most_recent_timestamp\n\t\t\t\t+ rq_dest->most_recent_timestamp;\n\t\tdeactivate_task(p, rq_src);\n\t\t__activate_task(p, rq_dest);\n\t\tif (TASK_PREEMPTS_CURR(p, rq_dest))\n\t\t\tresched_task(rq_dest->curr);\n\t}\n\tret = 1;\nout:\n\tdouble_rq_unlock(rq_src, rq_dest);\n\treturn ret;\n}\n\n/*\n * migration_thread - this is a highprio system thread that performs\n * thread migration by bumping thread off CPU then 'pushing' onto\n * another runqueue.\n */\nstatic int migration_thread(void *data)\n{\n\tint cpu = (long)data;\n\tstruct rq *rq;\n\n\trq = cpu_rq(cpu);\n\tBUG_ON(rq->migration_thread != current);\n\n\tset_current_state(TASK_INTERRUPTIBLE);\n\twhile (!kthread_should_stop()) {\n\t\tstruct migration_req *req;\n\t\tstruct list_head *head;\n\n\t\ttry_to_freeze();\n\n\t\tspin_lock_irq(&rq->lock);\n\n\t\tif (cpu_is_offline(cpu)) {\n\t\t\tspin_unlock_irq(&rq->lock);\n\t\t\tgoto wait_to_die;\n\t\t}\n\n\t\tif (rq->active_balance) {\n\t\t\tactive_load_balance(rq, cpu);\n\t\t\trq->active_balance = 0;\n\t\t}\n\n\t\thead = &rq->migration_queue;\n\n\t\tif (list_empty(head)) {\n\t\t\tspin_unlock_irq(&rq->lock);\n\t\t\tschedule();\n\t\t\tset_current_state(TASK_INTERRUPTIBLE);\n\t\t\tcontinue;\n\t\t}\n\t\treq = list_entry(head->next, struct migration_req, list);\n\t\tlist_del_init(head->next);\n\n\t\tspin_unlock(&rq->lock);\n\t\t__migrate_task(req->task, cpu, req->dest_cpu);\n\t\tlocal_irq_enable();\n\n\t\tcomplete(&req->done);\n\t}\n\t__set_current_state(TASK_RUNNING);\n\treturn 0;\n\nwait_to_die:\n\t/* Wait for kthread_stop */\n\tset_current_state(TASK_INTERRUPTIBLE);\n\twhile (!kthread_should_stop()) {\n\t\tschedule();\n\t\tset_current_state(TASK_INTERRUPTIBLE);\n\t}\n\t__set_current_state(TASK_RUNNING);\n\treturn 0;\n}\n\n#ifdef CONFIG_HOTPLUG_CPU\n/*\n * Figure out where task on dead CPU should go, use force if neccessary.\n * NOTE: interrupts should be disabled by the caller\n */\nstatic void move_task_off_dead_cpu(int dead_cpu, struct task_struct *p)\n{\n\tunsigned long flags;\n\tcpumask_t mask;\n\tstruct rq *rq;\n\tint dest_cpu;\n\nrestart:\n\t/* On same node? */\n\tmask = node_to_cpumask(cpu_to_node(dead_cpu));\n\tcpus_and(mask, mask, p->cpus_allowed);\n\tdest_cpu = any_online_cpu(mask);\n\n\t/* On any allowed CPU? */\n\tif (dest_cpu == NR_CPUS)\n\t\tdest_cpu = any_online_cpu(p->cpus_allowed);\n\n\t/* No more Mr. Nice Guy. */\n\tif (dest_cpu == NR_CPUS) {\n\t\trq = task_rq_lock(p, &flags);\n\t\tcpus_setall(p->cpus_allowed);\n\t\tdest_cpu = any_online_cpu(p->cpus_allowed);\n\t\ttask_rq_unlock(rq, &flags);\n\n\t\t/*\n\t\t * Don't tell them about moving exiting tasks or\n\t\t * kernel threads (both mm NULL), since they never\n\t\t * leave kernel.\n\t\t */\n\t\tif (p->mm && printk_ratelimit())\n\t\t\tprintk(KERN_INFO \"process %d (%s) no \"\n\t\t\t \"longer affine to cpu%d\\n\",\n\t\t\t p->pid, p->comm, dead_cpu);\n\t}\n\tif (!__migrate_task(p, dead_cpu, dest_cpu))\n\t\tgoto restart;\n}\n\n/*\n * While a dead CPU has no uninterruptible tasks queued at this point,\n * it might still have a nonzero ->nr_uninterruptible counter, because\n * for performance reasons the counter is not stricly tracking tasks to\n * their home CPUs. So we just add the counter to another CPU's counter,\n * to keep the global sum constant after CPU-down:\n */\nstatic void migrate_nr_uninterruptible(struct rq *rq_src)\n{\n\tstruct rq *rq_dest = cpu_rq(any_online_cpu(CPU_MASK_ALL));\n\tunsigned long flags;\n\n\tlocal_irq_save(flags);\n\tdouble_rq_lock(rq_src, rq_dest);\n\trq_dest->nr_uninterruptible += rq_src->nr_uninterruptible;\n\trq_src->nr_uninterruptible = 0;\n\tdouble_rq_unlock(rq_src, rq_dest);\n\tlocal_irq_restore(flags);\n}\n\n/* Run through task list and migrate tasks from the dead cpu. */\nstatic void migrate_live_tasks(int src_cpu)\n{\n\tstruct task_struct *p, *t;\n\n\twrite_lock_irq(&tasklist_lock);\n\n\tdo_each_thread(t, p) {\n\t\tif (p == current)\n\t\t\tcontinue;\n\n\t\tif (task_cpu(p) == src_cpu)\n\t\t\tmove_task_off_dead_cpu(src_cpu, p);\n\t} while_each_thread(t, p);\n\n\twrite_unlock_irq(&tasklist_lock);\n}\n\n/* Schedules idle task to be the next runnable task on current CPU.\n * It does so by boosting its priority to highest possible and adding it to\n * the _front_ of the runqueue. Used by CPU offline code.\n */\nvoid sched_idle_next(void)\n{\n\tint this_cpu = smp_processor_id();\n\tstruct rq *rq = cpu_rq(this_cpu);\n\tstruct task_struct *p = rq->idle;\n\tunsigned long flags;\n\n\t/* cpu has to be offline */\n\tBUG_ON(cpu_online(this_cpu));\n\n\t/*\n\t * Strictly not necessary since rest of the CPUs are stopped by now\n\t * and interrupts disabled on the current cpu.\n\t */\n\tspin_lock_irqsave(&rq->lock, flags);\n\n\t__setscheduler(p, SCHED_FIFO, MAX_RT_PRIO-1);\n\n\t/* Add idle task to the _front_ of its priority queue: */\n\t__activate_idle_task(p, rq);\n\n\tspin_unlock_irqrestore(&rq->lock, flags);\n}\n\n/*\n * Ensures that the idle task is using init_mm right before its cpu goes\n * offline.\n */\nvoid idle_task_exit(void)\n{\n\tstruct mm_struct *mm = current->active_mm;\n\n\tBUG_ON(cpu_online(smp_processor_id()));\n\n\tif (mm != &init_mm)\n\t\tswitch_mm(mm, &init_mm, current);\n\tmmdrop(mm);\n}\n\n/* called under rq->lock with disabled interrupts */\nstatic void migrate_dead(unsigned int dead_cpu, struct task_struct *p)\n{\n\tstruct rq *rq = cpu_rq(dead_cpu);\n\n\t/* Must be exiting, otherwise would be on tasklist. */\n\tBUG_ON(p->exit_state != EXIT_ZOMBIE && p->exit_state != EXIT_DEAD);\n\n\t/* Cannot have done final schedule yet: would have vanished. */\n\tBUG_ON(p->state == TASK_DEAD);\n\n\tget_task_struct(p);\n\n\t/*\n\t * Drop lock around migration; if someone else moves it,\n\t * that's OK. No task can be added to this CPU, so iteration is\n\t * fine.\n\t * NOTE: interrupts should be left disabled --dev@\n\t */\n\tspin_unlock(&rq->lock);\n\tmove_task_off_dead_cpu(dead_cpu, p);\n\tspin_lock(&rq->lock);\n\n\tput_task_struct(p);\n}\n\n/* release_task() removes task from tasklist, so we won't find dead tasks. */\nstatic void migrate_dead_tasks(unsigned int dead_cpu)\n{\n\tstruct rq *rq = cpu_rq(dead_cpu);\n\tunsigned int arr, i;\n\n\tfor (arr = 0; arr < 2; arr++) {\n\t\tfor (i = 0; i < MAX_PRIO; i++) {\n\t\t\tstruct list_head *list = &rq->arrays[arr].queue[i];\n\n\t\t\twhile (!list_empty(list))\n\t\t\t\tmigrate_dead(dead_cpu, list_entry(list->next,\n\t\t\t\t\t struct task_struct, run_list));\n\t\t}\n\t}\n}\n#endif /* CONFIG_HOTPLUG_CPU */\n\n/*\n * migration_call - callback that gets triggered when a CPU is added.\n * Here we can start up the necessary migration thread for the new CPU.\n */\nstatic int __cpuinit\nmigration_call(struct notifier_block *nfb, unsigned long action, void *hcpu)\n{\n\tstruct task_struct *p;\n\tint cpu = (long)hcpu;\n\tunsigned long flags;\n\tstruct rq *rq;\n\n\tswitch (action) {\n\tcase CPU_LOCK_ACQUIRE:\n\t\tmutex_lock(&sched_hotcpu_mutex);\n\t\tbreak;\n\n\tcase CPU_UP_PREPARE:\n\tcase CPU_UP_PREPARE_FROZEN:\n\t\tp = kthread_create(migration_thread, hcpu, \"migration/%d\",cpu);\n\t\tif (IS_ERR(p))\n\t\t\treturn NOTIFY_BAD;\n\t\tp->flags |= PF_NOFREEZE;\n\t\tkthread_bind(p, cpu);\n\t\t/* Must be high prio: stop_machine expects to yield to it. */\n\t\trq = task_rq_lock(p, &flags);\n\t\t__setscheduler(p, SCHED_FIFO, MAX_RT_PRIO-1);\n\t\ttask_rq_unlock(rq, &flags);\n\t\tcpu_rq(cpu)->migration_thread = p;\n\t\tbreak;\n\n\tcase CPU_ONLINE:\n\tcase CPU_ONLINE_FROZEN:\n\t\t/* Strictly unneccessary, as first user will wake it. */\n\t\twake_up_process(cpu_rq(cpu)->migration_thread);\n\t\tbreak;\n\n#ifdef CONFIG_HOTPLUG_CPU\n\tcase CPU_UP_CANCELED:\n\tcase CPU_UP_CANCELED_FROZEN:\n\t\tif (!cpu_rq(cpu)->migration_thread)\n\t\t\tbreak;\n\t\t/* Unbind it from offline cpu so it can run. Fall thru. */\n\t\tkthread_bind(cpu_rq(cpu)->migration_thread,\n\t\t\t any_online_cpu(cpu_online_map));\n\t\tkthread_stop(cpu_rq(cpu)->migration_thread);\n\t\tcpu_rq(cpu)->migration_thread = NULL;\n\t\tbreak;\n\n\tcase CPU_DEAD:\n\tcase CPU_DEAD_FROZEN:\n\t\tmigrate_live_tasks(cpu);\n\t\trq = cpu_rq(cpu);\n\t\tkthread_stop(rq->migration_thread);\n\t\trq->migration_thread = NULL;\n\t\t/* Idle task back to normal (off runqueue, low prio) */\n\t\trq = task_rq_lock(rq->idle, &flags);\n\t\tdeactivate_task(rq->idle, rq);\n\t\trq->idle->static_prio = MAX_PRIO;\n\t\t__setscheduler(rq->idle, SCHED_NORMAL, 0);\n\t\tmigrate_dead_tasks(cpu);\n\t\ttask_rq_unlock(rq, &flags);\n\t\tmigrate_nr_uninterruptible(rq);\n\t\tBUG_ON(rq->nr_running != 0);\n\n\t\t/* No need to migrate the tasks: it was best-effort if\n\t\t * they didn't take sched_hotcpu_mutex. Just wake up\n\t\t * the requestors. */\n\t\tspin_lock_irq(&rq->lock);\n\t\twhile (!list_empty(&rq->migration_queue)) {\n\t\t\tstruct migration_req *req;\n\n\t\t\treq = list_entry(rq->migration_queue.next,\n\t\t\t\t\t struct migration_req, list);\n\t\t\tlist_del_init(&req->list);\n\t\t\tcomplete(&req->done);\n\t\t}\n\t\tspin_unlock_irq(&rq->lock);\n\t\tbreak;\n#endif\n\tcase CPU_LOCK_RELEASE:\n\t\tmutex_unlock(&sched_hotcpu_mutex);\n\t\tbreak;\n\t}\n\treturn NOTIFY_OK;\n}\n\n/* Register at highest priority so that task migration (migrate_all_tasks)\n * happens before everything else.\n */\nstatic struct notifier_block __cpuinitdata migration_notifier = {\n\t.notifier_call = migration_call,\n\t.priority = 10\n};\n\nint __init migration_init(void)\n{\n\tvoid *cpu = (void *)(long)smp_processor_id();\n\tint err;\n\n\t/* Start one for the boot CPU: */\n\terr = migration_call(&migration_notifier, CPU_UP_PREPARE, cpu);\n\tBUG_ON(err == NOTIFY_BAD);\n\tmigration_call(&migration_notifier, CPU_ONLINE, cpu);\n\tregister_cpu_notifier(&migration_notifier);\n\n\treturn 0;\n}\n#endif\n\n#ifdef CONFIG_SMP\n\n/* Number of possible processor ids */\nint nr_cpu_ids __read_mostly = NR_CPUS;\nEXPORT_SYMBOL(nr_cpu_ids);\n\n#undef SCHED_DOMAIN_DEBUG\n#ifdef SCHED_DOMAIN_DEBUG\nstatic void sched_domain_debug(struct sched_domain *sd, int cpu)\n{\n\tint level = 0;\n\n\tif (!sd) {\n\t\tprintk(KERN_DEBUG \"CPU%d attaching NULL sched-domain.\\n\", cpu);\n\t\treturn;\n\t}\n\n\tprintk(KERN_DEBUG \"CPU%d attaching sched-domain:\\n\", cpu);\n\n\tdo {\n\t\tint i;\n\t\tchar str[NR_CPUS];\n\t\tstruct sched_group *group = sd->groups;\n\t\tcpumask_t groupmask;\n\n\t\tcpumask_scnprintf(str, NR_CPUS, sd->span);\n\t\tcpus_clear(groupmask);\n\n\t\tprintk(KERN_DEBUG);\n\t\tfor (i = 0; i < level + 1; i++)\n\t\t\tprintk(\" \");\n\t\tprintk(\"domain %d: \", level);\n\n\t\tif (!(sd->flags & SD_LOAD_BALANCE)) {\n\t\t\tprintk(\"does not load-balance\\n\");\n\t\t\tif (sd->parent)\n\t\t\t\tprintk(KERN_ERR \"ERROR: !SD_LOAD_BALANCE domain\"\n\t\t\t\t\t\t\" has parent\");\n\t\t\tbreak;\n\t\t}\n\n\t\tprintk(\"span %s\\n\", str);\n\n\t\tif (!cpu_isset(cpu, sd->span))\n\t\t\tprintk(KERN_ERR \"ERROR: domain->span does not contain \"\n\t\t\t\t\t\"CPU%d\\n\", cpu);\n\t\tif (!cpu_isset(cpu, group->cpumask))\n\t\t\tprintk(KERN_ERR \"ERROR: domain->groups does not contain\"\n\t\t\t\t\t\" CPU%d\\n\", cpu);\n\n\t\tprintk(KERN_DEBUG);\n\t\tfor (i = 0; i < level + 2; i++)\n\t\t\tprintk(\" \");\n\t\tprintk(\"groups:\");\n\t\tdo {\n\t\t\tif (!group) {\n\t\t\t\tprintk(\"\\n\");\n\t\t\t\tprintk(KERN_ERR \"ERROR: group is NULL\\n\");\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif (!group->__cpu_power) {\n\t\t\t\tprintk(\"\\n\");\n\t\t\t\tprintk(KERN_ERR \"ERROR: domain->cpu_power not \"\n\t\t\t\t\t\t\"set\\n\");\n\t\t\t}\n\n\t\t\tif (!cpus_weight(group->cpumask)) {\n\t\t\t\tprintk(\"\\n\");\n\t\t\t\tprintk(KERN_ERR \"ERROR: empty group\\n\");\n\t\t\t}\n\n\t\t\tif (cpus_intersects(groupmask, group->cpumask)) {\n\t\t\t\tprintk(\"\\n\");\n\t\t\t\tprintk(KERN_ERR \"ERROR: repeated CPUs\\n\");\n\t\t\t}\n\n\t\t\tcpus_or(groupmask, groupmask, group->cpumask);\n\n\t\t\tcpumask_scnprintf(str, NR_CPUS, group->cpumask);\n\t\t\tprintk(\" %s\", str);\n\n\t\t\tgroup = group->next;\n\t\t} while (group != sd->groups);\n\t\tprintk(\"\\n\");\n\n\t\tif (!cpus_equal(sd->span, groupmask))\n\t\t\tprintk(KERN_ERR \"ERROR: groups don't span \"\n\t\t\t\t\t\"domain->span\\n\");\n\n\t\tlevel++;\n\t\tsd = sd->parent;\n\t\tif (!sd)\n\t\t\tcontinue;\n\n\t\tif (!cpus_subset(groupmask, sd->span))\n\t\t\tprintk(KERN_ERR \"ERROR: parent span is not a superset \"\n\t\t\t\t\"of domain->span\\n\");\n\n\t} while (sd);\n}\n#else\n# define sched_domain_debug(sd, cpu) do { } while (0)\n#endif\n\nstatic int sd_degenerate(struct sched_domain *sd)\n{\n\tif (cpus_weight(sd->span) == 1)\n\t\treturn 1;\n\n\t/* Following flags need at least 2 groups */\n\tif (sd->flags & (SD_LOAD_BALANCE |\n\t\t\t SD_BALANCE_NEWIDLE |\n\t\t\t SD_BALANCE_FORK |\n\t\t\t SD_BALANCE_EXEC |\n\t\t\t SD_SHARE_CPUPOWER |\n\t\t\t SD_SHARE_PKG_RESOURCES)) {\n\t\tif (sd->groups != sd->groups->next)\n\t\t\treturn 0;\n\t}\n\n\t/* Following flags don't use groups */\n\tif (sd->flags & (SD_WAKE_IDLE |\n\t\t\t SD_WAKE_AFFINE |\n\t\t\t SD_WAKE_BALANCE))\n\t\treturn 0;\n\n\treturn 1;\n}\n\nstatic int\nsd_parent_degenerate(struct sched_domain *sd, struct sched_domain *parent)\n{\n\tunsigned long cflags = sd->flags, pflags = parent->flags;\n\n\tif (sd_degenerate(parent))\n\t\treturn 1;\n\n\tif (!cpus_equal(sd->span, parent->span))\n\t\treturn 0;\n\n\t/* Does parent contain flags not in child? */\n\t/* WAKE_BALANCE is a subset of WAKE_AFFINE */\n\tif (cflags & SD_WAKE_AFFINE)\n\t\tpflags &= ~SD_WAKE_BALANCE;\n\t/* Flags needing groups don't count if only 1 group in parent */\n\tif (parent->groups == parent->groups->next) {\n\t\tpflags &= ~(SD_LOAD_BALANCE |\n\t\t\t\tSD_BALANCE_NEWIDLE |\n\t\t\t\tSD_BALANCE_FORK |\n\t\t\t\tSD_BALANCE_EXEC |\n\t\t\t\tSD_SHARE_CPUPOWER |\n\t\t\t\tSD_SHARE_PKG_RESOURCES);\n\t}\n\tif (~cflags & pflags)\n\t\treturn 0;\n\n\treturn 1;\n}\n\n/*\n * Attach the domain 'sd' to 'cpu' as its base domain. Callers must\n * hold the hotplug lock.\n */\nstatic void cpu_attach_domain(struct sched_domain *sd, int cpu)\n{\n\tstruct rq *rq = cpu_rq(cpu);\n\tstruct sched_domain *tmp;\n\n\t/* Remove the sched domains which do not contribute to scheduling. */\n\tfor (tmp = sd; tmp; tmp = tmp->parent) {\n\t\tstruct sched_domain *parent = tmp->parent;\n\t\tif (!parent)\n\t\t\tbreak;\n\t\tif (sd_parent_degenerate(tmp, parent)) {\n\t\t\ttmp->parent = parent->parent;\n\t\t\tif (parent->parent)\n\t\t\t\tparent->parent->child = tmp;\n\t\t}\n\t}\n\n\tif (sd && sd_degenerate(sd)) {\n\t\tsd = sd->parent;\n\t\tif (sd)\n\t\t\tsd->child = NULL;\n\t}\n\n\tsched_domain_debug(sd, cpu);\n\n\trcu_assign_pointer(rq->sd, sd);\n}\n\n/* cpus with isolated domains */\nstatic cpumask_t cpu_isolated_map = CPU_MASK_NONE;\n\n/* Setup the mask of cpus configured for isolated domains */\nstatic int __init isolated_cpu_setup(char *str)\n{\n\tint ints[NR_CPUS], i;\n\n\tstr = get_options(str, ARRAY_SIZE(ints), ints);\n\tcpus_clear(cpu_isolated_map);\n\tfor (i = 1; i <= ints[0]; i++)\n\t\tif (ints[i] < NR_CPUS)\n\t\t\tcpu_set(ints[i], cpu_isolated_map);\n\treturn 1;\n}\n\n__setup (\"isolcpus=\", isolated_cpu_setup);\n\n/*\n * init_sched_build_groups takes the cpumask we wish to span, and a pointer\n * to a function which identifies what group(along with sched group) a CPU\n * belongs to. The return value of group_fn must be a >= 0 and < NR_CPUS\n * (due to the fact that we keep track of groups covered with a cpumask_t).\n *\n * init_sched_build_groups will build a circular linked list of the groups\n * covered by the given span, and will set each group's ->cpumask correctly,\n * and ->cpu_power to 0.\n */\nstatic void\ninit_sched_build_groups(cpumask_t span, const cpumask_t *cpu_map,\n\t\t\tint (*group_fn)(int cpu, const cpumask_t *cpu_map,\n\t\t\t\t\tstruct sched_group **sg))\n{\n\tstruct sched_group *first = NULL, *last = NULL;\n\tcpumask_t covered = CPU_MASK_NONE;\n\tint i;\n\n\tfor_each_cpu_mask(i, span) {\n\t\tstruct sched_group *sg;\n\t\tint group = group_fn(i, cpu_map, &sg);\n\t\tint j;\n\n\t\tif (cpu_isset(i, covered))\n\t\t\tcontinue;\n\n\t\tsg->cpumask = CPU_MASK_NONE;\n\t\tsg->__cpu_power = 0;\n\n\t\tfor_each_cpu_mask(j, span) {\n\t\t\tif (group_fn(j, cpu_map, NULL) != group)\n\t\t\t\tcontinue;\n\n\t\t\tcpu_set(j, covered);\n\t\t\tcpu_set(j, sg->cpumask);\n\t\t}\n\t\tif (!first)\n\t\t\tfirst = sg;\n\t\tif (last)\n\t\t\tlast->next = sg;\n\t\tlast = sg;\n\t}\n\tlast->next = first;\n}\n\n#define SD_NODES_PER_DOMAIN 16\n\n/*\n * Self-tuning task migration cost measurement between source and target CPUs.\n *\n * This is done by measuring the cost of manipulating buffers of varying\n * sizes. For a given buffer-size here are the steps that are taken:\n *\n * 1) the source CPU reads+dirties a shared buffer\n * 2) the target CPU reads+dirties the same shared buffer\n *\n * We measure how long they take, in the following 4 scenarios:\n *\n * - source: CPU1, target: CPU2 | cost1\n * - source: CPU2, target: CPU1 | cost2\n * - source: CPU1, target: CPU1 | cost3\n * - source: CPU2, target: CPU2 | cost4\n *\n * We then calculate the cost3+cost4-cost1-cost2 difference - this is\n * the cost of migration.\n *\n * We then start off from a small buffer-size and iterate up to larger\n * buffer sizes, in 5% steps - measuring each buffer-size separately, and\n * doing a maximum search for the cost. (The maximum cost for a migration\n * normally occurs when the working set size is around the effective cache\n * size.)\n */\n#define SEARCH_SCOPE\t\t2\n#define MIN_CACHE_SIZE\t\t(64*1024U)\n#define DEFAULT_CACHE_SIZE\t(5*1024*1024U)\n#define ITERATIONS\t\t1\n#define SIZE_THRESH\t\t130\n#define COST_THRESH\t\t130\n\n/*\n * The migration cost is a function of 'domain distance'. Domain\n * distance is the number of steps a CPU has to iterate down its\n * domain tree to share a domain with the other CPU. The farther\n * two CPUs are from each other, the larger the distance gets.\n *\n * Note that we use the distance only to cache measurement results,\n * the distance value is not used numerically otherwise. When two\n * CPUs have the same distance it is assumed that the migration\n * cost is the same. (this is a simplification but quite practical)\n */\n#define MAX_DOMAIN_DISTANCE 32\n\nstatic unsigned long long migration_cost[MAX_DOMAIN_DISTANCE] =\n\t\t{ [ 0 ... MAX_DOMAIN_DISTANCE-1 ] =\n/*\n * Architectures may override the migration cost and thus avoid\n * boot-time calibration. Unit is nanoseconds. Mostly useful for\n * virtualized hardware:\n */\n#ifdef CONFIG_DEFAULT_MIGRATION_COST\n\t\t\tCONFIG_DEFAULT_MIGRATION_COST\n#else\n\t\t\t-1LL\n#endif\n};\n\n/*\n * Allow override of migration cost - in units of microseconds.\n * E.g. migration_cost=1000,2000,3000 will set up a level-1 cost\n * of 1 msec, level-2 cost of 2 msecs and level3 cost of 3 msecs:\n */\nstatic int __init migration_cost_setup(char *str)\n{\n\tint ints[MAX_DOMAIN_DISTANCE+1], i;\n\n\tstr = get_options(str, ARRAY_SIZE(ints), ints);\n\n\tprintk(\"#ints: %d\\n\", ints[0]);\n\tfor (i = 1; i <= ints[0]; i++) {\n\t\tmigration_cost[i-1] = (unsigned long long)ints[i]*1000;\n\t\tprintk(\"migration_cost[%d]: %Ld\\n\", i-1, migration_cost[i-1]);\n\t}\n\treturn 1;\n}\n\n__setup (\"migration_cost=\", migration_cost_setup);\n\n/*\n * Global multiplier (divisor) for migration-cutoff values,\n * in percentiles. E.g. use a value of 150 to get 1.5 times\n * longer cache-hot cutoff times.\n *\n * (We scale it from 100 to 128 to long long handling easier.)\n */\n\n#define MIGRATION_FACTOR_SCALE 128\n\nstatic unsigned int migration_factor = MIGRATION_FACTOR_SCALE;\n\nstatic int __init setup_migration_factor(char *str)\n{\n\tget_option(&str, &migration_factor);\n\tmigration_factor = migration_factor * MIGRATION_FACTOR_SCALE / 100;\n\treturn 1;\n}\n\n__setup(\"migration_factor=\", setup_migration_factor);\n\n/*\n * Estimated distance of two CPUs, measured via the number of domains\n * we have to pass for the two CPUs to be in the same span:\n */\nstatic unsigned long domain_distance(int cpu1, int cpu2)\n{\n\tunsigned long distance = 0;\n\tstruct sched_domain *sd;\n\n\tfor_each_domain(cpu1, sd) {\n\t\tWARN_ON(!cpu_isset(cpu1, sd->span));\n\t\tif (cpu_isset(cpu2, sd->span))\n\t\t\treturn distance;\n\t\tdistance++;\n\t}\n\tif (distance >= MAX_DOMAIN_DISTANCE) {\n\t\tWARN_ON(1);\n\t\tdistance = MAX_DOMAIN_DISTANCE-1;\n\t}\n\n\treturn distance;\n}\n\nstatic unsigned int migration_debug;\n\nstatic int __init setup_migration_debug(char *str)\n{\n\tget_option(&str, &migration_debug);\n\treturn 1;\n}\n\n__setup(\"migration_debug=\", setup_migration_debug);\n\n/*\n * Maximum cache-size that the scheduler should try to measure.\n * Architectures with larger caches should tune this up during\n * bootup. Gets used in the domain-setup code (i.e. during SMP\n * bootup).\n */\nunsigned int max_cache_size;\n\nstatic int __init setup_max_cache_size(char *str)\n{\n\tget_option(&str, &max_cache_size);\n\treturn 1;\n}\n\n__setup(\"max_cache_size=\", setup_max_cache_size);\n\n/*\n * Dirty a big buffer in a hard-to-predict (for the L2 cache) way. This\n * is the operation that is timed, so we try to generate unpredictable\n * cachemisses that still end up filling the L2 cache:\n */\nstatic void touch_cache(void *__cache, unsigned long __size)\n{\n\tunsigned long size = __size / sizeof(long);\n\tunsigned long chunk1 = size / 3;\n\tunsigned long chunk2 = 2 * size / 3;\n\tunsigned long *cache = __cache;\n\tint i;\n\n\tfor (i = 0; i < size/6; i += 8) {\n\t\tswitch (i % 6) {\n\t\t\tcase 0: cache[i]++;\n\t\t\tcase 1: cache[size-1-i]++;\n\t\t\tcase 2: cache[chunk1-i]++;\n\t\t\tcase 3: cache[chunk1+i]++;\n\t\t\tcase 4: cache[chunk2-i]++;\n\t\t\tcase 5: cache[chunk2+i]++;\n\t\t}\n\t}\n}\n\n/*\n * Measure the cache-cost of one task migration. Returns in units of nsec.\n */\nstatic unsigned long long\nmeasure_one(void *cache, unsigned long size, int source, int target)\n{\n\tcpumask_t mask, saved_mask;\n\tunsigned long long t0, t1, t2, t3, cost;\n\n\tsaved_mask = current->cpus_allowed;\n\n\t/*\n\t * Flush source caches to RAM and invalidate them:\n\t */\n\tsched_cacheflush();\n\n\t/*\n\t * Migrate to the source CPU:\n\t */\n\tmask = cpumask_of_cpu(source);\n\tset_cpus_allowed(current, mask);\n\tWARN_ON(smp_processor_id() != source);\n\n\t/*\n\t * Dirty the working set:\n\t */\n\tt0 = sched_clock();\n\ttouch_cache(cache, size);\n\tt1 = sched_clock();\n\n\t/*\n\t * Migrate to the target CPU, dirty the L2 cache and access\n\t * the shared buffer. (which represents the working set\n\t * of a migrated task.)\n\t */\n\tmask = cpumask_of_cpu(target);\n\tset_cpus_allowed(current, mask);\n\tWARN_ON(smp_processor_id() != target);\n\n\tt2 = sched_clock();\n\ttouch_cache(cache, size);\n\tt3 = sched_clock();\n\n\tcost = t1-t0 + t3-t2;\n\n\tif (migration_debug >= 2)\n\t\tprintk(\"[%d->%d]: %8Ld %8Ld %8Ld => %10Ld.\\n\",\n\t\t\tsource, target, t1-t0, t1-t0, t3-t2, cost);\n\t/*\n\t * Flush target caches to RAM and invalidate them:\n\t */\n\tsched_cacheflush();\n\n\tset_cpus_allowed(current, saved_mask);\n\n\treturn cost;\n}\n\n/*\n * Measure a series of task migrations and return the average\n * result. Since this code runs early during bootup the system\n * is 'undisturbed' and the average latency makes sense.\n *\n * The algorithm in essence auto-detects the relevant cache-size,\n * so it will properly detect different cachesizes for different\n * cache-hierarchies, depending on how the CPUs are connected.\n *\n * Architectures can prime the upper limit of the search range via\n * max_cache_size, otherwise the search range defaults to 20MB...64K.\n */\nstatic unsigned long long\nmeasure_cost(int cpu1, int cpu2, void *cache, unsigned int size)\n{\n\tunsigned long long cost1, cost2;\n\tint i;\n\n\t/*\n\t * Measure the migration cost of 'size' bytes, over an\n\t * average of 10 runs:\n\t *\n\t * (We perturb the cache size by a small (0..4k)\n\t * value to compensate size/alignment related artifacts.\n\t * We also subtract the cost of the operation done on\n\t * the same CPU.)\n\t */\n\tcost1 = 0;\n\n\t/*\n\t * dry run, to make sure we start off cache-cold on cpu1,\n\t * and to get any vmalloc pagefaults in advance:\n\t */\n\tmeasure_one(cache, size, cpu1, cpu2);\n\tfor (i = 0; i < ITERATIONS; i++)\n\t\tcost1 += measure_one(cache, size - i * 1024, cpu1, cpu2);\n\n\tmeasure_one(cache, size, cpu2, cpu1);\n\tfor (i = 0; i < ITERATIONS; i++)\n\t\tcost1 += measure_one(cache, size - i * 1024, cpu2, cpu1);\n\n\t/*\n\t * (We measure the non-migrating [cached] cost on both\n\t * cpu1 and cpu2, to handle CPUs with different speeds)\n\t */\n\tcost2 = 0;\n\n\tmeasure_one(cache, size, cpu1, cpu1);\n\tfor (i = 0; i < ITERATIONS; i++)\n\t\tcost2 += measure_one(cache, size - i * 1024, cpu1, cpu1);\n\n\tmeasure_one(cache, size, cpu2, cpu2);\n\tfor (i = 0; i < ITERATIONS; i++)\n\t\tcost2 += measure_one(cache, size - i * 1024, cpu2, cpu2);\n\n\t/*\n\t * Get the per-iteration migration cost:\n\t */\n\tdo_div(cost1, 2 * ITERATIONS);\n\tdo_div(cost2, 2 * ITERATIONS);\n\n\treturn cost1 - cost2;\n}\n\nstatic unsigned long long measure_migration_cost(int cpu1, int cpu2)\n{\n\tunsigned long long max_cost = 0, fluct = 0, avg_fluct = 0;\n\tunsigned int max_size, size, size_found = 0;\n\tlong long cost = 0, prev_cost;\n\tvoid *cache;\n\n\t/*\n\t * Search from max_cache_size*5 down to 64K - the real relevant\n\t * cachesize has to lie somewhere inbetween.\n\t */\n\tif (max_cache_size) {\n\t\tmax_size = max(max_cache_size * SEARCH_SCOPE, MIN_CACHE_SIZE);\n\t\tsize = max(max_cache_size / SEARCH_SCOPE, MIN_CACHE_SIZE);\n\t} else {\n\t\t/*\n\t\t * Since we have no estimation about the relevant\n\t\t * search range\n\t\t */\n\t\tmax_size = DEFAULT_CACHE_SIZE * SEARCH_SCOPE;\n\t\tsize = MIN_CACHE_SIZE;\n\t}\n\n\tif (!cpu_online(cpu1) || !cpu_online(cpu2)) {\n\t\tprintk(\"cpu %d and %d not both online!\\n\", cpu1, cpu2);\n\t\treturn 0;\n\t}\n\n\t/*\n\t * Allocate the working set:\n\t */\n\tcache = vmalloc(max_size);\n\tif (!cache) {\n\t\tprintk(\"could not vmalloc %d bytes for cache!\\n\", 2 * max_size);\n\t\treturn 1000000; /* return 1 msec on very small boxen */\n\t}\n\n\twhile (size <= max_size) {\n\t\tprev_cost = cost;\n\t\tcost = measure_cost(cpu1, cpu2, cache, size);\n\n\t\t/*\n\t\t * Update the max:\n\t\t */\n\t\tif (cost > 0) {\n\t\t\tif (max_cost < cost) {\n\t\t\t\tmax_cost = cost;\n\t\t\t\tsize_found = size;\n\t\t\t}\n\t\t}\n\t\t/*\n\t\t * Calculate average fluctuation, we use this to prevent\n\t\t * noise from triggering an early break out of the loop:\n\t\t */\n\t\tfluct = abs(cost - prev_cost);\n\t\tavg_fluct = (avg_fluct + fluct)/2;\n\n\t\tif (migration_debug)\n\t\t\tprintk(\"-> [%d][%d][%7d] %3ld.%ld [%3ld.%ld] (%ld): \"\n\t\t\t\t\"(%8Ld %8Ld)\\n\",\n\t\t\t\tcpu1, cpu2, size,\n\t\t\t\t(long)cost / 1000000,\n\t\t\t\t((long)cost / 100000) % 10,\n\t\t\t\t(long)max_cost / 1000000,\n\t\t\t\t((long)max_cost / 100000) % 10,\n\t\t\t\tdomain_distance(cpu1, cpu2),\n\t\t\t\tcost, avg_fluct);\n\n\t\t/*\n\t\t * If we iterated at least 20% past the previous maximum,\n\t\t * and the cost has dropped by more than 20% already,\n\t\t * (taking fluctuations into account) then we assume to\n\t\t * have found the maximum and break out of the loop early:\n\t\t */\n\t\tif (size_found && (size*100 > size_found*SIZE_THRESH))\n\t\t\tif (cost+avg_fluct <= 0 ||\n\t\t\t\tmax_cost*100 > (cost+avg_fluct)*COST_THRESH) {\n\n\t\t\t\tif (migration_debug)\n\t\t\t\t\tprintk(\"-> found max.\\n\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t/*\n\t\t * Increase the cachesize in 10% steps:\n\t\t */\n\t\tsize = size * 10 / 9;\n\t}\n\n\tif (migration_debug)\n\t\tprintk(\"[%d][%d] working set size found: %d, cost: %Ld\\n\",\n\t\t\tcpu1, cpu2, size_found, max_cost);\n\n\tvfree(cache);\n\n\t/*\n\t * A task is considered 'cache cold' if at least 2 times\n\t * the worst-case cost of migration has passed.\n\t *\n\t * (this limit is only listened to if the load-balancing\n\t * situation is 'nice' - if there is a large imbalance we\n\t * ignore it for the sake of CPU utilization and\n\t * processing fairness.)\n\t */\n\treturn 2 * max_cost * migration_factor / MIGRATION_FACTOR_SCALE;\n}\n\nstatic void calibrate_migration_costs(const cpumask_t *cpu_map)\n{\n\tint cpu1 = -1, cpu2 = -1, cpu, orig_cpu = raw_smp_processor_id();\n\tunsigned long j0, j1, distance, max_distance = 0;\n\tstruct sched_domain *sd;\n\n\tj0 = jiffies;\n\n\t/*\n\t * First pass - calculate the cacheflush times:\n\t */\n\tfor_each_cpu_mask(cpu1, *cpu_map) {\n\t\tfor_each_cpu_mask(cpu2, *cpu_map) {\n\t\t\tif (cpu1 == cpu2)\n\t\t\t\tcontinue;\n\t\t\tdistance = domain_distance(cpu1, cpu2);\n\t\t\tmax_distance = max(max_distance, distance);\n\t\t\t/*\n\t\t\t * No result cached yet?\n\t\t\t */\n\t\t\tif (migration_cost[distance] == -1LL)\n\t\t\t\tmigration_cost[distance] =\n\t\t\t\t\tmeasure_migration_cost(cpu1, cpu2);\n\t\t}\n\t}\n\t/*\n\t * Second pass - update the sched domain hierarchy with\n\t * the new cache-hot-time estimations:\n\t */\n\tfor_each_cpu_mask(cpu, *cpu_map) {\n\t\tdistance = 0;\n\t\tfor_each_domain(cpu, sd) {\n\t\t\tsd->cache_hot_time = migration_cost[distance];\n\t\t\tdistance++;\n\t\t}\n\t}\n\t/*\n\t * Print the matrix:\n\t */\n\tif (migration_debug)\n\t\tprintk(\"migration: max_cache_size: %d, cpu: %d MHz:\\n\",\n\t\t\tmax_cache_size,\n#ifdef CONFIG_X86\n\t\t\tcpu_khz/1000\n#else\n\t\t\t-1\n#endif\n\t\t);\n\tif (system_state == SYSTEM_BOOTING && num_online_cpus() > 1) {\n\t\tprintk(\"migration_cost=\");\n\t\tfor (distance = 0; distance <= max_distance; distance++) {\n\t\t\tif (distance)\n\t\t\t\tprintk(\",\");\n\t\t\tprintk(\"%ld\", (long)migration_cost[distance] / 1000);\n\t\t}\n\t\tprintk(\"\\n\");\n\t}\n\tj1 = jiffies;\n\tif (migration_debug)\n\t\tprintk(\"migration: %ld seconds\\n\", (j1-j0) / HZ);\n\n\t/*\n\t * Move back to the original CPU. NUMA-Q gets confused\n\t * if we migrate to another quad during bootup.\n\t */\n\tif (raw_smp_processor_id() != orig_cpu) {\n\t\tcpumask_t mask = cpumask_of_cpu(orig_cpu),\n\t\t\tsaved_mask = current->cpus_allowed;\n\n\t\tset_cpus_allowed(current, mask);\n\t\tset_cpus_allowed(current, saved_mask);\n\t}\n}\n\n#ifdef CONFIG_NUMA\n\n/**\n * find_next_best_node - find the next node to include in a sched_domain\n * @node: node whose sched_domain we're building\n * @used_nodes: nodes already in the sched_domain\n *\n * Find the next node to include in a given scheduling domain. Simply\n * finds the closest node not already in the @used_nodes map.\n *\n * Should use nodemask_t.\n */\nstatic int find_next_best_node(int node, unsigned long *used_nodes)\n{\n\tint i, n, val, min_val, best_node = 0;\n\n\tmin_val = INT_MAX;\n\n\tfor (i = 0; i < MAX_NUMNODES; i++) {\n\t\t/* Start at @node */\n\t\tn = (node + i) % MAX_NUMNODES;\n\n\t\tif (!nr_cpus_node(n))\n\t\t\tcontinue;\n\n\t\t/* Skip already used nodes */\n\t\tif (test_bit(n, used_nodes))\n\t\t\tcontinue;\n\n\t\t/* Simple min distance search */\n\t\tval = node_distance(node, n);\n\n\t\tif (val < min_val) {\n\t\t\tmin_val = val;\n\t\t\tbest_node = n;\n\t\t}\n\t}\n\n\tset_bit(best_node, used_nodes);\n\treturn best_node;\n}\n\n/**\n * sched_domain_node_span - get a cpumask for a node's sched_domain\n * @node: node whose cpumask we're constructing\n * @size: number of nodes to include in this span\n *\n * Given a node, construct a good cpumask for its sched_domain to span. It\n * should be one that prevents unnecessary balancing, but also spreads tasks\n * out optimally.\n */\nstatic cpumask_t sched_domain_node_span(int node)\n{\n\tDECLARE_BITMAP(used_nodes, MAX_NUMNODES);\n\tcpumask_t span, nodemask;\n\tint i;\n\n\tcpus_clear(span);\n\tbitmap_zero(used_nodes, MAX_NUMNODES);\n\n\tnodemask = node_to_cpumask(node);\n\tcpus_or(span, span, nodemask);\n\tset_bit(node, used_nodes);\n\n\tfor (i = 1; i < SD_NODES_PER_DOMAIN; i++) {\n\t\tint next_node = find_next_best_node(node, used_nodes);\n\n\t\tnodemask = node_to_cpumask(next_node);\n\t\tcpus_or(span, span, nodemask);\n\t}\n\n\treturn span;\n}\n#endif\n\nint sched_smt_power_savings = 0, sched_mc_power_savings = 0;\n\n/*\n * SMT sched-domains:\n */\n#ifdef CONFIG_SCHED_SMT\nstatic DEFINE_PER_CPU(struct sched_domain, cpu_domains);\nstatic DEFINE_PER_CPU(struct sched_group, sched_group_cpus);\n\nstatic int cpu_to_cpu_group(int cpu, const cpumask_t *cpu_map,\n\t\t\t struct sched_group **sg)\n{\n\tif (sg)\n\t\t*sg = &per_cpu(sched_group_cpus, cpu);\n\treturn cpu;\n}\n#endif\n\n/*\n * multi-core sched-domains:\n */\n#ifdef CONFIG_SCHED_MC\nstatic DEFINE_PER_CPU(struct sched_domain, core_domains);\nstatic DEFINE_PER_CPU(struct sched_group, sched_group_core);\n#endif\n\n#if defined(CONFIG_SCHED_MC) && defined(CONFIG_SCHED_SMT)\nstatic int cpu_to_core_group(int cpu, const cpumask_t *cpu_map,\n\t\t\t struct sched_group **sg)\n{\n\tint group;\n\tcpumask_t mask = cpu_sibling_map[cpu];\n\tcpus_and(mask, mask, *cpu_map);\n\tgroup = first_cpu(mask);\n\tif (sg)\n\t\t*sg = &per_cpu(sched_group_core, group);\n\treturn group;\n}\n#elif defined(CONFIG_SCHED_MC)\nstatic int cpu_to_core_group(int cpu, const cpumask_t *cpu_map,\n\t\t\t struct sched_group **sg)\n{\n\tif (sg)\n\t\t*sg = &per_cpu(sched_group_core, cpu);\n\treturn cpu;\n}\n#endif\n\nstatic DEFINE_PER_CPU(struct sched_domain, phys_domains);\nstatic DEFINE_PER_CPU(struct sched_group, sched_group_phys);\n\nstatic int cpu_to_phys_group(int cpu, const cpumask_t *cpu_map,\n\t\t\t struct sched_group **sg)\n{\n\tint group;\n#ifdef CONFIG_SCHED_MC\n\tcpumask_t mask = cpu_coregroup_map(cpu);\n\tcpus_and(mask, mask, *cpu_map);\n\tgroup = first_cpu(mask);\n#elif defined(CONFIG_SCHED_SMT)\n\tcpumask_t mask = cpu_sibling_map[cpu];\n\tcpus_and(mask, mask, *cpu_map);\n\tgroup = first_cpu(mask);\n#else\n\tgroup = cpu;\n#endif\n\tif (sg)\n\t\t*sg = &per_cpu(sched_group_phys, group);\n\treturn group;\n}\n\n#ifdef CONFIG_NUMA\n/*\n * The init_sched_build_groups can't handle what we want to do with node\n * groups, so roll our own. Now each node has its own list of groups which\n * gets dynamically allocated.\n */\nstatic DEFINE_PER_CPU(struct sched_domain, node_domains);\nstatic struct sched_group **sched_group_nodes_bycpu[NR_CPUS];\n\nstatic DEFINE_PER_CPU(struct sched_domain, allnodes_domains);\nstatic DEFINE_PER_CPU(struct sched_group, sched_group_allnodes);\n\nstatic int cpu_to_allnodes_group(int cpu, const cpumask_t *cpu_map,\n\t\t\t\t struct sched_group **sg)\n{\n\tcpumask_t nodemask = node_to_cpumask(cpu_to_node(cpu));\n\tint group;\n\n\tcpus_and(nodemask, nodemask, *cpu_map);\n\tgroup = first_cpu(nodemask);\n\n\tif (sg)\n\t\t*sg = &per_cpu(sched_group_allnodes, group);\n\treturn group;\n}\n\nstatic void init_numa_sched_groups_power(struct sched_group *group_head)\n{\n\tstruct sched_group *sg = group_head;\n\tint j;\n\n\tif (!sg)\n\t\treturn;\nnext_sg:\n\tfor_each_cpu_mask(j, sg->cpumask) {\n\t\tstruct sched_domain *sd;\n\n\t\tsd = &per_cpu(phys_domains, j);\n\t\tif (j != first_cpu(sd->groups->cpumask)) {\n\t\t\t/*\n\t\t\t * Only add \"power\" once for each\n\t\t\t * physical package.\n\t\t\t */\n\t\t\tcontinue;\n\t\t}\n\n\t\tsg_inc_cpu_power(sg, sd->groups->__cpu_power);\n\t}\n\tsg = sg->next;\n\tif (sg != group_head)\n\t\tgoto next_sg;\n}\n#endif\n\n#ifdef CONFIG_NUMA\n/* Free memory allocated for various sched_group structures */\nstatic void free_sched_groups(const cpumask_t *cpu_map)\n{\n\tint cpu, i;\n\n\tfor_each_cpu_mask(cpu, *cpu_map) {\n\t\tstruct sched_group **sched_group_nodes\n\t\t\t= sched_group_nodes_bycpu[cpu];\n\n\t\tif (!sched_group_nodes)\n\t\t\tcontinue;\n\n\t\tfor (i = 0; i < MAX_NUMNODES; i++) {\n\t\t\tcpumask_t nodemask = node_to_cpumask(i);\n\t\t\tstruct sched_group *oldsg, *sg = sched_group_nodes[i];\n\n\t\t\tcpus_and(nodemask, nodemask, *cpu_map);\n\t\t\tif (cpus_empty(nodemask))\n\t\t\t\tcontinue;\n\n\t\t\tif (sg == NULL)\n\t\t\t\tcontinue;\n\t\t\tsg = sg->next;\nnext_sg:\n\t\t\toldsg = sg;\n\t\t\tsg = sg->next;\n\t\t\tkfree(oldsg);\n\t\t\tif (oldsg != sched_group_nodes[i])\n\t\t\t\tgoto next_sg;\n\t\t}\n\t\tkfree(sched_group_nodes);\n\t\tsched_group_nodes_bycpu[cpu] = NULL;\n\t}\n}\n#else\nstatic void free_sched_groups(const cpumask_t *cpu_map)\n{\n}\n#endif\n\n/*\n * Initialize sched groups cpu_power.\n *\n * cpu_power indicates the capacity of sched group, which is used while\n * distributing the load between different sched groups in a sched domain.\n * Typically cpu_power for all the groups in a sched domain will be same unless\n * there are asymmetries in the topology. If there are asymmetries, group\n * having more cpu_power will pickup more load compared to the group having\n * less cpu_power.\n *\n * cpu_power will be a multiple of SCHED_LOAD_SCALE. This multiple represents\n * the maximum number of tasks a group can handle in the presence of other idle\n * or lightly loaded groups in the same sched domain.\n */\nstatic void init_sched_groups_power(int cpu, struct sched_domain *sd)\n{\n\tstruct sched_domain *child;\n\tstruct sched_group *group;\n\n\tWARN_ON(!sd || !sd->groups);\n\n\tif (cpu != first_cpu(sd->groups->cpumask))\n\t\treturn;\n\n\tchild = sd->child;\n\n\tsd->groups->__cpu_power = 0;\n\n\t/*\n\t * For perf policy, if the groups in child domain share resources\n\t * (for example cores sharing some portions of the cache hierarchy\n\t * or SMT), then set this domain groups cpu_power such that each group\n\t * can handle only one task, when there are other idle groups in the\n\t * same sched domain.\n\t */\n\tif (!child || (!(sd->flags & SD_POWERSAVINGS_BALANCE) &&\n\t\t (child->flags &\n\t\t\t(SD_SHARE_CPUPOWER | SD_SHARE_PKG_RESOURCES)))) {\n\t\tsg_inc_cpu_power(sd->groups, SCHED_LOAD_SCALE);\n\t\treturn;\n\t}\n\n\t/*\n\t * add cpu_power of each child group to this groups cpu_power\n\t */\n\tgroup = child->groups;\n\tdo {\n\t\tsg_inc_cpu_power(sd->groups, group->__cpu_power);\n\t\tgroup = group->next;\n\t} while (group != child->groups);\n}\n\n/*\n * Build sched domains for a given set of cpus and attach the sched domains\n * to the individual cpus\n */\nstatic int build_sched_domains(const cpumask_t *cpu_map)\n{\n\tint i;\n\tstruct sched_domain *sd;\n#ifdef CONFIG_NUMA\n\tstruct sched_group **sched_group_nodes = NULL;\n\tint sd_allnodes = 0;\n\n\t/*\n\t * Allocate the per-node list of sched groups\n\t */\n\tsched_group_nodes = kzalloc(sizeof(struct sched_group*)*MAX_NUMNODES,\n\t\t\t\t\t GFP_KERNEL);\n\tif (!sched_group_nodes) {\n\t\tprintk(KERN_WARNING \"Can not alloc sched group node list\\n\");\n\t\treturn -ENOMEM;\n\t}\n\tsched_group_nodes_bycpu[first_cpu(*cpu_map)] = sched_group_nodes;\n#endif\n\n\t/*\n\t * Set up domains for cpus specified by the cpu_map.\n\t */\n\tfor_each_cpu_mask(i, *cpu_map) {\n\t\tstruct sched_domain *sd = NULL, *p;\n\t\tcpumask_t nodemask = node_to_cpumask(cpu_to_node(i));\n\n\t\tcpus_and(nodemask, nodemask, *cpu_map);\n\n#ifdef CONFIG_NUMA\n\t\tif (cpus_weight(*cpu_map)\n\t\t\t\t> SD_NODES_PER_DOMAIN*cpus_weight(nodemask)) {\n\t\t\tsd = &per_cpu(allnodes_domains, i);\n\t\t\t*sd = SD_ALLNODES_INIT;\n\t\t\tsd->span = *cpu_map;\n\t\t\tcpu_to_allnodes_group(i, cpu_map, &sd->groups);\n\t\t\tp = sd;\n\t\t\tsd_allnodes = 1;\n\t\t} else\n\t\t\tp = NULL;\n\n\t\tsd = &per_cpu(node_domains, i);\n\t\t*sd = SD_NODE_INIT;\n\t\tsd->span = sched_domain_node_span(cpu_to_node(i));\n\t\tsd->parent = p;\n\t\tif (p)\n\t\t\tp->child = sd;\n\t\tcpus_and(sd->span, sd->span, *cpu_map);\n#endif\n\n\t\tp = sd;\n\t\tsd = &per_cpu(phys_domains, i);\n\t\t*sd = SD_CPU_INIT;\n\t\tsd->span = nodemask;\n\t\tsd->parent = p;\n\t\tif (p)\n\t\t\tp->child = sd;\n\t\tcpu_to_phys_group(i, cpu_map, &sd->groups);\n\n#ifdef CONFIG_SCHED_MC\n\t\tp = sd;\n\t\tsd = &per_cpu(core_domains, i);\n\t\t*sd = SD_MC_INIT;\n\t\tsd->span = cpu_coregroup_map(i);\n\t\tcpus_and(sd->span, sd->span, *cpu_map);\n\t\tsd->parent = p;\n\t\tp->child = sd;\n\t\tcpu_to_core_group(i, cpu_map, &sd->groups);\n#endif\n\n#ifdef CONFIG_SCHED_SMT\n\t\tp = sd;\n\t\tsd = &per_cpu(cpu_domains, i);\n\t\t*sd = SD_SIBLING_INIT;\n\t\tsd->span = cpu_sibling_map[i];\n\t\tcpus_and(sd->span, sd->span, *cpu_map);\n\t\tsd->parent = p;\n\t\tp->child = sd;\n\t\tcpu_to_cpu_group(i, cpu_map, &sd->groups);\n#endif\n\t}\n\n#ifdef CONFIG_SCHED_SMT\n\t/* Set up CPU (sibling) groups */\n\tfor_each_cpu_mask(i, *cpu_map) {\n\t\tcpumask_t this_sibling_map = cpu_sibling_map[i];\n\t\tcpus_and(this_sibling_map, this_sibling_map, *cpu_map);\n\t\tif (i != first_cpu(this_sibling_map))\n\t\t\tcontinue;\n\n\t\tinit_sched_build_groups(this_sibling_map, cpu_map, &cpu_to_cpu_group);\n\t}\n#endif\n\n#ifdef CONFIG_SCHED_MC\n\t/* Set up multi-core groups */\n\tfor_each_cpu_mask(i, *cpu_map) {\n\t\tcpumask_t this_core_map = cpu_coregroup_map(i);\n\t\tcpus_and(this_core_map, this_core_map, *cpu_map);\n\t\tif (i != first_cpu(this_core_map))\n\t\t\tcontinue;\n\t\tinit_sched_build_groups(this_core_map, cpu_map, &cpu_to_core_group);\n\t}\n#endif\n\n\n\t/* Set up physical groups */\n\tfor (i = 0; i < MAX_NUMNODES; i++) {\n\t\tcpumask_t nodemask = node_to_cpumask(i);\n\n\t\tcpus_and(nodemask, nodemask, *cpu_map);\n\t\tif (cpus_empty(nodemask))\n\t\t\tcontinue;\n\n\t\tinit_sched_build_groups(nodemask, cpu_map, &cpu_to_phys_group);\n\t}\n\n#ifdef CONFIG_NUMA\n\t/* Set up node groups */\n\tif (sd_allnodes)\n\t\tinit_sched_build_groups(*cpu_map, cpu_map, &cpu_to_allnodes_group);\n\n\tfor (i = 0; i < MAX_NUMNODES; i++) {\n\t\t/* Set up node groups */\n\t\tstruct sched_group *sg, *prev;\n\t\tcpumask_t nodemask = node_to_cpumask(i);\n\t\tcpumask_t domainspan;\n\t\tcpumask_t covered = CPU_MASK_NONE;\n\t\tint j;\n\n\t\tcpus_and(nodemask, nodemask, *cpu_map);\n\t\tif (cpus_empty(nodemask)) {\n\t\t\tsched_group_nodes[i] = NULL;\n\t\t\tcontinue;\n\t\t}\n\n\t\tdomainspan = sched_domain_node_span(i);\n\t\tcpus_and(domainspan, domainspan, *cpu_map);\n\n\t\tsg = kmalloc_node(sizeof(struct sched_group), GFP_KERNEL, i);\n\t\tif (!sg) {\n\t\t\tprintk(KERN_WARNING \"Can not alloc domain group for \"\n\t\t\t\t\"node %d\\n\", i);\n\t\t\tgoto error;\n\t\t}\n\t\tsched_group_nodes[i] = sg;\n\t\tfor_each_cpu_mask(j, nodemask) {\n\t\t\tstruct sched_domain *sd;\n\t\t\tsd = &per_cpu(node_domains, j);\n\t\t\tsd->groups = sg;\n\t\t}\n\t\tsg->__cpu_power = 0;\n\t\tsg->cpumask = nodemask;\n\t\tsg->next = sg;\n\t\tcpus_or(covered, covered, nodemask);\n\t\tprev = sg;\n\n\t\tfor (j = 0; j < MAX_NUMNODES; j++) {\n\t\t\tcpumask_t tmp, notcovered;\n\t\t\tint n = (i + j) % MAX_NUMNODES;\n\n\t\t\tcpus_complement(notcovered, covered);\n\t\t\tcpus_and(tmp, notcovered, *cpu_map);\n\t\t\tcpus_and(tmp, tmp, domainspan);\n\t\t\tif (cpus_empty(tmp))\n\t\t\t\tbreak;\n\n\t\t\tnodemask = node_to_cpumask(n);\n\t\t\tcpus_and(tmp, tmp, nodemask);\n\t\t\tif (cpus_empty(tmp))\n\t\t\t\tcontinue;\n\n\t\t\tsg = kmalloc_node(sizeof(struct sched_group),\n\t\t\t\t\t GFP_KERNEL, i);\n\t\t\tif (!sg) {\n\t\t\t\tprintk(KERN_WARNING\n\t\t\t\t\"Can not alloc domain group for node %d\\n\", j);\n\t\t\t\tgoto error;\n\t\t\t}\n\t\t\tsg->__cpu_power = 0;\n\t\t\tsg->cpumask = tmp;\n\t\t\tsg->next = prev->next;\n\t\t\tcpus_or(covered, covered, tmp);\n\t\t\tprev->next = sg;\n\t\t\tprev = sg;\n\t\t}\n\t}\n#endif\n\n\t/* Calculate CPU power for physical packages and nodes */\n#ifdef CONFIG_SCHED_SMT\n\tfor_each_cpu_mask(i, *cpu_map) {\n\t\tsd = &per_cpu(cpu_domains, i);\n\t\tinit_sched_groups_power(i, sd);\n\t}\n#endif\n#ifdef CONFIG_SCHED_MC\n\tfor_each_cpu_mask(i, *cpu_map) {\n\t\tsd = &per_cpu(core_domains, i);\n\t\tinit_sched_groups_power(i, sd);\n\t}\n#endif\n\n\tfor_each_cpu_mask(i, *cpu_map) {\n\t\tsd = &per_cpu(phys_domains, i);\n\t\tinit_sched_groups_power(i, sd);\n\t}\n\n#ifdef CONFIG_NUMA\n\tfor (i = 0; i < MAX_NUMNODES; i++)\n\t\tinit_numa_sched_groups_power(sched_group_nodes[i]);\n\n\tif (sd_allnodes) {\n\t\tstruct sched_group *sg;\n\n\t\tcpu_to_allnodes_group(first_cpu(*cpu_map), cpu_map, &sg);\n\t\tinit_numa_sched_groups_power(sg);\n\t}\n#endif\n\n\t/* Attach the domains */\n\tfor_each_cpu_mask(i, *cpu_map) {\n\t\tstruct sched_domain *sd;\n#ifdef CONFIG_SCHED_SMT\n\t\tsd = &per_cpu(cpu_domains, i);\n#elif defined(CONFIG_SCHED_MC)\n\t\tsd = &per_cpu(core_domains, i);\n#else\n\t\tsd = &per_cpu(phys_domains, i);\n#endif\n\t\tcpu_attach_domain(sd, i);\n\t}\n\t/*\n\t * Tune cache-hot values:\n\t */\n\tcalibrate_migration_costs(cpu_map);\n\n\treturn 0;\n\n#ifdef CONFIG_NUMA\nerror:\n\tfree_sched_groups(cpu_map);\n\treturn -ENOMEM;\n#endif\n}\n/*\n * Set up scheduler domains and groups. Callers must hold the hotplug lock.\n */\nstatic int arch_init_sched_domains(const cpumask_t *cpu_map)\n{\n\tcpumask_t cpu_default_map;\n\tint err;\n\n\t/*\n\t * Setup mask for cpus without special case scheduling requirements.\n\t * For now this just excludes isolated cpus, but could be used to\n\t * exclude other special cases in the future.\n\t */\n\tcpus_andnot(cpu_default_map, *cpu_map, cpu_isolated_map);\n\n\terr = build_sched_domains(&cpu_default_map);\n\n\treturn err;\n}\n\nstatic void arch_destroy_sched_domains(const cpumask_t *cpu_map)\n{\n\tfree_sched_groups(cpu_map);\n}\n\n/*\n * Detach sched domains from a group of cpus specified in cpu_map\n * These cpus will now be attached to the NULL domain\n */\nstatic void detach_destroy_domains(const cpumask_t *cpu_map)\n{\n\tint i;\n\n\tfor_each_cpu_mask(i, *cpu_map)\n\t\tcpu_attach_domain(NULL, i);\n\tsynchronize_sched();\n\tarch_destroy_sched_domains(cpu_map);\n}\n\n/*\n * Partition sched domains as specified by the cpumasks below.\n * This attaches all cpus from the cpumasks to the NULL domain,\n * waits for a RCU quiescent period, recalculates sched\n * domain information and then attaches them back to the\n * correct sched domains\n * Call with hotplug lock held\n */\nint partition_sched_domains(cpumask_t *partition1, cpumask_t *partition2)\n{\n\tcpumask_t change_map;\n\tint err = 0;\n\n\tcpus_and(*partition1, *partition1, cpu_online_map);\n\tcpus_and(*partition2, *partition2, cpu_online_map);\n\tcpus_or(change_map, *partition1, *partition2);\n\n\t/* Detach sched domains from all of the affected cpus */\n\tdetach_destroy_domains(&change_map);\n\tif (!cpus_empty(*partition1))\n\t\terr = build_sched_domains(partition1);\n\tif (!err && !cpus_empty(*partition2))\n\t\terr = build_sched_domains(partition2);\n\n\treturn err;\n}\n\n#if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT)\nint arch_reinit_sched_domains(void)\n{\n\tint err;\n\n\tmutex_lock(&sched_hotcpu_mutex);\n\tdetach_destroy_domains(&cpu_online_map);\n\terr = arch_init_sched_domains(&cpu_online_map);\n\tmutex_unlock(&sched_hotcpu_mutex);\n\n\treturn err;\n}\n\nstatic ssize_t sched_power_savings_store(const char *buf, size_t count, int smt)\n{\n\tint ret;\n\n\tif (buf[0] != '0' && buf[0] != '1')\n\t\treturn -EINVAL;\n\n\tif (smt)\n\t\tsched_smt_power_savings = (buf[0] == '1');\n\telse\n\t\tsched_mc_power_savings = (buf[0] == '1');\n\n\tret = arch_reinit_sched_domains();\n\n\treturn ret ? ret : count;\n}\n\nint sched_create_sysfs_power_savings_entries(struct sysdev_class *cls)\n{\n\tint err = 0;\n\n#ifdef CONFIG_SCHED_SMT\n\tif (smt_capable())\n\t\terr = sysfs_create_file(&cls->kset.kobj,\n\t\t\t\t\t&attr_sched_smt_power_savings.attr);\n#endif\n#ifdef CONFIG_SCHED_MC\n\tif (!err && mc_capable())\n\t\terr = sysfs_create_file(&cls->kset.kobj,\n\t\t\t\t\t&attr_sched_mc_power_savings.attr);\n#endif\n\treturn err;\n}\n#endif\n\n#ifdef CONFIG_SCHED_MC\nstatic ssize_t sched_mc_power_savings_show(struct sys_device *dev, char *page)\n{\n\treturn sprintf(page, \"%u\\n\", sched_mc_power_savings);\n}\nstatic ssize_t sched_mc_power_savings_store(struct sys_device *dev,\n\t\t\t\t\t const char *buf, size_t count)\n{\n\treturn sched_power_savings_store(buf, count, 0);\n}\nSYSDEV_ATTR(sched_mc_power_savings, 0644, sched_mc_power_savings_show,\n\t sched_mc_power_savings_store);\n#endif\n\n#ifdef CONFIG_SCHED_SMT\nstatic ssize_t sched_smt_power_savings_show(struct sys_device *dev, char *page)\n{\n\treturn sprintf(page, \"%u\\n\", sched_smt_power_savings);\n}\nstatic ssize_t sched_smt_power_savings_store(struct sys_device *dev,\n\t\t\t\t\t const char *buf, size_t count)\n{\n\treturn sched_power_savings_store(buf, count, 1);\n}\nSYSDEV_ATTR(sched_smt_power_savings, 0644, sched_smt_power_savings_show,\n\t sched_smt_power_savings_store);\n#endif\n\n/*\n * Force a reinitialization of the sched domains hierarchy. The domains\n * and groups cannot be updated in place without racing with the balancing\n * code, so we temporarily attach all running cpus to the NULL domain\n * which will prevent rebalancing while the sched domains are recalculated.\n */\nstatic int update_sched_domains(struct notifier_block *nfb,\n\t\t\t\tunsigned long action, void *hcpu)\n{\n\tswitch (action) {\n\tcase CPU_UP_PREPARE:\n\tcase CPU_UP_PREPARE_FROZEN:\n\tcase CPU_DOWN_PREPARE:\n\tcase CPU_DOWN_PREPARE_FROZEN:\n\t\tdetach_destroy_domains(&cpu_online_map);\n\t\treturn NOTIFY_OK;\n\n\tcase CPU_UP_CANCELED:\n\tcase CPU_UP_CANCELED_FROZEN:\n\tcase CPU_DOWN_FAILED:\n\tcase CPU_DOWN_FAILED_FROZEN:\n\tcase CPU_ONLINE:\n\tcase CPU_ONLINE_FROZEN:\n\tcase CPU_DEAD:\n\tcase CPU_DEAD_FROZEN:\n\t\t/*\n\t\t * Fall through and re-initialise the domains.\n\t\t */\n\t\tbreak;\n\tdefault:\n\t\treturn NOTIFY_DONE;\n\t}\n\n\t/* The hotplug lock is already held by cpu_up/cpu_down */\n\tarch_init_sched_domains(&cpu_online_map);\n\n\treturn NOTIFY_OK;\n}\n\nvoid __init sched_init_smp(void)\n{\n\tcpumask_t non_isolated_cpus;\n\n\tmutex_lock(&sched_hotcpu_mutex);\n\tarch_init_sched_domains(&cpu_online_map);\n\tcpus_andnot(non_isolated_cpus, cpu_possible_map, cpu_isolated_map);\n\tif (cpus_empty(non_isolated_cpus))\n\t\tcpu_set(smp_processor_id(), non_isolated_cpus);\n\tmutex_unlock(&sched_hotcpu_mutex);\n\t/* XXX: Theoretical race here - CPU may be hotplugged now */\n\thotcpu_notifier(update_sched_domains, 0);\n\n\t/* Move init over to a non-isolated CPU */\n\tif (set_cpus_allowed(current, non_isolated_cpus) < 0)\n\t\tBUG();\n}\n#else\nvoid __init sched_init_smp(void)\n{\n}\n#endif /* CONFIG_SMP */\n\nint in_sched_functions(unsigned long addr)\n{\n\t/* Linker adds these: start and end of __sched functions */\n\textern char __sched_text_start[], __sched_text_end[];\n\n\treturn in_lock_functions(addr) ||\n\t\t(addr >= (unsigned long)__sched_text_start\n\t\t&& addr < (unsigned long)__sched_text_end);\n}\n\nvoid __init sched_init(void)\n{\n\tint i, j, k;\n\tint highest_cpu = 0;\n\n\tfor_each_possible_cpu(i) {\n\t\tstruct prio_array *array;\n\t\tstruct rq *rq;\n\n\t\trq = cpu_rq(i);\n\t\tspin_lock_init(&rq->lock);\n\t\tlockdep_set_class(&rq->lock, &rq->rq_lock_key);\n\t\trq->nr_running = 0;\n\t\trq->active = rq->arrays;\n\t\trq->expired = rq->arrays + 1;\n\t\trq->best_expired_prio = MAX_PRIO;\n\n#ifdef CONFIG_SMP\n\t\trq->sd = NULL;\n\t\tfor (j = 1; j < 3; j++)\n\t\t\trq->cpu_load[j] = 0;\n\t\trq->active_balance = 0;\n\t\trq->push_cpu = 0;\n\t\trq->cpu = i;\n\t\trq->migration_thread = NULL;\n\t\tINIT_LIST_HEAD(&rq->migration_queue);\n#endif\n\t\tatomic_set(&rq->nr_iowait, 0);\n\n\t\tfor (j = 0; j < 2; j++) {\n\t\t\tarray = rq->arrays + j;\n\t\t\tfor (k = 0; k < MAX_PRIO; k++) {\n\t\t\t\tINIT_LIST_HEAD(array->queue + k);\n\t\t\t\t__clear_bit(k, array->bitmap);\n\t\t\t}\n\t\t\t// delimiter for bitsearch\n\t\t\t__set_bit(MAX_PRIO, array->bitmap);\n\t\t}\n\t\thighest_cpu = i;\n\t}\n\n\tset_load_weight(&init_task);\n\n#ifdef CONFIG_SMP\n\tnr_cpu_ids = highest_cpu + 1;\n\topen_softirq(SCHED_SOFTIRQ, run_rebalance_domains, NULL);\n#endif\n\n#ifdef CONFIG_RT_MUTEXES\n\tplist_head_init(&init_task.pi_waiters, &init_task.pi_lock);\n#endif\n\n\t/*\n\t * The boot idle thread does lazy MMU switching as well:\n\t */\n\tatomic_inc(&init_mm.mm_count);\n\tenter_lazy_tlb(&init_mm, current);\n\n\t/*\n\t * Make us the idle thread. Technically, schedule() should not be\n\t * called from this thread, however somewhere below it might be,\n\t * but because we are the idle thread, we just pick up running again\n\t * when this runqueue becomes \"idle\".\n\t */\n\tinit_idle(current, smp_processor_id());\n}\n\n#ifdef CONFIG_DEBUG_SPINLOCK_SLEEP\nvoid __might_sleep(char *file, int line)\n{\n#ifdef in_atomic\n\tstatic unsigned long prev_jiffy;\t/* ratelimiting */\n\n\tif ((in_atomic() || irqs_disabled()) &&\n\t system_state == SYSTEM_RUNNING && !oops_in_progress) {\n\t\tif (time_before(jiffies, prev_jiffy + HZ) && prev_jiffy)\n\t\t\treturn;\n\t\tprev_jiffy = jiffies;\n\t\tprintk(KERN_ERR \"BUG: sleeping function called from invalid\"\n\t\t\t\t\" context at %s:%d\\n\", file, line);\n\t\tprintk(\"in_atomic():%d, irqs_disabled():%d\\n\",\n\t\t\tin_atomic(), irqs_disabled());\n\t\tdebug_show_held_locks(current);\n\t\tif (irqs_disabled())\n\t\t\tprint_irqtrace_events(current);\n\t\tdump_stack();\n\t}\n#endif\n}\nEXPORT_SYMBOL(__might_sleep);\n#endif\n\n#ifdef CONFIG_MAGIC_SYSRQ\nvoid normalize_rt_tasks(void)\n{\n\tstruct prio_array *array;\n\tstruct task_struct *g, *p;\n\tunsigned long flags;\n\tstruct rq *rq;\n\n\tread_lock_irq(&tasklist_lock);\n\n\tdo_each_thread(g, p) {\n\t\tif (!rt_task(p))\n\t\t\tcontinue;\n\n\t\tspin_lock_irqsave(&p->pi_lock, flags);\n\t\trq = __task_rq_lock(p);\n\n\t\tarray = p->array;\n\t\tif (array)\n\t\t\tdeactivate_task(p, task_rq(p));\n\t\t__setscheduler(p, SCHED_NORMAL, 0);\n\t\tif (array) {\n\t\t\t__activate_task(p, task_rq(p));\n\t\t\tresched_task(rq->curr);\n\t\t}\n\n\t\t__task_rq_unlock(rq);\n\t\tspin_unlock_irqrestore(&p->pi_lock, flags);\n\t} while_each_thread(g, p);\n\n\tread_unlock_irq(&tasklist_lock);\n}\n\n#endif /* CONFIG_MAGIC_SYSRQ */\n\n#if\tdefined(CONFIG_IA64) || defined(CONFIG_KDB)\n/*\n * These functions are only useful for the IA64 MCA handling.\n *\n * They can only be called when the whole system has been\n * stopped - every CPU needs to be quiescent, and no scheduling\n * activity can take place. Using them for anything else would\n * be a serious bug, and as a result, they aren't even visible\n * under any other configuration.\n */\n\n/**\n * curr_task - return the current task for a given cpu.\n * @cpu: the processor in question.\n *\n * ONLY VALID WHEN THE WHOLE SYSTEM IS STOPPED!\n */\nstruct task_struct *curr_task(int cpu)\n{\n\treturn cpu_curr(cpu);\n}\n\n/**\n * set_curr_task - set the current task for a given cpu.\n * @cpu: the processor in question.\n * @p: the task pointer to set.\n *\n * Description: This function must only be used when non-maskable interrupts\n * are serviced on a separate stack. It allows the architecture to switch the\n * notion of the current task on a cpu in a non-blocking manner. This function\n * must be called with all CPU's synchronized, and interrupts disabled, the\n * and caller must save the original value of the current task (see\n * curr_task() above) and restore that value before reenabling interrupts and\n * re-starting the system.\n *\n * ONLY VALID WHEN THE WHOLE SYSTEM IS STOPPED!\n */\nvoid set_curr_task(int cpu, struct task_struct *p)\n{\n\tcpu_curr(cpu) = p;\n}\n\n#endif\n\n#ifdef\tCONFIG_KDB\n\n#include <linux/kdb.h>\n\nstatic void\nkdb_prio(char *name, struct prio_array *array, kdb_printf_t xxx_printf)\n{\n\tint pri;\n\n\txxx_printf(\" %s nr_active:%d bitmap: 0x%lx 0x%lx 0x%lx\\n\",\n\t\tname, array->nr_active,\n\t\tarray->bitmap[0], array->bitmap[1], array->bitmap[2]);\n\n\tpri = sched_find_first_bit(array->bitmap);\n\tif (pri != MAX_PRIO) {\n\t\txxx_printf(\" bitmap priorities:\");\n\t\twhile (pri != MAX_PRIO) {\n\t\t\txxx_printf(\" %d\", pri);\n\t\t\tpri++;\n\t\t\tpri = find_next_bit(array->bitmap, MAX_PRIO, pri);\n\t\t}\n\t\txxx_printf(\"\\n\");\n\t}\n\n\tfor (pri = 0; pri < MAX_PRIO; pri++) {\n\t\tint printed_hdr = 0;\n\t\tstruct list_head *head, *curr;\n\n\t\thead = array->queue + pri;\n\t\tcurr = head->next;\n\t\twhile(curr != head) {\n\t\t\tstruct task_struct *task;\n\t\t\tif (!printed_hdr) {\n\t\t\t\txxx_printf(\" queue at priority=%d\\n\", pri);\n\t\t\t\tprinted_hdr = 1;\n\t\t\t}\n\t\t\ttask = list_entry(curr, struct task_struct, run_list);\n\t\t\txxx_printf(\" 0x%p %d %s time_slice:%d\\n\",\n\t\t\t\t task, task->pid, task->comm,\n\t\t\t\t task->time_slice);\n\t\t\tcurr = curr->next;\n\t\t}\n\t}\n}\n\n/* This code must be in sched.c because struct rq is only defined in this\n * source. To allow most of kdb to be modular, this code cannot call any kdb\n * functions directly, any external functions that it needs must be passed in\n * as parameters.\n */\n\nvoid\nkdb_runqueue(unsigned long cpu, kdb_printf_t xxx_printf)\n{\n\tstruct rq *rq;\n\n\trq = cpu_rq(cpu);\n\n\txxx_printf(\"CPU%ld lock:%s curr:0x%p(%d)(%s)\",\n\t\t cpu, (spin_is_locked(&rq->lock))?\"LOCKED\":\"free\",\n\t\t rq->curr, rq->curr->pid, rq->curr->comm);\n\tif (rq->curr == rq->idle)\n\t\txxx_printf(\" is idle\");\n\txxx_printf(\"\\n \");\n#ifdef CONFIG_SMP\n\txxx_printf(\" cpu_load:%lu %lu %lu\",\n\t\t\trq->cpu_load[0], rq->cpu_load[1], rq->cpu_load[2]);\n#endif\n\txxx_printf(\" nr_running:%lu nr_switches:%llu\\n\",\n\t\t rq->nr_running, rq->nr_switches);\n\tkdb_prio(\"active\", rq->active, xxx_printf);\n\tkdb_prio(\"expired\", rq->expired, xxx_printf);\n}\nEXPORT_SYMBOL(kdb_runqueue);\n\n#endif\t/* CONFIG_KDB */\n/*\n * linux/kernel/seccomp.c\n *\n * Copyright 2004-2005 Andrea Arcangeli <andrea@cpushare.com>\n *\n * This defines a simple but solid secure-computing mode.\n */\n\n#include <linux/seccomp.h>\n#include <linux/sched.h>\n\n/* #define SECCOMP_DEBUG 1 */\n\n/*\n * Secure computing mode 1 allows only read/write/exit/sigreturn.\n * To be fully secure this must be combined with rlimit\n * to limit the stack allocations too.\n */\nstatic int mode1_syscalls[] = {\n\t__NR_seccomp_read, __NR_seccomp_write, __NR_seccomp_exit, __NR_seccomp_sigreturn,\n\t0, /* null terminated */\n};\n\n#ifdef TIF_32BIT\nstatic int mode1_syscalls_32[] = {\n\t__NR_seccomp_read_32, __NR_seccomp_write_32, __NR_seccomp_exit_32, __NR_seccomp_sigreturn_32,\n\t0, /* null terminated */\n};\n#endif\n\nvoid __secure_computing(int this_syscall)\n{\n\tint mode = current->seccomp.mode;\n\tint * syscall;\n\n\tswitch (mode) {\n\tcase 1:\n\t\tsyscall = mode1_syscalls;\n#ifdef TIF_32BIT\n\t\tif (test_thread_flag(TIF_32BIT))\n\t\t\tsyscall = mode1_syscalls_32;\n#endif\n\t\tdo {\n\t\t\tif (*syscall == this_syscall)\n\t\t\t\treturn;\n\t\t} while (*++syscall);\n\t\tbreak;\n\tdefault:\n\t\tBUG();\n\t}\n\n#ifdef SECCOMP_DEBUG\n\tdump_stack();\n#endif\n\tdo_exit(SIGKILL);\n}\n/*\n * linux/kernel/signal.c\n *\n * Copyright (C) 1991, 1992 Linus Torvalds\n *\n * 1997-11-02 Modified for POSIX.1b signals by Richard Henderson\n *\n * 2003-06-02 Jim Houston - Concurrent Computer Corp.\n *\t\tChanges to use preallocated sigqueue structures\n *\t\tto allow signals to be sent reliably.\n */\n\n#include <linux/slab.h>\n#include <linux/module.h>\n#include <linux/init.h>\n#include <linux/sched.h>\n#include <linux/fs.h>\n#include <linux/tty.h>\n#include <linux/binfmts.h>\n#include <linux/security.h>\n#include <linux/syscalls.h>\n#include <linux/ptrace.h>\n#include <linux/signal.h>\n#include <linux/signalfd.h>\n#include <linux/capability.h>\n#include <linux/freezer.h>\n#include <linux/pid_namespace.h>\n#include <linux/nsproxy.h>\n\n#include <asm/param.h>\n#include <asm/uaccess.h>\n#include <asm/unistd.h>\n#include <asm/siginfo.h>\n#include \"audit.h\"\t/* audit_signal_info() */\n\n/*\n * SLAB caches for signal bits.\n */\n\nstatic struct kmem_cache *sigqueue_cachep;\n\n\nstatic int sig_ignored(struct task_struct *t, int sig)\n{\n\tvoid __user * handler;\n\n\t/*\n\t * Tracers always want to know about signals..\n\t */\n\tif (t->ptrace & PT_PTRACED)\n\t\treturn 0;\n\n\t/*\n\t * Blocked signals are never ignored, since the\n\t * signal handler may change by the time it is\n\t * unblocked.\n\t */\n\tif (sigismember(&t->blocked, sig))\n\t\treturn 0;\n\n\t/* Is it explicitly or implicitly ignored? */\n\thandler = t->sighand->action[sig-1].sa.sa_handler;\n\treturn handler == SIG_IGN ||\n\t\t(handler == SIG_DFL && sig_kernel_ignore(sig));\n}\n\n/*\n * Re-calculate pending state from the set of locally pending\n * signals, globally pending signals, and blocked signals.\n */\nstatic inline int has_pending_signals(sigset_t *signal, sigset_t *blocked)\n{\n\tunsigned long ready;\n\tlong i;\n\n\tswitch (_NSIG_WORDS) {\n\tdefault:\n\t\tfor (i = _NSIG_WORDS, ready = 0; --i >= 0 ;)\n\t\t\tready |= signal->sig[i] &~ blocked->sig[i];\n\t\tbreak;\n\n\tcase 4: ready = signal->sig[3] &~ blocked->sig[3];\n\t\tready |= signal->sig[2] &~ blocked->sig[2];\n\t\tready |= signal->sig[1] &~ blocked->sig[1];\n\t\tready |= signal->sig[0] &~ blocked->sig[0];\n\t\tbreak;\n\n\tcase 2: ready = signal->sig[1] &~ blocked->sig[1];\n\t\tready |= signal->sig[0] &~ blocked->sig[0];\n\t\tbreak;\n\n\tcase 1: ready = signal->sig[0] &~ blocked->sig[0];\n\t}\n\treturn ready !=\t0;\n}\n\n#define PENDING(p,b) has_pending_signals(&(p)->signal, (b))\n\nstatic int recalc_sigpending_tsk(struct task_struct *t)\n{\n\tif (t->signal->group_stop_count > 0 ||\n\t (freezing(t)) ||\n\t PENDING(&t->pending, &t->blocked) ||\n\t PENDING(&t->signal->shared_pending, &t->blocked)) {\n\t\tset_tsk_thread_flag(t, TIF_SIGPENDING);\n\t\treturn 1;\n\t}\n\t/*\n\t * We must never clear the flag in another thread, or in current\n\t * when it's possible the current syscall is returning -ERESTART*.\n\t * So we don't clear it here, and only callers who know they should do.\n\t */\n\treturn 0;\n}\n\n/*\n * After recalculating TIF_SIGPENDING, we need to make sure the task wakes up.\n * This is superfluous when called on current, the wakeup is a harmless no-op.\n */\nvoid recalc_sigpending_and_wake(struct task_struct *t)\n{\n\tif (recalc_sigpending_tsk(t))\n\t\tsignal_wake_up(t, 0);\n}\n\nvoid recalc_sigpending(void)\n{\n\tif (!recalc_sigpending_tsk(current))\n\t\tclear_thread_flag(TIF_SIGPENDING);\n\n}\n\n/* Given the mask, find the first available signal that should be serviced. */\n\nint next_signal(struct sigpending *pending, sigset_t *mask)\n{\n\tunsigned long i, *s, *m, x;\n\tint sig = 0;\n\t\n\ts = pending->signal.sig;\n\tm = mask->sig;\n\tswitch (_NSIG_WORDS) {\n\tdefault:\n\t\tfor (i = 0; i < _NSIG_WORDS; ++i, ++s, ++m)\n\t\t\tif ((x = *s &~ *m) != 0) {\n\t\t\t\tsig = ffz(~x) + i*_NSIG_BPW + 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\tbreak;\n\n\tcase 2: if ((x = s[0] &~ m[0]) != 0)\n\t\t\tsig = 1;\n\t\telse if ((x = s[1] &~ m[1]) != 0)\n\t\t\tsig = _NSIG_BPW + 1;\n\t\telse\n\t\t\tbreak;\n\t\tsig += ffz(~x);\n\t\tbreak;\n\n\tcase 1: if ((x = *s &~ *m) != 0)\n\t\t\tsig = ffz(~x) + 1;\n\t\tbreak;\n\t}\n\t\n\treturn sig;\n}\n\nstatic struct sigqueue *__sigqueue_alloc(struct task_struct *t, gfp_t flags,\n\t\t\t\t\t int override_rlimit)\n{\n\tstruct sigqueue *q = NULL;\n\tstruct user_struct *user;\n\n\t/*\n\t * In order to avoid problems with \"switch_user()\", we want to make\n\t * sure that the compiler doesn't re-load \"t->user\"\n\t */\n\tuser = t->user;\n\tbarrier();\n\tatomic_inc(&user->sigpending);\n\tif (override_rlimit ||\n\t atomic_read(&user->sigpending) <=\n\t\t\tt->signal->rlim[RLIMIT_SIGPENDING].rlim_cur)\n\t\tq = kmem_cache_alloc(sigqueue_cachep, flags);\n\tif (unlikely(q == NULL)) {\n\t\tatomic_dec(&user->sigpending);\n\t} else {\n\t\tINIT_LIST_HEAD(&q->list);\n\t\tq->flags = 0;\n\t\tq->user = get_uid(user);\n\t}\n\treturn(q);\n}\n\nstatic void __sigqueue_free(struct sigqueue *q)\n{\n\tif (q->flags & SIGQUEUE_PREALLOC)\n\t\treturn;\n\tatomic_dec(&q->user->sigpending);\n\tfree_uid(q->user);\n\tkmem_cache_free(sigqueue_cachep, q);\n}\n\nvoid flush_sigqueue(struct sigpending *queue)\n{\n\tstruct sigqueue *q;\n\n\tsigemptyset(&queue->signal);\n\twhile (!list_empty(&queue->list)) {\n\t\tq = list_entry(queue->list.next, struct sigqueue , list);\n\t\tlist_del_init(&q->list);\n\t\t__sigqueue_free(q);\n\t}\n}\n\n/*\n * Flush all pending signals for a task.\n */\nvoid flush_signals(struct task_struct *t)\n{\n\tunsigned long flags;\n\n\tspin_lock_irqsave(&t->sighand->siglock, flags);\n\tclear_tsk_thread_flag(t,TIF_SIGPENDING);\n\tflush_sigqueue(&t->pending);\n\tflush_sigqueue(&t->signal->shared_pending);\n\tspin_unlock_irqrestore(&t->sighand->siglock, flags);\n}\n\nvoid ignore_signals(struct task_struct *t)\n{\n\tint i;\n\n\tfor (i = 0; i < _NSIG; ++i)\n\t\tt->sighand->action[i].sa.sa_handler = SIG_IGN;\n\n\tflush_signals(t);\n}\n\n/*\n * Flush all handlers for a task.\n */\n\nvoid\nflush_signal_handlers(struct task_struct *t, int force_default)\n{\n\tint i;\n\tstruct k_sigaction *ka = &t->sighand->action[0];\n\tfor (i = _NSIG ; i != 0 ; i--) {\n\t\tif (force_default || ka->sa.sa_handler != SIG_IGN)\n\t\t\tka->sa.sa_handler = SIG_DFL;\n\t\tka->sa.sa_flags = 0;\n\t\tsigemptyset(&ka->sa.sa_mask);\n\t\tka++;\n\t}\n}\n\n\n/* Notify the system that a driver wants to block all signals for this\n * process, and wants to be notified if any signals at all were to be\n * sent/acted upon. If the notifier routine returns non-zero, then the\n * signal will be acted upon after all. If the notifier routine returns 0,\n * then then signal will be blocked. Only one block per process is\n * allowed. priv is a pointer to private data that the notifier routine\n * can use to determine if the signal should be blocked or not. */\n\nvoid\nblock_all_signals(int (*notifier)(void *priv), void *priv, sigset_t *mask)\n{\n\tunsigned long flags;\n\n\tspin_lock_irqsave(&current->sighand->siglock, flags);\n\tcurrent->notifier_mask = mask;\n\tcurrent->notifier_data = priv;\n\tcurrent->notifier = notifier;\n\tspin_unlock_irqrestore(&current->sighand->siglock, flags);\n}\n\n/* Notify the system that blocking has ended. */\n\nvoid\nunblock_all_signals(void)\n{\n\tunsigned long flags;\n\n\tspin_lock_irqsave(&current->sighand->siglock, flags);\n\tcurrent->notifier = NULL;\n\tcurrent->notifier_data = NULL;\n\trecalc_sigpending();\n\tspin_unlock_irqrestore(&current->sighand->siglock, flags);\n}\n\nstatic int collect_signal(int sig, struct sigpending *list, siginfo_t *info)\n{\n\tstruct sigqueue *q, *first = NULL;\n\tint still_pending = 0;\n\n\tif (unlikely(!sigismember(&list->signal, sig)))\n\t\treturn 0;\n\n\t/*\n\t * Collect the siginfo appropriate to this signal. Check if\n\t * there is another siginfo for the same signal.\n\t*/\n\tlist_for_each_entry(q, &list->list, list) {\n\t\tif (q->info.si_signo == sig) {\n\t\t\tif (first) {\n\t\t\t\tstill_pending = 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tfirst = q;\n\t\t}\n\t}\n\tif (first) {\n\t\tlist_del_init(&first->list);\n\t\tcopy_siginfo(info, &first->info);\n\t\t__sigqueue_free(first);\n\t\tif (!still_pending)\n\t\t\tsigdelset(&list->signal, sig);\n\t} else {\n\n\t\t/* Ok, it wasn't in the queue. This must be\n\t\t a fast-pathed signal or we must have been\n\t\t out of queue space. So zero out the info.\n\t\t */\n\t\tsigdelset(&list->signal, sig);\n\t\tinfo->si_signo = sig;\n\t\tinfo->si_errno = 0;\n\t\tinfo->si_code = 0;\n\t\tinfo->si_pid = 0;\n\t\tinfo->si_uid = 0;\n\t}\n\treturn 1;\n}\n\nstatic int __dequeue_signal(struct sigpending *pending, sigset_t *mask,\n\t\t\tsiginfo_t *info)\n{\n\tint sig = next_signal(pending, mask);\n\n\tif (sig) {\n\t\tif (current->notifier) {\n\t\t\tif (sigismember(current->notifier_mask, sig)) {\n\t\t\t\tif (!(current->notifier)(current->notifier_data)) {\n\t\t\t\t\tclear_thread_flag(TIF_SIGPENDING);\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (!collect_signal(sig, pending, info))\n\t\t\tsig = 0;\n\t}\n\n\treturn sig;\n}\n\n/*\n * Dequeue a signal and return the element to the caller, which is \n * expected to free it.\n *\n * All callers have to hold the siglock.\n */\nint dequeue_signal(struct task_struct *tsk, sigset_t *mask, siginfo_t *info)\n{\n\tint signr = 0;\n\n\t/* We only dequeue private signals from ourselves, we don't let\n\t * signalfd steal them\n\t */\n\tif (likely(tsk == current))\n\t\tsignr = __dequeue_signal(&tsk->pending, mask, info);\n\tif (!signr) {\n\t\tsignr = __dequeue_signal(&tsk->signal->shared_pending,\n\t\t\t\t\t mask, info);\n\t\t/*\n\t\t * itimer signal ?\n\t\t *\n\t\t * itimers are process shared and we restart periodic\n\t\t * itimers in the signal delivery path to prevent DoS\n\t\t * attacks in the high resolution timer case. This is\n\t\t * compliant with the old way of self restarting\n\t\t * itimers, as the SIGALRM is a legacy signal and only\n\t\t * queued once. Changing the restart behaviour to\n\t\t * restart the timer in the signal dequeue path is\n\t\t * reducing the timer noise on heavy loaded !highres\n\t\t * systems too.\n\t\t */\n\t\tif (unlikely(signr == SIGALRM)) {\n\t\t\tstruct hrtimer *tmr = &tsk->signal->real_timer;\n\n\t\t\tif (!hrtimer_is_queued(tmr) &&\n\t\t\t tsk->signal->it_real_incr.tv64 != 0) {\n\t\t\t\thrtimer_forward(tmr, tmr->base->get_time(),\n\t\t\t\t\t\ttsk->signal->it_real_incr);\n\t\t\t\thrtimer_restart(tmr);\n\t\t\t}\n\t\t}\n\t}\n\tif (likely(tsk == current))\n\t\trecalc_sigpending();\n\tif (signr && unlikely(sig_kernel_stop(signr))) {\n\t\t/*\n\t\t * Set a marker that we have dequeued a stop signal. Our\n\t\t * caller might release the siglock and then the pending\n\t\t * stop signal it is about to process is no longer in the\n\t\t * pending bitmasks, but must still be cleared by a SIGCONT\n\t\t * (and overruled by a SIGKILL). So those cases clear this\n\t\t * shared flag after we've set it. Note that this flag may\n\t\t * remain set after the signal we return is ignored or\n\t\t * handled. That doesn't matter because its only purpose\n\t\t * is to alert stop-signal processing code when another\n\t\t * processor has come along and cleared the flag.\n\t\t */\n\t\tif (!(tsk->signal->flags & SIGNAL_GROUP_EXIT))\n\t\t\ttsk->signal->flags |= SIGNAL_STOP_DEQUEUED;\n\t}\n\tif (signr && likely(tsk == current) &&\n\t ((info->si_code & __SI_MASK) == __SI_TIMER) &&\n\t info->si_sys_private){\n\t\t/*\n\t\t * Release the siglock to ensure proper locking order\n\t\t * of timer locks outside of siglocks. Note, we leave\n\t\t * irqs disabled here, since the posix-timers code is\n\t\t * about to disable them again anyway.\n\t\t */\n\t\tspin_unlock(&tsk->sighand->siglock);\n\t\tdo_schedule_next_timer(info);\n\t\tspin_lock(&tsk->sighand->siglock);\n\t}\n\treturn signr;\n}\n\n/*\n * Tell a process that it has a new active signal..\n *\n * NOTE! we rely on the previous spin_lock to\n * lock interrupts for us! We can only be called with\n * \"siglock\" held, and the local interrupt must\n * have been disabled when that got acquired!\n *\n * No need to set need_resched since signal event passing\n * goes through ->blocked\n */\nvoid signal_wake_up(struct task_struct *t, int resume)\n{\n\tunsigned int mask;\n\n\tset_tsk_thread_flag(t, TIF_SIGPENDING);\n\n\t/*\n\t * For SIGKILL, we want to wake it up in the stopped/traced case.\n\t * We don't check t->state here because there is a race with it\n\t * executing another processor and just now entering stopped state.\n\t * By using wake_up_state, we ensure the process will wake up and\n\t * handle its death signal.\n\t */\n\tmask = TASK_INTERRUPTIBLE;\n\tif (resume)\n\t\tmask |= TASK_STOPPED | TASK_TRACED;\n\tif (!wake_up_state(t, mask))\n\t\tkick_process(t);\n}\n\n/*\n * Remove signals in mask from the pending set and queue.\n * Returns 1 if any signals were found.\n *\n * All callers must be holding the siglock.\n *\n * This version takes a sigset mask and looks at all signals,\n * not just those in the first mask word.\n */\nstatic int rm_from_queue_full(sigset_t *mask, struct sigpending *s)\n{\n\tstruct sigqueue *q, *n;\n\tsigset_t m;\n\n\tsigandsets(&m, mask, &s->signal);\n\tif (sigisemptyset(&m))\n\t\treturn 0;\n\n\tsignandsets(&s->signal, &s->signal, mask);\n\tlist_for_each_entry_safe(q, n, &s->list, list) {\n\t\tif (sigismember(mask, q->info.si_signo)) {\n\t\t\tlist_del_init(&q->list);\n\t\t\t__sigqueue_free(q);\n\t\t}\n\t}\n\treturn 1;\n}\n/*\n * Remove signals in mask from the pending set and queue.\n * Returns 1 if any signals were found.\n *\n * All callers must be holding the siglock.\n */\nstatic int rm_from_queue(unsigned long mask, struct sigpending *s)\n{\n\tstruct sigqueue *q, *n;\n\n\tif (!sigtestsetmask(&s->signal, mask))\n\t\treturn 0;\n\n\tsigdelsetmask(&s->signal, mask);\n\tlist_for_each_entry_safe(q, n, &s->list, list) {\n\t\tif (q->info.si_signo < SIGRTMIN &&\n\t\t (mask & sigmask(q->info.si_signo))) {\n\t\t\tlist_del_init(&q->list);\n\t\t\t__sigqueue_free(q);\n\t\t}\n\t}\n\treturn 1;\n}\n\n/*\n * Bad permissions for sending the signal\n */\nstatic int check_kill_permission(int sig, struct siginfo *info,\n\t\t\t\t struct task_struct *t)\n{\n\tint error = -EINVAL;\n\tif (!valid_signal(sig))\n\t\treturn error;\n\n\terror = audit_signal_info(sig, t); /* Let audit system see the signal */\n\tif (error)\n\t\treturn error;\n\n\terror = -EPERM;\n\tif ((info == SEND_SIG_NOINFO || (!is_si_special(info) && SI_FROMUSER(info)))\n\t && ((sig != SIGCONT) ||\n\t\t(process_session(current) != process_session(t)))\n\t && (current->euid ^ t->suid) && (current->euid ^ t->uid)\n\t && (current->uid ^ t->suid) && (current->uid ^ t->uid)\n\t && !capable(CAP_KILL))\n\t\treturn error;\n\n\treturn security_task_kill(t, info, sig, 0);\n}\n\n/* forward decl */\nstatic void do_notify_parent_cldstop(struct task_struct *tsk, int why);\n\n/*\n * Handle magic process-wide effects of stop/continue signals.\n * Unlike the signal actions, these happen immediately at signal-generation\n * time regardless of blocking, ignoring, or handling. This does the\n * actual continuing for SIGCONT, but not the actual stopping for stop\n * signals. The process stop is done as a signal action for SIG_DFL.\n */\nstatic void handle_stop_signal(int sig, struct task_struct *p)\n{\n\tstruct task_struct *t;\n\n\tif (p->signal->flags & SIGNAL_GROUP_EXIT)\n\t\t/*\n\t\t * The process is in the middle of dying already.\n\t\t */\n\t\treturn;\n\n\tif (sig_kernel_stop(sig)) {\n\t\t/*\n\t\t * This is a stop signal. Remove SIGCONT from all queues.\n\t\t */\n\t\trm_from_queue(sigmask(SIGCONT), &p->signal->shared_pending);\n\t\tt = p;\n\t\tdo {\n\t\t\trm_from_queue(sigmask(SIGCONT), &t->pending);\n\t\t\tt = next_thread(t);\n\t\t} while (t != p);\n\t} else if (sig == SIGCONT) {\n\t\t/*\n\t\t * Remove all stop signals from all queues,\n\t\t * and wake all threads.\n\t\t */\n\t\tif (unlikely(p->signal->group_stop_count > 0)) {\n\t\t\t/*\n\t\t\t * There was a group stop in progress. We'll\n\t\t\t * pretend it finished before we got here. We are\n\t\t\t * obliged to report it to the parent: if the\n\t\t\t * SIGSTOP happened \"after\" this SIGCONT, then it\n\t\t\t * would have cleared this pending SIGCONT. If it\n\t\t\t * happened \"before\" this SIGCONT, then the parent\n\t\t\t * got the SIGCHLD about the stop finishing before\n\t\t\t * the continue happened. We do the notification\n\t\t\t * now, and it's as if the stop had finished and\n\t\t\t * the SIGCHLD was pending on entry to this kill.\n\t\t\t */\n\t\t\tp->signal->group_stop_count = 0;\n\t\t\tp->signal->flags = SIGNAL_STOP_CONTINUED;\n\t\t\tspin_unlock(&p->sighand->siglock);\n\t\t\tdo_notify_parent_cldstop(p, CLD_STOPPED);\n\t\t\tspin_lock(&p->sighand->siglock);\n\t\t}\n\t\trm_from_queue(SIG_KERNEL_STOP_MASK, &p->signal->shared_pending);\n\t\tt = p;\n\t\tdo {\n\t\t\tunsigned int state;\n\t\t\trm_from_queue(SIG_KERNEL_STOP_MASK, &t->pending);\n\t\t\t\n\t\t\t/*\n\t\t\t * If there is a handler for SIGCONT, we must make\n\t\t\t * sure that no thread returns to user mode before\n\t\t\t * we post the signal, in case it was the only\n\t\t\t * thread eligible to run the signal handler--then\n\t\t\t * it must not do anything between resuming and\n\t\t\t * running the handler. With the TIF_SIGPENDING\n\t\t\t * flag set, the thread will pause and acquire the\n\t\t\t * siglock that we hold now and until we've queued\n\t\t\t * the pending signal. \n\t\t\t *\n\t\t\t * Wake up the stopped thread _after_ setting\n\t\t\t * TIF_SIGPENDING\n\t\t\t */\n\t\t\tstate = TASK_STOPPED;\n\t\t\tif (sig_user_defined(t, SIGCONT) && !sigismember(&t->blocked, SIGCONT)) {\n\t\t\t\tset_tsk_thread_flag(t, TIF_SIGPENDING);\n\t\t\t\tstate |= TASK_INTERRUPTIBLE;\n\t\t\t}\n\t\t\twake_up_state(t, state);\n\n\t\t\tt = next_thread(t);\n\t\t} while (t != p);\n\n\t\tif (p->signal->flags & SIGNAL_STOP_STOPPED) {\n\t\t\t/*\n\t\t\t * We were in fact stopped, and are now continued.\n\t\t\t * Notify the parent with CLD_CONTINUED.\n\t\t\t */\n\t\t\tp->signal->flags = SIGNAL_STOP_CONTINUED;\n\t\t\tp->signal->group_exit_code = 0;\n\t\t\tspin_unlock(&p->sighand->siglock);\n\t\t\tdo_notify_parent_cldstop(p, CLD_CONTINUED);\n\t\t\tspin_lock(&p->sighand->siglock);\n\t\t} else {\n\t\t\t/*\n\t\t\t * We are not stopped, but there could be a stop\n\t\t\t * signal in the middle of being processed after\n\t\t\t * being removed from the queue. Clear that too.\n\t\t\t */\n\t\t\tp->signal->flags = 0;\n\t\t}\n\t} else if (sig == SIGKILL) {\n\t\t/*\n\t\t * Make sure that any pending stop signal already dequeued\n\t\t * is undone by the wakeup for SIGKILL.\n\t\t */\n\t\tp->signal->flags = 0;\n\t}\n}\n\nstatic int send_signal(int sig, struct siginfo *info, struct task_struct *t,\n\t\t\tstruct sigpending *signals)\n{\n\tstruct sigqueue * q = NULL;\n\tint ret = 0;\n\n\t/*\n\t * Deliver the signal to listening signalfds. This must be called\n\t * with the sighand lock held.\n\t */\n\tsignalfd_notify(t, sig);\n\n\t/*\n\t * fast-pathed signals for kernel-internal things like SIGSTOP\n\t * or SIGKILL.\n\t */\n\tif (info == SEND_SIG_FORCED)\n\t\tgoto out_set;\n\n\t/* Real-time signals must be queued if sent by sigqueue, or\n\t some other real-time mechanism. It is implementation\n\t defined whether kill() does so. We attempt to do so, on\n\t the principle of least surprise, but since kill is not\n\t allowed to fail with EAGAIN when low on memory we just\n\t make sure at least one signal gets delivered and don't\n\t pass on the info struct. */\n\n\tq = __sigqueue_alloc(t, GFP_ATOMIC, (sig < SIGRTMIN &&\n\t\t\t\t\t (is_si_special(info) ||\n\t\t\t\t\t info->si_code >= 0)));\n\tif (q) {\n\t\tlist_add_tail(&q->list, &signals->list);\n\t\tswitch ((unsigned long) info) {\n\t\tcase (unsigned long) SEND_SIG_NOINFO:\n\t\t\tq->info.si_signo = sig;\n\t\t\tq->info.si_errno = 0;\n\t\t\tq->info.si_code = SI_USER;\n\t\t\tq->info.si_pid = current->pid;\n\t\t\tq->info.si_uid = current->uid;\n\t\t\tbreak;\n\t\tcase (unsigned long) SEND_SIG_PRIV:\n\t\t\tq->info.si_signo = sig;\n\t\t\tq->info.si_errno = 0;\n\t\t\tq->info.si_code = SI_KERNEL;\n\t\t\tq->info.si_pid = 0;\n\t\t\tq->info.si_uid = 0;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tcopy_siginfo(&q->info, info);\n\t\t\tbreak;\n\t\t}\n\t} else if (!is_si_special(info)) {\n\t\tif (sig >= SIGRTMIN && info->si_code != SI_USER)\n\t\t/*\n\t\t * Queue overflow, abort. We may abort if the signal was rt\n\t\t * and sent by user using something other than kill().\n\t\t */\n\t\t\treturn -EAGAIN;\n\t}\n\nout_set:\n\tsigaddset(&signals->signal, sig);\n\treturn ret;\n}\n\n#define LEGACY_QUEUE(sigptr, sig) \\\n\t(((sig) < SIGRTMIN) && sigismember(&(sigptr)->signal, (sig)))\n\n\nstatic int\nspecific_send_sig_info(int sig, struct siginfo *info, struct task_struct *t)\n{\n\tint ret = 0;\n\n\tBUG_ON(!irqs_disabled());\n\tassert_spin_locked(&t->sighand->siglock);\n\n\t/* Short-circuit ignored signals. */\n\tif (sig_ignored(t, sig))\n\t\tgoto out;\n\n\t/* Support queueing exactly one non-rt signal, so that we\n\t can get more detailed information about the cause of\n\t the signal. */\n\tif (LEGACY_QUEUE(&t->pending, sig))\n\t\tgoto out;\n\n\tret = send_signal(sig, info, t, &t->pending);\n\tif (!ret && !sigismember(&t->blocked, sig))\n\t\tsignal_wake_up(t, sig == SIGKILL);\nout:\n\treturn ret;\n}\n\n/*\n * Force a signal that the process can't ignore: if necessary\n * we unblock the signal and change any SIG_IGN to SIG_DFL.\n *\n * Note: If we unblock the signal, we always reset it to SIG_DFL,\n * since we do not want to have a signal handler that was blocked\n * be invoked when user space had explicitly blocked it.\n *\n * We don't want to have recursive SIGSEGV's etc, for example.\n */\nint\nforce_sig_info(int sig, struct siginfo *info, struct task_struct *t)\n{\n\tunsigned long int flags;\n\tint ret, blocked, ignored;\n\tstruct k_sigaction *action;\n\n\tspin_lock_irqsave(&t->sighand->siglock, flags);\n\taction = &t->sighand->action[sig-1];\n\tignored = action->sa.sa_handler == SIG_IGN;\n\tblocked = sigismember(&t->blocked, sig);\n\tif (blocked || ignored) {\n\t\taction->sa.sa_handler = SIG_DFL;\n\t\tif (blocked) {\n\t\t\tsigdelset(&t->blocked, sig);\n\t\t\trecalc_sigpending_and_wake(t);\n\t\t}\n\t}\n\tret = specific_send_sig_info(sig, info, t);\n\tspin_unlock_irqrestore(&t->sighand->siglock, flags);\n\n\treturn ret;\n}\n\nvoid\nforce_sig_specific(int sig, struct task_struct *t)\n{\n\tforce_sig_info(sig, SEND_SIG_FORCED, t);\n}\n\n/*\n * Test if P wants to take SIG. After we've checked all threads with this,\n * it's equivalent to finding no threads not blocking SIG. Any threads not\n * blocking SIG were ruled out because they are not running and already\n * have pending signals. Such threads will dequeue from the shared queue\n * as soon as they're available, so putting the signal on the shared queue\n * will be equivalent to sending it to one such thread.\n */\nstatic inline int wants_signal(int sig, struct task_struct *p)\n{\n\tif (sigismember(&p->blocked, sig))\n\t\treturn 0;\n\tif (p->flags & PF_EXITING)\n\t\treturn 0;\n\tif (sig == SIGKILL)\n\t\treturn 1;\n\tif (p->state & (TASK_STOPPED | TASK_TRACED))\n\t\treturn 0;\n\treturn task_curr(p) || !signal_pending(p);\n}\n\nstatic void\n__group_complete_signal(int sig, struct task_struct *p)\n{\n\tstruct task_struct *t;\n\n\t/*\n\t * Now find a thread we can wake up to take the signal off the queue.\n\t *\n\t * If the main thread wants the signal, it gets first crack.\n\t * Probably the least surprising to the average bear.\n\t */\n\tif (wants_signal(sig, p))\n\t\tt = p;\n\telse if (thread_group_empty(p))\n\t\t/*\n\t\t * There is just one thread and it does not need to be woken.\n\t\t * It will dequeue unblocked signals before it runs again.\n\t\t */\n\t\treturn;\n\telse {\n\t\t/*\n\t\t * Otherwise try to find a suitable thread.\n\t\t */\n\t\tt = p->signal->curr_target;\n\t\tif (t == NULL)\n\t\t\t/* restart balancing at this thread */\n\t\t\tt = p->signal->curr_target = p;\n\n\t\twhile (!wants_signal(sig, t)) {\n\t\t\tt = next_thread(t);\n\t\t\tif (t == p->signal->curr_target)\n\t\t\t\t/*\n\t\t\t\t * No thread needs to be woken.\n\t\t\t\t * Any eligible threads will see\n\t\t\t\t * the signal in the queue soon.\n\t\t\t\t */\n\t\t\t\treturn;\n\t\t}\n\t\tp->signal->curr_target = t;\n\t}\n\n\t/*\n\t * Found a killable thread. If the signal will be fatal,\n\t * then start taking the whole group down immediately.\n\t */\n\tif (sig_fatal(p, sig) && !(p->signal->flags & SIGNAL_GROUP_EXIT) &&\n\t !sigismember(&t->real_blocked, sig) &&\n\t (sig == SIGKILL || !(t->ptrace & PT_PTRACED))) {\n\t\t/*\n\t\t * This signal will be fatal to the whole group.\n\t\t */\n\t\tif (!sig_kernel_coredump(sig)) {\n\t\t\t/*\n\t\t\t * Start a group exit and wake everybody up.\n\t\t\t * This way we don't have other threads\n\t\t\t * running and doing things after a slower\n\t\t\t * thread has the fatal signal pending.\n\t\t\t */\n\t\t\tp->signal->flags = SIGNAL_GROUP_EXIT;\n\t\t\tp->signal->group_exit_code = sig;\n\t\t\tp->signal->group_stop_count = 0;\n\t\t\tt = p;\n\t\t\tdo {\n\t\t\t\tsigaddset(&t->pending.signal, SIGKILL);\n\t\t\t\tsignal_wake_up(t, 1);\n\t\t\t\tt = next_thread(t);\n\t\t\t} while (t != p);\n\t\t\treturn;\n\t\t}\n\n\t\t/*\n\t\t * There will be a core dump. We make all threads other\n\t\t * than the chosen one go into a group stop so that nothing\n\t\t * happens until it gets scheduled, takes the signal off\n\t\t * the shared queue, and does the core dump. This is a\n\t\t * little more complicated than strictly necessary, but it\n\t\t * keeps the signal state that winds up in the core dump\n\t\t * unchanged from the death state, e.g. which thread had\n\t\t * the core-dump signal unblocked.\n\t\t */\n\t\trm_from_queue(SIG_KERNEL_STOP_MASK, &t->pending);\n\t\trm_from_queue(SIG_KERNEL_STOP_MASK, &p->signal->shared_pending);\n\t\tp->signal->group_stop_count = 0;\n\t\tp->signal->group_exit_task = t;\n\t\tt = p;\n\t\tdo {\n\t\t\tp->signal->group_stop_count++;\n\t\t\tsignal_wake_up(t, 0);\n\t\t\tt = next_thread(t);\n\t\t} while (t != p);\n\t\twake_up_process(p->signal->group_exit_task);\n\t\treturn;\n\t}\n\n\t/*\n\t * The signal is already in the shared-pending queue.\n\t * Tell the chosen thread to wake up and dequeue it.\n\t */\n\tsignal_wake_up(t, sig == SIGKILL);\n\treturn;\n}\n\nint\n__group_send_sig_info(int sig, struct siginfo *info, struct task_struct *p)\n{\n\tint ret = 0;\n\n\tassert_spin_locked(&p->sighand->siglock);\n\thandle_stop_signal(sig, p);\n\n\t/* Short-circuit ignored signals. */\n\tif (sig_ignored(p, sig))\n\t\treturn ret;\n\n\tif (LEGACY_QUEUE(&p->signal->shared_pending, sig))\n\t\t/* This is a non-RT signal and we already have one queued. */\n\t\treturn ret;\n\n\t/*\n\t * Put this signal on the shared-pending queue, or fail with EAGAIN.\n\t * We always use the shared queue for process-wide signals,\n\t * to avoid several races.\n\t */\n\tret = send_signal(sig, info, p, &p->signal->shared_pending);\n\tif (unlikely(ret))\n\t\treturn ret;\n\n\t__group_complete_signal(sig, p);\n\treturn 0;\n}\n\n/*\n * Nuke all other threads in the group.\n */\nvoid zap_other_threads(struct task_struct *p)\n{\n\tstruct task_struct *t;\n\n\tp->signal->flags = SIGNAL_GROUP_EXIT;\n\tp->signal->group_stop_count = 0;\n\n\tif (thread_group_empty(p))\n\t\treturn;\n\n\tfor (t = next_thread(p); t != p; t = next_thread(t)) {\n\t\t/*\n\t\t * Don't bother with already dead threads\n\t\t */\n\t\tif (t->exit_state)\n\t\t\tcontinue;\n\n\t\t/* SIGKILL will be handled before any pending SIGSTOP */\n\t\tsigaddset(&t->pending.signal, SIGKILL);\n\t\tsignal_wake_up(t, 1);\n\t}\n}\n\n/*\n * Must be called under rcu_read_lock() or with tasklist_lock read-held.\n */\nstruct sighand_struct *lock_task_sighand(struct task_struct *tsk, unsigned long *flags)\n{\n\tstruct sighand_struct *sighand;\n\n\tfor (;;) {\n\t\tsighand = rcu_dereference(tsk->sighand);\n\t\tif (unlikely(sighand == NULL))\n\t\t\tbreak;\n\n\t\tspin_lock_irqsave(&sighand->siglock, *flags);\n\t\tif (likely(sighand == tsk->sighand))\n\t\t\tbreak;\n\t\tspin_unlock_irqrestore(&sighand->siglock, *flags);\n\t}\n\n\treturn sighand;\n}\n\nint group_send_sig_info(int sig, struct siginfo *info, struct task_struct *p)\n{\n\tunsigned long flags;\n\tint ret;\n\n\tret = check_kill_permission(sig, info, p);\n\n\tif (!ret && sig) {\n\t\tret = -ESRCH;\n\t\tif (lock_task_sighand(p, &flags)) {\n\t\t\tret = __group_send_sig_info(sig, info, p);\n\t\t\tunlock_task_sighand(p, &flags);\n\t\t}\n\t}\n\n\treturn ret;\n}\n\n/*\n * kill_pgrp_info() sends a signal to a process group: this is what the tty\n * control characters do (^C, ^Z etc)\n */\n\nint __kill_pgrp_info(int sig, struct siginfo *info, struct pid *pgrp)\n{\n\tstruct task_struct *p = NULL;\n\tint retval, success;\n\n\tsuccess = 0;\n\tretval = -ESRCH;\n\tdo_each_pid_task(pgrp, PIDTYPE_PGID, p) {\n\t\tint err = group_send_sig_info(sig, info, p);\n\t\tsuccess |= !err;\n\t\tretval = err;\n\t} while_each_pid_task(pgrp, PIDTYPE_PGID, p);\n\treturn success ? 0 : retval;\n}\n\nint kill_pgrp_info(int sig, struct siginfo *info, struct pid *pgrp)\n{\n\tint retval;\n\n\tread_lock(&tasklist_lock);\n\tretval = __kill_pgrp_info(sig, info, pgrp);\n\tread_unlock(&tasklist_lock);\n\n\treturn retval;\n}\n\nint kill_pid_info(int sig, struct siginfo *info, struct pid *pid)\n{\n\tint error;\n\tstruct task_struct *p;\n\n\trcu_read_lock();\n\tif (unlikely(sig_needs_tasklist(sig)))\n\t\tread_lock(&tasklist_lock);\n\n\tp = pid_task(pid, PIDTYPE_PID);\n\terror = -ESRCH;\n\tif (p)\n\t\terror = group_send_sig_info(sig, info, p);\n\n\tif (unlikely(sig_needs_tasklist(sig)))\n\t\tread_unlock(&tasklist_lock);\n\trcu_read_unlock();\n\treturn error;\n}\n\nint\nkill_proc_info(int sig, struct siginfo *info, pid_t pid)\n{\n\tint error;\n\trcu_read_lock();\n\terror = kill_pid_info(sig, info, find_pid(pid));\n\trcu_read_unlock();\n\treturn error;\n}\n\n/* like kill_pid_info(), but doesn't use uid/euid of \"current\" */\nint kill_pid_info_as_uid(int sig, struct siginfo *info, struct pid *pid,\n\t\t uid_t uid, uid_t euid, u32 secid)\n{\n\tint ret = -EINVAL;\n\tstruct task_struct *p;\n\n\tif (!valid_signal(sig))\n\t\treturn ret;\n\n\tread_lock(&tasklist_lock);\n\tp = pid_task(pid, PIDTYPE_PID);\n\tif (!p) {\n\t\tret = -ESRCH;\n\t\tgoto out_unlock;\n\t}\n\tif ((info == SEND_SIG_NOINFO || (!is_si_special(info) && SI_FROMUSER(info)))\n\t && (euid != p->suid) && (euid != p->uid)\n\t && (uid != p->suid) && (uid != p->uid)) {\n\t\tret = -EPERM;\n\t\tgoto out_unlock;\n\t}\n\tret = security_task_kill(p, info, sig, secid);\n\tif (ret)\n\t\tgoto out_unlock;\n\tif (sig && p->sighand) {\n\t\tunsigned long flags;\n\t\tspin_lock_irqsave(&p->sighand->siglock, flags);\n\t\tret = __group_send_sig_info(sig, info, p);\n\t\tspin_unlock_irqrestore(&p->sighand->siglock, flags);\n\t}\nout_unlock:\n\tread_unlock(&tasklist_lock);\n\treturn ret;\n}\nEXPORT_SYMBOL_GPL(kill_pid_info_as_uid);\n\n/*\n * kill_something_info() interprets pid in interesting ways just like kill(2).\n *\n * POSIX specifies that kill(-1,sig) is unspecified, but what we have\n * is probably wrong. Should make it like BSD or SYSV.\n */\n\nstatic int kill_something_info(int sig, struct siginfo *info, int pid)\n{\n\tint ret;\n\trcu_read_lock();\n\tif (!pid) {\n\t\tret = kill_pgrp_info(sig, info, task_pgrp(current));\n\t} else if (pid == -1) {\n\t\tint retval = 0, count = 0;\n\t\tstruct task_struct * p;\n\n\t\tread_lock(&tasklist_lock);\n\t\tfor_each_process(p) {\n\t\t\tif (p->pid > 1 && p->tgid != current->tgid) {\n\t\t\t\tint err = group_send_sig_info(sig, info, p);\n\t\t\t\t++count;\n\t\t\t\tif (err != -EPERM)\n\t\t\t\t\tretval = err;\n\t\t\t}\n\t\t}\n\t\tread_unlock(&tasklist_lock);\n\t\tret = count ? retval : -ESRCH;\n\t} else if (pid < 0) {\n\t\tret = kill_pgrp_info(sig, info, find_pid(-pid));\n\t} else {\n\t\tret = kill_pid_info(sig, info, find_pid(pid));\n\t}\n\trcu_read_unlock();\n\treturn ret;\n}\n\n/*\n * These are for backward compatibility with the rest of the kernel source.\n */\n\n/*\n * These two are the most common entry points. They send a signal\n * just to the specific thread.\n */\nint\nsend_sig_info(int sig, struct siginfo *info, struct task_struct *p)\n{\n\tint ret;\n\tunsigned long flags;\n\n\t/*\n\t * Make sure legacy kernel users don't send in bad values\n\t * (normal paths check this in check_kill_permission).\n\t */\n\tif (!valid_signal(sig))\n\t\treturn -EINVAL;\n\n\t/*\n\t * We need the tasklist lock even for the specific\n\t * thread case (when we don't need to follow the group\n\t * lists) in order to avoid races with \"p->sighand\"\n\t * going away or changing from under us.\n\t */\n\tread_lock(&tasklist_lock); \n\tspin_lock_irqsave(&p->sighand->siglock, flags);\n\tret = specific_send_sig_info(sig, info, p);\n\tspin_unlock_irqrestore(&p->sighand->siglock, flags);\n\tread_unlock(&tasklist_lock);\n\treturn ret;\n}\n\n#define __si_special(priv) \\\n\t((priv) ? SEND_SIG_PRIV : SEND_SIG_NOINFO)\n\nint\nsend_sig(int sig, struct task_struct *p, int priv)\n{\n\treturn send_sig_info(sig, __si_special(priv), p);\n}\n\n/*\n * This is the entry point for \"process-wide\" signals.\n * They will go to an appropriate thread in the thread group.\n */\nint\nsend_group_sig_info(int sig, struct siginfo *info, struct task_struct *p)\n{\n\tint ret;\n\tread_lock(&tasklist_lock);\n\tret = group_send_sig_info(sig, info, p);\n\tread_unlock(&tasklist_lock);\n\treturn ret;\n}\n\nvoid\nforce_sig(int sig, struct task_struct *p)\n{\n\tforce_sig_info(sig, SEND_SIG_PRIV, p);\n}\n\n/*\n * When things go south during signal handling, we\n * will force a SIGSEGV. And if the signal that caused\n * the problem was already a SIGSEGV, we'll want to\n * make sure we don't even try to deliver the signal..\n */\nint\nforce_sigsegv(int sig, struct task_struct *p)\n{\n\tif (sig == SIGSEGV) {\n\t\tunsigned long flags;\n\t\tspin_lock_irqsave(&p->sighand->siglock, flags);\n\t\tp->sighand->action[sig - 1].sa.sa_handler = SIG_DFL;\n\t\tspin_unlock_irqrestore(&p->sighand->siglock, flags);\n\t}\n\tforce_sig(SIGSEGV, p);\n\treturn 0;\n}\n\nint kill_pgrp(struct pid *pid, int sig, int priv)\n{\n\treturn kill_pgrp_info(sig, __si_special(priv), pid);\n}\nEXPORT_SYMBOL(kill_pgrp);\n\nint kill_pid(struct pid *pid, int sig, int priv)\n{\n\treturn kill_pid_info(sig, __si_special(priv), pid);\n}\nEXPORT_SYMBOL(kill_pid);\n\nint\nkill_proc(pid_t pid, int sig, int priv)\n{\n\treturn kill_proc_info(sig, __si_special(priv), pid);\n}\n\n/*\n * These functions support sending signals using preallocated sigqueue\n * structures. This is needed \"because realtime applications cannot\n * afford to lose notifications of asynchronous events, like timer\n * expirations or I/O completions\". In the case of Posix Timers \n * we allocate the sigqueue structure from the timer_create. If this\n * allocation fails we are able to report the failure to the application\n * with an EAGAIN error.\n */\n \nstruct sigqueue *sigqueue_alloc(void)\n{\n\tstruct sigqueue *q;\n\n\tif ((q = __sigqueue_alloc(current, GFP_KERNEL, 0)))\n\t\tq->flags |= SIGQUEUE_PREALLOC;\n\treturn(q);\n}\n\nvoid sigqueue_free(struct sigqueue *q)\n{\n\tunsigned long flags;\n\tspinlock_t *lock = &current->sighand->siglock;\n\n\tBUG_ON(!(q->flags & SIGQUEUE_PREALLOC));\n\t/*\n\t * If the signal is still pending remove it from the\n\t * pending queue. We must hold ->siglock while testing\n\t * q->list to serialize with collect_signal().\n\t */\n\tspin_lock_irqsave(lock, flags);\n\tif (!list_empty(&q->list))\n\t\tlist_del_init(&q->list);\n\tspin_unlock_irqrestore(lock, flags);\n\n\tq->flags &= ~SIGQUEUE_PREALLOC;\n\t__sigqueue_free(q);\n}\n\nint send_sigqueue(int sig, struct sigqueue *q, struct task_struct *p)\n{\n\tunsigned long flags;\n\tint ret = 0;\n\n\tBUG_ON(!(q->flags & SIGQUEUE_PREALLOC));\n\n\t/*\n\t * The rcu based delayed sighand destroy makes it possible to\n\t * run this without tasklist lock held. The task struct itself\n\t * cannot go away as create_timer did get_task_struct().\n\t *\n\t * We return -1, when the task is marked exiting, so\n\t * posix_timer_event can redirect it to the group leader\n\t */\n\trcu_read_lock();\n\n\tif (!likely(lock_task_sighand(p, &flags))) {\n\t\tret = -1;\n\t\tgoto out_err;\n\t}\n\n\tif (unlikely(!list_empty(&q->list))) {\n\t\t/*\n\t\t * If an SI_TIMER entry is already queue just increment\n\t\t * the overrun count.\n\t\t */\n\t\tBUG_ON(q->info.si_code != SI_TIMER);\n\t\tq->info.si_overrun++;\n\t\tgoto out;\n\t}\n\t/* Short-circuit ignored signals. */\n\tif (sig_ignored(p, sig)) {\n\t\tret = 1;\n\t\tgoto out;\n\t}\n\t/*\n\t * Deliver the signal to listening signalfds. This must be called\n\t * with the sighand lock held.\n\t */\n\tsignalfd_notify(p, sig);\n\n\tlist_add_tail(&q->list, &p->pending.list);\n\tsigaddset(&p->pending.signal, sig);\n\tif (!sigismember(&p->blocked, sig))\n\t\tsignal_wake_up(p, sig == SIGKILL);\n\nout:\n\tunlock_task_sighand(p, &flags);\nout_err:\n\trcu_read_unlock();\n\n\treturn ret;\n}\n\nint\nsend_group_sigqueue(int sig, struct sigqueue *q, struct task_struct *p)\n{\n\tunsigned long flags;\n\tint ret = 0;\n\n\tBUG_ON(!(q->flags & SIGQUEUE_PREALLOC));\n\n\tread_lock(&tasklist_lock);\n\t/* Since it_lock is held, p->sighand cannot be NULL. */\n\tspin_lock_irqsave(&p->sighand->siglock, flags);\n\thandle_stop_signal(sig, p);\n\n\t/* Short-circuit ignored signals. */\n\tif (sig_ignored(p, sig)) {\n\t\tret = 1;\n\t\tgoto out;\n\t}\n\n\tif (unlikely(!list_empty(&q->list))) {\n\t\t/*\n\t\t * If an SI_TIMER entry is already queue just increment\n\t\t * the overrun count. Other uses should not try to\n\t\t * send the signal multiple times.\n\t\t */\n\t\tBUG_ON(q->info.si_code != SI_TIMER);\n\t\tq->info.si_overrun++;\n\t\tgoto out;\n\t} \n\t/*\n\t * Deliver the signal to listening signalfds. This must be called\n\t * with the sighand lock held.\n\t */\n\tsignalfd_notify(p, sig);\n\n\t/*\n\t * Put this signal on the shared-pending queue.\n\t * We always use the shared queue for process-wide signals,\n\t * to avoid several races.\n\t */\n\tlist_add_tail(&q->list, &p->signal->shared_pending.list);\n\tsigaddset(&p->signal->shared_pending.signal, sig);\n\n\t__group_complete_signal(sig, p);\nout:\n\tspin_unlock_irqrestore(&p->sighand->siglock, flags);\n\tread_unlock(&tasklist_lock);\n\treturn ret;\n}\n\n/*\n * Wake up any threads in the parent blocked in wait* syscalls.\n */\nstatic inline void __wake_up_parent(struct task_struct *p,\n\t\t\t\t struct task_struct *parent)\n{\n\twake_up_interruptible_sync(&parent->signal->wait_chldexit);\n}\n\n/*\n * Let a parent know about the death of a child.\n * For a stopped/continued status change, use do_notify_parent_cldstop instead.\n */\n\nvoid do_notify_parent(struct task_struct *tsk, int sig)\n{\n\tstruct siginfo info;\n\tunsigned long flags;\n\tstruct sighand_struct *psig;\n\n\tBUG_ON(sig == -1);\n\n \t/* do_notify_parent_cldstop should have been called instead. */\n \tBUG_ON(tsk->state & (TASK_STOPPED|TASK_TRACED));\n\n\tBUG_ON(!tsk->ptrace &&\n\t (tsk->group_leader != tsk || !thread_group_empty(tsk)));\n\n\tinfo.si_signo = sig;\n\tinfo.si_errno = 0;\n\tinfo.si_pid = tsk->pid;\n\tinfo.si_uid = tsk->uid;\n\n\t/* FIXME: find out whether or not this is supposed to be c*time. */\n\tinfo.si_utime = cputime_to_jiffies(cputime_add(tsk->utime,\n\t\t\t\t\t\t tsk->signal->utime));\n\tinfo.si_stime = cputime_to_jiffies(cputime_add(tsk->stime,\n\t\t\t\t\t\t tsk->signal->stime));\n\n\tinfo.si_status = tsk->exit_code & 0x7f;\n\tif (tsk->exit_code & 0x80)\n\t\tinfo.si_code = CLD_DUMPED;\n\telse if (tsk->exit_code & 0x7f)\n\t\tinfo.si_code = CLD_KILLED;\n\telse {\n\t\tinfo.si_code = CLD_EXITED;\n\t\tinfo.si_status = tsk->exit_code >> 8;\n\t}\n\n\tpsig = tsk->parent->sighand;\n\tspin_lock_irqsave(&psig->siglock, flags);\n\tif (!tsk->ptrace && sig == SIGCHLD &&\n\t (psig->action[SIGCHLD-1].sa.sa_handler == SIG_IGN ||\n\t (psig->action[SIGCHLD-1].sa.sa_flags & SA_NOCLDWAIT))) {\n\t\t/*\n\t\t * We are exiting and our parent doesn't care. POSIX.1\n\t\t * defines special semantics for setting SIGCHLD to SIG_IGN\n\t\t * or setting the SA_NOCLDWAIT flag: we should be reaped\n\t\t * automatically and not left for our parent's wait4 call.\n\t\t * Rather than having the parent do it as a magic kind of\n\t\t * signal handler, we just set this to tell do_exit that we\n\t\t * can be cleaned up without becoming a zombie. Note that\n\t\t * we still call __wake_up_parent in this case, because a\n\t\t * blocked sys_wait4 might now return -ECHILD.\n\t\t *\n\t\t * Whether we send SIGCHLD or not for SA_NOCLDWAIT\n\t\t * is implementation-defined: we do (if you don't want\n\t\t * it, just use SIG_IGN instead).\n\t\t */\n\t\ttsk->exit_signal = -1;\n\t\tif (psig->action[SIGCHLD-1].sa.sa_handler == SIG_IGN)\n\t\t\tsig = 0;\n\t}\n\tif (valid_signal(sig) && sig > 0)\n\t\t__group_send_sig_info(sig, &info, tsk->parent);\n\t__wake_up_parent(tsk, tsk->parent);\n\tspin_unlock_irqrestore(&psig->siglock, flags);\n}\n\nstatic void do_notify_parent_cldstop(struct task_struct *tsk, int why)\n{\n\tstruct siginfo info;\n\tunsigned long flags;\n\tstruct task_struct *parent;\n\tstruct sighand_struct *sighand;\n\n\tif (tsk->ptrace & PT_PTRACED)\n\t\tparent = tsk->parent;\n\telse {\n\t\ttsk = tsk->group_leader;\n\t\tparent = tsk->real_parent;\n\t}\n\n\tinfo.si_signo = SIGCHLD;\n\tinfo.si_errno = 0;\n\tinfo.si_pid = tsk->pid;\n\tinfo.si_uid = tsk->uid;\n\n\t/* FIXME: find out whether or not this is supposed to be c*time. */\n\tinfo.si_utime = cputime_to_jiffies(tsk->utime);\n\tinfo.si_stime = cputime_to_jiffies(tsk->stime);\n\n \tinfo.si_code = why;\n \tswitch (why) {\n \tcase CLD_CONTINUED:\n \t\tinfo.si_status = SIGCONT;\n \t\tbreak;\n \tcase CLD_STOPPED:\n \t\tinfo.si_status = tsk->signal->group_exit_code & 0x7f;\n \t\tbreak;\n \tcase CLD_TRAPPED:\n \t\tinfo.si_status = tsk->exit_code & 0x7f;\n \t\tbreak;\n \tdefault:\n \t\tBUG();\n \t}\n\n\tsighand = parent->sighand;\n\tspin_lock_irqsave(&sighand->siglock, flags);\n\tif (sighand->action[SIGCHLD-1].sa.sa_handler != SIG_IGN &&\n\t !(sighand->action[SIGCHLD-1].sa.sa_flags & SA_NOCLDSTOP))\n\t\t__group_send_sig_info(SIGCHLD, &info, parent);\n\t/*\n\t * Even if SIGCHLD is not generated, we must wake up wait4 calls.\n\t */\n\t__wake_up_parent(tsk, parent);\n\tspin_unlock_irqrestore(&sighand->siglock, flags);\n}\n\nstatic inline int may_ptrace_stop(void)\n{\n\tif (!likely(current->ptrace & PT_PTRACED))\n\t\treturn 0;\n\n\tif (unlikely(current->parent == current->real_parent &&\n\t\t (current->ptrace & PT_ATTACHED)))\n\t\treturn 0;\n\n\tif (unlikely(current->signal == current->parent->signal) &&\n\t unlikely(current->signal->flags & SIGNAL_GROUP_EXIT))\n\t\treturn 0;\n\n\t/*\n\t * Are we in the middle of do_coredump?\n\t * If so and our tracer is also part of the coredump stopping\n\t * is a deadlock situation, and pointless because our tracer\n\t * is dead so don't allow us to stop.\n\t * If SIGKILL was already sent before the caller unlocked\n\t * ->siglock we must see ->core_waiters != 0. Otherwise it\n\t * is safe to enter schedule().\n\t */\n\tif (unlikely(current->mm->core_waiters) &&\n\t unlikely(current->mm == current->parent->mm))\n\t\treturn 0;\n\n\treturn 1;\n}\n\n/*\n * This must be called with current->sighand->siglock held.\n *\n * This should be the path for all ptrace stops.\n * We always set current->last_siginfo while stopped here.\n * That makes it a way to test a stopped process for\n * being ptrace-stopped vs being job-control-stopped.\n *\n * If we actually decide not to stop at all because the tracer is gone,\n * we leave nostop_code in current->exit_code.\n */\nstatic void ptrace_stop(int exit_code, int nostop_code, siginfo_t *info)\n{\n\t/*\n\t * If there is a group stop in progress,\n\t * we must participate in the bookkeeping.\n\t */\n\tif (current->signal->group_stop_count > 0)\n\t\t--current->signal->group_stop_count;\n\n\tcurrent->last_siginfo = info;\n\tcurrent->exit_code = exit_code;\n\n\t/* Let the debugger run. */\n\tset_current_state(TASK_TRACED);\n\tspin_unlock_irq(&current->sighand->siglock);\n\ttry_to_freeze();\n\tread_lock(&tasklist_lock);\n\tif (may_ptrace_stop()) {\n\t\tdo_notify_parent_cldstop(current, CLD_TRAPPED);\n\t\tread_unlock(&tasklist_lock);\n\t\tschedule();\n\t} else {\n\t\t/*\n\t\t * By the time we got the lock, our tracer went away.\n\t\t * Don't stop here.\n\t\t */\n\t\tread_unlock(&tasklist_lock);\n\t\tset_current_state(TASK_RUNNING);\n\t\tcurrent->exit_code = nostop_code;\n\t}\n\n\t/*\n\t * We are back. Now reacquire the siglock before touching\n\t * last_siginfo, so that we are sure to have synchronized with\n\t * any signal-sending on another CPU that wants to examine it.\n\t */\n\tspin_lock_irq(&current->sighand->siglock);\n\tcurrent->last_siginfo = NULL;\n\n\t/*\n\t * Queued signals ignored us while we were stopped for tracing.\n\t * So check for any that we should take before resuming user mode.\n\t * This sets TIF_SIGPENDING, but never clears it.\n\t */\n\trecalc_sigpending_tsk(current);\n}\n\nvoid ptrace_notify(int exit_code)\n{\n\tsiginfo_t info;\n\n\tBUG_ON((exit_code & (0x7f | ~0xffff)) != SIGTRAP);\n\n\tmemset(&info, 0, sizeof info);\n\tinfo.si_signo = SIGTRAP;\n\tinfo.si_code = exit_code;\n\tinfo.si_pid = current->pid;\n\tinfo.si_uid = current->uid;\n\n\t/* Let the debugger run. */\n\tspin_lock_irq(&current->sighand->siglock);\n\tptrace_stop(exit_code, 0, &info);\n\tspin_unlock_irq(&current->sighand->siglock);\n}\n\nstatic void\nfinish_stop(int stop_count)\n{\n\t/*\n\t * If there are no other threads in the group, or if there is\n\t * a group stop in progress and we are the last to stop,\n\t * report to the parent. When ptraced, every thread reports itself.\n\t */\n\tif (stop_count == 0 || (current->ptrace & PT_PTRACED)) {\n\t\tread_lock(&tasklist_lock);\n\t\tdo_notify_parent_cldstop(current, CLD_STOPPED);\n\t\tread_unlock(&tasklist_lock);\n\t}\n\n\tdo {\n\t\tschedule();\n\t} while (try_to_freeze());\n\t/*\n\t * Now we don't run again until continued.\n\t */\n\tcurrent->exit_code = 0;\n}\n\n/*\n * This performs the stopping for SIGSTOP and other stop signals.\n * We have to stop all threads in the thread group.\n * Returns nonzero if we've actually stopped and released the siglock.\n * Returns zero if we didn't stop and still hold the siglock.\n */\nstatic int do_signal_stop(int signr)\n{\n\tstruct signal_struct *sig = current->signal;\n\tint stop_count;\n\n\tif (!likely(sig->flags & SIGNAL_STOP_DEQUEUED))\n\t\treturn 0;\n\n\tif (sig->group_stop_count > 0) {\n\t\t/*\n\t\t * There is a group stop in progress. We don't need to\n\t\t * start another one.\n\t\t */\n\t\tstop_count = --sig->group_stop_count;\n\t} else {\n\t\t/*\n\t\t * There is no group stop already in progress.\n\t\t * We must initiate one now.\n\t\t */\n\t\tstruct task_struct *t;\n\n\t\tsig->group_exit_code = signr;\n\n\t\tstop_count = 0;\n\t\tfor (t = next_thread(current); t != current; t = next_thread(t))\n\t\t\t/*\n\t\t\t * Setting state to TASK_STOPPED for a group\n\t\t\t * stop is always done with the siglock held,\n\t\t\t * so this check has no races.\n\t\t\t */\n\t\t\tif (!t->exit_state &&\n\t\t\t !(t->state & (TASK_STOPPED|TASK_TRACED))) {\n\t\t\t\tstop_count++;\n\t\t\t\tsignal_wake_up(t, 0);\n\t\t\t}\n\t\tsig->group_stop_count = stop_count;\n\t}\n\n\tif (stop_count == 0)\n\t\tsig->flags = SIGNAL_STOP_STOPPED;\n\tcurrent->exit_code = sig->group_exit_code;\n\t__set_current_state(TASK_STOPPED);\n\n\tspin_unlock_irq(&current->sighand->siglock);\n\tfinish_stop(stop_count);\n\treturn 1;\n}\n\n/*\n * Do appropriate magic when group_stop_count > 0.\n * We return nonzero if we stopped, after releasing the siglock.\n * We return zero if we still hold the siglock and should look\n * for another signal without checking group_stop_count again.\n */\nstatic int handle_group_stop(void)\n{\n\tint stop_count;\n\n\tif (current->signal->group_exit_task == current) {\n\t\t/*\n\t\t * Group stop is so we can do a core dump,\n\t\t * We are the initiating thread, so get on with it.\n\t\t */\n\t\tcurrent->signal->group_exit_task = NULL;\n\t\treturn 0;\n\t}\n\n\tif (current->signal->flags & SIGNAL_GROUP_EXIT)\n\t\t/*\n\t\t * Group stop is so another thread can do a core dump,\n\t\t * or else we are racing against a death signal.\n\t\t * Just punt the stop so we can get the next signal.\n\t\t */\n\t\treturn 0;\n\n\t/*\n\t * There is a group stop in progress. We stop\n\t * without any associated signal being in our queue.\n\t */\n\tstop_count = --current->signal->group_stop_count;\n\tif (stop_count == 0)\n\t\tcurrent->signal->flags = SIGNAL_STOP_STOPPED;\n\tcurrent->exit_code = current->signal->group_exit_code;\n\tset_current_state(TASK_STOPPED);\n\tspin_unlock_irq(&current->sighand->siglock);\n\tfinish_stop(stop_count);\n\treturn 1;\n}\n\nint get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka,\n\t\t\t struct pt_regs *regs, void *cookie)\n{\n\tsigset_t *mask = &current->blocked;\n\tint signr = 0;\n\n\ttry_to_freeze();\n\nrelock:\n\tspin_lock_irq(&current->sighand->siglock);\n\tfor (;;) {\n\t\tstruct k_sigaction *ka;\n\n\t\tif (unlikely(current->signal->group_stop_count > 0) &&\n\t\t handle_group_stop())\n\t\t\tgoto relock;\n\n\t\tsignr = dequeue_signal(current, mask, info);\n\n\t\tif (!signr)\n\t\t\tbreak; /* will return 0 */\n\n\t\tif ((current->ptrace & PT_PTRACED) && signr != SIGKILL) {\n\t\t\tptrace_signal_deliver(regs, cookie);\n\n\t\t\t/* Let the debugger run. */\n\t\t\tptrace_stop(signr, signr, info);\n\n\t\t\t/* We're back. Did the debugger cancel the sig? */\n\t\t\tsignr = current->exit_code;\n\t\t\tif (signr == 0)\n\t\t\t\tcontinue;\n\n\t\t\tcurrent->exit_code = 0;\n\n\t\t\t/* Update the siginfo structure if the signal has\n\t\t\t changed. If the debugger wanted something\n\t\t\t specific in the siginfo structure then it should\n\t\t\t have updated *info via PTRACE_SETSIGINFO. */\n\t\t\tif (signr != info->si_signo) {\n\t\t\t\tinfo->si_signo = signr;\n\t\t\t\tinfo->si_errno = 0;\n\t\t\t\tinfo->si_code = SI_USER;\n\t\t\t\tinfo->si_pid = current->parent->pid;\n\t\t\t\tinfo->si_uid = current->parent->uid;\n\t\t\t}\n\n\t\t\t/* If the (new) signal is now blocked, requeue it. */\n\t\t\tif (sigismember(&current->blocked, signr)) {\n\t\t\t\tspecific_send_sig_info(signr, info, current);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\tka = &current->sighand->action[signr-1];\n\t\tif (ka->sa.sa_handler == SIG_IGN) /* Do nothing. */\n\t\t\tcontinue;\n\t\tif (ka->sa.sa_handler != SIG_DFL) {\n\t\t\t/* Run the handler. */\n\t\t\t*return_ka = *ka;\n\n\t\t\tif (ka->sa.sa_flags & SA_ONESHOT)\n\t\t\t\tka->sa.sa_handler = SIG_DFL;\n\n\t\t\tbreak; /* will return non-zero \"signr\" value */\n\t\t}\n\n\t\t/*\n\t\t * Now we are doing the default action for this signal.\n\t\t */\n\t\tif (sig_kernel_ignore(signr)) /* Default is nothing. */\n\t\t\tcontinue;\n\n\t\t/*\n\t\t * Init of a pid space gets no signals it doesn't want from\n\t\t * within that pid space. It can of course get signals from\n\t\t * its parent pid space.\n\t\t */\n\t\tif (current == child_reaper(current))\n\t\t\tcontinue;\n\n\t\tif (sig_kernel_stop(signr)) {\n\t\t\t/*\n\t\t\t * The default action is to stop all threads in\n\t\t\t * the thread group. The job control signals\n\t\t\t * do nothing in an orphaned pgrp, but SIGSTOP\n\t\t\t * always works. Note that siglock needs to be\n\t\t\t * dropped during the call to is_orphaned_pgrp()\n\t\t\t * because of lock ordering with tasklist_lock.\n\t\t\t * This allows an intervening SIGCONT to be posted.\n\t\t\t * We need to check for that and bail out if necessary.\n\t\t\t */\n\t\t\tif (signr != SIGSTOP) {\n\t\t\t\tspin_unlock_irq(&current->sighand->siglock);\n\n\t\t\t\t/* signals can be posted during this window */\n\n\t\t\t\tif (is_current_pgrp_orphaned())\n\t\t\t\t\tgoto relock;\n\n\t\t\t\tspin_lock_irq(&current->sighand->siglock);\n\t\t\t}\n\n\t\t\tif (likely(do_signal_stop(signr))) {\n\t\t\t\t/* It released the siglock. */\n\t\t\t\tgoto relock;\n\t\t\t}\n\n\t\t\t/*\n\t\t\t * We didn't actually stop, due to a race\n\t\t\t * with SIGCONT or something like that.\n\t\t\t */\n\t\t\tcontinue;\n\t\t}\n\n\t\tspin_unlock_irq(&current->sighand->siglock);\n\n\t\t/*\n\t\t * Anything else is fatal, maybe with a core dump.\n\t\t */\n\t\tcurrent->flags |= PF_SIGNALED;\n\t\tif (sig_kernel_coredump(signr)) {\n\t\t\t/*\n\t\t\t * If it was able to dump core, this kills all\n\t\t\t * other threads in the group and synchronizes with\n\t\t\t * their demise. If we lost the race with another\n\t\t\t * thread getting here, it set group_exit_code\n\t\t\t * first and our do_group_exit call below will use\n\t\t\t * that value and ignore the one we pass it.\n\t\t\t */\n\t\t\tdo_coredump((long)signr, signr, regs);\n\t\t}\n\n\t\t/*\n\t\t * Death signals, no core dump.\n\t\t */\n\t\tdo_group_exit(signr);\n\t\t/* NOTREACHED */\n\t}\n\tspin_unlock_irq(&current->sighand->siglock);\n\treturn signr;\n}\n\nEXPORT_SYMBOL(recalc_sigpending);\nEXPORT_SYMBOL_GPL(dequeue_signal);\nEXPORT_SYMBOL(flush_signals);\nEXPORT_SYMBOL(force_sig);\nEXPORT_SYMBOL(kill_proc);\nEXPORT_SYMBOL(ptrace_notify);\nEXPORT_SYMBOL(send_sig);\nEXPORT_SYMBOL(send_sig_info);\nEXPORT_SYMBOL(sigprocmask);\nEXPORT_SYMBOL(block_all_signals);\nEXPORT_SYMBOL(unblock_all_signals);\n\n\n/*\n * System call entry points.\n */\n\nasmlinkage long sys_restart_syscall(void)\n{\n\tstruct restart_block *restart = &current_thread_info()->restart_block;\n\treturn restart->fn(restart);\n}\n\nlong do_no_restart_syscall(struct restart_block *param)\n{\n\treturn -EINTR;\n}\n\n/*\n * We don't need to get the kernel lock - this is all local to this\n * particular thread.. (and that's good, because this is _heavily_\n * used by various programs)\n */\n\n/*\n * This is also useful for kernel threads that want to temporarily\n * (or permanently) block certain signals.\n *\n * NOTE! Unlike the user-mode sys_sigprocmask(), the kernel\n * interface happily blocks \"unblockable\" signals like SIGKILL\n * and friends.\n */\nint sigprocmask(int how, sigset_t *set, sigset_t *oldset)\n{\n\tint error;\n\n\tspin_lock_irq(&current->sighand->siglock);\n\tif (oldset)\n\t\t*oldset = current->blocked;\n\n\terror = 0;\n\tswitch (how) {\n\tcase SIG_BLOCK:\n\t\tsigorsets(&current->blocked, &current->blocked, set);\n\t\tbreak;\n\tcase SIG_UNBLOCK:\n\t\tsignandsets(&current->blocked, &current->blocked, set);\n\t\tbreak;\n\tcase SIG_SETMASK:\n\t\tcurrent->blocked = *set;\n\t\tbreak;\n\tdefault:\n\t\terror = -EINVAL;\n\t}\n\trecalc_sigpending();\n\tspin_unlock_irq(&current->sighand->siglock);\n\n\treturn error;\n}\n\nasmlinkage long\nsys_rt_sigprocmask(int how, sigset_t __user *set, sigset_t __user *oset, size_t sigsetsize)\n{\n\tint error = -EINVAL;\n\tsigset_t old_set, new_set;\n\n\t/* XXX: Don't preclude handling different sized sigset_t's. */\n\tif (sigsetsize != sizeof(sigset_t))\n\t\tgoto out;\n\n\tif (set) {\n\t\terror = -EFAULT;\n\t\tif (copy_from_user(&new_set, set, sizeof(*set)))\n\t\t\tgoto out;\n\t\tsigdelsetmask(&new_set, sigmask(SIGKILL)|sigmask(SIGSTOP));\n\n\t\terror = sigprocmask(how, &new_set, &old_set);\n\t\tif (error)\n\t\t\tgoto out;\n\t\tif (oset)\n\t\t\tgoto set_old;\n\t} else if (oset) {\n\t\tspin_lock_irq(&current->sighand->siglock);\n\t\told_set = current->blocked;\n\t\tspin_unlock_irq(&current->sighand->siglock);\n\n\tset_old:\n\t\terror = -EFAULT;\n\t\tif (copy_to_user(oset, &old_set, sizeof(*oset)))\n\t\t\tgoto out;\n\t}\n\terror = 0;\nout:\n\treturn error;\n}\n\nlong do_sigpending(void __user *set, unsigned long sigsetsize)\n{\n\tlong error = -EINVAL;\n\tsigset_t pending;\n\n\tif (sigsetsize > sizeof(sigset_t))\n\t\tgoto out;\n\n\tspin_lock_irq(&current->sighand->siglock);\n\tsigorsets(&pending, &current->pending.signal,\n\t\t &current->signal->shared_pending.signal);\n\tspin_unlock_irq(&current->sighand->siglock);\n\n\t/* Outside the lock because only this thread touches it. */\n\tsigandsets(&pending, &current->blocked, &pending);\n\n\terror = -EFAULT;\n\tif (!copy_to_user(set, &pending, sigsetsize))\n\t\terror = 0;\n\nout:\n\treturn error;\n}\t\n\nasmlinkage long\nsys_rt_sigpending(sigset_t __user *set, size_t sigsetsize)\n{\n\treturn do_sigpending(set, sigsetsize);\n}\n\n#ifndef HAVE_ARCH_COPY_SIGINFO_TO_USER\n\nint copy_siginfo_to_user(siginfo_t __user *to, siginfo_t *from)\n{\n\tint err;\n\n\tif (!access_ok (VERIFY_WRITE, to, sizeof(siginfo_t)))\n\t\treturn -EFAULT;\n\tif (from->si_code < 0)\n\t\treturn __copy_to_user(to, from, sizeof(siginfo_t))\n\t\t\t? -EFAULT : 0;\n\t/*\n\t * If you change siginfo_t structure, please be sure\n\t * this code is fixed accordingly.\n\t * Please remember to update the signalfd_copyinfo() function\n\t * inside fs/signalfd.c too, in case siginfo_t changes.\n\t * It should never copy any pad contained in the structure\n\t * to avoid security leaks, but must copy the generic\n\t * 3 ints plus the relevant union member.\n\t */\n\terr = __put_user(from->si_signo, &to->si_signo);\n\terr |= __put_user(from->si_errno, &to->si_errno);\n\terr |= __put_user((short)from->si_code, &to->si_code);\n\tswitch (from->si_code & __SI_MASK) {\n\tcase __SI_KILL:\n\t\terr |= __put_user(from->si_pid, &to->si_pid);\n\t\terr |= __put_user(from->si_uid, &to->si_uid);\n\t\tbreak;\n\tcase __SI_TIMER:\n\t\t err |= __put_user(from->si_tid, &to->si_tid);\n\t\t err |= __put_user(from->si_overrun, &to->si_overrun);\n\t\t err |= __put_user(from->si_ptr, &to->si_ptr);\n\t\tbreak;\n\tcase __SI_POLL:\n\t\terr |= __put_user(from->si_band, &to->si_band);\n\t\terr |= __put_user(from->si_fd, &to->si_fd);\n\t\tbreak;\n\tcase __SI_FAULT:\n\t\terr |= __put_user(from->si_addr, &to->si_addr);\n#ifdef __ARCH_SI_TRAPNO\n\t\terr |= __put_user(from->si_trapno, &to->si_trapno);\n#endif\n\t\tbreak;\n\tcase __SI_CHLD:\n\t\terr |= __put_user(from->si_pid, &to->si_pid);\n\t\terr |= __put_user(from->si_uid, &to->si_uid);\n\t\terr |= __put_user(from->si_status, &to->si_status);\n\t\terr |= __put_user(from->si_utime, &to->si_utime);\n\t\terr |= __put_user(from->si_stime, &to->si_stime);\n\t\tbreak;\n\tcase __SI_RT: /* This is not generated by the kernel as of now. */\n\tcase __SI_MESGQ: /* But this is */\n\t\terr |= __put_user(from->si_pid, &to->si_pid);\n\t\terr |= __put_user(from->si_uid, &to->si_uid);\n\t\terr |= __put_user(from->si_ptr, &to->si_ptr);\n\t\tbreak;\n\tdefault: /* this is just in case for now ... */\n\t\terr |= __put_user(from->si_pid, &to->si_pid);\n\t\terr |= __put_user(from->si_uid, &to->si_uid);\n\t\tbreak;\n\t}\n\treturn err;\n}\n\n#endif\n\nasmlinkage long\nsys_rt_sigtimedwait(const sigset_t __user *uthese,\n\t\t siginfo_t __user *uinfo,\n\t\t const struct timespec __user *uts,\n\t\t size_t sigsetsize)\n{\n\tint ret, sig;\n\tsigset_t these;\n\tstruct timespec ts;\n\tsiginfo_t info;\n\tlong timeout = 0;\n\n\t/* XXX: Don't preclude handling different sized sigset_t's. */\n\tif (sigsetsize != sizeof(sigset_t))\n\t\treturn -EINVAL;\n\n\tif (copy_from_user(&these, uthese, sizeof(these)))\n\t\treturn -EFAULT;\n\t\t\n\t/*\n\t * Invert the set of allowed signals to get those we\n\t * want to block.\n\t */\n\tsigdelsetmask(&these, sigmask(SIGKILL)|sigmask(SIGSTOP));\n\tsignotset(&these);\n\n\tif (uts) {\n\t\tif (copy_from_user(&ts, uts, sizeof(ts)))\n\t\t\treturn -EFAULT;\n\t\tif (ts.tv_nsec >= 1000000000L || ts.tv_nsec < 0\n\t\t || ts.tv_sec < 0)\n\t\t\treturn -EINVAL;\n\t}\n\n\tspin_lock_irq(&current->sighand->siglock);\n\tsig = dequeue_signal(current, &these, &info);\n\tif (!sig) {\n\t\ttimeout = MAX_SCHEDULE_TIMEOUT;\n\t\tif (uts)\n\t\t\ttimeout = (timespec_to_jiffies(&ts)\n\t\t\t\t + (ts.tv_sec || ts.tv_nsec));\n\n\t\tif (timeout) {\n\t\t\t/* None ready -- temporarily unblock those we're\n\t\t\t * interested while we are sleeping in so that we'll\n\t\t\t * be awakened when they arrive. */\n\t\t\tcurrent->real_blocked = current->blocked;\n\t\t\tsigandsets(&current->blocked, &current->blocked, &these);\n\t\t\trecalc_sigpending();\n\t\t\tspin_unlock_irq(&current->sighand->siglock);\n\n\t\t\ttimeout = schedule_timeout_interruptible(timeout);\n\n\t\t\tspin_lock_irq(&current->sighand->siglock);\n\t\t\tsig = dequeue_signal(current, &these, &info);\n\t\t\tcurrent->blocked = current->real_blocked;\n\t\t\tsiginitset(&current->real_blocked, 0);\n\t\t\trecalc_sigpending();\n\t\t}\n\t}\n\tspin_unlock_irq(&current->sighand->siglock);\n\n\tif (sig) {\n\t\tret = sig;\n\t\tif (uinfo) {\n\t\t\tif (copy_siginfo_to_user(uinfo, &info))\n\t\t\t\tret = -EFAULT;\n\t\t}\n\t} else {\n\t\tret = -EAGAIN;\n\t\tif (timeout)\n\t\t\tret = -EINTR;\n\t}\n\n\treturn ret;\n}\n\nasmlinkage long\nsys_kill(int pid, int sig)\n{\n\tstruct siginfo info;\n\n\tinfo.si_signo = sig;\n\tinfo.si_errno = 0;\n\tinfo.si_code = SI_USER;\n\tinfo.si_pid = current->tgid;\n\tinfo.si_uid = current->uid;\n\n\treturn kill_something_info(sig, &info, pid);\n}\n\nstatic int do_tkill(int tgid, int pid, int sig)\n{\n\tint error;\n\tstruct siginfo info;\n\tstruct task_struct *p;\n\n\terror = -ESRCH;\n\tinfo.si_signo = sig;\n\tinfo.si_errno = 0;\n\tinfo.si_code = SI_TKILL;\n\tinfo.si_pid = current->tgid;\n\tinfo.si_uid = current->uid;\n\n\tread_lock(&tasklist_lock);\n\tp = find_task_by_pid(pid);\n\tif (p && (tgid <= 0 || p->tgid == tgid)) {\n\t\terror = check_kill_permission(sig, &info, p);\n\t\t/*\n\t\t * The null signal is a permissions and process existence\n\t\t * probe. No signal is actually delivered.\n\t\t */\n\t\tif (!error && sig && p->sighand) {\n\t\t\tspin_lock_irq(&p->sighand->siglock);\n\t\t\thandle_stop_signal(sig, p);\n\t\t\terror = specific_send_sig_info(sig, &info, p);\n\t\t\tspin_unlock_irq(&p->sighand->siglock);\n\t\t}\n\t}\n\tread_unlock(&tasklist_lock);\n\n\treturn error;\n}\n\n/**\n * sys_tgkill - send signal to one specific thread\n * @tgid: the thread group ID of the thread\n * @pid: the PID of the thread\n * @sig: signal to be sent\n *\n * This syscall also checks the @tgid and returns -ESRCH even if the PID\n * exists but it's not belonging to the target process anymore. This\n * method solves the problem of threads exiting and PIDs getting reused.\n */\nasmlinkage long sys_tgkill(int tgid, int pid, int sig)\n{\n\t/* This is only valid for single tasks */\n\tif (pid <= 0 || tgid <= 0)\n\t\treturn -EINVAL;\n\n\treturn do_tkill(tgid, pid, sig);\n}\n\n/*\n * Send a signal to only one task, even if it's a CLONE_THREAD task.\n */\nasmlinkage long\nsys_tkill(int pid, int sig)\n{\n\t/* This is only valid for single tasks */\n\tif (pid <= 0)\n\t\treturn -EINVAL;\n\n\treturn do_tkill(0, pid, sig);\n}\n\nasmlinkage long\nsys_rt_sigqueueinfo(int pid, int sig, siginfo_t __user *uinfo)\n{\n\tsiginfo_t info;\n\n\tif (copy_from_user(&info, uinfo, sizeof(siginfo_t)))\n\t\treturn -EFAULT;\n\n\t/* Not even root can pretend to send signals from the kernel.\n\t Nor can they impersonate a kill(), which adds source info. */\n\tif (info.si_code >= 0)\n\t\treturn -EPERM;\n\tinfo.si_signo = sig;\n\n\t/* POSIX.1b doesn't mention process groups. */\n\treturn kill_proc_info(sig, &info, pid);\n}\n\nint do_sigaction(int sig, struct k_sigaction *act, struct k_sigaction *oact)\n{\n\tstruct k_sigaction *k;\n\tsigset_t mask;\n\n\tif (!valid_signal(sig) || sig < 1 || (act && sig_kernel_only(sig)))\n\t\treturn -EINVAL;\n\n\tk = &current->sighand->action[sig-1];\n\n\tspin_lock_irq(&current->sighand->siglock);\n\tif (signal_pending(current)) {\n\t\t/*\n\t\t * If there might be a fatal signal pending on multiple\n\t\t * threads, make sure we take it before changing the action.\n\t\t */\n\t\tspin_unlock_irq(&current->sighand->siglock);\n\t\treturn -ERESTARTNOINTR;\n\t}\n\n\tif (oact)\n\t\t*oact = *k;\n\n\tif (act) {\n\t\tsigdelsetmask(&act->sa.sa_mask,\n\t\t\t sigmask(SIGKILL) | sigmask(SIGSTOP));\n\t\t*k = *act;\n\t\t/*\n\t\t * POSIX 3.3.1.3:\n\t\t * \"Setting a signal action to SIG_IGN for a signal that is\n\t\t * pending shall cause the pending signal to be discarded,\n\t\t * whether or not it is blocked.\"\n\t\t *\n\t\t * \"Setting a signal action to SIG_DFL for a signal that is\n\t\t * pending and whose default action is to ignore the signal\n\t\t * (for example, SIGCHLD), shall cause the pending signal to\n\t\t * be discarded, whether or not it is blocked\"\n\t\t */\n\t\tif (act->sa.sa_handler == SIG_IGN ||\n\t\t (act->sa.sa_handler == SIG_DFL && sig_kernel_ignore(sig))) {\n\t\t\tstruct task_struct *t = current;\n\t\t\tsigemptyset(&mask);\n\t\t\tsigaddset(&mask, sig);\n\t\t\trm_from_queue_full(&mask, &t->signal->shared_pending);\n\t\t\tdo {\n\t\t\t\trm_from_queue_full(&mask, &t->pending);\n\t\t\t\trecalc_sigpending_and_wake(t);\n\t\t\t\tt = next_thread(t);\n\t\t\t} while (t != current);\n\t\t}\n\t}\n\n\tspin_unlock_irq(&current->sighand->siglock);\n\treturn 0;\n}\n\nint \ndo_sigaltstack (const stack_t __user *uss, stack_t __user *uoss, unsigned long sp)\n{\n\tstack_t oss;\n\tint error;\n\n\tif (uoss) {\n\t\toss.ss_sp = (void __user *) current->sas_ss_sp;\n\t\toss.ss_size = current->sas_ss_size;\n\t\toss.ss_flags = sas_ss_flags(sp);\n\t}\n\n\tif (uss) {\n\t\tvoid __user *ss_sp;\n\t\tsize_t ss_size;\n\t\tint ss_flags;\n\n\t\terror = -EFAULT;\n\t\tif (!access_ok(VERIFY_READ, uss, sizeof(*uss))\n\t\t || __get_user(ss_sp, &uss->ss_sp)\n\t\t || __get_user(ss_flags, &uss->ss_flags)\n\t\t || __get_user(ss_size, &uss->ss_size))\n\t\t\tgoto out;\n\n\t\terror = -EPERM;\n\t\tif (on_sig_stack(sp))\n\t\t\tgoto out;\n\n\t\terror = -EINVAL;\n\t\t/*\n\t\t *\n\t\t * Note - this code used to test ss_flags incorrectly\n\t\t * \t old code may have been written using ss_flags==0\n\t\t *\t to mean ss_flags==SS_ONSTACK (as this was the only\n\t\t *\t way that worked) - this fix preserves that older\n\t\t *\t mechanism\n\t\t */\n\t\tif (ss_flags != SS_DISABLE && ss_flags != SS_ONSTACK && ss_flags != 0)\n\t\t\tgoto out;\n\n\t\tif (ss_flags == SS_DISABLE) {\n\t\t\tss_size = 0;\n\t\t\tss_sp = NULL;\n\t\t} else {\n\t\t\terror = -ENOMEM;\n\t\t\tif (ss_size < MINSIGSTKSZ)\n\t\t\t\tgoto out;\n\t\t}\n\n\t\tcurrent->sas_ss_sp = (unsigned long) ss_sp;\n\t\tcurrent->sas_ss_size = ss_size;\n\t}\n\n\tif (uoss) {\n\t\terror = -EFAULT;\n\t\tif (copy_to_user(uoss, &oss, sizeof(oss)))\n\t\t\tgoto out;\n\t}\n\n\terror = 0;\nout:\n\treturn error;\n}\n\n#ifdef __ARCH_WANT_SYS_SIGPENDING\n\nasmlinkage long\nsys_sigpending(old_sigset_t __user *set)\n{\n\treturn do_sigpending(set, sizeof(*set));\n}\n\n#endif\n\n#ifdef __ARCH_WANT_SYS_SIGPROCMASK\n/* Some platforms have their own version with special arguments others\n support only sys_rt_sigprocmask. */\n\nasmlinkage long\nsys_sigprocmask(int how, old_sigset_t __user *set, old_sigset_t __user *oset)\n{\n\tint error;\n\told_sigset_t old_set, new_set;\n\n\tif (set) {\n\t\terror = -EFAULT;\n\t\tif (copy_from_user(&new_set, set, sizeof(*set)))\n\t\t\tgoto out;\n\t\tnew_set &= ~(sigmask(SIGKILL) | sigmask(SIGSTOP));\n\n\t\tspin_lock_irq(&current->sighand->siglock);\n\t\told_set = current->blocked.sig[0];\n\n\t\terror = 0;\n\t\tswitch (how) {\n\t\tdefault:\n\t\t\terror = -EINVAL;\n\t\t\tbreak;\n\t\tcase SIG_BLOCK:\n\t\t\tsigaddsetmask(&current->blocked, new_set);\n\t\t\tbreak;\n\t\tcase SIG_UNBLOCK:\n\t\t\tsigdelsetmask(&current->blocked, new_set);\n\t\t\tbreak;\n\t\tcase SIG_SETMASK:\n\t\t\tcurrent->blocked.sig[0] = new_set;\n\t\t\tbreak;\n\t\t}\n\n\t\trecalc_sigpending();\n\t\tspin_unlock_irq(&current->sighand->siglock);\n\t\tif (error)\n\t\t\tgoto out;\n\t\tif (oset)\n\t\t\tgoto set_old;\n\t} else if (oset) {\n\t\told_set = current->blocked.sig[0];\n\tset_old:\n\t\terror = -EFAULT;\n\t\tif (copy_to_user(oset, &old_set, sizeof(*oset)))\n\t\t\tgoto out;\n\t}\n\terror = 0;\nout:\n\treturn error;\n}\n#endif /* __ARCH_WANT_SYS_SIGPROCMASK */\n\n#ifdef __ARCH_WANT_SYS_RT_SIGACTION\nasmlinkage long\nsys_rt_sigaction(int sig,\n\t\t const struct sigaction __user *act,\n\t\t struct sigaction __user *oact,\n\t\t size_t sigsetsize)\n{\n\tstruct k_sigaction new_sa, old_sa;\n\tint ret = -EINVAL;\n\n\t/* XXX: Don't preclude handling different sized sigset_t's. */\n\tif (sigsetsize != sizeof(sigset_t))\n\t\tgoto out;\n\n\tif (act) {\n\t\tif (copy_from_user(&new_sa.sa, act, sizeof(new_sa.sa)))\n\t\t\treturn -EFAULT;\n\t}\n\n\tret = do_sigaction(sig, act ? &new_sa : NULL, oact ? &old_sa : NULL);\n\n\tif (!ret && oact) {\n\t\tif (copy_to_user(oact, &old_sa.sa, sizeof(old_sa.sa)))\n\t\t\treturn -EFAULT;\n\t}\nout:\n\treturn ret;\n}\n#endif /* __ARCH_WANT_SYS_RT_SIGACTION */\n\n#ifdef __ARCH_WANT_SYS_SGETMASK\n\n/*\n * For backwards compatibility. Functionality superseded by sigprocmask.\n */\nasmlinkage long\nsys_sgetmask(void)\n{\n\t/* SMP safe */\n\treturn current->blocked.sig[0];\n}\n\nasmlinkage long\nsys_ssetmask(int newmask)\n{\n\tint old;\n\n\tspin_lock_irq(&current->sighand->siglock);\n\told = current->blocked.sig[0];\n\n\tsiginitset(&current->blocked, newmask & ~(sigmask(SIGKILL)|\n\t\t\t\t\t\t sigmask(SIGSTOP)));\n\trecalc_sigpending();\n\tspin_unlock_irq(&current->sighand->siglock);\n\n\treturn old;\n}\n#endif /* __ARCH_WANT_SGETMASK */\n\n#ifdef __ARCH_WANT_SYS_SIGNAL\n/*\n * For backwards compatibility. Functionality superseded by sigaction.\n */\nasmlinkage unsigned long\nsys_signal(int sig, __sighandler_t handler)\n{\n\tstruct k_sigaction new_sa, old_sa;\n\tint ret;\n\n\tnew_sa.sa.sa_handler = handler;\n\tnew_sa.sa.sa_flags = SA_ONESHOT | SA_NOMASK;\n\tsigemptyset(&new_sa.sa.sa_mask);\n\n\tret = do_sigaction(sig, &new_sa, &old_sa);\n\n\treturn ret ? ret : (unsigned long)old_sa.sa.sa_handler;\n}\n#endif /* __ARCH_WANT_SYS_SIGNAL */\n\n#ifdef __ARCH_WANT_SYS_PAUSE\n\nasmlinkage long\nsys_pause(void)\n{\n\tcurrent->state = TASK_INTERRUPTIBLE;\n\tschedule();\n\treturn -ERESTARTNOHAND;\n}\n\n#endif\n\n#ifdef __ARCH_WANT_SYS_RT_SIGSUSPEND\nasmlinkage long sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize)\n{\n\tsigset_t newset;\n\n\t/* XXX: Don't preclude handling different sized sigset_t's. */\n\tif (sigsetsize != sizeof(sigset_t))\n\t\treturn -EINVAL;\n\n\tif (copy_from_user(&newset, unewset, sizeof(newset)))\n\t\treturn -EFAULT;\n\tsigdelsetmask(&newset, sigmask(SIGKILL)|sigmask(SIGSTOP));\n\n\tspin_lock_irq(&current->sighand->siglock);\n\tcurrent->saved_sigmask = current->blocked;\n\tcurrent->blocked = newset;\n\trecalc_sigpending();\n\tspin_unlock_irq(&current->sighand->siglock);\n\n\tcurrent->state = TASK_INTERRUPTIBLE;\n\tschedule();\n\tset_thread_flag(TIF_RESTORE_SIGMASK);\n\treturn -ERESTARTNOHAND;\n}\n#endif /* __ARCH_WANT_SYS_RT_SIGSUSPEND */\n\n__attribute__((weak)) const char *arch_vma_name(struct vm_area_struct *vma)\n{\n\treturn NULL;\n}\n\nvoid __init signals_init(void)\n{\n\tsigqueue_cachep = KMEM_CACHE(sigqueue, SLAB_PANIC);\n}\n\n#ifdef CONFIG_KDB\n#include <linux/kdb.h>\n/*\n * kdb_send_sig_info\n *\n *\tAllows kdb to send signals without exposing signal internals.\n *\n * Inputs:\n *\tt\ttask\n *\tsiginfo\tsignal information\n *\tseqno\tcurrent kdb sequence number (avoid including kdbprivate.h)\n * Outputs:\n *\tNone.\n * Returns:\n *\tNone.\n * Locking:\n *\tChecks if the required locks are available before calling the main\n *\tsignal code, to avoid kdb deadlocks.\n * Remarks:\n */\nvoid\nkdb_send_sig_info(struct task_struct *t, struct siginfo *info, int seqno)\n{\n\tstatic struct task_struct *kdb_prev_t;\n\tstatic int kdb_prev_seqno;\n\tint sig, new_t;\n\tif (!spin_trylock(&t->sighand->siglock)) {\n\t\tkdb_printf(\"Can't do kill command now.\\n\"\n\t\t\t\"The sigmask lock is held somewhere else in kernel, try again later\\n\");\n\t\treturn;\n\t}\n\tspin_unlock(&t->sighand->siglock);\n\tnew_t = kdb_prev_t != t || kdb_prev_seqno != seqno;\n\tkdb_prev_t = t;\n\tkdb_prev_seqno = seqno;\n\tif (t->state != TASK_RUNNING && new_t) {\n\t\tkdb_printf(\"Process is not RUNNING, sending a signal from kdb risks deadlock\\n\"\n\t\t\t \"on the run queue locks. The signal has _not_ been sent.\\n\"\n\t\t\t \"Reissue the kill command if you want to risk the deadlock.\\n\");\n\t\treturn;\n\t}\n\tsig = info->si_signo;\n\tif (send_sig_info(sig, info, t))\n\t\tkdb_printf(\"Fail to deliver Signal %d to process %d.\\n\", sig, t->pid);\n\telse\n\t\tkdb_printf(\"Signal %d is sent to process %d.\\n\", sig, t->pid);\n}\n#endif\t/* CONFIG_KDB */\n/*\n *\tlinux/kernel/softirq.c\n *\n *\tCopyright (C) 1992 Linus Torvalds\n *\n * Rewritten. Old one was good in 2.2, but in 2.3 it was immoral. --ANK (990903)\n */\n\n#include <linux/module.h>\n#include <linux/kernel_stat.h>\n#include <linux/interrupt.h>\n#include <linux/init.h>\n#include <linux/mm.h>\n#include <linux/notifier.h>\n#include <linux/percpu.h>\n#include <linux/cpu.h>\n#include <linux/kthread.h>\n#include <linux/rcupdate.h>\n#include <linux/smp.h>\n#include <linux/tick.h>\n\n#include <asm/irq.h>\n/*\n - No shared variables, all the data are CPU local.\n - If a softirq needs serialization, let it serialize itself\n by its own spinlocks.\n - Even if softirq is serialized, only local cpu is marked for\n execution. Hence, we get something sort of weak cpu binding.\n Though it is still not clear, will it result in better locality\n or will not.\n\n Examples:\n - NET RX softirq. It is multithreaded and does not require\n any global serialization.\n - NET TX softirq. It kicks software netdevice queues, hence\n it is logically serialized per device, but this serialization\n is invisible to common code.\n - Tasklets: serialized wrt itself.\n */\n\n#ifndef __ARCH_IRQ_STAT\nirq_cpustat_t irq_stat[NR_CPUS] ____cacheline_aligned;\nEXPORT_SYMBOL(irq_stat);\n#endif\n\nstatic struct softirq_action softirq_vec[32] __cacheline_aligned_in_smp;\n\nstatic DEFINE_PER_CPU(struct task_struct *, ksoftirqd);\n\n/*\n * we cannot loop indefinitely here to avoid userspace starvation,\n * but we also don't want to introduce a worst case 1/HZ latency\n * to the pending events, so lets the scheduler to balance\n * the softirq load for us.\n */\nstatic inline void wakeup_softirqd(void)\n{\n\t/* Interrupts are disabled: no need to stop preemption */\n\tstruct task_struct *tsk = __get_cpu_var(ksoftirqd);\n\n\tif (tsk && tsk->state != TASK_RUNNING)\n\t\twake_up_process(tsk);\n}\n\n/*\n * This one is for softirq.c-internal use,\n * where hardirqs are disabled legitimately:\n */\n#ifdef CONFIG_TRACE_IRQFLAGS\nstatic void __local_bh_disable(unsigned long ip)\n{\n\tunsigned long flags;\n\n\tWARN_ON_ONCE(in_irq());\n\n\traw_local_irq_save(flags);\n\tadd_preempt_count(SOFTIRQ_OFFSET);\n\t/*\n\t * Were softirqs turned off above:\n\t */\n\tif (softirq_count() == SOFTIRQ_OFFSET)\n\t\ttrace_softirqs_off(ip);\n\traw_local_irq_restore(flags);\n}\n#else /* !CONFIG_TRACE_IRQFLAGS */\nstatic inline void __local_bh_disable(unsigned long ip)\n{\n\tadd_preempt_count(SOFTIRQ_OFFSET);\n\tbarrier();\n}\n#endif /* CONFIG_TRACE_IRQFLAGS */\n\nvoid local_bh_disable(void)\n{\n\t__local_bh_disable((unsigned long)__builtin_return_address(0));\n}\n\nEXPORT_SYMBOL(local_bh_disable);\n\nvoid __local_bh_enable(void)\n{\n\tWARN_ON_ONCE(in_irq());\n\n\t/*\n\t * softirqs should never be enabled by __local_bh_enable(),\n\t * it always nests inside local_bh_enable() sections:\n\t */\n\tWARN_ON_ONCE(softirq_count() == SOFTIRQ_OFFSET);\n\n\tsub_preempt_count(SOFTIRQ_OFFSET);\n}\nEXPORT_SYMBOL_GPL(__local_bh_enable);\n\n/*\n * Special-case - softirqs can safely be enabled in\n * cond_resched_softirq(), or by __do_softirq(),\n * without processing still-pending softirqs:\n */\nvoid _local_bh_enable(void)\n{\n\tWARN_ON_ONCE(in_irq());\n\tWARN_ON_ONCE(!irqs_disabled());\n\n\tif (softirq_count() == SOFTIRQ_OFFSET)\n\t\ttrace_softirqs_on((unsigned long)__builtin_return_address(0));\n\tsub_preempt_count(SOFTIRQ_OFFSET);\n}\n\nEXPORT_SYMBOL(_local_bh_enable);\n\nvoid local_bh_enable(void)\n{\n#ifdef CONFIG_TRACE_IRQFLAGS\n\tunsigned long flags;\n\n\tWARN_ON_ONCE(in_irq());\n#endif\n\tWARN_ON_ONCE(irqs_disabled());\n\n#ifdef CONFIG_TRACE_IRQFLAGS\n\tlocal_irq_save(flags);\n#endif\n\t/*\n\t * Are softirqs going to be turned on now:\n\t */\n\tif (softirq_count() == SOFTIRQ_OFFSET)\n\t\ttrace_softirqs_on((unsigned long)__builtin_return_address(0));\n\t/*\n\t * Keep preemption disabled until we are done with\n\t * softirq processing:\n \t */\n \tsub_preempt_count(SOFTIRQ_OFFSET - 1);\n\n\tif (unlikely(!in_interrupt() && local_softirq_pending()))\n\t\tdo_softirq();\n\n\tdec_preempt_count();\n#ifdef CONFIG_TRACE_IRQFLAGS\n\tlocal_irq_restore(flags);\n#endif\n\tpreempt_check_resched();\n}\nEXPORT_SYMBOL(local_bh_enable);\n\nvoid local_bh_enable_ip(unsigned long ip)\n{\n#ifdef CONFIG_TRACE_IRQFLAGS\n\tunsigned long flags;\n\n\tWARN_ON_ONCE(in_irq());\n\n\tlocal_irq_save(flags);\n#endif\n\t/*\n\t * Are softirqs going to be turned on now:\n\t */\n\tif (softirq_count() == SOFTIRQ_OFFSET)\n\t\ttrace_softirqs_on(ip);\n\t/*\n\t * Keep preemption disabled until we are done with\n\t * softirq processing:\n \t */\n \tsub_preempt_count(SOFTIRQ_OFFSET - 1);\n\n\tif (unlikely(!in_interrupt() && local_softirq_pending()))\n\t\tdo_softirq();\n\n\tdec_preempt_count();\n#ifdef CONFIG_TRACE_IRQFLAGS\n\tlocal_irq_restore(flags);\n#endif\n\tpreempt_check_resched();\n}\nEXPORT_SYMBOL(local_bh_enable_ip);\n\n/*\n * We restart softirq processing MAX_SOFTIRQ_RESTART times,\n * and we fall back to softirqd after that.\n *\n * This number has been established via experimentation.\n * The two things to balance is latency against fairness -\n * we want to handle softirqs as soon as possible, but they\n * should not be able to lock up the box.\n */\n#define MAX_SOFTIRQ_RESTART 10\n\nasmlinkage void __do_softirq(void)\n{\n\tstruct softirq_action *h;\n\t__u32 pending;\n\tint max_restart = MAX_SOFTIRQ_RESTART;\n\tint cpu;\n\n\tpending = local_softirq_pending();\n\taccount_system_vtime(current);\n\n\t__local_bh_disable((unsigned long)__builtin_return_address(0));\n\ttrace_softirq_enter();\n\n\tcpu = smp_processor_id();\nrestart:\n\t/* Reset the pending bitmask before enabling irqs */\n\tset_softirq_pending(0);\n\n\tlocal_irq_enable();\n\n\th = softirq_vec;\n\n\tdo {\n\t\tif (pending & 1) {\n\t\t\th->action(h);\n\t\t\trcu_bh_qsctr_inc(cpu);\n\t\t}\n\t\th++;\n\t\tpending >>= 1;\n\t} while (pending);\n\n\tlocal_irq_disable();\n\n\tpending = local_softirq_pending();\n\tif (pending && --max_restart)\n\t\tgoto restart;\n\n\tif (pending)\n\t\twakeup_softirqd();\n\n\ttrace_softirq_exit();\n\n\taccount_system_vtime(current);\n\t_local_bh_enable();\n}\n\n#ifndef __ARCH_HAS_DO_SOFTIRQ\n\nasmlinkage void do_softirq(void)\n{\n\t__u32 pending;\n\tunsigned long flags;\n\n\tif (in_interrupt())\n\t\treturn;\n\n\tlocal_irq_save(flags);\n\n\tpending = local_softirq_pending();\n\n\tif (pending)\n\t\t__do_softirq();\n\n\tlocal_irq_restore(flags);\n}\n\nEXPORT_SYMBOL(do_softirq);\n\n#endif\n\n/*\n * Enter an interrupt context.\n */\nvoid irq_enter(void)\n{\n\t__irq_enter();\n#ifdef CONFIG_NO_HZ\n\tif (idle_cpu(smp_processor_id()))\n\t\ttick_nohz_update_jiffies();\n#endif\n}\n\n#ifdef __ARCH_IRQ_EXIT_IRQS_DISABLED\n# define invoke_softirq()\t__do_softirq()\n#else\n# define invoke_softirq()\tdo_softirq()\n#endif\n\n/*\n * Exit an interrupt context. Process softirqs if needed and possible:\n */\nvoid irq_exit(void)\n{\n\taccount_system_vtime(current);\n\ttrace_hardirq_exit();\n\tsub_preempt_count(IRQ_EXIT_OFFSET);\n\tif (!in_interrupt() && local_softirq_pending())\n\t\tinvoke_softirq();\n\n#ifdef CONFIG_NO_HZ\n\t/* Make sure that timer wheel updates are propagated */\n\tif (!in_interrupt() && idle_cpu(smp_processor_id()) && !need_resched())\n\t\ttick_nohz_stop_sched_tick();\n#endif\n\tpreempt_enable_no_resched();\n}\n\n/*\n * This function must run with irqs disabled!\n */\ninline fastcall void raise_softirq_irqoff(unsigned int nr)\n{\n\t__raise_softirq_irqoff(nr);\n\n\t/*\n\t * If we're in an interrupt or softirq, we're done\n\t * (this also catches softirq-disabled code). We will\n\t * actually run the softirq once we return from\n\t * the irq or softirq.\n\t *\n\t * Otherwise we wake up ksoftirqd to make sure we\n\t * schedule the softirq soon.\n\t */\n\tif (!in_interrupt())\n\t\twakeup_softirqd();\n}\n\nEXPORT_SYMBOL(raise_softirq_irqoff);\n\nvoid fastcall raise_softirq(unsigned int nr)\n{\n\tunsigned long flags;\n\n\tlocal_irq_save(flags);\n\traise_softirq_irqoff(nr);\n\tlocal_irq_restore(flags);\n}\n\nvoid open_softirq(int nr, void (*action)(struct softirq_action*), void *data)\n{\n\tsoftirq_vec[nr].data = data;\n\tsoftirq_vec[nr].action = action;\n}\n\n/* Tasklets */\nstruct tasklet_head\n{\n\tstruct tasklet_struct *list;\n};\n\n/* Some compilers disobey section attribute on statics when not\n initialized -- RR */\nstatic DEFINE_PER_CPU(struct tasklet_head, tasklet_vec) = { NULL };\nstatic DEFINE_PER_CPU(struct tasklet_head, tasklet_hi_vec) = { NULL };\n\nvoid fastcall __tasklet_schedule(struct tasklet_struct *t)\n{\n\tunsigned long flags;\n\n\tlocal_irq_save(flags);\n\tt->next = __get_cpu_var(tasklet_vec).list;\n\t__get_cpu_var(tasklet_vec).list = t;\n\traise_softirq_irqoff(TASKLET_SOFTIRQ);\n\tlocal_irq_restore(flags);\n}\n\nEXPORT_SYMBOL(__tasklet_schedule);\n\nvoid fastcall __tasklet_hi_schedule(struct tasklet_struct *t)\n{\n\tunsigned long flags;\n\n\tlocal_irq_save(flags);\n\tt->next = __get_cpu_var(tasklet_hi_vec).list;\n\t__get_cpu_var(tasklet_hi_vec).list = t;\n\traise_softirq_irqoff(HI_SOFTIRQ);\n\tlocal_irq_restore(flags);\n}\n\nEXPORT_SYMBOL(__tasklet_hi_schedule);\n\nstatic void tasklet_action(struct softirq_action *a)\n{\n\tstruct tasklet_struct *list;\n\n\tlocal_irq_disable();\n\tlist = __get_cpu_var(tasklet_vec).list;\n\t__get_cpu_var(tasklet_vec).list = NULL;\n\tlocal_irq_enable();\n\n\twhile (list) {\n\t\tstruct tasklet_struct *t = list;\n\n\t\tlist = list->next;\n\n\t\tif (tasklet_trylock(t)) {\n\t\t\tif (!atomic_read(&t->count)) {\n\t\t\t\tif (!test_and_clear_bit(TASKLET_STATE_SCHED, &t->state))\n\t\t\t\t\tBUG();\n\t\t\t\tt->func(t->data);\n\t\t\t\ttasklet_unlock(t);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\ttasklet_unlock(t);\n\t\t}\n\n\t\tlocal_irq_disable();\n\t\tt->next = __get_cpu_var(tasklet_vec).list;\n\t\t__get_cpu_var(tasklet_vec).list = t;\n\t\t__raise_softirq_irqoff(TASKLET_SOFTIRQ);\n\t\tlocal_irq_enable();\n\t}\n}\n\nstatic void tasklet_hi_action(struct softirq_action *a)\n{\n\tstruct tasklet_struct *list;\n\n\tlocal_irq_disable();\n\tlist = __get_cpu_var(tasklet_hi_vec).list;\n\t__get_cpu_var(tasklet_hi_vec).list = NULL;\n\tlocal_irq_enable();\n\n\twhile (list) {\n\t\tstruct tasklet_struct *t = list;\n\n\t\tlist = list->next;\n\n\t\tif (tasklet_trylock(t)) {\n\t\t\tif (!atomic_read(&t->count)) {\n\t\t\t\tif (!test_and_clear_bit(TASKLET_STATE_SCHED, &t->state))\n\t\t\t\t\tBUG();\n\t\t\t\tt->func(t->data);\n\t\t\t\ttasklet_unlock(t);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\ttasklet_unlock(t);\n\t\t}\n\n\t\tlocal_irq_disable();\n\t\tt->next = __get_cpu_var(tasklet_hi_vec).list;\n\t\t__get_cpu_var(tasklet_hi_vec).list = t;\n\t\t__raise_softirq_irqoff(HI_SOFTIRQ);\n\t\tlocal_irq_enable();\n\t}\n}\n\n\nvoid tasklet_init(struct tasklet_struct *t,\n\t\t void (*func)(unsigned long), unsigned long data)\n{\n\tt->next = NULL;\n\tt->state = 0;\n\tatomic_set(&t->count, 0);\n\tt->func = func;\n\tt->data = data;\n}\n\nEXPORT_SYMBOL(tasklet_init);\n\nvoid tasklet_kill(struct tasklet_struct *t)\n{\n\tif (in_interrupt())\n\t\tprintk(\"Attempt to kill tasklet from interrupt\\n\");\n\n\twhile (test_and_set_bit(TASKLET_STATE_SCHED, &t->state)) {\n\t\tdo\n\t\t\tyield();\n\t\twhile (test_bit(TASKLET_STATE_SCHED, &t->state));\n\t}\n\ttasklet_unlock_wait(t);\n\tclear_bit(TASKLET_STATE_SCHED, &t->state);\n}\n\nEXPORT_SYMBOL(tasklet_kill);\n\nvoid __init softirq_init(void)\n{\n\topen_softirq(TASKLET_SOFTIRQ, tasklet_action, NULL);\n\topen_softirq(HI_SOFTIRQ, tasklet_hi_action, NULL);\n}\n\nstatic int ksoftirqd(void * __bind_cpu)\n{\n\tset_user_nice(current, 19);\n\tcurrent->flags |= PF_NOFREEZE;\n\n\tset_current_state(TASK_INTERRUPTIBLE);\n\n\twhile (!kthread_should_stop()) {\n\t\tpreempt_disable();\n\t\tif (!local_softirq_pending()) {\n\t\t\tpreempt_enable_no_resched();\n\t\t\tschedule();\n\t\t\tpreempt_disable();\n\t\t}\n\n\t\t__set_current_state(TASK_RUNNING);\n\n\t\twhile (local_softirq_pending()) {\n\t\t\t/* Preempt disable stops cpu going offline.\n\t\t\t If already offline, we'll be on wrong CPU:\n\t\t\t don't process */\n\t\t\tif (cpu_is_offline((long)__bind_cpu))\n\t\t\t\tgoto wait_to_die;\n\t\t\tdo_softirq();\n\t\t\tpreempt_enable_no_resched();\n\t\t\tcond_resched();\n\t\t\tpreempt_disable();\n\t\t}\n\t\tpreempt_enable();\n\t\tset_current_state(TASK_INTERRUPTIBLE);\n\t}\n\t__set_current_state(TASK_RUNNING);\n\treturn 0;\n\nwait_to_die:\n\tpreempt_enable();\n\t/* Wait for kthread_stop */\n\tset_current_state(TASK_INTERRUPTIBLE);\n\twhile (!kthread_should_stop()) {\n\t\tschedule();\n\t\tset_current_state(TASK_INTERRUPTIBLE);\n\t}\n\t__set_current_state(TASK_RUNNING);\n\treturn 0;\n}\n\n#ifdef CONFIG_HOTPLUG_CPU\n/*\n * tasklet_kill_immediate is called to remove a tasklet which can already be\n * scheduled for execution on @cpu.\n *\n * Unlike tasklet_kill, this function removes the tasklet\n * _immediately_, even if the tasklet is in TASKLET_STATE_SCHED state.\n *\n * When this function is called, @cpu must be in the CPU_DEAD state.\n */\nvoid tasklet_kill_immediate(struct tasklet_struct *t, unsigned int cpu)\n{\n\tstruct tasklet_struct **i;\n\n\tBUG_ON(cpu_online(cpu));\n\tBUG_ON(test_bit(TASKLET_STATE_RUN, &t->state));\n\n\tif (!test_bit(TASKLET_STATE_SCHED, &t->state))\n\t\treturn;\n\n\t/* CPU is dead, so no lock needed. */\n\tfor (i = &per_cpu(tasklet_vec, cpu).list; *i; i = &(*i)->next) {\n\t\tif (*i == t) {\n\t\t\t*i = t->next;\n\t\t\treturn;\n\t\t}\n\t}\n\tBUG();\n}\n\nstatic void takeover_tasklets(unsigned int cpu)\n{\n\tstruct tasklet_struct **i;\n\n\t/* CPU is dead, so no lock needed. */\n\tlocal_irq_disable();\n\n\t/* Find end, append list for that CPU. */\n\tfor (i = &__get_cpu_var(tasklet_vec).list; *i; i = &(*i)->next);\n\t*i = per_cpu(tasklet_vec, cpu).list;\n\tper_cpu(tasklet_vec, cpu).list = NULL;\n\traise_softirq_irqoff(TASKLET_SOFTIRQ);\n\n\tfor (i = &__get_cpu_var(tasklet_hi_vec).list; *i; i = &(*i)->next);\n\t*i = per_cpu(tasklet_hi_vec, cpu).list;\n\tper_cpu(tasklet_hi_vec, cpu).list = NULL;\n\traise_softirq_irqoff(HI_SOFTIRQ);\n\n\tlocal_irq_enable();\n}\n#endif /* CONFIG_HOTPLUG_CPU */\n\nstatic int __cpuinit cpu_callback(struct notifier_block *nfb,\n\t\t\t\t unsigned long action,\n\t\t\t\t void *hcpu)\n{\n\tint hotcpu = (unsigned long)hcpu;\n\tstruct task_struct *p;\n\n\tswitch (action) {\n\tcase CPU_UP_PREPARE:\n\tcase CPU_UP_PREPARE_FROZEN:\n\t\tp = kthread_create(ksoftirqd, hcpu, \"ksoftirqd/%d\", hotcpu);\n\t\tif (IS_ERR(p)) {\n\t\t\tprintk(\"ksoftirqd for %i failed\\n\", hotcpu);\n\t\t\treturn NOTIFY_BAD;\n\t\t}\n\t\tkthread_bind(p, hotcpu);\n \t\tper_cpu(ksoftirqd, hotcpu) = p;\n \t\tbreak;\n\tcase CPU_ONLINE:\n\tcase CPU_ONLINE_FROZEN:\n\t\twake_up_process(per_cpu(ksoftirqd, hotcpu));\n\t\tbreak;\n#ifdef CONFIG_HOTPLUG_CPU\n\tcase CPU_UP_CANCELED:\n\tcase CPU_UP_CANCELED_FROZEN:\n\t\tif (!per_cpu(ksoftirqd, hotcpu))\n\t\t\tbreak;\n\t\t/* Unbind so it can run. Fall thru. */\n\t\tkthread_bind(per_cpu(ksoftirqd, hotcpu),\n\t\t\t any_online_cpu(cpu_online_map));\n\tcase CPU_DEAD:\n\tcase CPU_DEAD_FROZEN:\n\t\tp = per_cpu(ksoftirqd, hotcpu);\n\t\tper_cpu(ksoftirqd, hotcpu) = NULL;\n\t\tkthread_stop(p);\n\t\ttakeover_tasklets(hotcpu);\n\t\tbreak;\n#endif /* CONFIG_HOTPLUG_CPU */\n \t}\n\treturn NOTIFY_OK;\n}\n\nstatic struct notifier_block __cpuinitdata cpu_nfb = {\n\t.notifier_call = cpu_callback\n};\n\n__init int spawn_ksoftirqd(void)\n{\n\tvoid *cpu = (void *)(long)smp_processor_id();\n\tint err = cpu_callback(&cpu_nfb, CPU_UP_PREPARE, cpu);\n\n\tBUG_ON(err == NOTIFY_BAD);\n\tcpu_callback(&cpu_nfb, CPU_ONLINE, cpu);\n\tregister_cpu_notifier(&cpu_nfb);\n\treturn 0;\n}\n\n#ifdef CONFIG_SMP\n/*\n * Call a function on all processors\n */\nint on_each_cpu(void (*func) (void *info), void *info, int retry, int wait)\n{\n\tint ret = 0;\n\n\tpreempt_disable();\n\tret = smp_call_function(func, info, retry, wait);\n\tlocal_irq_disable();\n\tfunc(info);\n\tlocal_irq_enable();\n\tpreempt_enable();\n\treturn ret;\n}\nEXPORT_SYMBOL(on_each_cpu);\n#endif\n/*\n * Detect Soft Lockups\n *\n * started by Ingo Molnar, Copyright (C) 2005, 2006 Red Hat, Inc.\n *\n * this code detects soft lockups: incidents in where on a CPU\n * the kernel does not reschedule for 10 seconds or more.\n */\n#include <linux/mm.h>\n#include <linux/cpu.h>\n#include <linux/init.h>\n#include <linux/delay.h>\n#include <linux/kthread.h>\n#include <linux/notifier.h>\n#include <linux/module.h>\n\nstatic DEFINE_SPINLOCK(print_lock);\n\nstatic DEFINE_PER_CPU(unsigned long, touch_timestamp);\nstatic DEFINE_PER_CPU(unsigned long, print_timestamp);\nstatic DEFINE_PER_CPU(struct task_struct *, watchdog_task);\n\nstatic int did_panic = 0;\n\nstatic int\nsoftlock_panic(struct notifier_block *this, unsigned long event, void *ptr)\n{\n\tdid_panic = 1;\n\n\treturn NOTIFY_DONE;\n}\n\nstatic struct notifier_block panic_block = {\n\t.notifier_call = softlock_panic,\n};\n\n/*\n * Returns seconds, approximately. We don't need nanosecond\n * resolution, and we don't need to waste time with a big divide when\n * 2^30ns == 1.074s.\n */\nstatic unsigned long get_timestamp(void)\n{\n\treturn sched_clock() >> 30; /* 2^30 ~= 10^9 */\n}\n\nvoid touch_softlockup_watchdog(void)\n{\n\t__raw_get_cpu_var(touch_timestamp) = get_timestamp();\n}\nEXPORT_SYMBOL(touch_softlockup_watchdog);\n\nvoid touch_all_softlockup_watchdogs(void)\n{\n\tint cpu;\n\n\t/* Cause each CPU to re-update its timestamp rather than complain */\n\tfor_each_online_cpu(cpu)\n\t\tper_cpu(touch_timestamp, cpu) = 0;\n}\nEXPORT_SYMBOL(touch_all_softlockup_watchdogs);\n\nunsigned long softlockup_get_next_event(void)\n{\n\tint this_cpu = smp_processor_id();\n\tunsigned long touch_timestamp = per_cpu(touch_timestamp, this_cpu);\n\n\tif (per_cpu(print_timestamp, this_cpu) == touch_timestamp ||\n\t\tdid_panic ||\n\t\t\t!per_cpu(watchdog_task, this_cpu))\n\t\treturn MAX_JIFFY_OFFSET;\n\n\treturn max_t(long, 0, touch_timestamp + HZ - jiffies);\n}\n\n/*\n * This callback runs from the timer interrupt, and checks\n * whether the watchdog thread has hung or not:\n */\nvoid softlockup_tick(void)\n{\n\tint this_cpu = smp_processor_id();\n\tunsigned long touch_timestamp = per_cpu(touch_timestamp, this_cpu);\n\tunsigned long print_timestamp;\n\tunsigned long now;\n\n\tif (touch_timestamp == 0) {\n\t\ttouch_softlockup_watchdog();\n\t\treturn;\n\t}\n\n\tprint_timestamp = per_cpu(print_timestamp, this_cpu);\n\n\t/* report at most once a second */\n\tif (print_timestamp < (touch_timestamp + 1) ||\n\t\tdid_panic ||\n\t\t\t!per_cpu(watchdog_task, this_cpu))\n\t\treturn;\n\n\t/* do not print during early bootup: */\n\tif (unlikely(system_state != SYSTEM_RUNNING)) {\n\t\ttouch_softlockup_watchdog();\n\t\treturn;\n\t}\n\n\tnow = get_timestamp();\n\n\t/* Wake up the high-prio watchdog task every second: */\n\tif (now > (touch_timestamp + 1))\n\t\twake_up_process(per_cpu(watchdog_task, this_cpu));\n\n\t/* Warn about unreasonable 10+ seconds delays: */\n\tif (now > (touch_timestamp + 10)) {\n\t\tper_cpu(print_timestamp, this_cpu) = touch_timestamp;\n\n\t\tspin_lock(&print_lock);\n\t\tprintk(KERN_ERR \"BUG: soft lockup detected on CPU#%d!\\n\",\n\t\t\tthis_cpu);\n\t\tdump_stack();\n\t\tspin_unlock(&print_lock);\n\t}\n}\n\n/*\n * The watchdog thread - runs every second and touches the timestamp.\n */\nstatic int watchdog(void * __bind_cpu)\n{\n\tstruct sched_param param = { .sched_priority = MAX_RT_PRIO-1 };\n\n\tsched_setscheduler(current, SCHED_FIFO, &param);\n\tcurrent->flags |= PF_NOFREEZE;\n\n\t/* initialize timestamp */\n\ttouch_softlockup_watchdog();\n\n\t/*\n\t * Run briefly once per second to reset the softlockup timestamp.\n\t * If this gets delayed for more than 10 seconds then the\n\t * debug-printout triggers in softlockup_tick().\n\t */\n\twhile (!kthread_should_stop()) {\n\t\tset_current_state(TASK_INTERRUPTIBLE);\n\t\ttouch_softlockup_watchdog();\n\t\tschedule();\n\t}\n\n\treturn 0;\n}\n\n/*\n * Create/destroy watchdog threads as CPUs come and go:\n */\nstatic int __cpuinit\ncpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)\n{\n\tint hotcpu = (unsigned long)hcpu;\n\tstruct task_struct *p;\n\n\tswitch (action) {\n\tcase CPU_UP_PREPARE:\n\tcase CPU_UP_PREPARE_FROZEN:\n\t\tBUG_ON(per_cpu(watchdog_task, hotcpu));\n\t\tp = kthread_create(watchdog, hcpu, \"watchdog/%d\", hotcpu);\n\t\tif (IS_ERR(p)) {\n\t\t\tprintk(\"watchdog for %i failed\\n\", hotcpu);\n\t\t\treturn NOTIFY_BAD;\n\t\t}\n \t\tper_cpu(touch_timestamp, hotcpu) = 0;\n \t\tper_cpu(watchdog_task, hotcpu) = p;\n\t\tkthread_bind(p, hotcpu);\n \t\tbreak;\n\tcase CPU_ONLINE:\n\tcase CPU_ONLINE_FROZEN:\n\t\twake_up_process(per_cpu(watchdog_task, hotcpu));\n\t\tbreak;\n#ifdef CONFIG_HOTPLUG_CPU\n\tcase CPU_UP_CANCELED:\n\tcase CPU_UP_CANCELED_FROZEN:\n\t\tif (!per_cpu(watchdog_task, hotcpu))\n\t\t\tbreak;\n\t\t/* Unbind so it can run. Fall thru. */\n\t\tkthread_bind(per_cpu(watchdog_task, hotcpu),\n\t\t\t any_online_cpu(cpu_online_map));\n\tcase CPU_DEAD:\n\tcase CPU_DEAD_FROZEN:\n\t\tp = per_cpu(watchdog_task, hotcpu);\n\t\tper_cpu(watchdog_task, hotcpu) = NULL;\n\t\tkthread_stop(p);\n\t\tbreak;\n#endif /* CONFIG_HOTPLUG_CPU */\n \t}\n\treturn NOTIFY_OK;\n}\n\nstatic struct notifier_block __cpuinitdata cpu_nfb = {\n\t.notifier_call = cpu_callback\n};\n\n__init void spawn_softlockup_task(void)\n{\n\tvoid *cpu = (void *)(long)smp_processor_id();\n\tint err = cpu_callback(&cpu_nfb, CPU_UP_PREPARE, cpu);\n\n\tBUG_ON(err == NOTIFY_BAD);\n\tcpu_callback(&cpu_nfb, CPU_ONLINE, cpu);\n\tregister_cpu_notifier(&cpu_nfb);\n\n\tatomic_notifier_chain_register(&panic_notifier_list, &panic_block);\n}\n/*\n * Copyright (2004) Linus Torvalds\n *\n * Author: Zwane Mwaikambo <zwane@fsmlabs.com>\n *\n * Copyright (2004, 2005) Ingo Molnar\n *\n * This file contains the spinlock/rwlock implementations for the\n * SMP and the DEBUG_SPINLOCK cases. (UP-nondebug inlines them)\n *\n * Note that some architectures have special knowledge about the\n * stack frames of these functions in their profile_pc. If you\n * change anything significant here that could change the stack\n * frame contact the architecture maintainers.\n */\n\n#include <linux/linkage.h>\n#include <linux/preempt.h>\n#include <linux/spinlock.h>\n#include <linux/interrupt.h>\n#include <linux/debug_locks.h>\n#include <linux/module.h>\n\nint __lockfunc _spin_trylock(spinlock_t *lock)\n{\n\tpreempt_disable();\n\tif (_raw_spin_trylock(lock)) {\n\t\tspin_acquire(&lock->dep_map, 0, 1, _RET_IP_);\n\t\treturn 1;\n\t}\n\t\n\tpreempt_enable();\n\treturn 0;\n}\nEXPORT_SYMBOL(_spin_trylock);\n\nint __lockfunc _read_trylock(rwlock_t *lock)\n{\n\tpreempt_disable();\n\tif (_raw_read_trylock(lock)) {\n\t\trwlock_acquire_read(&lock->dep_map, 0, 1, _RET_IP_);\n\t\treturn 1;\n\t}\n\n\tpreempt_enable();\n\treturn 0;\n}\nEXPORT_SYMBOL(_read_trylock);\n\nint __lockfunc _write_trylock(rwlock_t *lock)\n{\n\tpreempt_disable();\n\tif (_raw_write_trylock(lock)) {\n\t\trwlock_acquire(&lock->dep_map, 0, 1, _RET_IP_);\n\t\treturn 1;\n\t}\n\n\tpreempt_enable();\n\treturn 0;\n}\nEXPORT_SYMBOL(_write_trylock);\n\n/*\n * If lockdep is enabled then we use the non-preemption spin-ops\n * even on CONFIG_PREEMPT, because lockdep assumes that interrupts are\n * not re-enabled during lock-acquire (which the preempt-spin-ops do):\n */\n#if !defined(CONFIG_PREEMPT) || !defined(CONFIG_SMP) || \\\n\tdefined(CONFIG_DEBUG_LOCK_ALLOC)\n\nvoid __lockfunc _read_lock(rwlock_t *lock)\n{\n\tpreempt_disable();\n\trwlock_acquire_read(&lock->dep_map, 0, 0, _RET_IP_);\n\t_raw_read_lock(lock);\n}\nEXPORT_SYMBOL(_read_lock);\n\nunsigned long __lockfunc _spin_lock_irqsave(spinlock_t *lock)\n{\n\tunsigned long flags;\n\n\tlocal_irq_save(flags);\n\tpreempt_disable();\n\tspin_acquire(&lock->dep_map, 0, 0, _RET_IP_);\n\t/*\n\t * On lockdep we dont want the hand-coded irq-enable of\n\t * _raw_spin_lock_flags() code, because lockdep assumes\n\t * that interrupts are not re-enabled during lock-acquire:\n\t */\n#ifdef CONFIG_PROVE_LOCKING\n\t_raw_spin_lock(lock);\n#else\n\t_raw_spin_lock_flags(lock, &flags);\n#endif\n\treturn flags;\n}\nEXPORT_SYMBOL(_spin_lock_irqsave);\n\nvoid __lockfunc _spin_lock_irq(spinlock_t *lock)\n{\n\tlocal_irq_disable();\n\tpreempt_disable();\n\tspin_acquire(&lock->dep_map, 0, 0, _RET_IP_);\n\t_raw_spin_lock(lock);\n}\nEXPORT_SYMBOL(_spin_lock_irq);\n\nvoid __lockfunc _spin_lock_bh(spinlock_t *lock)\n{\n\tlocal_bh_disable();\n\tpreempt_disable();\n\tspin_acquire(&lock->dep_map, 0, 0, _RET_IP_);\n\t_raw_spin_lock(lock);\n}\nEXPORT_SYMBOL(_spin_lock_bh);\n\nunsigned long __lockfunc _read_lock_irqsave(rwlock_t *lock)\n{\n\tunsigned long flags;\n\n\tlocal_irq_save(flags);\n\tpreempt_disable();\n\trwlock_acquire_read(&lock->dep_map, 0, 0, _RET_IP_);\n\t_raw_read_lock(lock);\n\treturn flags;\n}\nEXPORT_SYMBOL(_read_lock_irqsave);\n\nvoid __lockfunc _read_lock_irq(rwlock_t *lock)\n{\n\tlocal_irq_disable();\n\tpreempt_disable();\n\trwlock_acquire_read(&lock->dep_map, 0, 0, _RET_IP_);\n\t_raw_read_lock(lock);\n}\nEXPORT_SYMBOL(_read_lock_irq);\n\nvoid __lockfunc _read_lock_bh(rwlock_t *lock)\n{\n\tlocal_bh_disable();\n\tpreempt_disable();\n\trwlock_acquire_read(&lock->dep_map, 0, 0, _RET_IP_);\n\t_raw_read_lock(lock);\n}\nEXPORT_SYMBOL(_read_lock_bh);\n\nunsigned long __lockfunc _write_lock_irqsave(rwlock_t *lock)\n{\n\tunsigned long flags;\n\n\tlocal_irq_save(flags);\n\tpreempt_disable();\n\trwlock_acquire(&lock->dep_map, 0, 0, _RET_IP_);\n\t_raw_write_lock(lock);\n\treturn flags;\n}\nEXPORT_SYMBOL(_write_lock_irqsave);\n\nvoid __lockfunc _write_lock_irq(rwlock_t *lock)\n{\n\tlocal_irq_disable();\n\tpreempt_disable();\n\trwlock_acquire(&lock->dep_map, 0, 0, _RET_IP_);\n\t_raw_write_lock(lock);\n}\nEXPORT_SYMBOL(_write_lock_irq);\n\nvoid __lockfunc _write_lock_bh(rwlock_t *lock)\n{\n\tlocal_bh_disable();\n\tpreempt_disable();\n\trwlock_acquire(&lock->dep_map, 0, 0, _RET_IP_);\n\t_raw_write_lock(lock);\n}\nEXPORT_SYMBOL(_write_lock_bh);\n\nvoid __lockfunc _spin_lock(spinlock_t *lock)\n{\n\tpreempt_disable();\n\tspin_acquire(&lock->dep_map, 0, 0, _RET_IP_);\n\t_raw_spin_lock(lock);\n}\n\nEXPORT_SYMBOL(_spin_lock);\n\nvoid __lockfunc _write_lock(rwlock_t *lock)\n{\n\tpreempt_disable();\n\trwlock_acquire(&lock->dep_map, 0, 0, _RET_IP_);\n\t_raw_write_lock(lock);\n}\n\nEXPORT_SYMBOL(_write_lock);\n\n#else /* CONFIG_PREEMPT: */\n\n/*\n * This could be a long-held lock. We both prepare to spin for a long\n * time (making _this_ CPU preemptable if possible), and we also signal\n * towards that other CPU that it should break the lock ASAP.\n *\n * (We do this in a function because inlining it would be excessive.)\n */\n\n#define BUILD_LOCK_OPS(op, locktype)\t\t\t\t\t\\\nvoid __lockfunc _##op##_lock(locktype##_t *lock)\t\t\t\\\n{\t\t\t\t\t\t\t\t\t\\\n\tfor (;;) {\t\t\t\t\t\t\t\\\n\t\tpreempt_disable();\t\t\t\t\t\\\n\t\tif (likely(_raw_##op##_trylock(lock)))\t\t\t\\\n\t\t\tbreak;\t\t\t\t\t\t\\\n\t\tpreempt_enable();\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n\t\tif (!(lock)->break_lock)\t\t\t\t\\\n\t\t\t(lock)->break_lock = 1;\t\t\t\t\\\n\t\twhile (!op##_can_lock(lock) && (lock)->break_lock)\t\\\n\t\t\t_raw_##op##_relax(&lock->raw_lock);\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n\t(lock)->break_lock = 0;\t\t\t\t\t\t\\\n}\t\t\t\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\nEXPORT_SYMBOL(_##op##_lock);\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\nunsigned long __lockfunc _##op##_lock_irqsave(locktype##_t *lock)\t\\\n{\t\t\t\t\t\t\t\t\t\\\n\tunsigned long flags;\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n\tfor (;;) {\t\t\t\t\t\t\t\\\n\t\tpreempt_disable();\t\t\t\t\t\\\n\t\tlocal_irq_save(flags);\t\t\t\t\t\\\n\t\tif (likely(_raw_##op##_trylock(lock)))\t\t\t\\\n\t\t\tbreak;\t\t\t\t\t\t\\\n\t\tlocal_irq_restore(flags);\t\t\t\t\\\n\t\tpreempt_enable();\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n\t\tif (!(lock)->break_lock)\t\t\t\t\\\n\t\t\t(lock)->break_lock = 1;\t\t\t\t\\\n\t\twhile (!op##_can_lock(lock) && (lock)->break_lock)\t\\\n\t\t\t_raw_##op##_relax(&lock->raw_lock);\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n\t(lock)->break_lock = 0;\t\t\t\t\t\t\\\n\treturn flags;\t\t\t\t\t\t\t\\\n}\t\t\t\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\nEXPORT_SYMBOL(_##op##_lock_irqsave);\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\nvoid __lockfunc _##op##_lock_irq(locktype##_t *lock)\t\t\t\\\n{\t\t\t\t\t\t\t\t\t\\\n\t_##op##_lock_irqsave(lock);\t\t\t\t\t\\\n}\t\t\t\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\nEXPORT_SYMBOL(_##op##_lock_irq);\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\nvoid __lockfunc _##op##_lock_bh(locktype##_t *lock)\t\t\t\\\n{\t\t\t\t\t\t\t\t\t\\\n\tunsigned long flags;\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n\t/*\t\t\t\t\t\t\t*/\t\\\n\t/* Careful: we must exclude softirqs too, hence the\t*/\t\\\n\t/* irq-disabling. We use the generic preemption-aware\t*/\t\\\n\t/* function:\t\t\t\t\t\t*/\t\\\n\t/**/\t\t\t\t\t\t\t\t\\\n\tflags = _##op##_lock_irqsave(lock);\t\t\t\t\\\n\tlocal_bh_disable();\t\t\t\t\t\t\\\n\tlocal_irq_restore(flags);\t\t\t\t\t\\\n}\t\t\t\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\nEXPORT_SYMBOL(_##op##_lock_bh)\n\n/*\n * Build preemption-friendly versions of the following\n * lock-spinning functions:\n *\n * _[spin|read|write]_lock()\n * _[spin|read|write]_lock_irq()\n * _[spin|read|write]_lock_irqsave()\n * _[spin|read|write]_lock_bh()\n */\nBUILD_LOCK_OPS(spin, spinlock);\nBUILD_LOCK_OPS(read, rwlock);\nBUILD_LOCK_OPS(write, rwlock);\n\n#endif /* CONFIG_PREEMPT */\n\n#ifdef CONFIG_DEBUG_LOCK_ALLOC\n\nvoid __lockfunc _spin_lock_nested(spinlock_t *lock, int subclass)\n{\n\tpreempt_disable();\n\tspin_acquire(&lock->dep_map, subclass, 0, _RET_IP_);\n\t_raw_spin_lock(lock);\n}\n\nEXPORT_SYMBOL(_spin_lock_nested);\nunsigned long __lockfunc _spin_lock_irqsave_nested(spinlock_t *lock, int subclass)\n{\n\tunsigned long flags;\n\n\tlocal_irq_save(flags);\n\tpreempt_disable();\n\tspin_acquire(&lock->dep_map, subclass, 0, _RET_IP_);\n\t/*\n\t * On lockdep we dont want the hand-coded irq-enable of\n\t * _raw_spin_lock_flags() code, because lockdep assumes\n\t * that interrupts are not re-enabled during lock-acquire:\n\t */\n#ifdef CONFIG_PROVE_SPIN_LOCKING\n\t_raw_spin_lock(lock);\n#else\n\t_raw_spin_lock_flags(lock, &flags);\n#endif\n\treturn flags;\n}\n\nEXPORT_SYMBOL(_spin_lock_irqsave_nested);\n\n#endif\n\nvoid __lockfunc _spin_unlock(spinlock_t *lock)\n{\n\tspin_release(&lock->dep_map, 1, _RET_IP_);\n\t_raw_spin_unlock(lock);\n\tpreempt_enable();\n}\nEXPORT_SYMBOL(_spin_unlock);\n\nvoid __lockfunc _write_unlock(rwlock_t *lock)\n{\n\trwlock_release(&lock->dep_map, 1, _RET_IP_);\n\t_raw_write_unlock(lock);\n\tpreempt_enable();\n}\nEXPORT_SYMBOL(_write_unlock);\n\nvoid __lockfunc _read_unlock(rwlock_t *lock)\n{\n\trwlock_release(&lock->dep_map, 1, _RET_IP_);\n\t_raw_read_unlock(lock);\n\tpreempt_enable();\n}\nEXPORT_SYMBOL(_read_unlock);\n\nvoid __lockfunc _spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags)\n{\n\tspin_release(&lock->dep_map, 1, _RET_IP_);\n\t_raw_spin_unlock(lock);\n\tlocal_irq_restore(flags);\n\tpreempt_enable();\n}\nEXPORT_SYMBOL(_spin_unlock_irqrestore);\n\nvoid __lockfunc _spin_unlock_irq(spinlock_t *lock)\n{\n\tspin_release(&lock->dep_map, 1, _RET_IP_);\n\t_raw_spin_unlock(lock);\n\tlocal_irq_enable();\n\tpreempt_enable();\n}\nEXPORT_SYMBOL(_spin_unlock_irq);\n\nvoid __lockfunc _spin_unlock_bh(spinlock_t *lock)\n{\n\tspin_release(&lock->dep_map, 1, _RET_IP_);\n\t_raw_spin_unlock(lock);\n\tpreempt_enable_no_resched();\n\tlocal_bh_enable_ip((unsigned long)__builtin_return_address(0));\n}\nEXPORT_SYMBOL(_spin_unlock_bh);\n\nvoid __lockfunc _read_unlock_irqrestore(rwlock_t *lock, unsigned long flags)\n{\n\trwlock_release(&lock->dep_map, 1, _RET_IP_);\n\t_raw_read_unlock(lock);\n\tlocal_irq_restore(flags);\n\tpreempt_enable();\n}\nEXPORT_SYMBOL(_read_unlock_irqrestore);\n\nvoid __lockfunc _read_unlock_irq(rwlock_t *lock)\n{\n\trwlock_release(&lock->dep_map, 1, _RET_IP_);\n\t_raw_read_unlock(lock);\n\tlocal_irq_enable();\n\tpreempt_enable();\n}\nEXPORT_SYMBOL(_read_unlock_irq);\n\nvoid __lockfunc _read_unlock_bh(rwlock_t *lock)\n{\n\trwlock_release(&lock->dep_map, 1, _RET_IP_);\n\t_raw_read_unlock(lock);\n\tpreempt_enable_no_resched();\n\tlocal_bh_enable_ip((unsigned long)__builtin_return_address(0));\n}\nEXPORT_SYMBOL(_read_unlock_bh);\n\nvoid __lockfunc _write_unlock_irqrestore(rwlock_t *lock, unsigned long flags)\n{\n\trwlock_release(&lock->dep_map, 1, _RET_IP_);\n\t_raw_write_unlock(lock);\n\tlocal_irq_restore(flags);\n\tpreempt_enable();\n}\nEXPORT_SYMBOL(_write_unlock_irqrestore);\n\nvoid __lockfunc _write_unlock_irq(rwlock_t *lock)\n{\n\trwlock_release(&lock->dep_map, 1, _RET_IP_);\n\t_raw_write_unlock(lock);\n\tlocal_irq_enable();\n\tpreempt_enable();\n}\nEXPORT_SYMBOL(_write_unlock_irq);\n\nvoid __lockfunc _write_unlock_bh(rwlock_t *lock)\n{\n\trwlock_release(&lock->dep_map, 1, _RET_IP_);\n\t_raw_write_unlock(lock);\n\tpreempt_enable_no_resched();\n\tlocal_bh_enable_ip((unsigned long)__builtin_return_address(0));\n}\nEXPORT_SYMBOL(_write_unlock_bh);\n\nint __lockfunc _spin_trylock_bh(spinlock_t *lock)\n{\n\tlocal_bh_disable();\n\tpreempt_disable();\n\tif (_raw_spin_trylock(lock)) {\n\t\tspin_acquire(&lock->dep_map, 0, 1, _RET_IP_);\n\t\treturn 1;\n\t}\n\n\tpreempt_enable_no_resched();\n\tlocal_bh_enable_ip((unsigned long)__builtin_return_address(0));\n\treturn 0;\n}\nEXPORT_SYMBOL(_spin_trylock_bh);\n\nint in_lock_functions(unsigned long addr)\n{\n\t/* Linker adds these: start and end of __lockfunc functions */\n\textern char __lock_text_start[], __lock_text_end[];\n\n\treturn addr >= (unsigned long)__lock_text_start\n\t&& addr < (unsigned long)__lock_text_end;\n}\nEXPORT_SYMBOL(in_lock_functions);\n/*\n * Sleepable Read-Copy Update mechanism for mutual exclusion.\n *\n * This program is free software; you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation; either version 2 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program; if not, write to the Free Software\n * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n *\n * Copyright (C) IBM Corporation, 2006\n *\n * Author: Paul McKenney <paulmck@us.ibm.com>\n *\n * For detailed explanation of Read-Copy Update mechanism see -\n * \t\tDocumentation/RCU/ *.txt\n *\n */\n\n#include <linux/module.h>\n#include <linux/mutex.h>\n#include <linux/percpu.h>\n#include <linux/preempt.h>\n#include <linux/rcupdate.h>\n#include <linux/sched.h>\n#include <linux/slab.h>\n#include <linux/smp.h>\n#include <linux/srcu.h>\n\n/**\n * init_srcu_struct - initialize a sleep-RCU structure\n * @sp: structure to initialize.\n *\n * Must invoke this on a given srcu_struct before passing that srcu_struct\n * to any other function. Each srcu_struct represents a separate domain\n * of SRCU protection.\n */\nint init_srcu_struct(struct srcu_struct *sp)\n{\n\tsp->completed = 0;\n\tmutex_init(&sp->mutex);\n\tsp->per_cpu_ref = alloc_percpu(struct srcu_struct_array);\n\treturn (sp->per_cpu_ref ? 0 : -ENOMEM);\n}\n\n/*\n * srcu_readers_active_idx -- returns approximate number of readers\n *\tactive on the specified rank of per-CPU counters.\n */\n\nstatic int srcu_readers_active_idx(struct srcu_struct *sp, int idx)\n{\n\tint cpu;\n\tint sum;\n\n\tsum = 0;\n\tfor_each_possible_cpu(cpu)\n\t\tsum += per_cpu_ptr(sp->per_cpu_ref, cpu)->c[idx];\n\treturn sum;\n}\n\n/**\n * srcu_readers_active - returns approximate number of readers.\n * @sp: which srcu_struct to count active readers (holding srcu_read_lock).\n *\n * Note that this is not an atomic primitive, and can therefore suffer\n * severe errors when invoked on an active srcu_struct. That said, it\n * can be useful as an error check at cleanup time.\n */\nint srcu_readers_active(struct srcu_struct *sp)\n{\n\treturn srcu_readers_active_idx(sp, 0) + srcu_readers_active_idx(sp, 1);\n}\n\n/**\n * cleanup_srcu_struct - deconstruct a sleep-RCU structure\n * @sp: structure to clean up.\n *\n * Must invoke this after you are finished using a given srcu_struct that\n * was initialized via init_srcu_struct(), else you leak memory.\n */\nvoid cleanup_srcu_struct(struct srcu_struct *sp)\n{\n\tint sum;\n\n\tsum = srcu_readers_active(sp);\n\tWARN_ON(sum); /* Leakage unless caller handles error. */\n\tif (sum != 0)\n\t\treturn;\n\tfree_percpu(sp->per_cpu_ref);\n\tsp->per_cpu_ref = NULL;\n}\n\n/**\n * srcu_read_lock - register a new reader for an SRCU-protected structure.\n * @sp: srcu_struct in which to register the new reader.\n *\n * Counts the new reader in the appropriate per-CPU element of the\n * srcu_struct. Must be called from process context.\n * Returns an index that must be passed to the matching srcu_read_unlock().\n */\nint srcu_read_lock(struct srcu_struct *sp)\n{\n\tint idx;\n\n\tpreempt_disable();\n\tidx = sp->completed & 0x1;\n\tbarrier(); /* ensure compiler looks -once- at sp->completed. */\n\tper_cpu_ptr(sp->per_cpu_ref, smp_processor_id())->c[idx]++;\n\tsrcu_barrier(); /* ensure compiler won't misorder critical section. */\n\tpreempt_enable();\n\treturn idx;\n}\n\n/**\n * srcu_read_unlock - unregister a old reader from an SRCU-protected structure.\n * @sp: srcu_struct in which to unregister the old reader.\n * @idx: return value from corresponding srcu_read_lock().\n *\n * Removes the count for the old reader from the appropriate per-CPU\n * element of the srcu_struct. Note that this may well be a different\n * CPU than that which was incremented by the corresponding srcu_read_lock().\n * Must be called from process context.\n */\nvoid srcu_read_unlock(struct srcu_struct *sp, int idx)\n{\n\tpreempt_disable();\n\tsrcu_barrier(); /* ensure compiler won't misorder critical section. */\n\tper_cpu_ptr(sp->per_cpu_ref, smp_processor_id())->c[idx]--;\n\tpreempt_enable();\n}\n\n/**\n * synchronize_srcu - wait for prior SRCU read-side critical-section completion\n * @sp: srcu_struct with which to synchronize.\n *\n * Flip the completed counter, and wait for the old count to drain to zero.\n * As with classic RCU, the updater must use some separate means of\n * synchronizing concurrent updates. Can block; must be called from\n * process context.\n *\n * Note that it is illegal to call synchornize_srcu() from the corresponding\n * SRCU read-side critical section; doing so will result in deadlock.\n * However, it is perfectly legal to call synchronize_srcu() on one\n * srcu_struct from some other srcu_struct's read-side critical section.\n */\nvoid synchronize_srcu(struct srcu_struct *sp)\n{\n\tint idx;\n\n\tidx = sp->completed;\n\tmutex_lock(&sp->mutex);\n\n\t/*\n\t * Check to see if someone else did the work for us while we were\n\t * waiting to acquire the lock. We need -two- advances of\n\t * the counter, not just one. If there was but one, we might have\n\t * shown up -after- our helper's first synchronize_sched(), thus\n\t * having failed to prevent CPU-reordering races with concurrent\n\t * srcu_read_unlock()s on other CPUs (see comment below). So we\n\t * either (1) wait for two or (2) supply the second ourselves.\n\t */\n\n\tif ((sp->completed - idx) >= 2) {\n\t\tmutex_unlock(&sp->mutex);\n\t\treturn;\n\t}\n\n\tsynchronize_sched(); /* Force memory barrier on all CPUs. */\n\n\t/*\n\t * The preceding synchronize_sched() ensures that any CPU that\n\t * sees the new value of sp->completed will also see any preceding\n\t * changes to data structures made by this CPU. This prevents\n\t * some other CPU from reordering the accesses in its SRCU\n\t * read-side critical section to precede the corresponding\n\t * srcu_read_lock() -- ensuring that such references will in\n\t * fact be protected.\n\t *\n\t * So it is now safe to do the flip.\n\t */\n\n\tidx = sp->completed & 0x1;\n\tsp->completed++;\n\n\tsynchronize_sched(); /* Force memory barrier on all CPUs. */\n\n\t/*\n\t * At this point, because of the preceding synchronize_sched(),\n\t * all srcu_read_lock() calls using the old counters have completed.\n\t * Their corresponding critical sections might well be still\n\t * executing, but the srcu_read_lock() primitives themselves\n\t * will have finished executing.\n\t */\n\n\twhile (srcu_readers_active_idx(sp, idx))\n\t\tschedule_timeout_interruptible(1);\n\n\tsynchronize_sched(); /* Force memory barrier on all CPUs. */\n\n\t/*\n\t * The preceding synchronize_sched() forces all srcu_read_unlock()\n\t * primitives that were executing concurrently with the preceding\n\t * for_each_possible_cpu() loop to have completed by this point.\n\t * More importantly, it also forces the corresponding SRCU read-side\n\t * critical sections to have also completed, and the corresponding\n\t * references to SRCU-protected data items to be dropped.\n\t *\n\t * Note:\n\t *\n\t *\tDespite what you might think at first glance, the\n\t *\tpreceding synchronize_sched() -must- be within the\n\t *\tcritical section ended by the following mutex_unlock().\n\t *\tOtherwise, a task taking the early exit can race\n\t *\twith a srcu_read_unlock(), which might have executed\n\t *\tjust before the preceding srcu_readers_active() check,\n\t *\tand whose CPU might have reordered the srcu_read_unlock()\n\t *\twith the preceding critical section. In this case, there\n\t *\tis nothing preventing the synchronize_sched() task that is\n\t *\ttaking the early exit from freeing a data structure that\n\t *\tis still being referenced (out of order) by the task\n\t *\tdoing the srcu_read_unlock().\n\t *\n\t *\tAlternatively, the comparison with \"2\" on the early exit\n\t *\tcould be changed to \"3\", but this increases synchronize_srcu()\n\t *\tlatency for bulk loads. So the current code is preferred.\n\t */\n\n\tmutex_unlock(&sp->mutex);\n}\n\n/**\n * srcu_batches_completed - return batches completed.\n * @sp: srcu_struct on which to report batch completion.\n *\n * Report the number of batches, correlated with, but not necessarily\n * precisely the same as, the number of grace periods that have elapsed.\n */\n\nlong srcu_batches_completed(struct srcu_struct *sp)\n{\n\treturn sp->completed;\n}\n\nEXPORT_SYMBOL_GPL(init_srcu_struct);\nEXPORT_SYMBOL_GPL(cleanup_srcu_struct);\nEXPORT_SYMBOL_GPL(srcu_read_lock);\nEXPORT_SYMBOL_GPL(srcu_read_unlock);\nEXPORT_SYMBOL_GPL(synchronize_srcu);\nEXPORT_SYMBOL_GPL(srcu_batches_completed);\nEXPORT_SYMBOL_GPL(srcu_readers_active);\n/*\n * kernel/stacktrace.c\n *\n * Stack trace management functions\n *\n * Copyright (C) 2006 Red Hat, Inc., Ingo Molnar <mingo@redhat.com>\n */\n#include <linux/sched.h>\n#include <linux/kallsyms.h>\n#include <linux/stacktrace.h>\n\nvoid print_stack_trace(struct stack_trace *trace, int spaces)\n{\n\tint i, j;\n\n\tfor (i = 0; i < trace->nr_entries; i++) {\n\t\tunsigned long ip = trace->entries[i];\n\n\t\tfor (j = 0; j < spaces + 1; j++)\n\t\t\tprintk(\" \");\n\t\tprint_ip_sym(ip);\n\t}\n}\n\n/* Copyright 2005 Rusty Russell rusty@rustcorp.com.au IBM Corporation.\n * GPL v2 and any later version.\n */\n#include <linux/cpu.h>\n#include <linux/err.h>\n#include <linux/kthread.h>\n#include <linux/module.h>\n#include <linux/sched.h>\n#include <linux/stop_machine.h>\n#include <linux/syscalls.h>\n#include <linux/interrupt.h>\n\n#include <asm/atomic.h>\n#include <asm/semaphore.h>\n#include <asm/uaccess.h>\n\n/* Since we effect priority and affinity (both of which are visible\n * to, and settable by outside processes) we do indirection via a\n * kthread. */\n\n/* Thread to stop each CPU in user context. */\nenum stopmachine_state {\n\tSTOPMACHINE_WAIT,\n\tSTOPMACHINE_PREPARE,\n\tSTOPMACHINE_DISABLE_IRQ,\n\tSTOPMACHINE_EXIT,\n};\n\nstatic enum stopmachine_state stopmachine_state;\nstatic unsigned int stopmachine_num_threads;\nstatic atomic_t stopmachine_thread_ack;\nstatic DECLARE_MUTEX(stopmachine_mutex);\n\nstatic int stopmachine(void *cpu)\n{\n\tint irqs_disabled = 0;\n\tint prepared = 0;\n\n\tset_cpus_allowed(current, cpumask_of_cpu((int)(long)cpu));\n\n\t/* Ack: we are alive */\n\tsmp_mb(); /* Theoretically the ack = 0 might not be on this CPU yet. */\n\tatomic_inc(&stopmachine_thread_ack);\n\n\t/* Simple state machine */\n\twhile (stopmachine_state != STOPMACHINE_EXIT) {\n\t\tif (stopmachine_state == STOPMACHINE_DISABLE_IRQ \n\t\t && !irqs_disabled) {\n\t\t\tlocal_irq_disable();\n\t\t\thard_irq_disable();\n\t\t\tirqs_disabled = 1;\n\t\t\t/* Ack: irqs disabled. */\n\t\t\tsmp_mb(); /* Must read state first. */\n\t\t\tatomic_inc(&stopmachine_thread_ack);\n\t\t} else if (stopmachine_state == STOPMACHINE_PREPARE\n\t\t\t && !prepared) {\n\t\t\t/* Everyone is in place, hold CPU. */\n\t\t\tpreempt_disable();\n\t\t\tprepared = 1;\n\t\t\tsmp_mb(); /* Must read state first. */\n\t\t\tatomic_inc(&stopmachine_thread_ack);\n\t\t}\n\t\t/* Yield in first stage: migration threads need to\n\t\t * help our sisters onto their CPUs. */\n\t\tif (!prepared && !irqs_disabled)\n\t\t\tyield();\n\t\telse\n\t\t\tcpu_relax();\n\t}\n\n\t/* Ack: we are exiting. */\n\tsmp_mb(); /* Must read state first. */\n\tatomic_inc(&stopmachine_thread_ack);\n\n\tif (irqs_disabled)\n\t\tlocal_irq_enable();\n\tif (prepared)\n\t\tpreempt_enable();\n\n\treturn 0;\n}\n\n/* Change the thread state */\nstatic void stopmachine_set_state(enum stopmachine_state state)\n{\n\tatomic_set(&stopmachine_thread_ack, 0);\n\tsmp_wmb();\n\tstopmachine_state = state;\n\twhile (atomic_read(&stopmachine_thread_ack) != stopmachine_num_threads)\n\t\tcpu_relax();\n}\n\nstatic int stop_machine(void)\n{\n\tint i, ret = 0;\n\tstruct sched_param param = { .sched_priority = MAX_RT_PRIO-1 };\n\n\t/* One high-prio thread per cpu. We'll do this one. */\n\tsched_setscheduler(current, SCHED_FIFO, &param);\n\n\tatomic_set(&stopmachine_thread_ack, 0);\n\tstopmachine_num_threads = 0;\n\tstopmachine_state = STOPMACHINE_WAIT;\n\n\tfor_each_online_cpu(i) {\n\t\tif (i == raw_smp_processor_id())\n\t\t\tcontinue;\n\t\tret = kernel_thread(stopmachine, (void *)(long)i,CLONE_KERNEL);\n\t\tif (ret < 0)\n\t\t\tbreak;\n\t\tstopmachine_num_threads++;\n\t}\n\n\t/* Wait for them all to come to life. */\n\twhile (atomic_read(&stopmachine_thread_ack) != stopmachine_num_threads)\n\t\tyield();\n\n\t/* If some failed, kill them all. */\n\tif (ret < 0) {\n\t\tstopmachine_set_state(STOPMACHINE_EXIT);\n\t\treturn ret;\n\t}\n\n\t/* Now they are all started, make them hold the CPUs, ready. */\n\tpreempt_disable();\n\tstopmachine_set_state(STOPMACHINE_PREPARE);\n\n\t/* Make them disable irqs. */\n\tlocal_irq_disable();\n\thard_irq_disable();\n\tstopmachine_set_state(STOPMACHINE_DISABLE_IRQ);\n\n\treturn 0;\n}\n\nstatic void restart_machine(void)\n{\n\tstopmachine_set_state(STOPMACHINE_EXIT);\n\tlocal_irq_enable();\n\tpreempt_enable_no_resched();\n}\n\nstruct stop_machine_data\n{\n\tint (*fn)(void *);\n\tvoid *data;\n\tstruct completion done;\n};\n\nstatic int do_stop(void *_smdata)\n{\n\tstruct stop_machine_data *smdata = _smdata;\n\tint ret;\n\n\tret = stop_machine();\n\tif (ret == 0) {\n\t\tret = smdata->fn(smdata->data);\n\t\trestart_machine();\n\t}\n\n\t/* We're done: you can kthread_stop us now */\n\tcomplete(&smdata->done);\n\n\t/* Wait for kthread_stop */\n\tset_current_state(TASK_INTERRUPTIBLE);\n\twhile (!kthread_should_stop()) {\n\t\tschedule();\n\t\tset_current_state(TASK_INTERRUPTIBLE);\n\t}\n\t__set_current_state(TASK_RUNNING);\n\treturn ret;\n}\n\nstruct task_struct *__stop_machine_run(int (*fn)(void *), void *data,\n\t\t\t\t unsigned int cpu)\n{\n\tstruct stop_machine_data smdata;\n\tstruct task_struct *p;\n\n\tsmdata.fn = fn;\n\tsmdata.data = data;\n\tinit_completion(&smdata.done);\n\n\tdown(&stopmachine_mutex);\n\n\t/* If they don't care which CPU fn runs on, bind to any online one. */\n\tif (cpu == NR_CPUS)\n\t\tcpu = raw_smp_processor_id();\n\n\tp = kthread_create(do_stop, &smdata, \"kstopmachine\");\n\tif (!IS_ERR(p)) {\n\t\tkthread_bind(p, cpu);\n\t\twake_up_process(p);\n\t\twait_for_completion(&smdata.done);\n\t}\n\tup(&stopmachine_mutex);\n\treturn p;\n}\n\nint stop_machine_run(int (*fn)(void *), void *data, unsigned int cpu)\n{\n\tstruct task_struct *p;\n\tint ret;\n\n\t/* No CPUs can come up or down during this. */\n\tlock_cpu_hotplug();\n\tp = __stop_machine_run(fn, data, cpu);\n\tif (!IS_ERR(p))\n\t\tret = kthread_stop(p);\n\telse\n\t\tret = PTR_ERR(p);\n\tunlock_cpu_hotplug();\n\n\treturn ret;\n}\nEXPORT_SYMBOL_GPL(stop_machine_run);\n/*\n * linux/kernel/sys.c\n *\n * Copyright (C) 1991, 1992 Linus Torvalds\n */\n\n#include <linux/module.h>\n#include <linux/mm.h>\n#include <linux/utsname.h>\n#include <linux/mman.h>\n#include <linux/smp_lock.h>\n#include <linux/notifier.h>\n#include <linux/reboot.h>\n#include <linux/prctl.h>\n#include <linux/highuid.h>\n#include <linux/fs.h>\n#include <linux/resource.h>\n#include <linux/kernel.h>\n#include <linux/kexec.h>\n#include <linux/workqueue.h>\n#include <linux/capability.h>\n#include <linux/device.h>\n#include <linux/key.h>\n#include <linux/times.h>\n#include <linux/posix-timers.h>\n#include <linux/security.h>\n#include <linux/dcookies.h>\n#include <linux/suspend.h>\n#include <linux/tty.h>\n#include <linux/signal.h>\n#include <linux/cn_proc.h>\n#include <linux/getcpu.h>\n#include <linux/task_io_accounting_ops.h>\n\n#include <linux/compat.h>\n#include <linux/syscalls.h>\n#include <linux/kprobes.h>\n\n#include <asm/uaccess.h>\n#include <asm/io.h>\n#include <asm/unistd.h>\n\n#ifndef SET_UNALIGN_CTL\n# define SET_UNALIGN_CTL(a,b)\t(-EINVAL)\n#endif\n#ifndef GET_UNALIGN_CTL\n# define GET_UNALIGN_CTL(a,b)\t(-EINVAL)\n#endif\n#ifndef SET_FPEMU_CTL\n# define SET_FPEMU_CTL(a,b)\t(-EINVAL)\n#endif\n#ifndef GET_FPEMU_CTL\n# define GET_FPEMU_CTL(a,b)\t(-EINVAL)\n#endif\n#ifndef SET_FPEXC_CTL\n# define SET_FPEXC_CTL(a,b)\t(-EINVAL)\n#endif\n#ifndef GET_FPEXC_CTL\n# define GET_FPEXC_CTL(a,b)\t(-EINVAL)\n#endif\n#ifndef GET_ENDIAN\n# define GET_ENDIAN(a,b)\t(-EINVAL)\n#endif\n#ifndef SET_ENDIAN\n# define SET_ENDIAN(a,b)\t(-EINVAL)\n#endif\n\n/*\n * this is where the system-wide overflow UID and GID are defined, for\n * architectures that now have 32-bit UID/GID but didn't in the past\n */\n\nint overflowuid = DEFAULT_OVERFLOWUID;\nint overflowgid = DEFAULT_OVERFLOWGID;\n\n#ifdef CONFIG_UID16\nEXPORT_SYMBOL(overflowuid);\nEXPORT_SYMBOL(overflowgid);\n#endif\n\n/*\n * the same as above, but for filesystems which can only store a 16-bit\n * UID and GID. as such, this is needed on all architectures\n */\n\nint fs_overflowuid = DEFAULT_FS_OVERFLOWUID;\nint fs_overflowgid = DEFAULT_FS_OVERFLOWUID;\n\nEXPORT_SYMBOL(fs_overflowuid);\nEXPORT_SYMBOL(fs_overflowgid);\n\n/*\n * this indicates whether you can reboot with ctrl-alt-del: the default is yes\n */\n\nint C_A_D = 1;\nstruct pid *cad_pid;\nEXPORT_SYMBOL(cad_pid);\n\n/*\n *\tNotifier list for kernel code which wants to be called\n *\tat shutdown. This is used to stop any idling DMA operations\n *\tand the like. \n */\n\nstatic BLOCKING_NOTIFIER_HEAD(reboot_notifier_list);\n\n/*\n *\tNotifier chain core routines. The exported routines below\n *\tare layered on top of these, with appropriate locking added.\n */\n\nstatic int notifier_chain_register(struct notifier_block **nl,\n\t\tstruct notifier_block *n)\n{\n\twhile ((*nl) != NULL) {\n\t\tif (n->priority > (*nl)->priority)\n\t\t\tbreak;\n\t\tnl = &((*nl)->next);\n\t}\n\tn->next = *nl;\n\trcu_assign_pointer(*nl, n);\n\treturn 0;\n}\n\nstatic int notifier_chain_unregister(struct notifier_block **nl,\n\t\tstruct notifier_block *n)\n{\n\twhile ((*nl) != NULL) {\n\t\tif ((*nl) == n) {\n\t\t\trcu_assign_pointer(*nl, n->next);\n\t\t\treturn 0;\n\t\t}\n\t\tnl = &((*nl)->next);\n\t}\n\treturn -ENOENT;\n}\n\n/**\n * notifier_call_chain - Informs the registered notifiers about an event.\n *\t@nl:\t\tPointer to head of the blocking notifier chain\n *\t@val:\t\tValue passed unmodified to notifier function\n *\t@v:\t\tPointer passed unmodified to notifier function\n *\t@nr_to_call:\tNumber of notifier functions to be called. Don't care\n *\t\t \tvalue of this parameter is -1.\n *\t@nr_calls:\tRecords the number of notifications sent. Don't care\n *\t\t \tvalue of this field is NULL.\n * \t@returns:\tnotifier_call_chain returns the value returned by the\n *\t\t\tlast notifier function called.\n */\n\nstatic int __kprobes notifier_call_chain(struct notifier_block **nl,\n\t\t\t\t\tunsigned long val, void *v,\n\t\t\t\t\tint nr_to_call,\tint *nr_calls)\n{\n\tint ret = NOTIFY_DONE;\n\tstruct notifier_block *nb, *next_nb;\n\n\tnb = rcu_dereference(*nl);\n\n\twhile (nb && nr_to_call) {\n\t\tnext_nb = rcu_dereference(nb->next);\n\t\tret = nb->notifier_call(nb, val, v);\n\n\t\tif (nr_calls)\n\t\t\t(*nr_calls)++;\n\n\t\tif ((ret & NOTIFY_STOP_MASK) == NOTIFY_STOP_MASK)\n\t\t\tbreak;\n\t\tnb = next_nb;\n\t\tnr_to_call--;\n\t}\n\treturn ret;\n}\n\n/*\n *\tAtomic notifier chain routines. Registration and unregistration\n *\tuse a spinlock, and call_chain is synchronized by RCU (no locks).\n */\n\n/**\n *\tatomic_notifier_chain_register - Add notifier to an atomic notifier chain\n *\t@nh: Pointer to head of the atomic notifier chain\n *\t@n: New entry in notifier chain\n *\n *\tAdds a notifier to an atomic notifier chain.\n *\n *\tCurrently always returns zero.\n */\n\nint atomic_notifier_chain_register(struct atomic_notifier_head *nh,\n\t\tstruct notifier_block *n)\n{\n\tunsigned long flags;\n\tint ret;\n\n\tspin_lock_irqsave(&nh->lock, flags);\n\tret = notifier_chain_register(&nh->head, n);\n\tspin_unlock_irqrestore(&nh->lock, flags);\n\treturn ret;\n}\n\nEXPORT_SYMBOL_GPL(atomic_notifier_chain_register);\n\n/**\n *\tatomic_notifier_chain_unregister - Remove notifier from an atomic notifier chain\n *\t@nh: Pointer to head of the atomic notifier chain\n *\t@n: Entry to remove from notifier chain\n *\n *\tRemoves a notifier from an atomic notifier chain.\n *\n *\tReturns zero on success or %-ENOENT on failure.\n */\nint atomic_notifier_chain_unregister(struct atomic_notifier_head *nh,\n\t\tstruct notifier_block *n)\n{\n\tunsigned long flags;\n\tint ret;\n\n\tspin_lock_irqsave(&nh->lock, flags);\n\tret = notifier_chain_unregister(&nh->head, n);\n\tspin_unlock_irqrestore(&nh->lock, flags);\n\tsynchronize_rcu();\n\treturn ret;\n}\n\nEXPORT_SYMBOL_GPL(atomic_notifier_chain_unregister);\n\n/**\n *\t__atomic_notifier_call_chain - Call functions in an atomic notifier chain\n *\t@nh: Pointer to head of the atomic notifier chain\n *\t@val: Value passed unmodified to notifier function\n *\t@v: Pointer passed unmodified to notifier function\n *\t@nr_to_call: See the comment for notifier_call_chain.\n *\t@nr_calls: See the comment for notifier_call_chain.\n *\n *\tCalls each function in a notifier chain in turn. The functions\n *\trun in an atomic context, so they must not block.\n *\tThis routine uses RCU to synchronize with changes to the chain.\n *\n *\tIf the return value of the notifier can be and'ed\n *\twith %NOTIFY_STOP_MASK then atomic_notifier_call_chain()\n *\twill return immediately, with the return value of\n *\tthe notifier function which halted execution.\n *\tOtherwise the return value is the return value\n *\tof the last notifier function called.\n */\n \nint __kprobes __atomic_notifier_call_chain(struct atomic_notifier_head *nh,\n\t\t\t\t\tunsigned long val, void *v,\n\t\t\t\t\tint nr_to_call, int *nr_calls)\n{\n\tint ret;\n\n\trcu_read_lock();\n\tret = notifier_call_chain(&nh->head, val, v, nr_to_call, nr_calls);\n\trcu_read_unlock();\n\treturn ret;\n}\n\nEXPORT_SYMBOL_GPL(__atomic_notifier_call_chain);\n\nint __kprobes atomic_notifier_call_chain(struct atomic_notifier_head *nh,\n\t\tunsigned long val, void *v)\n{\n\treturn __atomic_notifier_call_chain(nh, val, v, -1, NULL);\n}\n\nEXPORT_SYMBOL_GPL(atomic_notifier_call_chain);\n/*\n *\tBlocking notifier chain routines. All access to the chain is\n *\tsynchronized by an rwsem.\n */\n\n/**\n *\tblocking_notifier_chain_register - Add notifier to a blocking notifier chain\n *\t@nh: Pointer to head of the blocking notifier chain\n *\t@n: New entry in notifier chain\n *\n *\tAdds a notifier to a blocking notifier chain.\n *\tMust be called in process context.\n *\n *\tCurrently always returns zero.\n */\n \nint blocking_notifier_chain_register(struct blocking_notifier_head *nh,\n\t\tstruct notifier_block *n)\n{\n\tint ret;\n\n\t/*\n\t * This code gets used during boot-up, when task switching is\n\t * not yet working and interrupts must remain disabled. At\n\t * such times we must not call down_write().\n\t */\n\tif (unlikely(system_state == SYSTEM_BOOTING))\n\t\treturn notifier_chain_register(&nh->head, n);\n\n\tdown_write(&nh->rwsem);\n\tret = notifier_chain_register(&nh->head, n);\n\tup_write(&nh->rwsem);\n\treturn ret;\n}\n\nEXPORT_SYMBOL_GPL(blocking_notifier_chain_register);\n\n/**\n *\tblocking_notifier_chain_unregister - Remove notifier from a blocking notifier chain\n *\t@nh: Pointer to head of the blocking notifier chain\n *\t@n: Entry to remove from notifier chain\n *\n *\tRemoves a notifier from a blocking notifier chain.\n *\tMust be called from process context.\n *\n *\tReturns zero on success or %-ENOENT on failure.\n */\nint blocking_notifier_chain_unregister(struct blocking_notifier_head *nh,\n\t\tstruct notifier_block *n)\n{\n\tint ret;\n\n\t/*\n\t * This code gets used during boot-up, when task switching is\n\t * not yet working and interrupts must remain disabled. At\n\t * such times we must not call down_write().\n\t */\n\tif (unlikely(system_state == SYSTEM_BOOTING))\n\t\treturn notifier_chain_unregister(&nh->head, n);\n\n\tdown_write(&nh->rwsem);\n\tret = notifier_chain_unregister(&nh->head, n);\n\tup_write(&nh->rwsem);\n\treturn ret;\n}\n\nEXPORT_SYMBOL_GPL(blocking_notifier_chain_unregister);\n\n/**\n *\t__blocking_notifier_call_chain - Call functions in a blocking notifier chain\n *\t@nh: Pointer to head of the blocking notifier chain\n *\t@val: Value passed unmodified to notifier function\n *\t@v: Pointer passed unmodified to notifier function\n *\t@nr_to_call: See comment for notifier_call_chain.\n *\t@nr_calls: See comment for notifier_call_chain.\n *\n *\tCalls each function in a notifier chain in turn. The functions\n *\trun in a process context, so they are allowed to block.\n *\n *\tIf the return value of the notifier can be and'ed\n *\twith %NOTIFY_STOP_MASK then blocking_notifier_call_chain()\n *\twill return immediately, with the return value of\n *\tthe notifier function which halted execution.\n *\tOtherwise the return value is the return value\n *\tof the last notifier function called.\n */\n \nint __blocking_notifier_call_chain(struct blocking_notifier_head *nh,\n\t\t\t\t unsigned long val, void *v,\n\t\t\t\t int nr_to_call, int *nr_calls)\n{\n\tint ret = NOTIFY_DONE;\n\n\t/*\n\t * We check the head outside the lock, but if this access is\n\t * racy then it does not matter what the result of the test\n\t * is, we re-check the list after having taken the lock anyway:\n\t */\n\tif (rcu_dereference(nh->head)) {\n\t\tdown_read(&nh->rwsem);\n\t\tret = notifier_call_chain(&nh->head, val, v, nr_to_call,\n\t\t\t\t\tnr_calls);\n\t\tup_read(&nh->rwsem);\n\t}\n\treturn ret;\n}\nEXPORT_SYMBOL_GPL(__blocking_notifier_call_chain);\n\nint blocking_notifier_call_chain(struct blocking_notifier_head *nh,\n\t\tunsigned long val, void *v)\n{\n\treturn __blocking_notifier_call_chain(nh, val, v, -1, NULL);\n}\nEXPORT_SYMBOL_GPL(blocking_notifier_call_chain);\n\n/*\n *\tRaw notifier chain routines. There is no protection;\n *\tthe caller must provide it. Use at your own risk!\n */\n\n/**\n *\traw_notifier_chain_register - Add notifier to a raw notifier chain\n *\t@nh: Pointer to head of the raw notifier chain\n *\t@n: New entry in notifier chain\n *\n *\tAdds a notifier to a raw notifier chain.\n *\tAll locking must be provided by the caller.\n *\n *\tCurrently always returns zero.\n */\n\nint raw_notifier_chain_register(struct raw_notifier_head *nh,\n\t\tstruct notifier_block *n)\n{\n\treturn notifier_chain_register(&nh->head, n);\n}\n\nEXPORT_SYMBOL_GPL(raw_notifier_chain_register);\n\n/**\n *\traw_notifier_chain_unregister - Remove notifier from a raw notifier chain\n *\t@nh: Pointer to head of the raw notifier chain\n *\t@n: Entry to remove from notifier chain\n *\n *\tRemoves a notifier from a raw notifier chain.\n *\tAll locking must be provided by the caller.\n *\n *\tReturns zero on success or %-ENOENT on failure.\n */\nint raw_notifier_chain_unregister(struct raw_notifier_head *nh,\n\t\tstruct notifier_block *n)\n{\n\treturn notifier_chain_unregister(&nh->head, n);\n}\n\nEXPORT_SYMBOL_GPL(raw_notifier_chain_unregister);\n\n/**\n *\t__raw_notifier_call_chain - Call functions in a raw notifier chain\n *\t@nh: Pointer to head of the raw notifier chain\n *\t@val: Value passed unmodified to notifier function\n *\t@v: Pointer passed unmodified to notifier function\n *\t@nr_to_call: See comment for notifier_call_chain.\n *\t@nr_calls: See comment for notifier_call_chain\n *\n *\tCalls each function in a notifier chain in turn. The functions\n *\trun in an undefined context.\n *\tAll locking must be provided by the caller.\n *\n *\tIf the return value of the notifier can be and'ed\n *\twith %NOTIFY_STOP_MASK then raw_notifier_call_chain()\n *\twill return immediately, with the return value of\n *\tthe notifier function which halted execution.\n *\tOtherwise the return value is the return value\n *\tof the last notifier function called.\n */\n\nint __raw_notifier_call_chain(struct raw_notifier_head *nh,\n\t\t\t unsigned long val, void *v,\n\t\t\t int nr_to_call, int *nr_calls)\n{\n\treturn notifier_call_chain(&nh->head, val, v, nr_to_call, nr_calls);\n}\n\nEXPORT_SYMBOL_GPL(__raw_notifier_call_chain);\n\nint raw_notifier_call_chain(struct raw_notifier_head *nh,\n\t\tunsigned long val, void *v)\n{\n\treturn __raw_notifier_call_chain(nh, val, v, -1, NULL);\n}\n\nEXPORT_SYMBOL_GPL(raw_notifier_call_chain);\n\n/*\n *\tSRCU notifier chain routines. Registration and unregistration\n *\tuse a mutex, and call_chain is synchronized by SRCU (no locks).\n */\n\n/**\n *\tsrcu_notifier_chain_register - Add notifier to an SRCU notifier chain\n *\t@nh: Pointer to head of the SRCU notifier chain\n *\t@n: New entry in notifier chain\n *\n *\tAdds a notifier to an SRCU notifier chain.\n *\tMust be called in process context.\n *\n *\tCurrently always returns zero.\n */\n\nint srcu_notifier_chain_register(struct srcu_notifier_head *nh,\n\t\tstruct notifier_block *n)\n{\n\tint ret;\n\n\t/*\n\t * This code gets used during boot-up, when task switching is\n\t * not yet working and interrupts must remain disabled. At\n\t * such times we must not call mutex_lock().\n\t */\n\tif (unlikely(system_state == SYSTEM_BOOTING))\n\t\treturn notifier_chain_register(&nh->head, n);\n\n\tmutex_lock(&nh->mutex);\n\tret = notifier_chain_register(&nh->head, n);\n\tmutex_unlock(&nh->mutex);\n\treturn ret;\n}\n\nEXPORT_SYMBOL_GPL(srcu_notifier_chain_register);\n\n/**\n *\tsrcu_notifier_chain_unregister - Remove notifier from an SRCU notifier chain\n *\t@nh: Pointer to head of the SRCU notifier chain\n *\t@n: Entry to remove from notifier chain\n *\n *\tRemoves a notifier from an SRCU notifier chain.\n *\tMust be called from process context.\n *\n *\tReturns zero on success or %-ENOENT on failure.\n */\nint srcu_notifier_chain_unregister(struct srcu_notifier_head *nh,\n\t\tstruct notifier_block *n)\n{\n\tint ret;\n\n\t/*\n\t * This code gets used during boot-up, when task switching is\n\t * not yet working and interrupts must remain disabled. At\n\t * such times we must not call mutex_lock().\n\t */\n\tif (unlikely(system_state == SYSTEM_BOOTING))\n\t\treturn notifier_chain_unregister(&nh->head, n);\n\n\tmutex_lock(&nh->mutex);\n\tret = notifier_chain_unregister(&nh->head, n);\n\tmutex_unlock(&nh->mutex);\n\tsynchronize_srcu(&nh->srcu);\n\treturn ret;\n}\n\nEXPORT_SYMBOL_GPL(srcu_notifier_chain_unregister);\n\n/**\n *\t__srcu_notifier_call_chain - Call functions in an SRCU notifier chain\n *\t@nh: Pointer to head of the SRCU notifier chain\n *\t@val: Value passed unmodified to notifier function\n *\t@v: Pointer passed unmodified to notifier function\n *\t@nr_to_call: See comment for notifier_call_chain.\n *\t@nr_calls: See comment for notifier_call_chain\n *\n *\tCalls each function in a notifier chain in turn. The functions\n *\trun in a process context, so they are allowed to block.\n *\n *\tIf the return value of the notifier can be and'ed\n *\twith %NOTIFY_STOP_MASK then srcu_notifier_call_chain()\n *\twill return immediately, with the return value of\n *\tthe notifier function which halted execution.\n *\tOtherwise the return value is the return value\n *\tof the last notifier function called.\n */\n\nint __srcu_notifier_call_chain(struct srcu_notifier_head *nh,\n\t\t\t unsigned long val, void *v,\n\t\t\t int nr_to_call, int *nr_calls)\n{\n\tint ret;\n\tint idx;\n\n\tidx = srcu_read_lock(&nh->srcu);\n\tret = notifier_call_chain(&nh->head, val, v, nr_to_call, nr_calls);\n\tsrcu_read_unlock(&nh->srcu, idx);\n\treturn ret;\n}\nEXPORT_SYMBOL_GPL(__srcu_notifier_call_chain);\n\nint srcu_notifier_call_chain(struct srcu_notifier_head *nh,\n\t\tunsigned long val, void *v)\n{\n\treturn __srcu_notifier_call_chain(nh, val, v, -1, NULL);\n}\nEXPORT_SYMBOL_GPL(srcu_notifier_call_chain);\n\n/**\n *\tsrcu_init_notifier_head - Initialize an SRCU notifier head\n *\t@nh: Pointer to head of the srcu notifier chain\n *\n *\tUnlike other sorts of notifier heads, SRCU notifier heads require\n *\tdynamic initialization. Be sure to call this routine before\n *\tcalling any of the other SRCU notifier routines for this head.\n *\n *\tIf an SRCU notifier head is deallocated, it must first be cleaned\n *\tup by calling srcu_cleanup_notifier_head(). Otherwise the head's\n *\tper-cpu data (used by the SRCU mechanism) will leak.\n */\n\nvoid srcu_init_notifier_head(struct srcu_notifier_head *nh)\n{\n\tmutex_init(&nh->mutex);\n\tif (init_srcu_struct(&nh->srcu) < 0)\n\t\tBUG();\n\tnh->head = NULL;\n}\n\nEXPORT_SYMBOL_GPL(srcu_init_notifier_head);\n\n/**\n *\tregister_reboot_notifier - Register function to be called at reboot time\n *\t@nb: Info about notifier function to be called\n *\n *\tRegisters a function with the list of functions\n *\tto be called at reboot time.\n *\n *\tCurrently always returns zero, as blocking_notifier_chain_register()\n *\talways returns zero.\n */\n \nint register_reboot_notifier(struct notifier_block * nb)\n{\n\treturn blocking_notifier_chain_register(&reboot_notifier_list, nb);\n}\n\nEXPORT_SYMBOL(register_reboot_notifier);\n\n/**\n *\tunregister_reboot_notifier - Unregister previously registered reboot notifier\n *\t@nb: Hook to be unregistered\n *\n *\tUnregisters a previously registered reboot\n *\tnotifier function.\n *\n *\tReturns zero on success, or %-ENOENT on failure.\n */\n \nint unregister_reboot_notifier(struct notifier_block * nb)\n{\n\treturn blocking_notifier_chain_unregister(&reboot_notifier_list, nb);\n}\n\nEXPORT_SYMBOL(unregister_reboot_notifier);\n\nstatic int set_one_prio(struct task_struct *p, int niceval, int error)\n{\n\tint no_nice;\n\n\tif (p->uid != current->euid &&\n\t\tp->euid != current->euid && !capable(CAP_SYS_NICE)) {\n\t\terror = -EPERM;\n\t\tgoto out;\n\t}\n\tif (niceval < task_nice(p) && !can_nice(p, niceval)) {\n\t\terror = -EACCES;\n\t\tgoto out;\n\t}\n\tno_nice = security_task_setnice(p, niceval);\n\tif (no_nice) {\n\t\terror = no_nice;\n\t\tgoto out;\n\t}\n\tif (error == -ESRCH)\n\t\terror = 0;\n\tset_user_nice(p, niceval);\nout:\n\treturn error;\n}\n\nasmlinkage long sys_setpriority(int which, int who, int niceval)\n{\n\tstruct task_struct *g, *p;\n\tstruct user_struct *user;\n\tint error = -EINVAL;\n\tstruct pid *pgrp;\n\n\tif (which > PRIO_USER || which < PRIO_PROCESS)\n\t\tgoto out;\n\n\t/* normalize: avoid signed division (rounding problems) */\n\terror = -ESRCH;\n\tif (niceval < -20)\n\t\tniceval = -20;\n\tif (niceval > 19)\n\t\tniceval = 19;\n\n\tread_lock(&tasklist_lock);\n\tswitch (which) {\n\t\tcase PRIO_PROCESS:\n\t\t\tif (who)\n\t\t\t\tp = find_task_by_pid(who);\n\t\t\telse\n\t\t\t\tp = current;\n\t\t\tif (p)\n\t\t\t\terror = set_one_prio(p, niceval, error);\n\t\t\tbreak;\n\t\tcase PRIO_PGRP:\n\t\t\tif (who)\n\t\t\t\tpgrp = find_pid(who);\n\t\t\telse\n\t\t\t\tpgrp = task_pgrp(current);\n\t\t\tdo_each_pid_task(pgrp, PIDTYPE_PGID, p) {\n\t\t\t\terror = set_one_prio(p, niceval, error);\n\t\t\t} while_each_pid_task(pgrp, PIDTYPE_PGID, p);\n\t\t\tbreak;\n\t\tcase PRIO_USER:\n\t\t\tuser = current->user;\n\t\t\tif (!who)\n\t\t\t\twho = current->uid;\n\t\t\telse\n\t\t\t\tif ((who != current->uid) && !(user = find_user(who)))\n\t\t\t\t\tgoto out_unlock;\t/* No processes for this user */\n\n\t\t\tdo_each_thread(g, p)\n\t\t\t\tif (p->uid == who)\n\t\t\t\t\terror = set_one_prio(p, niceval, error);\n\t\t\twhile_each_thread(g, p);\n\t\t\tif (who != current->uid)\n\t\t\t\tfree_uid(user);\t\t/* For find_user() */\n\t\t\tbreak;\n\t}\nout_unlock:\n\tread_unlock(&tasklist_lock);\nout:\n\treturn error;\n}\n\n/*\n * Ugh. To avoid negative return values, \"getpriority()\" will\n * not return the normal nice-value, but a negated value that\n * has been offset by 20 (ie it returns 40..1 instead of -20..19)\n * to stay compatible.\n */\nasmlinkage long sys_getpriority(int which, int who)\n{\n\tstruct task_struct *g, *p;\n\tstruct user_struct *user;\n\tlong niceval, retval = -ESRCH;\n\tstruct pid *pgrp;\n\n\tif (which > PRIO_USER || which < PRIO_PROCESS)\n\t\treturn -EINVAL;\n\n\tread_lock(&tasklist_lock);\n\tswitch (which) {\n\t\tcase PRIO_PROCESS:\n\t\t\tif (who)\n\t\t\t\tp = find_task_by_pid(who);\n\t\t\telse\n\t\t\t\tp = current;\n\t\t\tif (p) {\n\t\t\t\tniceval = 20 - task_nice(p);\n\t\t\t\tif (niceval > retval)\n\t\t\t\t\tretval = niceval;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase PRIO_PGRP:\n\t\t\tif (who)\n\t\t\t\tpgrp = find_pid(who);\n\t\t\telse\n\t\t\t\tpgrp = task_pgrp(current);\n\t\t\tdo_each_pid_task(pgrp, PIDTYPE_PGID, p) {\n\t\t\t\tniceval = 20 - task_nice(p);\n\t\t\t\tif (niceval > retval)\n\t\t\t\t\tretval = niceval;\n\t\t\t} while_each_pid_task(pgrp, PIDTYPE_PGID, p);\n\t\t\tbreak;\n\t\tcase PRIO_USER:\n\t\t\tuser = current->user;\n\t\t\tif (!who)\n\t\t\t\twho = current->uid;\n\t\t\telse\n\t\t\t\tif ((who != current->uid) && !(user = find_user(who)))\n\t\t\t\t\tgoto out_unlock;\t/* No processes for this user */\n\n\t\t\tdo_each_thread(g, p)\n\t\t\t\tif (p->uid == who) {\n\t\t\t\t\tniceval = 20 - task_nice(p);\n\t\t\t\t\tif (niceval > retval)\n\t\t\t\t\t\tretval = niceval;\n\t\t\t\t}\n\t\t\twhile_each_thread(g, p);\n\t\t\tif (who != current->uid)\n\t\t\t\tfree_uid(user);\t\t/* for find_user() */\n\t\t\tbreak;\n\t}\nout_unlock:\n\tread_unlock(&tasklist_lock);\n\n\treturn retval;\n}\n\n/**\n *\temergency_restart - reboot the system\n *\n *\tWithout shutting down any hardware or taking any locks\n *\treboot the system. This is called when we know we are in\n *\ttrouble so this is our best effort to reboot. This is\n *\tsafe to call in interrupt context.\n */\nvoid emergency_restart(void)\n{\n\tmachine_emergency_restart();\n}\nEXPORT_SYMBOL_GPL(emergency_restart);\n\nstatic void kernel_restart_prepare(char *cmd)\n{\n\tblocking_notifier_call_chain(&reboot_notifier_list, SYS_RESTART, cmd);\n\tsystem_state = SYSTEM_RESTART;\n\tdevice_shutdown();\n}\n\n/**\n *\tkernel_restart - reboot the system\n *\t@cmd: pointer to buffer containing command to execute for restart\n *\t\tor %NULL\n *\n *\tShutdown everything and perform a clean reboot.\n *\tThis is not safe to call in interrupt context.\n */\nvoid kernel_restart(char *cmd)\n{\n\tkernel_restart_prepare(cmd);\n\tif (!cmd)\n\t\tprintk(KERN_EMERG \"Restarting system.\\n\");\n\telse\n\t\tprintk(KERN_EMERG \"Restarting system with command '%s'.\\n\", cmd);\n\tmachine_restart(cmd);\n}\nEXPORT_SYMBOL_GPL(kernel_restart);\n\n/**\n *\tkernel_kexec - reboot the system\n *\n *\tMove into place and start executing a preloaded standalone\n *\texecutable. If nothing was preloaded return an error.\n */\nstatic void kernel_kexec(void)\n{\n#ifdef CONFIG_KEXEC\n\tstruct kimage *image;\n\timage = xchg(&kexec_image, NULL);\n\tif (!image)\n\t\treturn;\n\tkernel_restart_prepare(NULL);\n\tprintk(KERN_EMERG \"Starting new kernel\\n\");\n\tmachine_shutdown();\n\tmachine_kexec(image);\n#endif\n}\n\nvoid kernel_shutdown_prepare(enum system_states state)\n{\n\tblocking_notifier_call_chain(&reboot_notifier_list,\n\t\t(state == SYSTEM_HALT)?SYS_HALT:SYS_POWER_OFF, NULL);\n\tsystem_state = state;\n\tdevice_shutdown();\n}\n/**\n *\tkernel_halt - halt the system\n *\n *\tShutdown everything and perform a clean system halt.\n */\nvoid kernel_halt(void)\n{\n\tkernel_shutdown_prepare(SYSTEM_HALT);\n\tprintk(KERN_EMERG \"System halted.\\n\");\n\tmachine_halt();\n}\n\nEXPORT_SYMBOL_GPL(kernel_halt);\n\n/**\n *\tkernel_power_off - power_off the system\n *\n *\tShutdown everything and perform a clean system power_off.\n */\nvoid kernel_power_off(void)\n{\n\tkernel_shutdown_prepare(SYSTEM_POWER_OFF);\n\tprintk(KERN_EMERG \"Power down.\\n\");\n\tmachine_power_off();\n}\nEXPORT_SYMBOL_GPL(kernel_power_off);\n/*\n * Reboot system call: for obvious reasons only root may call it,\n * and even root needs to set up some magic numbers in the registers\n * so that some mistake won't make this reboot the whole machine.\n * You can also set the meaning of the ctrl-alt-del-key here.\n *\n * reboot doesn't sync: do that yourself before calling this.\n */\nasmlinkage long sys_reboot(int magic1, int magic2, unsigned int cmd, void __user * arg)\n{\n\tchar buffer[256];\n\n\t/* We only trust the superuser with rebooting the system. */\n\tif (!capable(CAP_SYS_BOOT))\n\t\treturn -EPERM;\n\n\t/* For safety, we require \"magic\" arguments. */\n\tif (magic1 != LINUX_REBOOT_MAGIC1 ||\n\t (magic2 != LINUX_REBOOT_MAGIC2 &&\n\t magic2 != LINUX_REBOOT_MAGIC2A &&\n\t\t\tmagic2 != LINUX_REBOOT_MAGIC2B &&\n\t magic2 != LINUX_REBOOT_MAGIC2C))\n\t\treturn -EINVAL;\n\n\t/* Instead of trying to make the power_off code look like\n\t * halt when pm_power_off is not set do it the easy way.\n\t */\n\tif ((cmd == LINUX_REBOOT_CMD_POWER_OFF) && !pm_power_off)\n\t\tcmd = LINUX_REBOOT_CMD_HALT;\n\n\tlock_kernel();\n\tswitch (cmd) {\n\tcase LINUX_REBOOT_CMD_RESTART:\n\t\tkernel_restart(NULL);\n\t\tbreak;\n\n\tcase LINUX_REBOOT_CMD_CAD_ON:\n\t\tC_A_D = 1;\n\t\tbreak;\n\n\tcase LINUX_REBOOT_CMD_CAD_OFF:\n\t\tC_A_D = 0;\n\t\tbreak;\n\n\tcase LINUX_REBOOT_CMD_HALT:\n\t\tkernel_halt();\n\t\tunlock_kernel();\n\t\tdo_exit(0);\n\t\tbreak;\n\n\tcase LINUX_REBOOT_CMD_POWER_OFF:\n\t\tkernel_power_off();\n\t\tunlock_kernel();\n\t\tdo_exit(0);\n\t\tbreak;\n\n\tcase LINUX_REBOOT_CMD_RESTART2:\n\t\tif (strncpy_from_user(&buffer[0], arg, sizeof(buffer) - 1) < 0) {\n\t\t\tunlock_kernel();\n\t\t\treturn -EFAULT;\n\t\t}\n\t\tbuffer[sizeof(buffer) - 1] = '\\0';\n\n\t\tkernel_restart(buffer);\n\t\tbreak;\n\n\tcase LINUX_REBOOT_CMD_KEXEC:\n\t\tkernel_kexec();\n\t\tunlock_kernel();\n\t\treturn -EINVAL;\n\n#ifdef CONFIG_SOFTWARE_SUSPEND\n\tcase LINUX_REBOOT_CMD_SW_SUSPEND:\n\t\t{\n\t\t\tint ret = hibernate();\n\t\t\tunlock_kernel();\n\t\t\treturn ret;\n\t\t}\n#endif\n\n\tdefault:\n\t\tunlock_kernel();\n\t\treturn -EINVAL;\n\t}\n\tunlock_kernel();\n\treturn 0;\n}\n\nstatic void deferred_cad(struct work_struct *dummy)\n{\n\tkernel_restart(NULL);\n}\n\n/*\n * This function gets called by ctrl-alt-del - ie the keyboard interrupt.\n * As it's called within an interrupt, it may NOT sync: the only choice\n * is whether to reboot at once, or just ignore the ctrl-alt-del.\n */\nvoid ctrl_alt_del(void)\n{\n\tstatic DECLARE_WORK(cad_work, deferred_cad);\n\n\tif (C_A_D)\n\t\tschedule_work(&cad_work);\n\telse\n\t\tkill_cad_pid(SIGINT, 1);\n}\n\t\n/*\n * Unprivileged users may change the real gid to the effective gid\n * or vice versa. (BSD-style)\n *\n * If you set the real gid at all, or set the effective gid to a value not\n * equal to the real gid, then the saved gid is set to the new effective gid.\n *\n * This makes it possible for a setgid program to completely drop its\n * privileges, which is often a useful assertion to make when you are doing\n * a security audit over a program.\n *\n * The general idea is that a program which uses just setregid() will be\n * 100% compatible with BSD. A program which uses just setgid() will be\n * 100% compatible with POSIX with saved IDs. \n *\n * SMP: There are not races, the GIDs are checked only by filesystem\n * operations (as far as semantic preservation is concerned).\n */\nasmlinkage long sys_setregid(gid_t rgid, gid_t egid)\n{\n\tint old_rgid = current->gid;\n\tint old_egid = current->egid;\n\tint new_rgid = old_rgid;\n\tint new_egid = old_egid;\n\tint retval;\n\n\tretval = security_task_setgid(rgid, egid, (gid_t)-1, LSM_SETID_RE);\n\tif (retval)\n\t\treturn retval;\n\n\tif (rgid != (gid_t) -1) {\n\t\tif ((old_rgid == rgid) ||\n\t\t (current->egid==rgid) ||\n\t\t capable(CAP_SETGID))\n\t\t\tnew_rgid = rgid;\n\t\telse\n\t\t\treturn -EPERM;\n\t}\n\tif (egid != (gid_t) -1) {\n\t\tif ((old_rgid == egid) ||\n\t\t (current->egid == egid) ||\n\t\t (current->sgid == egid) ||\n\t\t capable(CAP_SETGID))\n\t\t\tnew_egid = egid;\n\t\telse\n\t\t\treturn -EPERM;\n\t}\n\tif (new_egid != old_egid) {\n\t\tcurrent->mm->dumpable = suid_dumpable;\n\t\tsmp_wmb();\n\t}\n\tif (rgid != (gid_t) -1 ||\n\t (egid != (gid_t) -1 && egid != old_rgid))\n\t\tcurrent->sgid = new_egid;\n\tcurrent->fsgid = new_egid;\n\tcurrent->egid = new_egid;\n\tcurrent->gid = new_rgid;\n\tkey_fsgid_changed(current);\n\tproc_id_connector(current, PROC_EVENT_GID);\n\treturn 0;\n}\n\n/*\n * setgid() is implemented like SysV w/ SAVED_IDS \n *\n * SMP: Same implicit races as above.\n */\nasmlinkage long sys_setgid(gid_t gid)\n{\n\tint old_egid = current->egid;\n\tint retval;\n\n\tretval = security_task_setgid(gid, (gid_t)-1, (gid_t)-1, LSM_SETID_ID);\n\tif (retval)\n\t\treturn retval;\n\n\tif (capable(CAP_SETGID)) {\n\t\tif (old_egid != gid) {\n\t\t\tcurrent->mm->dumpable = suid_dumpable;\n\t\t\tsmp_wmb();\n\t\t}\n\t\tcurrent->gid = current->egid = current->sgid = current->fsgid = gid;\n\t} else if ((gid == current->gid) || (gid == current->sgid)) {\n\t\tif (old_egid != gid) {\n\t\t\tcurrent->mm->dumpable = suid_dumpable;\n\t\t\tsmp_wmb();\n\t\t}\n\t\tcurrent->egid = current->fsgid = gid;\n\t}\n\telse\n\t\treturn -EPERM;\n\n\tkey_fsgid_changed(current);\n\tproc_id_connector(current, PROC_EVENT_GID);\n\treturn 0;\n}\n \nstatic int set_user(uid_t new_ruid, int dumpclear)\n{\n\tstruct user_struct *new_user;\n\n\tnew_user = alloc_uid(new_ruid);\n\tif (!new_user)\n\t\treturn -EAGAIN;\n\n\tif (atomic_read(&new_user->processes) >=\n\t\t\t\tcurrent->signal->rlim[RLIMIT_NPROC].rlim_cur &&\n\t\t\tnew_user != &root_user) {\n\t\tfree_uid(new_user);\n\t\treturn -EAGAIN;\n\t}\n\n\tswitch_uid(new_user);\n\n\tif (dumpclear) {\n\t\tcurrent->mm->dumpable = suid_dumpable;\n\t\tsmp_wmb();\n\t}\n\tcurrent->uid = new_ruid;\n\treturn 0;\n}\n\n/*\n * Unprivileged users may change the real uid to the effective uid\n * or vice versa. (BSD-style)\n *\n * If you set the real uid at all, or set the effective uid to a value not\n * equal to the real uid, then the saved uid is set to the new effective uid.\n *\n * This makes it possible for a setuid program to completely drop its\n * privileges, which is often a useful assertion to make when you are doing\n * a security audit over a program.\n *\n * The general idea is that a program which uses just setreuid() will be\n * 100% compatible with BSD. A program which uses just setuid() will be\n * 100% compatible with POSIX with saved IDs. \n */\nasmlinkage long sys_setreuid(uid_t ruid, uid_t euid)\n{\n\tint old_ruid, old_euid, old_suid, new_ruid, new_euid;\n\tint retval;\n\n\tretval = security_task_setuid(ruid, euid, (uid_t)-1, LSM_SETID_RE);\n\tif (retval)\n\t\treturn retval;\n\n\tnew_ruid = old_ruid = current->uid;\n\tnew_euid = old_euid = current->euid;\n\told_suid = current->suid;\n\n\tif (ruid != (uid_t) -1) {\n\t\tnew_ruid = ruid;\n\t\tif ((old_ruid != ruid) &&\n\t\t (current->euid != ruid) &&\n\t\t !capable(CAP_SETUID))\n\t\t\treturn -EPERM;\n\t}\n\n\tif (euid != (uid_t) -1) {\n\t\tnew_euid = euid;\n\t\tif ((old_ruid != euid) &&\n\t\t (current->euid != euid) &&\n\t\t (current->suid != euid) &&\n\t\t !capable(CAP_SETUID))\n\t\t\treturn -EPERM;\n\t}\n\n\tif (new_ruid != old_ruid && set_user(new_ruid, new_euid != old_euid) < 0)\n\t\treturn -EAGAIN;\n\n\tif (new_euid != old_euid) {\n\t\tcurrent->mm->dumpable = suid_dumpable;\n\t\tsmp_wmb();\n\t}\n\tcurrent->fsuid = current->euid = new_euid;\n\tif (ruid != (uid_t) -1 ||\n\t (euid != (uid_t) -1 && euid != old_ruid))\n\t\tcurrent->suid = current->euid;\n\tcurrent->fsuid = current->euid;\n\n\tkey_fsuid_changed(current);\n\tproc_id_connector(current, PROC_EVENT_UID);\n\n\treturn security_task_post_setuid(old_ruid, old_euid, old_suid, LSM_SETID_RE);\n}\n\n\n\t\t\n/*\n * setuid() is implemented like SysV with SAVED_IDS \n * \n * Note that SAVED_ID's is deficient in that a setuid root program\n * like sendmail, for example, cannot set its uid to be a normal \n * user and then switch back, because if you're root, setuid() sets\n * the saved uid too. If you don't like this, blame the bright people\n * in the POSIX committee and/or USG. Note that the BSD-style setreuid()\n * will allow a root program to temporarily drop privileges and be able to\n * regain them by swapping the real and effective uid. \n */\nasmlinkage long sys_setuid(uid_t uid)\n{\n\tint old_euid = current->euid;\n\tint old_ruid, old_suid, new_suid;\n\tint retval;\n\n\tretval = security_task_setuid(uid, (uid_t)-1, (uid_t)-1, LSM_SETID_ID);\n\tif (retval)\n\t\treturn retval;\n\n\told_ruid = current->uid;\n\told_suid = current->suid;\n\tnew_suid = old_suid;\n\t\n\tif (capable(CAP_SETUID)) {\n\t\tif (uid != old_ruid && set_user(uid, old_euid != uid) < 0)\n\t\t\treturn -EAGAIN;\n\t\tnew_suid = uid;\n\t} else if ((uid != current->uid) && (uid != new_suid))\n\t\treturn -EPERM;\n\n\tif (old_euid != uid) {\n\t\tcurrent->mm->dumpable = suid_dumpable;\n\t\tsmp_wmb();\n\t}\n\tcurrent->fsuid = current->euid = uid;\n\tcurrent->suid = new_suid;\n\n\tkey_fsuid_changed(current);\n\tproc_id_connector(current, PROC_EVENT_UID);\n\n\treturn security_task_post_setuid(old_ruid, old_euid, old_suid, LSM_SETID_ID);\n}\n\n\n/*\n * This function implements a generic ability to update ruid, euid,\n * and suid. This allows you to implement the 4.4 compatible seteuid().\n */\nasmlinkage long sys_setresuid(uid_t ruid, uid_t euid, uid_t suid)\n{\n\tint old_ruid = current->uid;\n\tint old_euid = current->euid;\n\tint old_suid = current->suid;\n\tint retval;\n\n\tretval = security_task_setuid(ruid, euid, suid, LSM_SETID_RES);\n\tif (retval)\n\t\treturn retval;\n\n\tif (!capable(CAP_SETUID)) {\n\t\tif ((ruid != (uid_t) -1) && (ruid != current->uid) &&\n\t\t (ruid != current->euid) && (ruid != current->suid))\n\t\t\treturn -EPERM;\n\t\tif ((euid != (uid_t) -1) && (euid != current->uid) &&\n\t\t (euid != current->euid) && (euid != current->suid))\n\t\t\treturn -EPERM;\n\t\tif ((suid != (uid_t) -1) && (suid != current->uid) &&\n\t\t (suid != current->euid) && (suid != current->suid))\n\t\t\treturn -EPERM;\n\t}\n\tif (ruid != (uid_t) -1) {\n\t\tif (ruid != current->uid && set_user(ruid, euid != current->euid) < 0)\n\t\t\treturn -EAGAIN;\n\t}\n\tif (euid != (uid_t) -1) {\n\t\tif (euid != current->euid) {\n\t\t\tcurrent->mm->dumpable = suid_dumpable;\n\t\t\tsmp_wmb();\n\t\t}\n\t\tcurrent->euid = euid;\n\t}\n\tcurrent->fsuid = current->euid;\n\tif (suid != (uid_t) -1)\n\t\tcurrent->suid = suid;\n\n\tkey_fsuid_changed(current);\n\tproc_id_connector(current, PROC_EVENT_UID);\n\n\treturn security_task_post_setuid(old_ruid, old_euid, old_suid, LSM_SETID_RES);\n}\n\nasmlinkage long sys_getresuid(uid_t __user *ruid, uid_t __user *euid, uid_t __user *suid)\n{\n\tint retval;\n\n\tif (!(retval = put_user(current->uid, ruid)) &&\n\t !(retval = put_user(current->euid, euid)))\n\t\tretval = put_user(current->suid, suid);\n\n\treturn retval;\n}\n\n/*\n * Same as above, but for rgid, egid, sgid.\n */\nasmlinkage long sys_setresgid(gid_t rgid, gid_t egid, gid_t sgid)\n{\n\tint retval;\n\n\tretval = security_task_setgid(rgid, egid, sgid, LSM_SETID_RES);\n\tif (retval)\n\t\treturn retval;\n\n\tif (!capable(CAP_SETGID)) {\n\t\tif ((rgid != (gid_t) -1) && (rgid != current->gid) &&\n\t\t (rgid != current->egid) && (rgid != current->sgid))\n\t\t\treturn -EPERM;\n\t\tif ((egid != (gid_t) -1) && (egid != current->gid) &&\n\t\t (egid != current->egid) && (egid != current->sgid))\n\t\t\treturn -EPERM;\n\t\tif ((sgid != (gid_t) -1) && (sgid != current->gid) &&\n\t\t (sgid != current->egid) && (sgid != current->sgid))\n\t\t\treturn -EPERM;\n\t}\n\tif (egid != (gid_t) -1) {\n\t\tif (egid != current->egid) {\n\t\t\tcurrent->mm->dumpable = suid_dumpable;\n\t\t\tsmp_wmb();\n\t\t}\n\t\tcurrent->egid = egid;\n\t}\n\tcurrent->fsgid = current->egid;\n\tif (rgid != (gid_t) -1)\n\t\tcurrent->gid = rgid;\n\tif (sgid != (gid_t) -1)\n\t\tcurrent->sgid = sgid;\n\n\tkey_fsgid_changed(current);\n\tproc_id_connector(current, PROC_EVENT_GID);\n\treturn 0;\n}\n\nasmlinkage long sys_getresgid(gid_t __user *rgid, gid_t __user *egid, gid_t __user *sgid)\n{\n\tint retval;\n\n\tif (!(retval = put_user(current->gid, rgid)) &&\n\t !(retval = put_user(current->egid, egid)))\n\t\tretval = put_user(current->sgid, sgid);\n\n\treturn retval;\n}\n\n\n/*\n * \"setfsuid()\" sets the fsuid - the uid used for filesystem checks. This\n * is used for \"access()\" and for the NFS daemon (letting nfsd stay at\n * whatever uid it wants to). It normally shadows \"euid\", except when\n * explicitly set by setfsuid() or for access..\n */\nasmlinkage long sys_setfsuid(uid_t uid)\n{\n\tint old_fsuid;\n\n\told_fsuid = current->fsuid;\n\tif (security_task_setuid(uid, (uid_t)-1, (uid_t)-1, LSM_SETID_FS))\n\t\treturn old_fsuid;\n\n\tif (uid == current->uid || uid == current->euid ||\n\t uid == current->suid || uid == current->fsuid || \n\t capable(CAP_SETUID)) {\n\t\tif (uid != old_fsuid) {\n\t\t\tcurrent->mm->dumpable = suid_dumpable;\n\t\t\tsmp_wmb();\n\t\t}\n\t\tcurrent->fsuid = uid;\n\t}\n\n\tkey_fsuid_changed(current);\n\tproc_id_connector(current, PROC_EVENT_UID);\n\n\tsecurity_task_post_setuid(old_fsuid, (uid_t)-1, (uid_t)-1, LSM_SETID_FS);\n\n\treturn old_fsuid;\n}\n\n/*\n * Samma på svenska..\n */\nasmlinkage long sys_setfsgid(gid_t gid)\n{\n\tint old_fsgid;\n\n\told_fsgid = current->fsgid;\n\tif (security_task_setgid(gid, (gid_t)-1, (gid_t)-1, LSM_SETID_FS))\n\t\treturn old_fsgid;\n\n\tif (gid == current->gid || gid == current->egid ||\n\t gid == current->sgid || gid == current->fsgid || \n\t capable(CAP_SETGID)) {\n\t\tif (gid != old_fsgid) {\n\t\t\tcurrent->mm->dumpable = suid_dumpable;\n\t\t\tsmp_wmb();\n\t\t}\n\t\tcurrent->fsgid = gid;\n\t\tkey_fsgid_changed(current);\n\t\tproc_id_connector(current, PROC_EVENT_GID);\n\t}\n\treturn old_fsgid;\n}\n\nasmlinkage long sys_times(struct tms __user * tbuf)\n{\n\t/*\n\t *\tIn the SMP world we might just be unlucky and have one of\n\t *\tthe times increment as we use it. Since the value is an\n\t *\tatomically safe type this is just fine. Conceptually its\n\t *\tas if the syscall took an instant longer to occur.\n\t */\n\tif (tbuf) {\n\t\tstruct tms tmp;\n\t\tstruct task_struct *tsk = current;\n\t\tstruct task_struct *t;\n\t\tcputime_t utime, stime, cutime, cstime;\n\n\t\tspin_lock_irq(&tsk->sighand->siglock);\n\t\tutime = tsk->signal->utime;\n\t\tstime = tsk->signal->stime;\n\t\tt = tsk;\n\t\tdo {\n\t\t\tutime = cputime_add(utime, t->utime);\n\t\t\tstime = cputime_add(stime, t->stime);\n\t\t\tt = next_thread(t);\n\t\t} while (t != tsk);\n\n\t\tcutime = tsk->signal->cutime;\n\t\tcstime = tsk->signal->cstime;\n\t\tspin_unlock_irq(&tsk->sighand->siglock);\n\n\t\ttmp.tms_utime = cputime_to_clock_t(utime);\n\t\ttmp.tms_stime = cputime_to_clock_t(stime);\n\t\ttmp.tms_cutime = cputime_to_clock_t(cutime);\n\t\ttmp.tms_cstime = cputime_to_clock_t(cstime);\n\t\tif (copy_to_user(tbuf, &tmp, sizeof(struct tms)))\n\t\t\treturn -EFAULT;\n\t}\n\treturn (long) jiffies_64_to_clock_t(get_jiffies_64());\n}\n\n/*\n * This needs some heavy checking ...\n * I just haven't the stomach for it. I also don't fully\n * understand sessions/pgrp etc. Let somebody who does explain it.\n *\n * OK, I think I have the protection semantics right.... this is really\n * only important on a multi-user system anyway, to make sure one user\n * can't send a signal to a process owned by another. -TYT, 12/12/91\n *\n * Auch. Had to add the 'did_exec' flag to conform completely to POSIX.\n * LBT 04.03.94\n */\nasmlinkage long sys_setpgid(pid_t pid, pid_t pgid)\n{\n\tstruct task_struct *p;\n\tstruct task_struct *group_leader = current->group_leader;\n\tint err = -EINVAL;\n\n\tif (!pid)\n\t\tpid = group_leader->pid;\n\tif (!pgid)\n\t\tpgid = pid;\n\tif (pgid < 0)\n\t\treturn -EINVAL;\n\n\t/* From this point forward we keep holding onto the tasklist lock\n\t * so that our parent does not change from under us. -DaveM\n\t */\n\twrite_lock_irq(&tasklist_lock);\n\n\terr = -ESRCH;\n\tp = find_task_by_pid(pid);\n\tif (!p)\n\t\tgoto out;\n\n\terr = -EINVAL;\n\tif (!thread_group_leader(p))\n\t\tgoto out;\n\n\tif (p->real_parent->tgid == group_leader->tgid) {\n\t\terr = -EPERM;\n\t\tif (task_session(p) != task_session(group_leader))\n\t\t\tgoto out;\n\t\terr = -EACCES;\n\t\tif (p->did_exec)\n\t\t\tgoto out;\n\t} else {\n\t\terr = -ESRCH;\n\t\tif (p != group_leader)\n\t\t\tgoto out;\n\t}\n\n\terr = -EPERM;\n\tif (p->signal->leader)\n\t\tgoto out;\n\n\tif (pgid != pid) {\n\t\tstruct task_struct *g =\n\t\t\tfind_task_by_pid_type(PIDTYPE_PGID, pgid);\n\n\t\tif (!g || task_session(g) != task_session(group_leader))\n\t\t\tgoto out;\n\t}\n\n\terr = security_task_setpgid(p, pgid);\n\tif (err)\n\t\tgoto out;\n\n\tif (process_group(p) != pgid) {\n\t\tdetach_pid(p, PIDTYPE_PGID);\n\t\tp->signal->pgrp = pgid;\n\t\tattach_pid(p, PIDTYPE_PGID, find_pid(pgid));\n\t}\n\n\terr = 0;\nout:\n\t/* All paths lead to here, thus we are safe. -DaveM */\n\twrite_unlock_irq(&tasklist_lock);\n\treturn err;\n}\n\nasmlinkage long sys_getpgid(pid_t pid)\n{\n\tif (!pid)\n\t\treturn process_group(current);\n\telse {\n\t\tint retval;\n\t\tstruct task_struct *p;\n\n\t\tread_lock(&tasklist_lock);\n\t\tp = find_task_by_pid(pid);\n\n\t\tretval = -ESRCH;\n\t\tif (p) {\n\t\t\tretval = security_task_getpgid(p);\n\t\t\tif (!retval)\n\t\t\t\tretval = process_group(p);\n\t\t}\n\t\tread_unlock(&tasklist_lock);\n\t\treturn retval;\n\t}\n}\n\n#ifdef __ARCH_WANT_SYS_GETPGRP\n\nasmlinkage long sys_getpgrp(void)\n{\n\t/* SMP - assuming writes are word atomic this is fine */\n\treturn process_group(current);\n}\n\n#endif\n\nasmlinkage long sys_getsid(pid_t pid)\n{\n\tif (!pid)\n\t\treturn process_session(current);\n\telse {\n\t\tint retval;\n\t\tstruct task_struct *p;\n\n\t\tread_lock(&tasklist_lock);\n\t\tp = find_task_by_pid(pid);\n\n\t\tretval = -ESRCH;\n\t\tif (p) {\n\t\t\tretval = security_task_getsid(p);\n\t\t\tif (!retval)\n\t\t\t\tretval = process_session(p);\n\t\t}\n\t\tread_unlock(&tasklist_lock);\n\t\treturn retval;\n\t}\n}\n\nasmlinkage long sys_setsid(void)\n{\n\tstruct task_struct *group_leader = current->group_leader;\n\tpid_t session;\n\tint err = -EPERM;\n\n\twrite_lock_irq(&tasklist_lock);\n\n\t/* Fail if I am already a session leader */\n\tif (group_leader->signal->leader)\n\t\tgoto out;\n\n\tsession = group_leader->pid;\n\t/* Fail if a process group id already exists that equals the\n\t * proposed session id.\n\t *\n\t * Don't check if session id == 1 because kernel threads use this\n\t * session id and so the check will always fail and make it so\n\t * init cannot successfully call setsid.\n\t */\n\tif (session > 1 && find_task_by_pid_type(PIDTYPE_PGID, session))\n\t\tgoto out;\n\n\tgroup_leader->signal->leader = 1;\n\t__set_special_pids(session, session);\n\n\tspin_lock(&group_leader->sighand->siglock);\n\tgroup_leader->signal->tty = NULL;\n\tspin_unlock(&group_leader->sighand->siglock);\n\n\terr = process_group(group_leader);\nout:\n\twrite_unlock_irq(&tasklist_lock);\n\treturn err;\n}\n\n/*\n * Supplementary group IDs\n */\n\n/* init to 2 - one for init_task, one to ensure it is never freed */\nstruct group_info init_groups = { .usage = ATOMIC_INIT(2) };\n\nstruct group_info *groups_alloc(int gidsetsize)\n{\n\tstruct group_info *group_info;\n\tint nblocks;\n\tint i;\n\n\tnblocks = (gidsetsize + NGROUPS_PER_BLOCK - 1) / NGROUPS_PER_BLOCK;\n\t/* Make sure we always allocate at least one indirect block pointer */\n\tnblocks = nblocks ? : 1;\n\tgroup_info = kmalloc(sizeof(*group_info) + nblocks*sizeof(gid_t *), GFP_USER);\n\tif (!group_info)\n\t\treturn NULL;\n\tgroup_info->ngroups = gidsetsize;\n\tgroup_info->nblocks = nblocks;\n\tatomic_set(&group_info->usage, 1);\n\n\tif (gidsetsize <= NGROUPS_SMALL)\n\t\tgroup_info->blocks[0] = group_info->small_block;\n\telse {\n\t\tfor (i = 0; i < nblocks; i++) {\n\t\t\tgid_t *b;\n\t\t\tb = (void *)__get_free_page(GFP_USER);\n\t\t\tif (!b)\n\t\t\t\tgoto out_undo_partial_alloc;\n\t\t\tgroup_info->blocks[i] = b;\n\t\t}\n\t}\n\treturn group_info;\n\nout_undo_partial_alloc:\n\twhile (--i >= 0) {\n\t\tfree_page((unsigned long)group_info->blocks[i]);\n\t}\n\tkfree(group_info);\n\treturn NULL;\n}\n\nEXPORT_SYMBOL(groups_alloc);\n\nvoid groups_free(struct group_info *group_info)\n{\n\tif (group_info->blocks[0] != group_info->small_block) {\n\t\tint i;\n\t\tfor (i = 0; i < group_info->nblocks; i++)\n\t\t\tfree_page((unsigned long)group_info->blocks[i]);\n\t}\n\tkfree(group_info);\n}\n\nEXPORT_SYMBOL(groups_free);\n\n/* export the group_info to a user-space array */\nstatic int groups_to_user(gid_t __user *grouplist,\n struct group_info *group_info)\n{\n\tint i;\n\tint count = group_info->ngroups;\n\n\tfor (i = 0; i < group_info->nblocks; i++) {\n\t\tint cp_count = min(NGROUPS_PER_BLOCK, count);\n\t\tint off = i * NGROUPS_PER_BLOCK;\n\t\tint len = cp_count * sizeof(*grouplist);\n\n\t\tif (copy_to_user(grouplist+off, group_info->blocks[i], len))\n\t\t\treturn -EFAULT;\n\n\t\tcount -= cp_count;\n\t}\n\treturn 0;\n}\n\n/* fill a group_info from a user-space array - it must be allocated already */\nstatic int groups_from_user(struct group_info *group_info,\n gid_t __user *grouplist)\n{\n\tint i;\n\tint count = group_info->ngroups;\n\n\tfor (i = 0; i < group_info->nblocks; i++) {\n\t\tint cp_count = min(NGROUPS_PER_BLOCK, count);\n\t\tint off = i * NGROUPS_PER_BLOCK;\n\t\tint len = cp_count * sizeof(*grouplist);\n\n\t\tif (copy_from_user(group_info->blocks[i], grouplist+off, len))\n\t\t\treturn -EFAULT;\n\n\t\tcount -= cp_count;\n\t}\n\treturn 0;\n}\n\n/* a simple Shell sort */\nstatic void groups_sort(struct group_info *group_info)\n{\n\tint base, max, stride;\n\tint gidsetsize = group_info->ngroups;\n\n\tfor (stride = 1; stride < gidsetsize; stride = 3 * stride + 1)\n\t\t; /* nothing */\n\tstride /= 3;\n\n\twhile (stride) {\n\t\tmax = gidsetsize - stride;\n\t\tfor (base = 0; base < max; base++) {\n\t\t\tint left = base;\n\t\t\tint right = left + stride;\n\t\t\tgid_t tmp = GROUP_AT(group_info, right);\n\n\t\t\twhile (left >= 0 && GROUP_AT(group_info, left) > tmp) {\n\t\t\t\tGROUP_AT(group_info, right) =\n\t\t\t\t GROUP_AT(group_info, left);\n\t\t\t\tright = left;\n\t\t\t\tleft -= stride;\n\t\t\t}\n\t\t\tGROUP_AT(group_info, right) = tmp;\n\t\t}\n\t\tstride /= 3;\n\t}\n}\n\n/* a simple bsearch */\nint groups_search(struct group_info *group_info, gid_t grp)\n{\n\tunsigned int left, right;\n\n\tif (!group_info)\n\t\treturn 0;\n\n\tleft = 0;\n\tright = group_info->ngroups;\n\twhile (left < right) {\n\t\tunsigned int mid = (left+right)/2;\n\t\tint cmp = grp - GROUP_AT(group_info, mid);\n\t\tif (cmp > 0)\n\t\t\tleft = mid + 1;\n\t\telse if (cmp < 0)\n\t\t\tright = mid;\n\t\telse\n\t\t\treturn 1;\n\t}\n\treturn 0;\n}\n\n/* validate and set current->group_info */\nint set_current_groups(struct group_info *group_info)\n{\n\tint retval;\n\tstruct group_info *old_info;\n\n\tretval = security_task_setgroups(group_info);\n\tif (retval)\n\t\treturn retval;\n\n\tgroups_sort(group_info);\n\tget_group_info(group_info);\n\n\ttask_lock(current);\n\told_info = current->group_info;\n\tcurrent->group_info = group_info;\n\ttask_unlock(current);\n\n\tput_group_info(old_info);\n\n\treturn 0;\n}\n\nEXPORT_SYMBOL(set_current_groups);\n\nasmlinkage long sys_getgroups(int gidsetsize, gid_t __user *grouplist)\n{\n\tint i = 0;\n\n\t/*\n\t *\tSMP: Nobody else can change our grouplist. Thus we are\n\t *\tsafe.\n\t */\n\n\tif (gidsetsize < 0)\n\t\treturn -EINVAL;\n\n\t/* no need to grab task_lock here; it cannot change */\n\ti = current->group_info->ngroups;\n\tif (gidsetsize) {\n\t\tif (i > gidsetsize) {\n\t\t\ti = -EINVAL;\n\t\t\tgoto out;\n\t\t}\n\t\tif (groups_to_user(grouplist, current->group_info)) {\n\t\t\ti = -EFAULT;\n\t\t\tgoto out;\n\t\t}\n\t}\nout:\n\treturn i;\n}\n\n/*\n *\tSMP: Our groups are copy-on-write. We can set them safely\n *\twithout another task interfering.\n */\n \nasmlinkage long sys_setgroups(int gidsetsize, gid_t __user *grouplist)\n{\n\tstruct group_info *group_info;\n\tint retval;\n\n\tif (!capable(CAP_SETGID))\n\t\treturn -EPERM;\n\tif ((unsigned)gidsetsize > NGROUPS_MAX)\n\t\treturn -EINVAL;\n\n\tgroup_info = groups_alloc(gidsetsize);\n\tif (!group_info)\n\t\treturn -ENOMEM;\n\tretval = groups_from_user(group_info, grouplist);\n\tif (retval) {\n\t\tput_group_info(group_info);\n\t\treturn retval;\n\t}\n\n\tretval = set_current_groups(group_info);\n\tput_group_info(group_info);\n\n\treturn retval;\n}\n\n/*\n * Check whether we're fsgid/egid or in the supplemental group..\n */\nint in_group_p(gid_t grp)\n{\n\tint retval = 1;\n\tif (grp != current->fsgid)\n\t\tretval = groups_search(current->group_info, grp);\n\treturn retval;\n}\n\nEXPORT_SYMBOL(in_group_p);\n\nint in_egroup_p(gid_t grp)\n{\n\tint retval = 1;\n\tif (grp != current->egid)\n\t\tretval = groups_search(current->group_info, grp);\n\treturn retval;\n}\n\nEXPORT_SYMBOL(in_egroup_p);\n\nDECLARE_RWSEM(uts_sem);\n\nEXPORT_SYMBOL(uts_sem);\n\nasmlinkage long sys_newuname(struct new_utsname __user * name)\n{\n\tint errno = 0;\n\n\tdown_read(&uts_sem);\n\tif (copy_to_user(name, utsname(), sizeof *name))\n\t\terrno = -EFAULT;\n\tup_read(&uts_sem);\n\treturn errno;\n}\n\nasmlinkage long sys_sethostname(char __user *name, int len)\n{\n\tint errno;\n\tchar tmp[__NEW_UTS_LEN];\n\n\tif (!capable(CAP_SYS_ADMIN))\n\t\treturn -EPERM;\n\tif (len < 0 || len > __NEW_UTS_LEN)\n\t\treturn -EINVAL;\n\tdown_write(&uts_sem);\n\terrno = -EFAULT;\n\tif (!copy_from_user(tmp, name, len)) {\n\t\tmemcpy(utsname()->nodename, tmp, len);\n\t\tutsname()->nodename[len] = 0;\n\t\terrno = 0;\n\t}\n\tup_write(&uts_sem);\n\treturn errno;\n}\n\n#ifdef __ARCH_WANT_SYS_GETHOSTNAME\n\nasmlinkage long sys_gethostname(char __user *name, int len)\n{\n\tint i, errno;\n\n\tif (len < 0)\n\t\treturn -EINVAL;\n\tdown_read(&uts_sem);\n\ti = 1 + strlen(utsname()->nodename);\n\tif (i > len)\n\t\ti = len;\n\terrno = 0;\n\tif (copy_to_user(name, utsname()->nodename, i))\n\t\terrno = -EFAULT;\n\tup_read(&uts_sem);\n\treturn errno;\n}\n\n#endif\n\n/*\n * Only setdomainname; getdomainname can be implemented by calling\n * uname()\n */\nasmlinkage long sys_setdomainname(char __user *name, int len)\n{\n\tint errno;\n\tchar tmp[__NEW_UTS_LEN];\n\n\tif (!capable(CAP_SYS_ADMIN))\n\t\treturn -EPERM;\n\tif (len < 0 || len > __NEW_UTS_LEN)\n\t\treturn -EINVAL;\n\n\tdown_write(&uts_sem);\n\terrno = -EFAULT;\n\tif (!copy_from_user(tmp, name, len)) {\n\t\tmemcpy(utsname()->domainname, tmp, len);\n\t\tutsname()->domainname[len] = 0;\n\t\terrno = 0;\n\t}\n\tup_write(&uts_sem);\n\treturn errno;\n}\n\nasmlinkage long sys_getrlimit(unsigned int resource, struct rlimit __user *rlim)\n{\n\tif (resource >= RLIM_NLIMITS)\n\t\treturn -EINVAL;\n\telse {\n\t\tstruct rlimit value;\n\t\ttask_lock(current->group_leader);\n\t\tvalue = current->signal->rlim[resource];\n\t\ttask_unlock(current->group_leader);\n\t\treturn copy_to_user(rlim, &value, sizeof(*rlim)) ? -EFAULT : 0;\n\t}\n}\n\n#ifdef __ARCH_WANT_SYS_OLD_GETRLIMIT\n\n/*\n *\tBack compatibility for getrlimit. Needed for some apps.\n */\n \nasmlinkage long sys_old_getrlimit(unsigned int resource, struct rlimit __user *rlim)\n{\n\tstruct rlimit x;\n\tif (resource >= RLIM_NLIMITS)\n\t\treturn -EINVAL;\n\n\ttask_lock(current->group_leader);\n\tx = current->signal->rlim[resource];\n\ttask_unlock(current->group_leader);\n\tif (x.rlim_cur > 0x7FFFFFFF)\n\t\tx.rlim_cur = 0x7FFFFFFF;\n\tif (x.rlim_max > 0x7FFFFFFF)\n\t\tx.rlim_max = 0x7FFFFFFF;\n\treturn copy_to_user(rlim, &x, sizeof(x))?-EFAULT:0;\n}\n\n#endif\n\nasmlinkage long sys_setrlimit(unsigned int resource, struct rlimit __user *rlim)\n{\n\tstruct rlimit new_rlim, *old_rlim;\n\tunsigned long it_prof_secs;\n\tint retval;\n\n\tif (resource >= RLIM_NLIMITS)\n\t\treturn -EINVAL;\n\tif (copy_from_user(&new_rlim, rlim, sizeof(*rlim)))\n\t\treturn -EFAULT;\n\tif (new_rlim.rlim_cur > new_rlim.rlim_max)\n\t\treturn -EINVAL;\n\told_rlim = current->signal->rlim + resource;\n\tif ((new_rlim.rlim_max > old_rlim->rlim_max) &&\n\t !capable(CAP_SYS_RESOURCE))\n\t\treturn -EPERM;\n\tif (resource == RLIMIT_NOFILE && new_rlim.rlim_max > NR_OPEN)\n\t\treturn -EPERM;\n\n\tretval = security_task_setrlimit(resource, &new_rlim);\n\tif (retval)\n\t\treturn retval;\n\n\tif (resource == RLIMIT_CPU && new_rlim.rlim_cur == 0) {\n\t\t/*\n\t\t * The caller is asking for an immediate RLIMIT_CPU\n\t\t * expiry. But we use the zero value to mean \"it was\n\t\t * never set\". So let's cheat and make it one second\n\t\t * instead\n\t\t */\n\t\tnew_rlim.rlim_cur = 1;\n\t}\n\n\ttask_lock(current->group_leader);\n\t*old_rlim = new_rlim;\n\ttask_unlock(current->group_leader);\n\n\tif (resource != RLIMIT_CPU)\n\t\tgoto out;\n\n\t/*\n\t * RLIMIT_CPU handling. Note that the kernel fails to return an error\n\t * code if it rejected the user's attempt to set RLIMIT_CPU. This is a\n\t * very long-standing error, and fixing it now risks breakage of\n\t * applications, so we live with it\n\t */\n\tif (new_rlim.rlim_cur == RLIM_INFINITY)\n\t\tgoto out;\n\n\tit_prof_secs = cputime_to_secs(current->signal->it_prof_expires);\n\tif (it_prof_secs == 0 || new_rlim.rlim_cur <= it_prof_secs) {\n\t\tunsigned long rlim_cur = new_rlim.rlim_cur;\n\t\tcputime_t cputime;\n\n\t\tcputime = secs_to_cputime(rlim_cur);\n\t\tread_lock(&tasklist_lock);\n\t\tspin_lock_irq(&current->sighand->siglock);\n\t\tset_process_cpu_timer(current, CPUCLOCK_PROF, &cputime, NULL);\n\t\tspin_unlock_irq(&current->sighand->siglock);\n\t\tread_unlock(&tasklist_lock);\n\t}\nout:\n\treturn 0;\n}\n\n/*\n * It would make sense to put struct rusage in the task_struct,\n * except that would make the task_struct be *really big*. After\n * task_struct gets moved into malloc'ed memory, it would\n * make sense to do this. It will make moving the rest of the information\n * a lot simpler! (Which we're not doing right now because we're not\n * measuring them yet).\n *\n * When sampling multiple threads for RUSAGE_SELF, under SMP we might have\n * races with threads incrementing their own counters. But since word\n * reads are atomic, we either get new values or old values and we don't\n * care which for the sums. We always take the siglock to protect reading\n * the c* fields from p->signal from races with exit.c updating those\n * fields when reaping, so a sample either gets all the additions of a\n * given child after it's reaped, or none so this sample is before reaping.\n *\n * Locking:\n * We need to take the siglock for CHILDEREN, SELF and BOTH\n * for the cases current multithreaded, non-current single threaded\n * non-current multithreaded. Thread traversal is now safe with\n * the siglock held.\n * Strictly speaking, we donot need to take the siglock if we are current and\n * single threaded, as no one else can take our signal_struct away, no one\n * else can reap the children to update signal->c* counters, and no one else\n * can race with the signal-> fields. If we do not take any lock, the\n * signal-> fields could be read out of order while another thread was just\n * exiting. So we should place a read memory barrier when we avoid the lock.\n * On the writer side, write memory barrier is implied in __exit_signal\n * as __exit_signal releases the siglock spinlock after updating the signal->\n * fields. But we don't do this yet to keep things simple.\n *\n */\n\nstatic void k_getrusage(struct task_struct *p, int who, struct rusage *r)\n{\n\tstruct task_struct *t;\n\tunsigned long flags;\n\tcputime_t utime, stime;\n\n\tmemset((char *) r, 0, sizeof *r);\n\tutime = stime = cputime_zero;\n\n\trcu_read_lock();\n\tif (!lock_task_sighand(p, &flags)) {\n\t\trcu_read_unlock();\n\t\treturn;\n\t}\n\n\tswitch (who) {\n\t\tcase RUSAGE_BOTH:\n\t\tcase RUSAGE_CHILDREN:\n\t\t\tutime = p->signal->cutime;\n\t\t\tstime = p->signal->cstime;\n\t\t\tr->ru_nvcsw = p->signal->cnvcsw;\n\t\t\tr->ru_nivcsw = p->signal->cnivcsw;\n\t\t\tr->ru_minflt = p->signal->cmin_flt;\n\t\t\tr->ru_majflt = p->signal->cmaj_flt;\n\t\t\tr->ru_inblock = p->signal->cinblock;\n\t\t\tr->ru_oublock = p->signal->coublock;\n\n\t\t\tif (who == RUSAGE_CHILDREN)\n\t\t\t\tbreak;\n\n\t\tcase RUSAGE_SELF:\n\t\t\tutime = cputime_add(utime, p->signal->utime);\n\t\t\tstime = cputime_add(stime, p->signal->stime);\n\t\t\tr->ru_nvcsw += p->signal->nvcsw;\n\t\t\tr->ru_nivcsw += p->signal->nivcsw;\n\t\t\tr->ru_minflt += p->signal->min_flt;\n\t\t\tr->ru_majflt += p->signal->maj_flt;\n\t\t\tr->ru_inblock += p->signal->inblock;\n\t\t\tr->ru_oublock += p->signal->oublock;\n\t\t\tt = p;\n\t\t\tdo {\n\t\t\t\tutime = cputime_add(utime, t->utime);\n\t\t\t\tstime = cputime_add(stime, t->stime);\n\t\t\t\tr->ru_nvcsw += t->nvcsw;\n\t\t\t\tr->ru_nivcsw += t->nivcsw;\n\t\t\t\tr->ru_minflt += t->min_flt;\n\t\t\t\tr->ru_majflt += t->maj_flt;\n\t\t\t\tr->ru_inblock += task_io_get_inblock(t);\n\t\t\t\tr->ru_oublock += task_io_get_oublock(t);\n\t\t\t\tt = next_thread(t);\n\t\t\t} while (t != p);\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tBUG();\n\t}\n\n\tunlock_task_sighand(p, &flags);\n\trcu_read_unlock();\n\n\tcputime_to_timeval(utime, &r->ru_utime);\n\tcputime_to_timeval(stime, &r->ru_stime);\n}\n\nint getrusage(struct task_struct *p, int who, struct rusage __user *ru)\n{\n\tstruct rusage r;\n\tk_getrusage(p, who, &r);\n\treturn copy_to_user(ru, &r, sizeof(r)) ? -EFAULT : 0;\n}\n\nasmlinkage long sys_getrusage(int who, struct rusage __user *ru)\n{\n\tif (who != RUSAGE_SELF && who != RUSAGE_CHILDREN)\n\t\treturn -EINVAL;\n\treturn getrusage(current, who, ru);\n}\n\nasmlinkage long sys_umask(int mask)\n{\n\tmask = xchg(&current->fs->umask, mask & S_IRWXUGO);\n\treturn mask;\n}\n \nasmlinkage long sys_prctl(int option, unsigned long arg2, unsigned long arg3,\n\t\t\t unsigned long arg4, unsigned long arg5)\n{\n\tlong error;\n\n\terror = security_task_prctl(option, arg2, arg3, arg4, arg5);\n\tif (error)\n\t\treturn error;\n\n\tswitch (option) {\n\t\tcase PR_SET_PDEATHSIG:\n\t\t\tif (!valid_signal(arg2)) {\n\t\t\t\terror = -EINVAL;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcurrent->pdeath_signal = arg2;\n\t\t\tbreak;\n\t\tcase PR_GET_PDEATHSIG:\n\t\t\terror = put_user(current->pdeath_signal, (int __user *)arg2);\n\t\t\tbreak;\n\t\tcase PR_GET_DUMPABLE:\n\t\t\terror = current->mm->dumpable;\n\t\t\tbreak;\n\t\tcase PR_SET_DUMPABLE:\n\t\t\tif (arg2 < 0 || arg2 > 1) {\n\t\t\t\terror = -EINVAL;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcurrent->mm->dumpable = arg2;\n\t\t\tbreak;\n\n\t\tcase PR_SET_UNALIGN:\n\t\t\terror = SET_UNALIGN_CTL(current, arg2);\n\t\t\tbreak;\n\t\tcase PR_GET_UNALIGN:\n\t\t\terror = GET_UNALIGN_CTL(current, arg2);\n\t\t\tbreak;\n\t\tcase PR_SET_FPEMU:\n\t\t\terror = SET_FPEMU_CTL(current, arg2);\n\t\t\tbreak;\n\t\tcase PR_GET_FPEMU:\n\t\t\terror = GET_FPEMU_CTL(current, arg2);\n\t\t\tbreak;\n\t\tcase PR_SET_FPEXC:\n\t\t\terror = SET_FPEXC_CTL(current, arg2);\n\t\t\tbreak;\n\t\tcase PR_GET_FPEXC:\n\t\t\terror = GET_FPEXC_CTL(current, arg2);\n\t\t\tbreak;\n\t\tcase PR_GET_TIMING:\n\t\t\terror = PR_TIMING_STATISTICAL;\n\t\t\tbreak;\n\t\tcase PR_SET_TIMING:\n\t\t\tif (arg2 == PR_TIMING_STATISTICAL)\n\t\t\t\terror = 0;\n\t\t\telse\n\t\t\t\terror = -EINVAL;\n\t\t\tbreak;\n\n\t\tcase PR_GET_KEEPCAPS:\n\t\t\tif (current->keep_capabilities)\n\t\t\t\terror = 1;\n\t\t\tbreak;\n\t\tcase PR_SET_KEEPCAPS:\n\t\t\tif (arg2 != 0 && arg2 != 1) {\n\t\t\t\terror = -EINVAL;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcurrent->keep_capabilities = arg2;\n\t\t\tbreak;\n\t\tcase PR_SET_NAME: {\n\t\t\tstruct task_struct *me = current;\n\t\t\tunsigned char ncomm[sizeof(me->comm)];\n\n\t\t\tncomm[sizeof(me->comm)-1] = 0;\n\t\t\tif (strncpy_from_user(ncomm, (char __user *)arg2,\n\t\t\t\t\t\tsizeof(me->comm)-1) < 0)\n\t\t\t\treturn -EFAULT;\n\t\t\tset_task_comm(me, ncomm);\n\t\t\treturn 0;\n\t\t}\n\t\tcase PR_GET_NAME: {\n\t\t\tstruct task_struct *me = current;\n\t\t\tunsigned char tcomm[sizeof(me->comm)];\n\n\t\t\tget_task_comm(tcomm, me);\n\t\t\tif (copy_to_user((char __user *)arg2, tcomm, sizeof(tcomm)))\n\t\t\t\treturn -EFAULT;\n\t\t\treturn 0;\n\t\t}\n\t\tcase PR_GET_ENDIAN:\n\t\t\terror = GET_ENDIAN(current, arg2);\n\t\t\tbreak;\n\t\tcase PR_SET_ENDIAN:\n\t\t\terror = SET_ENDIAN(current, arg2);\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\terror = -EINVAL;\n\t\t\tbreak;\n\t}\n\treturn error;\n}\n\nasmlinkage long sys_getcpu(unsigned __user *cpup, unsigned __user *nodep,\n\t \t\t struct getcpu_cache __user *cache)\n{\n\tint err = 0;\n\tint cpu = raw_smp_processor_id();\n\tif (cpup)\n\t\terr |= put_user(cpu, cpup);\n\tif (nodep)\n\t\terr |= put_user(cpu_to_node(cpu), nodep);\n\tif (cache) {\n\t\t/*\n\t\t * The cache is not needed for this implementation,\n\t\t * but make sure user programs pass something\n\t\t * valid. vsyscall implementations can instead make\n\t\t * good use of the cache. Only use t0 and t1 because\n\t\t * these are available in both 32bit and 64bit ABI (no\n\t\t * need for a compat_getcpu). 32bit has enough\n\t\t * padding\n\t\t */\n\t\tunsigned long t0, t1;\n\t\tget_user(t0, &cache->blob[0]);\n\t\tget_user(t1, &cache->blob[1]);\n\t\tt0++;\n\t\tt1++;\n\t\tput_user(t0, &cache->blob[0]);\n\t\tput_user(t1, &cache->blob[1]);\n\t}\n\treturn err ? -EFAULT : 0;\n}\n/*\n * sysctl.c: General linux system control interface\n *\n * Begun 24 March 1995, Stephen Tweedie\n * Added /proc support, Dec 1995\n * Added bdflush entry and intvec min/max checking, 2/23/96, Tom Dyas.\n * Added hooks for /proc/sys/net (minor, minor patch), 96/4/1, Mike Shaver.\n * Added kernel/java-{interpreter,appletviewer}, 96/5/10, Mike Shaver.\n * Dynamic registration fixes, Stephen Tweedie.\n * Added kswapd-interval, ctrl-alt-del, printk stuff, 1/8/97, Chris Horn.\n * Made sysctl support optional via CONFIG_SYSCTL, 1/10/97, Chris\n * Horn.\n * Added proc_doulongvec_ms_jiffies_minmax, 09/08/99, Carlos H. Bauer.\n * Added proc_doulongvec_minmax, 09/08/99, Carlos H. Bauer.\n * Changed linked lists to use list.h instead of lists.h, 02/24/00, Bill\n * Wendling.\n * The list_for_each() macro wasn't appropriate for the sysctl loop.\n * Removed it and replaced it with older style, 03/23/00, Bill Wendling\n */\n\n#include <linux/module.h>\n#include <linux/mm.h>\n#include <linux/swap.h>\n#include <linux/slab.h>\n#include <linux/sysctl.h>\n#include <linux/proc_fs.h>\n#include <linux/capability.h>\n#include <linux/ctype.h>\n#include <linux/utsname.h>\n#include <linux/capability.h>\n#include <linux/smp_lock.h>\n#include <linux/init.h>\n#include <linux/kernel.h>\n#include <linux/kobject.h>\n#include <linux/net.h>\n#include <linux/sysrq.h>\n#include <linux/highuid.h>\n#include <linux/writeback.h>\n#include <linux/hugetlb.h>\n#include <linux/security.h>\n#include <linux/initrd.h>\n#include <linux/times.h>\n#include <linux/limits.h>\n#include <linux/dcache.h>\n#include <linux/syscalls.h>\n#include <linux/nfs_fs.h>\n#include <linux/acpi.h>\n\n#include <asm/uaccess.h>\n#include <asm/processor.h>\n\nextern int proc_nr_files(ctl_table *table, int write, struct file *filp,\n void __user *buffer, size_t *lenp, loff_t *ppos);\n\n#ifdef CONFIG_X86\n#include <asm/nmi.h>\n#include <asm/stacktrace.h>\n#endif\n\n#if defined(CONFIG_SYSCTL)\n\n/* External variables not in a header file. */\nextern int C_A_D;\nextern int sysctl_overcommit_memory;\nextern int sysctl_overcommit_ratio;\nextern int sysctl_panic_on_oom;\nextern int max_threads;\nextern int core_uses_pid;\nextern int suid_dumpable;\nextern char core_pattern[];\nextern int pid_max;\nextern int min_free_kbytes;\nextern int printk_ratelimit_jiffies;\nextern int printk_ratelimit_burst;\nextern int pid_max_min, pid_max_max;\nextern int sysctl_drop_caches;\nextern int percpu_pagelist_fraction;\nextern int compat_log;\nextern int maps_protect;\nextern int sysctl_stat_interval;\n\n/* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */\nstatic int maxolduid = 65535;\nstatic int minolduid;\nstatic int min_percpu_pagelist_fract = 8;\n\nstatic int ngroups_max = NGROUPS_MAX;\n\n#ifdef CONFIG_KMOD\nextern char modprobe_path[];\n#endif\n#ifdef CONFIG_CHR_DEV_SG\nextern int sg_big_buff;\n#endif\n\n#ifdef __sparc__\nextern char reboot_command [];\nextern int stop_a_enabled;\nextern int scons_pwroff;\n#endif\n\n#ifdef __hppa__\nextern int pwrsw_enabled;\nextern int unaligned_enabled;\n#endif\n\n#ifdef CONFIG_S390\n#ifdef CONFIG_MATHEMU\nextern int sysctl_ieee_emulation_warnings;\n#endif\nextern int sysctl_userprocess_debug;\nextern int spin_retry;\n#endif\n\nextern int sysctl_hz_timer;\n\n#ifdef CONFIG_BSD_PROCESS_ACCT\nextern int acct_parm[];\n#endif\n\n#ifdef CONFIG_IA64\nextern int no_unaligned_warning;\n#endif\n\n#ifdef CONFIG_RT_MUTEXES\nextern int max_lock_depth;\n#endif\n\n#ifdef CONFIG_SYSCTL_SYSCALL\nstatic int parse_table(int __user *, int, void __user *, size_t __user *,\n\t\tvoid __user *, size_t, ctl_table *);\n#endif\n\n\n#ifdef CONFIG_PROC_SYSCTL\nstatic int proc_do_cad_pid(ctl_table *table, int write, struct file *filp,\n\t\t void __user *buffer, size_t *lenp, loff_t *ppos);\nstatic int proc_dointvec_taint(ctl_table *table, int write, struct file *filp,\n\t\t\t void __user *buffer, size_t *lenp, loff_t *ppos);\n#endif\n\nstatic ctl_table root_table[];\nstatic struct ctl_table_header root_table_header =\n\t{ root_table, LIST_HEAD_INIT(root_table_header.ctl_entry) };\n\nstatic ctl_table kern_table[];\nstatic ctl_table vm_table[];\nstatic ctl_table fs_table[];\nstatic ctl_table debug_table[];\nstatic ctl_table dev_table[];\nextern ctl_table random_table[];\n#ifdef CONFIG_UNIX98_PTYS\nextern ctl_table pty_table[];\n#endif\n#ifdef CONFIG_INOTIFY_USER\nextern ctl_table inotify_table[];\n#endif\n\n#ifdef HAVE_ARCH_PICK_MMAP_LAYOUT\nint sysctl_legacy_va_layout;\n#endif\n\n\n/* The default sysctl tables: */\n\nstatic ctl_table root_table[] = {\n\t{\n\t\t.ctl_name\t= CTL_KERN,\n\t\t.procname\t= \"kernel\",\n\t\t.mode\t\t= 0555,\n\t\t.child\t\t= kern_table,\n\t},\n\t{\n\t\t.ctl_name\t= CTL_VM,\n\t\t.procname\t= \"vm\",\n\t\t.mode\t\t= 0555,\n\t\t.child\t\t= vm_table,\n\t},\n#ifdef CONFIG_NET\n\t{\n\t\t.ctl_name\t= CTL_NET,\n\t\t.procname\t= \"net\",\n\t\t.mode\t\t= 0555,\n\t\t.child\t\t= net_table,\n\t},\n#endif\n\t{\n\t\t.ctl_name\t= CTL_FS,\n\t\t.procname\t= \"fs\",\n\t\t.mode\t\t= 0555,\n\t\t.child\t\t= fs_table,\n\t},\n\t{\n\t\t.ctl_name\t= CTL_DEBUG,\n\t\t.procname\t= \"debug\",\n\t\t.mode\t\t= 0555,\n\t\t.child\t\t= debug_table,\n\t},\n\t{\n\t\t.ctl_name\t= CTL_DEV,\n\t\t.procname\t= \"dev\",\n\t\t.mode\t\t= 0555,\n\t\t.child\t\t= dev_table,\n\t},\n\n\t{ .ctl_name = 0 }\n};\n\nextern int affinity_load_balancing;\n\nstatic ctl_table kern_table[] = {\n\t{\n\t\t.ctl_name\t= KERN_PANIC,\n\t\t.procname\t= \"panic\",\n\t\t.data\t\t= &panic_timeout,\n\t\t.maxlen\t\t= sizeof(int),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &proc_dointvec,\n\t},\n\t{\n\t\t.ctl_name\t= KERN_CORE_USES_PID,\n\t\t.procname\t= \"core_uses_pid\",\n\t\t.data\t\t= &core_uses_pid,\n\t\t.maxlen\t\t= sizeof(int),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &proc_dointvec,\n\t},\n\t{\n\t\t.ctl_name\t= KERN_CORE_PATTERN,\n\t\t.procname\t= \"core_pattern\",\n\t\t.data\t\t= core_pattern,\n\t\t.maxlen\t\t= CORENAME_MAX_SIZE,\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &proc_dostring,\n\t\t.strategy\t= &sysctl_string,\n\t},\n#ifdef CONFIG_PROC_SYSCTL\n\t{\n\t\t.ctl_name\t= KERN_TAINTED,\n\t\t.procname\t= \"tainted\",\n\t\t.data\t\t= &tainted,\n\t\t.maxlen\t\t= sizeof(int),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &proc_dointvec_taint,\n\t},\n#endif\n\t{\n\t\t.ctl_name\t= KERN_CAP_BSET,\n\t\t.procname\t= \"cap-bound\",\n\t\t.data\t\t= &cap_bset,\n\t\t.maxlen\t\t= sizeof(kernel_cap_t),\n\t\t.mode\t\t= 0600,\n\t\t.proc_handler\t= &proc_dointvec_bset,\n\t},\n#ifdef CONFIG_BLK_DEV_INITRD\n\t{\n\t\t.ctl_name\t= KERN_REALROOTDEV,\n\t\t.procname\t= \"real-root-dev\",\n\t\t.data\t\t= &real_root_dev,\n\t\t.maxlen\t\t= sizeof(int),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &proc_dointvec,\n\t},\n#endif\n#ifdef __sparc__\n\t{\n\t\t.ctl_name\t= KERN_SPARC_REBOOT,\n\t\t.procname\t= \"reboot-cmd\",\n\t\t.data\t\t= reboot_command,\n\t\t.maxlen\t\t= 256,\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &proc_dostring,\n\t\t.strategy\t= &sysctl_string,\n\t},\n\t{\n\t\t.ctl_name\t= KERN_SPARC_STOP_A,\n\t\t.procname\t= \"stop-a\",\n\t\t.data\t\t= &stop_a_enabled,\n\t\t.maxlen\t\t= sizeof (int),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &proc_dointvec,\n\t},\n\t{\n\t\t.ctl_name\t= KERN_SPARC_SCONS_PWROFF,\n\t\t.procname\t= \"scons-poweroff\",\n\t\t.data\t\t= &scons_pwroff,\n\t\t.maxlen\t\t= sizeof (int),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &proc_dointvec,\n\t},\n#endif\n#ifdef __hppa__\n\t{\n\t\t.ctl_name\t= KERN_HPPA_PWRSW,\n\t\t.procname\t= \"soft-power\",\n\t\t.data\t\t= &pwrsw_enabled,\n\t\t.maxlen\t\t= sizeof (int),\n\t \t.mode\t\t= 0644,\n\t\t.proc_handler\t= &proc_dointvec,\n\t},\n\t{\n\t\t.ctl_name\t= KERN_HPPA_UNALIGNED,\n\t\t.procname\t= \"unaligned-trap\",\n\t\t.data\t\t= &unaligned_enabled,\n\t\t.maxlen\t\t= sizeof (int),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &proc_dointvec,\n\t},\n#endif\n\t{\n\t\t.ctl_name\t= KERN_CTLALTDEL,\n\t\t.procname\t= \"ctrl-alt-del\",\n\t\t.data\t\t= &C_A_D,\n\t\t.maxlen\t\t= sizeof(int),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &proc_dointvec,\n\t},\n\t{\n\t\t.ctl_name\t= KERN_PRINTK,\n\t\t.procname\t= \"printk\",\n\t\t.data\t\t= &console_loglevel,\n\t\t.maxlen\t\t= 4*sizeof(int),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &proc_dointvec,\n\t},\n#ifdef CONFIG_KMOD\n\t{\n\t\t.ctl_name\t= KERN_MODPROBE,\n\t\t.procname\t= \"modprobe\",\n\t\t.data\t\t= &modprobe_path,\n\t\t.maxlen\t\t= KMOD_PATH_LEN,\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &proc_dostring,\n\t\t.strategy\t= &sysctl_string,\n\t},\n#endif\n#if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET)\n\t{\n\t\t.ctl_name\t= KERN_HOTPLUG,\n\t\t.procname\t= \"hotplug\",\n\t\t.data\t\t= &uevent_helper,\n\t\t.maxlen\t\t= UEVENT_HELPER_PATH_LEN,\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &proc_dostring,\n\t\t.strategy\t= &sysctl_string,\n\t},\n#endif\n#ifdef CONFIG_CHR_DEV_SG\n\t{\n\t\t.ctl_name\t= KERN_SG_BIG_BUFF,\n\t\t.procname\t= \"sg-big-buff\",\n\t\t.data\t\t= &sg_big_buff,\n\t\t.maxlen\t\t= sizeof (int),\n\t\t.mode\t\t= 0444,\n\t\t.proc_handler\t= &proc_dointvec,\n\t},\n#endif\n#ifdef CONFIG_BSD_PROCESS_ACCT\n\t{\n\t\t.ctl_name\t= KERN_ACCT,\n\t\t.procname\t= \"acct\",\n\t\t.data\t\t= &acct_parm,\n\t\t.maxlen\t\t= 3*sizeof(int),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &proc_dointvec,\n\t},\n#endif\n#ifdef CONFIG_MAGIC_SYSRQ\n\t{\n\t\t.ctl_name\t= KERN_SYSRQ,\n\t\t.procname\t= \"sysrq\",\n\t\t.data\t\t= &__sysrq_enabled,\n\t\t.maxlen\t\t= sizeof (int),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &proc_dointvec,\n\t},\n#endif\n#ifdef CONFIG_PROC_SYSCTL\n\t{\n\t\t.ctl_name\t= KERN_CADPID,\n\t\t.procname\t= \"cad_pid\",\n\t\t.data\t\t= NULL,\n\t\t.maxlen\t\t= sizeof (int),\n\t\t.mode\t\t= 0600,\n\t\t.proc_handler\t= &proc_do_cad_pid,\n\t},\n#endif\n\t{\n\t\t.ctl_name\t= KERN_MAX_THREADS,\n\t\t.procname\t= \"threads-max\",\n\t\t.data\t\t= &max_threads,\n\t\t.maxlen\t\t= sizeof(int),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &proc_dointvec,\n\t},\n#ifdef CONFIG_MODULES\n\t{\n\t\t.ctl_name\t= KERN_UNSUPPORTED,\n\t\t.procname\t= \"unsupported\",\n\t\t.data\t\t= &unsupported,\n\t\t.maxlen\t\t= sizeof(int),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &proc_dointvec,\n\t},\n#endif\n\t{\n\t\t.ctl_name\t= KERN_RANDOM,\n\t\t.procname\t= \"random\",\n\t\t.mode\t\t= 0555,\n\t\t.child\t\t= random_table,\n\t},\n#ifdef CONFIG_UNIX98_PTYS\n\t{\n\t\t.ctl_name\t= KERN_PTY,\n\t\t.procname\t= \"pty\",\n\t\t.mode\t\t= 0555,\n\t\t.child\t\t= pty_table,\n\t},\n#endif\n\t{\n\t\t.ctl_name\t= KERN_OVERFLOWUID,\n\t\t.procname\t= \"overflowuid\",\n\t\t.data\t\t= &overflowuid,\n\t\t.maxlen\t\t= sizeof(int),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &proc_dointvec_minmax,\n\t\t.strategy\t= &sysctl_intvec,\n\t\t.extra1\t\t= &minolduid,\n\t\t.extra2\t\t= &maxolduid,\n\t},\n\t{\n\t\t.ctl_name\t= KERN_OVERFLOWGID,\n\t\t.procname\t= \"overflowgid\",\n\t\t.data\t\t= &overflowgid,\n\t\t.maxlen\t\t= sizeof(int),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &proc_dointvec_minmax,\n\t\t.strategy\t= &sysctl_intvec,\n\t\t.extra1\t\t= &minolduid,\n\t\t.extra2\t\t= &maxolduid,\n\t},\n#ifdef CONFIG_S390\n#ifdef CONFIG_MATHEMU\n\t{\n\t\t.ctl_name\t= KERN_IEEE_EMULATION_WARNINGS,\n\t\t.procname\t= \"ieee_emulation_warnings\",\n\t\t.data\t\t= &sysctl_ieee_emulation_warnings,\n\t\t.maxlen\t\t= sizeof(int),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &proc_dointvec,\n\t},\n#endif\n#ifdef CONFIG_NO_IDLE_HZ\n\t{\n\t\t.ctl_name = KERN_HZ_TIMER,\n\t\t.procname = \"hz_timer\",\n\t\t.data = &sysctl_hz_timer,\n\t\t.maxlen = sizeof(int),\n\t\t.mode = 0644,\n\t\t.proc_handler = &proc_dointvec,\n\t},\n#endif\n\t{\n\t\t.ctl_name\t= KERN_S390_USER_DEBUG_LOGGING,\n\t\t.procname\t= \"userprocess_debug\",\n\t\t.data\t\t= &sysctl_userprocess_debug,\n\t\t.maxlen\t\t= sizeof(int),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &proc_dointvec,\n\t},\n#endif\n\t{\n\t\t.ctl_name\t= KERN_PIDMAX,\n\t\t.procname\t= \"pid_max\",\n\t\t.data\t\t= &pid_max,\n\t\t.maxlen\t\t= sizeof (int),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &proc_dointvec_minmax,\n\t\t.strategy\t= sysctl_intvec,\n\t\t.extra1\t\t= &pid_max_min,\n\t\t.extra2\t\t= &pid_max_max,\n\t},\n\t{\n\t\t.ctl_name\t= KERN_PANIC_ON_OOPS,\n\t\t.procname\t= \"panic_on_oops\",\n\t\t.data\t\t= &panic_on_oops,\n\t\t.maxlen\t\t= sizeof(int),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &proc_dointvec,\n\t},\n\t{\n\t\t.ctl_name\t= KERN_PRINTK_RATELIMIT,\n\t\t.procname\t= \"printk_ratelimit\",\n\t\t.data\t\t= &printk_ratelimit_jiffies,\n\t\t.maxlen\t\t= sizeof(int),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &proc_dointvec_jiffies,\n\t\t.strategy\t= &sysctl_jiffies,\n\t},\n\t{\n\t\t.ctl_name\t= KERN_PRINTK_RATELIMIT_BURST,\n\t\t.procname\t= \"printk_ratelimit_burst\",\n\t\t.data\t\t= &printk_ratelimit_burst,\n\t\t.maxlen\t\t= sizeof(int),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &proc_dointvec,\n\t},\n\t{\n\t\t.ctl_name\t= KERN_NGROUPS_MAX,\n\t\t.procname\t= \"ngroups_max\",\n\t\t.data\t\t= &ngroups_max,\n\t\t.maxlen\t\t= sizeof (int),\n\t\t.mode\t\t= 0444,\n\t\t.proc_handler\t= &proc_dointvec,\n\t},\n#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)\n\t{\n\t\t.ctl_name = KERN_UNKNOWN_NMI_PANIC,\n\t\t.procname = \"unknown_nmi_panic\",\n\t\t.data = &unknown_nmi_panic,\n\t\t.maxlen = sizeof (int),\n\t\t.mode = 0644,\n\t\t.proc_handler = &proc_dointvec,\n\t},\n#ifndef CONFIG_XEN\n\t{\n\t\t.ctl_name = KERN_NMI_WATCHDOG,\n\t\t.procname = \"nmi_watchdog\",\n\t\t.data = &nmi_watchdog_enabled,\n\t\t.maxlen = sizeof (int),\n\t\t.mode = 0644,\n\t\t.proc_handler = &proc_nmi_enabled,\n\t},\n#endif\n#endif\n#if defined(CONFIG_X86)\n\t{\n\t\t.ctl_name\t= KERN_PANIC_ON_NMI,\n\t\t.procname\t= \"panic_on_unrecovered_nmi\",\n\t\t.data\t\t= &panic_on_unrecovered_nmi,\n\t\t.maxlen\t\t= sizeof(int),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &proc_dointvec,\n\t},\n\t{\n\t\t.ctl_name\t= KERN_BOOTLOADER_TYPE,\n\t\t.procname\t= \"bootloader_type\",\n\t\t.data\t\t= &bootloader_type,\n\t\t.maxlen\t\t= sizeof (int),\n\t\t.mode\t\t= 0444,\n\t\t.proc_handler\t= &proc_dointvec,\n\t},\n\t{\n\t\t.ctl_name\t= CTL_UNNUMBERED,\n\t\t.procname\t= \"kstack_depth_to_print\",\n\t\t.data\t\t= &kstack_depth_to_print,\n\t\t.maxlen\t\t= sizeof(int),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &proc_dointvec,\n\t},\n#endif\n#if defined(CONFIG_MMU)\n\t{\n\t\t.ctl_name\t= KERN_RANDOMIZE,\n\t\t.procname\t= \"randomize_va_space\",\n\t\t.data\t\t= &randomize_va_space,\n\t\t.maxlen\t\t= sizeof(int),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &proc_dointvec,\n\t},\n#endif\n\t{\n\t\t.ctl_name\t= KERN_SETUID_DUMPABLE,\n\t\t.procname\t= \"suid_dumpable\",\n\t\t.data\t\t= &suid_dumpable,\n\t\t.maxlen\t\t= sizeof(int),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &proc_dointvec,\n\t},\n#if defined(CONFIG_S390) && defined(CONFIG_SMP)\n\t{\n\t\t.ctl_name\t= KERN_SPIN_RETRY,\n\t\t.procname\t= \"spin_retry\",\n\t\t.data\t\t= &spin_retry,\n\t\t.maxlen\t\t= sizeof (int),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &proc_dointvec,\n\t},\n#endif\n#ifdef CONFIG_ACPI_SLEEP\n\t{\n\t\t.ctl_name\t= KERN_ACPI_VIDEO_FLAGS,\n\t\t.procname\t= \"acpi_video_flags\",\n\t\t.data\t\t= &acpi_video_flags,\n\t\t.maxlen\t\t= sizeof (unsigned long),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &proc_doulongvec_minmax,\n\t},\n#endif\n#ifdef CONFIG_IA64\n\t{\n\t\t.ctl_name\t= KERN_IA64_UNALIGNED,\n\t\t.procname\t= \"ignore-unaligned-usertrap\",\n\t\t.data\t\t= &no_unaligned_warning,\n\t\t.maxlen\t\t= sizeof (int),\n\t \t.mode\t\t= 0644,\n\t\t.proc_handler\t= &proc_dointvec,\n\t},\n#endif\n#ifdef CONFIG_COMPAT\n\t{\n\t\t.ctl_name\t= KERN_COMPAT_LOG,\n\t\t.procname\t= \"compat-log\",\n\t\t.data\t\t= &compat_log,\n\t\t.maxlen\t\t= sizeof (int),\n\t \t.mode\t\t= 0644,\n\t\t.proc_handler\t= &proc_dointvec,\n\t},\n#endif\n#ifdef CONFIG_RT_MUTEXES\n\t{\n\t\t.ctl_name\t= KERN_MAX_LOCK_DEPTH,\n\t\t.procname\t= \"max_lock_depth\",\n\t\t.data\t\t= &max_lock_depth,\n\t\t.maxlen\t\t= sizeof(int),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &proc_dointvec,\n\t},\n#endif\n#ifdef CONFIG_PROC_FS\n\t{\n\t\t.ctl_name = CTL_UNNUMBERED,\n\t\t.procname = \"maps_protect\",\n\t\t.data = &maps_protect,\n\t\t.maxlen = sizeof(int),\n\t\t.mode = 0644,\n\t\t.proc_handler = &proc_dointvec,\n\t},\n#endif\n\n\t{ .ctl_name = 0 }\n};\n\n/* Constants for minimum and maximum testing in vm_table.\n We use these as one-element integer vectors. */\nstatic int zero;\nstatic int one_hundred = 100;\n\n\nstatic ctl_table vm_table[] = {\n\t{\n\t\t.ctl_name\t= VM_OVERCOMMIT_MEMORY,\n\t\t.procname\t= \"overcommit_memory\",\n\t\t.data\t\t= &sysctl_overcommit_memory,\n\t\t.maxlen\t\t= sizeof(sysctl_overcommit_memory),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &proc_dointvec,\n\t},\n\t{\n\t\t.ctl_name\t= VM_PANIC_ON_OOM,\n\t\t.procname\t= \"panic_on_oom\",\n\t\t.data\t\t= &sysctl_panic_on_oom,\n\t\t.maxlen\t\t= sizeof(sysctl_panic_on_oom),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &proc_dointvec,\n\t},\n\t{\n\t\t.ctl_name\t= VM_OVERCOMMIT_RATIO,\n\t\t.procname\t= \"overcommit_ratio\",\n\t\t.data\t\t= &sysctl_overcommit_ratio,\n\t\t.maxlen\t\t= sizeof(sysctl_overcommit_ratio),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &proc_dointvec,\n\t},\n\t{\n\t\t.ctl_name\t= VM_PAGE_CLUSTER,\n\t\t.procname\t= \"page-cluster\", \n\t\t.data\t\t= &page_cluster,\n\t\t.maxlen\t\t= sizeof(int),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &proc_dointvec,\n\t},\n\t{\n\t\t.ctl_name\t= VM_DIRTY_BACKGROUND,\n\t\t.procname\t= \"dirty_background_ratio\",\n\t\t.data\t\t= &dirty_background_ratio,\n\t\t.maxlen\t\t= sizeof(dirty_background_ratio),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &proc_dointvec_minmax,\n\t\t.strategy\t= &sysctl_intvec,\n\t\t.extra1\t\t= &zero,\n\t\t.extra2\t\t= &one_hundred,\n\t},\n\t{\n\t\t.ctl_name\t= VM_DIRTY_RATIO,\n\t\t.procname\t= \"dirty_ratio\",\n\t\t.data\t\t= &vm_dirty_ratio,\n\t\t.maxlen\t\t= sizeof(vm_dirty_ratio),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &proc_dointvec_minmax,\n\t\t.strategy\t= &sysctl_intvec,\n\t\t.extra1\t\t= &zero,\n\t\t.extra2\t\t= &one_hundred,\n\t},\n\t{\n\t\t.ctl_name\t= VM_DIRTY_WB_CS,\n\t\t.procname\t= \"dirty_writeback_centisecs\",\n\t\t.data\t\t= &dirty_writeback_interval,\n\t\t.maxlen\t\t= sizeof(dirty_writeback_interval),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &dirty_writeback_centisecs_handler,\n\t},\n\t{\n\t\t.ctl_name\t= VM_DIRTY_EXPIRE_CS,\n\t\t.procname\t= \"dirty_expire_centisecs\",\n\t\t.data\t\t= &dirty_expire_interval,\n\t\t.maxlen\t\t= sizeof(dirty_expire_interval),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &proc_dointvec_userhz_jiffies,\n\t},\n\t{\n\t\t.ctl_name\t= VM_NR_PDFLUSH_THREADS,\n\t\t.procname\t= \"nr_pdflush_threads\",\n\t\t.data\t\t= &nr_pdflush_threads,\n\t\t.maxlen\t\t= sizeof nr_pdflush_threads,\n\t\t.mode\t\t= 0444 /* read-only*/,\n\t\t.proc_handler\t= &proc_dointvec,\n\t},\n\t{\n\t\t.ctl_name\t= VM_SWAPPINESS,\n\t\t.procname\t= \"swappiness\",\n\t\t.data\t\t= &vm_swappiness,\n\t\t.maxlen\t\t= sizeof(vm_swappiness),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &proc_dointvec_minmax,\n\t\t.strategy\t= &sysctl_intvec,\n\t\t.extra1\t\t= &zero,\n\t\t.extra2\t\t= &one_hundred,\n\t},\n#ifdef CONFIG_HUGETLB_PAGE\n\t {\n\t\t.ctl_name\t= VM_HUGETLB_PAGES,\n\t\t.procname\t= \"nr_hugepages\",\n\t\t.data\t\t= &max_huge_pages,\n\t\t.maxlen\t\t= sizeof(unsigned long),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &hugetlb_sysctl_handler,\n\t\t.extra1\t\t= (void *)&hugetlb_zero,\n\t\t.extra2\t\t= (void *)&hugetlb_infinity,\n\t },\n\t {\n\t\t.ctl_name\t= VM_HUGETLB_GROUP,\n\t\t.procname\t= \"hugetlb_shm_group\",\n\t\t.data\t\t= &sysctl_hugetlb_shm_group,\n\t\t.maxlen\t\t= sizeof(gid_t),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &proc_dointvec,\n\t },\n#endif\n\t{\n\t\t.ctl_name\t= VM_LOWMEM_RESERVE_RATIO,\n\t\t.procname\t= \"lowmem_reserve_ratio\",\n\t\t.data\t\t= &sysctl_lowmem_reserve_ratio,\n\t\t.maxlen\t\t= sizeof(sysctl_lowmem_reserve_ratio),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &lowmem_reserve_ratio_sysctl_handler,\n\t\t.strategy\t= &sysctl_intvec,\n\t},\n\t{\n\t\t.ctl_name\t= VM_DROP_PAGECACHE,\n\t\t.procname\t= \"drop_caches\",\n\t\t.data\t\t= &sysctl_drop_caches,\n\t\t.maxlen\t\t= sizeof(int),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= drop_caches_sysctl_handler,\n\t\t.strategy\t= &sysctl_intvec,\n\t},\n\t{\n\t\t.ctl_name\t= VM_MIN_FREE_KBYTES,\n\t\t.procname\t= \"min_free_kbytes\",\n\t\t.data\t\t= &min_free_kbytes,\n\t\t.maxlen\t\t= sizeof(min_free_kbytes),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &min_free_kbytes_sysctl_handler,\n\t\t.strategy\t= &sysctl_intvec,\n\t\t.extra1\t\t= &zero,\n\t},\n\t{\n\t\t.ctl_name\t= VM_PERCPU_PAGELIST_FRACTION,\n\t\t.procname\t= \"percpu_pagelist_fraction\",\n\t\t.data\t\t= &percpu_pagelist_fraction,\n\t\t.maxlen\t\t= sizeof(percpu_pagelist_fraction),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &percpu_pagelist_fraction_sysctl_handler,\n\t\t.strategy\t= &sysctl_intvec,\n\t\t.extra1\t\t= &min_percpu_pagelist_fract,\n\t},\n#ifdef CONFIG_MMU\n\t{\n\t\t.ctl_name\t= VM_MAX_MAP_COUNT,\n\t\t.procname\t= \"max_map_count\",\n\t\t.data\t\t= &sysctl_max_map_count,\n\t\t.maxlen\t\t= sizeof(sysctl_max_map_count),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &proc_dointvec\n\t},\n#endif\n\t{\n\t\t.ctl_name\t= VM_LAPTOP_MODE,\n\t\t.procname\t= \"laptop_mode\",\n\t\t.data\t\t= &laptop_mode,\n\t\t.maxlen\t\t= sizeof(laptop_mode),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &proc_dointvec_jiffies,\n\t\t.strategy\t= &sysctl_jiffies,\n\t},\n\t{\n\t\t.ctl_name\t= VM_BLOCK_DUMP,\n\t\t.procname\t= \"block_dump\",\n\t\t.data\t\t= &block_dump,\n\t\t.maxlen\t\t= sizeof(block_dump),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &proc_dointvec,\n\t\t.strategy\t= &sysctl_intvec,\n\t\t.extra1\t\t= &zero,\n\t},\n\t{\n\t\t.ctl_name\t= VM_VFS_CACHE_PRESSURE,\n\t\t.procname\t= \"vfs_cache_pressure\",\n\t\t.data\t\t= &sysctl_vfs_cache_pressure,\n\t\t.maxlen\t\t= sizeof(sysctl_vfs_cache_pressure),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &proc_dointvec,\n\t\t.strategy\t= &sysctl_intvec,\n\t\t.extra1\t\t= &zero,\n\t},\n#ifdef HAVE_ARCH_PICK_MMAP_LAYOUT\n\t{\n\t\t.ctl_name\t= VM_LEGACY_VA_LAYOUT,\n\t\t.procname\t= \"legacy_va_layout\",\n\t\t.data\t\t= &sysctl_legacy_va_layout,\n\t\t.maxlen\t\t= sizeof(sysctl_legacy_va_layout),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &proc_dointvec,\n\t\t.strategy\t= &sysctl_intvec,\n\t\t.extra1\t\t= &zero,\n\t},\n#endif\n#ifdef CONFIG_NUMA\n\t{\n\t\t.ctl_name\t= VM_ZONE_RECLAIM_MODE,\n\t\t.procname\t= \"zone_reclaim_mode\",\n\t\t.data\t\t= &zone_reclaim_mode,\n\t\t.maxlen\t\t= sizeof(zone_reclaim_mode),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &proc_dointvec,\n\t\t.strategy\t= &sysctl_intvec,\n\t\t.extra1\t\t= &zero,\n\t},\n\t{\n\t\t.ctl_name\t= VM_MIN_UNMAPPED,\n\t\t.procname\t= \"min_unmapped_ratio\",\n\t\t.data\t\t= &sysctl_min_unmapped_ratio,\n\t\t.maxlen\t\t= sizeof(sysctl_min_unmapped_ratio),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &sysctl_min_unmapped_ratio_sysctl_handler,\n\t\t.strategy\t= &sysctl_intvec,\n\t\t.extra1\t\t= &zero,\n\t\t.extra2\t\t= &one_hundred,\n\t},\n\t{\n\t\t.ctl_name\t= VM_MIN_SLAB,\n\t\t.procname\t= \"min_slab_ratio\",\n\t\t.data\t\t= &sysctl_min_slab_ratio,\n\t\t.maxlen\t\t= sizeof(sysctl_min_slab_ratio),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &sysctl_min_slab_ratio_sysctl_handler,\n\t\t.strategy\t= &sysctl_intvec,\n\t\t.extra1\t\t= &zero,\n\t\t.extra2\t\t= &one_hundred,\n\t},\n#endif\n#ifdef CONFIG_SMP\n\t{\n\t\t.ctl_name\t= CTL_UNNUMBERED,\n\t\t.procname\t= \"stat_interval\",\n\t\t.data\t\t= &sysctl_stat_interval,\n\t\t.maxlen\t\t= sizeof(sysctl_stat_interval),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &proc_dointvec_jiffies,\n\t\t.strategy\t= &sysctl_jiffies,\n\t},\n#endif\n#if defined(CONFIG_X86_32) || \\\n (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL))\n\t{\n\t\t.ctl_name\t= VM_VDSO_ENABLED,\n\t\t.procname\t= \"vdso_enabled\",\n\t\t.data\t\t= &vdso_enabled,\n\t\t.maxlen\t\t= sizeof(vdso_enabled),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &proc_dointvec,\n\t\t.strategy\t= &sysctl_intvec,\n\t\t.extra1\t\t= &zero,\n\t},\n#endif\n#ifdef CONFIG_SMP\n\t{\n\t\t.ctl_name\t= -2,\n\t\t.procname\t= \"affinity_load_balancing\",\n\t\t.data\t\t= &affinity_load_balancing,\n\t\t.maxlen\t\t= sizeof(affinity_load_balancing),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &proc_dointvec,\n\t},\n#endif\n\t{ .ctl_name = 0 }\n};\n\n#if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)\nstatic ctl_table binfmt_misc_table[] = {\n\t{ .ctl_name = 0 }\n};\n#endif\n\nstatic ctl_table fs_table[] = {\n\t{\n\t\t.ctl_name\t= FS_NRINODE,\n\t\t.procname\t= \"inode-nr\",\n\t\t.data\t\t= &inodes_stat,\n\t\t.maxlen\t\t= 2*sizeof(int),\n\t\t.mode\t\t= 0444,\n\t\t.proc_handler\t= &proc_dointvec,\n\t},\n\t{\n\t\t.ctl_name\t= FS_STATINODE,\n\t\t.procname\t= \"inode-state\",\n\t\t.data\t\t= &inodes_stat,\n\t\t.maxlen\t\t= 7*sizeof(int),\n\t\t.mode\t\t= 0444,\n\t\t.proc_handler\t= &proc_dointvec,\n\t},\n\t{\n\t\t.ctl_name\t= FS_NRFILE,\n\t\t.procname\t= \"file-nr\",\n\t\t.data\t\t= &files_stat,\n\t\t.maxlen\t\t= 3*sizeof(int),\n\t\t.mode\t\t= 0444,\n\t\t.proc_handler\t= &proc_nr_files,\n\t},\n\t{\n\t\t.ctl_name\t= FS_MAXFILE,\n\t\t.procname\t= \"file-max\",\n\t\t.data\t\t= &files_stat.max_files,\n\t\t.maxlen\t\t= sizeof(int),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &proc_dointvec,\n\t},\n\t{\n\t\t.ctl_name\t= FS_DENTRY,\n\t\t.procname\t= \"dentry-state\",\n\t\t.data\t\t= &dentry_stat,\n\t\t.maxlen\t\t= 6*sizeof(int),\n\t\t.mode\t\t= 0444,\n\t\t.proc_handler\t= &proc_dointvec,\n\t},\n\t{\n\t\t.ctl_name\t= FS_OVERFLOWUID,\n\t\t.procname\t= \"overflowuid\",\n\t\t.data\t\t= &fs_overflowuid,\n\t\t.maxlen\t\t= sizeof(int),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &proc_dointvec_minmax,\n\t\t.strategy\t= &sysctl_intvec,\n\t\t.extra1\t\t= &minolduid,\n\t\t.extra2\t\t= &maxolduid,\n\t},\n\t{\n\t\t.ctl_name\t= FS_OVERFLOWGID,\n\t\t.procname\t= \"overflowgid\",\n\t\t.data\t\t= &fs_overflowgid,\n\t\t.maxlen\t\t= sizeof(int),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &proc_dointvec_minmax,\n\t\t.strategy\t= &sysctl_intvec,\n\t\t.extra1\t\t= &minolduid,\n\t\t.extra2\t\t= &maxolduid,\n\t},\n\t{\n\t\t.ctl_name\t= FS_LEASES,\n\t\t.procname\t= \"leases-enable\",\n\t\t.data\t\t= &leases_enable,\n\t\t.maxlen\t\t= sizeof(int),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &proc_dointvec,\n\t},\n#ifdef CONFIG_DNOTIFY\n\t{\n\t\t.ctl_name\t= FS_DIR_NOTIFY,\n\t\t.procname\t= \"dir-notify-enable\",\n\t\t.data\t\t= &dir_notify_enable,\n\t\t.maxlen\t\t= sizeof(int),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &proc_dointvec,\n\t},\n#endif\n#ifdef CONFIG_MMU\n\t{\n\t\t.ctl_name\t= FS_LEASE_TIME,\n\t\t.procname\t= \"lease-break-time\",\n\t\t.data\t\t= &lease_break_time,\n\t\t.maxlen\t\t= sizeof(int),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &proc_dointvec,\n\t},\n\t{\n\t\t.ctl_name\t= FS_AIO_NR,\n\t\t.procname\t= \"aio-nr\",\n\t\t.data\t\t= &aio_nr,\n\t\t.maxlen\t\t= sizeof(aio_nr),\n\t\t.mode\t\t= 0444,\n\t\t.proc_handler\t= &proc_doulongvec_minmax,\n\t},\n\t{\n\t\t.ctl_name\t= FS_AIO_MAX_NR,\n\t\t.procname\t= \"aio-max-nr\",\n\t\t.data\t\t= &aio_max_nr,\n\t\t.maxlen\t\t= sizeof(aio_max_nr),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &proc_doulongvec_minmax,\n\t},\n#ifdef CONFIG_INOTIFY_USER\n\t{\n\t\t.ctl_name\t= FS_INOTIFY,\n\t\t.procname\t= \"inotify\",\n\t\t.mode\t\t= 0555,\n\t\t.child\t\t= inotify_table,\n\t},\n#endif\t\n#endif\n\t{\n\t\t.ctl_name\t= KERN_SETUID_DUMPABLE,\n\t\t.procname\t= \"suid_dumpable\",\n\t\t.data\t\t= &suid_dumpable,\n\t\t.maxlen\t\t= sizeof(int),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= &proc_dointvec,\n\t},\n#if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)\n\t{\n\t\t.ctl_name\t= CTL_UNNUMBERED,\n\t\t.procname\t= \"binfmt_misc\",\n\t\t.mode\t\t= 0555,\n\t\t.child\t\t= binfmt_misc_table,\n\t},\n#endif\n\t{ .ctl_name = 0 }\n};\n\nstatic ctl_table debug_table[] = {\n\t{ .ctl_name = 0 }\n};\n\nstatic ctl_table dev_table[] = {\n\t{ .ctl_name = 0 }\n};\n\nstatic DEFINE_SPINLOCK(sysctl_lock);\n\n/* called under sysctl_lock */\nstatic int use_table(struct ctl_table_header *p)\n{\n\tif (unlikely(p->unregistering))\n\t\treturn 0;\n\tp->used++;\n\treturn 1;\n}\n\n/* called under sysctl_lock */\nstatic void unuse_table(struct ctl_table_header *p)\n{\n\tif (!--p->used)\n\t\tif (unlikely(p->unregistering))\n\t\t\tcomplete(p->unregistering);\n}\n\n/* called under sysctl_lock, will reacquire if has to wait */\nstatic void start_unregistering(struct ctl_table_header *p)\n{\n\t/*\n\t * if p->used is 0, nobody will ever touch that entry again;\n\t * we'll eliminate all paths to it before dropping sysctl_lock\n\t */\n\tif (unlikely(p->used)) {\n\t\tstruct completion wait;\n\t\tinit_completion(&wait);\n\t\tp->unregistering = &wait;\n\t\tspin_unlock(&sysctl_lock);\n\t\twait_for_completion(&wait);\n\t\tspin_lock(&sysctl_lock);\n\t}\n\t/*\n\t * do not remove from the list until nobody holds it; walking the\n\t * list in do_sysctl() relies on that.\n\t */\n\tlist_del_init(&p->ctl_entry);\n}\n\nvoid sysctl_head_finish(struct ctl_table_header *head)\n{\n\tif (!head)\n\t\treturn;\n\tspin_lock(&sysctl_lock);\n\tunuse_table(head);\n\tspin_unlock(&sysctl_lock);\n}\n\nstruct ctl_table_header *sysctl_head_next(struct ctl_table_header *prev)\n{\n\tstruct ctl_table_header *head;\n\tstruct list_head *tmp;\n\tspin_lock(&sysctl_lock);\n\tif (prev) {\n\t\ttmp = &prev->ctl_entry;\n\t\tunuse_table(prev);\n\t\tgoto next;\n\t}\n\ttmp = &root_table_header.ctl_entry;\n\tfor (;;) {\n\t\thead = list_entry(tmp, struct ctl_table_header, ctl_entry);\n\n\t\tif (!use_table(head))\n\t\t\tgoto next;\n\t\tspin_unlock(&sysctl_lock);\n\t\treturn head;\n\tnext:\n\t\ttmp = tmp->next;\n\t\tif (tmp == &root_table_header.ctl_entry)\n\t\t\tbreak;\n\t}\n\tspin_unlock(&sysctl_lock);\n\treturn NULL;\n}\n\nchar *sysctl_pathname(ctl_table *table, char *buffer, int buflen)\n{\n\tif (buflen < 1)\n\t\treturn NULL;\n\tbuffer += --buflen;\n\t*buffer = '\\0';\n\n\twhile (table) {\n\t\tint namelen = strlen(table->procname);\n\n\t\tif (buflen < namelen + 1)\n\t\t\treturn NULL;\n\t\tbuflen -= namelen + 1;\n\t\tbuffer -= namelen;\n\t\tmemcpy(buffer, table->procname, namelen);\n\t\t*--buffer = '/';\n\t\ttable = table->parent;\n\t}\n\tif (buflen < 4)\n\t\treturn NULL;\n\tbuffer -= 4;\n\tmemcpy(buffer, \"/sys\", 4);\n\n\treturn buffer;\n}\nEXPORT_SYMBOL(sysctl_pathname);\n\n#ifdef CONFIG_SYSCTL_SYSCALL\nint do_sysctl(int __user *name, int nlen, void __user *oldval, size_t __user *oldlenp,\n\t void __user *newval, size_t newlen)\n{\n\tstruct ctl_table_header *head;\n\tint error = -ENOTDIR;\n\n\tif (nlen <= 0 || nlen >= CTL_MAXNAME)\n\t\treturn -ENOTDIR;\n\tif (oldval) {\n\t\tint old_len;\n\t\tif (!oldlenp || get_user(old_len, oldlenp))\n\t\t\treturn -EFAULT;\n\t}\n\n\tfor (head = sysctl_head_next(NULL); head;\n\t\t\thead = sysctl_head_next(head)) {\n\t\terror = parse_table(name, nlen, oldval, oldlenp, \n\t\t\t\t\tnewval, newlen, head->ctl_table);\n\t\tif (error != -ENOTDIR) {\n\t\t\tsysctl_head_finish(head);\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn error;\n}\n\nasmlinkage long sys_sysctl(struct __sysctl_args __user *args)\n{\n\tstruct __sysctl_args tmp;\n\tint error;\n\n\tif (copy_from_user(&tmp, args, sizeof(tmp)))\n\t\treturn -EFAULT;\n\n\tlock_kernel();\n\terror = do_sysctl(tmp.name, tmp.nlen, tmp.oldval, tmp.oldlenp,\n\t\t\t tmp.newval, tmp.newlen);\n\tunlock_kernel();\n\treturn error;\n}\n#endif /* CONFIG_SYSCTL_SYSCALL */\n\n/*\n * sysctl_perm does NOT grant the superuser all rights automatically, because\n * some sysctl variables are readonly even to root.\n */\n\nstatic int test_perm(int mode, int op)\n{\n\tif (!current->euid)\n\t\tmode >>= 6;\n\telse if (in_egroup_p(0))\n\t\tmode >>= 3;\n\tif ((mode & op & 0007) == op)\n\t\treturn 0;\n\treturn -EACCES;\n}\n\nint sysctl_perm(ctl_table *table, int op)\n{\n\tint error;\n\terror = security_sysctl(table, op);\n\tif (error)\n\t\treturn error;\n\treturn test_perm(table->mode, op);\n}\n\n#ifdef CONFIG_SYSCTL_SYSCALL\nstatic int parse_table(int __user *name, int nlen,\n\t\t void __user *oldval, size_t __user *oldlenp,\n\t\t void __user *newval, size_t newlen,\n\t\t ctl_table *table)\n{\n\tint n;\nrepeat:\n\tif (!nlen)\n\t\treturn -ENOTDIR;\n\tif (get_user(n, name))\n\t\treturn -EFAULT;\n\tfor ( ; table->ctl_name || table->procname; table++) {\n\t\tif (!table->ctl_name)\n\t\t\tcontinue;\n\t\tif (n == table->ctl_name) {\n\t\t\tint error;\n\t\t\tif (table->child) {\n\t\t\t\tif (sysctl_perm(table, 001))\n\t\t\t\t\treturn -EPERM;\n\t\t\t\tname++;\n\t\t\t\tnlen--;\n\t\t\t\ttable = table->child;\n\t\t\t\tgoto repeat;\n\t\t\t}\n\t\t\terror = do_sysctl_strategy(table, name, nlen,\n\t\t\t\t\t\t oldval, oldlenp,\n\t\t\t\t\t\t newval, newlen);\n\t\t\treturn error;\n\t\t}\n\t}\n\treturn -ENOTDIR;\n}\n\n/* Perform the actual read/write of a sysctl table entry. */\nint do_sysctl_strategy (ctl_table *table, \n\t\t\tint __user *name, int nlen,\n\t\t\tvoid __user *oldval, size_t __user *oldlenp,\n\t\t\tvoid __user *newval, size_t newlen)\n{\n\tint op = 0, rc;\n\tsize_t len;\n\n\tif (oldval)\n\t\top |= 004;\n\tif (newval) \n\t\top |= 002;\n\tif (sysctl_perm(table, op))\n\t\treturn -EPERM;\n\n\tif (table->strategy) {\n\t\trc = table->strategy(table, name, nlen, oldval, oldlenp,\n\t\t\t\t newval, newlen);\n\t\tif (rc < 0)\n\t\t\treturn rc;\n\t\tif (rc > 0)\n\t\t\treturn 0;\n\t}\n\n\t/* If there is no strategy routine, or if the strategy returns\n\t * zero, proceed with automatic r/w */\n\tif (table->data && table->maxlen) {\n\t\tif (oldval && oldlenp) {\n\t\t\tif (get_user(len, oldlenp))\n\t\t\t\treturn -EFAULT;\n\t\t\tif (len) {\n\t\t\t\tif (len > table->maxlen)\n\t\t\t\t\tlen = table->maxlen;\n\t\t\t\tif(copy_to_user(oldval, table->data, len))\n\t\t\t\t\treturn -EFAULT;\n\t\t\t\tif(put_user(len, oldlenp))\n\t\t\t\t\treturn -EFAULT;\n\t\t\t}\n\t\t}\n\t\tif (newval && newlen) {\n\t\t\tlen = newlen;\n\t\t\tif (len > table->maxlen)\n\t\t\t\tlen = table->maxlen;\n\t\t\tif(copy_from_user(table->data, newval, len))\n\t\t\t\treturn -EFAULT;\n\t\t}\n\t}\n\treturn 0;\n}\n#endif /* CONFIG_SYSCTL_SYSCALL */\n\nstatic void sysctl_set_parent(struct ctl_table *parent, struct ctl_table *table)\n{\n\tfor (; table->ctl_name || table->procname; table++) {\n\t\ttable->parent = parent;\n\t\tif (table->child)\n\t\t\tsysctl_set_parent(table, table->child);\n\t}\n}\n\nstatic __init int sysctl_init(void)\n{\n\tsysctl_set_parent(NULL, root_table);\n\treturn 0;\n}\n\ncore_initcall(sysctl_init);\n\n/**\n * register_sysctl_table - register a sysctl hierarchy\n * @table: the top-level table structure\n *\n * Register a sysctl table hierarchy. @table should be a filled in ctl_table\n * array. An entry with a ctl_name of 0 terminates the table. \n *\n * The members of the &ctl_table structure are used as follows:\n *\n * ctl_name - This is the numeric sysctl value used by sysctl(2). The number\n * must be unique within that level of sysctl\n *\n * procname - the name of the sysctl file under /proc/sys. Set to %NULL to not\n * enter a sysctl file\n *\n * data - a pointer to data for use by proc_handler\n *\n * maxlen - the maximum size in bytes of the data\n *\n * mode - the file permissions for the /proc/sys file, and for sysctl(2)\n *\n * child - a pointer to the child sysctl table if this entry is a directory, or\n * %NULL.\n *\n * proc_handler - the text handler routine (described below)\n *\n * strategy - the strategy routine (described below)\n *\n * de - for internal use by the sysctl routines\n *\n * extra1, extra2 - extra pointers usable by the proc handler routines\n *\n * Leaf nodes in the sysctl tree will be represented by a single file\n * under /proc; non-leaf nodes will be represented by directories.\n *\n * sysctl(2) can automatically manage read and write requests through\n * the sysctl table. The data and maxlen fields of the ctl_table\n * struct enable minimal validation of the values being written to be\n * performed, and the mode field allows minimal authentication.\n *\n * More sophisticated management can be enabled by the provision of a\n * strategy routine with the table entry. This will be called before\n * any automatic read or write of the data is performed.\n *\n * The strategy routine may return\n *\n * < 0 - Error occurred (error is passed to user process)\n *\n * 0 - OK - proceed with automatic read or write.\n *\n * > 0 - OK - read or write has been done by the strategy routine, so\n * return immediately.\n *\n * There must be a proc_handler routine for any terminal nodes\n * mirrored under /proc/sys (non-terminals are handled by a built-in\n * directory handler). Several default handlers are available to\n * cover common cases -\n *\n * proc_dostring(), proc_dointvec(), proc_dointvec_jiffies(),\n * proc_dointvec_userhz_jiffies(), proc_dointvec_minmax(), \n * proc_doulongvec_ms_jiffies_minmax(), proc_doulongvec_minmax()\n *\n * It is the handler's job to read the input buffer from user memory\n * and process it. The handler should return 0 on success.\n *\n * This routine returns %NULL on a failure to register, and a pointer\n * to the table header on success.\n */\nstruct ctl_table_header *register_sysctl_table(ctl_table * table)\n{\n\tstruct ctl_table_header *tmp;\n\ttmp = kmalloc(sizeof(struct ctl_table_header), GFP_KERNEL);\n\tif (!tmp)\n\t\treturn NULL;\n\ttmp->ctl_table = table;\n\tINIT_LIST_HEAD(&tmp->ctl_entry);\n\ttmp->used = 0;\n\ttmp->unregistering = NULL;\n\tsysctl_set_parent(NULL, table);\n\tspin_lock(&sysctl_lock);\n\tlist_add_tail(&tmp->ctl_entry, &root_table_header.ctl_entry);\n\tspin_unlock(&sysctl_lock);\n\treturn tmp;\n}\n\n/**\n * unregister_sysctl_table - unregister a sysctl table hierarchy\n * @header: the header returned from register_sysctl_table\n *\n * Unregisters the sysctl table and all children. proc entries may not\n * actually be removed until they are no longer used by anyone.\n */\nvoid unregister_sysctl_table(struct ctl_table_header * header)\n{\n\tmight_sleep();\n\tspin_lock(&sysctl_lock);\n\tstart_unregistering(header);\n\tspin_unlock(&sysctl_lock);\n\tkfree(header);\n}\n\n#else /* !CONFIG_SYSCTL */\nstruct ctl_table_header *register_sysctl_table(ctl_table * table)\n{\n\treturn NULL;\n}\n\nvoid unregister_sysctl_table(struct ctl_table_header * table)\n{\n}\n\n#endif /* CONFIG_SYSCTL */\n\n/*\n * /proc/sys support\n */\n\n#ifdef CONFIG_PROC_SYSCTL\n\nstatic int _proc_do_string(void* data, int maxlen, int write,\n\t\t\t struct file *filp, void __user *buffer,\n\t\t\t size_t *lenp, loff_t *ppos)\n{\n\tsize_t len;\n\tchar __user *p;\n\tchar c;\n\n\tif (!data || !maxlen || !*lenp) {\n\t\t*lenp = 0;\n\t\treturn 0;\n\t}\n\n\tif (write) {\n\t\tlen = 0;\n\t\tp = buffer;\n\t\twhile (len < *lenp) {\n\t\t\tif (get_user(c, p++))\n\t\t\t\treturn -EFAULT;\n\t\t\tif (c == 0 || c == '\\n')\n\t\t\t\tbreak;\n\t\t\tlen++;\n\t\t}\n\t\tif (len >= maxlen)\n\t\t\tlen = maxlen-1;\n\t\tif(copy_from_user(data, buffer, len))\n\t\t\treturn -EFAULT;\n\t\t((char *) data)[len] = 0;\n\t\t*ppos += *lenp;\n\t} else {\n\t\tlen = strlen(data);\n\t\tif (len > maxlen)\n\t\t\tlen = maxlen;\n\n\t\tif (*ppos > len) {\n\t\t\t*lenp = 0;\n\t\t\treturn 0;\n\t\t}\n\n\t\tdata += *ppos;\n\t\tlen -= *ppos;\n\n\t\tif (len > *lenp)\n\t\t\tlen = *lenp;\n\t\tif (len)\n\t\t\tif(copy_to_user(buffer, data, len))\n\t\t\t\treturn -EFAULT;\n\t\tif (len < *lenp) {\n\t\t\tif(put_user('\\n', ((char __user *) buffer) + len))\n\t\t\t\treturn -EFAULT;\n\t\t\tlen++;\n\t\t}\n\t\t*lenp = len;\n\t\t*ppos += len;\n\t}\n\treturn 0;\n}\n\n/**\n * proc_dostring - read a string sysctl\n * @table: the sysctl table\n * @write: %TRUE if this is a write to the sysctl file\n * @filp: the file structure\n * @buffer: the user buffer\n * @lenp: the size of the user buffer\n * @ppos: file position\n *\n * Reads/writes a string from/to the user buffer. If the kernel\n * buffer provided is not large enough to hold the string, the\n * string is truncated. The copied string is %NULL-terminated.\n * If the string is being read by the user process, it is copied\n * and a newline '\\n' is added. It is truncated if the buffer is\n * not large enough.\n *\n * Returns 0 on success.\n */\nint proc_dostring(ctl_table *table, int write, struct file *filp,\n\t\t void __user *buffer, size_t *lenp, loff_t *ppos)\n{\n\treturn _proc_do_string(table->data, table->maxlen, write, filp,\n\t\t\t buffer, lenp, ppos);\n}\n\n\nstatic int do_proc_dointvec_conv(int *negp, unsigned long *lvalp,\n\t\t\t\t int *valp,\n\t\t\t\t int write, void *data)\n{\n\tif (write) {\n\t\t*valp = *negp ? -*lvalp : *lvalp;\n\t} else {\n\t\tint val = *valp;\n\t\tif (val < 0) {\n\t\t\t*negp = -1;\n\t\t\t*lvalp = (unsigned long)-val;\n\t\t} else {\n\t\t\t*negp = 0;\n\t\t\t*lvalp = (unsigned long)val;\n\t\t}\n\t}\n\treturn 0;\n}\n\nstatic int __do_proc_dointvec(void *tbl_data, ctl_table *table,\n\t\t int write, struct file *filp, void __user *buffer,\n\t\t size_t *lenp, loff_t *ppos,\n\t\t int (*conv)(int *negp, unsigned long *lvalp, int *valp,\n\t\t\t int write, void *data),\n\t\t void *data)\n{\n#define TMPBUFLEN 21\n\tint *i, vleft, first=1, neg, val;\n\tunsigned long lval;\n\tsize_t left, len;\n\t\n\tchar buf[TMPBUFLEN], *p;\n\tchar __user *s = buffer;\n\t\n\tif (!tbl_data || !table->maxlen || !*lenp ||\n\t (*ppos && !write)) {\n\t\t*lenp = 0;\n\t\treturn 0;\n\t}\n\t\n\ti = (int *) tbl_data;\n\tvleft = table->maxlen / sizeof(*i);\n\tleft = *lenp;\n\n\tif (!conv)\n\t\tconv = do_proc_dointvec_conv;\n\n\tfor (; left && vleft--; i++, first=0) {\n\t\tif (write) {\n\t\t\twhile (left) {\n\t\t\t\tchar c;\n\t\t\t\tif (get_user(c, s))\n\t\t\t\t\treturn -EFAULT;\n\t\t\t\tif (!isspace(c))\n\t\t\t\t\tbreak;\n\t\t\t\tleft--;\n\t\t\t\ts++;\n\t\t\t}\n\t\t\tif (!left)\n\t\t\t\tbreak;\n\t\t\tneg = 0;\n\t\t\tlen = left;\n\t\t\tif (len > sizeof(buf) - 1)\n\t\t\t\tlen = sizeof(buf) - 1;\n\t\t\tif (copy_from_user(buf, s, len))\n\t\t\t\treturn -EFAULT;\n\t\t\tbuf[len] = 0;\n\t\t\tp = buf;\n\t\t\tif (*p == '-' && left > 1) {\n\t\t\t\tneg = 1;\n\t\t\t\tp++;\n\t\t\t}\n\t\t\tif (*p < '0' || *p > '9')\n\t\t\t\tbreak;\n\n\t\t\tlval = simple_strtoul(p, &p, 0);\n\n\t\t\tlen = p-buf;\n\t\t\tif ((len < left) && *p && !isspace(*p))\n\t\t\t\tbreak;\n\t\t\tif (neg)\n\t\t\t\tval = -val;\n\t\t\ts += len;\n\t\t\tleft -= len;\n\n\t\t\tif (conv(&neg, &lval, i, 1, data))\n\t\t\t\tbreak;\n\t\t} else {\n\t\t\tp = buf;\n\t\t\tif (!first)\n\t\t\t\t*p++ = '\\t';\n\t\n\t\t\tif (conv(&neg, &lval, i, 0, data))\n\t\t\t\tbreak;\n\n\t\t\tsprintf(p, \"%s%lu\", neg ? \"-\" : \"\", lval);\n\t\t\tlen = strlen(buf);\n\t\t\tif (len > left)\n\t\t\t\tlen = left;\n\t\t\tif(copy_to_user(s, buf, len))\n\t\t\t\treturn -EFAULT;\n\t\t\tleft -= len;\n\t\t\ts += len;\n\t\t}\n\t}\n\n\tif (!write && !first && left) {\n\t\tif(put_user('\\n', s))\n\t\t\treturn -EFAULT;\n\t\tleft--, s++;\n\t}\n\tif (write) {\n\t\twhile (left) {\n\t\t\tchar c;\n\t\t\tif (get_user(c, s++))\n\t\t\t\treturn -EFAULT;\n\t\t\tif (!isspace(c))\n\t\t\t\tbreak;\n\t\t\tleft--;\n\t\t}\n\t}\n\tif (write && first)\n\t\treturn -EINVAL;\n\t*lenp -= left;\n\t*ppos += *lenp;\n\treturn 0;\n#undef TMPBUFLEN\n}\n\nstatic int do_proc_dointvec(ctl_table *table, int write, struct file *filp,\n\t\t void __user *buffer, size_t *lenp, loff_t *ppos,\n\t\t int (*conv)(int *negp, unsigned long *lvalp, int *valp,\n\t\t\t int write, void *data),\n\t\t void *data)\n{\n\treturn __do_proc_dointvec(table->data, table, write, filp,\n\t\t\tbuffer, lenp, ppos, conv, data);\n}\n\n/**\n * proc_dointvec - read a vector of integers\n * @table: the sysctl table\n * @write: %TRUE if this is a write to the sysctl file\n * @filp: the file structure\n * @buffer: the user buffer\n * @lenp: the size of the user buffer\n * @ppos: file position\n *\n * Reads/writes up to table->maxlen/sizeof(unsigned int) integer\n * values from/to the user buffer, treated as an ASCII string. \n *\n * Returns 0 on success.\n */\nint proc_dointvec(ctl_table *table, int write, struct file *filp,\n\t\t void __user *buffer, size_t *lenp, loff_t *ppos)\n{\n return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,\n\t\t \t NULL,NULL);\n}\n\n#define OP_SET\t0\n#define OP_AND\t1\n#define OP_OR\t2\n\nstatic int do_proc_dointvec_bset_conv(int *negp, unsigned long *lvalp,\n\t\t\t\t int *valp,\n\t\t\t\t int write, void *data)\n{\n\tint op = *(int *)data;\n\tif (write) {\n\t\tint val = *negp ? -*lvalp : *lvalp;\n\t\tswitch(op) {\n\t\tcase OP_SET:\t*valp = val; break;\n\t\tcase OP_AND:\t*valp &= val; break;\n\t\tcase OP_OR:\t*valp |= val; break;\n\t\t}\n\t} else {\n\t\tint val = *valp;\n\t\tif (val < 0) {\n\t\t\t*negp = -1;\n\t\t\t*lvalp = (unsigned long)-val;\n\t\t} else {\n\t\t\t*negp = 0;\n\t\t\t*lvalp = (unsigned long)val;\n\t\t}\n\t}\n\treturn 0;\n}\n\n/*\n *\tinit may raise the set.\n */\n \nint proc_dointvec_bset(ctl_table *table, int write, struct file *filp,\n\t\t\tvoid __user *buffer, size_t *lenp, loff_t *ppos)\n{\n\tint op;\n\n\tif (write && !capable(CAP_SYS_MODULE)) {\n\t\treturn -EPERM;\n\t}\n\n\top = is_init(current) ? OP_SET : OP_AND;\n\treturn do_proc_dointvec(table,write,filp,buffer,lenp,ppos,\n\t\t\t\tdo_proc_dointvec_bset_conv,&op);\n}\n\n/*\n *\tTaint values can only be increased\n */\nstatic int proc_dointvec_taint(ctl_table *table, int write, struct file *filp,\n\t\t\t void __user *buffer, size_t *lenp, loff_t *ppos)\n{\n\tint op;\n\n\tif (write && !capable(CAP_SYS_ADMIN))\n\t\treturn -EPERM;\n\n\top = OP_OR;\n\treturn do_proc_dointvec(table,write,filp,buffer,lenp,ppos,\n\t\t\t\tdo_proc_dointvec_bset_conv,&op);\n}\n\nstruct do_proc_dointvec_minmax_conv_param {\n\tint *min;\n\tint *max;\n};\n\nstatic int do_proc_dointvec_minmax_conv(int *negp, unsigned long *lvalp, \n\t\t\t\t\tint *valp, \n\t\t\t\t\tint write, void *data)\n{\n\tstruct do_proc_dointvec_minmax_conv_param *param = data;\n\tif (write) {\n\t\tint val = *negp ? -*lvalp : *lvalp;\n\t\tif ((param->min && *param->min > val) ||\n\t\t (param->max && *param->max < val))\n\t\t\treturn -EINVAL;\n\t\t*valp = val;\n\t} else {\n\t\tint val = *valp;\n\t\tif (val < 0) {\n\t\t\t*negp = -1;\n\t\t\t*lvalp = (unsigned long)-val;\n\t\t} else {\n\t\t\t*negp = 0;\n\t\t\t*lvalp = (unsigned long)val;\n\t\t}\n\t}\n\treturn 0;\n}\n\n/**\n * proc_dointvec_minmax - read a vector of integers with min/max values\n * @table: the sysctl table\n * @write: %TRUE if this is a write to the sysctl file\n * @filp: the file structure\n * @buffer: the user buffer\n * @lenp: the size of the user buffer\n * @ppos: file position\n *\n * Reads/writes up to table->maxlen/sizeof(unsigned int) integer\n * values from/to the user buffer, treated as an ASCII string.\n *\n * This routine will ensure the values are within the range specified by\n * table->extra1 (min) and table->extra2 (max).\n *\n * Returns 0 on success.\n */\nint proc_dointvec_minmax(ctl_table *table, int write, struct file *filp,\n\t\t void __user *buffer, size_t *lenp, loff_t *ppos)\n{\n\tstruct do_proc_dointvec_minmax_conv_param param = {\n\t\t.min = (int *) table->extra1,\n\t\t.max = (int *) table->extra2,\n\t};\n\treturn do_proc_dointvec(table, write, filp, buffer, lenp, ppos,\n\t\t\t\tdo_proc_dointvec_minmax_conv, &param);\n}\n\nstatic int __do_proc_doulongvec_minmax(void *data, ctl_table *table, int write,\n\t\t\t\t struct file *filp,\n\t\t\t\t void __user *buffer,\n\t\t\t\t size_t *lenp, loff_t *ppos,\n\t\t\t\t unsigned long convmul,\n\t\t\t\t unsigned long convdiv)\n{\n#define TMPBUFLEN 21\n\tunsigned long *i, *min, *max, val;\n\tint vleft, first=1, neg;\n\tsize_t len, left;\n\tchar buf[TMPBUFLEN], *p;\n\tchar __user *s = buffer;\n\t\n\tif (!data || !table->maxlen || !*lenp ||\n\t (*ppos && !write)) {\n\t\t*lenp = 0;\n\t\treturn 0;\n\t}\n\t\n\ti = (unsigned long *) data;\n\tmin = (unsigned long *) table->extra1;\n\tmax = (unsigned long *) table->extra2;\n\tvleft = table->maxlen / sizeof(unsigned long);\n\tleft = *lenp;\n\t\n\tfor (; left && vleft--; i++, min++, max++, first=0) {\n\t\tif (write) {\n\t\t\twhile (left) {\n\t\t\t\tchar c;\n\t\t\t\tif (get_user(c, s))\n\t\t\t\t\treturn -EFAULT;\n\t\t\t\tif (!isspace(c))\n\t\t\t\t\tbreak;\n\t\t\t\tleft--;\n\t\t\t\ts++;\n\t\t\t}\n\t\t\tif (!left)\n\t\t\t\tbreak;\n\t\t\tneg = 0;\n\t\t\tlen = left;\n\t\t\tif (len > TMPBUFLEN-1)\n\t\t\t\tlen = TMPBUFLEN-1;\n\t\t\tif (copy_from_user(buf, s, len))\n\t\t\t\treturn -EFAULT;\n\t\t\tbuf[len] = 0;\n\t\t\tp = buf;\n\t\t\tif (*p == '-' && left > 1) {\n\t\t\t\tneg = 1;\n\t\t\t\tp++;\n\t\t\t}\n\t\t\tif (*p < '0' || *p > '9')\n\t\t\t\tbreak;\n\t\t\tval = simple_strtoul(p, &p, 0) * convmul / convdiv ;\n\t\t\tlen = p-buf;\n\t\t\tif ((len < left) && *p && !isspace(*p))\n\t\t\t\tbreak;\n\t\t\tif (neg)\n\t\t\t\tval = -val;\n\t\t\ts += len;\n\t\t\tleft -= len;\n\n\t\t\tif(neg)\n\t\t\t\tcontinue;\n\t\t\tif ((min && val < *min) || (max && val > *max))\n\t\t\t\tcontinue;\n\t\t\t*i = val;\n\t\t} else {\n\t\t\tp = buf;\n\t\t\tif (!first)\n\t\t\t\t*p++ = '\\t';\n\t\t\tsprintf(p, \"%lu\", convdiv * (*i) / convmul);\n\t\t\tlen = strlen(buf);\n\t\t\tif (len > left)\n\t\t\t\tlen = left;\n\t\t\tif(copy_to_user(s, buf, len))\n\t\t\t\treturn -EFAULT;\n\t\t\tleft -= len;\n\t\t\ts += len;\n\t\t}\n\t}\n\n\tif (!write && !first && left) {\n\t\tif(put_user('\\n', s))\n\t\t\treturn -EFAULT;\n\t\tleft--, s++;\n\t}\n\tif (write) {\n\t\twhile (left) {\n\t\t\tchar c;\n\t\t\tif (get_user(c, s++))\n\t\t\t\treturn -EFAULT;\n\t\t\tif (!isspace(c))\n\t\t\t\tbreak;\n\t\t\tleft--;\n\t\t}\n\t}\n\tif (write && first)\n\t\treturn -EINVAL;\n\t*lenp -= left;\n\t*ppos += *lenp;\n\treturn 0;\n#undef TMPBUFLEN\n}\n\nstatic int do_proc_doulongvec_minmax(ctl_table *table, int write,\n\t\t\t\t struct file *filp,\n\t\t\t\t void __user *buffer,\n\t\t\t\t size_t *lenp, loff_t *ppos,\n\t\t\t\t unsigned long convmul,\n\t\t\t\t unsigned long convdiv)\n{\n\treturn __do_proc_doulongvec_minmax(table->data, table, write,\n\t\t\tfilp, buffer, lenp, ppos, convmul, convdiv);\n}\n\n/**\n * proc_doulongvec_minmax - read a vector of long integers with min/max values\n * @table: the sysctl table\n * @write: %TRUE if this is a write to the sysctl file\n * @filp: the file structure\n * @buffer: the user buffer\n * @lenp: the size of the user buffer\n * @ppos: file position\n *\n * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long\n * values from/to the user buffer, treated as an ASCII string.\n *\n * This routine will ensure the values are within the range specified by\n * table->extra1 (min) and table->extra2 (max).\n *\n * Returns 0 on success.\n */\nint proc_doulongvec_minmax(ctl_table *table, int write, struct file *filp,\n\t\t\t void __user *buffer, size_t *lenp, loff_t *ppos)\n{\n return do_proc_doulongvec_minmax(table, write, filp, buffer, lenp, ppos, 1l, 1l);\n}\n\n/**\n * proc_doulongvec_ms_jiffies_minmax - read a vector of millisecond values with min/max values\n * @table: the sysctl table\n * @write: %TRUE if this is a write to the sysctl file\n * @filp: the file structure\n * @buffer: the user buffer\n * @lenp: the size of the user buffer\n * @ppos: file position\n *\n * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long\n * values from/to the user buffer, treated as an ASCII string. The values\n * are treated as milliseconds, and converted to jiffies when they are stored.\n *\n * This routine will ensure the values are within the range specified by\n * table->extra1 (min) and table->extra2 (max).\n *\n * Returns 0 on success.\n */\nint proc_doulongvec_ms_jiffies_minmax(ctl_table *table, int write,\n\t\t\t\t struct file *filp,\n\t\t\t\t void __user *buffer,\n\t\t\t\t size_t *lenp, loff_t *ppos)\n{\n return do_proc_doulongvec_minmax(table, write, filp, buffer,\n\t\t\t\t lenp, ppos, HZ, 1000l);\n}\n\n\nstatic int do_proc_dointvec_jiffies_conv(int *negp, unsigned long *lvalp,\n\t\t\t\t\t int *valp,\n\t\t\t\t\t int write, void *data)\n{\n\tif (write) {\n\t\tif (*lvalp > LONG_MAX / HZ)\n\t\t\treturn 1;\n\t\t*valp = *negp ? -(*lvalp*HZ) : (*lvalp*HZ);\n\t} else {\n\t\tint val = *valp;\n\t\tunsigned long lval;\n\t\tif (val < 0) {\n\t\t\t*negp = -1;\n\t\t\tlval = (unsigned long)-val;\n\t\t} else {\n\t\t\t*negp = 0;\n\t\t\tlval = (unsigned long)val;\n\t\t}\n\t\t*lvalp = lval / HZ;\n\t}\n\treturn 0;\n}\n\nstatic int do_proc_dointvec_userhz_jiffies_conv(int *negp, unsigned long *lvalp,\n\t\t\t\t\t\tint *valp,\n\t\t\t\t\t\tint write, void *data)\n{\n\tif (write) {\n\t\tif (USER_HZ < HZ && *lvalp > (LONG_MAX / HZ) * USER_HZ)\n\t\t\treturn 1;\n\t\t*valp = clock_t_to_jiffies(*negp ? -*lvalp : *lvalp);\n\t} else {\n\t\tint val = *valp;\n\t\tunsigned long lval;\n\t\tif (val < 0) {\n\t\t\t*negp = -1;\n\t\t\tlval = (unsigned long)-val;\n\t\t} else {\n\t\t\t*negp = 0;\n\t\t\tlval = (unsigned long)val;\n\t\t}\n\t\t*lvalp = jiffies_to_clock_t(lval);\n\t}\n\treturn 0;\n}\n\nstatic int do_proc_dointvec_ms_jiffies_conv(int *negp, unsigned long *lvalp,\n\t\t\t\t\t int *valp,\n\t\t\t\t\t int write, void *data)\n{\n\tif (write) {\n\t\t*valp = msecs_to_jiffies(*negp ? -*lvalp : *lvalp);\n\t} else {\n\t\tint val = *valp;\n\t\tunsigned long lval;\n\t\tif (val < 0) {\n\t\t\t*negp = -1;\n\t\t\tlval = (unsigned long)-val;\n\t\t} else {\n\t\t\t*negp = 0;\n\t\t\tlval = (unsigned long)val;\n\t\t}\n\t\t*lvalp = jiffies_to_msecs(lval);\n\t}\n\treturn 0;\n}\n\n/**\n * proc_dointvec_jiffies - read a vector of integers as seconds\n * @table: the sysctl table\n * @write: %TRUE if this is a write to the sysctl file\n * @filp: the file structure\n * @buffer: the user buffer\n * @lenp: the size of the user buffer\n * @ppos: file position\n *\n * Reads/writes up to table->maxlen/sizeof(unsigned int) integer\n * values from/to the user buffer, treated as an ASCII string. \n * The values read are assumed to be in seconds, and are converted into\n * jiffies.\n *\n * Returns 0 on success.\n */\nint proc_dointvec_jiffies(ctl_table *table, int write, struct file *filp,\n\t\t\t void __user *buffer, size_t *lenp, loff_t *ppos)\n{\n return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,\n\t\t \t do_proc_dointvec_jiffies_conv,NULL);\n}\n\n/**\n * proc_dointvec_userhz_jiffies - read a vector of integers as 1/USER_HZ seconds\n * @table: the sysctl table\n * @write: %TRUE if this is a write to the sysctl file\n * @filp: the file structure\n * @buffer: the user buffer\n * @lenp: the size of the user buffer\n * @ppos: pointer to the file position\n *\n * Reads/writes up to table->maxlen/sizeof(unsigned int) integer\n * values from/to the user buffer, treated as an ASCII string. \n * The values read are assumed to be in 1/USER_HZ seconds, and \n * are converted into jiffies.\n *\n * Returns 0 on success.\n */\nint proc_dointvec_userhz_jiffies(ctl_table *table, int write, struct file *filp,\n\t\t\t\t void __user *buffer, size_t *lenp, loff_t *ppos)\n{\n return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,\n\t\t \t do_proc_dointvec_userhz_jiffies_conv,NULL);\n}\n\n/**\n * proc_dointvec_ms_jiffies - read a vector of integers as 1 milliseconds\n * @table: the sysctl table\n * @write: %TRUE if this is a write to the sysctl file\n * @filp: the file structure\n * @buffer: the user buffer\n * @lenp: the size of the user buffer\n * @ppos: file position\n * @ppos: the current position in the file\n *\n * Reads/writes up to table->maxlen/sizeof(unsigned int) integer\n * values from/to the user buffer, treated as an ASCII string. \n * The values read are assumed to be in 1/1000 seconds, and \n * are converted into jiffies.\n *\n * Returns 0 on success.\n */\nint proc_dointvec_ms_jiffies(ctl_table *table, int write, struct file *filp,\n\t\t\t void __user *buffer, size_t *lenp, loff_t *ppos)\n{\n\treturn do_proc_dointvec(table, write, filp, buffer, lenp, ppos,\n\t\t\t\tdo_proc_dointvec_ms_jiffies_conv, NULL);\n}\n\nstatic int proc_do_cad_pid(ctl_table *table, int write, struct file *filp,\n\t\t\t void __user *buffer, size_t *lenp, loff_t *ppos)\n{\n\tstruct pid *new_pid;\n\tpid_t tmp;\n\tint r;\n\n\ttmp = pid_nr(cad_pid);\n\n\tr = __do_proc_dointvec(&tmp, table, write, filp, buffer,\n\t\t\t lenp, ppos, NULL, NULL);\n\tif (r || !write)\n\t\treturn r;\n\n\tnew_pid = find_get_pid(tmp);\n\tif (!new_pid)\n\t\treturn -ESRCH;\n\n\tput_pid(xchg(&cad_pid, new_pid));\n\treturn 0;\n}\n\n#else /* CONFIG_PROC_FS */\n\nint proc_dostring(ctl_table *table, int write, struct file *filp,\n\t\t void __user *buffer, size_t *lenp, loff_t *ppos)\n{\n\treturn -ENOSYS;\n}\n\nint proc_dointvec(ctl_table *table, int write, struct file *filp,\n\t\t void __user *buffer, size_t *lenp, loff_t *ppos)\n{\n\treturn -ENOSYS;\n}\n\nint proc_dointvec_bset(ctl_table *table, int write, struct file *filp,\n\t\t\tvoid __user *buffer, size_t *lenp, loff_t *ppos)\n{\n\treturn -ENOSYS;\n}\n\nint proc_dointvec_minmax(ctl_table *table, int write, struct file *filp,\n\t\t void __user *buffer, size_t *lenp, loff_t *ppos)\n{\n\treturn -ENOSYS;\n}\n\nint proc_dointvec_jiffies(ctl_table *table, int write, struct file *filp,\n\t\t void __user *buffer, size_t *lenp, loff_t *ppos)\n{\n\treturn -ENOSYS;\n}\n\nint proc_dointvec_userhz_jiffies(ctl_table *table, int write, struct file *filp,\n\t\t void __user *buffer, size_t *lenp, loff_t *ppos)\n{\n\treturn -ENOSYS;\n}\n\nint proc_dointvec_ms_jiffies(ctl_table *table, int write, struct file *filp,\n\t\t\t void __user *buffer, size_t *lenp, loff_t *ppos)\n{\n\treturn -ENOSYS;\n}\n\nint proc_doulongvec_minmax(ctl_table *table, int write, struct file *filp,\n\t\t void __user *buffer, size_t *lenp, loff_t *ppos)\n{\n\treturn -ENOSYS;\n}\n\nint proc_doulongvec_ms_jiffies_minmax(ctl_table *table, int write,\n\t\t\t\t struct file *filp,\n\t\t\t\t void __user *buffer,\n\t\t\t\t size_t *lenp, loff_t *ppos)\n{\n return -ENOSYS;\n}\n\n\n#endif /* CONFIG_PROC_FS */\n\n\n#ifdef CONFIG_SYSCTL_SYSCALL\n/*\n * General sysctl support routines \n */\n\n/* The generic string strategy routine: */\nint sysctl_string(ctl_table *table, int __user *name, int nlen,\n\t\t void __user *oldval, size_t __user *oldlenp,\n\t\t void __user *newval, size_t newlen)\n{\n\tif (!table->data || !table->maxlen) \n\t\treturn -ENOTDIR;\n\t\n\tif (oldval && oldlenp) {\n\t\tsize_t bufsize;\n\t\tif (get_user(bufsize, oldlenp))\n\t\t\treturn -EFAULT;\n\t\tif (bufsize) {\n\t\t\tsize_t len = strlen(table->data), copied;\n\n\t\t\t/* This shouldn't trigger for a well-formed sysctl */\n\t\t\tif (len > table->maxlen)\n\t\t\t\tlen = table->maxlen;\n\n\t\t\t/* Copy up to a max of bufsize-1 bytes of the string */\n\t\t\tcopied = (len >= bufsize) ? bufsize - 1 : len;\n\n\t\t\tif (copy_to_user(oldval, table->data, copied) ||\n\t\t\t put_user(0, (char __user *)(oldval + copied)))\n\t\t\t\treturn -EFAULT;\n\t\t\tif (put_user(len, oldlenp))\n\t\t\t\treturn -EFAULT;\n\t\t}\n\t}\n\tif (newval && newlen) {\n\t\tsize_t len = newlen;\n\t\tif (len > table->maxlen)\n\t\t\tlen = table->maxlen;\n\t\tif(copy_from_user(table->data, newval, len))\n\t\t\treturn -EFAULT;\n\t\tif (len == table->maxlen)\n\t\t\tlen--;\n\t\t((char *) table->data)[len] = 0;\n\t}\n\treturn 1;\n}\n\n/*\n * This function makes sure that all of the integers in the vector\n * are between the minimum and maximum values given in the arrays\n * table->extra1 and table->extra2, respectively.\n */\nint sysctl_intvec(ctl_table *table, int __user *name, int nlen,\n\t\tvoid __user *oldval, size_t __user *oldlenp,\n\t\tvoid __user *newval, size_t newlen)\n{\n\n\tif (newval && newlen) {\n\t\tint __user *vec = (int __user *) newval;\n\t\tint *min = (int *) table->extra1;\n\t\tint *max = (int *) table->extra2;\n\t\tsize_t length;\n\t\tint i;\n\n\t\tif (newlen % sizeof(int) != 0)\n\t\t\treturn -EINVAL;\n\n\t\tif (!table->extra1 && !table->extra2)\n\t\t\treturn 0;\n\n\t\tif (newlen > table->maxlen)\n\t\t\tnewlen = table->maxlen;\n\t\tlength = newlen / sizeof(int);\n\n\t\tfor (i = 0; i < length; i++) {\n\t\t\tint value;\n\t\t\tif (get_user(value, vec + i))\n\t\t\t\treturn -EFAULT;\n\t\t\tif (min && value < min[i])\n\t\t\t\treturn -EINVAL;\n\t\t\tif (max && value > max[i])\n\t\t\t\treturn -EINVAL;\n\t\t}\n\t}\n\treturn 0;\n}\n\n/* Strategy function to convert jiffies to seconds */ \nint sysctl_jiffies(ctl_table *table, int __user *name, int nlen,\n\t\tvoid __user *oldval, size_t __user *oldlenp,\n\t\tvoid __user *newval, size_t newlen)\n{\n\tif (oldval && oldlenp) {\n\t\tsize_t olen;\n\n\t\tif (get_user(olen, oldlenp))\n\t\t\treturn -EFAULT;\n\t\tif (olen) {\n\t\t\tint val;\n\n\t\t\tif (olen < sizeof(int))\n\t\t\t\treturn -EINVAL;\n\n\t\t\tval = *(int *)(table->data) / HZ;\n\t\t\tif (put_user(val, (int __user *)oldval))\n\t\t\t\treturn -EFAULT;\n\t\t\tif (put_user(sizeof(int), oldlenp))\n\t\t\t\treturn -EFAULT;\n\t\t}\n\t}\n\tif (newval && newlen) { \n\t\tint new;\n\t\tif (newlen != sizeof(int))\n\t\t\treturn -EINVAL; \n\t\tif (get_user(new, (int __user *)newval))\n\t\t\treturn -EFAULT;\n\t\t*(int *)(table->data) = new*HZ; \n\t}\n\treturn 1;\n}\n\n/* Strategy function to convert jiffies to seconds */ \nint sysctl_ms_jiffies(ctl_table *table, int __user *name, int nlen,\n\t\tvoid __user *oldval, size_t __user *oldlenp,\n\t\tvoid __user *newval, size_t newlen)\n{\n\tif (oldval && oldlenp) {\n\t\tsize_t olen;\n\n\t\tif (get_user(olen, oldlenp))\n\t\t\treturn -EFAULT;\n\t\tif (olen) {\n\t\t\tint val;\n\n\t\t\tif (olen < sizeof(int))\n\t\t\t\treturn -EINVAL;\n\n\t\t\tval = jiffies_to_msecs(*(int *)(table->data));\n\t\t\tif (put_user(val, (int __user *)oldval))\n\t\t\t\treturn -EFAULT;\n\t\t\tif (put_user(sizeof(int), oldlenp))\n\t\t\t\treturn -EFAULT;\n\t\t}\n\t}\n\tif (newval && newlen) { \n\t\tint new;\n\t\tif (newlen != sizeof(int))\n\t\t\treturn -EINVAL; \n\t\tif (get_user(new, (int __user *)newval))\n\t\t\treturn -EFAULT;\n\t\t*(int *)(table->data) = msecs_to_jiffies(new);\n\t}\n\treturn 1;\n}\n\n\n\n#else /* CONFIG_SYSCTL_SYSCALL */\n\n\nasmlinkage long sys_sysctl(struct __sysctl_args __user *args)\n{\n\tstatic int msg_count;\n\tstruct __sysctl_args tmp;\n\tint name[CTL_MAXNAME];\n\tint i;\n\n\t/* Read in the sysctl name for better debug message logging */\n\tif (copy_from_user(&tmp, args, sizeof(tmp)))\n\t\treturn -EFAULT;\n\tif (tmp.nlen <= 0 || tmp.nlen >= CTL_MAXNAME)\n\t\treturn -ENOTDIR;\n\tfor (i = 0; i < tmp.nlen; i++)\n\t\tif (get_user(name[i], tmp.name + i))\n\t\t\treturn -EFAULT;\n\n\t/* Ignore accesses to kernel.version */\n\tif ((tmp.nlen == 2) && (name[0] == CTL_KERN) && (name[1] == KERN_VERSION))\n\t\tgoto out;\n\n\tif (msg_count < 5) {\n\t\tmsg_count++;\n\t\tprintk(KERN_INFO\n\t\t\t\"warning: process `%s' used the removed sysctl \"\n\t\t\t\"system call with \", current->comm);\n\t\tfor (i = 0; i < tmp.nlen; i++)\n\t\t\tprintk(\"%d.\", name[i]);\n\t\tprintk(\"\\n\");\n\t}\nout:\n\treturn -ENOSYS;\n}\n\nint sysctl_string(ctl_table *table, int __user *name, int nlen,\n\t\t void __user *oldval, size_t __user *oldlenp,\n\t\t void __user *newval, size_t newlen)\n{\n\treturn -ENOSYS;\n}\n\nint sysctl_intvec(ctl_table *table, int __user *name, int nlen,\n\t\tvoid __user *oldval, size_t __user *oldlenp,\n\t\tvoid __user *newval, size_t newlen)\n{\n\treturn -ENOSYS;\n}\n\nint sysctl_jiffies(ctl_table *table, int __user *name, int nlen,\n\t\tvoid __user *oldval, size_t __user *oldlenp,\n\t\tvoid __user *newval, size_t newlen)\n{\n\treturn -ENOSYS;\n}\n\nint sysctl_ms_jiffies(ctl_table *table, int __user *name, int nlen,\n\t\tvoid __user *oldval, size_t __user *oldlenp,\n\t\tvoid __user *newval, size_t newlen)\n{\n\treturn -ENOSYS;\n}\n\n#endif /* CONFIG_SYSCTL_SYSCALL */\n\n/*\n * No sense putting this after each symbol definition, twice,\n * exception granted :-)\n */\nEXPORT_SYMBOL(proc_dointvec);\nEXPORT_SYMBOL(proc_dointvec_jiffies);\nEXPORT_SYMBOL(proc_dointvec_minmax);\nEXPORT_SYMBOL(proc_dointvec_userhz_jiffies);\nEXPORT_SYMBOL(proc_dointvec_ms_jiffies);\nEXPORT_SYMBOL(proc_dostring);\nEXPORT_SYMBOL(proc_doulongvec_minmax);\nEXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax);\nEXPORT_SYMBOL(register_sysctl_table);\nEXPORT_SYMBOL(sysctl_intvec);\nEXPORT_SYMBOL(sysctl_jiffies);\nEXPORT_SYMBOL(sysctl_ms_jiffies);\nEXPORT_SYMBOL(sysctl_string);\nEXPORT_SYMBOL(unregister_sysctl_table);\n\n#include <linux/linkage.h>\n#include <linux/errno.h>\n\n#include <asm/unistd.h>\n\n/*\n * Non-implemented system calls get redirected here.\n */\nasmlinkage long sys_ni_syscall(void)\n{\n\treturn -ENOSYS;\n}\n\ncond_syscall(sys_nfsservctl);\ncond_syscall(sys_quotactl);\ncond_syscall(sys_acct);\ncond_syscall(sys_lookup_dcookie);\ncond_syscall(sys_swapon);\ncond_syscall(sys_swapoff);\ncond_syscall(sys_kexec_load);\ncond_syscall(compat_sys_kexec_load);\ncond_syscall(sys_init_module);\ncond_syscall(sys_delete_module);\ncond_syscall(sys_socketpair);\ncond_syscall(sys_bind);\ncond_syscall(sys_listen);\ncond_syscall(sys_accept);\ncond_syscall(sys_connect);\ncond_syscall(sys_getsockname);\ncond_syscall(sys_getpeername);\ncond_syscall(sys_sendto);\ncond_syscall(sys_send);\ncond_syscall(sys_recvfrom);\ncond_syscall(sys_recv);\ncond_syscall(sys_socket);\ncond_syscall(sys_setsockopt);\ncond_syscall(sys_getsockopt);\ncond_syscall(sys_shutdown);\ncond_syscall(sys_sendmsg);\ncond_syscall(sys_recvmsg);\ncond_syscall(sys_socketcall);\ncond_syscall(sys_futex);\ncond_syscall(compat_sys_futex);\ncond_syscall(sys_set_robust_list);\ncond_syscall(compat_sys_set_robust_list);\ncond_syscall(sys_get_robust_list);\ncond_syscall(compat_sys_get_robust_list);\ncond_syscall(sys_epoll_create);\ncond_syscall(sys_epoll_ctl);\ncond_syscall(sys_epoll_wait);\ncond_syscall(sys_epoll_pwait);\ncond_syscall(sys_semget);\ncond_syscall(sys_semop);\ncond_syscall(sys_semtimedop);\ncond_syscall(sys_semctl);\ncond_syscall(sys_msgget);\ncond_syscall(sys_msgsnd);\ncond_syscall(sys_msgrcv);\ncond_syscall(sys_msgctl);\ncond_syscall(sys_shmget);\ncond_syscall(sys_shmat);\ncond_syscall(sys_shmdt);\ncond_syscall(sys_shmctl);\ncond_syscall(sys_mq_open);\ncond_syscall(sys_mq_unlink);\ncond_syscall(sys_mq_timedsend);\ncond_syscall(sys_mq_timedreceive);\ncond_syscall(sys_mq_notify);\ncond_syscall(sys_mq_getsetattr);\ncond_syscall(compat_sys_mq_open);\ncond_syscall(compat_sys_mq_timedsend);\ncond_syscall(compat_sys_mq_timedreceive);\ncond_syscall(compat_sys_mq_notify);\ncond_syscall(compat_sys_mq_getsetattr);\ncond_syscall(sys_mbind);\ncond_syscall(sys_get_mempolicy);\ncond_syscall(sys_set_mempolicy);\ncond_syscall(compat_sys_mbind);\ncond_syscall(compat_sys_get_mempolicy);\ncond_syscall(compat_sys_set_mempolicy);\ncond_syscall(sys_add_key);\ncond_syscall(sys_request_key);\ncond_syscall(sys_keyctl);\ncond_syscall(compat_sys_keyctl);\ncond_syscall(compat_sys_socketcall);\ncond_syscall(sys_inotify_init);\ncond_syscall(sys_inotify_add_watch);\ncond_syscall(sys_inotify_rm_watch);\ncond_syscall(sys_migrate_pages);\ncond_syscall(sys_move_pages);\ncond_syscall(sys_chown16);\ncond_syscall(sys_fchown16);\ncond_syscall(sys_getegid16);\ncond_syscall(sys_geteuid16);\ncond_syscall(sys_getgid16);\ncond_syscall(sys_getgroups16);\ncond_syscall(sys_getresgid16);\ncond_syscall(sys_getresuid16);\ncond_syscall(sys_getuid16);\ncond_syscall(sys_lchown16);\ncond_syscall(sys_setfsgid16);\ncond_syscall(sys_setfsuid16);\ncond_syscall(sys_setgid16);\ncond_syscall(sys_setgroups16);\ncond_syscall(sys_setregid16);\ncond_syscall(sys_setresgid16);\ncond_syscall(sys_setresuid16);\ncond_syscall(sys_setreuid16);\ncond_syscall(sys_setuid16);\ncond_syscall(sys_vm86old);\ncond_syscall(sys_vm86);\ncond_syscall(compat_sys_ipc);\ncond_syscall(compat_sys_sysctl);\n\n/* arch-specific weak syscall entries */\ncond_syscall(sys_pciconfig_read);\ncond_syscall(sys_pciconfig_write);\ncond_syscall(sys_pciconfig_iobase);\ncond_syscall(sys32_ipc);\ncond_syscall(sys32_sysctl);\ncond_syscall(ppc_rtas);\ncond_syscall(sys_spu_run);\ncond_syscall(sys_spu_create);\n\n/* mmu depending weak syscall entries */\ncond_syscall(sys_mprotect);\ncond_syscall(sys_msync);\ncond_syscall(sys_mlock);\ncond_syscall(sys_munlock);\ncond_syscall(sys_mlockall);\ncond_syscall(sys_munlockall);\ncond_syscall(sys_mincore);\ncond_syscall(sys_madvise);\ncond_syscall(sys_mremap);\ncond_syscall(sys_remap_file_pages);\ncond_syscall(compat_sys_move_pages);\ncond_syscall(compat_sys_migrate_pages);\n\n/* block-layer dependent */\ncond_syscall(sys_bdflush);\ncond_syscall(sys_ioprio_set);\ncond_syscall(sys_ioprio_get);\n\n/* New file descriptors */\ncond_syscall(sys_signalfd);\ncond_syscall(sys_timerfd);\ncond_syscall(compat_sys_signalfd);\ncond_syscall(compat_sys_timerfd);\ncond_syscall(sys_eventfd);\n/*\n * taskstats.c - Export per-task statistics to userland\n *\n * Copyright (C) Shailabh Nagar, IBM Corp. 2006\n * (C) Balbir Singh, IBM Corp. 2006\n *\n * This program is free software; you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation; either version 2 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n */\n\n#include <linux/kernel.h>\n#include <linux/taskstats_kern.h>\n#include <linux/tsacct_kern.h>\n#include <linux/delayacct.h>\n#include <linux/tsacct_kern.h>\n#include <linux/cpumask.h>\n#include <linux/percpu.h>\n#include <net/genetlink.h>\n#include <asm/atomic.h>\n\n/*\n * Maximum length of a cpumask that can be specified in\n * the TASKSTATS_CMD_ATTR_REGISTER/DEREGISTER_CPUMASK attribute\n */\n#define TASKSTATS_CPUMASK_MAXLEN\t(100+6*NR_CPUS)\n\nstatic DEFINE_PER_CPU(__u32, taskstats_seqnum) = { 0 };\nstatic int family_registered;\nstruct kmem_cache *taskstats_cache;\n\nstatic struct genl_family family = {\n\t.id\t\t= GENL_ID_GENERATE,\n\t.name\t\t= TASKSTATS_GENL_NAME,\n\t.version\t= TASKSTATS_GENL_VERSION,\n\t.maxattr\t= TASKSTATS_CMD_ATTR_MAX,\n};\n\nstatic struct nla_policy taskstats_cmd_get_policy[TASKSTATS_CMD_ATTR_MAX+1]\n__read_mostly = {\n\t[TASKSTATS_CMD_ATTR_PID] = { .type = NLA_U32 },\n\t[TASKSTATS_CMD_ATTR_TGID] = { .type = NLA_U32 },\n\t[TASKSTATS_CMD_ATTR_REGISTER_CPUMASK] = { .type = NLA_STRING },\n\t[TASKSTATS_CMD_ATTR_DEREGISTER_CPUMASK] = { .type = NLA_STRING },};\n\nstruct listener {\n\tstruct list_head list;\n\tpid_t pid;\n\tchar valid;\n};\n\nstruct listener_list {\n\tstruct rw_semaphore sem;\n\tstruct list_head list;\n};\nstatic DEFINE_PER_CPU(struct listener_list, listener_array);\n\nenum actions {\n\tREGISTER,\n\tDEREGISTER,\n\tCPU_DONT_CARE\n};\n\nstatic int prepare_reply(struct genl_info *info, u8 cmd, struct sk_buff **skbp,\n\t\t\t\tsize_t size)\n{\n\tstruct sk_buff *skb;\n\tvoid *reply;\n\n\t/*\n\t * If new attributes are added, please revisit this allocation\n\t */\n\tskb = genlmsg_new(size, GFP_KERNEL);\n\tif (!skb)\n\t\treturn -ENOMEM;\n\n\tif (!info) {\n\t\tint seq = get_cpu_var(taskstats_seqnum)++;\n\t\tput_cpu_var(taskstats_seqnum);\n\n\t\treply = genlmsg_put(skb, 0, seq, &family, 0, cmd);\n\t} else\n\t\treply = genlmsg_put_reply(skb, info, &family, 0, cmd);\n\tif (reply == NULL) {\n\t\tnlmsg_free(skb);\n\t\treturn -EINVAL;\n\t}\n\n\t*skbp = skb;\n\treturn 0;\n}\n\n/*\n * Send taskstats data in @skb to listener with nl_pid @pid\n */\nstatic int send_reply(struct sk_buff *skb, pid_t pid)\n{\n\tstruct genlmsghdr *genlhdr = nlmsg_data(nlmsg_hdr(skb));\n\tvoid *reply = genlmsg_data(genlhdr);\n\tint rc;\n\n\trc = genlmsg_end(skb, reply);\n\tif (rc < 0) {\n\t\tnlmsg_free(skb);\n\t\treturn rc;\n\t}\n\n\treturn genlmsg_unicast(skb, pid);\n}\n\n/*\n * Send taskstats data in @skb to listeners registered for @cpu's exit data\n */\nstatic void send_cpu_listeners(struct sk_buff *skb,\n\t\t\t\t\tstruct listener_list *listeners)\n{\n\tstruct genlmsghdr *genlhdr = nlmsg_data(nlmsg_hdr(skb));\n\tstruct listener *s, *tmp;\n\tstruct sk_buff *skb_next, *skb_cur = skb;\n\tvoid *reply = genlmsg_data(genlhdr);\n\tint rc, delcount = 0;\n\n\trc = genlmsg_end(skb, reply);\n\tif (rc < 0) {\n\t\tnlmsg_free(skb);\n\t\treturn;\n\t}\n\n\trc = 0;\n\tdown_read(&listeners->sem);\n\tlist_for_each_entry(s, &listeners->list, list) {\n\t\tskb_next = NULL;\n\t\tif (!list_is_last(&s->list, &listeners->list)) {\n\t\t\tskb_next = skb_clone(skb_cur, GFP_KERNEL);\n\t\t\tif (!skb_next)\n\t\t\t\tbreak;\n\t\t}\n\t\trc = genlmsg_unicast(skb_cur, s->pid);\n\t\tif (rc == -ECONNREFUSED) {\n\t\t\ts->valid = 0;\n\t\t\tdelcount++;\n\t\t}\n\t\tskb_cur = skb_next;\n\t}\n\tup_read(&listeners->sem);\n\n\tif (skb_cur)\n\t\tnlmsg_free(skb_cur);\n\n\tif (!delcount)\n\t\treturn;\n\n\t/* Delete invalidated entries */\n\tdown_write(&listeners->sem);\n\tlist_for_each_entry_safe(s, tmp, &listeners->list, list) {\n\t\tif (!s->valid) {\n\t\t\tlist_del(&s->list);\n\t\t\tkfree(s);\n\t\t}\n\t}\n\tup_write(&listeners->sem);\n}\n\nstatic int fill_pid(pid_t pid, struct task_struct *tsk,\n\t\tstruct taskstats *stats)\n{\n\tint rc = 0;\n\n\tif (!tsk) {\n\t\trcu_read_lock();\n\t\ttsk = find_task_by_pid(pid);\n\t\tif (tsk)\n\t\t\tget_task_struct(tsk);\n\t\trcu_read_unlock();\n\t\tif (!tsk)\n\t\t\treturn -ESRCH;\n\t} else\n\t\tget_task_struct(tsk);\n\n\tmemset(stats, 0, sizeof(*stats));\n\t/*\n\t * Each accounting subsystem adds calls to its functions to\n\t * fill in relevant parts of struct taskstsats as follows\n\t *\n\t *\tper-task-foo(stats, tsk);\n\t */\n\n\tdelayacct_add_tsk(stats, tsk);\n\n\t/* fill in basic acct fields */\n\tstats->version = TASKSTATS_VERSION;\n\tbacct_add_tsk(stats, tsk);\n\n\t/* fill in extended acct fields */\n\txacct_add_tsk(stats, tsk);\n\n\t/* Define err: label here if needed */\n\tput_task_struct(tsk);\n\treturn rc;\n\n}\n\nstatic int fill_tgid(pid_t tgid, struct task_struct *first,\n\t\tstruct taskstats *stats)\n{\n\tstruct task_struct *tsk;\n\tunsigned long flags;\n\tint rc = -ESRCH;\n\n\t/*\n\t * Add additional stats from live tasks except zombie thread group\n\t * leaders who are already counted with the dead tasks\n\t */\n\trcu_read_lock();\n\tif (!first)\n\t\tfirst = find_task_by_pid(tgid);\n\n\tif (!first || !lock_task_sighand(first, &flags))\n\t\tgoto out;\n\n\tif (first->signal->stats)\n\t\tmemcpy(stats, first->signal->stats, sizeof(*stats));\n\telse\n\t\tmemset(stats, 0, sizeof(*stats));\n\n\ttsk = first;\n\tdo {\n\t\tif (tsk->exit_state)\n\t\t\tcontinue;\n\t\t/*\n\t\t * Accounting subsystem can call its functions here to\n\t\t * fill in relevant parts of struct taskstsats as follows\n\t\t *\n\t\t *\tper-task-foo(stats, tsk);\n\t\t */\n\t\tdelayacct_add_tsk(stats, tsk);\n\n\t} while_each_thread(first, tsk);\n\n\tunlock_task_sighand(first, &flags);\n\trc = 0;\nout:\n\trcu_read_unlock();\n\n\tstats->version = TASKSTATS_VERSION;\n\t/*\n\t * Accounting subsytems can also add calls here to modify\n\t * fields of taskstats.\n\t */\n\treturn rc;\n}\n\n\nstatic void fill_tgid_exit(struct task_struct *tsk)\n{\n\tunsigned long flags;\n\n\tspin_lock_irqsave(&tsk->sighand->siglock, flags);\n\tif (!tsk->signal->stats)\n\t\tgoto ret;\n\n\t/*\n\t * Each accounting subsystem calls its functions here to\n\t * accumalate its per-task stats for tsk, into the per-tgid structure\n\t *\n\t *\tper-task-foo(tsk->signal->stats, tsk);\n\t */\n\tdelayacct_add_tsk(tsk->signal->stats, tsk);\nret:\n\tspin_unlock_irqrestore(&tsk->sighand->siglock, flags);\n\treturn;\n}\n\nstatic int add_del_listener(pid_t pid, cpumask_t *maskp, int isadd)\n{\n\tstruct listener_list *listeners;\n\tstruct listener *s, *tmp;\n\tunsigned int cpu;\n\tcpumask_t mask = *maskp;\n\n\tif (!cpus_subset(mask, cpu_possible_map))\n\t\treturn -EINVAL;\n\n\tif (isadd == REGISTER) {\n\t\tfor_each_cpu_mask(cpu, mask) {\n\t\t\ts = kmalloc_node(sizeof(struct listener), GFP_KERNEL,\n\t\t\t\t\t cpu_to_node(cpu));\n\t\t\tif (!s)\n\t\t\t\tgoto cleanup;\n\t\t\ts->pid = pid;\n\t\t\tINIT_LIST_HEAD(&s->list);\n\t\t\ts->valid = 1;\n\n\t\t\tlisteners = &per_cpu(listener_array, cpu);\n\t\t\tdown_write(&listeners->sem);\n\t\t\tlist_add(&s->list, &listeners->list);\n\t\t\tup_write(&listeners->sem);\n\t\t}\n\t\treturn 0;\n\t}\n\n\t/* Deregister or cleanup */\ncleanup:\n\tfor_each_cpu_mask(cpu, mask) {\n\t\tlisteners = &per_cpu(listener_array, cpu);\n\t\tdown_write(&listeners->sem);\n\t\tlist_for_each_entry_safe(s, tmp, &listeners->list, list) {\n\t\t\tif (s->pid == pid) {\n\t\t\t\tlist_del(&s->list);\n\t\t\t\tkfree(s);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tup_write(&listeners->sem);\n\t}\n\treturn 0;\n}\n\nstatic int parse(struct nlattr *na, cpumask_t *mask)\n{\n\tchar *data;\n\tint len;\n\tint ret;\n\n\tif (na == NULL)\n\t\treturn 1;\n\tlen = nla_len(na);\n\tif (len > TASKSTATS_CPUMASK_MAXLEN)\n\t\treturn -E2BIG;\n\tif (len < 1)\n\t\treturn -EINVAL;\n\tdata = kmalloc(len, GFP_KERNEL);\n\tif (!data)\n\t\treturn -ENOMEM;\n\tnla_strlcpy(data, na, len);\n\tret = cpulist_parse(data, *mask);\n\tkfree(data);\n\treturn ret;\n}\n\nstatic struct taskstats *mk_reply(struct sk_buff *skb, int type, u32 pid)\n{\n\tstruct nlattr *na, *ret;\n\tint aggr;\n\n\taggr = (type == TASKSTATS_TYPE_PID)\n\t\t\t? TASKSTATS_TYPE_AGGR_PID\n\t\t\t: TASKSTATS_TYPE_AGGR_TGID;\n\n\tna = nla_nest_start(skb, aggr);\n\tif (!na)\n\t\tgoto err;\n\tif (nla_put(skb, type, sizeof(pid), &pid) < 0)\n\t\tgoto err;\n\tret = nla_reserve(skb, TASKSTATS_TYPE_STATS, sizeof(struct taskstats));\n\tif (!ret)\n\t\tgoto err;\n\tnla_nest_end(skb, na);\n\n\treturn nla_data(ret);\nerr:\n\treturn NULL;\n}\n\nstatic int taskstats_user_cmd(struct sk_buff *skb, struct genl_info *info)\n{\n\tint rc = 0;\n\tstruct sk_buff *rep_skb;\n\tstruct taskstats *stats;\n\tsize_t size;\n\tcpumask_t mask;\n\n\trc = parse(info->attrs[TASKSTATS_CMD_ATTR_REGISTER_CPUMASK], &mask);\n\tif (rc < 0)\n\t\treturn rc;\n\tif (rc == 0)\n\t\treturn add_del_listener(info->snd_pid, &mask, REGISTER);\n\n\trc = parse(info->attrs[TASKSTATS_CMD_ATTR_DEREGISTER_CPUMASK], &mask);\n\tif (rc < 0)\n\t\treturn rc;\n\tif (rc == 0)\n\t\treturn add_del_listener(info->snd_pid, &mask, DEREGISTER);\n\n\t/*\n\t * Size includes space for nested attributes\n\t */\n\tsize = nla_total_size(sizeof(u32)) +\n\t\tnla_total_size(sizeof(struct taskstats)) + nla_total_size(0);\n\n\trc = prepare_reply(info, TASKSTATS_CMD_NEW, &rep_skb, size);\n\tif (rc < 0)\n\t\treturn rc;\n\n\trc = -EINVAL;\n\tif (info->attrs[TASKSTATS_CMD_ATTR_PID]) {\n\t\tu32 pid = nla_get_u32(info->attrs[TASKSTATS_CMD_ATTR_PID]);\n\t\tstats = mk_reply(rep_skb, TASKSTATS_TYPE_PID, pid);\n\t\tif (!stats)\n\t\t\tgoto err;\n\n\t\trc = fill_pid(pid, NULL, stats);\n\t\tif (rc < 0)\n\t\t\tgoto err;\n\t} else if (info->attrs[TASKSTATS_CMD_ATTR_TGID]) {\n\t\tu32 tgid = nla_get_u32(info->attrs[TASKSTATS_CMD_ATTR_TGID]);\n\t\tstats = mk_reply(rep_skb, TASKSTATS_TYPE_TGID, tgid);\n\t\tif (!stats)\n\t\t\tgoto err;\n\n\t\trc = fill_tgid(tgid, NULL, stats);\n\t\tif (rc < 0)\n\t\t\tgoto err;\n\t} else\n\t\tgoto err;\n\n\treturn send_reply(rep_skb, info->snd_pid);\nerr:\n\tnlmsg_free(rep_skb);\n\treturn rc;\n}\n\nstatic struct taskstats *taskstats_tgid_alloc(struct task_struct *tsk)\n{\n\tstruct signal_struct *sig = tsk->signal;\n\tstruct taskstats *stats;\n\n\tif (sig->stats || thread_group_empty(tsk))\n\t\tgoto ret;\n\n\t/* No problem if kmem_cache_zalloc() fails */\n\tstats = kmem_cache_zalloc(taskstats_cache, GFP_KERNEL);\n\n\tspin_lock_irq(&tsk->sighand->siglock);\n\tif (!sig->stats) {\n\t\tsig->stats = stats;\n\t\tstats = NULL;\n\t}\n\tspin_unlock_irq(&tsk->sighand->siglock);\n\n\tif (stats)\n\t\tkmem_cache_free(taskstats_cache, stats);\nret:\n\treturn sig->stats;\n}\n\n/* Send pid data out on exit */\nvoid taskstats_exit(struct task_struct *tsk, int group_dead)\n{\n\tint rc;\n\tstruct listener_list *listeners;\n\tstruct taskstats *stats;\n\tstruct sk_buff *rep_skb;\n\tsize_t size;\n\tint is_thread_group;\n\n\tif (!family_registered)\n\t\treturn;\n\n\t/*\n\t * Size includes space for nested attributes\n\t */\n\tsize = nla_total_size(sizeof(u32)) +\n\t\tnla_total_size(sizeof(struct taskstats)) + nla_total_size(0);\n\n\tis_thread_group = !!taskstats_tgid_alloc(tsk);\n\tif (is_thread_group) {\n\t\t/* PID + STATS + TGID + STATS */\n\t\tsize = 2 * size;\n\t\t/* fill the tsk->signal->stats structure */\n\t\tfill_tgid_exit(tsk);\n\t}\n\n\tlisteners = &__raw_get_cpu_var(listener_array);\n\tif (list_empty(&listeners->list))\n\t\treturn;\n\n\trc = prepare_reply(NULL, TASKSTATS_CMD_NEW, &rep_skb, size);\n\tif (rc < 0)\n\t\treturn;\n\n\tstats = mk_reply(rep_skb, TASKSTATS_TYPE_PID, tsk->pid);\n\tif (!stats)\n\t\tgoto err;\n\n\trc = fill_pid(tsk->pid, tsk, stats);\n\tif (rc < 0)\n\t\tgoto err;\n\n\t/*\n\t * Doesn't matter if tsk is the leader or the last group member leaving\n\t */\n\tif (!is_thread_group || !group_dead)\n\t\tgoto send;\n\n\tstats = mk_reply(rep_skb, TASKSTATS_TYPE_TGID, tsk->tgid);\n\tif (!stats)\n\t\tgoto err;\n\n\tmemcpy(stats, tsk->signal->stats, sizeof(*stats));\n\nsend:\n\tsend_cpu_listeners(rep_skb, listeners);\n\treturn;\nerr:\n\tnlmsg_free(rep_skb);\n}\n\nstatic struct genl_ops taskstats_ops = {\n\t.cmd\t\t= TASKSTATS_CMD_GET,\n\t.doit\t\t= taskstats_user_cmd,\n\t.policy\t\t= taskstats_cmd_get_policy,\n};\n\n/* Needed early in initialization */\nvoid __init taskstats_init_early(void)\n{\n\tunsigned int i;\n\n\ttaskstats_cache = KMEM_CACHE(taskstats, SLAB_PANIC);\n\tfor_each_possible_cpu(i) {\n\t\tINIT_LIST_HEAD(&(per_cpu(listener_array, i).list));\n\t\tinit_rwsem(&(per_cpu(listener_array, i).sem));\n\t}\n}\n\nstatic int __init taskstats_init(void)\n{\n\tint rc;\n\n\trc = genl_register_family(&family);\n\tif (rc)\n\t\treturn rc;\n\n\trc = genl_register_ops(&family, &taskstats_ops);\n\tif (rc < 0)\n\t\tgoto err;\n\n\tfamily_registered = 1;\n\treturn 0;\nerr:\n\tgenl_unregister_family(&family);\n\treturn rc;\n}\n\n/*\n * late initcall ensures initialization of statistics collection\n * mechanisms precedes initialization of the taskstats interface\n */\nlate_initcall(taskstats_init);\n/*\n * linux/kernel/time.c\n *\n * Copyright (C) 1991, 1992 Linus Torvalds\n *\n * This file contains the interface functions for the various\n * time related system calls: time, stime, gettimeofday, settimeofday,\n *\t\t\t adjtime\n */\n/*\n * Modification history kernel/time.c\n * \n * 1993-09-02 Philip Gladstone\n * Created file with time related functions from sched.c and adjtimex() \n * 1993-10-08 Torsten Duwe\n * adjtime interface update and CMOS clock write code\n * 1995-08-13 Torsten Duwe\n * kernel PLL updated to 1994-12-13 specs (rfc-1589)\n * 1999-01-16 Ulrich Windl\n *\tIntroduced error checking for many cases in adjtimex().\n *\tUpdated NTP code according to technical memorandum Jan '96\n *\t\"A Kernel Model for Precision Timekeeping\" by Dave Mills\n *\tAllow time_constant larger than MAXTC(6) for NTP v4 (MAXTC == 10)\n *\t(Even though the technical memorandum forbids it)\n * 2004-07-14\t Christoph Lameter\n *\tAdded getnstimeofday to allow the posix timer functions to return\n *\twith nanosecond accuracy\n */\n\n#include <linux/module.h>\n#include <linux/timex.h>\n#include <linux/capability.h>\n#include <linux/errno.h>\n#include <linux/syscalls.h>\n#include <linux/security.h>\n#include <linux/fs.h>\n#include <linux/module.h>\n\n#include <asm/uaccess.h>\n#include <asm/unistd.h>\n\n/* \n * The timezone where the local system is located. Used as a default by some\n * programs who obtain this value by using gettimeofday.\n */\nstruct timezone sys_tz;\n\nEXPORT_SYMBOL(sys_tz);\n\n#ifdef __ARCH_WANT_SYS_TIME\n\n/*\n * sys_time() can be implemented in user-level using\n * sys_gettimeofday(). Is this for backwards compatibility? If so,\n * why not move it into the appropriate arch directory (for those\n * architectures that need it).\n */\nasmlinkage long sys_time(time_t __user * tloc)\n{\n\ttime_t i;\n\tstruct timeval tv;\n\n\tdo_gettimeofday(&tv);\n\ti = tv.tv_sec;\n\n\tif (tloc) {\n\t\tif (put_user(i,tloc))\n\t\t\ti = -EFAULT;\n\t}\n\treturn i;\n}\n\n/*\n * sys_stime() can be implemented in user-level using\n * sys_settimeofday(). Is this for backwards compatibility? If so,\n * why not move it into the appropriate arch directory (for those\n * architectures that need it).\n */\n \nasmlinkage long sys_stime(time_t __user *tptr)\n{\n\tstruct timespec tv;\n\tint err;\n\n\tif (get_user(tv.tv_sec, tptr))\n\t\treturn -EFAULT;\n\n\ttv.tv_nsec = 0;\n\n\terr = security_settime(&tv, NULL);\n\tif (err)\n\t\treturn err;\n\n\tdo_settimeofday(&tv);\n\treturn 0;\n}\n\n#endif /* __ARCH_WANT_SYS_TIME */\n\nasmlinkage long sys_gettimeofday(struct timeval __user *tv, struct timezone __user *tz)\n{\n\tif (likely(tv != NULL)) {\n\t\tstruct timeval ktv;\n\t\tdo_gettimeofday(&ktv);\n\t\tif (copy_to_user(tv, &ktv, sizeof(ktv)))\n\t\t\treturn -EFAULT;\n\t}\n\tif (unlikely(tz != NULL)) {\n\t\tif (copy_to_user(tz, &sys_tz, sizeof(sys_tz)))\n\t\t\treturn -EFAULT;\n\t}\n\treturn 0;\n}\n\n/*\n * Adjust the time obtained from the CMOS to be UTC time instead of\n * local time.\n * \n * This is ugly, but preferable to the alternatives. Otherwise we\n * would either need to write a program to do it in /etc/rc (and risk\n * confusion if the program gets run more than once; it would also be \n * hard to make the program warp the clock precisely n hours) or\n * compile in the timezone information into the kernel. Bad, bad....\n *\n * \t\t\t\t- TYT, 1992-01-01\n *\n * The best thing to do is to keep the CMOS clock in universal time (UTC)\n * as real UNIX machines always do it. This avoids all headaches about\n * daylight saving times and warping kernel clocks.\n */\nstatic inline void warp_clock(void)\n{\n\twrite_seqlock_irq(&xtime_lock);\n\twall_to_monotonic.tv_sec -= sys_tz.tz_minuteswest * 60;\n\txtime.tv_sec += sys_tz.tz_minuteswest * 60;\n\ttime_interpolator_reset();\n\twrite_sequnlock_irq(&xtime_lock);\n\tclock_was_set();\n}\n\n/*\n * In case for some reason the CMOS clock has not already been running\n * in UTC, but in some local time: The first time we set the timezone,\n * we will warp the clock so that it is ticking UTC time instead of\n * local time. Presumably, if someone is setting the timezone then we\n * are running in an environment where the programs understand about\n * timezones. This should be done at boot time in the /etc/rc script,\n * as soon as possible, so that the clock can be set right. Otherwise,\n * various programs will get confused when the clock gets warped.\n */\n\nint do_sys_settimeofday(struct timespec *tv, struct timezone *tz)\n{\n\tstatic int firsttime = 1;\n\tint error = 0;\n\n\tif (tv && !timespec_valid(tv))\n\t\treturn -EINVAL;\n\n\terror = security_settime(tv, tz);\n\tif (error)\n\t\treturn error;\n\n\tif (tz) {\n\t\t/* SMP safe, global irq locking makes it work. */\n\t\tsys_tz = *tz;\n\t\tif (firsttime) {\n\t\t\tfirsttime = 0;\n\t\t\tif (!tv)\n\t\t\t\twarp_clock();\n\t\t}\n\t}\n\tif (tv)\n\t{\n\t\t/* SMP safe, again the code in arch/foo/time.c should\n\t\t * globally block out interrupts when it runs.\n\t\t */\n\t\treturn do_settimeofday(tv);\n\t}\n\treturn 0;\n}\n\nasmlinkage long sys_settimeofday(struct timeval __user *tv,\n\t\t\t\tstruct timezone __user *tz)\n{\n\tstruct timeval user_tv;\n\tstruct timespec\tnew_ts;\n\tstruct timezone new_tz;\n\n\tif (tv) {\n\t\tif (copy_from_user(&user_tv, tv, sizeof(*tv)))\n\t\t\treturn -EFAULT;\n\t\tnew_ts.tv_sec = user_tv.tv_sec;\n\t\tnew_ts.tv_nsec = user_tv.tv_usec * NSEC_PER_USEC;\n\t}\n\tif (tz) {\n\t\tif (copy_from_user(&new_tz, tz, sizeof(*tz)))\n\t\t\treturn -EFAULT;\n\t}\n\n\treturn do_sys_settimeofday(tv ? &new_ts : NULL, tz ? &new_tz : NULL);\n}\n\nasmlinkage long sys_adjtimex(struct timex __user *txc_p)\n{\n\tstruct timex txc;\t\t/* Local copy of parameter */\n\tint ret;\n\n\t/* Copy the user data space into the kernel copy\n\t * structure. But bear in mind that the structures\n\t * may change\n\t */\n\tif(copy_from_user(&txc, txc_p, sizeof(struct timex)))\n\t\treturn -EFAULT;\n\tret = do_adjtimex(&txc);\n\treturn copy_to_user(txc_p, &txc, sizeof(struct timex)) ? -EFAULT : ret;\n}\n\ninline struct timespec current_kernel_time(void)\n{\n struct timespec now;\n unsigned long seq;\n\n\tdo {\n\t\tseq = read_seqbegin(&xtime_lock);\n\t\t\n\t\tnow = xtime;\n\t} while (read_seqretry(&xtime_lock, seq));\n\n\treturn now; \n}\n\nEXPORT_SYMBOL(current_kernel_time);\n\n/**\n * current_fs_time - Return FS time\n * @sb: Superblock.\n *\n * Return the current time truncated to the time granularity supported by\n * the fs.\n */\nstruct timespec current_fs_time(struct super_block *sb)\n{\n\tstruct timespec now = current_kernel_time();\n\treturn timespec_trunc(now, sb->s_time_gran);\n}\nEXPORT_SYMBOL(current_fs_time);\n\n/*\n * Convert jiffies to milliseconds and back.\n *\n * Avoid unnecessary multiplications/divisions in the\n * two most common HZ cases:\n */\nunsigned int inline jiffies_to_msecs(const unsigned long j)\n{\n#if HZ <= MSEC_PER_SEC && !(MSEC_PER_SEC % HZ)\n\treturn (MSEC_PER_SEC / HZ) * j;\n#elif HZ > MSEC_PER_SEC && !(HZ % MSEC_PER_SEC)\n\treturn (j + (HZ / MSEC_PER_SEC) - 1)/(HZ / MSEC_PER_SEC);\n#else\n\treturn (j * MSEC_PER_SEC) / HZ;\n#endif\n}\nEXPORT_SYMBOL(jiffies_to_msecs);\n\nunsigned int inline jiffies_to_usecs(const unsigned long j)\n{\n#if HZ <= USEC_PER_SEC && !(USEC_PER_SEC % HZ)\n\treturn (USEC_PER_SEC / HZ) * j;\n#elif HZ > USEC_PER_SEC && !(HZ % USEC_PER_SEC)\n\treturn (j + (HZ / USEC_PER_SEC) - 1)/(HZ / USEC_PER_SEC);\n#else\n\treturn (j * USEC_PER_SEC) / HZ;\n#endif\n}\nEXPORT_SYMBOL(jiffies_to_usecs);\n\n/**\n * timespec_trunc - Truncate timespec to a granularity\n * @t: Timespec\n * @gran: Granularity in ns.\n *\n * Truncate a timespec to a granularity. gran must be smaller than a second.\n * Always rounds down.\n *\n * This function should be only used for timestamps returned by\n * current_kernel_time() or CURRENT_TIME, not with do_gettimeofday() because\n * it doesn't handle the better resolution of the later.\n */\nstruct timespec timespec_trunc(struct timespec t, unsigned gran)\n{\n\t/*\n\t * Division is pretty slow so avoid it for common cases.\n\t * Currently current_kernel_time() never returns better than\n\t * jiffies resolution. Exploit that.\n\t */\n\tif (gran <= jiffies_to_usecs(1) * 1000) {\n\t\t/* nothing */\n\t} else if (gran == 1000000000) {\n\t\tt.tv_nsec = 0;\n\t} else {\n\t\tt.tv_nsec -= t.tv_nsec % gran;\n\t}\n\treturn t;\n}\nEXPORT_SYMBOL(timespec_trunc);\n\n#ifdef CONFIG_TIME_INTERPOLATION\nvoid getnstimeofday (struct timespec *tv)\n{\n\tunsigned long seq,sec,nsec;\n\n\tdo {\n\t\tseq = read_seqbegin(&xtime_lock);\n\t\tsec = xtime.tv_sec;\n\t\tnsec = xtime.tv_nsec+time_interpolator_get_offset();\n\t} while (unlikely(read_seqretry(&xtime_lock, seq)));\n\n\twhile (unlikely(nsec >= NSEC_PER_SEC)) {\n\t\tnsec -= NSEC_PER_SEC;\n\t\t++sec;\n\t}\n\ttv->tv_sec = sec;\n\ttv->tv_nsec = nsec;\n}\nEXPORT_SYMBOL_GPL(getnstimeofday);\n\nint do_settimeofday (struct timespec *tv)\n{\n\ttime_t wtm_sec, sec = tv->tv_sec;\n\tlong wtm_nsec, nsec = tv->tv_nsec;\n\n\tif ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC)\n\t\treturn -EINVAL;\n\n\twrite_seqlock_irq(&xtime_lock);\n\t{\n\t\twtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec);\n\t\twtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec);\n\n\t\tset_normalized_timespec(&xtime, sec, nsec);\n\t\tset_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec);\n\n\t\ttime_adjust = 0;\t\t/* stop active adjtime() */\n\t\ttime_status |= STA_UNSYNC;\n\t\ttime_maxerror = NTP_PHASE_LIMIT;\n\t\ttime_esterror = NTP_PHASE_LIMIT;\n\t\ttime_interpolator_reset();\n\t}\n\twrite_sequnlock_irq(&xtime_lock);\n\tclock_was_set();\n\treturn 0;\n}\nEXPORT_SYMBOL(do_settimeofday);\n\nvoid do_gettimeofday (struct timeval *tv)\n{\n\tunsigned long seq, nsec, usec, sec, offset;\n\tdo {\n\t\tseq = read_seqbegin(&xtime_lock);\n\t\toffset = time_interpolator_get_offset();\n\t\tsec = xtime.tv_sec;\n\t\tnsec = xtime.tv_nsec;\n\t} while (unlikely(read_seqretry(&xtime_lock, seq)));\n\n\tusec = (nsec + offset) / 1000;\n\n\twhile (unlikely(usec >= USEC_PER_SEC)) {\n\t\tusec -= USEC_PER_SEC;\n\t\t++sec;\n\t}\n\n\ttv->tv_sec = sec;\n\ttv->tv_usec = usec;\n}\n\nEXPORT_SYMBOL(do_gettimeofday);\n\n\n#else\n#ifndef CONFIG_GENERIC_TIME\n/*\n * Simulate gettimeofday using do_gettimeofday which only allows a timeval\n * and therefore only yields usec accuracy\n */\nvoid getnstimeofday(struct timespec *tv)\n{\n\tstruct timeval x;\n\n\tdo_gettimeofday(&x);\n\ttv->tv_sec = x.tv_sec;\n\ttv->tv_nsec = x.tv_usec * NSEC_PER_USEC;\n}\nEXPORT_SYMBOL_GPL(getnstimeofday);\n#endif\n#endif\n\n/* Converts Gregorian date to seconds since 1970-01-01 00:00:00.\n * Assumes input in normal date format, i.e. 1980-12-31 23:59:59\n * => year=1980, mon=12, day=31, hour=23, min=59, sec=59.\n *\n * [For the Julian calendar (which was used in Russia before 1917,\n * Britain & colonies before 1752, anywhere else before 1582,\n * and is still in use by some communities) leave out the\n * -year/100+year/400 terms, and add 10.]\n *\n * This algorithm was first published by Gauss (I think).\n *\n * WARNING: this function will overflow on 2106-02-07 06:28:16 on\n * machines were long is 32-bit! (However, as time_t is signed, we\n * will already get problems at other places on 2038-01-19 03:14:08)\n */\nunsigned long\nmktime(const unsigned int year0, const unsigned int mon0,\n const unsigned int day, const unsigned int hour,\n const unsigned int min, const unsigned int sec)\n{\n\tunsigned int mon = mon0, year = year0;\n\n\t/* 1..12 -> 11,12,1..10 */\n\tif (0 >= (int) (mon -= 2)) {\n\t\tmon += 12;\t/* Puts Feb last since it has leap day */\n\t\tyear -= 1;\n\t}\n\n\treturn ((((unsigned long)\n\t\t (year/4 - year/100 + year/400 + 367*mon/12 + day) +\n\t\t year*365 - 719499\n\t )*24 + hour /* now have hours */\n\t )*60 + min /* now have minutes */\n\t)*60 + sec; /* finally seconds */\n}\n\nEXPORT_SYMBOL(mktime);\n\n/**\n * set_normalized_timespec - set timespec sec and nsec parts and normalize\n *\n * @ts:\t\tpointer to timespec variable to be set\n * @sec:\tseconds to set\n * @nsec:\tnanoseconds to set\n *\n * Set seconds and nanoseconds field of a timespec variable and\n * normalize to the timespec storage format\n *\n * Note: The tv_nsec part is always in the range of\n * \t0 <= tv_nsec < NSEC_PER_SEC\n * For negative values only the tv_sec field is negative !\n */\nvoid set_normalized_timespec(struct timespec *ts, time_t sec, long nsec)\n{\n\twhile (nsec >= NSEC_PER_SEC) {\n\t\tnsec -= NSEC_PER_SEC;\n\t\t++sec;\n\t}\n\twhile (nsec < 0) {\n\t\tnsec += NSEC_PER_SEC;\n\t\t--sec;\n\t}\n\tts->tv_sec = sec;\n\tts->tv_nsec = nsec;\n}\n\n/**\n * ns_to_timespec - Convert nanoseconds to timespec\n * @nsec: the nanoseconds value to be converted\n *\n * Returns the timespec representation of the nsec parameter.\n */\nstruct timespec ns_to_timespec(const s64 nsec)\n{\n\tstruct timespec ts;\n\n\tif (!nsec)\n\t\treturn (struct timespec) {0, 0};\n\n\tts.tv_sec = div_long_long_rem_signed(nsec, NSEC_PER_SEC, &ts.tv_nsec);\n\tif (unlikely(nsec < 0))\n\t\tset_normalized_timespec(&ts, ts.tv_sec, ts.tv_nsec);\n\n\treturn ts;\n}\nEXPORT_SYMBOL(ns_to_timespec);\n\n/**\n * ns_to_timeval - Convert nanoseconds to timeval\n * @nsec: the nanoseconds value to be converted\n *\n * Returns the timeval representation of the nsec parameter.\n */\nstruct timeval ns_to_timeval(const s64 nsec)\n{\n\tstruct timespec ts = ns_to_timespec(nsec);\n\tstruct timeval tv;\n\n\ttv.tv_sec = ts.tv_sec;\n\ttv.tv_usec = (suseconds_t) ts.tv_nsec / 1000;\n\n\treturn tv;\n}\nEXPORT_SYMBOL(ns_to_timeval);\n\n/*\n * When we convert to jiffies then we interpret incoming values\n * the following way:\n *\n * - negative values mean 'infinite timeout' (MAX_JIFFY_OFFSET)\n *\n * - 'too large' values [that would result in larger than\n * MAX_JIFFY_OFFSET values] mean 'infinite timeout' too.\n *\n * - all other values are converted to jiffies by either multiplying\n * the input value by a factor or dividing it with a factor\n *\n * We must also be careful about 32-bit overflows.\n */\nunsigned long msecs_to_jiffies(const unsigned int m)\n{\n\t/*\n\t * Negative value, means infinite timeout:\n\t */\n\tif ((int)m < 0)\n\t\treturn MAX_JIFFY_OFFSET;\n\n#if HZ <= MSEC_PER_SEC && !(MSEC_PER_SEC % HZ)\n\t/*\n\t * HZ is equal to or smaller than 1000, and 1000 is a nice\n\t * round multiple of HZ, divide with the factor between them,\n\t * but round upwards:\n\t */\n\treturn (m + (MSEC_PER_SEC / HZ) - 1) / (MSEC_PER_SEC / HZ);\n#elif HZ > MSEC_PER_SEC && !(HZ % MSEC_PER_SEC)\n\t/*\n\t * HZ is larger than 1000, and HZ is a nice round multiple of\n\t * 1000 - simply multiply with the factor between them.\n\t *\n\t * But first make sure the multiplication result cannot\n\t * overflow:\n\t */\n\tif (m > jiffies_to_msecs(MAX_JIFFY_OFFSET))\n\t\treturn MAX_JIFFY_OFFSET;\n\n\treturn m * (HZ / MSEC_PER_SEC);\n#else\n\t/*\n\t * Generic case - multiply, round and divide. But first\n\t * check that if we are doing a net multiplication, that\n\t * we wouldnt overflow:\n\t */\n\tif (HZ > MSEC_PER_SEC && m > jiffies_to_msecs(MAX_JIFFY_OFFSET))\n\t\treturn MAX_JIFFY_OFFSET;\n\n\treturn (m * HZ + MSEC_PER_SEC - 1) / MSEC_PER_SEC;\n#endif\n}\nEXPORT_SYMBOL(msecs_to_jiffies);\n\nunsigned long usecs_to_jiffies(const unsigned int u)\n{\n\tif (u > jiffies_to_usecs(MAX_JIFFY_OFFSET))\n\t\treturn MAX_JIFFY_OFFSET;\n#if HZ <= USEC_PER_SEC && !(USEC_PER_SEC % HZ)\n\treturn (u + (USEC_PER_SEC / HZ) - 1) / (USEC_PER_SEC / HZ);\n#elif HZ > USEC_PER_SEC && !(HZ % USEC_PER_SEC)\n\treturn u * (HZ / USEC_PER_SEC);\n#else\n\treturn (u * HZ + USEC_PER_SEC - 1) / USEC_PER_SEC;\n#endif\n}\nEXPORT_SYMBOL(usecs_to_jiffies);\n\n/*\n * The TICK_NSEC - 1 rounds up the value to the next resolution. Note\n * that a remainder subtract here would not do the right thing as the\n * resolution values don't fall on second boundries. I.e. the line:\n * nsec -= nsec % TICK_NSEC; is NOT a correct resolution rounding.\n *\n * Rather, we just shift the bits off the right.\n *\n * The >> (NSEC_JIFFIE_SC - SEC_JIFFIE_SC) converts the scaled nsec\n * value to a scaled second value.\n */\nunsigned long\ntimespec_to_jiffies(const struct timespec *value)\n{\n\tunsigned long sec = value->tv_sec;\n\tlong nsec = value->tv_nsec + TICK_NSEC - 1;\n\n\tif (sec >= MAX_SEC_IN_JIFFIES){\n\t\tsec = MAX_SEC_IN_JIFFIES;\n\t\tnsec = 0;\n\t}\n\treturn (((u64)sec * SEC_CONVERSION) +\n\t\t(((u64)nsec * NSEC_CONVERSION) >>\n\t\t (NSEC_JIFFIE_SC - SEC_JIFFIE_SC))) >> SEC_JIFFIE_SC;\n\n}\nEXPORT_SYMBOL(timespec_to_jiffies);\n\nvoid\njiffies_to_timespec(const unsigned long jiffies, struct timespec *value)\n{\n\t/*\n\t * Convert jiffies to nanoseconds and separate with\n\t * one divide.\n\t */\n\tu64 nsec = (u64)jiffies * TICK_NSEC;\n\tvalue->tv_sec = div_long_long_rem(nsec, NSEC_PER_SEC, &value->tv_nsec);\n}\nEXPORT_SYMBOL(jiffies_to_timespec);\n\n/* Same for \"timeval\"\n *\n * Well, almost. The problem here is that the real system resolution is\n * in nanoseconds and the value being converted is in micro seconds.\n * Also for some machines (those that use HZ = 1024, in-particular),\n * there is a LARGE error in the tick size in microseconds.\n\n * The solution we use is to do the rounding AFTER we convert the\n * microsecond part. Thus the USEC_ROUND, the bits to be shifted off.\n * Instruction wise, this should cost only an additional add with carry\n * instruction above the way it was done above.\n */\nunsigned long\ntimeval_to_jiffies(const struct timeval *value)\n{\n\tunsigned long sec = value->tv_sec;\n\tlong usec = value->tv_usec;\n\n\tif (sec >= MAX_SEC_IN_JIFFIES){\n\t\tsec = MAX_SEC_IN_JIFFIES;\n\t\tusec = 0;\n\t}\n\treturn (((u64)sec * SEC_CONVERSION) +\n\t\t(((u64)usec * USEC_CONVERSION + USEC_ROUND) >>\n\t\t (USEC_JIFFIE_SC - SEC_JIFFIE_SC))) >> SEC_JIFFIE_SC;\n}\nEXPORT_SYMBOL(timeval_to_jiffies);\n\nvoid jiffies_to_timeval(const unsigned long jiffies, struct timeval *value)\n{\n\t/*\n\t * Convert jiffies to nanoseconds and separate with\n\t * one divide.\n\t */\n\tu64 nsec = (u64)jiffies * TICK_NSEC;\n\tlong tv_usec;\n\n\tvalue->tv_sec = div_long_long_rem(nsec, NSEC_PER_SEC, &tv_usec);\n\ttv_usec /= NSEC_PER_USEC;\n\tvalue->tv_usec = tv_usec;\n}\nEXPORT_SYMBOL(jiffies_to_timeval);\n\n/*\n * Convert jiffies/jiffies_64 to clock_t and back.\n */\nclock_t jiffies_to_clock_t(long x)\n{\n#if (TICK_NSEC % (NSEC_PER_SEC / USER_HZ)) == 0\n\treturn x / (HZ / USER_HZ);\n#else\n\tu64 tmp = (u64)x * TICK_NSEC;\n\tdo_div(tmp, (NSEC_PER_SEC / USER_HZ));\n\treturn (long)tmp;\n#endif\n}\nEXPORT_SYMBOL(jiffies_to_clock_t);\n\nunsigned long clock_t_to_jiffies(unsigned long x)\n{\n#if (HZ % USER_HZ)==0\n\tif (x >= ~0UL / (HZ / USER_HZ))\n\t\treturn ~0UL;\n\treturn x * (HZ / USER_HZ);\n#else\n\tu64 jif;\n\n\t/* Don't worry about loss of precision here .. */\n\tif (x >= ~0UL / HZ * USER_HZ)\n\t\treturn ~0UL;\n\n\t/* .. but do try to contain it here */\n\tjif = x * (u64) HZ;\n\tdo_div(jif, USER_HZ);\n\treturn jif;\n#endif\n}\nEXPORT_SYMBOL(clock_t_to_jiffies);\n\nu64 jiffies_64_to_clock_t(u64 x)\n{\n#if (TICK_NSEC % (NSEC_PER_SEC / USER_HZ)) == 0\n\tdo_div(x, HZ / USER_HZ);\n#else\n\t/*\n\t * There are better ways that don't overflow early,\n\t * but even this doesn't overflow in hundreds of years\n\t * in 64 bits, so..\n\t */\n\tx *= TICK_NSEC;\n\tdo_div(x, (NSEC_PER_SEC / USER_HZ));\n#endif\n\treturn x;\n}\n\nEXPORT_SYMBOL(jiffies_64_to_clock_t);\n\nu64 nsec_to_clock_t(u64 x)\n{\n#if (NSEC_PER_SEC % USER_HZ) == 0\n\tdo_div(x, (NSEC_PER_SEC / USER_HZ));\n#elif (USER_HZ % 512) == 0\n\tx *= USER_HZ/512;\n\tdo_div(x, (NSEC_PER_SEC / 512));\n#else\n\t/*\n * max relative error 5.7e-8 (1.8s per year) for USER_HZ <= 1024,\n * overflow after 64.99 years.\n * exact for HZ=60, 72, 90, 120, 144, 180, 300, 600, 900, ...\n */\n\tx *= 9;\n\tdo_div(x, (unsigned long)((9ull * NSEC_PER_SEC + (USER_HZ/2)) /\n\t\t\t\t USER_HZ));\n#endif\n\treturn x;\n}\n\n#if (BITS_PER_LONG < 64)\nu64 get_jiffies_64(void)\n{\n\tunsigned long seq;\n\tu64 ret;\n\n\tdo {\n\t\tseq = read_seqbegin(&xtime_lock);\n\t\tret = jiffies_64;\n\t} while (read_seqretry(&xtime_lock, seq));\n\treturn ret;\n}\n\nEXPORT_SYMBOL(get_jiffies_64);\n#endif\n\nEXPORT_SYMBOL(jiffies);\n/*\n * linux/kernel/timer.c\n *\n * Kernel internal timers, basic process system calls\n *\n * Copyright (C) 1991, 1992 Linus Torvalds\n *\n * 1997-01-28 Modified by Finn Arne Gangstad to make timers scale better.\n *\n * 1997-09-10 Updated NTP code according to technical memorandum Jan '96\n * \"A Kernel Model for Precision Timekeeping\" by Dave Mills\n * 1998-12-24 Fixed a xtime SMP race (we need the xtime_lock rw spinlock to\n * serialize accesses to xtime/lost_ticks).\n * Copyright (C) 1998 Andrea Arcangeli\n * 1999-03-10 Improved NTP compatibility by Ulrich Windl\n * 2002-05-31\tMove sys_sysinfo here and make its locking sane, Robert Love\n * 2000-10-05 Implemented scalable SMP per-CPU timer handling.\n * Copyright (C) 2000, 2001, 2002 Ingo Molnar\n * Designed by David S. Miller, Alexey Kuznetsov and Ingo Molnar\n */\n\n#include <linux/kernel_stat.h>\n#include <linux/module.h>\n#include <linux/interrupt.h>\n#include <linux/percpu.h>\n#include <linux/init.h>\n#include <linux/mm.h>\n#include <linux/swap.h>\n#include <linux/notifier.h>\n#include <linux/thread_info.h>\n#include <linux/time.h>\n#include <linux/jiffies.h>\n#include <linux/posix-timers.h>\n#include <linux/cpu.h>\n#include <linux/syscalls.h>\n#include <linux/delay.h>\n#include <linux/tick.h>\n#include <linux/kallsyms.h>\n\n#include <asm/uaccess.h>\n#include <asm/unistd.h>\n#include <asm/div64.h>\n#include <asm/timex.h>\n#include <asm/io.h>\n\nu64 jiffies_64 __cacheline_aligned_in_smp = INITIAL_JIFFIES;\n\nEXPORT_SYMBOL(jiffies_64);\n\n/*\n * per-CPU timer vector definitions:\n */\n#define TVN_BITS (CONFIG_BASE_SMALL ? 4 : 6)\n#define TVR_BITS (CONFIG_BASE_SMALL ? 6 : 8)\n#define TVN_SIZE (1 << TVN_BITS)\n#define TVR_SIZE (1 << TVR_BITS)\n#define TVN_MASK (TVN_SIZE - 1)\n#define TVR_MASK (TVR_SIZE - 1)\n\ntypedef struct tvec_s {\n\tstruct list_head vec[TVN_SIZE];\n} tvec_t;\n\ntypedef struct tvec_root_s {\n\tstruct list_head vec[TVR_SIZE];\n} tvec_root_t;\n\nstruct tvec_t_base_s {\n\tspinlock_t lock;\n\tstruct timer_list *running_timer;\n\tunsigned long timer_jiffies;\n\ttvec_root_t tv1;\n\ttvec_t tv2;\n\ttvec_t tv3;\n\ttvec_t tv4;\n\ttvec_t tv5;\n} ____cacheline_aligned;\n\ntypedef struct tvec_t_base_s tvec_base_t;\n\ntvec_base_t boot_tvec_bases;\nEXPORT_SYMBOL(boot_tvec_bases);\nstatic DEFINE_PER_CPU(tvec_base_t *, tvec_bases) = &boot_tvec_bases;\n\n/*\n * Note that all tvec_bases is 2 byte aligned and lower bit of\n * base in timer_list is guaranteed to be zero. Use the LSB for\n * the new flag to indicate whether the timer is deferrable\n */\n#define TBASE_DEFERRABLE_FLAG\t\t(0x1)\n\n/* Functions below help us manage 'deferrable' flag */\nstatic inline unsigned int tbase_get_deferrable(tvec_base_t *base)\n{\n\treturn ((unsigned int)(unsigned long)base & TBASE_DEFERRABLE_FLAG);\n}\n\nstatic inline tvec_base_t *tbase_get_base(tvec_base_t *base)\n{\n\treturn ((tvec_base_t *)((unsigned long)base & ~TBASE_DEFERRABLE_FLAG));\n}\n\nstatic inline void timer_set_deferrable(struct timer_list *timer)\n{\n\ttimer->base = ((tvec_base_t *)((unsigned long)(timer->base) |\n\t TBASE_DEFERRABLE_FLAG));\n}\n\nstatic inline void\ntimer_set_base(struct timer_list *timer, tvec_base_t *new_base)\n{\n\ttimer->base = (tvec_base_t *)((unsigned long)(new_base) |\n\t tbase_get_deferrable(timer->base));\n}\n\n/**\n * __round_jiffies - function to round jiffies to a full second\n * @j: the time in (absolute) jiffies that should be rounded\n * @cpu: the processor number on which the timeout will happen\n *\n * __round_jiffies() rounds an absolute time in the future (in jiffies)\n * up or down to (approximately) full seconds. This is useful for timers\n * for which the exact time they fire does not matter too much, as long as\n * they fire approximately every X seconds.\n *\n * By rounding these timers to whole seconds, all such timers will fire\n * at the same time, rather than at various times spread out. The goal\n * of this is to have the CPU wake up less, which saves power.\n *\n * The exact rounding is skewed for each processor to avoid all\n * processors firing at the exact same time, which could lead\n * to lock contention or spurious cache line bouncing.\n *\n * The return value is the rounded version of the @j parameter.\n */\nunsigned long __round_jiffies(unsigned long j, int cpu)\n{\n\tint rem;\n\tunsigned long original = j;\n\n\t/*\n\t * We don't want all cpus firing their timers at once hitting the\n\t * same lock or cachelines, so we skew each extra cpu with an extra\n\t * 3 jiffies. This 3 jiffies came originally from the mm/ code which\n\t * already did this.\n\t * The skew is done by adding 3*cpunr, then round, then subtract this\n\t * extra offset again.\n\t */\n\tj += cpu * 3;\n\n\trem = j % HZ;\n\n\t/*\n\t * If the target jiffie is just after a whole second (which can happen\n\t * due to delays of the timer irq, long irq off times etc etc) then\n\t * we should round down to the whole second, not up. Use 1/4th second\n\t * as cutoff for this rounding as an extreme upper bound for this.\n\t */\n\tif (rem < HZ/4) /* round down */\n\t\tj = j - rem;\n\telse /* round up */\n\t\tj = j - rem + HZ;\n\n\t/* now that we have rounded, subtract the extra skew again */\n\tj -= cpu * 3;\n\n\tif (j <= jiffies) /* rounding ate our timeout entirely; */\n\t\treturn original;\n\treturn j;\n}\nEXPORT_SYMBOL_GPL(__round_jiffies);\n\n/**\n * __round_jiffies_relative - function to round jiffies to a full second\n * @j: the time in (relative) jiffies that should be rounded\n * @cpu: the processor number on which the timeout will happen\n *\n * __round_jiffies_relative() rounds a time delta in the future (in jiffies)\n * up or down to (approximately) full seconds. This is useful for timers\n * for which the exact time they fire does not matter too much, as long as\n * they fire approximately every X seconds.\n *\n * By rounding these timers to whole seconds, all such timers will fire\n * at the same time, rather than at various times spread out. The goal\n * of this is to have the CPU wake up less, which saves power.\n *\n * The exact rounding is skewed for each processor to avoid all\n * processors firing at the exact same time, which could lead\n * to lock contention or spurious cache line bouncing.\n *\n * The return value is the rounded version of the @j parameter.\n */\nunsigned long __round_jiffies_relative(unsigned long j, int cpu)\n{\n\t/*\n\t * In theory the following code can skip a jiffy in case jiffies\n\t * increments right between the addition and the later subtraction.\n\t * However since the entire point of this function is to use approximate\n\t * timeouts, it's entirely ok to not handle that.\n\t */\n\treturn __round_jiffies(j + jiffies, cpu) - jiffies;\n}\nEXPORT_SYMBOL_GPL(__round_jiffies_relative);\n\n/**\n * round_jiffies - function to round jiffies to a full second\n * @j: the time in (absolute) jiffies that should be rounded\n *\n * round_jiffies() rounds an absolute time in the future (in jiffies)\n * up or down to (approximately) full seconds. This is useful for timers\n * for which the exact time they fire does not matter too much, as long as\n * they fire approximately every X seconds.\n *\n * By rounding these timers to whole seconds, all such timers will fire\n * at the same time, rather than at various times spread out. The goal\n * of this is to have the CPU wake up less, which saves power.\n *\n * The return value is the rounded version of the @j parameter.\n */\nunsigned long round_jiffies(unsigned long j)\n{\n\treturn __round_jiffies(j, raw_smp_processor_id());\n}\nEXPORT_SYMBOL_GPL(round_jiffies);\n\n/**\n * round_jiffies_relative - function to round jiffies to a full second\n * @j: the time in (relative) jiffies that should be rounded\n *\n * round_jiffies_relative() rounds a time delta in the future (in jiffies)\n * up or down to (approximately) full seconds. This is useful for timers\n * for which the exact time they fire does not matter too much, as long as\n * they fire approximately every X seconds.\n *\n * By rounding these timers to whole seconds, all such timers will fire\n * at the same time, rather than at various times spread out. The goal\n * of this is to have the CPU wake up less, which saves power.\n *\n * The return value is the rounded version of the @j parameter.\n */\nunsigned long round_jiffies_relative(unsigned long j)\n{\n\treturn __round_jiffies_relative(j, raw_smp_processor_id());\n}\nEXPORT_SYMBOL_GPL(round_jiffies_relative);\n\n\nstatic inline void set_running_timer(tvec_base_t *base,\n\t\t\t\t\tstruct timer_list *timer)\n{\n#ifdef CONFIG_SMP\n\tbase->running_timer = timer;\n#endif\n}\n\nstatic void internal_add_timer(tvec_base_t *base, struct timer_list *timer)\n{\n\tunsigned long expires = timer->expires;\n\tunsigned long idx = expires - base->timer_jiffies;\n\tstruct list_head *vec;\n\n\tif (idx < TVR_SIZE) {\n\t\tint i = expires & TVR_MASK;\n\t\tvec = base->tv1.vec + i;\n\t} else if (idx < 1 << (TVR_BITS + TVN_BITS)) {\n\t\tint i = (expires >> TVR_BITS) & TVN_MASK;\n\t\tvec = base->tv2.vec + i;\n\t} else if (idx < 1 << (TVR_BITS + 2 * TVN_BITS)) {\n\t\tint i = (expires >> (TVR_BITS + TVN_BITS)) & TVN_MASK;\n\t\tvec = base->tv3.vec + i;\n\t} else if (idx < 1 << (TVR_BITS + 3 * TVN_BITS)) {\n\t\tint i = (expires >> (TVR_BITS + 2 * TVN_BITS)) & TVN_MASK;\n\t\tvec = base->tv4.vec + i;\n\t} else if ((signed long) idx < 0) {\n\t\t/*\n\t\t * Can happen if you add a timer with expires == jiffies,\n\t\t * or you set a timer to go off in the past\n\t\t */\n\t\tvec = base->tv1.vec + (base->timer_jiffies & TVR_MASK);\n\t} else {\n\t\tint i;\n\t\t/* If the timeout is larger than 0xffffffff on 64-bit\n\t\t * architectures then we use the maximum timeout:\n\t\t */\n\t\tif (idx > 0xffffffffUL) {\n\t\t\tidx = 0xffffffffUL;\n\t\t\texpires = idx + base->timer_jiffies;\n\t\t}\n\t\ti = (expires >> (TVR_BITS + 3 * TVN_BITS)) & TVN_MASK;\n\t\tvec = base->tv5.vec + i;\n\t}\n\t/*\n\t * Timers are FIFO:\n\t */\n\tlist_add_tail(&timer->entry, vec);\n}\n\n#ifdef CONFIG_TIMER_STATS\nvoid __timer_stats_timer_set_start_info(struct timer_list *timer, void *addr)\n{\n\tif (timer->start_site)\n\t\treturn;\n\n\ttimer->start_site = addr;\n\tmemcpy(timer->start_comm, current->comm, TASK_COMM_LEN);\n\ttimer->start_pid = current->pid;\n}\n#endif\n\n/**\n * init_timer - initialize a timer.\n * @timer: the timer to be initialized\n *\n * init_timer() must be done to a timer prior calling *any* of the\n * other timer functions.\n */\nvoid fastcall init_timer(struct timer_list *timer)\n{\n\ttimer->entry.next = NULL;\n\ttimer->base = __raw_get_cpu_var(tvec_bases);\n#ifdef CONFIG_TIMER_STATS\n\ttimer->start_site = NULL;\n\ttimer->start_pid = -1;\n\tmemset(timer->start_comm, 0, TASK_COMM_LEN);\n#endif\n}\nEXPORT_SYMBOL(init_timer);\n\nvoid fastcall init_timer_deferrable(struct timer_list *timer)\n{\n\tinit_timer(timer);\n\ttimer_set_deferrable(timer);\n}\nEXPORT_SYMBOL(init_timer_deferrable);\n\nstatic inline void detach_timer(struct timer_list *timer,\n\t\t\t\tint clear_pending)\n{\n\tstruct list_head *entry = &timer->entry;\n\n\t__list_del(entry->prev, entry->next);\n\tif (clear_pending)\n\t\tentry->next = NULL;\n\tentry->prev = LIST_POISON2;\n}\n\n/*\n * We are using hashed locking: holding per_cpu(tvec_bases).lock\n * means that all timers which are tied to this base via timer->base are\n * locked, and the base itself is locked too.\n *\n * So __run_timers/migrate_timers can safely modify all timers which could\n * be found on ->tvX lists.\n *\n * When the timer's base is locked, and the timer removed from list, it is\n * possible to set timer->base = NULL and drop the lock: the timer remains\n * locked.\n */\nstatic tvec_base_t *lock_timer_base(struct timer_list *timer,\n\t\t\t\t\tunsigned long *flags)\n\t__acquires(timer->base->lock)\n{\n\ttvec_base_t *base;\n\n\tfor (;;) {\n\t\ttvec_base_t *prelock_base = timer->base;\n\t\tbase = tbase_get_base(prelock_base);\n\t\tif (likely(base != NULL)) {\n\t\t\tspin_lock_irqsave(&base->lock, *flags);\n\t\t\tif (likely(prelock_base == timer->base))\n\t\t\t\treturn base;\n\t\t\t/* The timer has migrated to another CPU */\n\t\t\tspin_unlock_irqrestore(&base->lock, *flags);\n\t\t}\n\t\tcpu_relax();\n\t}\n}\n\nint __mod_timer(struct timer_list *timer, unsigned long expires)\n{\n\ttvec_base_t *base, *new_base;\n\tunsigned long flags;\n\tint ret = 0;\n\n\ttimer_stats_timer_set_start_info(timer);\n\tBUG_ON(!timer->function);\n\n\tbase = lock_timer_base(timer, &flags);\n\n\tif (timer_pending(timer)) {\n\t\tdetach_timer(timer, 0);\n\t\tret = 1;\n\t}\n\n\tnew_base = __get_cpu_var(tvec_bases);\n\n\tif (base != new_base) {\n\t\t/*\n\t\t * We are trying to schedule the timer on the local CPU.\n\t\t * However we can't change timer's base while it is running,\n\t\t * otherwise del_timer_sync() can't detect that the timer's\n\t\t * handler yet has not finished. This also guarantees that\n\t\t * the timer is serialized wrt itself.\n\t\t */\n\t\tif (likely(base->running_timer != timer)) {\n\t\t\t/* See the comment in lock_timer_base() */\n\t\t\ttimer_set_base(timer, NULL);\n\t\t\tspin_unlock(&base->lock);\n\t\t\tbase = new_base;\n\t\t\tspin_lock(&base->lock);\n\t\t\ttimer_set_base(timer, base);\n\t\t}\n\t}\n\n\ttimer->expires = expires;\n\tinternal_add_timer(base, timer);\n\tspin_unlock_irqrestore(&base->lock, flags);\n\n\treturn ret;\n}\n\nEXPORT_SYMBOL(__mod_timer);\n\n/**\n * add_timer_on - start a timer on a particular CPU\n * @timer: the timer to be added\n * @cpu: the CPU to start it on\n *\n * This is not very scalable on SMP. Double adds are not possible.\n */\nvoid add_timer_on(struct timer_list *timer, int cpu)\n{\n\ttvec_base_t *base = per_cpu(tvec_bases, cpu);\n \tunsigned long flags;\n\n\ttimer_stats_timer_set_start_info(timer);\n \tBUG_ON(timer_pending(timer) || !timer->function);\n\tspin_lock_irqsave(&base->lock, flags);\n\ttimer_set_base(timer, base);\n\tinternal_add_timer(base, timer);\n\tspin_unlock_irqrestore(&base->lock, flags);\n}\n\n\n/**\n * mod_timer - modify a timer's timeout\n * @timer: the timer to be modified\n * @expires: new timeout in jiffies\n *\n * mod_timer() is a more efficient way to update the expire field of an\n * active timer (if the timer is inactive it will be activated)\n *\n * mod_timer(timer, expires) is equivalent to:\n *\n * del_timer(timer); timer->expires = expires; add_timer(timer);\n *\n * Note that if there are multiple unserialized concurrent users of the\n * same timer, then mod_timer() is the only safe way to modify the timeout,\n * since add_timer() cannot modify an already running timer.\n *\n * The function returns whether it has modified a pending timer or not.\n * (ie. mod_timer() of an inactive timer returns 0, mod_timer() of an\n * active timer returns 1.)\n */\nint mod_timer(struct timer_list *timer, unsigned long expires)\n{\n\tBUG_ON(!timer->function);\n\n\ttimer_stats_timer_set_start_info(timer);\n\t/*\n\t * This is a common optimization triggered by the\n\t * networking code - if the timer is re-modified\n\t * to be the same thing then just return:\n\t */\n\tif (timer->expires == expires && timer_pending(timer))\n\t\treturn 1;\n\n\treturn __mod_timer(timer, expires);\n}\n\nEXPORT_SYMBOL(mod_timer);\n\n/**\n * del_timer - deactive a timer.\n * @timer: the timer to be deactivated\n *\n * del_timer() deactivates a timer - this works on both active and inactive\n * timers.\n *\n * The function returns whether it has deactivated a pending timer or not.\n * (ie. del_timer() of an inactive timer returns 0, del_timer() of an\n * active timer returns 1.)\n */\nint del_timer(struct timer_list *timer)\n{\n\ttvec_base_t *base;\n\tunsigned long flags;\n\tint ret = 0;\n\n\ttimer_stats_timer_clear_start_info(timer);\n\tif (timer_pending(timer)) {\n\t\tbase = lock_timer_base(timer, &flags);\n\t\tif (timer_pending(timer)) {\n\t\t\tdetach_timer(timer, 1);\n\t\t\tret = 1;\n\t\t}\n\t\tspin_unlock_irqrestore(&base->lock, flags);\n\t}\n\n\treturn ret;\n}\n\nEXPORT_SYMBOL(del_timer);\n\n#ifdef CONFIG_SMP\n/**\n * try_to_del_timer_sync - Try to deactivate a timer\n * @timer: timer do del\n *\n * This function tries to deactivate a timer. Upon successful (ret >= 0)\n * exit the timer is not queued and the handler is not running on any CPU.\n *\n * It must not be called from interrupt contexts.\n */\nint try_to_del_timer_sync(struct timer_list *timer)\n{\n\ttvec_base_t *base;\n\tunsigned long flags;\n\tint ret = -1;\n\n\tbase = lock_timer_base(timer, &flags);\n\n\tif (base->running_timer == timer)\n\t\tgoto out;\n\n\tret = 0;\n\tif (timer_pending(timer)) {\n\t\tdetach_timer(timer, 1);\n\t\tret = 1;\n\t}\nout:\n\tspin_unlock_irqrestore(&base->lock, flags);\n\n\treturn ret;\n}\n\nEXPORT_SYMBOL(try_to_del_timer_sync);\n\n/**\n * del_timer_sync - deactivate a timer and wait for the handler to finish.\n * @timer: the timer to be deactivated\n *\n * This function only differs from del_timer() on SMP: besides deactivating\n * the timer it also makes sure the handler has finished executing on other\n * CPUs.\n *\n * Synchronization rules: Callers must prevent restarting of the timer,\n * otherwise this function is meaningless. It must not be called from\n * interrupt contexts. The caller must not hold locks which would prevent\n * completion of the timer's handler. The timer's handler must not call\n * add_timer_on(). Upon exit the timer is not queued and the handler is\n * not running on any CPU.\n *\n * The function returns whether it has deactivated a pending timer or not.\n */\nint del_timer_sync(struct timer_list *timer)\n{\n\tfor (;;) {\n\t\tint ret = try_to_del_timer_sync(timer);\n\t\tif (ret >= 0)\n\t\t\treturn ret;\n\t\tcpu_relax();\n\t}\n}\n\nEXPORT_SYMBOL(del_timer_sync);\n#endif\n\nstatic int cascade(tvec_base_t *base, tvec_t *tv, int index)\n{\n\t/* cascade all the timers from tv up one level */\n\tstruct timer_list *timer, *tmp;\n\tstruct list_head tv_list;\n\n\tlist_replace_init(tv->vec + index, &tv_list);\n\n\t/*\n\t * We are removing _all_ timers from the list, so we\n\t * don't have to detach them individually.\n\t */\n\tlist_for_each_entry_safe(timer, tmp, &tv_list, entry) {\n\t\tBUG_ON(tbase_get_base(timer->base) != base);\n\t\tinternal_add_timer(base, timer);\n\t}\n\n\treturn index;\n}\n\n#define INDEX(N) ((base->timer_jiffies >> (TVR_BITS + (N) * TVN_BITS)) & TVN_MASK)\n\n/**\n * __run_timers - run all expired timers (if any) on this CPU.\n * @base: the timer vector to be processed.\n *\n * This function cascades all vectors and executes all expired timer\n * vectors.\n */\nstatic inline void __run_timers(tvec_base_t *base)\n{\n\tstruct timer_list *timer;\n\n\tspin_lock_irq(&base->lock);\n\twhile (time_after_eq(jiffies, base->timer_jiffies)) {\n\t\tstruct list_head work_list;\n\t\tstruct list_head *head = &work_list;\n \t\tint index = base->timer_jiffies & TVR_MASK;\n\n\t\t/*\n\t\t * Cascade timers:\n\t\t */\n\t\tif (!index &&\n\t\t\t(!cascade(base, &base->tv2, INDEX(0))) &&\n\t\t\t\t(!cascade(base, &base->tv3, INDEX(1))) &&\n\t\t\t\t\t!cascade(base, &base->tv4, INDEX(2)))\n\t\t\tcascade(base, &base->tv5, INDEX(3));\n\t\t++base->timer_jiffies;\n\t\tlist_replace_init(base->tv1.vec + index, &work_list);\n\t\twhile (!list_empty(head)) {\n\t\t\tvoid (*fn)(unsigned long);\n\t\t\tunsigned long data;\n\n\t\t\ttimer = list_first_entry(head, struct timer_list,entry);\n \t\t\tfn = timer->function;\n \t\t\tdata = timer->data;\n\n\t\t\ttimer_stats_account_timer(timer);\n\n\t\t\tset_running_timer(base, timer);\n\t\t\tdetach_timer(timer, 1);\n\t\t\tspin_unlock_irq(&base->lock);\n\t\t\t{\n\t\t\t\tint preempt_count = preempt_count();\n\t\t\t\tfn(data);\n\t\t\t\tif (preempt_count != preempt_count()) {\n\t\t\t\t\tprintk(KERN_WARNING \"huh, entered %p \"\n\t\t\t\t\t \"with preempt_count %08x, exited\"\n\t\t\t\t\t \" with %08x?\\n\",\n\t\t\t\t\t fn, preempt_count,\n\t\t\t\t\t preempt_count());\n\t\t\t\t\tBUG();\n\t\t\t\t}\n\t\t\t}\n\t\t\tspin_lock_irq(&base->lock);\n\t\t}\n\t}\n\tset_running_timer(base, NULL);\n\tspin_unlock_irq(&base->lock);\n}\n\n#if defined(CONFIG_NO_IDLE_HZ) || defined(CONFIG_NO_HZ)\n/*\n * Find out when the next timer event is due to happen. This\n * is used on S/390 to stop all activity when a cpus is idle.\n * This functions needs to be called disabled.\n */\nstatic unsigned long __next_timer_interrupt(tvec_base_t *base)\n{\n\tunsigned long timer_jiffies = base->timer_jiffies;\n\tunsigned long expires = timer_jiffies + NEXT_TIMER_MAX_DELTA;\n\tint index, slot, array, found = 0;\n\tstruct timer_list *nte;\n\ttvec_t *varray[4];\n\n\t/* Look for timer events in tv1. */\n\tindex = slot = timer_jiffies & TVR_MASK;\n\tdo {\n\t\tlist_for_each_entry(nte, base->tv1.vec + slot, entry) {\n \t\t\tif (tbase_get_deferrable(nte->base))\n \t\t\t\tcontinue;\n\n\t\t\tfound = 1;\n\t\t\texpires = nte->expires;\n\t\t\t/* Look at the cascade bucket(s)? */\n\t\t\tif (!index || slot < index)\n\t\t\t\tgoto cascade;\n\t\t\treturn expires;\n\t\t}\n\t\tslot = (slot + 1) & TVR_MASK;\n\t} while (slot != index);\n\ncascade:\n\t/* Calculate the next cascade event */\n\tif (index)\n\t\ttimer_jiffies += TVR_SIZE - index;\n\ttimer_jiffies >>= TVR_BITS;\n\n\t/* Check tv2-tv5. */\n\tvarray[0] = &base->tv2;\n\tvarray[1] = &base->tv3;\n\tvarray[2] = &base->tv4;\n\tvarray[3] = &base->tv5;\n\n\tfor (array = 0; array < 4; array++) {\n\t\ttvec_t *varp = varray[array];\n\n\t\tindex = slot = timer_jiffies & TVN_MASK;\n\t\tdo {\n\t\t\tlist_for_each_entry(nte, varp->vec + slot, entry) {\n\t\t\t\tfound = 1;\n\t\t\t\tif (time_before(nte->expires, expires))\n\t\t\t\t\texpires = nte->expires;\n\t\t\t}\n\t\t\t/*\n\t\t\t * Do we still search for the first timer or are\n\t\t\t * we looking up the cascade buckets ?\n\t\t\t */\n\t\t\tif (found) {\n\t\t\t\t/* Look at the cascade bucket(s)? */\n\t\t\t\tif (!index || slot < index)\n\t\t\t\t\tbreak;\n\t\t\t\treturn expires;\n\t\t\t}\n\t\t\tslot = (slot + 1) & TVN_MASK;\n\t\t} while (slot != index);\n\n\t\tif (index)\n\t\t\ttimer_jiffies += TVN_SIZE - index;\n\t\ttimer_jiffies >>= TVN_BITS;\n\t}\n\treturn expires;\n}\n\n/*\n * Check, if the next hrtimer event is before the next timer wheel\n * event:\n */\nstatic unsigned long cmp_next_hrtimer_event(unsigned long now,\n\t\t\t\t\t unsigned long expires)\n{\n\tktime_t hr_delta = hrtimer_get_next_event();\n\tstruct timespec tsdelta;\n\tunsigned long delta;\n\n\tif (hr_delta.tv64 == KTIME_MAX)\n\t\treturn expires;\n\n\t/*\n\t * Expired timer available, let it expire in the next tick\n\t */\n\tif (hr_delta.tv64 <= 0)\n\t\treturn now + 1;\n\n\ttsdelta = ktime_to_timespec(hr_delta);\n\tdelta = timespec_to_jiffies(&tsdelta);\n\n\t/*\n\t * Limit the delta to the max value, which is checked in\n\t * tick_nohz_stop_sched_tick():\n\t */\n\tif (delta > NEXT_TIMER_MAX_DELTA)\n\t\tdelta = NEXT_TIMER_MAX_DELTA;\n\n\t/*\n\t * Take rounding errors in to account and make sure, that it\n\t * expires in the next tick. Otherwise we go into an endless\n\t * ping pong due to tick_nohz_stop_sched_tick() retriggering\n\t * the timer softirq\n\t */\n\tif (delta < 1)\n\t\tdelta = 1;\n\tnow += delta;\n\tif (time_before(now, expires))\n\t\treturn now;\n\treturn expires;\n}\n\n/**\n * next_timer_interrupt - return the jiffy of the next pending timer\n * @now: current time (in jiffies)\n */\nunsigned long get_next_timer_interrupt(unsigned long now)\n{\n\ttvec_base_t *base = __get_cpu_var(tvec_bases);\n\tunsigned long expires;\n\n\tspin_lock(&base->lock);\n\texpires = __next_timer_interrupt(base);\n\tspin_unlock(&base->lock);\n\n\tif (time_before_eq(expires, now))\n\t\treturn now;\n\n#ifndef CONFIG_XEN\n\treturn cmp_next_hrtimer_event(now, expires);\n#else\n\texpires = cmp_next_hrtimer_event(now, expires);\n\t{\n\t\tunsigned long sl_next = softlockup_get_next_event();\n\n\t\treturn expires <= now || expires - now < sl_next\n\t\t ? expires : now + sl_next;\n\t}\n#endif\n}\n\n#ifdef CONFIG_NO_IDLE_HZ\nunsigned long next_timer_interrupt(void)\n{\n\treturn get_next_timer_interrupt(jiffies);\n}\n#endif\n\n#endif\n\n/*\n * Called from the timer interrupt handler to charge one tick to the current \n * process. user_tick is 1 if the tick is user time, 0 for system.\n */\nvoid update_process_times(int user_tick)\n{\n\tstruct task_struct *p = current;\n\tint cpu = smp_processor_id();\n\n\t/* Note: this timer irq context must be accounted for as well. */\n\tif (user_tick)\n\t\taccount_user_time(p, jiffies_to_cputime(1));\n\telse\n\t\taccount_system_time(p, HARDIRQ_OFFSET, jiffies_to_cputime(1));\n\trun_local_timers();\n\tif (rcu_pending(cpu))\n\t\trcu_check_callbacks(cpu, user_tick);\n\tscheduler_tick();\n \trun_posix_cpu_timers(p);\n}\n\n/*\n * Nr of active tasks - counted in fixed-point numbers\n */\nstatic unsigned long count_active_tasks(void)\n{\n\treturn nr_active() * FIXED_1;\n}\n\n/*\n * Hmm.. Changed this, as the GNU make sources (load.c) seems to\n * imply that avenrun[] is the standard name for this kind of thing.\n * Nothing else seems to be standardized: the fractional size etc\n * all seem to differ on different machines.\n *\n * Requires xtime_lock to access.\n */\nunsigned long avenrun[3];\n\nEXPORT_SYMBOL(avenrun);\n\n/*\n * calc_load - given tick count, update the avenrun load estimates.\n * This is called while holding a write_lock on xtime_lock.\n */\nstatic inline void calc_load(unsigned long ticks)\n{\n\tunsigned long active_tasks; /* fixed-point */\n\tstatic int count = LOAD_FREQ;\n\n\tcount -= ticks;\n\tif (unlikely(count < 0)) {\n\t\tactive_tasks = count_active_tasks();\n\t\tdo {\n\t\t\tCALC_LOAD(avenrun[0], EXP_1, active_tasks);\n\t\t\tCALC_LOAD(avenrun[1], EXP_5, active_tasks);\n\t\t\tCALC_LOAD(avenrun[2], EXP_15, active_tasks);\n\t\t\tcount += LOAD_FREQ;\n\t\t} while (count < 0);\n\t}\n}\n\n/*\n * This function runs timers and the timer-tq in bottom half context.\n */\nstatic void run_timer_softirq(struct softirq_action *h)\n{\n\ttvec_base_t *base = __get_cpu_var(tvec_bases);\n\n\thrtimer_run_queues();\n\n\tif (time_after_eq(jiffies, base->timer_jiffies))\n\t\t__run_timers(base);\n}\n\n/*\n * Called by the local, per-CPU timer interrupt on SMP.\n */\nvoid run_local_timers(void)\n{\n\traise_softirq(TIMER_SOFTIRQ);\n\tsoftlockup_tick();\n}\n\n/*\n * Called by the timer interrupt. xtime_lock must already be taken\n * by the timer IRQ!\n */\nstatic inline void update_times(unsigned long ticks)\n{\n\tupdate_wall_time();\n\tcalc_load(ticks);\n}\n \n/*\n * The 64-bit jiffies value is not atomic - you MUST NOT read it\n * without sampling the sequence number in xtime_lock.\n * jiffies is defined in the linker script...\n */\n\nvoid do_timer(unsigned long ticks)\n{\n\tjiffies_64 += ticks;\n\tupdate_times(ticks);\n}\n\n#ifdef __ARCH_WANT_SYS_ALARM\n\n/*\n * For backwards compatibility? This can be done in libc so Alpha\n * and all newer ports shouldn't need it.\n */\nasmlinkage unsigned long sys_alarm(unsigned int seconds)\n{\n\treturn alarm_setitimer(seconds);\n}\n\n#endif\n\n#ifndef __alpha__\n\n/*\n * The Alpha uses getxpid, getxuid, and getxgid instead. Maybe this\n * should be moved into arch/i386 instead?\n */\n\n/**\n * sys_getpid - return the thread group id of the current process\n *\n * Note, despite the name, this returns the tgid not the pid. The tgid and\n * the pid are identical unless CLONE_THREAD was specified on clone() in\n * which case the tgid is the same in all threads of the same group.\n *\n * This is SMP safe as current->tgid does not change.\n */\nasmlinkage long sys_getpid(void)\n{\n\treturn current->tgid;\n}\n\n/*\n * Accessing ->real_parent is not SMP-safe, it could\n * change from under us. However, we can use a stale\n * value of ->real_parent under rcu_read_lock(), see\n * release_task()->call_rcu(delayed_put_task_struct).\n */\nasmlinkage long sys_getppid(void)\n{\n\tint pid;\n\n\trcu_read_lock();\n\tpid = rcu_dereference(current->real_parent)->tgid;\n\trcu_read_unlock();\n\n\treturn pid;\n}\n\nasmlinkage long sys_getuid(void)\n{\n\t/* Only we change this so SMP safe */\n\treturn current->uid;\n}\n\nasmlinkage long sys_geteuid(void)\n{\n\t/* Only we change this so SMP safe */\n\treturn current->euid;\n}\n\nasmlinkage long sys_getgid(void)\n{\n\t/* Only we change this so SMP safe */\n\treturn current->gid;\n}\n\nasmlinkage long sys_getegid(void)\n{\n\t/* Only we change this so SMP safe */\n\treturn current->egid;\n}\n\n#endif\n\nstatic void process_timeout(unsigned long __data)\n{\n\twake_up_process((struct task_struct *)__data);\n}\n\n/**\n * schedule_timeout - sleep until timeout\n * @timeout: timeout value in jiffies\n *\n * Make the current task sleep until @timeout jiffies have\n * elapsed. The routine will return immediately unless\n * the current task state has been set (see set_current_state()).\n *\n * You can set the task state as follows -\n *\n * %TASK_UNINTERRUPTIBLE - at least @timeout jiffies are guaranteed to\n * pass before the routine returns. The routine will return 0\n *\n * %TASK_INTERRUPTIBLE - the routine may return early if a signal is\n * delivered to the current task. In this case the remaining time\n * in jiffies will be returned, or 0 if the timer expired in time\n *\n * The current task state is guaranteed to be TASK_RUNNING when this\n * routine returns.\n *\n * Specifying a @timeout value of %MAX_SCHEDULE_TIMEOUT will schedule\n * the CPU away without a bound on the timeout. In this case the return\n * value will be %MAX_SCHEDULE_TIMEOUT.\n *\n * In all cases the return value is guaranteed to be non-negative.\n */\nfastcall signed long __sched schedule_timeout(signed long timeout)\n{\n\tstruct timer_list timer;\n\tunsigned long expire;\n\n\tswitch (timeout)\n\t{\n\tcase MAX_SCHEDULE_TIMEOUT:\n\t\t/*\n\t\t * These two special cases are useful to be comfortable\n\t\t * in the caller. Nothing more. We could take\n\t\t * MAX_SCHEDULE_TIMEOUT from one of the negative value\n\t\t * but I' d like to return a valid offset (>=0) to allow\n\t\t * the caller to do everything it want with the retval.\n\t\t */\n\t\tschedule();\n\t\tgoto out;\n\tdefault:\n\t\t/*\n\t\t * Another bit of PARANOID. Note that the retval will be\n\t\t * 0 since no piece of kernel is supposed to do a check\n\t\t * for a negative retval of schedule_timeout() (since it\n\t\t * should never happens anyway). You just have the printk()\n\t\t * that will tell you if something is gone wrong and where.\n\t\t */\n\t\tif (timeout < 0) {\n\t\t\tprintk(KERN_ERR \"schedule_timeout: wrong timeout \"\n\t\t\t\t\"value %lx\\n\", timeout);\n\t\t\tdump_stack();\n\t\t\tcurrent->state = TASK_RUNNING;\n\t\t\tgoto out;\n\t\t}\n\t}\n\n\texpire = timeout + jiffies;\n\n\tsetup_timer(&timer, process_timeout, (unsigned long)current);\n\t__mod_timer(&timer, expire);\n\tschedule();\n\tdel_singleshot_timer_sync(&timer);\n\n\ttimeout = expire - jiffies;\n\n out:\n\treturn timeout < 0 ? 0 : timeout;\n}\nEXPORT_SYMBOL(schedule_timeout);\n\n/*\n * We can use __set_current_state() here because schedule_timeout() calls\n * schedule() unconditionally.\n */\nsigned long __sched schedule_timeout_interruptible(signed long timeout)\n{\n\t__set_current_state(TASK_INTERRUPTIBLE);\n\treturn schedule_timeout(timeout);\n}\nEXPORT_SYMBOL(schedule_timeout_interruptible);\n\nsigned long __sched schedule_timeout_uninterruptible(signed long timeout)\n{\n\t__set_current_state(TASK_UNINTERRUPTIBLE);\n\treturn schedule_timeout(timeout);\n}\nEXPORT_SYMBOL(schedule_timeout_uninterruptible);\n\n/* Thread ID - the internal kernel \"pid\" */\nasmlinkage long sys_gettid(void)\n{\n\treturn current->pid;\n}\n\n/**\n * do_sysinfo - fill in sysinfo struct\n * @info: pointer to buffer to fill\n */ \nint do_sysinfo(struct sysinfo *info)\n{\n\tunsigned long mem_total, sav_total;\n\tunsigned int mem_unit, bitcount;\n\tunsigned long seq;\n\n\tmemset(info, 0, sizeof(struct sysinfo));\n\n\tdo {\n\t\tstruct timespec tp;\n\t\tseq = read_seqbegin(&xtime_lock);\n\n\t\t/*\n\t\t * This is annoying. The below is the same thing\n\t\t * posix_get_clock_monotonic() does, but it wants to\n\t\t * take the lock which we want to cover the loads stuff\n\t\t * too.\n\t\t */\n\n\t\tgetnstimeofday(&tp);\n\t\ttp.tv_sec += wall_to_monotonic.tv_sec;\n\t\ttp.tv_nsec += wall_to_monotonic.tv_nsec;\n\t\tif (tp.tv_nsec - NSEC_PER_SEC >= 0) {\n\t\t\ttp.tv_nsec = tp.tv_nsec - NSEC_PER_SEC;\n\t\t\ttp.tv_sec++;\n\t\t}\n\t\tinfo->uptime = tp.tv_sec + (tp.tv_nsec ? 1 : 0);\n\n\t\tinfo->loads[0] = avenrun[0] << (SI_LOAD_SHIFT - FSHIFT);\n\t\tinfo->loads[1] = avenrun[1] << (SI_LOAD_SHIFT - FSHIFT);\n\t\tinfo->loads[2] = avenrun[2] << (SI_LOAD_SHIFT - FSHIFT);\n\n\t\tinfo->procs = nr_threads;\n\t} while (read_seqretry(&xtime_lock, seq));\n\n\tsi_meminfo(info);\n\tsi_swapinfo(info);\n\n\t/*\n\t * If the sum of all the available memory (i.e. ram + swap)\n\t * is less than can be stored in a 32 bit unsigned long then\n\t * we can be binary compatible with 2.2.x kernels. If not,\n\t * well, in that case 2.2.x was broken anyways...\n\t *\n\t * -Erik Andersen <andersee@debian.org>\n\t */\n\n\tmem_total = info->totalram + info->totalswap;\n\tif (mem_total < info->totalram || mem_total < info->totalswap)\n\t\tgoto out;\n\tbitcount = 0;\n\tmem_unit = info->mem_unit;\n\twhile (mem_unit > 1) {\n\t\tbitcount++;\n\t\tmem_unit >>= 1;\n\t\tsav_total = mem_total;\n\t\tmem_total <<= 1;\n\t\tif (mem_total < sav_total)\n\t\t\tgoto out;\n\t}\n\n\t/*\n\t * If mem_total did not overflow, multiply all memory values by\n\t * info->mem_unit and set it to 1. This leaves things compatible\n\t * with 2.2.x, and also retains compatibility with earlier 2.4.x\n\t * kernels...\n\t */\n\n\tinfo->mem_unit = 1;\n\tinfo->totalram <<= bitcount;\n\tinfo->freeram <<= bitcount;\n\tinfo->sharedram <<= bitcount;\n\tinfo->bufferram <<= bitcount;\n\tinfo->totalswap <<= bitcount;\n\tinfo->freeswap <<= bitcount;\n\tinfo->totalhigh <<= bitcount;\n\tinfo->freehigh <<= bitcount;\n\nout:\n\treturn 0;\n}\n\nasmlinkage long sys_sysinfo(struct sysinfo __user *info)\n{\n\tstruct sysinfo val;\n\n\tdo_sysinfo(&val);\n\n\tif (copy_to_user(info, &val, sizeof(struct sysinfo)))\n\t\treturn -EFAULT;\n\n\treturn 0;\n}\n\n/*\n * lockdep: we want to track each per-CPU base as a separate lock-class,\n * but timer-bases are kmalloc()-ed, so we need to attach separate\n * keys to them:\n */\nstatic struct lock_class_key base_lock_keys[NR_CPUS];\n\nstatic int __devinit init_timers_cpu(int cpu)\n{\n\tint j;\n\ttvec_base_t *base;\n\tstatic char __devinitdata tvec_base_done[NR_CPUS];\n\n\tif (!tvec_base_done[cpu]) {\n\t\tstatic char boot_done;\n\n\t\tif (boot_done) {\n\t\t\t/*\n\t\t\t * The APs use this path later in boot\n\t\t\t */\n\t\t\tbase = kmalloc_node(sizeof(*base), GFP_KERNEL,\n\t\t\t\t\t\tcpu_to_node(cpu));\n\t\t\tif (!base)\n\t\t\t\treturn -ENOMEM;\n\n\t\t\t/* Make sure that tvec_base is 2 byte aligned */\n\t\t\tif (tbase_get_deferrable(base)) {\n\t\t\t\tWARN_ON(1);\n\t\t\t\tkfree(base);\n\t\t\t\treturn -ENOMEM;\n\t\t\t}\n\t\t\tmemset(base, 0, sizeof(*base));\n\t\t\tper_cpu(tvec_bases, cpu) = base;\n\t\t} else {\n\t\t\t/*\n\t\t\t * This is for the boot CPU - we use compile-time\n\t\t\t * static initialisation because per-cpu memory isn't\n\t\t\t * ready yet and because the memory allocators are not\n\t\t\t * initialised either.\n\t\t\t */\n\t\t\tboot_done = 1;\n\t\t\tbase = &boot_tvec_bases;\n\t\t}\n\t\ttvec_base_done[cpu] = 1;\n\t} else {\n\t\tbase = per_cpu(tvec_bases, cpu);\n\t}\n\n\tspin_lock_init(&base->lock);\n\tlockdep_set_class(&base->lock, base_lock_keys + cpu);\n\n\tfor (j = 0; j < TVN_SIZE; j++) {\n\t\tINIT_LIST_HEAD(base->tv5.vec + j);\n\t\tINIT_LIST_HEAD(base->tv4.vec + j);\n\t\tINIT_LIST_HEAD(base->tv3.vec + j);\n\t\tINIT_LIST_HEAD(base->tv2.vec + j);\n\t}\n\tfor (j = 0; j < TVR_SIZE; j++)\n\t\tINIT_LIST_HEAD(base->tv1.vec + j);\n\n\tbase->timer_jiffies = jiffies;\n\treturn 0;\n}\n\n#ifdef CONFIG_HOTPLUG_CPU\nstatic void migrate_timer_list(tvec_base_t *new_base, struct list_head *head)\n{\n\tstruct timer_list *timer;\n\n\twhile (!list_empty(head)) {\n\t\ttimer = list_first_entry(head, struct timer_list, entry);\n\t\tdetach_timer(timer, 0);\n\t\ttimer_set_base(timer, new_base);\n\t\tinternal_add_timer(new_base, timer);\n\t}\n}\n\nstatic void __devinit migrate_timers(int cpu)\n{\n\ttvec_base_t *old_base;\n\ttvec_base_t *new_base;\n\tint i;\n\n\tBUG_ON(cpu_online(cpu));\n\told_base = per_cpu(tvec_bases, cpu);\n\tnew_base = get_cpu_var(tvec_bases);\n\n\tlocal_irq_disable();\n\tdouble_spin_lock(&new_base->lock, &old_base->lock,\n\t\t\t smp_processor_id() < cpu);\n\n\tBUG_ON(old_base->running_timer);\n\n\tfor (i = 0; i < TVR_SIZE; i++)\n\t\tmigrate_timer_list(new_base, old_base->tv1.vec + i);\n\tfor (i = 0; i < TVN_SIZE; i++) {\n\t\tmigrate_timer_list(new_base, old_base->tv2.vec + i);\n\t\tmigrate_timer_list(new_base, old_base->tv3.vec + i);\n\t\tmigrate_timer_list(new_base, old_base->tv4.vec + i);\n\t\tmigrate_timer_list(new_base, old_base->tv5.vec + i);\n\t}\n\n\tdouble_spin_unlock(&new_base->lock, &old_base->lock,\n\t\t\t smp_processor_id() < cpu);\n\tlocal_irq_enable();\n\tput_cpu_var(tvec_bases);\n}\n#endif /* CONFIG_HOTPLUG_CPU */\n\nstatic int __cpuinit timer_cpu_notify(struct notifier_block *self,\n\t\t\t\tunsigned long action, void *hcpu)\n{\n\tlong cpu = (long)hcpu;\n\tswitch(action) {\n\tcase CPU_UP_PREPARE:\n\tcase CPU_UP_PREPARE_FROZEN:\n\t\tif (init_timers_cpu(cpu) < 0)\n\t\t\treturn NOTIFY_BAD;\n\t\tbreak;\n#ifdef CONFIG_HOTPLUG_CPU\n\tcase CPU_DEAD:\n\tcase CPU_DEAD_FROZEN:\n\t\tmigrate_timers(cpu);\n\t\tbreak;\n#endif\n\tdefault:\n\t\tbreak;\n\t}\n\treturn NOTIFY_OK;\n}\n\nstatic struct notifier_block __cpuinitdata timers_nb = {\n\t.notifier_call\t= timer_cpu_notify,\n};\n\n\nvoid __init init_timers(void)\n{\n\tint err = timer_cpu_notify(&timers_nb, (unsigned long)CPU_UP_PREPARE,\n\t\t\t\t(void *)(long)smp_processor_id());\n\n\tinit_timer_stats();\n\n\tBUG_ON(err == NOTIFY_BAD);\n\tregister_cpu_notifier(&timers_nb);\n\topen_softirq(TIMER_SOFTIRQ, run_timer_softirq, NULL);\n}\n\n#ifdef CONFIG_TIME_INTERPOLATION\n\nstruct time_interpolator *time_interpolator __read_mostly;\nstatic struct time_interpolator *time_interpolator_list __read_mostly;\nstatic DEFINE_SPINLOCK(time_interpolator_lock);\n\nstatic inline cycles_t time_interpolator_get_cycles(unsigned int src)\n{\n\tunsigned long (*x)(void);\n\n\tswitch (src)\n\t{\n\t\tcase TIME_SOURCE_FUNCTION:\n\t\t\tx = time_interpolator->addr;\n\t\t\treturn x();\n\n\t\tcase TIME_SOURCE_MMIO64\t:\n\t\t\treturn readq_relaxed((void __iomem *)time_interpolator->addr);\n\n\t\tcase TIME_SOURCE_MMIO32\t:\n\t\t\treturn readl_relaxed((void __iomem *)time_interpolator->addr);\n\n\t\tdefault: return get_cycles();\n\t}\n}\n\nstatic inline u64 time_interpolator_get_counter(int writelock)\n{\n\tunsigned int src = time_interpolator->source;\n\n\tif (time_interpolator->jitter)\n\t{\n\t\tcycles_t lcycle;\n\t\tcycles_t now;\n\n\t\tdo {\n\t\t\tlcycle = time_interpolator->last_cycle;\n\t\t\tnow = time_interpolator_get_cycles(src);\n\t\t\tif (lcycle && time_after(lcycle, now))\n\t\t\t\treturn lcycle;\n\n\t\t\t/* When holding the xtime write lock, there's no need\n\t\t\t * to add the overhead of the cmpxchg. Readers are\n\t\t\t * force to retry until the write lock is released.\n\t\t\t */\n\t\t\tif (writelock) {\n\t\t\t\ttime_interpolator->last_cycle = now;\n\t\t\t\treturn now;\n\t\t\t}\n\t\t\t/* Keep track of the last timer value returned. The use of cmpxchg here\n\t\t\t * will cause contention in an SMP environment.\n\t\t\t */\n\t\t} while (unlikely(cmpxchg(&time_interpolator->last_cycle, lcycle, now) != lcycle));\n\t\treturn now;\n\t}\n\telse\n\t\treturn time_interpolator_get_cycles(src);\n}\n\nvoid time_interpolator_reset(void)\n{\n\ttime_interpolator->offset = 0;\n\ttime_interpolator->last_counter = time_interpolator_get_counter(1);\n}\n\n#define GET_TI_NSECS(count,i) (((((count) - i->last_counter) & (i)->mask) * (i)->nsec_per_cyc) >> (i)->shift)\n\nunsigned long time_interpolator_get_offset(void)\n{\n\t/* If we do not have a time interpolator set up then just return zero */\n\tif (!time_interpolator)\n\t\treturn 0;\n\n\treturn time_interpolator->offset +\n\t\tGET_TI_NSECS(time_interpolator_get_counter(0), time_interpolator);\n}\n\n#define INTERPOLATOR_ADJUST 65536\n#define INTERPOLATOR_MAX_SKIP 10*INTERPOLATOR_ADJUST\n\nvoid time_interpolator_update(long delta_nsec)\n{\n\tu64 counter;\n\tunsigned long offset;\n\n\t/* If there is no time interpolator set up then do nothing */\n\tif (!time_interpolator)\n\t\treturn;\n\n\t/*\n\t * The interpolator compensates for late ticks by accumulating the late\n\t * time in time_interpolator->offset. A tick earlier than expected will\n\t * lead to a reset of the offset and a corresponding jump of the clock\n\t * forward. Again this only works if the interpolator clock is running\n\t * slightly slower than the regular clock and the tuning logic insures\n\t * that.\n\t */\n\n\tcounter = time_interpolator_get_counter(1);\n\toffset = time_interpolator->offset +\n\t\t\tGET_TI_NSECS(counter, time_interpolator);\n\n\tif (delta_nsec < 0 || (unsigned long) delta_nsec < offset)\n\t\ttime_interpolator->offset = offset - delta_nsec;\n\telse {\n\t\ttime_interpolator->skips++;\n\t\ttime_interpolator->ns_skipped += delta_nsec - offset;\n\t\ttime_interpolator->offset = 0;\n\t}\n\ttime_interpolator->last_counter = counter;\n\n\t/* Tuning logic for time interpolator invoked every minute or so.\n\t * Decrease interpolator clock speed if no skips occurred and an offset is carried.\n\t * Increase interpolator clock speed if we skip too much time.\n\t */\n\tif (jiffies % INTERPOLATOR_ADJUST == 0)\n\t{\n\t\tif (time_interpolator->skips == 0 && time_interpolator->offset > tick_nsec)\n\t\t\ttime_interpolator->nsec_per_cyc--;\n\t\tif (time_interpolator->ns_skipped > INTERPOLATOR_MAX_SKIP && time_interpolator->offset == 0)\n\t\t\ttime_interpolator->nsec_per_cyc++;\n\t\ttime_interpolator->skips = 0;\n\t\ttime_interpolator->ns_skipped = 0;\n\t}\n}\n\nstatic inline int\nis_better_time_interpolator(struct time_interpolator *new)\n{\n\tif (!time_interpolator)\n\t\treturn 1;\n\treturn new->frequency > 2*time_interpolator->frequency ||\n\t (unsigned long)new->drift < (unsigned long)time_interpolator->drift;\n}\n\nvoid\nregister_time_interpolator(struct time_interpolator *ti)\n{\n\tunsigned long flags;\n\n\t/* Sanity check */\n\tBUG_ON(ti->frequency == 0 || ti->mask == 0);\n\n\tti->nsec_per_cyc = ((u64)NSEC_PER_SEC << ti->shift) / ti->frequency;\n\tspin_lock(&time_interpolator_lock);\n\twrite_seqlock_irqsave(&xtime_lock, flags);\n\tif (is_better_time_interpolator(ti)) {\n\t\ttime_interpolator = ti;\n\t\ttime_interpolator_reset();\n\t}\n\twrite_sequnlock_irqrestore(&xtime_lock, flags);\n\n\tti->next = time_interpolator_list;\n\ttime_interpolator_list = ti;\n\tspin_unlock(&time_interpolator_lock);\n}\n\nvoid\nunregister_time_interpolator(struct time_interpolator *ti)\n{\n\tstruct time_interpolator *curr, **prev;\n\tunsigned long flags;\n\n\tspin_lock(&time_interpolator_lock);\n\tprev = &time_interpolator_list;\n\tfor (curr = *prev; curr; curr = curr->next) {\n\t\tif (curr == ti) {\n\t\t\t*prev = curr->next;\n\t\t\tbreak;\n\t\t}\n\t\tprev = &curr->next;\n\t}\n\n\twrite_seqlock_irqsave(&xtime_lock, flags);\n\tif (ti == time_interpolator) {\n\t\t/* we lost the best time-interpolator: */\n\t\ttime_interpolator = NULL;\n\t\t/* find the next-best interpolator */\n\t\tfor (curr = time_interpolator_list; curr; curr = curr->next)\n\t\t\tif (is_better_time_interpolator(curr))\n\t\t\t\ttime_interpolator = curr;\n\t\ttime_interpolator_reset();\n\t}\n\twrite_sequnlock_irqrestore(&xtime_lock, flags);\n\tspin_unlock(&time_interpolator_lock);\n}\n#endif /* CONFIG_TIME_INTERPOLATION */\n\n/**\n * msleep - sleep safely even with waitqueue interruptions\n * @msecs: Time in milliseconds to sleep for\n */\nvoid msleep(unsigned int msecs)\n{\n\tunsigned long timeout = msecs_to_jiffies(msecs) + 1;\n\n\twhile (timeout)\n\t\ttimeout = schedule_timeout_uninterruptible(timeout);\n}\n\nEXPORT_SYMBOL(msleep);\n\n/**\n * msleep_interruptible - sleep waiting for signals\n * @msecs: Time in milliseconds to sleep for\n */\nunsigned long msleep_interruptible(unsigned int msecs)\n{\n\tunsigned long timeout = msecs_to_jiffies(msecs) + 1;\n\n\twhile (timeout && !signal_pending(current))\n\t\ttimeout = schedule_timeout_interruptible(timeout);\n\treturn jiffies_to_msecs(timeout);\n}\n\nEXPORT_SYMBOL(msleep_interruptible);\n/*\n * tsacct.c - System accounting over taskstats interface\n *\n * Copyright (C) Jay Lan,\t<jlan@sgi.com>\n *\n *\n * This program is free software; you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation; either version 2 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n */\n\n#include <linux/kernel.h>\n#include <linux/sched.h>\n#include <linux/tsacct_kern.h>\n#include <linux/acct.h>\n#include <linux/jiffies.h>\n\n/*\n * fill in basic accounting fields\n */\nvoid bacct_add_tsk(struct taskstats *stats, struct task_struct *tsk)\n{\n\tstruct timespec uptime, ts;\n\ts64 ac_etime;\n\n\tBUILD_BUG_ON(TS_COMM_LEN < TASK_COMM_LEN);\n\n\t/* calculate task elapsed time in timespec */\n\tdo_posix_clock_monotonic_gettime(&uptime);\n\tts = timespec_sub(uptime, tsk->start_time);\n\t/* rebase elapsed time to usec */\n\tac_etime = timespec_to_ns(&ts);\n\tdo_div(ac_etime, NSEC_PER_USEC);\n\tstats->ac_etime = ac_etime;\n\tstats->ac_btime = xtime.tv_sec - ts.tv_sec;\n\tif (thread_group_leader(tsk)) {\n\t\tstats->ac_exitcode = tsk->exit_code;\n\t\tif (tsk->flags & PF_FORKNOEXEC)\n\t\t\tstats->ac_flag |= AFORK;\n\t}\n\tif (tsk->flags & PF_SUPERPRIV)\n\t\tstats->ac_flag |= ASU;\n\tif (tsk->flags & PF_DUMPCORE)\n\t\tstats->ac_flag |= ACORE;\n\tif (tsk->flags & PF_SIGNALED)\n\t\tstats->ac_flag |= AXSIG;\n\tstats->ac_nice\t = task_nice(tsk);\n\tstats->ac_sched\t = tsk->policy;\n\tstats->ac_uid\t = tsk->uid;\n\tstats->ac_gid\t = tsk->gid;\n\tstats->ac_pid\t = tsk->pid;\n\trcu_read_lock();\n\tstats->ac_ppid\t = pid_alive(tsk) ?\n\t\t\t\trcu_dereference(tsk->real_parent)->tgid : 0;\n\trcu_read_unlock();\n\tstats->ac_utime\t = cputime_to_msecs(tsk->utime) * USEC_PER_MSEC;\n\tstats->ac_stime\t = cputime_to_msecs(tsk->stime) * USEC_PER_MSEC;\n\tstats->ac_minflt = tsk->min_flt;\n\tstats->ac_majflt = tsk->maj_flt;\n\n\tstrncpy(stats->ac_comm, tsk->comm, sizeof(stats->ac_comm));\n}\n\n\n#ifdef CONFIG_TASK_XACCT\n\n#define KB 1024\n#define MB (1024*KB)\n/*\n * fill in extended accounting fields\n */\nvoid xacct_add_tsk(struct taskstats *stats, struct task_struct *p)\n{\n\tstruct mm_struct *mm;\n\n\t/* convert pages-jiffies to Mbyte-usec */\n\tstats->coremem = jiffies_to_usecs(p->acct_rss_mem1) * PAGE_SIZE / MB;\n\tstats->virtmem = jiffies_to_usecs(p->acct_vm_mem1) * PAGE_SIZE / MB;\n\tmm = get_task_mm(p);\n\tif (mm) {\n\t\t/* adjust to KB unit */\n\t\tstats->hiwater_rss = mm->hiwater_rss * PAGE_SIZE / KB;\n\t\tstats->hiwater_vm = mm->hiwater_vm * PAGE_SIZE / KB;\n\t\tmmput(mm);\n\t}\n\tstats->read_char\t= p->rchar;\n\tstats->write_char\t= p->wchar;\n\tstats->read_syscalls\t= p->syscr;\n\tstats->write_syscalls\t= p->syscw;\n#ifdef CONFIG_TASK_IO_ACCOUNTING\n\tstats->read_bytes\t= p->ioac.read_bytes;\n\tstats->write_bytes\t= p->ioac.write_bytes;\n\tstats->cancelled_write_bytes = p->ioac.cancelled_write_bytes;\n#else\n\tstats->read_bytes\t= 0;\n\tstats->write_bytes\t= 0;\n\tstats->cancelled_write_bytes = 0;\n#endif\n}\n#undef KB\n#undef MB\n\n/**\n * acct_update_integrals - update mm integral fields in task_struct\n * @tsk: task_struct for accounting\n */\nvoid acct_update_integrals(struct task_struct *tsk)\n{\n\tif (likely(tsk->mm)) {\n\t\tlong delta = cputime_to_jiffies(\n\t\t\tcputime_sub(tsk->stime, tsk->acct_stimexpd));\n\n\t\tif (delta == 0)\n\t\t\treturn;\n\t\ttsk->acct_stimexpd = tsk->stime;\n\t\ttsk->acct_rss_mem1 += delta * get_mm_rss(tsk->mm);\n\t\ttsk->acct_vm_mem1 += delta * tsk->mm->total_vm;\n\t}\n}\n\n/**\n * acct_clear_integrals - clear the mm integral fields in task_struct\n * @tsk: task_struct whose accounting fields are cleared\n */\nvoid acct_clear_integrals(struct task_struct *tsk)\n{\n\ttsk->acct_stimexpd = 0;\n\ttsk->acct_rss_mem1 = 0;\n\ttsk->acct_vm_mem1 = 0;\n}\n#endif\n/*\n *\tWrapper functions for 16bit uid back compatibility. All nicely tied\n *\ttogether in the faint hope we can take the out in five years time.\n */\n\n#include <linux/mm.h>\n#include <linux/utsname.h>\n#include <linux/mman.h>\n#include <linux/notifier.h>\n#include <linux/reboot.h>\n#include <linux/prctl.h>\n#include <linux/capability.h>\n#include <linux/init.h>\n#include <linux/highuid.h>\n#include <linux/security.h>\n#include <linux/syscalls.h>\n\n#include <asm/uaccess.h>\n\nasmlinkage long sys_chown16(const char __user * filename, old_uid_t user, old_gid_t group)\n{\n\tlong ret = sys_chown(filename, low2highuid(user), low2highgid(group));\n\t/* avoid REGPARM breakage on x86: */\n\tprevent_tail_call(ret);\n\treturn ret;\n}\n\nasmlinkage long sys_lchown16(const char __user * filename, old_uid_t user, old_gid_t group)\n{\n\tlong ret = sys_lchown(filename, low2highuid(user), low2highgid(group));\n\t/* avoid REGPARM breakage on x86: */\n\tprevent_tail_call(ret);\n\treturn ret;\n}\n\nasmlinkage long sys_fchown16(unsigned int fd, old_uid_t user, old_gid_t group)\n{\n\tlong ret = sys_fchown(fd, low2highuid(user), low2highgid(group));\n\t/* avoid REGPARM breakage on x86: */\n\tprevent_tail_call(ret);\n\treturn ret;\n}\n\nasmlinkage long sys_setregid16(old_gid_t rgid, old_gid_t egid)\n{\n\tlong ret = sys_setregid(low2highgid(rgid), low2highgid(egid));\n\t/* avoid REGPARM breakage on x86: */\n\tprevent_tail_call(ret);\n\treturn ret;\n}\n\nasmlinkage long sys_setgid16(old_gid_t gid)\n{\n\tlong ret = sys_setgid(low2highgid(gid));\n\t/* avoid REGPARM breakage on x86: */\n\tprevent_tail_call(ret);\n\treturn ret;\n}\n\nasmlinkage long sys_setreuid16(old_uid_t ruid, old_uid_t euid)\n{\n\tlong ret = sys_setreuid(low2highuid(ruid), low2highuid(euid));\n\t/* avoid REGPARM breakage on x86: */\n\tprevent_tail_call(ret);\n\treturn ret;\n}\n\nasmlinkage long sys_setuid16(old_uid_t uid)\n{\n\tlong ret = sys_setuid(low2highuid(uid));\n\t/* avoid REGPARM breakage on x86: */\n\tprevent_tail_call(ret);\n\treturn ret;\n}\n\nasmlinkage long sys_setresuid16(old_uid_t ruid, old_uid_t euid, old_uid_t suid)\n{\n\tlong ret = sys_setresuid(low2highuid(ruid), low2highuid(euid),\n\t\t\t\t low2highuid(suid));\n\t/* avoid REGPARM breakage on x86: */\n\tprevent_tail_call(ret);\n\treturn ret;\n}\n\nasmlinkage long sys_getresuid16(old_uid_t __user *ruid, old_uid_t __user *euid, old_uid_t __user *suid)\n{\n\tint retval;\n\n\tif (!(retval = put_user(high2lowuid(current->uid), ruid)) &&\n\t !(retval = put_user(high2lowuid(current->euid), euid)))\n\t\tretval = put_user(high2lowuid(current->suid), suid);\n\n\treturn retval;\n}\n\nasmlinkage long sys_setresgid16(old_gid_t rgid, old_gid_t egid, old_gid_t sgid)\n{\n\tlong ret = sys_setresgid(low2highgid(rgid), low2highgid(egid),\n\t\t\t\t low2highgid(sgid));\n\t/* avoid REGPARM breakage on x86: */\n\tprevent_tail_call(ret);\n\treturn ret;\n}\n\nasmlinkage long sys_getresgid16(old_gid_t __user *rgid, old_gid_t __user *egid, old_gid_t __user *sgid)\n{\n\tint retval;\n\n\tif (!(retval = put_user(high2lowgid(current->gid), rgid)) &&\n\t !(retval = put_user(high2lowgid(current->egid), egid)))\n\t\tretval = put_user(high2lowgid(current->sgid), sgid);\n\n\treturn retval;\n}\n\nasmlinkage long sys_setfsuid16(old_uid_t uid)\n{\n\tlong ret = sys_setfsuid(low2highuid(uid));\n\t/* avoid REGPARM breakage on x86: */\n\tprevent_tail_call(ret);\n\treturn ret;\n}\n\nasmlinkage long sys_setfsgid16(old_gid_t gid)\n{\n\tlong ret = sys_setfsgid(low2highgid(gid));\n\t/* avoid REGPARM breakage on x86: */\n\tprevent_tail_call(ret);\n\treturn ret;\n}\n\nstatic int groups16_to_user(old_gid_t __user *grouplist,\n struct group_info *group_info)\n{\n\tint i;\n\told_gid_t group;\n\n\tfor (i = 0; i < group_info->ngroups; i++) {\n\t\tgroup = high2lowgid(GROUP_AT(group_info, i));\n\t\tif (put_user(group, grouplist+i))\n\t\t\treturn -EFAULT;\n\t}\n\n\treturn 0;\n}\n\nstatic int groups16_from_user(struct group_info *group_info,\n old_gid_t __user *grouplist)\n{\n\tint i;\n\told_gid_t group;\n\n\tfor (i = 0; i < group_info->ngroups; i++) {\n\t\tif (get_user(group, grouplist+i))\n\t\t\treturn -EFAULT;\n\t\tGROUP_AT(group_info, i) = low2highgid(group);\n\t}\n\n\treturn 0;\n}\n\nasmlinkage long sys_getgroups16(int gidsetsize, old_gid_t __user *grouplist)\n{\n\tint i = 0;\n\n\tif (gidsetsize < 0)\n\t\treturn -EINVAL;\n\n\tget_group_info(current->group_info);\n\ti = current->group_info->ngroups;\n\tif (gidsetsize) {\n\t\tif (i > gidsetsize) {\n\t\t\ti = -EINVAL;\n\t\t\tgoto out;\n\t\t}\n\t\tif (groups16_to_user(grouplist, current->group_info)) {\n\t\t\ti = -EFAULT;\n\t\t\tgoto out;\n\t\t}\n\t}\nout:\n\tput_group_info(current->group_info);\n\treturn i;\n}\n\nasmlinkage long sys_setgroups16(int gidsetsize, old_gid_t __user *grouplist)\n{\n\tstruct group_info *group_info;\n\tint retval;\n\n\tif (!capable(CAP_SETGID))\n\t\treturn -EPERM;\n\tif ((unsigned)gidsetsize > NGROUPS_MAX)\n\t\treturn -EINVAL;\n\n\tgroup_info = groups_alloc(gidsetsize);\n\tif (!group_info)\n\t\treturn -ENOMEM;\n\tretval = groups16_from_user(group_info, grouplist);\n\tif (retval) {\n\t\tput_group_info(group_info);\n\t\treturn retval;\n\t}\n\n\tretval = set_current_groups(group_info);\n\tput_group_info(group_info);\n\n\treturn retval;\n}\n\nasmlinkage long sys_getuid16(void)\n{\n\treturn high2lowuid(current->uid);\n}\n\nasmlinkage long sys_geteuid16(void)\n{\n\treturn high2lowuid(current->euid);\n}\n\nasmlinkage long sys_getgid16(void)\n{\n\treturn high2lowgid(current->gid);\n}\n\nasmlinkage long sys_getegid16(void)\n{\n\treturn high2lowgid(current->egid);\n}\n/*\n * The \"user cache\".\n *\n * (C) Copyright 1991-2000 Linus Torvalds\n *\n * We have a per-user structure to keep track of how many\n * processes, files etc the user has claimed, in order to be\n * able to have per-user limits for system resources. \n */\n\n#include <linux/init.h>\n#include <linux/sched.h>\n#include <linux/slab.h>\n#include <linux/bitops.h>\n#include <linux/key.h>\n#include <linux/interrupt.h>\n\n/*\n * UID task count cache, to get fast user lookup in \"alloc_uid\"\n * when changing user ID's (ie setuid() and friends).\n */\n\n#define UIDHASH_BITS (CONFIG_BASE_SMALL ? 3 : 8)\n#define UIDHASH_SZ\t\t(1 << UIDHASH_BITS)\n#define UIDHASH_MASK\t\t(UIDHASH_SZ - 1)\n#define __uidhashfn(uid)\t(((uid >> UIDHASH_BITS) + uid) & UIDHASH_MASK)\n#define uidhashentry(uid)\t(uidhash_table + __uidhashfn((uid)))\n\nstatic struct kmem_cache *uid_cachep;\nstatic struct list_head uidhash_table[UIDHASH_SZ];\n\n/*\n * The uidhash_lock is mostly taken from process context, but it is\n * occasionally also taken from softirq/tasklet context, when\n * task-structs get RCU-freed. Hence all locking must be softirq-safe.\n * But free_uid() is also called with local interrupts disabled, and running\n * local_bh_enable() with local interrupts disabled is an error - we'll run\n * softirq callbacks, and they can unconditionally enable interrupts, and\n * the caller of free_uid() didn't expect that..\n */\nstatic DEFINE_SPINLOCK(uidhash_lock);\n\nstruct user_struct root_user = {\n\t.__count\t= ATOMIC_INIT(1),\n\t.processes\t= ATOMIC_INIT(1),\n\t.files\t\t= ATOMIC_INIT(0),\n\t.sigpending\t= ATOMIC_INIT(0),\n\t.mq_bytes\t= 0,\n\t.locked_shm = 0,\n#ifdef CONFIG_KEYS\n\t.uid_keyring\t= &root_user_keyring,\n\t.session_keyring = &root_session_keyring,\n#endif\n};\n\n/*\n * These routines must be called with the uidhash spinlock held!\n */\nstatic inline void uid_hash_insert(struct user_struct *up, struct list_head *hashent)\n{\n\tlist_add(&up->uidhash_list, hashent);\n}\n\nstatic inline void uid_hash_remove(struct user_struct *up)\n{\n\tlist_del(&up->uidhash_list);\n}\n\nstatic inline struct user_struct *uid_hash_find(uid_t uid, struct list_head *hashent)\n{\n\tstruct list_head *up;\n\n\tlist_for_each(up, hashent) {\n\t\tstruct user_struct *user;\n\n\t\tuser = list_entry(up, struct user_struct, uidhash_list);\n\n\t\tif(user->uid == uid) {\n\t\t\tatomic_inc(&user->__count);\n\t\t\treturn user;\n\t\t}\n\t}\n\n\treturn NULL;\n}\n\n/*\n * Locate the user_struct for the passed UID. If found, take a ref on it. The\n * caller must undo that ref with free_uid().\n *\n * If the user_struct could not be found, return NULL.\n */\nstruct user_struct *find_user(uid_t uid)\n{\n\tstruct user_struct *ret;\n\tunsigned long flags;\n\n\tspin_lock_irqsave(&uidhash_lock, flags);\n\tret = uid_hash_find(uid, uidhashentry(uid));\n\tspin_unlock_irqrestore(&uidhash_lock, flags);\n\treturn ret;\n}\n\nvoid free_uid(struct user_struct *up)\n{\n\tunsigned long flags;\n\n\tif (!up)\n\t\treturn;\n\n\tlocal_irq_save(flags);\n\tif (atomic_dec_and_lock(&up->__count, &uidhash_lock)) {\n\t\tuid_hash_remove(up);\n\t\tspin_unlock_irqrestore(&uidhash_lock, flags);\n\t\tkey_put(up->uid_keyring);\n\t\tkey_put(up->session_keyring);\n\t\tkmem_cache_free(uid_cachep, up);\n\t} else {\n\t\tlocal_irq_restore(flags);\n\t}\n}\n\nstruct user_struct * alloc_uid(uid_t uid)\n{\n\tstruct list_head *hashent = uidhashentry(uid);\n\tstruct user_struct *up;\n\n\tspin_lock_irq(&uidhash_lock);\n\tup = uid_hash_find(uid, hashent);\n\tspin_unlock_irq(&uidhash_lock);\n\n\tif (!up) {\n\t\tstruct user_struct *new;\n\n\t\tnew = kmem_cache_alloc(uid_cachep, GFP_KERNEL);\n\t\tif (!new)\n\t\t\treturn NULL;\n\t\tnew->uid = uid;\n\t\tatomic_set(&new->__count, 1);\n\t\tatomic_set(&new->processes, 0);\n\t\tatomic_set(&new->files, 0);\n\t\tatomic_set(&new->sigpending, 0);\n#ifdef CONFIG_INOTIFY_USER\n\t\tatomic_set(&new->inotify_watches, 0);\n\t\tatomic_set(&new->inotify_devs, 0);\n#endif\n\n\t\tnew->mq_bytes = 0;\n\t\tnew->locked_shm = 0;\n\n\t\tif (alloc_uid_keyring(new, current) < 0) {\n\t\t\tkmem_cache_free(uid_cachep, new);\n\t\t\treturn NULL;\n\t\t}\n\n\t\t/*\n\t\t * Before adding this, check whether we raced\n\t\t * on adding the same user already..\n\t\t */\n\t\tspin_lock_irq(&uidhash_lock);\n\t\tup = uid_hash_find(uid, hashent);\n\t\tif (up) {\n\t\t\tkey_put(new->uid_keyring);\n\t\t\tkey_put(new->session_keyring);\n\t\t\tkmem_cache_free(uid_cachep, new);\n\t\t} else {\n\t\t\tuid_hash_insert(new, hashent);\n\t\t\tup = new;\n\t\t}\n\t\tspin_unlock_irq(&uidhash_lock);\n\n\t}\n\treturn up;\n}\n\nvoid switch_uid(struct user_struct *new_user)\n{\n\tstruct user_struct *old_user;\n\n\t/* What if a process setreuid()'s and this brings the\n\t * new uid over his NPROC rlimit? We can check this now\n\t * cheaply with the new uid cache, so if it matters\n\t * we should be checking for it. -DaveM\n\t */\n\told_user = current->user;\n\tatomic_inc(&new_user->processes);\n\tatomic_dec(&old_user->processes);\n\tswitch_uid_keyring(new_user);\n\tcurrent->user = new_user;\n\n\t/*\n\t * We need to synchronize with __sigqueue_alloc()\n\t * doing a get_uid(p->user).. If that saw the old\n\t * user value, we need to wait until it has exited\n\t * its critical region before we can free the old\n\t * structure.\n\t */\n\tsmp_mb();\n\tspin_unlock_wait(&current->sighand->siglock);\n\n\tfree_uid(old_user);\n\tsuid_keys(current);\n}\n\n\nstatic int __init uid_cache_init(void)\n{\n\tint n;\n\n\tuid_cachep = kmem_cache_create(\"uid_cache\", sizeof(struct user_struct),\n\t\t\t0, SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL);\n\n\tfor(n = 0; n < UIDHASH_SZ; ++n)\n\t\tINIT_LIST_HEAD(uidhash_table + n);\n\n\t/* Insert the root user immediately (init already runs as root) */\n\tspin_lock_irq(&uidhash_lock);\n\tuid_hash_insert(&root_user, uidhashentry(0));\n\tspin_unlock_irq(&uidhash_lock);\n\n\treturn 0;\n}\n\nmodule_init(uid_cache_init);\n/*\n * Copyright (C) 2004 IBM Corporation\n *\n * Author: Serge Hallyn <serue@us.ibm.com>\n *\n * This program is free software; you can redistribute it and/or\n * modify it under the terms of the GNU General Public License as\n * published by the Free Software Foundation, version 2 of the\n * License.\n */\n\n#include <linux/module.h>\n#include <linux/uts.h>\n#include <linux/utsname.h>\n#include <linux/version.h>\n\n/*\n * Clone a new ns copying an original utsname, setting refcount to 1\n * @old_ns: namespace to clone\n * Return NULL on error (failure to kmalloc), new ns otherwise\n */\nstatic struct uts_namespace *clone_uts_ns(struct uts_namespace *old_ns)\n{\n\tstruct uts_namespace *ns;\n\n\tns = kmalloc(sizeof(struct uts_namespace), GFP_KERNEL);\n\tif (ns) {\n\t\tmemcpy(&ns->name, &old_ns->name, sizeof(ns->name));\n\t\tkref_init(&ns->kref);\n\t}\n\treturn ns;\n}\n\n/*\n * Copy task tsk's utsname namespace, or clone it if flags\n * specifies CLONE_NEWUTS. In latter case, changes to the\n * utsname of this process won't be seen by parent, and vice\n * versa.\n */\nstruct uts_namespace *copy_utsname(int flags, struct uts_namespace *old_ns)\n{\n\tstruct uts_namespace *new_ns;\n\n\tBUG_ON(!old_ns);\n\tget_uts_ns(old_ns);\n\n\tif (!(flags & CLONE_NEWUTS))\n\t\treturn old_ns;\n\n\tnew_ns = clone_uts_ns(old_ns);\n\n\tput_uts_ns(old_ns);\n\treturn new_ns;\n}\n\nvoid free_uts_ns(struct kref *kref)\n{\n\tstruct uts_namespace *ns;\n\n\tns = container_of(kref, struct uts_namespace, kref);\n\tkfree(ns);\n}\n/*\n * Copyright (C) 2007\n *\n * Author: Eric Biederman <ebiederm@xmision.com>\n *\n * This program is free software; you can redistribute it and/or\n * modify it under the terms of the GNU General Public License as\n * published by the Free Software Foundation, version 2 of the\n * License.\n */\n\n#include <linux/module.h>\n#include <linux/uts.h>\n#include <linux/utsname.h>\n#include <linux/version.h>\n#include <linux/sysctl.h>\n\nstatic void *get_uts(ctl_table *table, int write)\n{\n\tchar *which = table->data;\n#ifdef CONFIG_UTS_NS\n\tstruct uts_namespace *uts_ns = current->nsproxy->uts_ns;\n\twhich = (which - (char *)&init_uts_ns) + (char *)uts_ns;\n#endif\n\tif (!write)\n\t\tdown_read(&uts_sem);\n\telse\n\t\tdown_write(&uts_sem);\n\treturn which;\n}\n\nstatic void put_uts(ctl_table *table, int write, void *which)\n{\n\tif (!write)\n\t\tup_read(&uts_sem);\n\telse\n\t\tup_write(&uts_sem);\n}\n\n#ifdef CONFIG_PROC_FS\n/*\n *\tSpecial case of dostring for the UTS structure. This has locks\n *\tto observe. Should this be in kernel/sys.c ????\n */\nstatic int proc_do_uts_string(ctl_table *table, int write, struct file *filp,\n\t\t void __user *buffer, size_t *lenp, loff_t *ppos)\n{\n\tstruct ctl_table uts_table;\n\tint r;\n\tmemcpy(&uts_table, table, sizeof(uts_table));\n\tuts_table.data = get_uts(table, write);\n\tr = proc_dostring(&uts_table,write,filp,buffer,lenp, ppos);\n\tput_uts(table, write, uts_table.data);\n\treturn r;\n}\n#else\n#define proc_do_uts_string NULL\n#endif\n\n\n#ifdef CONFIG_SYSCTL_SYSCALL\n/* The generic string strategy routine: */\nstatic int sysctl_uts_string(ctl_table *table, int __user *name, int nlen,\n\t\t void __user *oldval, size_t __user *oldlenp,\n\t\t void __user *newval, size_t newlen)\n{\n\tstruct ctl_table uts_table;\n\tint r, write;\n\twrite = newval && newlen;\n\tmemcpy(&uts_table, table, sizeof(uts_table));\n\tuts_table.data = get_uts(table, write);\n\tr = sysctl_string(&uts_table, name, nlen,\n\t\toldval, oldlenp, newval, newlen);\n\tput_uts(table, write, uts_table.data);\n\treturn r;\n}\n#else\n#define sysctl_uts_string NULL\n#endif\n\nstatic struct ctl_table uts_kern_table[] = {\n\t{\n\t\t.ctl_name\t= KERN_OSTYPE,\n\t\t.procname\t= \"ostype\",\n\t\t.data\t\t= init_uts_ns.name.sysname,\n\t\t.maxlen\t\t= sizeof(init_uts_ns.name.sysname),\n\t\t.mode\t\t= 0444,\n\t\t.proc_handler\t= proc_do_uts_string,\n\t\t.strategy\t= sysctl_uts_string,\n\t},\n\t{\n\t\t.ctl_name\t= KERN_OSRELEASE,\n\t\t.procname\t= \"osrelease\",\n\t\t.data\t\t= init_uts_ns.name.release,\n\t\t.maxlen\t\t= sizeof(init_uts_ns.name.release),\n\t\t.mode\t\t= 0444,\n\t\t.proc_handler\t= proc_do_uts_string,\n\t\t.strategy\t= sysctl_uts_string,\n\t},\n\t{\n\t\t.ctl_name\t= KERN_VERSION,\n\t\t.procname\t= \"version\",\n\t\t.data\t\t= init_uts_ns.name.version,\n\t\t.maxlen\t\t= sizeof(init_uts_ns.name.version),\n\t\t.mode\t\t= 0444,\n\t\t.proc_handler\t= proc_do_uts_string,\n\t\t.strategy\t= sysctl_uts_string,\n\t},\n\t{\n\t\t.ctl_name\t= KERN_NODENAME,\n\t\t.procname\t= \"hostname\",\n\t\t.data\t\t= init_uts_ns.name.nodename,\n\t\t.maxlen\t\t= sizeof(init_uts_ns.name.nodename),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= proc_do_uts_string,\n\t\t.strategy\t= sysctl_uts_string,\n\t},\n\t{\n\t\t.ctl_name\t= KERN_DOMAINNAME,\n\t\t.procname\t= \"domainname\",\n\t\t.data\t\t= init_uts_ns.name.domainname,\n\t\t.maxlen\t\t= sizeof(init_uts_ns.name.domainname),\n\t\t.mode\t\t= 0644,\n\t\t.proc_handler\t= proc_do_uts_string,\n\t\t.strategy\t= sysctl_uts_string,\n\t},\n\t{}\n};\n\nstatic struct ctl_table uts_root_table[] = {\n\t{\n\t\t.ctl_name\t= CTL_KERN,\n\t\t.procname\t= \"kernel\",\n\t\t.mode\t\t= 0555,\n\t\t.child\t\t= uts_kern_table,\n\t},\n\t{}\n};\n\nstatic int __init utsname_sysctl_init(void)\n{\n\tregister_sysctl_table(uts_root_table);\n\treturn 0;\n}\n\n__initcall(utsname_sysctl_init);\n/*\n * Generic waiting primitives.\n *\n * (C) 2004 William Irwin, Oracle\n */\n#include <linux/init.h>\n#include <linux/module.h>\n#include <linux/sched.h>\n#include <linux/mm.h>\n#include <linux/wait.h>\n#include <linux/hash.h>\n\nvoid init_waitqueue_head(wait_queue_head_t *q)\n{\n\tspin_lock_init(&q->lock);\n\tINIT_LIST_HEAD(&q->task_list);\n}\n\nEXPORT_SYMBOL(init_waitqueue_head);\n\nvoid fastcall add_wait_queue(wait_queue_head_t *q, wait_queue_t *wait)\n{\n\tunsigned long flags;\n\n\twait->flags &= ~WQ_FLAG_EXCLUSIVE;\n\tspin_lock_irqsave(&q->lock, flags);\n\t__add_wait_queue(q, wait);\n\tspin_unlock_irqrestore(&q->lock, flags);\n}\nEXPORT_SYMBOL(add_wait_queue);\n\nvoid fastcall add_wait_queue_exclusive(wait_queue_head_t *q, wait_queue_t *wait)\n{\n\tunsigned long flags;\n\n\twait->flags |= WQ_FLAG_EXCLUSIVE;\n\tspin_lock_irqsave(&q->lock, flags);\n\t__add_wait_queue_tail(q, wait);\n\tspin_unlock_irqrestore(&q->lock, flags);\n}\nEXPORT_SYMBOL(add_wait_queue_exclusive);\n\nvoid fastcall remove_wait_queue(wait_queue_head_t *q, wait_queue_t *wait)\n{\n\tunsigned long flags;\n\n\tspin_lock_irqsave(&q->lock, flags);\n\t__remove_wait_queue(q, wait);\n\tspin_unlock_irqrestore(&q->lock, flags);\n}\nEXPORT_SYMBOL(remove_wait_queue);\n\n\n/*\n * Note: we use \"set_current_state()\" _after_ the wait-queue add,\n * because we need a memory barrier there on SMP, so that any\n * wake-function that tests for the wait-queue being active\n * will be guaranteed to see waitqueue addition _or_ subsequent\n * tests in this thread will see the wakeup having taken place.\n *\n * The spin_unlock() itself is semi-permeable and only protects\n * one way (it only protects stuff inside the critical region and\n * stops them from bleeding out - it would still allow subsequent\n * loads to move into the critical region).\n */\nvoid fastcall\nprepare_to_wait(wait_queue_head_t *q, wait_queue_t *wait, int state)\n{\n\tunsigned long flags;\n\n\twait->flags &= ~WQ_FLAG_EXCLUSIVE;\n\tspin_lock_irqsave(&q->lock, flags);\n\tif (list_empty(&wait->task_list))\n\t\t__add_wait_queue(q, wait);\n\t/*\n\t * don't alter the task state if this is just going to\n\t * queue an async wait queue callback\n\t */\n\tif (is_sync_wait(wait))\n\t\tset_current_state(state);\n\tspin_unlock_irqrestore(&q->lock, flags);\n}\nEXPORT_SYMBOL(prepare_to_wait);\n\nvoid fastcall\nprepare_to_wait_exclusive(wait_queue_head_t *q, wait_queue_t *wait, int state)\n{\n\tunsigned long flags;\n\n\twait->flags |= WQ_FLAG_EXCLUSIVE;\n\tspin_lock_irqsave(&q->lock, flags);\n\tif (list_empty(&wait->task_list))\n\t\t__add_wait_queue_tail(q, wait);\n\t/*\n\t * don't alter the task state if this is just going to\n \t * queue an async wait queue callback\n\t */\n\tif (is_sync_wait(wait))\n\t\tset_current_state(state);\n\tspin_unlock_irqrestore(&q->lock, flags);\n}\nEXPORT_SYMBOL(prepare_to_wait_exclusive);\n\nvoid fastcall finish_wait(wait_queue_head_t *q, wait_queue_t *wait)\n{\n\tunsigned long flags;\n\n\t__set_current_state(TASK_RUNNING);\n\t/*\n\t * We can check for list emptiness outside the lock\n\t * IFF:\n\t * - we use the \"careful\" check that verifies both\n\t * the next and prev pointers, so that there cannot\n\t * be any half-pending updates in progress on other\n\t * CPU's that we haven't seen yet (and that might\n\t * still change the stack area.\n\t * and\n\t * - all other users take the lock (ie we can only\n\t * have _one_ other CPU that looks at or modifies\n\t * the list).\n\t */\n\tif (!list_empty_careful(&wait->task_list)) {\n\t\tspin_lock_irqsave(&q->lock, flags);\n\t\tlist_del_init(&wait->task_list);\n\t\tspin_unlock_irqrestore(&q->lock, flags);\n\t}\n}\nEXPORT_SYMBOL(finish_wait);\n\nint autoremove_wake_function(wait_queue_t *wait, unsigned mode, int sync, void *key)\n{\n\tint ret = default_wake_function(wait, mode, sync, key);\n\n\tif (ret)\n\t\tlist_del_init(&wait->task_list);\n\treturn ret;\n}\nEXPORT_SYMBOL(autoremove_wake_function);\n\nint wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *arg)\n{\n\tstruct wait_bit_key *key = arg;\n\tstruct wait_bit_queue *wait_bit\n\t\t= container_of(wait, struct wait_bit_queue, wait);\n\n\tif (wait_bit->key.flags != key->flags ||\n\t\t\twait_bit->key.bit_nr != key->bit_nr ||\n\t\t\ttest_bit(key->bit_nr, key->flags))\n\t\treturn 0;\n\telse\n\t\treturn autoremove_wake_function(wait, mode, sync, key);\n}\nEXPORT_SYMBOL(wake_bit_function);\n\n/*\n * To allow interruptible waiting and asynchronous (i.e. nonblocking)\n * waiting, the actions of __wait_on_bit() and __wait_on_bit_lock() are\n * permitted return codes. Nonzero return codes halt waiting and return.\n */\nint __sched fastcall\n__wait_on_bit(wait_queue_head_t *wq, struct wait_bit_queue *q,\n\t\t\tint (*action)(void *), unsigned mode)\n{\n\tint ret = 0;\n\n\tdo {\n\t\tprepare_to_wait(wq, &q->wait, mode);\n\t\tif (test_bit(q->key.bit_nr, q->key.flags))\n\t\t\tret = (*action)(q->key.flags);\n\t} while (test_bit(q->key.bit_nr, q->key.flags) && !ret);\n\tfinish_wait(wq, &q->wait);\n\treturn ret;\n}\nEXPORT_SYMBOL(__wait_on_bit);\n\nint __sched fastcall out_of_line_wait_on_bit(void *word, int bit,\n\t\t\t\t\tint (*action)(void *), unsigned mode)\n{\n\twait_queue_head_t *wq = bit_waitqueue(word, bit);\n\tDEFINE_WAIT_BIT(wait, word, bit);\n\n\treturn __wait_on_bit(wq, &wait, action, mode);\n}\nEXPORT_SYMBOL(out_of_line_wait_on_bit);\n\nint __sched fastcall\n__wait_on_bit_lock(wait_queue_head_t *wq, struct wait_bit_queue *q,\n\t\t\tint (*action)(void *), unsigned mode)\n{\n\tint ret = 0;\n\n\tdo {\n\t\tprepare_to_wait_exclusive(wq, &q->wait, mode);\n\t\tif (test_bit(q->key.bit_nr, q->key.flags)) {\n\t\t\tif ((ret = (*action)(q->key.flags)))\n\t\t\t\tbreak;\n\t\t}\n\t} while (test_and_set_bit(q->key.bit_nr, q->key.flags));\n\tfinish_wait(wq, &q->wait);\n\treturn ret;\n}\nEXPORT_SYMBOL(__wait_on_bit_lock);\n\nint __sched fastcall out_of_line_wait_on_bit_lock(void *word, int bit,\n\t\t\t\t\tint (*action)(void *), unsigned mode)\n{\n\twait_queue_head_t *wq = bit_waitqueue(word, bit);\n\tDEFINE_WAIT_BIT(wait, word, bit);\n\n\treturn __wait_on_bit_lock(wq, &wait, action, mode);\n}\nEXPORT_SYMBOL(out_of_line_wait_on_bit_lock);\n\nvoid fastcall __wake_up_bit(wait_queue_head_t *wq, void *word, int bit)\n{\n\tstruct wait_bit_key key = __WAIT_BIT_KEY_INITIALIZER(word, bit);\n\tif (waitqueue_active(wq))\n\t\t__wake_up(wq, TASK_INTERRUPTIBLE|TASK_UNINTERRUPTIBLE, 1, &key);\n}\nEXPORT_SYMBOL(__wake_up_bit);\n\n/**\n * wake_up_bit - wake up a waiter on a bit\n * @word: the word being waited on, a kernel virtual address\n * @bit: the bit of the word being waited on\n *\n * There is a standard hashed waitqueue table for generic use. This\n * is the part of the hashtable's accessor API that wakes up waiters\n * on a bit. For instance, if one were to have waiters on a bitflag,\n * one would call wake_up_bit() after clearing the bit.\n *\n * In order for this to function properly, as it uses waitqueue_active()\n * internally, some kind of memory barrier must be done prior to calling\n * this. Typically, this will be smp_mb__after_clear_bit(), but in some\n * cases where bitflags are manipulated non-atomically under a lock, one\n * may need to use a less regular barrier, such fs/inode.c's smp_mb(),\n * because spin_unlock() does not guarantee a memory barrier.\n */\nvoid fastcall wake_up_bit(void *word, int bit)\n{\n\t__wake_up_bit(bit_waitqueue(word, bit), word, bit);\n}\nEXPORT_SYMBOL(wake_up_bit);\n\nfastcall wait_queue_head_t *bit_waitqueue(void *word, int bit)\n{\n\tconst int shift = BITS_PER_LONG == 32 ? 5 : 6;\n\tconst struct zone *zone = page_zone(virt_to_page(word));\n\tunsigned long val = (unsigned long)word << shift | bit;\n\n\treturn &zone->wait_table[hash_long(val, zone->wait_table_bits)];\n}\nEXPORT_SYMBOL(bit_waitqueue);\n/*\n * linux/kernel/workqueue.c\n *\n * Generic mechanism for defining kernel helper threads for running\n * arbitrary tasks in process context.\n *\n * Started by Ingo Molnar, Copyright (C) 2002\n *\n * Derived from the taskqueue/keventd code by:\n *\n * David Woodhouse <dwmw2@infradead.org>\n * Andrew Morton <andrewm@uow.edu.au>\n * Kai Petzke <wpp@marie.physik.tu-berlin.de>\n * Theodore Ts'o <tytso@mit.edu>\n *\n * Made to use alloc_percpu by Christoph Lameter <clameter@sgi.com>.\n */\n\n#include <linux/module.h>\n#include <linux/kernel.h>\n#include <linux/sched.h>\n#include <linux/init.h>\n#include <linux/signal.h>\n#include <linux/completion.h>\n#include <linux/workqueue.h>\n#include <linux/slab.h>\n#include <linux/cpu.h>\n#include <linux/notifier.h>\n#include <linux/kthread.h>\n#include <linux/hardirq.h>\n#include <linux/mempolicy.h>\n#include <linux/freezer.h>\n#include <linux/kallsyms.h>\n#include <linux/debug_locks.h>\n\n/*\n * The per-CPU workqueue (if single thread, we always use the first\n * possible cpu).\n */\nstruct cpu_workqueue_struct {\n\n\tspinlock_t lock;\n\n\tstruct list_head worklist;\n\twait_queue_head_t more_work;\n\tstruct work_struct *current_work;\n\n\tstruct workqueue_struct *wq;\n\tstruct task_struct *thread;\n\n\tint run_depth;\t\t/* Detect run_workqueue() recursion depth */\n} ____cacheline_aligned;\n\n/*\n * The externally visible workqueue abstraction is an array of\n * per-CPU workqueues:\n */\nstruct workqueue_struct {\n\tstruct cpu_workqueue_struct *cpu_wq;\n\tstruct list_head list;\n\tconst char *name;\n\tint singlethread;\n\tint freezeable;\t\t/* Freeze threads during suspend */\n};\n\n/* All the per-cpu workqueues on the system, for hotplug cpu to add/remove\n threads to each one as cpus come/go. */\nstatic DEFINE_MUTEX(workqueue_mutex);\nstatic LIST_HEAD(workqueues);\n\nstatic int singlethread_cpu __read_mostly;\nstatic cpumask_t cpu_singlethread_map __read_mostly;\n/*\n * _cpu_down() first removes CPU from cpu_online_map, then CPU_DEAD\n * flushes cwq->worklist. This means that flush_workqueue/wait_on_work\n * which comes in between can't use for_each_online_cpu(). We could\n * use cpu_possible_map, the cpumask below is more a documentation\n * than optimization.\n */\nstatic cpumask_t cpu_populated_map __read_mostly;\n\n/* If it's single threaded, it isn't in the list of workqueues. */\nstatic inline int is_single_threaded(struct workqueue_struct *wq)\n{\n\treturn wq->singlethread;\n}\n\nstatic const cpumask_t *wq_cpu_map(struct workqueue_struct *wq)\n{\n\treturn is_single_threaded(wq)\n\t\t? &cpu_singlethread_map : &cpu_populated_map;\n}\n\nstatic\nstruct cpu_workqueue_struct *wq_per_cpu(struct workqueue_struct *wq, int cpu)\n{\n\tif (unlikely(is_single_threaded(wq)))\n\t\tcpu = singlethread_cpu;\n\treturn per_cpu_ptr(wq->cpu_wq, cpu);\n}\n\n/*\n * Set the workqueue on which a work item is to be run\n * - Must *only* be called if the pending flag is set\n */\nstatic inline void set_wq_data(struct work_struct *work,\n\t\t\t\tstruct cpu_workqueue_struct *cwq)\n{\n\tunsigned long new;\n\n\tBUG_ON(!work_pending(work));\n\n\tnew = (unsigned long) cwq | (1UL << WORK_STRUCT_PENDING);\n\tnew |= WORK_STRUCT_FLAG_MASK & *work_data_bits(work);\n\tatomic_long_set(&work->data, new);\n}\n\nstatic inline\nstruct cpu_workqueue_struct *get_wq_data(struct work_struct *work)\n{\n\treturn (void *) (atomic_long_read(&work->data) & WORK_STRUCT_WQ_DATA_MASK);\n}\n\nstatic void insert_work(struct cpu_workqueue_struct *cwq,\n\t\t\t\tstruct work_struct *work, int tail)\n{\n\tset_wq_data(work, cwq);\n\t/*\n\t * Ensure that we get the right work->data if we see the\n\t * result of list_add() below, see try_to_grab_pending().\n\t */\n\tsmp_wmb();\n\tif (tail)\n\t\tlist_add_tail(&work->entry, &cwq->worklist);\n\telse\n\t\tlist_add(&work->entry, &cwq->worklist);\n\twake_up(&cwq->more_work);\n}\n\n/* Preempt must be disabled. */\nstatic void __queue_work(struct cpu_workqueue_struct *cwq,\n\t\t\t struct work_struct *work)\n{\n\tunsigned long flags;\n\n\tspin_lock_irqsave(&cwq->lock, flags);\n\tinsert_work(cwq, work, 1);\n\tspin_unlock_irqrestore(&cwq->lock, flags);\n}\n\n/**\n * queue_work - queue work on a workqueue\n * @wq: workqueue to use\n * @work: work to queue\n *\n * Returns 0 if @work was already on a queue, non-zero otherwise.\n *\n * We queue the work to the CPU it was submitted, but there is no\n * guarantee that it will be processed by that CPU.\n */\nint fastcall queue_work(struct workqueue_struct *wq, struct work_struct *work)\n{\n\tint ret = 0;\n\n\tif (!test_and_set_bit(WORK_STRUCT_PENDING, work_data_bits(work))) {\n\t\tBUG_ON(!list_empty(&work->entry));\n\t\t__queue_work(wq_per_cpu(wq, get_cpu()), work);\n\t\tput_cpu();\n\t\tret = 1;\n\t}\n\treturn ret;\n}\nEXPORT_SYMBOL_GPL(queue_work);\n\nvoid delayed_work_timer_fn(unsigned long __data)\n{\n\tstruct delayed_work *dwork = (struct delayed_work *)__data;\n\tstruct cpu_workqueue_struct *cwq = get_wq_data(&dwork->work);\n\tstruct workqueue_struct *wq = cwq->wq;\n\n\t__queue_work(wq_per_cpu(wq, smp_processor_id()), &dwork->work);\n}\n\n/**\n * queue_delayed_work - queue work on a workqueue after delay\n * @wq: workqueue to use\n * @dwork: delayable work to queue\n * @delay: number of jiffies to wait before queueing\n *\n * Returns 0 if @work was already on a queue, non-zero otherwise.\n */\nint fastcall queue_delayed_work(struct workqueue_struct *wq,\n\t\t\tstruct delayed_work *dwork, unsigned long delay)\n{\n\ttimer_stats_timer_set_start_info(&dwork->timer);\n\tif (delay == 0)\n\t\treturn queue_work(wq, &dwork->work);\n\n\treturn queue_delayed_work_on(-1, wq, dwork, delay);\n}\nEXPORT_SYMBOL_GPL(queue_delayed_work);\n\n/**\n * queue_delayed_work_on - queue work on specific CPU after delay\n * @cpu: CPU number to execute work on\n * @wq: workqueue to use\n * @dwork: work to queue\n * @delay: number of jiffies to wait before queueing\n *\n * Returns 0 if @work was already on a queue, non-zero otherwise.\n */\nint queue_delayed_work_on(int cpu, struct workqueue_struct *wq,\n\t\t\tstruct delayed_work *dwork, unsigned long delay)\n{\n\tint ret = 0;\n\tstruct timer_list *timer = &dwork->timer;\n\tstruct work_struct *work = &dwork->work;\n\n\tif (!test_and_set_bit(WORK_STRUCT_PENDING, work_data_bits(work))) {\n\t\tBUG_ON(timer_pending(timer));\n\t\tBUG_ON(!list_empty(&work->entry));\n\n\t\t/* This stores cwq for the moment, for the timer_fn */\n\t\tset_wq_data(work, wq_per_cpu(wq, raw_smp_processor_id()));\n\t\ttimer->expires = jiffies + delay;\n\t\ttimer->data = (unsigned long)dwork;\n\t\ttimer->function = delayed_work_timer_fn;\n\n\t\tif (unlikely(cpu >= 0))\n\t\t\tadd_timer_on(timer, cpu);\n\t\telse\n\t\t\tadd_timer(timer);\n\t\tret = 1;\n\t}\n\treturn ret;\n}\nEXPORT_SYMBOL_GPL(queue_delayed_work_on);\n\nstatic void run_workqueue(struct cpu_workqueue_struct *cwq)\n{\n\tspin_lock_irq(&cwq->lock);\n\tcwq->run_depth++;\n\tif (cwq->run_depth > 3) {\n\t\t/* morton gets to eat his hat */\n\t\tprintk(\"%s: recursion depth exceeded: %d\\n\",\n\t\t\t__FUNCTION__, cwq->run_depth);\n\t\tdump_stack();\n\t}\n\twhile (!list_empty(&cwq->worklist)) {\n\t\tstruct work_struct *work = list_entry(cwq->worklist.next,\n\t\t\t\t\t\tstruct work_struct, entry);\n\t\twork_func_t f = work->func;\n\n\t\tcwq->current_work = work;\n\t\tlist_del_init(cwq->worklist.next);\n\t\tspin_unlock_irq(&cwq->lock);\n\n\t\tBUG_ON(get_wq_data(work) != cwq);\n\t\twork_clear_pending(work);\n\t\tf(work);\n\n\t\tif (unlikely(in_atomic() || lockdep_depth(current) > 0)) {\n\t\t\tprintk(KERN_ERR \"BUG: workqueue leaked lock or atomic: \"\n\t\t\t\t\t\"%s/0x%08x/%d\\n\",\n\t\t\t\t\tcurrent->comm, preempt_count(),\n\t\t\t\t \tcurrent->pid);\n\t\t\tprintk(KERN_ERR \" last function: \");\n\t\t\tprint_symbol(\"%s\\n\", (unsigned long)f);\n\t\t\tdebug_show_held_locks(current);\n\t\t\tdump_stack();\n\t\t}\n\n\t\tspin_lock_irq(&cwq->lock);\n\t\tcwq->current_work = NULL;\n\t}\n\tcwq->run_depth--;\n\tspin_unlock_irq(&cwq->lock);\n}\n\nstatic int worker_thread(void *__cwq)\n{\n\tstruct cpu_workqueue_struct *cwq = __cwq;\n\tDEFINE_WAIT(wait);\n\n\tif (!cwq->wq->freezeable)\n\t\tcurrent->flags |= PF_NOFREEZE;\n\n\tset_user_nice(current, -5);\n\n\tfor (;;) {\n\t\tprepare_to_wait(&cwq->more_work, &wait, TASK_INTERRUPTIBLE);\n\t\tif (!freezing(current) &&\n\t\t !kthread_should_stop() &&\n\t\t list_empty(&cwq->worklist))\n\t\t\tschedule();\n\t\tfinish_wait(&cwq->more_work, &wait);\n\n\t\ttry_to_freeze();\n\n\t\tif (kthread_should_stop())\n\t\t\tbreak;\n\n\t\trun_workqueue(cwq);\n\t}\n\n\treturn 0;\n}\n\nstruct wq_barrier {\n\tstruct work_struct\twork;\n\tstruct completion\tdone;\n};\n\nstatic void wq_barrier_func(struct work_struct *work)\n{\n\tstruct wq_barrier *barr = container_of(work, struct wq_barrier, work);\n\tcomplete(&barr->done);\n}\n\nstatic void insert_wq_barrier(struct cpu_workqueue_struct *cwq,\n\t\t\t\t\tstruct wq_barrier *barr, int tail)\n{\n\tINIT_WORK(&barr->work, wq_barrier_func);\n\t__set_bit(WORK_STRUCT_PENDING, work_data_bits(&barr->work));\n\n\tinit_completion(&barr->done);\n\n\tinsert_work(cwq, &barr->work, tail);\n}\n\nstatic int flush_cpu_workqueue(struct cpu_workqueue_struct *cwq)\n{\n\tint active;\n\n\tif (cwq->thread == current) {\n\t\t/*\n\t\t * Probably keventd trying to flush its own queue. So simply run\n\t\t * it by hand rather than deadlocking.\n\t\t */\n\t\trun_workqueue(cwq);\n\t\tactive = 1;\n\t} else {\n\t\tstruct wq_barrier barr;\n\n\t\tactive = 0;\n\t\tspin_lock_irq(&cwq->lock);\n\t\tif (!list_empty(&cwq->worklist) || cwq->current_work != NULL) {\n\t\t\tinsert_wq_barrier(cwq, &barr, 1);\n\t\t\tactive = 1;\n\t\t}\n\t\tspin_unlock_irq(&cwq->lock);\n\n\t\tif (active)\n\t\t\twait_for_completion(&barr.done);\n\t}\n\n\treturn active;\n}\n\n/**\n * flush_workqueue - ensure that any scheduled work has run to completion.\n * @wq: workqueue to flush\n *\n * Forces execution of the workqueue and blocks until its completion.\n * This is typically used in driver shutdown handlers.\n *\n * We sleep until all works which were queued on entry have been handled,\n * but we are not livelocked by new incoming ones.\n *\n * This function used to run the workqueues itself. Now we just wait for the\n * helper threads to do it.\n */\nvoid fastcall flush_workqueue(struct workqueue_struct *wq)\n{\n\tconst cpumask_t *cpu_map = wq_cpu_map(wq);\n\tint cpu;\n\n\tmight_sleep();\n\tfor_each_cpu_mask(cpu, *cpu_map)\n\t\tflush_cpu_workqueue(per_cpu_ptr(wq->cpu_wq, cpu));\n}\nEXPORT_SYMBOL_GPL(flush_workqueue);\n\n/*\n * Upon a successful return, the caller \"owns\" WORK_STRUCT_PENDING bit,\n * so this work can't be re-armed in any way.\n */\nstatic int try_to_grab_pending(struct work_struct *work)\n{\n\tstruct cpu_workqueue_struct *cwq;\n\tint ret = 0;\n\n\tif (!test_and_set_bit(WORK_STRUCT_PENDING, work_data_bits(work)))\n\t\treturn 1;\n\n\t/*\n\t * The queueing is in progress, or it is already queued. Try to\n\t * steal it from ->worklist without clearing WORK_STRUCT_PENDING.\n\t */\n\n\tcwq = get_wq_data(work);\n\tif (!cwq)\n\t\treturn ret;\n\n\tspin_lock_irq(&cwq->lock);\n\tif (!list_empty(&work->entry)) {\n\t\t/*\n\t\t * This work is queued, but perhaps we locked the wrong cwq.\n\t\t * In that case we must see the new value after rmb(), see\n\t\t * insert_work()->wmb().\n\t\t */\n\t\tsmp_rmb();\n\t\tif (cwq == get_wq_data(work)) {\n\t\t\tlist_del_init(&work->entry);\n\t\t\tret = 1;\n\t\t}\n\t}\n\tspin_unlock_irq(&cwq->lock);\n\n\treturn ret;\n}\n\nstatic void wait_on_cpu_work(struct cpu_workqueue_struct *cwq,\n\t\t\t\tstruct work_struct *work)\n{\n\tstruct wq_barrier barr;\n\tint running = 0;\n\n\tspin_lock_irq(&cwq->lock);\n\tif (unlikely(cwq->current_work == work)) {\n\t\tinsert_wq_barrier(cwq, &barr, 0);\n\t\trunning = 1;\n\t}\n\tspin_unlock_irq(&cwq->lock);\n\n\tif (unlikely(running))\n\t\twait_for_completion(&barr.done);\n}\n\nstatic void wait_on_work(struct work_struct *work)\n{\n\tstruct cpu_workqueue_struct *cwq;\n\tstruct workqueue_struct *wq;\n\tconst cpumask_t *cpu_map;\n\tint cpu;\n\n\tmight_sleep();\n\n\tcwq = get_wq_data(work);\n\tif (!cwq)\n\t\treturn;\n\n\twq = cwq->wq;\n\tcpu_map = wq_cpu_map(wq);\n\n\tfor_each_cpu_mask(cpu, *cpu_map)\n\t\twait_on_cpu_work(per_cpu_ptr(wq->cpu_wq, cpu), work);\n}\n\n/**\n * cancel_work_sync - block until a work_struct's callback has terminated\n * @work: the work which is to be flushed\n *\n * cancel_work_sync() will cancel the work if it is queued. If the work's\n * callback appears to be running, cancel_work_sync() will block until it\n * has completed.\n *\n * It is possible to use this function if the work re-queues itself. It can\n * cancel the work even if it migrates to another workqueue, however in that\n * case it only guarantees that work->func() has completed on the last queued\n * workqueue.\n *\n * cancel_work_sync(&delayed_work->work) should be used only if ->timer is not\n * pending, otherwise it goes into a busy-wait loop until the timer expires.\n *\n * The caller must ensure that workqueue_struct on which this work was last\n * queued can't be destroyed before this function returns.\n */\nvoid cancel_work_sync(struct work_struct *work)\n{\n\twhile (!try_to_grab_pending(work))\n\t\tcpu_relax();\n\twait_on_work(work);\n\twork_clear_pending(work);\n}\nEXPORT_SYMBOL_GPL(cancel_work_sync);\n\n/**\n * cancel_rearming_delayed_work - reliably kill off a delayed work.\n * @dwork: the delayed work struct\n *\n * It is possible to use this function if @dwork rearms itself via queue_work()\n * or queue_delayed_work(). See also the comment for cancel_work_sync().\n */\nvoid cancel_rearming_delayed_work(struct delayed_work *dwork)\n{\n\twhile (!del_timer(&dwork->timer) &&\n\t !try_to_grab_pending(&dwork->work))\n\t\tcpu_relax();\n\twait_on_work(&dwork->work);\n\twork_clear_pending(&dwork->work);\n}\nEXPORT_SYMBOL(cancel_rearming_delayed_work);\n\nstatic struct workqueue_struct *keventd_wq __read_mostly;\n\n/**\n * schedule_work - put work task in global workqueue\n * @work: job to be done\n *\n * This puts a job in the kernel-global workqueue.\n */\nint fastcall schedule_work(struct work_struct *work)\n{\n\treturn queue_work(keventd_wq, work);\n}\nEXPORT_SYMBOL(schedule_work);\n\n/**\n * schedule_delayed_work - put work task in global workqueue after delay\n * @dwork: job to be done\n * @delay: number of jiffies to wait or 0 for immediate execution\n *\n * After waiting for a given time this puts a job in the kernel-global\n * workqueue.\n */\nint fastcall schedule_delayed_work(struct delayed_work *dwork,\n\t\t\t\t\tunsigned long delay)\n{\n\ttimer_stats_timer_set_start_info(&dwork->timer);\n\treturn queue_delayed_work(keventd_wq, dwork, delay);\n}\nEXPORT_SYMBOL(schedule_delayed_work);\n\n/**\n * schedule_delayed_work_on - queue work in global workqueue on CPU after delay\n * @cpu: cpu to use\n * @dwork: job to be done\n * @delay: number of jiffies to wait\n *\n * After waiting for a given time this puts a job in the kernel-global\n * workqueue on the specified CPU.\n */\nint schedule_delayed_work_on(int cpu,\n\t\t\tstruct delayed_work *dwork, unsigned long delay)\n{\n\treturn queue_delayed_work_on(cpu, keventd_wq, dwork, delay);\n}\nEXPORT_SYMBOL(schedule_delayed_work_on);\n\n/**\n * schedule_on_each_cpu - call a function on each online CPU from keventd\n * @func: the function to call\n *\n * Returns zero on success.\n * Returns -ve errno on failure.\n *\n * Appears to be racy against CPU hotplug.\n *\n * schedule_on_each_cpu() is very slow.\n */\nint schedule_on_each_cpu(work_func_t func)\n{\n\tint cpu;\n\tstruct work_struct *works;\n\n\tworks = alloc_percpu(struct work_struct);\n\tif (!works)\n\t\treturn -ENOMEM;\n\n\tpreempt_disable();\t\t/* CPU hotplug */\n\tfor_each_online_cpu(cpu) {\n\t\tstruct work_struct *work = per_cpu_ptr(works, cpu);\n\n\t\tINIT_WORK(work, func);\n\t\tset_bit(WORK_STRUCT_PENDING, work_data_bits(work));\n\t\t__queue_work(per_cpu_ptr(keventd_wq->cpu_wq, cpu), work);\n\t}\n\tpreempt_enable();\n\tflush_workqueue(keventd_wq);\n\tfree_percpu(works);\n\treturn 0;\n}\n\nvoid flush_scheduled_work(void)\n{\n\tflush_workqueue(keventd_wq);\n}\nEXPORT_SYMBOL(flush_scheduled_work);\n\n/**\n * execute_in_process_context - reliably execute the routine with user context\n * @fn:\t\tthe function to execute\n * @ew:\t\tguaranteed storage for the execute work structure (must\n *\t\tbe available when the work executes)\n *\n * Executes the function immediately if process context is available,\n * otherwise schedules the function for delayed execution.\n *\n * Returns:\t0 - function was executed\n *\t\t1 - function was scheduled for execution\n */\nint execute_in_process_context(work_func_t fn, struct execute_work *ew)\n{\n\tif (!in_interrupt()) {\n\t\tfn(&ew->work);\n\t\treturn 0;\n\t}\n\n\tINIT_WORK(&ew->work, fn);\n\tschedule_work(&ew->work);\n\n\treturn 1;\n}\nEXPORT_SYMBOL_GPL(execute_in_process_context);\n\nint keventd_up(void)\n{\n\treturn keventd_wq != NULL;\n}\n\nint current_is_keventd(void)\n{\n\tstruct cpu_workqueue_struct *cwq;\n\tint cpu = smp_processor_id();\t/* preempt-safe: keventd is per-cpu */\n\tint ret = 0;\n\n\tBUG_ON(!keventd_wq);\n\n\tcwq = per_cpu_ptr(keventd_wq->cpu_wq, cpu);\n\tif (current == cwq->thread)\n\t\tret = 1;\n\n\treturn ret;\n\n}\n\nstatic struct cpu_workqueue_struct *\ninit_cpu_workqueue(struct workqueue_struct *wq, int cpu)\n{\n\tstruct cpu_workqueue_struct *cwq = per_cpu_ptr(wq->cpu_wq, cpu);\n\n\tcwq->wq = wq;\n\tspin_lock_init(&cwq->lock);\n\tINIT_LIST_HEAD(&cwq->worklist);\n\tinit_waitqueue_head(&cwq->more_work);\n\n\treturn cwq;\n}\n\nstatic int create_workqueue_thread(struct cpu_workqueue_struct *cwq, int cpu)\n{\n\tstruct workqueue_struct *wq = cwq->wq;\n\tconst char *fmt = is_single_threaded(wq) ? \"%s\" : \"%s/%d\";\n\tstruct task_struct *p;\n\n\tp = kthread_create(worker_thread, cwq, fmt, wq->name, cpu);\n\t/*\n\t * Nobody can add the work_struct to this cwq,\n\t *\tif (caller is __create_workqueue)\n\t *\t\tnobody should see this wq\n\t *\telse // caller is CPU_UP_PREPARE\n\t *\t\tcpu is not on cpu_online_map\n\t * so we can abort safely.\n\t */\n\tif (IS_ERR(p))\n\t\treturn PTR_ERR(p);\n\n\tcwq->thread = p;\n\n\treturn 0;\n}\n\nstatic void start_workqueue_thread(struct cpu_workqueue_struct *cwq, int cpu)\n{\n\tstruct task_struct *p = cwq->thread;\n\n\tif (p != NULL) {\n\t\tif (cpu >= 0)\n\t\t\tkthread_bind(p, cpu);\n\t\twake_up_process(p);\n\t}\n}\n\nstruct workqueue_struct *__create_workqueue(const char *name,\n\t\t\t\t\t int singlethread, int freezeable)\n{\n\tstruct workqueue_struct *wq;\n\tstruct cpu_workqueue_struct *cwq;\n\tint err = 0, cpu;\n\n\twq = kzalloc(sizeof(*wq), GFP_KERNEL);\n\tif (!wq)\n\t\treturn NULL;\n\n\twq->cpu_wq = alloc_percpu(struct cpu_workqueue_struct);\n\tif (!wq->cpu_wq) {\n\t\tkfree(wq);\n\t\treturn NULL;\n\t}\n\n\twq->name = name;\n\twq->singlethread = singlethread;\n\twq->freezeable = freezeable;\n\tINIT_LIST_HEAD(&wq->list);\n\n\tif (singlethread) {\n\t\tcwq = init_cpu_workqueue(wq, singlethread_cpu);\n\t\terr = create_workqueue_thread(cwq, singlethread_cpu);\n\t\tstart_workqueue_thread(cwq, -1);\n\t} else {\n\t\tmutex_lock(&workqueue_mutex);\n\t\tlist_add(&wq->list, &workqueues);\n\n\t\tfor_each_possible_cpu(cpu) {\n\t\t\tcwq = init_cpu_workqueue(wq, cpu);\n\t\t\tif (err || !cpu_online(cpu))\n\t\t\t\tcontinue;\n\t\t\terr = create_workqueue_thread(cwq, cpu);\n\t\t\tstart_workqueue_thread(cwq, cpu);\n\t\t}\n\t\tmutex_unlock(&workqueue_mutex);\n\t}\n\n\tif (err) {\n\t\tdestroy_workqueue(wq);\n\t\twq = NULL;\n\t}\n\treturn wq;\n}\nEXPORT_SYMBOL_GPL(__create_workqueue);\n\nstatic void cleanup_workqueue_thread(struct cpu_workqueue_struct *cwq, int cpu)\n{\n\t/*\n\t * Our caller is either destroy_workqueue() or CPU_DEAD,\n\t * workqueue_mutex protects cwq->thread\n\t */\n\tif (cwq->thread == NULL)\n\t\treturn;\n\n\tflush_cpu_workqueue(cwq);\n\t/*\n\t * If the caller is CPU_DEAD and cwq->worklist was not empty,\n\t * a concurrent flush_workqueue() can insert a barrier after us.\n\t * However, in that case run_workqueue() won't return and check\n\t * kthread_should_stop() until it flushes all work_struct's.\n\t * When ->worklist becomes empty it is safe to exit because no\n\t * more work_structs can be queued on this cwq: flush_workqueue\n\t * checks list_empty(), and a \"normal\" queue_work() can't use\n\t * a dead CPU.\n\t */\n\tkthread_stop(cwq->thread);\n\tcwq->thread = NULL;\n}\n\n/**\n * destroy_workqueue - safely terminate a workqueue\n * @wq: target workqueue\n *\n * Safely destroy a workqueue. All work currently pending will be done first.\n */\nvoid destroy_workqueue(struct workqueue_struct *wq)\n{\n\tconst cpumask_t *cpu_map = wq_cpu_map(wq);\n\tstruct cpu_workqueue_struct *cwq;\n\tint cpu;\n\n\tmutex_lock(&workqueue_mutex);\n\tlist_del(&wq->list);\n\tmutex_unlock(&workqueue_mutex);\n\n\tfor_each_cpu_mask(cpu, *cpu_map) {\n\t\tcwq = per_cpu_ptr(wq->cpu_wq, cpu);\n\t\tcleanup_workqueue_thread(cwq, cpu);\n\t}\n\n\tfree_percpu(wq->cpu_wq);\n\tkfree(wq);\n}\nEXPORT_SYMBOL_GPL(destroy_workqueue);\n\nstatic int __devinit workqueue_cpu_callback(struct notifier_block *nfb,\n\t\t\t\t\t\tunsigned long action,\n\t\t\t\t\t\tvoid *hcpu)\n{\n\tunsigned int cpu = (unsigned long)hcpu;\n\tstruct cpu_workqueue_struct *cwq;\n\tstruct workqueue_struct *wq;\n\n\taction &= ~CPU_TASKS_FROZEN;\n\n\tswitch (action) {\n\tcase CPU_LOCK_ACQUIRE:\n\t\tmutex_lock(&workqueue_mutex);\n\t\treturn NOTIFY_OK;\n\n\tcase CPU_LOCK_RELEASE:\n\t\tmutex_unlock(&workqueue_mutex);\n\t\treturn NOTIFY_OK;\n\n\tcase CPU_UP_PREPARE:\n\t\tcpu_set(cpu, cpu_populated_map);\n\t}\n\n\tlist_for_each_entry(wq, &workqueues, list) {\n\t\tcwq = per_cpu_ptr(wq->cpu_wq, cpu);\n\n\t\tswitch (action) {\n\t\tcase CPU_UP_PREPARE:\n\t\t\tif (!create_workqueue_thread(cwq, cpu))\n\t\t\t\tbreak;\n\t\t\tprintk(KERN_ERR \"workqueue for %i failed\\n\", cpu);\n\t\t\treturn NOTIFY_BAD;\n\n\t\tcase CPU_ONLINE:\n\t\t\tstart_workqueue_thread(cwq, cpu);\n\t\t\tbreak;\n\n\t\tcase CPU_UP_CANCELED:\n\t\t\tstart_workqueue_thread(cwq, -1);\n\t\tcase CPU_DEAD:\n\t\t\tcleanup_workqueue_thread(cwq, cpu);\n\t\t\tbreak;\n\t\t}\n\t}\n\n\treturn NOTIFY_OK;\n}\n\nvoid __init init_workqueues(void)\n{\n\tcpu_populated_map = cpu_online_map;\n\tsinglethread_cpu = first_cpu(cpu_possible_map);\n\tcpu_singlethread_map = cpumask_of_cpu(singlethread_cpu);\n\thotcpu_notifier(workqueue_cpu_callback, 0);\n\tkeventd_wq = create_workqueue(\"events\");\n\tBUG_ON(!keventd_wq);\n}\ncontinue\ncontinue\ncontinue\n" }, { "alpha_fraction": 0.8096885681152344, "alphanum_fraction": 0.8096885681152344, "avg_line_length": 71, "blob_id": "b6be19ec5adf085dd44ff7956e38de5f4591bef7", "content_id": "fc271e5f859c607cafe94d33ce87335025f790a1", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Shell", "length_bytes": 289, "license_type": "permissive", "max_line_length": 83, "num_lines": 4, "path": "/copy_executables_from_bucket.sh", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "gsutil cp gs://grit-engine/Normal/engine/engine.exe media/Grit.dat\ngsutil cp gs://grit-engine/Normal/launcher/launcher.exe media/Grit.exe\ngsutil cp gs://grit-engine/Normal/extract/extract.exe media/Tools\ngsutil cp gs://grit-engine/Normal/GritXMLConverter/GritXMLConverter.exe media/Tools\n\n" }, { "alpha_fraction": 0.6336796879768372, "alphanum_fraction": 0.6429295539855957, "avg_line_length": 33.16017150878906, "blob_id": "fefbb30fcc39ba815fd61e852041043c451b7844", "content_id": "0d651fa274beb160c241e4838a2d10e19cf2ec5e", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 7892, "license_type": "permissive", "max_line_length": 98, "num_lines": 231, "path": "/engine/core_option.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include \"core_option.h\"\n#include \"streamer.h\"\n\nstatic CoreBoolOption option_keys_bool[] = {\n CORE_AUTOUPDATE,\n CORE_FOREGROUND_WARNINGS\n};\n\nstatic CoreFloatOption option_keys_float[] = {\n CORE_VISIBILITY,\n CORE_PREPARE_DISTANCE_FACTOR,\n CORE_FADE_OUT_FACTOR,\n CORE_FADE_OVERLAP_FACTOR\n};\n\nstatic CoreIntOption option_keys_int[] = {\n CORE_STEP_SIZE,\n CORE_RAM\n};\n\n\nstatic std::map<CoreBoolOption, bool> options_bool;\nstatic std::map<CoreIntOption, int> options_int;\nstatic std::map<CoreFloatOption, float> options_float;\nstatic std::map<CoreBoolOption, bool> new_options_bool;\nstatic std::map<CoreIntOption, int> new_options_int;\nstatic std::map<CoreFloatOption, float> new_options_float;\n\nstatic std::map<CoreBoolOption, ValidOption<bool>*> valid_option_bool;\nstatic std::map<CoreIntOption, ValidOption<int>*> valid_option_int;\nstatic std::map<CoreFloatOption, ValidOption<float>*> valid_option_float;\n\nstatic void valid_option (CoreBoolOption o, ValidOption<bool> *v) { valid_option_bool[o] = v; }\nstatic void valid_option (CoreIntOption o, ValidOption<int> *v) { valid_option_int[o] = v; }\nstatic void valid_option (CoreFloatOption o, ValidOption<float> *v) { valid_option_float[o] = v; }\n \nstatic bool truefalse_[] = { false, true };\nstatic ValidOptionList<bool, bool[2]> *truefalse = new ValidOptionList<bool, bool[2]>(truefalse_);\n\n \nstd::string core_option_to_string (CoreBoolOption o)\n{ \n switch (o) {\n case CORE_AUTOUPDATE: return \"AUTOUPDATE\";\n case CORE_FOREGROUND_WARNINGS: return \"FOREGROUND_WARNINGS\";\n }\n return \"UNKNOWN_BOOL_OPTION\";\n} \nstd::string core_option_to_string (CoreIntOption o)\n{ \n switch (o) {\n case CORE_STEP_SIZE: return \"STEP_SIZE\";\n case CORE_RAM: return \"RAM\";\n } \n return \"UNKNOWN_INT_OPTION\";\n}\nstd::string core_option_to_string (CoreFloatOption o)\n{ \n switch (o) {\n case CORE_VISIBILITY: return \"VISIBILITY\";\n case CORE_PREPARE_DISTANCE_FACTOR: return \"PREPARE_DISTANCE_FACTOR\";\n case CORE_FADE_OUT_FACTOR: return \"FADE_OUT_FACTOR\";\n case CORE_FADE_OVERLAP_FACTOR: return \"FADE_OVERLAP_FACTOR\";\n } \n return \"UNKNOWN_FLOAT_OPTION\";\n}\n\nvoid core_option_from_string (const std::string &s,\n int &t,\n CoreBoolOption &o0,\n CoreIntOption &o1,\n CoreFloatOption &o2)\n{\n if (s == \"AUTOUPDATE\") { t = 0; o0 = CORE_AUTOUPDATE; }\n else if (s == \"FOREGROUND_WARNINGS\") { t = 0; o0 = CORE_FOREGROUND_WARNINGS; }\n\n else if (s == \"STEP_SIZE\") { t = 1 ; o1 = CORE_STEP_SIZE; }\n else if (s == \"RAM\") { t = 1 ; o1 = CORE_RAM; }\n\n else if (s == \"VISIBILITY\") { t = 2 ; o2 = CORE_VISIBILITY; }\n else if (s == \"PREPARE_DISTANCE_FACTOR\") { t = 2 ; o2 = CORE_PREPARE_DISTANCE_FACTOR; }\n else if (s == \"FADE_OUT_FACTOR\") { t = 2 ; o2 = CORE_FADE_OUT_FACTOR; }\n else if (s == \"FADE_OVERLAP_FACTOR\") { t = 2 ; o2 = CORE_FADE_OVERLAP_FACTOR; }\n\n else t = -1;\n}\n\nstatic void options_update (bool flush)\n{\n (void) flush;\n\n for (unsigned i=0 ; i<sizeof(option_keys_bool)/sizeof(*option_keys_bool) ; ++i) {\n CoreBoolOption o = option_keys_bool[i];\n bool v_old = options_bool[o];\n bool v_new = new_options_bool[o];\n if (v_old == v_new) continue;\n switch (o) {\n case CORE_AUTOUPDATE: break;\n case CORE_FOREGROUND_WARNINGS:\n disk_resource_foreground_warnings = v_new;\n break;\n }\n }\n for (unsigned i=0 ; i<sizeof(option_keys_int)/sizeof(*option_keys_int) ; ++i) {\n CoreIntOption o = option_keys_int[i];\n int v_old = options_int[o];\n int v_new = new_options_int[o];\n if (v_old == v_new) continue;\n switch (o) {\n case CORE_STEP_SIZE:\n case CORE_RAM:\n break;\n }\n }\n for (unsigned i=0 ; i<sizeof(option_keys_float)/sizeof(*option_keys_float) ; ++i) {\n CoreFloatOption o = option_keys_float[i];\n float v_old = options_float[o];\n float v_new = new_options_float[o];\n if (v_old == v_new) continue;\n switch (o) {\n case CORE_VISIBILITY:\n streamer_visibility = v_new;\n break;\n case CORE_PREPARE_DISTANCE_FACTOR:\n streamer_prepare_distance_factor = v_new;\n break;\n case CORE_FADE_OUT_FACTOR:\n streamer_fade_out_factor = v_new;\n break;\n case CORE_FADE_OVERLAP_FACTOR:\n streamer_fade_overlap_factor = v_new;\n break;\n }\n }\n\n options_bool = new_options_bool;\n options_int = new_options_int;\n options_float = new_options_float;\n}\n\n\nvoid core_option_reset (void)\n{\n core_option(CORE_FOREGROUND_WARNINGS, true);\n\n core_option(CORE_STEP_SIZE, 20000);\n core_option(CORE_RAM, 1024); // 1GB\n\n core_option(CORE_VISIBILITY, 1.0f);\n core_option(CORE_PREPARE_DISTANCE_FACTOR, 1.3f);\n core_option(CORE_FADE_OUT_FACTOR, 0.7f);\n core_option(CORE_FADE_OVERLAP_FACTOR, 0.7f);\n}\n\n\nvoid core_option_init (void)\n{\n for (unsigned i=0 ; i < sizeof(option_keys_bool) / sizeof(*option_keys_bool) ; ++i) {\n valid_option(option_keys_bool[i], truefalse);\n }\n\n valid_option(CORE_STEP_SIZE, new ValidOptionRange<int>(0, 20000));\n valid_option(CORE_RAM, new ValidOptionRange<int>(0, 1024*1024)); // 1TB\n\n valid_option(CORE_VISIBILITY, new ValidOptionRange<float>(0, 10));\n valid_option(CORE_PREPARE_DISTANCE_FACTOR, new ValidOptionRange<float>(1, 3));\n valid_option(CORE_FADE_OUT_FACTOR, new ValidOptionRange<float>(0, 1));\n valid_option(CORE_FADE_OVERLAP_FACTOR, new ValidOptionRange<float>(0, 1));\n\n\n core_option(CORE_AUTOUPDATE, false);\n core_option_reset();\n options_update(true);\n // This will call options_update(false) but it will be a no-op this time.\n core_option(CORE_AUTOUPDATE, true);\n}\n\n\nvoid core_option (CoreBoolOption o, bool v)\n{\n valid_option_bool[o]->maybeThrow(\"Core\", v);\n new_options_bool[o] = v;\n if (new_options_bool[CORE_AUTOUPDATE]) options_update(false);\n}\nbool core_option (CoreBoolOption o)\n{\n return options_bool[o];\n}\n\nvoid core_option (CoreIntOption o, int v)\n{\n valid_option_int[o]->maybeThrow(\"Core\", v);\n new_options_int[o] = v;\n if (new_options_bool[CORE_AUTOUPDATE]) options_update(false);\n}\nint core_option (CoreIntOption o)\n{\n return options_int[o];\n}\n\nvoid core_option (CoreFloatOption o, float v)\n{\n valid_option_float[o]->maybeThrow(\"Core\", v);\n new_options_float[o] = v;\n if (new_options_bool[CORE_AUTOUPDATE]) options_update(false);\n}\nfloat core_option (CoreFloatOption o)\n{\n return options_float[o];\n}\n\n" }, { "alpha_fraction": 0.6790075302124023, "alphanum_fraction": 0.682690441608429, "avg_line_length": 38.84496307373047, "blob_id": "9dcb36484495139b10afdef66d8e66e313be7fdb", "content_id": "673a0e446ff1fedaca3df7fbe30870e6a0004856", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 5159, "license_type": "permissive", "max_line_length": 91, "num_lines": 129, "path": "/gtasa/handling.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016 \n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE. \n */\n \n#ifndef HANDLING_H \n#define HANDLING_H \n\n#include <istream>\n#include <vector>\n#include <string> \n#include <map> \n\n#include \"csvread.h\"\n\n// http://projectcerbera.com/gta/sa/tutorials/handling\nstruct VehicleData {\n std::string name;\n float mass, turn_mass, drag;\n\n float com_x, com_y, com_z;\n float bouyancy;\n float traction_mult, traction_loss, traction_bias;\n\n int gears;\n float max_vel, engine_accel, engine_innertia; // val in km/h\n bool front_wheel_drive;\n bool back_wheel_drive; // can both be true for 4wd\n int engine_type; // 0=petrol, 1=diesel, 2=electric\n\n float brakes;\n float brake_bias;\n bool abs;\n float steering_lock;\n\n float susp_force, susp_damp, susp_high_spd_com_damp, susp_upper, susp_lower, susp_bias;\n float susp_anti_dive;\n\n float seat_offset; // 'towards centre' apparently\n float damage_mult;\n int value; // in dollars\n\n bool is_van, is_bus, is_low, is_big;\n bool reverse_bonnet, hanging_boot, tailgate_boot, noswing_boot;\n bool no_doors, tandem_seats, sit_in_boat, convertible;\n bool no_exhaust, double_exhaust, no1fps_look_behind, force_door_check;\n bool axle_f_notilt, axle_f_solid, axle_f_mcpherson, axle_f_reverse;\n bool axle_r_notilt, axle_r_solid, axle_r_mcpherson, axle_r_reverse;\n bool is_bike, is_heli, is_plane, is_boat;\n bool bounce_panels, double_rwheels, force_ground_clearance, is_hatchback;\n \n bool one_g_boost, two_g_boost, npc_anti_roll, npc_neutral_handl;\n bool no_handbrake, steer_rearwheels, hb_rearwheel_steer, alt_steer_opt;\n bool wheel_f_narrow2, wheel_f_narrow, wheel_f_wide, wheel_f_wide2;\n bool wheel_r_narrow2, wheel_r_narrow, wheel_r_wide, wheel_r_wide2;\n bool hydraulic_geom, hydraulic_inst, hydraulic_none, nos_inst;\n bool offread_ability, offroad_ability2, halogen_lights, proc_rearwheel_1st;\n bool use_maxsp_limit, low_rider, street_race;\n bool swinging_chassis;\n\n int front_lights; // 0=long, 1=small, 2=big, 3=tall\n int rear_lights;\n\n int anim_group;\n\n // boat\n bool has_boat_data;\n float boat_thrust_y, boat_thrust_z, boat_thrust_app_z;\n float boat_aq_plane_force, boat_aq_plane_limit, boat_aq_plane_offset;\n float boat_wave_audio_muilt;\n float boat_move_res_x, boat_move_res_y, boat_move_res_z;\n float boat_turn_res_x, boat_turn_res_y, boat_turn_res_z;\n float boat_look_l_r_behind_cam_height;\n\n // bike\n bool has_bike_data;\n float bike_lean_fwd_com, bike_lean_fwd_force;\n float bike_lean_back_com, bike_lean_back_force;\n float bike_max_lean, bike_full_anim_lean, bike_des_lean;\n float bike_speed_steer, bike_slip_steer, bike_no_player_com_z;\n float bike_wheelie_ang, bike_stoppie_ang, bike_wheelie_steer;\n float bike_wheelie_stab_mult, bike_stoppie_stab_mult;\n\n // plane\n bool has_plane_data;\n float plane_thrust, plane_thrust_falloff, plane_yaw, plane_yaw_stab, plane_side_slip;\n float plane_roll, plane_roll_stab, plane_pitch, plane_pitch_stab;\n float plane_form_lift, plane_attack_lift, plane_gear_up_r, plane_gear_down_l;\n float plane_wind_mult, plane_move_res;\n float plane_turn_res_x, plane_turn_res_y, plane_turn_res_z;\n float plane_speed_res_x, plane_speed_res_y, plane_speed_res_z;\n};\n\nstruct HandlingData { \n std::vector<VehicleData> vehicles;\n\n // the map points into the vehicles vector above, so don't resize the above vector\n typedef std::map<std::string,VehicleData*> VehicleDataMap;\n typedef VehicleDataMap::iterator iterator;\n VehicleDataMap map;\n\n VehicleData *&operator [] (const std::string &i) { return map[i]; }\n \n iterator begin() { return map.begin(); }\n iterator end() { return map.end(); }\n iterator find(const std::string &i) { return map.find(i); }\n\n}; \n\n// the csv should be already read in\nvoid read_handling (Csv &csv, HandlingData &data);\n \n#endif \n\n" }, { "alpha_fraction": 0.5707606077194214, "alphanum_fraction": 0.5754364132881165, "avg_line_length": 37.650604248046875, "blob_id": "9011864fba46238becc868d0f831a70e4578af6c", "content_id": "c3d53c7928a5d354280871eb87bbc192ec6694bf", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 3208, "license_type": "permissive", "max_line_length": 86, "num_lines": 83, "path": "/gtasa/dirutil.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <cerrno>\n\n#ifdef WIN32\n#include <windows.h>\n#else\n#include <sys/types.h>\n#include <sys/stat.h>\n#include <unistd.h>\n#endif\n\n#include \"dirutil.h\"\n#include \"ios_util.h\"\n\n// \n#ifdef WIN32\nvoid ensuredir (const std::string &path)\n{\n // winapi version\n const char *cpath = path.c_str();\n if (!CreateDirectory(cpath,NULL)) {\n if (GetLastError()==ERROR_PATH_NOT_FOUND) {\n std::string::size_type slashpos = path.find_last_of(\"/\");\n if (slashpos<path.size()) {\n std::string prefix = path.substr(0,slashpos);\n ensuredir(prefix);\n ensuredir(path); // hopefully this won't loop horribly\n } else {\n GRIT_EXCEPT(std::string(\n \"root dir doesn't exist(?), \"\n \"making: \\\"\"+path+\"\\\"\"));\n }\n } else if (GetLastError()!=ERROR_ALREADY_EXISTS) {\n GRIT_EXCEPT(std::string(\"error while making dir: \"\n \"\\\"\"+path+\"\\\"\"));\n }\n }\n}\n#else\nvoid ensuredir (const std::string &path)\n{\n // posix version\n struct stat stat_results;\n int err = stat(path.c_str(),&stat_results);\n if (!err) return; // dir exists already\n if (err && errno!=ENOENT && errno!=ENOTDIR)\n GRIT_EXCEPT(std::string(strerror(errno))+\n \"while making dir: \\\"\"+path+\"\\\"\");\n\n // dir doesn't exist, check prefix exists\n std::string::size_type slashpos = path.find_last_of(\"/\");\n if (slashpos<path.size()) {\n std::string prefix = path.substr(0,slashpos);\n ensuredir(prefix);\n }\n\n // finally make dir with 755 permissions\n mkdir(path.c_str(), S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);\n}\n#endif\n \n\n// vim: shiftwidth=8:tabstop=8:expandtab\n" }, { "alpha_fraction": 0.6602907180786133, "alphanum_fraction": 0.6653915047645569, "avg_line_length": 28.25373077392578, "blob_id": "b00069f8409a5d81ed0aff182408223a4d0fd8dc", "content_id": "43d20cb80fb0813e447728b0793a2e2909a4d5d2", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 3921, "license_type": "permissive", "max_line_length": 93, "num_lines": 134, "path": "/engine/gfx/gfx_node.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include \"gfx_internal.h\"\n\n#include \"gfx_node.h\"\n#include \"gfx_fertile_node.h\"\n#include \"gfx_body.h\"\n\nconst std::string GfxNode::className = \"GfxNode\";\n\nGfxNode::GfxNode (const GfxNodePtr &par_)\n{\n dead = false;\n\n localPos = Vector3(0,0,0);\n localOrientation = Quaternion(1,0,0,0);\n localScale = Vector3(1,1,1);\n\n //dirtyWorldTransform = false;\n worldTransform = Transform::identity();\n\n node = ogre_sm->createSceneNode();\n ogre_root_node->addChild(node);\n\n par = GfxNodePtr(NULL);\n setParent(par_);\n\n gfx_all_nodes.push_back(this);\n}\n\nGfxNode::~GfxNode (void)\n{\n if (!dead) destroy();\n}\n \nvoid GfxNode::destroy (void)\n{\n setParent(GfxNodePtr(NULL));\n\n dead = true;\n\n ogre_sm->destroySceneNode(node->getName());\n node = NULL; \n\n gfx_all_nodes.erase(this);\n} \n \nvoid GfxNode::notifyParentDead (void)\n{\n ensureAlive();\n APP_ASSERT(!par.isNull());\n par = GfxNodePtr(NULL);\n updateParentBoneId();\n} \n \nvoid GfxNode::setParent (const GfxNodePtr &par_)\n{\n ensureAlive();\n if (par_ == par) return;\n if (!par.isNull()) {\n par->notifyLostChild(this);\n }\n par = par_;\n if (!par.isNull()) {\n par->notifyGainedChild(this);\n }\n updateParentBoneId();\n}\n\n/* Needs to be run:\n * when parent is changed\n * when parent is reloaded (skeleton can change)\n * when parentBoneName is changed\n */\nvoid GfxNode::updateParentBoneId (void)\n{\n if (parentBoneName.length()==0 || par.isNull()) {\n parentBoneId = -1;\n } else {\n GfxBody *pbody = dynamic_cast<GfxBody*>(&*par);\n if (pbody != NULL && pbody->hasBones() && pbody->hasBoneName(parentBoneName)) {\n parentBoneId = pbody->getBoneId(parentBoneName);\n } else {\n parentBoneId = -1;\n }\n }\n //dirtyWorldTransform = true;\n}\nvoid GfxNode::doUpdateWorldTransform (void)\n{\n if (par.isNull()) {\n worldTransform = Transform(localPos, localOrientation, localScale);\n } else {\n GfxFertileNode *fertile_node = static_cast<GfxFertileNode*>(&*par);\n fertile_node->updateWorldTransform();\n Transform parentTransform;\n if (parentBoneId < 0) {\n parentTransform = fertile_node->getWorldTransform();\n } else {\n GfxBody *pbody = static_cast<GfxBody*>(fertile_node);\n parentTransform = pbody->getBoneWorldTransform(parentBoneId);\n }\n worldTransform = parentTransform * Transform(localPos, localOrientation, localScale);\n }\n node->overrideCachedTransform(toOgre());\n //dirtyWorldTransform = false;\n}\n\n\nvoid GfxNode::ensureNotChildOf (GfxFertileNode *leaf) const\n{\n if (leaf==this) GRIT_EXCEPT(\"Parenthood must be acyclic.\");\n if (par.isNull()) return;\n par->ensureNotChildOf(leaf);\n}\n\n" }, { "alpha_fraction": 0.5546046495437622, "alphanum_fraction": 0.555162787437439, "avg_line_length": 35.31081008911133, "blob_id": "600cd13b0f98342b2283aaec616c5cd40c5d7f3a", "content_id": "5e5194a917c7a7df809eb6bb9a4b0bb458d42328", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 5375, "license_type": "permissive", "max_line_length": 106, "num_lines": 148, "path": "/dependencies/quex-0.34.1/quex/output/cpp/mode_classes.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "from quex.frs_py.string_handling import blue_print\n\n\ndef do(Modes):\n\n # -- get the implementation of mode class functions\n # (on_entry, on_exit, on_indendation, has_base, has_entry, has_exit)\n txt = \"#define self (*me)\\n\"\n for mode in Modes: \n txt += get_implementation_of_mode_functions(mode, Modes)\n\n txt += \"#undef self\\n\"\n return txt\n\n\nmode_function_implementation_str = \\\n\"\"\"\n void\n $$LEXER_CLASS_NAME$$_$$MODE_NAME$$_on_entry($$LEXER_CLASS_NAME$$* me, const QuexMode* FromMode) {\n$$ENTER-PROCEDURE$$\n }\n\n void\n $$LEXER_CLASS_NAME$$_$$MODE_NAME$$_on_exit($$LEXER_CLASS_NAME$$* me, const QuexMode* ToMode) {\n$$EXIT-PROCEDURE$$\n }\n\n#ifdef __QUEX_OPTION_INDENTATION_TRIGGER_SUPPORT \n void\n $$LEXER_CLASS_NAME$$_$$MODE_NAME$$_on_indentation($$LEXER_CLASS_NAME$$* me, const int Indentation) {\n$$INDENTATION-PROCEDURE$$\n }\n#endif\n\n#ifdef __QUEX_OPTION_RUNTIME_MODE_TRANSITION_CHECK\n bool\n $$LEXER_CLASS_NAME$$_$$MODE_NAME$$_has_base(const QuexMode* Mode) {\n$$HAS_BASE_MODE$$\n }\n bool\n $$LEXER_CLASS_NAME$$_$$MODE_NAME$$_has_entry_from(const QuexMode* Mode) {\n$$HAS_ENTRANCE_FROM$$\n }\n bool\n $$LEXER_CLASS_NAME$$_$$MODE_NAME$$_has_exit_to(const QuexMode* Mode) {\n$$HAS_EXIT_TO$$\n }\n#endif \n\"\"\" \n\ndef get_implementation_of_mode_functions(mode, Modes):\n \"\"\"Writes constructors and mode transition functions.\n\n void quex::lexer::enter_EXAMPLE_MODE() { ... }\n\n where EXAMPLE_MODE is a lexer mode from the given lexer-modes, and\n 'quex::lexer' is the lexical analysis class.\n \"\"\"\n # (*) on enter \n code_fragments = mode.on_entry_code_fragments() \n on_entry_str = \"#ifdef __QUEX_OPTION_RUNTIME_MODE_TRANSITION_CHECK\\n\"\n on_entry_str += \"__quex_assert(me->%s.has_entry_from(FromMode));\\n\" % mode.name\n on_entry_str += \"#endif\\n\"\n for code_info in code_fragments:\n on_entry_str += code_info.get_code()\n if on_entry_str[-1] == \"\\n\": on_entry_str = on_entry_str[:-1]\n\n # (*) on exit\n code_fragments = mode.on_exit_code_fragments() \n on_exit_str = \"#ifdef __QUEX_OPTION_RUNTIME_MODE_TRANSITION_CHECK\\n\"\n on_exit_str += \"__quex_assert(me->%s.has_exit_to(ToMode));\\n\" % mode.name\n on_exit_str += \"#endif\\n\"\n for code_info in code_fragments:\n on_exit_str += code_info.get_code()\n\n # (*) on indentation\n code_fragments = mode.on_indentation_code_fragments() \n on_indentation_str = \"__quex_assert(Indentation >= 0);\" \n for code_info in code_fragments:\n on_indentation_str += code_info.get_code()\n \n # (*) has base mode\n if mode.get_base_modes() != []:\n has_base_mode_str = get_IsOneOfThoseCode(mode.get_base_modes())\n else:\n has_base_mode_str = \" return false;\"\n \n # (*) has entry from\n try:\n entry_list = mode.options[\"entry\"] \n has_entry_from_str = get_IsOneOfThoseCode(entry_list,\n ConsiderDerivedClassesF=true)\n # check whether the mode we come from is an allowed mode\n except:\n has_entry_from_str = \" return true; // default\" \n\n # (*) has exit to\n try:\n exit_list = mode.options[\"exit\"]\n has_exit_to_str = get_IsOneOfThoseCode(exit_list,\n ConsiderDerivedClassesF=true)\n except:\n has_exit_to_str = \" return true; // default\"\n\n \n txt = blue_print(mode_function_implementation_str,\n [[\"$$ENTER-PROCEDURE$$\", on_entry_str],\n [\"$$EXIT-PROCEDURE$$\", on_exit_str],\n [\"$$INDENTATION-PROCEDURE$$\", on_indentation_str],\n [\"$$HAS_BASE_MODE$$\", has_base_mode_str],\n [\"$$HAS_ENTRANCE_FROM$$\", has_entry_from_str],\n [\"$$HAS_EXIT_TO$$\", has_exit_to_str],\n [\"$$MODE_NAME$$\", mode.name],\n ])\n return txt\n\ndef get_IsOneOfThoseCode(ThoseModes, Indentation=\" \",\n ConsiderDerivedClassesF=False):\n txt = Indentation\n if ThoseModes == []:\n return Indentation + \"return false;\"\n \n\n # NOTE: Usually, switch commands do a binary bracketting.\n # (Cannot be faster here ... is not critical anyway since this is debug code)\n txt = \"\\n\"\n txt += \"switch( Mode->id ) {\\n\"\n for mode_name in ThoseModes:\n txt += \"case LEX_ID_%s: return true;\\n\" % mode_name\n txt += \"default:\\n\"\n if ConsiderDerivedClassesF:\n for mode_name in ThoseModes:\n txt += \" if( Mode->has_base(%s) ) return true;\\n\" % mode_name\n else:\n txt += \";\\n\"\n txt += \"}\\n\"\n\n txt += \"#ifdef __QUEX_OPTION_ERROR_OUTPUT_ON_MODE_CHANGE_ERROR\\n\"\n if ConsiderDerivedClassesF:\n txt += \"std::cerr << \\\"mode '%s' is not one of (and not a a derived mode of):\\\\n\\\";\\n\" % mode_name\n else:\n txt += \"std::cerr << \\\"mode '%s' is not one of:\\\\n\\\";\" % mode_name\n for mode_name in ThoseModes:\n txt += \" std::cerr << \\\" %s\\\\n\\\";\\n\" % mode_name\n txt += \"#endif // QUEX_OPTION_ERROR_OUTPUT_ON_MODE_CHANGE_ERROR\\n\"\n txt += \"return false;\\n\"\n\n return txt.replace(\"\\n\", \"\\n\" + Indentation)\n\n" }, { "alpha_fraction": 0.5759865641593933, "alphanum_fraction": 0.5856423377990723, "avg_line_length": 34.014705657958984, "blob_id": "98e0867a4debf3b022dbcd240efbc22095f2ce68", "content_id": "419e560936426ffe42ca53fa56e72985707334b7", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2382, "license_type": "permissive", "max_line_length": 104, "num_lines": 68, "path": "/dependencies/quex-0.34.1/quex/core_engine/regular_expression/auxiliary.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "from quex.exception import RegularExpressionException\nfrom quex.core_engine.state_machine.core import StateMachine\n\n__debug_recursion_depth = -1\n__debug_output_enabled_f = False # True / False \n\ndef __snap_until(stream, ClosingDelimiter, OpeningDelimiter=None):\n \"\"\"Cuts the first letters of the utf8_string until an un-backslashed\n Delimiter occurs.\n \"\"\"\n cut_string = \"\" \n backslash_f = False\n open_bracket_n = 1 \n while 1 + 1 == 2:\n letter = stream.read(1)\n if letter == \"\": \n raise RegularExpressionException(\"Unable to find closing delimiter '%s'\" % ClosingDelimiter)\n\n cut_string += letter \n\n if letter == \"\\\\\": \n backslash_f = not backslash_f \n continue\n \n elif letter == ClosingDelimiter and not backslash_f: \n if open_bracket_n == 1: cut_string = cut_string[:-1]; break\n open_bracket_n -= 1\n\n elif letter == OpeningDelimiter and not backslash_f: \n # NOTE: if OpeningDelimiter == None, then this can never be the case!\n open_bracket_n += 1\n\n # if a backslash would have appeared, we would have 'continue'd (see above)\n backslash_f = False \n else:\n raise RegularExpressionException(\"Unable to find closing delimiter '%s'\" % ClosingDelimiter)\n \n return cut_string\n\ndef __debug_print(msg, msg2=\"\", msg3=\"\"):\n global __debug_recursion_depth\n if type(msg2) != str: msg2 = repr(msg2)\n if type(msg3) != str: msg3 = repr(msg3)\n txt = \"##\" + \" \" * __debug_recursion_depth + msg + \" \" + msg2 + \" \" + msg3\n txt = txt.replace(\"\\n\", \"\\n \" + \" \" * __debug_recursion_depth)\n if __debug_output_enabled_f: print txt\n \ndef __debug_exit(result, stream):\n global __debug_recursion_depth\n __debug_recursion_depth -= 1\n\n if __debug_output_enabled_f: \n pos = stream.tell()\n txt = stream.read()\n stream.seek(pos) \n __debug_print(\"##exit: [%s], remainder = \\\"%s\\\"\" % (repr(result), txt))\n \n return result\n\ndef __debug_entry(function_name, stream):\n global __debug_recursion_depth\n __debug_recursion_depth += 1\n\n if __debug_output_enabled_f: \n pos = stream.tell()\n txt = stream.read()\n stream.seek(pos) \n __debug_print(\"##entry: %s, remainder = \\\"%s\\\"\" % (function_name, txt))\n\n" }, { "alpha_fraction": 0.6205161213874817, "alphanum_fraction": 0.6414193511009216, "avg_line_length": 32.11111068725586, "blob_id": "e424fcb71a07a27da9a8a833565d72c7ad3e6121", "content_id": "b2fed0a5ffc42835922674bcd07f29731705eb35", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 7750, "license_type": "permissive", "max_line_length": 100, "num_lines": 234, "path": "/engine/gfx/gfx_decal.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include \"gfx_internal.h\"\n#include \"gfx_decal.h\"\n#include \"gfx_material.h\"\n\nconst std::string GfxDecal::className = \"GfxDecal\";\n\n// vdata/idata to be allocated later because constructor requires ogre to be initialised\nstatic Ogre::RenderOperation box_op;\n\n// Samew winding order for quad as for triangles generated>\n#define quad_vertexes(a,b,c,d) a, b, d, a, d, c\n\nvoid gfx_decal_init (void)\n{\n // TODO: The 4x3 transform will need to be \n // TODO: Eventually we'd like this uv rect to be configurable per decal.\n Vector2 uv1(0, 0);\n Vector2 uv2(1, 1);\n\n box_op.operationType = Ogre::RenderOperation::OT_TRIANGLE_LIST;\n\n Ogre::VertexData *vdata = OGRE_NEW Ogre::VertexData();\n box_op.vertexData = vdata;\n vdata->vertexStart = 0;\n const unsigned vertex_count = 8;\n vdata->vertexCount = vertex_count;\n unsigned vdecl_size = 0;\n // strict alignment required here\n struct Vertex { Vector3 position; Vector2 uv1; Vector2 uv2; };\n vdecl_size += vdata->vertexDeclaration->addElement(\n 0, vdecl_size, Ogre::VET_FLOAT3, Ogre::VES_POSITION).getSize();\n vdecl_size += vdata->vertexDeclaration->addElement(\n 0, vdecl_size, Ogre::VET_FLOAT2, Ogre::VES_TEXTURE_COORDINATES, 0).getSize();\n vdecl_size += vdata->vertexDeclaration->addElement(\n 0, vdecl_size, Ogre::VET_FLOAT2, Ogre::VES_TEXTURE_COORDINATES, 1).getSize();\n\n Ogre::HardwareVertexBufferSharedPtr vbuf =\n Ogre::HardwareBufferManager::getSingleton().createVertexBuffer(\n vdecl_size, vdata->vertexCount,\n Ogre::HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY_DISCARDABLE);\n vdata->vertexBufferBinding->setBinding(0, vbuf);\n Vertex vdata_raw[vertex_count] = {\n { Vector3(-0.5, -0.5, -0.5), uv1, uv2 },\n { Vector3(-0.5, -0.5, 0.5), uv1, uv2 },\n { Vector3(-0.5, 0.5, -0.5), uv1, uv2 },\n { Vector3(-0.5, 0.5, 0.5), uv1, uv2 },\n { Vector3( 0.5, -0.5, -0.5), uv1, uv2 },\n { Vector3( 0.5, -0.5, 0.5), uv1, uv2 },\n { Vector3( 0.5, 0.5, -0.5), uv1, uv2 },\n { Vector3( 0.5, 0.5, 0.5), uv1, uv2 }\n };\n vbuf->writeData(vdata->vertexStart, vdata->vertexCount*vdecl_size, vdata_raw, true);\n\n Ogre::IndexData *idata = OGRE_NEW Ogre::IndexData();\n box_op.indexData = idata;\n box_op.useIndexes = true;\n const unsigned indexes = 36; // 3 per triangle therefore 6 per face, 6 faces total\n idata->indexStart = 0;\n idata->indexCount = indexes;\n idata->indexBuffer = Ogre::HardwareBufferManager::getSingleton().createIndexBuffer(\n Ogre::HardwareIndexBuffer::IT_16BIT, indexes, Ogre::HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY);\n uint16_t idata_raw[indexes] = {\n quad_vertexes(2,6,0,4),\n quad_vertexes(7,3,5,1),\n quad_vertexes(3,2,1,0),\n quad_vertexes(6,7,4,5),\n quad_vertexes(0,4,1,5),\n quad_vertexes(3,7,2,6)\n };\n idata->indexBuffer->writeData(0, sizeof(idata_raw), idata_raw, true);\n}\n\nvoid gfx_decal_shutdown (void)\n{\n // Referenced buffers are managed via sharedptr.\n OGRE_DELETE box_op.vertexData;\n OGRE_DELETE box_op.indexData;\n}\n\n\nstatic std::set<GfxDecal*> all_decals;\n\nGfxDecal::GfxDecal (GfxMaterial *material, const GfxNodePtr &par_)\n : GfxNode(par_),\n enabled(true),\n fade(1),\n material(material)\n{\n all_decals.insert(this);\n}\n\nGfxDecal::~GfxDecal (void)\n{\n if (!dead) destroy();\n}\n\nvoid GfxDecal::destroy (void)\n{\n if (dead) THROW_DEAD(className);\n all_decals.erase(this);\n GfxNode::destroy();\n}\n\nbool GfxDecal::isEnabled (void)\n{\n if (dead) THROW_DEAD(className);\n return enabled;\n}\n\nvoid GfxDecal::setEnabled (bool v)\n{\n if (dead) THROW_DEAD(className);\n enabled = v;\n}\n\nGfxMaterial *GfxDecal::getMaterial (void)\n{\n if (dead) THROW_DEAD(className);\n return material;\n}\nvoid GfxDecal::setMaterial (GfxMaterial *m)\n{\n if (dead) THROW_DEAD(className);\n material = m;\n}\n\nfloat GfxDecal::getFade (void)\n{\n if (dead) THROW_DEAD(className);\n return fade;\n}\nvoid GfxDecal::setFade (float f)\n{\n if (dead) THROW_DEAD(className);\n fade = f;\n}\n\n\n/*\n * Read depth. Write diffuse, normal, spec, gloss. Alpha = 1.\n * Read depth, normal. Write diffuse, spec, gloss. Alpha = 1.\n * Read everything. Write colour. Alpha < 1.\n */\nvoid GfxDecal::render (const GfxShaderGlobals &g)\n{\n if (!enabled) return;\n\n const Ogre::Matrix4 &world = node->_getFullTransform(); \n \n // ISSUE RENDER COMMANDS\n try {\n const GfxTextureStateMap &mat_texs = material->getTextures();\n GfxShader *shader = material->getShader();\n\n // TODO(dcunnin): What if we don't want the dither fade?\n const GfxGslMaterialEnvironment &mat_env = material->getMaterialEnvironment();\n\n GfxGslMeshEnvironment mesh_env;\n shader->populateMeshEnv(false, 0, mesh_env);\n\n material->getShader()->bindShader(\n GFX_GSL_PURPOSE_DECAL, mat_env, mesh_env, g, world, nullptr, 0, 1,\n mat_texs, material->getBindings());\n \n \n float dist = (world * Ogre::Vector4(1, 1, 1, 0)).xyz().length();\n Ogre::Vector3 decal_to_cam = (world * Ogre::Vector4(0, 0, 0, 1)).xyz() - to_ogre(g.camPos);\n bool inside = decal_to_cam.length() - 0.4 < dist;\n\n ogre_rs->_setCullingMode(inside ? Ogre::CULL_ANTICLOCKWISE : Ogre::CULL_CLOCKWISE);\n // read but don't write depth buffer\n if (inside) {\n ogre_rs->_setDepthBufferParams(false, false);\n } else {\n ogre_rs->_setDepthBufferParams(true, false, Ogre::CMPF_LESS_EQUAL);\n }\n switch (material->getSceneBlend()) {\n case GFX_MATERIAL_OPAQUE:\n ogre_rs->_setSceneBlending(Ogre::SBF_ONE, Ogre::SBF_ZERO);\n break;\n case GFX_MATERIAL_ALPHA:\n case GFX_MATERIAL_ALPHA_DEPTH:\n ogre_rs->_setSceneBlending(Ogre::SBF_ONE, Ogre::SBF_ONE_MINUS_SOURCE_ALPHA);\n break;\n }\n\n ogre_rs->_setPolygonMode(Ogre::PM_SOLID);\n ogre_rs->setStencilCheckEnabled(false);\n ogre_rs->_setDepthBias(0, 0);\n\n ogre_rs->_render(box_op);\n\n for (unsigned i=0 ; i<mat_texs.size() ; ++i) {\n ogre_rs->_disableTextureUnit(i);\n }\n\n\n } catch (const Exception &e) {\n CERR << \"Rendering decals, got: \" << e << std::endl;\n } catch (const Ogre::Exception &e) {\n CERR << \"Rendering decals, got: \" << e.getDescription() << std::endl;\n }\n}\n\n\nvoid gfx_decal_render (GfxPipeline *p)\n{\n GfxShaderGlobals g = gfx_shader_globals_cam(p);\n\n for (GfxDecal *decal : all_decals) {\n decal->render(g);\n }\n}\n\n\n" }, { "alpha_fraction": 0.5601900815963745, "alphanum_fraction": 0.5711457133293152, "avg_line_length": 28.13846206665039, "blob_id": "3b65042daf7f9dd9fde4840438e60bc41698ca0e", "content_id": "91e707121b78cc15b58b26e7336dc253e5c0183b", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 7576, "license_type": "permissive", "max_line_length": 88, "num_lines": 260, "path": "/engine/linux/keyboard_x11.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <iostream>\n#include <sstream>\n\n#include <centralised_log.h>\n#include <unicode_util.h>\n\n#include \"keyboard_x11.h\"\n\nKeyboardX11::KeyboardX11 (size_t window)\n : focussed(true)\n{\n\n #define MAP_KEY(xk,k) myKeyMap.insert(std::make_pair(xk,k))\n\n // all the keys for which XLookupString followed by XKeySymToString would not return\n // what we want\n\n // these guys return the ascii control code\n MAP_KEY(XK_space, \"Space\");\n MAP_KEY(XK_BackSpace, \"BackSpace\");\n MAP_KEY(XK_Delete, \"Delete\");\n MAP_KEY(XK_Tab, \"Tab\");\n MAP_KEY(XK_Return, \"Return\");\n MAP_KEY(XK_Escape, \"Escape\");\n\n MAP_KEY(XK_Caps_Lock, \"CapsLock\");\n\n MAP_KEY(XK_Page_Up, \"PageUp\");\n MAP_KEY(XK_Page_Down, \"PageDown\");\n\n MAP_KEY(XK_Num_Lock, \"NumLock\");\n MAP_KEY(XK_Print, \"SysRq\");\n MAP_KEY(XK_Scroll_Lock, \"Scroll\");\n\n MAP_KEY(XK_Control_L, \"Ctrl\");\n MAP_KEY(XK_Control_R, \"Ctrl\");\n MAP_KEY(XK_Shift_R, \"Shift\");\n MAP_KEY(XK_Shift_L, \"Shift\");\n MAP_KEY(XK_Alt_R, \"Alt\");\n MAP_KEY(XK_Alt_L, \"Alt\");\n MAP_KEY(XK_Super_L, \"LWin\");\n MAP_KEY(XK_Super_R, \"RWin\");\n\n\n //Keypad\n MAP_KEY(XK_KP_0, \"NUMPAD0\");\n MAP_KEY(XK_KP_1, \"NUMPAD1\");\n MAP_KEY(XK_KP_2, \"NUMPAD2\");\n MAP_KEY(XK_KP_3, \"NUMPAD3\");\n MAP_KEY(XK_KP_4, \"NUMPAD4\");\n MAP_KEY(XK_KP_5, \"NUMPAD5\");\n MAP_KEY(XK_KP_6, \"NUMPAD6\");\n MAP_KEY(XK_KP_7, \"NUMPAD7\");\n MAP_KEY(XK_KP_8, \"NUMPAD8\");\n MAP_KEY(XK_KP_9, \"NUMPAD9\");\n MAP_KEY(XK_KP_Add, \"NUMPAD+\");\n MAP_KEY(XK_KP_Subtract, \"NUMPAD-\");\n MAP_KEY(XK_KP_Decimal, \"NUMPAD.\");\n MAP_KEY(XK_KP_Equal, \"NUMPAD=\");\n MAP_KEY(XK_KP_Divide, \"NUMPAD/\");\n MAP_KEY(XK_KP_Multiply, \"NUMPAD*\");\n MAP_KEY(XK_KP_Enter, \"NUMPADReturn\");\n\n //Keypad with numlock off\n MAP_KEY(XK_KP_Home, \"NUMPAD7\");\n MAP_KEY(XK_KP_Up, \"NUMPAD8\");\n MAP_KEY(XK_KP_Page_Up, \"NUMPAD9\");\n MAP_KEY(XK_KP_Left, \"NUMPAD4\");\n MAP_KEY(XK_KP_Begin, \"NUMPAD5\");\n MAP_KEY(XK_KP_Right, \"NUMPAD6\");\n MAP_KEY(XK_KP_End, \"NUMPAD1\");\n MAP_KEY(XK_KP_Down, \"NUMPAD2\");\n MAP_KEY(XK_KP_Page_Down, \"NUMPAD3\");\n MAP_KEY(XK_KP_Insert, \"NUMPAD0\");\n MAP_KEY(XK_KP_Delete, \"NUMPAD.\");\n\n //These guys give full names instead of the symbols\n //but we want to behave the same on windows and linux, so...\n MAP_KEY(XK_comma, \",\");\n MAP_KEY(XK_period, \".\");\n MAP_KEY(XK_semicolon, \";\");\n MAP_KEY(XK_slash, \"/\");\n MAP_KEY(XK_backslash, \"\\\\\");\n MAP_KEY(XK_apostrophe, \"'\");\n MAP_KEY(XK_bracketleft, \"[\");\n MAP_KEY(XK_bracketright, \"]\");\n MAP_KEY(XK_minus, \"-\");\n MAP_KEY(XK_equal, \"=\");\n MAP_KEY(XK_grave, \"`\");\n\n win = window;\n\n display = XOpenDisplay(0);\n APP_ASSERT(display);\n\n/*\n im = XOpenIM(display, NULL, NULL, NULL);\n APP_ASSERT(im);\n\n ic = XCreateIC(im);\n APP_ASSERT(im);\n*/\n\n\n long event_mask = KeyPressMask | KeyReleaseMask;\n event_mask |= FocusChangeMask;\n if (XSelectInput(display, win, event_mask) == BadWindow) {\n CERR << \"calling XSelectInput: BadWindow\" << std::endl;\n app_fatal();\n }\n}\n\nKeyboardX11::~KeyboardX11 (void)\n{\n if(display) {\n getPresses();\n //if (ic) XDestroyIC(ic);\n //if (im) XCloseIM(im);\n XCloseDisplay(display);\n }\n}\n\nvoid KeyboardX11::add_key (Keyboard::Presses &keys, XEvent ev, int kind)\n{\n const char *prefix[] = { \"-\", \"=\", \"+\" };\n std::string str = prefix[kind+1];\n\n std::string keystr;\n\n // There is a list of specific keysyms that I want to map to strings myself\n KeySym key = XLookupKeysym(&ev.xkey, 0);\n if (key == NoSymbol) return; // key is not bound in X\n\n if (myKeyMap.find(key) != myKeyMap.end()) {\n keystr = myKeyMap[key];\n } else {\n keystr = XKeysymToString(key);\n }\n \n str += keystr;\n\n if (verbose) {\n CLOG << \"X key: \" << str << std::endl;\n }\n keys.push_back(str);\n\n // TODO: advanced input method / context for non-european languages\n // use Xutf8LookupString\n // or use an existing system like gtk\n char buf[1024];\n int r = XLookupString(&ev.xkey, buf, sizeof buf, NULL, NULL);\n\n // don't want text events unless the key is being pressed or repeated\n if (r && kind >= 0) {\n APP_ASSERT(r==1);\n // returns latin1 which is a subset of unicode\n unsigned long codepoint = (unsigned char)buf[0];\n // do not want non-printable text coming from keyboard, we have the\n // above system for those keys\n if ((codepoint>=0x20 && codepoint<0x7f) || codepoint>=0xa0) {\n str = \":\";\n // just encode into utf8 and we're done\n encode_utf8(codepoint, str);\n if (verbose) {\n CLOG << \"X key text: \\\"\" << str << \"\\\"\" << std::endl;\n }\n keys.push_back(str);\n }\n }\n}\n\nbool KeyboardX11::hasFocus (void)\n{\n return focussed;\n}\n\nKeyboard::Presses KeyboardX11::getPresses (void)\n{\n\n Keyboard::Presses r; // collect presses here\n XEvent event;\n\n //Poll x11 for events\n\n bool last_was_release = false;\n KeySym last_key = 0;\n XEvent last_event;\n\n while (XPending(display) > 0) {\n\n XNextEvent(display, &event);\n\n switch (event.type) {\n\n case FocusIn: {\n focussed = true;\n last_was_release = false;\n } break;\n\n case FocusOut: {\n focussed = false;\n last_was_release = false;\n } break;\n\n case KeyRelease: {\n if (last_was_release) {\n add_key(r, last_event, -1);\n }\n KeySym key = XLookupKeysym(&event.xkey, 0);\n last_key = key;\n last_event = event;\n last_was_release = true;\n } break;\n\n case KeyPress: {\n KeySym key = XLookupKeysym(&event.xkey, 0);\n if (last_was_release) {\n if (last_key!=key) {\n // different key, add both\n add_key(r, last_event, -1);\n add_key(r, event, 1);\n } else {\n add_key(r, event, 0);\n }\n } else {\n add_key(r, event, 1);\n }\n last_was_release = false;\n } break;\n\n }\n }\n\n if (last_was_release) {\n add_key(r, last_event, -1);\n }\n\n return r;\n}\n" }, { "alpha_fraction": 0.6872303485870361, "alphanum_fraction": 0.7014667987823486, "avg_line_length": 34.121212005615234, "blob_id": "ee3ab5bf56f73c45bcc10e94f8c49838fe699f31", "content_id": "2932ee2a95e349dcc2041579634fcf6fb33a90dd", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 2318, "license_type": "permissive", "max_line_length": 98, "num_lines": 66, "path": "/engine/linux/joystick_devjs.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#ifndef __JOYSTICK_DEVJS_H__\n#define __JOYSTICK_DEVJS_H__\n\n#include <X11/Xlib.h>\n\n#include \"../joystick.h\"\n\n#define JOYSTICK_DEVJS_EVENT_TYPE_BUTTON 0x01 // boolean: button pressed(1=on),released\n#define JOYSTICK_DEVJS_EVENT_TYPE_AXE 0x02 // analog: axe -32767 .. +32767\n#define JOYSTICK_DEVJS_EVENT_TYPE_INIT 0x80 // initial state\n\nstruct JoystickDevjsEvent {\n uint32_t timestamp; // timestamp in ms\n int16_t value; // value bool or analog\n uint8_t type; // event type: axe or button\n uint8_t index; // index of axe or button\n};\n\nstruct JoystickDevjsValue {\n int button[JOYSTICK_MAX_NUM_BUTTONS];\n int axe[JOYSTICK_MAX_NUM_AXES];\n};\n\n\nclass JoystickDevjs : public Joystick {\n\n public:\n\n JoystickDevjs (size_t window);\n virtual ~JoystickDevjs ();\n\n virtual bool getEvents(std::vector<signed char> *buttons_indexes_and_values,\n std::vector<signed char> *axes_indexes,\n std::vector<short int> *axes_values);\n\n protected:\n\n Window win;\n\n int fd=-1;\n struct JoystickDevjsEvent event;\n struct JoystickDevjsValue value;\n};\n\n#endif //__JOYSTICK_DEVJS_H__\n" }, { "alpha_fraction": 0.6339768171310425, "alphanum_fraction": 0.6451737284660339, "avg_line_length": 30.573171615600586, "blob_id": "337bbd4dc0b426221308d8e1bf085b1aa74baa07", "content_id": "52ac2ca59d1717caac14cdaf5f6f1be1318bcecb", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 2590, "license_type": "permissive", "max_line_length": 74, "num_lines": 82, "path": "/engine/ldbglue.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "extern \"C\" {\n#include \"lua.h\"\n}\n\n/* Call ldb as carefully as possible. Returns true if it managed\n * to call ldb and ldb does not return 'false' (nil is ok). An\n * example call would be:\n *\n * assert(ldb(L, \"some message\"));\n *\n * ldb() will work as a LUA_CUSTOM_APICHECK reporter function if\n * you use the `apicheck.diff` patch in the ldb distribution. (In\n * fact, that's why I wrote that patch.)\n * \n * Even if you don't use the custom apicheck feature, I strongly\n * recommend the use of the patch. It will put meaningful error\n * messages into the assert() calls, and also ensures that the\n * lua_State is consistent when the assert() goes off, which\n * allows you to call Lua API functions from a debugger *provided*\n * that you're careful to call lua_checkstack() first.\n *\n * In order to integrate (better) with gdb, we also define the\n * interface\n * void ldbdo(lua_State *L, const char *cmd);\n * which submits its second argument to ldb with the trigger 'ldb_cmd'\n * unless its second argument is NULL, in which case it just does\n * the same as ldb() without returning a success indication (this\n * avoids adding values to gdb's expression history after a call\n * command.) Obviously other possibilities exist.\n *\n * A sample gdb canned command is in ldb.gdb in the distribution.\n * It lets you use 'ldb' as a command from a gdb session, making\n * use of the ldbdo() interface, such as:\n *\n * ldb print local0\n *\n * You'll have to modify the script if you use something other than `L` as\n * your lua_State variable; then put it in your .gdbinit file.\n */\n\nint ldb (lua_State *L, const char *msg) {\n int rc;\n if (!lua_checkstack(L, 3)) /* 2 of ours + possibly 1 in api_incr_top */\n return 0;\n lua_getfield(L, LUA_REGISTRYINDEX, \"ldb\");\n if (lua_isnil(L, -1)) {\n lua_pop(L, 1);\n return 0;\n }\n if (msg != NULL && msg[0] != 0) {\n lua_pushstring(L, msg);\n lua_call(L, 1, 1);\n }\n else\n lua_call(L, 0, 1);\n rc = lua_isnil(L, -1) || lua_toboolean(L, -1);\n lua_pop(L, 1);\n return rc;\n}\n\nvoid ldbdo (lua_State *L, const char *cmd) {\n if (lua_checkstack(L, 4)) {\n lua_getfield(L, LUA_REGISTRYINDEX, \"ldb\");\n if (lua_isnil(L, 1)) \n lua_pop(L, 1);\n else if (cmd == NULL || cmd[0] == 0)\n lua_call(L, 0, 0);\n else {\n lua_pushliteral(L, \"ldb_cmd\");\n lua_pushstring(L, cmd);\n lua_call(L, 2, 0);\n }\n }\n}\n\nint luaopen_ldbglue (lua_State *L) {\n lua_getglobal(L, \"require\");\n lua_pushstring(L, \"ldb\");\n lua_call(L, 1, 1); /* If this fails, we can't go on */\n lua_setfield(L, LUA_REGISTRYINDEX, \"ldb\");\n return 0;\n}\n\n" }, { "alpha_fraction": 0.7544794082641602, "alphanum_fraction": 0.7593220472335815, "avg_line_length": 33.41666793823242, "blob_id": "32bb315f4f86e079eac86936fe4db9e00168f79c", "content_id": "6079877b10156a5ccec3877ad802d454482f55cc", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 2065, "license_type": "permissive", "max_line_length": 80, "num_lines": 60, "path": "/engine/navigation/navigation_system.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#ifndef navigation_system_h\n#define navigation_system_h\n\n#include\"Ogre.h\"\n#include\"../gfx/gfx_body.h\"\n#include\"../physics/physics_world.h\"\n#include<vector>\n\nextern Ogre::Vector3 swap_yz(Ogre::Vector3 from);\nextern float* Vec3ToFloat(Ogre::Vector3 pos);\nextern Ogre::Vector3 FloatToVec3(float* pos);\n\nclass NavigationSystem;\n\nextern NavigationSystem* nvsys;\n\nvoid navigation_init(void);\nvoid navigation_update(const float tslf);\nvoid navigation_update_debug(const float tslf);\nvoid navigation_shutdown(void);\n\nnamespace NavSysDebug\n{\n extern bool Enabled;\n extern bool ShowNavmesh;\n extern bool NavmeshUseTileColours;\n extern bool ShowBounds;\n extern bool ShowTilingGrid;\n extern bool ShowAgents;\n extern bool ShowAgentArrows;\n extern bool ShowObstacles;\n extern bool ShowOffmeshConnections;\n extern bool ShowConvexVolumes;\n\n void init(void);\n void destroy(void);\n}\n\n#endif // navigation_system_h\n" }, { "alpha_fraction": 0.5644662976264954, "alphanum_fraction": 0.5812018513679504, "avg_line_length": 37.982582092285156, "blob_id": "68d69cbc80733bc72d024e4bfcdfc8fde3ca92f9", "content_id": "7c391214b82f063f05bfcf9abfd12d5f611d45cb", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 53718, "license_type": "permissive", "max_line_length": 146, "num_lines": 1378, "path": "/engine/gfx/gfx_pipeline.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016 *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <math_util.h>\n#include <sleep.h>\n\n#include \"gfx_body.h\"\n#include \"gfx_debug.h\"\n#include \"gfx_decal.h\"\n#include \"gfx_particle_system.h\"\n#include \"gfx_pipeline.h\"\n#include \"gfx_sky_body.h\"\n#include \"gfx_tracer_body.h\"\n\nOgre::VertexData *screen_quad_vdata;\nOgre::HardwareVertexBufferSharedPtr screen_quad_vbuf;\n\n// The 0th one is the real one, the others are for debug display.\nstatic GfxShader *deferred_ambient_sun[9];\nstatic GfxShader *deferred_lights;\nstatic GfxShader *compositor_tonemap;\nstatic GfxShader *compositor_exposure_filter_then_horz_blur;\nstatic GfxShader *compositor_vert_blur;\nstatic GfxShader *compositor_horz_blur;\nstatic GfxShader *compositor_vert_blur_combine_tonemap;\n\nvoid gfx_pipeline_init (void)\n{\n // Prepare vertex buffer\n screen_quad_vdata = new Ogre::VertexData();\n screen_quad_vdata->vertexStart = 0;\n screen_quad_vdata->vertexCount = 6;\n\n // Non-instanced data\n unsigned vdecl_size = 0;\n vdecl_size += screen_quad_vdata->vertexDeclaration->addElement(0, vdecl_size, Ogre::VET_FLOAT2, Ogre::VES_POSITION).getSize();\n screen_quad_vbuf =\n Ogre::HardwareBufferManager::getSingleton().createVertexBuffer(\n vdecl_size, 6, Ogre::HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY);\n screen_quad_vdata->vertexBufferBinding->setBinding(0, screen_quad_vbuf);\n\n float vdata_raw[] = {\n -1, -1, // bottom left\n 1, -1, // bottom right\n -1, 1, // top left\n 1, 1, // top right\n 1, -1, // bottom right\n -1, 1 // top left\n };\n screen_quad_vbuf->writeData(screen_quad_vdata->vertexStart, screen_quad_vdata->vertexCount*vdecl_size, vdata_raw);\n\n GfxGslRunParams gbuffer_shader_params = {\n {\"gbuffer0\", GfxGslParam(GFX_GSL_FLOAT_TEXTURE2, 1, 1, 1, 1)},\n {\"gbuffer1\", GfxGslParam(GFX_GSL_FLOAT_TEXTURE2, 1, 1, 1, 1)},\n {\"gbuffer2\", GfxGslParam(GFX_GSL_FLOAT_TEXTURE2, 1, 1, 1, 1)},\n {\"shadowRes\", GfxGslParam::float1(512)},\n {\"shadowFactor\", GfxGslParam::float1(5000)},\n };\n\n std::string das_vertex_code =\n \"var pos_ss = vert.position.xy;\\n\"\n \"out.position = Float3(pos_ss, 0.5);\\n\"\n\n \"var uv = pos_ss / Float2(2, -2) + Float2(0.5, 0.5);\\n\"\n \"var ray = lerp(lerp(global.rayTopLeft, global.rayTopRight, uv.x),\\n\"\n \" lerp(global.rayBottomLeft, global.rayBottomRight, uv.x),\\n\"\n \" uv.y);\\n\"\n + std::string(gfx_d3d9() ? \"uv = uv + Float2(0.5, 0.5) / global.viewportSize.xy;\\n\" : \"\");\n\n std::string deferred_colour_code =\n \"var texel0 = sample(mat.gbuffer0, uv);\\n\"\n \"var texel1 = sample(mat.gbuffer1, uv);\\n\"\n \"var texel2 = sample(mat.gbuffer2, uv);\\n\"\n \"var shadow_oblique_cutoff = unpack_deferred_shadow_cutoff(texel0, texel1, texel2);\\n\"\n \"var d = unpack_deferred_diffuse_colour(texel0, texel1, texel2);\\n\"\n \"var s = unpack_deferred_specular(texel0, texel1, texel2);\\n\"\n \"var g = unpack_deferred_gloss(texel0, texel1, texel2);\\n\"\n \"var normalised_cam_dist = unpack_deferred_cam_dist(texel0, texel1, texel2);\\n\"\n \"var normal_vs = unpack_deferred_normal(texel0, texel1, texel2);\\n\"\n \"if (normalised_cam_dist>=1) discard;\\n\"\n \"var pos_ws = global.cameraPos + normalised_cam_dist*ray;\\n\"\n \"var cam_dist = normalised_cam_dist * global.farClipDistance;\\n\"\n \"var v2c = -normalise(ray);\\n\"\n \"var normal_ws = mul(global.invView, Float4(normal_vs, 0)).xyz;\\n\";\n\n deferred_ambient_sun[0] = gfx_shader_make_or_reset(\n \"/system/DeferredAmbientSun0\",\n das_vertex_code,\n \"\",\n deferred_colour_code +\n \"var sun = sunlight(pos_ws, v2c, d, normal_ws, g, s, cam_dist);\\n\"\n \"var env = envlight(v2c, d, normal_ws, g, s);\\n\"\n \"out.colour = sun + env;\\n\"\n \"out.colour = lerp(global.fogColour, out.colour, fog_weakness(cam_dist));\\n\",\n gbuffer_shader_params,\n true);\n\n // Diffuse only.\n deferred_ambient_sun[1] = gfx_shader_make_or_reset(\n \"/system/DeferredAmbientSun1\",\n das_vertex_code,\n \"\",\n deferred_colour_code +\n \"out.colour = d;\\n\",\n gbuffer_shader_params,\n true);\n\n // Normal\n deferred_ambient_sun[2] = gfx_shader_make_or_reset(\n \"/system/DeferredAmbientSun2\",\n das_vertex_code,\n \"\",\n deferred_colour_code +\n \"out.colour = 0.5 + normal_ws/2;\\n\",\n gbuffer_shader_params,\n true);\n\n // Specular\n deferred_ambient_sun[3] = gfx_shader_make_or_reset(\n \"/system/DeferredAmbientSun3\",\n das_vertex_code,\n \"\",\n deferred_colour_code +\n \"out.colour = s;\\n\",\n gbuffer_shader_params,\n true);\n\n // Gloss\n deferred_ambient_sun[4] = gfx_shader_make_or_reset(\n \"/system/DeferredAmbientSun4\",\n das_vertex_code,\n \"\",\n deferred_colour_code +\n \"out.colour = g;\\n\",\n gbuffer_shader_params,\n true);\n\n // Position (world space)\n deferred_ambient_sun[5] = gfx_shader_make_or_reset(\n \"/system/DeferredAmbientSun5\",\n das_vertex_code,\n \"\",\n deferred_colour_code +\n \"out.colour = (pos_ws % 1 + 1) % 1;\\n\",\n gbuffer_shader_params,\n true);\n\n // Render shadow map 0 in the middle of the screen.\n deferred_ambient_sun[6] = gfx_shader_make_or_reset(\n \"/system/DeferredAmbientSun6\",\n \"out.position = Float3(vert.position.xy, 0.5);\\n\",\n \"\",\n \"var ray = (global.rayTopLeft + global.rayTopRight\\n\"\n \" + global.rayBottomLeft + global.rayBottomRight) / 4;\\n\"\n \"var pos_ws = ray * 0.9;\\n\" // Rear-centre frustum.\n \"var offset = floor((global.viewportSize - mat.shadowRes) / 2);\\n\"\n \"var shad_uv = (frag.screen - offset) / mat.shadowRes;\\n\"\n \"if (shad_uv.x > 1 || shad_uv.y > 1 || shad_uv.x < 0 || shad_uv.y < 0) {\\n\"\n \" out.colour = Float3(0.1, 0, 0);\\n\" \n \"} else {\\n\"\n \" var sun_dist = (sample(global.shadowMap0, shad_uv).x / 2 + 0.5) * mat.shadowFactor;\\n\"\n \" out.colour.x = sun_dist % 1;\\n\"\n \" out.colour.y = ((sun_dist - out.colour.x) / 255.0) % 1;\\n\"\n \" out.colour.z = (sun_dist - out.colour.x - out.colour.y * 255) / 255.0 / 255.0;\\n\"\n \"}\\n\",\n gbuffer_shader_params,\n true);\n\n // Render shadow map 1 in the middle of the screen.\n deferred_ambient_sun[7] = gfx_shader_make_or_reset(\n \"/system/DeferredAmbientSun7\",\n \"out.position = Float3(vert.position.xy, 0.5);\\n\",\n \"\",\n \"var ray = (global.rayTopLeft + global.rayTopRight\\n\"\n \" + global.rayBottomLeft + global.rayBottomRight) / 4;\\n\"\n \"var pos_ws = ray * 0.9;\\n\" // Rear-centre frustum.\n \"var offset = floor((global.viewportSize - mat.shadowRes) / 2);\\n\"\n \"var shad_uv = (frag.screen - offset) / mat.shadowRes;\\n\"\n \"if (shad_uv.x > 1 || shad_uv.y > 1 || shad_uv.x < 0 || shad_uv.y < 0) {\\n\"\n \" out.colour = Float3(0.1, 0, 0);\\n\" \n \"} else {\\n\"\n \" var sun_dist = (sample(global.shadowMap1, shad_uv).x / 2 + 0.5) * mat.shadowFactor;\\n\"\n \" out.colour.x = sun_dist % 1;\\n\"\n \" out.colour.y = ((sun_dist - out.colour.x) / 255.0) % 1;\\n\"\n \" out.colour.z = (sun_dist - out.colour.x - out.colour.y * 255) / 255.0 / 255.0;\\n\"\n \"}\\n\",\n gbuffer_shader_params,\n true);\n\n // Render shadow map 2 in the middle of the screen.\n deferred_ambient_sun[8] = gfx_shader_make_or_reset(\n \"/system/DeferredAmbientSun8\",\n \"out.position = Float3(vert.position.xy, 0.5);\\n\",\n \"\",\n \"var ray = (global.rayTopLeft + global.rayTopRight\\n\"\n \" + global.rayBottomLeft + global.rayBottomRight) / 4;\\n\"\n \"var pos_ws = ray * 0.9;\\n\" // Rear-centre frustum.\n \"var offset = floor((global.viewportSize - mat.shadowRes) / 2);\\n\"\n \"var shad_uv = (frag.screen - offset) / mat.shadowRes;\\n\"\n \"if (shad_uv.x > 1 || shad_uv.y > 1 || shad_uv.x < 0 || shad_uv.y < 0) {\\n\"\n \" out.colour = Float3(0.1, 0, 0);\\n\" \n \"} else {\\n\"\n \" var sun_dist = (sample(global.shadowMap2, shad_uv).x / 2 + 0.5) * mat.shadowFactor;\\n\"\n \" out.colour.x = sun_dist % 1;\\n\"\n \" out.colour.y = ((sun_dist - out.colour.x) / 255.0) % 1;\\n\"\n \" out.colour.z = (sun_dist - out.colour.x - out.colour.y * 255) / 255.0 / 255.0;\\n\"\n \"}\\n\",\n gbuffer_shader_params,\n true);\n\n\n // TODO: Not clear if it's more efficient to compute ray at the vertexes.\n std::string identity_vertex_code =\n \"out.position = vert.position.xyz;\\n\";\n\n\n std::string lights_colour_code =\n \"var uv = frag.screen / global.viewportSize;\\n\"\n \"uv.y = 1 - uv.y;\\n\" // frag.screen is lower-left, textures upper-right.\n \"var ray = lerp(lerp(global.rayTopLeft, global.rayTopRight, uv.x),\\n\"\n \" lerp(global.rayBottomLeft, global.rayBottomRight, uv.x),\\n\"\n \" uv.y);\\n\"\n // This code shouldn't be needed if frag.screen is working properly.\n //+ std::string(gfx_d3d9() ? \"uv = uv + Float2(0.5, 0.5) / global.viewportSize.xy;\\n\" : \"\")\n + deferred_colour_code +\n \"var light_aim_ws = vert.normal;\\n\"\n \"var light_pos_ws = vert.coord2.xyz;\\n\"\n \"var inner = vert.coord3.x;\\n\"\n \"var outer = vert.coord3.y;\\n\"\n \"var range = vert.coord3.z;\\n\"\n \"var diff_colour = vert.coord0.xyz;\\n\"\n \"var spec_colour = vert.coord1.xyz;\\n\"\n\n \"var light_ray_ws = light_pos_ws - pos_ws;\\n\"\n \"var light_dist = length(light_ray_ws);\\n\"\n \"var surf_to_light = light_ray_ws / light_dist;\\n\"\n\n \"var dist = min(1.0, light_dist / range);\\n\"\n // This is the fadeoff equation that should probably be changed.\n \"var light_intensity = 2*dist*dist*dist - 3*dist*dist + 1;\\n\"\n\n \"var angle = -dot(light_aim_ws, surf_to_light);\\n\"\n \"if (outer != inner) {\\n\"\n \" var occlusion = clamp((angle-inner)/(outer-inner), 0.0, 1.0);\\n\"\n \" light_intensity = light_intensity * (1 - occlusion);\\n\"\n \"}\\n\"\n\n \"out.colour = light_intensity * punctual_lighting(\\n\"\n \" surf_to_light,\\n\"\n \" v2c,\\n\"\n \" d,\\n\"\n \" normal_ws,\\n\"\n \" g,\\n\"\n \" s,\\n\"\n \" diff_colour,\\n\"\n \" spec_colour\\n\"\n \");\\n\"\n ;\n\n deferred_lights = gfx_shader_make_or_reset(\"/system/DeferredLights\",\n identity_vertex_code, \"\", lights_colour_code,\n gbuffer_shader_params, true);\n\n\n //////////////\n // TONE MAP //\n //////////////\n\n GfxGslRunParams hdr_shader_params = {\n {\"hdr\", GfxGslParam(GFX_GSL_FLOAT_TEXTURE2, 1, 1, 1, 1)},\n {\"colourGradeLut\", GfxGslParam(GFX_GSL_FLOAT_TEXTURE3, 1, 1, 1, 1)},\n };\n\n // CAUTION: tonemapping also done by /system/VertBlurCombineTonemap, needs to match this.\n std::string compositor_tonemap_colour =\n \"var uv = frag.screen / global.viewportSize;\\n\"\n \"uv.y = 1 - uv.y;\\n\" // frag.screen is origin lower-left, textures origin upper-left.\n \"out.colour = global.exposure * sample(mat.hdr, uv).xyz;\\n\"\n // Tone map algorithm:\n \"out.colour = out.colour / (1 + out.colour);\\n\"\n \"out.colour = gamma_encode(out.colour);\\n\"\n \"var lut_uvw = (out.colour * 31 + 0.5) / 32;\\n\" // Hardcode 32x32x32 dimensions.\n \"out.colour = sample(mat.colourGradeLut, lut_uvw).rgb;\\n\"\n \"out.colour = desaturate(out.colour, global.saturation);\\n\";\n\n\n // TODO: dithering\n compositor_tonemap = gfx_shader_make_or_reset(\"/system/TonemapOnly\",\n identity_vertex_code, \"\",\n compositor_tonemap_colour, hdr_shader_params,\n true);\n\n ///////////\n // BLOOM //\n ///////////\n\n GfxGslRunParams bloom_params = {\n {\"bloomTexScale\", GfxGslParam::float1(1.0f)},\n {\"colourGradeLut\", GfxGslParam(GFX_GSL_FLOAT_TEXTURE3, 1, 1, 1, 1)},\n {\"original\", GfxGslParam(GFX_GSL_FLOAT_TEXTURE2, 1, 1, 1, 1)},\n {\"srcTex\", GfxGslParam(GFX_GSL_FLOAT_TEXTURE2, 1, 1, 1, 1)},\n };\n\n \n\n std::stringstream ss; // FIRST HORZ\n ss << \"var pascal_row11 = []Float{ 252/638.0, 210/638.0, 120/638.0,\\n\";\n ss << \" 45/638.0, 10/638.0, 1/638.0 };\\n\";\n ss << \"var uv = frag.screen / global.viewportSize;\\n\";\n ss << \"uv.y = 1 - uv.y;\\n\"; // frag.screen is origin lower-left, textures origin upper-left.\n ss << \"var off = mat.bloomTexScale / global.viewportSize.x;\\n\";\n ss << \"for (var i=-4 ; i<=4 ; i = i + 1) {\\n\";\n ss << \" var bloom_uv = uv * mat.bloomTexScale + off * Float2(i, 0);\\n\";\n ss << \" bloom_uv = clamp(bloom_uv,\\n\";\n ss << \" Float2(off, off) * mat.bloomTexScale,\\n\";\n ss << \" Float2(1 - off, 1 - off) * mat.bloomTexScale);\\n\";\n ss << \" var colour = global.exposure * sample(mat.srcTex, bloom_uv).xyz;\\n\";\n // First iteration takes unfiltered unscaled hdr fb as input.\n ss << \" var t = colour - global.bloomThreshold;\\n\";\n ss << \" var bloom = colour * clamp((t.r + t.g + t.b)/3.0, 0.0, 1.0);\\n\";\n ss << \" out.colour = out.colour + pascal_row11[abs(i)] * bloom;\\n\";\n ss << \"}\\n\";\n\n compositor_exposure_filter_then_horz_blur = gfx_shader_make_or_reset(\n \"/system/ExposureFilterThenHorzBlur\", identity_vertex_code, \"\", ss.str(),\n bloom_params, true);\n\n\n ss.str(\"\"); // VERT\n ss << \"var pascal_row11 = []Float{ 252/638.0, 210/638.0, 120/638.0,\\n\";\n ss << \" 45/638.0, 10/638.0, 1/638.0 };\\n\";\n ss << \"var uv = frag.screen / global.viewportSize;\\n\";\n ss << \"uv.y = 1 - uv.y;\\n\"; // frag.screen is origin lower-left, textures origin upper-left.\n ss << \"var off = mat.bloomTexScale / global.viewportSize.x;\\n\";\n ss << \"for (var i=-4 ; i<=4 ; i = i + 1) {\\n\";\n ss << \" var bloom_uv = uv * mat.bloomTexScale + off * Float2(0, i);\\n\";\n ss << \" bloom_uv = clamp(bloom_uv,\\n\";\n ss << \" Float2(off, off) * mat.bloomTexScale,\\n\";\n ss << \" Float2(1 - off, 1 - off) * mat.bloomTexScale);\\n\";\n ss << \" var colour = sample(mat.srcTex, bloom_uv).xyz;\\n\";\n ss << \" out.colour = out.colour + pascal_row11[abs(i)] * colour;\\n\";\n ss << \"}\\n\";\n\n compositor_vert_blur = gfx_shader_make_or_reset(\n \"/system/VertBlur\", identity_vertex_code, \"\", ss.str(),\n bloom_params, true);\n\n ss.str(\"\"); // HORZ\n ss << \"var pascal_row11 = []Float{ 252/638.0, 210/638.0, 120/638.0,\\n\";\n ss << \" 45/638.0, 10/638.0, 1/638.0 };\\n\";\n ss << \"var uv = frag.screen / global.viewportSize;\\n\";\n ss << \"uv.y = 1 - uv.y;\\n\"; // frag.screen is origin lower-left, textures origin upper-left.\n ss << \"var off = mat.bloomTexScale / global.viewportSize.x;\\n\";\n ss << \"for (var i=-4 ; i<=4 ; i = i + 1) {\\n\";\n ss << \" var bloom_uv = uv * mat.bloomTexScale + off * Float2(i, 0);\\n\";\n ss << \" bloom_uv = clamp(bloom_uv,\\n\";\n ss << \" Float2(off, off) * mat.bloomTexScale,\\n\";\n ss << \" Float2(1 - off, 1 - off) * mat.bloomTexScale);\\n\";\n ss << \" var colour = sample(mat.srcTex, bloom_uv).xyz;\\n\";\n ss << \" out.colour = out.colour + pascal_row11[abs(i)] * colour;\\n\";\n ss << \"}\\n\";\n\n compositor_horz_blur = gfx_shader_make_or_reset(\n \"/system/HorzBlur\", identity_vertex_code, \"\", ss.str(),\n bloom_params, true);\n\n ss.str(\"\"); // LAST VERT\n ss << \"var pascal_row11 = []Float{ 252/638.0, 210/638.0, 120/638.0,\\n\";\n ss << \" 45/638.0, 10/638.0, 1/638.0 };\\n\";\n ss << \"var uv = frag.screen / global.viewportSize;\\n\";\n ss << \"uv.y = 1 - uv.y;\\n\"; // frag.screen is origin lower-left, textures origin upper-left.\n ss << \"var off = mat.bloomTexScale / global.viewportSize.x;\\n\";\n ss << \"for (var i=-4 ; i<=4 ; i = i + 1) {\\n\";\n ss << \" var bloom_uv = uv * mat.bloomTexScale + off * Float2(0, i);\\n\";\n ss << \" bloom_uv = clamp(bloom_uv,\\n\";\n ss << \" Float2(off, off) * mat.bloomTexScale,\\n\";\n ss << \" Float2(1 - off, 1 - off) * mat.bloomTexScale);\\n\";\n ss << \" var colour = sample(mat.srcTex, bloom_uv).xyz;\\n\";\n ss << \" out.colour = out.colour + pascal_row11[abs(i)] * colour;\\n\";\n ss << \"}\\n\";\n ss << \"out.colour = out.colour + global.exposure * sample(mat.original, uv).xyz;\\n\";\n // Tone map algorithm:\n ss << \"out.colour = out.colour / (1 + out.colour);\\n\";\n ss << \"out.colour = gamma_encode(out.colour);\\n\";\n ss << \"var lut_uvw = (out.colour * 31 + 0.5) / 32;\\n\"; // Hardcode 32x32x32 dimensions.\n ss << \"out.colour = sample(mat.colourGradeLut, lut_uvw).rgb;\\n\";\n ss << \"out.colour = desaturate(out.colour, global.saturation);\\n\";\n\n compositor_vert_blur_combine_tonemap = gfx_shader_make_or_reset(\n \"/system/VertBlurCombineTonemap\", identity_vertex_code, \"\", ss.str(),\n bloom_params, true);\n\n}\n\n\n// {{{ (Deferred rendering) PointLightsGeometry\n\n// Buffers constructed every frame to render the point lights with deferred shading\n// (Cube and pyramid shaped bounding boxes for each light)\nclass PointLightsGeometry {\n\nprotected:\n\n Ogre::RenderOperation mRenderOperation;\n Ogre::VertexData mVertexData;\n Ogre::IndexData mIndexData;\n\n unsigned mDeclSize;\n unsigned mMaxVertexesGPU;\n unsigned mMaxIndexesGPU;\n\n float *mVertexPtr0; // hold the base pointer\n uint16_t *mIndexPtr0; // hold the base pointer\n float *mVertexPtr; // hold the marching pointer\n uint16_t *mIndexPtr; // hold the marching pointer\n\npublic:\n\n PointLightsGeometry (void)\n :\n mDeclSize(0),\n mMaxVertexesGPU(0), // increase later\n mMaxIndexesGPU(0), // increase later\n mVertexPtr0(NULL),\n mIndexPtr0(NULL)\n {\n mRenderOperation.vertexData = &mVertexData;\n mRenderOperation.indexData = &mIndexData;\n mRenderOperation.operationType = Ogre::RenderOperation::OT_TRIANGLE_LIST;\n mRenderOperation.useIndexes = true;\n\n // position on screen (just distinguishes the corners frome each other, -1 or 1)\n mVertexData.vertexDeclaration->addElement(0, mDeclSize, Ogre::VET_FLOAT3,\n Ogre::VES_POSITION);\n mDeclSize += Ogre::VertexElement::getTypeSize(Ogre::VET_FLOAT3);\n // direction the light is pointing (same for all 8 corners of the cube)\n mVertexData.vertexDeclaration->addElement(0, mDeclSize, Ogre::VET_FLOAT3,\n Ogre::VES_NORMAL);\n mDeclSize += Ogre::VertexElement::getTypeSize(Ogre::VET_FLOAT3);\n // diffuse colour (same for all 8 corners of the cube)\n mVertexData.vertexDeclaration->addElement(0, mDeclSize, Ogre::VET_FLOAT3,\n Ogre::VES_TEXTURE_COORDINATES, 0);\n mDeclSize += Ogre::VertexElement::getTypeSize(Ogre::VET_FLOAT3);\n // specular colour (same for all 8 corners of the cube)\n mVertexData.vertexDeclaration->addElement(0, mDeclSize, Ogre::VET_FLOAT3,\n Ogre::VES_TEXTURE_COORDINATES, 1);\n mDeclSize += Ogre::VertexElement::getTypeSize(Ogre::VET_FLOAT3);\n // light centre (same for all 8 corners of the cube)\n mVertexData.vertexDeclaration->addElement(0, mDeclSize, Ogre::VET_FLOAT3,\n Ogre::VES_TEXTURE_COORDINATES, 2);\n mDeclSize += Ogre::VertexElement::getTypeSize(Ogre::VET_FLOAT3);\n // inner/outer cone dot product and range (same for all 8 corners of the cube)\n mVertexData.vertexDeclaration->addElement(0, mDeclSize, Ogre::VET_FLOAT3,\n Ogre::VES_TEXTURE_COORDINATES, 3);\n mDeclSize += Ogre::VertexElement::getTypeSize(Ogre::VET_FLOAT3);\n\n }\n\n const Ogre::RenderOperation &getRenderOperation (void) { return mRenderOperation; }\n\n unsigned indexesUsed (void) { return mIndexPtr - mIndexPtr0; }\n unsigned vertexesUsed (void) { return ((mVertexPtr-mVertexPtr0)*sizeof(float)) / mDeclSize; }\n\n void beginLights (unsigned lights)\n {\n unsigned vertexes = lights * 8; // assume worst case -- all cubes\n if (vertexes > mMaxVertexesGPU) {\n mMaxVertexesGPU = vertexes;\n Ogre::HardwareVertexBufferSharedPtr vbuf =\n Ogre::HardwareBufferManager::getSingleton().createVertexBuffer(mDeclSize, vertexes, Ogre::HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY);\n mVertexData.vertexBufferBinding->setBinding(0, vbuf);\n }\n\n unsigned indexes = lights * 36; // assume worst case -- all cubes\n if (indexes > mMaxIndexesGPU) {\n mMaxIndexesGPU = indexes;\n mIndexData.indexBuffer = Ogre::HardwareBufferManager::getSingleton().\n createIndexBuffer(Ogre::HardwareIndexBuffer::IT_16BIT, indexes, Ogre::HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY);\n }\n\n mVertexPtr0 = mVertexPtr = static_cast<float*>(mVertexData.vertexBufferBinding->getBuffer(0)->lock(Ogre::HardwareBuffer::HBL_DISCARD));\n mIndexPtr0 = mIndexPtr = static_cast<uint16_t*>(mIndexData.indexBuffer->lock(Ogre::HardwareBuffer::HBL_DISCARD));\n }\n\n #define quad_vertexes(a,b,c,d) a, b, d, a, d, c\n\n void pyramidLight (const Ogre::Vector3 &wpos,\n const Ogre::Vector3 *cuboid_planes, const Ogre::Vector3 &dir_ws,\n const Ogre::ColourValue &diff, const Ogre::ColourValue &spec,\n float inner, float outer, float range)\n {\n\n Ogre::Vector3 vertexes[] = {\n wpos + cuboid_planes[0] + cuboid_planes[2] + cuboid_planes[5],\n wpos + cuboid_planes[0] + cuboid_planes[3] + cuboid_planes[5],\n wpos + cuboid_planes[1] + cuboid_planes[2] + cuboid_planes[5],\n wpos + cuboid_planes[1] + cuboid_planes[3] + cuboid_planes[5],\n wpos,\n };\n\n static unsigned indexes[] = {\n quad_vertexes(3,1,2,0),\n 3, 4, 1,\n 1, 4, 0,\n 0, 4, 2,\n 2, 4, 3,\n };\n\n\n unsigned offset = vertexesUsed();\n for (int j=0 ; j<5 ; ++j) {\n // position\n *(mVertexPtr++) = vertexes[j].x;\n *(mVertexPtr++) = vertexes[j].y;\n *(mVertexPtr++) = vertexes[j].z;\n // direction\n *(mVertexPtr++) = dir_ws.x;\n *(mVertexPtr++) = dir_ws.y;\n *(mVertexPtr++) = dir_ws.z;\n // diffuse colour\n *(mVertexPtr++) = diff.r;\n *(mVertexPtr++) = diff.g;\n *(mVertexPtr++) = diff.b;\n // specular colour\n *(mVertexPtr++) = spec.r;\n *(mVertexPtr++) = spec.g;\n *(mVertexPtr++) = spec.b;\n // centre position\n *(mVertexPtr++) = wpos.x;\n *(mVertexPtr++) = wpos.y;\n *(mVertexPtr++) = wpos.z;\n // inner/outer cone dot product, range\n *(mVertexPtr++) = inner;\n *(mVertexPtr++) = outer;\n *(mVertexPtr++) = range;\n }\n for (int j=0 ; j<18 ; ++j) {\n *(mIndexPtr++) = offset+indexes[j];\n }\n }\n\n void cubeLight (const Ogre::Vector3 &wpos,\n const Ogre::Vector3 *cuboid_planes, const Ogre::Vector3 &dir_ws,\n const Ogre::ColourValue &diff, const Ogre::ColourValue &spec,\n float inner, float outer, float range)\n {\n Ogre::Vector3 vertexes[] = {\n wpos + cuboid_planes[0] + cuboid_planes[2] + cuboid_planes[4],\n wpos + cuboid_planes[0] + cuboid_planes[2] + cuboid_planes[5],\n wpos + cuboid_planes[0] + cuboid_planes[3] + cuboid_planes[4],\n wpos + cuboid_planes[0] + cuboid_planes[3] + cuboid_planes[5],\n wpos + cuboid_planes[1] + cuboid_planes[2] + cuboid_planes[4],\n wpos + cuboid_planes[1] + cuboid_planes[2] + cuboid_planes[5],\n wpos + cuboid_planes[1] + cuboid_planes[3] + cuboid_planes[4],\n wpos + cuboid_planes[1] + cuboid_planes[3] + cuboid_planes[5],\n };\n\n static unsigned indexes[] = {\n quad_vertexes(2,6,0,4),\n quad_vertexes(7,3,5,1),\n quad_vertexes(3,2,1,0),\n quad_vertexes(6,7,4,5),\n quad_vertexes(0,4,1,5),\n quad_vertexes(3,7,2,6)\n };\n\n unsigned offset = vertexesUsed();\n for (int j=0 ; j<8 ; ++j) {\n // position\n *(mVertexPtr++) = vertexes[j].x;\n *(mVertexPtr++) = vertexes[j].y;\n *(mVertexPtr++) = vertexes[j].z;\n // direction\n *(mVertexPtr++) = dir_ws.x;\n *(mVertexPtr++) = dir_ws.y;\n *(mVertexPtr++) = dir_ws.z;\n // diffuse colour\n *(mVertexPtr++) = diff.r;\n *(mVertexPtr++) = diff.g;\n *(mVertexPtr++) = diff.b;\n // specular colour\n *(mVertexPtr++) = spec.r;\n *(mVertexPtr++) = spec.g;\n *(mVertexPtr++) = spec.b;\n // centre position\n *(mVertexPtr++) = wpos.x;\n *(mVertexPtr++) = wpos.y;\n *(mVertexPtr++) = wpos.z;\n // inner/outer cone dot product, range\n *(mVertexPtr++) = inner;\n *(mVertexPtr++) = outer;\n *(mVertexPtr++) = range;\n }\n for (int j=0 ; j<36 ; ++j) {\n *(mIndexPtr++) = offset+indexes[j];\n }\n }\n\n\n void endLights ()\n {\n mVertexData.vertexBufferBinding->getBuffer(0)->unlock();\n mIndexData.indexBuffer->unlock();\n\n mVertexData.vertexCount = vertexesUsed();\n mIndexData.indexCount = indexesUsed();\n }\n\n\n};\n\n// }}}\n\n\n// {{{ (Deferred rendering) DeferredLightingPasses\n\nclass DeferredLightingPasses : public Ogre::RenderQueueInvocation {\n GfxPipeline *pipe;\n\n PointLightsGeometry mdl;\n PointLightsGeometry mdlInside;\n\n public:\n DeferredLightingPasses (GfxPipeline *pipe)\n : Ogre::RenderQueueInvocation(0, \"\"), pipe(pipe)\n {\n\n setSuppressShadows(true);\n }\n\n void invoke (Ogre::RenderQueueGroup *, Ogre::SceneManager *)\n {\n Ogre::Camera *cam = pipe->getCamera();\n Ogre::Vector3 cam_pos = cam->getPosition();\n\n GfxTextureStateMap texs;\n // fill these in later as they are are Ogre internal textures\n texs[\"gbuffer0\"] = gfx_texture_state_point(nullptr);\n texs[\"gbuffer1\"] = gfx_texture_state_point(nullptr);\n texs[\"gbuffer2\"] = gfx_texture_state_point(nullptr);\n\n GfxShaderBindings binds;\n binds[\"gbuffer0\"] = GfxGslParam(GFX_GSL_FLOAT_TEXTURE2, 1,1,1,1);\n binds[\"gbuffer1\"] = GfxGslParam(GFX_GSL_FLOAT_TEXTURE2, 1,1,1,1);\n binds[\"gbuffer2\"] = GfxGslParam(GFX_GSL_FLOAT_TEXTURE2, 1,1,1,1);\n binds[\"shadowRes\"] = GfxGslParam::float1(gfx_option(GFX_SHADOW_RES));\n binds[\"shadowFactor\"] = GfxGslParam::float1(shader_scene_env.shadowFactor);\n\n const Ogre::Matrix4 &I = Ogre::Matrix4::IDENTITY;\n\n try {\n GfxShaderGlobals globs = gfx_shader_globals_cam(pipe);\n\n GfxShader *shader = deferred_ambient_sun[pipe->getCameraOpts().debugMode];\n shader->bindShader(GFX_GSL_PURPOSE_DEFERRED_AMBIENT_SUN, false,\n false, 0, globs, I, nullptr, 0, 1, texs, binds);\n\n for (unsigned i=0 ; i<3 ; ++i) {\n ogre_rs->_setTexture(NUM_GLOBAL_TEXTURES_LIGHTING + i, true, pipe->getGBufferTexture(i));\n }\n\n ogre_rs->_setCullingMode(Ogre::CULL_NONE);\n ogre_rs->_setDepthBufferParams(false, false, Ogre::CMPF_LESS_EQUAL);\n ogre_rs->_setSceneBlending(Ogre::SBF_ONE, Ogre::SBF_ZERO);\n ogre_rs->_setPolygonMode(Ogre::PM_SOLID);\n ogre_rs->setStencilCheckEnabled(false);\n ogre_rs->_setDepthBias(0, 0);\n\n // Sun + ambient render\n Ogre::RenderOperation op;\n op.useIndexes = false;\n op.vertexData = screen_quad_vdata;\n op.operationType = Ogre::RenderOperation::OT_TRIANGLE_LIST;\n ogre_rs->_render(op);\n\n // This should be in shader.\n for (unsigned i=0 ; i<NUM_GLOBAL_TEXTURES_LIGHTING + 3 ; ++i) {\n ogre_rs->_disableTextureUnit(i);\n }\n\n } catch (const Exception &e) {\n CERR << \"Rendering deferred sun, got: \" << e << std::endl;\n } catch (const Ogre::Exception &e) {\n CERR << \"Rendering deferred sun, got: \" << e.getDescription() << std::endl;\n }\n\n if (pipe->getCameraOpts().debugMode) return;\n\n if (!pipe->getCameraOpts().pointLights) return;\n\n try {\n\n /////////////////////\n // deferred lights //\n /////////////////////\n\n const Ogre::LightList &ll = ogre_sm->_getLightsAffectingFrustum();\n\n mdl.beginLights(ll.size());\n mdlInside.beginLights(ll.size());\n\n int light_counter = 0;\n for (Ogre::LightList::const_iterator i=ll.begin(),i_=ll.end(); i!=i_ ; ++i) {\n Ogre::Light *l = *i;\n if (l == ogre_sun) continue;\n light_counter++;\n const Ogre::Vector3 &dir_ws = l->getDerivedDirection();\n const Ogre::ColourValue &diff = l->getDiffuseColour();\n const Ogre::ColourValue &spec = l->getSpecularColour();\n float inner = Ogre::Math::Cos(l->getSpotlightInnerAngle());\n float outer = Ogre::Math::Cos(l->getSpotlightOuterAngle());\n float range = l->getAttenuationRange();\n Ogre::Vector3 wpos = l->getDerivedPosition();\n // define cone space in terms of world space\n Ogre::Vector3 dir_z = dir_ws;\n Ogre::Vector3 dir_x = dir_z.perpendicular();\n Ogre::Vector3 dir_y = dir_z.crossProduct(dir_x);\n bool use_pyramid = outer >= 0.4;\n // define a bounding cuboid in cone space\n float outer2 = std::max(0.0f, outer); // stop it at the 90 degree point\n float cs_x_max = range * sqrtf(1 - outer2*outer2);\n if (use_pyramid) {\n cs_x_max /= outer;\n };\n float cs_x_min = -cs_x_max;\n float cs_y_max = cs_x_max;\n float cs_y_min = cs_x_min;\n float cs_z_max = range;\n float cs_z_min = range * std::min(0.0f, outer);\n Ogre::Vector3 light_to_cam = cam_pos - wpos;\n\n // the 'inside' method always works but is less efficient as it\n // does not allow us to avoid lighting when there is an object\n // between the lit surface and the camera occluding the fragments\n // to be shaded.\n\n // on the other hand, the 'inside' method does have an optimisation\n // in the case where the light is between the camera and a fragment\n // but the fragment is out of range of the light\n\n // I am choosing to prefer the occlusion optimisation as lights that are\n // too far from surfaces should be avoided by good level design.\n\n // however 'inside' is the only method that can be used if the\n // camera is inside the light volume.\n\n bool inside = between<float>(light_to_cam.dotProduct(dir_x), cs_x_min-1, cs_x_max+1)\n && between<float>(light_to_cam.dotProduct(dir_y), cs_y_min-1, cs_y_max+1)\n && between<float>(light_to_cam.dotProduct(dir_z), cs_z_min-1, cs_z_max+1);\n\n //inside = true;\n\n Ogre::Vector3 cuboid_planes[] = {\n cs_x_min * dir_x, cs_x_max * dir_x,\n cs_y_min * dir_y, cs_y_max * dir_y,\n cs_z_min * dir_z, cs_z_max * dir_z,\n };\n\n PointLightsGeometry &mdl_ = inside ? mdlInside : mdl;\n\n if (use_pyramid) {\n mdl_.pyramidLight(wpos, cuboid_planes, dir_ws,diff,spec,inner,outer,range);\n } else {\n mdl_.cubeLight(wpos, cuboid_planes, dir_ws,diff,spec,inner,outer,range);\n }\n }\n mdl.endLights();\n mdlInside.endLights();\n //CVERB << \"Total lights: \" << light_counter << std::endl;\n\n if (light_counter > 0) {\n\n GfxShaderGlobals globs = gfx_shader_globals_cam(pipe);\n\n deferred_lights->bindShader(GFX_GSL_PURPOSE_HUD, false, false, 0,\n globs, I, nullptr, 0, 1, texs, binds);\n\n for (unsigned i=0 ; i<3 ; ++i)\n ogre_rs->_setTexture(NUM_GLOBAL_TEXTURES_NO_LIGHTING + i, true, pipe->getGBufferTexture(i));\n\n ogre_rs->_setSceneBlending(Ogre::SBF_ONE, Ogre::SBF_ONE);\n ogre_rs->_setPolygonMode(Ogre::PM_SOLID);\n ogre_rs->setStencilCheckEnabled(false);\n ogre_rs->_setDepthBias(0, 0);\n\n if (mdl.indexesUsed() > 0) {\n ogre_rs->_setCullingMode(Ogre::CULL_CLOCKWISE);\n ogre_rs->_setDepthBufferParams(true, false, Ogre::CMPF_LESS_EQUAL);\n ogre_rs->_render(mdl.getRenderOperation());\n }\n\n if (mdlInside.indexesUsed() > 0) {\n ogre_rs->_setCullingMode(Ogre::CULL_ANTICLOCKWISE);\n ogre_rs->_setDepthBufferParams(true, false, Ogre::CMPF_GREATER_EQUAL);\n ogre_rs->_render(mdlInside.getRenderOperation());\n }\n\n for (unsigned i=0 ; i<NUM_GLOBAL_TEXTURES_NO_LIGHTING + 3 ; ++i) {\n ogre_rs->_disableTextureUnit(i);\n }\n }\n\n } catch (const Exception &e) {\n CERR << \"Rendering deferred point lights, got: \" << e << std::endl;\n } catch (const Ogre::Exception &e) {\n CERR << \"Rendering deferred point lights, got: \" << e.getDescription() << std::endl;\n }\n\n }\n \n};\n\n// }}}\n\n\n\n// {{{ Decals passes \n\nclass DecalPasses : public Ogre::RenderQueueInvocation {\n GfxPipeline *pipe;\n\n public:\n DecalPasses (GfxPipeline *pipe)\n : Ogre::RenderQueueInvocation(0, \"\"), pipe(pipe)\n {\n setSuppressShadows(true);\n }\n\n void invoke (Ogre::RenderQueueGroup *, Ogre::SceneManager *)\n {\n if (pipe->getCameraOpts().decals) gfx_decal_render(pipe);\n }\n \n};\n\n// }}}\n\n\n\n// {{{ Debug passes \n\nclass DebugPasses : public Ogre::RenderQueueInvocation {\n GfxPipeline *pipe;\n\n public:\n DebugPasses (GfxPipeline *pipe)\n : Ogre::RenderQueueInvocation(0, \"\"), pipe(pipe)\n {\n setSuppressShadows(true);\n }\n\n void invoke (Ogre::RenderQueueGroup *, Ogre::SceneManager *)\n {\n gfx_debug_render(pipe);\n }\n \n};\n\n// }}}\n\n\n\n// {{{ Particles passes \n\nclass ParticlesPasses : public Ogre::RenderQueueInvocation {\n GfxPipeline *pipe;\n\n public:\n ParticlesPasses (GfxPipeline *pipe)\n : Ogre::RenderQueueInvocation(0, \"\"), pipe(pipe)\n {\n setSuppressShadows(true);\n }\n\n void invoke (Ogre::RenderQueueGroup *, Ogre::SceneManager *)\n {\n if (pipe->getCameraOpts().particles) gfx_particle_render(pipe);\n }\n \n};\n\n// }}}\n\n\n\n// {{{ Tracer passes \n\nclass TracerPasses : public Ogre::RenderQueueInvocation {\n GfxPipeline *pipe;\n\n public:\n TracerPasses (GfxPipeline *pipe)\n : Ogre::RenderQueueInvocation(0, \"\"), pipe(pipe)\n {\n setSuppressShadows(true);\n }\n\n void invoke (Ogre::RenderQueueGroup *, Ogre::SceneManager *)\n {\n if (pipe->getCameraOpts().tracers) gfx_tracer_body_render(pipe);\n }\n \n};\n\n// }}}\n\n\n\n// {{{ Sky passes \n\nclass SkyPasses : public Ogre::RenderQueueInvocation {\n GfxPipeline *pipe;\n\n public:\n SkyPasses (GfxPipeline *pipe)\n : Ogre::RenderQueueInvocation(0), pipe(pipe)\n {\n setSuppressShadows(true);\n }\n\n void invoke (Ogre::RenderQueueGroup *, Ogre::SceneManager *)\n {\n try {\n if (pipe->getCameraOpts().sky) gfx_sky_render(pipe);\n } catch (Ogre::Exception &e) {\n CERR << \"While rendering skies: \" << e.getDescription() << std::endl;\n } catch (const Exception &e) {\n CERR << \"While rendering skies: \" << e << std::endl;\n }\n }\n \n};\n\n// }}}\n\n\n\n// {{{ Reset pass\n\nclass ResetPass : public Ogre::RenderQueueInvocation {\n GfxPipeline *pipe;\n unsigned int buffers;\n Vector3 colour;\n float depth;\n unsigned short stencil;\n\n public:\n ResetPass (GfxPipeline *pipe, unsigned int buffers,\n const Vector3 &colour=Vector3(1,1,1), float depth=1.0f, unsigned short stencil=0)\n : Ogre::RenderQueueInvocation(0), pipe(pipe), buffers(buffers),\n colour(colour), depth(depth), stencil(stencil)\n {\n setSuppressShadows(true);\n }\n\n void invoke (Ogre::RenderQueueGroup *, Ogre::SceneManager *)\n {\n try {\n pipe->getCamera()->getViewport()->clear(buffers, to_ogre_cv(colour), depth, stencil);\n } catch (Ogre::Exception &e) {\n CERR << \"While clearing buffer: \" << e.getDescription() << std::endl;\n }\n }\n \n};\n\n// }}}\n\n\n\n// {{{ First Person\n\nclass FirstPersonPasses : public Ogre::RenderQueueInvocation {\n GfxPipeline *pipe;\n bool alphaBlend;\n\n public:\n FirstPersonPasses (GfxPipeline *pipe, bool alpha_blend)\n : Ogre::RenderQueueInvocation(0), pipe(pipe), alphaBlend(alpha_blend)\n {\n setSuppressShadows(true);\n }\n\n void invoke (Ogre::RenderQueueGroup *, Ogre::SceneManager *)\n {\n try {\n if (pipe->getCameraOpts().firstPerson) gfx_body_render_first_person(pipe, alphaBlend);\n } catch (Ogre::Exception &e) {\n CERR << \"While rendering first person: \" << e.getDescription() << std::endl;\n } catch (const Exception &e) {\n CERR << \"While rendering first person: \" << e << std::endl;\n }\n }\n \n};\n\n// }}}\n\n\n\nGfxPipeline::GfxPipeline (const std::string &name, Ogre::Viewport *target_viewport)\n : targetViewport(target_viewport)\n{\n\n unsigned width = targetViewport->getActualWidth();\n unsigned height = targetViewport->getActualHeight();\n\n gBuffer = ogre_rs->createMultiRenderTarget(name+\":G\");\n // make textures for it\n const char *gbuffer_el_names[] = { \":G0\", \":G1\", \":G2\", \":G3\" };\n for (unsigned i=0 ; i<3 ; ++i) {\n gBufferElements[i] =\n Ogre::TextureManager::getSingleton().createManual(\n name+gbuffer_el_names[i], RESGRP, Ogre::TEX_TYPE_2D,\n width, height, 1,\n 0,\n Ogre::PF_A8R8G8B8,\n Ogre::TU_RENDERTARGET,\n NULL,\n use_hwgamma);\n gBuffer->bindSurface(i, gBufferElements[i]->getBuffer()->getRenderTarget());\n }\n\n\n for (unsigned i=0 ; i<sizeof(hdrFb)/sizeof(*hdrFb) ; ++i) {\n std::stringstream ss; ss << i;\n hdrFb[i] = Ogre::TextureManager::getSingleton().createManual(\n name+\":hdrFb\"+ss.str(), RESGRP, Ogre::TEX_TYPE_2D,\n width, height, 1,\n 0,\n Ogre::PF_FLOAT16_RGB,\n Ogre::TU_RENDERTARGET,\n NULL,\n false);\n hdrFb[i]->getBuffer()->getRenderTarget()->setDepthBufferPool(\n Ogre::DepthBuffer::POOL_MANUAL_USAGE);\n }\n\n cam = ogre_sm->createCamera(name+\":cam\");\n cam->setAutoAspectRatio(true);\n\n rqisGbuffer = ogre_root->createRenderQueueInvocationSequence(name+\":gbuffer\");\n rqisGbuffer->add(OGRE_NEW Ogre::RenderQueueInvocation(RQ_GBUFFER_OPAQUE));\n\n // Opaque passes\n rqisDebug = ogre_root->createRenderQueueInvocationSequence(name+\":debug\");\n rqisDebug->add(new DeferredLightingPasses(this));\n\n // Opaque passes\n rqisDeferred = ogre_root->createRenderQueueInvocationSequence(name+\":deferred\");\n rqisDeferred->add(new DeferredLightingPasses(this));\n rqisDeferred->add(OGRE_NEW Ogre::RenderQueueInvocation(RQ_FORWARD_OPAQUE));\n rqisDeferred->add(OGRE_NEW Ogre::RenderQueueInvocation(RQ_FORWARD_OPAQUE_EMISSIVE));\n rqisDeferred->add(new SkyPasses(this));\n // Alpha passes\n rqisDeferred->add(new DecalPasses(this));\n rqisDeferred->add(OGRE_NEW Ogre::RenderQueueInvocation(RQ_FORWARD_ALPHA_DEPTH));\n rqisDeferred->add(OGRE_NEW Ogre::RenderQueueInvocation(RQ_FORWARD_ALPHA_DEPTH_EMISSIVE));\n rqisDeferred->add(OGRE_NEW Ogre::RenderQueueInvocation(RQ_FORWARD_ALPHA));\n rqisDeferred->add(OGRE_NEW Ogre::RenderQueueInvocation(RQ_FORWARD_ALPHA_EMISSIVE));\n rqisDeferred->add(new ParticlesPasses(this));\n rqisDeferred->add(new TracerPasses(this));\n // Debug passes\n rqisDeferred->add(new DebugPasses(this));\n // First person passes\n rqisDeferred->add(new ResetPass(this, Ogre::FBT_DEPTH));\n rqisDeferred->add(new FirstPersonPasses(this, false));\n rqisDeferred->add(new FirstPersonPasses(this, true));\n}\n\nGfxPipeline::~GfxPipeline (void) {\n ogre_sm->destroyCamera(cam);\n\n // destroy MRT\n ogre_rs->destroyRenderTarget(gBuffer->getName());\n for (unsigned i=0 ; i<3 ; ++i) {\n Ogre::TextureManager::getSingleton().remove(gBufferElements[i]);\n }\n\n for (unsigned i=0 ; i<sizeof(hdrFb)/sizeof(*hdrFb) ; ++i) {\n Ogre::TextureManager::getSingleton().remove(hdrFb[i]);\n }\n\n ogre_root->destroyRenderQueueInvocationSequence(rqisGbuffer->getName());\n ogre_root->destroyRenderQueueInvocationSequence(rqisDeferred->getName());\n ogre_root->destroyRenderQueueInvocationSequence(rqisDebug->getName());\n}\n\ntemplate<unsigned n> struct RenderQuadParams {\n Ogre::TexturePtr texs[n];\n unsigned next;\n GfxShader *shader;\n Ogre::SceneBlendFactor targetBlend;\n RenderQuadParams(GfxShader *shader, Ogre::SceneBlendFactor target_blend=Ogre::SBF_ZERO)\n : next(0), shader(shader), targetBlend(target_blend)\n { }\n RenderQuadParams<n> tex (const Ogre::TexturePtr &t) {\n APP_ASSERT(next < n);\n texs[next] = t;\n next++;\n return *this;\n };\n};\n\n// Must assign textures in alphabetical order by name in tex_binds\nstatic void render_quad (\n GfxPipeline *p,\n Ogre::Viewport *viewport,\n GfxShader *shader,\n const GfxTextureStateMap &texs,\n const GfxShaderBindings &binds,\n size_t num_texs,\n const Ogre::TexturePtr **tex_arr, // array of length num_texs\n Ogre::SceneBlendFactor target_blend)\n{\n ogre_rs->_setViewport(viewport);\n ogre_rs->_beginFrame();\n\n GfxShaderGlobals globs = gfx_shader_globals_cam_ss(p, viewport);\n\n shader->bindShader(\n GFX_GSL_PURPOSE_HUD, false, false, 0, globs,\n Ogre::Matrix4::IDENTITY, nullptr, 0, 1, texs, binds);\n\n ogre_rs->_setCullingMode(Ogre::CULL_NONE);\n ogre_rs->_setDepthBufferParams(false, false, Ogre::CMPF_LESS_EQUAL);\n\n for (unsigned i=0 ; i<num_texs ; ++i) {\n unsigned index = NUM_GLOBAL_TEXTURES_NO_LIGHTING + i;\n ogre_rs->_setTexture(index, true, *tex_arr[i]);\n ogre_rs->_setTextureUnitFiltering(index, Ogre::FT_MIN, Ogre::FO_LINEAR);\n ogre_rs->_setTextureUnitFiltering(index, Ogre::FT_MAG, Ogre::FO_LINEAR);\n ogre_rs->_setTextureUnitFiltering(index, Ogre::FT_MIP, Ogre::FO_NONE);\n Ogre::TextureUnitState::UVWAddressingMode am;\n am.u = Ogre::TextureUnitState::TAM_CLAMP;\n am.v = Ogre::TextureUnitState::TAM_CLAMP;\n am.w = Ogre::TextureUnitState::TAM_CLAMP;\n ogre_rs->_setTextureAddressingMode(index, am);\n }\n\n ogre_rs->_setCullingMode(Ogre::CULL_NONE);\n ogre_rs->_setDepthBufferParams(false, false, Ogre::CMPF_LESS_EQUAL);\n ogre_rs->_setSceneBlending(Ogre::SBF_ONE, target_blend);\n ogre_rs->_setPolygonMode(Ogre::PM_SOLID);\n ogre_rs->setStencilCheckEnabled(false);\n ogre_rs->_setDepthBias(0, 0);\n\n\n // render the quad\n Ogre::RenderOperation op;\n op.useIndexes = false;\n op.vertexData = screen_quad_vdata;\n op.operationType = Ogre::RenderOperation::OT_TRIANGLE_LIST;\n ogre_rs->_render(op);\n\n for (unsigned i=0 ; i<num_texs ; ++i)\n ogre_rs->_disableTextureUnit(NUM_GLOBAL_TEXTURES_NO_LIGHTING + i);\n\n ogre_rs->_endFrame();\n\n}\n\n// Render onto the given RTT, set appropriate viewport_size and manage a\n// temporary viewport for this render.\nstatic void render_quad (\n GfxPipeline *p,\n Ogre::RenderTarget *rt,\n const Ogre::Vector4 &win,\n GfxShader *shader,\n const GfxTextureStateMap &texs,\n const GfxShaderBindings &binds,\n size_t num_texs,\n const Ogre::TexturePtr **tex_arr, // array of length num_texs\n Ogre::SceneBlendFactor target_blend)\n{\n Ogre::Viewport *vp = rt->addViewport(NULL, 0, win.x, win.y, win.z, win.w);\n render_quad(p, vp, shader, texs, binds, num_texs, tex_arr, target_blend);\n rt->removeViewport(vp->getZOrder());\n}\n\n// Render onto the given RTT\nstatic void render_quad (\n GfxPipeline *p,\n const Ogre::TexturePtr &rtt,\n const Ogre::Vector4 &win,\n GfxShader *shader,\n const GfxTextureStateMap &texs,\n const GfxShaderBindings &binds,\n size_t num_texs,\n const Ogre::TexturePtr **tex_arr, // array of length num_texs\n Ogre::SceneBlendFactor target_blend)\n{\n render_quad(p, rtt->getBuffer()->getRenderTarget(), win,\n shader, texs, binds, num_texs, tex_arr, target_blend);\n}\n\nstatic void clear_rt (Ogre::RenderTarget *rt)\n{\n Ogre::Viewport *vp = rt->addViewport(NULL);\n ogre_rs->_setViewport(vp);\n ogre_rs->clearFrameBuffer(Ogre::FBT_COLOUR);\n rt->removeViewport(vp->getZOrder());\n}\n\nstatic void clear_rt (const Ogre::TexturePtr &rtt)\n{\n return clear_rt(rtt->getBuffer()->getRenderTarget());\n}\n\nvoid GfxPipeline::render (const CameraOpts &cam_opts, bool additive)\n{\n opts = cam_opts;\n\n cam->setPosition(to_ogre(opts.pos));\n // Ogre cameras point towards Z whereas in Grit the convention is that 'unrotated' means pointing towards y (north)\n cam->setOrientation(to_ogre(opts.dir*Quaternion(Degree(90),Vector3(1,0,0))));\n cam->setFOVy(Ogre::Degree(opts.fovY));\n cam->setNearClipDistance(opts.nearClip);\n cam->setFarClipDistance(opts.farClip);\n cam->setFrustumOffset(opts.frustumOffset);\n cam->setFocalLength(1);\n\n Ogre::Viewport *vp;\n\n // populate gbuffer\n vp = gBuffer->addViewport(cam);\n\n if (gfx_option(GFX_UPDATE_MATERIALS)) {\n GfxShaderGlobals globs = gfx_shader_globals_cam(this);\n for (const auto &pair : material_db) {\n GfxMaterial *m = dynamic_cast<GfxMaterial*>(pair.second);\n if (m == nullptr) continue;\n // CVERB << \"Rebuilding: \" << m->name << std::endl;\n m->updateOgreMaterials(globs);\n }\n }\n\n vp->setShadowsEnabled(true);\n // white here makes sure that the depth (remember that it is 3 bytes) is maximal\n vp->setBackgroundColour(Ogre::ColourValue::White);\n vp->setRenderQueueInvocationSequenceName(rqisGbuffer->getName());\n unsigned long long micros_before = micros();\n vp->update();\n unsigned long long micros_after_gbuffer = micros();\n gBuffer->removeViewport(vp->getZOrder());\n gBufferStats.batches = ogre_rs->_getBatchCount();\n gBufferStats.triangles = ogre_rs->_getFaceCount();;\n gBufferStats.micros = micros_after_gbuffer - micros_before;\n\n if (!opts.bloomAndToneMap || opts.debugMode > 0) {\n\n // render gbuffer and alpha, sky, etc into ldr window\n vp = targetViewport;\n vp->setBackgroundColour(Ogre::ColourValue(0.3, 0.3, 0.3));\n vp->setCamera(cam);\n vp->setShadowsEnabled(false);\n if (opts.debugMode > 0) {\n vp->setRenderQueueInvocationSequenceName(rqisDebug->getName());\n } else {\n vp->setRenderQueueInvocationSequenceName(rqisDeferred->getName());\n }\n vp->update();\n unsigned long long micros_after_deferred = micros();\n deferredStats.batches = ogre_rs->_getBatchCount();\n deferredStats.triangles = ogre_rs->_getFaceCount();\n deferredStats.micros = micros_after_deferred - micros_after_gbuffer;\n return;\n\n }\n\n // render from gbuffer, the alpha passes, sky, etc into hdr viewport\n hdrFb[0]->getBuffer()->getRenderTarget()->attachDepthBuffer(gBuffer->getDepthBuffer());\n vp = hdrFb[0]->getBuffer()->getRenderTarget()->addViewport(cam);\n vp->setClearEveryFrame(true, Ogre::FBT_COLOUR);\n vp->setBackgroundColour(Ogre::ColourValue(0.3, 0.3, 0.3));\n vp->setShadowsEnabled(false);\n vp->setRenderQueueInvocationSequenceName(rqisDeferred->getName());\n vp->update();\n unsigned long long micros_after_deferred = micros();\n deferredStats.batches = ogre_rs->_getBatchCount();\n deferredStats.triangles = ogre_rs->_getFaceCount();\n deferredStats.micros = micros_after_deferred - micros_after_gbuffer;\n hdrFb[0]->getBuffer()->getRenderTarget()->removeViewport(vp->getZOrder());\n hdrFb[0]->getBuffer()->getRenderTarget()->detachDepthBuffer();\n\n\n Ogre::SceneBlendFactor target_blend = additive ? Ogre::SBF_ONE : Ogre::SBF_ZERO;\n\n unsigned bloom_iterations = gfx_option(GFX_BLOOM_ITERATIONS);\n\n if (bloom_iterations == 0) {\n\n // hdrFb[0] is an Ogre::TexturePtr and will never be a GfxDiskResource, so\n // bind it explicitly with Ogre-level calls in render_quad.\n GfxTextureStateMap texs;\n texs[\"colourGradeLut\"] = gfx_texture_state_anisotropic(nullptr, GFX_AM_CLAMP);\n texs[\"hdr\"] = gfx_texture_state_point(nullptr);\n GfxShaderBindings binds;\n binds[\"colourGradeLut\"] = GfxGslParam(GFX_GSL_FLOAT_TEXTURE3, 1,1,1,1);\n binds[\"hdr\"] = GfxGslParam(GFX_GSL_FLOAT_TEXTURE2, 1,1,1,1);\n\n const Ogre::TexturePtr *ogre_texs[] = {\n &colour_grade_lut->getOgreTexturePtr(),\n &hdrFb[0],\n };\n render_quad(this, targetViewport, compositor_tonemap, texs, binds,\n 2, ogre_texs, target_blend);\n\n return;\n }\n\n GfxTextureStateMap texs;\n texs[\"colourGradeLut\"] = gfx_texture_state_anisotropic(nullptr, GFX_AM_CLAMP);\n texs[\"original\"] = gfx_texture_state_point(nullptr);\n texs[\"srcTex\"] = gfx_texture_state_point(nullptr);\n GfxShaderBindings binds;\n binds[\"colourGradeLut\"] = GfxGslParam(GFX_GSL_FLOAT_TEXTURE3, 1,1,1,1);\n binds[\"original\"] = GfxGslParam(GFX_GSL_FLOAT_TEXTURE2, 1,1,1,1);\n binds[\"srcTex\"] = GfxGslParam(GFX_GSL_FLOAT_TEXTURE2, 1,1,1,1);\n\n const Ogre::TexturePtr *ogre_texs[3];\n ogre_texs[0] = &colour_grade_lut->getOgreTexturePtr();\n\n // half_bloom = filter_then_horz_blur(raw)\n // loop 1..n-1 {\n // bloom = vert_blur(half_bloom);\n // half_bloom = scale_then_horz_blur(bloom);\n // }\n // fb = vert_blur_combine_and_tonemap(raw, half_bloom) \n\n Ogre::Vector4 vp_dim(0,0,1,1);\n\n binds[\"bloomTexScale\"] = GfxGslParam::float1(vp_dim.z);\n ogre_texs[1] = &hdrFb[0];\n ogre_texs[2] = &hdrFb[0];\n render_quad(this, hdrFb[1], vp_dim, compositor_exposure_filter_then_horz_blur,\n texs, binds, 3, ogre_texs, Ogre::SBF_ZERO);\n\n for (unsigned i=1 ; i<bloom_iterations ; ++i) {\n clear_rt(hdrFb[2]);\n ogre_texs[1] = &hdrFb[1];\n ogre_texs[2] = &hdrFb[1];\n render_quad(this, hdrFb[2], vp_dim, compositor_vert_blur,\n texs, binds, 3, ogre_texs, Ogre::SBF_ZERO);\n vp_dim /= 2;\n\n clear_rt(hdrFb[1]);\n ogre_texs[1] = &hdrFb[2];\n ogre_texs[2] = &hdrFb[2];\n render_quad(this, hdrFb[1], vp_dim, compositor_horz_blur,\n texs, binds, 3, ogre_texs, Ogre::SBF_ZERO);\n\n binds[\"bloomTexScale\"] = GfxGslParam::float1(vp_dim.z);\n }\n // Note that hdrFb[0] is original, hdrFb[1] is srcTex, which are in alphabetical order.\n ogre_texs[1] = &hdrFb[0];\n ogre_texs[2] = &hdrFb[1];\n render_quad(this, targetViewport, compositor_vert_blur_combine_tonemap,\n texs, binds, 3, ogre_texs, target_blend);\n\n}\n" }, { "alpha_fraction": 0.635064959526062, "alphanum_fraction": 0.6425479054450989, "avg_line_length": 48.44648361206055, "blob_id": "f9bbf4b1d73b2ddf274eca9694cfff63a126678d", "content_id": "604dbef276d599cf6586152b004f723767bde155", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 16170, "license_type": "permissive", "max_line_length": 108, "num_lines": 327, "path": "/dependencies/quex-0.34.1/quex/core_engine/state_machine/ambiguous_post_context.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "# PURPOSE: Quex's strategy to handle post-conditions is the following:\n# When a state is reached that is labeled with 'end of core'\n# it stores the input position in a certain variable. This\n# approach is 'pure' in a sense that it does not circumvent the\n# understanding of a regular expression based state machine.\n# \n# A problem arises with some post-conditions, usually called\n# 'dangerous trailing context'. Some of those cases can be \n# handled by quex. Other's are by nature ambiguous. This\n# file provides functions to analyse the different cases.\n# \n# (C) Frank-Rene Schaefer\n##############################################################################\n\nfrom quex.core_engine.interval_handling import NumberSet, Interval\nimport quex.core_engine.state_machine.sequentialize as sequentialize\nimport quex.core_engine.state_machine.nfa_to_dfa as nfa_to_dfa\nimport quex.core_engine.state_machine.hopcroft_minimization as hopcroft\nimport sys\nfrom copy import deepcopy\n\n\ndef detect_forward(CoreStateMachine, PostConditionStateMachine):\n \"\"\"A 'forward ambiguity' denotes a case where the quex's normal\n post condition implementation fails. This happens if an\n iteration in the core pattern is a valid path in the post-\n condition pattern. In this case no decision can be be where\n to reset the input position.\n\n Example: x+/x At the end of the post condition an incoming\n 'x' guides through a path in the post condition\n and the core pattern. It cannot be determined\n by a flag where the input position ends.\n\n NOTE: For many cases where there is a forward ambiguity quex\n can gnerate an inverse post-condition that goes backwards from \n the end of the post condition (see function 'mount()'). However,\n there are cases where even this is not possible (see function\n 'detect_backward()').\n \"\"\"\n __assert_state_machines(CoreStateMachine, PostConditionStateMachine)\n \n core_acceptance_state_list = CoreStateMachine.get_acceptance_state_list()\n\n pcsm_init_state = PostConditionStateMachine.get_init_state()\n for csm_state in core_acceptance_state_list:\n if __dive_to_detect_iteration(CoreStateMachine, csm_state, \n PostConditionStateMachine, pcsm_init_state):\n return True\n\n return False\n\ndef detect_backward(CoreStateMachine, PostConditionStateMachine):\n\n \"\"\"A 'backward ambiguity' denotes the case where it cannot be clearly be\n determined how far to go back from the end of a post-condition. \n \n NOTE: This does not mean that the post-condition is ambiguous. Many\n cases that are backward ambiguous can be handled by quex's normal\n post-condition handling.\n\n Examples: x/x+ is backward ambiguous because in a stream\n of 'x' one cannot determine with a pure\n state machine where to stop. This case,\n though can be handled by the normal post-\n condition implementation.\n\n x+/x+ is backward ambiguous and cannot be handled\n by the normal implementation. In fact, this\n specification does not allow any conclusions\n about the users intend where to reset the \n input after match.\n \"\"\"\n\n __assert_state_machines(CoreStateMachine, PostConditionStateMachine)\n\n my_post_context_sm = PostConditionStateMachine.clone()\n\n # (*) Create a modified version of the post condition, where the\n # initial state is an acceptance state, and no other. This \n # allows the detector to trigger on 'iteration'.\n #\n # -- delete all acceptance states in the post condition\n # for state in my_post_context_sm.states.values():\n # state.set_acceptance(False)\n # -- set the initial state as acceptance state\n # my_post_context_sm.get_init_state().set_acceptance(True)\n\n my_core_sm = CoreStateMachine.get_inverse()\n my_core_sm = nfa_to_dfa.do(my_core_sm)\n my_core_sm = hopcroft.do(my_core_sm)\n\n tmp = deepcopy(PostConditionStateMachine)\n my_post_context_sm = tmp.get_inverse()\n my_post_context_sm = nfa_to_dfa.do(my_post_context_sm)\n my_post_context_sm = hopcroft.do(my_post_context_sm)\n\n return detect_forward(my_post_context_sm, my_core_sm)\n\ndef __dive_to_detect_iteration(SM0, sm0_state, SM1, sm1_state):\n \"\"\"This function goes along all path of SM0 that lead to an \n acceptance state AND at the same time are valid inside SM1.\n The search starts at the states sm0_state and sm1_state.\n \"\"\"\n\n sm0_transition_list = sm0_state.transitions().get_map().items()\n sm1_transition_list = sm1_state.transitions().get_map().items()\n\n # If there is no subsequent path in SM0 or SM1, \n # then we are at a leaf of the tree search. No\n # path to acceptance in SM0 lies in SM1.\n if sm0_transition_list == [] or sm1_transition_list == []:\n return False\n\n for sm0_target_state_index, sm0_trigger_set in sm0_transition_list:\n for sm1_target_state_index, sm1_trigger_set in sm1_transition_list:\n # If there is no common character in the transition pair, it does not\n # have to be considered.\n if not sm0_trigger_set.has_intersection(sm1_trigger_set):\n continue\n \n # Both trigger on the some same characters.\n # -----------------------[xxxxxxxxxxxxxxxx]-------------\n # -------------[yyyyyyyyyyyyyyyyyyyy]-------------------\n #\n # If the target state in the SM0 is an acceptance state,\n # => A valid path in SM1 leads at the same time to along \n # valid path in SM0.\n sm0_target_state = SM0.states[sm0_target_state_index]\n if sm0_target_state.is_acceptance():\n return True\n \n # If the state is not immediately an acceptance state, then\n # search in the subsequent pathes of the SM0.\n sm1_target_state = SM1.states[sm1_target_state_index]\n if __dive_to_detect_iteration(SM0, sm0_target_state, SM1, sm1_target_state):\n return True\n\n # None of the investigated paths in SM0 and SM1 leads to an\n # acceptance state in SM0. \n return False\n \ndef __get_inverse_state_machine_that_finds_end_of_core_expression(PostConditionSM):\n \"\"\"In case of a pseudo-ambiguous post condition one needs to go backwards\n in order to search for the end of the core condition. This function \n creates the inverse state machine that is able to go backwards.\n\n NOTE: This is a special case, because one already knows that the state\n machine reaches the acceptance state sometime (this is where it actually\n started). That means, that in states other than acceptance states one\n can take out the 'drop out' triggers since they CANNOT occur. This\n enables some speed-up when going backwards.\n \"\"\"\n result = PostConditionSM.get_inverse()\n result = nfa_to_dfa.do(result)\n result = hopcroft.do(result)\n\n # -- delete 'drop-out' transitions in non-acceptance states\n # NOTE: When going backwards one already knows that the acceptance\n # state (the init state of the post condition) is reached, see above.\n for state in result.states.values():\n # -- acceptance states can have 'drop-out' (actually, they need to have)\n if state.is_acceptance(): continue\n\n state.transitions().replace_drop_out_target_states_with_adjacent_targets()\n\n result = nfa_to_dfa.do(result)\n result = hopcroft.do(result)\n\n # Acceptance States need to be marked: Store input position.\n # NOTE: When tracing backwards the match is guaranteed, but there might\n # still be some 'trail' in case of iterations that are not directly\n # iterated to the ambiguous post condition. Thus drop out may\n # happen and it must be clear where to put the input pointer in this case.\n\n return result\n\ndef mount(the_state_machine, PostConditionSM):\n \"\"\"This function mounts a post condition to a state machine with\n a mechanism that is able to handle the pseudo ambigous post-\n condition. Note, that this mechanism can also treat 'normal'\n post-conditions. However, it is slightly less efficient.\n\n core- post- \n -----0000000000000111111111--------------\n\n (1) |-------------------->\n acceptance\n\n (2) <-------|\n reset input position\n\n The first step is performed by 'normal' lexing. The second step\n via the backward detector, which is basically an inverse state\n machine of the post-condition.\n\n NOTE: This function does **not** return a state machine that is\n necessarily deterministic. Run nfa_to_dfa on the result\n of this function.\n\n NOTE: This function is very similar to the function that mounts\n a pre-condition to a state machine. The only major difference\n is that the post condition is actually webbed into the \n state machine for forward lexing. For backward lexing\n a reference is stored that points to the backward detecting\n state machine.\n \"\"\"\n assert the_state_machine.__class__.__name__ == \"StateMachine\"\n assert PostConditionSM.__class__.__name__ == \"StateMachine\"\n # -- state machines with no states are senseless here. \n assert not the_state_machine.is_empty() \n assert not PostConditionSM.is_empty()\n\n # -- trivial pre-conditions should be added last, for simplicity\n # (*) concatinate the two state machines:\n # -- deletes acceptance states of the core pattern\n # -- leaves acceptance states of the post condition\n sequentialize.do([the_state_machine, PostConditionSM], MountToFirstStateMachineF=True)\n\n # (*) get the state machine that can go backwards from the acceptance\n # state of the post condition to the start of the post-condition.\n # The start of the post condition is at the same time the end \n # of the core pattern.\n backward_detector_sm = __get_inverse_state_machine_that_finds_end_of_core_expression(PostConditionSM)\n backward_detector_sm_id = backward_detector_sm.get_id()\n\n # NOTE: We do not need to mark any origins in the backward detector,\n # since it is not concerned with acceptance states. Its only\n # task is to reset the input stream.\n # NOTE: It is not necessary that the state machine directly refers to\n # the backward detector. The origins of the acceptance state will do so.\n acceptance_state_list = the_state_machine.get_acceptance_state_list()\n assert len(acceptance_state_list) != 0, \\\n \"error: mounting pseudo-ambiguous post condition:\\n\" + \\\n \"error: no acceptance state in sequentialized state machine.\"\n\n # (*) Create origin data, in case where there is none yet create new one.\n # (Do not delete, otherwise existing information gets lost.)\n for state in acceptance_state_list: \n state.core().set_post_context_backward_detector_sm_id(backward_detector_sm_id)\n # At the end of the post condition, the input positions needs to be stored. Before\n # we can go backwards, we need to know where the post condition actually ended.\n state.core().set_store_input_position_f(True)\n\n the_state_machine.core().set_post_context_backward_input_position_detector_sm(backward_detector_sm)\n\n\n # We cannot do a NFA to DFA and Hopcroft Optimization, because otherwise we\n # would create a new state machine. This function, though, is considered to \n # 'mount' something on an existing state machine, i.e. change the object\n # that is referenced by the first argument.\n return the_state_machine\n\ndef philosophical_cut(core_sm, post_context_sm):\n \"\"\"The 'philosophical cut' is a technique introduced by Frank-Rene Schaefer\n to produce a pair of a core- and a post-condition that otherwise would \n be forward and backward ambiguous. The philosophical ground for this\n cut is 'greed', i.e. a core pattern should eat as much characters as\n it can. This idea is followed during the whole construction of the lexical\n analyzer. \n \n For the case of total ambiguity 'x+/x+', this idea translates into leaving\n the iteration in the core condition and cutting the iteration in the post\n condition. Thus 'x+/x+' is transformed into 'x+/x' and can be solved by\n the technique for forward ambiguous post conditions.\n \"\"\"\n core_acceptance_state_list = core_sm.get_acceptance_state_list()\n\n pcsm_init_state = post_context_sm.get_init_state()\n for csm_state in core_acceptance_state_list:\n __dive_to_cut_iteration(core_sm, csm_state, post_context_sm, pcsm_init_state,\n SM1_Path=[post_context_sm.init_state_index])\n\n # By means of cutting, some states might have become bold. That is, they have\n # only an epsilon transition. Thus, it is required to do a transformation NFA->DFA\n # and add a hopcroft optimization.\n new_post_sm = nfa_to_dfa.do(post_context_sm)\n new_post_sm = hopcroft.do(new_post_sm)\n return new_post_sm\n\ndef __dive_to_cut_iteration(SM0, sm0_state, SM1, sm1_state, SM1_Path):\n \"\"\"Cut any trigger that allows to trigger out of SM1 that triggers \n back to its initial state while the path is valid in SM0. This\n function serves the 'philosophical cut'.\n \"\"\"\n sm0_transition_list = sm0_state.transitions().get_map().items()\n sm1_transition_list = sm1_state.transitions().get_map().items()\n\n # If there is no subsequent path in SM0 or SM1, then we are at a leaf of\n # the tree search. No path to acceptance in SM0 lies in SM1.\n if sm0_transition_list == [] or sm1_transition_list == []: return \n\n for sm0_target_state_index, sm0_trigger_set in sm0_transition_list:\n for sm1_target_state_index, sm1_trigger_set in sm1_transition_list:\n\n ## print \"##\", intersection.get_utf8_string(), sm1_transition.target_state_index, SM1_Path\n # Both trigger on the some same characters?\n # -----------------------[xxxxxxxxxxxxxxxx]-------------\n # -------------[yyyyyyyyyyyyyyyyyyyy]-------------------\n if not sm0_trigger_set.has_intersection(sm1_trigger_set):\n # If there is no common character in the transition pair, it does not\n # have to be considered.\n continue\n \n elif sm1_target_state_index in SM1_Path:\n # If the trigger set allows the current state to trigger to a state\n # that has already been reached in the path of states, then this\n # is the door to iteration. This 'door' backwards needs to be locked!\n # PREVIOUSLY: intersection = sm0_trigger_set.intersection(sm1_trigger_set)\n sm1_trigger_set.subtract(sm0_trigger_set) # PREVIOUSLY: subtract(intersection)\n sm1_state.transitions().delete_transitions_on_empty_trigger_sets()\n # (Where there is no door, there is no way to dive deeper ...)\n\n else:\n # Lets see to where this path may guide us ...\n sm0_target_state = SM0.states[sm0_target_state_index]\n sm1_target_state = SM1.states[sm1_target_state_index]\n __dive_to_cut_iteration(SM0, sm0_target_state, \n SM1, sm1_target_state,\n SM1_Path + [sm1_target_state_index])\n\n # All branches considered, ... dive up\n return \n\ndef __assert_state_machines(SM0, SM1):\n assert SM0.__class__.__name__ == \"StateMachine\"\n assert SM1.__class__.__name__ == \"StateMachine\"\n\n" }, { "alpha_fraction": 0.6418149471282959, "alphanum_fraction": 0.6424562931060791, "avg_line_length": 28.842105865478516, "blob_id": "d971614ef8c6541d60a879b68e3293ecf250b8b6", "content_id": "f3d2dcf7dfa75378f7ac1d2f0eff21acc170bb55", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 12474, "license_type": "permissive", "max_line_length": 98, "num_lines": 418, "path": "/engine/gfx/gfx_gasoline_type_system.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <cstdlib>\n\n#include <map>\n#include <set>\n#include <string>\n#include <vector>\n\n#include \"gfx_gasoline.h\"\n#include \"gfx_gasoline_parser.h\"\n\n#ifndef GFX_GASOLINE_TYPE_SYSTEM\n#define GFX_GASOLINE_TYPE_SYSTEM\n\nenum GfxGslKind {\n GFX_GSL_VERTEX,\n GFX_GSL_DANGS,\n GFX_GSL_COLOUR_ALPHA,\n GFX_GSL_TONE_MAP,\n GFX_GSL_FOG\n};\n\ntypedef std::vector<GfxGslType*> GfxGslTypes;\n\nstd::ostream &operator<<(std::ostream &o, const GfxGslType *t_);\n\n// Primitives\n\nstruct GfxGslArrayType : public GfxGslType {\n unsigned size;\n GfxGslType *elementType;\n GfxGslArrayType (unsigned size, GfxGslType *element_type)\n : size(size), elementType(element_type)\n { }\n};\n\nstruct GfxGslCoordType : public GfxGslType {\n unsigned dim;\n GfxGslCoordType (unsigned dim) : dim(dim) { }\n};\n\nstruct GfxGslFloatType : public GfxGslCoordType {\n GfxGslFloatType (unsigned dim) : GfxGslCoordType(dim) { }\n};\n\nstruct GfxGslFloatMatrixType : public GfxGslType {\n unsigned w;\n unsigned h;\n GfxGslFloatMatrixType (unsigned w, unsigned h) : w(w), h(h) { }\n};\n\nstruct GfxGslTextureType : public GfxGslType {\n GfxGslFloatVec solid; // This should not be in the type, it should be in the GfxGslContext\n GfxGslTextureType(const GfxGslFloatVec &solid)\n : solid(solid) { }\n};\n\nstruct GfxGslFloatTextureType : public GfxGslTextureType {\n unsigned dim;\n GfxGslFloatTextureType (const GfxGslFloatVec &solid, unsigned dim)\n : GfxGslTextureType(solid), dim(dim)\n { }\n};\n\nstruct GfxGslFloatTextureCubeType : public GfxGslTextureType {\n GfxGslFloatTextureCubeType (const GfxGslFloatVec &solid)\n : GfxGslTextureType(solid)\n { }\n};\n\nstruct GfxGslIntType : public GfxGslCoordType {\n GfxGslIntType (unsigned dim) : GfxGslCoordType(dim) { }\n};\n\nstruct GfxGslBoolType : public GfxGslType {\n GfxGslBoolType (void) { }\n};\n\n\nstruct GfxGslVoidType : public GfxGslType {\n GfxGslVoidType (void) { }\n};\n\n// Engine access types\n\nstruct GfxGslGlobalType : public GfxGslType {\n GfxGslGlobalType (void) { }\n};\n\nstruct GfxGslMatType : public GfxGslType {\n GfxGslMatType (void) { }\n};\n\nstruct GfxGslOutType : public GfxGslType {\n GfxGslOutType (void) { }\n};\n\nstruct GfxGslBodyType : public GfxGslType {\n GfxGslBodyType (void) { }\n};\n\nstruct GfxGslVertType : public GfxGslType {\n GfxGslVertType (void) { }\n};\n\nstruct GfxGslFragType : public GfxGslType {\n GfxGslFragType (void) { }\n};\n\n\nstruct GfxGslFunctionType : public GfxGslType {\n GfxGslTypes params;\n GfxGslType *ret;\n GfxGslFunctionType (const GfxGslTypes &params, GfxGslType *ret) : params(params), ret(ret) { }\n};\n\n\nstruct GfxGslFieldType {\n const GfxGslType *t;\n bool internal;\n bool lighting; // Should this be only available in shaders that do lighting?\n GfxGslFieldType() { }\n GfxGslFieldType(const GfxGslType *t)\n : t(t), internal(false), lighting(false)\n { }\n GfxGslFieldType(const GfxGslType *t, bool internal, bool lighting)\n : t(t), internal(internal), lighting(lighting)\n { }\n};\n\ntypedef std::vector<const GfxGslFunctionType *> GfxGslFunctionTypes;\n\nstruct GfxGslGlobalFuncType {\n GfxGslFunctionTypes ts;\n bool internal;\n bool lighting; // Should this be only available in shaders that do lighting?\n GfxGslGlobalFuncType() { }\n GfxGslGlobalFuncType(const GfxGslFunctionTypes &ts)\n : ts(ts), internal(false), lighting(false)\n { }\n GfxGslGlobalFuncType(const GfxGslFunctionTypes &ts, bool internal, bool lighting)\n : ts(ts), internal(internal), lighting(lighting)\n { }\n};\n\nstatic inline std::ostream &operator << (std::ostream &o, const GfxGslFieldType &ft)\n{\n o << ft.t << (ft.internal ? \" (internal)\" : \"\");\n return o;\n}\n\ntypedef std::map<std::string, GfxGslFieldType> GfxGslFieldTypeMap;\ntypedef std::map<std::string, GfxGslGlobalFuncType> GfxGslGlobalFuncTypeMap;\n\nstruct GfxGslContext {\n GfxGslAllocator &alloc;\n GfxGslGlobalFuncTypeMap funcTypes;\n GfxGslFieldTypeMap globalFields;\n GfxGslFieldTypeMap matFields;\n GfxGslFieldTypeMap bodyFields;\n GfxGslUnboundTextures ubt;\n GfxGslRunParams staticValues;\n\n bool d3d9;\n bool internal;\n bool lightingTextures;\n\n GfxGslFieldType getMatType (const std::string &f) const\n {\n auto it = matFields.find(f);\n if (it == matFields.end()) return GfxGslFieldType();\n return it->second;\n }\n\n GfxGslFieldType getGlobalType (const std::string &f) const\n {\n auto it = globalFields.find(f);\n if (it == globalFields.end()) return GfxGslFieldType();\n return it->second;\n }\n\n GfxGslFieldType getBodyType (const std::string &f) const\n {\n auto it = bodyFields.find(f);\n if (it == bodyFields.end()) return GfxGslFieldType();\n return it->second;\n }\n\n};\n\nstruct GfxGslTrans {\n enum Kind { USER, VERT, INTERNAL };\n Kind kind;\n std::vector<std::string> path;\n const GfxGslType *type; // Of path[0]\n bool operator== (const GfxGslTrans &other) const\n {\n if (kind != other.kind) return false;\n if (path != other.path) return false;\n return true;\n }\n bool operator< (const GfxGslTrans &other) const\n {\n if (kind < other.kind) return true;\n if (kind > other.kind) return false;\n return path < other.path;\n }\n};\n\n// TODO(dcunnin): Disallow explicit & implicit use of ddx/ddy in conditional code.\nclass GfxGslTypeSystem {\n GfxGslContext &ctx;\n\n GfxGslTypeMap outFields;\n GfxGslTypeMap fragFields;\n GfxGslTypeMap vertFields;\n GfxGslDefMap vars;\n\n std::set<std::string> fragFieldsRead;\n std::set<std::string> vertFieldsRead;\n std::set<std::string> globalFieldsRead;\n std::set<std::string> bodyFieldsRead;\n std::set<std::string> matFieldsRead;\n std::set<std::string> outFieldsWritten;\n\n std::set<GfxGslTrans> trans;\n\n GfxGslType *cloneType (const GfxGslType *t_);\n\n void initObjectTypes (GfxGslKind k);\n\n const GfxGslFunctionType *lookupFunction (const GfxGslLocation &loc, const std::string &name,\n GfxGslAsts &asts);\n\n bool isVoid (GfxGslType *x)\n {\n return dynamic_cast<GfxGslVoidType*>(x) != nullptr;\n }\n\n bool isFirstClass (const GfxGslType *x);\n\n bool equal (GfxGslType *a_, GfxGslType *b_);\n\n \n // Can the type be automatically converted\n bool conversionExists (GfxGslType *from_, GfxGslType *to_);\n\n // Wrap from, if necessary, to convert type.\n void doConversion (GfxGslAst *&from, GfxGslType *to_);\n\n void unify (const GfxGslLocation &loc, GfxGslAst *&a, GfxGslAst *&b);\n\n struct Ctx {\n /* read indicates that the object that the expression resolves to (if any) may be read\n * write indicates that the object that the expression resolves to (if any) may be written\n * path is the field path we will read from this object\n */\n const Ctx *parent;\n bool read;\n bool write;\n bool topLevel;\n std::vector<std::string> path;\n GfxGslDefMap *vars;\n Ctx (void)\n : parent(nullptr), read(false), write(false), topLevel(true), vars(nullptr)\n { }\n Ctx setRead (bool v) const\n {\n Ctx c = resetPath();\n c.read = v;\n return c;\n }\n Ctx setWrite (bool v) const\n {\n Ctx c = resetPath();\n c.write = v;\n return c;\n }\n Ctx setTopLevel (bool v)const\n {\n Ctx c = *this;\n c.topLevel = v;\n return c;\n }\n Ctx appendVars (GfxGslDefMap *v)const\n {\n Ctx c = *this;\n c.parent = this;\n c.vars = v;\n c.topLevel = false;\n return c;\n }\n Ctx appendPath (const std::string &v) const\n {\n Ctx c = *this;\n c.path.insert(c.path.begin(), v); // O(path.size())\n return c;\n }\n Ctx resetPath (void) const\n {\n Ctx c = *this;\n c.path.clear();\n return c;\n }\n const GfxGslDef *lookupVar(const std::string &id) const\n {\n if (vars != nullptr) {\n auto it = vars->find(id);\n if (it != vars->end())\n return it->second;\n }\n if (parent != nullptr)\n return parent->lookupVar(id);\n return nullptr;\n }\n };\n\n void addTrans (const GfxGslLocation &loc, const std::vector<std::string> &path,\n const GfxGslType *type, bool vert);\n\n void inferAndSet (GfxGslAst *ast_, const Ctx &c);\n\n public:\n\n const GfxGslKind kind;\n\n GfxGslTypeSystem (GfxGslContext &ctx, GfxGslKind kind)\n : ctx(ctx), kind(kind)\n {\n initObjectTypes(kind);\n }\n\n /** For all nodes in the AST, infer type and set that type within the node.\n *\n * This is the core type inference algorithm.\n */\n void inferAndSet (GfxGslShader *ast, const GfxGslDefMap &outer);\n\n /** Get the variables declared by this shader. */\n const GfxGslDefMap &getVars (void) const { return vars; }\n\n /** Get the vertex fields read by this shader (applies to all shaders). */\n const std::set<std::string> &getVertFieldsRead (void) const { return vertFieldsRead; }\n\n /** Get the fragment fields read by this shader (fragment shader only). */\n const std::set<std::string> &getFragFieldsRead (void) const { return fragFieldsRead; }\n\n /** Get the material fields read by this shader. */\n const std::set<std::string> &getMatFieldsRead (void) const { return matFieldsRead; }\n\n /** Get the global fields read by this shader. */\n const std::set<std::string> &getGlobalFieldsRead (void) const { return globalFieldsRead; }\n\n /** Get the global fields read by this shader. */\n const std::set<std::string> &getBodyFieldsRead (void) const { return bodyFieldsRead; }\n\n /** Get the out fields written by this shader. */\n const std::set<std::string> &getOutFieldsWritten (void) const { return outFieldsWritten; }\n\n /** Get type of a vertex attribute (only ones available to this shader). */\n const GfxGslType *getVertType (const std::string &f) const\n {\n auto it = vertFields.find(f);\n if (it == vertFields.end()) return nullptr;\n return it->second;\n }\n\n /** Get type of a fragment attribute (only ones available to this shader). */\n const GfxGslType *getFragType (const std::string &f) const\n {\n auto it = fragFields.find(f);\n if (it == fragFields.end()) return nullptr;\n return it->second;\n }\n\n /** The values (v.xy paths) that were used in this shader and captured from the one before it.\n */\n const std::set<GfxGslTrans> &getTrans (void) const { return trans; }\n\n /** Same as getTrans() but return a vector instead of a set. */\n std::vector<GfxGslTrans> getTransVector (void) const\n {\n return std::vector<GfxGslTrans>(trans.begin(), trans.end());\n }\n};\n\nstatic inline std::ostream &operator<< (std::ostream &o, const GfxGslTrans &t)\n{\n const char *prefix = \"\";\n if (t.kind == GfxGslTrans::VERT)\n o << \"vert.\";\n for (unsigned i=0 ; i<t.path.size() ; ++i) { \n o << prefix << t.path[i];\n prefix = \".\";\n }\n return o;\n}\n\n#endif\n" }, { "alpha_fraction": 0.652694582939148, "alphanum_fraction": 0.6986027956008911, "avg_line_length": 32.400001525878906, "blob_id": "22f5d59aeda0ae7cefd43b3568ddaedb88abe335", "content_id": "9b1bbdb181b1e796c1a24318195fa7b3e5ba29e8", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Shell", "length_bytes": 501, "license_type": "permissive", "max_line_length": 75, "num_lines": 15, "path": "/copy_executables_to_media.sh", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "#!/bin/bash\n\nif [ ! -d media ] ; then\n echo 'You first need to clone the game directory (media) from SVN:' >&2\n echo 'svn clone https://svn.code.sf.net/p/gritengine/code media' >&2\n exit 1\nfi\n\nSTRIP=\"strip -v --strip-all\"\n\n${STRIP} grit -o media/Grit.linux.x86_64\n${STRIP} gsl -o media/Tools/gsl.linux.x86_64\n${STRIP} extract -o media/Tools/extract.linux.x86_64\n${STRIP} grit_col_conv -o media/Tools/extract.linux.x86_64\n${STRIP} GritXMLConverter -o media/Tools/GritXMLConverter.linux.x86_64\n" }, { "alpha_fraction": 0.6828672289848328, "alphanum_fraction": 0.6869400143623352, "avg_line_length": 31.883928298950195, "blob_id": "93ff69dff331dd2ef679739e4f77d1388da1cbdf", "content_id": "c691ac1eb9b367db22e3c8b06ae04236d57b8bb8", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 7366, "license_type": "permissive", "max_line_length": 101, "num_lines": 224, "path": "/engine/navigation/navigation_manager.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "//\n// Copyright (c) 2009-2010 Mikko Mononen memon@inside.org\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n//\n\n#ifndef NAVIGATIONMANAGER_H\n#define NAVIGATIONMANAGER_H\n#include \"navigation_interfaces.h\"\n#include \"DetourNavMesh.h\"\n#include \"Recast.h\"\n#include \"chunky_tri_mesh.h\"\n\n/// These are just sample areas to use consistent values across the samples.\n/// The use should specify these base on his needs.\nenum SamplePolyAreas\n{\n SAMPLE_POLYAREA_GROUND,\n SAMPLE_POLYAREA_WATER,\n SAMPLE_POLYAREA_ROAD,\n SAMPLE_POLYAREA_DOOR,\n SAMPLE_POLYAREA_GRASS,\n SAMPLE_POLYAREA_JUMP,\n};\nenum SamplePolyFlags\n{\n SAMPLE_POLYFLAGS_WALK = 0x01, // Ability to walk (ground, grass, road)\n SAMPLE_POLYFLAGS_SWIM = 0x02, // Ability to swim (water).\n SAMPLE_POLYFLAGS_DOOR = 0x04, // Ability to move through doors.\n SAMPLE_POLYFLAGS_JUMP = 0x08, // Ability to jump.\n SAMPLE_POLYFLAGS_DISABLED = 0x10, // Disabled polygon\n SAMPLE_POLYFLAGS_ALL = 0xffff // All abilities.\n};\n\nenum SamplePartitionType\n{\n SAMPLE_PARTITION_WATERSHED,\n SAMPLE_PARTITION_MONOTONE,\n SAMPLE_PARTITION_LAYERS,\n};\n\nclass NavigationManager\n{\nprotected:\n class InputGeom* m_geom;\n class dtNavMesh* m_navMesh;\n class dtNavMeshQuery* m_navQuery;\n class dtCrowd* m_crowd;\n\n unsigned char m_navMeshDrawFlags;\n\n float m_cellSize;\n float m_cellHeight;\n float m_agentHeight;\n float m_agentRadius;\n float m_agentMaxClimb;\n float m_agentMaxSlope;\n float m_regionMinSize;\n float m_regionMergeSize;\n float m_edgeMaxLen;\n float m_edgeMaxError;\n float m_vertsPerPoly;\n float m_detailSampleDist;\n float m_detailSampleMaxError;\n int m_partitionType;\n\n BuildContext* m_ctx;\n\n bool m_keepInterResults;\n\n struct LinearAllocator* m_talloc;\n struct FastLZCompressor* m_tcomp;\n struct MeshProcess* m_tmproc;\n\n class dtTileCache* m_tileCache;\n\n float m_cacheBuildTimeMs;\n int m_cacheCompressedSize;\n int m_cacheRawSize;\n int m_cacheLayerCount;\n int m_cacheBuildMemUsage;\n \n enum DrawMode\n {\n DRAWMODE_NAVMESH,\n DRAWMODE_NAVMESH_TRANS,\n DRAWMODE_NAVMESH_BVTREE,\n DRAWMODE_NAVMESH_NODES,\n DRAWMODE_NAVMESH_PORTALS,\n DRAWMODE_NAVMESH_INVIS,\n DRAWMODE_MESH,\n DRAWMODE_CACHE_BOUNDS,\n MAX_DRAWMODE\n };\n \n DrawMode m_drawMode;\n \n int m_maxTiles;\n int m_maxPolysPerTile;\n float m_tileSize;\n \n // convex volumes:\n int m_areaType;\n float m_polyOffset;\n float m_boxHeight;\n float m_boxDescent;\n static const int MAX_PTS = 12;\n float m_pts[MAX_PTS * 3];\n int m_npts;\n int m_hull[MAX_PTS];\n int m_nhull;\npublic:\n NavigationManager();\n ~NavigationManager();\n\n //setters:\n // Rasterization:\n void setCellSize(float val) { m_cellSize = val; };\n void setCellHeight(float val) { m_cellHeight = val; };\n // Agent:\n void setAgentHeight(float val) { m_agentHeight = val; };\n void setAgentRadius(float val) { m_agentRadius = val; };\n void setAgentMaxClimb(float val) { m_agentMaxClimb = val; };\n void setAgentMaxSlope(float val) { m_agentMaxSlope = val; };\n // Region:\n void setRegionMinSize(float val) { m_regionMinSize = val; };\n void setRegionMergeSize(float val) { m_regionMergeSize = val; };\n // Partitioning:\n void setPartitionType(int val) { m_partitionType = val; };\n // Poligonization\n void setEdgeMaxLen(float val) { m_edgeMaxLen = val; };\n void setEdgeMaxError(float val) { m_edgeMaxError = val; };\n void setVertsPerPoly(float val) { m_vertsPerPoly = val; };\n // Detail Mesh\n void setDetailSampleDist(float val) { m_detailSampleDist = val; };\n void setDetailSampleMaxError(float val) { m_detailSampleMaxError = val; };\n void setKeepInterResults(bool val) { m_keepInterResults = val; };\n // Tiling:\n void setTileSize(float val) { m_tileSize = val; };\n\n // getters:\n float getCellSize(void) { return m_cellSize; };\n float getCellHeight(void) { return m_cellHeight; };\n // Agent:\n float getAgentMaxClimb(void) { return m_agentMaxClimb; };\n float getAgentMaxSlope(void) { return m_agentMaxSlope; };\n // Region:\n float getRegionMinSize(void) { return m_regionMinSize; };\n float getRegionMergeSize(void) { return m_regionMergeSize; };\n // Partitioning:\n int getPartitionType(void) { return m_partitionType; };\n // Poligonization\n float getEdgeMaxLen(void) { return m_edgeMaxLen; };\n float getEdgeMaxError(void) { return m_edgeMaxError; };\n float getVertsPerPoly(void) { return m_vertsPerPoly; };\n // Detail Mesh\n float getDetailSampleDist(void) { return m_detailSampleDist; };\n float getDetailSampleMaxError(void) { return m_detailSampleMaxError; };\n bool getKeepInterResults(void) { return m_keepInterResults; };\n // Tiling:\n float getTileSize(void) { return m_tileSize; };\n\n class CrowdTool* m_crowdTool;\n bool load(const char* path);\n void freeNavmesh();\n\n void removeConvexVolume(float* p);\n void createConvexVolume(float* p);\n\n void drawConvexVolume(DebugDrawGL* dd);\n\n dtTileCache* getTileCache(void) { return m_tileCache; };\n\n void updateMaxTiles();\n void render();\n void changeMesh(class InputGeom* geom);\n bool build();\n void update(const float dt);\n\n void getTilePos(const float* pos, int& tx, int& ty);\n \n void renderCachedTile(const int tx, const int ty, const int type);\n void renderCachedTileOverlay(const int tx, const int ty, double* proj, double* model, int* view);\n\n void addTempObstacle(const float* pos);\n void removeTempObstacle(const float* sp, const float* sq);\n void clearAllTempObstacles();\n\n bool saveAll(const char* path);\n bool loadAll(const char* path);\n\n void setContext(BuildContext* ctx) { m_ctx = ctx; }\n\n void step();\n\n class InputGeom* getInputGeom() { return m_geom; }\n class dtNavMesh* getNavMesh() { return m_navMesh; }\n class dtNavMeshQuery* getNavMeshQuery() { return m_navQuery; }\n class dtCrowd* getCrowd() { return m_crowd; }\n float getAgentRadius() { return m_agentRadius; }\n float getAgentHeight() { return m_agentHeight; }\n float getAgentClimb() { return m_agentMaxClimb; }\n const float* getBoundsMin();\n const float* getBoundsMax();\n\n inline unsigned char getNavMeshDrawFlags() const { return m_navMeshDrawFlags; }\n inline void setNavMeshDrawFlags(unsigned char flags) { m_navMeshDrawFlags = flags; }\n\n void resetCommonSettings();\n};\n\n#endif // NAVIGATIONMANAGER_H\n" }, { "alpha_fraction": 0.5896830558776855, "alphanum_fraction": 0.5918745994567871, "avg_line_length": 38.25165557861328, "blob_id": "8bcecd84033a354018b85a2e0520e2effdd94efc", "content_id": "75cb3586c54dcad2ad679280881a17c00ce4b2a4", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 5932, "license_type": "permissive", "max_line_length": 107, "num_lines": 151, "path": "/dependencies/quex-0.34.1/quex/output/graphviz/interface.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "import os\nimport sys\nimport subprocess\nimport tempfile\n\nfrom quex.frs_py.file_in import error_msg\nfrom quex.DEFINITIONS import QUEX_INSTALLATION_DIR\nfrom quex.core_engine.generator.base import GeneratorBase\n\nclass Generator(GeneratorBase):\n def __init__(self, PatternActionPairList, StateMachineName, GraphicFormat):\n assert map(lambda elm: elm.__class__.__name__, PatternActionPairList) \\\n == [ \"PatternActionInfo\" ] * len(PatternActionPairList)\n\n assert_graphviz_installed()\n\n GeneratorBase.__init__(self, PatternActionPairList, StateMachineName)\n\n # -- check if graphics format is supported\n supported_format_list = get_supported_graphic_formats()\n if GraphicFormat not in supported_format_list:\n error_msg(\"Graphic format '%s' not supported.\\n\" % GraphicFormat + \\\n get_supported_graphic_format_description())\n\n self.graphic_format = GraphicFormat\n\n def do(self):\n \"\"\"Prepare output in the 'dot' language, that graphviz uses.\"\"\"\n assert_graphviz_installed()\n\n self.__do(self.sm, self.state_machine_name + \".\" + self.graphic_format)\n\n if self.pre_context_sm != None:\n file_name = \"%s-pre-condition.%s\" % (self.state_machine_name, self.graphic_format)\n self.pre_context_file_name = file_name\n self.__do(self.pre_context_sm, file_name)\n\n if self.papc_backward_detector_state_machine_list != []:\n self.backward_detector_file_name = []\n for sm in self.papc_backward_detector_state_machine_list:\n file_name = \"%s_%i.%s\" % (self.state_machine_name, sm.get_id(), self.graphic_format)\n self.backward_detector_file_name.append(file_name)\n self.__do(sm, file_name)\n\n def __do(self, state_machine, name):\n dot_code = state_machine.get_graphviz_string(NormalizeF=True)\n _call_dot(dot_code, self.graphic_format, name)\n \ndef get_supported_graphic_formats():\n reply_str = _call_dot(\"\", \"?\", \"\", GetStdErrF=True)\n\n list_start_i = reply_str.rfind(\":\")\n if list_start_i == -1 or list_start_i == len(reply_str)-1:\n error_msg(\"Graphviz was asked to report supported graphic formats, but\\n\" + \\\n \"reply was incomprehensible.\")\n\n return reply_str[list_start_i+1:].split()\n\ndef get_supported_graphic_format_description():\n txt = \"SUPPORTED GRAPHIC FORMATS:\\n\"\n i = -1\n for format in get_supported_graphic_formats():\n i += 1\n txt += format + \", \"\n if i > 10: txt += \"\\n\"; i = -1\n \n return txt[:-2] + \".\"\n\ndef _call_dot(Code, OutputFormat, OutputFile, GetStdErrF=False):\n # (*) initiate call to the graphviz utility ('dot') and use a sample file\n # for reference.\n # try:\n fd, input_file_name = tempfile.mkstemp(\".quex.dot\", \"TMP\")\n fh = os.fdopen(fd, \"w\")\n fh.write(Code)\n fh.close()\n\n fd_err, error_file = tempfile.mkstemp(\".quex.err\", \"TMP\")\n fd_out, out_file = tempfile.mkstemp(\".quex.out\", \"TMP\")\n fh_err = os.fdopen(fd_err, \"w\")\n fh_out = os.fdopen(fd_out, \"w\")\n\n # except:\n # error_msg(\"File access error while preparing graphviz code.\")\n\n try: \n if OutputFile != \"\": output_str = \"-o%s\" % OutputFile \n else: output_str = \"\"\n subprocess.call([\"dot\", input_file_name, \"-T%s\" % OutputFormat, output_str],\n stdout=fh_out, stderr=fh_err)\n except: \n error_msg(\"Graphviz seems not to be installed on this system. Please, visit www.graphviz.org\\n\" + \\\n \"and download the package. This package is necessary for for plotting\\n\" + \\\n \"transition graphs.\")\n\n fh_out.close()\n fh_err.close()\n\n result = None\n if GetStdErrF:\n try: result = open(error_file).read()\n except: error_msg(\"Output of graphviz is unaccessible.\")\n\n os.remove(input_file_name) # Note: that is the temp-file that was 'charged' with the input\n os.remove(error_file)\n os.remove(out_file)\n\n return result\n\ndef assert_graphviz_installed():\n \"\"\"This function checks whether the graphviz utility has been installed.\"\"\"\n\n # A 'break' out of this loops ends up in an error message (see below).\n while 1 + 1 == 2:\n\n # -- create temporary files (maybe the output comes on 'stderr')\n try: \n fd_out, out_file = tempfile.mkstemp(\".quex.out\", \"TMP\")\n fh_out = os.fdopen(fd_out, \"w\")\n fd_err, err_file = tempfile.mkstemp(\".quex.err\", \"TMP\")\n fh_err = os.fdopen(fd_err, \"w\")\n except:\n error_msg(\"Could not create temporary files on system '%s'.\" % sys.platform)\n \n # -- try to call 'dot' in order to get version information\n try:\n subprocess.call([\"dot\", \"-V\"], stdout=fh_out, stderr=fh_err)\n fh_out.close()\n except: \n error_msg(\"Graphviz not installed or not in PATH of system '%s'.\" % sys.platform)\n\n # -- read the written content\n try: \n fh = open(out_file); content = fh.read(); fh.close(); os.remove(out_file)\n fh = open(err_file); content += fh.read(); fh.close(); os.remove(err_file)\n except:\n error_msg(\"Could not read temporary file on system '%s'.\" % sys.platform)\n\n # -- check wether all expected strings appear propperly\n def nf(Str): # nf -- not found\n return content.find(Str) == -1\n\n if nf(\"dot\") and nf(\"Dot\") and nf(\"DOT\") \\\n or nf(\"Graphviz\") and nf(\"GRAPHVIZ\") and nf(\"GraphViz\") and nf(\"graphviz\") \\\n or nf(\"version\") and nf(\"Version\") and nf(\" V\"):\n break\n\n return # Oll Korrekt\n\n error_msg(\"Graphviz is not installed or does not work propperly.\\n\" + \\\n \"Please, visit http://www.graphviz.org to download the software.\")\n\n \n" }, { "alpha_fraction": 0.5768619179725647, "alphanum_fraction": 0.586117148399353, "avg_line_length": 25.494253158569336, "blob_id": "8a9ad5c34a00debe7f6f2fecf9fd3da85cbfbec7", "content_id": "d2d2f8acebd5a73e8d754799e2960dd3fbaa20ce", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 6915, "license_type": "permissive", "max_line_length": 81, "num_lines": 261, "path": "/engine/cache_friendly_range_space_simd.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\ntemplate <typename T> class CacheFriendlyRangeSpaceSIMD;\n\n#ifndef CACHEFRIENDLYRANGESPACESIMD_H\n#define CACHEFRIENDLYRANGESPACESIMD_H\n\n#include <map>\n#include <vector>\n#include <iostream>\n#include <algorithm>\n#include <cmath>\n\n#ifdef WIN32\n#include <xmmintrin.h>\n#endif\n\n#include <centralised_log.h>\n\n#include \"sse_allocator.h\"\n\nclass SIMDVector4 {\n\n protected:\n\n union U {\n struct Raw {\n float x, y, z, d;\n } raw;\n #ifdef WIN32\n __m128 simd;\n #else\n float simd __attribute__ ((vector_size (16)));\n #endif\n };\n\n\n public:\n\n inline void updateAll (float x, float y, float z, float d)\n {\n u.raw.x = x;\n u.raw.y = y;\n u.raw.z = z;\n u.raw.d = d;\n }\n\n inline float x(void) const { return u.raw.x; }\n inline float y(void) const { return u.raw.y; }\n inline float z(void) const { return u.raw.z; }\n inline float d(void) const { return u.raw.d; }\n\n SIMDVector4 operator- (const SIMDVector4 &b) const\n {\n SIMDVector4 r;\n #ifdef WIN32\n r.u.simd = _mm_sub_ps(u.simd, b.u.simd);\n #else\n r.u.simd = u.simd - b.u.simd;\n #endif\n return r;\n }\n\n SIMDVector4 operator* (const SIMDVector4 &b) const\n {\n SIMDVector4 r;\n #ifdef WIN32\n r.u.simd = _mm_mul_ps(u.simd, b.u.simd);\n #else\n r.u.simd = u.simd * b.u.simd;\n #endif\n return r;\n }\n SIMDVector4 &operator*= (SIMDVector4 &b)\n {\n *this = *this * b;\n return *this;\n }\n\n protected:\n\n U u;\n};\n\n// msvc needs a horrible wrapper class because it can't handle aligned parameters\n// thus operations like resize() and push_back() cause compile errors\n#ifdef WIN32\nclass SIMDVector4s {\n\n public:\n\n struct Stupid { float x, y, z, d; };\n typedef std::vector<Stupid,SSEAllocator<Stupid> > Wrapped;\n typedef Wrapped::size_type size_type;\n\n void pop_back (void) { wrapped.pop_back(); }\n\n void push_back (const SIMDVector4 &v)\n { wrapped.push_back(reinterpret_cast<const Stupid&>(v)); }\n\n void clear (void) { wrapped.clear(); }\n\n SIMDVector4 &operator[] (size_type index)\n { return reinterpret_cast<SIMDVector4&>(wrapped[index]); }\n\n const SIMDVector4 &operator[] (size_type index) const\n { return reinterpret_cast<const SIMDVector4&>(wrapped[index]); }\n\n Wrapped::size_type size (void) const { return wrapped.size(); }\n\n void reserve (size_t s) { wrapped.reserve(s); }\n\n\n protected:\n Wrapped wrapped;\n};\n#else\ntypedef std::vector<SIMDVector4,SSEAllocator<SIMDVector4> > SIMDVector4s;\n#endif\n\ntemplate <typename T>\nclass CacheFriendlyRangeSpace {\n\n public:\n\n typedef std::vector<T> Cargo;\n\n CacheFriendlyRangeSpace (void) : hence(0) { }\n\n ~CacheFriendlyRangeSpace (void) { }\n\n void reserve (size_t s)\n {\n cargo.reserve(s);\n positions.reserve(s);\n }\n\n void add (const T &o)\n {\n typename Cargo::iterator begin = cargo.begin(),\n end = cargo.end();\n // if it's already in there, this is a no-op\n if (find(begin,end,o) != end) return;\n \n size_t index = cargo.size();\n cargo.push_back(o);\n positions.push_back(SIMDVector4());\n o->updateIndex(index);\n }\n\n inline void updateSphere (size_t index, float x, float y, float z, float d)\n {\n positions[index].updateAll(x,y,z,d);\n }\n\n // only meaningful if the radius is stored in pos.d and\n // other.d is 0, thus the subtraction and squaring\n // yields d^2\n static inline bool isNear (const SIMDVector4 &pos,\n const SIMDVector4 &centre,\n const float factor2)\n {\n SIMDVector4 diff;\n diff = pos - centre;\n diff *= diff;\n return diff.x() + diff.y() + diff.z()\n < diff.d() * factor2;\n }\n\n void getPresent (const float x,\n const float y,\n const float z,\n size_t num,\n const float factor,\n Cargo &found)\n {\n if (num == 0) return;\n if (cargo.size() == 0) return;\n if (num>cargo.size()) num=cargo.size();\n if (hence>=cargo.size()) hence = 0;\n\n // iterate from this point for a while\n SIMDVector4s::size_type iter = hence, end = positions.size(); \n\n if (num>positions.size()) {\n iter = 0;\n num = positions.size();\n }\n\n SIMDVector4 home;\n float factor2 = factor*factor;\n home.updateAll(x,y,z,0);\n for (SIMDVector4s::size_type i=0 ; i<num ; ++i) {\n SIMDVector4 &pos = positions[iter];\n if (isNear(home,pos,factor2)) {\n found.push_back(cargo[iter]);\n }\n iter++;\n if (iter == end) iter=0;\n }\n\n hence = iter;\n }\n\n void remove (const T &o)\n {\n typename Cargo::iterator begin = cargo.begin(),\n end = cargo.end();\n typename Cargo::iterator iter = find(begin,end,o);\n\n // no-op if o was not in the rangespace somewhere\n if (iter == end) return;\n\n // otherwise, carefully remove it -\n size_t index = iter - begin;\n\n positions[index] = positions[positions.size()-1];\n positions.pop_back();\n cargo[index] = cargo[cargo.size()-1];\n cargo[index]->updateIndex(index);\n cargo.pop_back();\n o->updateIndex(-1);\n }\n\n void clear (void)\n {\n cargo.clear();\n positions.clear();\n hence = 0;\n }\n\n size_t size (void) const { return cargo.size(); }\n\n\n protected:\n\n size_t hence;\n SIMDVector4s positions;\n Cargo cargo;\n};\n\n#endif\n" }, { "alpha_fraction": 0.509040355682373, "alphanum_fraction": 0.511821985244751, "avg_line_length": 20.058822631835938, "blob_id": "4b22c8ca76027ece39e0fda6517ab6bc9c0583d6", "content_id": "39a4ee075e173bf7eaa78eb32861a16cfbca3029", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 719, "license_type": "permissive", "max_line_length": 67, "num_lines": 34, "path": "/dependencies/quex-0.34.1/demo/000/simple.qx", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "// -*- C++ -*-\nheader {\n#include <cstdlib> // for: atoi()\n}\n\ntoken {\n IDENTIFIER\n STRUCT\n TYPE_INT\n TYPE_DOUBLE\n SEND\n EXPECT\n SEMICOLON\n BRACKET_OPEN\n BRACKET_CLOSE\n NUMBER\n}\n\nmode ONE_AND_ONLY\n{\n <<EOF>> => QUEX_TKN_TERMINATION;\n\n [ \\t\\r\\n]+ { }\n \"struct\" => QUEX_TKN_STRUCT;\n \"int\" => QUEX_TKN_TYPE_INT;\n \"double\" => QUEX_TKN_TYPE_DOUBLE;\n \"send\" => QUEX_TKN_SEND;\n \"expect\" => QUEX_TKN_EXPECT;\n \";\" => QUEX_TKN_SEMICOLON;\n \"{\" => QUEX_TKN_BRACKET_OPEN;\n \"}\" => QUEX_TKN_BRACKET_CLOSE;\n [0-9]+ => QUEX_TKN_NUMBER(atoi((char*)Lexeme));\n [_a-zA-Z]+ { self.send(QUEX_TKN_IDENTIFIER, Lexeme); RETURN; }\n}\n\n\n\n" }, { "alpha_fraction": 0.5624151825904846, "alphanum_fraction": 0.5671641826629639, "avg_line_length": 40.79206085205078, "blob_id": "d95d8e2d1d5316240d995906abc11e083759dd8f", "content_id": "71da115f537c4d66e957498791f7698f18c9134b", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 22110, "license_type": "permissive", "max_line_length": 124, "num_lines": 529, "path": "/dependencies/quex-0.34.1/quex/code_base/buffer/Buffer.i", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* -*- C++ -*- vim: set syntax=cpp: */\n#ifndef __INCLUDE_GUARD_QUEX__CODE_BASE__BUFFER__BUFFER_CORE_I__\n#define __INCLUDE_GUARD_QUEX__CODE_BASE__BUFFER__BUFFER_CORE_I__\n\n#include <quex/code_base/asserts>\n#include <quex/code_base/definitions>\n#include <quex/code_base/buffer/Buffer>\n#include <quex/code_base/buffer/plain/BufferFiller_Plain>\n#ifdef QUEX_OPTION_ENABLE_ICONV\n# include <quex/code_base/buffer/iconv/BufferFiller_IConv>\n#endif\n#include <quex/code_base/MemoryManager>\n\n#include <quex/code_base/temporary_macros_on>\n\n#if ! defined(__QUEX_SETTING_PLAIN_C)\nnamespace quex { \n#endif\n\n QUEX_INLINE void QuexBuffer_init(QuexBuffer* me); \n QUEX_INLINE void QuexBufferMemory_init(QuexBufferMemory* me, \n QUEX_CHARACTER_TYPE* memory, size_t Size);\n\n TEMPLATE_IN(InputHandleT) void\n QuexBuffer_construct(QuexBuffer* me, InputHandleT* input_handle,\n QuexBufferFillerTypeEnum FillerType, const char* IANA_InputCodingName, \n const size_t BufferMemorySize,\n const size_t TranslationBufferMemorySize)\n /* input_handle == 0x0 means that there is no stream/file to read from. Instead, the \n * user intends to perform the lexical analysis directly on plain\n * memory. In this case, the user needs to call the following function\n * by hand in order to setup the memory:\n *\n * QuexBufferMemory_init(buffer->_memory, (uint8_t*)MyMemoryP, MyMemorySize); \n */\n {\n QuexBufferFiller* buffer_filler = 0x0;\n QuexBufferFillerTypeEnum filler_type = FillerType;\n\n if( input_handle != 0x0 ) {\n if( filler_type == QUEX_AUTO ) {\n if( IANA_InputCodingName == 0x0 ) filler_type = QUEX_PLAIN;\n else filler_type = QUEX_ICONV;\n }\n switch( filler_type ) {\n case QUEX_AUTO:\n QUEX_ERROR_EXIT(\"Cannot instantiate BufferFiller of type QUEX_AUTO.\\n\");\n\n case QUEX_PLAIN: \n buffer_filler = MemoryManager_get_BufferFiller(filler_type);\n QuexBufferFiller_Plain_init((TEMPLATED(QuexBufferFiller_Plain)*)buffer_filler, input_handle);\n break;\n\n case QUEX_ICONV: \n# ifdef QUEX_OPTION_ENABLE_ICONV\n buffer_filler = MemoryManager_get_BufferFiller(filler_type);\n QuexBufferFiller_IConv_init((TEMPLATED(QuexBufferFiller_IConv)*)buffer_filler, input_handle, \n IANA_InputCodingName, /* Internal Coding: Default */0x0,\n TranslationBufferMemorySize);\n# else\n QUEX_ERROR_EXIT(\"Use of buffer filler type 'QUEX_ICONV' while option 'QUEX_OPTION_ENABLE_ICONV'\\n\" \\\n \"is not specified. If defined, then the iconv-library must be installed on your system!\\n\");\n# endif\n break;\n }\n /* If filler == 0x0, then user wants to operate on plain memory, he has to call\n * QuexBufferMemory_init(...) by hand later. */\n me->filler = buffer_filler;\n QuexBufferMemory_init(&(me->_memory), MemoryManager_get_BufferMemory(BufferMemorySize), BufferMemorySize); \n\n } else { \n me->filler = 0x0;\n QuexBufferMemory_init(&(me->_memory), 0, 0); \n } \n QuexBuffer_init(me);\n \n QUEX_BUFFER_ASSERT_CONSISTENCY(me);\n QUEX_BUFFER_ASSERT_CONTENT_CONSISTENCY(me);\n }\n\n QUEX_INLINE void\n QuexBuffer_destruct(QuexBuffer* me)\n {\n if( me->filler != 0x0 ) {\n me->filler->_destroy(me->filler);\n }\n MemoryManager_free_BufferMemory(me->_memory._front);\n }\n\n QUEX_INLINE void\n QuexBuffer_init(QuexBuffer* me)\n {\n me->_input_p = me->_memory._front + 1; /* First State does not increment */\n me->_lexeme_start_p = me->_memory._front + 1; /* Thus, set it on your own. */\n /* NOTE: The terminating zero is stored in the first character **after** the \n * lexeme (matching character sequence). The begin of line pre-condition \n * is concerned with the last character in the lexeme, which is the one \n * before the 'char_covered_by_terminating_zero'.*/\n me->_end_of_file_p = 0x0;\n me->_character_at_lexeme_start = '\\0'; /* (0 means: no character covered)*/\n me->_content_first_character_index = 0;\n# ifdef __QUEX_OPTION_SUPPORT_BEGIN_OF_LINE_PRE_CONDITION\n me->_character_before_lexeme_start = '\\n'; /* --> begin of line*/\n# endif\n\n if( me->filler != 0x0 ) {\n /* If a real buffer filler is specified, then fill the memory. Otherwise, one \n * assumes, that the user fills/has filled it with whatever his little heart desired. */\n QuexBufferFiller_initial_load(me);\n }\n\n QUEX_BUFFER_ASSERT_CONSISTENCY(me);\n QUEX_BUFFER_ASSERT_CONTENT_CONSISTENCY(me);\n }\n\n QUEX_INLINE void\n QuexBuffer_reset(QuexBuffer* me)\n {\n me->_input_p = me->_memory._front + 1; /* First State does not increment */\n me->_lexeme_start_p = me->_memory._front + 1; /* Thus, set it on your own. */\n /* NOTE: The terminating zero is stored in the first character **after** the \n * lexeme (matching character sequence). The begin of line pre-condition \n * is concerned with the last character in the lexeme, which is the one \n * before the 'char_covered_by_terminating_zero'. */\n me->_character_at_lexeme_start = '\\0'; /* (0 means: no character covered) */\n# ifdef __QUEX_OPTION_SUPPORT_BEGIN_OF_LINE_PRE_CONDITION\n me->_character_before_lexeme_start = '\\n'; /* --> begin of line*/\n# endif\n\n if( me->_content_first_character_index != 0 ) {\n __quex_assert(me->filler != 0x0);\n me->filler->seek_character_index(me->filler, 0);\n me->_content_first_character_index = 0;\n QuexBufferFiller_initial_load(me);\n }\n\n QUEX_BUFFER_ASSERT_CONSISTENCY(me);\n QUEX_BUFFER_ASSERT_CONTENT_CONSISTENCY(me);\n }\n\n QUEX_INLINE void\n QuexBuffer_setup_memory(QuexBuffer* me, QUEX_CHARACTER_TYPE* UserMemory, const size_t UserMemorySize)\n {\n /* This function initializes lexical analysis on user specified memory chunk. \n * Use this function, if no buffer filling shall be used and the analyser runs\n * solely on a given chunk of memory. */\n QuexBufferMemory_init(&me->_memory, UserMemory, UserMemorySize); \n me->_input_p = me->_memory._front + 1; /* First State does not increment */\n me->_lexeme_start_p = me->_memory._front + 1; /* Thus, set it on your own. */\n me->_end_of_file_p = 0x0;\n\n QUEX_BUFFER_ASSERT_CONSISTENCY(me);\n QUEX_BUFFER_ASSERT_CONTENT_CONSISTENCY(me);\n }\n\n QUEX_INLINE void\n QuexBuffer_input_p_add_offset(QuexBuffer* buffer, const size_t Offset)\n { \n QUEX_BUFFER_ASSERT_CONSISTENCY_LIGHT(buffer);\n buffer->_input_p += Offset; \n QUEX_BUFFER_ASSERT_CONSISTENCY_LIGHT(buffer);\n }\n\n QUEX_INLINE void\n QuexBuffer_input_p_increment(QuexBuffer* buffer)\n { \n ++(buffer->_input_p); \n }\n\n QUEX_INLINE void\n QuexBuffer_input_p_decrement(QuexBuffer* buffer)\n { \n --(buffer->_input_p); \n }\n\n QUEX_INLINE void\n QuexBuffer_mark_lexeme_start(QuexBuffer* buffer)\n { \n buffer->_lexeme_start_p = buffer->_input_p; \n }\n\n QUEX_INLINE void\n QuexBuffer_seek_lexeme_start(QuexBuffer* buffer)\n { \n buffer->_input_p = buffer->_lexeme_start_p;\n }\n\n QUEX_INLINE QUEX_CHARACTER_POSITION_TYPE\n QuexBuffer_tell_memory_adr(QuexBuffer* buffer)\n {\n /* NOTE: We cannot check for general consistency here, because this function \n * may be used by the range skippers, and they write possibly something on\n * the end of file pointer, that is different from the buffer limit code.\n * NOT: QUEX_BUFFER_ASSERT_CONSISTENCY(buffer); */\n QUEX_DEBUG_PRINT2(buffer, \"TELL: %i\", (int)buffer->_input_p);\n# if defined (QUEX_OPTION_ASSERTS) \\\n && ! defined(__QUEX_SETTING_PLAIN_C)\n return QUEX_CHARACTER_POSITION_TYPE(buffer->_input_p, buffer->_content_first_character_index);\n# else\n return (QUEX_CHARACTER_POSITION_TYPE)(buffer->_input_p);\n# endif\n }\n\n QUEX_INLINE void\n QuexBuffer_seek_memory_adr(QuexBuffer* buffer, QUEX_CHARACTER_POSITION_TYPE Position)\n {\n# if defined (QUEX_OPTION_ASSERTS) \\\n && ! defined(__QUEX_SETTING_PLAIN_C)\n /* Check wether the memory_position is relative to the current start position \n * of the stream. That means, that the tell_adr() command was called on the \n * same buffer setting or the positions have been adapted using the += operator.*/\n __quex_assert(Position.buffer_start_position == buffer->_content_first_character_index);\n buffer->_input_p = Position.address;\n# else\n buffer->_input_p = Position;\n# endif\n QUEX_BUFFER_ASSERT_CONSISTENCY(buffer);\n }\n\n QUEX_INLINE QUEX_CHARACTER_TYPE\n QuexBuffer_input_get(QuexBuffer* me)\n {\n QUEX_DEBUG_PRINT_INPUT(me, *(me->_input_p));\n QUEX_BUFFER_ASSERT_CONSISTENCY_LIGHT(me);\n# ifdef QUEX_OPTION_ASSERTS\n if( *me->_input_p == QUEX_SETTING_BUFFER_LIMIT_CODE )\n __quex_assert( me->_input_p == me->_end_of_file_p \n || me->_input_p == me->_memory._back || me->_input_p == me->_memory._front);\n# endif\n return *(me->_input_p); \n }\n\n QUEX_INLINE QUEX_CHARACTER_TYPE\n QuexBuffer_input_get_offset(QuexBuffer* me, const size_t Offset)\n {\n QUEX_BUFFER_ASSERT_CONSISTENCY_LIGHT(me);\n __quex_assert( me->_input_p + Offset > me->_memory._front );\n __quex_assert( me->_input_p + Offset <= me->_memory._back );\n return *(me->_input_p + Offset); \n }\n\n QUEX_INLINE void\n QuexBuffer_store_last_character_of_lexeme_for_next_run(QuexBuffer* me)\n { \n# ifdef __QUEX_OPTION_SUPPORT_BEGIN_OF_LINE_PRE_CONDITION\n me->_character_before_lexeme_start = *(me->_input_p - 1); \n# endif\n } \n\n QUEX_INLINE void\n QuexBuffer_set_terminating_zero_for_lexeme(QuexBuffer* me)\n { \n me->_character_at_lexeme_start = *(me->_input_p); \n *(me->_input_p) = '\\0';\n }\n\n QUEX_INLINE void\n QuexBuffer_undo_terminating_zero_for_lexeme(QuexBuffer* me)\n {\n /* only need to reset, in case that the terminating zero was set*/\n if( me->_character_at_lexeme_start != (QUEX_CHARACTER_TYPE)'\\0' ) { \n *(me->_input_p) = me->_character_at_lexeme_start; \n me->_character_at_lexeme_start = (QUEX_CHARACTER_TYPE)'\\0'; \n }\n }\n\n QUEX_INLINE QUEX_CHARACTER_TYPE*\n QuexBuffer_content_front(QuexBuffer* me)\n {\n return me->_memory._front + 1;\n }\n\n QUEX_INLINE QUEX_CHARACTER_TYPE*\n QuexBuffer_content_back(QuexBuffer* me)\n {\n return me->_memory._back - 1;\n }\n\n QUEX_INLINE size_t\n QuexBuffer_content_size(QuexBuffer* me)\n {\n return QuexBufferMemory_size(&(me->_memory)) - 2;\n }\n\n QUEX_INLINE QUEX_CHARACTER_TYPE* \n QuexBuffer_text_end(QuexBuffer* me)\n {\n /* Returns a pointer to the position after the last text content inside the buffer. */\n if( me->_end_of_file_p != 0 ) return me->_end_of_file_p;\n else return me->_memory._back; \n }\n\n QUEX_INLINE size_t\n QuexBuffer_distance_input_to_text_end(QuexBuffer* me)\n {\n QUEX_BUFFER_ASSERT_CONSISTENCY_LIGHT(me);\n return QuexBuffer_text_end(me) - me->_input_p;\n }\n\n QUEX_INLINE void\n QuexBuffer_end_of_file_set(QuexBuffer* me, QUEX_CHARACTER_TYPE* Position)\n {\n /* NOTE: The content starts at _front[1], since _front[0] contains \n * the buffer limit code. */\n me->_end_of_file_p = Position;\n *(me->_end_of_file_p) = QUEX_SETTING_BUFFER_LIMIT_CODE;\n\n /* Not yet: QUEX_BUFFER_ASSERT_CONSISTENCY(me) -- pointers may still have to be adapted. */\n }\n\n QUEX_INLINE void\n QuexBuffer_end_of_file_unset(QuexBuffer* buffer)\n {\n /* If the end of file pointer is to be 'unset' me must assume that the storage as been\n * overidden with something useful. Avoid setting _end_of_file_p = 0x0 while the \n * position pointed to still contains the buffer limit code. */\n buffer->_end_of_file_p = 0x0;\n /* Not yet: QUEX_BUFFER_ASSERT_CONSISTENCY(me) -- pointers may still have to be adapted. */\n }\n\n QUEX_INLINE bool \n QuexBuffer_is_end_of_file(QuexBuffer* buffer)\n { \n QUEX_BUFFER_ASSERT_CONSISTENCY(buffer);\n return buffer->_input_p == buffer->_end_of_file_p;\n }\n\n QUEX_INLINE bool \n QuexBuffer_is_begin_of_file(QuexBuffer* buffer)\n { \n QUEX_BUFFER_ASSERT_CONSISTENCY(buffer);\n if ( buffer->_input_p != buffer->_memory._front ) return false;\n else if( buffer->_content_first_character_index != 0 ) return false;\n return true;\n }\n\n QUEX_INLINE void \n QuexBuffer_move_forward(QuexBuffer* me, const size_t CharacterN)\n {\n QUEX_BUFFER_ASSERT_CONSISTENCY(me);\n /* Why: __quex_assert(QUEX_SETTING_BUFFER_MIN_FALLBACK_N >= 1); ? fschaef 08y11m1d> */\n\n if( CharacterN < QuexBuffer_distance_input_to_text_end(me) ) {\n /* _input_p + CharacterN < text_end, thus no reload necessary. */\n me->_input_p += CharacterN;\n }\n else {\n /* _input_p + CharacterN >= text_end, thus we need to reload. */\n if( me->filler == 0x0 || me->_end_of_file_p != 0x0 ) {\n me->_input_p = QuexBuffer_text_end(me); /* No reload possible */\n } else {\n /* Reload until delta is reachable inside buffer. */\n int delta = (int)CharacterN; \n int distance = QuexBuffer_distance_input_to_text_end(me);\n do {\n delta -= distance;\n\n me->_input_p = me->_memory._back; /* Prepare reload forward. */\n me->_lexeme_start_p = me->_input_p;\n if( QuexBufferFiller_load_forward(me) == 0 ) {\n me->_input_p = QuexBuffer_text_end(me); /* No reload possible */\n break;\n } \n /* After loading forward, we need to increment ... the way the game is to be played. */\n ++(me->_input_p);\n distance = QuexBuffer_distance_input_to_text_end(me);\n\n if( delta < distance ) {\n /* _input_p + delta < text_end, thus no further reload necessary. */\n me->_input_p += delta;\n break;\n }\n } while( 1 + 1 == 2 );\n }\n }\n me->_lexeme_start_p = me->_input_p;\n me->_character_at_lexeme_start = *(me->_lexeme_start_p);\n# ifdef __QUEX_OPTION_SUPPORT_BEGIN_OF_LINE_PRE_CONDITION\n me->_character_before_lexeme_start = *(me->_lexeme_start_p - 1);\n# endif\n\n QUEX_BUFFER_ASSERT_CONSISTENCY(me);\n }\n \n QUEX_INLINE void \n QuexBuffer_move_backward(QuexBuffer* me, const size_t CharacterN)\n {\n QUEX_BUFFER_ASSERT_CONSISTENCY(me);\n\n /* When going backward, anyway a non-zero width distance is left ahead. */\n if( CharacterN < (size_t)(me->_input_p - QuexBuffer_content_front(me)) ) {\n /* _input_p - CharacterN < content_front, thus no reload necessary. */\n me->_input_p -= CharacterN;\n }\n else {\n /* _input_p - CharacterN < _front + 1 >= text_end, thus we need to reload. */\n if( me->filler == 0x0 || me->_content_first_character_index == 0 ) { \n me->_input_p = QuexBuffer_content_front(me);\n } else {\n /* Reload until delta is reachable inside buffer. */\n int delta = (int)CharacterN; \n int distance = me->_input_p - QuexBuffer_content_front(me);\n do {\n delta -= distance;\n\n me->_input_p = me->_memory._front; /* Prepare reload backward. */\n me->_lexeme_start_p = me->_input_p + 1;\n if( QuexBufferFiller_load_backward(me) == 0 ) {\n me->_input_p = QuexBuffer_content_front(me); /* No reload possible */\n break;\n } \n /* After loading forward, we need **not** to increment ... the way the game is to be played. */\n distance = me->_input_p - QuexBuffer_content_front(me);\n\n if( delta < distance ) {\n /* _input_p + delta < text_end, thus no further reload necessary. */\n me->_input_p -= delta;\n break;\n }\n } while( 1 + 1 == 2 );\n }\n }\n me->_lexeme_start_p = me->_input_p;\n me->_character_at_lexeme_start = *(me->_lexeme_start_p);\n# ifdef __QUEX_OPTION_SUPPORT_BEGIN_OF_LINE_PRE_CONDITION\n me->_character_before_lexeme_start = *(me->_lexeme_start_p - 1);\n# endif\n\n QUEX_BUFFER_ASSERT_CONSISTENCY(me);\n }\n\n\n QUEX_INLINE size_t \n QuexBuffer_tell(QuexBuffer* me)\n {\n /* This function returns the character index that corresponds to the \n * current setting of the input pointer. Note, that the content starts\n * at one position after the memory (buffer limitting char at _front.). \n */\n const size_t DeltaToBufferBegin = me->_input_p - me->_memory._front - 1;\n /* Adding the current offset of the content of the buffer in the stream. \n * If there is no filler, there is no stream, then there is also no offset. */\n if( me->filler == 0x0 ) \n return DeltaToBufferBegin;\n else\n return DeltaToBufferBegin + me->_content_first_character_index;\n }\n\n QUEX_INLINE void \n QuexBuffer_seek(QuexBuffer* me, const size_t CharacterIndex)\n {\n /* This function sets the _input_p according to a character index of the\n * input stream (if there is a stream). It is the inverse of 'tell()'. */\n const size_t CurrentCharacterIndex = QuexBuffer_tell(me);\n if( CharacterIndex > CurrentCharacterIndex )\n QuexBuffer_move_forward(me, CharacterIndex - CurrentCharacterIndex);\n else\n QuexBuffer_move_backward(me, CurrentCharacterIndex - CharacterIndex);\n }\n\n QUEX_INLINE void \n QuexBufferMemory_init(QuexBufferMemory* me, \n QUEX_CHARACTER_TYPE* memory, size_t Size) \n {\n /* The buffer memory can be initially be set to '0x0' if no buffer filler\n * is specified. Then the user has to call this function on his own in order\n * to specify the memory on which to rumble. */\n __quex_assert((Size != 0) || (memory == 0x0)); \n\n if( Size == 0 ) { \n me->_front = me->_back = 0;\n return;\n }\n /* Min(Size) = 2 characters for buffer limit code (front and back) + at least\n * one character to be read in forward direction. */\n __quex_assert(Size > QUEX_SETTING_BUFFER_MIN_FALLBACK_N + 2);\n me->_front = memory;\n me->_back = memory + (Size - 1);\n /* NOTE: We cannot set the memory all to zero at this point in time. It may be that the\n * memory is already filled with content (e.g. by an external owner). The following\n * code has deliberately be disabled:\n * #ifdef QUEX_OPTION_ASSERTS\n * __QUEX_STD_memset(me->_front, 0, Size);\n * #endif \n * When the buffer uses a buffer filler, then it is a different ball game. Please,\n * consider QuexBuffer_init().\n */\n *(me->_front) = QUEX_SETTING_BUFFER_LIMIT_CODE;\n *(me->_back) = QUEX_SETTING_BUFFER_LIMIT_CODE;\n }\n\n\n QUEX_INLINE size_t \n QuexBufferMemory_size(QuexBufferMemory* me)\n { return me->_back - me->_front + 1; }\n\n#ifdef QUEX_OPTION_ASSERTS\n QUEX_INLINE void\n QUEX_BUFFER_ASSERT_CONTENT_CONSISTENCY(const QuexBuffer* buffer)\n {\n QUEX_CHARACTER_TYPE* iterator = buffer->_memory._front + 1;\n QUEX_CHARACTER_TYPE* End = buffer->_memory._back;\n\n if( buffer->_memory._front == 0x0 && buffer->_memory._back == 0x0 ) return;\n if( buffer->_end_of_file_p != 0x0 ) End = buffer->_end_of_file_p;\n for(; iterator != End; ++iterator) {\n if( *iterator == QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n if( iterator == buffer->_memory._front + 1 ) {\n QUEX_ERROR_EXIT(\"Buffer limit code character appeared as first character in buffer.\\n\"\n \"This is most probably a load failure.\");\n } else {\n QUEX_ERROR_EXIT(\"Buffer limit code character appeared as normal text content.\\n\");\n }\n }\n }\n }\n#else\n /* Defined as empty macro. See header 'quex/code_base/buffer/Buffer' */\n#endif\n\n#if ! defined(__QUEX_SETTING_PLAIN_C)\n} /* namespace quex */\n#endif\n\n#include <quex/code_base/temporary_macros_off>\n\n#include <quex/code_base/buffer/Buffer_debug.i>\n\n#endif /* __INCLUDE_GUARD_QUEX__CODE_BASE__BUFFER__BUFFER_CORE_I__ */\n\n\n" }, { "alpha_fraction": 0.6512779593467712, "alphanum_fraction": 0.6538338661193848, "avg_line_length": 32.29787063598633, "blob_id": "edf90d9987041ca8fa8b98a32256ba3b4177c53c", "content_id": "1dde9242774a89b1626fb8c71dff66b22dc32642", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 6260, "license_type": "permissive", "max_line_length": 95, "num_lines": 188, "path": "/engine/grit_class.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <string>\n#include <map>\n\nclass GritClass;\ntypedef std::map<std::string, GritClass*> GritClassMap;\n\n#ifndef GritClass_h\n#define GritClass_h\n\n#include <string>\n\nextern \"C\" {\n #include <lua.h>\n #include <lauxlib.h>\n #include <lualib.h>\n}\n\n#include \"external_table.h\"\n#include \"grit_lua_util.h\"\n#include \"lua_ptr.h\"\n#include \"path_util.h\"\n\n/** A game object class. The 'DNA' from which multiple similar game objects\n * can be instantiated. For example, there could be a class representing a\n * street lamp, complete with data and code to define its appearance and\n * behaviour, and this class would be instantiated everywhere around the map\n * where a streetlamp is needed. Notionally, the class is like a Lua table,\n * providing a mapping from keys to values.\n *\n * The class has a parent class, which is just a Lua table. The parent class\n * is used whenever the class itself does not provide a mapping for a given\n * key. For its own mappings, the class uses an ExternalTable to store data\n * without pressurising the Lua garbage collector.\n */\nclass GritClass {\n\n public:\n\n /** Create a class using class_add, this function is internal. */\n GritClass (lua_State *L, const std::string &name_)\n : name(name_), refCount(1)\n {\n int index = lua_gettop(L);\n for (lua_pushnil(L) ; lua_next(L, index)!=0 ; lua_pop(L, 1)) {\n const char *err = table.luaSet(L);\n if (err) my_lua_error(L, err);\n }\n lua_pop(L, 1); // the table we just iterated through\n parentClass.set(L);\n }\n\n /** The parent class is a table at the top of the Lua stack. */\n void setParent (lua_State *L)\n {\n parentClass.set(L);\n }\n\n /** Push the parent to the top of the Lua stack. */\n void pushParent (lua_State *L)\n {\n parentClass.push(L);\n }\n\n /** Look up the given key, pushing the value on the stack, or nil if it\n * is unbound. */\n void get (lua_State *L, const std::string &key)\n {\n const char *err = table.luaGet(L, key);\n if (err) my_lua_error(L, err);\n // check the parent\n if (lua_isnil(L, -1)) {\n lua_pop(L, 1);\n pushParent(L);\n lua_getfield(L, -1, key.c_str());\n lua_replace(L, -2); // pop the parent\n }\n }\n\n /** Set the given key to the value at the top of the Lua stack. */\n void set (lua_State *L, const std::string &key)\n {\n const char *err = table.luaSet(L, key);\n if (err) my_lua_error(L, err);\n }\n\n /** Set the key at Lua stack position -2 to the value at Lua stack position -1. */\n void set (lua_State *L)\n {\n const char *err = table.luaSet(L);\n if (err) my_lua_error(L, err);\n }\n\n /** Push a table to the stack containing the key/value mappings in this class. */\n void dump (lua_State *L)\n {\n table.dump(L);\n }\n\n /** Indicate that you are using this class.\n *\n * A class will not be completely destroyed until noone is using it. */\n void acquire ()\n {\n refCount++;\n }\n\n /** Indicate that you are no-longer using this class (e.g. you are an\n * object that is in the process of being destroyed). The class may be\n * destroyed if it is no-longer being used by anyone and has been removed via\n * class_del. */\n void release (lua_State *L)\n {\n refCount--;\n if (refCount>0) return;\n table.destroy(L);\n parentClass.setNil(L);\n delete this;\n }\n\n /** The name of the class, as a Grit path. */\n const std::string name;\n\n protected:\n\n /** The number of objects using this class.\n *\n * Includes an additional, +1 if it has not yet been 'deleted' and thus the system is using\n * it. */\n int refCount;\n\n /** A reference to the parent class, which is a Lua table and therefore exists on the Lua\n * heap. */\n LuaPtr parentClass;\n\n /** The class's key/value mappings. */\n ExternalTable table;\n\n};\n\n/** Create a new class or replace the existing class with the given name. Uses\n * the table at the top of the stack for the class's contents and the next\n * table in the stack as its parent. */\nGritClass *class_add (lua_State *L, const std::string& name);\n\n/** Remove the given class from the system. This meas it can no-longer be\n * found with class_get or class_has and it can no-longer be instantiated into\n * new objects. Existing objects using it will keep working until they are all\n * dead, at which point any last traces of the class will be deleted. */\nvoid class_del (lua_State *L, GritClass *c);\n\n/** Fetch the class of the given name, or throw an exception. */\nGritClass *class_get (const std::string &name);\n\n/** Does the class exist? */\nbool class_has (const std::string &name);\n\n/** Remove all classes from the system. */\nvoid class_all_del (lua_State *L);\n\n/** Return a list of all classes, via the two iterator 'byref' parameters. */\nvoid class_all (GritClassMap::iterator &begin, GritClassMap::iterator &end);\n\n/** Return the number of classes currently in the system. */\nsize_t class_count (void);\n\n\n#endif\n" }, { "alpha_fraction": 0.6967809200286865, "alphanum_fraction": 0.7165108919143677, "avg_line_length": 30.96666717529297, "blob_id": "62cbe7068375ea24e7c97a42d22879024bfcd08a", "content_id": "d06ee6333ab0182a19a8f689139ede9ead6d2099", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Text", "length_bytes": 963, "license_type": "permissive", "max_line_length": 70, "num_lines": 30, "path": "/dependencies/quex-0.34.1/demo/004/README.txt", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "\nThis program can be called in three modes:\n\n(1) BENCHMARK: \n\n > lexer file-of-size-1024kB.txt 1024\n\n Specify file name and size on the command line. The benchmark\n may repeat the analysis of this file multiple times in order to\n converge to a stable result. At the end, the output reports\n the number of repetitions. \n\n NOTE: The benchmark measures also a 'measuring overhead' which\n has to be subtracted. The overhead can be determined by\n using the lexer in the following modes.\n\n(2) COUNT TOKENS: \n\n > lexer filename.txt\n\n Counts the number of tokens found in the file 'filename.txt'. \n The number of tokens is important to determine the measurement\n overhead.\n\n(3) REFERENCE: \n\n > lexer file-of-size-1024kB.txt 1024 NumberOfTokens RepetitionN\n\n Computes the same timings as the BENCHMARK, but **does not** do\n any real analysis. Use the data to determine the 'real' values\n computed by the benchmark. \n\n\n" }, { "alpha_fraction": 0.6164596080780029, "alphanum_fraction": 0.6444099545478821, "avg_line_length": 25.83333396911621, "blob_id": "5819971f8c4d06a34585cef66feeb59375cb26a9", "content_id": "bacf725350f7d327f8200148b7e92a635e979f9b", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Lua", "length_bytes": 644, "license_type": "permissive", "max_line_length": 72, "num_lines": 24, "path": "/engine/tests/engine/hud/parent_resized.lua", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "print \"Test begins\"\n\ngfx_colour_grade(`neutral.lut.png`)\ngfx_option('POST_PROCESSING', false)\n\nprint \"Making class\"\ngfx_hud_class_add(`Rect`, {\n colour = vec(1, 0, 0);\n init = function (self)\n self.needsParentResizedCallbacks = true\n end;\n parentResizedCallback = function (self, psize)\n print(\"\u001b[0;31mparentResizedCallback(\" .. tostring(psize) .. \")\")\n self.position = vec(psize.x/2, psize.y/2)\n self.size = psize / 2\n end;\n})\n\nprint \"Making object\"\nobj = gfx_hud_object_add(`Rect`)\n\nprint \"Rendering frame\"\ngfx_render(0.1, vec(0, 0, 0), quat(1, 0, 0, 0))\ngfx_screenshot('output-parent_resized.png')\n" }, { "alpha_fraction": 0.5175096988677979, "alphanum_fraction": 0.6595330834388733, "avg_line_length": 30.121212005615234, "blob_id": "7dce4b9037a723ed7d709b5e9210c778ecdaaf81", "content_id": "4afe35bc783269adbe8f78ccb8da27b34f83136a", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Lua", "length_bytes": 1028, "license_type": "permissive", "max_line_length": 112, "num_lines": 33, "path": "/engine/tests/engine/dds/all_dds.luaimg.lua", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "function output(fmt, img)\n dds_save_simple(\"all_dds.\"..fmt..\".dds\", fmt, mipmaps(img))\nend\n\nimg1 = make(vec(128, 128), 1, function(p) return p.x/128 + p.y/128 / 2 end)\nimg1a = make(vec(128, 128), 1, true, function(p) return vec(p.x/128, p.y/128) end)\nimg2 = make(vec(128, 128), 2, function(p) return p / 128 end)\nimg3 = make(vec(128, 128), 3, function(p) return vec3(p/128, 1 - p.x/128/2) end)\nimg3a = make(vec(128, 128), 3, true, function(p) return vec4(p/128, 1 - p.x/128/2, 1 - mod(p.y/128 * 2, 1)) end)\n\noutput(\"R5G6B5\", img3)\noutput(\"R8G8B8\", img3)\noutput(\"A8R8G8B8\", img3a)\noutput(\"A2R10G10B10\", img3a)\noutput(\"A1R5G5B5\", img3a)\noutput(\"R8\", img1)\noutput(\"R16\", img1)\noutput(\"G16R16\", img2)\noutput(\"A8R8\", img1a)\noutput(\"A4R4\", img1a)\noutput(\"A16R16\", img1a)\noutput(\"R3G3B2\", img3)\noutput(\"A4R4G4B4\", img3a)\noutput(\"BC1\", img3a)\noutput(\"BC2\", img3a)\noutput(\"BC3\", img3a)\noutput(\"BC4\", img1)\noutput(\"BC5\", img2)\n\n-- TODO: volume map\n-- TODO: cubemap\n-- TODO: images with no mipmaps\n-- TODO: images with partial mipmaps\n\n" }, { "alpha_fraction": 0.5262076258659363, "alphanum_fraction": 0.5262076258659363, "avg_line_length": 29.726316452026367, "blob_id": "a40b0b9c78366e94f4354876e058a5d2f40d5e4c", "content_id": "86f06c5a3bbf0ccf185e76615bdc47d0c8de7c2d", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Makefile", "length_bytes": 2919, "license_type": "permissive", "max_line_length": 84, "num_lines": 95, "path": "/dependencies/quex-0.34.1/demo/002/Makefile", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "# PURPOSE: Makefile for unit tests.\n#\n# ABSOLUTELY NO WARRANTY\n#_______________________________________________________________________________\ninclude $(QUEX_PATH)/quex/code_base/core.mkd\n\n# (*) SETUP ____________________________________________________________________\n#\n# QUEX_PATH = ../../ # there should be an environment variable 'QUEX_PATH'\n# # thus this does have to be defined explicitly here.\n#\n# -- INPUT\nMODE_FILES = simple.qx\nDEBUG_F = # --debug # set flag if debugging info is required\n#\n# -- APPLICATION / LIBRARY specification\nAPPLICATION_NAME = lexer\nLIBRARY_NAME = libLexer\nENGINE_NAME = indy_lex# NOTE: a whitespace after this name creates chaos!\n#\nGENERATED_MODE_FILES = \\\n\t\t $(ENGINE_NAME)-core-engine.cpp \\\n\nGENERATED_MODE_OBJS = $(GENERATED_MODE_FILES:.cpp=.o)\n#\nENGINE_SOURCES = $(ENGINE_NAME) \\\n $(ENGINE_NAME).cpp \\\n $(ENGINE_NAME)-token_ids \\\n\t\t $(GENERATED_MODE_FILES)\n#\nLIBRARY_OBJS = $(ENGINE_NAME).o\n\n\n# (*) COMPILER SETTINGS ________________________________________________________\n# (change COMPILER to whatever you use as compiler on the command line,\n# e.g. \"make COMPILER=icpc\" will use intel's c++ compiler)\nCOMPILER = g++\n# -- compiler\nCC = $(COMPILER) -c -fPIC -ggdb -Wno-deprecated -Wall \\\n\t -I./ -I$(QUEX_PATH) $(NDEBUG_F) \\\n\t #-DQUEX_OPTION_DEBUG_MODE_TRANSITIONS \\\n\t #-D__QUEX_OPTION_DEBUG_STATE_TRANSITION_REPORTS\n\n# -- linker\nLD = $(COMPILER) \nSTATIC_LD = ar -rv\nDYNAMIC_LD = $(COMPILER) -shared \n\n\n# (*) RULES ____________________________________________________________________\n#\n# -- application\n$(APPLICATION_NAME): ./$(APPLICATION_NAME).o $(ENGINE_NAME).o $(GENERATED_MODE_OBJS)\n\t$(LD) ./$(APPLICATION_NAME).o $(ENGINE_NAME).o \\\n\t $(GENERATED_MODE_OBJS) \\\n -o $(APPLICATION_NAME) \n\n# -- libraries\n$(LIBRARY_NAME).a:\n\t$(STATIC_LD) $@ $(LIBRARY_OBJS)\n\n$(LIBRARY_NAME).so:\n\t$(DYNAMIC_LD) $(LIBRARY_OBJS) -o $@ \n\n# -- engine and object files\n$(APPLICATION_NAME).o: $(APPLICATION_NAME).cpp $(ENGINE_SOURCES)\n# # require: $(ENGINE_SOURCES) for header files\n\t$(CC) $(APPLICATION_NAME).cpp -o $(APPLICATION_NAME).o\n\n$(ENGINE_NAME).o: $(ENGINE_SOURCES)\n\t$(CC) $(ENGINE_NAME).cpp -o $(ENGINE_NAME).o\n\n%.o: %.cpp\n\t$(CC) $< -o $@\n\n$(ENGINE_SOURCES): $(MODE_FILES) $(QUEX_CORE)\n\tquex --mode-files $(MODE_FILES) \\\n\t --engine $(ENGINE_NAME) \n\n\n# (*) HELPERS __________________________________________________________________\n#\nclean:\t\n\ttouch $(MODE_FILES)\n\trm -f $(ENGINE_NAME) $(ENGINE_NAME).cpp \\\n $(ENGINE_NAME)-internal.h $(ENGINE_NAME)-token_ids\n\trm -f $(GENERATED_MODE_FILES)\n\trm -f $(GENERATED_MODE_OBJS)\n\trm -f $(ENGINE_NAME).o\n\trm -f $(LIBRARY_NAME).a $(LIBRARY_NAME).so\n\trm -f lexer.o\n\trm -f lexer\n\trm -f gmon.out\n\trm -f token_ids\n\trm -f *.bak\n" }, { "alpha_fraction": 0.7195029854774475, "alphanum_fraction": 0.7289156913757324, "avg_line_length": 41.158729553222656, "blob_id": "750b93dfe193e66332c57cb4b6d9b8a9f7ebbf2a", "content_id": "9b1b268e7f6a035fa3c1785a8f529426a75b8d04", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 2656, "license_type": "permissive", "max_line_length": 96, "num_lines": 63, "path": "/engine/bullet_debug_drawer.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n// Based on http://www.ogre3d.org/wiki/index.php/BulletDebugDrawer\n// copyright ownership unknown\n\n#ifndef BulletDebugDrawer_h\n#define BulletDebugDrawer_h\n\n#include <btBulletCollisionCommon.h>\n\n#include <math_util.h>\n\nclass BulletDebugDrawer: public btIDebugDraw\n{\n public:\n BulletDebugDrawer (void);\n ~BulletDebugDrawer (void);\n virtual void drawLine (const btVector3 &from, const btVector3 &to, const btVector3 &colour);\n virtual void drawTriangle (const btVector3 &v0, const btVector3 &v1, const btVector3 &v2,\n const btVector3 &colour, btScalar alpha);\n virtual void drawContactPoint (const btVector3 &PointOnB, const btVector3 &normalOnB,\n btScalar distance, int lifeTime, const btVector3 &colour);\n virtual void reportErrorWarning (const char *warningString);\n virtual void draw3dText (const btVector3 &location, const char *textString);\n virtual void setDebugMode (int debugMode);\n virtual int getDebugMode () const;\n void frameCallback (void);\n\n private:\n struct ContactPoint{\n Vector3 from;\n Vector3 to;\n Vector3 colour;\n size_t dieTime;\n };\n DebugDrawModes mDebugModes;\n // Every frame we throw out some contact points that have been displayed for long enough.\n // To implement that efficiently, we have a double buffer.\n std::vector<ContactPoint> contactPoints1;\n std::vector<ContactPoint> contactPoints2;\n std::vector<ContactPoint> *contactPoints;\n};\n\n#endif\n" }, { "alpha_fraction": 0.6090909242630005, "alphanum_fraction": 0.6090909242630005, "avg_line_length": 12.75, "blob_id": "b09237b9a605d640c6eaadcbf1880d23682aff43", "content_id": "1613ab1b73e0d810629a310a1c2f5aab18935c5b", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Makefile", "length_bytes": 110, "license_type": "permissive", "max_line_length": 23, "num_lines": 8, "path": "/dependencies/jsonxx_grit.mk", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "JSONXX_WEAK_CPP_SRCS= \\\n jsonxx.cpp \\\n\nJSONXX_INCLUDE_SRCS= \\\n jsonxx.h \\\n\nJSONXX_INCLUDE_DIRS= \\\n .\n" }, { "alpha_fraction": 0.604312002658844, "alphanum_fraction": 0.6842105388641357, "avg_line_length": 21.855072021484375, "blob_id": "12c42a603438b68df09335c80f20b887b798d541", "content_id": "27de0841600144737d4c5c1fdd60cb203a0428c0", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Lua", "length_bytes": 1577, "license_type": "permissive", "max_line_length": 75, "num_lines": 69, "path": "/engine/tests/engine/hud/stencil.lua", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "gfx_colour_grade(`neutral.lut.png`)\ngfx_option('POST_PROCESSING', false)\n\ngfx_hud_class_add(`Rect`, {\n})\n\nobj = gfx_hud_object_add(`Rect`)\nobj.position = vec(300, 300) -- centre of object, from screen bottom left\nobj.size = vec(400, 300)\nobj.stencil = true\nobj.stencilTexture = `speech-bubble.png`\nobj.orientation = 30\nobj.colour = vec(0, 1, 0)\nobj.zOrder = 5\n\nobj2 = gfx_hud_object_add(`Rect`)\nobj2.parent = obj\nobj2.size = vec(400, 100)\nobj2.colour = vec(1, 0, 0)\nobj2.orientation = 30\n\n\ninclude `font_impact50.lua`\n\nt = gfx_hud_text_add(`Impact50`)\nt.parent = obj\nt.position = vec(70, 0)\nt.orientation = -30\nt.zOrder = 5\nt.text = [[The quick brown fox jumped over the lazy dog.\nThe quick brown fox jumped over the lazy dog.\nThe quick brown fox jumped over the lazy dog.\n]]\n\n\n\nobj3 = gfx_hud_object_add(`Rect`)\nobj3.position = vec(600, 400) -- centre of object, from screen bottom left\nobj3.size = vec(400, 300)\nobj3.stencil = true\nobj3.orientation = 38\nobj3.colour = vec(0, 0, 0.5)\n\nobj4 = gfx_hud_object_add(`Rect`)\nobj4.parent = obj3\nobj4.size = vec(400, 300)\nobj4.colour = vec(0.5, 0, 0.5)\nobj4.orientation = 32\n\n\ninclude `font_impact50.lua`\n\nt2 = gfx_hud_text_add(`Impact50`)\nt2.parent = obj3\nt2.position = vec(70, 0)\nt2.orientation = -30\nt2.zOrder = 5\nt2.text = [[The quick brown fox jumped over the lazy dog.\nThe quick brown fox jumped over the lazy dog.\nThe quick brown fox jumped over the lazy dog.\n]]\nt2.colour = vec(0, 0, 0)\n\n\n\ngfx_render(0.1, vec(0, 0, 0), quat(1, 0, 0, 0))\n\ngfx_render(0.1, vec(0, 0, 0), quat(1, 0, 0, 0))\ngfx_screenshot('output-stencil.png')\n" }, { "alpha_fraction": 0.6179999709129333, "alphanum_fraction": 0.6286666393280029, "avg_line_length": 22.715415954589844, "blob_id": "1a78321094283990ea8cabf54a17e56de961bacb", "content_id": "b31725fa5760adab00a2c7c1ec45439d72732101", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 12000, "license_type": "permissive", "max_line_length": 168, "num_lines": 506, "path": "/engine/navigation/navigation.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n// May have some code of Recast Demo\n\n#include <DetourCommon.h>\n#include <DetourTileCache.h>\n\n#include \"crowd_manager.h\"\n#include \"input_geom.h\"\n#include \"navigation.h\"\n\nNavigationSystem* nvsys = nullptr;\n\nOgre::Vector3 swap_yz(Ogre::Vector3 from)\n{\n return Ogre::Vector3(-from.x, from.z, from.y);\n}\n\nfloat* swap_yz(float* pos)\n{\n float* float_pos = new float[3];\n float_pos[0] = -pos[0];\n float_pos[1] = pos[2];\n float_pos[2] = pos[1];\n return float_pos;\n}\n\nfloat* Vec3ToFloat(Ogre::Vector3 pos)\n{\n float* float_pos = new float[3];\n float_pos[0] = pos.x;\n float_pos[1] = pos.y;\n float_pos[2] = pos.z;\n return float_pos;\n}\n\nOgre::Vector3 FloatToVec3(float* pos)\n{\n return Ogre::Vector3(pos[0], pos[1], pos[2]);\n}\n\nnamespace NavSysDebug\n{\n bool Enabled = false;\n bool ShowNavmesh = true;\n bool NavmeshUseTileColours = false;\n bool ShowAgents = false;\n bool ShowAgentArrows = true;\n bool ShowObstacles = true;\n bool ShowOffmeshConnections = true;\n bool ShowBounds = true;\n bool ShowTilingGrid = false;\n bool ShowConvexVolumes = true;\n\n void init()\n {\n }\n\n void clearAllObjects(void)\n {\n }\n\n void redrawAllActiveObjects(void)\n {\n }\n void destroy()\n {\n }\n}\n\nvoid navigation_init()\n{\n nvsys = new NavigationSystem();\n}\n\nvoid navigation_shutdown()\n{\n delete nvsys;\n NavSysDebug::destroy();\n}\n\nNavigationSystem::NavigationSystem(void)\n{\n init();\n}\n\nNavigationSystem::~NavigationSystem(void)\n{\n delete geom;\n delete nvmgr;\n}\n\nvoid NavigationSystem::init()\n{\n NavSysDebug::init();\n\n geom = 0;\n nvmgr = new NavigationManager();\n\n nvmgr->setContext(&ctx);\n}\n\nvoid navigation_update(const float tslf)\n{\n nvsys->Update(tslf);\n}\n\nvoid navigation_update_debug(const float tslf)\n{\n nvsys->updateDebug(tslf);\n}\n\nvoid NavigationSystem::Update(const Ogre::Real tslf)\n{\n nvmgr->update(tslf);\n}\n\nvoid NavigationSystem::updateDebug(const Ogre::Real tslf)\n{\n (void) tslf;\n if (nvmgr && NavSysDebug::Enabled)\n {\n nvmgr->render();\n }\n}\n\nvoid NavigationSystem::set_dest_pos(Ogre::Vector3 pos)\n{\n nvmgr->m_crowdTool->setMoveTarget(Vec3ToFloat(swap_yz(pos)), false);\n}\n\nvoid NavigationSystem::buildNavMesh()\n{\n if (geom && nvmgr)\n {\n nvmgr->updateMaxTiles();\n\n ctx.resetLog();\n\n if (nvmgr->build())\n {\n navMeshLoaded = true;\n }\n }\n}\n\nvoid NavigationSystem::addObj(const char* mesh_name)\n{\n delete geom;\n geom = 0;\n\n char path[256];\n strcpy(path, \"./\");\n strcat(path, mesh_name);\n\n geom = new InputGeom;\n if (!geom || !geom->loadMesh(&ctx, path))\n {\n delete geom;\n geom = 0;\n }\n\n if (nvmgr && geom)\n {\n nvmgr->changeMesh(geom);\n }\n}\n\nvoid NavigationSystem::addGfxBody(GfxBodyPtr bd)\n{\n delete geom;\n geom = 0;\n\n std::vector<GfxBodyPtr> yu;\n yu.push_back(bd);\n\n geom = new InputGeom;\n if (!geom || !geom->loadGfxBody(&ctx, yu))\n {\n delete geom;\n geom = 0;\n }\n nvmgr->changeMesh(geom);\n}\n\nvoid NavigationSystem::addGfxBodies(std::vector<GfxBodyPtr> bds)\n{\n delete geom;\n geom = 0;\n\n geom = new InputGeom;\n if (!geom || !geom->loadGfxBody(&ctx, bds))\n {\n delete geom;\n geom = 0;\n }\n nvmgr->changeMesh(geom);\n}\n\nvoid NavigationSystem::addRigidBody(RigidBody *bd)\n{\n delete geom;\n geom = 0;\n\n std::vector<RigidBody*> yu;\n yu.push_back(bd);\n\n geom = new InputGeom;\n if (!geom || !geom->loadRigidBody(&ctx, yu))\n {\n delete geom;\n geom = 0;\n }\n nvmgr->changeMesh(geom);\n}\n\nvoid NavigationSystem::addTempObstacle(Ogre::Vector3 pos)\n{\n if (anyNavmeshLoaded())\n {\n nvmgr->addTempObstacle(Vec3ToFloat(swap_yz(pos)));\n }\n}\n\n// TODO\nvoid NavigationSystem::removeTempObstacle(Ogre::Vector3 pos)\n{\n (void) pos;\n if (anyNavmeshLoaded())\n {\n //nvmgr->removeTempObstacle(Vec3ToFloat(swap_yz(pos)));\n }\n}\n\nvoid NavigationSystem::addOffmeshConection(Ogre::Vector3 pos, Ogre::Vector3 pos2, bool bidir)\n{\n if (anyNavmeshLoaded())\n {\n const unsigned char area = SAMPLE_POLYAREA_JUMP;\n const unsigned short flags = SAMPLE_POLYFLAGS_JUMP;\n geom->addOffMeshConnection(Vec3ToFloat(swap_yz(pos2)), Vec3ToFloat(swap_yz(pos)), nvmgr->getAgentRadius(), bidir ? 1 : 0, area, flags);\n }\n}\n\nvoid NavigationSystem::removeOffmeshConection(Ogre::Vector3 pos)\n{\n if (anyNavmeshLoaded())\n {\n float nearestDist = FLT_MAX;\n int nearestIndex = -1;\n const float* verts = geom->getOffMeshConnectionVerts();\n for (int i = 0; i < geom->getOffMeshConnectionCount() * 2; ++i)\n {\n const float* v = &verts[i * 3];\n float d = rcVdistSqr(Vec3ToFloat(pos), v);\n if (d < nearestDist)\n {\n nearestDist = d;\n nearestIndex = i / 2; // Each link has two vertices.\n }\n }\n // If end point close enough, delete it.\n if (nearestIndex != -1 &&\n sqrtf(nearestDist) < nvmgr->getAgentRadius())\n {\n geom->deleteOffMeshConnection(nearestIndex);\n }\n }\n}\n\nbool NavigationSystem::findNearestPointOnNavmesh(Ogre::Vector3 pos, dtPolyRef &target_ref, Ogre::Vector3 &resultPoint)\n{\n if (anyNavmeshLoaded())\n {\n dtNavMeshQuery* navquery = nvmgr->getNavMeshQuery();\n dtCrowd* crowd = nvmgr->getCrowd();\n const dtQueryFilter* filter = crowd->getFilter(0);\n //const float* ext = crowd->getQueryExtents();\n float ext[3];\n ext[0] = 32.f, ext[1] = 32.f, ext[2] = 32.f;\n\n float target_pos[3];\n dtStatus sts = navquery->findNearestPoly(Vec3ToFloat(pos), ext, filter, &target_ref, target_pos);\n resultPoint = FloatToVec3(target_pos);\n\n if ((sts & DT_FAILURE) || (sts & DT_STATUS_DETAIL_MASK))\n {\n return false;\n }\n return true;\n }\n return false;\n}\n\nstatic float frand()\n{\n return (float)rand() / (float)RAND_MAX;\n}\n\nbool NavigationSystem::getRandomNavMeshPoint(Ogre::Vector3 &resultPoint)\n{\n if (anyNavmeshLoaded())\n {\n float resPoint[3];\n dtPolyRef resultPoly;\n // float ext[3];\n dtStatus sts = nvmgr->getNavMeshQuery()->findRandomPoint(nvmgr->getCrowd()->getFilter(0), frand, &resultPoly, resPoint);\n\n if ((sts & DT_FAILURE) || (sts & DT_STATUS_DETAIL_MASK))\n {\n return false;\n }\n resultPoint = FloatToVec3(resPoint);\n return true;\n }\n return false;\n}\n\nbool NavigationSystem::getRandomNavMeshPointInCircle(Ogre::Vector3 point, float radius, Ogre::Vector3 &resultPoint)\n{\n if (anyNavmeshLoaded())\n {\n dtPolyRef m_targetRef;\n Ogre::Vector3 rsp;\n\n if (findNearestPointOnNavmesh(point, m_targetRef, rsp))\n {\n dtPolyRef resultPoly;\n float resPoint[3];\n nvmgr->getNavMeshQuery()->findRandomPointAroundCircle(m_targetRef, Vec3ToFloat(rsp), radius, nvmgr->getCrowd()->getFilter(0), frand, &resultPoly, resPoint);\n resultPoint = FloatToVec3(resPoint);\n return true;\n }\n }\n return false;\n}\n\nint NavigationSystem::addAgent(Ogre::Vector3 pos)\n{\n return nvmgr->m_crowdTool->addAgent(Vec3ToFloat(swap_yz(pos)));\n}\n\nvoid NavigationSystem::removeAgent(int idx)\n{\n nvmgr->m_crowdTool->removeAgent(idx);\n}\n\nbool NavigationSystem::isAgentActive(int idx)\n{\n return nvmgr->getCrowd()->getAgent(idx)->active;\n}\n\nvoid NavigationSystem::agentStop(int idx)\n{\n float vector_zero[] = { 0, 0, 0 };\n nvmgr->getCrowd()->resetMoveTarget(idx) && nvmgr->getCrowd()->requestMoveVelocity(idx, vector_zero);\n}\n\nOgre::Vector3 NavigationSystem::getAgentPosition(int idx)\n{\n const dtCrowdAgent* agent = nvmgr->getCrowd()->getAgent(idx);\n return Ogre::Vector3(-agent->npos[0], agent->npos[2], agent->npos[1]);\n}\n\nOgre::Vector3 NavigationSystem::getAgentVelocity(int idx)\n{\n return Ogre::Vector3(\n -nvmgr->getCrowd()->getAgent(idx)->nvel[0],\n nvmgr->getCrowd()->getAgent(idx)->nvel[2],\n nvmgr->getCrowd()->getAgent(idx)->nvel[1]\n );\n}\n\nvoid NavigationSystem::agentRequestVelocity(int idx, Ogre::Vector3 vel)\n{\n nvmgr->getCrowd()->requestMoveVelocity(idx, Vec3ToFloat(swap_yz(vel)));\n}\n\nstatic void calcVel(float* vel, const float* pos, const float* tgt, const float speed)\n{\n dtVsub(vel, tgt, pos);\n vel[1] = 0.0;\n dtVnormalize(vel);\n dtVscale(vel, vel, speed);\n}\n\nvoid NavigationSystem::setAgentMoveTarget(int idx, Ogre::Vector3 pos, bool adjust)\n{\n if (!nvmgr) return;\n\n dtPolyRef m_targetRef;\n Ogre::Vector3 targetPnt(0, 0, 0); // Actually initialised below, but compiler can't tell.\n\n dtCrowd* crowd = nvmgr->getCrowd();\n\n pos = swap_yz(pos);\n\n if (adjust)\n {\n float vel[3];\n // Request velocity\n if (idx != -1)\n {\n const dtCrowdAgent* ag = crowd->getAgent(idx);\n if (ag && ag->active)\n {\n calcVel(vel, ag->npos, Vec3ToFloat(pos), ag->params.maxSpeed);\n crowd->requestMoveVelocity(idx, vel);\n }\n }\n }\n else\n {\n findNearestPointOnNavmesh(pos, m_targetRef, targetPnt);\n\n if (idx != -1)\n {\n const dtCrowdAgent* ag = crowd->getAgent(idx);\n if (ag && ag->active)\n crowd->requestMoveTarget(idx, m_targetRef, Vec3ToFloat(targetPnt));\n }\n }\n}\n\nfloat NavigationSystem::getDistanceToGoal(int idx, const float max_range)\n{\n const dtCrowdAgent* agent = nvmgr->getCrowd()->getAgent(idx);\n\n if (!agent->ncorners)\n return max_range;\n\n const bool endOfPath = (agent->cornerFlags[agent->ncorners - 1] & DT_STRAIGHTPATH_END) ? true : false;\n if (endOfPath)\n return dtMin(dtVdist2D(agent->npos, &agent->cornerVerts[(agent->ncorners - 1) * 3]), max_range);\n\n return max_range;\n}\n\nfloat NavigationSystem::getAgentHeight(int idx)\n{\n (void) idx;\n return nvmgr->getAgentHeight();\n}\n\nfloat NavigationSystem::getAgentRadius(int idx)\n{\n (void) idx;\n return nvmgr->getAgentRadius();\n}\n\nbool NavigationSystem::saveNavmesh(const char* path)\n{\n return nvmgr->saveAll(path);\n}\n\nbool NavigationSystem::loadNavmesh(const char* path)\n{\n delete geom;\n geom = 0;\n\n if (nvmgr->load(path))\n {\n navMeshLoaded = true;\n return true;\n } else\n {\n return false;\n }\n}\n\nvoid NavigationSystem::reset()\n{\n delete geom;\n geom = 0;\n NavSysDebug::clearAllObjects();\n nvmgr->changeMesh(nullptr);\n navMeshLoaded = false;\n}\n\nvoid NavigationSystem::removeConvexVolume(Ogre::Vector3 pos)\n{\n nvmgr->removeConvexVolume(Vec3ToFloat(pos));\n}\nvoid NavigationSystem::createConvexVolume(Ogre::Vector3 pos)\n{\n nvmgr->createConvexVolume(Vec3ToFloat(pos));\n}\n" }, { "alpha_fraction": 0.41803279519081116, "alphanum_fraction": 0.4328268766403198, "avg_line_length": 31.270967483520508, "blob_id": "cc859ee881d86bd289003433de46f1891c635d7a", "content_id": "89f3cc2a8dca64620de24beee57a1859a4dbeeb9", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 5002, "license_type": "permissive", "max_line_length": 92, "num_lines": 155, "path": "/gtasa/surfinfo.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "#include <iostream>\n#include <fstream>\n\n#include \"surfinfo.h\"\n#include \"ios_util.h\"\n\nstatic float f (const std::string &s) { return (float)strtod(s.c_str(), NULL); }\nstatic int dec (const std::string &s) { return (int)strtod(s.c_str(), NULL); }\nstatic bool b (const std::string &s) { return dec(s)==1; }\n\nvoid read_surfinfo (Csv &csv, SurfInfoData &data)\n{\n const CsvSection &s = csv[\"nosection\"];\n for (unsigned i=0 ; i<s.size() ; ++i) {\n const CsvLine &line = s[i];\n APP_ASSERT(line.size()>=36);\n\n SurfInfo v;\n v.name = line[0];\n\n v.adhesion_group = line[1];\n v.tyre_grip = f(line[2]);;\n v.wet_grip = f(line[3]);;\n v.skidmark = line[4];\n v.friction_effect = line[5];\n v.soft_landing = b(line[6]);\n v.see_through = b(line[7]);\n v.shoot_through = b(line[8]);\n v.sand = b(line[9]);\n v.water = b(line[10]);\n v.shallow_water = b(line[11]);\n v.beach = b(line[12]);\n v.steep_slope = b(line[13]);\n v.glass = b(line[14]);\n v.stairs = b(line[15]);\n v.skateable = b(line[16]);\n v.pavement = b(line[17]);\n v.roughness = dec(line[18]);\n v.flammability = dec(line[19]);\n v.sparks = b(line[20]);\n v.sprint = b(line[21]);\n v.footsteps = b(line[22]);\n v.footdust = b(line[23]);\n v.cardirt = b(line[24]);\n v.carclean = b(line[25]);\n v.w_grass = b(line[26]);\n v.w_gravel = b(line[27]);\n v.w_mud = b(line[28]);\n v.w_dust = b(line[29]);\n v.w_sand = b(line[30]);\n v.w_spray = b(line[31]);\n v.proc_plant = b(line[32]);\n v.proc_obj = b(line[33]);\n v.climbable = b(line[34]);\n v.bullet_fx = line[35];\n\n data.surfaces.push_back(v);\n }\n for (unsigned i=0 ; i<data.surfaces.size() ; ++i) {\n SurfInfo &v = data.surfaces[i];\n data[v.name] = &v;\n }\n}\n\n\n\n#ifdef _SURFINFO_EXEC\n\nvoid assert_triggered (void) { }\n\nvoid app_verbose(char const* file, int line, const std::string& msg)\n{\n std::cout<<BOLD<<GREEN<<\"VERBOSE \"<<RESET\n <<BOLD<<file<<NOBOLD<<\":\"<<BOLD<<line<<NOBOLD\n << \": \\\"\"<<BOLD<<BLUE<<msg<<RESET\"\\\"\";\n std::cout<<std::endl;\n}\n\nvoid app_error(char const* file, int line,\n const std::string& i_was, const std::string& msg)\n{\n std::cout<<BOLD RED\"ERROR \"<<RESET\n <<BOLD<<file<<NOBOLD<<\":\"<<BOLD<<line<<NOBOLD\n <<\": \\\"\"<<BOLD<<YELLOW<<msg<<RESET<<\"\\\"\";\n if (i_was!=\"\")\n std::cout<<\" (\"<<BOLD<<YELLOW<<i_was<<RESET<<\")\";\n std::cout<<std::endl;\n}\n\nvoid app_line(const std::string &msg)\n{\n std::cout<<BOLD<<msg<<NOBOLD<<std::endl;\n}\n\nvoid app_fatal()\n{\n abort();\n}\n\nint main(int argc, char *argv[])\n{\n if (argc!=2) {\n std::cerr<<\"Usage: \"<<argv[0]<<\" <surfinfo.dat file>\"<<std::endl;\n return EXIT_FAILURE;\n }\n\n try {\n\n std::ifstream surfinfofstream;\n std::istream *surfinfostream = &surfinfofstream;\n std::string filename;\n\n if (strcmp(argv[1],\"-\")==0) {\n surfinfostream = &std::cin;\n filename = \"<stdin>\";\n } else {\n filename = argv[1];\n surfinfofstream.open (filename.c_str());\n APP_ASSERT_IO_SUCCESSFUL(surfinfofstream,\n \"Opening surfinfo: \"+filename);\n if (surfinfofstream.fail() || surfinfofstream.bad()) {\n std::stringstream ss;\n ss << filename << \": IO Error: \" << strerror(errno) << \"\\n\";\n GRIT_EXCEPT(ss.str());\n }\n }\n\n Csv surfinfo;\n surfinfo.filename = filename;\n read_csv(*surfinfostream,surfinfo);\n SurfInfoData data;\n read_surfinfo(surfinfo, data);\n\n for (SurfInfoData::iterator i=data.begin(), i_=data.end() ; i!=i_ ; ++i) {\n const std::string name = i->first;\n const SurfInfo &v = *i->second;\n\n APP_ASSERT(name == v.name);\n\n std::cout << name << std::endl;\n }\n\n } catch (const Exception &e) {\n\n CERR << e << std::endl;\n return EXIT_FAILURE;\n\n }\n\n return EXIT_SUCCESS;\n}\n\n#endif\n\n// vim: shiftwidth=8:tabstop=8:expandtab\n" }, { "alpha_fraction": 0.46666666865348816, "alphanum_fraction": 0.47179487347602844, "avg_line_length": 20.5, "blob_id": "9e514ac9a5fb77b44557b5c1837403baa833b00f", "content_id": "2b7c4870ff3e405f12cdfac002b0edd097ed7969", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 390, "license_type": "permissive", "max_line_length": 57, "num_lines": 18, "path": "/dependencies/quex-0.34.1/demo/009/simple.qx", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "// -*- C++ -*- vim: set syntax=cpp:\ntoken {\n HELLO\n WORLD\n NUMBER\n BYE\n}\n\nmode ONE_AND_ONLY :\n<skip: [ \\n\\t]>\n{\n <<EOF>> => QUEX_TKN_TERMINATION;\n\n \"hello\"|\"bonjour\"|\"hallo\" => QUEX_TKN_HELLO(Lexeme);\n \"world\"|\"le monde\"|\"welt\" => QUEX_TKN_WORLD(Lexeme);\n [0-9]+ => QUEX_TKN_NUMBER(Lexeme);\n \"bye\" => QUEX_TKN_BYE;\n}\n\n\n\n" }, { "alpha_fraction": 0.5834882259368896, "alphanum_fraction": 0.5985237956047058, "avg_line_length": 30.480207443237305, "blob_id": "05aa1ee758d31ef065a4515aecdb69c215083214", "content_id": "d3d392063844ac52349fc8a95ef0aaabdda866fb", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 18290, "license_type": "permissive", "max_line_length": 99, "num_lines": 581, "path": "/engine/gfx/gfx_gasoline.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <cstdlib>\n#include <cstdint>\n\n#include <array>\n#include <map>\n#include <ostream>\n#include <string>\n\n#include <math_util.h>\n\n#include <centralised_log.h>\n\n#ifndef GFX_GASOLINE_H\n#define GFX_GASOLINE_H\n\ntemplate<class T> static inline size_t my_hash (const T &x) { return std::hash<T>()(x); }\n\nenum GfxGslBackend {\n GFX_GSL_BACKEND_CG,\n GFX_GSL_BACKEND_GLSL33,\n};\n\nstruct GfxGslFloatVec {\n float r, g, b, a;\n GfxGslFloatVec (void) { }\n GfxGslFloatVec (float r, float g=0, float b=0, float a=0)\n : r(r), g(g), b(b), a(a)\n { }\n bool operator== (const GfxGslFloatVec &other) const\n {\n return other.r == r && other.g == g && other.b == b && other.a == a;\n }\n bool operator!= (const GfxGslFloatVec &other) const\n {\n return !(*this == other);\n }\n};\n\nstatic inline std::ostream &operator<< (std::ostream &o, const GfxGslFloatVec &c)\n{\n o << \"Float4(\" << c.r << \", \" << c.g << \", \" << c.b << \", \" << c.a << \")\";\n return o;\n}\n\nnamespace std {\n template<> struct hash<GfxGslFloatVec> {\n size_t operator()(const GfxGslFloatVec &a) const\n {\n size_t r = 0;\n r = r * 31 + my_hash(a.r);\n r = r * 31 + my_hash(a.g);\n r = r * 31 + my_hash(a.b);\n r = r * 31 + my_hash(a.a);\n return r;\n }\n };\n}\n\nstruct GfxGslIntVec {\n int32_t r, g, b, a;\n GfxGslIntVec (void) { }\n GfxGslIntVec (int32_t r, int32_t g=0, int32_t b=0, int32_t a=0)\n : r(r), g(g), b(b), a(a)\n { }\n bool operator== (const GfxGslIntVec &other) const\n {\n return other.r == r && other.g == g && other.b == b && other.a == a;\n }\n bool operator!= (const GfxGslIntVec &other) const\n {\n return !(*this == other);\n }\n};\n\nstatic inline std::ostream &operator<< (std::ostream &o, const GfxGslIntVec &c)\n{\n o << \"Int4(\" << c.r << \", \" << c.g << \", \" << c.b << \", \" << c.a << \")\";\n return o;\n}\n\nnamespace std {\n template<> struct hash<GfxGslIntVec> {\n size_t operator()(const GfxGslIntVec &a) const\n {\n size_t r = 0;\n r = r * 31 + my_hash(a.r);\n r = r * 31 + my_hash(a.g);\n r = r * 31 + my_hash(a.b);\n r = r * 31 + my_hash(a.a);\n return r;\n }\n };\n}\n\nenum GfxGslParamType {\n GFX_GSL_FLOAT1 = 0x1,\n GFX_GSL_FLOAT2 = 0x2,\n GFX_GSL_FLOAT3 = 0x3,\n GFX_GSL_FLOAT4 = 0x4,\n GFX_GSL_INT1 = 0x11,\n GFX_GSL_INT2 = 0x12,\n GFX_GSL_INT3 = 0x13,\n GFX_GSL_INT4 = 0x14,\n GFX_GSL_FLOAT_TEXTURE1 = 0x101,\n GFX_GSL_FLOAT_TEXTURE2 = 0x102,\n GFX_GSL_FLOAT_TEXTURE3 = 0x103,\n GFX_GSL_FLOAT_TEXTURE4 = 0x104,\n GFX_GSL_FLOAT_TEXTURE_CUBE = 0x105,\n GFX_GSL_STATIC_FLOAT1 = 0x201,\n GFX_GSL_STATIC_FLOAT2 = 0x202,\n GFX_GSL_STATIC_FLOAT3 = 0x203,\n GFX_GSL_STATIC_FLOAT4 = 0x204,\n GFX_GSL_STATIC_INT1 = 0x211,\n GFX_GSL_STATIC_INT2 = 0x212,\n GFX_GSL_STATIC_INT3 = 0x213,\n GFX_GSL_STATIC_INT4 = 0x214,\n};\n\nnamespace std {\n template<> struct hash<GfxGslParamType> {\n size_t operator()(const GfxGslParamType &a) const\n {\n return a;\n }\n };\n}\n\n\nstatic inline bool gfx_gasoline_param_type_is_texture (GfxGslParamType t)\n{\n return t & 0x100;\n}\n\nstatic inline bool gfx_gasoline_param_type_is_static (GfxGslParamType t)\n{\n return t & 0x200;\n}\n\nstatic inline bool gfx_gasoline_param_type_is_int (GfxGslParamType t)\n{\n return t & 0x010;\n}\n\n/** Tagged union of the various values that can go into a shader param. */\nstruct GfxGslParam {\n GfxGslParamType t; \n\n // Default value, which is important for shader compilation only if t is a texture type.\n GfxGslFloatVec fs;\n GfxGslIntVec is;\n\n private:\n GfxGslParam (GfxGslParamType t, const GfxGslFloatVec &fs)\n : t(t), fs(fs), is(GfxGslIntVec(0))\n { }\n\n GfxGslParam (GfxGslParamType t, const GfxGslIntVec &is)\n : t(t), fs(GfxGslFloatVec(0)), is(is)\n { }\n\n public:\n\n GfxGslParam (void) { }\n // This form for textures.\n GfxGslParam (GfxGslParamType t, float r, float g, float b, float a)\n : t(t), fs(r, g, b, a), is(0)\n { }\n\n // These for regular params.\n static GfxGslParam int1 (int r)\n { return GfxGslParam(GFX_GSL_INT1, GfxGslIntVec(r)); }\n static GfxGslParam int2 (int r, int g)\n { return GfxGslParam(GFX_GSL_INT2, GfxGslIntVec(r, g)); }\n static GfxGslParam int3 (int r, int g, int b)\n { return GfxGslParam(GFX_GSL_INT3, GfxGslIntVec(r, g, b)); }\n static GfxGslParam int4 (int r, int g, int b, int a)\n { return GfxGslParam(GFX_GSL_INT4, GfxGslIntVec(r, g, b, a)); }\n static GfxGslParam float1 (float r)\n { return GfxGslParam(GFX_GSL_FLOAT1, GfxGslFloatVec(r)); }\n static GfxGslParam float2 (float r, float g)\n { return GfxGslParam(GFX_GSL_FLOAT2, GfxGslFloatVec(r, g)); }\n static GfxGslParam float3 (float r, float g, float b)\n { return GfxGslParam(GFX_GSL_FLOAT3, GfxGslFloatVec(r, g, b)); }\n static GfxGslParam float4 (float r, float g, float b, float a)\n { return GfxGslParam(GFX_GSL_FLOAT4, GfxGslFloatVec(r, g, b, a)); }\n GfxGslParam (const Vector2 &v) : t(GFX_GSL_FLOAT2), fs(v.x, v.y, 0, 0), is(0) { }\n GfxGslParam (const Vector3 &v) : t(GFX_GSL_FLOAT3), fs(v.x, v.y, v.z, 0), is(0) { }\n GfxGslParam (const Vector4 &v) : t(GFX_GSL_FLOAT4), fs(v.x, v.y, v.z, v.w), is(0) { }\n GfxGslParam setStatic(void) {\n APP_ASSERT(!gfx_gasoline_param_type_is_texture(t));\n GfxGslParam r = *this;\n r.t = GfxGslParamType(r.t | 0x200);\n return r;\n }\n GfxGslParam clearStatic(void) {\n APP_ASSERT(!gfx_gasoline_param_type_is_texture(t));\n GfxGslParam r = *this;\n r.t = GfxGslParamType(r.t & ~0x200);\n return r;\n }\n GfxGslParam copyStaticFrom(const GfxGslParam &other) {\n APP_ASSERT(!gfx_gasoline_param_type_is_texture(t));\n GfxGslParam r = this->clearStatic();\n if (gfx_gasoline_param_type_is_static(other.t))\n r = r.setStatic();\n return r;\n }\n}; \n \nstatic inline bool gfx_gasoline_param_is_texture (const GfxGslParam &p)\n{\n return gfx_gasoline_param_type_is_texture(p.t);\n}\n\nstatic inline bool gfx_gasoline_param_is_static (const GfxGslParam &p)\n{\n return gfx_gasoline_param_type_is_static(p.t);\n}\n\nstatic inline bool gfx_gasoline_param_is_int (const GfxGslParam &p)\n{\n return gfx_gasoline_param_type_is_int(p.t);\n}\n\nstd::ostream &operator<< (std::ostream &o, const GfxGslParam &p);\nbool operator== (const GfxGslParam &a, const GfxGslParam &b);\n\nnamespace std {\n template<> struct hash<GfxGslParam> {\n size_t operator()(const GfxGslParam &a) const\n {\n size_t r = 0;\n r = r * 31 + my_hash(a.t);\n if (gfx_gasoline_param_is_int(a))\n r = r * 31 + my_hash(a.is);\n else\n r = r * 31 + my_hash(a.fs);\n return r;\n }\n };\n}\n\n\n/*\nstatic inline const char *to_string (const GfxGslParam &p)\n{\n return to_string(p.t);\n}\nstatic inline std::ostream &operator<< (std::ostream &o, const GfxGslParam &p)\n{\n o << to_string(p);\n return o;\n}\n*/\n\ntypedef std::map<std::string, GfxGslParam> GfxGslRunParams;\n// If maps to false, texture should use static value (from TextureType).\n// If maps to true, texture is a solid uniform with the same name.\ntypedef std::map<std::string, bool> GfxGslUnboundTextures;\n\nstatic inline std::ostream &operator<< (std::ostream &o, const GfxGslUnboundTextures &ubt)\n{\n bool any = false;\n const char *prefix = \"{\";\n for (const auto &pair : ubt) {\n any = true;\n o << prefix;\n o << pair.first;\n o << \":\";\n o << pair.second;\n prefix = \",\";\n }\n if (!any) o << \"{\";\n o << \"}\";\n return o;\n}\n\nstruct GfxGasolineResult {\n std::string vertexShader;\n std::string fragmentShader;\n};\n\n// The stdlib is missing these for some reason.\nnamespace std {\n template<typename T, size_t N> struct hash<array<T, N> > {\n typedef array<T, N> argument_type;\n typedef size_t result_type;\n result_type operator()(const argument_type& a) const\n {\n result_type h = 0;\n for (result_type i = 0; i < N; ++i)\n h = h * 31 + my_hash(a[i]);\n return h;\n }\n };\n template<typename K, typename V> struct hash<map<K, V> > {\n typedef map<K, V> argument_type;\n typedef size_t result_type;\n result_type operator()(const argument_type& a) const\n {\n result_type h = 0;\n for (typename argument_type::const_iterator i=a.begin(), i_=a.end() ; i!=i_ ; ++i) {\n h = h * 31 + my_hash(i->first);\n h = h * 31 + my_hash(i->second);\n }\n return h;\n }\n };\n template<typename T> struct hash<set<T> > {\n typedef set<T> argument_type;\n typedef size_t result_type;\n result_type operator()(const argument_type& a) const\n {\n result_type h = 0;\n for (typename argument_type::const_iterator i=a.begin(), i_=a.end() ; i!=i_ ; ++i) {\n h = h * 31 + my_hash(*i);\n }\n return h;\n }\n };\n}\n\n/** Things that affect gsl compilation and vary between different geometry using the same material.\n */\nstruct GfxGslMeshEnvironment {\n unsigned boneWeights;\n bool instanced;\n\n GfxGslMeshEnvironment (void)\n : boneWeights(0), instanced(false)\n { }\n\n bool operator== (const GfxGslMeshEnvironment &other) const\n {\n return other.boneWeights == boneWeights\n && other.instanced == instanced;\n }\n};\nnamespace std {\n template<> struct hash<GfxGslMeshEnvironment> {\n size_t operator()(const GfxGslMeshEnvironment &a) const\n {\n size_t r = 0;\n r = r * 31 + my_hash(a.boneWeights);\n r = r * 31 + my_hash(a.instanced);\n return r;\n }\n };\n}\nstatic inline std::ostream &operator << (std::ostream &o, const GfxGslMeshEnvironment &e)\n{\n o << \"[\";\n o << (e.instanced ? \"I\" : \"i\");\n o << e.boneWeights;\n o << \"]\";\n return o;\n}\n\n\n/** Things that affect gsl compilation but are constant throughout the frame.\n */\nstruct GfxGslConfigEnvironment {\n\n unsigned envBoxes;\n unsigned shadowRes;\n typedef std::array<float, 3> F3;\n F3 shadowDist;\n F3 shadowSpread;\n float shadowFadeStart;\n float shadowFadeEnd;\n float shadowFactor;\n float shadowFilterSize;\n unsigned shadowFilterTaps;\n enum ShadowDitherMode {\n SHADOW_DITHER_NONE,\n SHADOW_DITHER_NOISE,\n SHADOW_DITHER_PLAIN\n } shadowDitherMode;\n\n GfxGslConfigEnvironment (void)\n : envBoxes(0), shadowRes(512), shadowDist(F3{{10, 20, 30}}), shadowSpread(F3{{1, 1, 1}}),\n shadowFadeStart(50), shadowFadeEnd(60), shadowFactor(5000), shadowFilterSize(1),\n shadowFilterTaps(0), shadowDitherMode(SHADOW_DITHER_NONE)\n { }\n bool operator== (const GfxGslConfigEnvironment &other) const\n {\n return other.envBoxes == envBoxes\n && other.shadowRes == shadowRes\n && other.shadowDist == shadowDist\n && other.shadowSpread == shadowSpread\n && other.shadowFadeStart == shadowFadeStart\n && other.shadowFadeEnd == shadowFadeEnd\n && other.shadowFactor == shadowFactor\n && other.shadowFilterSize == shadowFilterSize\n && other.shadowFilterTaps == shadowFilterTaps\n && other.shadowDitherMode == shadowDitherMode;\n }\n};\nnamespace std {\n template<> struct hash<GfxGslConfigEnvironment> {\n size_t operator()(const GfxGslConfigEnvironment &a) const\n {\n size_t r = 0;\n r = r * 31 + my_hash(a.envBoxes);\n r = r * 31 + my_hash(a.shadowRes);\n r = r * 31 + my_hash(a.shadowDist);\n r = r * 31 + my_hash(a.shadowSpread);\n r = r * 31 + my_hash(a.shadowFadeStart);\n r = r * 31 + my_hash(a.shadowFadeEnd);\n r = r * 31 + my_hash(a.shadowFactor);\n r = r * 31 + my_hash(a.shadowFilterSize);\n r = r * 31 + my_hash(a.shadowFilterTaps);\n r = r * 31 + my_hash(unsigned(a.shadowDitherMode));\n return r;\n }\n };\n}\nstatic inline std::ostream &operator << (std::ostream &o, const GfxGslConfigEnvironment::F3 &v)\n{\n o << \"(\" << v[0] << \",\" << v[1] << \",\" << v[2] << \")\";\n return o;\n}\nstatic inline std::ostream &operator << (std::ostream &o, const GfxGslConfigEnvironment &e)\n{\n o << \"[\";\n o << e.envBoxes;\n o << \"S(\" << e.shadowRes << \",\" << e.shadowDist << \",\" << e.shadowSpread << \",\"\n << e.shadowFadeStart << \",\" << e.shadowFadeEnd << \",\" << e.shadowFactor << \",\"\n << e.shadowFilterSize << \",\" << e.shadowFilterTaps << \",\" << unsigned(e.shadowDitherMode)\n << \")\";\n o << \"]\";\n return o;\n}\n\n\n/** Things that affect gsl compilation and vary from material to material.\n */\nstruct GfxGslMaterialEnvironment {\n // Varies depending on whether we're blending alpha or not.\n bool fadeDither;\n // What textures should be bound as a uniform (true) or static solid colour (false)\n // The static solid colour is found in the params (it's the default).\n GfxGslUnboundTextures ubt;\n // Actual values for static params that will be inlined in the generated code.\n GfxGslRunParams staticValues;\n\n GfxGslMaterialEnvironment (void)\n : fadeDither(false)\n { }\n bool operator== (const GfxGslMaterialEnvironment &other) const\n {\n return other.fadeDither == fadeDither\n && other.ubt == ubt\n && other.staticValues == staticValues;\n }\n};\nnamespace std {\n template<> struct hash<GfxGslMaterialEnvironment> {\n size_t operator()(const GfxGslMaterialEnvironment &a) const\n {\n size_t r = 0;\n r = r * 31 + my_hash(a.fadeDither);\n r = r * 31 + my_hash(a.ubt);\n r = r * 31 + my_hash(a.staticValues);\n return r;\n }\n };\n}\nstatic inline std::ostream &operator << (std::ostream &o, const GfxGslMaterialEnvironment &e)\n{\n o << \"[\";\n o << (e.fadeDither ? \"F\" : \"f\");\n o << e.ubt;\n o << e.staticValues;\n o << \"]\";\n return o;\n}\n\n\n\n/** All additional metadata for building a given shader. Each shader is built for a single\n * set of these values only. */\nstruct GfxGslMetadata {\n // What the shader needs from all materials (types).\n GfxGslRunParams params;\n // Environment\n GfxGslConfigEnvironment cfgEnv;\n GfxGslMaterialEnvironment matEnv;\n GfxGslMeshEnvironment meshEnv;\n bool d3d9;\n bool internal;\n bool lightingTextures;\n};\n\nvoid gfx_gasoline_check (const std::string &vert_prog,\n const std::string &dangs_prog,\n const std::string &additional_prog,\n const GfxGslMetadata &md);\n\nenum GfxGslPurpose {\n // Rasterise model, write dangs to gbuffer\n GFX_GSL_PURPOSE_FORWARD,\n\n // Rasterise model, compute sun + env lighting\n GFX_GSL_PURPOSE_ALPHA,\n\n // Rasterise model in view space, compute sun, env, additional lighting\n GFX_GSL_PURPOSE_FIRST_PERSON,\n\n // Rasterise model in view space, Fragments are all white\n GFX_GSL_PURPOSE_FIRST_PERSON_WIREFRAME,\n\n // Rasterise model, write additional lighting to hdr buf (additive)\n GFX_GSL_PURPOSE_ADDITIONAL,\n\n // Rasterise model, use dangs but ignore result (discard only)\n // Render appropriately-biased depth into a depth shadowmap (float32)\n GFX_GSL_PURPOSE_CAST,\n\n // Rasterise model, fragments are all white\n GFX_GSL_PURPOSE_WIREFRAME,\n\n\n // Rasterise model at camera, flatten z to max range\n GFX_GSL_PURPOSE_SKY,\n\n // Rasterise model, only additional used\n GFX_GSL_PURPOSE_HUD,\n\n // Not yet implemented.\n GFX_GSL_PURPOSE_DECAL,\n\n // Fullscreen quad for deferred lighting, writes depth from gbuffer.\n GFX_GSL_PURPOSE_DEFERRED_AMBIENT_SUN,\n};\n\nstatic inline bool gfx_gasoline_does_lighting(GfxGslPurpose p)\n{\n switch (p) {\n case GFX_GSL_PURPOSE_FORWARD: return false;\n case GFX_GSL_PURPOSE_ALPHA: return true;\n case GFX_GSL_PURPOSE_FIRST_PERSON: return true;\n case GFX_GSL_PURPOSE_FIRST_PERSON_WIREFRAME: return false;\n case GFX_GSL_PURPOSE_ADDITIONAL: return false;\n case GFX_GSL_PURPOSE_CAST: return false;\n case GFX_GSL_PURPOSE_WIREFRAME: return false;\n case GFX_GSL_PURPOSE_SKY: return false;\n case GFX_GSL_PURPOSE_HUD: return false;\n case GFX_GSL_PURPOSE_DECAL: return true;\n case GFX_GSL_PURPOSE_DEFERRED_AMBIENT_SUN: return true;\n }\n return false; // Why does compiler need this?\n}\n\nGfxGasolineResult gfx_gasoline_compile (GfxGslPurpose purpose,\n GfxGslBackend backend,\n const std::string &vert_prog,\n const std::string &dangs_prog,\n const std::string &additional_prog,\n const GfxGslMetadata &md);\n#endif\n" }, { "alpha_fraction": 0.5167807340621948, "alphanum_fraction": 0.5257738828659058, "avg_line_length": 32.066810607910156, "blob_id": "f687c9a348808b8c4d89dea87d9b589516f740b5", "content_id": "e65ba437e81ed78e17edea72d5e089cff3d8b2bb", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 15345, "license_type": "permissive", "max_line_length": 103, "num_lines": 464, "path": "/dependencies/quex-0.34.1/quex/frs_py/file_in.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "#! /usr/bin/env python\n# Quex is free software; you can redistribute it and/or modify it under the\n# terms of the GNU Lesser General Public License as published by the Free\n# Software Foundation; either version 2.1 of the License, or (at your option)\n# any later version.\n# \n# This software is distributed in the hope that it will be useful, but WITHOUT\n# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more\n# details.\n# \n# You should have received a copy of the GNU Lesser General Public License along\n# with this library; if not, write to the Free Software Foundation, Inc., 59\n# Temple Place, Suite 330, Boston, MA 02111-1307 USA\n#\n################################################################################\nimport os\nimport sys\nimport codecs\nfrom copy import copy\nfrom string import split\n\nclass EndOfStreamException(Exception):\n pass\n\ntemporary_files = []\n\ndef skip_whitespace(fh):\n def __skip_until_newline(fh):\n tmp = \"\"\n while tmp != '\\n':\n tmp = fh.read(1)\n if tmp == \"\": raise EndOfStreamException()\n\n while 1 + 1 == 2:\n tmp = fh.read(1)\n\n if tmp.isspace(): continue\n elif tmp == \"\": raise EndOfStreamException()\n\n # -- character was not a whitespace character\n # => is there a '//' or a '/*' -comment ?\n tmp2 = fh.read(1)\n if tmp2 == \"\": fh.seek(-1, 1); return\n\n tmp += tmp2\n if tmp == \"//\": \n __skip_until_newline(fh)\n\n elif tmp == \"/*\":\n # skip until '*/'\n previous = \" \"\n while tmp != \"\":\n tmp = fh.read(1)\n if tmp == \"\": raise EndOfStreamException()\n if previous + tmp == \"*/\":\n break\n previous = tmp\n else:\n # no whitespace, no comment --> real character\n fh.seek(-2, 1)\n return \n\ndef is_identifier_start(character):\n char_value = ord(character)\n return character == \"_\" \\\n or (char_value >= ord('a') and char_value <= ord('z')) \\\n or (char_value >= ord('A') and char_value <= ord('Z'))\n\ndef is_identifier_continue(character):\n char_value = ord(character)\n return is_identifier_start(character) \\\n or (char_value >= ord('0') and char_value <= ord('9'))\n\ndef is_identifier(identifier):\n if identifier == \"\": return False\n\n if is_identifier_start(identifier[0]) == False: return False\n if len(identifier) == 1: return True\n\n for letter in identifier[1:]:\n if is_identifier_continue(letter) == False: return False\n\n return True\n\ndef read_identifier(fh):\n txt = fh.read(1)\n if txt == \"\": return \"\"\n if is_identifier_start(txt) == False: fh.seek(-1, 1); return \"\"\n\n while 1 + 1 == 2:\n tmp = fh.read(1)\n if tmp == \"\": return txt\n\n if is_identifier_continue(tmp): txt += tmp\n else: fh.seek(-1, 1); return txt\n\ndef find_end_of_identifier(Txt, StartIdx, L):\n for i in range(StartIdx, L):\n if not is_identifier_continue(Txt[i]): return i\n else:\n return L\n\ndef get_text_line_n(Txt, Pos):\n line_n = 1\n for i in range(0, Pos):\n if Txt[i] == \"\\n\": line_n += 1\n return line_n\n\ndef delete_comment(Content, Opener, Closer, LeaveNewlineDelimiter=False):\n # delete comment lines in C++ form\n new_content = \"\"\n prev_i = 0\n while 1 + 1 == 2:\n i = Content.find(Opener, prev_i)\n if i == -1: \n new_content += Content[prev_i:]\n break\n new_content += Content[prev_i:i]\n prev_i = i + len(Opener)\n i = Content.find(Closer, prev_i)\n if i == -1: break\n if LeaveNewlineDelimiter:\n new_content += \"\\n\" * Content[prev_i:i+len(Closer)].count(\"\\n\")\n prev_i = i + len(Closer)\n\n return new_content\n\ndef read_integer(fh):\n pos = fh.tell()\n tmp = fh.read(1)\n txt = \"\"\n while tmp.isdigit() or tmp in \"abcdefABCDEF\":\n txt += tmp\n tmp = fh.read(1)\n fh.seek(-1, 1)\n return txt\n\ndef extract_identifiers_with_specific_prefix(Content, Prefix):\n L = len(Content)\n i = 0\n finding_list = []\n while 1 + 1 == 2:\n i = Content.find(Prefix, i)\n # not found?\n if i == -1: break\n # is it inside an identifier?\n if i != 0 and is_identifier_start(Content[i-1]): i += 1; continue\n end_i = find_end_of_identifier(Content, i, L)\n finding_list.append([Content[i:end_i], get_text_line_n(Content, i)])\n i = end_i\n return finding_list\n\ndef read_until_whitespace(fh):\n txt = \"\"\n previous_tmp = \"\"\n while 1 + 1 == 2:\n tmp = fh.read(1)\n if tmp == \"\": \n if txt == \"\": raise EndOfStreamException()\n else: return txt\n\n elif tmp.isspace(): fh.seek(-1, 1); return txt\n elif previous_tmp == \"/\" and (tmp in [\"*\", \"/\"]): fh.seek(-2, 1); return txt[:-1]\n txt += tmp\n previous_tmp = tmp\n\ndef read_until_closing_bracket(fh, Opener, Closer,\n IgnoreRegions = [ ['\"', '\"'], # strings\n ['\\'', '\\''], # characters\n [\"//\", \"\\n\"], # c++ comments\n [\"/*\", \"*/\"] ], # c comments\n SkipClosingDelimiterF = True): \n \"\"\"This function does not eat the closing bracket from the stream.\n \"\"\" \n # print \"# # read_until_closing_bracket: \", Opener, \", \", Closer, \", \", IgnoreRegions\n\n open_brackets_n = 1\n backslash_f = False\n txt = \"\"\n CacheSz = max(len(Opener), len(Closer))\n if IgnoreRegions != []: \n # check for correct type, because this can cause terrible errors\n assert type(IgnoreRegions) == list\n\n for element in IgnoreRegions: \n assert type(element) == list\n \n CacheSz = max(map(lambda delimiter: len(delimiter[0]), IgnoreRegions) + [ CacheSz ])\n\n cache = [\"\\0\"] * CacheSz\n\n def match_against_cache(Delimiter):\n \"\"\"Determine wether the string 'Delimiter' is flood into the cache or not.\"\"\"\n assert len(Delimiter) <= len(cache), \\\n \"error: read_until_closing_bracket() cache smaller than delimiter\"\n\n # delimiter == \"\" means that it is, in fact, not a delimiter (disabled) \n if Delimiter == \"\": return False\n L = len(Delimiter)\n i = -1\n for letter in Delimiter:\n i += 1\n if letter != cache[L-i-1]: return False\n return True\n\n # ignore_start_triggers = map(lamda x: x[0], IgnoreRegions)\n while 1 + 1 == 2:\n tmp = fh.read(1)\n txt += tmp\n cache.insert(0, tmp) # element 0 last element flood into cache (current)\n cache.pop(-1) # element N first element (oldest)\n\n if tmp == \"\": \n raise EndOfStreamException()\n\n elif tmp == \"\\\\\": \n backslash_f = not backslash_f # every second backslash switches to 'non-escape char'\n continue\n\n if not backslash_f:\n result = match_against_cache(Opener)\n if match_against_cache(Opener):\n open_brackets_n += 1\n elif match_against_cache(Closer):\n open_brackets_n -= 1\n if open_brackets_n == 0: \n # stop accumulating text when the closing delimiter is reached. do not \n # append the closing delimiter to the text. \n txt = txt[:-len(Closer)]\n break\n\n backslash_f = False\n\n for delimiter in IgnoreRegions:\n # If the start delimiter for ignored regions matches the strings recently in flooded into\n # the cache, then read until the end of the region that is to be ignored.\n if match_against_cache(delimiter[0]): \n ## print \"##cache = \", cache\n position = fh.tell()\n try:\n txt += read_until_closing_bracket(fh, \"\", delimiter[1], IgnoreRegions=[]) \n except:\n fh.seek(position)\n error_msg(\"Unbalanced '%s', reached end of file before closing '%s' was found.\" % \\\n (delimiter[0].replace(\"\\n\", \"\\\\n\"),\n delimiter[1].replace(\"\\n\", \"\\\\n\")),\n fh)\n\n txt += delimiter[1]\n # the 'ignore region info' may contain information about with what the\n # closing delimiter is to be replaced\n ## print \"##ooo\", txt\n # flush the cache\n cache = [\"\\0\"] * CacheSz\n break\n \n return txt\n\ndef read_until_character(fh, Character):\n open_brackets_n = 1\n backslash_n = 0\n txt = \"\"\n\n # ignore_start_triggers = map(lamda x: x[0], IgnoreRegions)\n # TODO: incorporate \"comment ignoring\"\n while 1 + 1 == 2:\n tmp = fh.read(1)\n if tmp == \"\": raise EndOfStreamException()\n elif tmp == \"\\\\\": backslash_n += 1\n else:\n backslash_n = 0\n if backslash_n % 2 != 1:\n if tmp == Character:\n return txt\n txt += tmp\n\n return txt\n\ndef read_until_letter(fh, EndMarkers, Verbose=False):\n txt = \"\"\n while 1 + 1 == 2:\n tmp = fh.read(1)\n if tmp == \"\": \n if Verbose: return \"\", -1\n else: return \"\"\n\n if tmp in EndMarkers:\n if Verbose: return txt, EndMarkers.index(tmp)\n else: return txt\n txt += tmp\n\ndef read_until_non_letter(fh):\n txt = \"\"\n tmp = \"\"\n while 1 + 1 == 2:\n tmp = fh.read(1)\n if tmp.isalpha(): txt += tmp\n else: break\n return txt\n \ndef read_until_line_contains(in_fh, LineContent):\n L = len(LineContent)\n\n line = in_fh.readline()\n if line == \"\": return \"\"\n\n collector = \"\"\n while line.find(LineContent) == -1:\n collector += line\n line = in_fh.readline()\n if line == \"\": break\n\n return collector\n\ndef get_plain_file_content(FileName):\n fh = open_file_or_die(FileName)\n txt = \"\"\n for line in fh.readlines(): txt += line\n return txt\n\ndef get_current_line_info_number(fh):\n position = fh.tell()\n line_n = 0\n fh.seek(0)\n for i in range(position):\n if fh.read(1) == '\\n': line_n += 1\n\n # just to be sure without having to test this stuff ...\n fh.seek(position)\n return line_n\n\ndef clean_up():\n # -- delete temporary files\n for file in temporary_files:\n os.system(\"rm %s\" % file)\n\ndef open_file_or_die(FileName, Mode=\"rb\", Env=None, Codec=\"\"):\n try:\n fh = open(FileName, Mode)\n # if Codec != \"\": \n # enc, dec, reader, writer = codecs.lookup('utf-8')\n # fh = reader(fh)\n return fh\n\n except:\n if Env != None:\n error_msg(\"is environment variable '%s' set propperly?\" % Env, DontExitF=True)\n error_msg(\"cannot open file '%s'\" % FileName)\n sys.exit(-1)\n\ndef indented_open(Filename, Indentation = 3):\n \"\"\"Opens a file but indents all the lines in it. In fact, a temporary\n file is created with all lines of the original file indented. The filehandle\n returned points to the temporary file.\"\"\"\n \n IndentString = \" \" * Indentation\n \n try:\n fh = open(Filename, \"rb\")\n except:\n print \"%s:error: indented opening of file '%s' \" % (this_name, Filename)\n sys.exit(-1)\n new_content = \"\"\n for line in fh.readlines():\n new_content += IndentString + line\n fh.close()\n\n tmp_filename = Filename + \".tmp\"\n\n if tmp_filename not in temporary_files:\n temporary_files.append(copy(tmp_filename))\n\n fh = open(tmp_filename, \"wb\")\n fh.write(new_content)\n fh.close()\n\n fh = open(tmp_filename)\n\n return fh\n\ndef read_next_word(fh):\n skip_whitespace(fh)\n word = read_until_whitespace(fh)\n\n if word == \"\": raise EndOfStreamException()\n return word\n\ndef read_word_list(fh, EndMarkers, Verbose=False):\n \"\"\"Reads whitespace separated words until the arrivel\n of a string mentioned in the array 'EndMarkers'. If\n the Verbose flag is set not only the list of found words\n is returned. Moreover the index of the end marker which\n triggered is given as a second return value.\"\"\"\n word_list = []\n while 1 + 1 == 2:\n skip_whitespace(fh)\n word = read_next_word(fh) \n if word == \"\": raise EndOfStreamException()\n if word in EndMarkers:\n if Verbose: return word_list, EndMarkers.index(word)\n else: return word_list\n word_list.append(word)\n\ndef verify_next_word(fh, Compare, Quit=True, Comment=\"\"):\n word = read_next_word(fh)\n if word != Compare:\n txt = \"Missing token '%s'. found '%s'.\" % (Compare, word)\n if Comment != \"\": \n txt += \"\\n\" + Comment\n error_msg(txt, fh)\n return word\n \ndef error_msg(ErrMsg, fh=-1, LineN=None, DontExitF=False, Prefix=\"\"):\n # fh = filehandle [1] or filename [2]\n # LineN = line_number of error\n # DontExitF = True then no exit from program\n # = False then total exit from program\n #\n # count line numbers (this is a kind of 'dirty' solution for not\n # counting line numbers on the fly. it does not harm at all and\n # is much more direct to be programmed.)\n\n if fh == -1:\n if Prefix == \"\": prefix = \"command line\"\n else: prefix = Prefix\n\n elif fh == \"assert\":\n if type(LineN) != str: \n error_msg(\"3rd argument needs to be a string,\\n\" + \\\n \"if message type == 'assert'\", \"assert\", \n \"file_in.error_msg()\")\n file_name = LineN \n prefix = \"internal assert:\" + file_name + \":\" \n else:\n if type(fh) == str:\n line_n = LineN\n Filename = fh \n else:\n if fh != None:\n line_n = get_current_line_info_number(fh)\n Filename = fh.name\n else:\n line_n = -1\n Filename = \"\"\n if DontExitF: \n prefix = \"%s:%i:warning\" % (Filename, line_n + 1) \n else:\n prefix = \"%s:%i:error\" % (Filename, line_n + 1) \n \n for line in split(ErrMsg, \"\\n\"):\n print prefix + \": %s\" % line\n\n if not DontExitF: sys.exit(-1)\n\ndef get_include_guard_extension(Filename):\n \"\"\"Transforms the letters of a filename, so that they can appear in a C-macro.\"\"\"\n include_guard_extension = \"\"\n for letter in Filename:\n if letter.isalpha() or letter.isdigit() or letter == \"_\":\n include_guard_extension += letter.upper()\n else:\n include_guard_extension += \"_x%x_\" % ord(letter)\n return include_guard_extension\n\n\n" }, { "alpha_fraction": 0.523676872253418, "alphanum_fraction": 0.523676872253418, "avg_line_length": 25.899999618530273, "blob_id": "ebf1583990ff32c32f30277e758ee28fbc6f6c04", "content_id": "c66065208a1720678e6b04862e74dd7d1d487252", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 1077, "license_type": "permissive", "max_line_length": 75, "num_lines": 40, "path": "/dependencies/quex-0.34.1/demo/007/simple.qx", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "// -*- C++ -*- vim: set syntax=cpp:\nstart = DERIVED;\n\nmode BASE :\n<inheritable: only> \n{ \n <<EOF>> {\n self.send(quex::token::ID_TERMINATION);\n RETURN;\n }\n \".\" => QUEX_TKN_PERIOD;\n \",\" => QUEX_TKN_PERIOD;\n \"Fischer's\" => QUEX_TKN_FISCHERS;\n [a-z]+ => QUEX_TKN_FISCHES(Lexeme);\n \"Fritz\" => QUEX_TKN_FRITZ;\n [A-Z][a-z]+ => QUEX_TKN_FISCH(Lexeme);\n \"Nothing\" => QUEX_TKN_NOTHING;\n\n // Test, that the skippers follow the same rule as every other pattern:\n // longer match precedes. Earlier match precedes.\n \"/*-+\" => QUEX_TKN_MATH_OPERATOR_LIST;\n}\n\n\nmode DERIVED : BASE\n<skip: [ \\n\\t]>\n<skip_range: \"/*\" \"*/\">\n<skip_range: \"//\" \"\\n\">\n{\n \"Nothing\" DELETION;\n\n \"grabs\" => QUEX_TKN_GRABS;\n \"Swordfish\" => QUEX_TKN_SWORDFISH;\n [a-z]+ PRIORITY-MARK;\n \"hunts\" => QUEX_TKN_FOOLS_AROUND;\n \"Trouts\" => QUEX_TKN_TROUTS;\n [A-Z][a-z]+ PRIORITY-MARK;\n \"catches\" => QUEX_TKN_FOOLS_AROUND;\n \"Sharks\" => QUEX_TKN_SOMETHING_IMPOSSIBLE;\n}\n\n" }, { "alpha_fraction": 0.4933868646621704, "alphanum_fraction": 0.4971657991409302, "avg_line_length": 32.33464431762695, "blob_id": "05fd6c899fe05c0b673934d27b0bf55b3fd1227a", "content_id": "bd12edc363baae59203adb265c9a7759abbadd54", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 8468, "license_type": "permissive", "max_line_length": 125, "num_lines": 254, "path": "/engine/doc/grit_book/unparse_html.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "#!/usr/bin/python\n\nimport codecs\nimport textwrap\nfrom xml.sax.saxutils import escape\n\nfrom pygments import highlight\nfrom pygments.formatters import HtmlFormatter\n\nimport pygments_lexers\nfrom translate_xml import *\n\n\ndef GetParentIndex(node):\n i = 0\n for c in node.parent:\n if c.kind == 'Section':\n i += 1\n if c == node:\n return i\n return None\n \n\ndef GetPath(node):\n if not node.parent:\n return []\n here = []\n if node.kind == 'Section':\n here = [str(GetParentIndex(node))]\n return GetPath(node.parent) + here\n\n\ndef GetLinkToNode(target):\n the_file = GetOutputFile(target)\n if the_file.id == target.id:\n return '%s.html' % the_file.id\n else:\n return '%s.html#%s' % (the_file.id, target.id)\n\n\ndef GetPathString(node):\n return '.'.join(GetPath(node))\n\n\ndef GeneratePage(title, content, book):\n s = '''<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\n\n<head>\n <title>Grit Book V0.1 - ''' + title + '''</title>\n <meta http-equiv=\"Content-type\" content=\"text/html;charset=UTF-8\" />\n <link rel=\"stylesheet\" type=\"text/css\" href=\"grit_book.css\" />\n <link rel=\"stylesheet\" type=\"text/css\" href=\"pygments.css\" />\n <link rel=\"icon\" type=\"image/png\" href=\"logo_tiny.png\" />\n <script type=\"text/javascript\">\n\n var menu_timeout = null;\n\n function set_visible(menu, b)\n {\n var category = menu.children[0];\n var dropdown = menu.children[1];\n if (dropdown != null) {\n dropdown.style.visibility = b ? 'visible' : 'hidden';\n }\n }\n\n function menu_open(el)\n {\n menu_close_all();\n var menu = el;\n while (menu.id === \"\") {\n menu = menu.parentNode;\n }\n set_visible(menu, true);\n }\n\n function menu_leave()\n {\n if (menu_timeout != null) {\n window.clearTimeout(menu_timeout);\n }\n menu_timeout = window.setTimeout(menu_close_all, 300);\n }\n\n function menu_close_all()\n {\n var mb = document.getElementById(\"menubar\");\n if (mb == null) return;\n var menus = mb.children;\n for (var i = 0 ; i < menus.length ; ++i) {\n set_visible(menus[i], false);\n }\n if (menu_timeout != null) {\n window.clearTimeout(menu_timeout);\n window_timeout = null;\n }\n }\n\n document.onclick = menu_close_all(); \n\n </script>\n</head>\n\n<body>\n\n<div class=\"page\">\n\n\n<div class=\"header\">'''\n if book:\n s += '\\n <div id=\"complete\"><a href=\"complete.html\">Go to print version</a></div>'\n else:\n s += '\\n <div id=\"complete\"><a href=\"index.html\">Go to web version</a></div>'\n s += '\\n <div class=\"logo\"> </div>'\n if book:\n s += '\\n<ol id=\"menubar\">'\n s += '''\n <li id=\"menu_contents\">\n <a href=\"index.html\" onmouseover=\"menu_open(this)\" onmouseout=\"menu_leave()\">Contents</a>\n </li>\n'''\n for chapter_index, chapter in enumerate(book):\n s += '\\n <li id=\"%s\">' % chapter.id\n s += ('\\n <a href=\"%s.html\" onmouseover=\"menu_open(this)\" onmouseout=\"menu_leave()\">%d. %s</a>'\n % (chapter.id, chapter_index + 1, escape(chapter.title)))\n s += '\\n <div onmouseover=\"menu_open(this)\" onmouseout=\"menu_leave()\">'\n for section in chapter:\n if section.kind == 'Section':\n path_string = GetPathString(section)\n title = escape(section.title)\n url = GetLinkToNode(section)\n s += '\\n <a href=\"%s\">%s. %s</a>' % (url, path_string, title)\n s += '\\n </div>'\n s += '\\n </li>'\n s += '\\n <div style=\"clear: both\"></div>'\n s += '\\n </ol>'\n\n s += '''\n</div>\n\n<div class=\"content\">\n\n''' + content + '''</div> <!-- content -->\n\n\n</div> <!-- page -->\n\n</body>\n\n</html>\n'''\n return s\n\ndef UnparseHtmlInlines(parent, inner=False):\n s = \"\"\n for n in parent:\n if isinstance(n, basestring):\n s += escape(n)\n elif n.kind == 'Definition':\n s += '<span class=\"def\">'\n s += UnparseHtmlInlines(n.data, True)\n s += '</span>'\n elif n.kind == 'Issue':\n url = 'http://code.google.com/p/grit/issues/detail?id=%d' % n.id\n s += '<a class=\"issue\" href=\"%s\">issue %d</a>' % (url, n.id)\n elif n.kind == 'Emph':\n s += '<span class=\"emph\">%s</span>' % UnparseHtmlInlines(n.data, True)\n elif n.kind == 'Italic':\n s += '<span class=\"italic\">%s</span>' % UnparseHtmlInlines(n.data, True)\n elif n.kind == 'Code':\n s += '<code>%s</code>' % UnparseHtmlInlines(n.data, True)\n elif n.kind == 'Todo':\n s += '(<span class=\"todo\">TODO: %s</span>)' % UnparseHtmlInlines(n.data, True)\n elif n.kind == 'Web':\n s += '<a class=\"web\" href=\"' + n.url + '\">'\n s += UnparseHtmlInlines(n.data, True)\n s += '</a>'\n elif n.kind == 'SRef':\n content = UnparseHtmlInlines(n.data, True)\n s += '%s (<a class=\"index\" href=\"%s\">&sect;%s</a>)' % (content, GetLinkToNode(n.target), GetPathString(n.target))\n else:\n print 'ERROR: unknown node kind: ' + n.kind\n return s\n\n\ndef UnparseHtmlBlocks(book, parent, split_below, never_split):\n s = \"\"\n for n in parent:\n if n.kind == 'Image':\n s += '''<div class=\"image\">\n <div class=\"image-title\">''' + escape(n.title) + '''</div>\n <a class=\"image-link\" href=\"''' + escape(n.src) + '''\">\n <img class=\"thumbnail\" src=\"''' + escape(n.thumb_src) + '''\" />\n </a>\n <div class=\"image-caption\">''' + escape(n.caption) + '''</div>\n</div>\\n\\n'''\n elif n.kind == 'UnorderedList':\n s += '<ul>\\n\\n'\n for item in n.data:\n s += '<li>\\n\\n'\n s += UnparseHtmlBlocks(book, item, split_below, never_split)\n s += '</li>\\n\\n'\n s += '</ul>\\n\\n'\n elif n.kind == 'Section':\n new_path = GetPath(n)\n path_string = '.'.join(new_path)\n h = len(new_path)\n title = '<a class=index_nocol href=\"%s\">%s. %s</a>' % (GetLinkToNode(n), path_string, escape(n.title))\n inner_html = '<h%d id=\"%s\">%s</h%d>\\n\\n' % (h, n.id, title, h)\n inner_html += UnparseHtmlBlocks(book, n, n.split, never_split)\n if split_below and not never_split:\n filename = 'html/' + n.id + '.html'\n print 'Writing ' + filename\n f = codecs.open(filename, 'w', 'utf-8')\n f.write(GeneratePage(n.title, inner_html, book))\n f.close()\n else:\n s += inner_html\n elif n.kind == 'Preformatted':\n s += '<pre class=\"gritpre\">%s</pre>\\n\\n' % n.data\n elif n.kind == 'Gasoline':\n s += highlight(n.data, pygments_lexers.GasolineLexer(), HtmlFormatter())\n elif n.kind == 'Lua':\n s += highlight(n.data, pygments_lexers.GritLuaLexer(), HtmlFormatter())\n elif n.kind == 'Paragraph':\n s += '<p>\\n'\n s += '\\n'.join(textwrap.wrap(UnparseHtmlInlines(n.data)))\n s += '\\n</p>\\n\\n'\n else:\n print \"ERROR: unknown node kind: \" + n.kind\n if split_below and not never_split:\n s += BuildHtmlIndex(parent)\n return s\n\n\ndef BuildHtmlIndex(parent, indent=0):\n indentstr = ' ' * (indent*4)\n index = indentstr + '<ul>\\n'\n section_index = 0\n for n in parent:\n if n.kind == 'Section':\n section_index += 1\n path_string = GetPathString(n)\n title = escape(n.title)\n index += ' ' * ((indent+1)*4)\n url = GetLinkToNode(n)\n cls = 'index' if parent.split else 'index_nocol'\n index += '<li class=\"index\">%s. <a class=\"%s\" href=\"%s\">%s</a></li>\\n' % (path_string, cls, url, title)\n index += BuildHtmlIndex(n, indent+1)\n index += indentstr + '</ul>\\n'\n if section_index == 0:\n return ''\n return index\n\n" }, { "alpha_fraction": 0.5358476638793945, "alphanum_fraction": 0.5499128699302673, "avg_line_length": 30.3828125, "blob_id": "da4a882bc85cce9ec239bac3c259ba8dbb56f9ff", "content_id": "d7c62c9b283f65f1dc52f787eba03080d03e3539", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 8034, "license_type": "permissive", "max_line_length": 91, "num_lines": 256, "path": "/engine/external_table.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include \"external_table.h\"\n#include \"grit_lua_util.h\"\n#include \"lua_wrappers_primitives.h\"\n\nvoid ExternalTable::destroy (lua_State *L)\n{\n clear(L);\n}\n\nvoid ExternalTable::clear (lua_State *L)\n{\n for (StringMap::iterator i=fields.begin(), i_=fields.end() ; i != i_ ; ++i) {\n Value &v = i->second;\n if (v.type == 8) {\n v.func.setNil(L);\n } else if (v.type == 5) {\n v.t->destroy(L);\n }\n }\n for (NumberMap::iterator i=elements.begin(), i_=elements.end() ; i != i_ ; ++i) {\n Value &v = i->second;\n if (v.type == 8) {\n v.func.setNil(L);\n } else if (v.type == 5) {\n v.t->destroy(L);\n }\n }\n fields.clear();\n elements.clear();\n}\nconst char *ExternalTable::luaGet (lua_State *L) const\n{\n if (lua_type(L, -1) == LUA_TSTRING) {\n std::string key = lua_tostring(L, -1);\n return luaGet(L, key);\n } else if (lua_type(L, -1) == LUA_TNUMBER) {\n lua_Number key = luaL_checknumber(L, -1);\n return luaGet(L, key);\n }\n return \"key was not a string or number\";\n}\n\nstatic void push (lua_State *L, const ExternalTable::Value &v)\n{\n switch (v.type) {\n case 0:\n lua_pushnumber(L, v.real);\n break;\n case 1:\n lua_pushstring(L, v.str.c_str());\n break;\n case 2:\n push_v3(L, v.v3);\n break;\n case 3:\n push_quat(L, v.q);\n break;\n case 4:\n lua_pushboolean(L, v.b);\n break;\n case 5:\n v.t->dump(L);\n break;\n case 6:\n push(L, new Plot(v.plot), PLOT_TAG);\n break;\n case 7:\n push(L, new PlotV3(v.plot_v3), PLOT_V3_TAG);\n break;\n case 8:\n v.func.push(L);\n break;\n case 9:\n push_v2(L, v.v2);\n break;\n case 10:\n push_v4(L, v.v4);\n break;\n default:\n CERR << \"Unhandled ExternalTable type: \" << v.type << std::endl;\n }\n}\n\nconst char *ExternalTable::luaGet (lua_State *L, const std::string &key) const\n{\n auto it = fields.find(key);\n if (it == fields.end()) {\n lua_pushnil(L);\n } else {\n push(L, it->second);\n }\n return NULL;\n}\n\nconst char *ExternalTable::luaGet (lua_State *L, lua_Number key) const\n{\n auto it = elements.find(key);\n if (it == elements.end()) {\n lua_pushnil(L);\n } else {\n push(L, it->second);\n }\n return NULL;\n}\n\nconst char *ExternalTable::luaSet (lua_State *L)\n{\n if (lua_type(L, -2) == LUA_TSTRING) {\n std::string key = lua_tostring(L, -2);\n return luaSet(L, key);\n } else if (lua_type(L, -2) == LUA_TNUMBER) {\n lua_Number key = luaL_checknumber(L, -2);\n return luaSet(L, key);\n }\n return \"key was not a string or number\";\n}\n\nconst char *ExternalTable::luaSet (lua_State *L, const std::string &key)\n{\n if (lua_type(L, -1) == LUA_TNIL) {\n unset(key);\n } else if (lua_type(L, -1) == LUA_TSTRING) {\n std::string val = lua_tostring(L, -1);\n set(key, val);\n } else if (lua_type(L, -1) == LUA_TNUMBER) {\n lua_Number val = luaL_checknumber(L, -1);\n set(key, val);\n } else if (lua_type(L, -1) == LUA_TBOOLEAN) {\n bool val = check_bool(L, -1);\n set(key, val);\n } else if (lua_type(L, -1) == LUA_TVECTOR3) {\n Vector3 val = check_v3(L, -1);\n set(key, val);\n } else if (lua_type(L, -1) == LUA_TQUAT) {\n Quaternion val = check_quat(L, -1);\n set(key, val);\n } else if (is_userdata(L, -1, PLOT_TAG)) {\n GET_UD_MACRO(Plot, self, -1, PLOT_TAG);\n set(key, self);\n } else if (is_userdata(L, -1, PLOT_V3_TAG)) {\n GET_UD_MACRO(PlotV3, self, -1, PLOT_V3_TAG);\n set(key, self);\n } else if (lua_type(L, -1) == LUA_TTABLE) {\n SharedPtr<ExternalTable> self = SharedPtr<ExternalTable>(new ExternalTable());\n self->takeTableFromLuaStack(L, lua_gettop(L));\n set(key, self);\n } else if (lua_type(L, -1) == LUA_TFUNCTION) {\n Value &v = fields[key];\n v.func.setNoPop(L);\n v.type = 8;\n } else if (lua_type(L, -1) == LUA_TVECTOR2) {\n Vector2 val = check_v2(L, -1);\n set(key, val);\n } else if (lua_type(L, -1) == LUA_TVECTOR4) {\n Vector4 val = check_v4(L, -1);\n set(key, val);\n } else {\n return \"type not supported\";\n }\n return NULL;\n}\n\nconst char *ExternalTable::luaSet (lua_State *L, lua_Number key)\n{\n if (lua_type(L, -1) == LUA_TNIL) {\n unset(key);\n } else if (lua_type(L, -1) == LUA_TSTRING) {\n std::string val = lua_tostring(L, -1);\n set(key, val);\n } else if (lua_type(L, -1) == LUA_TNUMBER) {\n lua_Number val = luaL_checknumber(L, -1);\n set(key, val);\n } else if (lua_type(L, -1) == LUA_TBOOLEAN) {\n bool val = check_bool(L, -1);\n set(key, val);\n } else if (lua_type(L, -1) == LUA_TVECTOR3) {\n Vector3 val = check_v3(L, -1);\n set(key, val);\n } else if (lua_type(L, -1) == LUA_TQUAT) {\n Quaternion val = check_quat(L, -1);\n set(key, val);\n } else if (is_userdata(L, -1, PLOT_TAG)) {\n GET_UD_MACRO(Plot, self, -1, PLOT_TAG);\n set(key, self);\n } else if (is_userdata(L, -1, PLOT_V3_TAG)) {\n GET_UD_MACRO(PlotV3, self, -1, PLOT_V3_TAG);\n set(key, self);\n } else if (lua_type(L, -1) == LUA_TTABLE) {\n SharedPtr<ExternalTable> self = SharedPtr<ExternalTable>(new ExternalTable());\n self->takeTableFromLuaStack(L, -1);\n set(key, self);\n } else if (lua_type(L, -1) == LUA_TFUNCTION) {\n Value &v = elements[key];\n v.func.setNoPop(L);\n v.type = 8;\n } else if (lua_type(L, -1) == LUA_TVECTOR2) {\n Vector2 val = check_v2(L, -1);\n set(key, val);\n } else if (lua_type(L, -1) == LUA_TVECTOR4) {\n Vector4 val = check_v4(L, -1);\n set(key, val);\n } else {\n return \"type not supported\";\n }\n return NULL;\n}\n\nvoid ExternalTable::dump (lua_State *L) const\n{\n lua_createtable(L, elements.size(), fields.size());\n for (StringMap::const_iterator i=fields.begin(), i_=fields.end() ; i != i_ ; ++i) {\n const std::string &key = i->first;\n const Value &v = i->second;\n lua_pushstring(L, key.c_str());\n push(L, v);\n lua_rawset(L, -3);\n }\n for (NumberMap::const_iterator i=elements.begin(), i_=elements.end() ; i != i_ ; ++i) {\n lua_Number key = i->first;\n const Value &v = i->second;\n lua_pushnumber(L, key);\n push(L, v);\n lua_rawset(L, -3);\n }\n}\n\nvoid ExternalTable::takeTableFromLuaStack (lua_State *L, int tab)\n{\n if (tab<0) tab += 1 + lua_gettop(L);\n lua_checkstack(L, 2);\n for (lua_pushnil(L) ; lua_next(L, tab) != 0 ; lua_pop(L, 1)) {\n const char *err = luaSet(L);\n if (err) my_lua_error(L, err);\n }\n}\n" }, { "alpha_fraction": 0.6382343173027039, "alphanum_fraction": 0.6385661959648132, "avg_line_length": 50.94827651977539, "blob_id": "74fd6aab712a5ae6ffb131b1c6c4a3e3b6f32123", "content_id": "546ab24ea0b9291e641a0d2d28c4bc60b19373f0", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3013, "license_type": "permissive", "max_line_length": 102, "num_lines": 58, "path": "/dependencies/quex-0.34.1/quex/core_engine/state_machine/setup_pre_context.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "#! /usr/bin/env python\nimport sys\nimport os\nsys.path.insert(0, os.environ[\"QUEX_PATH\"])\nfrom copy import deepcopy\n\nfrom quex.core_engine.state_machine.core import *\nimport quex.core_engine.state_machine.nfa_to_dfa as nfa_to_dfa\nimport quex.core_engine.state_machine.hopcroft_minimization as hopcroft\n\ndef do(the_state_machine, pre_context_state_machine):\n \"\"\"Sets up a pre-condition to the given state machine. This process\n is entirely different from any sequentialization or paralellization\n of state machines. Here, the state machine representing the pre-\n condition ist **not** webbed into the original state machine!\n\n Instead, the following happens:\n\n -- the pre-condition state machine is inverted, because\n it is to be walked through backwards.\n -- the inverted state machine is marked with the state machine id\n of the_state_machine. \n -- the original state machine will refere to the inverse\n state machine of the pre-condition.\n -- the initial state origins and the origins of the acceptance\n states are marked as 'pre-conditioned' indicating the id\n of the inverted state machine of the pre-condition. \n \"\"\"\n #___________________________________________________________________________________________\n # (*) do some consistency checking \n assert the_state_machine.__class__.__name__ == \"StateMachine\"\n assert pre_context_state_machine.__class__.__name__ == \"StateMachine\"\n # -- state machines with no states are senseless here. \n assert not the_state_machine.is_empty() \n assert not pre_context_state_machine.is_empty()\n # -- trivial pre-conditions should be added last, for simplicity\n assert not the_state_machine.core().pre_context_begin_of_line_f(), \\\n \"This function was not designed to deal with trivially pre-conditioned state machines.\" + \\\n \"Please, make sure the trivial pre-conditioning happens *after* regular pre-conditions.\" \n #___________________________________________________________________________________________\n \n # (*) invert the state machine of the pre-condition \n inverse_pre_context = pre_context_state_machine.get_inverse()\n inverse_pre_context = nfa_to_dfa.do(inverse_pre_context)\n inverse_pre_context = hopcroft.do(inverse_pre_context)\n \n # (*) let the state machine refer to it \n # [Is this necessary? Is it not enough that the acceptance origins point to it? <fschaef>]\n the_state_machine.core().set_pre_context_sm(inverse_pre_context)\n pre_context_sm_id = inverse_pre_context.get_id()\n\n # (*) create origin data, in case where there is none yet create new one.\n # (do not delete, otherwise existing information gets lost)\n for state in the_state_machine.states.values():\n if not state.is_acceptance(): continue\n state.core().set_pre_context_id(pre_context_sm_id)\n \n return the_state_machine\n" }, { "alpha_fraction": 0.6268656849861145, "alphanum_fraction": 0.6716417670249939, "avg_line_length": 24.125, "blob_id": "5d71e1a5e1c4c49d0adf7a698c708931d348acc0", "content_id": "659c96c7eda9abdaed40955d92fbf8f13382b795", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Lua", "length_bytes": 201, "license_type": "permissive", "max_line_length": 51, "num_lines": 8, "path": "/engine/tests/engine/simple_render_loop.lua", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "gfx_colour_grade(`neutral.lut.png`)\ngfx_option('POST_PROCESSING', true)\nfunction dump(x)\n return tostring(x)\nend\nwhile not clicked_close() do\n gfx_render(0.1, vec(0, 0, 0), quat(1, 0, 0, 0))\nend\n" }, { "alpha_fraction": 0.5405335426330566, "alphanum_fraction": 0.543954610824585, "avg_line_length": 37.67671585083008, "blob_id": "fa9b54a81f3d41318b4d06619bc78b0c4d36fba8", "content_id": "4168b7a7ea21999adca977834b97bd197181d41d", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 23092, "license_type": "permissive", "max_line_length": 116, "num_lines": 597, "path": "/dependencies/quex-0.34.1/quex/input/ucs_db_parser.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "import re\nimport os\nimport sys\nimport fnmatch\n\nsys.path.insert(0, os.environ[\"QUEX_PATH\"])\n\nfrom quex.frs_py.file_in import *\nfrom quex.frs_py.string_handling import *\n\nfrom quex.core_engine.interval_handling import Interval, NumberSet\n\nunicode_db_directory = os.environ[\"QUEX_PATH\"] + \"/quex/data_base/unicode\"\ncomment_deleter_re = re.compile(\"#[^\\n]*\")\n\ndef open_data_base_file(Filename):\n try: \n fh = open(unicode_db_directory + \"/\" + Filename, \"rb\")\n except:\n error_msg(\"Fatal---Unicode Database File '%s' not found!\\n\" % Filename + \\\n \"QUEX_PATH='%s'\\n\" % os.environ[\"QUEX_PATH\"] + \\\n \"Unicode Database Directory: '%s'\" % unicode_db_directory)\n return fh\n\ndef parse_table(Filename):\n fh = open_data_base_file(Filename)\n\n record_set = []\n for line in fh.readlines():\n line = line.strip()\n line = comment_deleter_re.sub(\"\", line)\n if line.isspace() or line == \"\": continue\n # append content to record set\n record_set.append(map(lambda x: x.strip(), line.split(\";\")))\n\n return record_set\n\ndef convert_column_to_number(table, CodeColumnIdx):\n \"\"\" CodeColumnIdx: Column that contains the UCS character code or\n code range.\n table: table in which the content is changed.\n \"\"\"\n for row in table:\n cell = row[CodeColumnIdx]\n row[CodeColumnIdx] = int(\"0x\" + cell, 16)\n\ndef convert_column_to_interval(table, CodeColumnIdx):\n \"\"\" CodeColumnIdx: Column that contains the UCS character code or\n code range.\n table: table in which the content is changed.\n \"\"\"\n for row in table:\n cell = row[CodeColumnIdx]\n fields = cell.split(\"..\") # range: value0..value1\n assert len(fields) in [1, 2]\n\n if len(fields) == 2: \n begin = int(\"0x\" + fields[0], 16)\n end = int(\"0x\" + fields[1], 16) + 1\n else:\n begin = int(\"0x\" + fields[0], 16)\n end = int(\"0x\" + fields[0], 16) + 1\n\n row[CodeColumnIdx] = Interval(begin, end)\n\ndef __enter_number_set(db, Key, Value):\n ValueType = Value.__class__.__name__\n assert ValueType in [\"Interval\", \"int\"]\n\n if ValueType == \"int\": Value = Interval(Value)\n\n if db.has_key(Key): db[Key].quick_append_interval(Value, SortF=False)\n else: db[Key] = NumberSet(Value)\n\ndef __enter_string(db, Key, Value):\n db[Key] = Value\n\ndef __enter_number(db, Key, Value):\n db[Key] = Value\n\ndef convert_table_to_associative_map(table, ValueColumnIdx, ValueType, KeyColumnIdx):\n \"\"\"Produces a dictionary that maps from 'keys' to NumberSets. The \n number sets represent the code points for which the key (property)\n is valid.\n\n ValueColumnIdx: Column that contains the character code interval or\n string to which one wishes to map.\n\n KeyColmnIdx: Column that contains the 'key' to be used for the map\n\n self.db = database to contain the associative map.\n \"\"\"\n try:\n enter = { \"NumberSet\": __enter_number_set,\n \"number\": __enter_number,\n \"string\": __enter_string\n }[ValueType]\n except:\n raise BaseException(\"ValueType = '%s' unknown.\\n\" % ValueType)\n\n db = {}\n for record in table:\n key = record[KeyColumnIdx].strip()\n key = key.replace(\" \", \"_\")\n value = record[ValueColumnIdx]\n enter(db, key, value)\n\n # if the content was a number set, it might be simplified, try it.\n if ValueType == \"NumberSet\":\n for key, number_set in db.items():\n number_set.clean()\n\n return db\n\ndef load_db(DB_Filename, ValueType, ValueColumnIdx, KeyColumnIdx):\n \"\"\"Loads a database contained in file 'DB_Filename'. Creates a python dictionary\n that maps from a string (contained in column KeyColumnIdx) to a number set\n or a single number (contained in column ValueColumnIdx).\n\n NOTE: The 'key' maybe for example the property value. The \n 'value' is the number set it points to. This maybe\n confusing.\n \"\"\"\n\n table = parse_table(DB_Filename)\n if ValueType == \"NumberSet\": convert_column_to_interval(table, ValueColumnIdx)\n elif ValueType == \"number\": convert_column_to_number(table, ValueColumnIdx)\n\n db = convert_table_to_associative_map(table, ValueColumnIdx, ValueType, KeyColumnIdx)\n\n return db\n\nclass PropertyInfo:\n def __init__(self, Name, Alias, Type, RelatedPropertyInfoDB):\n \"\"\"Alias = short form of Name or Value.\n \"\"\"\n self.name = Name\n self.alias = Alias\n self.type = Type\n self.alias_to_name_map = {} # map value alias to value\n # # NOTE: Not all values may have aliases!\n self.code_point_db = None # map value (not alias) to number set or number\n self.related_property_info_db = RelatedPropertyInfoDB\n\n def __repr__(self):\n assert self.type in [\"Binary\", \"Catalog\", \"Enumerated\", \"String\", \"Miscellaneous\", \"Numeric\"], \\\n \"self.type = \" + repr(self.type)\n\n txt = \"NAME = '%s'\\n\" % self.name\n txt += \"ALIAS = '%s'\\n\" % self.alias\n txt += \"TYPE = '%s'\\n\" % self.type\n if self.type == \"Binary\":\n txt += \"VALUE_ALIASES = (Binary has no values)\\n\"\n else:\n txt += \"VALUE_ALIASES = {\\n \"\n txt += self.get_value_list_help(sys.maxint).replace(\", \", \",\\n \")\n txt += \"\\n}\\n\" \n return txt\n\n def get_character_set(self, Value=None):\n \"\"\"Returns the character set that corresponds to 'Property==Value'.\n 'Value' can be a property value or a property value alias.\n For binary properties 'Value' must be None.\n \"\"\"\n assert self.type != \"Binary\" or Value == None\n\n if self.type != \"Binary\" and Value == None:\n return \"Property '%s' requires a value setting.\\n\" % self.name + \\\n \"Possible Values: \" + \\\n self.get_value_list_help()\n\n if self.code_point_db == None:\n self.init_code_point_db()\n\n if self.type == \"Binary\": \n return self.code_point_db\n\n adapted_value = Value.replace(\" \", \"_\")\n if self.code_point_db.has_key(adapted_value): \n value = adapted_value\n elif Value in self.alias_to_name_map.keys():\n value = self.alias_to_name_map[adapted_value]\n else:\n # -- WILDCARD MATCH: Results in a list of property values \n character_set = self.__wildcard_value_match(adapted_value)\n if character_set == None:\n return \"Property '%s' cannot have a value or value alias '%s'.\\n\" % (self.name, Value) + \\\n \"Possible Values: \" + \\\n self.get_value_list_help()\n return character_set\n\n return self.code_point_db[value]\n\n def init_code_point_db(self):\n\n if self.alias in [\"na\", \"na1\", \"nv\", \"gc\", \"bc\", \"isc\"]:\n # Name\n # Unicode 1 Name \n # Numeric Value\n # General Category\n # Bidi Class\n self.related_property_info_db.load_UnicodeData()\n return\n \n if self.type == \"Catalog\":\n if self.alias == \"blk\":\n self.code_point_db = load_db(\"Blocks.txt\", \"NumberSet\", 0, 1)\n elif self.alias == \"age\":\n self.code_point_db = load_db(\"DerivedAge.txt\", \"NumberSet\", 0, 1)\n elif self.alias == \"sc\":\n self.code_point_db = load_db(\"Scripts.txt\", \"NumberSet\", 0, 1)\n else:\n return\n\n\n elif self.type == \"Binary\":\n\n if self.alias in [\"AHex\", \"Bidi_C\", \"Dash\", \"Dep\", \"Dia\",\n \"Ext\", \"Hex\", \"Hyphen\", \"IDSB\", \"IDST\", \"Ideo\", \"Join_C\",\n \"LOE\", \"NChar\", \"OAlpha\", \"ODI\", \"OGr_Ext\", \"OIDC\", \"OIDS\",\n \"OLower\", \"OMath\", \"OUpper\", \"Pat_Syn\", \"Pat_WS\", \"QMark\",\n \"Radical\", \"SD\", \"STerm\", \"Term\", \"UIdeo\", \"VS\", \"WSpace\"]:\n\n filename = \"PropList.txt\"\n\n elif self.alias == \"Bidi_M\":\n\n filename = \"extracted/DerivedBinaryProperties.txt\"\n\n elif self.alias in [\"Alpha\", \"DI\", \"Gr_Base\", \"Gr_Ext\",\n \"Gr_Link\", \"IDC\", \"IDS\", \"Math\", \"Lower\", \"Upper\", \"XIDC\", \"XIDS\" ]:\n\n filename = \"DerivedCoreProperties.txt\"\n\n elif self.alias == \"Comp_Ex\":\n\n filename = \"DerivedNormalizationProps.txt\"\n\n elif self.alias == \"CE\":\n\n self.related_property_info_db.load_Composition_Exclusion()\n return\n\n else:\n return\n \n self.related_property_info_db.load_binary_properties(filename)\n\n elif self.type == \"Enumerated\":\n try:\n filename = {\n \"Numeric_Type\": \"extracted/DerivedNumericType.txt\",\n \"Joining_Type\": \"extracted/DerivedJoiningType.txt\",\n \"Joining_Group\": \"extracted/DerivedJoiningGroup.txt\",\n \"Word_Break\": \"auxiliary/WordBreakProperty.txt\",\n \"Sentence_Break\": \"auxiliary/SentenceBreakProperty.txt\",\n \"Grapheme_Cluster_Break\": \"auxiliary/GraphemeBreakProperty.txt\",\n \"Hangul_Syllable_Type\": \"HangulSyllableType.txt\",\n \"Line_Break\": \"extracted/DerivedLineBreak.txt\",\n \"Decomposition_Type\": \"extracted/DerivedDecompositionType.txt\",\n \"East_Asian_Width\": \"extracted/DerivedEastAsianWidth.txt\",\n \"Canonical_Combining_Class\": \"extracted/DerivedCombiningClass.txt\",\n }[self.name]\n except:\n print \"warning: no database file for property `%s'.\" % self.name\n return\n\n self.code_point_db = load_db(filename, \"NumberSet\", 0, 1)\n\n elif self.type == \"Miscellaneous\":\n pass # see first check\n\n def get_value_list_help(self, MaxN=20, OpeningBracket=\"\", ClosingBracket=\"\"):\n if self.code_point_db == None:\n self.init_code_point_db()\n\n the_list = self.code_point_db.keys()\n n = min(len(the_list), MaxN)\n selection = the_list[:n]\n selection.sort()\n\n txt = \"\"\n alias_name_pair_list = self.alias_to_name_map.items()\n for element in selection:\n if element == \"\": continue\n txt += OpeningBracket + element \n for alias, name in alias_name_pair_list:\n if element == name: \n txt += \"(%s)\" % alias\n break\n txt += ClosingBracket + \", \"\n\n if n != len(the_list): txt += \"... (%i more)\" % (len(the_list) - n)\n else: txt = txt[:-2] + \".\"\n\n return txt \n\n def get_wildcard_value_matches(self, WildCardValue):\n \"\"\"Does not consider value aliases!\"\"\"\n value_candidates = self.code_point_db.keys()\n match_value_list = fnmatch.filter(value_candidates, WildCardValue)\n match_value_list.sort()\n return match_value_list\n\n def __wildcard_value_match(self, WildCardValue):\n result = NumberSet()\n\n value_list = self.get_wildcard_value_matches(WildCardValue)\n if value_list == []: \n return None\n\n for value in value_list:\n result.unite_with(NumberSet(self.code_point_db[value]))\n\n return result\n\nclass PropertyInfoDB:\n def __init__(self):\n self.property_name_to_alias_map = {} # map: property alias to property name\n self.db = {} # map: property alias to property information\n\n def __getitem__(self, PropertyName):\n if self.db == {}: self.init_db()\n\n if PropertyName in self.db.keys(): \n return self.db[PropertyName]\n elif PropertyName in self.property_name_to_alias_map.keys():\n return self.db[self.property_name_to_alias_map[PropertyName]]\n else: \n return \"<unknown property or alias '%s'>\" % PropertyName\n\n def get_property_value_matches(self, PropertyName, Value):\n assert Value != None\n\n if self.db == {}: self.init_db()\n\n property = self[PropertyName]\n if property.__class__.__name__ != \"PropertyInfo\":\n txt = property\n txt += \"Properties: \" + self.get_property_names()\n return txt\n\n if property.type == \"Binary\":\n if Value != None:\n return \"Binary property '%s' cannot have a value.\\n\" % PropertyName + \\\n \"Received '%s = %s'.\" % (PropertyName, Value)\n\n return property.get_wildcard_value_matches(Value)\n\n def get_character_set(self, PropertyName, Value=None):\n \"\"\"Returns the character set that corresponds to 'Property==Value'.\n\n 'Property' can be a property name or a property alias.\n 'Value' can be a property value or a property value alias.\n For binary properties 'Value' must be None.\n\n RETURNS: NumberSet in case of success.\n str in case an error occured. String describes the problem.\n \"\"\"\n if self.db == {}: self.init_db()\n\n property = self[PropertyName]\n if property.__class__.__name__ != \"PropertyInfo\":\n txt = property\n txt += \"Properties: \" + self.get_property_names()\n return txt\n\n if property.type == \"Binary\":\n if Value != None:\n return \"Binary property '%s' cannot have a value.\\n\" % PropertyName + \\\n \"Received '%s = %s'.\" % (PropertyName, Value)\n\n elif Value == None:\n return \"None-Binary property '%s' must have a value.\\n\" % PropertyName + \\\n \"Expected something like '%s = Value'.\\n\" % PropertyName + \\\n \"Possible Values: \" + \\\n property.get_value_list_help()\n\n return property.get_character_set(Value)\n\n def init_db(self):\n self.__parse_property_name_alias_and_type()\n self.__parse_property_value_and_value_aliases()\n\n def __parse_property_name_alias_and_type(self):\n fh = open_data_base_file(\"PropertyAliases.txt\")\n\n # -- skip anything until the first line that contains '======'\n line = fh.readline()\n while line != \"\":\n if line.find(\"# ==================\") != -1: break\n line = fh.readline()\n\n property_type = \"none\"\n for line in fh.readlines():\n line = line.strip()\n if line != \"\" and line[0] == \"#\" and line.find(\"Properties\") != -1:\n property_type = line.split()[1]\n continue\n \n line = comment_deleter_re.sub(\"\", line)\n if line.isspace() or line == \"\": continue\n # append content to record set\n fields = map(lambda x: x.strip(), line.split(\";\"))\n property_alias = fields[0]\n property_name = fields[1]\n\n self.db[property_alias] = PropertyInfo(property_name, property_alias, property_type, self)\n self.property_name_to_alias_map[property_name] = property_alias\n\n def __parse_property_value_and_value_aliases(self):\n \"\"\"NOTE: Function __parse_property_name_alias_and_type() **must be called**\n before this function.\n \"\"\"\n assert self.db != {}\n table = parse_table(\"PropertyValueAliases.txt\")\n\n for row in table:\n property_alias = row[0].strip()\n property_value_alias = row[1].strip()\n property_value = row[2].replace(\" \", \"_\").strip()\n # -- if property db has been parsed before, this shall not fail\n property_info = self.db[property_alias]\n property_info.alias_to_name_map[property_value_alias] = property_value\n\n def load_binary_properties(self, DB_Filename):\n # property descriptions working with 'property names'\n db = load_db(DB_Filename, \"NumberSet\", 0, 1)\n\n for key, number_set in db.items():\n\n if self.property_name_to_alias_map.has_key(key): \n property_name_alias = self.property_name_to_alias_map[key]\n else:\n property_name_alias = key\n\n property = self.db[property_name_alias]\n\n if property.type != \"Binary\": continue\n\n property.code_point_db = number_set\n\n def load_Composition_Exclusion(self):\n table = parse_table(\"CompositionExclusions.txt\")\n\n number_set = NumberSet()\n for row in table:\n begin = int(\"0x\" + row[0], 16)\n number_set.quick_append_interval(Interval(begin, begin + 1))\n number_set.clean() \n\n self.db[\"CE\"].code_point_db = number_set\n\n def load_UnicodeData(self):\n table = parse_table(\"UnicodeData.txt\")\n CodePointIdx = 0\n NumericValueIdx = 6\n NameIdx = 1\n NameUC1Idx = 10\n ISO_CommentIdx = 11\n GeneralCategoryIdx = 2\n BidiClassIdx = 4\n convert_column_to_number(table, CodePointIdx)\n\n names_db = convert_table_to_associative_map(table, CodePointIdx, \"number\", NameIdx)\n names_uc1_db = convert_table_to_associative_map(table, CodePointIdx, \"number\", NameUC1Idx)\n numeric_value_db = convert_table_to_associative_map(table, CodePointIdx, \"NumberSet\", NumericValueIdx)\n iso_comment_db = convert_table_to_associative_map(table, CodePointIdx, \"string\", ISO_CommentIdx)\n\n # some rows contain aliases, so they need to get converted into values\n general_category_property = self.db[\"gc\"]\n bidi_class_property = self.db[\"bc\"]\n\n def convert(Property, ValueAlias):\n \"\"\"Convert specified ValueAlias to Value of the given property.\"\"\"\n if Property.alias_to_name_map.has_key(ValueAlias):\n return Property.alias_to_name_map[ValueAlias]\n return ValueAlias\n\n for row in table:\n row[GeneralCategoryIdx] = convert(general_category_property, row[GeneralCategoryIdx])\n row[BidiClassIdx] = convert(bidi_class_property, row[BidiClassIdx])\n \n general_category_db = convert_table_to_associative_map(table, CodePointIdx, \"NumberSet\", GeneralCategoryIdx)\n bidi_class_db = convert_table_to_associative_map(table, CodePointIdx, \"NumberSet\", BidiClassIdx) \n\n self.db[\"na\"].code_point_db = names_db # Name\n self.db[\"na1\"].code_point_db = names_uc1_db # Name Unicode 1\n self.db[\"nv\"].code_point_db = numeric_value_db # Numeric Value\n self.db[\"gc\"].code_point_db = general_category_db # General Category\n self.db[\"bc\"].code_point_db = bidi_class_db # BidiClass\n self.db[\"isc\"].code_point_db = iso_comment_db # ISO_Comment\n\n def get_property_descriptions(self):\n item_list = self.db.items()\n\n L = max(map(lambda property: len(property.name), self.db.values()))\n La = max(map(lambda property: len(property.alias), self.db.values()))\n Lt = max(map(lambda property: len(property.type), self.db.values()))\n\n txt = \"# Abbreviation, Name, Type\\n\"\n item_list.sort(lambda a, b: cmp(a[0], b[0]))\n for key, property in item_list:\n txt += \"%s, %s%s, %s%s\" % \\\n (property.alias, \" \" * (La - len(property.alias)),\n property.name, \" \" * (L - len(property.name)),\n property.type)\n property.init_code_point_db()\n if property.code_point_db == None: \n txt += \", \" + \" \" * (Lt - len(property.type)) + \"<unsupported>\" \n\n txt += \"\\n\"\n\n return txt\n\n def get_property_names(self, BinaryOnlyF=False):\n if self.db == {}:\n self.init_db()\n\n alias_list = self.db.keys()\n alias_list.sort(lambda a, b: cmp(self.db[a], self.db[b]))\n\n txt = \"\"\n for alias in alias_list:\n if BinaryOnlyF and self.db[alias].type != \"Binary\": continue\n txt += self.db[alias].name + \"(%s)\" % alias\n txt += \", \"\n\n return txt \n\n def get_documentation(self):\n binary_property_list = []\n non_binary_property_list = []\n\n for property in self.db.values():\n if property.type == \"Binary\": binary_property_list.append(property)\n else: non_binary_property_list.append(property)\n\n\n def list_to_string(the_list):\n the_list.sort(lambda a, b: cmp(a.name, b.name))\n txt = \"\"\n for property in the_list:\n txt += property.name + \"(%s), \" % property.alias\n return txt\n\n txt = \"Binary Properties::\\n\\n\"\n txt += \" \" + list_to_string(binary_property_list)\n txt += \"\\n\\n\"\n txt += \"Non-Binary Properties::\\n\\n\"\n txt += \" \" + list_to_string(non_binary_property_list)\n txt += \"\\n\\n\"\n txt += \"--------------------------------------------------------------\\n\"\n txt += \"\\n\\n\"\n txt += \"Property settings:\\n\"\n txt += \"\\n\\n\"\n for property in non_binary_property_list:\n if property.type == \"Binary\": continue\n\n txt += \"%s::\\n\\n\" % property.name\n\n property.init_code_point_db()\n if property.code_point_db == None: \n txt += \" (not supported)\\n\" \n\n elif property.name in [\"Name\", \"Unicode_1_Name\"]:\n txt += \" (see Unicode Standard Literature)\\n\"\n\n else:\n value_txt = property.get_value_list_help(270, OpeningBracket=\"$$\", ClosingBracket=\"$$\")\n txt += \" \" + value_txt + \"\\n\"\n\n txt += \"\\n\"\n\n\n return txt\n\n\n\n\nucs_property_db = PropertyInfoDB()\n\nif __name__ == \"__main__\":\n ucs_property_db.init_db()\n ################################################################################\n # NOTE: Do not delete this. It is used to generate documentation automatically.\n ################################################################################\n print ucs_property_db.get_documentation()\n\n # print ucs_property_db.db[\"bc\"].get_value_list_help()\n # print ucs_property_db.get_character_set(\"Block\", \"Arabic\")\n # print ucs_property_db.get_character_set(\"Age\", \"5.0\")\n # print ucs_property_db.get_character_set(\"Script\", \"Greek\")\n # print \"%X\" % names_db[\"LATIN SMALL LETTER CLOSED REVERSED EPSILON\"]\n # print ucs_property_db.get_character_set(\"White_Space\")\n\n #print ucs_property_db.get_property_descriptions()\n\n\n" }, { "alpha_fraction": 0.5421248078346252, "alphanum_fraction": 0.5445901155471802, "avg_line_length": 50.31526184082031, "blob_id": "9a9ddc597b64e94098c6a51651812ca75451b190", "content_id": "fd6f5c074d15ca1cc71777ed086eb5983bf4d73b", "detected_licenses": [ "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer", "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 25555, "license_type": "permissive", "max_line_length": 124, "num_lines": 498, "path": "/dependencies/quex-0.34.1/quex/core_engine/generator/skip_code.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "import os\nimport sys\nfrom copy import deepcopy\nsys.path.insert(0, os.environ[\"QUEX_PATH\"])\n\nfrom quex.input.setup import setup as Setup\nimport quex.core_engine.state_machine.index as sm_index\nimport quex.core_engine.utf8 as utf8\nfrom quex.frs_py.string_handling import blue_print\nfrom quex.core_engine.generator.drop_out import get_forward_load_procedure\nfrom quex.core_engine.generator.languages.core import __nice\nimport quex.core_engine.generator.transition_block as transition_block\nfrom quex.core_engine.state_machine.transition_map import TransitionMap \n\n\n\ndef do(SkipperDescriptor):\n LanguageDB = Setup.language_db\n skipper_class = SkipperDescriptor.__class__.__name__\n assert skipper_class in [\"SkipperRange\", \"SkipperCharacterSet\"]\n\n if skipper_class == \"SkipperRange\":\n return create_skip_range_code(SkipperDescriptor.get_closing_sequence())\n elif skipper_class == \"SkipperCharacterSet\":\n return create_skip_code(SkipperDescriptor.get_character_set())\n else:\n assert None\n\ndef create_skip_range_code(ClosingSequence):\n LanguageDB = Setup.language_db\n return \"{\\n\" \\\n + LanguageDB[\"$comment\"](\"Range skipper state\") \\\n + get_range_skipper(ClosingSequence, LanguageDB) \\\n + \"\\n}\\n\"\n\ndef create_skip_code(CharacterSet):\n LanguageDB = Setup.language_db\n return \"{\\n\" \\\n + LanguageDB[\"$comment\"](\"Character set skipper state\") \\\n + get_character_set_skipper(CharacterSet, LanguageDB) \\\n + \"\\n}\\n\"\n\nrange_skipper_template = \"\"\"\n{\n $$DELIMITER_COMMENT$$\n const QUEX_CHARACTER_TYPE Skipper$$SKIPPER_INDEX$$[] = { $$DELIMITER$$ };\n const size_t Skipper$$SKIPPER_INDEX$$L = $$DELIMITER_LENGTH$$;\n QUEX_CHARACTER_TYPE* text_end = QuexBuffer_text_end(&me->buffer);\n$$LC_COUNT_COLUMN_N_POINTER_DEFINITION$$\n\n$$ENTRY$$\n QUEX_BUFFER_ASSERT_CONSISTENCY(&me->buffer);\n __quex_assert(QuexBuffer_content_size(&me->buffer) >= Skipper$$SKIPPER_INDEX$$L );\n\n /* NOTE: If _input_p == end of buffer, then it will drop out immediately out of the\n * loop below and drop into the buffer reload procedure. */\n\n /* Loop eating characters: Break-out as soon as the First Character of the Delimiter\n * (FCD) is reached. Thus, the FCD plays also the role of the Buffer Limit Code. There\n * are two reasons for break-out:\n * (1) we reached a limit (end-of-file or buffer-limit)\n * (2) there was really the FCD in the character stream\n * This must be distinguished after the loop was exited. But, during the 'swallowing' we\n * are very fast, because we do not have to check for two different characters. */\n *text_end = Skipper$$SKIPPER_INDEX$$[0]; /* Overwrite BufferLimitCode (BLC). */\n $$WHILE_1_PLUS_1_EQUAL_2$$\n $$INPUT_GET$$ \n $$IF_INPUT_EQUAL_DELIMITER_0$$\n $$BREAK$$\n $$ENDIF$$\n$$LC_COUNT_IN_LOOP$$\n $$INPUT_P_INCREMENT$$ /* Now, BLC cannot occur. See above. */\n $$END_WHILE$$\n *text_end = QUEX_SETTING_BUFFER_LIMIT_CODE; /* Reset BLC. */\n\n /* Case (1) and (2) from above can be distinguished easily: \n *\n * (1) Distance to text end == 0: \n * End-of-File or Buffer-Limit. \n * => goto to drop-out handling\n *\n * (2) Else: \n * First character of delimit reached. \n * => For the verification of the tail of the delimiter it is \n * essential that it is loaded completely into the buffer. \n * For this, it must be required:\n *\n * Distance to text end >= Delimiter length \n *\n * _input_p end\n * | | end - _input_p >= 3\n * [ ][R][E][M][#] \n * \n * The case of reload should be seldom and is costy anyway. \n * Thus let's say, that in this case we simply enter the drop \n * out and start the search for the delimiter all over again.\n *\n * (2.1) Distance to text end < Delimiter length\n * => goto to drop-out handling\n * (2.2) Start detection of tail of delimiter\n *\n */\n if( QuexBuffer_distance_input_to_text_end(&me->buffer) == 0 ) {\n /* (1) */\n $$GOTO_DROP_OUT$$ \n } \n else if( Skipper$$SKIPPER_INDEX$$L && QuexBuffer_distance_input_to_text_end(&me->buffer) < Skipper$$SKIPPER_INDEX$$L ) {\n /* (2.1) */\n $$GOTO_DROP_OUT$$ \n }\n$$LC_COUNT_AT_LOOP_EXIT$$\n /* (2.2) Test the remaining delimiter, but note, that the check must restart at '_input_p + 1'\n * if any later check fails. */\n $$INPUT_P_INCREMENT$$\n /* Example: Delimiter = '*', '/'; if we get ...[*][*][/]... then the the first \"*\" causes \n * a drop out out of the 'swallowing loop' and the second \"*\" will mismatch \n * the required \"/\". But, then the second \"*\" must be presented to the\n * swallowing loop and the letter after it completes the 'match'.\n * (The whole discussion, of course, is superflous if the range delimiter has length 1.) */\n$$DELIMITER_REMAINDER_TEST$$ \n {\n $$SET_INPUT_P_BEHIND_DELIMITER$$ \n /* NOTE: The initial state does not increment the input_p. When it detects that\n * it is located on a buffer border, it automatically triggers a reload. No \n * need here to reload the buffer. */\n$$LC_COUNT_END_PROCEDURE$$\n $$GOTO_REENTRY_PREPARATION$$ /* End of range reached. */\n }\n\n$$DROP_OUT$$\n QUEX_BUFFER_ASSERT_CONSISTENCY_LIGHT(&me->buffer);\n /* -- When loading new content it is checked that the beginning of the lexeme\n * is not 'shifted' out of the buffer. In the case of skipping, we do not care about\n * the lexeme at all, so do not restrict the load procedure and set the lexeme start\n * to the actual input position. */\n /* -- According to case (2.1) is is possible that the _input_p does not point to the end\n * of the buffer, thus we record the current position in the lexeme start pointer and\n * recover it after the loading. */\n $$MARK_LEXEME_START$$\n me->buffer._input_p = text_end;\n$$LC_COUNT_BEFORE_RELOAD$$\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n /* Recover '_input_p' from lexeme start \n * (inverse of what we just did before the loading) */\n me->buffer._input_p = me->buffer._lexeme_start_p;\n /* After reload, we need to increment _input_p. That's how the game is supposed to be played. \n * But, we recovered from lexeme start pointer, and this one does not need to be incremented. */\n text_end = QuexBuffer_text_end(&me->buffer);\n$$LC_COUNT_AFTER_RELOAD$$\n QUEX_BUFFER_ASSERT_CONSISTENCY(&me->buffer);\n $$GOTO_ENTRY$$\n }\n /* Here, either the loading failed or it is not enough space to carry a closing delimiter */\n me->buffer._input_p = me->buffer._lexeme_start_p;\n $$MISSING_CLOSING_DELIMITER$$\n}\n\"\"\"\n\ndef get_range_skipper(EndSequence, LanguageDB, MissingClosingDelimiterAction=\"\"):\n assert EndSequence.__class__ == list\n assert len(EndSequence) >= 1\n assert map(type, EndSequence) == [int] * len(EndSequence)\n\n # Name the $$SKIPPER$$\n skipper_index = sm_index.get()\n\n # Determine the $$DELIMITER$$\n delimiter_str = \"\"\n delimiter_comment_str = \" Delimiter: \"\n for letter in EndSequence:\n delimiter_comment_str += \"'%s', \" % utf8.map_unicode_to_utf8(letter)\n delimiter_str += \"0x%X, \" % letter\n delimiter_length_str = \"%i\" % len(EndSequence)\n delimiter_comment_str = LanguageDB[\"$comment\"](delimiter_comment_str) \n\n # Determine the check for the tail of the delimiter\n delimiter_remainder_test_str = \"\"\n if len(EndSequence) != 1: \n txt = \"\"\n i = 0\n for letter in EndSequence[1:]:\n i += 1\n txt += \" \" + LanguageDB[\"$input/get-offset\"](i-1) + \"\\n\"\n txt += \" \" + LanguageDB[\"$if !=\"](\"Skipper$$SKIPPER_INDEX$$[%i]\" % i)\n txt += \" \" + LanguageDB[\"$goto\"](\"$entry\", skipper_index) + \"\\n\"\n txt += \" \" + LanguageDB[\"$endif\"]\n delimiter_remainder_test_str = txt\n\n # The main part\n code_str = blue_print(range_skipper_template,\n [[\"$$DELIMITER$$\", delimiter_str],\n [\"$$DELIMITER_LENGTH$$\", delimiter_length_str],\n [\"$$DELIMITER_COMMENT$$\", delimiter_comment_str],\n [\"$$WHILE_1_PLUS_1_EQUAL_2$$\", LanguageDB[\"$loop-start-endless\"]],\n [\"$$END_WHILE$$\", LanguageDB[\"$loop-end\"]],\n [\"$$INPUT_P_INCREMENT$$\", LanguageDB[\"$input/increment\"]],\n [\"$$INPUT_P_DECREMENT$$\", LanguageDB[\"$input/decrement\"]],\n [\"$$INPUT_GET$$\", LanguageDB[\"$input/get\"]],\n [\"$$IF_INPUT_EQUAL_DELIMITER_0$$\", LanguageDB[\"$if ==\"](\"Skipper$$SKIPPER_INDEX$$[0]\")],\n [\"$$BREAK$$\", LanguageDB[\"$break\"]],\n [\"$$ENDIF$$\", LanguageDB[\"$endif\"]],\n [\"$$ENTRY$$\", LanguageDB[\"$label-def\"](\"$entry\", skipper_index)],\n [\"$$DROP_OUT$$\", LanguageDB[\"$label-def\"](\"$drop-out\", skipper_index)],\n [\"$$GOTO_ENTRY$$\", LanguageDB[\"$goto\"](\"$entry\", skipper_index)],\n [\"$$GOTO_REENTRY_PREPARATION$$\", LanguageDB[\"$goto\"](\"$re-start\")],\n [\"$$MARK_LEXEME_START$$\", LanguageDB[\"$mark-lexeme-start\"]],\n [\"$$DELIMITER_REMAINDER_TEST$$\", delimiter_remainder_test_str],\n [\"$$SET_INPUT_P_BEHIND_DELIMITER$$\", LanguageDB[\"$input/add\"](len(EndSequence)-1)],\n [\"$$MISSING_CLOSING_DELIMITER$$\", MissingClosingDelimiterAction],\n ])\n\n # Line and column number counting\n code_str = __range_skipper_lc_counting_replacements(code_str, EndSequence)\n\n # The finishing touch\n code_str = blue_print(code_str,\n [[\"$$SKIPPER_INDEX$$\", __nice(skipper_index)],\n [\"$$GOTO_DROP_OUT$$\", LanguageDB[\"$goto\"](\"$drop-out\", skipper_index)]])\n\n return code_str\n\n\ntrigger_set_skipper_template = \"\"\"\n{ \n $$DELIMITER_COMMENT$$\n$$LC_COUNT_COLUMN_N_POINTER_DEFINITION$$\n\n QUEX_BUFFER_ASSERT_CONSISTENCY(&me->buffer);\n __quex_assert(QuexBuffer_content_size(&me->buffer) >= 1);\n if( QuexBuffer_distance_input_to_text_end(&me->buffer) == 0 ) \n $$GOTO_DROP_OUT$$\n\n /* NOTE: For simple skippers the end of content does not have to be overwriten \n * with anything (as done for range skippers). This is so, because the abort\n * criteria is that a character occurs which does not belong to the trigger \n * set. The BufferLimitCode, though, does never belong to any trigger set and\n * thus, no special character is to be set. */\n$$LOOP_START$$\n $$INPUT_GET$$ \n$$LC_COUNT_IN_LOOP$$\n$$ON_TRIGGER_SET_TO_LOOP_START$$\n$$LOOP_REENTRANCE$$\n $$INPUT_P_INCREMENT$$ /* Now, BLC cannot occur. See above. */\n $$GOTO_LOOP_START$$\n\n$$DROP_OUT$$\n /* -- When loading new content it is always taken care that the beginning of the lexeme\n * is not 'shifted' out of the buffer. In the case of skipping, we do not care about\n * the lexeme at all, so do not restrict the load procedure and set the lexeme start\n * to the actual input position. \n * -- The input_p will at this point in time always point to the buffer border. */\n if( QuexBuffer_distance_input_to_text_end(&me->buffer) == 0 ) {\n QUEX_BUFFER_ASSERT_CONSISTENCY(&me->buffer);\n$$LC_COUNT_BEFORE_RELOAD$$\n $$MARK_LEXEME_START$$\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n\n QUEX_BUFFER_ASSERT_CONSISTENCY(&me->buffer);\n QuexBuffer_input_p_increment(&me->buffer);\n$$LC_COUNT_AFTER_RELOAD$$\n $$GOTO_LOOP_START$$\n } else {\n $$GOTO_TERMINAL_EOF$$\n }\n }\n\n$$DROP_OUT_DIRECT$$\n$$LC_COUNT_END_PROCEDURE$$\n /* There was no buffer limit code, so no end of buffer or end of file --> continue analysis \n * The character we just swallowed must be re-considered by the main state machine.\n * But, note that the initial state does not increment '_input_p'!\n */\n $$GOTO_REENTRY_PREPARATION$$ \n}\n\"\"\"\n\ndef get_character_set_skipper(TriggerSet, LanguageDB):\n \"\"\"This function implements simple 'skipping' in the sense of passing by\n characters that belong to a given set of characters--the TriggerSet.\n \"\"\"\n assert TriggerSet.__class__.__name__ == \"NumberSet\"\n assert not TriggerSet.is_empty()\n\n skipper_index = sm_index.get()\n # Mini trigger map: [ trigger set ] --> loop start\n # That means: As long as characters of the trigger set appear, we go to the loop start.\n transition_map = TransitionMap()\n transition_map.add_transition(TriggerSet, skipper_index)\n iteration_code = transition_block.do(transition_map.get_trigger_map(), skipper_index, InitStateF=False, DSM=None)\n\n comment_str = LanguageDB[\"$comment\"](\"Skip any character in \" + TriggerSet.get_utf8_string())\n\n # Line and column number counting\n code_str = __set_skipper_lc_counting_replacements(trigger_set_skipper_template, TriggerSet)\n\n # The finishing touch\n txt = blue_print(code_str,\n [\n [\"$$DELIMITER_COMMENT$$\", comment_str],\n [\"$$INPUT_P_INCREMENT$$\", LanguageDB[\"$input/increment\"]],\n [\"$$INPUT_P_DECREMENT$$\", LanguageDB[\"$input/decrement\"]],\n [\"$$INPUT_GET$$\", LanguageDB[\"$input/get\"]],\n [\"$$IF_INPUT_EQUAL_DELIMITER_0$$\", LanguageDB[\"$if ==\"](\"SkipDelimiter$$SKIPPER_INDEX$$[0]\")],\n [\"$$ENDIF$$\", LanguageDB[\"$endif\"]],\n [\"$$LOOP_START$$\", LanguageDB[\"$label-def\"](\"$input\", skipper_index)],\n [\"$$GOTO_LOOP_START$$\", LanguageDB[\"$goto\"](\"$input\", skipper_index)],\n [\"$$LOOP_REENTRANCE$$\", LanguageDB[\"$label-def\"](\"$entry\", skipper_index)],\n [\"$$RESTART$$\", LanguageDB[\"$label-def\"](\"$input\", skipper_index)],\n [\"$$DROP_OUT$$\", LanguageDB[\"$label-def\"](\"$drop-out\", skipper_index)],\n [\"$$DROP_OUT_DIRECT$$\", LanguageDB[\"$label-def\"](\"$drop-out-direct\", skipper_index)],\n [\"$$GOTO_LOOP_START$$\", LanguageDB[\"$goto\"](\"$entry\", skipper_index)],\n [\"$$SKIPPER_INDEX$$\", repr(skipper_index)],\n [\"$$GOTO_TERMINAL_EOF$$\", LanguageDB[\"$goto\"](\"$terminal-EOF\")],\n [\"$$GOTO_REENTRY_PREPARATION$$\", LanguageDB[\"$goto\"](\"$re-start\")],\n [\"$$MARK_LEXEME_START$$\", LanguageDB[\"$mark-lexeme-start\"]],\n [\"$$ON_TRIGGER_SET_TO_LOOP_START$$\", iteration_code],\n ])\n\n return blue_print(txt,\n [[\"$$GOTO_DROP_OUT$$\", LanguageDB[\"$goto\"](\"$drop-out\", skipper_index)]])\n\ndef get_nested_character_skipper(StartSequence, EndSequence, LanguageDB, BufferEndLimitCode):\n assert StartSequence.__class__ == list\n assert len(StartSequence) >= 1\n assert map(type, StartSequence) == [int] * len(StartSequence)\n assert EndSequence.__class__ == list\n assert len(EndSequence) >= 1\n assert map(type, EndSequence) == [int] * len(EndSequence)\n assert StartSequence != EndSequence\n\n # Identify the common start of 'StartSequence' and 'EndSequence'\n CommonSequence = []\n StartSequenceTail = [] # 'un-common' tail of the start sequence\n EndSequenceTail = [] # 'un-common' tail of the end sequence\n L_min = min(len(StartSequence), len(EndSequence))\n characters_from_begin_to_i_are_common_f = True\n for i in range(L_min):\n if (not characters_from_begin_to_i_are_common_f) or (StartSequence[i] != EndSequence[i]): \n StartSequenceTail.append(StartSequence[i])\n EndSequenceTail.append(EndSequence[i])\n characters_from_begin_to_i_are_common_f = False\n else: \n CommonSequence.append(StartSequence[i])\n\n if CommonSequence != []:\n msg += \" \" + LanguageDB[\"$if ==\"](repr(CommonSequence[0]))\n msg += \" \" + action_on_first_character_match\n msg += \" \" + LanguageDB[\"$endif\"]\n else:\n msg += \" \" + LanguageDB[\"$if ==\"](repr(StartSequenceTail[0]))\n msg += \" \" + action_on_first_character_match\n msg += \" \" + LanguageDB[\"$endif\"]\n\n\nlc_counter_in_loop = \"\"\"\n# if defined(QUEX_OPTION_LINE_NUMBER_COUNTING) || defined(QUEX_OPTION_COLUMN_NUMBER_COUNTING)\n if( input == (QUEX_CHARACTER_TYPE)'\\\\n' ) { \n ++(self.counter._line_number_at_end);\n# if defined(QUEX_OPTION_COLUMN_NUMBER_COUNTING)\n column_count_p_$$SKIPPER_INDEX$$ = QuexBuffer_tell_memory_adr(&me->buffer);\n self.counter._column_number_at_end = 0;\n# endif\n }\n# endif\n\"\"\"\ndef __range_skipper_lc_counting_replacements(code_str, EndSequence):\n \"\"\"Line and Column Number Counting(Range Skipper):\n \n -- in loop if there appears a newline, then do:\n increment line_n\n set position from where to count column_n\n -- at end of skipping do one of the following:\n if end delimiter contains newline:\n column_n = number of letters since last new line in end delimiter\n increment line_n by number of newlines in end delimiter.\n (NOTE: in this case the setting of the position from where to count\n the column_n can be omitted.)\n else:\n column_n = current_position - position from where to count column number.\n\n NOTE: On reload we do count the column numbers and reset the column_p.\n \"\"\"\n variable_definition = \\\n \"# if defined(QUEX_OPTION_LINE_NUMBER_COUNTING) || defined(QUEX_OPTION_COLUMN_NUMBER_COUNTING)\\n\" + \\\n \"# ifdef QUEX_OPTION_COLUMN_NUMBER_COUNTING\\n\" + \\\n \" QUEX_CHARACTER_POSITION_TYPE column_count_p_$$SKIPPER_INDEX$$ = QuexBuffer_tell_memory_adr(&me->buffer);\\n\"+\\\n \"# endif\\n\" + \\\n \"# endif\\n\"\n in_loop = \"\"\n end_procedure = \"\"\n exit_loop = \"\"\n new_line_detection_in_loop_enabled_f = True\n\n # Does the end delimiter contain a newline?\n try: index = EndSequence.index(ord(\"\\n\"))\n except: index = -1\n if index != -1:\n if index == 0:\n # Inside the skipped range, there cannot have been a newline\n new_line_detection_in_loop_enabled_f = False\n exit_loop = \"# ifdef QUEX_OPTION_LINE_NUMBER_COUNTING\\n\" + \\\n \" ++(self.counter._line_number_at_end); /* First limit character was the newline */\\n\" \\\n \"# endif\" \n\n # If the first character in the delimiter is newline, then it was counted alread, see above.\n delimiter_newline_n = EndSequence[1:].count(ord(\"\\n\"))\n if delimiter_newline_n != 0:\n end_procedure += \"# ifdef QUEX_OPTION_LINE_NUMBER_COUNTING\\n\" + \\\n \" self.counter._line_number_at_end += %i;\\n\" % delimiter_newline_n + \\\n \"# endif\\n\"\n\n # If delimiter contains newline, then the column number is identical to the distance\n # of the last newline to the end of the delimiter.\n dummy = deepcopy(EndSequence)\n dummy.reverse()\n delimiter_tail_n = dummy.index(ord(\"\\n\")) + 1\n if delimiter_tail_n != 0:\n end_procedure += \"# ifdef QUEX_OPTION_COLUMN_NUMBER_COUNTING\\n\" + \\\n \" self.counter._column_number_at_end = %i;\\n\" % delimiter_tail_n + \\\n \"# endif\\n\"\n else:\n end_procedure = \"# ifdef QUEX_OPTION_COLUMN_NUMBER_COUNTING\\n\" + \\\n \" self.counter._column_number_at_end += QuexBuffer_tell_memory_adr(&me->buffer)\\n\" + \\\n \" - column_count_p_$$SKIPPER_INDEX$$;\\n\" + \\\n \"# endif\\n\"\n before_reload = \"# ifdef QUEX_OPTION_COLUMN_NUMBER_COUNTING\\n\" + \\\n \" self.counter._column_number_at_end += QuexBuffer_tell_memory_adr(&me->buffer)\\n\" + \\\n \" - column_count_p_$$SKIPPER_INDEX$$;\\n\" + \\\n \"# endif\\n\"\n after_reload = \"# ifdef QUEX_OPTION_COLUMN_NUMBER_COUNTING\\n\" + \\\n \" column_count_p_$$SKIPPER_INDEX$$ = QuexBuffer_tell_memory_adr(&me->buffer);\\n\" + \\\n \"# endif\\n\"\n\n if new_line_detection_in_loop_enabled_f:\n in_loop = lc_counter_in_loop\n\n return blue_print(code_str,\n [[\"$$LC_COUNT_COLUMN_N_POINTER_DEFINITION$$\", variable_definition],\n [\"$$LC_COUNT_IN_LOOP$$\", in_loop],\n [\"$$LC_COUNT_END_PROCEDURE$$\", end_procedure],\n [\"$$LC_COUNT_BEFORE_RELOAD$$\", before_reload],\n [\"$$LC_COUNT_AFTER_RELOAD$$\", after_reload],\n [\"$$LC_COUNT_AT_LOOP_EXIT$$\", exit_loop],\n ])\n\n\ndef __set_skipper_lc_counting_replacements(code_str, CharacterSet):\n \"\"\"Line and Column Number Counting(Range Skipper):\n \n -- in loop if there appears a newline, then do:\n increment line_n\n set position from where to count column_n\n -- at end of skipping do one of the following:\n if end delimiter contains newline:\n column_n = number of letters since last new line in end delimiter\n increment line_n by number of newlines in end delimiter.\n (NOTE: in this case the setting of the position from where to count\n the column_n can be omitted.)\n else:\n column_n = current_position - position from where to count column number.\n\n NOTE: On reload we do count the column numbers and reset the column_p.\n \"\"\"\n variable_definition = \\\n \"# if defined(QUEX_OPTION_LINE_NUMBER_COUNTING) || defined(QUEX_OPTION_COLUMN_NUMBER_COUNTING)\\n\" + \\\n \"# ifdef QUEX_OPTION_COLUMN_NUMBER_COUNTING\\n\" + \\\n \" QUEX_CHARACTER_POSITION_TYPE column_count_p_$$SKIPPER_INDEX$$ = QuexBuffer_tell_memory_adr(&me->buffer);\\n\"+\\\n \"# endif\\n\" + \\\n \"# endif\\n\"\n in_loop = \"\"\n end_procedure = \"\"\n exit_loop = \"\"\n\n # Does the end delimiter contain a newline?\n if CharacterSet.contains(ord(\"\\n\")):\n in_loop = lc_counter_in_loop\n\n end_procedure = \"# ifdef QUEX_OPTION_COLUMN_NUMBER_COUNTING\\n\" + \\\n \" self.counter._column_number_at_end += QuexBuffer_tell_memory_adr(&me->buffer)\\n\" + \\\n \" - column_count_p_$$SKIPPER_INDEX$$;\\n\" + \\\n \"# endif\\n\"\n before_reload = \"# ifdef QUEX_OPTION_COLUMN_NUMBER_COUNTING\\n\" + \\\n \" self.counter._column_number_at_end += QuexBuffer_tell_memory_adr(&me->buffer)\\n\" + \\\n \" - column_count_p_$$SKIPPER_INDEX$$;\\n\" + \\\n \"# endif\\n\"\n after_reload = \"# ifdef QUEX_OPTION_COLUMN_NUMBER_COUNTING\\n\" + \\\n \" column_count_p_$$SKIPPER_INDEX$$ = QuexBuffer_tell_memory_adr(&me->buffer);\\n\" + \\\n \"# endif\\n\"\n\n return blue_print(code_str,\n [[\"$$LC_COUNT_COLUMN_N_POINTER_DEFINITION$$\", variable_definition],\n [\"$$LC_COUNT_IN_LOOP$$\", in_loop],\n [\"$$LC_COUNT_END_PROCEDURE$$\", end_procedure],\n [\"$$LC_COUNT_BEFORE_RELOAD$$\", before_reload],\n [\"$$LC_COUNT_AFTER_RELOAD$$\", after_reload],\n ])\n" }, { "alpha_fraction": 0.6557595729827881, "alphanum_fraction": 0.6601001620292664, "avg_line_length": 34.654762268066406, "blob_id": "8a354d84e3f4086e5e468a293070e5792c1b9494", "content_id": "cdc2e8af23d2c14932962e3da32e8a47990d76b5", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2995, "license_type": "permissive", "max_line_length": 108, "num_lines": 84, "path": "/dependencies/quex-0.34.1/quex/core_engine/regular_expression/property.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "from quex.input.ucs_db_parser import ucs_property_db\nfrom quex.frs_py.file_in import skip_whitespace\nfrom quex.exception import RegularExpressionException\n\nfrom quex.core_engine.regular_expression.auxiliary import __snap_until \n\ndef do(stream):\n \"\"\"Property expression: '\\P{...}'\n \n Parse an expression of the forms:\n\n '\\P{property = value}' or '\\P{binary_property}'\n\n and return the related character set.\n \"\"\"\n content = __parse_property_expression(stream, \"P\")\n # if len(content) < 1 or > 2 then an exception is thrown\n\n property_name = content[0]\n if len(content) == 1: property_value = None\n else: property_value = content[1]\n\n result = ucs_property_db.get_character_set(property_name, property_value)\n\n if type(result) == str:\n raise RegularExpressionException(result)\n\n return result\n\ndef do_shortcut(stream, ShortcutLetter, PropertyAlias):\n \"\"\"Name property shortcut '\\ShortcutLetter{...}' which is a shortcut\n for '\\P{PropertyAlias=...}'.\n \n Parse an expression of the form '\\N{CHARACTER NAME}'\n and return the related character set of characters that \n match the given name. Wildcards in are allowed.\n \"\"\"\n content = __parse_property_expression(stream, ShortcutLetter, EqualConditionPossibleF=False)\n # if len(content) != 1 then an exception is thrown\n\n property_value = content[0]\n\n result = ucs_property_db.get_character_set(PropertyAlias, property_value)\n\n if type(result) == str:\n raise RegularExpressionException(result)\n\n return result\n\ndef __parse_property_expression(stream, PropertyLetter, EqualConditionPossibleF=True):\n \"\"\"Parses an expression of the form '\\? { X [ = Y] }' where\n ? = PropertyLetter. If the '=' operator is present then\n two fields are returned first = left hand side, second = \n right hand side. Othewise an element is returned.\n \"\"\"\n assert len(PropertyLetter) == 1\n assert type(PropertyLetter) == str\n assert type(EqualConditionPossibleF) == bool\n\n # verify '\\?'\n x = stream.read(2)\n if x != \"\\\\\" + PropertyLetter: \n raise RegularExpressionException(\"Unicode property letter '\\\\%s' expected, received '%s'.\" % x)\n \n skip_whitespace(stream)\n\n x = stream.read(1)\n if x != \"{\": \n raise RegularExpressionException(\"Unicode property '\\\\%s' not followed by '{'.\" % PropertyLetter)\n\n content = __snap_until(stream, \"}\")\n \n fields = content.split(\"=\")\n\n if len(fields) == 0:\n raise RegularExpressionException(\"Unicode property expression '\\\\%s{}' cannot have no content.\")\n\n if len(fields) > 2:\n raise RegularExpressionException(\"Unicode property expression '\\\\%s' can have at maximum one '='.\")\n\n if not EqualConditionPossibleF and len(fields) == 2:\n raise RegularExpressionException(\"Unicode property expression '\\\\%s' does not allow '=' conditions\")\n\n return map(lambda x: x.strip(), fields)\n" }, { "alpha_fraction": 0.7774254679679871, "alphanum_fraction": 0.7814415693283081, "avg_line_length": 38.73949432373047, "blob_id": "21aeacfe8c87e55e43f3386e39923c7b06356f31", "content_id": "92b667175b4e16e3c0b8c933ead032af20159889", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 4731, "license_type": "permissive", "max_line_length": 100, "num_lines": 119, "path": "/engine/doc/grit_book/md/README.md", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "\n\n# Grit Engine\n\nThis is the central repository for the [Grit Game Engine](http://www.gritengine.com) project.\n\nFrom here can be built the engine executable itself, the launcher, and various tools. These are\nmostly useless without the accompanying media tree (the [Game\nDirectory](https://sourceforge.net/projects/gritengine/) which is available on Sourceforge via\nSubversion. Therefore to get everything, execute the following:\n\n```\ngit clone --recursive https://github.com/sparkprime/grit-engine.git grit-engine\nsvn checkout https://svn.code.sf.net/p/gritengine/code/trunk grit-engine/media\n```\n\nThe subversion tree also contains prebuilt up-to-date executables (Linux & Windows) so the majority\nof developers only need that. Grit can be substantially modified through Lua scripting, and this\npotential should be exhausted before modifying C++ code.\n\nBuild files are provided for Linux (`Makefile` and `.../*grit.mk`) and Visual Studio 2013 project\nfiles. Building C++ takes about an hour on Windows and 10 minutes on Linux. Scripts are available\nfor copying new executables into Subversion, if it is checked out in the `media/` directory.\n\n\n# Windows\n\nOnly Visual Studio Express 2013 is supported. It is free (as in beer). Download it from the\nMicrosoft site.\n\n\n## Requirements\n\nYou will need the DirectX9 SDK (Google it), install that on your system (in `Program Files`). The\ninstall adds a system-wide environment variable `DXSDK_DIR` pointing to the install directory. This\nis used by the Visual Studio build. If Visual studio is running, you will have to restart it to make\nit 'see' the new environment variable.\n\n\n## Regular build\n\nOpen grit-engine.sln and build the whole solution with the *Normal* configuration. This will build\nall the tools and dependencies.\n\n\n## Debug Build\n\nDebugging with Visual Studio requires the engine to be built with the *Debug* configuration. To run\nin the debugger, execute the `engine` project from inside Visual Studio. You may need to set the\nworking directory to the `media/` directory (from the `engine` project properties).\n\n\n## Modifying the Build\n\nThe build uses hand-written MSVC build files. Each executable and library has a project file, and\nproperties files are used to layer additional build options without duplicating them between project\nfiles. They are structured as follows:\n* \n`grit-engine.sln`: Collects together all the projects.\n* \n`solution.props`: Build options for all libraries and executables. Options that are the same for\nboth Debug and Normal configurations live here.\n* \n`solution_debug.props`: Additional options when compiling in debug mode. Options that are the same\nfor all object files live here.\n* \n`solution_normal.props`: Additional options when compiling in normal mode. Options that are the same\nfor all object files live here.\n* \n`pch.props`: Options for enabling the precompiled header, used for top-level apps.\n* \n`path/to/my-project/my-project.vcxproj`: An executable or library to build. Build options that are\nspecific to the library itself (like warning levels) live here.\n* \n`path/to/my-project/my-project.props`: Build options required by clients of a library and the\nlibrary itself (typically defines and include paths).\n\n\n# Linux\n\nThe following instructions are for Ubuntu. If you're using another distro, you'll have to figure it\nout for yourself but hopefully the Ubuntu instructions will help. Note that the make files require\nGNU make, which may be called gmake on your system.\n\n\n## Requirements\n\n```\nsudo apt-get install subversion g++ make pkg-config gdb valgrind \\\nlibfreeimage-dev libzzip-dev libfreetype6-dev libglu1-mesa-dev \\\nlibxt-dev libxaw7-dev libglew1.5-dev libxrandr-dev \\\nlibgoogle-perftools-dev libopenal-dev libreadline-dev freeglut3-dev \\\nnvidia-cg-toolkit libvorbis-dev xutils-dev libicu-dev\n```\n\n\n## Building\n\nSimply running `make -j 8` in the root (adjust for your number of cores) will build everything.\nExecutables for the current platform are left in the root directory. You can add it to your PATH.\n\n\n## Debugging\n\nYou can debug Grit with `gdb` or `valgrind`. If the assembly is too obscure, disable optimizations\nby overriding the OPT variable as so:\n\n```\nmake -j 8 OPT=\n```\n\nNote that this will not rebuild anything that is already built, so you might want to first delete\nspecific object files -- the ones containing the code you're debugging, and then rebuilding them\nwithout optimizations.\n\n\n## Modifying the Build\n\nThe makefiles are handwritten. They use a lot of GNU make specific features. Each sub-project and\ndependency defines a `grit.mk` file which defines the additional source files and required build\noptions. These are all included by the root `Makefile` which computes the actual build rules.\n" }, { "alpha_fraction": 0.5515111088752747, "alphanum_fraction": 0.5643309354782104, "avg_line_length": 36.066795349121094, "blob_id": "e38d78b629ac2745deefba652f8e47e33467b478", "content_id": "5af477624a769b455f50c1b2dc5cad1f9933542b", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 19423, "license_type": "permissive", "max_line_length": 98, "num_lines": 524, "path": "/engine/physics/collision_mesh.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <iostream>\n#include <cstdlib>\n#include <ctime>\n\n#include <LinearMath/btGeometryUtil.h>\n#include <btBulletCollisionCommon.h>\n#include <BulletCollision/CollisionDispatch/btInternalEdgeUtility.h>\n\n#include <centralised_log.h>\n#include \"../path_util.h\"\n\n#include \"collision_mesh.h\"\n\n\n#ifndef M_PI\n#define M_PI 3.1415926535897932385\n#endif\n\nstatic inline Vector3 from_bullet (const btVector3 &from)\n{ return Vector3 (from.x(), from.y(), from.z()); }\n\nstatic inline Quaternion from_bullet (const btQuaternion &from)\n{ return Quaternion (from.w(), from.x(), from.y(), from.z()); }\n\nstatic inline btVector3 to_bullet (const Vector3 &from)\n{ return btVector3(from.x,from.y,from.z); }\n\nstatic inline btQuaternion to_bullet (const Quaternion &from)\n{ return btQuaternion(from.x, from.y, from.z, from.w); }\n\n\nclass ProxyStreamBuf : public std::streambuf\n{\n public:\n ProxyStreamBuf (const Ogre::DataStreamPtr &file_)\n : file(file_) { }\n\n protected:\n\n std::streamsize showmanyc (void)\n {\n return 0;\n }\n\n/*\n int_type uflow (void)\n {\n char buf;\n std::streamsize sz = file->read(&buf,1);\n if (sz==1) return traits_type::not_eof(buf);\n else return traits_type::eof();\n }\n*/\n\n virtual std::streamsize _Xsgetn_s (char* s, size_t, std::streamsize n)\n {\n return xsgetn(s,n);\n }\n \n\n/*\n std::streamsize xsgetn (char* s, std::streamsize n)\n {\n std::streamsize sz = std::streambuf::xsgetn(s,n);\n std::cout << \"(\"<<(void*)this<<\").xsgetn(\"<<(void*)s<<\",\"<<n<<\") = \"<<sz<<std::endl;\n return sz;\n }\n*/\n\n\n pos_type seekpos (pos_type sp, std::ios_base::openmode which)\n {\n if (which == std::ios_base::out) {\n GRIT_EXCEPT(\"Cannot write to an Ogre::DataStream\");\n }\n file->seek(sp);\n return file->tell();\n }\n\n pos_type seekoff (off_type off,\n std::ios_base::seekdir way,\n std::ios_base::openmode which)\n {\n if (which == std::ios_base::out) {\n GRIT_EXCEPT(\"Cannot write to an Ogre::DataStream\");\n }\n switch (way) {\n case std::ios_base::beg: file->seek(off); break;\n case std::ios_base::cur: file->skip(off); break;\n case std::ios_base::end:\n GRIT_EXCEPT(\"Cannot seek to end of an Ogre::DataStream\");\n\n default: // compiler is whining at me\n return -1;\n }\n return file->tell();\n }\n\n\n\n std::streamsize xsgetn (char* s, std::streamsize n)\n {\n std::streamsize left = n;\n while (left > 0) {\n std::streamsize sz = file->read(s,left);\n if (sz==0) break;\n left -= sz;\n s += sz;\n }\n return n - left;\n }\n\n std::streamsize xsputn (const char_type*, std::streamsize)\n {\n GRIT_EXCEPT(\"Cannot write to an Ogre::DataStream\");\n }\n\n Ogre::DataStreamPtr file;\n};\n\nnamespace {\n\n // Optimisation: for things in the bcol that have the same material,\n // they will almost certainly use the same char* value within the bcol\n // for the name of that material, so this map will avoid having to walk\n // the strings (which can be quite long) to look up actual PhysicalMaterial*\n class BColMaterialMap {\n std::string dir, name;\n typedef std::map<const char *, PhysicalMaterial*> Map;\n Map mmap;\n public:\n BColMaterialMap (const std::string &dir, const std::string &name)\n : dir(dir), name(name) { }\n PhysicalMaterial *operator() (const char *s)\n {\n Map::iterator i = mmap.find(s);\n if (i!=mmap.end()) return i->second;\n PhysicalMaterial *pm = phys_mats.getMaterial(dir, name, s);\n mmap[s] = pm;\n return pm;\n }\n };\n}\n\nstatic inline Vector3 to_v3(BColVert &v) { return Vector3(v.x, v.y, v.z); }\n\nvoid CollisionMesh::loadImpl (void)\n{\n APP_ASSERT(masterShape==NULL);\n\n Ogre::DataStreamPtr file;\n try {\n file = Ogre::ResourceGroupManager::getSingleton().openResource(name.substr(1), \"GRIT\");\n } catch (Ogre::Exception &e) {\n GRIT_EXCEPT(e.getDescription());\n }\n\n std::string ext = name.substr(name.length()-5);\n\n uint32_t fourcc = 0;\n for (int i=0 ; i<4 ; ++i) {\n unsigned char c;\n file->read(&c, 1);\n fourcc |= c << (i*8);\n }\n file->seek(0);\n\n std::string dir = grit_dirname(name);\n\n const btVector3 ZV(0,0,0);\n const btQuaternion ZQ(0,0,0,1);\n\n bool compute_inertia = false;\n bool is_static = false;\n\n if (fourcc==0x4c4f4342) { //BCOL\n\n Ogre::MemoryDataStreamPtr mem = \n Ogre::MemoryDataStreamPtr(OGRE_NEW Ogre::MemoryDataStream(name,file));\n\n BColFile &bcol = *reinterpret_cast<BColFile*>(mem->getPtr());\n\n is_static = bcol.mass == 0.0f; // static\n\n masterShape = new btCompoundShape();\n\n BColMaterialMap mmap(dir,name);\n\n for (unsigned i=0 ; i<bcol.hullNum ; ++i) {\n BColHull &p = *bcol.hulls(i);\n btConvexHullShape *s2 = new btConvexHullShape();\n s2->setMargin(p.margin);\n for (unsigned j=0 ; j<p.vertNum ; ++j) {\n BColVert &v = *p.verts(j);\n s2->addPoint(btVector3(v.x, v.y, v.z));\n }\n masterShape->addChildShape(btTransform(ZQ,ZV), s2);\n partMaterials.push_back(mmap(p.mat.name()));\n }\n\n for (unsigned i=0 ; i<bcol.boxNum ; ++i) {\n BColBox &p = *bcol.boxes(i);\n btBoxShape *s2 = new btBoxShape(btVector3(p.dx/2,p.dy/2,p.dz/2));\n s2->setMargin(p.margin);\n masterShape->addChildShape(btTransform(btQuaternion(p.qx,p.qy,p.qz,p.qw),\n btVector3(p.px,p.py,p.pz)), s2);\n partMaterials.push_back(mmap(p.mat.name()));\n }\n\n for (unsigned i=0 ; i<bcol.cylNum ; ++i) {\n BColCyl &p = *bcol.cyls(i);\n btCylinderShape *s2 = new btCylinderShapeZ(btVector3(p.dx/2,p.dy/2,p.dz/2));\n s2->setMargin(p.margin);\n masterShape->addChildShape(btTransform(btQuaternion(p.qx,p.qy,p.qz,p.qw),\n btVector3(p.px,p.py,p.pz)), s2);\n partMaterials.push_back(mmap(p.mat.name()));\n }\n\n for (unsigned i=0 ; i<bcol.coneNum ; ++i) {\n BColCone &p = *bcol.cones(i);\n btConeShape *s2 = new btConeShapeZ(p.radius,p.height);\n s2->setMargin(p.margin);\n masterShape->addChildShape(btTransform(btQuaternion(p.qx,p.qy,p.qz,p.qw),\n btVector3(p.px,p.py,p.pz)), s2);\n partMaterials.push_back(mmap(p.mat.name()));\n }\n\n for (unsigned i=0 ; i<bcol.planeNum ; ++i) {\n BColPlane &p = *bcol.planes(i);\n btStaticPlaneShape *s2 = new btStaticPlaneShape(btVector3(p.nx,p.ny,p.nz),p.d);\n masterShape->addChildShape(btTransform(ZQ,ZV), s2);\n partMaterials.push_back(mmap(p.mat.name()));\n }\n\n for (unsigned i=0 ; i<bcol.sphereNum ; ++i) {\n BColSphere &p = *bcol.spheres(i);\n btSphereShape *s2 = new btSphereShape(p.radius);\n masterShape->addChildShape(btTransform(ZQ, btVector3(p.px,p.py,p.pz)), s2);\n partMaterials.push_back(mmap(p.mat.name()));\n }\n\n\n if (bcol.triMeshFaceNum > 0) {\n\n bcolVerts.resize(bcol.triMeshVertNum);\n bcolFaces.resize(bcol.triMeshFaceNum);\n\n memcpy(&bcolVerts[0], bcol.triMeshVerts(0), bcol.triMeshVertNum * sizeof(BColVert));\n memcpy(&bcolFaces[0], bcol.triMeshFaces(0), bcol.triMeshFaceNum * sizeof(BColFace));\n\n faceMaterials.reserve(bcol.triMeshFaceNum);\n\n int counter = 0;\n float accum_area = 0;\n for (unsigned i=0 ; i<bcol.triMeshFaceNum ; ++i) {\n BColFace &face = *bcol.triMeshFaces(i);\n PhysicalMaterial *mat = mmap(face.mat.name());\n faceMaterials.push_back(mat);\n CollisionMesh::ProcObjFace po_face(to_v3(bcolVerts[face.v1]), \n to_v3(bcolVerts[face.v2]),\n to_v3(bcolVerts[face.v3]));\n procObjFaceDB[mat->id].faces.push_back(po_face);\n float area = (po_face.AB.cross(po_face.AC)).length();\n APP_ASSERT(area>=0);\n procObjFaceDB[mat->id].areas.push_back(area);\n procObjFaceDB[mat->id].totalArea += area;\n if (++counter = 10) {\n counter = 0;\n accum_area = 0;\n procObjFaceDB[mat->id].areas10.push_back(accum_area);\n }\n accum_area += area;\n \n }\n\n btTriangleIndexVertexArray *v = new btTriangleIndexVertexArray(\n bcolFaces.size(), reinterpret_cast<int*>(&(bcolFaces[0].v1)), sizeof(BColFace),\n bcolVerts.size(), &(bcolVerts[0].x), sizeof(BColVert));\n\n\n if (is_static) {\n btBvhTriangleMeshShape *tm = new btBvhTriangleMeshShape(v,true,true);\n tm->setMargin(bcol.triMeshMargin);\n btTriangleInfoMap* tri_info_map = new btTriangleInfoMap();\n tri_info_map->m_edgeDistanceThreshold = bcol.triMeshEdgeDistanceThreshold;\n\n btGenerateInternalEdgeInfo(tm,tri_info_map);\n masterShape->addChildShape(btTransform::getIdentity(), tm);\n } else {\n // skip over dynamic trimesh\n }\n }\n\n setMass(bcol.mass);\n setLinearDamping(bcol.linearDamping);\n setAngularDamping(bcol.angularDamping);\n setLinearSleepThreshold(bcol.linearSleepThreshold);\n setAngularSleepThreshold(bcol.angularSleepThreshold);\n setCCDMotionThreshold(bcol.ccdMotionThreshold);\n setCCDSweptSphereRadius(bcol.ccdSweptSphereRadius);\n setInertia(Vector3(bcol.inertia[0],bcol.inertia[1],bcol.inertia[2]));\n\n compute_inertia = !bcol.inertiaProvided;\n\n } else if (fourcc==0x4c4f4354) { //TCOL\n\n ProxyStreamBuf proxy(file);\n\n std::istream stream(&proxy);\n quex::tcol_lexer qlex(&stream);\n TColFile tcol;\n parse_tcol_1_0(name,&qlex,tcol);\n\n is_static = tcol.mass == 0.0f; // static\n\n masterShape = new btCompoundShape();\n\n if (tcol.usingCompound) {\n\n TColCompound &c = tcol.compound;\n\n for (size_t i=0 ; i<c.hulls.size() ; ++i) {\n const TColHull &h = c.hulls[i];\n btConvexHullShape *s2 = new btConvexHullShape();\n s2->setMargin(h.margin);\n for (unsigned j=0 ; j<h.vertexes.size() ; ++j) {\n const Vector3 &v = h.vertexes[j];\n s2->addPoint(to_bullet(v));\n }\n masterShape->addChildShape(btTransform(ZQ,ZV), s2);\n partMaterials.push_back(phys_mats.getMaterial(dir,name,h.material));\n }\n\n for (size_t i=0 ; i<c.boxes.size() ; ++i) {\n const TColBox &b = c.boxes[i];\n /* implement with hulls\n btConvexHullShape *s2 = new btConvexHullShape();\n s2->addPoint(btVector3(-b.dx/2+b.margin, -b.dy/2+b.margin, -b.dz/2+b.margin));\n s2->addPoint(btVector3(-b.dx/2+b.margin, -b.dy/2+b.margin, b.dz/2-b.margin));\n s2->addPoint(btVector3(-b.dx/2+b.margin, b.dy/2-b.margin, -b.dz/2+b.margin));\n s2->addPoint(btVector3(-b.dx/2+b.margin, b.dy/2-b.margin, b.dz/2-b.margin));\n s2->addPoint(btVector3( b.dx/2-b.margin, -b.dy/2+b.margin, -b.dz/2+b.margin));\n s2->addPoint(btVector3( b.dx/2-b.margin, -b.dy/2+b.margin, b.dz/2-b.margin));\n s2->addPoint(btVector3( b.dx/2-b.margin, b.dy/2-b.margin, -b.dz/2+b.margin));\n s2->addPoint(btVector3( b.dx/2-b.margin, b.dy/2-b.margin, b.dz/2-b.margin));\n */\n btBoxShape *s2 =new btBoxShape(btVector3(b.dx/2,b.dy/2,b.dz/2));\n s2->setMargin(b.margin);\n masterShape->addChildShape(btTransform(btQuaternion(b.qx,b.qy,b.qz,b.qw),\n btVector3(b.px,b.py,b.pz)), s2);\n partMaterials.push_back(phys_mats.getMaterial(dir,name,b.material));\n }\n\n for (size_t i=0 ; i<c.cylinders.size() ; ++i) {\n const TColCylinder &cyl = c.cylinders[i];\n btCylinderShape *s2 =\n new btCylinderShapeZ(btVector3(cyl.dx/2,cyl.dy/2,cyl.dz/2));\n s2->setMargin(cyl.margin);\n masterShape->addChildShape(\n btTransform(btQuaternion(cyl.qx,cyl.qy,cyl.qz,cyl.qw),\n btVector3(cyl.px,cyl.py,cyl.pz)), s2);\n partMaterials.push_back(phys_mats.getMaterial(dir,name,cyl.material));\n }\n\n for (size_t i=0 ; i<c.cones.size() ; ++i) {\n const TColCone &cone = c.cones[i];\n btConeShapeZ *s2 = new btConeShapeZ(cone.radius,cone.height);\n s2->setMargin(cone.margin);\n masterShape->addChildShape(\n btTransform(btQuaternion(cone.qx,cone.qy,cone.qz,cone.qw),\n btVector3(cone.px,cone.py,cone.pz)), s2);\n partMaterials.push_back(phys_mats.getMaterial(dir,name,cone.material));\n }\n\n for (size_t i=0 ; i<c.planes.size() ; ++i) {\n const TColPlane &p = c.planes[i];\n btStaticPlaneShape *s2 =\n new btStaticPlaneShape(btVector3(p.nx,p.ny,p.nz),p.d);\n masterShape->addChildShape(btTransform(ZQ,ZV), s2);\n partMaterials.push_back(phys_mats.getMaterial(dir,name,p.material));\n }\n\n for (size_t i=0 ; i<c.spheres.size() ; ++i) {\n const TColSphere &sp = c.spheres[i];\n btSphereShape *s2 = new btSphereShape(sp.radius);\n masterShape->addChildShape(btTransform(ZQ,\n btVector3(sp.px,sp.py,sp.pz)), s2);\n partMaterials.push_back(phys_mats.getMaterial(dir,name,sp.material));\n }\n }\n\n if (tcol.usingTriMesh) {\n\n TColTriMesh &t = tcol.triMesh;\n\n std::swap(verts, t.vertexes);\n std::swap(faces, t.faces);\n\n\n faceMaterials.reserve(faces.size());\n int counter = 0;\n float accum_area = 0;\n for (TColFaces::const_iterator i=faces.begin(), i_=faces.end() ; i!=i_ ; ++i) {\n //optimisation possible here by changing the TCol struct to be more liek what\n //bullet wants, and then re-using memory\n PhysicalMaterial *mat = phys_mats.getMaterial(dir,name,i->material);\n faceMaterials.push_back(mat);\n CollisionMesh::ProcObjFace po_face(verts[i->v1], verts[i->v2], verts[i->v3]);\n procObjFaceDB[mat->id].faces.push_back(po_face);\n float area = (po_face.AB.cross(po_face.AC)).length();\n APP_ASSERT(area>=0);\n procObjFaceDB[mat->id].areas.push_back(area);\n procObjFaceDB[mat->id].totalArea += area;\n if (++counter = 10) {\n counter = 0;\n accum_area = 0;\n procObjFaceDB[mat->id].areas10.push_back(accum_area);\n }\n accum_area += area;\n \n }\n\n btTriangleIndexVertexArray *v = new btTriangleIndexVertexArray(\n faces.size(), &(faces[0].v1), sizeof(TColFace),\n verts.size(), &(verts[0].x), sizeof(Vector3));\n\n if (is_static) {\n btBvhTriangleMeshShape *tm = new btBvhTriangleMeshShape(v,true,true);\n tm->setMargin(t.margin);\n btTriangleInfoMap* tri_info_map = new btTriangleInfoMap();\n tri_info_map->m_edgeDistanceThreshold = t.edgeDistanceThreshold;\n\n btGenerateInternalEdgeInfo(tm,tri_info_map);\n masterShape->addChildShape(btTransform::getIdentity(), tm);\n } else {\n // Skip over dynamic trimesh\n }\n\n }\n\n setMass(tcol.mass);\n setInertia(Vector3(tcol.inertia_x,tcol.inertia_y,tcol.inertia_z));\n setLinearDamping(tcol.linearDamping);\n setAngularDamping(tcol.angularDamping);\n setLinearSleepThreshold(tcol.linearSleepThreshold);\n setAngularSleepThreshold(tcol.angularSleepThreshold);\n setCCDMotionThreshold(tcol.ccdMotionThreshold);\n setCCDSweptSphereRadius(tcol.ccdSweptSphereRadius);\n\n compute_inertia = !tcol.hasInertia;\n\n } else {\n GRIT_EXCEPT(\"Collision mesh \\\"\"+name+\"\\\" seems to be corrupt.\");\n }\n\n\n if (is_static) {\n setInertia(Vector3(0,0,0));\n } else {\n if (faceMaterials.size() > 0) {\n CERR << \"While loading \\\"\" + name + \"\\\": Dynamic trimesh not supported.\" << std::endl;\n }\n if (compute_inertia) {\n btVector3 i;\n masterShape->calculateLocalInertia(mass,i);\n setInertia(from_bullet(i));\n }\n }\n}\n\nvoid CollisionMesh::unloadImpl (void)\n{\n //compound of shapes, recursive\n\n partMaterials.clear();\n faceMaterials.clear();\n procObjFaceDB.clear();\n faces.clear();\n verts.clear();\n bcolFaces.clear();\n bcolVerts.clear();\n\n int num_children = masterShape->getNumChildShapes();\n for (int i=num_children-1 ; i>=0 ; --i) {\n btCollisionShape *s = masterShape->getChildShape(i);\n masterShape->removeChildShapeByIndex(i);\n delete s;\n }\n delete masterShape;\n masterShape = NULL;\n}\n\nPhysicalMaterial *CollisionMesh::getMaterialFromPart (unsigned int id) const\n{\n if (id >= partMaterials.size()) return 0;\n return partMaterials[id];\n}\n\nPhysicalMaterial *CollisionMesh::getMaterialFromFace (unsigned int id) const\n{\n if (id >= faceMaterials.size()) return 0;\n return faceMaterials[id];\n}\n" }, { "alpha_fraction": 0.6151251196861267, "alphanum_fraction": 0.6172336339950562, "avg_line_length": 35.860103607177734, "blob_id": "6d77a55d64e11e48c2cff149c3c1806450ccc044", "content_id": "1f57830fcc92c9599396ce220e61d13dce3e2e98", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 7114, "license_type": "permissive", "max_line_length": 108, "num_lines": 193, "path": "/dependencies/quex-0.34.1/quex/code_base/template/Counter.i", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "// -*- C++ -*- vim: set syntax=cpp:\n// NOTE: Quex is pretty intelligent in choosing the right function\n// to count line and column numbers. If, for example, a pattern\n// does not contain newlines, then it simply adds the LexemeLength\n// to the column number and does not do anything to the line number.\n// Before touching anything in this code, first look at the generated\n// code. The author of these lines considers it rather difficult to\n// find better implementations of these functions in the framework\n// of the generated engine. <fschaef 07y6m30d>\n//\n// NOTE: Those functions are not responsible for setting the begin to the\n// last end, such as _line_number_at_begin = _line_number_at_end.\n// This has to happen outside these functions.\n#include <quex/code_base/template/count_common>\n\nnamespace quex { \ninline\nCounter::Counter()\n{ init(); }\n\ninline\nCounter::Counter(const Counter& That)\n{\n# ifdef QUEX_OPTION_LINE_NUMBER_COUNTING\n _line_number_at_begin = That._line_number_at_begin; // line where current pattern starts\n _line_number_at_end = That._line_number_at_end; // line after current pattern\n# endif\n# ifdef QUEX_OPTION_COLUMN_NUMBER_COUNTING\n _column_number_at_begin = That._column_number_at_begin; // column where current pattern starts\n _column_number_at_end = That._column_number_at_end; // column after current pattern\n# endif\n}\n\ninline void\nCounter::init()\n{\n# ifdef QUEX_OPTION_LINE_NUMBER_COUNTING\n _line_number_at_begin = 0;\n _line_number_at_end = 1;\n# endif\n# ifdef QUEX_OPTION_COLUMN_NUMBER_COUNTING\n _column_number_at_begin = 0;\n _column_number_at_end = 1; \n# endif\n}\n\ninline void \nCounter::count(QUEX_CHARACTER_TYPE* Lexeme, QUEX_CHARACTER_TYPE* LexemeEnd)\n// PURPOSE:\n// Adapts the column number and the line number according to the newlines\n// and letters of the last line occuring in the lexeme.\n//\n// NOTE: Providing LexemeLength may spare a subtraction (End - Lexeme) in case \n// there is no newline in the lexeme (see below).\n//\n////////////////////////////////////////////////////////////////////////////////\n{\n#if ! defined(QUEX_OPTION_COLUMN_NUMBER_COUNTING) && \\\n ! defined(QUEX_OPTION_LINE_NUMBER_COUNTING) \n return;\n#else\n QUEX_CHARACTER_TYPE* Begin = (QUEX_CHARACTER_TYPE*)Lexeme;\n QUEX_CHARACTER_TYPE* it = __count_chars_to_newline_backwards(Begin, LexemeEnd, LexemeEnd - Begin,\n /* LicenseToIncrementLineCountF = */ true);\n\n# ifdef QUEX_OPTION_LINE_NUMBER_COUNTING\n // The last function may have digested a newline (*it == '\\n'), but then it \n // would have increased the _line_number_at_end.\n __count_newline_n_backwards(it, Begin);\n# endif\n\n __QUEX_LEXER_COUNT_ASSERT_CONSISTENCY();\n#endif\n}\n\ninline void \nCounter::count_NoNewline(const int LexemeLength) \n{\n __quex_assert( LexemeLength > 0 );\n\n# ifdef QUEX_OPTION_COLUMN_NUMBER_COUNTING\n _column_number_at_end += LexemeLength;\n# endif\n\n __QUEX_LEXER_COUNT_ASSERT_CONSISTENCY();\n}\n\ninline void \nCounter::count_FixNewlineN(QUEX_CHARACTER_TYPE* Lexeme,\n QUEX_CHARACTER_TYPE* LexemeEnd,\n const int LineNIncrement) \n{\n __quex_assert( LexemeEnd > Lexeme );\n# ifdef QUEX_OPTION_LINE_NUMBER_COUNTING\n _line_number_at_end += LineNIncrement;\n# endif\n\n# ifdef QUEX_OPTION_COLUMN_NUMBER_COUNTING\n __count_chars_to_newline_backwards((QUEX_CHARACTER_TYPE*)Lexeme, \n (QUEX_CHARACTER_TYPE*)(LexemeEnd), \n LexemeEnd - Lexeme,\n /* LicenseToIncrementLineCountF = */ false);\n# endif\n __QUEX_LEXER_COUNT_ASSERT_CONSISTENCY();\n}\n\n\ninline void\nCounter::__count_newline_n_backwards(QUEX_CHARACTER_TYPE* it,\n QUEX_CHARACTER_TYPE* Begin)\n// NOTE: If *it == '\\n' this function does **not** count it. The user must\n// have increased the _line_number_at_end by hisself. This happens\n// for performance reasons.\n{\n __quex_assert(it >= Begin);\n# ifdef QUEX_OPTION_LINE_NUMBER_COUNTING\n // investigate remaining part of the lexeme, i.e. before the last newline\n // (recall the lexeme is traced from the rear)\n while( it != Begin ) {\n --it;\n if( *it == '\\n' ) ++_line_number_at_end; \n } \n# endif\n}\n\ninline QUEX_CHARACTER_TYPE*\nCounter::__count_chars_to_newline_backwards(QUEX_CHARACTER_TYPE* Begin,\n QUEX_CHARACTER_TYPE* End,\n const int LexemeLength,\n const bool LicenseToIncrementLineCountF /*=false*/)\n// RETURNS: Pointer to the first newline or the beginning of the lexeme.\n//\n// This function increases _line_number_at_end if a newline occurs and \n// LicenseToIncrementLineCountF = true.\n//\n// NOTE: The 'license' flag shall enable the compiler to **delete** the line number counting\n// from the following function or implemented unconditionally, since the decision\n// is based, then on a condition of a constant (either true or false) -- once the \n// function has been inlined. \n//\n// NOTE: Quex writes a call to this function only, if there **is** a potential\n// newline in the lexeme. Otherwise, it adds the fixed pattern length\n// or the LexemeLength directly.\n{\n#if ! defined(QUEX_OPTION_COLUMN_NUMBER_COUNTING) && \\\n ! defined(QUEX_OPTION_LINE_NUMBER_COUNTING) \n return 0x0;\n#else\n __quex_assert(Begin < End); // LexemeLength >= 1\n\n // loop from [End] to [Begin]:\n //\n // [Begin]xxxxxxxxxxxxxxxxxxxxxxxxxx\\n\n // \\n\n // \\n xxxxxxxxxxxxxxxxxxxxxxxx[End]\n // <---------\n //\n QUEX_CHARACTER_TYPE* it = End - 1;\n for(; *it != '\\n' ; --it) {\n if( it == Begin ) {\n // -- in case NO newline occurs, the column index is to be INCREASED \n // by the length of the string -1, since counting starts at zero\n // -- _column_number_at_begin = _column_number_at_end - LexemeLength (just take the old one)\n# ifdef QUEX_OPTION_COLUMN_NUMBER_COUNTING\n _column_number_at_end += LexemeLength;\n# endif\n return it;\n }\n }\n# ifdef QUEX_OPTION_COLUMN_NUMBER_COUNTING\n // -- in case that newline occurs, the column index is equal to\n // the number of letters from newline to end of string\n _column_number_at_end = End - it;\n# endif\n# ifdef QUEX_OPTION_LINE_NUMBER_COUNTING\n if( LicenseToIncrementLineCountF ) ++_line_number_at_end;\n# endif\n return it;\n#endif\n}\n\ninline void \nCounter::__shift_end_values_to_start_values() \n{\n# ifdef QUEX_OPTION_LINE_NUMBER_COUNTING\n _line_number_at_begin = _line_number_at_end;\n# endif\n# ifdef QUEX_OPTION_COLUMN_NUMBER_COUNTING\n _column_number_at_begin = _column_number_at_end;\n# endif\n}\n\n}\n" }, { "alpha_fraction": 0.5556485652923584, "alphanum_fraction": 0.5673640370368958, "avg_line_length": 19.568965911865234, "blob_id": "c0dc8fae608fd8f3b4c2b26f6d9fceb87129abec", "content_id": "9361356fe3d43ab6d5ca43496fc7c36ceae99856", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 1195, "license_type": "permissive", "max_line_length": 63, "num_lines": 58, "path": "/dependencies/quex-0.34.1/demo/008/main.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "#include <fstream> \n#include <iostream> \n#include \"Calc_parser.tab.hpp\"\n#include \"Calc_lexer\"\n\nint Calc_yyparse(quex::Calc_lexer *qlex);\n\nint main(int argc, char** argv) \n{\n\tquex::Calc_lexer qlex(argc == 1 ? \"example.txt\" : argv[1]);\n\n std::cout << \"Calculator Example Application\\n\";\n std::cout << \"Contributed by: Marco Antonelli (date: 09y11m7d)\\n\\n\";\n\n\tint ret = Calc_yyparse(&qlex);\n\tif (ret!=0)\n\t{\n\t\tstd::cout << \"Some error in yyparse\\n\";\n\t\treturn ret;\n\t}\n\treturn 0;\n}\n\n//void printit(wstring *arg)\n//{\n//\t\n//\tconst wchar_t *str = arg->c_str();\n//\tchar * dest;\n//\tsize_t len;\n//\t\n//\t/* first arg == NULL means 'calculate needed space' */\n//\tlen = wcstombs(NULL, str, 0);\n//\t\n//\t/* a size of -1 means there are characters that could not\n//\tbe converted to current locale */\n//\tif(len == (size_t)-1)\n//\t{\n//\t\tcout << \"wchar print error\" << endl;\n//\t\treturn;\n//\t}\n//\t\n//\t/* malloc the necessary space */\n//\tif((dest = (char *)malloc(len + 1)) == NULL)\n//\t{\n//\t\tcout << \"malloc error\" << endl;\n//\t\treturn;\n//\t}\n//\t\n//\t/* really do it */\n//\twcstombs(dest, str, len);\n//\t\n//\t/* ensure NULL-termination */\n//\tdest[len] = '\\0';\n//\t\n//\tcout << \"value: \" << dest << endl;\n//\t\n//\tfree(dest);\n//}\n\n\n" }, { "alpha_fraction": 0.5649879574775696, "alphanum_fraction": 0.577869176864624, "avg_line_length": 33.18037033081055, "blob_id": "216446f84d6d371f7e3fbbd27862f53f735838d0", "content_id": "64db1997a21103c36ba503b2424694b997204924", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 12887, "license_type": "permissive", "max_line_length": 100, "num_lines": 377, "path": "/engine/win32/keyboard_direct_input8.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <assert.h>\n#include <iostream>\n\n#include \"keyboard_direct_input8.h\"\n#include <centralised_log.h>\n\n\n#define BUFFSZ 128\n\nstatic const char *result_str(HRESULT r)\n{{{\n #define Shittymacro(id) if (r==(HRESULT)id) return #id; else\n Shittymacro(DI_BUFFEROVERFLOW)\n Shittymacro(DI_DOWNLOADSKIPPED)\n Shittymacro(DI_EFFECTRESTARTED)\n Shittymacro(DI_NOEFFECT)\n Shittymacro(DI_NOTATTACHED)\n Shittymacro(DI_OK)\n Shittymacro(DI_POLLEDDEVICE)\n Shittymacro(DI_PROPNOEFFECT)\n Shittymacro(DI_SETTINGSNOTSAVED)\n Shittymacro(DI_TRUNCATED)\n Shittymacro(DI_TRUNCATEDANDRESTARTED)\n Shittymacro(DI_WRITEPROTECT)\n Shittymacro(DIERR_ACQUIRED)\n Shittymacro(DIERR_ALREADYINITIALIZED)\n Shittymacro(DIERR_BADDRIVERVER)\n Shittymacro(DIERR_BETADIRECTINPUTVERSION)\n Shittymacro(DIERR_DEVICEFULL)\n Shittymacro(DIERR_DEVICENOTREG)\n Shittymacro(DIERR_EFFECTPLAYING)\n Shittymacro(DIERR_GENERIC)\n Shittymacro(DIERR_HANDLEEXISTS)\n Shittymacro(DIERR_HASEFFECTS)\n Shittymacro(DIERR_INCOMPLETEEFFECT)\n Shittymacro(DIERR_INPUTLOST)\n Shittymacro(DIERR_INVALIDPARAM)\n Shittymacro(DIERR_MAPFILEFAIL)\n Shittymacro(DIERR_MOREDATA)\n Shittymacro(DIERR_NOAGGREGATION)\n Shittymacro(DIERR_NOINTERFACE)\n Shittymacro(DIERR_NOTACQUIRED)\n Shittymacro(DIERR_NOTBUFFERED)\n Shittymacro(DIERR_NOTDOWNLOADED)\n Shittymacro(DIERR_NOTEXCLUSIVEACQUIRED)\n Shittymacro(DIERR_NOTFOUND)\n Shittymacro(DIERR_NOTINITIALIZED)\n Shittymacro(DIERR_OBJECTNOTFOUND)\n Shittymacro(DIERR_OLDDIRECTINPUTVERSION)\n Shittymacro(DIERR_OTHERAPPHASPRIO)\n Shittymacro(DIERR_OUTOFMEMORY)\n Shittymacro(DIERR_READONLY)\n Shittymacro(DIERR_REPORTFULL)\n Shittymacro(DIERR_UNPLUGGED)\n Shittymacro(DIERR_UNSUPPORTED)\n Shittymacro(E_HANDLE)\n Shittymacro(E_PENDING)\n Shittymacro(E_POINTER) {\n return \"Unrecognised result (shouldn't happen)\";\n }\n}}}\n\n#define BAD_DI_RESULT(r,i_was) do { CERR<<i_was<<\": \"<<result_str(r)<<std::endl; } while (0)\n\nstatic ULONGLONG millis()\n{\n FILETIME time;\n GetSystemTimeAsFileTime(&time);\n ULARGE_INTEGER millis;\n millis.LowPart = time.dwLowDateTime;\n millis.HighPart = time.dwHighDateTime;\n return millis.QuadPart/10000;\n}\n\nKeyboardDirectInput8::KeyboardDirectInput8(size_t window)\n{\n\n #define MAP_KEY(kc,k) keysDown.insert(std::make_pair(kc,\"+\"k)); \\\n keysRep.insert(std::make_pair(kc,\"=\"k)); \\\n keysUp.insert(std::make_pair(kc,\"-\"k)); \\\n keyCode.insert(std::make_pair(k,kc))\n\n #define MAP_KEY_TEXT2(kc,k,kt,ks) keysDown.insert(std::make_pair(kc,\"+\"k)); \\\n keysRep.insert(std::make_pair(kc,\"=\"k)); \\\n keysUp.insert(std::make_pair(kc,\"-\"k)); \\\n keysText.insert(std::make_pair(kc,\":\"kt)); \\\n keysTextShifted.insert(std::make_pair(kc,\":\"ks)); \\\n keyCode.insert(std::make_pair(k,kc))\n\n #define MAP_KEY_TEXT(kc,k,ks) MAP_KEY_TEXT2(kc,k,k,ks)\n\n MAP_KEY_TEXT(DIK_1, \"1\", \"!\");\n MAP_KEY_TEXT(DIK_2, \"2\", \"@\");\n MAP_KEY_TEXT(DIK_3, \"3\", \"#\");\n MAP_KEY_TEXT(DIK_4, \"4\", \"$\");\n MAP_KEY_TEXT(DIK_5, \"5\", \"%\");\n MAP_KEY_TEXT(DIK_6, \"6\", \"^\");\n MAP_KEY_TEXT(DIK_7, \"7\", \"&\");\n MAP_KEY_TEXT(DIK_8, \"8\", \"*\");\n MAP_KEY_TEXT(DIK_9, \"9\", \"(\");\n MAP_KEY_TEXT(DIK_0, \"0\", \")\");\n\n MAP_KEY(DIK_BACK, \"BackSpace\");\n\n MAP_KEY_TEXT(DIK_MINUS, \"-\", \"_\");\n MAP_KEY_TEXT(DIK_EQUALS, \"=\", \"+\");\n MAP_KEY_TEXT2(DIK_SPACE, \"Space\", \" \", \" \");\n MAP_KEY_TEXT(DIK_COMMA, \",\", \"<\");\n MAP_KEY_TEXT(DIK_PERIOD, \".\", \">\");\n\n MAP_KEY_TEXT(DIK_BACKSLASH, \"\\\\\", \"|\");\n MAP_KEY_TEXT(DIK_SLASH, \"/\", \"?\");\n MAP_KEY_TEXT(DIK_LBRACKET, \"[\", \"{\");\n MAP_KEY_TEXT(DIK_RBRACKET, \"]\", \"}\");\n\n MAP_KEY(DIK_ESCAPE,\"Escape\");\n MAP_KEY(DIK_CAPSLOCK, \"CapsLock\");\n\n MAP_KEY(DIK_TAB, \"Tab\");\n MAP_KEY(DIK_RETURN, \"Return\");\n MAP_KEY(DIK_LCONTROL, \"Ctrl\");\n MAP_KEY(DIK_RCONTROL, \"Ctrl\");\n\n MAP_KEY(DIK_COLON, \":\");\n MAP_KEY_TEXT(DIK_SEMICOLON, \";\", \":\");\n MAP_KEY_TEXT(DIK_APOSTROPHE, \"'\", \"\\\"\");\n MAP_KEY_TEXT(DIK_GRAVE, \"`\", \"~\");\n\n MAP_KEY_TEXT(DIK_A, \"a\", \"A\");\n MAP_KEY_TEXT(DIK_B, \"b\", \"B\");\n MAP_KEY_TEXT(DIK_C, \"c\", \"C\");\n MAP_KEY_TEXT(DIK_D, \"d\", \"D\");\n MAP_KEY_TEXT(DIK_E, \"e\", \"E\");\n MAP_KEY_TEXT(DIK_F, \"f\", \"F\");\n MAP_KEY_TEXT(DIK_G, \"g\", \"G\");\n MAP_KEY_TEXT(DIK_H, \"h\", \"H\");\n MAP_KEY_TEXT(DIK_I, \"i\", \"I\");\n MAP_KEY_TEXT(DIK_J, \"j\", \"J\");\n MAP_KEY_TEXT(DIK_K, \"k\", \"K\");\n MAP_KEY_TEXT(DIK_L, \"l\", \"L\");\n MAP_KEY_TEXT(DIK_M, \"m\", \"M\");\n MAP_KEY_TEXT(DIK_N, \"n\", \"N\");\n MAP_KEY_TEXT(DIK_O, \"o\", \"O\");\n MAP_KEY_TEXT(DIK_P, \"p\", \"P\");\n MAP_KEY_TEXT(DIK_Q, \"q\", \"Q\");\n MAP_KEY_TEXT(DIK_R, \"r\", \"R\");\n MAP_KEY_TEXT(DIK_S, \"s\", \"S\");\n MAP_KEY_TEXT(DIK_T, \"t\", \"T\");\n MAP_KEY_TEXT(DIK_U, \"u\", \"U\");\n MAP_KEY_TEXT(DIK_V, \"v\", \"V\");\n MAP_KEY_TEXT(DIK_W, \"w\", \"W\");\n MAP_KEY_TEXT(DIK_X, \"x\", \"X\");\n MAP_KEY_TEXT(DIK_Y, \"y\", \"Y\");\n MAP_KEY_TEXT(DIK_Z, \"z\", \"Z\");\n\n MAP_KEY(DIK_F1, \"F1\");\n MAP_KEY(DIK_F2, \"F2\");\n MAP_KEY(DIK_F3, \"F3\");\n MAP_KEY(DIK_F4, \"F4\");\n MAP_KEY(DIK_F5, \"F5\");\n MAP_KEY(DIK_F6, \"F6\");\n MAP_KEY(DIK_F7, \"F7\");\n MAP_KEY(DIK_F8, \"F8\");\n MAP_KEY(DIK_F9, \"F9\");\n MAP_KEY(DIK_F10, \"F10\");\n MAP_KEY(DIK_F11, \"F11\");\n MAP_KEY(DIK_F12, \"F12\");\n MAP_KEY(DIK_F13, \"F13\");\n MAP_KEY(DIK_F14, \"F14\");\n MAP_KEY(DIK_F15, \"F15\");\n\n MAP_KEY_TEXT2(DIK_NUMPAD0, \"NUMPAD0\", \"0\", \"0\");\n MAP_KEY_TEXT2(DIK_NUMPAD1, \"NUMPAD1\", \"1\", \"1\");\n MAP_KEY_TEXT2(DIK_NUMPAD2, \"NUMPAD2\", \"2\", \"2\");\n MAP_KEY_TEXT2(DIK_NUMPAD3, \"NUMPAD3\", \"3\", \"3\");\n MAP_KEY_TEXT2(DIK_NUMPAD4, \"NUMPAD4\", \"4\", \"4\");\n MAP_KEY_TEXT2(DIK_NUMPAD5, \"NUMPAD5\", \"5\", \"5\");\n MAP_KEY_TEXT2(DIK_NUMPAD6, \"NUMPAD6\", \"6\", \"6\");\n MAP_KEY_TEXT2(DIK_NUMPAD7, \"NUMPAD7\", \"7\", \"7\");\n MAP_KEY_TEXT2(DIK_NUMPAD8, \"NUMPAD8\", \"8\", \"8\");\n MAP_KEY_TEXT2(DIK_NUMPAD9, \"NUMPAD9\", \"9\", \"9\");\n MAP_KEY(DIK_NUMPADENTER, \"NUMPADReturn\");\n\n MAP_KEY(DIK_UP, \"Up\");\n MAP_KEY(DIK_DOWN, \"Down\");\n MAP_KEY(DIK_LEFT, \"Left\");\n MAP_KEY(DIK_RIGHT, \"Right\");\n\n MAP_KEY(DIK_PGUP, \"PageUp\");\n MAP_KEY(DIK_PGDN, \"PageDown\");\n MAP_KEY(DIK_HOME, \"Home\");\n MAP_KEY(DIK_END, \"End\");\n\n MAP_KEY(DIK_NUMLOCK, \"NumLock\");\n MAP_KEY(DIK_SYSRQ, \"SysRq\");\n MAP_KEY(DIK_SCROLL, \"Scroll\");\n MAP_KEY(DIK_PAUSE, \"Pause\");\n\n MAP_KEY(DIK_RSHIFT, \"Shift\");\n MAP_KEY(DIK_LSHIFT, \"Shift\");\n MAP_KEY(DIK_RALT, \"Alt\");\n MAP_KEY(DIK_LALT, \"Alt\");\n\n MAP_KEY(DIK_INSERT, \"Insert\");\n MAP_KEY(DIK_DELETE, \"Delete\");\n\n MAP_KEY(DIK_LWIN, \"Win\");\n MAP_KEY(DIK_RWIN, \"Win\");\n MAP_KEY(DIK_APPS, \"Menu\");\n\n\n\n\n\n win = (HWND)window;\n\n // create the root interface\n HRESULT r = DirectInput8Create(\n GetModuleHandle(0), DIRECTINPUT_VERSION, IID_IDirectInput8, (void**)&directInput, NULL);\n if (FAILED(r)) BAD_DI_RESULT(r,\"creating di8 root object\");\n\n // create a keyboard device\n r = directInput->CreateDevice(GUID_SysKeyboard,&dev,NULL);\n if (FAILED(r)) BAD_DI_RESULT(r,\"creating di8 device\");\n\n // Keyboard2 gives us more buttons - 8 instead of 4\n r = dev->SetDataFormat(&c_dfDIKeyboard);\n if (FAILED(r)) BAD_DI_RESULT(r,\"calling SetDataFormat\");\n\n r = dev->SetCooperativeLevel(win, DISCL_FOREGROUND|DISCL_NONEXCLUSIVE);\n if (FAILED(r)) BAD_DI_RESULT(r,\"calling SetCooperativeLevel\");\n\n // http://msdn2.microsoft.com/en-us/library/bb219669.aspx\n DIPROPDWORD dipdw;\n dipdw.diph.dwSize = sizeof(DIPROPDWORD);\n dipdw.diph.dwHeaderSize = sizeof(DIPROPHEADER);\n dipdw.diph.dwObj = 0;\n dipdw.diph.dwHow = DIPH_DEVICE;\n dipdw.dwData = BUFFSZ;\n\n // set buffer size to BUFFSZ\n r = dev->SetProperty(DIPROP_BUFFERSIZE, &dipdw.diph );\n if (FAILED(r)) BAD_DI_RESULT(r,\"setting buffer size\");\n\n lastTime = millis();\n}\n\nKeyboardDirectInput8::~KeyboardDirectInput8()\n{\n if (dev) {\n dev->Unacquire();\n dev->Release();\n dev = NULL;\n }\n if (directInput) {\n directInput->Release();\n }\n}\n\nbool KeyboardDirectInput8::hasFocus (void)\n{\n return GetActiveWindow() == win;\n}\n\nunsigned long repeatRate = 60;\nunsigned long repeatDelay = 300;\n\nKeyboard::Presses KeyboardDirectInput8::getPresses()\n{\n typedef std::map<DWORD, ULONGLONG>::iterator I;\n\n Keyboard::Presses ret;\n\n ULONGLONG this_time = millis();\n\n DWORD num_elements = BUFFSZ;\n DIDEVICEOBJECTDATA buf[BUFFSZ];\n\n HRESULT r;\n r = dev->GetDeviceData(sizeof(DIDEVICEOBJECTDATA),buf,&num_elements,0);\n if (r==DIERR_INPUTLOST || r==DIERR_NOTACQUIRED) {\n r = dev->Acquire();\n if (r==DIERR_OTHERAPPHASPRIO) {\n // let function exit normally but with no data\n } else if (FAILED(r)) {\n BAD_DI_RESULT(r,\"reacquiring keyboard\");\n }\n } else if (FAILED(r)) {\n BAD_DI_RESULT(r,\"getting keyboard data\");\n } else {\n // finally, process events\n for (DWORD i=0 ; i<num_elements ; i++) {\n DWORD kc = buf[i].dwOfs;\n bool down = 0!=(buf[i].dwData & 0x80);\n if (verbose) {\n CLOG << \"dinput: \" << kc\n << \" = \" << down << std::endl;\n }\n const char *keystr;\n const char *keystr_text = NULL;\n if (down) {\n pressTime[kc] = this_time;\n keystr = keysDown[kc];\n if (pressTime.find(DIK_LCONTROL) == pressTime.end() &&\n pressTime.find(DIK_RCONTROL) == pressTime.end() &&\n pressTime.find(DIK_LALT) == pressTime.end() &&\n pressTime.find(DIK_RALT) == pressTime.end()) {\n if (pressTime.find(DIK_LSHIFT) != pressTime.end()\n || pressTime.find(DIK_RSHIFT) != pressTime.end()) {\n keystr_text = keysTextShifted[kc];\n } else {\n keystr_text = keysText[kc];\n }\n }\n } else {\n pressTime.erase(kc);\n keystr = keysUp[kc];\n }\n if (keystr!=NULL) {\n ret.push_back(keystr);\n } else {\n CERR << \"dinput: unrecognised key: \" << kc\n << \" = \" << down << std::endl;\n }\n if (keystr_text!=NULL) {\n ret.push_back(keystr_text);\n }\n }\n }\n\n for (I i=pressTime.begin(), i_=pressTime.end() ; i!=i_ ; ++i) {\n // repeat\n DWORD key = i->first;\n ULONGLONG &press_time = i->second;\n if (press_time + repeatDelay > this_time) continue; // hasn't been held down long enough yet\n ULONGLONG repeat_period = 1000 / repeatRate;\n for (; press_time + repeatDelay + repeat_period <= this_time ;\n press_time += repeat_period) {\n ret.push_back(keysRep[key]);\n if (pressTime.find(DIK_LCONTROL) == pressTime.end() &&\n pressTime.find(DIK_RCONTROL) == pressTime.end() &&\n pressTime.find(DIK_LALT) == pressTime.end() &&\n pressTime.find(DIK_RALT) == pressTime.end()) {\n if (pressTime.find(DIK_LSHIFT) != pressTime.end()\n || pressTime.find(DIK_RSHIFT) != pressTime.end()) {\n if (keysTextShifted[key]) ret.push_back(keysTextShifted[key]);\n } else {\n if (keysText[key]) ret.push_back(keysText[key]);\n }\n }\n }\n }\n\n lastTime = this_time;\n return ret;\n}\n\n" }, { "alpha_fraction": 0.7338142395019531, "alphanum_fraction": 0.7345356345176697, "avg_line_length": 33.01840591430664, "blob_id": "b5909e691a34f46ea4ad595e1428b06853450652", "content_id": "822d525180ab374168181692972a7a7d7effdc0a", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 5545, "license_type": "permissive", "max_line_length": 96, "num_lines": 163, "path": "/engine/gfx/gfx_material.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\nclass GfxMaterial;\n\n#ifndef GFX_MATERIAL_H\n#define GFX_MATERIAL_H\n\n#include <mutex>\n\n#include \"gfx.h\"\n#include \"gfx_internal.h\"\n#include \"gfx_shader.h\"\n#include \"gfx_texture_state.h\"\n\n\n/* LOCKING STRATEGY:\n *\n * The background resource loading thread needs to know what dependent textures to load\n * after loading a mesh referencing a particular set of materials. This means it has\n * to access the material database, which is also being accessed from the primary render\n * thread.\n */\nextern std::recursive_mutex gfx_material_lock;\n#define GFX_MAT_SYNC std::lock_guard<std::recursive_mutex> _scoped_lock(gfx_material_lock)\n\n\nclass GfxBaseMaterial {\n\n protected:\n\n GfxShader *shader;\n GfxShaderBindings bindings;\n GfxTextureStateMap textures;\n \n public:\n\n GfxBaseMaterial (const std::string name, GfxShader *shader);\n virtual ~GfxBaseMaterial (void) { }\n \n const std::string name;\n \n const GfxTextureStateMap &getTextures (void) const { return textures; } \n void setTextures (const GfxTextureStateMap &v) { GFX_MAT_SYNC; textures = v; }\n\n void addDependencies (DiskResource *into) const;\n\n const GfxShaderBindings &getBindings (void) const { return bindings; }\n void setBindings (const GfxShaderBindings &v) { bindings = v; }\n \n GfxShader *getShader (void) const { return shader; }\n void setShader (GfxShader *v);\n \n};\n\ntypedef std::map<std::string, GfxBaseMaterial*> GfxMaterialDB;\n\nextern GfxMaterialDB material_db;\n\n\ntypedef std::vector<GfxMaterial*> GfxMaterials;\n\nenum GfxMaterialSceneBlend {\n GFX_MATERIAL_OPAQUE,\n GFX_MATERIAL_ALPHA,\n GFX_MATERIAL_ALPHA_DEPTH,\n};\n\nclass GfxMaterial : public GfxBaseMaterial {\n\n GfxGslMaterialEnvironment matEnv;\n GfxGslMaterialEnvironment matEnvAdditional;\n GfxGslMeshEnvironment meshEnv;\n GfxGslMeshEnvironment meshEnvInstanced;\n\n public: // hack\n Ogre::MaterialPtr regularMat; // Either just forward or complete (for alpha, etc)\n Ogre::MaterialPtr additionalMat; // Just the additional lighting as an additive pass\n Ogre::MaterialPtr castMat; // For shadow cast phase\n Ogre::MaterialPtr instancingMat; // For rendering with instanced geometry\n Ogre::MaterialPtr instancingCastMat; // Shadow cast phase (instanced geometry)\n Ogre::MaterialPtr wireframeMat; // Just white (complete shader).\n\n private:\n GfxMaterial (const std::string &name);\n GfxMaterialSceneBlend sceneBlend;\n bool backfaces;\n bool castShadows;\n // TODO(dcunnin): Infer this from the additional gasoline (constant propagation).\n // In particular, first person and alpha do not honour this annotation (so it's broken).\n bool additionalLighting;\n // How many bones can be blended at a given vertex.\n unsigned boneBlendWeights;\n // Whether to use discard from dangs shader\n // TODO(dcunnin): Infer this from the dangs gasoline (is it possible to discard a fragment?)\n bool shadowAlphaReject;\n float shadowBias;\n\n // TODO: various addressing modes for textures\n\n public:\n GfxMaterialSceneBlend getSceneBlend (void) const { return sceneBlend; }\n void setSceneBlend (GfxMaterialSceneBlend v);\n\n bool getBackfaces (void) const { return backfaces; }\n void setBackfaces (bool v);\n\n unsigned getBoneBlendWeights (void) const { return boneBlendWeights; }\n void setBoneBlendWeights (unsigned v);\n\n bool getCastShadows (void) const { return castShadows; }\n void setCastShadows (bool v);\n\n bool getAdditionalLighting (void) const { return additionalLighting; }\n void setAdditionalLighting (bool v);\n\n bool getShadowBias (void) const { return shadowBias; }\n void setShadowBias (float v);\n\n bool getShadowAlphaReject (void) const { return shadowAlphaReject; }\n void setShadowAlphaReject (bool v);\n\n void buildOgreMaterials (void);\n void updateOgreMaterials (const GfxShaderGlobals &globs);\n\n const GfxGslMaterialEnvironment &getMaterialEnvironment (void) const { return matEnv; }\n\n friend GfxMaterial *gfx_material_add(const std::string &);\n friend class GfxBody;\n};\n\n\nGfxMaterial *gfx_material_add (const std::string &name);\n\nGfxMaterial *gfx_material_add_or_get (const std::string &name);\n\nGfxMaterial *gfx_material_get (const std::string &name);\n\nbool gfx_material_has_any (const std::string &name);\n\nbool gfx_material_has (const std::string &name);\n\nvoid gfx_material_init (void);\n\n#endif\n" }, { "alpha_fraction": 0.431938499212265, "alphanum_fraction": 0.4725361466407776, "avg_line_length": 31.42922019958496, "blob_id": "e73e48d3cea2800b30224d62b68db1d8ac071357", "content_id": "5b5aa85880b859d8c621a3fcd23ca0130d843210", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 78576, "license_type": "permissive", "max_line_length": 130, "num_lines": 2423, "path": "/dependencies/quex-0.34.1/demo/000/tmp.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "#include \"tiny_lexer\"\n#if ! defined(__QUEX_SETTING_PLAIN_C)\nnamespace quex {\n#endif\n#define QUEX_LEXER_CLASS tiny_lexer\n\n#include <quex/code_base/template/Analyser>\n#include <quex/code_base/buffer/Buffer>\n\n#ifdef CONTINUE\n# undef CONTINUE\n#endif\n#define CONTINUE goto __REENTRY_PREPARATION;\n#include <quex/code_base/temporary_macros_on>\n\n__QUEX_SETTING_ANALYSER_FUNCTION_RETURN_TYPE \ntiny_lexer_ONE_AND_ONLY_analyser_function(QuexAnalyser* me) \n{\n /* NOTE: Different modes correspond to different analyser functions. The analyser*/\n /* functions are all located inside the main class as static functions. That*/\n /* means, they are something like 'globals'. They receive a pointer to the */\n /* lexical analyser, since static member do not have access to the 'this' pointer.*/\n# if defined (__QUEX_SETTING_PLAIN_C)\n# define self (*me)\n# else\n using namespace quex;\n QUEX_LEXER_CLASS& self = *((QUEX_LEXER_CLASS*)me);\n# endif\n /* me = pointer to state of the lexical analyser */\n quex::QuexMode& ONE_AND_ONLY = QUEX_LEXER_CLASS::ONE_AND_ONLY;\n QUEX_GOTO_LABEL_TYPE last_acceptance = QUEX_GOTO_TERMINAL_LABEL_INIT_VALUE;\n QUEX_CHARACTER_POSITION_TYPE last_acceptance_input_position = (QUEX_CHARACTER_TYPE*)(0x00);\n QUEX_CHARACTER_POSITION_TYPE* post_context_start_position = 0x0;\n QUEX_CHARACTER_TYPE input = (QUEX_CHARACTER_TYPE)(0x00);\n\n /* Post context positions do not have to be reset or initialized. If a state\n * is reached which is associated with 'end of post context' it is clear what\n * post context is meant. This results from the ways the state machine is \n * constructed. A post context positions live time looks like the following:\n *\n * (1) unitialized (don't care)\n * (1.b) on buffer reload it may, or may not be adapted (don't care)\n * (2) when a post context begin state is passed, the it is **SET** (now: take care)\n * (2.b) on buffer reload it **is adapted**.\n * (3) when a terminal state of the post context is reached (which can only be reached\n * for that particular post context, then the post context position is used\n * to reset the input position. */\n#if defined(QUEX_OPTION_AUTOMATIC_ANALYSIS_CONTINUATION_ON_MODE_CHANGE) \\\n || defined(QUEX_OPTION_ASSERTS)\n me->DEBUG_analyser_function_at_entry = me->current_analyser_function;\n#endif\n__REENTRY:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: __REENTRY\");\n QuexBuffer_mark_lexeme_start(&(me->buffer));\n QuexBuffer_undo_terminating_zero_for_lexeme(&me->buffer);\n /* state machine */\n /* init-state = 249L\n * 00249() <~ (5, 16), (7, 32), (10, 47), (13, 65), (16, 82), (19, 101), (22, 112), (25, 118), (28, 124), (35, 141), (41, 158)\n * == ['\\t', '\\n'], '\\r', ' ' ==> 00251\n * == ['0', '9'] ==> 00259\n * == ';' ==> 00258\n * == ['A', 'Z'], '_', ['a', 'c'], ['f', 'h'], ['j', 'r'], ['t', 'z'] ==> 00255\n * == 'd' ==> 00252\n * == 'e' ==> 00250\n * == 'i' ==> 00254\n * == 's' ==> 00257\n * == '{' ==> 00253\n * == '}' ==> 00256\n * <no epsilon>\n * 00256(A, S) <~ (28, 125, A, S)\n * <no epsilon>\n * 00257(A, S) <~ (41, 159, A, S), (7, 33), (16, 83)\n * == ['A', 'Z'], '_', ['a', 'd'], ['f', 's'], ['u', 'z'] ==> 00255\n * == 'e' ==> 00260\n * == 't' ==> 00261\n * <no epsilon>\n * 00260(A, S) <~ (41, 159, A, S), (16, 84)\n * == ['A', 'Z'], '_', ['a', 'm'], ['o', 'z'] ==> 00255\n * == 'n' ==> 00266\n * <no epsilon>\n * 00266(A, S) <~ (41, 159, A, S), (16, 85)\n * == ['A', 'Z'], '_', ['a', 'c'], ['e', 'z'] ==> 00255\n * == 'd' ==> 00267\n * <no epsilon>\n * 00267(A, S) <~ (16, 86, A, S)\n * == ['A', 'Z'], '_', ['a', 'z'] ==> 00255\n * <no epsilon>\n * 00255(A, S) <~ (41, 159, A, S)\n * == ['A', 'Z'], '_', ['a', 'z'] ==> 00255\n * <no epsilon>\n * 00261(A, S) <~ (41, 159, A, S), (7, 34)\n * == ['A', 'Z'], '_', ['a', 'q'], ['s', 'z'] ==> 00255\n * == 'r' ==> 00262\n * <no epsilon>\n * 00262(A, S) <~ (41, 159, A, S), (7, 35)\n * == ['A', 'Z'], '_', ['a', 't'], ['v', 'z'] ==> 00255\n * == 'u' ==> 00263\n * <no epsilon>\n * 00263(A, S) <~ (41, 159, A, S), (7, 36)\n * == ['A', 'Z'], '_', ['a', 'b'], ['d', 'z'] ==> 00255\n * == 'c' ==> 00264\n * <no epsilon>\n * 00264(A, S) <~ (41, 159, A, S), (7, 37)\n * == ['A', 'Z'], '_', ['a', 's'], ['u', 'z'] ==> 00255\n * == 't' ==> 00265\n * <no epsilon>\n * 00265(A, S) <~ (7, 38, A, S)\n * == ['A', 'Z'], '_', ['a', 'z'] ==> 00255\n * <no epsilon>\n * 00258(A, S) <~ (22, 113, A, S)\n * <no epsilon>\n * 00259(A, S) <~ (35, 142, A, S)\n * == ['0', '9'] ==> 00259\n * <no epsilon>\n * 00250(A, S) <~ (41, 159, A, S), (19, 102)\n * == ['A', 'Z'], '_', ['a', 'w'], ['y', 'z'] ==> 00255\n * == 'x' ==> 00275\n * <no epsilon>\n * 00275(A, S) <~ (41, 159, A, S), (19, 103)\n * == ['A', 'Z'], '_', ['a', 'o'], ['q', 'z'] ==> 00255\n * == 'p' ==> 00276\n * <no epsilon>\n * 00276(A, S) <~ (41, 159, A, S), (19, 104)\n * == ['A', 'Z'], '_', ['a', 'd'], ['f', 'z'] ==> 00255\n * == 'e' ==> 00277\n * <no epsilon>\n * 00277(A, S) <~ (41, 159, A, S), (19, 105)\n * == ['A', 'Z'], '_', ['a', 'b'], ['d', 'z'] ==> 00255\n * == 'c' ==> 00278\n * <no epsilon>\n * 00278(A, S) <~ (41, 159, A, S), (19, 106)\n * == ['A', 'Z'], '_', ['a', 's'], ['u', 'z'] ==> 00255\n * == 't' ==> 00279\n * <no epsilon>\n * 00279(A, S) <~ (19, 107, A, S)\n * == ['A', 'Z'], '_', ['a', 'z'] ==> 00255\n * <no epsilon>\n * 00251(A, S) <~ (5, 17, A, S)\n * == ['\\t', '\\n'], '\\r', ' ' ==> 00251\n * <no epsilon>\n * 00252(A, S) <~ (41, 159, A, S), (13, 66)\n * == ['A', 'Z'], '_', ['a', 'n'], ['p', 'z'] ==> 00255\n * == 'o' ==> 00270\n * <no epsilon>\n * 00270(A, S) <~ (41, 159, A, S), (13, 67)\n * == ['A', 'Z'], '_', ['a', 't'], ['v', 'z'] ==> 00255\n * == 'u' ==> 00271\n * <no epsilon>\n * 00271(A, S) <~ (41, 159, A, S), (13, 68)\n * == ['A', 'Z'], '_', 'a', ['c', 'z'] ==> 00255\n * == 'b' ==> 00272\n * <no epsilon>\n * 00272(A, S) <~ (41, 159, A, S), (13, 69)\n * == ['A', 'Z'], '_', ['a', 'k'], ['m', 'z'] ==> 00255\n * == 'l' ==> 00273\n * <no epsilon>\n * 00273(A, S) <~ (41, 159, A, S), (13, 70)\n * == ['A', 'Z'], '_', ['a', 'd'], ['f', 'z'] ==> 00255\n * == 'e' ==> 00274\n * <no epsilon>\n * 00274(A, S) <~ (13, 71, A, S)\n * == ['A', 'Z'], '_', ['a', 'z'] ==> 00255\n * <no epsilon>\n * 00253(A, S) <~ (25, 119, A, S)\n * <no epsilon>\n * 00254(A, S) <~ (41, 159, A, S), (10, 48)\n * == ['A', 'Z'], '_', ['a', 'm'], ['o', 'z'] ==> 00255\n * == 'n' ==> 00268\n * <no epsilon>\n * 00268(A, S) <~ (41, 159, A, S), (10, 49)\n * == ['A', 'Z'], '_', ['a', 's'], ['u', 'z'] ==> 00255\n * == 't' ==> 00269\n * <no epsilon>\n * 00269(A, S) <~ (10, 50, A, S)\n * == ['A', 'Z'], '_', ['a', 'z'] ==> 00255\n * <no epsilon>\n * \n */\nSTATE_249:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_249\");\n\n input = QuexBuffer_input_get(&(me->buffer));\n if( input < 95) {\n if( input < 33) {\n if( input < 13) {\n if( input < 9) {\n goto STATE_249_DROP_OUT; /* [-oo, \\8] */\n } else {\n if( input < 11) {\n goto STATE_251; /* ['\\t', '\\n'] */\n } else {\n goto STATE_249_DROP_OUT_DIRECT; /* [\\11, \\12] */\n }\n }\n } else {\n if( input < 14) {\n goto STATE_251; /* '\\r' */\n } else {\n if( input != 32) {\n goto STATE_249_DROP_OUT_DIRECT; /* [\\14, \\31] */\n } else {\n goto STATE_251; /* ' ' */\n }\n }\n }\n } else {\n if( input < 59) {\n if( input < 48) {\n goto STATE_249_DROP_OUT_DIRECT; /* ['!', '/'] */\n } else {\n if( input != 58) {\n goto STATE_259; /* ['0', '9'] */\n } else {\n goto STATE_249_DROP_OUT_DIRECT; /* ':' */\n }\n }\n } else {\n if( input < 65) {\n if( input == 59) {\n QuexBuffer_input_p_increment(&(me->buffer));\n goto TERMINAL_22_DIRECT; /* ';' */\n } else {\n goto STATE_249_DROP_OUT_DIRECT; /* ['<', '@'] */\n }\n } else {\n if( input < 91) {\n goto STATE_255; /* ['A', 'Z'] */\n } else {\n goto STATE_249_DROP_OUT_DIRECT; /* ['[', '^'] */\n }\n }\n }\n }\n } else {\n if( input < 106) {\n if( input < 100) {\n if( input < 96) {\n goto STATE_255; /* '_' */\n } else {\n if( input == 96) {\n goto STATE_249_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_255; /* ['a', 'c'] */\n }\n }\n } else {\n if( input < 102) {\n if( input == 100) {\n goto STATE_252; /* 'd' */\n } else {\n goto STATE_250; /* 'e' */\n }\n } else {\n if( input != 105) {\n goto STATE_255; /* ['f', 'h'] */\n } else {\n goto STATE_254; /* 'i' */\n }\n }\n }\n } else {\n if( input < 123) {\n if( input == 115) {\n goto STATE_257; /* 's' */\n } else {\n goto STATE_255; /* ['j', 'r'] */\n }\n } else {\n if( input < 125) {\n if( input == 123) {\n QuexBuffer_input_p_increment(&(me->buffer));\n goto TERMINAL_25_DIRECT; /* '{' */\n } else {\n goto STATE_249_DROP_OUT_DIRECT; /* '|' */\n }\n } else {\n if( input == 125) {\n QuexBuffer_input_p_increment(&(me->buffer));\n goto TERMINAL_28_DIRECT; /* '}' */\n } else {\n goto STATE_249_DROP_OUT_DIRECT; /* ['~', oo] */\n }\n }\n }\n }\n }\n\nSTATE_249_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_249_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_249_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_249_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n if( QuexBuffer_is_end_of_file(&(me->buffer)) ) {\n /* NO CHECK 'last_acceptance != -1' --- first state can **never** be an acceptance state */\n goto TERMINAL_END_OF_STREAM;\n }\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, 0) ) {\n goto STATE_249_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\nSTATE_249_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_249_INPUT\");\n QuexBuffer_input_p_increment(&(me->buffer));\n goto STATE_249;\nSTATE_257:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_257\");\n\nSTATE_257_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_257_INPUT\");\n\n QuexBuffer_input_p_increment(&(me->buffer));\n input = QuexBuffer_input_get(&(me->buffer));\n if( input < 97) {\n if( input < 91) {\n if( input < 65) {\n goto STATE_257_DROP_OUT; /* [-oo, '@'] */\n } else {\n goto STATE_255; /* ['A', 'Z'] */\n }\n } else {\n if( input < 95) {\n goto STATE_257_DROP_OUT_DIRECT; /* ['[', '^'] */\n } else {\n if( input == 95) {\n goto STATE_255; /* '_' */\n } else {\n goto STATE_257_DROP_OUT_DIRECT; /* '`' */\n }\n }\n }\n } else {\n if( input < 116) {\n if( input == 101) {\n goto STATE_260; /* 'e' */\n } else {\n goto STATE_255; /* ['a', 'd'] */\n }\n } else {\n if( input < 117) {\n goto STATE_261; /* 't' */\n } else {\n if( input < 123) {\n goto STATE_255; /* ['u', 'z'] */\n } else {\n goto STATE_257_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_257_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_257_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_257_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_257_DROP_OUT_DIRECT\");\n goto TERMINAL_41_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"41\");\n QUEX_SET_last_acceptance(41);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&(me->buffer));\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, 0) ) {\n goto STATE_257_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_259:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_259\");\n\nSTATE_259_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_259_INPUT\");\n\n QuexBuffer_input_p_increment(&(me->buffer));\n input = QuexBuffer_input_get(&(me->buffer));\n if( input < 48) {\n goto STATE_259_DROP_OUT; /* [-oo, '/'] */\n } else {\n if( input < 58) {\n goto STATE_259; /* ['0', '9'] */\n } else {\n goto STATE_259_DROP_OUT_DIRECT; /* [':', oo] */\n }\n }\n\nSTATE_259_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_259_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_259_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_259_DROP_OUT_DIRECT\");\n goto TERMINAL_35_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"35\");\n QUEX_SET_last_acceptance(35);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&(me->buffer));\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, 0) ) {\n goto STATE_259_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_260:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_260\");\n\nSTATE_260_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_260_INPUT\");\n\n QuexBuffer_input_p_increment(&(me->buffer));\n input = QuexBuffer_input_get(&(me->buffer));\n if( input < 96) {\n if( input < 91) {\n if( input < 65) {\n goto STATE_260_DROP_OUT; /* [-oo, '@'] */\n } else {\n goto STATE_255; /* ['A', 'Z'] */\n }\n } else {\n if( input != 95) {\n goto STATE_260_DROP_OUT_DIRECT; /* ['[', '^'] */\n } else {\n goto STATE_255; /* '_' */\n }\n }\n } else {\n if( input < 110) {\n if( input == 96) {\n goto STATE_260_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_255; /* ['a', 'm'] */\n }\n } else {\n if( input < 111) {\n goto STATE_266; /* 'n' */\n } else {\n if( input < 123) {\n goto STATE_255; /* ['o', 'z'] */\n } else {\n goto STATE_260_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_260_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_260_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_260_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_260_DROP_OUT_DIRECT\");\n goto TERMINAL_41_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"41\");\n QUEX_SET_last_acceptance(41);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&(me->buffer));\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, 0) ) {\n goto STATE_260_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_261:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_261\");\n\nSTATE_261_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_261_INPUT\");\n\n QuexBuffer_input_p_increment(&(me->buffer));\n input = QuexBuffer_input_get(&(me->buffer));\n if( input < 96) {\n if( input < 91) {\n if( input < 65) {\n goto STATE_261_DROP_OUT; /* [-oo, '@'] */\n } else {\n goto STATE_255; /* ['A', 'Z'] */\n }\n } else {\n if( input != 95) {\n goto STATE_261_DROP_OUT_DIRECT; /* ['[', '^'] */\n } else {\n goto STATE_255; /* '_' */\n }\n }\n } else {\n if( input < 114) {\n if( input == 96) {\n goto STATE_261_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_255; /* ['a', 'q'] */\n }\n } else {\n if( input < 115) {\n goto STATE_262; /* 'r' */\n } else {\n if( input < 123) {\n goto STATE_255; /* ['s', 'z'] */\n } else {\n goto STATE_261_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_261_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_261_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_261_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_261_DROP_OUT_DIRECT\");\n goto TERMINAL_41_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"41\");\n QUEX_SET_last_acceptance(41);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&(me->buffer));\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, 0) ) {\n goto STATE_261_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_262:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_262\");\n\nSTATE_262_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_262_INPUT\");\n\n QuexBuffer_input_p_increment(&(me->buffer));\n input = QuexBuffer_input_get(&(me->buffer));\n if( input < 96) {\n if( input < 91) {\n if( input < 65) {\n goto STATE_262_DROP_OUT; /* [-oo, '@'] */\n } else {\n goto STATE_255; /* ['A', 'Z'] */\n }\n } else {\n if( input != 95) {\n goto STATE_262_DROP_OUT_DIRECT; /* ['[', '^'] */\n } else {\n goto STATE_255; /* '_' */\n }\n }\n } else {\n if( input < 117) {\n if( input == 96) {\n goto STATE_262_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_255; /* ['a', 't'] */\n }\n } else {\n if( input < 118) {\n goto STATE_263; /* 'u' */\n } else {\n if( input < 123) {\n goto STATE_255; /* ['v', 'z'] */\n } else {\n goto STATE_262_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_262_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_262_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_262_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_262_DROP_OUT_DIRECT\");\n goto TERMINAL_41_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"41\");\n QUEX_SET_last_acceptance(41);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&(me->buffer));\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, 0) ) {\n goto STATE_262_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_263:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_263\");\n\nSTATE_263_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_263_INPUT\");\n\n QuexBuffer_input_p_increment(&(me->buffer));\n input = QuexBuffer_input_get(&(me->buffer));\n if( input < 96) {\n if( input < 91) {\n if( input < 65) {\n goto STATE_263_DROP_OUT; /* [-oo, '@'] */\n } else {\n goto STATE_255; /* ['A', 'Z'] */\n }\n } else {\n if( input != 95) {\n goto STATE_263_DROP_OUT_DIRECT; /* ['[', '^'] */\n } else {\n goto STATE_255; /* '_' */\n }\n }\n } else {\n if( input < 99) {\n if( input == 96) {\n goto STATE_263_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_255; /* ['a', 'b'] */\n }\n } else {\n if( input < 100) {\n goto STATE_264; /* 'c' */\n } else {\n if( input < 123) {\n goto STATE_255; /* ['d', 'z'] */\n } else {\n goto STATE_263_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_263_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_263_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_263_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_263_DROP_OUT_DIRECT\");\n goto TERMINAL_41_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"41\");\n QUEX_SET_last_acceptance(41);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&(me->buffer));\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, 0) ) {\n goto STATE_263_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_264:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_264\");\n\nSTATE_264_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_264_INPUT\");\n\n QuexBuffer_input_p_increment(&(me->buffer));\n input = QuexBuffer_input_get(&(me->buffer));\n if( input < 96) {\n if( input < 91) {\n if( input < 65) {\n goto STATE_264_DROP_OUT; /* [-oo, '@'] */\n } else {\n goto STATE_255; /* ['A', 'Z'] */\n }\n } else {\n if( input != 95) {\n goto STATE_264_DROP_OUT_DIRECT; /* ['[', '^'] */\n } else {\n goto STATE_255; /* '_' */\n }\n }\n } else {\n if( input < 116) {\n if( input == 96) {\n goto STATE_264_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_255; /* ['a', 's'] */\n }\n } else {\n if( input < 117) {\n goto STATE_265; /* 't' */\n } else {\n if( input < 123) {\n goto STATE_255; /* ['u', 'z'] */\n } else {\n goto STATE_264_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_264_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_264_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_264_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_264_DROP_OUT_DIRECT\");\n goto TERMINAL_41_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"41\");\n QUEX_SET_last_acceptance(41);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&(me->buffer));\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, 0) ) {\n goto STATE_264_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_265:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_265\");\n\nSTATE_265_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_265_INPUT\");\n\n QuexBuffer_input_p_increment(&(me->buffer));\n input = QuexBuffer_input_get(&(me->buffer));\n if( input < 95) {\n if( input < 65) {\n goto STATE_265_DROP_OUT; /* [-oo, '@'] */\n } else {\n if( input < 91) {\n goto STATE_255; /* ['A', 'Z'] */\n } else {\n goto STATE_265_DROP_OUT_DIRECT; /* ['[', '^'] */\n }\n }\n } else {\n if( input < 97) {\n if( input == 95) {\n goto STATE_255; /* '_' */\n } else {\n goto STATE_265_DROP_OUT_DIRECT; /* '`' */\n }\n } else {\n if( input < 123) {\n goto STATE_255; /* ['a', 'z'] */\n } else {\n goto STATE_265_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n\nSTATE_265_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_265_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_265_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_265_DROP_OUT_DIRECT\");\n goto TERMINAL_7_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"7\");\n QUEX_SET_last_acceptance(7);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&(me->buffer));\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, 0) ) {\n goto STATE_265_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_266:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_266\");\n\nSTATE_266_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_266_INPUT\");\n\n QuexBuffer_input_p_increment(&(me->buffer));\n input = QuexBuffer_input_get(&(me->buffer));\n if( input < 96) {\n if( input < 91) {\n if( input < 65) {\n goto STATE_266_DROP_OUT; /* [-oo, '@'] */\n } else {\n goto STATE_255; /* ['A', 'Z'] */\n }\n } else {\n if( input != 95) {\n goto STATE_266_DROP_OUT_DIRECT; /* ['[', '^'] */\n } else {\n goto STATE_255; /* '_' */\n }\n }\n } else {\n if( input < 100) {\n if( input == 96) {\n goto STATE_266_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_255; /* ['a', 'c'] */\n }\n } else {\n if( input < 101) {\n goto STATE_267; /* 'd' */\n } else {\n if( input < 123) {\n goto STATE_255; /* ['e', 'z'] */\n } else {\n goto STATE_266_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_266_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_266_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_266_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_266_DROP_OUT_DIRECT\");\n goto TERMINAL_41_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"41\");\n QUEX_SET_last_acceptance(41);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&(me->buffer));\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, 0) ) {\n goto STATE_266_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_267:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_267\");\n\nSTATE_267_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_267_INPUT\");\n\n QuexBuffer_input_p_increment(&(me->buffer));\n input = QuexBuffer_input_get(&(me->buffer));\n if( input < 95) {\n if( input < 65) {\n goto STATE_267_DROP_OUT; /* [-oo, '@'] */\n } else {\n if( input < 91) {\n goto STATE_255; /* ['A', 'Z'] */\n } else {\n goto STATE_267_DROP_OUT_DIRECT; /* ['[', '^'] */\n }\n }\n } else {\n if( input < 97) {\n if( input == 95) {\n goto STATE_255; /* '_' */\n } else {\n goto STATE_267_DROP_OUT_DIRECT; /* '`' */\n }\n } else {\n if( input < 123) {\n goto STATE_255; /* ['a', 'z'] */\n } else {\n goto STATE_267_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n\nSTATE_267_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_267_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_267_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_267_DROP_OUT_DIRECT\");\n goto TERMINAL_16_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"16\");\n QUEX_SET_last_acceptance(16);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&(me->buffer));\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, 0) ) {\n goto STATE_267_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_268:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_268\");\n\nSTATE_268_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_268_INPUT\");\n\n QuexBuffer_input_p_increment(&(me->buffer));\n input = QuexBuffer_input_get(&(me->buffer));\n if( input < 96) {\n if( input < 91) {\n if( input < 65) {\n goto STATE_268_DROP_OUT; /* [-oo, '@'] */\n } else {\n goto STATE_255; /* ['A', 'Z'] */\n }\n } else {\n if( input != 95) {\n goto STATE_268_DROP_OUT_DIRECT; /* ['[', '^'] */\n } else {\n goto STATE_255; /* '_' */\n }\n }\n } else {\n if( input < 116) {\n if( input == 96) {\n goto STATE_268_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_255; /* ['a', 's'] */\n }\n } else {\n if( input < 117) {\n goto STATE_269; /* 't' */\n } else {\n if( input < 123) {\n goto STATE_255; /* ['u', 'z'] */\n } else {\n goto STATE_268_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_268_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_268_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_268_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_268_DROP_OUT_DIRECT\");\n goto TERMINAL_41_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"41\");\n QUEX_SET_last_acceptance(41);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&(me->buffer));\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, 0) ) {\n goto STATE_268_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_269:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_269\");\n\nSTATE_269_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_269_INPUT\");\n\n QuexBuffer_input_p_increment(&(me->buffer));\n input = QuexBuffer_input_get(&(me->buffer));\n if( input < 95) {\n if( input < 65) {\n goto STATE_269_DROP_OUT; /* [-oo, '@'] */\n } else {\n if( input < 91) {\n goto STATE_255; /* ['A', 'Z'] */\n } else {\n goto STATE_269_DROP_OUT_DIRECT; /* ['[', '^'] */\n }\n }\n } else {\n if( input < 97) {\n if( input == 95) {\n goto STATE_255; /* '_' */\n } else {\n goto STATE_269_DROP_OUT_DIRECT; /* '`' */\n }\n } else {\n if( input < 123) {\n goto STATE_255; /* ['a', 'z'] */\n } else {\n goto STATE_269_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n\nSTATE_269_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_269_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_269_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_269_DROP_OUT_DIRECT\");\n goto TERMINAL_10_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"10\");\n QUEX_SET_last_acceptance(10);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&(me->buffer));\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, 0) ) {\n goto STATE_269_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_270:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_270\");\n\nSTATE_270_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_270_INPUT\");\n\n QuexBuffer_input_p_increment(&(me->buffer));\n input = QuexBuffer_input_get(&(me->buffer));\n if( input < 96) {\n if( input < 91) {\n if( input < 65) {\n goto STATE_270_DROP_OUT; /* [-oo, '@'] */\n } else {\n goto STATE_255; /* ['A', 'Z'] */\n }\n } else {\n if( input != 95) {\n goto STATE_270_DROP_OUT_DIRECT; /* ['[', '^'] */\n } else {\n goto STATE_255; /* '_' */\n }\n }\n } else {\n if( input < 117) {\n if( input == 96) {\n goto STATE_270_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_255; /* ['a', 't'] */\n }\n } else {\n if( input < 118) {\n goto STATE_271; /* 'u' */\n } else {\n if( input < 123) {\n goto STATE_255; /* ['v', 'z'] */\n } else {\n goto STATE_270_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_270_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_270_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_270_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_270_DROP_OUT_DIRECT\");\n goto TERMINAL_41_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"41\");\n QUEX_SET_last_acceptance(41);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&(me->buffer));\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, 0) ) {\n goto STATE_270_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_271:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_271\");\n\nSTATE_271_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_271_INPUT\");\n\n QuexBuffer_input_p_increment(&(me->buffer));\n input = QuexBuffer_input_get(&(me->buffer));\n if( input < 96) {\n if( input < 91) {\n if( input < 65) {\n goto STATE_271_DROP_OUT; /* [-oo, '@'] */\n } else {\n goto STATE_255; /* ['A', 'Z'] */\n }\n } else {\n if( input != 95) {\n goto STATE_271_DROP_OUT_DIRECT; /* ['[', '^'] */\n } else {\n goto STATE_255; /* '_' */\n }\n }\n } else {\n if( input < 98) {\n if( input == 96) {\n goto STATE_271_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_255; /* 'a' */\n }\n } else {\n if( input < 99) {\n goto STATE_272; /* 'b' */\n } else {\n if( input < 123) {\n goto STATE_255; /* ['c', 'z'] */\n } else {\n goto STATE_271_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_271_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_271_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_271_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_271_DROP_OUT_DIRECT\");\n goto TERMINAL_41_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"41\");\n QUEX_SET_last_acceptance(41);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&(me->buffer));\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, 0) ) {\n goto STATE_271_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_272:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_272\");\n\nSTATE_272_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_272_INPUT\");\n\n QuexBuffer_input_p_increment(&(me->buffer));\n input = QuexBuffer_input_get(&(me->buffer));\n if( input < 96) {\n if( input < 91) {\n if( input < 65) {\n goto STATE_272_DROP_OUT; /* [-oo, '@'] */\n } else {\n goto STATE_255; /* ['A', 'Z'] */\n }\n } else {\n if( input != 95) {\n goto STATE_272_DROP_OUT_DIRECT; /* ['[', '^'] */\n } else {\n goto STATE_255; /* '_' */\n }\n }\n } else {\n if( input < 108) {\n if( input == 96) {\n goto STATE_272_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_255; /* ['a', 'k'] */\n }\n } else {\n if( input < 109) {\n goto STATE_273; /* 'l' */\n } else {\n if( input < 123) {\n goto STATE_255; /* ['m', 'z'] */\n } else {\n goto STATE_272_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_272_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_272_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_272_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_272_DROP_OUT_DIRECT\");\n goto TERMINAL_41_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"41\");\n QUEX_SET_last_acceptance(41);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&(me->buffer));\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, 0) ) {\n goto STATE_272_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_273:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_273\");\n\nSTATE_273_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_273_INPUT\");\n\n QuexBuffer_input_p_increment(&(me->buffer));\n input = QuexBuffer_input_get(&(me->buffer));\n if( input < 96) {\n if( input < 91) {\n if( input < 65) {\n goto STATE_273_DROP_OUT; /* [-oo, '@'] */\n } else {\n goto STATE_255; /* ['A', 'Z'] */\n }\n } else {\n if( input != 95) {\n goto STATE_273_DROP_OUT_DIRECT; /* ['[', '^'] */\n } else {\n goto STATE_255; /* '_' */\n }\n }\n } else {\n if( input < 101) {\n if( input == 96) {\n goto STATE_273_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_255; /* ['a', 'd'] */\n }\n } else {\n if( input < 102) {\n goto STATE_274; /* 'e' */\n } else {\n if( input < 123) {\n goto STATE_255; /* ['f', 'z'] */\n } else {\n goto STATE_273_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_273_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_273_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_273_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_273_DROP_OUT_DIRECT\");\n goto TERMINAL_41_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"41\");\n QUEX_SET_last_acceptance(41);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&(me->buffer));\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, 0) ) {\n goto STATE_273_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_274:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_274\");\n\nSTATE_274_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_274_INPUT\");\n\n QuexBuffer_input_p_increment(&(me->buffer));\n input = QuexBuffer_input_get(&(me->buffer));\n if( input < 95) {\n if( input < 65) {\n goto STATE_274_DROP_OUT; /* [-oo, '@'] */\n } else {\n if( input < 91) {\n goto STATE_255; /* ['A', 'Z'] */\n } else {\n goto STATE_274_DROP_OUT_DIRECT; /* ['[', '^'] */\n }\n }\n } else {\n if( input < 97) {\n if( input == 95) {\n goto STATE_255; /* '_' */\n } else {\n goto STATE_274_DROP_OUT_DIRECT; /* '`' */\n }\n } else {\n if( input < 123) {\n goto STATE_255; /* ['a', 'z'] */\n } else {\n goto STATE_274_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n\nSTATE_274_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_274_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_274_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_274_DROP_OUT_DIRECT\");\n goto TERMINAL_13_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"13\");\n QUEX_SET_last_acceptance(13);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&(me->buffer));\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, 0) ) {\n goto STATE_274_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_275:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_275\");\n\nSTATE_275_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_275_INPUT\");\n\n QuexBuffer_input_p_increment(&(me->buffer));\n input = QuexBuffer_input_get(&(me->buffer));\n if( input < 96) {\n if( input < 91) {\n if( input < 65) {\n goto STATE_275_DROP_OUT; /* [-oo, '@'] */\n } else {\n goto STATE_255; /* ['A', 'Z'] */\n }\n } else {\n if( input != 95) {\n goto STATE_275_DROP_OUT_DIRECT; /* ['[', '^'] */\n } else {\n goto STATE_255; /* '_' */\n }\n }\n } else {\n if( input < 112) {\n if( input == 96) {\n goto STATE_275_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_255; /* ['a', 'o'] */\n }\n } else {\n if( input < 113) {\n goto STATE_276; /* 'p' */\n } else {\n if( input < 123) {\n goto STATE_255; /* ['q', 'z'] */\n } else {\n goto STATE_275_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_275_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_275_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_275_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_275_DROP_OUT_DIRECT\");\n goto TERMINAL_41_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"41\");\n QUEX_SET_last_acceptance(41);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&(me->buffer));\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, 0) ) {\n goto STATE_275_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_276:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_276\");\n\nSTATE_276_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_276_INPUT\");\n\n QuexBuffer_input_p_increment(&(me->buffer));\n input = QuexBuffer_input_get(&(me->buffer));\n if( input < 96) {\n if( input < 91) {\n if( input < 65) {\n goto STATE_276_DROP_OUT; /* [-oo, '@'] */\n } else {\n goto STATE_255; /* ['A', 'Z'] */\n }\n } else {\n if( input != 95) {\n goto STATE_276_DROP_OUT_DIRECT; /* ['[', '^'] */\n } else {\n goto STATE_255; /* '_' */\n }\n }\n } else {\n if( input < 101) {\n if( input == 96) {\n goto STATE_276_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_255; /* ['a', 'd'] */\n }\n } else {\n if( input < 102) {\n goto STATE_277; /* 'e' */\n } else {\n if( input < 123) {\n goto STATE_255; /* ['f', 'z'] */\n } else {\n goto STATE_276_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_276_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_276_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_276_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_276_DROP_OUT_DIRECT\");\n goto TERMINAL_41_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"41\");\n QUEX_SET_last_acceptance(41);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&(me->buffer));\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, 0) ) {\n goto STATE_276_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_277:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_277\");\n\nSTATE_277_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_277_INPUT\");\n\n QuexBuffer_input_p_increment(&(me->buffer));\n input = QuexBuffer_input_get(&(me->buffer));\n if( input < 96) {\n if( input < 91) {\n if( input < 65) {\n goto STATE_277_DROP_OUT; /* [-oo, '@'] */\n } else {\n goto STATE_255; /* ['A', 'Z'] */\n }\n } else {\n if( input != 95) {\n goto STATE_277_DROP_OUT_DIRECT; /* ['[', '^'] */\n } else {\n goto STATE_255; /* '_' */\n }\n }\n } else {\n if( input < 99) {\n if( input == 96) {\n goto STATE_277_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_255; /* ['a', 'b'] */\n }\n } else {\n if( input < 100) {\n goto STATE_278; /* 'c' */\n } else {\n if( input < 123) {\n goto STATE_255; /* ['d', 'z'] */\n } else {\n goto STATE_277_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_277_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_277_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_277_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_277_DROP_OUT_DIRECT\");\n goto TERMINAL_41_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"41\");\n QUEX_SET_last_acceptance(41);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&(me->buffer));\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, 0) ) {\n goto STATE_277_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_278:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_278\");\n\nSTATE_278_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_278_INPUT\");\n\n QuexBuffer_input_p_increment(&(me->buffer));\n input = QuexBuffer_input_get(&(me->buffer));\n if( input < 96) {\n if( input < 91) {\n if( input < 65) {\n goto STATE_278_DROP_OUT; /* [-oo, '@'] */\n } else {\n goto STATE_255; /* ['A', 'Z'] */\n }\n } else {\n if( input != 95) {\n goto STATE_278_DROP_OUT_DIRECT; /* ['[', '^'] */\n } else {\n goto STATE_255; /* '_' */\n }\n }\n } else {\n if( input < 116) {\n if( input == 96) {\n goto STATE_278_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_255; /* ['a', 's'] */\n }\n } else {\n if( input < 117) {\n goto STATE_279; /* 't' */\n } else {\n if( input < 123) {\n goto STATE_255; /* ['u', 'z'] */\n } else {\n goto STATE_278_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_278_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_278_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_278_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_278_DROP_OUT_DIRECT\");\n goto TERMINAL_41_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"41\");\n QUEX_SET_last_acceptance(41);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&(me->buffer));\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, 0) ) {\n goto STATE_278_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_279:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_279\");\n\nSTATE_279_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_279_INPUT\");\n\n QuexBuffer_input_p_increment(&(me->buffer));\n input = QuexBuffer_input_get(&(me->buffer));\n if( input < 95) {\n if( input < 65) {\n goto STATE_279_DROP_OUT; /* [-oo, '@'] */\n } else {\n if( input < 91) {\n goto STATE_255; /* ['A', 'Z'] */\n } else {\n goto STATE_279_DROP_OUT_DIRECT; /* ['[', '^'] */\n }\n }\n } else {\n if( input < 97) {\n if( input == 95) {\n goto STATE_255; /* '_' */\n } else {\n goto STATE_279_DROP_OUT_DIRECT; /* '`' */\n }\n } else {\n if( input < 123) {\n goto STATE_255; /* ['a', 'z'] */\n } else {\n goto STATE_279_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n\nSTATE_279_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_279_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_279_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_279_DROP_OUT_DIRECT\");\n goto TERMINAL_19_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"19\");\n QUEX_SET_last_acceptance(19);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&(me->buffer));\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, 0) ) {\n goto STATE_279_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_250:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_250\");\n\nSTATE_250_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_250_INPUT\");\n\n QuexBuffer_input_p_increment(&(me->buffer));\n input = QuexBuffer_input_get(&(me->buffer));\n if( input < 96) {\n if( input < 91) {\n if( input < 65) {\n goto STATE_250_DROP_OUT; /* [-oo, '@'] */\n } else {\n goto STATE_255; /* ['A', 'Z'] */\n }\n } else {\n if( input != 95) {\n goto STATE_250_DROP_OUT_DIRECT; /* ['[', '^'] */\n } else {\n goto STATE_255; /* '_' */\n }\n }\n } else {\n if( input < 120) {\n if( input == 96) {\n goto STATE_250_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_255; /* ['a', 'w'] */\n }\n } else {\n if( input < 121) {\n goto STATE_275; /* 'x' */\n } else {\n if( input < 123) {\n goto STATE_255; /* ['y', 'z'] */\n } else {\n goto STATE_250_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_250_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_250_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_250_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_250_DROP_OUT_DIRECT\");\n goto TERMINAL_41_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"41\");\n QUEX_SET_last_acceptance(41);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&(me->buffer));\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, 0) ) {\n goto STATE_250_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_251:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_251\");\n\nSTATE_251_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_251_INPUT\");\n\n QuexBuffer_input_p_increment(&(me->buffer));\n input = QuexBuffer_input_get(&(me->buffer));\n if( input < 13) {\n if( input < 9) {\n goto STATE_251_DROP_OUT; /* [-oo, \\8] */\n } else {\n if( input < 11) {\n goto STATE_251; /* ['\\t', '\\n'] */\n } else {\n goto STATE_251_DROP_OUT_DIRECT; /* [\\11, \\12] */\n }\n }\n } else {\n if( input < 32) {\n if( input == 13) {\n goto STATE_251; /* '\\r' */\n } else {\n goto STATE_251_DROP_OUT_DIRECT; /* [\\14, \\31] */\n }\n } else {\n if( input == 32) {\n goto STATE_251; /* ' ' */\n } else {\n goto STATE_251_DROP_OUT_DIRECT; /* ['!', oo] */\n }\n }\n }\n\nSTATE_251_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_251_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_251_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_251_DROP_OUT_DIRECT\");\n goto TERMINAL_5_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"5\");\n QUEX_SET_last_acceptance(5);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&(me->buffer));\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, 0) ) {\n goto STATE_251_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_252:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_252\");\n\nSTATE_252_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_252_INPUT\");\n\n QuexBuffer_input_p_increment(&(me->buffer));\n input = QuexBuffer_input_get(&(me->buffer));\n if( input < 96) {\n if( input < 91) {\n if( input < 65) {\n goto STATE_252_DROP_OUT; /* [-oo, '@'] */\n } else {\n goto STATE_255; /* ['A', 'Z'] */\n }\n } else {\n if( input != 95) {\n goto STATE_252_DROP_OUT_DIRECT; /* ['[', '^'] */\n } else {\n goto STATE_255; /* '_' */\n }\n }\n } else {\n if( input < 111) {\n if( input == 96) {\n goto STATE_252_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_255; /* ['a', 'n'] */\n }\n } else {\n if( input < 112) {\n goto STATE_270; /* 'o' */\n } else {\n if( input < 123) {\n goto STATE_255; /* ['p', 'z'] */\n } else {\n goto STATE_252_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_252_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_252_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_252_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_252_DROP_OUT_DIRECT\");\n goto TERMINAL_41_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"41\");\n QUEX_SET_last_acceptance(41);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&(me->buffer));\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, 0) ) {\n goto STATE_252_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_254:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_254\");\n\nSTATE_254_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_254_INPUT\");\n\n QuexBuffer_input_p_increment(&(me->buffer));\n input = QuexBuffer_input_get(&(me->buffer));\n if( input < 96) {\n if( input < 91) {\n if( input < 65) {\n goto STATE_254_DROP_OUT; /* [-oo, '@'] */\n } else {\n goto STATE_255; /* ['A', 'Z'] */\n }\n } else {\n if( input != 95) {\n goto STATE_254_DROP_OUT_DIRECT; /* ['[', '^'] */\n } else {\n goto STATE_255; /* '_' */\n }\n }\n } else {\n if( input < 110) {\n if( input == 96) {\n goto STATE_254_DROP_OUT_DIRECT; /* '`' */\n } else {\n goto STATE_255; /* ['a', 'm'] */\n }\n } else {\n if( input < 111) {\n goto STATE_268; /* 'n' */\n } else {\n if( input < 123) {\n goto STATE_255; /* ['o', 'z'] */\n } else {\n goto STATE_254_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n }\n\nSTATE_254_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_254_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_254_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_254_DROP_OUT_DIRECT\");\n goto TERMINAL_41_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"41\");\n QUEX_SET_last_acceptance(41);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&(me->buffer));\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, 0) ) {\n goto STATE_254_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_255:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_255\");\n\nSTATE_255_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_255_INPUT\");\n\n QuexBuffer_input_p_increment(&(me->buffer));\n input = QuexBuffer_input_get(&(me->buffer));\n if( input < 95) {\n if( input < 65) {\n goto STATE_255_DROP_OUT; /* [-oo, '@'] */\n } else {\n if( input < 91) {\n goto STATE_255; /* ['A', 'Z'] */\n } else {\n goto STATE_255_DROP_OUT_DIRECT; /* ['[', '^'] */\n }\n }\n } else {\n if( input < 97) {\n if( input == 95) {\n goto STATE_255; /* '_' */\n } else {\n goto STATE_255_DROP_OUT_DIRECT; /* '`' */\n }\n } else {\n if( input < 123) {\n goto STATE_255; /* ['a', 'z'] */\n } else {\n goto STATE_255_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n\nSTATE_255_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_255_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_255_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_255_DROP_OUT_DIRECT\");\n goto TERMINAL_41_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"41\");\n QUEX_SET_last_acceptance(41);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&(me->buffer));\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, 0) ) {\n goto STATE_255_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\n\n /* (*) Terminal states _______________________________________________________*/\n /**/\n /* Acceptance terminal states, i.e. the 'winner patterns'. This means*/\n /* that the last input dropped out of a state where the longest matching*/\n /* pattern was according to the terminal state. The terminal states are */\n /* numbered after the pattern id.*/\n /**/\n#define Lexeme (me->buffer._lexeme_start_p)\n#define LexemeBegin (me->buffer._lexeme_start_p)\n#define LexemeEnd (me->buffer._input_p)\n#define LexemeL (size_t)(me->buffer._input_p - me->buffer._lexeme_start_p)\nTERMINAL_35:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_35\");\n\n QuexBuffer_seek_memory_adr(&(me->buffer), last_acceptance_input_position);\n\nTERMINAL_35_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_35_DIRECT\");\n\n QuexBuffer_set_terminating_zero_for_lexeme(&me->buffer);\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(LexemeL);\n \n #line 32 \"simple.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(TKN_NUMBER, atoi((char*)Lexeme)); return;\n #else\n self.send(atoi((char*)Lexeme)); return TKN_NUMBER;\n #endif\n#line 2026 \"tiny_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_5:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_5\");\n\n QuexBuffer_seek_memory_adr(&(me->buffer), last_acceptance_input_position);\n\nTERMINAL_5_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_5_DIRECT\");\n\n QuexBuffer_set_terminating_zero_for_lexeme(&me->buffer);\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count(Lexeme, LexemeEnd);\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_7:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_7\");\n\n QuexBuffer_seek_memory_adr(&(me->buffer), last_acceptance_input_position);\n\nTERMINAL_7_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_7_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(6);\n \n #line 24 \"simple.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(TKN_STRUCT); return;\n #else\n self.send(); return TKN_STRUCT;\n #endif\n#line 2071 \"tiny_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_41:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_41\");\n\n QuexBuffer_seek_memory_adr(&(me->buffer), last_acceptance_input_position);\n\nTERMINAL_41_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_41_DIRECT\");\n\n QuexBuffer_set_terminating_zero_for_lexeme(&me->buffer);\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(LexemeL);\n \n #line 33 \"simple.qx\"\n self.send(TKN_IDENTIFIER, Lexeme); RETURN; \n#line 2094 \"tiny_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_10:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_10\");\n\n QuexBuffer_seek_memory_adr(&(me->buffer), last_acceptance_input_position);\n\nTERMINAL_10_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_10_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(3);\n \n #line 25 \"simple.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(TKN_TYPE_INT); return;\n #else\n self.send(); return TKN_TYPE_INT;\n #endif\n#line 2120 \"tiny_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_13:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_13\");\n\n QuexBuffer_seek_memory_adr(&(me->buffer), last_acceptance_input_position);\n\nTERMINAL_13_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_13_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(6);\n \n #line 26 \"simple.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(TKN_TYPE_DOUBLE); return;\n #else\n self.send(); return TKN_TYPE_DOUBLE;\n #endif\n#line 2146 \"tiny_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_16:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_16\");\n\n QuexBuffer_seek_memory_adr(&(me->buffer), last_acceptance_input_position);\n\nTERMINAL_16_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_16_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(4);\n \n #line 27 \"simple.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(TKN_SEND); return;\n #else\n self.send(); return TKN_SEND;\n #endif\n#line 2172 \"tiny_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_19:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_19\");\n\n QuexBuffer_seek_memory_adr(&(me->buffer), last_acceptance_input_position);\n\nTERMINAL_19_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_19_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(6);\n \n #line 28 \"simple.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(TKN_EXPECT); return;\n #else\n self.send(); return TKN_EXPECT;\n #endif\n#line 2198 \"tiny_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_22:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_22\");\n\n QuexBuffer_seek_memory_adr(&(me->buffer), last_acceptance_input_position);\n\nTERMINAL_22_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_22_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(1);\n \n #line 29 \"simple.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(TKN_SEMICOLON); return;\n #else\n self.send(); return TKN_SEMICOLON;\n #endif\n#line 2224 \"tiny_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_25:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_25\");\n\n QuexBuffer_seek_memory_adr(&(me->buffer), last_acceptance_input_position);\n\nTERMINAL_25_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_25_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(1);\n \n #line 30 \"simple.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(TKN_BRACKET_OPEN); return;\n #else\n self.send(); return TKN_BRACKET_OPEN;\n #endif\n#line 2250 \"tiny_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_28:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_28\");\n\n QuexBuffer_seek_memory_adr(&(me->buffer), last_acceptance_input_position);\n\nTERMINAL_28_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_28_DIRECT\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(1);\n \n #line 31 \"simple.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(TKN_BRACKET_CLOSE); return;\n #else\n self.send(); return TKN_BRACKET_CLOSE;\n #endif\n#line 2276 \"tiny_lexer-core-engine.cpp\"\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\n\n\nTERMINAL_END_OF_STREAM:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_END_OF_STREAM\");\n\n {\n {\n self.counter.__shift_end_values_to_start_values();\n \n #line 21 \"simple.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(TKN_TERMINATION); return;\n #else\n self.send(); return TKN_TERMINATION;\n #endif\n#line 2298 \"tiny_lexer-core-engine.cpp\"\n \n }\n }\n\n#ifdef __QUEX_OPTION_ANALYSER_RETURN_TYPE_IS_VOID\n return /*__QUEX_TOKEN_ID_TERMINATION*/;\n#else\n return __QUEX_TOKEN_ID_TERMINATION;\n#endif\n\nTERMINAL_DEFAULT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_DEFAULT\");\n\nif( QuexBuffer_is_end_of_file(&(me->buffer)) ) {\n\n QuexBuffer_input_p_decrement(&(me->buffer));\n}\n\nelse {\n /* Step over nomatching character */ QuexBuffer_input_p_increment(&(me->buffer));\n}\n\n QuexBuffer_set_terminating_zero_for_lexeme(&me->buffer);\n {\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count(Lexeme, LexemeEnd);\n self.send(TKN_TERMINATION);\n #ifdef __QUEX_OPTION_ANALYSER_RETURN_TYPE_IS_VOID\n return /*__QUEX_TOKEN_ID_TERMINATION*/;\n #else\n return __QUEX_TOKEN_ID_TERMINATION;\n #endif\n \n }\n }\n\n goto __REENTRY_PREPARATION;\n\n#undef Lexeme\n#undef LexemeBegin\n#undef LexemeEnd\n#undef LexemeL\n#ifndef __QUEX_OPTION_GNU_C_GREATER_2_3_DETECTED\n__TERMINAL_ROUTER: {\n /* if last_acceptance => goto correspondent acceptance terminal state*/\n /* else => execute defaul action*/\n switch( last_acceptance ) {\n case 35: goto TERMINAL_35;\n case 5: goto TERMINAL_5;\n case 7: goto TERMINAL_7;\n case 41: goto TERMINAL_41;\n case 10: goto TERMINAL_10;\n case 13: goto TERMINAL_13;\n case 16: goto TERMINAL_16;\n case 19: goto TERMINAL_19;\n case 22: goto TERMINAL_22;\n case 25: goto TERMINAL_25;\n case 28: goto TERMINAL_28;\n\n default: goto TERMINAL_DEFAULT;; /* nothing matched */\n }\n }\n#endif /* __QUEX_OPTION_GNU_C_GREATER_2_3_DETECTED*/\n\n \n__REENTRY_PREPARATION:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: __REENTRY_PREPARATION\");\n\n /* (*) Common point for **restarting** lexical analysis.\n * at each time when CONTINUE is called at the end of a pattern. */\n last_acceptance = QUEX_GOTO_TERMINAL_LABEL_INIT_VALUE;\n\n\n /* Post context positions do not have to be reset or initialized. If a state\n * is reached which is associated with 'end of post context' it is clear what\n * post context is meant. This results from the ways the state machine is \n * constructed. A post context positions live time looks like the following:\n *\n * (1) unitialized (don't care)\n * (1.b) on buffer reload it may, or may not be adapted (don't care)\n * (2) when a post context begin state is passed, the it is **SET** (now: take care)\n * (2.b) on buffer reload it **is adapted**.\n * (3) when a terminal state of the post context is reached (which can only be reached\n * for that particular post context, then the post context position is used\n * to reset the input position. */\n\n /* If a mode change happened, then the function must first return and\n * indicate that another mode function is to be called. At this point, \n * we to force a 'return' on a mode change. \n *\n * Pseudo Code: if( previous_mode != current_mode ) {\n * return 0;\n * }\n *\n * When the analyzer returns, the caller function has to watch if a mode change\n * occured. If not it can call this function again. */\n#if defined(QUEX_OPTION_AUTOMATIC_ANALYSIS_CONTINUATION_ON_MODE_CHANGE) || defined(QUEX_OPTION_ASSERTS)\n if( me->DEBUG_analyser_function_at_entry != me->current_analyser_function ) \n#endif\n { \n#if defined(QUEX_OPTION_AUTOMATIC_ANALYSIS_CONTINUATION_ON_MODE_CHANGE)\n# ifdef __QUEX_OPTION_ANALYSER_RETURN_TYPE_IS_VOID\n return /*__QUEX_TOKEN_ID_UNINITIALIZED*/;\n# else\n return __QUEX_TOKEN_ID_UNINITIALIZED;\n# endif\n#elif defined(QUEX_OPTION_ASSERTS)\n QUEX_ERROR_EXIT(\"Mode change without immediate return from the lexical analyser.\");\n#endif\n }\n\n goto __REENTRY;\n\n /* prevent compiler warning 'unused variable': use variables once in a part of the code*/\n /* that is never reached (and deleted by the compiler anyway).*/\n if( 0 == 1 ) {\n int unused = 0;\n unused = unused + ONE_AND_ONLY.id;\n }\n}\n#include <quex/code_base/temporary_macros_off>\n#if ! defined(__QUEX_SETTING_PLAIN_C)\n} // namespace quex\n#endif\n" }, { "alpha_fraction": 0.5646687746047974, "alphanum_fraction": 0.6687697172164917, "avg_line_length": 21.11627960205078, "blob_id": "465df574ca0367122caf4d23396802fe31f2e6e3", "content_id": "68c12eaab91572b290d97725c67d80b2a8170836", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Lua", "length_bytes": 951, "license_type": "permissive", "max_line_length": 74, "num_lines": 43, "path": "/engine/tests/engine/hud/simple.lua", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "gfx_colour_grade(`neutral.lut.png`)\ngfx_option('POST_PROCESSING', false)\n\ngfx_hud_class_add(`Rect`, {\n})\n\nobj = gfx_hud_object_add(`Rect`)\nobj.position = vec(200, 100) -- centre of object, from screen bottom left\nobj.size = vec(50, 50)\nobj.colour = vec(0, 1, 1)\nobj.zOrder = 2\nobj.alpha = 0.7\n\nobj2 = gfx_hud_object_add(`Rect`)\nobj2.position = vec(100, 100)\nobj2.size = vec(50, 50)\nobj2.colour = vec(1, 1, 0)\nobj2.zOrder = 2\nobj2.alpha = 0.7\nobj2.orientation = 30\nobj2.parent = obj\n\nobj2b = gfx_hud_object_add(`Rect`)\nobj2b.position = vec(200, 50)\nobj2b.size = vec(50, 50)\nobj2b.colour = vec(1, 1, 1)\nobj2b.zOrder = 2\nobj2b.alpha = 0.7\nobj2b.orientation = 60\nobj2b.parent = obj\n\nobj3 = gfx_hud_object_add(`Rect`)\nobj3.position = vec(0, 50)\nobj3.size = vec(50, 50)\nobj3.colour = vec(1, 0, 0)\nobj3.zOrder = 2\nobj3.alpha = 0.7\nobj3.orientation = 0\nobj3.parent = obj2\n\n\ngfx_render(0.1, vec(0, 0, 0), quat(1, 0, 0, 0))\ngfx_screenshot('output-simple.png')\n" }, { "alpha_fraction": 0.6366675496101379, "alphanum_fraction": 0.6428119540214539, "avg_line_length": 32.13473129272461, "blob_id": "5539cb57f37194ae52337ad640b0165a90e8642d", "content_id": "fe594a90db5f76a7660855b1c035dfe87ca622ac", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Makefile", "length_bytes": 11067, "license_type": "permissive", "max_line_length": 220, "num_lines": 334, "path": "/Makefile", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "# ============================\n# Makefile for building luaimg\n# ============================\n\n# Disable built-in rules, in particular they interfere with C++ headers that have no file\n# extension.\n.SUFFIXES:\n\n\n# -----------------------\n# User-overrideable parts\n# -----------------------\n\n# Override stuff in a user.mk\n-include user.mk\n\nCXX?= g++\nCC?= gcc\nOPT?=-O3 -DNDEBUG\nARCH?= -march=native -mtune=native\n\n\n# -----------------\n# Compilation input\n# -----------------\n\ninclude engine/grit.mk\ninclude gtasa/grit.mk\n\ninclude dependencies/grit-freeimage/grit.mk\ninclude dependencies/grit-bullet/grit.mk\ninclude dependencies/grit-lua/grit.mk\ninclude dependencies/grit-ogre/grit.mk\ninclude dependencies/grit-util/grit.mk\ninclude dependencies/jsonxx_grit.mk\ninclude dependencies/quex-0.34.1/grit.mk\ninclude dependencies/recastnavigation_grit.mk\n\n\nPKGCONFIG_DEPS = freetype2 gl glu glew xaw7 zlib zziplib xrandr xrender\n\n# Allow overriding with static deps since this one moves about between distros.\nICU_LDLIBS = $(shell pkg-config icu-uc icu-i18n --libs)\n\nOPENAL_LDLIBS ?= -lopenal -lvorbisfile\n\nVORBIS_LDLIBS ?= -lvorbisfile\n\nGOOGLE_PERF_TOOLS_DEFS ?= USE_GOOGLE_PERF_TOOLS=1\nGOOGLE_PERF_TOOLS_LDLIBS ?= -lprofiler\n\n\n\nGRIT_WEAK_C_SRCS= \\\n $(addprefix dependencies/grit-freeimage/,$(FREEIMAGE_WEAK_C_SRCS)) \\\n $(addprefix dependencies/grit-bullet/,$(BULLET_WEAK_C_SRCS)) \\\n $(addprefix dependencies/grit-lua/,$(LUA_WEAK_C_SRCS)) \\\n $(addprefix dependencies/grit-ogre/,$(OGRE_WEAK_C_SRCS)) \\\n $(addprefix dependencies/grit-util/,$(UTIL_WEAK_C_SRCS)) \\\n $(addprefix dependencies/jsonxx/,$(JSONXX_WEAK_C_SRCS)) \\\n $(addprefix dependencies/quex-0.34.1/,$(QUEX_WEAK_C_SRCS)) \\\n $(addprefix dependencies/recastnavigation/,$(RECAST_WEAK_C_SRCS)) \\\n $(ICU_WEAK_C_SRCS) \\\n $(OPENAL_WEAK_C_SRCS) \\\n $(VORBIS_WEAK_C_SRCS) \\\n\nGRIT_WEAK_CPP_SRCS= \\\n $(addprefix dependencies/grit-freeimage/,$(FREEIMAGE_WEAK_CPP_SRCS)) \\\n $(addprefix dependencies/grit-bullet/,$(BULLET_WEAK_CPP_SRCS)) \\\n $(addprefix dependencies/grit-lua/,$(LUA_WEAK_CPP_SRCS)) \\\n $(addprefix dependencies/grit-ogre/,$(OGRE_WEAK_CPP_SRCS)) \\\n $(addprefix dependencies/grit-util/,$(UTIL_WEAK_CPP_SRCS)) \\\n $(addprefix dependencies/jsonxx/,$(JSONXX_WEAK_CPP_SRCS)) \\\n $(addprefix dependencies/quex-0.34.1/,$(QUEX_WEAK_CPP_SRCS)) \\\n $(addprefix dependencies/recastnavigation/,$(RECAST_WEAK_CPP_SRCS)) \\\n $(ICU_WEAK_CPP_SRCS) \\\n $(OPENAL_WEAK_CPP_SRCS) \\\n $(VORBIS_WEAK_CPP_SRCS) \\\n\nGRIT_C_SRCS= \\\n $(addprefix dependencies/grit-freeimage/,$(FREEIMAGE_C_SRCS)) \\\n $(addprefix dependencies/grit-bullet/,$(BULLET_C_SRCS)) \\\n $(addprefix dependencies/grit-lua/,$(LUA_C_SRCS)) \\\n $(addprefix dependencies/grit-ogre/,$(OGRE_C_SRCS)) \\\n $(addprefix dependencies/grit-util/,$(UTIL_C_SRCS)) \\\n $(addprefix dependencies/jsonxx/,$(JSONXX_C_SRCS)) \\\n $(addprefix dependencies/quex-0.34.1/,$(QUEX_C_SRCS)) \\\n $(addprefix dependencies/recastnavigation/,$(RECAST_C_SRCS)) \\\n $(ICU_C_SRCS) \\\n $(OPENAL_C_SRCS) \\\n $(VORBIS_C_SRCS) \\\n\nGRIT_CPP_SRCS= \\\n $(addprefix dependencies/grit-freeimage/,$(FREEIMAGE_CPP_SRCS)) \\\n $(addprefix dependencies/grit-bullet/,$(BULLET_CPP_SRCS)) \\\n $(addprefix dependencies/grit-lua/,$(LUA_CPP_SRCS)) \\\n $(addprefix dependencies/grit-ogre/,$(OGRE_CPP_SRCS)) \\\n $(addprefix dependencies/grit-util/,$(UTIL_CPP_SRCS)) \\\n $(addprefix dependencies/jsonxx/,$(JSONXX_CPP_SRCS)) \\\n $(addprefix dependencies/quex-0.34.1/,$(QUEX_CPP_SRCS)) \\\n $(addprefix dependencies/recastnavigation/,$(RECAST_CPP_SRCS)) \\\n $(ICU_CPP_SRCS) \\\n $(OPENAL_CPP_SRCS) \\\n $(VORBIS_CPP_SRCS) \\\n\t$(addprefix engine/,$(ENGINE_CPP_SRCS)) \\\n\n\n# TODO: remove EXTRACT_INCLUDE_DIRS from here, refactor to put stuff in dependencies/\nINCLUDE_DIRS= \\\n $(addprefix gtasa/,$(EXTRACT_INCLUDE_DIRS)) \\\n $(addprefix dependencies/grit-freeimage/,$(FREEIMAGE_INCLUDE_DIRS)) \\\n $(addprefix dependencies/grit-bullet/,$(BULLET_INCLUDE_DIRS)) \\\n $(addprefix dependencies/grit-lua/,$(LUA_INCLUDE_DIRS)) \\\n $(addprefix dependencies/grit-ogre/,$(OGRE_INCLUDE_DIRS)) \\\n $(addprefix dependencies/grit-util/,$(UTIL_INCLUDE_DIRS)) \\\n $(addprefix dependencies/jsonxx/,$(JSONXX_INCLUDE_DIRS)) \\\n $(addprefix dependencies/quex-0.34.1/,$(QUEX_INCLUDE_DIRS)) \\\n $(addprefix dependencies/recastnavigation/,$(RECAST_INCLUDE_DIRS)) \\\n $(ICU_INCLUDE_DIRS) \\\n $(OPENAL_INCLUDE_DIRS) \\\n $(VORBIS_INCLUDE_DIRS) \\\n\nCFLAGS= \\\n\t$(INCLUDE_DIRS:%=-isystem%) \\\n\t$(BULLET_DEFS:%=-D%) \\\n\t$(LUA_DEFS:%=-D%) \\\n\t$(OGRE_DEFS:%=-D%) \\\n\t$(UTIL_DEFS:%=-D%) \\\n\t$(JSONXX_DEFS:%=-D%) \\\n\t$(QUEX_DEFS:%=-D%) \\\n\t$(FREEIMAGE_DEFS:%=-D%) \\\n\t$(ICU_DEFS:%=-D%) \\\n\t$(OPENAL_DEFS:%=-D%) \\\n\t$(VORBIS_DEFS:%=-D%) \\\n\t$(GOOGLE_PERF_TOOLS_DEFS:%=-D%) \\\n\t$(shell pkg-config $(PKGCONFIG_DEPS) --cflags) \\\n\nLDFLAGS= \\\n\t$(BULLET_LDFLAGS) \\\n\t$(LUA_LDFLAGS) \\\n\t$(OGRE_LDFLAGS) \\\n\t$(UTIL_LDFLAGS) \\\n\t$(JSONXX_LDFLAGS) \\\n\t$(QUEX_LDFLAGS) \\\n\t$(ICU_LDFLAGS) \\\n\t$(OPENAL_LDFLAGS) \\\n\t$(VORBIS_LDFLAGS) \\\n\t$(shell pkg-config $(PKGCONFIG_DEPS) --libs-only-L --libs-only-other) \\\n\nLDLIBS= \\\n\t$(BULLET_LDLIBS) \\\n\t$(LUA_LDLIBS) \\\n\t$(OGRE_LDLIBS) \\\n\t$(UTIL_LDLIBS) \\\n\t$(JSONXX_LDLIBS) \\\n\t$(QUEX_LDLIBS) \\\n\t$(FREEIMAGE_LDLIBS) \\\n\t$(ICU_LDLIBS) \\\n\t$(OPENAL_LDLIBS) \\\n\t$(VORBIS_LDLIBS) \\\n\t$(GOOGLE_PERF_TOOLS_LDLIBS) \\\n\t$(shell pkg-config $(PKGCONFIG_DEPS) --libs-only-l) \\\n\t-lreadline \\\n\t-lm \\\n\nCOL_CONV_OBJECTS= \\\n\t$(addprefix build/engine/,$(COL_CONV_STANDALONE_CPP_SRCS)) \\\n\nEXTRACT_OBJECTS= \\\n\t$(addprefix build/gtasa/,$(EXTRACT_CPP_SRCS)) \\\n $(addprefix build/dependencies/grit-freeimage/,$(FREEIMAGE_WEAK_CPP_SRCS:%.cpp=%.weak_cpp)) \\\n $(addprefix build/dependencies/grit-freeimage/,$(FREEIMAGE_WEAK_C_SRCS:%.c=%.weak_c)) \\\n $(addprefix build/dependencies/grit-freeimage/,$(FREEIMAGE_CPP_SRCS)) \\\n $(addprefix build/dependencies/grit-freeimage/,$(FREEIMAGE_C_SRCS)) \\\n\t$(addprefix build/dependencies/grit-ogre/,$(OGRE_WEAK_CPP_SRCS:%.cpp=%.weak_cpp)) \\\n\t$(addprefix build/dependencies/grit-ogre/,$(OGRE_WEAK_C_SRCS:%.c=%.weak_c)) \\\n\t$(addprefix build/dependencies/grit-ogre/,$(OGRE_CPP_SRCS)) \\\n\t$(addprefix build/dependencies/grit-ogre/,$(OGRE_C_SRCS)) \\\n\nGRIT_OBJECTS= \\\n\t$(addprefix build/,$(GRIT_WEAK_CPP_SRCS:%.cpp=%.weak_cpp)) \\\n\t$(addprefix build/,$(GRIT_WEAK_C_SRCS:%.c=%.weak_c)) \\\n\t$(addprefix build/,$(GRIT_CPP_SRCS)) \\\n\t$(addprefix build/,$(GRIT_C_SRCS)) \\\n\nGSL_OBJECTS= \\\n\t$(addprefix build/engine/,$(GSL_STANDALONE_CPP_SRCS)) \\\n\nXMLCONVERTER_OBJECTS= \\\n $(addprefix build/dependencies/grit-freeimage/,$(FREEIMAGE_WEAK_CPP_SRCS:%.cpp=%.weak_cpp)) \\\n $(addprefix build/dependencies/grit-freeimage/,$(FREEIMAGE_WEAK_C_SRCS:%.c=%.weak_c)) \\\n $(addprefix build/dependencies/grit-freeimage/,$(FREEIMAGE_CPP_SRCS)) \\\n $(addprefix build/dependencies/grit-freeimage/,$(FREEIMAGE_C_SRCS)) \\\n\t$(addprefix build/dependencies/grit-ogre/,$(XMLCONVERTER_WEAK_CPP_SRCS:%.cpp=%.weak_cpp)) \\\n\t$(addprefix build/dependencies/grit-ogre/,$(XMLCONVERTER_WEAK_C_SRCS:%.c=%.weak_c)) \\\n\t$(addprefix build/dependencies/grit-ogre/,$(XMLCONVERTER_CPP_SRCS)) \\\n\t$(addprefix build/dependencies/grit-ogre/,$(XMLCONVERTER_C_SRCS)) \\\n\nALL_OBJECTS= \\\n\t$(COL_CONV_OBJECTS) \\\n\t$(EXTRACT_OBJECTS) \\\n\t$(GRIT_OBJECTS) \\\n\t$(GSL_OBJECTS) \\\n\t$(XMLCONVERTER_OBJECTS) \\\n\n# Caution: -ffast-math broke btContinuousConvexCollision::calcTimeOfImpact, and there seems to be\n# no easy way to disable it on a per-file basis.\nCODEGEN= \\\n $(OPT) \\\n $(ARCH) \\\n\t-Winvalid-pch \\\n -Wno-type-limits \\\n -Wno-deprecated \\\n -g \\\n\n\n# -----------\n# Build rules\n# -----------\n\nPRECOMPILED_HEADER= echo -e '\\e[0mPrecompiling header: \\e[1;34m$@\\e[0m'\nCOMPUTING_DEPENDENCIES= echo -e '\\e[0mComputing dependencies: \\e[33m$@\\e[0m'\nCOMPILING= echo -e '\\e[0mCompiling: \\e[32m$@\\e[0m'\nLINKING= echo -e '\\e[0mLinking: \\e[1;32m$@\\e[0m'\nALL_EXECUTABLES= extract grit gsl grit_col_conv GritXMLConverter\n\nall: $(ALL_EXECUTABLES)\n\n# Precompiled header\nbuild/stdafx.h.gch: dependencies/stdafx/stdafx.h\n\t@$(PRECOMPILED_HEADER)\n\t@mkdir -p $(shell dirname $@)\n\t@$(CXX) -c $(CODEGEN) -std=c++11 -pedantic $(CFLAGS) $< -o $@\n\t\nbuild/stdafx.h: dependencies/stdafx/stdafx.h\n\tcp $< $@\n\t\n\nbuild/%.cpp.o: %.cpp build/stdafx.h build/stdafx.h.gch\n\t@$(COMPILING)\n\t@mkdir -p $(shell dirname $@)\n\t@$(CXX) -c $(CODEGEN) -std=c++11 -pedantic -Wall -Wextra -include build/stdafx.h $(CFLAGS) $< -o $@\n\nbuild/%.c.o: %.c\n\t@$(COMPILING)\n\t@mkdir -p $(shell dirname $@)\n\t@$(CC) -c $(CODEGEN) -std=c99 -pedantic -Wall -Wextra $(CFLAGS) $< -o $@\n\nbuild/%.weak_cpp.o: %.cpp\n\t@$(COMPILING)\n\t@mkdir -p $(shell dirname $@)\n\t@$(CXX) -c $(CODEGEN) -std=c++11 -Wno-narrowing -Wno-literal-suffix -Wno-unused-result -Wno-format -Wno-terminate -Wno-write-strings -Wno-deprecated-declarations -Wno-pedantic -Wno-int-to-pointer-cast $(CFLAGS) $< -o $@\n\n# Hack to also support dependencies that use .cc\nbuild/%.weak_cpp.o: %.cc\n\t@$(COMPILING)\n\t@mkdir -p $(shell dirname $@)\n\t@$(CXX) -c $(CODEGEN) -std=c++11 $(CFLAGS) $< -o $@\n\nbuild/%.weak_c.o: %.c\n\t@$(COMPILING)\n\t@mkdir -p $(shell dirname $@)\n\t@$(CC) -c $(CODEGEN) -Wno-implicit-function-declaration $(CFLAGS) $< -o $@\n\nextract: $(addsuffix .o,$(EXTRACT_OBJECTS))\n\t@$(LINKING)\n\t@$(CXX) $^ $(LDFLAGS) $(LDLIBS) -o $@\n\ngrit: $(addsuffix .o,$(GRIT_OBJECTS))\n\t@$(LINKING)\n\t@$(CXX) $^ $(LDFLAGS) $(LDLIBS) -o $@\n\ngsl: $(addsuffix .o,$(GSL_OBJECTS))\n\t@$(LINKING)\n\t@$(CXX) $^ $(LDFLAGS) $(LDLIBS) -o $@\n\ngrit_col_conv: $(addsuffix .o,$(COL_CONV_OBJECTS))\n\t@$(LINKING)\n\t@$(CXX) $^ $(LDFLAGS) $(LDLIBS) -o $@\n\nGritXMLConverter: $(addsuffix .o,$(XMLCONVERTER_OBJECTS))\n\t@$(LINKING)\n\t@$(CXX) $^ $(LDFLAGS) $(LDLIBS) -o $@\n\n\n# ---------\n# Dev stuff\n# ---------\n\n# Note the two -MT are to ensure that if any of the discovered headers change, the dependencies will\n# be re-computed. This avoids a problem where if you include a new header from an existing header,\n# the .d would never be updated and the build would be wrong.\n\nbuild/stdafx.h.gch.d: dependencies/stdafx/stdafx.h\n\t@$(COMPUTING_DEPENDENCIES)\n\t@mkdir -p $(shell dirname $@)\n\t@$(CXX) -M -std=c++11 $(CFLAGS) $< -o $@ -MT $(@:%.d=%) -MT $@\n\t\nbuild/%.cpp.d: %.cpp\n\t@$(COMPUTING_DEPENDENCIES)\n\t@mkdir -p $(shell dirname $@)\n\t@$(CXX) -M -std=c++11 $(CFLAGS) $< -o $@ -MT $(@:%.d=%.o) -MT $@\n\nbuild/%.c.d: %.c\n\t@$(COMPUTING_DEPENDENCIES)\n\t@mkdir -p $(shell dirname $@)\n\t@$(CC) -M -std=c99 $(CFLAGS) $< -o $@ -MT $(@:%.d=%.o) -MT $@\n\nbuild/%.weak_cpp.d: %.cpp\n\t@$(COMPUTING_DEPENDENCIES)\n\t@mkdir -p $(shell dirname $@)\n\t@$(CXX) -M -std=c++11 $(CFLAGS) $< -o $@ -MT $(@:%.d=%.o) -MT $@\n\n# Hack to also support dependencies that use .cc\nbuild/%.weak_cpp.d: %.cc\n\t@$(COMPUTING_DEPENDENCIES)\n\t@mkdir -p $(shell dirname $@)\n\t@$(CXX) -M -std=c++11 $(CFLAGS) $< -o $@ -MT $(@:%.d=%.o) -MT $@\n\nbuild/%.weak_c.d: %.c\n\t@$(COMPUTING_DEPENDENCIES)\n\t@mkdir -p $(shell dirname $@)\n\t@$(CC) -M $(CFLAGS) $< -o $@ -MT $(@:%.d=%.o) -MT $@\n\nALL_DEPS = $(addsuffix .d,$(ALL_OBJECTS)) build/stdafx.h.gch.d\n\nclean_depend:\n\t@rm -f $(ALL_DEPS)\n\t@echo Dependencies cleaned.\n\nclean:\n\trm -rfv $(ALL_EXECUTABLES) build\n\n-include $(ALL_DEPS)\n" }, { "alpha_fraction": 0.5135810971260071, "alphanum_fraction": 0.519746720790863, "avg_line_length": 39.00666809082031, "blob_id": "4651a7bf6b116083d3fa66bab368483c4c0585c0", "content_id": "9f5b6d8f3c0ada2d51b63664770c67ff3a1f23f6", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 6001, "license_type": "permissive", "max_line_length": 159, "num_lines": 150, "path": "/dependencies/quex-0.34.1/demo/004/report.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "#include <ctime>\n#include <cstdlib>\n#include <sys/types.h>\n#include <sys/stat.h>\n#include <unistd.h>\n#include <c_lexer>\n\nusing namespace std;\n\nsize_t get_file_size(const char*, bool SilentF=false);\nvoid print_date_string();\nsize_t count_token_n(std::FILE*);\ndouble report(clock_t StartTime, double RepetitionN, size_t FileSize, size_t CharacterSize);\nvoid final_report(double TimePerRun, double RefTimePerRun, const char* ThisExecutableName, const char* Filename, \n size_t FileSize, size_t TokenN, double RepetitionN);\n\nvoid \nfinal_report(double TimePerRun, double RefTimePerRun, const char* ThisExecutableName, const char* FileName, size_t FileSize, size_t TokenN, double RepetitionN)\n{\n const double CharN = (double)(FileSize) / (CHARACTER_SIZE);\n const double CycleTime = 1.0 / double(CPU_FREQ_MHZ) * 1e-6;\n //\n const double TimePerChar = TimePerRun / CharN;\n const double CCC = TimePerChar / CycleTime;\n const double RefTimePerChar = RefTimePerRun / CharN;\n const double RefCCC = RefTimePerChar / CycleTime;\n\n double TimePerToken = 0;\n double CCT = 0;\n double RefTimePerToken = 0;\n double RefCCT = 0;\n\n if( TokenN == 1 ) { \n TimePerToken = TimePerRun;\n RefTimePerToken = RefTimePerRun;\n } else { \n TimePerToken = TimePerRun / double(TokenN);\n RefTimePerToken = RefTimePerRun / double(TokenN);\n }\n CCT = TimePerToken / CycleTime;\n RefCCT = RefTimePerToken / CycleTime;\n\n cout << \"//Result:\\n\";\n cout << \"// Time / Run: \" << (TimePerRun - RefTimePerRun) << endl;\n cout << \"// Time / Char: \" << (TimePerChar - RefTimePerChar) << endl;\n cout << \"// Clock Cycles / Char: \" << (CCC - RefCCC) << endl;\n cout << \"{\" << endl;\n cout << \" quex_version = {\" << QUEX_VERSION << \"}, \" << endl;\n cout << \" cpu_name = {\" << CPU_NAME << \"}, \" << endl;\n cout << \" cpu_code = {\" << CPU_CODE << \"}, \" << endl;\n cout << \" cpu_freq_mhz = {\" << CPU_FREQ_MHZ << \"}, \" << endl;\n cout << \" cc_name = {\" << CC_NAME << \"}, \" << endl;\n cout << \" cc_version = {\" << CC_VERSION << \"}, \" << endl;\n cout << \" cc_opt_flags = {\" << CC_OPTIMIZATION_FLAGS << \"}, \" << endl;\n cout << \" executable_size = {\" << get_file_size(ThisExecutableName, true) << \"}, \" << endl;\n cout << \" os_name = {\" << OS_NAME << \"}, \" << endl;\n cout << \" tester_email = {\" << EMAIL << \"}, \" << endl;\n print_date_string();\n cout << \" file_name = {\" << FileName << \"}, \" << endl;\n cout << \" file_size = {\" << FileSize << \"}, \" << endl;\n cout << \" char_size = {\" << CHARACTER_SIZE << \"}, \" << endl;\n cout << \" buffer_size = {\" << QUEX_SETTING_BUFFER_SIZE << \"}, \" << endl;\n# ifdef QUEX_OPTION_LINE_NUMBER_COUNTING\n cout << \" line_count = {true},\" << endl;\n# else\n cout << \" line_count = {false},\" << endl;\n# endif\n# ifdef QUEX_OPTION_COLUMN_NUMBER_COUNTING\n cout << \" column_count = {true},\" << endl;\n# else\n cout << \" column_count = {false},\" << endl;\n# endif\n cout << \" note = {\" << NOTE << \"}, \" << endl;\n // Result\n cout << \" repetition_n = {\" << (unsigned int)(RepetitionN) << \"}, \" << endl;\n cout << \" time_per_repetition = {\" << (TimePerRun - RefTimePerRun) << \"},\" << endl;\n cout << \" token_n = {\" << TokenN << \"}, \" << endl;\n cout << \" clock_cycles_per_character = {\" << (CCC - RefCCC) << \"}, \" << endl;\n cout << \" clock_cycles_per_token = {\" << (CCT - RefCCT) << \"}, \" << endl;\n cout << \"}\\n\" << endl;\n}\n\n\ndouble\nreport(clock_t StartTime, double RepetitionN, size_t FileSize, size_t CharacterSize)\n{ \n using namespace std;\n\n const clock_t EndTime = clock();\n const double TimeDiff = (double)(EndTime - StartTime) / (double)CLOCKS_PER_SEC;\n const double TimePerRun = TimeDiff / RepetitionN;\n\n cout << \"// Total Time: \" << TimeDiff << \" [sec]\" << endl;\n cout << \"// Runs: \" << (long)RepetitionN << \" [1]\" << endl;\n cout << \"// TimePerRun: \" << TimePerRun << \" [sec]\" << endl;\n\n const double CharN = FileSize / CHARACTER_SIZE;\n const double CycleTime = 1.0 / (CPU_FREQ_MHZ * 1e6);\n const double TimePerChar = TimePerRun / CharN;\n const double CCC = TimePerChar / CycleTime;\n\n cout << \"// Time / Char: \" << TimePerChar << endl;\n cout << \"// Clock Cycles / Char: \" << CCC << endl;\n\n return TimePerRun;\n}\n\nsize_t\ncount_token_n(std::FILE* fh)\n{\n using namespace std;\n quex::c_lexer qlex(fh);\n //quex::token* TokenP;\n int token_id = QUEX_TKN_TERMINATION;\n int token_n = 0;\n\n // (*) loop until the 'termination' token arrives\n for(token_n=0; ; ++token_n) {\n token_id = qlex.get_token();\n if( token_id == QUEX_TKN_TERMINATION ) break;\n } \n cout << \"// TokenN: \" << token_n << \" [1]\" << endl;\n return token_n;\n}\n\nsize_t\nget_file_size(const char* Filename, bool SilentF /*=false*/)\n{\n using namespace std;\n struct stat s;\n stat(Filename, &s);\n if( ! SilentF ) {\n cout << \"// FileSize: \" << s.st_size << \" [Byte] = \"; \n cout << double(s.st_size) / double(1024.0) << \" [kB] = \";\n cout << double(s.st_size) / double(1024.0*1024.0) << \" [MB].\" << endl;\n }\n return s.st_size;\n}\n\nvoid\nprint_date_string()\n{\n\n std::time_t current_time = time(NULL); \n struct tm* broken_down_time = std::gmtime(&current_time);\n \n std::cout << \" year = {\" << broken_down_time->tm_year + 1900 << \"},\" << endl;\n std::cout << \" month = {\" << broken_down_time->tm_mon + 1 << \"},\" << endl;\n std::cout << \" day = {\" << broken_down_time->tm_mday << \"},\" << endl;\n}\n" }, { "alpha_fraction": 0.5868908762931824, "alphanum_fraction": 0.5963777303695679, "avg_line_length": 41.907405853271484, "blob_id": "eb091056cf08c5a12dec4bfd772470b0aebaf1cc", "content_id": "fb69bdc2a85678b31490c36b8212dd8c96254d5e", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2319, "license_type": "permissive", "max_line_length": 94, "num_lines": 54, "path": "/dependencies/quex-0.34.1/quex-exe.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "#! /usr/bin/env python\n# Quex is free software; you can redistribute it and/or modify it under the\n# terms of the GNU Lesser General Public License as published by the Free\n# Software Foundation; either version 2.1 of the License, or (at your option)\n# any later version.\n# \n# This software is distributed in the hope that it will be useful, but WITHOUT\n# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more\n# details.\n# \n# You should have received a copy of the GNU Lesser General Public License along\n# with this library; if not, write to the Free Software Foundation, Inc., 59\n# Temple Place, Suite 330, Boston, MA 02111-1307 USA\n#\n# (C) 2007 Frank-Rene Schaefer\n#\n################################################################################\n\n# (*) Check if everything is correctly installed\nimport quex.DEFINITIONS\nquex.DEFINITIONS.check()\n\nimport sys\nimport tempfile\n\n# This script needs to be located one directory above 'quex.'\n# so that it ca get the imports straight.\nfrom quex.input.setup import setup as Setup\nimport quex.input.setup_parser as setup_parser\nimport quex.input.query as query_parser\nimport quex.core as core\n\nfrom quex.frs_py.file_in import error_msg\n\nif __name__ == \"__main__\":\n try:\n # (*) Call only for query? ___________________________________________________________\n if query_parser.do(sys.argv): # if quex has been called for UCS property\n sys.exit(0) # query, then no further processing is performed\n\n # (*) Get Setup from Command Line and Config File ____________________________________\n setup_parser.do(sys.argv)\n\n if Setup.plot_graphic_format_list_f:\n print quex.output.graphviz.interface.get_supported_graphic_format_description()\n sys.exit(0)\n\n # (*) Run the Quex ___________________________________________________________________\n if Setup.plot_graphic_format == \"\": core.do() # 'normal' code generation\n else: core.do_plot() # plot transition graphs\n\n except \"\": # AssertionError:\n error_msg(\"Assertion error -- please report a bug at http://quex.sourceforge.net.\")\n\n\n" }, { "alpha_fraction": 0.6149661540985107, "alphanum_fraction": 0.6360620856285095, "avg_line_length": 30.668067932128906, "blob_id": "69519fd78596627720701422316036df4f7d6165", "content_id": "5333b380ec81ad20fe2b3d11e6d1ed541ac4f5c5", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 7537, "license_type": "permissive", "max_line_length": 142, "num_lines": 238, "path": "/engine/audio/audio_disk_resource.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include \"audio_disk_resource.h\"\n#include \"audio.h\"\n#include <portable_io.h>\n#include \"ogg_vorbis_decoder.h\"\n\nvoid AudioDiskResource::loadImpl (void)\n{\n // head radio. because your head NEEDS IT.\n\n // why using OGRE anyways? I'm just following CollisionMesh.c++'s example and doing so here\n // [DC] we are still using ogre's IO code, that understands putting files in zips etc.\n Ogre::DataStreamPtr file;\n try {\n file = Ogre::ResourceGroupManager::getSingleton().openResource(name.substr(1),\"GRIT\");\n } catch (Ogre::Exception &e) {\n GRIT_EXCEPT(e.getDescription());\n }\n\n uint32_t fourcc = 0;\n file->read(&fourcc, sizeof(fourcc));\n\n if (fourcc == 0x46464952) // RIFF\n {\n file->seek(0);\n loadWAV(file);\n }\n else if (fourcc == 0x5367674F) // OggS\n {\n file->seek(0);\n loadOGG(file);\n }\n else\n {\n GRIT_EXCEPT(\"Unknown audio file format in \" + name);\n }\n\n}\n\nstruct chunk_header\n{\n uint32_t fourcc;\n uint32_t size;\n};\n\nstruct riff_header\n{\n chunk_header chunk;\n uint32_t format;\n};\n\nstruct wave_format\n{\n uint16_t format_tag;\n uint16_t channels;\n uint32_t samples;\n uint32_t bytesPerSec;\n uint16_t blockAlign;\n uint16_t bitsPerSample;\n uint16_t size;\n};\n\nvoid AudioDiskResource::loadWAV(Ogre::DataStreamPtr &file)\n{\n riff_header header;\n file->read(&header, sizeof(header));\n\n if (header.format != 0x45564157) // WAVE\n {\n GRIT_EXCEPT(name + \" is not a WAVE file.\");\n }\n\n // FIXME: possibly use more advanced chunk reading?\n chunk_header fmtHeader;\n file->read(&fmtHeader, sizeof(fmtHeader));\n\n if (fmtHeader.fourcc != 0x20746d66)\n {\n GRIT_EXCEPT(\"First chunk in \" + name + \" wasn't 'fmt'.\");\n }\n\n // save the fmt position so we can seek from it later on\n size_t fmtStart = file->tell();\n\n // read the format header\n wave_format fmt;\n file->read(&fmt, sizeof(fmt));\n\n if (fmt.format_tag != 1) // PCM\n {\n GRIT_EXCEPT(name + \" isn't PCM (only PCM is supported right now)\");\n }\n\n if (fmt.channels > 2)\n {\n GRIT_EXCEPT(name + \" has more than two channels.\");\n }\n\n if (fmt.bitsPerSample != 8 && fmt.bitsPerSample != 16)\n {\n GRIT_EXCEPT(name + \" isn't 8 or 16 bits per sample.\");\n }\n\n // seek to the data start\n file->seek(fmtStart + fmtHeader.size);\n\n // read the data and the data header\n chunk_header dataHeader;\n file->read(&dataHeader, sizeof(dataHeader));\n\n if (dataHeader.fourcc != 0x61746164)\n {\n GRIT_EXCEPT(\"Second chunk in \" + name + \" wasn't 'data'.\");\n }\n\n if (fmt.channels == 0) {\n GRIT_EXCEPT(\"Wave file has zero channels: \\\"\"+name+\"\\\"\");\n }\n\n if (fmt.channels > 2) {\n GRIT_EXCEPT(\"Wave file has too many channels: \\\"\"+name+\"\\\"\");\n }\n\n size_t bytes_per_sample = fmt.bitsPerSample/8;\n size_t samples = dataHeader.size / fmt.channels / bytes_per_sample;\n\n uint8_t* data = new uint8_t[dataHeader.size];\n file->read(data, dataHeader.size);\n\n // generate an AL buffer\n\n alBufferLeft = 0;\n alBufferRight = 0;\n alBuffer = 0;\n\n ALenum mono_format = (fmt.bitsPerSample == 8) ? AL_FORMAT_MONO8 : AL_FORMAT_MONO16;\n ALenum stereo_format = (fmt.bitsPerSample == 8) ? AL_FORMAT_STEREO8 : AL_FORMAT_STEREO16;\n\n if (fmt.channels == 1) {\n stereo = false;\n alGenBuffers(1, &alBufferLeft);\n alBufferData(alBufferLeft, mono_format, data, dataHeader.size, fmt.samples);\n } else {\n stereo = true;\n alGenBuffers(1, &alBuffer);\n alBufferData(alBuffer, stereo_format, data, dataHeader.size, fmt.samples);\n uint8_t* data1 = new uint8_t[dataHeader.size / 2];\n for (size_t i=0 ; i<samples ; ++i) memcpy(&data1[i*bytes_per_sample], &data[2*i*bytes_per_sample], bytes_per_sample);\n alGenBuffers(1, &alBufferLeft);\n alBufferData(alBufferLeft, mono_format, data1, dataHeader.size/2, fmt.samples);\n for (size_t i=0 ; i<samples ; ++i) memcpy(&data1[i*bytes_per_sample], &data[(2*i+1)*bytes_per_sample], bytes_per_sample);\n alGenBuffers(1, &alBufferRight);\n alBufferData(alBufferRight, mono_format, data1, dataHeader.size/2, fmt.samples);\n delete[] data1;\n }\n\n\n // free the data (as memory is in the AL buffer now)\n delete[] data;\n\n // close the stream\n file->close();\n}\n\nvoid AudioDiskResource::loadOGG(Ogre::DataStreamPtr &file)\n{ \n alBufferLeft = 0;\n alBufferRight = 0;\n alBuffer = 0;\n\n OggVorbisDecoder decoder(name, file);\n \n const int size = 4096;\n char buffer[size];\n \n std::vector<char> data;\n \n while (true) {\n int bytes_read = decoder.read(buffer, size);\n if(bytes_read == 0) break;\n data.insert(data.end(), buffer, buffer+bytes_read);\n }\n \n //these doesn't mean to be changed, the OggVorbisDecoder is now decoding 2 bytes samples only, and this are left here just for readability\n const int bytes_per_sample = 2;\n const ALenum mono_format = AL_FORMAT_MONO16;\n const ALenum stereo_format = AL_FORMAT_STEREO16;\n \n if (decoder.stereo()) { //stereo\n stereo = true;\n alGenBuffers(1, &alBuffer);\n alBufferData(alBuffer, stereo_format, &data[0], data.size(), decoder.rate());\n char *data1 = new char[data.size() / 2];\n size_t samples = data.size() / 2 / bytes_per_sample;\n for (size_t i=0 ; i < samples; ++i)\n memcpy(&data1[i*bytes_per_sample], &data[2*i*bytes_per_sample], bytes_per_sample);\n alGenBuffers(1, &alBufferLeft);\n alBufferData(alBufferLeft, mono_format, data1, data.size()/2, decoder.rate());\n for (size_t i=0 ; i < samples; ++i)\n memcpy(&data1[i*bytes_per_sample], &data[(2*i+1)*bytes_per_sample], bytes_per_sample);\n alGenBuffers(1, &alBufferRight);\n alBufferData(alBufferRight, mono_format, data1, data.size()/2, decoder.rate());\n delete[] data1;\n } else { //mono\n stereo = false;\n alGenBuffers(1, &alBufferLeft);\n alBufferData(alBufferLeft, mono_format, &data[0], data.size(), decoder.rate());\n }\n \n file->close();\n}\n\nvoid AudioDiskResource::unloadImpl (void)\n{\n if (alBuffer != 0) alDeleteBuffers(1, &alBuffer);\n if (alBufferLeft != 0) alDeleteBuffers(1, &alBufferLeft);\n if (alBufferRight != 0) alDeleteBuffers(1, &alBufferRight);\n}\n" }, { "alpha_fraction": 0.536933422088623, "alphanum_fraction": 0.5741466283798218, "avg_line_length": 33.50724792480469, "blob_id": "0ef63094fd5709cd8ef6394a681214994e5a9ec1", "content_id": "f514f958a5411599d56a8105fe3184033e656c40", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 7148, "license_type": "permissive", "max_line_length": 96, "num_lines": 207, "path": "/dependencies/quex-0.34.1/quex/core_engine/utf8.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "from copy import copy\nimport StringIO\n\n\ndef map_utf8_to_unicode(utf8_string_or_stream):\n \"\"\"Maps the start of the 'utf8_string' to a single unicode character. \n \n Returns: (string) the unicode of the letter and the remaining utf8-string with the first \n letters cut that represented the unicode letter.\n (StringIO) the unicode of the first utf8 coding in the stream. sets the stream\n position to the first character after the utf8 code. \n \"\"\" \n arg_type=utf8_string_or_stream.__class__.__name__\n assert arg_type in [\"StringIO\", \"file\", \"str\"]\n\n if utf8_string_or_stream.__class__.__name__ == \"StringIO\" \\\n or utf8_string_or_stream.__class__.__name__ == \"file\":\n return __read_one_utf8_code_from_stream(utf8_string_or_stream)\n elif utf8_string_or_stream.__class__.__name__ == \"str\":\n utf8_string = utf8_string_or_stream\n\n stream = StringIO.StringIO(utf8_string)\n ucs_character_code = __read_one_utf8_code_from_stream(stream)\n remainder = stream.read() \n return ucs_character_code, remainder \n \ndef map_n_utf8_to_unicode(utf8_string, N=-1, RemainderF=False):\n \"\"\"Reads 'N' characters out of the string and creates an array\n of integers that represent the unicode characters contained.\n N=-1 => interpret the whole given string.\n\n Returns: unicode value and if RemainderF=True: remaining string.\n \"\"\" \n stream = StringIO.StringIO(utf8_string)\n result = []\n if N == 0: \n if RemainderF: return result, utf8_string\n else: return result\n\n if N != -1:\n tmp = __read_one_utf8_code_from_stream(stream)\n result.append(tmp)\n n = 0\n while tmp != 0xFF:\n n += 1\n if n >= N: break\n tmp = __read_one_utf8_code_from_stream(stream)\n result.append(tmp)\n\n else:\n tmp = __read_one_utf8_code_from_stream(stream)\n while tmp != 0xFF:\n result.append(tmp)\n tmp = __read_one_utf8_code_from_stream(stream)\n\n if RemainderF: \n remainder = stream.read() \n return result, remainder\n else: \n return result\n\ndef map_unicode_to_utf8(UCS_character_code):\n \"\"\"Returns a utf8 string that correspond to the unicode character\n passed by UCS_character_code.\n \"\"\"\n \n if UCS_character_code < 0x80:\n return chr(UCS_character_code)\n elif UCS_character_code < 0x800: # anyway: UCS_character_code >= 0x80\n byte_n = 1\n elif UCS_character_code < 0x10000: # anyway: UCS_character_code >= 0x800\n byte_n = 2\n elif UCS_character_code < 0x200000: # anyway: UCS_character_code >= 0x10000 \n byte_n = 3\n elif UCS_character_code < 0x4000000: # anyway: UCS_character_code >= 0x200000\n byte_n = 4\n elif UCS_character_code < 0x10000000: # anyway: UCS_character_code >= 0x4000000\n byte_n = 5\n else:\n return [ -1 ]\n\n # as utf-8 specifies: number of ones at head + 1 = number of trailing bytes\n leading_ones_str = \"1\" * (byte_n + 1) + \"0\"\n char_bits_in_header_n = 8 - (byte_n + 1 + 1)\n \n # number of bits reserved for the character:\n # remaining bits in the header byte = 8 - (byte_n + 1)\n # (+1 because of the trailing zero)\n # bits per byte that follows = 6\n bit_n = char_bits_in_header_n + 6 * byte_n \n\n # get bit representation of the original UCS character code\n orig_bit_str = __int_to_bit_string(UCS_character_code, bit_n)\n bytes = [0] * (byte_n + 1)\n bytes[0] = __bit_string_to_int(leading_ones_str\n + orig_bit_str[:char_bits_in_header_n])\n\n for i in range((bit_n - char_bits_in_header_n)/6):\n bit_0 = char_bits_in_header_n + i * 6\n bytes[i+1] = __bit_string_to_int(\"10\" + orig_bit_str[bit_0:bit_0+6])\n\n result_str = \"\"\n for byte in bytes:\n result_str += chr(byte) \n return result_str\n\ndef __int_to_bit_string(IntN, BitN):\n \"\"\"Receives an integer and constructs a string containing 0s and 1s that \n represent the integer binarily.\n \"\"\"\n int_n = copy(IntN)\n\n sum = \"\"\n while int_n:\n if int_n & 0x1: sum = \"1\" + sum\n else: sum = \"0\" + sum\n int_n = int_n >> 1\n \n # NOTE: this should not occur in our case (head character > 0xC0)\n if len(sum) < BitN: sum = \"0\" * (BitN - len(sum)) + sum\n \n return sum\n\ndef __bit_string_to_int(BitStr):\n \"\"\"Transforms a string of the form '01001001' into an integer\n which represents this byte.\n\n TESTED <frs>\n \"\"\"\n\n BitStr = BitStr.replace(\".\", \"\")\n BitArray = map(lambda x: x, BitStr)\n BitArray.reverse()\n\n n = 0\n sum = 0\n for bit in BitArray:\n if bit == \"1\": sum += 2**n\n n += 1\n\n return sum\n\ndef __read_one_utf8_code_from_stream(char_stream):\n \"\"\"Interprets the subsequent characters as a UTF-8 coded\n character.\n\n RETURNS: integer value of the unicode character.\n 0xFF in case of error.\n\n second parameter: True if character was backslashed,\n False if not.\n \"\"\"\n character = char_stream.read(1)\n if character == \"\": return 0xFF\n try: head_char = ord(character)\n except: return 0xFF\n\n # (*) head characters for the the \"utf-8 escape\" are located in between\n # 0xC0 to 0xFD. If the chacter code falls out of this border no further\n # consideration is required.\n if head_char < 0xC0 or head_char > 0xFD:\n return head_char\n\n\n # (*) determine byte range and number of characters\n # that have to be decoded.\n head = __int_to_bit_string(head_char, 8)\n\n if head[:3] == \"110\":\n char_range = [0x80, 0x7FF]\n char_n = 1\n elif head[:4] == \"1110\":\n char_range = [0x800, 0xFFFF]\n char_n = 2\n elif head[:5] == \"11110\":\n char_range = [0x10000, 0x1FFFFF]\n char_n = 3\n elif head[:6] == \"111110\":\n char_range = [0x200000, 0x3FFFFFF]\n char_n = 4\n elif head[:7] == \"1111110\":\n char_range = [0x4000000, 0x7FFFFFFF]\n char_n = 5\n else:\n print \"utf8.py: wrong utf-8 header byte %s\" % header\n return 0xFF\n \n # (*) read the bytes from the char_stream that are needed\n try: bytes = map(lambda x: ord(x), char_stream.read(char_n))\n except:\n print \"utf8.py: could not read %i utf-follow bytes\" % char_n\n return 0xFF\n \n # -- take the remaining bits from the header\n bits = head[char_n+2:]\n # -- take from each following byte the 6 lowest bits \n for byte in bytes:\n # utf-8 says that any follower byte has to be in range [0x80-0xBF]\n if byte < 0x80 or byte > 0xBF: \n print \"utf8.py: follow-byte out of range: %02x not in [0x80-0xBF]\" % byte\n return 0xFF\n \n byte_str = __int_to_bit_string(byte, 8)\n # consider only the 6 lowest bits\n bits += byte_str[2:]\n\n return __bit_string_to_int(bits)\n\n\n \n\n" }, { "alpha_fraction": 0.6854130029678345, "alphanum_fraction": 0.6871704459190369, "avg_line_length": 19.321428298950195, "blob_id": "fe99a1c3453b4a32aa6cde9c6551b405d5f75c89", "content_id": "34cd17c3356ece8a482a1c13742f2316a4ab101c", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 1138, "license_type": "permissive", "max_line_length": 80, "num_lines": 56, "path": "/engine/net/net_manager.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "class NetManager;\n\n#ifndef NetManager_h\n#define NetManager_h\n\n#include <cstdlib>\n\n#include <queue>\n\n#include \"../external_table.h\"\n\n#include \"net.h\"\n\nclass NetManager\n{\nprivate:\n struct NetPacket\n {\n NetAddress addr;\n std::string data;\n uint64_t time;\n\n NetPacket(NetAddress& from, std::string& data_);\n };\n\n SOCKET netSocket;\n\n int forcedLatency;\n\n std::queue<NetPacket> receiveQueue;\n std::queue<NetPacket> sendQueue;\n\n std::queue<std::string> clientLoopQueue;\n std::queue<std::string> serverLoopQueue;\n\n ExternalTable netCBTable;\n\n void sendLoopbackPacket(NetChannel channel, std::string& packet);\n void sendPacketInternal(NetAddress& netAddress, std::string& packet);\n\npublic:\n NetManager();\n virtual ~NetManager();\n\n void process(lua_State* L);\n void processPacket(lua_State* L, NetAddress& from, std::string& data);\n\n void sendPacket(NetChannel channel, NetAddress& address, std::string& data);\n\n void setCBTable(ExternalTable& table);\n ExternalTable& getCBTable();\n\n bool getLoopbackPacket(NetChannel channel, std::string& packet);\n};\n\n#endif\n" }, { "alpha_fraction": 0.6715633273124695, "alphanum_fraction": 0.6854801177978516, "avg_line_length": 24.561264038085938, "blob_id": "77e11e0171dcea98cde4b35c07bd022a9fd1344f", "content_id": "822b369b6f438a73cd357f27a0302e0a46fcd580", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 6467, "license_type": "permissive", "max_line_length": 90, "num_lines": 253, "path": "/engine/gfx/gfx_light.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include \"gfx_internal.h\"\n#include \"gfx_light.h\"\n\nstatic bool have_init_coronas = false;\n\nstatic void ensure_coronas_init (void)\n{\n if (have_init_coronas) return;\n // this only happens once\n gfx_particle_define(\"/system/Coronas\",\n disk_resource_use<GfxTextureDiskResource>(\"/system/Corona.png\"));\n have_init_coronas = true;\n}\n\nconst std::string GfxLight::className = \"GfxLight\";\n\nGfxLight::GfxLight (const GfxNodePtr &par_)\n : GfxNode(par_),\n enabled(true),\n fade(1),\n coronaLocalPos(0,0,0),\n coronaSize(1),\n coronaColour(1,1,1),\n diffuse(1,1,1),\n specular(1,1,1),\n aim(1,0,0,0),\n coronaInnerAngle(Degree(180)),\n coronaOuterAngle(Degree(180))\n{\n light = ogre_sm->createLight();\n light->setDirection(Ogre::Vector3(0,1,0));\n light->setAttenuation(10, 0, 0, 0);\n light->setSpotlightInnerAngle(Ogre::Degree(180));\n light->setSpotlightOuterAngle(Ogre::Degree(180));\n updateVisibility();\n ensure_coronas_init();\n corona = gfx_particle_emit(\"/system/Coronas\");\n corona->setDefaultUV();\n corona->alpha = 1;\n corona->angle = 0;\n update(Vector3(0,0,0));\n}\n\nGfxLight::~GfxLight (void)\n{\n if (!dead) destroy();\n}\n\nvoid GfxLight::destroy (void)\n{\n if (dead) THROW_DEAD(className);\n if (light) ogre_sm->destroyLight(light);\n light = NULL;\n corona->release();\n GfxNode::destroy();\n}\n\nvoid GfxLight::update (const Vector3 &cam_pos)\n{\n if (dead) THROW_DEAD(className);\n light->setPosition(to_ogre(getWorldTransform().pos));\n light->setDirection(to_ogre(getWorldTransform().removeTranslation()*Vector3(0,1,0)));\n corona->pos = getWorldTransform() * coronaLocalPos;\n Vector3 col = enabled ? fade * coronaColour : Vector3(0,0,0);\n corona->dimensions = Vector3(coronaSize, coronaSize, coronaSize);\n\n Vector3 light_dir_ws = (cam_pos - getWorldTransform().pos).normalisedCopy();\n Vector3 light_aim_ws_ = getWorldTransform().removeTranslation() * Vector3(0,1,0);\n\n float angle = light_aim_ws_.dot(light_dir_ws);\n float inner = gritcos(coronaInnerAngle);\n float outer = gritcos(coronaOuterAngle);\n if (outer != inner) {\n float occlusion = std::min(std::max((angle-inner)/(outer-inner), 0.0f), 1.0f);\n col *= (1-occlusion);\n }\n corona->diffuse = Vector3(0, 0, 0);\n corona->emissive = col;\n}\n\nfloat GfxLight::getCoronaSize (void)\n{\n if (dead) THROW_DEAD(className);\n return coronaSize;\n}\nvoid GfxLight::setCoronaSize (float v)\n{\n if (dead) THROW_DEAD(className);\n coronaSize = v;\n}\n\nVector3 GfxLight::getCoronaLocalPosition (void)\n{\n if (dead) THROW_DEAD(className);\n return coronaLocalPos;\n}\n\nvoid GfxLight::setCoronaLocalPosition (const Vector3 &v)\n{\n if (dead) THROW_DEAD(className);\n coronaLocalPos = v;\n}\n\nVector3 GfxLight::getCoronaColour (void)\n{\n if (dead) THROW_DEAD(className);\n return coronaColour;\n}\n\nvoid GfxLight::setCoronaColour (const Vector3 &v)\n{\n if (dead) THROW_DEAD(className);\n coronaColour = v;\n}\n\nVector3 GfxLight::getDiffuseColour (void)\n{\n if (dead) THROW_DEAD(className);\n return diffuse;\n}\n\nVector3 GfxLight::getSpecularColour (void)\n{\n if (dead) THROW_DEAD(className);\n return specular;\n}\n\nvoid GfxLight::setDiffuseColour (const Vector3 &v)\n{\n if (dead) THROW_DEAD(className);\n diffuse = v;\n updateVisibility();\n}\n\nvoid GfxLight::setSpecularColour (const Vector3 &v)\n{\n if (dead) THROW_DEAD(className);\n specular = v;\n updateVisibility();\n}\n\nfloat GfxLight::getRange (void)\n{\n if (dead) THROW_DEAD(className);\n return light->getAttenuationRange();\n}\n\nvoid GfxLight::setRange (float v)\n{\n if (dead) THROW_DEAD(className);\n light->setAttenuation(v, 0, 0, 0);\n}\n\nDegree GfxLight::getInnerAngle (void)\n{\n if (dead) THROW_DEAD(className);\n return from_ogre(light->getSpotlightInnerAngle());\n}\n\nvoid GfxLight::setInnerAngle (Degree v)\n{\n if (dead) THROW_DEAD(className);\n light->setSpotlightInnerAngle(to_ogre(v));\n}\n\nDegree GfxLight::getOuterAngle (void)\n{\n if (dead) THROW_DEAD(className);\n return from_ogre(light->getSpotlightOuterAngle());\n}\n\nvoid GfxLight::setOuterAngle (Degree v)\n{\n if (dead) THROW_DEAD(className);\n light->setSpotlightOuterAngle(to_ogre(v));\n}\n\nDegree GfxLight::getCoronaInnerAngle (void)\n{\n if (dead) THROW_DEAD(className);\n return coronaInnerAngle;\n}\n\nvoid GfxLight::setCoronaInnerAngle (Degree v)\n{\n if (dead) THROW_DEAD(className);\n coronaInnerAngle = v;\n}\n\nDegree GfxLight::getCoronaOuterAngle (void)\n{\n if (dead) THROW_DEAD(className);\n return coronaOuterAngle;\n}\n\nvoid GfxLight::setCoronaOuterAngle (Degree v)\n{\n if (dead) THROW_DEAD(className);\n coronaOuterAngle = v;\n}\n\nbool GfxLight::isEnabled (void)\n{\n if (dead) THROW_DEAD(className);\n return enabled;\n}\n\nvoid GfxLight::setEnabled (bool v)\n{\n if (dead) THROW_DEAD(className);\n enabled = v;\n updateVisibility();\n}\n\nfloat GfxLight::getFade (void)\n{\n if (dead) THROW_DEAD(className);\n return fade;\n}\nvoid GfxLight::setFade (float f)\n{\n if (dead) THROW_DEAD(className);\n fade = f;\n updateVisibility();\n}\n\nvoid GfxLight::updateVisibility (void)\n{\n light->setVisible(enabled && fade > 0.001);\n light->setDiffuseColour(to_ogre_cv(fade * diffuse));\n light->setSpecularColour(to_ogre_cv(fade * specular));\n}\n" }, { "alpha_fraction": 0.5557844638824463, "alphanum_fraction": 0.5643423199653625, "avg_line_length": 23.269229888916016, "blob_id": "dec46036e9bed908f1936edfe55586cddbcebcb1", "content_id": "5f1b5f8ad489a1585384bdecc733a78743ee0fba", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 6310, "license_type": "permissive", "max_line_length": 91, "num_lines": 260, "path": "/engine/net/net_manager.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "#include <cstdlib>\n\n#include <sleep.h>\n\n#include <centralised_log.h>\n\n#include \"../grit_lua_util.h\"\n\n#include \"net.h\"\n#include \"net_manager.h\"\n#include \"lua_wrappers_net.h\"\n\nNetManager::NetPacket::NetPacket(NetAddress& from, std::string& data_) {\n addr = from;\n data = data_;\n time = micros();\n}\n\n#if defined(WIN32)\n# define sock_errno WSAGetLastError()\n# define ADDRESS_ALREADY_USED WSAEADDRINUSE\n# define WOULD_BLOCK WSAEWOULDBLOCK\n# define CONNECTION_RESET WSAECONNRESET\n#else\n# define sock_errno errno\n# define closesocket close\n# define ioctlsocket ioctl\n# define WOULD_BLOCK EAGAIN\n# define CONNECTION_RESET ECONNRESET\n# define ADDRESS_ALREADY_USED EADDRINUSE\n#endif\n\nNetManager::NetManager()\n : forcedLatency(0)\n{\n#if defined(WIN32)\n WSADATA wsaData;\n if (WSAStartup(MAKEWORD(2, 2), &wsaData) != 0) {\n GRIT_EXCEPT(\"WSAStartup failed\");\n }\n#endif\n\n netSocket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);\n\n // FIXME win32 dependency\n if (netSocket == INVALID_SOCKET)\n {\n GRIT_EXCEPT(\"socket creation failed\");\n }\n\n uint16_t port = 48960;\n\n while (true) {\n sockaddr_in bindEP;\n memset(&bindEP, 0, sizeof(bindEP));\n bindEP.sin_family = AF_INET;\n bindEP.sin_addr.s_addr = INADDR_ANY;\n bindEP.sin_port = htons(port);\n\n if (bind(netSocket, (sockaddr*)&bindEP, sizeof(bindEP)) != 0) {\n if (sock_errno == ADDRESS_ALREADY_USED) {\n port++;\n continue;\n } else {\n GRIT_EXCEPT(\"binding socket failed\");\n }\n }\n\n break;\n }\n\n CLOG << \"Listening on port \" << port << std::endl;\n\n // set non-blocking mode\n u_long nonBlocking = 1;\n\n ioctlsocket(netSocket, FIONBIO, &nonBlocking);\n}\n\nNetManager::~NetManager()\n{\n if (netSocket)\n {\n closesocket(netSocket);\n }\n\n#if defined(WIN32)\n WSACleanup();\n#endif\n}\n\nvoid NetManager::processPacket(lua_State* L, NetAddress& from, std::string& data)\n{\n STACK_BASE;\n\n push_cfunction(L, my_lua_error_handler);\n int error_handler = lua_gettop(L);\n\n const char* err = netCBTable.luaGet(L, \"process_packet\");\n\n if (err) {\n my_lua_error(L, err);\n }\n\n STACK_CHECK_N(2);\n\n push_netaddress(L, NetAddressPtr(new NetAddress(from)));\n push_netmessage(L, NetMessagePtr(new NetMessage(data.c_str(), data.size())));\n\n STACK_CHECK_N(4);\n\n // note this pops the args and the function from the stack\n int status = lua_pcall(L, 2, 0, error_handler);\n\n if (status) {\n STACK_CHECK_N(2);\n lua_pop(L, 1); // pop the error\n\n CERR << \"Encountered an error during processing of a network packet.\" << std::endl;\n\n STACK_CHECK_N(1);\n }\n\n // empty the stack\n STACK_CHECK_N(1);\n lua_pop(L, 1);\n STACK_CHECK;\n}\n\nvoid NetManager::process(lua_State* L)\n{\n char buffer[16384];\n int bytes = 0;\n sockaddr_storage remoteEP;\n socklen_t remoteEPLength = sizeof(remoteEP);\n\n while (true) {\n bytes = recvfrom(netSocket, buffer, sizeof(buffer), 0, (sockaddr*)&remoteEP,\n &remoteEPLength);\n if (bytes < 0) {\n if (sock_errno != WOULD_BLOCK && sock_errno != CONNECTION_RESET) {\n CLOG << \"socket error \" << sock_errno << std::endl;\n } else {\n break;\n }\n }\n\n if (bytes > 0) {\n std::string data(buffer, bytes);\n NetAddress from((sockaddr*)&remoteEP, remoteEPLength);\n\n if (forcedLatency == 0) {\n processPacket(L, from, data);\n } else {\n receiveQueue.push(NetPacket(from, data));\n }\n }\n\n // process queues\n uint64_t time = micros();\n\n if (!sendQueue.empty()) {\n do {\n NetPacket packet = sendQueue.front();\n\n if (time >= (packet.time + (forcedLatency * 1000))) {\n sendPacketInternal(packet.addr, packet.data);\n\n sendQueue.pop();\n } else {\n break;\n }\n } while (!sendQueue.empty());\n }\n\n if (!receiveQueue.empty()) {\n do {\n NetPacket packet = receiveQueue.front();\n\n if (time >= (packet.time + (forcedLatency * 1000))) {\n processPacket(L, packet.addr, packet.data);\n\n receiveQueue.pop();\n } else {\n break;\n }\n } while (!receiveQueue.empty());\n }\n }\n}\n\nvoid NetManager::sendPacket(NetChannel channel, NetAddress& address, std::string& data)\n{\n if (address.getType() == NetAddress_Loopback) {\n sendLoopbackPacket(channel, data);\n } else {\n if (forcedLatency > 0) {\n sendQueue.push(NetPacket(address, data));\n } else {\n //sendPacketInternal(address, data);\n sockaddr_storage to;\n int toLen;\n\n address.getSockAddr(&to, &toLen);\n\n sendto(netSocket, data.c_str(), data.size(), 0, (sockaddr*)&to, toLen);\n }\n }\n}\n\nvoid NetManager::sendPacketInternal(NetAddress& netAddress, std::string& packet)\n{\n sockaddr_storage to;\n int toLen;\n\n netAddress.getSockAddr(&to, &toLen);\n\n sendto(netSocket, packet.c_str(), packet.size(), 0, (sockaddr*)&to, toLen);\n}\n\nvoid NetManager::sendLoopbackPacket(NetChannel channel, std::string& packet)\n{\n if (channel == NetChan_ClientToServer) {\n serverLoopQueue.push(packet);\n } else if (channel == NetChan_ServerToClient) {\n clientLoopQueue.push(packet);\n }\n}\n\nbool NetManager::getLoopbackPacket(NetChannel channel, std::string& packet)\n{\n std::queue<std::string>* queue = NULL;\n\n if (channel == NetChan_ClientToServer) {\n queue = &serverLoopQueue;\n } else if (channel == NetChan_ServerToClient) {\n queue = &clientLoopQueue;\n }\n\n if (queue != NULL) {\n if (!queue->empty()) {\n packet = queue->front();\n queue->pop();\n\n return true;\n }\n }\n\n return false;\n}\n\nvoid NetManager::setCBTable(ExternalTable& table)\n{\n this->netCBTable = table;\n}\n\nExternalTable& NetManager::getCBTable()\n{\n return this->netCBTable;\n}\n" }, { "alpha_fraction": 0.6270712018013, "alphanum_fraction": 0.6280046701431274, "avg_line_length": 35.931034088134766, "blob_id": "7538174326b80bf8bbb48a3c33da302b483f3548", "content_id": "cd17c1cd37e506a6f050724f2ed1c41e8501ec99", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 4285, "license_type": "permissive", "max_line_length": 113, "num_lines": 116, "path": "/dependencies/quex-0.34.1/quex/input/regular_expression.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "from StringIO import StringIO\nfrom quex.input.setup import setup as Setup\n\nfrom quex.frs_py.file_in import EndOfStreamException, error_msg\nfrom quex.exception import RegularExpressionException\nimport quex.lexer_mode as lexer_mode\nimport quex.core_engine.regular_expression.core as regex\nimport quex.core_engine.regular_expression.character_set_expression as charset_expression\nimport quex.core_engine.regular_expression.snap_character_string as snap_character_string\n\ndef parse(fh, AllowNothingIsFineF=False):\n\n start_position = fh.tell()\n try:\n # (*) parse regular expression, build state machine\n pattern_state_machine = regex.do(fh, lexer_mode.shorthand_db, \n BufferLimitCode = Setup.buffer_limit_code,\n DOS_CarriageReturnNewlineF = not Setup.no_dos_carriage_return_newline_f,\n AllowNothingIsFineF = AllowNothingIsFineF)\n\n # (*) error in regular expression?\n if pattern_state_machine == None:\n error_msg(\"No valid regular expression detected.\", fh)\n\n except RegularExpressionException, x:\n fh.seek(start_position)\n error_msg(\"Regular expression parsing:\\n\" + x.message, fh)\n\n except EndOfStreamException:\n fh.seek(start_position)\n error_msg(\"End of file reached while parsing regular expression.\", fh)\n\n end_position = fh.tell()\n\n fh.seek(start_position)\n regular_expression = fh.read(end_position - start_position)\n\n return regular_expression, pattern_state_machine\n\n\ndef parse_character_set(Txt_or_File, PatternStringF=False):\n\n if Txt_or_File.__class__ in [file, StringIO]:\n sh = Txt_or_File\n sh_ref = sh\n position = sh.tell()\n else:\n sh = StringIO(Txt_or_File)\n sh_ref = -1\n\n start_position = sh.tell()\n\n try:\n # -- parse regular expression, build state machine\n character_set = charset_expression.snap_set_expression(sh)\n\n if character_set == None:\n error_msg(\"No valid regular character set expression detected.\", sh_ref)\n\n # -- character set is not supposed to contain buffer limit code\n if character_set.contains(Setup.buffer_limit_code):\n character_set.cut_interval(Interval(Setup.buffer_limit_code, Setup.buffer_limit_code))\n\n except RegularExpressionException, x:\n error_msg(\"Regular expression parsing:\\n\" + x.message, sh_ref)\n\n except EndOfStreamException:\n if sh_ref != -1: sh_ref.seek(position)\n error_msg(\"End of character set expression reached while parsing.\", sh_ref)\n\n if PatternStringF:\n assert sh.__class__ != StringIO\n end_position = sh.tell()\n sh.seek(start_position)\n regular_expression = sh.read(end_position - start_position)\n return regular_expression, character_set\n\n return character_set\n\ndef parse_character_string(Txt_or_File, PatternStringF=False):\n\n if Txt_or_File.__class__ in [file, StringIO]:\n sh = Txt_or_File\n sh_ref = sh\n position = sh.tell()\n else:\n sh = StringIO(Txt_or_File)\n sh_ref = -1\n\n start_position = sh.tell()\n\n try:\n # -- parse regular expression, build state machine\n state_machine = snap_character_string.do(sh)\n state_machine = regex.__clean_and_validate(state_machine, \n Setup.buffer_limit_code, \n AllowNothingIsFineF=False)\n\n if state_machine == None:\n error_msg(\"No valid regular character string expression detected.\", sh_ref)\n\n except RegularExpressionException, x:\n error_msg(\"Regular expression parsing:\\n\" + x.message, sh_ref)\n\n except EndOfStreamException:\n if sh_ref != -1: sh_ref.seek(position)\n error_msg(\"End of character string reached while parsing.\", sh_ref)\n\n if PatternStringF:\n assert sh.__class__ != StringIO\n end_position = sh.tell()\n sh.seek(start_position)\n regular_expression = sh.read(end_position - start_position)\n return regular_expression, state_machine\n\n return state_machine\n\n" }, { "alpha_fraction": 0.5342941880226135, "alphanum_fraction": 0.5402136445045471, "avg_line_length": 37.2512321472168, "blob_id": "4c1cf3dded8966065be2442a4d1d27f8a5df2846", "content_id": "f1e7589fa4d2575ac4c7f5ab3638c50cd12f4f0f", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 7771, "license_type": "permissive", "max_line_length": 120, "num_lines": 203, "path": "/dependencies/quex-0.34.1/quex/core_engine/regular_expression/character_set_expression.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "# GRAMMAR:\n#\n# set_expression: \n# [: set_term :]\n# traditional character set\n# \\P '{' propperty string '}'\n#\n# set_term:\n# \"alnum\" \n# \"alpha\" \n# \"blank\" \n# \"cntrl\" \n# \"digit\" \n# \"graph\" \n# \"lower\" \n# \"print\" \n# \"punct\" \n# \"space\" \n# \"upper\" \n# \"xdigit\"\n# \"union\" '(' set_term [ ',' set_term ]+ ')'\n# \"intersection\" '(' set_term [ ',' set_term ]+ ')'\n# \"difference\" '(' set_term [ ',' set_term ]+ ')'\n# \"inverse\" '(' set_term ')'\n# set_expression\n# \nimport quex.core_engine.regular_expression.traditional_character_set as traditional_character_set\nimport quex.core_engine.regular_expression.property as property\nimport quex.core_engine.regular_expression.auxiliary as aux\n#\nfrom quex.core_engine.state_machine.core import StateMachine\nfrom quex.exception import RegularExpressionException\nfrom quex.frs_py.file_in import read_until_letter, \\\n read_until_non_letter, \\\n skip_whitespace\nfrom quex.core_engine.regular_expression.auxiliary import __snap_until, \\\n __debug_entry, \\\n __debug_exit\n\nspecial_character_set_db = {\n # The closing ']' is to trigger the end of the traditional character set\n \"alnum\": traditional_character_set.do_string(\"a-zA-Z0-9]\"),\n \"alpha\": traditional_character_set.do_string(\"a-zA-Z]\"),\n \"blank\": traditional_character_set.do_string(\" \\\\t]\"),\n \"cntrl\": traditional_character_set.do_string(\"\\\\x00-\\\\x1F\\\\x7F]\"), \n \"digit\": traditional_character_set.do_string(\"0-9]\"),\n \"graph\": traditional_character_set.do_string(\"\\\\x21-\\\\x7E]\"),\n \"lower\": traditional_character_set.do_string(\"a-z]\"),\n \"print\": traditional_character_set.do_string(\"\\\\x20-\\\\x7E]\"), \n \"punct\": traditional_character_set.do_string(\"!\\\"#$%&'()*+,-./:;?@[\\\\]_`{|}~\\\\\\\\]\"),\n \"space\": traditional_character_set.do_string(\" \\\\t\\\\r\\\\n]\"),\n \"upper\": traditional_character_set.do_string(\"A-Z]\"),\n \"xdigit\": traditional_character_set.do_string(\"a-fA-F0-9]\"),\n}\n\ndef do(stream):\n trigger_set = snap_set_expression(stream)\n\n if trigger_set == None: \n raise RegularExpressionException(\"Regular Expression: character_set_expression called for something\\n\" + \\\n \"that does not start with '[:', '[' or '\\\\P'\")\n if trigger_set.is_empty():\n raise RegularExpressionException(\"Regular Expression: Character set expression results in empty set.\")\n\n # Create state machine that triggers with the trigger set to SUCCESS\n # NOTE: The default for the ELSE transition is FAIL.\n sm = StateMachine()\n sm.add_transition(sm.init_state_index, trigger_set, AcceptanceF=True)\n\n return __debug_exit(sm, stream)\n\ndef snap_set_expression(stream):\n assert stream.__class__.__name__ == \"StringIO\" \\\n or stream.__class__.__name__ == \"file\"\n\n __debug_entry(\"set_expression\", stream)\n\n result = snap_property_set(stream)\n if result != None: return result\n\n x = stream.read(2)\n if x == \"[:\":\n result = snap_set_term(stream)\n skip_whitespace(stream)\n x = stream.read(2)\n if x != \":]\":\n raise RegularExpressionException(\"Missing closing ':]' for character set expression.\\n\" + \\\n \"found: '%s'\" % x)\n elif x[0] == \"[\":\n stream.seek(-1, 1)\n result = traditional_character_set.do(stream) \n elif x == \"\\\\P\": \n stream.seek(-2, 1)\n result = property.do(stream)\n elif x == \"\\\\N\": \n stream.seek(-2, 1)\n result = property.do_shortcut(stream, \"N\", \"na\") # UCS Property: Name\n elif x == \"\\\\G\": \n stream.seek(-2, 1)\n result = property.do_shortcut(stream, \"G\", \"gc\") # UCS Property: General_Category\n else:\n result = None\n\n return __debug_exit(result, stream)\n\ndef snap_property_set(stream):\n position = stream.tell()\n x = stream.read(2)\n if x == \"\\\\P\": \n stream.seek(position)\n return property.do(stream)\n elif x == \"\\\\N\": \n stream.seek(position)\n return property.do_shortcut(stream, \"N\", \"na\") # UCS Property: Name\n elif x == \"\\\\G\": \n stream.seek(position)\n return property.do_shortcut(stream, \"G\", \"gc\") # UCS Property: General_Category\n else:\n stream.seek(position)\n return None\n\ndef snap_set_term(stream):\n __debug_entry(\"set_term\", stream) \n\n skip_whitespace(stream)\n position = stream.tell()\n\n # if there is no following '(', then enter the 'snap_expression' block below\n try: \n word = read_until_non_letter(stream)\n stream.seek(-1, 1) # putback the non-letter\n except: \n word = \"not a valid word\"\n\n word = word.strip()\n\n if word in [ \"union\", \"intersection\", \"difference\", \"inverse\"]: \n set_list = snap_set_list(stream, word)\n # if an error occurs during set_list parsing, an exception is thrown about syntax error\n\n L = len(set_list)\n result = set_list[0]\n\n if word == \"inverse\":\n # The inverse of multiple sets, is to be the inverse of the union of these sets.\n if L > 1:\n for set in set_list[1:]:\n result.unite_with(set)\n result = result.inverse()\n return __debug_exit(result, stream)\n\n if L < 2:\n raise RegularExpressionException(\"Regular Expression: A %s operation needs at least\\n\" % word + \\\n \"two sets to operate on them.\")\n \n if word == \"union\":\n for set in set_list[1:]:\n result.unite_with(set)\n elif word == \"intersection\":\n for set in set_list[1:]:\n result.intersect_with(set)\n elif word == \"difference\":\n for set in set_list[1:]:\n result.subtract(set)\n\n elif word in special_character_set_db.keys():\n result = special_character_set_db[word]\n\n else:\n # try to snap an expression out of it\n stream.seek(position)\n result = snap_set_expression(stream)\n\n return __debug_exit(result, stream)\n\ndef __snap_word(stream):\n try: the_word = read_until_letter(stream, [\"(\"]) \n except: \n raise RegularExpressionException(\"Missing opening bracket.\")\n stream.seek(-1,1)\n return the_word.strip()\n\ndef snap_set_list(stream, set_operation_name):\n __debug_entry(\"set_list\", stream)\n\n skip_whitespace(stream)\n if stream.read(1) != \"(\": \n raise RegularExpressionException(\"Missing opening bracket '%s' operation.\" % set_operation_name)\n\n set_list = []\n while 1 + 1 == 2:\n skip_whitespace(stream)\n result = snap_set_term(stream)\n if result == None: \n raise RegularExpressionException(\"Missing set expression list after '%s' operation.\" % set_operation_name)\n set_list.append(result)\n skip_whitespace(stream)\n tmp = stream.read(1)\n if tmp != \",\": \n if tmp != \")\":\n stream.seek(-1, 1)\n raise RegularExpressionException(\"Missing closing ')' after after '%s' operation.\" % set_operation_name)\n return __debug_exit(set_list, stream)\n\n\n \n" }, { "alpha_fraction": 0.6361702084541321, "alphanum_fraction": 0.6470019221305847, "avg_line_length": 38.769229888916016, "blob_id": "0ce0b98c94786f76227d9b1331d0b5e7d7402c59", "content_id": "d59731f8ff273d7c483c7ffc66f57a45604b35e7", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 10340, "license_type": "permissive", "max_line_length": 99, "num_lines": 260, "path": "/engine/gfx/gfx_debug.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include \"gfx_internal.h\"\n#include \"gfx_decal.h\"\n#include \"gfx_material.h\"\n\n// vdata to be allocated later because constructor requires OGRE to be initialised.\nstatic Ogre::RenderOperation tri_op;\nstatic Ogre::HardwareVertexBufferSharedPtr tri_vbuf;\n\nstatic Ogre::RenderOperation lines_op;\nstatic Ogre::HardwareVertexBufferSharedPtr lines_vbuf;\n\nstatic Ogre::RenderOperation points_op;\nstatic Ogre::HardwareVertexBufferSharedPtr points_vbuf;\n\n// Initialised by gfx_debug_init().\nstatic unsigned vdecl_size = 28;\nGfxShader *shader;\n\n// Strict alignment required here.\nstruct Vertex {\n Vector3 position;\n Vector3 colour;\n float alpha;\n};\n\nstatic void recreate_vbuf(Ogre::HardwareVertexBufferSharedPtr &vbuf, size_t num_vertexes)\n{\n vbuf = Ogre::HardwareBufferManager::getSingleton().createVertexBuffer(\n vdecl_size, num_vertexes,\n Ogre::HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY_DISCARDABLE);\n}\n\nvoid gfx_debug_init (void)\n{\n APP_ASSERT(sizeof(Vertex) == vdecl_size);\n size_t size;\n\n points_op.operationType = Ogre::RenderOperation::OT_POINT_LIST;\n points_op.vertexData = OGRE_NEW Ogre::VertexData();\n points_op.vertexData->vertexStart = 0;\n points_op.useIndexes = false;\n size = 0;\n size += points_op.vertexData->vertexDeclaration->addElement(\n 0, size, Ogre::VET_FLOAT3, Ogre::VES_POSITION).getSize();\n size += points_op.vertexData->vertexDeclaration->addElement(\n 0, size, Ogre::VET_FLOAT4, Ogre::VES_DIFFUSE, 0).getSize();\n APP_ASSERT(size == vdecl_size);\n recreate_vbuf(points_vbuf, 20000);\n points_op.vertexData->vertexBufferBinding->setBinding(0, points_vbuf);\n\n lines_op.operationType = Ogre::RenderOperation::OT_LINE_LIST;\n lines_op.vertexData = OGRE_NEW Ogre::VertexData();\n lines_op.vertexData->vertexStart = 0;\n lines_op.useIndexes = false;\n size = 0;\n size += lines_op.vertexData->vertexDeclaration->addElement(\n 0, size, Ogre::VET_FLOAT3, Ogre::VES_POSITION).getSize();\n size += lines_op.vertexData->vertexDeclaration->addElement(\n 0, size, Ogre::VET_FLOAT4, Ogre::VES_DIFFUSE, 0).getSize();\n APP_ASSERT(size == vdecl_size);\n recreate_vbuf(lines_vbuf, 20000);\n lines_op.vertexData->vertexBufferBinding->setBinding(0, lines_vbuf);\n\n tri_op.operationType = Ogre::RenderOperation::OT_TRIANGLE_LIST;\n tri_op.vertexData = OGRE_NEW Ogre::VertexData();\n tri_op.vertexData->vertexStart = 0;\n tri_op.useIndexes = false;\n size = 0;\n size += tri_op.vertexData->vertexDeclaration->addElement(\n 0, size, Ogre::VET_FLOAT3, Ogre::VES_POSITION).getSize();\n size += tri_op.vertexData->vertexDeclaration->addElement(\n 0, size, Ogre::VET_FLOAT4, Ogre::VES_DIFFUSE, 0).getSize();\n APP_ASSERT(size == vdecl_size);\n recreate_vbuf(tri_vbuf, 30000);\n tri_op.vertexData->vertexBufferBinding->setBinding(0, tri_vbuf);\n\n std::string vertex_code = \"out.position = transform_to_world(vert.position.xyz);\";\n std::string colour_code =\n \"out.colour = vert.colour.xyz;\\n\"\n \"out.alpha = vert.colour.w;\\n\"\n \"out.colour = out.colour * out.alpha;\\n\";\n shader = gfx_shader_make_or_reset(\"/system/Debug\",\n vertex_code, \"\", colour_code, GfxGslRunParams{}, false);\n}\n\nvoid gfx_debug_shutdown (void)\n{\n // Referenced buffers are managed via sharedptr.\n OGRE_DELETE tri_op.vertexData;\n}\n\nstd::vector<Vertex> points_vertexes;\n\nvoid gfx_debug_point (Vector3 pos, float radius, Vector3 col, float alpha)\n{\n (void) radius; // Looks like we have to have the same radius for all points.\n points_vertexes.push_back({pos, col, alpha});\n}\n\nstd::vector<Vertex> lines_vertexes;\n\nvoid gfx_debug_line (Vector3 from, Vector3 to, Vector3 col, float alpha)\n{\n lines_vertexes.push_back({from, col, alpha});\n lines_vertexes.push_back({to, col, alpha});\n}\n\nstd::vector<Vertex> tri_vertexes;\n\nvoid gfx_debug_triangle (Vector3 v1, Vector3 v2, Vector3 v3, Vector3 col, float alpha)\n{\n tri_vertexes.push_back({v1, col, alpha});\n tri_vertexes.push_back({v2, col, alpha});\n tri_vertexes.push_back({v3, col, alpha});\n}\n\nvoid gfx_debug_quad (Vector3 v1, Vector3 v2, Vector3 v3, Vector3 v4, Vector3 col, float alpha)\n{\n gfx_debug_triangle(v1, v2, v3, col, alpha);\n gfx_debug_triangle(v3, v4, v1, col, alpha);\n}\n\nvoid gfx_debug_render (GfxPipeline *p)\n{\n GfxShaderGlobals g = gfx_shader_globals_cam(p);\n\n const Ogre::Matrix4 world = Ogre::Matrix4::IDENTITY;\n \n if (points_vertexes.size() > 0) {\n // Update buffer.\n Ogre::VertexData *vdata = points_op.vertexData;\n vdata->vertexCount = points_vertexes.size();\n if (points_vbuf->getNumVertices() < vdata->vertexCount) {\n recreate_vbuf(points_vbuf, vdata->vertexCount);\n points_op.vertexData->vertexBufferBinding->setBinding(0, points_vbuf);\n }\n points_vbuf->writeData(\n vdata->vertexStart, vdata->vertexCount * vdecl_size, &points_vertexes[0], true);\n\n // ISSUE RENDER COMMANDS\n try {\n static const GfxTextureStateMap no_texs;\n static const GfxShaderBindings bindings;\n shader->bindShader(\n GFX_GSL_PURPOSE_HUD, false, false, 0, g, world, nullptr, 0, 1, no_texs, bindings);\n\n // Read but don't write depth buffer.\n ogre_rs->_setDepthBufferParams(true, false, Ogre::CMPF_LESS_EQUAL);\n ogre_rs->_setSceneBlending(Ogre::SBF_SOURCE_ALPHA, Ogre::SBF_ONE_MINUS_SOURCE_ALPHA);\n\n // All parameters after the boolean are ignored in GL3PlusRenderSystem...\n ogre_rs->_setPointParameters(10, false, 0, 1, 0, 0, 10);\n ogre_rs->setStencilCheckEnabled(false);\n ogre_rs->_setDepthBias(0, 0);\n\n ogre_rs->_render(points_op);\n\n } catch (const Exception &e) {\n CERR << \"Rendering debug points, got: \" << e << std::endl;\n } catch (const Ogre::Exception &e) {\n CERR << \"Rendering debug points, got: \" << e.getDescription() << std::endl;\n }\n points_vertexes.clear();\n }\n \n if (lines_vertexes.size() > 0) {\n // Update buffer.\n Ogre::VertexData *vdata = lines_op.vertexData;\n vdata->vertexCount = lines_vertexes.size();\n if (lines_vbuf->getNumVertices() < vdata->vertexCount) {\n recreate_vbuf(lines_vbuf, vdata->vertexCount);\n lines_op.vertexData->vertexBufferBinding->setBinding(0, lines_vbuf);\n }\n lines_vbuf->writeData(\n vdata->vertexStart, vdata->vertexCount * vdecl_size, &lines_vertexes[0], true);\n\n // ISSUE RENDER COMMANDS\n try {\n static const GfxTextureStateMap no_texs;\n static const GfxShaderBindings bindings;\n shader->bindShader(\n GFX_GSL_PURPOSE_HUD, false, false, 0, g, world, nullptr, 0, 1, no_texs, bindings);\n\n ogre_rs->_setCullingMode(Ogre::CULL_NONE);\n // Read but don't write depth buffer.\n ogre_rs->_setDepthBufferParams(true, false, Ogre::CMPF_LESS_EQUAL);\n ogre_rs->_setSceneBlending(Ogre::SBF_SOURCE_ALPHA, Ogre::SBF_ONE_MINUS_SOURCE_ALPHA);\n\n ogre_rs->_setPolygonMode(Ogre::PM_SOLID);\n ogre_rs->setStencilCheckEnabled(false);\n ogre_rs->_setDepthBias(0, 0);\n\n ogre_rs->_render(lines_op);\n\n } catch (const Exception &e) {\n CERR << \"Rendering debug lines, got: \" << e << std::endl;\n } catch (const Ogre::Exception &e) {\n CERR << \"Rendering debug lines, got: \" << e.getDescription() << std::endl;\n }\n lines_vertexes.clear();\n }\n \n if (tri_vertexes.size() > 0) {\n // Update buffer.\n Ogre::VertexData *vdata = tri_op.vertexData;\n vdata->vertexCount = tri_vertexes.size();\n if (tri_vbuf->getNumVertices() < vdata->vertexCount) {\n recreate_vbuf(tri_vbuf, vdata->vertexCount);\n tri_op.vertexData->vertexBufferBinding->setBinding(0, tri_vbuf);\n }\n tri_vbuf->writeData(\n vdata->vertexStart, vdata->vertexCount * vdecl_size, &tri_vertexes[0], true);\n\n // ISSUE RENDER COMMANDS\n try {\n static const GfxTextureStateMap no_texs;\n static const GfxShaderBindings bindings;\n shader->bindShader(\n GFX_GSL_PURPOSE_HUD, false, false, 0, g, world, nullptr, 0, 1, no_texs, bindings);\n\n ogre_rs->_setCullingMode(Ogre::CULL_CLOCKWISE);\n // Read but don't write depth buffer.\n ogre_rs->_setDepthBufferParams(true, false, Ogre::CMPF_LESS_EQUAL);\n ogre_rs->_setSceneBlending(Ogre::SBF_SOURCE_ALPHA, Ogre::SBF_ONE_MINUS_SOURCE_ALPHA);\n\n ogre_rs->_setPolygonMode(Ogre::PM_SOLID);\n ogre_rs->setStencilCheckEnabled(false);\n ogre_rs->_setDepthBias(0, 0);\n\n ogre_rs->_render(tri_op);\n\n } catch (const Exception &e) {\n CERR << \"Rendering debug triangles, got: \" << e << std::endl;\n } catch (const Ogre::Exception &e) {\n CERR << \"Rendering debug triangles, got: \" << e.getDescription() << std::endl;\n }\n tri_vertexes.clear();\n }\n}\n" }, { "alpha_fraction": 0.5905834436416626, "alphanum_fraction": 0.5960423350334167, "avg_line_length": 31.566667556762695, "blob_id": "2097932738e7473d8330e6ccff2e5c818af86d59", "content_id": "5fda3c4ebc485e353e4c911d81b9d70d27609805", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 2931, "license_type": "permissive", "max_line_length": 90, "num_lines": 90, "path": "/engine/path_util.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <centralised_log.h>\n#include \"path_util.h\"\n#include \"grit_lua_util.h\"\n\n// handle .. in paths\nstatic std::string path_collapse (const std::string &p, bool &err)\n{\n APP_ASSERT(p[0] == '/');\n std::vector<std::string> new_path;\n size_t last = 0;\n //CVERB<<\"Starting with: \"<<p<<std::endl;\n do {\n size_t next = p.find('/', last+1);\n std::string dir(p, last+1, next-last-1);\n //CVERB<<\"Piece: \"<<last<<\" \"<<next<<\" \"<<dir<<std::endl;\n if (dir == \"..\") {\n if (new_path.size()==0) {\n err = true;\n return \"\";\n }\n new_path.pop_back();\n } else {\n new_path.push_back(dir);\n }\n if (next == std::string::npos) break;\n last = next;\n } while (true);\n std::string r;\n for (size_t i=0 ; i<new_path.size(); ++i) {\n r.append(\"/\");\n r.append(new_path[i]);\n }\n return r;\n}\n\nstd::string grit_dirname (const std::string &absolute)\n{\n APP_ASSERT(absolute[0] == '/');\n std::string dir(absolute, 0, absolute.rfind('/')+1);\n return dir;\n}\n\nstd::string pwd_full_ex (std::string rel, const std::string &path)\n{\n if (rel[0] != '/') {\n rel = path + rel;\n }\n // process '..'\n bool err = false;\n std::string r = path_collapse(rel, err);\n if (err)\n EXCEPT << \"Path tries to escape game dir: \\\"\" << rel << \"\\\"\" << ENDL;\n return r;\n}\n\nstd::string pwd_full_ex (std::string rel, const std::string &path, const std::string &def)\n{\n if (rel[0] != '/') {\n rel = path + rel;\n }\n // process '..'\n bool err = false;\n std::string r = path_collapse(rel, err);\n if (err) {\n CERR << \"Path tries to escape game dir: \\\"\" << rel << \"\\\"\" << std::endl;\n r = def;\n }\n return r;\n}\n" }, { "alpha_fraction": 0.6186468005180359, "alphanum_fraction": 0.6210747957229614, "avg_line_length": 28.5598087310791, "blob_id": "a1b97d59a3f1948604c52c2d36196bad35d34904", "content_id": "8f6aa0c62cdddfbcf1598e3ceff6c0ebe73272e1", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 6178, "license_type": "permissive", "max_line_length": 98, "num_lines": 209, "path": "/engine/disk_resource.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n\n#include \"core_option.h\"\n#include \"main.h\"\n\n#include \"gfx/gfx_disk_resource.h\"\n\n#include \"audio/audio_disk_resource.h\"\n#include \"physics/collision_mesh.h\"\n\nbool disk_resource_foreground_warnings = true;\nbool disk_resource_verbose_loads = false;\nbool disk_resource_verbose_incs = false;\n\n// should map nothing to NULL\ntypedef std::map<std::string, DiskResource*> DiskResourceMap;\nDiskResourceMap disk_resource_map;\n\nbool disk_resource_has (const std::string &n)\n{\n if (n[0] != '/') EXCEPT << \"Path must be absolute: \\\"\" << n << \"\\\"\" << ENDL;\n DiskResourceMap::iterator it = disk_resource_map.find(n);\n if (it == disk_resource_map.end()) return false;\n return true;\n}\n\nunsigned long disk_resource_num (void)\n{\n return disk_resource_map.size();\n}\n\nint disk_resource_num_loaded (void)\n{\n int r = 0;\n DiskResourceMap &m = disk_resource_map;\n for (DiskResourceMap::iterator i=m.begin(), i_=m.end() ; i != i_ ; ++i) {\n if (i->second->isLoaded()) r++;\n }\n return r;\n}\n\nDiskResources disk_resource_all (void)\n{\n DiskResources r;\n DiskResourceMap &m = disk_resource_map;\n for (DiskResourceMap::iterator i=m.begin(), i_=m.end() ; i != i_ ; ++i) {\n r.push_back(i->second);\n }\n return r;\n}\n\nDiskResources disk_resource_all_loaded (void)\n{\n DiskResources r;\n DiskResourceMap &m = disk_resource_map;\n for (DiskResourceMap::iterator i=m.begin(), i_=m.end() ; i != i_ ; ++i) {\n if (i->second->isLoaded())\n r.push_back(i->second);\n }\n return r;\n}\n \nstatic bool ends_with (const std::string &str, const std::string &snippet)\n{\n if (snippet.length() > str.length()) return false;\n return str.substr(str.length() - snippet.length()) == snippet;\n}\n\nDiskResource *disk_resource_get_or_make (const std::string &rn)\n{\n if (disk_resource_has(rn))\n return disk_resource_map[rn];\n\n size_t pos = rn.rfind('.');\n if (pos == rn.npos) {\n EXCEPT << \"Disk resource \\\"\" << rn << \"\\\" does not have a file extension.\" << ENDL;\n }\n std::string suffix(rn, pos + 1);\n\n const char *texture_formats[] = { \"jpg\", \"png\", \"tga\", \"tiff\", \"hdr\", \"dds\" };\n unsigned num_texture_formats = sizeof(texture_formats)/sizeof(*texture_formats);\n\n DiskResource *dr = nullptr;\n if (suffix == \"mesh\") {\n dr = new GfxMeshDiskResource(rn);\n } else if (suffix == \"tcol\" || suffix == \"gcol\" || suffix == \"bcol\") {\n dr = new CollisionMesh(rn);\n } else if (suffix == \"wav\" || suffix == \"ogg\" || suffix == \"mp3\") {\n dr = new AudioDiskResource(rn);\n } else if (ends_with(rn, \".envcube.tiff\")) {\n dr = new GfxEnvCubeDiskResource(rn);\n } else if (ends_with(rn, \".lut.png\")) {\n dr = new GfxColourGradeLUTDiskResource(rn);\n } else if (ends_with(rn, \".lut.tiff\")) {\n dr = new GfxColourGradeLUTDiskResource(rn);\n } else {\n for (unsigned i=0 ; i<num_texture_formats ; ++i) {\n if (suffix == texture_formats[i]) {\n dr = new GfxTextureDiskResource(rn);\n break;\n }\n }\n }\n if (dr == NULL) {\n std::stringstream ss;\n for (unsigned i=0 ; i<num_texture_formats ; ++i) {\n if (i>0) ss << \", \";\n ss << texture_formats[i];\n }\n GRIT_EXCEPT(\"Ignoring resource \\\"\" + rn + \"\\\" as \"\n \"its file extension was not recognised. Recognised extensions: \" + ss.str());\n }\n disk_resource_map[rn] = dr;\n return dr;\n}\n\nvoid DiskResource::callReloadWatchers (void) const\n{\n typedef ReloadWatcherSet::iterator I;\n for (I i=reloadWatchers.begin(), i_=reloadWatchers.end() ; i != i_ ; ++i) {\n (*i)->notifyReloaded(this);\n }\n}\n\n\nvoid DiskResource::reload (void)\n{\n APP_ASSERT(loaded);\n reloadImpl();\n callReloadWatchers();\n}\n\nvoid DiskResource::load (void)\n{\n APP_ASSERT(!loaded);\n\n loadImpl();\n\n if (disk_resource_verbose_loads)\n CVERB << \"LOAD \" << getName() << std::endl;\n loaded = true;\n\n callReloadWatchers();\n}\n\nvoid DiskResource::loadForeground (void)\n{\n if (disk_resource_foreground_warnings)\n CLOG << \"WARNING: Resource loaded in rendering thread: \" << getName() << std::endl;\n load();\n}\n\nvoid DiskResource::decrement (void)\n{\n APP_ASSERT(users > 0);\n users--;\n if (disk_resource_verbose_incs)\n CVERB << \"-- \" << getName() << \"(now \" << users << \")\" << std::endl;\n // Maybe reclaim now / later\n if (users == 0) {\n bgl->finishedWith(this);\n }\n}\n\nvoid DiskResource::unload (void)\n{\n APP_ASSERT(loaded);\n APP_ASSERT(noUsers());\n\n if (disk_resource_verbose_loads)\n CVERB << \"FREE \" << getName() << std::endl;\n for (unsigned i=0 ; i<dependencies.size() ; ++i) {\n dependencies[i]->decrement();\n }\n dependencies.clear();\n unloadImpl();\n loaded = false;\n}\n\ndouble host_ram_available (void)\n{\n return core_option(CORE_RAM);\n}\n\ndouble host_ram_used (void)\n{\n // TODO: Implement this by requiring each DiskReosurce to specify its in-memory size.\n return 0;\n}\n" }, { "alpha_fraction": 0.6271640658378601, "alphanum_fraction": 0.6365131139755249, "avg_line_length": 34.63483428955078, "blob_id": "3818b63bbf48125541ec65564d5105dd9ae4162b", "content_id": "2dee194f93e82576f93a4643627365a8c98b9a6c", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 65675, "license_type": "permissive", "max_line_length": 172, "num_lines": 1843, "path": "/engine/physics/physics_world.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <BulletCollision/CollisionShapes/btTriangleShape.h>\n#include <BulletCollision/CollisionDispatch/btInternalEdgeUtility.h>\n\n#include \"../grit_object.h\"\n#include \"../main.h\"\n#include <centralised_log.h>\n#include \"../option.h\"\n#include \"../grit_lua_util.h\"\n\n#include \"physics_world.h\"\n#include \"lua_wrappers_physics.h\"\n\nstatic btDefaultCollisionConfiguration *col_conf;\nstatic btCollisionDispatcher *col_disp;\n\nstatic btBroadphaseInterface *broadphase;\n\nstatic btConstraintSolver *con_solver;\n\nstatic DynamicsWorld *world;\n\nstatic btVector3 gravity; // cached in here in vector form\n\n// {{{ get access to some protected members in btDiscreteDynamicsWorld\n\nclass DynamicsWorld : public btDiscreteDynamicsWorld {\n public:\n DynamicsWorld (btCollisionDispatcher *colDisp,\n btBroadphaseInterface *broadphase,\n btConstraintSolver *conSolver,\n btCollisionConfiguration *colConf)\n : btDiscreteDynamicsWorld(colDisp,broadphase,conSolver,colConf)\n { }\n\n // used to be protected\n void saveKinematicState (float step_size)\n { saveKinematicState(step_size); }\n\n // used to be protected\n void internalStepSimulation (float step_size)\n { internalSingleStepSimulation(step_size); }\n\n};\n\n// }}}\n\n\n// {{{ PHYSICS OPTION\n\nstatic PhysicsBoolOption option_keys_bool[] = {\n PHYSICS_AUTOUPDATE,\n\n PHYSICS_GIMPACT_ONE_WAY_MESH_HACK,\n PHYSICS_BUMPY_TRIANGLE_MESH_HACK,\n PHYSICS_USE_TRIANGLE_EDGE_INFO,\n PHYSICS_VERBOSE_CONTACTS,\n PHYSICS_VERBOSE_CASTS,\n PHYSICS_ERROR_CONTACTS,\n PHYSICS_ERROR_CASTS,\n PHYSICS_SOLVER_SPLIT_IMPULSE,\n PHYSICS_SOLVER_RANDOMISE_ORDER,\n PHYSICS_SOLVER_FRICTION_SEPARATE,\n PHYSICS_SOLVER_USE_WARM_STARTING,\n PHYSICS_SOLVER_CACHE_FRIENDLY,\n\n PHYSICS_DEBUG_WIREFRAME,\n PHYSICS_DEBUG_AABB,\n PHYSICS_DEBUG_FEATURES_TEXT,\n PHYSICS_DEBUG_CONTACT_POINTS,\n PHYSICS_DEBUG_CONSTRAINTS,\n PHYSICS_DEBUG_CONSTRAINTS_LIMITS,\n\n PHYSICS_DEBUG_NO_DEACTIVATION,\n PHYSICS_DEBUG_NO_HELP_TEXT,\n PHYSICS_DEBUG_DRAW_TEXT,\n PHYSICS_DEBUG_PROFILE_TIMINGS,\n PHYSICS_DEBUG_ENABLE_SAT_COMPARISON,\n PHYSICS_DEBUG_DISABLE_BULLET_LCP,\n PHYSICS_DEBUG_ENABLE_CCD,\n PHYSICS_DEBUG_FAST_WIREFRAME\n};\n\nstatic PhysicsIntOption option_keys_int[] = {\n PHYSICS_SOLVER_ITERATIONS\n};\n\nstatic PhysicsFloatOption option_keys_float[] = {\n PHYSICS_GRAVITY_X,\n PHYSICS_GRAVITY_Y,\n PHYSICS_GRAVITY_Z,\n PHYSICS_STEP_SIZE,\n PHYSICS_CONTACT_BREAKING_THRESHOLD,\n PHYSICS_DEACTIVATION_TIME,\n PHYSICS_SOLVER_DAMPING,\n PHYSICS_SOLVER_ERP,\n PHYSICS_SOLVER_ERP2,\n PHYSICS_SOLVER_SPLIT_IMPULSE_THRESHOLD,\n PHYSICS_SOLVER_LINEAR_SLOP,\n PHYSICS_SOLVER_WARM_STARTING_FACTOR\n};\n\nstatic std::map<PhysicsBoolOption,bool> options_bool;\nstatic std::map<PhysicsIntOption,int> options_int;\nstatic std::map<PhysicsFloatOption,float> options_float;\nstatic std::map<PhysicsBoolOption,bool> new_options_bool;\nstatic std::map<PhysicsIntOption,int> new_options_int;\nstatic std::map<PhysicsFloatOption,float> new_options_float;\n\nstatic std::map<PhysicsBoolOption,ValidOption<bool>*> valid_option_bool;\nstatic std::map<PhysicsIntOption,ValidOption<int>*> valid_option_int;\nstatic std::map<PhysicsFloatOption,ValidOption<float>*> valid_option_float;\n\nstatic void valid_option (PhysicsBoolOption o, ValidOption<bool> *v) { valid_option_bool[o] = v; }\nstatic void valid_option (PhysicsIntOption o, ValidOption<int> *v) { valid_option_int[o] = v; }\nstatic void valid_option (PhysicsFloatOption o, ValidOption<float> *v) { valid_option_float[o] = v; }\n\nstatic bool truefalse_[] = { false, true };\nstatic ValidOptionList<bool,bool[2]> *truefalse = new ValidOptionList<bool,bool[2]>(truefalse_);\n\nstd::string physics_option_to_string (PhysicsBoolOption o)\n{\n switch (o) {\n case PHYSICS_AUTOUPDATE: return \"GIMPACT_AUTOUPDATE\";\n case PHYSICS_GIMPACT_ONE_WAY_MESH_HACK: return \"GIMPACT_ONE_WAY_MESH_HACK\";\n case PHYSICS_BUMPY_TRIANGLE_MESH_HACK: return \"BUMPY_TRIANGLE_MESH_HACK\";\n case PHYSICS_USE_TRIANGLE_EDGE_INFO: return \"USE_TRIANGLE_EDGE_INFO\";\n case PHYSICS_VERBOSE_CONTACTS: return \"VERBOSE_CONTACTS\";\n case PHYSICS_VERBOSE_CASTS: return \"VERBOSE_CASTS\";\n case PHYSICS_ERROR_CONTACTS: return \"ERROR_CONTACTS\";\n case PHYSICS_ERROR_CASTS: return \"ERROR_CASTS\";\n case PHYSICS_SOLVER_SPLIT_IMPULSE: return \"SOLVER_SPLIT_IMPULSE\";\n case PHYSICS_SOLVER_RANDOMISE_ORDER: return \"SOLVER_RANDOMISE_ORDER\";\n case PHYSICS_SOLVER_FRICTION_SEPARATE: return \"SOLVER_FRICTION_SEPARATE\";\n case PHYSICS_SOLVER_USE_WARM_STARTING: return \"SOLVER_USE_WARM_STARTING\";\n case PHYSICS_SOLVER_CACHE_FRIENDLY: return \"SOLVER_CACHE_FRIENDLY\";\n case PHYSICS_DEBUG_WIREFRAME: return \"DEBUG_WIREFRAME\";\n case PHYSICS_DEBUG_AABB: return \"DEBUG_AABB\";\n case PHYSICS_DEBUG_FEATURES_TEXT: return \"DEBUG_FEATURES_TEXT\";\n case PHYSICS_DEBUG_CONTACT_POINTS: return \"DEBUG_CONTACT_POINTS\";\n case PHYSICS_DEBUG_CONSTRAINTS: return \"DEBUG_CONSTRAINTS\";\n case PHYSICS_DEBUG_CONSTRAINTS_LIMITS: return \"DEBUG_CONSTRAINTS_LIMITS\";\n case PHYSICS_DEBUG_NO_DEACTIVATION: return \"DEBUG_NO_DEACTIVATION\";\n case PHYSICS_DEBUG_NO_HELP_TEXT: return \"DEBUG_NO_HELP_TEXT\";\n case PHYSICS_DEBUG_DRAW_TEXT: return \"DEBUG_DRAW_TEXT\";\n case PHYSICS_DEBUG_PROFILE_TIMINGS: return \"DEBUG_PROFILE_TIMINGS\";\n case PHYSICS_DEBUG_ENABLE_SAT_COMPARISON: return \"DEBUG_ENABLE_SAT_COMPARISON\";\n case PHYSICS_DEBUG_DISABLE_BULLET_LCP: return \"DEBUG_DISABLE_BULLET_LCP\";\n case PHYSICS_DEBUG_ENABLE_CCD: return \"DEBUG_ENABLE_CCD\";\n case PHYSICS_DEBUG_FAST_WIREFRAME: return \"DEBUG_FAST_WIREFRAME\";\n }\n return \"UNKNOWN_BOOL_OPTION\";\n}\nstd::string physics_option_to_string (PhysicsIntOption o)\n{\n switch (o) {\n case PHYSICS_SOLVER_ITERATIONS: return \"SOLVER_ITERATIONS\";\n }\n return \"UNKNOWN_INT_OPTION\";\n}\nstd::string physics_option_to_string (PhysicsFloatOption o)\n{\n switch (o) {\n case PHYSICS_GRAVITY_X: return \"GRAVITY_X\";\n case PHYSICS_GRAVITY_Y: return \"GRAVITY_Y\";\n case PHYSICS_GRAVITY_Z: return \"GRAVITY_Z\";\n case PHYSICS_STEP_SIZE: return \"STEP_SIZE\";\n case PHYSICS_CONTACT_BREAKING_THRESHOLD: return \"CONTACT_BREAKING_THRESHOLD\";\n case PHYSICS_DEACTIVATION_TIME: return \"DEACTIVATION_TIME\";\n case PHYSICS_SOLVER_DAMPING: return \"SOLVER_DAMPING\";\n case PHYSICS_SOLVER_ERP: return \"SOLVER_ERP\";\n case PHYSICS_SOLVER_ERP2: return \"SOLVER_ERP2\";\n case PHYSICS_SOLVER_SPLIT_IMPULSE_THRESHOLD: return \"SOLVER_SPLIT_IMPULSE_THRESHOLD\";\n case PHYSICS_SOLVER_LINEAR_SLOP: return \"SOLVER_LINEAR_SLOP\";\n case PHYSICS_SOLVER_WARM_STARTING_FACTOR: return \"WARM_STARTING_FACTOR\";\n }\n return \"UNKNOWN_FLOAT_OPTION\";\n}\n\n// set's t to either 0,1,2 and fills in the approriate argument\nvoid physics_option_from_string (const std::string &s,\n int &t,\n PhysicsBoolOption &o0,\n PhysicsIntOption &o1,\n PhysicsFloatOption &o2)\n{\n if (s==\"AUTOUPDATE\") { t = 0; o0 = PHYSICS_AUTOUPDATE; }\n\n else if (s==\"GIMPACT_ONE_WAY_MESH_HACK\") { t = 0 ; o0 = PHYSICS_GIMPACT_ONE_WAY_MESH_HACK; }\n else if (s==\"BUMPY_TRIANGLE_MESH_HACK\") { t = 0 ; o0 = PHYSICS_BUMPY_TRIANGLE_MESH_HACK; }\n else if (s==\"USE_TRIANGLE_EDGE_INFO\") { t = 0 ; o0 = PHYSICS_USE_TRIANGLE_EDGE_INFO; }\n else if (s==\"VERBOSE_CONTACTS\") { t = 0 ; o0 = PHYSICS_VERBOSE_CONTACTS; }\n else if (s==\"VERBOSE_CASTS\") { t = 0 ; o0 = PHYSICS_VERBOSE_CASTS; }\n else if (s==\"ERROR_CONTACTS\") { t = 0 ; o0 = PHYSICS_ERROR_CONTACTS; }\n else if (s==\"ERROR_CASTS\") { t = 0 ; o0 = PHYSICS_ERROR_CASTS; }\n else if (s==\"SOLVER_SPLIT_IMPULSE\") { t = 0 ; o0 = PHYSICS_SOLVER_SPLIT_IMPULSE; }\n else if (s==\"SOLVER_RANDOMISE_ORDER\") { t = 0 ; o0 = PHYSICS_SOLVER_RANDOMISE_ORDER; }\n else if (s==\"SOLVER_FRICTION_SEPARATE\") { t = 0 ; o0 = PHYSICS_SOLVER_FRICTION_SEPARATE; }\n else if (s==\"SOLVER_USE_WARM_STARTING\") { t = 0 ; o0 = PHYSICS_SOLVER_USE_WARM_STARTING; }\n else if (s==\"SOLVER_CACHE_FRIENDLY\") { t = 0 ; o0 = PHYSICS_SOLVER_CACHE_FRIENDLY; }\n else if (s==\"DEBUG_WIREFRAME\") { t = 0 ; o0 = PHYSICS_DEBUG_WIREFRAME; }\n else if (s==\"DEBUG_AABB\") { t = 0 ; o0 = PHYSICS_DEBUG_AABB; }\n else if (s==\"DEBUG_FEATURES_TEXT\") { t = 0 ; o0 = PHYSICS_DEBUG_FEATURES_TEXT; }\n else if (s==\"DEBUG_CONTACT_POINTS\") { t = 0 ; o0 = PHYSICS_DEBUG_CONTACT_POINTS; }\n else if (s==\"DEBUG_CONSTRAINTS\") { t = 0 ; o0 = PHYSICS_DEBUG_CONSTRAINTS; }\n else if (s==\"DEBUG_CONSTRAINTS_LIMITS\") { t = 0 ; o0 = PHYSICS_DEBUG_CONSTRAINTS_LIMITS; }\n else if (s==\"DEBUG_NO_DEACTIVATION\") { t = 0 ; o0 = PHYSICS_DEBUG_NO_DEACTIVATION; }\n else if (s==\"DEBUG_NO_HELP_TEXT\") { t = 0 ; o0 = PHYSICS_DEBUG_NO_HELP_TEXT; }\n else if (s==\"DEBUG_DRAW_TEXT\") { t = 0 ; o0 = PHYSICS_DEBUG_DRAW_TEXT; }\n else if (s==\"DEBUG_PROFILE_TIMINGS\") { t = 0 ; o0 = PHYSICS_DEBUG_PROFILE_TIMINGS; }\n else if (s==\"DEBUG_ENABLE_SAT_COMPARISON\") { t = 0 ; o0 = PHYSICS_DEBUG_ENABLE_SAT_COMPARISON; }\n else if (s==\"DEBUG_DISABLE_BULLET_LCP\") { t = 0 ; o0 = PHYSICS_DEBUG_DISABLE_BULLET_LCP; }\n else if (s==\"DEBUG_ENABLE_CCD\") { t = 0 ; o0 = PHYSICS_DEBUG_ENABLE_CCD; }\n else if (s==\"DEBUG_FAST_WIREFRAME\") { t = 0 ; o0 = PHYSICS_DEBUG_FAST_WIREFRAME; }\n\n else if (s==\"SOLVER_ITERATIONS\") { t = 1 ; o1 = PHYSICS_SOLVER_ITERATIONS; }\n\n else if (s==\"GRAVITY_X\") { t = 2 ; o2 = PHYSICS_GRAVITY_X; }\n else if (s==\"GRAVITY_Y\") { t = 2 ; o2 = PHYSICS_GRAVITY_Y; }\n else if (s==\"GRAVITY_Z\") { t = 2 ; o2 = PHYSICS_GRAVITY_Z; }\n else if (s==\"STEP_SIZE\") { t = 2 ; o2 = PHYSICS_STEP_SIZE; }\n else if (s==\"CONTACT_BREAKING_THRESHOLD\") { t = 2 ; o2 = PHYSICS_CONTACT_BREAKING_THRESHOLD; }\n else if (s==\"DEACTIVATION_TIME\") { t = 2 ; o2 = PHYSICS_DEACTIVATION_TIME; }\n else if (s==\"SOLVER_DAMPING\") { t = 2 ; o2 = PHYSICS_SOLVER_DAMPING; }\n else if (s==\"SOLVER_ERP\") { t = 2 ; o2 = PHYSICS_SOLVER_ERP; }\n else if (s==\"SOLVER_ERP2\") { t = 2 ; o2 = PHYSICS_SOLVER_ERP2; }\n else if (s==\"SOLVER_SPLIT_IMPULSE_THRESHOLD\") { t = 2 ; o2 = PHYSICS_SOLVER_SPLIT_IMPULSE_THRESHOLD; }\n else if (s==\"SOLVER_LINEAR_SLOP\") { t = 2 ; o2 = PHYSICS_SOLVER_LINEAR_SLOP; }\n else if (s==\"WARM_STARTING_FACTOR\") { t = 2 ; o2 = PHYSICS_SOLVER_WARM_STARTING_FACTOR; }\n\n else t = -1;\n}\n\n\n\n\n\nstatic void options_update (bool flush)\n{\n bool reset_gravity = flush;\n bool reset_solver_mode = flush;\n bool reset_debug_drawer = flush;\n\n for (unsigned i=0 ; i<sizeof(option_keys_bool)/sizeof(*option_keys_bool) ; ++i) {\n PhysicsBoolOption o = option_keys_bool[i];\n bool v_old = options_bool[o];\n bool v_new = new_options_bool[o];\n if (v_old == v_new) continue;\n switch (o) {\n case PHYSICS_AUTOUPDATE: break;\n\n case PHYSICS_GIMPACT_ONE_WAY_MESH_HACK:\n case PHYSICS_BUMPY_TRIANGLE_MESH_HACK:\n case PHYSICS_USE_TRIANGLE_EDGE_INFO:\n case PHYSICS_VERBOSE_CONTACTS:\n case PHYSICS_VERBOSE_CASTS:\n case PHYSICS_ERROR_CONTACTS:\n case PHYSICS_ERROR_CASTS:\n break;\n\n case PHYSICS_SOLVER_SPLIT_IMPULSE:\n world->getSolverInfo().m_splitImpulse = v_new;\n break;\n\n case PHYSICS_SOLVER_RANDOMISE_ORDER:\n case PHYSICS_SOLVER_FRICTION_SEPARATE:\n case PHYSICS_SOLVER_USE_WARM_STARTING:\n case PHYSICS_SOLVER_CACHE_FRIENDLY:\n reset_solver_mode = true;\n break;\n\n case PHYSICS_DEBUG_WIREFRAME:\n case PHYSICS_DEBUG_AABB:\n case PHYSICS_DEBUG_FEATURES_TEXT:\n case PHYSICS_DEBUG_CONTACT_POINTS:\n case PHYSICS_DEBUG_CONSTRAINTS:\n case PHYSICS_DEBUG_CONSTRAINTS_LIMITS:\n case PHYSICS_DEBUG_NO_DEACTIVATION:\n case PHYSICS_DEBUG_NO_HELP_TEXT:\n case PHYSICS_DEBUG_DRAW_TEXT:\n case PHYSICS_DEBUG_PROFILE_TIMINGS:\n case PHYSICS_DEBUG_ENABLE_SAT_COMPARISON:\n case PHYSICS_DEBUG_DISABLE_BULLET_LCP:\n case PHYSICS_DEBUG_ENABLE_CCD:\n case PHYSICS_DEBUG_FAST_WIREFRAME:\n reset_debug_drawer = true;\n break;\n }\n }\n for (unsigned i=0 ; i<sizeof(option_keys_int)/sizeof(*option_keys_int) ; ++i) {\n PhysicsIntOption o = option_keys_int[i];\n int v_old = options_int[o];\n int v_new = new_options_int[o];\n if (v_old == v_new) continue;\n switch (o) {\n case PHYSICS_SOLVER_ITERATIONS:\n world->getSolverInfo().m_numIterations = v_new;\n break;\n }\n }\n for (unsigned i=0 ; i<sizeof(option_keys_float)/sizeof(*option_keys_float) ; ++i) {\n PhysicsFloatOption o = option_keys_float[i];\n float v_old = options_float[o];\n float v_new = new_options_float[o];\n if (v_old == v_new) continue;\n switch (o) {\n case PHYSICS_STEP_SIZE:\n break;\n case PHYSICS_GRAVITY_X:\n case PHYSICS_GRAVITY_Y:\n case PHYSICS_GRAVITY_Z:\n reset_gravity = true;\n break;\n case PHYSICS_DEACTIVATION_TIME:\n gDeactivationTime = v_new;\n break;\n case PHYSICS_CONTACT_BREAKING_THRESHOLD:\n gContactBreakingThreshold = v_new;\n break;\n case PHYSICS_SOLVER_DAMPING:\n world->getSolverInfo().m_damping = v_new;\n break;\n case PHYSICS_SOLVER_ERP:\n world->getSolverInfo().m_erp = v_new;\n break;\n case PHYSICS_SOLVER_ERP2:\n world->getSolverInfo().m_erp2 = v_new;\n break;\n case PHYSICS_SOLVER_LINEAR_SLOP:\n world->getSolverInfo().m_linearSlop = v_new;\n break;\n case PHYSICS_SOLVER_WARM_STARTING_FACTOR:\n world->getSolverInfo().m_warmstartingFactor = v_new;\n break;\n case PHYSICS_SOLVER_SPLIT_IMPULSE_THRESHOLD:\n world->getSolverInfo().m_splitImpulsePenetrationThreshold = v_new;\n break;\n }\n }\n\n options_bool = new_options_bool;\n options_int = new_options_int;\n options_float = new_options_float;\n\n\n if (reset_gravity) {\n gravity = btVector3(physics_option(PHYSICS_GRAVITY_X), physics_option(PHYSICS_GRAVITY_Y), physics_option(PHYSICS_GRAVITY_Z));\n\n // the only force we apply to objects is gravity, everything else is impulses\n\n // iterate through all objects, clearing their forces\n world->clearForces();\n\n // apply the new gravity to all objects\n for (int i=0 ; i<world->getNumCollisionObjects() ; ++i) {\n btCollisionObject* victim = world->getCollisionObjectArray()[i];\n btRigidBody* victim2 = btRigidBody::upcast(victim);\n if (victim2==NULL) continue;\n victim2->applyForce(gravity / victim2->getInvMass(), btVector3(0,0,0));\n victim2->activate();\n }\n\n }\n\n if (reset_solver_mode) {\n world->getSolverInfo().m_solverMode = 0\n | (physics_option(PHYSICS_SOLVER_RANDOMISE_ORDER) ? SOLVER_RANDMIZE_ORDER : 0)\n | (physics_option(PHYSICS_SOLVER_FRICTION_SEPARATE) ? SOLVER_FRICTION_SEPARATE : 0)\n | (physics_option(PHYSICS_SOLVER_USE_WARM_STARTING) ? SOLVER_USE_WARMSTARTING : 0)\n | (physics_option(PHYSICS_SOLVER_CACHE_FRIENDLY) ? SOLVER_CACHE_FRIENDLY : 0);\n }\n \n if (reset_debug_drawer) {\n debug_drawer->setDebugMode(0\n | (physics_option(PHYSICS_DEBUG_WIREFRAME) ? BulletDebugDrawer::DBG_DrawWireframe : 0)\n | (physics_option(PHYSICS_DEBUG_AABB) ? BulletDebugDrawer::DBG_DrawAabb : 0)\n | (physics_option(PHYSICS_DEBUG_FEATURES_TEXT) ? BulletDebugDrawer::DBG_DrawFeaturesText : 0)\n | (physics_option(PHYSICS_DEBUG_CONTACT_POINTS) ? BulletDebugDrawer::DBG_DrawContactPoints : 0)\n | (physics_option(PHYSICS_DEBUG_NO_DEACTIVATION) ? BulletDebugDrawer::DBG_NoDeactivation : 0)\n | (physics_option(PHYSICS_DEBUG_NO_HELP_TEXT) ? BulletDebugDrawer::DBG_NoHelpText : 0)\n | (physics_option(PHYSICS_DEBUG_DRAW_TEXT) ? BulletDebugDrawer::DBG_DrawText : 0)\n | (physics_option(PHYSICS_DEBUG_PROFILE_TIMINGS) ? BulletDebugDrawer::DBG_ProfileTimings : 0)\n// | (physics_option(PHYSICS_DEBUG_ENABLE_SET_COMPARISON) ? BulletDebugDrawer::DBG_EnableSetComparison : 0)\n | (physics_option(PHYSICS_DEBUG_DISABLE_BULLET_LCP) ? BulletDebugDrawer::DBG_DisableBulletLCP : 0)\n | (physics_option(PHYSICS_DEBUG_ENABLE_CCD) ? BulletDebugDrawer::DBG_EnableCCD : 0)\n | (physics_option(PHYSICS_DEBUG_CONSTRAINTS) ? BulletDebugDrawer::DBG_DrawConstraints : 0)\n | (physics_option(PHYSICS_DEBUG_CONSTRAINTS_LIMITS) ? BulletDebugDrawer::DBG_DrawConstraintLimits : 0)\n | (physics_option(PHYSICS_DEBUG_FAST_WIREFRAME) ? BulletDebugDrawer::DBG_FastWireframe : 0)\n );\n }\n}\n\nvoid physics_option_reset (void)\n{\n physics_option(PHYSICS_GIMPACT_ONE_WAY_MESH_HACK, true);\n physics_option(PHYSICS_BUMPY_TRIANGLE_MESH_HACK, false);\n physics_option(PHYSICS_USE_TRIANGLE_EDGE_INFO, false);\n physics_option(PHYSICS_VERBOSE_CONTACTS, false);\n physics_option(PHYSICS_VERBOSE_CASTS, false);\n physics_option(PHYSICS_ERROR_CONTACTS, true);\n physics_option(PHYSICS_ERROR_CASTS, true);\n physics_option(PHYSICS_SOLVER_SPLIT_IMPULSE, false);\n physics_option(PHYSICS_SOLVER_RANDOMISE_ORDER, false);\n physics_option(PHYSICS_SOLVER_FRICTION_SEPARATE, false);\n physics_option(PHYSICS_SOLVER_USE_WARM_STARTING, true);\n physics_option(PHYSICS_SOLVER_CACHE_FRIENDLY, false);\n\n physics_option(PHYSICS_DEBUG_WIREFRAME, false);\n physics_option(PHYSICS_DEBUG_AABB, false);\n physics_option(PHYSICS_DEBUG_FEATURES_TEXT, false);\n physics_option(PHYSICS_DEBUG_CONTACT_POINTS, false);\n physics_option(PHYSICS_DEBUG_CONSTRAINTS, false);\n physics_option(PHYSICS_DEBUG_CONSTRAINTS_LIMITS, false);\n physics_option(PHYSICS_DEBUG_NO_DEACTIVATION, false);\n physics_option(PHYSICS_DEBUG_NO_HELP_TEXT, false);\n physics_option(PHYSICS_DEBUG_DRAW_TEXT, false);\n physics_option(PHYSICS_DEBUG_PROFILE_TIMINGS, false);\n physics_option(PHYSICS_DEBUG_ENABLE_SAT_COMPARISON, false);\n physics_option(PHYSICS_DEBUG_DISABLE_BULLET_LCP, false);\n physics_option(PHYSICS_DEBUG_ENABLE_CCD, false);\n physics_option(PHYSICS_DEBUG_FAST_WIREFRAME, false);\n\n physics_option(PHYSICS_SOLVER_ITERATIONS, 10);\n\n physics_option(PHYSICS_GRAVITY_X, 0.0f);\n physics_option(PHYSICS_GRAVITY_Y, 0.0f);\n physics_option(PHYSICS_GRAVITY_Z, -9.807f);\n physics_option(PHYSICS_STEP_SIZE, 1/200.0f);\n physics_option(PHYSICS_CONTACT_BREAKING_THRESHOLD, 0.02f);\n physics_option(PHYSICS_DEACTIVATION_TIME, 2.0f);\n physics_option(PHYSICS_SOLVER_DAMPING, 1.0f);\n physics_option(PHYSICS_SOLVER_ERP, 0.2f);\n physics_option(PHYSICS_SOLVER_ERP2, 0.1f);\n physics_option(PHYSICS_SOLVER_SPLIT_IMPULSE_THRESHOLD, -0.02f);\n physics_option(PHYSICS_SOLVER_WARM_STARTING_FACTOR, 0.85f);\n}\n\nstatic void init_options (void)\n{\n\n for (unsigned i=0 ; i < sizeof(option_keys_bool) / sizeof(*option_keys_bool) ; ++i) {\n valid_option(option_keys_bool[i], truefalse);\n\n }\n\n valid_option(PHYSICS_SOLVER_ITERATIONS, new ValidOptionRange<int>(0,1000));\n\n valid_option(PHYSICS_GRAVITY_X, new ValidOptionRange<float>(-1000, 1000));\n valid_option(PHYSICS_GRAVITY_Y, new ValidOptionRange<float>(-1000, 1000));\n valid_option(PHYSICS_GRAVITY_Z, new ValidOptionRange<float>(-1000, 1000));\n valid_option(PHYSICS_STEP_SIZE, new ValidOptionRange<float>(0.00001f,100));\n valid_option(PHYSICS_CONTACT_BREAKING_THRESHOLD, new ValidOptionRange<float>(0.00001f,100));\n valid_option(PHYSICS_DEACTIVATION_TIME, new ValidOptionRange<float>(0.00001f,1000));\n valid_option(PHYSICS_SOLVER_DAMPING, new ValidOptionRange<float>(0.00001f,1000));\n valid_option(PHYSICS_SOLVER_ERP, new ValidOptionRange<float>(0.00001f,1000));\n valid_option(PHYSICS_SOLVER_ERP2, new ValidOptionRange<float>(0.00001f,1000));\n valid_option(PHYSICS_SOLVER_SPLIT_IMPULSE_THRESHOLD, new ValidOptionRange<float>(-1000,1000));\n valid_option(PHYSICS_SOLVER_WARM_STARTING_FACTOR, new ValidOptionRange<float>(0.00001f,1000));\n\n physics_option(PHYSICS_AUTOUPDATE, false);\n physics_option_reset();\n options_update(true);\n // This will call options_update(false) but it will be a no-op this time.\n physics_option(PHYSICS_AUTOUPDATE, true);\n}\n\nvoid physics_option (PhysicsBoolOption o, bool v)\n{\n valid_option_bool[o]->maybeThrow(\"Physics\", v);\n new_options_bool[o] = v;\n if (new_options_bool[PHYSICS_AUTOUPDATE]) options_update(false);\n}\nbool physics_option (PhysicsBoolOption o)\n{\n return options_bool[o];\n}\n\nvoid physics_option (PhysicsIntOption o, int v)\n{\n valid_option_int[o]->maybeThrow(\"Physics\", v);\n new_options_int[o] = v;\n if (new_options_bool[PHYSICS_AUTOUPDATE]) options_update(false);\n}\nint physics_option (PhysicsIntOption o)\n{\n return options_int[o];\n}\n\nvoid physics_option (PhysicsFloatOption o, float v)\n{\n valid_option_float[o]->maybeThrow(\"Physics\", v);\n new_options_float[o] = v;\n if (new_options_bool[PHYSICS_AUTOUPDATE]) options_update(false);\n}\nfloat physics_option (PhysicsFloatOption o)\n{\n return options_float[o];\n}\n\n\n\n// }}}\n\n\n// {{{ conversion and nan checking utilities\n\nstatic inline btVector3 check_nan_ (const btVector3 &v, const char *file, int line)\n{\n if (std::isnan(v.x()) || std::isnan(v.y()) || std::isnan(v.z())) {\n CLog(file,line,true) << \"Vect3 NaN from Bullet.\" << std::endl;\n return btVector3(0,0,0);\n }\n return v;\n}\n\nstatic inline Vector3 check_nan_ (const Vector3 &v, const char *file, int line)\n{\n if (std::isnan(v.x) || std::isnan(v.y) || std::isnan(v.z)) {\n CLog(file,line,true) << \"Vect3 NaN from Grit.\" << std::endl;\n return Vector3(0,0,0);\n }\n return v;\n}\n\nstatic inline btQuaternion check_nan_ (const btQuaternion &v, const char *file, int line)\n{\n if (std::isnan(v.w()) || std::isnan(v.x()) || std::isnan(v.y()) || std::isnan(v.z())) {\n CLog(file,line,true) << \"Quat NaN from Bullet.\" << std::endl;\n return btQuaternion(0,0,0,1);\n }\n return v;\n}\n\nstatic inline Quaternion check_nan_ (const Quaternion &v, const char *file, int line)\n{\n if (std::isnan(v.w) || std::isnan(v.x) || std::isnan(v.y) || std::isnan(v.z)) {\n CLog(file,line,true) << \"Quat NaN from Grit.\" << std::endl;\n return Quaternion(1,0,0,0);\n }\n return v;\n}\n\nstatic inline Vector3 from_bullet (const btVector3 &from)\n{ return Vector3 (from.x(), from.y(), from.z()); }\n\nstatic inline Quaternion from_bullet (const btQuaternion &from)\n{ return Quaternion (from.w(), from.x(), from.y(), from.z()); }\n\nstatic inline btVector3 to_bullet (const Vector3 &from)\n{ return btVector3(from.x,from.y,from.z); }\n\nstatic inline btQuaternion to_bullet (const Quaternion &from)\n{ return btQuaternion(from.x, from.y, from.z, from.w); }\n\n#define check_nan(x) check_nan_(x,__FILE__,__LINE__)\n\n// }}}\n\n\n\n// {{{ Handling contacts, materials, etc\n\nbool physics_verbose_contacts = false;\n\nstatic std::ostream &operator << (std::ostream &o, const btVector3 &v)\n{\n return o << \"(\"<<v.x()<<\", \"<<v.y()<<\", \"<<v.z()<<\")\";\n}\n\nstatic std::string shape_str (int s)\n{\n switch (s) {\n case BOX_SHAPE_PROXYTYPE: return \"box\";\n case TRIANGLE_SHAPE_PROXYTYPE: return \"tri\";\n case CONVEX_HULL_SHAPE_PROXYTYPE: return \"hul\";\n case SPHERE_SHAPE_PROXYTYPE: return \"sph\";\n case CAPSULE_SHAPE_PROXYTYPE: return \"cap\";\n case CONE_SHAPE_PROXYTYPE: return \"con\";\n case CYLINDER_SHAPE_PROXYTYPE: return \"cyl\";\n case TRIANGLE_MESH_SHAPE_PROXYTYPE: return \"sta\";\n case GIMPACT_SHAPE_PROXYTYPE: return \"gim\";\n case STATIC_PLANE_PROXYTYPE: return \"pla\";\n case COMPOUND_SHAPE_PROXYTYPE: return \"com\";\n default:\n std::stringstream ss;\n ss << s;\n return ss.str();\n }\n return \"\";\n}\n\n/* bullet does not support putting a gimpact triangle mesh in a compound shape so I am hacking the parent in this case to be the triangle mesh instead of the compound shape\n*/\nstatic void fix_parent (const btCollisionShape *shape, const btCollisionShape *&parent)\n{\n APP_ASSERT(shape!=NULL);\n APP_ASSERT(parent!=NULL);\n if (shape->getShapeType()!=TRIANGLE_SHAPE_PROXYTYPE) return;\n if (parent->getShapeType()!=COMPOUND_SHAPE_PROXYTYPE) return;\n // iterate through children of compound shape searching for the gimpact shape\n\n // assume there is exactly 1 gimpact shape in the compound if the child shape\n // is a triangle\n\n const btCompoundShape *compound = static_cast<const btCompoundShape*>(parent);\n const btCollisionShape *new_parent = NULL;\n\n for (int i=0,i_=compound->getNumChildShapes() ; i<i_ ; ++i) {\n const btCollisionShape *child = compound->getChildShape(i);\n if (child->getShapeType()==GIMPACT_SHAPE_PROXYTYPE) {\n new_parent = child;\n break;\n }\n if (child->getShapeType()==TRIANGLE_MESH_SHAPE_PROXYTYPE) {\n new_parent = child;\n break;\n }\n }\n\n // this can happen with static triangle meshes in a compound\n //if (new_parent==NULL) return;\n APP_ASSERT(new_parent!=NULL);\n\n parent = new_parent;\n}\n\nstatic int get_material (const CollisionMesh *cmesh, const btCollisionShape *shape,\n int id, bool *err, bool verb)\n{\n // * when one gimpact shape hits another (not in compounds), we don't get the triangle\n // we get the whole gimpact shape for some reason\n // * when casting rays, we get the whole shape in the case of static meshes\n if (shape->getShapeType()==TRIANGLE_SHAPE_PROXYTYPE\n || shape->getShapeType()==GIMPACT_SHAPE_PROXYTYPE\n || shape->getShapeType()==TRIANGLE_MESH_SHAPE_PROXYTYPE) {\n int max = cmesh->faceMaterials.size();\n if (id < 0 || id >= max) {\n if (verb) {\n CERR << \"index from bullet was garbage: \" << id\n << \" >= \" << max\n << \" cmesh: \\\"\" << cmesh->getName() << \"\\\"\"\n << std::endl;\n if (err) *err = true;\n }\n id = 0;\n }\n return cmesh->getMaterialFromFace(id)->id;\n } else {\n int max = cmesh->partMaterials.size();\n if (id < 0 || id >= max) {\n if (verb) {\n CERR << \"index from bullet was garbage: \" << id\n << \" >= \" << max\n << \" cmesh: \\\"\" << cmesh->getName() << \"\\\"\"\n << std::endl;\n if (err) *err = true;\n }\n id = 0;\n }\n return cmesh->getMaterialFromPart(id)->id;\n }\n}\n\nstatic void get_shape_and_parent(const btCollisionObject* colObj,\n const btCollisionShape *&shape,\n const btCollisionShape *&parent)\n{\n shape = colObj->getCollisionShape();\n parent = colObj->getRootCollisionShape();\n fix_parent(shape, parent);\n APP_ASSERT(shape!=NULL);\n APP_ASSERT(parent!=NULL);\n}\n\nbool contact_added_callback (btManifoldPoint& cp,\n const btCollisionObject* colObj0, int part0, int index0,\n const btCollisionObject* colObj1, int part1, int index1)\n{\n const btRigidBody *bbody0 = dynamic_cast<const btRigidBody*>(colObj0);\n const btRigidBody *bbody1 = dynamic_cast<const btRigidBody*>(colObj1);\n APP_ASSERT(bbody0!=NULL);\n APP_ASSERT(bbody1!=NULL);\n\n const RigidBody *body0 = static_cast<const RigidBody*>(bbody0->getMotionState());\n const RigidBody *body1 = static_cast<const RigidBody*>(bbody1->getMotionState());\n APP_ASSERT(body0!=NULL);\n APP_ASSERT(body1!=NULL);\n\n const CollisionMesh *cmesh0 = body0->colMesh, *cmesh1 = body1->colMesh;\n\n const btCollisionShape *shape0, *parent0, *shape1, *parent1;\n\n get_shape_and_parent(colObj0, shape0, parent0);\n get_shape_and_parent(colObj1, shape1, parent1);\n\n bool err = false;\n bool verb = physics_option(PHYSICS_ERROR_CONTACTS);\n bool verb_contacts = physics_option(PHYSICS_VERBOSE_CONTACTS);\n\n int mat0 = get_material(cmesh0, shape0, index0, &err, verb);\n int mat1 = get_material(cmesh1, shape1, index1, &err, verb);\n\n // FIXME: HACK! store materials in the part ids, I do not need the part ids and I think\n // Bullet does not either so this should be OK.\n cp.m_partId0 = mat0;\n cp.m_partId1 = mat1;\n\n phys_mats.getFrictionRestitution(mat0, mat1, cp.m_combinedFriction, cp.m_combinedRestitution);\n\n if (err || verb_contacts) {\n CLOG << mat0 << \"[\" << shape_str(shape0->getShapeType()) << \"]\"\n << \"(\" << shape_str(parent0->getShapeType()) << \")\"\n << \" \" << part0 << \" \" << index0\n << \" AGAINST \" << mat1 << \"[\" << shape_str(shape1->getShapeType()) << \"]\"\n << \"(\" << shape_str(parent1->getShapeType()) << \")\"\n << \" \" << part1 << \" \" << index1 << std::endl;\n CLOG << cp.m_lifeTime << \" \" << cp.m_positionWorldOnA\n << \" \" << cp.m_positionWorldOnB\n << \" \" << cp.m_normalWorldOnB << \" \" << cp.m_distance1\n << \" *\" << cp.m_appliedImpulse << \"* |\" << cp.m_combinedFriction\n << \"| >\" << cp.m_combinedRestitution << \"<\" << std::endl;\n /*\n bool m_lateralFrictionInitialized\n btScalar m_appliedImpulseLateral1\n btScalar m_appliedImpulseLateral2\n btVector3 m_lateralFrictionDir1\n btVector3 m_lateralFrictionDir2\n */\n }\n \n if (parent0->getShapeType() == TRIANGLE_MESH_SHAPE_PROXYTYPE ||\n parent1->getShapeType() == TRIANGLE_MESH_SHAPE_PROXYTYPE) {\n\n const btRigidBody *sta_body;\n const btRigidBody *dyn_body;\n\n if (parent0->getShapeType() == TRIANGLE_MESH_SHAPE_PROXYTYPE) {\n sta_body = bbody0;\n dyn_body = bbody1;\n } else {\n dyn_body = bbody0;\n sta_body = bbody1;\n }\n\n\n if (physics_option(PHYSICS_USE_TRIANGLE_EDGE_INFO)) {\n btAdjustInternalEdgeContacts(cp,sta_body, dyn_body, part1,index1);\n if (verb_contacts) {\n CLOG << cp.m_lifeTime << \" \" << cp.m_positionWorldOnA\n << \" \" << cp.m_positionWorldOnB\n << \" \" << cp.m_normalWorldOnB << \" \" << cp.m_distance1\n << \" *\" << cp.m_appliedImpulse << \"* |\" << cp.m_combinedFriction\n << \"| >\" << cp.m_combinedRestitution << \"< (CORRECTION)\" << std::endl;\n /*\n bool m_lateralFrictionInitialized\n btScalar m_appliedImpulseLateral1\n btScalar m_appliedImpulseLateral2\n btVector3 m_lateralFrictionDir1\n btVector3 m_lateralFrictionDir2\n */\n }\n }\n\n if (physics_option(PHYSICS_BUMPY_TRIANGLE_MESH_HACK)) {\n const btTriangleShape *tshape =\n static_cast<const btTriangleShape*>(sta_body->getCollisionShape());\n\n btVector3 normal;\n tshape->calcNormal(normal);\n\n normal = sta_body->getWorldTransform().getBasis() * normal;\n\n btScalar dot = normal.dot(cp.m_normalWorldOnB);\n\n btScalar magnitude = cp.m_normalWorldOnB.length();\n normal *= dot > 0 ? magnitude : -magnitude;\n\n cp.m_normalWorldOnB = normal;\n\n // Reproject collision point along normal.\n cp.m_positionWorldOnB =\n cp.m_positionWorldOnA - cp.m_normalWorldOnB * cp.m_distance1;\n cp.m_localPointB =\n sta_body->getWorldTransform().invXform(cp.m_positionWorldOnB);\n }\n\n }\n\n if (parent0->getShapeType() == GIMPACT_SHAPE_PROXYTYPE ||\n parent1->getShapeType() == GIMPACT_SHAPE_PROXYTYPE) {\n\n const btRigidBody *gim_body;\n\n if (parent0->getShapeType() == GIMPACT_SHAPE_PROXYTYPE) {\n gim_body = bbody0;\n } else {\n gim_body = bbody1;\n }\n\n if (physics_option(PHYSICS_GIMPACT_ONE_WAY_MESH_HACK)) {\n const btTriangleShape *tshape =\n static_cast<const btTriangleShape*>(gim_body->getCollisionShape());\n\n btVector3 normal;\n tshape->calcNormal(normal);\n\n normal = gim_body->getWorldTransform().getBasis() * normal;\n\n btScalar dot = normal.dot(cp.m_normalWorldOnB) * (gim_body == bbody0 ? 1 : -1);\n\n if (dot > 0) {\n cp.m_normalWorldOnB -= 2 * dot * normal;\n }\n }\n }\n\n return true;\n}\n\nextern ContactAddedCallback gContactAddedCallback;\n\n// }}}\n\n\n// C++ requires this to not be a local class\nnamespace {\n struct Info {\n RigidBody *body, *other;\n float life, imp, dist;\n unsigned mat, matOther;\n Vector3 pos, posOther, norm;\n };\n}\n\nvoid physics_update (lua_State *L)\n{\n float step_size = physics_option(PHYSICS_STEP_SIZE);\n world->internalStepSimulation(step_size);\n\n // NAN CHECKS\n // check whether NaN has crept in anywhere\n std::vector<RigidBody*> nan_bodies;\n for (int i=0 ; i<world->getNumCollisionObjects() ; ++i) {\n\n btCollisionObject* victim = world->getCollisionObjectArray()[i];\n btRigidBody* victim2 = btRigidBody::upcast(victim);\n if (victim2==NULL) continue;\n RigidBody *rb = static_cast<RigidBody*>(victim2->getMotionState());\n\n const btTransform &current_xform = victim2->getWorldTransform();\n const btVector3 &pos = current_xform.getOrigin();\n btQuaternion quat;\n current_xform.getBasis().getRotation(quat);\n float x=pos.x(), y=pos.y(), z=pos.z();\n float qw=quat.w(), qx=quat.x(), qy=quat.y(), qz=quat.z();\n if (std::isnan(x) || std::isnan(y) || std::isnan(z) ||\n std::isnan(qw) || std::isnan(qx) || std::isnan(qy) || std::isnan(qz)) {\n CERR << \"NaN from physics engine position update.\" << std::endl;\n nan_bodies.push_back(rb);\n }\n }\n // chuck them out if they have misbehaved\n for (unsigned int i=0 ; i<nan_bodies.size() ; ++i) {\n nan_bodies[i]->destroy(L);\n }\n\n // COLLISION CALLBACKS\n std::vector<Info> infos;\n // first, check for collisions\n unsigned num_manifolds = world->getDispatcher()->getNumManifolds();\n for (unsigned i=0 ; i<num_manifolds; ++i) {\n btPersistentManifold* manifold =\n world->getDispatcher()->getManifoldByIndexInternal(i);\n btCollisionObject\n *ob_a = static_cast<btCollisionObject*>(manifold->getBody0()),\n *ob_b = static_cast<btCollisionObject*>(manifold->getBody1());\n APP_ASSERT(ob_a != NULL);\n APP_ASSERT(ob_b != NULL);\n\n btRigidBody* brb_a = btRigidBody::upcast(ob_a);\n btRigidBody* brb_b = btRigidBody::upcast(ob_b);\n\n APP_ASSERT(brb_a);\n APP_ASSERT(brb_b);\n\n RigidBody *rb_a = static_cast<RigidBody*>(brb_a->getMotionState());\n RigidBody *rb_b = static_cast<RigidBody*>(brb_b->getMotionState());\n\n // each manifold has a number of points (usually 3?) that provide\n // a stable foundation\n unsigned num_contacts = manifold->getNumContacts();\n for (unsigned j=0 ; j<num_contacts ; ++j) {\n btManifoldPoint &p = manifold->getContactPoint(j);\n unsigned mat0 = p.m_partId0;\n unsigned mat1 = p.m_partId1;\n Info infoA = {\n rb_a, rb_b, \n (float)p.getLifeTime(), p.getAppliedImpulse(), p.getDistance(),\n mat0, mat1, from_bullet(p.m_positionWorldOnA),\n from_bullet(p.m_positionWorldOnB), -from_bullet(p.m_normalWorldOnB)\n };\n infos.push_back(infoA);\n Info infoB = {\n rb_b, rb_a, \n (float)p.getLifeTime(), p.getAppliedImpulse(), p.getDistance(),\n mat1, mat0, from_bullet(p.m_positionWorldOnB),\n from_bullet(p.m_positionWorldOnA), from_bullet(p.m_normalWorldOnB)\n };\n infos.push_back(infoB);\n }\n }\n for (unsigned i=0 ; i<infos.size(); ++i) {\n Info &info = infos[i];\n if (info.body->destroyed()) continue;\n info.body->collisionCallback(L, info.life, info.imp, info.other,\n info.mat, info.matOther,\n info.dist, info.pos, info.posOther, info.norm);\n }\n\n // STEP CALLBACKS\n for (int i=0 ; i<world->getNumCollisionObjects() ; ++i) {\n btCollisionObject* victim = world->getCollisionObjectArray()[i];\n btRigidBody* victim2 = btRigidBody::upcast(victim);\n if (victim2==NULL) continue;\n RigidBody *rb = static_cast<RigidBody*>(victim2->getMotionState());\n rb->stepCallback(L, step_size);\n }\n\n // STABILISE CALLBACKS\n for (int i=0 ; i<world->getNumCollisionObjects() ; ++i) {\n\n btCollisionObject* victim = world->getCollisionObjectArray()[i];\n btRigidBody* victim2 = btRigidBody::upcast(victim);\n if (victim2==NULL) continue;\n RigidBody *rb = static_cast<RigidBody*>(victim2->getMotionState());\n rb->stabiliseCallback(L, step_size);\n }\n}\n\nvoid physics_update_graphics (lua_State *L, float extrapolate)\n{\n // to handle errors raised by the lua callback\n push_cfunction(L, my_lua_error_handler);\n\n // call all the graphic update callbacks\n for (int i=0 ; i<world->getNumCollisionObjects() ; ++i) {\n btCollisionObject* victim = world->getCollisionObjectArray()[i];\n btRigidBody* victim2 = btRigidBody::upcast(victim);\n if (victim2==NULL) continue;\n RigidBody *rb = static_cast<RigidBody*>(victim2->getMotionState());\n rb->updateGraphicsCallback(L, extrapolate);\n }\n\n lua_pop(L,1); // error handler\n}\n\nclass BulletRayCallback : public btCollisionWorld::RayResultCallback {\n public:\n BulletRayCallback (SweepCallback &scb_) : scb(scb_) { }\n virtual btScalar addSingleResult (btCollisionWorld::LocalRayResult&r, bool)\n {\n btRigidBody *body = btRigidBody::upcast(r.m_collisionObject);\n if (body == NULL) return r.m_hitFraction;\n RigidBody *rb= dynamic_cast<RigidBody*>(body->getMotionState());\n if (rb == NULL) return r.m_hitFraction;\n APP_ASSERT(r.m_localShapeInfo!=NULL);\n int part, index;\n bool err = false;\n if (r.m_localShapeInfo) {\n part = r.m_localShapeInfo->m_shapePart;\n index = r.m_localShapeInfo->m_triangleIndex;\n } else {\n err = true;\n part = 0;\n index = 0;\n }\n\n const btCollisionShape *shape, *parent;\n get_shape_and_parent(body, shape, parent);\n\n bool verb = physics_option(PHYSICS_ERROR_CASTS);\n int m = get_material(rb->colMesh, shape, index, &err, verb);\n\n if (err || physics_option(PHYSICS_VERBOSE_CASTS)) {\n CLOG << \"RAY HIT \" << m << \"[\" << shape_str(shape->getShapeType()) << \"]\"\n << \"(\" << shape_str(parent->getShapeType()) << \")\"\n << \" \" << part << \" \" << index << std::endl;\n CLOG << r.m_hitFraction << \" \" << r.m_hitNormalLocal << std::endl;\n }\n\n\n scb.result(*rb, r.m_hitFraction, from_bullet(r.m_hitNormalLocal), m);\n return r.m_hitFraction;\n }\n protected:\n SweepCallback &scb;\n};\n\nclass BulletSweepCallback : public btCollisionWorld::ConvexResultCallback {\n public:\n BulletSweepCallback (SweepCallback &scb_) : scb(scb_) { }\n virtual btScalar addSingleResult (btCollisionWorld::LocalConvexResult&r, bool)\n {\n btRigidBody *body = btRigidBody::upcast(r.m_hitCollisionObject);\n if (body == NULL) return r.m_hitFraction;\n RigidBody *rb= dynamic_cast<RigidBody*>(body->getMotionState());\n if (rb == NULL) return r.m_hitFraction;\n APP_ASSERT(r.m_localShapeInfo!=NULL);\n int part, index;\n bool err = false;\n if (r.m_localShapeInfo) {\n part = r.m_localShapeInfo->m_shapePart;\n index = r.m_localShapeInfo->m_triangleIndex;\n } else {\n part = 0;\n index = 0;\n err = true;\n }\n\n const btCollisionShape *shape, *parent;\n get_shape_and_parent(body, shape, parent);\n\n bool verb = physics_option(PHYSICS_ERROR_CASTS);\n int m = get_material(rb->colMesh, shape, index, &err, verb);\n\n if (err || physics_option(PHYSICS_VERBOSE_CASTS)) {\n CLOG << \"SWEEP HIT \" << m << \"[\" << shape_str(shape->getShapeType()) << \"]\"\n << \"(\" << shape_str(parent->getShapeType()) << \")\"\n << \" \" << part << \" \" << index << std::endl;\n CLOG << r.m_hitFraction << \" \" << r.m_hitNormalLocal << std::endl;\n }\n scb.result(*rb, r.m_hitFraction, from_bullet(r.m_hitNormalLocal), m);\n return r.m_hitFraction;\n }\n protected:\n SweepCallback &scb;\n};\n\nvoid physics_ray (const Vector3 &start,\n const Vector3 &end,\n SweepCallback &scb)\n{\n BulletRayCallback brcb(scb);\n world->rayTest(to_bullet(start),to_bullet(end),brcb);\n}\n\nvoid physics_sweep_sphere (const Vector3 &start, const Vector3 &end,\n SweepCallback &scb, float radius)\n{\n BulletSweepCallback bscb(scb);\n btSphereShape tmpShape(radius);\n btTransform from(btQuaternion(0,0,0,1),to_bullet(start));\n btTransform to(btQuaternion(0,0,0,1),to_bullet(end));\n world->convexSweepTest(&tmpShape,from,to,bscb);\n}\n\nvoid physics_sweep_box (const Vector3 &start, const Quaternion &startq,\n const Vector3 &end,\n SweepCallback &scb, const Vector3 &size)\n{\n BulletSweepCallback bscb(scb);\n btBoxShape tmpShape(to_bullet(size/2));\n btTransform from(to_bullet(startq),to_bullet(start));\n btTransform to(to_bullet(startq),to_bullet(end));\n world->convexSweepTest(&tmpShape,from,to,bscb);\n}\n\nvoid physics_sweep_cylinder (const Vector3 &start, const Quaternion &startq,\n const Vector3 &end,\n SweepCallback &scb, float radius, float height)\n{\n BulletSweepCallback bscb(scb);\n btCylinderShapeZ tmpShape(btVector3(radius, radius, height/2));\n btTransform from(to_bullet(startq),to_bullet(start));\n btTransform to(to_bullet(startq),to_bullet(end));\n world->convexSweepTest(&tmpShape,from,to,bscb);\n}\n\n// Currently only supports a single hull.\nvoid physics_sweep_col_mesh (const Vector3 &startp, const Quaternion &startq,\n const Vector3 &endp, const Quaternion &endq,\n SweepCallback &scb, const CollisionMesh *col_mesh)\n{\n BulletSweepCallback bscb(scb);\n btTransform start(to_bullet(startq),to_bullet(startp));\n btTransform end(to_bullet(endq),to_bullet(endp));\n btCompoundShape *compound = col_mesh->getMasterShape();\n if (compound->getNumChildShapes() != 1)\n EXCEPT << \"Can only sweep collision meshes comprised of a single convex hull.\" << std::endl;\n btConvexHullShape *conv = dynamic_cast<btConvexHullShape*>(compound->getChildShape(0));\n if (conv == nullptr)\n EXCEPT << \"Can only sweep collision meshes comprised of a single convex hull.\" << std::endl;\n world->convexSweepTest(conv, start, end, bscb);\n}\n\nclass BulletTestCallback : public btCollisionWorld::ContactResultCallback {\n \n public:\n \n /*! You may also want to set m_collisionFilterGroup and m_collisionFilterMask\n * (supplied by the superclass) for needsCollision() */\n BulletTestCallback (btCollisionObject& obj_,\n TestCallback &tcb_,\n bool dyn_only)\n : obj(obj_), tcb(tcb_), dynOnly(dyn_only) { }\n \n virtual btScalar addSingleResult (btManifoldPoint& cp,\n const btCollisionObject* colObj0,int,int index0,\n const btCollisionObject* colObj1,int,int index1)\n {\n const btCollisionObject *colObj;\n Vector3 pos, wpos, norm;\n int index;\n if(colObj1==&obj) {\n colObj = colObj0;\n pos = from_bullet(cp.m_localPointA);\n wpos = from_bullet(cp.m_positionWorldOnA);\n norm = -from_bullet(cp.m_normalWorldOnB);\n index = index0;\n } else {\n colObj = colObj1;\n pos = from_bullet(cp.m_localPointB);\n wpos = from_bullet(cp.m_positionWorldOnB);\n norm = from_bullet(cp.m_normalWorldOnB);\n index = index1;\n }\n\n const btRigidBody *bbody = dynamic_cast<const btRigidBody*>(colObj);\n APP_ASSERT(bbody!=NULL);\n\n RigidBody *body = const_cast<RigidBody*>(static_cast<const RigidBody*>(\n bbody->getMotionState()));\n APP_ASSERT(body!=NULL);\n\n if (body->getMass()==0 && dynOnly) return 0;\n\n CollisionMesh *cmesh = body->colMesh;\n\n const btCollisionShape *shape, *parent;\n\n get_shape_and_parent(colObj, shape, parent);\n\n bool err = false;\n bool verb = physics_option(PHYSICS_ERROR_CONTACTS);\n\n int mat = get_material(cmesh, shape, index, &err, verb);\n\n tcb.result(body, pos, wpos, norm, -cp.getDistance(), mat);\n\n return 0;\n }\n\n public:\n btCollisionObject &obj;\n TestCallback &tcb;\n bool dynOnly;\n};\n\nvoid physics_test (const CollisionMesh *col_mesh, const Vector3 &pos, const Quaternion &quat,\n bool dyn_only, TestCallback &cb_)\n{\n btCollisionObject encroacher;\n encroacher.setCollisionShape(col_mesh->getMasterShape());\n encroacher.setWorldTransform(btTransform(to_bullet(quat), to_bullet(pos)));\n \n BulletTestCallback cb(encroacher,cb_,dyn_only);\n world->contactTest(&encroacher,cb);\n}\n\n\nvoid physics_test_sphere (float rad, const Vector3 &pos, bool dyn_only, TestCallback &cb_)\n{\n btCollisionObject encroacher;\n btSphereShape sphere(rad);\n encroacher.setCollisionShape(&sphere);\n encroacher.setWorldTransform(btTransform(btQuaternion(0,0,0,1), to_bullet(pos)));\n \n BulletTestCallback cb(encroacher,cb_,dyn_only);\n world->contactTest(&encroacher,cb);\n}\n\n\n\nvoid physics_draw (void)\n{\n world->debugDrawWorld();\n}\n\n\n\n\n// {{{ RigidBody\n\nRigidBody::RigidBody (const std::string &col_mesh,\n const Vector3 &pos,\n const Quaternion &quat)\n : lastXform(to_bullet(quat),to_bullet(pos)), refCount(0)\n{\n DiskResource *dr = disk_resource_get_or_make(col_mesh);\n colMesh = dynamic_cast<CollisionMesh*>(dr);\n if (colMesh==NULL) GRIT_EXCEPT(\"Not a collision mesh: \\\"\"+col_mesh+\"\\\"\");\n if (!colMesh->isLoaded()) GRIT_EXCEPT(\"Not loaded: \\\"\"+col_mesh+\"\\\"\");\n\n colMesh->registerReloadWatcher(this);\n body = NULL;\n addToWorld();\n}\n\n\nstatic btCompoundShape *clone_compound (btCompoundShape *master)\n{\n btCompoundShape *slave = new btCompoundShape();\n for (int i=0 ; i<master->getNumChildShapes() ; ++i) {\n btCollisionShape *s = master->getChildShape(i);\n btTransform &t = master->getChildTransform(i);\n slave->addChildShape(t,s);\n }\n return slave;\n}\n\n/* The intention is that the object is always in the world. The exceptions are when it is created,\n * after it has been destroyed, and in the brief moments when it is pulled out and put back in again\n * in response to a CollisionMesh reload. */\n\n// Another exception: When it has been polluted by a NaN and must be pulled out\n\nvoid RigidBody::addToWorld (void)\n{\n shape = clone_compound(colMesh->getMasterShape());\n localChanges.resize(shape->getNumChildShapes());\n // by default, turn everything on, leave it transformed as found in the master copy\n for (int i=0 ; i<localChanges.size() ; ++i) {\n localChanges[i].enabled = true;\n localChanges[i].offset.setIdentity();\n }\n\n btRigidBody::btRigidBodyConstructionInfo\n info(colMesh->getMass(), this, shape, to_bullet(colMesh->getInertia()));\n\n mass = colMesh->getMass();\n ghost = false;\n\n info.m_linearDamping = colMesh->getLinearDamping();\n info.m_angularDamping = colMesh->getAngularDamping();\n info.m_friction = 0;\n info.m_restitution = 0;\n info.m_linearSleepingThreshold = colMesh->getLinearSleepThreshold();\n info.m_angularSleepingThreshold = colMesh->getAngularSleepThreshold();\n\n APP_ASSERT(body==NULL);\n body = new btRigidBody(info);\n\n world->addRigidBody(body);\n\n // Only do CCD if speed of body exceeeds this\n body->setCcdMotionThreshold(colMesh->getCCDMotionThreshold());\n body->setCcdSweptSphereRadius(colMesh->getCCDSweptSphereRadius());\n body->applyForce(gravity * mass, btVector3(0,0,0));\n\n updateCollisionFlags();\n}\n\nvoid RigidBody::removeFromWorld (void)\n{\n lastXform = body->getCenterOfMassTransform();\n world->removeRigidBody(body);\n delete body;\n delete shape;\n body = NULL;\n}\n\nvoid RigidBody::destroy (lua_State *L)\n{\n colMesh->unregisterReloadWatcher(this);\n if (body==NULL) return;\n removeFromWorld();\n stepCallbackPtr.setNil(L);\n updateCallbackPtr.setNil(L);\n collisionCallbackPtr.setNil(L);\n stabiliseCallbackPtr.setNil(L);\n}\n\nvoid RigidBody::incRefCount (void)\n{\n refCount++;\n}\n\nvoid RigidBody::decRefCount (lua_State *L)\n{\n refCount--;\n if (refCount == 0) {\n destroy(L);\n // We don't have a destroy callback so no need to add extra complexity\n // like we have in HudObject. We should probably unify all these approaches into\n // a generic superclass.\n APP_ASSERT(refCount == 0);\n delete this;\n }\n}\n\nRigidBody::~RigidBody (void)\n{\n colMesh->unregisterReloadWatcher(this);\n if (body==NULL) return;\n CERR << \"destructing RigidBody: destroy() was not called\" << std::endl;\n // just leak stuff, this is not meant to happen\n}\n\nvoid RigidBody::getWorldTransform (btTransform& into_here) const\n{\n into_here = lastXform;\n}\n\nvoid RigidBody::setWorldTransform (const btTransform& )\n{\n}\n\nvoid RigidBody::updateGraphicsCallback (lua_State *L, float extrapolate)\n{\n if (updateCallbackPtr.isNil()) return;\n\n btTransform current_xform;\n\n btTransformUtil::integrateTransform(\n body->getInterpolationWorldTransform(),\n body->getInterpolationLinearVelocity(),\n body->getInterpolationAngularVelocity(),\n extrapolate*body->getHitFraction(),\n current_xform);\n\n\n STACK_BASE;\n\n // args\n const btVector3 &pos = check_nan(current_xform.getOrigin());\n btQuaternion quat;\n current_xform.getBasis().getRotation(quat);\n quat = check_nan(quat);\n\n int error_handler = lua_gettop(L);\n\n // get callback\n updateCallbackPtr.push(L);\n\n push_v3(L,from_bullet(pos)); // arg 1\n push_quat(L,from_bullet(quat)); // arg 1\n\n // call callback (7 args, no return values)\n int status = lua_pcall(L,2,0,error_handler);\n if (status) {\n // pop the error message since the error handler will\n // have already printed it out\n lua_pop(L,1);\n updateCallbackPtr.setNil(L);\n }\n\n STACK_CHECK;\n}\n\nvoid RigidBody::stepCallback (lua_State *L, float step_size)\n{\n if (body->getInvMass()==0) {\n btTransform after;\n btTransformUtil::integrateTransform(body->getCenterOfMassTransform(),\n body->getLinearVelocity(),\n body->getInterpolationAngularVelocity(),\n step_size,\n after);\n body->proceedToTransform(after);\n }\n if (stepCallbackPtr.isNil()) return;\n\n STACK_BASE;\n\n // to handle errors raised by the lua callback\n push_cfunction(L, my_lua_error_handler);\n int error_handler = lua_gettop(L);\n\n // get callback\n stepCallbackPtr.push(L);\n lua_pushnumber(L, step_size);\n\n // call callback (no args, no return values)\n int status = lua_pcall(L,1,0,error_handler);\n if (status) {\n lua_pop(L,1);\n stepCallbackPtr.setNil(L);\n }\n\n lua_pop(L,1); // error handler\n\n STACK_CHECK;\n}\n\nvoid RigidBody::collisionCallback (lua_State *L, int lifetime, float impulse,\n RigidBody *other, int m, int m2,\n float penetration, const Vector3 &pos, const Vector3 &pos2,\n const Vector3 &wnormal)\n{\n if (collisionCallbackPtr.isNil()) return;\n\n STACK_BASE;\n\n // to handle errors raised by the lua callback\n push_cfunction(L, my_lua_error_handler);\n int error_handler = lua_gettop(L);\n\n // get callback\n collisionCallbackPtr.push(L);\n\n lua_pushnumber(L,lifetime);\n lua_pushnumber(L,impulse);\n push_rbody(L,other);\n lua_pushstring(L,phys_mats.getMaterial(m)->name.c_str());\n lua_pushstring(L,phys_mats.getMaterial(m2)->name.c_str());\n lua_pushnumber(L,penetration);\n push_v3(L,pos);\n push_v3(L,pos2);\n push_v3(L,wnormal);\n int status = lua_pcall(L,9,0,error_handler);\n if (status) {\n lua_pop(L,1);\n collisionCallbackPtr.setNil(L);\n }\n\n lua_pop(L,1); // error handler\n\n STACK_CHECK;\n}\n\nvoid RigidBody::stabiliseCallback (lua_State *L, float elapsed)\n{\n if (stabiliseCallbackPtr.isNil()) return;\n\n STACK_BASE;\n\n // to handle errors raised by the lua callback\n push_cfunction(L, my_lua_error_handler);\n int error_handler = lua_gettop(L);\n\n // get callback\n stabiliseCallbackPtr.push(L);\n\n lua_pushnumber(L, elapsed);\n\n // call callback (no args, no return values)\n int status = lua_pcall(L,1,0,error_handler);\n if (status) {\n lua_pop(L,1);\n stabiliseCallbackPtr.setNil(L);\n }\n\n lua_pop(L,1); // error handler\n\n STACK_CHECK;\n}\n\nvoid RigidBody::force (const Vector3 &force)\n{\n if (std::isnan(force.x) || std::isnan(force.y) || std::isnan(force.z))\n GRIT_EXCEPT(\"RigidBody::force received NaN element in force vector\");\n if (body==NULL) return;\n body->applyCentralImpulse(to_bullet(force*physics_option(PHYSICS_STEP_SIZE)));\n body->activate();\n}\n\nvoid RigidBody::force (const Vector3 &force,\n const Vector3 &rel_pos)\n{\n if (std::isnan(force.x) || std::isnan(force.y) || std::isnan(force.z))\n GRIT_EXCEPT(\"RigidBody::force received NaN element in force vector\");\n if (std::isnan(rel_pos.x) || std::isnan(rel_pos.y) || std::isnan(rel_pos.z))\n GRIT_EXCEPT(\"RigidBody::force received NaN element in position vector\");\n if (body==NULL) return;\n body->applyImpulse(to_bullet(force*physics_option(PHYSICS_STEP_SIZE)),\n to_bullet(rel_pos));\n body->activate();\n}\n\nvoid RigidBody::impulse (const Vector3 &impulse)\n{\n if (std::isnan(impulse.x) || std::isnan(impulse.y) || std::isnan(impulse.z))\n GRIT_EXCEPT(\"RigidBody::impulse received NaN element in impulse vector\");\n if (body==NULL) return;\n body->applyCentralImpulse(to_bullet(impulse));\n body->activate();\n}\n\nvoid RigidBody::impulse (const Vector3 &impulse,\n const Vector3 &rel_pos)\n{\n if (std::isnan(impulse.x) || std::isnan(impulse.y) || std::isnan(impulse.z))\n GRIT_EXCEPT(\"RigidBody::impulse received NaN element in impulse vector\");\n if (std::isnan(rel_pos.x) || std::isnan(rel_pos.y) || std::isnan(rel_pos.z))\n GRIT_EXCEPT(\"RigidBody::impulse received NaN element in position vector\");\n if (body==NULL) return;\n body->applyImpulse(to_bullet(impulse),to_bullet(rel_pos));\n body->activate();\n}\n\nvoid RigidBody::torque (const Vector3 &torque)\n{\n if (std::isnan(torque.x) || std::isnan(torque.y) || std::isnan(torque.z))\n GRIT_EXCEPT(\"RigidBody::torque received NaN element in torque vector\");\n if (body==NULL) return;\n body->applyTorqueImpulse(to_bullet(torque*physics_option(PHYSICS_STEP_SIZE)));\n body->activate();\n}\n\nvoid RigidBody::torqueImpulse (const Vector3 &torque)\n{\n if (std::isnan(torque.x) || std::isnan(torque.y) || std::isnan(torque.z))\n GRIT_EXCEPT(\"RigidBody::torque received NaN element in torque vector\");\n if (body==NULL) return;\n body->applyTorqueImpulse(to_bullet(torque));\n body->activate();\n}\n\nfloat RigidBody::getContactProcessingThreshold (void) const\n{\n if (body==NULL) return 0;\n return body->getContactProcessingThreshold();\n}\n\nvoid RigidBody::setContactProcessingThreshold (float r)\n{\n if (body==NULL) return;\n body->setContactProcessingThreshold(r);\n}\n\nfloat RigidBody::getLinearDamping (void) const\n{\n if (body==NULL) return 0;\n return body->getLinearDamping();\n}\n\nvoid RigidBody::setLinearDamping (float r)\n{\n if (body==NULL) return;\n body->setDamping(r,getAngularDamping());\n}\n\nfloat RigidBody::getAngularDamping (void) const\n{\n if (body==NULL) return 0;\n return body->getAngularDamping();\n}\n\nvoid RigidBody::setAngularDamping (float r)\n{\n if (body==NULL) return;\n body->setDamping(getLinearDamping(),r);\n}\n\n\nfloat RigidBody::getLinearSleepThreshold (void) const\n{\n if (body==NULL) return 0;\n return body->getLinearSleepingThreshold();\n}\n\nvoid RigidBody::setLinearSleepThreshold (float r)\n{\n if (body==NULL) return;\n body->setSleepingThresholds(r,getAngularSleepThreshold());\n}\n\nfloat RigidBody::getAngularSleepThreshold (void) const\n{\n if (body==NULL) return 0;\n return body->getAngularSleepingThreshold();\n}\n\nvoid RigidBody::setAngularSleepThreshold (float r)\n{\n if (body==NULL) return;\n body->setSleepingThresholds(getLinearSleepThreshold(),r);\n}\n\n\nvoid RigidBody::activate (void)\n{\n if (body==NULL) return;\n body->activate();\n}\n\nvoid RigidBody::deactivate (void)\n{\n body->setActivationState( WANTS_DEACTIVATION );\n}\n\nVector3 RigidBody::getLinearVelocity (void) const\n{\n if (body==NULL) return Vector3(0,0,0);\n return from_bullet(body->getLinearVelocity());\n}\n\nvoid RigidBody::setLinearVelocity (const Vector3 &v)\n{\n if (body==NULL) return;\n body->setLinearVelocity(to_bullet(v));\n body->activate();\n}\n\nVector3 RigidBody::getAngularVelocity (void) const\n{\n if (body==NULL) return Vector3(0,0,0);\n return from_bullet(body->getAngularVelocity());\n}\n\nVector3 RigidBody::getLocalVelocity (const Vector3 &v) const\n{\n if (body==NULL) return Vector3(0,0,0);\n return from_bullet(body->getVelocityInLocalPoint(to_bullet(v)));\n}\n\nvoid RigidBody::setAngularVelocity (const Vector3 &v)\n{\n if (body==NULL) return;\n body->setAngularVelocity(to_bullet(v));\n body->activate();\n}\n\nstatic inline float invert0 (float v)\n{\n return v==0 ? 0 : 1/v;\n}\n\nstatic inline Vector3 invert0 (const Vector3 &v)\n{\n return Vector3(invert0(v.x),invert0(v.y),invert0(v.z));\n}\n\nfloat RigidBody::getMass (void) const\n{\n if (body==NULL) return 0;\n return mass;\n}\n\nvoid RigidBody::setMass (float r)\n{\n if (body==NULL) return;\n mass = r;\n body->setMassProps(r,to_bullet(getInertia()));\n}\n\n\nVector3 RigidBody::getInertia (void) const\n{\n if (body==NULL) return Vector3(0,0,0);\n return invert0(from_bullet(body->getInvInertiaDiagLocal()));\n}\n\nvoid RigidBody::setInertia (const Vector3 &v)\n{\n if (body==NULL) return;\n body->setMassProps(getMass(),to_bullet(v));\n}\n\nstatic int get_child_index(btCompoundShape* c, btCollisionShape* shape)\n{\n for (int i=0 ; i<c->getNumChildShapes() ; ++i) {\n if(c->getChildShape(i) == shape)\n return i;\n }\n CERR << \"Could not find child shape in compound.\" << std::endl;\n return 0;\n}\n\n\nvoid RigidBody::setElementEnabled (int i, bool v)\n{\n if (getElementEnabled(i)==v) return;\n localChanges[i].enabled = v;\n if (v) {\n btCollisionShape *s = colMesh->getMasterShape()->getChildShape(i);\n btTransform &t = colMesh->getMasterShape()->getChildTransform(i);\n t = t * localChanges[i].offset;\n shape->addChildShape(t,s);\n } else {\n int i2 = get_child_index(shape, colMesh->getMasterShape()->getChildShape(i));\n world->getBroadphase()->getOverlappingPairCache()\n ->cleanProxyFromPairs(body->getBroadphaseHandle(), world->getDispatcher());\n shape->removeChildShapeByIndex(i2);\n }\n}\n\nbool RigidBody::getElementEnabled (int i)\n{\n APP_ASSERT(i>=0); APP_ASSERT(i<(int)localChanges.size());\n return localChanges[i].enabled;\n}\n\nVector3 RigidBody::getElementPositionMaster (int i)\n{\n APP_ASSERT(i>=0); APP_ASSERT(i<(int)localChanges.size());\n return from_bullet(colMesh->getMasterShape()->getChildTransform(i).getOrigin());\n}\n\nvoid RigidBody::setElementPositionOffset (int i, const Vector3 &v)\n{\n APP_ASSERT(i>=0); APP_ASSERT(i<(int)localChanges.size());\n localChanges[i].offset.setOrigin(to_bullet(v));\n if (localChanges[i].enabled) {\n int i2 = get_child_index(shape, colMesh->getMasterShape()->getChildShape(i));\n shape->updateChildTransform(i2, colMesh->getMasterShape()->getChildTransform(i) * localChanges[i].offset);\n }\n}\n\nVector3 RigidBody::getElementPositionOffset (int i)\n{\n APP_ASSERT(i>=0); APP_ASSERT(i<(int)localChanges.size());\n return from_bullet(localChanges[i].offset.getOrigin());\n}\n\nQuaternion RigidBody::getElementOrientationMaster (int i)\n{\n APP_ASSERT(i>=0); APP_ASSERT(i<(int)localChanges.size());\n return from_bullet(colMesh->getMasterShape()->getChildTransform(i).getRotation());\n}\n\nvoid RigidBody::setElementOrientationOffset (int i, const Quaternion &q)\n{\n APP_ASSERT(i>=0); APP_ASSERT(i<(int)localChanges.size());\n localChanges[i].offset.setRotation(to_bullet(q));\n if (localChanges[i].enabled) {\n int i2 = get_child_index(shape, colMesh->getMasterShape()->getChildShape(i));\n shape->updateChildTransform(i2, colMesh->getMasterShape()->getChildTransform(i) * localChanges[i].offset);\n }\n}\n\nQuaternion RigidBody::getElementOrientationOffset (int i)\n{\n APP_ASSERT(i>=0); APP_ASSERT(i<(int)localChanges.size());\n return from_bullet(localChanges[i].offset.getRotation());\n}\n\nVector3 RigidBody::getPosition (void) const\n{\n if (body==NULL) return Vector3(0,0,0); // deactivated\n return from_bullet(body->getCenterOfMassPosition());\n}\n\nQuaternion RigidBody::getOrientation (void) const\n{\n if (body==NULL) return Quaternion(0,1,0,0); // deactivated\n return from_bullet(body->getOrientation());\n}\n\nvoid RigidBody::setPosition (const Vector3 &v)\n{\n if (body==NULL) return; // deactivated\n body->setCenterOfMassTransform(\n btTransform(body->getOrientation(), to_bullet(v)));\n world->updateSingleAabb(body);\n body->activate();\n}\n\nvoid RigidBody::setOrientation (const Quaternion &q)\n{\n if (body==NULL) return; // deactivated\n body->setCenterOfMassTransform(\n btTransform(to_bullet(q),body->getCenterOfMassPosition()));\n world->updateSingleAabb(body);\n body->activate();\n}\n\n\nvoid RigidBody::updateCollisionFlags (void)\n{\n if (body==NULL) return; // deactivated\n body->setCollisionFlags(\n btCollisionObject::CF_CUSTOM_MATERIAL_CALLBACK\n | (ghost ? btCollisionObject::CF_NO_CONTACT_RESPONSE : 0)\n | (mass == 0 ? btCollisionObject::CF_STATIC_OBJECT : 0)\n );\n body->activate();\n}\n\n// }}}\n\n\nvoid physics_init (void)\n{\n col_conf = new btDefaultCollisionConfiguration();\n col_disp = new btCollisionDispatcher(col_conf);\n\n broadphase = new btDbvtBroadphase();\n\n con_solver = new btSequentialImpulseConstraintSolver();\n\n world = new DynamicsWorld(col_disp,broadphase,con_solver,col_conf);\n\n gContactAddedCallback = contact_added_callback;\n \n world->setDebugDrawer(debug_drawer);\n\n init_options();\n}\n\nvoid physics_shutdown (void)\n{\n // they should probably all be gone by now but just in case some\n // aren't linked to RigidBodies, this will clean them up\n for (int i=world->getNumCollisionObjects()-1 ; i>=0 ; --i) {\n\n btCollisionObject* victim = world->getCollisionObjectArray()[i];\n\n btRigidBody* victim2 = btRigidBody::upcast(victim);\n\n if (victim2)\n world->removeRigidBody(victim2);\n\n delete victim;\n }\n\n\n delete world;\n delete con_solver;\n delete broadphase;\n delete col_disp;\n delete col_conf;\n}\n" }, { "alpha_fraction": 0.5465353727340698, "alphanum_fraction": 0.5581684112548828, "avg_line_length": 28.938901901245117, "blob_id": "2fa8b2e9ec298bb8b58bd72ce5c785ed9793f978", "content_id": "08472ddc6a9dd217c28dfbc3ca2b83114df62843", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 160233, "license_type": "permissive", "max_line_length": 109, "num_lines": 5352, "path": "/engine/gfx/lua_wrappers_gfx.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <colour_conversion.h>\n#include <io_util.h>\n#include <unicode_util.h>\n\n#include \"../grit_lua_util.h\"\n\n#include \"../lua_wrappers_primitives.h\"\n#include \"../main.h\"\n#include \"../external_table.h\"\n#include \"../lua_ptr.h\"\n#include \"../path_util.h\"\n\n#include \"gfx_debug.h\"\n#include \"gfx_font.h\"\n#include \"gfx_option.h\"\n#include \"hud.h\"\n#include \"lua_wrappers_gfx.h\"\n\nGfxNodePtr check_gfx_node (lua_State *L, int idx)\n{\n if (has_tag(L, idx, GFXNODE_TAG)) {\n GET_UD_MACRO(GfxNodePtr,self,idx,GFXNODE_TAG);\n return self;\n } else if (has_tag(L, idx, GFXBODY_TAG)) {\n GET_UD_MACRO(GfxBodyPtr,self,idx,GFXBODY_TAG);\n return self.staticCast<GfxFertileNode>();\n } else {\n EXCEPT << \"Expected a GfxFertileNode or GfxBody at position \" << idx << ENDL;\n }\n}\n\nvoid push_gfx_node_concrete (lua_State *L, const GfxNodePtr &np)\n{\n if (np.isNull()) {\n lua_pushnil(L);\n } else if (np->hasGraphics()) {\n push_gfxbody(L, np.staticCast<GfxBody>());\n } else {\n push_gfxnode(L, np);\n }\n}\n\n// GFXNODE ============================================================== {{{\n\nvoid push_gfxnode (lua_State *L, const GfxNodePtr &self)\n{\n if (self.isNull())\n lua_pushnil(L);\n else\n push(L,new GfxNodePtr(self),GFXNODE_TAG);\n}\n\nGC_MACRO(GfxNodePtr,gfxnode,GFXNODE_TAG)\n\nstatic int gfxnode_make_child (lua_State *L)\n{\nTRY_START\n if (lua_gettop(L)==1) {\n GET_UD_MACRO(GfxNodePtr,self,1,GFXNODE_TAG);\n push_gfxnode(L, GfxFertileNode::make(self));\n } else {\n check_args(L,2);\n GET_UD_MACRO(GfxNodePtr,self,1,GFXNODE_TAG);\n std::string mesh_name = check_path(L,2);\n push_gfxbody(L, GfxBody::make(mesh_name, gfx_empty_string_map, self));\n }\n return 1;\nTRY_END\n}\n\nstatic int gfxnode_set_all_materials (lua_State *L)\n{\nTRY_START\n check_args(L,2);\n GET_UD_MACRO(GfxNodePtr,self,1,GFXNODE_TAG);\n const char *mname = luaL_checkstring(L,2);\n GfxMaterial *m = gfx_material_get(mname);\n (void) self;\n (void) m;\n return 0;\nTRY_END\n}\n\nstatic int gfxnode_destroy (lua_State *L)\n{\nTRY_START\n check_args(L,1);\n GET_UD_MACRO(GfxNodePtr,self,1,GFXNODE_TAG);\n self->destroy();\n return 0;\nTRY_END\n}\n\n\n\nTOSTRING_SMART_PTR_MACRO (gfxnode,GfxNodePtr,GFXNODE_TAG)\n\n\nstatic int gfxnode_index (lua_State *L)\n{\nTRY_START\n check_args(L,2);\n GET_UD_MACRO(GfxNodePtr,self,1,GFXNODE_TAG);\n const char *key = luaL_checkstring(L,2);\n if (!::strcmp(key,\"localPosition\")) {\n push_v3(L, self->getLocalPosition());\n } else if (!::strcmp(key,\"localOrientation\")) {\n push_quat(L, self->getLocalOrientation());\n } else if (!::strcmp(key,\"localScale\")) {\n push_v3(L, self->getLocalScale());\n } else if (!::strcmp(key,\"parent\")) {\n push_gfx_node_concrete(L, self->getParent());\n } else if (!::strcmp(key,\"parentBone\")) {\n if (self->getParentBoneName().length() == 0) {\n lua_pushnil(L);\n } else {\n push_string(L, self->getParentBoneName());\n }\n } else if (!::strcmp(key,\"setAllMaterials\")) {\n push_cfunction(L,gfxnode_set_all_materials);\n } else if (!::strcmp(key,\"batchesWithChildren\")) {\n lua_pushnumber(L, self->getBatchesWithChildren());\n } else if (!::strcmp(key,\"trianglesWithChildren\")) {\n lua_pushnumber(L, self->getTrianglesWithChildren());\n } else if (!::strcmp(key,\"vertexesWithChildren\")) {\n lua_pushnumber(L, self->getVertexesWithChildren());\n } else if (!::strcmp(key,\"fade\")) {\n lua_pushnumber(L, 1);\n } else if (!::strcmp(key,\"makeChild\")) {\n push_cfunction(L,gfxnode_make_child);\n } else if (!::strcmp(key,\"destroyed\")) {\n lua_pushboolean(L,self->destroyed());\n } else if (!::strcmp(key,\"destroy\")) {\n push_cfunction(L,gfxnode_destroy);\n } else {\n my_lua_error(L,\"Not a readable GfxFertileNode member: \"+std::string(key));\n }\n return 1;\nTRY_END\n}\n\n\nstatic int gfxnode_newindex (lua_State *L)\n{\nTRY_START\n check_args(L,3);\n GET_UD_MACRO(GfxNodePtr,self,1,GFXNODE_TAG);\n const char *key = luaL_checkstring(L,2);\n if (!::strcmp(key,\"localPosition\")) {\n Vector3 v = check_v3(L,3);\n self->setLocalPosition(v);\n } else if (!::strcmp(key,\"localOrientation\")) {\n Quaternion v = check_quat(L,3);\n self->setLocalOrientation(v);\n } else if (!::strcmp(key,\"localScale\")) {\n Vector3 v = check_v3(L,3);\n self->setLocalScale(v);\n } else if (!::strcmp(key,\"parent\")) {\n if (lua_isnil(L,3)) {\n self->setParent(GfxNodePtr(NULL));\n } else {\n GfxNodePtr par = check_gfx_node(L, 3);\n self->setParent(par);\n }\n } else if (!::strcmp(key,\"parentBone\")) {\n if (lua_isnil(L,3)) {\n self->setParentBoneName(\"\");\n } else {\n std::string s = check_string(L, 3);\n self->setParentBoneName(s);\n }\n } else if (!::strcmp(key,\"fade\")) {\n float v = check_float(L,3);\n (void) v;\n } else {\n my_lua_error(L,\"Not a writeable GfxFertileNode member: \"+std::string(key));\n }\n return 0;\nTRY_END\n}\n\nEQ_MACRO(GfxNodePtr,gfxnode,GFXNODE_TAG)\n\nMT_MACRO_NEWINDEX(gfxnode);\n\n//}}}\n\n\n// GFXBODY ============================================================== {{{\n\nvoid push_gfxbody (lua_State *L, const GfxBodyPtr &self)\n{\n if (self.isNull())\n lua_pushnil(L);\n else\n push(L,new GfxBodyPtr(self),GFXBODY_TAG);\n}\n\nGC_MACRO(GfxBodyPtr,gfxbody,GFXBODY_TAG)\n\nstatic int gfxbody_reinitialise (lua_State *L)\n{\nTRY_START\n check_args(L,1);\n GET_UD_MACRO(GfxBodyPtr,self,1,GFXBODY_TAG);\n self->reinitialise();\n return 0;\nTRY_END\n}\n\nstatic int gfxbody_get_emissive_enabled (lua_State *L)\n{\nTRY_START\n check_args(L,2);\n GET_UD_MACRO(GfxBodyPtr,self,1,GFXBODY_TAG);\n const std::string &n = luaL_checkstring(L,2);\n unsigned n2 = self->getSubMeshByOriginalMaterialName(n);\n lua_pushboolean(L, self->getEmissiveEnabled(n2));\n return 1;\nTRY_END\n}\n\nstatic int gfxbody_set_emissive_enabled (lua_State *L)\n{\nTRY_START\n check_args(L,3);\n GET_UD_MACRO(GfxBodyPtr,self,1,GFXBODY_TAG);\n const std::string &n = luaL_checkstring(L,2);\n unsigned n2 = self->getSubMeshByOriginalMaterialName(n);\n bool v = check_bool(L,3);\n self->setEmissiveEnabled(n2,v);\n return 0;\nTRY_END\n}\n\nstatic int gfxbody_get_materials (lua_State *L)\n{\nTRY_START\n check_args(L,1);\n GET_UD_MACRO(GfxBodyPtr,self,1,GFXBODY_TAG);\n for (unsigned i=0 ; i<self->getNumSubMeshes() ; ++i) {\n GfxMaterial *m = self->getMaterial(i);\n lua_pushstring(L, m->name.c_str());\n }\n return self->getNumSubMeshes() ;\nTRY_END\n}\n\nstatic int gfxbody_set_material (lua_State *L)\n{\nTRY_START\n check_args(L,3);\n GET_UD_MACRO(GfxBodyPtr,self,1,GFXBODY_TAG);\n const std::string &n = luaL_checkstring(L,2);\n unsigned n2 = self->getSubMeshByOriginalMaterialName(n);\n const char *mname = luaL_checkstring(L,3);\n GfxMaterial *m = gfx_material_get(mname);\n self->setMaterial(n2,m);\n return 0;\nTRY_END\n}\n\nstatic int gfxbody_set_all_materials (lua_State *L)\n{\nTRY_START\n check_args(L,2);\n GET_UD_MACRO(GfxBodyPtr,self,1,GFXBODY_TAG);\n const char *mname = luaL_checkstring(L,2);\n GfxMaterial *m = gfx_material_get(mname);\n for (unsigned i=0 ; i<self->getBatches() ; ++i) {\n self->setMaterial(i,m);\n }\n return 0;\nTRY_END\n}\n\nstatic int gfxbody_get_paint_colour (lua_State *L)\n{\nTRY_START\n check_args(L, 2);\n GET_UD_MACRO(GfxBodyPtr, self, 1, GFXBODY_TAG);\n int i = check_int(L, 2, 0, 3);\n GfxPaintColour col = self->getPaintColour(i);\n\n push_v3(L, col.diff);\n lua_pushnumber(L, col.met);\n lua_pushnumber(L, col.gloss);\n lua_pushnumber(L, col.spec);\n return 4;\nTRY_END\n}\n\nstatic int gfxbody_set_paint_colour (lua_State *L)\n{\nTRY_START\n check_args(L, 6);\n GET_UD_MACRO(GfxBodyPtr, self, 1, GFXBODY_TAG);\n int i = check_int(L, 2, 0, 3);\n GfxPaintColour col;\n col.diff = check_v3(L, 3);\n col.met = check_float(L, 4);\n col.gloss = check_float(L, 5);\n col.spec = check_float(L, 6);\n self->setPaintColour(i, col);\n return 0;\nTRY_END\n}\n\nstatic int gfxbody_get_bone_id (lua_State *L)\n{\nTRY_START\n check_args(L,2);\n GET_UD_MACRO(GfxBodyPtr,self,1,GFXBODY_TAG);\n const char *name = luaL_checkstring(L,2);\n unsigned bone = self->getBoneId(name);\n lua_pushnumber(L,bone);\n return 1;\nTRY_END\n}\n\nstatic int gfxbody_get_bone_name (lua_State *L)\n{\nTRY_START\n check_args(L,2);\n GET_UD_MACRO(GfxBodyPtr,self,1,GFXBODY_TAG);\n unsigned i = check_t<unsigned>(L,2);\n const std::string &name = self->getBoneName(i);\n lua_pushstring(L,name.c_str());\n return 1;\nTRY_END\n}\n\nstatic int gfxbody_get_bone_manually_controlled (lua_State *L)\n{\nTRY_START\n check_args(L,2);\n GET_UD_MACRO(GfxBodyPtr,self,1,GFXBODY_TAG);\n unsigned i = check_t<unsigned>(L,2);\n bool v = self->getBoneManuallyControlled(i);\n lua_pushboolean(L,v);\n return 1;\nTRY_END\n}\n\nstatic int gfxbody_set_bone_manually_controlled (lua_State *L)\n{\nTRY_START\n check_args(L,3);\n GET_UD_MACRO(GfxBodyPtr,self,1,GFXBODY_TAG);\n unsigned i = check_t<unsigned>(L,2);\n bool v = check_bool(L,3);\n self->setBoneManuallyControlled(i, v);\n return 0;\nTRY_END\n}\n\nstatic int gfxbody_set_all_bones_manually_controlled (lua_State *L)\n{\nTRY_START\n check_args(L,2);\n GET_UD_MACRO(GfxBodyPtr,self,1,GFXBODY_TAG);\n bool v = check_bool(L,2);\n self->setAllBonesManuallyControlled(v);\n return 0;\nTRY_END\n}\n\nstatic int gfxbody_get_bone_initial_position (lua_State *L)\n{\nTRY_START\n check_args(L,2);\n GET_UD_MACRO(GfxBodyPtr,self,1,GFXBODY_TAG);\n unsigned i = check_t<unsigned>(L,2);\n push_v3(L, self->getBoneInitialPosition(i));\n return 1;\nTRY_END\n}\n\nstatic int gfxbody_get_bone_world_position (lua_State *L)\n{\nTRY_START\n check_args(L,2);\n GET_UD_MACRO(GfxBodyPtr,self,1,GFXBODY_TAG);\n unsigned i = check_t<unsigned>(L,2);\n push_v3(L, self->getBoneWorldPosition(i));\n return 1;\nTRY_END\n}\n\nstatic int gfxbody_get_bone_local_position (lua_State *L)\n{\nTRY_START\n check_args(L,2);\n GET_UD_MACRO(GfxBodyPtr,self,1,GFXBODY_TAG);\n unsigned i = check_t<unsigned>(L,2);\n push_v3(L, self->getBoneLocalPosition(i));\n return 1;\nTRY_END\n}\n\nstatic int gfxbody_get_bone_initial_orientation (lua_State *L)\n{\nTRY_START\n check_args(L,2);\n GET_UD_MACRO(GfxBodyPtr,self,1,GFXBODY_TAG);\n unsigned i = check_t<unsigned>(L,2);\n push_quat(L, self->getBoneInitialOrientation(i));\n return 1;\nTRY_END\n}\n\nstatic int gfxbody_get_bone_world_orientation (lua_State *L)\n{\nTRY_START\n check_args(L,2);\n GET_UD_MACRO(GfxBodyPtr,self,1,GFXBODY_TAG);\n unsigned i = check_t<unsigned>(L,2);\n push_quat(L, self->getBoneWorldOrientation(i));\n return 1;\nTRY_END\n}\n\nstatic int gfxbody_get_bone_local_orientation (lua_State *L)\n{\nTRY_START\n check_args(L,2);\n GET_UD_MACRO(GfxBodyPtr,self,1,GFXBODY_TAG);\n unsigned i = check_t<unsigned>(L,2);\n push_quat(L, self->getBoneLocalOrientation(i));\n return 1;\nTRY_END\n}\n\nstatic int gfxbody_set_bone_local_position (lua_State *L)\n{\nTRY_START\n check_args(L,3);\n GET_UD_MACRO(GfxBodyPtr,self,1,GFXBODY_TAG);\n unsigned i = check_t<unsigned>(L,2);\n Vector3 pos = check_v3(L,3);\n self->setBoneLocalPosition(i, pos);\n return 0;\nTRY_END\n}\n\nstatic int gfxbody_set_bone_local_orientation (lua_State *L)\n{\nTRY_START\n check_args(L,3);\n GET_UD_MACRO(GfxBodyPtr,self,1,GFXBODY_TAG);\n unsigned i = check_t<unsigned>(L,2);\n Quaternion quat = check_quat(L,3);\n self->setBoneLocalOrientation(i, quat);\n return 0;\nTRY_END\n}\n\nstatic int gfxbody_set_bone_local_position_offset (lua_State *L)\n{\nTRY_START\n check_args(L,3);\n GET_UD_MACRO(GfxBodyPtr,self,1,GFXBODY_TAG);\n unsigned i = check_t<unsigned>(L,2);\n Vector3 pos = check_v3(L,3);\n self->setBoneLocalPosition(i, self->getBoneInitialPosition(i)+pos);\n return 0;\nTRY_END\n}\n\nstatic int gfxbody_set_bone_local_orientation_offset (lua_State *L)\n{\nTRY_START\n check_args(L,3);\n GET_UD_MACRO(GfxBodyPtr,self,1,GFXBODY_TAG);\n unsigned i = check_t<unsigned>(L,2);\n Quaternion quat = check_quat(L,3);\n self->setBoneLocalOrientation(i, self->getBoneInitialOrientation(i)*quat);\n return 0;\nTRY_END\n}\n\nstatic int gfxbody_get_all_animations(lua_State *L)\n{\nTRY_START\n check_args(L,1);\n GET_UD_MACRO(GfxBodyPtr,self,1,GFXBODY_TAG);\n std::vector<std::string> names = self->getAnimationNames();\n for (unsigned i=0 ; i<names.size() ; ++i) {\n lua_pushstring(L, names[i].c_str());\n }\n return names.size();\nTRY_END\n}\n\nstatic int gfxbody_get_animation_length(lua_State *L)\n{\nTRY_START\n check_args(L,2);\n GET_UD_MACRO(GfxBodyPtr,self,1,GFXBODY_TAG);\n std::string anim = check_string(L,2);\n lua_pushnumber(L, self->getAnimationLength(anim));\n return 1;\nTRY_END\n}\n\nstatic int gfxbody_get_animation_pos(lua_State *L)\n{\nTRY_START\n check_args(L,2);\n GET_UD_MACRO(GfxBodyPtr,self,1,GFXBODY_TAG);\n std::string anim = check_string(L,2);\n lua_pushnumber(L, self->getAnimationPos(anim));\n return 1;\nTRY_END\n}\n\nstatic int gfxbody_set_animation_pos(lua_State *L)\n{\nTRY_START\n check_args(L,3);\n GET_UD_MACRO(GfxBodyPtr,self,1,GFXBODY_TAG);\n std::string anim = check_string(L,2);\n float const t = check_float(L,3);\n self->setAnimationPos(anim, t);\n return 0;\nTRY_END\n}\n\nstatic int gfxbody_get_animation_pos_normalised(lua_State *L)\n{\nTRY_START\n check_args(L,2);\n GET_UD_MACRO(GfxBodyPtr,self,1,GFXBODY_TAG);\n std::string anim = check_string(L,2);\n lua_pushnumber(L, self->getAnimationPos(anim) / self->getAnimationLength(anim));\n return 1;\nTRY_END\n}\n\nstatic int gfxbody_set_animation_pos_normalised(lua_State *L)\n{\nTRY_START\n check_args(L,3);\n GET_UD_MACRO(GfxBodyPtr,self,1,GFXBODY_TAG);\n std::string anim = check_string(L,2);\n float const t = check_float(L,3);\n self->setAnimationPos(anim, t * self->getAnimationLength(anim));\n return 0;\nTRY_END\n}\n\nstatic int gfxbody_get_animation_mask(lua_State *L)\n{\nTRY_START\n check_args(L,2);\n GET_UD_MACRO(GfxBodyPtr,self,1,GFXBODY_TAG);\n std::string anim = check_string(L,2);\n lua_pushnumber(L, self->getAnimationMask(anim));\n return 1;\nTRY_END\n}\n\nstatic int gfxbody_set_animation_mask(lua_State *L)\n{\nTRY_START\n check_args(L,3);\n GET_UD_MACRO(GfxBodyPtr,self,1,GFXBODY_TAG);\n std::string anim = check_string(L,2);\n float const t = check_float(L,3);\n self->setAnimationMask(anim, t);\n return 0;\nTRY_END\n}\n\nstatic int gfxbody_make_child (lua_State *L)\n{\nTRY_START\n if (lua_gettop(L)==1) {\n GET_UD_MACRO(GfxBodyPtr,self,1,GFXBODY_TAG);\n push_gfxnode(L, GfxFertileNode::make(self.staticCast<GfxFertileNode>()));\n } else {\n check_args(L,2);\n GET_UD_MACRO(GfxBodyPtr,self,1,GFXBODY_TAG);\n std::string mesh_name = check_path(L,2);\n push_gfxbody(L, GfxBody::make(mesh_name, gfx_empty_string_map, self.staticCast<GfxFertileNode>()));\n }\n return 1;\nTRY_END\n}\n\nstatic int gfxbody_destroy (lua_State *L)\n{\nTRY_START\n check_args(L,1);\n GET_UD_MACRO(GfxBodyPtr,self,1,GFXBODY_TAG);\n self->destroy();\n return 0;\nTRY_END\n}\n\n\n\nTOSTRING_SMART_PTR_MACRO (gfxbody,GfxBodyPtr,GFXBODY_TAG)\n\n\nstatic int gfxbody_index (lua_State *L)\n{\nTRY_START\n check_args(L,2);\n GET_UD_MACRO(GfxBodyPtr,self,1,GFXBODY_TAG);\n const char *key = luaL_checkstring(L,2);\n if (!::strcmp(key,\"localPosition\")) {\n push_v3(L, self->getLocalPosition());\n } else if (!::strcmp(key,\"localOrientation\")) {\n push_quat(L, self->getLocalOrientation());\n } else if (!::strcmp(key,\"localScale\")) {\n push_v3(L, self->getLocalScale());\n } else if (!::strcmp(key,\"parent\")) {\n push_gfx_node_concrete(L, self->getParent());\n } else if (!::strcmp(key,\"parentBone\")) {\n if (self->getParentBoneName().length() == 0) {\n lua_pushnil(L);\n } else {\n push_string(L, self->getParentBoneName());\n }\n } else if (!::strcmp(key,\"batches\")) {\n lua_pushnumber(L, self->getBatches());\n } else if (!::strcmp(key,\"batchesWithChildren\")) {\n lua_pushnumber(L, self->getBatchesWithChildren());\n } else if (!::strcmp(key,\"triangles\")) {\n lua_pushnumber(L, self->getTriangles());\n } else if (!::strcmp(key,\"trianglesWithChildren\")) {\n lua_pushnumber(L, self->getTrianglesWithChildren());\n } else if (!::strcmp(key,\"vertexes\")) {\n lua_pushnumber(L, self->getVertexes());\n } else if (!::strcmp(key,\"vertexesWithChildren\")) {\n lua_pushnumber(L, self->getVertexesWithChildren());\n } else if (!::strcmp(key,\"getMaterials\")) {\n push_cfunction(L,gfxbody_get_materials);\n } else if (!::strcmp(key,\"setMaterial\")) {\n push_cfunction(L,gfxbody_set_material);\n } else if (!::strcmp(key,\"setAllMaterials\")) {\n push_cfunction(L,gfxbody_set_all_materials);\n } else if (!::strcmp(key,\"getEmissiveEnabled\")) {\n push_cfunction(L,gfxbody_get_emissive_enabled);\n } else if (!::strcmp(key,\"setEmissiveEnabled\")) {\n push_cfunction(L,gfxbody_set_emissive_enabled);\n } else if (!::strcmp(key,\"reinitialise\")) {\n push_cfunction(L, gfxbody_reinitialise);\n\n } else if (!::strcmp(key,\"fade\")) {\n lua_pushnumber(L, self->getFade());\n } else if (!::strcmp(key,\"castShadows\")) {\n lua_pushboolean(L, self->getCastShadows());\n } else if (!::strcmp(key,\"wireframe\")) {\n lua_pushboolean(L, self->getWireframe());\n } else if (!::strcmp(key,\"firstPerson\")) {\n lua_pushboolean(L, self->getFirstPerson());\n } else if (!::strcmp(key,\"enabled\")) {\n lua_pushboolean(L, self->isEnabled());\n\n } else if (!::strcmp(key,\"getPaintColour\")) {\n push_cfunction(L,gfxbody_get_paint_colour);\n } else if (!::strcmp(key,\"setPaintColour\")) {\n push_cfunction(L,gfxbody_set_paint_colour);\n\n } else if (!::strcmp(key,\"numBones\")) {\n lua_pushnumber(L, self->getNumBones());\n } else if (!::strcmp(key,\"getBoneId\")) {\n push_cfunction(L,gfxbody_get_bone_id);\n } else if (!::strcmp(key,\"getBoneName\")) {\n push_cfunction(L,gfxbody_get_bone_name);\n\n } else if (!::strcmp(key,\"getBoneManuallyControlled\")) {\n push_cfunction(L,gfxbody_get_bone_manually_controlled);\n } else if (!::strcmp(key,\"setBoneManuallyControlled\")) {\n push_cfunction(L,gfxbody_set_bone_manually_controlled);\n } else if (!::strcmp(key,\"setAllBonesManuallyControlled\")) {\n push_cfunction(L,gfxbody_set_all_bones_manually_controlled);\n\n } else if (!::strcmp(key,\"getBoneInitialPosition\")) {\n push_cfunction(L,gfxbody_get_bone_initial_position);\n } else if (!::strcmp(key,\"getBoneWorldPosition\")) {\n push_cfunction(L,gfxbody_get_bone_world_position);\n } else if (!::strcmp(key,\"getBoneLocalPosition\")) {\n push_cfunction(L,gfxbody_get_bone_local_position);\n } else if (!::strcmp(key,\"getBoneInitialOrientation\")) {\n push_cfunction(L,gfxbody_get_bone_initial_orientation);\n } else if (!::strcmp(key,\"getBoneWorldOrientation\")) {\n push_cfunction(L,gfxbody_get_bone_world_orientation);\n } else if (!::strcmp(key,\"getBoneLocalOrientation\")) {\n push_cfunction(L,gfxbody_get_bone_local_orientation);\n\n } else if (!::strcmp(key,\"setBoneLocalPosition\")) {\n push_cfunction(L,gfxbody_set_bone_local_position);\n } else if (!::strcmp(key,\"setBoneLocalOrientation\")) {\n push_cfunction(L,gfxbody_set_bone_local_orientation);\n\n // 2 convenience functions\n } else if (!::strcmp(key,\"setBoneLocalPositionOffset\")) {\n push_cfunction(L,gfxbody_set_bone_local_position_offset);\n } else if (!::strcmp(key,\"setBoneLocalOrientationOffset\")) {\n push_cfunction(L,gfxbody_set_bone_local_orientation_offset);\n/*\n } else if (!::strcmp(key,\"setAnimation\")) {\n push_cfunction(L,gfxbody_set_animation);\n } else if (!::strcmp(key,\"findAnimation\")) {\n push_cfunction(L,gfxbody_find_animation);\n } else if (!::strcmp(key,\"updateAnimation\")) {\n push_cfunction(L,gfxbody_update_animation);\n*/\n\n } else if (!::strcmp(key,\"getAllAnimations\")) {\n push_cfunction(L,gfxbody_get_all_animations);\n\n } else if (!::strcmp(key,\"getAnimationLength\")) {\n push_cfunction(L,gfxbody_get_animation_length);\n } else if (!::strcmp(key,\"getAnimationPos\")) {\n push_cfunction(L,gfxbody_get_animation_pos);\n } else if (!::strcmp(key,\"getAnimationPosNormalised\")) {\n push_cfunction(L,gfxbody_get_animation_pos_normalised);\n } else if (!::strcmp(key,\"setAnimationPos\")) {\n push_cfunction(L,gfxbody_set_animation_pos);\n } else if (!::strcmp(key,\"setAnimationPosNormalised\")) {\n push_cfunction(L,gfxbody_set_animation_pos_normalised);\n } else if (!::strcmp(key,\"getAnimationMask\")) {\n push_cfunction(L,gfxbody_get_animation_mask);\n } else if (!::strcmp(key,\"setAnimationMask\")) {\n push_cfunction(L,gfxbody_set_animation_mask);\n\n } else if (!::strcmp(key,\"meshName\")) {\n push_string(L,self->getMeshName());\n } else if (!::strcmp(key,\"makeChild\")) {\n push_cfunction(L,gfxbody_make_child);\n } else if (!::strcmp(key,\"destroyed\")) {\n lua_pushboolean(L,self->destroyed());\n } else if (!::strcmp(key,\"destroy\")) {\n push_cfunction(L,gfxbody_destroy);\n } else {\n my_lua_error(L,\"Not a readable GfxBody member: \"+std::string(key));\n }\n return 1;\nTRY_END\n}\n\n\nstatic int gfxbody_newindex (lua_State *L)\n{\nTRY_START\n check_args(L,3);\n GET_UD_MACRO(GfxBodyPtr,self,1,GFXBODY_TAG);\n const char *key = luaL_checkstring(L,2);\n if (!::strcmp(key,\"localPosition\")) {\n Vector3 v = check_v3(L,3);\n self->setLocalPosition(v);\n } else if (!::strcmp(key,\"localOrientation\")) {\n Quaternion v = check_quat(L,3);\n self->setLocalOrientation(v);\n } else if (!::strcmp(key,\"localScale\")) {\n Vector3 v = check_v3(L,3);\n self->setLocalScale(v);\n } else if (!::strcmp(key,\"fade\")) {\n float v = check_float(L,3);\n self->setFade(v);\n } else if (!::strcmp(key,\"parent\")) {\n if (lua_isnil(L,3)) {\n self->setParent(GfxNodePtr(NULL));\n } else {\n GfxNodePtr par = check_gfx_node(L, 3);\n self->setParent(par);\n }\n } else if (!::strcmp(key,\"parentBone\")) {\n if (lua_isnil(L,3)) {\n self->setParentBoneName(\"\");\n } else {\n std::string s = check_string(L, 3);\n self->setParentBoneName(s);\n }\n } else if (!::strcmp(key,\"castShadows\")) {\n bool v = check_bool(L,3);\n self->setCastShadows(v);\n } else if (!::strcmp(key,\"wireframe\")) {\n bool v = check_bool(L,3);\n self->setWireframe(v);\n } else if (!::strcmp(key,\"enabled\")) {\n bool v = check_bool(L,3);\n self->setEnabled(v);\n } else if (!::strcmp(key,\"firstPerson\")) {\n bool v = check_bool(L,3);\n self->setFirstPerson(v);\n } else {\n my_lua_error(L,\"Not a writeable GfxBody member: \"+std::string(key));\n }\n return 0;\nTRY_END\n}\n\nEQ_MACRO(GfxBodyPtr,gfxbody,GFXBODY_TAG)\n\nMT_MACRO_NEWINDEX(gfxbody);\n\n//}}}\n\n\n// GFXTEXTBODY ============================================================== {{{\n\nvoid push_gfxtextbody (lua_State *L, const GfxTextBodyPtr &self)\n{\n if (self.isNull())\n lua_pushnil(L);\n else\n push(L, new GfxTextBodyPtr(self), GFXTEXTBODY_TAG);\n}\n\nGC_MACRO(GfxTextBodyPtr, gfxtextbody, GFXTEXTBODY_TAG)\n\nstatic int gfxtextbody_clear (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n GET_UD_MACRO(GfxTextBodyPtr, self, 1, GFXTEXTBODY_TAG);\n self->clear();\n return 0;\nTRY_END\n}\n\nstatic int gfxtextbody_update_gpu (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n GET_UD_MACRO(GfxTextBodyPtr, self, 1, GFXTEXTBODY_TAG);\n self->updateGpu();\n return 0;\nTRY_END\n}\n\nstatic int gfxtextbody_append (lua_State *L)\n{\nTRY_START\n if (lua_gettop(L) == 2) {\n GET_UD_MACRO(GfxTextBodyPtr, self, 1, GFXTEXTBODY_TAG);\n std::string str = check_string(L, 2);\n Vector3 colour(0, 0, 0);\n float alpha = 1;\n self->append(str, colour, alpha, colour, alpha);\n } else {\n check_args(L, 6);\n GET_UD_MACRO(GfxTextBodyPtr, self, 1, GFXTEXTBODY_TAG);\n std::string str = check_string(L, 2);\n Vector3 top_colour = check_v3(L, 3);\n float top_alpha = check_float(L, 4);\n Vector3 bot_colour = check_v3(L, 5);\n float bot_alpha = check_float(L, 6);\n self->append(str, top_colour, top_alpha, bot_colour, bot_alpha);\n }\n return 0;\nTRY_END\n}\n\nstatic int gfxtextbody_destroy (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n GET_UD_MACRO(GfxTextBodyPtr, self, 1, GFXTEXTBODY_TAG);\n self->destroy();\n return 0;\nTRY_END\n}\n\nTOSTRING_SMART_PTR_MACRO (gfxtextbody, GfxTextBodyPtr, GFXTEXTBODY_TAG)\n\nstatic int gfxtextbody_index (lua_State *L)\n{\nTRY_START\n check_args(L, 2);\n GET_UD_MACRO(GfxTextBodyPtr, self, 1, GFXTEXTBODY_TAG);\n const char *key = luaL_checkstring(L, 2);\n if (!::strcmp(key, \"localPosition\")) {\n push_v3(L, self->getLocalPosition());\n } else if (!::strcmp(key, \"localOrientation\")) {\n push_quat(L, self->getLocalOrientation());\n } else if (!::strcmp(key, \"localScale\")) {\n push_v3(L, self->getLocalScale());\n } else if (!::strcmp(key, \"parent\")) {\n push_gfx_node_concrete(L, self->getParent());\n } else if (!::strcmp(key, \"batches\")) {\n lua_pushnumber(L, self->getBatches());\n } else if (!::strcmp(key, \"batchesWithChildren\")) {\n lua_pushnumber(L, self->getBatchesWithChildren());\n } else if (!::strcmp(key, \"triangles\")) {\n lua_pushnumber(L, self->getTriangles());\n } else if (!::strcmp(key, \"trianglesWithChildren\")) {\n lua_pushnumber(L, self->getTrianglesWithChildren());\n } else if (!::strcmp(key, \"vertexes\")) {\n lua_pushnumber(L, self->getVertexes());\n } else if (!::strcmp(key, \"vertexesWithChildren\")) {\n lua_pushnumber(L, self->getVertexesWithChildren());\n } else if (!::strcmp(key, \"material\")) {\n push_string(L, self->getMaterial()->name);\n } else if (!::strcmp(key, \"emissiveEnabled\")) {\n lua_pushboolean(L, self->getEmissiveEnabled());\n } else if (!::strcmp(key,\"font\")) {\n GfxFont *font = self->getFont();\n push_string(L, font->name);\n\n } else if (!::strcmp(key, \"fade\")) {\n lua_pushnumber(L, self->getFade());\n } else if (!::strcmp(key, \"castShadows\")) {\n lua_pushboolean(L, self->getCastShadows());\n } else if (!::strcmp(key, \"enabled\")) {\n lua_pushboolean(L, self->isEnabled());\n } else if (!::strcmp(key, \"clear\")) {\n push_cfunction(L, gfxtextbody_clear);\n } else if (!::strcmp(key, \"updateGpu\")) {\n push_cfunction(L, gfxtextbody_update_gpu);\n } else if (!::strcmp(key, \"append\")) {\n push_cfunction(L, gfxtextbody_append);\n\n } else if (!::strcmp(key, \"destroyed\")) {\n lua_pushboolean(L, self->destroyed());\n } else if (!::strcmp(key, \"destroy\")) {\n push_cfunction(L, gfxtextbody_destroy);\n } else {\n EXCEPT << \"Not a readable GfxTextBody member: \" << std::string(key) << ENDL;\n }\n return 1;\nTRY_END\n}\n\n\nstatic int gfxtextbody_newindex (lua_State *L)\n{\nTRY_START\n check_args(L, 3);\n GET_UD_MACRO(GfxTextBodyPtr, self, 1, GFXTEXTBODY_TAG);\n const char *key = luaL_checkstring(L, 2);\n if (!::strcmp(key, \"localPosition\")) {\n Vector3 v = check_v3(L, 3);\n self->setLocalPosition(v);\n } else if (!::strcmp(key, \"localOrientation\")) {\n Quaternion v = check_quat(L, 3);\n self->setLocalOrientation(v);\n } else if (!::strcmp(key, \"localScale\")) {\n Vector3 v = check_v3(L, 3);\n self->setLocalScale(v);\n } else if (!::strcmp(key, \"fade\")) {\n float v = check_float(L, 3);\n self->setFade(v);\n } else if (!::strcmp(key, \"parent\")) {\n if (lua_isnil(L, 3)) {\n self->setParent(GfxNodePtr(NULL));\n } else {\n GfxNodePtr par = check_gfx_node(L, 3);\n self->setParent(par);\n }\n } else if (!::strcmp(key, \"emissiveEnabled\")) {\n bool v = check_bool(L, 3);\n self->setEmissiveEnabled(v);\n } else if (!::strcmp(key, \"material\")) {\n const char *mname = luaL_checkstring(L, 3);\n GfxMaterial *m = gfx_material_get(mname);\n self->setMaterial(m);\n } else if (!::strcmp(key, \"castShadows\")) {\n bool v = check_bool(L, 3);\n self->setCastShadows(v);\n } else if (!::strcmp(key,\"font\")) {\n std::string v = check_string(L, 3);\n GfxFont *font = gfx_font_get(v);\n if (font == NULL) my_lua_error(L, \"Font does not exist \\\"\"+v+\"\\\"\");\n self->setFont(font);\n } else if (!::strcmp(key,\"text\")) {\n std::string v = check_string(L, 3);\n self->clear();\n self->append(v, Vector3(0, 0, 0), 1, Vector3(0, 0, 0), 1);\n self->updateGpu();\n } else if (!::strcmp(key, \"enabled\")) {\n bool v = check_bool(L, 3);\n self->setEnabled(v);\n } else {\n EXCEPT << \"Not a writeable GfxTextBody member: \" << std::string(key) << ENDL;\n }\n return 0;\nTRY_END\n}\n\nEQ_MACRO(GfxTextBodyPtr, gfxtextbody, GFXTEXTBODY_TAG)\n\nMT_MACRO_NEWINDEX(gfxtextbody);\n\n//}}}\n\n\n// GFXDECAL ============================================================== {{{\n\nvoid push_gfxdecal (lua_State *L, const GfxDecalPtr &self)\n{\n if (self.isNull())\n lua_pushnil(L);\n else\n push(L,new GfxDecalPtr(self),GFXDECAL_TAG);\n}\n\nGC_MACRO(GfxDecalPtr,gfxdecal,GFXDECAL_TAG)\n\nstatic int gfxdecal_destroy (lua_State *L)\n{\nTRY_START\n check_args(L,1);\n GET_UD_MACRO(GfxDecalPtr,self,1,GFXDECAL_TAG);\n self->destroy();\n return 0;\nTRY_END\n}\n\n\n\nTOSTRING_SMART_PTR_MACRO (gfxdecal,GfxDecalPtr,GFXDECAL_TAG)\n\n\nstatic int gfxdecal_index (lua_State *L)\n{\nTRY_START\n check_args(L,2);\n GET_UD_MACRO(GfxDecalPtr,self,1,GFXDECAL_TAG);\n const char *key = luaL_checkstring(L,2);\n if (!::strcmp(key,\"localPosition\")) {\n push_v3(L, self->getLocalPosition());\n } else if (!::strcmp(key,\"localOrientation\")) {\n push_quat(L, self->getLocalOrientation());\n } else if (!::strcmp(key,\"localScale\")) {\n push_v3(L, self->getLocalScale());\n } else if (!::strcmp(key,\"material\")) {\n GfxMaterial *m = self->getMaterial();\n lua_pushstring(L, m->name.c_str());\n } else if (!::strcmp(key,\"fade\")) {\n lua_pushnumber(L, self->getFade());\n } else if (!::strcmp(key,\"enabled\")) {\n lua_pushboolean(L, self->isEnabled());\n } else if (!::strcmp(key,\"parent\")) {\n push_gfx_node_concrete(L, self->getParent());\n\n } else if (!::strcmp(key,\"destroyed\")) {\n lua_pushboolean(L,self->destroyed());\n } else if (!::strcmp(key,\"destroy\")) {\n push_cfunction(L,gfxdecal_destroy);\n } else {\n my_lua_error(L,\"Not a readable GfxDecal member: \"+std::string(key));\n }\n return 1;\nTRY_END\n}\n\n\nstatic int gfxdecal_newindex (lua_State *L)\n{\nTRY_START\n check_args(L,3);\n GET_UD_MACRO(GfxDecalPtr,self,1,GFXDECAL_TAG);\n const char *key = luaL_checkstring(L,2);\n if (!::strcmp(key,\"localPosition\")) {\n Vector3 v = check_v3(L,3);\n self->setLocalPosition(v);\n } else if (!::strcmp(key,\"localOrientation\")) {\n Quaternion v = check_quat(L,3);\n self->setLocalOrientation(v);\n } else if (!::strcmp(key,\"localScale\")) {\n Vector3 v = check_v3(L,3);\n self->setLocalScale(v);\n } else if (!::strcmp(key,\"material\")) {\n const char *m_name = luaL_checkstring(L,3);\n GfxMaterial *m = gfx_material_get(m_name);\n self->setMaterial(m);\n } else if (!::strcmp(key,\"fade\")) {\n float v = check_float(L,3);\n self->setFade(v);\n } else if (!::strcmp(key,\"enabled\")) {\n bool v = check_bool(L,3);\n self->setEnabled(v);\n } else if (!::strcmp(key,\"parent\")) {\n if (lua_isnil(L,3)) {\n self->setParent(GfxNodePtr(NULL));\n } else {\n GfxNodePtr par = check_gfx_node(L, 3);\n self->setParent(par);\n }\n } else {\n my_lua_error(L,\"Not a writeable GfxDecal member: \"+std::string(key));\n }\n return 0;\nTRY_END\n}\n\nEQ_MACRO(GfxDecalPtr,gfxdecal,GFXDECAL_TAG)\n\nMT_MACRO_NEWINDEX(gfxdecal);\n\n//}}}\n\n\n// GFXTRACERBODY ============================================================== {{{\n\nvoid push_gfxtracerbody (lua_State *L, const SharedPtr<GfxTracerBody> &self)\n{\n if (self.isNull())\n lua_pushnil(L);\n else\n push(L,new SharedPtr<GfxTracerBody>(self),GFXTRACERBODY_TAG);\n}\n\nGC_MACRO(SharedPtr<GfxTracerBody>,gfxtracerbody,GFXTRACERBODY_TAG)\n\nstatic int gfxtracerbody_pump (lua_State *L)\n{\nTRY_START\n check_args(L,1);\n GET_UD_MACRO(SharedPtr<GfxTracerBody>,self,1,GFXTRACERBODY_TAG);\n self->pump();\n return 0;\nTRY_END\n}\n\nstatic int gfxtracerbody_destroy (lua_State *L)\n{\nTRY_START\n check_args(L,1);\n GET_UD_MACRO(SharedPtr<GfxTracerBody>,self,1,GFXTRACERBODY_TAG);\n self->destroy();\n return 0;\nTRY_END\n}\n\nTOSTRING_SMART_PTR_MACRO (gfxtracerbody,SharedPtr<GfxTracerBody>,GFXTRACERBODY_TAG)\n\nstatic int gfxtracerbody_index (lua_State *L)\n{\nTRY_START\n check_args(L,2);\n GET_UD_MACRO(SharedPtr<GfxTracerBody>,self,1,GFXTRACERBODY_TAG);\n const char *key = luaL_checkstring(L,2);\n if (!::strcmp(key,\"localPosition\")) {\n push_v3(L, self->getLocalPosition());\n } else if (!::strcmp(key,\"localOrientation\")) {\n push_quat(L, self->getLocalOrientation());\n } else if (!::strcmp(key,\"localScale\")) {\n push_v3(L, self->getLocalScale());\n } else if (!::strcmp(key,\"texture\")) {\n GfxTextureDiskResource *d = self->getTexture();\n if (d == NULL) {\n lua_pushnil(L);\n } else {\n push_string(L, d->getName());\n }\n\n } else if (!::strcmp(key,\"fade\")) {\n lua_pushnumber(L, self->getFade());\n } else if (!::strcmp(key,\"enabled\")) {\n lua_pushboolean(L, self->isEnabled());\n } else if (!::strcmp(key,\"parent\")) {\n push_gfx_node_concrete(L, self->getParent());\n\n } else if (!::strcmp(key,\"diffuseColour\")) {\n push_v3(L, self->getDiffuseColour());\n } else if (!::strcmp(key,\"emissiveColour\")) {\n push_v3(L, self->getEmissiveColour());\n } else if (!::strcmp(key,\"alpha\")) {\n lua_pushnumber(L, self->getAlpha());\n } else if (!::strcmp(key,\"size\")) {\n lua_pushnumber(L, self->getSize());\n } else if (!::strcmp(key,\"length\")) {\n lua_pushnumber(L, self->getLength());\n } else if (!::strcmp(key,\"pump\")) {\n push_cfunction(L,gfxtracerbody_pump);\n\n } else if (!::strcmp(key,\"destroyed\")) {\n lua_pushboolean(L,self->destroyed());\n } else if (!::strcmp(key,\"destroy\")) {\n push_cfunction(L,gfxtracerbody_destroy);\n } else {\n my_lua_error(L,\"Not a readable GfxTracerBody member: \"+std::string(key));\n }\n return 1;\nTRY_END\n}\n\n\nstatic int gfxtracerbody_newindex (lua_State *L)\n{\nTRY_START\n check_args(L,3);\n GET_UD_MACRO(SharedPtr<GfxTracerBody>,self,1,GFXTRACERBODY_TAG);\n const char *key = luaL_checkstring(L,2);\n if (!::strcmp(key,\"localPosition\")) {\n Vector3 v = check_v3(L,3);\n self->setLocalPosition(v);\n } else if (!::strcmp(key,\"localOrientation\")) {\n Quaternion v = check_quat(L,3);\n self->setLocalOrientation(v);\n } else if (!::strcmp(key,\"localScale\")) {\n Vector3 v = check_v3(L,3);\n self->setLocalScale(v);\n } else if (!::strcmp(key,\"texture\")) {\n if (lua_isnil(L,3)) {\n self->setTexture(DiskResourcePtr<GfxTextureDiskResource>());\n } else {\n std::string v = check_path(L,3);\n auto d = disk_resource_use<GfxTextureDiskResource>(v);\n if (d == nullptr) my_lua_error(L, \"Resource not a texture: \\\"\" + v + \"\\\"\");\n self->setTexture(d);\n }\n } else if (!::strcmp(key,\"emissiveColour\")) {\n Vector3 v = check_v3(L,3);\n self->setEmissiveColour(v);\n } else if (!::strcmp(key,\"diffuseColour\")) {\n Vector3 v = check_v3(L,3);\n self->setDiffuseColour(v);\n } else if (!::strcmp(key,\"alpha\")) {\n float v = check_float(L,3);\n self->setAlpha(v);\n } else if (!::strcmp(key,\"size\")) {\n float v = check_float(L,3);\n self->setSize(v);\n } else if (!::strcmp(key,\"fade\")) {\n float v = check_float(L,3);\n self->setFade(v);\n } else if (!::strcmp(key,\"length\")) {\n float v = check_float(L, 3);\n self->setLength(v);\n } else if (!::strcmp(key,\"enabled\")) {\n bool v = check_bool(L,3);\n self->setEnabled(v);\n } else if (!::strcmp(key,\"parent\")) {\n if (lua_isnil(L,3)) {\n self->setParent(GfxNodePtr(NULL));\n } else {\n GfxNodePtr par = check_gfx_node(L, 3);\n self->setParent(par);\n }\n } else {\n my_lua_error(L,\"Not a writeable GfxTracerBody member: \"+std::string(key));\n }\n return 0;\nTRY_END\n}\n\nEQ_MACRO(SharedPtr<GfxTracerBody>,gfxtracerbody,GFXTRACERBODY_TAG)\n\nMT_MACRO_NEWINDEX(gfxtracerbody);\n\n//}}}\n\n\n// GFXRANGEDINSTANCES ============================================================== {{{\n\nvoid push_gfxrangedinstances (lua_State *L, const GfxRangedInstancesPtr &self)\n{\n if (self.isNull())\n lua_pushnil(L);\n else\n push(L,new GfxRangedInstancesPtr(self),GFXRANGEDINSTANCES_TAG);\n}\n\nGC_MACRO(GfxRangedInstancesPtr,gfxrangedinstances,GFXRANGEDINSTANCES_TAG)\n\nstatic int gfxrangedinstances_destroy (lua_State *L)\n{\nTRY_START\n check_args(L,1);\n GET_UD_MACRO(GfxRangedInstancesPtr,self,1,GFXRANGEDINSTANCES_TAG);\n self->destroy();\n return 0;\nTRY_END\n}\n\nstatic int gfxrangedinstances_add (lua_State *L)\n{\nTRY_START\n check_args(L,4);\n GET_UD_MACRO(GfxRangedInstancesPtr,self,1,GFXRANGEDINSTANCES_TAG);\n Vector3 v = check_v3(L,2);\n Quaternion q = check_quat(L,3);\n float f = check_float(L,4);\n unsigned index = self->add(v, q, f);\n lua_pushnumber(L, index);\n return 1;\nTRY_END\n}\n\nstatic int gfxrangedinstances_update (lua_State *L)\n{\nTRY_START\n check_args(L,5);\n GET_UD_MACRO(GfxRangedInstancesPtr,self,1,GFXRANGEDINSTANCES_TAG);\n unsigned index = check_t<unsigned>(L, 2);\n Vector3 v = check_v3(L,3);\n Quaternion q = check_quat(L,4);\n float f = check_float(L,5);\n self->update(index, v, q, f);\n return 0;\nTRY_END\n}\n\nstatic int gfxrangedinstances_del (lua_State *L)\n{\nTRY_START\n check_args(L,2);\n GET_UD_MACRO(GfxRangedInstancesPtr,self,1,GFXRANGEDINSTANCES_TAG);\n unsigned index = check_t<unsigned>(L, 2);\n self->del(index);\n return 0;\nTRY_END\n}\n\n\n\nTOSTRING_SMART_PTR_MACRO (gfxrangedinstances,GfxRangedInstancesPtr,GFXRANGEDINSTANCES_TAG)\n\n\nstatic int gfxrangedinstances_index (lua_State *L)\n{\nTRY_START\n check_args(L,2);\n GET_UD_MACRO(GfxRangedInstancesPtr,self,1,GFXRANGEDINSTANCES_TAG);\n const char *key = luaL_checkstring(L,2);\n if (!::strcmp(key,\"castShadows\")) {\n lua_pushboolean(L, self->getCastShadows());\n } else if (!::strcmp(key,\"destroyed\")) {\n lua_pushboolean(L,self->destroyed());\n } else if (!::strcmp(key,\"destroy\")) {\n push_cfunction(L,gfxrangedinstances_destroy);\n } else if (!::strcmp(key,\"parent\")) {\n push_gfx_node_concrete(L, self->getParent());\n } else if (!::strcmp(key,\"add\")) {\n push_cfunction(L,gfxrangedinstances_add);\n } else if (!::strcmp(key,\"update\")) {\n push_cfunction(L,gfxrangedinstances_update);\n } else if (!::strcmp(key,\"del\")) {\n push_cfunction(L,gfxrangedinstances_del);\n } else if (!::strcmp(key,\"enabled\")) {\n lua_pushboolean(L, self->isEnabled());\n } else if (!::strcmp(key,\"castShadows\")) {\n lua_pushboolean(L, self->getCastShadows());\n } else if (!::strcmp(key,\"instances\")) {\n lua_pushnumber(L, self->getInstances());\n } else if (!::strcmp(key,\"trianglesPerInstance\")) {\n lua_pushnumber(L, self->getTrianglesPerInstance());\n } else if (!::strcmp(key,\"triangles\")) {\n lua_pushnumber(L, self->getTrianglesPerInstance() * self->getInstances());\n } else if (!::strcmp(key,\"batches\")) {\n lua_pushnumber(L, self->getBatches());\n } else if (!::strcmp(key,\"meshName\")) {\n push_string(L,self->getMeshName());\n } else {\n my_lua_error(L,\"Not a readable GfxRangedInstance member: \"+std::string(key));\n }\n return 1;\nTRY_END\n}\n\n\nstatic int gfxrangedinstances_newindex (lua_State *L)\n{\nTRY_START\n check_args(L,3);\n GET_UD_MACRO(GfxRangedInstancesPtr,self,1,GFXRANGEDINSTANCES_TAG);\n const char *key = luaL_checkstring(L,2);\n if (!::strcmp(key,\"castShadows\")) {\n bool v = check_bool(L,3);\n self->setCastShadows(v);\n } else if (!::strcmp(key,\"parent\")) {\n if (lua_isnil(L,3)) {\n self->setParent(GfxNodePtr(NULL));\n } else {\n GfxNodePtr par = check_gfx_node(L, 3);\n self->setParent(par);\n }\n } else if (!::strcmp(key,\"enabled\")) {\n bool v = check_bool(L,3);\n self->setEnabled(v);\n } else if (!::strcmp(key,\"castShadows\")) {\n bool v = check_bool(L,3);\n self->setCastShadows(v);\n } else {\n my_lua_error(L,\"Not a writeable GfxRangedInstance member: \"+std::string(key));\n }\n return 0;\nTRY_END\n}\n\nEQ_MACRO(GfxRangedInstancesPtr,gfxrangedinstances,GFXRANGEDINSTANCES_TAG)\n\nMT_MACRO_NEWINDEX(gfxrangedinstances);\n\n//}}}\n\n\n// GFXINSTANCES ============================================================== {{{\n\nvoid push_gfxinstances (lua_State *L, const GfxInstancesPtr &self)\n{\n if (self.isNull())\n lua_pushnil(L);\n else\n push(L,new GfxInstancesPtr(self),GFXINSTANCES_TAG);\n}\n\nGC_MACRO(GfxInstancesPtr,gfxinstances,GFXINSTANCES_TAG)\n\nstatic int gfxinstances_destroy (lua_State *L)\n{\nTRY_START\n check_args(L,1);\n GET_UD_MACRO(GfxInstancesPtr,self,1,GFXINSTANCES_TAG);\n self->destroy();\n return 0;\nTRY_END\n}\n\nstatic int gfxinstances_add (lua_State *L)\n{\nTRY_START\n check_args(L,4);\n GET_UD_MACRO(GfxInstancesPtr,self,1,GFXINSTANCES_TAG);\n Vector3 v = check_v3(L,2);\n Quaternion q = check_quat(L,3);\n float f = check_float(L,4);\n unsigned index = self->add(v, q, f);\n lua_pushnumber(L, index);\n return 1;\nTRY_END\n}\n\nstatic int gfxinstances_update (lua_State *L)\n{\nTRY_START\n check_args(L,5);\n GET_UD_MACRO(GfxInstancesPtr,self,1,GFXINSTANCES_TAG);\n unsigned index = check_t<unsigned>(L, 2);\n Vector3 v = check_v3(L,3);\n Quaternion q = check_quat(L,4);\n float f = check_float(L,5);\n self->update(index, v, q, f);\n return 0;\nTRY_END\n}\n\nstatic int gfxinstances_del (lua_State *L)\n{\nTRY_START\n check_args(L,2);\n GET_UD_MACRO(GfxInstancesPtr,self,1,GFXINSTANCES_TAG);\n unsigned index = check_t<unsigned>(L, 2);\n self->del(index);\n return 0;\nTRY_END\n}\n\n\n\nTOSTRING_SMART_PTR_MACRO (gfxinstances,GfxInstancesPtr,GFXINSTANCES_TAG)\n\n\nstatic int gfxinstances_index (lua_State *L)\n{\nTRY_START\n check_args(L,2);\n GET_UD_MACRO(GfxInstancesPtr,self,1,GFXINSTANCES_TAG);\n const char *key = luaL_checkstring(L,2);\n if (!::strcmp(key,\"castShadows\")) {\n lua_pushboolean(L, self->getCastShadows());\n } else if (!::strcmp(key,\"destroyed\")) {\n lua_pushboolean(L,self->destroyed());\n } else if (!::strcmp(key,\"destroy\")) {\n push_cfunction(L,gfxinstances_destroy);\n } else if (!::strcmp(key,\"parent\")) {\n push_gfx_node_concrete(L, self->getParent());\n } else if (!::strcmp(key,\"add\")) {\n push_cfunction(L,gfxinstances_add);\n } else if (!::strcmp(key,\"update\")) {\n push_cfunction(L,gfxinstances_update);\n } else if (!::strcmp(key,\"del\")) {\n push_cfunction(L,gfxinstances_del);\n } else if (!::strcmp(key,\"enabled\")) {\n lua_pushboolean(L, self->isEnabled());\n } else if (!::strcmp(key,\"castShadows\")) {\n lua_pushboolean(L, self->getCastShadows());\n } else if (!::strcmp(key,\"instances\")) {\n lua_pushnumber(L, self->getInstances());\n } else if (!::strcmp(key,\"trianglesPerInstance\")) {\n lua_pushnumber(L, self->getTrianglesPerInstance());\n } else if (!::strcmp(key,\"triangles\")) {\n lua_pushnumber(L, self->getTrianglesPerInstance() * self->getInstances());\n } else if (!::strcmp(key,\"batches\")) {\n lua_pushnumber(L, self->getBatches());\n } else if (!::strcmp(key,\"meshName\")) {\n push_string(L,self->getMeshName());\n\n } else {\n my_lua_error(L,\"Not a readable GfxInstance member: \"+std::string(key));\n }\n return 1;\nTRY_END\n}\n\n\nstatic int gfxinstances_newindex (lua_State *L)\n{\nTRY_START\n check_args(L,3);\n GET_UD_MACRO(GfxInstancesPtr,self,1,GFXINSTANCES_TAG);\n const char *key = luaL_checkstring(L,2);\n if (!::strcmp(key,\"castShadows\")) {\n bool v = check_bool(L,3);\n self->setCastShadows(v);\n } else if (!::strcmp(key,\"parent\")) {\n if (lua_isnil(L,3)) {\n self->setParent(GfxNodePtr(NULL));\n } else {\n GfxNodePtr par = check_gfx_node(L, 3);\n self->setParent(par);\n }\n } else if (!::strcmp(key,\"enabled\")) {\n bool v = check_bool(L,3);\n self->setEnabled(v);\n } else if (!::strcmp(key,\"castShadows\")) {\n bool v = check_bool(L,3);\n self->setCastShadows(v);\n } else {\n my_lua_error(L,\"Not a writeable GfxInstance member: \"+std::string(key));\n }\n return 0;\nTRY_END\n}\n\nEQ_MACRO(GfxInstancesPtr,gfxinstances,GFXINSTANCES_TAG)\n\nMT_MACRO_NEWINDEX(gfxinstances);\n\n//}}}\n\n\n// GFXSKYBODY ============================================================== {{{\n\nvoid push_gfxskybody (lua_State *L, const GfxSkyBodyPtr &self)\n{\n if (self.isNull())\n lua_pushnil(L);\n else\n push(L,new GfxSkyBodyPtr(self),GFXSKYBODY_TAG);\n}\n\nGC_MACRO(GfxSkyBodyPtr,gfxskybody,GFXSKYBODY_TAG)\n\nstatic int gfxskybody_destroy (lua_State *L)\n{\nTRY_START\n check_args(L,1);\n GET_UD_MACRO(GfxSkyBodyPtr,self,1,GFXSKYBODY_TAG);\n self->destroy();\n return 0;\nTRY_END\n}\n\nstatic int gfxskybody_get_materials (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n GET_UD_MACRO(GfxSkyBodyPtr, self, 1, GFXSKYBODY_TAG);\n for (unsigned i=0 ; i<self->getNumSubMeshes() ; ++i) {\n GfxSkyMaterial *m = self->getMaterial(i);\n push_string(L, m->name);\n }\n return self->getNumSubMeshes();\nTRY_END\n}\n\nstatic int gfxskybody_set_material (lua_State *L)\n{\nTRY_START\n check_args(L, 3);\n GET_UD_MACRO(GfxSkyBodyPtr, self, 1, GFXSKYBODY_TAG);\n const std::string &n = luaL_checkstring(L, 2);\n unsigned n2 = self->getSubMeshByOriginalMaterialName(n);\n const char *mname = luaL_checkstring(L, 3);\n GfxSkyMaterial *m = gfx_sky_material_get(mname);\n self->setMaterial(n2, m);\n return 0;\nTRY_END\n}\n\nstatic int gfxskybody_set_all_materials (lua_State *L)\n{\nTRY_START\n check_args(L, 2);\n GET_UD_MACRO(GfxSkyBodyPtr, self, 1, GFXSKYBODY_TAG);\n const char *mname = luaL_checkstring(L, 2);\n GfxSkyMaterial *m = gfx_sky_material_get(mname);\n for (unsigned i=0 ; i<self->getNumSubMeshes() ; ++i) {\n self->setMaterial(i, m);\n }\n return 0;\nTRY_END\n}\n\n\n\nTOSTRING_SMART_PTR_MACRO (gfxskybody,GfxSkyBodyPtr,GFXSKYBODY_TAG)\n\n\nstatic int gfxskybody_index (lua_State *L)\n{\nTRY_START\n check_args(L,2);\n GET_UD_MACRO(GfxSkyBodyPtr,self,1,GFXSKYBODY_TAG);\n const char *key = luaL_checkstring(L,2);\n if (!::strcmp(key,\"orientation\")) {\n push_quat(L, self->getOrientation());\n } else if (!::strcmp(key,\"zOrder\")) {\n lua_pushnumber(L, self->getZOrder());\n\n } else if (!::strcmp(key,\"enabled\")) {\n lua_pushboolean(L, self->isEnabled());\n\n } else if (!::strcmp(key,\"meshName\")) {\n push_string(L, self->getMeshName());\n\n } else if (!::strcmp(key,\"getMaterials\")) {\n push_cfunction(L,gfxskybody_get_materials);\n } else if (!::strcmp(key,\"setMaterial\")) {\n push_cfunction(L,gfxskybody_set_material);\n } else if (!::strcmp(key,\"setAllMaterials\")) {\n push_cfunction(L,gfxskybody_set_all_materials);\n\n } else if (!::strcmp(key,\"destroyed\")) {\n lua_pushboolean(L,self->destroyed());\n } else if (!::strcmp(key,\"destroy\")) {\n push_cfunction(L,gfxskybody_destroy);\n } else {\n my_lua_error(L,\"Not a readable GfxSkyBody member: \"+std::string(key));\n }\n return 1;\nTRY_END\n}\n\n\nstatic int gfxskybody_newindex (lua_State *L)\n{\nTRY_START\n check_args(L,3);\n GET_UD_MACRO(GfxSkyBodyPtr,self,1,GFXSKYBODY_TAG);\n const char *key = luaL_checkstring(L,2);\n if (!::strcmp(key,\"orientation\")) {\n Quaternion v = check_quat(L,3);\n self->setOrientation(v);\n } else if (!::strcmp(key,\"zOrder\")) {\n unsigned char v = check_int(L,3,0,255);\n self->setZOrder(v);\n } else if (!::strcmp(key,\"enabled\")) {\n bool v = check_bool(L,3);\n self->setEnabled(v);\n } else {\n my_lua_error(L,\"Not a writeable GfxSkyBody member: \"+std::string(key));\n }\n return 0;\nTRY_END\n}\n\nEQ_MACRO(GfxBodyPtr,gfxskybody,GFXSKYBODY_TAG)\n\nMT_MACRO_NEWINDEX(gfxskybody);\n\n//}}}\n\n\n// GFXLIGHT ============================================================== {{{\n\nvoid push_gfxlight (lua_State *L, const GfxLightPtr &self)\n{\n if (self.isNull())\n lua_pushnil(L);\n else\n push(L,new GfxLightPtr(self),GFXLIGHT_TAG);\n}\n\nGC_MACRO(GfxLightPtr,gfxlight,GFXLIGHT_TAG)\n\nstatic int gfxlight_destroy (lua_State *L)\n{\nTRY_START\n check_args(L,1);\n GET_UD_MACRO(GfxLightPtr,self,1,GFXLIGHT_TAG);\n self->destroy();\n return 0;\nTRY_END\n}\n\n\n\nTOSTRING_SMART_PTR_MACRO (gfxlight,GfxLightPtr,GFXLIGHT_TAG)\n\n\nstatic int gfxlight_index (lua_State *L)\n{\nTRY_START\n check_args(L,2);\n GET_UD_MACRO(GfxLightPtr,self,1,GFXLIGHT_TAG);\n const char *key = luaL_checkstring(L,2);\n if (!::strcmp(key,\"localPosition\")) {\n push_v3(L, self->getLocalPosition());\n } else if (!::strcmp(key,\"localOrientation\")) {\n push_quat(L, self->getLocalOrientation());\n } else if (!::strcmp(key,\"localScale\")) {\n push_v3(L, self->getLocalScale());\n } else if (!::strcmp(key,\"diffuseColour\")) {\n push_v3(L, self->getDiffuseColour());\n } else if (!::strcmp(key,\"specularColour\")) {\n push_v3(L, self->getSpecularColour());\n } else if (!::strcmp(key,\"coronaSize\")) {\n lua_pushnumber(L, self->getCoronaSize());\n } else if (!::strcmp(key,\"coronaLocalPosition\")) {\n push_v3(L, self->getCoronaLocalPosition());\n } else if (!::strcmp(key,\"coronaColour\")) {\n push_v3(L, self->getCoronaColour());\n } else if (!::strcmp(key,\"range\")) {\n lua_pushnumber(L, self->getRange());\n } else if (!::strcmp(key,\"fade\")) {\n lua_pushnumber(L, self->getFade());\n } else if (!::strcmp(key,\"innerAngle\")) {\n lua_pushnumber(L, self->getInnerAngle().inDegrees());\n } else if (!::strcmp(key,\"outerAngle\")) {\n lua_pushnumber(L, self->getOuterAngle().inDegrees());\n } else if (!::strcmp(key,\"coronaInnerAngle\")) {\n lua_pushnumber(L, self->getCoronaInnerAngle().inDegrees());\n } else if (!::strcmp(key,\"coronaOuterAngle\")) {\n lua_pushnumber(L, self->getCoronaOuterAngle().inDegrees());\n } else if (!::strcmp(key,\"enabled\")) {\n lua_pushboolean(L, self->isEnabled());\n } else if (!::strcmp(key,\"parent\")) {\n push_gfx_node_concrete(L, self->getParent());\n\n } else if (!::strcmp(key,\"destroyed\")) {\n lua_pushboolean(L,self->destroyed());\n } else if (!::strcmp(key,\"destroy\")) {\n push_cfunction(L,gfxlight_destroy);\n } else {\n my_lua_error(L,\"Not a readable GfxLight member: \"+std::string(key));\n }\n return 1;\nTRY_END\n}\n\n\nstatic int gfxlight_newindex (lua_State *L)\n{\nTRY_START\n check_args(L,3);\n GET_UD_MACRO(GfxLightPtr,self,1,GFXLIGHT_TAG);\n const char *key = luaL_checkstring(L,2);\n if (!::strcmp(key,\"localPosition\")) {\n Vector3 v = check_v3(L,3);\n self->setLocalPosition(v);\n } else if (!::strcmp(key,\"localOrientation\")) {\n Quaternion v = check_quat(L,3);\n self->setLocalOrientation(v);\n } else if (!::strcmp(key,\"localScale\")) {\n Vector3 v = check_v3(L,3);\n self->setLocalScale(v);\n } else if (!::strcmp(key,\"diffuseColour\")) {\n Vector3 v = check_v3(L,3);\n self->setDiffuseColour(v);\n } else if (!::strcmp(key,\"specularColour\")) {\n Vector3 v = check_v3(L,3);\n self->setSpecularColour(v);\n } else if (!::strcmp(key,\"coronaSize\")) {\n float v = check_float(L,3);\n self->setCoronaSize(v);\n } else if (!::strcmp(key,\"coronaLocalPosition\")) {\n Vector3 v = check_v3(L,3);\n self->setCoronaLocalPosition(v);\n } else if (!::strcmp(key,\"coronaColour\")) {\n Vector3 v = check_v3(L,3);\n self->setCoronaColour(v);\n } else if (!::strcmp(key,\"fade\")) {\n float v = check_float(L,3);\n self->setFade(v);\n } else if (!::strcmp(key,\"range\")) {\n float v = check_float(L,3);\n self->setRange(v);\n } else if (!::strcmp(key,\"innerAngle\")) {\n float v = check_float(L,3);\n self->setInnerAngle(Degree(v));\n } else if (!::strcmp(key,\"outerAngle\")) {\n float v = check_float(L,3);\n self->setOuterAngle(Degree(v));\n } else if (!::strcmp(key,\"coronaInnerAngle\")) {\n float v = check_float(L,3);\n self->setCoronaInnerAngle(Degree(v));\n } else if (!::strcmp(key,\"coronaOuterAngle\")) {\n float v = check_float(L,3);\n self->setCoronaOuterAngle(Degree(v));\n } else if (!::strcmp(key,\"enabled\")) {\n bool v = check_bool(L,3);\n self->setEnabled(v);\n } else if (!::strcmp(key,\"parent\")) {\n if (lua_isnil(L,3)) {\n self->setParent(GfxNodePtr(NULL));\n } else {\n GfxNodePtr par = check_gfx_node(L, 3);\n self->setParent(par);\n }\n } else {\n my_lua_error(L,\"Not a writeable GfxLight member: \"+std::string(key));\n }\n return 0;\nTRY_END\n}\n\nEQ_MACRO(GfxLightPtr,gfxlight,GFXLIGHT_TAG)\n\nMT_MACRO_NEWINDEX(gfxlight);\n\n//}}}\n\n\n// GFXSPRITEBODY ============================================================== {{{\n\nvoid push_gfxspritebody (lua_State *L, const GfxSpriteBodyPtr &self)\n{\n if (self.isNull())\n lua_pushnil(L);\n else\n push(L, new GfxSpriteBodyPtr(self), GFXSPRITEBODY_TAG);\n}\n\nGC_MACRO(GfxSpriteBodyPtr, gfxspritebody, GFXSPRITEBODY_TAG)\n\nstatic int gfxspritebody_destroy (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n GET_UD_MACRO(GfxSpriteBodyPtr, self, 1, GFXSPRITEBODY_TAG);\n self->destroy();\n return 0;\nTRY_END\n}\n\n\n\nTOSTRING_SMART_PTR_MACRO (gfxspritebody, GfxSpriteBodyPtr, GFXSPRITEBODY_TAG)\n\n\nstatic int gfxspritebody_index (lua_State *L)\n{\nTRY_START\n check_args(L, 2);\n GET_UD_MACRO(GfxSpriteBodyPtr, self, 1, GFXSPRITEBODY_TAG);\n const char *key = luaL_checkstring(L, 2);\n if (!::strcmp(key, \"localPosition\")) {\n push_v3(L, self->getLocalPosition());\n } else if (!::strcmp(key, \"localOrientation\")) {\n push_quat(L, self->getLocalOrientation());\n } else if (!::strcmp(key, \"localScale\")) {\n push_v3(L, self->getLocalScale());\n } else if (!::strcmp(key, \"diffuse\")) {\n push_v3(L, self->getDiffuse());\n } else if (!::strcmp(key, \"emissive\")) {\n push_v3(L, self->getEmissive());\n } else if (!::strcmp(key, \"dimensions\")) {\n push_v3(L, self->getDimensions());\n } else if (!::strcmp(key, \"angle\")) {\n lua_pushnumber(L, self->getAngle());\n } else if (!::strcmp(key, \"alpha\")) {\n lua_pushnumber(L, self->getAlpha());\n } else if (!::strcmp(key, \"fade\")) {\n lua_pushnumber(L, self->getFade());\n } else if (!::strcmp(key, \"enabled\")) {\n lua_pushboolean(L, self->isEnabled());\n } else if (!::strcmp(key, \"parent\")) {\n push_gfx_node_concrete(L, self->getParent());\n\n } else if (!::strcmp(key, \"destroyed\")) {\n lua_pushboolean(L, self->destroyed());\n } else if (!::strcmp(key, \"destroy\")) {\n push_cfunction(L, gfxspritebody_destroy);\n } else {\n my_lua_error(L, \"Not a readable GfxSpriteBody member: \"+std::string(key));\n }\n return 1;\nTRY_END\n}\n\n\nstatic int gfxspritebody_newindex (lua_State *L)\n{\nTRY_START\n check_args(L, 3);\n GET_UD_MACRO(GfxSpriteBodyPtr, self, 1, GFXSPRITEBODY_TAG);\n const char *key = luaL_checkstring(L, 2);\n if (!::strcmp(key, \"localPosition\")) {\n Vector3 v = check_v3(L, 3);\n self->setLocalPosition(v);\n } else if (!::strcmp(key, \"localOrientation\")) {\n Quaternion v = check_quat(L, 3);\n self->setLocalOrientation(v);\n } else if (!::strcmp(key, \"localScale\")) {\n Vector3 v = check_v3(L, 3);\n self->setLocalScale(v);\n } else if (!::strcmp(key, \"diffuse\")) {\n Vector3 v = check_v3(L, 3);\n self->setDiffuse(v);\n } else if (!::strcmp(key, \"emissive\")) {\n Vector3 v = check_v3(L, 3);\n self->setEmissive(v);\n } else if (!::strcmp(key, \"angle\")) {\n float v = check_float(L, 3);\n self->setAngle(v);\n } else if (!::strcmp(key, \"fade\")) {\n float v = check_float(L, 3);\n self->setFade(v);\n } else if (!::strcmp(key, \"alpha\")) {\n float v = check_float(L, 3);\n self->setAlpha(v);\n } else if (!::strcmp(key, \"enabled\")) {\n bool v = check_bool(L, 3);\n self->setEnabled(v);\n } else if (!::strcmp(key, \"parent\")) {\n if (lua_isnil(L, 3)) {\n self->setParent(GfxNodePtr(NULL));\n } else {\n GfxNodePtr par = check_gfx_node(L, 3);\n self->setParent(par);\n }\n } else {\n my_lua_error(L, \"Not a writeable GfxSpriteBody member: \"+std::string(key));\n }\n return 0;\nTRY_END\n}\n\nEQ_MACRO(GfxSpriteBodyPtr, gfxspritebody, GFXSPRITEBODY_TAG)\n\nMT_MACRO_NEWINDEX(gfxspritebody);\n\n//}}}\n\n\n\n// HUDCLASS ================================================================ {{{\n\nvoid push_hudclass (lua_State *L, HudClass *self)\n{\n if (self == NULL) {\n lua_pushnil(L);\n } else {\n push(L,self,HUDCLASS_TAG);\n }\n}\n\nstatic int hudclass_gc (lua_State *L)\n{\nTRY_START\n check_args(L,1);\n GET_UD_MACRO_OFFSET(HudClass,self,1,HUDCLASS_TAG,0);\n return 0;\nTRY_END\n}\n\nTOSTRING_GETNAME_MACRO(hudclass,HudClass,.name,HUDCLASS_TAG)\n\n\n\nstatic int hudclass_index (lua_State *L)\n{\nTRY_START\n check_args(L,2);\n GET_UD_MACRO(HudClass,self,1,HUDCLASS_TAG);\n std::string key = luaL_checkstring(L,2);\n if (key==\"name\") {\n lua_pushstring(L,self.name.c_str());\n } else if (key==\"dump\") {\n self.dump(L);\n } else {\n self.get(L,key);\n }\n return 1;\nTRY_END\n}\n\nstatic int hudclass_newindex (lua_State *L)\n{\nTRY_START\n check_args(L,3);\n GET_UD_MACRO(HudClass,self,1,HUDCLASS_TAG);\n std::string key = luaL_checkstring(L,2);\n\n if (key==\"name\") {\n my_lua_error(L,\"Not a writeable HudClass member: \"+key);\n } else if (key==\"dump\") {\n my_lua_error(L,\"Not a writeable HudClass member: \"+key);\n } else {\n self.set(L,key);\n }\n\n return 0;\nTRY_END\n}\n\nEQ_PTR_MACRO(HudClass,hudclass,HUDCLASS_TAG)\n\nMT_MACRO_NEWINDEX(hudclass);\n\n//}}}\n\n\n// HUDOBJECT ============================================================== {{{\n\nvoid push_hudobj (lua_State *L, HudObject *self)\n{\n if (self==NULL)\n lua_pushnil(L);\n else {\n self->incRefCount();\n push(L,self,HUDOBJECT_TAG);\n }\n}\n\nstatic int hudobj_gc (lua_State *L)\n{\nTRY_START\n check_args(L,1);\n GET_UD_MACRO(HudObject,self,1,HUDOBJECT_TAG);\n self.decRefCount(L);\n return 0;\nTRY_END\n}\n\nstatic int hudobj_set_rect (lua_State *L)\n{\nTRY_START\n check_args(L,5);\n GET_UD_MACRO(HudObject,self,1,HUDOBJECT_TAG);\n float left = check_float(L,2);\n float bottom = check_float(L,3);\n float right = check_float(L,4);\n float top = check_float(L,5);\n left = floorf(left + 0.5);\n bottom = floorf(bottom + 0.5);\n right = floorf(right + 0.5);\n top = floorf(top + 0.5);\n self.setPosition(Vector2((right+left)/2, (top+bottom)/2));\n self.setSize(L, Vector2(right-left, top-bottom));\n return 0;\nTRY_END\n}\n\nstatic int hudobj_destroy (lua_State *L)\n{\nTRY_START\n check_args(L,1);\n GET_UD_MACRO(HudObject,self,1,HUDOBJECT_TAG);\n self.destroy(L);\n return 0;\nTRY_END\n}\n\nstatic int hudobj_tostring (lua_State *L)\n{\n check_args(L, 1);\n GET_UD_MACRO(HudObject, self, 1, HUDOBJECT_TAG);\n std::stringstream ss;\n ss << HUDOBJECT_TAG << \" \\\"\" << self.hudClass->name << \"\\\" \" << static_cast<void*>(&self);\n lua_pushstring(L, ss.str().c_str());\n return 1;\n}\n\nstatic int hudobj_index (lua_State *L)\n{\nTRY_START\n check_args(L,2);\n GET_UD_MACRO(HudObject,self,1,HUDOBJECT_TAG);\n if (lua_type(L,2) == LUA_TSTRING) {\n const char *key = lua_tostring(L,2);\n if (!::strcmp(key,\"orientation\")) {\n lua_pushnumber(L, self.getOrientation().inDegrees());\n } else if (!::strcmp(key,\"position\")) {\n push_v2(L, self.getPosition());\n } else if (!::strcmp(key,\"derivedPosition\")) {\n push_v2(L, self.getDerivedPosition());\n } else if (!::strcmp(key,\"derivedOrientation\")) {\n lua_pushnumber(L, self.getDerivedOrientation().inDegrees());\n } else if (!::strcmp(key,\"size\")) {\n push_v2(L, self.HudObject::getSize());\n } else if (!::strcmp(key,\"sizeSet\")) {\n lua_pushboolean(L, self.getSizeSet());\n } else if (!::strcmp(key,\"bounds\")) {\n push_v2(L, self.getBounds());\n } else if (!::strcmp(key,\"derivedBounds\")) {\n push_v2(L, self.getDerivedBounds());\n } else if (!::strcmp(key,\"setRect\")) {\n push_cfunction(L, hudobj_set_rect);\n } else if (!::strcmp(key,\"zOrder\")) {\n lua_pushnumber(L, self.getZOrder());\n } else if (!::strcmp(key,\"inheritOrientation\")) {\n lua_pushboolean(L, self.getInheritOrientation());\n } else if (!::strcmp(key,\"snapPixels\")) {\n lua_pushboolean(L, self.snapPixels);\n } else if (!::strcmp(key,\"stencil\")) {\n lua_pushboolean(L, self.isStencil());\n } else if (!::strcmp(key,\"stencilTexture\")) {\n GfxTextureDiskResource *d = self.getStencilTexture();\n if (d == NULL) {\n lua_pushnil(L);\n } else {\n push_string(L, d->getName());\n }\n\n } else if (!::strcmp(key,\"colour\")) {\n push_v3(L, self.getColour());\n } else if (!::strcmp(key,\"alpha\")) {\n lua_pushnumber(L, self.getAlpha());\n } else if (!::strcmp(key,\"texture\")) {\n GfxTextureDiskResource *d = self.getTexture();\n if (d == NULL) {\n lua_pushnil(L);\n } else {\n push_string(L, d->getName());\n }\n\n } else if (!::strcmp(key,\"needsInputCallbacks\")) {\n lua_pushboolean(L, self.getNeedsInputCallbacks());\n } else if (!::strcmp(key,\"needsFrameCallbacks\")) {\n lua_pushboolean(L, self.getNeedsFrameCallbacks());\n } else if (!::strcmp(key,\"needsResizedCallbacks\")) {\n lua_pushboolean(L, self.getNeedsResizedCallbacks());\n } else if (!::strcmp(key,\"needsParentResizedCallbacks\")) {\n lua_pushboolean(L, self.getNeedsParentResizedCallbacks());\n\n } else if (!::strcmp(key,\"cornered\")) {\n lua_pushboolean(L, self.isCornered());\n\n } else if (!::strcmp(key,\"enabled\")) {\n lua_pushboolean(L, self.isEnabled());\n\n } else if (!::strcmp(key,\"parent\")) {\n push_hudobj(L, self.getParent());\n } else if (!::strcmp(key,\"class\")) {\n push_hudclass(L, self.hudClass);\n } else if (!::strcmp(key,\"className\")) {\n push_string(L, self.hudClass->name);\n } else if (!::strcmp(key,\"table\")) {\n self.table.push(L);\n\n } else if (!::strcmp(key,\"destroyed\")) {\n lua_pushboolean(L,self.destroyed());\n } else if (!::strcmp(key,\"destroy\")) {\n push_cfunction(L,hudobj_destroy);\n } else {\n if (self.destroyed()) my_lua_error(L,\"HudObject destroyed\");\n self.table.push(L);\n lua_pushstring(L, key);\n lua_rawget(L, -2);\n\n if (!lua_isnil(L,-1)) return 1;\n lua_pop(L,1);\n\n // try class instead\n self.hudClass->get(L,key);\n }\n } else {\n if (self.destroyed()) my_lua_error(L,\"HudObject destroyed\");\n self.table.push(L);\n lua_pushvalue(L, 2);\n lua_rawget(L, -2);\n\n if (!lua_isnil(L,-1)) return 1;\n lua_pop(L,1);\n\n // try class instead\n lua_pushvalue(L,2);\n self.hudClass->get(L);\n }\n return 1;\nTRY_END\n}\n\n\nstatic int hudobj_newindex (lua_State *L)\n{\nTRY_START\n check_args(L,3);\n GET_UD_MACRO(HudObject,self,1,HUDOBJECT_TAG);\n if (lua_type(L,2) == LUA_TSTRING) {\n const char *key = lua_tostring(L,2);\n if (!::strcmp(key,\"orientation\")) {\n float v = check_float(L,3);\n self.setOrientation(Degree(v));\n } else if (!::strcmp(key,\"position\")) {\n Vector2 v = check_v2(L,3);\n self.setPosition(v);\n } else if (!::strcmp(key,\"size\")) {\n Vector2 v = check_v2(L,3);\n self.setSize(L, v);\n } else if (!::strcmp(key,\"inheritOrientation\")) {\n bool v = check_bool(L, 3);\n self.setInheritOrientation(v);\n } else if (!::strcmp(key,\"snapPixels\")) {\n bool v = check_bool(L, 3);\n self.snapPixels = v;\n\n } else if (!::strcmp(key,\"stencil\")) {\n bool v = check_bool(L, 3);\n self.setStencil(v);\n } else if (!::strcmp(key,\"stencilTexture\")) {\n if (lua_isnil(L,3)) {\n self.setStencilTexture(DiskResourcePtr<GfxTextureDiskResource>());\n } else {\n std::string v = check_path(L, 3);\n auto d = disk_resource_use<GfxTextureDiskResource>(v);\n if (d == nullptr) my_lua_error(L, \"Resource not a texture: \\\"\" + v + \"\\\"\");\n self.setStencilTexture(d);\n }\n\n } else if (!::strcmp(key,\"colour\")) {\n Vector3 v = check_v3(L,3);\n self.setColour(v);\n } else if (!::strcmp(key,\"alpha\")) {\n float v = check_float(L,3);\n self.setAlpha(v);\n } else if (!::strcmp(key,\"texture\")) {\n if (lua_isnil(L,3)) {\n self.setTexture(DiskResourcePtr<GfxTextureDiskResource>());\n } else {\n std::string v = check_path(L,3);\n auto d = disk_resource_use<GfxTextureDiskResource>(v);\n if (d == nullptr) my_lua_error(L, \"Resource not a texture: \\\"\" + v + \"\\\"\");\n self.setTexture(d);\n }\n\n } else if (!::strcmp(key,\"parent\")) {\n if (lua_isnil(L,3)) {\n self.setParent(L, NULL);\n } else {\n GET_UD_MACRO(HudObject,v,3,HUDOBJECT_TAG);\n self.setParent(L, &v);\n }\n } else if (!::strcmp(key,\"zOrder\")) {\n unsigned char v = check_int(L,3,0,15);\n self.setZOrder(v);\n\n } else if (!::strcmp(key,\"needsInputCallbacks\")) {\n bool v = check_bool(L,3);\n self.setNeedsInputCallbacks(v);\n } else if (!::strcmp(key,\"needsFrameCallbacks\")) {\n bool v = check_bool(L,3);\n self.setNeedsFrameCallbacks(v);\n } else if (!::strcmp(key,\"needsResizedCallbacks\")) {\n bool v = check_bool(L,3);\n self.setNeedsResizedCallbacks(v);\n } else if (!::strcmp(key,\"needsParentResizedCallbacks\")) {\n bool v = check_bool(L,3);\n self.setNeedsParentResizedCallbacks(v);\n\n } else if (!::strcmp(key,\"cornered\")) {\n bool v = check_bool(L,3);\n self.setCornered(v);\n\n } else if (!::strcmp(key,\"enabled\")) {\n bool v = check_bool(L,3);\n self.setEnabled(v);\n } else if (!::strcmp(key,\"table\")) {\n my_lua_error(L,\"Not a writeable HudObject member: \"+std::string(key));\n } else if (!::strcmp(key,\"class\")) {\n my_lua_error(L,\"Not a writeable HudObject member: \"+std::string(key));\n } else if (!::strcmp(key,\"className\")) {\n my_lua_error(L,\"Not a writeable HudObject member: \"+std::string(key));\n } else if (!::strcmp(key,\"destroy\")) {\n my_lua_error(L,\"Not a writeable HudObject member: \"+std::string(key));\n } else if (!::strcmp(key,\"destroyed\")) {\n my_lua_error(L,\"Not a writeable HudObject member: \"+std::string(key));\n } else {\n if (self.destroyed()) my_lua_error(L,\"HudObject destroyed\");\n\n self.table.push(L);\n lua_pushvalue(L, 2);\n lua_pushvalue(L, 3);\n lua_rawset(L, -3);\n }\n } else {\n if (self.destroyed()) my_lua_error(L,\"HudObject destroyed\");\n\n self.table.push(L);\n lua_pushvalue(L, 2);\n lua_pushvalue(L, 3);\n lua_rawset(L, -3);\n }\n return 0;\nTRY_END\n}\n\nEQ_PTR_MACRO(HudObject, hudobj, HUDOBJECT_TAG)\n\nMT_MACRO_NEWINDEX(hudobj);\n\n//}}}\n\n\n// HUDTEXT ============================================================== {{{\n\nvoid push_hudtext (lua_State *L, HudText *self)\n{\n if (self==NULL)\n lua_pushnil(L);\n else {\n self->incRefCount();\n push(L,self,HUDTEXT_TAG);\n }\n}\n\nstatic int hudtext_gc (lua_State *L)\n{\nTRY_START\n check_args(L,1);\n GET_UD_MACRO(HudText,self,1,HUDTEXT_TAG);\n self.decRefCount();\n return 0;\nTRY_END\n}\n\nstatic int hudtext_destroy (lua_State *L)\n{\nTRY_START\n check_args(L,1);\n GET_UD_MACRO(HudText,self,1,HUDTEXT_TAG);\n self.destroy();\n return 0;\nTRY_END\n}\n\nstatic int hudtext_append (lua_State *L)\n{\nTRY_START\n check_args(L,2);\n GET_UD_MACRO(HudText,self,1,HUDTEXT_TAG);\n std::string str = check_string(L,2);\n self.append(str);\n return 0;\nTRY_END\n}\n\nstatic int hudtext_clear (lua_State *L)\n{\nTRY_START\n check_args(L,1);\n GET_UD_MACRO(HudText,self,1,HUDTEXT_TAG);\n self.clear();\n return 0;\nTRY_END\n}\n\n\n\nTOSTRING_ADDR_MACRO (hudtext,HudText,HUDTEXT_TAG)\n\n\nstatic int hudtext_index (lua_State *L)\n{\nTRY_START\n check_args(L,2);\n GET_UD_MACRO(HudText,self,1,HUDTEXT_TAG);\n const char *key = luaL_checkstring(L,2);\n if (!::strcmp(key,\"orientation\")) {\n lua_pushnumber(L, self.getOrientation().inDegrees());\n } else if (!::strcmp(key,\"position\")) {\n push_v2(L, self.getPosition());\n } else if (!::strcmp(key,\"derivedPosition\")) {\n push_v2(L, self.getDerivedPosition());\n } else if (!::strcmp(key,\"derivedOrientation\")) {\n lua_pushnumber(L, self.getDerivedOrientation().inDegrees());\n } else if (!::strcmp(key,\"zOrder\")) {\n lua_pushnumber(L, self.getZOrder());\n } else if (!::strcmp(key,\"size\")) {\n push_v2(L, self.HudText::getSize());\n } else if (!::strcmp(key,\"textWrap\")) {\n if (self.getTextWrap() == Vector2(0,0)) {\n lua_pushnil(L);\n } else {\n push_v2(L, self.getTextWrap());\n }\n } else if (!::strcmp(key,\"scroll\")) {\n lua_pushnumber(L, self.getScroll());\n } else if (!::strcmp(key,\"shadow\")) {\n if (self.getShadow() == Vector2(0,0)) {\n lua_pushnil(L);\n } else {\n push_v2(L, self.getShadow());\n }\n } else if (!::strcmp(key,\"shadowColour\")) {\n push_v3(L, self.getShadowColour());\n } else if (!::strcmp(key,\"shadowAlpha\")) {\n lua_pushnumber(L, self.getShadowAlpha());\n } else if (!::strcmp(key,\"bufferHeight\")) {\n lua_pushnumber(L, self.getBufferHeight());\n } else if (!::strcmp(key,\"bounds\")) {\n push_v2(L, self.getBounds());\n } else if (!::strcmp(key,\"derivedBounds\")) {\n push_v2(L, self.getDerivedBounds());\n } else if (!::strcmp(key,\"inheritOrientation\")) {\n lua_pushboolean(L, self.getInheritOrientation());\n } else if (!::strcmp(key,\"snapPixels\")) {\n lua_pushboolean(L, self.snapPixels);\n\n } else if (!::strcmp(key,\"colour\")) {\n push_v3(L, self.getColour());\n } else if (!::strcmp(key,\"alpha\")) {\n lua_pushnumber(L, self.getAlpha());\n } else if (!::strcmp(key,\"letterTopColour\")) {\n push_v3(L, self.getLetterTopColour());\n } else if (!::strcmp(key,\"letterTopAlpha\")) {\n lua_pushnumber(L, self.getLetterTopAlpha());\n } else if (!::strcmp(key,\"letterBottomColour\")) {\n push_v3(L, self.getLetterBottomColour());\n } else if (!::strcmp(key,\"letterBottomAlpha\")) {\n lua_pushnumber(L, self.getLetterBottomAlpha());\n } else if (!::strcmp(key,\"font\")) {\n GfxFont *font = self.getFont();\n push_string(L, font->name);\n\n } else if (!::strcmp(key,\"text\")) {\n push_string(L, self.getText());\n } else if (!::strcmp(key,\"clear\")) {\n push_cfunction(L,hudtext_clear);\n } else if (!::strcmp(key,\"append\")) {\n push_cfunction(L,hudtext_append);\n\n } else if (!::strcmp(key,\"enabled\")) {\n lua_pushboolean(L, self.isEnabled());\n\n } else if (!::strcmp(key,\"parent\")) {\n push_hudobj(L, self.getParent());\n\n } else if (!::strcmp(key,\"destroyed\")) {\n lua_pushboolean(L,self.destroyed());\n } else if (!::strcmp(key,\"destroy\")) {\n push_cfunction(L,hudtext_destroy);\n } else {\n my_lua_error(L,\"Not a readable HudText member: \"+std::string(key));\n }\n return 1;\nTRY_END\n}\n\n\nstatic int hudtext_newindex (lua_State *L)\n{\nTRY_START\n check_args(L,3);\n GET_UD_MACRO(HudText,self,1,HUDTEXT_TAG);\n const char *key = luaL_checkstring(L,2);\n if (!::strcmp(key,\"orientation\")) {\n float v = check_float(L,3);\n self.setOrientation(Degree(v));\n } else if (!::strcmp(key,\"position\")) {\n Vector2 v = check_v2(L,3);\n self.setPosition(v);\n } else if (!::strcmp(key,\"textWrap\")) {\n if (lua_isnil(L,3)) {\n self.setTextWrap(Vector2(0,0));\n } else {\n Vector2 v = check_v2(L,3);\n self.setTextWrap(v);\n }\n } else if (!::strcmp(key,\"scroll\")) {\n long v = check_t<long>(L, 3);\n self.setScroll(v);\n } else if (!::strcmp(key,\"shadow\")) {\n if (lua_isnil(L,3)) {\n self.setShadow(Vector2(0,0));\n } else {\n Vector2 v = check_v2(L,3);\n self.setShadow(v);\n }\n } else if (!::strcmp(key,\"shadowColour\")) {\n Vector3 v = check_v3(L,3);\n self.setShadowColour(v);\n } else if (!::strcmp(key,\"shadowAlpha\")) {\n float v = check_float(L,3);\n self.setShadowAlpha(v);\n } else if (!::strcmp(key,\"inheritOrientation\")) {\n bool v = check_bool(L, 3);\n self.setInheritOrientation(v);\n } else if (!::strcmp(key,\"snapPixels\")) {\n bool v = check_bool(L, 3);\n self.snapPixels = v;\n\n } else if (!::strcmp(key,\"colour\")) {\n Vector3 v = check_v3(L,3);\n self.setColour(v);\n } else if (!::strcmp(key,\"alpha\")) {\n float v = check_float(L,3);\n self.setAlpha(v);\n } else if (!::strcmp(key,\"letterTopColour\")) {\n Vector3 v = check_v3(L,3);\n self.setLetterTopColour(v);\n } else if (!::strcmp(key,\"letterTopAlpha\")) {\n float v = check_float(L,3);\n self.setLetterTopAlpha(v);\n } else if (!::strcmp(key,\"letterBottomColour\")) {\n Vector3 v = check_v3(L,3);\n self.setLetterBottomColour(v);\n } else if (!::strcmp(key,\"letterBottomAlpha\")) {\n float v = check_float(L,3);\n self.setLetterBottomAlpha(v);\n } else if (!::strcmp(key,\"font\")) {\n std::string v = check_string(L,3);\n GfxFont *font = gfx_font_get(v);\n if (font == NULL) my_lua_error(L, \"Font does not exist \\\"\"+v+\"\\\"\");\n self.setFont(font);\n\n } else if (!::strcmp(key,\"text\")) {\n std::string v = check_string(L,3);\n self.clear();\n self.setLetterTopColour(Vector3(1,1,1));\n self.setLetterBottomColour(Vector3(1,1,1));\n self.setLetterTopAlpha(1);\n self.setLetterBottomAlpha(1);\n self.append(v);\n\n } else if (!::strcmp(key,\"parent\")) {\n if (lua_isnil(L,3)) {\n self.setParent(NULL);\n } else {\n GET_UD_MACRO(HudObject,v,3,HUDOBJECT_TAG);\n self.setParent(&v);\n }\n } else if (!::strcmp(key,\"zOrder\")) {\n unsigned char v = check_int(L,3,0,15);\n self.setZOrder(v);\n\n } else if (!::strcmp(key,\"enabled\")) {\n bool v = check_bool(L,3);\n self.setEnabled(v);\n } else {\n my_lua_error(L,\"Not a writeable HudText member: \"+std::string(key));\n }\n return 0;\nTRY_END\n}\n\nEQ_PTR_MACRO(GfxBodyPtr,hudtext,HUDTEXT_TAG)\n\nMT_MACRO_NEWINDEX(hudtext);\n\n//}}}\n\n\n\nstatic int global_gfx_render (lua_State *L)\n{\nTRY_START\n check_args(L,3);\n float elapsed = check_float(L,1);\n Vector3 cam_pos = check_v3(L,2);\n Quaternion cam_dir = check_quat(L,3);\n gfx_window_events_pump();\n hud_call_per_frame_callbacks(L, elapsed);\n gfx_render(elapsed, cam_pos, cam_dir);\n return 0;\nTRY_END\n}\n\nstatic int global_gfx_bake_env_cube (lua_State *L)\n{\nTRY_START\n check_args(L,5);\n std::string name = check_string(L,1);\n unsigned size = check_t<unsigned>(L,2);\n Vector3 cam_pos = check_v3(L,3);\n float saturation = check_float(L,4);\n Vector3 ambient = check_v3(L,5);\n gfx_bake_env_cube(name, size, cam_pos, saturation, ambient);\n return 0;\nTRY_END\n}\n\nstatic int global_gfx_screenshot (lua_State *L)\n{\nTRY_START\n check_args(L,1);\n const char *filename = luaL_checkstring(L,1);\n gfx_screenshot(filename);\n return 0;\nTRY_END\n}\n\nstatic int global_gfx_option_reset (lua_State *L)\n{\nTRY_START\n check_args(L, 0);\n gfx_option_reset();\n return 0;\nTRY_END\n}\nstatic int global_gfx_option (lua_State *L)\n{\nTRY_START\n if (lua_gettop(L)==2) {\n std::string opt = luaL_checkstring(L,1);\n int t;\n GfxBoolOption o0;\n GfxIntOption o1;\n GfxFloatOption o2;\n gfx_option_from_string(opt, t, o0, o1, o2);\n switch (t) {\n case -1: my_lua_error(L,\"Unrecognised graphics option: \\\"\"+opt+\"\\\"\");\n case 0: gfx_option(o0, check_bool(L,2)); break;\n case 1: gfx_option(o1, check_t<int>(L,2)); break;\n case 2: gfx_option(o2, check_float(L,2)); break;\n default: my_lua_error(L,\"Unrecognised type from gfx_option_from_string\");\n }\n return 0;\n } else {\n check_args(L,1);\n std::string opt = luaL_checkstring(L,1);\n int t;\n GfxBoolOption o0;\n GfxIntOption o1;\n GfxFloatOption o2;\n gfx_option_from_string(opt, t, o0, o1, o2);\n switch (t) {\n case -1: my_lua_error(L,\"Unrecognised graphics option: \\\"\"+opt+\"\\\"\");\n case 0: lua_pushboolean(L,gfx_option(o0)); break;\n case 1: lua_pushnumber(L,gfx_option(o1)); break;\n case 2: lua_pushnumber(L,gfx_option(o2)); break;\n default: my_lua_error(L,\"Unrecognised type from gfx_option_from_string\");\n }\n return 1;\n }\nTRY_END\n}\n\nstatic int global_gfx_instances_make (lua_State *L)\n{\nTRY_START\n check_args(L,1);\n std::string meshname = check_path(L,1);\n push_gfxinstances(L, GfxInstances::make(meshname));\n return 1;\nTRY_END\n}\n\nstatic int global_gfx_ranged_instances_make (lua_State *L)\n{\nTRY_START\n check_args(L,1);\n std::string meshname = check_path(L,1);\n push_gfxrangedinstances(L, GfxRangedInstances::make(meshname));\n return 1;\nTRY_END\n}\n\nstatic int global_gfx_decal_make (lua_State *L)\n{\nTRY_START\n check_args(L,1);\n std::string mat_name = check_path(L,1);\n GfxMaterial *mat = gfx_material_get(mat_name);\n push_gfxdecal(L, GfxDecal::make(mat));\n return 1;\nTRY_END\n}\n\nstatic int global_gfx_tracer_body_make (lua_State *L)\n{\nTRY_START\n check_args(L, 0);\n push_gfxtracerbody(L, GfxTracerBody::make());\n return 1;\nTRY_END\n}\n\nstatic int global_gfx_tracer_body_pump (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n float elapsed = check_float(L, 1);\n gfx_tracer_body_pump(elapsed);\n return 1;\nTRY_END\n}\n\nstatic int global_gfx_tracer_body_set_left_over_time (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n float time = check_float(L, 1);\n gfx_tracer_body_set_left_over_time(time);\n return 1;\nTRY_END\n}\n\nstatic int global_gfx_debug_point (lua_State *L)\n{\nTRY_START\n check_args(L, 4);\n Vector3 pos = check_v3(L, 1);\n float radius = check_float(L, 2);\n Vector3 col = check_v3(L, 3);\n float alpha = check_float(L, 4);\n gfx_debug_point(pos, radius, col, alpha);\n return 0;\nTRY_END\n}\n\nstatic int global_gfx_debug_line (lua_State *L)\n{\nTRY_START\n check_args(L, 4);\n Vector3 pos0 = check_v3(L, 1);\n Vector3 pos1 = check_v3(L, 2);\n Vector3 col = check_v3(L, 3);\n float alpha = check_float(L, 4);\n gfx_debug_line(pos0, pos1, col, alpha);\n return 0;\nTRY_END\n}\n\nstatic int global_gfx_debug_triangle (lua_State *L)\n{\nTRY_START\n check_args(L, 5);\n Vector3 pos0 = check_v3(L, 1);\n Vector3 pos1 = check_v3(L, 2);\n Vector3 pos2 = check_v3(L, 3);\n Vector3 col = check_v3(L, 4);\n float alpha = check_float(L, 5);\n gfx_debug_triangle(pos0, pos1, pos2, col, alpha);\n return 0;\nTRY_END\n}\n\nstatic int global_gfx_debug_quad (lua_State *L)\n{\nTRY_START\n check_args(L, 6);\n Vector3 pos0 = check_v3(L, 1);\n Vector3 pos1 = check_v3(L, 2);\n Vector3 pos2 = check_v3(L, 3);\n Vector3 pos3 = check_v3(L, 4);\n Vector3 col = check_v3(L, 5);\n float alpha = check_float(L, 6);\n gfx_debug_quad(pos0, pos1, pos2, pos3, col, alpha);\n return 0;\nTRY_END\n}\n\nstatic int global_gfx_body_make (lua_State *L)\n{\nTRY_START\n if (lua_gettop(L)==0) {\n push_gfxnode(L, GfxFertileNode::make());\n } else if (lua_gettop(L)==1) {\n std::string meshname = check_path(L,1);\n push_gfxbody(L, GfxBody::make(meshname));\n } else {\n // map the materials?\n check_args(L,2);\n std::string meshname = check_path(L,1);\n if (lua_isnil(L,2)) {\n push_gfxbody(L, GfxBody::make(meshname));\n } else {\n if (lua_type(L,2)!=LUA_TTABLE) {\n my_lua_error(L, \"Second parameter should be a table (string map)\");\n }\n GfxStringMap sm;\n for (lua_pushnil(L) ; lua_next(L,2)!=0 ; lua_pop(L,1)) {\n // stack: sm, key, val\n if (lua_type(L,-2)!=LUA_TSTRING) {\n my_lua_error(L, \"Table keys must be strings\");\n }\n if (lua_type(L,-1)!=LUA_TSTRING) {\n my_lua_error(L, \"Table values must be strings\");\n }\n sm[lua_tostring(L,-2)] = lua_tostring(L,-1);\n }\n push_gfxbody(L, GfxBody::make(meshname, sm));\n }\n }\n return 1;\nTRY_END\n}\n\nstatic int global_gfx_text_body_make (lua_State *L)\n{\nTRY_START\n check_args(L, 2);\n std::string font_name = check_path(L, 1);\n std::string mat_name = check_path(L, 2);\n GfxFont *font = gfx_font_get(font_name);\n if (font == NULL) my_lua_error(L, \"Font does not exist \\\"\" + font_name + \"\\\"\");\n GfxMaterial *mat = gfx_material_get(mat_name);\n push_gfxtextbody(L, GfxTextBody::make(font, mat));\n return 1;\nTRY_END\n}\n\nstatic int global_gfx_sky_body_make (lua_State *L)\n{\nTRY_START\n std::string meshname = check_path(L,1);\n short z_order = check_t<short>(L,2);\n push_gfxskybody(L, GfxSkyBody::make(meshname, z_order));\n return 1;\nTRY_END\n}\n\nstatic int global_gfx_font_define (lua_State *L)\n{\nTRY_START\n check_args(L,4);\n std::string name = check_path(L,1);\n std::string tex_name = check_path(L,2);\n lua_Number line_height = luaL_checknumber(L, 3);\n luaL_checktype(L,4,LUA_TTABLE);\n\n DiskResource *d = disk_resource_get_or_make(tex_name);\n if (d==NULL) my_lua_error(L, \"Resource does not exist: \\\"\"+tex_name+\"\\\"\");\n GfxTextureDiskResource *d2 = dynamic_cast<GfxTextureDiskResource*>(d);\n if (d2==NULL) my_lua_error(L, \"Resource not a texture: \\\"\"+tex_name+\"\\\"\");\n\n // get or create font of the right name\n GfxFont *font = gfx_font_make(name, d2, line_height);\n\n // iterate through codepoints\n for (lua_pushnil(L) ; lua_next(L,4) ; lua_pop(L,1)) {\n lua_Number codepoint = check_t<unsigned>(L,-2);\n lua_rawgeti(L, -1, 1);\n lua_Number x = check_t<unsigned>(L,-1);\n lua_pop(L,1);\n lua_rawgeti(L, -1, 2);\n lua_Number y = check_t<unsigned>(L,-1);\n lua_pop(L,1);\n lua_rawgeti(L, -1, 3);\n lua_Number w = check_t<unsigned>(L,-1);\n lua_pop(L,1);\n lua_rawgeti(L, -1, 4);\n lua_Number h = check_t<unsigned>(L,-1);\n lua_pop(L,1);\n\n GfxFont::CharRect cr;\n cr.u1 = x;\n cr.v1 = y;\n cr.u2 = cr.u1 + w;\n cr.v2 = cr.v1 + h;\n font->setCodePoint(codepoint, cr);\n }\n\n return 0;\nTRY_END\n}\n\nstatic int global_gfx_font_line_height (lua_State *L)\n{\nTRY_START\n check_args(L,1);\n std::string name = check_path(L,1);\n GfxFont *font = gfx_font_get(name);\n if (font == NULL) EXCEPT << \"Font does not exist: \\\"\" << name << \"\\\"\" << ENDL;\n lua_pushnumber(L, font->getHeight());\n return 1;\nTRY_END\n}\n\nstatic int global_gfx_font_list (lua_State *L)\n{\nTRY_START\n check_args(L, 0);\n std::vector<GfxFont*> list = gfx_font_list();\n lua_newtable(L);\n int counter = 1;\n for (unsigned i=0 ; i<list.size() ; ++i) {\n lua_pushstring(L, list[i]->name.c_str());\n lua_rawseti(L,-2,counter);\n counter++;\n }\n return 1;\nTRY_END\n}\n\nstatic int global_gfx_font_text_width (lua_State *L)\n{\nTRY_START\n check_args(L, 2);\n std::string name = check_path(L,1);\n std::string text = check_string(L, 2);\n GfxFont *font = gfx_font_get(name);\n if (font == NULL) EXCEPT << \"Font does not exist: \\\"\" << name << \"\\\"\" << ENDL;\n unsigned long width = 0;\n for (size_t i=0 ; i<text.length() ; ++i) {\n GfxFont::codepoint_t cp = decode_utf8(text, i);\n GfxFont::CharRect uvs;\n bool r = font->getCodePointOrFail(cp, uvs);\n if (!r) continue;\n width += uvs.u2 - uvs.u1;\n }\n lua_pushnumber(L, width);\n return 1;\nTRY_END\n}\n\nstatic int global_hud_text_add (lua_State *L)\n{\nTRY_START\n check_args(L,1);\n std::string font_name = check_path(L,1);\n GfxFont *font = gfx_font_get(font_name);\n if (font == NULL) my_lua_error(L, \"Font does not exist: \\\"\"+font_name+\"\\\"\");\n\n HudText *self = new HudText(font);\n push_hudtext(L,self);\n\n return 1;\nTRY_END\n}\n\n\nstatic int global_hud_object_add (lua_State *L)\n{\nTRY_START\n if (lua_gettop(L) == 1) lua_newtable(L);\n check_args(L,2);\n std::string class_name = check_path(L,1);\n HudClass *hud_class = hud_class_get(class_name);\n int table_index = lua_gettop(L);\n if (!lua_istable(L,table_index)) my_lua_error(L,\"Last parameter should be a table\");\n\n HudObject *parent = NULL;\n HudObject *self = new HudObject(hud_class);\n\n // Push this now, so that it will increment its internal reference counter and not be deleted\n // if aliases are gc'd.\n push_hudobj(L,self);\n\n bool have_orientation = false;\n bool have_position = false;\n bool have_size = false;\n bool have_colour = false;\n bool have_alpha = false;\n bool have_texture = false;\n bool have_zorder = false;\n bool have_cornered = false;\n bool have_enabled = false;\n bool have_stencil = false;\n bool have_stencil_texture = false;\n\n lua_newtable(L);\n int new_table_index = lua_gettop(L);\n\n self->table.setNoPop(L);\n\n // scan through table adding lua data to self\n for (lua_pushnil(L) ; lua_next(L,table_index)!=0 ; lua_pop(L,1)) {\n const char *key = \"\";\n if (lua_type(L,-2)==LUA_TSTRING) {\n key = luaL_checkstring(L,-2);\n }\n\n if (!::strcmp(key,\"orientation\")) {\n if (lua_isnumber(L,-1)) {\n float v = check_float(L,-1);\n self->setOrientation(Degree(v));\n have_orientation = true;\n } else {\n my_lua_error(L, \"orientation must be a number.\");\n }\n } else if (!::strcmp(key,\"position\")) {\n if (lua_isvector2(L,-1)) {\n Vector2 v = check_v2(L,-1);\n self->setPosition(v);\n have_position = true;\n } else {\n my_lua_error(L, \"position must be a vector2.\");\n }\n } else if (!::strcmp(key,\"size\")) {\n if (lua_isvector2(L,-1)) {\n Vector2 v = check_v2(L,-1);\n self->setSize(L, v);\n have_size = true;\n } else {\n my_lua_error(L, \"size must be a vector2.\");\n }\n } else if (!::strcmp(key,\"parent\")) {\n if (lua_isnil(L,-1)) {\n parent = NULL;\n } else {\n GET_UD_MACRO(HudObject,v,-1,HUDOBJECT_TAG);\n parent = &v;\n }\n } else if (!::strcmp(key,\"colour\")) {\n if (lua_isvector3(L,-1)) {\n Vector3 v = check_v3(L,-1);\n self->setColour(v);\n have_colour = true;\n } else {\n my_lua_error(L, \"colour must be a vector3.\");\n }\n } else if (!::strcmp(key,\"alpha\")) {\n if (lua_isnumber(L,-1)) {\n float v = check_float(L,-1);\n self->setAlpha(v);\n have_alpha = true;\n } else {\n my_lua_error(L, \"alpha must be a number.\");\n }\n } else if (!::strcmp(key,\"texture\")) {\n if (lua_type(L,-1) == LUA_TSTRING) {\n std::string v = check_path(L,-1);\n auto d = disk_resource_use<GfxTextureDiskResource>(v);\n if (d == nullptr) my_lua_error(L, \"Resource not a texture: \\\"\" + v + \"\\\"\");\n self->setTexture(d);\n have_texture = true;\n } else {\n my_lua_error(L, \"texture must be a string.\");\n }\n } else if (!::strcmp(key,\"zOrder\")) {\n if (lua_isnumber(L,-1)) {\n lua_Number v = lua_tonumber(L,-1);\n if (v!=(unsigned char)(v)) {\n my_lua_error(L, \"zOrder must be an integer between 0 and 255 inclusive.\");\n }\n self->setZOrder((unsigned char)v);\n have_zorder = true;\n } else {\n my_lua_error(L, \"zOrder must be a number.\");\n }\n } else if (!::strcmp(key,\"cornered\")) {\n if (lua_isboolean(L,-1)) {\n bool v = check_bool(L,-1);\n self->setCornered(v);\n have_cornered = true;\n } else {\n my_lua_error(L, \"cornered must be a boolean.\");\n }\n } else if (!::strcmp(key,\"enabled\")) {\n if (lua_isboolean(L,-1)) {\n bool v = check_bool(L,-1);\n self->setEnabled(v);\n have_enabled = true;\n } else {\n my_lua_error(L, \"enabled must be a boolean.\");\n }\n } else if (!::strcmp(key,\"stencil\")) {\n if (lua_isboolean(L,-1)) {\n bool v = check_bool(L,-1);\n self->setStencil(v);\n have_stencil = true;\n } else {\n my_lua_error(L, \"enabled must be a boolean.\");\n }\n } else if (!::strcmp(key,\"stencilTexture\")) {\n if (lua_type(L,-1) == LUA_TSTRING) {\n std::string v = check_path(L,-1);\n auto d = disk_resource_use<GfxTextureDiskResource>(v);\n if (d == nullptr) my_lua_error(L, \"Resource not a texture: \\\"\" + v + \"\\\"\");\n self->setStencilTexture(d);\n have_stencil_texture = true;\n } else {\n my_lua_error(L, \"texture must be a string.\");\n }\n } else if (!::strcmp(key,\"class\")) {\n my_lua_error(L,\"Not a writeable HudObject member: \"+std::string(key));\n } else if (!::strcmp(key,\"className\")) {\n my_lua_error(L,\"Not a writeable HudObject member: \"+std::string(key));\n } else if (!::strcmp(key,\"destroy\")) {\n my_lua_error(L,\"Not a writeable HudObject member: \"+std::string(key));\n } else if (!::strcmp(key,\"destroyed\")) {\n my_lua_error(L,\"Not a writeable HudObject member: \"+std::string(key));\n } else {\n lua_pushvalue(L, -2); // push key\n lua_pushvalue(L, -2); // push value\n lua_rawset(L, new_table_index);\n }\n }\n ExternalTable &class_tab = hud_class->getTable();\n std::string msg = \"Wrong type for %s field in hud class \\\"\" + hud_class->name + \"\\\".\";\n if (!have_orientation) {\n if (class_tab.has(\"orientation\")) {\n lua_Number v;\n class_tab.getOrExcf(\"orientation\", v, msg, \"orientation\");\n self->setOrientation(Degree(v));\n }\n }\n if (!have_position) {\n if (class_tab.has(\"position\")) {\n Vector2 v;\n class_tab.getOrExcf(\"position\", v, msg, \"position\");\n self->setPosition(v);\n }\n }\n if (!have_size) {\n if (class_tab.has(\"size\")) {\n Vector2 v;\n class_tab.getOrExcf(\"size\", v, msg, \"size\");\n self->setSize(L, v);\n have_size = true;\n }\n }\n if (!have_colour) {\n if (class_tab.has(\"colour\")) {\n Vector3 v;\n class_tab.getOrExcf(\"colour\", v, msg, \"colour\");\n self->setColour(v);\n }\n }\n if (!have_alpha) {\n if (class_tab.has(\"alpha\")) {\n lua_Number v;\n class_tab.getOrExcf(\"alpha\", v, msg, \"alpha\");\n self->setAlpha(v);\n }\n }\n if (!have_texture) {\n if (class_tab.has(\"texture\")) {\n std::string v;\n class_tab.getOrExcf(\"texture\", v, msg, \"texture\");\n auto d = disk_resource_use<GfxTextureDiskResource>(v);\n if (d == nullptr) my_lua_error(L, \"Resource not a texture: \\\"\"+std::string(v)+\"\\\"\");\n self->setTexture(d);\n }\n }\n if (!have_zorder) {\n if (class_tab.has(\"zOrder\")) {\n lua_Number v;\n class_tab.getOrExcf(\"zOrder\", v, msg, \"zOrder\");\n if ((unsigned char)(v) != v)\n EXCEPT << \"zOrder must be an integer in range 0 to 255 in class \\\"\"\n << hud_class->name << \"\\\".\" << ENDL;\n self->setZOrder((unsigned char)v);\n }\n }\n if (!have_cornered) {\n if (class_tab.has(\"cornered\")) {\n bool v;\n class_tab.getOrExcf(\"cornered\", v, msg, \"cornered\");\n self->setCornered(v);\n }\n }\n if (!have_enabled) {\n if (class_tab.has(\"enabled\")) {\n bool v;\n class_tab.getOrExcf(\"enabled\", v, msg, \"enabled\");\n self->setEnabled(v);\n }\n }\n if (!have_stencil) {\n if (class_tab.has(\"stencil\")) {\n bool v;\n class_tab.getOrExcf(\"stencil\", v, msg, \"stencil\");\n self->setStencil(v);\n }\n }\n if (!have_stencil_texture) {\n if (class_tab.has(\"stencilTexture\")) {\n std::string v;\n class_tab.getOrExcf(\"stencilTexture\", v, msg, \"stencilTexture\");\n auto d = disk_resource_use<GfxTextureDiskResource>(v);\n if (d == nullptr) EXCEPT << \"Resource not a texture: \\\"\" << v << \"\\\"\" << ENDL;\n self->setStencilTexture(d);\n }\n }\n\n self->triggerInit(L);\n if (!have_size && !self->getSizeSet() && self->getTexture()!=NULL) {\n // Set size from texture.\n GfxTextureDiskResource *dr = self->getTexture();\n if (dr->isLoaded()) {\n Ogre::TexturePtr tex = dr->getOgreTexturePtr();\n tex->load(); // otherwise width and height are 512!?\n self->setSize(L, Vector2(tex->getWidth(),tex->getHeight()));\n }\n }\n self->setParent(L, parent);\n\n push_hudobj(L,self);\n\n return 1;\nTRY_END\n}\n\nstatic int global_hud_class_add (lua_State *L)\n{\nTRY_START\n check_args(L,2);\n std::string name = check_path(L,1);\n if (!lua_istable(L,2))\n my_lua_error(L,\"Second parameter should be a table\");\n HudClass *c = hud_class_add(L, name);\n push_hudclass(L, c);\n return 1;\nTRY_END\n}\n\nstatic int global_hud_class_get (lua_State *L)\n{\nTRY_START\n check_args(L,1);\n std::string name = check_path(L,1);\n push_hudclass(L,hud_class_get(name));\n return 1;\nTRY_END\n}\n\nstatic int global_hud_class_has (lua_State *L)\n{\nTRY_START\n check_args(L,1);\n std::string name = check_path(L,1);\n lua_pushboolean(L,hud_class_has(name));\n return 1;\nTRY_END\n}\n\nstatic int global_hud_class_count (lua_State *L)\n{\nTRY_START\n check_args(L,0);\n lua_pushnumber(L, hud_class_count());\n return 1;\nTRY_END\n}\n\nstatic int global_hud_class_all (lua_State *L)\n{\nTRY_START\n check_args(L,0);\n lua_newtable(L);\n unsigned int c = 0;\n HudClassMap::iterator i, i_;\n for (hud_class_all(i,i_) ; i!=i_ ; ++i) {\n push_hudclass(L,i->second);\n lua_rawseti(L,-2,c+1);\n c++;\n }\n return 1;\nTRY_END\n}\n\nstatic int global_hud_ray (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n Vector2 pos = check_v2(L, 1);\n // negative values occur when dragging out of the game window\n // casting to unsigned makes them go away...\n HudObject *obj = hud_ray((unsigned)pos.x, (unsigned)pos.y);\n if (obj != nullptr) {\n push_hudobj(L, obj);\n push_v2(L, obj->screenToLocal(pos));\n return 2;\n } else {\n lua_pushnil(L);\n return 1;\n }\nTRY_END\n}\n\n\n\n\n\nstatic int global_gfx_sprite_body_make (lua_State *L)\n{\nTRY_START\n check_args(L,1);\n std::string particle_name = check_string(L, 1);\n push_gfxspritebody(L, GfxSpriteBody::make(particle_name));\n return 1;\nTRY_END\n}\n\nstatic int global_gfx_light_make (lua_State *L)\n{\nTRY_START\n check_args(L,0);\n push_gfxlight(L, GfxLight::make());\n return 1;\nTRY_END\n}\n\nstatic int global_gfx_sunlight_diffuse (lua_State *L)\n{\nTRY_START\n switch (lua_gettop(L)) {\n case 0: {\n push_v3(L, gfx_sunlight_diffuse());\n return 1;\n }\n case 1: {\n Vector3 v = check_v3(L,1);\n gfx_sunlight_diffuse(v);\n return 0;\n }\n default:\n my_lua_error(L, \"Getter/setter: expected 0 or 1 arguments\");\n return 0; // silence compiler\n }\nTRY_END\n}\n\nstatic int global_gfx_sunlight_specular (lua_State *L)\n{\nTRY_START\n switch (lua_gettop(L)) {\n case 0: {\n push_v3(L, gfx_sunlight_specular());\n return 1;\n }\n case 1: {\n Vector3 v = check_v3(L,1);\n gfx_sunlight_specular(v);\n return 0;\n }\n default:\n my_lua_error(L, \"Getter/setter: expected 0 or 1 arguments\");\n return 0; // silence compiler\n }\nTRY_END\n}\n\nstatic int global_gfx_sunlight_direction (lua_State *L)\n{\nTRY_START\n switch (lua_gettop(L)) {\n case 0: {\n push_v3(L, gfx_sunlight_direction());\n return 1;\n }\n case 1: {\n Vector3 v = check_v3(L,1);\n gfx_sunlight_direction(v);\n return 0;\n }\n default:\n my_lua_error(L, \"Getter/setter: expected 0 or 1 arguments\");\n return 0; // silence compiler\n }\nTRY_END\n}\n\nstatic int global_gfx_sun_direction (lua_State *L)\n{\nTRY_START\n switch (lua_gettop(L)) {\n case 0: {\n push_v3(L, gfx_sun_direction());\n return 1;\n }\n case 1: {\n Vector3 v = check_v3(L,1);\n gfx_sun_direction(v);\n return 0;\n }\n default:\n my_lua_error(L, \"Getter/setter: expected 0 or 1 arguments\");\n return 0; // silence compiler\n }\nTRY_END\n}\n\nstatic int global_gfx_hell_colour (lua_State *L)\n{\nTRY_START\n switch (lua_gettop(L)) {\n case 0: {\n push_v3(L, gfx_hell_colour());\n return 1;\n }\n case 1: {\n Vector3 v = check_v3(L,1);\n gfx_hell_colour(v);\n return 0;\n }\n default:\n my_lua_error(L, \"Getter/setter: expected 0 or 1 arguments\");\n return 0; // silence compiler\n }\nTRY_END\n}\n\nstatic int global_gfx_sun_colour (lua_State *L)\n{\nTRY_START\n switch (lua_gettop(L)) {\n case 0: {\n push_v3(L, gfx_sun_colour());\n return 1;\n }\n case 1: {\n Vector3 v = check_v3(L,1);\n gfx_sun_colour(v);\n return 0;\n }\n default:\n my_lua_error(L, \"Getter/setter: expected 0 or 1 arguments\");\n return 0; // silence compiler\n }\nTRY_END\n}\n\nstatic int global_gfx_sun_alpha (lua_State *L)\n{\nTRY_START\n switch (lua_gettop(L)) {\n case 0: {\n lua_pushnumber(L, gfx_sun_alpha());\n return 1;\n }\n case 1: {\n float v = check_float(L,1);\n gfx_sun_alpha(v);\n return 0;\n }\n default:\n my_lua_error(L, \"Getter/setter: expected 0 or 1 arguments\");\n return 0; // silence compiler\n }\nTRY_END\n}\n\nstatic int global_gfx_sun_size (lua_State *L)\n{\nTRY_START\n switch (lua_gettop(L)) {\n case 0: {\n lua_pushnumber(L, gfx_sun_size());\n return 1;\n }\n case 1: {\n float v = check_float(L,1);\n gfx_sun_size(v);\n return 0;\n }\n default:\n my_lua_error(L, \"Getter/setter: expected 0 or 1 arguments\");\n return 0; // silence compiler\n }\nTRY_END\n}\n\nstatic int global_gfx_sun_falloff_distance (lua_State *L)\n{\nTRY_START\n switch (lua_gettop(L)) {\n case 0: {\n lua_pushnumber(L, gfx_sun_falloff_distance());\n return 1;\n }\n case 1: {\n float v = check_float(L,1);\n gfx_sun_falloff_distance(v);\n return 0;\n }\n default:\n my_lua_error(L, \"Getter/setter: expected 0 or 1 arguments\");\n return 0; // silence compiler\n }\nTRY_END\n}\n\nstatic int global_gfx_sky_glare_sun_distance (lua_State *L)\n{\nTRY_START\n switch (lua_gettop(L)) {\n case 0: {\n lua_pushnumber(L, gfx_sky_glare_sun_distance());\n return 1;\n }\n case 1: {\n float v = check_float(L,1);\n gfx_sky_glare_sun_distance(v);\n return 0;\n }\n default:\n my_lua_error(L, \"Getter/setter: expected 0 or 1 arguments\");\n return 0; // silence compiler\n }\nTRY_END\n}\n\nstatic int global_gfx_sky_glare_horizon_elevation (lua_State *L)\n{\nTRY_START\n switch (lua_gettop(L)) {\n case 0: {\n lua_pushnumber(L, gfx_sky_glare_horizon_elevation());\n return 1;\n }\n case 1: {\n float v = check_float(L,1);\n gfx_sky_glare_horizon_elevation(v);\n return 0;\n }\n default:\n my_lua_error(L, \"Getter/setter: expected 0 or 1 arguments\");\n return 0; // silence compiler\n }\nTRY_END\n}\n\nstatic int global_gfx_sky_divider (lua_State *L)\n{\nTRY_START\n switch (lua_gettop(L)) {\n case 1: {\n unsigned index = check_int(L, 1, 0, 4);\n lua_pushnumber(L, gfx_sky_divider(index));\n return 1;\n }\n case 2: {\n unsigned index = check_int(L, 1, 0, 4);\n float v = check_float(L,2);\n gfx_sky_divider(index, v);\n return 0;\n }\n default:\n my_lua_error(L, \"Getter/setter with integer index: expected 1 or 2 arguments\");\n return 0; // silence compiler\n }\nTRY_END\n}\n\nstatic int global_gfx_sky_colour (lua_State *L)\n{\nTRY_START\n switch (lua_gettop(L)) {\n case 1: {\n unsigned index = check_int(L, 1, 0, 5);\n push_v3(L, gfx_sky_colour(index));\n return 1;\n }\n case 2: {\n unsigned index = check_int(L, 1, 0, 5);\n Vector3 v = check_v3(L,2);\n gfx_sky_colour(index, v);\n return 0;\n }\n default:\n my_lua_error(L, \"Getter/setter with integer index: expected 1 or 2 arguments\");\n return 0; // silence compiler\n }\nTRY_END\n}\n\nstatic int global_gfx_sky_sun_colour (lua_State *L)\n{\nTRY_START\n switch (lua_gettop(L)) {\n case 1: {\n unsigned index = check_int(L, 1, 0, 5);\n push_v3(L, gfx_sky_sun_colour(index));\n return 1;\n }\n case 2: {\n unsigned index = check_int(L, 1, 0, 5);\n Vector3 v = check_v3(L,2);\n gfx_sky_sun_colour(index, v);\n return 0;\n }\n default:\n my_lua_error(L, \"Getter/setter with integer index: expected 1 or 2 arguments\");\n return 0; // silence compiler\n }\nTRY_END\n}\n\nstatic int global_gfx_sky_alpha (lua_State *L)\n{\nTRY_START\n switch (lua_gettop(L)) {\n case 1: {\n unsigned index = check_int(L, 1, 0, 5);\n lua_pushnumber(L, gfx_sky_alpha(index));\n return 1;\n }\n case 2: {\n unsigned index = check_int(L, 1, 0, 5);\n float v = check_float(L,2);\n gfx_sky_alpha(index, v);\n return 0;\n }\n default:\n my_lua_error(L, \"Getter/setter with integer index: expected 1 or 2 arguments\");\n return 0; // silence compiler\n }\nTRY_END\n}\n\nstatic int global_gfx_sky_sun_alpha (lua_State *L)\n{\nTRY_START\n switch (lua_gettop(L)) {\n case 1: {\n unsigned index = check_int(L, 1, 0, 5);\n lua_pushnumber(L, gfx_sky_alpha(index));\n return 1;\n }\n case 2: {\n unsigned index = check_int(L, 1, 0, 5);\n float v = check_float(L,2);\n gfx_sky_alpha(index, v);\n return 0;\n }\n default:\n my_lua_error(L, \"Getter/setter with integer index: expected 1 or 2 arguments\");\n return 0; // silence compiler\n }\nTRY_END\n}\n\nstatic int global_gfx_sky_cloud_colour (lua_State *L)\n{\nTRY_START\n switch (lua_gettop(L)) {\n case 0: {\n push_v3(L, gfx_sky_cloud_colour());\n return 1;\n }\n case 1: {\n Vector3 v = check_v3(L,1);\n gfx_sky_cloud_colour(v);\n return 0;\n }\n default:\n my_lua_error(L, \"Getter/setter: expected 0 or 1 arguments\");\n return 0; // silence compiler\n }\nTRY_END\n}\n\nstatic int global_gfx_sky_cloud_coverage (lua_State *L)\n{\nTRY_START\n switch (lua_gettop(L)) {\n case 0: {\n lua_pushnumber(L, gfx_sky_cloud_coverage());\n return 1;\n }\n case 1: {\n float v = check_float(L,1);\n gfx_sky_cloud_coverage(v);\n return 0;\n }\n default:\n my_lua_error(L, \"Getter/setter: expected 0 or 1 arguments\");\n return 0; // silence compiler\n }\nTRY_END\n}\n\n\nstatic int global_gfx_env_cube (lua_State *L)\n{\nTRY_START\n unsigned i = check_int(L, 1, 0, 1);\n switch (lua_gettop(L)) {\n case 1: {\n if (gfx_env_cube(i) != NULL) {\n push_string(L, gfx_env_cube(i)->getName());\n } else {\n lua_pushnil(L);\n }\n return 1;\n }\n case 2: {\n if (lua_isnil(L, 2)) {\n gfx_env_cube(i, DiskResourcePtr<GfxEnvCubeDiskResource>());\n } else {\n std::string v = check_path(L, 2);\n auto dr = disk_resource_use<GfxEnvCubeDiskResource>(v);\n if (dr == nullptr) my_lua_error(L, \"Not an env cube: \\\"\" + v + \"\\\"\");\n gfx_env_cube(i, dr);\n }\n return 0;\n }\n default:\n my_lua_error(L, \"Getter/setter: expected 1 or 2 arguments\");\n return 0; // silence compiler\n }\nTRY_END\n}\n\nstatic int global_gfx_env_cube_cross_fade (lua_State *L)\n{\nTRY_START\n switch (lua_gettop(L)) {\n case 0: {\n lua_pushnumber(L, gfx_env_cube_cross_fade());\n return 1;\n }\n case 1: {\n float v = check_float(L,1);\n gfx_env_cube_cross_fade(v);\n return 0;\n }\n default:\n my_lua_error(L, \"Getter/setter: expected 0 or 1 arguments\");\n return 0; // silence compiler\n }\nTRY_END\n}\n\nstatic int global_gfx_fade_dither_map (lua_State *L)\n{\nTRY_START\n switch (lua_gettop(L)) {\n case 0: {\n if (gfx_fade_dither_map() != NULL) {\n push_string(L, gfx_fade_dither_map()->getName());\n } else {\n lua_pushnil(L);\n }\n return 1;\n }\n case 1: {\n if (lua_isnil(L, 1)) {\n gfx_fade_dither_map(DiskResourcePtr<GfxTextureDiskResource>());\n } else {\n std::string v = check_string(L,1);\n auto dr = disk_resource_use<GfxTextureDiskResource>(v);\n if (dr == nullptr) my_lua_error(L, \"Not a texture: \\\"\" + v + \"\\\"\");\n gfx_fade_dither_map(dr);\n }\n return 0;\n }\n default:\n my_lua_error(L, \"Getter/setter: expected 0 or 1 arguments\");\n return 0; // silence compiler\n }\nTRY_END\n}\n\nstatic int global_gfx_corona_map (lua_State *L)\n{\nTRY_START\n switch (lua_gettop(L)) {\n case 0: {\n if (gfx_corona_map() != NULL) {\n push_string(L, gfx_corona_map()->getName());\n } else {\n lua_pushnil(L);\n }\n return 1;\n }\n case 1: {\n if (lua_isnil(L, 1)) {\n gfx_corona_map(DiskResourcePtr<GfxTextureDiskResource>());\n } else {\n std::string v = check_string(L,1);\n auto dr = disk_resource_use<GfxTextureDiskResource>(v);\n if (dr == nullptr) my_lua_error(L, \"Not a texture: \\\"\" + v + \"\\\"\");\n gfx_corona_map(dr);\n }\n return 0;\n }\n default:\n my_lua_error(L, \"Getter/setter: expected 0 or 1 arguments\");\n return 0; // silence compiler\n }\nTRY_END\n}\n\nstatic int global_gfx_shadow_pcf_noise_map (lua_State *L)\n{\nTRY_START\n switch (lua_gettop(L)) {\n case 0: {\n if (gfx_shadow_pcf_noise_map() != NULL) {\n push_string(L, gfx_shadow_pcf_noise_map()->getName());\n } else {\n lua_pushnil(L);\n }\n return 1;\n }\n case 1: {\n if (lua_isnil(L, 1)) {\n gfx_shadow_pcf_noise_map(DiskResourcePtr<GfxTextureDiskResource>());\n } else {\n std::string v = check_string(L,1);\n auto dr = disk_resource_use<GfxTextureDiskResource>(v);\n if (dr == nullptr) my_lua_error(L, \"Not a texture: \\\"\" + v + \"\\\"\");\n gfx_shadow_pcf_noise_map(dr);\n }\n return 0;\n }\n default:\n my_lua_error(L, \"Getter/setter: expected 0 or 1 arguments\");\n return 0; // silence compiler\n }\nTRY_END\n}\n\nstatic int global_gfx_colour_grade (lua_State *L)\n{\nTRY_START\n switch (lua_gettop(L)) {\n case 0: {\n if (gfx_colour_grade() != NULL) {\n push_string(L, gfx_colour_grade()->getName());\n } else {\n lua_pushnil(L);\n }\n return 1;\n }\n case 1: {\n if (lua_isnil(L, 1)) {\n gfx_colour_grade(DiskResourcePtr<GfxColourGradeLUTDiskResource>());\n } else {\n std::string v = check_string(L,1);\n auto dr = disk_resource_use<GfxColourGradeLUTDiskResource>(v);\n if (dr == nullptr) my_lua_error(L, \"Not a colour grade LUT texture: \\\"\" + v + \"\\\"\");\n gfx_colour_grade(dr);\n }\n return 0;\n }\n default:\n my_lua_error(L, \"Getter/setter: expected 0 or 1 arguments\");\n return 0; // silence compiler\n }\nTRY_END\n}\n\nstatic int global_gfx_global_saturation (lua_State *L)\n{\nTRY_START\n switch (lua_gettop(L)) {\n case 0: {\n lua_pushnumber(L, gfx_global_saturation());\n return 1;\n }\n case 1: {\n float v = check_float(L,1);\n gfx_global_saturation(v);\n return 0;\n }\n default:\n my_lua_error(L, \"Getter/setter: expected 0 or 1 arguments\");\n return 0; // silence compiler\n }\nTRY_END\n}\n\nstatic int global_gfx_global_exposure (lua_State *L)\n{\nTRY_START\n switch (lua_gettop(L)) {\n case 0: {\n lua_pushnumber(L, gfx_global_exposure());\n return 1;\n }\n case 1: {\n float v = check_float(L,1);\n gfx_global_exposure(v);\n return 0;\n }\n default:\n my_lua_error(L, \"Getter/setter: expected 0 or 1 arguments\");\n return 0; // silence compiler\n }\nTRY_END\n}\n\nstatic int global_gfx_particle_ambient (lua_State *L)\n{\nTRY_START\n switch (lua_gettop(L)) {\n case 0: {\n push_v3(L, gfx_particle_ambient());\n return 1;\n }\n case 1: {\n Vector3 v = check_v3(L,1);\n gfx_particle_ambient(v);\n return 0;\n }\n default:\n my_lua_error(L, \"Getter/setter: expected 0 or 1 arguments\");\n return 0; // silence compiler\n }\nTRY_END\n}\n\nstatic int global_gfx_fog_colour (lua_State *L)\n{\nTRY_START\n switch (lua_gettop(L)) {\n case 0: {\n push_v3(L, gfx_fog_colour());\n return 1;\n }\n case 1: {\n Vector3 v = check_v3(L,1);\n gfx_fog_colour(v);\n return 0;\n }\n default:\n my_lua_error(L, \"Getter/setter: expected 0 or 1 arguments\");\n return 0; // silence compiler\n }\nTRY_END\n}\n\nstatic int global_gfx_fog_density (lua_State *L)\n{\nTRY_START\n switch (lua_gettop(L)) {\n case 0: {\n lua_pushnumber(L, gfx_fog_density());\n return 1;\n }\n case 1: {\n float v = check_float(L,1);\n gfx_fog_density(v);\n return 0;\n }\n default:\n my_lua_error(L, \"Getter/setter: expected 0 or 1 arguments\");\n return 0; // silence compiler\n }\nTRY_END\n}\n\nstatic void push_stat (lua_State *L, GfxLastRenderStats &s)\n{\n lua_pushnumber(L, s.batches);\n lua_pushnumber(L, s.triangles);\n lua_pushnumber(L, s.micros);\n}\n\nstatic int global_gfx_last_frame_stats (lua_State *L)\n{\nTRY_START\n check_args(L,0);\n GfxLastFrameStats s = gfx_last_frame_stats();\n lua_checkstack(L,30); // we're going to push a lot of stuff...\n push_stat(L, s.shadow[0]);\n push_stat(L, s.shadow[1]);\n push_stat(L, s.shadow[2]);\n push_stat(L, s.left_gbuffer);\n push_stat(L, s.left_deferred);\n push_stat(L, s.right_gbuffer);\n push_stat(L, s.right_deferred);\n return 3*7;\nTRY_END\n}\n\nstatic int global_gfx_colour_grade_look_up (lua_State *L)\n{\n check_args(L,1);\n Vector3 v = check_v3(L, 1);\n push_v3(L, gfx_colour_grade_look_up(v));\n return 1;\n}\n\nstatic int global_gfx_window_active (lua_State *L)\n{\n check_args(L,0);\n lua_pushboolean(L, gfx_window_active());\n return 1;\n}\n\nstatic int global_gfx_window_size (lua_State *L)\n{\n check_args(L,0);\n push_v2(L, gfx_window_size());\n return 1;\n}\n\nstatic int global_gfx_window_size_in_scene (lua_State *L)\n{\n check_args(L,0);\n push_v2(L, gfx_window_size_in_scene());\n return 1;\n}\n\nstatic int global_gfx_world_to_screen (lua_State *L)\n{\nTRY_START\n check_args(L, 3);\n Vector3 cp = check_v3(L, 1);\n Quaternion cq = check_quat(L, 2);\n Vector3 p = check_v3(L, 3);\n push_v3(L, gfx_world_to_screen(cp, cq, p));\n return 1;\nTRY_END\n}\n\nstatic int global_gfx_screen_to_world (lua_State *L)\n{\nTRY_START\n check_args(L, 3);\n Vector3 cp = check_v3(L, 1);\n Quaternion cq = check_quat(L, 2);\n Vector2 p = check_v2(L, 3);\n push_v3(L, gfx_screen_to_world(cp, cq, p));\n return 1;\nTRY_END\n}\n\nstatic int global_gfx_gpu_ram_available (lua_State *L)\n{\n check_args(L,0);\n lua_pushnumber(L, gfx_gpu_ram_available());\n return 1;\n}\n\nstatic int global_gfx_gpu_ram_used (lua_State *L)\n{\n check_args(L,0);\n lua_pushnumber(L, gfx_gpu_ram_used());\n return 1;\n}\n\nstatic lua_Number anim_rate (lua_Number n)\n{\n // n * ANIM_TIME_MAX must be an integer k, since this means the animation\n // will repeat k times within the period that the master time repeats.\n return floor(n * ANIM_TIME_MAX + 0.5) / ANIM_TIME_MAX;\n}\n\nstatic int global_gfx_anim_rate (lua_State *L)\n{\n check_args(L, 1);\n switch (lua_type(L, 1)) {\n case LUA_TNUMBER: {\n lua_Number n = luaL_checknumber(L, 1);\n lua_pushnumber(L, anim_rate(n));\n }\n break;\n\n case LUA_TVECTOR2: {\n Vector2 v = check_v2(L, 1);\n push_v2(L, Vector2(anim_rate(v.x), anim_rate(v.y)));\n }\n break;\n\n case LUA_TVECTOR3: {\n Vector3 v = check_v3(L, 1);\n push_v3(L, Vector3(anim_rate(v.x), anim_rate(v.y), anim_rate(v.z)));\n }\n break;\n\n case LUA_TVECTOR4: {\n Vector4 v = check_v4(L, 1);\n push_v4(L, Vector4(anim_rate(v.x), anim_rate(v.y), anim_rate(v.z), anim_rate(v.w)));\n }\n break;\n\n default:\n my_lua_error(L, \"Expected number or vec2/3/4.\");\n }\n\n return 1;\n}\n\nstatic int global_rgb_to_hsl (lua_State *L)\n{\n check_args(L,1);\n float r,g,b;\n lua_checkvector3(L, 1, &r, &g, &b);\n float h,s,l;\n RGBtoHSL(r,g,b, h,s,l);\n lua_pushvector3(L, h,s,l);\n return 1;\n}\n\nstatic int global_hsl_to_rgb (lua_State *L)\n{\n check_args(L,1);\n float h,s,l;\n lua_checkvector3(L, 1, &h, &s, &l);\n float r,g,b;\n HSLtoRGB(h,s,l, r,g,b);\n lua_pushvector3(L, r,g,b);\n return 1;\n}\n\nstatic int global_hsv_to_hsl (lua_State *L)\n{\n check_args(L,1);\n float hh,ss,ll;\n lua_checkvector3(L, 1, &hh, &ss, &ll);\n float h,s,l;\n HSVtoHSL(hh,ss,ll, h,s,l);\n lua_pushvector3(L, h,s,l);\n return 1;\n}\n\nstatic int global_hsl_to_hsv (lua_State *L)\n{\n check_args(L,1);\n float h,s,l;\n lua_checkvector3(L, 1, &h, &s, &l);\n float hh,ss,ll;\n HSLtoHSV(h,s,l, hh,ss,ll);\n lua_pushvector3(L, hh,ss,ll);\n return 1;\n}\n\nstatic int global_rgb_to_hsv (lua_State *L)\n{\n check_args(L,1);\n float r,g,b;\n lua_checkvector3(L, 1, &r, &g, &b);\n float h,s,v;\n RGBtoHSV(r,g,b, h,s,v);\n lua_pushvector3(L, h,s,v);\n return 1;\n}\n\nstatic int global_hsv_to_rgb (lua_State *L)\n{\n check_args(L,1);\n float h,s,v;\n lua_checkvector3(L, 1, &h, &s, &v);\n float r,g,b;\n HSVtoRGB(h,s,v, r,g,b);\n lua_pushvector3(L, r,g,b);\n return 1;\n}\n\n\n\n// {{{ Particles\n\nnamespace {\n struct UVRect { float u1,v1, u2,v2; };\n struct ParticleDefinition;\n\n struct ParticleDefinition {\n ParticleDefinition (const std::string &m, const std::vector<UVRect> fs, lua_State *L, int t)\n : material(m), frames(fs)\n {\n table.takeTableFromLuaStack(L, t);\n }\n void destroy (lua_State *L);\n\n std::string material;\n std::vector<UVRect> frames;\n ExternalTable table;\n };\n\n std::map<std::string, ParticleDefinition*> particle_defs;\n\n struct LuaParticle {\n\n LuaPtr state;\n GfxParticle *p;\n ParticleDefinition *pd;\n\n LuaParticle (lua_State *L, GfxParticle *p, ParticleDefinition *pd)\n : p(p), pd(pd)\n {\n state.set(L);\n }\n\n void destroy (lua_State *L)\n {\n state.setNil(L);\n p->release();\n }\n\n bool updateGraphics (lua_State *L, float elapsed, int error_handler)\n {\n state.push(L);\n // stack: err tab\n\n bool destroy = false;\n\n lua_getfield(L, -1, \"behaviour\");\n // stack: err tab func\n lua_pushvalue(L,-2);\n // stack: err tab func tab\n lua_pushnumber(L,elapsed);\n // stack: err tab func tab elapsed\n int status = lua_pcall(L,2,1,error_handler);\n if (status) {\n // stack: err,tab,msg\n // pop the error message since the error handler will\n // have already printed it out\n lua_pop(L,1);\n //stack: err,tab\n destroy = true;\n } else {\n // stack: err, tab, bool\n if (lua_isboolean(L,-1) && !lua_toboolean(L,-1)) destroy = true;\n lua_pop(L,1); // destroy code\n // stack: err, tab\n }\n // stack: err, tab\n\n if (!destroy) {\n // handle stuff from tab\n lua_getfield(L, -1, \"position\");\n if (!lua_isvector3(L,-1)) {\n CERR << \"Particle position was not a vector3.\" << std::endl;\n destroy = true;\n } else {\n p->pos = check_v3(L,-1);\n }\n lua_pop(L,1);\n\n lua_getfield(L, -1, \"dimensions\");\n if (lua_isnil(L,-1)) {\n p->dimensions = Vector3(1,1,1);\n } else if (!lua_isvector3(L,-1)) {\n CERR << \"Particle dimensions was not a number.\" << std::endl;\n destroy = true;\n } else {\n p->dimensions = check_v3(L,-1);\n }\n lua_pop(L,1);\n\n lua_getfield(L, -1, \"diffuse\");\n if (lua_isnil(L,-1)) {\n p->diffuse = Vector3(1,1,1);\n } else if (!lua_isvector3(L,-1)) {\n CERR << \"Particle diffuse was not a vector3.\" << std::endl;\n destroy = true;\n } else {\n p->diffuse = check_v3(L,-1);\n }\n lua_pop(L,1);\n\n lua_getfield(L, -1, \"emissive\");\n if (lua_isnil(L,-1)) {\n p->emissive = Vector3(0,0,0);\n } else if (!lua_isvector3(L,-1)) {\n CERR << \"Particle emissive was not a vector3.\" << std::endl;\n destroy = true;\n } else {\n p->emissive = check_v3(L,-1);\n }\n lua_pop(L,1);\n\n lua_getfield(L, -1, \"alpha\");\n if (lua_isnil(L,-1)) {\n p->alpha = 1;\n } else if (!lua_isnumber(L,-1)) {\n CERR << \"Particle alpha was not a number.\" << std::endl;\n destroy = true;\n } else {\n p->alpha = check_float(L,-1);\n }\n lua_pop(L,1);\n\n lua_getfield(L, -1, \"angle\");\n if (lua_isnil(L,-1)) {\n p->angle = 0;\n } else if (!lua_isnumber(L,-1)) {\n CERR << \"Particle angle was not a number.\" << std::endl;\n destroy = true;\n } else {\n p->angle = check_float(L,-1);\n }\n lua_pop(L,1);\n\n bool has_frame = false;\n lua_getfield(L, -1, \"frame\");\n if (lua_isnil(L,-1) || pd->frames.size()==0) {\n } else if (!lua_isnumber(L,-1)) {\n has_frame = true;\n CERR << \"Particle frame was not a number.\" << std::endl;\n destroy = true;\n } else {\n has_frame = true;\n float frame_ = lua_tonumber(L,-1);\n unsigned frame = unsigned(frame_);\n UVRect &uvr = pd->frames[frame % pd->frames.size()];\n p->u1 = uvr.u1;\n p->v1 = uvr.v1;\n p->u2 = uvr.u2;\n p->v2 = uvr.v2;\n }\n lua_pop(L,1);\n\n bool has_uvs = false;\n lua_getfield(L, -1, \"uvs\");\n if (has_frame || lua_isnil(L,-1)) {\n } else if (!lua_istable(L,-1)) {\n CERR << \"Particle uvs was not a table.\" << std::endl;\n destroy = true;\n } else if (lua_objlen(L,-1) != 4) {\n CERR << \"Particle uvs did not have 4 elements.\" << std::endl;\n destroy = true;\n } else {\n has_uvs = true;\n lua_rawgeti(L, -1, 1);\n if (!lua_isnumber(L,-1)) {\n CERR << \"Texture ordinate u1 was not a number.\" << std::endl;\n destroy = true;\n }\n p->u1 = lua_tonumber(L,-1);\n lua_pop(L,1);\n\n lua_rawgeti(L, -1, 1);\n if (!lua_isnumber(L,-1)) {\n CERR << \"Texture ordinate v1 was not a number.\" << std::endl;\n destroy = true;\n }\n p->v1 = lua_tonumber(L,-1);\n lua_pop(L,1);\n\n\n lua_rawgeti(L, -1, 1);\n if (!lua_isnumber(L,-1)) {\n CERR << \"Texture ordinate u2 was not a number.\" << std::endl;\n destroy = true;\n }\n p->u2 = lua_tonumber(L,-1);\n lua_pop(L,1);\n\n lua_rawgeti(L, -1, 1);\n if (!lua_isnumber(L,-1)) {\n CERR << \"Texture ordinate v2 was not a number.\" << std::endl;\n destroy = true;\n }\n p->v2 = lua_tonumber(L,-1);\n lua_pop(L,1);\n\n }\n lua_pop(L,1);\n if (!has_frame && !has_uvs) {\n p->setDefaultUV();\n }\n // stack: err, tab\n }\n lua_pop(L,1);\n\n // stack: err\n return destroy;\n }\n };\n\n std::vector<LuaParticle*> particles;\n\n void ParticleDefinition::destroy (lua_State *L)\n {\n // remove any particles that used to belong to this definition\n for (unsigned i=0 ; i<particles.size() ; ++i) {\n LuaParticle *p = particles[i];\n if (p->pd == this) {\n p->destroy(L);\n delete p;\n vect_remove_fast(particles, i);\n --i;\n }\n }\n table.destroy(L);\n }\n\n void reset_particles (lua_State *L)\n {\n // remove any particles that used to belong to this definition\n for (unsigned i=0 ; i<particles.size() ; ++i) {\n LuaParticle *p = particles[i];\n p->destroy(L);\n delete p;\n }\n particles.clear();\n }\n}\n\nstatic int global_gfx_particle_define (lua_State *L)\n{\nTRY_START\n check_args(L,2);\n std::string name = check_path(L,1);\n if (!lua_istable(L,2)) my_lua_error(L,\"Parameter 2 must be a table.\");\n\n lua_getfield(L, 2, \"map\");\n if (lua_type(L,-1) != LUA_TSTRING) my_lua_error(L,\"Particle map must be a string.\");\n std::string texture_name = lua_tostring(L,-1);\n auto dr = disk_resource_use<GfxTextureDiskResource>(texture_name);\n lua_pop(L,1);\n lua_pushnil(L);\n lua_setfield(L, 2, \"map\");\n\n lua_getfield(L, 2, \"frames\");\n std::vector<UVRect> frames;\n if (lua_isnil(L,-1)) {\n } else if (!lua_istable(L,-1)) {\n my_lua_error(L,\"Particle frames must be an array.\");\n } else {\n unsigned nums = lua_objlen(L,-1);\n if (nums%4 != 0) my_lua_error(L,\"Number of texcoords should be a multiple of 4.\");\n frames.resize(nums/4);\n for (unsigned i=0 ; i<nums/4 ; ++i) {\n UVRect &uvrect = frames[i];\n\n lua_rawgeti(L,-1,4*i+1);\n if (!lua_isnumber(L,-1)) my_lua_error(L, \"Texcoord must be a number\");\n uvrect.u1 = 0.5+lua_tonumber(L,-1);\n lua_pop(L,1);\n\n lua_rawgeti(L,-1,4*i+2);\n if (!lua_isnumber(L,-1)) my_lua_error(L, \"Texcoord must be a number\");\n uvrect.v1 = 0.5+lua_tonumber(L,-1);\n lua_pop(L,1);\n\n lua_rawgeti(L,-1,4*i+3);\n if (!lua_isnumber(L,-1)) my_lua_error(L, \"Texcoord must be a number\");\n uvrect.u2 = 0.5+lua_tonumber(L,-1);\n lua_pop(L,1);\n\n lua_rawgeti(L,-1,4*i+4);\n if (!lua_isnumber(L,-1)) my_lua_error(L, \"Texcoord must be a number\");\n uvrect.v2 = 0.5+lua_tonumber(L,-1);\n lua_pop(L,1);\n\n uvrect.u2 += uvrect.u1 - 1;\n uvrect.v2 += uvrect.v1 - 1;\n\n }\n }\n lua_pop(L,1); // pop frames array\n lua_pushnil(L);\n lua_setfield(L, 2, \"frames\");\n\n lua_getfield(L, 2, \"behaviour\");\n if (!lua_isfunction(L,-1)) my_lua_error(L,\"Particle behaviour must be a function.\");\n\n ParticleDefinition *&pd = particle_defs[name];\n if (pd != NULL) {\n pd->destroy(L);\n delete pd;\n }\n\n ParticleDefinition *newpd = new ParticleDefinition(name, frames, L, 2);\n pd = newpd;\n gfx_particle_define(name, dr); // will invalidate\n return 0;\nTRY_END\n}\n\nstatic int global_gfx_particle_all (lua_State *L)\n{\nTRY_START\n check_args(L, 0);\n std::vector<std::string> list = gfx_particle_all();\n lua_newtable(L);\n int counter = 1;\n for (unsigned i=0 ; i<list.size() ; ++i) {\n push_string(L, list[i]);\n lua_rawseti(L, -2, counter);\n counter++;\n }\n return 1;\nTRY_END\n}\n\nstatic int global_gfx_particle_reset (lua_State *L)\n{\nTRY_START\n check_args(L, 0);\n reset_particles(L);\n return 0;\nTRY_END\n}\n\n\nstatic int global_gfx_particle_emit (lua_State *L)\n{\nTRY_START\n check_args(L,3);\n std::string name = check_path(L,1);\n Vector3 pos = check_v3(L,2);\n if (!lua_istable(L,3)) my_lua_error(L,\"Parameter 3 must be a table.\");\n\n ParticleDefinition *pd = particle_defs[name];\n\n if (pd==NULL) {\n my_lua_error(L, \"No such particle \\\"\"+name+\"\\\"\");\n }\n\n pd->table.dump(L);\n // stack: particle\n\n push_v3(L, pos);\n lua_setfield(L,-2,\"position\");\n lua_pushstring(L, name.c_str());\n lua_setfield(L,-2,\"name\");\n\n // stack: particle\n for (lua_pushnil(L) ; lua_next(L,3)!=0 ; lua_pop(L,1)) {\n // stack: particle, key, val\n lua_pushvalue(L,-2);\n // stack: particle, key, val, key\n lua_pushvalue(L,-2);\n // stack: particle, key, val, key, val\n lua_settable(L,-5);\n // stack: particle, key, val\n }\n // stack: particle\n\n\n LuaParticle *lp = new LuaParticle(L, gfx_particle_emit(pd->material), pd);\n particles.push_back(lp);\n\n push_cfunction(L, my_lua_error_handler);\n int error_handler = lua_gettop(L);\n // stack: eh\n\n bool destroy = lp->updateGraphics(L, 0, error_handler);\n if (destroy) {\n // stack: eh,\n particles.pop_back();\n lp->destroy(L);\n delete lp;\n }\n // stack: eh\n\n lua_pop(L,1);\n // stack:\n\n return 0;\nTRY_END\n}\n\nfloat particle_step_size = 0.01f;\nfloat particle_step_remainder= 0.0f;\n\nstatic int global_gfx_particle_step_size (lua_State *L)\n{\nTRY_START\n switch (lua_gettop(L)) {\n case 0: {\n lua_pushnumber(L, particle_step_size);\n return 1;\n }\n case 1: {\n float v = check_float(L,1);\n if (v<=0) my_lua_error(L, \"Step size must not be 0 or below\");\n particle_step_size = v;\n return 0;\n }\n default:\n my_lua_error(L, \"Getter/setter: Expected 0 or 1 arguments.\");\n return 0; // silence compiler\n }\nTRY_END\n}\n\nstatic int global_gfx_particle_pump (lua_State *L)\n{\nTRY_START\n check_args(L,1);\n float elapsed = check_float(L,1);\n\n elapsed += particle_step_remainder;\n\n push_cfunction(L, my_lua_error_handler);\n int error_handler = lua_gettop(L);\n // stack: err\n\n while (elapsed > particle_step_size) {\n elapsed -= particle_step_size;\n for (size_t i=0 ; i<particles.size() ; ++i) {\n LuaParticle *lp = particles[i];\n bool destroy = lp->updateGraphics(L, particle_step_size, error_handler);\n\n if (destroy) {\n // stack: err\n APP_ASSERT(particles[i]==lp);\n vect_remove_fast(particles, i);\n lp->destroy(L);\n delete lp;\n --i;\n continue;\n }\n // stack: err\n }\n }\n particle_step_remainder = elapsed;\n\n lua_pop(L,1);\n\n return 0;\nTRY_END\n}\n\nstatic int global_gfx_particle_count (lua_State *L)\n{\n check_args(L,0);\n lua_pushnumber(L, particles.size());\n return 1;\n}\n\n// }}}\n\n\n\n\n#include \"lua_wrappers_gfx.h\"\n\n\n////////////////////////////////////////////////////////////////////////////////\n\ntypedef std::map<std::string, ExternalTable> MatMap;\nstatic MatMap mat_map;\n\nstatic std::set<std::string> system_fields = {\n \"shader\",\n \"sceneBlend\",\n \"backfaces\",\n \"shadowAlphaReject\",\n \"castShadows\",\n \"shadowBias\",\n \"additionalLighting\",\n \"blendedBones\",\n};\n\nGfxTextureAddrMode addr_mode_from_string(const std::string &kind, const std::string &mat_name,\n const std::string &param_name, const std::string &v)\n{\n if (v == \"WRAP\")\n return GFX_AM_WRAP;\n else if (v == \"MIRROR\")\n return GFX_AM_MIRROR;\n else if (v == \"CLAMP\")\n return GFX_AM_CLAMP;\n else if (v == \"BORDER\")\n return GFX_AM_BORDER;\n else\n EXCEPTEX << kind << \" \\\"\" << mat_name << \"\\\" param \" << param_name\n << \" had invalid texture addressing mode: \" << v << ENDL;\n}\n\nGfxTextureFilterMode filter_mode_from_string(const std::string &kind, const std::string &mat_name,\n const std::string &param_name, const std::string &v)\n{\n if (v == \"NONE\")\n return GFX_FILTER_NONE;\n else if (v == \"POINT\")\n return GFX_FILTER_POINT;\n else if (v == \"LINEAR\")\n return GFX_FILTER_LINEAR;\n else if (v == \"ANISOTROPIC\")\n return GFX_FILTER_ANISOTROPIC;\n else\n EXCEPTEX << kind << \" \\\"\" << mat_name << \"\\\" param \" << param_name\n << \" had invalid texture filtering mode: \" << v << ENDL;\n}\n\nstatic void handle_param_binding(const std::string &kind, const std::string &mat_name,\n GfxGslRunParams &bindings, GfxTextureStateMap &textures,\n const GfxGslParam &p, ExternalTable &t, const std::string &k)\n{\n APP_ASSERT(t.has(k));\n lua_Number number;\n Vector2 v2;\n Vector3 v3;\n Vector4 v4;\n switch (p.t) {\n case GFX_GSL_STATIC_FLOAT1:\n case GFX_GSL_FLOAT1:\n if (t.get(k, number)) {\n bindings[k] = GfxGslParam::float1(number).copyStaticFrom(p);\n } else {\n EXCEPT << kind << \" \\\"\" << mat_name << \"\\\" expected param \" << k << \" to have type: \"\n << \"number\" << std::endl;\n }\n break;\n\n case GFX_GSL_STATIC_FLOAT2:\n case GFX_GSL_FLOAT2:\n if (t.get(k, v2)) {\n bindings[k] = GfxGslParam(v2).copyStaticFrom(p);\n } else {\n EXCEPT << kind << \" \\\"\" << mat_name << \"\\\" expected param \" << k << \" to have type: \"\n << \"vector2\" << std::endl;\n }\n break;\n\n case GFX_GSL_STATIC_FLOAT3:\n case GFX_GSL_FLOAT3:\n if (t.get(k, v3)) {\n bindings[k] = GfxGslParam(v3).copyStaticFrom(p);\n } else {\n EXCEPT << kind << \" \\\"\" << mat_name << \"\\\" expected param \" << k << \" to have type: \"\n << \"vector3\" << std::endl;\n }\n break;\n\n case GFX_GSL_STATIC_FLOAT4:\n case GFX_GSL_FLOAT4:\n if (t.get(k, v4)) {\n bindings[k] = GfxGslParam(v4).copyStaticFrom(p);\n } else {\n EXCEPT << kind << \" \\\"\" << mat_name << \"\\\" expected param \" << k << \" to have type: \"\n << \"vector4\" << std::endl;\n }\n break;\n\n case GFX_GSL_STATIC_INT1:\n case GFX_GSL_INT1:\n EXCEPTEX << \"Not implemented.\" << ENDL;\n\n case GFX_GSL_STATIC_INT2:\n case GFX_GSL_INT2:\n EXCEPTEX << \"Not implemented.\" << ENDL;\n\n case GFX_GSL_STATIC_INT3:\n case GFX_GSL_INT3:\n EXCEPTEX << \"Not implemented.\" << ENDL;\n\n case GFX_GSL_STATIC_INT4:\n case GFX_GSL_INT4:\n EXCEPTEX << \"Not implemented.\" << ENDL;\n\n case GFX_GSL_FLOAT_TEXTURE1:\n case GFX_GSL_FLOAT_TEXTURE2:\n case GFX_GSL_FLOAT_TEXTURE3:\n case GFX_GSL_FLOAT_TEXTURE4:\n case GFX_GSL_FLOAT_TEXTURE_CUBE:\n GfxTextureState state;\n std::string tex_name;\n SharedPtr<ExternalTable> t2;\n Vector4 solid_colour;\n if (t.get(k, tex_name)) {\n auto *tex = dynamic_cast<GfxTextureDiskResource*>(disk_resource_get_or_make(tex_name));\n if (tex == NULL) EXCEPT << \"Resource is not a texture \\\"\" << tex_name << \"\\\"\" << ENDL;\n state = gfx_texture_state_anisotropic(tex);\n } else if (t.get(k, t2)) {\n if (!t2->get(\"image\", tex_name)) {\n EXCEPT << kind << \" \\\"\" << mat_name << \"\\\" param \" << k\n << \" texture assignment lacks 'image' field.\" << std::endl;\n }\n auto *tex = dynamic_cast<GfxTextureDiskResource*>(disk_resource_get_or_make(tex_name));\n if (tex == NULL) EXCEPT << \"Resource is not a texture \\\"\" << tex_name << \"\\\"\" << ENDL;\n state.texture = tex;\n std::string mode_u_str, mode_v_str, mode_w_str;\n t2->get(\"modeU\", mode_u_str, std::string(\"WRAP\"));\n t2->get(\"modeV\", mode_v_str, std::string(\"WRAP\"));\n t2->get(\"modeW\", mode_w_str, std::string(\"WRAP\"));\n state.modeU = addr_mode_from_string(kind, mat_name, k, mode_u_str);\n state.modeV = addr_mode_from_string(kind, mat_name, k, mode_v_str);\n state.modeW = addr_mode_from_string(kind, mat_name, k, mode_w_str);\n std::string filter_min_str, filter_max_str, filter_mip_str;\n t2->get(\"filterMin\", filter_min_str, std::string(\"ANISOTROPIC\"));\n t2->get(\"filterMax\", filter_max_str, std::string(\"ANISOTROPIC\"));\n t2->get(\"filterMip\", filter_mip_str, std::string(\"LINEAR\"));\n state.filterMin = filter_mode_from_string(kind, mat_name, k, filter_min_str);\n state.filterMax = filter_mode_from_string(kind, mat_name, k, filter_max_str);\n state.filterMip = filter_mode_from_string(kind, mat_name, k, filter_mip_str);\n lua_Number anisotropy;\n t2->get(\"anisotropy\", anisotropy, 16.0);\n state.anisotropy = anisotropy;\n } else if (t.get(k, solid_colour)) {\n bindings[k] = GfxGslParam(solid_colour).copyStaticFrom(p);\n break;\n } else {\n EXCEPT << kind << \" \\\"\" << mat_name << \"\\\" expected param \" << k\n << \" to be a texture assignment (name or table).\" << std::endl;\n }\n //CVERB << key << \" bound to texture \" << state->getName() << std::endl;\n textures[k] = state;\n break;\n }\n}\nstatic int global_gfx_register_material (lua_State *L)\n{\nTRY_START\n\n check_args(L, 2);\n std::string name = check_path(L, 1);\n if (!lua_istable(L, 2))\n my_lua_error(L, \"Second parameter should be a table\");\n\n //CVERB << name << std::endl;\n\n ExternalTable &t = mat_map[name];\n t.clear(L);\n t.takeTableFromLuaStack(L, 2);\n\n GfxTextureStateMap textures;\n GfxGslRunParams bindings;\n\n std::string shader_name;\n t.get(\"shader\", shader_name, std::string(\"/system/Default\"));\n GfxShader *shader = gfx_shader_get(shader_name);\n\n GFX_MAT_SYNC;\n GfxMaterial *gfxmat = gfx_material_add_or_get(name);\n\n // In case we crash early, leave the materials in a reasonable state.\n gfxmat->buildOgreMaterials();\n\n std::string scene_blend_str;\n t.get(\"sceneBlend\", scene_blend_str, std::string(\"OPAQUE\"));\n GfxMaterialSceneBlend scene_blend;\n if (scene_blend_str == \"OPAQUE\") {\n scene_blend = GFX_MATERIAL_OPAQUE;\n } else if (scene_blend_str == \"ALPHA\") {\n scene_blend = GFX_MATERIAL_ALPHA;\n } else if (scene_blend_str == \"ALPHA_DEPTH\") {\n scene_blend = GFX_MATERIAL_ALPHA_DEPTH;\n } else {\n my_lua_error(L, \"Unknown sceneBlend: \" + scene_blend_str);\n }\n gfxmat->setSceneBlend(scene_blend);\n\n bool backfaces;\n t.get(\"backfaces\", backfaces, false);\n gfxmat->setBackfaces(backfaces);\n\n bool shadow_alpha_reject;\n t.get(\"shadowAlphaReject\", shadow_alpha_reject, false);\n gfxmat->setShadowAlphaReject(shadow_alpha_reject);\n\n bool cast_shadows;\n t.get(\"castShadows\", cast_shadows, true);\n gfxmat->setCastShadows(cast_shadows);\n\n lua_Number shadow_bias;\n t.get(\"shadowBias\", shadow_bias, 0.0);\n gfxmat->setShadowBias(shadow_bias);\n\n bool additional_lighting;\n t.get(\"additionalLighting\", additional_lighting, false);\n\n lua_Number blended_bones;\n t.get(\"blendedBones\", blended_bones, 0.0);\n if (blended_bones != floor(blended_bones) || blended_bones < 0) {\n my_lua_error(L,\"blendedBones must be a non-negative integer\");\n }\n gfxmat->setBoneBlendWeights(blended_bones);\n\n gfxmat->setAdditionalLighting(additional_lighting);\n\n\n const GfxGslRunParams &params = shader->getParams();\n for (const auto &pair : t) {\n const std::string &k = pair.first;\n if (system_fields.find(k) != system_fields.end()) continue;\n auto it = params.find(k);\n if (it == params.end()) {\n EXCEPT << \"Material \\\"\" << name << \"\\\" references unknown uniform: \"\n << pair.first << std::endl;\n }\n handle_param_binding(\"Material\", name, bindings, textures, it->second, t, k);\n }\n for (const auto &pair : params) {\n if (t.has(pair.first)) continue;\n // Use default.\n if (gfx_gasoline_param_is_texture(pair.second)) continue;\n bindings[pair.first] = pair.second;\n }\n\n gfxmat->setShader(shader);\n gfxmat->setTextures(textures);\n gfxmat->setBindings(bindings);\n\n gfxmat->buildOgreMaterials();\n\n return 0;\nTRY_END\n}\n\n////////////////////////////////////////////////////////////////////////////////\n\n// sky material interface\n\nstatic GfxSkyMaterialSceneBlend skymat_scene_blend_from_string (lua_State *L, const std::string& factor)\n{\n if (factor==\"OPAQUE\") {\n return GFX_SKY_MATERIAL_OPAQUE;\n } else if (factor==\"ALPHA\") {\n return GFX_SKY_MATERIAL_ALPHA;\n } else if (factor==\"ADD\") {\n return GFX_SKY_MATERIAL_ADD;\n } else {\n std::string msg = \"Unknown sky material scene blend: \";\n msg += factor;\n my_lua_error(L,msg);\n return GFX_SKY_MATERIAL_OPAQUE; // never happens\n }\n}\n\n/*\nstatic void skymat_push_string_from_scene_blend (lua_State *L, GfxSkyMaterialSceneBlend factor)\n{\n switch (factor) {\n case GFX_SKY_MATERIAL_OPAQUE:\n lua_pushstring(L,\"OPAQUE\");\n break;\n case GFX_SKY_MATERIAL_ALPHA:\n lua_pushstring(L,\"ALPHA\");\n break;\n case GFX_SKY_MATERIAL_ADD:\n lua_pushstring(L,\"ADD\");\n break;\n default:\n my_lua_error(L,\"Unknown sky material blend\");\n }\n}\n*/\n\nstatic int global_gfx_register_sky_material (lua_State *L)\n{\nTRY_START\n\n check_args(L,2);\n std::string name = check_path(L,1);\n if (!lua_istable(L,2))\n my_lua_error(L,\"Second parameter should be a table\");\n\n ExternalTable t;\n t.takeTableFromLuaStack(L,2);\n\n std::string shader_name;\n t.get(\"shader\", shader_name, std::string(\"/system/SkyDefault\"));\n GfxShader *shader = gfx_shader_get(shader_name);\n\n GFX_MAT_SYNC;\n GfxSkyMaterial *gfxskymat = gfx_sky_material_add_or_get(name);\n\n std::string scene_blend;\n t.get(\"sceneBlend\", scene_blend, std::string(\"OPAQUE\"));\n\n GfxTextureStateMap textures;\n GfxShaderBindings bindings;\n\n const GfxGslRunParams &params = shader->getParams();\n for (const auto &pair : t) {\n const std::string &k = pair.first;\n if (k == \"shader\") continue;\n if (k == \"sceneBlend\") continue;\n auto it = params.find(k);\n if (it == params.end()) {\n CERR << \"Material \\\"\" << name << \"\\\" references unknown uniform: \"\n << pair.first << std::endl;\n }\n handle_param_binding(\"Sky material\", name, bindings, textures, it->second, t, k);\n }\n\n gfxskymat->setShader(shader);\n gfxskymat->setSceneBlend(skymat_scene_blend_from_string(L, scene_blend));\n gfxskymat->setTextures(textures);\n gfxskymat->setBindings(bindings);\n\n return 0;\nTRY_END\n}\n\nstatic int global_gfx_register_shader (lua_State *L)\n{\nTRY_START\n\n check_args(L,2);\n std::string name = check_path(L,1);\n if (!lua_istable(L,2))\n my_lua_error(L,\"Second parameter should be a table\");\n\n ExternalTable t;\n t.takeTableFromLuaStack(L,2);\n\n std::string vertex_code;\n std::string dangs_code;\n std::string additional_code;\n\n if (!t.get(\"vertexCode\", vertex_code))\n my_lua_error(L, \"Shader \\\"\" + name + \"\\\" did not specify vertexCode.\");\n t.get(\"dangsCode\", dangs_code, std::string());\n t.get(\"additionalCode\", additional_code, std::string());\n\n GfxGslRunParams uniforms;\n\n typedef ExternalTable::KeyIterator KI;\n for (KI i=t.begin(), i_=t.end() ; i!=i_ ; ++i) {\n const std::string &key = i->first;\n if (key == \"vertexCode\") continue;\n if (key == \"dangsCode\") continue;\n if (key == \"additionalCode\") continue;\n\n // must be a texture or param\n GfxGslParam uniform;\n\n SharedPtr<ExternalTable> tab;\n if (!t.get(key, tab)) {\n my_lua_error(L, \"Uniform \\\"\"+key+\"\\\" incorrectly defined\");\n }\n\n std::string uniform_kind;\n if (!tab->get(\"uniformKind\", uniform_kind)) {\n my_lua_error(L, \"Uniform \\\"\"+key+\"\\\" expected string 'uniformKind' field.\");\n }\n\n if (uniform_kind == \"PARAM\") {\n bool static_value;\n tab->get(\"static\", static_value, false);\n std::string value_kind; // type of the actual data (e.g. FLOAT)\n if (!tab->get(\"valueKind\", value_kind)) {\n my_lua_error(L, \"Uniform \\\"\"+key+\"\\\" expected string 'valueKind' field.\");\n }\n\n if (value_kind==\"FLOAT\") {\n std::vector<float> vs;\n for (unsigned i=1 ; true ; ++i) {\n lua_Number def;\n if (tab->get(i, def)) {\n vs.push_back(def);\n } else break;\n }\n switch (vs.size()) {\n case 0: my_lua_error(L, \"Uniform \\\"\" + key + \"\\\" must have a default value\");\n case 1: uniform = GfxGslParam::float1(vs[0]); break;\n case 2: uniform = GfxGslParam::float2(vs[0], vs[1]); break;\n case 3: uniform = GfxGslParam::float3(vs[0], vs[1], vs[2]); break;\n case 4: uniform = GfxGslParam::float4(vs[0], vs[1], vs[2], vs[3]); break;\n default: my_lua_error(L, \"Uniform \\\"\" + key + \"\\\" unsupported number of default values\");\n }\n } else {\n my_lua_error(L, \"Uniform \\\"\"+key+\"\\\" unrecognised 'valueKind' field: \\\"\"+value_kind+\"\\\"\");\n }\n\n if (static_value) uniform = uniform.setStatic();\n\n } else if (uniform_kind == \"TEXTURE1D\") {\n Vector3 c;\n tab->get(\"defaultColour\", c, Vector3(1, 1, 1));\n\n lua_Number a;\n tab->get(\"defaultAlpha\", a, 1.0);\n\n uniform = GfxGslParam(GFX_GSL_FLOAT_TEXTURE1, c.x, c.y, c.z, a);\n\n } else if (uniform_kind == \"TEXTURE2D\") {\n Vector3 c;\n tab->get(\"defaultColour\", c, Vector3(1, 1, 1));\n\n lua_Number a;\n tab->get(\"defaultAlpha\", a, 1.0);\n\n uniform = GfxGslParam(GFX_GSL_FLOAT_TEXTURE2, c.x, c.y, c.z, a);\n\n } else if (uniform_kind == \"TEXTURE4D\") {\n Vector3 c;\n tab->get(\"defaultColour\", c, Vector3(1, 1, 1));\n\n lua_Number a;\n tab->get(\"defaultAlpha\", a, 1.0);\n\n uniform = GfxGslParam(GFX_GSL_FLOAT_TEXTURE4, c.x, c.y, c.z, a);\n\n } else if (uniform_kind == \"TEXTURE3D\") {\n Vector3 c;\n tab->get(\"defaultColour\", c, Vector3(1, 1, 1));\n\n lua_Number a;\n tab->get(\"defaultAlpha\", a, 1.0);\n\n uniform = GfxGslParam(GFX_GSL_FLOAT_TEXTURE3, c.x, c.y, c.z, a);\n\n } else if (uniform_kind == \"TEXTURE_CUBE\") {\n Vector3 c;\n tab->get(\"defaultColour\", c, Vector3(1, 1, 1));\n\n lua_Number a;\n tab->get(\"defaultAlpha\", a, 1.0);\n\n uniform = GfxGslParam(GFX_GSL_FLOAT_TEXTURE_CUBE, c.x, c.y, c.z, a);\n\n } else {\n my_lua_error(L, \"Did not understand 'uniformKind' value \\\"\" + uniform_kind + \"\\\"\");\n }\n\n uniforms[key] = uniform;\n }\n\n gfx_shader_check(name, vertex_code, dangs_code, additional_code, uniforms, false);\n\n gfx_shader_make_or_reset(name, vertex_code, dangs_code, additional_code, uniforms, false);\n\n return 0;\nTRY_END\n}\n\n////////////////////////////////////////////////////////////////////////////////\n\nstatic int global_resource_exists (lua_State *L)\n{\nTRY_START\n check_args(L,1);\n std::string name = check_path(L,1);\n bool b = Ogre::ResourceGroupManager::getSingleton().\n resourceExists(\"GRIT\",name.substr(1));\n lua_pushboolean(L,b);\n return 1;\nTRY_END\n}\n\n\nstatic int global_gfx_d3d9 (lua_State *L)\n{\nTRY_START\n check_args(L,0);\n lua_pushboolean(L, gfx_d3d9());\n return 1;\nTRY_END\n}\n\nstatic int global_gfx_describe_texture (lua_State *L)\n{\nTRY_START\n check_args(L,1);\n std::string name = check_path(L,1);\n Ogre::TexturePtr tex = Ogre::TextureManager::getSingleton().getByName(name.substr(1), RESGRP);\n if (tex.isNull())\n EXCEPT << \"Texture does not exist: \\\"\" << name << \"\\\"\" << std::endl;\n if (!tex->isPrepared() && !tex->isLoaded())\n EXCEPT << \"Texture is not loaded: \\\"\" << name << \"\\\"\" << std::endl;\n if (!tex->isLoaded())\n tex->load();\n lua_newtable(L);\n ExternalTable t;\n t.set(\"height\", lua_Number(tex->getHeight()));\n t.set(\"width\", lua_Number(tex->getWidth()));\n t.set(\"depth\", lua_Number(tex->getDepth()));\n t.set(\"desiredFloatBitDepth\", lua_Number(tex->getDesiredFloatBitDepth()));\n t.set(\"desiredFormat\", lua_Number(tex->getDesiredFormat()));\n t.set(\"desiredIntegerBitDepth\", lua_Number(tex->getDesiredIntegerBitDepth()));\n t.set(\"format\", lua_Number(tex->getFormat()));\n t.set(\"numFaces\", lua_Number(tex->getNumFaces()));\n t.set(\"numMipmaps\", lua_Number(tex->getNumMipmaps()));\n t.set(\"srcDepth\", lua_Number(tex->getSrcDepth()));\n t.set(\"srcFormat\", lua_Number(tex->getSrcFormat()));\n t.set(\"srcHeight\", lua_Number(tex->getSrcHeight()));\n t.set(\"srcWidth\", lua_Number(tex->getSrcWidth()));\n t.set(\"textureType\", lua_Number(tex->getTextureType()));\n t.set(\"hasAlpha\", tex->hasAlpha());\n t.dump(L);\n return 1;\nTRY_END\n}\n\nstatic int global_gfx_dump_shadow_map (lua_State *L)\n{\nTRY_START\n check_args(L, 2);\n std::string filename = check_string(L,1);\n int i = check_int(L, 2, 0, 3);\n Ogre::TexturePtr tex = ogre_sm->getShadowTexture(i);\n Ogre::Image image;\n tex->convertToImage(image);\n\n uint32_t width = image.getWidth();\n uint32_t height = image.getHeight();\n uint8_t channels = 1;\n\n OutFile out(filename);\n out.write(width);\n out.write(height);\n out.write(channels);\n out.write('a'); // No alpha.\n\n float *raw = reinterpret_cast<float*>(image.getData());\n for (size_t i = 0 ; i < width * height ; ++i) {\n out.write(raw[i]);\n }\n\n return 1;\nTRY_END\n}\n\nstatic const luaL_reg global[] = {\n\n {\"gfx_d3d9\", global_gfx_d3d9},\n\n {\"gfx_render\", global_gfx_render},\n {\"gfx_bake_env_cube\", global_gfx_bake_env_cube},\n {\"gfx_screenshot\", global_gfx_screenshot},\n {\"gfx_option\", global_gfx_option},\n {\"gfx_option_reset\", global_gfx_option_reset},\n {\"gfx_body_make\", global_gfx_body_make},\n {\"gfx_text_body_make\", global_gfx_text_body_make},\n {\"gfx_instances_make\", global_gfx_instances_make},\n {\"gfx_ranged_instances_make\", global_gfx_ranged_instances_make},\n {\"gfx_sky_body_make\", global_gfx_sky_body_make},\n {\"gfx_light_make\", global_gfx_light_make},\n {\"gfx_sprite_body_make\", global_gfx_sprite_body_make},\n {\"gfx_decal_make\", global_gfx_decal_make},\n {\"gfx_tracer_body_make\", global_gfx_tracer_body_make},\n\n {\"gfx_tracer_body_pump\", global_gfx_tracer_body_pump},\n {\"gfx_tracer_body_set_left_over_time\", global_gfx_tracer_body_set_left_over_time},\n\n {\"gfx_debug_point\", global_gfx_debug_point},\n {\"gfx_debug_line\", global_gfx_debug_line},\n {\"gfx_debug_triangle\", global_gfx_debug_triangle},\n {\"gfx_debug_quad\", global_gfx_debug_quad},\n\n {\"gfx_register_sky_material\", global_gfx_register_sky_material},\n {\"gfx_register_material\", global_gfx_register_material},\n {\"gfx_register_shader\", global_gfx_register_shader},\n\n {\"gfx_font_define\", global_gfx_font_define},\n {\"gfx_font_line_height\", global_gfx_font_line_height},\n {\"gfx_font_list\", global_gfx_font_list},\n {\"gfx_font_text_width\", global_gfx_font_text_width},\n\n // TODO(dcunnin): Remove these.\n {\"gfx_hud_object_add\", global_hud_object_add},\n {\"gfx_hud_text_add\", global_hud_text_add},\n {\"gfx_hud_class_add\", global_hud_class_add},\n {\"gfx_hud_class_get\", global_hud_class_get},\n {\"gfx_hud_class_has\", global_hud_class_has},\n {\"gfx_hud_class_all\", global_hud_class_all},\n {\"gfx_hud_class_count\", global_hud_class_count},\n {\"gfx_hud_ray\", global_hud_ray},\n\n {\"hud_object_add\", global_hud_object_add},\n {\"hud_text_add\", global_hud_text_add},\n {\"hud_class_add\", global_hud_class_add},\n {\"hud_class_get\", global_hud_class_get},\n {\"hud_class_has\", global_hud_class_has},\n {\"hud_class_all\", global_hud_class_all},\n {\"hud_class_count\", global_hud_class_count},\n {\"hud_ray\", global_hud_ray},\n\n {\"gfx_env_cube\", global_gfx_env_cube},\n {\"gfx_env_cube_cross_fade\", global_gfx_env_cube_cross_fade},\n {\"gfx_fade_dither_map\", global_gfx_fade_dither_map},\n {\"gfx_corona_map\", global_gfx_corona_map},\n {\"gfx_shadow_pcf_noise_map\", global_gfx_shadow_pcf_noise_map},\n {\"gfx_colour_grade\", global_gfx_colour_grade},\n {\"gfx_particle_ambient\", global_gfx_particle_ambient},\n {\"gfx_sunlight_diffuse\", global_gfx_sunlight_diffuse},\n {\"gfx_sunlight_specular\", global_gfx_sunlight_specular},\n {\"gfx_sunlight_direction\", global_gfx_sunlight_direction},\n\n {\"gfx_fog_colour\", global_gfx_fog_colour},\n {\"gfx_fog_density\", global_gfx_fog_density},\n {\"gfx_hell_colour\", global_gfx_hell_colour},\n\n {\"gfx_sun_direction\", global_gfx_sun_direction},\n {\"gfx_sun_colour\", global_gfx_sun_colour},\n {\"gfx_sun_alpha\", global_gfx_sun_alpha},\n {\"gfx_sun_size\", global_gfx_sun_size},\n {\"gfx_sun_falloff_distance\", global_gfx_sun_falloff_distance},\n\n {\"gfx_sky_glare_sun_distance\", global_gfx_sky_glare_sun_distance},\n {\"gfx_sky_glare_horizon_elevation\", global_gfx_sky_glare_horizon_elevation},\n {\"gfx_sky_divider\", global_gfx_sky_divider},\n {\"gfx_sky_colour\", global_gfx_sky_colour},\n {\"gfx_sky_alpha\", global_gfx_sky_alpha},\n {\"gfx_sky_sun_colour\", global_gfx_sky_sun_colour},\n {\"gfx_sky_sun_alpha\", global_gfx_sky_sun_alpha},\n {\"gfx_sky_cloud_colour\", global_gfx_sky_cloud_colour},\n {\"gfx_sky_cloud_coverage\", global_gfx_sky_cloud_coverage},\n\n {\"gfx_global_saturation\", global_gfx_global_saturation},\n {\"gfx_global_exposure\", global_gfx_global_exposure},\n\n {\"gfx_particle_define\", global_gfx_particle_define},\n {\"gfx_particle_emit\", global_gfx_particle_emit},\n {\"gfx_particle_pump\", global_gfx_particle_pump},\n {\"gfx_particle_count\", global_gfx_particle_count},\n {\"gfx_particle_step_size\", global_gfx_particle_step_size},\n {\"gfx_particle_all\", global_gfx_particle_all},\n {\"gfx_particle_reset\", global_gfx_particle_reset},\n\n {\"gfx_particle_reset\", global_gfx_particle_reset},\n\n {\"gfx_last_frame_stats\", global_gfx_last_frame_stats},\n\n {\"gfx_colour_grade_look_up\", global_gfx_colour_grade_look_up},\n\n {\"gfx_window_active\", global_gfx_window_active},\n {\"gfx_window_size\", global_gfx_window_size},\n {\"gfx_window_size_in_scene\", global_gfx_window_size_in_scene},\n {\"gfx_world_to_screen\", global_gfx_world_to_screen},\n {\"gfx_screen_to_world\", global_gfx_screen_to_world},\n\n {\"gfx_gpu_ram_available\", global_gfx_gpu_ram_available},\n {\"gfx_gpu_ram_used\", global_gfx_gpu_ram_used},\n\n {\"gfx_anim_rate\", global_gfx_anim_rate},\n\n {\"gfx_describe_texture\", global_gfx_describe_texture},\n {\"gfx_dump_shadow_map\", global_gfx_dump_shadow_map},\n\n {\"RGBtoHSL\", global_rgb_to_hsl},\n {\"HSLtoRGB\", global_hsl_to_rgb},\n {\"HSBtoHSL\", global_hsv_to_hsl},\n {\"HSLtoHSB\", global_hsl_to_hsv},\n {\"RGBtoHSV\", global_rgb_to_hsv},\n {\"HSVtoRGB\", global_hsv_to_rgb},\n\n {NULL, NULL}\n};\n\nstatic const luaL_reg global_ogre_debug[] = {\n\n {\"register_material\", global_gfx_register_material},\n\n {\"resource_exists\", global_resource_exists},\n\n {NULL, NULL}\n};\n\n\n\nvoid gfx_lua_init (lua_State *L)\n{\n ADD_MT_MACRO(gfxnode,GFXNODE_TAG);\n ADD_MT_MACRO(gfxbody,GFXBODY_TAG);\n ADD_MT_MACRO(gfxtextbody,GFXTEXTBODY_TAG);\n ADD_MT_MACRO(gfxskybody,GFXSKYBODY_TAG);\n ADD_MT_MACRO(gfxlight,GFXLIGHT_TAG);\n ADD_MT_MACRO(gfxinstances,GFXINSTANCES_TAG);\n ADD_MT_MACRO(gfxrangedinstances,GFXRANGEDINSTANCES_TAG);\n ADD_MT_MACRO(gfxdecal,GFXDECAL_TAG);\n ADD_MT_MACRO(gfxtracerbody,GFXTRACERBODY_TAG);\n ADD_MT_MACRO(gfxspritebody,GFXSPRITEBODY_TAG);\n\n ADD_MT_MACRO(hudobj,HUDOBJECT_TAG);\n ADD_MT_MACRO(hudtext,HUDTEXT_TAG);\n ADD_MT_MACRO(hudclass,HUDCLASS_TAG);\n\n register_lua_globals(L, global);\n register_lua_globals(L, global_ogre_debug);\n\n}\n" }, { "alpha_fraction": 0.5461205244064331, "alphanum_fraction": 0.5537795424461365, "avg_line_length": 35.17469787597656, "blob_id": "fee68ac7acf29813d0afb1d53090a6c0f9f86387", "content_id": "0d4b5547dc65db5e177e0e8f67d7ed57932222b3", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 6006, "license_type": "permissive", "max_line_length": 170, "num_lines": 166, "path": "/dependencies/quex-0.34.1/demo/004/lexer.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "#include<fstream> \n#include<iostream> \n\n// (*) include lexical analyser header\n#include \"c_lexer\"\n\nusing namespace std;\n\ndouble benchmark(std::FILE*, const size_t FileSize, double* repetition_n);\n\ndouble overhead(std::FILE*, \n const int SimulatedFileSize, const size_t SimulatedTokenN, \n const double RepetitionN);\n\n// report.c:\nsize_t get_file_size(const char*, bool SilentF=false);\nvoid print_date_string();\nsize_t count_token_n(std::FILE*);\ndouble report(clock_t StartTime, double RepetitionN, size_t FileSize, size_t CharacterSize);\nvoid final_report(double TimePerRun, double RefTimePerRun, const char* ThisExecutableName, const char* Filename, size_t FileSize, size_t TokenN, double RepetitionN);\n\nint \nmain(int argc, char** argv) \n{ \n std::FILE* fh = 0x0;\n\n {\n if( argc != 2 ) { return -1; }\n\n fh = fopen(argv[1], \"r\");\n if( fh == NULL ) { \n cerr << \"File '\" << argv[1] << \"' not found.\\n\";\n return -1;\n }\n }\n const size_t TokenN = count_token_n(fh); \n fseek(fh, 0, SEEK_SET);\n const size_t FileSize = get_file_size(argv[1]);\n fseek(fh, 0, SEEK_SET);\n double repetition_n;\n const double TimePerRun = benchmark(fh, FileSize, &repetition_n);\n fseek(fh, 0, SEEK_SET);\n /* Measure the overhead of the measurement */\n const double RefTimePerRun = overhead(fh, FileSize, TokenN, repetition_n);\n\n final_report(TimePerRun, RefTimePerRun, argv[0], argv[1], FileSize, TokenN, repetition_n);\n return 0;\n} \n\n#ifndef QUEX_BENCHMARK_SERIOUS\nvoid __PRINT_START()\n{\n cout << \",------------------------------------------------------------------------------------\\n\";\n cout << \"| [START]\\n\";\n}\nvoid __PRINT_END()\n{\n cout << \"| [END] \\n\";\n cout << \"`------------------------------------------------------------------------------------\\n\";\n}\n#else \nvoid __PRINT_START() { }\nvoid __PRINT_END() { }\n#endif\n\ndouble\nbenchmark(std::FILE* fh, const size_t FileSize, double* repetition_n)\n{\n using namespace std;\n //quex::token* TokenP;\n int token_id = QUEX_TKN_TERMINATION;\n //\n // -- repeat the experiment, so that it takes at least 20 seconds\n const clock_t StartTime = clock();\n# ifdef QUEX_BENCHMARK_SERIOUS\n const clock_t MinExperimentTime = 10 * CLOCKS_PER_SEC + StartTime;\n# else\n const clock_t MinExperimentTime = StartTime;\n# endif\n int checksum = 0;\n size_t token_n = 0;\n int checksum_ref = -1;\n //\n quex::c_lexer qlex(fh);\n\n do { \n checksum = 777;\n *repetition_n += 1.0f;\n __PRINT_START(); /* No Operation if QUEX_BENCHMARK_SERIOUS is defined */\n \n do { \n // qlex->get_token(&TokenP);\n token_id = qlex.get_token();\n\n // checksum = (checksum + TokenP->type_id()) % 0xFF; \n checksum = (checksum + token_id) % 0xFF; \n\n# if ! defined(QUEX_BENCHMARK_SERIOUS)\n cout << /*qlex.line_number() << \": \" <<*/ quex::Token::map_id_to_name(token_id) << endl;\n# endif\n\n token_n += 1;\n // } while( TokenP->type_id() != QUEX_TKN_TERMINATION );\n } while( (unsigned)token_id != QUEX_TKN_TERMINATION );\n // Overhead-Intern: (addition, modulo division, assignment, increment by one, comparison) * token_n\n\n __PRINT_END();\n if( checksum_ref == -1 ) { \n checksum_ref = checksum; \n }\n else if( checksum != checksum_ref ) {\n cerr << \"run: \" << *repetition_n << endl;\n cerr << \"checksum-reference: \" << checksum_ref << endl;\n cerr << \"checksum: \" << checksum << endl;\n throw std::runtime_error(\"Checksum failure\");\n }\n qlex._reset();\n } while( clock() < MinExperimentTime );\n // Overhead: Overhead-Intern\n // + (assignment, increment by one, comparision * 2, _reset(),\n // clock(), comparision) * RepetitionN\n \n cout << \"//Benchmark (including overhead)\\n\";\n cout << \"// TokenN: \" << (int)((token_n-1) / *repetition_n) << endl;\n return report(StartTime, *repetition_n, FileSize, /* CharacterSize = 1 */ 1);\n}\n\ndouble \noverhead(std::FILE* fh,\n const int SimulatedFileSize, const size_t SimulatedTokenN, const double RepetitionN)\n{\n // This function is supposed to perform all 'frame' operations, but not the\n // analyzer function. This is to estimate the overhead implied by the test program.\n const clock_t StartTime = clock();\n double repetition_n = 0.0;\n int checksum = 0;\n //\n quex::c_lexer qlex(fh);\n\n checksum = 0; // here: prevent optimizing away of token_n --> out of loop\n while( repetition_n < RepetitionN ) { \n repetition_n += 1.0f;\n \n size_t token_n = 0;\n do {\n checksum = (token_n + checksum) % 0xFF; // use argument RepetitionN instead of a \n // // constant, so that it cannot be optimized away.\n token_n += 1;\n } while( token_n != SimulatedTokenN );\n // Overhead-Intern: (addition, modulo division, assignment, increment by one, comparison) * token_n\n \n checksum += token_n ^ clock();\n\n qlex._reset();\n }\n // Overhead: Overhead-Intern\n // + (assignment, increment by one, comparision * 2, _reset(),\n // clock(), comparision) * RepetitionN\n \n // The 'Checksum' is printed for the sole purpose to prevent that the \n // checksum computation is not optimized away. When the checksum computation is not\n // optimized away, then the token id reception cannot be optimized away.\n cout << \"// Overhead:\\n\";\n cout << \"// Checksum (meaningless): \" << checksum << \" [1]\" << std::endl;\n return report(StartTime, RepetitionN, SimulatedFileSize, /* CharacterSize [byte] */ 1);\n}\n\n" }, { "alpha_fraction": 0.5824176073074341, "alphanum_fraction": 0.5839629173278809, "avg_line_length": 38.88356018066406, "blob_id": "503ec5e9dcd5fb5f6e832e7c8a19e692e97bde81", "content_id": "bb1bc2da7017534938cd831f3a29fce6731df570", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 5824, "license_type": "permissive", "max_line_length": 111, "num_lines": 146, "path": "/dependencies/quex-0.34.1/quex/core_engine/generator/action_info.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "from quex.frs_py.file_in import is_identifier_start, \\\n is_identifier_continue\n\nimport quex.core_engine.generator.skip_code as skip_code\n\nclass ActionI:\n def __init__(self, Code, RequireTerminatingZeroF=False):\n self.__code = Code\n self.__require_terminating_zero_f = RequireTerminatingZeroF\n\n def set_code(self, Code):\n self.__code = Code\n\n def get_code(self):\n return self.__code\n\n def set_require_terminating_zero_f(self):\n self.__require_terminating_zero_f = True\n\n def require_terminating_zero_f(self):\n return self.__require_terminating_zero_f\n\n\nclass CodeFragment(ActionI):\n def __init__(self, Code=\"\", RequireTerminatingZeroF=False):\n ActionI.__init__(self, Code, RequireTerminatingZeroF)\n\n\nUserCodeFragment_OpenLinePragma = {\n#___________________________________________________________________________________\n# Line pragmas allow to direct the 'virtual position' of a program in a file\n# that was generated to its origin. That is, if an error occurs in line in a \n# C-program which is actually is the pasted code from a certain line in a .qx \n# file, then the compiler would print out the line number from the .qx file.\n# \n# This mechanism relies on line pragmas of the form '#line xx \"filename\"' telling\n# the compiler to count the lines from xx and consider them as being from filename.\n#\n# During code generation, the pasted code segments need to be followed by line\n# pragmas resetting the original C-file as the origin, so that errors that occur\n# in the 'real' code are not considered as coming from the .qx files.\n# Therefore, the code generator introduces placeholders that are to be replaced\n# once the whole code is generated.\n#\n# ...[Language][0] = the placeholder until the whole code is generated\n# ...[Language][1] = template containing 'NUMBER' and 'FILENAME' that\n# are to replaced in order to get the resetting line pragma.\n#___________________________________________________________________________________\n \"C\": [\n '/* POST-ADAPTION: FILL IN APPROPRIATE LINE PRAGMA */',\n '#line NUMBER \"FILENAME\"'\n ],\n }\n\nclass UserCodeFragment(ActionI):\n def __init__(self, Code, Filename, LineN, LanguageDB=None, AddReferenceCodeF=False):\n assert type(Code) in [str, unicode]\n assert type(LanguageDB) == dict or LanguageDB == None\n assert type(Filename) in [str, unicode]\n assert type(LineN) in [int, long, float]\n\n self.filename = Filename\n self.line_n = LineN\n\n # No clue yet, how to deal with languages other than C/C++ here.\n if AddReferenceCodeF and Code != \"\":\n txt = '\\n#line %i \"%s\"\\n' % (self.line_n, self.filename)\n txt += Code\n if txt[-1] != \"\\n\": txt = txt + \"\\n\"\n txt += UserCodeFragment_OpenLinePragma[\"C\"][0] + \"\\n\"\n code = txt\n else:\n code = Code\n\n require_terminating_zero_f = False\n if LanguageDB != None and LanguageDB[\"$require-terminating-zero-preparation\"](LanguageDB, code):\n require_terminating_zero_f = True\n\n ActionI.__init__(self, code, require_terminating_zero_f)\n\n\ndef UserCodeFragment_straighten_open_line_pragmas(filename, Language):\n if Language not in UserCodeFragment_OpenLinePragma.keys():\n return\n\n try: fh = open(filename)\n except: raise \"error: file to straighten line pragmas not found: '%s'\" % \\\n filename\n\n new_content = \"\"\n line_n = 0\n LinePragmaInfo = UserCodeFragment_OpenLinePragma[Language]\n for line in fh.readlines():\n line_n += 1\n if line.find(LinePragmaInfo[0]) != -1:\n if Language == \"C\":\n line = LinePragmaInfo[1]\n line = line.replace(\"NUMBER\", repr(int(line_n)))\n line = line.replace(\"FILENAME\", filename)\n line = line + \"\\n\"\n new_content += line\n\n fh.close()\n\n fh = open(filename, \"w\")\n fh.write(new_content)\n fh.close()\n\nclass PatternActionInfo:\n def __init__(self, PatternStateMachine, Action, Pattern=\"\", IL = None, ModeName=\"\"):\n\n assert Action == None or \\\n issubclass(Action.__class__, ActionI) or \\\n type(Action) in [str, unicode]\n assert PatternStateMachine.__class__.__name__ == \"StateMachine\" \\\n or PatternStateMachine == None\n\n self.__pattern_state_machine = PatternStateMachine\n if type(Action) in [str, unicode]: self.__action = CodeFragment(Action)\n else: self.__action = Action\n\n self.pattern = Pattern\n # depth of inheritance where the pattern occurs\n self.inheritance_level = IL\n self.inheritance_mode_name = ModeName\n\n def pattern_state_machine(self):\n return self.__pattern_state_machine\n\n def action(self):\n return self.__action\n\n def pattern_index(self):\n return self.pattern_state_machine().get_id()\n\n def __repr__(self): \n txt = \"\"\n txt += \"self.pattern = \" + repr(self.pattern) + \"\\n\"\n txt += \"self.pattern_state_machine = \\n\" + repr(self.pattern_state_machine()).replace(\"\\n\", \"\\n \")\n txt += \"self.action = \" + repr(self.action().get_code()) + \"\\n\"\n if self.action().__class__ == UserCodeFragment:\n txt += \"self.filename = \" + repr(self.action().filename) + \"\\n\"\n txt += \"self.line_n = \" + repr(self.action().line_n) + \"\\n\"\n txt += \"self.inheritance_level = \" + repr(self.inheritance_level) + \"\\n\"\n txt += \"self.pattern_index = \" + repr(self.pattern_state_machine().core().id()) + \"\\n\"\n return txt\n\n" }, { "alpha_fraction": 0.4912028908729553, "alphanum_fraction": 0.5008333921432495, "avg_line_length": 41.85317611694336, "blob_id": "673f8e660f4bb458ad16ae176db7db8f63bf1342", "content_id": "68b1c37eae0b7eed9a478f96cbbd74145a90fd27", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 21598, "license_type": "permissive", "max_line_length": 92, "num_lines": 504, "path": "/gtasa/col_parser.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <locale>\n#include <algorithm>\n#include <iostream>\n#include <fstream>\n\n#include \"col_parser.h\"\n#include \"ios_util.h\"\n\n#ifdef min\n#undef min\n#endif\n#ifdef max\n#undef max\n#endif\n\nMaterialMap global_db;\n\n// This is called by the standalone tools (colread && dffread)\n// extract.exe on the other hand reads surface.dat\n// Don't want to read surface.dat in colread or dffread as we want a single input dff\n// The output of such tools is not usually used as an input to grit, it is mainly\n// for verifying or debugging the gta format parsing code, and using verbose output\n// to inspect the gta dataset\nvoid init_global_db ()\n{\n int counter = 0;\n global_db[counter++] = \"DEFAULT\";\n global_db[counter++] = \"TARMAC\";\n global_db[counter++] = \"TARMAC_FUCKED\";\n global_db[counter++] = \"TARMAC_REALLYFUCKED\";\n global_db[counter++] = \"PAVEMENT\";\n global_db[counter++] = \"PAVEMENT_FUCKED\";\n global_db[counter++] = \"GRAVEL\";\n global_db[counter++] = \"FUCKED_CONCRETE\";\n global_db[counter++] = \"PAINTED_GROUND\";\n global_db[counter++] = \"GRASS_SHORT_LUSH\";\n global_db[counter++] = \"GRASS_MEDIUM_LUSH\";\n global_db[counter++] = \"GRASS_LONG_LUSH\";\n global_db[counter++] = \"GRASS_SHORT_DRY\";\n global_db[counter++] = \"GRASS_MEDIUM_DRY\";\n global_db[counter++] = \"GRASS_LONG_DRY\";\n global_db[counter++] = \"GOLFGRASS_ROUGH\";\n global_db[counter++] = \"GOLFGRASS_SMOOTH\";\n global_db[counter++] = \"STEEP_SLIDYGRASS\";\n global_db[counter++] = \"STEEP_CLIFF\";\n global_db[counter++] = \"FLOWERBED\";\n global_db[counter++] = \"MEADOW\";\n global_db[counter++] = \"WASTEGROUND\";\n global_db[counter++] = \"WOODLANDGROUND\";\n global_db[counter++] = \"VEGETATION\";\n global_db[counter++] = \"MUD_WET\";\n global_db[counter++] = \"MUD_DRY\";\n global_db[counter++] = \"DIRT\";\n global_db[counter++] = \"DIRTTRACK\";\n global_db[counter++] = \"SAND_DEEP\";\n global_db[counter++] = \"SAND_MEDIUM\";\n global_db[counter++] = \"SAND_COMPACT\";\n global_db[counter++] = \"SAND_ARID\";\n global_db[counter++] = \"SAND_MORE\";\n global_db[counter++] = \"SAND_BEACH\";\n global_db[counter++] = \"CONCRETE_BEACH\";\n global_db[counter++] = \"ROCK_DRY\";\n global_db[counter++] = \"ROCK_WET\";\n global_db[counter++] = \"ROCK_CLIFF\";\n global_db[counter++] = \"WATER_RIVERBED\";\n global_db[counter++] = \"WATER_SHALLOW\";\n global_db[counter++] = \"CORNFIELD\";\n global_db[counter++] = \"HEDGE\";\n global_db[counter++] = \"WOOD_CRATES\";\n global_db[counter++] = \"WOOD_SOLID\";\n global_db[counter++] = \"WOOD_THIN\";\n global_db[counter++] = \"GLASS\";\n global_db[counter++] = \"GLASS_WINDOWS_LARGE\";\n global_db[counter++] = \"GLASS_WINDOWS_SMALL\";\n global_db[counter++] = \"EMPTY1\";\n global_db[counter++] = \"EMPTY2\";\n global_db[counter++] = \"GARAGE_DOOR\";\n global_db[counter++] = \"THICK_METAL_PLATE\";\n global_db[counter++] = \"SCAFFOLD_POLE\";\n global_db[counter++] = \"LAMP_POST\";\n global_db[counter++] = \"METAL_GATE\";\n global_db[counter++] = \"METAL_CHAIN_FENCE\";\n global_db[counter++] = \"GIRDER\";\n global_db[counter++] = \"FIRE_HYDRANT\";\n global_db[counter++] = \"CONTAINER\";\n global_db[counter++] = \"NEWS_VENDOR\";\n global_db[counter++] = \"WHEELBASE\";\n global_db[counter++] = \"CARDBOARDBOX\";\n global_db[counter++] = \"PED\";\n global_db[counter++] = \"CAR\";\n global_db[counter++] = \"CAR_PANEL\";\n global_db[counter++] = \"CAR_MOVINGCOMPONENT\";\n global_db[counter++] = \"TRANSPARENT_CLOTH\";\n global_db[counter++] = \"RUBBER\";\n global_db[counter++] = \"PLASTIC\";\n global_db[counter++] = \"TRANSPARENT_STONE\";\n global_db[counter++] = \"WOOD_BENCH\";\n global_db[counter++] = \"CARPET\";\n global_db[counter++] = \"FLOORBOARD\";\n global_db[counter++] = \"STAIRSWOOD\";\n global_db[counter++] = \"P_SAND\";\n global_db[counter++] = \"P_SAND_DENSE\";\n global_db[counter++] = \"P_SAND_ARID\";\n global_db[counter++] = \"P_SAND_COMPACT\";\n global_db[counter++] = \"P_SAND_ROCKY\";\n global_db[counter++] = \"P_SANDBEACH\";\n global_db[counter++] = \"P_GRASS_SHORT\";\n global_db[counter++] = \"P_GRASS_MEADOW\";\n global_db[counter++] = \"P_GRASS_DRY\";\n global_db[counter++] = \"P_WOODLAND\";\n global_db[counter++] = \"P_WOODDENSE\";\n global_db[counter++] = \"P_ROADSIDE\";\n global_db[counter++] = \"P_ROADSIDEDES\";\n global_db[counter++] = \"P_FLOWERBED\";\n global_db[counter++] = \"P_WASTEGROUND\";\n global_db[counter++] = \"P_CONCRETE\";\n global_db[counter++] = \"P_OFFICEDESK\";\n global_db[counter++] = \"P_711SHELF1\";\n global_db[counter++] = \"P_711SHELF2\";\n global_db[counter++] = \"P_711SHELF3\";\n global_db[counter++] = \"P_RESTUARANTTABLE\";\n global_db[counter++] = \"P_BARTABLE\";\n global_db[counter++] = \"P_UNDERWATERLUSH\";\n global_db[counter++] = \"P_UNDERWATERBARREN\";\n global_db[counter++] = \"P_UNDERWATERCORAL\";\n global_db[counter++] = \"P_UNDERWATERDEEP\";\n global_db[counter++] = \"P_RIVERBED\";\n global_db[counter++] = \"P_RUBBLE\";\n global_db[counter++] = \"P_BEDROOMFLOOR\";\n global_db[counter++] = \"P_KIRCHENFLOOR\";\n global_db[counter++] = \"P_LIVINGRMFLOOR\";\n global_db[counter++] = \"P_CORRIDORFLOOR\";\n global_db[counter++] = \"P_711FLOOR\";\n global_db[counter++] = \"P_FASTFOODFLOOR\";\n global_db[counter++] = \"P_SKANKYFLOOR\";\n global_db[counter++] = \"P_MOUNTAIN\";\n global_db[counter++] = \"P_MARSH\";\n global_db[counter++] = \"P_BUSHY\";\n global_db[counter++] = \"P_BUSHYMIX\";\n global_db[counter++] = \"P_BUSHYDRY\";\n global_db[counter++] = \"P_BUSHYMID\";\n global_db[counter++] = \"P_GRASSWEEFLOWERS\";\n global_db[counter++] = \"P_GRASSDRYTALL\";\n global_db[counter++] = \"P_GRASSLUSHTALL\";\n global_db[counter++] = \"P_GRASSGRNMIX\";\n global_db[counter++] = \"P_GRASSBRNMIX\";\n global_db[counter++] = \"P_GRASSLOW\";\n global_db[counter++] = \"P_GRASSROCKY\";\n global_db[counter++] = \"P_GRASSSMALLTREES\";\n global_db[counter++] = \"P_DIRTROCKY\";\n global_db[counter++] = \"P_DIRTWEEDS\";\n global_db[counter++] = \"P_GRASSWEEDS\";\n global_db[counter++] = \"P_RIVEREDGE\";\n global_db[counter++] = \"P_POOLSIDE\";\n global_db[counter++] = \"P_FORESTSTUMPS\";\n global_db[counter++] = \"P_FORESTSTICKS\";\n global_db[counter++] = \"P_FORRESTLEAVES\";\n global_db[counter++] = \"P_DESERTROCKS\";\n global_db[counter++] = \"P_FORRESTDRY\";\n global_db[counter++] = \"P_SPARSEFLOWERS\";\n global_db[counter++] = \"P_BUILDINGSITE\";\n global_db[counter++] = \"P_DOCKLANDS\";\n global_db[counter++] = \"P_INDUSTRIAL\";\n global_db[counter++] = \"P_INDUSTJETTY\";\n global_db[counter++] = \"P_CONCRETELITTER\";\n global_db[counter++] = \"P_ALLEYRUBISH\";\n global_db[counter++] = \"P_JUNKYARDPILES\";\n global_db[counter++] = \"P_JUNKYARDGRND\";\n global_db[counter++] = \"P_DUMP\";\n global_db[counter++] = \"P_CACTUSDENSE\";\n global_db[counter++] = \"P_AIRPORTGRND\";\n global_db[counter++] = \"P_CORNFIELD\";\n global_db[counter++] = \"P_GRASSLIGHT\";\n global_db[counter++] = \"P_GRASSLIGHTER\";\n global_db[counter++] = \"P_GRASSLIGHTER2\";\n global_db[counter++] = \"P_GRASSMID1\";\n global_db[counter++] = \"P_GRASSMID2\";\n global_db[counter++] = \"P_GRASSDARK\";\n global_db[counter++] = \"P_GRASSDARK2\";\n global_db[counter++] = \"P_GRASSDIRTMIX\";\n global_db[counter++] = \"P_RIVERBEDSTONE\";\n global_db[counter++] = \"P_RIVERBEDSHALLOW\";\n global_db[counter++] = \"P_RIVERBEDWEEDS\";\n global_db[counter++] = \"P_SEAWEED\";\n global_db[counter++] = \"DOOR\";\n global_db[counter++] = \"PLASTICBARRIER\";\n global_db[counter++] = \"PARKGRASS\";\n global_db[counter++] = \"STAIRSSTONE\";\n global_db[counter++] = \"STAIRSMETAL\";\n global_db[counter++] = \"STAIRSCARPET\";\n global_db[counter++] = \"FLOORMETAL\";\n global_db[counter++] = \"FLOORCONCRETE\";\n global_db[counter++] = \"BIN_BAG\";\n global_db[counter++] = \"THIN_METAL_SHEET\";\n global_db[counter++] = \"METAL_BARREL\";\n global_db[counter++] = \"PLASTIC_CONE\";\n global_db[counter++] = \"PLASTIC_DUMPSTER\";\n global_db[counter++] = \"METAL_DUMPSTER\";\n global_db[counter++] = \"WOOD_PICKET_FENCE\";\n global_db[counter++] = \"WOOD_SLATTED_FENCE\";\n global_db[counter++] = \"WOOD_RANCH_FENCE\";\n global_db[counter++] = \"UNBREAKABLE_GLASS\";\n global_db[counter++] = \"HAY_BALE\";\n global_db[counter++] = \"GORE\";\n global_db[counter++] = \"RAILTRACK\";\n}\n\nstatic inline int tolowr (int c)\n{\n return std::tolower(char(c),std::cout.getloc());\n}\n\nstatic inline std::string& strlower(std::string& s)\n{\n std::transform(s.begin(),s.end(), s.begin(),tolowr);\n return s;\n}\n\nvoid parse_col (std::string &name,\n std::istream &in,\n TColFile &tcol,\n const std::string &phys_mat_pref,\n MaterialMap &db,\n int debug_level)\n{\n unsigned long fourcc;\n fourcc = ios_read_u32(in);\n\n tcol.mass = 0;\n tcol.inertia_x = 0;\n tcol.inertia_y = 0;\n tcol.inertia_z = 0;\n tcol.linearDamping = 0;\n tcol.angularDamping = 0.5;\n tcol.linearSleepThreshold = 1;\n tcol.angularSleepThreshold = 0.8f;\n tcol.ccdMotionThreshold = 0;\n tcol.ccdSweptSphereRadius = 0;\n\n\n unsigned long size = ios_read_u32(in);\n (void)size;\n\n int version;\n switch (fourcc) {\n case 0x4c4c4f43: // COLL\n version = 1;\n break;\n case 0x324c4f43: // COL2\n version = 2;\n break;\n case 0x334c4f43: // COL3\n version = 3;\n break;\n default:\n GRIT_EXCEPT(\"This is not a col file.\");\n }\n\n if (debug_level>0)\n std::cout << \"Version: \" << version << std::endl;\n\n APP_ASSERT(version==3 || version==2);\n\n name = ios_read_fixedstr(in,24);\n strlower(name);\n\n if (debug_level>0)\n std::cout << \"Name: \" << name << std::endl;\n\n // skip 40 byte bounding structure\n in.seekg(40,std::ios_base::cur);\n\n if (version >= 2) {\n\n unsigned short num_spheres = ios_read_u16(in);\n if (debug_level>1)\n std::cout<<\"num_spheres: \"<<num_spheres<<std::endl;\n unsigned short num_boxes = ios_read_u16(in);\n if (debug_level>1)\n std::cout<<\"num_boxes: \"<<num_boxes<<std::endl;\n unsigned long num_faces = ios_read_u32(in);\n if (debug_level>1)\n std::cout<<\"num_faces: \"<<num_faces<<std::endl;\n unsigned long flags = ios_read_u32(in);\n //bool non_empty = flags & 2;\n //bool has_face_groups = flags & 8;\n //bool has_shadow_mesh = flags & 16;\n APP_ASSERT((flags | 2 | 8 | 16) == 26);\n unsigned long offset_spheres = ios_read_u32(in);\n (void) offset_spheres;\n if (debug_level>2)\n std::cout<<\"offset_spheres: \"<<offset_spheres<<std::endl;\n unsigned long offset_boxes = ios_read_u32(in);\n (void) offset_boxes;\n if (debug_level>2)\n std::cout<<\"offset_boxes: \"<<offset_boxes<<std::endl;\n unsigned long unknown = ios_read_u32(in);\n APP_ASSERT(unknown==0);\n unsigned long offset_vertexes = ios_read_u32(in);\n if (debug_level>2)\n std::cout<<\"offset_vertexes: \"<<offset_vertexes<<std::endl;\n unsigned long offset_faces = ios_read_u32(in);\n if (debug_level>2)\n std::cout<<\"offset_faces: \"<<offset_faces<<std::endl;\n unsigned long unknown2 = ios_read_u32(in);\n APP_ASSERT(unknown2==0);\n\n unsigned long num_shadow_faces = 0;\n unsigned long offset_shadow_vertexes = 0;\n unsigned long offset_shadow_faces = 0;\n if (version==3) {\n num_shadow_faces = ios_read_u32(in);\n if (debug_level>1)\n std::cout<<\"num_shadow_faces: \"\n <<num_shadow_faces<<std::endl;\n offset_shadow_vertexes = ios_read_u32(in);\n if (debug_level>1)\n std::cout<<\"offset_shadow_vertexes: \"\n <<offset_shadow_vertexes<<std::endl;\n offset_shadow_faces = ios_read_u32(in);\n if (debug_level>1)\n std::cout<<\"offset_shadow_faces: \"\n <<offset_shadow_faces<<std::endl;\n }\n\n tcol.usingCompound = num_spheres>0 || num_boxes>0;\n\n tcol.usingTriMesh = num_faces > 0;\n\n for (int i=0 ; i<num_spheres ; ++i) {\n TColSphere sphere;\n sphere.px = ios_read_float(in);\n sphere.py = ios_read_float(in);\n sphere.pz = ios_read_float(in);\n sphere.radius = ios_read_float(in);\n sphere.material = phys_mat_pref+db[ios_read_u8(in)];\n unsigned char flag = ios_read_u8(in);\n unsigned char unk = ios_read_u8(in);\n unsigned char light = ios_read_u8(in);\n //std::cout<<\"sphere mat: \"<<sphere.material<<std::endl;\n //std::cout<<\"sphere flag: \"<<(int)flag<<std::endl;\n //std::cout<<\"sphere unk: \"<<(int)unk<<std::endl;\n //std::cout<<\"sphere light: \"<<(int)light<<std::endl;\n (void) flag; // not used yet\n (void) unk; // not used yet\n (void) light; // not used yet\n tcol.compound.spheres.push_back(sphere);\n }\n\n for (int i=0 ; i<num_boxes ; ++i) {\n float xm = ios_read_float(in);\n float ym = ios_read_float(in);\n float zm = ios_read_float(in);\n float xM = ios_read_float(in);\n float yM = ios_read_float(in);\n float zM = ios_read_float(in);\n TColBox box;\n box.px = (xm+xM)/2;\n box.py = (ym+yM)/2;\n box.pz = (zm+zM)/2;\n box.dx = (xM-xm);\n box.dy = (yM-ym);\n box.dz = (zM-zm);\n box.qw = 1;\n box.qx = 0;\n box.qy = 0;\n box.qz = 0;\n box.margin = 0.04f;\n box.material = phys_mat_pref+db[ios_read_u8(in)];\n unsigned char flag = ios_read_u8(in);\n unsigned char unk = ios_read_u8(in);\n unsigned char light = ios_read_u8(in);\n //std::cout<<\"box mat: \"<<box.material<<std::endl;\n //std::cout<<\"box flag: \"<<(int)flag<<std::endl;\n //std::cout<<\"box unk: \"<<(int)unk<<std::endl;\n //std::cout<<\"box light: \"<<(int)light<<std::endl;\n (void) flag; // not used yet\n (void) unk; // not used yet\n (void) light; // not used yet\n tcol.compound.boxes.push_back(box);\n }\n\n // an approximation, real value is much less.\n int num_vertexes = (offset_faces - offset_vertexes)/6;\n if (debug_level>3)\n std::cout<<\"num_vertexes: \"<<num_vertexes<<std::endl;\n int remainder = (offset_faces - offset_vertexes) % 6;\n if (debug_level>3)\n std::cout<<\"remainder: \"<<remainder << std::endl;\n for (int i=0 ; i<num_vertexes ; ++i) {\n float x = ios_read_s16(in)/128.0f;\n float y = ios_read_s16(in)/128.0f;\n float z = ios_read_s16(in)/128.0f;\n tcol.triMesh.vertexes.push_back(Vector3(x,y,z));\n }\n\n // seek all the way up to offset_faces-4\n in.seekg(remainder,std::ios_base::cur);\n\n unsigned short max_vertex = 0;\n\n for (unsigned long i=0 ; i<num_faces ; ++i) {\n // faces\n unsigned short a = ios_read_u16(in);\n unsigned short b = ios_read_u16(in);\n unsigned short c = ios_read_u16(in);\n max_vertex =\n std::max(a,std::max(b,std::max(c,max_vertex)));\n unsigned char mat = ios_read_u8(in);\n unsigned char light = ios_read_u8(in);\n //std::cout<<\"face mat: \"<<(int)mat<<std::endl;\n //std::cout<<\"face light: \"<<(int)light<<std::endl;\n (void) light; // not used yet\n tcol.triMesh.faces.push_back(TColFace(a,b,c,phys_mat_pref+db[mat]));\n }\n\n if (num_faces > 0) {\n if (debug_level>1)\n std::cout<<\"max_vertex: \"<<max_vertex<<std::endl;\n APP_ASSERT(max_vertex<num_vertexes);\n tcol.triMesh.vertexes.resize(max_vertex+1);\n }\n\n in.seekg(offset_shadow_faces - offset_shadow_vertexes,\n std::ios_base::cur);\n\n in.seekg(num_shadow_faces*8, std::ios_base::cur);\n\n } else {\n\n APP_ASSERT(false);\n/*\n unsigned long num_spheres = ios_read_u32(in);\n // spheres\n unsigned long unknown = ios_read_u32(in);\n (void) unknown;\n unsigned long num_boxes = ios_read_u32(in);\n // boxes\n unsigned long num_vertexes = ios_read_u32(in);\n // vertexes\n unsigned long num_faces = ios_read_u32(in);\n // faces\n*/\n\n }\n}\n\nvoid dump_all_cols (std::istream &in, bool binary, const std::string &phys_mat_pref,\n MaterialMap &db, int debug_level)\n{\n do {\n TColFile tcol;\n std::string name;\n parse_col(name,in,tcol,phys_mat_pref,db,debug_level);\n\n if (!tcol.usingCompound && !tcol.usingTriMesh) {\n if (debug_level>0)\n std::cout<<\"Col is empty.\"<<std::endl;\n // skip empty cols. They are pure lol.\n } else if (binary) {\n name += \".bcol\";\n GRIT_EXCEPT(\"Writing bcol not implemented.\");\n } else {\n name += \".tcol\";\n\n std::ofstream out;\n out.open(name.c_str(), std::ios::binary);\n APP_ASSERT_IO_SUCCESSFUL(out,\"opening tcol for writing\");\n\n pretty_print_tcol(out,tcol);\n }\n \n std::istream::int_type next = in.peek();\n\n // no more cols\n if (next==std::istream::traits_type::eof() || next==0) break; \n\n } while (true);\n}\n\n\n\n// vim: shiftwidth=8:tabstop=8:expandtab\n" }, { "alpha_fraction": 0.6425203680992126, "alphanum_fraction": 0.6425203680992126, "avg_line_length": 40.57143020629883, "blob_id": "c22a9ae4573073f4387e8cc1b4647c7d599faecc", "content_id": "a76d63e06a60338f7a34227487e397bb9b753add", "detected_licenses": [ "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer", "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2333, "license_type": "permissive", "max_line_length": 88, "num_lines": 56, "path": "/dependencies/quex-0.34.1/quex/core_engine/generator/state_machine_coder.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "from copy import deepcopy\n\nimport quex.core_engine.generator.languages.core as languages\nfrom quex.core_engine.generator.languages.core import __nice\nimport quex.core_engine.generator.state_coder as state_coder\nfrom quex.input.setup import setup as Setup\n\nLanguageDB = Setup.language_db\n\ndef do(SMD):\n \"\"\"Returns the program code implementing the StateMachine's behavior.\n NOTE: This function should only be called on a DFA after the call\n to 'filter_dominated_origins'. The latter is important\n to ensure that for an acceptance state there is only one\n related original state.\n\n The procedure for each state is the following:\n i) input <-- next character from stream \n ii) state transition code (include marking of last success state\n and last success stream position). \n \"\"\"\n assert SMD.__class__.__name__ == \"StateMachineDecorator\"\n\n state_machine = SMD.sm()\n\n txt = \"\"\n # -- treat initial state separately \n if state_machine.is_init_state_a_target_state():\n # (only define the init state label, if it is really needed)\n txt += LanguageDB[\"$label-def\"](\"$entry\", state_machine.init_state_index) + \"\\n\"\n\n init_state = state_machine.states[state_machine.init_state_index]\n #\n # NOTE: Only the init state provides a transition via 'EndOfFile'! In any other\n # case, end of file needs to cause a drop out! After the drop out, lexing\n # starts at furthest right before the EndOfFile and the init state transits\n # into the TERMINAL_END_OF_FILE.\n txt += LanguageDB[\"$label-def\"](\"$entry\", state_machine.init_state_index) + \"\\n\"\n txt += state_coder.do(init_state, \n state_machine.init_state_index, SMD, InitStateF = True)\n\n # -- all other states\n for state_index, state in state_machine.states.items():\n # the init state has been coded already\n if state_index == state_machine.init_state_index: continue\n\n state_code = state_coder.do(state, state_index, SMD)\n\n # some states are not coded (some dead end states)\n if state_code == \"\": continue\n\n txt += LanguageDB[\"$label-def\"](\"$entry\", state_index) + \"\\n\"\n txt += state_code\n txt += \"\\n\"\n \n return txt\n\n\n\n\n\n" }, { "alpha_fraction": 0.5801389813423157, "alphanum_fraction": 0.5849012136459351, "avg_line_length": 49.42519760131836, "blob_id": "be01d505bd98c0236fe859c8b16a84ed4fdce1b3", "content_id": "b603efd0caad4c26f5f68bd03ebc9d9d22054582", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 12809, "license_type": "permissive", "max_line_length": 134, "num_lines": 254, "path": "/dependencies/quex-0.34.1/quex/input/setup_parser.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "from quex.DEFINITIONS import *\nfrom copy import copy\nimport sys\nimport os\n\nfrom quex.GetPot import GetPot\nfrom quex.frs_py.file_in import open_file_or_die, error_msg, is_identifier, \\\n extract_identifiers_with_specific_prefix, \\\n delete_comment\nimport quex.lexer_mode as lexer_mode\nimport quex.input.query as query\nfrom quex.token_id_maker import parse_token_id_file\n\nfrom quex.input.setup import setup, SETUP_INFO, LIST, FLAG, DEPRECATED\n\ndef do(argv):\n global setup\n\n # (*) Interpret Command Line (A) _____________________________________________________\n command_line = GetPot(argv)\n\n if command_line.search(\"--version\", \"-v\"):\n print \"Quex - A Mode Oriented Lexical Analyser\"\n print \"Version \" + QUEX_VERSION\n print \"(C) 2006-2008 Frank-Rene Schaefer\"\n sys.exit(0)\n\n if command_line.search(\"--help\", \"-h\"):\n print \"Quex - A Mode Oriented Lexical Analyser\"\n print \"Please, consult the quex documentation for further help, or\"\n print \"visit http://quex.sourceforge.net.\"\n print \"(C) 2006-2008 Frank-Rene Schaefer\"\n sys.exit(0)\n\n for variable_name, info in SETUP_INFO.items():\n if info[1] == LIST:\n the_list = command_line.nominus_followers(info[0])\n if setup.__dict__.has_key(variable_name):\n setup.__dict__[variable_name].extend(the_list) \n else:\n setup.__dict__[variable_name] = the_list\n elif info[1] == FLAG:\n setup.__dict__[variable_name] = command_line.search(info[0]) \n else:\n setup.__dict__[variable_name] = command_line.follow(info[1], info[0])\n\n setup.QUEX_VERSION = QUEX_VERSION\n setup.QUEX_INSTALLATION_DIR = QUEX_INSTALLATION_DIR\n setup.QUEX_TEMPLATE_DB_DIR = QUEX_TEMPLATE_DB_DIR\n \n # (*) Output files\n setup.output_file_stem = __prepare_file_name(setup, \"\")\n setup.output_token_id_file = __prepare_file_name(setup, \"-token_ids\")\n setup.output_header_file = __prepare_file_name(setup, \"-internal.h\")\n setup.output_code_file = __prepare_file_name(setup, \".cpp\")\n setup.output_core_engine_file = __prepare_file_name(setup, \"-core-engine.cpp\")\n\n setup.buffer_limit_code = __get_integer(setup.buffer_limit_code, \"--buffer-limit\")\n setup.control_character_code_list = [setup.buffer_limit_code]\n\n setup.input_token_counter_offset = __get_integer(setup.input_token_counter_offset,\n \"--token-offset\")\n setup.token_id_termination = __get_integer(setup.token_id_termination, \n \"--token-id-termination\")\n setup.token_id_uninitialized = __get_integer(setup.token_id_uninitialized, \n \"--token-id-uninitialized\")\n validate(setup, command_line, argv)\n\n if setup.input_foreign_token_id_file != \"\": \n CommentDelimiterList = [[\"//\", \"\\n\"], [\"/*\", \"*/\"]]\n # Regular expression to find '#include <something>' and extract the 'something'\n # in a 'group'. Note that '(' ')' cause the storage of parts of the match.\n IncludeRE = \"#[ \\t]*include[ \\t]*[\\\"<]([^\\\">]+)[\\\">]\"\n #\n parse_token_id_file(setup.input_foreign_token_id_file, setup.input_token_id_prefix, \n CommentDelimiterList, IncludeRE)\n\n # (*) Default values\n # (Please, do not change this, otherwise no 'empty' options can be detected.)\n if setup.input_token_class_file == \"\": \n setup.input_token_class_file = SETUP_INFO[\"input_token_class_file\"][2]\n if setup.input_token_class_name == \"\": \n setup.input_token_class_name = SETUP_INFO[\"input_token_class_name\"][2]\n\n # (*) return setup ___________________________________________________________________\n return\n\ndef validate(setup, command_line, argv):\n \"\"\"Does a consistency check for setup and the command line.\n \"\"\"\n setup.output_directory = os.path.normpath(setup.output_directory)\n if setup.output_directory != \"\":\n # Check, if the output directory exists\n if os.access(setup.output_directory, os.F_OK) == False:\n error_msg(\"The directory %s was specified for output, but does not exists.\" % setup.output_directory)\n if os.access(setup.output_directory, os.W_OK) == False:\n error_msg(\"The directory %s was specified for output, but is not writeable.\" % setup.output_directory)\n\n # if the mode is 'plotting', then check wether a graphic format is speicified\n for plot_option in SETUP_INFO[\"plot_graphic_format\"][0]:\n if plot_option in argv and setup.plot_graphic_format == \"\":\n error_msg(\"Option '%s' must be followed by a graphic format specifier (bmp, svg, jpg, ...)\" % \\\n plot_option)\n\n # ensure that options are not specified twice\n for parameter, info in SETUP_INFO.items():\n occurence_n = 0 \n for option in info[0]:\n occurence_n += argv.count(option)\n if occurence_n > 1:\n error_msg(\"Received more than one of the following options:\\n\" + \\\n \"%s\" % repr(info[0])[1:-1])\n\n # (*) Check for 'Depraceted' Options ___________________________________________________\n for name, info in DEPRECATED.items():\n command_line_options = SETUP_INFO[name][0]\n comment = info[0]\n depreciated_since_version = info[1]\n for option in command_line_options:\n if command_line.search(option):\n error_msg(\"Command line option '%s' is ignored.\\n\" % option + \\\n \"Last version of Quex supporting this option is version %s. Please, visit\\n\" % depreciated_since_version + \\\n \"http://quex.sourceforge.net for download---Or use a more advanced approach.\\n\" + \\\n comment)\n \n\n # (*) Check for 'Straying' Options ___________________________________________________\n options = []\n for key, info in SETUP_INFO.items():\n if key in DEPRECATED: continue\n if info[1] != None: options.extend(info[0])\n options.sort(lambda a,b: cmp(a.replace(\"-\",\"\"), b.replace(\"-\",\"\")))\n\n ufos = command_line.unidentified_options(options)\n if ufos != []:\n error_msg(\"Unidentified option(s) = \" + repr(ufos) + \"\\n\" + \\\n __get_supported_command_line_option_description(options))\n\n if setup.input_derived_class_name != \"\" and \\\n setup.input_derived_class_file == \"\":\n error_msg(\"Specified derived class '%s' on command line, but it was not\\n\" % \\\n setup.input_derived_class_name + \\\n \"specified which file contains the definition of it.\\n\" + \\\n \"use command line option '--derived-class-file'.\\n\")\n\n # check validity\n bpc = setup.bytes_per_ucs_code_point\n if bpc != \"wchar_t\":\n if bpc not in [\"1\", \"2\", \"4\"]:\n error_msg(\"choice for --bytes-per-ucs-code-point: %s\" % bpc + \\\n \"quex only supports 1, 2, or 4 bytes per character in internal engine\")\n sys.exit(-1)\n else:\n setup.bytes_per_ucs_code_point = int(setup.bytes_per_ucs_code_point)\n\n if setup.byte_order == \"<system>\": \n setup.byte_order = sys.byteorder \n elif setup.byte_order not in [\"<system>\", \"little\", \"big\"]:\n error_msg(\"Byte order (option --endian) must be 'little' or 'big'.\\n\" + \\\n \"Note, that this option is only interesting for cross plattform development.\\n\" + \\\n \"By default, quex automatically chooses the endian type of your system.\")\n\n # token offset and several ids\n if setup.input_token_counter_offset == setup.token_id_termination:\n error_msg(\"Token id offset (--token-offset) == token id for termination (--token-id-termination)\\n\")\n if setup.input_token_counter_offset == setup.token_id_uninitialized:\n error_msg(\"Token id offset (--token-offset) == token id for uninitialized (--token-id-uninitialized)\\n\")\n if setup.token_id_termination == setup.token_id_uninitialized:\n error_msg(\"Token id for termination (--token-id-termination) and uninitialized (--token-id-uninitialized)\\n\" + \\\n \"are chosen to be the same. Maybe it works.\", DontExitF=True)\n if setup.input_token_counter_offset < setup.token_id_uninitialized:\n error_msg(\"Token id offset (--token-offset) < token id uninitialized (--token-id-uninitialized).\\n\" + \\\n \"Maybe it works.\", DontExitF=True)\n if setup.input_token_counter_offset < setup.token_id_termination:\n error_msg(\"Token id offset (--token-offset) < token id termination (--token-id-termination).\\n\" + \\\n \"Maybe it works.\", DontExitF=True)\n \n # check that names are valid identifiers\n __check_identifier(setup, \"input_token_id_prefix\", \"Token prefix\")\n __check_identifier(setup, \"output_engine_name\", \"Engine name\")\n if setup.input_derived_class_name != \"\": \n __check_identifier(setup, \"input_derived_class_name\", \"Derived class name\")\n if setup.input_token_class_name != \"\": \n __check_identifier(setup, \"input_token_class_name\", \"Token class name\")\n \n # '--token-class' and '--token-class-file' needs to appear together\n if setup.input_token_class_name != \"\" and setup.input_token_class_file == \"\":\n error_msg(\"User defined token class '%s':\\n\" % setup.input_token_class_name + \\\n \"Specifying a user-defined token class via '--token-class' requires\\n\" + \\\n \"that the token class file, also, needs to be specified via '--token-class-file'.\")\n if setup.input_token_class_file != \"\" and setup.input_token_class_name == \"\":\n error_msg(\"User defined token class file '%s':\\n\" % setup.input_token_class_file + \\\n \"Specifying a user-defined token class file via '--token-class-file' requires\\n\" + \\\n \"that the token class, also, needs to be specified via '--token-class'.\")\n\n # __check_identifier(\"token_id_termination\", \"Token id for termination\")\n # __check_identifier(\"token_id_uninitialized\", \"Token id for uninitialized\")\n __check_file_name(setup, \"input_token_class_file\", \"file containing user defined token class\")\n __check_file_name(setup, \"input_derived_class_file\", \"file containing user derived lexer class\")\n\n __check_file_name(setup, \"input_foreign_token_id_file\", \"file containing user token ids\")\n __check_file_name(setup, \"input_user_token_id_file\", \"file containing user token ids\")\n\n __check_file_name(setup, \"input_mode_files\", \"quex source file\")\n\ndef __check_file_name(setup, Candidate, Name):\n value = setup.__dict__[Candidate]\n CommandLineOption = SETUP_INFO[Candidate][0]\n\n if type(value) == list:\n for name in value:\n if name != \"\" and name[0] == \"-\": \n error_msg(\"Quex refuses to work with file names that start with '-' (minus).\\n\" + \\\n \"Received '%s' for %s (%s)\" % (value, name, repr(CommandLineOption)[1:-1]))\n if os.access(name, os.F_OK) == False:\n error_msg(\"File %s cannot be found.\\n\" % name)\n else:\n if value == \"\" or value[0] == \"-\": \n return\n if os.access(value, os.F_OK) == False:\n error_msg(\"File %s cannot be found.\\n\" % value)\n\ndef __check_identifier(setup, Candidate, Name):\n value = setup.__dict__[Candidate]\n if is_identifier(value): return\n\n CommandLineOption = SETUP_INFO[Candidate][0]\n\n error_msg(\"%s must be a valid identifier (%s).\\n\" % (Name, repr(CommandLineOption)[1:-1]) + \\\n \"Received: '%s'\" % value)\n\ndef __get_integer(code, option_name):\n try:\n if type(code) == int: return code\n elif len(code) > 2:\n if code[:2] == \"0x\": return int(code, 16)\n elif code[:2] == \"0o\": return int(code, 8)\n return int(code)\n except:\n error_msg(\"Cannot convert '%s' into an integer for '%s'\" % (code, option_name))\n\ndef __prepare_file_name(Setup, Suffix):\n FileName = Setup.output_engine_name + Suffix\n if Setup.output_directory == \"\": return FileName\n else: return os.path.normpath(Setup.output_directory + \"/\" + FileName)\n\ndef __get_supported_command_line_option_description(NormalModeOptions):\n txt = \"OPTIONS:\\n\"\n for option in NormalModeOptions:\n txt += \" \" + option + \"\\n\"\n\n txt += \"\\nOPTIONS FOR QUERY MODE:\\n\"\n txt += query.get_supported_command_line_option_description()\n return txt\n\n" }, { "alpha_fraction": 0.525635838508606, "alphanum_fraction": 0.5260395407676697, "avg_line_length": 29.962499618530273, "blob_id": "80e2cbeedc6400a9c4cf9cc4071d26f15c54ccb7", "content_id": "1a758e35ba199f61dc46a2db502efdc1a201cd52", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Makefile", "length_bytes": 2477, "license_type": "permissive", "max_line_length": 80, "num_lines": 80, "path": "/dependencies/quex-0.34.1/demo/003/Makefile", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "# PURPOSE: Makefile for Demo Application of Quex\n#\n# ABSOLUTELY NO WARRANTY\n#_______________________________________________________________________________\n.PHONY: clean\n\nifndef QUEX_PATH\n $(error The environment variable QUEX_PATH is not defined!)\nendif\n\nifndef BYTES_PER_CHARACTER\n BYTES_PER_CHARACTER = 2\nendif\ninclude $(QUEX_PATH)/quex/code_base/core.mkd\n\n# (*) SETUP ____________________________________________________________________\n# -- INPUT\nMODE_FILES = definitions.qx end_of_file.qx program.qx\n# -- FILES PRODUCED BY QUEX\nENGINE_NAME = tiny_lexer# NOTE: a whitespace after this name creates chaos!\nENGINE_SOURCES = $(ENGINE_NAME) \\\n $(ENGINE_NAME).cpp \\\n $(ENGINE_NAME)-token_ids \\\n\t\t $(ENGINE_NAME)-core-engine.cpp\n# -- OUTPUT\nAPPLICATION = lexer\n\n# (*) COMPILER SETTINGS ________________________________________________________\n# (change COMPILER to whatever you use as compiler on the command line,\n# e.g. \"make COMPILER=icpc\" will use intel's c++ compiler)\nCOMPILER = g++\n# Some compiler distributions have iconv in a separate lib:\n# -- Intel's icpc\n# -- MS's cl\n# -- Digital Mars dmc\n# Add any compiler that does so to\nifneq (,$(findstring $(COMPILER),icpc cl dmc))\n\tLIBICONV=-liconv\nelse\n\tLIBICONV=#\nendif\nCC = $(COMPILER) -c -fPIC -Wno-deprecated -Wall \\\n\t -I./ -I$(QUEX_PATH) $(NDEBUG_F) \\\n\t -D___QUEX_UNIT_TESTING___ -ggdb \\\n -DQUEX_OPTION_ACTIVATE_ASSERTS\t\n\nLD = $(COMPILER) $(LIBICONV) \n\n# (*) RULES ____________________________________________________________________\n# -- application\n$(APPLICATION): $(APPLICATION).o \\\n\t $(ENGINE_NAME).o $(ENGINE_NAME)-core-engine.o\n\t$(LD) ./$(APPLICATION).o $(ENGINE_NAME).o $(ENGINE_NAME)-core-engine.o \\\n -o $(APPLICATION) \n# -- libraries\n$(LIBRARY_NAME).a:\n\t$(STATIC_LD) $@ $(LIBRARY_OBJS)\n\n$(LIBRARY_NAME).so:\n\t$(DYNAMIC_LD) $(LIBRARY_OBJS) -o $@ \n\n# -- engine and object files\n%.o: %.cpp $(ENGINE_SOURCES)\n\t$(CC) $< -o $@\n\n$(ENGINE_SOURCES): $(MODE_FILES) $(QUEX_CORE)\n\tquex -i $(MODE_FILES) --engine $(ENGINE_NAME) \\\n\t --bytes-per-ucs-code-point $(BYTES_PER_CHARACTER) \\\n\t --iconv \n\n# (*) HELPERS __________________________________________________________________\nclean:\t\n\ttouch $(MODE_FILES)\n\trm -f $(ENGINE_SOURCES)\n\trm -f $(ENGINE_NAME).o\n\trm -f $(ENGINE_NAME)-core-engine.o\n\trm -f lexer.o\n\trm -f lexer\n\trm -f token_ids\n\trm -f *.bak\n" }, { "alpha_fraction": 0.5185801386833191, "alphanum_fraction": 0.5241264700889587, "avg_line_length": 27.171875, "blob_id": "1ef7b07a1116508330cd02817377af651dd8760f", "content_id": "bcd0be967df6195b7ee5d5ddd3f5879cdb73b58f", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 1803, "license_type": "permissive", "max_line_length": 102, "num_lines": 64, "path": "/dependencies/quex-0.34.1/demo/009/wlexer.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "#include<fstream> \n#include<iostream> \n#include<sstream> \n\n#include <./tiny_wlexer>\n\nusing namespace std;\n\nquex::tiny_wlexer* get_wstringstream_input();\n\n\nint \nmain(int argc, char** argv) \n{ \n // (*) create token\n quex::Token Token;\n // (*) create the lexical analyser\n // if no command line argument is specified user file 'example.txt'\n quex::tiny_wlexer* qlex = 0x0;\n\n if( argc < 2 ) {\n cout << \"At least one command line argument required.\\n\";\n return -1;\n } else if ( strcmp(argv[1], \"wstringstream\") == 0 ) {\n qlex = get_wstringstream_input();\n } else {\n cout << \"Experiment \" << argv[1] << \" not supported by this application.\\n\";\n return -1;\n }\n\n cout << \",------------------------------------------------------------------------------------\\n\";\n cout << \"| [START]\\n\";\n\n int number_of_tokens = 0;\n // (*) loop until the 'termination' token arrives\n do {\n qlex->get_token(&Token);\n cout << string(Token) << endl;\n ++number_of_tokens;\n } while( Token.type_id() != QUEX_TKN_TERMINATION );\n\n cout << \"| [END] number of token = \" << number_of_tokens << \"\\n\";\n cout << \"`------------------------------------------------------------------------------------\\n\";\n\n delete qlex;\n\n return 0;\n}\n\nquex::tiny_wlexer* \nget_wstringstream_input()\n{\n /* Wide String Stream Input */\n std::wstringstream my_stream;\n cout << \"wstringstream:\\n\";\n cout << \" Note this works only when engine is generated with -b wchar_t\\n\";\n cout << \" and therefore QUEX_CHARACTER_TYPE == wchar_t.\\n\";\n\n assert(sizeof(QUEX_CHARACTER_TYPE) == sizeof(wchar_t));\n\n my_stream << L\"bonjour le monde hello world hallo welt\";\n\n return new quex::tiny_wlexer(&my_stream);\n}\n" }, { "alpha_fraction": 0.5504410266876221, "alphanum_fraction": 0.5570562481880188, "avg_line_length": 36.79166793823242, "blob_id": "d112cce020f8b5633d7315578b5b3ead208cb4f6", "content_id": "43512afb808feb477f65eeab26cb56de4871682d", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 3628, "license_type": "permissive", "max_line_length": 92, "num_lines": 96, "path": "/dependencies/quex-0.34.1/quex/code_base/template/IncludeStack.i", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "// -*- C++ -*- vim:set syntax=cpp:\n#ifndef __INCLUDE_GUARD__QUEX__INCLUDE_STACK\n#define __INCLUDE_GUARD__QUEX__INCLUDE_STACK\n\n#include <quex/code_base/template/Analyser>\nnamespace quex { \n\n inline \n IncludeStack::IncludeStack(CLASS* the_lexer)\n : _the_lexer(the_lexer)\n { }\n\n\n template <class InputHandle> inline void \n IncludeStack::push(InputHandle* new_input_handle_p, \n const QuexMode& mode, \n QuexBufferFillerTypeEnum BFT /* = QUEX_AUTO */,\n const char* IANA_CodingName /* = 0x0 */)\n {\n // Once we allow MODE_ID == 0, reset the range to [0:MAX_MODE_CLASS_N]\n __push(new_input_handle_p, mode.analyser_function, IANA_CodingName);\n }\n\n template <class InputHandle> inline void \n IncludeStack::push(InputHandle* new_input_handle_p, \n const int MODE_ID /* = -1 */, \n QuexBufferFillerTypeEnum BFT /* QUEX_AUTO */,\n const char* IANA_CodingName /* = 0x0 */)\n {\n // Once we allow MODE_ID == 0, reset the range to [0:MAX_MODE_CLASS_N]\n __quex_assert( MODE_ID == -1 \n || (MODE_ID >= 1 && MODE_ID < __QUEX_SETTING_MAX_MODE_CLASS_N + 1));\n __quex_assert(new_input_handle_p != 0x0);\n // IANA_CodingName == 0x0 possible if normal ASCII is ment (e.g. no iconv support)\n\n if( MODE_ID != -1 ) _the_lexer->set_mode_brutally(MODE_ID);\n\n _stack.push_back(memento());\n memento* m = &(_stack.back());\n\n // (1) saving the current state of the lexical analyzer (memento pattern)\n m->map_from_lexical_analyzer(_the_lexer);\n\n _the_lexer->counter.init();\n\n // (2) initializing the new state of the lexer for reading the new input file/stream\n QuexAnalyser_construct((QuexAnalyser*)_the_lexer,\n _the_lexer->current_analyser_function,\n new_input_handle_p,\n BFT, IANA_CodingName, \n QUEX_SETTING_BUFFER_SIZE,\n QUEX_SETTING_TRANSLATION_BUFFER_SIZE);\n } \n\n inline bool\n IncludeStack::pop() \n {\n /* Not included? return 'false' to indicate we're on the top level */\n if( _stack.empty() ) return false; \n\n memento* m = &(_stack.back());\n\n // (1) Free the related memory that is no longer used\n QuexAnalyser_destruct((QuexAnalyser*)_the_lexer);\n\n // (2) Reset the lexical analyser to the state it was before the include\n m->map_to_lexical_analyzer(_the_lexer);\n\n // (3) Forget about the memento\n _stack.pop_back();\n\n /* Return to including file succesful */\n return true;\n }\n\n inline void\n IncludeStack::memento::map_from_lexical_analyzer(CLASS* TheLexer)\n {\n // (1) saving the current state of the lexical analyzer (memento pattern)\n this->analyser_core = *((QuexAnalyser*)TheLexer);\n this->counter = TheLexer->counter;\n\n this->current_mode_p = TheLexer->__current_mode_p;\n }\n\n inline void\n IncludeStack::memento::map_to_lexical_analyzer(CLASS* the_lexer)\n {\n // (1) saving the current state of the lexical analyzer (memento pattern)\n *((QuexAnalyser*)the_lexer) = this->analyser_core;\n the_lexer->counter = this->counter;\n the_lexer->__current_mode_p = this->current_mode_p;\n }\n} // namespace quex\n\n#endif // __INCLUDE_GUARD__QUEX__INCLUDE_STACK\n" }, { "alpha_fraction": 0.6722433567047119, "alphanum_fraction": 0.6866919994354248, "avg_line_length": 41.41935348510742, "blob_id": "040a707a0ce7e80ccd0102b90f2183c109a1c48c", "content_id": "435279a4223e5168014efbc9234c562749bdc2d3", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "C", "length_bytes": 1315, "license_type": "permissive", "max_line_length": 78, "num_lines": 31, "path": "/dependencies/quex-0.34.1/quex/code_base/compatibility/pseudo-stdbool.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* PURPOSE: This header defines standard bool data types for use\n * in plain 'C' lexical analyser engines. This is done\n * here, in wise prediction that some compiler distributions\n * may not provide this standard header. For the standard\n * reference, please review: \"The Open Group Base Specifications \n * Issue 6, IEEE Std 1003.1, 2004 Edition\".\n *\n * (C) 2008 Frank-Rene Schaefer */ \n#ifndef __INCLUDE_GUARD_QUEX__CODE_BASE__COMPATIBILITY_PSEUDO_STDBOOL_H__\n#define __INCLUDE_GUARD_QUEX__CODE_BASE__COMPATIBILITY_PSEUDO_STDBOOL_H__\n\n#if defined(__QUEX_SETTING_PLAIN_C)\n\n/* According to the C99 Standard 'bool' would have to be defined\n * as equal to '_Bool' which is also defined in some standard. The author\n * of this header, though, found it particularly hard to determine\n * whether the compiler obeys these standards or not. Even prominent\n * compilers (such as gcc) do not provide __STDC_VERSION__. Thus, \n * the 'easy' solution to simply define it as 'int' and call this\n * file a 'pseudo-stdbool.h'. */\n#ifndef bool\n# define bool int\n#endif\n\n#define true ((int)(1))\n#define false ((int)(0))\n\n#define __bool_true_false_are_defined ((int)(1))\n\n#endif /* __QUEX_SETTING_PLAIN_C */\n#endif /* __INCLUDE_GUARD_QUEX__CODE_BASE__COMPATIBILITY_PSEUDO_STDBOOL_H__ */\n" }, { "alpha_fraction": 0.5748427510261536, "alphanum_fraction": 0.5830188393592834, "avg_line_length": 33.94505310058594, "blob_id": "bcb7020d9f2ee377c6f682423e92996366d9493b", "content_id": "934f62c0fb4a0500e2f363220ea96868a4d13f5c", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 9540, "license_type": "permissive", "max_line_length": 85, "num_lines": 273, "path": "/engine/physics/collision_mesh.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\nclass CollisionMesh;\n\n#ifndef CollisionMesh_h\n#define CollisionMesh_h\n\nclass btCompoundShape;\n\n#include <string>\n\n#include <sleep.h>\n\n#include <centralised_log.h>\n#include \"../disk_resource.h\"\n#include \"../shared_ptr.h\"\n\n#include \"tcol_parser.h\"\n#include \"bcol_parser.h\"\n#include \"loose_end.h\"\n#include \"physical_material.h\"\n\nclass CollisionMesh : public DiskResource {\n\n public:\n\n CollisionMesh (const std::string &name)\n : name(name),\n masterShape(NULL),\n inertia(0.0f, 0.0f, 0.0f),\n mass(0.0f),\n ccdMotionThreshold(0.0f),\n ccdSweptSphereRadius(0.0f),\n linearDamping(0.0f),\n angularDamping(0.0f),\n linearSleepThreshold(0.0f),\n angularSleepThreshold(0.0f),\n friction(0.0f),\n restitution(0.0f)\n { }\n\n btCompoundShape *getMasterShape (void) const { return masterShape; }\n\n const std::string &getName (void) const { return name; }\n\n float getMass (void) const { return mass; }\n void setMass (float v) { mass = v; }\n\n Vector3 getInertia (void) const { return inertia; }\n void setInertia (const Vector3 &v) { inertia = v; }\n\n float getCCDMotionThreshold (void) const\n { return ccdMotionThreshold; }\n void setCCDMotionThreshold (float v)\n { ccdMotionThreshold = v; }\n\n float getCCDSweptSphereRadius (void) const\n { return ccdSweptSphereRadius; }\n void setCCDSweptSphereRadius (float v)\n { ccdSweptSphereRadius = v; }\n\n float getLinearDamping (void) const\n { return linearDamping; }\n void setLinearDamping (float r)\n { linearDamping = r; }\n float getAngularDamping (void) const\n { return angularDamping; }\n void setAngularDamping (float r)\n { angularDamping = r; }\n\n float getLinearSleepThreshold (void) const\n { return linearSleepThreshold; }\n void setLinearSleepThreshold (float r)\n { linearSleepThreshold = r; }\n float getAngularSleepThreshold (void) const\n { return angularSleepThreshold; }\n void setAngularSleepThreshold (float r)\n { angularSleepThreshold = r; }\n\n PhysicalMaterial *getMaterialFromPart (unsigned int id) const;\n PhysicalMaterial *getMaterialFromFace (unsigned int id) const;\n\n typedef std::vector<PhysicalMaterial*> Materials;\n\n struct ProcObjFace {\n Vector3 A;\n Vector3 AB;\n Vector3 AC;\n ProcObjFace (const Vector3 &a, const Vector3 &b, const Vector3 &c)\n {\n A = a;\n AB = b - a;\n AC = c - a;\n }\n };\n typedef std::vector<ProcObjFace> ProcObjFaces;\n typedef std::vector<float> ProcObjFaceAreas;\n\n struct ProcObjFaceDBEntry {\n ProcObjFaces faces;\n ProcObjFaceAreas areas;\n ProcObjFaceAreas areas10;\n float totalArea;\n ProcObjFaceDBEntry (void) : totalArea(0) { }\n };\n typedef std::map<int,ProcObjFaceDBEntry> ProcObjFaceDB;\n\n void getProcObjMaterials (std::vector<int> &r) const {\n typedef ProcObjFaceDB::const_iterator I;\n for (I i=procObjFaceDB.begin(),i_=procObjFaceDB.end() ; i!=i_ ; ++i)\n r.push_back(i->first);\n }\n\n // Required in T:\n // member function void T::push_back(const WorldTransform &)\n // member function size_t T::size()\n template<class T>\n void scatter (int mat, const SimpleTransform &world_trans, float density,\n float min_slope, float max_slope,\n float min_elevation, float max_elevation,\n bool no_z, bool rotate, bool align_slope,\n unsigned seed,\n T &r) const\n {\n float left_overs = 0; // fractional samples carried over to the next triangle\n float min_slope_sin = gritsin(Degree(90-max_slope));\n float max_slope_sin = gritsin(Degree(90-min_slope));\n float range_slope_sin = (max_slope_sin-min_slope_sin);\n\n ProcObjFaceDB::const_iterator ent_ = procObjFaceDB.find(mat);\n if (ent_ == procObjFaceDB.end())\n GRIT_EXCEPT(\"Collision mesh cannot scatter to that physical material\");\n const ProcObjFaceDBEntry &ent = ent_->second;\n const ProcObjFaces &mat_faces = ent.faces;\n const ProcObjFaceAreas &mat_face_areas = ent.areas;\n //const ProcObjFaceAreas &mat_face_areas10 = ent.areas10;\n float total_area = ent.totalArea;\n int max_samples = int(total_area * density);\n\n r.reserve(r.size() + max_samples);\n\n srand(seed);\n\n unsigned long long before = micros();\n for (unsigned i=0 ; i<mat_face_areas.size() ; ++i) {\n\n float area = mat_face_areas[i];\n float samples_f = area * density + left_overs;\n int samples = int(samples_f);\n left_overs = samples_f - samples;\n if (samples==0) continue;\n\n const ProcObjFace &f = mat_faces[i];\n\n Vector3 A = world_trans * f.A;\n Vector3 AB = world_trans.removeTranslation() * f.AB;\n Vector3 AC = world_trans.removeTranslation() * f.AC;\n\n Vector3 n = AB.cross(AC).normalisedCopy();\n if (n.z < min_slope_sin) continue;\n if (n.z > max_slope_sin) continue;\n if (no_z) {\n samples_f *= 1 - (max_slope_sin-n.z)/range_slope_sin;\n samples = int(samples_f);\n if (samples == 0) continue;\n }\n //float density = float(rand())/RAND_MAX * density;\n\n // base_q may be multiplied by a random rotation for each sample later\n Quaternion base_q = align_slope ?\n Vector3(0,0,1).getRotationTo(n) : Quaternion(1,0,0,0);\n \n for (int i=0 ; i<samples ; ++i) {\n float x = float(rand())/RAND_MAX;\n float y = float(rand())/RAND_MAX;\n if (x+y > 1) { x=1-x; y=1-y; }\n \n // scale up\n Vector3 p = A + x*AB + y*AC;\n\n if (p.z < min_elevation && p.z > max_elevation) continue;\n\n // a whole bunch of sanity checks for debugging purposes\n #if 0\n Vector3 max(std::max(A.x,std::max(B.x,C.x)),\n std::max(A.y,std::max(B.y,C.y)),\n std::max(A.z,std::max(B.z,C.z)));\n Vector3 min(std::min(A.x,std::min(B.x,C.x)),\n std::min(A.y,std::min(B.y,C.y)),\n std::min(A.z,std::min(B.z,C.z)));\n if (p.x < min.x) abort();\n if (p.y < min.y) abort();\n if (p.z < min.z) abort();\n if (p.x > max.x) abort();\n if (p.y > max.y) abort();\n if (p.z > max.z) abort();\n APP_ASSERT(!std::isnan(p.x));\n APP_ASSERT(!std::isnan(p.y));\n APP_ASSERT(!std::isnan(p.z));\n APP_ASSERT(!std::isnan(base_q.w));\n APP_ASSERT(!std::isnan(base_q.x));\n APP_ASSERT(!std::isnan(base_q.y));\n APP_ASSERT(!std::isnan(base_q.z));\n #endif\n\n if (rotate) {\n Quaternion rnd(Radian(float(rand())/RAND_MAX * 2*M_PI),\n Vector3(0,0,1));\n r.push_back(SimpleTransform(p, base_q * rnd));\n } else {\n r.push_back(SimpleTransform(p, base_q));\n }\n }\n }\n CLOG << \"scatter time: \" << micros()-before << \"us\"\n << \" max_samples: \" << max_samples\n << \" samples: \" << r.size() << \" tris: \" << mat_faces.size()\n << \" area: \" << total_area\n << std::endl;;\n }\n protected:\n\n const std::string name;\n btCompoundShape *masterShape;\n\n Vector3 inertia;\n float mass;\n float ccdMotionThreshold;\n float ccdSweptSphereRadius;\n float linearDamping;\n float angularDamping;\n float linearSleepThreshold;\n float angularSleepThreshold;\n float friction;\n float restitution;\n\n void loadImpl (void);\n void unloadImpl (void);\n\n\n ProcObjFaceDB procObjFaceDB;\n\n // don't resize these: bullet has an internal pointer to them\n TColFaces faces;\n Vertexes verts;\n BColFaces bcolFaces;\n BColVerts bcolVerts;\n\n public: // make these protected again when bullet works\n Materials faceMaterials;\n Materials partMaterials;\n};\n\n#endif\n" }, { "alpha_fraction": 0.7214764952659607, "alphanum_fraction": 0.7348993420600891, "avg_line_length": 73.5, "blob_id": "d9cce6f2c7be04be986b30ace27256f26958f7f9", "content_id": "5f11b2a96aaabdec48f49022b89b7e48c732a4bc", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 298, "license_type": "permissive", "max_line_length": 206, "num_lines": 4, "path": "/docs/README.md", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "# ~GRIT-ENGINE = GRIT-COMPLEMENT\n[SVG](https://lavrod.github.io/grit-complement/svg.html)\n\n<a href=\"http://www.youtube.com/watch?feature=player_embedded&v=YOUTUBE_VIDEO_ID_HERE \" target=\"_blank\"><img src=\"http://img.youtube.com/vi/YOUTUBE_VIDEO_ID_HERE/0.jpg\" alt=\"IMAGE ALT TEXT HERE\" width=\"240\"\n" }, { "alpha_fraction": 0.6381969451904297, "alphanum_fraction": 0.6411625146865845, "avg_line_length": 34.11458206176758, "blob_id": "cad3c9c59eedf174aa29df588e69075e4825c2c2", "content_id": "1b19dd3e0585efb4b3fd1bcacb499b8327e764ad", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 3372, "license_type": "permissive", "max_line_length": 89, "num_lines": 96, "path": "/engine/option.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <string>\n#include <sstream>\n#include <ostream>\n\n#ifndef OPTION_H\n#define OPTION_H\n\n#include <exception.h>\n\n/** Abstract base class for an option (i.e. a configurable parameter of one of\n * the Grit subsystems such as gfx_option) that defines the valid range of\n * values. */\ntemplate<class T> struct ValidOption {\n\n virtual ~ValidOption (void) { }\n\n /** Returns whether or not the given value is part of the range. */\n virtual bool isValid (T v) = 0;\n\n /** Writes to the stream a string of the form \"must be <property of values\n * that are valid in this range>\" . */\n virtual void err (ExceptionStream &o) = 0;\n\n /** Throws an error with an appropriate message including the name of the\n * option if the given value is not valid. */\n virtual void maybeThrow (const std::string name, T v)\n {\n if (!isValid(v)) {\n ExceptionStream ex;\n ex << name << \" option: new value \" << v << \": \";\n err(ex);\n ex << ENDL;\n }\n }\n};\n\n/** An implementation of ValidOption that allows a dense range of values [min, max].\n *\n * T must have <= and >= defined.\n */\ntemplate<class T> struct ValidOptionRange : ValidOption<T> {\n T min, max;\n ValidOptionRange (T min_, T max_) : min(min_), max(max_) { }\n virtual bool isValid (T v) { return v>=min && v<=max; }\n virtual void err (ExceptionStream &o) { o << \"must be between \"<<min<<\" and \"<<max; }\n};\n\n/** An implementation of ValidOption that allows a defined list of values.\n *\n * A must be of type T[n] for some literal n.\n */\ntemplate<class T, class A> struct ValidOptionList : ValidOption<T> {\n A list;\n /** The array of valid options is passed by reference. */\n ValidOptionList (A &list_)\n {\n for (unsigned i=0 ; i<sizeof(A)/sizeof(T) ; ++i)\n list[i] = list_[i];\n } \n virtual bool isValid (T v)\n {\n for (unsigned i=0 ; i<sizeof(A)/sizeof(T) ; ++i)\n if (v==list[i]) return true;\n return false;\n } \n virtual void err (ExceptionStream &o)\n {\n o << \"must be one of [\";\n for (unsigned i=0 ; i<sizeof(A)/sizeof(T) ; ++i)\n o << (i==0?\"\":\", \") << list[i];\n o << \"]\";\n } \n}; \n\n#endif\n\n" }, { "alpha_fraction": 0.6119929552078247, "alphanum_fraction": 0.619528591632843, "avg_line_length": 27.47945213317871, "blob_id": "c2bb68e3b5d02f528f642ecca043d653a8e113ba", "content_id": "7bda1313669e395d66a1525e369fb3f4dcd9d849", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 6237, "license_type": "permissive", "max_line_length": 83, "num_lines": 219, "path": "/engine/main.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n//#include <fenv.h>\n#include <cerrno>\n#include <sstream>\n\n#ifdef WIN32\n# include <windows.h>\n# define DIRECT3D_VERSION 0x0900\n//# include <d3d9.h>\n# include \"win32/mouse_direct_input8.h\"\n# include \"win32/keyboard_direct_input8.h\"\n# include \"win32/keyboard_win_api.h\"\n# include \"win32/joystick_direct_input8.h\"\n#else\n# include \"linux/keyboard_x11.h\"\n# include \"linux/mouse_x11.h\"\n# include \"linux/joystick_devjs.h\"\n#endif\n\n#include \"clipboard.h\"\n\n#include <centralised_log.h>\n#include \"core_option.h\"\n#include \"grit_lua_util.h\"\n#include \"lua_wrappers_core.h\"\n#include \"main.h\"\n\n#include \"gfx/gfx.h\"\n#include \"physics/physics_world.h\"\n#include \"audio/audio.h\"\n#include \"net/net.h\"\n#include\"navigation/navigation_system.h\"\n\nCentralisedLog clog;\nbool clicked_close = false;\nMouse *mouse = NULL;\nKeyboard *keyboard = NULL;\nJoystick *joystick = NULL;\n\nlua_State *core_L = NULL;\nBulletDebugDrawer *debug_drawer = NULL;\nBackgroundLoader *bgl;\n\n// Receive notifications from the graphics engine.\nstruct TheGfxCallback : GfxCallback {\n\n virtual void clickedClose (void)\n {\n clicked_close = true;\n }\n\n virtual void windowResized (int width, int height)\n {\n (void) width;\n (void) height;\n }\n \n virtual void messageLogged (const std::string &line)\n {\n clog.print(line);\n }\n\n} cb;\n\nint already_fatal = 0;\n\n// To be called in emergencies, upon unrecoverable errors.\nvoid app_fatal()\n{\n if (!already_fatal) {\n already_fatal = 1;\n gfx_shutdown();\n }\n\n abort();\n}\n\nint main (int argc, const char **argv)\n{\n #ifdef WIN32\n {\n // set the console to accept escape sequences (Win10+)\n HANDLE console = GetStdHandle(STD_OUTPUT_HANDLE);\n\n if (console != INVALID_HANDLE_VALUE) {\n DWORD consoleMode = 0;\n GetConsoleMode(console, &consoleMode);\n\n // The macro isn't available in our current SDK target.\n consoleMode |= 4; // ENABLE_VIRTUAL_TERMINAL_PROCESSING\n SetConsoleMode(console, consoleMode);\n }\n }\n #endif\n\n int exit_code = EXIT_SUCCESS;\n\n try {\n\n // Experiment with floating point masks.\n // #ifdef FE_NOMASK_ENV\n // feenableexcept(FE_INVALID);\n // feenableexcept(FE_DIVBYZERO | FE_INVALID);\n // #endif\n\n bgl = new BackgroundLoader();\n\n size_t winid = gfx_init(cb);\n\n debug_drawer = new BulletDebugDrawer(); // FIXME: hack\n\n #ifdef WIN32\n mouse = new MouseDirectInput8(winid);\n bool use_dinput = getenv(\"GRIT_DINPUT\")!=NULL;\n keyboard = use_dinput ? (Keyboard *)new KeyboardDirectInput8(winid)\n : (Keyboard *)new KeyboardWinAPI(winid);\n joystick = new JoystickDirectInput8(winid);\n #else\n mouse = new MouseX11(winid);\n keyboard = new KeyboardX11(winid);\n joystick = new JoystickDevjs(winid);\n #endif\n\n clipboard_init();\n\n physics_init();\n\n net_init();\n\n core_option_init();\n streamer_init();\n\n navigation_init();\n\n // audio_init(getenv(\"GRIT_AUDIO_DEV\"));\n audio_init(NULL);\n\n std::vector<std::string> args;\n for (int i=0 ; i<argc ; i++) {\n args.push_back(argv[i]);\n }\n\n try {\n const char *init_file = getenv(\"GRIT_INIT\");\n if (init_file == nullptr) init_file = \"/system/init.lua\";\n init_lua(init_file, args, core_L);\n } catch (Exception &e) {\n CERR << \"Fatal error: \" << e << std::endl;\n exit_code = EXIT_FAILURE;\n }\n\n // Lua returns - we quit.\n\n object_all_del(core_L); // Will remove all demands from background loader.\n \n CVERB << \"Shutting down Lua graphics subsystem...\" << std::endl;\n gfx_shutdown_lua(core_L);\n\n CVERB << \"Shutting down Lua net subsystem...\" << std::endl;\n net_shutdown(core_L);\n\n CVERB << \"Shutting down navigation subsystem...\" << std::endl;\n navigation_shutdown();\n\n CVERB << \"Shutting down Background Loader...\" << std::endl;\n bgl->shutdown();\n\n CVERB << \"Shutting down Mouse & Keyboard...\" << std::endl;\n if (mouse) delete mouse;\n if (keyboard) delete keyboard;\n if (joystick) delete joystick;\n\n CVERB << \"Shutting down clipboard...\" << std::endl;\n clipboard_shutdown();\n\n CVERB << \"Shutting down Lua VM...\" << std::endl;\n if (core_L) shutdown_lua(core_L);\n\n CVERB << \"Shutting down audio subsystem...\" << std::endl;\n audio_shutdown(); //close AL device\n\n CVERB << \"Shutting down physics subsystem...\" << std::endl;\n physics_shutdown();\n\n CVERB << \"Shutting down the physics debug drawer...\" << std::endl;\n if (debug_drawer) delete debug_drawer;\n\n CVERB << \"Shutting down the Graphics subsystem...\" << std::endl;\n gfx_shutdown();\n\n delete bgl;\n\n } catch (Exception &e) {\n std::cerr << \"TOP LEVEL ERROR: \" << e << std::endl;\n return EXIT_FAILURE;\n }\n\n return exit_code;\n}\n" }, { "alpha_fraction": 0.6186321377754211, "alphanum_fraction": 0.6197579503059387, "avg_line_length": 41.28571319580078, "blob_id": "f909ea46484a43d0c75df53cbb28712d64c3ad66", "content_id": "175345b15281f3218569b29307f2596ea184e1b4", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3553, "license_type": "permissive", "max_line_length": 121, "num_lines": 84, "path": "/dependencies/quex-0.34.1/quex/consistency_check.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "import sys\n\nfrom quex.frs_py.file_in import error_msg\nimport quex.lexer_mode as lexer_mode\nfrom quex.core_engine.generator.action_info import CodeFragment\n\n\ndef do(Modes):\n \"\"\"If consistency check fails due to a fatal error, then this functions\n exits back to the system with error code -1. Otherwise, in 'not so\n perfect' cases there might be only a warning being printed to standard\n output.\n \"\"\"\n if len(Modes) == 0:\n error_msg(\"No single mode defined - bailing out\", Prefix=\"consistency check\")\n\n # -- is there a mode that is applicable?\n for mode in Modes.values():\n if mode.options[\"inheritable\"] != \"only\": break\n else:\n error_msg(\"There is no mode that can be applied---all existing modes are 'inheritable only'.\\n\" + \\\n \"modes are = \" + repr(map(lambda m: m.name, Modes.values()))[1:-1],\n Prefix=\"consistency check\")\n\n # -- is the initial mode defined\n if lexer_mode.initial_mode.get_code() == \"\":\n # find first mode that can actually be applied\n for mode in Modes.values():\n if mode.options[\"inheritable\"] != \"only\":\n selected_mode = mode.name\n break\n \n lexer_mode.initial_mode = CodeFragment(selected_mode)\n error_msg(\"no initial mode defined via 'start'\\n\" + \\\n \"using mode '%s' as initial mode\" % selected_mode, DontExitF=True,\n Prefix=\"warning\")\n\n\n # -- is the start mode applicable?\n if Modes.has_key(lexer_mode.initial_mode.get_code()) == False:\n error_msg(\"Start mode '%s' has not been defined anywhere.\" % lexer_mode.initial_mode.get_code(),\n lexer_mode.initial_mode.filename, lexer_mode.initial_mode.line_n)\n\n if Modes[lexer_mode.initial_mode.get_code()].options[\"inheritable\"] == \"only\":\n error_msg(\"Start mode '%s' is inheritable only and cannot be instantiated.\" % lexer_mode.initial_mode.get_code(),\n lexer_mode.initial_mode.filename, lexer_mode.initial_mode.line_n)\n\n # -- check for circular inheritance\n check_circular_inheritance(Modes)\n\n # -- mode specific checks\n for mode in Modes.values():\n mode.consistency_check()\n\ndef check_circular_inheritance(ModeDB):\n for mode in ModeDB.values():\n __search_circular_inheritance(ModeDB, mode, [])\n mode.inheritance_circularity_check_done_f = True\n\ndef __search_circular_inheritance(ModeDB, mode, inheritance_path):\n \n def __report_error(mode, inheritance_path):\n assert inheritance_path != []\n msg = \"\"\n previous = mode.name\n inheritance_path.reverse()\n for mode_name in inheritance_path:\n msg += \"mode '%s' is a base of mode '%s'.\\n\" % (previous, mode_name)\n previous = mode_name\n\n error_msg(\"circular inheritance detected:\\n\" + msg, mode.filename, mode.line_n)\n\n for base_mode_name in mode.base_modes:\n # -- does base mode exist?\n if ModeDB.has_key(base_mode_name) == False:\n error_msg(\"mode '%s' is derived from mode a '%s'\\n\" % (mode.name, base_mode_name) + \\\n \"but no such mode '%s' actually exists!\" % base_mode_name,\n mode.filename, mode.line_n)\n\n # -- did mode appear in the path of deriving modes\n base_mode = ModeDB[base_mode_name]\n if base_mode.name in inheritance_path: __report_error(base_mode, inheritance_path)\n\n __search_circular_inheritance(ModeDB, base_mode, inheritance_path + [mode.name])\n\n" }, { "alpha_fraction": 0.4529520869255066, "alphanum_fraction": 0.49346041679382324, "avg_line_length": 34.76704406738281, "blob_id": "342bb2eedfa55ad1377a29d146e7eb03ec91b854", "content_id": "3adf1c164c27e25210448cab1481011d1c333fb1", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 18885, "license_type": "permissive", "max_line_length": 94, "num_lines": 528, "path": "/gtasa/txdread.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <fstream>\n#include <string>\n#include <algorithm>\n#include <vector>\n#include <locale>\n\n#include \"ios_util.h\"\n#include \"txdread.h\"\n\n//DDS HEADER SIZE\n#define HDSZ (124)\n#define HDSZT (124+4)\n\n#define DDSD_CAPS 0x00000001 // required\n#define DDSD_HEIGHT 0x00000002 // required\n#define DDSD_WIDTH 0x00000004 // required\n#define DDSD_PITCH 0x00000008 // used for uncompressed textures\n#define DDSD_PIXELFORMAT 0x00001000 // required\n#define DDSD_MIPMAPCOUNT 0x00020000\n#define DDSD_LINEARSIZE 0x00080000 // used for compressed textures\n#define DDSD_DEPTH 0x00800000 // don't need this\n\n#define DDPF_ALPHAPIXELS 0x00000001\n#define DDPF_FOURCC 0x00000004\n#define DDPF_RGB 0x00000040\n\n#define DDSCAPS_COMPLEX 0x00000008\n#define DDSCAPS_TEXTURE 0x00001000\n#define DDSCAPS_MIPMAP 0x00400000\n#define DDSCAPS2_CUBEMAP 0x00000200\n#define DDSCAPS2_CUBEMAP_POSITIVEX 0x00000400\n#define DDSCAPS2_CUBEMAP_NEGATIVEX 0x00000800\n#define DDSCAPS2_CUBEMAP_POSITIVEY 0x00001000\n#define DDSCAPS2_CUBEMAP_NEGATIVEY 0x00002000\n#define DDSCAPS2_CUBEMAP_POSITIVEZ 0x00004000\n#define DDSCAPS2_CUBEMAP_NEGATIVEZ 0x00008000\n#define DDSCAPS2_VOLUME 0x00200000\n\n\n#define RWDATA 0x1\n#define RWEXT 0x3\n#define RWTEX 0x15\n#define RWTEXDICT 0x16\n\n#ifdef min\n#undef min\n#endif\n#ifdef max\n#undef max\n#endif\n\n\n#define VBOS(x,y) if (x<d) { std::cout<<y<<std::endl; } else { }\n\n// these are for writing to memory blocks\n\nstatic int tolowr (int c)\n{\n return std::tolower(char(c),std::cout.getloc());\n}\n\nstatic std::string& strlower (std::string& s)\n{\n std::transform(s.begin(),s.end(), s.begin(),tolowr);\n return s;\n}\n\nvoid Txd::readTx (std::istream &f,\n const std::string &dest_dir,\n unsigned long file_ver,\n bool output)\n{\n\n unsigned long type, texsize;\n ios_read_header(f,&type,&texsize,NULL,&file_ver);\n APP_ASSERT(type==RWTEX);\n\n\n unsigned long size;\n ios_read_header(f,&type,&size,NULL,&file_ver);\n APP_ASSERT(type==RWDATA);\n\n unsigned long vers = ios_read_u32(f);\n APP_ASSERT(vers==8 || vers==9); // always the case in gta_sa\n\n unsigned long filter_flags = ios_read_u32(f);\n APP_ASSERT(filter_flags==0x1101 || filter_flags==0x1102 ||\n filter_flags==0x1106 || filter_flags==0x1206 ||\n filter_flags==0x2106 ||\n filter_flags==0 // gos_town\n );\n\n std::string tex_name = ios_read_fixedstr(f,32);\n strlower(tex_name);\n names.insert(tex_name);\n\n // don't know what this is for?\n std::string alpha_name = ios_read_fixedstr(f,32);\n\n unsigned long alpha_flags = ios_read_u32(f);\n // don't know what these mean\n APP_ASSERT(alpha_flags==0x100 || alpha_flags==0x200 ||\n alpha_flags==0x300 || alpha_flags==0x500 ||\n alpha_flags==0x600 || alpha_flags==0x2600 ||\n alpha_flags==0x8200);\n\n unsigned long d3d_tex_format = ios_read_u32(f);\n // 0 is unknown, 0x15 and 0x16 are raw with/without alpha\n // the other two are DXT1 and DXT3 (code is ascii DWORD)\n // 1 is gostown unknown\n APP_ASSERT(d3d_tex_format==0 || d3d_tex_format==0x15 || d3d_tex_format==0x16\n || d3d_tex_format==0x31545844 || d3d_tex_format==0x33545844\n || d3d_tex_format==0x1);\n\n bool compressed= d3d_tex_format==0x31545844||d3d_tex_format==0x33545844;\n\n unsigned short width = ios_read_u16(f);\n unsigned short height = ios_read_u16(f);\n\n unsigned char depth = ios_read_u8(f);\n // no 24 bit textures in gta sa\n APP_ASSERT(depth==8 || depth==16 || depth==32);\n\n unsigned char levels = ios_read_u8(f);\n APP_ASSERT(levels>0);\n\n unsigned char tex_code_type = ios_read_u8(f);\n APP_ASSERT(tex_code_type==4); // don't know what this means\n\n unsigned char flags = ios_read_u8(f);\n // bit 1 = has alpha, bit 3 = compressed\n APP_ASSERT(flags==0x0 || flags==0x1 || flags==0x8 || flags==0x9\n || flags==0x3); //gostown\n\n unsigned char palette_r[256];\n unsigned char palette_g[256];\n unsigned char palette_b[256];\n unsigned char palette_a[256];\n if (depth==8) {\n for (int i=0 ; i<256 ; i++) {\n palette_r[i] = ios_read_u8(f);\n palette_g[i] = ios_read_u8(f);\n palette_b[i] = ios_read_u8(f);\n palette_a[i] = ios_read_u8(f);\n }\n }\n\n // useful: \"DDS File Reference\", found at:\n // http://msdn2.microsoft.com/en-us/library/bb172993.aspx\n\n if (d3d_tex_format==0) {\n APP_ASSERT(vers==8);\n if (depth==16) {\n APP_ASSERT(flags==0x1);\n d3d_tex_format = 0x31545844; //dxt1\n compressed = true;\n } else if (depth==32) {\n APP_ASSERT(flags==0x0);\n d3d_tex_format = 0x15;\n } else {\n GRIT_EXCEPT(\"unrecognised file type\");\n }\n }\n\n if (d3d_tex_format==1) {\n //gostown\n APP_ASSERT(vers==8);\n APP_ASSERT(flags==0x3);\n APP_ASSERT(depth==16);\n APP_ASSERT(filter_flags==0x1106);\n APP_ASSERT(alpha_flags==0x300);\n d3d_tex_format = 0x33545844; //dxt3\n compressed = true;\n }\n\n if (!output) {\n for (unsigned char i=0 ; i<levels ; i++) {\n unsigned long imgsize = ios_read_u32(f);\n ios_read_byte_array(f, NULL, imgsize);\n }\n ios_read_header(f,&type,&size,NULL,&file_ver);\n APP_ASSERT(type==RWEXT);\n APP_ASSERT(size==0);\n return;\n }\n\n unsigned long imgsize = ios_read_u32(f);\n\n std::ofstream ddsf;\n std::string ddsname = dest_dir + \"/\" + tex_name + \".dds\";\n ddsf.open(ddsname.c_str(),std::ios::binary);\n APP_ASSERT_IO_SUCCESSFUL(ddsf,\"creating new dds file: \\\"\"+ddsname+\"\\\"\");\n\n bool has_alpha = flags&1;\n\n ios_write_u32(ddsf,0x20534444); // \"DDS \"\n ios_write_u32(ddsf,HDSZ);\n unsigned long ddsflags = 0;\n ddsflags |= DDSD_CAPS | DDSD_PIXELFORMAT | DDSD_WIDTH | DDSD_HEIGHT;\n //ddsflags |= compressed ? DDSD_LINEARSIZE : DDSD_PITCH;\n ddsflags |= DDSD_MIPMAPCOUNT;\n ios_write_u32(ddsf,ddsflags);\n ios_write_u32(ddsf,height);\n ios_write_u32(ddsf,width);\n ios_write_u32(ddsf,0); //compressed?imgsize:width*depth/8);\n ios_write_u32(ddsf,0); // not a volume texture\n ios_write_u32(ddsf, levels);\n for (int i=0 ; i<11 ; i++)\n ios_write_u32(ddsf,0); // \"reserved\"\n\n // pixelformat structure\n ios_write_u32(ddsf,32); // size of struct that follows, always 32\n ddsflags = compressed ? DDPF_FOURCC : DDPF_RGB;\n ddsflags |= !compressed && has_alpha ? DDPF_ALPHAPIXELS : 0;\n ios_write_u32(ddsf,ddsflags);\n ios_write_u32(ddsf,compressed?d3d_tex_format:0);\n if (depth==8) {\n // will convert to 32 bit later\n ios_write_u32(ddsf,32);\n } else {\n APP_ASSERT(depth==16 || depth==32);\n ios_write_u32(ddsf,compressed?0:depth);\n }\n if (compressed) {\n ios_write_u32(ddsf,0);\n ios_write_u32(ddsf,0);\n ios_write_u32(ddsf,0);\n ios_write_u32(ddsf,0);\n } else {\n ios_write_u32(ddsf,0x00FF0000); //r\n ios_write_u32(ddsf,0x0000FF00); //g\n ios_write_u32(ddsf,0x000000FF); //b\n ios_write_u32(ddsf,has_alpha ? 0xFF000000 : 0x00000000); //a\n }\n\n // capabilities structure\n ios_write_u32(ddsf,DDSCAPS_TEXTURE|DDSCAPS_MIPMAP|DDSCAPS_COMPLEX);\n ios_write_u32(ddsf,0); // not a cube/volume map\n ios_write_u32(ddsf,0); // \"reserved\"\n ios_write_u32(ddsf,0); // \"reserved\"\n\n // unused\n ios_write_u32(ddsf,0);\n\n unsigned char *dds = NULL;\n unsigned long dds_sz = 0;\n\n for (unsigned char i=0 ; i<levels ; i++) {\n if (i>0) {\n imgsize = ios_read_u32(f);\n }\n\n if (imgsize==0 && compressed) {\n // sometimes txds do not give a mipmap level if it is\n // smaller (width or height) than 4 pixels as dxt1-3\n // are stored in 4x4 pixel chunks so we generate mipmap\n // levels here in a cheap crappy way\n unsigned long mmwidth = width, mmheight=height;\n for (unsigned char j=0 ; j<i ; ++j) {\n mmwidth = std::max(1UL,mmwidth/2);\n mmheight = std::max(1UL,mmheight/2);\n }\n // we need width/height measured in whole 4x4 blocks\n mmwidth = (mmwidth+3)/4;\n mmheight = (mmheight+3)/4;\n unsigned long blocks = mmwidth * mmheight;\n APP_ASSERT(mmwidth==1 || mmheight==1);\n\n // The following code generate black mipmap levels but\n // this was not a good idea, it results in far off\n // things being black (duh).\n /*\n const unsigned char block8[] = {0,0,0,0,\n 0,0,0,0};\n const unsigned char block16[] = {255,255,0,0,\n 0,0,0,0,\n 0,0,0,0,\n 0,0,0,0};\n switch (d3d_tex_format) {\n case 0x31545844: // dxt1: 8 bytes per block\n for (unsigned long j=0 ; j<blocks ; ++j) {\n ios_write_byte_array(ddsf,block8,8);\n }\n break;\n case 0x33545844: // dxt3: 16 bytes per block\n for (unsigned long j=0 ; j<blocks ; ++j) {\n ios_write_byte_array(ddsf,block16,16);\n }\n break;\n default:\n fprintf(stderr,\"Unrecognised format: 0x%x\\n\",d3d_tex_format);\n abort();\n }\n */\n\n // The slightly-better-but-still-pretty-shitty approach\n // is to re-use the mipmap from the layer above, but\n // crop it to the right size. I am going to hell for this.\n unsigned long block_sz = 0;\n switch (d3d_tex_format) {\n case 0x31545844: block_sz = 8; break; // DXT1\n case 0x33545844: block_sz = 16; break; // DXT3\n default:\n fprintf(stderr,\"Unrecognised format: 0x%lx\\n\",d3d_tex_format);\n abort();\n }\n // crop like this:\n dds_sz = blocks * block_sz;\n\n } else {\n\n delete [] dds;\n dds = new unsigned char[imgsize];\n ios_read_byte_array(f, dds, imgsize);\n dds_sz = imgsize;\n\n // convert evil 8bit images to sensible 32bit images\n if (depth==8) {\n unsigned char *new_dds = new unsigned char[imgsize*4];\n for (size_t i=0 ; i<imgsize ; i++) {\n unsigned char c = dds[i];\n new_dds[4*i+0] = palette_b[c];\n new_dds[4*i+1] = palette_g[c];\n new_dds[4*i+2] = palette_r[c];\n new_dds[4*i+3] = palette_a[c];\n }\n imgsize *= 4;\n delete [] dds;\n dds = new_dds;\n dds_sz = imgsize;\n }\n }\n\n ios_write_byte_array(ddsf,dds,dds_sz);\n }\n\n delete [] dds;\n\n // these 3 lines are duplicated at the early return, above\n ios_read_header(f,&type,&size,NULL,&file_ver);\n APP_ASSERT(type==RWEXT);\n APP_ASSERT(size==0);\n\n}\n\n\nTxd::Txd (std::istream &f, const std::string &dest_dir, bool output)\n{\n unsigned long type, txdsize, file_ver;\n ios_read_header(f,&type,&txdsize,&file_ver,NULL);\n APP_ASSERT(type==RWTEXDICT);\n\n unsigned long size;\n ios_read_header(f,&type,&size,NULL,&file_ver);\n APP_ASSERT(type==RWDATA);\n\n unsigned long num_files = ios_read_u16(f);\n ios_read_u16(f);\n\n for (unsigned long i=0 ; i<num_files ; i++) {\n readTx(f, dest_dir, file_ver, output);\n }\n\n ios_read_header(f,&type,&size,NULL,&file_ver);\n APP_ASSERT(type==RWEXT);\n APP_ASSERT(size==0);\n\n}\n\n\n////////////////////////////////////////////////////////////////////////////////\n// TXDREAD CMDLINE TOOL STUFF //////////////////////////////////////////////////\n////////////////////////////////////////////////////////////////////////////////\n\n#ifdef _TXDREAD_EXEC\n\nvoid app_verbose(char const* file, int line, const std::string& msg)\n{\n std::cout<<BOLD<<GREEN<<\"VERBOSE \"<<RESET\n <<BOLD<<file<<NOBOLD<<\":\"<<BOLD<<line<<NOBOLD\n << \": \\\"\"<<BOLD<<BLUE<<msg<<RESET\"\\\"\";\n std::cout<<std::endl;\n}\n\nvoid app_error(char const* file, int line,\n const std::string& i_was, const std::string& msg)\n{\n std::cout<<BOLD<<RED<<\"ERROR \"<<RESET\n <<BOLD<<file<<NOBOLD<<\":\"<<BOLD<<line<<NOBOLD\n <<\": \\\"\"<<BOLD<<YELLOW<<msg<<RESET<<\"\\\"\";\n if (i_was!=\"\")\n std::cout<<\" (\"<<BOLD<<YELLOW<<i_was<<RESET<<\")\";\n std::cout<<std::endl;\n}\n\nvoid app_line(const std::string &msg)\n{\n std::cout<<BOLD<<msg<<NOBOLD<<std::endl;\n}\n\nvoid app_fatal()\n{\n abort();\n}\n\n#define VERSION \"1.0\"\n\nconst char *info =\n\"txdread (c) Dave Cunningham 2007 (version: \" VERSION \")\\n\"\n\"I dump dds files from txds.\\n\";\n\nconst char *usage =\n\"Usage: txdread { <opt> }\\n\\n\"\n\"where <opt> ::= \\\"-v\\\" | \\\"--verbose\\\" increase debug level\\n\"\n\" | \\\"-q\\\" | \\\"--quiet\\\" decrease debug level\\n\"\n\" | \\\"-i\\\" <file> | \\\"--in\\\" <file> input txd\\n\\n\"\n\" | \\\"-d\\\" <dir> | \\\"--destdir\\\" <dir> export here\\n\"\n\" | \\\"-h\\\" | \\\"--help\\\" this message\\n\";\n\nstd::string next_arg(int& so_far, int argc, char **argv)\n{\n if (so_far==argc) {\n std::cerr<<\"Ran out of arguments.\"<<std::endl;\n std::cerr<<usage<<std::endl;\n exit(EXIT_FAILURE);\n }\n return argv[so_far++];\n}\n\n\nstd::string get_ext(const std::string& name, std::string *base_name)\n{\n std::string r;\n std::string::size_type dot = name.find_last_of('.');\n if (dot!=std::string::npos) {\n r = name.substr(dot);\n if (base_name) *base_name = name.substr(0,dot);\n }\n return r;\n}\n\nvoid assert_triggered (void) { }\n\nint main(int argc, char **argv)\n{\n if (argc==1) {\n std::cout<<info<<std::endl;\n std::cout<<usage<<std::endl;\n }\n\n // default parameters\n int d= 0;\n std::string txdname;\n std::string dest_dir = \".\";\n\n int so_far = 1;\n\n while (so_far<argc) {\n std::string arg = next_arg(so_far,argc,argv);\n if (arg==\"-v\" || arg==\"--verbose\") {\n d++;\n } else if (arg==\"-q\" || arg==\"--quiet\") {\n d--;\n } else if (arg==\"-i\" || arg==\"--in\") {\n txdname = next_arg(so_far,argc,argv);\n if (get_ext(txdname,NULL)!=\".txd\") {\n std::cerr << txdname<<\": does not end in .txd\"\n << std::endl;\n exit(EXIT_FAILURE);\n }\n } else if (arg==\"-d\" || arg==\"--destdir\") {\n dest_dir = next_arg(so_far,argc,argv);\n } else if (arg==\"-h\" || arg==\"--help\") {\n std::cout<<info<<std::endl;\n std::cout<<usage<<std::endl;\n } else {\n std::cerr<<\"Unrecognised argument: \"<<arg<<std::endl;\n std::cerr<<usage<<std::endl;\n exit(EXIT_FAILURE);\n } \n }\n\n\n try {\n\n if (txdname != \"\") {\n std::ifstream f;\n f.open(txdname.c_str(), std::ios::binary);\n APP_ASSERT_IO_SUCCESSFUL(f,\"opening \"+txdname);\n VBOS(0,\"reading txd: \"<<txdname<<\"\\n\");\n\n Txd txd(f, dest_dir, true);\n }\n\n } catch (const Exception &e) {\n std::cerr << \"ERROR: \" << e << std::endl;\n\n return EXIT_FAILURE;\n }\n\n return EXIT_SUCCESS;\n}\n\n#endif\n\n// vim: shiftwidth=4:tabstop=4:expandtab\n// vim: shiftwidth=8:tabstop=8:expandtab\n" }, { "alpha_fraction": 0.675424337387085, "alphanum_fraction": 0.676598072052002, "avg_line_length": 34.05063247680664, "blob_id": "0d17f89fee66263f46abaef59eac6c1acf5b4f72", "content_id": "90a36f8f92994d0744201bd2409d8d7d09643801", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 11076, "license_type": "permissive", "max_line_length": 99, "num_lines": 316, "path": "/engine/disk_resource.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <vector>\n#include <set>\n\nclass DiskResource;\ntemplate <class T> class DiskResourcePtr;\ntypedef std::vector<DiskResource*> DiskResources;\n\n#ifndef DiskResource_h\n#define DiskResource_h\n\n#include <string>\n\n#include <centralised_log.h>\n\n\n/** \\file\n *\n * Grit's resource subsystem allows disk data to transition between a loaded\n * and unloaded state. The intention is to manage memory usage by only keeping\n * a necessary subset of all the disk resources loaded simultaneously. There\n * are many kinds of disk resources, including meshes, textures, audio files,\n * collision meshes, etc. In each case, 'unloaded' means existing only on\n * disk, and 'loaded' means ready for use. There is also a system for\n * registering one's need for a particular resource, so that automatic memory\n * management can avoid unloading resources that are currently in use.\n *\n * In addition to this, one can reload resources, which is useful for\n * development of games, where e.g. textures can be tweaked on disk and\n * reloaded in the game for instant preview.\n */\n\n/** Whether or not to print warnings when a resource is loaded in foreground thread. */\nextern bool disk_resource_foreground_warnings;\n\n/** Whether or not disk resource (un)loads trigger a log message. */\nextern bool disk_resource_verbose_loads;\n\n/** Whether or not disk resource inc/decrements trigger a log message. */\nextern bool disk_resource_verbose_incs;\n\n/** Number of disk resources in existence. */\nunsigned long disk_resource_num (void);\n\n/** Number of disk resources that are loaded. */\nint disk_resource_num_loaded (void);\n\n/** A vector of every disk resource in existence. */\nDiskResources disk_resource_all (void);\n\n/** A vector of every disk resource in existence that is also loaded. */\nDiskResources disk_resource_all_loaded (void);\n\n/** Either retrieve the disk resource of the given name, or create a new one.\n * The disk resource will begin life unloaded.\n */\nDiskResource *disk_resource_get_or_make (const std::string &rn);\n\n/** Test if a disk resource of the given name exists. */\nbool disk_resource_has (const std::string &rn);\n\n/** How many MB of host RAM are available for use by disk resources. \n * This is actually controlled by core_option(CORE_RAM)\n */\ndouble host_ram_available (void);\n\n/** How many MB of host RAM have been used by disk resources. */\ndouble host_ram_used (void);\n\n/** Represents some data on disk that must be loaded before use.\n *\n * Subclasses of DiskResource define different kinds of data, such as audio,\n * textures, etc. Each disk resource can be in a loaded or unloaded state. In\n * addition to this, each resource keeps a counter of the number of 'users' it\n * has, who register/unregister their need for the resource. Loaded resources\n * with no users are subject to be automatically unloaded if system memory\n * becomes tight.\n *\n * Note that users>0 and loaded are not logically related. Just because a\n * resource is loaded, does not mean it is still in use, as resources are\n * cached according to a least-recently-used policy. Just because a resource\n * has registered users, does not mean it is loaded, as one can explicitly\n * unload a resource, or a resource can be marked as being used but not be\n * loaded yet.\n *\n * Each resource can depend on any number of other resources to form an acylic\n * graph. This is e.g. for meshes that use materials (and thus textures), and\n * also for collision meshes that have procedural vegetation. The dependencies\n * are discovered when loading the resource, and loading a resource will load\n * its dependencies automatically. Therefore the set of dependencies of an\n * unloaded resource is always empty. Also, if users>0 on a resource, then the\n * dependencies automatically have a user registered for the depending resource\n * so one only has to register use of the top-level resource.\n */\nclass DiskResource {\n\n public:\n\n /** A callback to tell you if this resource is reloaded. */\n struct ReloadWatcher {\n virtual ~ReloadWatcher (void) { };\n virtual void notifyReloaded (const DiskResource *dr) = 0;\n };\n\n /** Do not use this, call the disk_resource_get function instead. */\n DiskResource (void) : loaded(false), users(0) { }\n\n /** The filename, as an absolute unix-style path from the root of the\n * game directory. */\n virtual const std::string &getName (void) const = 0;\n\n /** Is the resource loaded and therefore ready for use? */\n bool isLoaded (void) const { return loaded; }\n\n /** Number of users of this resource. */\n int getUsers (void) const { return users; }\n\n /** Are there no users? */\n bool noUsers() const { return users == 0; }\n\n /** Register a callback for discovering when a resource is reloaded. */\n void registerReloadWatcher (ReloadWatcher *u) { reloadWatchers.insert(u); }\n\n /** Unregister a callback for discovering when a resource is reloaded. */\n void unregisterReloadWatcher (ReloadWatcher *u) { reloadWatchers.erase(u); }\n\n /** Call all the reload watchers. This is called automatically so you\n * almost certainly don't need to call it yourself. */\n void callReloadWatchers (void) const;\n\n /** Is this resource to be unloaded if there is GPU memory pressure? There\n * are two kinds of memory, GPU memory (on the graphics card) and system\n * memory. Textures and meshes take up both kinds, everything else only takes\n * system memory. Therefore if there is GPU memory pressure, unloading a\n * collision mesh will not help.\n */\n virtual bool isGPUResource (void) const\n {\n return false;\n }\n\n /** Register yourself as a user.\n *\n * This stops the resource being unloaded while you're using it.\n * */\n void increment (void)\n {\n users++;\n if (disk_resource_verbose_incs)\n CVERB << \"++ \" << getName() << \" (now at \" << users << \")\" << std::endl;\n }\n\n /** Inform that you are no-longer using this resource. */\n void decrement (void);\n\n /** Update internal state from disk. The resource is never actually unloaded at any point. */\n void reload (void);\n\n /** Load from disk. */\n void load (void);\n\n /** Load from disk. */\n void loadForeground (void);\n\n /** Erase from memory, the only copy will be on disk. */\n void unload (void);\n\n /** Subclasses should register dependencies at load time. This also loads the dependencies. */\n void addDependency (const std::string &name)\n {\n APP_ASSERT(name != \"\");\n DiskResource *dep = disk_resource_get_or_make(name);\n addDependency(dep);\n }\n\n /** Subclasses should register dependencies at load time. This also loads the dependencies. */\n void addDependency (DiskResource *dep)\n {\n dependencies.push_back(dep);\n dep->increment();\n if (!dep->isLoaded())\n dep->load();\n }\n\n protected:\n\n /** Subclasses override to implement reloading. */\n virtual void reloadImpl (void) { unloadImpl(); loaded = false; loadImpl(); loaded = true; }\n\n /** Subclasses override to implement loading. */\n virtual void loadImpl (void) { }\n\n /** Subclasses override to implement unloading. */\n virtual void unloadImpl (void) { }\n\n private:\n\n /** The dependencies of this disk resource that must be loaded when it is. */\n DiskResources dependencies;\n\n /** Store loaded state. */\n bool loaded;\n\n /** Store number of users (like a reference counter). */\n int users;\n\n /** Type for storage of reload callbacks. */\n typedef std::set<ReloadWatcher*> ReloadWatcherSet;\n\n /** Storage for reload callbacks. */\n ReloadWatcherSet reloadWatchers;\n\n friend class Demand;\n friend class BackgroundLoader;\n};\n\n/** Allow writing a disk resource to a stream, printing its name. */\ninline std::ostream &operator << (std::ostream &o, const DiskResource &dr)\n{\n return o << dr.getName();\n}\n\n/** Allow writing a vector of disk resources to a stream, printing a list of their names. */\ninline std::ostream &operator << (std::ostream &o, const DiskResources &dr)\n{\n o << \"[\";\n for (unsigned i=0 ; i<dr.size() ; ++i) {\n o << (i == 0 ? \" \" : \", \") << (*dr[i]);\n }\n return o << (dr.size() == 0 ? \"]\" : \" ]\");\n}\n\n\n// Use this smart pointer to avoid mismatched increment/decrement calls.\ntemplate<class T> class DiskResourcePtr {\n T *dr;\n public:\n explicit DiskResourcePtr (T *dr = nullptr)\n : dr(dr)\n {\n if (dr != nullptr)\n dr->increment();\n }\n DiskResourcePtr (const DiskResourcePtr<T> &other)\n : dr(&*other)\n {\n if (dr != nullptr)\n dr->increment();\n }\n ~DiskResourcePtr (void)\n {\n if (dr != nullptr)\n dr->decrement();\n }\n T &operator* (void) const { return *dr; }\n T *operator-> (void) const { return dr; }\n\n DiskResourcePtr<T> &operator= (const DiskResourcePtr<T> &other)\n {\n return *this = &*other;\n }\n\n DiskResourcePtr<T> &operator= (T *other)\n {\n if (other == dr) return *this; // Optimisation\n if (other != nullptr)\n other->increment();\n if (dr != nullptr)\n dr->decrement();\n dr = other;\n return *this;\n }\n\n operator T *(void) const { return dr; }\n};\n\ntemplate<class T>\nbool operator== (const DiskResourcePtr<T> &a, const DiskResourcePtr<T> &b) { return &*a == &*b; }\ntemplate<class T>\nbool operator!= (const DiskResourcePtr<T> &a, const DiskResourcePtr<T> &b) { return !(a == b); }\n\n/** Create (if necessary load) the disk resource, and increment. */\ntemplate <class T> DiskResourcePtr<T> disk_resource_use (const std::string &name)\n{\n DiskResource *dr = disk_resource_get_or_make(name);\n if (dynamic_cast<T*>(dr) == nullptr)\n return DiskResourcePtr<T>();\n\n DiskResourcePtr<T> drp(static_cast<T*>(dr));\n if (!drp->isLoaded())\n drp->loadForeground();\n return drp;\n}\n\n\n#endif\n" }, { "alpha_fraction": 0.6483227610588074, "alphanum_fraction": 0.6558271050453186, "avg_line_length": 28.753816604614258, "blob_id": "f67e6fe04b51d4525e9dc2f5dba405bf29dadc38", "content_id": "ccc5d1e26c5844443e363062c0a7e5685536f5f9", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 15591, "license_type": "permissive", "max_line_length": 129, "num_lines": 524, "path": "/engine/audio/audio.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <AL/al.h>\n#include <AL/alc.h>\n\n#include <centralised_log.h>\n#include \"../vect_util.h\"\n#include \"../option.h\"\n\n#include \"audio.h\"\n#include \"audio_disk_resource.h\"\n\nALCdevice* alDevice;\nALCcontext* alContext;\n\nstatic AudioBoolOption option_keys_bool[] = {\n AUDIO_AUTOUPDATE,\n AUDIO_DOPPLER_ENABLED,\n AUDIO_MUTE\n};\n\nstatic AudioFloatOption option_keys_float[] = {\n AUDIO_MASTER_VOLUME\n};\n\nstatic AudioIntOption option_keys_int[] = {\n AUDIO_MAX_SOUNDS\n};\n\nstatic std::map<AudioBoolOption,bool> options_bool;\nstatic std::map<AudioIntOption,int> options_int;\nstatic std::map<AudioFloatOption,float> options_float;\nstatic std::map<AudioBoolOption,bool> new_options_bool;\nstatic std::map<AudioIntOption,int> new_options_int;\nstatic std::map<AudioFloatOption,float> new_options_float;\n\nstatic std::map<AudioBoolOption,ValidOption<bool>*> valid_option_bool;\nstatic std::map<AudioIntOption,ValidOption<int>*> valid_option_int;\nstatic std::map<AudioFloatOption,ValidOption<float>*> valid_option_float;\n\nstatic void valid_option (AudioBoolOption o, ValidOption<bool> *v) { valid_option_bool[o] = v; }\nstatic void valid_option (AudioIntOption o, ValidOption<int> *v) { valid_option_int[o] = v; }\nstatic void valid_option (AudioFloatOption o, ValidOption<float> *v) { valid_option_float[o] = v; }\n\nstatic bool truefalse_[] = { false, true };\nstatic ValidOptionList<bool,bool[2]> *truefalse = new ValidOptionList<bool,bool[2]>(truefalse_);\n\n\nstd::string audio_option_to_string (AudioBoolOption o)\n{\n switch (o) {\n case AUDIO_AUTOUPDATE: return \"AUTOUPDATE\";\n case AUDIO_DOPPLER_ENABLED: return \"DOPPLER_ENABLED\";\n case AUDIO_MUTE: return \"MUTE\";\n }\n return \"UNKNOWN_BOOL_OPTION\";\n}\nstd::string audio_option_to_string (AudioIntOption o)\n{\n switch (o) {\n case AUDIO_MAX_SOUNDS: return \"MAX_SOUNDS\";\n }\n return \"UNKNOWN_INT_OPTION\";\n}\nstd::string audio_option_to_string (AudioFloatOption o)\n{\n switch (o) {\n case AUDIO_MASTER_VOLUME: return \"MASTER_VOLUME\";\n }\n return \"UNKNOWN_FLOAT_OPTION\";\n}\n\nvoid audio_option_from_string (const std::string &s,\n int &t,\n AudioBoolOption &o0,\n AudioIntOption &o1,\n AudioFloatOption &o2)\n{\n if (s==\"AUTOUPDATE\") { t = 0; o0 = AUDIO_AUTOUPDATE; }\n\n else if (s==\"DOPPLER_ENABLED\") { t = 0 ; o0 = AUDIO_DOPPLER_ENABLED; }\n else if (s==\"MUTE\") { t = 0 ; o0 = AUDIO_MUTE; }\n\n else if (s==\"MAX_SOUNDS\") { t = 1 ; o1 = AUDIO_MAX_SOUNDS; }\n\n else if (s==\"MASTER_VOLUME\") { t = 2 ; o2 = AUDIO_MASTER_VOLUME; }\n\n else t = -1;\n}\n\nstatic void options_update (bool flush)\n{\n (void) flush;\n\n for (unsigned i=0 ; i<sizeof(option_keys_bool)/sizeof(*option_keys_bool) ; ++i) {\n AudioBoolOption o = option_keys_bool[i];\n bool v_old = options_bool[o];\n bool v_new = new_options_bool[o];\n if (v_old == v_new) continue;\n switch (o) {\n case AUDIO_AUTOUPDATE: break;\n case AUDIO_DOPPLER_ENABLED:\n case AUDIO_MUTE:\n break;\n }\n }\n for (unsigned i=0 ; i<sizeof(option_keys_int)/sizeof(*option_keys_int) ; ++i) {\n AudioIntOption o = option_keys_int[i];\n int v_old = options_int[o];\n int v_new = new_options_int[o];\n if (v_old == v_new) continue;\n switch (o) {\n case AUDIO_MAX_SOUNDS:\n break;\n }\n }\n for (unsigned i=0 ; i<sizeof(option_keys_float)/sizeof(*option_keys_float) ; ++i) {\n AudioFloatOption o = option_keys_float[i];\n float v_old = options_float[o];\n float v_new = new_options_float[o];\n if (v_old == v_new) continue;\n switch (o) {\n case AUDIO_MASTER_VOLUME:\n break;\n }\n }\n\n options_bool = new_options_bool;\n options_int = new_options_int;\n options_float = new_options_float;\n}\n\nvoid audio_option_reset (void)\n{\n audio_option(AUDIO_MUTE, false);\n audio_option(AUDIO_DOPPLER_ENABLED, true);\n\n audio_option(AUDIO_MAX_SOUNDS, 1000);\n\n audio_option(AUDIO_MASTER_VOLUME, 1.0f);\n}\n\nstatic void init_options (void)\n{\n for (unsigned i=0 ; i < sizeof(option_keys_bool) / sizeof(*option_keys_bool) ; ++i) {\n valid_option(option_keys_bool[i], truefalse);\n }\n\n valid_option(AUDIO_MAX_SOUNDS, new ValidOptionRange<int>(1,1000));\n valid_option(AUDIO_MASTER_VOLUME, new ValidOptionRange<float>(0, 2));\n\n audio_option(AUDIO_AUTOUPDATE, false);\n audio_option_reset();\n options_update(true);\n // This will call options_update(false) but it will be a no-op this time.\n audio_option(AUDIO_AUTOUPDATE, true);\n}\n\n\nvoid audio_option (AudioBoolOption o, bool v)\n{\n valid_option_bool[o]->maybeThrow(\"Audio\", v);\n new_options_bool[o] = v;\n if (new_options_bool[AUDIO_AUTOUPDATE]) options_update(false);\n}\nbool audio_option (AudioBoolOption o)\n{\n return options_bool[o];\n}\n\nvoid audio_option (AudioIntOption o, int v)\n{\n valid_option_int[o]->maybeThrow(\"Audio\", v);\n new_options_int[o] = v;\n if (new_options_bool[AUDIO_AUTOUPDATE]) options_update(false);\n}\nint audio_option (AudioIntOption o)\n{\n return options_int[o];\n}\n\nvoid audio_option (AudioFloatOption o, float v)\n{\n valid_option_float[o]->maybeThrow(\"Audio\", v);\n new_options_float[o] = v;\n if (new_options_bool[AUDIO_AUTOUPDATE]) options_update(false);\n}\nfloat audio_option (AudioFloatOption o)\n{\n return options_float[o];\n}\n\n\nvoid audio_init (const char *devname)\n{\n init_options();\n\n alDevice = alcOpenDevice(devname);\n\n if (!alDevice)\n {\n GRIT_EXCEPT(\"Couldn't initialize the OpenAL device.\");\n }\n\n alContext = alcCreateContext(alDevice, NULL);\n alcMakeContextCurrent(alContext);\n}\n\nvoid audio_shutdown()\n{\n alcCloseDevice(alDevice);\n}\n\nstruct OneShotSound {\n ALuint sound;\n DiskResourcePtr<AudioDiskResource> resource;\n OneShotSound(ALuint sound, const DiskResourcePtr<AudioDiskResource> &resource)\n : sound(sound), resource(resource)\n { }\n OneShotSound (void) : sound(0) { }\n};\n\nstatic std::vector<OneShotSound> one_shot_sounds;\n\nstatic ALuint audio_play_aux (const DiskResourcePtr<AudioDiskResource> &resource, ALuint buffer,\n float volume, float pitch, float ref_dist=0, float roll_off=0)\n{\n ALuint src;\n alGenSources(1, &src);\n alSourcei(src, AL_BUFFER, buffer);\n alSourcef(src, AL_GAIN, volume);\n alSourcef(src, AL_PITCH, pitch);\n alSourcef(src, AL_REFERENCE_DISTANCE, ref_dist);\n alSourcef(src, AL_ROLLOFF_FACTOR, roll_off);\n one_shot_sounds.emplace_back(src, resource);\n return src;\n}\n\nvoid audio_play_ambient (const std::string& filename, float volume, float pitch)\n{\n auto resource = disk_resource_use<AudioDiskResource>(filename);\n if (resource == nullptr) GRIT_EXCEPT(\"Not an audio resource: \\\"\"+filename+\"\\\"\");\n \n ALuint src = audio_play_aux(resource, resource->getALBufferAll(), volume, pitch);\n alSource3f(src, AL_POSITION, 0, 0, 0);\n alSourcei(src, AL_SOURCE_RELATIVE, AL_TRUE);\n alSourcePlay(src);\n \n}\n\nvoid audio_play (const std::string& filename, const Vector3& position, float volume, float ref_dist, float roll_off, float pitch)\n{\n auto resource = disk_resource_use<AudioDiskResource>(filename);\n if (resource == nullptr) GRIT_EXCEPT(\"Not an audio resource: \\\"\"+filename+\"\\\"\");\n \n Vector3 v;\n // put them in the same place for now -- openal doesn't really support this and there's not point in an uphill struggle\n ALuint src_l = audio_play_aux(resource, resource->getALBufferLeft(), volume, pitch, ref_dist, roll_off);\n v = position;\n alSource3f(src_l, AL_POSITION, v.x, v.y, v.z);\n alSourcePlay(src_l);\n ALuint src_r = audio_play_aux(resource, resource->getALBufferRight(), volume, pitch, ref_dist, roll_off);\n v = position;\n alSource3f(src_r, AL_POSITION, v.x, v.y, v.z);\n alSourcePlay(src_r);\n \n}\n\nvoid audio_update (const Vector3& position, const Vector3& velocity, const Quaternion& rotation)\n{\n ALfloat pos[] = { position.x, position.y, position.z };\n ALfloat vel[] = { velocity.x, velocity.y, velocity.z };\n ALfloat zeros[] = { 0.0f, 0.0f, 0.0f };\n\n Vector3 at = rotation * Vector3(0.0f, 1.0f, 0.0f);\n Vector3 up = rotation * Vector3(0.0f, 0.0f, 1.0f);\n\n ALfloat ori[] = { at.x, at.y, at.z, up.x, up.y, up.z };\n\n alcSuspendContext(alContext);\n alListenerfv(AL_POSITION, pos);\n alListenerfv(AL_VELOCITY, audio_option(AUDIO_DOPPLER_ENABLED) ? vel : zeros);\n alListenerfv(AL_ORIENTATION, ori);\n float volume = audio_option(AUDIO_MUTE) ? 0 : audio_option(AUDIO_MASTER_VOLUME);\n alListenerfv(AL_GAIN, &volume);\n alcProcessContext(alContext);\n\n // destroy any one-shot sounds that finished playing\n // NOTE: this won't account for cases where there's still a sound playing when the game exits\n\n for (unsigned i=0 ; i<one_shot_sounds.size() ; ++i) {\n OneShotSound &oss = one_shot_sounds[i];\n ALuint &src = oss.sound;\n\n ALint playing;\n alGetSourcei(src, AL_SOURCE_STATE, &playing);\n\n if (playing != AL_PLAYING) {\n\n alDeleteSources(1, &src);\n\n one_shot_sounds[i] = one_shot_sounds[one_shot_sounds.size()-1];\n one_shot_sounds.pop_back();\n i--; // re-examine index i again, next iteration\n\n }\n }\n}\n\nconst std::string AudioBody::className = \"GfxBody\";\n\nAudioBody::AudioBody (const std::string &filename, bool ambient)\n : resource(NULL),\n position(Vector3(0,0,0)),\n orientation(Quaternion(1,0,0,0)),\n separation(0.0f),\n velocity(Vector3(0,0,0)),\n looping(false),\n pitch(1.0f),\n volume(1.0f),\n ambient(ambient),\n referenceDistance(1),\n rollOff(1),\n destroyed(false)\n{\n resource = disk_resource_use<AudioDiskResource>(filename);\n if (resource == nullptr) {\n EXCEPT << \"Not an audio resource: \\\"\" << filename << \"\\\"\" << ENDL;\n }\n\n alGenSources(1, &alSourceLeft);\n alGenSources(1, &alSourceRight);\n\n reinitialise();\n\n resource->registerReloadWatcher(this);\n\n}\n\nAudioBody::~AudioBody (void)\n{\n if (!destroyed) destroy();\n}\n\nvoid AudioBody::notifyReloaded (const DiskResource *r)\n{\n (void) r;\n bool was_playing = playing();\n if (was_playing) stop();\n reinitialise();\n if (was_playing) play();\n}\n\nvoid AudioBody::reinitialise (void)\n{\n if (destroyed) THROW_DEAD(className);\n alSourcei(alSourceLeft, AL_BUFFER, AL_NONE);\n alSourcei(alSourceRight, AL_BUFFER, AL_NONE);\n\n if (!resource->isLoaded()) {\n CERR << \"Cannot create an AudioBody for an unloaded audio resource: \"\n << resource->getName() << std::endl;\n return;\n }\n\n if (ambient) {\n // will be mono or stereo, whatever the wav file was\n alSourcei(alSourceLeft, AL_BUFFER, resource->getALBufferAll());\n } else {\n // get the two channels separate for two separate sources\n alSourcei(alSourceLeft, AL_BUFFER, resource->getALBufferLeft());\n if (resource->getStereo()) {\n alSourcei(alSourceRight, AL_BUFFER, resource->getALBufferLeft());\n }\n }\n}\n\nvoid AudioBody::updatePositions (void)\n{\n if (destroyed) THROW_DEAD(className);\n if (ambient) return;\n // put them on top of each other if not stereo\n float off = resource->getStereo() ? separation/2 : 0;\n\n Vector3 v_l = position + orientation * Vector3(-off,0,0);\n Vector3 v_r = position + orientation * Vector3( off,0,0);\n alSource3f(alSourceLeft, AL_POSITION, v_l.x, v_l.y, v_l.z);\n alSource3f(alSourceRight, AL_POSITION, v_r.x, v_r.y, v_r.z);\n}\n\nvoid AudioBody::destroy (void)\n{\n if (destroyed) THROW_DEAD(className);\n destroyed = true;\n resource->unregisterReloadWatcher(this);\n alDeleteSources(1, &alSourceLeft);\n alDeleteSources(1, &alSourceRight);\n resource = nullptr;\n}\n\nvoid AudioBody::setPosition (const Vector3& v)\n{\n if (destroyed) THROW_DEAD(className);\n if (ambient) return;\n position = v;\n updatePositions();\n}\n\nvoid AudioBody::setOrientation (const Quaternion& v)\n{\n if (destroyed) THROW_DEAD(className);\n if (ambient) return;\n orientation = v;\n updatePositions();\n}\n\nvoid AudioBody::setSeparation (float v)\n{\n if (destroyed) THROW_DEAD(className);\n if (ambient) return;\n separation = v;\n updatePositions();\n}\n\nvoid AudioBody::setVelocity (const Vector3& v)\n{\n if (destroyed) THROW_DEAD(className);\n if (ambient) return;\n velocity = v;\n alSource3f(alSourceLeft, AL_VELOCITY, v.x, v.y, v.z);\n alSource3f(alSourceRight, AL_VELOCITY, v.x, v.y, v.z);\n}\n\nvoid AudioBody::setLooping (bool v)\n{\n if (destroyed) THROW_DEAD(className);\n looping = v;\n alSourcei(alSourceLeft, AL_LOOPING, v);\n alSourcei(alSourceRight, AL_LOOPING, v);\n}\n\nvoid AudioBody::setVolume (float v)\n{\n if (destroyed) THROW_DEAD(className);\n volume = v;\n alSourcef(alSourceLeft, AL_GAIN, v);\n alSourcef(alSourceRight, AL_GAIN, v);\n}\n\nvoid AudioBody::setPitch (float v)\n{\n if (destroyed) THROW_DEAD(className);\n pitch = v;\n alSourcef(alSourceLeft, AL_PITCH, v);\n alSourcef(alSourceRight, AL_PITCH, v);\n}\n\nvoid AudioBody::setReferenceDistance (float v)\n{\n if (destroyed) THROW_DEAD(className);\n if (ambient) return;\n referenceDistance = v;\n alSourcef(alSourceLeft, AL_REFERENCE_DISTANCE, v);\n alSourcef(alSourceRight, AL_REFERENCE_DISTANCE, v);\n}\n\nvoid AudioBody::setRollOff (float v)\n{\n if (destroyed) THROW_DEAD(className);\n if (ambient) return;\n rollOff = v;\n alSourcef(alSourceLeft, AL_ROLLOFF_FACTOR, v);\n alSourcef(alSourceRight, AL_ROLLOFF_FACTOR, v);\n}\n\nbool AudioBody::playing (void)\n{\n if (destroyed) THROW_DEAD(className);\n ALint value;\n // just query left source, right one may not have a buffer\n alGetSourcei(alSourceLeft, AL_SOURCE_STATE, &value);\n return (value == AL_PLAYING);\n}\n\nvoid AudioBody::play (void)\n{\n if (destroyed) THROW_DEAD(className);\n alSourcePlay(alSourceLeft);\n alSourcePlay(alSourceRight);\n}\n\nvoid AudioBody::pause (void)\n{\n if (destroyed) THROW_DEAD(className);\n // presumably does nothing if the track is not playing\n alSourcePause(alSourceLeft);\n alSourcePause(alSourceRight);\n}\n\nvoid AudioBody::stop (void)\n{\n if (destroyed) THROW_DEAD(className);\n alSourceStop(alSourceLeft);\n alSourceStop(alSourceRight);\n}\n" }, { "alpha_fraction": 0.6349831819534302, "alphanum_fraction": 0.6389253735542297, "avg_line_length": 28.140424728393555, "blob_id": "640ac5818c421838d01d433ecc91e3dc82aee2f0", "content_id": "73915a2f660b5f7eec355095e6c73f5cfd74e631", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 6849, "license_type": "permissive", "max_line_length": 92, "num_lines": 235, "path": "/engine/gfx/gfx_sky_body.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include \"gfx_internal.h\"\n#include \"gfx_sky_body.h\"\n#include \"gfx_sky_material.h\"\n#include \"gfx_pipeline.h\"\n\nfast_erase_vector<GfxSkyBody*> gfx_all_sky_bodies;\n\nconst std::string GfxSkyBody::className = \"GfxSkyBody\";\n\nstatic void validate_sky_mesh (const Ogre::MeshPtr &mesh)\n{\n mesh->load();\n for (unsigned i=0 ; i<mesh->getNumSubMeshes() ; ++i) {\n Ogre::SubMesh *sm = mesh->getSubMesh(i);\n std::string matname = sm->getMaterialName();\n if (!gfx_sky_material_has(matname)) {\n CERR << \"Mesh \\\"/\"<<mesh->getName()<<\"\\\" references non-existing material \"\n << \"\\\"\"<<matname<<\"\\\"\"<<std::endl;\n matname = \"/system/FallbackMaterial\";\n sm->setMaterialName(matname);\n }\n }\n}\n\n\nGfxSkyBody::GfxSkyBody (const DiskResourcePtr<GfxMeshDiskResource> &gdr, short z_order)\n : dead(false),\n enabled(true),\n zOrder(z_order),\n orientation(1,0,0,0),\n gdr(gdr)\n{\n const Ogre::MeshPtr &rp = gdr->getOgreMeshPtr();\n\n mesh = rp;\n\n reinitialise();\n\n gfx_all_sky_bodies.push_back(this);\n}\n\nvoid GfxSkyBody::reinitialise()\n{\n // must set materials here!\n validate_sky_mesh(mesh);\n materials = std::vector<GfxSkyMaterial*>(mesh->getNumSubMeshes());\n for (unsigned i=0 ; i<mesh->getNumSubMeshes() ; ++i) {\n Ogre::SubMesh *sm = mesh->getSubMesh(i);\n std::string matname = sm->getMaterialName();\n materials[i] = gfx_sky_material_get(matname);\n }\n}\n\nGfxSkyBody::~GfxSkyBody (void)\n{\n if (!dead) destroy();\n}\n\nvoid GfxSkyBody::destroy (void)\n{\n dead = true;\n gfx_all_sky_bodies.erase(this);\n}\n\nGfxSkyBodyPtr GfxSkyBody::make (const std::string &mesh_name, short z_order)\n{\n auto gdr = disk_resource_use<GfxMeshDiskResource>(mesh_name);\n if (gdr == nullptr) GRIT_EXCEPT(\"Resource is not a mesh: \\\"\" + mesh_name + \"\\\"\");\n return GfxSkyBodyPtr(new GfxSkyBody(gdr, z_order));\n}\n\nQuaternion GfxSkyBody::getOrientation (void)\n{\n if (dead) THROW_DEAD(className);\n return orientation;\n}\nvoid GfxSkyBody::setOrientation (const Quaternion &q)\n{\n if (dead) THROW_DEAD(className);\n orientation = q;\n}\n\nunsigned char GfxSkyBody::getZOrder (void)\n{\n if (dead) THROW_DEAD(className);\n return zOrder;\n}\nvoid GfxSkyBody::setZOrder (unsigned char v)\n{\n if (dead) THROW_DEAD(className);\n zOrder = v;\n}\n\nbool GfxSkyBody::isEnabled (void)\n{\n if (dead) THROW_DEAD(className);\n return enabled;\n}\n\nvoid GfxSkyBody::setEnabled (bool v)\n{\n if (dead) THROW_DEAD(className);\n enabled = v;\n}\n\nGfxSkyMaterial *GfxSkyBody::getMaterial (unsigned i)\n{\n if (i >= materials.size()) GRIT_EXCEPT(\"Submesh id out of range. \");\n return materials[i];\n}\n\nunsigned GfxSkyBody::getSubMeshByOriginalMaterialName (const std::string &n)\n{\n for (unsigned i=0 ; i<mesh->getNumSubMeshes() ; ++i) {\n Ogre::SubMesh *sm = mesh->getSubMesh(i);\n if (sm->getMaterialName() == n) {\n return i;\n }\n }\n CERR << \"Mesh did not contain material \\\"\"<<n<<\"\\\"\" <<std::endl;\n return 0;\n}\n\nvoid GfxSkyBody::setMaterial (unsigned i, GfxSkyMaterial *m)\n{\n if (i >= materials.size()) GRIT_EXCEPT(\"Submesh id out of range. \");\n if (materials[i] == m) return;\n materials[i] = m;\n}\n\n\n\nvoid GfxSkyBody::render (const GfxShaderGlobals &g)\n{\n if (!enabled) return;\n\n Ogre::Matrix3 rot;\n to_ogre(orientation).ToRotationMatrix(rot);\n\n Ogre::Matrix4 world(rot);\n\n\n\n // this is to protect the material to texture mappings which might be\n // concurrently read by the background loading thread\n // TODO: use a RW lock to avoid stalls\n GFX_MAT_SYNC;\n\n // iterate through the materials\n for (unsigned i=0 ; i<materials.size() ; ++i) {\n\n GfxSkyMaterial *mat = materials[i];\n Ogre::SubMesh *sm = mesh->getSubMesh(i);\n\n // render sm using mat\n \n const GfxTextureStateMap &mat_texs = mat->getTextures();\n mat->getShader()->bindShader(GFX_GSL_PURPOSE_SKY, false, false, 0,\n g, world, nullptr, 0, 1, mat_texs, mat->getBindings());\n\n ogre_rs->_setCullingMode(Ogre::CULL_NONE);\n // read but don't write depth buffer\n ogre_rs->_setDepthBufferParams(true, false, Ogre::CMPF_LESS_EQUAL);\n switch (mat->getSceneBlend()) {\n case GFX_SKY_MATERIAL_OPAQUE:\n ogre_rs->_setSceneBlending(Ogre::SBF_ONE, Ogre::SBF_ZERO);\n break;\n case GFX_SKY_MATERIAL_ALPHA:\n ogre_rs->_setSceneBlending(Ogre::SBF_ONE, Ogre::SBF_ONE_MINUS_SOURCE_ALPHA);\n break;\n case GFX_SKY_MATERIAL_ADD:\n ogre_rs->_setSceneBlending(Ogre::SBF_ONE, Ogre::SBF_ONE);\n break;\n }\n\n ogre_rs->_setPolygonMode(Ogre::PM_SOLID);\n ogre_rs->setStencilCheckEnabled(false);\n ogre_rs->_setDepthBias(0, 0);\n\n Ogre::RenderOperation op; \n sm->_getRenderOperation(op);\n ogre_rs->_render(op);\n\n for (unsigned i=0 ; i<mat_texs.size() ; ++i) {\n ogre_rs->_disableTextureUnit(i);\n }\n\n }\n}\n\nstatic bool sky_body_compare (GfxSkyBody *a, GfxSkyBody *b)\n{\n // furthest particle first\n return a->getZOrder() > b->getZOrder();\n}\n\n\n// called every frame\nvoid gfx_sky_render (GfxPipeline *p)\n{\n GfxShaderGlobals g = gfx_shader_globals_cam(p);\n g.view.setTrans(Ogre::Vector3(0,0,0)); \n\n // sort by z order into separate container\n std::vector<GfxSkyBody*> sorted;\n for (unsigned i=0 ; i<gfx_all_sky_bodies.size() ; ++i) {\n sorted.push_back(gfx_all_sky_bodies[i]);\n }\n std::sort(sorted.begin(), sorted.end(), sky_body_compare);\n\n for (unsigned i=0 ; i<sorted.size() ; ++i) {\n sorted[i]->render(g);\n }\n}\n\n" }, { "alpha_fraction": 0.6272522807121277, "alphanum_fraction": 0.6272522807121277, "avg_line_length": 39.3636360168457, "blob_id": "2de58460bce243e9b92b628ca4e2f746d21c1543", "content_id": "19f132a3c63de66c6d3128bbf7a5da1155f29639", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 888, "license_type": "permissive", "max_line_length": 86, "num_lines": 22, "path": "/dependencies/quex-0.34.1/quex/code_base/template/token_receiving_via_singleton.i", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "// -*- C++ -*- vim: set syntax=cpp:\n\nnamespace quex { \n inline QUEX_TOKEN_ID_TYPE\n CLASS::get_token() \n {\n // The framework / constructor **should** ensure that at this point the two\n // pointers are identical. Since this function is called very often the\n // assignment of safety (prev=current) is not done. Instead, we only check\n // (as long as NDEBUG is not defined) that the framework assigns the variables\n // propperly.\n# if ! defined(QUEX_OPTION_AUTOMATIC_ANALYSIS_CONTINUATION_ON_MODE_CHANGE)\n return QuexAnalyser::current_analyser_function(this);\n# else\n QUEX_TOKEN_ID_TYPE token_id = __QUEX_TOKEN_ID_TERMINATION;\n do {\n token_id = QuexAnalyser::current_analyser_function(this);\n } while( token_id == __QUEX_TOKEN_ID_UNINITIALIZED );\n return token_id;\n# endif\n }\n}\n" }, { "alpha_fraction": 0.5984868407249451, "alphanum_fraction": 0.6005982160568237, "avg_line_length": 47.98706817626953, "blob_id": "08b2b38c6b61c790fb9daaa2539099163ae31ec8", "content_id": "04276cc744a20d1d8c01e5139366d0a25856f8be", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 11367, "license_type": "permissive", "max_line_length": 109, "num_lines": 232, "path": "/dependencies/quex-0.34.1/quex/core_engine/state_machine/state_core_info.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "\nStateOriginInfo_POST_CONDITION_END = 1\nStateOriginInfo_NON_ACCEPTANCE = 2\nStateOriginInfo_ACCEPTANCE = 3\nStateOriginInfo_POST_CONDITIONED_ACCEPTANCE = 4\nStateOriginInfo_PRE_CONDITIONEND_ACCEPTANCE = 5\nStateOriginInfo_ERROR = -1\n\nclass StateCoreInfo:\n \"\"\"-- store input position: if an origin is flagged that way it \n imposes that the input position is to be stored.\n\n -- post conditioned acceptance: \n indicates that the original pattern was a 'post-conditioned'\n pattern. It follows:\n\n -- if store input position is required, then it has to be \n stored in a dedicated variable, because, multiple \n patterns may be post conditioned and only the one (if one)\n succeeds, has to store set the input position to the position\n where the first post conditioned acceptance occured.\n\n -- if store input position is not required, this implies that\n the original state was the 'final acceptance' state, i.e.\n the end of the post condition. no input position is to be\n stored in this case, because the position of the first\n success is to be restored.\n\n -- pre condition id:\n id of the state machine that constitutes the pre-condition. \n if not pre-condition is set it is -1L. \n\n -- pseudo ambiguous post condition id:\n id of the state machine that constitutes the state machine \n that is used to go backwards to search the end of the core\n condition.\n In the large majority of cases, where there is no pseudo \n ambiguous post condition (e.g. x*/x), it is set it is -1L. \n \"\"\" \n def __init__(self, StateMachineID, StateIndex, AcceptanceF, StoreInputPositionF=False, \n PostContextID=-1L, PreContext_StateMachineID=-1L,\n PreContext_BeginOfLineF=False,\n PseudoAmbiguousPostConditionID=-1L):\n assert type(StateIndex) == long\n assert type(StateMachineID) == long\n\n self.state_machine_id = StateMachineID\n self.state_index = StateIndex\n # is a acceptance state?\n self.__acceptance_f = AcceptanceF \n\n # Input position of the current input stream is to be stored in \n # the following cases: \n #\n # -- 'normal acceptance state', i.e. not the acceptance state of a post condition.\n # -- 'ex acceptance state', i.e. states that were acceptance states of state machines\n # that have a post condition. \n #\n # NOTE: By default, the function 'set_acceptance(True)' and 'set_acceptance(False)'\n # of class State sets the 'store_input_position_f' to True, respectively\n # false, because this is the normal case. When a post condition is to be appended\n # the 'store_input_position_f' is to be stored manually - see the function\n # 'state_machine.post_context_append.do(...).\n self.__store_input_position_f = StoreInputPositionF\n\n # -- was the origin a post-conditioned acceptance?\n # (then we have to store the input position, store the original state machine\n # as winner, but continue)\n self.__post_context_id = PostContextID\n\n # -- was the origin a pre-conditioned acceptance?\n # (then one has to check at the end if the pre-condition holds)\n self.__pre_context_id = PreContext_StateMachineID \n #\n # -- trivial pre-condition: begin of line\n self.__pre_context_begin_of_line_f = PreContext_BeginOfLineF\n\n # -- id of state machine that is used to go backwards from the end\n # of a post condition that is pseudo-ambiguous. \n self.__pseudo_ambiguous_post_context_id = PseudoAmbiguousPostConditionID\n\n def merge(self, Other):\n # It **does** make any sense to merge to state cores from different\n # state machines. This should not be an 'assert'. In the final state machine\n # more than one state machine is combined in parallel and then they belong \n # to the same state machine\n # if self.state_machine_id != Other.state_machine_id: return\n\n if Other.__acceptance_f: self.__acceptance_f = True\n if Other.__store_input_position_f: self.__store_input_position_f = True \n if Other.__pre_context_begin_of_line_f: self.__pre_context_begin_of_line_f = True \n\n if Other.__pre_context_id != -1L: self.__pre_context_id = Other.__pre_context_id \n if Other.__post_context_id != -1L: self.__post_context_id = Other.__post_context_id\n\n if Other.__pseudo_ambiguous_post_context_id != -1L: \n self.__pseudo_ambiguous_post_context_id = Other.__pseudo_ambiguous_post_context_id\n\n def is_acceptance(self):\n return self.__acceptance_f\n\n def set_acceptance_f(self, Value, LeaveStoreInputPositionF):\n \"\"\"NOTE: By default, when a state is set to acceptance the input\n position is to be stored for all related origins, if this is \n not desired (as by 'post_context_append.do(..)' the flag\n 'store_input_position_f' is to be adpated manually using the\n function 'set_store_input_position_f'\n \"\"\" \n assert type(Value) == bool\n self.__acceptance_f = Value\n # default: store_input_position_f follows acceptance_f\n if not LeaveStoreInputPositionF: self.set_store_input_position_f(Value)\n \n def set_store_input_position_f(self, Value=True):\n assert type(Value) == bool\n self.__store_input_position_f = Value\n\n def set_pre_context_id(self, Value=True):\n assert type(Value) == long\n self.__pre_context_id = Value\n\n def set_pre_context_begin_of_line_f(self, Value=True):\n assert type(Value) == bool\n self.__pre_context_begin_of_line_f = Value\n\n def set_post_context_id(self, Value):\n assert type(Value) == long\n self.__post_context_id = Value\n\n def set_post_context_backward_detector_sm_id(self, Value):\n assert type(Value) == long\n self.__pseudo_ambiguous_post_context_id = Value\n\n def pre_context_id(self):\n return self.__pre_context_id \n\n def post_context_id(self):\n return self.__post_context_id \n\n def pre_context_begin_of_line_f(self):\n return self.__pre_context_begin_of_line_f\n\n def store_input_position_f(self):\n return self.__store_input_position_f \n\n def pseudo_ambiguous_post_context_id(self):\n return self.__pseudo_ambiguous_post_context_id\n\n def is_end_of_post_contexted_core_pattern(self):\n return self.post_context_id() != -1L and self.store_input_position_f()\n \n def type(self):\n Acc = self.is_acceptance()\n Store = self.store_input_position_f()\n Post = self.post_context_id()\n Pre = self.pre_context_id() \n if Acc and Store and not Post and not Pre: return StateOriginInfo_ACCEPTANCE\n if not Acc and not Store and not Post and not Pre: return StateOriginInfo_NON_ACCEPTANCE\n if Acc and Store and Post and not Pre: return StateOriginInfo_POST_CONDITIONED_ACCEPTANCE\n if Acc and not Store and Post and not Pre: return StateOriginInfo_POST_CONDITION_END \n if Acc and Store and not Post and Pre: return StateOriginInfo_PRE_CONDITIONEND_ACCEPTANCE\n # the constitution of the state origin is not valid --> return error\n return StateOriginInfo_ERROR \n\n def __cmp__(self, Other):\n if self.is_acceptance() == True and Other.is_acceptance() == False: return -1\n if self.is_acceptance() == False and Other.is_acceptance() == True: return 1\n\n # NOTE: The state machine ID directly corresponds to the 'position in the list'\n # where the pattern was specified. Low ID == early specification.\n return cmp(self.state_machine_id, Other.state_machine_id)\n \n def __eq__(self, other):\n \"\"\"Two origins are the same if they origin from the same state machine and \n have the same state index. If they then differ in the 'store_input_position_f'\n there is a major error. It would mean that one StateOriginInfo states about the\n same original state something different than another StateOriginInfo.\n \"\"\"\n result = self.state_machine_id == other.state_machine_id and \\\n self.state_index == other.state_index \n\n if result == True: \n assert self.__store_input_position_f == other.__store_input_position_f, \\\n \"Two StateOriginInfo objects report about the same state different\\n\" \\\n \"information about the input being stored or not.\\n\" \\\n \"state machine id = \" + repr(self.state_machine_id) + \"\\n\" + \\\n \"state index = \" + repr(self.state_index)\n assert self.__pre_context_id == other.__pre_context_id, \\\n \"Two StateOriginInfo objects report about the same state different\\n\" \\\n \"information about the pre-conditioned acceptance.\\n\" \\\n \"state machine id = \" + repr(self.state_machine_id) + \"\\n\" + \\\n \"state index = \" + repr(self.state_index)\n assert self.__post_context_id == other.__post_context_id, \\\n \"Two StateOriginInfo objects report about the same state different\\n\" \\\n \"information about the post-conditioned acceptance.\\n\" \\\n \"state machine id = \" + repr(self.state_machine_id) + \"\\n\" + \\\n \"state index = \" + repr(self.state_index)\n\n return result \n\n def __repr__(self):\n return self.get_string()\n\n def get_string(self, StateMachineAndStateInfoF=True):\n appendix = \"\"\n\n # ONLY FOR TEST: state.core\n if False and not StateMachineAndStateInfoF:\n if self.__acceptance_f: return \"*\"\n else: return \"\"\n\n if StateMachineAndStateInfoF:\n if self.state_machine_id != -1L:\n appendix += \", \" + repr(self.state_machine_id).replace(\"L\", \"\")\n if self.state_index != -1L:\n appendix += \", \" + repr(self.state_index).replace(\"L\", \"\")\n if self.__acceptance_f: \n appendix += \", A\"\n if self.__store_input_position_f: \n appendix += \", S\"\n if self.__post_context_id != -1L: # post context id determined 'register' where input position\n # # stored\n appendix += \", P\" + repr(self.__post_context_id).replace(\"L\", \"\")\n if self.__pre_context_id != -1L: \n appendix += \", pre=\" + repr(self.__pre_context_id).replace(\"L\", \"\")\n if self.__pseudo_ambiguous_post_context_id != -1L: \n appendix += \", papc=\" + repr(self.__pseudo_ambiguous_post_context_id).replace(\"L\", \"\")\n if self.__pre_context_begin_of_line_f:\n appendix += \", bol\"\n if len(appendix) > 2: \n appendix = appendix[2:]\n\n return \"(%s)\" % appendix\n\n" }, { "alpha_fraction": 0.5620370507240295, "alphanum_fraction": 0.5916666388511658, "avg_line_length": 29.828571319580078, "blob_id": "52dd975b589a7aa2b20394fcce65f770f77271a2", "content_id": "15707819840f56de26075f2fc523649e51c59f29", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Shell", "length_bytes": 1080, "license_type": "permissive", "max_line_length": 51, "num_lines": 35, "path": "/dependencies/quex-0.34.1/demo/004/benchmark/run.sh", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "stamp=`date +%Yy%mm%dd-%Hh%M`\nif [[ $1 != \"HWUT-TEST\" ]]; then\n output=\"result-$stamp.dat\"\nelse\n output=\"tmp.dat\"\n rm -f tmp.dat\n cd ..\n make clean >& /dev/null; \n make lexer OPTIMIZATION=' ' >& /dev/null\n cd benchmark\n ../lexer linux-2.6.22.17-kernel-dir.c > $output\n make clean >& /dev/null; \n exit\nfi\ncd ..\nmake clean; make OPTIMIZATION='-O3' >& /dev/null\ncd benchmark\n../lexer-lc many-tiny-tokens.c > $output\n../lexer-lc single-large-token.c >> $output\n../lexer-lc linux-2.6.22.17-kernel-dir.c >> $output\n\n../lexer many-tiny-tokens.c >> $output\n../lexer single-large-token.c >> $output\n../lexer linux-2.6.22.17-kernel-dir.c >> $output\n\ncd ..\nmake clean; make OPTIMIZATION='-Os' >& /dev/null\ncd benchmark\n../lexer-lc many-tiny-tokens.c >> $output\n../lexer-lc single-large-token.c >> $output\n../lexer-lc linux-2.6.22.17-kernel-dir.c >> $output\n\n../lexer many-tiny-tokens.c >> $output\n../lexer single-large-token.c >> $output\n../lexer linux-2.6.22.17-kernel-dir.c >> $output\n\n" }, { "alpha_fraction": 0.6410595774650574, "alphanum_fraction": 0.6437085866928101, "avg_line_length": 21.205883026123047, "blob_id": "506f4c3d1a2dffb8e9c29469eac4d6b615f1e07f", "content_id": "802a8d11821712c54cd0df2fa6eabbb7716f681b", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "reStructuredText", "length_bytes": 755, "license_type": "permissive", "max_line_length": 78, "num_lines": 34, "path": "/engine/doc/grit_book/README.rst", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "Grit Book\n=========\n\nThis folder contains the sources of the `Grit Book\n<http://www.gritengine.com/grit_book/>`_.\n\nDependencies\n------------\n\nYou must install the following dependencies to build the Grit Book:\n\n- `HTMLDOC <https://www.msweet.org/projects.php?Z1>`_\n\n- `Markdown <http://daringfireball.net/projects/markdown/>`_\n\n- `Python 2.x <https://www.python.org/downloads/>`_ and the following Python\n libraries:\n\n - `lxml <http://lxml.de/>`_\n\n - `Pygments <http://pygments.org/>`_\n\n\nBuilding the Grit Book\n----------------------\n\nTo build the Grit Book, run::\n\n ./generate_doc.sh\n\nThe book is generated inside :code:`html/`. You can open\n:code:`html/index.html` in a web browser to read the book::\n\n xdg-open html/index.html\n" }, { "alpha_fraction": 0.7385044097900391, "alphanum_fraction": 0.740362286567688, "avg_line_length": 33.725807189941406, "blob_id": "b5db7283435ee7948696d808e58c42264f693da4", "content_id": "587d9f6f9f91154d3d8ac3fc29320094ae7576b5", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 2153, "license_type": "permissive", "max_line_length": 80, "num_lines": 62, "path": "/engine/gfx/gfx_fertile_node.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include \"../shared_ptr.h\"\n\nclass GfxFertileNode;\ntypedef SharedPtr<GfxFertileNode> GfxNodePtr;\n\n#ifndef GfxNode_h\n#define GfxNode_h\n\n#include \"gfx_node.h\"\n\n/** A node can be a leaf, or a parent. */\nclass GfxFertileNode : public GfxNode {\n protected:\n static const std::string className;\n std::vector<GfxNode*> children; // caution!\n\n GfxFertileNode (const GfxNodePtr &par_);\n ~GfxFertileNode ();\n\n public:\n static GfxNodePtr make (const GfxNodePtr &par_=GfxNodePtr(NULL))\n { return GfxNodePtr(new GfxFertileNode(par_)); }\n\n void notifyLostChild (GfxNode *child);\n void notifyGainedChild (GfxNode *child);\n virtual void setParent (const GfxNodePtr &par_);\n\n virtual unsigned getBatchesWithChildren (void) const;\n\n virtual unsigned getTrianglesWithChildren (void) const;\n\n virtual unsigned getVertexesWithChildren (void) const;\n\n virtual void destroy (void);\n\n virtual bool hasGraphics (void) const { return false; }\n\n friend class SharedPtr<GfxFertileNode>;\n};\n\n#endif\n" }, { "alpha_fraction": 0.5669041275978088, "alphanum_fraction": 0.5699360966682434, "avg_line_length": 55.3271598815918, "blob_id": "70945a54179d4acce5ba359d000bb5c69140929b", "content_id": "88273432f4eeca849fb1f76787202fa8109a3191", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 27375, "license_type": "permissive", "max_line_length": 124, "num_lines": 486, "path": "/dependencies/quex-0.34.1/quex/code_base/buffer/iconv/BufferFiller_IConv.i", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* -*- C++ -*- vim: set syntax=cpp:\n * (C) 2007-2008 Frank-Rene Schaefer */\n#ifndef __INCLUDE_GUARD__QUEX_BUFFER_INPUT_STRATEGY_ICONV_I__\n#define __INCLUDE_GUARD__QUEX_BUFFER_INPUT_STRATEGY_ICONV_I_\n\n#include <quex/code_base/buffer/BufferFiller>\n#include <quex/code_base/buffer/iconv/BufferFiller_IConv>\n#include <quex/code_base/buffer/InputPolicy>\n#include <quex/code_base/MemoryManager>\n#include <quex/code_base/compatibility/iconv-argument-types.h>\n\n\n#ifdef QUEX_OPTION_ASSERTS\n# define QUEX_ASSERT_BUFFER_INFO(BI) \\\n __quex_assert( BI != 0x0 ); \\\n __quex_assert((BI)->base.iterator >= (BI)->base.begin); \\\n __quex_assert((BI)->fill_level_n <= (BI)->base.size); \\\n __quex_assert((size_t)((BI)->base.iterator - (BI)->base.begin) <= (BI)->base.size); \\\n __quex_assert((BI)->base.bytes_left_n <= (BI)->base.size); \\\n __quex_assert((BI)->base.bytes_left_n <= (BI)->fill_level_n); \\\n __quex_assert( (size_t)((BI)->base.iterator - (BI)->base.begin) \\\n == (size_t)((BI)->fill_level_n - (BI)->base.bytes_left_n));\n\n# define QUEX_ASSERT_BUFFER_INFO_EASY(BI) \\\n __quex_assert( BI != 0x0 ); \\\n __quex_assert((BI)->iterator >= (BI)->begin); \\\n __quex_assert((size_t)((BI)->iterator - (BI)->begin) <= (BI)->size); \\\n __quex_assert((BI)->bytes_left_n <= (BI)->size); \n#else\n# define QUEX_ASSERT_BUFFER_INFO(BI) /* empty */\n# define QUEX_ASSERT_BUFFER_INFO_EASY(BI) /* empty */\n#endif\n\n#if ! defined (__QUEX_SETTING_PLAIN_C)\n extern \"C\" { \n# include <iconv.h>\n }\n# include <quex/code_base/compatibility/iconv-argument-types.h>\n# include <cerrno>\n# else\n# include <errno.h>\n#endif\n\n#include <quex/code_base/temporary_macros_on>\n\n#if ! defined (__QUEX_SETTING_PLAIN_C)\nnamespace quex {\n#endif\n TEMPLATE_IN(InputHandleT) size_t __QuexBufferFiller_IConv_tell_character_index(QuexBufferFiller* alter_ego);\n TEMPLATE_IN(InputHandleT) void __QuexBufferFiller_IConv_seek_character_index(QuexBufferFiller* alter_ego, \n const size_t CharacterIndex); \n TEMPLATE_IN(InputHandleT) size_t __QuexBufferFiller_IConv_read_characters(QuexBufferFiller* alter_ego,\n QUEX_CHARACTER_TYPE* start_of_buffer, \n const size_t N);\n TEMPLATE_IN(InputHandleT) void __QuexBufferFiller_IConv_destroy(QuexBufferFiller* alter_ego);\n\n QUEX_INLINE bool QuexBufferFiller_IConv_has_coding_dynamic_character_width(const char* Coding);\n\n QUEX_INLINE void QuexBufferFiller_IConv_BufferInfo_init(QuexBufferFiller_IConv_BufferInfo* me, \n uint8_t* Begin, size_t SizeInBytes);\n\n TEMPLATE_IN(InputHandleT) size_t __QuexBufferFiller_IConv_read_characters(QuexBufferFiller* alter_ego,\n QUEX_CHARACTER_TYPE* user_memory_p, \n const size_t N);\n\n TEMPLATE_IN(InputHandleT) void __QuexBufferFiller_IConv_fill_raw_buffer(TEMPLATED(QuexBufferFiller_IConv)*);\n\n TEMPLATE_IN(InputHandleT) bool __QuexBufferFiller_IConv_convert(TEMPLATED(QuexBufferFiller_IConv)* me, \n QuexBufferFiller_IConv_BufferInfo* drain);\n\n TEMPLATE_IN(InputHandleT) void __QuexBufferFiller_IConv_step_forward_n_characters(TEMPLATED(QuexBufferFiller_IConv)* me,\n const size_t ForwardN);\n\n TEMPLATE_IN(InputHandleT) void __QuexBufferFiller_IConv_mark_start_position(TEMPLATED(QuexBufferFiller_IConv)* me);\n\n TEMPLATE_IN(InputHandleT) void\n QuexBufferFiller_IConv_init(TEMPLATED(QuexBufferFiller_IConv)* me,\n InputHandleT* input_handle, \n const char* FromCoding, const char* ToCoding,\n size_t RawBufferSize)\n { \n const char* to_coding = ToCoding != 0x0 ? ToCoding : QUEX_SETTING_CORE_ENGINE_DEFAULT_CHARACTER_CODING;\n\n __quex_assert(RawBufferSize >= 6); /* UTF-8 char can be 6 bytes long */\n\n __QuexBufferFiller_init_functions(&me->base,\n TEMPLATED(__QuexBufferFiller_IConv_tell_character_index),\n TEMPLATED(__QuexBufferFiller_IConv_seek_character_index), \n TEMPLATED(__QuexBufferFiller_IConv_read_characters),\n TEMPLATED(__QuexBufferFiller_IConv_destroy));\n\n /* Initialize the raw buffer that holds the plain bytes of the input file\n * (setup to trigger initial reload) */\n me->ih = input_handle;\n\n /* Initialize the raw buffer that holds the plain bytes of the input file */\n uint8_t* raw_buffer_p = MemoryManager_get_BufferFiller_RawBuffer(RawBufferSize);\n QuexBufferFiller_IConv_BufferInfo_init(&me->raw_buffer.base, raw_buffer_p, RawBufferSize);\n\n me->raw_buffer.base.bytes_left_n = 0; /* --> trigger reload */\n\n /* Initialize the conversion operations */\n me->iconv_handle = iconv_open(to_coding, FromCoding);\n if( me->iconv_handle == (iconv_t)-1 ) {\n char tmp[128];\n snprintf(tmp, 127, \"Conversion '%s' --> '%s' is not supported by 'iconv'.\\n\", FromCoding, to_coding);\n QUEX_ERROR_EXIT(tmp);\n }\n me->_constant_size_character_encoding_f = \\\n ! QuexBufferFiller_IConv_has_coding_dynamic_character_width(FromCoding);\n\n /* Setup the tell/seek of character positions */\n __QuexBufferFiller_IConv_mark_start_position(me);\n me->raw_buffer.begin_stream_position = QUEX_INPUT_POLICY_TELL(me->ih, InputHandleT);\n me->raw_buffer.begin_character_index = 0;\n me->raw_buffer.end_stream_position = me->raw_buffer.begin_stream_position;\n me->raw_buffer.iterators_character_index = 0;\n me->raw_buffer.fill_level_n = 0;\n\n /*QUEX_UNIT_TEST_ICONV_INPUT_STRATEGY_PRINT_CONSTRUCTOR(FromCoding, ToCoding, me->iconv_handle);*/\n QUEX_ASSERT_BUFFER_INFO(&me->raw_buffer);\n }\n\n TEMPLATE_IN(InputHandleT) void \n __QuexBufferFiller_IConv_destroy(QuexBufferFiller* alter_ego)\n { \n TEMPLATED(QuexBufferFiller_IConv)* me = (TEMPLATED(QuexBufferFiller_IConv)*)alter_ego;\n QUEX_ASSERT_BUFFER_INFO(&me->raw_buffer);\n\n iconv_close(me->iconv_handle); \n\n MemoryManager_free_BufferFiller_RawBuffer(me->raw_buffer.base.begin); \n\n /* The memory manager allocated the space required for a buffer filler of this\n * type. Somewhere down the road it is known what size of memory belongs to this\n * pointer. */\n MemoryManager_free_BufferFiller(alter_ego);\n }\n\n TEMPLATE_IN(InputHandleT) size_t \n __QuexBufferFiller_IConv_read_characters(QuexBufferFiller* alter_ego,\n QUEX_CHARACTER_TYPE* user_memory_p, \n const size_t N)\n {\n __quex_assert(alter_ego != 0x0); \n TEMPLATED(QuexBufferFiller_IConv)* me = (TEMPLATED(QuexBufferFiller_IConv)*)alter_ego;\n\n QuexBufferFiller_IConv_BufferInfo user_buffer;\n QuexBufferFiller_IConv_BufferInfo_init(&user_buffer, (uint8_t*)user_memory_p, \n N * sizeof(QUEX_CHARACTER_TYPE));\n QUEX_ASSERT_BUFFER_INFO(&me->raw_buffer);\n\n /* TWO CASES:\n * (1) There are still some bytes in the raw buffer from the last load.\n * in this case, first translate them and then maybe load the raw buffer\n * again. (raw_buffer.base.bytes_left_n != 0)\n * (2) The raw buffer is empty. Then it must be loaded in order to get some\n * basis for conversion. (raw_buffer.base.bytes_left_n == 0) */\n if( me->raw_buffer.base.bytes_left_n == 0 ) __QuexBufferFiller_IConv_fill_raw_buffer(me); \n\n while( __QuexBufferFiller_IConv_convert(me, &user_buffer) == false ) \n __QuexBufferFiller_IConv_fill_raw_buffer(me); \n\n if( user_buffer.bytes_left_n == 0 ) { \n /* The buffer was filled to its limits. All 'N' characters have been written. */\n return N;\n } else { \n /* The buffer was not filled completely, because the end of the file was \n * reached. The fill level of the user buffer computes as: */\n const size_t ConvertedCharN = (user_buffer.size - user_buffer.bytes_left_n) / sizeof(QUEX_CHARACTER_TYPE);\n# ifdef QUEX_OPTION_ASSERTS\n /* '.bytes_left_n' is not always correct. '.iterator' points always directly \n * behind the last written byte. */\n /* Cast to uint8_t to avoid that some smart guy provides a C++ overloading function */\n __QUEX_STD_memset((uint8_t*)(user_buffer.iterator), (uint8_t)0xFF, \n (user_buffer.begin + user_buffer.size) - user_buffer.iterator);\n# endif\n return ConvertedCharN;\n }\n }\n\n TEMPLATE_IN(InputHandleT) void \n __QuexBufferFiller_IConv_fill_raw_buffer(TEMPLATED(QuexBufferFiller_IConv)* me) \n {\n /* Try to fill the raw buffer to its limits with data from the file.\n * The filling starts from its current position, thus the remaining bytes\n * to be translated are exactly the number of bytes in the buffer. */\n QuexBufferFiller_IConv_BufferInfo* buffer = &me->raw_buffer.base;\n const size_t RemainingBytesN = buffer->bytes_left_n;\n QUEX_ASSERT_BUFFER_INFO(&me->raw_buffer);\n __quex_assert(me->raw_buffer.end_stream_position == QUEX_INPUT_POLICY_TELL(me->ih, InputHandleT));\n\n /* Update the character index / stream position infos */\n me->raw_buffer.begin_character_index = me->raw_buffer.iterators_character_index;\n me->raw_buffer.begin_stream_position = me->raw_buffer.end_stream_position \n - (STREAM_OFFSET_TYPE(InputHandleT))RemainingBytesN;\n\n /* There are cases (e.g. when a broken multibyte sequence occured at the end of \n * the buffer) where there are bytes left in the raw buffer. These need to be\n * moved to the beginning of the buffer. */\n if( buffer->iterator != buffer->begin ) {\n /* Be careful: Maybe one can use 'memcpy()' which is a bit faster but the\n * following is safe against overlaps. */\n /* Cast to uint8_t to avoid a spurious function overload */\n __QUEX_STD_memmove((uint8_t*)(buffer->begin), (uint8_t*)(buffer->iterator), RemainingBytesN);\n /* Reset the position, so that new conversion get's the whole character. */\n buffer->iterator = buffer->begin; \n }\n\n uint8_t* FillStartPosition = buffer->begin + RemainingBytesN;\n size_t FillSize = buffer->size - RemainingBytesN;\n const size_t LoadedByteN = \\\n QUEX_INPUT_POLICY_LOAD_BYTES(me->ih, InputHandleT, FillStartPosition, FillSize);\n\n /* NOTE: In case of 'end of file' it is possible: bytes_left_n != buffer->size */\n me->raw_buffer.fill_level_n = LoadedByteN + RemainingBytesN;\n buffer->bytes_left_n = LoadedByteN + RemainingBytesN; \n\n me->raw_buffer.end_stream_position = QUEX_INPUT_POLICY_TELL(me->ih, InputHandleT);\n /* '.character_index' remains to be updated after character conversion */\n\n /*QUEX_UNIT_TEST_ICONV_INPUT_STRATEGY_PRINT_RAW_BUFFER_LOAD(LoadedByteN);*/\n QUEX_ASSERT_BUFFER_INFO(&me->raw_buffer);\n }\n\n TEMPLATE_IN(InputHandleT) bool \n __QuexBufferFiller_IConv_convert(TEMPLATED(QuexBufferFiller_IConv)* me, \n QuexBufferFiller_IConv_BufferInfo* drain) \n {\n /* RETURNS: true --> User buffer is filled as much as possible with converted \n * characters.\n * false --> More raw bytes are needed to fill the user buffer. \n *\n * IF YOU GET A COMPILE ERROR HERE, THEN PLEASE HAVE A LOOK AT THE FILE:\n *\n * quex/code_base/compatibility/iconv-argument-types.h\n * \n * The issue is, that 'iconv' is defined on different systems with different\n * types of the second argument. There are two variants 'const char**'\n * and 'char **'. If you get an error here, consider defining \n *\n * -DQUEX_SETTING_ICONV_2ND_ARG_CONST_CHARPP\n *\n * as a compile option. If you have an elegant solution to solve the problem for \n * plain 'C', then please, let me know <fschaef@users.sourceforge.net>. */\n QuexBufferFiller_IConv_BufferInfo* source = &me->raw_buffer.base;\n const uint8_t* drain_start_iterator = drain->iterator;\n QUEX_ASSERT_BUFFER_INFO(&me->raw_buffer);\n QUEX_ASSERT_BUFFER_INFO_EASY(drain);\n size_t report = iconv(me->iconv_handle, \n __QUEX_ADAPTER_ICONV_2ND_ARG(&source->iterator), &source->bytes_left_n,\n (char**)&(drain->iterator), &(drain->bytes_left_n));\n QUEX_ASSERT_BUFFER_INFO(&me->raw_buffer);\n\n /* The following only holds for fixed size **target** encodings. In Quex we assume that \n * the buffer content on which the core engine operates has fixed character widths. */ \n const size_t ConvertedCharN = (drain->iterator - drain_start_iterator)/sizeof(QUEX_CHARACTER_TYPE);\n me->raw_buffer.iterators_character_index += ConvertedCharN;\n\n if( report != (size_t)-1 ) { \n __quex_assert(source->bytes_left_n == 0);\n /* The input sequence (raw buffer content) has been converted completely.\n * But, is the user buffer filled to its limits? */\n if( drain->bytes_left_n == 0 ) {\n __quex_assert(drain->iterator == drain->begin + drain->size);\n return true; \n }\n /* If the buffer was not filled completely, then was it because we reached EOF?\n * NOTE: Here, 'source->iterator' points to the position after the last byte\n * that has been converted. If this is the end of the buffer, then it means\n * that the raw buffer was read. If not, it means that the buffer has not been\n * filled to its border which happens only if End of File occured. */\n if( source->iterator != source->begin + source->size ) {\n __quex_assert(me->raw_buffer.fill_level_n != me->raw_buffer.base.size);\n return true;\n }\n else {\n /* Else: The user buffer is still hungry, thus the raw buffer needs more bytes. */\n /* source->bytes_left_n = 0 anyway, so 'refill' is triggered */\n return false; \n }\n }\n\n switch( errno ) {\n default:\n QUEX_ERROR_EXIT(\"Unexpected setting of 'errno' after call to GNU's iconv().\");\n\n case EILSEQ:\n QUEX_ERROR_EXIT(\"Invalid byte sequence encountered for given character coding.\");\n\n case EINVAL:\n /* (*) Incomplete byte sequence for character conversion\n * ('raw_buffer.base.iterator' points to the beginning of the incomplete sequence.)\n * Please, refill the buffer (consider copying the bytes from raw_buffer.base.iterator \n * to the end of the buffer in front of the new buffer). */\n return false; \n\n case E2BIG:\n /* (*) The input buffer was not able to hold the number of converted characters.\n * (in other words we're filled up to the limit and that's what we actually wanted.) */\n return true;\n }\n }\n\n\n TEMPLATE_IN(InputHandleT) size_t \n __QuexBufferFiller_IConv_tell_character_index(QuexBufferFiller* alter_ego)\n { \n __quex_assert(alter_ego != 0x0); \n TEMPLATED(QuexBufferFiller_IConv)* me = (TEMPLATED(QuexBufferFiller_IConv)*)alter_ego;\n /* The raw buffer iterator stands on the next character to be read. In general it holds\n * that the raw_buffer's iterator points to the first byte of the next character to be\n * converted when the next user buffer is to be filled. */\n return me->raw_buffer.iterators_character_index; \n }\n\n TEMPLATE_IN(InputHandleT) void \n __QuexBufferFiller_IConv_seek_character_index(QuexBufferFiller* alter_ego, \n const size_t Index)\n { \n /* NOTE: This differs from QuexBuffer_seek(...) in the sense, that it only sets the\n * stream to a particular position given by a character index. QuexBuffer_seek(..)\n * sets the _input_p to a particular position. */\n __quex_assert(alter_ego != 0x0); \n TEMPLATED(QuexBufferFiller_IConv)* me = (TEMPLATED(QuexBufferFiller_IConv)*)alter_ego;\n const size_t BeginIndex = me->raw_buffer.begin_character_index;\n\n /* Seek_character_index(Pos) means that the next time when a character buffer\n * is to be filled, this has to happen from position 'CharacterIndex'. \n *\n * NOTE: The reference for character positioning is **not** directly the stream.\n * Moreover, it is the internal raw_buffer.position. It determines what characters \n * are converted next into the user's buffer. */\n if( Index == me->raw_buffer.iterators_character_index ) { \n return; /* Nothing to be done */\n }\n /* Depending on the character encoding, the seek procedure can be optimized there are the \n * following two cases:\n *\n * (1) The coding uses **fixed** character widths (such as ASCII, UCS2, UCS4, etc.) where\n * each character always occupies the same amount of bytes. Here, offsets can be \n * **computed**. This makes things faster.\n * (2) The coding uses **dynamic** character width (e.g. UTF-8). Here the position cannot\n * be computed. Instead, the conversion must start from a given 'known' position \n * until one reaches the specified character index. */\n if( me->_constant_size_character_encoding_f ) { \n /* (1) Fixed Character Width */\n const size_t EndIndex = BeginIndex + (me->raw_buffer.base.size / sizeof(QUEX_CHARACTER_TYPE));\n if( Index >= BeginIndex && Index < EndIndex ) {\n uint8_t* new_iterator = me->raw_buffer.base.begin + (Index - BeginIndex) * sizeof(QUEX_CHARACTER_TYPE);\n me->raw_buffer.base.bytes_left_n -= (new_iterator - me->raw_buffer.base.iterator);\n me->raw_buffer.base.iterator = new_iterator;\n me->raw_buffer.iterators_character_index = Index;\n }\n else /* Index not in [BeginIndex:EndIndex) */ {\n STREAM_POSITION_TYPE(InputHandleT) avoid_tmp_arg =\n (STREAM_POSITION_TYPE(InputHandleT))(Index * sizeof(QUEX_CHARACTER_TYPE) + me->start_position);\n QUEX_INPUT_POLICY_SEEK(me->ih, InputHandleT, avoid_tmp_arg);\n me->raw_buffer.end_stream_position = avoid_tmp_arg;\n me->raw_buffer.base.bytes_left_n = 0; /* Trigger reload */\n me->raw_buffer.base.iterator = me->raw_buffer.base.begin;\n me->raw_buffer.begin_character_index = Index;\n me->raw_buffer.iterators_character_index = Index;\n }\n } \n else { \n /* (2) Dynamic Character Width */\n /* Setting the iterator to the begin of the raw_buffer initiates a conversion\n * start from this point. */\n if( Index == BeginIndex ) { \n /* The 'read_characters()' function works on the content of the bytes\n * in the raw_buffer. The only thing that has to happen is to reset \n * the raw buffer's position pointer to '0'. */\n me->raw_buffer.base.bytes_left_n += (me->raw_buffer.base.iterator - me->raw_buffer.base.begin);\n me->raw_buffer.base.iterator = me->raw_buffer.base.begin;\n me->raw_buffer.iterators_character_index = Index;\n }\n else if( Index > BeginIndex ) { \n /* The searched index lies in the current raw_buffer or behind. Simply start \n * conversion from the current position until it is reached--but use the stuff \n * currently inside the buffer. */\n me->raw_buffer.base.bytes_left_n += (me->raw_buffer.base.iterator - me->raw_buffer.base.begin);\n me->raw_buffer.base.iterator = me->raw_buffer.base.begin;\n me->raw_buffer.iterators_character_index = me->raw_buffer.begin_character_index;\n __QuexBufferFiller_IConv_step_forward_n_characters(me, Index - BeginIndex);\n }\n else /* Index < BeginIndex */ {\n /* No idea where to start --> start from the beginning. In some cases this might\n * mean a huge performance penalty. But note, that is only occurs at pre-conditions\n * that are very very long and happen right at the beginning of the raw buffer. */\n QUEX_INPUT_POLICY_SEEK(me->ih, InputHandleT, me->start_position);\n me->raw_buffer.end_stream_position = me->start_position;\n me->raw_buffer.base.bytes_left_n = 0; /* trigger reload, not only conversion */\n me->raw_buffer.base.iterator = me->raw_buffer.base.begin;\n me->raw_buffer.begin_character_index = 0;\n me->raw_buffer.iterators_character_index = 0;\n me->raw_buffer.fill_level_n = 0;\n __QuexBufferFiller_IConv_step_forward_n_characters(me, Index);\n } \n }\n QUEX_ASSERT_BUFFER_INFO(&me->raw_buffer);\n __quex_assert(me->raw_buffer.iterators_character_index == Index);\n }\n\n TEMPLATE_IN(InputHandleT) void \n __QuexBufferFiller_IConv_step_forward_n_characters(TEMPLATED(QuexBufferFiller_IConv)* me,\n const size_t ForwardN)\n { \n /* We cannot use the raw buffer at this point in time, since this is required \n * to interpret characters. Whenever a dynamic size coding is required this\n * way of searching may become necessary. */\n# ifdef QUEX_OPTION_ASSERTS\n const size_t TargetIndex = me->raw_buffer.iterators_character_index + ForwardN;\n# endif\n const size_t ChunkSize = QUEX_SETTING_BUFFER_FILLER_SEEK_TEMP_BUFFER_SIZE;\n QUEX_CHARACTER_TYPE chunk[QUEX_SETTING_BUFFER_FILLER_SEEK_TEMP_BUFFER_SIZE];\n /* This seek operation thought to support only cases where character positions\n * cannot be computed--as is the case for fixed character width encodings. */\n __quex_assert(me->_constant_size_character_encoding_f == false);\n /* Same restriction as for raw_buffer (see above) */\n __quex_assert(QUEX_SETTING_BUFFER_FILLER_SEEK_TEMP_BUFFER_SIZE >= 6);\n QUEX_ASSERT_BUFFER_INFO(&me->raw_buffer);\n\n /* STRATEGY: Starting from a certain point in the file we read characters\n * Convert one-by-one until we reach the given character index */\n size_t remaining_character_n = ForwardN;\n\n /* We are now at character index 'CharacterIndex - remaining_character_n' in the stream.\n * It remains to interpret 'remaining_character_n' number of characters. Since the\n * the interpretation is best done using a buffer, we do this in chunks. */ \n for(; remaining_character_n > ChunkSize; remaining_character_n -= ChunkSize ) \n me->base.read_characters(&me->base, (QUEX_CHARACTER_TYPE*)chunk, ChunkSize);\n if( remaining_character_n ) \n me->base.read_characters(&me->base, (QUEX_CHARACTER_TYPE*)chunk, remaining_character_n);\n \n __quex_assert(me->raw_buffer.iterators_character_index == TargetIndex);\n }\n\n TEMPLATE_IN(InputHandleT) void \n __QuexBufferFiller_IConv_mark_start_position(TEMPLATED(QuexBufferFiller_IConv)* me) \n { \n __quex_assert(me != 0x0); \n me->start_position = QUEX_INPUT_POLICY_TELL(me->ih, InputHandleT);\n }\n\n TEMPLATE_IN(InputHandleT) void \n __QuexBufferFiller_IConv_reset_start_position(TEMPLATED(QuexBufferFiller_IConv)* me) \n {\n __quex_assert(me != 0x0); \n QUEX_INPUT_POLICY_SEEK(me->ih, InputHandleT, me->start_position);\n me->raw_buffer.end_stream_position = me->start_position;\n }\n\n QUEX_INLINE bool \n QuexBufferFiller_IConv_has_coding_dynamic_character_width(const char* Coding) \n {\n return true; /* TODO: distinguish between different coding formats */\n /* // 'true' is safe, but possibly a little slower. */\n }\n\n QUEX_INLINE void\n QuexBufferFiller_IConv_BufferInfo_init(QuexBufferFiller_IConv_BufferInfo* me, \n uint8_t* Begin, size_t SizeInBytes)\n {\n me->begin = Begin;\n me->size = SizeInBytes;\n me->iterator = me->begin;\n me->bytes_left_n = me->size;\n\n# ifdef QUEX_OPTION_ASSERTS\n /* Cast to uint8_t to avoid that some smart guy provides a C++ overloading function */\n __QUEX_STD_memset((uint8_t*)Begin, (uint8_t)0xFF, SizeInBytes);\n# endif\n }\n\n#undef CLASS\n\n#if ! defined(__QUEX_SETTING_PLAIN_C)\n}\n#endif\n\n#include <quex/code_base/temporary_macros_off>\n\n#include <quex/code_base/buffer/BufferFiller.i>\n\n#endif /* __INCLUDE_GUARD__QUEX_BUFFER_INPUT_STRATEGY_ICONV__ */\n" }, { "alpha_fraction": 0.6495818495750427, "alphanum_fraction": 0.650391161441803, "avg_line_length": 25.105634689331055, "blob_id": "1572361a904d7a15dce31491574e2034da61879e", "content_id": "b5c3144714e5436081cd202cb3d6cb692392e786", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 3707, "license_type": "permissive", "max_line_length": 97, "num_lines": 142, "path": "/engine/physics/tcol_lexer.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "#include\"tcol_lexer\"\nnamespace quex {\n QuexMode tcol_lexer::COMMENT;\n QuexMode tcol_lexer::END_OF_FILE;\n QuexMode tcol_lexer::MAIN;\n#define self (*me)\n\n void\n tcol_lexer_COMMENT_on_entry(tcol_lexer* me, const QuexMode* FromMode) {\n#ifdef __QUEX_OPTION_RUNTIME_MODE_TRANSITION_CHECK\n__quex_assert(me->COMMENT.has_entry_from(FromMode));\n#endif\n\n }\n\n void\n tcol_lexer_COMMENT_on_exit(tcol_lexer* me, const QuexMode* ToMode) {\n#ifdef __QUEX_OPTION_RUNTIME_MODE_TRANSITION_CHECK\n__quex_assert(me->COMMENT.has_exit_to(ToMode));\n#endif\n\n }\n\n#ifdef __QUEX_OPTION_INDENTATION_TRIGGER_SUPPORT \n void\n tcol_lexer_COMMENT_on_indentation(tcol_lexer* me, const int Indentation) {\n__quex_assert(Indentation >= 0);\n }\n#endif\n\n#ifdef __QUEX_OPTION_RUNTIME_MODE_TRANSITION_CHECK\n bool\n tcol_lexer_COMMENT_has_base(const QuexMode* Mode) {\n\n switch( Mode->id ) {\n case LEX_ID_END_OF_FILE: return true;\n default:\n ;\n }\n #ifdef __QUEX_OPTION_ERROR_OUTPUT_ON_MODE_CHANGE_ERROR\n std::cerr << \"mode 'END_OF_FILE' is not one of:\\n\"; std::cerr << \" END_OF_FILE\\n\";\n #endif // QUEX_OPTION_ERROR_OUTPUT_ON_MODE_CHANGE_ERROR\n return false;\n \n }\n bool\n tcol_lexer_COMMENT_has_entry_from(const QuexMode* Mode) {\n return true; // default\n }\n bool\n tcol_lexer_COMMENT_has_exit_to(const QuexMode* Mode) {\n return true; // default\n }\n#endif \n\n void\n tcol_lexer_END_OF_FILE_on_entry(tcol_lexer* me, const QuexMode* FromMode) {\n#ifdef __QUEX_OPTION_RUNTIME_MODE_TRANSITION_CHECK\n__quex_assert(me->END_OF_FILE.has_entry_from(FromMode));\n#endif\n\n }\n\n void\n tcol_lexer_END_OF_FILE_on_exit(tcol_lexer* me, const QuexMode* ToMode) {\n#ifdef __QUEX_OPTION_RUNTIME_MODE_TRANSITION_CHECK\n__quex_assert(me->END_OF_FILE.has_exit_to(ToMode));\n#endif\n\n }\n\n#ifdef __QUEX_OPTION_INDENTATION_TRIGGER_SUPPORT \n void\n tcol_lexer_END_OF_FILE_on_indentation(tcol_lexer* me, const int Indentation) {\n__quex_assert(Indentation >= 0);\n }\n#endif\n\n#ifdef __QUEX_OPTION_RUNTIME_MODE_TRANSITION_CHECK\n bool\n tcol_lexer_END_OF_FILE_has_base(const QuexMode* Mode) {\n return false;\n }\n bool\n tcol_lexer_END_OF_FILE_has_entry_from(const QuexMode* Mode) {\n return true; // default\n }\n bool\n tcol_lexer_END_OF_FILE_has_exit_to(const QuexMode* Mode) {\n return true; // default\n }\n#endif \n\n void\n tcol_lexer_MAIN_on_entry(tcol_lexer* me, const QuexMode* FromMode) {\n#ifdef __QUEX_OPTION_RUNTIME_MODE_TRANSITION_CHECK\n__quex_assert(me->MAIN.has_entry_from(FromMode));\n#endif\n\n }\n\n void\n tcol_lexer_MAIN_on_exit(tcol_lexer* me, const QuexMode* ToMode) {\n#ifdef __QUEX_OPTION_RUNTIME_MODE_TRANSITION_CHECK\n__quex_assert(me->MAIN.has_exit_to(ToMode));\n#endif\n\n }\n\n#ifdef __QUEX_OPTION_INDENTATION_TRIGGER_SUPPORT \n void\n tcol_lexer_MAIN_on_indentation(tcol_lexer* me, const int Indentation) {\n__quex_assert(Indentation >= 0);\n }\n#endif\n\n#ifdef __QUEX_OPTION_RUNTIME_MODE_TRANSITION_CHECK\n bool\n tcol_lexer_MAIN_has_base(const QuexMode* Mode) {\n\n switch( Mode->id ) {\n case LEX_ID_END_OF_FILE: return true;\n default:\n ;\n }\n #ifdef __QUEX_OPTION_ERROR_OUTPUT_ON_MODE_CHANGE_ERROR\n std::cerr << \"mode 'END_OF_FILE' is not one of:\\n\"; std::cerr << \" END_OF_FILE\\n\";\n #endif // QUEX_OPTION_ERROR_OUTPUT_ON_MODE_CHANGE_ERROR\n return false;\n \n }\n bool\n tcol_lexer_MAIN_has_entry_from(const QuexMode* Mode) {\n return true; // default\n }\n bool\n tcol_lexer_MAIN_has_exit_to(const QuexMode* Mode) {\n return true; // default\n }\n#endif \n#undef self\n} // END: namespace quex\n" }, { "alpha_fraction": 0.7460854649543762, "alphanum_fraction": 0.7477782368659973, "avg_line_length": 32.28168869018555, "blob_id": "6e97101eb4196c08139f491e685446b6146c0cbc", "content_id": "ea4730315f281b98a3a8a36589087cffcee99d1e", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 2363, "license_type": "permissive", "max_line_length": 80, "num_lines": 71, "path": "/engine/gfx/gfx_sky_material.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <vector>\n\nclass GfxSkyMaterial;\ntypedef std::vector<GfxSkyMaterial*> GfxSkyMaterials;\n\n#ifndef GFX_SKY_MATERIAL_H\n#define GFX_SKY_MATERIAL_H\n\n#include \"gfx_material.h\"\n#include \"gfx_internal.h\"\n#include \"gfx_gasoline.h\"\n#include \"gfx_shader.h\"\n\nenum GfxSkyMaterialSceneBlend {\n GFX_SKY_MATERIAL_OPAQUE,\n GFX_SKY_MATERIAL_ALPHA,\n GFX_SKY_MATERIAL_ADD\n};\n\nclass GfxSkyMaterial : public GfxBaseMaterial {\n\n GfxSkyMaterialSceneBlend sceneBlend;\n\n GfxSkyMaterial (const std::string &name);\n\n public:\n // take MAT_SYNC when iterating through this stuff\n\n GfxSkyMaterialSceneBlend getSceneBlend (void) const { return sceneBlend; }\n void setSceneBlend (GfxSkyMaterialSceneBlend v) { sceneBlend = v; }\n\n void addDependencies (DiskResource *into);\n\n friend GfxSkyMaterial *gfx_sky_material_add(const std::string &);\n friend class GfxSkyBody;\n}; \n \nGfxSkyMaterial *gfx_sky_material_add (const std::string &name);\n\nGfxSkyMaterial *gfx_sky_material_add_or_get (const std::string &name);\n\nGfxSkyMaterial *gfx_sky_material_get (const std::string &name);\n \nbool gfx_sky_material_has (const std::string &name);\n\nvoid gfx_sky_material_shutdown (void);\n\nvoid gfx_sky_material_init (void);\n\n#endif\n" }, { "alpha_fraction": 0.6322034001350403, "alphanum_fraction": 0.7067796587944031, "avg_line_length": 32.71428680419922, "blob_id": "7a0d4dae75258c0c71c8936be5c03cf498d6667e", "content_id": "1e76d3bd76a2e0c253f8f354048b7922e5dc70d2", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "C", "length_bytes": 1180, "license_type": "permissive", "max_line_length": 75, "num_lines": 35, "path": "/dependencies/quex-0.34.1/quex/code_base/compatibility/win/borland_inttypes.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "#ifndef __INCLUDE_GUARD_QUEX_CODE_BASE_COMPATIBILITY_WIN_BORLAND_INTTYPES_H\n#define __INCLUDE_GUARD_QUEX_CODE_BASE_COMPATIBILITY_WIN_BORLAND_INTTYPES_H\n // Contributed by Howard Jeng <sphericalcow@users.sourceforge.net>.\n // DATE: 08y3m4d\n\n typedef signed __int8 int8_t;\n typedef signed __int8 int_least8_t;\n typedef signed __int8 int_fast8_t;\n typedef unsigned __int8 uint8_t;\n typedef unsigned __int8 uint_least8_t;\n typedef unsigned __int8 uint_fast8_t;\n\n typedef signed __int16 int16_t;\n typedef signed __int16 int_least16_t;\n typedef signed __int16 int_fast16_t;\n typedef unsigned __int16 uint16_t;\n typedef unsigned __int16 uint_least16_t;\n typedef unsigned __int16 uint_fast16_t;\n\n typedef signed __int32 int32_t;\n typedef signed __int32 int_least32_t;\n typedef signed __int32 int_fast32_t;\n typedef unsigned __int32 uint32_t;\n typedef unsigned __int32 uint_least32_t;\n typedef unsigned __int32 uint_fast32_t;\n\n\n typedef signed __int64 int64_t;\n typedef signed __int64 int_least64_t;\n typedef signed __int64 int_fast64_t;\n typedef unsigned __int64 uint64_t;\n typedef unsigned __int64 uint_least64_t;\n typedef unsigned __int64 uint_fast64_t;\n\n#endif\n" }, { "alpha_fraction": 0.5024582147598267, "alphanum_fraction": 0.5039331316947937, "avg_line_length": 34.66666793823242, "blob_id": "c9b18844a9188f3d28eeb095abb1588e4c7e378e", "content_id": "ad02d41ccbf8b83d5047ae20f697c726c770571e", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 2034, "license_type": "permissive", "max_line_length": 102, "num_lines": 57, "path": "/dependencies/quex-0.34.1/demo/009/stdinlexer.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "#include<fstream> \n#include<iostream> \n#include<sstream> \n\n#include <./tiny_lexer>\n\nint \nmain(int argc, char** argv) \n{ \n using namespace std;\n\n // (*) create token\n quex::Token Token;\n // (*) create the lexical analyser\n // if no command line argument is specified user file 'example.txt'\n quex::tiny_lexer* qlex = new quex::tiny_lexer();\n\n cout << \",------------------------------------------------------------------------------------\\n\";\n cout << \"| [START]\\n\";\n cout << \"Please, type an arbitrary sequence of the following:\\n\";\n cout << \"-- One of the words: 'hello', 'world', 'hallo', 'welt', 'bonjour', 'le monde'.\\n\";\n cout << \"-- An integer number.\\n\";\n cout << \"-- The word 'bye' in order to terminate.\\n\";\n cout << \"Please, terminate each line with pressing [enter].\\n\";\n\n\n int number_of_tokens = 0;\n while( cin ) {\n // Read a line from standard input\n cin.getline((char*)qlex->buffer_begin(), qlex->buffer_size());\n cout << \"[[Received \" << cin.gcount() << \" characters in line.]]\\n\";\n // Prepare the read the characters that we just flooded into the buffer\n qlex->buffer_prepare(cin.gcount());\n \n // Loop until the 'termination' token arrives\n do {\n qlex->get_token(&Token);\n cout << string(Token) << endl;\n ++number_of_tokens;\n } while( Token.type_id() != QUEX_TKN_TERMINATION && Token.type_id() != QUEX_TKN_BYE );\n \n cout << \"[[End of Input]]\\n\";\n if( qlex->buffer_distance_to_text_end() != 0 ) {\n // The end of the text is always zero terminated, that is why we can print it\n cout << \"[[Warning: not all characters treated.]]\\n\";\n }\n\n if( Token.type_id() == QUEX_TKN_BYE ) break;\n }\n\n cout << \"| [END] number of token = \" << number_of_tokens << \"\\n\";\n cout << \"`------------------------------------------------------------------------------------\\n\";\n\n delete qlex;\n\n return 0;\n}\n\n" }, { "alpha_fraction": 0.584193766117096, "alphanum_fraction": 0.5980680584907532, "avg_line_length": 29.799999237060547, "blob_id": "6981571194c631cbe099c94fedc6558e17ad2afa", "content_id": "40ccea286e858ac38f3c74dbd7ca6980f08f92c7", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 49588, "license_type": "permissive", "max_line_length": 173, "num_lines": 1610, "path": "/engine/gfx/hud.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <centralised_log.h>\n#include \"../path_util.h\"\n\n#include \"lua_wrappers_gfx.h\"\n#include \"hud.h\"\n#include \"gfx_internal.h\"\n#include \"gfx_shader.h\"\n\nstatic GfxShader *shader_text, *shader_rect, *shader_stencil;\nstatic GfxShaderBindings shader_text_binds, empty_binds;\n\nstatic Vector2 win_size(0,0);\n\n// {{{ CLASSES\n\nstatic HudClassMap classes;\n\nHudClass *hud_class_add (lua_State *L, const std::string& name)\n{\n HudClass *ghc;\n HudClassMap::iterator i = classes.find(name);\n \n if (i!=classes.end()) {\n ghc = i->second;\n int index = lua_gettop(L);\n for (lua_pushnil(L) ; lua_next(L,index)!=0 ; lua_pop(L,1)) {\n ghc->set(L);\n }\n } else {\n // add it and return it\n ghc = new HudClass(L, name);\n classes[name] = ghc;\n } \n return ghc; \n}\n\nHudClass *hud_class_get (const std::string &name)\n{\n HudClassMap::iterator i = classes.find(name);\n if (i==classes.end())\n GRIT_EXCEPT(\"GfXHudClass does not exist: \"+name);\n return i->second; \n}\n\nbool hud_class_has (const std::string &name)\n{\n return classes.find(name)!=classes.end();\n}\n\nvoid hud_class_all (HudClassMap::iterator &begin, HudClassMap::iterator &end)\n{\n begin = classes.begin();\n end = classes.end();\n}\n\nsize_t hud_class_count (void)\n{\n return classes.size();\n}\n\n// }}}\n\n\n// {{{ BASE\nstatic fast_erase_vector<HudBase*> root_elements;\n\n/** Get a std::vector of root_elemenets that are HudObjects, and also inc\n * their ref counts.\n *\n * A common operation is to iterate over the hud objects and call a Lua\n * callback on some/all of them. Since Lua callbacks can trigger the Lua\n * garbage collector, and thus call gc metamethods on hud objects, and thus dec\n * the reference count of hud objects, we must be careful that 1) we are not\n * iterating over root_elements directly since it will change, and 2) we are\n * not iterating over a simple copy of root_elements since some of those\n * pointers will be free'd in the middle of the iteration. To avoid this, we\n * increment the reference counters for all these objects before the iteration,\n * as well as using a copied std::vector.\n */\nstatic std::vector<HudObject *> get_all_hud_objects (const fast_erase_vector<HudBase*> &bases)\n{\n std::vector<HudObject*> r;\n for (unsigned i=0 ; i<bases.size() ; ++i) {\n HudObject *o = dynamic_cast<HudObject*>(bases[i]);\n if (o == NULL) continue;\n r.push_back(o);\n o->incRefCount();\n }\n return r;\n}\n\n/** The companion to get_all_hud_objects. This simply decs the reference count\n * for all the objects.\n */\nstatic void dec_all_hud_objects (lua_State *L, std::vector<HudObject *> objs)\n{\n for (unsigned i=0 ; i<objs.size() ; ++i) {\n objs[i]->decRefCount(L);\n }\n}\n\n\nvoid HudBase::registerRemove (void)\n{\n //CVERB << \"Hud element unregistering its existence: \" << this << std::endl;\n if (parent != NULL) {\n parent->notifyChildRemove(this);\n } else {\n root_elements.erase(this);\n }\n}\n\nvoid HudBase::registerAdd (void)\n{\n //CVERB << \"Hud element registering its existence: \" << this << std::endl;\n if (parent != NULL) {\n parent->notifyChildAdd(this);\n } else {\n root_elements.push_back(this);\n }\n}\n\nHudBase::HudBase (void)\n : aliveness(ALIVE), parent(NULL), zOrder(3),\n position(0,0), orientation(0), inheritOrientation(true), enabled(true), snapPixels(true)\n{\n //CVERB << \"Hud element created: \" << this << std::endl;\n registerAdd();\n}\n\nHudBase::~HudBase (void)\n{\n if (aliveness==ALIVE) destroy();\n //CVERB << \"Hud element deleted: \" << this << std::endl;\n}\n\nvoid HudBase::destroy (void)\n{\n if (aliveness==DEAD) return;\n registerRemove();\n aliveness = DEAD;\n //CVERB << \"Hud element destroyed: \" << this << std::endl;\n}\n\nvoid HudBase::assertAlive (void) const\n{\n if (aliveness == DEAD)\n GRIT_EXCEPT(\"Hud element destroyed.\");\n}\n\nRadian HudBase::getDerivedOrientation (void) const\n{\n assertAlive();\n if (inheritOrientation && parent!=NULL) {\n return parent->getDerivedOrientation() + orientation;\n } else {\n return orientation;\n }\n}\n\nVector2 HudBase::getDerivedPosition (void) const\n{\n assertAlive();\n if (parent!=NULL) {\n return parent->getDerivedPosition() + position.rotateBy(parent->getDerivedOrientation());\n } else {\n return position;\n }\n}\n\nVector2 HudBase::getBounds (void)\n{\n assertAlive();\n float s = gritsin(orientation);\n float c = gritcos(orientation);\n Vector2 size = getSize();\n float w = (fabs(c)*size.x + fabs(s)*size.y);\n float h = (fabs(s)*size.x + fabs(c)*size.y);\n return Vector2(w,h);\n}\n\nVector2 HudBase::getDerivedBounds (void)\n{\n assertAlive();\n float s = gritsin(getDerivedOrientation());\n float c = gritcos(getDerivedOrientation());\n Vector2 size = getSize();\n float w = (fabs(c)*size.x + fabs(s)*size.y);\n float h = (fabs(s)*size.x + fabs(c)*size.y);\n return Vector2(w,h);\n}\n\n// }}}\n\n\n// {{{ OBJECTS\n\nHudObject::HudObject (HudClass *hud_class)\n : HudBase(), hudClass(hud_class),\n uv1(0,0), uv2(1,1), cornered(false), size(32,32), sizeSet(false), colour(1,1,1), alpha(1),\n stencil(false),\n needsResizedCallbacks(false), needsParentResizedCallbacks(false), needsInputCallbacks(false),\n needsFrameCallbacks(false), refCount(0)\n{\n shader_rect->populateMatEnv(false, texs, shaderBinds, matEnvRect);\n shader_stencil->populateMatEnv(false, stencilTexs, empty_binds, matEnvStencil);\n}\n\nvoid HudObject::incRefCount (void)\n{\n refCount++;\n //CVERB << \"Inc ref count to \"<<refCount<<\": \" << this << std::endl;\n}\n\nvoid HudObject::decRefCount (lua_State *L)\n{\n refCount--;\n //CVERB << \"Dec ref count to \"<<refCount<<\": \" << this << std::endl;\n if (refCount == 0) {\n destroy(L);\n if (refCount == 0) {\n // the destroy callback may increase the refcount by adding new\n // alisaes, in which case the object is still destroyed, i.e.\n // will throw exceptions when it is used in any way, but\n // will not actually be deleted until the ref count does reach zero\n delete this;\n } else {\n //CVERB << \"Not deleting yet since destroy callback kept dangling link: \" << this << std::endl;\n }\n }\n}\n\nvoid HudObject::setColour (const Vector3 &v)\n{\n assertAlive();\n colour = v;\n shaderBinds[\"colour\"] = v;\n}\n\nvoid HudObject::setAlpha (float v)\n{\n assertAlive();\n alpha = v;\n shaderBinds[\"alpha\"] = GfxGslParam::float1(v);\n}\n\nvoid HudObject::destroy (void)\n{\n if (aliveness != DEAD) {\n texture = nullptr;\n HudBase::destroy();\n }\n}\n\nvoid HudObject::destroy (lua_State *L)\n{\n if (aliveness == ALIVE) {\n aliveness = DYING;\n triggerDestroy(L);\n while (children.size() != 0) {\n HudBase *child = children[0];\n child->destroy(L);\n }\n table.setNil(L);\n destroy();\n }\n}\n\nvoid HudObject::triggerInit (lua_State *L)\n{\n assertAlive();\n\n STACK_BASE;\n //stack is empty\n\n // error handler in case there is a problem during \n // the callback\n push_cfunction(L, my_lua_error_handler);\n int error_handler = lua_gettop(L);\n\n //stack: err\n\n // get the function\n hudClass->get(L,\"init\");\n //stack: err,callback\n if (lua_isnil(L,-1)) {\n // no destroy callback -- our work is done\n lua_pop(L,2);\n STACK_CHECK;\n return;\n }\n\n\n //stack: err,callback\n STACK_CHECK_N(2);\n\n push_hudobj(L, this);\n //stack: err,callback,object\n\n STACK_CHECK_N(3);\n\n // call (1 arg), pops function too\n int status = lua_pcall(L,1,0,error_handler);\n if (status) {\n STACK_CHECK_N(2);\n //stack: err,error\n // pop the error message since the error handler will\n // have already printed it out\n lua_pop(L,1);\n //stack: err\n STACK_CHECK_N(1);\n } else {\n //stack: err\n STACK_CHECK_N(1);\n }\n\n //stack: err\n STACK_CHECK_N(1);\n lua_pop(L,1);\n\n //stack is empty\n STACK_CHECK;\n}\n\nvoid HudObject::triggerResized (lua_State *L)\n{\n assertAlive();\n\n if (!needsResizedCallbacks) return;\n\n STACK_BASE;\n //stack is empty\n\n // error handler in case there is a problem during \n // the callback\n push_cfunction(L, my_lua_error_handler);\n int error_handler = lua_gettop(L);\n\n //stack: err\n\n // get the function\n hudClass->get(L,\"resizedCallback\");\n //stack: err,callback\n if (lua_isnil(L,-1)) {\n // no resized callback -- our work is done\n lua_pop(L,2);\n CERR << \"Hud object of class: \\\"\" << hudClass->name\n << \"\\\" has no resizedCallback, disabling callback.\" << std::endl;\n needsResizedCallbacks = false;\n STACK_CHECK;\n return;\n }\n\n\n //stack: err,callback\n STACK_CHECK_N(2);\n\n Vector2 size = getSize();\n\n push_hudobj(L, this);\n push_v2(L, size);\n //stack: err,callback,object,size\n\n STACK_CHECK_N(4);\n\n // call (1 arg), pops function too\n int status = lua_pcall(L,2,0,error_handler);\n if (status) {\n STACK_CHECK_N(2);\n //stack: err,error\n // pop the error message since the error handler will\n // have already printed it out\n lua_pop(L,1);\n CERR << \"Hud object of class: \\\"\" << hudClass->name\n << \"\\\" raised an error on resizedCallback, disabling callback.\" << std::endl;\n // will call destroy callback\n needsResizedCallbacks = false;\n //stack: err\n STACK_CHECK_N(1);\n } else {\n //stack: err\n STACK_CHECK_N(1);\n }\n\n //stack: err\n STACK_CHECK_N(1);\n lua_pop(L,1);\n\n //stack is empty\n STACK_CHECK;\n\n}\n\nvoid HudObject::triggerParentResized (lua_State *L)\n{\n assertAlive();\n\n if (!needsParentResizedCallbacks) return;\n\n STACK_BASE;\n //stack is empty\n\n // error handler in case there is a problem during \n // the callback\n push_cfunction(L, my_lua_error_handler);\n int error_handler = lua_gettop(L);\n\n //stack: err\n\n // get the function\n hudClass->get(L,\"parentResizedCallback\");\n //stack: err,callback\n if (lua_isnil(L,-1)) {\n // no parentResized callback -- our work is done\n lua_pop(L,2);\n CERR << \"Hud object of class: \\\"\" << hudClass->name << \"\\\" has no parentResizedCallback, disabling callback.\" << std::endl;\n needsParentResizedCallbacks = false;\n STACK_CHECK;\n return;\n }\n\n\n //stack: err,callback\n STACK_CHECK_N(2);\n\n Vector2 parent_size = parent==NULL ? win_size : parent->getSize();\n\n push_hudobj(L, this);\n push_v2(L, parent_size);\n //stack: err,callback,object,size\n\n STACK_CHECK_N(4);\n\n // call (1 arg), pops function too\n int status = lua_pcall(L,2,0,error_handler);\n if (status) {\n STACK_CHECK_N(2);\n //stack: err,error\n // pop the error message since the error handler will\n // have already printed it out\n lua_pop(L,1);\n CERR << \"Hud object of class: \\\"\" << hudClass->name << \"\\\" raised an error on parentResizeCallback, disabling callback.\" << std::endl;\n // will call destroy callback\n needsParentResizedCallbacks = false;\n //stack: err\n STACK_CHECK_N(1);\n } else {\n //stack: err\n STACK_CHECK_N(1);\n }\n\n //stack: err\n STACK_CHECK_N(1);\n lua_pop(L,1);\n\n //stack is empty\n STACK_CHECK;\n\n}\n\nvoid HudObject::setSize (lua_State *L, const Vector2 &v)\n{\n assertAlive();\n sizeSet = true;\n size = v;\n\n // use local_children copy since callbacks can alter hierarchy\n std::vector<HudObject*> local_children = get_all_hud_objects(children);\n for (unsigned j=0 ; j<local_children.size() ; ++j) {\n HudObject *obj = local_children[j];\n if (!obj->destroyed()) obj->triggerParentResized(L);\n }\n dec_all_hud_objects(L, local_children);\n\n // Run this last because there is a common pattern where a parent positions its child\n // according to the child's size, and the child's size is controlled in the child's\n // parentResizedCallback as a function of the parent size. This happens for example in a\n // FileExplorer IconFlow. To make this work, we let the child know about he size change before\n // we call the parent's resizedCallback, which can then position the child properly.\n triggerResized(L);\n\n}\n\nvoid HudObject::setParent (lua_State *L, HudObject *v)\n{\n HudBase::setParent(v);\n\n triggerParentResized(L);\n}\n\nVector2 HudObject::screenToLocal (const Vector2 &screen_pos)\n{\n return (screen_pos - getDerivedPosition()).rotateBy(-getDerivedOrientation());\n}\n\nstatic HudObject *ray (const Vector2 &screen_pos)\n{\n for (int i=GFX_HUD_ZORDER_MAX ; i>=0 ; --i) {\n for (unsigned j=0 ; j<root_elements.size() ; ++j) {\n HudBase *base = root_elements[j];\n if (base->destroyed()) continue;\n if (base->getZOrder() != i) continue;\n HudObject *obj = dynamic_cast<HudObject*>(base);\n if (obj == nullptr) continue;\n HudObject *hit = obj->shootRay(screen_pos);\n if (hit != NULL) return hit;\n }\n }\n\n return NULL;\n}\n\nHudObject *HudObject::shootRay (const Vector2 &screen_pos)\n{\n if (!isEnabled()) return NULL; // can't hit any children either\n\n Vector2 local_pos = screenToLocal(screen_pos);\n bool inside = fabsf(local_pos.x) < getSize().x / 2\n && fabsf(local_pos.y) < getSize().y / 2;\n\n // children can still be hit, since they can be larger than parent, so do not return yet...\n //if (!inside) return NULL;\n \n // look at children, ensure not inside one of them\n for (int i=GFX_HUD_ZORDER_MAX ; i>=0 ; --i) {\n for (unsigned j=0 ; j<children.size() ; ++j) {\n HudBase *base = children[j];\n\n if (base->destroyed()) continue;\n if (base->getZOrder() != i) continue;\n\n HudObject *obj = dynamic_cast<HudObject*>(base);\n if (obj == NULL) continue;\n HudObject *hit = obj->shootRay(screen_pos);\n if (hit != NULL) return hit;\n }\n }\n \n // Child was not hit\n\n return getNeedsInputCallbacks() && inside ? this : NULL;\n}\n\nvoid HudObject::triggerMouseMove (lua_State *L, const Vector2 &screen_pos)\n{\n assertAlive();\n\n if (!isEnabled()) return;\n\n do {\n\n if (!needsInputCallbacks) continue;\n\n STACK_BASE;\n //stack is empty\n\n // error handler in case there is a problem during \n // the callback\n push_cfunction(L, my_lua_error_handler);\n int error_handler = lua_gettop(L);\n\n //stack: err\n\n // get the function\n hudClass->get(L,\"mouseMoveCallback\");\n //stack: err,callback\n if (lua_isnil(L,-1)) {\n // no parentResized callback -- our work is done\n lua_pop(L,2);\n STACK_CHECK;\n CERR << \"Hud object of class: \\\"\" << hudClass->name << \"\\\" has no mouseMoveCallback function, disabling input callbacks.\" << std::endl;\n needsInputCallbacks = false;\n continue; // to children\n }\n\n\n //stack: err,callback\n STACK_CHECK_N(2);\n\n push_hudobj(L, this);\n Vector2 local_pos = screenToLocal(screen_pos);\n push_v2(L, local_pos);\n push_v2(L, screen_pos);\n HudObject *ray_hit_obj = ray(screen_pos);\n bool hit_us = ray_hit_obj == this;\n bool hit_child = false;\n for (HudObject *p = ray_hit_obj ; p != nullptr ; p = p->getParent()) {\n if (p == this) {\n hit_child = true;\n break;\n }\n }\n lua_pushboolean(L, hit_us);\n lua_pushboolean(L, hit_child);\n //stack: err,callback,object,local_pos,screen_pos,inside\n\n STACK_CHECK_N(7);\n\n // call (1 arg), pops function too\n int status = lua_pcall(L,5,0,error_handler);\n if (status) {\n STACK_CHECK_N(2);\n //stack: err,error\n // pop the error message since the error handler will\n // have already printed it out\n lua_pop(L,1);\n CERR << \"Hud object of class: \\\"\" << hudClass->name << \"\\\" raised an error on mouseMoveCallback, disabling input callbacks.\" << std::endl;\n needsInputCallbacks = false;\n //stack: err\n STACK_CHECK_N(1);\n } else {\n //stack: err\n STACK_CHECK_N(1);\n }\n\n //stack: err\n STACK_CHECK_N(1);\n lua_pop(L,1);\n\n //stack is empty\n STACK_CHECK;\n\n } while (0);\n\n // note if we destroyed ourselves due to an error in the callback, children should be empty\n\n // use local_children copy since callbacks can alter hierarchy\n std::vector<HudObject*> local_children = get_all_hud_objects(children);\n for (unsigned j=0 ; j<local_children.size() ; ++j) {\n HudObject *obj = local_children[j];\n if (!obj->destroyed()) obj->triggerMouseMove(L, screen_pos);\n }\n dec_all_hud_objects(L, local_children);\n}\n\nvoid HudObject::triggerButton (lua_State *L, const std::string &name)\n{\n assertAlive();\n\n if (!isEnabled()) return;\n\n do {\n if (!needsInputCallbacks) continue;\n\n STACK_BASE;\n //stack is empty\n\n // error handler in case there is a problem during \n // the callback\n push_cfunction(L, my_lua_error_handler);\n int error_handler = lua_gettop(L);\n\n //stack: err\n\n // get the function\n hudClass->get(L,\"buttonCallback\");\n //stack: err,callback\n if (lua_isnil(L,-1)) {\n // no parentResized callback -- our work is done\n lua_pop(L,2);\n STACK_CHECK;\n CERR << \"Hud object of class: \\\"\" << hudClass->name << \"\\\" has no buttonCallback function, disabling input callbacks.\" << std::endl;\n needsInputCallbacks = false;\n continue; // to children\n }\n\n\n //stack: err,callback\n STACK_CHECK_N(2);\n\n push_hudobj(L, this);\n push_string(L, name);\n //stack: err,callback,object,size\n\n STACK_CHECK_N(4);\n\n // call (2 args), pops function too\n int status = lua_pcall(L,2,0,error_handler);\n if (status) {\n STACK_CHECK_N(2);\n //stack: err,error\n // pop the error message since the error handler will\n // have already printed it out\n lua_pop(L,1);\n CERR << \"Hud object of class: \\\"\" << hudClass->name << \"\\\" raised an error on buttonCallback, disabling input callbacks.\" << std::endl;\n needsInputCallbacks = false;\n //stack: err\n STACK_CHECK_N(1);\n } else {\n //stack: err\n STACK_CHECK_N(1);\n }\n\n //stack: err\n STACK_CHECK_N(1);\n lua_pop(L,1);\n\n //stack is empty\n STACK_CHECK;\n\n } while (0);\n\n // note if we destroyed ourselves due to an error in the callback, children should be empty\n\n // use local_children copy since callbacks can alter hierarchy\n std::vector<HudObject*> local_children = get_all_hud_objects(children);\n for (unsigned j=0 ; j<local_children.size() ; ++j) {\n HudObject *obj = local_children[j];\n if (!obj->destroyed()) obj->triggerButton(L, name);\n }\n dec_all_hud_objects(L, local_children);\n}\n\nvoid HudObject::triggerFrame (lua_State *L, float elapsed)\n{\n assertAlive();\n\n if (!isEnabled()) return;\n\n do {\n if (!needsFrameCallbacks) continue;\n\n STACK_BASE;\n //stack is empty\n\n // error handler in case there is a problem during \n // the callback\n push_cfunction(L, my_lua_error_handler);\n int error_handler = lua_gettop(L);\n\n //stack: err\n\n // get the function\n hudClass->get(L,\"frameCallback\");\n //stack: err,callback\n if (lua_isnil(L,-1)) {\n // no parentResized callback -- our work is done\n lua_pop(L,2);\n STACK_CHECK;\n CERR << \"Hud object of class: \\\"\" << hudClass->name << \"\\\" has no frameCallback function, disabling frame callbacks.\" << std::endl;\n needsFrameCallbacks = false;\n continue; // to children\n }\n\n\n //stack: err,callback\n STACK_CHECK_N(2);\n\n push_hudobj(L, this);\n lua_pushnumber(L, elapsed);\n //stack: err,callback,object,size\n\n STACK_CHECK_N(4);\n\n // call (1 arg), pops function too\n int status = lua_pcall(L,2,0,error_handler);\n if (status) {\n STACK_CHECK_N(2);\n //stack: err,error\n // pop the error message since the error handler will\n // have already printed it out\n lua_pop(L,1);\n CERR << \"Hud object of class: \\\"\" << hudClass->name << \"\\\" raised an error on frameCallback, disabling frame callbacks.\" << std::endl;\n needsFrameCallbacks = false;\n //stack: err\n STACK_CHECK_N(1);\n } else {\n //stack: err\n STACK_CHECK_N(1);\n }\n\n //stack: err\n STACK_CHECK_N(1);\n lua_pop(L,1);\n\n //stack is empty\n STACK_CHECK;\n\n } while (0);\n\n // note if we destroyed ourselves due to an error in the callback, children should be empty\n\n // use local_children copy since callbacks can alter hierarchy\n std::vector<HudObject*> local_children = get_all_hud_objects(children);\n for (unsigned j=0 ; j<local_children.size() ; ++j) {\n HudObject *obj = local_children[j];\n if (!obj->destroyed()) obj->triggerFrame(L, elapsed);\n }\n dec_all_hud_objects(L, local_children);\n}\n\nvoid HudObject::notifyChildAdd (HudBase *child)\n{\n children.push_back(child);\n}\n\nvoid HudObject::notifyChildRemove (HudBase *child)\n{\n children.erase(child);\n}\n\n\nvoid HudObject::triggerDestroy (lua_State *L)\n{\n assertAlive();\n STACK_BASE;\n //stack is empty\n\n // error handler in case there is a problem during \n // the callback\n push_cfunction(L, my_lua_error_handler);\n int error_handler = lua_gettop(L);\n\n //stack: err\n\n // get the function\n hudClass->get(L,\"destroy\");\n //stack: err,callback\n if (lua_isnil(L,-1)) {\n // no destroy callback -- our work is done\n lua_pop(L,2);\n STACK_CHECK;\n return;\n }\n\n\n //stack: err,callback\n STACK_CHECK_N(2);\n\n push_hudobj(L, this);\n //stack: err,callback,object\n\n STACK_CHECK_N(3);\n\n // call (1 arg), pops function too\n int status = lua_pcall(L,1,0,error_handler);\n if (status) {\n STACK_CHECK_N(2);\n //stack: err,error\n // pop the error message since the error handler will\n // have already printed it out\n lua_pop(L,1);\n //stack: err\n STACK_CHECK_N(1);\n } else {\n //stack: err\n STACK_CHECK_N(1);\n }\n\n //stack: err\n STACK_CHECK_N(1);\n lua_pop(L,1);\n\n //stack is empty\n STACK_CHECK;\n}\n\nvoid HudObject::setTexture (const DiskResourcePtr<GfxTextureDiskResource> &v)\n{\n assertAlive();\n if (v != nullptr) {\n if (!v->isLoaded()) v->load();\n }\n texture = v;\n texs.clear();\n if (v != nullptr)\n texs[\"tex\"] = gfx_texture_state_anisotropic(&*v);\n shader_rect->populateMatEnv(false, texs, shaderBinds, matEnvRect);\n}\n\nvoid HudObject::setStencilTexture (const DiskResourcePtr<GfxTextureDiskResource> &v)\n{\n assertAlive();\n if (v != nullptr) {\n if (!v->isLoaded()) v->load();\n }\n stencilTexture = v;\n stencilTexs.clear();\n if (v != nullptr)\n stencilTexs[\"tex\"] = gfx_texture_state_anisotropic(&*v);\n shader_stencil->populateMatEnv(false, stencilTexs, empty_binds, matEnvStencil);\n\n}\n\n// }}}\n\n\n// {{{ TEXT\n\nHudText::HudText (GfxFont *font)\n : buf(font), colour(1,1,1), alpha(1),\n letterTopColour(1,1,1), letterTopAlpha(1),\n letterBottomColour(1,1,1), letterBottomAlpha(1),\n wrap(0,0), scroll(0),\n shadow(0,0), shadowColour(0,0,0), shadowAlpha(1),\n refCount(0)\n{\n shaderBinds[\"colour\"] = colour;\n shaderBinds[\"alpha\"] = GfxGslParam::float1(alpha);\n\n shaderBindsShadow[\"colour\"] = shadowColour;\n shaderBindsShadow[\"alpha\"] = GfxGslParam::float1(shadowAlpha);\n\n GfxTextureDiskResource *tex = font->getTexture();\n texs[\"tex\"] = gfx_texture_state_anisotropic(tex);\n\n shader_text->populateMatEnv(false, texs, shaderBinds, matEnv);\n shader_text->populateMatEnv(false, texs, shaderBindsShadow, matEnvShadow);\n}\n\nvoid HudText::setAlpha (float v)\n{\n assertAlive();\n alpha = v;\n shaderBinds[\"alpha\"] = GfxGslParam::float1(alpha);\n}\n\nvoid HudText::setColour (const Vector3 &v)\n{\n assertAlive();\n colour = v;\n shaderBinds[\"colour\"] = colour;\n}\n\nvoid HudText::setShadowColour (const Vector3 &v)\n{\n assertAlive();\n shadowColour = v;\n shaderBindsShadow[\"colour\"] = shadowColour;\n}\n\nvoid HudText::setShadowAlpha (float v)\n{\n assertAlive();\n shadowAlpha = v;\n shaderBindsShadow[\"alpha\"] = GfxGslParam::float1(shadowAlpha);\n}\n\nvoid HudText::incRefCount (void)\n{\n refCount++;\n}\n\nvoid HudText::decRefCount (void)\n{\n refCount--;\n if (refCount == 0) {\n destroy();\n delete this;\n }\n}\n\nvoid HudText::destroy (void)\n{\n if (aliveness==ALIVE) {\n buf.clear();\n HudBase::destroy();\n }\n}\n\nvoid HudText::clear (void)\n{\n assertAlive();\n buf.clear();\n}\nvoid HudText::append (const std::string &v)\n{\n assertAlive();\n buf.addFormattedString(v, letterTopColour, letterTopAlpha, letterBottomColour, letterBottomAlpha);\n}\n\nstd::string HudText::getText (void) const\n{\n assertAlive();\n // TODO: support this, turn unicode cps into UTF8.\n //return buf.getText();\n return \"\";\n}\n\n// }}}\n\n\n\n\n// {{{ RENDERING\n\n\nGfxGslMeshEnvironment simple_mesh_env;\n\n// vdata/idata be allocated later because constructor requires ogre to be initialised\nstatic Ogre::VertexData *quad_vdata;\nstatic Ogre::HardwareVertexBufferSharedPtr quad_vbuf;\nstatic unsigned quad_vdecl_size;\n\n// vdata/idata be allocated later because constructor requires ogre to be initialised\nstatic Ogre::VertexData *cornered_quad_vdata;\nstatic Ogre::IndexData *cornered_quad_idata;\nstatic Ogre::HardwareVertexBufferSharedPtr cornered_quad_vbuf;\nstatic Ogre::HardwareIndexBufferSharedPtr cornered_quad_ibuf;\nstatic unsigned cornered_quad_vdecl_size;\n\nvoid hud_init (void)\n{\n win_size = Vector2(ogre_win->getWidth(), ogre_win->getHeight());\n\n // Prepare vertex buffers\n quad_vdata = OGRE_NEW Ogre::VertexData();\n quad_vdata->vertexStart = 0;\n quad_vdata->vertexCount = 6;\n quad_vdecl_size = 0;\n quad_vdecl_size += quad_vdata->vertexDeclaration->addElement(0, quad_vdecl_size, Ogre::VET_FLOAT2, Ogre::VES_POSITION).getSize();\n quad_vdecl_size += quad_vdata->vertexDeclaration->addElement(0, quad_vdecl_size, Ogre::VET_FLOAT2, Ogre::VES_TEXTURE_COORDINATES,0).getSize();\n quad_vbuf =\n Ogre::HardwareBufferManager::getSingleton().createVertexBuffer(\n quad_vdecl_size, 6, Ogre::HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY_DISCARDABLE);\n quad_vdata->vertexBufferBinding->setBinding(0, quad_vbuf);\n\n cornered_quad_vdata = OGRE_NEW Ogre::VertexData();\n cornered_quad_vdata->vertexStart = 0;\n cornered_quad_vdata->vertexCount = 16;\n cornered_quad_vdecl_size = 0;\n cornered_quad_vdecl_size += cornered_quad_vdata->vertexDeclaration->addElement(0, cornered_quad_vdecl_size, Ogre::VET_FLOAT2, Ogre::VES_POSITION).getSize();\n cornered_quad_vdecl_size += cornered_quad_vdata->vertexDeclaration->addElement(0, cornered_quad_vdecl_size, Ogre::VET_FLOAT2, Ogre::VES_TEXTURE_COORDINATES,0).getSize();\n cornered_quad_vbuf =\n Ogre::HardwareBufferManager::getSingleton().createVertexBuffer(\n cornered_quad_vdecl_size, 16, Ogre::HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY_DISCARDABLE);\n cornered_quad_vdata->vertexBufferBinding->setBinding(0, cornered_quad_vbuf);\n\n unsigned cornered_quad_indexes = 6*9;\n cornered_quad_ibuf =\n Ogre::HardwareBufferManager::getSingleton().createIndexBuffer(\n Ogre::HardwareIndexBuffer::IT_16BIT,\n cornered_quad_indexes,\n Ogre::HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY);\n\n cornered_quad_idata = OGRE_NEW Ogre::IndexData();\n cornered_quad_idata->indexStart = 0;\n cornered_quad_idata->indexCount = cornered_quad_indexes;\n cornered_quad_idata->indexBuffer = cornered_quad_ibuf;\n\n /* c d e f\n * 8 9 a b\n * 4 5 6 7 d c\n * 0 1 2 3 a b\n */\n #define QUAD(a,b,c,d) a, b, d, c, d, b\n uint16_t cornered_quad_idata_raw[] = {\n QUAD( 0, 1, 5, 4), QUAD( 1, 2, 6, 5), QUAD( 2, 3, 7, 6),\n QUAD( 4, 5, 9, 8), QUAD( 5, 6,10, 9), QUAD( 6, 7,11,10),\n QUAD( 8, 9,13,12), QUAD( 9,10,14,13), QUAD(10,11,15,14),\n };\n #undef QUAD\n\n cornered_quad_ibuf->writeData(\n 0, cornered_quad_indexes*sizeof(uint16_t), &cornered_quad_idata_raw[0], true);\n\n GfxGslRunParams shader_rect_params = {\n {\"colour\", GfxGslParam::float3(1, 1, 1)},\n {\"alpha\", GfxGslParam::float1(1.0f)},\n {\"tex\", GfxGslParam(GFX_GSL_FLOAT_TEXTURE2, 1, 1, 1, 1)}\n };\n GfxGslRunParams shader_stencil_params = {\n {\"tex\", GfxGslParam(GFX_GSL_FLOAT_TEXTURE2, 1, 1, 1, 1)}\n };\n GfxGslRunParams shader_text_params = {\n {\"colour\", GfxGslParam::float3(1, 1, 1)},\n {\"alpha\", GfxGslParam::float1(1.0f)},\n {\"tex\", GfxGslParam(GFX_GSL_FLOAT_TEXTURE2, 1, 1, 1, 1)}\n };\n\n std::string vertex_code =\n \"out.position = transform_to_world(Float3(vert.position.xy, 0));\\n\";\n\n // Note this never discards, even if alpha == 0. This is important because we use it\n // to populate the stencil buffer to mask children at the bounds of the object.\n std::string rect_colour_code =\n \"var texel = sample(mat.tex, vert.coord0.xy);\\n\"\n \"out.colour = texel.rgb * mat.colour;\\n\"\n \"out.alpha = texel.a * mat.alpha;\\n\"\n \"out.colour = out.colour * out.alpha;\\n\";\n\n std::string stencil_colour_code =\n \"var texel = sample(mat.tex, vert.coord0.xy);\\n\"\n \"if (texel.a < 0.5) discard;\\n\";\n\n std::string text_colour_code =\n \"var texel = sample(mat.tex, vert.coord0.xy);\\n\"\n \"out.colour = texel.rgb * vert.coord1.rgb * mat.colour;\\n\"\n \"out.alpha = texel.a * vert.coord1.a * mat.alpha;\\n\"\n \"out.colour = out.colour * out.alpha;\\n\";\n\n gfx_shader_check(\n \"/system/HudRect\", vertex_code, \"\", rect_colour_code, shader_rect_params, false);\n gfx_shader_check(\n \"/system/HudStencil\", vertex_code, \"\", stencil_colour_code, shader_stencil_params, false);\n gfx_shader_check(\n \"/system/HudText\", vertex_code, \"\", text_colour_code, shader_text_params, false);\n\n shader_rect = gfx_shader_make_or_reset(\n \"/system/HudRect\", vertex_code, \"\", rect_colour_code, shader_rect_params, false);\n\n shader_stencil = gfx_shader_make_or_reset(\n \"/system/HudStencil\", vertex_code, \"\", stencil_colour_code, shader_stencil_params, false);\n \n shader_text = gfx_shader_make_or_reset(\n \"/system/HudText\", vertex_code, \"\", text_colour_code, shader_text_params, false);\n\n}\n\nvoid hud_shutdown (lua_State *L)\n{\n quad_vbuf.setNull();\n OGRE_DELETE quad_vdata;\n cornered_quad_vbuf.setNull();\n OGRE_DELETE cornered_quad_vdata;\n\n // Not all destroy callbacks actually destroy their children. Orphaned\n // children end up being adopted by grandparents, and ultimately the root. If\n // hud elements are left at the root until Lua state destruction, the gc\n // callbacks are called in an arbitrary order. That can cause undefined\n // behaviour on the c++ side (access of deleted objects). So we aggressively\n // destroy all the root elements before the actual lua shutdown. This causes\n // the callbacks to run in the correct order, and avoid segfaults.\n\n while (root_elements.size() > 0) {\n // First clean up all the non Lua ones. This is the easy part.\n\n // Copy into an intermediate buffer, since calling destroy changes root_elements.\n std::vector<HudBase*> all_non_lua;\n for (unsigned j=0 ; j<root_elements.size() ; ++j) {\n HudBase *base = root_elements[j];\n if (dynamic_cast<HudObject*>(base) == NULL) all_non_lua.push_back(base);\n }\n for (unsigned j=0 ; j<all_non_lua.size() ; ++j) {\n all_non_lua[j]->destroy();\n }\n\n // Now kill the ones with lua callbacks.\n std::vector<HudObject*> local_root_objects = get_all_hud_objects(root_elements);\n for (unsigned j=0 ; j<local_root_objects.size() ; ++j) {\n HudObject *obj = local_root_objects[j];\n if (obj->destroyed()) continue;\n obj->destroy(L);\n }\n\n dec_all_hud_objects(L, local_root_objects);\n }\n}\n\nstatic inline Vector2 maybe_snap (bool snap, Vector2 pos)\n{\n if (snap) {\n pos.x = ::floorf(pos.x);\n pos.y = ::floorf(pos.y);\n }\n return pos;\n}\n\nstatic void set_vertex_data (const Vector2 &size,\n const Vector2 &uv1, const Vector2 &uv2)\n{\n // strict alignment required here\n struct Vertex { Vector2 position; Vector2 uv; };\n\n float left = -size.x / 2;\n float right = size.x / 2;\n float bottom = -size.y / 2;\n float top = size.y / 2;\n\n Vertex bottom_left = { Vector2(left, bottom), Vector2(uv1.x,uv2.y) };\n Vertex bottom_right = { Vector2(right, bottom), uv2 };\n Vertex top_left = { Vector2(left, top), uv1 };\n Vertex top_right = { Vector2(right, top), Vector2(uv2.x,uv1.y) };\n\n Vertex vdata_raw[] = {\n bottom_left, bottom_right, top_left,\n top_left, bottom_right, top_right\n };\n\n quad_vbuf->writeData(quad_vdata->vertexStart, quad_vdata->vertexCount*quad_vdecl_size,\n vdata_raw, true);\n}\n\nstatic void set_cornered_vertex_data (GfxTextureDiskResource *tex,\n const Vector2 &size,\n const Vector2 &uv1, const Vector2 &uv2)\n{\n // strict alignment required here\n struct Vertex { Vector2 position; Vector2 uv; };\n\n const Ogre::TexturePtr &texptr = tex->getOgreTexturePtr();\n texptr->load();\n const Vector2 whole_tex_size(texptr->getWidth(), texptr->getHeight());\n \n const Vector2 tex_size = whole_tex_size * Vector2(::fabsf(uv2.x-uv1.x), ::fabsf(uv2.y-uv1.y));\n const Vector2 uvm = (uv2+uv1)/2;\n\n const Vector2 diag0 = -size/2;\n const Vector2 diag3 = size/2;\n const Vector2 diag1 = diag0 + tex_size/2;\n const Vector2 diag2 = diag3 - tex_size/2;\n\n /* c d e f\n * 8 9 a b\n * 4 5 6 7\n * 0 1 2 3\n */\n\n Vertex vdata_raw[] = {\n { Vector2(diag0.x, diag0.y), Vector2(uv1.x, uv2.y) },\n { Vector2(diag1.x, diag0.y), Vector2(uvm.x, uv2.y) },\n { Vector2(diag2.x, diag0.y), Vector2(uvm.x, uv2.y) },\n { Vector2(diag3.x, diag0.y), Vector2(uv2.x, uv2.y) },\n\n { Vector2(diag0.x, diag1.y), Vector2(uv1.x, uvm.y) },\n { Vector2(diag1.x, diag1.y), Vector2(uvm.x, uvm.y) },\n { Vector2(diag2.x, diag1.y), Vector2(uvm.x, uvm.y) },\n { Vector2(diag3.x, diag1.y), Vector2(uv2.x, uvm.y) },\n\n { Vector2(diag0.x, diag2.y), Vector2(uv1.x, uvm.y) },\n { Vector2(diag1.x, diag2.y), Vector2(uvm.x, uvm.y) },\n { Vector2(diag2.x, diag2.y), Vector2(uvm.x, uvm.y) },\n { Vector2(diag3.x, diag2.y), Vector2(uv2.x, uvm.y) },\n\n { Vector2(diag0.x, diag3.y), Vector2(uv1.x, uv1.y) },\n { Vector2(diag1.x, diag3.y), Vector2(uvm.x, uv1.y) },\n { Vector2(diag2.x, diag3.y), Vector2(uvm.x, uv1.y) },\n { Vector2(diag3.x, diag3.y), Vector2(uv2.x, uv1.y) },\n };\n\n cornered_quad_vbuf->writeData(cornered_quad_vdata->vertexStart,\n cornered_quad_vdata->vertexCount*cornered_quad_vdecl_size,\n vdata_raw, true);\n}\n\nvoid gfx_render_hud_text (HudText *text, bool shadow, const Vector2 &offset,\n int parent_stencil_ref)\n{\n GfxFont *font = text->getFont();\n GfxTextureDiskResource *tex = font->getTexture();\n\n // In case the font has changed texture.\n // Note that we do not have to rebuild the GfxGasolineMaterialEnvironments because\n // they only care about whether a texture was bound, not which one.\n text->texs[\"tex\"] = gfx_texture_state_anisotropic(tex);\n\n Vector2 pos = text->getDerivedPosition();\n if (text->snapPixels) {\n if (int(text->getDerivedBounds().x + 0.5) % 2 == 1)\n pos.x += 0.5f;\n if (int(text->getDerivedBounds().y + 0.5) % 2 == 1)\n pos.y += 0.5f;\n pos.x = ::floorf(pos.x);\n pos.y = ::floorf(pos.y);\n if (int(text->getDerivedBounds().x + 0.5) % 2 == 1)\n pos.x -= 0.5f;\n if (int(text->getDerivedBounds().y + 0.5) % 2 == 1)\n pos.y -= 0.5f;\n }\n pos += offset;\n\n const Ogre::Matrix4 &I = Ogre::Matrix4::IDENTITY;\n\n Ogre::Matrix4 matrix_centre = I;\n // move origin to center (for rotation)\n matrix_centre.setTrans(Ogre::Vector3(-text->getSize().x/2, text->getSize().y/2, 0));\n\n const Degree &orientation = text->getDerivedOrientation();\n Ogre::Matrix4 matrix_spin(Ogre::Quaternion(to_ogre(orientation), Ogre::Vector3(0,0,-1)));\n\n Ogre::Matrix4 matrix_trans = I;\n matrix_trans.setTrans(Ogre::Vector3(pos.x, pos.y, 0));\n\n Ogre::Matrix4 matrix_d3d_offset = I;\n if (d3d9) {\n // offsets for D3D rasterisation quirks, see http://msdn.microsoft.com/en-us/library/windows/desktop/bb219690(v=vs.85).aspx\n matrix_d3d_offset.setTrans(Ogre::Vector3(-0.5-win_size.x/2, 0.5-win_size.y/2, 0));\n } else {\n matrix_d3d_offset.setTrans(Ogre::Vector3(-win_size.x/2, -win_size.y/2, 0));\n }\n\n Ogre::Matrix4 matrix_scale = I;\n matrix_scale.setScale(Ogre::Vector3(2/win_size.x, 2/win_size.y ,1));\n\n // TODO: render target flipping (see comment in text rendering, above)\n bool render_target_flipping = false;\n Ogre::Matrix4 matrix = matrix_scale * matrix_d3d_offset * matrix_trans * matrix_spin * matrix_centre;\n\n Vector3 zv(0,0,0);\n GfxShaderGlobals globs = {\n zv, I, I, I, zv, zv, zv, zv, win_size, render_target_flipping, nullptr\n };\n\n if (shadow) {\n shader_text->bindShader(GFX_GSL_PURPOSE_HUD, text->matEnvShadow, simple_mesh_env,\n globs, matrix, nullptr, 0, 1, text->texs, text->shaderBindsShadow);\n } else {\n shader_text->bindShader(GFX_GSL_PURPOSE_HUD, text->matEnv, simple_mesh_env,\n globs, matrix, nullptr, 0, 1, text->texs, text->shaderBinds);\n }\n\n\n ogre_rs->setStencilBufferParams(Ogre::CMPF_EQUAL, parent_stencil_ref);\n\n\n if (text->buf.getRenderOperation().indexData->indexCount > 0) {\n ogre_rs->_render(text->buf.getRenderOperation());\n }\n\n ogre_rs->_disableTextureUnit(0);\n}\n\n\nvoid gfx_render_hud_one (HudBase *base, int parent_stencil_ref)\n{\n if (!base->isEnabled()) return;\n if (base->destroyed()) return;\n\n HudObject *obj = dynamic_cast<HudObject*>(base);\n if (obj != nullptr) {\n\n bool is_cornered = obj->isCornered();\n\n Vector2 uv1 = obj->getUV1();\n Vector2 uv2 = obj->getUV2();\n\n Vector2 pos = obj->getDerivedPosition();\n if (obj->snapPixels) {\n if (int(obj->getDerivedBounds().x + 0.5) % 2 == 1)\n pos.x += 0.5f;\n if (int(obj->getDerivedBounds().y + 0.5) % 2 == 1)\n pos.y += 0.5f;\n pos.x = ::floorf(pos.x);\n pos.y = ::floorf(pos.y);\n if (int(obj->getDerivedBounds().x + 0.5) % 2 == 1)\n pos.x -= 0.5f;\n if (int(obj->getDerivedBounds().y + 0.5) % 2 == 1)\n pos.y -= 0.5f;\n }\n\n GfxTextureDiskResource *tex = obj->getTexture();\n if (is_cornered && tex != nullptr) {\n set_cornered_vertex_data(tex, obj->getSize(), uv1, uv2);\n } else {\n set_vertex_data(obj->getSize(), uv1, uv2);\n }\n\n const Degree &orientation = obj->getDerivedOrientation();\n Ogre::Matrix4 matrix_spin(Ogre::Quaternion(to_ogre(orientation), Ogre::Vector3(0,0,-1)));\n\n const Ogre::Matrix4 &I = Ogre::Matrix4::IDENTITY;\n\n Ogre::Matrix4 matrix_trans = I;\n matrix_trans.setTrans(Ogre::Vector3(pos.x, pos.y, 0));\n\n Ogre::Matrix4 matrix_d3d_offset = I;\n if (d3d9) {\n // offsets for D3D rasterisation quirks, see http://msdn.microsoft.com/en-us/library/windows/desktop/bb219690(v=vs.85).aspx\n matrix_d3d_offset.setTrans(Ogre::Vector3(-0.5-win_size.x/2, 0.5-win_size.y/2, 0));\n } else {\n matrix_d3d_offset.setTrans(Ogre::Vector3(-win_size.x/2, -win_size.y/2, 0));\n }\n\n Ogre::Matrix4 matrix_scale = I;\n matrix_scale.setScale(Ogre::Vector3(2/win_size.x, 2/win_size.y, 1));\n\n // TODO: Is there no render target flipping?\n // I guess we never rendered HUD to a texture on GL?\n bool render_target_flipping = false;\n Ogre::Matrix4 matrix = matrix_scale * matrix_d3d_offset * matrix_trans * matrix_spin;\n\n Vector3 zv(0,0,0);\n GfxShaderGlobals globs = { zv, I, I, I, zv, zv, zv, zv, win_size, render_target_flipping,\n nullptr };\n\n Ogre::RenderOperation op;\n if (is_cornered && tex != nullptr) {\n op.useIndexes = true;\n op.vertexData = cornered_quad_vdata;\n op.indexData = cornered_quad_idata;\n } else {\n op.useIndexes = false;\n op.vertexData = quad_vdata;\n }\n op.operationType = Ogre::RenderOperation::OT_TRIANGLE_LIST;\n\n shader_rect->bindShader(GFX_GSL_PURPOSE_HUD, obj->matEnvRect, simple_mesh_env,\n globs, matrix, nullptr, 0, 1, obj->texs, obj->shaderBinds);\n\n // First only draw our colour if we fit inside our parent.\n ogre_rs->setStencilBufferParams(\n Ogre::CMPF_EQUAL, parent_stencil_ref, 0xffffffff, 0xffffffff,\n Ogre::SOP_KEEP, Ogre::SOP_KEEP, Ogre::SOP_KEEP);\n\n ogre_rs->_render(op);\n\n int child_stencil_ref = parent_stencil_ref;\n if (obj->isStencil()) {\n\n GfxTextureDiskResource *stencil_tex = obj->getStencilTexture();\n if (is_cornered && stencil_tex != nullptr) {\n set_cornered_vertex_data(stencil_tex, obj->getSize(), uv1, uv2);\n } else {\n set_vertex_data(obj->getSize(), uv1, uv2);\n }\n\n\n // Paint a rectangle in the stencil buffer to mask our children, but we\n // ourselves are still masked by our parent.\n child_stencil_ref += 1;\n\n ogre_rs->setStencilBufferParams(\n Ogre::CMPF_EQUAL, parent_stencil_ref, 0xffffffff, 0xffffffff,\n Ogre::SOP_KEEP, Ogre::SOP_KEEP, Ogre::SOP_INCREMENT);\n\n ogre_rs->_setColourBufferWriteEnabled(false, false, false, false);\n shader_stencil->bindShader(GFX_GSL_PURPOSE_HUD, obj->matEnvStencil, simple_mesh_env,\n globs, matrix, nullptr, 0, 1, obj->stencilTexs,\n empty_binds);\n\n ogre_rs->_render(op);\n ogre_rs->_setColourBufferWriteEnabled(true, true, true, true);\n }\n\n if (tex != NULL) {\n ogre_rs->_disableTextureUnit(0);\n }\n\n for (unsigned i=0 ; i<=GFX_HUD_ZORDER_MAX ; ++i) {\n for (unsigned j=0 ; j<obj->children.size() ; ++j) {\n // Draw in reverse order, for consistency with ray priority\n HudBase *child = obj->children[obj->children.size() - j - 1];\n if (child->getZOrder() != i) continue;\n gfx_render_hud_one(child, child_stencil_ref);\n }\n }\n\n if (obj->isStencil()) {\n ogre_rs->setStencilBufferParams(\n Ogre::CMPF_LESS_EQUAL, parent_stencil_ref, 0xffffffff, 0xffffffff,\n Ogre::SOP_KEEP, Ogre::SOP_KEEP, Ogre::SOP_REPLACE);\n\n ogre_rs->_setColourBufferWriteEnabled(false, false, false, false);\n shader_stencil->bindShader(GFX_GSL_PURPOSE_HUD, obj->matEnvStencil, simple_mesh_env,\n globs, matrix, nullptr, 0, 1, obj->stencilTexs,\n empty_binds);\n\n ogre_rs->_render(op);\n ogre_rs->_setColourBufferWriteEnabled(true, true, true, true);\n }\n }\n\n HudText *text = dynamic_cast<HudText*>(base);\n if (text != nullptr) {\n\n text->buf.updateGPU(text->wrap == Vector2(0, 0), text->scroll, text->scroll+text->wrap.y);\n\n if (text->getShadow() != Vector2(0, 0)) {\n gfx_render_hud_text(text, true, text->getShadow(), parent_stencil_ref);\n }\n gfx_render_hud_text(text, false, Vector2(0, 0), parent_stencil_ref);\n }\n}\n\nvoid hud_render (Ogre::Viewport *vp)\n{\n ogre_rs->_setViewport(vp);\n\n ogre_rs->_beginFrame();\n\n\n ogre_rs->clearFrameBuffer(Ogre::FBT_STENCIL);\n\n ogre_rs->_setDepthBias(0, 0);\n ogre_rs->_setPolygonMode(Ogre::PM_SOLID);\n ogre_rs->setStencilCheckEnabled(true);\n ogre_rs->_setCullingMode(Ogre::CULL_NONE);\n ogre_rs->_setDepthBufferParams(false, false, Ogre::CMPF_LESS_EQUAL);\n ogre_rs->_setSceneBlending(Ogre::SBF_ONE, Ogre::SBF_ONE_MINUS_SOURCE_ALPHA);\n\n try {\n\n for (unsigned i=0 ; i<=GFX_HUD_ZORDER_MAX ; ++i) {\n for (unsigned j=0 ; j<root_elements.size() ; ++j) {\n HudBase *el = root_elements[root_elements.size() - j - 1];\n if (el->getZOrder() != i) continue;\n gfx_render_hud_one(el, 0);\n }\n }\n\n } catch (const Exception &e) {\n CERR << \"Rendering HUD, got: \" << e << std::endl;\n } catch (const Ogre::Exception &e) {\n CERR << \"Rendering HUD, got: \" << e.getDescription() << std::endl;\n }\n\n ogre_rs->setStencilCheckEnabled(false);\n\n ogre_rs->_endFrame();\n\n}\n\n// }}}\n\n\n// {{{ RESIZE\n\n// when true, triggers resize callbacks at the root\nstatic bool window_size_dirty;\n\nvoid hud_signal_window_resized (unsigned w, unsigned h)\n{\n Vector2 new_win_size = Vector2(float(w),float(h));\n if (win_size == new_win_size) return;\n win_size = new_win_size;\n window_size_dirty = true;\n}\n\nvoid hud_call_per_frame_callbacks (lua_State *L, float elapsed)\n{\n\n std::vector<HudObject*> local_root_objects = get_all_hud_objects(root_elements);\n\n if (window_size_dirty) {\n window_size_dirty = false;\n for (unsigned j=0 ; j<local_root_objects.size() ; ++j) {\n HudObject *obj = local_root_objects[j];\n if (obj->destroyed()) continue;\n obj->triggerParentResized(L);\n }\n }\n\n for (unsigned j=0 ; j<local_root_objects.size() ; ++j) {\n HudObject *obj = local_root_objects[j];\n if (obj->destroyed()) continue;\n obj->triggerFrame(L, elapsed);\n }\n\n dec_all_hud_objects(L, local_root_objects);\n}\n\n// }}}\n\n\n// {{{ INPUT\n\nHudObject *hud_ray (int x, int y)\n{\n Vector2 screen_pos(x,y);\n return ray(screen_pos);\n}\n\nstatic Vector2 last_mouse_abs;\nvoid hud_signal_mouse_move (lua_State *L, const Vector2 &abs)\n{\n // make local copy because callbacks can destroy elements\n std::vector<HudObject*> local_root_objects = get_all_hud_objects(root_elements);\n\n for (unsigned j=0 ; j<local_root_objects.size() ; ++j) {\n HudObject *obj = local_root_objects[j];\n if (obj->destroyed()) continue;\n obj->triggerMouseMove(L, abs);\n }\n\n dec_all_hud_objects(L, local_root_objects);\n last_mouse_abs = abs;\n}\n\nvoid hud_signal_button (lua_State *L, const std::string &key)\n{\n // make local copy because callbacks can destroy elements\n std::vector<HudObject*> local_root_objects = get_all_hud_objects(root_elements);\n\n for (unsigned j=0 ; j<local_root_objects.size() ; ++j) {\n HudObject *obj = local_root_objects[j];\n if (obj->destroyed()) continue;\n obj->triggerMouseMove(L, last_mouse_abs);\n obj->triggerButton(L, key);\n }\n\n dec_all_hud_objects(L, local_root_objects);\n}\n\nvoid hud_signal_flush (lua_State *L)\n{\n (void) L;\n // TODO: issue 'fake' key up for any keys that are still down.\n}\n// }}}\n" }, { "alpha_fraction": 0.514104425907135, "alphanum_fraction": 0.5217691659927368, "avg_line_length": 35.59080505371094, "blob_id": "240ea552412a04b963b8e7fbd977d4ada7c15f02", "content_id": "0442d023f5a34d721b7102ab684a0fcd930045be", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 15917, "license_type": "permissive", "max_line_length": 97, "num_lines": 435, "path": "/engine/physics/bcol_parser.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <cmath>\n\n#include <sstream>\n\n#include <portable_io.h>\n\n#include \"col_defaults.h\"\n#include \"bcol_parser.h\"\n#include \"tcol_parser.h\"\n\nstatic inline bool fnear(const float x, const float y)\n{\n return fabs(x-y) < 1E-6;\n}\n\nstatic inline bool ffar(const float x, const float y)\n{\n return !fnear(x,y);\n}\n\nvoid pretty_print_material (std::ostream &o, BColMat &material)\n{\n o << \"\\\"\" << material.name() << \"\\\"\";\n}\n\nvoid write_bcol_as_tcol (std::ostream &o, BColFile &f)\n{\n o << std::fixed; // use fixed point (no exponents)\n\n o << \"TCOL1.0\\n\\n\"\n << \"attributes {\\n\";\n if (f.mass==0) {\n o << \"\\tstatic;\\n\";\n } else {\n o << \"\\tmass \" << f.mass << \";\\n\";\n }\n/*\n o << \"\\tinertia \" << f.inertia_x << \" \"\n << f.inertia_y << \" \"\n << f.inertia_z << \";\\n\";\n*/\n if (ffar(f.linearDamping,DEFAULT_LINEAR_DAMPING))\n o << \"\\tlinear_damping \" << f.linearDamping << \";\\n\";\n if (ffar(f.angularDamping,DEFAULT_ANGULAR_DAMPING))\n o << \"\\tangular_damping \" << f.angularDamping << \";\\n\";\n if (ffar(f.linearSleepThreshold,DEFAULT_LINEAR_SLEEP_THRESHOLD))\n o << \"\\tlinear_sleep_threshold \" << f.linearSleepThreshold << \";\\n\";\n if (ffar(f.angularSleepThreshold,DEFAULT_ANGULAR_SLEEP_THRESHOLD))\n o << \"\\tangular_sleep_threshold \" << f.angularSleepThreshold << \";\\n\";\n if (ffar(f.ccdMotionThreshold,DEFAULT_CCD_MOTION_THRESHOLD))\n o << \"\\tccd_motion_threshold \" << f.ccdMotionThreshold << \";\\n\";\n if (ffar(f.ccdSweptSphereRadius,DEFAULT_CCD_SWEPT_SPHERE_RADIUS))\n o << \"\\tccd_swept_sphere_radius \" << f.ccdSweptSphereRadius << \";\\n\";\n o << \"}\\n\\n\";\n\n if (f.totalCompoundElements() > 0 || f.triMeshFaceNum == 0) {\n o << \"compound {\\n\";\n\n for (size_t i=0 ; i<f.hullNum ; ++i) {\n BColHull &h = *f.hulls(i);\n o<<\"\\t\"<<\"hull {\\n\";\n //o<<\"\\t\\t\"<<\"material \"; pretty_print_material(o, h.mat); o<<\";\\n\";\n if (ffar(h.margin,DEFAULT_MARGIN)) {\n o<<\"\\t\\t\"<<\"margin \"<<h.margin<<\";\\n\";\n }\n o<<\"\\t\\t\"<<\"vertexes {\\n\";\n for (unsigned j=0 ; j<h.vertNum ; ++j) {\n BColVert &v = *h.verts(j);\n o<<\"\\t\\t\\t\"<<v.x<<\" \"<<v.y<<\" \"<<v.z<<\";\"<<\"\\n\";\n }\n o<<\"\\t\\t\"<<\"}\\n\";\n o<<\"\\t\"<<\"}\\n\";\n }\n\n for (size_t i=0 ; i<f.boxNum ; ++i) {\n BColBox &b = *f.boxes(i);\n o<<\"\\t\"<<\"box {\\n\";\n o<<\"\\t\\t\"<<\"material \"; pretty_print_material(o, b.mat); o<<\";\\n\";\n if (ffar(b.margin,DEFAULT_MARGIN)) {\n o<<\"\\t\\t\"<<\"margin \"<<b.margin<<\";\\n\";\n }\n o<<\"\\t\\t\"<<\"centre \"<<b.px\n <<\" \"<<b.py<<\" \"<<b.pz<<\";\\n\";\n if (ffar(b.qw,1) && ffar(b.qx,0) &&\n ffar(b.qy,0) && ffar(b.qz,0)) {\n o<<\"\\t\\t\"<<\"orientation \"<<b.qw<<\" \"<<b.qx\n <<\" \"<<b.qy<<\" \"<<b.qz<<\";\\n\";\n }\n o<<\"\\t\\t\"<<\"dimensions \"<<b.dx<<\" \"<<b.dy\n <<\" \"<<b.dz<<\";\\n\";\n o<<\"\\t\"<<\"}\\n\";\n }\n\n for (size_t i=0 ; i<f.cylNum ; ++i) {\n BColCyl &cyl = *f.cyls(i);\n o<<\"\\t\"<<\"cylinder {\\n\";\n o<<\"\\t\\t\"<<\"material \"; pretty_print_material(o, cyl.mat); o<<\";\\n\";\n if (ffar(cyl.margin,DEFAULT_MARGIN)) {\n o<<\"\\t\\t\"<<\"margin \"<<cyl.margin<<\";\\n\";\n } \n o<<\"\\t\\t\"<<\"centre \"<<cyl.px\n <<\" \"<<cyl.py<<\" \"<<cyl.pz<<\";\\n\";\n if (ffar(cyl.qw,1) && ffar(cyl.qx,0) &&\n ffar(cyl.qy,0) && ffar(cyl.qz,0)) {\n o<<\"\\t\\t\"<<\"orientation \"<<cyl.qw<<\" \"<<cyl.qx\n <<\" \"<<cyl.qy<<\" \"<<cyl.qz<<\";\\n\";\n }\n o<<\"\\t\\t\"<<\"dimensions \"<<cyl.dx<<\" \"<<cyl.dy\n <<\" \"<<cyl.dz<<\";\\n\";\n o<<\"\\t\"<<\"}\\n\";\n }\n\n for (size_t i=0 ; i<f.coneNum ; ++i) {\n BColCone &cone = *f.cones(i);\n o<<\"\\t\"<<\"cone {\\n\";\n o<<\"\\t\\t\"<<\"material \"; pretty_print_material(o, cone.mat); o<<\";\\n\";\n if (ffar(cone.margin,DEFAULT_MARGIN)) {\n o<<\"\\t\\t\"<<\"margin \"<<cone.margin<<\";\\n\";\n }\n o<<\"\\t\\t\"<<\"centre \"<<cone.px\n <<\" \"<<cone.py<<\" \"<<cone.pz<<\";\\n\";\n if (ffar(cone.qw,1) && ffar(cone.qx,0) &&\n ffar(cone.qy,0) && ffar(cone.qz,0)) {\n o<<\"\\t\\t\"<<\"orientation \"<<cone.qw<<\" \"<<cone.qx\n <<\" \"<<cone.qy<<\" \"<<cone.qz<<\";\\n\";\n }\n o<<\"\\t\\t\"<<\"radius \"<<cone.radius<<\";\\n\";\n o<<\"\\t\\t\"<<\"height \"<<cone.height<<\";\\n\";\n o<<\"\\t\"<<\"}\\n\";\n }\n \n for (size_t i=0 ; i<f.planeNum ; ++i) {\n BColPlane &p = *f.planes(i);\n o<<\"\\t\"<<\"plane {\\n\";\n o<<\"\\t\\t\"<<\"material \"; pretty_print_material(o, p.mat); o<<\";\\n\";\n o<<\"\\t\\t\"<<\"normal \"<<p.nx<<\" \"<<p.ny<<\" \"<<p.nz<<\";\\n\";\n o<<\"\\t\\t\"<<\"distance \"<<p.d<<\";\\n\";\n o<<\"\\t\"<<\"}\\n\";\n }\n\n for (size_t i=0 ; i<f.sphereNum ; ++i) {\n BColSphere &s = *f.spheres(i);\n o<<\"\\t\"<<\"sphere {\\n\";\n o<<\"\\t\\t\"<<\"material \"; pretty_print_material(o, s.mat); o<<\";\\n\";\n o<<\"\\t\\t\"<<\"centre \"<<s.px<<\" \"<<s.py<<\" \"<<s.pz<<\";\\n\";\n o<<\"\\t\\t\"<<\"radius \"<<s.radius<<\";\\n\";\n o<<\"\\t\"<<\"}\\n\";\n }\n\n o << \"}\\n\"; \n }\n\n if (f.triMeshFaceNum > 0) {\n o << \"trimesh {\\n\";\n if (ffar(f.triMeshMargin,0.0)) {\n o<<\"\\t\"<<\"margin \"<<f.triMeshMargin<<\";\\n\";\n }\n o << \"\\tedge_distance_threshold \"<<f.triMeshEdgeDistanceThreshold<<\";\\n\";\n o << \"\\tvertexes {\\n\";\n for (unsigned i=0 ; i<f.triMeshVertNum ; ++i) {\n BColVert &v = *f.triMeshVerts(i);\n o<<\"\\t\\t\"<<v.x<<\" \"<<v.y<<\" \"<<v.z<<\";\"<<\"\\n\";\n }\n o << \"\\t}\\n\";\n o << \"\\tfaces {\\n\";\n for (unsigned i=0 ; i<f.triMeshFaceNum ; ++i) {\n BColFace &face = *f.triMeshFaces(i);\n o<<\"\\t\\t\"<<face.v1<<\" \"<<face.v2<<\" \"<<face.v3<<\" \";\n pretty_print_material(o, face.mat);\n o<<\";\"<<\"\\n\";\n }\n o << \"\\t}\\n\";\n o << \"}\\n\";\n }\n}\n\nnamespace {\n\n\n}\n\nvoid write_tcol_as_bcol (std::ostream &o, TColFile &f)\n{\n\n TColCompound &c = f.compound;\n TColTriMesh &t = f.triMesh;\n\n const size_t hull_start = BColFile::size();\n const size_t box_start = hull_start + BColHull::size()*c.hulls.size();\n const size_t cyl_start = box_start + BColBox::size()*c.boxes.size();\n const size_t cone_start = cyl_start + BColCyl::size()*c.cylinders.size();\n const size_t plane_start = cone_start + BColCone::size()*c.cones.size();\n const size_t sphere_start = plane_start + BColPlane::size()*c.planes.size();\n const size_t hull_verts_start = sphere_start + BColSphere::size()*c.spheres.size();\n\n size_t trimesh_vert_start = hull_verts_start;\n for (unsigned i=0 ; i<c.hulls.size() ; ++i) {\n size_t n = c.hulls[i].vertexes.size();\n trimesh_vert_start += BColVert::size() * n;\n }\n\n size_t trimesh_face_start = trimesh_vert_start + BColVert::size()*t.vertexes.size();\n size_t text_start = trimesh_face_start + BColFace::size()*t.faces.size();\n\n ios_write_byte_array(o, \"BCOL1.0\\n\", 8);\n ios_write_float(o, f.mass);\n ios_write_u32(o, f.hasInertia);\n ios_write_float(o,f.inertia_x);\n ios_write_float(o,f.inertia_y);\n ios_write_float(o,f.inertia_z);\n ios_write_float(o,f.linearDamping);\n ios_write_float(o,f.angularDamping);\n ios_write_float(o,f.linearSleepThreshold);\n ios_write_float(o,f.angularSleepThreshold);\n ios_write_float(o,f.ccdMotionThreshold);\n ios_write_float(o,f.ccdSweptSphereRadius);\n ios_write_u32(o, c.hulls.size()); ios_write_u32(o, hull_start); // hull\n ios_write_u32(o, c.boxes.size()); ios_write_u32(o, box_start); // box\n ios_write_u32(o, c.cylinders.size()); ios_write_u32(o, cyl_start); // cyl\n ios_write_u32(o, c.cones.size()); ios_write_u32(o, cone_start); // cone\n ios_write_u32(o, c.planes.size()); ios_write_u32(o, plane_start); // plane\n ios_write_u32(o, c.spheres.size()); ios_write_u32(o, sphere_start); // sphere\n ios_write_u32(o, 0); ios_write_u32(o, 0); // sphere\n ios_write_float(o,t.margin);\n ios_write_float(o,t.edgeDistanceThreshold);\n ios_write_u32(o, t.vertexes.size()); ios_write_u32(o, trimesh_vert_start); // verts\n ios_write_u32(o, t.faces.size()); ios_write_u32(o, trimesh_face_start); // faces\n //CTRACE(t.vertexes.size());\n //CTRACE(t.faces.size());\n\n class StringAccumulator {\n private:\n typedef std::map<std::string, int> Map;\n Map map;\n std::vector<std::string> table;\n size_t off;\n public:\n StringAccumulator (size_t off) : off(off) { }\n int operator[] (const std::string &str)\n {\n Map::iterator i = map.find(str);\n if (i != map.end()) return i->second;\n size_t r = off;\n map[str] = off;\n table.push_back(str);\n off += str.length()+1;\n return r;\n }\n void write(std::ostream &o)\n {\n for (unsigned i=0 ; i<table.size() ; ++i) {\n ios_write_byte_array(o, table[i].c_str(), table[i].length()+1);\n }\n }\n \n } sa(text_start);\n\n // hulls\n size_t hull_verts_current = hull_verts_start;\n size_t local_hull_start = hull_start;\n for (size_t i=0 ; i<c.hulls.size() ; ++i) {\n TColHull &h = c.hulls[i];\n size_t local_start = hull_verts_current - local_hull_start;\n ios_write_u32(o, sa[h.material] - local_start);\n ios_write_float(o, h.margin);\n ios_write_u32(o, h.vertexes.size());\n ios_write_u32(o, hull_verts_current - local_hull_start);\n hull_verts_current += BColVert::size() * h.vertexes.size();\n local_hull_start += BColHull::size();\n }\n\n // boxes\n size_t local_box_start = hull_start;\n for (size_t i=0 ; i<c.boxes.size() ; ++i) {\n TColBox &b = c.boxes[i];\n ios_write_u32(o, sa[b.material] - local_box_start);\n ios_write_float(o, b.margin);\n ios_write_float(o, b.px);\n ios_write_float(o, b.py);\n ios_write_float(o, b.pz);\n ios_write_float(o, b.dx);\n ios_write_float(o, b.dy);\n ios_write_float(o, b.dz);\n ios_write_float(o, b.qw);\n ios_write_float(o, b.qx);\n ios_write_float(o, b.qy);\n ios_write_float(o, b.qz);\n local_box_start += BColBox::size();\n }\n\n // cylinders\n size_t local_cyl_start = cyl_start;\n for (size_t i=0 ; i<c.cylinders.size() ; ++i) {\n TColCylinder &cyl = c.cylinders[i];\n ios_write_u32(o, sa[cyl.material] - local_cyl_start);\n ios_write_float(o, cyl.margin);\n ios_write_float(o, cyl.px);\n ios_write_float(o, cyl.py);\n ios_write_float(o, cyl.pz);\n ios_write_float(o, cyl.dx);\n ios_write_float(o, cyl.dy);\n ios_write_float(o, cyl.dz);\n ios_write_float(o, cyl.qw);\n ios_write_float(o, cyl.qx);\n ios_write_float(o, cyl.qy);\n ios_write_float(o, cyl.qz);\n local_cyl_start += BColCyl::size();\n }\n\n // cones\n size_t local_cone_start = cone_start;\n for (size_t i=0 ; i<c.cones.size() ; ++i) {\n TColCone &cone = c.cones[i];\n ios_write_u32(o, sa[cone.material] - local_cone_start);\n ios_write_float(o, cone.margin);\n ios_write_float(o, cone.px);\n ios_write_float(o, cone.py);\n ios_write_float(o, cone.pz);\n ios_write_float(o, cone.radius);\n ios_write_float(o, cone.height);\n ios_write_float(o, cone.qw);\n ios_write_float(o, cone.qx);\n ios_write_float(o, cone.qy);\n ios_write_float(o, cone.qz);\n local_cone_start += BColCone::size();\n }\n\n // planes\n size_t local_plane_start = plane_start;\n for (size_t i=0 ; i<c.planes.size() ; ++i) {\n TColPlane &p = c.planes[i];\n ios_write_u32(o, sa[p.material] - local_plane_start);\n ios_write_float(o, p.nx);\n ios_write_float(o, p.ny);\n ios_write_float(o, p.nz);\n ios_write_float(o, p.d);\n local_plane_start += BColPlane::size();\n }\n\n // spheres\n size_t local_sphere_start = sphere_start;\n for (size_t i=0 ; i<c.spheres.size() ; ++i) {\n TColSphere &s = c.spheres[i];\n ios_write_u32(o, sa[s.material] - local_sphere_start);\n ios_write_float(o, s.px);\n ios_write_float(o, s.py);\n ios_write_float(o, s.pz);\n ios_write_float(o, s.radius);\n local_sphere_start += BColSphere::size();\n }\n\n // verts for hulls\n for (size_t i=0 ; i<c.hulls.size() ; ++i) {\n TColHull &h = c.hulls[i];\n for (unsigned j=0 ; j<h.vertexes.size() ; ++j) {\n ios_write_float(o, h.vertexes[j].x);\n ios_write_float(o, h.vertexes[j].y);\n ios_write_float(o, h.vertexes[j].z);\n }\n }\n\n\n // verts for trimesh\n for (unsigned j=0 ; j<t.vertexes.size() ; ++j) {\n ios_write_float(o, t.vertexes[j].x);\n ios_write_float(o, t.vertexes[j].y);\n ios_write_float(o, t.vertexes[j].z);\n }\n\n\n // faces for trimesh\n size_t local_trimesh_face_start = trimesh_face_start;\n for (unsigned j=0 ; j<t.faces.size() ; ++j) {\n ios_write_u32(o, sa[t.faces[j].material] - local_trimesh_face_start);\n ios_write_u32(o, t.faces[j].v1);\n ios_write_u32(o, t.faces[j].v2);\n ios_write_u32(o, t.faces[j].v3);\n local_trimesh_face_start += BColFace::size();\n } \n\n // text\n sa.write(o);\n \n}\n\n\ntemplate<class T> static bool bcol_assert_struct_size_ok (const char *name)\n{\n unsigned is = sizeof(T);\n unsigned want = T::size();\n if (is != want) {\n fprintf(stderr,\"Executable is broken: %s is %u bytes, need %u bytes.\\n\", name, is, want);\n return false;\n }\n return true;\n}\n\nstatic bool bcol_assert_structs_size_ok (void) {\n bool r = true;\n r &= bcol_assert_struct_size_ok<BColVert>(\"BColVert\");\n r &= bcol_assert_struct_size_ok<BColMat>(\"BColMat\");\n r &= bcol_assert_struct_size_ok<BColHull>(\"BColHull\");\n r &= bcol_assert_struct_size_ok<BColBox>(\"BColBox\");\n r &= bcol_assert_struct_size_ok<BColCyl>(\"BColCyl\");\n r &= bcol_assert_struct_size_ok<BColCone>(\"BColCone\");\n r &= bcol_assert_struct_size_ok<BColPlane>(\"BColPlane\");\n r &= bcol_assert_struct_size_ok<BColSphere>(\"BColSphere\");\n r &= bcol_assert_struct_size_ok<BColFace>(\"BColFace\");\n r &= bcol_assert_struct_size_ok<BColFile>(\"BColFile\");\n if (!r) exit(EXIT_FAILURE);\n return r;\n}\n\nbool unused = bcol_assert_structs_size_ok();\n" }, { "alpha_fraction": 0.6312533617019653, "alphanum_fraction": 0.6312533617019653, "avg_line_length": 48.560001373291016, "blob_id": "2bb0574b2f40afc99878ed8f6c698c70bf602b91", "content_id": "490bc1a4cb5de1a8cdbcb633f5dbf17b0756f9dd", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3718, "license_type": "permissive", "max_line_length": 107, "num_lines": 75, "path": "/dependencies/quex-0.34.1/quex/core_engine/generator/state_coder.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "import quex.core_engine.generator.languages.core as languages\nfrom quex.core_engine.generator.languages.core import __nice\nimport quex.core_engine.generator.transition_block as transition_block\nimport quex.core_engine.generator.transition as transition\nimport quex.core_engine.generator.acceptance_info as acceptance_info\nimport quex.core_engine.generator.drop_out as drop_out\nfrom quex.input.setup import setup as Setup\nfrom copy import deepcopy\n\nLanguageDB = Setup.language_db\n\n__DEBUG_CHECK_ACTIVE_F = False # Use this flag to double check that intervals are adjacent\n\ndef do(state, StateIdx, SMD, InitStateF=False):\n \"\"\"Produces code for all state transitions. Programming language is determined\n by 'Language'.\n \"\"\" \n assert SMD.__class__.__name__ == \"StateMachineDecorator\"\n\n # (*) check that no epsilon transition triggers to a real state \n if __DEBUG_CHECK_ACTIVE_F:\n assert state.transitions().get_epsilon_target_state_index_list() == [], \\\n \"epsilon transition contained target states: state machine was not made a DFA!\\n\" + \\\n \"epsilon target states = \" + repr(state.transitions().get_epsilon_target_state_index_list())\n\n if SMD.dead_end_state_db().has_key(StateIdx):\n return transition.do_dead_end_router(state, StateIdx, SMD.backward_lexing_f())\n \n TriggerMap = state.transitions().get_trigger_map()\n assert TriggerMap != [] # Only dead end states have empty trigger maps.\n # # ==> here, the trigger map cannot be empty.\n #_________________________________________________________________________________________ \n # NOTE: The first entry into the init state is a little different. It does not \n # increment the current pointer before referencing the character to be read. \n # However, when the init state is entered during analysis else, the current \n # pointer needs to be incremented.\n txt = \"\"\n # note down information about success, if state is an acceptance state\n txt += input_block(StateIdx, InitStateF, SMD.backward_lexing_f())\n\n txt += acceptance_info.do(state, StateIdx, SMD)\n\n txt += transition_block.do(TriggerMap, StateIdx, InitStateF, SMD)\n\n txt += drop_out.do(state, StateIdx, SMD, InitStateF) \n\n # Define the entry of the init state after the init state itself. This is so,\n # since the init state does not require an increment on the first beat. Later on,\n # when other states enter here, they need to increase/decrease the input pointer.\n if not SMD.backward_lexing_f():\n if InitStateF:\n txt += LanguageDB[\"$label-def\"](\"$input\", StateIdx)\n txt += \" \" + LanguageDB[\"$input/increment\"] + \"\\n\"\n txt += \" \" + LanguageDB[\"$goto\"](\"$entry\", StateIdx) + \"\\n\"\n\n \n return txt # .replace(\"\\n\", \"\\n \") + \"\\n\"\n\ndef input_block(StateIdx, InitStateF, BackwardLexingF):\n # The initial state starts from the character to be read and is an exception.\n # Any other state starts with an increment (forward) or decrement (backward).\n # This is so, since the beginning of the state is considered to be the \n # transition action (setting the pointer to the next position to be read).\n txt = \"\"\n if not BackwardLexingF:\n if not InitStateF:\n txt += LanguageDB[\"$label-def\"](\"$input\", StateIdx) + \"\\n\"\n txt += \" \" + LanguageDB[\"$input/increment\"] + \"\\n\"\n else:\n txt += LanguageDB[\"$label-def\"](\"$input\", StateIdx) + \"\\n\"\n txt += \" \" + LanguageDB[\"$input/decrement\"] + \"\\n\"\n\n txt += \" \" + LanguageDB[\"$input/get\"] + \"\\n\"\n\n return txt\n\n" }, { "alpha_fraction": 0.5643307566642761, "alphanum_fraction": 0.5728587508201599, "avg_line_length": 26.793813705444336, "blob_id": "dc8eb436fde96d68c7367980558a9677490ed77f", "content_id": "1e9619fa5c7ea7b26863f7064289295cde991eb7", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Shell", "length_bytes": 2697, "license_type": "permissive", "max_line_length": 163, "num_lines": 97, "path": "/engine/new_lua_obj.sh", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "#!/bin/sh\n\nSOURCE='\nstatic void push_NAME (lua_State *L, UNKNOWN_TYPE *self)\n{\n void **ud = static_cast<void**>(lua_newuserdata(L, sizeof(*ud)));\n ud[0] = static_cast<void*> (self);\n luaL_getmetatable(L, UNKNOWN_TAG);\n lua_setmetatable(L, -2);\n PARENT *p = self->getParent();\n TODO_maps& maps = grit->getUserDataTables().parents[parent];\n maps.UDNAME[self].push_back(ud);\n}\n\nstatic int NAME_gc (lua_State *L)\n{\nTRY_START\n check_args(L,1);\n GET_UD_MACRO_OFFSET(UNKNOWN_TYPE,self,1,UNKNOWN_TAG,0);\n if (self==NULL) return 0;\n CVERB << \"nullifying \"UNKNOWN_TAG << std::endl;\n vec_nullify_remove(grit->getUserDataTables().UDNAME[self],&self);\n return 0;\nTRY_END\n}\n\nstatic int NAME_destroy (lua_State *L)\n{\nTRY_START\n check_args(L,1);\n GET_UD_MACRO(UNKNOWN_TYPE,self,1,UNKNOWN_TAG);\n CVERB << \"destroying \"UNKNOWN_TAG << std::endl;\n self.destroySomehow();\n map_nullify_remove(grit->getUserDataTables().UDNAME,&self);\n return 0;\nTRY_END\n}\n\n\nTOSTRING_ADDR_MACRO(NAME,UNKNOWN_TYPE,UNKNOWN_TAG)\n\n\nstatic int NAME_index (lua_State *L)\n{\nTRY_START\n check_args(L,2);\n GET_UD_MACRO(UNKNOWN_TYPE,self,1,UNKNOWN_TAG);\n std::string key = luaL_checkstring(L,2);\n if (key==\"destroy\") {\n lua_pushcfunction(L,NAME_destroy);\n } else if (key==\"someField\") {\n int v = 3;\n lua_pushnumber(L,v);\n } else {\n my_lua_error(L,\"Not a valid USER_VISIBLE_NAME member: \"+key);\n }\n return 1;\nTRY_END\n}\n\nstatic int NAME_newindex (lua_State *L)\n{\nTRY_START\n check_args(L,3);\n GET_UD_MACRO(UNKNOWN_TYPE,self,1,UNKNOWN_TAG);\n std::string key = luaL_checkstring(L,2);\n if (key==\"someField\") {\n bool v = lua_toboolean(L,3);\n self.setSomeField(v);\n } else {\n my_lua_error(L,\"Not a valid USER_VISIBLE_NAME member: \"+key);\n }\n return 0;\nTRY_END\n}\n\nEQ_PTR_MACRO(UNKNOWN_TYPE,NAME,UNKNOWN_TAG)\n\nMT_MACRO_NEWINDEX(NAME);'\n\n\necho \"Type to be wrapped (e.g. Ogre::MaterialPtr)\"\nread TYPE\necho \"Name (e.g. mat)\"\nread NAME\necho \"Userdata TAG (e.g. MAT_TAG)\"\nread TAG\necho \"Title in code (e.g. MATERIAL)\"\nread TITLE\necho \"User-visible name (e.g. Material)\"\nread UVNAME\necho \"Userdata table name (e.g. materials)\"\nread UDNAME\n\necho \"// $TITLE ===================================================================================\" | cut -b 1-80\n\necho \"$SOURCE\" | sed \"s/UNKNOWN_TYPE/$TYPE/g\" | sed \"s/UNKNOWN_TAG/$TAG/g\" | sed \"s/USER_VISIBLE_NAME/$UVNAME/g\" | sed \"s/UDNAME/$UDNAME/g\" | sed \"s/NAME/$NAME/g\" \n" }, { "alpha_fraction": 0.608107328414917, "alphanum_fraction": 0.6209779381752014, "avg_line_length": 28.674339294433594, "blob_id": "e3f114fb28b3aec83aca52515cf9c60f8f1d4956", "content_id": "b7383ab84e0c79498a95fee29ae43d4d9ae4f7e5", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 34808, "license_type": "permissive", "max_line_length": 175, "num_lines": 1173, "path": "/engine/gfx/gfx.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <sstream>\n\n#include <sleep.h>\n\n#include \"../path_util.h\"\n#include \"../main.h\"\n#include \"../clipboard.h\"\n\n#include \"clutter.h\"\n#include \"gfx_body.h\"\n#include \"gfx_debug.h\"\n#include \"gfx_decal.h\"\n#include \"gfx_gl3_plus.h\"\n#include \"hud.h\"\n#include \"gfx_internal.h\"\n#include \"gfx_light.h\"\n#include \"gfx_material.h\"\n#include \"gfx_option.h\"\n#include \"gfx_pipeline.h\"\n#include \"gfx_sky_body.h\"\n#include \"gfx_sky_material.h\"\n#include \"gfx_sprite_body.h\"\n#include \"gfx_tracer_body.h\"\n\n#ifdef WIN32\nbool d3d9 = getenv(\"GRIT_GL\") == NULL;\n#else\nbool d3d9 = false;\n#endif\n\nextern \"C\" { \n#ifdef WIN32\n _declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;\n#else\n unsigned int NvOptimusEnablement = 0x00000001;\n#endif\n}\n\nOgre::OctreePlugin *octree;\nOgre::CgPlugin *cg;\n\nOgre::Root *ogre_root = NULL;\nOgre::RenderSystem *ogre_rs = NULL;\nOgre::RenderWindow *ogre_win = NULL;\nOgre::OctreeSceneManager *ogre_sm = NULL;\nOgre::SceneNode *ogre_root_node = NULL;\nOgre::SharedPtr<Ogre::FrameTimeControllerValue> ftcv;\n\nOgre::Light *ogre_sun = NULL;\n\nGfxCallback *gfx_cb = NULL;\nbool shutting_down = false;\n// I think this is for render targets only.\nbool use_hwgamma = false; //getenv(\"GRIT_NOHWGAMMA\")==NULL;\n\nstatic bool reset_frame_buffer_on_next_render = false;\n\n// For default parameters of functions that take GfxStringMap\nconst GfxStringMap gfx_empty_string_map;\n\nOgre::Matrix4 shadow_view_proj[3];\n\nVector3 particle_ambient;\nVector3 fog_colour;\nfloat fog_density;\n\nVector3 sun_direction;\nVector3 sunlight_direction;\nVector3 sun_colour;\nVector3 sunlight_diffuse;\nVector3 sunlight_specular;\nfloat sun_alpha;\nfloat sun_size;\nfloat sun_falloff_distance;\nfloat sky_glare_sun_distance;\nfloat sky_glare_horizon_elevation;\nfloat sky_divider[4];\nVector3 sky_colour[6];\nVector3 sky_sun_colour[5];\nfloat sky_alpha[6];\nfloat sky_sun_alpha[5];\nVector3 sky_cloud_colour;\nfloat sky_cloud_coverage;\nVector3 hell_colour;\n\nDiskResourcePtr<GfxEnvCubeDiskResource> global_env_cube0;\nDiskResourcePtr<GfxEnvCubeDiskResource> global_env_cube1;\nunsigned env_cube_count = 0;\nfloat env_cube_cross_fade = 0;\nfloat global_exposure = 1;\nfloat global_saturation = 1;\nDiskResourcePtr<GfxColourGradeLUTDiskResource> colour_grade_lut;\nDiskResourcePtr<GfxTextureDiskResource> fade_dither_map;\nDiskResourcePtr<GfxTextureDiskResource> corona_map;\nDiskResourcePtr<GfxTextureDiskResource> shadow_pcf_noise_map;\n\nGfxGslConfigEnvironment shader_scene_env;\n\n// abuse ogre fog params to store several things\nstatic void set_ogre_fog (void)\n{\n ogre_sm->setFog(Ogre::FOG_EXP2, to_ogre_cv(fog_colour),\n fog_density, env_cube_cross_fade, /*unused*/ 0);\n}\n\n\nGfxShaderDB shader_db;\nGfxMaterialDB material_db;\nfast_erase_vector<GfxNode*> gfx_all_nodes;\n\n\n// {{{ utilities\n\nint freshname_counter = 0;\nstd::string freshname (const std::string &prefix)\n{\n std::stringstream ss;\n ss << prefix << freshname_counter;\n freshname_counter++;\n return ss.str();\n}\nstd::string freshname (void)\n{\n return freshname(\"F:\");\n}\n\n// }}}\n\n\nOgre::Viewport *eye_left_vp = NULL;\nOgre::Viewport *eye_right_vp = NULL;\nOgre::Viewport *hud_vp = NULL;\nGfxPipeline *eye_left = NULL;\nGfxPipeline *eye_right = NULL;\n\nvoid do_reset_framebuffer (void)\n{\n // get rid of everything that might be set up already\n\n if (eye_left_vp) ogre_win->removeViewport(eye_left_vp->getZOrder());\n delete eye_left;\n eye_left = NULL;\n\n if (eye_right_vp) ogre_win->removeViewport(eye_right_vp->getZOrder());\n delete eye_right;\n eye_right = NULL;\n\n if (hud_vp) ogre_win->removeViewport(hud_vp->getZOrder());\n\n // set things up again\n if (stereoscopic()) {\n if (gfx_option(GFX_CROSS_EYE)) {\n eye_left_vp = ogre_win->addViewport(NULL, 0, 0, 0, 0.5, 1);\n eye_left = new GfxPipeline(\"EyeLeft\", eye_left_vp);\n eye_right_vp = ogre_win->addViewport(NULL, 1, 0.5, 0, 0.5, 1);\n eye_right = new GfxPipeline(\"EyeRight\", eye_right_vp);\n } else {\n eye_left_vp = ogre_win->addViewport(NULL, 0, 0, 0, 1, 1);\n eye_left = new GfxPipeline(\"EyeLeft\", eye_left_vp);\n eye_right_vp = ogre_win->addViewport(NULL, 1, 0, 0, 1, 1);\n eye_right = new GfxPipeline(\"EyeRight\", eye_right_vp);\n }\n } else {\n eye_left_vp = ogre_win->addViewport(NULL, 0, 0, 0, 1, 1);\n eye_left = new GfxPipeline(\"EyeLeft\", eye_left_vp);\n }\n\n hud_vp = ogre_win->addViewport(NULL, 10, 0, 0, 1, 1);\n}\n\n\n\n// {{{ SCENE PROPERTIES\n\n// lighting parameters\n\nVector3 gfx_sunlight_diffuse (void)\n{\n return sunlight_diffuse;\n}\n\nvoid gfx_sunlight_diffuse (const Vector3 &v)\n{\n sunlight_diffuse = v;\n ogre_sun->setDiffuseColour(to_ogre_cv(v));\n}\n\nVector3 gfx_sunlight_specular (void)\n{\n return sunlight_specular;\n}\n\nvoid gfx_sunlight_specular (const Vector3 &v)\n{\n sunlight_specular = v;\n ogre_sun->setSpecularColour(to_ogre_cv(v));\n}\n\nVector3 gfx_sunlight_direction (void)\n{\n return sunlight_direction;\n}\n\nvoid gfx_sunlight_direction (const Vector3 &v)\n{\n sunlight_direction = v;\n ogre_sun->setDirection(to_ogre(v));\n}\n\nVector3 gfx_particle_ambient (void)\n{\n return particle_ambient;\n}\n\nvoid gfx_particle_ambient (const Vector3 &v)\n{\n particle_ambient = v;\n}\n\n\nfloat gfx_env_cube_cross_fade (void)\n{\n return env_cube_cross_fade;\n}\n\nvoid gfx_env_cube_cross_fade (float v)\n{\n env_cube_cross_fade = v;\n set_ogre_fog();\n}\n\n\nGfxEnvCubeDiskResource *gfx_env_cube (unsigned i)\n{\n APP_ASSERT(i == 0 || i == 1);\n const auto &ec = i == 0 ? global_env_cube0 : global_env_cube1;\n return ec;\n}\n\nvoid gfx_env_cube (unsigned i, const DiskResourcePtr<GfxEnvCubeDiskResource> &v)\n{\n auto &ec = i == 0 ? global_env_cube0 : global_env_cube1;\n if (ec == v) return;\n //CVERB << \"Setting scene env cube to \" << v << std::endl;\n ec = v;\n env_cube_count = unsigned(global_env_cube0 != nullptr)\n + unsigned(global_env_cube1 != nullptr);\n}\n\nGfxTextureDiskResource *gfx_shadow_pcf_noise_map (void)\n{\n return shadow_pcf_noise_map;\n}\n\nvoid gfx_shadow_pcf_noise_map (const DiskResourcePtr<GfxTextureDiskResource> &v)\n{\n if (v == shadow_pcf_noise_map) return;\n\n shadow_pcf_noise_map = v;\n}\n\n\nGfxTextureDiskResource *gfx_fade_dither_map (void)\n{\n return fade_dither_map;\n}\n\nvoid gfx_fade_dither_map (const DiskResourcePtr<GfxTextureDiskResource> &v)\n{\n if (v == fade_dither_map) return;\n\n fade_dither_map = v;\n}\n\n\nGfxTextureDiskResource *gfx_corona_map (void)\n{\n return corona_map;\n}\n\nvoid gfx_corona_map (const DiskResourcePtr<GfxTextureDiskResource> &v)\n{\n if (v == corona_map) return;\n\n corona_map = v;\n}\n\n\nGfxColourGradeLUTDiskResource *gfx_colour_grade (void)\n{\n return colour_grade_lut;\n}\n\nvoid gfx_colour_grade (const DiskResourcePtr<GfxColourGradeLUTDiskResource> &v)\n{\n if (v == colour_grade_lut) return;\n //CVERB << \"Setting colour grade to \" << v << std::endl;\n\n colour_grade_lut = v;\n}\n\n\nfloat gfx_global_saturation (void)\n{\n return global_saturation;\n}\n\nvoid gfx_global_saturation (float v)\n{\n global_saturation = v;\n}\n \nfloat gfx_global_exposure (void)\n{\n return global_exposure;\n}\n\nvoid gfx_global_exposure (float v)\n{\n global_exposure = v;\n}\n \n\n\nVector3 gfx_fog_colour (void)\n{\n return fog_colour;\n}\n\nvoid gfx_fog_colour (const Vector3 &v)\n{\n fog_colour = v;\n set_ogre_fog();\n}\n\nfloat gfx_fog_density (void)\n{\n return fog_density;\n}\n\nvoid gfx_fog_density (float v)\n{\n fog_density = v;\n set_ogre_fog();\n}\n\n\nfloat gfx_sun_size (void)\n{\n return sun_size;\n}\n\nvoid gfx_sun_size (float v)\n{\n sun_size = v;\n}\n\nfloat gfx_sun_falloff_distance (void)\n{\n return sun_falloff_distance;\n}\n\nvoid gfx_sun_falloff_distance (float v)\n{\n sun_falloff_distance = v;\n}\n\nVector3 gfx_sky_cloud_colour (void)\n{\n return sky_cloud_colour;\n}\n\nvoid gfx_sky_cloud_colour (const Vector3 &v)\n{\n sky_cloud_colour = v;\n}\n\nfloat gfx_sky_cloud_coverage (void)\n{\n return sky_cloud_coverage;\n}\n\nvoid gfx_sky_cloud_coverage (float v)\n{\n sky_cloud_coverage = v;\n}\n\nVector3 gfx_hell_colour (void)\n{\n return hell_colour;\n}\n\nvoid gfx_hell_colour (const Vector3 &v)\n{\n hell_colour = v;\n}\n\nVector3 gfx_sun_direction (void)\n{\n return sun_direction;\n}\n\nvoid gfx_sun_direction (const Vector3 &v)\n{\n sun_direction = v;\n}\n\nVector3 gfx_sun_colour (void)\n{\n return sun_colour;\n}\n\nvoid gfx_sun_colour (const Vector3 &v)\n{\n sun_colour = v;\n}\n\nfloat gfx_sun_alpha (void)\n{\n return sun_alpha;\n}\n\nvoid gfx_sun_alpha (float v)\n{\n sun_alpha = v;\n}\n\nfloat gfx_sky_glare_sun_distance (void)\n{\n return sky_glare_sun_distance;\n}\n\nvoid gfx_sky_glare_sun_distance (float v)\n{\n sky_glare_sun_distance = v;\n}\n\nfloat gfx_sky_glare_horizon_elevation (void)\n{\n return sky_glare_horizon_elevation;\n}\n\nvoid gfx_sky_glare_horizon_elevation (float v)\n{\n sky_glare_horizon_elevation = v;\n}\n\nfloat gfx_sky_divider (unsigned i)\n{\n APP_ASSERT(i < 4);\n return sky_divider[i];\n}\n\nvoid gfx_sky_divider (unsigned i, float v)\n{\n APP_ASSERT(i < 4);\n sky_divider[i] = v;\n}\n\nVector3 gfx_sky_colour (unsigned i)\n{\n APP_ASSERT(i < 6);\n return sky_colour[i];\n}\n\nvoid gfx_sky_colour (unsigned i, const Vector3 &v)\n{\n APP_ASSERT(i < 6);\n sky_colour[i] = v;\n}\n\nVector3 gfx_sky_sun_colour (unsigned i)\n{\n APP_ASSERT(i < 5);\n return sky_sun_colour[i];\n}\n\nvoid gfx_sky_sun_colour (unsigned i, const Vector3 &v)\n{\n APP_ASSERT(i < 5);\n sky_sun_colour[i] = v;\n}\n\nfloat gfx_sky_alpha (unsigned i)\n{\n APP_ASSERT(i < 6);\n return sky_alpha[i];\n}\n\nvoid gfx_sky_alpha (unsigned i, float v)\n{\n APP_ASSERT(i < 6);\n sky_alpha[i] = v;\n}\n\nfloat gfx_sky_sun_alpha (unsigned i)\n{\n APP_ASSERT(i < 5);\n return sky_sun_alpha[i];\n}\n\nvoid gfx_sky_sun_alpha (unsigned i, float v)\n{\n APP_ASSERT(i < 5);\n sky_sun_alpha[i] = v;\n}\n\n// }}}\n\n\n// {{{ RENDER\n\nfloat anim_time = 0;\n\nstatic float time_since_started_rendering = 0;\n\nvoid gfx_window_events_pump (void)\n{\n Ogre::WindowEventUtilities::messagePump();\n}\n\nvoid gfx_render (float elapsed, const Vector3 &cam_pos, const Quaternion &cam_dir)\n{\n time_since_started_rendering += elapsed;\n anim_time = fmodf(anim_time+elapsed, ANIM_TIME_MAX);\n\n clipboard_pump();\n\n debug_drawer->frameCallback();\n ogre_root_node->needUpdate();\n\n // try and do all \"each object\" processing in these loops\n for (unsigned long i=0 ; i<gfx_all_nodes.size() ; ++i) {\n GfxNode *node = gfx_all_nodes[i];\n\n if (auto *b = dynamic_cast<GfxBody*>(node))\n b->updateBoneMatrixes();\n }\n // must be done after updating bone matrixes\n for (unsigned long i=0 ; i<gfx_all_nodes.size() ; ++i) {\n GfxNode *node = gfx_all_nodes[i];\n node->updateWorldTransform();\n\n if (auto *l = dynamic_cast<GfxLight*>(node))\n l->update(cam_pos);\n\n if (auto *sb = dynamic_cast<GfxSpriteBody*>(node))\n sb->update();\n }\n\n try {\n if (reset_frame_buffer_on_next_render) {\n reset_frame_buffer_on_next_render = false;\n do_reset_framebuffer();\n }\n\n // This pumps ogre's texture animation and probably other things\n ftcv->setValue(elapsed);\n ftcv->setElapsedTime(time_since_started_rendering);\n // used for indicating that ogre internal data prepared for last frame is now invalid\n ogre_root->setNextFrameNumber(ogre_root->getNextFrameNumber()+1);\n\n if (ogre_win->isActive()) {\n ogre_win->_beginUpdate();\n CameraOpts opts_left;\n opts_left.fovY = gfx_option(GFX_FOV);\n opts_left.nearClip = gfx_option(GFX_NEAR_CLIP);\n opts_left.farClip = gfx_option(GFX_FAR_CLIP);\n opts_left.pos = cam_pos;\n opts_left.dir = cam_dir;\n opts_left.debugMode = gfx_option(GFX_DEBUG_MODE);\n opts_left.bloomAndToneMap = gfx_option(GFX_POST_PROCESSING);\n opts_left.particles = gfx_option(GFX_RENDER_PARTICLES);\n opts_left.pointLights = gfx_option(GFX_POINT_LIGHTS);\n opts_left.sky = gfx_option(GFX_RENDER_SKY);\n opts_left.firstPerson = gfx_option(GFX_RENDER_FIRST_PERSON);\n if (stereoscopic()) {\n\n float FOV = gfx_option(GFX_FOV);\n float monitor_height = gfx_option(GFX_MONITOR_HEIGHT);\n float distance = gfx_option(GFX_MONITOR_EYE_DISTANCE);\n float eye_separation = gfx_option(GFX_EYE_SEPARATION);\n float min = gfx_option(GFX_MIN_PERCEIVED_DEPTH);\n float max = gfx_option(GFX_MAX_PERCEIVED_DEPTH);\n\n CameraOpts opts_right = opts_left;\n\n float s = 2*tan((FOV/2)/180*M_PI)/monitor_height * (eye_separation * (1-distance/max));\n opts_left.frustumOffset = s/2;\n opts_right.frustumOffset = -s/2;\n \n // cam separation -- different than eye separation because we want to control the perceived depth\n float c = 2*tan((FOV/2)/180*M_PI)/monitor_height * (eye_separation * (1-distance/min));\n c = gfx_option(GFX_NEAR_CLIP) * (s - c);\n\n opts_left.pos = cam_pos + c/2 * (cam_dir*Vector3(-1,0,0));\n opts_right.pos = cam_pos + c/2 * (cam_dir*Vector3(1,0,0));\n\n if (gfx_option(GFX_ANAGLYPH)) {\n opts_left.mask = Vector3(gfx_option(GFX_ANAGLYPH_LEFT_RED_MASK),\n gfx_option(GFX_ANAGLYPH_LEFT_GREEN_MASK),\n gfx_option(GFX_ANAGLYPH_LEFT_BLUE_MASK));\n opts_right.mask = Vector3(gfx_option(GFX_ANAGLYPH_RIGHT_RED_MASK),\n gfx_option(GFX_ANAGLYPH_RIGHT_GREEN_MASK),\n gfx_option(GFX_ANAGLYPH_RIGHT_BLUE_MASK));\n opts_left.saturationMask = opts_right.saturationMask = 1 - gfx_option(GFX_ANAGLYPH_DESATURATION);\n\n }\n\n bool additive = gfx_option(GFX_ANAGLYPH);\n\n eye_left->render(opts_left);\n eye_right->render(opts_right, additive);\n\n } else {\n eye_left->render(opts_left);\n }\n\n if (gfx_option(GFX_RENDER_HUD))\n hud_render(hud_vp);\n\n ogre_win->_endUpdate();\n\n ogre_rs->_swapAllRenderTargetBuffers();\n } else {\n // corresponds to 100fps\n mysleep(10000);\n }\n\n\n } catch (Ogre::Exception &e) {\n CERR << e.getFullDescription() << std::endl;\n } catch (const Exception &e) {\n CERR << e << std::endl;\n }\n\n ogre_rs->markProfileEvent(\"end grit frame\");\n}\n\n// }}}\n\nvoid gfx_bake_env_cube (const std::string &filename, unsigned size, const Vector3 &cam_pos,\n float saturation, const Vector3 &ambient)\n{\n if ((size & (size-1)) != 0) GRIT_EXCEPT(\"Can only bake env cubes with power of 2 size\");\n\n // make texture\n Ogre::TexturePtr cube = Ogre::TextureManager::getSingleton().createManual(\"env_cube_bake\", RESGRP, Ogre::TEX_TYPE_2D,\n 6 * size, size, 1,\n 0,\n Ogre::PF_FLOAT32_RGB,\n Ogre::TU_RENDERTARGET,\n NULL,\n false);\n Ogre::RenderTarget *rt = cube->getBuffer()->getRenderTarget();\n\n // these are correct assuming the end image is going to be flipped about y\n Quaternion cube_orientations[6] = {\n Quaternion(Degree(90), Vector3(0,1,0)) * Quaternion(Degree(90), Vector3(1,0,0)), // lean your head back to look up, then lean to the right\n Quaternion(Degree(90), Vector3(0,-1,0)) * Quaternion(Degree(90), Vector3(1,0,0)), // lean your head back to look up, then lean to the left\n Quaternion(1,0,0,0), // looking north\n Quaternion(Degree(180), Vector3(1,0,0)), // lean your head back until you are looking south\n Quaternion(Degree(90), Vector3(1,0,0)), // lean your head back to look up\n Quaternion(Degree(90), Vector3(1,0,0)) * Quaternion(Degree(180), Vector3(0,0,1)), // turn to face south, then look down\n };\n\n // create 6 viewports and 6 pipelines\n for (unsigned i=0 ; i<6 ; ++i) {\n Ogre::Viewport *vp = rt->addViewport(NULL, 0, i/6.0, 0, 1.0/6, 1);\n\n GfxPipeline pipe(\"env_cube_bake_pipe\", vp);\n\n CameraOpts opts;\n opts.fovY = 90;\n opts.nearClip = 0.3;\n opts.farClip = 1200;\n opts.pos = cam_pos;\n opts.dir = cube_orientations[i];\n opts.bloomAndToneMap = false;\n opts.particles = false;\n opts.pointLights = false;\n opts.sky = true;\n opts.sun = false;\n\n pipe.render(opts);\n\n rt->removeViewport(vp->getZOrder());\n }\n\n // read back onto cpu\n Ogre::Image img_raw;\n unsigned char *img_raw_buf = OGRE_ALLOC_T(unsigned char, 6*size*size*3*4, Ogre::MEMCATEGORY_GENERAL);\n img_raw.loadDynamicImage(img_raw_buf, size*6, size, 1, Ogre::PF_FLOAT32_RGB, true);\n rt->copyContentsToMemory(img_raw.getPixelBox());\n Ogre::PixelBox img_raw_box = img_raw.getPixelBox();\n\n // clean up texture\n Ogre::TextureManager::getSingleton().remove(cube);\n rt = NULL;\n\n // make an image that is a target for the conversion process\n Ogre::Image img_conv;\n unsigned char *img_conv_buf = OGRE_ALLOC_T(unsigned char, 6*size*size*3*2, Ogre::MEMCATEGORY_GENERAL);\n img_conv.loadDynamicImage(img_conv_buf, size*6, size, 1, Ogre::PF_SHORT_RGB, true);\n Ogre::PixelBox img_conv_box = img_conv.getPixelBox();\n\n // do conversion (flip y, gamma, hdr range up to 16)\n for (unsigned y=0 ; y<size ; y++) {\n for (unsigned x=0 ; x<size*6 ; x++) {\n Ogre::ColourValue cv = img_raw.getColourAt(x,y,0);\n cv = cv + Ogre::ColourValue(ambient.x, ambient.y, ambient.z);\n float grey = (cv.r + cv.g + cv.b)/3;\n cv = saturation * cv + (1-saturation) * Ogre::ColourValue(grey, grey, grey, 1);\n cv = cv / 16;\n cv = Ogre::ColourValue(powf(cv.r,1/2.2), powf(cv.g,1/2.2), powf(cv.b,1/2.2), 1.0f);\n img_conv.setColourAt(cv,x,size - y - 1,0);\n }\n }\n\n // write out to file\n img_conv.save(filename);\n\n}\n\n\nvoid gfx_screenshot (const std::string &filename) { ogre_win->writeContentsToFile(filename); }\n\nbool gfx_window_active (void)\n{\n return ogre_win->isActive();\n}\n\nVector2 gfx_window_size (void)\n{\n return Vector2(ogre_win->getWidth(), ogre_win->getHeight());\n}\n\nVector2 gfx_window_size_in_scene (void)\n{\n float ncd = gfx_option(GFX_NEAR_CLIP);\n float fov = gfx_option(GFX_FOV);\n Vector2 win_size = gfx_window_size();\n float ratio = win_size.x / win_size.y;\n float height = ncd * 2 * tan(M_PI/180 * (fov/2));\n float width = ratio * height;\n return Vector2(width, height);\n}\n\nVector3 gfx_world_to_screen (const Vector3 &cam_pos, const Quaternion &cam_dir, const Vector3 &p)\n{\n Ogre::Matrix4 view =\n Ogre::Math::makeViewMatrix(to_ogre(cam_pos),\n to_ogre(cam_dir*Quaternion(Degree(90),Vector3(1,0,0))),\n nullptr);\n\n float w = ogre_win->getWidth();\n float h = ogre_win->getHeight();\n\n Ogre::Frustum frustum;\n // Ogre cameras point towards Z whereas in Grit the convention\n // is that 'unrotated' means pointing towards y (north)\n frustum.setFOVy(Ogre::Degree(gfx_option(GFX_FOV)));\n frustum.setAspectRatio(w / h);\n frustum.setNearClipDistance(gfx_option(GFX_NEAR_CLIP));\n frustum.setFarClipDistance(gfx_option(GFX_FAR_CLIP));\n Ogre::Matrix4 proj = frustum.getProjectionMatrix();;\n\n Ogre::Vector4 sp_h = proj * (view * Ogre::Vector4(p.x, p.y, p.z, 1));\n if (sp_h.w == 0) return Vector3(0, 0, 0);\n Vector3 sp = Vector3(sp_h.x, sp_h.y, sp_h.z) / sp_h.w;\n if (sp_h.w < 0) sp *= Vector3(1, 1, -1);\n return Vector3((sp.x+1)/2*w, (sp.y+1)/2*h, sp.z);\n}\n\nVector3 gfx_screen_to_world (const Vector3 &cam_pos, const Quaternion &cam_dir, const Vector2 &p)\n{\n Ogre::Matrix4 view =\n Ogre::Math::makeViewMatrix(to_ogre(cam_pos),\n to_ogre(cam_dir*Quaternion(Degree(90),Vector3(1,0,0))),\n nullptr);\n\n float w = ogre_win->getWidth();\n float h = ogre_win->getHeight();\n\n Ogre::Frustum frustum;\n // Ogre cameras point towards Z whereas in Grit the convention\n // is that 'unrotated' means pointing towards y (north)\n frustum.setFOVy(Ogre::Degree(gfx_option(GFX_FOV)));\n frustum.setAspectRatio(w / h);\n frustum.setNearClipDistance(gfx_option(GFX_NEAR_CLIP));\n frustum.setFarClipDistance(gfx_option(GFX_FAR_CLIP));\n Ogre::Matrix4 proj = frustum.getProjectionMatrix();;\n\n Ogre::Matrix4 inv_view_proj = (proj * view).inverse();\n\n Vector2 norm_p = (2 * p / Vector2(w, h)) - Vector2(1, 1);\n\n // Get a point on the near clip plane\n Ogre::Vector3 near_clip_p = (inv_view_proj * Ogre::Vector3(norm_p.x, norm_p.y, 0));\n\n return (from_ogre(near_clip_p) - cam_pos).normalisedCopy();\n}\n\nstatic GfxLastRenderStats stats_from_rt (Ogre::RenderTarget *rt)\n{\n GfxLastRenderStats r;\n r.batches = float(rt->getBatchCount());\n r.triangles = float(rt->getTriangleCount());\n return r;\n}\n\nGfxLastFrameStats gfx_last_frame_stats (void)\n{\n GfxLastFrameStats r;\n\n r.left_deferred = eye_left->getDeferredStats();\n r.left_gbuffer = eye_left->getGBufferStats();\n\n if (stereoscopic()) {\n r.right_deferred = eye_right->getGBufferStats();\n r.right_gbuffer = eye_right->getGBufferStats();\n }\n\n if (gfx_option(GFX_SHADOW_CAST)) {\n for (int i=0 ; i<3 ; ++i) {\n r.shadow[i] = stats_from_rt(ogre_sm->getShadowTexture(i)->getBuffer()->getRenderTarget());\n }\n }\n\n return r;\n}\n\nGfxRunningFrameStats gfx_running_frame_stats (void)\n{\n GfxRunningFrameStats r;\n return r;\n}\n\n\n// {{{ LISTENERS \n\nstruct MeshSerializerListener : Ogre::MeshSerializerListener {\n void processMaterialName (Ogre::Mesh *mesh, std::string *name)\n {\n if (shutting_down) return;\n std::string filename = mesh->getName();\n std::string dir(filename, 0, filename.rfind('/')+1);\n *name = pwd_full_ex(*name, \"/\"+dir, \"BaseWhite\");\n }\n\n void processSkeletonName (Ogre::Mesh *mesh, std::string *name)\n {\n if (shutting_down) return;\n std::string filename = mesh->getName();\n std::string dir(filename, 0, filename.rfind('/')+1);\n *name = pwd_full_ex(*name, \"/\"+dir, *name).substr(1); // strip leading '/' from this one\n }\n void processMeshCompleted (Ogre::Mesh *mesh)\n {\n (void) mesh;\n // do nothing\n }\n} mesh_serializer_listener;\n\nstruct WindowEventListener : Ogre::WindowEventListener {\n\n void windowResized(Ogre::RenderWindow *rw)\n {\n if (shutting_down) return;\n gfx_cb->windowResized(rw->getWidth(),rw->getHeight());\n reset_frame_buffer_on_next_render = true;\n hud_signal_window_resized(rw->getWidth(),rw->getHeight());\n }\n\n void windowClosed (Ogre::RenderWindow *rw)\n {\n (void) rw;\n if (shutting_down) return;\n gfx_cb->clickedClose();\n }\n\n} window_event_listener;\n\nstruct LogListener : Ogre::LogListener {\n virtual void messageLogged (const std::string &message,\n Ogre::LogMessageLevel lml,\n bool maskDebug,\n const std::string &logName,\n bool& skipThisMessage )\n\n {\n (void)lml;\n (void)logName;\n (void)skipThisMessage;\n if (!maskDebug) gfx_cb->messageLogged(message);\n }\n} log_listener;\n\nstruct SceneManagerListener : Ogre::SceneManager::Listener {\n //virtual void preUpdateSceneGraph (Ogre::SceneManager *, Ogre::Camera *camera)\n //{\n // //CVERB << \"preUpdateSceneGraph: \" << camera->getName() << std::endl;\n //}\n\n //virtual void preFindVisibleObjects (Ogre::SceneManager *, Ogre::SceneManager::IlluminationRenderStage irs, Ogre::Viewport *v)\n //{\n // //CVERB << \"preFindVisibleObjects: \" << irs << \" \" << v << std::endl;\n //}\n\n //virtual void postFindVisibleObjects (Ogre::SceneManager *, Ogre::SceneManager::IlluminationRenderStage irs, Ogre::Viewport *v)\n //{\n // //CVERB << \"postFindVisibleObjects: \" << irs << \" \" << v << std::endl;\n //}\n\n virtual void shadowTexturesUpdated (size_t numberOfShadowTextures)\n {\n (void) numberOfShadowTextures;\n // misleading, actually refers to number of lights that have had shadow textures populated i think\n //APP_ASSERT(numberOfShadowTextures==1);\n //if (numberOfShadowTextures!=1)\n // CVERB << \"shadowTexturesUpdated: \" << numberOfShadowTextures << std::endl;\n }\n\n virtual void shadowTextureCasterPreViewProj (Ogre::Light *light, Ogre::Camera *cam, size_t iteration)\n {\n // apparently other lights cast shadows, should probably fix that...\n if (light != ogre_sun) return;\n APP_ASSERT(iteration < 3);\n //CVERB << \"shadowTextureCasterPreViewProj: \" << light->getName() << \" \" << cam->getName() << \" \" << iteration << std::endl;\n Ogre::Matrix4 view = cam->getViewMatrix();\n Ogre::Matrix4 proj = cam->getProjectionMatrixWithRSDepth();\n static const Ogre::Matrix4 to_uv_space( 0.5, 0, 0, 0.5, 0, -0.5, 0, 0.5, 0, 0, 1, 0, 0, 0, 0, 1);\n Ogre::Matrix4 view_proj = to_uv_space*proj*view;\n shadow_view_proj[iteration] = view_proj;\n //CVERB << light->getName() << \" \" << iteration << \" \" << cam->getViewMatrix() << std::endl;\n //CVERB << light->getName() << \" \" << iteration << \" \" << cam->getProjectionMatrixRS() << std::endl;\n }\n\n virtual void shadowTextureReceiverPreViewProj (Ogre::Light *light, Ogre::Frustum *frustum)\n {\n CVERB << \"shadowTextureReceiverPreViewProj: \" << light->getName() << \" \" << frustum->getName() << std::endl;\n }\n\n //virtual bool sortLightsAffectingFrustum (Ogre::LightList &lightList)\n //{\n // //CVERB << \"sortLightsAffectingFrustum: \" << lightList.size() << std::endl;\n // return false;\n //}\n\n //virtual void sceneManagerDestroyed (Ogre::SceneManager *)\n //{\n // //CVERB << \"sceneManagerDestroyed\" << std::endl;\n //}\n\n} ogre_sm_listener;\n\n// }}}\n\n\n// {{{ INIT / SHUTDOWN\n\nbool gfx_d3d9 (void)\n{\n return d3d9;\n}\n\nsize_t gfx_init (GfxCallback &cb_)\n{\n try {\n gfx_cb = &cb_;\n\n Ogre::LogManager *lmgr = OGRE_NEW Ogre::LogManager();\n Ogre::Log *ogre_log = OGRE_NEW Ogre::Log(\"\",false,true);\n ogre_log->addListener(&log_listener);\n lmgr->setDefaultLog(ogre_log);\n lmgr->setLogDetail(Ogre::LL_NORMAL);\n\n ogre_root = OGRE_NEW Ogre::Root(\"\",\"\",\"\");\n\n octree = OGRE_NEW Ogre::OctreePlugin();\n ogre_root->installPlugin(octree);\n\n cg = OGRE_NEW Ogre::CgPlugin();\n ogre_root->installPlugin(cg);\n\n if (d3d9) {\n #ifdef WIN32\n ogre_rs = OGRE_NEW Ogre::D3D9RenderSystem(GetModuleHandle(NULL));\n ogre_rs->setConfigOption(\"Allow NVPerfHUD\", \"Yes\");\n ogre_rs->setConfigOption(\"Floating-point mode\", \"Consistent\");\n ogre_rs->setConfigOption(\"Video Mode\", \"1024 x 768 @ 32-bit colour\");\n #endif\n } else {\n ogre_rs = gfx_gl3_plus_get_render_system();\n ogre_rs->setConfigOption(\"RTT Preferred Mode\", \"FBO\");\n ogre_rs->setConfigOption(\"Video Mode\", \"1024 x 768\");\n }\n ogre_rs->setConfigOption(\"sRGB Gamma Conversion\", use_hwgamma ? \"Yes\" : \"No\");\n ogre_rs->setConfigOption(\"Full Screen\", \"No\");\n ogre_rs->setConfigOption(\"VSync\", \"Yes\");\n\n Ogre::ConfigOptionMap &config_opts = ogre_rs->getConfigOptions();\n CLOG << \"Rendersystem options:\" << std::endl;\n for (Ogre::ConfigOptionMap::iterator i=config_opts.begin(),i_=config_opts.end() ; i!=i_ ; ++i) {\n const Ogre::StringVector &sv = i->second.possibleValues;\n CLOG << \" \" << i->second.name << \" (\" << (i->second.immutable ? \"immutable\" : \"mutable\") << \") {\";\n for (unsigned j=0 ; j<sv.size() ; ++j) {\n CLOG << (j==0?\" \":\", \") << sv[j];\n }\n CLOG << \" }\" << std::endl;\n }\n ogre_root->setRenderSystem(ogre_rs);\n\n ogre_root->initialise(true,\"Grit Game Window\");\n\n ogre_win = ogre_root->getAutoCreatedWindow();\n\n size_t winid;\n ogre_win->getCustomAttribute(\"WINDOW\", &winid);\n #ifdef WIN32\n HMODULE mod = GetModuleHandle(NULL);\n HICON icon_big = (HICON)LoadImage(mod, MAKEINTRESOURCE(118), IMAGE_ICON,\n 0, 0, LR_DEFAULTSIZE|LR_SHARED);\n HICON icon_small = (HICON)LoadImage(mod,MAKEINTRESOURCE(118), IMAGE_ICON,\n 16, 16, LR_DEFAULTSIZE|LR_SHARED);\n SendMessage((HWND)winid, (UINT)WM_SETICON, (WPARAM) ICON_BIG, (LPARAM) icon_big);\n SendMessage((HWND)winid, (UINT)WM_SETICON, (WPARAM) ICON_SMALL, (LPARAM) icon_small);\n #endif\n\n ogre_win->setDeactivateOnFocusChange(false);\n\n Ogre::TextureManager::getSingleton().setVerbose(false);\n Ogre::MeshManager::getSingleton().setVerbose(false);\n\n Ogre::MeshManager::getSingleton().setListener(&mesh_serializer_listener);\n Ogre::WindowEventUtilities::addWindowEventListener(ogre_win, &window_event_listener);\n Ogre::ResourceGroupManager::getSingleton().addResourceLocation(\".\", \"FileSystem\", RESGRP, true);\n Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();\n\n Ogre::GpuProgramManager::getSingleton().setSaveMicrocodesToCache(false);\n \n ftcv = Ogre::ControllerManager::getSingleton().getFrameTimeSource().dynamicCast<Ogre::FrameTimeControllerValue>();\n if (ftcv.isNull()) {\n CERR << \"While initialising Grit, Ogre::FrameControllerValue could not be found!\" << std::endl;\n }\n ogre_sm = static_cast<Ogre::OctreeSceneManager*>(ogre_root->createSceneManager(\"OctreeSceneManager\"));\n ogre_sm->addListener(&ogre_sm_listener);\n ogre_root_node = ogre_sm->getRootSceneNode();\n ogre_sm->setShadowCasterRenderBackFaces(false);\n ogre_sm->setShadowTextureSelfShadow(true);\n ogre_sun = ogre_sm->createLight(\"Sun\");\n ogre_sun->setType(Ogre::Light::LT_DIRECTIONAL);\n\n gfx_shader_init();\n gfx_material_init();\n gfx_sky_material_init();\n gfx_pipeline_init();\n gfx_option_init();\n gfx_particle_init();\n gfx_tracer_body_init();\n hud_init();\n gfx_decal_init();\n gfx_debug_init();\n \n gfx_env_cube(0, DiskResourcePtr<GfxEnvCubeDiskResource>());\n gfx_env_cube(1, DiskResourcePtr<GfxEnvCubeDiskResource>());\n env_cube_cross_fade = 0;\n shader_scene_env.envBoxes = 2; \n\n shader_scene_env.shadowFactor = 5000; // See uber.cgh also\n\n CVERB << \"Ogre::RSC_RTT_MAIN_DEPTHBUFFER_ATTACHABLE = \" << ogre_rs->getCapabilities()->hasCapability(Ogre::RSC_RTT_SEPARATE_DEPTHBUFFER) << std::endl;\n CVERB << \"Ogre::RSC_RTT_SEPARATE_DEPTHBUFFER = \" << ogre_rs->getCapabilities()->hasCapability(Ogre::RSC_RTT_SEPARATE_DEPTHBUFFER) << std::endl;\n CVERB << \"Ogre::RSC_RTT_DEPTHBUFFER_RESOLUTION_LESSEQUAL = \" << ogre_rs->getCapabilities()->hasCapability(Ogre::RSC_RTT_DEPTHBUFFER_RESOLUTION_LESSEQUAL) << std::endl;\n\n return winid;\n } catch (Ogre::Exception &e) {\n GRIT_EXCEPT(\"Couldn't initialise graphics subsystem: \"+e.getFullDescription());\n }\n}\n\nGfxMaterialType gfx_material_type (const std::string &name)\n{\n GFX_MAT_SYNC;\n if (!gfx_material_has_any(name)) GRIT_EXCEPT(\"Non-existent material: \\\"\"+name+\"\\\"\");\n GfxBaseMaterial *mat = material_db[name];\n if (dynamic_cast<GfxMaterial*>(mat) != NULL) return GFX_MATERIAL;\n if (dynamic_cast<GfxSkyMaterial*>(mat) != NULL) return GFX_SKY_MATERIAL;\n GRIT_EXCEPT(\"Internal error: unrecognised kind of material\");\n return GFX_MATERIAL; // never get here\n}\n\nbool gfx_material_has_any (const std::string &name)\n{\n GFX_MAT_SYNC;\n return material_db.find(name) != material_db.end();\n}\n\nvoid gfx_material_add_dependencies (const std::string &name, DiskResource *into)\n{\n if (!gfx_material_has_any(name)) GRIT_EXCEPT(\"Non-existent material: \\\"\"+name+\"\\\"\");\n material_db[name]->addDependencies(into);\n}\n\nvoid gfx_shutdown_lua (lua_State *L)\n{\n hud_shutdown(L);\n}\n\nvoid gfx_shutdown (void)\n{\n try {\n if (shutting_down) return;\n gfx_debug_shutdown();\n gfx_decal_shutdown();\n shutting_down = true;\n delete eye_left;\n delete eye_right;\n\n // Allow these smart pointers to be unloaded.\n global_env_cube0 = nullptr;\n global_env_cube1 = nullptr;\n fade_dither_map = nullptr;\n corona_map = nullptr;\n shadow_pcf_noise_map = nullptr;\n colour_grade_lut = nullptr;\n\n gfx_shader_shutdown();\n ftcv.setNull();\n if (ogre_sm && ogre_root) ogre_root->destroySceneManager(ogre_sm);\n if (ogre_root) OGRE_DELETE ogre_root; // internally deletes ogre_rs\n OGRE_DELETE octree;\n OGRE_DELETE cg;\n } catch (Ogre::Exception &e) {\n GRIT_EXCEPT(\"Couldn't shut down graphics subsystem: \"+e.getFullDescription());\n }\n\n}\n\n// }}}\n\n\n\n// {{{ COLOURSPACE CONVERSION UTILS\n\n\nVector3 gfx_colour_grade_look_up (const Vector3 &v)\n{\n if (colour_grade_lut == nullptr) return v;\n return colour_grade_lut->lookUp(v);\n}\n\n// }}}\n" }, { "alpha_fraction": 0.6627907156944275, "alphanum_fraction": 0.6812015771865845, "avg_line_length": 33.36666488647461, "blob_id": "05ed821e78c5711cc7576ffc9bed0627f8d43174", "content_id": "1560d39739335759dd55729138e4ccd3c2dc3523", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Shell", "length_bytes": 1032, "license_type": "permissive", "max_line_length": 142, "num_lines": 30, "path": "/remote_build.sh", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "#!/bin/bash\n\nexport CLOUDSDK_CORE_ACCOUNT=\"sparkprime@gmail.com\"\nexport CLOUDSDK_CORE_PROJECT=\"sparkprime-gcp\"\n\nINSTANCE_NAME=\"grit-build\"\nZONE=\"us-central1-b\"\n\nENDPOINT=\"$INSTANCE_NAME.gritengine.com\"\nPORT=\"3389\"\nRES=\"1920x1080\"\nUSERNAME=\"sparkprime\"\nPASSWORD=\"$(cat ~/.grit-build-pass)\"\n\ngcloud compute instances start \"$INSTANCE_NAME\" --zone=\"$ZONE\"\necho 'Waiting for RDP to come up...'\nwhile ! echo exit | nc \"$ENDPOINT\" \"$PORT\"; do sleep 1; done\necho 'RDP up!'\necho 'Use shutdown /s /t 0 from the Windows console to shut down.'\n# This works for xfreerdp 1.0.2\nxfreerdp -u \"$USERNAME\" -K -g \"$RES\" -p \"$PASSWORD\" \"$ENDPOINT\"\n# This one is a later version (I think)\n# xfreerdp /u:\"$USERNAME\" -grab-keyboard /size:\"$RES\" /p:\"$PASSWORD\" /v:\"${ENDPOINT}:${PORT}\"\necho 'Waiting for instance to stop...'\nwhile true; do\n STATUS=\"$(gcloud compute instances describe --zone=\"$ZONE\" \"$INSTANCE_NAME\" --format=json | jsonnet -S -e '(import \"/dev/stdin\").status')\"\n test \"$STATUS\" == 'TERMINATED' && break\n echo \"Status: $STATUS\"\n sleep 5\ndone\n\n" }, { "alpha_fraction": 0.6886827349662781, "alphanum_fraction": 0.702782928943634, "avg_line_length": 38.60293960571289, "blob_id": "6408b9b5563ac20fe0b6881e180acae01faf7dc5", "content_id": "3a99e8b576a03819fe758513eb92c0322bb3d007", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 2695, "license_type": "permissive", "max_line_length": 93, "num_lines": 68, "path": "/engine/joystick.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#ifndef Joystick_h\n#define Joystick_h\n\n#include <vector>\n\n/** Maximum number of buttons and axes allowed on a joystick. */\n#define JOYSTICK_MAX_NUM_BUTTONS 11 // 1 to 11\n#define JOYSTICK_MAX_NUM_AXES 8 // 1 to 8\n\n/** A class to be inheritted by a particular platform's implementation for\n * signalling joystick input to the engine. */\nclass Joystick {\n\npublic:\n\n /** The kind of joystick boolean button being pressed(1=on) or unpressed(0=off). */\n enum Button {\n JOYSTICK_BUTTON1 = 1, JOYSTICK_BUTTON2, JOYSTICK_BUTTON3,\n JOYSTICK_BUTTON4, JOYSTICK_BUTTON5, JOYSTICK_BUTTON6,\n JOYSTICK_BUTTON7, JOYSTICK_BUTTON8, JOYSTICK_BUTTON9,\n JOYSTICK_BUTTON10,JOYSTICK_BUTTON11\n };\n\n /** The kind of joystick analog axes being moved */\n enum Axis {\n JOYSTICK_AXE1 = 1, JOYSTICK_AXE2, JOYSTICK_AXE3,\n JOYSTICK_AXE4, JOYSTICK_AXE5, JOYSTICK_AXE6,\n JOYSTICK_AXE7, JOYSTICK_AXE8\n };\n\n /** Empty destructor. */\n virtual ~Joystick() { }\n\n /** Return the joystick events since the last call.\n *\n * Should be called frequently (e.g. every graphics frame).\n *\n * \\param buttons A list of joystick buttons pressed since the last call.\n * \\param axes A list of joystick buttons pressed since the last call.\n * \\param axes A list of joystick buttons pressed since the last call.\n */\n virtual bool getEvents(std::vector<signed char> *buttons, std::vector<signed char> *axes,\n std::vector<short int> *values) = 0;\n\n};\n\n#endif //Joystick_h\n\n\n" }, { "alpha_fraction": 0.6373056769371033, "alphanum_fraction": 0.6839378476142883, "avg_line_length": 26.571428298950195, "blob_id": "9bd8e6ecb2dc82e4a04f831ca1e0102199c88f7f", "content_id": "a0f7165d7b326618f91254c36024f0ea7a89dcca", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Lua", "length_bytes": 193, "license_type": "permissive", "max_line_length": 47, "num_lines": 7, "path": "/engine/tests/engine/one_frame.lua", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "gfx_colour_grade(`neutral.lut.png`)\ngfx_option('POST_PROCESSING', true)\nfunction dump(x)\n return tostring(x)\nend\ngfx_render(0.1, vec(0, 0, 0), quat(1, 0, 0, 0))\ngfx_screenshot('output.png')\n" }, { "alpha_fraction": 0.46820810437202454, "alphanum_fraction": 0.594733476638794, "avg_line_length": 25.827587127685547, "blob_id": "548c7f3d0b5993bf60258181f07feb61a944eba3", "content_id": "99d49c7ed7b5b98150868148638da8bf9f170870", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Lua", "length_bytes": 1557, "license_type": "permissive", "max_line_length": 108, "num_lines": 58, "path": "/engine/tests/engine/gfx_ranged_instances/test.lua", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "gfx_colour_grade(`neutral.lut.png`)\ngfx_fade_dither_map `stipple.png`\n\n\ngfx_register_shader(`Money`, {\n tex = {\n uniformKind = \"TEXTURE2D\",\n },\n vertexCode = [[\n var normal_ws = rotate_to_world(vert.normal.xyz);\n ]],\n dangsCode = [[\n out.diffuse = sample(mat.tex, vert.coord0.xy).rgb;\n out.gloss = 0;\n out.specular = 0;\n out.normal = normal_ws;\n ]],\n additionalCode = [[\n // out.colour = sample(mat.tex, vert.coord0.xy).rgb;\n // out.colour = Float3(1, 1, 1);\n ]],\n})\n\n-- Used by Money.mesh.\nregister_material(`Money`, {\n shader = `Money`,\n tex = `Money_d.dds`,\n additionalLighting = false,\n})\n\n\nprint \"Loading Money_d.dds\" \ndisk_resource_load(`Money_d.dds`)\nprint \"Loading Money.mesh\" \ndisk_resource_load(`Money.mesh`)\n\n\ngfx_sunlight_direction(vec(0, 0, -1))\ngfx_sunlight_diffuse(vec(1, 1, 1))\ngfx_sunlight_specular(vec(1, 1, 1))\n\n\nb = gfx_instances_make(`Money.mesh`)\nb.castShadows = false\nb:add(vec(0, 0, 0), quat(1, 0, 0, 0), 1)\nb:add(vec(0.4, 0, 0), quat(1, 0, 0, 0), 1)\nb:add(vec(0, 0.4, 0), quat(1, 0, 0, 0), 1)\nb:add(vec(0.4, 0.4, 0), quat(1, 0, 0, 0), 1)\nb:add(vec(0.4, 0.8, 0), quat(0, 1, 0, 0), 1)\nb:add(vec(0.8, 0.8, 0), quat(0, 1, 0, 0), 0.5)\n\n-- b2 = gfx_body_make(`Money.mesh`)\n-- b2.castShadows = false\n\ngfx_render(0.1, vec(0.04362189, -0.9296255, 0.5302261), quat(0.9800102, -0.1631184, 0.01870036, -0.1123512))\ngfx_render(0.1, vec(0.04362189, -0.9296255, 0.5302261), quat(0.9800102, -0.1631184, 0.01870036, -0.1123512))\n\ngfx_screenshot('output.png')\n\n" }, { "alpha_fraction": 0.6091622114181519, "alphanum_fraction": 0.6227816939353943, "avg_line_length": 39.38333511352539, "blob_id": "cc2d49fa91d1829c4ffcce70827c33f4695d9625", "content_id": "7a8688ea497ed94496e81e04b479e4971fabf7c5", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 4846, "license_type": "permissive", "max_line_length": 154, "num_lines": 120, "path": "/engine/gfx/gfx_gasoline_backend.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <sstream>\n#include <string>\n\n#include \"gfx_gasoline_parser.h\"\n#include \"gfx_gasoline_type_system.h\"\n\n#ifndef GFX_GSL_BACKEND_H\n#define GFX_GSL_BACKEND_H\n\nclass GfxGslBackendUnparser {\n std::stringstream ss;\n const std::string varPref;\n\n public:\n GfxGslBackendUnparser (const std::string &var_pref)\n : varPref(var_pref)\n { }\n\n void zeroInitialise(const std::string &space, const std::string &name, GfxGslType *t);\n void unparseType (const GfxGslType *t_);\n void unparse (const GfxGslAst *ast_, int indent);\n\n std::string getUserVertexFunction (void)\n {\n std::stringstream ss2;\n ss2 << \"void func_user_vertex (out Float3 out_position)\\n\";\n ss2 << \"{\\n\";\n ss2 << \" out_position = transform_to_world(vert_position.xyz);\\n\";\n ss2 << ss.str();\n ss2 << \"}\\n\";\n return ss2.str();\n }\n std::string getUserDangsFunction (void)\n {\n std::stringstream ss2;\n ss2 << \"void func_user_dangs (out Float3 out_diffuse, out Float out_alpha, out Float3 out_normal, out Float out_gloss, out Float out_specular)\\n\";\n ss2 << \"{\\n\";\n ss2 << \" out_diffuse = Float3(0.5, 0.25, 0.0);\\n\";\n ss2 << \" out_alpha = 1.0;\\n\";\n ss2 << \" out_normal = Float3(0.0, 0.0, 1.0);\\n\";\n ss2 << \" out_gloss = 1.0;\\n\";\n ss2 << \" out_specular = 0.04;\\n\";\n ss2 << ss.str();\n ss2 << \"}\\n\";\n return ss2.str();\n }\n std::string getUserColourAlphaFunction (void)\n {\n std::stringstream ss2;\n ss2 << \"void func_user_colour (out Float3 out_colour, out Float out_alpha)\\n\";\n ss2 << \"{\\n\";\n ss2 << \" out_colour = Float3(0.0, 0.0, 0.0);\\n\";\n ss2 << \" out_alpha = 1;\\n\";\n ss2 << ss.str();\n ss2 << \"}\\n\";\n return ss2.str();\n }\n};\n\nstd::string gfx_gasoline_generate_preamble_functions (void);\n\nstd::string gfx_gasoline_generate_global_fields (const GfxGslContext &ctx, bool reg);\n\nstd::string gfx_gasoline_generate_var_decls (const GfxGslTypeMap &vars);\n\nstd::string gfx_gasoline_generate_trans_encode (const std::vector<GfxGslTrans> &trans,\n const std::string &var_pref);\n\nstd::string gfx_gasoline_generate_trans_decode (const std::vector<GfxGslTrans> &trans,\n const std::string &pref,\n GfxGslTrans::Kind only);\n\n/** Generate general purpose utility functions for computing lighting. */\nstd::string gfx_gasoline_preamble_lighting (const GfxGslConfigEnvironment &cfg_env);\n\n/** Generate general purpose utility functions for dither fading. */\nstd::string gfx_gasoline_preamble_fade (void);\n\n/** Generate general purpose utility functions for transforming geometry to world space. */\nstd::string gfx_gasoline_preamble_transformation (bool first_person,\n const GfxGslMeshEnvironment &mesh_env);\n\ntypedef std::map<std::string, const GfxGslFloatType *> GfxGslInternalMap;\nstatic inline void gfx_gasoline_add_internal_trans(const GfxGslInternalMap &internals,\n std::vector<GfxGslTrans> &trans)\n{\n for (const auto &pair : internals) {\n if (pair.second->dim == 1) {\n trans.emplace_back(GfxGslTrans{ GfxGslTrans::INTERNAL, {pair.first}, pair.second });\n } else {\n const char *chars[] = {\"x\", \"y\", \"z\"};\n for (unsigned i = 0; i < pair.second->dim ; ++i) {\n trans.emplace_back(\n GfxGslTrans{ GfxGslTrans::INTERNAL, {pair.first, chars[i]}, pair.second });\n }\n }\n }\n}\n\n#endif\n" }, { "alpha_fraction": 0.6743341684341431, "alphanum_fraction": 0.6761501431465149, "avg_line_length": 49.06060791015625, "blob_id": "0cd66e55ca7044faf80b6024c4d1534db78b2059", "content_id": "b98984680315b8f7fe35e82ed2703ddd60cec865", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3304, "license_type": "permissive", "max_line_length": 120, "num_lines": 66, "path": "/dependencies/quex-0.34.1/quex/core_engine/state_machine/sequentialize.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "#! /usr/bin/env python\nimport sys\nfrom copy import deepcopy\nsys.path.append(\"../\")\n\nfrom core import *\n\n\ndef do(the_state_machine_list, LeaveIntermediateAcceptanceStatesF=False, \n MountToFirstStateMachineF=False, CloneRemainingStateMachinesF=True):\n \"\"\"Creates a state machine connecting all state machines in the array \n 'state_machine_list'. When the flag 'LeaveIntermediateAcceptanceStatesF'\n is given as True, the connection points between the state machines\n will remain acceptances states. In any other case (e.g. the normal\n sequentialization) the connection points leave there acceptance \n status and only the last state machine in the list keeps its\n acceptance states.\n\n If MountToFirstStateMachineF is set, then the first state machine will\n contain the result of the concatination.\n \"\"\"\n assert type(the_state_machine_list) == list \n assert len(the_state_machine_list) != 0\n assert map(lambda x: x.__class__.__name__, the_state_machine_list) == [\"StateMachine\"] * len(the_state_machine_list)\n\n for sm in the_state_machine_list: # DEBUG\n sm.assert_consistency() # DEBUG\n\n # state machines with no states can be deleted from the list. they do not do anything\n # and do not introduce triggers. \n state_machine_list = filter(lambda sm: not sm.is_empty(), the_state_machine_list) \n \n if len(state_machine_list) < 2:\n if len(state_machine_list) < 1: return StateMachine()\n else: return state_machine_list[0]\n\n # (*) collect all transitions from both state machines into a single one\n # (clone to ensure unique identifiers of states)\n result = state_machine_list[0]\n if not MountToFirstStateMachineF: result = result.clone()\n\n # (*) need to clone the state machines, i.e. provide their internal\n # states with new ids, but the 'behavior' remains. This allows\n # state machines to appear twice, or being used in 'larger'\n # conglomerates.\n appended_sm_list = state_machine_list[1:]\n if CloneRemainingStateMachinesF: \n appended_sm_list = map(lambda sm: sm.clone(), appended_sm_list)\n\n # (*) all but last state machine enter the subsequent one, in case of SUCCESS\n # NOTE: The start index is unique. Therefore, one can assume that each\n # appended_sm_list's '.states' dictionary has different keys. One can simply\n # take over all transitions of a start index into the result without\n # considering interferences (see below)\n for appendix in appended_sm_list:\n appendix.assert_consistency() # DEBUG\n # Mount on every acceptance state the initial state of the following state\n # machine via epsilon transition.\n result.mount_to_acceptance_states(appendix.init_state_index, \n CancelStartAcceptanceStateF = not LeaveIntermediateAcceptanceStatesF)\n for state_index, state in appendix.states.items(): \n result.states[state_index] = state # state is already cloned (if desired), so no deepcopy here\n\n # (*) double check for consistency (each target state is contained in state machine)\n result.assert_consistency() # DEBUG\n return result\n" }, { "alpha_fraction": 0.4490017294883728, "alphanum_fraction": 0.4613121449947357, "avg_line_length": 36.97288513183594, "blob_id": "1f3047a1f5e0a956ca9832b2b5be5d9c52a3a90b", "content_id": "70e5f82b220997b5c80297e5e9e069c373fcc59d", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 35011, "license_type": "permissive", "max_line_length": 114, "num_lines": 922, "path": "/engine/gfx/gfx_gasoline_parser.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <cstdlib>\n\n#include <list>\n#include <map>\n#include <sstream>\n\n#include <exception.h>\n\n#include <centralised_log.h>\n\n#include \"gfx_gasoline.h\"\n#include \"gfx_gasoline_parser.h\"\n#include \"gfx_gasoline_type_system.h\"\n\n// Thankyou, Windows...\n#ifdef OUT\n#undef OUT\n#endif\n\n// Workaround for g++ not supporting moveable streams.\n#define error(loc) (EXCEPT << \"Parse error: \" << loc << \": \")\n\nenum TokenKind {\n BODY,\n DISCARD,\n ELSE,\n END_OF_FILE, // Holds location info if EOF error.\n FOR,\n FRAG,\n GLOBAL,\n IDENTIFIER, // Has val.\n IF,\n LITERAL_NUMBER, // Has val.\n MAT,\n OUT,\n RETURN,\n SYMBOL, // Has val.\n VAR,\n VERT,\n\n // Type tokens are distinguished by having capital letters.\n TYPE_FLOAT,\n TYPE_FLOAT2,\n TYPE_FLOAT3,\n TYPE_FLOAT4,\n TYPE_FLOAT1x1,\n TYPE_FLOAT2x1,\n TYPE_FLOAT3x1,\n TYPE_FLOAT4x1,\n TYPE_FLOAT1x2,\n TYPE_FLOAT2x2,\n TYPE_FLOAT3x2,\n TYPE_FLOAT4x2,\n TYPE_FLOAT1x3,\n TYPE_FLOAT2x3,\n TYPE_FLOAT3x3,\n TYPE_FLOAT4x3,\n TYPE_FLOAT1x4,\n TYPE_FLOAT2x4,\n TYPE_FLOAT3x4,\n TYPE_FLOAT4x4,\n TYPE_FLOAT_TEXTURE1,\n TYPE_FLOAT_TEXTURE2,\n TYPE_FLOAT_TEXTURE3,\n TYPE_FLOAT_TEXTURE4,\n TYPE_FLOAT_TEXTURE_CUBE,\n TYPE_INT,\n TYPE_INT2,\n TYPE_INT3,\n TYPE_INT4,\n TYPE_BOOL,\n TYPE_VOID,\n TYPE_GLOBAL,\n TYPE_MAT,\n TYPE_VERT,\n TYPE_OUT,\n TYPE_BODY,\n TYPE_FRAG,\n};\n\nstatic std::string to_string (TokenKind k)\n{\n switch (k) {\n case BODY: return \"body\";\n case DISCARD: return \"discard\";\n case ELSE: return \"else\";\n case END_OF_FILE: return \"EOF\";\n case FOR: return \"for\";\n case FRAG: return \"frag\";\n case GLOBAL: return \"global\";\n case IDENTIFIER: return \"identifier\";\n case IF: return \"if\";\n case LITERAL_NUMBER: return \"number\";\n case MAT: return \"mat\";\n case OUT: return \"out\";\n case RETURN: return \"return\";\n case SYMBOL: return \"symbol\";\n case VAR: return \"var\";\n case VERT: return \"vert\";\n\n case TYPE_FLOAT: return \"Float\";\n case TYPE_FLOAT2: return \"Float2\";\n case TYPE_FLOAT3: return \"Float3\";\n case TYPE_FLOAT4: return \"Float4\";\n case TYPE_FLOAT1x1: return \"Float1x1\";\n case TYPE_FLOAT2x1: return \"Float2x1\";\n case TYPE_FLOAT3x1: return \"Float3x1\";\n case TYPE_FLOAT4x1: return \"Float4x1\";\n case TYPE_FLOAT1x2: return \"Float1x2\";\n case TYPE_FLOAT2x2: return \"Float2x2\";\n case TYPE_FLOAT3x2: return \"Float3x2\";\n case TYPE_FLOAT4x2: return \"Float4x2\";\n case TYPE_FLOAT1x3: return \"Float1x3\";\n case TYPE_FLOAT2x3: return \"Float2x3\";\n case TYPE_FLOAT3x3: return \"Float3x3\";\n case TYPE_FLOAT4x3: return \"Float4x3\";\n case TYPE_FLOAT1x4: return \"Float1x4\";\n case TYPE_FLOAT2x4: return \"Float2x4\";\n case TYPE_FLOAT3x4: return \"Float3x4\";\n case TYPE_FLOAT4x4: return \"Float4x4\";\n case TYPE_FLOAT_TEXTURE1: return \"FloatTexture1\";\n case TYPE_FLOAT_TEXTURE2: return \"FloatTexture2\";\n case TYPE_FLOAT_TEXTURE3: return \"FloatTexture3\";\n case TYPE_FLOAT_TEXTURE4: return \"FloatTexture4\";\n case TYPE_FLOAT_TEXTURE_CUBE: return \"FloatTextureCube\";\n case TYPE_INT: return \"Int\";\n case TYPE_INT2: return \"Int2\";\n case TYPE_INT3: return \"Int3\";\n case TYPE_INT4: return \"Int4\";\n case TYPE_BOOL: return \"Bool\";\n case TYPE_VOID: return \"Void\";\n case TYPE_GLOBAL: return \"Global\";\n case TYPE_MAT: return \"Mat\";\n case TYPE_VERT: return \"Vert\";\n case TYPE_OUT: return \"Out\";\n case TYPE_BODY: return \"Body\";\n case TYPE_FRAG: return \"Frag\";\n }\n EXCEPT << \"Internal error.\" << ENDL;\n}\n\nstruct Token {\n TokenKind kind;\n std::string val;\n GfxGslLocation loc;\n Token (TokenKind kind, const GfxGslLocation &loc)\n : kind(kind), val(to_string(kind)), loc(loc)\n { }\n Token (TokenKind kind, const std::string &val, const GfxGslLocation &loc)\n : kind(kind), val(val), loc(loc)\n { }\n};\n\nstatic inline bool operator==(const Token &a, const Token &b)\n{\n return a.val == b.val;\n}\n\nstatic inline std::ostream &operator<<(std::ostream &o, const Token &v)\n{\n o << v.val;\n return o;\n}\n\n// Symbol tokens are arbitrary-length uninterrupted sequences of these characters\nbool is_symbol (char c)\n{\n switch (c) {\n case '=': case '!': case '+': case '-': case '*': case '/': case '%': case '^':\n case '<': case '>':\n case '&': case '|':\n return true;\n }\n return false;\n}\n\nstatic bool is_upper (char c) { return c >= 'A' && c <= 'Z'; }\nstatic bool is_lower (char c) { return c >= 'a' && c <= 'z'; }\nstatic bool is_number (char c) { return c >= '0' && c <= '9'; }\nstatic bool is_identifier1 (char c) { return c == '_' || is_upper(c) || is_lower(c); }\nstatic bool is_identifier (char c) { return is_identifier1(c) || is_number(c); }\n\nstatic Token lex_number (const char *&c, const GfxGslLocation &here)\n{\n enum State {\n BEGIN,\n AFTER_ZERO,\n AFTER_ONE_TO_NINE,\n AFTER_DOT,\n AFTER_DIGIT,\n AFTER_EXP,\n AFTER_EXP_SIGN,\n AFTER_EXP_DIGIT\n } state;\n\n std::stringstream ss;\n\n state = BEGIN;\n while (true) {\n switch (state) {\n case BEGIN:\n switch (*c) {\n case '0':\n state = AFTER_ZERO;\n break;\n\n case '1': case '2': case '3': case '4':\n case '5': case '6': case '7': case '8': case '9':\n state = AFTER_ONE_TO_NINE;\n break;\n\n default:\n error(here) << \"Couldn't lex number\" << ENDL;\n }\n break;\n\n case AFTER_ZERO:\n switch (*c) {\n case '.':\n state = AFTER_DOT;\n break;\n\n case 'E': case 'e':\n state = AFTER_EXP;\n break;\n\n default:\n goto end;\n }\n break;\n\n case AFTER_ONE_TO_NINE:\n switch (*c) {\n case '.':\n state = AFTER_DOT;\n break;\n\n case 'E': case 'e': \n state = AFTER_EXP;\n break;\n\n case '0': case '1': case '2': case '3': case '4':\n case '5': case '6': case '7': case '8': case '9':\n state = AFTER_ONE_TO_NINE;\n break;\n\n default:\n goto end;\n }\n break;\n\n case AFTER_DOT:\n switch (*c) {\n case '0': case '1': case '2': case '3': case '4':\n case '5': case '6': case '7': case '8': case '9':\n state = AFTER_DIGIT;\n break;\n\n default:\n error(here) << \"Couldn't lex number, junk after decimal point: \" << *c << ENDL;\n }\n break;\n\n case AFTER_DIGIT:\n switch (*c) {\n case 'E': case 'e': \n state = AFTER_EXP;\n break;\n\n case '0': case '1': case '2': case '3': case '4':\n case '5': case '6': case '7': case '8': case '9':\n state = AFTER_DIGIT;\n break;\n\n default:\n goto end;\n }\n break;\n\n case AFTER_EXP:\n switch (*c) {\n case '+': case '-':\n state = AFTER_EXP_SIGN;\n break;\n\n case '0': case '1': case '2': case '3': case '4':\n case '5': case '6': case '7': case '8': case '9':\n state = AFTER_EXP_DIGIT;\n break;\n\n default:\n error(here) << \"Couldn't lex number, junk after E: \" << *c << ENDL;\n }\n break;\n\n case AFTER_EXP_SIGN:\n switch (*c) {\n case '0': case '1': case '2': case '3': case '4':\n case '5': case '6': case '7': case '8': case '9':\n state = AFTER_EXP_DIGIT;\n break;\n\n default:\n error(here) << \"Couldn't lex number, junk after exponent sign: \" << *c << ENDL;\n }\n break;\n\n case AFTER_EXP_DIGIT:\n switch (*c) {\n case '0': case '1': case '2': case '3': case '4':\n case '5': case '6': case '7': case '8': case '9':\n state = AFTER_EXP_DIGIT;\n break;\n\n default:\n goto end;\n }\n break;\n }\n ss << *c;\n c++;\n }\n end:\n c--;\n return Token(LITERAL_NUMBER, ss.str(), here);\n}\n\nstd::list<Token> lex (const std::string &shader)\n{\n unsigned long this_line_number = 1;\n const char *this_line = &shader[0];\n std::list<Token> r;\n const char *c = shader.c_str();\n for ( ; *c != '\\0' ; ++c) {\n // Columns start from 1, hence the + 1.\n GfxGslLocation here(this_line_number, c - this_line + 1);\n switch (*c) {\n // White space\n case '\\n':\n this_line_number++;\n this_line = c + 1;\n case ' ': case '\\t': case '\\r':\n break;\n\n // Symbols that cannot be combined with a =\n case '{': case '}': case '(': case ')': case '.': case ',': case ';':\n case '[': case ']': case ':':\n r.emplace_back(SYMBOL, std::string({*c}), here);\n break;\n\n default:\n if (is_symbol(*c)) {\n /* Old-style C comments */\n if (*c == '/' && *(c+1) == '*') {\n c += 2;\n while (*c != '\\0' && !(*c == '*' && *(c+1) == '/')) {\n if (*c == '\\n') {\n // Maintain line and column vars.\n this_line_number++;\n this_line = c+1;\n }\n ++c;\n }\n if (*c == '\\0') {\n error(here) << \"Multi-line comment has no terminating */.\";\n }\n c++; // Set counter to the end /.\n break;\n }\n\n // Single-line C++ style comments\n if (*c == '/' && *(c+1) == '/') {\n while (*c != '\\0' && *c != '\\n') ++c;\n this_line_number++;\n this_line = c + 1;\n break;\n }\n\n // Lex operator -- sequence of symbols chars that ends at the first /* // and\n // cannot end with a - ! ~ or + (unless the operator is that single char).\n const char *operator_begin = c;\n std::stringstream ss;\n while (is_symbol(*c)) {\n // Not allowed // in operators\n if (*c == '/' && *(c+1) == '/') break;\n // Not allowed /* in operators\n if (*c == '/' && *(c+1) == '*') break;\n ++c;\n }\n while (c > operator_begin + 1) {\n switch (*(c - 1)) {\n case '+': case '-': case '~': case '!':\n c--;\n break;\n default:\n goto operator_done;\n }\n }\n operator_done:\n r.emplace_back(SYMBOL, std::string(operator_begin, c), here);\n c--; // Leave it on the last symbol.\n\n } else if (is_identifier1(*c)) {\n std::string id;\n for (; is_identifier(*c) ; ++c) {\n id += *c;\n }\n --c;\n if (id == \"discard\") {\n r.emplace_back(DISCARD, id, here);\n } else if (id == \"else\") {\n r.emplace_back(ELSE, id, here);\n } else if (id == \"for\") {\n r.emplace_back(FOR, id, here);\n } else if (id == \"frag\") {\n r.emplace_back(FRAG, id, here);\n } else if (id == \"global\") {\n r.emplace_back(GLOBAL, id, here);\n } else if (id == \"if\") {\n r.emplace_back(IF, id, here);\n } else if (id == \"mat\") {\n r.emplace_back(MAT, id, here);\n } else if (id == \"return\") {\n r.emplace_back(RETURN, id, here);\n } else if (id == \"var\") {\n r.emplace_back(VAR, id, here);\n } else if (id == \"vert\") {\n r.emplace_back(VERT, id, here);\n } else if (id == \"out\") {\n r.emplace_back(OUT, id, here);\n } else if (id == \"body\") {\n r.emplace_back(BODY, id, here);\n\n } else if (id == \"Float\") {\n r.emplace_back(TYPE_FLOAT, id, here);\n } else if (id == \"Float2\") {\n r.emplace_back(TYPE_FLOAT2, id, here);\n } else if (id == \"Float3\") {\n r.emplace_back(TYPE_FLOAT3, id, here);\n } else if (id == \"Float4\") {\n r.emplace_back(TYPE_FLOAT4, id, here);\n } else if (id == \"Float1x1\") {\n r.emplace_back(TYPE_FLOAT1x1, id, here);\n } else if (id == \"Float2x1\") {\n r.emplace_back(TYPE_FLOAT2x1, id, here);\n } else if (id == \"Float3x1\") {\n r.emplace_back(TYPE_FLOAT3x1, id, here);\n } else if (id == \"Float4x1\") {\n r.emplace_back(TYPE_FLOAT4x1, id, here);\n } else if (id == \"Float1x2\") {\n r.emplace_back(TYPE_FLOAT1x2, id, here);\n } else if (id == \"Float2x2\") {\n r.emplace_back(TYPE_FLOAT2x2, id, here);\n } else if (id == \"Float3x2\") {\n r.emplace_back(TYPE_FLOAT3x2, id, here);\n } else if (id == \"Float4x2\") {\n r.emplace_back(TYPE_FLOAT4x2, id, here);\n } else if (id == \"Float1x3\") {\n r.emplace_back(TYPE_FLOAT1x3, id, here);\n } else if (id == \"Float2x3\") {\n r.emplace_back(TYPE_FLOAT2x3, id, here);\n } else if (id == \"Float3x3\") {\n r.emplace_back(TYPE_FLOAT3x3, id, here);\n } else if (id == \"Float4x3\") {\n r.emplace_back(TYPE_FLOAT4x3, id, here);\n } else if (id == \"Float1x4\") {\n r.emplace_back(TYPE_FLOAT1x4, id, here);\n } else if (id == \"Float2x4\") {\n r.emplace_back(TYPE_FLOAT2x4, id, here);\n } else if (id == \"Float3x4\") {\n r.emplace_back(TYPE_FLOAT3x4, id, here);\n } else if (id == \"Float4x4\") {\n r.emplace_back(TYPE_FLOAT4x4, id, here);\n } else if (id == \"FloatTexture1\") {\n r.emplace_back(TYPE_FLOAT_TEXTURE1, id, here);\n } else if (id == \"FloatTexture2\") {\n r.emplace_back(TYPE_FLOAT_TEXTURE2, id, here);\n } else if (id == \"FloatTexture3\") {\n r.emplace_back(TYPE_FLOAT_TEXTURE3, id, here);\n } else if (id == \"FloatTexture4\") {\n r.emplace_back(TYPE_FLOAT_TEXTURE4, id, here);\n } else if (id == \"FloatTextureCube\") {\n r.emplace_back(TYPE_FLOAT_TEXTURE_CUBE, id, here);\n } else if (id == \"Int\") {\n r.emplace_back(TYPE_INT, id, here);\n } else if (id == \"Int2\") {\n r.emplace_back(TYPE_INT2, id, here);\n } else if (id == \"Int3\") {\n r.emplace_back(TYPE_INT3, id, here);\n } else if (id == \"Int4\") {\n r.emplace_back(TYPE_INT4, id, here);\n } else if (id == \"Bool\") {\n r.emplace_back(TYPE_BOOL, id, here);\n } else if (id == \"Void\") {\n r.emplace_back(TYPE_VOID, id, here);\n } else if (id == \"Global\") {\n r.emplace_back(TYPE_GLOBAL, id, here);\n } else if (id == \"Mat\") {\n r.emplace_back(TYPE_MAT, id, here);\n } else if (id == \"Vert\") {\n r.emplace_back(TYPE_VERT, id, here);\n } else if (id == \"Out\") {\n r.emplace_back(TYPE_OUT, id, here);\n } else if (id == \"Body\") {\n r.emplace_back(TYPE_BODY, id, here);\n } else if (id == \"Frag\") {\n r.emplace_back(TYPE_FRAG, id, here);\n\n } else {\n r.emplace_back(IDENTIFIER, id, here);\n }\n } else if (is_number(*c)) {\n r.push_back(lex_number(c, here));\n } else {\n error(here) << \"Did not understand character \\\"\" << std::string({*c}) << \"\\\"\"\n << ENDL;\n }\n }\n }\n r.emplace_back(END_OF_FILE, \"EOF\", GfxGslLocation(this_line_number, c - this_line + 1));\n //for (auto t : r) std::cout << t << std::endl;\n return r;\n}\n\n\n/////////////\n// PARSING //\n/////////////\n\nstatic const int precedence_apply = 1;\nstatic const int precedence_uop = 2;\nstatic const int precedence_max = 7;\n\n// Can't make this const, as [] is not a const operator.\nstatic std::map<GfxGslOp, int> precedence_op = {\n {GFX_GSL_OP_MUL, 3},\n {GFX_GSL_OP_DIV, 3},\n {GFX_GSL_OP_MOD, 3},\n\n {GFX_GSL_OP_ADD, 4},\n {GFX_GSL_OP_SUB, 4},\n\n {GFX_GSL_OP_LT, 5},\n {GFX_GSL_OP_LTE, 5},\n {GFX_GSL_OP_GT, 5},\n {GFX_GSL_OP_GTE, 5},\n\n {GFX_GSL_OP_EQ, 6},\n {GFX_GSL_OP_NE, 6},\n\n {GFX_GSL_OP_AND, 7},\n {GFX_GSL_OP_OR, 7},\n};\n\nstatic inline bool is_op(const std::string &symbol, GfxGslOp &op)\n{\n auto it = op_map.find(symbol);\n if (it == op_map.end()) return false;\n op = it->second;\n return true;\n}\n\n\n\nnamespace {\n class Parser {\n GfxGslAllocator &alloc;\n std::list<Token> tokens;\n\n Token peek (void) { return tokens.front(); }\n\n Token pop (void)\n {\n auto tok = peek();\n tokens.pop_front();\n return tok;\n }\n\n bool peekKind (TokenKind k, const char *val=nullptr)\n {\n auto tok = peek();\n if (tok.kind != k) return false;\n if (val != nullptr && tok.val != val) return false;\n return true;\n }\n\n bool maybePopKind (TokenKind k, const char *val=nullptr)\n {\n auto r = peekKind(k, val);\n if (r) pop();\n return r;\n }\n\n Token popKind (TokenKind k, const char *val=nullptr)\n {\n auto tok = pop();\n if (tok.kind != k || (val!=nullptr && tok.val != val)) {\n if (val == nullptr) {\n error(tok.loc) << \"Expected \" << to_string(k) << \", got \" << tok.val << ENDL;\n } else {\n error(tok.loc) << \"Expected \" << val << \", got \" << tok.val << ENDL;\n }\n }\n return tok;\n }\n\n public:\n\n Parser (GfxGslAllocator &alloc, std::list<Token> tokens)\n : alloc(alloc), tokens(tokens)\n { }\n\n GfxGslType *parseType (void)\n {\n GfxGslFloatVec black(0); // TODO(dcunnin): This is a hack.\n auto tok = pop();\n switch (tok.kind) {\n case TYPE_FLOAT: return alloc.makeType<GfxGslFloatType>(1);\n case TYPE_FLOAT2: return alloc.makeType<GfxGslFloatType>(2);\n case TYPE_FLOAT3: return alloc.makeType<GfxGslFloatType>(3);\n case TYPE_FLOAT4: return alloc.makeType<GfxGslFloatType>(4);\n case TYPE_FLOAT1x1: return alloc.makeType<GfxGslFloatMatrixType>(1, 1);\n case TYPE_FLOAT2x1: return alloc.makeType<GfxGslFloatMatrixType>(2, 1);\n case TYPE_FLOAT3x1: return alloc.makeType<GfxGslFloatMatrixType>(3, 1);\n case TYPE_FLOAT4x1: return alloc.makeType<GfxGslFloatMatrixType>(4, 1);\n case TYPE_FLOAT1x2: return alloc.makeType<GfxGslFloatMatrixType>(1, 2);\n case TYPE_FLOAT2x2: return alloc.makeType<GfxGslFloatMatrixType>(2, 2);\n case TYPE_FLOAT3x2: return alloc.makeType<GfxGslFloatMatrixType>(3, 2);\n case TYPE_FLOAT4x2: return alloc.makeType<GfxGslFloatMatrixType>(4, 2);\n case TYPE_FLOAT1x3: return alloc.makeType<GfxGslFloatMatrixType>(1, 3);\n case TYPE_FLOAT2x3: return alloc.makeType<GfxGslFloatMatrixType>(2, 3);\n case TYPE_FLOAT3x3: return alloc.makeType<GfxGslFloatMatrixType>(3, 3);\n case TYPE_FLOAT4x3: return alloc.makeType<GfxGslFloatMatrixType>(4, 3);\n case TYPE_FLOAT1x4: return alloc.makeType<GfxGslFloatMatrixType>(1, 4);\n case TYPE_FLOAT2x4: return alloc.makeType<GfxGslFloatMatrixType>(2, 4);\n case TYPE_FLOAT3x4: return alloc.makeType<GfxGslFloatMatrixType>(3, 4);\n case TYPE_FLOAT4x4: return alloc.makeType<GfxGslFloatMatrixType>(4, 4);\n case TYPE_FLOAT_TEXTURE1: return alloc.makeType<GfxGslFloatTextureType>(black, 1);\n case TYPE_FLOAT_TEXTURE2: return alloc.makeType<GfxGslFloatTextureType>(black, 2);\n case TYPE_FLOAT_TEXTURE3: return alloc.makeType<GfxGslFloatTextureType>(black, 3);\n case TYPE_FLOAT_TEXTURE4: return alloc.makeType<GfxGslFloatTextureType>(black, 4);\n case TYPE_FLOAT_TEXTURE_CUBE:\n return alloc.makeType<GfxGslFloatTextureCubeType>(black);\n case TYPE_INT: return alloc.makeType<GfxGslIntType>(1);\n case TYPE_INT2: return alloc.makeType<GfxGslIntType>(2);\n case TYPE_INT3: return alloc.makeType<GfxGslIntType>(3);\n case TYPE_INT4: return alloc.makeType<GfxGslIntType>(4);\n case TYPE_BOOL: return alloc.makeType<GfxGslBoolType>();\n case TYPE_VOID: return alloc.makeType<GfxGslVoidType>();\n case TYPE_GLOBAL: return alloc.makeType<GfxGslGlobalType>();\n case TYPE_MAT: return alloc.makeType<GfxGslMatType>();\n case TYPE_VERT: return alloc.makeType<GfxGslVertType>();\n case TYPE_OUT: return alloc.makeType<GfxGslOutType>();\n case TYPE_BODY: return alloc.makeType<GfxGslBodyType>();\n case TYPE_FRAG: return alloc.makeType<GfxGslFragType>();\n case SYMBOL: {\n if (tok.val == \"[\") {\n GfxGslAst *sz_ast = parseExpr(precedence_max);\n auto *sz_ast2 = dynamic_cast<GfxGslLiteralInt*>(sz_ast);\n if (sz_ast2 == nullptr || sz_ast2->val <= 0) {\n error(tok.loc) << \"Array size must be a positive integer\" << ENDL;\n }\n unsigned sz = unsigned(sz_ast2->val);\n popKind(SYMBOL, \"]\");\n GfxGslType *el = parseType();\n return alloc.makeType<GfxGslArrayType>(sz, el);\n }\n // Would put function type parsing here but we don't actually need it.\n } // Carry on to default case for bad symbol.\n default:\n error(tok.loc) << \"Expected a type, got \" << tok << ENDL;\n }\n }\n\n GfxGslAst *parseExpr (int precedence)\n {\n auto tok = peek();\n if (precedence == 0) {\n switch (tok.kind) {\n case MAT: return alloc.makeAst<GfxGslMat>(pop().loc);\n case GLOBAL: return alloc.makeAst<GfxGslGlobal>(pop().loc);\n case VERT: return alloc.makeAst<GfxGslVert>(pop().loc);\n case OUT: return alloc.makeAst<GfxGslOut>(pop().loc);\n case BODY: return alloc.makeAst<GfxGslBody>(pop().loc);\n case FRAG: return alloc.makeAst<GfxGslFrag>(pop().loc);\n case IDENTIFIER:\n case TYPE_FLOAT: case TYPE_FLOAT2: case TYPE_FLOAT3: case TYPE_FLOAT4: {\n auto tok = pop();\n return alloc.makeAst<GfxGslVar>(tok.loc, tok.val);\n }\n case LITERAL_NUMBER: {\n auto tok = pop();\n // If contains only [0-9].\n bool is_float = false;\n for (auto c : tok.val) {\n if (c < '0' || c > '9') is_float = true;\n }\n if (is_float)\n return alloc.makeAst<GfxGslLiteralFloat>(tok.loc, strtod(tok.val.c_str(), nullptr));\n else\n return alloc.makeAst<GfxGslLiteralInt>(tok.loc, strtol(tok.val.c_str(), nullptr, 10));\n }\n case SYMBOL:\n if (tok.val == \"(\") {\n // Parentheses\n pop();\n auto *expr = parseExpr(precedence_max);\n popKind(SYMBOL, \")\");\n return expr;\n } else if (tok.val == \"[\") {\n // Array Literal\n pop();\n popKind(SYMBOL, \"]\");\n GfxGslType *element_type = parseType();\n popKind(SYMBOL, \"{\");\n GfxGslAsts elements;\n bool comma = true;\n while (true) {\n if (!comma && maybePopKind(SYMBOL, \",\"))\n comma = true;\n if (maybePopKind(SYMBOL, \"}\")) break;\n elements.push_back(parseExpr(precedence_max));\n comma = false;\n }\n return alloc.makeAst<GfxGslLiteralArray>(tok.loc, element_type, elements);\n }\n // else follow into error\n\n default: \n error(tok.loc) << \"Unexpected: \" << tok << ENDL;\n }\n } else if (precedence == precedence_uop) {\n if (tok.kind == SYMBOL) {\n if (tok.val == \"!\") {\n pop();\n auto *expr = parseExpr(precedence_uop);\n auto *_false = alloc.makeAst<GfxGslLiteralBoolean>(tok.loc, false);\n return alloc.makeAst<GfxGslBinary>(tok.loc, expr, GFX_GSL_OP_EQ, _false);\n } else if (tok.val == \"-\") {\n pop();\n auto *expr = parseExpr(precedence_uop);\n auto *zero = alloc.makeAst<GfxGslLiteralInt>(tok.loc, 0);\n return alloc.makeAst<GfxGslBinary>(tok.loc, zero, GFX_GSL_OP_SUB, expr);\n }\n }\n }\n\n // Must be binary\n auto *a = parseExpr(precedence - 1);\n \n while (true) {\n\n if (peek().kind == END_OF_FILE) return a;\n\n if (peek().kind != SYMBOL) {\n error(tok.loc) << \"Not a symbol: \" << peek() << ENDL;\n }\n auto sym = peek().val;\n\n // special cases for things that arent binary operators\n if (precedence == precedence_apply) {\n if (sym == \"(\") {\n // Call\n Token lparen = pop();\n GfxGslAsts args;\n bool comma = true;\n while (true) {\n if (!comma && maybePopKind(SYMBOL, \",\"))\n comma = true;\n if (maybePopKind(SYMBOL, \")\")) break;\n args.push_back(parseExpr(precedence_max));\n comma = false;\n }\n if (auto *var = dynamic_cast<GfxGslVar*>(a)) {\n a = alloc.makeAst<GfxGslCall>(lparen.loc, var->id, args);\n } else {\n error(tok.loc) << \"Invalid call syntax: \" << lparen << ENDL;\n }\n } else if (sym == \"[\") {\n Token lbracket = pop();\n GfxGslAst *index = parseExpr(precedence_max);\n popKind(SYMBOL, \"]\");\n a = alloc.makeAst<GfxGslArrayLookup>(lbracket.loc, a, index);\n } else if (sym == \".\") {\n Token dot = pop();\n const std::string &id = popKind(IDENTIFIER).val;\n a = alloc.makeAst<GfxGslField>(dot.loc, a, id);\n } else {\n break; // Process this token at higher precedence.\n }\n } else {\n GfxGslOp op;\n if (is_op(sym, op) && precedence==precedence_op[op]) {\n auto op_tok = pop();\n auto *b = parseExpr(precedence-1);\n a = alloc.makeAst<GfxGslBinary>(op_tok.loc, a, op, b);\n } else {\n break; // Process this token at higher precedence.\n }\n }\n }\n\n return a;\n }\n\n // Currently this does not allow an expression on a line as expressions\n // do not have side-effects. However, if we were to add user-defined functions\n // that had side-effects then we would want to at least allow calls as well.\n GfxGslAst *parseAssignment (void)\n {\n auto loc = peek().loc;\n auto *lhs = parseExpr(precedence_max);\n popKind(SYMBOL, \"=\");\n auto *rhs = parseExpr(precedence_max);\n return alloc.makeAst<GfxGslAssign>(loc, lhs, rhs);\n }\n\n GfxGslAst *parseStmt (void)\n {\n auto loc = peek().loc;\n if (maybePopKind(IF)) {\n popKind(SYMBOL, \"(\");\n auto *cond = parseExpr(precedence_max);\n popKind(SYMBOL, \")\");\n auto *yes = parseStmt();\n if (maybePopKind(ELSE)) {\n auto *no = parseStmt();\n return alloc.makeAst<GfxGslIf>(loc, cond, yes, no);\n }\n return alloc.makeAst<GfxGslIf>(loc, cond, yes, nullptr);\n } else if (maybePopKind(FOR)) {\n popKind(SYMBOL, \"(\");\n GfxGslAst *init = nullptr;\n GfxGslType *annot = nullptr;\n std::string id;\n if (maybePopKind(VAR)) {\n id = popKind(IDENTIFIER).val;\n if (maybePopKind(SYMBOL, \":\")) {\n annot = parseType();\n }\n if (maybePopKind(SYMBOL, \"=\")) {\n init = parseExpr(precedence_max);\n }\n } else {\n init = parseAssignment();\n }\n popKind(SYMBOL, \";\");\n auto *cond = parseExpr(precedence_max);\n popKind(SYMBOL, \";\");\n auto *inc = parseAssignment();\n popKind(SYMBOL, \")\");\n auto *body = parseStmt();\n return alloc.makeAst<GfxGslFor>(loc, id, annot, init, cond, inc, body);\n } else if (maybePopKind(SYMBOL, \"{\")) {\n GfxGslAsts stmts;\n while (!maybePopKind(SYMBOL, \"}\")) {\n stmts.push_back(parseStmt());\n }\n return alloc.makeAst<GfxGslBlock>(loc, stmts);\n } else if (maybePopKind(DISCARD)) {\n popKind(SYMBOL, \";\");\n return alloc.makeAst<GfxGslDiscard>(loc);\n } else if (maybePopKind(RETURN)) {\n popKind(SYMBOL, \";\");\n return alloc.makeAst<GfxGslReturn>(loc);\n } else if (maybePopKind(VAR)) {\n const auto &id = popKind(IDENTIFIER).val;\n GfxGslType *annot = nullptr;\n if (maybePopKind(SYMBOL, \":\")) {\n annot = parseType();\n }\n GfxGslAst *init = nullptr;\n if (maybePopKind(SYMBOL, \"=\")) {\n init = parseExpr(precedence_max);\n }\n popKind(SYMBOL, \";\");\n return alloc.makeAst<GfxGslDecl>(loc, id, annot, init);\n } else {\n GfxGslAst *ast = parseAssignment();\n popKind(SYMBOL, \";\");\n return ast;\n }\n }\n\n GfxGslShader *parseShader (void)\n {\n GfxGslAsts stmts;\n auto loc = peek().loc;\n while (!peekKind(END_OF_FILE)) {\n stmts.push_back(parseStmt());\n }\n return alloc.makeAst<GfxGslShader>(loc, stmts);\n }\n };\n}\n\nGfxGslShader *gfx_gasoline_parse (GfxGslAllocator &alloc, const std::string &shader)\n{\n auto tokens = lex(shader);\n Parser parser(alloc, tokens);\n return parser.parseShader();\n}\n" }, { "alpha_fraction": 0.6104624271392822, "alphanum_fraction": 0.6232601404190063, "avg_line_length": 19.867446899414062, "blob_id": "5ee82ca0d02561fc2485b666d5153bc307d136ac", "content_id": "3c90616dcac0b1df60001b4ae71fcea5a2f1d867", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 10705, "license_type": "permissive", "max_line_length": 89, "num_lines": 513, "path": "/engine/net/lua_wrappers_net.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "#include \"../main.h\"\n#include \"../external_table.h\"\n#include \"../lua_ptr.h\"\n#include \"../path_util.h\"\n\n#include \"net.h\"\n#include \"lua_wrappers_net.h\"\n\n#define NETADDRESS_TAG \"Grit/NetAddress\"\n\nvoid push_netaddress (lua_State *L, const NetAddressPtr &self)\n{\n if (self.isNull())\n lua_pushnil(L);\n else\n push(L,new NetAddressPtr(self), NETADDRESS_TAG);\n}\n\nGC_MACRO(NetAddressPtr,netaddress,NETADDRESS_TAG)\n\nstatic int netaddress_tostring (lua_State *L)\n{\nTRY_START\n check_args(L,1);\n GET_UD_MACRO(NetAddressPtr,self,1,NETADDRESS_TAG);\n\n std::string stringAddr = self->toString();\n\n lua_pushstring(L, stringAddr.c_str());\n return 1;\nTRY_END\n}\n\nstatic int netaddress_index (lua_State *L)\n{\nTRY_START\n check_args(L,2);\n\n GET_UD_MACRO(NetAddressPtr,self,1,NETADDRESS_TAG);\n\n (void) self;\n\n my_lua_error(L,\"NetAddress has no properties.\");\n\n return 0;\nTRY_END\n}\n\nEQ_MACRO(NetAddressPtr, netaddress, NETADDRESS_TAG)\n\nMT_MACRO(netaddress);\n\n// --- NetMessage wrappers ----------------------------------------------------\n#define NETMESSAGE_TAG \"Grit/NetMessage\"\n\nvoid push_netmessage (lua_State *L, const NetMessagePtr &self)\n{\n if (self.isNull())\n lua_pushnil(L);\n else\n push(L,new NetMessagePtr(self), NETMESSAGE_TAG);\n}\n\nTOSTRING_SMART_PTR_MACRO(netmessage, NetMessagePtr, NETMESSAGE_TAG)\nGC_MACRO(NetMessagePtr, netmessage, NETMESSAGE_TAG)\nEQ_MACRO(NetMessagePtr, netmessage, NETMESSAGE_TAG)\n\nstatic int netmessage_read_bool(lua_State *L)\n{\nTRY_START\n check_args(L,1);\n GET_UD_MACRO_OFFSET(NetMessagePtr,self,1,NETMESSAGE_TAG,0);\n\n lua_pushboolean(L, (*self)->readBool());\n \n return 1;\nTRY_END\n}\n\nstatic int netmessage_read_integer(lua_State *L)\n{\nTRY_START\n check_args_min(L, 1);\n check_args_max(L, 2);\n\n GET_UD_MACRO_OFFSET(NetMessagePtr,self,1,NETMESSAGE_TAG,0);\n\n int bits = (lua_gettop(L) == 2) ? check_int(L, 2, 1, 32) : 32;\n\n lua_pushinteger(L, (*self)->readInteger(bits));\n \n return 1;\nTRY_END\n}\n\nstatic int netmessage_read_float(lua_State *L)\n{\nTRY_START\n check_args(L,1);\n GET_UD_MACRO_OFFSET(NetMessagePtr,self,1,NETMESSAGE_TAG,0);\n\n lua_pushnumber(L, (*self)->readFloat());\n \n return 1;\nTRY_END\n}\n\nstatic int netmessage_read_string(lua_State *L)\n{\nTRY_START\n check_args(L,1);\n GET_UD_MACRO_OFFSET(NetMessagePtr,self,1,NETMESSAGE_TAG,0);\n\n std::string str = (*self)->readString();\n\n lua_pushstring(L, str.c_str());\n \n return 1;\nTRY_END\n}\n\nstatic int netmessage_read_delta_integer(lua_State *L)\n{\nTRY_START\n check_args_min(L, 2);\n check_args_max(L, 3);\n\n GET_UD_MACRO_OFFSET(NetMessagePtr,self,1,NETMESSAGE_TAG,0);\n\n int old = luaL_checkinteger(L, 2);\n int bits = (lua_gettop(L) == 3) ? check_int(L, 3, 1, 32) : 32;\n\n lua_pushinteger(L, (*self)->readDeltaInteger(old, bits));\n \n return 1;\nTRY_END\n}\n\nstatic int netmessage_read_delta_float(lua_State *L)\n{\nTRY_START\n check_args(L,2);\n GET_UD_MACRO_OFFSET(NetMessagePtr,self,1,NETMESSAGE_TAG,0);\n\n float old = luaL_checknumber(L, 2);\n\n lua_pushnumber(L, (*self)->readDeltaFloat(old));\n \n return 1;\nTRY_END\n}\n\nstatic int netmessage_write_bool(lua_State *L)\n{\nTRY_START\n check_args(L,2);\n GET_UD_MACRO_OFFSET(NetMessagePtr,self,1,NETMESSAGE_TAG,0);\n\n (*self)->writeBool(check_bool(L, 2));\n \n return 0;\nTRY_END\n}\n\nstatic int netmessage_write_integer(lua_State *L)\n{\nTRY_START\n check_args_min(L, 2);\n check_args_max(L, 3);\n\n GET_UD_MACRO_OFFSET(NetMessagePtr,self,1,NETMESSAGE_TAG,0);\n\n int bits = (lua_gettop(L) == 3) ? check_int(L, 3, 1, 32) : 32;\n\n (*self)->writeInteger(luaL_checkinteger(L, 2), bits);\n \n return 0;\nTRY_END\n}\n\nstatic int netmessage_write_float(lua_State *L)\n{\nTRY_START\n check_args(L,2);\n GET_UD_MACRO_OFFSET(NetMessagePtr,self,1,NETMESSAGE_TAG,0);\n\n (*self)->writeFloat(check_float(L, 2));\n \n return 0;\nTRY_END\n}\n\nstatic int netmessage_write_string(lua_State *L)\n{\nTRY_START\n check_args(L,2);\n GET_UD_MACRO_OFFSET(NetMessagePtr,self,1,NETMESSAGE_TAG,0);\n\n std::string str = check_string(L, 2);\n (*self)->writeString(str);\n \n return 0;\nTRY_END\n}\n\nstatic int netmessage_write_delta_integer(lua_State *L)\n{\nTRY_START\n check_args_min(L,3);\n check_args_max(L,4);\n GET_UD_MACRO_OFFSET(NetMessagePtr,self,1,NETMESSAGE_TAG,0);\n\n int bits = (lua_gettop(L) == 4) ? check_int(L, 4, 1, 32) : 32;\n (void) bits;\n (*self)->writeDeltaFloat(luaL_checkinteger(L, 2), luaL_checkinteger(L, 3));\n \n return 0;\nTRY_END\n}\n\nstatic int netmessage_write_delta_float(lua_State *L)\n{\nTRY_START\n check_args(L,3);\n GET_UD_MACRO_OFFSET(NetMessagePtr,self,1,NETMESSAGE_TAG,0);\n\n (*self)->writeDeltaFloat(check_float(L, 2), check_float(L, 3));\n \n return 0;\nTRY_END\n}\n\nstatic int netmessage_clone(lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n GET_UD_MACRO_OFFSET(NetMessagePtr, self, 1, NETMESSAGE_TAG, 0);\n\n std::string buffer = (*self)->getBuffer();\n\n push_netmessage(L, NetMessagePtr(new NetMessage(buffer.c_str(), buffer.size())));\n\n return 1;\nTRY_END\n}\n\nstatic int netmessage_index (lua_State *L)\n{\nTRY_START\n check_args(L,2);\n GET_UD_MACRO(NetMessagePtr,self,1,NETMESSAGE_TAG);\n std::string key = luaL_checkstring(L,2);\n\n if (key == \"read_bool\")\n {\n push_cfunction(L, netmessage_read_bool);\n }\n else if (key == \"read_int\")\n {\n push_cfunction(L, netmessage_read_integer);\n }\n else if (key == \"read_float\")\n {\n push_cfunction(L, netmessage_read_float);\n }\n else if (key == \"read_string\")\n {\n push_cfunction(L, netmessage_read_string);\n }\n else if (key == \"read_delta_int\")\n {\n push_cfunction(L, netmessage_read_delta_integer);\n }\n else if (key == \"read_delta_float\")\n {\n push_cfunction(L, netmessage_read_delta_float);\n }\n else if (key == \"write_bool\")\n {\n push_cfunction(L, netmessage_write_bool);\n }\n else if (key == \"write_int\")\n {\n push_cfunction(L, netmessage_write_integer);\n }\n else if (key == \"write_float\")\n {\n push_cfunction(L, netmessage_write_float);\n }\n else if (key == \"write_string\")\n {\n push_cfunction(L, netmessage_write_string);\n }\n else if (key == \"write_delta_int\")\n {\n push_cfunction(L, netmessage_write_delta_integer);\n }\n else if (key == \"write_delta_float\")\n {\n push_cfunction(L, netmessage_write_delta_float);\n }\n else if (key == \"clone\")\n {\n push_cfunction(L, netmessage_clone);\n }\n else if (key == \"length\")\n {\n lua_pushinteger(L, self->getLength());\n }\n else\n {\n my_lua_error(L, \"Not a valid NetMessage field: \" + key);\n }\n \n return 1;\nTRY_END\n}\n\nMT_MACRO(netmessage);\n\nstatic int global_net_register_callbacks(lua_State *L)\n{\nTRY_START\n\n check_args(L, 1);\n\n if (!lua_istable(L, 1))\n my_lua_error(L, \"First parameter should be a table\");\n\n ExternalTable table;\n\n int index = lua_gettop(L);\n for (lua_pushnil(L) ; lua_next(L,index)!=0 ; lua_pop(L,1)) {\n const char *err = table.luaSet(L);\n if (err) my_lua_error(L, err);\n }\n lua_pop(L,1);\n\n net_set_callbacks(table, L);\n\n return 0;\n\nTRY_END\n}\n\nstatic int global_net_process(lua_State* L)\n{\nTRY_START\n\n check_args(L, 0);\n\n net_process(L);\n\n return 0;\nTRY_END\n}\n\nstatic int global_net_make_message(lua_State* L)\n{\nTRY_START\n\n check_args(L, 0);\n\n push_netmessage(L, NetMessagePtr(new NetMessage()));\n\n return 1;\n\nTRY_END\n}\n\nstatic int global_net_get_loopback_packet(lua_State* L)\n{\nTRY_START\n\n check_args(L, 1);\n\n std::string str = check_string(L, 1);\n NetChannel channel;\n\n if (str == \"server\")\n {\n channel = NetChan_ClientToServer;\n }\n else if (str == \"client\")\n {\n channel = NetChan_ServerToClient;\n }\n else\n {\n my_lua_error(L, \"invalid network channel: \" + str);\n }\n\n std::string packet;\n if (!net_get_loopback_packet(channel, packet))\n {\n lua_pushnil(L);\n }\n else\n {\n push_netmessage(L, NetMessagePtr(new NetMessage(packet.c_str(), packet.size())));\n }\n\n return 1;\n\nTRY_END\n}\n\nstatic int global_net_send_packet(lua_State* L)\n{\nTRY_START\n\n check_args(L, 3);\n std::string str = check_string(L, 1);\n GET_UD_MACRO_OFFSET(NetAddressPtr,address,2,NETADDRESS_TAG,0);\n GET_UD_MACRO_OFFSET(NetMessagePtr,message,3,NETMESSAGE_TAG,0);\n\n NetChannel channel;\n\n if (str == \"server\")\n {\n channel = NetChan_ClientToServer;\n }\n else if (str == \"client\")\n {\n channel = NetChan_ServerToClient;\n }\n else\n {\n my_lua_error(L, \"invalid network channel: \" + str);\n }\n\n std::string buffer = (*message)->getBuffer();\n\n net_send(channel, **address, buffer.c_str(), buffer.size());\n\n return 0;\n\nTRY_END\n}\n\nstatic int global_net_send_packet_sequenced(lua_State* L)\n{\nTRY_START\n\n check_args(L, 4);\n std::string str = check_string(L, 1);\n GET_UD_MACRO_OFFSET(NetAddressPtr,address,2,NETADDRESS_TAG,0);\n GET_UD_MACRO_OFFSET(NetMessagePtr,message,3,NETMESSAGE_TAG,0);\n int sequenceNum = luaL_checkinteger(L, 4);\n\n NetChannel channel;\n\n if (str == \"server\")\n {\n channel = NetChan_ClientToServer;\n }\n else if (str == \"client\")\n {\n channel = NetChan_ServerToClient;\n }\n else\n {\n my_lua_error(L, \"invalid network channel: \" + str);\n }\n\n std::string buffer = (*message)->getBuffer();\n NetMessage tempMessage;\n tempMessage.writeInteger(sequenceNum);\n tempMessage.writeBits(buffer.size() * 8, buffer.c_str());\n\n buffer = tempMessage.getBuffer();\n\n net_send(channel, **address, buffer.c_str(), buffer.size());\n\n return 0;\n\nTRY_END\n}\n\nstatic int global_net_resolve_address(lua_State* L)\n{\nTRY_START\n\n check_args(L, 1);\n\n std::string str = check_string(L, 1);\n\n NetAddress address = NetAddress::resolve(str.c_str(), NetAddress_IPv4);\n push_netaddress(L, NetAddressPtr(new NetAddress(address)));\n\n return 1;\n\nTRY_END\n}\n\nstatic const luaL_reg global[] = {\n {\"net_register_callbacks\", global_net_register_callbacks},\n {\"net_process\", global_net_process},\n {\"net_make_message\", global_net_make_message},\n {\"net_get_loopback_packet\", global_net_get_loopback_packet},\n {\"net_send_packet\", global_net_send_packet},\n {\"net_send_packet_sequenced\", global_net_send_packet_sequenced},\n {\"net_resolve_address\", global_net_resolve_address},\n {NULL,NULL}\n};\n\nvoid net_lua_init (lua_State *L)\n{\n ADD_MT_MACRO(netaddress, NETADDRESS_TAG);\n ADD_MT_MACRO(netmessage, NETMESSAGE_TAG);\n\n register_lua_globals(L, global);\n}\n" }, { "alpha_fraction": 0.6229761242866516, "alphanum_fraction": 0.6247751116752625, "avg_line_length": 49.51948165893555, "blob_id": "84086c28af9b537b308fb7e832d4238463ad204c", "content_id": "a3fafa12afc791f0af17c0a3b6c60b258857cfe1", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3891, "license_type": "permissive", "max_line_length": 112, "num_lines": 77, "path": "/dependencies/quex-0.34.1/quex/core_engine/state_machine/parallelize.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "#! /usr/bin/env python\nimport sys\nfrom copy import deepcopy\nsys.path.append(\"../\")\nsys.path.append(\"../../\")\n\nimport quex.core_engine.state_machine\nfrom quex.core_engine.state_machine.core import StateMachine\n\ndef do(the_state_machines):\n \"\"\"Connect state machines paralell.\"\"\"\n assert type(the_state_machines) == list\n assert len(the_state_machines) != 0\n assert map(lambda x: x.__class__.__name__, the_state_machines) == [\"StateMachine\"] * len(the_state_machines)\n \n # filter out empty state machines from the consideration \n state_machines = filter(lambda sm: not sm.is_empty(), the_state_machines)\n\n def __add_optional_free_pass(result_state_machine,\n TerminationStateIdx=-1):\n \"\"\"Add an optional 'free pass' if there was an empty state.\"\"\" \n # if there was an empty state, then the number of elements in the list changed\n # in case there was an empty state one has to add a 'free pass' from begin to \n # the final acceptance state. \n if TerminationStateIdx == -1:\n acceptance_state_index_list = result_state_machine.get_acceptance_state_index_list()\n assert acceptance_state_index_list != [], \\\n \"resulting state machine has no acceptance state!\"\n TerminationStateIdx = acceptance_state_index_list[0]\n\n if len(state_machines) != len(the_state_machines):\n result_state_machine.add_epsilon_transition(result_state_machine.init_state_index, \n TerminationStateIdx)\n return result_state_machine\n\n if len(state_machines) < 2:\n if len(state_machines) < 1: return __add_optional_free_pass(StateMachine())\n else: return __add_optional_free_pass(state_machines[0])\n\n # (*) need to clone the state machines, i.e. provide their internal\n # states with new ids, but the 'behavior' remains. This allows\n # state machines to appear twice, or being used in 'larger'\n # conglomerates.\n clone_list = map(lambda sm: sm.clone(), state_machines)\n\n # (*) collect all transitions from both state machines into a single one\n # (clone to ensure unique identifiers of states)\n result = StateMachine()\n for clone in clone_list:\n for start_state_index, states in clone.states.items(): \n # DOUBT: is deepcopy necessary at this place?\n # ANSWER: it does not harm, because no new state indices are creates\n result.states[start_state_index] = deepcopy(states)\n\n # (*) add additional **init** and **end** state\n # NOTE: when the result state machine was created, it already contains a \n # new initial state index. thus at this point only the new terminal\n # state has to be created. \n # NOTE: it is essential that the acceptance flag stays False, at this\n # point in time, so that the mounting operations only happen on\n # the old acceptance states. Later the acceptance state is raised\n # to 'accepted' (see below)\n new_terminal_state_index = result.create_new_state() \n \n # (*) connect from the new initial state to the initial states of the\n # clones via epsilon transition. \n # connect from each success state of the clones to the new end state\n # via epsilon transition.\n for clone in clone_list:\n result.mount_to_initial_state(clone.init_state_index)\n result.mount_to_acceptance_states(new_terminal_state_index,\n CancelStartAcceptanceStateF=True,\n RaiseTargetAcceptanceStateF=True,\n LeaveStoreInputPositionsF=True)\n\n\n return __add_optional_free_pass(result, new_terminal_state_index)\n\n" }, { "alpha_fraction": 0.5788813233375549, "alphanum_fraction": 0.5821762084960938, "avg_line_length": 41.345516204833984, "blob_id": "04d42cd0d7c368f12d6b7ccb567d39b635a2125d", "content_id": "f0c3161132eb60de1839305da1905ddc7e2644ad", "detected_licenses": [ "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer", "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 12747, "license_type": "permissive", "max_line_length": 112, "num_lines": 301, "path": "/dependencies/quex-0.34.1/quex/code_base/template/CounterWithIndentation.i", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "// -*- C++ -*- vim: set syntax=cpp:\n\n#ifdef __QUEX_OPTION_INDENTATION_TRIGGER_SUPPORT\t\n#include <quex/code_base/template/count_common>\n\nnamespace quex { \n// NOTE: Quex is pretty intelligent in choosing the right function\n// to count line and column numbers. If, for example, a pattern\n// does not contain newlines, then it simply adds the LexemeLength\n// to the column number and does not do anything to the line number.\n// Before touching anything in this code, first look at the generated\n// code. The author of these lines considers it rather difficult to\n// find better implementations of these functions in the framework\n// of the generated engine. <fschaef 07y6m30d>\n//\n// NOTE: Those functions are not responsible for setting the begin to the\n// last end, such as _line_number_at_begin = _line_number_at_end.\n// This has to happen outside these functions.\ninline \nCounterWithIndentation::CounterWithIndentation(CLASS* TheLexer)\n : _the_lexer(TheLexer)\n{ init(); }\n\ninline \nCounterWithIndentation::CounterWithIndentation(const CounterWithIndentation& That)\n : _the_lexer(That._the_lexer)\n{ \n\n _indentation = That._indentation;\n _indentation_count_enabled_f = That._indentation_count_enabled_f;\n _indentation_event_enabled_f = That._indentation_event_enabled_f;\n}\n\ninline void\nCounterWithIndentation::init()\n{\n _indentation = 0;\n _indentation_count_enabled_f = false;\n _indentation_event_enabled_f = true;\n}\n\ninline void\nCounterWithIndentation::on_end_of_file()\n{\n // 'flush' remaining indentations\n if( _indentation_event_enabled_f ) \n _the_lexer->mode().on_indentation(_the_lexer, _indentation);\n}\n\ninline void \nCounterWithIndentation::icount(QUEX_CHARACTER_TYPE* Lexeme,\n QUEX_CHARACTER_TYPE* LexemeEnd)\n// Lexeme: Pointer to first character of Lexeme.\n// LexemeEnd: Pointer to first character after Lexeme.\n//\n// PURPOSE:\n// Adapts the column number and the line number according to the newlines\n// and letters of the last line occuring in the lexeme.\n//\n////////////////////////////////////////////////////////////////////////////////\n{\n // NOTE: Indentation counting is only active between newline and the\n // first non-whitespace character in a line. Use a variable\n // to indicate the activation of newline.\n // \n // DEF: End_it = pointer to first letter behind lexeme\n // Begin_it = pointer to first letter of lexeme\n // \n // (1) last character of Lexeme == newline?\n // yes => indentation_counting = ON\n // indentation = 0\n // line_number_at_end += number of newlines in Lexeme\n // column_number_at_end = 0 \n // END\n // \n // (2) find last newline in Lexeme -> start_consideration_it\n // \n // (2.1) no newline in lexeme?\n // yes => indentation_counting == ON ?\n // no => perform normal line number and column number counting\n // (we are not in between newline and the first non-whitespace \n // character of a line).\n // END\n // yes => start_consideration_it = Begin_it\n // \n // (3) Count\n // \n // indentation += number of whitespace between start_consideration \n // and first non-whitespace character\n // did non-whitespace character arrive?\n // yes => indentation_counting = OFF\n // \n // column_number_at_end = End_it - start_consideration_it\n // line_number_at_end += number of newlines from: Begin_it to: start_consideration_it\n // \n QUEX_CHARACTER_TYPE* Begin = (QUEX_CHARACTER_TYPE*)Lexeme;\n QUEX_CHARACTER_TYPE* Last = LexemeEnd - 1; \n QUEX_CHARACTER_TYPE* it = Last;\n\n __quex_assert(Begin < LexemeEnd); // LexemeLength >= 1: NEVER COMPROMISE THIS !\n\n\n // (1) Last character == newline ? _______________________________________________\n //\n if( *Last == '\\n' ) {\n _indentation = 0;\n _indentation_count_enabled_f = true;\n# ifndef QUEX_NO_SUPPORT_FOR_LINE_NUMBER_COUNTING\n ++_line_number_at_end;\n __count_newline_n_backwards(it, Begin);\n# endif\n# ifndef QUEX_NO_SUPPORT_FOR_COLUMN_NUMBER_COUNTING\n _column_number_at_end = 1; // next lexeme starts at _column_number_at_end + 1\n# endif\n return;\n }\n\n // (2) Find last newline in lexeme _______________________________________________\n //\n QUEX_CHARACTER_TYPE* start_consideration_it = 0x0;\n it = Last;\n while( it != Begin ) {\n // recall assert: no lexeme with len(Lexeme) == 0\n --it;\n if( *it == '\\n' ) { \t\t\n // NOTE: according to the test in (1) it is not possible\n // that *it == \"\\n\" and it == Last \n // => there is always an iterator behind 'it'\n // if *it == \"\\n\". The incrementation does\n // not need a check;\n start_consideration_it = it;\n ++start_consideration_it; // point to first character after newline\n _indentation = 0;\n _indentation_count_enabled_f = true;\n# ifdef QUEX_OPTION_COLUMN_NUMBER_COUNTING\n _column_number_at_end = 1;\n# endif\n break; \n }\t \n }\n // (2.1) no newline in lexeme?\n if( start_consideration_it == 0x0 ) {\n if( _indentation_count_enabled_f == false ) {\n // count increment without consideration of indentations\n // no newline => no line number increment\n // no column number overflow / restart at '1'\n // no indentation enabled => no indentation increment\n# ifdef QUEX_OPTION_COLUMN_NUMBER_COUNTING\n _column_number_at_end += LexemeEnd - Begin;\n# endif\n return;\n }\n // There was no newline, but the flag '_indentation_count_enabled_f'\n // tells us that before this pattern there was only whitespace after \n // newline. Let us add the whitespace at the beginning of this pattern\n // to the _indentation.\n start_consideration_it = Begin;\n }\n // At this point:\n // -- either there was no newline in the pattern, but the indentation\n // count was active (see case above).\n // -- or there was a newline in the pattern, so above it is set\n // '_indentation_count_enabled_f = true'.\n __quex_assert( _indentation_count_enabled_f == true );\n\n // (3) Count _____________________________________________________________________\n //\n // -- whitespace from: start_consideration to first non-whitespace\n // (indentation count is disabled if non-whitespace arrives)\n __count_whitespace_to_first_non_whitespace(start_consideration_it, Begin, LexemeEnd, \n /* LicenseToIncrementLineCountF = */ true);\n\n __QUEX_LEXER_COUNT_ASSERT_CONSISTENCY();\n}\n\n\ninline void \nCounterWithIndentation::icount_NoNewline(QUEX_CHARACTER_TYPE* Lexeme,\n const int LexemeL)\n// Lexeme: Pointer to first character of Lexeme.\n// LexemeEnd: Pointer to first character after Lexeme.\n{\n // NOTE: For an explanation of the algorithm, see the function:\n // count_indentation(...).\n QUEX_CHARACTER_TYPE* Begin = (QUEX_CHARACTER_TYPE*)Lexeme;\n\n // (1) Last character == newline ? _______________________________________________\n // [impossible, lexeme does never contain a newline]\n // (2) Find last newline in lexeme _______________________________________________\n // [cannot be found]\n // (2.1) no newline in lexeme? [yes]\n if( _indentation_count_enabled_f == false ) {\n // count increment without consideration of indentations\n // no newline => no line number increment\n // no column number overflow / restart at '1'\n // no indentation enabled => no indentation increment\n# ifdef QUEX_OPTION_COLUMN_NUMBER_COUNTING\n _column_number_at_end += LexemeL;\n# endif\n return;\n }\n \n // The flag '_indentation_count_enabled_f' tells us that before this\n // pattern there was only whitespace after newline. Let us add the\n // whitespace at the beginning of this pattern to the _indentation.\n __count_whitespace_to_first_non_whitespace(Begin, Begin, Begin + LexemeL, \n /* LicenseToIncrementLineCountF = */ false);\n\n __QUEX_LEXER_COUNT_ASSERT_CONSISTENCY();\n}\n\ninline void \nCounterWithIndentation::icount_NoNewline_NeverStartOnWhitespace(const int ColumnNIncrement) \n // This is the fastest way to count: simply add the constant integer that represents \n // the constant length of the lexeme (for patterns with fixed length, e.g. keywords).\n{\n __quex_assert(ColumnNIncrement > 0); // lexeme length >= 1\n# ifdef QUEX_OPTION_COLUMN_NUMBER_COUNTING\n _column_number_at_end += ColumnNIncrement;\n# endif\n if( _indentation_count_enabled_f ) {\n _indentation_count_enabled_f = false; \n _the_lexer->mode().on_indentation(_the_lexer, _indentation);\n }\n __QUEX_LEXER_COUNT_ASSERT_CONSISTENCY();\n}\n\ninline void \nCounterWithIndentation::icount_NoNewline_ContainsOnlySpace(const int ColumnNIncrement) \n{\n __quex_assert(ColumnNIncrement > 0); // lexeme length >= 1\n# ifdef QUEX_OPTION_COLUMN_NUMBER_COUNTING\n _column_number_at_end += ColumnNIncrement;\n# endif\n if( _indentation_count_enabled_f ) _indentation += ColumnNIncrement;\n\n __QUEX_LEXER_COUNT_ASSERT_CONSISTENCY();\n}\n\ninline void\nCounterWithIndentation::__count_whitespace_to_first_non_whitespace(QUEX_CHARACTER_TYPE* start_consideration_it, \n QUEX_CHARACTER_TYPE* Begin,\n QUEX_CHARACTER_TYPE* End,\n const bool LicenseToCountF)\n// NOTE: The 'license' flag shall enable the compiler to **delete** the line number counting\n// from the following function or implement it unconditionally, since the decision\n// is based on a constant (either true or false) -- once the function has been inlined. \n{\n // (3) Count _____________________________________________________________________\n //\n // -- whitespace from: start_consideration to first non-whitespace\n // (indentation count is disabled if non-whitespace arrives)\n QUEX_CHARACTER_TYPE* it = start_consideration_it;\n do { \n if( *it != ' ' ) { \n _indentation_count_enabled_f = false;\n _indentation += it - start_consideration_it;\n // Line and column number need to be counted before the indentation handler\n // is called. this way it has to correct information.\n __count_indentation_aux(start_consideration_it, Begin, End, LicenseToCountF);\n // indentation event enabled:\n // yes -> call indentation event handler\n // no -> enable event for the next time.\n // indentation events can only be disabled for one coming event.\n if( _indentation_event_enabled_f ) \n _the_lexer->mode().on_indentation(_the_lexer, _indentation);\n else\n // event was disabled this time, enable it for the next time.\n _indentation_event_enabled_f = true;\n\n return;\n }\n ++it; \t\t \n } while ( it != End );\n\n // no non-whitespace until end of lexeme, thus only increment the indentation\n _indentation += it - start_consideration_it;\n __count_indentation_aux(start_consideration_it, Begin, End, LicenseToCountF);\n}\n\ninline void\nCounterWithIndentation::__count_indentation_aux(QUEX_CHARACTER_TYPE* start_consideration_it,\n QUEX_CHARACTER_TYPE* Begin,\n QUEX_CHARACTER_TYPE* End, \n const bool LicenseToCountF)\n{\n // when inlined, this is a condition on a constant => deleted by compiler.\n if( LicenseToCountF == false ) return;\n\n# ifdef QUEX_OPTION_LINE_NUMBER_COUNTING\n __count_newline_n_backwards(start_consideration_it, Begin);\n# endif\t \n# ifdef QUEX_OPTION_COLUMN_NUMBER_COUNTING\n _column_number_at_end += End - start_consideration_it;\n# endif\n\n}\n\n} // namespace quex \n\n#endif // __QUEX_OPTION_INDENTATION_TRIGGER_SUPPORT\t\n" }, { "alpha_fraction": 0.6956259608268738, "alphanum_fraction": 0.6977375745773315, "avg_line_length": 34.64516067504883, "blob_id": "2a0581d9e71566a19062387a61c149b9f2317b2f", "content_id": "40755e4f09811d221bb0ff6788ff700cb6688f07", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 3315, "license_type": "permissive", "max_line_length": 96, "num_lines": 93, "path": "/engine/gfx/gfx_texture_state.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\nstruct GfxTextureState;\n\n#ifndef GFX_TEXTURE_STATE_H\n#define GFX_TEXTURE_STATE_H\n\n#include <OgreCommon.h>\n#include <OgreTextureUnitState.h>\n\nenum GfxTextureAddrMode {\n GFX_AM_WRAP, GFX_AM_MIRROR, GFX_AM_CLAMP, GFX_AM_BORDER\n};\n\nstatic inline Ogre::TextureUnitState::TextureAddressingMode to_ogre(GfxTextureAddrMode m)\n{\n switch (m) {\n case GFX_AM_WRAP: return Ogre::TextureUnitState::TAM_WRAP;\n case GFX_AM_MIRROR: return Ogre::TextureUnitState::TAM_MIRROR;\n case GFX_AM_CLAMP: return Ogre::TextureUnitState::TAM_CLAMP;\n case GFX_AM_BORDER: return Ogre::TextureUnitState::TAM_BORDER;\n }\n EXCEPTEX << \"Unreachable.\" << ENDL;\n return Ogre::TextureUnitState::TAM_WRAP;\n}\n\nenum GfxTextureFilterMode {\n GFX_FILTER_NONE, GFX_FILTER_POINT, GFX_FILTER_LINEAR, GFX_FILTER_ANISOTROPIC\n};\n\nstatic inline Ogre::FilterOptions to_ogre(GfxTextureFilterMode m)\n{\n switch (m) {\n case GFX_FILTER_NONE: return Ogre::FO_NONE;\n case GFX_FILTER_POINT: return Ogre::FO_POINT;\n case GFX_FILTER_LINEAR: return Ogre::FO_LINEAR;\n case GFX_FILTER_ANISOTROPIC: return Ogre::FO_ANISOTROPIC;\n }\n EXCEPTEX << \"Unreachable.\" << ENDL;\n return Ogre::FO_NONE;\n}\n\nstruct GfxTextureState {\n GfxBaseTextureDiskResource *texture;\n GfxTextureAddrMode modeU, modeV, modeW;\n GfxTextureFilterMode filterMin, filterMax, filterMip;\n int anisotropy;\n};\n\nstatic inline GfxTextureState gfx_texture_state_anisotropic(GfxBaseTextureDiskResource *texture,\n GfxTextureAddrMode mode=GFX_AM_WRAP)\n{\n return {\n texture,\n mode, mode, mode,\n GFX_FILTER_ANISOTROPIC, GFX_FILTER_ANISOTROPIC, GFX_FILTER_LINEAR,\n 16,\n };\n}\n\nstatic inline GfxTextureState gfx_texture_state_point(GfxBaseTextureDiskResource *texture,\n GfxTextureAddrMode mode=GFX_AM_WRAP)\n{\n return {\n texture,\n mode, mode, mode,\n GFX_FILTER_POINT, GFX_FILTER_POINT, GFX_FILTER_NONE,\n 0,\n };\n}\n\ntypedef std::map<std::string, GfxTextureState> GfxTextureStateMap;\n \n#endif // GFX_TEXTURE_STATE_H\n" }, { "alpha_fraction": 0.6018298864364624, "alphanum_fraction": 0.610275387763977, "avg_line_length": 43.038761138916016, "blob_id": "fc1234c84623cf3b886af5c41280503732b066a6", "content_id": "8cab297c404c7d89c1917e0647d525548255d416", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 11367, "license_type": "permissive", "max_line_length": 99, "num_lines": 258, "path": "/dependencies/quex-0.34.1/quex/core_engine/generator/transition_block.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "import sys\nimport quex.core_engine.generator.transition as transition\nfrom quex.input.setup import setup as Setup\nLanguageDB = Setup.language_db\n\n__DEBUG_CHECK_ACTIVE_F = False # Use this flag to double check that intervals are adjacent\n\nclass __info:\n def __init__(self, StateIdx, IsInitStateF, DSM):\n assert DSM == None or DSM.__class__.__name__ == \"StateMachineDecorator\"\n\n self.state_index = StateIdx\n self.is_init_state_f = IsInitStateF\n\n self.dsm = DSM\n\ndef do(TriggerMap, StateIdx, InitStateF, DSM):\n assert type(TriggerMap) == list\n assert DSM == None or DSM.__class__.__name__ == \"StateMachineDecorator\"\n # If a state has no transitions, no new input needs to be eaten => no reload.\n #\n # NOTE: The only case where the buffer reload is not required are empty states,\n # AND states during backward input position detection!\n # Empty states do not exist any longer, the backward input position is\n # essential though for pseudo ambiguous post contexts.\n assert TriggerMap != [] # states with empty trigger maps are 'dead end states'. those\n # # are not to be coded at this place.\n\n info = __info(StateIdx=StateIdx, IsInitStateF=InitStateF, DSM=DSM)\n\n if len(TriggerMap) > 1:\n return __get_code(TriggerMap, info) + \"\\n\"\n else:\n # We can actually be sure, that the Buffer Limit Code is filtered\n # out, since this is the task of the regular expression parser.\n # In case of backward lexing in pseudo-ambiguous post conditions,\n # it makes absolutely sense that there is only one interval that\n # covers all characters (see the discussion there).\n assert TriggerMap[0][0].begin == -sys.maxint\n assert TriggerMap[0][0].end == sys.maxint\n return \" \" + transition.do(StateIdx, TriggerMap[0][0], TriggerMap[0][1], DSM) + \"\\n\"\n\ndef __get_code(TriggerMap, info):\n \"\"\"Creates code for state transitions from this state. This function is very\n similar to the function creating code for a 'NumberSet' condition \n (see 'interval_handling').\n \n Writes code that does a mapping according to 'binary search' by\n means of if-else-blocks.\n \"\"\"\n TriggerSetN = len(TriggerMap)\n\n if TriggerSetN > 1 and __DEBUG_CHECK_ACTIVE_F:\n # -- check that the trigger map consist of sorted adjacent intervals \n # This assumption is critical because it is assumed that for any isolated\n # interval the bordering intervals have bracketed the remaining cases!\n previous_interval = TriggerMap[0][0] \n for trigger_interval, target_state_index in TriggerMap[1:]:\n assert trigger_interval.begin == previous_interval.end, \\\n \"non-adjacent intervals in TriggerMap\\n\" + \\\n \"TriggerMap = \" + repr(TriggerMap)\n assert trigger_interval.end > previous_interval.begin, \\\n \"unsorted intervals in TriggerMap\\n\" + \\\n \"TriggerMap = \" + repr(TriggerMap)\n previous_interval = deepcopy(trigger_interval)\n\n #________________________________________________________________________________\n txt = \" \"\n\n if TriggerSetN == 1 :\n # (*) Only one interval \n # (all boundaring cases must have been dealt with already => case is clear)\n # If the input falls into this interval the target trigger is identified!\n txt += __create_transition_code(TriggerMap[0], info)\n \n else: \n simple_txt = __try_very_simplest_case(TriggerMap, info)\n if simple_txt != None: \n txt += simple_txt\n else:\n # two or more intervals => cut in the middle\n MiddleTrigger_Idx = int(TriggerSetN / 2)\n middle = TriggerMap[MiddleTrigger_Idx]\n\n # input < 0 is impossible, since unicode codepoints start at 0!\n if middle[0].begin == 0: txt += __get_code(TriggerMap[MiddleTrigger_Idx:], info) \n elif TriggerSetN == 2: txt += __bracket_two_intervals(TriggerMap, info) \n elif TriggerSetN == 3: txt += __bracket_three_intervals(TriggerMap, info)\n else: txt += __bracket_normally(MiddleTrigger_Idx, TriggerMap, info)\n \n\n # (*) indent by four spaces (nested blocks are correctly indented)\n # delete the last newline, to prevent additional indentation\n if txt[-1] == \"\\n\": txt = txt[:-1]\n txt = txt.replace(\"\\n\", \"\\n \") + \"\\n\"\n return txt \n\ndef __create_transition_code(TriggerMapEntry, info, IndentF=False):\n \"\"\"Creates the transition code to a given target based on the information in\n the trigger map entry.\n \"\"\"\n interval = TriggerMapEntry[0]\n target_state_index = TriggerMapEntry[1] \n # target state != None, then the machine is still eating\n # => transition to subsequent state.\n #\n # target state == None, drop into a terminal state (defined by origins).\n #\n # for details about $transition, see the __transition() function of the\n # respective language module.\n #\n txt = \" \" + transition.do(info.state_index, interval, target_state_index, info.dsm)\n if interval != None:\n txt += \" \" + LanguageDB[\"$comment\"](interval.get_utf8_string()) + \"\\n\"\n else:\n txt += \"\\n\"\n\n if IndentF: \n txt = txt[:-1].replace(\"\\n\", \"\\n \") + \"\\n\" # don't replace last '\\n'\n return txt\n\ndef __try_very_simplest_case(TriggerMap, info):\n \"\"\"Assume the following setup:\n\n if( input == Char1 ) goto X;\n if( input == Char2 ) goto X;\n ...\n if( input == CharN ) goto X;\n\n If the input is equally distributed over the characters 1 to N then the\n average number of comparisons for N = 3 will be 2,333. For N = 4, the \n everage number of comparisons will be 2,75. Binary bracketing requires\n ld(N), so for N = 4 the number of comparisons is 2. Thus until N = 3\n it is advantegous to compare step by step. Also, for N = 1 a simple \n comparison is, most likely, more efficient that an 'or' operation over\n a list of length '1'. \n \n This function is trying to identify the case where there are only two or\n three characters that trigger to the same target state. \n \n RETURNS: 'None' if the very simple implementation does not make sense.\n A string if it could be implemented that way\n \"\"\"\n # return None\n character_list = []\n common_target_state_index = -1\n for trigger in TriggerMap:\n interval = trigger[0]\n target_state_index = trigger[1]\n\n if target_state_index == None: continue\n assert target_state_index != -1\n\n # All must have the same target state\n if common_target_state_index == -1:\n common_target_state_index = target_state_index\n elif common_target_state_index != target_state_index: \n return None\n\n # Because of memory reasons, it is not wise to try to extend sys.maxint number\n # of characters. Since, we do not allow for more than three characters, let's\n # do a little sanity pre-check:\n if interval.size() > 3: return None\n character_list.extend(range(interval.begin, interval.end))\n\n # More than three characters does not make sense\n if len(character_list) > 3: return None\n\n if len(character_list) < 2: return None\n assert common_target_state_index != -1\n\n txt = LanguageDB[\"$if in-set\"](character_list) \n # TriggerInfo = [None, TargetStateIndex] because the interval does not matter.\n txt += __create_transition_code([None, common_target_state_index], info, IndentF=True) \n txt += LanguageDB[\"$endif-else\"]\n txt += __create_transition_code([None, None], info, IndentF=True)\n txt += LanguageDB[\"$end-else\"]\n\n return txt\n\n \ndef __bracket_two_intervals(TriggerMap, info):\n assert len(TriggerMap) == 2\n\n first = TriggerMap[0]\n second = TriggerMap[1]\n\n # If the first interval causes a 'drop out' then make it the second.\n ## If the second interval is a 'drop out' the 'goto drop out' can be spared,\n ## since it lands there anyway.\n ## if second[0] < 0: # target state index < 0 ==> drop out\n ## tmp = first; first = second; second = tmp\n\n # find interval of size '1'\n first_interval = first[0]\n second_interval = second[0]\n\n # We only need one comparison at the border between the two intervals\n if first_interval.size() == 1: txt = LanguageDB[\"$if ==\"](repr(first_interval.begin))\n elif second_interval.size() == 1: txt = LanguageDB[\"$if !=\"](repr(second_interval.begin))\n else: txt = LanguageDB[\"$if <\"](repr(second_interval.begin))\n\n txt += __create_transition_code(first, info, IndentF=True) \n txt += LanguageDB[\"$endif-else\"]\n txt += __create_transition_code(second, info, IndentF=True)\n txt += LanguageDB[\"$end-else\"]\n\n return txt\n\ndef __bracket_three_intervals(TriggerMap, info):\n assert len(TriggerMap) == 3\n\n # does one interval have the size '1'?\n size_one_map = [False, False, False] # size_on_map[i] == True if interval 'i' has size '1'\n for i in range(len(TriggerMap)):\n interval = TriggerMap[i][0]\n if interval.size() == 1: size_one_map[i] = True\n\n target_state_0 = TriggerMap[0][1]\n target_state_2 = TriggerMap[2][1]\n if target_state_0 == target_state_2:\n if TriggerMap[1][0].size() == 1:\n # (1) Special Trick I only holds for one single case:\n # -- the interval in the middle has size 1\n # -- the outer two intervals trigger to the same target state\n # if inner character is matched: goto its target\n # else: goto alternative target\n txt = LanguageDB[\"$if ==\"](repr(TriggerMap[1][0].begin))\n else:\n # (2) Special Trick II only holds for:\n # -- the outer two intervals trigger to the same target state\n # if character in inner interval: goto its target\n # else: goto alternative target\n txt = LanguageDB[\"$if in-interval\"](TriggerMap[1][0])\n txt += __create_transition_code(TriggerMap[1], info, IndentF=True) \n txt += LanguageDB[\"$endif-else\"]\n # TODO: Add somehow a mechanism to report that here the intervals 0 **and** 1 are triggered\n # (only for the comments in the generated code)\n txt += __create_transition_code(TriggerMap[0], info, IndentF=True)\n txt += LanguageDB[\"$end-else\"]\n return txt\n\n # (*) Non special case --> bracket normally\n return __bracket_normally(1, TriggerMap, info)\n\ndef __bracket_normally(MiddleTrigger_Idx, TriggerMap, info):\n\n middle = TriggerMap[MiddleTrigger_Idx]\n assert middle[0].begin >= 0, \\\n \"code generation: error cannot split intervals at negative code points.\"\n\n txt = LanguageDB[\"$if <\"](repr(middle[0].begin))\n txt += __get_code(TriggerMap[:MiddleTrigger_Idx], info)\n txt += LanguageDB[\"$endif-else\"]\n txt += __get_code(TriggerMap[MiddleTrigger_Idx:], info)\n txt += LanguageDB[\"$end-else\"]\n\n return txt\n\n\n\n\n\n" }, { "alpha_fraction": 0.5244151949882507, "alphanum_fraction": 0.5353168249130249, "avg_line_length": 23.19230842590332, "blob_id": "97fa1a96866a0ee94bf5def29a757e8c9188765b", "content_id": "b34fc33e7fcf59d3d67f67cfcdcd8fcabe448d3b", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 4403, "license_type": "permissive", "max_line_length": 81, "num_lines": 182, "path": "/engine/net/net_address.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "#include <cstdio>\n#include <cstring>\n\n#include <centralised_log.h>\n\n#include \"net.h\"\n\nNetAddress::NetAddress()\n{\n this->type = NetAddress_Loopback;\n}\n\nNetAddress::NetAddress(NetAddressType type)\n{\n this->type = type;\n}\n\nNetAddress::NetAddress(sockaddr* addr, int length)\n{\n (void) length;\n switch (addr->sa_family)\n {\n case AF_INET:\n {\n sockaddr_in* in_addr = (sockaddr_in*)addr;\n this->type = NetAddress_IPv4;\n this->port = ntohs(in_addr->sin_port);\n this->ip4 = ntohl(in_addr->sin_addr.s_addr);\n }\n break;\n case AF_INET6:\n {\n sockaddr_in6* in_addr = (sockaddr_in6*)addr;\n this->type = NetAddress_IPv6;\n this->port = ntohs(in_addr->sin6_port);\n memcpy(this->ip6, &in_addr->sin6_addr, sizeof(this->ip6));\n }\n break;\n }\n}\n\nNetAddress& NetAddress::getLoopback()\n{\n static NetAddress loopbackIP;\n\n return loopbackIP;\n}\n\nNetAddress NetAddress::resolve(const char* host, NetAddressType type)\n{\n char hostName[256];\n uint16_t port;\n\n // [^:] sounds like it'd fail for ipv6?\n if (sscanf(host, \"%256[^:]:%hu\", hostName, &port) == 2)\n {\n if (!strcmp(hostName, \"localhost\"))\n {\n return NetAddress(NetAddress_Loopback);\n }\n\n struct addrinfo* addrInfo;\n if (getaddrinfo(hostName, NULL, NULL, &addrInfo) != 0)\n {\n return NetAddress(NetAddress_Invalid);\n }\n\n int requestedFamily = (type == NetAddress_IPv6) ? AF_INET6 : AF_INET;\n\n struct addrinfo* info = addrInfo;\n while (info)\n {\n if (info->ai_family == requestedFamily)\n {\n break;\n }\n\n info = info->ai_next;\n }\n\n if (!info)\n {\n freeaddrinfo(addrInfo);\n return NetAddress(NetAddress_Invalid);\n }\n\n NetAddress retval(info->ai_addr, info->ai_addrlen);\n retval.port = port;\n\n freeaddrinfo(addrInfo);\n\n return retval;\n }\n\n return NetAddress(NetAddress_Invalid);\n}\n\nbool NetAddress::operator ==(NetAddress& right)\n{\n if (type != right.type)\n {\n return false;\n }\n\n switch (type)\n {\n case NetAddress_Invalid:\n case NetAddress_Loopback:\n return true;\n case NetAddress_IPv4:\n return (ip4 == right.ip4);\n case NetAddress_IPv6:\n return !memcmp(ip6, right.ip6, sizeof(ip6));\n }\n\n return false;\n}\n\nbool NetAddress::operator !=(NetAddress& right)\n{\n return !(*this == right);\n}\n\nvoid NetAddress::getSockAddr(sockaddr_storage* storage, int* length)\n{\n memset(storage, 0, sizeof(sockaddr_storage));\n\n switch (type)\n {\n case NetAddress_Invalid:\n case NetAddress_Loopback:\n GRIT_EXCEPT(\"can not convert invalid/loopback address to sockaddr\");\n case NetAddress_IPv4:\n {\n sockaddr_in* in_addr = (sockaddr_in*)storage;\n in_addr->sin_family = AF_INET;\n in_addr->sin_addr.s_addr = htonl(ip4);\n in_addr->sin_port = htons(port);\n\n *length = sizeof(sockaddr_in);\n }\n break;\n case NetAddress_IPv6:\n {\n sockaddr_in6* in_addr = (sockaddr_in6*)storage;\n in_addr->sin6_family = AF_INET6;\n memcpy(&in_addr->sin6_addr, ip6, sizeof(ip6));\n in_addr->sin6_port = htons(port);\n\n *length = sizeof(sockaddr_in6);\n }\n break;\n }\n}\n\nstd::string NetAddress::toString()\n{\n if (type == NetAddress_IPv4) {\n sockaddr_storage storage;\n int storageLen;\n\n char buffer[16];\n\n getSockAddr(&storage, &storageLen);\n\n sockaddr_in* inAddr = (sockaddr_in*)&storage;\n inet_ntop(inAddr->sin_family, &inAddr->sin_addr, buffer, sizeof(buffer));\n\n std::stringstream ss;\n ss << buffer << \":\" << port;\n\n return ss.str();\n } else if (type == NetAddress_IPv6) {\n GRIT_EXCEPT(\"IPv6 toString not yet implemented\");\n } else if (type == NetAddress_Loopback) {\n return \"localhost\";\n } else if (type == NetAddress_Invalid) {\n return \"INVALID\";\n } else {\n return \"UNRECOGNISED TYPE\";\n }\n}\n" }, { "alpha_fraction": 0.6436519026756287, "alphanum_fraction": 0.6456490755081177, "avg_line_length": 37.93333435058594, "blob_id": "ebfa244a6812a2da21400861b1606f0993113b25", "content_id": "3ec384ddfb0023bcbb75cadb638302ec71cba1c7", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 3505, "license_type": "permissive", "max_line_length": 85, "num_lines": 90, "path": "/engine/physics/physical_material.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include \"physical_material.h\"\n#include \"../path_util.h\"\n\nPhysicalMaterialDB phys_mats; \n\nPhysicalMaterial *PhysicalMaterialDB::getMaterial (const std::string &mat_name)\n{\n NameMap::const_iterator i = mdb.find(mat_name);\n if (i==mdb.end()) {\n CERR << \"Physical material does not exist: \\\"\"<<mat_name<<\"\\\"\" << std::endl;\n return mdb[emergencyMat()];\n }\n return i->second;\n}\n\nPhysicalMaterial *PhysicalMaterialDB::getMaterial (const std::string &col_name,\n const std::string &mat_name)\n{\n NameMap::const_iterator i = mdb.find(mat_name);\n if (i==mdb.end()) {\n CERR << \"Collision mesh \\\"\"<<col_name<<\"\\\" references \"\n << \"non-existent physical material \\\"\"<<mat_name<<\"\\\"\" << std::endl;\n return mdb[emergencyMat()];\n }\n return i->second;\n}\n\nPhysicalMaterial *PhysicalMaterialDB::getMaterial (const std::string &dir,\n const std::string &col_name,\n const std::string &mat_name)\n{\n // can fail in this function because of e.g. \"/../Blah\"\n const char * emergency = PhysicalMaterialDB::emergencyMat();\n std::string absolute_mat_name = pwd_full_ex(mat_name,dir,emergency);\n // can also fail here if that material does not exist\n return getMaterial(col_name, absolute_mat_name);\n}\n\nPhysicalMaterial *PhysicalMaterialDB::getMaterialSafe (int mat_id)\n{\n if ((unsigned)mat_id>=mdb2.size()) {\n CERR << \"Got a bad material id: \" << mat_id << std::endl;\n return mdb[emergencyMat()];\n }\n return getMaterial(mat_id);\n}\n\nvoid PhysicalMaterialDB::setMaterial (const std::string &name, int interaction_group)\n{\n if (mdb.find(name) == mdb.end()) {\n PhysicalMaterial *m = new PhysicalMaterial();\n mdb[name] = m;\n m->name = name;\n m->interactionGroup = interaction_group;\n m->id = mdb2.size();\n mdb2.push_back(m);\n } else {\n PhysicalMaterial *m = mdb[name];\n m->interactionGroup = interaction_group;\n }\n}\n\nvoid PhysicalMaterialDB::setInteractionGroups (unsigned groups,\n const Interactions &interactions_)\n{\n APP_ASSERT(groups * groups == interactions_.size());\n numInteractions = groups;\n interactions = interactions_;\n}\n\n" }, { "alpha_fraction": 0.5283094048500061, "alphanum_fraction": 0.5354864597320557, "avg_line_length": 28.15116310119629, "blob_id": "c03a6a9354dbddf4ba54d0d39e181dce96c8ca60", "content_id": "07dd7ab98840f25e8f073660c34417930fe263b3", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 2508, "license_type": "permissive", "max_line_length": 102, "num_lines": 86, "path": "/dependencies/quex-0.34.1/demo/009/lexer.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "#include<fstream> \n#include<iostream> \n#include<sstream> \n\n// (*) include lexical analyser header\n#include <./tiny_lexer>\n\nusing namespace std;\n\nquex::tiny_lexer* get_file_input();\nquex::tiny_lexer* get_stringstream_input();\n\n\nint \nmain(int argc, char** argv) \n{ \n // (*) create token\n quex::Token Token;\n // (*) create the lexical analyser\n // if no command line argument is specified user file 'example.txt'\n quex::tiny_lexer* qlex = 0x0;\n\n if( argc < 2 ) {\n cout << \"At least one command line argument required.\\n\";\n return -1;\n } else if ( strcmp(argv[1], \"FILE\") == 0 ) {\n qlex = get_file_input();\n } else if ( strcmp(argv[1], \"stringstream\") == 0 ) {\n qlex = get_stringstream_input();\n } else {\n cout << \"Experiment \" << argv[1] << \" not supported by this application.\\n\";\n return -1;\n }\n\n cout << \",------------------------------------------------------------------------------------\\n\";\n cout << \"| [START]\\n\";\n\n int number_of_tokens = 0;\n // (*) loop until the 'termination' token arrives\n do {\n // (*) get next token from the token stream\n qlex->get_token(&Token);\n\n // (*) print out token information\n // -- name of the token\n cout << string(Token);\n cout << endl;\n\n ++number_of_tokens;\n\n // (*) check against 'termination'\n } while( Token.type_id() != QUEX_TKN_TERMINATION );\n\n cout << \"| [END] number of token = \" << number_of_tokens << \"\\n\";\n cout << \"`------------------------------------------------------------------------------------\\n\";\n\n delete qlex;\n\n return 0;\n}\n\nquex::tiny_lexer* \nget_file_input()\n{\n /* Normal File Input */\n cout << \"FILE* (stdio.h):\\n\";\n cout << \" Note this works only when engine is generated with -b 1 (or no -b)\\n\";\n cout << \" and therefore QUEX_CHARACTER_TYPE == uint8_t.\\n\";\n assert(sizeof(QUEX_CHARACTER_TYPE) == sizeof(uint8_t));\n return new quex::tiny_lexer(\"example.txt\");\n}\n\nquex::tiny_lexer* \nget_stringstream_input()\n{\n /* Normal String Stream Input */\n std::stringstream my_stream;\n cout << \"stringstream:\\n\";\n cout << \" Note this works only when engine is generated with -b 1 (or no -b)\\n\";\n cout << \" and therefore QUEX_CHARACTER_TYPE == uint8_t.\\n\";\n assert(sizeof(QUEX_CHARACTER_TYPE) == sizeof(uint8_t));\n\n my_stream << \"bonjour le monde hello world hallo welt\";\n\n return new quex::tiny_lexer(&my_stream);\n}\n\n" }, { "alpha_fraction": 0.553816020488739, "alphanum_fraction": 0.6379647850990295, "avg_line_length": 45.45454406738281, "blob_id": "c30f326c62a5e1038faf5d9d22af593cfea9cbcf", "content_id": "d5a47403b46e6eeab6eacf89e5bb6c0afc3a82ff", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Shell", "length_bytes": 511, "license_type": "permissive", "max_line_length": 115, "num_lines": 11, "path": "/dependencies/quex-0.34.1/demo/004/benchmark/input/create-example_db.sh", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "cp data.txt data-1-kB.txt\n# from 1 to 64KB create files for each KB\nj=1; for i in `seq 2 64`; do cat data.txt data-${j}-kB.txt > data-${i}-kB.txt; j=$i; done\n\n# from 64KB to 1MB create files of 64KB increment\nj=1; for i in `seq 2 16`; do cat data-64-kB.txt data-$((j * 64))-kB.txt > data-$((i * 64))-kB.txt; j=$i; done\n\n# from 1MB to 32MB create files of 1MB increment\nj=1; for i in `seq 2 32`; do cat data-1024-kB.txt data-$((j * 1024))-kB.txt > data-$((i * 1024))-kB.txt; j=$i; done\n\ntouch EXAMPLE-DB-CREATED\n" }, { "alpha_fraction": 0.5605564713478088, "alphanum_fraction": 0.5666939616203308, "avg_line_length": 28.095237731933594, "blob_id": "dec2df881612e2a5ed908bf3a356acd1241fae11", "content_id": "c27485de6c39c697b09d82e81d3f2d569c908ca5", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 4888, "license_type": "permissive", "max_line_length": 80, "num_lines": 168, "path": "/engine/cache_friendly_range_space.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\ntemplate <typename T> class CacheFriendlyRangeSpace;\n\n#ifndef CACHEFRIENDLYRANGESPACE_H\n#define CACHEFRIENDLYRANGESPACE_H\n\n#include <map>\n#include <vector>\n#include <iostream>\n#include <algorithm>\n#include <cmath>\n\n#include <centralised_log.h>\n\n\ntemplate <typename T>\nclass CacheFriendlyRangeSpace {\n\n protected:\n\n struct Position {\n Position()\n : x(0), y(0), d(0)\n { }\n \n signed short x;\n signed short y;\n signed short d;\n };\n\n typedef std::vector<Position> Positions;\n typedef std::vector<T> Cargoes;\n\n\n public:\n\n CacheFriendlyRangeSpace() : hence(0) { }\n\n ~CacheFriendlyRangeSpace() { }\n\n void add (const T &o)\n {\n typename Cargoes::iterator begin = cargoes.begin(),\n end = cargoes.end();\n // if it's already in there, this is a no-op\n if (find(begin,end,o) != end) return;\n \n size_t index = cargoes.size();\n cargoes.push_back(o);\n positions.push_back(Position());\n o->updateIndex(index);\n }\n\n inline void updateSphere (size_t index, float x, float y, float z, float d)\n {\n positions[index].x = (short)x;\n positions[index].y = (short)y;\n (void) z;\n positions[index].d = (short)d;\n }\n\n // conservative approximation - x/y bounding box\n inline bool broadPhase (const Position &pos,\n const short x2, const short y2)\n {\n\n if (std::abs(pos.x-x2)>pos.d) return false;\n if (std::abs(pos.y-y2)>pos.d) return false;\n return true;\n }\n\n\n void getPresent (float x, float y, float z,\n size_t num, std::vector<T*> &found)\n {\n if (num == 0) return;\n if (cargoes.size() == 0) return;\n if (num>cargoes.size()) num=cargoes.size();\n if (hence>=cargoes.size()) hence = 0;\n\n // iterate from this point for a while\n typename Positions::iterator begin = positions.begin(),\n iter = begin + hence,\n end = positions.end();\n\n if (num>positions.size()) {\n iter = begin;\n num = positions.size();\n }\n\n short x2 = (short)x;\n short y2 = (short)y;\n for (size_t i=0 ; i<num ; ++i) {\n Position &pos = *iter;\n if (broadPhase(pos,x2,y2)) {\n // do more thorough check\n T &o = *(cargoes.begin() + (iter-begin));\n float xd2 = (o->getX()-x) * (o->getX()-x);\n float yd2 = (o->getY()-y) * (o->getY()-y);\n float zd2 = (o->getZ()-z) * (o->getZ()-z);\n if (xd2 + yd2 + zd2 < o->getR() * o->getR()) {\n found.push_back(&o);\n }\n }\n iter++;\n if (iter == end) iter=begin;\n }\n\n hence = iter - positions.begin();\n }\n\n void remove (const T &o)\n {\n typename Cargoes::iterator begin = cargoes.begin(),\n end = cargoes.end();\n typename Cargoes::iterator iter = find(begin,end,o);\n\n // no-op if o was not in the rangespace somewhere\n if (iter == end) return;\n\n // otherwise, carefully remove it -\n size_t index = iter - begin;\n\n positions[index] = positions[positions.size()-1];\n positions.pop_back();\n cargoes[index] = cargoes[cargoes.size()-1];\n cargoes[index]->updateIndex(index);\n cargoes.pop_back();\n o->updateIndex(-1);\n }\n\n void clear (void)\n {\n cargoes.clear();\n positions.clear();\n hence = 0;\n }\n\n\n protected:\n\n size_t hence;\n Positions positions;\n Cargoes cargoes;\n};\n\n\n#endif\n" }, { "alpha_fraction": 0.6593655347824097, "alphanum_fraction": 0.662009060382843, "avg_line_length": 29.090909957885742, "blob_id": "c7acb17c05e92b50dd020455461b6bb8a81ebdbf", "content_id": "e675d13f3ded7f585fbba63d0012fa854ee74559", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 2648, "license_type": "permissive", "max_line_length": 80, "num_lines": 88, "path": "/engine/grit_class.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include \"grit_class.h\"\n\nstatic GritClassMap classes;\n\nGritClass *class_add (lua_State *L, const std::string& name)\n{\n GritClass *gcp;\n GritClassMap::iterator i = classes.find(name);\n \n if (i!=classes.end()) {\n gcp = i->second;\n int index = lua_gettop(L);\n for (lua_pushnil(L) ; lua_next(L,index)!=0 ; lua_pop(L,1)) {\n gcp->set(L);\n } \n lua_pop(L,1); // the table we just iterated through\n gcp->setParent(L);\n } else {\n // add it and return it\n gcp = new GritClass(L,name);\n classes[name] = gcp;\n }\n return gcp;\n}\n\n\nvoid class_del (lua_State *L, GritClass *c)\n{\n // anything using this class keeps using it\n classes.erase(c->name);\n // class gets deleted properly when everything stops using it\n c->release(L);\n}\n\n\nGritClass *class_get (const std::string &name)\n{\n GritClassMap::iterator i = classes.find(name);\n if (i==classes.end())\n GRIT_EXCEPT(\"GritClass does not exist: \"+name);\n return i->second;\n}\n\nbool class_has (const std::string &name)\n{\n return classes.find(name)!=classes.end();\n}\n\n \nvoid class_all_del (lua_State *L)\n{\n GritClassMap m = classes;\n for (GritClassMap::iterator i=m.begin(),i_=m.end() ; i!=i_ ; ++i) {\n class_del(L, i->second);\n } \n}\n\nvoid class_all (GritClassMap::iterator &begin, GritClassMap::iterator &end)\n{\n begin = classes.begin();\n end = classes.end();\n}\n\nsize_t class_count (void)\n{\n return classes.size();\n}\n" }, { "alpha_fraction": 0.7118586301803589, "alphanum_fraction": 0.7176350951194763, "avg_line_length": 29.65625, "blob_id": "13b4f9f9334e9a56e5008514c6094a4a1e17b380", "content_id": "a1a75af11cdf735a0ef0e1a13d8e30cb2215af95", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 2943, "license_type": "permissive", "max_line_length": 80, "num_lines": 96, "path": "/engine/gfx/gfx_light.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\nclass GfxLight;\ntypedef SharedPtr<GfxLight> GfxLightPtr;\n\n#ifndef GFX_LIGHT_H\n#define GFX_LIGHT_H\n\n#include \"gfx.h\"\n#include \"gfx_fertile_node.h\"\n#include \"gfx_particle_system.h\"\n\nclass GfxLight : public GfxNode {\n protected:\n static const std::string className;\n bool enabled;\n float fade;\n Vector3 coronaLocalPos;\n float coronaSize;\n Vector3 coronaColour;\n Vector3 diffuse;\n Vector3 specular;\n GfxParticle *corona;\n Quaternion aim;\n Radian coronaInnerAngle;\n Radian coronaOuterAngle;\n public: // HACK\n Ogre::Light *light;\n protected:\n\n GfxLight (const GfxNodePtr &par_);\n ~GfxLight ();\n\n void updateVisibility (void);\n\n public:\n static GfxLightPtr make (const GfxNodePtr &par_=GfxNodePtr(NULL))\n { return GfxLightPtr(new GfxLight(par_)); }\n \n Vector3 getDiffuseColour (void);\n Vector3 getSpecularColour (void);\n void setDiffuseColour (const Vector3 &v);\n void setSpecularColour (const Vector3 &v);\n float getRange (void);\n void setRange (float v);\n Degree getInnerAngle (void);\n void setInnerAngle (Degree v);\n Degree getOuterAngle (void);\n void setOuterAngle (Degree v);\n\n Degree getCoronaInnerAngle (void);\n void setCoronaInnerAngle (Degree v);\n Degree getCoronaOuterAngle (void);\n void setCoronaOuterAngle (Degree v);\n\n bool isEnabled (void);\n void setEnabled (bool v);\n\n float getFade (void);\n void setFade (float f);\n\n void update (const Vector3 &cam_pos);\n\n Vector3 getCoronaLocalPosition (void);\n void setCoronaLocalPosition (const Vector3 &v);\n\n float getCoronaSize (void);\n void setCoronaSize (float v);\n Vector3 getCoronaColour (void);\n void setCoronaColour (const Vector3 &v);\n\n void destroy (void);\n\n friend class SharedPtr<GfxLight>;\n};\n\n#endif\n" }, { "alpha_fraction": 0.5889286994934082, "alphanum_fraction": 0.60301274061203, "avg_line_length": 43.43673324584961, "blob_id": "9a155c3f70af884d9f5d4dab017a251990ed3b17", "content_id": "c176337743e7bc06cc46ffb17336a3ca83091470", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 32661, "license_type": "permissive", "max_line_length": 122, "num_lines": 735, "path": "/engine/gfx/gfx_gasoline.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include \"gfx_gasoline.h\"\n#include \"gfx_gasoline_parser.h\"\n#include \"gfx_gasoline_type_system.h\"\n#include \"gfx_gasoline_backend_gsl.h\"\n#include \"gfx_gasoline_backend_cg.h\"\n#include \"gfx_gasoline_backend_glsl.h\"\n\n\nstatic const GfxGslFloatVec GSL_BLACK(0, 0, 0, 0);\n\nstd::ostream &operator<< (std::ostream &o, const GfxGslParam &p)\n{\n switch (p.t) {\n case GFX_GSL_STATIC_INT1:\n case GFX_GSL_INT1:\n o << \"Int(\" << p.is.r << \")\";\n break;\n case GFX_GSL_STATIC_INT2:\n case GFX_GSL_INT2:\n o << \"Int2(\" << p.is.r << \", \" << p.is.g << \")\";\n break;\n case GFX_GSL_STATIC_INT3:\n case GFX_GSL_INT3:\n o << \"Int3(\" << p.is.r << \", \" << p.is.g << \", \" << p.is.b << \")\";\n break;\n case GFX_GSL_STATIC_INT4:\n case GFX_GSL_INT4:\n o << \"Int4(\" << p.is.r << \", \" << p.is.g << \", \" << p.is.b << \", \" << p.is.a << \")\";\n break;\n case GFX_GSL_STATIC_FLOAT1:\n case GFX_GSL_FLOAT1:\n o << \"Float(\" << p.fs.r << \")\";\n break;\n case GFX_GSL_STATIC_FLOAT2:\n case GFX_GSL_FLOAT2:\n o << \"Float2(\" << p.fs.r << \", \" << p.fs.g << \")\";\n break;\n case GFX_GSL_STATIC_FLOAT3:\n case GFX_GSL_FLOAT3:\n o << \"Float3(\" << p.fs.r << \", \" << p.fs.g << \", \" << p.fs.b << \")\";\n break;\n case GFX_GSL_STATIC_FLOAT4:\n case GFX_GSL_FLOAT4:\n case GFX_GSL_FLOAT_TEXTURE1:\n case GFX_GSL_FLOAT_TEXTURE2:\n case GFX_GSL_FLOAT_TEXTURE3:\n case GFX_GSL_FLOAT_TEXTURE4:\n case GFX_GSL_FLOAT_TEXTURE_CUBE:\n o << \"Float4(\" << p.fs.r << \", \" << p.fs.g << \", \" << p.fs.b << \", \" << p.fs.a << \")\";\n break;\n default:\n EXCEPTEX << \"Not a first class parameter value.\" << ENDL;\n }\n if (gfx_gasoline_param_is_static(p)) {\n o << \" /* static */\";\n } else if (gfx_gasoline_param_is_texture(p)) {\n o << \" /* Texture */\";\n }\n return o;\n}\n\nbool operator== (const GfxGslParam &a, const GfxGslParam &b)\n{\n if (a.t != b.t) return false;\n if (gfx_gasoline_param_is_int(a)) {\n if (a.is != b.is) return false;\n } else {\n if (a.fs != b.fs) return false;\n }\n return true;\n}\n\nstatic GfxGslFieldTypeMap make_body_fields (GfxGslAllocator &alloc)\n{\n GfxGslFieldTypeMap m;\n\n m[\"world\"] = alloc.makeType<GfxGslFloatMatrixType>(4,4);\n m[\"worldView\"] = GfxGslFieldType(alloc.makeType<GfxGslFloatMatrixType>(4,4), true, false);\n m[\"worldViewProj\"] = GfxGslFieldType(alloc.makeType<GfxGslFloatMatrixType>(4,4), true, false);\n\n m[\"paintDiffuse0\"] = alloc.makeType<GfxGslFloatType>(3);\n m[\"paintDiffuse1\"] = alloc.makeType<GfxGslFloatType>(3);\n m[\"paintDiffuse2\"] = alloc.makeType<GfxGslFloatType>(3);\n m[\"paintDiffuse3\"] = alloc.makeType<GfxGslFloatType>(3);\n m[\"paintMetallic0\"] = alloc.makeType<GfxGslFloatType>(1);\n m[\"paintMetallic1\"] = alloc.makeType<GfxGslFloatType>(1);\n m[\"paintMetallic2\"] = alloc.makeType<GfxGslFloatType>(1);\n m[\"paintMetallic3\"] = alloc.makeType<GfxGslFloatType>(1);\n m[\"paintSpecular0\"] = alloc.makeType<GfxGslFloatType>(1);\n m[\"paintSpecular1\"] = alloc.makeType<GfxGslFloatType>(1);\n m[\"paintSpecular2\"] = alloc.makeType<GfxGslFloatType>(1);\n m[\"paintSpecular3\"] = alloc.makeType<GfxGslFloatType>(1);\n m[\"paintGloss0\"] = alloc.makeType<GfxGslFloatType>(1);\n m[\"paintGloss1\"] = alloc.makeType<GfxGslFloatType>(1);\n m[\"paintGloss2\"] = alloc.makeType<GfxGslFloatType>(1);\n m[\"paintGloss3\"] = alloc.makeType<GfxGslFloatType>(1);\n\n // Direct access to bone matrixes not allowed -- use transform_to_world.\n\n return m;\n}\n \nstatic GfxGslFieldTypeMap make_global_fields (GfxGslAllocator &alloc)\n{\n GfxGslFieldTypeMap m;\n\n m[\"cameraPos\"] = alloc.makeType<GfxGslFloatType>(3);\n m[\"fovY\"] = alloc.makeType<GfxGslFloatType>(1);\n m[\"proj\"] = alloc.makeType<GfxGslFloatMatrixType>(4,4);\n m[\"time\"] = alloc.makeType<GfxGslFloatType>(1);\n m[\"view\"] = GfxGslFieldType(alloc.makeType<GfxGslFloatMatrixType>(4,4), true, false);\n m[\"invView\"] = GfxGslFieldType(alloc.makeType<GfxGslFloatMatrixType>(4,4), true, false);\n m[\"viewportSize\"] = GfxGslFieldType(alloc.makeType<GfxGslFloatType>(2), false, false);\n m[\"viewProj\"] = GfxGslFieldType(alloc.makeType<GfxGslFloatMatrixType>(4,4), false, false);\n m[\"rayTopLeft\"] = GfxGslFieldType(alloc.makeType<GfxGslFloatType>(3), true, false);\n m[\"rayTopRight\"] = GfxGslFieldType(alloc.makeType<GfxGslFloatType>(3), true, false);\n m[\"rayBottomLeft\"] = GfxGslFieldType(alloc.makeType<GfxGslFloatType>(3), true, false);\n m[\"rayBottomRight\"] = GfxGslFieldType(alloc.makeType<GfxGslFloatType>(3), true, false);\n m[\"nearClipDistance\"] = alloc.makeType<GfxGslFloatType>(1);\n m[\"farClipDistance\"] = alloc.makeType<GfxGslFloatType>(1);\n\n m[\"particleAmbient\"] = alloc.makeType<GfxGslFloatType>(3);\n m[\"sunlightDiffuse\"] = alloc.makeType<GfxGslFloatType>(3);\n m[\"sunlightDirection\"] = alloc.makeType<GfxGslFloatType>(3);\n m[\"sunlightSpecular\"] = alloc.makeType<GfxGslFloatType>(3);\n\n m[\"fogColour\"] = alloc.makeType<GfxGslFloatType>(3);\n m[\"fogDensity\"] = alloc.makeType<GfxGslFloatType>(1);\n m[\"hellColour\"] = alloc.makeType<GfxGslFloatType>(3);\n m[\"skyCloudColour\"] = alloc.makeType<GfxGslFloatType>(3);\n m[\"skyCloudCoverage\"] = alloc.makeType<GfxGslFloatType>(1);\n m[\"skyGlareHorizonElevation\"] = alloc.makeType<GfxGslFloatType>(1);\n m[\"skyGlareSunDistance\"] = alloc.makeType<GfxGslFloatType>(1);\n m[\"sunAlpha\"] = alloc.makeType<GfxGslFloatType>(1);\n m[\"sunColour\"] = alloc.makeType<GfxGslFloatType>(3);\n m[\"sunDirection\"] = alloc.makeType<GfxGslFloatType>(3);\n m[\"sunFalloffDistance\"] = alloc.makeType<GfxGslFloatType>(1);\n m[\"sunSize\"] = alloc.makeType<GfxGslFloatType>(1);\n\n m[\"skyDivider1\"] = alloc.makeType<GfxGslFloatType>(1);\n m[\"skyDivider2\"] = alloc.makeType<GfxGslFloatType>(1);\n m[\"skyDivider3\"] = alloc.makeType<GfxGslFloatType>(1);\n m[\"skyDivider4\"] = alloc.makeType<GfxGslFloatType>(1);\n\n m[\"skyColour0\"] = alloc.makeType<GfxGslFloatType>(3);\n m[\"skyColour1\"] = alloc.makeType<GfxGslFloatType>(3);\n m[\"skyColour2\"] = alloc.makeType<GfxGslFloatType>(3);\n m[\"skyColour3\"] = alloc.makeType<GfxGslFloatType>(3);\n m[\"skyColour4\"] = alloc.makeType<GfxGslFloatType>(3);\n m[\"skyColour5\"] = alloc.makeType<GfxGslFloatType>(3);\n\n m[\"skySunColour0\"] = alloc.makeType<GfxGslFloatType>(3);\n m[\"skySunColour1\"] = alloc.makeType<GfxGslFloatType>(3);\n m[\"skySunColour2\"] = alloc.makeType<GfxGslFloatType>(3);\n m[\"skySunColour3\"] = alloc.makeType<GfxGslFloatType>(3);\n m[\"skySunColour4\"] = alloc.makeType<GfxGslFloatType>(3);\n\n m[\"envCubeCrossFade\"] = GfxGslFieldType(alloc.makeType<GfxGslFloatType>(1), true, true);\n m[\"envCubeMipmaps0\"] = GfxGslFieldType(alloc.makeType<GfxGslFloatType>(1), true, true);\n m[\"envCubeMipmaps1\"] = GfxGslFieldType(alloc.makeType<GfxGslFloatType>(1), true, true);\n m[\"saturation\"] = GfxGslFieldType(alloc.makeType<GfxGslFloatType>(1), true, false);\n m[\"exposure\"] = GfxGslFieldType(alloc.makeType<GfxGslFloatType>(1), true, false);\n m[\"bloomThreshold\"] = GfxGslFieldType(alloc.makeType<GfxGslFloatType>(1), true, false);\n m[\"shadowViewProj0\"] = GfxGslFieldType(alloc.makeType<GfxGslFloatMatrixType>(4,4), true, true);\n m[\"shadowViewProj1\"] = GfxGslFieldType(alloc.makeType<GfxGslFloatMatrixType>(4,4), true, true);\n m[\"shadowViewProj2\"] = GfxGslFieldType(alloc.makeType<GfxGslFloatMatrixType>(4,4), true, true);\n\n m[\"envCube0\"] =\n GfxGslFieldType(alloc.makeType<GfxGslFloatTextureCubeType>(GSL_BLACK), true, true);\n m[\"envCube1\"] =\n GfxGslFieldType(alloc.makeType<GfxGslFloatTextureCubeType>(GSL_BLACK), true, true);\n m[\"fadeDitherMap\"] =\n alloc.makeType<GfxGslFloatTextureType>(GSL_BLACK, 2);\n m[\"gbuffer0\"] =\n GfxGslFieldType(alloc.makeType<GfxGslFloatTextureType>(GSL_BLACK, 2), true, false);\n m[\"shadowPcfNoiseMap\"] =\n GfxGslFieldType(alloc.makeType<GfxGslFloatTextureType>(GSL_BLACK, 2), true, true);\n m[\"shadowMap0\"] =\n GfxGslFieldType(alloc.makeType<GfxGslFloatTextureType>(GSL_BLACK, 2), true, true);\n m[\"shadowMap1\"] =\n GfxGslFieldType(alloc.makeType<GfxGslFloatTextureType>(GSL_BLACK, 2), true, true);\n m[\"shadowMap2\"] =\n GfxGslFieldType(alloc.makeType<GfxGslFloatTextureType>(GSL_BLACK, 2), true, true);\n\n return m;\n}\n \nGfxGslGlobalFuncTypeMap make_func_types (GfxGslAllocator &alloc)\n{\n GfxGslGlobalFuncTypeMap m;\n\n auto is = [&] (int i) -> GfxGslIntType* { return alloc.makeType<GfxGslIntType>(i); };\n auto fs = [&] (int i) -> GfxGslFloatType* { return alloc.makeType<GfxGslFloatType>(i); };\n auto tex = [&] (int i) -> GfxGslFloatTextureType* {\n return alloc.makeType<GfxGslFloatTextureType>(GSL_BLACK, i);\n };\n\n auto *cube = alloc.makeType<GfxGslFloatTextureCubeType>(GSL_BLACK);\n\n //GfxGslType *b = alloc.makeType<GfxGslBoolType>();\n // ts holds the set of all functions: float_n -> float_n\n std::vector<const GfxGslFunctionType*> ts;\n for (unsigned i=1 ; i<=4 ; ++i)\n ts.push_back(alloc.makeType<GfxGslFunctionType>(GfxGslTypes{fs(i)}, fs(i)));\n m[\"tan\"] = ts;\n m[\"atan\"] = ts;\n m[\"sin\"] = ts;\n m[\"asin\"] = ts;\n m[\"cos\"] = ts;\n m[\"acos\"] = ts;\n m[\"ddx\"] = ts; // Only available in fragment shader\n m[\"ddy\"] = ts; // Only available in fragment shader\n m[\"sqrt\"] = ts;\n m[\"fract\"] = ts;\n m[\"floor\"] = ts;\n m[\"ceil\"] = ts;\n\n m[\"abs\"] = GfxGslFunctionTypes {\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{fs(1)}, fs(1)),\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{fs(2)}, fs(2)),\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{fs(3)}, fs(3)),\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{fs(4)}, fs(4)),\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{is(1)}, is(1)),\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{is(2)}, is(2)),\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{is(3)}, is(3)),\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{is(4)}, is(4)),\n };\n\n m[\"pow\"] = GfxGslFunctionTypes {\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{fs(1), fs(1)}, fs(1)),\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{fs(2), fs(1)}, fs(2)),\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{fs(3), fs(1)}, fs(3)),\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{fs(4), fs(1)}, fs(4)),\n };\n\n m[\"strength\"] = GfxGslFunctionTypes {\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{fs(1), fs(1)}, fs(1)),\n };\n\n m[\"atan2\"] = GfxGslFunctionTypes {\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{fs(1), fs(1)}, fs(1))\n };\n\n m[\"dot\"] = GfxGslFunctionTypes {\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{fs(3), fs(3)}, fs(1)),\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{fs(2), fs(2)}, fs(1)),\n };\n m[\"normalise\"] = GfxGslFunctionTypes {\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{fs(3)}, fs(3))\n };\n m[\"reflect\"] = GfxGslFunctionTypes {\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{fs(3), fs(3)}, fs(3))\n };\n m[\"cross\"] = GfxGslFunctionTypes {\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{fs(3), fs(3)}, fs(3))\n };\n\n m[\"desaturate\"] = GfxGslFunctionTypes {\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{fs(3), fs(1)}, fs(3))\n };\n\n // TODO: only available in vertex shader -- needs a lot of varyings for instanced geometry.\n m[\"rotate_to_world\"] = GfxGslFunctionTypes {\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{fs(3)}, fs(3))\n };\n\n // TODO: only available in vertex shader -- needs a lot of varyings for instanced geometry.\n m[\"transform_to_world\"] = GfxGslFunctionTypes {\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{fs(3)}, fs(3))\n };\n\n // ts holds the set of all functions: (float_n) -> float_1\n ts.clear();\n for (unsigned i=1 ; i<=4 ; ++i)\n ts.push_back(alloc.makeType<GfxGslFunctionType>(GfxGslTypes{fs(i)}, fs(1)));\n m[\"length\"] = ts;\n\n // ts holds the set of all functions: (float_n, float_n, float_n) -> float_n\n ts.clear();\n for (unsigned i=1 ; i<=4 ; ++i)\n ts.push_back(alloc.makeType<GfxGslFunctionType>(GfxGslTypes{fs(i), fs(i), fs(i)}, fs(i)));\n m[\"clamp\"] = ts;\n\n m[\"Float\"] = GfxGslFunctionTypes {\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{is(1)}, fs(1)),\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{fs(1)}, fs(1)),\n };\n m[\"Float2\"] = GfxGslFunctionTypes {\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{is(1)}, fs(2)),\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{fs(1)}, fs(2)),\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{is(2)}, fs(2)),\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{fs(2)}, fs(2)),\n\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{fs(1), fs(1)}, fs(2))\n };\n m[\"Float3\"] = GfxGslFunctionTypes {\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{is(1)}, fs(3)),\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{fs(1)}, fs(3)),\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{is(3)}, fs(3)),\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{fs(3)}, fs(3)),\n\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{fs(2), fs(1)}, fs(3)),\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{fs(1), fs(2)}, fs(3)),\n\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{fs(1), fs(1), fs(1)}, fs(3)),\n };\n\n m[\"Float4\"] = GfxGslFunctionTypes {\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{is(1)}, fs(4)),\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{fs(1)}, fs(4)),\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{is(4)}, fs(4)),\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{fs(4)}, fs(4)),\n\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{fs(3), fs(1)}, fs(4)),\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{fs(1), fs(3)}, fs(4)),\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{fs(2), fs(2)}, fs(4)),\n\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{fs(1), fs(1), fs(2)}, fs(4)),\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{fs(1), fs(2), fs(1)}, fs(4)),\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{fs(2), fs(1), fs(1)}, fs(4)),\n\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{fs(1), fs(1), fs(1), fs(1)}, fs(4))\n };\n\n // ts holds the set of all functions: (float_n, float_n, float1) -> float_n\n ts.clear();\n for (unsigned i=1 ; i<=4 ; ++i)\n ts.push_back(alloc.makeType<GfxGslFunctionType>(GfxGslTypes{fs(i), fs(i), fs(i)}, fs(i)));\n m[\"lerp\"] = ts;\n\n\n // ts holds the set of all functions: (float_n, float_n) -> float_n\n ts.clear();\n for (unsigned i=1 ; i<=4 ; ++i)\n ts.push_back(alloc.makeType<GfxGslFunctionType>(GfxGslTypes{fs(i), fs(i)}, fs(i)));\n m[\"max\"] = ts;\n m[\"min\"] = ts;\n\n // ts holds the set of all functions: (float_n, float_1) -> float_n\n ts.clear();\n for (unsigned i=1 ; i<=4 ; ++i)\n ts.push_back(alloc.makeType<GfxGslFunctionType>(GfxGslTypes{fs(i), fs(1)}, fs(i)));\n m[\"mod\"] = ts;\n\n ts.clear();\n for (unsigned w=2 ; w<=4 ; ++w) {\n for (unsigned h=2 ; h<=4 ; ++h) {\n GfxGslType *m = alloc.makeType<GfxGslFloatMatrixType>(w, h);\n ts.push_back(alloc.makeType<GfxGslFunctionType>(GfxGslTypes{m, fs(w)}, fs(h)));\n }\n }\n m[\"mul\"] = ts;\n\n m[\"sample\"] = GfxGslFunctionTypes {\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{tex(2), fs(2)}, fs(4)),\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{tex(3), fs(3)}, fs(4)),\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{cube, fs(3)}, fs(4)),\n };\n m[\"sampleGrad\"] = GfxGslFunctionTypes {\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{tex(2), fs(2), fs(2), fs(2)}, fs(4)),\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{tex(3), fs(3), fs(3), fs(3)}, fs(4)),\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{cube, fs(3), fs(3), fs(3)}, fs(4)),\n };\n\n m[\"sampleLod\"] = GfxGslFunctionTypes {\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{tex(2), fs(2), fs(1)}, fs(4)),\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{tex(3), fs(3), fs(1)}, fs(4)),\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{cube, fs(3), fs(1)}, fs(4)),\n };\n\n m[\"pma_decode\"] = GfxGslFunctionTypes {\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{fs(4)}, fs(4)),\n };\n\n m[\"gamma_decode\"] = GfxGslFunctionTypes {\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{fs(1)}, fs(1)),\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{fs(2)}, fs(2)),\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{fs(3)}, fs(3)),\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{fs(4)}, fs(4)),\n };\n\n m[\"gamma_encode\"] = GfxGslFunctionTypes {\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{fs(1)}, fs(1)),\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{fs(2)}, fs(2)),\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{fs(3)}, fs(3)),\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{fs(4)}, fs(4)),\n };\n\n m[\"sunlight\"] = GfxGslGlobalFuncType(\n GfxGslFunctionTypes {\n alloc.makeType<GfxGslFunctionType>(\n GfxGslTypes{fs(3), fs(3), fs(3), fs(3), fs(1), fs(1), fs(1)}, fs(3)),\n }, true, true);\n \n\n m[\"envlight\"] = GfxGslGlobalFuncType(\n GfxGslFunctionTypes {\n alloc.makeType<GfxGslFunctionType>(\n GfxGslTypes{fs(3), fs(3), fs(3), fs(1), fs(1)}, fs(3)),\n }, true, true);\n\n m[\"punctual_lighting\"] = GfxGslGlobalFuncType(\n GfxGslFunctionTypes {\n alloc.makeType<GfxGslFunctionType>(\n GfxGslTypes{fs(3), fs(3), fs(3), fs(3), fs(1), fs(1), fs(3), fs(3)}, fs(3)),\n }, true, false);\n\n m[\"unpack_deferred_diffuse_colour\"] = GfxGslGlobalFuncType(\n GfxGslFunctionTypes {\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{fs(4), fs(4), fs(4)}, fs(3))\n }, true, false);\n m[\"unpack_deferred_specular\"] = GfxGslGlobalFuncType(\n GfxGslFunctionTypes {\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{fs(4), fs(4), fs(4)}, fs(1))\n }, true, false);\n m[\"unpack_deferred_shadow_cutoff\"] = GfxGslGlobalFuncType(\n GfxGslFunctionTypes {\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{fs(4), fs(4), fs(4)}, fs(1))\n }, true, false);\n m[\"unpack_deferred_gloss\"] = GfxGslGlobalFuncType(\n GfxGslFunctionTypes {\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{fs(4), fs(4), fs(4)}, fs(1))\n }, true, false);\n m[\"unpack_deferred_cam_dist\"] = GfxGslGlobalFuncType(\n GfxGslFunctionTypes {\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{fs(4), fs(4), fs(4)}, fs(1))\n }, true, false);\n m[\"unpack_deferred_normal\"] = GfxGslGlobalFuncType(\n GfxGslFunctionTypes {\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{fs(4), fs(4), fs(4)}, fs(3))\n }, true, false);\n\n m[\"fog_weakness\"] = GfxGslGlobalFuncType(\n GfxGslFunctionTypes {\n alloc.makeType<GfxGslFunctionType>(GfxGslTypes{fs(1)}, fs(1))\n }, true, false);\n\n return m;\n}\n\n\n\nstatic GfxGslType *to_type (GfxGslAllocator &alloc, const GfxGslParam &p)\n{\n switch (p.t) {\n case GFX_GSL_INT1: case GFX_GSL_STATIC_INT1: return alloc.makeType<GfxGslIntType>(1);\n case GFX_GSL_INT2: case GFX_GSL_STATIC_INT2: return alloc.makeType<GfxGslIntType>(2);\n case GFX_GSL_INT3: case GFX_GSL_STATIC_INT3: return alloc.makeType<GfxGslIntType>(3);\n case GFX_GSL_INT4: case GFX_GSL_STATIC_INT4: return alloc.makeType<GfxGslIntType>(4);\n case GFX_GSL_FLOAT1: case GFX_GSL_STATIC_FLOAT1: return alloc.makeType<GfxGslFloatType>(1);\n case GFX_GSL_FLOAT2: case GFX_GSL_STATIC_FLOAT2: return alloc.makeType<GfxGslFloatType>(2);\n case GFX_GSL_FLOAT3: case GFX_GSL_STATIC_FLOAT3: return alloc.makeType<GfxGslFloatType>(3);\n case GFX_GSL_FLOAT4: case GFX_GSL_STATIC_FLOAT4: return alloc.makeType<GfxGslFloatType>(4);\n case GFX_GSL_FLOAT_TEXTURE1: return alloc.makeType<GfxGslFloatTextureType>(p.fs, 1);\n case GFX_GSL_FLOAT_TEXTURE2: return alloc.makeType<GfxGslFloatTextureType>(p.fs, 2);\n case GFX_GSL_FLOAT_TEXTURE3: return alloc.makeType<GfxGslFloatTextureType>(p.fs, 3);\n case GFX_GSL_FLOAT_TEXTURE4: return alloc.makeType<GfxGslFloatTextureType>(p.fs, 4);\n case GFX_GSL_FLOAT_TEXTURE_CUBE: return alloc.makeType<GfxGslFloatTextureCubeType>(p.fs);\n }\n EXCEPTEX << ENDL;\n}\n\nstatic GfxGslFieldTypeMap make_mat_fields (GfxGslAllocator &alloc, const GfxGslRunParams &params)\n{\n GfxGslFieldTypeMap r;\n for (auto pair : params)\n r[pair.first] = to_type(alloc, pair.second);\n return r;\n}\n\ntypedef GfxGasolineResult Continuation (const GfxGslContext &ctx,\n const GfxGslTypeSystem &vert_ts,\n const GfxGslAst *vert_ast,\n const GfxGslTypeSystem &dangs_ts,\n const GfxGslAst *dangs_ast,\n const GfxGslTypeSystem &additional_ts,\n const GfxGslAst *additional_ast,\n const GfxGslMetadata &md);\n\n// Intended to be called with lambdas that finish off compilation.\ntemplate<class Continuation>\nstatic GfxGasolineResult type_check (const std::string &vert_prog,\n const std::string &dangs_prog,\n const std::string &additional_prog,\n const GfxGslMetadata &md,\n Continuation cont)\n{\n GfxGslAllocator alloc;\n GfxGslContext ctx = {\n alloc, make_func_types(alloc), make_global_fields(alloc),\n make_mat_fields(alloc, md.params), make_body_fields(alloc), md.matEnv.ubt,\n md.matEnv.staticValues, md.d3d9, md.internal, md.lightingTextures\n };\n\n GfxGslShader *vert_ast;\n GfxGslTypeSystem vert_ts(ctx, GFX_GSL_VERTEX);\n\n try {\n vert_ast = gfx_gasoline_parse(alloc, vert_prog);\n vert_ts.inferAndSet(vert_ast, GfxGslDefMap { });\n } catch (const Exception &e) {\n EXCEPT << \"Vertex shader: \" << e << ENDL;\n }\n\n\n GfxGslShader *dangs_ast;\n GfxGslTypeSystem dangs_ts(ctx, GFX_GSL_DANGS);\n\n try {\n dangs_ast = gfx_gasoline_parse(alloc, dangs_prog);\n dangs_ts.inferAndSet(dangs_ast, vert_ast->vars);\n } catch (const Exception &e) {\n EXCEPT << \"DANGS shader: \" << e << ENDL;\n }\n\n GfxGslShader *additional_ast;\n GfxGslTypeSystem additional_ts(ctx, GFX_GSL_COLOUR_ALPHA);\n\n try {\n additional_ast = gfx_gasoline_parse(alloc, additional_prog);\n additional_ts.inferAndSet(additional_ast, vert_ast->vars);\n } catch (const Exception &e) {\n EXCEPT << \"Additional shader: \" << e << ENDL;\n }\n\n return cont(ctx, vert_ts, vert_ast, dangs_ts, dangs_ast, additional_ts, additional_ast, md);\n}\n\nvoid gfx_gasoline_check (const std::string &vert_prog,\n const std::string &dangs_prog,\n const std::string &additional_prog,\n const GfxGslMetadata &md)\n{\n auto cont = [] (const GfxGslContext &,\n const GfxGslTypeSystem &,\n const GfxGslAst *,\n const GfxGslTypeSystem &,\n const GfxGslAst *,\n const GfxGslTypeSystem &,\n const GfxGslAst *,\n const GfxGslMetadata &)\n -> GfxGasolineResult\n {\n return GfxGasolineResult();\n };\n\n type_check(vert_prog, dangs_prog, additional_prog, md, cont);\n}\n\nstatic GfxGasolineResult gfx_gasoline_compile_colour (const GfxGslBackend backend,\n const std::string &vert_prog,\n const std::string &colour_prog,\n const GfxGslMetadata &md,\n const bool flat_z, const bool das)\n{\n auto cont = [backend, flat_z, das] (\n const GfxGslContext &ctx,\n const GfxGslTypeSystem &vert_ts,\n const GfxGslAst *vert_ast,\n const GfxGslTypeSystem &dangs_ts,\n const GfxGslAst *dangs_ast,\n const GfxGslTypeSystem &additional_ts,\n const GfxGslAst *additional_ast,\n const GfxGslMetadata &md)\n -> GfxGasolineResult\n {\n (void) dangs_ts; (void) dangs_ast;\n std::string vert_out;\n std::string frag_out;\n switch (backend) {\n case GFX_GSL_BACKEND_CG:\n gfx_gasoline_unparse_cg(\n ctx, &vert_ts, vert_ast, vert_out, &additional_ts, additional_ast, frag_out,\n md.cfgEnv, md.matEnv, md.meshEnv, flat_z, das);\n break;\n\n case GFX_GSL_BACKEND_GLSL33:\n gfx_gasoline_unparse_glsl(\n ctx, &vert_ts, vert_ast, vert_out, &additional_ts, additional_ast, frag_out,\n md.cfgEnv, md.matEnv, md.meshEnv, true, flat_z, das);\n break;\n }\n return {vert_out, frag_out};\n };\n\n return type_check(vert_prog, \"\", colour_prog, md, cont);\n}\n\nstatic GfxGasolineResult gfx_gasoline_compile_body (const GfxGslBackend backend,\n const std::string &vert_prog,\n const std::string &dangs_prog,\n const std::string &additional_prog,\n const GfxGslMetadata &md,\n bool first_person,\n bool wireframe,\n bool forward_only,\n bool cast)\n{\n auto cont = [backend, first_person, wireframe, forward_only, cast] (\n const GfxGslContext &ctx,\n const GfxGslTypeSystem &vert_ts,\n const GfxGslAst *vert_ast,\n const GfxGslTypeSystem &dangs_ts,\n const GfxGslAst *dangs_ast,\n const GfxGslTypeSystem &additional_ts,\n const GfxGslAst *additional_ast,\n const GfxGslMetadata &md)\n -> GfxGasolineResult\n {\n std::string vert_out;\n std::string frag_out;\n switch (backend) {\n case GFX_GSL_BACKEND_CG:\n gfx_gasoline_unparse_body_cg(\n ctx, &vert_ts, vert_ast, &dangs_ts, dangs_ast, &additional_ts, additional_ast,\n vert_out, frag_out, md.cfgEnv, md.matEnv, md.meshEnv, first_person, wireframe,\n forward_only, cast);\n break;\n\n case GFX_GSL_BACKEND_GLSL33:\n gfx_gasoline_unparse_body_glsl(\n ctx, &vert_ts, vert_ast, &dangs_ts, dangs_ast, &additional_ts, additional_ast,\n vert_out, frag_out, md.cfgEnv, md.matEnv, md.meshEnv, true, first_person, wireframe,\n forward_only, cast);\n break;\n }\n return {vert_out, frag_out};\n };\n\n return type_check(vert_prog, dangs_prog, additional_prog, md, cont);\n}\n\nGfxGasolineResult gfx_gasoline_compile (GfxGslPurpose purpose,\n GfxGslBackend backend,\n const std::string &vert_prog,\n const std::string &dangs_prog,\n const std::string &additional_prog,\n const GfxGslMetadata &md)\n{\n switch (purpose) {\n case GFX_GSL_PURPOSE_FORWARD:\n return gfx_gasoline_compile_body(backend, vert_prog, dangs_prog, additional_prog, md, false, false, true, false);\n\n case GFX_GSL_PURPOSE_ALPHA:\n return gfx_gasoline_compile_body(backend, vert_prog, dangs_prog, additional_prog, md, false, false, false, false);\n\n case GFX_GSL_PURPOSE_FIRST_PERSON:\n return gfx_gasoline_compile_body(backend, vert_prog, dangs_prog, additional_prog, md, true, true, false, false);\n\n case GFX_GSL_PURPOSE_FIRST_PERSON_WIREFRAME: {\n std::string colour_prog = \"out.colour = Float3(1, 1, 1);\\n\";\n return gfx_gasoline_compile_body(backend, vert_prog, \"\", colour_prog, md, true, true, false, false);\n }\n\n case GFX_GSL_PURPOSE_ADDITIONAL:\n return gfx_gasoline_compile_colour(backend, vert_prog, additional_prog, md, false, false);\n\n case GFX_GSL_PURPOSE_WIREFRAME: {\n std::string white_prog = \"out.colour = Float3(1, 1, 1);\\n\";\n return gfx_gasoline_compile_colour(backend, vert_prog, white_prog, md, false, false);\n }\n\n case GFX_GSL_PURPOSE_SKY:\n return gfx_gasoline_compile_colour(backend, vert_prog, additional_prog, md, true, false);\n\n case GFX_GSL_PURPOSE_HUD:\n return gfx_gasoline_compile_colour(backend, vert_prog, additional_prog, md, false, false);\n\n case GFX_GSL_PURPOSE_DECAL: {\n auto cont = [backend] (const GfxGslContext &ctx,\n const GfxGslTypeSystem &vert_ts,\n const GfxGslAst *vert_ast,\n const GfxGslTypeSystem &dangs_ts,\n const GfxGslAst *dangs_ast,\n const GfxGslTypeSystem &additional_ts,\n const GfxGslAst *additional_ast,\n const GfxGslMetadata &md)\n -> GfxGasolineResult\n {\n // TODO: Ensure the dangs & additional shaders do not use vertex fields.\n (void) vert_ts;\n (void) vert_ast;\n std::string vert_out;\n std::string frag_out;\n switch (backend) {\n case GFX_GSL_BACKEND_CG:\n gfx_gasoline_unparse_decal_cg(ctx, &dangs_ts, dangs_ast,\n &additional_ts, additional_ast,\n vert_out, frag_out,\n md.cfgEnv, md.matEnv, md.meshEnv);\n break;\n\n case GFX_GSL_BACKEND_GLSL33:\n gfx_gasoline_unparse_decal_glsl(ctx, &dangs_ts, dangs_ast,\n &additional_ts, additional_ast,\n vert_out, frag_out,\n md.cfgEnv, md.matEnv, md.meshEnv, true);\n break;\n }\n return {vert_out, frag_out};\n };\n\n return type_check(\"\", dangs_prog, additional_prog, md, cont);\n }\n\n case GFX_GSL_PURPOSE_DEFERRED_AMBIENT_SUN:\n return gfx_gasoline_compile_colour(backend, vert_prog, additional_prog, md, false, true);\n\n case GFX_GSL_PURPOSE_CAST:\n return gfx_gasoline_compile_body(backend, vert_prog, dangs_prog, additional_prog, md, false, false, false, true);\n\n }\n\n EXCEPTEX << \"Unreachable\" << ENDL; // g++ bug requires this.\n}\n" }, { "alpha_fraction": 0.568302571773529, "alphanum_fraction": 0.5698655843734741, "avg_line_length": 52.29999923706055, "blob_id": "29023665ef1651941fc75354cc0143e1dc89bf46", "content_id": "53e27816ae288a4053412c12da929226ca6068d8", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3199, "license_type": "permissive", "max_line_length": 106, "num_lines": 60, "path": "/dependencies/quex-0.34.1/quex/core_engine/state_machine/dead_end_analysis.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "\ndef do(state_machine):\n \"\"\"(1) Delete transitions to non-acceptance states that have no further \n transition. Delete also the correspondent empty states.\n\n This can be done, since a transition to a non-acceptance state\n where there is no further path is identical to a drop-out. The\n drop out happens if no transition happens on current character.\n \n (2) Collect all states that have no further transitions, i.e. dead end states.\n Some of them need to be investigated, since it depends on pre-conditions\n what terminal state is to be considered. The mapping works as follows:\n\n db.has_key(state_index) == False ==> state is not a dead end at all.\n\n db[state_index] = None ==> state is a 'gateway' please, jump as usual to \n the state, the state then routes to the correspondent\n terminal (without input) depending on the \n pre-conditions.\n\n db[state_index] = integer ==> state transits immediately to TERMINAL_n\n where 'n' is the integer.\n\n db[state_index] = -1 ==> state is a 'harmless' drop out. need to jump to\n general terminal\n \"\"\"\n db = {}\n directly_reached_terminal_id_list = []\n non_acceptance_dead_end_state_index_list = []\n for state_index, state in state_machine.states.items():\n\n if not state.transitions().is_empty(): continue\n\n if state.is_acceptance(): \n # (2) Acceptance States --> short cuts\n db[state_index] = state\n if state.origins().contains_any_pre_context_dependency():\n # (a) state require run time investigation since pre-conditions have to be checked\n # Terminals are reached via a 'router'. nevertheless, they are reached \n # without a seek.\n for origin in state.origins().get_list():\n if not origin.is_acceptance(): continue\n directly_reached_terminal_id_list.append(origin.state_machine_id)\n\n else:\n # Find the first acceptance origin (origins are sorted already)\n acceptance_origin = state.origins().find_first_acceptance_origin()\n # There **must** be an acceptance state, see above\n assert type(acceptance_origin) != type(None)\n\n # (b) state transits automatically to terminal given below\n directly_reached_terminal_id_list.append(acceptance_origin.state_machine_id)\n else:\n # (1) Non-Acceptance states --> deletion of state and all transitions to it\n for state in state_machine.states.values():\n state.transitions().delete_transitions_to_target(state_index) \n\n del state_machine.states[state_index]\n non_acceptance_dead_end_state_index_list.append(state_index)\n\n return db, directly_reached_terminal_id_list\n" }, { "alpha_fraction": 0.6216036081314087, "alphanum_fraction": 0.623270571231842, "avg_line_length": 51.165218353271484, "blob_id": "27eb576d35d415093a33845a9199566c71fff1de", "content_id": "b681cc4844eb4181111b4b4079e303dfbcf850aa", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 5999, "license_type": "permissive", "max_line_length": 99, "num_lines": 115, "path": "/dependencies/quex-0.34.1/quex/core_engine/generator/transition.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "import quex.core_engine.generator.acceptance_info as acceptance_info\nfrom quex.input.setup import setup as Setup\n\n\ndef __goto_distinct_terminal(Origin):\n assert Origin.is_acceptance()\n LanguageDB = Setup.language_db\n txt = \"\"\n if Origin.post_context_id() == -1:\n # The seek for the end of the core pattern is part of the 'normal' terminal\n # if the terminal 'is' a post conditioned pattern acceptance.\n txt += LanguageDB[\"$input/increment\"] + \"\\n\"\n txt += LanguageDB[\"$goto\"](\"$terminal-direct\", Origin.state_machine_id)\n return txt\n\n\ndef do(CurrentStateIdx, TriggerInterval, TargetStateIdx, DSM):\n \"\"\"\n TargetStateIdx: != None: Index of the state to which 'goto' has to go.\n == None: Drop Out. Goto a terminal state.\n DSM == None: We are not concerned with the whole state machine and just want to\n create a nice binary-bracketing transition (e.g. for range skippers).\n \"\"\"\n LanguageDB = Setup.language_db\n assert DSM == None or DSM.__class__.__name__ == \"StateMachineDecorator\"\n assert TargetStateIdx == None or TargetStateIdx >= 0\n assert TriggerInterval.__class__.__name__ == \"Interval\" or TriggerInterval == None\n\n if DSM == None or not DSM.dead_end_state_db().has_key(TargetStateIdx):\n # (1) The target state is not mentioned to be a state void of further transitions.\n if TargetStateIdx != None: \n # THE very normal transition to another state\n return LanguageDB[\"$goto\"](\"$entry\", TargetStateIdx)\n else:\n # NOTE: The normal drop out contains a check against the buffer limit code. This\n # check can be avoided, if one is sure that the current interval does not contain\n # a buffer limit code.\n blc = Setup.buffer_limit_code\n if type(blc) != int:\n if len(blc) > 2 and blc[:2] == \"0x\": blc = int(blc, 16)\n else: blc = int(blc)\n if TriggerInterval == None or TriggerInterval.contains(blc):\n return LanguageDB[\"$goto\"](\"$drop-out\", CurrentStateIdx)\n else:\n return LanguageDB[\"$goto\"](\"$drop-out-direct\", CurrentStateIdx)\n else:\n # (2) The TargetStateIdx is mentioned to be a dead-end-state! That means, that there is\n # actually no 'transition body' in that state and it transits directly to a terminal.\n dead_end_target_state = DSM.dead_end_state_db()[TargetStateIdx]\n assert dead_end_target_state.is_acceptance(), \\\n \"NON-ACCEPTANCE dead end detected during code generation!\\n\" + \\\n \"A dead end that is not deleted must be an ACCEPTANCE dead end. See\\n\" + \\\n \"state_machine.dead_end_analysis.py and generator.state_machine_coder.py.\\n\" + \\\n \"If this is not the case, then something serious went wrong. A transition\\n\" + \\\n \"to a non-acceptance dead end is to be translated into a drop-out.\"\n\n if dead_end_target_state.origins().contains_any_pre_context_dependency(): \n # Backward lexing (pre-condition or backward input position detection) cannot\n # depend on pre-conditions, since it is not part of the 'main' lexical analyser\n # process.\n assert DSM.mode() == \"ForwardLexing\"\n return LanguageDB[\"$goto\"](\"$entry\", TargetStateIdx) # router to terminal\n\n elif DSM.mode() == \"ForwardLexing\":\n winner_origin = dead_end_target_state.origins().find_first_acceptance_origin()\n assert type(winner_origin) != type(None) # see first assert in this block\n\n terminal_id = winner_origin.state_machine_id\n\n # During forward lexing (main lexer process) there are dedicated terminal states.\n return __goto_distinct_terminal(winner_origin)\n\n elif DSM.mode() == \"BackwardLexing\":\n # When checking a pre-condition no dedicated terminal exists. However, when\n # we check for pre-conditions, a pre-condition flag needs to be set.\n return acceptance_info.backward_lexing(dead_end_target_state)\n\n elif DSM.mode() == \"BackwardInputPositionDetection\":\n # When searching backwards for the end of the core pattern, and one reaches\n # a dead end state, then no position needs to be stored extra since it was\n # stored at the entry of the state.\n txt = LanguageDB[\"$input/decrement\"] + \"\\n\"\n txt += acceptance_info.backward_lexing_find_core_pattern(dead_end_target_state)\n\n txt += LanguageDB[\"$goto\"](\"$terminal-general\", True) # general terminal\n return txt\n else:\n assert False, \"Impossible lexing mode: '%s'\" % DSM.mode()\n \n \n\ndef do_dead_end_router(State, StateIdx, BackwardLexingF):\n # DeadEndType == -1:\n # States, that do not contain any acceptance transit to the 'General Terminal'\n # The do not have to be coded. Instead the 'jump' must be redirected immediately\n # to the general terminal.\n # DeadEndType == some integer:\n # States, where the acceptance is clear must be redirected to the correspondent\n # terminal given by the integer.\n # DeadEndType == None:\n # States, where the acceptance depends on the run-time pre-conditions being fulfilled\n # or not. They are the only once, that are 'implemented' as routers, that map to\n # a terminal correspondent the pre-conditions.\n assert State.is_acceptance()\n\n if State.origins().contains_any_pre_context_dependency() == False: \n return \"\"\n\n txt = acceptance_info.get_acceptance_detector(State.origins().get_list(), \n __goto_distinct_terminal)\n \n # -- double check for consistency\n assert txt != \"\", \"Acceptance state without acceptance origins!\" \n\n return txt\n" }, { "alpha_fraction": 0.600193977355957, "alphanum_fraction": 0.6023760437965393, "avg_line_length": 41.689117431640625, "blob_id": "c6f1a9073f281eec392938d2ae571a2a7a51bd0a", "content_id": "1096a02ccc71e38bbc169059b5d9ba236d2df679", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 8249, "license_type": "permissive", "max_line_length": 110, "num_lines": 193, "path": "/dependencies/quex-0.34.1/quex/core_engine/generator/languages/visual_basic.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "from copy import copy\nfrom quex.frs_py.string_handling import blue_print\ndb={}\n\ndef get_label(StateMachineName, StateIdx, SuccessfulOriginalStateMachineID=None):\n \"\"\"\n (1) StateIdx != None\n jump label for state machine state entry \n (2) StateIdx == None: terminal state\n (1a) SuccessfulOriginalStateMachineID == None: not acceptance terminal state\n (1b) else: acceptance terminal state\n \"\"\"\n def nice(SM_ID): return repr(SM_ID).replace(\"L\", \"\")\n\n if StateIdx != None: \n return \"QUEX_LABEL_%s_ENTRY_%s\" % (StateMachineName, nice(StateIdx))\n elif SuccessfulOriginalStateMachineID == None:\n return \"QUEX_LABEL_%s_TERMINAL\" % StateMachineName\n else: \n return \"QUEX_LABEL_%s_TERMINAL_%s\" % (StateMachineName, nice(SuccessfulOriginalStateMachineID))\n\n#________________________________________________________________________________\n# C++\n#\ndef __cpp_goto_state(UserDefinedStateMachineName, StateIdx, SuccessfulOriginalStateMachineID=None):\n return \"goto %s;\" % get_label(UserDefinedStateMachineName, StateIdx, SuccessfulOriginalStateMachineID)\n \ndef __cpp_acceptance_info(SuccessfulOriginalStateMachineID, LanguageDB):\n if SuccessfulOriginalStateMachineID != None:\n txt = \"last_acceptance = %s;\\n\" % SuccessfulOriginalStateMachineID\n txt += LanguageDB[\"$input/tell_position\"](\"last_acceptance_input_position\") + \"\\n\"\n else:\n txt = \"\" \n return txt\n\n__cpp_function_header = \\\n\"\"\"#include<istream>\n#define QUEX_CHAR_BUFFER_BASED\n\n#if defined QUEX_ANALYSER_STREAM_BASED\n# define QUEX_ANALYSER_FUNC_ARGS std::istream& stream\n# define QUEX_ANALYSER_RETURN_TYPE int\n# define QUEX_CHARACTER_TYPE int\n# define QUEX_CHARACTER_POSITION std::istream::pos_type\n# define QUEX_STREAM_GET(character) (character = stream.get())\n# define QUEX_STREAM_TELL(position) (position = stream.tellg())\n# define QUEX_STREAM_SEEK(position) (stream.seekg((position)))\n#endif\n\n#if defined QUEX_CHAR_BUFFER_BASED\n/* Pass a pointer to a pointer to the analyser, because the last lexing\n** position is to be stored. This way the next call to the analyser can\n** start where it has stopped before.\n*/\n# define QUEX_ANALYSER_FUNC_ARGS unsigned char** char_pp\n# define QUEX_ANALYSER_RETURN_TYPE int\n# define QUEX_CHARACTER_TYPE unsigned char\n# define QUEX_CHARACTER_POSITION unsigned char*\n# define QUEX_STREAM_GET(character) character = (**char_pp); ++(*char_pp); \n# define QUEX_STREAM_TELL(position) position = *char_pp;\n# define QUEX_STREAM_SEEK(position) *char_pp = position;\n#endif\n\n#if defined QUEX_ANALYSER_UNICODE_VECTOR_BASED\n// Each element in the vector contains a unicode character\n# define QUEX_ANALYSER_FUNC_ARGS std::vector<int>::iterator& it\n# define QUEX_ANALYSER_RETURN_TYPE int\n# define QUEX_CHARACTER_TYPE int\n# define QUEX_CHARACTER_POSITION std::vector<int>::iterator\n# define QUEX_STREAM_GET(character) character = (*it); ++it; \n# define QUEX_STREAM_TELL(position) position = it;\n# define QUEX_STREAM_SEEK(position) it = position;\n#endif\n\nQUEX_ANALYSER_RETURN_TYPE\n$$QUEX_ANALYZER_FUNCTION_NAME$$(QUEX_ANALYSER_FUNC_ARGS) {\n int last_acceptance = -1;\n QUEX_CHARACTER_POSITION last_acceptance_input_position = (QUEX_CHARACTER_POSITION)(0x00);\n QUEX_CHARACTER_TYPE input = (QUEX_CHARACTER_TYPE)(0x00);\\n\n\"\"\"\ndef __cpp_analyser_function(FunctionName, function_body): \n txt = __cpp_function_header.replace(\"$$QUEX_ANALYZER_FUNCTION_NAME$$\", \n FunctionName)\n txt += function_body\n txt += \"}\\n\"\n return txt\n\n__cpp_terminal_state_str = \"\"\"\n // (*) terminal states\n //\n // NOTE: 'input' contains the next character already, so there is no\n // need to read it from the stream again. Thus,\n //\n // goto QUEX_LABEL_$$STATE_MACHINE_NAME$$_ENTRY_INITIAL_STATE;\n //\n // at the end of each acceptance terminal state. However:\n //\n // goto $$INITIAL_STATE_INDEX_LABEL$$;\n // \n // However, in cases that the related action contains a 'return' it has\n // to be sure that the lexical analysis starts at the previous position.\n // Thus one needs to 'seek-back' first. We write the 'input-get' code directly\n // after the pattern action, so that the compiler might be able to recognize\n // a redundancy during optimization.\n\n // specific terminal states, i.e. related to a 'winner pattern'. this means,\n // that the last input before the pattern matched a complete pattern.\n $$SPECIFIC_TERMINAL_STATES$$\n\n TERMINAL_GENERAL:\n int tmp = last_acceptance;\n last_acceptance = 0x00; // reset the last acceptance position for next run\n // jump to last acceptance state\n // if last acceptance:\n // -- execute pattern action \n // -- goto initial state\n // else:\n // -- execute defaul action\n // -- goto initial state \n switch( tmp ) {\n $$JUMPS_TO_ACCEPTANCE_STATE$$\n default:\n // no acceptance state \n $$DEFAULT_ACTION$$\n QUEX_STREAM_GET(input);\n goto QUEX_LABEL_$$STATE_MACHINE_NAME$$_ENTRY_INITIAL_STATE; \n }\n\"\"\"\n\ndef __cpp_terminal_states(StateMachineName, sm, action_db, DefaultAction):\n \n # -- specific terminal states of patterns (entered from acceptance states)\n txt = \"\"\n for state_machine_id in action_db.keys():\n txt += \" %s:\\n\" % get_label(\"\", None, state_machine_id)\n action_code = \" \" + action_db[state_machine_id].replace(\"\\n\", \"\\n \") \n txt += \" QUEX_STREAM_SEEK(last_acceptance_input_position);\"\n txt += action_code + \"\\n\" \n txt += \" // if action code returns from the function, then the following is meaningless\\n\"\n if sm.states[sm.init_state_index].transitions().is_empty() == False:\n txt += \" QUEX_STREAM_GET(input);\"\n txt += \" goto QUEX_LABEL_%s_ENTRY_INITIAL_STATE;\\n\" % StateMachineName\n\n specific_terminal_states_str = txt\n\n # -- general terminal state (entered from non-acceptance state) \n txt = \"\" \n for state_machine_id in action_db.keys():\n txt += \" case %s: goto %s;\\n\" % \\\n (repr(state_machine_id), get_label(\"\", None, state_machine_id))\n jumps_to_acceptance_states_str = txt\n\n\n # -- execute default pattern action \n # -- reset character stream to last success \n # -- goto initial state \n txt = blue_print(__cpp_terminal_state_str, \n [[\"$$JUMPS_TO_ACCEPTANCE_STATE$$\", jumps_to_acceptance_states_str], \n [\"$$SPECIFIC_TERMINAL_STATES$$\", specific_terminal_states_str],\n [\"$$DEFAULT_ACTION$$\", DefaultAction.replace(\"\\n\", \" \\n\")],\n [\"$$STATE_MACHINE_NAME$$\", StateMachineName],\n [\"$$INITIAL_STATE_INDEX_LABEL$$\", get_label(StateMachineName, sm.init_state_index)]])\n return txt\n \n#________________________________________________________________________________\n# Visual Basic 6\n# \ndb[\"VisualBasic6\"] = {\n \"$if\": \"If\",\n \"$then\": \"Then\",\n \"$endif\": \"End If\",\n \"$>=\": \">=\",\n \"$==\": \"==\",\n \"$input\": \"input\",\n \"$return_true\": \"$the_function = True: Exit Function\",\n \"$return_false\": \"$the_function = True: Exit Function\",\n }\n\n\ndef replace_keywords(program_txt, LanguageDB, NoIndentF):\n \"\"\"Replaces pseudo-code keywords with keywords of the given language.\"\"\"\n\n txt = blue_print(program_txt, LanguageDB.items())\n\n if NoIndentF == False:\n # delete the last newline, to prevent additional indentation\n if txt[-1] == \"\\n\": txt = txt[:-1]\n # indent by four spaces\n # (if this happens in recursively called functions nested indented blocks\n # are correctly indented, see NumberSet::get_condition_code() for example) \n txt = txt.replace(\"\\n\", \"\\n \") + \"\\n\"\n \n return txt \n" }, { "alpha_fraction": 0.6514014005661011, "alphanum_fraction": 0.66266268491745, "avg_line_length": 32.29999923706055, "blob_id": "b486da5f6c4ba8258611ee46d539157f4829280f", "content_id": "cace6a699249970da2d34d1f47dcda2a3bd14ef3", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 3996, "license_type": "permissive", "max_line_length": 80, "num_lines": 120, "path": "/engine/sse_allocator.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n/** Used to specify 16-byte aligned internal storage for c++ stdlib\n * datastructures such as std::vector. This implementation wastes between 1\n * and 16 bytes (inclusive) for metadata in each allocation by storing the\n * padding required to offset the pointer to 16-byte alignment.\n */\ntemplate <class T> class SSEAllocator {\n\n public:\n\n typedef T value_type;\n typedef value_type *pointer;\n typedef const value_type *const_pointer;\n typedef value_type &reference;\n typedef const value_type &const_reference;\n typedef std::size_t size_type;\n typedef std::ptrdiff_t difference_type;\n\n\n SSEAllocator (void) {}\n\n SSEAllocator (const SSEAllocator&) {}\n\n ~SSEAllocator (void) {}\n\n template <class U>\n SSEAllocator (const SSEAllocator<U>&) {}\n\n template <class U>\n struct rebind { typedef SSEAllocator<U> other; };\n\n\n pointer address(reference x) const { return &x; }\n\n const_pointer address(const_reference x) const { return &x; }\n\n\n pointer allocate (size_type n, const_pointer = 0)\n {\n size_type size = n * sizeof(T);\n //std::cout << \"+size: \" << size << std::endl;\n // offset by positive amount to force alignment\n // store the offset behind the pointer to the aligned block\n unsigned char *block = (unsigned char*)std::malloc(size+1+15);\n if (!block)\n throw std::bad_alloc();\n //std::cout << \"+block: \" << (void*)block << std::endl;\n unsigned char *aligned16 =\n (unsigned char*)((size_t)(block+1+15)&(size_t)(-16));\n //std::cout << \"+aligned16: \" << (void*)aligned16 << std::endl;\n unsigned char offset = aligned16 - block;\n aligned16[-1] = offset;\n return (pointer)aligned16;\n }\n\n void deallocate (pointer p, size_type)\n {\n unsigned char *aligned16 = (unsigned char*) p;\n //std::cout << \"-aligned16: \" << (void*)aligned16 << std::endl;\n unsigned char offset = aligned16[-1];\n unsigned char *block = aligned16 - offset;\n //std::cout << \"-block: \" << (void*)block << std::endl;\n std::free(block);\n }\n\n\n size_type max_size (void) const\n {\n return static_cast<size_type>(-1) / sizeof(value_type);\n }\n\n\n void construct (pointer p, const value_type& x) { new(p)value_type(x); }\n\n void destroy (pointer p) { p->~value_type(); }\n\n\n private:\n\n void operator = (const SSEAllocator&);\n\n};\n\ntemplate<> class SSEAllocator<void> {\n typedef void value_type;\n typedef void *pointer;\n typedef const void *const_pointer;\n\n template <class U>\n struct rebind { typedef SSEAllocator<U> other; };\n};\n\n\ntemplate <class T>\ninline bool operator == (const SSEAllocator<T>&, const SSEAllocator<T>&)\n{ return true; }\n\ntemplate <class T>\ninline bool operator != (const SSEAllocator<T>&, const SSEAllocator<T>&)\n{ return false; }\n" }, { "alpha_fraction": 0.6417359113693237, "alphanum_fraction": 0.6666666865348816, "avg_line_length": 36.344825744628906, "blob_id": "b0709a5f62a4ab9ed3a27570caf093ef8ee79ac4", "content_id": "eb78c8f54afa3e1badc710d31306333b1b1ec8bf", "detected_licenses": [ "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer", "MIT" ], "is_generated": false, "is_vendor": false, "language": "C", "length_bytes": 1083, "license_type": "permissive", "max_line_length": 74, "num_lines": 29, "path": "/dependencies/quex-0.34.1/quex/code_base/compatibility/stdbool.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* PURPOSE: This header defines standard bool data types for use\n * in plain 'C' lexical analyser engines. This is done\n * here, in wise prediction that some compiler distributions\n * may not provide this standard header. For the standard\n * reference, please review: \"The Open Group Base Specifications \n * Issue 6, IEEE Std 1003.1, 2004 Edition\".\n *\n * (C) 2008 Frank-Rene Schaefer */ \n#ifndef __INCLUDE_GUARD_QUEX__CODE_BASE__COMPATIBILITY_STDBOOL_H__\n#define __INCLUDE_GUARD_QUEX__CODE_BASE__COMPATIBILITY_STDBOOL_H__\n\n#if defined(__QUEX_SETTING_PLAIN_C)\n\n#define bool _Bool\n\n/* Some compilers (I guess compilers build towards C89) do not\n * even provide the __STDC_VERSION__ macro. C99, though requires\n * the _Bool type to be there. */\n#if ! defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L\ntypedef int _Bool;\n#endif\n\n#define true ((int)(1))\n#define false ((int)(1))\n\n#define __bool_true_false_are_defined ((int)(1))\n\n#endif /* __QUEX_SETTING_PLAIN_C */\n#endif /* __INCLUDE_GUARD_QUEX__CODE_BASE__COMPATIBILITY_STDBOOL_H__ */\n" }, { "alpha_fraction": 0.5591939687728882, "alphanum_fraction": 0.5591939687728882, "avg_line_length": 35.75925827026367, "blob_id": "d36c60841f5082678eac7906430b2a76689fd00e", "content_id": "f0eeabe662face9fcf78a50f33ee933a63539f42", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Makefile", "length_bytes": 1985, "license_type": "permissive", "max_line_length": 89, "num_lines": 54, "path": "/dependencies/quex-0.34.1/demo/009/Makefile", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "# PURPOSE: Makefile Demo Application of Quex\n#\n# ABSOLUTELY NO WARRANTY\n#_______________________________________________________________________________\n.PHONY: clean\n\nifndef QUEX_PATH\n $(error The environment variable QUEX_PATH is not defined!)\nendif\n\ninclude $(QUEX_PATH)/quex/code_base/core.mkd\n\n# (*) SETUP ____________________________________________________________________\nSOURCES = tiny_lexer tiny_lexer.cpp tiny_lexer-token_ids tiny_lexer-core-engine.cpp\nWSOURCES = tiny_wlexer tiny_wlexer.cpp tiny_wlexer-token_ids tiny_wlexer-core-engine.cpp \n# (*) COMPILER SETTINGS ________________________________________________________\n# (change COMPILER to whatever you use as compiler on the command line,\n# e.g. \"make COMPILER=icpc\" will use intel's c++ compiler)\nCOMPILER = g++ -ggdb -Wall -pedantic -DQUEX_OPTION_NO_COMPUTED_GOTOS\nCC = $(COMPILER) -c -I./ -I$(QUEX_PATH) $(NDEBUG_F) -DQUEX_OPTION_ASSERTS\nLD = $(COMPILER) \n\n# (*) RULES ____________________________________________________________________\nall: lexer stdinlexer wlexer\n\n# -- char application\nlexer: lexer.o tiny_lexer.o tiny_lexer-core-engine.o\n\t$(LD) -o $@ lexer.o tiny_lexer.o tiny_lexer-core-engine.o \n \nstdinlexer: stdinlexer.o tiny_lexer.o tiny_lexer-core-engine.o\n\t$(LD) -o $@ stdinlexer.o tiny_lexer.o tiny_lexer-core-engine.o \n \n$(SOURCES): simple.qx $(QUEX_CORE)\n\tquex -i simple.qx --engine tiny_lexer # CERTAINLY NOT: \"-b wchar_t\" \n\n# -- wchar_t application\nwlexer: wlexer.o tiny_wlexer.o tiny_wlexer-core-engine.o\n\t$(LD) -o $@ wlexer.o tiny_wlexer.o tiny_wlexer-core-engine.o \n \n$(WSOURCES): simple.qx $(QUEX_CORE)\n\tquex -i simple.qx --engine tiny_wlexer -b wchar_t \n\n# -- The general way to get .o from .cpp\n%.o: %.cpp $(SOURCES) $(WSOURCES)\n\t$(CC) $< -o $@ \n\n# (*) HELPERS __________________________________________________________________\nclean:\t\n\ttouch simple.qx\n\trm -f $(SOURCES)\n\trm -f $(WSOURCES)\n\trm -f *.o\n\trm -f lexer stdinlexer wlexer\n\trm -f *.bak\n" }, { "alpha_fraction": 0.44376450777053833, "alphanum_fraction": 0.4467187225818634, "avg_line_length": 25.176795959472656, "blob_id": "2a48b8e5b60c1eb0dbd8caa9727c4d67a7612655", "content_id": "02efc89a48a9a60b29f044683ab6f6ffa205e11a", "detected_licenses": [ "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer", "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 4739, "license_type": "permissive", "max_line_length": 87, "num_lines": 181, "path": "/dependencies/quex-0.34.1/demo/004/c.qx", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "// -*- C++ -*- vim: set syntax=cpp:\nstart = PROGRAM;\n\ndefine {\n // Pattern definitions for example application\n P_WHITESPACE [ \\t\\n]+\n P_IDENTIFIER [_a-zA-Z][_a-zA-Z0-9]*\n P_NUMBER [0-9]+\n //\n // String: \n // Quote \" followe by either \\\" or something different from \" and then a final \"\n P_STRING \"\\\"\"(\\\\\"\\\"\"|[^\"])*\"\\\"\"\n P_QUOTED_CHAR_1 (\"'\\\\''\")|(\"'\"[^']?\"'\")\n P_QUOTED_CHAR_2 \"'\\\\\"[0-9abcfnrtv\\\\]\"'\"\n P_QUOTED_CHAR ({P_QUOTED_CHAR_1}|{P_QUOTED_CHAR_2})\n P_INCLUDE_FILE1 \"<\"[^>]+\">\"\n P_INCLUDE_FILE2 \"\\\"\"[^\"]+\"\\\"\"\n}\n\ntoken {\n AMPERSANT\n AND\n ASSIGN_DIV\n ASSIGN_MINUS\n ASSIGN_MULT\n ASSIGN_PLUS\n BACKLASHED_NEWLINE\n BRACKET_C\n BRACKET_C\n BRACKET_O\n BRACKET_O\n BREAK\n CATCH\n CLASS\n COLON\n COMMA\n COMMENT\n CONST\n CONTINUE\n CORNER_BRACKET_C\n CORNER_BRACKET_O\n CURLY_BRACKET_C\n CURLY_BRACKET_O\n DIV\n DO\n DOT\n DOUBLE_COLON\n DOUBLE_HASH\n ELSE\n EQ\n EXCLUSIVE_OR\n FOR\n GREATER\n GR_EQ\n HASH\n IDENTIFIER\n IF\n LESS\n LE_EQ\n LOGICAL_OR\n MINUS\n MODULO\n MULT\n NOT\n NOT_EQ\n NUMBER\n OP_ASSIGNMENT\n OR\n PLUS\n PP_DEFINE\n PP_DEFINED\n PP_ELSE\n PP_ENDIF\n PP_ERROR\n PP_ELIF\n PP_IF\n PP_IFDEF\n PP_IFNDEF\n PP_INCLUDE\n PP_PRAGMA\n QUESTION_MARK\n QUOTE\n QUOTED_CHAR\n SEMICOLON\n STRING\n STRUCT\n SWITCH\n TILDE\n TYPE_CHAR\n TYPE_DOUBLE\n TYPE_FLOAT\n TYPE_INT\n TYPE_LONG\n TYPE_UNSIGNED\n WHILE\n}\n\nmode PROGRAM :\n<skip: [ \\n\\t]>\n<skip_range: \"/*\" \"*/\">\n<skip_range: \"//\" \"\\n\">\n{\n <<EOF>> => QUEX_TKN_TERMINATION;\n\n \"#\"[ \\t]*\"include\"[ \\t]*{P_INCLUDE_FILE2} => QUEX_TKN_PP_INCLUDE;\n \"#\"[ \\t]*\"include\"[ \\t]*{P_INCLUDE_FILE1} => QUEX_TKN_PP_INCLUDE;\n \"#\"[ \\t]*\"define\" => QUEX_TKN_PP_DEFINE;\n \"#\"[ \\t]*\"if\" => QUEX_TKN_PP_IF;\n \"#\"[ \\t]*\"elif\" => QUEX_TKN_PP_ELIF;\n \"#\"[ \\t]*\"ifdef\" => QUEX_TKN_PP_IFDEF;\n \"#\"[ \\t]*\"ifndef\" => QUEX_TKN_PP_IFNDEF;\n \"#\"[ \\t]*\"endif\" => QUEX_TKN_PP_ENDIF;\n \"#\"[ \\t]*\"else\" => QUEX_TKN_PP_ELSE;\n \"#\"[ \\t]*\"pragma\" => QUEX_TKN_PP_PRAGMA;\n \"#\"[ \\t]*\"error\" => QUEX_TKN_PP_ERROR;\n defined => QUEX_TKN_PP_DEFINED;\n \"\\\\\\n\" => QUEX_TKN_BACKLASHED_NEWLINE;\n\n unsigned => QUEX_TKN_TYPE_UNSIGNED;\n int => QUEX_TKN_TYPE_INT;\n long => QUEX_TKN_TYPE_LONG;\n float => QUEX_TKN_TYPE_FLOAT;\n double => QUEX_TKN_TYPE_DOUBLE;\n char => QUEX_TKN_TYPE_CHAR;\n\n \"#\" => QUEX_TKN_HASH;\n \"##\" => QUEX_TKN_DOUBLE_HASH;\n \"?\" => QUEX_TKN_QUESTION_MARK;\n \"~\" => QUEX_TKN_TILDE;\n \"(\" => QUEX_TKN_BRACKET_O;\n \")\" => QUEX_TKN_BRACKET_C;\n \"[\" => QUEX_TKN_CORNER_BRACKET_O;\n \"]\" => QUEX_TKN_CORNER_BRACKET_C;\n \"{\" => QUEX_TKN_CURLY_BRACKET_O;\n \"}\" => QUEX_TKN_CURLY_BRACKET_C;\n \"=\" => QUEX_TKN_OP_ASSIGNMENT;\n \"+\" => QUEX_TKN_PLUS;\n \"-\" => QUEX_TKN_MINUS;\n \"*\" => QUEX_TKN_MULT;\n \"/\" => QUEX_TKN_DIV;\n \"%\" => QUEX_TKN_MODULO;\n \"+=\" => QUEX_TKN_ASSIGN_PLUS;\n \"-=\" => QUEX_TKN_ASSIGN_MINUS;\n \"*=\" => QUEX_TKN_ASSIGN_MULT;\n \"/=\" => QUEX_TKN_ASSIGN_DIV;\n \"==\" => QUEX_TKN_EQ;\n \"!=\" => QUEX_TKN_NOT_EQ;\n \">\" => QUEX_TKN_GREATER;\n \">=\" => QUEX_TKN_GR_EQ;\n \"<\" => QUEX_TKN_LESS;\n \"<=\" => QUEX_TKN_LE_EQ;\n \"!\" => QUEX_TKN_NOT;\n \"|\" => QUEX_TKN_LOGICAL_OR;\n \"^\" => QUEX_TKN_EXCLUSIVE_OR;\n \"||\" => QUEX_TKN_OR;\n \"&\" => QUEX_TKN_AMPERSANT;\n \"&&\" => QUEX_TKN_AND;\n \":\" => QUEX_TKN_COLON;\n struct => QUEX_TKN_STRUCT;\n const => QUEX_TKN_CONST;\n if => QUEX_TKN_IF;\n else => QUEX_TKN_ELSE;\n switch => QUEX_TKN_SWITCH;\n for => QUEX_TKN_FOR;\n do => QUEX_TKN_DO;\n while => QUEX_TKN_WHILE;\n break => QUEX_TKN_BREAK;\n continue => QUEX_TKN_CONTINUE;\n \";\" => QUEX_TKN_SEMICOLON;\n \".\" => QUEX_TKN_DOT;\n \",\" => QUEX_TKN_COMMA;\n\n {P_IDENTIFIER} => QUEX_TKN_IDENTIFIER;\n {P_NUMBER} => QUEX_TKN_NUMBER;\n {P_STRING} => QUEX_TKN_STRING;\n {P_QUOTED_CHAR} => QUEX_TKN_QUOTED_CHAR;\n\n // {P_WHITESPACE} { }\n //\"/*\"([^*]|(\"*\"[^/]))*\"*/\" { } // => QUEX_TKN_COMMENT;\n // \"//\"[^\\n]*\"\\n\" { } // => QUEX_TKN_COMMENT;\n}\n\n" }, { "alpha_fraction": 0.7053104043006897, "alphanum_fraction": 0.7120419144630432, "avg_line_length": 31.216867446899414, "blob_id": "6c1c40c754384d1e79a01ba8644d50da21eff494", "content_id": "9a7b0b1264cab6e002c7d4d0a41e0ba9bab1d69c", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 2674, "license_type": "permissive", "max_line_length": 80, "num_lines": 83, "path": "/engine/gfx/gfx_sprite_body.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\nclass GfxSpriteBody;\ntypedef SharedPtr<GfxSpriteBody> GfxSpriteBodyPtr;\n\n#ifndef GFX_SPRITE_BODY_H\n#define GFX_SPRITE_BODY_H\n\n#include \"gfx_fertile_node.h\"\n#include \"gfx_particle_system.h\"\n\nclass GfxSpriteBody : public GfxNode {\n protected:\n static const std::string className;\n bool enabled;\n // Particle's alpha is managed to be the product of these.\n float fade;\n float alpha;\n GfxParticle * const particle;\n\n GfxSpriteBody (const std::string &particle_name, const GfxNodePtr &par_);\n ~GfxSpriteBody ();\n\n public:\n static GfxSpriteBodyPtr make (const std::string &particle_name,\n const GfxNodePtr &par_=GfxNodePtr(NULL))\n { return GfxSpriteBodyPtr(new GfxSpriteBody(particle_name, par_)); }\n \n Vector3 getDiffuse (void) const;\n void setDiffuse (const Vector3 &v);\n\n Vector3 getEmissive (void) const;\n void setEmissive (const Vector3 &v);\n\n Vector3 getDimensions (void) const;\n void setDimensions (const Vector3 &v);\n\n bool isEnabled (void) const;\n void setEnabled (bool v);\n\n float getAngle (void) const;\n void setAngle (float f);\n\n float getFade (void) const;\n void setFade (float f);\n\n float getAlpha (void) const;\n void setAlpha (float f);\n\n Vector2 getUV1 (void) const;\n void setUV1 (const Vector2 &v);\n\n Vector2 getUV2 (void) const;\n void setUV2 (const Vector2 &v);\n\n // Update particle position, float\n void update (void);\n\n void destroy (void);\n\n friend class SharedPtr<GfxSpriteBody>;\n};\n\n#endif\n" }, { "alpha_fraction": 0.6138613820075989, "alphanum_fraction": 0.6138613820075989, "avg_line_length": 27.714284896850586, "blob_id": "a586dec4d52afe49679eb64627d3169856f3c1b7", "content_id": "d03a1432425f947d914809609079c24ccaea7eee", "detected_licenses": [ "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer", "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 202, "license_type": "permissive", "max_line_length": 44, "num_lines": 7, "path": "/dependencies/quex-0.34.1/quex/exception.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "class RegularExpressionException(Exception):\n def __init__(self, InfoStr):\n self.message = InfoStr\n\n def __repr__(self):\n txt = \"QuexException:\\n\"\n return txt + self.message\n\n" }, { "alpha_fraction": 0.6376842856407166, "alphanum_fraction": 0.645706832408905, "avg_line_length": 30.799999237060547, "blob_id": "7857db0bce3ab7b78308ce2aa51c97fc1062bb75", "content_id": "9dad4f372b71100300119092af0dbb468ac7ac1e", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 4612, "license_type": "permissive", "max_line_length": 101, "num_lines": 145, "path": "/engine/gfx/gfx_ranged_instances.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <algorithm>\n\n#include \"../main.h\"\n\n#include \"gfx_internal.h\"\n#include \"gfx_ranged_instances.h\"\n\nconst std::string GfxRangedInstances::className = \"GfxRangedInstances\";\n\nGfxRangedInstancesPtr GfxRangedInstances::make (const std::string &mesh_name, const GfxNodePtr &par_)\n{ \n auto gdr = disk_resource_use<GfxMeshDiskResource>(mesh_name);\n \n if (gdr == nullptr) GRIT_EXCEPT(\"Resource is not a mesh: \\\"\" + mesh_name + \"\\\"\");\n\n return GfxRangedInstancesPtr(new GfxRangedInstances(gdr, par_));\n}\n\nGfxRangedInstances::GfxRangedInstances (const DiskResourcePtr<GfxMeshDiskResource> &gdr,\n const GfxNodePtr &par_)\n : GfxInstances(gdr, par_),\n mItemRenderingDistance(40),\n mVisibility(1),\n mStepSize(100000)\n{ \n registerMe();\n} \n\nGfxRangedInstances::~GfxRangedInstances (void)\n{\n unregisterMe();\n}\n\nvoid GfxRangedInstances::registerMe (void)\n{\n streamer_callback_register(this);\n}\n\nvoid GfxRangedInstances::unregisterMe (void)\n{\n streamer_callback_unregister(this);\n}\n\nvoid GfxRangedInstances::update (const Vector3 &new_pos)\n{\n const float vis2 = mVisibility * mVisibility;\n typedef Cargo::iterator I;\n\n // iterate through all activated guys to see who is too far to stay activated\n Cargo victims = activated;\n for (I i=victims.begin(), i_=victims.end() ; i!=i_ ; ++i) {\n Item *o = *i;\n //note we use vis2 not visibility\n float range2 = o->range2(new_pos) / vis2;\n\n if (range2 > 1) {\n // now out of range\n del(o->ticket);\n o->activated = false;\n Item *filler = activated[activated.size()-1];\n activated[o->activatedIndex] = filler;\n filler->activatedIndex = o->activatedIndex;\n activated.pop_back();\n } else {\n // still in range, update visibility\n float fade = o->calcFade(range2);\n if (fade!=o->lastFade) {\n update(o->ticket, o->pos, o->quat, fade);\n o->lastFade = fade;\n }\n }\n }\n\n Cargo cargo;\n mSpace.getPresent(new_pos.x, new_pos.y, new_pos.z, mStepSize, mVisibility, cargo);\n // iterate through the cargo to see who needs to become activated\n for (Cargo::iterator i=cargo.begin(),i_=cargo.end() ; i!=i_ ; ++i) {\n Item *o = *i;\n\n if (o->activated) continue;\n\n float range2 = o->range2(new_pos) / vis2;\n\n // not in range yet\n if (range2 > 1) continue;\n\n float fade = o->calcFade(range2);\n o->lastFade = fade;\n\n //activate o\n o->ticket = add(o->pos, o->quat, fade);\n o->activatedIndex = activated.size();\n activated.push_back(o);\n o->activated = true;\n }\n}\n\nvoid GfxRangedInstances::push_back (const SimpleTransform &t)\n{\n // it is very important that the number of samples does not increase over time, or\n // the vector will resize and these pointers will become invalid\n items.push_back(Item());\n Item &item = items[items.size()-1];\n item.parent = this;\n item.activated = false;\n item.quat = t.quat;\n item.lastFade = 0;\n mSpace.add(&item);\n item.updateSphere(t.pos, mItemRenderingDistance);\n}\n\nfloat GfxRangedInstances::Item::calcFade (float range2)\n{\n const float out = streamer_fade_out_factor;\n float range = ::sqrtf(range2);\n\n float fade = 1.0;\n\n if (range > out) {\n fade = (1-range) / (1-out);\n }\n\n return fade;\n}\n\n" }, { "alpha_fraction": 0.6522231698036194, "alphanum_fraction": 0.6536391973495483, "avg_line_length": 30.810810089111328, "blob_id": "ca2ee0d1539929eee6506ac2eaab74ae36723a3c", "content_id": "26fdca85aa2cb246470288ee9b38acb38aa2b08f", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 3531, "license_type": "permissive", "max_line_length": 86, "num_lines": 111, "path": "/engine/lua_ptr.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#ifndef LuaPtr_h\n#define LuaPtr_h\n\nextern \"C\" {\n #include \"lua.h\"\n #include <lauxlib.h>\n #include <lualib.h>\n}\n\n#include <centralised_log.h>\n\n/** A smart pointer that holds a pointer to an object on the lua heap. The\n * smarts here are to do with ensuring lua GC works correctly, using the Lua\n * registry.\n */\nclass LuaPtr {\n\n public:\n\n /** The pointer initially points to nil */\n LuaPtr (void)\n {\n ptr = LUA_REFNIL;\n }\n\n bool isNil (void) const { return ptr == LUA_REFNIL; }\n\n /** Make this pointer point to whatever is at the top of the Lua stack,\n * and pops the stack.\n */\n void set (lua_State *L)\n {\n luaL_unref(L, LUA_REGISTRYINDEX, ptr);\n ptr = luaL_ref(L, LUA_REGISTRYINDEX);\n }\n\n /** Just like set(L), but does not pop the stack. */\n void setNoPop (lua_State *L, int index=-1)\n {\n lua_pushvalue(L, index);\n set(L);\n }\n\n /** Leak the Lua object. It will never be garbage collected. The one case\n * where this is a good idea is just after lua_close is called. If something\n * is so fundamental that it can't be removed from the registry before\n * lua_close is called (e.g. because garbage collection metamethods may try to\n * use it during the lua_close call), then one can simply let Lua clean up the\n * metatable. At this point, we need to not call luaL_ref on the closed state,\n * in fact there is no cleanup to do, so we simply unlink it and walk away.\n * The only real effect of this is disabling the error message in the LuaPtr\n * destructor.\n */\n void leak (void)\n {\n ptr = LUA_REFNIL;\n }\n\n /** Make this pointer point to nil.\n */\n void setNil (lua_State *L)\n {\n luaL_unref(L, LUA_REGISTRYINDEX, ptr);\n ptr = LUA_REFNIL;\n }\n\n /** The pointer must be destroyed properly (with a lua_State*) before\n * allowing it do be destructed. Otherwise the lua memory leaks.\n */\n ~LuaPtr (void)\n {\n if (!isNil())\n CERR << \"LuaPtr was not shut down properly (call setNil()).\" << std::endl;\n }\n\n /** Push the lua object on the top of the lua stack.\n */\n void push (lua_State *L) const\n {\n lua_rawgeti(L, LUA_REGISTRYINDEX, ptr);\n }\n\n protected:\n\n /** The location of the lua object in the lua registry.\n */\n int ptr;\n};\n\n#endif\n" }, { "alpha_fraction": 0.6459781527519226, "alphanum_fraction": 0.6506951451301575, "avg_line_length": 28.617647171020508, "blob_id": "3899896119a26a0b8df430c0abe93cdab4e40896", "content_id": "2edfe512f9ab2c8d72ea65ffa6be027a1bf6651a", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 4028, "license_type": "permissive", "max_line_length": 128, "num_lines": 136, "path": "/engine/doc/grit_book/convert_web.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "#!/usr/bin/python\n\nimport codecs\nimport re\nfrom shutil import copyfile\n\nimport lxml.etree as ET\n\nfrom translate_xml import *\nfrom unparse_html import *\nfrom unparse_markdown import *\n\n\n# libxml2 does not properly implement the XML standard, so do my own implementation here...\ndef MyXInclude(tree):\n for n in tree:\n if n.tag == 'include':\n src = 'xml/' + n.get('src')\n print 'Parsing ' + src\n include_tree = ET.parse(src)\n include_tree.getroot().set('{http://www.w3.org/XML/1998/namespace}base', src)\n MyXInclude(include_tree.getroot())\n tree.replace(n, include_tree.getroot())\n else:\n MyXInclude(n)\n\n\n_ID_REGEX = re.compile(\"^[_a-z0-9]+$\")\n\nID_MAP = {}\n\n# Ensure no two ids are the same\ndef CheckDupIds(node):\n nid = node.get('id')\n if node.tag == 'section':\n if not nid:\n Error(node, 'Section must have id attribute.')\n if not _ID_REGEX.match(nid):\n Error(node, 'Section id uses invalid characters.')\n existing = ID_MAP.get(nid)\n if existing is not None:\n Error(node, 'Section id already exists: %s. The other exists at %s:%d' % (nid, existing.base, existing.sourceline))\n ID_MAP[nid] = node\n elif node.tag in ['issue', 'sref']:\n pass\n else:\n if nid:\n Error(node, 'Only section tags can have id attribute.')\n for child in node:\n CheckDupIds(child)\n\n# Ensure ids are not dangling\ndef CheckRefIds(node):\n if node.tag == 'sref':\n nid = node.get('id')\n if not nid:\n Error(node, 'sref must have id attribute.')\n if ID_MAP.get(nid) is None:\n Error(node, 'Referenced section id does not exist: ' + nid)\n for child in node:\n CheckRefIds(child)\n\n\nprint 'Parsing xml/index.xml'\ntree = ET.parse('xml/index.xml')\nMyXInclude(tree.getroot())\nbook = tree.getroot()\n\nCheckDupIds(book)\nCheckRefIds(book)\nAssertTag(book, 'book')\n\nprint 'Translating XML dom...'\nbook_ast = Node('Book', None, split=True, data=False)\nbook_ast.data = TranslateBlockContents(book, book_ast)\nResolveReferences(book_ast)\n\n# Fetch all images\ndef GetImgSrcs(ast):\n if ast is None:\n return []\n if isinstance(ast, basestring):\n return []\n if isinstance(ast, list):\n return [s for child in ast for s in GetImgSrcs(child)]\n if ast.kind == 'Image':\n return [ast.src]\n return GetImgSrcs(ast.data)\n\nall_imgs = GetImgSrcs(book_ast)\nprint all_imgs\n\n# Web .html\nprint 'Writing html/index.html'\nindex = '<h1> Contents </h1>\\n'\nindex += UnparseHtmlBlocks(book_ast, book_ast, True, False)\ncontents = codecs.open('html/index.html', 'w', 'utf-8')\ncontents.write(GeneratePage('Contents', index, book_ast))\ncontents.close()\npygments_css = codecs.open('html/pygments.css', 'w', 'utf-8')\npygments_css.write(HtmlFormatter().get_style_defs('.highlight'))\npygments_css.close()\n\nprint 'Writing html/complete.html'\nindex = UnparseHtmlBlocks(book_ast, book_ast, True, True)\ncontents = codecs.open('html/complete.html', 'w', 'utf-8')\ncontents.write(GeneratePage('&copy; 2016 Grit Engine Community.', index, None))\ncontents.close()\n\nprint 'Copyimg images to html'\nfor img in all_imgs:\n copyfile('xml/' + img, 'html/' + img)\n copyfile('xml/thumb_' + img, 'html/thumb_' + img)\n\nprint 'Copyimg images to md'\nfor img in all_imgs:\n copyfile('xml/' + img, 'md/' + img)\n\n# Markdown .md\nprint 'Writing md/index.md'\nindex = '# Contents\\n'\nindex += UnparseMarkdownBlocks(book_ast, book_ast, True, False)\ncontents = codecs.open('md/index.md', 'w', 'utf-8')\ncontents.write(UnparseMarkdownGeneratePage('Contents', index, book_ast))\ncontents.close()\n\nprint 'Writing md/complete.md'\nindex = UnparseMarkdownBlocks(book_ast, book_ast, True, True)\ncontents = codecs.open('md/complete.md', 'w', 'utf-8')\ncontents.write(UnparseMarkdownGeneratePage('Contents', index, None))\ncontents.close()\n\n# Main README.md from Compiling Instruction\ncopyfile('md/README.md', '../../../README.md')\n\nprint 'Done.'\n" }, { "alpha_fraction": 0.6428571343421936, "alphanum_fraction": 0.6746031641960144, "avg_line_length": 30.5, "blob_id": "3f5f4f5708c7702a393320712137f266ffcafcff", "content_id": "963ec0869885e2af70a7845256e6cbebbf25d5dc", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Shell", "length_bytes": 126, "license_type": "permissive", "max_line_length": 61, "num_lines": 4, "path": "/engine/physics/build_lexer.sh", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "#!/bin/bash\n\nexport QUEX_PATH=../../../dependencies/quex-0.34.1\n${QUEX_PATH}/quex-exe.py -i tcol_lexer.qx --engine tcol_lexer\n" }, { "alpha_fraction": 0.7058406472206116, "alphanum_fraction": 0.7082506418228149, "avg_line_length": 31.809301376342773, "blob_id": "ecb45c3c0783636610af280dc191e512f727b73f", "content_id": "365a083735429ea9511b3814df8aaf0be21bf947", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 7054, "license_type": "permissive", "max_line_length": 100, "num_lines": 215, "path": "/engine/gfx/gfx_body.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include \"../shared_ptr.h\"\n\nclass GfxBody;\ntypedef SharedPtr<GfxBody> GfxBodyPtr;\n\n#ifndef GfxBody_h\n#define GfxBody_h\n\n#include \"gfx_fertile_node.h\"\n#include \"gfx_material.h\"\n\n// Must extend Ogre::MovableObject so that we can become attached to a node and\n// rendered by the regular Ogre scenemanager-based pipeline.\nclass GfxBody : public GfxFertileNode, public Ogre::MovableObject {\n\n protected:\n\n class Sub : public Ogre::Renderable {\n\n protected:\n\n GfxBody *parent;\n\n\n Ogre::SubMesh *subMesh;\n\n public:\n\n Sub (GfxBody *parent, Ogre::SubMesh *sub_mesh)\n : Renderable(), parent(parent), subMesh(sub_mesh), material(NULL), emissiveEnabled(true)\n { }\n ~Sub() { }\n\n Ogre::SubMesh* getSubMesh(void) const { return subMesh; }\n\n GfxMaterial *material;\n bool emissiveEnabled;\n\n const Ogre::MaterialPtr& getMaterial(void) const;\n\n\n void getRenderOperation(Ogre::RenderOperation& op)\n { subMesh->_getRenderOperation(op, 0); }\n\n void getWorldTransforms(Ogre::Matrix4* xform) const;\n unsigned short getNumWorldTransforms(void) const;\n Ogre::Real getSquaredViewDepth(const Ogre::Camera* cam) const;\n const Ogre::LightList& getLights(void) const;\n\n bool getCastShadows(void) const;\n\n };\n\n\n const Ogre::AxisAlignedBox& getBoundingBox (void) const;\n float getBoundingRadius (void) const;\n\n void _updateRenderQueue (Ogre::RenderQueue* queue);\n void visitRenderables (Ogre::Renderable::Visitor* visitor, bool debugRenderables = false);\n\n const std::string& getMovableType (void) const { return className; }\n\n typedef std::vector<Sub*> SubList;\n SubList subList;\n\n protected:\n Ogre::SkeletonInstance* skeleton;\n Ogre::AnimationStateSet animationState;\n Ogre::Matrix4 *boneWorldMatrixes;\n Ogre::Matrix4 *boneMatrixes;\n unsigned short numBoneMatrixes;\n \n\n\n protected:\n static const std::string className;\n public: // HACK\n Ogre::MeshPtr mesh;\n protected:\n float fade;\n // Hack to pass material into queue->addRenderable\n Ogre::MaterialPtr renderMaterial;\n GfxPaintColour colours[4];\n bool enabled;\n bool castShadows;\n bool wireframe;\n bool firstPerson;\n std::vector<bool> manualBones;\n GfxStringMap initialMaterialMap;\n const DiskResourcePtr<GfxMeshDiskResource> gdr;\n\n GfxBody (const DiskResourcePtr<GfxMeshDiskResource> &gdr,\n const GfxStringMap &sm, const GfxNodePtr &par_);\n ~GfxBody ();\n\n\n public:\n static GfxBodyPtr make (const std::string &mesh_name,\n const GfxStringMap &sm=gfx_empty_string_map,\n const GfxNodePtr &par_=GfxNodePtr(NULL));\n\n GfxMaterial *getMaterial (unsigned i);\n const std::string &getOriginalMaterialName (unsigned i);\n unsigned getSubMeshByOriginalMaterialName (const std::string &n);\n void setMaterial (unsigned i, GfxMaterial *m);\n bool getEmissiveEnabled (unsigned i);\n void setEmissiveEnabled (unsigned i, bool v);\n unsigned getNumSubMeshes (void) { return subList.size(); }\n\n protected:\n void destroyGraphics (void);\n void updateBones (void);\n void checkBone (unsigned n) const;\n Ogre::AnimationState *getAnimState (const std::string &name);\n public:\n void reinitialise (void);\n\n void renderFirstPerson (const GfxShaderGlobals &p, bool alpha_blend);\n\n unsigned getBatches (void) const;\n unsigned getBatchesWithChildren (void) const;\n\n unsigned getTriangles (void) const;\n unsigned getTrianglesWithChildren (void) const;\n\n unsigned getVertexes (void) const;\n unsigned getVertexesWithChildren (void) const;\n\n float getFade (void);\n void setFade (float f);\n\n bool getCastShadows (void);\n void setCastShadows (bool v);\n\n bool getWireframe (void);\n void setWireframe (bool v);\n\n bool getFirstPerson (void);\n void setFirstPerson (bool v);\n\n GfxPaintColour getPaintColour (int i);\n void setPaintColour (int i, const GfxPaintColour &c);\n\n unsigned getNumBones (void) const;\n bool hasBones (void) const { if (dead) THROW_DEAD(className); return skeleton != NULL; }\n bool hasBoneName (const std::string name) const;\n unsigned getBoneId (const std::string name) const;\n const std::string &getBoneName (unsigned n) const;\n\n bool getBoneManuallyControlled (unsigned n);\n void setBoneManuallyControlled (unsigned n, bool v);\n void setAllBonesManuallyControlled (bool v);\n\n Vector3 getBoneInitialPosition (unsigned n);\n Vector3 getBoneWorldPosition (unsigned n);\n Vector3 getBoneLocalPosition (unsigned n);\n Quaternion getBoneInitialOrientation (unsigned n);\n Quaternion getBoneWorldOrientation (unsigned n);\n Quaternion getBoneLocalOrientation (unsigned n);\n Vector3 getBoneInitialScale (unsigned n);\n Vector3 getBoneWorldScale (unsigned n);\n Vector3 getBoneLocalScale (unsigned n);\n\n Transform getBoneWorldTransform (unsigned n);\n\n void setBoneLocalPosition (unsigned n, const Vector3 &v);\n void setBoneLocalOrientation (unsigned n, const Quaternion &v);\n void setBoneLocalScale (unsigned n, const Vector3 &v);\n\n void updateBoneMatrixes (void);\n\n std::vector<std::string> getAnimationNames (void);\n float getAnimationLength (const std::string &name);\n float getAnimationPos (const std::string &name);\n void setAnimationPos (const std::string &name, float v);\n float getAnimationMask (const std::string &name);\n void setAnimationMask (const std::string &name, float v);\n\n bool isEnabled (void);\n void setEnabled (bool v);\n\n void destroy (void);\n\n bool hasGraphics (void) const { return true; }\n\n std::string getMeshName (void) const;\n\n friend class SharedPtr<GfxBody>;\n friend class GfxMeshDiskResource;\n};\n\n// called every frame\nvoid gfx_body_render_first_person (GfxPipeline *p, bool alpha_blend);\n#endif\n" }, { "alpha_fraction": 0.6962156295776367, "alphanum_fraction": 0.6993260979652405, "avg_line_length": 34.07272720336914, "blob_id": "fdce37f9a7ec587982ef8a641c96e6632bed1ddd", "content_id": "8982c3ef2dba8e9020a808f71d902ab1c620d82a", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 1929, "license_type": "permissive", "max_line_length": 80, "num_lines": 55, "path": "/gtasa/iplread.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#ifndef IPLREAD_H\n#define IPLREAD_H\n\n#include <string>\n#include <vector>\n\nstruct Inst {\n unsigned long id;\n std::string dff;\n unsigned long interior;\n double x,y,z, rx,ry,rz,rw;\n long near_for;\n bool is_low_detail;\n};\n\ntypedef std::vector<struct Inst> Insts;\n\nclass IPL {\n public:\n virtual void addMore (std::istream &f);\n virtual const Insts &getInsts (void) const { return insts; }\n virtual const std::string &getName (void) const { return name; }\n virtual void setName (const std::string &v) { name = v; }\n protected:\n virtual void addText (std::istream &f);\n virtual void addBinary (std::istream &f);\n Insts insts;\n std::string name;\n};\n\n#endif\n\n\n// vim: shiftwidth=8:tabstop=8:expandtab\n" }, { "alpha_fraction": 0.6097051501274109, "alphanum_fraction": 0.6122108101844788, "avg_line_length": 40.86014175415039, "blob_id": "6f1a00e33e718030880d2126fb484520c3d7c3d6", "content_id": "f9ce4432ebff99d7da714def713fb1413add2a14", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 11973, "license_type": "permissive", "max_line_length": 117, "num_lines": 286, "path": "/dependencies/quex-0.34.1/quex/input/mode_definition.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "from quex.frs_py.file_in import *\nfrom quex.token_id_maker import TokenInfo\nfrom quex.exception import RegularExpressionException\nimport quex.lexer_mode as lexer_mode\nimport quex.input.regular_expression as regular_expression\nimport quex.input.code_fragment as code_fragment\nfrom quex.core_engine.generator.action_info import CodeFragment\nfrom quex.core_engine.generator.skip_code import create_skip_code, create_skip_range_code\nimport quex.core_engine.state_machine.index as index\nfrom quex.core_engine.state_machine.core import StateMachine\nimport quex.core_engine.regular_expression.snap_character_string as snap_character_string\nfrom quex.input.setup import setup as Setup\n\ndef parse(fh, Setup):\n # NOTE: Catching of EOF happens in caller: parse_section(...)\n\n skip_whitespace(fh)\n mode_name = read_identifier(fh)\n if mode_name == \"\":\n error_msg(\"missing identifier at beginning of mode definition.\", fh)\n\n # NOTE: constructor does register this mode in the mode_db\n new_mode = lexer_mode.LexMode(mode_name, fh.name, get_current_line_info_number(fh))\n\n # (*) inherited modes / options\n skip_whitespace(fh)\n dummy = fh.read(1)\n if dummy not in [\":\", \"{\"]:\n error_msg(\"missing ':' or '{' after mode '%s'\" % mode_name, fh)\n\n if dummy == \":\":\n parse_mode_option_list(new_mode, fh)\n\n # (*) read in pattern-action pairs and events\n while parse_mode_element(new_mode, fh): \n pass\n\n # (*) check for modes w/o pattern definitions\n if not new_mode.has_event_handler() and new_mode.own_matches() == {}:\n if new_mode.options[\"inheritable\"] != \"only\":\n new_mode.options[\"inheritable\"] = \"only\"\n error_msg(\"Mode without pattern and event handlers needs to be 'inheritable only'.\\n\" + \\\n \"<inheritable: only> has been added automatically.\", fh, DontExitF=True)\n\ndef parse_mode_option_list(new_mode, fh):\n position = fh.tell()\n try: \n # ':' => inherited modes/options follow\n skip_whitespace(fh)\n\n # (*) base modes \n base_modes, i = read_until_letter(fh, [\"{\", \"<\"], Verbose=1)\n new_mode.base_modes = split(base_modes)\n\n if i != 1: return\n fh.seek(-1, 1)\n\n # (*) options\n while parse_mode_option(fh, new_mode):\n pass\n\n except EndOfStreamException:\n fh.seek(position)\n error_msg(\"End of file reached while options of mode '%s'.\" % mode_name, fh)\n\ndef parse_mode_option(fh, new_mode):\n skip_whitespace(fh)\n\n # (*) base modes \n if fh.read(1) != \"<\": return False\n\n skip_whitespace(fh)\n\n identifier = read_identifier(fh).strip()\n\n if identifier == \"\": error_msg(\"missing identifer after start of mode option '<'\", fh)\n skip_whitespace(fh)\n if fh.read(1) != \":\": error_msg(\"missing ':' after option name '%s'\" % identifier, fh)\n skip_whitespace(fh)\n\n if identifier == \"skip\":\n # A skipper 'eats' characters at the beginning of a pattern that belong\n # to a specified set of characters. A useful application is most probably\n # the whitespace skipper '[ \\t\\n]'. The skipper definition allows quex to\n # implement a very effective way to skip these regions.\n pattern_str, trigger_set = regular_expression.parse_character_set(fh, PatternStringF=True)\n skip_whitespace(fh)\n\n if fh.read(1) != \">\":\n error_msg(\"missing closing '>' for mode option '%s'.\" % identifier, fh)\n\n if trigger_set.is_empty():\n error_msg(\"Empty trigger set for skipper.\" % identifier, fh)\n\n # TriggerSet skipping is implemented the following way: As soon as one element of the \n # trigger set appears, the state machine enters the 'trigger set skipper section'.\n opener_sm = StateMachine()\n opener_sm.add_transition(opener_sm.init_state_index, trigger_set, AcceptanceF=True)\n \n action = CodeFragment(create_skip_code(trigger_set))\n \n # Enter the skipper as if the opener pattern was a normal pattern and the 'skipper' is the action.\n new_mode.add_match(pattern_str, action, opener_sm)\n\n return True\n\n elif identifier == \"skip_range\":\n # A non-nesting skipper can contain a full fledged regular expression as opener,\n # since it only effects the trigger. Not so the nested range skipper-see below.\n\n # -- opener\n skip_whitespace(fh)\n opener_str, opener_sm = regular_expression.parse(fh)\n skip_whitespace(fh)\n\n # -- closer\n if fh.read(1) != \"\\\"\":\n error_msg(\"closing pattern for skip_range can only be a string and must start with a quote like \\\".\", fh)\n closer_sequence = snap_character_string.get_character_code_sequence(fh)\n skip_whitespace(fh)\n if fh.read(1) != \">\":\n error_msg(\"missing closing '>' for mode option '%s'\" % identifier, fh)\n\n action = CodeFragment(create_skip_range_code(closer_sequence))\n\n # Enter the skipper as if the opener pattern was a normal pattern and the 'skipper' is the action.\n new_mode.add_match(opener_str, action, opener_sm)\n return True\n \n elif identifier == \"skip_nesting_range\":\n error_msg(\"skip_nesting_range is not yet supported.\", fh)\n\n else:\n value, i = read_until_letter(fh, [\">\"], Verbose=1)\n if i != 0:\n error_msg(\"missing closing '>' for mode option '%s'\" % identifier, fh)\n\n value = value.strip()\n\n # Does the specified option actually exist?\n if not lexer_mode.mode_option_info_db.has_key(identifier):\n error_msg(\"tried to set option '%s' which does not exist!\\n\" % identifier + \\\n \"options are %s\" % repr(lexer_mode.mode_option_info_db.keys()), fh)\n\n # Is the option of the appropriate value?\n option_info = lexer_mode.mode_option_info_db[identifier]\n if option_info.type != \"list\" and value not in option_info.domain:\n error_msg(\"Tried to set value '%s' for option '%s'. \" % (Value, Option) + \\\n \"Though, possible \\n\" + \\\n \"for this option are %s\" % repr(oi.domain), fh)\n\n # Finally, set the option\n new_mode.add_option(identifier, value)\n\n return True\n\ndef parse_mode_element(new_mode, fh):\n \"\"\"Returns: False, if a closing '}' has been found.\n True, else.\n \"\"\"\n position = fh.tell()\n try:\n description = \"Pattern or event handler name.\\n\" + \\\n \"Missing closing '}' for end of mode\"\n\n skip_whitespace(fh)\n # NOTE: Do not use 'read_word' since we need to continue directly after\n # whitespace, if a regular expression is to be parsed.\n position = fh.tell()\n\n word = read_until_whitespace(fh)\n if word == \"}\":\n return False\n\n # -- check for 'on_entry', 'on_exit', ...\n result = check_for_event_specification(word, fh, new_mode)\n if result == True: \n return True # all work has been done in check_for_event_specification()\n else:\n fh.seek(position)\n description = \"start of mode element: regular expression\"\n pattern, pattern_state_machine = regular_expression.parse(fh)\n\n if new_mode.has_pattern(pattern):\n previous = new_mode.get_match_object(pattern)\n error_msg(\"Pattern has been defined twice.\", fh, DontExitF=True)\n error_msg(\"First defined here.\", \n previous.action().filename, previous.action().line_n)\n\n\n position = fh.tell()\n description = \"start of mode element: code fragment for '%s'\" % pattern\n\n parse_action_code(new_mode, fh, pattern, pattern_state_machine)\n\n except EndOfStreamException:\n fh.seek(position)\n error_msg(\"End of file reached while parsing %s.\" % description, fh)\n\n return True\n\ndef parse_action_code(new_mode, fh, pattern, pattern_state_machine):\n\n position = fh.tell()\n try:\n skip_whitespace(fh)\n position = fh.tell()\n \n code_obj = code_fragment.parse(fh, \"regular expression\", ErrorOnFailureF=False) \n if code_obj != None:\n new_mode.add_match(pattern, code_obj, pattern_state_machine)\n return\n\n fh.seek(position)\n word = read_until_letter(fh, [\";\"])\n if word == \"PRIORITY-MARK\":\n # This mark 'lowers' the priority of a pattern to the priority of the current\n # pattern index (important for inherited patterns, that have higher precedence).\n # The parser already constructed a state machine for the pattern that is to\n # be assigned a new priority. Since, this machine is not used, let us just\n # use its id.\n fh.seek(-1, 1)\n verify_next_word(fh, \";\", Comment=\"Since quex version 0.33.5 this is required.\")\n new_mode.add_match_priority(pattern, pattern_state_machine, pattern_state_machine.get_id(), fh)\n\n elif word == \"DELETION\":\n # This mark deletes any pattern that was inherited with the same 'name'\n fh.seek(-1, 1)\n verify_next_word(fh, \";\", Comment=\"Since quex version 0.33.5 this is required.\")\n new_mode.add_match_deletion(pattern, pattern_state_machine, fh)\n \n else:\n error_msg(\"missing token '{', 'PRIORITY-MARK', 'DELETION', or '=>' after '%s'.\\n\" % pattern + \\\n \"found: '%s'. Note, that since quex version 0.33.5 it is required to add a ';'\\n\" % word + \\\n \"to the commands PRIORITY-MARK and DELETION.\", fh)\n\n\n except EndOfStreamException:\n fh.seek(position)\n error_msg(\"End of file reached while parsing action code for pattern.\", fh)\n\ndef check_for_event_specification(word, fh, new_mode):\n\n if word == \"on_entry\":\n # Event: enter into mode\n new_mode.on_entry = code_fragment.parse(fh, \"%s::on_entry event handler\" % new_mode.name)\n return True\n \n elif word == \"on_exit\":\n # Event: exit from mode\n new_mode.on_exit = code_fragment.parse(fh, \"%s::on_exit event handler\" % new_mode.name)\n return True\n\n elif word == \"on_match\":\n # Event: exit from mode\n new_mode.on_match = code_fragment.parse(fh, \"%s::on_match event handler\" % new_mode.name)\n return True\n\n elif word == \"on_indentation\":\n # Event: start of indentation, \n # first non-whitespace after whitespace\n new_mode.on_indentation = code_fragment.parse(fh, \"%s::on_indentation event handler\" % new_mode.name)\n return True\n\n elif word == \"on_failure\" or word == \"<<FAIL>>\":\n # Event: No pattern matched for current position.\n # NOTE: See 'on_end_of_stream' comments.\n new_mode.on_failure = code_fragment.parse(fh, \"%s::on_failure event handler\" % new_mode.name)\n return True\n\n elif word == \"on_end_of_stream\" or word == \"<<EOF>>\": \n # Event: End of data stream / end of file\n # NOTE: The regular expression parser relies on <<EOF>> and <<FAIL>>. So those\n # patterns are entered here, even if later versions of quex might dismiss\n # those rule deefinitions in favor of consistent event handlers.\n new_mode.on_end_of_stream = code_fragment.parse(fh, \"%s::on_end_of_stream event handler\" % new_mode.name)\n return True\n\n elif len(word) >= 3 and word[:3] == \"on_\": \n error_msg(\"Unknown event handler '%s'. Known event handlers are:\\n\\n\" % word + \\\n \"on_entry, on_exit, on_indentation, on_end_of_stream, on_failure. on_match\\n\\n\" + \\\n \"Note, that any pattern starting with 'on_' is considered an event handler.\\n\" + \\\n \"use double quotes to bracket patterns that start with 'on_'.\", fh)\n\n # word was not an event specification \n return False\n\n" }, { "alpha_fraction": 0.5984086990356445, "alphanum_fraction": 0.6042713522911072, "avg_line_length": 38.13114929199219, "blob_id": "a79588444f5ba01ffecd27d14147083d3d665860", "content_id": "f6e82a6b2f9f4ea1610368222ba1068f27aa4881", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2388, "license_type": "permissive", "max_line_length": 101, "num_lines": 61, "path": "/dependencies/quex-0.34.1/quex/core_engine/regular_expression/snap_character_string.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "import quex.core_engine.utf8 as utf8\nimport quex.core_engine.regular_expression.snap_backslashed_character as snap_backslashed_character\nfrom quex.core_engine.state_machine.core import StateMachine\nfrom quex.exception import RegularExpressionException\n\n\ndef do(sh):\n \"\"\"Converts a uni-code string into a state machine that parses \n its letters sequentially. Each state in the sequence correponds\n to the sucessful triggering of a letter. Only the last state, though,\n is an acceptance state. Any bailing out before is 'not accepted'. \n Example:\n\n \"hey\" is translated into the state machine:\n\n (0)-- 'h' -->(1)-- 'e' -->(2)-- 'y' --> ACCEPTANCE\n | | |\n FAIL FAIL FAIL\n \n Note: The state indices are globally unique. But, they are not necessarily\n 0, 1, 2, ... \n \"\"\"\n assert sh.__class__.__name__ == \"StringIO\" \\\n or sh.__class__.__name__ == \"file\"\n\n # resulting state machine\n result = StateMachine()\n state_idx = result.init_state_index\n\n # Only \\\" is a special character '\"', any other backslashed character\n # remains as the sequence 'backslash' + character\n for char_code in get_character_code_sequence(sh):\n state_idx = result.add_transition(state_idx, char_code)\n\n # when the last state has trigger it is supposed to end up in 'acceptance'\n result.states[state_idx].set_acceptance()\n return result\n\ndef get_character_code_sequence(sh):\n assert sh.__class__.__name__ == \"StringIO\" \\\n or sh.__class__.__name__ == \"file\"\n\n # Only \\\" is a special character '\"', any other backslashed character\n # remains as the sequence 'backslash' + character\n sequence = []\n while 1 + 1 == 2:\n char_code = utf8.__read_one_utf8_code_from_stream(sh)\n if char_code == 0xFF:\n raise RegularExpressionException(\"End of file reached while parsing quoted string.\")\n\n elif char_code == ord(\"\\\\\"): \n char_code = snap_backslashed_character.do(sh)\n if char_code == None: \n raise RegularExpressionException(\"Unidentified backslash-sequence in quoted string.\")\n\n elif char_code == ord('\"'):\n break\n\n sequence.append(char_code)\n\n return sequence\n\n" }, { "alpha_fraction": 0.4715099632740021, "alphanum_fraction": 0.49857550859451294, "avg_line_length": 25, "blob_id": "b44252af8e55f0e830cbe69b819d147b3d4a6907", "content_id": "38e4fa123349d9fe77fc982b20e8cc43262de274", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 702, "license_type": "permissive", "max_line_length": 78, "num_lines": 27, "path": "/dependencies/quex-0.34.1/demo/004/benchmark/show.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "#! /usr/bin/env python\nimport sys\nimport os\n\n\ndir = \"./results/\"\nfile_list = os.listdir(dir)\n\ndb = []\nfor file in file_list:\n data = []\n if file[0] == \".\": continue\n\n for line in open(dir + file, \"r\").readlines():\n x = line.split()\n if line.find(\"quex_version\") != -1: version = x[2][1:-2]\n if line.find(\"cpu_name\") != -1: cpu = x[2][1:-2]\n if line.find(\"clock_cycles_per_character\") != -1: ccc = x[2][1:-2]\n # if line.find(\"file_name\") != -1: test_file = x[2][1:-2]\n \n if line.strip() == \"}\": data.append(ccc)\n\n db.append([version, cpu] + data)\n \ndb.sort()\nfor entry in db:\n print repr(entry)[1:-1]\n" }, { "alpha_fraction": 0.6254180669784546, "alphanum_fraction": 0.6395391821861267, "avg_line_length": 34.880001068115234, "blob_id": "c77a0788434df0d8ce9b7c0e6dd3f30416916579", "content_id": "69c0bbe04a003b6b5fee5c0f929bd02c3152dd89", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Shell", "length_bytes": 5382, "license_type": "permissive", "max_line_length": 312, "num_lines": 150, "path": "/engine/tests/gasoline/test.sh", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "#!/bin/bash\n\nset -e\n\nmake -C ../../.. gsl\n\nTMP=$(tempfile)\n\ndo_glsl_check() {\n local KIND=\"$1\"\n local FILENAME=\"$2\"\n ./glsl_check \"${KIND}\" \"${FILENAME}\" 2>&1\n return \"$?\"\n}\n\ndo_cg_check() {\n local KIND=\"$1\"\n local FILENAME=\"$2\"\n local PROFILE=ps_3_0\n if [ \"$KIND\" == \"vert\" ] ; then\n PROFILE=vs_3_0\n fi\n cgc -profile $PROFILE -strict ${FILENAME} -o ${FILENAME}.asm 2>&1\n return \"$?\"\n}\n\ndo_check() {\n local TARGET=\"$1\"\n local KIND=\"$2\"\n local FILENAME=\"$3\"\n local FAILED=0\n if [ \"$TARGET\" == \"cg\" ] ; then\n do_cg_check $KIND $FILENAME > $TMP || FAILED=1\n else\n do_glsl_check $KIND $FILENAME > $TMP || FAILED=1\n fi\n if [ \"$FAILED\" -ne 0 ] ; then\n echo \"While checking ${TARGET} ${KIND} shader: ${FILENAME}\"\n cat $TMP\n nl -b a ${FILENAME}\n exit 1\n fi\n}\n\ntest_sky() {\n local TARGET=\"$1\"\n local SHADER=\"$2\"\n local PARAMS=\"-p starfieldMap FloatTexture2 -p starfieldMask Float3 -p perlin FloatTexture2 -p perlinN FloatTexture2 -p emissiveMap FloatTexture2 -p emissiveMask Float3 -p alphaMask Float -p alphaRejectThreshold Float -p premultipliedAlpha StaticFloat -U emissiveMap -p volumeMap FloatTexture3\"\n local UBT=\"-u perlinN\"\n local TLANG=\"\"\n test $TARGET == \"cg\" && TLANG=\"-C\"\n gsl $TLANG $PARAMS $UBT \"${SHADER}.vert.gsl\" \"/dev/null\" \"${SHADER}.colour.gsl\" SKY ${SHADER}.{vert,frag}.out.$TARGET\n do_check ${TARGET} vert ${SHADER}.vert.out.${TARGET}\n do_check ${TARGET} frag ${SHADER}.frag.out.${TARGET}\n}\n\n\n\n\ntest_hud() {\n local TARGET=\"$1\"\n local SHADER=\"$2\"\n local PARAMS=\"-p colour Float3 -p alpha Float -p tex FloatTexture2\"\n local UBT=\"\"\n local TLANG=\"\"\n test $TARGET == \"cg\" && TLANG=\"-C\"\n gsl $TLANG $PARAMS $UBT \"${SHADER}.vert.gsl\" \"/dev/null\" \"${SHADER}.colour.gsl\" HUD ${SHADER}.{vert,frag}.out.$TARGET\n do_check ${TARGET} vert ${SHADER}.vert.out.${TARGET}\n do_check ${TARGET} frag ${SHADER}.frag.out.${TARGET}\n}\n\n# TODO(dcunnin): Need to test with -e and -E not to mention -d\ntest_body() {\n local TARGET=\"$1\"\n local SHADER=\"$2\"\n local BONE_WEIGHTS=\"$3\"\n local KIND=\"$4\"\n local INSTANCED=\"$5\"\n local PARAMS=\"$INSTANCED -p alphaMask Float -p alphaRejectThreshold Float -p diffuseMap FloatTexture2 -p diffuseMask Float3 -p normalMap FloatTexture2 -p glossMap FloatTexture2 -p glossMask Float -p specularMask Float -p emissiveMap FloatTexture2 -p emissiveMask Float3 -b $BONE_WEIGHTS -U paintSelectionMap\"\n local UBT=\"-u normalMap\"\n local TLANG=\"\"\n test $TARGET == \"cg\" && TLANG=\"-C\"\n gsl $TLANG $PARAMS $UBT \"${SHADER}.vert.gsl\" \"${SHADER}.dangs.gsl\" \"${SHADER}.add.gsl\" ${KIND} ${SHADER}.${BONE_WEIGHTS}.{vert,frag}.$KIND.out.$TARGET\n\n do_check ${TARGET} vert ${SHADER}.${BONE_WEIGHTS}.vert.$KIND.out.$TARGET\n do_check ${TARGET} frag ${SHADER}.${BONE_WEIGHTS}.frag.$KIND.out.$TARGET\n}\n\n# TODO(dcunnin): Need to test with -e and -E not to mention -d\ntest_decal() {\n local TARGET=\"$1\"\n local SHADER=\"$2\"\n local BONE_WEIGHTS=\"$3\"\n local PARAMS=\"-p alphaMask Float -p alphaRejectThreshold Float -p diffuseMap FloatTexture2 -p diffuseMask Float3 -p normalMap FloatTexture2 -p glossMap FloatTexture2 -p glossMask Float -p specularMask Float -p emissiveMap FloatTexture2 -p emissiveMask Float3 -b $BONE_WEIGHTS\"\n local UBT=\"-u normalMap\"\n local TLANG=\"\"\n test $TARGET == \"cg\" && TLANG=\"-C\"\n gsl $TLANG $PARAMS $UBT \"/dev/null\" \"${SHADER}.dangs.gsl\" \"${SHADER}.add.gsl\" DECAL ${SHADER}.${BONE_WEIGHTS}.{vert,frag}.out.$TARGET\n do_check ${TARGET} vert ${SHADER}.${BONE_WEIGHTS}.vert.out.$TARGET\n do_check ${TARGET} frag ${SHADER}.${BONE_WEIGHTS}.frag.out.$TARGET\n}\n\n\ntest_particle() {\n local TARGET=\"$1\"\n local SHADER=\"$2\"\n local PARAMS=\"--internal -p gbuffer0 FloatTexture2 -p particleAtlas FloatTexture2\"\n local TLANG=\"\"\n test $TARGET == \"cg\" && TLANG=\"-C\"\n gsl $TLANG $PARAMS $UBT \"${SHADER}.vert.gsl\" \"/dev/null\" \"${SHADER}.add.gsl\" SKY ${SHADER}.{vert,frag}.out.$TARGET\n do_check ${TARGET} vert ${SHADER}.vert.out.$TARGET\n do_check ${TARGET} frag ${SHADER}.frag.out.$TARGET\n}\n\n\ndo_tests() {\n local TARGET=$1\n test_particle ${TARGET} Particle\n\n test_sky ${TARGET} Empty\n test_sky ${TARGET} SkyTest\n test_sky ${TARGET} SkyDefault\n test_sky ${TARGET} SkyClouds\n test_sky ${TARGET} SkyBackground\n test_sky ${TARGET} ForLoop\n\n for KIND in FORWARD ALPHA FIRST_PERSON FIRST_PERSON_WIREFRAME CAST ; do\n for INSTANCED in \"\" \"-i\"; do\n test_body ${TARGET} FpDefault 0 \"$KIND\" \"$INSTANCED\"\n test_body ${TARGET} Empty 0 \"$KIND\" \"$INSTANCED\"\n test_body ${TARGET} CarPaint 0 \"$KIND\" \"$INSTANCED -p paintSelectionMap FloatTexture2 -p paintSelectionMask Float4 -p paintByDiffuseAlpha StaticFloat -p microflakesMap FloatTexture2\"\n test_body ${TARGET} FpDefault 3 \"$KIND\" \"$INSTANCED\"\n test_body ${TARGET} Empty 3 \"$KIND\" \"$INSTANCED\"\n test_body ${TARGET} CarPaint 3 \"$KIND\" \"$INSTANCED -p paintSelectionMap FloatTexture2 -p paintSelectionMask Float4 -p paintByDiffuseAlpha StaticFloat -p microflakesMap FloatTexture2\"\n done\n done\n\n test_hud ${TARGET} HudRect\n test_hud ${TARGET} HudText\n}\n\nif [ \"$SKIP_GLSL\" != \"1\" ] ; then\n do_tests glsl33\nfi\n\nif [ \"$SKIP_CG\" != \"1\" ] ; then\n do_tests cg\nfi\n\n# test_decal glsl Empty 0\n" }, { "alpha_fraction": 0.6522019505500793, "alphanum_fraction": 0.6603652238845825, "avg_line_length": 24.50684928894043, "blob_id": "8368ede887d377b001b217b36a739930f73842a3", "content_id": "b6c4a43c6b8dc8d43f19ff1fb093128b37b973cd", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 9310, "license_type": "permissive", "max_line_length": 98, "num_lines": 365, "path": "/engine/lua_wrappers_disk_resource.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include \"grit_lua_util.h\"\n#include \"lua_wrappers_disk_resource.h\"\n#include \"main.h\"\n\n#include \"gfx/gfx_disk_resource.h\"\n\n#define DISKRESHOLD_TAG \"Grit/DiskResourceHold\"\n\n\n\n// DISK RESOURCE HOLD ============================================================= {{{\n\nstatic int diskreshold_gc (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n GET_UD_MACRO_OFFSET(DiskResourcePtr<DiskResource>, self, 1, DISKRESHOLD_TAG, 0);\n delete self;\n return 0;\nTRY_END\n}\n\nTOSTRING_ADDR_MACRO(diskreshold, DiskResourcePtr<DiskResource>, DISKRESHOLD_TAG)\n\nstatic int diskreshold_index (lua_State *L)\n{\nTRY_START\n check_args(L, 2);\n GET_UD_MACRO(DiskResourcePtr<DiskResource>, self, 1, DISKRESHOLD_TAG);\n std::string key = check_string(L, 2);\n if (key == \"name\") {\n push_string(L, self->getName());\n } else {\n EXCEPT << \"DiskResourceHold no such field: \" << key << ENDL;\n }\n return 1;\nTRY_END\n}\n\nstatic int diskreshold_newindex (lua_State *L)\n{\nTRY_START\n check_args(L, 3);\n GET_UD_MACRO(DiskResourcePtr<DiskResource>, self, 1, DISKRESHOLD_TAG);\n std::string key = check_string(L, 2);\n (void) self;\n if (false) {\n } else {\n EXCEPT << \"DiskResourceHold no such field: \" << key << ENDL;\n }\n return 0;\nTRY_END\n}\n\nEQ_PTR_MACRO(DiskResourcePtr<DiskResource>, diskreshold, DISKRESHOLD_TAG)\n\nMT_MACRO_NEWINDEX(diskreshold);\n\n//}}}\n\n\n// {{{ FLAGS\n\nstatic int global_disk_resource_get_gfx_verbose_loads (lua_State *L)\n{\nTRY_START\n check_args(L, 0);\n lua_pushboolean(L, gfx_disk_resource_verbose_loads);\n return 1;\nTRY_END\n}\n\nstatic int global_disk_resource_set_gfx_verbose_loads (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n gfx_disk_resource_verbose_loads = check_bool(L, 1);\n return 0;\nTRY_END\n}\n\nstatic int global_disk_resource_get_verbose_loads (lua_State *L)\n{\nTRY_START\n check_args(L, 0);\n lua_pushboolean(L, disk_resource_verbose_loads);\n return 1;\nTRY_END\n}\n\nstatic int global_disk_resource_set_verbose_loads (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n disk_resource_verbose_loads = check_bool(L, 1);\n return 0;\nTRY_END\n}\n\nstatic int global_disk_resource_get_verbose_incs (lua_State *L)\n{\nTRY_START\n check_args(L, 0);\n lua_pushboolean(L, disk_resource_verbose_incs);\n return 1;\nTRY_END\n}\n\nstatic int global_disk_resource_set_verbose_incs (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n disk_resource_verbose_incs = check_bool(L, 1);\n return 0;\nTRY_END\n}\n\n// }}}\n\n\nstatic int global_disk_resource_num (lua_State *L)\n{\nTRY_START\n check_args(L, 0);\n lua_pushnumber(L, disk_resource_num());\n return 1;\nTRY_END\n}\n\nstatic int global_disk_resource_num_loaded (lua_State *L)\n{\nTRY_START\n check_args(L, 0);\n lua_pushnumber(L, disk_resource_num_loaded());\n return 1;\nTRY_END\n}\n\nstatic int global_disk_resource_all (lua_State *L)\n{\nTRY_START\n check_args(L, 0);\n DiskResources drs = disk_resource_all();\n lua_newtable(L);\n int counter = 1;\n for (DiskResources::iterator i=drs.begin(), i_=drs.end() ; i != i_ ; ++i) {\n lua_pushstring(L, (*i)->getName().c_str());\n lua_rawseti(L, -2, counter++);\n }\n return 1;\nTRY_END\n}\n\nstatic int global_disk_resource_all_loaded (lua_State *L)\n{\nTRY_START\n check_args(L, 0);\n DiskResources drs = disk_resource_all_loaded();\n lua_newtable(L);\n int counter = 1;\n for (DiskResources::iterator i=drs.begin(), i_=drs.end() ; i != i_ ; ++i) {\n lua_pushstring(L, (*i)->getName().c_str());\n lua_rawseti(L, -2, counter++);\n }\n return 1;\nTRY_END\n}\n\nstatic int global_disk_resource_reload (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n std::string name = check_path(L, 1);\n DiskResource *dr = disk_resource_get_or_make(name);\n if (!dr->isLoaded()) my_lua_error(L, \"Resource not loaded: \\\"\" + std::string(name) + \"\\\"\");\n dr->reload();\n return 0;\nTRY_END\n}\n\nstatic int global_disk_resource_load (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n std::string name = check_path(L, 1);\n DiskResource *dr = disk_resource_get_or_make(name);\n if (dr->isLoaded()) my_lua_error(L, \"Resource already loaded: \\\"\" + std::string(name) + \"\\\"\");\n dr->loadForeground();\n return 0;\nTRY_END\n}\n\nstatic int global_disk_resource_ensure_loaded (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n std::string name = check_path(L, 1);\n DiskResource *dr = disk_resource_get_or_make(name);\n if (!dr->isLoaded())\n dr->loadForeground();\n return 0;\nTRY_END\n}\n\nstatic int global_disk_resource_unload (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n std::string name = check_path(L, 1);\n DiskResource *dr = disk_resource_get_or_make(name);\n if (!dr->isLoaded()) my_lua_error(L, \"Resource not loaded: \\\"\" + std::string(name) + \"\\\"\");\n dr->unload();\n return 0;\nTRY_END\n}\n\nstatic int global_disk_resource_add (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n std::string name = check_path(L, 1);\n disk_resource_get_or_make(name);\n return 0;\nTRY_END\n}\n\nstatic int global_disk_resource_has (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n std::string name = check_path(L, 1);\n bool b = disk_resource_has(name);\n lua_pushboolean(L, b);\n return 1;\nTRY_END\n}\n\nstatic int global_disk_resource_loaded (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n std::string name = check_path(L, 1);\n DiskResource *dr = disk_resource_get_or_make(name);\n lua_pushboolean(L, dr->isLoaded());\n return 1;\nTRY_END\n}\n\nstatic int global_disk_resource_users (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n std::string name = check_path(L, 1);\n DiskResource *dr = disk_resource_get_or_make(name);\n lua_pushnumber(L, dr->getUsers());\n return 1;\nTRY_END\n}\n\n\nstatic int global_disk_resource_check (lua_State *L)\n{\nTRY_START\n check_args(L, 0);\n bgl->checkRAMHost();\n bgl->checkRAMGPU();\n return 0;\nTRY_END\n}\n\nstatic int global_host_ram_available (lua_State *L)\n{\nTRY_START\n check_args(L, 0);\n lua_pushnumber(L, host_ram_available());\n return 1;\nTRY_END\n}\n\nstatic int global_host_ram_used (lua_State *L)\n{\nTRY_START\n check_args(L, 0);\n lua_pushnumber(L, host_ram_used());\n return 1;\nTRY_END\n}\n\n\nstatic int global_disk_resource_hold_make (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n std::string name = check_path(L, 1);\n DiskResource *dr = disk_resource_get_or_make(name);\n auto *self = new DiskResourcePtr<DiskResource>(dr);\n push(L, self, DISKRESHOLD_TAG);\n return 1;\nTRY_END\n}\n\n\n\nstatic const luaL_reg global[] = {\n\n // global flags\n {\"disk_resource_get_gfx_verbose_loads\", global_disk_resource_get_gfx_verbose_loads},\n {\"disk_resource_set_gfx_verbose_loads\", global_disk_resource_set_gfx_verbose_loads},\n {\"disk_resource_get_verbose_loads\", global_disk_resource_get_verbose_loads},\n {\"disk_resource_set_verbose_loads\", global_disk_resource_set_verbose_loads},\n {\"disk_resource_get_verbose_incs\", global_disk_resource_get_verbose_incs},\n {\"disk_resource_set_verbose_incs\", global_disk_resource_set_verbose_incs},\n\n // querying\n {\"disk_resource_num\", global_disk_resource_num},\n {\"disk_resource_num_loaded\", global_disk_resource_num_loaded},\n {\"disk_resource_all\", global_disk_resource_all},\n {\"disk_resource_all_loaded\", global_disk_resource_all_loaded},\n\n // the resources themselves\n {\"disk_resource_add\", global_disk_resource_add},\n {\"disk_resource_has\", global_disk_resource_has},\n {\"disk_resource_users\", global_disk_resource_users},\n {\"disk_resource_ensure_loaded\", global_disk_resource_ensure_loaded},\n {\"disk_resource_loaded\", global_disk_resource_loaded},\n {\"disk_resource_load\", global_disk_resource_load},\n {\"disk_resource_unload\", global_disk_resource_unload},\n {\"disk_resource_reload\", global_disk_resource_reload},\n {\"disk_resource_hold_make\", global_disk_resource_hold_make},\n\n {\"disk_resource_check\", global_disk_resource_check},\n\n {\"host_ram_available\", global_host_ram_available},\n {\"host_ram_used\", global_host_ram_used},\n\n {NULL, NULL}\n};\n\nvoid disk_resource_lua_init (lua_State *L)\n{\n register_lua_globals(L, global);\n\n ADD_MT_MACRO(diskreshold, DISKRESHOLD_TAG);\n}\n" }, { "alpha_fraction": 0.6682451963424683, "alphanum_fraction": 0.6766640543937683, "avg_line_length": 31.767240524291992, "blob_id": "2a75265fb2c0bdf5df0f1ab8723ddc3bd0563038", "content_id": "3ae776736871d5dc88b569050bde4878bfd0d317", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 3801, "license_type": "permissive", "max_line_length": 93, "num_lines": 116, "path": "/engine/physics/physical_material.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\nstruct PhysicalMaterial;\nclass PhysicalMaterialDB;\n\n#ifndef PhysicalMaterial_h\n#define PhysicalMaterial_h\n\n#include <map>\n#include <string>\n#include <vector>\n\n#include <centralised_log.h>\n\n\nstruct PhysicalMaterial {\n std::string name;\n int interactionGroup;\n int id;\n};\n\nstruct Interaction {\n float friction;\n float restitution;\n Interaction() : friction(0), restitution(0) { }\n Interaction(float f, float r) : friction(f), restitution(r) { }\n};\n\ntypedef std::vector<Interaction> Interactions;\n\nclass PhysicalMaterialDB {\n\n public:\n\n static const char *emergencyMat (void) { return \"/system/FallbackPhysicalMaterial\"; }\n\n PhysicalMaterialDB (void)\n {\n Interactions interactions;\n interactions.push_back(Interaction(0.5,0.5));\n setInteractionGroups(1, interactions);\n setMaterial(emergencyMat(), 0);\n }\n\n PhysicalMaterial *getMaterial (const std::string &mat_name);\n\n PhysicalMaterial *getMaterial (const std::string &col_name, const std::string &mat_name);\n\n PhysicalMaterial *getMaterial (const std::string &dir,\n const std::string &col_name,\n const std::string &mat_name);\n\n\n PhysicalMaterial *getMaterial (int material)\n { return mdb2[material]; }\n\n PhysicalMaterial *getMaterialSafe (int material);\n\n\n void setMaterial (const std::string &name, int interaction_group);\n\n void setInteractionGroups (unsigned groups, const Interactions &interactions);\n\n void getFrictionRestitution (int mat0, int mat1, float &f, float &r)\n {\n unsigned char ig0 = getMaterial(mat0)->interactionGroup;\n unsigned char ig1 = getMaterial(mat1)->interactionGroup;\n if (ig0 > numInteractions) {\n CERR<<\"Invalid interaction group \"<<ig0<<\" in material \\\"\"\n <<getMaterial(mat0)->name<<\"\\\"\"<<std::endl;\n f = 0; r = 0; return;\n }\n if (ig1 > numInteractions) {\n CERR<<\"Invalid interaction group \"<<ig1<<\" in material \\\"\"\n <<getMaterial(mat1)->name<<\"\\\"\"<<std::endl;\n f = 0; r = 0; return;\n }\n int code = ig0*numInteractions + ig1;\n f = interactions[code].friction;\n r = interactions[code].restitution ;\n }\n\n protected:\n\n typedef std::map<std::string, PhysicalMaterial*> NameMap; // map string to material\n NameMap mdb;\n \n typedef std::vector<PhysicalMaterial*> IndexMap; // map id to material\n IndexMap mdb2;\n \n Interactions interactions; // size() == numInteractions*numInteractions\n unsigned numInteractions;\n};\n\nextern PhysicalMaterialDB phys_mats; \n\n#endif\n" }, { "alpha_fraction": 0.5435354113578796, "alphanum_fraction": 0.5507183074951172, "avg_line_length": 39.913978576660156, "blob_id": "764e3c8b5fcf0a49d8ec7c875026f74ce47a437e", "content_id": "a44e3471e2061971fb430cc0b434394ac153172b", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 11416, "license_type": "permissive", "max_line_length": 106, "num_lines": 279, "path": "/dependencies/quex-0.34.1/quex/input/quex_file_parser.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "#! /usr/bin/env python\n# Quex is free software; you can redistribute it and/or modify it under the\n# terms of the GNU Lesser General Public License as published by the Free\n# Software Foundation; either version 2.1 of the License, or (at your option)\n# any later version.\n# \n# This software is distributed in the hope that it will be useful, but WITHOUT\n# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more\n# details.\n# \n# You should have received a copy of the GNU Lesser General Public License along\n# with this library; if not, write to the Free Software Foundation, Inc., 59\n# Temple Place, Suite 330, Boston, MA 02111-1307 USA\n#\n################################################################################\n#\nfrom quex.frs_py.file_in import *\nfrom quex.token_id_maker import TokenInfo\nfrom quex.exception import RegularExpressionException\nimport quex.lexer_mode as lexer_mode\nimport quex.input.mode_definition as mode_definition\nimport quex.input.regular_expression as regular_expression\nimport quex.input.code_fragment as code_fragment\nfrom quex.core_engine.generator.action_info import UserCodeFragment\n\n\ndef do(file_list, Setup):\n global mode_db\n\n for file in file_list:\n fh = open_file_or_die(file, Codec=\"utf-8\")\n\n # read all modes until end of file\n try:\n while 1 + 1 == 2:\n parse_section(fh, Setup)\n except EndOfStreamException:\n pass\n except RegularExpressionException, x:\n error_msg(x.message, fh)\n \n return lexer_mode.mode_db\n\ndef __parse_domain_of_whitespace_separated_elements(fh, CodeFragmentName, ElementNames, MinElementN): \n \"\"\"Returns list of lists, where \n \n record_list[i][k] means element 'k' of line 'i'\n\n NOTE: record_list[i][-1] contains the line 'i' as it appeared as a whole.\n record_list[i][-2] contains the line number of line in the given file.\n\n \"\"\" \n start_line_n = get_current_line_info_number(fh)\n dummy, i = read_until_letter(fh, [\"{\"], Verbose=True)\n if i == -1: \n error_msg(\"missing '{' after %s statement\" % CodeFragmentName, fh)\n #\n line_n = start_line_n \n record_list = []\n while 1 + 1 == 2:\n line = fh.readline()\n line_n += 1\n #\n if line == \"\": \n error_msg(\"found end of file while parsing a '%s' range.\\n\" % CodeFragmentName + \\\n \"range started here.\", fh, start_line_n) \n line = line.strip()\n if line == \"\": continue # empty line\n elif line[0] == '}': return record_list # end of define range\n elif len(line) > 1 and line[:2] == \"//\": continue # comment\n\n # -- interpret line as list of whitespace separated record elements\n fields = line.split() \n if fields != [] and is_identifier(fields[0]) == False:\n error_msg(\"'%s' is not a valid identifier.\" % fields[0], fh)\n\n if len(fields) < MinElementN: \n format_str = \"\"\n for element in ElementNames:\n format_str += \"%s \" % element \n error_msg(\"syntax error in definition list\\n\" + \\\n \"format: %s NEWLINE\" % format_str , fh, line_n)\n record_list.append(fields + [line_n, line]) \n\n assert True == False, \"this code section should have never been reached!\"\n\ndef parse_section(fh, Setup):\n\n # NOTE: End of File is supposed to be reached when trying to read a new\n # section. Thus, the end-of-file catcher does not encompass the beginning.\n position = fh.tell()\n skip_whitespace(fh)\n word = read_next_word(fh)\n\n try:\n # (*) determine what is defined\n #\n # -- 'mode { ... }' => define a mode\n # -- 'start = ...;' => define the name of the initial mode\n # -- 'header { ... }' => define code that is to be pasted on top\n # of the engine (e.g. \"#include<...>\")\n # -- 'body { ... }' => define code that is to be pasted in the class' body\n # of the engine (e.g. \"public: int my_member;\")\n # -- 'init { ... }' => define code that is to be pasted in the class' constructors\n # of the engine (e.g. \"my_member = -1;\")\n # -- 'define { ... }' => define patterns shorthands such as IDENTIFIER for [a-z]+\n # -- 'token { ... }' => define token ids\n #\n if word == \"start\":\n parse_initial_mode_definition(fh)\n return\n \n elif word == \"header\":\n fragment = code_fragment.parse(fh, \"header\", AllowBriefTokenSenderF=False) \n lexer_mode.header = fragment\n return\n\n elif word == \"body\":\n fragment = code_fragment.parse(fh, \"body\", AllowBriefTokenSenderF=False) \n lexer_mode.class_body = fragment\n return\n\n elif word == \"init\":\n fragment = code_fragment.parse(fh, \"init\", AllowBriefTokenSenderF=False)\n lexer_mode.class_init = fragment\n return\n \n elif word == \"define\":\n parse_pattern_name_definitions(fh, Setup)\n return\n\n elif word == \"token\": \n parse_token_id_definitions(fh, Setup)\n return\n\n elif word == \"mode\":\n mode_definition.parse(fh, Setup)\n return\n else:\n error_msg(\"sequence '%s' not recognized as valid keyword in this context\\n\" % word + \\\n \"use: 'mode', 'header', 'body', 'init', 'define', 'token' or 'start'\", fh)\n except EndOfStreamException:\n fh.seek(position)\n error_msg(\"End of file reached while parsing '%s' section\" % word, fh)\n\ndef parse_pattern_name_definitions(fh, Setup):\n \"\"\"Parses pattern definitions of the form:\n \n WHITESPACE [ \\t\\n]\n IDENTIFIER [a-zA-Z0-9]+\n OP_PLUS \"+\"\n \n That means: 'name' whitespace 'regular expression' whitespace newline.\n Comments can only be '//' nothing else and they have to appear at the\n beginning of the line.\n \n One regular expression can have more than one name, but one name can \n only have one regular expression.\n \"\"\"\n # NOTE: Catching of EOF happens in caller: parse_section(...)\n\n def __closing_bracket(fh):\n position = fh.tell()\n dummy = fh.read(1)\n if dummy == \"}\": return True\n fh.seek(position)\n return False\n\n #\n dummy, i = read_until_letter(fh, [\"{\"], Verbose=True)\n\n while 1 + 1 == 2:\n skip_whitespace(fh)\n\n if __closing_bracket(fh): \n return\n \n # -- get the name of the pattern\n skip_whitespace(fh)\n pattern_name = read_identifier(fh)\n if pattern_name == \"\":\n raise RegularExpressionException(\"Missing identifier for pattern definition.\")\n\n skip_whitespace(fh)\n\n if __closing_bracket(fh): \n raise RegularExpressionException(\"Missing regular expression for pattern definition '%s'.\" % \\\n pattern_name)\n\n # -- parse regular expression, build state machine\n regular_expression_obj, state_machine = regular_expression.parse(fh, AllowNothingIsFineF=True)\n \n lexer_mode.shorthand_db[pattern_name] = \\\n lexer_mode.PatternShorthand(pattern_name, state_machine, \n fh.name, get_current_line_info_number(fh),\n regular_expression_obj)\n\ndef parse_token_id_definitions(fh, Setup):\n \"\"\"Parses token definitions of the form:\n \n TOKEN_ID_NAME [Number] [TypeName] \n \n For example:\n\n TKN_IDENTIFIER 1002 std::string\n \n defines an token_id with value 1002 and type std::string.\n \n TKN_NUMBER std::double\n TKN_FLAG 1008\n TKN_NUMBER 2999 \n \n defines an id TKN_NUMBER, where the type is set to 'std::string'. Then\n TKN_FLAG is defined as numerical value 1008. Finally an addition to \n TKN_NUMBER is made, saying that is has the numerical value of 2999. \n \n \"\"\"\n # NOTE: Catching of EOF happens in caller: parse_section(...)\n #\n record_list = __parse_domain_of_whitespace_separated_elements(fh, \"define\", \n [\"TOKEN-ID-NAME\", \n \"[Number]\", \"[TypeName]\"], 1)\n db = lexer_mode.token_id_db\n for record in record_list:\n # NOTE: record[-1] -> line text, record[-2] -> line number\n # record[:-2] fields of the line\n line_n = record[-2]\n name = record[0]\n type_name = None\n number = None\n #\n # -- check the name, if it starts with the token prefix paste a warning\n token_prefix = Setup.input_token_id_prefix\n if name.find(token_prefix) == 0:\n error_msg(\"Token identifier '%s' starts with token prefix '%s'.\\n\" % (name, token_prefix) + \\\n \"Token prefix is mounted automatically. This token id appears in the source\\n\" + \\\n \"code as '%s%s'.\" % (token_prefix, name), \\\n fh, DontExitF=True)\n\n #\n if len(record) - 2 > 1: \n candidate = record[1]\n # does candidate consist only of digits ? --> number\n # is first character a letter or '_' ? --> type_name \n if candidate.isdigit(): number = long(candidate)\n elif is_identifier(candidate[0]): type_name = candidate\n #\n if len(record) - 2 > 2:\n candidate = record[2]\n # is first character a letter or '_' ? \n if is_identifier(candidate[0]): \n if type_name != None:\n error_msg(\"Token can only have *one* type associated with it\", fh, line_n)\n type_name = candidate\n #\n if not db.has_key(name): \n db[name] = TokenInfo(name, number, type_name, fh.name, line_n)\n else:\n if number != None: db[name].id = number\n if type_name != None: db[name].type_name = type_name\n db[name].positions.append([fh.name, line_n])\n\ndef parse_initial_mode_definition(fh):\n # NOTE: Catching of EOF happens in caller: parse_section(...)\n\n verify_next_word(fh, \"=\")\n # specify the name of the intial lexical analyser mode\n skip_whitespace(fh)\n mode_name = read_identifier(fh)\n verify_next_word(fh, \";\", Comment=\"Since quex version 0.33.5 this is required.\")\n\n if lexer_mode.initial_mode.get_code() != \"\":\n error_msg(\"start mode defined more than once!\", fh, DontExitF=True)\n error_msg(\"previously defined here\",\n lexer_mode.initial_mode.filename,\n lexer_mode.initial_mode.line_n)\n \n lexer_mode.initial_mode = UserCodeFragment(mode_name, fh.name, get_current_line_info_number(fh), None)\n\n" }, { "alpha_fraction": 0.530512273311615, "alphanum_fraction": 0.530512273311615, "avg_line_length": 31.071428298950195, "blob_id": "2376b5501fd67078a2081ba9edc401cfbed5be4e", "content_id": "69f5ca8d06bed63cfa515565b35c19e15ca3d8b5", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Makefile", "length_bytes": 2245, "license_type": "permissive", "max_line_length": 96, "num_lines": 70, "path": "/dependencies/quex-0.34.1/demo/008/Makefile", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "# PURPOSE: Makefile Demo Application of Quex\n#\n# ABSOLUTELY NO WARRANTY\n#_______________________________________________________________________________\n.PHONY: clean\n\nifndef QUEX_PATH\n $(error The environment variable QUEX_PATH is not defined!)\nendif\n\n# (*) SETUP ____________________________________________________________________\n# -- INPUT\nLEXER_FILE\t\t= Calc_lexer.qx\n\n# -- FILES PRODUCED BY QUEX\nLEXER_NAME\t\t= Calc_lexer# NOTE: a whitespace after this name creates chaos!\nLEXER_SOURCES\t= $(LEXER_NAME) \\\n $(LEXER_NAME).cpp \\\n $(LEXER_NAME)-token_ids \\\n\t\t $(LEXER_NAME)-core-engine.cpp\n\nTOKEN_FILE\t\t= Calc_token-ids\n\nPARSER_NAME\t\t=\tCalc_parser\nPARSER_FILE\t\t=\t$(PARSER_NAME).ypp\nPARSER_SOURCES\t=\t$(PARSER_NAME).tab.cpp\t\\\n\t\t\t\t\t$(PARSER_NAME).tab.hpp\n# -- OUTPUT\nAPPLICATION = lexer\n\n# (*) COMPILER SETTINGS ________________________________________________________\n# (change COMPILER to whatever you use as compiler on the command line,\n# e.g. \"make COMPILER=icpc\" will use intel's c++ compiler)\nCOMPILER = g++ -ggdb -Wall\n\nifneq (,$(findstring $(COMPILER),icpc cl dmc))\n\tLIBICONV=-liconv\nelse\n\tLIBICONV=#\nendif\n\nCC = $(COMPILER) -c -I./ -I$(QUEX_PATH) $(NDEBUG_F) \\\n -DQUEX_OPTION_ACTIVATE_ASSERTS # -no-deprecated -Wall -fPIC\n\nLD = $(COMPILER) $(LIBICONV)\n\n# (*) RULES ____________________________________________________________________\n# -- application\n$(APPLICATION): main.o $(LEXER_NAME).o $(LEXER_NAME)-core-engine.o $(PARSER_NAME).tab.o\n\t$(LD) -o $(APPLICATION) main.o $(LEXER_NAME).o $(LEXER_NAME)-core-engine.o $(PARSER_NAME).tab.o\n\n# -- engine and object files\n%.o: %.cpp $(LEXER_SOURCES) $(PARSER_NAME).tab.cpp\n\t$(CC) $< -o $@ # -D__QUEX_OPTION_DEBUG_STATE_TRANSITION_REPORTS\n\n$(LEXER_SOURCES): $(LEXER_FILE) $(PARSER_NAME).tab.cpp\n\tquex -i $(LEXER_FILE) --engine $(LEXER_NAME) --token-prefix TKN_ \\\n --foreign-token-id-file Calc_token-ids.h\n\n$(PARSER_NAME).tab.cpp: $(PARSER_FILE)\n\tbison $(PARSER_FILE)\n\n# (*) HELPERS __________________________________________________________________\nclean:\t\n\ttouch $(LEXER_FILE)\n\trm -f $(LEXER_SOURCES)\n\trm -f $(PARSER_SOURCES)\n\trm -f *.o\n\trm -f $(APPLICATION)\n\trm -f *.bak\n" }, { "alpha_fraction": 0.7122538089752197, "alphanum_fraction": 0.7155361175537109, "avg_line_length": 34.153846740722656, "blob_id": "57b04fcf6a807d03563e9e0dca3396d8369ee58f", "content_id": "d9b613fde931178b1ffdc2f9f27af596c34dfa6b", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 1828, "license_type": "permissive", "max_line_length": 80, "num_lines": 52, "path": "/engine/grit_lua_util.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <string>\n\nextern \"C\" {\n #include \"lua.h\"\n #include <lauxlib.h>\n #include <lualib.h>\n}\n\n#include <centralised_log.h>\n#include <lua_util.h>\n#include <lua_wrappers_common.h>\n\n\n#define TRY_START try {\n#define TRY_END } catch (Ogre::Exception &e) { \\\n std::string msg = e.getFullDescription(); \\\n my_lua_error(L,msg); \\\n return 0; \\\n} catch (Exception &e) { \\\n my_lua_error(L,e.msg); \\\n return 0; \\\n}\n\nstd::string check_path (lua_State *l, int stack_index);\n\nvoid push_cfunction (lua_State *L, int (*func)(lua_State*));\nvoid func_map_leak_all (void);\n\nint my_lua_error_handler (lua_State *l);\n\nint my_lua_error_handler (lua_State *l, lua_State *coro, int levelhack);\n" }, { "alpha_fraction": 0.5908165574073792, "alphanum_fraction": 0.598181962966919, "avg_line_length": 41.974056243896484, "blob_id": "c525324d64b43b635d1ce7081ec523d4c314aaa4", "content_id": "0e2fbd52ceadae132146f643111d68782a6b4a0d", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 57974, "license_type": "permissive", "max_line_length": 118, "num_lines": 1349, "path": "/engine/gfx/gfx_shader.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <centralised_log.h>\n\n#include \"gfx.h\"\n#include \"gfx_gasoline.h\"\n#include \"gfx_gl3_plus.h\"\n#include \"gfx_internal.h\"\n#include \"gfx_shader.h\"\n\nGfxGslBackend backend = gfx_d3d9() ? GFX_GSL_BACKEND_CG : GFX_GSL_BACKEND_GLSL33;\n\nstatic const std::string dump_shader(getenv(\"GRIT_DUMP_SHADER\") == nullptr\n ? \"\" : getenv(\"GRIT_DUMP_SHADER\"));\n\nstd::ostream &operator << (std::ostream &o, const GfxShader::Split &s)\n{\n o << s.purpose;\n o << s.meshEnv;\n return o;\n}\n\nstatic std::string fresh_name (void)\n{\n static int counter = 0;\n std::stringstream ss;\n ss << \"Gen:\" << counter++;\n return ss.str();\n}\n\nGfxShaderGlobals gfx_shader_globals_cam_ss (GfxPipeline *pipe, Ogre::Viewport *viewport)\n{\n Ogre::Camera *cam = pipe->getCamera();\n Ogre::Matrix4 view = Ogre::Matrix4::IDENTITY;\n Ogre::Matrix4 proj = Ogre::Matrix4::IDENTITY;\n\n bool render_target_flipping = viewport->getTarget()->requiresTextureFlipping();\n Vector3 cam_pos = from_ogre(cam->getPosition());\n Vector2 viewport_dim(viewport->getActualWidth(), viewport->getActualHeight());\n\n Vector3 ray_top_right = from_ogre(cam->getWorldSpaceCorners()[4]) - cam_pos;\n Vector3 ray_top_left = from_ogre(cam->getWorldSpaceCorners()[5]) - cam_pos;\n Vector3 ray_bottom_left = from_ogre(cam->getWorldSpaceCorners()[6]) - cam_pos;\n Vector3 ray_bottom_right = from_ogre(cam->getWorldSpaceCorners()[7]) - cam_pos;\n\n return {\n cam_pos, view, view.inverseAffine(), proj,\n ray_top_left, ray_top_right, ray_bottom_left, ray_bottom_right,\n viewport_dim, render_target_flipping, pipe\n };\n}\n\nGfxShaderGlobals gfx_shader_globals_cam (GfxPipeline *pipe, const Ogre::Matrix4 &proj)\n{\n Ogre::Camera *cam = pipe->getCamera();\n Ogre::Matrix4 view = cam->getViewMatrix();\n\n Ogre::Viewport *viewport = cam->getViewport();\n bool render_target_flipping = viewport->getTarget()->requiresTextureFlipping();\n Vector3 cam_pos = from_ogre(cam->getPosition());\n Vector2 viewport_dim(viewport->getActualWidth(), viewport->getActualHeight());\n\n Vector3 ray_top_right = from_ogre(cam->getWorldSpaceCorners()[4]) - cam_pos;\n Vector3 ray_top_left = from_ogre(cam->getWorldSpaceCorners()[5]) - cam_pos;\n Vector3 ray_bottom_left = from_ogre(cam->getWorldSpaceCorners()[6]) - cam_pos;\n Vector3 ray_bottom_right = from_ogre(cam->getWorldSpaceCorners()[7]) - cam_pos;\n\n return {\n cam_pos, view, view.inverseAffine(), proj,\n ray_top_left, ray_top_right, ray_bottom_left, ray_bottom_right,\n viewport_dim, render_target_flipping, pipe\n };\n}\n\nGfxShaderGlobals gfx_shader_globals_cam (GfxPipeline *pipe)\n{\n Ogre::Camera *cam = pipe->getCamera();\n return gfx_shader_globals_cam(pipe, cam->getProjectionMatrix());\n}\n\nvoid try_set_constant (const Ogre::GpuProgramParametersSharedPtr &p,\n const std::string &name, const Ogre::Matrix4 &v)\n{\n p->setNamedConstant(name, v);\n}\n\nvoid try_set_constant (const Ogre::GpuProgramParametersSharedPtr &p,\n const std::string &name, const Ogre::Matrix4 *v, unsigned n)\n{\n p->setNamedConstant(name, v, n);\n}\n\nvoid try_set_constant (const Ogre::GpuProgramParametersSharedPtr &p,\n const std::string &name, int v)\n{\n p->setNamedConstant(name, v);\n}\n\nvoid try_set_constant (const Ogre::GpuProgramParametersSharedPtr &p,\n const std::string &name, float v)\n{\n p->setNamedConstant(name, v);\n}\n\nvoid try_set_constant (const Ogre::GpuProgramParametersSharedPtr &p,\n const std::string &name, const Vector2 &v)\n{\n p->setNamedConstant(name, to_ogre(v));\n}\n\nvoid try_set_constant (const Ogre::GpuProgramParametersSharedPtr &p,\n const std::string &name, const Vector3 &v)\n{\n p->setNamedConstant(name, to_ogre(v));\n}\n\nvoid try_set_constant (const Ogre::GpuProgramParametersSharedPtr &p,\n const std::string &name, const Vector4 &v)\n{\n p->setNamedConstant(name, to_ogre(v));\n}\n\nvoid try_set_constant (const Ogre::GpuProgramParametersSharedPtr &p,\n const std::string &name,\n const Ogre::GpuProgramParameters::AutoConstantType &v)\n{\n p->setNamedAutoConstant(name, v);\n}\n\nvoid try_set_constant (const Ogre::GpuProgramParametersSharedPtr &p,\n const std::string &name,\n const Ogre::GpuProgramParameters::AutoConstantType &v,\n unsigned n)\n{\n p->setNamedAutoConstant(name, v, n);\n}\n\n\ntemplate<class T> static void hack_set_constant(const Ogre::GpuProgramParametersSharedPtr &p,\n const std::string &name, const T&v, unsigned n)\n{\n try_set_constant(p, name, v, n);\n}\n\ntemplate<class T> static void hack_set_constant(const Ogre::GpuProgramParametersSharedPtr &vp,\n const Ogre::GpuProgramParametersSharedPtr &fp,\n const std::string &name, const T&v, unsigned n)\n{\n hack_set_constant(vp, name, v, n);\n hack_set_constant(fp, name, v, n);\n}\n\ntemplate<class T> static void hack_set_constant(const Ogre::GpuProgramParametersSharedPtr &p,\n const std::string &name, const T&v)\n{\n try_set_constant(p, name, v);\n}\n\ntemplate<class T> static void hack_set_constant(const Ogre::GpuProgramParametersSharedPtr &vp,\n const Ogre::GpuProgramParametersSharedPtr &fp,\n const std::string &name, const T&v)\n{\n hack_set_constant(vp, name, v);\n hack_set_constant(fp, name, v);\n}\n\n\nvoid GfxShader::reset (const GfxGslRunParams &p,\n const std::string &src_vertex,\n const std::string &src_dangs,\n const std::string &src_additional,\n bool internal_)\n{\n params = p;\n srcVertex = src_vertex;\n srcDangs = src_dangs;\n srcAdditional = src_additional;\n internal = internal_;\n\n // Destroy all currently built shaders\n for (const auto &pair1 : shaderCache) {\n for (const auto &pair2 : pair1.second) {\n for (const auto &pair3 : pair2.second) {\n const NativePair &np = pair3.second;\n Ogre::HighLevelGpuProgramManager::getSingleton().remove(np.vp);\n Ogre::HighLevelGpuProgramManager::getSingleton().remove(np.fp);\n }\n }\n }\n shaderCache.clear();\n\n // all mats must reset now\n}\n\n// Build a list of texture params that are not satisfied by actual textures.\n// Build a list of static params and the values that satisfy them.\nvoid GfxShader::populateMatEnv (bool fade_dither,\n const GfxTextureStateMap &textures,\n const GfxShaderBindings &bindings,\n GfxGslMaterialEnvironment &mat_env)\n{\n mat_env.ubt.clear();\n mat_env.fadeDither = fade_dither;\n for (const auto &u : params) {\n // Find undefined textures.\n if (gfx_gasoline_param_is_texture(u.second)) {\n if (textures.find(u.first) == textures.end()) {\n mat_env.ubt[u.first] = bindings.find(u.first) != bindings.end();\n }\n }\n }\n mat_env.staticValues.clear();\n for (const auto &bind : bindings) {\n // Find statics.\n if (gfx_gasoline_param_is_static(bind.second)) {\n mat_env.staticValues[bind.first] = bind.second;\n }\n }\n}\n\nvoid GfxShader::populateMeshEnv (bool instanced, unsigned bone_weights,\n GfxGslMeshEnvironment &mesh_env)\n{\n mesh_env.instanced = instanced;\n mesh_env.boneWeights = bone_weights;\n}\n\nGfxShader::NativePair GfxShader::getNativePair (GfxGslPurpose purpose,\n const GfxGslMaterialEnvironment &mat_env,\n const GfxGslMeshEnvironment &mesh_env)\n{\n // Need to choose / maybe compile a shader for this combination of textures and bindings.\n //\n //\n ShaderCacheBySplit &cache = shaderCache[shader_scene_env][mat_env];\n Split split;\n split.purpose = purpose;\n split.meshEnv = mesh_env;\n auto it = cache.find(split);\n\n if (it == cache.end()) {\n // Need to build it.\n Ogre::HighLevelGpuProgramPtr vp;\n Ogre::HighLevelGpuProgramPtr fp;\n\n\n std::string oname = fresh_name();\n if (backend == GFX_GSL_BACKEND_CG) {\n vp = Ogre::HighLevelGpuProgramManager::getSingleton().createProgram(\n oname+\"_v\", RESGRP, \"cg\", Ogre::GPT_VERTEX_PROGRAM);\n fp = Ogre::HighLevelGpuProgramManager::getSingleton().createProgram(\n oname+\"_f\", RESGRP, \"cg\", Ogre::GPT_FRAGMENT_PROGRAM);\n Ogre::StringVector vp_profs, fp_profs;\n if (gfx_d3d9()) {\n vp_profs.push_back(\"vs_3_0\");\n fp_profs.push_back(\"ps_3_0\");\n } else {\n vp_profs.push_back(\"gpu_vp\");\n fp_profs.push_back(\"gp4fp\");\n }\n\n Ogre::CgProgram *tmp_vp = static_cast<Ogre::CgProgram*>(&*vp);\n tmp_vp->setEntryPoint(\"main\");\n tmp_vp->setProfiles(vp_profs);\n tmp_vp->setCompileArguments(\"-I. -O3\");\n\n Ogre::CgProgram *tmp_fp = static_cast<Ogre::CgProgram*>(&*fp);\n tmp_fp->setEntryPoint(\"main\");\n tmp_fp->setProfiles(fp_profs);\n tmp_fp->setCompileArguments(\"-I. -O3\");\n } else {\n vp = Ogre::HighLevelGpuProgramManager::getSingleton().createProgram(\n oname+\"_v\", RESGRP, \"glsl\", Ogre::GPT_VERTEX_PROGRAM);\n fp = Ogre::HighLevelGpuProgramManager::getSingleton().createProgram(\n oname+\"_f\", RESGRP, \"glsl\", Ogre::GPT_FRAGMENT_PROGRAM);\n }\n\n\n GfxGslMetadata md;\n md.params = params;\n md.cfgEnv = shader_scene_env;\n md.matEnv = mat_env;\n md.meshEnv = mesh_env;\n md.d3d9 = gfx_d3d9();\n md.internal = internal;\n md.lightingTextures = gfx_gasoline_does_lighting(purpose);\n\n GfxGasolineResult output;\n try {\n output = gfx_gasoline_compile(purpose, backend, srcVertex, srcDangs, srcAdditional, md);\n } catch (const Exception &e) {\n EXCEPT << name << \": \" << e.msg << ENDL;\n }\n if (dump_shader == \"*\" || dump_shader == name) {\n CVERB << \"=== Compiling: \" << name << \" \" << split << std::endl;\n CVERB << \"--- Vertex ---\\n\" << output.vertexShader << std::endl;\n CVERB << \"--- Fragment ---\\n\" << output.fragmentShader << std::endl;\n }\n vp->setSource(output.vertexShader);\n fp->setSource(output.fragmentShader);\n vp->load();\n fp->load();\n\n if (backend == GFX_GSL_BACKEND_GLSL33) {\n gfx_gl3_plus_force_shader_compilation(vp, fp);\n }\n NativePair np = {vp, fp};\n cache[split] = np;\n\n return np;\n \n } else {\n\n return it->second;\n\n }\n}\n\n\nvoid GfxShader::bindShaderParams (int counter,\n const Ogre::GpuProgramParametersSharedPtr &vparams,\n const Ogre::GpuProgramParametersSharedPtr &fparams,\n const GfxTextureStateMap &textures,\n const GfxShaderBindings &bindings)\n{\n for (auto pair : params) {\n const std::string &name = pair.first;\n const auto &param = pair.second;\n if (gfx_gasoline_param_is_texture(param)) {\n\n auto it = textures.find(name);\n // material might leave a given texture undefined in which case we\n // are using the shader without that texture so do not bind it\n if (it == textures.end()) {\n auto bind = bindings.find(name);\n if (bind == bindings.end()) {\n // Completely unbound texture, must be in ubt\n continue;\n }\n // Solid colour texture, bind as a non-texture uniform.\n const GfxGslParam &v = bind->second;\n if (v.t != GFX_GSL_FLOAT4) {\n EXCEPTEX << \"Solid texture \\\"\" << name << \"\\\" had wrong type in shader \"\n << \"\\\"\" << this->name << \"\\\": got \" << v.t << \" but expected \"\n << GFX_GSL_FLOAT4 << ENDL;\n }\n hack_set_constant(vparams, fparams, \"mat_\" + name,\n Vector4(v.fs.r, v.fs.g, v.fs.b, v.fs.a));\n } else {\n if (backend==GFX_GSL_BACKEND_GLSL33) {\n hack_set_constant(vparams, fparams, \"mat_\" + name, counter);\n }\n counter++;\n }\n\n } else {\n const GfxGslParam *vptr = &param;\n auto bind = bindings.find(name);\n if (bind != bindings.end()) {\n GfxGslParamType bt = bind->second.t;\n if (bt == param.t) {\n vptr = &bind->second;\n } else {\n EXCEPTEX << \"Binding \\\"\" << name << \"\\\" had wrong type in shader \"\n << \"\\\"\" << this->name << \"\\\": got \" << bt << \" but expected \"\n << vptr->t << ENDL;\n }\n }\n const auto &v = *vptr;\n switch (v.t) {\n case GFX_GSL_FLOAT1:\n hack_set_constant(vparams, fparams, \"mat_\" + name, v.fs.r);\n break;\n\n case GFX_GSL_FLOAT2:\n hack_set_constant(vparams, fparams, \"mat_\" + name, Vector2(v.fs.r, v.fs.g));\n break;\n\n case GFX_GSL_FLOAT3:\n hack_set_constant(vparams, fparams, \"mat_\" + name,\n Vector3(v.fs.r, v.fs.g, v.fs.b));\n break;\n\n case GFX_GSL_FLOAT4:\n hack_set_constant(vparams, fparams, \"mat_\" + name,\n Vector4(v.fs.r, v.fs.g, v.fs.b, v.fs.a));\n break;\n\n case GFX_GSL_INT1:\n hack_set_constant(vparams, fparams, \"mat_\" + name, v.is.r);\n break;\n\n case GFX_GSL_INT2:\n case GFX_GSL_INT3:\n case GFX_GSL_INT4:\n EXCEPTEX << \"Ogre does not support int2 / int3 / int4.\" << ENDL;\n\n case GFX_GSL_STATIC_FLOAT1:\n case GFX_GSL_STATIC_FLOAT2:\n case GFX_GSL_STATIC_FLOAT3:\n case GFX_GSL_STATIC_FLOAT4:\n case GFX_GSL_STATIC_INT1:\n case GFX_GSL_STATIC_INT2:\n case GFX_GSL_STATIC_INT3:\n case GFX_GSL_STATIC_INT4:\n // Do nothing -- these are baked into the shader already.\n break;\n\n default: EXCEPTEX << \"Internal error.\" << ENDL;\n }\n }\n }\n}\n\nvoid GfxShader::initPassTextures (Ogre::Pass *p, const GfxTextureStateMap &textures)\n{\n // Must be called after globals.\n for (auto pair : params) {\n const std::string &name = pair.first;\n const auto &param = pair.second;\n if (gfx_gasoline_param_is_texture(param)) {\n\n auto it = textures.find(name);\n\n // material might leave a given texture undefined in which case we\n // are using the shader without that texture so do not bind it\n\n if (it == textures.end()) continue;\n\n const GfxTextureState &state = it->second;\n\n Ogre::TextureUnitState *tus = p->createTextureUnitState();\n // TODO(dcunnin): tex is null as a temporary hack to allow binding of gbuffer\n if (state.texture != nullptr) {\n tus->setTextureAnisotropy(state.anisotropy);\n tus->setTextureFiltering(to_ogre(state.filterMin), to_ogre(state.filterMax),\n to_ogre(state.filterMip));\n Ogre::TextureUnitState::UVWAddressingMode am = {\n to_ogre(state.modeU), to_ogre(state.modeV), to_ogre(state.modeW)\n };\n tus->setTextureAddressingMode(am);\n }\n }\n }\n\n}\n\nvoid GfxShader::updatePassTextures (Ogre::Pass *p, int counter, const GfxTextureStateMap &textures)\n{\n // Must be called after globals.\n for (auto pair : params) {\n const std::string &name = pair.first;\n const auto &param = pair.second;\n if (gfx_gasoline_param_is_texture(param)) {\n\n auto it = textures.find(name);\n\n // material might leave a given texture undefined in which case we\n // are using the shader without that texture so do not bind it\n\n if (it == textures.end()) continue;\n\n const GfxTextureState &state = it->second;\n\n Ogre::TextureUnitState *tus = p->getTextureUnitState(counter++);\n // TODO(dcunnin): tex is null as a temporary hack to allow binding of gbuffer\n if (state.texture != nullptr) {\n tus->setTextureName(state.texture->getOgreTexturePtr()->getName());\n }\n }\n }\n APP_ASSERT(counter == p->getNumTextureUnitStates());\n\n}\n\nvoid GfxShader::bindShaderParamsRs (int counter, const GfxTextureStateMap &textures)\n{\n for (auto pair : params) {\n const std::string &name = pair.first;\n const auto &param = pair.second;\n if (gfx_gasoline_param_is_texture(param)) {\n\n auto it = textures.find(name);\n\n // material might leave a given texture undefined in which case we\n // are using the shader without that texture so do not bind it\n\n if (it == textures.end()) continue;\n\n const GfxTextureState &state = it->second;\n\n // TODO(dcunnin): tex is null as a temporary hack to allow binding of gbuffer\n if (state.texture != nullptr) {\n ogre_rs->_setTexture(counter, true, state.texture->getOgreTexturePtr());\n ogre_rs->_setTextureLayerAnisotropy(counter, state.anisotropy);\n ogre_rs->_setTextureUnitFiltering(counter, \n to_ogre(state.filterMin), to_ogre(state.filterMax), to_ogre(state.filterMip));\n Ogre::TextureUnitState::UVWAddressingMode am = {\n to_ogre(state.modeU), to_ogre(state.modeV), to_ogre(state.modeW)\n };\n ogre_rs->_setTextureAddressingMode(counter, am);\n }\n counter++;\n }\n }\n\n}\n\nvoid GfxShader::bindShader (GfxGslPurpose purpose,\n const GfxGslMaterialEnvironment &mat_env,\n const GfxGslMeshEnvironment &mesh_env,\n const GfxShaderGlobals &globs,\n const Ogre::Matrix4 &world,\n const Ogre::Matrix4 *bone_world_matrixes,\n unsigned num_bone_world_matrixes,\n float fade,\n const GfxTextureStateMap &textures,\n const GfxShaderBindings &bindings)\n{\n GfxPaintColour white[] = {\n { Vector3(1, 1, 1), 1, 1, 1, },\n { Vector3(1, 1, 1), 1, 1, 1, },\n { Vector3(1, 1, 1), 1, 1, 1, },\n { Vector3(1, 1, 1), 1, 1, 1, },\n };\n bindShader(purpose, mat_env, mesh_env, globs, world,\n bone_world_matrixes, num_bone_world_matrixes, fade, white,\n textures, bindings);\n}\n\nvoid GfxShader::bindShader (GfxGslPurpose purpose,\n bool fade_dither,\n bool instanced,\n unsigned bone_weights,\n const GfxShaderGlobals &globs,\n const Ogre::Matrix4 &world,\n const Ogre::Matrix4 *bone_world_matrixes,\n unsigned num_bone_world_matrixes,\n float fade,\n const GfxTextureStateMap &textures,\n const GfxShaderBindings &bindings)\n{\n GfxPaintColour white[] = {\n { Vector3(1, 1, 1), 1, 1, 1, },\n { Vector3(1, 1, 1), 1, 1, 1, },\n { Vector3(1, 1, 1), 1, 1, 1, },\n { Vector3(1, 1, 1), 1, 1, 1, },\n };\n bindShader(purpose, fade_dither, instanced, bone_weights, globs, world,\n bone_world_matrixes, num_bone_world_matrixes, fade, white,\n textures, bindings);\n}\n\nvoid GfxShader::bindShader (GfxGslPurpose purpose,\n bool fade_dither,\n bool instanced,\n unsigned bone_weights,\n const GfxShaderGlobals &globs,\n const Ogre::Matrix4 &world,\n const Ogre::Matrix4 *bone_world_matrixes,\n unsigned num_bone_world_matrixes,\n float fade,\n const GfxPaintColour *paint_colours, // Array of 4\n const GfxTextureStateMap &textures,\n const GfxShaderBindings &bindings)\n{\n GfxGslMaterialEnvironment mat_env;\n populateMatEnv(fade_dither, textures, bindings, mat_env);\n\n GfxGslMeshEnvironment mesh_env;\n populateMeshEnv(instanced, bone_weights, mesh_env);\n \n bindShader(purpose, mat_env, mesh_env, globs, world, bone_world_matrixes,\n num_bone_world_matrixes, fade, paint_colours, textures, bindings);\n}\n\nvoid GfxShader::bindShader (GfxGslPurpose purpose,\n const GfxGslMaterialEnvironment &mat_env,\n const GfxGslMeshEnvironment &mesh_env,\n const GfxShaderGlobals &globs,\n const Ogre::Matrix4 &world,\n const Ogre::Matrix4 *bone_world_matrixes,\n unsigned num_bone_world_matrixes,\n float fade,\n const GfxPaintColour *paint_colours, // Array of 4\n const GfxTextureStateMap &textures,\n const GfxShaderBindings &bindings)\n{\n auto np = getNativePair(purpose, mat_env, mesh_env);\n\n // both programs must be bound before we bind the params, otherwise some params are 'lost' in gl\n ogre_rs->bindGpuProgram(np.vp->_getBindingDelegate());\n ogre_rs->bindGpuProgram(np.fp->_getBindingDelegate());\n\n const Ogre::GpuProgramParametersSharedPtr &vparams = np.vp->getDefaultParameters();\n const Ogre::GpuProgramParametersSharedPtr &fparams = np.fp->getDefaultParameters();\n vparams->setIgnoreMissingParams(true);\n fparams->setIgnoreMissingParams(true);\n\n bindGlobals(vparams, fparams, globs, purpose);\n int counter = bindGlobalTexturesRs(globs, purpose);\n bindShaderParams(counter, vparams, fparams, textures, bindings);\n bindShaderParamsRs(counter, textures);\n bindBodyParamsRS(vparams, fparams, globs, world, bone_world_matrixes, num_bone_world_matrixes,\n fade, paint_colours, purpose);\n\n ogre_rs->bindGpuProgramParameters(Ogre::GPT_VERTEX_PROGRAM, vparams, Ogre::GPV_ALL);\n ogre_rs->bindGpuProgramParameters(Ogre::GPT_FRAGMENT_PROGRAM, fparams, Ogre::GPV_ALL);\n}\n\nstatic void inc (const Ogre::GpuProgramParametersSharedPtr &vp,\n const Ogre::GpuProgramParametersSharedPtr &fp,\n int &counter,\n const char *name)\n{\n if (backend==GFX_GSL_BACKEND_GLSL33)\n hack_set_constant(vp, fp, name, counter);\n counter++;\n}\n\nvoid GfxShader::initPass (Ogre::Pass *p,\n GfxGslPurpose purpose,\n const GfxGslMaterialEnvironment &mat_env,\n const GfxGslMeshEnvironment &mesh_env,\n const GfxTextureStateMap &textures,\n const GfxShaderBindings &bindings)\n{\n auto np = getNativePair(purpose, mat_env, mesh_env);\n\n p->setFragmentProgram(np.fp->getName());\n p->setVertexProgram(np.vp->getName());\n\n const Ogre::GpuProgramParametersSharedPtr &vp = p->getVertexProgramParameters();\n const Ogre::GpuProgramParametersSharedPtr &fp = p->getFragmentProgramParameters();\n vp->setIgnoreMissingParams(true);\n fp->setIgnoreMissingParams(true);\n\n hack_set_constant(vp, fp, \"internal_shadow_view_proj\",\n Ogre::GpuProgramParameters::ACT_VIEWPROJ_MATRIX);\n\n\n hack_set_constant(vp, fp, \"global_cameraPos\", Ogre::GpuProgramParameters::ACT_CAMERA_POSITION);\n hack_set_constant(vp, fp, \"global_fovY\", Ogre::GpuProgramParameters::ACT_FOV);\n hack_set_constant(vp, fp, \"global_viewportSize\", Ogre::GpuProgramParameters::ACT_VIEWPORT_SIZE);\n hack_set_constant(vp, fp, \"global_nearClipDistance\", Ogre::GpuProgramParameters::ACT_NEAR_CLIP_DISTANCE);\n hack_set_constant(vp, fp, \"global_farClipDistance\", Ogre::GpuProgramParameters::ACT_FAR_CLIP_DISTANCE);\n hack_set_constant(vp, fp, \"global_shadowViewProj0\", Ogre::GpuProgramParameters::ACT_TEXTURE_VIEWPROJ_MATRIX, 0);\n hack_set_constant(vp, fp, \"global_shadowViewProj1\", Ogre::GpuProgramParameters::ACT_TEXTURE_VIEWPROJ_MATRIX, 1);\n hack_set_constant(vp, fp, \"global_shadowViewProj2\", Ogre::GpuProgramParameters::ACT_TEXTURE_VIEWPROJ_MATRIX, 2);\n hack_set_constant(vp, fp, \"global_rayTopLeft\", Vector3(0, 0, 0));\n hack_set_constant(vp, fp, \"global_rayTopRight\", Vector3(0, 0, 0));\n hack_set_constant(vp, fp, \"global_rayBottomLeft\", Vector3(0, 0, 0));\n hack_set_constant(vp, fp, \"global_rayBottomRight\", Vector3(0, 0, 0));\n hack_set_constant(vp, fp, \"global_particleAmbient\", Vector3(0, 0, 0));\n // TODO(dcunnin): Apparently this isn't working -- alpha textures (which need it) are not\n // getting valid values for sunlight. No idea why, working around it by setting it every frame\n // (see updatePass below).\n // hack_set_constant(vp, fp, \"global_sunlightDiffuse\", Ogre::GpuProgramParameters::ACT_LIGHT_DIFFUSE_COLOUR, 0);\n // hack_set_constant(vp, fp, \"global_sunlightSpecular\", Ogre::GpuProgramParameters::ACT_LIGHT_SPECULAR_COLOUR, 0);\n hack_set_constant(vp, fp, \"global_hellColour\", Vector3(0, 0, 0));\n // For some reason fog was too intense this way\n //hack_set_constant(vp, fp, \"global_fogColour\", Ogre::GpuProgramParameters::ACT_FOG_COLOUR);\n hack_set_constant(vp, fp, \"global_envCubeMipmaps0\", 9.0f);\n hack_set_constant(vp, fp, \"global_envCubeMipmaps1\", 9.0f);\n hack_set_constant(vp, fp, \"internal_rt_flip\", Ogre::GpuProgramParameters::ACT_RENDER_TARGET_FLIPPING);\n\n initPassGlobalTextures(p, purpose);\n\n int counter = 0;\n // CAUTION!!! These texture bindings must be in alphabetical order.\n // And match those in initPassGlobalTextures\n\n if (gfx_gasoline_does_lighting(purpose)) {\n inc(vp, fp, counter, \"global_envCube0\");\n inc(vp, fp, counter, \"global_envCube1\");\n }\n inc(vp, fp, counter, \"global_fadeDitherMap\");\n inc(vp, fp, counter, \"global_gbuffer0\");\n if (gfx_gasoline_does_lighting(purpose)) {\n inc(vp, fp, counter, \"global_shadowMap0\");\n inc(vp, fp, counter, \"global_shadowMap1\");\n inc(vp, fp, counter, \"global_shadowMap2\");\n inc(vp, fp, counter, \"global_shadowPcfNoiseMap\");\n }\n\n initPassTextures(p, textures);\n initPassBodyParams(vp, fp, purpose);\n bindShaderParams(counter, vp, fp, textures, bindings);\n updatePassTextures(p, counter, textures);\n\n}\n\nvoid GfxShader::updatePass (Ogre::Pass *p,\n const GfxShaderGlobals &globs,\n GfxGslPurpose purpose,\n const GfxGslMaterialEnvironment &mat_env,\n const GfxGslMeshEnvironment &mesh_env,\n const GfxTextureStateMap &textures,\n const GfxShaderBindings &bindings)\n{\n auto np = getNativePair(purpose, mat_env, mesh_env);\n\n // TODO(dcunnin): Not 100% sure why this is being done, but if it is so that materials\n // are updated when their shaders change, this should be done at the time of shader update, not\n // checked every material every frame as the getNativePair call is too slow for that.\n if (p->getFragmentProgram() != np.fp || p->getVertexProgram() != np.vp) {\n // Need a whole new shader, so do the slow path.\n p->removeAllTextureUnitStates();\n initPass(p, purpose, mat_env, mesh_env, textures, bindings);\n }\n const Ogre::GpuProgramParametersSharedPtr &vp = p->getVertexProgramParameters();\n const Ogre::GpuProgramParametersSharedPtr &fp = p->getFragmentProgramParameters();\n\n updatePassGlobals(vp, fp, globs, purpose);\n //bindGlobals(vparams, fparams, globs, purpose);\n updatePassGlobalTextures(p, purpose);\n}\n\nvoid GfxShader::bindBodyParamsRS (const Ogre::GpuProgramParametersSharedPtr &vp,\n const Ogre::GpuProgramParametersSharedPtr &fp,\n const GfxShaderGlobals &p, \n const Ogre::Matrix4 &world,\n const Ogre::Matrix4 *bone_world_matrixes,\n unsigned num_bone_world_matrixes,\n float fade,\n const GfxPaintColour *paint_colours,\n GfxGslPurpose purpose)\n{ \n Ogre::Matrix4 world_view = p.view * world;\n Ogre::Matrix4 world_view_proj = p.proj * world_view;\n \n hack_set_constant(vp, fp, \"body_worldViewProj\", world_view_proj);\n hack_set_constant(vp, fp, \"body_worldView\", world_view);\n hack_set_constant(vp, fp, \"body_world\", world);\n if (purpose == GFX_GSL_PURPOSE_DECAL) {\n Ogre::Matrix4 inv_world = world.inverse();\n hack_set_constant(vp, fp, \"internal_inv_world\", inv_world);\n }\n hack_set_constant(vp, fp, \"body_boneWorlds\", bone_world_matrixes, num_bone_world_matrixes);\n hack_set_constant(vp, fp, \"internal_fade\", fade);\n hack_set_constant(vp, fp, \"body_paintDiffuse0\", paint_colours[0].diff);\n hack_set_constant(vp, fp, \"body_paintMetallic0\", paint_colours[0].met);\n hack_set_constant(vp, fp, \"body_paintSpecular0\", paint_colours[0].spec);\n hack_set_constant(vp, fp, \"body_paintGloss0\", paint_colours[0].gloss);\n hack_set_constant(vp, fp, \"body_paintDiffuse1\", paint_colours[1].diff);\n hack_set_constant(vp, fp, \"body_paintMetallic1\", paint_colours[1].met);\n hack_set_constant(vp, fp, \"body_paintSpecular1\", paint_colours[1].spec);\n hack_set_constant(vp, fp, \"body_paintGloss1\", paint_colours[1].gloss);\n hack_set_constant(vp, fp, \"body_paintDiffuse2\", paint_colours[2].diff);\n hack_set_constant(vp, fp, \"body_paintMetallic2\", paint_colours[2].met);\n hack_set_constant(vp, fp, \"body_paintSpecular2\", paint_colours[2].spec);\n hack_set_constant(vp, fp, \"body_paintGloss2\", paint_colours[2].gloss);\n hack_set_constant(vp, fp, \"body_paintDiffuse3\", paint_colours[3].diff);\n hack_set_constant(vp, fp, \"body_paintMetallic3\", paint_colours[3].met);\n hack_set_constant(vp, fp, \"body_paintSpecular3\", paint_colours[3].spec);\n hack_set_constant(vp, fp, \"body_paintGloss3\", paint_colours[3].gloss);\n}\n\n\nvoid GfxShader::initPassBodyParams (const Ogre::GpuProgramParametersSharedPtr &vp,\n const Ogre::GpuProgramParametersSharedPtr &fp,\n GfxGslPurpose purpose)\n{\n std::array<Ogre::GpuProgramParametersSharedPtr, 2> params = {vp, fp};\n\n for (const auto &p : params) { \n p->setNamedAutoConstant(\"body_worldViewProj\",\n Ogre::GpuProgramParameters::ACT_WORLDVIEWPROJ_MATRIX);\n p->setNamedAutoConstant(\"body_worldView\",\n Ogre::GpuProgramParameters::ACT_WORLDVIEW_MATRIX);\n p->setNamedAutoConstant(\"body_world\",\n Ogre::GpuProgramParameters::ACT_WORLD_MATRIX);\n if (purpose == GFX_GSL_PURPOSE_DECAL) {\n p->setNamedAutoConstant(\"internal_inv_world\",\n Ogre::GpuProgramParameters::ACT_INVERSE_WORLD_MATRIX);\n }\n p->setNamedAutoConstant(\"body_boneWorlds\",\n Ogre::GpuProgramParameters::ACT_WORLD_MATRIX_ARRAY);\n p->setNamedAutoConstant(\"internal_fade\",\n Ogre::GpuProgramParameters::ACT_CUSTOM, 0);\n\n p->setNamedAutoConstant(\"body_paintDiffuse0\",\n Ogre::GpuProgramParameters::ACT_CUSTOM, 1);\n p->setNamedAutoConstant(\"body_paintMetallic0\",\n Ogre::GpuProgramParameters::ACT_CUSTOM, 2);\n p->setNamedAutoConstant(\"body_paintGloss0\",\n Ogre::GpuProgramParameters::ACT_CUSTOM, 3);\n p->setNamedAutoConstant(\"body_paintSpecular0\",\n Ogre::GpuProgramParameters::ACT_CUSTOM, 4);\n p->setNamedAutoConstant(\"body_paintDiffuse1\",\n Ogre::GpuProgramParameters::ACT_CUSTOM, 5);\n p->setNamedAutoConstant(\"body_paintMetallic1\",\n Ogre::GpuProgramParameters::ACT_CUSTOM, 6);\n p->setNamedAutoConstant(\"body_paintGloss1\",\n Ogre::GpuProgramParameters::ACT_CUSTOM, 7);\n p->setNamedAutoConstant(\"body_paintSpecular1\",\n Ogre::GpuProgramParameters::ACT_CUSTOM, 8);\n p->setNamedAutoConstant(\"body_paintDiffuse2\",\n Ogre::GpuProgramParameters::ACT_CUSTOM, 9);\n p->setNamedAutoConstant(\"body_paintMetallic2\",\n Ogre::GpuProgramParameters::ACT_CUSTOM, 10);\n p->setNamedAutoConstant(\"body_paintGloss2\",\n Ogre::GpuProgramParameters::ACT_CUSTOM, 11);\n p->setNamedAutoConstant(\"body_paintSpecular2\",\n Ogre::GpuProgramParameters::ACT_CUSTOM, 12);\n p->setNamedAutoConstant(\"body_paintDiffuse3\",\n Ogre::GpuProgramParameters::ACT_CUSTOM, 13);\n p->setNamedAutoConstant(\"body_paintMetallic3\",\n Ogre::GpuProgramParameters::ACT_CUSTOM, 14);\n p->setNamedAutoConstant(\"body_paintGloss3\",\n Ogre::GpuProgramParameters::ACT_CUSTOM, 15);\n p->setNamedAutoConstant(\"body_paintSpecular3\",\n Ogre::GpuProgramParameters::ACT_CUSTOM, 16);\n }\n}\n\nvoid GfxShader::updatePassGlobals (const Ogre::GpuProgramParametersSharedPtr &vp,\n const Ogre::GpuProgramParametersSharedPtr &fp,\n const GfxShaderGlobals &g, GfxGslPurpose purpose)\n{\n bool lighting = gfx_gasoline_does_lighting(purpose);\n Ogre::Matrix4 view_proj = g.proj * g.view; \n /*\n Vector4 viewport_size(g.viewportDim.x, g.viewportDim.y,\n 1.0f/g.viewportDim.x, 1.0f/g.viewportDim.y);\n */\n // float render_target_flipping_factor = g.renderTargetFlipping ? -1.0f : 1.0f;\n\n //hack_set_constant(vp, fp, \"global_fovY\", gfx_option(GFX_FOV));\n // DId not work, everything was upside down\n //hack_set_constant(vp, fp, \"global_proj\", Ogre::GpuProgramParameters::ACT_PROJECTION_MATRIX);\n hack_set_constant(vp, fp, \"global_proj\", g.proj);\n hack_set_constant(vp, fp, \"global_time\", anim_time);\n //hack_set_constant(vp, fp, \"global_viewportSize\", viewport_size);\n hack_set_constant(vp, fp, \"global_viewProj\", view_proj);\n hack_set_constant(vp, fp, \"global_view\", g.view);\n hack_set_constant(vp, fp, \"global_invView\", g.invView);\n /*\n hack_set_constant(vp, fp, \"global_nearClipDistance\", gfx_option(GFX_NEAR_CLIP));\n hack_set_constant(vp, fp, \"global_farClipDistance\", gfx_option(GFX_FAR_CLIP));\n */\n\n if (lighting) {\n // All of these should be updated by Ogre...\n hack_set_constant(vp, fp, \"global_sunlightDiffuse\", sunlight_diffuse);\n hack_set_constant(vp, fp, \"global_sunlightSpecular\", sunlight_specular);\n }\n\n if (lighting || purpose == GFX_GSL_PURPOSE_CAST) {\n hack_set_constant(vp, fp, \"global_sunlightDirection\", sunlight_direction);\n }\n\n hack_set_constant(vp, fp, \"global_fogColour\", fog_colour);\n hack_set_constant(vp, fp, \"global_fogDensity\", fog_density);\n //hack_set_constant(vp, fp, \"global_hellColour\", hell_colour);\n /*\n hack_set_constant(vp, fp, \"global_skyCloudColour\", sky_cloud_colour);\n hack_set_constant(vp, fp, \"global_skyCloudCoverage\", sky_cloud_coverage);\n hack_set_constant(vp, fp, \"global_skyGlareHorizonElevation\", sky_glare_horizon_elevation);\n hack_set_constant(vp, fp, \"global_skyGlareSunDistance\", sky_glare_sun_distance);\n hack_set_constant(vp, fp, \"global_sunAlpha\", sun_alpha);\n hack_set_constant(vp, fp, \"global_sunColour\", sun_colour);\n hack_set_constant(vp, fp, \"global_sunDirection\", sun_direction);\n hack_set_constant(vp, fp, \"global_sunFalloffDistance\", sun_falloff_distance);\n hack_set_constant(vp, fp, \"global_sunSize\", sun_size);\n */\n\n /*\n hack_set_constant(vp, fp, \"global_skyDivider1\", sky_divider[0]);\n hack_set_constant(vp, fp, \"global_skyDivider2\", sky_divider[1]);\n hack_set_constant(vp, fp, \"global_skyDivider3\", sky_divider[2]);\n hack_set_constant(vp, fp, \"global_skyDivider4\", sky_divider[3]);\n\n hack_set_constant(vp, fp, \"global_skyColour0\", sky_colour[0]);\n hack_set_constant(vp, fp, \"global_skyColour1\", sky_colour[1]);\n hack_set_constant(vp, fp, \"global_skyColour2\", sky_colour[2]);\n hack_set_constant(vp, fp, \"global_skyColour3\", sky_colour[3]);\n hack_set_constant(vp, fp, \"global_skyColour4\", sky_colour[4]);\n hack_set_constant(vp, fp, \"global_skyColour5\", sky_colour[5]);\n\n hack_set_constant(vp, fp, \"global_skySunColour0\", sky_sun_colour[0]);\n hack_set_constant(vp, fp, \"global_skySunColour1\", sky_sun_colour[1]);\n hack_set_constant(vp, fp, \"global_skySunColour2\", sky_sun_colour[2]);\n hack_set_constant(vp, fp, \"global_skySunColour3\", sky_sun_colour[3]);\n hack_set_constant(vp, fp, \"global_skySunColour4\", sky_sun_colour[4]);\n */\n\n hack_set_constant(vp, fp, \"global_envCubeCrossFade\", env_cube_cross_fade);\n\n /*\n hack_set_constant(vp, fp, \"global_saturation\", global_saturation);\n hack_set_constant(vp, fp, \"global_exposure\", global_exposure);\n hack_set_constant(vp, fp, \"global_bloomThreshold\", gfx_option(GFX_BLOOM_THRESHOLD));\n */\n\n // hack_set_constant(vp, fp, \"internal_rt_flip\", render_target_flipping_factor);\n\n/*\n int counter = 0;\n\n // CAUTION!!! These texture bindings must be in alphabetical order.\n // And match those in bind_global_textures\n\n if (lighting) {\n inc(vp, fp, counter, \"global_envCube0\");\n inc(vp, fp, counter, \"global_envCube1\");\n }\n inc(vp, fp, counter, \"global_fadeDitherMap\");\n inc(vp, fp, counter, \"global_gbuffer0\");\n if (lighting) {\n const static char *name[] = { \"global_shadowMap0\", \"global_shadowMap1\", \"global_shadowMap2\" };\n for (unsigned i=0 ; i<3 ; ++i) inc(vp, fp, counter, name[i]);\n inc(vp, fp, counter, \"global_shadowPcfNoiseMap\");\n }\n*/\n\n}\n\nvoid GfxShader::bindGlobals (const Ogre::GpuProgramParametersSharedPtr &vp,\n const Ogre::GpuProgramParametersSharedPtr &fp,\n const GfxShaderGlobals &g, GfxGslPurpose purpose)\n{\n Ogre::Matrix4 view_proj = g.proj * g.view; \n Vector4 viewport_size(g.viewportDim.x, g.viewportDim.y,\n 1.0f/g.viewportDim.x, 1.0f/g.viewportDim.y);\n float render_target_flipping_factor = g.renderTargetFlipping ? -1.0f : 1.0f;\n\n hack_set_constant(vp, fp, \"global_cameraPos\", g.camPos);\n hack_set_constant(vp, fp, \"global_fovY\", gfx_option(GFX_FOV));\n hack_set_constant(vp, fp, \"global_proj\", g.proj);\n hack_set_constant(vp, fp, \"global_time\", anim_time);\n hack_set_constant(vp, fp, \"global_viewportSize\", viewport_size);\n hack_set_constant(vp, fp, \"global_viewProj\", view_proj);\n hack_set_constant(vp, fp, \"global_view\", g.view);\n hack_set_constant(vp, fp, \"global_invView\", g.invView);\n hack_set_constant(vp, fp, \"global_rayTopLeft\", g.rayTopLeft);\n hack_set_constant(vp, fp, \"global_rayTopRight\", g.rayTopRight);\n hack_set_constant(vp, fp, \"global_rayBottomLeft\", g.rayBottomLeft);\n hack_set_constant(vp, fp, \"global_rayBottomRight\", g.rayBottomRight);\n hack_set_constant(vp, fp, \"global_nearClipDistance\", gfx_option(GFX_NEAR_CLIP));\n hack_set_constant(vp, fp, \"global_farClipDistance\", gfx_option(GFX_FAR_CLIP));\n\n hack_set_constant(vp, fp, \"global_shadowViewProj0\", shadow_view_proj[0]);\n hack_set_constant(vp, fp, \"global_shadowViewProj1\", shadow_view_proj[1]);\n hack_set_constant(vp, fp, \"global_shadowViewProj2\", shadow_view_proj[2]);\n\n hack_set_constant(vp, fp, \"global_particleAmbient\", particle_ambient);\n hack_set_constant(vp, fp, \"global_sunlightDiffuse\", sunlight_diffuse);\n hack_set_constant(vp, fp, \"global_sunlightDirection\", sunlight_direction);\n hack_set_constant(vp, fp, \"global_sunlightSpecular\", sunlight_specular);\n\n hack_set_constant(vp, fp, \"global_fogColour\", fog_colour);\n hack_set_constant(vp, fp, \"global_fogDensity\", fog_density);\n hack_set_constant(vp, fp, \"global_hellColour\", hell_colour);\n hack_set_constant(vp, fp, \"global_skyCloudColour\", sky_cloud_colour);\n hack_set_constant(vp, fp, \"global_skyCloudCoverage\", sky_cloud_coverage);\n hack_set_constant(vp, fp, \"global_skyGlareHorizonElevation\", sky_glare_horizon_elevation);\n hack_set_constant(vp, fp, \"global_skyGlareSunDistance\", sky_glare_sun_distance);\n hack_set_constant(vp, fp, \"global_sunAlpha\", sun_alpha);\n hack_set_constant(vp, fp, \"global_sunColour\", sun_colour);\n hack_set_constant(vp, fp, \"global_sunDirection\", sun_direction);\n hack_set_constant(vp, fp, \"global_sunFalloffDistance\", sun_falloff_distance);\n hack_set_constant(vp, fp, \"global_sunSize\", sun_size);\n\n hack_set_constant(vp, fp, \"global_skyDivider1\", sky_divider[0]);\n hack_set_constant(vp, fp, \"global_skyDivider2\", sky_divider[1]);\n hack_set_constant(vp, fp, \"global_skyDivider3\", sky_divider[2]);\n hack_set_constant(vp, fp, \"global_skyDivider4\", sky_divider[3]);\n\n hack_set_constant(vp, fp, \"global_skyColour0\", sky_colour[0]);\n hack_set_constant(vp, fp, \"global_skyColour1\", sky_colour[1]);\n hack_set_constant(vp, fp, \"global_skyColour2\", sky_colour[2]);\n hack_set_constant(vp, fp, \"global_skyColour3\", sky_colour[3]);\n hack_set_constant(vp, fp, \"global_skyColour4\", sky_colour[4]);\n hack_set_constant(vp, fp, \"global_skyColour5\", sky_colour[5]);\n\n hack_set_constant(vp, fp, \"global_skySunColour0\", sky_sun_colour[0]);\n hack_set_constant(vp, fp, \"global_skySunColour1\", sky_sun_colour[1]);\n hack_set_constant(vp, fp, \"global_skySunColour2\", sky_sun_colour[2]);\n hack_set_constant(vp, fp, \"global_skySunColour3\", sky_sun_colour[3]);\n hack_set_constant(vp, fp, \"global_skySunColour4\", sky_sun_colour[4]);\n\n hack_set_constant(vp, fp, \"global_envCubeCrossFade\", env_cube_cross_fade);\n hack_set_constant(vp, fp, \"global_envCubeMipmaps0\", 9.0f);\n hack_set_constant(vp, fp, \"global_envCubeMipmaps1\", 9.0f);\n\n hack_set_constant(vp, fp, \"global_saturation\", global_saturation);\n hack_set_constant(vp, fp, \"global_exposure\", global_exposure);\n hack_set_constant(vp, fp, \"global_bloomThreshold\", gfx_option(GFX_BLOOM_THRESHOLD));\n\n hack_set_constant(vp, fp, \"internal_rt_flip\", render_target_flipping_factor);\n\n int counter = 0;\n\n // CAUTION!!! These texture bindings must be in alphabetical order.\n // And match those in bind_global_textures\n\n if (gfx_gasoline_does_lighting(purpose)) {\n inc(vp, fp, counter, \"global_envCube0\");\n inc(vp, fp, counter, \"global_envCube1\");\n }\n inc(vp, fp, counter, \"global_fadeDitherMap\");\n inc(vp, fp, counter, \"global_gbuffer0\");\n if (gfx_gasoline_does_lighting(purpose)) {\n const static char *name[] = { \"global_shadowMap0\", \"global_shadowMap1\", \"global_shadowMap2\" };\n for (unsigned i=0 ; i<3 ; ++i) inc(vp, fp, counter, name[i]);\n inc(vp, fp, counter, \"global_shadowPcfNoiseMap\");\n }\n\n}\n\nvoid GfxShader::initPassGlobalTextures (Ogre::Pass *p, GfxGslPurpose purpose)\n{\n const auto clamp = Ogre::TextureUnitState::TAM_CLAMP;\n const auto wrap = Ogre::TextureUnitState::TAM_WRAP;\n Ogre::TextureUnitState *tus;\n bool lighting = gfx_gasoline_does_lighting(purpose);\n\n if (lighting) {\n if (global_env_cube0 != nullptr && global_env_cube1 != nullptr) {\n // Both env cubes\n tus = p->createTextureUnitState();\n tus->setTextureName(global_env_cube0->getOgreTexturePtr()->getName());\n tus->setTextureFiltering(Ogre::FO_LINEAR, Ogre::FO_LINEAR, Ogre::FO_LINEAR);\n tus->setTextureAddressingMode(\n Ogre::TextureUnitState::UVWAddressingMode {wrap, wrap, wrap});\n\n tus = p->createTextureUnitState();\n tus->setTextureName(global_env_cube1->getOgreTexturePtr()->getName());\n tus->setTextureFiltering(Ogre::FO_LINEAR, Ogre::FO_LINEAR, Ogre::FO_LINEAR);\n tus->setTextureAddressingMode(\n Ogre::TextureUnitState::UVWAddressingMode {wrap, wrap, wrap});\n\n } else if (global_env_cube0 != nullptr) {\n // One env cube\n tus = p->createTextureUnitState();\n tus->setTextureName(global_env_cube0->getOgreTexturePtr()->getName());\n tus->setTextureFiltering(Ogre::FO_LINEAR, Ogre::FO_LINEAR, Ogre::FO_LINEAR);\n tus->setTextureAddressingMode(\n Ogre::TextureUnitState::UVWAddressingMode {wrap, wrap, wrap});\n\n tus = p->createTextureUnitState();\n\n } else if (global_env_cube1 != nullptr) {\n // Other env cube\n tus = p->createTextureUnitState();\n\n tus = p->createTextureUnitState();\n tus->setTextureName(global_env_cube1->getOgreTexturePtr()->getName());\n tus->setTextureFiltering(Ogre::FO_LINEAR, Ogre::FO_LINEAR, Ogre::FO_LINEAR);\n tus->setTextureAddressingMode(\n Ogre::TextureUnitState::UVWAddressingMode {wrap, wrap, wrap});\n } else {\n // No env cube\n tus = p->createTextureUnitState();\n\n tus = p->createTextureUnitState();\n }\n }\n \n\n tus = p->createTextureUnitState();\n if (fade_dither_map != nullptr) {\n tus->setTextureName(fade_dither_map->getOgreTexturePtr()->getName());\n tus->setTextureFiltering(Ogre::FO_POINT, Ogre::FO_POINT, Ogre::FO_NONE);\n tus->setTextureAddressingMode(\n Ogre::TextureUnitState::UVWAddressingMode {clamp, clamp, clamp});\n }\n\n tus = p->createTextureUnitState();\n if (purpose == GFX_GSL_PURPOSE_DECAL) {\n // Decals will never be rendered by Ogre::Pass.\n }\n\n if (lighting) {\n for (unsigned i=0 ; i<3 ; ++i) {\n tus = p->createTextureUnitState();\n tus->setContentType(Ogre::TextureUnitState::CONTENT_SHADOW);\n tus->setTextureFiltering(Ogre::FO_POINT, Ogre::FO_POINT, Ogre::FO_NONE);\n tus->setTextureAddressingMode(\n Ogre::TextureUnitState::UVWAddressingMode {clamp, clamp, clamp});\n }\n\n tus = p->createTextureUnitState();\n if (shadow_pcf_noise_map != nullptr) {\n tus->setTextureFiltering(Ogre::FO_POINT, Ogre::FO_POINT, Ogre::FO_NONE);\n tus->setTextureAddressingMode(\n Ogre::TextureUnitState::UVWAddressingMode {clamp, clamp, clamp});\n }\n }\n}\n\nvoid GfxShader::updatePassGlobalTextures (Ogre::Pass *p, GfxGslPurpose purpose)\n{\n Ogre::TextureUnitState *tus;\n bool lighting = gfx_gasoline_does_lighting(purpose);\n int counter = 0;\n\n if (lighting) {\n if (global_env_cube0 != nullptr) {\n tus = p->getTextureUnitState(counter);\n tus->setTextureName(global_env_cube0->getOgreTexturePtr()->getName());\n }\n counter++;\n\n if (global_env_cube1 != nullptr) {\n tus = p->getTextureUnitState(counter);\n tus->setTextureName(global_env_cube1->getOgreTexturePtr()->getName());\n }\n counter++;\n }\n \n\n counter++;\n /* This never changes for now.\n tus = p->getTextureUnitState(counter++);\n if (fade_dither_map != nullptr) {\n tus->setTextureName(fade_dither_map->getOgreTexturePtr()->getName());\n }\n */\n\n counter++;\n /*\n tus = p->getTextureUnitState(counter++);\n if (purpose == GFX_GSL_PURPOSE_DECAL) {\n // Decals will never be rendered by Ogre::Pass.\n }\n */\n\n if (lighting) {\n for (unsigned i=0 ; i<3 ; ++i) {\n counter++;\n /* Using ogre auto shadow binding for now\n tus = p->getTextureUnitState(counter++);\n tus->setTextureName(ogre_sm->getShadowTexture(i)->getName());\n */\n }\n\n counter++;\n /* This never changes for now\n tus = p->getTextureUnitState(counter++);\n if (shadow_pcf_noise_map != nullptr) {\n tus->setTextureName(shadow_pcf_noise_map->getOgreTexturePtr()->getName());\n }\n */\n }\n}\n\nint GfxShader::bindGlobalTexturesRs (const GfxShaderGlobals &g, GfxGslPurpose purpose)\n{\n int counter = 0;\n const auto clamp = Ogre::TextureUnitState::TAM_CLAMP;\n const auto wrap = Ogre::TextureUnitState::TAM_WRAP;\n bool lighting = gfx_gasoline_does_lighting(purpose);\n\n if (lighting) {\n if (global_env_cube0 != nullptr && global_env_cube1 != nullptr) {\n // Both env cubes\n ogre_rs->_setTexture(counter, true, global_env_cube0->getOgreTexturePtr());\n ogre_rs->_setTextureUnitFiltering(counter, Ogre::FT_MIN, Ogre::FO_LINEAR);\n ogre_rs->_setTextureUnitFiltering(counter, Ogre::FT_MAG, Ogre::FO_LINEAR);\n ogre_rs->_setTextureUnitFiltering(counter, Ogre::FT_MIP, Ogre::FO_LINEAR);\n ogre_rs->_setTextureAddressingMode(\n counter, Ogre::TextureUnitState::UVWAddressingMode {wrap, wrap, wrap});\n counter++;\n ogre_rs->_setTexture(counter, true, global_env_cube1->getOgreTexturePtr());\n ogre_rs->_setTextureUnitFiltering(counter, Ogre::FT_MIN, Ogre::FO_LINEAR);\n ogre_rs->_setTextureUnitFiltering(counter, Ogre::FT_MAG, Ogre::FO_LINEAR);\n ogre_rs->_setTextureUnitFiltering(counter, Ogre::FT_MIP, Ogre::FO_LINEAR);\n ogre_rs->_setTextureAddressingMode(\n counter, Ogre::TextureUnitState::UVWAddressingMode {wrap, wrap, wrap});\n counter++;\n\n } else if (global_env_cube0 != nullptr) {\n // One env cube\n ogre_rs->_setTexture(counter, true, global_env_cube0->getOgreTexturePtr());\n ogre_rs->_setTextureUnitFiltering(counter, Ogre::FT_MIN, Ogre::FO_LINEAR);\n ogre_rs->_setTextureUnitFiltering(counter, Ogre::FT_MAG, Ogre::FO_LINEAR);\n ogre_rs->_setTextureUnitFiltering(counter, Ogre::FT_MIP, Ogre::FO_LINEAR);\n ogre_rs->_setTextureAddressingMode(\n counter, Ogre::TextureUnitState::UVWAddressingMode {wrap, wrap, wrap});\n counter++;\n\n ogre_rs->_setTexture(counter, false, \"\");\n counter++;\n\n } else if (global_env_cube1 != nullptr) {\n // Other env cube\n ogre_rs->_setTexture(counter, false, \"\");\n counter++;\n\n ogre_rs->_setTexture(counter, true, global_env_cube1->getOgreTexturePtr());\n ogre_rs->_setTextureUnitFiltering(counter, Ogre::FT_MIN, Ogre::FO_LINEAR);\n ogre_rs->_setTextureUnitFiltering(counter, Ogre::FT_MAG, Ogre::FO_LINEAR);\n ogre_rs->_setTextureUnitFiltering(counter, Ogre::FT_MIP, Ogre::FO_LINEAR);\n ogre_rs->_setTextureAddressingMode(\n counter, Ogre::TextureUnitState::UVWAddressingMode {wrap, wrap, wrap});\n counter++;\n } else {\n // No env cube\n ogre_rs->_setTexture(counter, false, \"\");\n counter++;\n\n ogre_rs->_setTexture(counter, false, \"\");\n counter++;\n }\n }\n \n\n if (fade_dither_map != nullptr) {\n ogre_rs->_setTexture(counter, true, fade_dither_map->getOgreTexturePtr());\n ogre_rs->_setTextureUnitFiltering(counter, Ogre::FT_MIN, Ogre::FO_POINT);\n ogre_rs->_setTextureUnitFiltering(counter, Ogre::FT_MAG, Ogre::FO_POINT);\n ogre_rs->_setTextureUnitFiltering(counter, Ogre::FT_MIP, Ogre::FO_NONE);\n ogre_rs->_setTextureAddressingMode(\n counter, Ogre::TextureUnitState::UVWAddressingMode {clamp, clamp, clamp});\n } else {\n ogre_rs->_setTexture(counter, false, \"\");\n }\n counter++;\n\n if (purpose == GFX_GSL_PURPOSE_DECAL) {\n ogre_rs->_setTexture(counter, true, g.pipe->getGBufferTexture(0));\n } else {\n ogre_rs->_setTexture(counter, false, \"\");\n }\n counter++;\n\n if (lighting) {\n for (unsigned i=0 ; i<3 ; ++i) {\n if (purpose == GFX_GSL_PURPOSE_CAST) {\n ogre_rs->_setTexture(counter, false, \"\");\n } else {\n ogre_rs->_setTexture(counter, true, ogre_sm->getShadowTexture(i));\n ogre_rs->_setTextureUnitFiltering(counter, Ogre::FT_MIN, Ogre::FO_POINT);\n ogre_rs->_setTextureUnitFiltering(counter, Ogre::FT_MAG, Ogre::FO_POINT);\n ogre_rs->_setTextureUnitFiltering(counter, Ogre::FT_MIP, Ogre::FO_NONE);\n ogre_rs->_setTextureAddressingMode(\n counter, Ogre::TextureUnitState::UVWAddressingMode {clamp, clamp, clamp});\n }\n counter++;\n }\n\n if (shadow_pcf_noise_map != nullptr) {\n ogre_rs->_setTexture(counter, true, shadow_pcf_noise_map->getOgreTexturePtr());\n ogre_rs->_setTextureUnitFiltering(counter, Ogre::FT_MIN, Ogre::FO_POINT);\n ogre_rs->_setTextureUnitFiltering(counter, Ogre::FT_MAG, Ogre::FO_POINT);\n ogre_rs->_setTextureUnitFiltering(counter, Ogre::FT_MIP, Ogre::FO_NONE);\n ogre_rs->_setTextureAddressingMode(\n counter, Ogre::TextureUnitState::UVWAddressingMode {clamp, clamp, clamp});\n } else {\n ogre_rs->_setTexture(counter, false, \"\");\n }\n counter++;\n }\n\n // CAUTION!!! These texture bindings must be in alphabetical order.\n\n return counter;\n\n}\n\n/*\nvoid GfxShaderInstance::rebuild (void)\n{\n \n}\n*/\n\nGfxShader *gfx_shader_make_or_reset (const std::string &name,\n const std::string &new_vertex_code,\n const std::string &new_dangs_code,\n const std::string &new_additional_code,\n const GfxGslRunParams &params,\n bool internal)\n{\n gfx_shader_check(name, new_vertex_code, new_dangs_code, new_additional_code, params, internal);\n GfxShader *shader;\n if (gfx_shader_has(name)) {\n shader = gfx_shader_get(name);\n shader->reset(params, new_vertex_code, new_dangs_code, new_additional_code, internal);\n // TODO: go through materials, checking them all\n } else {\n shader = new GfxShader(name, params, new_vertex_code, new_dangs_code, new_additional_code,\n internal);\n shader_db[name] = shader;\n }\n return shader;\n}\n\nGfxShader *gfx_shader_get (const std::string &name)\n{\n if (!gfx_shader_has(name)) GRIT_EXCEPT(\"Shader does not exist: \\\"\" + name + \"\\\"\");\n return shader_db[name];\n}\n\nbool gfx_shader_has (const std::string &name)\n{\n GfxShaderDB::iterator it = shader_db.find(name);\n if (it == shader_db.end()) return false;\n return true;\n}\n\nvoid gfx_shader_check (const std::string &name,\n const std::string &src_vertex,\n const std::string &src_dangs,\n const std::string &src_additional,\n const GfxGslRunParams &params,\n bool internal)\n{\n GfxGslMetadata md;\n md.params = params;\n md.d3d9 = gfx_d3d9();\n md.internal = internal;\n try {\n gfx_gasoline_check(src_vertex, src_dangs, src_additional, md);\n } catch (const Exception &e) {\n EXCEPT << name << \": \" << e.msg << ENDL;\n }\n}\n\n\n\nvoid gfx_shader_init (void)\n{\n}\n\nvoid gfx_shader_shutdown (void)\n{\n}\n\n\n" }, { "alpha_fraction": 0.5756238102912903, "alphanum_fraction": 0.5888643860816956, "avg_line_length": 26.018348693847656, "blob_id": "86b647455ab78f8f45c1394bb45c55b3652b9103", "content_id": "20669ad94e2f4f44daba0ffadd96df2d4c9c5416", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 5891, "license_type": "permissive", "max_line_length": 80, "num_lines": 218, "path": "/engine/linux/mouse_x11.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <sstream>\n\n#include <centralised_log.h>\n\n#include \"mouse_x11.h\"\n\n\nMouseX11::MouseX11(size_t window)\n{\n win = window;\n\n display = XOpenDisplay(0);\n APP_ASSERT(display);\n\n long event_mask = ButtonPressMask|ButtonReleaseMask|PointerMotionMask;\n event_mask |= FocusChangeMask;\n if (XSelectInput(display, win, event_mask) == BadWindow) {\n CERR << \"calling XSelectInput: BadWindow\" << std::endl;\n app_fatal();\n }\n\n Colormap colormap = DefaultColormap( display, DefaultScreen(display) );\n XColor black, dummy;\n XAllocNamedColor( display, colormap, \"black\", &black, &dummy );\n\n static char blank_cursor_raw[] = { 0, 0, 0, 0, 0, 0, 0, 0 };\n Pixmap pm =\n XCreateBitmapFromData(display, win, blank_cursor_raw, 8, 8);\n blankCursor =\n XCreatePixmapCursor(display, pm, pm, &black, &black, 0, 0);\n\n current_x = 0;\n current_y = 0;\n real_last_x = 0;\n real_last_y = 0;\n\n requested_grab = 0;\n requested_hide = 0;\n\n just_warped = false;\n}\n\nMouseX11::~MouseX11 (void)\n{\n if (display) {\n getEvents(NULL,NULL,NULL,NULL,NULL);\n XFreeCursor(display, blankCursor);\n XCloseDisplay(display);\n }\n}\n\nbool MouseX11::getEvents (std::vector<int> *clicks,\n int *x, int *y, int *rel_x, int *rel_y)\n{\n if (clicks) clicks->clear();\n // if there is no mouse grab in action, last_x = real_last_x\n // otherwise: last_x is where the app thinks the cursor is\n // real_last_x\n int last_x = current_x;\n int last_y = current_y;\n bool moved = false;\n\n // fetch window size info\n XWindowAttributes attr;\n XGetWindowAttributes(display,win,&attr);\n\n //Poll x11 for events\n XEvent event;\n while (XPending(display) > 0) {\n\n XNextEvent(display, &event);\n\n int mod = 1;\n\n switch (event.type) {\n\n case FocusIn:\n\n // re-establish grab if it is supposed to be in action\n if (requested_grab) setGrab(requested_grab);\n\n break;\n\n case MotionNotify:\n\n if (just_warped && event.xmotion.x==warped_x\n && event.xmotion.y==warped_y) {\n just_warped = false;\n // adjust the \"last\" position to the new\n // position so that it looks like the mouse\n // hasn't moved during the warp\n real_last_x = event.xmotion.x;\n real_last_y = event.xmotion.y;\n break;\n }\n\n if (requested_grab) {\n current_x += event.xmotion.x - real_last_x;\n current_y += event.xmotion.y - real_last_y;\n } else {\n current_x = event.xmotion.x;\n current_y = event.xmotion.y;\n }\n\n real_last_x = event.xmotion.x;\n real_last_y = event.xmotion.y;\n\n moved = true;\n\n if (requested_grab) {\n setPos(attr.width/2,attr.height/2);\n }\n\n break;\n\n case ButtonRelease:\n\n mod = -1;\n\n case ButtonPress:\n\n if (event.xbutton.button >= NUM_BUTTONS) break;\n\n enum Button from_x11[NUM_BUTTONS];\n from_x11[Button1] = MOUSE_LEFT;\n from_x11[Button2] = MOUSE_MIDDLE;\n from_x11[Button3] = MOUSE_RIGHT;\n from_x11[Button4] = MOUSE_SCROLL_UP;\n from_x11[Button5] = MOUSE_SCROLL_DOWN;\n\n if (clicks) {\n int code = from_x11[event.xbutton.button];\n clicks->push_back(mod*code);\n }\n\n break;\n\n }\n\n }\n\n if (x) *x = current_x;\n if (y) *y = attr.height - current_y - 1; // flip axis\n if (rel_x) *rel_x = current_x - last_x;\n if (rel_y) *rel_y = - (current_y - last_y); // flip axis\n\n return moved;\n}\n\nvoid MouseX11::setPos (int x, int y)\n{\n // fetch window size info\n XWindowAttributes attr;\n XGetWindowAttributes(display,win,&attr);\n\n y = attr.height - y - 1;\n\n XWarpPointer(display,None,win,0,0,0,0, x,y);\n warped_x = x;\n warped_y = y;\n just_warped = true;\n}\n\n\nvoid MouseX11::setHide (bool toggle)\n{\n requested_hide = toggle;\n if (toggle)\n XDefineCursor(display, win, blankCursor);\n else\n XUndefineCursor(display, win);\n}\n\nbool MouseX11::getHide (void)\n{\n return requested_hide;\n}\n\n\nvoid MouseX11::setGrab(bool toggle)\n{\n requested_grab = toggle;\n\n if (toggle) {\n XGrabPointer(display, win,\n True, 0,\n GrabModeAsync, GrabModeAsync,\n win, None, CurrentTime);\n } else {\n XUngrabPointer(display, CurrentTime);\n }\n}\n\nbool MouseX11::getGrab (void)\n{\n return requested_grab;\n}\n\n" }, { "alpha_fraction": 0.5289566516876221, "alphanum_fraction": 0.5419737696647644, "avg_line_length": 31.76133155822754, "blob_id": "5e65d7a6b2824a1831484aa567907d75a2d753b9", "content_id": "2f3bd981dae8371d9ead88e350447445a104af11", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 35415, "license_type": "permissive", "max_line_length": 139, "num_lines": 1081, "path": "/engine/physics/lua_wrappers_physics.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <limits>\n\n#include \"../gfx/gfx_ranged_instances.h\"\n#include \"../lua_wrappers_gritobj.h\"\n#include \"../main.h\"\n#include \"../path_util.h\"\n#include \"../lua_wrappers_disk_resource.h\"\n\n#include \"../gfx/gfx.h\"\n#include \"../gfx/lua_wrappers_gfx.h\"\n\n#include \"physics_world.h\"\n#include \"collision_mesh.h\"\n#include \"lua_wrappers_physics.h\"\n\n\n// Sweep Callback {{{\n\nstruct SweepResult { RigidBody *rb; float dist; Vector3 n; int material; };\ntypedef std::vector<SweepResult> SweepResults;\n\nstatic void push_sweep_result (lua_State *L, const SweepResult &r)\n{\n lua_pushnumber(L, r.dist);\n push_rbody(L, r.rb);\n // normal is documented as being object space but is actually world space\n Vector3 normal = /*r.rb->getOrientation()* */r.n.normalisedCopy();\n push_v3(L, normal);\n push_string(L, phys_mats.getMaterial(r.material)->name);\n}\n\nclass LuaSweepCallback : public SweepCallback {\n public: \n LuaSweepCallback (bool nearest_only, unsigned long flags)\n : nearestOnly(nearest_only), ignoreDynamic((flags & 0x1) != 0)\n { }\n\n virtual void result (RigidBody &rb, float dist, const Vector3 &n, int m)\n {\n if (ignoreDynamic && rb.getMass()>0) return;\n if (blacklist.find(&rb) != blacklist.end()) return;\n SweepResult r;\n r.rb = &rb;\n r.dist = dist;\n r.n = n;\n r.material = m;\n results.push_back(r);\n }\n\n void pushResults (lua_State *L, int func_index, int err_handler)\n {\n if (nearestOnly) {\n if (results.size()==0) return;\n SweepResult nearest;\n nearest.material = 0; // Not neessary, but avoids a compler warning.\n nearest.rb = nullptr; // Not neessary, but avoids a compler warning.\n nearest.dist = FLT_MAX;\n for (const auto &r : results) {\n if (r.dist <= nearest.dist) nearest = r;\n }\n lua_pushvalue(L, func_index);\n push_sweep_result(L, nearest);\n int status = lua_pcall(L, 4, 0, err_handler);\n if (status) {\n lua_pop(L, 1); // error message, already printed\n }\n } else {\n lua_checkstack(L, results.size() * 4);\n for (const auto &r : results) {\n lua_pushvalue(L, func_index);\n push_sweep_result(L, r);\n int status = lua_pcall(L, 4, 0, err_handler);\n if (status) {\n lua_pop(L, 1); // error message, already printed\n break;\n }\n }\n }\n }\n\n int pushResults (lua_State *L)\n {\n\n if (nearestOnly) {\n if (results.size()==0) return 0;\n SweepResult nearest;\n nearest.dist = FLT_MAX;\n nearest.material = 0; // Not neessary, but avoids a compler warning.\n nearest.rb = nullptr; // Not neessary, but avoids a compler warning.\n for (const auto &r : results) {\n if (r.dist <= nearest.dist) nearest = r;\n }\n push_sweep_result(L, nearest);\n return 4;\n } else {\n lua_checkstack(L, results.size() * 4);\n for (const auto &r : results) {\n push_sweep_result(L, r);\n }\n return results.size() * 4;\n }\n }\n\n std::set<RigidBody *> blacklist;\n SweepResults results;\n bool nearestOnly;\n bool ignoreDynamic;\n};\n\n// }}}\n\n\n#define RBODY_TAG \"Grit/RigidBody\"\n\n\n// RIGID_BODY ============================================================== {{{\n\nvoid push_rbody (lua_State *L, RigidBody *self)\n{\n if (self == nullptr) {\n lua_pushnil(L);\n } else {\n self->incRefCount();\n push(L, self, RBODY_TAG);\n }\n}\n\nstatic int rbody_gc (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n GET_UD_MACRO(RigidBody, self, 1, RBODY_TAG);\n self.decRefCount(L);\n return 0;\nTRY_END\n}\n\nstatic int rbody_scatter (lua_State *L)\n{\nTRY_START\n check_args(L, 11);\n GET_UD_MACRO(RigidBody, self, 1, RBODY_TAG);\n std::string mat = check_path(L, 2);\n SimpleTransform world_trans(self.getPosition(), self.getOrientation());\n float density = check_float(L, 3);\n float min_slope = check_float(L, 4);\n float max_slope = check_float(L, 5);\n float min_elevation = check_float(L, 6);\n float max_elevation = check_float(L, 7);\n bool no_z = check_bool(L, 8);\n bool rotate = check_bool(L, 9);\n bool align_slope = check_bool(L, 10);\n unsigned seed = check_t<unsigned>(L, 11);\n\n std::vector<SimpleTransform> r;\n self.colMesh->scatter(phys_mats.getMaterial(mat)->id,\n world_trans, density, min_slope, max_slope, min_elevation,\n max_elevation, no_z, rotate, align_slope, seed,\n r);\n\n lua_newtable(L);\n for (size_t j=0 ; j<r.size(); ++j) {\n const Quaternion &q = r[j].quat;\n const Vector3 &p = r[j].pos;\n lua_pushnumber(L, p.x);\n lua_rawseti(L, -2, 7*j+1);\n lua_pushnumber(L, p.y);\n lua_rawseti(L, -2, 7*j+1+1);\n lua_pushnumber(L, p.z);\n lua_rawseti(L, -2, 7*j+2+1);\n lua_pushnumber(L, q.w);\n lua_rawseti(L, -2, 7*j+3+1);\n lua_pushnumber(L, q.x);\n lua_rawseti(L, -2, 7*j+4+1);\n lua_pushnumber(L, q.y);\n lua_rawseti(L, -2, 7*j+5+1);\n lua_pushnumber(L, q.z);\n lua_rawseti(L, -2, 7*j+6+1);\n }\n\n return 1;\nTRY_END\n}\n\nstatic int rbody_ranged_scatter (lua_State *L)\n{\nTRY_START\n check_args(L, 12);\n GET_UD_MACRO(RigidBody, self, 1, RBODY_TAG);\n std::string mat = check_path(L, 2);\n GET_UD_MACRO(GfxRangedInstancesPtr, gri, 3, GFXRANGEDINSTANCES_TAG);\n float density = check_float(L, 4);\n float min_slope = check_float(L, 5);\n float max_slope = check_float(L, 6);\n float min_elevation = check_float(L, 7);\n float max_elevation = check_float(L, 8);\n bool no_z = check_bool(L, 9);\n bool rotate = check_bool(L, 10);\n bool align_slope = check_bool(L, 11);\n unsigned seed = check_t<unsigned>(L, 12);\n\n SimpleTransform world_trans(self.getPosition(), self.getOrientation());\n\n self.colMesh->scatter(phys_mats.getMaterial(mat)->id,\n world_trans, density, min_slope, max_slope, min_elevation,\n max_elevation, no_z, rotate, align_slope, seed,\n *gri);\n\n return 0;\nTRY_END\n}\n\nstatic int rbody_force (lua_State *L)\n{\nTRY_START\n check_args(L, 3);\n GET_UD_MACRO(RigidBody, self, 1, RBODY_TAG);\n Vector3 force = check_v3(L, 2);\n Vector3 wpos = check_v3(L, 3);\n const Vector3 &pos = self.getPosition();\n self.force(force, wpos-pos);\n return 0;\nTRY_END\n}\n\nstatic int rbody_impulse (lua_State *L)\n{\nTRY_START\n check_args(L, 3);\n GET_UD_MACRO(RigidBody, self, 1, RBODY_TAG);\n Vector3 impulse = check_v3(L, 2);\n Vector3 wpos = check_v3(L, 3);\n const Vector3 &pos = self.getPosition();\n self.impulse(impulse, wpos-pos);\n return 0;\nTRY_END\n}\n\n\nstatic int rbody_torque_impulse (lua_State *L)\n{\nTRY_START\n check_args(L, 2);\n GET_UD_MACRO(RigidBody, self, 1, RBODY_TAG);\n Vector3 torque = check_v3(L, 2);\n self.torqueImpulse(torque);\n return 0;\nTRY_END\n}\n\n\nstatic int rbody_torque (lua_State *L)\n{\nTRY_START\n check_args(L, 2);\n GET_UD_MACRO(RigidBody, self, 1, RBODY_TAG);\n Vector3 torque = check_v3(L, 2);\n self.torque(torque);\n return 0;\nTRY_END\n}\n\nstatic int rbody_get_part_enabled (lua_State *L)\n{\nTRY_START\n check_args(L, 2);\n GET_UD_MACRO(RigidBody, self, 1, RBODY_TAG);\n int i = (int)check_int(L, 2, 0, self.getNumElements()-1);\n lua_pushboolean(L, self.getElementEnabled(i));\n return 1;\nTRY_END\n}\n\nstatic int rbody_set_part_enabled (lua_State *L)\n{\nTRY_START\n check_args(L, 3);\n GET_UD_MACRO(RigidBody, self, 1, RBODY_TAG);\n int i = (int)check_int(L, 2, 0, self.getNumElements()-1);\n bool b = check_bool(L, 3);\n self.setElementEnabled(i, b);\n return 0;\nTRY_END\n}\n\nstatic int rbody_get_part_position_initial (lua_State *L)\n{\nTRY_START\n check_args(L, 2);\n GET_UD_MACRO(RigidBody, self, 1, RBODY_TAG);\n int i = (int)check_int(L, 2, 0, self.getNumElements()-1);\n Vector3 v = self.getElementPositionMaster(i);\n lua_pushnumber(L, v.x); lua_pushnumber(L, v.y); lua_pushnumber(L, v.z);\n return 3;\nTRY_END\n}\n\nstatic int rbody_get_part_position_offset (lua_State *L)\n{\nTRY_START\n check_args(L, 2);\n GET_UD_MACRO(RigidBody, self, 1, RBODY_TAG);\n int i = (int)check_int(L, 2, 0, self.getNumElements()-1);\n Vector3 v = self.getElementPositionOffset(i);\n lua_pushnumber(L, v.x); lua_pushnumber(L, v.y); lua_pushnumber(L, v.z);\n return 3;\nTRY_END\n}\n\nstatic int rbody_set_part_position_offset (lua_State *L)\n{\nTRY_START\n check_args(L, 3);\n GET_UD_MACRO(RigidBody, self, 1, RBODY_TAG);\n int i = (int)check_int(L, 2, 0, self.getNumElements()-1);\n Vector3 v = check_v3(L, 3);\n self.setElementPositionOffset(i, v);\n return 0;\nTRY_END\n}\n\nstatic int rbody_get_part_orientation_initial (lua_State *L)\n{\nTRY_START\n check_args(L, 2);\n GET_UD_MACRO(RigidBody, self, 1, RBODY_TAG);\n int i = (int)check_int(L, 2, 0, self.getNumElements()-1);\n Quaternion q = self.getElementOrientationMaster(i);\n lua_pushnumber(L, q.w); lua_pushnumber(L, q.x); lua_pushnumber(L, q.y); lua_pushnumber(L, q.z);\n return 4;\nTRY_END\n}\n\nstatic int rbody_get_part_orientation_offset (lua_State *L)\n{\nTRY_START\n check_args(L, 2);\n GET_UD_MACRO(RigidBody, self, 1, RBODY_TAG);\n int i = (int)check_int(L, 2, 0, self.getNumElements()-1);\n Quaternion q = self.getElementOrientationOffset(i);\n lua_pushnumber(L, q.w); lua_pushnumber(L, q.x); lua_pushnumber(L, q.y); lua_pushnumber(L, q.z);\n return 4;\nTRY_END\n}\n\nstatic int rbody_set_part_orientation_offset (lua_State *L)\n{\nTRY_START\n check_args(L, 3);\n GET_UD_MACRO(RigidBody, self, 1, RBODY_TAG);\n int i = (int)check_int(L, 2, 0, self.getNumElements()-1);\n Quaternion q = check_quat(L, 3);\n self.setElementOrientationOffset(i, q);\n return 0;\nTRY_END\n}\n\n\nstatic void init_cast_blacklist (lua_State *L, int base_line, LuaSweepCallback &lcb)\n{\n int blacklist_number = lua_gettop(L) - base_line;\n for (int i=1 ; i<=blacklist_number ; ++i) {\n GET_UD_MACRO(RigidBody, black, base_line+i, RBODY_TAG);\n lcb.blacklist.insert(&black);\n }\n}\n\nstatic int global_physics_cast_ray (lua_State *L)\n{\nTRY_START\n int base_line = 4;\n check_args_min(L, base_line);\n\n Vector3 start = check_v3(L, 1);\n Vector3 ray = check_v3(L, 2);\n bool nearest_only = check_bool(L, 3);\n unsigned long flags = check_t<unsigned long>(L, 4);\n\n LuaSweepCallback lcb(nearest_only, flags);\n init_cast_blacklist(L, base_line, lcb);\n\n physics_ray(start, start+ray, lcb);\n\n return lcb.pushResults(L);\n\nTRY_END\n}\n\n\nstatic int global_physics_sweep_sphere (lua_State *L)\n{\nTRY_START\n int base_line = 5;\n check_args_min(L, base_line);\n\n float radius = check_float(L, 1);\n Vector3 start = check_v3(L, 2);\n Vector3 ray = check_v3(L, 3);\n bool nearest_only = check_bool(L, 4);\n unsigned long flags = check_t<unsigned long>(L, 5);\n\n LuaSweepCallback lcb(nearest_only, flags);\n init_cast_blacklist(L, base_line, lcb);\n\n physics_sweep_sphere(start, start+ray, lcb, radius);\n\n return lcb.pushResults(L);\n\nTRY_END\n}\n\n\nstatic int global_physics_sweep_box (lua_State *L)\n{\nTRY_START\n int base_line = 6;\n check_args_min(L, base_line);\n\n Vector3 size = check_v3(L, 1);\n Quaternion q = check_quat(L, 2);\n Vector3 start = check_v3(L, 3);\n Vector3 ray = check_v3(L, 4);\n bool nearest_only = check_bool(L, 5);\n unsigned long flags = check_t<unsigned long>(L, 6);\n\n LuaSweepCallback lcb(nearest_only, flags);\n init_cast_blacklist(L, base_line, lcb);\n\n physics_sweep_box(start, q, start+ray, lcb, size);\n\n return lcb.pushResults(L);\n\nTRY_END\n}\n\n\nstatic int global_physics_sweep_col_mesh (lua_State *L)\n{\nTRY_START\n int base_line = 7;\n check_args_min(L, base_line);\n\n std::string col_mesh_name = check_path(L, 1);\n DiskResource *col_mesh_ = disk_resource_get_or_make(col_mesh_name);\n CollisionMesh *col_mesh = dynamic_cast<CollisionMesh*>(col_mesh_);\n Quaternion q = check_quat(L, 2);\n Vector3 start = check_v3(L, 3);\n Vector3 ray = check_v3(L, 4);\n bool nearest_only = check_bool(L, 5);\n unsigned long flags = check_t<unsigned long>(L, 6);\n if (lua_type(L, 7) != LUA_TFUNCTION)\n my_lua_error(L, \"Parameter 5 should be a function.\");\n\n LuaSweepCallback lcb(nearest_only, flags);\n init_cast_blacklist(L, base_line, lcb);\n\n physics_sweep_col_mesh(start, q, start + ray, q, lcb, col_mesh);\n\n push_cfunction(L, my_lua_error_handler);\n int error_handler = lua_gettop(L);\n\n lcb.pushResults(L, 7, error_handler);\n return 0;\nTRY_END\n}\n\n\nstatic int global_physics_sweep_cylinder (lua_State *L)\n{\nTRY_START\n int base_line = 7;\n check_args_min(L, base_line);\n\n float radius = check_float(L, 1);\n float height = check_float(L, 2);\n Quaternion q = check_quat(L, 3);\n Vector3 start = check_v3(L, 4);\n Vector3 ray = check_v3(L, 5);\n bool nearest_only = check_bool(L, 6);\n unsigned long flags = check_t<unsigned long>(L, 7);\n\n LuaSweepCallback lcb(nearest_only, flags);\n init_cast_blacklist(L, base_line, lcb);\n\n physics_sweep_cylinder(start, q, start+ray, lcb, radius, height);\n\n return lcb.pushResults(L);\n\nTRY_END\n}\n\n\n\n\nstatic int rbody_local_to_world (lua_State *L)\n{\nTRY_START\n check_args(L, 2);\n GET_UD_MACRO(RigidBody, self, 1, RBODY_TAG);\n Vector3 a = check_v3(L, 2);\n Vector3 result = self.getPosition() + self.getOrientation() * a;\n push_v3(L, result);\n return 1;\nTRY_END\n}\n\nstatic int rbody_world_to_local (lua_State *L)\n{\nTRY_START\n check_args(L, 2);\n GET_UD_MACRO(RigidBody, self, 1, RBODY_TAG);\n Vector3 a = check_v3(L, 2);\n Vector3 result = self.getOrientation().inverse() * (a - self.getPosition());\n push_v3(L, result);\n return 1;\nTRY_END\n}\n\n\nstatic int rbody_local_vel (lua_State *L)\n{\nTRY_START\n check_args(L, 3);\n GET_UD_MACRO(RigidBody, self, 1, RBODY_TAG);\n Vector3 pos = check_v3(L, 2);\n bool world_space = check_bool(L, 3);\n Vector3 local_pos = pos;\n if (world_space) {\n local_pos -= self.getPosition();\n }\n Vector3 local_vel = self.getLocalVelocity(local_pos);\n push_v3(L, local_vel);\n return 1;\nTRY_END\n}\n\n\nstatic int rbody_activate (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n GET_UD_MACRO(RigidBody, self, 1, RBODY_TAG);\n self.activate();\n return 0;\nTRY_END\n}\n\n\nstatic int rbody_deactivate (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n GET_UD_MACRO(RigidBody, self, 1, RBODY_TAG);\n self.deactivate();\n return 0;\nTRY_END\n}\n\n\nstatic int rbody_destroy (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n GET_UD_MACRO(RigidBody, self, 1, RBODY_TAG);\n self.destroy(L);\n return 0;\nTRY_END\n}\n\n\n\nTOSTRING_ADDR_MACRO (rbody, RigidBody, RBODY_TAG)\n\n\nstatic int rbody_index (lua_State *L)\n{\nTRY_START\n check_args(L, 2);\n GET_UD_MACRO(RigidBody, self, 1, RBODY_TAG);\n const char *key = luaL_checkstring(L, 2);\n if (!::strcmp(key, \"force\")) {\n push_cfunction(L, rbody_force);\n } else if (!::strcmp(key, \"impulse\")) {\n push_cfunction(L, rbody_impulse);\n } else if (!::strcmp(key, \"torque\")) {\n push_cfunction(L, rbody_torque);\n } else if (!::strcmp(key, \"torqueImpulse\")) {\n push_cfunction(L, rbody_torque_impulse);\n\n } else if (!::strcmp(key, \"procObjMaterials\")) {\n std::vector<int> mats;\n self.colMesh->getProcObjMaterials(mats);\n lua_createtable(L, mats.size(), 0);\n for (size_t j=0 ; j<mats.size(); ++j) {\n lua_pushstring(L, phys_mats.getMaterial(mats[j])->name.c_str());\n lua_rawseti(L, -2, j+1);\n }\n } else if (!::strcmp(key, \"scatter\")) {\n push_cfunction(L, rbody_scatter);\n } else if (!::strcmp(key, \"rangedScatter\")) {\n push_cfunction(L, rbody_ranged_scatter);\n\n } else if (!::strcmp(key, \"activate\")) {\n push_cfunction(L, rbody_activate);\n } else if (!::strcmp(key, \"deactivate\")) {\n push_cfunction(L, rbody_deactivate);\n } else if (!::strcmp(key, \"destroy\")) {\n push_cfunction(L, rbody_destroy);\n\n } else if (!::strcmp(key, \"linearSleepThreshold\")) {\n lua_pushnumber(L, self.getLinearSleepThreshold());\n } else if (!::strcmp(key, \"angularSleepThreshold\")) {\n lua_pushnumber(L, self.getAngularSleepThreshold());\n\n } else if (!::strcmp(key, \"worldPosition\")) {\n push_v3(L, self.getPosition());\n } else if (!::strcmp(key, \"worldOrientation\")) {\n push_quat(L, self.getOrientation());\n\n } else if (!::strcmp(key, \"localToWorld\")) {\n push_cfunction(L, rbody_local_to_world);\n } else if (!::strcmp(key, \"worldToLocal\")) {\n push_cfunction(L, rbody_world_to_local);\n\n } else if (!::strcmp(key, \"linearVelocity\")) {\n push_v3(L, self.getLinearVelocity());\n } else if (!::strcmp(key, \"angularVelocity\")) {\n push_v3(L, self.getAngularVelocity());\n } else if (!::strcmp(key, \"getLocalVelocity\")) {\n push_cfunction(L, rbody_local_vel);\n\n } else if (!::strcmp(key, \"contactProcessingThreshold\")) {\n lua_pushnumber(L, self.getContactProcessingThreshold());\n\n } else if (!::strcmp(key, \"linearDamping\")) {\n lua_pushnumber(L, self.getLinearDamping());\n } else if (!::strcmp(key, \"angularDamping\")) {\n lua_pushnumber(L, self.getAngularDamping());\n\n } else if (!::strcmp(key, \"mass\")) {\n lua_pushnumber(L, self.getMass());\n } else if (!::strcmp(key, \"inertia\")) {\n push_v3(L, self.getInertia());\n } else if (!::strcmp(key, \"ghost\")) {\n lua_pushboolean(L, self.getGhost());\n\n } else if (!::strcmp(key, \"numParts\")) {\n lua_pushnumber(L, self.getNumElements());\n } else if (!::strcmp(key, \"getPartEnabled\")) {\n push_cfunction(L, rbody_get_part_enabled);\n } else if (!::strcmp(key, \"setPartEnabled\")) {\n push_cfunction(L, rbody_set_part_enabled);\n } else if (!::strcmp(key, \"getPartPositionInitial\")) {\n push_cfunction(L, rbody_get_part_position_initial);\n } else if (!::strcmp(key, \"getPartPositionOffset\")) {\n push_cfunction(L, rbody_get_part_position_offset);\n } else if (!::strcmp(key, \"setPartPositionOffset\")) {\n push_cfunction(L, rbody_set_part_position_offset);\n } else if (!::strcmp(key, \"getPartOrientationInitial\")) {\n push_cfunction(L, rbody_get_part_orientation_initial);\n } else if (!::strcmp(key, \"getPartOrientationOffset\")) {\n push_cfunction(L, rbody_get_part_orientation_offset);\n } else if (!::strcmp(key, \"setPartOrientationOffset\")) {\n push_cfunction(L, rbody_set_part_orientation_offset);\n\n } else if (!::strcmp(key, \"meshName\")) {\n push_string(L, self.colMesh->getName());\n\n } else if (!::strcmp(key, \"owner\")) {\n if (self.owner.isNull()) {\n lua_pushnil(L);\n } else {\n push_gritobj(L, self.owner);\n }\n\n } else if (!::strcmp(key, \"updateCallback\")) {\n self.updateCallbackPtr.push(L);\n } else if (!::strcmp(key, \"stepCallback\")) {\n self.stepCallbackPtr.push(L);\n } else if (!::strcmp(key, \"collisionCallback\")) {\n self.collisionCallbackPtr.push(L);\n } else if (!::strcmp(key, \"stabiliseCallback\")) {\n self.stabiliseCallbackPtr.push(L);\n } else {\n my_lua_error(L, \"Not a readable RigidBody member: \"+std::string(key));\n }\n return 1;\nTRY_END\n}\n\nstatic int rbody_newindex (lua_State *L)\n{\nTRY_START\n check_args(L, 3);\n GET_UD_MACRO(RigidBody, self, 1, RBODY_TAG);\n const char *key = luaL_checkstring(L, 2);\n if (!::strcmp(key, \"linearVelocity\")) {\n Vector3 v = check_v3(L, 3);\n self.setLinearVelocity(v);\n } else if (!::strcmp(key, \"angularVelocity\")) {\n Vector3 v = check_v3(L, 3);\n self.setAngularVelocity(v);\n } else if (!::strcmp(key, \"worldPosition\")) {\n Vector3 v = check_v3(L, 3);\n self.setPosition(v);\n } else if (!::strcmp(key, \"worldOrientation\")) {\n Quaternion v = check_quat(L, 3);\n self.setOrientation(v);\n } else if (!::strcmp(key, \"contactProcessingThreshold\")) {\n float v = check_float(L, 3);\n self.setContactProcessingThreshold(v);\n } else if (!::strcmp(key, \"linearDamping\")) {\n float v = check_float(L, 3);\n self.setLinearDamping(v);\n } else if (!::strcmp(key, \"angularDamping\")) {\n float v = check_float(L, 3);\n self.setAngularDamping(v);\n } else if (!::strcmp(key, \"linearSleepThreshold\")) {\n float v = check_float(L, 3);\n self.setLinearSleepThreshold(v);\n } else if (!::strcmp(key, \"angularSleepThreshold\")) {\n float v = check_float(L, 3);\n self.setAngularSleepThreshold(v);\n } else if (!::strcmp(key, \"mass\")) {\n float v = check_float(L, 3);\n self.setMass(v);\n } else if (!::strcmp(key, \"ghost\")) {\n bool v = check_bool(L, 3);\n self.setGhost(v);\n } else if (!::strcmp(key, \"updateCallback\")) {\n self.updateCallbackPtr.set(L);\n } else if (!::strcmp(key, \"stepCallback\")) {\n self.stepCallbackPtr.set(L);\n } else if (!::strcmp(key, \"collisionCallback\")) {\n self.collisionCallbackPtr.set(L);\n } else if (!::strcmp(key, \"stabiliseCallback\")) {\n self.stabiliseCallbackPtr.set(L);\n } else if (!::strcmp(key, \"inertia\")) {\n Vector3 v = check_v3(L, 3);\n self.setInertia(v);\n } else if (!::strcmp(key, \"owner\")) {\n if (lua_isnil(L, 3)) {\n self.owner.setNull();\n } else {\n GET_UD_MACRO(GritObjectPtr, v, 3, GRITOBJ_TAG);\n self.owner = v;\n }\n\n } else {\n my_lua_error(L, \"Not a writeable RigidBody member: \"+std::string(key));\n }\n return 0;\nTRY_END\n}\n\nEQ_PTR_MACRO(RigidBody, rbody, RBODY_TAG)\n\nMT_MACRO_NEWINDEX(rbody);\n\n//}}}\n\n\nstatic int global_physics_draw (lua_State *L)\n{\nTRY_START\n check_args(L, 0);\n physics_draw();\n return 0;\nTRY_END\n}\n\nclass LuaTestCallback : public TestCallback {\n public:\n\n void result (RigidBody *body, const Vector3 &pos, const Vector3 &wpos,\n const Vector3 &normal, float penetration, int m)\n {\n resultMap[body].push_back(Result(pos, wpos, normal, penetration, m));\n }\n\n void pushResults (lua_State *L, int func_index, int err_handler)\n {\n for (ResultMap::iterator i=resultMap.begin(), i_=resultMap.end() ; i!=i_ ; ++i) {\n RigidBody *body = i->first;\n Results &results = i->second;\n for (Results::iterator j=results.begin(), j_=results.end() ; j!=j_ ; ++j) {\n if (body->destroyed()) continue;\n lua_pushvalue(L, func_index);\n push_rbody(L, body);\n lua_pushnumber(L, results.size());\n push_v3(L, j->pos);\n push_v3(L, j->wpos);\n push_v3(L, j->normal);\n lua_pushnumber(L, j->penetration);\n push_string(L, phys_mats.getMaterial(j->m)->name);\n int status = lua_pcall(L, 7, 0, err_handler);\n if (status) {\n lua_pop(L, 1); // error message, already printed\n break;\n }\n }\n }\n }\n\n protected:\n\n struct Result {\n Result (Vector3 pos_, Vector3 wpos_,\n Vector3 normal_, float penetration_, int m_)\n : pos(pos_), wpos(wpos_), normal(normal_),\n penetration(penetration_), m(m_)\n { }\n Vector3 pos;\n Vector3 wpos;\n Vector3 normal;\n float penetration;\n int m;\n };\n\n typedef std::vector<Result> Results;\n typedef std::map<RigidBody*, Results > ResultMap;\n ResultMap resultMap;\n};\n\nstatic int global_physics_test (lua_State *L)\n{\nTRY_START\n LuaTestCallback lcb;\n push_cfunction(L, my_lua_error_handler);\n int error_handler = lua_gettop(L);\n if (lua_gettop(L)==5) {\n float radius = lua_tonumber(L, 1);\n Vector3 pos = check_v3(L, 2);\n bool only_dyn = check_bool(L, 3);\n if (lua_type(L, 4) != LUA_TFUNCTION)\n my_lua_error(L, \"Parameter 4 should be a function.\");\n\n physics_test_sphere(radius, pos, only_dyn, lcb);\n lcb.pushResults(L, 4, error_handler);\n } else {\n check_args(L, 6);\n std::string col_mesh_name = check_path(L, 1);\n DiskResource *col_mesh_ = disk_resource_get_or_make(col_mesh_name);\n CollisionMesh *col_mesh = dynamic_cast<CollisionMesh*>(col_mesh_);\n if (col_mesh==NULL) my_lua_error(L, \"Not a collision mesh: \\\"\"+col_mesh_name+\"\\\"\");\n if (!col_mesh->isLoaded()) my_lua_error(L, \"Not loaded: \\\"\"+col_mesh_name+\"\\\"\");\n Vector3 pos = check_v3(L, 2);\n Quaternion quat = check_quat(L, 3);\n bool only_dyn = check_bool(L, 4);\n if (lua_type(L, 5) != LUA_TFUNCTION)\n my_lua_error(L, \"Parameter 5 should be a function.\");\n\n physics_test(col_mesh, pos, quat, only_dyn, lcb);\n lcb.pushResults(L, 5, error_handler);\n }\n lua_pop(L, 1); // error handler\n return 0;\nTRY_END\n}\n\nstatic int global_physics_update (lua_State *L)\n{\nTRY_START\n check_args(L, 0);\n physics_update(L);\n return 0;\nTRY_END\n}\n\nstatic int global_physics_update_graphics (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n float extrapolate = check_float(L, 1);\n physics_update_graphics(L, extrapolate);\n return 0;\nTRY_END\n}\n\nstatic int global_physics_body_make (lua_State *L)\n{\nTRY_START\n check_args(L, 3);\n std::string n = check_path(L, 1);\n Vector3 pos = check_v3(L, 2);\n Quaternion quat = check_quat(L, 3);\n push_rbody(L, new RigidBody(n, pos, quat));\n return 1;\nTRY_END\n}\n\nstatic int global_physics_get_gravity (lua_State *L)\n{\nTRY_START\n check_args(L, 0);\n Vector3 gravity = Vector3(physics_option(PHYSICS_GRAVITY_X), physics_option(PHYSICS_GRAVITY_Y), physics_option(PHYSICS_GRAVITY_Z));\n push_v3(L, gravity);\n return 1;\nTRY_END\n}\n\n\nstatic int global_physics_option_reset (lua_State *L)\n{\nTRY_START\n check_args(L, 0);\n physics_option_reset();\n return 0;\nTRY_END\n}\n\nstatic int global_physics_option (lua_State *L)\n{\nTRY_START\n if (lua_gettop(L)==2) {\n std::string opt = check_string(L, 1);\n int t;\n PhysicsBoolOption o0;\n PhysicsIntOption o1;\n PhysicsFloatOption o2;\n physics_option_from_string(opt, t, o0, o1, o2);\n switch (t) {\n case -1: my_lua_error(L, \"Unrecognised physics option: \\\"\"+opt+\"\\\"\");\n case 0: physics_option(o0, check_bool(L, 2)); break;\n case 1: physics_option(o1, check_t<int>(L, 2)); break;\n case 2: physics_option(o2, check_float(L, 2)); break;\n default: my_lua_error(L, \"Unrecognised type from physics_option_from_string\");\n }\n return 0;\n } else {\n check_args(L, 1);\n std::string opt = check_string(L, 1);\n int t;\n PhysicsBoolOption o0;\n PhysicsIntOption o1;\n PhysicsFloatOption o2;\n physics_option_from_string(opt, t, o0, o1, o2);\n switch (t) {\n case -1: my_lua_error(L, \"Unrecognised physics option: \\\"\"+opt+\"\\\"\");\n case 0: lua_pushboolean(L, physics_option(o0)); break;\n case 1: lua_pushnumber(L, physics_option(o1)); break;\n case 2: lua_pushnumber(L, physics_option(o2)); break;\n default: my_lua_error(L, \"Unrecognised type from physics_option_from_string\");\n }\n return 1;\n }\nTRY_END\n}\n\n\nstatic int global_physics_set_material (lua_State *L)\n{\nTRY_START\n check_args(L, 2);\n std::string name = check_path(L, 1);\n unsigned char interaction_group = check_t<unsigned char>(L, 2);\n phys_mats.setMaterial(name, interaction_group);\n return 0;\nTRY_END\n}\n\nstatic int global_physics_get_material (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n std::string name = check_path(L, 1);\n lua_pushnumber(L, phys_mats.getMaterial(name)->interactionGroup);\n return 1;\nTRY_END\n}\n\nstatic int global_physics_set_interaction_groups (lua_State *L)\n{\nTRY_START\n check_args(L, 2);\n if (!lua_istable(L, 1))\n my_lua_error(L, \"Second parameter should be a table\");\n if (!lua_istable(L, 2))\n my_lua_error(L, \"Third parameter should be a table\");\n\n int counter1 = 0;\n for (lua_pushnil(L) ; lua_next(L, 1)!=0 ; lua_pop(L, 1)) {\n counter1++;\n }\n int counter2 = 0;\n for (lua_pushnil(L) ; lua_next(L, 2)!=0 ; lua_pop(L, 1)) {\n counter2++;\n }\n\n if (counter1 != counter2) {\n my_lua_error(L, \"Tables were of different sizes\");\n }\n\n int counter = counter1;\n\n int num = int(sqrtf(float(counter))+0.5f);\n if (num*num != counter) {\n my_lua_error(L, \"Table was not a square (e.g. 4, 16, 25, etc, elements)\");\n }\n \n Interactions v;\n v.resize(counter);\n counter = 0;\n for (lua_pushnil(L) ; lua_next(L, 1)!=0 ; lua_pop(L, 1)) {\n float f = check_float(L, -1);\n v[counter].friction = f;\n counter++;\n }\n counter = 0;\n for (lua_pushnil(L) ; lua_next(L, 2)!=0 ; lua_pop(L, 1)) {\n float f = check_float(L, -1);\n v[counter].restitution = f;\n counter++;\n }\n\n // reflect the other half of the square into place\n for (int ig0=0 ; ig0<num ; ++ig0) {\n for (int ig1=ig0+1 ; ig1<num ; ++ig1) {\n int code_from = ig1*num + ig0;\n int code_to = ig0*num + ig1;\n v[code_to].friction = v[code_from].friction;\n v[code_to].restitution = v[code_from].restitution;\n }\n }\n\n phys_mats.setInteractionGroups(num, v);\n\n return 0;\nTRY_END\n}\n\n\nstatic const luaL_reg global[] = {\n {\"physics_get_material\", global_physics_get_material},\n {\"physics_set_material\", global_physics_set_material},\n {\"physics_set_interaction_groups\", global_physics_set_interaction_groups},\n {\"physics_draw\", global_physics_draw},\n {\"physics_test\", global_physics_test},\n\n {\"physics_update\", global_physics_update},\n {\"physics_update_graphics\", global_physics_update_graphics},\n\n {\"physics_body_make\", global_physics_body_make},\n {\"physics_get_gravity\", global_physics_get_gravity},\n {\"physics_option_reset\", global_physics_option_reset},\n {\"physics_option\", global_physics_option},\n {\"physics_cast\", global_physics_cast_ray},\n {\"physics_sweep_sphere\", global_physics_sweep_sphere},\n {\"physics_sweep_cylinder\", global_physics_sweep_cylinder},\n {\"physics_sweep_box\", global_physics_sweep_box},\n {\"physics_sweep_col_mesh\", global_physics_sweep_col_mesh},\n {NULL, NULL}\n};\n\n\nvoid physics_lua_init (lua_State *L)\n{\n ADD_MT_MACRO(rbody, RBODY_TAG);\n register_lua_globals(L, global);\n}\n" }, { "alpha_fraction": 0.49489322304725647, "alphanum_fraction": 0.6081708669662476, "avg_line_length": 18.563636779785156, "blob_id": "4e9a5fe55c6d696f3fd947a5c4e9deffb986f9e3", "content_id": "9dafa9277dd1569efa1e3d037bfc976bcae28a90", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Lua", "length_bytes": 1077, "license_type": "permissive", "max_line_length": 98, "num_lines": 55, "path": "/engine/tests/engine/tracer/tracer.lua", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "gfx_colour_grade `neutral.lut.png`\ngfx_fade_dither_map `stipple.png`\ngfx_particle_ambient(vec(1, 1, 1))\n\ncam_pos = vec(0, 0, 0)\ncam_look = vec(0, 100, 0)\ncam_quat = quat(vec(0, 1, 0), cam_look - cam_pos)\n\nb1 = gfx_tracer_body_make()\nb1.texture = `Tracer.png`\nb1.length = 30\nb1.size = 0.5\nb1.alpha = 0;\n\nfor i = 0, 5000, 10 do\n b1.localPosition = vec(math.sin(math.rad(i)), -10 + i / 5000 * 50, math.cos(math.rad(i)))\n b1.emissiveColour = (b1.localPosition + vec(1, 0, 1)) * vec(0.5, 0, 0.5) + vec(0, i / 5000, 0)\n gfx_render(0.1, cam_pos, cam_quat)\n gfx_tracer_body_pump(0.1)\nend\n\ngfx_screenshot('output-tracer1.png')\n\n\nb2 = gfx_tracer_body_make()\nb2.length = 10\nb2.size = 0.2\nb2.alpha = 0.75\nb2.diffuseColour = vec(1, 0, 0)\n\nfunction p(x, z)\n b2.localPosition = vec(x, 3, z)\n b2:pump()\nend\n\np(0, 1)\np(0.5, 1)\np(1, 1)\np(1, 0.5)\np(1, 0)\np(0.5, 0)\np(0, 0)\np(0, 0.5)\n\n\np(0.5, 0.5)\np(0.5, 0.5)\np(0.5, 0.6)\np(0.5, 0.7)\n\ngfx_render(0.1, cam_pos, cam_quat)\ngfx_render(0.1, cam_pos, cam_quat)\ngfx_render(0.1, cam_pos, cam_quat)\n\ngfx_screenshot('output-tracer2.png')\n\n" }, { "alpha_fraction": 0.5392905473709106, "alphanum_fraction": 0.5416972041130066, "avg_line_length": 33.3776969909668, "blob_id": "172ad92c9c639bc21fef5678219b498d1550ae87", "content_id": "0f3c93684d91cb1a7e64213370a76a71193024ee", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 9557, "license_type": "permissive", "max_line_length": 121, "num_lines": 278, "path": "/engine/doc/grit_book/translate_xml.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "#!/usr/bin/python\n\nimport os.path\nimport re\nimport textwrap\n\nimport lxml.etree as ET\n\n\nclass TranslateError:\n def __init__(self, el, problem):\n self.filename = el.base\n self.line = el.sourceline\n self.problem = problem\n def __str__(self):\n return '%s:%d: %s' % (self.filename, self.line, self.problem)\n\n\ndef Error(el, msg):\n raise TranslateError(el, msg)\n\n\ndef AssertNoBody(el):\n if el.text and el.text.strip('\\n\\t '):\n Error(el, 'Cannot have text after element %s.' % el.tag)\n\n\ndef AssertNoTail(el):\n if el.tail and el.tail.strip('\\n\\t '):\n Error(el, 'Cannot have text after element %s.' % el.tag)\n \n\ndef AssertExists(el, attr):\n v = el.get(attr)\n if not v:\n Error(el, 'Tag: \"%s\" needs attribute \"%s\".' % (el.tag, attr))\n return v\n \n\ndef AssertTag(el, tag):\n if el.tag != tag:\n Error(el, 'Expected %s, not %s.' % (tag, el.tag))\n \n\ndef AssertFile(el, fname):\n if not os.path.isfile(fname):\n Error(el, \"File does not exist: \" + fname)\n\n\nclass Node:\n def __init__(self, kind, parent, **kwargs):\n self.kind = kind\n self.parent = parent\n self.attr = kwargs\n def __getattr__(self, key):\n return self.attr.get(key)\n def __str__(self):\n return repr(self)\n def __repr__(self):\n return 'Node(\"%s\", attr=%s)' % (self.kind, repr(self.attr))\n def __iter__(self):\n if self.data:\n for a in self.data:\n yield a\n def __len__(self):\n return len(self.data)\n def __nonzero__(self):\n return True\n def __eq__(self, other):\n if other.kind != self.kind: return False\n if other.parent != self.parent: return False\n if other.attr != self.attr: return False\n return True\n def __ne__(self, other):\n return not (self == other)\n\n\ninline_tags = { 'def', 'web', 'issue', 'todo', 'sref', 'code', 'emph', 'italic' }\n\ndef MinimiseWhiteSpace(n):\n \"\"\"Convert any whitespace to a single space.\"\"\"\n return re.sub('[ \\t\\n]+', ' ', n)\n\ndef StripParagraphWhiteSpace(p, inside=False):\n \"\"\"At the root of a paragraph, strip leading whitespace from the first\n element, and trailing whitespace from the last. Minimise whitespace in all\n other cases.\n\n Args:\n p: List of strings and tags.\n inside: Whether or not we are recursing within the body of a tag within the paragraph.\n Returns:\n The list of strings and tags with maybe less whitespace.\n \"\"\"\n r = []\n for i, n in enumerate(p):\n if isinstance(n, basestring):\n n = MinimiseWhiteSpace(n)\n if not inside:\n if i==0:\n n = n.lstrip(' \\t\\n')\n if i==len(p)-1:\n n = n.rstrip(' \\t\\n')\n elif n.data:\n n.data = StripParagraphWhiteSpace(n.data, True)\n r.append(n)\n return r\n \n\ndef NonEmptyParagraph(para):\n \"\"\"A paragraph is non-empty if it contains more than just whitespace.\"\"\"\n for el in para:\n if not isinstance(el, basestring):\n return True\n if el.strip('\\n\\t'):\n return True\n return False\n\n\nSECTION_MAP = {}\n\ndef ResolveReferences(ast):\n if not isinstance(ast, Node):\n return\n if ast.kind == \"SRef\":\n target = SECTION_MAP.get(ast.target)\n # ChedkRef ensures that the references are all valid.\n ast.target = target\n for ch in ast:\n ResolveReferences(ch)\n\n\ndef TranslateParagraphs(content, context_ast, dosplit=True):\n \"\"\"Translate text and XML elements into paragraphs by examining whitespace.\n\n Args:\n content: A list of text and tags. The text may span several paragraphs\n (represented by blank lines). \n context_ast:\n dosplit: Whether or not to treat blank lines as paragraph dividers.\n\n Returns:\n A list of paragraphs, where each paragraph is given as a list of strings and nodes.\n \"\"\"\n r = []\n r2 = None\n for i, c in enumerate(content):\n if isinstance(c, basestring):\n for i, s in enumerate(re.split('\\n[ \\t]*\\n',c) if dosplit else [c]):\n if i==0:\n # Could be after an inline block, therefore not the beginning of a paragraph.\n if not r2:\n r2 = []\n r.append(r2)\n else:\n r2 = []\n r.append(r2)\n r2.append(s)\n else:\n if not r2:\n r2 = []\n r.append(r2)\n content2 = TranslateParagraphs(([c.text] if c.text else []) + [ch for ch in c], context_ast, False)\n flattened = [item for sublist in content2 for item in sublist]\n if c.tag == \"def\":\n r2.append(Node('Definition', context_ast, data=flattened))\n elif c.tag == \"web\":\n r2.append(Node('Web', context_ast, url=c.get('url'), data=flattened))\n elif c.tag == \"issue\":\n if flattened:\n Error(c, \"Tag: %s should not have textual content.\" % c.tag) \n r2.append(Node('Issue', context_ast, id=int(c.get('id'))))\n elif c.tag == \"todo\":\n r2.append(Node('Todo', context_ast, data=flattened))\n elif c.tag == \"emph\":\n r2.append(Node('Emph', context_ast, data=flattened))\n elif c.tag == \"code\":\n r2.append(Node('Code', context_ast, data=flattened))\n elif c.tag == \"italic\":\n r2.append(Node('Italic', context_ast, data=flattened))\n elif c.tag == \"sref\":\n target = c.get('id')\n if not target:\n Error(c, 'Tag: %s should have an id attribute.' % c.tag)\n r2.append(Node('SRef', context_ast, target=target, data=flattened))\n else:\n Error(c, 'Unknown tag: ' + str(c.tag))\n r = map(StripParagraphWhiteSpace, r)\n r = filter(NonEmptyParagraph, r)\n return r\n\n\ndef TranslateBlockContents(block, block_ast):\n block_content = []\n text_content = None\n if block.text:\n text_content = [block.text]\n block_content.append(text_content)\n\n for el in block:\n if el.tag == ET.Comment:\n if el.tail:\n text_content = [el.tail]\n block_content.append(text_content)\n elif el.tag in inline_tags:\n if text_content:\n text_content.append(el)\n else:\n text_content = [el]\n block_content.append(text_content)\n if el.tail:\n text_content.append(el.tail)\n else:\n block_content.append(el)\n text_content = None\n if el.tail:\n text_content = [el.tail]\n block_content.append(text_content)\n\n output_content = []\n for el in block_content:\n if isinstance(el,list):\n paragraphs = []\n for inline in TranslateParagraphs(el, None):\n n = Node('Paragraph', block_ast, data=inline)\n for i in inline:\n if not isinstance(i, basestring):\n i.parent = n\n paragraphs.append(n)\n output_content += paragraphs\n else:\n if el.tag == \"section\":\n id = AssertExists(el, 'id')\n title = AssertExists(el, 'title')\n sb = el.get('splitbelow')\n # Add Section node without data field first.\n translated_content = Node('Section', block_ast, split=sb==\"true\", id=id,\n title=title, data=False)\n SECTION_MAP[id] = translated_content\n translated_content.data = TranslateBlockContents(el, translated_content)\n AssertNoTail(el)\n elif el.tag == \"image\":\n src = el.get('src')\n thumb_src = 'thumb_' + src\n caption = MinimiseWhiteSpace(el.text or '')\n title = MinimiseWhiteSpace(el.get('title'))\n AssertFile(el, 'xml/' + src)\n AssertFile(el, 'xml/' + thumb_src)\n translated_content = Node('Image', block_ast, src=src, caption=caption, thumb_src=thumb_src, title=title)\n elif el.tag == \"ul\":\n AssertNoBody(el)\n translated_items = []\n translated_content = Node('UnorderedList', block_ast)\n for item in el:\n AssertTag(item, 'li')\n translated_items.append(TranslateBlockContents(item, translated_content))\n AssertNoTail(item)\n translated_content.data = translated_items\n elif el.tag == \"lua\":\n translated_content = Node('Lua', block_ast, data=textwrap.dedent(el.text))\n elif el.tag == \"gasoline\":\n translated_content = Node('Gasoline', block_ast, data=textwrap.dedent(el.text))\n elif el.tag == \"pre\":\n translated_content = Node('Preformatted', block_ast, data=textwrap.dedent(el.text))\n else:\n Error(el, 'Unknown tag: ' + str(el.tag))\n output_content.append(translated_content)\n\n return output_content\n\n\ndef GetOutputFile(node):\n \"\"\"Return the node that begins the current file, by chasing parents.\"\"\"\n if not node.parent:\n raise 'Got to the bottom of the DOM tree without finding an output file.'\n if node.parent.split:\n return node\n return GetOutputFile(node.parent)\n" }, { "alpha_fraction": 0.3873308002948761, "alphanum_fraction": 0.42479994893074036, "avg_line_length": 38.91343307495117, "blob_id": "8441415359de7726b612c8f2d7b5a3ff8895bac5", "content_id": "b88f97f5917fed4db8f56a1c059abe5a971e3c24", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 13371, "license_type": "permissive", "max_line_length": 92, "num_lines": 335, "path": "/gtasa/handling.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "#include <cstdlib>\n#include <iostream>\n#include <fstream>\n#include <algorithm>\n#include <locale>\n\n\n#include \"handling.h\"\n#include \"ios_util.h\"\n\nstatic float f (const std::string &s) { return (float)strtod(s.c_str(), NULL); }\nstatic int dec (const std::string &s) { return (int)strtod(s.c_str(), NULL); }\nstatic unsigned long hex (const std::string &s) { return strtoul(s.c_str(), NULL, 16); }\n\nstatic int tolowr (int c)\n{\n return std::tolower(char(c),std::cout.getloc());\n}\n\nstatic std::string strlower (std::string s)\n{\n std::transform(s.begin(),s.end(), s.begin(),tolowr);\n return s;\n}\n\nvoid read_handling (Csv &csv, HandlingData &data)\n{\n const CsvSection &s = csv[\"nosection\"];\n for (unsigned i=0 ; i<s.size() ; ++i) {\n const CsvLine &line = s[i];\n APP_ASSERT(line.size()>0);\n\n if (line[0] == \"%\") continue;\n if (line[0] == \"!\") continue;\n if (line[0] == \"$\") continue;\n if (line[0] == \"^\") continue;\n\n APP_ASSERT(line.size()==36);\n\n VehicleData v;\n v.name = strlower(line[0]);\n v.mass = f(line[1]);\n v.turn_mass = f(line[2]);\n v.drag = f(line[3]);\n\n v.com_x = f(line[4]);\n v.com_y = f(line[5]);\n v.com_z = f(line[6]);\n v.bouyancy = f(line[7]);\n v.traction_mult = f(line[8]);\n v.traction_loss = f(line[9]);\n v.traction_bias = f(line[10]);\n\n v.gears = dec(line[11]);\n v.max_vel = f(line[12]);\n v.engine_accel = f(line[13]);\n v.engine_innertia = f(line[14]);\n\n char drive = line[15][0];\n v.front_wheel_drive = drive=='F' || drive=='4';\n v.back_wheel_drive = drive=='R' || drive=='4';\n\n char et = line[16][0];\n switch (et) {\n case 'P': v.engine_type = 0; break;\n case 'D': v.engine_type = 1; break;\n case 'E': v.engine_type = 2; break;\n }\n\n v.brakes = f(line[17]);\n v.brake_bias = f(line[18]);\n v.abs = dec(line[19])==1;\n APP_ASSERT(!v.abs);\n v.steering_lock = f(line[20]);\n\n v.susp_force = f(line[21]);\n v.susp_damp = f(line[22]);\n v.susp_high_spd_com_damp = f(line[23]);\n v.susp_upper = f(line[24]);\n v.susp_lower = f(line[25]);\n v.susp_bias = f(line[26]);\n v.susp_anti_dive = f(line[27]);\n\n v.seat_offset = f(line[28]);\n v.damage_mult = f(line[29]);\n v.value = dec(line[30]); // in dollars\n\n unsigned long mflags = hex(line[31]);\n v.is_van = mflags & 0x1;\n v.is_bus = mflags & 0x2;\n v.is_low = mflags & 0x4;\n v.is_big = mflags & 0x8;\n v.reverse_bonnet = mflags & 0x10;\n v.hanging_boot = mflags & 0x20;\n v.tailgate_boot = mflags & 0x40;\n v.noswing_boot = mflags & 0x80;\n v.no_doors = mflags & 0x100;\n v.tandem_seats = mflags & 0x200;\n v.sit_in_boat = mflags & 0x400;\n v.convertible = mflags & 0x800;\n v.no_exhaust = mflags & 0x100;\n v.double_exhaust = mflags & 0x2000;\n v.no1fps_look_behind = mflags & 0x4000;\n v.force_door_check = mflags & 0x8000;\n v.axle_f_notilt = mflags & 0x1000;\n v.axle_f_solid = mflags & 0x2000;\n v.axle_f_mcpherson = mflags & 0x40000;\n v.axle_f_reverse = mflags & 0x80000;\n v.axle_r_notilt = mflags & 0x10000;\n v.axle_r_solid = mflags & 0x20000;\n v.axle_r_mcpherson = mflags & 0x400000;\n v.axle_r_reverse = mflags & 0x800000;\n v.is_bike = mflags & 0x1000000;\n v.is_heli = mflags & 0x2000000;\n v.is_plane = mflags & 0x4000000;\n v.is_boat = mflags & 0x8000000;\n v.bounce_panels = mflags & 0x10000000;\n v.double_rwheels = mflags & 0x20000000;\n v.force_ground_clearance = mflags & 0x40000000;\n v.is_hatchback = mflags & 0x80000000;\n\n unsigned long hflags = hex(line[32]);\n v.one_g_boost = hflags & 0x1;\n v.two_g_boost = hflags & 0x2;\n v.npc_anti_roll = hflags & 0x4;\n v.npc_neutral_handl = hflags & 0x8;\n v.no_handbrake = hflags & 0x10;\n v.steer_rearwheels = hflags & 0x20;\n v.hb_rearwheel_steer = hflags & 0x40;\n v.alt_steer_opt = hflags & 0x80;\n v.wheel_f_narrow2 = hflags & 0x100;\n v.wheel_f_narrow = hflags & 0x200;\n v.wheel_f_wide = hflags & 0x400;\n v.wheel_f_wide2 = hflags & 0x800;\n v.wheel_r_narrow2 = hflags & 0x1000;\n v.wheel_r_narrow = hflags & 0x2000;\n v.wheel_r_wide = hflags & 0x4000;\n v.wheel_r_wide2 = hflags & 0x8000;\n v.hydraulic_geom = hflags & 0x10000;\n v.hydraulic_inst = hflags & 0x20000;\n v.hydraulic_none = hflags & 0x40000;\n v.nos_inst = hflags & 0x80000;\n v.offread_ability = hflags & 0x100000;\n v.offroad_ability2 = hflags & 0x200000;\n v.halogen_lights = hflags & 0x400000;\n v.proc_rearwheel_1st = hflags & 0x800000;\n v.use_maxsp_limit = hflags & 0x1000000;\n v.low_rider = hflags & 0x2000000;\n v.street_race = hflags & 0x4000000;\n v.swinging_chassis = hflags & 0x10000000;\n\n v.front_lights = dec(line[33]); // 0=long, 1=small, 2=big, 3=tall\n v.rear_lights = dec(line[34]);\n\n v.anim_group = dec(line[35]);\n\n v.has_boat_data = false;\n v.has_bike_data = false;\n v.has_plane_data = false;\n\n data.vehicles.push_back(v);\n }\n for (unsigned i=0 ; i<data.vehicles.size() ; ++i) {\n VehicleData &v = data.vehicles[i];\n data[v.name] = &v;\n }\n for (unsigned i=0 ; i<s.size() ; ++i) {\n const CsvLine &line = s[i];\n APP_ASSERT(line.size()>0);\n if (line[0] == \"%\") {\n APP_ASSERT(line.size()==16);\n const std::string &name = strlower(line[1]);\n APP_ASSERT(data[name]!=NULL);\n VehicleData &v = *data[name];\n v.has_boat_data = true;\n // boat\n v.boat_thrust_y = f(line[2]);\n v.boat_thrust_z = f(line[3]);\n v.boat_thrust_app_z = f(line[4]);\n v.boat_aq_plane_force = f(line[5]);\n v.boat_aq_plane_limit = f(line[6]);\n v.boat_aq_plane_offset = f(line[7]);\n v.boat_wave_audio_muilt = f(line[8]);\n v.boat_move_res_x = f(line[9]);\n v.boat_move_res_y = f(line[10]);\n v.boat_move_res_z = f(line[11]);\n v.boat_turn_res_x = f(line[12]);\n v.boat_turn_res_y = f(line[13]);\n v.boat_turn_res_z = f(line[14]);\n v.boat_look_l_r_behind_cam_height = f(line[15]);\n } else if (line[0] == \"!\") {\n APP_ASSERT(line.size()==17);\n const std::string &name = strlower(line[1]);\n APP_ASSERT(data[name]!=NULL);\n VehicleData &v = *data[name];\n v.has_bike_data = true;\n // bike\n v.bike_lean_fwd_com = f(line[2]);\n v.bike_lean_fwd_force = f(line[3]);\n v.bike_lean_back_com = f(line[4]);\n v.bike_lean_back_force = f(line[5]);\n v.bike_max_lean = f(line[6]);\n v.bike_full_anim_lean = f(line[7]);\n v.bike_des_lean = f(line[8]);\n v.bike_speed_steer = f(line[9]);\n v.bike_slip_steer = f(line[10]);\n v.bike_no_player_com_z = f(line[11]);\n v.bike_wheelie_ang = f(line[12]);\n v.bike_stoppie_ang = f(line[13]);\n v.bike_wheelie_steer = f(line[14]);\n v.bike_wheelie_stab_mult = f(line[15]);\n v.bike_stoppie_stab_mult = f(line[16]);\n } else if (line[0] == \"$\") {\n APP_ASSERT(line.size()==23);\n const std::string &name = strlower(line[1]);\n APP_ASSERT(data[name]!=NULL);\n VehicleData &v = *data[name];\n v.has_plane_data = true;\n // plane\n v.plane_thrust = f(line[2]);\n v.plane_thrust_falloff = f(line[3]);\n v.plane_yaw = f(line[4]);\n v.plane_yaw_stab = f(line[5]);\n v.plane_side_slip = f(line[6]);\n v.plane_roll = f(line[7]);\n v.plane_roll_stab = f(line[8]);\n v.plane_pitch = f(line[9]);\n v.plane_pitch_stab = f(line[10]);\n v.plane_form_lift = f(line[11]);\n v.plane_attack_lift = f(line[12]);\n v.plane_gear_up_r = f(line[13]);\n v.plane_gear_down_l = f(line[14]);\n v.plane_wind_mult = f(line[15]);\n v.plane_move_res = f(line[16]);\n v.plane_turn_res_x = f(line[17]);\n v.plane_turn_res_y = f(line[18]);\n v.plane_turn_res_z = f(line[19]);\n v.plane_speed_res_x = f(line[20]);\n v.plane_speed_res_y = f(line[21]);\n v.plane_speed_res_z = f(line[22]);\n }\n }\n}\n\n\n\n#ifdef _HANDLING_EXEC\n\nvoid app_verbose(char const* file, int line, const std::string& msg)\n{\n std::cout<<BOLD<<GREEN<<\"VERBOSE \"<<RESET\n <<BOLD<<file<<NOBOLD<<\":\"<<BOLD<<line<<NOBOLD\n << \": \\\"\"<<BOLD<<BLUE<<msg<<RESET\"\\\"\";\n std::cout<<std::endl;\n}\n\nvoid app_error(char const* file, int line,\n const std::string& i_was, const std::string& msg)\n{\n std::cout<<BOLD RED\"ERROR \"<<RESET\n <<BOLD<<file<<NOBOLD<<\":\"<<BOLD<<line<<NOBOLD\n <<\": \\\"\"<<BOLD<<YELLOW<<msg<<RESET<<\"\\\"\";\n if (i_was!=\"\")\n std::cout<<\" (\"<<BOLD<<YELLOW<<i_was<<RESET<<\")\";\n std::cout<<std::endl;\n}\n\nvoid app_line(const std::string &msg)\n{\n std::cout<<BOLD<<msg<<NOBOLD<<std::endl;\n}\n\nvoid app_fatal()\n{\n abort();\n}\n\nvoid assert_triggered (void) { }\n\nint main(int argc, char *argv[])\n{\n if (argc!=2) {\n std::cerr<<\"Usage: \"<<argv[0]<<\" <handling.cfg file>\"<<std::endl;\n return EXIT_FAILURE;\n }\n\n try {\n\n std::ifstream handlingfstream;\n std::istream *handlingstream = &handlingfstream;\n std::string filename;\n\n if (strcmp(argv[1],\"-\")==0) {\n handlingstream = &std::cin;\n filename = \"<stdin>\";\n } else {\n filename = argv[1];\n handlingfstream.open (filename.c_str());\n APP_ASSERT_IO_SUCCESSFUL(handlingfstream,\n \"Opening handling: \"+filename);\n if (handlingfstream.fail() || handlingfstream.bad()) {\n std::stringstream ss;\n ss << filename << \": IO Error: \" << strerror(errno) << \"\\n\";\n GRIT_EXCEPT(ss.str());\n }\n }\n\n Csv handling;\n handling.filename = filename;\n read_csv(*handlingstream,handling);\n HandlingData data;\n read_handling(handling, data);\n\n for (HandlingData::iterator i=data.begin(), i_=data.end() ; i!=i_ ; ++i) {\n const std::string name = i->first;\n const VehicleData &v = *i->second;\n\n APP_ASSERT(name == v.name);\n\n std::cout << name << std::endl;\n }\n\n } catch (const Exception &e) {\n\n CERR << e << std::endl;\n return EXIT_FAILURE;\n\n }\n\n return EXIT_SUCCESS;\n}\n\n#endif\n\n// vim: shiftwidth=8:tabstop=8:expandtab\n" }, { "alpha_fraction": 0.5878093242645264, "alphanum_fraction": 0.589006245136261, "avg_line_length": 45.869564056396484, "blob_id": "b7097ce88ad9d51ce86c4e5a69286faa32ea094e", "content_id": "27d6a6d6fbd747f1d1f6f2708cb85600f91d274d", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 33419, "license_type": "permissive", "max_line_length": 105, "num_lines": 713, "path": "/dependencies/quex-0.34.1/quex/core_engine/state_machine/core.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "import sys\nfrom copy import copy, deepcopy\n\nfrom quex.frs_py.string_handling import blue_print\n#\nfrom quex.core_engine.interval_handling import NumberSet, Interval\nimport quex.core_engine.state_machine.index as state_machine_index\nfrom quex.core_engine.state_machine.transition_map import *\nfrom quex.core_engine.state_machine.state_core_info import StateCoreInfo\nfrom quex.core_engine.state_machine.origin_list import StateOriginList\n\n\nclass State:\n # Information about all transitions starting from a particular state. Transitions are\n # of two types:\n # \n # -- normal transitions: triggered when a character arrives that falls into \n # a trigger set.\n # -- epsilon transition: triggered when no other trigger of the normal transitions\n # triggers.\n #\n # Objects of this class are to be used in class StateMachine, where a dictionary maps \n # from a start state index to a State-object.\n #\n ##################################################################################### \n def __init__(self, AcceptanceF=False, StateMachineID=-1L, StateIndex=-1L):\n \"\"\"Contructor of a State, i.e. a aggregation of transitions.\n \"\"\"\n self.__core = StateCoreInfo(StateMachineID, StateIndex, AcceptanceF=AcceptanceF)\n self.__origin_list = StateOriginList()\n\n # normal transitions: trigger, action, target-state-index\n self.__transition_map = TransitionMap()\n\n def core(self):\n return self.__core\n\n def origins(self):\n return self.__origin_list\n\n def transitions(self):\n return self.__transition_map\n\n def merge(self, Other):\n # merge core information of self with other state\n self.core().merge(Other.core())\n if Other.origins().is_empty(): return \n elif self.origins().is_empty(): \n self.origins().set(Other.origins().get_list())\n else: \n self.origins().append(Other.origins().get_list(), \n StoreInputPositionFollowsAcceptanceF=False,\n SelfAcceptanceF=self.is_acceptance())\n\n def is_acceptance(self):\n return self.core().is_acceptance()\n \n def set_acceptance(self, Value=True, LeaveStoreInputPositionF=False):\n self.core().set_acceptance_f(Value, LeaveStoreInputPositionF)\n\n def mark_self_as_origin(self, StateMachineID, StateIndex):\n self.core().state_machine_id = StateMachineID\n self.core().state_index = StateIndex\n # use the own 'core' as only origin\n self.origins().set([self.core()])\n\n def add_origin(self, StateMachineID_or_StateOriginInfo, StateIdx=None, StoreInputPositionF=None):\n self.origins().add(StateMachineID_or_StateOriginInfo, StateIdx, \n StoreInputPositionF, self.is_acceptance())\n\n def add_transition(self, Trigger, TargetStateIdx): \n self.__transition_map.add_transition(Trigger, TargetStateIdx)\n \n def clone(self, ReplacementDictionary=None):\n \"\"\"Creates a copy of all transitions, but replaces any state index with the ones \n determined in the ReplacementDictionary.\"\"\"\n result = State()\n result.__core = deepcopy(self.__core)\n result.__transition_map = deepcopy(self.__transition_map)\n result.__origin_list = deepcopy(self.__origin_list)\n # if replacement of indices is desired, than do it\n if ReplacementDictionary != None:\n for ti, replacement_ti in ReplacementDictionary.items():\n result.transitions().replace_target_index(ti, replacement_ti)\n return result\n\n def __repr__(self):\n return self.get_string()\n\n def get_string(self, StateIndexMap=None):\n # if information about origins of the state is present, then print\n msg = self.origins().get_string()\n fill_str = \"\"\n if msg != \"\": fill_str = \" \"\n\n msg = self.core().get_string(StateMachineAndStateInfoF=False) + msg\n\n # print out transitionts\n msg += self.transitions().get_string(fill_str, StateIndexMap)\n return msg\n\n def get_graphviz_string(self, OwnStateIdx, StateIndexMap):\n return self.transitions().get_graphviz_string(OwnStateIdx, StateIndexMap)\n\nclass StateMachineCoreInfo:\n def __init__(self, ID, \n PreContextSM=None, \n PreContext_BeginOfLineF=False, \n PreContext_SingleCharacterList=[]):\n\n self.__id = ID \n self.__pre_context_sm = PreContextSM\n self.__pre_context_begin_of_line_f = PreContext_BeginOfLineF\n self.__pre_context_single_character_list = PreContext_SingleCharacterList\n self.__post_context_id = -1L\n self.__post_context_backward_input_position_detector_sm = None\n\n def id(self): \n return self.__id\n def pre_context_sm(self): \n return self.__pre_context_sm\n def pre_context_sm_id(self):\n if self.__pre_context_sm != None: return self.__pre_context_sm.core().id()\n else: return -1L\n def pre_context_begin_of_line_f(self): \n return self.__pre_context_begin_of_line_f \n def pre_context_single_character_list(self): \n return self.__pre_context_single_character_list \n def post_context_id(self): \n return self.__post_context_id \n def post_context_backward_input_position_detector_sm(self): \n return self.__post_context_backward_input_position_detector_sm\n def post_context_backward_input_position_detector_sm_id(self): \n if self.__post_context_backward_input_position_detector_sm != None: \n return self.__post_context_backward_input_position_detector_sm.core().id()\n else:\n return -1L\n\n def set_id(self, Value): \n assert type(Value) == long\n self.__id = Value\n def set_pre_context_sm(self, Value): \n assert Value.__class__.__name__ == \"StateMachine\" or Value == None\n self.__pre_context_sm = Value\n def set_pre_context_begin_of_line_f(self, Value=True): \n assert type(Value) == bool\n self.__pre_context_begin_of_line_f = Value\n def set_pre_context_single_character_list(self, Value): \n assert type(Value) == list\n self.__pre_context_single_character_list = Value\n def set_post_context_id(self, Value): \n assert type(Value) == long\n self.__post_context_id = Value\n def set_post_context_backward_input_position_detector_sm(self, Value): \n assert Value.__class__.__name__ == \"StateMachine\" or Value == None\n self.__post_context_backward_input_position_detector_sm = Value\n\nclass StateMachine:\n\n def __init__(self, InitStateIndex=None, AcceptanceF=False, Core=None):\n\n # print \"##state_machine_init\"\n if InitStateIndex == None: self.init_state_index = state_machine_index.get()\n else: self.init_state_index = InitStateIndex\n \n # State Index => State (information about what triggers transition to what target state).\n self.states = { self.init_state_index: State(AcceptanceF) } \n\n # get a unique state machine id \n id = state_machine_index.get_state_machine_id()\n\n # Setup core information\n if Core != None: \n self.__core = deepcopy(Core)\n self.__core.set_id(id)\n else: \n self.__core = StateMachineCoreInfo(id)\n\n def core(self):\n return self.__core\n \n def clone(self):\n \"\"\"Clone state machine, i.e. create a new one with the same behavior,\n i.e. transitions, but with new unused state indices. This is used when\n state machines are to be created that combine the behavior of more\n then one state machine. E.g. see the function 'sequentialize'. Note:\n the state ids SUCCESS and TERMINATION are not replaced by new ones.\n\n RETURNS: cloned object if cloning successful\n None if cloning not possible due to external state references\n\n \"\"\"\n replacement = {}\n\n # (*) create the new state machine\n # (this has to happen first, to get an init_state_index)\n result = StateMachine()\n\n # every target state has to appear as a start state (no external states)\n # => it is enough to consider the start states and 'rename' them.\n # if later a target state index appears, that is not in this set we\n # return 'None' to indicate that this state machine cannot be cloned.\n sorted_state_indices = self.states.keys()\n sorted_state_indices.sort()\n for state_idx in sorted_state_indices:\n # NOTE: The constructor already delivered an init state index to 'result'.\n # Thus self's init index has to be translated to result's init index.\n if state_idx == self.init_state_index:\n replacement[state_idx] = result.init_state_index\n else:\n replacement[state_idx] = state_machine_index.get()\n # termination is a global state, it is not replaced by a new index \n\n for state_idx, state in self.states.items():\n new_state_idx = replacement[state_idx]\n # print \"##\", state_idx, \"-->\", new_state_idx\n result.states[new_state_idx] = self.states[state_idx].clone(replacement)\n\n result.__core = deepcopy(self.__core)\n \n return result\n\n def get_id(self):\n return self.__core.id()\n\n def get_init_state(self):\n return self.states[self.init_state_index]\n\n def is_init_state_a_target_state(self):\n init_state_index = self.init_state_index\n for state in self.states.values():\n target_state_index_list = state.transitions().get_target_state_index_list()\n if init_state_index in target_state_index_list: return True\n return False\n \n def get_orphaned_state_index_list(self):\n \"\"\"This function checks for states that are not targeted via any trigger\n by any other state. This indicates most likely a lack off efficiency \n or an error in the algorithms.\n \"\"\"\n work_list = self.states.keys()\n try: del work_list[work_list.index(self.init_state_index)]\n except: assert False, \"Init state index is not contained in list of state indices.\"\n\n for state in self.states.values():\n target_state_index_list = state.transitions().get_target_state_index_list()\n work_list = filter(lambda i: i not in target_state_index_list, work_list)\n return work_list\n\n def get_epsilon_closure_of_state_set(self, StateIdxList):\n \"\"\"Returns the epsilon closure of a set of states, i.e. the union\n of the epsilon closures of the single states.\"\"\"\n result = []\n\n for state_idx in StateIdxList:\n ec = self.get_epsilon_closure(state_idx)\n for idx in ec:\n if idx not in result: result.append(idx)\n\n return result\n\n def get_epsilon_closure(self, StateIdx):\n \"\"\"Return all states that can be reached from 'StateIdx' via epsilon\n transition.\"\"\"\n assert self.states.has_key(StateIdx)\n\n aggregated_epsilon_closure = [ StateIdx ] \n def __dive(state_index):\n index_list = self.states[state_index].transitions().get_epsilon_target_state_index_list()\n for target_index in index_list:\n if target_index in aggregated_epsilon_closure: continue\n aggregated_epsilon_closure.append(target_index)\n __dive(target_index)\n\n __dive(StateIdx)\n return aggregated_epsilon_closure\n \n def get_elementary_trigger_sets(self, StateIdxList):\n \"\"\"Considers the trigger dictionary that contains a mapping from target state index \n to the trigger set that triggers to it: \n \n target_state_index ---> trigger_set \n \n The trigger sets of different target state indices may intersect. As a result,\n this function produces a list of pairs:\n \n [ state_index_list, elementary_trigger_set ]\n \n where the elementary trigger set is the set of all triggers that trigger\n at the same time to all states in the state_index_list. The list contains \n for one state_index_list only one elementary_trigger_set. All elementary\n trigger sets are disjunct, i.e. they do not intersect.\n \n NOTE: A general solution of this problem would have to consider the \n inspection of all possible subset combinations. The number of \n combinations for N trigger sets is 2^N - which potentially blows\n the calculation power of the computer. Excessive optimizations\n would have to be programmed, if not the following were the case: \n \n NOTE: Fortunately, we are dealing with one dimensional sets! Thus, there is\n a very effective way to determine the elementary trigger sets. Imagine\n three trigger sets stretching over the range of numbers as follows:\n\n different targets, e.g. T0, T1, T2 are triggered by different sets of letters\n in the alphabet. \n letters of alphabet\n ---------------------------------------------------->\n\n T0 [---------) [----------)\n T1 [------) [-----)\n T2 [----------------------) \n \n => elementary sets: \n \n only T0 [-------)\n T0, T1 [-)\n only T1 [-)\n T1, T2 [--)\n only T2 [---) [----)\n T0, T2 [---) [)\n T0, T1, T2 [-----)\n \"\"\"\n def DEBUG_print_history(history):\n txt = \"\"\n for item in history:\n txt += repr(item) + \"\\n\"\n print txt\n\n # (*) accumulate the transitions for all states in the state list.\n # transitions to the same target state are combined by union.\n history = []\n for state_idx in StateIdxList:\n # -- trigger dictionary: target_idx --> trigger set that triggers to target\n line_up = self.states[state_idx].transitions().get_trigger_set_line_up() \n # NOTE: Doublicate entries in history are perfectly reasonable at this point,\n # simply if two states trigger on the same character range to the same \n # target state. When ranges are opened/closed via the history items\n # this algo keeps track of doublicates (see below).\n history.extend(line_up)\n\n # (*) sort history according to position\n history.sort(lambda a, b: cmp(a.position, b.position))\n ## DEBUG_print_history(history)\n\n # (*) build the elementary subset list \n combinations = {} # use dictionary for uniqueness\n map_key_str_to_target_index_combination = {} # use dictionary for uniqueness \n current_interval_begin = None\n current_involved_target_indices = {} # use dictionary for uniqueness\n current_involved_targets_epsilon_closure = []\n for item in history:\n # -- add interval and target indice combination to the data\n # (only build interval when current begin is there, \n # when the interval size is not zero, and\n # when the epsilon closure of target states is not empty) \n if current_interval_begin != None and \\\n current_interval_begin != item.position and \\\n current_involved_target_indices.keys() != []:\n\n interval = Interval(current_interval_begin, item.position)\n key_str = repr(current_involved_targets_epsilon_closure)\n if not combinations.has_key(key_str): \n combinations[key_str] = NumberSet(interval, ArgumentIsYoursF=True)\n map_key_str_to_target_index_combination[key_str] = \\\n current_involved_targets_epsilon_closure\n else:\n combinations[key_str].unite_with(interval)\n \n # -- BEGIN / END of interval:\n # add or delete a target state to the set of currently considered target states\n # NOTE: More than one state can trigger on the same range to the same target state.\n # Thus, one needs to keep track of the 'opened' target states.\n if item.change == INTERVAL_BEGIN:\n if current_involved_target_indices.has_key(item.target_idx):\n current_involved_target_indices[item.target_idx] += 1\n else:\n current_involved_target_indices[item.target_idx] = 1\n else: # == INTERVAL_END\n if current_involved_target_indices[item.target_idx] > 1:\n current_involved_target_indices[item.target_idx] -= 1\n else: \n del current_involved_target_indices[item.target_idx] \n \n # -- re-compute the epsilon closure of the target states\n current_involved_targets_epsilon_closure = \\\n self.get_epsilon_closure_of_state_set(current_involved_target_indices.keys())\n current_involved_targets_epsilon_closure.sort() \n \n # -- set the begin of interval to come\n current_interval_begin = item.position \n \n # (*) create the list of pairs [target-index-combination, trigger_set] \n result = []\n for key_str, target_index_combination in map_key_str_to_target_index_combination.items():\n result.append([target_index_combination, combinations[key_str]])\n \n return result\n\n def get_acceptance_state_list(self, \n ReturnNonAcceptanceTooF=False, \n SplitAcceptanceStatesByOriginF=False,\n CorePatternF=False):\n \"\"\"Returns the set of states that are 'acceptance'. If the optional \n argument 'ReturnNonAcceptanceTooF' is specified, then the non-\n acceptance states are also returned.\n\n If 'SplitAcceptanceStatesByOriginF'=True, then the list of acceptance\n states is split into sets of states of the same origin. The last state\n set is then the set of non-acceptance states (if requested).\n\n If 'CorePatternF'=True then the 'end acceptance states' of post conditions\n are not returned (acceptance + post condition flag). Instead the core\n patterns acceptance states are returned (post condition flag only).\n \"\"\" \n return filter(lambda s: s.is_acceptance(), self.states.values())\n\n def get_acceptance_state_index_list(self):\n result = []\n for index, state in self.states.items():\n if state.is_acceptance(): result.append(index)\n return result\n\n def get_inverse(self, CutAtShortestAcceptanceF=False):\n \"\"\"Creates an inverse representation of the state machine. Optionally,\n the longer acceptance paths can be cut, in case that there are shorter\n once. This is the contrary of a 'greedy' wildcard, i.e.\n \n (\"hello\"|\"h\") would be equivalent to \"h\" this is by pure\n logic an redundant construct, since \"h\" causes acceptance\", except\n one goes for 'longest match'\n \n Also \"h\"*|\"h\" : HERE cut at first match because it ends after \"h\" \n \"\"\"\n #__________________________________________________________________________________________\n # TODO: See th above comment and think about it.\n assert self.__core.pre_context_sm() == None \\\n and not self.core().pre_context_begin_of_line_f(), \\\n \"pre-conditioned state machines cannot be inverted via 'get_inverse()'\"\n\n #__________________________________________________________________________________________\n result = StateMachine(InitStateIndex=self.init_state_index)\n \n # Ensure that each target state index has a state inside the state machine\n for state_index in self.states.keys():\n result.create_new_state(StateIdx=state_index)\n\n for state_index, state in self.states.items():\n for target_state_index, trigger_set in state.transitions().get_map().items():\n result.states[target_state_index].add_transition(deepcopy(trigger_set), state_index)\n\n for target_state_index in state.transitions().get_epsilon_target_state_index_list():\n result.states[target_state_index].transitions().add_epsilon_target_state(state_index)\n\n # -- copy all origins of the original state machine\n for state_index, state in self.states.items():\n original_origin_list = state.origins().get_list()\n result.states[state_index].origins().set(original_origin_list) # deepcopy implicit\n\n # -- only the initial state becomes an acceptance state\n result.states[self.init_state_index].set_acceptance(True)\n\n # -- setup an epsilon transition from an new init state to all previous \n # acceptance states.\n new_init_state_index = result.create_new_init_state() \n for state_index in self.get_acceptance_state_index_list():\n result.add_epsilon_transition(new_init_state_index, state_index) \n\n # -- for uniqueness of state ids, clone the result\n return result.clone() \n \n def is_empty(self):\n \"\"\"If state machine only contains the initial state that points nowhere,\n then it is empty.\n \"\"\"\n if len(self.states) != 1: return False\n return self.states[self.init_state_index].transitions().is_empty()\n\n def has_origins(self):\n for state in self.states.values():\n if not state.origins().is_empty(): return True\n return False\n\n def delete_meaningless_origins(self):\n \"\"\"Delete origins that do not inform about acceptance, store input position,\n post context, pre context, and the like.\n \"\"\"\n for state in self.states.values():\n state.origins().delete_meaningless()\n\n def mark_state_origins(self, OtherStateMachineID=-1L):\n \"\"\"Marks at each state that it originates from this state machine. This is\n important, when multiple patterns are combined into a single DFA and\n origins need to be traced down. In this case, each pattern (which is\n are all state machines) needs to mark the states with the state machine \n identifier and the state inside this state machine.\n\n If OtherStateMachineID and StateIdx are specified other origins\n than the current state machine can be defined (useful for pre- and post-\n conditions). \n\n DontMarkIfOriginsPresentF can be set to ensure that origin data structures\n are only provided for states where non is set yet. This can be unsed\n to ensure that every state has an origin structure related to it, without\n overiding existing ones.\n \"\"\"\n assert type(OtherStateMachineID) == long\n\n if OtherStateMachineID == -1L: state_machine_id = self.__core.id()\n else: state_machine_id = OtherStateMachineID\n\n for state_idx, state in self.states.items():\n state.mark_self_as_origin(state_machine_id, state_idx)\n\n def create_new_init_state(self, AcceptanceF=False):\n\n self.init_state_index = self.create_new_state()\n return self.init_state_index\n\n def create_new_state(self, AcceptanceF=False, StateIdx=None):\n if StateIdx == None:\n new_state_index = state_machine_index.get()\n else:\n new_state_index = StateIdx\n\n self.states[new_state_index] = State(AcceptanceF)\n return new_state_index\n \n def add_transition(self, StartStateIdx, TriggerSet, TargetStateIdx = None, AcceptanceF = False):\n \"\"\"Adds a transition from Start to Target based on a given Trigger.\n\n TriggerSet can be of different types: ... see add_transition()\n \n (see comment on 'State::add_transition)\n\n RETURNS: The target state index.\n \"\"\"\n assert type(StartStateIdx) == long\n # NOTE: The Transition Constructor is very tolerant, so no tests on TriggerSet()\n # assert TriggerSet.__class__.__name__ == \"NumberSet\"\n assert type(TargetStateIdx) == long or TargetStateIdx == None\n assert type(AcceptanceF) == bool\n\n # If target state is undefined (None) then a new one has to be created\n if TargetStateIdx == None: TargetStateIdx = state_machine_index.get()\n if self.states.has_key(StartStateIdx) == False: self.states[StartStateIdx] = State() \n if self.states.has_key(TargetStateIdx) == False: self.states[TargetStateIdx] = State()\n if AcceptanceF: self.states[TargetStateIdx].set_acceptance(True)\n\n self.states[StartStateIdx].add_transition(TriggerSet, TargetStateIdx)\n\n return TargetStateIdx\n \n def add_epsilon_transition(self, StartStateIdx, TargetStateIdx=None, RaiseAcceptanceF=False):\n assert TargetStateIdx == None or type(TargetStateIdx) == long\n\n # create new state if index does not exist\n if not self.states.has_key(StartStateIdx):\n self.states[StartStateIdx] = State()\n if TargetStateIdx == None:\n TargetStateIdx = self.create_new_state(AcceptanceF=RaiseAcceptanceF)\n elif not self.states.has_key(TargetStateIdx):\n self.states[TargetStateIdx] = State()\n\n # add the epsilon target state\n self.states[StartStateIdx].transitions().add_epsilon_target_state(TargetStateIdx) \n # optionally raise the state of the target to 'acceptance'\n if RaiseAcceptanceF: self.states[TargetStateIdx].set_acceptance(True)\n\n return TargetStateIdx\n\n def mount_to_acceptance_states(self, MountedStateIdx, \n CancelStartAcceptanceStateF=True,\n RaiseTargetAcceptanceStateF=False,\n LeaveStoreInputPositionsF=False):\n \"\"\"Mount on any acceptance state the MountedStateIdx via epsilon transition.\n \"\"\"\n\n for state_idx, state in self.states.items():\n # -- only consider state other than the state to be mounted\n # -- only handle only acceptance states\n if not state_idx != MountedStateIdx: continue\n if not state.is_acceptance(): continue\n # add the MountedStateIdx to the list of epsilon transition targets\n state.transitions().add_epsilon_target_state(MountedStateIdx)\n # if required (e.g. for sequentialization) cancel the acceptance status\n if CancelStartAcceptanceStateF: state.set_acceptance(False, LeaveStoreInputPositionsF)\n\n if RaiseTargetAcceptanceStateF: \n self.states[MountedStateIdx].set_acceptance(True, LeaveStoreInputPositionsF)\n\n def mount_to_initial_state(self, TargetStateIdx):\n \"\"\"Adds an epsilon transition from initial state to the given 'TargetStateIdx'. \n The initial states epsilon transition to TERMINATE is deleted.\"\"\"\n\n assert self.states.has_key(self.init_state_index)\n\n self.states[self.init_state_index].transitions().add_epsilon_target_state(TargetStateIdx)\n\n def filter_dominated_origins(self):\n for state in self.states.values(): \n state.origins().delete_dominated()\n\n def __repr__(self):\n return self.get_string(NormalizeF=True)\n\n def __get_state_sequence_for_print_out(self):\n state_index_sequence = [ self.init_state_index ]\n\n def __dive(state):\n target_state_index_list = state.transitions().get_target_state_index_list()\n # sort by 'lowest trigger'\n def cmp_by_trigger_set(A, B):\n # In case of epsilon transitions, the 'other' dominates.\n try: trigger_set_to_A = state.transitions().get_map()[A]\n except: return -1\n try: trigger_set_to_B = state.transitions().get_map()[B]\n except: return 1\n return cmp(trigger_set_to_A.minimum(), trigger_set_to_A.minimum())\n target_state_index_list.sort(cmp_by_trigger_set)\n \n for state_index in target_state_index_list:\n if state_index in state_index_sequence: continue\n state_index_sequence.append(state_index)\n __dive(self.states[state_index])\n\n __dive(self.states[self.init_state_index])\n\n # There might be 'sick' cases where there are not all states connected.\n if len(self.states.keys()) != len(state_index_sequence):\n state_index_sequence = self.states.keys()\n\n # DEBUG: double check that the sequence is complete\n x = self.states.keys(); x.sort() # DEBUG\n y = deepcopy(state_index_sequence); y.sort() # DEBUG\n assert x == y # DEBUG\n\n return state_index_sequence\n\n def __get_state_index_normalization(self, NormalizeF):\n index_map = {}\n inverse_index_map = {}\n\n index_sequence = self.__get_state_sequence_for_print_out()\n if NormalizeF:\n counter = -1L\n for state_i in index_sequence:\n counter += 1L\n index_map[state_i] = counter\n inverse_index_map[counter] = state_i\n else:\n for state_i in index_sequence:\n index_map[state_i] = state_i\n inverse_index_map[state_i] = state_i\n\n return index_map, inverse_index_map, index_sequence\n\n def get_string(self, NormalizeF=False):\n\n # (*) normalize the state indices\n index_map, inverse_index_map, index_sequence = self.__get_state_index_normalization(NormalizeF)\n\n # (*) construct text \n msg = \"init-state = \" + repr(index_map[self.init_state_index]) + \"\\n\"\n for state_i in index_sequence:\n printed_state_i = index_map[state_i]\n state = self.states[state_i]\n msg += \"%05i\" % printed_state_i + state.get_string(index_map)\n \n if self.__core.pre_context_sm() != None:\n msg += \"pre-condition inverted = \"\n msg += repr(self.core().pre_context_sm()) \n\n return msg\n\n def get_graphviz_string(self, NormalizeF=False):\n # (*) normalize the state indices\n index_map, inverse_index_map, index_sequence = self.__get_state_index_normalization(NormalizeF)\n\n # (*) Border of plot block\n frame_txt = \"\"\"\n digraph state_machine_%i {\n\t rankdir=LR;\n\t size=\"8,5\"\n\t node [shape = doublecircle]; $$ACCEPTANCE_STATES$$;\n node [shape = circle];\n $$TRANSITIONS$$\n }\n \"\"\" % self.get_id()\n\n transition_str = \"\"\n acceptance_state_str = \"\"\n for state_i in index_sequence:\n printed_state_i = index_map[state_i]\n state = self.states[state_i]\n if state.is_acceptance(): \n acceptance_state_str += \"%i; \" % int(printed_state_i)\n transition_str += state.get_graphviz_string(printed_state_i, index_map)\n\n if acceptance_state_str != \"\": acceptance_state_str = acceptance_state_str[:-2]\n return blue_print(frame_txt, [[\"$$ACCEPTANCE_STATES$$\", acceptance_state_str],\n [\"$$TRANSITIONS$$\", transition_str]])\n \n def assert_consistency(self):\n \"\"\"Check: -- whether each target state in contained inside the state machine.\n \"\"\"\n target_state_index_list = self.states.keys()\n for index, state in self.states.items():\n for target_state_index in state.transitions().get_target_state_index_list():\n assert target_state_index in target_state_index_list, \\\n \"state machine contains target state %s that is not contained in itself.\" \\\n % repr(target_state_index) + \"\\n\" \\\n \"present state indices: \" + repr(self.states.keys()) + \"\\n\" + \\\n \"state machine = \" + self.get_string(NormalizeF=False)\n\n" }, { "alpha_fraction": 0.4784542918205261, "alphanum_fraction": 0.4944969117641449, "avg_line_length": 36.37649154663086, "blob_id": "c5ea4f3121e191293bc6c821b1f9eb940bafe1bf", "content_id": "92ff7cf6a298387e4540703e0c99617cc113853a", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 78243, "license_type": "permissive", "max_line_length": 154, "num_lines": 2093, "path": "/gtasa/dffread.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <cstdlib>\n#include <cstddef>\n#include <climits>\n#include <locale>\n//#include <cstdarg>\n#include <map>\n#include <string>\n#include <vector>\n#include <sstream>\n#include <iostream>\n#include <fstream>\n\n//#include <errno.h>\n\n#include <OgreDefaultHardwareBufferManager.h>\n#include <OgreMesh.h>\n#include <OgreSubMesh.h>\n#include <OgreMeshSerializer.h>\n#include <OgreLogManager.h>\n#include <OgreResourceGroupManager.h>\n#include <OgreMeshManager.h>\n#include <OgreLodStrategyManager.h>\n\n#include \"ios_util.h\"\n\n#include \"dffread.h\"\n#include \"ideread.h\"\n#include \"tex_dups.h\"\n\n#ifdef rad2\n#undef rad2\n#endif\n#ifdef min\n#undef min\n#endif\n#ifdef max\n#undef max\n#endif\n\n#define HEX(x) std::hex<<(x)<<std::dec\n\n#define DECHEX(x) (x)<<\" [0x\"<<HEX(x)<<\"]\"\n#define FLTDECHEX(x) (*(float*)&(x))<<\" \"<<(x)<<\" [0x\"<<HEX(x)<<\"]\"\n\nstatic void unrec (const std::string &p, unsigned long type,\n unsigned long size, const std::string &word)\n{\n std::stringstream ss;\n ss << p << type << \" 0x\" << HEX(type)\n << \" (\"<<size<<\"B) UNREC \"<<word<<\" EXT!\";\n GRIT_EXCEPT(ss.str());\n}\n\n\nstatic int tolowr (int c)\n{\n return std::tolower(char(c),std::cout.getloc());\n}\n\nstatic std::string& strlower(std::string& s)\n{\n std::transform(s.begin(),s.end(), s.begin(),tolowr);\n return s;\n}\n\n\n\n#define check_spill(f,s,sz,p) check_spill_(f,s,sz,__FILE__,__LINE__,p)\n\n#define VBOS(x,y) if (x<d) { std::cout<<y<<std::endl; } else { }\n\n\nstatic inline void check_spill_(std::ifstream &f,\n std::streamoff start, unsigned long should,\n const char* src, int line, const std::string &p)\n{{{\n std::streamoff did = (f.tellg() - start);\n ptrdiff_t overspill = did - should;\n if (overspill) {\n std::stringstream msg;\n msg<<p<<\"Read \"<<abs(overspill)<<\" bytes too \"<<(overspill>0?\"many\":\"few\")<<\", \"<<did<<\" not \"<<should<<\" (\"<<src<<\":\"<<line<<\").\u001b[0m\"<<std::endl;\n GRIT_EXCEPT(msg.str());\n }\n}}}\n\n\nstatic void ios_read_texture (int d, std::ifstream &f,\n unsigned long file_version,\n struct texture *t,\n const std::string &p)\n{{{\n unsigned long type, tex_size;\n ios_read_header(f,&type,&tex_size,NULL,&file_version);\n APP_ASSERT(type==RW_TEXTURE);\n std::streamoff tex_start = f.tellg();\n\n unsigned long size;\n ios_read_header(f,&type,&size,NULL,&file_version);\n APP_ASSERT(type==RW_DATA);\n APP_ASSERT(size==4);\n t->filter_flags = ios_read_u16(f);\n VBOS(3,p<<\"filter_flags: \"<<HEX(t->filter_flags));\n t->unk1 = ios_read_u16(f);\n VBOS(3,p<<\"mysterious_flag: \"<<HEX(t->unk1));\n\n ios_read_header(f,&type,&size,NULL,&file_version);\n APP_ASSERT(type==RW_STRING);\n t->name = ios_read_fixedstr(f,size);\n VBOS(3,p<<\"name: \"<<t->name);\n\n ios_read_header(f,&type,&size,NULL,&file_version);\n APP_ASSERT(type==RW_STRING);\n std::string alpha_str = ios_read_fixedstr(f,size);\n t->has_alpha = alpha_str!=\"\";\n VBOS(3,p<<\"has_alpha: \"<<t->has_alpha);\n\n unsigned long totalsize;\n ios_read_header(f,&type,&totalsize,NULL,&file_version);\n APP_ASSERT(type==RW_EXT);\n\n while (totalsize>0) {\n unsigned long size;\n ios_read_header(f,&type,&size,NULL,&file_version);\n totalsize -= size + 12;\n switch(type) {\n case RW_SKY_MIPMAP_VAL: {\n unsigned long sky_mipmap = ios_read_u32(f);\n VBOS(3,p<<\"sky_mipmap: \"<<sky_mipmap);\n } break;\n default:\n unrec(p,type,size,\"TEXTURE\");\n }\n }\n\n check_spill(f,tex_start,tex_size,p);\n}}}\n\n\nstatic void ios_read_material_effs (int d,std::ifstream &f,\n unsigned long file_version,\n struct material *m,\n const std::string &p)\n{{{\n m->mat_type1 = ios_read_u32(f);\n VBOS(3,p<<\"mat_type1: \"<<m->mat_type1);\n m->mat_type2 = ios_read_u32(f);\n VBOS(3,p<<\"mat_type2: \"<<m->mat_type2);\n switch(m->mat_type1) {\n case MATBUMP1:\n APP_ASSERT(m->mat_type2 == MATBUMP2);\n m->multiplier = ios_read_float(f);\n VBOS(3,p<<\"multiplier: \"<<m->multiplier);\n m->dest_blend_type = ios_read_u32(f);\n APP_ASSERT(m->dest_blend_type==0);\n m->num_effects_textures = ios_read_u32(f);\n VBOS(3,p<<\"num_effects_textures: \"<<m->num_effects_textures);\n m->effects_textures.resize(m->num_effects_textures);\n for (unsigned long i=0 ; i<m->num_effects_textures ; i++) {\n std::stringstream prefss;\n prefss<<p<<\"effects_texture[\"<<i<<\"].\";\n std::string pref = prefss.str();\n ios_read_texture(d,f,file_version,&m->effects_textures[i],pref);\n }\n ios_read_u32(f);// WHAT THE FUCK?\n break;\n case MATBUMPENV1:\n APP_ASSERT(m->mat_type2 == MATBUMP1);\n m->multiplier = ios_read_float(f);\n VBOS(3,p<<\"multiplier: \"<<m->multiplier);\n m->dest_blend_type = ios_read_u32(f);\n APP_ASSERT(m->dest_blend_type==0);\n m->num_effects_textures = ios_read_u32(f);\n VBOS(3,p<<\"num_effects_textures: \"<<m->num_effects_textures);\n m->effects_textures.resize(m->num_effects_textures);\n for (unsigned long i=0 ; i<m->num_effects_textures ; i++) {\n std::stringstream prefss;\n prefss<<p<<\"effects_texture[\"<<i<<\"].\";\n std::string pref = prefss.str();\n ios_read_texture(d,f,file_version,&m->effects_textures[i],pref);\n }\n\n m->mat_type3 = ios_read_u32(f);\n VBOS(3,p<<\"mat_type3: \"<<m->mat_type3);\n APP_ASSERT(m->mat_type3 == MATENV1);\n m->multiplier2 = ios_read_float(f);\n VBOS(3,p<<\"multiplier2: \"<<m->multiplier2);\n m->dest_blend_type2 = ios_read_u32(f);\n APP_ASSERT(m->dest_blend_type2==0);\n m->num_effects_textures2 = ios_read_u32(f);\n VBOS(3,p<<\"num_effects_textures2: \"<<m->num_effects_textures2);\n m->effects_textures2.resize(m->num_effects_textures2);\n for (unsigned long i=0 ; i<m->num_effects_textures2 ; i++) {\n std::stringstream prefss;\n prefss<<p<<\"effects_texture[\"<<i<<\"].\";\n std::string pref = prefss.str();\n ios_read_texture(d,f,file_version,&m->effects_textures2[i],pref);\n }\n break;\n case MATUVTRANSFORM1:\n APP_ASSERT(m->mat_type2 == MATUVTRANSFORM2);\n ios_read_u32(f);// WHAT THE FUCK?\n break;\n case MATDUALPASS1:\n APP_ASSERT(m->mat_type2 == MATDUALPASS2);\n m->src_blend_type = ios_read_u32(f);\n VBOS(3,p<<\"src_blend_type: \"<<m->src_blend_type);\n m->dest_blend_type = ios_read_u32(f);\n VBOS(3,p<<\"dest_blend_type: \"<<m->dest_blend_type);\n m->num_effects_textures = ios_read_u32(f);\n VBOS(3,p<<\"num_effects_textures: \"<<m->num_effects_textures);\n m->effects_textures.resize(m->num_effects_textures);\n for (unsigned long i=0 ; i<m->num_effects_textures ; i++) {\n std::stringstream prefss;\n prefss<<p<<\"effects_texture[\"<<i<<\"].\";\n std::string pref = prefss.str();\n ios_read_texture(d,f,file_version, &m->effects_textures[i],pref);\n }\n ios_read_u32(f);// WHAT THE FUCK?\n break;\n case MATENV1:\n APP_ASSERT(m->mat_type2 == MATENV2);\n m->multiplier = ios_read_float(f);\n VBOS(3,p<<\"multiplier: \"<<m->multiplier);\n m->src_blend_type = ios_read_u32(f);\n VBOS(3,p<<\"dest_blend_type: \"<<m->dest_blend_type);\n m->num_effects_textures = ios_read_u32(f);\n VBOS(3,p<<\"num_effects_textures: \"<<m->num_effects_textures);\n m->effects_textures.resize(m->num_effects_textures);\n for (unsigned long i=0 ; i<m->num_effects_textures ; i++) {\n std::stringstream prefss;\n prefss<<p<<\"effects_texture[\"<<i<<\"].\";\n std::string pref = prefss.str();\n ios_read_texture(d,f,file_version, &m->effects_textures[i],pref);\n }\n ios_read_u32(f);// WHAT THE FUCK?\n break;\n default:\n std::stringstream ss;\n ss << p << m->mat_type1 << \" 0x\" << HEX(m->mat_type1)\n << \"UNREC MATERIAL EFFECT!\";\n GRIT_EXCEPT(ss.str());\n }\n}}}\n\nstatic void ios_read_material (int d,\n std::ifstream &f,\n unsigned long file_version,\n struct material *m,\n const std::string &p)\n{{{\n unsigned long type, material_size;\n ios_read_header(f,&type,&material_size,NULL,&file_version); \n APP_ASSERT(type==RW_MATERIAL);\n std::streamoff material_start = f.tellg();\n\n ios_read_header(f,&type,NULL,NULL,&file_version);\n APP_ASSERT(type==RW_DATA);\n unsigned long zero = ios_read_u32(f);\n APP_ASSERT(zero==zero);\n m->colour = ios_read_u32(f);\n m->unk2 = ios_read_u32(f);\n m->num_textures = ios_read_u32(f);\n m->textures.resize(m->num_textures);\n m->unk3 = ios_read_float(f);\n m->unk4 = ios_read_float(f);\n m->unk5 = ios_read_float(f);\n VBOS(3,p<<\"colour: \"<<HEX(m->colour));\n VBOS(3,p<<\"mat_unk2: \"<<HEX(m->unk2));\n VBOS(3,p<<\"num_textures: \"<<m->num_textures);\n VBOS(3,p<<\"mat_unk3: \"<<m->unk3);\n VBOS(3,p<<\"mat_unk4: \"<<m->unk4);\n APP_ASSERT(m->unk5==1.0);\n\n m->textures.resize(m->num_textures);\n for (unsigned long i=0 ; i<m->num_textures ; i++) {\n std::stringstream prefss;\n prefss<<p<<\"texture[\"<<i<<\"].\";\n ios_read_texture(d,f,file_version,&m->textures[i],prefss.str());\n }\n\n unsigned long totalsize;\n ios_read_header(f,&type,&totalsize,NULL,&file_version);\n APP_ASSERT(type==RW_EXT);\n\n while (totalsize>0) {\n unsigned long size;\n ios_read_header(f,&type,&size,NULL,&file_version);\n std::streamoff start = f.tellg();\n totalsize -= size + 12;\n switch (type) {\n case RW_REFLECTION_MATERIAL:\n APP_ASSERT(size==24);\n m->reflection_material.unk1 = ios_read_float(f);\n m->reflection_material.unk2 = ios_read_float(f);\n m->reflection_material.unk3 = ios_read_float(f);\n m->reflection_material.unk4 = ios_read_float(f);\n m->reflection_material.unk5 = ios_read_float(f);\n m->reflection_material.unk6 = ios_read_float(f);\n VBOS(3,p<<\"reflection_material.unk1: \"\n <<m->reflection_material.unk1);\n VBOS(3,p<<\"reflection_material.unk2: \"\n <<m->reflection_material.unk2);\n VBOS(3,p<<\"reflection_material.unk3: \"\n <<m->reflection_material.unk3);\n VBOS(3,p<<\"reflection_material.unk4: \"\n <<m->reflection_material.unk4);\n VBOS(3,p<<\"reflection_material.unk5: \"\n <<m->reflection_material.unk5);\n APP_ASSERT(m->reflection_material.unk6==0.0);\n break;\n case RW_MATERIAL_EFFECTS:\n ios_read_material_effs(d,f,file_version,m,p);\n break;\n case RW_SPEC:\n m->spec_level = ios_read_float(f);\n VBOS(3,p<<\"spec_level: \"<<m->spec_level);\n m->spec_texture = ios_read_fixedstr(f,size-4);\n VBOS(3,p<<\"spec_texture: \"<<m->spec_texture);\n break;\n case RW_UV_ANIMATION:\n unsigned long anim_size;\n ios_read_header(f,&type,&anim_size,NULL,&file_version);\n APP_ASSERT(type==RW_DATA);\n APP_ASSERT(anim_size==36);\n VBOS(1,p<<\"SKIPPING_OVER_ADC: \"<<DECHEX(anim_size));\n ios_read_byte_array(f,NULL,anim_size);\n break;\n case RW_RIGHT_TO_RENDER:\n APP_ASSERT(size==8);\n m->rtr_unk1 = ios_read_u32(f);\n VBOS(3,p<<\"rtr_unk1: \"<<DECHEX(m->rtr_unk1));\n m->rtr_unk2 = ios_read_u32(f);\n VBOS(3,p<<\"rtr_unk2: \"<<DECHEX(m->rtr_unk2));\n break;\n default:\n unrec(p,type,size,\"MATERIAL\");\n }\n check_spill(f,start,size,p);\n }\n check_spill(f,material_start,material_size,p);\n\n}}}\n\n\ntypedef std::vector<unsigned long> Ixs;\ntypedef std::vector<struct vect> Vxs;\n\nstatic Ixs decode_strip (const Ixs &strip, const Vxs &vertexes)\n{\n Ixs r;\n r.reserve((strip.size()-2)*3);\n unsigned long v1=0, v2=0, v3=0;\n int vertexes_so_far = 0;\n int tri_counter = 0;\n // in a triangle strip, the normal alternates.\n // we reverse the order of the vertexes if tri_counter is odd\n for (Ixs::const_iterator i=strip.begin(),i_=strip.end() ; i!=i_ ; i++) {\n v1=v2;\n v2=v3;\n v3 = *i;\n vertexes_so_far++;\n if (vertexes_so_far>=3 && v1!=v2 && v2!=v3 && v3!=v1) {\n if (vect_eq(vertexes[v1],vertexes[v2]) ||\n vect_eq(vertexes[v2],vertexes[v3]) ||\n vect_eq(vertexes[v3],vertexes[v1])) {\n // degenerate due to independent but co-located vertexes\n } else {\n if (tri_counter%2 == 0) {\n r.push_back(v1);\n r.push_back(v2);\n r.push_back(v3);\n } else {\n r.push_back(v1);\n r.push_back(v3);\n r.push_back(v2);\n }\n }\n }\n if (vertexes_so_far>=3) tri_counter++;\n }\n\n return r;\n}\n\nstatic void ios_read_geometry (int d,\n std::ifstream &f,\n unsigned long file_version,\n struct geometry &g,\n const std::string &p)\n{{{\n g.frame = -1;\n\n unsigned long type, geometry_size;\n ios_read_header(f,&type,&geometry_size,NULL,&file_version);\n APP_ASSERT(type==RW_GEOMETRY);\n std::streamoff geometry_start = f.tellg();\n\n unsigned long struct_size;\n ios_read_header(f,&type,&struct_size,NULL,&file_version);\n std::streamoff struct_start = f.tellg();\n APP_ASSERT(type==RW_DATA);\n g.flags = ios_read_u32(f);\n VBOS(3,p<<\"geometry_struct_size: \"<<struct_size);\n VBOS(3,p<<\"geometry_flags: \"<<HEX(g.flags)<<\": \"\n <<(g.flags&GEO_TRISTRIP?\"STRIP \":\"\")\n <<(g.flags&GEO_POSITIONS?\"POS \":\"\")\n <<(g.flags&GEO_TEXCOORDS?\"UV \":\"\")\n <<(g.flags&GEO_COLOURS?\"COLS \":\"\")\n <<(g.flags&GEO_NORMALS?\"NORMS \":\"\")\n <<(g.flags&GEO_LIGHTS?\"LIT \":\"\")\n <<(g.flags&GEO_MODULATE?\"MOD \":\"\")\n <<(g.flags&GEO_TEXCOORDS2?\"UV2 \":\"\")\n <<(g.flags&GEO_UNKNOWN1?\"UNK1 \":\"\")\n <<(g.flags&GEO_UNKNOWN2?\"UNK2 \":\"\"));\n unsigned long tmp = g.flags;\n tmp |= GEO_TRISTRIP;\n tmp |= GEO_POSITIONS;\n tmp |= GEO_TEXCOORDS;\n tmp |= GEO_COLOURS;\n tmp |= GEO_NORMALS;\n tmp |= GEO_LIGHTS;\n tmp |= GEO_MODULATE;\n tmp |= GEO_TEXCOORDS2;\n tmp |= GEO_UNKNOWN1;\n tmp |= GEO_UNKNOWN2;\n APP_ASSERT(tmp==(GEO_TRISTRIP|GEO_POSITIONS|GEO_TEXCOORDS|GEO_COLOURS|\n GEO_NORMALS|GEO_LIGHTS|GEO_MODULATE|GEO_TEXCOORDS2|\n GEO_UNKNOWN1|GEO_UNKNOWN2));\n g.num_faces = ios_read_u32(f);\n VBOS(3,p<<\"num_faces: \"<<g.num_faces);\n g.faces.resize(g.num_faces);\n g.num_vertexes = ios_read_u32(f);\n VBOS(3,p<<\"num_vertexes: \"<<g.num_vertexes);\n g.vertexes.resize(g.num_vertexes);\n g.num_frames = ios_read_u32(f);\n APP_ASSERT(g.num_frames==1);\n if (file_version==0x1003FFFF) {\n g.ambient = ios_read_float(f);\n g.diffuse = ios_read_float(f);\n g.specular = ios_read_float(f);\n VBOS(0,p<<\"lighting: \"<<g.ambient<<\" \"<<g.diffuse<<\" \"<<g.specular);\n }\n if (g.flags&GEO_COLOURS) {\n g.vertex_cols.resize(g.num_vertexes);\n for (unsigned long i=0 ; i<g.num_vertexes ; i++) {\n g.vertex_cols[i] = ios_read_u32(f);\n VBOS(4,p<<\"vertex_cols[\"<<i<<\"]: \"<<HEX(g.vertex_cols[i]));\n }\n }\n if (g.flags&GEO_UNKNOWN1) {\n g.tex_coords.resize(g.num_vertexes);\n for (unsigned long i=0 ; i<g.num_vertexes ; i++) {\n g.tex_coords[i].u = ios_read_float(f);\n g.tex_coords[i].v = ios_read_float(f);\n VBOS(4,p<<\"texture_coords[\"<<i<<\"]: \"\n <<g.tex_coords[i].u<<\" \"<<g.tex_coords[i].v);\n }\n }\n if (g.flags&GEO_UNKNOWN2) {\n g.tex_coords2.resize(g.num_vertexes);\n for (unsigned long i=0 ; i<g.num_vertexes ; i++) {\n g.tex_coords2[i].u = ios_read_float(f);\n g.tex_coords2[i].v = ios_read_float(f);\n VBOS(4,p<<\"texture_coords2[\"<<i<<\"]: \"\n <<g.tex_coords2[i].u<<\" \"<<g.tex_coords2[i].v);\n }\n g.lights.resize(g.num_vertexes);\n for (unsigned long i=0 ; i<g.num_vertexes ; i++) {\n g.lights[i].unk1 = ios_read_float(f);\n g.lights[i].unk2 = ios_read_float(f);\n VBOS(4,p<<\"lights[\"<<i<<\"]: \"\n <<g.lights[i].unk1<<\" \"<<g.lights[i].unk2);\n }\n }\n for (unsigned long i=0 ; i<g.num_faces ; i++) {\n g.faces[i].v2 = ios_read_u16(f);\n g.faces[i].v1 = ios_read_u16(f);\n g.faces[i].flags = ios_read_u16(f);\n g.faces[i].v3 = ios_read_u16(f);\n VBOS(4,p<<\"face[\"<<i<<\"]: \"\n <<g.faces[i].v1<<\" \"<<g.faces[i].v2<<\" \"\n <<g.faces[i].v3<<\" \"<<HEX(g.faces[i].flags));\n }\n g.b_x = ios_read_float(f);\n g.b_y = ios_read_float(f);\n g.b_z = ios_read_float(f);\n g.b_r = ios_read_float(f);\n VBOS(3,p<<\"bounding_sphere: (\"\n <<g.b_x<<\",\"<<g.b_y<<\",\"<<g.b_z<<\") radius \"<<g.b_r);\n g.has_position = ios_read_u32(f);\n VBOS(3,p<<\"has_position: \"<<g.has_position);\n g.has_normals = ios_read_u32(f);\n VBOS(3,p<<\"has_normals: \"<<g.has_normals);\n //if (g.flags&GEO_POSITIONS) {\n if (g.has_position) {\n g.vertexes.resize(g.num_vertexes);\n for (unsigned long i=0 ; i<g.num_vertexes ; i++) {\n g.vertexes[i].x = ios_read_float(f);\n g.vertexes[i].y = ios_read_float(f);\n g.vertexes[i].z = ios_read_float(f);\n VBOS(4,p<<\"vertex_coords[\"<<i<<\"]: \"\n <<\"(\"<<g.vertexes[i].x<<\",\"<<g.vertexes[i].y\n <<\",\"<<g.vertexes[i].z<<\")\");\n }\n }\n //if (g.flags&GEO_NORMALS) {\n if (g.has_normals) {\n g.normals.resize(g.num_vertexes);\n for (unsigned long i=0 ; i<g.num_vertexes ; i++) {\n g.normals[i].x = ios_read_float(f);\n g.normals[i].y = ios_read_float(f);\n g.normals[i].z = ios_read_float(f);\n VBOS(4,p<<\"vertex_normals[\"<<i<<\"]: \"\n <<\"(\"<<g.normals[i].x<<\",\"<<g.normals[i].y\n <<\",\"<<g.normals[i].z<<\")\");\n }\n }\n check_spill(f,struct_start,struct_size,p);\n\n ios_read_header(f,&type,NULL,NULL,&file_version);\n APP_ASSERT(type==RW_MATERIAL_LIST);\n\n ios_read_header(f,&type,NULL,NULL,&file_version);\n APP_ASSERT(type==RW_DATA);\n g.num_materials = ios_read_u32(f);\n g.materials.resize(g.num_materials);\n VBOS(4,p<<\"num_materials: \"<<g.num_materials);\n for (unsigned long i=0 ; i<g.num_materials ; i++) {\n unsigned long big = ios_read_u32(f);\n APP_ASSERT(big==ULONG_MAX);\n }\n\n for (unsigned long i=0 ; i<g.num_materials ; i++) {\n std::stringstream prefss;\n prefss<<p<<\"material[\"<<i<<\"].\";\n ios_read_material(d,f,file_version,&g.materials[i],prefss.str());\n }\n\n unsigned long totalsize;\n ios_read_header(f,&type,&totalsize,NULL,&file_version);\n APP_ASSERT(type==RW_EXT);\n\n while (totalsize>0) {\n unsigned long size; \n ios_read_header(f,&type,&size,NULL,&file_version);\n totalsize -= size + 12;\n switch (type) {\n case RW_MATERIALSPLIT:\n g.face_type = ios_read_u32(f);\n VBOS(3,p<<\"face_type: \"<<g.face_type);\n g.num_mat_spls = ios_read_u32(f);\n g.mat_spls.resize(g.num_mat_spls);\n VBOS(3,p<<\"num_mat_spls: \"<<g.num_mat_spls);\n g.num_indexes = ios_read_u32(f);\n VBOS(3,p<<\"num_indexes: \"<<g.num_indexes);\n for (unsigned long i=0 ; i<g.num_mat_spls ; i++) {\n std::stringstream prefss;\n prefss<<p<<\"MatSplit[\"<<i<<\"].\";\n std::string pref = prefss.str();\n struct MatSplit &s = g.mat_spls[i];\n s.num_indexes =ios_read_u32(f);\n VBOS(3,pref<<\"num_indexes: \"<<s.num_indexes);\n s.material = ios_read_u32(f);\n VBOS(3,pref<<\"material: \"<<s.material);\n s.indexes2.resize(s.num_indexes);\n for (unsigned long j=0 ; j<s.num_indexes ; j++) {\n s.indexes2[j] = ios_read_u32(f);\n VBOS(4,pref<<\"index[\"<<j<<\"]: \"<<s.indexes2[j]);\n }\n if (g.flags & GEO_TRISTRIP)\n s.indexes2 = decode_strip(s.indexes2, g.vertexes);\n }\n break;\n case RW_NIGHT:\n g.vertex_night_unk = ios_read_u32(f);\n VBOS(3,p<<\"vertex_night_unk: \"<<HEX(g.vertex_night_unk));\n if (!g.vertex_night_unk) break;\n g.vertex_night_cols.resize(g.num_vertexes);\n for (unsigned long i=0 ; i<g.num_vertexes ; i++) {\n g.vertex_night_cols[i] = ios_read_u32(f);\n VBOS(4,p<<\"vertex_night_colour[\"<<i<<\"]: \"\n <<HEX(g.vertex_night_cols[i]));\n }\n break;\n case RW_ADC:\n VBOS(1,p<<\"SKIPPING_OVER_ADC: \"<<DECHEX(size));\n ios_read_byte_array(f,NULL,size);\n break;\n case RW_SKIN:\n VBOS(1,p<<\"SKIPPING_OVER_SKIN: \"<<DECHEX(size));\n ios_read_byte_array(f,NULL,size);\n break;\n case RW_MESHEXT: {\n\n std::streamoff mesh_ext_start = f.tellg();\n\n unsigned long fourcc = ios_read_u32(f);\n if (fourcc) {\n unsigned long one = ios_read_u32(f);\n (void)one;\n //APP_ASSERT(one==1);\n unsigned long vcount = ios_read_u32(f);\n unsigned long unk1 = ios_read_u32(f);\n VBOS(3,p<<\"meshext_unk1: \"<<DECHEX(unk1));\n unsigned long unk2 = ios_read_u32(f);\n VBOS(3,p<<\"meshext_unk2: \"<<DECHEX(unk2));\n unsigned long unk3 = ios_read_u32(f);\n VBOS(3,p<<\"meshext_unk3: \"<<DECHEX(unk3));\n unsigned long fcount = ios_read_u32(f);\n unsigned long unk4 = ios_read_u32(f);\n VBOS(3,p<<\"meshext_unk4: \"<<DECHEX(unk4));\n unsigned long unk5 = ios_read_u32(f);\n VBOS(3,p<<\"meshext_unk5: \"<<DECHEX(unk5));\n unsigned long fragcount = ios_read_u32(f);\n unsigned long unk6 = ios_read_u32(f);\n VBOS(3,p<<\"meshext_unk6: \"<<DECHEX(unk6));\n unsigned long unk7 = ios_read_u32(f);\n VBOS(3,p<<\"meshext_unk7: \"<<DECHEX(unk7));\n unsigned long unk8 = ios_read_u32(f);\n VBOS(3,p<<\"meshext_unk8: \"<<DECHEX(unk8));\n unsigned long unk9 = ios_read_u32(f);\n VBOS(3,p<<\"meshext_unk9: \"<<DECHEX(unk9));\n\n g.meshext_vertexes.reserve(3*vcount);\n for (unsigned long i=0 ; i<vcount ; ++i) {\n g.meshext_vertexes.push_back(ios_read_float(f));\n g.meshext_vertexes.push_back(ios_read_float(f));\n g.meshext_vertexes.push_back(ios_read_float(f));\n }\n\n g.meshext_texcoords.reserve(2*vcount);\n for (unsigned long i=0 ; i<vcount ; ++i) {\n g.meshext_texcoords.push_back(ios_read_float(f));\n g.meshext_texcoords.push_back(ios_read_float(f));\n }\n\n g.meshext_vertexcols.reserve(vcount);\n for (unsigned long i=0 ; i<vcount ; ++i) {\n g.meshext_vertexcols.push_back(ios_read_u32(f));\n }\n\n g.meshext_indexes.reserve(3*fcount);\n for (unsigned long i=0 ; i<fcount ; ++i) {\n g.meshext_indexes.push_back(ios_read_u16(f));\n g.meshext_indexes.push_back(ios_read_u16(f));\n g.meshext_indexes.push_back(ios_read_u16(f));\n }\n\n g.meshext_face_fragment.reserve(fcount);\n for (unsigned long i=0 ; i<fcount ; ++i) {\n g.meshext_face_fragment.push_back(ios_read_u16(f));\n }\n\n g.meshext_fragments.resize(fragcount);\n\n for (unsigned long i=0 ; i<fragcount ; ++i) {\n fragment &frag = g.meshext_fragments[i];\n frag.texname = ios_read_fixedstr(f,32);\n VBOS(3,p<<\"meshext_frag[\"<<i<<\"].tex: \"<<frag.texname);\n }\n\n for (unsigned long i=0 ; i<fragcount ; ++i) {\n fragment &frag = g.meshext_fragments[i];\n frag.atexname = ios_read_fixedstr(f,32);\n VBOS(3,p<<\"meshext_frag[\"<<i<<\"].atex: \"<<frag.atexname);\n }\n\n for (unsigned long i=0 ; i<fragcount ; ++i) {\n fragment &frag = g.meshext_fragments[i];\n frag.unk1 = ios_read_float(f);\n VBOS(3,p<<\"meshext_frag[\"<<i<<\"].unk1: \"<<frag.unk1);\n }\n\n for (unsigned long i=0 ; i<fragcount ; ++i) {\n fragment &frag = g.meshext_fragments[i];\n frag.unk2 = ios_read_float(f);\n VBOS(3,p<<\"meshext_frag[\"<<i<<\"].unk2: \"<<frag.unk2);\n }\n\n for (unsigned long i=0 ; i<fragcount ; ++i) {\n fragment &frag = g.meshext_fragments[i];\n frag.unk3 = ios_read_float(f);\n VBOS(3,p<<\"meshext_frag[\"<<i<<\"].unk3: \"<<frag.unk3);\n }\n\n check_spill(f,mesh_ext_start,size,p);\n\n }\n } break;\n\n case RW_2DFX: {\n uint32_t num_2dfx = ios_read_u32(f);\n VBOS(1,p<<\"num_2dfx = \"<<num_2dfx);\n g.twodfxs.resize(num_2dfx);\n uint32_t counter = 4;\n for (unsigned j=0 ; j<num_2dfx ; ++j) {\n twodfx &fx = g.twodfxs[j];\n fx.x = ios_read_float(f);\n fx.y = ios_read_float(f);\n fx.z = ios_read_float(f);\n VBOS(1,p<<\"2DFX[\"<<j<<\"].x = \"<<fx.x);\n VBOS(1,p<<\"2DFX[\"<<j<<\"].y = \"<<fx.y);\n VBOS(1,p<<\"2DFX[\"<<j<<\"].z = \"<<fx.z);\n fx.type = ios_read_u32(f);\n VBOS(1,p<<\"2DFX[\"<<j<<\"].type = \"<<fx.type);\n fx.sz = ios_read_u32(f);\n counter += fx.sz + 20;\n VBOS(1,p<<\"2DFX[\"<<j<<\"].sz = \"<<fx.sz);\n switch (fx.type) {\n case TWODFX_LIGHT:\n fx.light.r = ios_read_u8(f);\n VBOS(1,p<<\"2DFX[\"<<j<<\"].light.r = \"<<(int)fx.light.r);\n fx.light.g = ios_read_u8(f);\n VBOS(1,p<<\"2DFX[\"<<j<<\"].light.g = \"<<(int)fx.light.g);\n fx.light.b = ios_read_u8(f);\n VBOS(1,p<<\"2DFX[\"<<j<<\"].light.b = \"<<(int)fx.light.b);\n fx.light.x = ios_read_u8(f);\n VBOS(1,p<<\"2DFX[\"<<j<<\"].light.x = \"<<(int)fx.light.x);\n fx.light.draw_distance = ios_read_float(f);\n VBOS(1,p<<\"2DFX[\"<<j<<\"].light.draw_distance = \"<<fx.light.draw_distance);\n fx.light.outer_range = ios_read_float(f);\n VBOS(1,p<<\"2DFX[\"<<j<<\"].light.outer_range = \"<<fx.light.outer_range);\n fx.light.size = ios_read_float(f);\n VBOS(1,p<<\"2DFX[\"<<j<<\"].light.size = \"<<fx.light.size);\n fx.light.inner_range = ios_read_float(f);\n VBOS(1,p<<\"2DFX[\"<<j<<\"].light.inner_range = \"<<fx.light.inner_range);\n for (int pi=0 ; pi<5; ++pi) {\n fx.light.params[pi] = ios_read_u8(f);\n VBOS(1,p<<\"2DFX[\"<<j<<\"].light.params[\"<<pi<<\"] = \"<<(int)fx.light.params[pi]);\n }\n fx.light.corona_name = ios_read_fixedstr(f,24);\n VBOS(1,p<<\"2DFX[\"<<j<<\"].light.corona_name = \"<<fx.light.corona_name);\n fx.light.shadow_name = ios_read_fixedstr(f,24);\n VBOS(1,p<<\"2DFX[\"<<j<<\"].light.shadow_name = \"<<fx.light.shadow_name);\n fx.light.flare = ios_read_s32(f);\n VBOS(1,p<<\"2DFX[\"<<j<<\"].light.flare = \"<<fx.light.flare);\n for (int pi=0 ; pi<3; ++pi) {\n fx.light.flare_params[pi] = ios_read_u8(f);\n VBOS(1,p<<\"2DFX[\"<<j<<\"].light.flare_params[\"<<pi<<\"] = \"<<(int)fx.light.flare_params[pi]);\n }\n break;\n case TWODFX_PFX:\n fx.pfx.particle_name = ios_read_fixedstr(f,24);\n VBOS(1,p<<\"2DFX[\"<<j<<\"].pfx.particle_name = \"<<fx.pfx.particle_name);\n break;\n case TWODFX_PED:\n case TWODFX_UNK1:\n case TWODFX_SIGN:\n case TWODFX_SLOTMACHINE:\n case TWODFX_UNK2:\n case TWODFX_ESCALATOR:\n VBOS(1,p<<\"Skipping over 2DFX type: \"<<fx.type<<\" of size \"<<DECHEX(fx.sz));\n ios_read_byte_array(f,NULL,fx.sz);\n break;\n default:\n GRIT_EXCEPT(\"Unknown 2DFX type!\");\n };\n }\n APP_ASSERT(counter==size);\n } break;\n default:\n unrec(p,type,size,\"GEOMETRY\");\n }\n }\n\n check_spill(f,geometry_start,geometry_size,p);\n}}}\n\n\nvoid ios_read_dff (int d, std::ifstream &f, struct dff *c, const std::string &p,\n const std::string &phys_mat_pref, MaterialMap &db)\n{{{\n unsigned long type, file_version, dff_size;\n ios_read_header(f,&type,&dff_size,&file_version,NULL);\n VBOS(3,p<<\"file_version: \"<<DECHEX(file_version));\n unsigned long size;\n if (type==RW_UV_ANIMATION_DICTIONARY) {\n size = dff_size;\n VBOS(1,p<<\"SKIPPING_OVER_UV_ANIM_DICT: \"<<DECHEX(size));\n ios_read_byte_array(f,NULL,size); // TODO\n ios_read_header(f,&type,&dff_size,NULL,&file_version);\n }\n std::streamoff dff_start = f.tellg();\n\n APP_ASSERT(type==RW_CHUNK);\n\n ios_read_header(f,&type,&size,NULL,&file_version);\n APP_ASSERT(type==RW_DATA);\n APP_ASSERT(size==12);\n unsigned long num_objects = ios_read_u32(f);\n VBOS(3,p<<\"num_objects: \"<<num_objects);\n unsigned long num_lights = ios_read_u32(f);\n VBOS(3,p<<\"num_lights: \"<<num_lights);\n unsigned long unk2 = ios_read_u32(f);\n APP_ASSERT(unk2==0);\n\n // frame list\n ios_read_header(f,&type,&size,NULL,&file_version);\n APP_ASSERT(type==RW_FRAME_LIST);\n ios_read_header(f,&type,&size,NULL,&file_version);\n APP_ASSERT(type==RW_DATA);\n unsigned long num_frames = ios_read_u32(f);\n c->frames.resize(num_frames);\n VBOS(3,p<<\"num_frames: \"<<num_frames);\n for (unsigned long i=0 ; i<num_frames ; i++) {\n std::stringstream prefss;\n prefss<<p<<\"frame[\"<<i<<\"].\";\n std::string pref = prefss.str();\n for (int j=0 ; j<9 ; j++) {\n float v = ios_read_float(f);\n c->frames[i].rot[j] = v;\n VBOS(4,pref<<\"rot[\"<<j<<\"]: \"<<v);\n }\n c->frames[i].x = ios_read_float(f);\n VBOS(3,pref<<\"x: \"<<c->frames[i].x);\n c->frames[i].y = ios_read_float(f);\n VBOS(3,pref<<\"y: \"<<c->frames[i].y);\n c->frames[i].z = ios_read_float(f);\n VBOS(3,pref<<\"z: \"<<c->frames[i].z);\n long parent = ios_read_s32(f);\n c->frames[i].parent_frame = parent;\n VBOS(3,pref<<\"parent_frame: \"<<parent);\n if (parent==-1) {\n c->root_frame = i;\n } else {\n c->frames[parent].children.push_back(i);\n }\n c->frames[i].unk = ios_read_u32(f);\n VBOS(3,pref<<\"unk: \"<<c->frames[i].unk);\n }\n\n for (unsigned long i=0 ; i<num_frames ; i++) {\n std::stringstream prefss;\n prefss<<p<<\"frame[\"<<i<<\"].\";\n std::string pref = prefss.str();\n c->frames[i].geometry = -1;\n unsigned long total_size;\n ios_read_header(f,&type,&total_size,NULL,&file_version);\n APP_ASSERT(type==RW_EXT);\n while (total_size>0) {\n ios_read_header(f,&type,&size,NULL,&file_version);\n total_size -= size + 12;\n switch(type) {\n case RW_BONE:\n c->frames[i].bone_unk_flags = ios_read_u32(f);\n APP_ASSERT(c->frames[i].bone_unk_flags==0x100);\n c->frames[i].bone_id = ios_read_u32(f);\n VBOS(3,pref<<\"bone_id: \"<<c->frames[i].bone_id);\n c->frames[i].num_bones = ios_read_u32(f);\n VBOS(3,pref<<\"num_bones: \"<<c->frames[i].num_bones);\n c->frames[i].bone_ids.resize\n (c->frames[i].num_bones);\n c->frames[i].bone_nums.resize\n (c->frames[i].num_bones);\n c->frames[i].bone_types.resize\n (c->frames[i].num_bones);\n if (c->frames[i].num_bones) {\n c->frames[i].bone_unk1 =ios_read_u32(f);\n VBOS(3,pref<<\"bone_unk1: \"<<c->frames[i].bone_unk1);\n c->frames[i].bone_unk2 =ios_read_u32(f);\n VBOS(3,pref<<\"bone_unk2: \"<<c->frames[i].bone_unk2);\n }\n for (unsigned long j=0 ;j<c->frames[i].num_bones; j++) {\n c->frames[i].bone_ids[j] = ios_read_u32(f);\n VBOS(3,pref<<\"bone[\"<<j<<\"].id: \"\n <<c->frames[i].bone_ids[j]);\n c->frames[i].bone_nums[j] =ios_read_u32(f);\n VBOS(3,pref<<\"bone[\"<<j<<\"].num: \"\n <<c->frames[i].bone_nums[j]);\n c->frames[i].bone_types[j]=ios_read_u32(f);\n VBOS(3,pref<<\"bone[\"<<j<<\"].type: \"\n <<c->frames[i].bone_types[j]);\n }\n break;\n case RW_FRAME: {\n c->frames[i].name = ios_read_fixedstr(f,size);\n break;\n } default:\n unrec(p,type,size,\"FRAME\");\n }\n }\n VBOS(3,pref<<\"name: \"<<c->frames[i].name);\n }\n\n // frame list\n ios_read_header(f,&type,&size,NULL,&file_version);\n APP_ASSERT(type==RW_GEOMETRY_LIST);\n ios_read_header(f,&type,&size,NULL,&file_version);\n APP_ASSERT(type==RW_DATA);\n unsigned long num_geometries = ios_read_u32(f);\n c->geometries.resize(num_geometries);\n VBOS(3,p<<\"num_geometries: \"<<num_geometries);\n for (unsigned long i=0 ; i<num_geometries ; i++) {\n std::stringstream prefss;\n prefss<<p<<\"geometry[\"<<i<<\"].\";\n std::string pref = prefss.str();\n ios_read_geometry(d,f,file_version,c->geometries[i],pref);\n }\n\n c->objects.resize(num_objects);\n for (unsigned long i=0 ; i<num_objects ; i++) {\n std::stringstream prefss;\n prefss<<p<<\"object[\"<<i<<\"].\";\n std::string pref = prefss.str();\n ios_read_header(f,&type,&size,NULL,&file_version);\n APP_ASSERT(type==RW_ATOMIC);\n ios_read_header(f,&type,&size,NULL,&file_version);\n APP_ASSERT(type==RW_DATA);\n APP_ASSERT(size==16);\n unsigned long frame_index = ios_read_u32(f);\n c->objects[i].frame_index = frame_index;\n VBOS(3,pref<<\"frame_index: \"<<frame_index);\n long geometry_index = ios_read_s32(f);\n c->objects[i].geometry_index = geometry_index;\n VBOS(3,pref<<\"geometry_index: \"<<geometry_index);\n unsigned long five = ios_read_u32(f);\n APP_ASSERT(five==5);\n unsigned long zero = ios_read_u32(f);\n APP_ASSERT(zero==0);\n\n APP_ASSERT(c->frames[frame_index].geometry==-1);\n c->frames[frame_index].geometry = geometry_index;\n\n APP_ASSERT(c->geometries[geometry_index].frame==-1);\n c->geometries[geometry_index].frame = (long)frame_index;\n\n unsigned long total_size;\n ios_read_header(f,&type,&total_size,NULL,&file_version);\n APP_ASSERT(type==RW_EXT);\n while (total_size>0) {\n ios_read_header(f,&type,&size,NULL,&file_version);\n total_size -= size + 12;\n switch(type) {\n case RW_RIGHT_TO_RENDER:\n APP_ASSERT(size==8);\n c->objects[i].rtr_unk1 = ios_read_u32(f);\n VBOS(3,pref<<\"rtr_unk1: \"<<DECHEX(c->objects[i].rtr_unk1));\n c->objects[i].rtr_unk2 = ios_read_u32(f);\n VBOS(3,pref<<\"rtr_unk2: \"<<DECHEX(c->objects[i].rtr_unk2));\n break;\n\n case RW_MATERIAL_EFFECTS: {\n APP_ASSERT(size==4);\n unsigned long eff = ios_read_u32(f);\n APP_ASSERT(eff==1);\n } break;\n\n case RW_UNKNOWN:\n APP_ASSERT(size==4);\n c->unk = ios_read_u32(f);\n VBOS(3,pref<<\"obj_ext_unk: \"<<c->unk);\n break;\n\n default:\n unrec(p,type,size,\"ATOMIC\");\n }\n }\n }\n\n // gos_town, racespot.dff has num_lights==0 but 10 light sections here so\n // ignore this header value\n //c->lights.resize(num_lights);\n unsigned long totalsize; // used after the loop\n int counter = 0;\n while (true) {\n light2 light;\n std::stringstream prefss;\n prefss<<p<<\"light[\"<<counter<<\"].\";\n std::string pref = prefss.str();\n ios_read_header(f,&type,&size,NULL,&file_version);\n if (type==RW_EXT) {\n totalsize = size;\n break;\n }\n APP_ASSERT(type==RW_DATA);\n APP_ASSERT(size==4);\n unsigned long num = ios_read_u32(f);\n (void)num;\n //APP_ASSERT(num==counter+1);\n\n ios_read_header(f,&type,&size,NULL,&file_version);\n APP_ASSERT(type==RW_LIGHT);\n APP_ASSERT(size==48);\n\n ios_read_header(f,&type,&size,NULL,&file_version);\n APP_ASSERT(type==RW_DATA);\n APP_ASSERT(size==24);\n light.unk1 = ios_read_float(f);\n VBOS(3,pref<<\"unk1: \"<<light.unk1);\n light.unk3 = ios_read_float(f);\n VBOS(3,pref<<\"unk2: \"<<light.unk2);\n light.unk3 = ios_read_float(f);\n VBOS(3,pref<<\"unk3: \"<<light.unk3);\n light.unk4 = ios_read_float(f);\n VBOS(3,pref<<\"unk4: \"<<light.unk4);\n light.unk5 = ios_read_float(f);\n VBOS(3,pref<<\"unk5: \"<<light.unk5);\n light.flags = ios_read_u32(f);\n VBOS(3,pref<<\"flags: 0x\"<<std::hex<<light.flags<<std::dec);\n\n ios_read_header(f,&type,&size,NULL,&file_version);\n APP_ASSERT(type==RW_EXT);\n APP_ASSERT(size==0);\n\n c->lights.push_back(light);\n counter++;\n }\n\n c->has_tcol = false;\n\n while (totalsize>0) {\n unsigned long size;\n ios_read_header(f,&type,&size,NULL,&file_version);\n totalsize -= size + 12;\n switch (type) {\n case RW_COLLISION: {\n VBOS(1,p<<\"Reading col data... \"<<DECHEX(size));\n // rccam seems to have broken col, this is a crude heuristic to catch it\n if (size==160) { \n unsigned char *data = new unsigned char[size];\n ios_read_byte_array(f,data,size); //TODO\n //std::ofstream f;\n //f.open(\"tmp.bin\", std::ios::binary);\n //f.write((char*)data, size);\n delete [] data;\n } else {\n parse_col(c->col_name, f, c->tcol, phys_mat_pref, db, d-1);\n c->has_tcol = true;\n }\n } break;\n default:\n unrec(p,type,size,\"MODEL\");\n }\n }\n\n check_spill(f,dff_start,dff_size,p);\n\n //everything has just one clump except clothing which seems to have 3...\n //unsigned char byte = ios_read_u8(f);\n //APP_ASSERT(byte==0);\n\n}}}\n\nvoid offset_dff (dff &dff, float x, float y, float z)\n{{{\n for (unsigned long j=0 ; j<dff.frames.size() ; ++j) {\n frame &fr = dff.frames[j];\n fr.x += x;\n fr.y += y;\n fr.z += z;\n }\n/* offsetting the frames is obviously enough\n for (unsigned long i=0 ; i<dff.geometries.size() ; i++) {\n geometry &g = dff.geometries[i];\n std::vector<vect> &vs = g.vertexes;\n for (unsigned long j=0 ; j<vs.size() ; ++j) {\n vect &v = vs[j];\n v.x += x;\n v.y += y;\n v.z += z;\n }\n }\n*/\n if (dff.has_tcol) {\n tcol_offset(dff.tcol, x, y, z);\n }\n}}}\n\nstatic float &lu(float (&rot)[9], int x, int y)\n{\n return rot[x*3+y];\n}\nvoid reset_dff_frame (dff &dff, unsigned frame_id)\n{\n APP_ASSERT(frame_id<dff.frames.size());\n frame &fr = dff.frames[frame_id];\n\n geometry &g = dff.geometries[fr.geometry];\n std::vector<vect> &vs = g.vertexes;\n for (unsigned long j=0 ; j<vs.size() ; ++j) {\n vect &v = vs[j];\n float x_ = lu(fr.rot,0,0)*v.x + lu(fr.rot,1,0)*v.y + lu(fr.rot,2,0)*v.z;\n float y_ = lu(fr.rot,0,1)*v.x + lu(fr.rot,1,1)*v.y + lu(fr.rot,2,1)*v.z;\n float z_ = lu(fr.rot,0,2)*v.x + lu(fr.rot,1,2)*v.y + lu(fr.rot,2,2)*v.z;\n v.x = x_ + fr.x;\n v.y = y_ + fr.y;\n v.z = z_ + fr.z;\n }\n\n for (unsigned long j=0 ; j<fr.children.size() ; ++j) {\n APP_ASSERT(j<dff.frames.size());\n frame &frc = dff.frames[frame_id];\n float x_ = lu(fr.rot,0,0)*frc.x + lu(fr.rot,1,0)*frc.y + lu(fr.rot,2,0)*frc.x;\n float y_ = lu(fr.rot,0,1)*frc.x + lu(fr.rot,1,1)*frc.y + lu(fr.rot,2,1)*frc.z;\n float z_ = lu(fr.rot,0,2)*frc.x + lu(fr.rot,1,2)*frc.y + lu(fr.rot,2,2)*frc.z;\n frc.x = x_ + fr.x;\n frc.y = y_ + fr.y;\n frc.z = z_ + fr.z;\n // TODO: matrix multiplication\n float rot_[9] = {0};\n for (int i=0 ; i<9 ; ++i) {\n frc.rot[i] = rot_[i];\n }\n }\n \n fr.x = 0;\n fr.y = 0;\n fr.z = 0;\n for (int i=0 ; i<9 ; ++i) fr.rot[i] = 0;\n}\n\n////////////////////////////////////////////////////////////////////////////////\n// OUTPUT OF MESH AND MATERIALS ////////////////////////////////////////////////\n////////////////////////////////////////////////////////////////////////////////\n\nvoid ind (std::ostream &out, unsigned int level)\n{\n for (unsigned int i=0 ; i<level ; i++)\n out << \" \";\n}\n\n\n#define ARRLEN(a) (sizeof a/sizeof *a)\n\nstd::string get_tex_name (const std::string &img,\n const std::string &txd,\n std::string tex_name)\n{{{\n strlower(tex_name);\n tex_name += \".dds\";\n\n if (txd!=\"\") tex_name = txd + \".txd\" + \"/\" + tex_name;\n if (img!=\"\") tex_name = img + \"/\" + tex_name;\n //if (mod_name!=\"\") tex_name = mod_name + \"/\" + tex_name;\n\n // if it's a duplicate of another texture, use the other texture instead\n tex_name = tex_dup(tex_name);\n\n return tex_name;\n}}}\n\nbool operator< (const existing_material &a, const existing_material &b)\n{\n if (a.texs > b.texs) return false;\n if (a.texs < b.texs) return true;\n if (a.alpha_blend > b.alpha_blend) return false;\n if (a.alpha_blend < b.alpha_blend) return true;\n if (a.no_alpha_reject > b.no_alpha_reject) return false;\n if (a.no_alpha_reject < b.no_alpha_reject) return true;\n if (a.double_sided > b.double_sided) return false;\n if (a.double_sided < b.double_sided) return true;\n if (a.dynamic_lighting < b.dynamic_lighting) return true;\n if (a.dynamic_lighting > b.dynamic_lighting) return false;\n if (a.r > b.r) return false;\n if (a.r < b.r) return true;\n if (a.g > b.g) return false;\n if (a.g < b.g) return true;\n if (a.b > b.b) return false;\n if (a.b < b.b) return true;\n if (a.a > b.a) return false;\n if (a.a < b.a) return true;\n return false;\n}\n\nconst std::string &already_seen (MatDB &matdb,\n float r,float g,float b,float a,\n const Strings& texs,\n bool alpha_blend, bool no_alpha_reject,\n bool double_sided, bool dynamic_lighting,\n const std::string& new_name)\n{{{\n struct existing_material m =\n {r,g,b,a,texs,alpha_blend,no_alpha_reject,double_sided,dynamic_lighting};\n std::string &existing = matdb[m];\n if (existing==\"\") {\n existing = new_name;\n //std::cout<<\"registering: \"<<new_name<<std::endl;\n //std::cout<<r<<\" \"<<g<<\" \"<<b<<\" \"<<alpha_blend<<\" \"<<double_sided<<std::endl;\n //for (unsigned long i=0 ; i<texs.size() ; i++) {\n // std::cout<<texs[i]<<std::endl;\n //}\n } else {\n //std::cout<<\"\\\"\"<<new_name<<\"\\\" is the same as \\\"\"\n // <<existing<<\"\\\"\"<<std::endl;\n }\n return existing;\n}}}\n\n// return the given txd and recursively all parents (if any)\nstatic std::vector<std::string> search_txds(bool is_car,\n const std::string &txd,\n const ide &ide)\n{\n std::vector<std::string> r;\n r.push_back(txd);\n for (size_t j=0 ; j<ide.txdps.size() ; ++j) {\n const TXDP &txdp = ide.txdps[j]; \n if (txdp.txd1 == txd) {\n std::vector<std::string> sub = search_txds(is_car, txdp.txd2, ide);\n r.insert(r.end(), sub.begin(), sub.end());\n }\n }\n return r;\n}\n\nstatic std::string to_string(const std::vector<std::string> &strs)\n{\n std::stringstream ss;\n ss << \"[\";\n for (size_t j=0 ; j<strs.size() ; ++j) {\n ss << (j>0?\", \":\"\") << strs[j];\n }\n ss << \"]\";\n return ss.str();\n}\n\nstatic const std::string &\nexport_or_provide_mat (const StringSet &texs,\n const ide &ide,\n const std::vector<std::string> &imgs,\n geometry &g,\n int mindex,\n const Obj &obj,\n const std::string &oname,\n MatDB &matdb,\n std::ostream &lua_file)\n{{{\n\n material &m = g.materials[mindex];\n\n bool has_alpha = false; // old method(stupid): obj.flags & OBJ_FLAG_ALPHA1;\n bool decal = (obj.flags & OBJ_FLAG_ALPHA1) && (obj.flags & OBJ_FLAG_NO_SHADOW);\n bool double_sided = 0 != (obj.flags & OBJ_FLAG_DRAW_BACKFACE);\n bool dynamic_lighting = g.normals.size()>0;\n\n float R = ((m.colour >> 0) & 0xFF) / 255.0f;\n float G = ((m.colour >> 8) & 0xFF) / 255.0f;\n float B = ((m.colour >> 16) & 0xFF) / 255.0f;\n float A = ((m.colour >> 24) & 0xFF) / 255.0f;\n\n Strings textures;\n\n APP_ASSERT(m.num_textures==1 || m.num_textures==0);\n for (unsigned int i=0 ; i<m.num_textures ; i++) {\n std::vector<std::string> txds = search_txds(obj.is_car, obj.txd, ide);\n bool found = false;\n std::string tex_name;\n for (size_t j=0 ; j<txds.size() ; ++j) {\n const std::string &txd = txds[j];\n for (size_t k=0 ; k<imgs.size() ; ++k) {\n const std::string &img = imgs[k];\n tex_name = get_tex_name(img, txd, m.textures[i].name);\n if (texs.empty() || texs.find(tex_name)!=texs.end()) {\n found = true;\n goto done;\n }\n }\n }\n if (obj.is_car) {\n tex_name = get_tex_name(\"\", \"../generic/vehicle\", m.textures[i].name);\n if (texs.empty() || texs.find(tex_name)!=texs.end()) {\n found = true;\n goto done;\n }\n }\n done:\n if (!found) {\n std::cerr<<\"For \"<<oname<<\" \"<<imgs[0]<<\"/\"<<obj.dff<<\".dff \"\n <<\"couldn't find tex: \\\"\"<<m.textures[i].name\n <<\"\\\" in \"<<to_string(txds)<<std::endl;\n tex_name = \"\";\n }\n textures.push_back(tex_name);\n if (m.textures[i].has_alpha) has_alpha = true;\n } \n\n if (textures.size()==0)\n textures.push_back(\"\");\n\n m.rewrittenTextures = textures;\n\n std::ostringstream mname;\n mname<<oname<<\":\"<<mindex;\n\n const std::string &mat = already_seen(matdb, R,G,B,A, textures, has_alpha,\n decal, double_sided,\n dynamic_lighting, mname.str());\n\n if (mat!=mname.str())\n return mat;\n\n \n lua_file << \"material `\" << mname.str() << \"` { \";\n if (g.vertex_cols.size() > 0) {\n lua_file << \"vertexDiffuse=true, \";\n lua_file << \"vertexAlpha=true, \";\n }\n if (has_alpha || decal) lua_file << \"alpha=true, \";\n if (has_alpha && !decal) lua_file << \"depthWrite=true, \";\n if (decal) {\n lua_file << \"castShadows=false, alphaReject=0, \";\n } else {\n lua_file << \"alphaReject=0.25, \";\n }\n if (double_sided || obj.is_car) lua_file << \"backfaces=true, \";\n if (!dynamic_lighting) lua_file << \"normals=false, \";\n\n if (m.colour!=0xFFFFFFFF) {\n if ((m.colour|0xff000000)==0xff00ff3c && obj.is_car) {\n // colour 1\n m.colour=0xFFFFFFFF;\n lua_file<<\"paintColour=1, \";\n } else if ((m.colour|0xff000000)==0xffaf00ff && obj.is_car) {\n // colour 2\n m.colour=0xFFFFFFFF;\n lua_file<<\"paintColour=2, \";\n } else if ((m.colour|0xff000000)==0xffffff00 && obj.is_car) {\n // colour 3\n m.colour=0xFFFFFFFF;\n lua_file<<\"paintColour=3, \";\n } else if ((m.colour|0xff000000)==0xffff00ff && obj.is_car) {\n // colour 4\n m.colour=0xFFFFFFFF;\n lua_file<<\"paintColour=4, \";\n } else if ((m.colour|0xff000000)==0xff00afff && obj.is_car) {\n // left headlight\n m.colour=0xFFFFFFFF;\n } else if ((m.colour|0xff000000)==0xffc8ff00 && obj.is_car) {\n // right headlight\n m.colour=0xFFFFFFFF;\n } else if ((m.colour|0xff000000)==0xff00ffb9 && obj.is_car) {\n // left rearlight\n m.colour=0xFFFFFFFF;\n } else if ((m.colour|0xff000000)==0xff003cff && obj.is_car) {\n // right rearlight\n m.colour=0xFFFFFFFF;\n } else {\n lua_file<<\"diffuseColour=0x\"<<std::hex<<m.colour<<std::dec<<\", \";\n }\n }\n if (textures[0]!=\"\") lua_file << \"diffuseMap=`\"<<textures[0]<<\"`, \";\n lua_file << \"}\\n\";\n\n return mat;\n}}}\n\nvect operator+= (vect &a, const vect &b)\n{ a.x += b.x; a.y += b.y; a.z += b.z; return a; }\n\nvect operator- (const vect &a, const vect &b)\n{ return vect(a.x-b.x, a.y-b.y, a.z-b.z); }\n\nvect operator/ (const vect &a, float b)\n{ return vect(a.x/b, a.y/b, a.z/b); }\n\nfloat len (const vect &a)\n{ return ::sqrt(a.x*a.x + a.y*a.y + a.z*a.z); }\n\nvect normalise (const vect &a)\n{ return a / len(a); }\n\nvect cross_prod (const vect &a, const vect &b)\n{ return vect(a.y*b.z-a.z*b.y, a.z*b.x-a.x*b.z, a.x*b.y-a.y*b.x); }\n\nvoid add_face_normal (vect &N, const vect &v1, const vect &v2, const vect &v3)\n{\n N += cross_prod (v2-v1, v3-v1);\n}\n\nvoid generate_normals (struct geometry &g)\n{\n const std::vector<vect> &positions = g.vertexes;\n std::vector<vect> &normals = g.normals;\n if (normals.size() > 0) {\n APP_ASSERT(positions.size() == normals.size());\n // already has normals\n return;\n }\n normals.resize(positions.size()); // initialises to zero\n for (MatSplits::iterator s=g.mat_spls.begin(),s_=g.mat_spls.end() ; s!=s_ ; ++s) {\n const std::vector<unsigned long> &mindexes = s->indexes2;\n APP_ASSERT(mindexes.size() % 3 == 0);\n for (size_t f=0 ; f<mindexes.size() ; f+=3) {\n unsigned long index1=mindexes[f+0], index2=mindexes[f+1], index3=mindexes[f+2];\n add_face_normal(normals[index1], positions[index1],positions[index2],positions[index3]);\n add_face_normal(normals[index2], positions[index1],positions[index2],positions[index3]);\n add_face_normal(normals[index3], positions[index1],positions[index2],positions[index3]);\n }\n }\n for (size_t i=0 ; i<normals.size() ; ++i) {\n normals[i] = normalise(normals[i]);\n }\n}\n\nvoid export_xml (const StringSet &texs,\n const ide &ide,\n const std::vector<std::string> &imgs,\n std::ostream &out,\n const std::string &fname,\n const Obj &obj,\n const std::string &oname,\n struct geometry &g,\n MatDB &matdb,\n std::ostream &lua_file)\n{{{\n out << \"xml filename: \" << fname << std::endl;\n\n std::ofstream f;\n f.open(fname.c_str(), std::ios::binary);\n APP_ASSERT_IO_SUCCESSFUL(f, \"opening \"+fname);\n\n\n ind(f,0);f<<\"<mesh>\\n\";\n ind(f,1);f<<\"<sharedgeometry vertexcount=\\\"\"<<g.num_vertexes<<\"\\\">\\n\";\n int positions = g.vertexes.size();\n int normals = g.normals.size();\n int colours_diffuse = g.vertex_cols.size();\n int texture_coords = g.tex_coords.size() ? 1 : 0;\n int texture_coords2 = g.tex_coords2.size() ? 1 : 0;\n APP_ASSERT(obj.id==14825 || obj.id==18009 || obj.id==18036 || !texture_coords || !texture_coords2);\n APP_ASSERT(!texture_coords2 || texture_coords);\n ind(f,2);f<<\"<vertexbuffer positions=\\\"\"\n <<(positions?\"true\":\"false\")<<\"\\\" \"\n <<\"normals=\\\"\"<<(normals?\"true\":\"false\")<<\"\\\" \"\n <<\"colours_diffuse=\\\"\"<<(colours_diffuse?\"true\":\"false\")<<\"\\\" \"\n <<\"texture_coords=\\\"\"<<(texture_coords+texture_coords2)<<\"\\\" \"\n <<\"texture_coords_dimensions_0=\\\"2\\\">\\n\";\n\n for (unsigned long i=0 ; i<g.num_vertexes ; i++) {\n ind(f,3);f<<\"<vertex> <!--\"<<i<<\"-->\\n\";\n if (positions) {\n struct vect *v = &g.vertexes[i];\n float x = v->x, y = v->y, z = v->z;\n ind(f,4);\n f<<\"<position x=\\\"\"<<x<<\"\\\" y=\\\"\"<<y<<\"\\\" z=\\\"\"<<z<<\"\\\"/>\\n\";\n }\n if (normals) {\n struct vect *v = &g.normals[i];\n float x = v->x, y = v->y, z = v->z;\n ind(f,4);f<<\"<normal x=\\\"\"<<x<<\"\\\" y=\\\"\"<<y<<\"\\\" z=\\\"\"<<z<<\"\\\"/>\\n\";\n }\n if (colours_diffuse) {\n float r = ((g.vertex_cols[i] >> 0) & 0xFF) / 255.0f;\n float gr =((g.vertex_cols[i] >> 8) & 0xFF) / 255.0f;\n float b = ((g.vertex_cols[i] >> 16) & 0xFF) / 255.0f;\n float a = ((g.vertex_cols[i] >> 24) & 0xFF) / 255.0f;\n ind(f,4);f<<\"<colour_diffuse value=\"\n \"\\\"\"<<r<<\" \"<<gr<<\" \"<<b<<\" \"<<a<<\"\\\"/>\\n\";\n }\n if (texture_coords) {\n struct texcoord *uv = &g.tex_coords[i];\n ind(f,4);f<<\"<texcoord u=\\\"\"<<uv->u<<\"\\\" v=\\\"\"<<uv->v<<\"\\\"/>\\n\";\n }\n if (texture_coords2) {\n struct texcoord *uv = &g.tex_coords2[i];\n ind(f,4);f<<\"<texcoord u=\\\"\"<<uv->u<<\"\\\" v=\\\"\"<<uv->v<<\"\\\"/>\\n\";\n }\n ind(f,3);f<<\"</vertex>\\n\";\n }\n ind(f,2);f<<\"</vertexbuffer>\\n\";\n ind(f,1);f<<\"</sharedgeometry>\\n\";\n\n ind(f,1);f<<\"<submeshes>\\n\";\n for (MatSplits::iterator s=g.mat_spls.begin(),s_=g.mat_spls.end() ;\n s!=s_ ; s++) {\n\n int tris = s->indexes2.size() / 3;\n\n if (tris==0) {\n //out<<\"Empty submesh: \\\"\"<<oname<<\"/\"<<s->material<<\"\\\"\\n\";\n continue;\n }\n\n std::string mname = export_or_provide_mat(texs,ide,imgs,g,s->material,\n obj,oname,matdb,lua_file);\n\n s->surrogate = mname;\n\n ind(f,2);f<<\"<submesh material=\\\"\"<<mname<<\"\\\" \"\n <<\"usesharedvertices=\\\"true\\\" \"\n <<\"operationtype=\\\"triangle_list\\\">\\n\";\n ind(f,3);f<<\"<faces count=\\\"\"<<tris<<\"\\\">\\n\";\n\n for (int tri=0 ; tri<tris ; ++tri) {\n unsigned long v1 = s->indexes2[3*tri + 0];\n unsigned long v2 = s->indexes2[3*tri + 1];\n unsigned long v3 = s->indexes2[3*tri + 2];\n APP_ASSERT(v1 < g.vertexes.size());\n APP_ASSERT(v2 < g.vertexes.size());\n APP_ASSERT(v3 < g.vertexes.size());\n f<<\"<face v1=\\\"\"<<v1<<\"\\\" \"\n \"v2=\\\"\"<<v2<<\"\\\" \"\n \"v3=\\\"\"<<v3<<\"\\\"/>\\n\";\n }\n ind(f,3);f<<\"</faces>\\n\";\n\n ind(f,2);f<<\"</submesh>\\n\";\n\n }\n ind(f,1);f<<\"</submeshes>\\n\";\n ind(f,0);f<<\"</mesh>\\n\";\n}}}\n\n\nOgre::LogManager *lmgr;\nOgre::ResourceGroupManager *rgmgr;\nOgre::MeshManager *mmgr;\nOgre::HardwareBufferManager *hwbmgr;\nOgre::LodStrategyManager *lodsm;\nOgre::MeshSerializer *serialiser;\n\nvoid init_ogre (void)\n{\n lmgr = new Ogre::LogManager();\n lmgr->createLog(\"Ogre.log\",true,false,false); // log is disabled for now\n lmgr->setLogDetail(Ogre::LL_LOW);\n\n rgmgr = new Ogre::ResourceGroupManager();\n mmgr = new Ogre::MeshManager();\n hwbmgr = new Ogre::DefaultHardwareBufferManager();\n\n lodsm = new Ogre::LodStrategyManager();\n\n serialiser = new Ogre::MeshSerializer();\n}\n\nvoid export_mesh (const StringSet &texs,\n const ide &ide,\n const std::vector<std::string> &imgs,\n std::ostream &out,\n const std::string &fname,\n const Obj &obj,\n const std::string &oname,\n struct geometry &g,\n MatDB &matdb,\n std::ostream &lua_file)\n{{{\n (void) out;\n //out << \"mesh filename: \" << fname << std::endl;\n\n Ogre::MeshPtr mesh = mmgr->createManual(fname, \"General\");\n\n // FIRST - SHARED GEOMETRY\n\n mesh->sharedVertexData = new Ogre::VertexData();\n Ogre::VertexDeclaration* decl = mesh->sharedVertexData->vertexDeclaration;\n\n int positions = g.vertexes.size();\n int normals = g.normals.size();\n int day_colours = g.vertex_cols.size();\n int night_colours = g.vertex_night_cols.size();\n int texture_coords = g.tex_coords.size();\n int texture_coords2 = g.tex_coords2.size();\n\n if (!day_colours) night_colours = 0;\n\n APP_ASSERT(positions>0);\n APP_ASSERT(!normals || normals==positions);\n APP_ASSERT(!day_colours || day_colours==positions);\n APP_ASSERT(!night_colours || night_colours==positions);\n APP_ASSERT(!texture_coords || texture_coords==positions);\n\n size_t offset = 0;\n if (positions) {\n decl->addElement(0,offset,Ogre::VET_FLOAT3,Ogre::VES_POSITION);\n offset += Ogre::VertexElement::getTypeSize(Ogre::VET_FLOAT3);\n }\n\n if (normals) {\n decl->addElement(0,offset,Ogre::VET_FLOAT3,Ogre::VES_NORMAL);\n offset += Ogre::VertexElement::getTypeSize(Ogre::VET_FLOAT3);\n }\n\n if (day_colours) {\n decl->addElement(0,offset,Ogre::VET_FLOAT4,Ogre::VES_DIFFUSE,0);\n offset += Ogre::VertexElement::getTypeSize(Ogre::VET_FLOAT4);\n }\n\n if (texture_coords) {\n decl->addElement(0,offset,Ogre::VET_FLOAT2,Ogre::VES_TEXTURE_COORDINATES,0);\n offset += Ogre::VertexElement::getTypeSize(Ogre::VET_FLOAT2);\n }\n\n if (texture_coords2) {\n decl->addElement(0,offset,Ogre::VET_FLOAT2,Ogre::VES_TEXTURE_COORDINATES,0);\n offset += Ogre::VertexElement::getTypeSize(Ogre::VET_FLOAT2);\n }\n\n if (night_colours) {\n decl->addElement(0,offset,Ogre::VET_FLOAT4,Ogre::VES_TEXTURE_COORDINATES,1);\n offset += Ogre::VertexElement::getTypeSize(Ogre::VET_FLOAT4);\n }\n\n\n float *vbuf = new float[g.num_vertexes*offset/sizeof(float)];\n float *vbuf_next = vbuf;\n\n Ogre::Real min_x=0, min_y=0, min_z=0, max_x=0, max_y=0, max_z=0;\n Ogre::Real rad2=0;\n\n for (unsigned long i=0 ; i<g.num_vertexes ; i++) {\n if (positions) {\n struct vect *v = &g.vertexes[i];\n float x = v->x, y = v->y, z = v->z;\n min_x = std::min(min_x,x);\n min_y = std::min(min_y,y);\n min_z = std::min(min_z,z);\n max_x = std::max(max_x,x);\n max_y = std::max(max_y,y);\n max_z = std::max(max_z,z);\n rad2 = std::max(rad2,x*x+y*y+z*z);\n (*vbuf_next++) = x;\n (*vbuf_next++) = y;\n (*vbuf_next++) = z;\n }\n if (normals) {\n struct vect *v = &g.normals[i];\n float x = v->x, y = v->y, z = v->z;\n (*vbuf_next++) = x;\n (*vbuf_next++) = y;\n (*vbuf_next++) = z;\n }\n if (day_colours) {\n float r = ((g.vertex_cols[i] >> 0) & 0xFF) / 255.0f;\n float gr =((g.vertex_cols[i] >> 8) & 0xFF) / 255.0f;\n float b = ((g.vertex_cols[i] >> 16) & 0xFF) / 255.0f;\n float a = ((g.vertex_cols[i] >> 24) & 0xFF) / 255.0f;\n (*vbuf_next++) = r;\n (*vbuf_next++) = gr;\n (*vbuf_next++) = b;\n (*vbuf_next++) = a;\n }\n if (texture_coords) {\n struct texcoord &uv = g.tex_coords[i];\n float u = uv.u, v = uv.v;\n (*vbuf_next++) = u;\n (*vbuf_next++) = v;\n }\n if (texture_coords2) {\n struct texcoord &uv = g.tex_coords2[i];\n float u = uv.u, v = uv.v;\n (*vbuf_next++) = u;\n (*vbuf_next++) = v;\n }\n if (night_colours) {\n float r = ((g.vertex_night_cols[i] >> 0) & 0xFF) / 255.0f;\n float gr =((g.vertex_night_cols[i] >> 8) & 0xFF) / 255.0f;\n float b = ((g.vertex_night_cols[i] >> 16) & 0xFF) / 255.0f;\n float a = ((g.vertex_night_cols[i] >> 24) & 0xFF) / 255.0f;\n (*vbuf_next++) = r;\n (*vbuf_next++) = gr;\n (*vbuf_next++) = b;\n (*vbuf_next++) = a;\n }\n }\n mesh->sharedVertexData->vertexCount = g.num_vertexes;\n\n Ogre::HardwareVertexBufferSharedPtr hwvbuf = hwbmgr\n ->createVertexBuffer(\n offset,\n mesh->sharedVertexData->vertexCount,\n Ogre::HardwareBuffer::HBU_STATIC_WRITE_ONLY);\n\n hwvbuf->writeData(0, hwvbuf->getSizeInBytes(), vbuf, true);\n\n mesh->sharedVertexData->vertexBufferBinding->setBinding(0, hwvbuf);\n\n\n MatSplits &ms = g.mat_spls;\n for (MatSplits::iterator s=ms.begin(),s_=ms.end() ; s!=s_ ; s++) {\n\n int tris = s->indexes2.size() / 3;\n\n if (tris==0) {\n //out<<\"Empty submesh: \\\"\"<<oname<<\"/\"<<s->material<<\"\\\"\\n\";\n continue;\n }\n\n unsigned short *ibuf = new unsigned short[tris*3];\n unsigned short *ibuf_next = ibuf;\n\n std::string mname = export_or_provide_mat(texs,ide,imgs,g,s->material,\n obj,oname,matdb,lua_file);\n\n s->surrogate = mname;\n\n for (int tri=0 ; tri<tris ; ++tri) {\n unsigned short v1 = (unsigned short) s->indexes2[3*tri + 0];\n unsigned short v2 = (unsigned short) s->indexes2[3*tri + 1];\n unsigned short v3 = (unsigned short) s->indexes2[3*tri + 2];\n APP_ASSERT(v1 < g.vertexes.size());\n APP_ASSERT(v2 < g.vertexes.size());\n APP_ASSERT(v3 < g.vertexes.size());\n *(ibuf_next++) = v1;\n *(ibuf_next++) = v2;\n *(ibuf_next++) = v3;\n }\n\n Ogre::HardwareIndexBufferSharedPtr hwibuf = hwbmgr\n ->createIndexBuffer(\n Ogre::HardwareIndexBuffer::IT_16BIT,\n tris*3,\n Ogre::HardwareBuffer::HBU_STATIC_WRITE_ONLY);\n\n hwibuf->writeData(0, hwibuf->getSizeInBytes(), ibuf, true);\n\n\n Ogre::SubMesh* submesh = mesh->createSubMesh();\n submesh->setMaterialName(mname);\n submesh->useSharedVertices = true;\n submesh->indexData->indexBuffer = hwibuf;\n submesh->indexData->indexCount = tris * 3;\n submesh->indexData->indexStart = 0;\n\n delete [] ibuf;\n }\n\n mesh->_setBounds(Ogre::AxisAlignedBox(min_x,min_y,min_z,max_x,max_y,max_z));\n mesh->_setBoundingSphereRadius(Ogre::Math::Sqrt(rad2));\n\n mesh->load();\n\n serialiser->exportMesh(&*mesh, fname);\n\n mmgr->remove(mesh);\n\n delete [] vbuf;\n\n}}}\n\n\n////////////////////////////////////////////////////////////////////////////////\n// DFFREAD CMDLINE TOOL STUFF //////////////////////////////////////////////////\n////////////////////////////////////////////////////////////////////////////////\n\n#ifdef _DFFREAD_EXEC\n\nvoid print_frame_tree (int d, struct dff *c, const std::string &p,\n int more, unsigned long node)\n{\n const char *thing = more ? \"├\" : \"└\";\n unsigned long num_children = c->frames[node].children.size();\n const char *thing2 = num_children > 0 ? \"┬\" : \"─\";\n std::stringstream output;\n output<<p<<thing<<\"─\"<<thing2<<\"─\\\"\"<<c->frames[node].name<<\"\\\" \";\n output<<\"(frame:\"<<node<<\") \";\n if (c->frames[node].geometry==-1) {\n output<<\"(\u001b[0;31mDUMMY!\u001b[0m) \";\n } else {\n output<<\"(\u001b[0;1;37mgeometry:\"<<c->frames[node].geometry<<\"\u001b[0m) \";\n }\n output<<\"(\"<<c->frames[node].x<<\",\"<<c->frames[node].y<<\",\"<<c->frames[node].z<<\")\";\n output<<\" [ \";\n for (int i=0 ; i<9 ; ++i) {\n if (i%3==0 && i!=0) output << \", \";\n else if (i!=0) output << \",\";\n output<<c->frames[node].rot[i];\n }\n output<<\" ]\";\n VBOS(3,output.str());\n\n for (unsigned long i=0 ; i<num_children ; i++) {\n unsigned long child = c->frames[node].children[i];\n std::string pref = p+(more?\"│\":\" \");\n pref += \" \";\n print_frame_tree(d,c,pref,i<num_children-1,child);\n }\n}\n\nvoid list_orphans(int d,struct dff *c, const std::string &p)\n{\n print_frame_tree(d,c,p,0,c->root_frame);\n for (unsigned long i=0 ; i<c->geometries.size() ; i++) {\n if (c->geometries[i].frame==-1) {\n VBOS(-1000,p<<\"orphaned_geometry: \"<<i<<\"\\n\");\n }\n }\n}\n\nvoid app_verbose(char const* file, int line, const std::string& msg)\n{\n std::cout<<BOLD<<GREEN<<\"VERBOSE \"<<RESET\n <<BOLD<<file<<NOBOLD<<\":\"<<BOLD<<line<<NOBOLD\n << \": \\\"\"<<BOLD<<BLUE<<msg<<RESET\"\\\"\";\n std::cout<<std::endl;\n}\n\nvoid app_error(char const* file, int line,\n const std::string& i_was, const std::string& msg)\n{\n std::cout<<BOLD RED\"ERROR \"<<RESET\n <<BOLD<<file<<NOBOLD<<\":\"<<BOLD<<line<<NOBOLD\n <<\": \\\"\"<<BOLD<<YELLOW<<msg<<RESET<<\"\\\"\";\n if (i_was!=\"\")\n std::cout<<\" (\"<<BOLD<<YELLOW<<i_was<<RESET<<\")\";\n std::cout<<std::endl;\n}\n\nvoid app_line(const std::string &msg)\n{\n std::cout<<BOLD<<msg<<NOBOLD<<std::endl;\n}\n\nvoid app_fatal()\n{\n abort();\n}\n\nvoid assert_triggered (void) { } \n\n#define VERSION \"1.1\"\n\nconst char *info =\n\"dffread (c) Dave Cunningham 2007 (version: \" VERSION \")\\n\"\n\"I print information about dff files.\\n\";\n\nconst char *usage =\n\"Usage: dffread { <opt> } filename.dff\\n\\n\"\n\"where <opt> ::= \\\"-v\\\" | \\\"--verbose\\\" increase debug level\\n\"\n\" | \\\"-q\\\" | \\\"--quiet\\\" decrease debug level\\n\"\n\" | \\\"-e\\\" <name> | \\\"--export\\\" <name> export to .mesh\\n\"\n\" | \\\"-t\\\" <name> | \\\"--txd\\\" <name> for export\\n\\n\"\n\" | \\\"-o\\\" | \\\"--orphans\\\" list orphaned frames\\n\"\n\" | \\\"-O\\\" | \\\"--no-orphans\\\" complement of above\\n\\n\"\n\" | \\\"-h\\\" | \\\"--help\\\" this message\\n\";\n\nstd::string next_arg(int& so_far, int argc, char **argv)\n{\n if (so_far==argc) {\n std::cerr<<\"Ran out of arguments.\"<<std::endl;\n std::cerr<<usage<<std::endl;\n exit(EXIT_FAILURE);\n }\n return argv[so_far++];\n}\n\n\nstd::string get_ext(const std::string& name, std::string *base_name)\n{\n std::string r;\n std::string::size_type dot = name.find_last_of('.');\n if (dot!=std::string::npos) {\n r = name.substr(dot);\n if (base_name) *base_name = name.substr(0,dot);\n }\n return r;\n}\n\n// I think we never actually call this as we never read a tcol\nstd::string pwd_full (const std::string &, const std::string &)\n{ abort(); return std::string(); } \n \nint main(int argc, char **argv)\n{\n if (argc==1) {\n std::cout<<info<<std::endl;\n std::cout<<usage<<std::endl;\n }\n\n // default parameters\n int d= 0;\n bool orphans = false;\n bool do_export_mesh = false;\n bool car = false;\n std::string oname;\n std::string txdname;\n\n int so_far = 1;\n int extras = 0; // number of args that weren't options\n std::string file_name;\n bool filename_given = false;\n std::string phys_mat_pref;\n\n //init_col_db_same(\"/common/Metal\");\n init_global_db();\n\n while (so_far<argc) {\n std::string arg = next_arg(so_far,argc,argv);\n if (arg==\"-v\" || arg==\"--verbose\") {\n d++;\n } else if (arg==\"-q\" || arg==\"--quiet\") {\n d--;\n } else if (arg==\"-o\" || arg==\"--orphans\") {\n orphans = true;\n } else if (arg==\"-O\" || arg==\"--no-orphans\") {\n orphans = false;\n } else if (arg==\"-t\" || arg==\"--txd\") {\n txdname = next_arg(so_far,argc,argv);\n } else if (arg==\"-p\" || arg==\"--phys-mat-prefix\") {\n phys_mat_pref = next_arg(so_far,argc,argv);\n } else if (arg==\"-e\" || arg==\"--export\") {\n oname = next_arg(so_far,argc,argv);\n do_export_mesh = true;\n } else if (arg==\"-c\" || arg==\"--car\") {\n car = true;\n } else if (arg==\"-C\" || arg==\"--nocar\") {\n car = false;\n } else if (arg==\"-h\" || arg==\"--help\") {\n std::cout<<info<<std::endl;\n std::cout<<usage<<std::endl;\n } else if (extras==0) {\n extras++;\n filename_given = true;\n file_name = arg;\n if (get_ext(file_name,NULL)!=\".dff\") {\n std::cerr << file_name<<\": does not end in .dff\"\n << std::endl;\n exit(EXIT_FAILURE);\n }\n } else {\n std::cerr<<\"Unrecognised argument: \"<<arg<<std::endl;\n std::cerr<<usage<<std::endl;\n exit(EXIT_FAILURE);\n }\n }\n\n if (!filename_given) {\n std::cerr<<\"No filename given.\"<<std::endl;\n std::cerr<<usage<<std::endl;\n exit(EXIT_FAILURE);\n }\n\n try {\n\n std::ofstream lua_file;\n if (do_export_mesh) {\n init_ogre();\n std::string s = oname+\".lua\";\n lua_file.open(s.c_str(), std::ios::binary);\n APP_ASSERT_IO_SUCCESSFUL(lua_file, \"opening \"+s);\n }\n\n std::ifstream f;\n f.open(file_name.c_str(), std::ios::binary);\n APP_ASSERT_IO_SUCCESSFUL(f,\"opening \"+file_name);\n VBOS(0,\"reading dff: \"<<file_name<<\"\\n\");\n\n struct dff dff;\n ios_read_dff(d,f,&dff,file_name+\"/\", phys_mat_pref,global_db);\n\n if (orphans)\n list_orphans(d,&dff,file_name+\"/\");\n\n if (do_export_mesh) {\n if (car) {\n StringSet texs;\n ide ide;\n Strings imgs;\n imgs.push_back(\"\");\n Obj obj; // currently obj only needs a few things set\n obj.dff = file_name;\n obj.txd = txdname;\n obj.flags = 0;\n obj.is_car = true;\n MatDB matdb;\n for (unsigned long j=0 ; j<dff.frames.size() ; ++j) {\n frame &fr = dff.frames[j];\n\n // ignore dummies for now\n if (fr.geometry == -1) continue;\n\n geometry &g = dff.geometries[fr.geometry];\n\n generate_normals(g);\n\n export_mesh(texs,ide,imgs,\n std::cout, oname+\".\"+fr.name+\".mesh\",\n obj,oname+\".\"+fr.name,g,matdb,lua_file);\n }\n\n lua_file << std::endl;\n\n for (unsigned long j=0 ; j<dff.frames.size() ; ++j) {\n frame &fr = dff.frames[j];\n\n if (fr.name.substr(fr.name.size()-4,4)==\"_dam\") continue;\n if (fr.name.substr(fr.name.size()-4,4)==\"_vlo\") continue;\n\n std::string parent = \"sm.root\";\n if (fr.parent_frame >= 0) {\n frame &parent_frame = dff.frames[fr.parent_frame];\n parent = oname + \"_\" + parent_frame.name;\n }\n lua_file<<oname<<\"_\"<<fr.name<<\" = \"<<parent<<\":createChild()\"<<std::endl;\n lua_file<<oname<<\"_\"<<fr.name<<\".position = \"\n <<\"vector3(\"<<fr.x<<\",\"<<fr.y<<\",\"<<fr.z<<\")\"<<std::endl;\n\n // ignore dummies for now\n if (fr.geometry == -1) continue;\n\n std::string name = oname+\".\"+fr.name;\n std::string mesh = name+\".mesh\";\n lua_file<<\"safe_destroy(sm:getEntity(\\\"\"<<name<<\"\\\"))\"<<std::endl;\n lua_file<<oname<<\"_\"<<fr.name<<\":attachObject(\"\n <<\"sm:createEntity(\\\"\"<<name<<\"\\\",\\\"cheetah/\"<<mesh<<\"\\\"))\"<<std::endl;\n lua_file<<\"sm:getEntity(\\\"\"<<name<<\"\\\"):setCustomParameterAll(0,1,1,1,1)\"\n <<std::endl;\n }\n\n if (dff.has_tcol) {\n std::string col_name = oname;\n static const char *phys_mat = \"/common/Metal\";\n\n for (unsigned i=0 ; i<dff.tcol.compound.hulls.size() ; ++i)\n dff.tcol.compound.hulls[i].material = phys_mat;\n for (unsigned i=0 ; i<dff.tcol.compound.boxes.size() ; ++i)\n dff.tcol.compound.boxes[i].material = phys_mat;\n for (unsigned i=0 ; i<dff.tcol.compound.cylinders.size() ; ++i)\n dff.tcol.compound.cylinders[i].material = phys_mat;\n for (unsigned i=0 ; i<dff.tcol.compound.cones.size() ; ++i)\n dff.tcol.compound.cones[i].material = phys_mat;\n for (unsigned i=0 ; i<dff.tcol.compound.planes.size() ; ++i)\n dff.tcol.compound.planes[i].material = phys_mat;\n for (unsigned i=0 ; i<dff.tcol.compound.spheres.size() ; ++i)\n dff.tcol.compound.spheres[i].material = phys_mat;\n for (unsigned i=0 ; i<dff.tcol.triMesh.faces.size() ; ++i)\n dff.tcol.triMesh.faces[i].material = phys_mat;\n\n dff.tcol.mass = 1000;\n\n if (!dff.tcol.usingCompound && !dff.tcol.usingTriMesh) {\n GRIT_EXCEPT(\"Collision data had no compound or trimesh\");\n /*\n } else if (binary) {\n col_name += \".bcol\";\n GRIT_EXCEPT(\"Writing bcol not implemented.\");\n */\n } else {\n col_name += \".tcol\";\n\n std::ofstream out;\n out.open(col_name.c_str(), std::ios::binary);\n APP_ASSERT_IO_SUCCESSFUL(out,\"opening tcol for writing\");\n\n pretty_print_tcol(out,dff.tcol);\n }\n\n lua_file << std::endl;\n lua_file << \"class `\"<<oname<<\"` (ColClass) {\" << std::endl;\n lua_file << \" gfxMesh=`\"<<oname<<\".chassis.mesh`;\" << std::endl;\n lua_file << \" colMesh=`\"<<col_name<<\"`;\" << std::endl;\n lua_file << \"}\" << std::endl;\n }\n\n } else {\n StringSet texs;\n ide ide;\n Strings imgs;\n imgs.push_back(\"\");\n Obj obj; // currently obj only needs a few things set\n obj.dff = file_name;\n obj.txd = txdname;\n obj.flags = 0;\n obj.is_car = false;\n MatDB matdb;\n export_mesh(texs, ide, imgs, std::cout, oname+\".mesh\", obj,\n oname, dff.geometries[0], matdb, lua_file);\n }\n }\n\n } catch (const Exception &e) {\n std::cerr << e << std::endl;\n\n return EXIT_FAILURE;\n }\n\n return EXIT_SUCCESS;\n}\n\n#endif\n\n// vim: shiftwidth=4:tabstop=4:expandtab\n" }, { "alpha_fraction": 0.655316948890686, "alphanum_fraction": 0.6573160290718079, "avg_line_length": 37.100738525390625, "blob_id": "e7fd9a3a7a50f460193f16b52306ae16e9f1275b", "content_id": "0a3c86e8af27eb7f38b2f34ff5354a800ed4f9a3", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 15507, "license_type": "permissive", "max_line_length": 95, "num_lines": 407, "path": "/engine/grit_object.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <map>\n#include <vector>\n#include <set>\n#include <string>\n\n#include \"shared_ptr.h\"\n\nclass GritObject;\ntypedef SharedPtr<GritObject> GritObjectPtr;\ntypedef std::map<std::string, GritObjectPtr> GObjMap;\ntypedef std::vector<GritObjectPtr> GObjPtrs;\ntypedef std::set<GritObjectPtr> GObjSet;\n\n\n#ifndef GritObject_h\n#define GritObject_h\n\n#include \"background_loader.h\"\n#include \"external_table.h\"\n#include \"streamer.h\"\n\n/** A streamed game object, occupying a place in the map.\n *\n * Grit bjects are instances of Grit Classes (\\see GritClass). The class is a\n * blueprint of the object, and is intended define the majority of the object's\n * qualities and behaviour. Once created, they are either in a 'deactivated'\n * state, meaning the player is outside the object's rendering distance, or\n * 'activated' otherwise. The intent is that when deactivated, the object is\n * in a low-resource state where very little memory and no CPU resources are\n * required. In particular, no Lua heap resources are used when the object is\n * deactivated, as all its state is stored in an ExternalTable. This means\n * garbage collection remains fast as the map scales up. There are a number of\n * Lua callbacks that are issued by the object when its state changes or when\n * other interesting events occur. These callbacks are the basis of user\n * scripts to create active objects, i.e. objects that appear alive or react to\n * stimuli.\n *\n * When the object is activated, it has a Lua table which holds its state and\n * is maintained by the Lua scripts that define its behaviour. When it is\n * deactivated, this table is destroyed and the only persistent state is held\n * in the External table in the object itself.\n *\n * The object is typically referred to via a reference counting smart pointer,\n * and many of the member functions in this class require that smart pointer to\n * be passed in, becuase they need to pass it on to Lua or whatever. In such\n * cases the parameter is called 'self' and it is essentially the same as\n * 'this', except for having the refernece counter information attached.\n *\n * TODO: talk about lods\n */ \nclass GritObject {\n\n public:\n\n /** Don't use this, create an object with object_add. */\n GritObject (const std::string &name_, GritClass *gritClass_);\n\n /** Destructor. */\n ~GritObject (void) { }\n\n /** Explicit destroy call, invokes Lua callbacks via Lua state. Once\n * destroyed, the object no-longer plays a role in the game, although it still\n * exists in memory. Its state is marked as being destroyed by setting the\n * class to NULL. Attempts to use a destroyed class result in exceptions. */\n void destroy (lua_State *L, const GritObjectPtr &self);\n\n /** Calls Lua deactivate callbacks. */\n bool deactivate (lua_State *L, const GritObjectPtr &self);\n\n /** Calls Lua init callbacks. */\n void init (lua_State *L, const GritObjectPtr &self);\n\n /** Calls Lua activate callbacks. */\n void activate (lua_State *L, const GritObjectPtr &self);\n\n /** Calculates the extent (0.0f to 1.0f) that this object is visible,\n * based on the range, its rendering distance, and its lod associations. Also\n * returns whether or not the object is 'overlapping' i.e. making the\n * transition with another lod. */\n float calcFade (const float range2, bool &overlap);\n\n /** Called to tell the object that its distance to the player has changed. */\n void notifyRange2 (lua_State *L, const GritObjectPtr &self, const float range2)\n {\n if (gritClass == NULL) GRIT_EXCEPT(\"Object destroyed\");\n bool overlap = false;\n float fade = calcFade(range2, overlap);\n // if fade is sufficiently different\n if (fade != lastFade) {\n notifyFade(L, self, fade);\n lastFade = fade;\n }\n }\n\n /** Call the Lua per-frame callback, with the given elapsed time\n * quantity. A frame is a discrete unit of graphical display. */\n bool frameCallback (lua_State *L,\n const GritObjectPtr &self,\n const float time);\n\n /** Call the Lua per-game-tick callback, with the given elapsed time\n * quantity. A step is a unit of game logic, including rigid body motion\n * calculations.*/\n bool stepCallback (lua_State *L,\n const GritObjectPtr &self,\n const float time);\n\n /** Call the Lua fade callback. \n *\n * This is called whenever the object changes its fade state (0.0f to 1.0f).\n */\n void notifyFade (lua_State *L,\n const GritObjectPtr &self,\n const float fade);\n\n /** Is the object activated (close enough to the player)? */\n bool isActivated (void) const { return lua != LUA_NOREF; }\n\n /** Push the object's Lua table state, which only exists when it is activated. */\n void pushLuaTable (lua_State *L)\n {\n lua_rawgeti(L, LUA_REGISTRYINDEX, lua);\n }\n\n\n /** Add a resource that must be loaded before this object is activated. */\n void addDiskResource (const std::string &name)\n { demand.addDiskResource(name); }\n\n /** Clear this list of dependent disk resources that must be loaded\n * before this object is activated. */\n void clearDiskResources (void)\n { demand.clearDiskResources(); }\n\n /** Request that the resource's disk resources be loaded. The cam_pos\n * is required in order to prioritise the loading when many requests are made\n * concurrently. */\n bool requestLoad (const Vector3 &cam_pos)\n {\n return demand.requestLoad((cam_pos - pos).length2());\n }\n\n /** Indicate that a previous request to load should now be cancelled,\n * and that the resources are no-longer needed. They may be unloaded if system\n * resource pressure requires it.\n */\n void tryUnloadResources(void)\n {\n demand.finishedWith();\n }\n\n /** Are the resources associated with this object queued to be loaded.\n * The loading happens in a background thread which is held up by disk I/O and\n * a queue of resources that need loading.\n */\n bool isInBackgroundQueue (void)\n {\n return demand.isInBackgroundQueue();\n }\n\n /** Return whether or not there was a problem loading dependent resources. */\n bool backgroundLoadingCausedError (void)\n {\n return demand.errorOnLoad();\n }\n\n /** Reload all the disk resources that this object depends on. This is\n * a convenience function for development, when reloading e.g. the textures can\n * be useful for an instant preview. */\n void reloadDiskResources(void)\n {\n demand.immediateReload();\n }\n\n\n /** The class that this object is an instance of. */\n GritClass *getClass (void) { return gritClass; }\n\n /** How faded out the object is (0.0f meaning fully faded out, 1.0f\n * fully faded in. Fading is for rendering distance and lod transitions. */\n float getFade (void) const { return lastFade; }\n\n /** Whether or not this object should have its frame callback invoked every frame. */\n bool getNeedsFrameCallbacks (void) const { return needsFrameCallbacks; }\n /** Whether or not this object should have its frame callback invoked every frame. */\n void setNeedsFrameCallbacks (const GritObjectPtr &self, bool v);\n\n /** Whether or not this object should have its step callback invoked every frame. */\n bool getNeedsStepCallbacks (void) const { return needsStepCallbacks; }\n /** Whether or not this object should have its step callback invoked every frame. */\n void setNeedsStepCallbacks (const GritObjectPtr &self, bool v);\n\n /** The object's name. */\n const std::string name;\n\n /** The RangeSpace datastructure requires that object remember its\n * index within that structure. Presence of this function is required of any\n * c++ class that is to be used in a RangeSpace. */\n inline void updateIndex (int index_)\n {\n index = index_;\n }\n\n /** Update the position and rendering distance of this object. */\n void updateSphere (const Vector3 &pos, float r_);\n /** Update just the position of this object. */\n void updateSphere (const Vector3 &pos);\n /** Update just the rendering distance of this object. */\n void updateSphere (float r_);\n\n /** Return the current position of this object in the game map. If\n * deactivated, this is the spawn location of the object. If activated, it is\n * wherever it has moved to since being activated. */\n Vector3 getPos() const { return pos; }\n\n /** Return the rendering distance of this object. */\n float getR() const { return r; }\n\n \n /** Get the 'near' version of this object, for lod transitions. */\n const GritObjectPtr &getNearObj (void) const { return nearObj; }\n\n /** Set the 'near' version of this object, for lod transitions. */\n void setNearObj (const GritObjectPtr &self, const GritObjectPtr &v)\n {\n // this function is recursive and mutually recursive\n // but always terminates due to the early return below\n if (nearObj == v) return;\n if (nearObj.isNull()) {\n // note that v cannot be null since near != v\n // adding a near\n nearObj = v;\n nearObj->setFarObj(nearObj, self);\n } else {\n if (v.isNull()) {\n // removing near\n GritObjectPtr tmp = nearObj;\n nearObj.setNull();\n tmp->setFarObj(tmp, nearObj);\n } else {\n // changing nearObj\n // first set to null\n GritObjectPtr tmp = nearObj;\n nearObj.setNull();\n tmp->setFarObj(tmp, nearObj);\n // then set to new value\n setNearObj(self, v);\n }\n }\n }\n\n\n /** Get the 'far' version of this object, used for lod transitions. */\n const GritObjectPtr &getFarObj (void) const { return farObj; }\n\n /** Set the 'far' version of this object, used for lod transitions. */\n void setFarObj (const GritObjectPtr &self, const GritObjectPtr &v)\n {\n // this function is recursive and mutually recursive\n // but always terminates due to the early return below\n if (farObj == v) return;\n if (farObj.isNull()) {\n // adding a far\n farObj = v;\n farObj->setNearObj(farObj, self);\n } else {\n if (v.isNull()) {\n // removing far\n GritObjectPtr tmp = farObj;\n farObj.setNull();\n tmp->setNearObj(tmp, farObj);\n } else {\n // changing far\n // first set to null\n GritObjectPtr tmp = farObj;\n farObj.setNull();\n tmp->setNearObj(tmp, farObj);\n // then set to new value\n setFarObj(self, v);\n }\n }\n }\n\n /** Return the squared distance to the given point. */\n float range2 (const Vector3 &cam_pos) const\n {\n return (cam_pos - pos).length2() / (r*r);\n }\n\n /** Is the obejct within range of the given point, using the given\n * global scaling factor on rendering distances. */\n bool withinRange (const Vector3 &cam_pos, float factor) const\n {\n const float rad = r*factor;\n return (cam_pos - pos).length2() < rad*rad;\n }\n\n /** If you are the 'far' lod for this object, you must fade out by this\n * amount because you are transitioning with the 'near' lod. */\n float getImposedFarFade (void) const { return imposedFarFade; }\n\n /** The state of the object that persists even after it deactivates. */\n ExternalTable userValues;\n\n /** Whether or not this object had a generated name. */\n bool anonymous;\n\n void getField (lua_State *L, const std::string &f) const;\n\n protected:\n\n /** Current position of the object. */\n Vector3 pos;\n\n /** Current rendering distance. */\n float r;\n \n /** The object's class. */\n GritClass *gritClass;\n\n /** A pointer to the object's state in Lua (when activated). This\n * could be replaced with a LuaPtr, it currently directly uses the Lua\n * registry. */\n int lua;\n\n /** The index of the object within the range space. */\n int index;\n\n /** Whether or not the callbacks should be called. */\n bool needsFrameCallbacks;\n\n /** Whether or not the callbacks should be called. */\n bool needsStepCallbacks;\n\n /** The lod companion that should be activated when the player is closer to the object. */\n GritObjectPtr nearObj;\n\n /** The lod companion that should be activated when the player is outside of this object's\n * rendering distance.\n */\n GritObjectPtr farObj;\n \n /** Appears to be unused? */\n bool demandRegistered;\n Demand demand;\n\n /** The fade imposed upon a far lod companion because we are the near lod and we are taking\n * over.\n */\n float imposedFarFade;\n\n /** Used to tell if the fade has changed when recalculating it. The\n * callback is only invoked if the fade has changed, for performance reasons.\n */\n float lastFade;\n};\n\n/** Instantiate the given class to create a new object with the given name.\n * The lua state is used for callbacks and errors, if any. */\nGritObjectPtr object_add (lua_State *L, std::string name, GritClass *grit_class);\n\n/** Destroy the object, which removes it from the game. */\nvoid object_del (lua_State *L, const GritObjectPtr &o);\n\n/** Get a non-destroyed object by name. */\nconst GritObjectPtr &object_get (const std::string &name);\n\n/** Does an object exist with this name? */\nbool object_has (const std::string &name);\n \n/** Return all objects, via the two iterator 'byref' params. */\nvoid object_all (GObjMap::iterator &begin, GObjMap::iterator &end);\n\n/** Clear all objects from the game map. */\nvoid object_all_del (lua_State *L);\n\n/** Return the number of objects that currently exist. */\nint object_count (void);\n\n/** Call the frame callbacks for all objects, providing the given elapsed time quantity. */\nvoid object_do_frame_callbacks (lua_State *L, float elapsed);\n\n/** Call the step callbacks for all objects, providing the given elapsed time quantity. */\nvoid object_do_step_callbacks (lua_State *L, float elapsed);\n\n#endif\n" }, { "alpha_fraction": 0.5246878266334534, "alphanum_fraction": 0.5582828521728516, "avg_line_length": 31.60610008239746, "blob_id": "8b96ad2d5ab9e4feb41e56c25013526daa998805", "content_id": "9698514aad1494b8a864f9dc2dd02e4059dd5cd7", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 49174, "license_type": "permissive", "max_line_length": 122, "num_lines": 1508, "path": "/dependencies/quex-0.34.1/demo/001/new-tiny_lexer-core-engine.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": " /* Information about what pattern 'comes' from what mode in the inheritance tree.\n * \n * [1] pattern, [2] dominating mode, [3] dominating inheritance level, [4] pattern index\n * \n * (STRING_READER)\n * {P_BACKSLASHED_STRING_DELIMITER} STRING_READER 0 00052\n * {P_BACKSLASHED_BACKSLASH} STRING_READER 0 00054\n * {P_STRING_DELIMITER} STRING_READER 0 00056\n * \n * \n * (PROGRAM)\n * \\\"{\\\" PROGRAM 0 00022\n * \\\"}\\\" PROGRAM 0 00025\n * \\\"=\\\" PROGRAM 0 00028\n * \\\"struct\\\" PROGRAM 0 00031\n * if PROGRAM 0 00034\n * \\\";\\\" PROGRAM 0 00037\n * [a-z]+ PROGRAM 0 00044\n * {P_NUMBER} PROGRAM 0 00045\n * [ \\t\\n] PROGRAM 0 00048\n * {P_STRING_DELIMITER} PROGRAM 0 00050\n * \n * \n * \n */\n#include \"tiny_lexer\"\n#if ! defined(__QUEX_SETTING_PLAIN_C)\nnamespace quex {\n#endif\n#define QUEX_LEXER_CLASS tiny_lexer\n\n#include <quex/code_base/template/Analyser>\n#include <quex/code_base/buffer/Buffer>\n\n#ifdef CONTINUE\n# undef CONTINUE\n#endif\n#define CONTINUE goto __REENTRY_PREPARATION;\n#include <quex/code_base/temporary_macros_on>\n\n__QUEX_SETTING_ANALYSER_FUNCTION_RETURN_TYPE \ntiny_lexer_STRING_READER_analyser_function(QuexAnalyser* me) \n{\n /* NOTE: Different modes correspond to different analyser functions. The analyser*/\n /* functions are all located inside the main class as static functions. That*/\n /* means, they are something like 'globals'. They receive a pointer to the */\n /* lexical analyser, since static member do not have access to the 'this' pointer.*/\n# if defined (__QUEX_SETTING_PLAIN_C)\n# define self (*me)\n# else\n using namespace quex;\n QUEX_LEXER_CLASS& self = *((QUEX_LEXER_CLASS*)me);\n# endif\n /* me = pointer to state of the lexical analyser */\n quex::QuexMode& STRING_READER = QUEX_LEXER_CLASS::STRING_READER;\n quex::QuexMode& PROGRAM = QUEX_LEXER_CLASS::PROGRAM;\n QUEX_GOTO_LABEL_TYPE last_acceptance = QUEX_GOTO_TERMINAL_LABEL_INIT_VALUE;\n QUEX_CHARACTER_POSITION_TYPE last_acceptance_input_position = (QUEX_CHARACTER_TYPE*)(0x00);\n QUEX_CHARACTER_POSITION_TYPE* post_context_start_position = 0x0;\n const size_t PostContextStartPositionN = (size_t)0;\n QUEX_CHARACTER_TYPE input = (QUEX_CHARACTER_TYPE)(0x00);\n\n /* Post context positions do not have to be reset or initialized. If a state\n * is reached which is associated with 'end of post context' it is clear what\n * post context is meant. This results from the ways the state machine is \n * constructed. A post context positions live time looks like the following:\n *\n * (1) unitialized (don't care)\n * (1.b) on buffer reload it may, or may not be adapted (don't care)\n * (2) when a post context begin state is passed, the it is **SET** (now: take care)\n * (2.b) on buffer reload it **is adapted**.\n * (3) when a terminal state of the post context is reached (which can only be reached\n * for that particular post context, then the post context position is used\n * to reset the input position. */\n#if defined(QUEX_OPTION_AUTOMATIC_ANALYSIS_CONTINUATION_ON_MODE_CHANGE) \\\n || defined(QUEX_OPTION_ASSERTS)\n me->DEBUG_analyser_function_at_entry = me->current_analyser_function;\n#endif\n__REENTRY:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: __REENTRY\");\n QuexBuffer_mark_lexeme_start(&me->buffer);\n QuexBuffer_undo_terminating_zero_for_lexeme(&me->buffer);\n /* state machine */\n /* init-state = 176L\n * 00176() <~ (52, 147), (54, 153), (56, 157)\n * == '\"' ==> 00178\n * == '\\' ==> 00177\n * <no epsilon>\n * 00177() <~ (52, 148), (54, 154)\n * == '\"' ==> 00180\n * == '\\' ==> 00179\n * <no epsilon>\n * 00179(A, S) <~ (54, 155, A, S)\n * <no epsilon>\n * 00180(A, S) <~ (52, 149, A, S)\n * <no epsilon>\n * 00178(A, S) <~ (56, 158, A, S)\n * <no epsilon>\n * \n */\nSTATE_176:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_176\");\n\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 35) {\n if( input != 34) {\n goto STATE_176_DROP_OUT; /* [-oo, '!'] */\n } else {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_56_DIRECT; /* '\"' */\n }\n } else {\n if( input == 92) {\n goto STATE_177; /* '\\' */\n } else {\n goto STATE_176_DROP_OUT_DIRECT; /* ['#', '['] */\n }\n }\n\nSTATE_176_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_176_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_176_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_176_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n if( QuexBuffer_is_end_of_file(&me->buffer) ) {\n /* NO CHECK 'last_acceptance != -1' --- first state can **never** be an acceptance state */\n goto TERMINAL_END_OF_STREAM;\n }\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_176_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\nSTATE_176_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_176_INPUT\");\n QuexBuffer_input_p_increment(&me->buffer);\n goto STATE_176;\nSTATE_177:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_177\");\n\nSTATE_177_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_177_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 35) {\n if( input != 34) {\n goto STATE_177_DROP_OUT; /* [-oo, '!'] */\n } else {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_52_DIRECT; /* '\"' */\n }\n } else {\n if( input == 92) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_54_DIRECT; /* '\\' */\n } else {\n goto STATE_177_DROP_OUT_DIRECT; /* ['#', '['] */\n }\n }\n\nSTATE_177_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_177_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_177_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_177_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_177_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\n\n /* (*) Terminal states _______________________________________________________*/\n /**/\n /* Acceptance terminal states, i.e. the 'winner patterns'. This means*/\n /* that the last input dropped out of a state where the longest matching*/\n /* pattern was according to the terminal state. The terminal states are */\n /* numbered after the pattern id.*/\n /**/\n#define Lexeme (me->buffer._lexeme_start_p)\n#define LexemeBegin (me->buffer._lexeme_start_p)\n#define LexemeEnd (me->buffer._input_p)\n#define LexemeL (size_t)(me->buffer._input_p - me->buffer._lexeme_start_p)\nTERMINAL_56:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_56\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_56_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_56_DIRECT\");\n\n {\n \n #line 1 \"\"\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(1);\n \n #line 83 \"simple.qx\"\n self << PROGRAM; RETURN; \n#line 220 \"tiny_lexer-core-engine.cpp\"\n \n }\n#line 223 \"tiny_lexer-core-engine.cpp\"\n \n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_52:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_52\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_52_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_52_DIRECT\");\n\n QuexBuffer_set_terminating_zero_for_lexeme(&me->buffer);\n {\n \n #line 1 \"\"\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(2);\n \n #line 80 \"simple.qx\"\n self.accumulator.add(Lexeme); \n#line 247 \"tiny_lexer-core-engine.cpp\"\n \n }\n#line 250 \"tiny_lexer-core-engine.cpp\"\n \n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_54:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_54\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_54_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_54_DIRECT\");\n\n QuexBuffer_set_terminating_zero_for_lexeme(&me->buffer);\n {\n \n #line 1 \"\"\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(2);\n \n #line 81 \"simple.qx\"\n self.accumulator.add(Lexeme); \n#line 274 \"tiny_lexer-core-engine.cpp\"\n \n }\n#line 277 \"tiny_lexer-core-engine.cpp\"\n \n }\n\n goto __REENTRY_PREPARATION;\n\n\n\nTERMINAL_END_OF_STREAM:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_END_OF_STREAM\");\n\n {\n \n #line 1 \"\"\n {\n self.counter.__shift_end_values_to_start_values();\n \n }\n#line 295 \"tiny_lexer-core-engine.cpp\"\n \n }\n\n#ifdef __QUEX_OPTION_ANALYSER_RETURN_TYPE_IS_VOID\n return /*__QUEX_TOKEN_ID_TERMINATION*/;\n#else\n return __QUEX_TOKEN_ID_TERMINATION;\n#endif\n\nTERMINAL_DEFAULT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_DEFAULT\");\n\nme->buffer._input_p = me->buffer._lexeme_start_p;\nif( QuexBuffer_is_end_of_file(&me->buffer) ) {\n\n /* Next increment will stop on EOF character. */\n}\n\nelse {\n /* Step over nomatching character */ QuexBuffer_input_p_increment(&me->buffer);\n}\n\n QuexBuffer_set_terminating_zero_for_lexeme(&me->buffer);\n {\n \n #line 1 \"\"\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count(Lexeme, LexemeEnd);\n \n #line 86 \"simple.qx\"\n self.accumulator.add(Lexeme);\n \n#line 329 \"tiny_lexer-core-engine.cpp\"\n \n }\n#line 332 \"tiny_lexer-core-engine.cpp\"\n \n }\n\n goto __REENTRY_PREPARATION;\n\n#undef Lexeme\n#undef LexemeBegin\n#undef LexemeEnd\n#undef LexemeL\n#ifndef __QUEX_OPTION_USE_COMPUTED_GOTOS\n__TERMINAL_ROUTER: {\n /* if last_acceptance => goto correspondent acceptance terminal state*/\n /* else => execute defaul action*/\n switch( last_acceptance ) {\n case 56: goto TERMINAL_56;\n case 52: goto TERMINAL_52;\n case 54: goto TERMINAL_54;\n\n default: goto TERMINAL_DEFAULT;; /* nothing matched */\n }\n }\n#endif /* __QUEX_OPTION_USE_COMPUTED_GOTOS */\n\n \n__REENTRY_PREPARATION:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: __REENTRY_PREPARATION\");\n\n /* (*) Common point for **restarting** lexical analysis.\n * at each time when CONTINUE is called at the end of a pattern. */\n last_acceptance = QUEX_GOTO_TERMINAL_LABEL_INIT_VALUE;\n\n\n /* Post context positions do not have to be reset or initialized. If a state\n * is reached which is associated with 'end of post context' it is clear what\n * post context is meant. This results from the ways the state machine is \n * constructed. A post context positions live time looks like the following:\n *\n * (1) unitialized (don't care)\n * (1.b) on buffer reload it may, or may not be adapted (don't care)\n * (2) when a post context begin state is passed, the it is **SET** (now: take care)\n * (2.b) on buffer reload it **is adapted**.\n * (3) when a terminal state of the post context is reached (which can only be reached\n * for that particular post context, then the post context position is used\n * to reset the input position. */\n\n /* If a mode change happened, then the function must first return and\n * indicate that another mode function is to be called. At this point, \n * we to force a 'return' on a mode change. \n *\n * Pseudo Code: if( previous_mode != current_mode ) {\n * return 0;\n * }\n *\n * When the analyzer returns, the caller function has to watch if a mode change\n * occured. If not it can call this function again. */\n#if defined(QUEX_OPTION_AUTOMATIC_ANALYSIS_CONTINUATION_ON_MODE_CHANGE) || defined(QUEX_OPTION_ASSERTS)\n if( me->DEBUG_analyser_function_at_entry != me->current_analyser_function ) \n#endif\n { \n#if defined(QUEX_OPTION_AUTOMATIC_ANALYSIS_CONTINUATION_ON_MODE_CHANGE)\n# ifdef __QUEX_OPTION_ANALYSER_RETURN_TYPE_IS_VOID\n return /*__QUEX_TOKEN_ID_UNINITIALIZED*/;\n# else\n return __QUEX_TOKEN_ID_UNINITIALIZED;\n# endif\n#elif defined(QUEX_OPTION_ASSERTS)\n QUEX_ERROR_EXIT(\"Mode change without immediate return from the lexical analyser.\");\n#endif\n }\n\n goto __REENTRY;\n\n /* prevent compiler warning 'unused variable': use variables once in a part of the code*/\n /* that is never reached (and deleted by the compiler anyway).*/\n if( 0 == 1 ) {\n int unused = 0;\n unused = unused + STRING_READER.id;\n unused = unused + PROGRAM.id;\n }\n}\n#include <quex/code_base/temporary_macros_off>\n\n#include <quex/code_base/template/Analyser>\n#include <quex/code_base/buffer/Buffer>\n\n#ifdef CONTINUE\n# undef CONTINUE\n#endif\n#define CONTINUE goto __REENTRY_PREPARATION;\n#include <quex/code_base/temporary_macros_on>\n\n__QUEX_SETTING_ANALYSER_FUNCTION_RETURN_TYPE \ntiny_lexer_PROGRAM_analyser_function(QuexAnalyser* me) \n{\n /* NOTE: Different modes correspond to different analyser functions. The analyser*/\n /* functions are all located inside the main class as static functions. That*/\n /* means, they are something like 'globals'. They receive a pointer to the */\n /* lexical analyser, since static member do not have access to the 'this' pointer.*/\n# if defined (__QUEX_SETTING_PLAIN_C)\n# define self (*me)\n# else\n using namespace quex;\n QUEX_LEXER_CLASS& self = *((QUEX_LEXER_CLASS*)me);\n# endif\n /* me = pointer to state of the lexical analyser */\n quex::QuexMode& STRING_READER = QUEX_LEXER_CLASS::STRING_READER;\n quex::QuexMode& PROGRAM = QUEX_LEXER_CLASS::PROGRAM;\n QUEX_GOTO_LABEL_TYPE last_acceptance = QUEX_GOTO_TERMINAL_LABEL_INIT_VALUE;\n QUEX_CHARACTER_POSITION_TYPE last_acceptance_input_position = (QUEX_CHARACTER_TYPE*)(0x00);\n QUEX_CHARACTER_POSITION_TYPE* post_context_start_position = 0x0;\n const size_t PostContextStartPositionN = (size_t)0;\n QUEX_CHARACTER_TYPE input = (QUEX_CHARACTER_TYPE)(0x00);\n\n /* Post context positions do not have to be reset or initialized. If a state\n * is reached which is associated with 'end of post context' it is clear what\n * post context is meant. This results from the ways the state machine is \n * constructed. A post context positions live time looks like the following:\n *\n * (1) unitialized (don't care)\n * (1.b) on buffer reload it may, or may not be adapted (don't care)\n * (2) when a post context begin state is passed, the it is **SET** (now: take care)\n * (2.b) on buffer reload it **is adapted**.\n * (3) when a terminal state of the post context is reached (which can only be reached\n * for that particular post context, then the post context position is used\n * to reset the input position. */\n#if defined(QUEX_OPTION_AUTOMATIC_ANALYSIS_CONTINUATION_ON_MODE_CHANGE) \\\n || defined(QUEX_OPTION_ASSERTS)\n me->DEBUG_analyser_function_at_entry = me->current_analyser_function;\n#endif\n__REENTRY:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: __REENTRY\");\n QuexBuffer_mark_lexeme_start(&me->buffer);\n QuexBuffer_undo_terminating_zero_for_lexeme(&me->buffer);\n /* state machine */\n /* init-state = 236L\n * 00236() <~ (22, 63), (25, 69), (28, 75), (31, 91), (34, 104), (37, 111), (44, 128), (45, 132), (48, 138), (50, 142)\n * == ['\\t', '\\n'], ' ' ==> 00243\n * == '\"' ==> 00244\n * == ['0', '9'] ==> 00246\n * == ';' ==> 00241\n * == '=' ==> 00240\n * == ['a', 'h'], ['j', 'r'], ['t', 'z'] ==> 00245\n * == 'i' ==> 00239\n * == 's' ==> 00238\n * == '{' ==> 00242\n * == '}' ==> 00237\n * <no epsilon>\n * 00237(A, S) <~ (25, 70, A, S)\n * <no epsilon>\n * 00238(A, S) <~ (44, 129, A, S), (31, 92)\n * == ['a', 's'], ['u', 'z'] ==> 00245\n * == 't' ==> 00248\n * <no epsilon>\n * 00248(A, S) <~ (44, 129, A, S), (31, 93)\n * == ['a', 'q'], ['s', 'z'] ==> 00245\n * == 'r' ==> 00249\n * <no epsilon>\n * 00249(A, S) <~ (44, 129, A, S), (31, 94)\n * == ['a', 't'], ['v', 'z'] ==> 00245\n * == 'u' ==> 00250\n * <no epsilon>\n * 00250(A, S) <~ (44, 129, A, S), (31, 95)\n * == ['a', 'b'], ['d', 'z'] ==> 00245\n * == 'c' ==> 00251\n * <no epsilon>\n * 00251(A, S) <~ (44, 129, A, S), (31, 96)\n * == ['a', 's'], ['u', 'z'] ==> 00245\n * == 't' ==> 00252\n * <no epsilon>\n * 00252(A, S) <~ (31, 97, A, S)\n * == ['a', 'z'] ==> 00245\n * <no epsilon>\n * 00245(A, S) <~ (44, 129, A, S)\n * == ['a', 'z'] ==> 00245\n * <no epsilon>\n * 00239(A, S) <~ (44, 129, A, S), (34, 105)\n * == ['a', 'e'], ['g', 'z'] ==> 00245\n * == 'f' ==> 00247\n * <no epsilon>\n * 00247(A, S) <~ (34, 106, A, S)\n * == ['a', 'z'] ==> 00245\n * <no epsilon>\n * 00240(A, S) <~ (28, 76, A, S)\n * <no epsilon>\n * 00241(A, S) <~ (37, 112, A, S)\n * <no epsilon>\n * 00242(A, S) <~ (22, 64, A, S)\n * <no epsilon>\n * 00243(A, S) <~ (48, 139, A, S)\n * <no epsilon>\n * 00244(A, S) <~ (50, 143, A, S)\n * <no epsilon>\n * 00246(A, S) <~ (45, 133, A, S)\n * == ['0', '9'] ==> 00246\n * <no epsilon>\n * \n */\nSTATE_236:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_236\");\n\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 61) {\n if( input < 34) {\n if( input == 9 || input == 10 || input == 32 ) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_48_DIRECT;\n } else {\n goto STATE_236_DROP_OUT;\n }\n } else {\n if( input < 58) {\n if( input < 35) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_50_DIRECT; /* '\"' */\n } else {\n if( input < 48) {\n goto STATE_236_DROP_OUT_DIRECT; /* ['#', '/'] */\n } else {\n goto STATE_246; /* ['0', '9'] */\n }\n }\n } else {\n if( input == 59) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_37_DIRECT; /* ';' */\n } else {\n goto STATE_236_DROP_OUT_DIRECT; /* ':' */\n }\n }\n }\n } else {\n if( input < 115) {\n if( input < 97) {\n if( input == 61) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_28_DIRECT; /* '=' */\n } else {\n goto STATE_236_DROP_OUT_DIRECT; /* ['>', '`'] */\n }\n } else {\n if( input == 105) {\n goto STATE_239; /* 'i' */\n } else {\n goto STATE_245; /* ['a', 'h'] */\n }\n }\n } else {\n if( input < 124) {\n if( input < 116) {\n goto STATE_238; /* 's' */\n } else {\n if( input != 123) {\n goto STATE_245; /* ['t', 'z'] */\n } else {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_22_DIRECT; /* '{' */\n }\n }\n } else {\n if( input == 125) {\n QuexBuffer_input_p_increment(&me->buffer);\n goto TERMINAL_25_DIRECT; /* '}' */\n } else {\n goto STATE_236_DROP_OUT_DIRECT; /* '|' */\n }\n }\n }\n }\n\nSTATE_236_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_236_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_236_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_236_DROP_OUT_DIRECT\");\n QUEX_GOTO_last_acceptance();\n\n }\n\n if( QuexBuffer_is_end_of_file(&me->buffer) ) {\n /* NO CHECK 'last_acceptance != -1' --- first state can **never** be an acceptance state */\n goto TERMINAL_END_OF_STREAM;\n }\n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_236_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\nSTATE_236_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_236_INPUT\");\n QuexBuffer_input_p_increment(&me->buffer);\n goto STATE_236;\nSTATE_238:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_238\");\n\nSTATE_238_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_238_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 116) {\n if( input < 97) {\n goto STATE_238_DROP_OUT; /* [-oo, '`'] */\n } else {\n goto STATE_245; /* ['a', 's'] */\n }\n } else {\n if( input < 117) {\n goto STATE_248; /* 't' */\n } else {\n if( input < 123) {\n goto STATE_245; /* ['u', 'z'] */\n } else {\n goto STATE_238_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n\nSTATE_238_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_238_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_238_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_238_DROP_OUT_DIRECT\");\n goto TERMINAL_44_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"44\");\n QUEX_SET_last_acceptance(44);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_238_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_239:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_239\");\n\nSTATE_239_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_239_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 102) {\n if( input < 97) {\n goto STATE_239_DROP_OUT; /* [-oo, '`'] */\n } else {\n goto STATE_245; /* ['a', 'e'] */\n }\n } else {\n if( input < 103) {\n goto STATE_247; /* 'f' */\n } else {\n if( input < 123) {\n goto STATE_245; /* ['g', 'z'] */\n } else {\n goto STATE_239_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n\nSTATE_239_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_239_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_239_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_239_DROP_OUT_DIRECT\");\n goto TERMINAL_44_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"44\");\n QUEX_SET_last_acceptance(44);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_239_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_245:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_245\");\n\nSTATE_245_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_245_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input >= 97 && input < 123 ) {\n goto STATE_245; /* ['a', 'z'] */\n } else {\n goto STATE_245_DROP_OUT; /* [-oo, '`'] */\n }\n\nSTATE_245_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_245_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_245_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_245_DROP_OUT_DIRECT\");\n goto TERMINAL_44_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"44\");\n QUEX_SET_last_acceptance(44);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_245_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_246:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_246\");\n\nSTATE_246_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_246_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input >= 48 && input < 58 ) {\n goto STATE_246; /* ['0', '9'] */\n } else {\n goto STATE_246_DROP_OUT; /* [-oo, '/'] */\n }\n\nSTATE_246_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_246_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_246_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_246_DROP_OUT_DIRECT\");\n goto TERMINAL_45_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"45\");\n QUEX_SET_last_acceptance(45);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_246_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_247:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_247\");\n\nSTATE_247_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_247_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input >= 97 && input < 123 ) {\n goto STATE_245; /* ['a', 'z'] */\n } else {\n goto STATE_247_DROP_OUT; /* [-oo, '`'] */\n }\n\nSTATE_247_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_247_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_247_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_247_DROP_OUT_DIRECT\");\n goto TERMINAL_34_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"34\");\n QUEX_SET_last_acceptance(34);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_247_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_248:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_248\");\n\nSTATE_248_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_248_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 114) {\n if( input < 97) {\n goto STATE_248_DROP_OUT; /* [-oo, '`'] */\n } else {\n goto STATE_245; /* ['a', 'q'] */\n }\n } else {\n if( input < 115) {\n goto STATE_249; /* 'r' */\n } else {\n if( input < 123) {\n goto STATE_245; /* ['s', 'z'] */\n } else {\n goto STATE_248_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n\nSTATE_248_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_248_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_248_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_248_DROP_OUT_DIRECT\");\n goto TERMINAL_44_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"44\");\n QUEX_SET_last_acceptance(44);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_248_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_249:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_249\");\n\nSTATE_249_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_249_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 117) {\n if( input < 97) {\n goto STATE_249_DROP_OUT; /* [-oo, '`'] */\n } else {\n goto STATE_245; /* ['a', 't'] */\n }\n } else {\n if( input < 118) {\n goto STATE_250; /* 'u' */\n } else {\n if( input < 123) {\n goto STATE_245; /* ['v', 'z'] */\n } else {\n goto STATE_249_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n\nSTATE_249_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_249_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_249_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_249_DROP_OUT_DIRECT\");\n goto TERMINAL_44_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"44\");\n QUEX_SET_last_acceptance(44);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_249_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_250:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_250\");\n\nSTATE_250_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_250_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 99) {\n if( input == 97 || input == 98 ) {\n goto STATE_245;\n } else {\n goto STATE_250_DROP_OUT;\n }\n } else {\n if( input < 100) {\n goto STATE_251; /* 'c' */\n } else {\n if( input < 123) {\n goto STATE_245; /* ['d', 'z'] */\n } else {\n goto STATE_250_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n\nSTATE_250_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_250_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_250_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_250_DROP_OUT_DIRECT\");\n goto TERMINAL_44_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"44\");\n QUEX_SET_last_acceptance(44);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_250_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_251:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_251\");\n\nSTATE_251_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_251_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input < 116) {\n if( input < 97) {\n goto STATE_251_DROP_OUT; /* [-oo, '`'] */\n } else {\n goto STATE_245; /* ['a', 's'] */\n }\n } else {\n if( input < 117) {\n goto STATE_252; /* 't' */\n } else {\n if( input < 123) {\n goto STATE_245; /* ['u', 'z'] */\n } else {\n goto STATE_251_DROP_OUT_DIRECT; /* ['{', oo] */\n }\n }\n }\n\nSTATE_251_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_251_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\nSTATE_251_DROP_OUT_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_251_DROP_OUT_DIRECT\");\n goto TERMINAL_44_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"44\");\n QUEX_SET_last_acceptance(44);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_251_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\nSTATE_252:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_252\");\n\nSTATE_252_INPUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_252_INPUT\");\n\n QuexBuffer_input_p_increment(&me->buffer);\n input = QuexBuffer_input_get(&me->buffer);\n if( input >= 97 && input < 123 ) {\n goto STATE_245; /* ['a', 'z'] */\n } else {\n goto STATE_252_DROP_OUT; /* [-oo, '`'] */\n }\n\nSTATE_252_DROP_OUT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_252_DROP_OUT\");\n if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\n /* STATE_252_DROP_OUT_DIRECT:\n */\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: STATE_252_DROP_OUT_DIRECT\");\n goto TERMINAL_31_DIRECT;\n }\n\n QUEX_DEBUG_PRINT2(&me->buffer, \"ACCEPTANCE: %s\", \"31\");\n QUEX_SET_last_acceptance(31);\n last_acceptance_input_position = QuexBuffer_tell_memory_adr(&me->buffer);\n \n QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\n if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\n post_context_start_position, PostContextStartPositionN) ) {\n goto STATE_252_INPUT;\n }\n\n QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\n QUEX_GOTO_last_acceptance();\n\n\n\n\n /* (*) Terminal states _______________________________________________________*/\n /**/\n /* Acceptance terminal states, i.e. the 'winner patterns'. This means*/\n /* that the last input dropped out of a state where the longest matching*/\n /* pattern was according to the terminal state. The terminal states are */\n /* numbered after the pattern id.*/\n /**/\n#define Lexeme (me->buffer._lexeme_start_p)\n#define LexemeBegin (me->buffer._lexeme_start_p)\n#define LexemeEnd (me->buffer._input_p)\n#define LexemeL (size_t)(me->buffer._input_p - me->buffer._lexeme_start_p)\nTERMINAL_34:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_34\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_34_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_34_DIRECT\");\n\n {\n \n #line 1 \"\"\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(2);\n \n #line 54 \"simple.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_IF); return;\n #else\n self.send(); return QUEX_TKN_IF;\n #endif\n#line 1108 \"tiny_lexer-core-engine.cpp\"\n \n }\n#line 1111 \"tiny_lexer-core-engine.cpp\"\n \n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_37:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_37\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_37_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_37_DIRECT\");\n\n {\n \n #line 1 \"\"\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(1);\n \n #line 55 \"simple.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_SEMICOLON); return;\n #else\n self.send(); return QUEX_TKN_SEMICOLON;\n #endif\n#line 1138 \"tiny_lexer-core-engine.cpp\"\n \n }\n#line 1141 \"tiny_lexer-core-engine.cpp\"\n \n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_44:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_44\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_44_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_44_DIRECT\");\n\n QuexBuffer_set_terminating_zero_for_lexeme(&me->buffer);\n {\n \n #line 1 \"\"\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(LexemeL);\n \n #line 57 \"simple.qx\"\n self.send(QUEX_TKN_IDENTIFIER, Lexeme); \n#line 1165 \"tiny_lexer-core-engine.cpp\"\n \n }\n#line 1168 \"tiny_lexer-core-engine.cpp\"\n \n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_45:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_45\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_45_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_45_DIRECT\");\n\n QuexBuffer_set_terminating_zero_for_lexeme(&me->buffer);\n {\n \n #line 1 \"\"\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(LexemeL);\n \n #line 58 \"simple.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_NUMBER, atoi((const char*)Lexeme)); return;\n #else\n self.send(atoi((const char*)Lexeme)); return QUEX_TKN_NUMBER;\n #endif\n#line 1196 \"tiny_lexer-core-engine.cpp\"\n \n }\n#line 1199 \"tiny_lexer-core-engine.cpp\"\n \n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_48:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_48\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_48_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_48_DIRECT\");\n\n QuexBuffer_set_terminating_zero_for_lexeme(&me->buffer);\n {\n \n #line 1 \"\"\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count(Lexeme, LexemeEnd);\n \n }\n#line 1222 \"tiny_lexer-core-engine.cpp\"\n \n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_50:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_50\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_50_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_50_DIRECT\");\n\n {\n \n #line 1 \"\"\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(1);\n \n #line 63 \"simple.qx\"\n self.send(QUEX_TKN_QUOTE);\n self << STRING_READER;\n RETURN;\n \n#line 1248 \"tiny_lexer-core-engine.cpp\"\n \n }\n#line 1251 \"tiny_lexer-core-engine.cpp\"\n \n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_22:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_22\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_22_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_22_DIRECT\");\n\n {\n \n #line 1 \"\"\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(1);\n \n #line 50 \"simple.qx\"\n self.send(QUEX_TKN_CURLY_BRACKET_O); RETURN; \n#line 1274 \"tiny_lexer-core-engine.cpp\"\n \n }\n#line 1277 \"tiny_lexer-core-engine.cpp\"\n \n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_25:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_25\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_25_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_25_DIRECT\");\n\n {\n \n #line 1 \"\"\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(1);\n \n #line 51 \"simple.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_CURLY_BRACKET_C); return;\n #else\n self.send(); return QUEX_TKN_CURLY_BRACKET_C;\n #endif\n#line 1304 \"tiny_lexer-core-engine.cpp\"\n \n }\n#line 1307 \"tiny_lexer-core-engine.cpp\"\n \n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_28:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_28\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_28_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_28_DIRECT\");\n\n {\n \n #line 1 \"\"\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(1);\n \n #line 52 \"simple.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_OP_ASSIGNMENT); return;\n #else\n self.send(); return QUEX_TKN_OP_ASSIGNMENT;\n #endif\n#line 1334 \"tiny_lexer-core-engine.cpp\"\n \n }\n#line 1337 \"tiny_lexer-core-engine.cpp\"\n \n }\n\n goto __REENTRY_PREPARATION;\n\nTERMINAL_31:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_31\");\n\n QuexBuffer_seek_memory_adr(&me->buffer, last_acceptance_input_position);\n\nTERMINAL_31_DIRECT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_31_DIRECT\");\n\n {\n \n #line 1 \"\"\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count_NoNewline(6);\n \n #line 53 \"simple.qx\"\n #ifdef QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\n self.send(QUEX_TKN_STRUCT); return;\n #else\n self.send(); return QUEX_TKN_STRUCT;\n #endif\n#line 1364 \"tiny_lexer-core-engine.cpp\"\n \n }\n#line 1367 \"tiny_lexer-core-engine.cpp\"\n \n }\n\n goto __REENTRY_PREPARATION;\n\n\n\nTERMINAL_END_OF_STREAM:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_END_OF_STREAM\");\n\n {\n \n #line 1 \"\"\n {\n self.counter.__shift_end_values_to_start_values();\n \n }\n#line 1385 \"tiny_lexer-core-engine.cpp\"\n \n }\n\n#ifdef __QUEX_OPTION_ANALYSER_RETURN_TYPE_IS_VOID\n return /*__QUEX_TOKEN_ID_TERMINATION*/;\n#else\n return __QUEX_TOKEN_ID_TERMINATION;\n#endif\n\nTERMINAL_DEFAULT:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: TERMINAL_DEFAULT\");\n\nme->buffer._input_p = me->buffer._lexeme_start_p;\nif( QuexBuffer_is_end_of_file(&me->buffer) ) {\n\n /* Next increment will stop on EOF character. */\n}\n\nelse {\n /* Step over nomatching character */ QuexBuffer_input_p_increment(&me->buffer);\n}\n\n QuexBuffer_set_terminating_zero_for_lexeme(&me->buffer);\n {\n \n #line 1 \"\"\n {\n self.counter.__shift_end_values_to_start_values();\n self.counter.count(Lexeme, LexemeEnd);\n \n }\n#line 1417 \"tiny_lexer-core-engine.cpp\"\n \n }\n\n goto __REENTRY_PREPARATION;\n\n#undef Lexeme\n#undef LexemeBegin\n#undef LexemeEnd\n#undef LexemeL\n#ifndef __QUEX_OPTION_USE_COMPUTED_GOTOS\n__TERMINAL_ROUTER: {\n /* if last_acceptance => goto correspondent acceptance terminal state*/\n /* else => execute defaul action*/\n switch( last_acceptance ) {\n case 34: goto TERMINAL_34;\n case 37: goto TERMINAL_37;\n case 44: goto TERMINAL_44;\n case 45: goto TERMINAL_45;\n case 48: goto TERMINAL_48;\n case 50: goto TERMINAL_50;\n case 22: goto TERMINAL_22;\n case 25: goto TERMINAL_25;\n case 28: goto TERMINAL_28;\n case 31: goto TERMINAL_31;\n\n default: goto TERMINAL_DEFAULT;; /* nothing matched */\n }\n }\n#endif /* __QUEX_OPTION_USE_COMPUTED_GOTOS */\n\n \n__REENTRY_PREPARATION:\n QUEX_DEBUG_PRINT(&me->buffer, \"LABEL: __REENTRY_PREPARATION\");\n\n /* (*) Common point for **restarting** lexical analysis.\n * at each time when CONTINUE is called at the end of a pattern. */\n last_acceptance = QUEX_GOTO_TERMINAL_LABEL_INIT_VALUE;\n\n\n /* Post context positions do not have to be reset or initialized. If a state\n * is reached which is associated with 'end of post context' it is clear what\n * post context is meant. This results from the ways the state machine is \n * constructed. A post context positions live time looks like the following:\n *\n * (1) unitialized (don't care)\n * (1.b) on buffer reload it may, or may not be adapted (don't care)\n * (2) when a post context begin state is passed, the it is **SET** (now: take care)\n * (2.b) on buffer reload it **is adapted**.\n * (3) when a terminal state of the post context is reached (which can only be reached\n * for that particular post context, then the post context position is used\n * to reset the input position. */\n\n /* If a mode change happened, then the function must first return and\n * indicate that another mode function is to be called. At this point, \n * we to force a 'return' on a mode change. \n *\n * Pseudo Code: if( previous_mode != current_mode ) {\n * return 0;\n * }\n *\n * When the analyzer returns, the caller function has to watch if a mode change\n * occured. If not it can call this function again. */\n#if defined(QUEX_OPTION_AUTOMATIC_ANALYSIS_CONTINUATION_ON_MODE_CHANGE) || defined(QUEX_OPTION_ASSERTS)\n if( me->DEBUG_analyser_function_at_entry != me->current_analyser_function ) \n#endif\n { \n#if defined(QUEX_OPTION_AUTOMATIC_ANALYSIS_CONTINUATION_ON_MODE_CHANGE)\n# ifdef __QUEX_OPTION_ANALYSER_RETURN_TYPE_IS_VOID\n return /*__QUEX_TOKEN_ID_UNINITIALIZED*/;\n# else\n return __QUEX_TOKEN_ID_UNINITIALIZED;\n# endif\n#elif defined(QUEX_OPTION_ASSERTS)\n QUEX_ERROR_EXIT(\"Mode change without immediate return from the lexical analyser.\");\n#endif\n }\n\n goto __REENTRY;\n\n /* prevent compiler warning 'unused variable': use variables once in a part of the code*/\n /* that is never reached (and deleted by the compiler anyway).*/\n if( 0 == 1 ) {\n int unused = 0;\n unused = unused + STRING_READER.id;\n unused = unused + PROGRAM.id;\n }\n}\n#include <quex/code_base/temporary_macros_off>\n#if ! defined(__QUEX_SETTING_PLAIN_C)\n} // namespace quex\n#endif\n" }, { "alpha_fraction": 0.5883983969688416, "alphanum_fraction": 0.590062141418457, "avg_line_length": 43.39901351928711, "blob_id": "22aeca9254a4f4db3f185b116647396ca76fc7c3", "content_id": "92b9d2d4bc2c5715763374375caf39796c325e2b", "detected_licenses": [ "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer", "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 9016, "license_type": "permissive", "max_line_length": 120, "num_lines": 203, "path": "/dependencies/quex-0.34.1/quex/core_engine/generator/acceptance_info.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "from quex.core_engine.generator.languages.core import __nice\nfrom quex.input.setup import setup as Setup\nLanguageDB = Setup.language_db\n\ndef do(State, StateIdx, SMD):\n assert State.__class__.__name__ == \"State\"\n assert SMD.__class__.__name__ == \"StateMachineDecorator\"\n \n mode = SMD.mode()\n if mode == \"ForwardLexing\": return forward_lexing(State, StateIdx, SMD)\n elif mode == \"BackwardLexing\": return backward_lexing(State)\n elif mode == \"BackwardInputPositionDetection\": return backward_lexing_find_core_pattern(State)\n else:\n assert False, \"This part of the code should never be reached\"\n\ndef forward_lexing(State, StateIdx, SMD, ForceF=False):\n \"\"\"Forward Lexing:\n\n (1) If a the end of a core pattern of a post contexted pattern is reached, then\n the current position needs to be stored in a dedicated register---ultimatively.\n\n (2) Final acceptance states can contain pre-conditions that have to be checked\n and their might me priorities.\n\n => use 'get_acceptance_detector()' in order to get a sequence of 'if-else'\n blocks that determine acceptance. \n \"\"\"\n assert SMD.__class__.__name__ == \"StateMachineDecorator\"\n SM = SMD.sm()\n\n OriginList = State.origins().get_list()\n\n txt = \"\"\n\n # (1) Set the post context registers (if appropriate)\n # (also determine the list of acceptance origins)\n contains_acceptance_f = False\n for origin in OriginList: \n if origin.is_end_of_post_contexted_core_pattern():\n assert origin.is_acceptance() == False\n # store current input position, to be restored when post condition really matches\n post_context_index = SMD.get_post_context_index(origin.state_machine_id)\n txt += \" \" + LanguageDB[\"$comment\"](\"post context index '%s' == state machine '%s'\" % \\\n (__nice(post_context_index), __nice(origin.state_machine_id)))\n txt += \" \" + LanguageDB[\"$input/tell_position\"](\"post_context_start_position[%i]\\n\" % post_context_index)\n\n elif origin.is_acceptance():\n contains_acceptance_f = True\n\n # -- If there is no 'real' acceptance, then we're done\n if not contains_acceptance_f: \n return txt \n\n # -- If the current acceptance does not need to be stored, then do not do it\n if not ForceF and \\\n do_subsequent_states_require_storage_of_last_acceptance_position(StateIdx, State, SM) == False: \n return txt\n \n # (2) Create detector for normal and pre-conditioned acceptances\n def __on_detection_code(Origin):\n \"\"\"Store the name of the winner pattern (last_acceptance) and the position\n where it has matched (use of $input/tell_position).\n \"\"\"\n assert Origin.is_acceptance()\n info = LanguageDB[\"$set-last_acceptance\"](__nice(Origin.state_machine_id))\n # NOTE: When a post conditioned pattern ends it does not store the input position.\n # Rather, the acceptance position of the core pattern is considered in the\n # terminal state.\n if Origin.post_context_id() == -1:\n info += LanguageDB[\"$input/tell_position\"](\"last_acceptance_input_position\") + \"\\n\"\n\n return info\n\n txt += get_acceptance_detector(OriginList, __on_detection_code)\n\n return txt\n\ndef backward_lexing(State):\n \"\"\"Backward Lexing:\n -- Using an inverse state machine from 'real' current start position backwards\n until a drop out occurs.\n -- During backward lexing, there is no 'winner' so all origins that indicate\n acceptance need to be considered. They raise there flag 'pre-condition fulfilled'.\n \"\"\"\n assert State.__class__.__name__ == \"State\"\n OriginList = State.origins().get_list()\n\n # There should be nothing, but unconditional acceptances or no-acceptance \n # origins in the list of origins.\n inadmissible_origin_list = filter(lambda origin:\n origin.pre_context_begin_of_line_f() or\n origin.pre_context_id() != -1L or\n origin.post_context_id() != -1L,\n OriginList)\n assert inadmissible_origin_list == [], \\\n \"Inadmissible origins for inverse state machine.\"\n #___________________________________________________________________________________________\n\n txt = \"\"\n for origin in OriginList:\n if not origin.store_input_position_f(): continue\n assert origin.is_acceptance()\n variable = \"pre_context_%s_fulfilled_f\" % __nice(origin.state_machine_id)\n txt += \" \" + LanguageDB[\"$assignment\"](variable, 1)\n txt += \"\\n\" \n\n return txt\n\ndef backward_lexing_find_core_pattern(State):\n \"\"\"Backward Lexing:\n -- (see above)\n -- for the search of the end of the core pattern, the acceptance position\n backwards must be stored. \n -- There is only one pattern involved, so no determination of 'who won'\n is important.\n \"\"\"\n assert State.__class__.__name__ == \"State\", \\\n \"Received %s as argument.\" % repr(State)\n\n OriginList = State.origins().get_list()\n\n # There should be nothing, but unconditional acceptances or no-acceptance \n # origins in the list of origins.\n inadmissible_origin_list = filter(lambda origin:\n origin.pre_context_begin_of_line_f() or\n origin.pre_context_id() != -1L or\n origin.post_context_id() != -1L,\n OriginList)\n assert inadmissible_origin_list == [], \\\n \"Inadmissible origins for inverse state machine.\"\n #___________________________________________________________________________________________\n\n\n for origin in OriginList:\n if origin.store_input_position_f():\n assert origin.is_acceptance()\n return \" \" + LanguageDB[\"$input/tell_position\"](\"end_of_core_pattern_position\") + \"\\n\"\n return \"\\n\"\n\ndef get_acceptance_detector(OriginList, get_on_detection_code_fragment):\n \n LanguageDB = Setup.language_db\n\n def indent_this(Fragment):\n # do not replace the last '\\n' with '\\n '\n return \" \" + Fragment[:-1].replace(\"\\n\", \"\\n \") + Fragment[-1]\n\n txt = \"\"\n first_if_statement_f = True\n OriginList.sort()\n for origin in OriginList:\n if not origin.is_acceptance(): continue\n\n info = get_on_detection_code_fragment(origin)\n\n if origin.pre_context_id() != -1L:\n if first_if_statement_f: txt += LanguageDB[\"$if pre-context\"](origin.pre_context_id())\n else: txt += LanguageDB[\"$elseif pre-context\"](origin.pre_context_id())\n txt += indent_this(info)\n txt += LanguageDB[\"$endif\"]\n \n elif origin.pre_context_begin_of_line_f():\n if first_if_statement_f: txt += LanguageDB[\"$if begin-of-line\"]\n else: txt += LanguageDB[\"$elseif begin-of-line\"]\n txt += indent_this(info)\n txt += LanguageDB[\"$endif\"] \n \n else:\n if first_if_statement_f: \n txt += info\n else:\n # if an 'if' statements preceeded, the acceptance needs to appear in an else block\n txt += LanguageDB[\"$else\"] + \"\\n\"; \n txt += indent_this(info)\n txt += LanguageDB[\"$endif\"]\n\n break # no need for further pre-condition consideration\n\n first_if_statement_f = False\n\n # (*) write code for the unconditional acceptance states\n if txt == \"\": return \"\"\n else: return \" \" + txt[:-1].replace(\"\\n\", \"\\n \") + txt[-1]\n\ndef do_subsequent_states_require_storage_of_last_acceptance_position(StateIdx, State, SM):\n \"\"\"For the 'longest match' approach it is generally necessary to store the last\n pattern that has matched the current input stream. This means, that the\n current pattern index **and** the current input position need to be stored.\n Nothing of that is necessary, if one knows that a state does not have any\n 'critical' follow-up states where the position is to be restored.\n \"\"\"\n assert State.__class__.__name__ == \"State\"\n assert SM.__class__.__name__ == \"StateMachine\"\n assert State.is_acceptance()\n reachable_state_list = State.transitions().get_target_state_index_list()\n\n # If all directly following states are acceptance states then there is no\n # point in storing the last acceptance. It is overridden anyway at the \n # entry of the next state. If one single state is non-acceptance then we\n # need to store the acceptance (return True).\n for state_index in reachable_state_list:\n if SM.states[state_index].is_acceptance() == False: return True\n return False\n\n\n\n" }, { "alpha_fraction": 0.70878005027771, "alphanum_fraction": 0.7183424830436707, "avg_line_length": 32.17307662963867, "blob_id": "d651af0241b9847d76c3bbe7417ff3ee130870d9", "content_id": "5cb445562342f82af46f7fc7fb0ded8b0403b58c", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 3451, "license_type": "permissive", "max_line_length": 98, "num_lines": 104, "path": "/engine/gfx/gfx_pipeline.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n/* TODO:\n * clutter / rclutter\n * shaders\n * materials\n */\n\n#include \"../shared_ptr.h\"\n#include \"../vect_util.h\"\n\n// Only things that are referenced from Lua AND can be destroyed (before shutdown) get a SharedPtr\nclass GfxPipeline;\n\n#ifndef GfxPipeline_h\n#define GfxPipeline_h\n\n#include \"gfx_internal.h\"\n\nvoid gfx_pipeline_init (void);\n\nstruct CameraOpts {\n float fovY, nearClip, farClip;\n float frustumOffset;\n float saturationMask;\n Vector3 mask; // colour\n bool decals;\n int debugMode;\n bool bloomAndToneMap;\n bool pointLights;\n bool particles;\n bool tracers;\n bool sky;\n bool sun;\n bool firstPerson;\n bool reflect;\n Vector3 reflectPlaneNormal;\n float reflectPlaneDist;\n Vector3 pos;\n Quaternion dir;\n CameraOpts (void)\n : fovY(55), nearClip(0.3f), farClip(800),\n frustumOffset(0), saturationMask(1), mask(1,1,1), decals(true), debugMode(0),\n bloomAndToneMap(true), pointLights(true), particles(true), tracers(true), sky(true),\n sun(true), firstPerson(true), reflect(false), reflectPlaneNormal(0,0,1),\n reflectPlaneDist(0), pos(0,0,0), dir(0,0,0,1)\n { }\n};\n\n/** The pipeline handles complete rendering of the scene for one 'eye' of a stereographic view. */\nclass GfxPipeline {\n Ogre::Camera *cam;\n GfxLastRenderStats gBufferStats;\n GfxLastRenderStats deferredStats;\n\n // gbuffer target\n Ogre::TexturePtr gBufferElements[3];\n Ogre::MultiRenderTarget *gBuffer;\n Ogre::RenderQueueInvocationSequence *rqisGbuffer;\n\n Ogre::TexturePtr hdrFb[3];\n\n // ultimate target\n Ogre::Viewport *targetViewport;\n Ogre::RenderQueueInvocationSequence *rqisDebug;\n Ogre::RenderQueueInvocationSequence *rqisDeferred;\n\n CameraOpts opts;\n\n public:\n GfxPipeline (const std::string &name, Ogre::Viewport *target_viewport);\n\n ~GfxPipeline (void);\n\n void render (const CameraOpts &opts, bool additive=false);\n\n const GfxLastRenderStats &getGBufferStats (void) { return gBufferStats; }\n const GfxLastRenderStats &getDeferredStats (void) { return deferredStats; }\n\n const CameraOpts &getCameraOpts (void) const { return opts; }\n Ogre::Camera *getCamera (void) const { return cam; }\n const Ogre::TexturePtr &getGBufferTexture (unsigned i) const { return gBufferElements[i]; }\n};\n\n#endif \n" }, { "alpha_fraction": 0.6343807578086853, "alphanum_fraction": 0.6384839415550232, "avg_line_length": 47.22395706176758, "blob_id": "f669e060f3bd6958192d8341c70ff4e8c9849175", "content_id": "291e01005b1984000b5bace49abe3cf6d07661ac", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 9261, "license_type": "permissive", "max_line_length": 114, "num_lines": 192, "path": "/dependencies/quex-0.34.1/quex/core_engine/state_machine/character_counter.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "from quex.core_engine.interval_handling import Interval, NumberSet\n\n__distance_db = {}\ndef get_newline_n(state_machine): \n \"\"\"\n Counts the number of newlines that appear until the acceptance state. \n The part of the post condition is omitted. \n\n RETURNS: 0 if statemachine / pattern does not contain the newline\n character at all.\n N > 0 number of newlines that are **always** required in order to\n reach an acceptance state.\n -1 the number of newlines cannot be determined, because of \n recursion or because there are different pathes to acceptance\n with different numbers of newlines occuring.\n\n NOTE: Only the core pattern is concerned---not the pre- or post-condition.\n \"\"\"\n global __distance_db\n __distance_db.clear()\n return __dive(state_machine, state_machine.init_state_index, 0, [], CharacterToCount=ord('\\n'))\n\ndef get_character_n(state_machine):\n \"\"\"\n Counts the number of characters that appear until the acceptance state. \n The part of the post condition is omitted. \n\n RETURNS: 0 if statemachine / pattern does not contain the newline\n character at all.\n N > 0 number of newlines that are **always** required in order to\n reach an acceptance state.\n -1 the number of newlines cannot be determined, because of \n recursion or because there are different pathes to acceptance\n with different numbers of newlines occuring.\n\n NOTE: Only the core pattern is concerned---not the pre- or post-condition.\n \"\"\"\n global __distance_db\n __distance_db.clear()\n return __dive(state_machine, state_machine.init_state_index, 0, [], CharacterToCount=-1)\n\ndef contains_only_spaces(state_machine):\n \"\"\"Determines wether there are only spaces on the way to the acceptance state.\n \"\"\"\n for state in state_machine.states.values():\n target_state_list = state.transitions().get_target_state_index_list()\n # (1) if a pattern contains only ' ', then there is no place for more than\n # one target state, since every state has only one trigger and one target state\n if len(target_state_list) > 1: return False\n\n # (2) does state exclusively trigger on ' '?\n # (2a) does state trigger on ' '?\n all_trigger_set = state.transitions().get_trigger_set_union()\n if all_trigger_set.contains(ord(' ')) == False: return False\n # (2b) does state trigger on nothing else? \n if all_trigger_set.difference(NumberSet(ord(' '))).is_empty() == False: return False\n\n return True\n\ndef __recursion_contains_critical_character(state_machine, Path, TargetStateIdx, Character):\n \"\"\"Path = list of state indices\n Character = character code of concern.\n -1 => any character.\n \n RETURNS: True = the path contains the TargetStateIdx and on the path\n there is the critical character.\n False = the path does either not contain the TargetStateIdx,\n i.e. there will be no recursion, or the recursion\n path does not contain the critical character and \n therefore is not dangerous.\n\n NOTE: This function is required to judge wether a recursion occurs\n that effects the number of characters to be counted. If so,\n then the recursion signifies that the number of characters\n to be matched cannot be determined directly from the state machine.\n They have to be computed after a match has happend.\n \"\"\"\n assert TargetStateIdx in Path \n\n # -- recursion detected!\n # did the critical character occur in the path?\n if Character == -1: return True\n\n occurence_idx = Path.index(TargetStateIdx)\n prev_idx = TargetStateIdx\n for idx in Path[occurence_idx+1:] + [TargetStateIdx]:\n # does transition from prev_state to state contain newline?\n trigger_set = state_machine.states[prev_idx].transitions().get_trigger_set_to_target(idx)\n if trigger_set.contains(Character):\n return True # YES! recursion with critical character\n prev_idx = idx\n\n # -- no critical character in recursion --> OK, no problem\n # -- state has been already handled, no further treatment required\n return False\n\ndef __recursion_with_critical_character_ahead(state_machine, state, PassedStateList, Character):\n \"\"\"Does any of the following target states close a recursion loop which contains the \n character to be counted?\n \"\"\"\n\n for follow_state_index in state.transitions().get_target_state_index_list():\n\n if follow_state_index not in PassedStateList: continue\n\n if __recursion_contains_critical_character(state_machine, PassedStateList, follow_state_index, Character):\n return True\n\n return False\n\ndef __dive(state_machine, state_index, character_n, passed_state_list, CharacterToCount):\n \"\"\"Once the distance to the acceptance state is determined, we store it in a cache database.\n Note, that the distance is only stored after all possible pathes starting from the state\n have been investigated. Note also, that the distance to the acceptance state can be \n '-1' meaning that there are multiple pathes of different length, i.e. it cannot be\n determined from the pattern how many characters appear in the lexeme that matches.\n \"\"\"\n global __distance_db\n if __distance_db.has_key(state_index): \n return __distance_db[state_index] + character_n\n\n result = ____dive(state_machine, state_index, character_n, passed_state_list, CharacterToCount)\n if state_index not in passed_state_list:\n __distance_db[state_index] = result - character_n\n\n return result\n\n\ndef ____dive(state_machine, state_index, character_n, passed_state_list, CharacterToCount):\n state = state_machine.states[state_index]\n\n new_passed_state_list = passed_state_list + [ state_index ]\n\n # -- recursion?\n if __recursion_with_critical_character_ahead(state_machine, state, new_passed_state_list, \n CharacterToCount):\n return -1\n\n # -- if no recursion is detected and the state is the end of a core exression\n # of a post conditioned pattern, then this is it. No further investigation\n # from this point on. The post condition state machine is not considered \n # for line number counting.\n if state.core().post_context_id() != -1L: return character_n\n\n # trigger_map[target_state_index] = set that triggers to target state index\n trigger_dict = state.transitions().get_map()\n if trigger_dict == {}: return character_n\n \n if state.is_acceptance(): prev_characters_found_n = character_n\n else: prev_characters_found_n = None\n\n for follow_state_index, trigger_set in trigger_dict.items():\n\n # -- do not follow recursive paths. note: this is only relevant for specified\n # CharacterToCount != -1. Otherwise, recursions are broken up when detected ahead.\n if follow_state_index in new_passed_state_list: continue\n \n if CharacterToCount == -1:\n # (1.1) We are counting all characters, so we increment always.\n increment = 1\n elif not trigger_set.contains(CharacterToCount):\n # (2.1) The trigger set does not contain the character to be counted at all\n # Thus the number of occurences is deterministic and **no increment occurence counter**.\n increment = 0\n elif trigger_set.has_only_this_element(CharacterToCount):\n # (2.2) The trigger set contains only the character to be counted.\n # Thus the number of occurences is deterministic and **increment occurence counter**.\n increment = 1\n else:\n # (2.3) The trigger set contains the character to be counted and also others. This\n # means that for the transition the number of occurences (zero or one) is not\n # determined by the pattern. Thus the number of occurences not deterministic.\n return -1\n\n characters_found_n = __dive(state_machine, follow_state_index, character_n + increment, \n new_passed_state_list, CharacterToCount)\n\n # -- if one path contains an undefined number of characters, then the whole pattern\n # has an undefined number of characters.\n if characters_found_n == -1: \n return -1\n\n # -- if one path contains a different number of characters than another path\n # then the number of characters is undefined.\n if prev_characters_found_n != None and \\\n prev_characters_found_n != characters_found_n: \n return -1\n\n prev_characters_found_n = characters_found_n\n\n if prev_characters_found_n == None: return -1\n else: return prev_characters_found_n\n\n\n" }, { "alpha_fraction": 0.6553672552108765, "alphanum_fraction": 0.694915235042572, "avg_line_length": 58, "blob_id": "507ea19c79adf4c1c1ea68fad66d8ffeebe10ecc", "content_id": "9af4f8c497735a256ce0a49079933436593bc86a", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Shell", "length_bytes": 177, "license_type": "permissive", "max_line_length": 163, "num_lines": 3, "path": "/engine/tests/gasoline/build_glsl_check.sh", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "#!/bin/bash\n\ng++ -Wall -Wextra -std=c++11 glsl_check.cpp -o glsl_check -lGL `pkg-config --cflags --libs glfw3` -lX11 -lXcursor -lXrandr -lXi -lXxf86vm -lpthread -ldl -lXinerama\n" }, { "alpha_fraction": 0.6369426846504211, "alphanum_fraction": 0.7006369233131409, "avg_line_length": 23.076923370361328, "blob_id": "d82e4b050f6ed660b16f5b03ffe08e3ee82b1f85", "content_id": "9d76308143704bf1c2fad0cfa7d49caf208d23c4", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Lua", "length_bytes": 314, "license_type": "permissive", "max_line_length": 35, "num_lines": 13, "path": "/engine/tests/engine/mesh/test.lua", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "\n-- Used by the meshes.\nregister_material(`Small`, {\n})\n\nprint \"Loading Test.08.mesh\" \ndisk_resource_load(`Test.08.mesh`)\nprint \"Using Test.08.mesh\" \nb08 = gfx_body_make(`Test.08.mesh`)\n\nprint \"Loading Test.08.mesh\"\ndisk_resource_load(`Test.10.mesh`)\nprint \"Using Test.08.mesh\"\nb10 = gfx_body_make(`Test.10.mesh`)\n" }, { "alpha_fraction": 0.655597448348999, "alphanum_fraction": 0.6625241637229919, "avg_line_length": 30.973941802978516, "blob_id": "48b92331b7249f9a8e0d4b40dc3e908b8a3a4f38", "content_id": "f787224b2f75049b8676135097b756fec0454ae2", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 9817, "license_type": "permissive", "max_line_length": 118, "num_lines": 307, "path": "/engine/gfx/gfx_instances.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <algorithm>\n\n#include \"../main.h\"\n\n#include \"gfx_internal.h\"\n#include \"gfx_material.h\"\n#include \"gfx_instances.h\"\n\nconst std::string GfxInstances::className = \"GfxInstances\";\n\nconst unsigned instance_data_floats = 13;\nconst unsigned instance_data_bytes = instance_data_floats*4;\n\n// One of these for each material in the original mesh.\nclass GfxInstances::Section : public Ogre::Renderable {\n\n GfxInstances *parent;\n GfxMaterial *mat;\n Ogre::MaterialPtr omat;\n Ogre::RenderOperation op;\n\n public:\n\n Section (GfxInstances *parent, GfxMaterial *mat, Ogre::SubMesh *sm)\n : parent(parent), mat(mat), queueID(0), queuePriority(0)\n {\n sm->_getRenderOperation(op, 0);\n op.vertexData = parent->sharedVertexData;\n setNumInstances(0);\n }\n\n void setNumInstances (unsigned v) { op.numberOfInstances = v; }\n\n // Ogre has already used the name setMaterial so be explicit for this one\n GfxMaterial *getGritMaterial (void) { return mat; }\n\n unsigned char queueID;\n unsigned short queuePriority;\n // Renderable stuff\n\n void setMaterial (const Ogre::MaterialPtr &m) { omat = m; }\n\n const Ogre::MaterialPtr& getMaterial (void) const { return omat; }\n void getRenderOperation (Ogre::RenderOperation& o) { o = op; }\n void getWorldTransforms (Ogre::Matrix4* xform) const\n { xform[0] = Ogre::Matrix4::IDENTITY; }\n Ogre::Real getSquaredViewDepth (const Ogre::Camera *) const { return 0; }\n const Ogre::LightList &getLights (void) const { return parent->queryLights(); }\n\n};\n\n\nGfxInstancesPtr GfxInstances::make (const std::string &mesh_name, const GfxNodePtr &par_)\n{ \n auto gdr = disk_resource_use<GfxMeshDiskResource>(mesh_name);\n if (gdr == nullptr) GRIT_EXCEPT(\"Resource is not a mesh: \\\"\" + mesh_name + \"\\\"\");\n return GfxInstancesPtr(new GfxInstances(gdr, par_));\n}\n\nGfxInstances::GfxInstances (const DiskResourcePtr<GfxMeshDiskResource> &gdr, const GfxNodePtr &par_)\n : GfxNode(par_),\n dirty(false),\n enabled(true),\n gdr(gdr),\n mBoundingBox(Ogre::AxisAlignedBox::BOX_INFINITE),\n mBoundingRadius(std::numeric_limits<float>::max())\n{ \n mesh = gdr->getOgreMeshPtr();\n\n node->attachObject(this);\n\n reinitialise();\n\n reserveSpace(0);\n} \n\nvoid GfxInstances::updateSections (void)\n{\n mesh->load();\n\n APP_ASSERT(mesh->sharedVertexData != NULL);\n sharedVertexData = mesh->sharedVertexData->clone(false);\n\n // add instancing declarations on to the end of it\n Ogre::VertexDeclaration &vdecl = *sharedVertexData->vertexDeclaration;\n unsigned vdecl_inst_sz = 0;\n vdecl_inst_sz += vdecl.addElement(1, vdecl_inst_sz, Ogre::VET_FLOAT3, Ogre::VES_TEXTURE_COORDINATES, 1).getSize();\n vdecl_inst_sz += vdecl.addElement(1, vdecl_inst_sz, Ogre::VET_FLOAT3, Ogre::VES_TEXTURE_COORDINATES, 2).getSize();\n vdecl_inst_sz += vdecl.addElement(1, vdecl_inst_sz, Ogre::VET_FLOAT3, Ogre::VES_TEXTURE_COORDINATES, 3).getSize();\n vdecl_inst_sz += vdecl.addElement(1, vdecl_inst_sz, Ogre::VET_FLOAT3, Ogre::VES_TEXTURE_COORDINATES, 4).getSize();\n vdecl_inst_sz += vdecl.addElement(1, vdecl_inst_sz, Ogre::VET_FLOAT1, Ogre::VES_TEXTURE_COORDINATES, 5).getSize();\n APP_ASSERT(vdecl_inst_sz == instance_data_bytes);\n\n numSections = mesh->getNumSubMeshes();\n sections = new Section*[numSections];\n\n for (unsigned i=0 ; i<numSections ; ++i) {\n Ogre::SubMesh *sm = mesh->getSubMesh(i);\n std::string matname = sm->getMaterialName();\n if (!gfx_material_has(matname)) {\n CERR << \"Mesh \\\"/\"<<mesh->getName()<<\"\\\" references non-existing material \"\n << \"\\\"\"<<matname<<\"\\\"\"<<std::endl;\n matname = \"/system/FallbackMaterial\";\n sm->setMaterialName(matname);\n }\n\n sections[i] = new Section(this, gfx_material_get(matname), sm);\n }\n\n}\n\nvoid GfxInstances::reinitialise (void)\n{\n updateSections();\n updateProperties();\n}\n\nvoid GfxInstances::reserveSpace (unsigned new_capacity)\n{\n new_capacity = indexes.reserve(new_capacity);\n\n instBufRaw.reserve(new_capacity * instance_data_floats);\n\n instBuf.setNull();\n if (new_capacity > 0) {\n instBuf = Ogre::HardwareBufferManager::getSingleton().createVertexBuffer(\n instance_data_bytes,\n new_capacity,\n Ogre::HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY);\n instBuf->setIsInstanceData(true);\n instBuf->setInstanceDataStepRate(1);\n dirty = true; // will be lazily copied from host\n }\n sharedVertexData->vertexBufferBinding->setBinding(1, instBuf);\n\n}\n\nunsigned GfxInstances::getTrianglesPerInstance (void)\n{\n unsigned total = 0;\n for (unsigned i=0 ; i<mesh->getNumSubMeshes() ; ++i) {\n total += mesh->getSubMesh(i)->indexData->indexCount/3;\n }\n return total;\n}\n\nunsigned GfxInstances::getBatches (void)\n{\n return mesh->getNumSubMeshes();\n}\n\nvoid GfxInstances::copyToGPU (void)\n{\n copyToGPU(0, indexes.size(), true);\n}\n\nvoid GfxInstances::copyToGPU (unsigned from, unsigned to, bool discard)\n{\n if (to - from == 0) return;\n unsigned offset = from * instance_data_bytes;\n unsigned len = (to - from) * instance_data_bytes;\n void *data = &instBufRaw[from * instance_data_floats];\n instBuf->writeData(offset, len, data, discard);\n}\n\n\nGfxInstances::~GfxInstances (void)\n{\n if (!dead) destroy();\n //unregisterMe();\n OGRE_DELETE sharedVertexData;\n delete [] sections;\n}\n\nvoid GfxInstances::destroy (void)\n{\n if (dead) THROW_DEAD(className);\n GfxNode::destroy();\n}\n\nunsigned GfxInstances::add (const Vector3 &pos, const Quaternion &q, float fade)\n{\n if (indexes.size() >= indexes.capacity()) reserveSpace(std::max(128u, unsigned(indexes.capacity() * 1.3)));\n unsigned sparse_index = indexes.newSparseIndex();\n instBufRaw.resize(instBufRaw.size() + instance_data_floats);\n for (unsigned i=0 ; i<numSections ; ++i) sections[i]->setNumInstances(indexes.size());\n update(sparse_index, pos, q, fade);\n return sparse_index;\n}\n\nvoid GfxInstances::update (unsigned sparse_index, const Vector3 &pos, const Quaternion &q, float fade)\n{\n indexes.sparseIndexValid(sparse_index);\n unsigned dense_index = indexes.denseIndex(sparse_index);\n\n float *base = &instBufRaw[dense_index * instance_data_floats];\n Ogre::Matrix3 rot;\n to_ogre(q).ToRotationMatrix(rot);\n float *rot_base = rot[0];\n for (int i=0 ; i<9 ; ++i) {\n base[i] = rot_base[i];\n }\n base[ 9] = pos.x;\n base[10] = pos.y;\n base[11] = pos.z;\n base[12] = fade;\n dirty = true;\n}\n\nvoid GfxInstances::del (unsigned sparse_index)\n{\n indexes.sparseIndexValid(sparse_index);\n unsigned dense_index = indexes.denseIndex(sparse_index);\n unsigned last = indexes.size()-1;\n indexes.delSparseIndex(sparse_index);\n\n if (dense_index != last) {\n // reorganise buffer to move last instance into the position of the one just removed\n for (unsigned i=0 ; i<instance_data_floats ; ++i) {\n instBufRaw[dense_index * instance_data_floats + i] = instBufRaw[last * instance_data_floats + i];\n }\n }\n\n\n instBufRaw.resize(instance_data_floats * last);\n for (unsigned i=0 ; i<numSections ; ++i) sections[i]->setNumInstances(last);\n\n dirty = true;\n}\n\n\n// Currently needs to be updated when these material properties change:\n// getSceneBlend\n// getStipple\nvoid GfxInstances::updateProperties (void)\n{\n GFX_MAT_SYNC;\n\n for (unsigned i=0 ; i<numSections ; ++i) {\n\n Section *s = sections[i];\n\n GfxMaterial *gfx_material = s->getGritMaterial();\n\n s->setMaterial(gfx_material->instancingMat);\n\n switch (gfx_material->getSceneBlend()) {\n case GFX_MATERIAL_OPAQUE:\n s->queueID = RQ_GBUFFER_OPAQUE;\n break;\n case GFX_MATERIAL_ALPHA:\n s->queueID = RQ_FORWARD_ALPHA;\n break;\n case GFX_MATERIAL_ALPHA_DEPTH:\n s->queueID = RQ_FORWARD_ALPHA_DEPTH;\n break;\n }\n }\n}\n\nvoid GfxInstances::visitRenderables(Ogre::Renderable::Visitor *visitor, bool debug)\n{\n (void) debug;\n for (unsigned i=0 ; i<numSections ; ++i)\n visitor->visit(sections[i], 0, false);\n}\n\nvoid GfxInstances::_updateRenderQueue(Ogre::RenderQueue *queue)\n{\n if (indexes.size() == 0) return;\n if (!enabled) return;\n if (dirty) {\n copyToGPU();\n dirty = false;\n }\n for (unsigned i=0 ; i<numSections ; ++i) {\n Section *s = sections[i];\n\n queue->addRenderable(s, s->queueID, s->queuePriority);\n }\n}\n\nstd::string GfxInstances::getMeshName (void) const\n{ \n return \"/\" + mesh->getName();\n}\n\n" }, { "alpha_fraction": 0.45210281014442444, "alphanum_fraction": 0.5794392228126526, "avg_line_length": 24.176469802856445, "blob_id": "d6ce2acb720a4793b467e6e5558c024d4d48a015", "content_id": "bfee374db1c60712f678688edfe38e55cc7d6298", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Lua", "length_bytes": 856, "license_type": "permissive", "max_line_length": 58, "num_lines": 34, "path": "/engine/tests/engine/dds/all_dds.lua", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "gfx_colour_grade(`neutral.lut.png`)\ngfx_option('POST_PROCESSING', false)\n\ngfx_hud_class_add(`Rect`, {\n})\n\nfunction rect(coord, fmt)\n obj = gfx_hud_object_add(`Rect`)\n obj.position = vec(128, 128) * (coord + vec(0.5, 0.5))\n obj.texture = `all_dds.` .. fmt .. \".dds\"\n obj.size = vec(128, 128)\nend\n\nrect(vec(0, 0), \"R5G6B5\")\nrect(vec(0, 1), \"R8G8B8\")\nrect(vec(0, 2), \"A8R8G8B8\")\nrect(vec(0, 3), \"A2R10G10B10\")\nrect(vec(1, 0), \"A1R5G5B5\")\nrect(vec(1, 1), \"R8\")\nrect(vec(1, 2), \"R16\")\nrect(vec(1, 3), \"G16R16\")\n-- rect(vec(2, 0), \"A8R8\")\nrect(vec(2, 1), \"A4R4\")\n--rect(vec(2, 2), \"A16R16\")\nrect(vec(2, 3), \"R3G3B2\")\nrect(vec(3, 0), \"A4R4G4B4\")\nrect(vec(3, 1), \"BC1\")\nrect(vec(3, 2), \"BC2\")\nrect(vec(3, 3), \"BC3\")\n--rect(vec(4, 0), \"BC4\")\n--rect(vec(4, 1), \"BC5\")\n\ngfx_render(0.1, vec(0, 0, 0), quat(1, 0, 0, 0))\ngfx_screenshot('output-all-dds.png')\n" }, { "alpha_fraction": 0.6737228631973267, "alphanum_fraction": 0.6798790097236633, "avg_line_length": 28.30063247680664, "blob_id": "687c095c4be7d0a108a943df1089bb3280da1433", "content_id": "da7ece5a12981badf8a93ff02f71060bfd12bc55", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 9259, "license_type": "permissive", "max_line_length": 93, "num_lines": 316, "path": "/engine/physics/physics_world.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <map>\n\n#include <centralised_log.h>\n#include \"../shared_ptr.h\"\n\nclass RigidBody;\n\n#ifndef physics_h\n#define physics_h\n\nenum PhysicsBoolOption {\n PHYSICS_AUTOUPDATE,\n\n PHYSICS_GIMPACT_ONE_WAY_MESH_HACK,\n PHYSICS_BUMPY_TRIANGLE_MESH_HACK,\n PHYSICS_USE_TRIANGLE_EDGE_INFO,\n PHYSICS_VERBOSE_CONTACTS,\n PHYSICS_VERBOSE_CASTS,\n PHYSICS_ERROR_CONTACTS,\n PHYSICS_ERROR_CASTS,\n PHYSICS_SOLVER_SPLIT_IMPULSE,\n PHYSICS_SOLVER_RANDOMISE_ORDER,\n PHYSICS_SOLVER_FRICTION_SEPARATE,\n PHYSICS_SOLVER_USE_WARM_STARTING,\n PHYSICS_SOLVER_CACHE_FRIENDLY,\n\n PHYSICS_DEBUG_WIREFRAME,\n PHYSICS_DEBUG_AABB,\n PHYSICS_DEBUG_FEATURES_TEXT,\n PHYSICS_DEBUG_CONTACT_POINTS,\n PHYSICS_DEBUG_CONSTRAINTS,\n PHYSICS_DEBUG_CONSTRAINTS_LIMITS,\n\n PHYSICS_DEBUG_NO_DEACTIVATION,\n PHYSICS_DEBUG_NO_HELP_TEXT,\n PHYSICS_DEBUG_DRAW_TEXT,\n PHYSICS_DEBUG_PROFILE_TIMINGS,\n PHYSICS_DEBUG_ENABLE_SAT_COMPARISON,\n PHYSICS_DEBUG_DISABLE_BULLET_LCP,\n PHYSICS_DEBUG_ENABLE_CCD,\n PHYSICS_DEBUG_FAST_WIREFRAME\n\n};\n\nenum PhysicsIntOption {\n PHYSICS_SOLVER_ITERATIONS\n};\n\nenum PhysicsFloatOption {\n PHYSICS_GRAVITY_X,\n PHYSICS_GRAVITY_Y,\n PHYSICS_GRAVITY_Z,\n PHYSICS_STEP_SIZE,\n PHYSICS_CONTACT_BREAKING_THRESHOLD,\n PHYSICS_DEACTIVATION_TIME,\n PHYSICS_SOLVER_DAMPING,\n PHYSICS_SOLVER_ERP,\n PHYSICS_SOLVER_ERP2,\n PHYSICS_SOLVER_SPLIT_IMPULSE_THRESHOLD,\n PHYSICS_SOLVER_LINEAR_SLOP,\n PHYSICS_SOLVER_WARM_STARTING_FACTOR\n};\n\nstd::string physics_option_to_string (PhysicsBoolOption o);\nstd::string physics_option_to_string (PhysicsIntOption o);\nstd::string physics_option_to_string (PhysicsFloatOption o);\n\n// set's t to either 0,1,2 and fills in the approriate argument\nvoid physics_option_from_string (const std::string &s,\n int &t,\n PhysicsBoolOption &o0,\n PhysicsIntOption &o1,\n PhysicsFloatOption &o2);\n\nvoid physics_option (PhysicsBoolOption o, bool v);\nbool physics_option (PhysicsBoolOption o);\nvoid physics_option (PhysicsIntOption o, int v);\nint physics_option (PhysicsIntOption o);\nvoid physics_option (PhysicsFloatOption o, float v);\nfloat physics_option (PhysicsFloatOption o);\n\nvoid physics_option_reset (void);\n\n\n#include <btBulletDynamicsCommon.h>\n\nextern \"C\" {\n #include <lua.h>\n #include <lauxlib.h>\n #include <lualib.h>\n}\n\n#include <math_util.h>\n\n#include \"tcol_parser.h\"\n#include \"collision_mesh.h\"\n\n#include \"../grit_object.h\"\n\n#include \"../lua_ptr.h\"\n\n#include \"physical_material.h\"\n\n\n// a class that extends a bullet class\nclass DynamicsWorld;\n\nvoid physics_update (lua_State *L);\n\n// to be extended by lua wrapper or whatever\nclass SweepCallback {\n public:\n virtual void result (RigidBody &body, float d, const Vector3 &normal, int m) = 0;\n};\n\nvoid physics_ray (const Vector3 &start,\n const Vector3 &end,\n SweepCallback &rcb);\n\nvoid physics_sweep_sphere (const Vector3 &start, const Vector3 &end,\n SweepCallback &scb, float radius);\n\nvoid physics_sweep_cylinder (const Vector3 &start, const Quaternion &startq,\n const Vector3 &end,\n SweepCallback &scb, float radius, float height);\n\n\nvoid physics_sweep_box (const Vector3 &start, const Quaternion &startq,\n const Vector3 &end,\n SweepCallback &scb, const Vector3 &size);\n\nvoid physics_sweep_col_mesh (const Vector3 &startp,\n const Quaternion &startq,\n const Vector3 &endp,\n const Quaternion &endq,\n SweepCallback &scb,\n const CollisionMesh *col_mesh);\n\nclass TestCallback {\n public:\n virtual void result (RigidBody *body, const Vector3 &pos, const Vector3 &wpos,\n const Vector3 &normal, float penetration, int m) = 0;\n};\n\nvoid physics_test (const CollisionMesh *col_mesh, const Vector3 &pos, const Quaternion &quat,\n bool dyn_only, TestCallback &cb);\n\nvoid physics_test_sphere (float rad, const Vector3 &pos, bool dyn_only, TestCallback &cb);\n\nvoid physics_draw (void);\n\nvoid physics_update_graphics (lua_State *L, float extrapolate);\n\n\nclass RigidBody : public btMotionState, public CollisionMesh::ReloadWatcher {\n\n friend class CollisionMesh;\n\n public:\n\n RigidBody (const std::string &col_mesh,\n const Vector3 &pos,\n const Quaternion &quat);\n\n\n ~RigidBody (void);\n\n void destroy (lua_State *L);\n\n bool destroyed (void) const { return body==NULL; }\n\n void getWorldTransform (btTransform& into_here) const;\n\n void setWorldTransform (const btTransform& current_xform);\n\n Vector3 getPosition (void) const;\n\n Quaternion getOrientation (void) const;\n\n void setPosition (const Vector3 &v);\n\n void setOrientation (const Quaternion &q);\n\n void stepCallback (lua_State *L, float step_size);\n void collisionCallback (lua_State *L, int lifetime, float impulse,\n RigidBody *other,\n int m, int m2, float penetration,\n const Vector3 &pos, const Vector3 &pos2, const Vector3 &wnormal);\n void stabiliseCallback (lua_State *L, float elapsed);\n void updateGraphicsCallback (lua_State *L, float extrapolate);\n\n void activate (void);\n void deactivate (void);\n\n void force (const Vector3 &force);\n void force (const Vector3 &force,\n const Vector3 &rel_pos);\n void impulse (const Vector3 &impulse);\n void impulse (const Vector3 &impulse,\n const Vector3 &rel_pos);\n void torque (const Vector3 &torque);\n void torqueImpulse (const Vector3 &torque);\n\n float getContactProcessingThreshold (void) const;\n void setContactProcessingThreshold (float v);\n\n float getLinearDamping (void) const;\n void setLinearDamping (float r);\n\n float getAngularDamping (void) const;\n void setAngularDamping (float r);\n\n float getLinearSleepThreshold (void) const;\n void setLinearSleepThreshold (float r);\n\n float getAngularSleepThreshold (void) const;\n void setAngularSleepThreshold (float r);\n\n Vector3 getLinearVelocity (void) const;\n void setLinearVelocity (const Vector3 &v);\n\n Vector3 getAngularVelocity (void) const;\n void setAngularVelocity (const Vector3 &v);\n\n Vector3 getLocalVelocity (const Vector3 &) const;\n\n float getMass (void) const;\n void setMass (float r);\n\n Vector3 getInertia (void) const;\n void setInertia (const Vector3 &v);\n\n void incRefCount (void);\n void decRefCount (lua_State *L);\n\n CollisionMesh * colMesh;\n\n GritObjectPtr owner;\n\n void notifyReloaded (const DiskResource *r)\n {\n (void) r;\n removeFromWorld();\n addToWorld();\n }\n\n void addToWorld (void);\n void removeFromWorld (void);\n\n void setElementEnabled (int i, bool v);\n bool getElementEnabled (int i);\n\n Vector3 getElementPositionMaster (int i);\n void setElementPositionOffset (int i, const Vector3 &v);\n Vector3 getElementPositionOffset (int i);\n Quaternion getElementOrientationMaster (int i);\n void setElementOrientationOffset (int i, const Quaternion &q);\n Quaternion getElementOrientationOffset (int i);\n int getNumElements (void) { return localChanges.size(); };\n\n bool getGhost (void) const { return ghost; }\n void setGhost (bool v) { ghost = v; updateCollisionFlags(); }\n\n protected:\n\n float mass;\n bool ghost;\n\n btTransform lastXform;\n\n public:\n LuaPtr updateCallbackPtr;\n LuaPtr stepCallbackPtr;\n LuaPtr collisionCallbackPtr;\n LuaPtr stabiliseCallbackPtr;\n\n protected:\n btRigidBody *body;\n btCompoundShape *shape;\n\n unsigned refCount;\n\n struct CompElement {\n bool enabled;\n btTransform offset;\n };\n btAlignedObjectArray<CompElement> localChanges; // to the master compound\n\n void updateCollisionFlags (void);\n};\n\nvoid physics_init (void);\nvoid physics_shutdown (void);\n\n#endif\n" }, { "alpha_fraction": 0.5697279572486877, "alphanum_fraction": 0.5780355334281921, "avg_line_length": 25.74932289123535, "blob_id": "d1f28eb75ccbb6f056749e6c6405700cbc5d6e90", "content_id": "236c3cc0c329e6e7c5a6653d39dc9fbb06a397b0", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 19741, "license_type": "permissive", "max_line_length": 90, "num_lines": 738, "path": "/engine/lua_wrappers_gritobj.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include \"grit_class.h\"\n#include \"grit_object.h\"\n#include \"lua_wrappers_core.h\"\n#include \"lua_wrappers_gritobj.h\"\n#include \"lua_wrappers_primitives.h\"\n#include \"main.h\"\n#include \"path_util.h\"\n\n\n// GRIT CLASS ============================================================= {{{\n\nvoid push_gritcls (lua_State *L, GritClass *self)\n{\n if (self == NULL) {\n lua_pushnil(L);\n } else {\n self->acquire();\n push(L, self, GRITCLS_TAG);\n }\n}\n\nstatic int gritcls_gc (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n GET_UD_MACRO_OFFSET(GritClass, self, 1, GRITCLS_TAG, 0);\n self->release(L);\n return 0;\nTRY_END\n}\n\nTOSTRING_GETNAME_MACRO(gritcls, GritClass, .name, GRITCLS_TAG)\n\n\n\nstatic int gritcls_index (lua_State *L)\n{\nTRY_START\n check_args(L, 2);\n GET_UD_MACRO(GritClass, self, 1, GRITCLS_TAG);\n std::string key = check_string(L, 2);\n if (key == \"name\") {\n lua_pushstring(L, self.name.c_str());\n } else if (key == \"parent\") {\n self.pushParent(L);\n } else if (key == \"dump\") {\n self.dump(L);\n } else {\n self.get(L, key);\n }\n return 1;\nTRY_END\n}\n\nstatic int gritcls_newindex (lua_State *L)\n{\nTRY_START\n check_args(L, 3);\n GET_UD_MACRO(GritClass, self, 1, GRITCLS_TAG);\n std::string key = check_string(L, 2);\n\n if (key == \"name\") {\n my_lua_error(L, \"Not a writeable GritClass member: \" + key);\n } else if (key == \"parent\") {\n self.setParent(L);\n } else {\n self.set(L, key);\n }\n\n return 0;\nTRY_END\n}\n\nEQ_PTR_MACRO(GritClass, gritcls, GRITCLS_TAG)\n\nMT_MACRO_NEWINDEX(gritcls);\n\n//}}}\n\n\n\n// GRIT OBJECT ============================================================= {{{\n\nvoid push_gritobj (lua_State *L, const GritObjectPtr &self)\n{\n if (self.isNull()) {\n lua_pushnil(L);\n } else {\n push(L, new GritObjectPtr(self), GRITOBJ_TAG);\n }\n}\n\nstatic int gritobj_gc (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n GET_UD_MACRO_OFFSET(GritObjectPtr, self, 1, GRITOBJ_TAG, 0);\n delete self;\n return 0;\nTRY_END\n}\n\nstatic int gritobj_destroy (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n GET_UD_MACRO(GritObjectPtr, self, 1, GRITOBJ_TAG);\n object_del(L, self);\n return 0;\nTRY_END\n}\n\nstatic int gritobj_activate (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n GET_UD_MACRO(GritObjectPtr, self, 1, GRITOBJ_TAG);\n self->activate(L, self);\n return 0;\nTRY_END\n}\n\nstatic int gritobj_add_disk_resource (lua_State *L)\n{\nTRY_START\n check_args(L, 2);\n GET_UD_MACRO(GritObjectPtr, self, 1, GRITOBJ_TAG);\n std::string name = check_path(L, 2);\n self->addDiskResource(name);\n return 0;\nTRY_END\n}\n\nstatic int gritobj_reload_disk_resource (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n GET_UD_MACRO(GritObjectPtr, self, 1, GRITOBJ_TAG);\n self->reloadDiskResources();\n return 0;\nTRY_END\n}\n\n/*\nstatic int gritobj_get_advance_prepare_hints (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n GET_UD_MACRO(GritObjectPtr, self, 1, GRITOBJ_TAG);\n const GritObject::StringPairs &hints = self->getAdvanceHints();\n typedef GritObject::StringPairs::const_iterator I;\n int counter = 0;\n for (I i=hints.begin(), i_=hints.end() ; i != i_ ; ++i) {\n const std::string &type = i->first;\n const std::string &name = i->second;\n lua_pushstring(L, type.c_str());\n lua_pushstring(L, name.c_str());\n counter += 2;\n }\n return counter;\nTRY_END\n}\n*/\n\nstatic int gritobj_deactivate (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n GET_UD_MACRO(GritObjectPtr, self, 1, GRITOBJ_TAG);\n self->deactivate(L, self);\n return 0;\nTRY_END\n}\n\n\n\nTOSTRING_GETNAME_MACRO(gritobj, GritObjectPtr, ->name, GRITOBJ_TAG)\n\n\n\nstatic int gritobj_index (lua_State *L)\n{\nTRY_START\n check_args(L, 2);\n GET_UD_MACRO(GritObjectPtr, self, 1, GRITOBJ_TAG);\n std::string key = check_string(L, 2);\n if (key == \"destroy\") {\n push_cfunction(L, gritobj_destroy);\n } else if (key == \"activated\") {\n lua_pushboolean(L, self->isActivated());\n } else if (key == \"near\") {\n push_gritobj(L, self->getNearObj());\n } else if (key == \"far\") {\n push_gritobj(L, self->getFarObj());\n } else if (key == \"fade\") {\n lua_pushnumber(L, self->getFade());\n } else if (key == \"pos\") {\n push_v3(L, self->getPos());\n } else if (key == \"renderingDistance\") {\n lua_pushnumber(L, self->getR());\n } else if (key == \"deactivate\") {\n push_cfunction(L, gritobj_deactivate);\n } else if (key == \"activate\") {\n push_cfunction(L, gritobj_activate);\n } else if (key == \"instance\") {\n self->pushLuaTable(L);\n } else if (key == \"addDiskResource\") {\n push_cfunction(L, gritobj_add_disk_resource);\n } else if (key == \"reloadDiskResources\") {\n push_cfunction(L, gritobj_reload_disk_resource);\n/*\n } else if (key == \"getAdvancePrepareHints\") {\n push_cfunction(L, gritobj_get_advance_prepare_hints);\n*/\n } else if (key == \"destroyed\") {\n lua_pushboolean(L, self->getClass() == NULL);\n } else if (key == \"class\") {\n GritClass *c = self->getClass();\n if (c == NULL) my_lua_error(L, \"GritObject destroyed\");\n push_gritcls(L, c);\n } else if (key == \"className\") {\n GritClass *c = self->getClass();\n if (c == NULL) my_lua_error(L, \"GritObject destroyed\");\n lua_pushstring(L, c->name.c_str());\n } else if (key == \"name\") {\n lua_pushstring(L, self->name.c_str());\n } else if (key == \"needsFrameCallbacks\") {\n lua_pushboolean(L, self->getNeedsFrameCallbacks());\n } else if (key == \"needsStepCallbacks\") {\n lua_pushboolean(L, self->getNeedsStepCallbacks());\n } else if (key == \"dump\") {\n self->userValues.dump(L);\n } else {\n self->getField(L, key);\n }\n return 1;\nTRY_END\n}\n\nstatic int gritobj_newindex (lua_State *L)\n{\nTRY_START\n check_args(L, 3);\n GET_UD_MACRO(GritObjectPtr, self, 1, GRITOBJ_TAG);\n std::string key = check_string(L, 2);\n\n if (key == \"destroy\") {\n my_lua_error(L, \"Not a writeable GritObject member: \" + key);\n } else if (key == \"near\") {\n if (lua_isnil(L, 3)) {\n self->setNearObj(self, GritObjectPtr());\n } else {\n GET_UD_MACRO(GritObjectPtr, v, 3, GRITOBJ_TAG);\n self->setNearObj(self, v);\n }\n } else if (key == \"far\") {\n if (lua_isnil(L, 3)) {\n self->setNearObj(self, GritObjectPtr());\n } else {\n GET_UD_MACRO(GritObjectPtr, v, 3, GRITOBJ_TAG);\n self->setFarObj(self, v);\n }\n } else if (key == \"fade\") {\n my_lua_error(L, \"Not a writeable GritObject member: \" + key);\n } else if (key == \"pos\") {\n self->updateSphere(check_v3(L, 3));\n } else if (key == \"renderingDistance\") {\n self->updateSphere(check_float(L, 3));\n } else if (key == \"getSphere\") {\n my_lua_error(L, \"Not a writeable GritObject member: \" + key);\n } else if (key == \"activated\") {\n my_lua_error(L, \"Not a writeable GritObject member: \" + key);\n } else if (key == \"deactivate\") {\n my_lua_error(L, \"Not a writeable GritObject member: \" + key);\n } else if (key == \"activate\") {\n my_lua_error(L, \"Not a writeable GritObject member: \" + key);\n } else if (key == \"instance\") {\n my_lua_error(L, \"Not a writeable GritObject member: \" + key);\n } else if (key == \"hintAdvancePrepare\") {\n my_lua_error(L, \"Not a writeable GritObject member: \" + key);\n } else if (key == \"getAdvancePrepareHints\") {\n my_lua_error(L, \"Not a writeable GritObject member: \" + key);\n } else if (key == \"destroyed\") {\n my_lua_error(L, \"Not a writeable GritObject member: \" + key);\n } else if (key == \"class\") {\n my_lua_error(L, \"Not a writeable GritObject member: \" + key);\n } else if (key == \"className\") {\n my_lua_error(L, \"Not a writeable GritObject member: \" + key);\n } else if (key == \"name\") {\n my_lua_error(L, \"Not a writeable GritObject member: \" + key);\n } else if (key == \"needsFrameCallbacks\") {\n self->setNeedsFrameCallbacks(self, check_bool(L, 3));\n } else if (key == \"needsStepCallbacks\") {\n self->setNeedsStepCallbacks(self, check_bool(L, 3));\n } else {\n GritClass *c = self->getClass();\n if (c == NULL) my_lua_error(L, \"GritObject destroyed\");\n const char *err = self->userValues.luaSet(L);\n if (err) my_lua_error(L, err);\n }\n\n return 0;\nTRY_END\n}\n\nEQ_MACRO(GritObjectPtr, gritobj, GRITOBJ_TAG)\n\nMT_MACRO_NEWINDEX(gritobj);\n\n//}}}\n\n\n\n// STREAMER ================================================================ {{{\n\nstatic int global_streamer_centre (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n Vector3 pos = check_v3(L, 1);\n streamer_centre(L, pos, false);\n return 0;\nTRY_END\n}\n\nstatic int global_streamer_centre_full (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n Vector3 pos = check_v3(L, 1);\n streamer_centre(L, pos, true);\n return 0;\nTRY_END\n}\n\nstatic int global_class_add (lua_State *L)\n{\nTRY_START\n check_args(L, 3);\n std::string name = check_path(L, 1);\n if (!lua_istable(L, 2))\n my_lua_error(L, \"Second parameter should be a table\");\n if (!lua_istable(L, 3))\n my_lua_error(L, \"Third parameter should be a table\");\n class_add(L, name);\n return 1;\nTRY_END\n}\n\nstatic int global_class_get (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n std::string name = check_path(L, 1);\n push_gritcls(L, class_get(name));\n return 1;\nTRY_END\n}\n\nstatic int global_class_has (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n std::string name = check_path(L, 1);\n lua_pushboolean(L, class_has(name));\n return 1;\nTRY_END\n}\n\nstatic int global_class_del (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n std::string name = check_path(L, 1);\n class_del(L, class_get(name));\n return 0;\nTRY_END\n}\n\nstatic int global_class_all_del (lua_State *L)\n{\nTRY_START\n check_args(L, 0);\n class_all_del(L);\n return 0;\nTRY_END\n}\n\nstatic int global_class_count (lua_State *L)\n{\nTRY_START\n check_args(L, 0);\n lua_pushnumber(L, class_count());\n return 1;\nTRY_END\n}\n\nstatic int global_class_all (lua_State *L)\n{\nTRY_START\n check_args(L, 0);\n lua_newtable(L);\n unsigned int c = 0;\n GritClassMap::iterator i, i_;\n for (class_all(i, i_) ; i != i_ ; ++i) {\n push_gritcls(L, i->second);\n lua_rawseti(L, -2, c + 1);\n c++; \n } \n return 1;\nTRY_END\n}\n\n\nstatic int global_object_add (lua_State *L)\n{\nTRY_START\n if (lua_gettop(L) == 2) lua_newtable(L);\n check_args(L, 3);\n std::string className = check_path(L, 1);\n Vector3 spawnPos = check_v3(L, 2);\n int table_index = lua_gettop(L);\n if (!lua_istable(L, table_index)) my_lua_error(L, \"Last parameter should be a table\");\n lua_getfield(L, table_index, \"name\");\n std::string name;\n if (lua_isnil(L, -1)) {\n name = \"\";\n } else {\n if (lua_type(L, -1) != LUA_TSTRING) my_lua_error(L, \"Name wasn't a string!\");\n name = lua_tostring(L, -1);\n }\n lua_pop(L, 1);\n\n GritObjectPtr o = object_add(L, name, class_get(className));\n o->userValues.set(\"spawnPos\", spawnPos);\n lua_getfield(L, table_index, \"renderingDistance\");\n // Use renderingDistance from table if provided\n if (lua_isnil(L, -1)) {\n lua_pop(L, 1);\n // Otherwise, use class.\n o->getClass()->get(L, \"renderingDistance\");\n if (lua_isnil(L, -1)) {\n object_del(L, o);\n my_lua_error(L, \"no renderingDistance in class \\\"\"\n + className + \"\\\"\");\n }\n if (lua_type(L, -1) != LUA_TNUMBER) {\n object_del(L, o);\n my_lua_error(L, \"renderingDistance not a number in class \\\"\"\n + className + \"\\\"\");\n }\n } else {\n if (lua_type(L, -1) != LUA_TNUMBER) {\n object_del(L, o);\n my_lua_error(L, \"renderingDistance not a number in object \\\"\"\n + name + \"\\\"\");\n }\n }\n float r = lua_tonumber(L, -1);\n o->updateSphere(spawnPos, r);\n lua_pop(L, 1);\n\n // TODO move near and far into the loop below ('name' must remain above)\n lua_getfield(L, table_index, \"near\");\n if (!lua_isnil(L, -1)) {\n if (is_userdata(L, -1, GRITOBJ_TAG)) {\n GET_UD_MACRO(GritObjectPtr, the_near, -1, GRITOBJ_TAG);\n o->setNearObj(o, the_near);\n } else {\n my_lua_error(L, \"Field 'near' must be a grit object.\");\n }\n }\n lua_pop(L, 1);\n\n lua_getfield(L, table_index, \"far\");\n if (!lua_isnil(L, -1)) {\n if (is_userdata(L, -1, GRITOBJ_TAG)) {\n GET_UD_MACRO(GritObjectPtr, the_far, -1, GRITOBJ_TAG);\n o->setFarObj(o, the_far);\n } else {\n my_lua_error(L, \"Field 'far' must be a grit object.\");\n }\n }\n lua_pop(L, 1);\n\n // scan through table adding lua data to o\n for (lua_pushnil(L) ; lua_next(L, table_index) != 0 ; lua_pop(L, 1)) {\n if (lua_type(L, -2) != LUA_TSTRING) {\n object_del(L, o);\n my_lua_error(L, \"user value key was not a string\");\n }\n std::string key = check_string(L, -2);\n // the name is held in the object anyway\n if (key == \"name\") continue;\n if (key == \"near\") continue;\n if (key == \"far\") continue;\n if (key == \"renderingDistance\") continue;\n const char *err = o->userValues.luaSet(L);\n if (err) {\n object_del(L, o);\n my_lua_error(L, err);\n }\n }\n o->init(L, o);\n push_gritobj(L, o);\n return 1;\nTRY_END\n}\n\nstatic int global_object_del (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n GET_UD_MACRO(GritObjectPtr, self, 1, GRITOBJ_TAG);\n object_del(L, self);\n return 0;\nTRY_END\n}\n\n\n\nstatic int global_object_get (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n std::string name = check_string(L, 1);\n GritObjectPtr o = object_get(name);\n if (o.isNull()) {\n lua_pushnil(L);\n } else {\n push_gritobj(L, o);\n }\n return 1;\nTRY_END\n}\n\nstatic int global_object_has (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n std::string name = check_string(L, 1);\n lua_pushboolean(L, object_has(name));\n return 1;\nTRY_END\n}\n\n\n\nstatic int global_object_all (lua_State *L)\n{\nTRY_START\n check_args(L, 0);\n lua_newtable(L);\n unsigned int c = 0;\n GObjMap::iterator i, i_;\n for (object_all(i, i_) ; i != i_ ; ++i) {\n const GritObjectPtr &o = i->second;\n push_gritobj(L, o);\n lua_rawseti(L, -2, c + 1);\n c++; \n } \n return 1;\nTRY_END\n}\n\nstatic int global_object_all_del (lua_State *L)\n{\nTRY_START\n check_args(L, 0);\n object_all_del(L);\n return 0;\nTRY_END\n}\n\nstatic int global_object_count (lua_State *L)\n{\nTRY_START\n check_args(L, 0);\n lua_pushnumber(L, object_count());\n return 1;\nTRY_END\n}\n\n\nstatic int global_object_all_deactivate (lua_State *L)\n{\nTRY_START\n check_args(L, 0);\n GObjMap::iterator i, i_;\n for (object_all(i, i_) ; i != i_ ; ++i) {\n const GritObjectPtr &o = i->second;\n o->deactivate(L, o);\n } \n return 0;\nTRY_END\n}\n\nstatic int global_object_all_activated (lua_State *L)\n{\nTRY_START\n check_args(L, 0);\n lua_newtable(L);\n unsigned int c = 0;\n GObjPtrs::iterator i, i_;\n for (streamer_object_activated(i, i_) ; i != i_ ; ++i) {\n const GritObjectPtr &o = *i;\n push_gritobj(L, o);\n lua_rawseti(L, -2, c + 1);\n c++; \n } \n return 1;\nTRY_END\n}\n\nstatic int global_object_count_activated (lua_State *L)\n{\nTRY_START\n check_args(L, 0);\n lua_pushnumber(L, streamer_object_activated_count());\n return 1;\nTRY_END\n}\n\nstatic int global_object_all_of_class (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n std::string cls = check_path(L, 1);\n lua_newtable(L);\n unsigned int c = 0;\n GObjMap::iterator i, i_;\n for (object_all(i, i_) ; i != i_ ; ++i) {\n const GritObjectPtr &o = i->second;\n GritClass *oc = o->getClass();\n if (oc == NULL) continue; // object destroyed\n if (oc->name != cls) continue; // wrong class\n push_gritobj(L, o);\n lua_rawseti(L, -2, c + 1);\n c++; \n } \n return 1;\nTRY_END\n}\n\nstatic int global_object_count_of_class (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n std::string cls = check_path(L, 1);\n unsigned counter = 0;\n GObjMap::iterator i, i_;\n for (object_all(i, i_) ; i != i_ ; ++i) {\n const GritObjectPtr &o = i->second;\n GritClass *oc = o->getClass();\n if (oc == NULL) continue; // object destroyed\n if (oc->name != cls) continue; // wrong class\n counter++;\n } \n return 1;\nTRY_END\n}\n\nstatic int global_object_do_frame_callbacks (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n float elapsed = check_float(L, 1);\n object_do_frame_callbacks(L, elapsed);\n return 0;\nTRY_END\n}\n\nstatic int global_object_do_step_callbacks (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n float elapsed = check_float(L, 1);\n object_do_step_callbacks(L, elapsed);\n return 0;\nTRY_END\n}\n\n\n\nstatic const luaL_reg global[] = {\n {\"streamer_centre\", global_streamer_centre},\n {\"streamer_centre_full\", global_streamer_centre_full},\n {\"class_add\", global_class_add},\n {\"class_del\", global_class_del},\n {\"class_all_del\", global_class_all_del},\n {\"class_get\", global_class_get},\n {\"class_has\", global_class_has},\n {\"class_all\", global_class_all},\n {\"class_count\", global_class_count},\n {\"object_add\", global_object_add},\n {\"object_del\", global_object_del},\n {\"object_all_del\", global_object_all_del},\n {\"object_get\", global_object_get},\n {\"object_has\", global_object_has},\n {\"object_all\", global_object_all},\n {\"object_count\", global_object_count},\n {\"object_all_activated\", global_object_all_activated},\n {\"object_count_activated\", global_object_count_activated},\n {\"object_all_of_class\", global_object_all_of_class},\n {\"object_count_of_class\", global_object_count_of_class},\n {\"object_all_deactivate\", global_object_all_deactivate},\n {\"object_do_frame_callbacks\", global_object_do_frame_callbacks},\n {\"object_do_step_callbacks\", global_object_do_step_callbacks},\n {NULL, NULL}\n};\n\nvoid gritobj_lua_init (lua_State *L)\n{\n ADD_MT_MACRO(gritcls, GRITCLS_TAG);\n ADD_MT_MACRO(gritobj, GRITOBJ_TAG);\n register_lua_globals(L, global);\n}\n" }, { "alpha_fraction": 0.5253782868385315, "alphanum_fraction": 0.5378259420394897, "avg_line_length": 26.408823013305664, "blob_id": "7d2855922391132a67826e4d70b9f14316e1a3cd", "content_id": "3cd7fd93eb0cf9ecf14be55a35450cec18095e80", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 9319, "license_type": "permissive", "max_line_length": 83, "num_lines": 340, "path": "/engine/lua_wrappers_primitives.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <algorithm>\n\n#include \"lua_wrappers_primitives.h\"\n#include \"math_util.h\"\n\n\n// PLOT ==================================================================== {{{\n\nint plot_make (lua_State *L)\n{\nTRY_START\n Plot *self = new Plot();\n check_args(L, 1);\n int table = lua_gettop(L);\n if (!lua_istable(L, table))\n my_lua_error(L, \"Parameter should be a table\");\n for (lua_pushnil(L) ; lua_next(L, table) != 0 ; lua_pop(L, 1)) {\n // the name is held in the object anyway\n float k = check_float(L, -2);\n float v = check_float(L, -1);\n self->addPoint(k, v);\n }\n self->commit();\n push(L, self, PLOT_TAG);\n return 1;\nTRY_END\n}\n\nTOSTRING_ADDR_MACRO(plot, Plot, PLOT_TAG)\n\nGC_MACRO(Plot, plot, PLOT_TAG)\n\nstatic int plot_index(lua_State *L)\n{\nTRY_START\n typedef Plot::Map Map;\n typedef Plot::MI MI;\n check_args(L, 2);\n GET_UD_MACRO(Plot, self, 1, PLOT_TAG);\n if (lua_type(L, 2) == LUA_TNUMBER) {\n float k = check_float(L, 2);\n lua_pushnumber(L, self[k]);\n } else {\n std::string key = luaL_checkstring(L, 2);\n if (key == \"minX\") {\n lua_pushnumber(L, self.minX());\n } else if (key == \"maxX\") {\n lua_pushnumber(L, self.maxX());\n } else if (key == \"points\") {\n Map data = self.getPoints();\n lua_createtable(L, data.size(), 0);\n for (MI i=data.begin(), i_=data.end() ; i != i_ ; ++i) {\n lua_pushnumber(L, i->first);\n lua_pushnumber(L, i->second);\n lua_settable(L, -3);\n }\n } else if (key == \"tangents\") {\n Map data = self.getTangents();\n lua_createtable(L, data.size(), 0);\n for (MI i=data.begin(), i_=data.end() ; i != i_ ; ++i) {\n lua_pushnumber(L, i->first);\n lua_pushnumber(L, i->second);\n lua_settable(L, -3);\n }\n } else {\n my_lua_error(L, \"Not a readable Plot member: \" + key);\n }\n }\n return 1;\nTRY_END\n}\n\nstatic int plot_newindex(lua_State *L)\n{\nTRY_START\n check_args(L, 3);\n GET_UD_MACRO(Plot, self, 1, PLOT_TAG);\n (void) self;\n std::string key = luaL_checkstring(L, 2);\n if (false) {\n } else {\n my_lua_error(L, \"Not a writeable Plot member: \" + key);\n }\n return 0;\nTRY_END\n}\n\nEQ_PTR_MACRO(Plot, plot, PLOT_TAG)\n\nMT_MACRO_NEWINDEX(plot);\n\n// }}}\n\n\n// PLOT_V3 ==================================================================== {{{\n\nint plot_v3_make (lua_State *L)\n{\nTRY_START\n PlotV3 *self = new PlotV3();\n check_args(L, 1);\n int table = lua_gettop(L);\n if (!lua_istable(L, table))\n my_lua_error(L, \"Parameter should be a table\");\n for (lua_pushnil(L) ; lua_next(L, table) != 0 ; lua_pop(L, 1)) {\n // the name is held in the object anyway\n float k = check_float(L, -2);\n Vector3 v = check_v3(L, -1);\n self->addPoint(k, v);\n }\n self->commit();\n push(L, self, PLOT_V3_TAG);\n return 1;\nTRY_END\n}\n\nTOSTRING_ADDR_MACRO(plot_v3, PlotV3, PLOT_V3_TAG)\n\nGC_MACRO(PlotV3, plot_v3, PLOT_V3_TAG)\n\nstatic int plot_v3_index(lua_State *L)\n{\nTRY_START\n typedef PlotV3::Map Map;\n typedef PlotV3::MI MI;\n check_args(L, 2);\n GET_UD_MACRO(PlotV3, self, 1, PLOT_V3_TAG);\n if (lua_type(L, 2) == LUA_TNUMBER) {\n float k = check_float(L, 2);\n push_v3(L, self[k]);\n } else {\n std::string key = luaL_checkstring(L, 2);\n if (key == \"minX\") {\n lua_pushnumber(L, self.minX());\n } else if (key == \"maxX\") {\n lua_pushnumber(L, self.maxX());\n } else if (key == \"points\") {\n Map data = self.getPoints();\n lua_createtable(L, data.size(), 0);\n for (MI i=data.begin(), i_=data.end() ; i != i_ ; ++i) {\n lua_pushnumber(L, i->first);\n push_v3(L, i->second);\n lua_settable(L, -3);\n }\n } else if (key == \"tangents\") {\n Map data = self.getTangents();\n lua_createtable(L, data.size(), 0);\n for (MI i=data.begin(), i_=data.end() ; i != i_ ; ++i) {\n lua_pushnumber(L, i->first);\n push_v3(L, i->second);\n lua_settable(L, -3);\n }\n } else {\n my_lua_error(L, \"Not a readable PlotV3 member: \" + key);\n }\n }\n return 1;\nTRY_END\n}\n\nstatic int plot_v3_newindex(lua_State *L)\n{\nTRY_START\n check_args(L, 3);\n GET_UD_MACRO(PlotV3, self, 1, PLOT_V3_TAG);\n (void) self;\n std::string key = luaL_checkstring(L, 2);\n if (false) {\n } else {\n my_lua_error(L, \"Not a writeable PlotV3 member: \" + key);\n }\n return 0;\nTRY_END\n}\n\nEQ_PTR_MACRO(PlotV3, plot_v3, PLOT_V3_TAG)\n\nMT_MACRO_NEWINDEX(plot_v3);\n\n// }}}\n\n\n// STRINGDB ================================================================ {{{\n\ntypedef std::vector<std::string> StringDB;\n\n\nint stringdb_make (lua_State *L)\n{\nTRY_START\n StringDB self;\n if (lua_gettop(L) == 1) {\n int table = lua_gettop(L);\n if (!lua_istable(L, table))\n my_lua_error(L, \"Parameter should be a table\");\n for (lua_pushnil(L) ; lua_next(L, table) != 0 ; lua_pop(L, 1)) {\n // the name is held in the object anyway\n std::string str = luaL_checkstring(L, -1);\n self.push_back(str);\n }\n } else {\n check_args(L, 0);\n }\n push(L, new StringDB(self), STRINGDB_TAG);\n return 1;\nTRY_END\n}\n\nstd::ostream &operator<<(std::ostream &o, StringDB &db)\n{\n o << \"{\";\n for (size_t i=0 ; i<db.size() ; ++i) {\n if (i>0) o << \", \";\n o << db[i];\n }\n o << \"}\";\n return o;\n}\n \n\n\nstatic int stringdb_add (lua_State *L)\n{\nTRY_START\n check_args(L, 2);\n GET_UD_MACRO(StringDB, self, 1, STRINGDB_TAG);\n self.push_back(luaL_checkstring(L, 2));\n return 0;\nTRY_END\n}\n\n\nstatic int stringdb_clear (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n GET_UD_MACRO(StringDB, self, 1, STRINGDB_TAG);\n self.clear();\n return 0;\nTRY_END\n}\n\n\nTOSTRING_MACRO(stringdb, StringDB, STRINGDB_TAG)\n\nGC_MACRO(StringDB, stringdb, STRINGDB_TAG)\n\nstatic int stringdb_index(lua_State *L)\n{\nTRY_START\n check_args(L, 2);\n GET_UD_MACRO(StringDB, self, 1, STRINGDB_TAG);\n if (lua_type(L, 2) == LUA_TNUMBER) {\n if (self.size() == 0) {\n my_lua_error(L, \"Empty stringdb\");\n }\n unsigned short index=check_t<unsigned short>(L, 2, 1, self.size());\n lua_pushstring(L, self[index-1].c_str());\n } else {\n std::string key = luaL_checkstring(L, 2);\n if (key == \"add\") {\n push_cfunction(L, stringdb_add);\n } else if (key == \"clear\") {\n push_cfunction(L, stringdb_clear);\n } else if (key == \"table\") {\n lua_createtable(L, self.size(), 0);\n for (unsigned int i=0 ; i<self.size() ; i++) {\n lua_pushnumber(L, i + 1);\n lua_pushstring(L, self[i].c_str());\n lua_settable(L, -3);\n }\n } else {\n my_lua_error(L, \"Not a readable StringDB member: \" + key);\n }\n }\n return 1;\nTRY_END\n}\n\nstatic int stringdb_newindex(lua_State *L)\n{\nTRY_START\n check_args(L, 3);\n GET_UD_MACRO(StringDB, self, 1, STRINGDB_TAG);\n std::string key = luaL_checkstring(L, 2);\n if (lua_type(L, 2) == LUA_TNUMBER) {\n if (self.size() == 0) {\n my_lua_error(L, \"Empty stringdb\");\n }\n unsigned short index=check_t<unsigned short>(L, 2, 1, self.size());\n std::string v = luaL_checkstring(L, 3);\n self[index-1] = v;\n } else {\n if (key == \"value\") {\n GET_UD_MACRO(StringDB, v, 3, STRINGDB_TAG);\n self = v;\n } else {\n my_lua_error(L, \"Not a writeable StringDB member: \" + key);\n }\n }\n return 0;\nTRY_END\n}\n\nstatic int stringdb_len(lua_State *L)\n{\nTRY_START\n check_args(L, 2); // a\n GET_UD_MACRO(StringDB, self, 1, STRINGDB_TAG);\n lua_pushnumber(L, self.size());\n return 1;\nTRY_END\n}\n\nEQ_PTR_MACRO(StringDB, stringdb, STRINGDB_TAG)\n\nMT_MACRO_LEN_NEWINDEX(stringdb);\n\n// }}}\n" }, { "alpha_fraction": 0.7831325531005859, "alphanum_fraction": 0.7831325531005859, "avg_line_length": 40.5, "blob_id": "2583740e039ac23222a1cda99a7e62db9c60de15", "content_id": "64b8b19d08db4d1917636aa21188bfed249bc670", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Lua", "length_bytes": 83, "license_type": "permissive", "max_line_length": 47, "num_lines": 2, "path": "/engine/tests/engine/envmap/envmap.lua", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "gfx_colour_grade `neutral.lut.png`\ndisk_resource_load `env_cube_noon.envcube.tiff`\n" }, { "alpha_fraction": 0.5675085783004761, "alphanum_fraction": 0.5746003985404968, "avg_line_length": 43.382568359375, "blob_id": "00fd35c8473dbb3d32f098ddf9b9ff8076e12dca", "content_id": "849c1b5b2adf454f9d0681a88a957feec240c19b", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 18331, "license_type": "permissive", "max_line_length": 107, "num_lines": 413, "path": "/dependencies/quex-0.34.1/quex/core_engine/state_machine/transition_map.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "import sys\n\nfrom quex.core_engine.interval_handling import NumberSet, Interval\n\n# definitions for 'history items':\nINTERVAL_BEGIN = True\nINTERVAL_END = False\n# real (uni-code) character codes start at zero, thus, it is safe to use \n# -7777 as a marker for undefined borders.\nINTERVAL_UNDEFINED_BORDER = -7777\n\nclass TransitionMap:\n def __init__(self):\n self.__db = {} # [target index] --> [trigger set that triggers to target]\n self.__epsilon_target_index_list = []\n\n def is_empty(self):\n return len(self.__db) == 0 and len(self.__epsilon_target_index_list) == 0\n\n def is_DFA_compliant(self):\n \"\"\"Checks if the current state transitions are DFA compliant, i.e. it\n investigates if trigger sets pointing to different targets intersect.\n RETURN: True => OK\n False => Same triggers point to different target. This cannot\n be part of a deterministic finite automaton (DFA).\n \"\"\"\n # DFA's do not have epsilon transitions\n if self.__epsilon_target_index_list != []: return False\n\n # check wether trigger sets intersect\n all_trigger_sets = NumberSet()\n for trigger_set in self.__db.values():\n if all_trigger_sets.has_intersection(trigger_set): \n return False\n else:\n all_trigger_sets.unite_with(trigger_set)\n\n return True\n\n def add_epsilon_target_state(self, TargetStateIdx):\n if TargetStateIdx not in self.__epsilon_target_index_list:\n self.__epsilon_target_index_list.append(TargetStateIdx)\n\n def add_transition(self, Trigger, TargetStateIdx): \n \"\"\"Adds a transition according to trigger and target index.\n RETURNS: The target state index (may be created newly).\n \"\"\"\n assert type(TargetStateIdx) == long or TargetStateIdx == None\n assert Trigger.__class__ in [int, long, list, Interval, NumberSet] or Trigger == None\n\n if Trigger == None: # This is a shorthand to trigger via the remaining triggers\n Trigger = self.get_trigger_set_union().inverse()\n elif type(Trigger) == long: Trigger = Interval(int(Trigger), int(Trigger+1))\n elif type(Trigger) == int: Trigger = Interval(Trigger, Trigger+1)\n elif type(Trigger) == list: Trigger = NumberSet(Trigger, ArgumentIsYoursF=True)\n\n if Trigger.__class__ == Interval: \n if self.__db.has_key(TargetStateIdx): \n self.__db[TargetStateIdx].add_interval(Trigger)\n else:\n self.__db[TargetStateIdx] = NumberSet(Trigger, ArgumentIsYoursF=True)\n else:\n if self.__db.has_key(TargetStateIdx): \n self.__db[TargetStateIdx].unite_with(Trigger)\n else:\n self.__db[TargetStateIdx] = Trigger\n\n return TargetStateIdx\n\n def delete_transitions_to_target(self, TargetIdx):\n \"\"\"Returns all triggers that lead to target 'TargetIdx'. If a trigger 'None' is returned\n it means that the epsilon transition triggers to target state. If the TargetIndex is \n omitted the set of all triggers, except the epsilon triggers, are returned.\n \"\"\"\n if not self.__db.has_key(TargetIdx): return\n del self.__db[TargetIdx]\n\n def delete_epsilon_target_state(self, TargetStateIdx):\n\n if TargetStateIdx in self.__epsilon_target_index_list:\n del self.__epsilon_target_index_list[self.__epsilon_target_index_list.index(TargetStateIdx)]\n\n def delete_transitions_on_character_list(self, CharacterCodeList):\n\n for trigger_set in self.__db.values():\n for char_code in CharacterCodeList:\n if trigger_set.contains(char_code):\n trigger_set.cut_interval(Interval(char_code, char_code+1))\n\n self.delete_transitions_on_empty_trigger_sets()\n\n def delete_transitions_on_empty_trigger_sets(self):\n\n for target_index, trigger_set in self.__db.items():\n if trigger_set.is_empty(): del self.__db[target_index]\n\n def get_trigger_set_union(self):\n result = NumberSet()\n for trigger_set in self.__db.values():\n result.unite_with(trigger_set)\n\n return result\n\n def get_epsilon_target_state_index_list(self):\n return self.__epsilon_target_index_list\n\n def get_non_epsilon_target_state_index_list(self):\n return self.__db.keys()\n\n def get_target_state_index_list(self):\n result = self.__db.keys()\n for index in self.__epsilon_target_index_list:\n result.append(index)\n return result\n\n def get_resulting_target_state_index(self, Trigger):\n \"\"\"This function makes sense for DFA's\"\"\"\n for target_index, trigger_set in self.__db.items():\n if trigger_set.contains(Trigger): return target_index\n return None\n\n def get_resulting_target_state_index_list(self, Trigger):\n \"\"\"NOTE: This function makes sense for NFA's\"\"\"\n result = []\n for target_index, trigger_set in self.__db.items():\n if trigger_set.contains(Trigger) and target_index not in result:\n result.append(target_index) \n\n if self.__epsilon_target_index_list != []:\n for target_index in self.__epsilon_target_index_list:\n if target_index not in result:\n result.append(self.__epsilon_target_index_list)\n\n return result_list\n\n def get_map(self):\n return self.__db\n\n def get_trigger_set_line_up(self):\n ## WATCH AND SEE THAT WE COULD CACHE HERE AND GAIN A LOT OF SPEED during construction\n ## if self.__dict__.has_key(\"NONSENSE\"): \n ## self.NONSENSE += 1\n ## print \"## called\", self.NONSENSE\n ## else:\n ## self.NONSENSE = 1\n \"\"\"Lines the triggers up on a 'time line'. A target is triggered by\n certain characters that belong to 'set' (trigger sets). Those sets\n are imagined as ranges on a time line. The 'history' is described\n by means of history items. Each item tells wether a range begins\n or ends, and what target state is reached in that range.\n\n [0, 10] [90, 95] [100, 200] ---> TargetState0\n [20, 89] ---> TargetState1\n [96, 99] [201, 205] ---> TargetState2\n\n results in a 'history':\n\n 0: begin of TargetState0\n 10: end of TargetState0\n 11: begin of DropOut\n 20: begin of TargetState1\n 89: end of TargetState1\n 90: begin of TargetState0\n 95: end of TargetState0\n 96: begin of TargetState2\n 99: end of TargetState2\n 100 ...\n \n \"\"\"\n # (*) create a 'history', i.e. note down any change on the trigger set combination\n # (here the alphabet plays the role of a time scale)\n class history_item:\n def __init__(self, Position, ChangeF, TargetIdx):\n self.position = Position\n self.change = ChangeF\n self.target_idx = TargetIdx \n \n def __repr__(self): \n if self.change == INTERVAL_BEGIN: ChangeStr = \"begin\"\n else: ChangeStr = \"end\"\n return \"%i: %s %s\" % (self.position, ChangeStr, self.target_idx)\n\n def __eq__(self, Other):\n return self.position == Other.position \\\n and self.change == Other.change \\\n and self.target_idx == Other.target_idx \n \n history = []\n # NOTE: This function only deals with non-epsilon triggers. Empty\n # ranges in 'history' are dealt with in '.get_trigger_map()'. \n for target_idx, trigger_set in self.__db.items():\n interval_list = trigger_set.get_intervals(PromiseNotToChangeAnythingF=True)\n for interval in interval_list: \n # add information about start and end of current interval\n history.append(history_item(interval.begin, INTERVAL_BEGIN, target_idx))\n history.append(history_item(interval.end, INTERVAL_END, target_idx))\n\n # (*) sort history according to position\n history.sort(lambda a, b: cmp(a.position, b.position))\n\n return history \n\n def get_trigger_map(self):\n \"\"\"Consider the set of possible characters as aligned on a 1 dimensional line.\n This one-dimensional line is remiscent of a 'time line' so we call the change\n of interval coverage 'history'. \n\n Returns a trigger map consisting of a list of pairs: (Interval, TargetIdx)\n\n [ [ interval_0, target_0],\n [ interval_1, target_1],\n ...\n [ interval_N, target_N] ]\n\n The intervals are sorted and non-overlapping (use this function only for DFA).\n\n A drop out on 'interval_i' is represented by 'target_i' == None.\n \"\"\"\n # At this point only DFAs shall be considered. Thus there cannot be any epsilon\n # target transitions.\n assert self.__epsilon_target_index_list == [], \\\n \"Trigger maps can only be computed on DFAs. Epsilon transition detected.\"\n\n # NOTE: The response '[]' is a **signal** that there is only an epsilon\n # transition. The response as such would be incorrect. But the signal\n # 'empty reply' needs to be treated by the caller.\n if len(self.__db) == 0: return []\n \n history = self.get_trigger_set_line_up()\n \n def query_trigger_map(EndPosition, TargetIdx):\n \"\"\"Find all map entries that have or have not an open interval and\n point to the given TargetIdx. If TargetIdx = None it is not checked.\n \"\"\"\n entry_list = []\n for entry in trigger_map:\n if entry[0].end == EndPosition and entry[1] == TargetIdx: \n entry_list.append(entry)\n return entry_list \n\n # (*) build the trigger map\n trigger_map = [] \n for item in history:\n if item.change == INTERVAL_BEGIN: \n # if an interval has same target index and ended at the current\n # intervals begin, then extend the last interval, do not create a new one.\n adjacent_trigger_list = query_trigger_map(item.position, item.target_idx)\n if adjacent_trigger_list == []:\n # open a new interval (set .end = None to indicate 'open')\n trigger_map.append([Interval(item.position, INTERVAL_UNDEFINED_BORDER), \n item.target_idx])\n else:\n for entry in adjacent_trigger_list: \n # re-open the adjacent interval (set .end = None to indicate 'open')\n entry[0].end = INTERVAL_UNDEFINED_BORDER\n \n else:\n # item.change == INTERVAL_END \n # close the correspondent intervals\n # (search for .end = None indicating 'open interval') \n for entry in query_trigger_map(INTERVAL_UNDEFINED_BORDER, item.target_idx):\n entry[0].end = item.position\n \n # (*) fill all gaps in the trigger map with 'None' target = Drop Out !\n\n drop_out_target = None\n ## NOTE: Trigger maps shall only be computed for DFA, see assert above. \n # Thus, there cannot be an epsilon transition.\n ## if self.__drop_out_target_index_list != []: \n ## drop_out_target = self.__drop_out_target_index_list[0] \n gap_filler = [] \n if len(trigger_map) >= 2: \n prev_entry = trigger_map[0] \n for entry in trigger_map[1:]: \n if prev_entry[0].end != entry[0].begin: \n gap_filler.append([Interval(prev_entry[0].end, entry[0].begin), drop_out_target])\n prev_entry = entry\n \n # -- append the last interval until 'infinity' (if it is not yet specified \n # (do not switch this with the following step, .. or you screw it) \n if trigger_map[-1][0].end != sys.maxint: \n trigger_map.append([Interval(trigger_map[-1][0].end, sys.maxint), drop_out_target])\n # -- insert a first interval from -'infinity' to the start of the first interval\n if trigger_map[0][0].begin != -sys.maxint:\n trigger_map.append([Interval(-sys.maxint, trigger_map[0][0].begin), drop_out_target])\n \n # -- insert the gap fillers and get the trigger map straigtened up again\n trigger_map.extend(gap_filler) \n trigger_map.sort(lambda a, b: cmp(a[0].begin, b[0].begin))\n\n # (*) post check assert\n for entry in trigger_map:\n assert entry[0].end != None, \\\n \"remaining open intervals in trigger map construction\"\n\n return trigger_map\n\n def get_trigger_set_to_target(self, TargetIdx):\n \"\"\"Returns all triggers that lead to target 'TargetIdx'. If a trigger 'None' is returned\n it means that the epsilon transition triggers to target state. If the TargetIndex is \n omitted the set of all triggers, except the epsilon triggers, are returned.\n \"\"\"\n if self.__db.has_key(TargetIdx): return self.__db[TargetIdx]\n else: return NumberSet()\n\n def replace_target_index(self, Before, After):\n \"\"\"Replaces given target index 'Before' with the index 'After'. \n This means, that a transition targetting to 'Before' will then transit\n to 'After'.\n \"\"\" \n # replace target index in the 'normal map'\n if not self.__db.has_key(Before): \n pass\n elif self.__db.has_key(After): \n self.__db[After].unite_with(self.__db[Before])\n del self.__db[Before]\n else: \n self.__db[After] = self.__db[Before]\n del self.__db[Before]\n\n # replace target index in the list of epsilon transition targets.\n if Before in self.__epsilon_target_index_list:\n self.__epsilon_target_index_list[self.__epsilon_target_index_list.index(Before)] = After\n\n def replace_drop_out_target_states_with_adjacent_targets(self):\n # NOTE: The request does not invalidate anything, invalidate cache after that.\n trigger_map = self.get_trigger_map() \n\n\n if trigger_map == []: # Nothing to be done, since there is nothing adjacent \n return # to the 'drop out' trigger. There is only an epsilon transition.\n\n assert len(trigger_map) >= 2\n\n # Target of internval (-oo, X) must be 'drop out' since there are no unicode \n # code points below 0.\n assert trigger_map[0][1] == None\n assert trigger_map[0][0].begin == - sys.maxint\n\n\n # The first interval mentioned after that must not point to 'drop out' since\n # the trigger map must collect the same targets into one single interval.\n assert trigger_map[1][1] != None\n\n non_drop_out_target = trigger_map[1][1]\n self.add_transition(trigger_map[0][0], non_drop_out_target)\n \n # NOTE: Here we know that len(trigger_map) >= 2\n for trigger_set, target in trigger_map[2:]:\n\n if target == None: target = non_drop_out_target\n else: non_drop_out_target = target\n\n self.add_transition(trigger_set, target)\n\n def has_one_of_triggers(self, CharacterCodeList):\n assert type(CharacterCodeList) == list\n for code in CharacterCodeList:\n if self.has_trigger(code): return True\n return False\n\n def has_trigger(self, CharCode):\n assert type(CharCode) == int\n if self.get_resulting_target_state_index(CharCode) == None: return False\n else: return True\n\n def get_string(self, FillStr, StateIndexMap):\n # print out transitionts\n sorted_transitions = self.get_map().items()\n sorted_transitions.sort(lambda a, b: cmp(a[1].minimum(), b[1].minimum()))\n\n msg = \"\"\n # normal state transitions\n for target_state_index, trigger_set in sorted_transitions:\n trigger_str = trigger_set.get_utf8_string()\n if StateIndexMap == None: target_str = \"%05i\" % target_state_index\n else: target_str = \"%05i\" % StateIndexMap[target_state_index]\n \n msg += \"%s == %s ==> %s\\n\" % (FillStr, trigger_str, target_str)\n\n # epsilon transitions\n if self.__epsilon_target_index_list != []:\n txt_list = map(lambda ti: \"%05i\" % StateIndexMap[ti], self.__epsilon_target_index_list)\n msg += \"%s ==<epsilon>==> \" % FillStr \n for txt in txt_list:\n msg += txt + \", \"\n if len(txt_list) != 0: msg = msg[:-2]\n else:\n msg += \"%s <no epsilon>\" % FillStr\n\n msg += \"\\n\"\n\n return msg\n\n def get_graphviz_string(self, OwnStateIdx, StateIndexMap):\n sorted_transitions = self.get_map().items()\n sorted_transitions.sort(lambda a, b: cmp(a[1].minimum(), b[1].minimum()))\n\n msg = \"\"\n # normal state transitions\n for target_state_index, trigger_set in sorted_transitions:\n trigger_str = trigger_set.get_utf8_string()\n if StateIndexMap == None: target_str = \"%i\" % target_state_index\n else: target_str = \"%i\" % StateIndexMap[target_state_index]\n msg += \"%i -> %s [label =\\\"%s\\\"];\\n\" % (OwnStateIdx, target_str, trigger_str.replace(\"\\\"\", \"\"))\n\n # epsilon transitions\n for ti in self.__epsilon_target_index_list:\n if StateIndexMap == None: target_str = \"%i\" % int(ti) \n else: target_str = \"%i\" % int(StateIndexMap[ti]) \n msg += \"%i -> %s [label =\\\"<epsilon>\\\"];\\n\" % (OwnStateIdx, target_str)\n\n return msg\n\n" }, { "alpha_fraction": 0.5563587546348572, "alphanum_fraction": 0.5651004314422607, "avg_line_length": 25.61521339416504, "blob_id": "7fbe330ee5c97d1b5bd99c773980221bbc5d115a", "content_id": "9c76d44ee67904ae25dd01736ffb315aae9b8ffe", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 11897, "license_type": "permissive", "max_line_length": 96, "num_lines": 447, "path": "/engine/external_table.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\nclass ExternalTable;\n\n\n#ifndef ExternalTable_h\n#define ExternalTable_h\n\n#include <map>\n#include <string>\n\nextern \"C\" {\n #include <lua.h>\n #include <lauxlib.h>\n}\n\n#include <math_util.h>\n#include <spline_table.h>\n#include <stringf.h>\n\n#include \"lua_ptr.h\"\n#include \"shared_ptr.h\"\n\n\n// Purpose of this class is to store lua data outside of lua so as to avoid\n// putting stress on the garbage collector. Only certain kinds of primitive data\n// are supported.\n\nclass ExternalTable {\n\n public:\n\n ExternalTable (void) { }\n\n void destroy (lua_State *L);\n\n bool has (const std::string &key) const { return fields.find(key) != fields.end(); }\n bool has (lua_Number key) const { return elements.find(key) != elements.end(); }\n\n template<class U> void get (const std::string &key, U &val, const U &def) const\n {\n if (!get(key, val)) val = def;\n \n }\n\n template<class U> void get (lua_Number key, U &val, const U &def) const\n {\n if (!get(key, val)) val = def;\n \n }\n\n template<class U, typename ...Args>\n void getOrExcf (const std::string &key, U &val, const std::string &msgf, Args... args) const\n {\n if (!get(key, val)) EXCEPTF(msgf, args...);\n }\n\n template<class U, typename ...Args>\n void getOrExcf (lua_Number key, U &val, const std::string &msgf, Args... args) const\n {\n if (!get(key, val)) EXCEPTF(msgf, args...);\n }\n\n bool get (const std::string &key, lua_Number &v) const\n {\n auto it = fields.find(key);\n if (it == fields.end()) return false;\n if (it->second.type != 0) return false;\n v = it->second.real;\n return true;\n }\n\n bool get (const std::string &key, std::string &v) const\n {\n auto it = fields.find(key);\n if (it == fields.end()) return false;\n if (it->second.type != 1) return false;\n v = it->second.str;\n return true;\n }\n\n bool get (const std::string &key, Vector3 &v) const\n {\n auto it = fields.find(key);\n if (it == fields.end()) return false;\n if (it->second.type != 2) return false;\n v = it->second.v3 ;\n return true;\n }\n\n bool get (const std::string &key, Quaternion &v) const\n {\n auto it = fields.find(key);\n if (it == fields.end()) return false;\n if (it->second.type != 3) return false;\n v = it->second.q;\n return true;\n }\n\n bool get (const std::string &key, bool &v) const\n {\n auto it = fields.find(key);\n if (it == fields.end()) return false;\n if (it->second.type != 4) return false;\n v = it->second.b;\n return true;\n }\n\n bool get (const std::string &key, SharedPtr<ExternalTable> &v) const\n {\n auto it = fields.find(key);\n if (it == fields.end()) return false;\n if (it->second.type != 5) return false;\n v = it->second.t;\n return true;\n }\n\n bool get (const std::string &key, Plot &v) const\n {\n auto it = fields.find(key);\n if (it == fields.end()) return false;\n if (it->second.type != 6) return false;\n v = it->second.plot;\n return true;\n }\n\n bool get (const std::string &key, PlotV3 &v) const\n {\n auto it = fields.find(key);\n if (it == fields.end()) return false;\n if (it->second.type != 7) return false;\n v = it->second.plot_v3;\n return true;\n }\n\n bool get (const std::string &key, Vector2 &v) const\n {\n auto it = fields.find(key);\n if (it == fields.end()) return false;\n if (it->second.type != 9) return false;\n v = it->second.v2;\n return true;\n }\n\n bool get (const std::string &key, Vector4 &v) const\n {\n auto it = fields.find(key);\n if (it == fields.end()) return false;\n if (it->second.type != 10) return false;\n v = it->second.v4;\n return true;\n }\n\n bool get (lua_Number key, lua_Number &v) const\n {\n auto it = elements.find(key);\n if (it == elements.end()) return false;\n if (it->second.type != 0) return false;\n v = it->second.real;\n return true;\n }\n\n bool get (lua_Number key, std::string &v) const\n {\n auto it = elements.find(key);\n if (it == elements.end()) return false;\n if (it->second.type != 1) return false;\n v = it->second.str;\n return true;\n }\n\n bool get (lua_Number key, Vector3 &v) const\n {\n auto it = elements.find(key);\n if (it == elements.end()) return false;\n if (it->second.type != 2) return false;\n v = it->second.v3 ;\n return true;\n }\n\n bool get (lua_Number key, Quaternion &v) const\n {\n auto it = elements.find(key);\n if (it == elements.end()) return false;\n if (it->second.type != 3) return false;\n v = it->second.q;\n return true;\n }\n\n bool get (lua_Number key, bool &v) const\n {\n auto it = elements.find(key);\n if (it == elements.end()) return false;\n if (it->second.type != 4) return false;\n v = it->second.b;\n return true;\n }\n\n bool get (lua_Number key, SharedPtr<ExternalTable> &v) const\n {\n auto it = elements.find(key);\n if (it == elements.end()) return false;\n if (it->second.type != 5) return false;\n v = it->second.t;\n return true;\n }\n\n bool get (lua_Number key, Plot &v) const\n {\n auto it = elements.find(key);\n if (it == elements.end()) return false;\n if (it->second.type != 6) return false;\n v = it->second.plot;\n return true;\n }\n\n bool get (lua_Number key, PlotV3 &v) const\n {\n auto it = elements.find(key);\n if (it == elements.end()) return false;\n if (it->second.type != 7) return false;\n v = it->second.plot_v3;\n return true;\n }\n\n bool get (lua_Number key, Vector2 &v) const\n {\n auto it = elements.find(key);\n if (it == elements.end()) return false;\n if (it->second.type != 9) return false;\n v = it->second.v2;\n return true;\n }\n\n bool get (lua_Number key, Vector4 &v) const\n {\n auto it = elements.find(key);\n if (it == elements.end()) return false;\n if (it->second.type != 10) return false;\n v = it->second.v4;\n return true;\n }\n\n\n void set (const std::string &key, const lua_Number r)\n {\n fields[key].type = 0;\n fields[key].real = r;\n }\n\n void set (const std::string &key, const std::string &s)\n {\n fields[key].type = 1;\n fields[key].str = s;\n }\n\n void set (const std::string &key, const Vector3 &v3)\n {\n fields[key].type = 2;\n fields[key].v3 = v3;\n }\n\n void set (const std::string &key, const Quaternion &q)\n {\n fields[key].type = 3;\n fields[key].q = q;\n }\n\n void set (const std::string &key, bool b)\n {\n fields[key].type = 4;\n fields[key].b = b;\n }\n\n void set (const std::string &key, const SharedPtr<ExternalTable> &t)\n {\n fields[key].type = 5;\n fields[key].t = t;\n }\n\n void set (const std::string &key, Plot plot)\n {\n fields[key].type = 6;\n fields[key].plot = plot;\n }\n\n void set (const std::string &key, PlotV3 plot_v3)\n {\n fields[key].type = 7;\n fields[key].plot_v3 = plot_v3;\n }\n\n void set (const std::string &key, const Vector2 &v2)\n {\n fields[key].type = 9;\n fields[key].v2 = v2;\n }\n\n void set (const std::string &key, const Vector4 &v4)\n {\n fields[key].type = 10;\n fields[key].v4 = v4;\n }\n\n void set (lua_Number key, const lua_Number r)\n {\n elements[key].type = 0;\n elements[key].real = r;\n }\n\n void set (lua_Number key, const std::string &s)\n {\n elements[key].type = 1;\n elements[key].str = s;\n }\n\n void set (lua_Number key, const Vector3 &v3)\n {\n elements[key].type = 2;\n elements[key].v3 = v3;\n }\n\n void set (lua_Number &key, const Quaternion &q)\n {\n elements[key].type = 3;\n elements[key].q = q;\n }\n\n void set (lua_Number &key, bool b)\n {\n elements[key].type = 4;\n elements[key].b = b;\n }\n\n void set (lua_Number &key, const SharedPtr<ExternalTable> &t)\n {\n elements[key].type = 5;\n elements[key].t = t;\n }\n\n void set (lua_Number &key, const Plot &plot)\n {\n elements[key].type = 6;\n elements[key].plot = plot;\n }\n\n void set (lua_Number &key, const PlotV3 &plot_v3)\n {\n elements[key].type = 7;\n elements[key].plot_v3 = plot_v3;\n }\n\n void set (lua_Number &key, const Vector2 &v2)\n {\n elements[key].type = 9;\n elements[key].v2 = v2;\n }\n\n void set (lua_Number &key, const Vector4 &v4)\n {\n elements[key].type = 10;\n elements[key].v4 = v4;\n }\n\n const char *luaGet (lua_State *L) const;\n const char *luaSet (lua_State *L);\n\n const char *luaGet (lua_State *L, const std::string &key) const;\n const char *luaSet (lua_State *L, const std::string &key);\n\n const char *luaGet (lua_State *L, lua_Number key) const;\n const char *luaSet (lua_State *L, lua_Number key);\n\n void unset (const std::string &key) { fields.erase(key); }\n void unset (lua_Number key) { elements.erase(key); }\n\n void clear (lua_State *L);\n\n void dump (lua_State *L) const;\n void takeTableFromLuaStack (lua_State *L, int tab);\n\n template<typename T> class UniquePtr {\n T *ptr;\n public:\n UniquePtr () : ptr(NULL) { }\n ~UniquePtr (void) { delete ptr; }\n T *operator-> (void) const { return ptr; }\n T &operator* (void) const { return *ptr; }\n T *operator= (T *ptr_) { delete ptr; return ptr=ptr_; }\n };\n\n struct Value {\n int type;\n std::string str;\n lua_Number real;\n Vector3 v3;\n Quaternion q;\n bool b;\n SharedPtr<ExternalTable> t;\n Plot plot;\n PlotV3 plot_v3;\n // TODO(dcunnin): This is not destroyed properly, as setNil() is not called.\n LuaPtr func;\n Vector2 v2;\n Vector4 v4;\n };\n\n typedef std::map<std::string, Value> StringMap;\n\n typedef StringMap::iterator KeyIterator;\n KeyIterator begin (void) { return fields.begin(); }\n KeyIterator end (void) { return fields.end(); }\n\n typedef StringMap::const_iterator ConstKeyIterator;\n ConstKeyIterator begin (void) const { return fields.begin(); }\n ConstKeyIterator end (void) const { return fields.end(); }\n\n typedef std::map<lua_Number, Value> NumberMap;\n\n protected:\n\n StringMap fields;\n\n NumberMap elements;\n\n};\n\n#endif\n" }, { "alpha_fraction": 0.5224413871765137, "alphanum_fraction": 0.530828058719635, "avg_line_length": 30.74981689453125, "blob_id": "62dbc4fef065e32b5783d4a230fc3ee97b224be3", "content_id": "c51f29224a3927b5d23e20cf76fdc6f3dd5a8351", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 43402, "license_type": "permissive", "max_line_length": 94, "num_lines": 1367, "path": "/engine/physics/tcol_parser.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <iostream>\n#include <cstdlib>\n\n#include <math_util.h>\n\n#include \"../path_util.h\"\n#include <centralised_log.h>\n\n#include \"tcol_lexer\"\n#include \"tcol_parser.h\"\n\n#include \"col_defaults.h\"\n\nstatic inline bool fnear(const float x, const float y)\n{\n return fabs(x-y) < 1E-6;\n}\n\nstatic inline bool ffar(const float x, const float y)\n{\n return !fnear(x,y);\n}\n\nstatic std::string str (const quex::Token &t)\n{\n std::string tmp;\n typedef std::basic_string<QUEX_CHARACTER_TYPE> S;\n S tmp2 = t.text();\n for (S::iterator i=tmp2.begin(),i_=tmp2.end() ; i!=i_ ; ++i) {\n uint8_t utf8[7];\n int utf8_length = quex::Quex_unicode_to_utf8(*i, utf8);\n utf8[utf8_length] = '\\0';\n tmp += std::string((const char*)utf8);\n }\n return tmp;\n}\n\nconst char *utf8 (const quex::Token &t)\n{\n // the lexer is ascii so a direct translation is possible\n return (char*) &t.text()[0];\n}\n\nstatic std::string where (quex::tcol_lexer* qlex)\n{\n std::stringstream ss;\n ss << \"(line \" << qlex->line_number() << \", column \" << qlex->column_number() << \")\";\n return ss.str();\n}\n\nstatic const char * what2 (QUEX_TOKEN_ID_TYPE tid)\n{\n switch (tid) {\n case QUEX_TKN_TERMINATION: return \"end of file\";\n case QUEX_TKN_TCOL: return \"TCOL header\";\n\n case QUEX_TKN_ATTRIBUTES: return \"attributes\";\n case QUEX_TKN_STATIC: return \"static\";\n case QUEX_TKN_MASS: return \"mass\";\n case QUEX_TKN_INERTIA: return \"inertia\";\n case QUEX_TKN_LINEAR_DAMPING: return \"linear_damping\";\n case QUEX_TKN_ANGULAR_DAMPING: return \"angular_damping\";\n case QUEX_TKN_LINEAR_SLEEP_THRESHOLD:\n return \"linear_sleep_threshold\";\n case QUEX_TKN_ANGULAR_SLEEP_THRESHOLD:\n return \"angular_sleep_threshold\";\n case QUEX_TKN_CCD_MOTION_THRESHOLD:\n return \"ccd_motion_threshold\";\n case QUEX_TKN_CCD_SWEPT_SPHERE_RADIUS:\n return \"ccd_swept_sphere_radius\";\n\n case QUEX_TKN_MATERIAL: return \"material\";\n case QUEX_TKN_MARGIN: return \"margin\";\n case QUEX_TKN_SHRINK: return \"shrink\";\n case QUEX_TKN_CENTRE: return \"centre\";\n case QUEX_TKN_NORMAL: return \"normal\";\n case QUEX_TKN_ORIENTATION: return \"orientation\";\n case QUEX_TKN_DIMENSIONS: return \"dimensions\";\n case QUEX_TKN_RADIUS: return \"radius\";\n case QUEX_TKN_HEIGHT: return \"height\";\n case QUEX_TKN_DISTANCE: return \"distance\";\n case QUEX_TKN_VERTEXES: return \"vertexes\";\n case QUEX_TKN_FACES: return \"faces\";\n case QUEX_TKN_EDGE_DISTANCE_THRESHOLD: return \"edge_distance_threshold\";\n case QUEX_TKN_MAX_EDGE_ANGLE_THRESHOLD: return \"max_edge_angle_threshold\";\n\n case QUEX_TKN_COMPOUND: return \"compound\";\n case QUEX_TKN_HULL: return \"hull\";\n case QUEX_TKN_BOX: return \"box\";\n case QUEX_TKN_CYLINDER: return \"cylinder\";\n case QUEX_TKN_CONE: return \"cone\";\n case QUEX_TKN_SPHERE: return \"sphere\";\n case QUEX_TKN_PLANE: return \"plane\";\n case QUEX_TKN_CAPSULE: return \"capsule\";\n case QUEX_TKN_MULTISPHERE: return \"multisphere\";\n case QUEX_TKN_TRIMESH: return \"trimesh\";\n\n case QUEX_TKN_SEMI: return \";\";\n case QUEX_TKN_LBRACE: return \"{\";\n case QUEX_TKN_RBRACE: return \"}\";\n case QUEX_TKN_NATURAL: return \"positive integer\";\n case QUEX_TKN_FLOAT: return \"float\";\n case QUEX_TKN_HEX: return \"hex flag\";\n case QUEX_TKN_UNKNOWN: return \"bad token\";\n default: return \"unknown token (probably a bug?)\";\n }\n}\n\nstatic std::string what (const quex::Token &t)\n{\n switch (t.type_id()) {\n case QUEX_TKN_NATURAL: return \"positive integer \"+str(t);\n case QUEX_TKN_FLOAT: return \"float \"+str(t);\n case QUEX_TKN_HEX: return \"hex flag \"+str(t);\n case QUEX_TKN_UNKNOWN: return \"bad token \"+str(t);\n default: return what2(t.type_id());\n }\n}\n\n\n#define err4(name, qlex, t, expected) \\\n do { \\\n std::stringstream ss; \\\n ss << \"While parsing \" << name << \" at \" << where(qlex) \\\n << \" - got \\\"\" << what(t) << \"\\\" \" \\\n << \"but expected \\\"\" << expected << \"\\\".\"; \\\n GRIT_EXCEPT(ss.str()); \\\n } while (false)\n\n\n#define err3(name, qlex, msg) \\\n do { \\\n std::stringstream ss; \\\n ss << \"While parsing \" << name << \" at \" << where(qlex) << \" ERROR: \" << msg; \\\n GRIT_EXCEPT(ss.str()); \\\n } while (false)\n\n\n#define ensure_token(name, qlex, tid) \\\n do { \\\n quex::Token t; \\\n qlex->get_token(&t); \\\n if (t.type_id() != tid) { \\\n err4(name,qlex,t,what2(tid)); \\\n } \\\n } while (false)\n\n\n//quex::Token is not const because number() is not const (a bug in quex)\nstatic int get_int_from_token (const std::string &name,\n quex::tcol_lexer* qlex,\n quex::Token &t,\n int num_vertexes)\n{\n int v = t.number();\n if (v>=num_vertexes)\n err4(name,qlex,t,\"index of a vertex\");\n return v;\n}\n\nstatic int parse_int (const std::string &name,\n quex::tcol_lexer* qlex,\n int num_vertexes)\n{\n quex::Token t; qlex->get_token(&t);\n if (t.type_id()!=QUEX_TKN_NATURAL) {\n err4(name,qlex,t,\"positive integer\");\n }\n return get_int_from_token(name,qlex,t,num_vertexes);\n}\n\n/*\nstatic unsigned long get_ulong_from_hex_token (const quex::Token &t)\n{\n const char *text = utf8(t);\n return strtoul(text,NULL,16);\n}\n\nstatic unsigned long parse_hex (const std::string &name,\n quex::tcol_lexer* qlex)\n{\n quex::Token t; qlex->get_token(&t);\n if (t.type_id()!=QUEX_TKN_HEX) {\n err4(name,qlex,t,\"hexadecimal flags\");\n }\n return get_ulong_from_hex_token(t);\n}\n*/\n\nstatic void get_string_from_string_token (const quex::Token &t, std::string &material)\n{\n // cast away unsignedness -- don't care\n const char *text = reinterpret_cast<const char *>(&t.text()[0]);\n // strip leading and trailing quotes\n material.append(text+1, t.text().length()-2);\n}\n\nstatic std::string parse_material (const std::string &name,\n quex::tcol_lexer* qlex)\n{\n quex::Token t; qlex->get_token(&t);\n if (t.type_id()!=QUEX_TKN_STRING) {\n err4(name,qlex,t,\"quoted string\");\n }\n std::string m;\n get_string_from_string_token(t, m);\n return m;\n}\n\nstatic float get_real_from_token (const quex::Token &t)\n{\n const char *text = utf8(t);\n return (float) strtod(text,NULL);\n}\n\nstatic float parse_real (const std::string &name, quex::tcol_lexer* qlex)\n{\n quex::Token t; qlex->get_token(&t);\n if (t.type_id()==QUEX_TKN_FLOAT) {\n return get_real_from_token(t);\n } else if (t.type_id()==QUEX_TKN_NATURAL) {\n return (float)t.number();\n } else {\n err4(name,qlex,t,\"float\");\n return 0.0; // suppress msvc warning\n }\n}\n\nstatic float parse_positive_real (const std::string &name,\n quex::tcol_lexer* qlex)\n{\n float v;\n quex::Token t; qlex->get_token(&t);\n if (t.type_id()==QUEX_TKN_FLOAT) {\n v = get_real_from_token(t);\n } else if (t.type_id()==QUEX_TKN_NATURAL) {\n v = (float)t.number();\n } else {\n err4(name,qlex,t,\"float\");\n }\n if (v<0)\n err4(name,qlex,t,\"positive float\");\n return v;\n}\n\n// pops ; or }, returning true or false respectively\nbool more_to_come (const std::string &name, quex::tcol_lexer* qlex)\n{\n quex::Token t; qlex->get_token(&t);\n switch (t.type_id()) {\n case QUEX_TKN_SEMI: return true;\n case QUEX_TKN_RBRACE: return false;\n default:\n err4(name,qlex,t,\"; or }\");\n }\n return false; // never happens\n}\n\n\n\n\nstatic void parse_vertexes (const std::string &name,\n quex::tcol_lexer* qlex,\n Vertexes &vertexes)\n{\n ensure_token(name,qlex,QUEX_TKN_LBRACE);\n\n while (true) { \n float x,y,z;\n quex::Token t; qlex->get_token(&t);\n switch (t.type_id()) {\n case QUEX_TKN_FLOAT:\n case QUEX_TKN_NATURAL:\n x=get_real_from_token(t);\n y=parse_real(name,qlex);\n z=parse_real(name,qlex);\n vertexes.push_back(Vector3(x,y,z));\n if (!more_to_come(name,qlex)) break;\n continue;\n\n case QUEX_TKN_RBRACE:\n break;\n\n default:\n err4(name,qlex,t,\"3 floats or }\");\n }\n\n break;\n }\n}\n\nstruct PlaneEquation {\n Vector3 normal;\n float d;\n PlaneEquation (void) { }\n PlaneEquation (const Vector3 &n, float d_) : normal(n), d(d_) { }\n};\n\nstatic bool isPointInsidePlanes (const std::vector<PlaneEquation>& planeEquations,\n const Vector3& point,\n float margin)\n{\n int numbrushes = planeEquations.size();\n for (int i=0;i<numbrushes;i++)\n {\n const PlaneEquation &N1 = planeEquations[i];\n float dist = N1.normal.dot(point) + N1.d - margin;\n if (dist>0.0f) return false;\n }\n return true;\n\n}\n\nstatic bool areVerticesBehindPlane (const PlaneEquation& plane,\n const std::vector<Vector3>& vertices,\n float margin)\n{\n int numvertices = vertices.size();\n for (int i=0;i<numvertices;i++) {\n const Vector3 &N1 = vertices[i];\n float dist = plane.normal.dot(N1) + plane.d - margin;\n if (dist>0.0f) return false;\n }\n return true;\n}\n\nstatic bool notExist (const Vector3& planeNormal,\n const std::vector<PlaneEquation>& planeEquations)\n{\n int numbrushes = planeEquations.size();\n for (int i=0;i<numbrushes;i++) {\n const PlaneEquation &N1 = planeEquations[i];\n if (planeNormal.dot(N1.normal) > 0.999f) return false;\n }\n return true;\n}\n\nstatic void getPlaneEquationsFromVertices (std::vector<Vector3>& vertices,\n std::vector<PlaneEquation>& planeEquationsOut )\n{\n const int numvertices = vertices.size();\n // brute force:\n for (int i=0;i<numvertices;i++) {\n\n const Vector3& N1 = vertices[i];\n\n for (int j=i+1;j<numvertices;j++) {\n\n const Vector3& N2 = vertices[j];\n\n for (int k=j+1;k<numvertices;k++) {\n\n const Vector3& N3 = vertices[k];\n\n Vector3 edge0 = N2-N1;\n Vector3 edge1 = N3-N1;\n float normalSign = 1.0f;\n for (int ww=0;ww<2;ww++) {\n Vector3 planeNormal = normalSign * edge0.cross(edge1);\n if (planeNormal.length2() > 0.0001f) {\n planeNormal.normalise();\n if (notExist(planeNormal,planeEquationsOut)) {\n PlaneEquation p(planeNormal, -planeNormal.dot(N1));\n\n //check if inside, and replace supportingVertexOut if needed\n if (areVerticesBehindPlane(p,vertices,0.01f)) {\n planeEquationsOut.push_back(p);\n }\n }\n }\n normalSign = -1.0f;\n }\n\n }\n }\n }\n\n}\n\nvoid getVerticesFromPlaneEquations(const std::vector<PlaneEquation>& planeEquations,\n std::vector<Vector3>& verticesOut )\n{\n const int numbrushes = planeEquations.size();\n // brute force:\n for (int i=0;i<numbrushes;i++) {\n\n const PlaneEquation& N1 = planeEquations[i];\n\n for (int j=i+1;j<numbrushes;j++) {\n\n const PlaneEquation& N2 = planeEquations[j];\n\n for (int k=j+1;k<numbrushes;k++) {\n\n const PlaneEquation& N3 = planeEquations[k];\n\n Vector3 n2n3; n2n3 = N2.normal.cross(N3.normal);\n Vector3 n3n1; n3n1 = N3.normal.cross(N1.normal);\n Vector3 n1n2; n1n2 = N1.normal.cross(N2.normal);\n\n if ( ( n2n3.length2() > 0.0001f ) &&\n ( n3n1.length2() > 0.0001f ) &&\n ( n1n2.length2() > 0.0001f ) ) {\n\n //point P out of 3 plane equations:\n\n // d1 ( N2 * N3 ) + d2 ( N3 * N1 ) + d3 ( N1 * N2 ) \n //P = ------------------------------------------------------------------------- \n // N1 . ( N2 * N3 ) \n\n\n float quotient = (N1.normal.dot(n2n3));\n if (fabs(quotient) > 0.000001f) {\n quotient = -1.0f / quotient;\n n2n3 *= N1.d;\n n3n1 *= N2.d;\n n1n2 *= N3.d;\n Vector3 potentialVertex = n2n3;\n potentialVertex += n3n1;\n potentialVertex += n1n2;\n potentialVertex *= quotient;\n\n //check if inside, and replace supportingVertexOut if needed\n if (isPointInsidePlanes(planeEquations,potentialVertex,0.01f))\n {\n verticesOut.push_back(potentialVertex);\n }\n }\n }\n }\n }\n }\n}\n\n\nstatic void shrink_vertexes (Vertexes &vertexes, float distance)\n{\n std::vector<PlaneEquation> planes;\n getPlaneEquationsFromVertices(vertexes, planes);\n int sz = planes.size();\n for (int i=0 ; i<sz ; ++i) {\n planes[i].d += distance;\n if (planes[i].d >= 0) {\n CERR << \"Failed to shrink hull: [\"<<i<<\"]\" << planes[i].d << std::endl;\n return;\n }\n }\n vertexes.clear();\n getVerticesFromPlaneEquations(planes, vertexes);\n}\n\ntemplate <typename T>\nstatic inline T &vecnext (std::vector<T> &vec)\n{\n size_t sz = vec.size();\n vec.resize(sz+1); // push a blank element\n return vec[sz]; // and return reference to it\n}\n\nstatic void parse_hull (const std::string &name,\n quex::tcol_lexer* qlex,\n TColHull &hull)\n{\n ensure_token(name,qlex,QUEX_TKN_LBRACE);\n\n float shrink = 0;\n bool has_vertexes = false;\n hull.margin = DEFAULT_MARGIN;\n bool have_material = false;\n\n quex::Token t; \n while (true) {\n qlex->get_token(&t);\n switch (t.type_id()) {\n case QUEX_TKN_MARGIN:\n hull.margin = parse_positive_real(name,qlex);\n if (more_to_come(name, qlex)) continue;\n break;\n\n case QUEX_TKN_MATERIAL:\n hull.material = parse_material(name, qlex);\n have_material = true;\n if (more_to_come(name, qlex)) continue;\n break;\n\n case QUEX_TKN_SHRINK:\n if (has_vertexes) {\n err3(name,qlex,\"Give shrink before vertexes!\");\n }\n shrink = parse_positive_real(name,qlex);\n if (more_to_come(name, qlex)) continue;\n break;\n\n case QUEX_TKN_VERTEXES:\n if (has_vertexes) {\n err3(name,qlex,\"Only one vertex list allowed.\");\n }\n has_vertexes = true;\n parse_vertexes(name, qlex, hull.vertexes);\n if (shrink > 0) {\n shrink_vertexes(hull.vertexes, shrink);\n }\n if (more_to_come(name, qlex)) continue;\n break;\n\n case QUEX_TKN_RBRACE:\n break;\n\n default:\n err4(name,qlex,t,\"margin, shrink, vertexes or }\");\n }\n break;\n } \n\n if (!has_vertexes) {\n err3(name,qlex,\"No vertexes provided for hull.\");\n }\n\n if (!have_material) {\n err3(name,qlex,\"No material provided for hull.\");\n }\n}\n\n\nstatic void parse_box (const std::string &name,\n quex::tcol_lexer* qlex,\n TColBox &box)\n{\n ensure_token(name,qlex,QUEX_TKN_LBRACE);\n box.margin = DEFAULT_MARGIN;\n bool have_material = false;\n bool have_centre = false;\n box.qx = 0;\n box.qy = 0;\n box.qz = 0;\n box.qw = 1;\n bool have_dimensions = false;\n quex::Token t;\n while (true) {\n qlex->get_token(&t);\n switch (t.type_id()) {\n case QUEX_TKN_MARGIN:\n box.margin = parse_positive_real(name,qlex);\n if (more_to_come(name, qlex)) continue;\n break;\n\n case QUEX_TKN_MATERIAL:\n box.material = parse_material(name, qlex);\n have_material = true;\n if (more_to_come(name, qlex)) continue;\n break;\n\n case QUEX_TKN_CENTRE:\n box.px = parse_real(name,qlex);\n box.py = parse_real(name,qlex);\n box.pz = parse_real(name,qlex);\n have_centre = true;\n if (more_to_come(name, qlex)) continue;\n break;\n\n case QUEX_TKN_ORIENTATION:\n box.qw = parse_real(name,qlex);\n box.qx = parse_real(name,qlex);\n box.qy = parse_real(name,qlex);\n box.qz = parse_real(name,qlex);\n if (more_to_come(name, qlex)) continue;\n break;\n\n case QUEX_TKN_DIMENSIONS:\n box.dx = parse_real(name,qlex);\n box.dy = parse_real(name,qlex);\n box.dz = parse_real(name,qlex);\n have_dimensions = true;\n if (more_to_come(name, qlex)) continue;\n break;\n\n case QUEX_TKN_RBRACE:\n break;\n\n default:\n err4(name,qlex,t,\"margin, material, centre, orientation, or dimensions\");\n }\n break;\n }\n if (!have_material) {\n err3(name,qlex,\"No material provided for box.\");\n }\n if (!have_centre) {\n err3(name,qlex,\"No centre provided for box.\");\n }\n if (!have_dimensions) {\n err3(name,qlex,\"No dimensions provided for box.\");\n }\n}\n\n\nstatic void parse_cylinder (const std::string &name,\n quex::tcol_lexer* qlex,\n TColCylinder &cylinder)\n{\n ensure_token(name,qlex,QUEX_TKN_LBRACE);\n cylinder.margin = DEFAULT_MARGIN;\n bool have_material = false;\n bool have_centre = false;\n cylinder.qx = 0;\n cylinder.qy = 0;\n cylinder.qz = 0;\n cylinder.qw = 1;\n bool have_dimensions = false;\n quex::Token t;\n while (true) {\n qlex->get_token(&t);\n switch (t.type_id()) {\n case QUEX_TKN_MARGIN:\n cylinder.margin = parse_positive_real(name,qlex);\n if (more_to_come(name, qlex)) continue;\n break;\n\n case QUEX_TKN_MATERIAL:\n cylinder.material = parse_material(name, qlex);\n have_material = true;\n if (more_to_come(name, qlex)) continue;\n break;\n\n case QUEX_TKN_CENTRE:\n cylinder.px=parse_real(name,qlex);\n cylinder.py=parse_real(name,qlex);\n cylinder.pz=parse_real(name,qlex);\n have_centre = true;\n if (more_to_come(name, qlex)) continue;\n break;\n\n case QUEX_TKN_ORIENTATION:\n cylinder.qw=parse_real(name,qlex);\n cylinder.qx=parse_real(name,qlex);\n cylinder.qy=parse_real(name,qlex);\n cylinder.qz=parse_real(name,qlex);\n if (more_to_come(name, qlex)) continue;\n break;\n\n case QUEX_TKN_DIMENSIONS:\n cylinder.dx=parse_real(name,qlex);\n cylinder.dy=parse_real(name,qlex);\n cylinder.dz=parse_real(name,qlex);\n have_dimensions = true;\n if (more_to_come(name, qlex)) continue;\n break;\n\n case QUEX_TKN_RBRACE:\n break;\n\n default:\n err4(name,qlex,t,\"margin, material, centre, orientation or dimensions\");\n }\n break;\n }\n if (!have_material) {\n err3(name,qlex,\"No material provided for cylinder.\");\n }\n if (!have_dimensions) {\n err3(name,qlex,\"No dimensions provided for cylinder.\");\n }\n if (!have_centre) {\n err3(name,qlex,\"No centre provided for cylinder.\");\n }\n}\n\n\nstatic void parse_cone (const std::string &name,\n quex::tcol_lexer* qlex,\n TColCone &cone)\n{\n ensure_token(name,qlex,QUEX_TKN_LBRACE);\n cone.margin = DEFAULT_MARGIN;\n bool have_material = false;\n bool have_centre = false;\n cone.qx = 0;\n cone.qy = 0;\n cone.qz = 0;\n cone.qw = 1;\n bool have_radius = false;\n bool have_height = false;\n quex::Token t;\n while (true) {\n qlex->get_token(&t);\n switch (t.type_id()) {\n case QUEX_TKN_MARGIN:\n cone.margin = parse_positive_real(name,qlex);\n if (more_to_come(name, qlex)) continue;\n break;\n\n case QUEX_TKN_MATERIAL:\n cone.material = parse_material(name, qlex);\n have_material = true;\n if (more_to_come(name, qlex)) continue;\n break;\n\n case QUEX_TKN_CENTRE:\n cone.px=parse_real(name,qlex);\n cone.py=parse_real(name,qlex);\n cone.pz=parse_real(name,qlex);\n have_centre = true;\n if (more_to_come(name, qlex)) continue;\n break;\n\n case QUEX_TKN_ORIENTATION:\n cone.qw=parse_real(name,qlex);\n cone.qx=parse_real(name,qlex);\n cone.qy=parse_real(name,qlex);\n cone.qz=parse_real(name,qlex);\n if (more_to_come(name, qlex)) continue;\n break;\n\n case QUEX_TKN_RADIUS:\n cone.radius=parse_real(name,qlex);\n have_radius = true;\n if (more_to_come(name, qlex)) continue;\n break;\n\n case QUEX_TKN_HEIGHT:\n cone.height=parse_real(name,qlex);\n have_height = true;\n if (more_to_come(name, qlex)) continue;\n break;\n\n case QUEX_TKN_RBRACE:\n break;\n\n default:\n err4(name,qlex,t,\"margin, material, centre, height, orientation or radius\");\n }\n break;\n }\n if (!have_material) {\n err3(name,qlex,\"No material provided for cone.\");\n }\n if (!have_centre) {\n err3(name,qlex,\"No centre provided for cone.\");\n }\n if (!have_radius) {\n err3(name,qlex,\"No radius provided for cone.\");\n }\n if (!have_height) {\n err3(name,qlex,\"No height provided for cone.\");\n }\n}\n\n\nstatic void parse_plane (const std::string &name,\n quex::tcol_lexer* qlex,\n TColPlane &plane)\n{\n ensure_token(name,qlex,QUEX_TKN_LBRACE);\n ensure_token(name,qlex,QUEX_TKN_MATERIAL);\n plane.material = parse_material(name, qlex);\n ensure_token(name,qlex,QUEX_TKN_SEMI);\n ensure_token(name,qlex,QUEX_TKN_NORMAL);\n plane.nx = parse_real(name,qlex);\n plane.ny = parse_real(name,qlex);\n plane.nz = parse_real(name,qlex);\n ensure_token(name,qlex,QUEX_TKN_SEMI);\n ensure_token(name,qlex,QUEX_TKN_DISTANCE);\n plane.d = parse_real(name,qlex);\n if (more_to_come(name,qlex))\n ensure_token(name,qlex,QUEX_TKN_RBRACE);\n}\n\n\nstatic void parse_sphere (const std::string &name,\n quex::tcol_lexer* qlex,\n TColSphere &sphere)\n{\n ensure_token(name,qlex,QUEX_TKN_LBRACE);\n ensure_token(name,qlex,QUEX_TKN_MATERIAL);\n sphere.material = parse_material(name, qlex);\n ensure_token(name,qlex,QUEX_TKN_SEMI);\n ensure_token(name,qlex,QUEX_TKN_CENTRE);\n sphere.px = parse_real(name,qlex);\n sphere.py = parse_real(name,qlex);\n sphere.pz = parse_real(name,qlex);\n ensure_token(name,qlex,QUEX_TKN_SEMI);\n ensure_token(name,qlex,QUEX_TKN_RADIUS);\n sphere.radius = parse_real(name,qlex);\n if (more_to_come(name,qlex))\n ensure_token(name,qlex,QUEX_TKN_RBRACE);\n}\n\n\nstatic void parse_compound_shape (const std::string &name,\n quex::tcol_lexer* qlex,\n TColCompound &compound)\n{\n\n ensure_token(name,qlex,QUEX_TKN_LBRACE);\n\n while (true) {\n // define all these upfront since we're using a switch\n quex::Token t; qlex->get_token(&t);\n switch (t.type_id()) {\n case QUEX_TKN_HULL: ///////////////////////////////////\n parse_hull(name, qlex, vecnext(compound.hulls)); \n continue;\n\n case QUEX_TKN_BOX: ////////////////////////////////////\n parse_box(name,qlex,vecnext(compound.boxes));\n continue;\n\n case QUEX_TKN_CYLINDER: //////////////////////////////\n parse_cylinder(name,qlex,vecnext(compound.cylinders));\n continue;\n\n case QUEX_TKN_CONE: ///////////////////////////////////\n parse_cone(name,qlex,vecnext(compound.cones));\n continue;\n\n case QUEX_TKN_PLANE: //////////////////////////////////\n parse_plane(name,qlex,vecnext(compound.planes));\n continue;\n\n case QUEX_TKN_SPHERE: /////////////////////////////////\n parse_sphere(name,qlex,vecnext(compound.spheres));\n continue;\n\n case QUEX_TKN_RBRACE: /////////////////////////////////\n break;\n\n default:\n err4(name,qlex,t,\"compound, box, sphere, hull\");\n }\n\n break;\n }\n}\n\n\nstatic void parse_faces (const std::string &name,\n quex::tcol_lexer* qlex,\n size_t num_vertexes,\n TColFaces &faces)\n{\n ensure_token(name,qlex,QUEX_TKN_LBRACE);\n int v1, v2, v3;\n std::string material;\n\n while (true) {\n quex::Token t; qlex->get_token(&t);\n switch (t.type_id()) {\n case QUEX_TKN_NATURAL:\n v1 = get_int_from_token(name,qlex,t,num_vertexes);\n v2 = parse_int(name,qlex,num_vertexes);\n v3 = parse_int(name,qlex,num_vertexes);\n material = parse_material(name, qlex);\n faces.push_back(TColFace(v1,v2,v3,material));\n if (!more_to_come(name,qlex)) break;\n continue;\n\n case QUEX_TKN_RBRACE:\n break;\n\n default:\n err4(name,qlex,t,\"positive integer or }\");\n }\n\n break;\n }\n\n}\n\nstatic void parse_static_trimesh_shape (const std::string &name,\n quex::tcol_lexer* qlex,\n TColTriMesh &triMesh)\n{\n ensure_token(name,qlex,QUEX_TKN_LBRACE);\n\n triMesh.margin = 0.00;\n bool have_edge_distance_threshold = false;\n triMesh.edgeDistanceThreshold = 0.001f;\n\n do {\n quex::Token t; qlex->get_token(&t);\n switch (t.type_id()) {\n \n case QUEX_TKN_EDGE_DISTANCE_THRESHOLD:\n if (have_edge_distance_threshold)\n err3(name,qlex,\"Already have edge_distance_threshold\");\n have_edge_distance_threshold = true;\n triMesh.edgeDistanceThreshold = parse_positive_real(name,qlex);\n ensure_token(name,qlex,QUEX_TKN_SEMI);\n continue;\n \n case QUEX_TKN_VERTEXES:\n break;\n \n default:\n err4(name,qlex,t,\"edge_distance_threshold, vertexes\");\n }\n break;\n } while (true);\n\n parse_vertexes(name,qlex,triMesh.vertexes);\n\n ensure_token(name,qlex,QUEX_TKN_FACES);\n\n parse_faces(name, qlex, triMesh.vertexes.size(), triMesh.faces);\n\n ensure_token(name,qlex,QUEX_TKN_RBRACE);\n\n}\n\n\nstatic void parse_dynamic_trimesh_shape (const std::string &name,\n quex::tcol_lexer* qlex,\n TColTriMesh &triMesh)\n{\n ensure_token(name,qlex,QUEX_TKN_LBRACE);\n\n triMesh.margin = DEFAULT_MARGIN;\n triMesh.edgeDistanceThreshold = 0.001f;\n\n quex::Token t; qlex->get_token(&t);\n switch (t.type_id()) {\n\n case QUEX_TKN_MARGIN:\n triMesh.margin = parse_positive_real(name,qlex);\n ensure_token(name,qlex,QUEX_TKN_SEMI);\n ensure_token(name,qlex,QUEX_TKN_VERTEXES);\n break;\n\n case QUEX_TKN_VERTEXES:\n break;\n\n default:\n err4(name,qlex,t,\"margin, vertexes\");\n }\n\n parse_vertexes(name,qlex,triMesh.vertexes);\n\n ensure_token(name,qlex,QUEX_TKN_FACES);\n\n parse_faces(name,qlex,triMesh.vertexes.size(),triMesh.faces);\n\n ensure_token(name,qlex,QUEX_TKN_RBRACE);\n\n}\n\n\nvoid parse_tcol_1_0 (const std::string &name,\n quex::tcol_lexer* qlex,\n TColFile &file)\n{\n ensure_token(name,qlex,QUEX_TKN_TCOL);\n\n ensure_token(name,qlex,QUEX_TKN_ATTRIBUTES);\n ensure_token(name,qlex,QUEX_TKN_LBRACE);\n\n enum TriBool { UNKNOWN, YES, NO };\n\n TriBool is_static = UNKNOWN;\n bool have_inertia = false;\n file.inertia_x = 0;\n file.inertia_y = 0;\n file.inertia_z = 0;\n bool have_linear_damping = false;\n file.linearDamping = DEFAULT_LINEAR_DAMPING;\n bool have_angular_damping = false;\n file.angularDamping = DEFAULT_ANGULAR_DAMPING;\n bool have_linear_sleep_threshold = false;\n file.linearSleepThreshold = DEFAULT_LINEAR_SLEEP_THRESHOLD;\n bool have_angular_sleep_threshold = false;\n file.angularSleepThreshold = DEFAULT_ANGULAR_SLEEP_THRESHOLD;\n bool have_ccd_motion_threshold = false;\n file.ccdMotionThreshold = DEFAULT_CCD_MOTION_THRESHOLD;\n bool have_ccd_swept_sphere_radius = false;\n file.ccdSweptSphereRadius = DEFAULT_CCD_SWEPT_SPHERE_RADIUS;\n\n do {\n quex::Token t; qlex->get_token(&t);\n switch (t.type_id()) {\n\n case QUEX_TKN_STATIC:\n if (is_static==NO)\n err3(name,qlex,\"If static, do not give mass\");\n if (is_static==YES)\n err3(name,qlex,\"Already have static\");\n is_static = YES;\n file.mass = 0;\n if (more_to_come(name,qlex)) continue; break;\n\n case QUEX_TKN_MASS:\n if (is_static==YES)\n err3(name,qlex,\"If static, do not give mass\");\n if (is_static==NO)\n err3(name,qlex,\"Already have mass\");\n file.mass = parse_positive_real(name,qlex);\n if (file.mass == 0)\n err3(name,qlex,\"Mass of 0 is not allowed. Did you mean to use static?\");\n is_static = NO;\n if (more_to_come(name,qlex)) continue; break;\n\n case QUEX_TKN_INERTIA:\n if (have_inertia)\n err3(name,qlex,\"Already have inertia\");\n file.inertia_x = parse_real(name,qlex);\n file.inertia_y = parse_real(name,qlex);\n file.inertia_z = parse_real(name,qlex);\n have_inertia = true;\n if (more_to_come(name,qlex)) continue; break;\n\n case QUEX_TKN_LINEAR_DAMPING:\n if (have_linear_damping)\n err3(name,qlex,\"Already have linear_damping\");\n file.linearDamping = parse_positive_real(name,qlex);\n have_linear_damping = true;\n if (more_to_come(name,qlex)) continue; break;\n\n case QUEX_TKN_ANGULAR_DAMPING:\n if (have_angular_damping)\n err3(name,qlex,\"Already have angular_damping\");\n file.angularDamping = parse_positive_real(name,qlex);\n have_angular_damping = true;\n if (more_to_come(name,qlex)) continue; break;\n\n case QUEX_TKN_LINEAR_SLEEP_THRESHOLD:\n if (have_linear_sleep_threshold)\n err3(name,qlex, \"Already have linear_sleep_threshold\");\n file.linearSleepThreshold = parse_real(name,qlex);\n have_linear_sleep_threshold = true;\n if (more_to_come(name,qlex)) continue; break;\n\n case QUEX_TKN_ANGULAR_SLEEP_THRESHOLD:\n if (have_angular_sleep_threshold)\n err3(name,qlex, \"Already have angular_sleep_threshold\");\n file.angularSleepThreshold = parse_real(name,qlex);\n have_angular_sleep_threshold = true;\n if (more_to_come(name,qlex)) continue; break;\n\n case QUEX_TKN_CCD_MOTION_THRESHOLD:\n if (have_ccd_motion_threshold)\n err3(name,qlex, \"Already have ccd_motion_threshold\");\n file.ccdMotionThreshold = parse_real(name,qlex);\n have_ccd_motion_threshold = true;\n if (more_to_come(name,qlex)) continue; break;\n\n case QUEX_TKN_CCD_SWEPT_SPHERE_RADIUS:\n if (have_ccd_swept_sphere_radius)\n err3(name,qlex, \"Already have ccd_swept_sphere_radius\");\n file.ccdSweptSphereRadius = parse_real(name,qlex);\n have_ccd_swept_sphere_radius = true;\n if (more_to_come(name,qlex)) continue; break;\n\n case QUEX_TKN_RBRACE: break; \n\n default:\n err4(name,qlex,t,\"mass, linear_damping, angular_damping, etc or }\");\n\n }\n\n break;\n } while (true);\n\n if (is_static==UNKNOWN)\n err3(name,qlex,\"Need either static or mass\");\n\n\n file.usingTriMesh = false;\n file.usingCompound = false;\n file.hasInertia = have_inertia;\n\n quex::Token t; qlex->get_token(&t);\n switch (t.type_id()) {\n case QUEX_TKN_COMPOUND:\n file.usingCompound = true;\n parse_compound_shape(name,qlex,file.compound);\n qlex->get_token(&t);\n if (t.type_id()==QUEX_TKN_TERMINATION) break;\n if (t.type_id()!=QUEX_TKN_TRIMESH)\n err4(name,qlex,t,\"trimesh or EOF\");\n\n case QUEX_TKN_TRIMESH:\n if (is_static==YES) {\n file.usingTriMesh = true;\n parse_static_trimesh_shape(name,qlex,file.triMesh);\n } else {\n file.usingTriMesh = true;\n parse_dynamic_trimesh_shape(name,qlex,file.triMesh);\n }\n ensure_token(name,qlex,QUEX_TKN_TERMINATION);\n break;\n\n default: err4(name,qlex,t,\"compound or trimesh\");\n }\n\n\n}\n\nstatic void pretty_print_material (std::ostream &o, const std::string &material)\n{\n o << \"\\\"\" << material << \"\\\"\";\n}\n\nstatic void pretty_print_compound (std::ostream &o, TColCompound &c, const std::string &in)\n{\n o << in << \"compound {\\n\";\n\n for (size_t i=0 ; i<c.hulls.size() ; ++i) {\n TColHull &h = c.hulls[i];\n o<<in<<\"\\t\"<<\"hull {\\n\";\n o<<in<<\"\\t\\t\"<<\"material \"; pretty_print_material(o, h.material); o<<\";\\n\";\n if (ffar(h.margin,DEFAULT_MARGIN)) {\n o<<in<<\"\\t\\t\"<<\"margin \"<<h.margin<<\";\\n\";\n }\n o<<in<<\"\\t\\t\"<<\"vertexes {\\n\";\n for (unsigned j=0 ; j<h.vertexes.size() ; ++j) {\n Vector3 &v = h.vertexes[j];\n o<<in<<\"\\t\\t\\t\"<<v.x<<\" \"<<v.y<<\" \"<<v.z<<\";\"<<\"\\n\";\n }\n o<<in<<\"\\t\\t\"<<\"}\\n\";\n o<<in<<\"\\t\"<<\"}\\n\";\n }\n\n for (size_t i=0 ; i<c.boxes.size() ; ++i) {\n TColBox &b = c.boxes[i];\n o<<in<<\"\\t\"<<\"box {\\n\";\n o<<in<<\"\\t\\t\"<<\"material \"; pretty_print_material(o, b.material); o<<\";\\n\";\n if (ffar(b.margin,DEFAULT_MARGIN)) {\n o<<in<<\"\\t\\t\"<<\"margin \"<<b.margin<<\";\\n\";\n }\n o<<in<<\"\\t\\t\"<<\"centre \"<<b.px\n <<\" \"<<b.py<<\" \"<<b.pz<<\";\\n\";\n if (ffar(b.qw,1) && ffar(b.qx,0) &&\n ffar(b.qy,0) && ffar(b.qz,0)) {\n o<<in<<\"\\t\\t\"<<\"orientation \"<<b.qw<<\" \"<<b.qx\n <<\" \"<<b.qy<<\" \"<<b.qz<<\";\\n\";\n }\n o<<in<<\"\\t\\t\"<<\"dimensions \"<<b.dx<<\" \"<<b.dy\n <<\" \"<<b.dz<<\";\\n\";\n o<<in<<\"\\t\"<<\"}\\n\";\n }\n\n for (size_t i=0 ; i<c.cylinders.size() ; ++i) {\n TColCylinder &cyl = c.cylinders[i];\n o<<in<<\"\\t\"<<\"cylinder {\\n\";\n o<<in<<\"\\t\\t\"<<\"material \"; pretty_print_material(o, cyl.material); o<<\";\\n\";\n if (ffar(cyl.margin,DEFAULT_MARGIN)) {\n o<<in<<\"\\t\\t\"<<\"margin \"<<cyl.margin<<\";\\n\";\n }\n o<<in<<\"\\t\\t\"<<\"centre \"<<cyl.px\n <<\" \"<<cyl.py<<\" \"<<cyl.pz<<\";\\n\";\n if (ffar(cyl.qw,1) && ffar(cyl.qx,0) &&\n ffar(cyl.qy,0) && ffar(cyl.qz,0)) {\n o<<in<<\"\\t\\t\"<<\"orientation \"<<cyl.qw<<\" \"<<cyl.qx\n <<\" \"<<cyl.qy<<\" \"<<cyl.qz<<\";\\n\";\n }\n o<<in<<\"\\t\\t\"<<\"dimensions \"<<cyl.dx<<\" \"<<cyl.dy\n <<\" \"<<cyl.dz<<\";\\n\";\n o<<in<<\"\\t\"<<\"}\\n\";\n }\n\n for (size_t i=0 ; i<c.cones.size() ; ++i) {\n TColCone &cone = c.cones[i];\n o<<in<<\"\\t\"<<\"cone {\\n\";\n o<<in<<\"\\t\\t\"<<\"material \"; pretty_print_material(o, cone.material); o<<\";\\n\";\n if (ffar(cone.margin,DEFAULT_MARGIN)) {\n o<<in<<\"\\t\\t\"<<\"margin \"<<cone.margin<<\";\\n\";\n }\n o<<in<<\"\\t\\t\"<<\"centre \"<<cone.px\n <<\" \"<<cone.py<<\" \"<<cone.pz<<\";\\n\";\n if (ffar(cone.qw,1) && ffar(cone.qx,0) &&\n ffar(cone.qy,0) && ffar(cone.qz,0)) {\n o<<in<<\"\\t\\t\"<<\"orientation \"<<cone.qw<<\" \"<<cone.qx\n <<\" \"<<cone.qy<<\" \"<<cone.qz<<\";\\n\";\n }\n o<<in<<\"\\t\\t\"<<\"radius \"<<cone.radius<<\";\\n\";\n o<<in<<\"\\t\\t\"<<\"height \"<<cone.height<<\";\\n\";\n o<<in<<\"\\t\"<<\"}\\n\";\n }\n\n for (size_t i=0 ; i<c.planes.size() ; ++i) {\n TColPlane &p = c.planes[i];\n o<<in<<\"\\t\"<<\"plane {\\n\";\n o<<in<<\"\\t\\t\"<<\"material \"; pretty_print_material(o, p.material); o<<\";\\n\";\n o<<in<<\"\\t\\t\"<<\"normal \"<<p.nx<<\" \"<<p.ny<<\" \"<<p.nz<<\";\\n\";\n o<<in<<\"\\t\\t\"<<\"distance \"<<p.d<<\";\\n\";\n o<<in<<\"\\t\"<<\"}\\n\";\n }\n\n for (size_t i=0 ; i<c.spheres.size() ; ++i) {\n TColSphere &s = c.spheres[i];\n o<<in<<\"\\t\"<<\"sphere {\\n\";\n o<<in<<\"\\t\\t\"<<\"material \"; pretty_print_material(o, s.material); o<<\";\\n\";\n o<<in<<\"\\t\\t\"<<\"centre \"<<s.px<<\" \"<<s.py<<\" \"<<s.pz<<\";\\n\";\n o<<in<<\"\\t\\t\"<<\"radius \"<<s.radius<<\";\\n\";\n o<<in<<\"\\t\"<<\"}\\n\";\n }\n\n o << in << \"}\\n\";\n}\n\n\nvoid pretty_print_tcol (std::ostream &os, TColFile &f)\n{\n std::stringstream o;\n o << std::fixed; // use fixed point (no exponents)\n\n o << \"TCOL1.0\\n\\n\"\n << \"attributes {\\n\";\n if (f.mass==0) {\n o << \"\\tstatic;\\n\";\n } else {\n o << \"\\tmass \" << f.mass << \";\\n\";\n }\n/*\n o << \"\\tinertia \" << f.inertia_x << \" \"\n << f.inertia_y << \" \"\n << f.inertia_z << \";\\n\";\n*/\n if (ffar(f.linearDamping,DEFAULT_LINEAR_DAMPING))\n o << \"\\tlinear_damping \" << f.linearDamping << \";\\n\";\n if (ffar(f.angularDamping,DEFAULT_ANGULAR_DAMPING))\n o << \"\\tangular_damping \" << f.angularDamping << \";\\n\";\n if (ffar(f.linearSleepThreshold,DEFAULT_LINEAR_SLEEP_THRESHOLD))\n o << \"\\tlinear_sleep_threshold \" << f.linearSleepThreshold << \";\\n\";\n if (ffar(f.angularSleepThreshold,DEFAULT_ANGULAR_SLEEP_THRESHOLD))\n o << \"\\tangular_sleep_threshold \" << f.angularSleepThreshold << \";\\n\";\n if (ffar(f.ccdMotionThreshold,DEFAULT_CCD_MOTION_THRESHOLD))\n o << \"\\tccd_motion_threshold \" << f.ccdMotionThreshold << \";\\n\";\n if (ffar(f.ccdSweptSphereRadius,DEFAULT_CCD_SWEPT_SPHERE_RADIUS))\n o << \"\\tccd_swept_sphere_radius \" << f.ccdSweptSphereRadius << \";\\n\";\n o << \"}\\n\\n\";\n\n if (f.usingCompound) {\n pretty_print_compound(o,f.compound,\"\");\n }\n\n if (f.usingTriMesh) {\n o << \"trimesh {\\n\";\n o << \"\\tvertexes {\\n\";\n for (unsigned i=0 ; i<f.triMesh.vertexes.size() ; ++i) {\n Vector3 &v = f.triMesh.vertexes[i];\n o<<\"\\t\\t\"<<v.x<<\" \"<<v.y<<\" \"<<v.z<<\";\"<<\"\\n\";\n }\n o << \"\\t}\\n\";\n o << \"\\tfaces {\\n\";\n for (unsigned i=0 ; i<f.triMesh.faces.size() ; ++i) {\n TColFace &face = f.triMesh.faces[i];\n o<<\"\\t\\t\"<<face.v1<<\" \"<<face.v2<<\" \"<<face.v3<<\" \";\n pretty_print_material(o, face.material);\n o<<\";\"<<\"\\n\";\n }\n o << \"\\t}\\n\";\n o << \"}\\n\";\n }\n os << o.str();\n}\n\nvoid tcol_offset (TColFile &f, float x, float y, float z)\n{\n if (f.usingCompound) {\n TColCompound c = f.compound;\n for (size_t i=0 ; i<c.hulls.size() ; ++i) {\n TColHull &h = c.hulls[i];\n for (unsigned i=0 ; i<h.vertexes.size() ; ++i) {\n Vector3 &v = h.vertexes[i];\n v.x += x;\n v.y += y;\n v.z += z;\n }\n }\n\n for (size_t i=0 ; i<c.boxes.size() ; ++i) {\n TColBox &b = c.boxes[i];\n b.px += x;\n b.py += y;\n b.pz += z;\n }\n\n for (size_t i=0 ; i<c.cylinders.size() ; ++i) {\n TColCylinder &cyl = c.cylinders[i];\n cyl.px += x;\n cyl.py += y;\n cyl.pz += z;\n }\n\n for (size_t i=0 ; i<c.cones.size() ; ++i) {\n TColCone &cone = c.cones[i];\n cone.px += x;\n cone.py += y;\n cone.pz += z;\n }\n\n for (size_t i=0 ; i<c.planes.size() ; ++i) {\n TColPlane &p = c.planes[i];\n // The maths here may not actually be accurate\n p.d += p.nx*x + p.ny*y + p.nz*z;\n }\n\n for (size_t i=0 ; i<c.spheres.size() ; ++i) {\n TColSphere &s = c.spheres[i];\n s.px += x;\n s.py += y;\n s.pz += z;\n }\n }\n\n if (f.usingTriMesh) {\n for (unsigned i=0 ; i<f.triMesh.vertexes.size() ; ++i) {\n Vector3 &v = f.triMesh.vertexes[i];\n v.x += x;\n v.y += y;\n v.z += z;\n }\n }\n}\n\nvoid tcol_triangles_to_hulls (TColFile &tcol, float extrude_by, float margin)\n{\n if (tcol.usingTriMesh) {\n for (unsigned i=0 ; i<tcol.triMesh.faces.size() ; ++i) {\n TColFace &f = tcol.triMesh.faces[i];\n Vector3 v1 = tcol.triMesh.vertexes[f.v1];\n Vector3 v2 = tcol.triMesh.vertexes[f.v2];\n Vector3 v3 = tcol.triMesh.vertexes[f.v3];\n Vector3 n = ((v2-v1).cross(v3-v2)).normalisedCopy();\n v1 = v1 + margin*n;\n v2 = v2 + margin*n;\n v3 = v3 + margin*n;\n Vector3 v1_ex = v1 + extrude_by*n;\n Vector3 v2_ex = v2 + extrude_by*n;\n Vector3 v3_ex = v3 + extrude_by*n;\n\n TColHull &hull = vecnext(tcol.compound.hulls);\n hull.vertexes.push_back(v1);\n hull.vertexes.push_back(v2);\n hull.vertexes.push_back(v3);\n hull.vertexes.push_back(v1_ex);\n hull.vertexes.push_back(v2_ex);\n hull.vertexes.push_back(v3_ex);\n hull.material = f.material;\n hull.margin = margin;\n tcol.usingCompound = true; // in case the original tcol was only trimesh\n }\n tcol.triMesh.faces.clear();\n tcol.triMesh.vertexes.clear();\n tcol.usingTriMesh = false;\n }\n}\n" }, { "alpha_fraction": 0.7170501947402954, "alphanum_fraction": 0.7194037437438965, "avg_line_length": 29.349206924438477, "blob_id": "2d6fdc2d009245fa5aa2b4f35c6f7294edb59b41", "content_id": "5968b3e3b8b84528d165204de43eee435ff22a1e", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 3824, "license_type": "permissive", "max_line_length": 99, "num_lines": 126, "path": "/engine/gfx/gfx_instances.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include \"../shared_ptr.h\"\n\nclass GfxInstances;\ntypedef SharedPtr<GfxInstances> GfxInstancesPtr;\n\n\n#ifndef GFX_INSTANCES_H\n#define GFX_INSTANCES_H\n\n#include \"../dense_index_map.h\"\n\n#include \"gfx_disk_resource.h\"\n#include \"gfx_node.h\"\n#include \"gfx_fertile_node.h\"\n\nclass GfxInstances : public GfxNode, public Ogre::MovableObject {\n\n protected:\n\n static const std::string className;\n\n DenseIndexMap indexes;\n\n class Section;\n\n unsigned numSections;\n Section **sections;\n\n Ogre::MeshPtr mesh;\n Ogre::VertexData *sharedVertexData;\n Ogre::HardwareVertexBufferSharedPtr instBuf;\n std::vector<float> instBufRaw;\n bool dirty;\n bool enabled;\n const DiskResourcePtr<GfxMeshDiskResource> gdr;\n\n GfxInstances (const DiskResourcePtr<GfxMeshDiskResource> &gdr, const GfxNodePtr &par_);\n ~GfxInstances (void);\n\n public:\n static GfxInstancesPtr make (const std::string &mesh, const GfxNodePtr &par_=GfxNodePtr(NULL));\n\n unsigned int add (const Vector3 &pos, const Quaternion &q, float fade);\n // in future, perhaps 3d scale, skew, or general 3x3 matrix?\n void update (unsigned int inst, const Vector3 &pos, const Quaternion &q, float fade);\n void del (unsigned int inst);\n\n // don't call this reserve because a subclass wants to call its member function reserve\n void reserveSpace (unsigned new_capacity);\n\n void destroy (void);\n\n void setEnabled (bool v) { enabled = v; }\n bool isEnabled (void) { return enabled; }\n\n unsigned getCapacity (void) { return indexes.capacity(); }\n unsigned getInstances (void) { return indexes.size(); }\n unsigned getTrianglesPerInstance (void);\n unsigned getBatches (void);\n\n protected:\n\n void updateSections (void);\n void updateProperties (void);\n void reinitialise (void);\n\n void copyToGPU ();\n void copyToGPU (unsigned from, unsigned to, bool discard);\n\n\n // Stuff for Ogre::MovableObject\n\n Ogre::AxisAlignedBox mBoundingBox;\n Ogre::Real mBoundingRadius;\n\n public:\n\n virtual const Ogre::String& getMovableType (void) const\n {\n return className;\n }\n\n virtual const Ogre::AxisAlignedBox &getBoundingBox (void) const\n { return mBoundingBox; }\n\n virtual Ogre::Real getBoundingRadius (void) const\n { return mBoundingRadius; }\n\n virtual void setBoundingBox (const Ogre::AxisAlignedBox &b)\n { mBoundingBox = b; }\n\n virtual void setBoundingRadius (Ogre::Real v)\n { mBoundingRadius = v; }\n\n virtual void visitRenderables(Ogre::Renderable::Visitor *v, bool b);\n\n virtual void _updateRenderQueue(Ogre::RenderQueue *q);\n\n\n std::string getMeshName (void) const;\n\n friend class SharedPtr<GfxInstances>;\n};\n\n#endif\n" }, { "alpha_fraction": 0.6292110681533813, "alphanum_fraction": 0.6330490112304688, "avg_line_length": 31.87383270263672, "blob_id": "e695c3f138c40d8b68a3b5e836fe6ca2d05185e6", "content_id": "2de7e3974d199bedb144a5aab0d07e8ebeb474ee", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 14070, "license_type": "permissive", "max_line_length": 102, "num_lines": 428, "path": "/engine/gfx/clutter.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\nclass ClutterBuffer;\nclass ClutterFactory;\n\n#ifndef CLUTTER_H\n#define CLUTTER_H\n\n#include <cfloat>\n\n#include <math_util.h>\n\n#include \"../cache_friendly_range_space_simd.h\"\n\n#include \"../streamer.h\"\n\n\n// NOTE: BEFORE USING THESE IMPLEMENTATIONS, ONE MUST:\n //ogre_root->addMovableObjectFactory(new MovableClutterFactory());\n //ogre_root->addMovableObjectFactory(new RangedClutterFactory());\n\n\n// Provides an interface whereby a fixed size vertex buffer is used to render a\n// number of instances in a batch. The instances can be added / removed and\n// moved about arbitrarily.\n\n// There are two kinds of instance -- geometry (an entire mesh) and quads (just\n// a quad). By reserving an instance, you get a 'ticket' which can then be\n// used to update that instance (e.g. position, fade), or release it (i.e. stop\n// using it).\n\n// Current implementation: ?\n// ClutterBuffer manages a section for each material involved\n// fowards update calls to relevant sections\n// Section stores vertex buffers, also usage (records which triangle is used) -- sparse representation\n// data stores the data to be copied to the gpu (longer than usage by factor of 3 * vertex size)\n\n// New implementation:\n// -------------------\n\n// Use octree to cull aggressively? No. Issues with multiple frusta -- shadow\n// / reflection renders. Would be necessary to build several buffers or union\n// the frusta. Can't be bothered and probably would not be a great reduction\n// in polys anyway.\n\n// Rebuild buffer every frame ignoring frustum?\n\n// TODO: also need to play nice with the disk_resource subsystem\n\nclass ClutterBuffer {\n\n public:\n\n class Section : public Ogre::Renderable {\n protected:\n\n ClutterBuffer *mParent;\n Ogre::MaterialPtr mMaterial;\n Ogre::RenderOperation mRenderOperation;\n Ogre::VertexData mVertexData;\n\n std::vector<unsigned char> data;\n std::vector<bool> usage;\n unsigned marker;\n unsigned mDeclSize;\n unsigned first;\n unsigned last;\n unsigned usedTriangles;\n\n void updateFirstLast (void);\n \n struct BTicket {\n unsigned long offset;\n BTicket (void) : offset(0xFFFFFFFF) { }\n BTicket (unsigned offset_) : offset(offset_) { }\n BTicket (const BTicket &o) : offset(o.offset) { }\n bool valid (void) { return offset != 0xFFFFFFFF; }\n };\n\n public:\n\n // get a bit more type safety\n struct QTicket : public BTicket {\n QTicket (void) : BTicket() { }\n QTicket (unsigned offset_) : BTicket(offset_) { }\n QTicket (const QTicket &o) : BTicket(o.offset) { }\n };\n\n struct MTicket : public BTicket {\n MTicket (void) : BTicket() { }\n MTicket (unsigned offset_) : BTicket(offset_) { }\n MTicket (const MTicket &o) : BTicket(o.offset) { }\n };\n\n Section (ClutterBuffer *parent, unsigned triangles, const Ogre::MaterialPtr &m);\n ~Section (void);\n \n Ogre::RenderOperation *getRenderOperation (void) { return &mRenderOperation; }\n \n // Renderable overrides\n const Ogre::MaterialPtr& getMaterial (void) const { return mMaterial; }\n void getRenderOperation (Ogre::RenderOperation& op) { op = mRenderOperation; }\n void getWorldTransforms (Ogre::Matrix4* xform) const\n { xform[0] = Ogre::Matrix4::IDENTITY; }\n Ogre::Real getSquaredViewDepth (const Ogre::Camera *) const { return 0; }\n const Ogre::LightList &getLights (void) const\n { return mParent->mMovableObject->queryLights(); }\n \n \n MTicket reserveGeometry (Ogre::SubMesh *sm);\n void releaseGeometry (MTicket &t, Ogre::SubMesh *sm);\n void updateGeometry (const MTicket &t,\n const Ogre::SubMesh *sm,\n const Ogre::Vector3 &position,\n const Ogre::Quaternion &orientation,\n float vis);\n\n\n QTicket reserveQuad (void);\n void releaseQuad (QTicket &t);\n void updateQuad (const QTicket &t,\n const Ogre::Vector3 (&pos)[4],\n const Ogre::Vector3 (&norm)[4],\n const Ogre::Vector2 (&uv)[4],\n const Ogre::Vector3 (*tang)[4],\n float vis);\n\n void accumulateUtilisation (size_t &used, size_t &rendered, size_t &total);\n\n protected:\n\n void reserveTriangles (unsigned triangles, unsigned &off, unsigned &len);\n void releaseTriangles (unsigned off, unsigned len);\n \n };\n\n struct QTicket {\n Ogre::MaterialPtr m; // used as key to get the right Section\n Section::QTicket t;\n QTicket (void) { }\n QTicket (const Ogre::MaterialPtr &m_, const Section::QTicket &t_) : m(m_), t(t_) { }\n QTicket &operator= (const QTicket &o) { m=o.m; t=o.t; return *this; }\n bool valid (void) { return t.valid(); }\n };\n struct MTicket {\n Ogre::MeshPtr mesh; // need to look at the mesh each time it is updated\n Section::MTicket *ts;\n MTicket (void) : ts(NULL) { }\n MTicket (const Ogre::MeshPtr &mesh_,\n Section::MTicket *ts_) : mesh(mesh_), ts(ts_) { }\n MTicket &operator= (const MTicket &o) { mesh=o.mesh; ts=o.ts; return *this; }\n bool valid (void) { return ts != NULL; }\n };\n\n\n ClutterBuffer (Ogre::MovableObject *mobj, unsigned triangles, bool tangents);\n\n virtual ~ClutterBuffer (void);\n\n MTicket reserveGeometry (const Ogre::MeshPtr &mesh);\n void releaseGeometry (Section::MTicket *stkts, const Ogre::MeshPtr &mesh);\n void releaseGeometry (MTicket &t);\n void updateGeometry (const MTicket &t,\n const Ogre::Vector3 &position,\n const Ogre::Quaternion &orientation,\n float vis);\n\n QTicket reserveQuad (const Ogre::MaterialPtr &m);\n void releaseQuad (QTicket &t);\n void updateQuad (const QTicket &t,\n const Ogre::Vector3 (&pos)[4],\n const Ogre::Vector3 (&norm)[4],\n const Ogre::Vector2 (&uv)[4],\n const Ogre::Vector3 (*tang)[4],\n float vis);\n\n\n typedef std::map<Ogre::MaterialPtr, Section*> SectionMap;\n\n const SectionMap &getSections (void) { return sects; } \n\n void getUtilisation (size_t &used, size_t &rendered, size_t &total);\n\n\n protected:\n\n Ogre::MovableObject *mMovableObject;\n\n unsigned mTriangles;\n bool mTangents;\n\n SectionMap sects;\n\n Section &getOrCreateSection (const Ogre::MaterialPtr &m) {\n SectionMap::iterator i = sects.find(m);\n if (i==sects.end()) {\n Section *&s = sects[m];\n s = new Section(this, mTriangles, m);\n return *s;\n } else {\n return *i->second;\n }\n \n }\n\n};\n\n\n\n// Mainly for testing, wraps ClutterBuffer but provides a MovableObject\n// interface for Ogre's scenegraph, although it only has the identity transform\n// and its bounds are infinite\n\nclass MovableClutter : public Ogre::MovableObject {\n\n public:\n\n MovableClutter (const Ogre::String &name, unsigned triangles, bool tangents)\n : Ogre::MovableObject(name), clutter(this,triangles,tangents) { }\n\n virtual ~MovableClutter (void) { }\n\n virtual const Ogre::String& getMovableType (void) const\n {\n static const Ogre::String type = \"MovableClutter\";\n return type;\n }\n\n virtual const Ogre::AxisAlignedBox& getBoundingBox (void) const\n { return Ogre::AxisAlignedBox::BOX_INFINITE; }\n\n virtual Ogre::Real getBoundingRadius (void) const\n { return FLT_MAX; }\n\n virtual void visitRenderables(Ogre::Renderable::Visitor *v, bool b);\n virtual void _updateRenderQueue(Ogre::RenderQueue *q);\n\n\n ClutterBuffer::MTicket reserveGeometry (const Ogre::MeshPtr &mesh)\n { return clutter.reserveGeometry(mesh); }\n void releaseGeometry (ClutterBuffer::MTicket &t)\n { return clutter.releaseGeometry(t); }\n void updateGeometry (const ClutterBuffer::MTicket &t,\n const Ogre::Vector3 &position,\n const Ogre::Quaternion &orientation,\n float vis)\n { return clutter.updateGeometry(t,position,orientation,vis); }\n\n ClutterBuffer::QTicket reserveQuad (const Ogre::MaterialPtr &m)\n { return clutter.reserveQuad(m); }\n void releaseQuad (ClutterBuffer::QTicket &t)\n { return clutter.releaseQuad(t); }\n void updateQuad (const ClutterBuffer::QTicket &t,\n const Ogre::Vector3 (&pos)[4],\n const Ogre::Vector3 (&norm)[4],\n const Ogre::Vector2 (&uv)[4],\n const Ogre::Vector3 (*tang)[4],\n float vis)\n { return clutter.updateQuad(t,pos,norm,uv,tang,vis); }\n\n\n protected:\n\n ClutterBuffer clutter;\n\n};\n\nclass MovableClutterFactory : public Ogre::MovableObjectFactory {\n\n public:\n\n virtual const Ogre::String& getType (void) const\n {\n static const Ogre::String typeName = \"MovableClutter\";\n return typeName;\n }\n\n virtual Ogre::MovableObject* createInstanceImpl (\n const Ogre::String& name, const Ogre::NameValuePairList* params);\n\n virtual void destroyInstance (Ogre::MovableObject* obj);\n\n};\n\n\n\n// Object streams in\n// RangedClutter mobj created, initialised using scatter query\n// attached to same node as object entity\n// added to a table in streamer that updates it every frame\nclass RangedClutter : public Ogre::MovableObject, public StreamerCallback {\n\n public:\n\n RangedClutter (const Ogre::String &name, unsigned triangles, bool tangents)\n : Ogre::MovableObject(name),\n mItemRenderingDistance(40),\n mVisibility(1),\n mStepSize(100000),\n mBoundingBox(Ogre::AxisAlignedBox::BOX_INFINITE), mBoundingRadius(FLT_MAX),\n mClutter(this,triangles,tangents)\n { registerMe(); }\n\n virtual ~RangedClutter (void) { unregisterMe(); }\n\n void registerMe (void);\n void unregisterMe (void);\n\n virtual const Ogre::String& getMovableType (void) const\n {\n static const Ogre::String type = \"RangedClutter\";\n return type;\n }\n\n virtual const Ogre::AxisAlignedBox& getBoundingBox (void) const\n { return mBoundingBox; }\n\n virtual Ogre::Real getBoundingRadius (void) const\n { return mBoundingRadius; }\n\n virtual void setBoundingBox (const Ogre::AxisAlignedBox &b)\n { mBoundingBox = b; }\n\n virtual void setBoundingRadius (Ogre::Real v)\n { mBoundingRadius = v; }\n\n virtual void visitRenderables(Ogre::Renderable::Visitor *v, bool b);\n virtual void _updateRenderQueue(Ogre::RenderQueue *q);\n\n\n void update (const Vector3 &new_pos);\n\n // be compatible with std::vector\n void push_back (const SimpleTransform &t);\n void reserve (size_t s) {\n items.reserve(s);\n mSpace.reserve(s);\n };\n\n void setNextMesh (const Ogre::MeshPtr &m) { mNextMesh = m; }\n Ogre::MeshPtr getNextMesh (void) { return mNextMesh; }\n\n float mItemRenderingDistance;\n float mVisibility;\n float mStepSize;\n\n size_t size (void) { return mSpace.size(); }\n\n void getUtilisation (size_t &used, size_t &rendered, size_t &total);\n\n\n protected:\n\n struct Item {\n RangedClutter *parent;\n int index; // maintained by the RangeSpace class\n Ogre::MeshPtr mesh;\n Vector3 pos;\n Quaternion quat;\n bool activated;\n int activatedIndex;\n ClutterBuffer::MTicket ticket;\n float renderingDistance;\n float lastFade;\n void updateSphere (const Vector3 &pos_, float r_)\n {\n renderingDistance = r_;\n pos = pos_;\n parent->mSpace.updateSphere(index, pos.x, pos.y, pos.z, r_);\n }\n void updateIndex (int index_) { index = index_; }\n float range2 (const Vector3 &new_pos) const\n {\n return (new_pos-pos).length2() / renderingDistance / renderingDistance;\n }\n float calcFade (float range2);\n };\n typedef std::vector<Item> Items;\n\n Ogre::MeshPtr mNextMesh;\n Ogre::AxisAlignedBox mBoundingBox;\n Ogre::Real mBoundingRadius;\n ClutterBuffer mClutter;\n typedef CacheFriendlyRangeSpace<Item*> RS;\n typedef RS::Cargo Cargo;\n RS mSpace;\n Items items;\n Cargo activated;\n};\n\n\nclass RangedClutterFactory : public Ogre::MovableObjectFactory {\n\n public:\n\n virtual const Ogre::String& getType (void) const\n {\n static const Ogre::String typeName = \"RangedClutter\";\n return typeName;\n }\n\n virtual Ogre::MovableObject* createInstanceImpl (\n const Ogre::String& name, const Ogre::NameValuePairList* params);\n\n virtual void destroyInstance (Ogre::MovableObject* obj);\n\n};\n\n#endif\n" }, { "alpha_fraction": 0.6330750584602356, "alphanum_fraction": 0.6508907675743103, "avg_line_length": 36.16688919067383, "blob_id": "8c1c59966ec71cc059a506b90b82ea83b9ca9165", "content_id": "06e0369133541519eeb30229e30a4a286225214d", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 27616, "license_type": "permissive", "max_line_length": 99, "num_lines": 743, "path": "/engine/gfx/gfx_option.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016 \n * \n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */ \n\n#include <string>\n#include <map>\n\n#include \"gfx_internal.h\"\n#include \"gfx_pipeline.h\"\n#include \"gfx_option.h\"\n#include \"../option.h\"\n#include <centralised_log.h>\n \nGfxBoolOption gfx_bool_options[] = {\n GFX_AUTOUPDATE,\n GFX_SHADOW_RECEIVE,\n GFX_SHADOW_CAST,\n GFX_VSYNC,\n GFX_FULLSCREEN,\n\n GFX_FOG,\n GFX_WIREFRAME,\n GFX_WIREFRAME_SOLID,\n GFX_ANAGLYPH,\n GFX_CROSS_EYE,\n\n GFX_SHADOW_SIMPLE_OPTIMAL_ADJUST,\n GFX_SHADOW_AGGRESSIVE_FOCUS_REGION,\n GFX_SHADOW_FILTER_DITHER,\n GFX_SHADOW_FILTER_DITHER_TEXTURE,\n GFX_SHADOW_EMULATE_PCF,\n\n GFX_POST_PROCESSING,\n GFX_RENDER_PARTICLES,\n GFX_POINT_LIGHTS,\n GFX_RENDER_SKY,\n GFX_RENDER_HUD,\n\n GFX_RENDER_FIRST_PERSON,\n GFX_UPDATE_MATERIALS,\n}; \n\nGfxIntOption gfx_int_options[] = {\n GFX_FULLSCREEN_WIDTH,\n GFX_FULLSCREEN_HEIGHT,\n GFX_SHADOW_RES,\n GFX_SHADOW_FILTER_TAPS,\n GFX_BLOOM_ITERATIONS,\n GFX_RAM,\n GFX_DEBUG_MODE,\n}; \n \nGfxFloatOption gfx_float_options[] = {\n GFX_FOV,\n GFX_NEAR_CLIP,\n GFX_FAR_CLIP,\n GFX_FIRST_PERSON_NEAR_CLIP,\n GFX_FIRST_PERSON_FAR_CLIP,\n GFX_EYE_SEPARATION,\n GFX_MONITOR_HEIGHT,\n\n GFX_MONITOR_EYE_DISTANCE,\n GFX_MIN_PERCEIVED_DEPTH,\n GFX_MAX_PERCEIVED_DEPTH,\n GFX_SHADOW_START,\n GFX_SHADOW_END0,\n\n GFX_SHADOW_END1,\n GFX_SHADOW_END2,\n GFX_SHADOW_FADE_START,\n GFX_SHADOW_FILTER_SIZE,\n GFX_SHADOW_OPTIMAL_ADJUST0,\n\n GFX_SHADOW_OPTIMAL_ADJUST1,\n GFX_SHADOW_OPTIMAL_ADJUST2,\n GFX_SHADOW_LIGHT_DIRECTION_THRESHOLD,\n GFX_SHADOW_PADDING,\n GFX_SHADOW_SPREAD_FACTOR0,\n\n GFX_SHADOW_SPREAD_FACTOR1,\n GFX_SHADOW_SPREAD_FACTOR2,\n GFX_ANAGLYPH_LEFT_RED_MASK,\n GFX_ANAGLYPH_LEFT_GREEN_MASK,\n GFX_ANAGLYPH_LEFT_BLUE_MASK,\n\n GFX_ANAGLYPH_RIGHT_RED_MASK,\n GFX_ANAGLYPH_RIGHT_GREEN_MASK,\n GFX_ANAGLYPH_RIGHT_BLUE_MASK,\n GFX_ANAGLYPH_DESATURATION,\n GFX_BLOOM_THRESHOLD,\n};\n\nstatic std::map<GfxBoolOption,bool> options_bool;\nstatic std::map<GfxIntOption,int> options_int;\nstatic std::map<GfxFloatOption,float> options_float;\nstatic std::map<GfxBoolOption,bool> new_options_bool;\nstatic std::map<GfxIntOption,int> new_options_int;\nstatic std::map<GfxFloatOption,float> new_options_float;\n\nstatic std::map<GfxBoolOption,ValidOption<bool>*> valid_option_bool;\nstatic std::map<GfxIntOption,ValidOption<int>*> valid_option_int;\nstatic std::map<GfxFloatOption,ValidOption<float>*> valid_option_float;\n\nstatic void valid_option (GfxBoolOption o, ValidOption<bool> *v) { valid_option_bool[o] = v; }\nstatic void valid_option (GfxIntOption o, ValidOption<int> *v) { valid_option_int[o] = v; }\nstatic void valid_option (GfxFloatOption o, ValidOption<float> *v) { valid_option_float[o] = v; }\n\nstatic bool truefalse_[] = { false, true };\nstatic ValidOptionList<bool,bool[2]> *truefalse = new ValidOptionList<bool,bool[2]>(truefalse_);\n\n#define TO_STRING_MACRO(x) case x: return (&#x[4])\n\nstd::string gfx_option_to_string (GfxBoolOption o)\n{\n switch (o) {\n TO_STRING_MACRO(GFX_AUTOUPDATE);\n TO_STRING_MACRO(GFX_SHADOW_RECEIVE);\n TO_STRING_MACRO(GFX_SHADOW_CAST);\n TO_STRING_MACRO(GFX_VSYNC);\n TO_STRING_MACRO(GFX_FULLSCREEN);\n\n TO_STRING_MACRO(GFX_FOG);\n TO_STRING_MACRO(GFX_WIREFRAME);\n TO_STRING_MACRO(GFX_WIREFRAME_SOLID);\n TO_STRING_MACRO(GFX_ANAGLYPH);\n TO_STRING_MACRO(GFX_CROSS_EYE);\n\n TO_STRING_MACRO(GFX_SHADOW_SIMPLE_OPTIMAL_ADJUST);\n TO_STRING_MACRO(GFX_SHADOW_AGGRESSIVE_FOCUS_REGION);\n TO_STRING_MACRO(GFX_SHADOW_FILTER_DITHER);\n TO_STRING_MACRO(GFX_SHADOW_FILTER_DITHER_TEXTURE);\n TO_STRING_MACRO(GFX_SHADOW_EMULATE_PCF);\n\n TO_STRING_MACRO(GFX_POST_PROCESSING);\n TO_STRING_MACRO(GFX_RENDER_PARTICLES);\n TO_STRING_MACRO(GFX_POINT_LIGHTS);\n TO_STRING_MACRO(GFX_RENDER_SKY);\n TO_STRING_MACRO(GFX_RENDER_HUD);\n\n TO_STRING_MACRO(GFX_RENDER_FIRST_PERSON);\n TO_STRING_MACRO(GFX_UPDATE_MATERIALS);\n }\n return \"UNKNOWN_BOOL_OPTION\";\n}\nstd::string gfx_option_to_string (GfxIntOption o)\n{\n switch (o) {\n TO_STRING_MACRO(GFX_FULLSCREEN_WIDTH);\n TO_STRING_MACRO(GFX_FULLSCREEN_HEIGHT);\n TO_STRING_MACRO(GFX_SHADOW_RES);\n TO_STRING_MACRO(GFX_SHADOW_FILTER_TAPS);\n TO_STRING_MACRO(GFX_BLOOM_ITERATIONS);\n TO_STRING_MACRO(GFX_RAM);\n TO_STRING_MACRO(GFX_DEBUG_MODE);\n }\n return \"UNKNOWN_INT_OPTION\";\n}\nstd::string gfx_option_to_string (GfxFloatOption o)\n{\n switch (o) {\n TO_STRING_MACRO(GFX_FOV);\n TO_STRING_MACRO(GFX_NEAR_CLIP);\n TO_STRING_MACRO(GFX_FAR_CLIP);\n TO_STRING_MACRO(GFX_FIRST_PERSON_NEAR_CLIP);\n TO_STRING_MACRO(GFX_FIRST_PERSON_FAR_CLIP);\n TO_STRING_MACRO(GFX_EYE_SEPARATION);\n TO_STRING_MACRO(GFX_MONITOR_HEIGHT);\n\n TO_STRING_MACRO(GFX_MONITOR_EYE_DISTANCE);\n TO_STRING_MACRO(GFX_MIN_PERCEIVED_DEPTH);\n TO_STRING_MACRO(GFX_MAX_PERCEIVED_DEPTH);\n TO_STRING_MACRO(GFX_SHADOW_START);\n TO_STRING_MACRO(GFX_SHADOW_END0);\n\n TO_STRING_MACRO(GFX_SHADOW_END1);\n TO_STRING_MACRO(GFX_SHADOW_END2);\n TO_STRING_MACRO(GFX_SHADOW_FADE_START);\n TO_STRING_MACRO(GFX_SHADOW_FILTER_SIZE);\n TO_STRING_MACRO(GFX_SHADOW_OPTIMAL_ADJUST0);\n\n TO_STRING_MACRO(GFX_SHADOW_OPTIMAL_ADJUST1);\n TO_STRING_MACRO(GFX_SHADOW_OPTIMAL_ADJUST2);\n TO_STRING_MACRO(GFX_SHADOW_LIGHT_DIRECTION_THRESHOLD);\n TO_STRING_MACRO(GFX_SHADOW_PADDING);\n TO_STRING_MACRO(GFX_SHADOW_SPREAD_FACTOR0);\n\n TO_STRING_MACRO(GFX_SHADOW_SPREAD_FACTOR1);\n TO_STRING_MACRO(GFX_SHADOW_SPREAD_FACTOR2);\n TO_STRING_MACRO(GFX_ANAGLYPH_LEFT_RED_MASK);\n TO_STRING_MACRO(GFX_ANAGLYPH_LEFT_GREEN_MASK);\n TO_STRING_MACRO(GFX_ANAGLYPH_LEFT_BLUE_MASK);\n\n TO_STRING_MACRO(GFX_ANAGLYPH_RIGHT_RED_MASK);\n TO_STRING_MACRO(GFX_ANAGLYPH_RIGHT_GREEN_MASK);\n TO_STRING_MACRO(GFX_ANAGLYPH_RIGHT_BLUE_MASK);\n TO_STRING_MACRO(GFX_ANAGLYPH_DESATURATION);\n TO_STRING_MACRO(GFX_BLOOM_THRESHOLD);\n }\n return \"UNKNOWN_FLOAT_OPTION\";\n}\n\n#define FROM_STRING_MACRO(x,var,type) else if (s==(&#x[4])) { t = type; var = x; }\n#define FROM_STRING_BOOL_MACRO(x) FROM_STRING_MACRO(x,o0,0)\n#define FROM_STRING_INT_MACRO(x) FROM_STRING_MACRO(x,o1,1)\n#define FROM_STRING_FLOAT_MACRO(x) FROM_STRING_MACRO(x,o2,2)\n\n// set's t to either 0,1,2 and fills in the approriate argument\nvoid gfx_option_from_string (const std::string &s,\n int &t,\n GfxBoolOption &o0,\n GfxIntOption &o1,\n GfxFloatOption &o2)\n{\n if (s==\"AUTOUPDATE\") { t = 0; o0 = GFX_AUTOUPDATE; }\n FROM_STRING_BOOL_MACRO(GFX_SHADOW_RECEIVE)\n FROM_STRING_BOOL_MACRO(GFX_SHADOW_RECEIVE)\n FROM_STRING_BOOL_MACRO(GFX_SHADOW_CAST)\n FROM_STRING_BOOL_MACRO(GFX_VSYNC)\n FROM_STRING_BOOL_MACRO(GFX_FULLSCREEN)\n\n FROM_STRING_BOOL_MACRO(GFX_FOG)\n FROM_STRING_BOOL_MACRO(GFX_WIREFRAME)\n FROM_STRING_BOOL_MACRO(GFX_WIREFRAME_SOLID)\n FROM_STRING_BOOL_MACRO(GFX_ANAGLYPH)\n FROM_STRING_BOOL_MACRO(GFX_CROSS_EYE)\n\n FROM_STRING_BOOL_MACRO(GFX_SHADOW_SIMPLE_OPTIMAL_ADJUST)\n FROM_STRING_BOOL_MACRO(GFX_SHADOW_AGGRESSIVE_FOCUS_REGION)\n FROM_STRING_BOOL_MACRO(GFX_SHADOW_FILTER_DITHER)\n FROM_STRING_BOOL_MACRO(GFX_SHADOW_FILTER_DITHER_TEXTURE)\n FROM_STRING_BOOL_MACRO(GFX_SHADOW_EMULATE_PCF)\n\n FROM_STRING_BOOL_MACRO(GFX_POST_PROCESSING)\n FROM_STRING_BOOL_MACRO(GFX_RENDER_PARTICLES)\n FROM_STRING_BOOL_MACRO(GFX_POINT_LIGHTS)\n FROM_STRING_BOOL_MACRO(GFX_RENDER_SKY)\n FROM_STRING_BOOL_MACRO(GFX_RENDER_HUD)\n\n FROM_STRING_BOOL_MACRO(GFX_RENDER_FIRST_PERSON)\n FROM_STRING_BOOL_MACRO(GFX_UPDATE_MATERIALS)\n\n\n FROM_STRING_INT_MACRO(GFX_FULLSCREEN_WIDTH)\n FROM_STRING_INT_MACRO(GFX_FULLSCREEN_HEIGHT)\n FROM_STRING_INT_MACRO(GFX_SHADOW_RES)\n FROM_STRING_INT_MACRO(GFX_SHADOW_FILTER_TAPS)\n FROM_STRING_INT_MACRO(GFX_BLOOM_ITERATIONS)\n\n FROM_STRING_INT_MACRO(GFX_RAM)\n FROM_STRING_INT_MACRO(GFX_DEBUG_MODE)\n\n\n FROM_STRING_FLOAT_MACRO(GFX_FOV)\n FROM_STRING_FLOAT_MACRO(GFX_NEAR_CLIP)\n FROM_STRING_FLOAT_MACRO(GFX_FAR_CLIP)\n FROM_STRING_FLOAT_MACRO(GFX_FIRST_PERSON_NEAR_CLIP)\n FROM_STRING_FLOAT_MACRO(GFX_FIRST_PERSON_FAR_CLIP)\n FROM_STRING_FLOAT_MACRO(GFX_EYE_SEPARATION)\n FROM_STRING_FLOAT_MACRO(GFX_MONITOR_HEIGHT)\n\n FROM_STRING_FLOAT_MACRO(GFX_MONITOR_EYE_DISTANCE)\n FROM_STRING_FLOAT_MACRO(GFX_MIN_PERCEIVED_DEPTH)\n FROM_STRING_FLOAT_MACRO(GFX_MAX_PERCEIVED_DEPTH)\n FROM_STRING_FLOAT_MACRO(GFX_SHADOW_START)\n FROM_STRING_FLOAT_MACRO(GFX_SHADOW_END0)\n\n FROM_STRING_FLOAT_MACRO(GFX_SHADOW_END1)\n FROM_STRING_FLOAT_MACRO(GFX_SHADOW_END2)\n FROM_STRING_FLOAT_MACRO(GFX_SHADOW_FADE_START)\n FROM_STRING_FLOAT_MACRO(GFX_SHADOW_FILTER_SIZE)\n FROM_STRING_FLOAT_MACRO(GFX_SHADOW_OPTIMAL_ADJUST0)\n\n FROM_STRING_FLOAT_MACRO(GFX_SHADOW_OPTIMAL_ADJUST1)\n FROM_STRING_FLOAT_MACRO(GFX_SHADOW_OPTIMAL_ADJUST2)\n FROM_STRING_FLOAT_MACRO(GFX_SHADOW_LIGHT_DIRECTION_THRESHOLD)\n FROM_STRING_FLOAT_MACRO(GFX_SHADOW_PADDING)\n FROM_STRING_FLOAT_MACRO(GFX_SHADOW_SPREAD_FACTOR0)\n\n FROM_STRING_FLOAT_MACRO(GFX_SHADOW_SPREAD_FACTOR1)\n FROM_STRING_FLOAT_MACRO(GFX_SHADOW_SPREAD_FACTOR2)\n FROM_STRING_FLOAT_MACRO(GFX_ANAGLYPH_LEFT_RED_MASK)\n FROM_STRING_FLOAT_MACRO(GFX_ANAGLYPH_LEFT_GREEN_MASK)\n FROM_STRING_FLOAT_MACRO(GFX_ANAGLYPH_LEFT_BLUE_MASK)\n\n FROM_STRING_FLOAT_MACRO(GFX_ANAGLYPH_RIGHT_RED_MASK)\n FROM_STRING_FLOAT_MACRO(GFX_ANAGLYPH_RIGHT_GREEN_MASK)\n FROM_STRING_FLOAT_MACRO(GFX_ANAGLYPH_RIGHT_BLUE_MASK)\n FROM_STRING_FLOAT_MACRO(GFX_ANAGLYPH_DESATURATION)\n FROM_STRING_FLOAT_MACRO(GFX_BLOOM_THRESHOLD)\n\n else t = -1;\n}\n\n/* Transfer settings to lower level components.\n *\n * Will regenerate anything if new_options differs to old_options, or the called can force\n * regeneration by setting 'flush'.\n */\nstatic void options_update (bool flush)\n{\n bool reset_fullscreen = flush;\n bool reset_shadowmaps = flush;\n bool reset_shadows = flush;\n bool reset_pcss = flush;\n bool reset_framebuffer = flush;\n bool reset_shadow_spread = flush;\n bool reset_shadow_dither_mode = flush;\n\n for (unsigned i=0 ; i<sizeof(gfx_bool_options)/sizeof(*gfx_bool_options) ; ++i) {\n GfxBoolOption o = gfx_bool_options[i];\n bool v_old = options_bool[o];\n bool v_new = new_options_bool[o];\n if (v_old == v_new) continue;\n switch (o) {\n case GFX_AUTOUPDATE: break;\n case GFX_CROSS_EYE:\n case GFX_ANAGLYPH:\n reset_framebuffer = true;\n break;\n case GFX_SHADOW_RECEIVE:\n break;\n case GFX_SHADOW_CAST:\n reset_shadows = true;\n break;\n case GFX_VSYNC:\n ogre_win->setVSyncEnabled(v_new);\n break;\n case GFX_FULLSCREEN:\n reset_fullscreen = true;\n break;\n case GFX_FOG:\n break;\n case GFX_WIREFRAME_SOLID:\n break;\n case GFX_WIREFRAME:\n break;\n case GFX_SHADOW_SIMPLE_OPTIMAL_ADJUST:\n reset_pcss = true;\n break;\n case GFX_SHADOW_AGGRESSIVE_FOCUS_REGION:\n reset_pcss = true;\n break;\n case GFX_SHADOW_FILTER_DITHER:\n case GFX_SHADOW_FILTER_DITHER_TEXTURE:\n reset_shadow_dither_mode = true;\n break;\n case GFX_SHADOW_EMULATE_PCF: break;\n case GFX_POST_PROCESSING: break;\n case GFX_RENDER_PARTICLES: break;\n case GFX_POINT_LIGHTS: break;\n case GFX_RENDER_SKY: break;\n case GFX_RENDER_HUD: break;\n case GFX_RENDER_FIRST_PERSON: break;\n case GFX_UPDATE_MATERIALS: break;\n }\n }\n for (unsigned i=0 ; i<sizeof(gfx_int_options)/sizeof(*gfx_int_options) ; ++i) {\n GfxIntOption o = gfx_int_options[i];\n int v_old = options_int[o];\n int v_new = new_options_int[o];\n if (v_old == v_new) continue;\n switch (o) {\n case GFX_FULLSCREEN_WIDTH:\n reset_fullscreen = true;\n break;\n case GFX_FULLSCREEN_HEIGHT:\n reset_fullscreen = true;\n break;\n case GFX_RAM:\n break;\n case GFX_DEBUG_MODE:\n break;\n case GFX_SHADOW_RES:\n shader_scene_env.shadowRes = v_new;\n reset_shadowmaps = true;\n break;\n case GFX_SHADOW_FILTER_TAPS:\n shader_scene_env.shadowFilterTaps = v_new;\n break;\n case GFX_BLOOM_ITERATIONS: break;\n }\n }\n for (unsigned i=0 ; i<sizeof(gfx_float_options)/sizeof(*gfx_float_options) ; ++i) {\n GfxFloatOption o = gfx_float_options[i];\n float v_old = options_float[o];\n float v_new = new_options_float[o];\n if (v_old == v_new) continue;\n switch (o) {\n // the following read every frame\n case GFX_FOV:\n case GFX_NEAR_CLIP:\n case GFX_FAR_CLIP:\n case GFX_FIRST_PERSON_NEAR_CLIP:\n case GFX_FIRST_PERSON_FAR_CLIP:\n case GFX_EYE_SEPARATION:\n case GFX_MONITOR_HEIGHT:\n case GFX_MONITOR_EYE_DISTANCE:\n case GFX_MIN_PERCEIVED_DEPTH:\n case GFX_MAX_PERCEIVED_DEPTH:\n break;\n case GFX_SHADOW_START:\n shader_scene_env.shadowFadeStart = v_new;\n reset_pcss = true;\n break;\n case GFX_SHADOW_END0:\n shader_scene_env.shadowDist[0] = v_new;\n reset_pcss = true;\n break;\n break;\n case GFX_SHADOW_END1:\n shader_scene_env.shadowDist[1] = v_new;\n reset_pcss = true;\n break;\n case GFX_SHADOW_END2:\n shader_scene_env.shadowDist[2] = v_new;\n shader_scene_env.shadowFadeEnd = v_new;\n reset_pcss = true;\n break;\n case GFX_SHADOW_OPTIMAL_ADJUST0:\n case GFX_SHADOW_OPTIMAL_ADJUST1:\n case GFX_SHADOW_OPTIMAL_ADJUST2:\n case GFX_SHADOW_LIGHT_DIRECTION_THRESHOLD:\n case GFX_SHADOW_PADDING:\n reset_pcss = true;\n break;\n case GFX_SHADOW_SPREAD_FACTOR0:\n reset_shadow_spread = true;\n break;\n case GFX_SHADOW_SPREAD_FACTOR1:\n reset_shadow_spread = true;\n break;\n case GFX_SHADOW_SPREAD_FACTOR2:\n reset_shadow_spread = true;\n break;\n case GFX_SHADOW_FADE_START:\n shader_scene_env.shadowFadeStart = v_new;\n break;\n case GFX_SHADOW_FILTER_SIZE:\n reset_shadow_spread = true;\n break;\n case GFX_ANAGLYPH_LEFT_RED_MASK:\n case GFX_ANAGLYPH_LEFT_GREEN_MASK:\n case GFX_ANAGLYPH_LEFT_BLUE_MASK:\n case GFX_ANAGLYPH_RIGHT_RED_MASK:\n case GFX_ANAGLYPH_RIGHT_GREEN_MASK:\n case GFX_ANAGLYPH_RIGHT_BLUE_MASK:\n case GFX_ANAGLYPH_DESATURATION:\n break;\n case GFX_BLOOM_THRESHOLD:\n break;\n }\n }\n\n options_bool = new_options_bool;\n options_int = new_options_int;\n options_float = new_options_float;\n\n if (reset_shadow_dither_mode) {\n if (gfx_option(GFX_SHADOW_FILTER_DITHER_TEXTURE)) {\n shader_scene_env.shadowDitherMode = GfxGslConfigEnvironment::SHADOW_DITHER_NOISE;\n } else if (gfx_option(GFX_SHADOW_FILTER_DITHER)) {\n shader_scene_env.shadowDitherMode = GfxGslConfigEnvironment::SHADOW_DITHER_PLAIN;\n } else {\n shader_scene_env.shadowDitherMode = GfxGslConfigEnvironment::SHADOW_DITHER_NONE;\n }\n }\n\n if (reset_shadow_spread) {\n shader_scene_env.shadowSpread[0] = gfx_option(GFX_SHADOW_SPREAD_FACTOR0)\n * gfx_option(GFX_SHADOW_FILTER_SIZE);\n shader_scene_env.shadowSpread[1] = gfx_option(GFX_SHADOW_SPREAD_FACTOR1)\n * gfx_option(GFX_SHADOW_FILTER_SIZE);\n shader_scene_env.shadowSpread[2] = gfx_option(GFX_SHADOW_SPREAD_FACTOR2)\n * gfx_option(GFX_SHADOW_FILTER_SIZE);\n shader_scene_env.shadowFilterSize = gfx_option(GFX_SHADOW_FILTER_SIZE);\n }\n\n if (reset_shadowmaps) {\n ogre_sm->setShadowTextureCountPerLightType(Ogre::Light::LT_DIRECTIONAL, 3);\n ogre_sm->setShadowTextureSettings(options_int[GFX_SHADOW_RES], 3, Ogre::PF_FLOAT32_R);\n }\n\n if (reset_pcss) {\n\n Ogre::PSSMShadowCameraSetup *p = new Ogre::PSSMShadowCameraSetup();\n\n p->setOptimalAdjustFactor(0, gfx_option(GFX_SHADOW_OPTIMAL_ADJUST0));\n p->setOptimalAdjustFactor(1, gfx_option(GFX_SHADOW_OPTIMAL_ADJUST1));\n p->setOptimalAdjustFactor(2, gfx_option(GFX_SHADOW_OPTIMAL_ADJUST2));\n\n p->setUseAggressiveFocusRegion(gfx_option(GFX_SHADOW_AGGRESSIVE_FOCUS_REGION));\n\n p->setCameraLightDirectionThreshold(\n Ogre::Degree(gfx_option(GFX_SHADOW_LIGHT_DIRECTION_THRESHOLD)));\n p->setUseSimpleOptimalAdjust(gfx_option(GFX_SHADOW_SIMPLE_OPTIMAL_ADJUST));\n\n Ogre::PSSMShadowCameraSetup::SplitPointList boundaries;\n boundaries.push_back(gfx_option(GFX_SHADOW_START));\n boundaries.push_back(gfx_option(GFX_SHADOW_END0));\n boundaries.push_back(gfx_option(GFX_SHADOW_END1));\n boundaries.push_back(gfx_option(GFX_SHADOW_END2));\n p->setSplitPoints(boundaries);\n p->setSplitPadding(gfx_option(GFX_SHADOW_PADDING));\n\n ogre_sm->setShadowCameraSetup(Ogre::ShadowCameraSetupPtr(p));\n\n }\n\n if (reset_shadows) {\n if (gfx_option(GFX_SHADOW_CAST)) {\n ogre_sm->setShadowTechnique(Ogre::SHADOWTYPE_TEXTURE_MODULATIVE_INTEGRATED);\n } else {\n ogre_sm->setShadowTechnique(Ogre::SHADOWTYPE_NONE);\n }\n }\n\n if (reset_fullscreen) {\n unsigned width = gfx_option(GFX_FULLSCREEN_WIDTH);\n unsigned height = gfx_option(GFX_FULLSCREEN_HEIGHT);\n\n if (gfx_option(GFX_FULLSCREEN)) {\n if (ogre_win->isFullScreen()) {\n if (ogre_win->getWidth()!=width || ogre_win->getHeight()!=height) {\n ogre_win->setFullscreen(true, width, height);\n }\n } else {\n ogre_win->setFullscreen(true, width, height);\n }\n } else {\n if (ogre_win->isFullScreen()) {\n ogre_win->setFullscreen(false, 640, 480);\n }\n }\n }\n\n if (reset_framebuffer) {\n do_reset_framebuffer();\n }\n\n}\n\nvoid gfx_option_reset (void)\n{\n gfx_option(GFX_SHADOW_RECEIVE, true);\n gfx_option(GFX_SHADOW_CAST, true);\n gfx_option(GFX_VSYNC, true);\n gfx_option(GFX_FULLSCREEN, false);\n\n gfx_option(GFX_FOG, true);\n gfx_option(GFX_WIREFRAME, false);\n gfx_option(GFX_WIREFRAME_SOLID, true);\n gfx_option(GFX_ANAGLYPH, false);\n gfx_option(GFX_CROSS_EYE, false);\n\n gfx_option(GFX_SHADOW_SIMPLE_OPTIMAL_ADJUST, true);\n gfx_option(GFX_SHADOW_AGGRESSIVE_FOCUS_REGION, true);\n gfx_option(GFX_SHADOW_FILTER_DITHER, false);\n gfx_option(GFX_SHADOW_FILTER_DITHER_TEXTURE, true);\n gfx_option(GFX_SHADOW_EMULATE_PCF, false);\n\n gfx_option(GFX_POST_PROCESSING, true);\n gfx_option(GFX_RENDER_PARTICLES, true);\n gfx_option(GFX_POINT_LIGHTS, true);\n gfx_option(GFX_RENDER_SKY, true);\n gfx_option(GFX_RENDER_HUD, true);\n\n gfx_option(GFX_RENDER_FIRST_PERSON, true);\n gfx_option(GFX_UPDATE_MATERIALS, true);\n\n\n gfx_option(GFX_FULLSCREEN_WIDTH, 800);\n gfx_option(GFX_FULLSCREEN_HEIGHT, 600);\n gfx_option(GFX_SHADOW_RES, 1024);\n gfx_option(GFX_SHADOW_FILTER_TAPS, 4);\n gfx_option(GFX_BLOOM_ITERATIONS, 0);\n gfx_option(GFX_RAM, 128);\n gfx_option(GFX_DEBUG_MODE, 0);\n\n\n gfx_option(GFX_FOV, 55.0f);\n gfx_option(GFX_NEAR_CLIP, 0.355f);\n gfx_option(GFX_FAR_CLIP, 1000.0f);\n gfx_option(GFX_FIRST_PERSON_NEAR_CLIP, 0.01f);\n gfx_option(GFX_FIRST_PERSON_FAR_CLIP, 10.0f);\n\n gfx_option(GFX_EYE_SEPARATION, 0.06f);\n gfx_option(GFX_MONITOR_HEIGHT, 0.27f);\n gfx_option(GFX_MONITOR_EYE_DISTANCE, 0.6f);\n gfx_option(GFX_MIN_PERCEIVED_DEPTH, 0.3f);\n gfx_option(GFX_MAX_PERCEIVED_DEPTH, 2.0f);\n\n gfx_option(GFX_SHADOW_START, 0.2f);\n gfx_option(GFX_SHADOW_END0, 20.0f);\n gfx_option(GFX_SHADOW_END1, 50.0f);\n gfx_option(GFX_SHADOW_END2, 200.0f);\n gfx_option(GFX_SHADOW_FADE_START, 150.0f);\n\n gfx_option(GFX_SHADOW_FILTER_SIZE, 4.0f);\n gfx_option(GFX_SHADOW_OPTIMAL_ADJUST0, 3.0f);\n gfx_option(GFX_SHADOW_OPTIMAL_ADJUST1, 1.0f);\n gfx_option(GFX_SHADOW_OPTIMAL_ADJUST2, 1.0f);\n gfx_option(GFX_SHADOW_SPREAD_FACTOR0, 1.0f);\n\n gfx_option(GFX_SHADOW_SPREAD_FACTOR1, 1.0f);\n gfx_option(GFX_SHADOW_SPREAD_FACTOR2, 0.28f);\n gfx_option(GFX_SHADOW_LIGHT_DIRECTION_THRESHOLD, 35.0f);\n gfx_option(GFX_SHADOW_PADDING, 0.8f);\n gfx_option(GFX_ANAGLYPH_LEFT_RED_MASK, 1.0f);\n\n gfx_option(GFX_ANAGLYPH_LEFT_GREEN_MASK, 0.0f);\n gfx_option(GFX_ANAGLYPH_LEFT_BLUE_MASK, 0.0f);\n gfx_option(GFX_ANAGLYPH_RIGHT_RED_MASK, 0.0f);\n gfx_option(GFX_ANAGLYPH_RIGHT_GREEN_MASK, 1.0f);\n gfx_option(GFX_ANAGLYPH_RIGHT_BLUE_MASK, 1.0f);\n\n gfx_option(GFX_ANAGLYPH_DESATURATION, 0.5f);\n gfx_option(GFX_BLOOM_THRESHOLD, 1.0f);\n\n}\n\nvoid gfx_option_init (void)\n{\n for (unsigned i=0 ; i<sizeof(gfx_bool_options)/sizeof(gfx_bool_options[0]) ; ++i)\n valid_option(gfx_bool_options[i], truefalse);\n\n valid_option(GFX_FULLSCREEN_WIDTH, new ValidOptionRange<int>(1,10000));\n valid_option(GFX_FULLSCREEN_HEIGHT, new ValidOptionRange<int>(1,10000));\n int res_list[] = {512,1024,2048,4096};\n valid_option(GFX_SHADOW_RES, new ValidOptionList<int,int[4]>(res_list));\n int filter_taps_list[] = {1,4,9,16,36};\n valid_option(GFX_SHADOW_FILTER_TAPS, new ValidOptionList<int,int[5]>(filter_taps_list));\n valid_option(GFX_BLOOM_ITERATIONS, new ValidOptionRange<int>(0,255));\n valid_option(GFX_RAM, new ValidOptionRange<int>(0,16384));\n valid_option(GFX_DEBUG_MODE, new ValidOptionRange<int>(0,8));\n\n\n valid_option(GFX_FOV, new ValidOptionRange<float>(0.0000001f,179.0f));\n valid_option(GFX_NEAR_CLIP, new ValidOptionRange<float>(0.0000001f,10000.0f));\n valid_option(GFX_FAR_CLIP, new ValidOptionRange<float>(0.0000001f,10000.0f));\n valid_option(GFX_FIRST_PERSON_NEAR_CLIP, new ValidOptionRange<float>(0.0000001f,10000.0f));\n valid_option(GFX_FIRST_PERSON_FAR_CLIP, new ValidOptionRange<float>(0.0000001f,10000.0f));\n\n valid_option(GFX_EYE_SEPARATION, new ValidOptionRange<float>(0.0f,0.5f));\n valid_option(GFX_MONITOR_HEIGHT, new ValidOptionRange<float>(0.01f,1000.0f));\n valid_option(GFX_MONITOR_EYE_DISTANCE, new ValidOptionRange<float>(0.01f,1000.0f));\n valid_option(GFX_MIN_PERCEIVED_DEPTH, new ValidOptionRange<float>(0.01f,1000.0f));\n valid_option(GFX_MAX_PERCEIVED_DEPTH, new ValidOptionRange<float>(0.01f,1000.0f));\n\n valid_option(GFX_SHADOW_START, new ValidOptionRange<float>(0.0f,10000.0f));\n valid_option(GFX_SHADOW_END0, new ValidOptionRange<float>(0.0f,10000.0f));\n valid_option(GFX_SHADOW_END1, new ValidOptionRange<float>(0.0f,10000.0f));\n valid_option(GFX_SHADOW_END2, new ValidOptionRange<float>(0.0f,10000.0f));\n valid_option(GFX_SHADOW_FADE_START, new ValidOptionRange<float>(0.0f,10000.0f));\n\n valid_option(GFX_SHADOW_FILTER_SIZE, new ValidOptionRange<float>(0.0f,40.0f));\n valid_option(GFX_SHADOW_OPTIMAL_ADJUST0, new ValidOptionRange<float>(0.0f,10000.0f));\n valid_option(GFX_SHADOW_OPTIMAL_ADJUST1, new ValidOptionRange<float>(0.0f,10000.0f));\n valid_option(GFX_SHADOW_OPTIMAL_ADJUST2, new ValidOptionRange<float>(0.0f,10000.0f));\n valid_option(GFX_SHADOW_SPREAD_FACTOR0, new ValidOptionRange<float>(0.0f,20.0f));\n\n valid_option(GFX_SHADOW_SPREAD_FACTOR1, new ValidOptionRange<float>(0.0f,20.0f));\n valid_option(GFX_SHADOW_SPREAD_FACTOR2, new ValidOptionRange<float>(0.0f,20.0f));\n valid_option(GFX_SHADOW_LIGHT_DIRECTION_THRESHOLD, new ValidOptionRange<float>(0.0f,10000.0f));\n valid_option(GFX_SHADOW_PADDING, new ValidOptionRange<float>(0.0f,100.0f));\n valid_option(GFX_ANAGLYPH_LEFT_RED_MASK, new ValidOptionRange<float>(0.0f,1.0f));\n\n valid_option(GFX_ANAGLYPH_LEFT_GREEN_MASK, new ValidOptionRange<float>(0.0f,1.0f));\n valid_option(GFX_ANAGLYPH_LEFT_BLUE_MASK, new ValidOptionRange<float>(0.0f,1.0f));\n valid_option(GFX_ANAGLYPH_RIGHT_RED_MASK, new ValidOptionRange<float>(0.0f,1.0f));\n valid_option(GFX_ANAGLYPH_RIGHT_GREEN_MASK, new ValidOptionRange<float>(0.0f,1.0f));\n valid_option(GFX_ANAGLYPH_RIGHT_BLUE_MASK, new ValidOptionRange<float>(0.0f,1.0f));\n\n valid_option(GFX_ANAGLYPH_DESATURATION, new ValidOptionRange<float>(0.0f,1.0f));\n valid_option(GFX_BLOOM_THRESHOLD, new ValidOptionRange<float>(0.0f,255.0f));\n\n gfx_option(GFX_AUTOUPDATE, false);\n gfx_option_reset();\n options_update(true);\n // This will trigger options_update(false) but it will be a no-op.\n gfx_option(GFX_AUTOUPDATE, true);\n}\n\nvoid gfx_option (GfxBoolOption o, bool v)\n{\n valid_option_bool[o]->maybeThrow(\"Graphics\", v);\n try {\n new_options_bool[o] = v;\n if (new_options_bool[GFX_AUTOUPDATE]) options_update(false);\n } catch (Ogre::Exception &e) {\n GRIT_EXCEPT(\"Couldn't set graphics option: \"+e.getFullDescription());\n }\n}\nbool gfx_option (GfxBoolOption o)\n{\n return options_bool[o];\n}\n\nvoid gfx_option (GfxIntOption o, int v)\n{\n valid_option_int[o]->maybeThrow(\"Graphics\", v);\n try {\n new_options_int[o] = v;\n if (new_options_bool[GFX_AUTOUPDATE]) options_update(false);\n } catch (Ogre::Exception &e) {\n GRIT_EXCEPT(\"Couldn't set graphics option: \"+e.getFullDescription());\n }\n}\nint gfx_option (GfxIntOption o)\n{\n return options_int[o];\n}\n\nvoid gfx_option (GfxFloatOption o, float v)\n{\n valid_option_float[o]->maybeThrow(\"Graphics\", v);\n try {\n new_options_float[o] = v;\n if (new_options_bool[GFX_AUTOUPDATE]) options_update(false);\n } catch (Ogre::Exception &e) {\n GRIT_EXCEPT(\"Couldn't set graphics option: \"+e.getFullDescription());\n }\n}\nfloat gfx_option (GfxFloatOption o)\n{\n return options_float[o];\n}\n\n" }, { "alpha_fraction": 0.5969123244285583, "alphanum_fraction": 0.601736843585968, "avg_line_length": 34.51931381225586, "blob_id": "9dc0853cde88faf6a5ab95540f453a10889cd4aa", "content_id": "a4ac3619906e8a2908033789b2aafb62826b8418", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 8291, "license_type": "permissive", "max_line_length": 107, "num_lines": 233, "path": "/dependencies/quex-0.34.1/quex/input/query.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "import sys\n\nfrom StringIO import StringIO\n\nfrom quex.frs_py.file_in import error_msg\nfrom quex.core_engine.utf8 import map_unicode_to_utf8\nfrom quex.input.ucs_db_parser import ucs_property_db\nfrom quex.exception import RegularExpressionException\nfrom quex.GetPot import GetPot\n\nimport quex.input.regular_expression as regular_expression\n\nOPTION_DB = {\n \"--property\": [\"Querying properties\"],\n \"--set-by-property\": [\"Determining character set by property\"],\n \"--set-by-expression\": [\"Determining character set by property\"],\n \"--property-match\": [\"Find property values that match wildcards\"],\n \"--numeric\": [\"Display sets numerically\", [\"--set-by-property\", \"--set-by-expression\"]],\n \"--intervals\": [\"Display sets by intervals\", [\"--set-by-property\", \"--set-by-expression\"]],\n}\n\ndef get_supported_command_line_option_description():\n txt = \"\"\n for key, description in OPTION_DB.items():\n txt += \" \" + key\n if len(description) >= 2: \n txt += \" (only with \"\n txt += repr(description[1])[1:-1]\n txt += \")\"\n txt += \"\\n\"\n return txt\n\ndef search_and_validate(CL, Option):\n\n if CL.search(Option) == False: return False\n\n # Validate command line\n ufos = CL.unidentified_options(OPTION_DB.keys())\n if ufos != []:\n error_msg(\"Unidentified option(s) = \" + repr(ufos) + \"\\n\" + \\\n get_supported_command_line_option_description())\n return True\n\ndef do(ARGV):\n \"\"\"Performs a query based on the given command line arguments.\n RETURNS: True if a query was performed.\n False if not query was requested.\n \"\"\"\n cl = GetPot(ARGV)\n\n try:\n if search_and_validate(cl, \"--property\"): __handle_property(cl)\n elif search_and_validate(cl, \"--set-by-property\"): __handle_set_by_property(cl)\n elif search_and_validate(cl, \"--set-by-expression\"): __handle_set_by_expression(cl)\n elif search_and_validate(cl, \"--property-match\"): __handle_property_match(cl)\n else: return False\n return True\n\n except RegularExpressionException, x:\n error_msg(x.message)\n\n return False\n\ndef __handle_property(cl):\n property_follower = cl.follow(\"\", \"--property\")\n\n if property_follower == \"\":\n # no specific property => display all properties in the database\n sys.stderr.write(\"(please, wait for database parsing to complete)\\n\")\n ucs_property_db.init_db()\n print ucs_property_db.get_property_descriptions()\n\n else:\n # specific property => display information about it\n sys.stderr.write(\"(please, wait for database parsing to complete)\\n\")\n property = __get_property(property_follower)\n if property == None: return True\n print property\n\ndef __handle_property_match(cl):\n property_follower = cl.follow(\"\", \"--property-match\")\n sys.stderr.write(\"(please, wait for database parsing to complete)\\n\")\n\n if property_follower == \"\":\n return\n\n fields = map(lambda x: x.strip(), property_follower.split(\"=\"))\n if len(fields) != 2:\n error_msg(\"Wrong property setting '%s'.\" % result)\n\n # -- determine name and value\n name = fields[0]\n wild_card_expression = fields[1]\n\n # -- get the property from the database\n property = __get_property(name)\n if property == None: \n return True\n\n # -- find the character set for the given expression\n if property.type == \"Binary\":\n error_msg(\"Binary property '%s' is not subject to value wild card matching.\\n\" % property.name)\n\n for value in property.get_wildcard_value_matches(wild_card_expression):\n print value\n\ndef __handle_set_by_property(cl):\n result = cl.follow(\"\", \"--set-by-property\") \n\n # expect: 'property-name = value'\n if result != \"\":\n sys.stderr.write(\"(please, wait for database parsing to complete)\\n\")\n fields = map(lambda x: x.strip(), result.split(\"=\"))\n if len(fields) not in [1, 2]:\n error_msg(\"Wrong property setting '%s'.\" % result)\n\n # -- determine name and value\n name = fields[0]\n if len(fields) == 2: value = fields[1]\n else: value = None\n\n # -- get the property from the database\n property = __get_property(name)\n if property == None: \n return True\n\n # -- find the character set for the given expression\n if property.type == \"Binary\" and value != None:\n error_msg(\"Binary property '%s' cannot have a value assigned to it.\\n\" % property.name + \\\n \"Setting ignored. Printing set of characters with the given property.\")\n\n character_set = property.get_character_set(value)\n if character_set.__class__.__name__ != \"NumberSet\":\n error_msg(character_set)\n\n __display_set(character_set, cl)\n\ndef __handle_set_by_expression(cl):\n result = cl.follow(\"\", \"--set-by-expression\")\n if result != \"\":\n character_set = regular_expression.parse_character_set(\"[:\" + result + \":]\")\n __display_set(character_set, cl)\n\ndef __display_set(CharSet, cl):\n if cl.search(\"--numeric\"): display = \"hex\"\n else: display = \"utf8\"\n\n if cl.search(\"--intervals\"): \n print \"Characters:\\n\", \n __print_set_in_intervals(CharSet, display, 80)\n else:\n print \"Characters:\\n\", \n __print_set_single_characters(CharSet, display, 80)\n\n print \n \ndef __get_property(Name_or_Alias):\n \n ucs_property_db.init_db()\n property = ucs_property_db[Name_or_Alias]\n if property.__class__.__name__ != \"PropertyInfo\":\n print property\n if Name_or_Alias.find(\"=\") != -1: \n print \"Use command line option `--set-by-property` to investigate property settings.\"\n if Name_or_Alias.find(\"(\") != -1:\n print \"Use command line option `--set-by-expression` to investigate character set operations.\"\n return None\n \n property.init_code_point_db()\n return property\n\ndef __print_set_in_intervals(CharSet, Display, ScreenWidth):\n assert Display in [\"hex\", \"utf8\"]\n\n interval_list = CharSet.get_intervals(PromiseNotToChangeAnythingF=True)\n\n txt = \"\"\n line_size = 0\n for interval in interval_list:\n interval_string = interval.get_string(Display, \"-\") + \", \"\n interval_string_length = len(interval_string)\n\n if line_size + interval_string_length > ScreenWidth:\n txt += \"\\n\"\n line_size = 0\n else:\n line_size += interval_string_length\n txt += interval_string\n\n print txt\n\ndef __print_set_single_characters(CharSet, Display, ScreenWidth):\n assert Display in [\"hex\", \"utf8\"]\n\n interval_list = CharSet.get_intervals(PromiseNotToChangeAnythingF=True)\n\n if Display == \"hex\":\n CharactersPerLine = 8\n ColumnWidth = 6\n else:\n CharactersPerLine = 32\n ColumnWidth = 2\n\n txt = \"\"\n line_size = 0\n character_list = []\n for interval in interval_list:\n character_list.extend(range(interval.begin, interval.end))\n\n # just to make sure ...\n character_list.sort()\n\n last_start_character_of_line = 0\n last_horizontal_offset = 0\n for character_code in character_list:\n start_character_of_line = character_code - character_code % CharactersPerLine\n horizontal_offset = character_code - start_character_of_line\n\n if start_character_of_line > last_start_character_of_line + CharactersPerLine: \n sys.stdout.write(\"\\n...\")\n if start_character_of_line != last_start_character_of_line:\n sys.stdout.write(\"\\n%05X: \" % start_character_of_line)\n last_horizontal_offset = 0\n\n sys.stdout.write(\" \" * ColumnWidth * (horizontal_offset - last_horizontal_offset - 1))\n\n if Display == \"hex\":\n sys.stdout.write(\"%05X \" % character_code)\n else:\n sys.stdout.write(\"%s \" % map_unicode_to_utf8(character_code))\n\n last_start_character_of_line = start_character_of_line\n last_horizontal_offset = horizontal_offset\n \n \n\n" }, { "alpha_fraction": 0.6914734244346619, "alphanum_fraction": 0.6946521997451782, "avg_line_length": 36.66197204589844, "blob_id": "047cb3702fa50afa1ad33cf541c02b7e6a3eeaa2", "content_id": "9d063ef3e9c536269707af54fd2c260356dbf132", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 5348, "license_type": "permissive", "max_line_length": 142, "num_lines": 142, "path": "/engine/gfx/gfx_text_buffer.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\nclass GfxTextBuffer;\n\n#ifndef GFX_TEXT_BUFFER_H\n#define GFX_TEXT_BUFFER_H\n\n#include <cstdint>\n\n#include <math_util.h>\n\n#include \"gfx_font.h\"\n\n/** Encapsulate the code required to build GPU buffers for rendering text.*/\nclass GfxTextBuffer {\n\n struct ColouredChar {\n GfxFont::codepoint_t cp;\n /* We have to record the top/bottom colour anyway since ansi colour codes are not\n the only way to change the colour. Therefore we may as well record all the\n colour. Also, if we have the colour per character, it is possible to know the\n colour without looking back for the last colour code.\n */\n Vector3 topColour;\n float topAlpha;\n Vector3 bottomColour;\n float bottomAlpha;\n unsigned long left, top;\n ColouredChar (GfxFont::codepoint_t cp, const Vector3 &tc, float ta, const Vector3 &bc, float ba)\n : cp(cp), topColour(tc), topAlpha(ta), bottomColour(bc), bottomAlpha(ba)\n { }\n };\n std::vector<ColouredChar> colouredText;\n\n GfxFont *font;\n\n Ogre::VertexData vData;\n Ogre::IndexData iData;\n Ogre::HardwareVertexBufferSharedPtr vBuf;\n Ogre::HardwareIndexBufferSharedPtr iBuf;\n Ogre::RenderOperation op;\n unsigned currentGPUCapacity; // due to lazy update, lags behind\n\n std::vector<float> rawVBuf;\n std::vector<uint16_t> rawIBuf;\n\n Vector2 currentDrawnDimensions;\n\n unsigned long currentLeft, currentTop;\n\n long lastTop, lastBottom;\n unsigned long wrap;\n\n bool dirty;\n\n /** Fill in the ColouredChar::pos fields. */\n void recalculatePositions (unsigned long offset = 0);\n\n unsigned long binaryChopTop (unsigned long begin, unsigned long end, unsigned long top);\n\n unsigned long binaryChopBottom (unsigned long begin, unsigned long end, unsigned long bottom_top);\n\n public:\n\n GfxTextBuffer (GfxFont *font);\n\n ~GfxTextBuffer (void)\n {\n clear();\n vData.vertexDeclaration = NULL; // save OGRE from itself\n }\n\n /** High level interface: Add a string that can contain \\n,\\t and ansi terminal colours.\n * \\param text The text in UTF8.\n * \\param top_colour and friends: Initial colours, overriden by use of ansi terminal colours.\n */\n void addFormattedString (const std::string &text, const Vector3 &top_colour, float top_alpha, const Vector3 &bot_colour, float bot_alpha);\n\n /** Put the triangles in the vertex/index buffers and upload them.\n * \\param no_scroll Do not use top/bottom to clip the buffer vertically, render the whole buffer.\n * \\param top The top of the visible area, in pixels from the top of the buffer. Can be negative to add extra space at top.\n * \\param bottom The bottom of the visible area, in pixels from the top of the buffer. Can be negative.\n */\n void updateGPU (bool no_scroll, long top, long bottom);\n\n /** Reset the buffer. */\n void clear (void)\n {\n colouredText.clear();\n recalculatePositions();\n dirty = true;\n }\n\n /** Return number of vertexes required to render the text. */\n unsigned getVertexes (void) const { return vData.vertexCount; }\n\n /** Return number of triangles required to render the text. */\n unsigned getTriangles (void) const { return iData.indexCount / 3; }\n\n /** Sets the font. */\n void setFont (GfxFont *v) { font = v; recalculatePositions(); }\n\n /** Returns the font. */\n GfxFont *getFont (void) const { return font; }\n\n /** Returns the size of the text rectangle in pixels. Drawn part only, updated by updateGPU. */\n const Vector2 &getDrawnDimensions (void) const { return currentDrawnDimensions; }\n\n /** Returns the size of the text rectangle in pixels. Entire buffer. */\n unsigned long getBufferHeight (void) const { return font->getHeight() + currentTop; }\n\n /** Set the max size. This is used to wrap text during addFormattedString. */\n void setWrap (float v) { wrap = v; recalculatePositions(); }\n\n /** Returns the max size. \\see setWrap */\n float getWrap (void) const { return wrap; }\n\n /** Get an operation that can be used to render this text buffer. */\n const Ogre::RenderOperation &getRenderOperation (void) const { return op; }\n\n};\n\n#endif\n" }, { "alpha_fraction": 0.5173157453536987, "alphanum_fraction": 0.538741409778595, "avg_line_length": 25.215547561645508, "blob_id": "555a6d303fdc2a77c980df953f3ea47192c73e33", "content_id": "f2fc50924931270765345eecb4bb0634daf0e260", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 7421, "license_type": "permissive", "max_line_length": 100, "num_lines": 283, "path": "/engine/navigation/navigation_interfaces.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "//\n// Copyright (c) 2009-2010 Mikko Mononen memon@inside.org\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n//\n\n// This is a modified version of SampleInterfaces.cpp from Recast Demo\n\n#define _USE_MATH_DEFINES\n#include <cmath>\n#include <cstdio>\n#include <cstdarg>\n\n#include <Recast.h>\n#include <RecastDebugDraw.h>\n#include <DetourDebugDraw.h>\n\n#include \"navigation_interfaces.h\"\n#include \"navigation_system.h\"\n#include \"../gfx/gfx_debug.h\"\n\n////////////////////////////////////////////////////////////////////////////////////////////////////\n\nBuildContext::BuildContext() :\n m_messageCount(0),\n m_textPoolSize(0)\n{\n resetTimers();\n}\n\nBuildContext::~BuildContext()\n{\n}\n\n// Virtual functions for custom implementations.\nvoid BuildContext::doResetLog()\n{\n m_messageCount = 0;\n m_textPoolSize = 0;\n}\n\nvoid BuildContext::doLog(const rcLogCategory category, const char* msg, const int len)\n{\n if (!len) return;\n if (m_messageCount >= MAX_MESSAGES)\n return;\n char* dst = &m_textPool[m_textPoolSize];\n int n = TEXT_POOL_SIZE - m_textPoolSize;\n if (n < 2)\n return;\n char* cat = dst;\n char* text = dst+1;\n const int maxtext = n-1;\n // Store category\n *cat = (char)category;\n // Store message\n const int count = rcMin(len+1, maxtext);\n memcpy(text, msg, count);\n text[count-1] = '\\0';\n m_textPoolSize += 1 + count;\n m_messages[m_messageCount++] = dst;\n}\n\nvoid BuildContext::dumpLog(const char* format, ...)\n{\n // Print header.\n va_list ap;\n va_start(ap, format);\n vprintf(format, ap);\n va_end(ap);\n printf(\"\\n\");\n \n // Print messages\n const int TAB_STOPS[4] = { 28, 36, 44, 52 };\n for (int i = 0; i < m_messageCount; ++i)\n {\n const char* msg = m_messages[i]+1;\n int n = 0;\n while (*msg)\n {\n if (*msg == '\\t')\n {\n int count = 1;\n for (int j = 0; j < 4; ++j)\n {\n if (n < TAB_STOPS[j])\n {\n count = TAB_STOPS[j] - n;\n break;\n }\n }\n while (--count)\n {\n putchar(' ');\n n++;\n }\n }\n else\n {\n putchar(*msg);\n n++;\n }\n msg++;\n }\n putchar('\\n');\n }\n}\n\nint BuildContext::getLogCount() const\n{\n return m_messageCount;\n}\n\nconst char* BuildContext::getLogText(const int i) const\n{\n return m_messages[i]+1;\n}\n\n////////////////////////////////////////////////////////////////////////////////////////////////////\n//++\nVector4 uintColorToOgre(unsigned int colour)\n{\n int r = colour & 0xff;\n int g = (colour >> 8) & 0xff;\n int b = (colour >> 16) & 0xff;\n int a = (colour >> 24) & 0xff;\n return Vector4(r, g, b, a) / 255.0f;\n}\n\nvoid DebugDrawGL::depthMask(bool state)\n{\n (void) state;\n}\n\nvoid DebugDrawGL::texture(bool state)\n{\n (void) state;\n}\n\nvoid DebugDrawGL::begin(duDebugDrawPrimitives prim, float size)\n{\n assert(currentVertex == 0);\n currentVertex = 0;\n currentSize = size;\n switch (prim) {\n case DU_DRAW_POINTS: maxVertex = 1; break;\n case DU_DRAW_LINES: maxVertex = 2; break;\n case DU_DRAW_TRIS: maxVertex = 3; break;\n case DU_DRAW_QUADS: maxVertex = 4; break;\n }\n}\n\nvoid DebugDrawGL::vertex(const float* pos, unsigned int color)\n{\n vertex(pos[0], pos[1], pos[2], color);\n}\n\nvoid DebugDrawGL::vertex(const float x, const float y, const float z, unsigned int color)\n{\n Vector4 colour = uintColorToOgre(color);\n vertexes[currentVertex][0] = -x;\n vertexes[currentVertex][1] = z;\n vertexes[currentVertex][2] = y;\n currentVertex++;\n\n assert(currentVertex <= maxVertex);\n \n if (currentVertex == maxVertex) {\n currentVertex = 0;\n switch (maxVertex) {\n case 1:\n gfx_debug_point(\n Vector3(vertexes[0][0], vertexes[0][1], vertexes[0][2]), \n currentSize,\n Vector3(colour.x, colour.y, colour.z), colour.w);\n break;\n case 2:\n gfx_debug_line(\n Vector3(vertexes[0][0], vertexes[0][1], vertexes[0][2]), \n Vector3(vertexes[1][0], vertexes[1][1], vertexes[1][2]), \n Vector3(colour.x, colour.y, colour.z), colour.w);\n break;\n case 3:\n gfx_debug_triangle(\n Vector3(vertexes[0][0], vertexes[0][1], vertexes[0][2]), \n Vector3(vertexes[1][0], vertexes[1][1], vertexes[1][2]), \n Vector3(vertexes[2][0], vertexes[2][1], vertexes[2][2]), \n Vector3(colour.x, colour.y, colour.z), colour.w);\n break;\n case 4:\n gfx_debug_quad(\n Vector3(vertexes[0][0], vertexes[0][1], vertexes[0][2]), \n Vector3(vertexes[1][0], vertexes[1][1], vertexes[1][2]), \n Vector3(vertexes[2][0], vertexes[2][1], vertexes[2][2]), \n Vector3(vertexes[3][0], vertexes[3][1], vertexes[3][2]), \n Vector3(colour.x, colour.y, colour.z), colour.w);\n break;\n }\n }\n}\n\nvoid DebugDrawGL::vertex(const float* pos, unsigned int color, const float* uv)\n{\n (void) uv;\n vertex(pos[0], pos[1], pos[2], color);\n}\nvoid DebugDrawGL::vertex(const float x, const float y, const float z,\n unsigned int color, const float u, const float v)\n{\n (void) u; (void) v;\n vertex(x, y, z, color);\n}\n\nvoid DebugDrawGL::end()\n{\n}\n\n////////////////////////////////////////////////////////////////////////////////////////////////////\n\nFileIO::FileIO() :\n m_fp(0),\n m_mode(-1)\n{\n}\n\nFileIO::~FileIO()\n{\n if (m_fp) fclose(m_fp);\n}\n\nbool FileIO::openForWrite(const char* path)\n{\n if (m_fp) return false;\n m_fp = fopen(path, \"wb\");\n if (!m_fp) return false;\n m_mode = 1;\n return true;\n}\n\nbool FileIO::openForRead(const char* path)\n{\n if (m_fp) return false;\n m_fp = fopen(path, \"rb\");\n if (!m_fp) return false;\n m_mode = 2;\n return true;\n}\n\nbool FileIO::isWriting() const\n{\n return m_mode == 1;\n}\n\nbool FileIO::isReading() const\n{\n return m_mode == 2;\n}\n\nbool FileIO::write(const void* ptr, const size_t size)\n{\n if (!m_fp || m_mode != 1) return false;\n fwrite(ptr, size, 1, m_fp);\n return true;\n}\n\nbool FileIO::read(void* ptr, const size_t size)\n{\n if (!m_fp || m_mode != 2) return false;\n size_t readLen = fread(ptr, size, 1, m_fp);\n return readLen == 1;\n}\n\n\n" }, { "alpha_fraction": 0.6018999814987183, "alphanum_fraction": 0.6076889038085938, "avg_line_length": 29.622726440429688, "blob_id": "43b33078eb4421125fb0ee20b9eac211637703c3", "content_id": "83a0c2cf6bbeebbca716e1285324f1fa24d6b714", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 6737, "license_type": "permissive", "max_line_length": 99, "num_lines": 220, "path": "/engine/linux/x11_clipboard.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <cstdlib>\n#include <string>\n#include <X11/Xlib.h>\n#include <X11/Xatom.h>\n\n#include <centralised_log.h>\n\n#include \"../clipboard.h\"\n\n\nstatic Display *display = NULL;\nWindow window = None;\nAtom scratch_property = None; // Clipboard copied to here upon get\nAtom utf8_string = None; // Clipboard data type to ask other apps for.\nAtom src_selection = None;\nAtom src_clipboard = None;\nstd::string data_selection;\nstd::string data_clipboard;\n\nstatic std::string get_xlib_error (Display *display, int code)\n{\n char buf[1000];\n XGetErrorText(display, code, buf, sizeof(buf));\n return std::string(buf);\n}\n\nvoid clipboard_init (void)\n{\n display = XOpenDisplay(NULL);\n if (!display) {\n EXCEPTEX << \"Could not open X display for getting clipboard.\" << ENDL;\n }\n Window root = XDefaultRootWindow(display);\n int black = BlackPixel(display, DefaultScreen (display));\n window = XCreateSimpleWindow(display, root, 0, 0, 1, 1, 0, black, black);\n scratch_property = XInternAtom(display, \"ScratchProperty\", False);\n utf8_string = XInternAtom(display, \"UTF8_STRING\", False);\n src_selection = XInternAtom(display, \"PRIMARY\", False);\n src_clipboard = XInternAtom(display, \"CLIPBOARD\", False);\n}\n\nstatic bool handle_event (const XEvent &event)\n{\n if (event.type != SelectionRequest)\n return false;\n\n const XSelectionRequestEvent &req = event.xselectionrequest;\n std::string *to_serve;\n if (req.selection == src_selection) {\n to_serve = &data_selection;\n } else if (req.selection == src_clipboard) {\n to_serve = &data_clipboard;\n } else {\n return true;\n }\n XSelectionEvent res;\n res.type = SelectionNotify;\n res.display = req.display;\n res.requestor = req.requestor;\n res.selection = req.selection;\n res.time = req.time;\n res.target = req.target;\n res.property = req.property;\n XChangeProperty(display, req.requestor, req.property,\n req.target, 8, PropModeReplace,\n reinterpret_cast<const unsigned char*>(to_serve->c_str()), to_serve->length());\n XSendEvent(display, res.requestor, False, (unsigned long)NULL, (XEvent *)&res);\n return true;\n}\n\nvoid clipboard_pump (void)\n{\n XEvent event;\n int r = XCheckTypedEvent(display, SelectionRequest, &event);\n if (!r) return;\n handle_event(event);\n}\n\nvoid clipboard_shutdown (void)\n{\n if (display) XCloseDisplay(display);\n}\n\nvoid clipboard_set (const std::string &s)\n{\n data_clipboard = s;\n XSetSelectionOwner(display, src_clipboard, window, CurrentTime);\n}\n\nvoid clipboard_selection_set (const std::string &s)\n{\n data_selection = s;\n XSetSelectionOwner(display, src_selection, window, CurrentTime);\n}\n\nstatic std::string clipboard_get (Atom source)\n{\n unsigned char *data = NULL;\n std::string s;\n try {\n\n XConvertSelection(display, source, utf8_string, scratch_property, window, CurrentTime);\n\n // Ensure that scratch_property has been populated.\n bool got_it = false;\n XEvent event;\n while (!got_it) {\n // Blocks if queue is empty.\n XNextEvent(display, &event);\n if (!handle_event(event)) {\n if (event.type == SelectionNotify) {\n if (event.xselection.selection == source)\n got_it = true;\n }\n }\n }\n\n if (event.xselection.property != None) {\n\n Atom type; // Unused.\n int format = 0;\n unsigned long len = 0;\n unsigned long bytes_left = 0;\n\n // First call gets the length.\n int result = XGetWindowProperty(display, window, scratch_property,\n 0, 0,\n False,\n AnyPropertyType,\n &type,\n &format,\n &len, &bytes_left,\n &data);\n if (result != Success) {\n EXCEPTEX << \"Could not XGetWindowProperty: \" << get_xlib_error(display, result)\n << ENDL;\n }\n\n if (bytes_left != 0) {\n unsigned long dummy = 0;\n result = XGetWindowProperty(display, window, scratch_property,\n 0, bytes_left,\n False,\n AnyPropertyType, &type, &format,\n &len, &dummy, &data);\n if (result != Success) {\n EXCEPTEX << \"Could not XGetWindowProperty: \" << get_xlib_error(display, result)\n << ENDL;\n }\n s = std::string(data, data+len);\n }\n }\n } catch (Exception &e) {\n if (data) XFree(data);\n throw e;\n }\n\n if (data) XFree(data);\n return s;\n}\n\n\nstd::string clipboard_get (void)\n{\n return clipboard_get(src_clipboard);\n}\n\nstd::string clipboard_selection_get (void)\n{\n return clipboard_get(src_selection);\n}\n\n#ifdef GRIT_CLIPBOARD_TEST\n#include <cstdlib>\n#include <iostream>\n\nint main(void)\n{\n try {\n clipboard_init();\n\n std::cout << \"Clipboard: \\n\" << clipboard_get() << \"\\n\" << std::endl;;\n std::cout << \"Selection: \\n\" << clipboard_selection_get() << \"\\n\" << std::endl;;\n\n clipboard_selection_set(\"Selection data.\");\n clipboard_set(\"Clipboard data.\");\n for (long long i=0 ; i<10000000 ; ++i)\n clipboard_pump();\n\n clipboard_shutdown();\n \n return EXIT_SUCCESS;\n } catch (Exception &e) {\n std::cerr << \"Exception: \" << e << std::endl;\n return EXIT_FAILURE;\n }\n}\n\n#endif\n" }, { "alpha_fraction": 0.685326099395752, "alphanum_fraction": 0.6934782862663269, "avg_line_length": 24.379310607910156, "blob_id": "9dc234bfff4d29b972c136937572e7ba30f7fcc9", "content_id": "8e24dfac3f4fa1f779b07c1b1f2462c6743d7e0a", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 3680, "license_type": "permissive", "max_line_length": 87, "num_lines": 145, "path": "/engine/gfx/gfx_sprite_body.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include \"gfx_internal.h\"\n#include \"gfx_sprite_body.h\"\n\nconst std::string GfxSpriteBody::className = \"GfxSpriteBody\";\n\nGfxSpriteBody::GfxSpriteBody (const std::string &particle_name, const GfxNodePtr &par_)\n : GfxNode(par_),\n enabled(true),\n fade(1),\n alpha(1),\n particle(gfx_particle_emit(particle_name))\n{\n particle->dimensions = Vector3(1, 1, 1);\n particle->diffuse = Vector3(1, 1, 1); // More like ambient colour than diffuse.\n particle->emissive = Vector3(0, 0, 0);\n particle->setDefaultUV();\n particle->angle = 0;\n update();\n}\n\nGfxSpriteBody::~GfxSpriteBody (void)\n{\n if (!dead) destroy();\n}\n\nvoid GfxSpriteBody::destroy (void)\n{\n if (dead) THROW_DEAD(className);\n particle->release();\n GfxNode::destroy();\n}\n\nvoid GfxSpriteBody::update (void)\n{\n if (dead) THROW_DEAD(className);\n particle->pos = getWorldTransform() * Vector3(0, 0, 0);\n if (enabled) {\n particle->alpha = fade * alpha;\n } else {\n particle->alpha = 0;\n }\n}\n\nfloat GfxSpriteBody::getAlpha (void) const\n{\n if (dead) THROW_DEAD(className);\n return alpha;\n}\nvoid GfxSpriteBody::setAlpha (float v)\n{\n if (dead) THROW_DEAD(className);\n alpha = v;\n}\n\nVector3 GfxSpriteBody::getDimensions (void) const\n{\n if (dead) THROW_DEAD(className);\n return particle->dimensions;\n}\n\nvoid GfxSpriteBody::setDimensions (const Vector3 &v)\n{\n if (dead) THROW_DEAD(className);\n particle->dimensions = v;\n}\n\nVector3 GfxSpriteBody::getDiffuse (void) const\n{\n if (dead) THROW_DEAD(className);\n return particle->diffuse;\n}\n\nvoid GfxSpriteBody::setDiffuse (const Vector3 &v)\n{\n if (dead) THROW_DEAD(className);\n particle->diffuse = v;\n}\n\nVector3 GfxSpriteBody::getEmissive (void) const\n{\n if (dead) THROW_DEAD(className);\n return particle->emissive;\n}\n\nvoid GfxSpriteBody::setEmissive (const Vector3 &v)\n{\n if (dead) THROW_DEAD(className);\n particle->emissive = v;\n}\n\nfloat GfxSpriteBody::getAngle (void) const\n{\n if (dead) THROW_DEAD(className);\n return particle->angle;\n}\n\nvoid GfxSpriteBody::setAngle (float v)\n{\n if (dead) THROW_DEAD(className);\n particle->angle = v;\n}\n\nbool GfxSpriteBody::isEnabled (void) const\n{\n if (dead) THROW_DEAD(className);\n return enabled;\n}\n\nvoid GfxSpriteBody::setEnabled (bool v)\n{\n if (dead) THROW_DEAD(className);\n enabled = v;\n}\n\nfloat GfxSpriteBody::getFade (void) const\n{\n if (dead) THROW_DEAD(className);\n return fade;\n}\nvoid GfxSpriteBody::setFade (float f)\n{\n if (dead) THROW_DEAD(className);\n fade = f;\n}\n" }, { "alpha_fraction": 0.6006401777267456, "alphanum_fraction": 0.6083959341049194, "avg_line_length": 28.645984649658203, "blob_id": "90e3ecd442470fded6802e24647fffa4a61d1731", "content_id": "c12d540aad2291617fca811234edf28e26369854", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 8123, "license_type": "permissive", "max_line_length": 93, "num_lines": 274, "path": "/engine/win32/mouse_direct_input8.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <assert.h>\n#include <iostream>\n\n#include <centralised_log.h>\n\n#include \"mouse_direct_input8.h\"\n\n\n#define BUFFSZ 128\n\nstatic const char *result_str(HRESULT r)\n{\n #define Shittymacro(id) if (r == (HRESULT)id) return #id; else\n Shittymacro(DI_BUFFEROVERFLOW)\n Shittymacro(DI_DOWNLOADSKIPPED)\n Shittymacro(DI_EFFECTRESTARTED)\n Shittymacro(DI_NOEFFECT)\n Shittymacro(DI_NOTATTACHED)\n Shittymacro(DI_OK)\n Shittymacro(DI_POLLEDDEVICE)\n Shittymacro(DI_PROPNOEFFECT)\n Shittymacro(DI_SETTINGSNOTSAVED)\n Shittymacro(DI_TRUNCATED)\n Shittymacro(DI_TRUNCATEDANDRESTARTED)\n Shittymacro(DI_WRITEPROTECT)\n Shittymacro(DIERR_ACQUIRED)\n Shittymacro(DIERR_ALREADYINITIALIZED)\n Shittymacro(DIERR_BADDRIVERVER)\n Shittymacro(DIERR_BETADIRECTINPUTVERSION)\n Shittymacro(DIERR_DEVICEFULL)\n Shittymacro(DIERR_DEVICENOTREG)\n Shittymacro(DIERR_EFFECTPLAYING)\n Shittymacro(DIERR_GENERIC)\n Shittymacro(DIERR_HANDLEEXISTS)\n Shittymacro(DIERR_HASEFFECTS)\n Shittymacro(DIERR_INCOMPLETEEFFECT)\n Shittymacro(DIERR_INPUTLOST)\n Shittymacro(DIERR_INVALIDPARAM)\n Shittymacro(DIERR_MAPFILEFAIL)\n Shittymacro(DIERR_MOREDATA)\n Shittymacro(DIERR_NOAGGREGATION)\n Shittymacro(DIERR_NOINTERFACE)\n Shittymacro(DIERR_NOTACQUIRED)\n Shittymacro(DIERR_NOTBUFFERED)\n Shittymacro(DIERR_NOTDOWNLOADED)\n Shittymacro(DIERR_NOTEXCLUSIVEACQUIRED)\n Shittymacro(DIERR_NOTFOUND)\n Shittymacro(DIERR_NOTINITIALIZED)\n Shittymacro(DIERR_OBJECTNOTFOUND)\n Shittymacro(DIERR_OLDDIRECTINPUTVERSION)\n Shittymacro(DIERR_OTHERAPPHASPRIO)\n Shittymacro(DIERR_OUTOFMEMORY)\n Shittymacro(DIERR_READONLY)\n Shittymacro(DIERR_REPORTFULL)\n Shittymacro(DIERR_UNPLUGGED)\n Shittymacro(DIERR_UNSUPPORTED)\n Shittymacro(E_HANDLE)\n Shittymacro(E_PENDING)\n Shittymacro(E_POINTER) {\n return \"Unrecognised result (shouldn't happen)\";\n }\n}\n\n#define BAD_DI_RESULT(r, i_was) do { CERR<<i_was<<\": \"<<result_str(r)<<std::endl; } while (0)\n\nMouseDirectInput8::MouseDirectInput8(size_t window)\n{\n\n win = (HWND)window;\n\n // create the root interface\n HRESULT r = DirectInput8Create(GetModuleHandle(0),\n DIRECTINPUT_VERSION,\n IID_IDirectInput8,\n (void**)&directInput,\n NULL);\n assert(!FAILED(r));\n\n // create a mouse device\n r = directInput->CreateDevice(GUID_SysMouse, &dev, NULL);\n assert(!FAILED(r));\n\n // Mouse2 gives us more buttons - 8 instead of 4\n r = dev->SetDataFormat(&c_dfDIMouse2);\n assert(!FAILED(r));\n\n r = dev->SetCooperativeLevel(win, DISCL_FOREGROUND|DISCL_NONEXCLUSIVE);\n assert(!FAILED(r));\n\n // http://msdn2.microsoft.com/en-us/library/bb219669.aspx\n DIPROPDWORD dipdw;\n dipdw.diph.dwSize = sizeof(DIPROPDWORD);\n dipdw.diph.dwHeaderSize = sizeof(DIPROPHEADER);\n dipdw.diph.dwObj = 0;\n dipdw.diph.dwHow = DIPH_DEVICE;\n dipdw.dwData = BUFFSZ;\n\n // set buffer size to BUFFSZ\n r = dev->SetProperty(DIPROP_BUFFERSIZE, &dipdw.diph );\n assert(!FAILED(r));\n\n hidden = false;\n grabbed = false;\n\n scroll = 0;\n}\n\nMouseDirectInput8::~MouseDirectInput8()\n{\n if (dev) {\n dev->Unacquire();\n dev->Release();\n dev = NULL;\n }\n if (directInput) {\n directInput->Release();\n }\n}\n\nbool MouseDirectInput8::getEvents(std::vector<int> *clicks,\n int *x, int *y, int *rel_x, int *rel_y)\n{\n if (clicks) clicks->clear();\n\n int rx = 0;\n int ry = 0;\n bool moved = false;\n\n DWORD num_elements = BUFFSZ;\n DIDEVICEOBJECTDATA buf[BUFFSZ];\n\n // Get window size\n RECT rect;\n GetClientRect(win, &rect);\n int win_height = rect.bottom - rect.top;\n\n HRESULT r;\n r = dev->GetDeviceData(sizeof(DIDEVICEOBJECTDATA), buf, &num_elements, 0);\n if (r == DIERR_INPUTLOST || r == DIERR_NOTACQUIRED) {\n r = dev->Acquire();\n if (r == DIERR_OTHERAPPHASPRIO) {\n // let function exit normally but with no data\n } else if (FAILED(r)) {\n BAD_DI_RESULT(r, \"reacquiring mouse\");\n }\n } else if (FAILED(r)) {\n BAD_DI_RESULT(r, \"getting mouse data\");\n } else {\n // finally, process events\n for (DWORD i=0 ; i<num_elements ; i++) {\n POINT p; GetCursorPos(&p);\n ScreenToClient(win, &p);\n\n if (p.x<0 || p.x>=rect.right) continue;\n if (p.y<0 || p.y>=rect.bottom) continue;\n\n DWORD d = buf[i].dwData;\n\n if (buf[i].dwOfs == DIMOFS_BUTTON0 && clicks) {\n clicks->push_back((d&0x80?1:-1)*MOUSE_LEFT);\n } else if (buf[i].dwOfs == DIMOFS_BUTTON1 && clicks) {\n clicks->push_back((d&0x80?1:-1)*MOUSE_RIGHT);\n } else if (buf[i].dwOfs == DIMOFS_BUTTON2 && clicks) {\n clicks->push_back((d&0x80?1:-1)*MOUSE_MIDDLE);\n } else if (buf[i].dwOfs == DIMOFS_X) {\n moved = true;\n rx += (int)d;\n current_x = p.x;\n } else if (buf[i].dwOfs == DIMOFS_Y) {\n moved = true;\n ry += (int)d;\n current_y = p.y;\n } else if (buf[i].dwOfs == DIMOFS_Z) {\n scroll += (int)d;\n while (scroll>=WHEEL_DELTA) {\n clicks->push_back(MOUSE_SCROLL_UP);\n clicks->push_back(-MOUSE_SCROLL_UP);\n scroll -= WHEEL_DELTA;\n }\n while (scroll<=-WHEEL_DELTA) {\n clicks->push_back(MOUSE_SCROLL_DOWN);\n clicks->push_back(-MOUSE_SCROLL_DOWN);\n scroll += WHEEL_DELTA;\n }\n }\n }\n }\n\n if (x) *x = current_x;\n if (y) *y = win_height-current_y-1; // invert axis\n if (rel_x) *rel_x = rx;\n if (rel_y) *rel_y = -ry; // invert axis\n\n return moved;\n}\n\nvoid MouseDirectInput8::setPos(int x, int y)\n{\n // Get window size\n RECT rect;\n GetClientRect(win, &rect);\n int win_height = rect.bottom - rect.top;\n\n y = win_height - y - 1;\n\n POINT p;\n p.x = x;\n p.y = y;\n ClientToScreen(win, &p);\n SetCursorPos(p.x, p.y);\n current_x = x;\n current_y = y;\n}\n\n\nvoid MouseDirectInput8::setHide(bool toggle)\n{\n if (hidden == toggle) return;\n hidden = toggle;\n ShowCursor(!toggle);\n}\n\nbool MouseDirectInput8::getHide()\n{\n return hidden;\n}\n\n\nvoid MouseDirectInput8::setGrab(bool toggle)\n{\n if (grabbed == toggle) return;\n grabbed = toggle;\n if (!toggle) {\n ClipCursor(NULL);\n } else {\n RECT rect;\n GetClientRect(win, &rect);\n POINT p;\n p.x = 0;\n p.y = 0;\n ClientToScreen(win, &p);\n rect.left = p.x;\n rect.top = p.y;\n rect.right += p.x;\n rect.bottom += p.y;\n ClipCursor(&rect);\n }\n}\n\nbool MouseDirectInput8::getGrab()\n{\n return grabbed;\n}\n" }, { "alpha_fraction": 0.5514878630638123, "alphanum_fraction": 0.5535702109336853, "avg_line_length": 44.80615234375, "blob_id": "9b00f207eec4c641b1972bd552a05b1f2b5f96cf", "content_id": "bf77d125ab3ffac4093052d0e1921a24bbc2e6c4", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 14887, "license_type": "permissive", "max_line_length": 114, "num_lines": 325, "path": "/dependencies/quex-0.34.1/quex/output/cpp/core.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "#! /usr/bin/env python\nimport os\nfrom copy import copy\nimport time\n\nfrom quex.frs_py.string_handling import blue_print\nfrom quex.frs_py.file_in import open_file_or_die, \\\n get_include_guard_extension\n\nimport quex.lexer_mode as lexer_mode\nimport quex.output.cpp.mode_classes as mode_classes\n\n\ndef do(Modes, Setup):\n\n write_engine_header(Modes, Setup)\n\n write_mode_class_implementation(Modes, Setup)\n\ndef write_engine_header(Modes, Setup):\n\n QuexClassHeaderFileTemplate = (Setup.QUEX_TEMPLATE_DB_DIR \n + \"/template/lexical_analyzer_class\").replace(\"//\",\"/\")\n CoreEngineDefinitionsHeader = (Setup.QUEX_TEMPLATE_DB_DIR + \"/core_engine/\").replace(\"//\",\"/\")\n QuexClassHeaderFileOutput = Setup.output_file_stem\n LexerClassName = Setup.output_engine_name\n VersionID = Setup.input_application_version_id\n QuexVersionID = Setup.QUEX_VERSION\n\n # -- determine character type according to number of bytes per ucs character code point\n # for the internal engine.\n quex_character_type_str = { 1: \"uint8_t \", 2: \"uint16_t\", 4: \"uint32_t\", \n \"wchar_t\": \"wchar_t\" }[Setup.bytes_per_ucs_code_point]\n quex_lexeme_type_str = { 1: \"char \", 2: \"int16_t\", 4: \"int32_t\", \n \"wchar_t\": \"wchar_t\" }[Setup.bytes_per_ucs_code_point]\n\n # are bytes of integers Setup 'little endian' or 'big endian' ?\n if Setup.byte_order == \"little\":\n quex_coding_name_str = { 1: \"ASCII\", 2: \"UCS-2LE\", 4: \"UCS-4LE\", \n \"wchar_t\": \"WCHAR_T\" }[Setup.bytes_per_ucs_code_point]\n else:\n quex_coding_name_str = { 1: \"ASCII\", 2: \"UCS-2BE\", 4: \"UCS-4BE\", \n \"wchar_t\": \"WCHAR_T\" }[Setup.bytes_per_ucs_code_point]\n\n\n # -- determine whether the lexical analyser needs indentation counting\n # support. if one mode has an indentation handler, than indentation\n # support must be provided.\n indentation_support_f = False\n for mode in Modes.values():\n if mode.on_indentation.get_code() != \"\":\n indentation_support_f = True\n break\n\n lex_id_definitions_str = \"\" \n # NOTE: First mode-id needs to be '1' for compatibility with flex generated engines\n i = 0\n for name in Modes.keys():\n i += 1\n lex_id_definitions_str += \"const int LEX_ID_%s = %i;\\n\" % (name, i)\n\n include_guard_extension = get_include_guard_extension(Setup.output_file_stem)\n\n # -- instances of mode classes as members of the lexer\n mode_object_members_txt, \\\n constructor_txt, \\\n mode_specific_functions_txt, \\\n friend_txt = \\\n get_mode_class_related_code_fragments(Modes.values(), LexerClassName)\n\n # -- define a pointer that directly has the type of the derived class\n if Setup.input_derived_class_name == \"\":\n Setup.input_derived_class_name = LexerClassName\n derived_class_type_declaration = \"\"\n else:\n derived_class_type_declaration = \"class %s;\" % Setup.input_derived_class_name\n\n # -- the friends of the class\n friends_str = \"\"\n for friend in Setup.input_lexer_class_friends:\n friends_str += \" friend class %s;\\n\" % friend\n\n # -- the class body extension\n class_body_extension_str = lexer_mode.class_body.get_code()\n\n # -- the class constructor extension\n class_constructor_extension_str = lexer_mode.class_init.get_code()\n\n fh = open_file_or_die(QuexClassHeaderFileTemplate)\n template_code_txt = fh.read()\n fh.close()\n\n # -- check if exit/entry handlers have to be active\n entry_handler_active_f = False\n exit_handler_active_f = False\n for mode in Modes.values():\n if mode.on_entry_code_fragments() != []: entry_handler_active_f = True\n if mode.on_exit_code_fragments() != []: exit_handler_active_f = True\n\n txt = template_code_txt\n def set_switch(txt, SwitchF, Name):\n if SwitchF: txt = txt.replace(\"$$SWITCH$$ %s\" % Name, \"#define %s\" % Name)\n else: txt = txt.replace(\"$$SWITCH$$ %s\" % Name, \"// #define %s\" % Name)\n return txt\n \n txt = set_switch(txt, entry_handler_active_f, \"__QUEX_OPTION_ON_ENTRY_HANDLER_PRESENT\")\n txt = set_switch(txt, exit_handler_active_f, \"__QUEX_OPTION_ON_EXIT_HANDLER_PRESENT\")\n txt = set_switch(txt, indentation_support_f, \"__QUEX_OPTION_INDENTATION_TRIGGER_SUPPORT\") \n txt = set_switch(txt, True, \"__QUEX_OPTION_SUPPORT_BEGIN_OF_LINE_PRE_CONDITION\")\n txt = set_switch(txt, Setup.enable_iconv_f, \"QUEX_OPTION_ENABLE_ICONV\")\n txt = set_switch(txt, not Setup.disable_token_queue_f, \"QUEX_OPTION_TOKEN_SENDING_VIA_QUEUE\")\n txt = set_switch(txt, not Setup.disable_string_accumulator_f, \"QUEX_OPTION_STRING_ACCUMULATOR\")\n txt = set_switch(txt, Setup.post_categorizer_f, \"QUEX_OPTION_POST_CATEGORIZER\")\n txt = set_switch(txt, True, \"QUEX_OPTION_VIRTUAL_FUNCTION_ON_ACTION_ENTRY\") \n txt = set_switch(txt, True, \"QUEX_OPTION_LINE_NUMBER_COUNTING\") \n txt = set_switch(txt, True, \"QUEX_OPTION_COLUMN_NUMBER_COUNTING\") \n txt = set_switch(txt, Setup.output_debug_f, \"QUEX_OPTION_DEBUG_TOKEN_SENDING\")\n txt = set_switch(txt, Setup.output_debug_f, \"QUEX_OPTION_DEBUG_MODE_TRANSITIONS\")\n txt = set_switch(txt, Setup.output_debug_f, \"QUEX_OPTION_DEBUG_QUEX_PATTERN_MATCHES\")\n txt = set_switch(txt, True, \"QUEX_OPTION_INCLUDE_STACK_SUPPORT\")\n txt = set_switch(txt, not Setup.no_mode_transition_check_f, \n \"QUEX_OPTION_RUNTIME_MODE_TRANSITION_CHECK\")\n\n txt = blue_print(txt,\n [\n [\"$$BUFFER_LIMIT_CODE$$\", \"0x%X\" % Setup.buffer_limit_code],\n [\"$$CONSTRUCTOR_EXTENSTION$$\", class_constructor_extension_str],\n [\"$$CONSTRUCTOR_MODE_DB_INITIALIZATION_CODE$$\", constructor_txt],\n [\"$$CORE_ENGINE_DEFINITIONS_HEADER$$\", CoreEngineDefinitionsHeader],\n [\"$$CLASS_BODY_EXTENSION$$\", class_body_extension_str],\n [\"$$INCLUDE_GUARD_EXTENSION$$\", include_guard_extension],\n [\"$$INITIAL_LEXER_MODE_ID$$\", \"LEX_ID_\" + lexer_mode.initial_mode.get_code()],\n [\"$$LEXER_BUILD_DATE$$\", time.asctime()],\n [\"$$LEXER_BUILD_VERSION$$\", VersionID],\n [\"$$LEXER_CLASS_FRIENDS$$\", friends_str],\n [\"$$LEXER_CLASS_NAME$$\", LexerClassName],\n [\"$$LEXER_DERIVED_CLASS_DECL$$\", derived_class_type_declaration],\n [\"$$LEXER_DERIVED_CLASS_NAME$$\", Setup.input_derived_class_name],\n [\"$$LEX_ID_DEFINITIONS$$\", lex_id_definitions_str],\n [\"$$MAX_MODE_CLASS_N$$\", repr(len(Modes))],\n [\"$$MODE_CLASS_FRIENDS$$\", friend_txt],\n [\"$$MODE_OBJECT_MEMBERS$$\", mode_object_members_txt],\n [\"$$MODE_SPECIFIC_ANALYSER_FUNCTIONS$$\", mode_specific_functions_txt],\n [\"$$PRETTY_INDENTATION$$\", \" \" + \" \" * (len(LexerClassName)*2 + 2)],\n [\"$$QUEX_TEMPLATE_DIR$$\", Setup.QUEX_TEMPLATE_DB_DIR],\n [\"$$QUEX_VERSION$$\", QuexVersionID],\n [\"$$TOKEN_CLASS$$\", Setup.input_token_class_name],\n [\"$$TOKEN_CLASS_DEFINITION_FILE$$\", Setup.input_token_class_file.replace(\"//\",\"/\")],\n [\"$$TOKEN_ID_DEFINITION_FILE$$\", Setup.output_token_id_file.replace(\"//\",\"/\")],\n [\"$$QUEX_CHARACTER_TYPE$$\", quex_character_type_str],\n [\"$$QUEX_LEXEME_TYPE$$\", quex_lexeme_type_str],\n [\"$$CORE_ENGINE_CHARACTER_CODING$$\", quex_coding_name_str],\n [\"$$USER_DEFINED_HEADER$$\", lexer_mode.header.get_code() + \"\\n\"],\n ])\n\n fh_out = open(QuexClassHeaderFileOutput, \"wb\")\n if os.linesep != \"\\n\": txt = txt.replace(\"\\n\", os.linesep)\n fh_out.write(txt)\n fh_out.close()\n\n\ndef write_mode_class_implementation(Modes, Setup):\n LexerClassName = Setup.output_engine_name\n TokenClassName = Setup.input_token_class_name\n OutputFilestem = Setup.output_file_stem\n DerivedClassName = Setup.input_derived_class_name\n DerivedClassHeaderFileName = Setup.input_derived_class_file\n ModeClassImplementationFile = Setup.output_code_file\n\n if DerivedClassHeaderFileName != \"\": txt = \"#include<\" + DerivedClassHeaderFileName +\">\\n\"\n else: txt = \"#include\\\"\" + OutputFilestem +\"\\\"\\n\"\n \n # -- mode class member function definitions (on_entry, on_exit, has_base, ...)\n mode_class_member_functions_txt = mode_classes.do(Modes.values())\n\n mode_objects_txt = \"\" \n for mode_name in Modes:\n mode_objects_txt += \" QuexMode $$LEXER_CLASS_NAME$$::%s;\\n\" % mode_name\n\n txt += \"namespace quex {\\n\"\n txt += mode_objects_txt\n txt += mode_class_member_functions_txt\n txt += \"} // END: namespace quex\\n\"\n\n txt = blue_print(txt, [[\"$$LEXER_CLASS_NAME$$\", LexerClassName],\n [\"$$TOKEN_CLASS$$\", TokenClassName],\n [\"$$LEXER_DERIVED_CLASS_NAME$$\", DerivedClassName]])\n \n fh_out = open(ModeClassImplementationFile, \"wb\")\n if os.linesep != \"\\n\": txt = txt.replace(\"\\n\", os.linesep)\n fh_out.write(txt)\n fh_out.close()\n\n\nquex_mode_init_call_str = \"\"\"\n $$MN$$.id = LEX_ID_$$MN$$;\n $$MN$$.name = \"$$MN$$\";\n $$MN$$.analyser_function = $analyser_function;\n# ifdef __QUEX_OPTION_INDENTATION_TRIGGER_SUPPORT \n $$MN$$.on_indentation = $on_indentation;\n# endif\n $$MN$$.on_entry = $on_entry;\n $$MN$$.on_exit = $on_exit;\n# ifdef __QUEX_OPTION_RUNTIME_MODE_TRANSITION_CHECK\n $$MN$$.has_base = $has_base;\n $$MN$$.has_entry_from = $has_entry_from;\n $$MN$$.has_exit_to = $has_exit_to;\n# endif\n\"\"\"\n\ndef __get_mode_init_call(mode, LexerClassName):\n \n header_str = \"%s_%s_\" % (LexerClassName, mode.name)\n\n analyser_function = header_str + \"analyser_function\" \n on_indentation = header_str + \"on_indentation\" \n on_entry = header_str + \"on_entry\" \n on_exit = header_str + \"on_exit\" \n has_base = header_str + \"has_base\" \n has_entry_from = header_str + \"has_entry_from\" \n has_exit_to = header_str + \"has_exit_to\" \n\n if mode.options[\"inheritable\"] == \"only\": \n analyser_function = \"QuexMode_uncallable_analyser_function\"\n\n if mode.on_entry_code_fragments() == []:\n on_entry = \"QuexMode_on_entry_exit_null_function\"\n\n if mode.on_exit_code_fragments() == []:\n on_exit = \"QuexMode_on_entry_exit_null_function\"\n\n if mode.on_indentation_code_fragments() == []:\n on_indentation = \"QuexMode_on_indentation_null_function\"\n\n txt = blue_print(quex_mode_init_call_str,\n [[\"$$MN$$\", mode.name],\n [\"$analyser_function\", analyser_function],\n [\"$on_indentation\", on_indentation],\n [\"$on_entry\", on_entry],\n [\"$on_exit\", on_exit],\n [\"$has_base\", has_base],\n [\"$has_entry_from\", has_entry_from],\n [\"$has_exit_to\", has_exit_to]])\n\n return txt\n\ndef __get_mode_function_declaration(Modes, LexerClassName, FriendF=False):\n\n if FriendF: prolog = \" friend \"\n else: prolog = \" extern \"\n\n def __mode_functions(Prolog, ReturnType, NameList, ArgList):\n txt = \"\"\n for name in NameList:\n function_signature = \"%s %s_%s_%s(%s);\" % \\\n (ReturnType, LexerClassName, mode.name, name, ArgList)\n txt += \"%s\" % Prolog + \" \" + function_signature + \"\\n\"\n\n return txt\n\n txt = \"\"\n for mode in Modes:\n if mode.options[\"inheritable\"] != \"only\":\n txt += __mode_functions(prolog, \"__QUEX_SETTING_ANALYSER_FUNCTION_RETURN_TYPE\", [\"analyser_function\"],\n \"QuexAnalyser*\")\n for mode in Modes:\n if mode.on_indentation_code_fragments() != []:\n txt += __mode_functions(prolog, \"void\", [\"on_indentation\"], \n LexerClassName + \"*, const int\")\n\n for mode in Modes:\n if mode.on_entry_code_fragments() != []:\n txt += __mode_functions(prolog, \"void\", [\"on_entry\"], \n LexerClassName + \"*, const QuexMode*\")\n\n if mode.on_exit_code_fragments() != []:\n txt += __mode_functions(prolog, \"void\", [\"on_exit\"], \n LexerClassName + \"*, const QuexMode*\")\n\n txt += \"#ifdef __QUEX_OPTION_RUNTIME_MODE_TRANSITION_CHECK\\n\"\n for mode in Modes:\n txt += __mode_functions(prolog, \"bool\", [\"has_base\", \"has_entry_from\", \"has_exit_to\"], \n \"const QuexMode*\")\n \n txt += \"#endif\\n\"\n txt += \"\\n\"\n\n return txt\n\ndef get_mode_class_related_code_fragments(Modes, LexerClassName):\n \"\"\"\n RETURNS: -- members of the lexical analyzer class for the mode classes\n -- static member functions declaring the analyzer functions for he mode classes \n -- constructor init expressions (before '{'), \n -- constructor text to be executed at construction time \n -- friend declarations for the mode classes/functions\n\n \"\"\"\n\n L = max(map(lambda m: len(m.name), Modes))\n\n members_txt = \"\" \n for mode in Modes:\n members_txt += \" static QuexMode %s;\\n\" % mode.name\n\n # constructor code\n txt = \"\"\n for mode in Modes:\n txt += \" __quex_assert(LEX_ID_%s %s<= %i);\\n\" % (mode.name, \" \" * (L-len(mode.name)), len(Modes))\n\n for mode in Modes:\n txt += __get_mode_init_call(mode, LexerClassName)\n\n for mode in Modes:\n txt += \" mode_db[LEX_ID_%s]%s = &%s;\\n\" % (mode.name, \" \" * (L-len(mode.name)), mode.name)\n\n constructor_txt = txt\n\n mode_functions_txt = __get_mode_function_declaration(Modes, LexerClassName, FriendF=False)\n friends_txt = __get_mode_function_declaration(Modes, LexerClassName, FriendF=True)\n\n return members_txt, \\\n constructor_txt, \\\n mode_functions_txt, \\\n friends_txt\n" }, { "alpha_fraction": 0.7199169993400574, "alphanum_fraction": 0.7213001251220703, "avg_line_length": 27.077669143676758, "blob_id": "55f57d0289ba4237139a378f7405bcf634eee4fc", "content_id": "3e1b9bd60b561fba9db3a6170de6c26e80984556", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 2892, "license_type": "permissive", "max_line_length": 80, "num_lines": 103, "path": "/engine/gfx/gfx_sky_body.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <vector>\n#include <string>\n\n#include \"../shared_ptr.h\"\n\nclass GfxSkyBody;\ntypedef SharedPtr<GfxSkyBody> GfxSkyBodyPtr;\n\n#include \"../vect_util.h\"\n\nextern fast_erase_vector<GfxSkyBody*> gfx_all_sky_bodies;\n\n\n#ifndef SKY_BODY_H\n#define SKY_BODY_H\n\n#include <math_util.h>\n\n#include \"gfx_disk_resource.h\"\n#include \"gfx_sky_material.h\"\n\nclass GfxSkyBody : public fast_erase_index {\n protected:\n static const std::string className;\n\n bool dead;\n bool enabled;\n\n unsigned char zOrder;\n Quaternion orientation;\n\n Ogre::MeshPtr mesh;\n GfxSkyMaterials materials;\n\n const DiskResourcePtr<GfxMeshDiskResource> gdr;\n\n GfxSkyBody (const DiskResourcePtr<GfxMeshDiskResource> &gdr, short z_order);\n\n public:\n\n virtual ~GfxSkyBody (void);\n\n static GfxSkyBodyPtr make (const std::string &mesh_name, short z_order);\n\n const Ogre::MeshPtr &getMesh (void) {\n return mesh;\n }\n\n std::string getMeshName (void) const {\n return \"/\" + mesh->getName();\n }\n\n unsigned getNumSubMeshes (void) { return materials.size(); }\n GfxSkyMaterial *getMaterial (unsigned i);\n void setMaterial (unsigned i, GfxSkyMaterial *m);\n unsigned getSubMeshByOriginalMaterialName (const std::string &n);\n\n void destroy (void);\n virtual bool destroyed (void) const { return dead; }\n\n Quaternion getOrientation (void);\n void setOrientation (const Quaternion &q);\n\n unsigned char getZOrder (void);\n void setZOrder (unsigned char v);\n\n bool isEnabled (void);\n void setEnabled (bool v);\n\n void reinitialise (void);\n\n void render (const GfxShaderGlobals &g);\n\n friend class GfxSkyMaterial;\n friend class GfxMeshDiskResource;\n\n};\n\n// called every frame\nvoid gfx_sky_render (GfxPipeline *p);\n\n#endif\n" }, { "alpha_fraction": 0.5079035758972168, "alphanum_fraction": 0.5237107872962952, "avg_line_length": 35.31999969482422, "blob_id": "8451da1e7868006edd5c853648908a79c1db431d", "content_id": "df3938ae6372b0a0a3eb4aec9ad46c1044acaf7a", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 15436, "license_type": "permissive", "max_line_length": 137, "num_lines": 425, "path": "/engine/gfx/gfx_text_buffer.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <unicode_util.h>\n\n#include \"gfx_text_buffer.h\"\n\nconst unsigned VERT_FLOAT_SZ = 2+2+4;\nconst unsigned VERT_BYTE_SZ = VERT_FLOAT_SZ*sizeof(float);\n\n/** If the font doesn't have the codepoint, try some alternatives. */\nstatic GfxFont::codepoint_t override_cp (GfxFont *font, GfxFont::codepoint_t cp) \n{\n if (font->hasCodePoint(cp)) return cp;\n if (font->hasCodePoint(UNICODE_ERROR_CODEPOINT)) return UNICODE_ERROR_CODEPOINT;\n if (font->hasCodePoint(' ')) return ' ';\n if (font->hasCodePoint('E')) return 'E';\n return cp;\n}\n\nstatic bool is_whitespace (GfxFont::codepoint_t cp)\n{\n return cp==' ' || cp=='\\n' || cp=='\\t';\n}\n\nGfxTextBuffer::GfxTextBuffer (GfxFont *font)\n : font(font), currentDrawnDimensions(0,0), currentLeft(0), currentTop(0),\n lastTop(0), lastBottom(0), wrap(0), dirty(false)\n{ \n APP_ASSERT(font != NULL);\n\n vBuf.setNull();\n iBuf.setNull();\n vData.vertexBufferBinding->setBinding(0, vBuf);\n vData.vertexStart = 0;\n vData.vertexCount = 0;\n\n iData.indexBuffer = iBuf;\n iData.indexStart = 0;\n iData.indexCount = 0;\n currentGPUCapacity = 0;\n\n\n op.useIndexes = true;\n op.vertexData = &vData;\n op.indexData = &iData;\n op.operationType = Ogre::RenderOperation::OT_TRIANGLE_LIST;\n\n\n unsigned vdecl_sz = 0;\n vdecl_sz += vData.vertexDeclaration->addElement(0, vdecl_sz, Ogre::VET_FLOAT2, Ogre::VES_POSITION, 0).getSize();\n vdecl_sz += vData.vertexDeclaration->addElement(0, vdecl_sz, Ogre::VET_FLOAT2, Ogre::VES_TEXTURE_COORDINATES, 0).getSize(); // uv\n vdecl_sz += vData.vertexDeclaration->addElement(0, vdecl_sz, Ogre::VET_FLOAT4, Ogre::VES_TEXTURE_COORDINATES, 1).getSize(); // colour\n APP_ASSERT(vdecl_sz == VERT_BYTE_SZ);\n}\n\n// searching for the i such that cT[i-1].top < top && cT[i].top >= top, or 0 if cT[0] >= top\nunsigned long GfxTextBuffer::binaryChopTop (unsigned long begin, unsigned long end, unsigned long top)\n{\n unsigned long middle = (end + begin + 1) / 2;\n if (middle == 0) return middle;\n if (middle == colouredText.size() - 1) return middle+1;\n const ColouredChar &c = colouredText[middle];\n const ColouredChar &b = colouredText[middle-1];\n if (c.top < top) {\n // too close to the beginning of the text, look right\n APP_ASSERT(begin != middle); // this leads to infinite recursion\n return binaryChopTop(middle, end, top);\n } else if (b.top < top) {\n // found it\n return middle;\n } else {\n // too close to the end of the text, look left\n return binaryChopTop(begin, middle-1, top);\n }\n}\n\n// searching for the i such that cT[i].top <= top && cT[i+1].top > top, or sz-1 if cT[sz-1] < top\nunsigned long GfxTextBuffer::binaryChopBottom (unsigned long begin, unsigned long end, unsigned long bottom_top)\n{ \n unsigned long middle = (end + begin) / 2;\n if (middle == colouredText.size() - 1) return middle;\n const ColouredChar &c = colouredText[middle];\n const ColouredChar &d = colouredText[middle+1];\n if (c.top > bottom_top) {\n // too close to the end of the text, look left\n APP_ASSERT(middle != end); // this leads to infinite recursion\n return binaryChopBottom(begin, middle, bottom_top);\n } else if (d.top > bottom_top) {\n // found it\n return middle;\n } else {\n // too close to the beginning of the text, look right\n return binaryChopBottom(middle+1, end, bottom_top);\n }\n}\n\nvoid GfxTextBuffer::updateGPU (bool no_scroll, long top, long bottom)\n{\n if (lastTop != top || lastBottom != bottom) dirty = true;\n if (!dirty) return;\n\n currentDrawnDimensions = Vector2(0,0);\n rawVBuf.clear();\n rawIBuf.clear();\n\n unsigned long start_index = 0;\n unsigned long stop_index = colouredText.size();\n float zero = 0;\n\n if (!no_scroll && colouredText.size() > 0) {\n long bottom_top = bottom - long(font->getHeight());\n /* find start and stop */\n if (bottom_top < 0) {\n start_index = 0;\n stop_index = 0;\n } else {\n start_index = binaryChopTop(0, colouredText.size() - 1, std::max(0l, top));\n stop_index = 1+binaryChopBottom(0, colouredText.size() - 1, std::max(0l, bottom_top));\n zero = top;\n }\n }\n\n unsigned long current_size = 0;\n\n for (unsigned long i=start_index ; i<stop_index ; ++i) {\n const ColouredChar &c = colouredText[i];\n if (is_whitespace(c.cp)) {\n continue;\n }\n\n GfxFont::CharRect uvs;\n GfxFont::codepoint_t cp = override_cp(font, c.cp);\n bool r = font->getCodePointOrFail(cp, uvs);\n if (!r) continue;\n Vector2 tex_dim = font->getTextureDimensions();\n float width = uvs.u2 - uvs.u1;\n float height = uvs.v2 - uvs.v1;\n\n if (width == 0 || height == 0) {\n // invalid char rect in font -- indicates char should not be rendered\n continue;\n }\n\n // use font, add to raw buf\n /* 0---1\n | /|\n | / |\n |/ |\n 2---3 indexes: 0 2 1 1 2 3\n */\n {\n // 4 because there are 4 vertexes per letter\n rawVBuf.resize(rawVBuf.size() + VERT_FLOAT_SZ*4);\n float *base = &rawVBuf[current_size * VERT_FLOAT_SZ*4];\n\n (*base++) = c.left;\n (*base++) = -(c.top - zero);\n (*base++) = uvs.u1 / tex_dim.x;\n (*base++) = uvs.v1 / tex_dim.y;\n (*base++) = c.topColour.x;\n (*base++) = c.topColour.y;\n (*base++) = c.topColour.z;\n (*base++) = c.topAlpha;\n\n (*base++) = c.left + width;\n (*base++) = -(c.top - zero);\n (*base++) = uvs.u2 / tex_dim.x;\n (*base++) = uvs.v1 / tex_dim.y;\n (*base++) = c.topColour.x;\n (*base++) = c.topColour.y;\n (*base++) = c.topColour.z;\n (*base++) = c.topAlpha;\n\n (*base++) = c.left;\n (*base++) = -(c.top - zero + height);\n (*base++) = uvs.u1 / tex_dim.x;\n (*base++) = uvs.v2 / tex_dim.y;\n (*base++) = c.bottomColour.x;\n (*base++) = c.bottomColour.y;\n (*base++) = c.bottomColour.z;\n (*base++) = c.bottomAlpha;\n\n (*base++) = c.left + width;\n (*base++) = -(c.top - zero + height);\n (*base++) = uvs.u2 / tex_dim.x;\n (*base++) = uvs.v2 / tex_dim.y;\n (*base++) = c.bottomColour.x;\n (*base++) = c.bottomColour.y;\n (*base++) = c.bottomColour.z;\n (*base++) = c.bottomAlpha;\n }\n\n {\n // 6 because there are 2 triangles per letter\n rawIBuf.resize(rawIBuf.size() + 6);\n uint16_t *base = &rawIBuf[current_size * 6];\n (*base++) = current_size*4 + 0;\n (*base++) = current_size*4 + 2;\n (*base++) = current_size*4 + 1;\n (*base++) = current_size*4 + 1;\n (*base++) = current_size*4 + 2;\n (*base++) = current_size*4 + 3;\n }\n\n current_size++;\n\n // calculate text bounds\n currentDrawnDimensions.x = std::max(currentDrawnDimensions.x, float(c.left + width));\n currentDrawnDimensions.y = std::max(currentDrawnDimensions.y, float(c.top + font->getHeight()));\n\n }\n\n\n // do the actual copy to GPU (resize if necessary)\n\n unsigned vertex_size = current_size * 4; // 4 verts per quad\n unsigned index_size = current_size * 6; // 2 triangles per quad\n\n if (currentGPUCapacity < current_size) {\n // resize needed\n\n vBuf.setNull();\n iBuf.setNull();\n\n vBuf = Ogre::HardwareBufferManager::getSingleton().createVertexBuffer(\n VERT_BYTE_SZ,\n vertex_size,\n Ogre::HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY);\n\n iBuf = Ogre::HardwareBufferManager::getSingleton().createIndexBuffer(\n Ogre::HardwareIndexBuffer::IT_16BIT,\n index_size,\n Ogre::HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY);\n\n vData.vertexBufferBinding->setBinding(0, vBuf);\n iData.indexBuffer = iBuf;\n\n currentGPUCapacity = current_size;\n }\n\n if (current_size > 0) {\n // copy the whole thing every time (could optimise this if needed)\n vBuf->writeData(0, vertex_size*VERT_BYTE_SZ, &rawVBuf[0], true);\n iBuf->writeData(0, index_size*sizeof(uint16_t), &rawIBuf[0], true);\n }\n \n vData.vertexCount = vertex_size;\n iData.indexCount = index_size;\n\n dirty = false;\n lastTop = top;\n lastBottom = bottom;\n}\n\nvoid GfxTextBuffer::recalculatePositions (unsigned long start)\n{\n if (start == 0) {\n currentLeft = 0;\n currentTop = 0;\n }\n unsigned word_first_letter = 0;\n bool in_word = false;\n bool word_first_on_line = true;\n for (unsigned long i=start ; i<colouredText.size() ; ++i) {\n if (!in_word) {\n word_first_letter = i;\n in_word = true;\n }\n ColouredChar &c = colouredText[i];\n if (is_whitespace(c.cp)) {\n in_word = false;\n word_first_on_line = false;\n }\n\n c.left = currentLeft;\n c.top = currentTop;\n\n switch (c.cp) {\n case '\\n':\n word_first_on_line = true;\n currentLeft = 0;\n currentTop += font->getHeight();\n break;\n\n case '\\t': {\n GfxFont::CharRect uvs;\n if (font->getCodePointOrFail(' ', uvs)) {\n // TODO: override tab width per textbuffer?\n unsigned long tab_width = 8 * (uvs.u2 - uvs.u1);\n // round up to next multiple of tab_width\n if (tab_width > 0)\n currentLeft = (currentLeft + tab_width)/tab_width * tab_width;\n }\n }\n break;\n\n default: {\n GfxFont::CharRect uvs;\n GfxFont::codepoint_t cp = override_cp(font, c.cp);\n if (!font->getCodePointOrFail(cp, uvs)) continue;\n float width = (uvs.u2 - uvs.u1);\n currentLeft += width;\n if (c.cp != ' ') {\n }\n }\n }\n\n if (wrap>0 && currentLeft>wrap) {\n if (c.cp == '\\t') {\n // let the tab fill up the remainder of the line\n // continue on the next line\n } else if (c.cp == ' ') {\n // let the space take us to the next line\n } else if (c.left == 0) {\n // break at next char, wasn't even enough space for 1 char\n } else if (word_first_on_line) {\n // break at char\n i--;\n } else {\n // break at word\n i = word_first_letter - 1;\n }\n in_word = false;\n word_first_on_line = true;\n currentLeft = 0;\n currentTop += font->getHeight();\n continue;\n }\n\n }\n dirty = true;\n}\n\nvoid GfxTextBuffer::addFormattedString (const std::string &text,\n const Vector3 &top_colour, float top_alpha,\n const Vector3 &bot_colour, float bot_alpha)\n{\n Vector3 ansi_colour[] = {\n Vector3(0,0,0), Vector3(.8,0,0), Vector3(0,.8,0), Vector3(.8,.8,0),\n Vector3(0,0,.93), Vector3(.8,0,.8), Vector3(0,.8,.8), Vector3(.75,.75,.75),\n };\n Vector3 ansi_bold_colour[] = {\n Vector3(0.5,0.5,0.5), Vector3(1,0,0), Vector3(0,1,0), Vector3(1,1,0),\n Vector3(.36,.36,1), Vector3(1,0,1), Vector3(0,1,1), Vector3(1,1,1),\n };\n\n ColouredChar c(0, top_colour, top_alpha, bot_colour, bot_alpha);\n\n unsigned long original_size = colouredText.size();\n\n bool bold = false;\n unsigned default_colour = 7; // FIXME: this assumes a 'white on black' console\n unsigned last_colour = default_colour;\n for (size_t i=0 ; i<text.length() ; ++i) {\n GfxFont::codepoint_t cp = decode_utf8(text, i);\n if (cp == UNICODE_ESCAPE_CODEPOINT) {\n if (++i >= text.length()) break;\n cp = decode_utf8(text, i);\n if (cp == '[') {\n // continue until 'm'\n unsigned code = 0;\n do {\n if (++i >= text.length()) break;\n cp = decode_utf8(text, i);\n if (cp == 'm' || cp == ';') {\n // act on code\n if (code == 0) {\n bold = false;\n last_colour = default_colour;\n c.topColour = top_colour;\n c.bottomColour = bot_colour;\n } else if (code == 1) {\n bold = true;\n Vector3 col = bold ? ansi_bold_colour[last_colour] : ansi_colour[last_colour];\n c.topColour = col;\n c.bottomColour = col;\n } else if (code == 22) {\n bold = false;\n Vector3 col = bold ? ansi_bold_colour[last_colour] : ansi_colour[last_colour];\n c.topColour = col;\n c.bottomColour = col;\n } else if (code >= 30 && code <= 37) {\n last_colour = code - 30;\n Vector3 col = bold ? ansi_bold_colour[last_colour] : ansi_colour[last_colour];\n c.topColour = col;\n c.bottomColour = col;\n }\n code = 0;\n }\n if (cp == 'm') break;\n if (cp >= '0' && cp <= '9') {\n unsigned digit = cp - '0';\n code = 10*code + digit;\n }\n } while (true);\n if (cp == 'm') continue;\n }\n }\n \n // This char is not part of an ansi terminal colour code.\n c.cp = cp;\n colouredText.push_back(c);\n }\n\n recalculatePositions(original_size);\n}\n" }, { "alpha_fraction": 0.7075707316398621, "alphanum_fraction": 0.7104825377464294, "avg_line_length": 21.866666793823242, "blob_id": "e50c4074b4755b0462c8c57619cc65e24404ce48", "content_id": "8e2b4704df45d7818dae3feb5fbe0b273a9320da", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Makefile", "length_bytes": 2404, "license_type": "permissive", "max_line_length": 41, "num_lines": 105, "path": "/engine/grit.mk", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "\n\nGSL_CPP_SRCS= \\\n\tgfx/gfx_gasoline.cpp \\\n\tgfx/gfx_gasoline_parser.cpp \\\n\tgfx/gfx_gasoline_type_system.cpp \\\n\tgfx/gfx_gasoline_backend.cpp \\\n\tgfx/gfx_gasoline_backend_gsl.cpp \\\n\tgfx/gfx_gasoline_backend_cg.cpp \\\n\tgfx/gfx_gasoline_backend_glsl.cpp \\\n\n\nGSL_STANDALONE_CPP_SRCS= \\\n\tgfx/gfx_gasoline_standalone.cpp \\\n\t$(GSL_CPP_SRCS) \\\n\n\nCOL_CONV_CPP_SRCS= \\\n\tphysics/bcol_parser.cpp \\\n\tphysics/tcol_lexer-core-engine.cpp \\\n\tphysics/tcol_lexer.cpp \\\n\tphysics/tcol_parser.cpp \\\n\n\nCOL_CONV_STANDALONE_CPP_SRCS = \\\n\tphysics/grit_col_conv.cpp \\\n\t$(COL_CONV_CPP_SRCS) \\\n\n\nENGINE_CPP_SRCS=\\\n\tbackground_loader.cpp \\\n\tbullet_debug_drawer.cpp \\\n\tcore_option.cpp \\\n\tdense_index_map.cpp \\\n\tdisk_resource.cpp \\\n\texternal_table.cpp \\\n\tgrit_class.cpp \\\n\tgrit_lua_util.cpp \\\n\tgrit_object.cpp \\\n\tinput_filter.cpp \\\n\tldbglue.cpp \\\n\tlua_wrappers_core.cpp \\\n\tlua_wrappers_disk_resource.cpp \\\n\tlua_wrappers_gritobj.cpp \\\n\tlua_wrappers_primitives.cpp \\\n\tmain.cpp \\\n\tpath_util.cpp \\\n\tstreamer.cpp \\\n\t \\\n\taudio/audio.cpp \\\n\taudio/lua_wrappers_audio.cpp \\\n\taudio/audio_disk_resource.cpp \\\n\taudio/ogg_vorbis_decoder.cpp \\\n\t \\\n\tgfx/gfx_body.cpp \\\n\tgfx/gfx.cpp \\\n\tgfx/gfx_debug.cpp \\\n\tgfx/gfx_decal.cpp \\\n\tgfx/gfx_disk_resource.cpp \\\n\tgfx/gfx_fertile_node.cpp \\\n\tgfx/gfx_font.cpp \\\n\tgfx/gfx_gl3_plus.cpp \\\n\tgfx/gfx_instances.cpp \\\n\tgfx/gfx_light.cpp \\\n\tgfx/gfx_material.cpp \\\n\tgfx/gfx_node.cpp \\\n\tgfx/gfx_option.cpp \\\n\tgfx/gfx_particle_system.cpp \\\n\tgfx/gfx_pipeline.cpp \\\n\tgfx/gfx_ranged_instances.cpp \\\n\tgfx/gfx_shader.cpp \\\n\tgfx/gfx_sky_body.cpp \\\n\tgfx/gfx_sky_material.cpp \\\n\tgfx/gfx_sprite_body.cpp \\\n\tgfx/gfx_text_body.cpp \\\n\tgfx/gfx_text_buffer.cpp \\\n\tgfx/gfx_tracer_body.cpp \\\n\tgfx/hud.cpp \\\n\tgfx/lua_wrappers_gfx.cpp \\\n\t \\\n\tnavigation/chunky_tri_mesh.cpp \\\n\tnavigation/crowd_manager.cpp \\\n\tnavigation/fastlz.cpp \\\n\tnavigation/input_geom.cpp \\\n\tnavigation/lua_wrappers_navigation.cpp \\\n\tnavigation/mesh_loader_obj.cpp \\\n\tnavigation/navigation.cpp \\\n\tnavigation/navigation_interfaces.cpp \\\n\tnavigation/navigation_manager.cpp \\\n\t \\\n\tnet/lua_wrappers_net.cpp \\\n\tnet/net_address.cpp \\\n\tnet/net.cpp \\\n\tnet/net_manager.cpp \\\n\tnet/net_message.cpp \\\n\t \\\n\tlinux/keyboard_x11.cpp \\\n\tlinux/mouse_x11.cpp \\\n\tlinux/x11_clipboard.cpp \\\n\tlinux/joystick_devjs.cpp \\\n\t \\\n\tphysics/collision_mesh.cpp \\\n\tphysics/lua_wrappers_physics.cpp \\\n\tphysics/physical_material.cpp \\\n\tphysics/physics_world.cpp \\\n\t$(COL_CONV_CPP_SRCS) \\\n\t$(GSL_CPP_SRCS) \\\n\n" }, { "alpha_fraction": 0.6118009090423584, "alphanum_fraction": 0.6392172574996948, "avg_line_length": 28.696165084838867, "blob_id": "c62efb183e1e9ca7201e07e2da54b10442ca44b5", "content_id": "89a917c5060e6e01c6d70655b4acb932ca20322a", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 10067, "license_type": "permissive", "max_line_length": 80, "num_lines": 339, "path": "/gtasa/dffread.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#ifndef DFFREAD_H_\n#define DFFREAD_H_\n\n#include <string>\n#include <set>\n#include <vector>\n\n#include \"ideread.h\"\n// #include \"physics/tcol_parser.h\"\n\n#include \"col_parser.h\"\n\n#define GEO_TRISTRIP 0x1\n#define GEO_POSITIONS 0x2\n#define GEO_TEXCOORDS 0x4\n#define GEO_COLOURS 0x8\n#define GEO_NORMALS 0x10\n#define GEO_LIGHTS 0x20\n#define GEO_MODULATE 0x40\n#define GEO_TEXCOORDS2 0x80\n#define GEO_UNKNOWN1 0x10000\n#define GEO_UNKNOWN2 0x20000\n\n\n#define RW_DATA 0x1\n#define RW_STRING 0x2\n#define RW_EXT 0x3\n#define RW_TEXTURE 0x6\n#define RW_MATERIAL 0x7\n#define RW_MATERIAL_LIST 0x8\n#define RW_FRAME_LIST 0xE\n#define RW_GEOMETRY 0xF\n#define RW_CHUNK 0x10\n#define RW_LIGHT 0x12\n#define RW_ATOMIC 0x14\n#define RW_GEOMETRY_LIST 0x1A\n#define RW_RIGHT_TO_RENDER 0x1F\n#define RW_UV_ANIMATION_DICTIONARY 0x2B\n#define RW_SKY_MIPMAP_VAL 0x110\n#define RW_BONE 0x11E\n#define RW_SKIN 0x116\n#define RW_MATERIAL_EFFECTS 0x120\n#define RW_ADC 0x134 // no idea what this is\n#define RW_UV_ANIMATION 0x135\n#define RW_MATERIALSPLIT 0x50E\n\n#define RW_UNKNOWN 0x0253F2F3\n#define RW_SPEC 0x0253F2F6\n#define RW_2DFX 0x0253F2F8\n#define RW_NIGHT 0x0253F2F9\n#define RW_COLLISION 0x0253F2FA\n#define RW_REFLECTION_MATERIAL 0x0253F2FC\n#define RW_MESHEXT 0x0253F2FD\n#define RW_FRAME 0x253F2FE\n\n\n#define MATBUMP1 0x1 //these are for use in mat_type1\n#define MATENV1 0x2\n#define MATBUMPENV1 0x3\n#define MATDUALPASS1 0x4\n#define MATUVTRANSFORM1 0x5\n#define MATDUALUVTRANSFORM1 0x6\n\n#define MATBUMP2 0x1 //these are for use in mat_type2\n#define MATENV2 0x2\n#define MATBUMPENV2 0x1\n#define MATDUALPASS2 0x4\n#define MATUVTRANSFORM2 0x5\n#define MATDUALUVTRANSFORM2 0x5\n\ntypedef std::set<std::string> StringSet;\n\ntypedef std::vector<std::string> Strings;\n\nstruct texture {\n unsigned short filter_flags;\n unsigned short unk1;\n std::string name;\n bool has_alpha;\n};\n\nstruct reflection_material { float unk1, unk2, unk3, unk4, unk5, unk6; };\n\nstruct material {\n unsigned long colour;\n unsigned long unk2;\n unsigned long num_textures;\n float unk3, unk4, unk5;\n std::vector<struct texture> textures;\n Strings rewrittenTextures;\n struct reflection_material reflection_material;\n unsigned long mat_type1; //for effects stuff\n unsigned long mat_type2; //for effects stuff\n unsigned long mat_type3; //for effects stuff\n float multiplier; //for effects stuff\n float multiplier2; //for effects stuff\n unsigned long src_blend_type; //for effects stuff\n unsigned long dest_blend_type; //for effects stuff\n unsigned long dest_blend_type2; //for effects stuff\n unsigned long num_effects_textures; //for effects stuff\n unsigned long num_effects_textures2; //for effects stuff\n std::vector<struct texture> effects_textures;\n std::vector<struct texture> effects_textures2;\n float spec_level;\n std::string spec_texture;\n unsigned long rtr_unk1, rtr_unk2;\n};\n\nstruct existing_material { \n float r;\n float g;\n float b;\n float a;\n Strings texs;\n bool alpha_blend;\n bool double_sided;\n bool no_alpha_reject;\n bool dynamic_lighting;\n};\n\nbool operator< (const existing_material &a, const existing_material &b);\n\ntypedef std::map<existing_material,std::string> MatDB;\n\n\nstruct fragment {\n std::string texname, atexname;\n float unk1;\n float unk2;\n float unk3;\n};\n\n// material split\nstruct MatSplit {\n std::string surrogate; // a material we should use instead\n unsigned long num_indexes;\n unsigned long material;\n //unsigned longset indexes;\n std::vector<unsigned long> indexes2;\n};\ntypedef std::vector<MatSplit> MatSplits;\n\nstruct face { unsigned short v2, v1, flags, v3; };\n\nstruct vect {\n float x, y, z;\n vect () : x(0), y(0), z(0) { }\n vect (float x_, float y_, float z_) : x(x_), y(y_), z(z_) { }\n};\n\nstruct texcoord { float u, v; };\nstruct light { float unk1, unk2; };\n\nstatic inline bool vect_eq (struct vect v1, struct vect v2)\n{\n return v1.x==v2.x && v1.y==v2.y && v1.z==v2.z;\n}\n\n// 2dfx\n#define TWODFX_LIGHT 0\n#define TWODFX_PFX 1\n#define TWODFX_PED 3\n#define TWODFX_UNK1 6\n#define TWODFX_SIGN 7\n#define TWODFX_SLOTMACHINE 8\n#define TWODFX_UNK2 9\n#define TWODFX_ESCALATOR 10\nstruct twodfx {\n float x,y,z;\n uint32_t sz;\n uint32_t type;\n struct {\n uint8_t r, g, b, x;\n float draw_distance;\n float outer_range;\n float size;\n float inner_range;\n uint8_t params[5];\n std::string corona_name;\n std::string shadow_name;\n int32_t flare;\n uint8_t flare_params[3];\n } light;\n struct {\n std::string particle_name;\n } pfx;\n struct {\n } ped;\n struct {\n } unk1;\n struct {\n } sign;\n struct {\n } slotmachine;\n struct{\n } unk2 ;\n struct {\n } escalator;\n};\n\nstruct geometry {\n unsigned long flags;\n unsigned long num_faces;\n unsigned long num_vertexes;\n unsigned long num_frames;\n float ambient, diffuse, specular;\n std::vector<unsigned long> vertex_cols;\n std::vector<struct texcoord> tex_coords;\n std::vector<struct face> faces;\n float b_x, b_y, b_z, b_r; // bounding sphere\n unsigned long has_position;\n unsigned long has_normals;\n std::vector<struct vect> vertexes;\n std::vector<struct vect> normals;\n std::vector<struct light> lights;\n std::vector<struct texcoord> tex_coords2;\n unsigned long num_materials;\n std::vector<struct material> materials;\n unsigned long face_type;\n unsigned long num_mat_spls;\n unsigned long num_indexes;\n std::vector<struct MatSplit> mat_spls;\n unsigned long unk2;\n unsigned long vertex_night_unk;\n std::vector<unsigned long> vertex_night_cols;\n std::vector<float> meshext_vertexes;\n std::vector<unsigned long> meshext_vertexcols;\n std::vector<float> meshext_texcoords;\n std::vector<unsigned short> meshext_indexes;\n std::vector<unsigned short> meshext_face_fragment;\n std::vector<struct fragment> meshext_fragments;\n std::vector<struct twodfx> twodfxs;\n\n long frame;\n};\n\nstruct frame {\n float rot[9];\n float x, y, z;\n long parent_frame;\n std::vector<unsigned long> children;\n unsigned long unk;\n unsigned long bone_unk_flags;\n unsigned long bone_id;\n unsigned long num_bones;\n unsigned long bone_unk1, bone_unk2;\n std::vector<unsigned long> bone_ids;\n std::vector<unsigned long> bone_nums;\n std::vector<unsigned long> bone_types;\n std::string name;\n long geometry;\n};\n\nstruct object {\n unsigned long frame_index;\n long geometry_index;\n unsigned long unk1, unk2, rtr_unk1, rtr_unk2, eff;\n};\n\nstruct light2 {\n float unk1;\n float unk2;\n float unk3;\n float unk4;\n float unk5; // usually 0 (1026/1038 times)\n unsigned long flags;\n};\n\nstruct dff {\n std::vector<struct frame> frames;\n unsigned long root_frame;\n std::vector<struct geometry> geometries;\n std::vector<struct object> objects;\n std::vector<struct light2> lights;\n unsigned long unk;\n TColFile tcol;\n bool has_tcol;\n std::string col_name;\n};\n\n// read from f, write into c, use p as a prefix on debug messages\nvoid ios_read_dff (int debug_threshold, std::ifstream &f,\n dff *c, const std::string &p,\n const std::string &phys_mat_pref, MaterialMap &db);\n\nvoid offset_dff (dff &dff, float x, float y, float z);\n\n// apply transformation to geometry, set transformation to identity\nvoid reset_dff_frame (dff &dff, unsigned frame);\n\nvoid export_xml (const StringSet &texs,\n const ide &ide,\n const std::vector<std::string> &img,\n std::ostream &out,\n const std::string &fname,\n const Obj &obj,\n const std::string &oname,\n struct geometry &g,\n MatDB &matdb,\n std::ostream &materials_lua);\n\nvoid init_ogre (void);\n\nvoid export_mesh (const StringSet &texs,\n const ide &ide,\n const std::vector<std::string> &img,\n std::ostream &out,\n const std::string &fname,\n const Obj &obj,\n const std::string &oname,\n struct geometry &g,\n MatDB &matdb,\n std::ostream &materials_lua);\n\nvoid generate_normals (struct geometry &g);\n#endif\n\n// vim: shiftwidth=8:tabstop=8:expandtab\n" }, { "alpha_fraction": 0.5251336693763733, "alphanum_fraction": 0.5262032151222229, "avg_line_length": 20.238636016845703, "blob_id": "8ed798f2ca415bd66c8b5851eedf3eeedcf15e6c", "content_id": "a49d714840b8f8dfba43ab7f741b4245fb13f913", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 1870, "license_type": "permissive", "max_line_length": 70, "num_lines": 88, "path": "/dependencies/quex-0.34.1/demo/001/simple.qx", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "// -*- C++ -*-\nstart = PROGRAM;\n\nheader {\n#include <cstdlib> // C++ adapted 'stdlib.h'\n// // gets: atoi(const char*) \n}\n\ndefine {\n // -*- C -*- // just to color it in emacs\n // Pattern definitions for example application\n P_IDENTIFIER [a-zA-Z]+\n P_NUMBER [0-9]+\n //\n P_STRING_DELIMITER \"\\\"\"\n P_BACKSLASHED_STRING_DELIMITER \"\\\\\\\"\"\n P_BACKSLASHED_BACKSLASH \"\\\\\\\\\"\n}\n\ntoken {\n BRACKET_O\n BRACKET_C\n CURLY_BRACKET_O\n CURLY_BRACKET_C\n OP_ASSIGNMENT\n IF\n IDENTIFIER\n STRUCT\n SEMICOLON\n NUMBER\n STRING\n QUOTE\n}\n\nmode END_OF_FILE :\n<inheritable: only> \n{ \n <<EOF>> {\n self.send(quex::token::ID_TERMINATION);\n RETURN;\n }\n}\n\n\nmode PROGRAM :\n END_OF_FILE\n<entry: STRING_READER>\n<exit: STRING_READER>\n{\n \"{\" { self.send(QUEX_TKN_CURLY_BRACKET_O); RETURN; }\n \"}\" => QUEX_TKN_CURLY_BRACKET_C;\n \"=\" => QUEX_TKN_OP_ASSIGNMENT;\n \"struct\" => QUEX_TKN_STRUCT;\n if => QUEX_TKN_IF;\n \";\" => QUEX_TKN_SEMICOLON;\n\n [a-z]+ { self.send(QUEX_TKN_IDENTIFIER, Lexeme); }\n {P_NUMBER} => QUEX_TKN_NUMBER(atoi((const char*)Lexeme));\n\n [ \\t\\n] { }\n\n {P_STRING_DELIMITER} {\n self.send(QUEX_TKN_QUOTE);\n self << STRING_READER;\n RETURN;\n }\n}\n\nmode STRING_READER :\n END_OF_FILE\n<entry: PROGRAM>\n<exit: PROGRAM>\n{\n on_entry { self.accumulator.clear(); }\n on_exit { \n self.accumulator.flush(QUEX_TKN_STRING); \n self.send(QUEX_TKN_QUOTE);\n }\n\n {P_BACKSLASHED_STRING_DELIMITER} { self.accumulator.add(Lexeme); }\n {P_BACKSLASHED_BACKSLASH} { self.accumulator.add(Lexeme); }\n\n {P_STRING_DELIMITER} { self << PROGRAM; RETURN; }\n\n <<FAIL>> {\n self.accumulator.add(Lexeme);\n }\n}\n\n" }, { "alpha_fraction": 0.7024371027946472, "alphanum_fraction": 0.7122641801834106, "avg_line_length": 35.342857360839844, "blob_id": "b3ca447653646eee668df2b4636c4fa534413320", "content_id": "69f76db440799f97f7fccd1533d6895e563d9201", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 2544, "license_type": "permissive", "max_line_length": 120, "num_lines": 70, "path": "/engine/audio/ogg_vorbis_decoder.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#ifndef OGG_VORBIS_DECODER_H\n#define OGG_VORBIS_DECODER_H\n\n#include <string>\n#include <vorbis/codec.h>\n#include <vorbis/vorbisfile.h>\n#include <centralised_log.h>\n\nclass OggVorbisDecoder {\npublic:\n OggVorbisDecoder (const std::string& name, const Ogre::DataStreamPtr &file);\n ~OggVorbisDecoder (void);\n\n void prepare (void); //read initial headers\n \n bool isOggVorbis (void);\n bool stereo (void);\n int rate (void);\n \n uint32_t total_decoded_size (void); //returns a size of buffer needed to hold the whole decoded pcm for all channels\n \n uint32_t raw_total (void);\n uint32_t pcm_total (void);\n double time_total (void); //total size is in seconds\n \n uint32_t raw_seek (uint32_t pos); //when speed is priority use of this function is recommended\n uint32_t pcm_seek (uint32_t pos);\n uint32_t time_seek (double pos); //pos is in seconds\n \n uint32_t raw_tell (void);\n uint32_t pcm_tell (void);\n double time_tell (void);\n \n long read (char *buffer, int length); //note this actually reads 2 byte samples\n //TODO: expose ov_read_float()\nprivate:\n const std::string name; //used in thrown exceptions\n Ogre::DataStreamPtr file;\n \n bool prepared; //is initial headers were read?\n \n vorbis_info *info;\n \n OggVorbis_File vf; //needed for vorbis file decoding\n \n ov_callbacks callbacks;\n};\n\n#endif //OGG_VORBIS_DECODER_H\n" }, { "alpha_fraction": 0.49094444513320923, "alphanum_fraction": 0.4955451190471649, "avg_line_length": 38.927555084228516, "blob_id": "db8a3b48b32870aa1389f979b9bbdd30d4e61468", "content_id": "321ccbcb221ce34ca82d2fa2ce0a4b34635ec6cf", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 30865, "license_type": "permissive", "max_line_length": 111, "num_lines": 773, "path": "/dependencies/quex-0.34.1/quex/core_engine/interval_handling.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "#! /usr/bin/env python\n# PURPOSE: Provides classes for handling of sets of numbers:\n#\n# Interval: A continous set of numbers in a range from a\n# minimum to a maximum border.\n# \n# NumberSet: A non-continous set of numbers consisting of\n# described as a set of intervals.\n#\n# DATE: May 26, 2006\n#\n# (C) 2006 Frank-Rene Schaefer\n#\n# ABSOLUTELY NO WARRANTY\n################################################################################\n\nfrom copy import copy, deepcopy\n\nimport quex.core_engine.generator.languages.core as languages\nimport quex.core_engine.utf8 as utf8\nimport sys\n\nclass Interval:\n \"\"\"Representing an interval with a minimum and a maximum border. Implements\n basic operations on intervals: union, intersection, and difference.\n \"\"\"\n def __init__(self, Begin=None, End=None):\n \"\"\"NOTE: Begin = End signifies **empty** interval.\n\n Begin == None and End == None => Empty Interval\n\n Begin == int and End == None => Interval of size '1' (one number = Begin)\n \n Begin and End != None => Interval starting from 'Begin' and the last\n element is 'End-1'\n\n \"\"\"\n\n # .begin = smallest integer that belogns to interval.\n # .end = first integer > 'Begin' that does **not belong** to interval\n if Begin == None and End == None:\n # empty interval\n self.begin = 0\n self.end = 0\n else:\n if Begin == None:\n raise \"Begin can only be 'None', if End is also 'None'!\"\n self.begin = Begin \n if End == None: \n if self.begin != sys.maxint: self.end = self.begin + 1\n else: self.end = self.begin\n else: \n self.end = End\n \n def is_empty(self):\n return self.begin == self.end\n\n def is_all(self):\n return self.begin == -sys.maxint and self.end == sys.maxint \n print \"##res:\", result\n \n def contains(self, Number):\n \"\"\"True => if Number in NumberSet\n False => else\n \"\"\"\n if Number >= self.begin and Number < self.end: return True\n else: return False\n \n def check_overlap(self, Other):\n \"\"\"Does interval overlap the Other?\"\"\"\n if self.begin < Other.end and self.end > Other.begin: return True\n if Other.begin < self.end and Other.end > self.begin: return True\n else: return False\n\n def check_touch(self, Other):\n \"\"\"Does interval touch the Other?\"\"\"\n if self.begin < Other.end and self.end > Other.begin: return True\n if Other.begin < self.end and Other.end > self.begin: return True\n if self.begin == Other.begin or self.end == Other.begin: return True\n else: return False\n \n def union(self, Other):\n if self.check_overlap(Other):\n # overlap: return one single interval\n # (the one that encloses both intervals)\n return [ Interval(min(self.begin, Other.begin),\n max(self.end, Other.end)) ]\n else:\n # no overlap: two disjunct intervals\n result = []\n if not self.is_empty(): result.append(copy(self))\n if not Other.is_empty(): result.append(copy(Other))\n return result\n\n def intersection(self, Other):\n if self.check_overlap(Other):\n # overlap: return one single interval\n # (the one that both have in common)\n return Interval(max(self.begin, Other.begin),\n min(self.end, Other.end)) \n else:\n # no overlap: empty interval (begin=end)\n return Interval() # empty interval\n\n def difference(self, Other):\n \"\"\"Difference self - Other.\"\"\"\n if self.begin >= Other.begin:\n if self.end <= Other.end:\n # overlap: Other covers self\n # --------------[xxxxxxxxxxxxx]-------------------\n # ---------[yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy]-----\n #\n # nothing remains - empty interval\n return []\n else:\n if self.begin >= Other.end:\n # no intersection\n return [ copy(self) ]\n else:\n # overlap: Other covers lower part\n # --------------[xxxxxxxxxxxxxxxxxxxx]------------\n # ---------[yyyyyyyyyyyyyyyyyyyy]-----------------\n return [ Interval(Other.end, self.end) ]\n else: \n if self.end >= Other.end:\n # overlap: self covers Other\n # ---------[xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx]-----\n # --------------[yyyyyyyyyyyyy]-------------------\n #\n # result = two disjunct intervals\n result = []\n lower_part = Interval(self.begin, Other.begin)\n if not lower_part.is_empty(): result.append(lower_part)\n upper_part = Interval(Other.end, self.end)\n if not upper_part.is_empty(): result.append(upper_part)\n return result\n else:\n if self.end <= Other.begin:\n # no intersection\n return [ copy(self) ]\n else:\n # overlap: Other upper part\n # ---------[xxxxxxxxxxxxx]------------------------\n # --------------[yyyyyyyyyyyyy]-------------------\n # \n return [ Interval(self.begin, Other.begin) ]\n\n def inverse(self):\n if self.begin == self.end:\n # empty interval => whole range\n return [ Interval(-sys.maxint, sys.maxint) ]\n else:\n result = []\n if self.begin != -sys.maxint: result.append(Interval(-sys.maxint,self.begin))\n if self.end != sys.maxint: result.append(Interval(self.end, sys.maxint))\n return result\n\n def size(self):\n return self.end - self.begin\n\n def __repr__(self):\n return self.get_string(Option=\"\")\n\n def __utf8_char(self, Code):\n if Code == - sys.maxint: return \"-oo\"\n elif Code == sys.maxint: return \"oo\" \n elif Code == ord(' '): return \"' '\"\n elif Code == ord('\\n'): return \"'\\\\n'\"\n elif Code == ord('\\t'): return \"'\\\\t'\"\n elif Code == ord('\\r'): return \"'\\\\r'\"\n elif Code < ord(' '): return \"\\\\\" + repr(Code) # from ' ' to '9' things are 'visible'\n else:\n char_str = utf8.map_unicode_to_utf8(Code)\n return \"'\" + char_str + \"'\"\n # elif Code < ord('0') or Code > ord('z'): return \"\\\\\" + repr(Code)\n # else: return \"'\" + chr(Code) + \"'\"\n\n def get_string(self, Option=\"\", Delimiter=\", \"):\n if Option == \"hex\": __repr = lambda x: \"%05X\" % x\n elif Option == \"utf8\": __repr = lambda x: self.__utf8_char(x)\n else: __repr = repr\n \n if self.begin == self.end: return \"[]\"\n elif self.end - self.begin == 1: return \"[\" + __repr(self.begin) + \"]\" \n else: return \"[\" + __repr(self.begin) + Delimiter + __repr(self.end-1) + \"]\"\n\n def get_utf8_string(self):\n #_____________________________________________________________________________\n assert self.begin <= self.end\n \n if self.begin == self.end: \n return \"''\"\n elif self.end - self.begin == 1: \n return self.__utf8_char(self.begin) \n else: \n if self.end == -sys.maxint: end_char = \"-oo\"\n elif self.end == sys.maxint: end_char = \"oo\"\n else: end_char = self.__utf8_char(self.end-1)\n return \"[\" + self.__utf8_char(self.begin) + \", \" + end_char + \"]\"\n\n def gnuplot_string(self, y_coordinate):\n if self.begin == self.end: return \"\"\n txt = \"\"\n txt += \"%i %f\\n\" % (self.begin, y_coordinate)\n txt += \"%i %f\\n\" % (self.end-1, y_coordinate)\n txt += \"%i %f\\n\" % (self.end-1, float(y_coordinate) + 0.8)\n txt += \"%i %f\\n\" % (self.begin, float(y_coordinate) + 0.8)\n txt += \"%i %f\\n\" % (self.begin, y_coordinate)\n return txt\n\n \nclass NumberSet:\n \"\"\"Represents an arbitrary set of numbers. The set is described\n in terms of intervals, i.e. objects of class 'Interval'. This\n class also provides basic operations such as union, intersection,\n and difference.\n \"\"\"\n def __init__(self, Arg = None, ArgumentIsYoursF=False):\n \"\"\"Arg = list ==> list of initial intervals\n Arg = Interval ==> initial interval\n Arg = integer ==> interval consisting of one number\n \"\"\"\n arg_type = Arg.__class__\n assert arg_type in [Interval, NumberSet, int, list] or Arg == None\n \n if arg_type == list:\n if ArgumentIsYoursF:\n self.__intervals = Arg\n else:\n self.__intervals = []\n # use 'add_interval' to ensure consistency, i.e. touches, overlaps, etc.\n for interval in Arg:\n self.add_interval(copy(interval))\n return\n\n if arg_type == Interval:\n if ArgumentIsYoursF: self.__intervals = [ Arg ] \n else: self.__intervals = [ copy(Arg) ]\n\n elif arg_type == NumberSet:\n if ArgumentIsYoursF: self.__intervals = Arg.__intervals\n else: self.__intervals = deepcopy(Arg.__intervals)\n\n elif arg_type == int:\n self.__intervals = [ Interval(Arg) ]\n\n else:\n self.__intervals = []\n\n def quick_append_interval(self, Other, SortF=True):\n \"\"\"This function assumes that there are no intersections with other intervals.\n Use this function with caution. It is much faster than the 'union' function\n or the function 'add_interval'.\n \"\"\"\n assert Other.__class__.__name__ == \"Interval\"\n\n self.__intervals.append(Other)\n\n def add_interval(self, NewInterval):\n \"\"\"Adds an interval and ensures that no overlap with existing\n intervals occurs. Note: the 'touch' test is faster here, because\n only one interval is checked against.!\"\"\"\n if NewInterval.is_empty(): return\n \n # (1) determine if begin overlaps with the new interval\n if self.__intervals == [] or NewInterval.begin > self.__intervals[-1].end:\n self.__intervals.append(NewInterval)\n return\n\n X = NewInterval\n i = -1\n for y in self.__intervals:\n i += 1\n # possible cases:\n # (1) [=== X ===] [=== y ===] \n # \n # (2) [=== X ============][=== y ===]\n # \n # (3) [=== X ==================]\n # [=== y ===]\n # \n # (4) [=== X =======================]\n # [=== y ===]\n # \n # (5) [=== X =============================================]\n # [=== y ===]\n # \n # (6) [=== X =========================]\n # [=== y ===]\n # \n # (7) [=== y ===][=== X ==============]\n # \n # (8) [=== y ===] [=== X ===]\n # \n if X.begin > y.end: \n continue # filter (8)\n elif X.end < y.begin: \n self.__intervals.insert(i, X) \n return # filter (1)\n else:\n touch_begin = min(X.begin, y.begin) \n break\n\n toucher_list = [ ]\n insertion_index = i\n for y in self.__intervals[i:]:\n if X.end < y.begin: touch_end = X.end; break\n toucher_list.append(i)\n if X.end <= y.end: touch_end = y.end; break\n i += 1\n else:\n touch_end = X.end\n\n # (2) combine all intervals that intersect with the new one\n combination = Interval(touch_begin, touch_end)\n\n # (3) build new list of intervals\n # (all overlaps are deleted, i.e. not added because they are\n # replaced by the union with the NewInterval)\n # NOTE: The indices need to be adapted, since if for example\n # interval '3' was an overlapper, and so '5' then if\n # '3' is deleted, '5' comes at position '5'.\n offset = -1\n for i in toucher_list:\n offset += 1\n del self.__intervals[i - offset]\n\n self.__intervals.insert(insertion_index, combination)\n\n def cut_interval(self, CutInterval):\n \"\"\"Adds an interval and ensures that no overlap with existing\n intervals occurs. Note: the 'touch' test is faster here, because\n only one interval is checked against.!\"\"\"\n assert CutInterval.__class__ == Interval\n if CutInterval.is_empty(): return\n \n # (*) determine if the interval has any intersection at all\n if self.__intervals == [] \\\n or CutInterval.begin > self.__intervals[-1].end \\\n or CutInterval.end <= self.__intervals[0].begin:\n # (the cutting interval cannot cut out anything)\n return\n\n Y = CutInterval\n remainder_low = None\n remainder_up = None\n # (*) find the first interval with which the cutting interval intersects.\n i = -1\n for x in self.__intervals:\n i += 1\n # (1) an intersecting interval is not yet reached\n if Y.begin >= x.end: continue \n # (2) an intersecting interval was never reached\n # (the cutting interval cannot cut out anything)\n elif Y.end < x.begin: return\n # (3) INTERSECTION (implicit from above conditions)\n # the following conditions are not mutually exclusive.\n # from now on it is clear that the loop will be left.\n # (3a) the cut leaves a 'lower interval'\n if x.begin < Y.begin: remainder_low = Interval(x.begin, Y.begin)\n # (3b) the cut leaves an 'upper interval'\n if x.end > Y.end: remainder_up = Interval(Y.end, x.end)\n # (3c) the interval has been swallowed completely \n # (both remainders stay empty)\n insertion_index = i\n break\n\n # (*) find the last interval that is concerned with the cut\n toucher_list = [ i ]\n\n if remainder_up == None and i != len(self.__intervals) - 1:\n for x in self.__intervals[i+1:]:\n i += 1\n # (1) last interval was swallowed complety, current interval has no intersection\n if Y.end <= x.begin: break\n # (2) INTERSECTION (implicit)\n toucher_list.append(i)\n # (2a) last intersecting interval (probably) not yet reached\n if Y.end > x.end: continue\n # (2b) last cutting leaves an upper interval\n if Y.end < x.end: \n remainder_up = Interval(Y.end, x.end)\n break\n\n ## print \"##\", remainder_low\n ## print \"##\", remainder_up\n ## print \"##\", toucher_list\n\n # (*) build new list of intervals\n # (all overlaps are deleted, i.e. not added because they are\n # replaced by the union with the NewInterval)\n # NOTE: The indices need to be adapted, since if for example\n # interval '3' was an overlapper, and so '5' then if\n # '3' is deleted, '5' comes at position '5'.\n offset = -1\n for i in toucher_list:\n offset += 1\n del self.__intervals[i - offset]\n\n # insert the upper remainder first, so that it comes after the lower remainder\n if remainder_up != None: self.__intervals.insert(insertion_index, remainder_up)\n if remainder_low != None: self.__intervals.insert(insertion_index, remainder_low)\n\n def contains(self, Number):\n \"\"\"True => if Number in NumberSet\n False => else\n \"\"\"\n for interval in self.__intervals:\n if interval.contains(Number): return True\n return False\n\n def minimum(self):\n if self.__intervals == []: return sys.maxint # i.e. an absurd value\n else: return self.__intervals[0].begin\n\n def supremum(self):\n if self.__intervals == []: return - sys.maxint # i.e. an absurd value\n else: return self.__intervals[0].end\n\n def is_empty(self):\n if self.__intervals == []: return True\n for interval in self.__intervals:\n if interval.is_empty() == False: return False\n return True\n \n def is_all(self):\n \"\"\"Returns True if this NumberSet covers all numbers, False if not.\n \n Note: All intervals should have been added using the function 'add_interval'\n Thus no overlapping intervals shall exists. If the set covers all numbers,\n then there can only be one interval that 'is_all()'\n \"\"\"\n if len(self.__intervals) != 1: return False\n return self.__intervals[0].is_all()\n \n def is_equal(self, Other):\n \"\"\"Assume: All intervals are sorted and adjacent intervals are combined.\n \"\"\"\n N = len(self.__intervals)\n if N != len(Other.__intervals): return False\n i = -1\n for interval in self.__intervals:\n i += 1\n other = Other.__intervals[i]\n if interval.begin != other.begin: return False\n elif interval.end != other.end: return False\n return True\n\n def interval_number(self):\n \"\"\"This value gives some information about the 'complexity' of the number set.\"\"\"\n return len(self.__intervals)\n\n def get_intervals(self, PromiseNotToChangeAnythingF=False):\n if PromiseNotToChangeAnythingF: return self.__intervals\n else: return deepcopy(self.__intervals)\n\n def unite_with(self, Other):\n Other_type = Other.__class__\n assert Other_type == Interval or Other_type == NumberSet, \\\n \"Error, argument of type %s\" % Other.__class__.__name__\n\n if Other_type == Interval: \n self.add_interval(Other)\n return\n\n # simply add all intervals to one single set\n for interval in Other.__intervals:\n self.add_interval(interval)\n\n def union(self, Other):\n Other_type = Other.__class__\n assert Other_type == Interval or Other_type == NumberSet, \\\n \"Error, argument of type %s\" % Other.__class__.__name__\n\n clone = deepcopy(self)\n\n if Other_type == Interval: \n clone.add_interval(Other)\n return clone\n\n # simply add all intervals to one single set\n for interval in Other.__intervals:\n clone.add_interval(interval)\n\n return clone \n\n def has_intersection(self, Other):\n assert Other.__class__ == Interval or Other.__class__ == NumberSet\n self_begin = self.__intervals[0].begin\n self_end = self.__intervals[-1].end\n if Other.__class__ == Interval: \n if Other.end < self_begin: return False\n if Other.begin > self_end: return False\n\n for y in self.__intervals:\n # PASTE: Implement Interval::overlap() for performance reasons.\n if x.begin >= y.end: continue\n elif x.end <= y.begin: break\n # x.end > y.begin (lacks condition: x.begin < y.end)\n # y.end > x.begin (lacks condition: y.begin < x.end)\n if x.begin < y.end or y.begin < x.end: return True\n\n return False\n\n for x in Other.__intervals:\n if x.end < self_begin: continue\n elif x.begin > self_end: break\n for y in self.__intervals:\n # PASTE: Implement Interval::overlap() for performance reasons.\n if x.begin >= y.end: continue\n elif x.end <= y.begin: break\n # x.end > y.begin (lacks condition: x.begin < y.end)\n # y.end > x.begin (lacks condition: y.begin < x.end)\n if x.begin < y.end or y.begin < x.end: return True\n return False\n\n def has_only_this_element(self, Number):\n if len(self.__intervals) != 1: return False\n elif self.__intervals[0].begin != Number: return False\n elif self.__intervals[0].end != Number + 1: return False\n return True\n\n def intersect_with(self, Other):\n assert Other.__class__ == Interval or Other.__class__ == NumberSet\n\n if Other.__class__ == Interval: Other_intervals = [ Other ]\n else: Other_intervals = Other.__intervals\n \n if Other_intervals == [] or self.__intervals == []: \n self.__intervals = []\n return \n\n self_begin = self.__intervals[0].begin\n self_end = self.__intervals[-1].end\n Other_begin = Other_intervals[0].begin\n Other_end = Other_intervals[-1].end\n if Other_end < self_begin or Other_begin > self_end: \n self.__intervals = []\n return\n\n # For each interval to leave remain, it needs at least have an intersection\n # with one of the other intervals. If such an intersection is found the\n # interval of concern can be pruned appropriately.\n # print \"##si0\", self.__intervals\n L = len(self.__intervals)\n insertion_list = []\n deletion_list = []\n i = -1\n begin_i = -1\n end_i = L\n for x in self.__intervals:\n i += 1\n if x.end <= Other_begin: continue\n elif begin_i == -1: begin_i = i; i -= begin_i; \n if x.begin >= Other_end: end_i = i; break\n\n replacement_list = []\n for y in Other_intervals:\n if x.begin >= y.end: continue\n elif x.end <= y.begin: break\n # x.end > y.begin (lacks condition: x.begin < y.end)\n # y.end > x.begin (lacks condition: y.begin < x.end)\n if x.begin < y.end or y.begin < x.end:\n replacement_list.append([max(x.begin, y.begin), min(x.end, y.end)])\n\n if replacement_list != []:\n x.begin, x.end = replacement_list.pop(0)\n insertion_list.append([i, replacement_list])\n else:\n deletion_list.append(i)\n\n # -- delete the intervals that have no intersection\n if begin_i != -1: del self.__intervals[:begin_i]\n if end_i != L: del self.__intervals[end_i:]\n offset = 0\n for i in deletion_list:\n del self.__intervals[i - offset]\n offset += 1\n\n # -- insert new intervals\n offset = 0\n for i, replacement_list in insertion_list:\n for begin, end in replacement_list:\n i += 1\n if i >= L: self.__intervals.append(Interval(begin, end))\n else: self.__intervals.insert(i, Interval(begin, end))\n offset += i\n\n def intersection(self, Other):\n assert Other.__class__ == Interval or Other.__class__ == NumberSet\n\n if Other.__class__ == Interval: Other_intervals = [ Other ]\n else: Other_intervals = Other.__intervals\n\n # NOTE: If, for any reason this function does not rely on intersect_with(), then\n # the function intersect_with() is no longer under unit test!\n result = deepcopy(self)\n result.intersect_with(Other)\n return result\n\n def subtract(self, Other):\n Other_type = Other.__class__\n assert Other_type == Interval or Other_type == NumberSet, \\\n \"Error, argument of type %s\" % Other.__class__.__name__\n\n if Other_type == Interval: \n self.cut_interval(Other)\n return\n\n Begin = self.__intervals[0].begin\n End = self.__intervals[-1].end\n for interval in Other.__intervals:\n if interval.end <= Begin: continue\n if interval.begin >= End: break\n self.cut_interval(interval)\n\n def difference(self, Other):\n assert Other.__class__ == Interval or Other.__class__ == NumberSet\n\n clone = deepcopy(self)\n if Other.__class__ == Interval: \n clone.cut_interval(Other)\n return clone\n\n Begin = self.__intervals[0].begin\n End = self.__intervals[-1].end\n # note: there should be no internal overlaps according to 'add_interval'\n for interval in Other.__intervals:\n if interval.end <= Begin: continue\n if interval.begin >= End: break\n clone.cut_interval(interval)\n\n return clone\n\n def inverse(self):\n \"\"\"Intersection of inverses of all intervals.\"\"\"\n interval_list = []\n begin = - sys.maxint\n for interval in self.__intervals:\n interval_list.append(Interval(begin, interval.begin))\n begin = interval.end\n interval_list.append(Interval(begin, sys.maxint))\n\n return NumberSet(interval_list, ArgumentIsYoursF=True)\n \n def clean(self, SortF=True):\n \"\"\"Combines adjacent and intersecting intervals to one.\n \"\"\"\n\n # (2) Combine adjacent intervals\n L = len(self.__intervals)\n if L < 2: return\n\n new_intervals = []\n i = 0 \n current = self.__intervals[0]\n while i < L - 1:\n i += 1\n next = self.__intervals[i]\n\n if current.end < next.begin: \n # (1) no intersection?\n new_intervals.append(current)\n current = next\n else:\n # (2) intersection: [xxxxxxxxxxxxxxx]\n # [yyyyyyyyyyyyyyyyy]\n # becomes [xxxxxxxxxxxxxxxxxxxxxxxxxxx]\n #\n # => do not append interval i + 1, do not consider i + 1\n if current.end > next.end:\n # no adaptions necessary, simply ignore next interval\n pass\n else:\n # adapt upper border of current interval to the end of the next\n current.end = next.end\n\n new_intervals.append(current)\n\n\n self.__intervals = new_intervals\n\n def __repr__(self):\n return repr(self.__intervals)\n\n def get_utf8_string(self):\n msg = \"\"\n for interval in self.__intervals:\n msg += interval.get_utf8_string() + \", \"\n if msg != \"\": msg = msg[:-2]\n return msg\n\n def gnuplot_string(self, y_coordinate):\n txt = \"\"\n for interval in self.__intervals:\n txt += interval.gnuplot_string(y_coordinate)\n txt += \"\\n\"\n return txt\n\n def condition_code(self,\n Language = \"C\",\n FunctionName = \"example\"):\n\n LanguageDB = languages.db[Language]\n txt = LanguageDB[\"$function_def\"].replace(\"$$function_name$$\", FunctionName)\n txt += self.__condition_code(LanguageDB)\n txt += LanguageDB[\"$function_end\"]\n\n return txt\n\n def __condition_code(self, LanguageDB,\n LowestInterval_Idx = -1, UppestInterval_Idx = -1, \n NoIndentF = False):\n \n \"\"\"Writes code that does a mapping according to 'binary search' by\n means of if-else-blocks.\n \"\"\"\n if LowestInterval_Idx == -1 and UppestInterval_Idx == -1:\n LowestInterval_Idx = 0\n UppestInterval_Idx = len(self.__intervals) - 1\n \n if NoIndentF:\n txt = \"\"\n else:\n txt = \" \"\n\n MiddleInterval_Idx = (UppestInterval_Idx + LowestInterval_Idx) / 2\n \n # quick check:\n assert UppestInterval_Idx >= LowestInterval_Idx, \\\n \"NumberSet::conditions_code(): strange interval indices:\" + \\\n \"lowest interval index = \" + repr(LowestInterval_Idx) + \\\n \"uppest interval index = \" + repr(UppestInterval_Idx)\n \n middle = self.__intervals[MiddleInterval_Idx]\n \n if LowestInterval_Idx == UppestInterval_Idx \\\n and middle.begin == middle.end - 1:\n # middle == one element\n txt += \"$if %s $then\\n\" % LanguageDB[\"$==\"](\"input\", repr(middle.begin))\n txt += \" $return_true\\n\"\n txt += \"$endif\"\n txt += \"$return_false\\n\"\n \n else:\n # middle interval > one element\n txt += \"$if input $>= %s $then\\n\" % repr(middle.end)\n\n if MiddleInterval_Idx == UppestInterval_Idx:\n # upper interval = none\n txt += \" $return_false\\n\"\n txt += \"$endif\"\n else:\n # upper intervals = some\n txt += self.__condition_code(LanguageDB,\n MiddleInterval_Idx + 1, UppestInterval_Idx)\n txt += \"$endif\"\n\n txt += \"$if input $>= %s $then\\n\" % repr(middle.begin)\n txt += \" $return_true\\n\"\n txt += \"$endif\" \n\n if MiddleInterval_Idx == LowestInterval_Idx:\n # lower intervals = none\n txt += \"$return_false\\n\"\n else:\n # lower intervals = some\n txt += self.__condition_code(LanguageDB,\n LowestInterval_Idx, MiddleInterval_Idx - 1,\n NoIndentF = True)\n \n # return program text for given language\n return languages.replace_keywords(txt, LanguageDB, NoIndentF)\n\n" }, { "alpha_fraction": 0.5707314610481262, "alphanum_fraction": 0.5768312215805054, "avg_line_length": 41.597625732421875, "blob_id": "d4dc61d0ef129e3a0bb1eb511a3acd030d149718", "content_id": "5ad5524414949a7b97c30f3b43f30faa3532b1c3", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 57379, "license_type": "permissive", "max_line_length": 255, "num_lines": 1347, "path": "/exporters/blender_scripts/addons/grit_blender/__init__.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "# Copyright (c) David Cunningham and the Grit Game Engine project 2012\n#\n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of this software and associated documentation files (the \"Software\"), to deal\n# in the Software without restriction, including without limitation the rights\n# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n# copies of the Software, and to permit persons to whom the Software is\n# furnished to do so, subject to the following conditions:\n# \n# The above copyright notice and this permission notice shall be included in\n# all copies or substantial portions of the Software.\n# \n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n# THE SOFTWARE.\n\n# TODO\n#\n# bones\n# * can only update if set to 'rest' mode, or transformed bone positions will be output\n# * armature position not taken into account (evo armature was not at 0,0,0 which caused artifacts)\n# * export everything did not work with bones, had to 'export as mesh'\n#\n# vertex painting (colour)\n# vertex painting (blend)\n#\n# special classes:\n# * piles\n#\n# special class attributes\n# * health / damage threshold\n# * colour specification (for paint)\n# * explodes, explodeRadius, explodeDeactivate?\n# * material maps\n# * lights\n# * LOD\n#\n# xml import:\n# * http://docs.python.org/library/xml.etree.elementtree.html\n\nbl_info = {\n \"name\": \"Grit Exporter\",\n \"description\": \"Exporter for Grit Game Engine\",\n \"author\": \"Dave Cunningham\",\n \"version\": (1, 1),\n \"blender\": (2, 7, 0),\n \"api\": 31236,\n \"location\": \"File > Import-Export > Grit\",\n \"warning\": \"\",\n \"category\": \"Import-Export\"\n}\n\nimport bpy\nimport bpy.path\nimport inspect\nimport os\nimport os.path\nimport subprocess\nimport sys\nimport tempfile\nimport xml.etree.ElementTree\n\nfrom bpy.props import *\nfrom bpy_extras.io_utils import unpack_list\nfrom bpy_extras.io_utils import unpack_face_list\nfrom mathutils import Quaternion, Vector, Matrix\n\nplatform = \"x86_64\" if sys.maxsize > 2**32 else \"x86\"\nexecutable_suffix = \".exe\" if os.sep == \"\\\\\" else (\".linux.\"+platform)\n\ndef my_abspath(x):\n return os.path.abspath(bpy.path.abspath(x))\n\ndef path_to_grit(x):\n return x.replace(\"\\\\\",\"/\")\n\ndef grit_path_from_data(scene, data):\n if data.library == None: return data.name\n return grit_path(scene, data.library.filepath, data.name)\n\n# assuming grit_root_dir is ../..\n# takes e.g. \"//../../common/lib.blend\" and \"mat/White\"\n# returns \"/common/mat/White\"\n# or takes e.g. \"//../base.blend\" \"Fish\"\n# returns \"../Fish\"\ndef grit_path(scene, remote_blend, remote_resource_name):\n root = my_abspath(\"//\" + scene.grit_root_dir) + os.sep\n this_blend_dir = my_abspath(\"//\")\n that_blend = my_abspath(remote_blend)\n that_blend_dir = os.path.dirname(that_blend)\n if not this_blend_dir.startswith(root):\n error_msg('Invalid root directory: \"%s\"\\n(expands to \"%s\")\\n does not contain \"%s\"' % (scene.grit_root_dir, root, this_blend_dir))\n return \"UNKNOWN\"\n if not that_blend_dir.startswith(root):\n error_msg('Invalid root directory: \"%s\"\\n(expands to \"%s\")\\n does not contain \"%s\"' % (scene.grit_root_dir, root, that_blend_dir))\n return \"UNKNOWN\"\n\n # make paths use game's root\n this_blend_dir = this_blend_dir[len(root):]\n that_blend_dir = that_blend_dir[len(root):]\n pref = os.path.commonprefix([this_blend_dir, that_blend_dir])\n\n if pref == \"\":\n # use absolute grit path, e.g. \"/common/mat/White\"\n return path_to_grit(\"/\"+that_blend_dir+\"/\"+remote_resource_name)\n else:\n # use path relative to current blend file, e.g. \"../Fish\"\n return path_to_grit(os.path.relpath(that_blend_dir, this_blend_dir)+\"/\"+remote_resource_name)\n\ndef strip_leading_exc(x):\n return x[1:] if x[0]=='!' else x\n\n\ndef grit_xml_converter (*args):\n \"\"\"Run the GritXMLConverter with the given command-line arguments.\"\"\"\n current_py = inspect.getfile(inspect.currentframe())\n exporter = os.path.abspath(os.path.join(os.path.dirname(current_py), \"GritXMLConverter\" + executable_suffix))\n args = [exporter] + list(args)\n subprocess.call(args)\n\n\nclass MessageOperator(bpy.types.Operator):\n bl_idname = \"error.message\"\n bl_label = \"Message\"\n message = StringProperty()\n title = StringProperty(default=\"ERROR!\")\n icon = StringProperty(default=\"ERROR\")\n \n def execute(self, context):\n return {'FINISHED'}\n \n def invoke(self, context, event):\n wm = context.window_manager\n return wm.invoke_popup(self, width=500)\n \n def draw(self, context):\n row = self.layout.row()\n row.alignment = \"CENTER\"\n row.label(self.title, icon=self.icon)\n for line in self.message.split(\"\\n\"):\n self.layout.label(line)\n\n\ndef error_msg(msg, title=\"ERROR!\", icon=\"ERROR\"):\n if msg == None: return\n bpy.ops.error.message('INVOKE_DEFAULT', message=msg, title=title, icon=icon)\n\n# {{{ mesh examination utility\n\ndef float_eq (x, y):\n # no reason to handle rounding errors at this point\n return x == y\n\ndef uv_eq (x, y):\n return float_eq(x[0], y[0]) and float_eq(x[1], y[1])\n\ndef groups_eq (x, y):\n if x.groups == y.groups: return True\n if x.groups == None or y.groups == None: return False\n if len(x.groups) != len(y.groups): return False\n for i, g in enumerate(x.groups):\n if y.groups(i) != g: return False\n for i, g in enumerate(y.groups):\n if x.groups(i) != g: return False\n return True\n\n\ndef get_vertexes_faces(scene, mesh, no_normals, default_material, scale):\n\n mesh.update(calc_tessface=True)\n\n num_uv = len(mesh.tessface_uv_textures)\n rgb = mesh.tessface_vertex_colors.get(\"diffuse_colour_rgb\")\n aaa = mesh.tessface_vertex_colors.get(\"diffuse_colour_aaa\")\n class Empty: pass\n\n # list of vertexes with their attributes\n vertexes = []\n # table mapping material name to a list of face triples\n faces = { }\n\n counter = 0\n\n for fi, f in enumerate(mesh.tessfaces):\n\n #print(\"face: \"+str(fi))\n\n matname = default_material if (len(mesh.materials)==0 or mesh.materials[f.material_index] == None) else grit_path_from_data(scene, mesh.materials[f.material_index])\n\n triangles = []\n\n tri = ([f.vertices[0], f.vertices[1], f.vertices[2]], [0, 1, 2])\n triangles.append(tri)\n\n if len(f.vertices) == 4:\n tri = ([f.vertices[0], f.vertices[2], f.vertices[3]], [0, 2, 3])\n triangles.append(tri)\n\n for triangle in triangles:\n face = [0, 0, 0]\n for fvi, vi in enumerate(triangle[0]):\n fvi2 = triangle[1][fvi]\n v = mesh.vertices[vi]\n vert = Empty()\n vert.pos = (v.co.x * scale.x, v.co.y * scale.y, v.co.z * scale.z)\n vert.colour = (1, 1, 1)\n vert.alpha = 1\n if no_normals:\n vert.normal = (0, 0, 0)\n else:\n vert.normal = (v.normal.x, v.normal.y, v.normal.z)\n if num_uv == 0:\n vert.uv = (0, 0)\n else:\n the_uv = mesh.tessface_uv_textures[0].data[fi].uv[fvi2]\n vert.uv = (the_uv[0], the_uv[1])\n if rgb != None:\n if fvi2 == 0:\n vert.colour = rgb.data[fi].color1\n elif fvi2 == 1:\n vert.colour = rgb.data[fi].color2\n elif fvi2 == 2:\n vert.colour = rgb.data[fi].color3\n elif fvi2 == 3:\n vert.colour = rgb.data[fi].color4\n if aaa != None:\n if fvi2 == 0:\n vert.alpha = sum(aaa.data[fi].color1) / 3\n elif fvi2 == 1:\n vert.alpha = sum(aaa.data[fi].color2) / 3\n elif fvi2 == 2:\n vert.alpha = sum(aaa.data[fi].color3) / 3\n elif fvi2 == 3:\n vert.alpha = sum(aaa.data[fi].color4) / 3\n vert.groups = None\n if len(v.groups) > 0:\n vert.groups = []\n for gi, g in enumerate(v.groups):\n vert.groups.append((g.group, g.weight))\n \n\n def tostr (v):\n return \"(pos=\"+str(v.pos) + \", normal=\"+str(v.normal)+\", uv=\"+str(v.uv)+\")\"\n\n # see if we already hvae a vertex that is close enough\n duplicate = None\n for evi, evert in enumerate(vertexes): #existing vertex id\n if evert.pos == vert.pos and \\\n evert.normal == vert.normal and \\\n evert.colour == vert.colour and \\\n evert.uv == vert.uv and \\\n groups_eq(evert, vert):\n duplicate = evi\n break\n\n if duplicate != None:\n face[fvi] = duplicate\n else:\n vertexes.append(vert)\n # print(\"vertexes now: \"+str(len(vertexes)))\n face[fvi] = counter\n counter += 1\n if not matname in faces.keys():\n # first face we have seen of this material\n faces[matname] = []\n faces[matname].append(face)\n\n return (vertexes, faces)\n\n#}}}\n\n\n#{{{ Scene stuff \n\npromotion_enum_items = [\n ('NONE','No Export','Not promoted'),\n ('OBJECT','Object','Grit Object'),\n ('CLASS','Class','Grit Class'), # for dummies only\n ('MESH','.mesh','Grit .mesh'),\n ('GCOL','col','Grit col'), # for dummies or mesh (trimesh)\n ('PRIM','col primitive','Grit col primitive'),\n ('GCOL_EXT','external col','External Grit col'), #for dummies\n ('MESH_EXT','external .mesh','External Grit .mesh'), #for dummies\n]\n\n\nbpy.types.Scene.grit_root_dir = StringProperty(name=\"Grit root dir\", description=\"The root of the game directory (where Grit.exe lives)\", maxlen= 1024, default= \"..\")\n\nbpy.types.Scene.grit_map_export = BoolProperty(name=\"Export map\", description=\"Whether or not to emit an object placements lua file\", default=True)\nbpy.types.Scene.grit_map_file = StringProperty(name=\"Grit map path\", description=\"Path of object placements lua file\", maxlen= 1024, default= \"map.lua\")\nbpy.types.Scene.grit_map_prefix = StringProperty(name=\"Map obj prefix\", description=\"This will be prepended to all of your object names, useful to avoid clashes between different blend files\", maxlen= 1024, default= \"my_\")\n\nbpy.types.Scene.grit_classes_export = BoolProperty(name=\"Export classes\", description=\"Whether or not to emit a class definitions lua file\", default=True)\nbpy.types.Scene.grit_classes_file = StringProperty(name=\"Grit classes path\", description=\"Path of class definitions lua file\", maxlen=1024, default= \"classes.lua\")\n\nbpy.types.Scene.grit_meshes_export = BoolProperty(name=\"Export .mesh\", description=\"Whether or not to generate Grit .mesh files\", default=True)\nbpy.types.Scene.grit_meshes_convert = BoolProperty(name=\"Convert mesh.xml -> mesh\", description=\"Whether or not to run the external tool\", default=True)\n\nbpy.types.Scene.grit_gcols_export = BoolProperty(name=\"Export .gcol\", description=\"Whether or not to generate Grit .gcol files\", default=True)\nbpy.types.Scene.grit_gcols_convert = BoolProperty(name=\"Convert tcol -> gcol\", description=\"Whether or not to run the external tool\", default=True)\n\nclass SceneSummaryPanel(bpy.types.Panel): \n bl_label = \"Grit Exportables Summary\"\n bl_space_type = 'PROPERTIES'\n bl_region_type = 'WINDOW'\n bl_context = \"scene\"\n\n def draw(self, context):\n box = self.layout.box()\n func1 = lambda prom, objs: str(len([o for o in objs if o.grit_promotion == prom]))\n func = lambda prom: func1(prom, context.selected_objects) + \" of \" + func1(prom, context.scene.objects)\n summary = box.row(align=True)\n summary.label(\"selected objects\")\n summary.label(func('OBJECT'))\n summary = box.row(align=True)\n summary.label(\"selected classes\")\n summary.label(func('CLASS'))\n summary = box.row(align=True)\n summary.label(\"selected meshes\")\n summary.label(func('MESH'))\n summary = box.row(align=True)\n summary.label(\"selected gcols\")\n summary.label(func('GCOL'))\n summary = box.row(align=True)\n summary.label(\"selected gcol parts\")\n summary.label(func('PRIM'))\n summary = box.row(align=True)\n summary.label(\"selected external .gcol\")\n summary.label(func('GCOL_EXT'))\n summary = box.row(align=True)\n summary.label(\"selected unpromoted\")\n summary.label(func('NONE'))\n\n\n#}}}\n\n# {{{ additional object metadata\n\n\nbpy.types.Object.grit_promotion = bpy.props.EnumProperty(name='Promotion', default='NONE', items=promotion_enum_items, description=\"The special role within the Grit engine that this Blender object represents\")\nbpy.types.Object.grit_export = bpy.props.BoolProperty(name='Export', default=True, description=\"Whether to export this Grit asset\")\n\nbpy.types.Object.grit_object_class_name = bpy.props.StringProperty(name='Class', default=\"\", description=\"Name of the class (without the !) of which this Grit object is an instance\")\n\n\nbpy.types.Object.grit_gcol_ext_name = bpy.props.StringProperty(name='External gcol', default=\"Foo.gcol\", description=\"Name of the external .gcol file to use\")\n\n# piles\n\nbpy.types.Object.grit_class_rendering_distance = bpy.props.FloatProperty(name='Rendering Distance', default=100, description=\"Distance at which the object is deactivated, e.g. no-longer rendered or generating collisions\")\nbpy.types.Object.grit_class_cast_shadows = bpy.props.BoolProperty(name='Casts Shadows?', default=False, description=\"Does the graphical representation of the object cast shadows within Grit\")\nbpy.types.Object.grit_class_place_z_off = bpy.props.FloatProperty(name='Placement Z Offset', default=0.0, description=\"When placing objects on the map using place(), the distance above ground to spawn (to avoid violent intersection)\")\nbpy.types.Object.grit_class_place_rnd_rot = bpy.props.BoolProperty(name='Placement Random Z Rotate?', default=False, description=\"When placing objects on the map using place(), whether a random rotation about Z is used (to introduce some variety)\")\n\nbpy.types.Object.grit_mesh_tangents = bpy.props.BoolProperty(name='Tangents?', default=False, description=\"Whether or not to generate tangents in the mesh file (takes more disk & memory but required when using normal maps)\")\nbpy.types.Object.grit_mesh_ext_name = bpy.props.StringProperty(name='External mesh', default=\"\", description=\"If set, use the existing named mesh file instead\")\n\nbpy.types.Object.grit_gcol_static = bpy.props.BoolProperty(name='Static?', default=True, description=\"Whether or not objects using this gcol are fixed in place (like a wall)\")\nbpy.types.Object.grit_gcol_mass = bpy.props.FloatProperty(name='Mass', default=100.0, description=\"The mass of the object in kilograms\")\nbpy.types.Object.grit_gcol_linear_damping = bpy.props.FloatProperty(name='Linear damping', default=0.5, description=\"Proportion of linear velocity lost per second due to drag / friction\")\nbpy.types.Object.grit_gcol_angular_damping = bpy.props.FloatProperty(name='Angular damping', default=0.5, description=\"Proportion of angular velocity lost per second due to drag / friction\")\nbpy.types.Object.grit_gcol_linear_sleep_thresh = bpy.props.FloatProperty(name='Linear sleep thresh.', default=1, description=\"Linear velocity below which object will sleep\")\nbpy.types.Object.grit_gcol_angular_sleep_thresh = bpy.props.FloatProperty(name='Angular sleep thresh.', default=0.8, description=\"Angular velocity below which object will sleep\")\nbpy.types.Object.grit_gcol_prim_margin = bpy.props.FloatProperty(name='Margin', default=0.04, description=\"Collsion margin -- distance after which a different collision resolution algorithm is used. For hulls, forms an invisible shell around the object\")\nbpy.types.Object.grit_gcol_prim_shrink = bpy.props.FloatProperty(name='Shrink', default=0.04, description=\"For hulls, a distance the hull should be shrunk inwards along face normals to compensate for the margin\")\n\n\ndef set_parent(context, child, parent):\n bpy.ops.object.select_all(action=\"DESELECT\")\n child.select = True\n context.scene.objects.active = parent\n bpy.ops.object.parent_set(type='OBJECT')\n\nclass NewClass(bpy.types.Operator):\n '''Create a new class at the cursor'''\n bl_idname = \"grit.new_class\"\n bl_label = \"New Class\"\n\n class_name = bpy.props.StringProperty(name=\"Class name\", default=\"\")\n collision = bpy.props.EnumProperty(name='.gcol type', default='MESH', items=[\n ('NONE','No .gcol','No .gcol'),\n ('EMPTY','Empty .gcol (e.g. for dynamic)','No collision mesh, only child parts / hulls'),\n ('MESH','Trimesh .gcol (mainly for static)','Has collision mesh, and optional child parts / hull'),\n ('EXT','External .gcol','A .gcol that already exists on disk'),\n ])\n\n\n def invoke(self, context, event):\n wm = context.window_manager\n return wm.invoke_props_dialog(self, width=500)\n\n def execute(self, context):\n\n class_name = self.class_name\n mesh_name = self.class_name + \".mesh\"\n gcol_name = self.class_name + \".gcol\"\n\n if class_name == \"\":\n error_msg(\"Must give name of class\")\n return {'FINISHED'}\n\n if context.scene.objects.get('!'+class_name) != None:\n error_msg(\"Object already exists with name \\\"\"+'!'+class_name+\"\\\"\")\n return {'FINISHED'}\n\n if context.scene.objects.get(mesh_name) != None:\n error_msg(\"Object already exists with name \\\"\"+mesh_name+\"\\\"\")\n return {'FINISHED'}\n\n if self.collision!=\"NONE\" and context.scene.objects.get(gcol_name) != None:\n error_msg(\"Object already exists with name \\\"\"+gcol_name+\"\\\"\")\n return {'FINISHED'}\n\n pos = context.scene.cursor_location\n\n bpy.ops.object.add(type=\"EMPTY\", location=pos)\n the_class = context.active_object\n the_class.name = \"!\"+class_name\n the_class.grit_promotion = \"CLASS\"\n\n bpy.ops.mesh.primitive_cube_add(location=pos+Vector((5,0,0)))\n the_mesh = context.active_object\n the_mesh.name = mesh_name\n the_mesh.grit_promotion = \"MESH\"\n set_parent(context, the_mesh, the_class)\n\n if self.collision!=\"NONE\":\n if self.collision==\"EMPTY\":\n bpy.ops.object.add(type=\"EMPTY\", location=pos+Vector((-5,0,0)))\n the_gcol = context.active_object\n the_gcol.grit_promotion = \"GCOL\"\n elif self.collision==\"MESH\":\n bpy.ops.mesh.primitive_cube_add(location=pos+Vector((-5,0,0)))\n the_gcol = context.active_object\n the_gcol.grit_promotion = \"GCOL\"\n else:\n bpy.ops.object.add(type=\"EMPTY\", location=pos+Vector((-5,0,0)))\n the_gcol = context.active_object\n the_gcol.grit_promotion = \"GCOL_EXT\"\n the_gcol.name = gcol_name\n set_parent(context, the_gcol, the_class)\n \n bpy.ops.object.select_all(action=\"DESELECT\")\n the_class.select = True\n context.scene.objects.active = the_class\n\n return {'FINISHED'}\n\nclass RenameClass(bpy.types.Operator):\n '''Rename the selected class'''\n bl_idname = \"grit.rename_class\"\n bl_label = \"Rename Class\"\n\n class_name = bpy.props.StringProperty(name=\"Class name\", default=\"\")\n rename_mesh = BoolProperty(name=\".mesh follows class name\", description=\"Whether to also rename the .mesh object after the class\", default=True)\n rename_gcol = BoolProperty(name=\".gcol follows class name\", description=\"Whether to also rename the .gcol object after the class\", default=True)\n\n def invoke(self, context, event):\n wm = context.window_manager\n return wm.invoke_props_dialog(self, width=500)\n\n @classmethod\n def poll(cls, context):\n return context.active_object != None and context.active_object.grit_promotion == \"CLASS\"\n\n def execute(self, context):\n class_obj = context.active_object\n\n old_class_name = strip_leading_exc(class_obj.name)\n\n class_name = self.class_name\n mesh_name = self.class_name + \".mesh\"\n gcol_name = self.class_name + \".gcol\"\n\n rename_gcol = False\n for c in class_obj.children:\n if c.grit_promotion == \"GCOL\": rename_gcol = True\n rename_gcol = rename_gcol and self.rename_gcol\n\n if class_name == \"\":\n error_msg(\"Must give name of class\")\n return {'FINISHED'}\n\n if context.scene.objects.get('!'+class_name) != None:\n error_msg(\"Object already exists with name \\\"\"+'!'+class_name+\"\\\"\")\n return {'FINISHED'}\n\n if self.rename_mesh and context.scene.objects.get(mesh_name) != None:\n error_msg(\"Object already exists with name \\\"\"+mesh_name+\"\\\"\")\n return {'FINISHED'}\n\n if rename_gcol and context.scene.objects.get(gcol_name) != None:\n error_msg(\"Object already exists with name \\\"\"+gcol_name+\"\\\"\")\n return {'FINISHED'}\n\n for c in class_obj.children:\n if c.grit_promotion == \"GCOL\" and rename_gcol: c.name = gcol_name\n if c.grit_promotion == \"MESH\" and self.rename_mesh: c.name = mesh_name\n if c.grit_promotion == \"GCOL_EXT\" and rename_gcol: c.name = gcol_name\n\n class_obj.name = '!'+class_name\n\n for obj in context.scene.objects:\n if obj.grit_promotion == \"OBJECT\" and obj.grit_object_class_name == old_class_name:\n obj.grit_object_class_name = class_name\n\n return {'FINISHED'}\n\nclass NewPrimitive(bpy.types.Operator):\n '''Create a new class at the cursor'''\n bl_idname = \"grit.new_primitive\"\n bl_label = \"New Primitive\"\n\n @classmethod\n def poll(cls, context):\n return context.active_object != None and context.active_object.grit_promotion == \"GCOL\"\n\n def execute(self, context):\n gcol = context.active_object\n\n bpy.ops.mesh.primitive_cube_add(location=context.scene.cursor_location)\n ob = context.active_object\n ob.grit_promotion = \"PRIM\"\n set_parent(context, ob, gcol)\n\n bpy.ops.object.select_all(action=\"DESELECT\")\n ob.select = True\n context.scene.objects.active = ob\n\n return {'FINISHED'}\n\n\nitems = []\nlookup = {}\n\nbpy.types.Scene.grit_object_chooser = EnumProperty(name='Class to instantiate', default='0', items=[(\"0\",\"None\",\"None\")])\n\ndef all_classes():\n return [ o for o in bpy.data.objects if o.grit_promotion==\"CLASS\" ]\n\ndef reset_grit_object_chooser():\n global items\n global lookup\n lookup = {}\n items = []\n\n for c in all_classes():\n name = strip_leading_exc(c.name)\n if c.library != None:\n name = grit_path(bpy.context.scene, c.library.filepath, name)\n items.append((name, name, \"unused\"))\n lookup[name] = c\n items.sort()\n\n bpy.types.Scene.grit_object_chooser = EnumProperty(name='Class to instantiate', default=items[0][0], items=items)\n\n\nclass InstantiateExternalClass(bpy.types.Operator):\n '''Instantiate a class from another scene at the cursor'''\n bl_idname = \"grit.new_object2\"\n bl_label = \"Instantiate Class\"\n\n @classmethod\n def poll(cls, context):\n return len(all_classes()) > 0\n\n def invoke(self, context, event):\n reset_grit_object_chooser()\n wm = context.window_manager\n return wm.invoke_props_dialog(self, width=500, height=100)\n\n def draw(self, context):\n self.layout.prop(context.scene, \"grit_object_chooser\", text=\"\")\n col = self.layout.column()\n col.label(\"To see more classes here, link in a scene\")\n col.label(\"from another .blend file within the Grit tree.\")\n col.label(\"The classes from that scene will then be\")\n col.label(\"available here.\")\n\n def execute(self, context):\n\n global lookup\n global items\n\n class_obj = lookup[context.scene.grit_object_chooser]\n\n lookup = {}\n items = []\n\n class_name = strip_leading_exc(class_obj.name)\n\n meshes = [c for c in class_obj.children if c.grit_promotion == 'MESH']\n\n if len(meshes) == 0:\n error_msg(\"Class has no graphical representation (mesh)\")\n return {'FINISHED'}\n if len(meshes) > 1:\n error_msg(\"Class has more than 1 graphical representation (mesh)\")\n return {'FINISHED'}\n\n mesh_ob = meshes[0]\n\n ob = mesh_ob.copy()\n for i in ob.keys(): del ob[i]\n ob.parent = None\n ob.name = \"obj\"\n context.scene.objects.link(ob)\n\n if mesh_ob.library != None:\n class_name = grit_path(context.scene, mesh_ob.library.filepath, class_name)\n\n ob.grit_promotion = \"OBJECT\"\n ob.grit_object_class_name = class_name\n ob.location = context.scene.cursor_location\n\n bpy.ops.object.select_all(action=\"DESELECT\")\n ob.select = True\n context.scene.objects.active = ob\n\n return {'FINISHED'}\n\n#}}}\n\ndef to_lua (v):\n if v == True: return \"true\"\n if v == False: return \"false\"\n if type(v) == type(\"a string\"): return v\n return str(v)\n\n# {{{ export_objects\n\ndef errors_to_string (errors):\n # clip errors at a max to avoid filling the screen with crap\n max_errors = 20\n if len(errors) > max_errors: errors = errors[:max_errors] + [\"...\"]\n if len(errors) > 0: return \"\\n\".join(errors)\n\ndef export_as_mesh (scene, obj, tangents, filename):\n errors = []\n export_mesh_internal (scene, obj, tangents, filename, errors)\n return errors_to_string (errors)\n\ndef export_mesh_internal (scene, obj, tangents, filename, errors):\n armature = None\n armature_filename = None\n if obj.modifiers.get('Armature') != None:\n armature = obj.modifiers['Armature'].object\n armature_filename = armature.name\n\n mesh = obj.to_mesh(scene, True, \"PREVIEW\")\n\n if len(mesh.materials) == 0:\n errors.append(\"Grit mesh \\\"\"+obj.name+\"\\\" has no materials\")\n\n for m in mesh.materials:\n if m == None:\n errors.append(\"Grit mesh \\\"\"+obj.name+\"\\\" has an undefined material\")\n\n filename = my_abspath(\"//\" + filename+\".xml\")\n\n (vertexes, faces) = get_vertexes_faces(scene, mesh, False, \"/system/FallbackMaterial\", obj.scale)\n rgb = mesh.tessface_vertex_colors.get(\"diffuse_colour_rgb\") \n aaa = mesh.tessface_vertex_colors.get(\"diffuse_colour_aaa\") \n\n file = open(filename, \"w\")\n file.write(\"<mesh>\\n\")\n file.write(\" <sharedgeometry>\\n\")\n file.write(' <vertexbuffer positions=\"true\" normals=\"true\" colours_diffuse=\"%s\" texture_coord_dimensions_0=\"float2\" texture_coords=\"1\">\\n'\n % bool(rgb or aaa))\n for v in vertexes:\n file.write(\" <vertex>\\n\")\n file.write(\" <position x=\\\"\"+str(v.pos[0])+\"\\\" y=\\\"\"+str(v.pos[1])+\"\\\" z=\\\"\"+str(v.pos[2])+\"\\\" />\\n\")\n file.write(\" <normal x=\\\"\"+str(v.normal[0])+\"\\\" y=\\\"\"+str(v.normal[1])+\"\\\" z=\\\"\"+str(v.normal[2])+\"\\\" />\\n\")\n file.write(\" <texcoord u=\\\"\"+str(v.uv[0])+\"\\\" v=\\\"\"+str(1-v.uv[1])+\"\\\" />\\n\")\n if rgb != None or aaa != None:\n r, g, b, a = 1, 1, 1, 1\n if rgb != None:\n r, g, b = v.colour\n if aaa != None:\n a = v.alpha\n file.write(' <colour_diffuse value=\"%f %f %f %f\" />\\n' % (r, g, b, a))\n file.write(\" </vertex>\\n\")\n file.write(\" </vertexbuffer>\\n\")\n file.write(\" </sharedgeometry>\\n\")\n if armature!=None:\n file.write(\" <boneassignments>\\n\")\n for vi, v in enumerate(vertexes):\n for g in v.groups:\n bone_index = armature.pose.bones.find(obj.vertex_groups[g[0]].name)\n file.write(\" <vertexboneassignment vertexindex=\\\"\"+str(vi)+\"\\\" boneindex=\\\"\"+str(bone_index)+\"\\\" weight=\\\"\"+str(g[1])+\"\\\" />\\n\")\n file.write(\" </boneassignments>\\n\");\n\n file.write(\" <submeshes>\\n\")\n for m in faces.keys():\n file.write(\" <submesh material=\\\"\"+m+\"\\\" usesharedvertices=\\\"true\\\" use32bitindexes=\\\"false\\\" operationtype=\\\"triangle_list\\\">\\n\")\n file.write(\" <faces>\\n\")\n for f in faces[m]:\n file.write(\" <face v1=\\\"\"+str(f[0])+\"\\\" v2=\\\"\"+str(f[1])+\"\\\" v3=\\\"\"+str(f[2])+\"\\\" />\\n\")\n file.write(\" </faces>\\n\")\n file.write(\" </submesh>\\n\")\n file.write(\" </submeshes>\\n\")\n if armature!=None:\n file.write(\" <skeletonlink name=\\\"\"+armature.name+\"\\\" />\\n\")\n file.write(\"</mesh>\\n\")\n file.close()\n\n if armature != None:\n skel_filename = my_abspath(\"//\" + armature.name+\".xml\")\n file = open(skel_filename, \"w\")\n file.write(\"<skeleton blendmode=\\\"average\\\">\\n\")\n file.write(\" <bones>\\n\")\n for bi, b in enumerate(armature.pose.bones):\n file.write(\" <bone id=\\\"\"+str(bi)+\"\\\" name=\\\"\"+b.name+\"\\\">\\n\")\n mat = b.bone.matrix_local\n pos = b.bone.head_local\n b_parent = b.parent\n if b_parent != None:\n mat = b_parent.bone.matrix_local.inverted() * mat\n else:\n mat = Matrix.Identity(4)\n \n file.write(\" <position x=\\\"\"+str(pos.x)+\"\\\" y=\\\"\"+str(pos.y)+\"\\\" z=\\\"\"+str(pos.z)+\"\\\" />\\n\")\n rot = mat.to_quaternion()\n file.write(\" <rotation angle=\\\"\"+str(rot.angle)+\"\\\">\\n\")\n file.write(\" <axis x=\\\"\"+str(rot.axis.x)+\"\\\" y=\\\"\"+str(rot.axis.y)+\"\\\" z=\\\"\"+str(rot.axis.z)+\"\\\" />\\n\")\n file.write(\" </rotation>\\n\")\n file.write(\" </bone>\\n\")\n file.write(\" </bones>\\n\")\n file.write(\" <bonehierarchy>\\n\")\n for bi, b in enumerate(armature.pose.bones):\n if b.parent != None:\n file.write(\" <boneparent bone=\\\"\"+b.name+\"\\\" parent=\\\"\"+b.parent.name+\"\\\" />\\n\")\n\n file.write(\" </bonehierarchy>\\n\")\n file.write(\" <animations>\\n\")\n for anim in bpy.data.actions:\n\n anim_data = { }\n\n for group in anim.groups:\n anim_data[group.name] = { }\n for keyframe in group.channels[0].keyframe_points:\n time = keyframe.co[0]\n anim_data[group.name][time] = ((0,0,0), (0,1,0,0))\n\n anim_length = 2\n\n file.write(\" <animation name=\\\"\"+anim.name+\"\\\" length=\\\"\"+str(anim_length)+\"\\\">\\n\")\n file.write(\" <tracks>\\n\")\n for bone in anim_data:\n file.write(\" <track bone=\\\"\"+bone+\"\\\">\\n\")\n file.write(\" <keyframes>\\n\")\n #channels[1].keyframe_points[1].co\n for time in anim_data[bone]:\n (pos, rot) = anim_data[bone][time]\n file.write(\" <keyframe time=\\\"\"+str(time)+\"\\\">\\n\")\n file.write(\" <translate x=\\\"\"+str(pos[0])+\"\\\" y=\\\"\"+str(pos[1])+\"\\\" z=\\\"\"+str(pos[2])+\"\\\" />\\n\")\n file.write(\" <rotate angle=\\\"\"+str(rot[0])+\"\\\"> <axis x=\\\"\"+str(rot[1])+\"\\\" y=\\\"\"+str(rot[2])+\"\\\" z=\\\"\"+str(rot[3])+\"\\\" /> </rotate>\\n\")\n file.write(\" </keyframe>\\n\")\n file.write(\" </keyframes>\\n\")\n file.write(\" </track>\\n\")\n file.write(\" </tracks>\\n\")\n file.write(\" </animation>\\n\")\n file.write(\" </animations>\\n\")\n\n file.write(\"</skeleton>\\n\")\n file.close()\n\n if scene.grit_meshes_convert:\n grit_xml_converter(filename)\n if armature != None:\n grit_xml_converter(skel_filename)\n\n bpy.data.meshes.remove(mesh)\n\ndef export_as_gcol (scene, obj, gcol_static, mass, linear_damping, angular_damping, linear_sleep_thresh, angular_sleep_thresh, filename):\n errors = []\n export_gcol_internal (scene, obj, gcol_static, mass, linear_damping, angular_damping, linear_sleep_thresh, angular_sleep_thresh, filename, errors)\n return errors_to_string (errors)\n\ndef export_gcol_internal (scene, obj, gcol_static, mass, linear_damping, angular_damping, linear_sleep_thresh, angular_sleep_thresh, filename, errors):\n filename = my_abspath(\"//\" + filename)\n file = open(filename, \"w\")\n file.write(\"TCOL1.0\\n\")\n file.write(\"\\n\")\n file.write(\"attributes {\\n\")\n if gcol_static:\n file.write(\" static;\\n\")\n else:\n file.write(\" mass \"+str(mass)+\";\\n\")\n file.write(\" linear_damping \"+str(linear_damping)+\";\\n\")\n file.write(\" angular_damping \"+str(angular_damping)+\";\\n\")\n file.write(\" linear_sleep_threshold \"+str(linear_sleep_thresh)+\";\\n\")\n file.write(\" angular_sleep_threshold \"+str(angular_sleep_thresh)+\";\\n\")\n file.write(\"}\\n\")\n file.write(\"\\n\")\n\n file.write(\"compound {\\n\")\n for c in obj.children:\n if c.type == \"EMPTY\":\n errors.append(\"Part \\\"\"+c.name+\"\\\" under \\\"\"+obj.name+\"\\\" is an Empty)\")\n continue\n file.write(\" // \"+c.name+\"\\n\")\n mesh = c.data\n pos = c.matrix_local.to_translation()\n rot = c.matrix_local.to_quaternion()\n scale = c.matrix_local.to_scale()\n mat = \"/system/FallbackPhysicalMaterial\"\n if len(c.material_slots) == 0:\n errors.append(\"Part \\\"\"+c.name+\"\\\" under \\\"\"+obj.name+\"\\\" has no materials)\")\n else:\n mat = c.material_slots[0].material\n if mat == None:\n mat = \"/system/FallbackPhysicalMaterial\"\n errors.append(\"Part \\\"\"+c.name+\"\\\" under \\\"\"+obj.name+\"\\\" has undefined material\")\n else:\n mat = grit_path_from_data(scene, mat)\n if len(c.material_slots) > 1:\n errors.append(\"Part \\\"\"+c.name+\"\\\" under \\\"\"+obj.name+\"\\\" must have 1 material (has \"+str(len(c.material_slots))+\")\")\n marg = c.grit_gcol_prim_margin\n shrink = c.grit_gcol_prim_shrink\n if mesh.name == \"GritPhysicsBox\":\n file.write(\" box {\\n\")\n file.write(\" material \\\"\"+mat+\"\\\";\\n\")\n file.write(\" centre \"+str(pos.x)+\" \"+str(pos.y)+\" \"+str(pos.z)+\";\\n\")\n file.write(\" orientation \"+str(rot.w)+\" \"+str(rot.x)+\" \"+str(rot.y)+\" \"+str(rot.z)+\";\\n\")\n file.write(\" dimensions \"+str(scale.x)+\" \"+str(scale.y)+\" \"+str(scale.z)+\";\\n\")\n file.write(\" margin \"+str(marg)+\";\\n\")\n file.write(\" }\\n\")\n elif mesh.name == \"GritPhysicsSphere\":\n file.write(\" sphere {\\n\")\n file.write(\" material \\\"\"+mat+\"\\\";\\n\")\n file.write(\" centre \"+str(pos.x)+\" \"+str(pos.y)+\" \"+str(pos.z)+\";\\n\")\n file.write(\" radius \"+str((scale.x+scale.y+scale.z)/3)+\";\\n\")\n file.write(\" }\\n\")\n elif mesh.name == \"GritPhysicsCylinder\":\n file.write(\" cylinder {\\n\")\n file.write(\" material \\\"\"+mat+\"\\\";\\n\")\n file.write(\" centre \"+str(pos.x)+\" \"+str(pos.y)+\" \"+str(pos.z)+\";\\n\")\n file.write(\" orientation \"+str(rot.w)+\" \"+str(rot.x)+\" \"+str(rot.y)+\" \"+str(rot.z)+\";\\n\")\n file.write(\" dimensions \"+str(scale.x)+\" \"+str(scale.y)+\" \"+str(scale.z)+\";\\n\")\n file.write(\" margin \"+str(marg)+\";\\n\")\n file.write(\" }\\n\")\n elif mesh.name == \"GritPhysicsCone\":\n file.write(\" cone {\\n\")\n file.write(\" material \\\"\"+mat+\"\\\";\\n\")\n file.write(\" centre \"+str(pos.x)+\" \"+str(pos.y)+\" \"+str(pos.z)+\";\\n\")\n file.write(\" orientation \"+str(rot.w)+\" \"+str(rot.x)+\" \"+str(rot.y)+\" \"+str(rot.z)+\";\\n\")\n file.write(\" height \"+str(scale.z)+\";\\n\")\n file.write(\" radius \"+str((scale.x+scale.y)/2)+\";\\n\")\n file.write(\" margin \"+str(marg)+\";\\n\")\n file.write(\" }\\n\")\n else:\n mesh = c.to_mesh(scene, True, \"PREVIEW\")\n (vertexes, faces) = get_vertexes_faces(scene, mesh, True, \"/system/FallbackPhysicalMaterial\", c.scale)\n file.write(\" hull {\\n\")\n file.write(\" material \\\"\"+mat+\"\\\";\\n\")\n file.write(\" margin \"+str(marg)+\";\\n\")\n file.write(\" shrink \"+str(shrink)+\";\\n\")\n file.write(\" vertexes {\\n\")\n for v in vertexes:\n p = c.matrix_local * Vector(v.pos)\n file.write(\" \"+str(p.x)+\" \"+str(p.y)+\" \"+str(p.z)+\";\\n\")\n file.write(\" }\\n\")\n file.write(\" }\\n\")\n bpy.data.meshes.remove(mesh)\n file.write(\"}\\n\")\n\n if obj.type == \"MESH\":\n # triangles to add\n mesh = obj.to_mesh(scene, True, \"PREVIEW\")\n\n if not gcol_static:\n errors.append(\"Grit gcol \\\"\"+obj.name+\"\\\" has trimesh but is not static\")\n\n if len(mesh.materials) == 0:\n errors.append(\"Grit gcol \\\"\"+obj.name+\"\\\" has no materials\")\n\n for m in mesh.materials:\n if m == None:\n errors.append(\"Grit .gcol \\\"\"+obj.name+\"\\\" has undefined material\")\n\n (vertexes, faces) = get_vertexes_faces(scene, mesh, True, \"/common/Stone\", obj.scale)\n\n file.write(\"trimesh {\\n\")\n file.write(\" vertexes {\\n\")\n for v in vertexes:\n file.write(\" \"+str(v.pos[0])+\" \"+str(v.pos[1])+\" \"+str(v.pos[2])+\";\\n\")\n file.write(\" }\\n\")\n file.write(\" faces {\\n\")\n for m in faces.keys():\n for f in faces[m]:\n file.write(\" \"+str(f[0])+\" \"+str(f[1])+\" \"+str(f[2])+\" \\\"\"+m+\"\\\";\\n\")\n file.write(\" }\\n\")\n file.write(\"}\\n\")\n\n bpy.data.meshes.remove(mesh)\n\n file.close()\n\n\ndef export_objects (scene, objs):\n errors = []\n\n if bpy.path.abspath(\"//\") == \"\":\n return \"You must save your .blend file first.\\nI do not know what the output directory is.\\n\"\n\n grit_objects = [ x for x in objs if x.grit_promotion == 'OBJECT' ]\n grit_classes = [ x for x in objs if x.grit_promotion == 'CLASS' ]\n\n if scene.grit_map_export and len(grit_objects) > 0:\n filename = my_abspath(\"//\" + scene.grit_map_file)\n f = open(filename, \"w\")\n f.write(\"-- Lua file generated by Blender map export script.\\n\")\n f.write(\"-- WARNING: If you modify this file, your changes will be lost if it is subsequently re-exported from blender\\n\\n\")\n\n for obj in grit_objects:\n if obj.grit_object_class_name == \"\":\n errors.append(\"Object without class: `\"+obj.name+\"`\")\n else:\n pos = obj.location\n rot = obj.rotation_euler.to_quaternion()\n rot_str = rot == Quaternion((1,0,0,0)) and \"\" or \"rot=quat(\"+str(rot.w)+\", \"+str(rot.x)+\", \"+str(rot.y)+\", \"+str(rot.z)+\"), \"\n #TODO: handle classes in other directories\n class_name = obj.grit_object_class_name\n f.write(\"object `\"+class_name+\"` (\"+str(pos.x)+\", \"+str(pos.y)+\", \"+str(pos.z)+\") { \"+rot_str+\"name=\\\"\"+scene.grit_map_prefix+obj.name+\"\\\" }\\n\")\n\n f.close()\n\n if scene.grit_classes_export and len(grit_classes) > 0:\n filename = my_abspath(\"//\" + scene.grit_classes_file)\n f = open(filename, \"w\")\n f.write(\"-- Lua file generated by Blender class export script.\\n\")\n f.write(\"-- WARNING: If you modify this file, your changes will be lost if it is subsequently re-exported from blender\\n\\n\")\n\n for obj in grit_classes:\n class_name = strip_leading_exc(obj.name)\n\n meshes = [c for c in obj.children if c.grit_promotion == 'MESH' or c.grit_promotion == 'MESH_EXT']\n cols = [c for c in obj.children if c.grit_promotion == 'GCOL' or c.grit_promotion == 'GCOL_EXT']\n\n if len(meshes) == 0:\n errors.append(\"Class does not have a mesh: \\\"\"+obj.name+\"\\\"\\n\")\n continue\n if len(meshes) > 1:\n errors.append(\"Class has \"+len(meshes)+\" meshes (should have 1): \\\"\"+obj.name+\"\\\"\\n\")\n continue\n\n attributes = []\n attributes.append((\"renderingDistance\", obj.grit_class_rendering_distance))\n attributes.append((\"castShadows\", obj.grit_class_cast_shadows))\n attributes.append((\"placementZOffset\", obj.grit_class_place_z_off))\n attributes.append((\"placementRandomRotation\", obj.grit_class_place_rnd_rot))\n\n mesh_name = meshes[0].name\n if meshes[0].grit_promotion == 'MESH_EXT':\n mesh_name = meshes[0].grit_gcol_ext_name\n if class_name + \".mesh\" != mesh_name: attributes.append((\"gfxMesh\", \"`%s`\" % mesh_name))\n parent_class_name = \"\"\n if len(cols) == 0:\n parent_class_name = \"BaseClass\"\n interior = \" \"\n else:\n parent_class_name = \"ColClass\"\n if len(cols) > 1:\n errors.append(\"Class has \"+str(len(cols))+\" cols (should have 0 or 1): \\\"\"+obj.name+\"\\\"\")\n continue\n col_name = cols[0].name\n if cols[0].grit_promotion == 'GCOL_EXT':\n col_name = cols[0].grit_gcol_ext_name\n if class_name + \".gcol\" != col_name: attributes.append((\"colMesh\", \"`%s`\" % col_name))\n\n interior = \"\"\n if len(attributes) == 0:\n interior = \" \"\n else:\n interior = \"\\n \" + \";\\n \".join(map(lambda x: x[0] + \" = \" + to_lua(x[1]), attributes)) + \";\\n\"\n\n f.write(\"class `\"+class_name+\"` (\"+parent_class_name+\") {\"+interior+\"}\\n\\n\")\n\n f.close()\n\n\n\n for obj in objs:\n if obj.grit_promotion == 'MESH':\n export_mesh_internal(scene, obj, obj.grit_mesh_tangents, obj.name, errors)\n\n if obj.grit_promotion == 'GCOL':\n export_gcol_internal(scene, obj, obj.grit_gcol_static, obj.grit_gcol_mass, obj.grit_gcol_linear_damping, obj.grit_gcol_angular_damping, obj.grit_gcol_linear_sleep_thresh, obj.grit_gcol_angular_sleep_thresh, obj.name, errors)\n\n return errors_to_string(errors)\n\n#}}}\n\n\n\nclass ScenePanel(bpy.types.Panel): #{{{ \n bl_category = \"Grit\"\n bl_label = \"Grit Export Settings\"\n bl_space_type = 'VIEW_3D'\n bl_region_type = 'TOOLS'\n\n #@classmethod\n #def poll(cls, context):\n # return len(context.selected_objects) == 1\n\n def draw(self, context):\n box = self.layout\n col = box.column(align=True)\n row = col.row(align=True)\n row.alignment = \"EXPAND\"\n row.label(\"Game root\")\n row.prop(context.scene, \"grit_root_dir\", text=\"\", expand=True)\n row = col.row(align=True)\n row.alignment = \"EXPAND\"\n row.prop(context.scene, \"grit_map_export\", text=\"Export?\")\n row.prop(context.scene, \"grit_map_file\", text=\"\", expand=True)\n row = col.row(align=True)\n row.alignment = \"EXPAND\"\n row.label(\"Obj prefix\")\n row.prop(context.scene, \"grit_map_prefix\", text=\"\", expand=True)\n row = col.row(align=True)\n row.alignment = \"EXPAND\"\n row.prop(context.scene, \"grit_classes_export\", text=\"Export?\")\n row.prop(context.scene, \"grit_classes_file\", text=\"\", expand=True)\n row = col.row(align=True)\n row.alignment = \"EXPAND\"\n row.prop(context.scene, \"grit_meshes_export\")\n row.prop(context.scene, \"grit_meshes_convert\", text=\"Convert\", expand=True)\n row = col.row(align=True)\n row.alignment = \"EXPAND\"\n row.prop(context.scene, \"grit_gcols_export\")\n row = row.row()\n row.prop(context.scene, \"grit_gcols_convert\", text=\"Convert\", expand=True)\n row.enabled = False\n col.operator(\"grit.import_mesh\", icon=\"SCRIPT\")\n col.operator(\"grit.export_as_gcol\", icon=\"SCRIPT\")\n col.operator(\"grit.export_as_mesh\", icon=\"SCRIPT\")\n col = box.column(align = True)\n col.operator(\"grit.export_selected\", icon=\"SCRIPT\")\n col.operator(\"grit.export_all\", icon=\"SCRIPT\")\n#}}}\n\n\nclass ExportAsMesh(bpy.types.Operator):\n '''Simple export: active object to .mesh file'''\n bl_idname = \"grit.export_as_mesh\"\n bl_label = \"Export As .mesh\"\n\n filepath = bpy.props.StringProperty(subtype=\"FILE_PATH\")\n tangents = bpy.props.BoolProperty(name=\"Normal map (tangents)?\")\n\n @classmethod\n def poll(cls, context):\n return context.active_object != None\n\n def invoke(self, context, event):\n context.window_manager.fileselect_add(self)\n return {'RUNNING_MODAL'}\n\n def execute(self, context):\n scene = bpy.context.scene\n err = export_as_mesh(scene, context.active_object, self.tangents, self.filepath)\n error_msg(err)\n return {'FINISHED'}\n\nclass ExportAsGcol(bpy.types.Operator):\n '''Simple export: active object to .gcol file'''\n bl_idname = \"grit.export_as_gcol\"\n bl_label = \"Export As static .gcol\"\n\n filepath = bpy.props.StringProperty(subtype=\"FILE_PATH\")\n\n @classmethod\n def poll(cls, context):\n return context.active_object != None\n\n def invoke(self, context, event):\n context.window_manager.fileselect_add(self)\n return {'RUNNING_MODAL'}\n\n def execute(self, context):\n scene = bpy.context.scene\n objs = [ x for x in scene.objects if x.grit_export ]\n err = export_as_gcol(scene, context.active_object, True, 0, 0, 0, 0, 0, self.filepath)\n error_msg(err)\n return {'FINISHED'}\n\nclass ExportScene(bpy.types.Operator):\n '''Export scene to grit files (excluding Blender objects with export turned off)'''\n bl_idname = \"grit.export_all\"\n bl_label = \"Export Whole Scene\"\n\n @classmethod\n def poll(cls, context):\n return any(x.grit_promotion != 'NONE' for x in context.scene.objects)\n\n def execute(self, context):\n scene = bpy.context.scene\n objs = [ x for x in scene.objects if x.grit_export ]\n err = export_objects(scene, objs)\n error_msg(err)\n return {'FINISHED'}\n\n\nclass ExportSelected(bpy.types.Operator):\n '''Export selected objects to grit files'''\n bl_idname = \"grit.export_selected\"\n bl_label = \"Export Selected\"\n\n @classmethod\n def poll(cls, context):\n return any(x.grit_promotion != 'NONE' for x in context.selected_objects)\n\n def execute(self, context):\n scene = bpy.context.scene\n objs = bpy.context.selected_objects\n err = export_objects(scene, objs)\n error_msg(err)\n return {'FINISHED'}\n\n\nclass ImportXML(bpy.types.Operator):\n '''Import from a .mesh or .xml file'''\n bl_idname = \"grit.import_mesh\"\n bl_label = \"Import mesh\"\n\n filepath = StringProperty(subtype='FILE_PATH')\n\n def invoke(self, context, event):\n wm = context.window_manager\n wm.fileselect_add(self)\n return {'RUNNING_MODAL'}\n\n def execute(self, contxmlext):\n xml_filepath = self.filepath\n try:\n if self.filepath[-5:] == '.mesh':\n xml_file, xml_filepath = tempfile.mkstemp('.xml', self.filepath, dir=None, text=True)\n os.close(xml_file)\n grit_xml_converter(self.filepath, xml_filepath)\n elif self.filepath[-4:] != '.xml':\n error_msg(\"Can only import .mesh or .xml\")\n return {'FINISHED'}\n\n\n tree = xml.etree.ElementTree.parse(xml_filepath)\n root = tree.getroot()\n\n sharedgeometry = root.find(\"sharedgeometry\")\n if sharedgeometry == None:\n error_msg(\"Can only import mesh.xml with shared geometry\")\n return {'FINISHED'}\n blender_verts = []\n blender_uvs = []\n blender_cols = []\n for vertexbuffer in sharedgeometry.iterfind(\"vertexbuffer\"):\n has_positions = vertexbuffer.get('positions') == 'true'\n num_coords = int(vertexbuffer.get('texture_coords'))\n has_colours_diffuse = vertexbuffer.get('colours_diffuse') == 'true'\n for vert in vertexbuffer.iterfind(\"vertex\"):\n if has_positions:\n x = float(vert.find(\"position\").get(\"x\"))\n y = float(vert.find(\"position\").get(\"y\"))\n z = float(vert.find(\"position\").get(\"z\"))\n blender_verts.append((x, y, z))\n if num_coords >= 1:\n u = float(vert.find(\"texcoord\").get(\"u\"))\n v = float(vert.find(\"texcoord\").get(\"v\"))\n blender_uvs.append((u, 1 - v))\n if has_colours_diffuse:\n value = vert.find('colour_diffuse').get('value')\n blender_cols.append(tuple([float(x) for x in value.split(' ')]))\n\n submeshes = root.find(\"submeshes\")\n if submeshes == None:\n error_msg(\"Could not find submeshes element in .mesh.xml\")\n\n blender_faces = []\n blender_materials = []\n blender_face_materials = []\n for submesh in submeshes.iterfind(\"submesh\"):\n matname = submesh.get(\"material\")\n mat = bpy.data.materials.get(matname, None)\n if mat == None:\n mat = bpy.data.materials.new(matname)\n blender_materials.append(mat)\n for faces in submesh.iterfind(\"faces\"):\n for face in faces.iterfind(\"face\"):\n v1 = int(face.get(\"v1\"))\n v2 = int(face.get(\"v2\"))\n v3 = int(face.get(\"v3\"))\n # unpack_face_list() will re-arrange verts if the 3rd one has index 0.\n # This then breaks the uv assignment we do further down this function\n # because that code assumes the original arrangement. So to avoid this,\n # we make sure we never have a 0 in the 3rd face, otherwise re-arrange\n # verts ourselves before both of them.\n if v3 == 0:\n v1, v2, v3 = v2, v3, v1\n blender_faces.append((v1, v2, v3))\n blender_face_materials.append(len(blender_materials) - 1)\n\n meshname = bpy.path.basename(self.filepath)\n mesh = bpy.data.meshes.new(meshname)\n for mat in blender_materials:\n mesh.materials.append(mat)\n\n mesh.vertices.add(len(blender_verts))\n mesh.vertices.foreach_set(\"co\", unpack_list(blender_verts))\n\n mesh.tessfaces.add(len(blender_faces))\n unpacked = unpack_face_list(blender_faces)\n mesh.tessfaces.foreach_set(\"vertices_raw\", unpacked)\n mesh.tessfaces.foreach_set(\"material_index\", blender_face_materials)\n\n #for fi in range(0,len(blender_faces)-1):\n # mesh.tessfaces[fi].material_index = blender_face_materials[fi]\n\n mesh.tessface_uv_textures.new('coord0_uv')\n\n for fi, f in enumerate(blender_faces):\n mesh.tessface_uv_textures[0].data[fi].uv1 = blender_uvs[f[0]]\n mesh.tessface_uv_textures[0].data[fi].uv2 = blender_uvs[f[1]]\n mesh.tessface_uv_textures[0].data[fi].uv3 = blender_uvs[f[2]]\n\n if len(blender_cols) > 0:\n aaa = mesh.tessface_vertex_colors.new('diffuse_colour_aaa')\n rgb = mesh.tessface_vertex_colors.new('diffuse_colour_rgb')\n for fi, f in enumerate(blender_faces):\n rgb.data[fi].color1 = blender_cols[f[0]][0:3]\n rgb.data[fi].color2 = blender_cols[f[1]][0:3]\n rgb.data[fi].color3 = blender_cols[f[2]][0:3]\n aaa.data[fi].color1 = blender_cols[f[0]][3:4] * 3\n aaa.data[fi].color2 = blender_cols[f[1]][3:4] * 3\n aaa.data[fi].color3 = blender_cols[f[2]][3:4] * 3\n\n mesh.update()\n \n return {'FINISHED'}\n\n finally:\n if xml_filepath != self.filepath:\n os.remove(xml_filepath)\n\n\nclass ToolsPanel(bpy.types.Panel):\n bl_category = \"Grit\"\n bl_label = \"Grit Tools\"\n bl_space_type = 'VIEW_3D'\n bl_region_type = 'TOOLS'\n bl_context = \"objectmode\"\n\n def draw(self, context):\n sel_objs = context.selected_objects\n\n root = self.layout.box()\n root.label(\"New at cursor\", icon=\"NEW\")\n column = root.column(align=True)\n column.alignment = \"EXPAND\"\n column.operator(\"grit.new_class\")\n #column.operator(\"grit.new_object\")\n column.operator(\"grit.new_object2\")\n column.operator(\"grit.new_primitive\")\n\n obj = context.active_object\n if obj == None: return\n\n root = self.layout.box()\n root.label(\"Object\"+(\" \\\"\"+obj.name+\"\\\"\" if obj.grit_promotion == \"OBJECT\" else \"\"), icon=\"OBJECT_DATAMODE\")\n root = root.column(align=True)\n if obj.grit_promotion != \"OBJECT\":\n root.enabled = False\n root.prop(obj, \"grit_object_class_name\")\n\n root = self.layout.box()\n root.label(\"Class\"+(\" \\\"\"+strip_leading_exc(obj.name)+\"\\\"\" if obj.grit_promotion == \"CLASS\" else \"\"), icon=\"VIEW3D\")\n column = root.column(align=False)\n if obj.grit_promotion != \"CLASS\":\n column.enabled = False\n column.operator(\"grit.rename_class\")\n column2 = column.column(align=True)\n column2.prop(obj, \"grit_class_rendering_distance\")\n column2.prop(obj, \"grit_class_place_z_off\")\n column2.prop(obj, \"grit_class_place_rnd_rot\")\n column2.prop(obj, \"grit_class_cast_shadows\")\n\n root = self.layout.box()\n root.label(\".mesh\"+(\" \\\"\"+obj.name+\"\\\"\" if obj.grit_promotion == \"MESH\" else \"\"), icon=\"EDITMODE_HLT\")\n column = root.column(align=True)\n if obj.grit_promotion != \"MESH\":\n column.enabled = False\n column.prop(obj, \"grit_mesh_tangents\")\n \n root = self.layout.box()\n root.label(\".gcol\"+(\" \\\"\"+obj.name+\"\\\"\" if obj.grit_promotion == \"GCOL\" else \"\"), icon=\"PHYSICS\")\n column = root.column(align=True)\n if obj.grit_promotion != \"GCOL\":\n column.enabled = False\n column.prop(obj, \"grit_gcol_static\")\n column2 = column.column(align=True)\n if obj.grit_gcol_static: column2.enabled = False\n column2.prop(obj, \"grit_gcol_mass\")\n column2.prop(obj, \"grit_gcol_linear_damping\")\n column2.prop(obj, \"grit_gcol_angular_damping\")\n column2.prop(obj, \"grit_gcol_linear_sleep_thresh\")\n column2.prop(obj, \"grit_gcol_angular_sleep_thresh\")\n \n root = self.layout.box()\n root.label(\"External .gcol\"+(\" \\\"\"+obj.name+\"\\\"\" if obj.grit_promotion == \"GCOL_EXT\" else \"\"), icon=\"PHYSICS\")\n column = root.column(align=True)\n if obj.grit_promotion != \"GCOL_EXT\":\n column.enabled = False\n column.prop(obj, \"grit_gcol_ext_name\")\n \n root = self.layout.box()\n mapping = dict()\n mapping[\"GritPhysicsSphere\"] = \" (sphere)\"\n mapping[\"GritPhysicsBox\"] = \" (box)\"\n mapping[\"GritPhysicsCone\"] = \" (cone)\"\n mapping[\"GritPhysicsCylinder\"] = \" (cylinder)\"\n extra = obj.type == \"MESH\" and obj.grit_promotion == \"PRIM\" and (mapping.get(obj.data.name) or \" (hull)\") or \"\"\n root.label(\".gcol prim\"+(\" \\\"\"+obj.name+\"\\\"\" if obj.grit_promotion == \"PRIM\" else \"\")+extra, icon=\"PHYSICS\")\n root = root.column(align=True)\n if obj.grit_promotion != \"PRIM\":\n root.enabled = False\n #root.template_list(context.scene, \"objects\", context.scene, \"blah\")\n r = root.row()\n r.prop(obj, \"grit_gcol_prim_margin\")\n if obj.type == \"MESH\" and obj.data.name == \"GritPhysicsSphere\": r.enabled = False\n r = root.row()\n r.prop(obj, \"grit_gcol_prim_shrink\")\n if obj.type == \"MESH\" and mapping.get(obj.data.name): r.enabled = False\n\n self.layout.prop(obj, \"grit_export\", text=\"Export this object\")\n self.layout.prop(obj, \"grit_promotion\", text=\"Promotion\")\n\n \ndef register():\n bpy.utils.register_module(__name__)\n\ndef unregister():\n bpy.utils.unregister_module(__name__)\n" }, { "alpha_fraction": 0.5614310503005981, "alphanum_fraction": 0.5687609314918518, "avg_line_length": 27.939393997192383, "blob_id": "76fd8c46da549154ecd4abbe76881862dfb0f84d", "content_id": "295976197e4ed156fa49917cf7786105dbf23649", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 5730, "license_type": "permissive", "max_line_length": 80, "num_lines": 198, "path": "/gtasa/imgread.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <string>\n#include <vector>\n#include <fstream>\n#include <algorithm>\n#include <locale>\n\n#include \"ios_util.h\"\n#include \"imgread.h\"\n\n#define BLK_SZ 2048\n\nstatic int tolowr (int c)\n{\n return std::tolower(char(c),std::cout.getloc());\n}\n\nstatic std::string& strlower (std::string& s)\n{\n std::transform(s.begin(),s.end(), s.begin(),tolowr);\n return s;\n}\n\n\nvoid Img::init (std::istream &f, std::string name_)\n{\n name = name_;\n unsigned long version = ios_read_u32(f);\n APP_ASSERT(version==0x32524556);\n\n numFiles = ios_read_u32(f);\n names.resize(numFiles);\n offsets.resize(numFiles);\n sizes.resize(numFiles);\n\n for (size_t i=0 ; i<numFiles ; i++) {\n offsets[i] = ios_read_u32(f) * BLK_SZ;\n sizes[i]= ios_read_u32(f) * BLK_SZ;\n names[i] = ios_read_fixedstr(f,24);\n strlower(names[i]);\n }\n\n if (dir.size()==numFiles) return;\n for (unsigned long i=0 ; i<numFiles ; ++i) {\n dir[names[i]] = i;\n }\n}\n\nconst std::string &Img::fileName (unsigned long i) const\n{\n return names[i];\n}\n\nbool Img::fileExists (const std::string &fname) const\n{\n return dir.find(fname) != dir.end();\n}\n\nvoid Img::fileOffset (std::istream &f, unsigned long i) const\n{\n f.seekg(fileOffset(i)); \n APP_ASSERT_IO_SUCCESSFUL(f,\"seeking to: \"+fileName(i));\n}\n\nImg::Dir::const_iterator Img::find (const std::string &fname) const\n{\n Dir::const_iterator iter = dir.find(fname);\n if (iter==dir.end())\n GRIT_EXCEPT(name+\" did not contain: \\\"\"+fname+\"\\\"\");\n return iter;\n}\n\nvoid Img::fileOffset (std::istream &f, const std::string &fname) const\n{\n Dir::const_iterator iter = find(fname);\n fileOffset(f, iter->second);\n} \n\nunsigned long Img::fileOffset (unsigned long i) const\n{\n return offsets[i];\n}\n\nunsigned long Img::fileOffset (const std::string &fname) const\n{\n Dir::const_iterator iter = find(fname);\n return fileOffset(iter->second);\n} \n\nunsigned long Img::fileSize (unsigned long i) const\n{\n return sizes[i];\n}\n\nunsigned long Img::fileSize (const std::string &fname) const\n{\n Dir::const_iterator iter = find(fname);\n return fileSize(iter->second);\n} \n\n\n\n#ifdef _IMGREAD_EXEC\n\nsize_t amount_read = 0;\nsize_t amount_seeked = 0;\n\nvoid assert_triggered (void) { } \n\nvoid extract_file (std::ifstream &in,\n const std::string &name,\n unsigned long off, unsigned long sz)\n{\n char *data = new char[sz];\n in.seekg(off);\n APP_ASSERT_IO_SUCCESSFUL(in,\"extracting: \"+name);\n in.read(data,sz);\n APP_ASSERT_IO_SUCCESSFUL(in,\"extracting: \"+name);\n \n std::ofstream out;\n out.open(name.c_str(), std::ios::binary);\n APP_ASSERT_IO_SUCCESSFUL(out,\"opening output: \"+name);\n\n out.write(data,sz);\n APP_ASSERT_IO_SUCCESSFUL(out,\"writing output: \"+name);\n\n delete data;\n}\n\n\n\nint main(int argc, char *argv[])\n{\n if (argc!=2 && argc!=3) {\n std::cerr<<\"To extract a file: \"<<std::endl;\n std::cerr<<argv[0]<<\" <img> <file>\"<<std::endl;\n std::cerr<<\"To extract all files: \"<<std::endl;\n std::cerr<<argv[0]<<\" <img>\"<<std::endl;\n return EXIT_FAILURE;\n }\n bool all_files = argc==2;\n std::string extract;\n if (!all_files) extract = argv[2];\n\n try {\n\n std::ifstream in;\n in.open(argv[1], std::ios::binary);\n APP_ASSERT_IO_SUCCESSFUL(in,\"opening IMG\");\n\n Img img;\n\n img.init(in, argv[1]);\n\n if (!all_files) {\n unsigned long off = img.fileOffset(extract);\n unsigned long sz = img.fileSize(extract);\n extract_file(in, extract, off, sz);\n return EXIT_SUCCESS;\n }\n\n for (size_t i=0 ; i<img.size() ; i++) {\n unsigned long off = img.fileOffset(i);\n unsigned long sz = img.fileSize(i);\n extract_file(in, img.fileName(i), off, sz);\n }\n return EXIT_SUCCESS;\n\n } catch (const Exception &e) {\n CERR << e << std::endl;\n\n return EXIT_FAILURE;\n }\n}\n\n#endif\n\n// vim: shiftwidth=8:tabstop=8:expandtab\n" }, { "alpha_fraction": 0.7365743517875671, "alphanum_fraction": 0.7388355135917664, "avg_line_length": 35.47422790527344, "blob_id": "dee03367a02cec5ef6eecd3866a6362115969654", "content_id": "2be357f5868d1406e5901055d40c1a73d1a3ce4b", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 3538, "license_type": "permissive", "max_line_length": 86, "num_lines": 97, "path": "/engine/streamer.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\nclass GritClass;\n\n#ifndef Streamer_h\n#define Streamer_h\n\n#include <map>\n\nextern \"C\" {\n #include \"lua.h\"\n #include <lauxlib.h>\n #include <lualib.h>\n}\n\n#include \"grit_object.h\"\n#include \"math_util.h\"\n\n/** Single var cache of CORE_PREPARE_DISTANCE_FACTOR. */\nextern float streamer_prepare_distance_factor;\n\n/** Single var cache of CORE_VISIBILITY. */\nextern float streamer_visibility;\n\n/** Single var cache of CORE_FADE_OUT_FACTOR. */\nextern float streamer_fade_out_factor;\n\n/** Single var cache of CORE_FADE_OVERLAP_FACTOR. */\nextern float streamer_fade_overlap_factor;\n\n/** Call before anything else. Sets up internal state of the subsystem. */\nvoid streamer_init();\n\n/** Called frequently to action streaming.\n * \\param L Lua state for calling object activation callbacks.\n * \\param new_pos The player's position.\n */\nvoid streamer_centre (lua_State *L, const Vector3 &new_pos, bool everything);\n\n/** Called by objects when they change position or rendering distance.\n * \\param index The index of the object within the streamer.\n * \\param pos The new position of the object.\n * \\param d The new rendering distance of the object.\n */\nvoid streamer_update_sphere (size_t index, const Vector3 &pos, float d);\n \n/** Add a new object to the 'map', i.e. set of objects considered for streaming in. */\nvoid streamer_list (const GritObjectPtr &o);\n\n/** Remove an object from the map. */\nvoid streamer_unlist (const GritObjectPtr &o);\n\n/** Add to the list of activated objects. These are not streamed in when they\n * come into range, and are streamed out when they go out of range. */\nvoid streamer_list_as_activated (const GritObjectPtr &o);\n\n/** Remove an object from the list of activated objects. */\nvoid streamer_unlist_as_activated (const GritObjectPtr &o);\n\n/** Fetch a list of currently activated objects (via a pair of iterators). */\nvoid streamer_object_activated (GObjPtrs::iterator &begin, GObjPtrs::iterator &end);\n\n/** Return the number of currently activated objects. */\nint streamer_object_activated_count (void);\n\n\n/** Called whenever someone calls streamer_centre. */\nstruct StreamerCallback {\n virtual void update(const Vector3 &new_pos) = 0;\n};\n\n/** Register a StreamerCallback callback. */\nvoid streamer_callback_register (StreamerCallback *rc);\n\n/** Unregister a StreamerCallback callback. */\nvoid streamer_callback_unregister (StreamerCallback *rc);\n\n#endif\n" }, { "alpha_fraction": 0.39227810502052307, "alphanum_fraction": 0.4082036018371582, "avg_line_length": 47.54624938964844, "blob_id": "dc840bb96bfd7f5aec5f6597af490a5e64f5eb8c", "content_id": "003bda8276721f197d4d82b62931505c95a25230", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 27819, "license_type": "permissive", "max_line_length": 97, "num_lines": 573, "path": "/gtasa/ideread.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <climits>\n#include <cmath>\n#include <cerrno>\n\n#include <iostream>\n#include <string>\n#include <sstream>\n#include <vector>\n#include <fstream>\n#include <istream>\n#include <iomanip>\n#include <algorithm>\n#include <locale>\n\n#include \"ios_util.h\"\n#include \"ideread.h\"\n#include \"csvread.h\"\n\nstatic int tolowr (int c)\n{\n return std::tolower(char(c),std::cout.getloc());\n}\n\nstatic std::string& strlower (std::string& s)\n{\n std::transform(s.begin(),s.end(), s.begin(),tolowr);\n return s;\n}\n\nstatic std::string& str_lcase_crop (std::string& str)\n{\n strlower(str);\n std::string::size_type b=str.find_first_not_of(' ');\n std::string::size_type e=str.find_last_not_of(' ');\n str = str.substr(b,e+1);\n return str;\n}\n\n\nlong get_long(const std::string& val_, const char* name)\n{\n double val = strtod(val_.c_str(),NULL);\n if (val!=floor(val)){\n std::cerr<<name<<\" not an integer: \\\"\"<<val_<<\"\\\"\"<<std::endl;\n exit(EXIT_FAILURE);\n }\n return (long) floor(val);\n}\n\nunsigned long get_ulong(const std::string& val_, const char* name)\n{\n double val = strtod(val_.c_str(),NULL);\n if (val!=floor(val) || val<0) {\n std::cerr<<name<<\" not a positive integer: \\\"\"\n <<val_<<\"\\\"\"<<std::endl;\n exit(EXIT_FAILURE);\n }\n return (unsigned long) floor(val);\n}\n\nunsigned char get_uchar(const std::string& val_, const char* name)\n{\n double val = strtod(val_.c_str(),NULL);\n if (val!=floor(val) || val<0 || val>UCHAR_MAX) {\n std::cerr<<name<<\" not a positive integer <=255: \\\"\"\n <<val_<<\"\\\"\"<<std::endl;\n exit(EXIT_FAILURE);\n }\n return (unsigned char) floor(val);\n}\n\nbool get_bool(const std::string& val_, const char* name)\n{\n double val = strtod(val_.c_str(),NULL);\n if (val!=0 && val!=1) {\n std::cerr<<name<<\" not a boolean value (1 or 0): \\\"\"\n <<val_<<\"\\\"\"<<std::endl;\n exit(EXIT_FAILURE);\n }\n return val==1.0;\n}\n\nunsigned long get_hex(const std::string& val_, const char* name)\n{\n if (val_.size()==0) {\n std::cerr<<name<<\" not a hex value: \\\"\"<<val_<<\"\\\"\"<<std::endl;\n exit(EXIT_FAILURE);\n }\n char *ret;\n unsigned long val = strtoul(val_.c_str(),&ret,16);\n if (*ret!=0) {\n std::cerr<<name<<\" not a hex value: \\\"\"<<val_<<\"\\\"\"<<std::endl;\n exit(EXIT_FAILURE);\n }\n return val;\n}\n\nvoid read_ide (const std::string &filename, std::istream &f, struct ide *ide)\n{\n Csv csv;\n csv.filename = filename;\n read_csv(f,csv);\n\n for (Csv::iterator i=csv.begin(), i_=csv.end() ; i!=i_ ; ++i) {\n const std::string section = i->first;\n\n const CsvSection &lines = i->second;\n\n for (unsigned j=0 ; j<lines.size() ; ++j) {\n\n CsvLine line = lines[j];\n\n // airtrain_vlo in default.ide has 6 for some reason\n if (section==\"objs\" && line.size()==5) {\n Obj obj;\n obj.id = get_ulong(line[0],\"Id\");\n obj.dff = str_lcase_crop(line[1]);\n obj.txd = str_lcase_crop(line[2]);\n obj.draw_distance = (float)strtod(line[3].c_str(),NULL);\n obj.flags = get_ulong(line[4],\"Flags\");\n obj.is_car = false;\n APP_ASSERT((obj.flags|0x77feef) == 0x77feef);\n ide->objs.push_back(obj);\n } else if (section==\"objs\" && line.size()==6) {\n // mysterious airtrain_vlo thing\n } else if (section==\"tobj\" && line.size()==7) {\n TObj tobj;\n tobj.id = get_ulong(line[0],\"Id\");\n tobj.dff = str_lcase_crop(line[1]);\n tobj.txd = str_lcase_crop(line[2]);\n tobj.draw_distance =(float)strtod(line[3].c_str(),NULL);\n tobj.flags = get_ulong(line[4],\"Flags\");\n APP_ASSERT((tobj.flags|0x77feef) == 0x77feef);\n tobj.hour_on = get_uchar(line[5],\"Hour on\");\n tobj.hour_off = get_uchar(line[6],\"Hour off\");\n ide->tobjs.push_back(tobj);\n } else if (section==\"2dfx\" && line.size()==38) {\n //std::cout<<\"In \"<<section<<\" [\"<<line.size()<<\"] \"\n // <<str<<\"\\n\";\n } else if (section==\"anim\" && line.size()==6) {\n Anim anim;\n anim.id = get_ulong(line[0],\"Id\");\n anim.dff = str_lcase_crop(line[1]);\n anim.txd = str_lcase_crop(line[2]);\n anim.ifp_file = str_lcase_crop(line[3]);\n anim.draw_distance =(float)strtod(line[4].c_str(),NULL);\n anim.flags = get_ulong(line[5],\"Flags\");\n APP_ASSERT((anim.flags|0x77feef) == 0x77feef);\n ide->anims.push_back(anim);\n } else if (section==\"txdp\" && line.size()==2) {\n TXDP txdp;\n txdp.txd1 = str_lcase_crop(line[0]);\n txdp.txd2 = str_lcase_crop(line[1]);\n ide->txdps.push_back(txdp);\n } else if (section==\"weap\" && line.size()==7) {\n Weap weap;\n weap.id = get_ulong(line[0],\"Id\");\n weap.dff = str_lcase_crop(line[1]);\n weap.txd = str_lcase_crop(line[2]);\n weap.type = str_lcase_crop(line[3]);\n weap.unk_one = get_ulong(line[4],\"Unknown\");\n APP_ASSERT(weap.unk_one==1);\n weap.unk_num = get_ulong(line[5],\"Unknown\");\n weap.unk_zero = get_ulong(line[6],\"Unknown\");\n APP_ASSERT(weap.unk_zero==0);\n ide->weaps.push_back(weap);\n } else if (section==\"hier\" && line.size()==5) {\n } else if (section==\"peds\" && line.size()==14) {\n Ped ped;\n ped.id = get_ulong(line[0],\"Id\");\n ped.dff = str_lcase_crop(line[1]);\n ped.txd = str_lcase_crop(line[2]);\n ped.type = str_lcase_crop(line[3]);\n ped.stat_type = str_lcase_crop(line[4]);\n ped.anim_group = str_lcase_crop(line[5]);\n ped.can_drive = get_ulong(line[6],\"can_drive\");\n ped.buys_drugs = get_bool(line[7],\"buys drugs\");\n ped.anim_file = str_lcase_crop(line[8]);\n ped.radio1 = get_ulong(line[9],\"radio1\");\n ped.radio2 = get_ulong(line[10],\"radio2\");\n ped.unk1 = str_lcase_crop(line[11]);\n ped.unk2 = str_lcase_crop(line[12]);\n ped.unk3 = str_lcase_crop(line[13]);\n ide->peds.push_back(ped);\n } else if (section==\"cars\"&&(line.size()>=11||line.size()<=15)) {\n Vehicle vehicle;\n vehicle.id = get_ulong(line[0],\"Id\");\n vehicle.dff = str_lcase_crop(line[1]);\n vehicle.txd = str_lcase_crop(line[2]);\n //bike bmx boat car heli mtruck plane quad trailer train\n vehicle.type = str_lcase_crop(line[3]);\n vehicle.handling_id = str_lcase_crop(line[4]);\n vehicle.game_name = str_lcase_crop(line[5]);\n // BF_injection biked bikeh bikes bikev bmx bus choppa\n // coach dozer KART mtb nevada null quad rustler shamal\n // tank truck van vortex wayfarer\n vehicle.anims = str_lcase_crop(line[6]);\n // bicycle big executive ignore leisureboat moped\n // motorbike normal poorfamily richfamily taxi worker\n // workerboat\n vehicle.class_ = str_lcase_crop(line[7]);\n vehicle.freq = get_ulong(line[8],\"Frequency\");\n vehicle.flags = get_ulong(line[9],\"Flags\");\n // 0 1012 1f10 1f341210 2ff0 3012 30123345\n // 3210 3f01 3f10 3f341210 4fff\n vehicle.comp_rules = get_hex(line[10],\"CompRules\");\n // boats do not have the following:\n if (line.size()>=15) {\n APP_ASSERT(vehicle.type!=\"boat\");\n // on bikes, 16 or 23, otherwise -1\n vehicle.unk1 = get_long(line[11],\"Unknown1\");\n APP_ASSERT(vehicle.type==\"bike\" ||\n vehicle.type==\"bmx\" ||\n vehicle.unk1==-1);\n APP_ASSERT(vehicle.type!=\"bmx\" ||\n vehicle.unk1==16||vehicle.unk1==23);\n APP_ASSERT(vehicle.type!=\"bike\" ||\n vehicle.unk1==16||vehicle.unk1==23);\n vehicle.front_wheel_size =\n (float)strtod(line[12].c_str(),NULL);\n vehicle.rear_wheel_size =\n (float)strtod(line[13].c_str(),NULL);\n // -1 0 1 2 (on non-cars always -1)\n vehicle.unk2 = get_long(line[14],\"Unknown2\");\n APP_ASSERT(vehicle.unk2>=-1 && vehicle.unk2<=2);\n APP_ASSERT(vehicle.type==\"car\" ||\n vehicle.unk2==-1);\n }\n ide->vehicles.push_back(vehicle);\n } else {\n std::cerr<<\"In \"<<filename<<\":\"<<line.orig_line<<\" \"\n <<\"section \"<<section<<\", row \"<<line.section_line<<\", \"\n <<\"did not have the right number of values: \"\n <<line.size()<<std::endl;\n }\n }\n }\n\n}\n#if 0\nvoid read_ide (std::istream &f, struct ide *ide)\n{\n std::string section(\"no section\");\n\n std::vector<std::string> strs;\n\n for (std::string str ; std::getline(f,str) ; ) {\n\n size_t len = str.size();\n if (len==0) continue;\n if (str[0]=='#') continue;\n\n bool all_whitespace = true;\n for (size_t i=0 ; i<str.size() ; i++) {\n if (str[i]!='\\n' &&\n str[i]!='\\r' &&\n str[i]!=' ' &&\n str[i]!='\\t') {\n //std::cerr<<(int)str[i]<<std::endl;\n all_whitespace = false;\n } else {\n str[i] = ' ';\n }\n if (str[i]==',') str[i] = ' ';\n }\n\n if (all_whitespace) continue;\n\n std::string::size_type b = str.find_first_not_of(' ');\n std::string::size_type e = str.find_last_not_of(' ');\n str = str.substr(b,e+1);\n\n if (str==\"hier\") { section = str; continue; }\n if (str==\"weap\") { section = str; continue; }\n if (str==\"objs\") { section = str; continue; }\n if (str==\"tobj\") { section = str; continue; }\n if (str==\"path\") { section = str; continue; }\n if (str==\"2dfx\") { section = str; continue; }\n if (str==\"anim\") { section = str; continue; }\n if (str==\"txdp\") { section = str; continue; }\n if (str==\"peds\") { section = str; continue; }\n if (str==\"cars\") { section = str; continue; }\n if (str==\"end\") { section = \"between sections\" ; continue; }\n\n\n std::stringstream ss;\n ss << str;\n strs.clear();\n for (std::string word ; std::getline(ss,word,' ') ; ) {\n //std::cout<<word2<<std::endl;\n if (word==\"\") continue;\n strs.push_back(word);\n }\n\n // airtrain_vlo in default.ide has 6 for some reason\n if (section==\"objs\" && strs.size()==5) {\n Obj obj;\n obj.id = get_ulong(strs[0],\"Id\");\n obj.dff = str_lcase_crop(strs[1]);\n obj.txd = str_lcase_crop(strs[2]);\n obj.draw_distance = (float)strtod(strs[3].c_str(),NULL);\n obj.flags = get_ulong(strs[4],\"Flags\");\n obj.is_car = false;\n APP_ASSERT((obj.flags|0x77feef) == 0x77feef);\n ide->objs.push_back(obj);\n } else if (section==\"objs\" && strs.size()==6) {\n // mysterious airtrain_vlo thing\n } else if (section==\"tobj\" && strs.size()==7) {\n TObj tobj;\n tobj.id = get_ulong(strs[0],\"Id\");\n tobj.dff = str_lcase_crop(strs[1]);\n tobj.txd = str_lcase_crop(strs[2]);\n tobj.draw_distance =(float)strtod(strs[3].c_str(),NULL);\n tobj.flags = get_ulong(strs[4],\"Flags\");\n APP_ASSERT((tobj.flags|0x77feef) == 0x77feef);\n tobj.hour_on = get_uchar(strs[5],\"Hour on\");\n tobj.hour_off = get_uchar(strs[6],\"Hour off\");\n ide->tobjs.push_back(tobj);\n } else if (section==\"2dfx\" && strs.size()==38) {\n //std::cout<<\"In \"<<section<<\" [\"<<strs.size()<<\"] \"\n // <<str<<\"\\n\";\n } else if (section==\"anim\" && strs.size()==6) {\n Anim anim;\n anim.id = get_ulong(strs[0],\"Id\");\n anim.dff = str_lcase_crop(strs[1]);\n anim.txd = str_lcase_crop(strs[2]);\n anim.ifp_file = str_lcase_crop(strs[3]);\n anim.draw_distance =(float)strtod(strs[4].c_str(),NULL);\n anim.flags = get_ulong(strs[5],\"Flags\");\n APP_ASSERT((anim.flags|0x77feef) == 0x77feef);\n ide->anims.push_back(anim);\n } else if (section==\"txdp\" && strs.size()==2) {\n TXDP txdp;\n txdp.txd1 = str_lcase_crop(strs[0]);\n txdp.txd2 = str_lcase_crop(strs[1]);\n ide->txdps.push_back(txdp);\n } else if (section==\"weap\" && strs.size()==7) {\n Weap weap;\n weap.id = get_ulong(strs[0],\"Id\");\n weap.dff = str_lcase_crop(strs[1]);\n weap.txd = str_lcase_crop(strs[2]);\n weap.type = str_lcase_crop(strs[3]);\n weap.unk_one = get_ulong(strs[4],\"Unknown\");\n APP_ASSERT(weap.unk_one==1);\n weap.unk_num = get_ulong(strs[5],\"Unknown\");\n weap.unk_zero = get_ulong(strs[6],\"Unknown\");\n APP_ASSERT(weap.unk_zero==0);\n ide->weaps.push_back(weap);\n } else if (section==\"hier\" && strs.size()==5) {\n } else if (section==\"peds\" && strs.size()==14) {\n Ped ped;\n ped.id = get_ulong(strs[0],\"Id\");\n ped.dff = str_lcase_crop(strs[1]);\n ped.txd = str_lcase_crop(strs[2]);\n ped.type = str_lcase_crop(strs[3]);\n ped.stat_type = str_lcase_crop(strs[4]);\n ped.anim_group = str_lcase_crop(strs[5]);\n ped.can_drive = get_ulong(strs[6],\"can_drive\");\n ped.buys_drugs = get_bool(strs[7],\"buys drugs\");\n ped.anim_file = str_lcase_crop(strs[8]);\n ped.radio1 = get_ulong(strs[9],\"radio1\");\n ped.radio2 = get_ulong(strs[10],\"radio2\");\n ped.unk1 = str_lcase_crop(strs[11]);\n ped.unk2 = str_lcase_crop(strs[12]);\n ped.unk3 = str_lcase_crop(strs[13]);\n ide->peds.push_back(ped);\n } else if (section==\"cars\"&&(strs.size()==11||strs.size()==15)) {\n Vehicle vehicle;\n vehicle.id = get_ulong(strs[0],\"Id\");\n vehicle.dff = str_lcase_crop(strs[1]);\n vehicle.txd = str_lcase_crop(strs[2]);\n //bike bmx boat car heli mtruck plane quad trailer train\n vehicle.type = str_lcase_crop(strs[3]);\n vehicle.handling_id = str_lcase_crop(strs[4]);\n vehicle.game_name = str_lcase_crop(strs[5]);\n // BF_injection biked bikeh bikes bikev bmx bus choppa\n // coach dozer KART mtb nevada null quad rustler shamal\n // tank truck van vortex wayfarer\n vehicle.anims = str_lcase_crop(strs[6]);\n // bicycle big executive ignore leisureboat moped\n // motorbike normal poorfamily richfamily taxi worker\n // workerboat\n vehicle.class_ = str_lcase_crop(strs[7]);\n vehicle.freq = get_ulong(strs[8],\"Frequency\");\n vehicle.flags = get_ulong(strs[9],\"Flags\");\n // 0 1012 1f10 1f341210 2ff0 3012 30123345\n // 3210 3f01 3f10 3f341210 4fff\n vehicle.comp_rules = get_hex(strs[10],\"CompRules\");\n // boats do not have the following:\n if (strs.size()==15) {\n APP_ASSERT(vehicle.type!=\"boat\");\n // on bikes, 16 or 23, otherwise -1\n vehicle.unk1 = get_long(strs[11],\"Unknown1\");\n APP_ASSERT(vehicle.type==\"bike\" ||\n vehicle.type==\"bmx\" ||\n vehicle.unk1==-1);\n APP_ASSERT(vehicle.type!=\"bmx\" ||\n vehicle.unk1==16||vehicle.unk1==23);\n APP_ASSERT(vehicle.type!=\"bike\" ||\n vehicle.unk1==16||vehicle.unk1==23);\n vehicle.front_wheel_size =\n (float)strtod(strs[12].c_str(),NULL);\n vehicle.rear_wheel_size =\n (float)strtod(strs[13].c_str(),NULL);\n // -1 0 1 2 (on non-cars always -1)\n vehicle.unk2 = get_long(strs[14],\"Unknown2\");\n APP_ASSERT(vehicle.unk2>=-1 && vehicle.unk2<=2);\n APP_ASSERT(vehicle.type==\"car\" ||\n vehicle.unk2==-1);\n }\n ide->vehicles.push_back(vehicle);\n } else {\n std::cerr<<\"In \"<<section<<\", couldn't understand \\\"\"\n <<str<<\"\\\" \"<<strs.size()<<std::endl;\n }\n }\n}\n#endif\n\n#ifdef _IDEREAD_EXEC\n\nvoid app_verbose(char const* file, int line, const std::string& msg)\n{\n std::cout<<BOLD<<GREEN<<\"VERBOSE \"<<RESET\n <<BOLD<<file<<NOBOLD<<\":\"<<BOLD<<line<<NOBOLD\n << \": \\\"\"<<BOLD<<BLUE<<msg<<RESET\"\\\"\";\n std::cout<<std::endl;\n}\n\nvoid app_error(char const* file, int line,\n const std::string& i_was, const std::string& msg)\n{\n std::cout<<BOLD RED\"ERROR \"<<RESET\n <<BOLD<<file<<NOBOLD<<\":\"<<BOLD<<line<<NOBOLD\n <<\": \\\"\"<<BOLD<<YELLOW<<msg<<RESET<<\"\\\"\";\n if (i_was!=\"\")\n std::cout<<\" (\"<<BOLD<<YELLOW<<i_was<<RESET<<\")\";\n std::cout<<std::endl;\n}\n\nvoid app_line(const std::string &msg)\n{\n std::cout<<BOLD<<msg<<NOBOLD<<std::endl;\n}\n\nvoid app_fatal()\n{\n abort();\n}\n\nvoid assert_triggered (void) { } \n\nstd::string fstr(unsigned int flags)\n{\n std::stringstream ss;\n if (flags & OBJ_FLAG_WET) ss << \"WET \";\n if (flags & OBJ_FLAG_NIGHT) ss << \"NIGHT \";\n if (flags & OBJ_FLAG_ALPHA1) ss << \"ALPHA1 \";\n if (flags & OBJ_FLAG_ALPHA2) ss << \"ALPHA2 \";\n if (flags & OBJ_FLAG_DAY) ss << \"DAY \";\n if (flags & OBJ_FLAG_INTERIOR) ss << \"INTERIOR \";\n if (flags & OBJ_FLAG_NO_SHADOW) ss << \"NO_SHADOW \";\n if (flags & OBJ_FLAG_NO_COL) ss << \"NO_COL \";\n if (flags & OBJ_FLAG_NO_DRAW_DIST) ss << \"NO_DRAW_DIST \";\n if (flags & OBJ_FLAG_BREAK_GLASS) ss << \"BREAK_GLASS \";\n if (flags & OBJ_FLAG_BREAK_GLASS_CRACK) ss << \"BREAK_GLASS_CRACK \";\n if (flags & OBJ_FLAG_GARAGE_DOOR) ss << \"GARAGE_DOOR \";\n if (flags & OBJ_FLAG_2CLUMP) ss << \"2CLUMP \";\n if (flags & OBJ_FLAG_SWAYS) ss << \"SWAYS \";\n if (flags & OBJ_FLAG_OTHER_VEG) ss << \"OTHER_VEG \";\n if (flags & OBJ_FLAG_POLE_SHADOW) ss << \"POLE_SHADOW \";\n if (flags & OBJ_FLAG_EXPLOSIVE) ss << \"EXPLOSIVE \";\n if (flags & OBJ_FLAG_UNK1) ss << \"UNK1 \";\n if (flags & OBJ_FLAG_UNK2) ss << \"UNK2 \";\n if (flags & OBJ_FLAG_UNK3) ss << \"UNK3 \";\n if (flags & OBJ_FLAG_GRAFITTI) ss << \"GRAFITTI \";\n if (flags & OBJ_FLAG_DRAW_BACKFACE) ss << \"DRAW_BACKFACE \";\n if (flags & OBJ_FLAG_UNK4) ss << \"UNK4 \";\n return ss.str();\n}\n\nint main(int argc, char *argv[])\n{\n if (argc!=2) {\n std::cerr<<\"Usage: \"<<argv[0]<<\" <ide file>\"<<std::endl;\n return EXIT_FAILURE;\n }\n\n try {\n\n std::ifstream idefstream;\n std::istream *idestream = &idefstream;\n std::string filename;\n\n if (strcmp(argv[1],\"-\")==0) {\n idestream = &std::cin;\n filename = \"<stdin>\";\n } else {\n filename = argv[1];\n idefstream.open (filename.c_str());\n APP_ASSERT_IO_SUCCESSFUL(idefstream,\n \"Opening ide: \"+filename);\n if (idefstream.fail() || idefstream.bad()) {\n std::stringstream ss;\n ss << filename << \": IO Error: \" << strerror(errno) << \"\\n\";\n GRIT_EXCEPT(ss.str());\n }\n }\n\n struct ide ide;\n read_ide(filename, *idestream,&ide);\n\n for (size_t i=0 ; i<ide.objs.size() ; i++) {\n std::cout << \"obj: \"<<ide.objs[i].id<<\" \"\n <<\"\\\"\"<<ide.objs[i].dff<<\"\\\" \"\n <<\"\\\"\"<<ide.objs[i].txd<<\"\\\" \"\n <<ide.objs[i].draw_distance<<\" \"\n <<fstr(ide.objs[i].flags)<<\"\\n\";\n }\n for (size_t i=0 ; i<ide.tobjs.size() ; i++) {\n std::cout << \"tobj: \"<<ide.tobjs[i].id<<\" \"\n <<\"\\\"\"<<ide.tobjs[i].dff<<\"\\\" \"\n <<\"\\\"\"<<ide.tobjs[i].txd<<\"\\\" \"\n <<ide.tobjs[i].draw_distance<<\" \"\n <<fstr(ide.tobjs[i].flags)<<\"\\n\";\n }\n for (size_t i=0 ; i<ide.anims.size() ; i++) {\n std::cout << \"anims: \"<<ide.anims[i].id<<\" \"\n <<\"\\\"\"<<ide.anims[i].dff<<\"\\\" \"\n <<\"\\\"\"<<ide.anims[i].txd<<\"\\\" \"\n <<ide.anims[i].draw_distance<<\" \"\n <<fstr(ide.anims[i].flags)<<\"\\n\";\n }\n\n for (size_t i=0 ; i<ide.txdps.size() ; i++) {\n std::cout << \"txdp: \"<<ide.txdps[i].txd1<<\" → \"\n <<ide.txdps[i].txd2<<std::endl;\n }\n\n } catch (const Exception &e) {\n\n CERR << e << std::endl;\n return EXIT_FAILURE;\n\n }\n\n return EXIT_SUCCESS;\n}\n\n#endif\n\n// vim: shiftwidth=8:tabstop=8:expandtab\n" }, { "alpha_fraction": 0.4831475019454956, "alphanum_fraction": 0.4973607659339905, "avg_line_length": 37.49058532714844, "blob_id": "5970d16a17397d5e4725dda459cd636a3907763f", "content_id": "c4bd04cc7c2e09fdae42cf66919d550c8f3ee669", "detected_licenses": [ "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer", "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 38837, "license_type": "permissive", "max_line_length": 110, "num_lines": 1009, "path": "/dependencies/quex-0.34.1/quex/GetPot.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "#! /usr/bin/env python\n# Quex is free software; you can redistribute it and/or modify it under the\n# terms of the GNU Lesser General Public License as published by the Free\n# Software Foundation; either version 2.1 of the License, or (at your option)\n# any later version.\n# \n# This software is distributed in the hope that it will be useful, but WITHOUT\n# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more\n# details.\n# \n# You should have received a copy of the GNU Lesser General Public License along\n# with this library; if not, write to the Free Software Foundation, Inc., 59\n# Temple Place, Suite 330, Boston, MA 02111-1307 USA\n#\n################################################################################\n#! /usr/bin/env python\n# Quex is free software; you can redistribute it and/or modify it under the\n# terms of the GNU Lesser General Public License as published by the Free\n# Software Foundation; either version 2.1 of the License, or (at your option)\n# any later version.\n# \n# This software is distributed in the hope that it will be useful, but WITHOUT\n# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more\n# details.\n# \n# You should have received a copy of the GNU Lesser General Public License along\n# with this library; if not, write to the Free Software Foundation, Inc., 59\n# Temple Place, Suite 330, Boston, MA 02111-1307 USA\n#\n################################################################################\n#! /usr/bin/env python\n# Quex is free software; you can redistribute it and/or modify it under the\n# terms of the GNU Lesser General Public License as published by the Free\n# Software Foundation; either version 2.1 of the License, or (at your option)\n# any later version.\n# \n# This software is distributed in the hope that it will be useful, but WITHOUT\n# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more\n# details.\n# \n# You should have received a copy of the GNU Lesser General Public License along\n# with this library; if not, write to the Free Software Foundation, Inc., 59\n# Temple Place, Suite 330, Boston, MA 02111-1307 USA\n#\n################################################################################\n# -*- python -*- \n# GetPot Version $$Version$$ $$Date$$\n# \n# WEBSITE: http://getpot.sourceforge.net\n# \n# This library is free software; you can redistribute it and/or modify\n# it under the terms of the GNU Lesser General Public License as\n# published by the Free Software Foundation; either version 2.1 of the\n# License, or (at your option) any later version.\n# \n# This library is distributed in the hope that it will be useful, but\n# WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n# Lesser General Public License for more details.\n# \n# You should have received a copy of the GNU Lesser General Public\n# License along with this library; if not, write to the Free Software\n# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307\n# USA\n# \n# (C) 2001, 2002 Frank R. Schaefer \n#==========================================================================\nimport string\nimport os\nimport copy\n\nclass GetPot_variable:\n def __init__(self, name, str_value):\n self.name = name\n self.take(str_value)\n\n def take(self, str_value):\n self.value = string.split(str_value)\n self.original = str_value\n \n\nclass GetPot:\n def __init__(self, Argv=[], Filename=None):\n # Make the default argument for Argv=[], otherwise\n # strange things may occur, when somewhere the cursor\n # is set to len(Argv) - 1. Even if the user passes a dangerous\n # [], the case is caught.\n if Argv == []: Argv = [\"\"]\n \n # in case a search for a specific argument failed,\n # it effects the next functions calls.\n self.search_failed_f = 0\n\n # indeces of arguments that do not start with minus\n self.idx_nominus = []\n\n # vector of identified variables\n # (arguments of the form \"variable=value\")\n self.variables = [ ]\n\n self.section_list = []\n \n # cursor oriented functions (nect(), follow(), etc.): \n # pointer to actual position to be parsed.\n self.cursor = 0\n self.nominus_cursor = -1\n self.search_loop_f = 1\n self.prefix = \"\"\n # set up the internal database\n\n if Filename != None:\n Argv = [ Filename ]\n parsed_argv = self.__read_in_file(Filename)\n try: Argv.extend(parsed_argv)\n except: pass\n\n self.argv = self.__parse_argument_vector(Argv)\n \n if self.argv == []: self.argv = [\"\"]\n\n def __parse_argument_vector(self, argv_):\n\n self.section = ''\n section_stack = []\n\n argv = []\n\n for i in range(len(argv_)):\n arg = argv_[i]\n\n if len(arg) == 0: continue\n elif i == 0: argv.append(arg); continue\n \n # [section] ?\n if len(arg) > 1 and arg[0] == '[' and arg[-1] == ']':\n name = self.DBE_expand_string(arg[1:-1])\n self.section = self.__process_section_label(name, section_stack)\n if self.section not in self.section_list:\n self.section_list.append(self.section)\n argv.append(arg)\n else:\n arg = self.section + self.DBE_expand_string(arg[:])\n argv.append(arg)\n \n # no-minus argument ?\n if arg[0] != '-': self.idx_nominus.append(i)\n\n # assignment ?\n for k in range(len(arg)-1):\n if arg[k] == '=':\n v = self.__find_variable(arg[0:k])\n if v == None:\n self.variables.append(GetPot_variable(arg[0:k], arg[k+1:]))\n else:\n v.take(arg[k+1:])\n\n return argv\n\n\n # (*) file parsing\n def __read_in_file(self, Filename):\n \"\"\"Parses a file and returns a vector of arguments.\"\"\"\n try:\n fh = open(Filename, \"rb\")\n except:\n raise \"GetPot: could not open file '%s'\" % Filename\n\n brute_tokens = []\n token = 0\n while token != '':\n self.__skip_whitespace(fh)\n token = self.__get_next_token(fh)\n brute_tokens.append(token)\n\n # -- reduce expressions of token1'='token2 to a single \n # string 'token1=token2'\n # -- copy everything into 'argv'\n # -- arguments preceded by something like '[' name ']' (section)\n # produce a second copy of each argument with a prefix '[name]argument'\n i1 = 0; i2 = 1; i3 = 2;\n\n argv = []\n # loop over brute tokens to create argv vector\n while i1 < len(brute_tokens): \n SRef = brute_tokens[i1];\n \n # concatinate 'variable' '=' 'value' to 'variable=value'\n if i2 < len(brute_tokens) and brute_tokens[i2] == '=':\n if i3 >= len(brute_tokens):\n argv.append(brute_tokens[i1] + brute_tokens[i2])\n else:\n argv.append(brute_tokens[i1] + brute_tokens[i2] + brute_tokens[i3])\n i1 = i3 + 1; i2 = i3 + 2; i3 = i3 + 3;\n continue\n else:\n argv.append(SRef)\n i1 = i2; i2 = i3; i3 += 1;\n \n return argv\n\n def __skip_whitespace(self, FH):\n \"\"\"Skips whitespaces: space, tabulator, newline and #-comments.\"\"\"\n tmp = ' '\n while 1+1==2:\n while tmp == ' ' or tmp == '\\t' or tmp == '\\n':\n tmp = FH.read(1) \n if tmp == '': return # end of file ?\n\n # found a non whitespace \n if tmp != '#':\n # put the last read letter back \n FH.seek(-1,1) # (seek -1 backwards from current position (code=1))\n return\n\n # '#' - comment => skip until end of line\n while tmp != '\\n':\n tmp = FH.read(1)\n if tmp == '': return # end of file ?\n\n def __get_next_token(self, FH):\n \"\"\"Reads next chunk of characters that are not separated by\n whitespace. Quotes and ${ ... }, however, allow to embrace whitespaces.\"\"\"\n token = ''; tmp = 0; last_letter = 0\n while 1+1 == 2:\n last_letter = tmp; tmp = FH.read(1);\n if tmp == '' or \\\n ((tmp == ' ' or tmp == '\\t' or tmp == '\\n') and last_letter != '\\\\'):\n return token\n elif tmp == '\\'' and not last_letter == '\\\\':\n # QUOTES: un-backslashed quotes => it's a string\n token += self.__get_string(FH)\n continue\n elif tmp == \"{\" and last_letter == '$':\n token += '{' + self.__get_until_closing_bracket(FH)\n continue\n elif tmp == \"$\" and last_letter == '\\\\':\n token += tmp; tmp = 0 # so that last_letter will become = 0, not '$'\n continue\n elif tmp == '\\\\' and not last_letter == '\\\\':\n continue # don't append un-backslashed backslashes\n\n token += tmp\n\n\n def __get_string(self, FH):\n \"\"\"Reads characters until the next un-backslashed quote.\"\"\"\n str = ''; tmp = 0\n while 1 + 1 == 2:\n last_letter = tmp; tmp = FH.read(1)\n if tmp == '': return str\n # un-backslashed quotes => it's the end of the string\n elif tmp == '\\'' and not last_letter == '\\\\': return str\n elif tmp == '\\\\' and not last_letter == '\\\\': continue # don't append \n\n str += tmp\n\n\n def __get_until_closing_bracket(self, FH):\n \"\"\"Reads characters until the next un-backslashed '}'.\"\"\"\n str = ''; tmp = 0\n brackets = 1\n while 1 + 1 == 2:\n last_letter = tmp; tmp = FH.read(1)\n if tmp == '': return str \n elif tmp == '{' and last_letter == '$': brackets += 1\n elif tmp == '}':\n brackets -= 1\n # un-backslashed brackets => it's the end of the string\n if brackets == 0: return str + '}'\n elif tmp == '\\\\' and not last_letter == '\\\\':\n continue # do not append an unbackslashed backslash\n \n str += tmp\n\n\n\n def __process_section_label(self, label, section_stack): \n # 1) subsection of actual section ('./' prefix)\n if len(label) >= 2 and label[:2] == \"./\":\n label = label[2:]\n # a single [./] means 'the same section' \n # 2) subsection of parent section ('../' prefix)\n elif label[0:3] == \"../\":\n while label[0:3] == \"../\":\n if len(section_stack) != 0: section_stack.pop()\n label = label[3:]\n # 3) subsection of the root-section\n else:\n del section_stack[:]\n\n # 4) parse section name for slashes\n if label != \"\":\n i=0\n while i < len(label): \n if label[i] == '/': \n section_stack.append(label[0:i])\n if i+1 < len(label):\n label = label[i+1:]\n i = 0\n else: \n i += 1\n section_stack.append(label)\n\n section = \"\"\n for s in section_stack:\n section += s + '/'\n\n return section\n \n def __convert_to_type(self, String, Default):\n \"\"\"Converts a string into an object of the same type as 'Default'.\n Returns 'None' in case this is not possible.\"\"\"\n if type(Default) == type(\"\"):\n # character string\n return String\n elif type(Default) == type(0.):\n # float\n try: return float(String)\n except: return Default\n elif type(Default) == type(0):\n # integer\n if len(String) >= 2 and String[0:2] == \"0x\": start_i = 2\n elif len(String) >=3 and String[0:3] == \"-0x\": start_i = 3\n else:\n # normal integer, not a hexadecimal\n try: return int(String)\n except: return Default\n\n # a hexadecimal number\n number = 0;\n for c in String[start_i:len(String)]:\n c = int(c)\n if c >= int('0') and c <= int('9'): digit = c - int('0')\n elif c >= int('a') and c <= int('f'): digit = c - int('a')\n elif c >= int('A') and c <= int('F'): digit = c - int('A')\n else: break\n number *= 16\n number += digit\n if start_i == 2: return number\n else: return -number\n\n def __get_remaining_string(self, String, Start):\n \"\"\"Checks if 'String' begins with 'Start' and returns the remaining String.\n Returns None if String does not begin with Start.\"\"\"\n if Start == \"\": return String\n if string.find(String, Start) == 0: return String[len(Start):]\n else: return None\n\n\n def __deal_propperly_with_array_arguments(self, Args):\n tmp_args = []\n for arg in Args:\n if type(arg) == list: tmp_args.extend(arg)\n else: tmp_args.append(arg)\n return tmp_args\n \n # -- search for a certain option and set cursor to position\n def search(self, *Args):\n \"\"\"Search for a command line argument and set cursor. Starts search\n from current cursor position. Only wraps arround the end, if 'loop'\n is enabled. Returns 'False' if nothing was found, True otherwise.\"\"\"\n\n # make sure to propperly deal with arrays being passed as arguments\n Args = self.__deal_propperly_with_array_arguments(Args)\n \n if self.cursor >= len(self.argv)-1:\n self.cursor = len(self.argv)-1\n self.search_failed_f = 1\n old_cursor = self.cursor\n\n def check_match(i0, i1, Args, Argv=self.argv, Prefix=self.prefix, obj=self):\n \"\"\"Checks if one of the arguments in Args matches an argument in sequence.\"\"\"\n for i in range(i0, i1):\n for arg in Args:\n if Prefix + arg == Argv[i]:\n obj.cursor = i; obj.search_failed_f = 0\n return True\n return False\n \n # first run: from cursor to end\n if check_match(self.cursor, len(self.argv), Args, self.argv) == 1: return True\n \n if self.search_loop_f == 0: return False\n\n # second run: from 1 to old_cursor position\n # (note, that old_cursor can be at maximum = len(self.argv),\n # the range function contains therefore only values until\n # \"len(self.argv) - 1\")\n if check_match(1, old_cursor, Args, self.argv) == 1: return True\n\n return False\n \n def disable_loop(self):\n self.search_loop_f = 0\n \n def enable_loop(self):\n self.search_loop_f = 1\n \n # -- reset cursor to initial position\n def reset_cursor(self):\n self.search_failed_f = 0; self.cursor = 0\n\n def search_failed(self):\n return self.search_failed_f\n\n def init_multiple_occurrence(self):\n self.disable_loop(); self.reset_cursor()\n\n def set_prefix(self, Prefix):\n self.prefix = Prefix\n \n # (*) direct access to command line arguments through []-operator\n def __getitem__(self, Idx):\n \"\"\"Returns a specific argument indexed by Idx or 'None' if this\n does not exist.\"\"\"\n if Idx < 0 or Idx >= len(self.argv): return None\n return self.argv[Idx]\n\n def get(self, Idx, Default):\n \"\"\"Looks if the type of argv[Idx] matches the type of the default argument.\n If it does not, the default argument is returned.\"\"\"\n if self[Idx] == None: return Default\n return self.__convert_to_type(self[Idx], Default)\n\n def size(self):\n \"\"\"Returns the size of the argument list.\"\"\"\n return len(self.argv)\n\n\n # -- get argument at cursor++\n def next(self, Default):\n \"\"\"Tests if the following argument is of the same type as Default. If not\n Default is returned. Note, that if the following argument does not contain\n the 'prefix', the same way the Default argument is returned.\"\"\"\n if self.search_failed_f == 1: return Default\n self.cursor += 1\n if self.cursor >= len(self.argv): self.cursor = len(self.argv)-1; return Default\n\n if self.prefix == \"\": return self.__convert_to_type(self.argv[self.cursor], Default)\n\n remain = self.__get_remaining_string(self.argv[self.cursor], self.prefix)\n if remain != None: return self.__convert_to_type(remain, Default)\n else: return Default\n\n\n # -- search for option and get argument at cursor++\n def follow(self, Default, *Args):\n # make sure to propperly deal with arrays being passed as arguments\n Args = self.__deal_propperly_with_array_arguments(Args)\n for arg in Args:\n if self.search(arg) == 1:\n return self.next(Default)\n return Default\n\n\n def nominus_followers(self, *Args):\n \"\"\"Returns a list of strings of arguments that directly follow\n the option but do not start with a minus.\"\"\"\n\n # make sure to propperly deal with arrays being passed as arguments\n Args = self.__deal_propperly_with_array_arguments(Args)\n \n result_list = []\n for arg in Args:\n if self.search(arg) == False: continue\n while 1 + 1 == 2:\n self.cursor += 1\n if self.cursor >= len(self.argv):\n self.cursor = len(self.argv)-1\n break\n if len(self.argv[self.cursor]) >= 1:\n if self.argv[self.cursor][0] == \"-\":\n break\n else:\n result_list.append(self.argv[self.cursor])\n\n return result_list\n \n\n def direct_follow(self, Default, Arg):\n remaining_string = self.__match_starting_string(Arg)\n\n if remaining_string == None:\n return Default\n self.cursor += 1\n if self.cursor >= len(self.argv): self.cursor = len(self.argv)\n return self.__convert_to_type(remaining_string, Default)\n\n # helper to find directly followed arguments\n def __match_starting_string(self, StartString):\n \"\"\"Searches argument list for next occurrence of 'StartString', beginning\n from current cursor position. Returns string after StartString if found.\n Returns None if no argument contains the starting string.\"\"\"\n old_cursor = self.cursor\n\n self.search_failed_f = 1\n # first run: from cursor to end\n if self.cursor < len(self.argv):\n for i in range(old_cursor, len(self.argv)):\n if string.find(self.argv[i], StartString) == 0:\n self.cursor = i\n self.search_failed_f = 0\n return self.argv[i][len(StartString):]\n\n if self.search_loop_f == 0: return None\n\n # second run: from 1 to old_cursor position\n # (note, that old_cursor can be at maximum = len(self.argv),\n # the range function contains therefore only values until\n # \"len(self.argv) - 1\")\n for i in range(1, old_cursor):\n if string.find(self.argv[i], StartString) == 0:\n self.cursor = i\n self.search_failed_f = 0\n return self.argv[i][len(StartString):]\n return None\n\n # (*) flags\n def options_contain(self, FlagList):\n \"\"\"Go through all arguments that start with a '-' and watch if they\n contain a flag in flaglist. In case a prefix is specified, the option\n must be preceeded with it, e.g. 'pack-options/-cvx'.\"\"\"\n for arg in self.argv:\n if self.prefix != \"\": arg = self.__get_remaining_string(arg, self.prefix)\n if arg != None and len(arg) >= 2 and arg[0] == '-' and arg[1] != '-' \\\n and self.__check_flags(arg, FlagList) == 1: return 1\n \n return 0\n\n def argument_contains(self, Idx, FlagList):\n \"\"\"Check if an argument that is associated with a certain index contains\n a certain flag. If a prefix is specified, the index indicates the number\n inside the list.\"\"\"\n if Idx < 0 or Idx > len(self.argv): return 0\n\n if self.prefix == \"\":\n # search argument for any flag in flag list\n return self.__check_flags(self.argv[Idx], FlagList)\n \n # if a prefix is set, then the argument index is the index\n # inside the 'namespace'\n # => only check list of arguments that start with prefix\n no_matches = 0\n for i in range(len(self.argv)):\n remain = self.__get_remaining_string(self.argv[i], self.prefix)\n if remain != None:\n no_matches += 1\n if no_matches == Idx:\n return self.__check_flags(remain, FlagList)\n # no argument in this namespace\n return 0\n\n def __check_flags(self, Str, FlagList):\n \"\"\"Does a given string 'Str' contain a flag in 'FlagList' ?\"\"\"\n for l in Str:\n for f in FlagList:\n if f == l:\n return 1\n return 0\n\n\n # (*) nominus arguments\n def reset_nominus_cursor(self):\n self.nominus_cursor = -1\n\n def nominus_vector(self):\n v_nm = []\n for i in self.idx_nominus:\n v_nm.append(self.argv[i])\n return v_nm\n \n def nominus_size(self):\n return len(self.idx_nominus)\n \n def next_nominus(self):\n if self.nominus_cursor >= len(self.idx_nominus)-1: return None\n self.nominus_cursor += 1\n return self.argv[self.idx_nominus[self.nominus_cursor]]\n\n\n # (*) variables\n # helper to find arguments\n def get_variable_names(self):\n # return all variables for given prefix\n vars = []\n for v in self.variables:\n tmp = self.__get_remaining_string(v.name, self.prefix)\n if tmp != None: vars.append(tmp)\n return vars\n\n def get_section_names(self):\n self.section_list\n\n # helper to find arguments\n def __find_variable(self, VarName):\n \"\"\"Search for a variable in the array of variables.\"\"\"\n v_name = self.prefix + VarName\n for v in self.variables:\n if v.name == v_name: return v \n return None\n\n # -- scalar values and vectors\n def __call__(self, VarName, Default, Idx=-1):\n \"\"\"Returns 'None' in case variable was not found or type did not match.\"\"\"\n v = self.__find_variable(VarName)\n if v == None:\n return Default\n if Idx == -1:\n # variable has to be considered as a single value\n return self.__convert_to_type(v.original, Default)\n else:\n # variable interpreted as vector\n if Idx >= len(v.value):\n return Default\n return self.__convert_to_type(v.value[Idx], Default)\n \n def vector_variable_size(self):\n return variables.size()\n\n\n def Print(self):\n print \"argc = %i\" % len(self.argv)\n for arg in self.argv:\n print \"%s\" % arg\n\n # (*) dollar bracket expressions (DBEs) ------------------------------------\n #\n # 1) Entry Function: DBE_expand_string()\n # Takes a string such as\n #\n # \"${+ ${x} ${y}} Subject-${& ${section} ${subsection}}: ${title}\"\n #\n # calls DBE_expand() for each of the expressions\n #\n # ${+ ${x} ${y}}\n # ${& ${section} ${subsection}}\n # ${Title}\n #\n # and returns the string\n #\n # \"4711 Subject-1.01: Mit den Clowns kamen die Schwaene\"\n #\n # assuming that\n # x = \"4699\"\n # y = \"12\"\n # section = \"1.\"\n # subsection = \"01\"\n # title = \"Mit den Clowns kamen die Schwaene\"\n #\n # 2) DBE_expand():\n #\n # checks for the command, i.e. the 'sign' that follows '${'\n # divides the argument list into sub-expressions using\n # DBE_get_expr_list()\n #\n # ${+ ${x} ${y}} -> \"${x}\" \"${y}\"\n # ${& ${section} ${subsection}} -> \"${section}\" \"${subsection}\"\n # ${Title} -> Nothing, variable expansion\n #\n # 3) DBE_expression_list():\n #\n # builds a vector of unbracketed whitespace separated strings, i.e.\n #\n # \" ${Number}.a ${: Das Marmorbild} AB-${& Author= ${Eichendorf}-1870}\"\n #\n # is split into a vector\n #\n # [0] ${Number}.a\n # [1] ${: Das Marmorbild}\n # [2] ${& Author= ${Eichendorf}}\n #\n # The each sub-expression is expanded using expand(). \n #--------------------------------------------------------------------------- \n def DBE_expand_string(self, String):\n \"\"\"Parses for closing operators '${ }' and expands them letting\n white spaces and other letters as they are.\"\"\"\n new_string = \"\"\n open_brackets = 0\n for i in range(len(String)):\n if i < len(String)-2 and String[i:i+2] == \"${\":\n if open_brackets == 0: first = i+2;\n open_brackets += 1;\n elif String[i] == \"}\" and open_brackets > 0:\n open_brackets -= 1\n if open_brackets == 0:\n new_string += self.DBE_expand(String[first:i])\n elif open_brackets == 0:\n new_string += String[i]\n\n return new_string\n\n\n def DBE_get_expr_list(self, String, ExpectedNumber):\n \"\"\"Separates expressions by non-bracketed whitespaces, expands them\n and puts them into a list.\"\"\"\n i = 0\n # (1) eat initial whitespaces\n for letter in String:\n if letter != \" \" and letter != \"\\t\" and letter != \"\\n\":\n break\n i += 1\n \n expr_list = []\n open_brackets = 0\n start_idx = []\n start_new_string = i\n L = len(String)\n # (2) search for ${ } expressions ...\n while i < L:\n letter = String[i]\n # whitespace -> end of expression\n if (letter == \" \" or letter == \"\\t\" or letter == \"\\n\") \\\n and open_brackets == 0: \n expr_list.append(String[start_new_string:i])\n for i in range(i+1, L):\n letter = String[i]\n if letter != \" \" and letter != \"\\t\" and letter != \"\\n\":\n start_new_string = i\n break\n else:\n # end of expression list\n if len(expr_list) < ExpectedNumber:\n expr_list.extend([\"<< ${ }: missing arguments>>\"] * (ExpectedNumber - len(expr_list)))\n return expr_list\n\n # dollar-bracket expression\n if len(String) >= i+2 and String[i:i+2] == \"${\":\n open_brackets += 1\n start_idx.append(i+2)\n elif letter == \"}\" and open_brackets > 0:\n start = start_idx.pop()\n Replacement = self.DBE_expand(String[start:i])\n if start-2 <= 0: String = Replacement + String[i+1:]\n else: String = String[:start-2] + Replacement + String[i+1:]\n L = len(String) \n i = start + len(Replacement) - 3\n open_brackets -= 1\n i += 1\n \n expr_list.append(String[start_new_string:i])\n if len(expr_list) < ExpectedNumber:\n expr_list.extend([\"<< ${ }: missing arguments>>\"] * (ExpectedNumber - len(expr_list)))\n\n return expr_list\n\n\n def DBE_get_variable(self, VarName):\n SECURE_Prefix = self.prefix\n\n for p in [self.section, \"\"]:\n self.prefix = p\n # (1) first search in currently active section\n # (2) search in root name space\n var = self.__find_variable(VarName)\n if type(var) != type(None):\n self.prefix = SECURE_Prefix\n return var\n\n self.prefix = SECURE_Prefix\n return \"<<${ } variable '%s' undefined>>\" % VarName\n\n\n def DBE_expand(self, Expr):\n # ${: } pure text\n if Expr[0] == \":\":\n return Expr[1:]\n\n # ${& expr expr ... } text concatination\n elif Expr[0] == \"&\":\n A = self.DBE_get_expr_list(Expr[1:], 1)\n return reduce(lambda a,b: \"%s%s\" % (a, b), A)\n\n # ${<-> expr expr expr} text replacement\n elif len(Expr) >= 3 and Expr[0:3] == \"<->\":\n A = self.DBE_get_expr_list(Expr[3:], 3)\n # string old new\n return string.replace(A[0], A[1], A[2])\n\n # ${+ ...}, ${- ...}, ${* ...}, ${/ ...} expressions\n elif Expr[0] == \"+\":\n A = self.DBE_get_expr_list(Expr[1:], 2)\n return \"%e\" % (reduce(lambda a, b:\n self.__convert_to_type(a, 0.) + self.__convert_to_type(b,0.),\n A))\n \n elif Expr[0] == \"-\":\n A = self.DBE_get_expr_list(Expr[1:], 2)\n return \"%e\" % reduce(lambda a, b:\n self.__convert_to_type(a, 0.) - self.__convert_to_type(b,0.),\n A)\n\n elif Expr[0] == \"*\":\n A = self.DBE_get_expr_list(Expr[1:], 2)\n return \"%e\" % reduce(lambda a, b:\n self.__convert_to_type(a, 0.) * self.__convert_to_type(b,0.),\n A)\n\n elif Expr[0] == \"/\":\n A = self.DBE_get_expr_list(Expr[1:], 2)\n Q = self.__convert_to_type(A[0], 0.)\n if Q == 0: return repr(0.)\n for q in A[1:]:\n q = self.__convert_to_type(q, 0.)\n if q == 0.0: return repr(0.)\n Q /= q\n return \"%e\" % Q\n\n # ${^ ... } power expressions\n elif Expr[0] == \"^\":\n A = self.DBE_get_expr_list(Expr[1:], 2)\n return \"%e\" % reduce(lambda a, b:\n self.__convert_to_type(a, 0.) ** self.__convert_to_type(b,0.),\n A)\n \n # ${== } ${<= } ${>= } comparisons (return the number of the first 'match'\n elif len(Expr) >= 2 and \\\n (Expr[0:2] == \"==\" or Expr[0:2] == \">=\" or Expr[0:2] == \"<=\" or \\\n Expr[0:1] == \">\" or Expr[0:1] == \"<\"):\n # differentiate between two and one sign operators\n if Expr[1] == \"=\": OP = Expr[0:2]; A = self.DBE_get_expr_list(Expr[2:], 2)\n else: OP = Expr[0]; A = self.DBE_get_expr_list(Expr[1:], 2)\n\n x_orig = A[0] \n x = self.__convert_to_type(x_orig, 1e37)\n i = 1\n\n for y_orig in A[1:]:\n y = self.__convert_to_type(y_orig, 1e37)\n # set the strings as reference if one wasn't a number\n if x == 1e37 or y == 1e37: xc = x_orig; y = y_orig; \n else: xc = x\n\n if OP == \"==\" and xc == y: return repr(i)\n elif OP == \">=\" and xc >= y: return repr(i)\n elif OP == \"<=\" and xc <= y: return repr(i) \n elif OP == \">\" and xc > y: return repr(i)\n elif OP == \"<\" and xc < y: return repr(i)\n i += 1\n\n # nothing fulfills the condition => return 0\n return repr(0)\n\n # ${?? expr expr} select \n elif len(Expr) >=2 and Expr[0:2] == \"??\":\n A = self.DBE_get_expr_list(Expr[2:], 2)\n X = self.__convert_to_type(A[0], 1e37)\n # last element is always the default argument\n if X == 1e37 or X < 0 or X >= len(A) - 1:\n return A[-1]\n # round X to closest integer\n return A[int(X+0.5)]\n \n # ${? expr expr expr} if then else conditions\n elif Expr[0] == \"?\":\n A = self.DBE_get_expr_list(Expr[1:], 2)\n if self.__convert_to_type(A[0], 0.0) == 1.0: return A[1]\n elif len(A) > 2: return A[2]\n\n # ${! expr} maxro expansion \n elif Expr[0] == \"!\":\n Var = self.DBE_get_variable(Expr[1:])\n # error\n if type(Var) == type(\"\"): return Var\n\n A = self.DBE_get_expr_list(Var.original, 2)\n return A[0]\n\n # ${@: } - string subscription\n elif len(Expr) >= 2 and Expr[0:2] == \"@:\":\n A = self.DBE_get_expr_list(Expr[2:], 2) \n X = self.__convert_to_type(A[1], 1e37)\n\n # last element is always the default argument\n if X == 1e37 or X < 0 or X >= len(A[0]) - 1:\n return \"<<1st index out of range>>\"\n\n if len(A) > 2:\n Y = self.__convert_to_type(A[2], 1e37)\n if Y != 1e37 and Y > 0 and Y <= len(A[0]) - 1 and Y > X:\n return A[0][int(X+0.5):int(Y+1.5)]\n elif Y == -1:\n return A[0][int(X+0.5):]\n return \"<<2nd index out of range>>\" \n else:\n return A[0][int(X+0.5)]\n \n # ${@ } - vector subscription\n elif Expr[0] == \"@\":\n A = self.DBE_get_expr_list(Expr[1:], 2)\n Var = self.DBE_get_variable(A[0])\n # error\n if type(Var) == type(\"\"): return Var\n \n X = self.__convert_to_type(A[1], 1e37)\n\n # last element is always the default argument\n if X == 1e37 or X < 0 or X >= len(Var.value):\n return \"<<1st index out of range>>\"\n\n if len(A) > 2:\n Y = self.__convert_to_type(A[2], 1e37)\n if Y != 1e37 and Y > 0 and Y <= len(Var.value) and Y > X:\n Vec = Var.value[int(X+0.5):int(Y+1.5)]\n elif Y == -1:\n Vec = Var.value[int(X+0.5):]\n else:\n return \"<<2nd index out of range>>\" \n return reduce(lambda a,b: \"%s %s\" % (a,b), Vec)\n else:\n return Var.value[int(X+0.5)]\n\n \n A = self.DBE_get_expr_list(copy.copy(Expr), 1)\n\n B = self.DBE_get_variable(A[0])\n\n if type(B) == type(\"\"): return B\n else: return B.original\n\n\n # (*) unidentified flying objects\n def unidentified_arguments(self, *Knowns):\n known_x = []\n # convert lists\n for k in Knowns:\n if type(k) == list: known_x.extend(k)\n else: known_x.append(k)\n\n ufos = []\n for it in self.argv[1:]:\n arg = self.__get_remaining_string(it, self.prefix)\n if arg not in known_x: ufos.append(it)\n return ufos\n\n def unidentified_options(self, *Knowns):\n known_x = []\n # convert lists\n for k in Knowns:\n if type(k) == list: known_x.extend(k)\n else: known_x.append(k)\n\n ufos = []\n for it in self.argv[1:]:\n arg = self.__get_remaining_string(it, self.prefix)\n if len(arg) < 2 or arg[0] != '-': continue\n if arg not in known_x: ufos.append(it)\n return ufos\n\n def unidentified_flags(self, KnownFlags, ArgumentNumber=-1):\n\n ufos = \"\"\n if ArgumentNumber == -1:\n # (*) search through all options with one single '-'\n for it in self.argv[1:]:\n arg = self.__get_remaining_string(it, self.prefix)\n if len(arg) < 2: continue\n elif arg[0] != '-': continue\n elif arg[1] == '-': continue\n \n for letter in arg[1:]:\n if letter not in KnownFlags: ufos += letter;\n else:\n no_matches = 0\n for it in argv[1:]:\n Remain = self.__get_remaining_string(it, self.prefix)\n if Remain != \"\":\n no_matches += 1\n if no_matches == ArgumentNumber:\n # -- the right argument number inside the section is found\n # => check it for flags\n for letter in Remain:\n if letter not in KnownFlags: ufos += letter;\n return ufos\n return ufos\n\n def unidentified_variables(self, *Knowns):\n ufos = []\n for it in self.variables:\n var_name = self.__get_remaining_string(it.name, self.prefix)\n if var_name not in Knowns: ufos.append(it.name)\n return ufos\n \n def unidentified_sections(self, *Knowns):\n ufos = []\n for it in self.section_list:\n sec_name = self.__get_remaining_string(it, self.prefix)\n if sec_name not in Knowns: ufos.append(it)\n return ufos\n\n def unidentified_nominuses(self, Knowns):\n ufos = []\n for it in self.argv[1:]:\n arg = self.__get_remaining_string(it, self.prefix)\n # only 'real nominuses'\n if len(arg) < 1 or arg[0] == '-': continue\n elif arg[0] == '[' and arg[-1] == ']': continue # section label\n elif '=' in arg: continue # variable definition\n\n if arg not in Knowns: ufos.append(it)\n return ufos\n \n\n\n#license-info Sat Aug 5 12:31:27 2006#\n#license-info Sat Aug 5 13:05:27 2006#\n#license-info Sat Aug 5 14:10:32 2006#\n" }, { "alpha_fraction": 0.6116265654563904, "alphanum_fraction": 0.6238402724266052, "avg_line_length": 28.56597137451172, "blob_id": "2f2e937bd0bc8e708efaebb5c3d390d39a7fa6a8", "content_id": "cc765e2d8b0d5b0d5903a0cdbf077c4a7e020d24", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 8515, "license_type": "permissive", "max_line_length": 87, "num_lines": 288, "path": "/engine/audio/lua_wrappers_audio.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include \"../main.h\"\n#include \"../external_table.h\"\n#include \"../lua_ptr.h\"\n#include \"../path_util.h\"\n\n#include \"audio.h\"\n#include \"lua_wrappers_audio.h\"\n\n#define AUDIOSOURCE_TAG \"Grit/AudioBody\"\n\nvoid push_audiobody (lua_State *L, const AudioBodyPtr &self)\n{\n if (self.isNull())\n lua_pushnil(L);\n else\n push(L,new AudioBodyPtr(self),AUDIOSOURCE_TAG);\n}\n\nGC_MACRO(AudioBodyPtr,audiobody,AUDIOSOURCE_TAG)\n\nstatic int audiobody_play (lua_State *L)\n{\nTRY_START\n check_args(L,1);\n GET_UD_MACRO(AudioBodyPtr,self,1,AUDIOSOURCE_TAG);\n self->play();\n return 0;\nTRY_END\n}\n\nstatic int audiobody_pause (lua_State *L)\n{\nTRY_START\n check_args(L,1);\n GET_UD_MACRO(AudioBodyPtr,self,1,AUDIOSOURCE_TAG);\n self->pause();\n return 0;\nTRY_END\n}\n\nstatic int audiobody_stop (lua_State *L)\n{\nTRY_START\n check_args(L,1);\n GET_UD_MACRO(AudioBodyPtr,self,1,AUDIOSOURCE_TAG);\n self->stop();\n return 0;\nTRY_END\n}\n\nstatic int audiobody_destroy (lua_State *L)\n{\nTRY_START\n check_args(L,1);\n GET_UD_MACRO(AudioBodyPtr,self,1,AUDIOSOURCE_TAG);\n self->destroy();\n return 0;\nTRY_END\n}\n\nTOSTRING_SMART_PTR_MACRO (audiobody,AudioBodyPtr,AUDIOSOURCE_TAG)\n\nstatic int audiobody_index (lua_State *L)\n{\nTRY_START\n check_args(L,2);\n GET_UD_MACRO(AudioBodyPtr,self,1,AUDIOSOURCE_TAG);\n const char *key = luaL_checkstring(L,2);\n if (!::strcmp(key,\"position\")) {\n push_v3(L, self->getPosition());\n } else if (!::strcmp(key,\"orientation\")) {\n push_quat(L, self->getOrientation());\n } else if (!::strcmp(key,\"separation\")) {\n lua_pushnumber(L, self->getSeparation());\n } else if (!::strcmp(key,\"velocity\")) {\n push_v3(L, self->getVelocity());\n } else if (!::strcmp(key,\"looping\")) {\n lua_pushboolean(L, self->getLooping());\n } else if (!::strcmp(key,\"pitch\")) {\n lua_pushnumber(L, self->getPitch());\n } else if (!::strcmp(key,\"volume\")) {\n lua_pushnumber(L, self->getVolume());\n } else if (!::strcmp(key,\"ambient\")) {\n lua_pushboolean(L, self->getAmbient());\n } else if (!::strcmp(key,\"referenceDistance\")) {\n lua_pushnumber(L, self->getReferenceDistance());\n } else if (!::strcmp(key,\"rollOff\")) {\n lua_pushnumber(L, self->getRollOff());\n } else if (!::strcmp(key,\"playing\")) {\n lua_pushboolean(L, self->playing());\n } else if (!::strcmp(key,\"play\")) {\n push_cfunction(L,audiobody_play);\n } else if (!::strcmp(key,\"pause\")) {\n push_cfunction(L,audiobody_pause);\n } else if (!::strcmp(key,\"stop\")) {\n push_cfunction(L,audiobody_stop);\n } else if (!::strcmp(key,\"destroy\")) {\n push_cfunction(L,audiobody_destroy);\n } else {\n my_lua_error(L,\"Not a readable AudioBody member: \"+std::string(key));\n }\n return 1;\nTRY_END\n}\n\n\nstatic int audiobody_newindex (lua_State *L)\n{\nTRY_START\n check_args(L,3);\n GET_UD_MACRO(AudioBodyPtr,self,1,AUDIOSOURCE_TAG);\n const char *key = luaL_checkstring(L,2);\n if (!::strcmp(key,\"position\")) {\n Vector3 v = check_v3(L,3);\n self->setPosition(v);\n } else if (!::strcmp(key,\"orientation\")) {\n Quaternion v = check_quat(L,3);\n self->setOrientation(v);\n } else if (!::strcmp(key,\"separation\")) {\n float v = check_float(L,3);\n self->setSeparation(v);\n } else if (!::strcmp(key,\"velocity\")) {\n Vector3 v = check_v3(L,3);\n self->setVelocity(v);\n } else if (!::strcmp(key,\"pitch\")) {\n float f = check_float(L, 3);\n self->setPitch(f);\n } else if (!::strcmp(key,\"volume\")) {\n float f = check_float(L, 3);\n self->setVolume(f);\n } else if (!::strcmp(key,\"referenceDistance\")) {\n float f = check_float(L, 3);\n self->setReferenceDistance(f);\n } else if (!::strcmp(key,\"rollOff\")) {\n float f = check_float(L, 3);\n self->setRollOff(f);\n } else if (!::strcmp(key,\"looping\")) {\n bool b = check_bool(L,3);\n self->setLooping(b);\n } else {\n my_lua_error(L,\"Not a writable AudioBody member: \"+std::string(key));\n }\n return 0;\nTRY_END\n}\n\nEQ_MACRO(AudioBodyPtr,audiobody,AUDIOSOURCE_TAG)\n\nMT_MACRO_NEWINDEX(audiobody);\n\nstatic int global_audio_body_make (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n push_audiobody(L, AudioBody::make(check_path(L, 1),false));\n return 1;\nTRY_END\n}\n\nstatic int global_audio_body_make_ambient (lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n push_audiobody(L, AudioBody::make(check_path(L, 1),true));\n return 1;\nTRY_END\n}\n\nstatic int global_audio_play_ambient (lua_State *L)\n{\nTRY_START\n check_args(L, 3);\n std::string res = check_path(L,1);\n float volume = check_float(L,2);\n float pitch = check_float(L,3);\n audio_play_ambient(res, volume, pitch);\n return 0;\nTRY_END\n}\n\nstatic int global_audio_play (lua_State *L)\n{\nTRY_START\n check_args(L, 6);\n std::string res = check_path(L,1);\n float volume = check_float(L,2);\n float pitch = check_float(L,3);\n Vector3 pos = check_v3(L,4);\n float ref_dist = check_float(L,5);\n float roll_off = check_float(L,6);\n audio_play(res, pos, volume, ref_dist, roll_off, pitch);\n return 0;\nTRY_END\n}\n\nstatic int global_audio_update (lua_State *L)\n{\nTRY_START\n check_args(L, 3);\n audio_update(check_v3(L, 1), check_v3(L, 2), check_quat(L, 3));\n return 0;\nTRY_END\n}\n\nstatic int global_audio_option_reset (lua_State *L)\n{\nTRY_START\n check_args(L, 0);\n audio_option_reset();\n return 0;\nTRY_END\n}\n\nint global_audio_option (lua_State *L)\n{\nTRY_START\n if (lua_gettop(L)==2) {\n std::string opt = luaL_checkstring(L,1);\n int t;\n AudioBoolOption o0;\n AudioIntOption o1;\n AudioFloatOption o2;\n audio_option_from_string(opt, t, o0, o1, o2);\n switch (t) {\n case -1: my_lua_error(L,\"Unrecognised audio option: \\\"\"+opt+\"\\\"\");\n case 0: audio_option(o0, check_bool(L,2)); break;\n case 1: audio_option(o1, check_t<int>(L,2)); break;\n case 2: audio_option(o2, check_float(L,2)); break;\n default: my_lua_error(L,\"Unrecognised type from audio_option_from_string\");\n }\n return 0;\n } else {\n check_args(L,1);\n std::string opt = luaL_checkstring(L,1);\n int t;\n AudioBoolOption o0;\n AudioIntOption o1;\n AudioFloatOption o2;\n audio_option_from_string(opt, t, o0, o1, o2);\n switch (t) {\n case -1: my_lua_error(L,\"Unrecognised audio option: \\\"\"+opt+\"\\\"\");\n case 0: lua_pushboolean(L,audio_option(o0)); break;\n case 1: lua_pushnumber(L,audio_option(o1)); break;\n case 2: lua_pushnumber(L,audio_option(o2)); break;\n default: my_lua_error(L,\"Unrecognised type from audio_option_from_string\");\n }\n return 1;\n }\nTRY_END\n}\n\nstatic const luaL_reg global[] = {\n {\"audio_body_make\",global_audio_body_make},\n {\"audio_body_make_ambient\",global_audio_body_make_ambient},\n {\"audio_play\",global_audio_play},\n {\"audio_play_ambient\",global_audio_play_ambient},\n {\"audio_update\",global_audio_update},\n {\"audio_option\",global_audio_option},\n {\"audio_option_reset\",global_audio_option_reset},\n {NULL,NULL}\n};\n\nvoid audio_lua_init (lua_State *L)\n{\n ADD_MT_MACRO(audiobody,AUDIOSOURCE_TAG);\n register_lua_globals(L, global);\n}\n" }, { "alpha_fraction": 0.6897746920585632, "alphanum_fraction": 0.691724419593811, "avg_line_length": 28.58974266052246, "blob_id": "980c40c9536259629da040a2c03ac39dad545020", "content_id": "1725fd364620e559c13755af8d8f8a6baaf41325", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 4616, "license_type": "permissive", "max_line_length": 94, "num_lines": 156, "path": "/engine/gfx/gfx_text_body.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include \"../shared_ptr.h\"\n\nclass GfxTextBody;\ntypedef SharedPtr<GfxTextBody> GfxTextBodyPtr;\n\n#ifndef GfxTextBody_h\n#define GfxTextBody_h\n\n#include \"gfx_fertile_node.h\"\n#include \"gfx_text_buffer.h\"\n#include \"gfx_material.h\"\n\n// Must extend Ogre::MovableObject so that we can become attached to a node and\n// rendered by the regular Ogre scenemanager-based pipeline.\nclass GfxTextBody : public GfxFertileNode, public Ogre::MovableObject {\n\n protected:\n\n class Sub : public Ogre::Renderable {\n\n protected:\n\n GfxTextBody *parent;\n\n public:\n\n Sub (GfxTextBody *parent)\n : parent(parent)\n { }\n ~Sub() { }\n\n const Ogre::MaterialPtr& getMaterial(void) const;\n\n\n void getRenderOperation(Ogre::RenderOperation& op)\n { op = parent->textBuffer.getRenderOperation(); }\n\n void getWorldTransforms(Ogre::Matrix4* xform) const;\n unsigned short getNumWorldTransforms(void) const;\n Ogre::Real getSquaredViewDepth(const Ogre::Camera* cam) const;\n const Ogre::LightList& getLights(void) const;\n\n bool getCastShadows(void) const;\n };\n\n\n void recomputeBounds (void);\n\n const Ogre::AxisAlignedBox& getBoundingBox (void) const\n { return bounds; }\n \n float getBoundingRadius (void) const;\n\n void _updateRenderQueue (Ogre::RenderQueue* queue);\n void visitRenderables (Ogre::Renderable::Visitor* visitor, bool debugRenderables = false);\n\n const std::string& getMovableType (void) const { return className; }\n\n\n static const std::string className;\n\n Sub sub;\n \n GfxMaterial *material;\n\n bool emissiveEnabled;\n float fade;\n // Hack to pass material into queue->addRenderable\n Ogre::MaterialPtr renderMaterial;\n GfxTextBuffer textBuffer;\n // Ogre API requires us to return a reference to this.\n Ogre::AxisAlignedBox bounds;\n bool enabled;\n bool castShadows;\n\n GfxTextBody (GfxFont *font, GfxMaterial *mat, const GfxNodePtr &par_);\n ~GfxTextBody ();\n\n public:\n static GfxTextBodyPtr make (GfxFont *font, GfxMaterial *mat,\n const GfxNodePtr &par_=GfxNodePtr(NULL));\n\n void append (const std::string &text, const Vector3 &top_colour, float top_alpha,\n const Vector3 &bot_colour, float bot_alpha) {\n textBuffer.addFormattedString(text, top_colour, top_alpha, bot_colour, bot_alpha);\n }\n\n void updateGpu (void) {\n textBuffer.updateGPU(true, 0, 0);\n recomputeBounds();\n }\n\n void clear (void) {\n textBuffer.clear();\n }\n GfxFont *getFont (void) const {\n return textBuffer.getFont();\n }\n void setFont (GfxFont *font) {\n textBuffer.setFont(font);\n }\n\n\n GfxMaterial *getMaterial (void) const;\n void setMaterial (GfxMaterial *m);\n\n bool getEmissiveEnabled (void) const;\n void setEmissiveEnabled (bool v);\n\n unsigned getBatches (void) const;\n unsigned getBatchesWithChildren (void) const;\n\n unsigned getTriangles (void) const;\n unsigned getTrianglesWithChildren (void) const;\n\n unsigned getVertexes (void) const;\n unsigned getVertexesWithChildren (void) const;\n\n float getFade (void) const;\n void setFade (float f);\n\n bool getCastShadows (void) const;\n void setCastShadows (bool v);\n\n bool isEnabled (void) const;\n void setEnabled (bool v);\n\n void destroy (void);\n\n bool hasGraphics (void) const { return true; }\n\n friend class SharedPtr<GfxTextBody>;\n};\n\n#endif\n" }, { "alpha_fraction": 0.7144644260406494, "alphanum_fraction": 0.7233776450157166, "avg_line_length": 35.335227966308594, "blob_id": "7ea372123c8aba77d894ff76f7b39472bae9de52", "content_id": "2187f3134bdb99e3e2573582b3f48020a7011f00", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 6395, "license_type": "permissive", "max_line_length": 107, "num_lines": 176, "path": "/engine/gfx/gfx_internal.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <string>\n#include <sstream>\n\n#include \"gfx.h\"\n#include \"gfx_option.h\"\n#include \"gfx_gasoline.h\"\n\n#define RESGRP \"GRIT\"\n\n// render queues, ordering now actually determined by GfxPipeline\n#define RQ_GBUFFER_OPAQUE 10\n#define RQ_FORWARD_OPAQUE 20\n#define RQ_FORWARD_OPAQUE_EMISSIVE 21\n#define RQ_FORWARD_ALPHA_DEPTH 60\n#define RQ_FORWARD_ALPHA_DEPTH_EMISSIVE 61\n#define RQ_FORWARD_ALPHA 70\n#define RQ_FORWARD_ALPHA_EMISSIVE 71\n\n#ifndef GFX_INTERNAL_H\n#define GFX_INTERNAL_H\n\n#define NUM_GLOBAL_TEXTURES_LIGHTING 8\n#define NUM_GLOBAL_TEXTURES_NO_LIGHTING 2\n\nextern bool d3d9;\nextern Ogre::Root *ogre_root;\nextern Ogre::RenderWindow *ogre_win;\nextern Ogre::RenderSystem *ogre_rs;\n\nextern Ogre::OctreeSceneManager *ogre_sm;\nextern Ogre::SceneNode *ogre_root_node;\nextern Ogre::Light *ogre_sun;\n\n// Note: Must be cleaned up in gfx_shutdown.\nextern DiskResourcePtr<GfxEnvCubeDiskResource> global_env_cube0;\nextern DiskResourcePtr<GfxEnvCubeDiskResource> global_env_cube1;\n\nextern float env_cube_cross_fade;\nextern unsigned env_cube_count;\nextern Ogre::Matrix4 shadow_view_proj[3];\n\n// Note: Must be cleaned up in gfx_shutdown.\nextern DiskResourcePtr<GfxTextureDiskResource> fade_dither_map;\nextern DiskResourcePtr<GfxTextureDiskResource> corona_map;\nextern DiskResourcePtr<GfxTextureDiskResource> shadow_pcf_noise_map;\n\nstatic inline bool stereoscopic (void)\n{ return gfx_option(GFX_CROSS_EYE) || gfx_option(GFX_ANAGLYPH); }\n\nextern bool use_hwgamma;\nextern GfxCallback *gfx_cb;\nextern bool shutting_down;\n\nextern Vector3 particle_ambient;\nextern Vector3 fog_colour;\nextern float fog_density;\nextern float env_brightness;\nextern float global_exposure;\nextern float global_saturation;\n\n// Note: Must be cleaned up in gfx_shutdown.\nextern DiskResourcePtr<GfxColourGradeLUTDiskResource> colour_grade_lut;\n\nextern Vector3 sun_direction;\nextern Vector3 sunlight_direction;\nextern Vector3 sun_colour;\nextern Vector3 sunlight_diffuse;\nextern Vector3 sunlight_specular;\nextern float sun_alpha;\nextern float sun_size;\nextern float sun_falloff_distance;\nextern float sky_glare_sun_distance;\nextern float sky_glare_horizon_elevation;\nextern float sky_divider[4];\nextern Vector3 sky_colour[6];\nextern Vector3 sky_sun_colour[5];\nextern float sky_alpha[6];\nextern float sky_sun_alpha[5];\nextern Vector3 sky_cloud_colour;\nextern float sky_cloud_coverage;\nextern Vector3 hell_colour;\n\n// ANIM_TIME_MAX is a number that can be divided cleanly by many other numbers.\n#define ANIM_TIME_MAX (2.0 * 3.0 * 5.0 * 7.0 * 11.0)\nextern float anim_time;\n\nstd::string freshname (const std::string &prefix);\nstd::string freshname (void);\n\nvoid clean_compositors (void);\nvoid do_reset_framebuffer (void);\nvoid do_reset_compositors (void);\n\nvoid gfx_material_add_dependencies (const std::string &name, DiskResource *into);\n\nvoid handle_dirty_materials (void);\n\n\nclass GfxShader;\n\ntypedef std::map<std::string,GfxShader*> GfxShaderDB;\n\nextern GfxShaderDB shader_db;\n\nextern GfxGslConfigEnvironment shader_scene_env;\n\n\ntemplate<class T> void try_set_named_constant_ (const Ogre::GpuProgramParametersSharedPtr &p,\n const std::string &name, const T &v, bool silent_fail)\n{\n p->setIgnoreMissingParams(silent_fail);\n try {\n p->setNamedConstant(name,v);\n } catch (const Ogre::Exception &e) {\n if (e.getNumber() == Ogre::Exception::ERR_INVALIDPARAMS) {\n CLOG << \"WARNING: \" << e.getDescription() << std::endl;\n } else {\n throw e;\n }\n }\n} \n \n/*\nstatic inline void try_set_named_constant (const Ogre::GpuProgramParametersSharedPtr &p,\n const std::string &name, const Ogre::ColourValue &v, bool silent_fail=false)\n{ try_set_named_constant_(p, name, v, silent_fail); }\n*/\n\nstatic inline void try_set_named_constant (const Ogre::GpuProgramParametersSharedPtr &p,\n const std::string &name, const Ogre::Matrix4 &v, bool silent_fail=false)\n{ try_set_named_constant_(p, name, v, silent_fail); }\n\nstatic inline void try_set_named_constant (const Ogre::GpuProgramParametersSharedPtr &p,\n const std::string &name, float v, bool silent_fail=false)\n{ try_set_named_constant_(p, name, v, silent_fail); }\n\n/*\nvoid try_set_named_constant (const Ogre::GpuProgramParametersSharedPtr &p,\n const std::string &name, const Ogre::Vector2 &v, bool silent_fail=false)\n{ try_set_named_constant_(p, name, v, silent_fail); }\n*/\n\nstatic inline void try_set_named_constant (const Ogre::GpuProgramParametersSharedPtr &p,\n const std::string &name, const Ogre::Vector3 &v, bool silent_fail=false)\n{ try_set_named_constant_(p, name, v, silent_fail); }\n\nstatic inline void try_set_named_constant (const Ogre::GpuProgramParametersSharedPtr &p,\n const std::string &name, const Ogre::Vector4 &v, bool silent_fail=false)\n{ try_set_named_constant_(p, name, v, silent_fail); }\n\ntemplate<class T> void try_set_named_constant (const Ogre::HighLevelGpuProgramPtr &p,\n const std::string &name, const T &v, bool silent_fail=false)\n{ try_set_named_constant(p->getDefaultParameters(), name, v, silent_fail); }\n \n#endif\n" }, { "alpha_fraction": 0.34813347458839417, "alphanum_fraction": 0.3515271544456482, "avg_line_length": 32.358489990234375, "blob_id": "244b709e9c51d75a4c521a61343857657d01ef32", "content_id": "c8b3fb3d12d4aec1eef51c053c65e251c9b86360", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 7072, "license_type": "permissive", "max_line_length": 97, "num_lines": 212, "path": "/gtasa/csvread.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "#include <iostream>\n#include <fstream>\n\n#include \"csvread.h\"\n#include \"ios_util.h\"\n\nvoid read_csv (std::istream &f, Csv &csv)\n{\n bool in_section = false;\n std::string section = \"nosection\";\n {\n CsvSection &s = csv[section];\n s.section_name = section;\n }\n\n std::vector<std::string> strs;\n\n size_t orig_line_counter = 0;\n size_t section_line_counter = 0;\n\n for (std::string str_ ; std::getline(f,str_) ; ) {\n\n orig_line_counter++;\n\n std::string::size_type b, e;\n\n e = str_.find('\\r');\n str_ = str_.substr(0,e);\n\n e = str_.find('\\n');\n str_ = str_.substr(0,e);\n\n e = str_.find(';');\n str_ = str_.substr(0,e);\n\n e = str_.find('#');\n str_ = str_.substr(0,e);\n\n e = str_.find(\"//\");\n str_ = str_.substr(0,e);\n\n if (str_[0] == '*') continue;\n\n b = str_.find_first_not_of(\"\\t \");\n e = str_.find_last_not_of(\"\\t \");\n if (b==str_.npos) continue;\n if (e==str_.npos) continue;\n str_ = str_.substr(b,e+1);\n\n std::string str;\n bool last_was_wspace = false;\n for (size_t i=0 ; i<str_.size() ; i++) {\n bool wspace = str_[i]==' ' || str_[i]=='\\t' || str_[i]==',';\n if (!wspace) {\n str += str_[i];\n } else if (!last_was_wspace) {\n str += \",\";\n }\n last_was_wspace = wspace;\n }\n\n if (str.size()==0) continue;\n\n if (!in_section && str.find(\",\")==str.npos) {\n section = str;\n in_section = true;\n section_line_counter = 0;\n if (csv.find(section)!=csv.end()) {\n GRIT_EXCEPT(\"Already seen section \\\"\"+section+\"\\\" in this file\");\n } else {\n CsvSection &s = csv[section];\n s.section_name = section;\n }\n } else {\n if (str==\"end\") {\n in_section = false;\n section = \"nosection\";\n } else {\n section_line_counter++;\n CsvSection &s = csv[section];\n CsvLine line;\n line.orig_line = orig_line_counter;\n line.section_line = section_line_counter;\n std::string val;\n for (size_t i=0 ; i<str.size() ; i++) {\n if (str[i]!=',') {\n val += str[i];\n } else {\n line.push_back(val);\n val = \"\";\n }\n }\n line.push_back(val);\n s.push_back(line);\n }\n }\n }\n if (in_section) {\n if (csv.filename != \"\") {\n GRIT_EXCEPT(\"CSV file did not close section \\\"\"+section+\"\\\" with 'end'\");\n } else {\n }\n GRIT_EXCEPT(\"CSV file \\\"\"+csv.filename+\"\\\" did not close section \\\"\"\n +section+\"\\\" with 'end'\");\n }\n}\n\n#ifdef _CSVREAD_EXEC\n\nvoid app_verbose(char const* file, int line, const std::string& msg)\n{\n std::cout<<BOLD<<GREEN<<\"VERBOSE \"<<RESET\n <<BOLD<<file<<NOBOLD<<\":\"<<BOLD<<line<<NOBOLD\n << \": \\\"\"<<BOLD<<BLUE<<msg<<RESET\"\\\"\";\n std::cout<<std::endl;\n}\n\nvoid app_error(char const* file, int line,\n const std::string& i_was, const std::string& msg)\n{\n std::cout<<BOLD RED\"ERROR \"<<RESET\n <<BOLD<<file<<NOBOLD<<\":\"<<BOLD<<line<<NOBOLD\n <<\": \\\"\"<<BOLD<<YELLOW<<msg<<RESET<<\"\\\"\";\n if (i_was!=\"\")\n std::cout<<\" (\"<<BOLD<<YELLOW<<i_was<<RESET<<\")\";\n std::cout<<std::endl;\n}\n\nvoid app_line(const std::string &msg)\n{\n std::cout<<BOLD<<msg<<NOBOLD<<std::endl;\n}\n\nvoid app_fatal()\n{\n abort();\n}\n\nvoid assert_triggered (void) { } \n\nint main(int argc, char *argv[])\n{\n if (argc!=2) {\n std::cerr<<\"Usage: \"<<argv[0]<<\" <csv file>\"<<std::endl;\n return EXIT_FAILURE;\n }\n\n try {\n\n std::ifstream csvfstream;\n std::istream *csvstream = &csvfstream;\n std::string filename;\n\n if (strcmp(argv[1],\"-\")==0) {\n csvstream = &std::cin;\n filename = \"<stdin>\";\n } else {\n filename = argv[1];\n csvfstream.open (filename.c_str());\n APP_ASSERT_IO_SUCCESSFUL(csvfstream,\n \"Opening csv: \"+filename);\n if (csvfstream.fail() || csvfstream.bad()) {\n std::stringstream ss;\n ss << filename << \": IO Error: \" << strerror(errno) << \"\\n\";\n GRIT_EXCEPT(ss.str());\n }\n }\n\n Csv csv;\n csv.filename = filename;\n read_csv(*csvstream,csv);\n\n for (Csv::iterator i=csv.begin(), i_=csv.end() ; i!=i_ ; ++i) {\n const std::string section = i->first;\n const CsvSection &lines = i->second;\n\n APP_ASSERT(section == i->second.section_name);\n\n if (section==\"nosection\" && lines.size()==0) continue;\n\n std::cout << section << std::endl;\n\n\n for (unsigned j=0 ; j<lines.size() ; ++j) {\n\n CsvLine line = lines[j];\n\n for (unsigned k=0 ; k<line.size() ; ++k) {\n const std::string &val = line[k];\n std::cout << (k>0?\",\":\"\") << val;\n }\n \n std::cout << std::endl;\n\n }\n\n std::cout << \"end\" << std::endl;\n }\n\n } catch (const Exception &e) {\n\n CERR << e << std::endl;\n return EXIT_FAILURE;\n\n }\n\n return EXIT_SUCCESS;\n}\n\n#endif\n\n// vim: shiftwidth=8:tabstop=8:expandtab\n" }, { "alpha_fraction": 0.6831656694412231, "alphanum_fraction": 0.6877977848052979, "avg_line_length": 25.60211181640625, "blob_id": "9e3934caa17659e0c6e3a6022f70b36bfe4d4d49", "content_id": "53ee3fc336b0b6094ce0b9af07ec3246fdb00c8b", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 7556, "license_type": "permissive", "max_line_length": 100, "num_lines": 284, "path": "/engine/gfx/gfx_text_body.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <centralised_log.h>\n\n#include \"gfx_internal.h\"\n\n#include \"gfx_text_body.h\"\n\nconst std::string GfxTextBody::className = \"GfxTextBody\";\n\n// {{{ Sub\n\nunsigned short GfxTextBody::Sub::getNumWorldTransforms(void) const\n{\n return 1;\n}\n\nvoid GfxTextBody::Sub::getWorldTransforms(Ogre::Matrix4 *xform) const\n{\n *xform = parent->toOgre();\n}\n\nOgre::Real GfxTextBody::Sub::getSquaredViewDepth (const Ogre::Camera *cam) const\n{\n Ogre::Vector3 diff = to_ogre(parent->worldTransform.pos) - cam->getDerivedPosition();\n return diff.squaredLength();\n}\n\nstatic Ogre::LightList EMPTY_LIGHTS;\n\nconst Ogre::LightList& GfxTextBody::Sub::getLights (void) const\n{\n return EMPTY_LIGHTS;\n}\n\nbool GfxTextBody::Sub::getCastShadows (void) const\n{\n return parent->getCastShadows();\n}\n\nconst Ogre::MaterialPtr& GfxTextBody::Sub::getMaterial(void) const\n{\n return parent->renderMaterial;\n}\n\n// }}}\n\n\n\n\n\n// {{{ RENDERING\n\nvoid GfxTextBody::_updateRenderQueue(Ogre::RenderQueue* queue)\n{\n bool shadow_cast =\n ogre_sm->_getCurrentRenderStage() == Ogre::SceneManager::IRS_RENDER_TO_TEXTURE;\n\n if (!enabled || fade < 0.000001) return;\n\n bool do_wireframe = gfx_option(GFX_WIREFRAME);\n bool do_regular = !do_wireframe || gfx_option(GFX_WIREFRAME_SOLID);\n\n // fade is used by both shadow_cast and regular pass\n // we could potentially move this out of the frame loop if it affects performance\n sub.setCustomParameter(0, Ogre::Vector4(fade,0,0,0));\n\n if (shadow_cast) {\n\n // Ogre chases ->getTechnique(0)->getShadowCasterMaterial() to get the actual one\n // which is material->castMat\n renderMaterial = material->regularMat;\n queue->addRenderable(&sub, 0, 0);\n renderMaterial.setNull();\n return;\n }\n\n if (do_regular) {\n // TODO: Warn if mesh does not have required vertex attributes for this material\n // taking into account dead code due to particular uniform values.\n // E.g. vertex colours, alpha, normals, tangents, extra tex coords.\n\n\n /* TODO(dcunnin): Pick a specific material by\n * Fading: false/true\n */\n\n renderMaterial = material->regularMat;\n\n int queue_group = RQ_GBUFFER_OPAQUE;\n switch (material->getSceneBlend()) {\n case GFX_MATERIAL_OPAQUE: queue_group = RQ_GBUFFER_OPAQUE; break;\n case GFX_MATERIAL_ALPHA: queue_group = RQ_FORWARD_ALPHA; break;\n case GFX_MATERIAL_ALPHA_DEPTH: queue_group = RQ_FORWARD_ALPHA_DEPTH; break;\n }\n queue->addRenderable(&sub, queue_group, 0);\n\n if (material->getAdditionalLighting() && emissiveEnabled) {\n renderMaterial = material->additionalMat;\n switch (material->getSceneBlend()) {\n case GFX_MATERIAL_OPAQUE: queue_group = RQ_FORWARD_OPAQUE_EMISSIVE; break;\n case GFX_MATERIAL_ALPHA: queue_group = RQ_FORWARD_ALPHA_EMISSIVE; break;\n case GFX_MATERIAL_ALPHA_DEPTH: queue_group = RQ_FORWARD_ALPHA_DEPTH_EMISSIVE; break;\n }\n queue->addRenderable(&sub, queue_group, 0);\n }\n }\n\n if (do_wireframe) {\n renderMaterial = material->wireframeMat;\n queue->addRenderable(&sub, RQ_FORWARD_ALPHA, 0);\n }\n\n renderMaterial.setNull();\n\n}\n\nvoid GfxTextBody::visitRenderables(Ogre::Renderable::Visitor* visitor, bool)\n{\n // Internally accesses renderMaterial.\n renderMaterial = material->regularMat;\n visitor->visit(&sub, 0, false);\n renderMaterial.setNull();\n}\n\n\nvoid GfxTextBody::recomputeBounds (void)\n{\n Vector2 dim = textBuffer.getDrawnDimensions();\n Vector3 min_bound(0, -dim.y, 0);\n Vector3 max_bound(dim.x, 0, 0);\n bounds = Ogre::AxisAlignedBox(to_ogre(min_bound), to_ogre(max_bound));\n}\n\nOgre::Real GfxTextBody::getBoundingRadius(void) const\n{\n return textBuffer.getDrawnDimensions().length();\n}\n\n// }}}\n\n\n\n\n\n\n\n\n\nGfxTextBodyPtr GfxTextBody::make (GfxFont *font, GfxMaterial *mat, const GfxNodePtr &par_)\n{\n return GfxTextBodyPtr(new GfxTextBody(font, mat, par_));\n}\n\nGfxTextBody::GfxTextBody (GfxFont *font, GfxMaterial *mat, const GfxNodePtr &par_)\n : GfxFertileNode(par_), sub(this), material(mat), emissiveEnabled(true),\n fade(1), textBuffer(font), enabled(true), castShadows(true)\n{\n node->attachObject(this);\n}\n\nGfxTextBody::~GfxTextBody (void)\n{\n if (!dead) destroy();\n}\n\nvoid GfxTextBody::destroy (void)\n{\n if (dead) THROW_DEAD(className);\n GfxFertileNode::destroy();\n}\n\nGfxMaterial *GfxTextBody::getMaterial (void) const\n{\n if (dead) THROW_DEAD(className);\n return material;\n}\n\nvoid GfxTextBody::setMaterial (GfxMaterial *m)\n{\n if (dead) THROW_DEAD(className);\n material = m;\n}\n\nbool GfxTextBody::getEmissiveEnabled (void) const\n{\n if (dead) THROW_DEAD(className);\n return emissiveEnabled;\n}\n\nvoid GfxTextBody::setEmissiveEnabled (bool v)\n{\n if (dead) THROW_DEAD(className);\n emissiveEnabled = v;\n}\n\nunsigned GfxTextBody::getBatches (void) const\n{\n if (dead) THROW_DEAD(className);\n return 1;\n}\n\nunsigned GfxTextBody::getBatchesWithChildren (void) const\n{\n if (dead) THROW_DEAD(className);\n return getBatches() + GfxFertileNode::getBatchesWithChildren();\n}\n\nunsigned GfxTextBody::getVertexes (void) const\n{\n if (dead) THROW_DEAD(className);\n return textBuffer.getVertexes();\n}\n\nunsigned GfxTextBody::getVertexesWithChildren (void) const\n{\n if (dead) THROW_DEAD(className);\n return getVertexes() + GfxFertileNode::getVertexesWithChildren();\n}\n\nunsigned GfxTextBody::getTriangles (void) const\n{\n if (dead) THROW_DEAD(className);\n return textBuffer.getTriangles();\n}\n\nunsigned GfxTextBody::getTrianglesWithChildren (void) const\n{\n if (dead) THROW_DEAD(className);\n return getTriangles() + GfxFertileNode::getTrianglesWithChildren();\n}\n\nfloat GfxTextBody::getFade (void) const\n{\n if (dead) THROW_DEAD(className);\n return fade;\n}\nvoid GfxTextBody::setFade (float f)\n{\n if (dead) THROW_DEAD(className);\n fade = f;\n}\n\nbool GfxTextBody::getCastShadows (void) const\n{\n if (dead) THROW_DEAD(className);\n return castShadows;\n}\nvoid GfxTextBody::setCastShadows (bool v)\n{\n if (dead) THROW_DEAD(className);\n castShadows = v;\n}\n\nbool GfxTextBody::isEnabled (void) const\n{\n if (dead) THROW_DEAD(className);\n return enabled;\n}\n\nvoid GfxTextBody::setEnabled (bool v)\n{\n if (dead) THROW_DEAD(className);\n enabled = v;\n}\n\n" }, { "alpha_fraction": 0.4797893762588501, "alphanum_fraction": 0.4810854494571686, "avg_line_length": 47.3725471496582, "blob_id": "f2cc66f52717584767eedb80c553ba63fd291663", "content_id": "5aa2114092b878c2d63576088747ef8ff2576968", "detected_licenses": [ "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer", "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 12345, "license_type": "permissive", "max_line_length": 117, "num_lines": 255, "path": "/dependencies/quex-0.34.1/quex/core_engine/generator/languages/core.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "# PURPOSE: Providing a database for code generation in different programming languages.\n# A central object 'db' contains for each keyword, such as '$if' '$else' a correspondent\n# keyword or sequence that corresponds to it in the given language. Some code\n# elements are slighly more complicated. Therefore the db returns for some keywords\n# a function that generates the correspondent code fragment.\n# \n# NOTE: The language of reference is C++. At the current state the python code generation \n# is only suited for unit test of state transitions, no state machine code generation.\n# Basics for other languages are in place (VisualBasic, Perl, ...) but no action has been\n# taken to seriously implement them.\n#\n# AUTHOR: Frank-Rene Schaefer\n# ABSOLUTELY NO WARRANTY\n#########################################################################################################\nfrom copy import copy\nimport quex.core_engine.generator.languages.cpp as cpp\nimport quex.core_engine.generator.languages.python as python\nfrom quex.frs_py.string_handling import blue_print\n\ndef __nice(SM_ID): \n return repr(SM_ID).replace(\"L\", \"\")\n \ndb = {}\n\n__label_db = \\\n{\n \"$terminal\": lambda TerminalIdx: \"TERMINAL_%s\" % __nice(TerminalIdx),\n \"$terminal-direct\": lambda TerminalIdx: \"TERMINAL_%s_DIRECT\" % __nice(TerminalIdx),\n \"$terminal-general\": lambda NoThing: \"TERMINAL_GENERAL_BACKWARD\",\n \"$terminal-EOF\": lambda NoThing: \"TERMINAL_END_OF_STREAM\",\n \"$terminal-DEFAULT\": lambda NoThing: \"TERMINAL_DEFAULT\",\n \"$entry\": lambda StateIdx: \"STATE_%s\" % __nice(StateIdx),\n \"$drop-out\": lambda StateIdx: \"STATE_%s_DROP_OUT\" % __nice(StateIdx),\n \"$drop-out-direct\": lambda StateIdx: \"STATE_%s_DROP_OUT_DIRECT\" % __nice(StateIdx),\n \"$input\": lambda StateIdx: \"STATE_%s_INPUT\" % __nice(StateIdx),\n \"$re-start\": lambda NoThing: \"__REENTRY_PREPARATION\",\n \"$start\": lambda NoThing: \"__REENTRY\",\n}\n\n__label_printed_list_unique = {}\n__label_used_list_unique = {}\ndef label_db_get(Type, Index, GotoTargetF=False):\n global __label_printed_list_unique\n global __label_used_list_unique\n global __label_db\n \n label = __label_db[Type](Index)\n\n if Type in [\"$re-start\", \"$start\"]: return label\n\n # Keep track of any label. Labels which are not used as goto targets\n # may be deleted later on.\n if GotoTargetF: __label_used_list_unique[label] = True\n else: __label_printed_list_unique[label] = True\n\n return label\n\ndef label_db_get_unused_label_list():\n global __label_target_unique\n global __label_printed_unique\n global __label_db\n \n result = []\n\n for label in __label_printed_list_unique:\n if label not in __label_used_list_unique:\n result.append(label)\n return result\n\n\n#________________________________________________________________________________\n# C++\n# \ndb[\"C++\"] = {\n \"$language\": \"C++\",\n \"$comment-delimiters\": [[\"/*\", \"*/\", \"\"], [\"//\", \"\\n\", \"\"], [\"\\\"\", \"\\\"\", \"\\\\\\\"\"]],\n \"$MODUL$\": cpp,\n \"$require-terminating-zero-preparation\": cpp.__require_terminating_zero_preparation,\n \"$function_def\": \"bool\\n$$function_name$$(const int input)\\n{\\n\", # still needed ?? fschaef 07y3m20d\n \"$function_end\": \"}\\n\", # still needed ??\n \"$if\": \"if(\",\n \"$then\": \") {\\n\",\n \"$elseif\": \"else if(\",\n \"$endif\": \"}\\n\",\n \"$endif-else\": \"} else {\\n\",\n \"$end-else\": \"}\\n\",\n \"$else\": \"else {\", \n \"$and\": \"&&\",\n \"$loop-start-endless\": \"while( 1 + 1 == 2 ) {\\n\",\n \"$loop-end\": \"}\\n\",\n \"$continue\": \"continue;\\n\",\n \"$break\": \"break;\\n\",\n \"$if not BLC\": \"if( input != QUEX_SETTING_BUFFER_LIMIT_CODE ) {\\n\",\n \"$if EOF\": \"if( QuexBuffer_is_end_of_file(&me->buffer) ) {\\n\",\n \"$if BOF\": \"if( QuexBuffer_is_begin_of_file(&me->buffer) ) {\\n\",\n \"$if pre-context\": lambda id: \"if( pre_context_%s_fulfilled_f ) {\\n\" % repr(id).replace(\"L\", \"\"),\n \"$elseif pre-context\": lambda id: \"else if( pre_context_%s_fulfilled_f ) {\\n\" % repr(id).replace(\"L\", \"\"),\n \"$if begin-of-line\": \"if( me->buffer._character_before_lexeme_start == '\\\\n' ) {\\n\",\n \"$elseif begin-of-line\": \"else if( me->begin_of_line_f ) {\\n\",\n \"$if <\": lambda value: \"if( input < \" + value + \") {\\n\",\n \"$if in-set\": cpp.__get_if_in_character_set,\n \"$if in-interval\": cpp.__get_if_in_interval,\n \"$if ==\": lambda value: \"if( input == \" + value + \") {\\n\",\n \"$if !=\": lambda value: \"if( input != \" + value + \") {\\n\",\n #\n \"$if >=\": lambda value: \"if( input >= \" + value + \") {\\n\",\n \"$<\": lambda left, right: left + \" < \" + right,\n \"$==\": lambda left, right: left + \" == \" + right,\n \"$!=\": lambda left, right: left + \" != \" + right,\n #\n \"$comment\": lambda txt: \"/* \" + txt + \" */\",\n \"$ml-comment\": lambda txt: \" /* \" + txt.replace(\"\\n\", \"\\n * \") + \"\\n */\",\n \"$/*\": \"//\",\n \"$*/\": \"\\n\",\n \"$*/\\n\": \"\\n\", # make sure, that we do not introduce an extra '\\n' in case that end of comment\n # # is followed directly by newline.\n \"$local-variable-defs\": cpp.__local_variable_definitions, \n \"$input\": \"input\",\n \"$mark-lexeme-start\": \"QuexBuffer_mark_lexeme_start(&me->buffer);\",\n \"$input/increment\": \"QuexBuffer_input_p_increment(&me->buffer);\",\n \"$input/add\": lambda Offset: \"QuexBuffer_input_p_add_offset(&me->buffer, %i);\" % Offset,\n \"$input/decrement\": \"QuexBuffer_input_p_decrement(&me->buffer);\",\n \"$input/get\": \"input = QuexBuffer_input_get(&me->buffer);\",\n \"$input/get-offset\": lambda Offset: \"input = QuexBuffer_input_get_offset(&me->buffer, %i);\" % Offset,\n \"$input/tell_position\": lambda PositionStr: \"%s = QuexBuffer_tell_memory_adr(&me->buffer);\\n\" % PositionStr,\n \"$input/seek_position\": lambda PositionStr: \"QuexBuffer_seek_memory_adr(&me->buffer, %s);\\n\" % PositionStr,\n \"$return\": \"return;\",\n \"$return_true\": \"return true;\",\n \"$return_false\": \"return false;\",\n \"$goto\": lambda Type, Argument=None: \"goto %s;\" % label_db_get(Type, Argument, GotoTargetF=True),\n \"$label-pure\": lambda Label: \"%s:\" % Label,\n \"$label-def\": lambda Type, Argument=None: \n \"%s:\\n\" % label_db_get(Type, Argument) + \\\n \" QUEX_DEBUG_PRINT(&me->buffer, \\\"LABEL: %s\\\");\\n\" % label_db_get(Type, Argument),\n \"$analyser-func\": cpp.__analyser_function,\n \"$terminal-code\": cpp.__terminal_states, \n \"$compile-option\": lambda option: \"#define %s\\n\" % option,\n \"$assignment\": lambda variable, value:\n \"QUEX_DEBUG_PRINT2(&me->buffer, \\\"%s = %%s\\\", \\\"%s\\\");\\n\" % (variable, value) + \\\n \"%s = %s;\\n\" % (variable, value),\n \"$set-last_acceptance\": lambda value:\n \"QUEX_DEBUG_PRINT2(&me->buffer, \\\"ACCEPTANCE: %%s\\\", \\\"%s\\\");\\n\" % value + \\\n \"QUEX_SET_last_acceptance(%s);\\n\" % value,\n \"$goto-last_acceptance\": \"QUEX_GOTO_last_acceptance();\\n\",\n #\n \"$header-definitions\": cpp.__header_definitions,\n \"$frame\": cpp.__frame_of_all,\n }\n\n#________________________________________________________________________________\n# C\n# \ndb[\"C\"] = copy(db[\"C++\"])\ndb[\"C\"][\"$/*\"] = \"/*\"\ndb[\"C\"][\"$*/\"] = \"*/\\n\"\ndb[\"C\"][\"$function_def\"] = \"const int\\n$$function_name$$(const int input)\\n{\\n\"\ndb[\"C\"][\"$return_true\"] = \"return 1;\"\ndb[\"C\"][\"$return_false\"] = \"return 0;\"\n\n#________________________________________________________________________________\n# Perl\n# \ndb[\"Perl\"] = copy(db[\"C\"])\ndb[\"Perl\"][\"$function_def\"] = \"sub $$function_name$$ {\\n input = shift\\n\"\n\n#________________________________________________________________________________\n# Python\n# \ndb[\"Python\"] = {\n \"$function_def\": \"def $$function_name$$(input):\\n\",\n \"$function_end\": \"\\n\", \n \"$if\": \"if \",\n \"$then\": \":\",\n \"$if EOF\": \"if True:\\n\",\n \"$if not BLC\": \"#if True:\\n\",\n \"$if <\": lambda value: \"if input < \" + value + \":\\n\",\n \"$if in-set\": python.__get_if_in_character_set,\n \"$if in-interval\": python.__get_if_in_interval,\n \"$if ==\": lambda value: \"if input == \" + value + \":\\n\",\n \"$if !=\": lambda value: \"if input != \" + value + \":\\n\",\n \"$if >=\": lambda value: \"if input >= \" + value + \":\\n\",\n \"$<\": lambda left, right: left + \" < \" + right,\n \"$==\": lambda left, right: left + \" == \" + right,\n \"$!=\": lambda left, right: left + \" != \" + right,\n \"$>=\": \">=\",\n \"$endif\": \"\", \n \"$else\": \"else:\", \n \"$endif-else\": \"else:\\n\",\n \"$end-else\": \"\",\n \"$and\": \"and\",\n \"$comment\": lambda txt: \"# \" + txt + \"\\n\",\n \"$/*\": \"#\",\n \"$*/\": \"\\n\", \n \"$*/\\n\": \"\\n\", # make sure, that we do not introduce an extra '\\n' in case that end of comment\n # # is followed directly by newline.\n \"$input\": \"input\",\n \"$input/get\": \"# TODO: getting input into parser\",\n \"$input/increment\": \"# TODO: getting input into parser\",\n \"$return_true\": \"return True\",\n \"$return_false\": \"return False\",\n \"$label-definition\": python.__label_definition,\n \"$goto-terminate\": python.__goto_terminal_state, \n \"$acceptance-info-fw\": lambda x, y: \"\",\n \"$acceptance-info-bw\": lambda x, y: \"\",\n \"$acceptance-info-bwfc\": lambda x, y: \"\",\n \"$label\": \"\", \n \"$include\": lambda include_file: \"#include <%s>\" % include_file,\n \"$debug-info-input\": \"\",\n \"$header-definitions\": \"\",\n \"$goto-last_acceptance\": \"# QUEX_GOTO_last_acceptance();\\n\",\n \"$drop-out\": \"# drop out\\n\",\n #\n \"$goto\": lambda Type, Argument=None: \"return %s;\" % Argument,\n \"$label-def\": lambda Type, Argument=None: \n \"#%s:\\n\" % label_db[Type](Argument) + \\\n \"# QUEX_DEBUG_LABEL_PASS(\\\"%s\\\");\\n\" % label_db[Type](Argument),\n \"$drop-out-forward\": lambda StateIndex: \n \"# QUEX_SET_drop_out_state_index(%i);\\n\" % int(StateIndex) + \\\n \"# goto __FORWARD_DROP_OUT_HANDLING;\\n\",\n \"$drop-out-backward\": lambda StateIndex: \n \"# QUEX_SET_drop_out_state_index(%i);\\n\" % int(StateIndex) + \\\n \"# goto __BACKWARD_DROP_OUT_HANDLING;\\n\",\n}\n\n#________________________________________________________________________________\n# Visual Basic 6\n# \ndb[\"VisualBasic6\"] = {\n \"$if\": \"If\",\n \"$then\": \"Then\",\n \"$endif\": \"End If\",\n \"$>=\": \">=\",\n \"$==\": lambda left, right: left + \" == \" + right,\n \"$!=\": lambda left, right: left + \" <> \" + right,\n \"$input\": \"input\",\n \"$return_true\": \"$the_function = True: Exit Function\",\n \"$return_false\": \"$the_function = True: Exit Function\",\n }\n\n\n\ndef replace_keywords(program_txt, LanguageDB, NoIndentF):\n \"\"\"Replaces pseudo-code keywords with keywords of the given language.\"\"\"\n\n txt = blue_print(program_txt, LanguageDB.items())\n\n if NoIndentF == False:\n # delete the last newline, to prevent additional indentation\n if txt[-1] == \"\\n\": txt = txt[:-1]\n # indent by four spaces\n # (if this happens in recursively called functions nested indented blocks\n # are correctly indented, see NumberSet::get_condition_code() for example) \n txt = txt.replace(\"\\n\", \"\\n \") + \"\\n\"\n \n return txt \n" }, { "alpha_fraction": 0.4756188988685608, "alphanum_fraction": 0.47861966490745544, "avg_line_length": 29.295454025268555, "blob_id": "7c8f9ef0c77cc71ab0f0c90245f037f77c1cda35", "content_id": "6a1b621104f41a5503e2ee91cc09a389eec6b21d", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 1333, "license_type": "permissive", "max_line_length": 102, "num_lines": 44, "path": "/dependencies/quex-0.34.1/demo/006/lexer.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "#include<fstream> \n#include<iostream> \n\n// (*) include lexical analyser header\n#include <./tiny_lexer>\n#include <./tiny_lexer-token_ids>\n\nusing namespace std;\n\nint \nmain(int argc, char** argv) \n{ \n // (*) create token\n quex::Token Token;\n // (*) create the lexical analyser\n // if no command line argument is specified user file 'example.txt'\n quex::tiny_lexer* qlex = new quex::tiny_lexer(argc == 1 ? \"example.txt\" : argv[1]);\n\n // (*) print the version \n // cout << qlex->version() << endl << endl;\n\n cout << \",------------------------------------------------------------------------------------\\n\";\n cout << \"| [START]\\n\";\n\n int number_of_tokens = 0;\n // (*) loop until the 'termination' token arrives\n do {\n // (*) get next token from the token stream\n qlex->get_token(&Token);\n\n // (*) print out token information\n // -- name of the token\n cout << Token.type_id_name() << \"\\t\" << Token.text().c_str() << endl;\n\n ++number_of_tokens;\n\n // (*) check against 'termination'\n } while( Token.type_id() != QUEX_TKN_TERMINATION );\n\n cout << \"| [END] number of token = \" << number_of_tokens << \"\\n\";\n cout << \"`------------------------------------------------------------------------------------\\n\";\n\n return 0;\n}\n" }, { "alpha_fraction": 0.5929591059684753, "alphanum_fraction": 0.5948620438575745, "avg_line_length": 49.49038314819336, "blob_id": "e700891092feeb36c5be8ec2ecf5d86c16d36492", "content_id": "3c1187cb7e066a7f2642f4d034434359bf29ed9b", "detected_licenses": [ "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer", "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 5255, "license_type": "permissive", "max_line_length": 108, "num_lines": 104, "path": "/dependencies/quex-0.34.1/quex/core_engine/state_machine/setup_border_conditions.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "from quex.core_engine.state_machine.core import StateMachine\nimport quex.core_engine.state_machine.setup_post_context as setup_post_context\nimport quex.core_engine.state_machine.nfa_to_dfa as nfa_to_dfa\n\ndef do(sm, BeginOfLineF, EndOfLineF, DOS_CarriageReturnNewlineF=False):\n \"\"\"DOS_CarriageReturnNewlineF == True: \n '$' is implemented as post-condition '\\r\\n'. This is required\n or lexical analysers on DOS and Windows machines.\n DOS_CarriageReturnNewlineF == False:\n '$' is implemented as post-condition '\\n' -- like the normal\n newline on Unix machines.\n \"\"\"\n # (1) end of line \n # NOTE: This must come before 'Begin of File', because there's a post condition\n # added, that enters new acceptance states.\n if EndOfLineF:\n if sm.core().post_context_id() == -1L:\n # -- create a state machine that represents the post-condition\n # -- mount it to the core pattern as a post-condition\n post_sm = StateMachine()\n if not DOS_CarriageReturnNewlineF:\n state_idx = post_sm.add_transition(post_sm.init_state_index, ord('\\n'), AcceptanceF=True)\n else:\n aux_idx = post_sm.add_transition(post_sm.init_state_index, ord('\\r'), AcceptanceF=False)\n state_idx = post_sm.add_transition(aux_idx, ord('\\n'), AcceptanceF=True)\n ## post_sm.add_transition(post_sm.init_state_index, EndOfFile_Code, state_idx, AcceptanceF=True)\n \n # post conditions add an epsilon transition that has to be solved \n # by translating state machine into a DFA\n sm = setup_post_context.do(sm, post_sm) \n sm = nfa_to_dfa.do(sm)\n assert sm.has_origins() == False\n \n else:\n post_context_id = sm.core().post_context_id()\n # end of line in two cases:\n # (1) next char is '\\n' (or \\r\\n in case of DOS_CarriageReturnNewlineF==True)\n # (2) at end of file, we supposed anyway that in this case the buffer needs to\n # end with 'EndOfFile_Code' just before the first letter.\n #\n # => mount 'newline or EndOfFile_Code' to the tail of pattern\n #\n new_state_idx = __add_line_border_at_end(sm, \n DOS_CarriageReturnNewlineF, InverseF=False)\n # -- the post-context flag needs to be raised\n sm.states[new_state_idx].core().set_post_context_id(post_context_id)\n\n # (2) begin of line\n if BeginOfLineF: \n # begin of line in two cases:\n # (1) last char was '\\n'\n # (2) the first character is not detected as begin of line, if the \n # pre-condition is non-trivial.\n #\n # A line begins always after '\\n' so no check for '\\r\\n' is necessary.\n # => DOS_CarriageReturnNewlineF = False\n if sm.core().pre_context_sm() != None:\n __add_line_border_at_end(sm.core().pre_context_sm(), \n DOS_CarriageReturnNewlineF=False, InverseF=True)\n else:\n # mark all acceptance states with the 'trivial pre-condition BOL' flag\n for state in sm.get_acceptance_state_list():\n state.core().set_pre_context_begin_of_line_f()\n sm.core().set_pre_context_begin_of_line_f()\n \n return sm\n\ndef __add_line_border_at_end(the_sm, DOS_CarriageReturnNewlineF, InverseF): \n \"\"\"Adds the condition 'newline or border character' at the end \n of the given state machine. Acceptance is only reached when \n the newline or border occurs. \n \n This function is used for begin of line or end of line pre-conditions, \n thus: IT DOES NOT SETUP A POST-CONDITITION in the sense\n that output is scanned but cursor is being reset after match!\n The caller provides the post-condition modifications itself, if needed.\n\n We simply append to each acceptance state the trigger\n '\\n' or BorderCharacter that leads to the new acceptance.\n The old acceptance state is annulated.\n \"\"\" \n old_acceptance_state_list = the_sm.get_acceptance_state_list() \n new_state_idx = the_sm.create_new_state(AcceptanceF=True)\n for state in old_acceptance_state_list:\n # (1) Transition '\\n' --> Acceptance\n state.add_transition(ord('\\n'), new_state_idx)\n \n if DOS_CarriageReturnNewlineF:\n # (3) Transition '\\r\\n' --> Acceptance\n aux_idx = the_sm.create_new_state(AcceptanceF=False)\n if not InverseF:\n state.add_transition(ord('\\r'), aux_idx)\n the_sm.states[aux_idx].add_transition(ord('\\n'), new_state_idx)\n else:\n state.add_transition(ord('\\n'), aux_idx)\n the_sm.states[aux_idx].add_transition(ord('\\r'), new_state_idx)\n\n # (-) Cancel acceptance of old state\n state.set_acceptance(False)\n state.core().set_store_input_position_f(False)\n state.core().set_post_context_id(-1L)\n state.core().set_pre_context_begin_of_line_f(False)\n #\n return new_state_idx \n" }, { "alpha_fraction": 0.5414289832115173, "alphanum_fraction": 0.5487639307975769, "avg_line_length": 53.93843460083008, "blob_id": "4e745921c5cc340975809c867f41ae18be68c994", "content_id": "8e2eabee4fbd38fb31a1e50341f322fad1b52d93", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 29448, "license_type": "permissive", "max_line_length": 139, "num_lines": 536, "path": "/dependencies/quex-0.34.1/quex/code_base/buffer/BufferFiller.i", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* -*- C++ -*- vim: set syntax=cpp: */\n#ifndef __INCLUDE_GUARD_QUEX__CODE_BASE__BUFFER__BUFFER_FILLER_I__\n#define __INCLUDE_GUARD_QUEX__CODE_BASE__BUFFER__BUFFER_FILLER_I__\n\n#include <quex/code_base/definitions>\n#include <quex/code_base/buffer/Buffer.i>\n#include <quex/code_base/buffer/Buffer_debug.i>\n#include <quex/code_base/buffer/BufferFiller>\n#include <quex/code_base/buffer/plain/BufferFiller_Plain>\n#ifdef QUEX_OPTION_ENABLE_ICONV\n# include <quex/code_base/buffer/iconv/BufferFiller_IConv>\n#endif\n#if ! defined(__QUEX_SETTING_PLAIN_C)\n# include <stdexcept>\nnamespace quex { \n#endif\n\n QUEX_INLINE void __QuexBufferFiller_on_overflow(QuexBuffer*, bool ForwardF);\n QUEX_INLINE size_t __QuexBufferFiller_forward_copy_fallback_region(QuexBuffer*,\n const size_t Distance_LexemeStart_to_InputP);\n QUEX_INLINE void __QuexBufferFiller_forward_adapt_pointers(QuexBuffer*, \n const size_t DesiredLoadN,\n const size_t LoadedN,\n const size_t FallBackN, \n const size_t Distance_LexemeStart_to_InputP);\n QUEX_INLINE size_t __QuexBufferFiller_backward_copy_backup_region(QuexBuffer*);\n QUEX_INLINE void __QuexBufferFiller_backward_adapt_pointers(QuexBuffer*, \n const size_t BackwardDistance);\n\n# ifndef __QUEX_SETTING_PLAIN_C\n /* NOTE: The filler types carry only pointers to input handles. So, the \n * required memory size is the same for any type. Let us use std::istream*\n * to feed the sizeof()-operator. */\n# define BUFFER_FILLER_PLAIN QuexBufferFiller_Plain<std::istream>\n# define BUFFER_FILLER_ICONV QuexBufferFiller_IConv<std::istream>\n# else\n# define BUFFER_FILLER_PLAIN QuexBufferFiller_Plain\n# define BUFFER_FILLER_ICONV QuexBufferFiller_IConv\n# endif\n QUEX_INLINE size_t\n QuexBufferFiller_get_memory_size(QuexBufferFillerTypeEnum FillerType)\n {\n switch( FillerType ) {\n default: QUEX_ERROR_EXIT(\"No memory size for QUEX_AUTO.\\n\");\n case QUEX_PLAIN: return sizeof(BUFFER_FILLER_PLAIN);\n case QUEX_ICONV: \n# ifdef QUEX_OPTION_ENABLE_ICONV\n return sizeof(BUFFER_FILLER_ICONV);\n# else\n QUEX_ERROR_EXIT(\"Use of buffer filler type 'QUEX_ICONV' while option 'QUEX_OPTION_ENABLE_ICONV'\\n\" \\\n \"is not specified. If defined, then the iconv-library must be installed on your system!\\n\");\n return -1;\n# endif\n }\n }\n# undef BUFFER_FILLER_PLAIN \n# undef BUFFER_FILLER_ICONV \n\n QUEX_INLINE void \n QuexBufferFiller_destroy(QuexBufferFiller* me)\n { \n /* if no dedicated deallocator is specified then free only the basic\n * BufferFiller structure. */\n if( me->_destroy == 0x0 ) __QUEX_FREE_MEMORY(me);\n else me->_destroy(me);\n }\n\n QUEX_INLINE void\n __QuexBufferFiller_init_functions(QuexBufferFiller* me,\n size_t (*tell_character_index)(QuexBufferFiller*),\n void (*seek_character_index)(QuexBufferFiller*, const size_t),\n size_t (*read_characters)(QuexBufferFiller*,\n QUEX_CHARACTER_TYPE* buffer, const size_t),\n void (*destroy)(QuexBufferFiller*))\n {\n __quex_assert(me != 0x0);\n __quex_assert(tell_character_index != 0x0);\n __quex_assert(seek_character_index != 0x0);\n __quex_assert(read_characters != 0x0);\n\n me->tell_character_index = tell_character_index;\n me->seek_character_index = seek_character_index;\n me->read_characters = read_characters;\n me->_on_overflow = 0x0;\n me->_destroy = destroy;\n }\n\n QUEX_INLINE void\n QuexBufferFiller_initial_load(QuexBuffer* buffer)\n {\n const size_t ContentSize = QuexBuffer_content_size(buffer);\n QUEX_CHARACTER_TYPE* ContentFront = QuexBuffer_content_front(buffer);\n\n /* Assume: Buffer initialization happens independently */\n __quex_assert(buffer->_content_first_character_index == 0);\n __quex_assert(buffer->_input_p == ContentFront); \n __quex_assert(buffer->_lexeme_start_p == ContentFront);\n\n const size_t LoadedN = buffer->filler->read_characters(buffer->filler, ContentFront, ContentSize);\n\n /* If end of file has been reached, then the 'end of file' pointer needs to be set*/\n if( LoadedN != ContentSize ) QuexBuffer_end_of_file_set(buffer, ContentFront + LoadedN);\n else QuexBuffer_end_of_file_unset(buffer);\n\n QUEX_BUFFER_ASSERT_CONTENT_CONSISTENCY(buffer);\n } \n\n QUEX_INLINE size_t\n QuexBufferFiller_load_forward(QuexBuffer* buffer)\n {\n /* PURPOSE: This function is to be called as a reaction to a buffer limit code 'BLC'\n * as returned by 'get_forward()'. Its task is to load new content into the \n * buffer such that 'get_forward() can continue iterating. This means that the \n * '_input_p' points to one of the following positions:\n *\n * (1) Beginning of the Buffer: In this case, no reload needs to take place.\n * It can basically only appear if 'load_forward()' is called after\n * 'get_backward()'---and this does not make sense. But returning a '0'\n * (which is >= 0 and indicates that everything is ok) tells the application \n * that nothing has been loaded, and the next 'get_forward()' will work \n * normally.\n *\n * (2) End of File Pointer: (which may be equal to the end of the buffer) \n * In this case no further content can be loaded. The function returns '0'.\n *\n * (3) End of Buffer (if it is != End of File Pointer): Here a 'normal' load of\n * new data into the buffer can happen.\n *\n * RETURNS: '>= 0' number of characters that were loaded forward in the stream.\n * '-1' if forward loading was not possible (end of file) */\n /* \n * NOTE: There is a seemingly dangerous case where the loading **just** fills the buffer to \n * the limit. In this case no 'End Of File' is detected, no end of file pointer is set,\n * and as a consequence a new loading will happen later. This new loading, though,\n * will only copy the fallback-region. The 'LoadedN == 0' will cause the _end_of_file_p\n * to be set to the end of the copied fallback-region. And everything is fine.\n */\n QuexBufferFiller* me = buffer->filler;\n if( me == 0x0 ) return 0; /* This case it totally rational, if no filler has been specified */\n\n __quex_assert(buffer != 0x0);\n __quex_assert(me->tell_character_index != 0x0);\n __quex_assert(me->seek_character_index != 0x0);\n __quex_assert(me->read_characters != 0x0);\n size_t ContentSize = QuexBuffer_content_size(buffer);\n\n /* Catch impossible scenario: If the stretch from _input_p to _lexeme_start_p \n * spans the whole buffer content, then nothing can be loaded into it. */\n const size_t Distance_LexemeStart_to_InputP = buffer->_input_p - buffer->_lexeme_start_p;\n if( Distance_LexemeStart_to_InputP >= ContentSize ) { \n __QuexBufferFiller_on_overflow(buffer, /* Forward */ true);\n return 0;\n }\n QUEX_DEBUG_PRINT_BUFFER_LOAD(buffer, \"FORWARD(entry)\");\n\n /* (*) Check for the three possibilities mentioned above */\n if ( buffer->_input_p == buffer->_memory._front ) { return 0; } /* (1)*/\n else if( buffer->_input_p == buffer->_end_of_file_p ) { return 0; } /* (2)*/\n else if( buffer->_input_p != buffer->_memory._back ) { \n QUEX_ERROR_EXIT(\"Call to 'load_forward() but '_input_p' not on buffer border.\\n\" \n \"(Check character encoding)\"); \n }\n else if( buffer->_end_of_file_p != 0x0 ) { \n /* End of file has been reached before, we cannot load more. */\n return 0; \n }\n /* HERE: _input_p ---> LAST ELEMENT OF THE BUFFER! * (3)*/ \n\n /*___________________________________________________________________________________*/\n /* (1) Handle fallback region*/\n const size_t FallBackN = __QuexBufferFiller_forward_copy_fallback_region(buffer, \n Distance_LexemeStart_to_InputP);\n __quex_assert(FallBackN < ContentSize);\n /*___________________________________________________________________________________*/\n /* (2) Load new content*/\n /* NOTE: Due to backward loading the character index might not stand on the end of\n * the buffer. Thus a seek is necessary. */\n const size_t CharacterIndexAtEnd = (size_t)(buffer->_content_first_character_index + \n (QuexBuffer_content_size(buffer)));\n me->seek_character_index(me, CharacterIndexAtEnd);\n\n const size_t DesiredLoadN = ContentSize - FallBackN;\n QUEX_CHARACTER_TYPE* new_content_begin = buffer->_memory._front + 1 + FallBackN;\n const size_t LoadedN = me->read_characters(me, new_content_begin, DesiredLoadN);\n\n /*___________________________________________________________________________________*/\n /* (3) Adapt the pointers in the buffer*/\n __QuexBufferFiller_forward_adapt_pointers(buffer, \n DesiredLoadN, LoadedN, FallBackN, \n Distance_LexemeStart_to_InputP);\n\n QUEX_DEBUG_PRINT_BUFFER_LOAD(buffer, \"LOAD FORWARD(exit)\");\n /* NOTE: During backward loading the rule does not hold that the stream position\n * corresponds to the last character in the buffer. The last character in the\n * buffer might be a copy from the front of the buffer. Thus, this constraint\n * only holds **after the forwad load**. */\n# ifdef QUEX_OPTION_ASSERTS\n const size_t ComputedCharacterIndexAtEnd = (size_t)(buffer->_content_first_character_index + \n (QuexBuffer_text_end(buffer) - QuexBuffer_content_front(buffer)));\n const size_t RealCharacterIndexAtEnd = buffer->filler->tell_character_index(buffer->filler);\n __quex_assert( ComputedCharacterIndexAtEnd == RealCharacterIndexAtEnd );\n# endif\n QUEX_BUFFER_ASSERT_CONSISTENCY(buffer);\n QUEX_BUFFER_ASSERT_CONTENT_CONSISTENCY(buffer);\n\n /* NOTE: Return value is used for adaptions of memory addresses. It happens that the*/\n /* address offset is equal to DesiredLoadN; see function __forward_adapt_pointers().*/\n return DesiredLoadN; /* THUS NOT: LoadedN*/\n }\n\n QUEX_INLINE size_t\n __QuexBufferFiller_forward_copy_fallback_region(QuexBuffer* buffer,\n const size_t Distance_LexemeStart_to_InputP)\n {\n /* (1) Fallback: A certain region of the current buffer is copied in front such that\n * if necessary the stream can go backwards without a backward load.\n *\n * fallback_n\n * :\n * |11111111111111:22222222222222222222222222222222222222|\n * copy of : new loaded content of buffer\n * end of old \n * buffer \n *\n * The fallback region is related to the lexeme start pointer. The lexeme start \n * pointer always needs to lie inside the buffer, because applications might read\n * their characters from it. The 'stretch' [lexeme start, current_p] must be \n * contained in the new buffer (precisely in the fallback region). */\n QUEX_BUFFER_ASSERT_CONSISTENCY(buffer);\n __quex_assert((int)Distance_LexemeStart_to_InputP == buffer->_input_p - buffer->_lexeme_start_p);\n __quex_assert(Distance_LexemeStart_to_InputP < QuexBuffer_content_size(buffer));\n /* Copying forward shall **only** happen when new content is to be loaded. This is not the case\n * if EOF as reached and the _end_of_file_p lies inside the buffer. Thus the _input_p\n * must have reached the upper border of the buffer. */\n __quex_assert(buffer->_input_p == buffer->_memory._back);\n\n /* (*) Fallback region = max(default size, necessary size)*/\n const size_t FallBackN = QUEX_SETTING_BUFFER_MIN_FALLBACK_N > Distance_LexemeStart_to_InputP \n ? QUEX_SETTING_BUFFER_MIN_FALLBACK_N \n : Distance_LexemeStart_to_InputP;\n\n /* (*) Copy fallback region*/\n /* If there is no 'overlap' from source and drain than the faster memcpy() can */\n /* used instead of memmove().*/\n QUEX_CHARACTER_TYPE* source = QuexBuffer_content_back(buffer) - FallBackN + 1; /* end of content - fallback*/\n QUEX_CHARACTER_TYPE* drain = QuexBuffer_content_front(buffer); \n /* Cast to uint8_t to avoid that some smart guy provides a C++ overloading function */\n if( drain + FallBackN >= source ) {\n __QUEX_STD_memmove((uint8_t*)drain, (uint8_t*)source, FallBackN * sizeof(QUEX_CHARACTER_TYPE));\n } else { \n __QUEX_STD_memcpy((uint8_t*)drain, (uint8_t*)source, FallBackN * sizeof(QUEX_CHARACTER_TYPE));\n }\n\n# ifdef QUEX_OPTION_ASSERTS\n /* Cast to uint8_t to avoid that some smart guy provides a C++ overloading function */\n __QUEX_STD_memset((uint8_t*)(drain + FallBackN), (uint8_t)(0xFF), \n (QuexBuffer_content_size(buffer) - FallBackN)*sizeof(QUEX_CHARACTER_TYPE)); \n# endif\n\n __quex_assert(FallBackN < QuexBuffer_content_size(buffer));\n return FallBackN;\n }\n\n QUEX_INLINE void\n __QuexBufferFiller_forward_adapt_pointers(QuexBuffer* buffer, \n const size_t DesiredLoadN,\n const size_t LoadedN,\n const size_t FallBackN, \n const size_t Distance_LexemeStart_to_InputP)\n {\n const size_t ContentSize = QuexBuffer_content_size(buffer);\n QUEX_CHARACTER_TYPE* ContentFront = QuexBuffer_content_front(buffer);\n\n __quex_assert( buffer->_end_of_file_p == 0x0 || LoadedN + FallBackN == ContentSize );\n __quex_assert( DesiredLoadN != 0 );\n\n /* (*) If end of file has been reached, then the 'end of file' pointer needs to be set*/\n if( LoadedN != DesiredLoadN ) \n QuexBuffer_end_of_file_set(buffer, ContentFront + FallBackN + LoadedN);\n else\n QuexBuffer_end_of_file_unset(buffer);\n\n\n /* (*) Character index of the first character in the content of the buffer \n * increases by content size - fallback indenpendently how many bytes \n * have actually been loaded. */\n buffer->_content_first_character_index += ContentSize - FallBackN;\n\n /*___________________________________________________________________________________*/\n /* (*) Pointer adaption*/\n /* Next char to be read: '_input_p + 1'*/\n buffer->_input_p = ContentFront + FallBackN - 1; \n /* NOTE: _input_p is set to (_input_p - 1) so that the next *(++_input_p) */\n /* reads the _input_p.*/\n buffer->_lexeme_start_p = (buffer->_input_p + 1) - Distance_LexemeStart_to_InputP; \n\n __quex_assert( buffer->_end_of_file_p == 0x0 || (int)(LoadedN + FallBackN) == buffer->_end_of_file_p - buffer->_memory._front - 1);\n\n }\n\n\n QUEX_INLINE size_t \n QuexBufferFiller_load_backward(QuexBuffer* buffer)\n {\n QuexBufferFiller* me = buffer->filler;\n QUEX_BUFFER_ASSERT_CONSISTENCY(buffer);\n\n if( me == 0x0 ) return 0; /* This case it totally rational, if no filler has been specified */\n\n /* PURPOSE: This function is to be called as a reaction to a buffer limit code 'BLC'\n * as returned by 'get_backward()'. Its task is the same as the one of \n * 'load_forward()'--only in opposite direction. Here only two cases need \n * to be distinguished. The current_p points to \n *\n * (1) End of Buffer or End of File pointer: No backward load needs to \n * happen. This can only occur if a 'get_forward()' was called right\n * before.\n *\n * (2) Begin of the buffer and the buffer is the 'start buffer':\n * in this case no backward load can happen, because we are at the \n * beginning. The function returns 0.\n *\n * (3) Begin of buffer and _begin_of_file_f is not set!: This is the case\n * where this function, actually, has some work to do. It loads the\n * buffer with 'earlier' content from the file.\n *\n *\n * RETURNS: Distance that was loaded backwards.\n * -1 in case of backward loading is not possible (begin of file)\n * \n * COMMENT: \n * \n * For normal cases the fallback region, i.e. the 'FALLBACK_N' buffer bytes \n * allows to go a certain distance backwards immediately. If still the begin \n * of the buffer is reached, then this is an indication that something is\n * 'off-the-norm'. Lexical analysis is not supposed to go longtimes\n * backwards. For such cases we step a long stretch backwards: A\n * THIRD of the buffer's size! \n *\n * A meaningful fallback_n would be 64 Bytes. If the buffer's size\n * is for example 512 kB then the backwards_distance of A THIRD means 170\n * kB. This leaves a safety region which is about 2730 times\n * greater than normal (64 Bytes). After all, lexical analysis means\n * to go **mainly forward** and not backwards. */\n __quex_assert(buffer != 0x0);\n QUEX_CHARACTER_TYPE* ContentFront = QuexBuffer_content_front(buffer);\n QUEX_CHARACTER_TYPE* ContentBack = QuexBuffer_content_back(buffer);\n\n QUEX_DEBUG_PRINT_BUFFER_LOAD(buffer, \"BACKWARD(entry)\");\n QUEX_BUFFER_ASSERT_CONSISTENCY(buffer);\n\n /* (*) Check for the three possibilities mentioned above*/\n if ( buffer->_input_p == buffer->_memory._back ) { return 0; } /* (1) */\n else if( buffer->_input_p == buffer->_end_of_file_p ) { return 0; } /* (1) */\n else if( buffer->_input_p != buffer->_memory._front ) {\n QUEX_ERROR_EXIT(\"Call to 'load_backward() but '_input_p' not on buffer border.\\n\" \n \"(Check character encoding)\"); \n }\n else if( buffer->_content_first_character_index == 0 ) { return 0; } /* (2) */\n /* * (3) */\n /* HERE: current_p == FRONT OF THE BUFFER! \n *_______________________________________________________________________________*/\n /* Catch impossible scenario: If the stretch from _input_p to _lexeme_start_p \n * spans the whole buffer content, then nothing can be loaded into it. */\n if( buffer->_lexeme_start_p == ContentBack ) { \n __QuexBufferFiller_on_overflow(buffer, /* ForwardF */ false);\n return 0;\n }\n /* (1) Compute distance to go backwards*/\n const size_t BackwardDistance = __QuexBufferFiller_backward_copy_backup_region(buffer);\n if( BackwardDistance == 0 ) return 0;\n\n /*_______________________________________________________________________________\n * (2) Compute the stream position of the 'start to read' \n * \n * It is not safe to assume that the character size is fixed. Thus it is up to \n * the input strategy to determine the input position that belongs to a character \n * position. */\n __quex_assert( buffer->_content_first_character_index >= BackwardDistance );\n const size_t NewContentFirstCharacterIndex = buffer->_content_first_character_index - BackwardDistance;\n\n /*_______________________________________________________________________________\n * (3) Load content*/\n me->seek_character_index(me, NewContentFirstCharacterIndex);\n# ifdef QUEX_OPTION_ASSERTS\n const size_t LoadedN = /* avoid unused variable in case '__quex_assert()' is deactivated*/\n# endif\n /* -- If file content < buffer size, then the start position of the stream to which \n * the buffer refers is always 0 and no backward loading will ever happen. \n * -- If the file content >= buffer size, then backward loading must always fill \n * the buffer. */\n me->read_characters(me, ContentFront, BackwardDistance);\n\n __quex_assert(LoadedN == (size_t)BackwardDistance);\n\n /*________________________________________________________________________________\n * (4) Adapt pointers*/\n __QuexBufferFiller_backward_adapt_pointers(buffer, BackwardDistance);\n\n QUEX_DEBUG_PRINT_BUFFER_LOAD(buffer, \"BACKWARD(exit)\");\n QUEX_BUFFER_ASSERT_CONSISTENCY(buffer);\n QUEX_BUFFER_ASSERT_CONTENT_CONSISTENCY(buffer);\n\n return BackwardDistance;\n }\n\n\n QUEX_INLINE size_t\n __QuexBufferFiller_backward_copy_backup_region(QuexBuffer* buffer)\n {\n const size_t ContentSize = QuexBuffer_content_size(buffer);\n QUEX_CHARACTER_TYPE* ContentFront = QuexBuffer_content_front(buffer);\n\n QUEX_BUFFER_ASSERT_CONSISTENCY(buffer);\n /* Copying backward shall **only** happen when new content is to be loaded. In back\n * ward direction, this makes only sense if the lower border was reached. */\n __quex_assert(buffer->_input_p == buffer->_memory._front);\n /* We need to make sure, that the lexeme start pointer remains inside the\n * buffer, so that we do not loose the reference. From current_p == buffer begin\n * it is safe to say that _lexeme_start_p > _input_p (the lexeme starts\n * on a letter not the buffer limit). */\n __quex_assert(buffer->_lexeme_start_p > buffer->_input_p);\n __quex_assert((size_t)(buffer->_lexeme_start_p - buffer->_input_p) < QuexBuffer_content_size(buffer));\n\n const size_t IntendedBackwardDistance = (size_t)(ContentSize / 3); \n\n /* Limit 1:\n *\n * Before: |C L |\n *\n * After: | C L |\n * ------->\n * backward distance\n *\n * Lexeme start pointer L shall lie inside the buffer. Thus, it is required:\n *\n * backward distance + (C - L) < size\n * => backward distance < size - (C - L)\n * */\n /* (result is possitive, see __quex_assert(...) above) */\n const size_t Distance_InputP_to_LexemeStart = (size_t)(buffer->_lexeme_start_p - buffer->_input_p);\n const int LimitBackwardDist_1 = ContentSize - Distance_InputP_to_LexemeStart; \n\n /* Limit 2:\n * We cannot go before the first character in the stream. */\n const int LimitBackwardDist_2 = (int)buffer->_content_first_character_index;\n\n /* Taking the minimum of all:*/\n const size_t Limit_1_and_2 = LimitBackwardDist_1 < LimitBackwardDist_2 ? LimitBackwardDist_1\n : LimitBackwardDist_2;\n const size_t BackwardDistance = IntendedBackwardDistance < Limit_1_and_2 ? IntendedBackwardDistance \n : Limit_1_and_2;\n\n /* (*) copy content that is already there to its new position.\n * (copying is much faster then loading new content from file). */\n __QUEX_STD_memmove(ContentFront + BackwardDistance, ContentFront, \n (ContentSize - BackwardDistance)*sizeof(QUEX_CHARACTER_TYPE));\n\n# ifdef QUEX_OPTION_ASSERTS\n /* Cast to uint8_t to avoid that some smart guy provides a C++ overloading function */\n __QUEX_STD_memset((uint8_t*)ContentFront, (uint8_t)(0xFF), BackwardDistance * sizeof(QUEX_CHARACTER_TYPE)); \n# endif\n return BackwardDistance;\n }\n\n QUEX_INLINE void\n __QuexBufferFiller_backward_adapt_pointers(QuexBuffer* buffer, const size_t BackwardDistance)\n {\n /* -- end of file / end of buffer:*/\n if( buffer->_end_of_file_p ) {\n QUEX_CHARACTER_TYPE* NewEndOfFileP = buffer->_end_of_file_p + BackwardDistance;\n if( NewEndOfFileP <= buffer->_memory._back ) \n QuexBuffer_end_of_file_set(buffer, NewEndOfFileP);\n else \n QuexBuffer_end_of_file_unset(buffer);\n }\n /* -- character index of begin of buffer = where we started reading new content*/\n buffer->_content_first_character_index -= BackwardDistance;\n\n buffer->_input_p += BackwardDistance + 1; \n buffer->_lexeme_start_p += BackwardDistance;\n }\n\n QUEX_INLINE void\n __QuexBufferFiller_on_overflow(QuexBuffer* buffer, bool ForwardF)\n {\n QuexBufferFiller* me = buffer->filler;\n\n if( me->_on_overflow == 0x0\n || me->_on_overflow(buffer, ForwardF) == false ) {\n\n# ifdef QUEX_OPTION_INFORMATIVE_BUFFER_OVERFLOW_MESSAGE\n /* Print out the lexeme start, so that the user has a hint. */\n uint8_t utf8_encoded_str[512]; \n static char message[1024];\n const size_t MessageSize = 1024;\n uint8_t* WEnd = utf8_encoded_str + 512 - 7;\n uint8_t* witerator = utf8_encoded_str; \n QUEX_CHARACTER_TYPE* End = buffer->_memory._back; \n QUEX_CHARACTER_TYPE* iterator = buffer->_lexeme_start_p; \n int utf8_length = 0;\n \n for(; witerator < WEnd && iterator != End ; ++iterator) {\n utf8_length = Quex_unicode_to_utf8(*iterator, witerator);\n if( utf8_length < 0 || utf8_length > 6) continue;\n witerator += utf8_length;\n *witerator = '\\0';\n }\n message[0] = '\\0';\n /* No use of 'snprintf()' because not all systems seem to support it propperly. */\n __QUEX_STD_strncat(message, \n \"Distance between lexeme start and current pointer exceeds buffer size.\\n\"\n \"(tried to load buffer\",\n MessageSize);\n __QUEX_STD_strncat(message, ForwardF ? \"forward)\" : \"backward)\", MessageSize);\n __QUEX_STD_strncat(message, \"As a hint consider the beginning of the lexeme:\\n[[\", MessageSize);\n __QUEX_STD_strncat(message, (char*)utf8_encoded_str, MessageSize);\n __QUEX_STD_strncat(message, \"]]\\n\", MessageSize);\n\n QUEX_ERROR_EXIT(message);\n# else\n QUEX_ERROR_EXIT(\"Distance between lexeme start and current pointer exceeds buffer size.\\n\"\n \"(tried to load buffer forward). Please, compile with option\\n\\n\"\n \" QUEX_OPTION_INFORMATIVE_BUFFER_OVERFLOW_MESSAGE\\n\\n\"\n \"in order to get a more informative output. Most likely, one of your patterns\\n\"\n \"eats longer as you inteded it. Alternatively you might want to set the buffer\\n\"\n \"size to a greate value or use skippers (<skip: [ \\n\\t]> for example.\");\n# endif /* QUEX_OPTION_INFORMATIVE_BUFFER_OVERFLOW_MESSAGE */\n }\n }\n\n#if ! defined(__QUEX_SETTING_PLAIN_C)\n} // namespace quex\n#endif\n\n#endif /* __INCLUDE_GUARD_QUEX__CODE_BASE__BUFFER__BUFFER_FILLER_I__ */\n\n" }, { "alpha_fraction": 0.6754167675971985, "alphanum_fraction": 0.6775244474411011, "avg_line_length": 35.75, "blob_id": "ca21178cf1b272707a9d2e68cd0a9e5fdc77ecb8", "content_id": "b22e561d50ad40ccdae1100cfc45ecd9ecfcc0f0", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 10438, "license_type": "permissive", "max_line_length": 100, "num_lines": 284, "path": "/engine/gfx/gfx_material.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <set>\n\n#include \"gfx_internal.h\"\n#include \"gfx_material.h\"\n#include \"gfx_body.h\"\n#include \"gfx_shader.h\"\n\n// Global lock, see header for documentation.\nstd::recursive_mutex gfx_material_lock;\n\n\nGfxBaseMaterial::GfxBaseMaterial(const std::string name, GfxShader *shader)\n : shader(shader),\n bindings(),\n name(name)\n{ }\n\nvoid GfxBaseMaterial::addDependencies (DiskResource *into) const\n{ \n GFX_MAT_SYNC;\n for (const auto &i : textures) {\n into->addDependency(i.second.texture);\n }\n}\n\nvoid GfxBaseMaterial::setShader (GfxShader *v)\n{\n GFX_MAT_SYNC;\n shader = v;\n bindings.clear();\n textures.clear();\n}\n\nGfxMaterial::GfxMaterial (const std::string &name)\n : GfxBaseMaterial(name, gfx_shader_get(\"/system/Default\")),\n sceneBlend(GFX_MATERIAL_OPAQUE),\n backfaces(false),\n castShadows(true),\n additionalLighting(false),\n boneBlendWeights(0),\n shadowAlphaReject(false),\n shadowBias(0.15)\n{\n}\n\nvoid GfxMaterial::setSceneBlend (GfxMaterialSceneBlend v)\n{\n sceneBlend = v;\n}\n\nvoid GfxMaterial::setBackfaces (bool v)\n{\n backfaces = v;\n}\n\nvoid GfxMaterial::setShadowBias (float v)\n{ \n shadowBias = v;\n} \n \nvoid GfxMaterial::setCastShadows (bool v)\n{ \n castShadows = v;\n} \n \nvoid GfxMaterial::setAdditionalLighting (bool v)\n{ \n additionalLighting = v;\n} \n \nvoid GfxMaterial::setBoneBlendWeights (unsigned v)\n{\n boneBlendWeights = v;\n}\n\nvoid GfxMaterial::setShadowAlphaReject (bool v)\n{ \n shadowAlphaReject = v;\n} \n \n\nstatic Ogre::Pass *create_or_reset_material (const std::string &name)\n{\n auto &mm = Ogre::MaterialManager::getSingleton();\n Ogre::MaterialPtr m = mm.createOrRetrieve(name, RESGRP).first.staticCast<Ogre::Material>();\n m->setTransparencyCastsShadows(true);\n m->removeAllTechniques();\n Ogre::Technique *t = m->createTechnique();\n return t->createPass();\n}\n\nvoid GfxMaterial::buildOgreMaterials (void)\n{\n bool fade_dither = sceneBlend == GFX_MATERIAL_OPAQUE;\n Ogre::Pass *p;\n\n shader->populateMatEnv(fade_dither, textures, bindings, matEnv);\n shader->populateMatEnv(false, textures, bindings, matEnvAdditional);\n shader->populateMeshEnv(false, boneBlendWeights, meshEnv);\n shader->populateMeshEnv(true, boneBlendWeights, meshEnvInstanced);\n\n // TODO: wireframe for instanced geometry?\n p = create_or_reset_material(name + \":wireframe\");\n shader->initPass(p, GFX_GSL_PURPOSE_WIREFRAME, matEnv, meshEnv, textures, bindings);\n p->setCullingMode(Ogre::CULL_NONE);\n p->setPolygonMode(Ogre::PM_WIREFRAME);\n p->setDepthWriteEnabled(false);\n wireframeMat = Ogre::MaterialManager::getSingleton().getByName(name + \":wireframe\", \"GRIT\");\n\n\n p = create_or_reset_material(name + \":cast\");\n shader->initPass(p, GFX_GSL_PURPOSE_CAST, matEnv, meshEnv, textures, bindings);\n if (backfaces)\n p->setCullingMode(Ogre::CULL_NONE);\n p->getVertexProgramParameters()->setNamedConstant(\n \"internal_shadow_additional_bias\", shadowBias);\n p->getFragmentProgramParameters()->setNamedConstant(\n \"internal_shadow_additional_bias\", shadowBias);\n castMat = Ogre::MaterialManager::getSingleton().getByName(name + \":cast\", \"GRIT\");\n\n p = create_or_reset_material(name + \":instancing_cast\");\n shader->initPass(p, GFX_GSL_PURPOSE_CAST, matEnv, meshEnvInstanced, textures, bindings);\n if (backfaces)\n p->setCullingMode(Ogre::CULL_NONE);\n p->getVertexProgramParameters()->setNamedConstant(\n \"internal_shadow_additional_bias\", shadowBias);\n p->getFragmentProgramParameters()->setNamedConstant(\n \"internal_shadow_additional_bias\", shadowBias);\n instancingCastMat =\n Ogre::MaterialManager::getSingleton().getByName(name + \":instancing_cast\", \"GRIT\");\n\n p = create_or_reset_material(name + \":regular\");\n if (sceneBlend == GFX_MATERIAL_OPAQUE) {\n shader->initPass(p, GFX_GSL_PURPOSE_FORWARD, matEnv, meshEnv, textures, bindings);\n } else {\n shader->initPass(p, GFX_GSL_PURPOSE_ALPHA, matEnv, meshEnv, textures, bindings);\n p->setDepthWriteEnabled(sceneBlend == GFX_MATERIAL_ALPHA_DEPTH);\n // Use pre-multiplied alpha to allow applying alpha to regular lighting pass and not to\n // emissive when both are done in the same pass.\n p->setSceneBlending(Ogre::SBF_ONE, Ogre::SBF_ONE_MINUS_SOURCE_ALPHA);\n p->setTransparentSortingForced(true);\n }\n if (backfaces)\n p->setCullingMode(Ogre::CULL_NONE);\n regularMat = Ogre::MaterialManager::getSingleton().getByName(name + \":regular\", \"GRIT\");\n regularMat->getTechnique(0)->setShadowCasterMaterial(castMat);\n\n p = create_or_reset_material(name + \":instancing\");\n if (sceneBlend == GFX_MATERIAL_OPAQUE) {\n shader->initPass(\n p, GFX_GSL_PURPOSE_FORWARD, matEnv, meshEnvInstanced, textures, bindings);\n } else {\n shader->initPass(p, GFX_GSL_PURPOSE_ALPHA, matEnv, meshEnvInstanced, textures, bindings);\n p->setDepthWriteEnabled(sceneBlend == GFX_MATERIAL_ALPHA_DEPTH);\n // Use pre-multiplied alpha to allow applying alpha to regular lighting pass and not to\n // emissive when both are done in the same pass.\n p->setSceneBlending(Ogre::SBF_ONE, Ogre::SBF_ONE_MINUS_SOURCE_ALPHA);\n p->setTransparentSortingForced(true);\n }\n if (backfaces)\n p->setCullingMode(Ogre::CULL_NONE);\n instancingMat = Ogre::MaterialManager::getSingleton().getByName(name + \":instancing\", \"GRIT\");\n instancingMat->getTechnique(0)->setShadowCasterMaterial(instancingCastMat);\n\n // TODO: additional lighting for instanced geometry?\n p = create_or_reset_material(name + \":additional\");\n shader->initPass(p, GFX_GSL_PURPOSE_ADDITIONAL, matEnvAdditional, meshEnv,\n textures, bindings);\n if (backfaces)\n p->setCullingMode(Ogre::CULL_NONE);\n p->setDepthWriteEnabled(false);\n p->setDepthFunction(Ogre::CMPF_LESS_EQUAL);\n p->setSceneBlending(Ogre::SBF_ONE, Ogre::SBF_ONE);\n additionalMat = Ogre::MaterialManager::getSingleton().getByName(name + \":additional\", \"GRIT\");\n}\n\nvoid GfxMaterial::updateOgreMaterials (const GfxShaderGlobals &globs)\n{\n Ogre::Pass *p;\n\n // TODO: wireframe for instanced geometry?\n p = wireframeMat->getTechnique(0)->getPass(0);\n shader->updatePass(p, globs, GFX_GSL_PURPOSE_WIREFRAME, matEnv, meshEnv, textures, bindings);\n\n p = castMat->getTechnique(0)->getPass(0);\n shader->updatePass(p, globs, GFX_GSL_PURPOSE_CAST, matEnv, meshEnv, textures, bindings);\n\n p = instancingCastMat->getTechnique(0)->getPass(0);\n shader->updatePass(p, globs, GFX_GSL_PURPOSE_CAST, matEnv, meshEnvInstanced,\n textures, bindings);\n\n p = regularMat->getTechnique(0)->getPass(0);\n if (sceneBlend == GFX_MATERIAL_OPAQUE) {\n shader->updatePass(p, globs, GFX_GSL_PURPOSE_FORWARD, matEnv, meshEnv, textures, bindings);\n } else {\n shader->updatePass(p, globs, GFX_GSL_PURPOSE_ALPHA, matEnv, meshEnv, textures, bindings);\n }\n\n p = instancingMat->getTechnique(0)->getPass(0);\n if (sceneBlend == GFX_MATERIAL_OPAQUE) {\n shader->updatePass(p, globs, GFX_GSL_PURPOSE_FORWARD, matEnv, meshEnvInstanced,\n textures, bindings);\n } else {\n shader->updatePass(p, globs, GFX_GSL_PURPOSE_ALPHA, matEnv, meshEnvInstanced,\n textures, bindings);\n }\n\n // TODO: additional lighting for instanced geometry?\n p = additionalMat->getTechnique(0)->getPass(0);\n shader->updatePass(p, globs, GFX_GSL_PURPOSE_ADDITIONAL, matEnvAdditional, meshEnv,\n textures, bindings);\n}\n\nGfxMaterial *gfx_material_add (const std::string &name)\n{\n GFX_MAT_SYNC;\n if (gfx_material_has_any(name)) GRIT_EXCEPT(\"Material already exists: \\\"\"+name+\"\\\"\");\n GfxMaterial *r = new GfxMaterial(name);\n material_db[name] = r;\n return r;\n}\n\nGfxMaterial *gfx_material_add_or_get (const std::string &name)\n{\n GFX_MAT_SYNC;\n if (gfx_material_has_any(name)) {\n GfxMaterial *mat = dynamic_cast<GfxMaterial*>(material_db[name]);\n if (mat == NULL) GRIT_EXCEPT(\"Material already exists but is the wrong kind: \\\"\"+name+\"\\\"\");\n return mat;\n } \n return gfx_material_add(name);\n}\n\nGfxMaterial *gfx_material_get (const std::string &name)\n{\n GFX_MAT_SYNC;\n if (!gfx_material_has_any(name)) GRIT_EXCEPT(\"Material does not exist: \\\"\"+name+\"\\\"\");\n GfxMaterial *mat = dynamic_cast<GfxMaterial*>(material_db[name]);\n if (mat == NULL) GRIT_EXCEPT(\"Wrong kind of material: \\\"\"+name+\"\\\"\");\n return mat;\n}\n\n\nbool gfx_material_has (const std::string &name)\n{\n GFX_MAT_SYNC;\n GfxMaterialDB::iterator it = material_db.find(name);\n if (it == material_db.end()) return false;\n return dynamic_cast<GfxMaterial*>(it->second) != NULL;\n}\n\nvoid gfx_material_init (void)\n{\n std::string vs =\n \"out.position = transform_to_world(vert.position.xyz);\\n\"\n \"var normal_ws = rotate_to_world(vert.normal.xyz);\\n\";\n std::string fs = \"out.normal = normal_ws;\";\n std::string as = \"\";\n \n gfx_shader_make_or_reset(\"/system/Default\", vs, fs, as, { }, false); \n gfx_material_add(\"/system/Default\")->buildOgreMaterials();\n \n}\n\n" }, { "alpha_fraction": 0.5768725275993347, "alphanum_fraction": 0.5863337516784668, "avg_line_length": 29.677419662475586, "blob_id": "2c98b6500df682c9b0c350f81915d87f37869a92", "content_id": "429eae3044e01305238a1343296c347082de7f86", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 3805, "license_type": "permissive", "max_line_length": 83, "num_lines": 124, "path": "/engine/grit_lua_util.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <cstdlib>\n\n#include <map>\n\n#include <io_util.h>\n#include <lua_stack.h>\n\n#include \"lua_ptr.h\"\n#include \"grit_lua_util.h\"\n#include \"path_util.h\"\n\ntypedef std::map<int (*)(lua_State*), LuaPtr> FuncMap;\nstatic FuncMap func_map;\nvoid push_cfunction (lua_State *L, int (*func)(lua_State*))\n{\n if (func_map.find(func)==func_map.end()) {\n lua_pushcfunction(L, func);\n func_map[func].setNoPop(L);\n } else {\n func_map[func].push(L);\n }\n}\n\nvoid func_map_leak_all (void)\n{\n for (FuncMap::iterator i=func_map.begin(), i_=func_map.end() ; i != i_ ; ++i) {\n i->second.leak();\n }\n}\n\n\nstd::string check_path (lua_State *L, int stack_index)\n{\n std::string abs = check_string(L, stack_index);\n if (abs.length() == 0) {\n EXCEPT << \"Path was a zero length string.\" << ENDL;\n }\n if (abs[0] != '/') {\n EXCEPT << \"Absolute path expected: \\\"\" << abs << \"\\\"\" << ENDL;\n }\n return abs;\n}\n\n\nint my_lua_error_handler (lua_State *l)\n{\n return my_lua_error_handler(l, l, 1);\n}\n\nint my_lua_error_handler (lua_State *l, lua_State *coro, int levelhack)\n{\n //check_args(l, 1);\n int level = 0;\n if (lua_type(l, -1)==LUA_TTABLE) {\n lua_rawgeti(l, -1, 1);\n level = luaL_checkinteger(l, -1);\n lua_pop(l, 1);\n lua_rawgeti(l, -1, 2);\n } \n level += levelhack; // To remove the current function as well.\n \n std::string str = check_string(l, -1);\n\n std::vector<struct stack_frame> tb = traceback(coro, level);\n\n if (tb.size()==0) {\n CERR<<\"getting traceback: ERROR LEVEL TOO HIGH!\"<<std::endl;\n level=0;\n tb = traceback(coro, level);\n } \n \n if (tb.size()==0) {\n CERR<<\"getting traceback: EVEN ZERO TOO HIGH!\"<<std::endl;\n return 1;\n } \n \n // strip file:line from message if it is there\n std::stringstream ss; ss<<tb[0].file<<\":\"<<tb[0].line<<\": \";\n std::string str_prefix1 = ss.str();\n std::string str_prefix2 = str.substr(0, str_prefix1.size());\n if (str_prefix1==str_prefix2)\n str = str.substr(str_prefix1.size());\n \n CLOG << BOLD << RED << tb[0].file;\n int line = tb[0].line;\n if (line > 0) { \n CLOG << \":\" << line;\n }\n CLOG << \": \" << str << RESET << std::endl;\n for (size_t i=1 ; i<tb.size() ; i++) {\n if (tb[i].gap) {\n CLOG << \"\\t...\" << RESET << std::endl;\n } else {\n CLOG << RED << \"\\t\" << tb[i].file;\n int line = tb[i].line;\n if (line > 0) {\n CLOG << \":\" << line;\n }\n CLOG << \": \" << tb[i].func_name << RESET << std::endl;\n }\n }\n return 1;\n}\n\n" }, { "alpha_fraction": 0.6286104321479797, "alphanum_fraction": 0.6297475695610046, "avg_line_length": 46.25806427001953, "blob_id": "57071318a213d486cb6f27e2ee82be67497b1ff2", "content_id": "92ca99d90134db50a424521786296dea31315af4", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 4397, "license_type": "permissive", "max_line_length": 123, "num_lines": 93, "path": "/dependencies/quex-0.34.1/quex/core_engine/state_machine/repeat.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "#! /usr/bin/env python\n# PURPOSE: creates a state machine that is the repeated version of the \n# given one. this means, that the success state is linked to the \n# start state.\nimport sys\nfrom copy import deepcopy\nsys.path.append(\"../\")\n\nfrom core import *\nimport sequentialize\n\ndef do(the_state_machine, min_repetition_n = 0, max_repetition_n = -1):\n \"\"\" Creates a state machine that represents a repetition of the given \n 'the_state_machine'. Minimum and maximim number of repetitions can be specified.\n \"\"\"\n assert min_repetition_n <= max_repetition_n or max_repetition_n == -1\n\n # (*) if minimum number of repetitions is required, then the initial\n # repetition is produced by sequentialization.\n initial_state_machine = None\n if min_repetition_n != 0:\n # Concatinate the state machine N times, at the beginning, so that \n # there are N repetitions at least. Any 'bail out' before the first N\n # repetitions happen from a 'non-acceptance' state => fail. Only, when\n # the first N repetitions happend, the state machines enters into the\n # following 'repetition states'.\n # NOTE: sequentialize clones the given state machines \n initial_state_machine = sequentialize.do([the_state_machine] * min_repetition_n)\n\n if max_repetition_n != -1:\n # if a maximum number of repetitions is given, then the state machine needs \n # to be repeated 'physically'. No new 'repeated' version of the state machine\n # is computed.\n # NOTE: sequentialize clones the given state machines \n if initial_state_machine != None: \n return sequentialize.do([initial_state_machine] \n + [the_state_machine] * (max_repetition_n - min_repetition_n),\n LeaveIntermediateAcceptanceStatesF = True)\n else:\n concatenation = sequentialize.do([the_state_machine] * max_repetition_n,\n LeaveIntermediateAcceptanceStatesF = True)\n # Here, zero initial repetitions are required, thus the initial state must be\n # an acceptance state.\n concatenation.states[concatenation.init_state_index].set_acceptance(True) \n return concatenation\n\n # (*) clone the state machine\n # NOTE: kleene_closure() clones the state machine.\n pure_repetition = kleene_closure(the_state_machine)\n if initial_state_machine != None: \n return sequentialize.do([initial_state_machine] + [ pure_repetition ],\n LeaveIntermediateAcceptanceStatesF = True)\n else:\n return pure_repetition\n\ndef kleene_closure(the_state_machine):\n \"\"\"Creates a state machine that is repeated any number of times \n (zero is also accepted).\n See: Thomson construction.\n \"\"\" \n # (*) clone the machine\n result = the_state_machine.clone()\n\n # (*) add additional initial state\n prev_init_state_index = result.init_state_index\n result.create_new_init_state() \n result.mount_to_initial_state(prev_init_state_index)\n # print \"##rmounti:\", result\n\n # (*) add additional terminal state\n new_terminal_state_index = result.create_new_state()\n\n # (*) connect all acceptance states via epsilon transition \n # *backwards* to old initial state.\n #\n # NOTE: do not cancel the acceptance state of any acceptance state,\n # so the next step can enter another target state index.\n result.mount_to_acceptance_states(prev_init_state_index,\n CancelStartAcceptanceStateF=False,\n RaiseTargetAcceptanceStateF=False)\n # print \"##backward:\", result\n # (*) connect all acceptance states via epsilon transition \n # *forwards* to terminal state\n result.mount_to_acceptance_states(new_terminal_state_index,\n CancelStartAcceptanceStateF=True,\n RaiseTargetAcceptanceStateF=False)\n # print \"##forward:\", result\n\n # (*) add epsilon transition from new init state to new terminal state\n result.add_epsilon_transition(result.init_state_index, new_terminal_state_index, \n RaiseAcceptanceF=True) \n\n return result\n\n\n" }, { "alpha_fraction": 0.5531870126724243, "alphanum_fraction": 0.5708003044128418, "avg_line_length": 29.8377685546875, "blob_id": "c3c02b9316ea608a921f2f5e1b94011bf62337fa", "content_id": "dd8513721229bffca659022349ad78a0a0f6f48b", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 47521, "license_type": "permissive", "max_line_length": 130, "num_lines": 1541, "path": "/engine/navigation/navigation_manager.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "//\n// Copyright (c) 2009-2010 Mikko Mononen memon@inside.org\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n//\n\n// This is a modified version of Sample_TempObstacles.cpp from Recast Demo\n\n#define _USE_MATH_DEFINES\n#include <math.h>\n#include <stdio.h>\n#include <string.h>\n#include <float.h>\n#include <new>\n#include \"input_geom.h\"\n#include \"navigation_manager.h\"\n#include \"Recast.h\"\n#include \"RecastDebugDraw.h\"\n#include \"DetourAssert.h\"\n#include \"DetourNavMesh.h\"\n#include \"DetourNavMeshBuilder.h\"\n#include \"DetourDebugDraw.h\"\n#include \"DetourCommon.h\"\n#include \"DetourTileCache.h\"\n#include \"crowd_manager.h\"\n#include \"RecastAlloc.h\"\n#include \"RecastAssert.h\"\n#include \"fastlz.h\"\n\n#include \"DetourNavMeshQuery.h\"\n#include \"DetourCrowd.h\"\n\n#ifdef WIN32\n# define snprintf _snprintf\n#endif\n\n#include\"navigation_system.h\"\n\n// This value specifies how many layers (or \"floors\") each navmesh tile is expected to have.\nstatic const int EXPECTED_LAYERS_PER_TILE = 4;\n\n\nstatic bool isectSegAABB(const float* sp, const float* sq,\n const float* amin, const float* amax,\n float& tmin, float& tmax)\n{\n static const float EPS = 1e-6f;\n \n float d[3];\n rcVsub(d, sq, sp);\n tmin = 0; // set to -FLT_MAX to get first hit on line\n tmax = FLT_MAX; // set to max distance ray can travel (for segment)\n \n // For all three slabs\n for (int i = 0; i < 3; i++)\n {\n if (fabsf(d[i]) < EPS)\n {\n // Ray is parallel to slab. No hit if origin not within slab\n if (sp[i] < amin[i] || sp[i] > amax[i])\n return false;\n }\n else\n {\n // Compute intersection t value of ray with near and far plane of slab\n const float ood = 1.0f / d[i];\n float t1 = (amin[i] - sp[i]) * ood;\n float t2 = (amax[i] - sp[i]) * ood;\n // Make t1 be intersection with near plane, t2 with far plane\n if (t1 > t2) rcSwap(t1, t2);\n // Compute the intersection of slab intersections intervals\n if (t1 > tmin) tmin = t1;\n if (t2 < tmax) tmax = t2;\n // Exit with no collision as soon as slab intersection becomes empty\n if (tmin > tmax) return false;\n }\n }\n \n return true;\n}\n\nstatic int calcLayerBufferSize(const int gridWidth, const int gridHeight)\n{\n const int headerSize = dtAlign4(sizeof(dtTileCacheLayerHeader));\n const int gridSize = gridWidth * gridHeight;\n return headerSize + gridSize*4;\n}\n\nstruct FastLZCompressor : public dtTileCacheCompressor\n{\n virtual int maxCompressedSize(const int bufferSize)\n {\n return (int)(bufferSize* 1.05f);\n }\n \n virtual dtStatus compress(const unsigned char* buffer, const int bufferSize,\n unsigned char* compressed, const int /*maxCompressedSize*/, int* compressedSize)\n {\n *compressedSize = fastlz_compress((const void *const)buffer, bufferSize, compressed);\n return DT_SUCCESS;\n }\n \n virtual dtStatus decompress(const unsigned char* compressed, const int compressedSize,\n unsigned char* buffer, const int maxBufferSize, int* bufferSize)\n {\n *bufferSize = fastlz_decompress(compressed, compressedSize, buffer, maxBufferSize);\n return *bufferSize < 0 ? DT_FAILURE : DT_SUCCESS;\n }\n};\n\nstruct LinearAllocator : public dtTileCacheAlloc\n{\n unsigned char* buffer;\n size_t capacity;\n size_t top;\n size_t high;\n \n LinearAllocator(const size_t cap) : buffer(0), capacity(0), top(0), high(0)\n {\n resize(cap);\n }\n \n ~LinearAllocator()\n {\n dtFree(buffer);\n }\n\n void resize(const size_t cap)\n {\n if (buffer) dtFree(buffer);\n buffer = (unsigned char*)dtAlloc(cap, DT_ALLOC_PERM);\n capacity = cap;\n }\n \n virtual void reset()\n {\n high = dtMax(high, top);\n top = 0;\n }\n \n virtual void* alloc(const size_t size)\n {\n if (!buffer)\n return 0;\n if (top+size > capacity)\n return 0;\n unsigned char* mem = &buffer[top];\n top += size;\n return mem;\n }\n \n virtual void free(void* /*ptr*/)\n {\n // Empty\n }\n};\n\nstruct MeshProcess : public dtTileCacheMeshProcess\n{\n InputGeom* m_geom;\n\n inline MeshProcess() : m_geom(0)\n {\n }\n\n inline void init(InputGeom* geom)\n {\n m_geom = geom;\n }\n \n virtual void process(struct dtNavMeshCreateParams* params,\n unsigned char* polyAreas, unsigned short* polyFlags)\n {\n // Update poly flags from areas.\n for (int i = 0; i < params->polyCount; ++i)\n {\n if (polyAreas[i] == DT_TILECACHE_WALKABLE_AREA)\n polyAreas[i] = SAMPLE_POLYAREA_GROUND;\n\n if (polyAreas[i] == SAMPLE_POLYAREA_GROUND ||\n polyAreas[i] == SAMPLE_POLYAREA_GRASS ||\n polyAreas[i] == SAMPLE_POLYAREA_ROAD)\n {\n polyFlags[i] = SAMPLE_POLYFLAGS_WALK;\n }\n else if (polyAreas[i] == SAMPLE_POLYAREA_WATER)\n {\n polyFlags[i] = SAMPLE_POLYFLAGS_SWIM;\n }\n else if (polyAreas[i] == SAMPLE_POLYAREA_DOOR)\n {\n polyFlags[i] = SAMPLE_POLYFLAGS_WALK | SAMPLE_POLYFLAGS_DOOR;\n }\n }\n\n // Pass in off-mesh connections.\n if (m_geom)\n {\n params->offMeshConVerts = m_geom->getOffMeshConnectionVerts();\n params->offMeshConRad = m_geom->getOffMeshConnectionRads();\n params->offMeshConDir = m_geom->getOffMeshConnectionDirs();\n params->offMeshConAreas = m_geom->getOffMeshConnectionAreas();\n params->offMeshConFlags = m_geom->getOffMeshConnectionFlags();\n params->offMeshConUserID = m_geom->getOffMeshConnectionId();\n params->offMeshConCount = m_geom->getOffMeshConnectionCount(); \n }\n }\n};\n\nstatic const int MAX_LAYERS = 32;\n\nstruct TileCacheData\n{\n unsigned char* data;\n int dataSize;\n};\n\nstruct RasterizationContext\n{\n RasterizationContext() :\n solid(0),\n triareas(0),\n lset(0),\n chf(0),\n ntiles(0)\n {\n memset(tiles, 0, sizeof(TileCacheData)*MAX_LAYERS);\n }\n \n ~RasterizationContext()\n {\n rcFreeHeightField(solid);\n delete [] triareas;\n rcFreeHeightfieldLayerSet(lset);\n rcFreeCompactHeightfield(chf);\n for (int i = 0; i < MAX_LAYERS; ++i)\n {\n dtFree(tiles[i].data);\n tiles[i].data = 0;\n }\n }\n \n rcHeightfield* solid;\n unsigned char* triareas;\n rcHeightfieldLayerSet* lset;\n rcCompactHeightfield* chf;\n TileCacheData tiles[MAX_LAYERS];\n int ntiles;\n};\n\nstatic int rasterizeTileLayers(BuildContext* ctx, InputGeom* geom,\n const int tx, const int ty,\n const rcConfig& cfg,\n TileCacheData* tiles,\n const int maxTiles)\n{\n if (!geom || !geom->getMesh() || !geom->getChunkyMesh())\n {\n ctx->log(RC_LOG_ERROR, \"buildTile: Input mesh is not specified.\");\n return 0;\n }\n \n FastLZCompressor comp;\n RasterizationContext rc;\n \n const float* verts = geom->getMesh()->getVerts();\n const int nverts = geom->getMesh()->getVertCount();\n const rcChunkyTriMesh* chunkyMesh = geom->getChunkyMesh();\n \n // Tile bounds.\n const float tcs = cfg.tileSize * cfg.cs;\n \n rcConfig tcfg;\n memcpy(&tcfg, &cfg, sizeof(tcfg));\n\n tcfg.bmin[0] = cfg.bmin[0] + tx*tcs;\n tcfg.bmin[1] = cfg.bmin[1];\n tcfg.bmin[2] = cfg.bmin[2] + ty*tcs;\n tcfg.bmax[0] = cfg.bmin[0] + (tx+1)*tcs;\n tcfg.bmax[1] = cfg.bmax[1];\n tcfg.bmax[2] = cfg.bmin[2] + (ty+1)*tcs;\n tcfg.bmin[0] -= tcfg.borderSize*tcfg.cs;\n tcfg.bmin[2] -= tcfg.borderSize*tcfg.cs;\n tcfg.bmax[0] += tcfg.borderSize*tcfg.cs;\n tcfg.bmax[2] += tcfg.borderSize*tcfg.cs;\n \n // Allocate voxel heightfield where we rasterize our input data to.\n rc.solid = rcAllocHeightfield();\n if (!rc.solid)\n {\n ctx->log(RC_LOG_ERROR, \"buildNavigation: Out of memory 'solid'.\");\n return 0;\n }\n if (!rcCreateHeightfield(ctx, *rc.solid, tcfg.width, tcfg.height, tcfg.bmin, tcfg.bmax, tcfg.cs, tcfg.ch))\n {\n ctx->log(RC_LOG_ERROR, \"buildNavigation: Could not create solid heightfield.\");\n return 0;\n }\n \n // Allocate array that can hold triangle flags.\n // If you have multiple meshes you need to process, allocate\n // and array which can hold the max number of triangles you need to process.\n rc.triareas = new unsigned char[chunkyMesh->maxTrisPerChunk];\n if (!rc.triareas)\n {\n ctx->log(RC_LOG_ERROR, \"buildNavigation: Out of memory 'm_triareas' (%d).\", chunkyMesh->maxTrisPerChunk);\n return 0;\n }\n \n float tbmin[2], tbmax[2];\n tbmin[0] = tcfg.bmin[0];\n tbmin[1] = tcfg.bmin[2];\n tbmax[0] = tcfg.bmax[0];\n tbmax[1] = tcfg.bmax[2];\n int cid[512];// TODO: Make grow when returning too many items.\n const int ncid = rcGetChunksOverlappingRect(chunkyMesh, tbmin, tbmax, cid, 512);\n if (!ncid)\n {\n return 0; // empty\n }\n \n for (int i = 0; i < ncid; ++i)\n {\n const rcChunkyTriMeshNode& node = chunkyMesh->nodes[cid[i]];\n const int* tris = &chunkyMesh->tris[node.i*3];\n const int ntris = node.n;\n \n memset(rc.triareas, 0, ntris*sizeof(unsigned char));\n rcMarkWalkableTriangles(ctx, tcfg.walkableSlopeAngle,\n verts, nverts, tris, ntris, rc.triareas);\n \n if (!rcRasterizeTriangles(ctx, verts, nverts, tris, rc.triareas, ntris, *rc.solid, tcfg.walkableClimb))\n return 0;\n }\n \n // Once all geometry is rasterized, we do initial pass of filtering to\n // remove unwanted overhangs caused by the conservative rasterization\n // as well as filter spans where the character cannot possibly stand.\n rcFilterLowHangingWalkableObstacles(ctx, tcfg.walkableClimb, *rc.solid);\n rcFilterLedgeSpans(ctx, tcfg.walkableHeight, tcfg.walkableClimb, *rc.solid);\n rcFilterWalkableLowHeightSpans(ctx, tcfg.walkableHeight, *rc.solid);\n \n \n rc.chf = rcAllocCompactHeightfield();\n if (!rc.chf)\n {\n ctx->log(RC_LOG_ERROR, \"buildNavigation: Out of memory 'chf'.\");\n return 0;\n }\n if (!rcBuildCompactHeightfield(ctx, tcfg.walkableHeight, tcfg.walkableClimb, *rc.solid, *rc.chf))\n {\n ctx->log(RC_LOG_ERROR, \"buildNavigation: Could not build compact data.\");\n return 0;\n }\n \n // Erode the walkable area by agent radius.\n if (!rcErodeWalkableArea(ctx, tcfg.walkableRadius, *rc.chf))\n {\n ctx->log(RC_LOG_ERROR, \"buildNavigation: Could not erode.\");\n return 0;\n }\n \n // (Optional) Mark areas.\n const ConvexVolume* vols = geom->getConvexVolumes();\n for (int i = 0; i < geom->getConvexVolumeCount(); ++i)\n {\n rcMarkConvexPolyArea(ctx, vols[i].verts, vols[i].nverts,\n vols[i].hmin, vols[i].hmax,\n (unsigned char)vols[i].area, *rc.chf);\n }\n \n rc.lset = rcAllocHeightfieldLayerSet();\n if (!rc.lset)\n {\n ctx->log(RC_LOG_ERROR, \"buildNavigation: Out of memory 'lset'.\");\n return 0;\n }\n if (!rcBuildHeightfieldLayers(ctx, *rc.chf, tcfg.borderSize, tcfg.walkableHeight, *rc.lset))\n {\n ctx->log(RC_LOG_ERROR, \"buildNavigation: Could not build heighfield layers.\");\n return 0;\n }\n \n rc.ntiles = 0;\n for (int i = 0; i < rcMin(rc.lset->nlayers, MAX_LAYERS); ++i)\n {\n TileCacheData* tile = &rc.tiles[rc.ntiles++];\n const rcHeightfieldLayer* layer = &rc.lset->layers[i];\n \n // Store header\n dtTileCacheLayerHeader header;\n header.magic = DT_TILECACHE_MAGIC;\n header.version = DT_TILECACHE_VERSION;\n \n // Tile layer location in the navmesh.\n header.tx = tx;\n header.ty = ty;\n header.tlayer = i;\n dtVcopy(header.bmin, layer->bmin);\n dtVcopy(header.bmax, layer->bmax);\n \n // Tile info.\n header.width = (unsigned char)layer->width;\n header.height = (unsigned char)layer->height;\n header.minx = (unsigned char)layer->minx;\n header.maxx = (unsigned char)layer->maxx;\n header.miny = (unsigned char)layer->miny;\n header.maxy = (unsigned char)layer->maxy;\n header.hmin = (unsigned short)layer->hmin;\n header.hmax = (unsigned short)layer->hmax;\n\n dtStatus status = dtBuildTileCacheLayer(&comp, &header, layer->heights, layer->areas, layer->cons,\n &tile->data, &tile->dataSize);\n if (dtStatusFailed(status))\n {\n return 0;\n }\n }\n\n // Transfer ownsership of tile data from build context to the caller.\n int n = 0;\n for (int i = 0; i < rcMin(rc.ntiles, maxTiles); ++i)\n {\n tiles[n++] = rc.tiles[i];\n rc.tiles[i].data = 0;\n rc.tiles[i].dataSize = 0;\n }\n \n return n;\n}\n\nvoid drawTiles(duDebugDraw* dd, dtTileCache* tc)\n{\n unsigned int fcol[6];\n float bmin[3], bmax[3];\n\n for (int i = 0; i < tc->getTileCount(); ++i)\n {\n const dtCompressedTile* tile = tc->getTile(i);\n if (!tile->header) continue;\n \n tc->calcTightTileBounds(tile->header, bmin, bmax);\n \n const unsigned int col = duIntToCol(i,64);\n duCalcBoxColors(fcol, col, col);\n duDebugDrawBox(dd, bmin[0],bmin[1],bmin[2], bmax[0],bmax[1],bmax[2], fcol);\n }\n \n for (int i = 0; i < tc->getTileCount(); ++i)\n {\n const dtCompressedTile* tile = tc->getTile(i);\n if (!tile->header) continue;\n \n tc->calcTightTileBounds(tile->header, bmin, bmax);\n \n const unsigned int col = duIntToCol(i,255);\n const float pad = tc->getParams()->cs * 0.1f;\n duDebugDrawBoxWire(dd, bmin[0]-pad,bmin[1]-pad,bmin[2]-pad,\n bmax[0]+pad,bmax[1]+pad,bmax[2]+pad, col, 2.0f);\n }\n\n}\n\nenum DrawDetailType\n{\n DRAWDETAIL_AREAS,\n DRAWDETAIL_REGIONS,\n DRAWDETAIL_CONTOURS,\n DRAWDETAIL_MESH,\n};\n\nvoid drawDetail(duDebugDraw* dd, dtTileCache* tc, const int tx, const int ty, int type)\n{\n struct TileCacheBuildContext\n {\n inline TileCacheBuildContext(struct dtTileCacheAlloc* a) : layer(0), lcset(0), lmesh(0), alloc(a) {}\n inline ~TileCacheBuildContext() { purge(); }\n void purge()\n {\n dtFreeTileCacheLayer(alloc, layer);\n layer = 0;\n dtFreeTileCacheContourSet(alloc, lcset);\n lcset = 0;\n dtFreeTileCachePolyMesh(alloc, lmesh);\n lmesh = 0;\n }\n struct dtTileCacheLayer* layer;\n struct dtTileCacheContourSet* lcset;\n struct dtTileCachePolyMesh* lmesh;\n struct dtTileCacheAlloc* alloc;\n };\n\n dtCompressedTileRef tiles[MAX_LAYERS];\n const int ntiles = tc->getTilesAt(tx,ty,tiles,MAX_LAYERS);\n\n dtTileCacheAlloc* talloc = tc->getAlloc();\n dtTileCacheCompressor* tcomp = tc->getCompressor();\n const dtTileCacheParams* params = tc->getParams();\n\n for (int i = 0; i < ntiles; ++i)\n {\n const dtCompressedTile* tile = tc->getTileByRef(tiles[i]);\n\n talloc->reset();\n\n TileCacheBuildContext bc(talloc);\n const int walkableClimbVx = (int)(params->walkableClimb / params->ch);\n dtStatus status;\n \n // Decompress tile layer data. \n status = dtDecompressTileCacheLayer(talloc, tcomp, tile->data, tile->dataSize, &bc.layer);\n if (dtStatusFailed(status))\n return;\n if (type == DRAWDETAIL_AREAS)\n {\n duDebugDrawTileCacheLayerAreas(dd, *bc.layer, params->cs, params->ch);\n continue;\n }\n\n // Build navmesh\n status = dtBuildTileCacheRegions(talloc, *bc.layer, walkableClimbVx);\n if (dtStatusFailed(status))\n return;\n if (type == DRAWDETAIL_REGIONS)\n {\n duDebugDrawTileCacheLayerRegions(dd, *bc.layer, params->cs, params->ch);\n continue;\n }\n \n bc.lcset = dtAllocTileCacheContourSet(talloc);\n if (!bc.lcset)\n return;\n status = dtBuildTileCacheContours(talloc, *bc.layer, walkableClimbVx,\n params->maxSimplificationError, *bc.lcset);\n if (dtStatusFailed(status))\n return;\n if (type == DRAWDETAIL_CONTOURS)\n {\n duDebugDrawTileCacheContours(dd, *bc.lcset, tile->header->bmin, params->cs, params->ch);\n continue;\n }\n \n bc.lmesh = dtAllocTileCachePolyMesh(talloc);\n if (!bc.lmesh)\n return;\n status = dtBuildTileCachePolyMesh(talloc, *bc.lcset, *bc.lmesh);\n if (dtStatusFailed(status))\n return;\n\n if (type == DRAWDETAIL_MESH)\n {\n duDebugDrawTileCachePolyMesh(dd, *bc.lmesh, tile->header->bmin, params->cs, params->ch);\n continue;\n }\n\n }\n}\n\nvoid drawDetailOverlay(const dtTileCache* tc, const int tx, const int ty, double* proj, double* model, int* view)\n{\n dtCompressedTileRef tiles[MAX_LAYERS];\n const int ntiles = tc->getTilesAt(tx,ty,tiles,MAX_LAYERS);\n if (!ntiles)\n return;\n \n (void) model;\n (void) view;\n (void) proj;\n //const int rawSize = calcLayerBufferSize(tc->getParams()->width, tc->getParams()->height);\n \n //char text[128];\n\n for (int i = 0; i < ntiles; ++i)\n {\n const dtCompressedTile* tile = tc->getTileByRef(tiles[i]);\n \n float pos[3];\n pos[0] = (tile->header->bmin[0]+tile->header->bmax[0])/2.0f;\n pos[1] = tile->header->bmin[1];\n pos[2] = (tile->header->bmin[2]+tile->header->bmax[2])/2.0f;\n (void) pos;\n //-- TODO: replace this using Ogre \"MoveableTextOverlay\"\n //GLdouble x, y, z;\n //if (gluProject((GLdouble)pos[0], (GLdouble)pos[1], (GLdouble)pos[2],\n // model, proj, view, &x, &y, &z))\n //{\n // snprintf(text,128,\"(%d,%d)/%d\", tile->header->tx,tile->header->ty,tile->header->tlayer);\n // imguiDrawText((int)x, (int)y-25, IMGUI_ALIGN_CENTER, text, imguiRGBA(0,0,0,220));\n // snprintf(text,128,\"Compressed: %.1f kB\", tile->dataSize/1024.0f);\n // imguiDrawText((int)x, (int)y-45, IMGUI_ALIGN_CENTER, text, imguiRGBA(0,0,0,128));\n // snprintf(text,128,\"Raw:%.1fkB\", rawSize/1024.0f);\n // imguiDrawText((int)x, (int)y-65, IMGUI_ALIGN_CENTER, text, imguiRGBA(0,0,0,128));\n //}\n }\n}\n \ndtObstacleRef hitTestObstacle(const dtTileCache* tc, const float* sp, const float* sq)\n{\n float tmin = FLT_MAX;\n const dtTileCacheObstacle* obmin = 0;\n for (int i = 0; i < tc->getObstacleCount(); ++i)\n {\n const dtTileCacheObstacle* ob = tc->getObstacle(i);\n if (ob->state == DT_OBSTACLE_EMPTY)\n continue;\n \n float bmin[3], bmax[3], t0,t1;\n tc->getObstacleBounds(ob, bmin,bmax);\n \n if (isectSegAABB(sp,sq, bmin,bmax, t0,t1))\n {\n if (t0 < tmin)\n {\n tmin = t0;\n obmin = ob;\n }\n }\n }\n return tc->getObstacleRef(obmin);\n}\n \nvoid drawObstacles(duDebugDraw* dd, const dtTileCache* tc)\n{\n // Draw obstacles\n for (int i = 0; i < tc->getObstacleCount(); ++i)\n {\n const dtTileCacheObstacle* ob = tc->getObstacle(i);\n if (ob->state == DT_OBSTACLE_EMPTY) continue;\n float bmin[3], bmax[3];\n tc->getObstacleBounds(ob, bmin,bmax);\n\n unsigned int col = 0;\n if (ob->state == DT_OBSTACLE_PROCESSING)\n col = duRGBA(255,255,0,128);\n else if (ob->state == DT_OBSTACLE_PROCESSED)\n col = duRGBA(255,192,0,192);\n else if (ob->state == DT_OBSTACLE_REMOVING)\n col = duRGBA(220,0,0,128);\n\n duDebugDrawCylinder(dd, bmin[0],bmin[1],bmin[2], bmax[0],bmax[1],bmax[2], col);\n duDebugDrawCylinderWire(dd, bmin[0],bmin[1],bmin[2], bmax[0],bmax[1],bmax[2], duDarkenCol(col), 2);\n }\n}\n\nNavigationManager::NavigationManager() :\n m_geom(nullptr),\n m_navMesh(nullptr),\n m_navMeshDrawFlags(DU_DRAWNAVMESH_OFFMESHCONS | DU_DRAWNAVMESH_CLOSEDLIST),\n m_ctx(nullptr),\n m_keepInterResults(false),\n m_tileCache(0),\n m_cacheBuildTimeMs(0),\n m_cacheCompressedSize(0),\n m_cacheRawSize(0),\n m_cacheLayerCount(0),\n m_cacheBuildMemUsage(0),\n m_drawMode(DRAWMODE_NAVMESH),\n m_maxTiles(0),\n m_maxPolysPerTile(0),\n m_tileSize(48),\n m_npts(0),\n m_nhull(0)\n{\n m_navQuery = dtAllocNavMeshQuery();\n m_crowd = dtAllocCrowd();\n\n resetCommonSettings();\n \n m_talloc = new LinearAllocator(32000);\n m_tcomp = new FastLZCompressor;\n m_tmproc = new MeshProcess;\n\n m_crowdTool = new CrowdTool();\n}\n\nNavigationManager::~NavigationManager()\n{\n dtFreeNavMeshQuery(m_navQuery);\n dtFreeNavMesh(m_navMesh);\n dtFreeCrowd(m_crowd);\n\n m_navMesh = 0;\n dtFreeTileCache(m_tileCache);\n}\n\nvoid NavigationManager::updateMaxTiles()\n{\n if (m_geom)\n {\n const float* bmin = m_geom->getNavMeshBoundsMin();\n const float* bmax = m_geom->getNavMeshBoundsMax();\n // char text[64];\n int gw = 0, gh = 0;\n rcCalcGridSize(bmin, bmax, m_cellSize, &gw, &gh);\n const int ts = (int)m_tileSize;\n const int tw = (gw + ts-1) / ts;\n const int th = (gh + ts-1) / ts;\n\n // Max tiles and max polys affect how the tile IDs are caculated.\n // There are 22 bits available for identifying a tile and a polygon.\n int tileBits = rcMin((int)dtIlog2(dtNextPow2(tw*th*EXPECTED_LAYERS_PER_TILE)), 14);\n if (tileBits > 14) tileBits = 14;\n int polyBits = 22 - tileBits;\n m_maxTiles = 1 << tileBits;\n m_maxPolysPerTile = 1 << polyBits;\n }\n else\n {\n m_maxTiles = 0;\n m_maxPolysPerTile = 0;\n }\n}\n\n// this is a modified function of Recast Debug Draw\n// removed tile bounds and points\nstatic void drawMeshTilex(duDebugDraw* dd, const dtNavMesh& mesh, const dtNavMeshQuery* query,\n const dtMeshTile* tile, unsigned char flags)\n{\n dtPolyRef base = mesh.getPolyRefBase(tile);\n\n int tileNum = mesh.decodePolyIdTile(base);\n\n dd->depthMask(false);\n\n dd->begin(DU_DRAW_TRIS);\n for (int i = 0; i < tile->header->polyCount; ++i)\n {\n const dtPoly* p = &tile->polys[i];\n if (p->getType() == DT_POLYTYPE_OFFMESH_CONNECTION) // Skip off-mesh links.\n continue;\n\n const dtPolyDetail* pd = &tile->detailMeshes[i];\n\n unsigned int col;\n if (query && query->isInClosedList(base | (dtPolyRef)i))\n col = duRGBA(255, 196, 0, 64);\n else\n {\n if (flags & DU_DRAWNAVMESH_COLOR_TILES)\n {\n col = duIntToCol(tileNum, 128);\n }\n else\n {\n if (p->getArea() == 0) // Treat zero area type as default.\n col = duRGBA(0, 192, 255, 64);\n else\n col = duIntToCol(p->getArea(), 64);\n }\n }\n\n for (int j = 0; j < pd->triCount; ++j)\n {\n const unsigned char* t = &tile->detailTris[(pd->triBase + j) * 4];\n for (int k = 0; k < 3; ++k)\n {\n if (t[k] < p->vertCount)\n dd->vertex(&tile->verts[p->verts[t[k]] * 3], col);\n else\n dd->vertex(&tile->detailVerts[(pd->vertBase + t[k] - p->vertCount) * 3], col);\n }\n }\n }\n dd->end();\n\n if (flags & DU_DRAWNAVMESH_OFFMESHCONS)\n {\n dd->begin(DU_DRAW_LINES, 2.0f);\n for (int i = 0; i < tile->header->polyCount; ++i)\n {\n const dtPoly* p = &tile->polys[i];\n if (p->getType() != DT_POLYTYPE_OFFMESH_CONNECTION) // Skip regular polys.\n continue;\n\n unsigned int col, col2;\n if (query && query->isInClosedList(base | (dtPolyRef)i))\n col = duRGBA(255, 196, 0, 220);\n else\n col = duDarkenCol(duIntToCol(p->getArea(), 220));\n\n const dtOffMeshConnection* con = &tile->offMeshCons[i - tile->header->offMeshBase];\n const float* va = &tile->verts[p->verts[0] * 3];\n const float* vb = &tile->verts[p->verts[1] * 3];\n\n // Check to see if start and end end-points have links.\n bool startSet = false;\n bool endSet = false;\n for (unsigned int k = p->firstLink; k != DT_NULL_LINK; k = tile->links[k].next)\n {\n if (tile->links[k].edge == 0)\n startSet = true;\n if (tile->links[k].edge == 1)\n endSet = true;\n }\n\n // End points and their on-mesh locations.\n dd->vertex(va[0], va[1], va[2], col);\n dd->vertex(con->pos[0], con->pos[1], con->pos[2], col);\n col2 = startSet ? col : duRGBA(220, 32, 16, 196);\n duAppendCircle(dd, con->pos[0], con->pos[1] + 0.1f, con->pos[2], con->rad, col2);\n\n dd->vertex(vb[0], vb[1], vb[2], col);\n dd->vertex(con->pos[3], con->pos[4], con->pos[5], col);\n col2 = endSet ? col : duRGBA(220, 32, 16, 196);\n duAppendCircle(dd, con->pos[3], con->pos[4] + 0.1f, con->pos[5], con->rad, col2);\n\n // End point vertices.\n dd->vertex(con->pos[0], con->pos[1], con->pos[2], duRGBA(0, 48, 64, 196));\n dd->vertex(con->pos[0], con->pos[1] + 0.2f, con->pos[2], duRGBA(0, 48, 64, 196));\n\n dd->vertex(con->pos[3], con->pos[4], con->pos[5], duRGBA(0, 48, 64, 196));\n dd->vertex(con->pos[3], con->pos[4] + 0.2f, con->pos[5], duRGBA(0, 48, 64, 196));\n\n // Connection arc.\n duAppendArc(dd, con->pos[0], con->pos[1], con->pos[2], con->pos[3], con->pos[4], con->pos[5], 0.25f,\n (con->flags & 1) ? 0.6f : 0, 0.6f, col);\n }\n dd->end();\n }\n\n dd->depthMask(true);\n}\n\nvoid duDebugDrawNavMeshx(duDebugDraw* dd, const dtNavMesh& mesh, unsigned char flags)\n{\n if (!dd) return;\n\n for (int i = 0; i < mesh.getMaxTiles(); ++i)\n {\n const dtMeshTile* tile = mesh.getTile(i);\n if (!tile->header) continue;\n drawMeshTilex(dd, mesh, 0, tile, flags);\n }\n}\n\nvoid NavigationManager::render()\n{\n // when loading from a navmesh file, no m_geom is loaded\n bool navmesh_from_disk = false;\n if (!m_geom || !m_geom->getMesh())\n {\n navmesh_from_disk = true;\n //return;\n }\n\n DebugDrawGL dd;\n\n // const float texScale = 1.0f / (m_cellSize * 10.0f);\n\n if (!navmesh_from_disk)\n {\n\n if (m_drawMode != DRAWMODE_NAVMESH_TRANS && NavSysDebug::ShowOffmeshConnections)\n {\n m_geom->drawOffMeshConnections(&dd);\n }\n\n // Draw bounds\n const float* bmin = m_geom->getNavMeshBoundsMin();\n const float* bmax = m_geom->getNavMeshBoundsMax();\n\n if (NavSysDebug::ShowBounds)\n {\n duDebugDrawBoxWire(&dd, bmin[0], bmin[1], bmin[2], bmax[0], bmax[1], bmax[2], duRGBA(255, 255, 255, 128), 1.0f);\n }\n\n if (NavSysDebug::ShowTilingGrid)\n {\n // Tiling grid.\n int gw = 0, gh = 0;\n rcCalcGridSize(bmin, bmax, m_cellSize, &gw, &gh);\n const int tw = (gw + (int)m_tileSize - 1) / (int)m_tileSize;\n const int th = (gh + (int)m_tileSize - 1) / (int)m_tileSize;\n const float s = m_tileSize*m_cellSize;\n\n duDebugDrawGridXZ(&dd, bmin[0], bmin[1], bmin[2], tw, th, s, duRGBA(0, 0, 0, 64), 1.0f);\n }\n\n // TODO\n if (NavSysDebug::ShowConvexVolumes)\n {\n m_geom->drawConvexVolumes(&dd);\n \n // temporary convex volume\n drawConvexVolume(&dd);\n }\n\n m_crowdTool->render();\n }\n\n //if (m_tileCache && m_drawMode == DRAWMODE_CACHE_BOUNDS)\n // drawTiles(&dd, m_tileCache);\n\n if (m_tileCache && NavSysDebug::ShowObstacles)\n {\n drawObstacles(&dd, m_tileCache);\n }\n\n if (NavSysDebug::ShowNavmesh)\n {\n\n if (m_navMesh && m_navQuery &&\n (m_drawMode == DRAWMODE_NAVMESH ||\n m_drawMode == DRAWMODE_NAVMESH_TRANS ||\n m_drawMode == DRAWMODE_NAVMESH_BVTREE ||\n m_drawMode == DRAWMODE_NAVMESH_NODES ||\n m_drawMode == DRAWMODE_NAVMESH_PORTALS ||\n m_drawMode == DRAWMODE_NAVMESH_INVIS))\n {\n if (m_drawMode != DRAWMODE_NAVMESH_INVIS)\n //--duDebugDrawNavMeshWithClosedList(&dd, *m_navMesh, *m_navQuery, m_navMeshDrawFlags|DU_DRAWNAVMESH_COLOR_TILES);\n //++\n duDebugDrawNavMeshx(&dd, *m_navMesh, m_navMeshDrawFlags | DU_DRAWNAVMESH_COLOR_TILES);\n /*\n if (m_drawMode == DRAWMODE_NAVMESH_BVTREE)\n duDebugDrawNavMeshBVTree(&dd, *m_navMesh);\n if (m_drawMode == DRAWMODE_NAVMESH_PORTALS)\n duDebugDrawNavMeshPortals(&dd, *m_navMesh);\n if (m_drawMode == DRAWMODE_NAVMESH_NODES)\n duDebugDrawNavMeshNodes(&dd, *m_navQuery);\n */\n //duDebugDrawNavMeshPolysWithFlags(&dd, *m_navMesh, SAMPLE_POLYFLAGS_DISABLED, duRGBA(0,0,0,128));\n }\n }\n}\n\nvoid NavigationManager::renderCachedTile(const int tx, const int ty, const int type)\n{\n DebugDrawGL dd;\n if (m_tileCache)\n drawDetail(&dd,m_tileCache,tx,ty,type);\n}\n\nvoid NavigationManager::renderCachedTileOverlay(const int tx, const int ty, double* proj, double* model, int* view)\n{\n if (m_tileCache)\n drawDetailOverlay(m_tileCache, tx, ty, proj, model, view);\n}\n\nvoid NavigationManager::changeMesh(class InputGeom* geom)\n{\n m_geom = geom;\n\n m_tmproc->init(m_geom);\n\n dtFreeTileCache(m_tileCache);\n m_tileCache = 0;\n \n dtFreeNavMesh(m_navMesh);\n m_navMesh = 0;\n}\n\nvoid NavigationManager::addTempObstacle(const float* pos)\n{\n if (!m_tileCache)\n return;\n float p[3];\n dtVcopy(p, pos);\n p[1] -= 0.5f;\n m_tileCache->addObstacle(p, 1.0f, 2.0f, 0);\n}\n\nvoid NavigationManager::removeTempObstacle(const float* sp, const float* sq)\n{\n if (!m_tileCache)\n return;\n dtObstacleRef ref = hitTestObstacle(m_tileCache, sp, sq);\n m_tileCache->removeObstacle(ref);\n}\n\nvoid NavigationManager::clearAllTempObstacles()\n{\n if (!m_tileCache)\n return;\n for (int i = 0; i < m_tileCache->getObstacleCount(); ++i)\n {\n const dtTileCacheObstacle* ob = m_tileCache->getObstacle(i);\n if (ob->state == DT_OBSTACLE_EMPTY) continue;\n m_tileCache->removeObstacle(m_tileCache->getObstacleRef(ob));\n }\n}\n\nbool NavigationManager::build()\n{\n dtStatus status;\n\n if (!m_geom || !m_geom->getMesh())\n {\n m_ctx->log(RC_LOG_ERROR, \"buildTiledNavigation: No vertices and triangles.\");\n return false;\n }\n\n m_tmproc->init(m_geom);\n \n // Init cache\n const float* bmin = m_geom->getNavMeshBoundsMin();\n const float* bmax = m_geom->getNavMeshBoundsMax();\n int gw = 0, gh = 0;\n rcCalcGridSize(bmin, bmax, m_cellSize, &gw, &gh);\n const int ts = (int)m_tileSize;\n const int tw = (gw + ts-1) / ts;\n const int th = (gh + ts-1) / ts;\n\n // Generation params.\n rcConfig cfg;\n memset(&cfg, 0, sizeof(cfg));\n cfg.cs = m_cellSize;\n cfg.ch = m_cellHeight;\n cfg.walkableSlopeAngle = m_agentMaxSlope;\n cfg.walkableHeight = (int)ceilf(m_agentHeight / cfg.ch);\n cfg.walkableClimb = (int)floorf(m_agentMaxClimb / cfg.ch);\n cfg.walkableRadius = (int)ceilf(m_agentRadius / cfg.cs);\n cfg.maxEdgeLen = (int)(m_edgeMaxLen / m_cellSize);\n cfg.maxSimplificationError = m_edgeMaxError;\n cfg.minRegionArea = (int)rcSqr(m_regionMinSize); // Note: area = size*size\n cfg.mergeRegionArea = (int)rcSqr(m_regionMergeSize); // Note: area = size*size\n cfg.maxVertsPerPoly = (int)m_vertsPerPoly;\n cfg.tileSize = (int)m_tileSize;\n cfg.borderSize = cfg.walkableRadius + 3; // Reserve enough padding.\n cfg.width = cfg.tileSize + cfg.borderSize*2;\n cfg.height = cfg.tileSize + cfg.borderSize*2;\n cfg.detailSampleDist = m_detailSampleDist < 0.9f ? 0 : m_cellSize * m_detailSampleDist;\n cfg.detailSampleMaxError = m_cellHeight * m_detailSampleMaxError;\n rcVcopy(cfg.bmin, bmin);\n rcVcopy(cfg.bmax, bmax);\n \n // Tile cache params.\n dtTileCacheParams tcparams;\n memset(&tcparams, 0, sizeof(tcparams));\n rcVcopy(tcparams.orig, bmin);\n tcparams.cs = m_cellSize;\n tcparams.ch = m_cellHeight;\n tcparams.width = (int)m_tileSize;\n tcparams.height = (int)m_tileSize;\n tcparams.walkableHeight = m_agentHeight;\n tcparams.walkableRadius = m_agentRadius;\n tcparams.walkableClimb = m_agentMaxClimb;\n tcparams.maxSimplificationError = m_edgeMaxError;\n tcparams.maxTiles = tw*th*EXPECTED_LAYERS_PER_TILE;\n tcparams.maxObstacles = 128;\n\n dtFreeTileCache(m_tileCache);\n \n m_tileCache = dtAllocTileCache();\n if (!m_tileCache)\n {\n m_ctx->log(RC_LOG_ERROR, \"buildTiledNavigation: Could not allocate tile cache.\");\n return false;\n }\n status = m_tileCache->init(&tcparams, m_talloc, m_tcomp, m_tmproc);\n if (dtStatusFailed(status))\n {\n m_ctx->log(RC_LOG_ERROR, \"buildTiledNavigation: Could not init tile cache.\");\n return false;\n }\n \n dtFreeNavMesh(m_navMesh);\n \n m_navMesh = dtAllocNavMesh();\n if (!m_navMesh)\n {\n m_ctx->log(RC_LOG_ERROR, \"buildTiledNavigation: Could not allocate navmesh.\");\n return false;\n }\n\n dtNavMeshParams params;\n memset(&params, 0, sizeof(params));\n rcVcopy(params.orig, bmin);\n params.tileWidth = m_tileSize*m_cellSize;\n params.tileHeight = m_tileSize*m_cellSize;\n params.maxTiles = m_maxTiles;\n params.maxPolys = m_maxPolysPerTile;\n \n status = m_navMesh->init(&params);\n if (dtStatusFailed(status))\n {\n m_ctx->log(RC_LOG_ERROR, \"buildTiledNavigation: Could not init navmesh.\");\n return false;\n }\n \n status = m_navQuery->init(m_navMesh, 2048);\n if (dtStatusFailed(status))\n {\n m_ctx->log(RC_LOG_ERROR, \"buildTiledNavigation: Could not init Detour navmesh query\");\n return false;\n }\n\n // Preprocess tiles.\n \n m_ctx->resetTimers();\n \n m_cacheLayerCount = 0;\n m_cacheCompressedSize = 0;\n m_cacheRawSize = 0;\n \n for (int y = 0; y < th; ++y)\n {\n for (int x = 0; x < tw; ++x)\n {\n TileCacheData tiles[MAX_LAYERS];\n memset(tiles, 0, sizeof(tiles));\n int ntiles = rasterizeTileLayers(m_ctx, m_geom, x, y, cfg, tiles, MAX_LAYERS);\n\n for (int i = 0; i < ntiles; ++i)\n {\n TileCacheData* tile = &tiles[i];\n status = m_tileCache->addTile(tile->data, tile->dataSize, DT_COMPRESSEDTILE_FREE_DATA, 0);\n if (dtStatusFailed(status))\n {\n dtFree(tile->data);\n tile->data = 0;\n continue;\n }\n \n m_cacheLayerCount++;\n m_cacheCompressedSize += tile->dataSize;\n m_cacheRawSize += calcLayerBufferSize(tcparams.width, tcparams.height);\n }\n }\n }\n\n // Build initial meshes\n m_ctx->startTimer(RC_TIMER_TOTAL);\n for (int y = 0; y < th; ++y)\n for (int x = 0; x < tw; ++x)\n m_tileCache->buildNavMeshTilesAt(x,y, m_navMesh);\n m_ctx->stopTimer(RC_TIMER_TOTAL);\n \n m_cacheBuildTimeMs = m_ctx->getAccumulatedTime(RC_TIMER_TOTAL)/1000.0f;\n m_cacheBuildMemUsage = m_talloc->high;\n \n //--\n /*\n const dtNavMesh* nav = m_navMesh;\n int navmeshMemUsage = 0;\n for (int i = 0; i < nav->getMaxTiles(); ++i)\n {\n const dtMeshTile* tile = nav->getTile(i);\n if (tile->header)\n navmeshMemUsage += tile->dataSize;\n }\n printf(\"navmeshMemUsage = %.1f kB\", navmeshMemUsage/1024.0f);\n */\n m_crowdTool->init(this);\n\n return true;\n}\n\nvoid NavigationManager::update(const float dt)\n{\n m_crowdTool->update(dt);\n\n if (!m_navMesh)\n return;\n if (!m_tileCache)\n return;\n \n m_tileCache->update(dt, m_navMesh);\n}\n\nvoid NavigationManager::getTilePos(const float* pos, int& tx, int& ty)\n{\n if (!m_geom) return;\n \n const float* bmin = m_geom->getNavMeshBoundsMin();\n \n const float ts = m_tileSize*m_cellSize;\n tx = (int)((pos[0] - bmin[0]) / ts);\n ty = (int)((pos[2] - bmin[2]) / ts);\n}\n\nstatic const int TILECACHESET_MAGIC = 'T'<<24 | 'S'<<16 | 'E'<<8 | 'T'; //'TSET';\nstatic const int TILECACHESET_VERSION = 1;\n\nstruct TileCacheSetHeader\n{\n int magic;\n int version;\n int numTiles;\n dtNavMeshParams meshParams;\n dtTileCacheParams cacheParams;\n};\n\nstruct TileCacheTileHeader\n{\n dtCompressedTileRef tileRef;\n int dataSize;\n};\n\nbool NavigationManager::saveAll(const char* path)\n{\n if (!m_tileCache) return false;\n \n FILE* fp = fopen(path, \"wb\");\n if (!fp)\n return false;\n \n // Store header.\n TileCacheSetHeader header;\n header.magic = TILECACHESET_MAGIC;\n header.version = TILECACHESET_VERSION;\n header.numTiles = 0;\n for (int i = 0; i < m_tileCache->getTileCount(); ++i)\n {\n const dtCompressedTile* tile = m_tileCache->getTile(i);\n if (!tile || !tile->header || !tile->dataSize) continue;\n header.numTiles++;\n }\n memcpy(&header.cacheParams, m_tileCache->getParams(), sizeof(dtTileCacheParams));\n memcpy(&header.meshParams, m_navMesh->getParams(), sizeof(dtNavMeshParams));\n fwrite(&header, sizeof(TileCacheSetHeader), 1, fp);\n\n // Store tiles.\n for (int i = 0; i < m_tileCache->getTileCount(); ++i)\n {\n const dtCompressedTile* tile = m_tileCache->getTile(i);\n if (!tile || !tile->header || !tile->dataSize) continue;\n\n TileCacheTileHeader tileHeader;\n tileHeader.tileRef = m_tileCache->getTileRef(tile);\n tileHeader.dataSize = tile->dataSize;\n fwrite(&tileHeader, sizeof(tileHeader), 1, fp);\n\n fwrite(tile->data, tile->dataSize, 1, fp);\n }\n\n fclose(fp);\n return true;\n}\n\nbool NavigationManager::loadAll(const char* path)\n{\n FILE* fp = fopen(path, \"rb\");\n if (!fp) return false;\n\n // Read header.\n TileCacheSetHeader header;\n size_t bytes = fread(&header, sizeof(TileCacheSetHeader), 1, fp);\n APP_ASSERT(bytes != sizeof(TileCacheSetHeader));\n if (header.magic != TILECACHESET_MAGIC)\n {\n fclose(fp);\n return false;\n }\n if (header.version != TILECACHESET_VERSION)\n {\n fclose(fp);\n return false;\n }\n\n m_navMesh = dtAllocNavMesh();\n if (!m_navMesh)\n {\n fclose(fp);\n return false;\n }\n dtStatus status = m_navMesh->init(&header.meshParams);\n if (dtStatusFailed(status))\n {\n fclose(fp);\n return false;\n }\n\n m_tileCache = dtAllocTileCache();\n if (!m_tileCache)\n {\n fclose(fp);\n return false;\n }\n status = m_tileCache->init(&header.cacheParams, m_talloc, m_tcomp, m_tmproc);\n if (dtStatusFailed(status))\n {\n fclose(fp);\n return false;\n }\n\n // Read tiles.\n for (int i = 0; i < header.numTiles; ++i)\n {\n TileCacheTileHeader tileHeader;\n bytes = fread(&tileHeader, sizeof(tileHeader), 1, fp);\n APP_ASSERT(bytes != sizeof(tileHeader));\n if (!tileHeader.tileRef || !tileHeader.dataSize)\n break;\n\n unsigned char* data = (unsigned char*)dtAlloc(tileHeader.dataSize, DT_ALLOC_PERM);\n if (!data) break;\n memset(data, 0, tileHeader.dataSize);\n bytes = fread(data, tileHeader.dataSize, 1, fp);\n APP_ASSERT((long long)(bytes) != tileHeader.dataSize);\n \n dtCompressedTileRef tile = 0;\n m_tileCache->addTile(data, tileHeader.dataSize, DT_COMPRESSEDTILE_FREE_DATA, &tile);\n\n if (tile)\n m_tileCache->buildNavMeshTile(tile, m_navMesh);\n }\n\n fclose(fp);\n return true;\n}\n\nvoid NavigationManager::resetCommonSettings()\n{\n m_cellSize = 0.3f;\n m_cellHeight = 0.2f;\n m_agentHeight = 2.0f;\n m_agentRadius = 0.6f;\n m_agentMaxClimb = 0.9f;\n m_agentMaxSlope = 45.0f;\n m_regionMinSize = 8;\n m_regionMergeSize = 20;\n m_edgeMaxLen = 12.0f;\n m_edgeMaxError = 1.3f;\n m_vertsPerPoly = 6.0f;\n m_detailSampleDist = 6.0f;\n m_detailSampleMaxError = 1.0f;\n m_partitionType = SAMPLE_PARTITION_WATERSHED;\n}\n\nconst float* NavigationManager::getBoundsMin()\n{\n if (!m_geom) return 0;\n return m_geom->getNavMeshBoundsMin();\n}\n\nconst float* NavigationManager::getBoundsMax()\n{\n if (!m_geom) return 0;\n return m_geom->getNavMeshBoundsMax();\n}\n\nvoid NavigationManager::step()\n{\n \n}\n\nbool NavigationManager::load(const char* path)\n{\n updateMaxTiles();\n dtFreeNavMesh(m_navMesh);\n dtFreeTileCache(m_tileCache);\n bool result = loadAll(path);\n m_navQuery->init(m_navMesh, 2048);\n\n m_crowdTool->init(this);\n return result;\n}\n\nvoid NavigationManager::freeNavmesh()\n{\n dtFreeTileCache(m_tileCache);\n m_tileCache = 0;\n\n dtFreeNavMesh(m_navMesh);\n m_navMesh = 0;\n}\n\n// CONVEX VOLUMES: (from Convex Volume Tool)\n// Returns true if 'c' is left of line 'a'-'b'.\ninline bool left(const float* a, const float* b, const float* c)\n{\n const float u1 = b[0] - a[0];\n const float v1 = b[2] - a[2];\n const float u2 = c[0] - a[0];\n const float v2 = c[2] - a[2];\n return u1 * v2 - v1 * u2 < 0;\n}\n\n// Returns true if 'a' is more lower-left than 'b'.\ninline bool cmppt(const float* a, const float* b)\n{\n if (a[0] < b[0]) return true;\n if (a[0] > b[0]) return false;\n if (a[2] < b[2]) return true;\n if (a[2] > b[2]) return false;\n return false;\n}\n// Calculates convex hull on xz-plane of points on 'pts',\n// stores the indices of the resulting hull in 'out' and\n// returns number of points on hull.\nstatic int convexhull(const float* pts, int npts, int* out)\n{\n // Find lower-leftmost point.\n int hull = 0;\n for (int i = 1; i < npts; ++i)\n if (cmppt(&pts[i * 3], &pts[hull * 3]))\n hull = i;\n // Gift wrap hull.\n int endpt = 0;\n int i = 0;\n do\n {\n out[i++] = hull;\n endpt = 0;\n for (int j = 1; j < npts; ++j)\n if (hull == endpt || left(&pts[hull * 3], &pts[endpt * 3], &pts[j * 3]))\n endpt = j;\n hull = endpt;\n } while (endpt != out[0]);\n\n return i;\n}\n\nstatic int pointInPoly(int nvert, const float* verts, const float* p)\n{\n int i, j, c = 0;\n for (i = 0, j = nvert - 1; i < nvert; j = i++)\n {\n const float* vi = &verts[i * 3];\n const float* vj = &verts[j * 3];\n if (((vi[2] > p[2]) != (vj[2] > p[2])) &&\n (p[0] < (vj[0] - vi[0]) * (p[2] - vi[2]) / (vj[2] - vi[2]) + vi[0]))\n c = !c;\n }\n return c;\n}\n\nvoid NavigationManager::removeConvexVolume(float* p)\n{\n if (!m_geom || !m_geom->getMesh())\n {\n return;\n }\n int nearestIndex = -1;\n const ConvexVolume* vols = m_geom->getConvexVolumes();\n for (int i = 0; i < m_geom->getConvexVolumeCount(); ++i)\n {\n if (pointInPoly(vols[i].nverts, vols[i].verts, p) &&\n p[1] >= vols[i].hmin && p[1] <= vols[i].hmax)\n {\n nearestIndex = i;\n }\n }\n // If end point close enough, delete it.\n if (nearestIndex != -1)\n {\n m_geom->deleteConvexVolume(nearestIndex);\n }\n}\n\nvoid NavigationManager::createConvexVolume(float* p)\n{\n if (!m_geom || !m_geom->getMesh())\n {\n return;\n }\n // If clicked on that last pt, create the shape.\n if (m_npts && rcVdistSqr(p, &m_pts[(m_npts - 1) * 3]) < rcSqr(0.2f))\n {\n if (m_nhull > 2)\n {\n // Create shape.\n float verts[MAX_PTS * 3];\n for (int i = 0; i < m_nhull; ++i)\n rcVcopy(&verts[i * 3], &m_pts[m_hull[i] * 3]);\n\n float minh = FLT_MAX, maxh = 0;\n for (int i = 0; i < m_nhull; ++i)\n minh = rcMin(minh, verts[i * 3 + 1]);\n minh -= m_boxDescent;\n maxh = minh + m_boxHeight;\n\n if (m_polyOffset > 0.01f)\n {\n float offset[MAX_PTS * 2 * 3];\n int noffset = rcOffsetPoly(verts, m_nhull, m_polyOffset, offset, MAX_PTS * 2);\n if (noffset > 0)\n m_geom->addConvexVolume(offset, noffset, minh, maxh, (unsigned char)m_areaType);\n }\n else\n {\n m_geom->addConvexVolume(verts, m_nhull, minh, maxh, (unsigned char)m_areaType);\n }\n }\n\n m_npts = 0;\n m_nhull = 0;\n }\n else\n {\n // Add new point \n if (m_npts < MAX_PTS)\n {\n rcVcopy(&m_pts[m_npts * 3], p);\n m_npts++;\n // Update hull.\n if (m_npts > 1)\n m_nhull = convexhull(m_pts, m_npts, m_hull);\n else\n m_nhull = 0;\n }\n }\n}\n\n// Temporary convex volume\nvoid NavigationManager::drawConvexVolume(DebugDrawGL* dd)\n{\n // Find height extents of the shape.\n float minh = FLT_MAX, maxh = 0;\n for (int i = 0; i < m_npts; ++i)\n minh = rcMin(minh, m_pts[i * 3 + 1]);\n minh -= m_boxDescent;\n maxh = minh + m_boxHeight;\n\n dd->begin(DU_DRAW_POINTS, 4.0f);\n for (int i = 0; i < m_npts; ++i)\n {\n unsigned int col = duRGBA(255, 255, 255, 255);\n if (i == m_npts - 1)\n col = duRGBA(240, 32, 16, 255);\n dd->vertex(m_pts[i * 3 + 0], m_pts[i * 3 + 1] + 0.1f, m_pts[i * 3 + 2], col);\n }\n dd->end();\n\n dd->begin(DU_DRAW_LINES, 2.0f);\n for (int i = 0, j = m_nhull - 1; i < m_nhull; j = i++)\n {\n const float* vi = &m_pts[m_hull[j] * 3];\n const float* vj = &m_pts[m_hull[i] * 3];\n dd->vertex(vj[0], minh, vj[2], duRGBA(255, 255, 255, 64));\n dd->vertex(vi[0], minh, vi[2], duRGBA(255, 255, 255, 64));\n dd->vertex(vj[0], maxh, vj[2], duRGBA(255, 255, 255, 64));\n dd->vertex(vi[0], maxh, vi[2], duRGBA(255, 255, 255, 64));\n dd->vertex(vj[0], minh, vj[2], duRGBA(255, 255, 255, 64));\n dd->vertex(vj[0], maxh, vj[2], duRGBA(255, 255, 255, 64));\n }\n dd->end();\n}\n" }, { "alpha_fraction": 0.5090248584747314, "alphanum_fraction": 0.5139062404632568, "avg_line_length": 31.267398834228516, "blob_id": "0997f6103914f6b31104217551de709b3ba80fe5", "content_id": "3062f7379ab8b0944df49e430142ecd17c9a0e03", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 8809, "license_type": "permissive", "max_line_length": 100, "num_lines": 273, "path": "/engine/physics/grit_col_conv.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <cstdlib>\n#include <cerrno>\n#include <cstring>\n\n#include <iostream>\n#include <fstream>\n\n#include <unistd.h>\n#include <sys/types.h>\n#include <sys/stat.h>\n#include <sys/mman.h>\n#include <fcntl.h>\n\n#include <portable_io.h>\n#include \"tcol_parser.h\"\n#include \"bcol_parser.h\"\n\n#define VERSION \"1.0\"\n\nconst char *info =\n\"grit_col_conv (c) Dave Cunningham 2011 (version: \" VERSION \")\\n\"\n\"I convert between tcol and bcol files. The process is not lossless:\\n\"\n\"Some TCOL features are preprocessed on read, such as hull shrinking.\\n\\n\";\n\nconst char *usage =\n\"Usage: colread { <opt> }\\n\\n\"\n\"where <opt> ::= \\\"-v\\\" | \\\"--verbose\\\" increase debug level\\n\"\n\" | \\\"-q\\\" | \\\"--quiet\\\" decrease debug level\\n\"\n\" | \\\"-h\\\" | \\\"--help\\\" this message\\n\\n\"\n\" | \\\"-i\\\" | \\\"--input\\\" <name> input file\\n\"\n\" | \\\"-o\\\" | \\\"--output\\\" <name> output file\\n\"\n\" (ignored if binary col found)\\n\\n\"\n\" | \\\"-B\\\" | \\\"--output-bcol\\\" output binary\\n\"\n\" | \\\"-T\\\" | \\\"--output-tcol\\\" output text (default)\\n\";\n\nstd::string next_arg(int& so_far, int argc, char **argv)\n{\n if (so_far==argc) {\n std::cerr<<\"Ran out of arguments.\"<<std::endl;\n std::cerr<<usage<<std::endl;\n exit(EXIT_FAILURE);\n }\n return argv[so_far++];\n}\n\nvoid app_fatal (void) { abort(); }\n\nCentralisedLog clog;\n\nint main (int argc, char **argv)\n{\n if (argc==1) {\n std::cout<<info<<std::endl;\n std::cout<<usage<<std::endl;\n return EXIT_SUCCESS;\n }\n\n // default parameters\n int debug_level = 0;\n bool output_binary_specified = false;\n bool output_binary = false; // always overwritten\n std::string input_filename;\n std::string output_filename;\n std::string mat_prefix;\n\n int so_far = 1;\n\n while (so_far<argc) {\n std::string arg = next_arg(so_far,argc,argv);\n if (arg==\"-v\" || arg==\"--verbose\") {\n debug_level++;\n } else if (arg==\"-q\" || arg==\"--quiet\") {\n debug_level--;\n } else if (arg==\"-i\" || arg==\"--input\") {\n input_filename = next_arg(so_far,argc,argv);\n } else if (arg==\"-o\" || arg==\"--output\") {\n output_filename = next_arg(so_far,argc,argv);\n } else if (arg==\"-B\" || arg==\"--output-bcol\") {\n output_binary = true;\n output_binary_specified = true;\n } else if (arg==\"-T\" || arg==\"--output-tcol\") {\n output_binary = false;\n output_binary_specified = true;\n } else if (arg==\"-m\" || arg==\"--material-prefix\") {\n mat_prefix = next_arg(so_far,argc,argv);\n } else if (arg==\"-h\" || arg==\"--help\") {\n std::cout<<info<<std::endl;\n std::cout<<usage<<std::endl;\n } else {\n std::cerr<<\"Unrecognised argument: \"<<arg<<std::endl;\n std::cerr<<usage<<std::endl;\n return EXIT_FAILURE;\n }\n }\n\n if (!output_binary_specified) {\n if (output_filename.length()>=5) {\n std::string ext = output_filename.substr(output_filename.length()-5);\n output_binary = ext==\".bcol\" || ext==\".gcol\";\n } else {\n output_binary = false;\n }\n }\n\n std::istream *in = NULL;\n std::ostream *out = NULL;\n\n try {\n\n if (input_filename==\"\" || input_filename==\"-\") {\n in = &std::cin;\n } else {\n std::ifstream *in_ = new std::ifstream();\n in = in_;\n in_->open(input_filename.c_str(), std::ios::binary);\n APP_ASSERT_IO_SUCCESSFUL(*in_,\n \"opening \"+input_filename);\n }\n\n unsigned long fourcc = ios_peek_u32(*in);\n APP_ASSERT_IO_SUCCESSFUL(*in,\"reading fourcc\");\n\n if (output_filename==\"\"||output_filename==\"-\") {\n out = &std::cout;\n } else {\n std::ofstream *out_=new std::ofstream();\n out = out_;\n out_->open(output_filename.c_str(),\n std::ios::binary);\n APP_ASSERT_IO_SUCCESSFUL(*out_,\n \"opening \"+output_filename);\n }\n\n if (fourcc==0x4c4f4354) { //TCOL\n\n TColFile tcol;\n\n quex::tcol_lexer* qlex =\n new quex::tcol_lexer(in);\n parse_tcol_1_0(input_filename,qlex,tcol);\n delete qlex;\n\n if (output_binary) {\n write_tcol_as_bcol(*out, tcol);\n } else {\n pretty_print_tcol(*out,tcol);\n }\n\n } else if (fourcc==0x4c4f4342) { //BCOL\n\n if (in == &std::cin) {\n GRIT_EXCEPT(\"Reading bcol from stdin not implemented (use a file).\");\n return EXIT_FAILURE;\n }\n\n static_cast<std::ifstream*>(in)->close();\n\n const char *in_name = input_filename.c_str();\n\n int fdin = open(in_name, O_RDONLY);\n if (fdin < 0) {\n CERR << \"cannot open: \\\"\"<<in_name<<\"\\\" (\"<<strerror(errno)<<\")\" << std::endl;\n return EXIT_FAILURE;\n }\n /* find size of input file */\n size_t sz;\n {\n struct stat statbuf;\n if (fstat(fdin,&statbuf) < 0) {\n CERR << \"cannot fstat: \\\"\"<<in_name<<\"\\\" (\"<<strerror(errno)<<\")\" << std::endl;\n return EXIT_FAILURE;\n }\n sz = statbuf.st_size;\n }\n\n BColFile *bcol = static_cast<BColFile*>(mmap(NULL, sz, PROT_READ, MAP_SHARED, fdin, 0));\n if (bcol == MAP_FAILED) {\n CERR << \"cannot mmap: \\\"\"<<in_name<<\"\\\" (\"<<strerror(errno)<<\")\"<<std::endl;\n return EXIT_FAILURE;\n }\n\n if (close(fdin)) {\n CERR << \"cannot close: \\\"\"<<in_name<<\"\\\" (\"<<strerror(errno)<<\")\"<<std::endl;\n return EXIT_FAILURE;\n }\n\n if (output_binary) {\n GRIT_EXCEPT(\"Writing a BCol from a BCol not implemented.\");\n return EXIT_FAILURE;\n } else {\n write_bcol_as_tcol(*out, *bcol);\n }\n\n\n if (munmap(bcol, sz)) {\n CERR << \"cannot mummap: \\\"\"<<in_name<<\"\\\" (\"<<strerror(errno)<<\")\"<<std::endl;\n return EXIT_FAILURE;\n }\n\n } else {\n GRIT_EXCEPT(\"Unrecognised fourcc tag.\");\n }\n\n if (in!=&std::cin) delete in;\n if (out!=&std::cout) delete out;\n\n } catch (Exception& e) {\n\n CERR << e << std::endl;\n\n if (in!=&std::cin) delete in;\n if (out!=&std::cout) delete out;\n\n return EXIT_FAILURE;\n\n }\n\n\n\n\n\n\n/*\n\n int fdout = open(out_name, O_RDWR | O_CREAT | O_TRUNC, FILE_MODE);\n if (fdout < 0) {\n std::cerr << \"cannot open: \\\"\"<<out_name<<\"\\\" (\"<<strerror(errno)<<\")\" << std::endl;\n return EXIT_FAILURE;\n }\n\n // go to the location corresponding to the last byte\n if (lseek (fdout, sz - 1, SEEK_SET) == -1)\n std::cerr << \"cannot lseek: \\\"\"<<out_name<<\"\\\" (\"<<strerror(errno)<<\")\" << std::endl;\n return EXIT_FAILURE;\n }\n\n // write a dummy byte at the last location\n if (write (fdout, \"\", 1) != 1)\n err_sys (\"write error\");\n\n char *dst;\n if ((dst = mmap(NULL, sz, PROT_READ | PROT_WRITE, MAP_SHARED, fdout, 0)) == (caddr_t) -1)\n err_sys (\"mmap error for output\");\n\n\n // this copies the input file to the output file\n memcpy (dst, src, statbuf.st_size);\n\n*/\n\n return EXIT_SUCCESS;\n}\n" }, { "alpha_fraction": 0.6231865882873535, "alphanum_fraction": 0.6358488202095032, "avg_line_length": 25.149749755859375, "blob_id": "13aa5b7c8168f4cb87aafb183ed2c1c42b457f67", "content_id": "d0cf112bb337e9978972d447edddc4b0869ef48d", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 15716, "license_type": "permissive", "max_line_length": 117, "num_lines": 601, "path": "/engine/navigation/lua_wrappers_navigation.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include \"lua_wrappers_navigation.h\"\n#include\"navigation_system.h\"\n#include\"navigation.h\"\n#include <iostream>\n#include \"../gfx/lua_wrappers_gfx.h\"\n#include\"../physics/lua_wrappers_physics.h\"\n#include \"../external_table.h\"\n#include \"../lua_ptr.h\"\n#include \"../path_util.h\"\n\n#include \"input_geom.h\"\n\nstatic int navigation_system_update(lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n\n navigation_update(check_float(L, 1));\n\n return 0;\nTRY_END\n}\n\nstatic int navigation_system_update_debug(lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n\n navigation_update_debug(check_float(L, 1));\n\n return 0;\nTRY_END\n}\n\nstatic int navigation_system_reset(lua_State *L)\n{\nTRY_START\n check_args(L, 0);\n nvsys->reset();\n return 0;\nTRY_END\n}\n\nstatic int crowd_move_agents(lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n\n nvsys->set_dest_pos(to_ogre(check_v3(L, 1)));\n\n return 0;\nTRY_END\n}\n\nstatic int global_navigation_add_obj(lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n\n nvsys->addObj(check_string(L, 1));\n\n return 0;\nTRY_END\n}\n\nstatic int global_navigation_add_gfx_body(lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n GET_UD_MACRO(GfxBodyPtr, body, 1, GFXBODY_TAG);\n nvsys->addGfxBody(body);\n return 0;\nTRY_END\n}\n\nstatic int global_navigation_add_gfx_bodies(lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n\n std::vector<GfxBodyPtr> bds;\n\n lua_pushnil(L);\n while (lua_next(L, -2))\n {\n GET_UD_MACRO(GfxBodyPtr, body, -1, GFXBODY_TAG);\n bds.push_back(body);\n lua_pop(L, 1);\n }\n\n lua_pop(L, lua_gettop(L));\n\n nvsys->addGfxBodies(bds);\n return 0;\nTRY_END\n}\n\nstatic int global_navigation_add_rigid_body(lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n GET_UD_MACRO(RigidBody, body, 1, \"Grit/RigidBody\");\n nvsys->addRigidBody(&body);\n return 0;\nTRY_END\n}\n\nstatic int global_add_temp_obstacle(lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n nvsys->addTempObstacle(to_ogre(check_v3(L, 1)));\n return 0;\nTRY_END\n}\n\nstatic int global_remove_temp_obstacle(lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n nvsys->removeTempObstacle(to_ogre(check_v3(L, 1)));\n return 0;\nTRY_END\n}\n\nstatic int global_add_offmesh_connection(lua_State *L)\n{\nTRY_START\n check_args(L, 3);\n nvsys->addOffmeshConection(to_ogre(check_v3(L, 1)), to_ogre(check_v3(L, 2)), check_bool(L, 3));\n return 0;\nTRY_END\n}\n\nstatic int global_remove_offmesh_connection(lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n nvsys->removeOffmeshConection(to_ogre(check_v3(L, 1)));\n return 0;\nTRY_END\n}\n\nstatic int global_build_nav_mesh(lua_State *L)\n{\nTRY_START\n check_args(L, 0);\n nvsys->buildNavMesh();\n return 0;\nTRY_END\n}\n\nconst char* getfield_string(lua_State *L, const char *key) {\n const char* result;\n lua_pushstring(L, key);\n lua_gettable(L, -2);\n\n result = (const char*)lua_tostring(L, -1);\n lua_pop(L, 1);\n return result;\n}\n\nint getfield_int(lua_State *L, const char *key) {\n int result;\n lua_pushstring(L, key);\n lua_gettable(L, -2);\n\n result = (int)lua_tonumber(L, -1);\n lua_pop(L, 1);\n return result;\n}\n\nfloat getfield_float(lua_State *L, const char *key) {\n float result;\n lua_pushstring(L, key);\n lua_gettable(L, -2);\n\n result = (float)lua_tonumber(L, -1);\n lua_pop(L, 1);\n return result;\n}\n\nbool getfield_bool(lua_State *L, const char *key) {\n bool result;\n lua_pushstring(L, key);\n lua_gettable(L, -2);\n\n result = (bool)lua_toboolean(L, -1);\n lua_pop(L, 1);\n return result;\n}\n\nstatic int global_navigation_update_params(lua_State *L)\n{\nTRY_START\n check_args(L, 0);\n\n lua_getglobal(L, \"nav_builder_params\");\n\n nvsys->getNavigationManager()->setCellSize(getfield_float(L, \"cellSize\"));\n nvsys->getNavigationManager()->setCellHeight(getfield_float(L, \"cellHeight\"));\n\n nvsys->getNavigationManager()->setAgentHeight(getfield_float(L, \"agentHeight\"));\n nvsys->getNavigationManager()->setAgentRadius(getfield_float(L, \"agentRadius\"));\n nvsys->getNavigationManager()->setAgentMaxClimb(getfield_float(L, \"agentMaxClimb\"));\n nvsys->getNavigationManager()->setAgentMaxSlope(getfield_float(L, \"agentMaxSlope\"));\n\n nvsys->getNavigationManager()->setRegionMinSize(getfield_float(L, \"regionMinSize\"));\n nvsys->getNavigationManager()->setRegionMergeSize(getfield_float(L, \"regionMergeSize\"));\n\n nvsys->getNavigationManager()->setPartitionType(getfield_int(L, \"partitionType\"));\n\n nvsys->getNavigationManager()->setEdgeMaxLen(getfield_float(L, \"edgeMaxLen\"));\n nvsys->getNavigationManager()->setEdgeMaxError(getfield_float(L, \"edgeMaxError\"));\n nvsys->getNavigationManager()->setVertsPerPoly(getfield_float(L, \"vertsPerPoly\"));\n\n nvsys->getNavigationManager()->setDetailSampleDist(getfield_float(L, \"detailSampleDist\"));\n nvsys->getNavigationManager()->setDetailSampleMaxError(getfield_float(L, \"detailSampleMaxError\"));\n nvsys->getNavigationManager()->setKeepInterResults(getfield_bool(L, \"keepInterResults\"));\n\n nvsys->getNavigationManager()->setTileSize(getfield_float(L, \"tileSize\"));\n\n return 0;\nTRY_END\n}\n\nstatic int global_navigation_nearest_point_on_navmesh(lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n\n dtPolyRef m_targetRef;\n\n Ogre::Vector3 resPoint;\n\n bool found = nvsys->findNearestPointOnNavmesh(swap_yz(to_ogre(check_v3(L, 1))), m_targetRef, resPoint);\n if (found)\n {\n push_v3(L, from_ogre(swap_yz(resPoint)));\n lua_pushinteger(L, m_targetRef);\n return 2;\n }\n else {\n lua_pushnil(L);\n return 1;\n }\nTRY_END\n}\n\nstatic int global_navigation_random_navmesh_point(lua_State *L)\n{\nTRY_START\n check_args(L, 0);\n\n Ogre::Vector3 resPoint;\n\n bool found = nvsys->getRandomNavMeshPoint(resPoint);\n if (found)\n {\n push_v3(L, from_ogre(swap_yz(resPoint)));\n return 1;\n }\n else {\n lua_pushnil(L);\n return 1;\n }\nTRY_END\n}\n\nstatic int global_navigation_random_navmesh_point_in_circle(lua_State *L)\n{\nTRY_START\n check_args(L, 2);\n\n Ogre::Vector3 resPoint;\n\n bool found = nvsys->getRandomNavMeshPointInCircle(swap_yz(to_ogre(check_v3(L, 1))), check_float(L, 2), resPoint);\n if (found)\n {\n push_v3(L, from_ogre(swap_yz(resPoint)));\n return 1;\n }\n else {\n lua_pushnil(L);\n return 1;\n }\nTRY_END\n}\n\nstatic int global_navigation_debug_option(lua_State *L)\n{\nTRY_START\n if (lua_gettop(L) == 1)\n {\n const char *key = luaL_checkstring(L, 1);\n if (!::strcmp(key, \"enabled\")) {\n lua_pushboolean(L, NavSysDebug::Enabled);\n }\n else if (!::strcmp(key, \"navmesh\")) {\n lua_pushboolean(L, NavSysDebug::ShowNavmesh);\n }\n else if (!::strcmp(key, \"navmesh_use_tile_colours\")) {\n lua_pushboolean(L, NavSysDebug::NavmeshUseTileColours);\n }\n else if (!::strcmp(key, \"bounds\")) {\n lua_pushboolean(L, NavSysDebug::ShowBounds);\n }\n else if (!::strcmp(key, \"tiling_grid\")) {\n lua_pushboolean(L, NavSysDebug::ShowTilingGrid);\n }\n else if (!::strcmp(key, \"agent\")) {\n lua_pushboolean(L, NavSysDebug::ShowAgents);\n }\n else if (!::strcmp(key, \"agent_arrows\")) {\n lua_pushboolean(L, NavSysDebug::ShowAgentArrows);\n }\n else if (!::strcmp(key, \"convex_volumes\")) {\n lua_pushboolean(L, NavSysDebug::ShowConvexVolumes);\n }\n else if (!::strcmp(key, \"obstacles\")) {\n lua_pushboolean(L, NavSysDebug::ShowObstacles);\n }\n else if (!::strcmp(key, \"offmesh_connections\")) {\n lua_pushboolean(L, NavSysDebug::ShowOffmeshConnections);\n }\n else {\n my_lua_error(L, \"Invalid Attribute: \" + std::string(key));\n }\n return 1;\n }\n else if (lua_gettop(L) == 2)\n {\n const char *key = luaL_checkstring(L, 1);\n if (!::strcmp(key, \"enabled\")) {\n bool b = check_bool(L, 2);\n NavSysDebug::Enabled = b;\n }\n else if (!::strcmp(key, \"navmesh\")) {\n bool b = check_bool(L, 2);\n NavSysDebug::ShowNavmesh = b;\n }\n else if (!::strcmp(key, \"navmesh_use_tile_colours\")) {\n bool b = check_bool(L, 2);\n NavSysDebug::NavmeshUseTileColours = b;\n }\n else if (!::strcmp(key, \"bounds\")) {\n bool b = check_bool(L, 2);\n NavSysDebug::ShowBounds = b;\n }\n else if (!::strcmp(key, \"tiling_grid\")) {\n bool b = check_bool(L, 2);\n NavSysDebug::ShowTilingGrid = b;\n }\n else if (!::strcmp(key, \"agent\")) {\n bool b = check_bool(L, 2);\n NavSysDebug::ShowAgents = b;\n }\n else if(!::strcmp(key, \"agent_arrows\")) {\n bool b = check_bool(L, 2);\n NavSysDebug::ShowAgentArrows = b;\n }\n else if (!::strcmp(key, \"convex_volumes\")) {\n bool b = check_bool(L, 2);\n NavSysDebug::ShowConvexVolumes = b;\n }\n else if (!::strcmp(key, \"obstacles\")) {\n bool b = check_bool(L, 2);\n NavSysDebug::ShowObstacles = b;\n }\n else if (!::strcmp(key, \"offmesh_connections\")) {\n bool b = check_bool(L, 2);\n NavSysDebug::ShowOffmeshConnections = b;\n }\n else {\n my_lua_error(L, \"Invalid Option: \" + std::string(key));\n }\n }\n return 0;\nTRY_END\n}\n\nstatic int global_navigation_save_navmesh(lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n lua_pushboolean(L, nvsys->saveNavmesh(check_string(L, 1)));\n return 1;\nTRY_END\n}\n\nstatic int global_navigation_load_navmesh(lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n lua_pushboolean(L, nvsys->loadNavmesh(check_string(L, 1)));\n return 1;\nTRY_END\n}\n\nstatic int global_navigation_navmesh_loaded(lua_State *L)\n{\nTRY_START\n check_args(L, 0);\n lua_pushboolean(L, nvsys->anyNavmeshLoaded());\n return 1;\nTRY_END\n}\n\nstatic int global_add_convex_volume_point(lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n nvsys->createConvexVolume(to_ogre(check_v3(L, 1)));\n return 0;\nTRY_END\n}\n\nstatic int global_remove_convex_volume(lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n nvsys->removeConvexVolume(to_ogre(check_v3(L, 1)));\n return 0;\nTRY_END\n}\n\nstatic const luaL_reg global_navigation[] = {\n { \"navigation_add_obj\", global_navigation_add_obj },\n { \"navigation_add_gfx_body\", global_navigation_add_gfx_body },\n { \"navigation_add_gfx_bodies\", global_navigation_add_gfx_bodies },\n { \"navigation_add_rigid_body\", global_navigation_add_rigid_body },\n\n { \"navigation_update\", navigation_system_update },\n { \"navigation_update_debug\", navigation_system_update_debug },\n { \"navigation_reset\", navigation_system_reset },\n\n { \"navigation_navmesh_loaded\", global_navigation_navmesh_loaded },\n\n { \"crowd_move_to\", crowd_move_agents },\n { \"navigation_add_obstacle\", global_add_temp_obstacle },\n { \"navigation_remove_obstacle\", global_remove_temp_obstacle },\n { \"navigation_add_offmesh_connection\", global_add_offmesh_connection },\n\n { \"navigation_add_convex_volume_point\", global_add_convex_volume_point },\n { \"navigation_remove_convex_volume\", global_remove_convex_volume },\n\n { \"navigation_remove_offmesh_connection\", global_remove_offmesh_connection },\n { \"navigation_build_nav_mesh\", global_build_nav_mesh },\n { \"navigation_update_params\", global_navigation_update_params },\n { \"navigation_nearest_point_on_navmesh\", global_navigation_nearest_point_on_navmesh },\n\n { \"navigation_random_navmesh_point\", global_navigation_random_navmesh_point },\n { \"navigation_random_navmesh_point_in_circle\", global_navigation_random_navmesh_point_in_circle },\n\n { \"navigation_debug_option\", global_navigation_debug_option },\n { \"navigation_save_navmesh\", global_navigation_save_navmesh },\n { \"navigation_load_navmesh\", global_navigation_load_navmesh },\n\n { NULL, NULL }\n};\n\nstatic int agent_add(lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n lua_pushinteger(L, nvsys->addAgent(to_ogre(check_v3(L, 1))));\n return 1;\nTRY_END\n}\n\nstatic int agent_remove(lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n nvsys->removeAgent(check_int(L, 1, 0, 256));\n return 0;\nTRY_END\n}\n\nstatic int agent_active(lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n lua_pushboolean(L, nvsys->isAgentActive(check_int(L, 1, 0, 256)));\n return 1;\nTRY_END\n}\n\nstatic int agent_stop(lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n nvsys->agentStop(check_int(L, 1, 0, 256));\n return 0;\nTRY_END\n}\n\nstatic int agent_position(lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n push_v3(L, from_ogre(nvsys->getAgentPosition(check_int(L, 1, 0, 256))));\n return 1;\nTRY_END\n}\n\nstatic int agent_velocity(lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n push_v3(L, from_ogre(nvsys->getAgentVelocity(check_int(L, 1, 0, 256))));\n return 1;\nTRY_END\n}\n\nstatic int agent_request_velocity(lua_State *L)\n{\nTRY_START\n check_args(L, 2);\n nvsys->agentRequestVelocity(check_int(L, 1, 0, 256), to_ogre(check_v3(L, 2)));\n return 0;\nTRY_END\n}\n\nstatic int agent_move_target(lua_State *L)\n{\nTRY_START\n check_args(L, 3);\n nvsys->setAgentMoveTarget(check_int(L, 1, 0, 256), to_ogre(check_v3(L, 2)), check_bool(L, 3));\n return 0;\nTRY_END\n}\n\nstatic int agent_distance_to_goal(lua_State *L)\n{\nTRY_START\n check_args(L, 2);\n lua_pushnumber(L, nvsys->getDistanceToGoal(check_int(L, 1, 0, 256), check_float(L, 2)));\n return 1;\nTRY_END\n}\n\nstatic int agent_height(lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n lua_pushnumber(L, nvsys->getAgentHeight(check_int(L, 1, 0, 256)));\n return 1;\nTRY_END\n}\n\nstatic int agent_radius(lua_State *L)\n{\nTRY_START\n check_args(L, 1);\n lua_pushnumber(L, nvsys->getAgentRadius(check_int(L, 1, 0, 256)));\n return 1;\nTRY_END\n}\n\nstatic const luaL_reg global_agent[] = {\n { \"agent_make\", agent_add },\n { \"agent_destroy\", agent_remove },\n { \"agent_active\", agent_active },\n { \"agent_stop\", agent_stop },\n { \"agent_position\", agent_position },\n { \"agent_velocity\", agent_velocity },\n { \"agent_request_velocity\", agent_request_velocity },\n { \"agent_move_target\", agent_move_target },\n { \"agent_distance_to_goal\", agent_distance_to_goal },\n { \"agent_height\", agent_height },\n { \"agent_radius\", agent_radius },\n { NULL, NULL }\n};\n\nvoid navigation_lua_init(lua_State *L)\n{\n register_lua_globals(L, global_navigation);\n register_lua_globals(L, global_agent);\n}\n" }, { "alpha_fraction": 0.6413317918777466, "alphanum_fraction": 0.6461538672447205, "avg_line_length": 53.42499923706055, "blob_id": "6e0a48112ab39a687a6419cf15d7a739d4e959dc", "content_id": "e75c9c86b2f8a30e7aaa4b993aa9658bab19371f", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 4355, "license_type": "permissive", "max_line_length": 106, "num_lines": 80, "path": "/dependencies/quex-0.34.1/quex/core_engine/state_machine/nfa_to_dfa.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "from quex.core_engine.state_machine.core import StateMachine\nfrom quex.core_engine.state_machine.index import map_state_combination_to_index\n\ndef do(SM):\n \"\"\"Creates a deterministic finite automaton (DFA) from the current state \n machine - which may be a NFA (non-deterministic finite automaton). This is\n a generlized version of the 'subset construction' algorithm. Where \n subsection construction focusses on letters of an alphabet for the\n investigation of transitions, this algorithm focusses on elementary\n trigger sets. A very good description of the subset construction \n algorithm can be found in 'Engineering a Compiler' by Keith Cooper.\n \"\"\"\n # (*) create the result state machine\n initial_state_epsilon_closure = SM.get_epsilon_closure(SM.init_state_index) \n\n # NOTE: Later on, state machines with an initial acceptance state are forbidden.\n # So, acceptance is not a question here. Think about setting it to false anyway.\n result = StateMachine(Core = SM.core())\n\n # (*) initial state of resulting DFA = epsilon closure of initial state of NFA\n # -- add the origin list of all states in the epsilon closure\n new_init_state = result.get_init_state()\n for state in map(lambda idx: SM.states[idx], initial_state_epsilon_closure):\n new_init_state.merge(state)\n\n # (*) prepare the initial worklist\n worklist = [ ( result.init_state_index, initial_state_epsilon_closure) ]\n\n while worklist != []:\n # 'start_state_index' is the index of an **existing** state in the state machine.\n # It was either created above, in StateMachine's constructor, or as a target\n # state index.\n start_state_index, start_state_combination = worklist.pop()\n \n # (*) compute the elementary trigger sets together with the \n # epsilon closure of target state combinations that they trigger to.\n # In other words: find the ranges of characters where the state triggers to\n # a unique state combination. E.g:\n # Range Target State Combination \n # [0:23] --> [ State1, State2, State10 ]\n # [24:60] --> [ State1 ]\n # [61:123] --> [ State2, State10 ]\n #\n elementary_trigger_set_infos = SM.get_elementary_trigger_sets(start_state_combination)\n ## DEBUG_print(start_state_combination, elementary_trigger_set_infos)\n\n # (*) loop over all elementary trigger sets\n for epsilon_closure_of_target_state_combination, trigger_set in elementary_trigger_set_infos:\n # -- if there is no trigger to the given target state combination, then drop it\n if trigger_set.is_empty(): continue\n\n # -- add a new target state representing the state combination\n # (if this did not happen yet)\n target_state_index = \\\n map_state_combination_to_index(epsilon_closure_of_target_state_combination)\n\n # -- if target state combination was not considered yet, then create \n # a new state in the state machine\n if result.states.has_key(target_state_index):\n # -- add only a transition 'start state to target state'\n result.add_transition(start_state_index, trigger_set, target_state_index)\n else:\n # -- add the transition 'start state to target state'\n # (create implicitly the new target state in the state machine)\n result.add_transition(start_state_index, trigger_set, target_state_index)\n # -- merge informations of combined states inside the target state\n new_target_state = result.states[target_state_index]\n for state in map(lambda idx: SM.states[idx], epsilon_closure_of_target_state_combination):\n new_target_state.merge(state)\n\n worklist.append((target_state_index, epsilon_closure_of_target_state_combination)) \n\n return result \n\ndef DEBUG_print(start_state_combination, elementary_trigger_list):\n print \"----\"\n print \"StartStateCombination:\", start_state_combination\n for ti, trigger_set in elementary_trigger_list:\n print \"trigger set =\", trigger_set.get_utf8_string(), \"target =\", ti \n print \"----\"\n\n" }, { "alpha_fraction": 0.6866881251335144, "alphanum_fraction": 0.6877170205116272, "avg_line_length": 34.82949447631836, "blob_id": "9033a1806590c74960c17bec025865b5d05ad400", "content_id": "96d83928dab492cacacbd7a379ded433a3a41170", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 7775, "license_type": "permissive", "max_line_length": 92, "num_lines": 217, "path": "/engine/input_filter.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#ifndef INPUT_FILTER_H\n#define INPUT_FILTER_H\n\n#include <map>\n#include <set>\n#include <string>\n\nextern \"C\" {\n #include \"lua.h\"\n #include <lauxlib.h>\n #include <lualib.h>\n}\n\n#include \"lua_ptr.h\"\n\n// Menu (binds escape)\n// * goes into modal to display menu (disable player_ctrl and tab stuff)\n// * never captures mouse\n// * changes hud to display menu screen (highest z order)\n// * menu screen hud bindings for up/down, enter, etc\n// * menu screen hud support for text entry \"player name\" fields, etc\n// * other hud elements not focussed, or obscured by screen rectangle\n// Debug (binds tab)\n// * goes into modal when tab pressed\n// * changes enable status of console, etc\n// * never captures mouse\n// * can handle screenshot and simple things also, e.g. physics pause,\n// any global bindings that work in debug mode\n// * can be disabled to disallow cheating\n// Playing General\n// * just game binds, set up by configuration.lua\n// * captures mouse, dispatches through controlObj stuff\n// * understands 'f' key, controls foot/driving/flying/ghosting enablement\n// Playing on foot\n// * movement, firing, etc\n// Playing driving\n// * movement\n// Playing flying\n// Playing ghosting\n// Implicit HUD\n\nclass InputFilter {\n\n public:\n\n struct Callback {\n LuaPtr down;\n LuaPtr up;\n LuaPtr repeat;\n };\n\n typedef std::map<std::string, std::string> ButtonStatus;\n typedef std::map<std::string, Callback> CallbackMap;\n typedef std::set<std::string> BindingSet;\n\n private:\n\n /** Keys that we sent a down signal for, but not an up yet. These must be\n * \"flushed\" in certain circumstances, such as when as when we are disabled, or\n * if an earlier input filter goes modal. Each down button is mapped\n * to the prefix of modifiers that were down at the time of it being pressed.\n * These allow the button up events to be matched to button down events\n * properly, even if the modifier was released between the down and up events.\n */\n ButtonStatus down;\n\n bool modal;\n bool enabled;\n bool mouseCapture;\n\n /** The keys of this map can be things like C-A-S-Space meaning\n * ctrl+alt+shift+space.\n */\n CallbackMap buttonCallbacks;\n\n LuaPtr mouseMoveCallback;\n\n bool destroyed;\n\n void ensureAlive() {\n if (!destroyed) return;\n EXCEPT << \"InputFilter \\\"\"<<description<<\"\\\" destroyed.\" << ENDL;\n }\n\n public:\n\n const double order;\n\n const std::string description;\n\n /** Give the initial order, and a string description (useful for debugging). */\n InputFilter (double order, const std::string &desc);\n\n ~InputFilter (void);\n\n /** Has anyone called destroy yet? */\n bool isAlive (void) { return !destroyed; };\n \n /** Unlink all the Lua callbacks. */\n void destroy (lua_State *L);\n \n /** Bind callbacks to a specific key. Expects the stack to contain 3\n * things. First thing must be a function and is the 'down' callback. Second\n * thing can be nil or a function and is the 'up' callback. Third thing can be\n * nil, true, or a function and is the 'repeat' callback (true means to use the\n * 'down' callback for this as well). The button name is given without +-:\n * prefix. It can have a C-A-S- prefix, e.g. C-A-T for ctrl+alt, or S-V for\n * shift+V.\n */\n void bind (lua_State *L, const std::string &button);\n\n /** The given key no-longer triggers callbacks and falls to the next filter. The\n * button is given in the same form as in bind.\n */\n void unbind (lua_State *L, const std::string &button);\n\n /** Receive mouse move events. This callback is called if this InputFilter\n * has locked the mouse and no earlier ones have done so.\n */\n void setMouseMoveCallback (lua_State *L);\n\n bool getEnabled (void) { return enabled; }\n\n /** Will trigger events at lower levels or this level. */\n void setEnabled (lua_State *L, bool v);\n\n bool getModal (void) { return modal; }\n\n /** Will effectively disable all lower levels. */\n void setModal (lua_State *L, bool v);\n\n bool getMouseCapture (void) { return mouseCapture; }\n\n /** Will hide the mouse cursor and we will get mouse move events instead of\n * the HUD.\n */\n void setMouseCapture (lua_State *L, bool v);\n\n /** Test for whether a given button is down at this time from the\n * perspective of this filter. The button is given without +-:= prefix.\n */\n bool isButtonPressed (const std::string &b);\n\n /** Get a list of all key-bindings in this InputFilter.\n */\n std::vector<std::string> allBinds(void);\n\n /** For internal use. */\n bool acceptButton (lua_State *L, const std::string &b);\n void triggerFunc (lua_State *L, const std::string &button, const LuaPtr &func);\n void triggerMouseMove (lua_State *L, const Vector2 &abs);\n void flushAll (lua_State *L);\n void flushSet (lua_State *L, const BindingSet &s);\n bool isBound (const std::string &b);\n\n};\n\n/** Does there exist an InputFilter at this order? */\nbool input_filter_has (double order);\n\n/** Get the description at this order, or throw exception. */\nstd::string input_filter_get_description (double order);\n\n/** Destroy a given input filter. This can be useful if you've lost the pointer to it. */\nstd::string input_filter_destroy (double order);\n\n/** Issue button events to the appropriate level of the stack or the HUD. */\nvoid input_filter_trickle_button (lua_State *L, const std::string &ev);\n\n/** Issue mouse move events to the appropriate level of the stack or the HUD. */\nvoid input_filter_trickle_mouse_move (lua_State *L, const Vector2 &rel, const Vector2 &abs);\n\n/** Is the given button down (globally). */\nbool input_filter_pressed (const std::string &button);\n\n/** Issue button up events to anyone who believes a key is down. This is used\n * when losing focus from the game window and similar situations when we can\n * expect to fundamentally lose input events for a period of time. */\nvoid input_filter_flush (lua_State *L);\n\n/** Return a list of all the input filters in existence. */\nstd::vector<std::pair<double, std::string>> input_filter_list (void);\n\n/** Suppress system mouse cursor. The system mouse cursor is usually more\n * responsive than anything you can render in game. However, if the style is\n * disagreeable it can be hidden, and you can draw your own instead.\n*/\nvoid input_filter_set_cursor_hidden (bool v);\n\n/** Is the system mouse cursor suppressed? */\nbool input_filter_get_cursor_hidden (void);\n\n/** Shutdown Lua state. */\nvoid input_filter_shutdown (lua_State *L);\n\n#endif\n" }, { "alpha_fraction": 0.6306195259094238, "alphanum_fraction": 0.6317009329795837, "avg_line_length": 47.66917419433594, "blob_id": "96c566ae8d30e18be1154c170a8b4174941b1b9f", "content_id": "a58cc9023c2e275dc45590726402e0ef7454ebf5", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 6473, "license_type": "permissive", "max_line_length": 107, "num_lines": 133, "path": "/dependencies/quex-0.34.1/quex/core_engine/state_machine/setup_post_context.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "#! /usr/bin/env python\nimport sys\nfrom quex.frs_py.file_in import error_msg\nfrom quex.core_engine.state_machine.core import *\nimport quex.core_engine.state_machine.ambiguous_post_context as apc\n\n\ndef do(the_state_machine, post_context_sm, DEMONSTRATION_TurnOffSpecialSolutionF=False, fh=-1):\n \"\"\" Appends a post context to the given state machine. This process is very\n similar to sequentialization. There is a major difference, though:\n \n Given a state machine (e.g. a pattern) X with a post context Y, \n a match is only valid if X is followed by Y. Let Xn be an acceptance\n state of X and Ym an acceptance state of Y: \n\n ---(Xn-1)---->(Xn)---->(Y0)----> ... ---->((Ym))\n store acceptance\n input\n position\n \n That is, it holds:\n\n -- The next input position is stored the position of Xn, even though\n it is 'officially' not an acceptance state.\n\n -- Ym will be an acceptance state, but it will not store \n the input position! \n\n The analysis of the next pattern will start at the position where\n X stopped, even though Ym is required to state acceptance. \n \n \"\"\"\n # (*) do some consistency checking \n assert the_state_machine.__class__.__name__ == \"StateMachine\", \\\n \"expected 1st argument as objects of class StateMachine\\n\" + \\\n \"received: \" + the_state_machine.__class__.__name__\n assert post_context_sm.__class__.__name__ == \"StateMachine\", \\\n \"expected 2nd argument as objects of class StateMachine\\n\" + \\\n \"received: \" + post_context_sm.__class__.__name__\n assert the_state_machine.core().post_context_id() == -1L, \\\n \"post context state machine cannot be post-context again.\"\n\n # -- state machines with no states are senseless here. \n assert not the_state_machine.is_empty(), \\\n \"empty state machine can have no post context.\"\n assert not post_context_sm.is_empty(), \\\n \"empty state machine cannot be a post-context.\"\n\n # -- state machines involved with post condition building are part of a pattern, \n # but not configured out of multiple patterns. Thus there should be no origins.\n assert the_state_machine.has_origins() == False\n assert post_context_sm.has_origins() == False\n\n # -- a post context with an initial state that is acceptance is not\n # really a 'context' since it accepts anything. The state machine remains\n # un-post context.\n if post_context_sm.get_init_state().is_acceptance():\n error_msg(\"Post context accepts anything---replaced by no post context.\", fh, \n DontExitF=True)\n return the_state_machine\n \n # (*) Two ways of handling post-contexts:\n #\n # -- Seldom Exception: \n # Pseudo-Ambiguous Post Conditions (x+/x) -- detecting the end of the \n # core pattern after the end of the post context\n # has been reached.\n #\n if not DEMONSTRATION_TurnOffSpecialSolutionF:\n if apc.detect_forward(the_state_machine, post_context_sm):\n if apc.detect_backward(the_state_machine, post_context_sm):\n # -- for post contexts that are forward and backward ambiguous\n # a philosophical cut is necessary.\n error_msg(\"Post context requires philosophical cut---this operation is not reliable.\", fh, \n DontExitF=True)\n post_context_sm = apc.philosophical_cut(the_state_machine, post_context_sm)\n\n apc.mount(the_state_machine, post_context_sm)\n return the_state_machine\n\n # -- The 'normal' way: storing the input position at the end of the core\n # pattern.\n #\n result = the_state_machine\n # (*) need to clone the state machines, i.e. provide their internal\n # states with new ids, but the 'behavior' remains. This allows\n # state machines to appear twice, or being used in 'larger'\n # conglomerates.\n post_clone = post_context_sm.clone() \n\n # (*) collect all transitions from both state machines into a single one\n #\n # NOTE: The start index is unique. Therefore, one can assume that each\n # clone_list '.states' dictionary has different keys. One can simply\n # take over all transitions of a start index into the result without\n # considering interferences (see below)\n #\n orig_acceptance_state_id_list = result.get_acceptance_state_index_list()\n\n # -- mount on every acceptance state the initial state of the following state\n # machine via epsilon transition\n result.mount_to_acceptance_states(post_clone.init_state_index, CancelStartAcceptanceStateF=True)\n for start_state_index, state in post_clone.states.items(): \n result.states[start_state_index] = state # states are already cloned\n\n # -- consider the pre-context, it has to be moved to the acceptance state\n # -- same for trivial pre-contexts \n post_context_id = the_state_machine.core().id()\n pre_context_sm = the_state_machine.core().pre_context_sm()\n pre_context_sm_id = the_state_machine.core().pre_context_sm_id()\n pre_context_begin_of_line_f = the_state_machine.core().pre_context_begin_of_line_f() \n\n # -- raise at each old acceptance state the 'store input position flag'\n # -- set the post context flag for all acceptance states\n for state_idx in orig_acceptance_state_id_list:\n state = result.states[state_idx]\n state.core().set_store_input_position_f(True)\n state.core().set_post_context_id(post_context_id)\n state.core().set_pre_context_id(-1L) \n \n # -- no acceptance state shall store the input position\n # -- set the post context flag for all acceptance states\n for state in result.get_acceptance_state_list():\n state.core().set_store_input_position_f(False)\n state.core().set_post_context_id(post_context_id)\n state.core().set_pre_context_id(pre_context_sm_id) \n\n # -- information about the pre-context remains\n result.core().set_pre_context_begin_of_line_f(pre_context_begin_of_line_f)\n result.core().set_pre_context_sm(pre_context_sm)\n result.core().set_post_context_id(post_context_id)\n\n return result\n" }, { "alpha_fraction": 0.39945322275161743, "alphanum_fraction": 0.41063183546066284, "avg_line_length": 38.95145797729492, "blob_id": "b18fa59e58b34de33abbf92142522c6f5c91c961", "content_id": "ad597e6c72f3e74d3178ddd8425a135dd7168056", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 16460, "license_type": "permissive", "max_line_length": 97, "num_lines": 412, "path": "/gtasa/iplread.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <cmath>\n#include <cerrno>\n#include <string>\n#include <sstream>\n#include <vector>\n#include <iostream>\n#include <fstream>\n#include <algorithm>\n#include <locale>\n\n#include \"ios_util.h\"\n\n#include <console.h>\n\n#include \"iplread.h\"\n#include \"csvread.h\"\n\n\nstatic int tolowr (int c)\n{\n return std::tolower(char(c),std::cout.getloc());\n}\n\nstatic std::string& strlower (std::string& s)\n{\n std::transform(s.begin(),s.end(), s.begin(),tolowr);\n return s;\n}\n\nstatic std::string& str_lcase_crop (std::string& str)\n{\n strlower(str);\n std::string::size_type b=str.find_first_not_of(' ');\n std::string::size_type e=str.find_last_not_of(' ');\n str = str.substr(b,e+1);\n return str;\n}\n\n\n\nvoid IPL::addBinary (std::istream &f)\n{\n unsigned long fourcc = ios_read_u32(f);\n APP_ASSERT(fourcc==0x79726e62); // \"bnry\"\n unsigned long num_insts = ios_read_u32(f);\n unsigned long num_unk1 = ios_read_u32(f);\n unsigned long num_unk2 = ios_read_u32(f);\n unsigned long num_unk3 = ios_read_u32(f);\n unsigned long num_vehicles = ios_read_u32(f);\n unsigned long num_unk4 = ios_read_u32(f);\n\n unsigned long inst_offset = ios_read_u32(f);\n unsigned long zero = ios_read_u32(f);\n APP_ASSERT(zero==0);\n unsigned long unk1_offset = ios_read_u32(f);\n zero = ios_read_u32(f);\n APP_ASSERT(zero==0);\n unsigned long unk2_offset = ios_read_u32(f);\n zero = ios_read_u32(f);\n APP_ASSERT(zero==0);\n unsigned long unk3_offset = ios_read_u32(f);\n zero = ios_read_u32(f);\n APP_ASSERT(zero==0);\n unsigned long vehicles_offset = ios_read_u32(f);\n zero = ios_read_u32(f);\n APP_ASSERT(zero==0);\n unsigned long unk4_offset = ios_read_u32(f);\n zero = ios_read_u32(f);\n APP_ASSERT(zero==0);\n\n APP_ASSERT(inst_offset==76);\n\n (void) num_unk1;\n (void) num_unk2;\n (void) num_unk3;\n (void) num_unk4;\n (void) num_vehicles;\n\n (void) unk1_offset;\n (void) unk2_offset;\n (void) unk3_offset;\n (void) unk4_offset;\n (void) vehicles_offset;\n\n for (unsigned long i=0 ; i<num_insts ; i++) {\n Inst inst;\n inst.is_low_detail = false;\n inst.dff = \"\";\n inst.x = ios_read_float(f);\n inst.y = ios_read_float(f);\n inst.z = ios_read_float(f);\n inst.rx = ios_read_float(f);\n inst.ry = ios_read_float(f);\n inst.rz = ios_read_float(f);\n inst.rw = -ios_read_float(f);\n inst.id = ios_read_u32(f);\n inst.interior = ios_read_u32(f);\n inst.near_for = ios_read_u32(f);\n //APP_ASSERT(inst.near_for==0);\n insts.push_back(inst);\n }\n\n for (size_t i=0 ; i<insts.size() ; i++) {\n Inst& inst = insts[i];\n if (inst.near_for==-1) continue;\n if (inst.near_for<0 || (size_t)inst.near_for>=insts.size()) {\n std::cerr<<\"Invalid lod index at instance \"<<i\n <<\": \"<<inst.near_for<<\"\\n\";\n continue;\n }\n insts[inst.near_for].is_low_detail = true;\n }\n}\n\n\nvoid IPL::addText (std::istream &f)\n{\n\n Csv csv;\n csv.filename = name;\n read_csv(f,csv);\n\n for (Csv::iterator i=csv.begin(), i_=csv.end() ; i!=i_ ; ++i) {\n const std::string section = i->first;\n\n const CsvSection &lines = i->second;\n\n for (unsigned j=0 ; j<lines.size() ; ++j) {\n\n CsvLine line = lines[j];\n\n if (section==\"inst\" && line.size()==11) {\n Inst inst;\n inst.is_low_detail = false;\n double id = strtod(line[0].c_str(),NULL);\n if (id!=floor(id)) {\n std::cerr<<\"Id not an integer \"<<id<<\"\\n\";\n exit(EXIT_FAILURE);\n }\n inst.id = (long unsigned int) id;\n inst.dff = str_lcase_crop(line[1]);\n double interior = strtod(line[2].c_str(),NULL);\n if (interior!=floor(interior)) {\n std::cerr<<\"Interior not an integer \"\n <<interior<<\"\\n\";\n exit(EXIT_FAILURE);\n }\n inst.interior = (long unsigned int) interior;\n inst.x = strtod(line[3].c_str(),NULL);\n inst.y = strtod(line[4].c_str(),NULL);\n inst.z = strtod(line[5].c_str(),NULL);\n inst.rx = strtod(line[6].c_str(),NULL);\n inst.ry = strtod(line[7].c_str(),NULL);\n inst.rz = strtod(line[8].c_str(),NULL);\n inst.rw = -strtod(line[9].c_str(),NULL);\n double lod = strtod(line[10].c_str(),NULL);\n if (lod!=floor(lod)) {\n std::cerr<<\"LOD not an integer \"<<lod<<\"\\n\";\n exit(EXIT_FAILURE);\n }\n inst.near_for = (long unsigned int) lod;\n insts.push_back(inst);\n\n } else if (section==\"occl\" && line.size()==10) {\n } else if (section==\"occl\" && line.size()==7) {\n } else if (section==\"auzo\" && line.size()==7) {\n } else if (section==\"auzo\" && line.size()==9) {\n } else if (section==\"grge\" && line.size()==11) {\n } else if (section==\"tcyc\" && line.size()==11) {\n } else if (section==\"pick\" && line.size()==4) {\n } else if (section==\"cull\" && line.size()==14) {\n } else if (section==\"cull\" && line.size()==11) {\n } else if (section==\"enex\" && line.size()==18) {\n } else if (section==\"path\") {\n } else if (section==\"between sections\" && line.size()==0 ) {\n } else {\n std::cerr<<\"In \"<<name<<\":\"<<line.orig_line<<\" \"\n <<\"section \"<<section<<\", row \"<<line.section_line<<\", \"\n <<\"did not have the right number of values: \"\n <<line.size()<<std::endl;\n\n }\n }\n }\n\n\n for (size_t i=0 ; i<insts.size() ; i++) {\n Inst& inst = insts[i];\n if (inst.near_for==-1) continue;\n if (inst.near_for<0 ||\n (size_t)inst.near_for >=insts.size()) {\n std::cerr<<\"Invalid lod index at instance \"<<i\n <<\": \"<<inst.near_for<<\"\\n\";\n continue;\n }\n insts[inst.near_for].is_low_detail = true;\n }\n}\n#if 0\nvoid IPL::addText (std::istream &f)\n{\n std::string section = \"no section\";\n\n std::vector<std::string> strs;\n\n while (!f.eof()) {\n\n std::string str;\n\n std::getline(f,str);\n\n size_t len = str.size();\n if (len==0 || str.at(0)=='#') continue;\n\n if (str.at(len-1)=='\\n') str.erase(str.end()-1);\n len = str.size();\n if (str.at(len-1)=='\\r') str.erase(str.end()-1);\n\n if (str==\"inst\") { section=str; continue; }\n if (str==\"cull\") { section=str; continue; }\n if (str==\"path\") { section=str; continue; }\n if (str==\"grge\") { section=str; continue; }\n if (str==\"enex\") { section=str; continue; }\n if (str==\"pick\") { section=str; continue; }\n if (str==\"jump\") { section=str; continue; }\n if (str==\"tcyc\") { section=str; continue; }\n if (str==\"auzo\") { section=str; continue; }\n if (str==\"mult\") { section=str; continue; }\n if (str==\"cars\") { section=str; continue; }\n if (str==\"occl\") { section=str; continue; }\n if (str==\"end\") { section=\"between sections\"; continue; }\n\n std::stringstream ss;\n ss << str;\n strs.clear();\n for (std::string word ; std::getline(ss,word,',') ; ) {\n strs.push_back(word);\n }\n\n\n if (section==\"inst\" && strs.size()==11) {\n Inst inst;\n inst.is_low_detail = false;\n double id = strtod(strs[0].c_str(),NULL);\n if (id!=floor(id)) {\n std::cerr<<\"Id not an integer \"<<id<<\"\\n\";\n exit(EXIT_FAILURE);\n }\n inst.id = (long unsigned int) id;\n inst.dff = str_lcase_crop(strs[1]);\n double interior = strtod(strs[2].c_str(),NULL);\n if (interior!=floor(interior)) {\n std::cerr<<\"Interior not an integer \"\n <<interior<<\"\\n\";\n exit(EXIT_FAILURE);\n }\n inst.interior = (long unsigned int) interior;\n inst.x = strtod(strs[3].c_str(),NULL);\n inst.y = strtod(strs[4].c_str(),NULL);\n inst.z = strtod(strs[5].c_str(),NULL);\n inst.rx = strtod(strs[6].c_str(),NULL);\n inst.ry = strtod(strs[7].c_str(),NULL);\n inst.rz = strtod(strs[8].c_str(),NULL);\n inst.rw = -strtod(strs[9].c_str(),NULL);\n double lod = strtod(strs[10].c_str(),NULL);\n if (lod!=floor(lod)) {\n std::cerr<<\"LOD not an integer \"<<lod<<\"\\n\";\n exit(EXIT_FAILURE);\n }\n inst.near_for = (long unsigned int) lod;\n insts.push_back(inst);\n\n } else if (section==\"occl\" && strs.size()==10) {\n } else if (section==\"occl\" && strs.size()==7) {\n } else if (section==\"auzo\" && strs.size()==7) {\n } else if (section==\"auzo\" && strs.size()==9) {\n } else if (section==\"grge\" && strs.size()==11) {\n } else if (section==\"tcyc\" && strs.size()==11) {\n } else if (section==\"pick\" && strs.size()==4) {\n } else if (section==\"cull\" && strs.size()==14) {\n } else if (section==\"cull\" && strs.size()==11) {\n } else if (section==\"enex\" && strs.size()==18) {\n } else if (section==\"path\") {\n } else if (section==\"between sections\" && strs.size()==0 ) {\n } else {\n std::cerr<<\"In \"<<section<<\", couldn't understand [\"\n <<strs.size()<<\"] \\\"\"<<str<<\"\\\"\\n\";\n }\n }\n\n for (size_t i=0 ; i<insts.size() ; i++) {\n Inst& inst = insts[i];\n if (inst.near_for==-1) continue;\n if (inst.near_for<0 ||\n (size_t)inst.near_for >=insts.size()) {\n std::cerr<<\"Invalid lod index at instance \"<<i\n <<\": \"<<inst.near_for<<\"\\n\";\n continue;\n }\n insts[inst.near_for].is_low_detail = true;\n }\n}\n#endif\nvoid IPL::addMore(std::istream &f)\n{\n unsigned long fourcc = ios_read_u32(f);\n f.seekg(-4,std::ios_base::cur);\n if (fourcc==0x79726e62) { // \"bnry\"\n addBinary(f);\n } else {\n addText(f);\n }\n}\n\n#ifdef _IPLREAD_EXEC\n\nsize_t amount_read = 0;\nsize_t amount_seeked = 0;\n\nvoid assert_triggered (void) { } \n\nint main(int argc, char *argv[])\n{\n if (argc<2) {\n std::cerr<<\"Usage: \"<<argv[0]<<\" <ipl> {<streams>}\"<<std::endl;\n exit(EXIT_FAILURE);\n }\n\n try {\n\n IPL ipl;\n\n for (int i=1 ; i<argc ; ++i) {\n std::string name = argv[i];\n\n std::ifstream f;\n f.open(name.c_str(),std::ios::binary);\n APP_ASSERT_IO_SUCCESSFUL(f,\"opening IPL: \"+name);\n\n ipl.setName(name);\n ipl.addMore(f);\n }\n\n/*\n for (size_t i=0 ; i<insts.size() ; i++) {\n std::cout <<RESET<<argv[1]<<\":\"<<i<<\" \"\n <<insts[i].id<<\" \"\n <<\"\\\"\"<<insts[i].dff<<\"\\\" \"\n <<BOLD<<GREEN<<insts[i].interior<<\" \"\n <<NOBOLD<<WHITE<<insts[i].x<<\" \"\n <<WHITE<<insts[i].y<<\" \"\n <<WHITE<<insts[i].z<<\" \"\n <<BLUE<<insts[i].rx<<\" \"\n <<BLUE<<insts[i].ry<<\" \"\n <<BLUE<<insts[i].rz<<\" \"\n <<BLUE<<insts[i].rw<<\" \"\n <<BOLD<<RED<<insts[i].near_for<<\" \"\n <<NOBOLD<<RED<<insts[i].is_low_detail<<std::endl;\n }\n*/\n\n const Insts &insts = ipl.getInsts();\n\n for (size_t i=0 ; i<insts.size() ; i++) {\n std::cout <<argv[1]<<\":\"<<i<<\" \"\n <<\"id:\"<<insts[i].id<<\" \"\n <<\"\\\"\"<<insts[i].dff<<\"\\\" \"\n <<insts[i].interior<<\" \"\n <<insts[i].x<<\" \"\n <<insts[i].y<<\" \"\n <<insts[i].z<<\" \"\n <<insts[i].rx<<\" \"\n <<insts[i].ry<<\" \"\n <<insts[i].rz<<\" \"\n <<insts[i].rw<<\" \"\n <<insts[i].near_for<<\" \"\n <<(insts[i].is_low_detail?\"near\":\"no_near\")\n <<std::endl;\n }\n\n } catch (const Exception &e) {\n CERR<<e<<std::endl;\n return EXIT_FAILURE;\n }\n\n return EXIT_SUCCESS;\n}\n\n#endif\n\n// vim: shiftwidth=8:tabstop=8:expandtab\n" }, { "alpha_fraction": 0.5150495171546936, "alphanum_fraction": 0.5158416032791138, "avg_line_length": 23.396135330200195, "blob_id": "1f1acbc973e0b7b3ae342df80c1c0b37b34366f8", "content_id": "a97f69aff91942706786b9f970d406511ffe55cf", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 5050, "license_type": "permissive", "max_line_length": 92, "num_lines": 207, "path": "/dependencies/quex-0.34.1/demo/002/simple.qx", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "// -*- C++ -*-\nstart = PROGRAM;\n\nheader {\n#include <cstdlib> // C++ adapted 'stdlib.h'\n// // gets: atoi(const char*) \n}\n\ndefine {\n // -*- C -*-\n // Pattern definitions for example application\n P_WHITESPACE [ \\t\\n]\n P_CURLY_BRACKET_O \"{\"\n P_CURLY_BRACKET_C \"}\"\n P_BRACKET_O \"(\"\n P_BRACKET_C \")\"\n P_EQUAL \"==\"\n P_KEY_STRUCT \"struct\"\n P_KEY_IF \"if\"\n P_KEY_IN \"in\"\n P_KEY_ELSE \"else:\"\n P_KEY_AND \"and\"\n P_KEY_OR \"or\"\n P_KEY_FOR \"for\"\n P_KEY_DEF \"def\"\n P_COLON \":\"\n P_IDENTIFIER [a-zA-Z]+\n P_PRINT \"print\"\n P_NUMBER [0-9]+\n //\n P_STRING_DELIMITER \"\\\"\"\n P_BACKSLASHED_STRING_DELIMITER \"\\\\\\\"\"\n P_BACKSLASHED_BACKSLASH \"\\\\\\\\\"\n P_BACKSLASHED_NEWLINE \"\\\\\\n\"\n}\n\ntoken {\n BRACKET_O\n BRACKET_C\n BLOCK_OPEN\n BLOCK_CLOSE\n CURLY_BRACKET_O\n CURLY_BRACKET_C\n OP_EQUAL\n IF\n ELSE\n AND\n OR\n COLON\n FOR\n IN\n PRINT\n FUNCTION_DEF\n INDENTATION\n STRUCT\n SEMICOLON\n IDENTIFIER\n NUMBER\n STRING\n ERROR_MISALIGNED_INDENTATION\n EVENT_MODE_CHANGE\n}\n\nbody {\n std::vector<int> indentation_stack;\n bool allow_opening_indentation_f;\n}\n\ninit {\n // first indentation at column = 0\n self.indentation_stack.push_back(0);\n // default: do not allow to open a sub-block.\n // only function definitions, if statements, and for loops\n // shoul allow to open a new indentation block in the next line.\n self.allow_opening_indentation_f = false;\n}\n\n\nmode END_OF_FILE :\n<inheritable: only> \n{ \n <<EOF>> => QUEX_TKN_TERMINATION;\n}\n\n\nmode PROGRAM :\n END_OF_FILE\n<entry: STRING_READER>\n<exit: STRING_READER>\n{\n on_indentation {\n\n if( Indentation > self.indentation_stack.back() ) {\n if( self.allow_opening_indentation_f ) {\n self.send(QUEX_TKN_BLOCK_OPEN);\n self.indentation_stack.push_back(Indentation);\n self.allow_opening_indentation_f = false;\n }\n else {\n // -- higher indentation where it was not allowed to indent higher\n // => misaligned indentation\n self.send(QUEX_TKN_ERROR_MISALIGNED_INDENTATION, self.line_number_at_end());\n }\n return;\n }\n while( self.indentation_stack.back() > Indentation ) {\n self.send(QUEX_TKN_BLOCK_CLOSE); \n self.indentation_stack.pop_back();\n }\n\n // -- 'landing' indentation has to fit an indentation border\n // if not send an error\n if( self.indentation_stack.back() != Indentation ) \n self.send(QUEX_TKN_ERROR_MISALIGNED_INDENTATION, self.line_number_at_end());\n }\n\n {P_BACKSLASHED_NEWLINE} {\n self.disable_next_indentation_event();\n }\n \n {P_WHITESPACE} {\n }\n\n {P_CURLY_BRACKET_O} => QUEX_TKN_CURLY_BRACKET_O; \n {P_CURLY_BRACKET_C} => QUEX_TKN_CURLY_BRACKET_C; \n {P_BRACKET_O} => QUEX_TKN_BRACKET_O;\n {P_BRACKET_C} => QUEX_TKN_BRACKET_C;\n {P_EQUAL} => QUEX_TKN_OP_EQUAL;\n {P_KEY_AND} => QUEX_TKN_AND;\n {P_PRINT} => QUEX_TKN_PRINT;\n {P_KEY_OR} => QUEX_TKN_OR;\n {P_COLON} => QUEX_TKN_COLON;\n {P_KEY_IN} => QUEX_TKN_IN;\n\n {P_KEY_STRUCT} {\n self.send(QUEX_TKN_STRUCT);\n self.allow_opening_indentation_f = true;\n RETURN;\n }\n\n {P_KEY_IF} {\n self.send(QUEX_TKN_IF);\n self.allow_opening_indentation_f = true;\n RETURN;\n }\n {P_KEY_ELSE} {\n self.send(QUEX_TKN_ELSE);\n self.allow_opening_indentation_f = true;\n RETURN;\n }\n {P_KEY_FOR} {\n self.send(QUEX_TKN_FOR);\n self.allow_opening_indentation_f = true;\n RETURN;\n }\n {P_KEY_DEF} {\n self.send(QUEX_TKN_FUNCTION_DEF);\n self.allow_opening_indentation_f = true;\n RETURN;\n }\n {P_IDENTIFIER} {\n self.send(QUEX_TKN_IDENTIFIER, Lexeme);\n RETURN;\n }\n {P_NUMBER} {\n self.send(QUEX_TKN_NUMBER, atoi((const char*)Lexeme));\n RETURN;\n }\n\n {P_STRING_DELIMITER} {\n self << STRING_READER; \n self.send(QUEX_TKN_EVENT_MODE_CHANGE);\n return;\n }\n}\n\nmode STRING_READER :\n END_OF_FILE\n<entry: PROGRAM>\n<exit: PROGRAM>\n{\n on_entry {\n self.accumulator.clear();\n }\n\n on_exit {\n self.accumulator.flush(QUEX_TKN_STRING);\n }\n\n {P_BACKSLASHED_STRING_DELIMITER} {\n self.accumulator.add(Lexeme);\n }\n\n {P_BACKSLASHED_BACKSLASH} {\n self.accumulator.add(Lexeme);\n }\n\n {P_STRING_DELIMITER} {\n /*........................................*/ self << PROGRAM;\n self.send(QUEX_TKN_EVENT_MODE_CHANGE);\n return;\n }\n\n . {\n self.accumulator.add(Lexeme);\n }\n}\n" }, { "alpha_fraction": 0.7553606033325195, "alphanum_fraction": 0.7592592835426331, "avg_line_length": 22.813953399658203, "blob_id": "1c1f56cbac39b8334d2532ccf9e3a94d5eac6d37", "content_id": "a25c5d68411cee1056e17b2165b15d9b1f8d2858", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 1026, "license_type": "permissive", "max_line_length": 86, "num_lines": 43, "path": "/dependencies/quex-0.34.1/quex/code_base/buffer/BufferInitFactory.i", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* -*- C++ -*- vim: set syntax=cpp: */\n\n# ifndef __QUEX_SETTING_PLAIN_C\n# define BUFFER_FILLER_CONVERTER QuexBufferFiller_IConv<InputHandleT>\n# else\n# define BUFFER_FILLER_CONVERTER QuexBufferFiller_IConv\n# endif\n\nQuexBufferFiller*\nMemoryManager_get_BufferMemory(const size_t ByteN)\n{\n return __QUEX_ALLOCATE_MEMORY(1, ByteN);\n}\n\nQuexBufferFiller*\nMemoryManager_get_BufferFiller(QuexInputCodingTypeEnum)\n{\n return __QUEX_ALLOCATE_MEMORY(1, QuexBufferFiller_get_memory_size(ICT);\n}\n\nQuexBufferFiller*\nMemoryManager_get_BufferFiller_RawBuffer(const size_t ByteN)\n{\n return __QUEX_ALLOCATE_MEMORY(1, ByteN);\n}\n\nQuexBufferFiller*\nMemoryManager_free_BufferMemory(uint8_t* memory_chunk)\n{\n __QUEX_FREE_ARRAY_MEMORY(memory_chunk);\n}\n\nQuexBufferFiller*\nMemoryManager_free_BufferFiller(QuexBufferFiller* memory, QuexInputCodingTypeEnum ICT)\n{\n __QUEX_FREE_MEMORY(memory);\n}\n\nQuexBufferFiller*\nMemoryManager_free_BufferFiller_RawBuffer(QuexInputCodingTypeEnum)\n{\n __QUEX_FREE_ARRAY_MEMORY(memory_chunk);\n}\n\n\n" }, { "alpha_fraction": 0.5523828864097595, "alphanum_fraction": 0.5544371604919434, "avg_line_length": 37.619049072265625, "blob_id": "e883ce035013281aece6795f591bd576a95a60d3", "content_id": "cf9224f50626b1f966e24e0701843851c5f9f83e", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 4868, "license_type": "permissive", "max_line_length": 87, "num_lines": 126, "path": "/engine/gfx/gfx_gasoline_backend_gsl.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <cstdlib>\n\n#include <exception.h>\n\n#include <centralised_log.h>\n\n#include \"gfx_gasoline_backend_gsl.h\"\n\nstatic void unparse (std::stringstream &ss, const GfxGslAst *ast_, int indent)\n{\n std::string space(4 * indent, ' ');\n if (auto ast = dynamic_cast<const GfxGslBlock*>(ast_)) {\n ss << space << \"{\\n\";\n for (auto stmt : ast->stmts) {\n unparse(ss, stmt, indent+1);\n }\n ss << space << \"}\\n\";\n } else if (auto ast = dynamic_cast<const GfxGslShader*>(ast_)) {\n for (auto stmt : ast->stmts) {\n unparse(ss, stmt, indent);\n }\n } else if (auto ast = dynamic_cast<const GfxGslDecl*>(ast_)) {\n ss << space << \"var\" << \" \" << ast->id << \" = \";\n unparse(ss, ast->init, indent);\n ss << \";\";\n if (ast->init->type != nullptr) ss << \" // \" << ast->init->type;\n ss << \"\\n\";\n } else if (auto ast = dynamic_cast<const GfxGslIf*>(ast_)) {\n ss << space << \"if (\";\n unparse(ss, ast->cond, indent);\n ss << \") {\\n\";\n unparse(ss, ast->yes, indent+1);\n if (ast->no) {\n ss << space << \"} else {\\n\";\n unparse(ss, ast->no, indent+1);\n }\n ss << space << \"}\\n\";\n } else if (auto ast = dynamic_cast<const GfxGslAssign*>(ast_)) {\n ss << space;\n unparse(ss, ast->target, indent);\n ss << \" = \";\n unparse(ss, ast->expr, indent);\n ss << \";\\n\";\n } else if (dynamic_cast<const GfxGslDiscard*>(ast_)) {\n ss << space << \"discard;\\n\";\n } else if (dynamic_cast<const GfxGslReturn*>(ast_)) {\n ss << space << \"return;\\n\";\n\n } else if (auto ast = dynamic_cast<const GfxGslCall*>(ast_)) {\n ss << ast->func;\n if (ast->args.size() == 0) {\n ss << \"()\";\n } else {\n const char *sep = \"(\";\n for (auto arg : ast->args) {\n ss << sep;\n unparse(ss, arg, indent);\n sep = \", \";\n }\n ss << \")\";\n }\n } else if (auto ast = dynamic_cast<const GfxGslField*>(ast_)) {\n ss << \"(\";\n unparse(ss, ast->target, indent);\n ss << \").\";\n ss << ast->id;\n } else if (auto ast = dynamic_cast<const GfxGslLiteralInt*>(ast_)) {\n ss << ast->val;\n } else if (auto ast = dynamic_cast<const GfxGslLiteralFloat*>(ast_)) {\n ss << ast->val;\n } else if (auto ast = dynamic_cast<const GfxGslLiteralBoolean*>(ast_)) {\n ss << (ast->val ? \"true\" : \"false\");\n } else if (auto ast = dynamic_cast<const GfxGslVar*>(ast_)) {\n ss << ast->id;\n } else if (auto ast = dynamic_cast<const GfxGslBinary*>(ast_)) {\n ss << \"(\";\n unparse(ss, ast->a, indent);\n ss << \" \" << to_string(ast->op) << \" \";\n unparse(ss, ast->b, indent);\n ss << \")\";\n\n } else if (dynamic_cast<const GfxGslGlobal*>(ast_)) {\n ss << \"global\";\n } else if (dynamic_cast<const GfxGslMat*>(ast_)) {\n ss << \"mat\";\n } else if (dynamic_cast<const GfxGslVert*>(ast_)) {\n ss << \"vert\";\n } else if (dynamic_cast<const GfxGslFrag*>(ast_)) {\n ss << \"frag\";\n\n } else {\n EXCEPTEX << \"INTERNAL ERROR: Unknown Ast.\" << ENDL;\n }\n}\n\nstd::string gfx_gasoline_unparse_gsl (const GfxGslTypeSystem *ts, const GfxGslAst *ast)\n{\n std::stringstream ss;\n ss << \"// Vert fields read: \" << ts->getVertFieldsRead() << \"\\n\";\n ss << \"// Frag fields read: \" << ts->getFragFieldsRead() << \"\\n\";\n ss << \"// Material fields read: \" << ts->getMatFieldsRead() << \"\\n\";\n ss << \"// Global fields read: \" << ts->getGlobalFieldsRead() << \"\\n\";\n ss << \"// Trans-values: \" << ts->getTrans() << \"\\n\";\n unparse(ss, ast, 0);\n return ss.str();\n}\n\n\n" }, { "alpha_fraction": 0.706457257270813, "alphanum_fraction": 0.7113438248634338, "avg_line_length": 35.730770111083984, "blob_id": "a1009877d4ab35c88bcdd6e270a68d9d1006afb9", "content_id": "1d2318eb3279fa2c7a0c427ea38f67a8b7dac157", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 2865, "license_type": "permissive", "max_line_length": 94, "num_lines": 78, "path": "/engine/dense_index_map.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <algorithm>\n#include <sstream>\n\n#include <centralised_log.h>\n\n#include \"dense_index_map.h\"\n\nunsigned DenseIndexMap::reserve (unsigned new_capacity)\n{\n unsigned old_capacity = capacity();\n if (new_capacity <= old_capacity) return old_capacity;\n\n sparseIndexes.reserve(new_capacity);\n freeList.reserve(new_capacity);\n denseIndexes.resize(new_capacity);\n for (unsigned i=old_capacity ; i<new_capacity ; ++i) {\n denseIndexes[i] = 0xFFFF;\n freeList.push_back(i);\n }\n\n return new_capacity;\n}\n\nvoid DenseIndexMap::sparseIndexValid (unsigned sparse_index) const\n{\n if (sparse_index >= denseIndexes.size() || denseIndexes[sparse_index] == 0xFFFF) {\n std::stringstream ss;\n ss << \"Index out of range or unassigned: \" << sparse_index;\n GRIT_EXCEPT(ss.str());\n }\n}\n\nunsigned DenseIndexMap::newSparseIndex (void)\n{\n if (size() >= capacity()) reserve(std::max(128u, unsigned(capacity() * 1.3)));\n unsigned sparse_index = freeList[freeList.size() - 1];\n freeList.pop_back();\n unsigned dense_index = sparseIndexes.size();\n denseIndexes[sparse_index] = dense_index;\n sparseIndexes.push_back(sparse_index);\n return sparse_index;\n}\n\nvoid DenseIndexMap::delSparseIndex (unsigned sparse_index)\n{\n unsigned dense_index = denseIndexes[sparse_index];\n unsigned last = sparseIndexes.size() - 1;\n if (dense_index != last) {\n // Reorganise buffers to move last instance into the position of the one just removed.\n sparseIndexes[dense_index] = sparseIndexes[last];\n denseIndexes[sparseIndexes[last]] = dense_index;\n }\n sparseIndexes.resize(last);\n denseIndexes[sparse_index] = 0xFFFF;\n freeList.push_back(sparse_index);\n\n}\n" }, { "alpha_fraction": 0.5348404049873352, "alphanum_fraction": 0.5377730131149292, "avg_line_length": 38.582828521728516, "blob_id": "e785ca1f8fc14e6cd46d5fe85503f0a7e45e8edd", "content_id": "0aa67d275928abf36a74d3a3d615bb824b0fbf75", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 32735, "license_type": "permissive", "max_line_length": 100, "num_lines": 827, "path": "/engine/gfx/gfx_gasoline_type_system.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <cstdlib>\n\n#include <centralised_log.h>\n\n#include \"gfx_gasoline_parser.h\"\n#include \"gfx_gasoline_type_system.h\"\n\n// Workaround for g++ not supporting moveable streams.\n#define error(loc) (EXCEPT << \"Type error: \" << loc << \": \")\n\nstatic bool frag(GfxGslKind k)\n{\n return k != GFX_GSL_VERTEX;\n}\n\nstd::ostream &operator<<(std::ostream &o, const GfxGslType *t_)\n{ \n if (auto *t = dynamic_cast<const GfxGslFloatType*>(t_)) {\n o << \"Float\";\n if (t->dim > 1) o << t->dim;\n\n } else if (auto *t = dynamic_cast<const GfxGslFloatMatrixType*>(t_)) {\n o << \"Float\" << t->w << \"x\" << t->h;\n\n } else if (auto *t = dynamic_cast<const GfxGslFloatTextureType*>(t_)) {\n o << \"FloatTexture\";\n if (t->dim > 1) o << t->dim;\n\n } else if (dynamic_cast<const GfxGslFloatTextureCubeType*>(t_)) {\n o << \"FloatTextureCube\";\n\n } else if (auto *t = dynamic_cast<const GfxGslIntType*>(t_)) {\n o << \"Int\";\n if (t->dim > 1) o << t->dim;\n\n } else if (dynamic_cast<const GfxGslBoolType*>(t_)) {\n o << \"Bool\";\n\n } else if (dynamic_cast<const GfxGslVoidType*>(t_)) {\n o << \"Void\";\n\n } else if (dynamic_cast<const GfxGslGlobalType*>(t_)) {\n o << \"Global\";\n\n } else if (dynamic_cast<const GfxGslMatType*>(t_)) {\n o << \"Mat\";\n\n } else if (dynamic_cast<const GfxGslVertType*>(t_)) {\n o << \"Vert\";\n\n } else if (dynamic_cast<const GfxGslOutType*>(t_)) {\n o << \"Out\";\n\n } else if (dynamic_cast<const GfxGslBodyType*>(t_)) {\n o << \"Body\";\n\n } else if (dynamic_cast<const GfxGslFragType*>(t_)) {\n o << \"Frag\";\n\n } else if (auto *t = dynamic_cast<const GfxGslArrayType*>(t_)) {\n o << \"[\" << t->size << \"]\" << t->elementType;\n\n } else if (auto *t = dynamic_cast<const GfxGslFunctionType*>(t_)) {\n if (t->params.size() == 0) {\n o << \"( )\";\n } else {\n const char *prefix = \"(\";\n for (unsigned i=0 ; i<t->params.size() ; ++i) {\n o << prefix << t->params[i];\n prefix = \", \";\n }\n o << \")\";\n }\n\n o << \" -> \";\n o << t->ret;\n }\n\n return o;\n}\n\n\nGfxGslType *GfxGslTypeSystem::cloneType (const GfxGslType *t_)\n{\n GfxGslType *r = nullptr;\n if (auto *t = dynamic_cast<const GfxGslFloatType*>(t_)) {\n r = ctx.alloc.makeType<GfxGslFloatType>(*t);\n } else if (auto *t = dynamic_cast<const GfxGslFloatMatrixType*>(t_)) {\n r = ctx.alloc.makeType<GfxGslFloatMatrixType>(*t);\n } else if (auto *t = dynamic_cast<const GfxGslFloatTextureType*>(t_)) {\n r = ctx.alloc.makeType<GfxGslFloatTextureType>(*t);\n } else if (auto *t = dynamic_cast<const GfxGslFloatTextureCubeType*>(t_)) {\n r = ctx.alloc.makeType<GfxGslFloatTextureCubeType>(*t);\n } else if (auto *t = dynamic_cast<const GfxGslIntType*>(t_)) {\n r = ctx.alloc.makeType<GfxGslIntType>(*t);\n } else if (dynamic_cast<const GfxGslBoolType*>(t_)) {\n r = ctx.alloc.makeType<GfxGslBoolType>();\n } else if (dynamic_cast<const GfxGslVoidType*>(t_)) {\n r = ctx.alloc.makeType<GfxGslVoidType>();\n } else if (dynamic_cast<const GfxGslGlobalType*>(t_)) {\n r = ctx.alloc.makeType<GfxGslGlobalType>();\n } else if (dynamic_cast<const GfxGslMatType*>(t_)) {\n r = ctx.alloc.makeType<GfxGslMatType>();\n } else if (dynamic_cast<const GfxGslVertType*>(t_)) {\n r = ctx.alloc.makeType<GfxGslVertType>();\n } else if (dynamic_cast<const GfxGslOutType*>(t_)) {\n r = ctx.alloc.makeType<GfxGslOutType>();\n } else if (dynamic_cast<const GfxGslBodyType*>(t_)) {\n r = ctx.alloc.makeType<GfxGslBodyType>();\n } else if (dynamic_cast<const GfxGslFragType*>(t_)) {\n r = ctx.alloc.makeType<GfxGslFragType>();\n } else if (auto *t = dynamic_cast<const GfxGslArrayType*>(t_)) {\n GfxGslType *el = cloneType(t->elementType);\n r = ctx.alloc.makeType<GfxGslArrayType>(t->size, el);\n } else if (auto *t = dynamic_cast<const GfxGslFunctionType*>(t_)) {\n std::vector<GfxGslType*> params(t->params.size());\n for (unsigned i=0 ; i<t->params.size() ; ++i)\n params[i] = cloneType(t->params[i]);\n GfxGslType *ret = cloneType(t->ret);\n r = ctx.alloc.makeType<GfxGslFunctionType>(params, ret);\n } else {\n EXCEPTEX << \"Internal error.\" << ENDL;\n }\n r->writeable = t_->writeable;\n return r;\n}\n\nvoid GfxGslTypeSystem::initObjectTypes (GfxGslKind k)\n{\n switch (k) {\n case GFX_GSL_COLOUR_ALPHA:\n outFields[\"colour\"] = ctx.alloc.makeType<GfxGslFloatType>(3);\n outFields[\"alpha\"] = ctx.alloc.makeType<GfxGslFloatType>(1);\n break;\n\n case GFX_GSL_DANGS:\n outFields[\"diffuse\"] = ctx.alloc.makeType<GfxGslFloatType>(3);\n outFields[\"alpha\"] = ctx.alloc.makeType<GfxGslFloatType>(1);\n outFields[\"normal\"] = ctx.alloc.makeType<GfxGslFloatType>(3);\n outFields[\"gloss\"] = ctx.alloc.makeType<GfxGslFloatType>(1);\n outFields[\"specular\"] = ctx.alloc.makeType<GfxGslFloatType>(1);\n break;\n\n case GFX_GSL_VERTEX:\n outFields[\"position\"] = ctx.alloc.makeType<GfxGslFloatType>(3);\n break;\n\n case GFX_GSL_TONE_MAP:\n case GFX_GSL_FOG:\n break;\n }\n\n if (frag(k))\n fragFields[\"screen\"] = ctx.alloc.makeType<GfxGslFloatType>(2);\n\n vertFields[\"coord0\"] = ctx.alloc.makeType<GfxGslFloatType>(4);\n vertFields[\"coord1\"] = ctx.alloc.makeType<GfxGslFloatType>(4);\n vertFields[\"coord2\"] = ctx.alloc.makeType<GfxGslFloatType>(4);\n vertFields[\"coord3\"] = ctx.alloc.makeType<GfxGslFloatType>(4);\n vertFields[\"coord4\"] = ctx.alloc.makeType<GfxGslFloatType>(4);\n vertFields[\"coord5\"] = ctx.alloc.makeType<GfxGslFloatType>(4);\n vertFields[\"coord6\"] = ctx.alloc.makeType<GfxGslFloatType>(4);\n vertFields[\"coord7\"] = ctx.alloc.makeType<GfxGslFloatType>(4);\n vertFields[\"normal\"] = ctx.alloc.makeType<GfxGslFloatType>(3);\n vertFields[\"colour\"] = ctx.alloc.makeType<GfxGslFloatType>(4);\n vertFields[\"tangent\"] = ctx.alloc.makeType<GfxGslFloatType>(4);\n vertFields[\"position\"] = ctx.alloc.makeType<GfxGslFloatType>(4);\n vertFields[\"boneWeights\"] = ctx.alloc.makeType<GfxGslFloatType>(4);\n vertFields[\"boneAssignments\"] = ctx.alloc.makeType<GfxGslFloatType>(4);\n\n}\n\nconst GfxGslFunctionType *GfxGslTypeSystem::lookupFunction(const GfxGslLocation &loc,\n const std::string &name,\n GfxGslAsts &asts)\n{\n auto it = ctx.funcTypes.find(name);\n if (it == ctx.funcTypes.end()) {\n error(loc) << \"Unrecognised function: \" << name << ENDL;\n }\n\n // The \"internal\" status is the same no matter the compilation purpose.\n if (it->second.internal && !ctx.internal)\n error(loc) << \"Unrecognised function: \" << name << ENDL;\n\n // Since lightingTextures is a property of the GfxPurpose, we cannot use it\n // in the type system. Shaders are type-checked for all purposes.\n /*\n if (it->second.lighting && !ctx.lightingTextures)\n error(loc) << \"Unrecognised function: \" << name << ENDL;\n */\n\n // Bind if it's an exact match\n const GfxGslFunctionTypes &overloads = it->second.ts;\n for (auto *o : overloads) {\n if (o->params.size() != asts.size()) continue;\n for (unsigned i=0 ; i<asts.size() ; ++i) {\n if (!equal(o->params[i], asts[i]->type)) goto nextfunc;\n }\n //std::cout << \"Exact match: \" << name << \": \" << o << std::endl;\n return o;\n nextfunc:;\n }\n\n // Otherwise search for one that matches with conversions.\n // If there is just 1, use it, otherwise error.\n const GfxGslFunctionType *found = nullptr;\n for (auto *o : overloads) {\n //std::cout << \"Trying with conversions: \" << name << \": \" << o << std::endl;\n if (o->params.size() != asts.size()) continue;\n for (unsigned i=0 ; i<asts.size() ; ++i) {\n if (!conversionExists(asts[i]->type, o->params[i])) goto nextfunc2;\n }\n if (found != nullptr) {\n std::stringstream ss;\n if (asts.size() == 0) {\n ss << \"()\";\n } else {\n const char *prefix = \"(\";\n for (unsigned i=0 ; i<asts.size() ; ++i) {\n ss << prefix << asts[i]->type;\n prefix = \", \";\n }\n ss << \")\";\n }\n error(loc) << \"Cannot unambiguously bind function: \" << name << ss.str() << ENDL;\n }\n found = o;\n nextfunc2:;\n }\n\n if (found != nullptr) {\n for (unsigned i=0 ; i<asts.size() ; ++i) {\n doConversion(asts[i], found->params[i]);\n }\n return found;\n }\n\n std::stringstream ss;\n if (asts.size() == 0) {\n ss << \"()\";\n } else {\n const char *prefix = \"(\";\n for (unsigned i=0 ; i<asts.size() ; ++i) {\n ss << prefix << asts[i]->type;\n prefix = \", \";\n }\n ss << \")\";\n }\n error(loc) << \"No override found for \" << name << ss.str() << ENDL;\n}\n\nbool GfxGslTypeSystem::isFirstClass (const GfxGslType *x)\n{\n if (dynamic_cast<const GfxGslFloatType*>(x)) {\n return true;\n } else if (dynamic_cast<const GfxGslIntType*>(x)) {\n return true;\n } else if (dynamic_cast<const GfxGslBoolType*>(x)) {\n return true;\n } else if (auto *xa = dynamic_cast<const GfxGslArrayType*>(x)) {\n return isFirstClass(xa->elementType);\n }\n return false;\n}\n\nbool GfxGslTypeSystem::equal (GfxGslType *a_, GfxGslType *b_)\n{\n if (auto *a = dynamic_cast<GfxGslFloatType*>(a_)) {\n auto *b = dynamic_cast<GfxGslFloatType*>(b_);\n if (b == nullptr) return false;\n if (b->dim != a->dim) return false;\n\n } else if (auto *a = dynamic_cast<GfxGslIntType*>(a_)) {\n auto *b = dynamic_cast<GfxGslIntType*>(b_);\n if (b == nullptr) return false;\n if (b->dim != a->dim) return false;\n\n } else if (auto *a = dynamic_cast<GfxGslFloatMatrixType*>(a_)) {\n auto *b = dynamic_cast<GfxGslFloatMatrixType*>(b_);\n if (b == nullptr) return false;\n if (b->w != a->w) return false;\n if (b->h != a->h) return false;\n\n } else if (auto *a = dynamic_cast<GfxGslFloatTextureType*>(a_)) {\n auto *b = dynamic_cast<GfxGslFloatTextureType*>(b_);\n if (b == nullptr) return false;\n if (b->dim != a->dim) return false;\n\n } else if (dynamic_cast<GfxGslFloatTextureCubeType*>(a_)) {\n auto *b = dynamic_cast<GfxGslFloatTextureCubeType*>(b_);\n if (b == nullptr) return false;\n\n } else if (dynamic_cast<GfxGslBoolType*>(a_)) {\n auto *b = dynamic_cast<GfxGslBoolType*>(b_);\n if (b == nullptr) return false;\n\n } else if (dynamic_cast<GfxGslVoidType*>(a_)) {\n auto *b = dynamic_cast<GfxGslVoidType*>(b_);\n if (b == nullptr) return false;\n\n } else if (dynamic_cast<GfxGslGlobalType*>(a_)) {\n auto *b = dynamic_cast<GfxGslGlobalType*>(b_);\n if (b == nullptr) return false;\n\n } else if (dynamic_cast<GfxGslMatType*>(a_)) {\n auto *b = dynamic_cast<GfxGslMatType*>(b_);\n if (b == nullptr) return false;\n\n } else if (dynamic_cast<GfxGslVertType*>(a_)) {\n auto *b = dynamic_cast<GfxGslVertType*>(b_);\n if (b == nullptr) return false;\n\n } else if (dynamic_cast<GfxGslOutType*>(a_)) {\n auto *b = dynamic_cast<GfxGslOutType*>(b_);\n if (b == nullptr) return false;\n\n } else if (dynamic_cast<GfxGslBodyType*>(a_)) {\n auto *b = dynamic_cast<GfxGslBodyType*>(b_);\n if (b == nullptr) return false;\n\n } else if (dynamic_cast<GfxGslFragType*>(a_)) {\n auto *b = dynamic_cast<GfxGslFragType*>(b_);\n if (b == nullptr) return false;\n\n } else if (auto *a = dynamic_cast<GfxGslArrayType*>(a_)) {\n auto *b = dynamic_cast<GfxGslArrayType*>(b_);\n if (b == nullptr) return false;\n if (a->size != b->size) return false;\n if (!equal(a->elementType, b->elementType)) return false;\n\n } else if (auto *a = dynamic_cast<GfxGslFunctionType*>(a_)) {\n auto *b = dynamic_cast<GfxGslFunctionType*>(b_);\n if (b == nullptr) return false;\n if (!equal(a->ret, b->ret)) return false;\n if (a->params.size() != b->params.size()) return false;\n for (unsigned i=0 ; i<a->params.size() ; ++i) {\n if (!equal(a->params[i], b->params[i])) return false;\n }\n } else {\n EXCEPTEX << \"Internal error: \" << a_ << ENDL;\n }\n return true;\n}\n\n\n// Can the type be automatically converted\nbool GfxGslTypeSystem::conversionExists (GfxGslType *from_, GfxGslType *to_)\n{\n if (equal(from_, to_)) return true;\n \n if (dynamic_cast<GfxGslIntType*>(to_)) {\n if (auto *ft = dynamic_cast<GfxGslIntType*>(from_)) {\n if (ft->dim == 1) {\n // Int -> Int[n]\n return true;\n }\n }\n } else if (dynamic_cast<GfxGslFloatType*>(to_)) {\n if (auto *ft = dynamic_cast<GfxGslFloatType*>(from_)) {\n if (ft->dim == 1) {\n // Float -> Float[n]\n return true;\n }\n } else if (auto *ft = dynamic_cast<GfxGslIntType*>(from_)) {\n // Int -> Float[n]\n if (ft->dim == 1) {\n return true;\n }\n }\n }\n return false;\n}\n\n// Wrap from, if necessary, to convert type.\nvoid GfxGslTypeSystem::doConversion (GfxGslAst *&from, GfxGslType *to_)\n{\n if (equal(from->type, to_)) {\n // Nothing to do.\n return;\n }\n\n if (auto *tt = dynamic_cast<GfxGslIntType*>(to_)) {\n const char *names[] = { \"Int\", \"Int2\", \"Int3\", \"Int4\" };\n if (auto *ft = dynamic_cast<GfxGslIntType*>(from->type)) {\n if (ft->dim == 1) {\n // Int -> Int[n]\n from = ctx.alloc.makeAst<GfxGslCall>(from->loc, names[tt->dim-1], GfxGslAsts{from});\n from->type = cloneType(tt);\n return;\n }\n }\n } else if (auto *tt = dynamic_cast<GfxGslFloatType*>(to_)) {\n const char *names[] = { \"Float\", \"Float2\", \"Float3\", \"Float4\" };\n if (auto *ft = dynamic_cast<GfxGslFloatType*>(from->type)) {\n if (ft->dim == 1) {\n // Float -> Float[n]\n from = ctx.alloc.makeAst<GfxGslCall>(from->loc, names[tt->dim-1], GfxGslAsts{from});\n from->type = cloneType(tt);\n return;\n }\n } else if (auto *ft = dynamic_cast<GfxGslIntType*>(from->type)) {\n // Int1 -> Float[n]\n if (ft->dim == 1) {\n from = ctx.alloc.makeAst<GfxGslCall>(from->loc, names[tt->dim-1], GfxGslAsts{from});\n from->type = cloneType(tt);\n return;\n }\n }\n }\n error(from->loc) << \"Could not convert type \" << from->type << \" to \" << to_ << ENDL;\n}\n\nvoid GfxGslTypeSystem::unify (const GfxGslLocation &loc, GfxGslAst *&a, GfxGslAst *&b)\n{\n ASSERT(a != nullptr);\n ASSERT(b != nullptr);\n ASSERT(a->type != nullptr);\n ASSERT(b->type != nullptr);\n if (conversionExists(a->type, b->type)) {\n doConversion(a, b->type);\n return;\n }\n if (conversionExists(b->type, a->type)) {\n doConversion(b, a->type);\n return;\n }\n error(loc) << \"Could not unify types \" << a->type << \" and \" << b->type << ENDL;\n}\n\nstatic bool get_offset (char c, unsigned &offset)\n{\n switch (c) {\n case 'r': case 'x': offset = 0; return true;\n case 'g': case 'y': offset = 1; return true;\n case 'b': case 'z': offset = 2; return true;\n case 'a': case 'w': offset = 3; return true;\n default:\n return false;\n }\n}\n\nvoid GfxGslTypeSystem::addTrans (const GfxGslLocation &loc, const std::vector<std::string> &path,\n const GfxGslType *type, bool vert)\n{\n auto *ft = dynamic_cast<const GfxGslFloatType *>(type);\n if (ft == nullptr)\n error(loc) << \"Can only capture floating point values.\" << ENDL;\n std::set<unsigned> parts;\n if (path.size() == 1) {\n for (unsigned i=0 ; i<ft->dim ; ++i) {\n parts.insert(i);\n }\n } else if (path.size() == 2) {\n std::string last = path[1];\n for (unsigned i=0 ; i<last.length() ; ++i) {\n unsigned offset;\n if (!get_offset(last[i], offset))\n EXCEPTEX << \"Internal error.\" << ENDL;\n ASSERT(offset < ft->dim);\n parts.insert(offset);\n }\n } else {\n EXCEPTEX << \"Internal error.\" << ENDL;\n }\n static const char *fields = \"xyzw\";\n for (unsigned p : parts) {\n GfxGslTrans t;\n t.kind = vert ? GfxGslTrans::VERT : GfxGslTrans::USER;\n t.path.push_back(path[0]);\n if (ft->dim > 1) {\n t.path.emplace_back(1, fields[p]);\n }\n t.type = ft;\n trans.insert(t);\n }\n}\n\nvoid GfxGslTypeSystem::inferAndSet (GfxGslShader *ast, const GfxGslDefMap &outer)\n{\n Ctx root;\n GfxGslDefMap outer2;\n for (const auto &pair : outer) {\n GfxGslDef *def = ctx.alloc.makeDef<GfxGslDef>(pair.second->type, true, false);\n outer2[pair.first] = def;\n }\n Ctx c = root.appendVars(&outer2);\n for (GfxGslAst *stmt : ast->stmts) {\n inferAndSet(stmt, c.appendVars(&ast->vars).setTopLevel(true));\n }\n ast->type = ctx.alloc.makeType<GfxGslVoidType>();\n vars = ast->vars;\n}\n\nvoid GfxGslTypeSystem::inferAndSet (GfxGslAst *ast_, const Ctx &c)\n{\n ASSERT(ast_ != nullptr);\n const GfxGslLocation &loc = ast_->loc;\n\n if (auto *ast = dynamic_cast<GfxGslBlock*>(ast_)) {\n for (auto stmt : ast->stmts) {\n inferAndSet(stmt, c.appendVars(&ast->vars));\n }\n ast->type = ctx.alloc.makeType<GfxGslVoidType>();\n\n } else if (auto *ast = dynamic_cast<GfxGslDecl*>(ast_)) {\n if (c.lookupVar(ast->id) != nullptr)\n error(loc) << \"Variable already defined: \" << ast->id << ENDL;\n GfxGslType *type = nullptr;\n if (ast->init != nullptr) {\n if (auto *arrLit = dynamic_cast<GfxGslLiteralArray*>(ast->init)) {\n type = ctx.alloc.makeType<GfxGslArrayType>(arrLit->elements.size(),\n cloneType(arrLit->elementType));\n for (unsigned i=0 ; i<arrLit->elements.size() ; ++i) {\n inferAndSet(arrLit->elements[i], c.setRead(true));\n doConversion(arrLit->elements[i], arrLit->elementType);\n }\n } else {\n inferAndSet(ast->init, c.setRead(true));\n type = cloneType(ast->init->type);\n }\n }\n if (ast->annot != nullptr) {\n // Change our minds, use the annotation.\n type = cloneType(ast->annot);\n if (ast->init != nullptr)\n doConversion(ast->init, type);\n }\n if (type == nullptr) {\n error(loc) << \"Variable must have type annotation or initialiser: \" << ast->id << ENDL;\n }\n if (!isFirstClass(type))\n error(loc) << \"Variable cannot have type: \" << type << ENDL;\n type->writeable = true;\n GfxGslDef *def = ctx.alloc.makeDef<GfxGslDef>(type, false, c.topLevel);\n (*c.vars)[ast->id] = def;\n ast->def = def;\n ast->type = ctx.alloc.makeType<GfxGslVoidType>();\n\n } else if (auto *ast = dynamic_cast<GfxGslIf*>(ast_)) {\n inferAndSet(ast->cond, c.setRead(true));\n auto *btype = ctx.alloc.makeType<GfxGslBoolType>();\n doConversion(ast->cond, btype);\n \n inferAndSet(ast->yes, c.appendVars(&ast->yesVars));\n if (ast->no) {\n inferAndSet(ast->no, c.appendVars(&ast->noVars));\n unify(loc, ast->yes, ast->no);\n }\n ast->type = ctx.alloc.makeType<GfxGslVoidType>();\n\n } else if (auto *ast = dynamic_cast<GfxGslFor*>(ast_)) {\n Ctx c2 = c.appendVars(&ast->vars);\n if (ast->id != \"\") {\n // var form -- augment with new var\n if (c.lookupVar(ast->id) != nullptr)\n error(loc) << \"Loop variable already defined: \" << ast->id << ENDL;\n GfxGslType *type = nullptr;\n if (ast->init != nullptr) {\n inferAndSet(ast->init, c.setRead(true));\n type = cloneType(ast->init->type);\n }\n if (ast->annot != nullptr) {\n // Change our minds, use the annotation.\n type = cloneType(ast->annot);\n if (ast->init != nullptr)\n doConversion(ast->init, type);\n }\n if (type == nullptr) {\n error(loc) << \"Variable must have type annotation or initialiser: \"\n << ast->id << ENDL;\n }\n type->writeable = true;\n GfxGslDef *def = ctx.alloc.makeDef<GfxGslDef>(type, false, false);\n ast->vars[ast->id] = def;\n ast->def = def;\n if (!isFirstClass(ast->def->type))\n error(loc) << \"Loop variable cannot have type: \" << ast->def->type << ENDL;\n inferAndSet(ast->cond, c2.setRead(true));\n inferAndSet(ast->inc, c2);\n inferAndSet(ast->body, c2);\n } else {\n inferAndSet(ast->init, c);\n inferAndSet(ast->cond, c.setRead(true));\n inferAndSet(ast->inc, c);\n inferAndSet(ast->body, c2);\n }\n auto *btype = ctx.alloc.makeType<GfxGslBoolType>();\n doConversion(ast->cond, btype);\n ast->type = ctx.alloc.makeType<GfxGslVoidType>();\n\n } else if (auto *ast = dynamic_cast<GfxGslAssign*>(ast_)) {\n inferAndSet(ast->target, c.setWrite(true));\n if (!ast->target->type->writeable)\n error(loc) << \"Cannot assign to this object.\" << ENDL;\n inferAndSet(ast->expr, c.setRead(true));\n doConversion(ast->expr, ast->target->type);\n ast->type = ctx.alloc.makeType<GfxGslVoidType>();\n\n } else if (auto *ast = dynamic_cast<GfxGslDiscard*>(ast_)) {\n ast->type = ctx.alloc.makeType<GfxGslVoidType>();\n\n } else if (auto *ast = dynamic_cast<GfxGslReturn*>(ast_)) {\n ast->type = ctx.alloc.makeType<GfxGslVoidType>();\n\n } else if (auto *ast = dynamic_cast<GfxGslCall*>(ast_)) {\n if (c.write)\n error(loc) << \"Cannot assign to result of function call.\" << ENDL;\n for (unsigned i=0 ; i<ast->args.size() ; ++i)\n inferAndSet(ast->args[i], c.setRead(true));\n const GfxGslFunctionType *t = lookupFunction(loc, ast->func, ast->args);\n ast->type = cloneType(t->ret);\n\n } else if (auto *ast = dynamic_cast<GfxGslArrayLookup*>(ast_)) {\n inferAndSet(ast->target, c);\n auto *arr_type = dynamic_cast<GfxGslArrayType*>(ast->target->type);\n if (arr_type == nullptr)\n error(loc) << \"Array lookup on \" << ast->target->type << ENDL;\n inferAndSet(ast->index, c);\n auto *index_type = dynamic_cast<GfxGslIntType*>(ast->index->type);\n if (index_type == nullptr || index_type->dim != 1)\n error(loc) << \"Array index had type \" << ast->index->type << ENDL;\n ast->type = cloneType(arr_type->elementType);\n ast->type->writeable = true;\n\n } else if (auto *ast = dynamic_cast<GfxGslField*>(ast_)) {\n inferAndSet(ast->target, c.appendPath(ast->id));\n if (dynamic_cast<GfxGslFragType*>(ast->target->type)) {\n if (fragFields.find(ast->id) == fragFields.end())\n error(loc) << \"Frag field does not exist: \" << ast->id << ENDL;\n const GfxGslType *type = fragFields[ast->id];\n ast->type = cloneType(type);\n ast->type->writeable = false;\n if (c.read) {\n fragFieldsRead.insert(ast->id);\n }\n if (c.write) {\n error(loc) << \"frag.\" << ast->id << \" cannot be written.\" << ENDL;\n }\n } else if (dynamic_cast<GfxGslVertType*>(ast->target->type)) {\n if (vertFields.find(ast->id) == vertFields.end())\n error(loc) << \"vert.\" << ast->id << \" does not exist.\" << ENDL;\n const GfxGslType *type = vertFields[ast->id];\n ast->type = cloneType(type);\n ast->type->writeable = false;\n if (c.read) {\n if (kind == GFX_GSL_VERTEX) {\n vertFieldsRead.insert(ast->id);\n } else {\n addTrans(loc, c.appendPath(ast->id).path, type, true);\n }\n }\n if (c.write)\n error(loc) << \"vert.\" << ast->id << \" cannot be written.\" << ENDL;\n } else if (dynamic_cast<GfxGslOutType*>(ast->target->type)) {\n if (outFields.find(ast->id) == outFields.end())\n error(loc) << \"out.\" << ast->id << \" does not exist.\" << ENDL;\n const GfxGslType *type = outFields[ast->id];\n ast->type = cloneType(type);\n ast->type->writeable = true;\n if (c.write)\n outFieldsWritten.insert(ast->id);\n } else if (dynamic_cast<GfxGslBodyType*>(ast->target->type)) {\n if (ctx.bodyFields.find(ast->id) == ctx.bodyFields.end())\n error(loc) << \"body.\" << ast->id << \" does not exist.\" << ENDL;\n GfxGslFieldType field_t = ctx.bodyFields[ast->id];\n if (field_t.internal && !ctx.internal)\n error(loc) << \"body.\" << ast->id << \" does not exist.\" << ENDL;\n ast->type = cloneType(field_t.t);\n ast->type->writeable = true;\n if (c.write)\n outFieldsWritten.insert(ast->id);\n } else if (dynamic_cast<GfxGslGlobalType*>(ast->target->type)) {\n if (ctx.globalFields.find(ast->id) == ctx.globalFields.end())\n error(loc) << \"global.\" << ast->id << \" does not exist.\" << ENDL;\n GfxGslFieldType field_t = ctx.globalFields[ast->id];\n if (field_t.internal && !ctx.internal)\n error(loc) << \"global.\" << ast->id << \" does not exist.\" << ENDL;\n ast->type = cloneType(field_t.t);\n ast->type->writeable = false;\n if (c.read)\n globalFieldsRead.insert(ast->id);\n if (c.write)\n error(loc) << \"global.\" << ast->id << \" cannot be written.\" << ENDL;\n } else if (dynamic_cast<GfxGslMatType*>(ast->target->type)) {\n if (ctx.matFields.find(ast->id) == ctx.matFields.end())\n error(loc) << \"mat.\" << ast->id << \" does not exist.\" << ENDL;\n GfxGslFieldType field_t = ctx.matFields[ast->id];\n if (field_t.internal && !ctx.internal)\n error(loc) << \"mat.\" << ast->id << \" does not exist.\" << ENDL;\n ast->type = cloneType(field_t.t);\n if (dynamic_cast<GfxGslTextureType*>(ast->type)) {\n if (!frag(kind)) {\n error(loc) << \"Cannot use textures in vertex shader: \" << ast->id << ENDL;\n }\n }\n ast->type->writeable = false;\n if (c.read)\n matFieldsRead.insert(ast->id);\n if (c.write)\n error(loc) << \"mat.\" << ast->id << \" cannot be written.\" << ENDL;\n } else if (auto *ft = dynamic_cast<GfxGslFloatType*>(ast->target->type)) {\n unsigned dim = ft->dim;\n const std::string &id = ast->id;\n if (id.length() > 4) {\n error(loc) << \"Invalid field of \" << ft << \": \" << ast->id << ENDL;\n }\n for (unsigned i=0 ; i<id.length() ; ++i) {\n unsigned offset;\n if (!get_offset(id[i], offset))\n error(loc) << \"Invalid field of \" << ft << \": \" << ast->id << ENDL;\n if (offset >= dim) {\n error(loc) << \"Invalid field of \" << ft << \": \" << ast->id << ENDL;\n }\n }\n ast->type = ctx.alloc.makeType<GfxGslFloatType>(id.length());\n ast->type->writeable = ft->writeable;\n \n } else {\n error(loc) << \"Cannot access field \\\"\" << ast->id << \"\\\" from non-object type: \"\n << ast->target->type << ENDL;\n }\n\n } else if (auto *ast = dynamic_cast<GfxGslLiteralInt*>(ast_)) {\n ast->type = ctx.alloc.makeType<GfxGslIntType>(1);\n\n } else if (auto *ast = dynamic_cast<GfxGslLiteralFloat*>(ast_)) {\n ast->type = ctx.alloc.makeType<GfxGslFloatType>(1);\n\n } else if (auto *ast = dynamic_cast<GfxGslVar*>(ast_)) {\n const GfxGslDef *def = c.lookupVar(ast->id);\n if (def == nullptr) {\n error(loc) << \"Unknown variable: \" << ast->id << ENDL;\n }\n ast->type = cloneType(def->type);\n if (c.write && !ast->type->writeable)\n error(loc) << \"Cannot write to variable: \" << ast->id << ENDL;\n\n if (def->trans)\n addTrans(loc, c.appendPath(ast->id).path, ast->type, false);\n\n } else if (auto *ast = dynamic_cast<GfxGslBinary*>(ast_)) {\n inferAndSet(ast->a, c.setRead(true));\n inferAndSet(ast->b, c.setRead(true));\n unify(loc, ast->a, ast->b);\n GfxGslType *t = ast->a->type;\n switch (ast->op) {\n case GFX_GSL_OP_ADD: \n case GFX_GSL_OP_SUB: \n case GFX_GSL_OP_MUL: \n case GFX_GSL_OP_DIV: \n case GFX_GSL_OP_MOD: {\n if (dynamic_cast<GfxGslCoordType*>(t)) {\n ast->type = cloneType(t);\n } else {\n error(loc) << \"Type error at operator \" << ast->op << ENDL;\n }\n } break;\n\n case GFX_GSL_OP_EQ:\n case GFX_GSL_OP_NE:\n case GFX_GSL_OP_LT:\n case GFX_GSL_OP_LTE:\n case GFX_GSL_OP_GT:\n case GFX_GSL_OP_GTE: {\n if (auto *coord_type = dynamic_cast<GfxGslCoordType*>(t)) {\n if (coord_type->dim != 1)\n error(loc) << \"Expected scalar type, got \" << coord_type << ENDL;\n ast->type = ctx.alloc.makeType<GfxGslBoolType>();\n } else {\n error(loc) << \"Type error at operator \" << ast->op << ENDL;\n }\n } break;\n\n case GFX_GSL_OP_AND:\n case GFX_GSL_OP_OR: {\n if (dynamic_cast<GfxGslBoolType*>(t)) {\n ast->type = ctx.alloc.makeType<GfxGslBoolType>();\n } else {\n error(loc) << \"Type error at operator \" << ast->op << ENDL;\n }\n } break;\n }\n\n } else if (auto *ast = dynamic_cast<GfxGslGlobal*>(ast_)) {\n ast->type = ctx.alloc.makeType<GfxGslGlobalType>();\n\n } else if (auto *ast = dynamic_cast<GfxGslMat*>(ast_)) {\n ast->type = ctx.alloc.makeType<GfxGslMatType>();\n\n } else if (auto *ast = dynamic_cast<GfxGslVert*>(ast_)) {\n ast->type = ctx.alloc.makeType<GfxGslVertType>();\n\n } else if (auto *ast = dynamic_cast<GfxGslFrag*>(ast_)) {\n ast->type = ctx.alloc.makeType<GfxGslFragType>();\n\n } else if (auto *ast = dynamic_cast<GfxGslOut*>(ast_)) {\n ast->type = ctx.alloc.makeType<GfxGslOutType>();\n\n } else if (auto *ast = dynamic_cast<GfxGslBody*>(ast_)) {\n ast->type = ctx.alloc.makeType<GfxGslBodyType>();\n\n } else {\n EXCEPTEX << \"INTERNAL ERROR: Unknown Ast.\" << ENDL;\n\n }\n}\n" }, { "alpha_fraction": 0.5552228093147278, "alphanum_fraction": 0.6216311454772949, "avg_line_length": 34.93037796020508, "blob_id": "5aa110ddc584c4fb1991c6a37765424ccedc6cf2", "content_id": "b787e04e0d31a3dd21f850d3220c5254f6abc23e", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 5677, "license_type": "permissive", "max_line_length": 80, "num_lines": 158, "path": "/gtasa/ideread.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#ifndef IDEREAD_H\n#define IDEREAD_H\n\n\n#include <string>\n#include <vector>\n#include <istream>\n\n#define OBJ_FLAG_WET 1<<0 // 1 0x1 (771 objects)\n#define OBJ_FLAG_NIGHT 1<<1 // 2 0x2 (29 objects)\n#define OBJ_FLAG_ALPHA1 1<<2 // 4 0x4 (2202 objects)\n#define OBJ_FLAG_ALPHA2 1<<3 // 8 0x8 (4 objects)\n#define OBJ_FLAG_DAY 1<<4 // 16 0x10 (0 objects)\n#define OBJ_FLAG_INTERIOR 1<<5 // 32 0x20 (29 objects) door?\n#define OBJ_FLAG_NO_SHADOW 1<<6 // 64 0x40 (244 objects)\n#define OBJ_FLAG_NO_COL 1<<7 // 128 0x80 (4999 objects)\n#define OBJ_FLAG_NO_DRAW_DIST 1<<8 // 256 0x100 (0 objects)\n#define OBJ_FLAG_BREAK_GLASS 1<<9 // 512 0x200 (2 objects)\n#define OBJ_FLAG_BREAK_GLASS_CRACK 1<<10 // 1024 0x400 (8 objects)\n#define OBJ_FLAG_GARAGE_DOOR 1<<11 // 2048 0x800 (56 objects)\n#define OBJ_FLAG_2CLUMP 1<<12 // 4096 0x1000 (69 objects)\n#define OBJ_FLAG_SWAYS 1<<13 // 8192 0x2000 (102 objects)\n#define OBJ_FLAG_OTHER_VEG 1<<14 // 16384 0x4000 (10 objects)\n#define OBJ_FLAG_POLE_SHADOW 1<<15 // 32768 0x8000 (70 objects)\n#define OBJ_FLAG_EXPLOSIVE 1<<16 // 65536 0x10000 (9 objects)\n#define OBJ_FLAG_UNK1 1<<17 // 131072 0x20000 (9 objects)\n#define OBJ_FLAG_UNK2 1<<18 // 262144 0x40000 (1 objects)\n#define OBJ_FLAG_UNK3 1<<19 // 524288 0x80000 (0 objects)\n#define OBJ_FLAG_GRAFITTI 1<<20 // 1048576 0x100000 (9 objects)\n#define OBJ_FLAG_DRAW_BACKFACE 1<<21 // 2097152 0x200000 (1501 objects)\n#define OBJ_FLAG_UNK4 1<<22 // 4194304 0x400000 (6 objects)\n\nclass Obj {\npublic:\n unsigned long id;\n std::string dff;\n std::string txd;\n float draw_distance;\n unsigned long flags;\n bool is_car; // not from ide file\n};\ntypedef std::vector<Obj> Objs;\n\nclass TObj : public Obj {\npublic:\n unsigned char hour_on;\n unsigned char hour_off;\n};\ntypedef std::vector<TObj> TObjs;\n\nclass Anim : public Obj {\npublic:\n std::string ifp_file;\n};\ntypedef std::vector<Anim> Anims;\n\nclass TXDP {\npublic:\n std::string txd1;\n std::string txd2;\n};\ntypedef std::vector<TXDP> TXDPs;\n\nclass Ped {\npublic:\n unsigned long id;\n std::string dff;\n std::string txd;\n std::string stat_type; \n std::string type; \n std::string anim_group;\n unsigned long can_drive; // peds.ide has the values\n bool buys_drugs; // just 0 or 1\n std::string anim_file;\n unsigned long radio1; // peds.ide has the values\n unsigned long radio2; // peds.ide has the values\n std::string unk1;\n std::string unk2;\n std::string unk3;\n};\ntypedef std::vector<Ped> Peds;\n\nclass Vehicle {\npublic:\n unsigned long id;\n std::string dff;\n std::string txd;\n //bike bmx boat car heli mtruck plane quad trailer train\n std::string type; \n std::string handling_id;\n std::string game_name; // for gxt apparently\n // BF_injection biked bikeh bikes bikev bmx bus choppa coach dozer KART\n // mtb nevada null quad rustler shamal tank truck van vortex wayfarer\n std::string anims;\n // bicycle big executive ignore leisureboat moped motorbike normal\n // poorfamily richfamily taxi worker workerboat\n std::string class_;\n unsigned int freq;\n unsigned int flags; // 0 1 or 7\n // 0 1012 1f10 1f341210 2ff0 3012 30123345 3210 3f01 3f10 3f341210 4fff\n unsigned int comp_rules;\n // boats do not have the following:\n int unk1; // on bikes, 16 or 23, otherwise -1\n float front_wheel_size;\n float rear_wheel_size;\n int unk2; // if present -1, 0, 1, 2 (on non-cars always -1)\n};\ntypedef std::vector<Vehicle> Vehicles;\n\nclass Weap {\npublic:\n unsigned long id;\n std::string dff;\n std::string txd;\n std::string type;\n unsigned int unk_one;\n unsigned int unk_num;\n unsigned int unk_zero;\n};\ntypedef std::vector<Weap> Weaps;\n\nstruct ide {\n Objs objs;\n TObjs tobjs;\n TXDPs txdps;\n Anims anims;\n Weaps weaps;\n Vehicles vehicles;\n Peds peds;\n};\n\nvoid read_ide(const std::string &filename, std::istream &f, struct ide *ide);\n\n#endif\n\n\n// vim: shiftwidth=8:tabstop=8:expandtab\n" }, { "alpha_fraction": 0.41698381304740906, "alphanum_fraction": 0.4245956242084503, "avg_line_length": 29.68613052368164, "blob_id": "1a89da507eeef41ce1725b2cd8166ca1531e17b2", "content_id": "79321294df835c234802ce3e3e9188a385325047", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 4204, "license_type": "permissive", "max_line_length": 92, "num_lines": 137, "path": "/gtasa/procobj.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "#include <iostream>\n#include <fstream>\n\n#include \"procobj.h\"\n#include \"ios_util.h\"\n\nstatic float f (const std::string &s) { return (float)strtod(s.c_str(), NULL); }\nstatic bool b (const std::string &s) { return ((int)f(s))==1; }\n\nvoid read_procobj (Csv &csv, ProcObjData &data)\n{\n const CsvSection &s = csv[\"nosection\"];\n for (unsigned i=0 ; i<s.size() ; ++i) {\n const CsvLine &line = s[i];\n APP_ASSERT(line.size()==14);\n\n ProcObj v;\n v.name = line[0];\n\n v.object_name = line[1];\n v.spacing = f(line[2]);\n v.mindist = f(line[3]);\n v.minrot = f(line[4]);\n v.maxrot = f(line[5]);\n v.minscl = f(line[6]);\n v.maxscl = f(line[7]);\n v.minsclz = f(line[8]);\n v.maxsclz = f(line[9]);\n v.zoffmin = f(line[10]);\n v.zoffmax = f(line[11]);\n v.align = b(line[12]);;\n v.use_grid = b(line[13]);;\n\n data.procobjs.push_back(v);\n }\n for (unsigned i=0 ; i<data.procobjs.size() ; ++i) {\n ProcObj &v = data.procobjs[i];\n data[v.name].push_back(&v);\n }\n}\n\n\n\n#ifdef _PROCOBJ_EXEC\n\nvoid assert_triggered (void) { }\n\nvoid app_verbose(char const* file, int line, const std::string& msg)\n{\n std::cout<<BOLD<<GREEN<<\"VERBOSE \"<<RESET\n <<BOLD<<file<<NOBOLD<<\":\"<<BOLD<<line<<NOBOLD\n << \": \\\"\"<<BOLD<<BLUE<<msg<<RESET\"\\\"\";\n std::cout<<std::endl;\n}\n\nvoid app_error(char const* file, int line,\n const std::string& i_was, const std::string& msg)\n{\n std::cout<<BOLD RED\"ERROR \"<<RESET\n <<BOLD<<file<<NOBOLD<<\":\"<<BOLD<<line<<NOBOLD\n <<\": \\\"\"<<BOLD<<YELLOW<<msg<<RESET<<\"\\\"\";\n if (i_was!=\"\")\n std::cout<<\" (\"<<BOLD<<YELLOW<<i_was<<RESET<<\")\";\n std::cout<<std::endl;\n}\n\nvoid app_line(const std::string &msg)\n{\n std::cout<<BOLD<<msg<<NOBOLD<<std::endl;\n}\n\nvoid app_fatal()\n{\n abort();\n}\n\nint main(int argc, char *argv[])\n{\n if (argc!=2) {\n std::cerr<<\"Usage: \"<<argv[0]<<\" <procobj.dat file>\"<<std::endl;\n return EXIT_FAILURE;\n }\n\n try {\n\n std::ifstream procobjfstream;\n std::istream *procobjstream = &procobjfstream;\n std::string filename;\n\n if (strcmp(argv[1],\"-\")==0) {\n procobjstream = &std::cin;\n filename = \"<stdin>\";\n } else {\n filename = argv[1];\n procobjfstream.open (filename.c_str());\n APP_ASSERT_IO_SUCCESSFUL(procobjfstream,\n \"Opening procobj: \"+filename);\n if (procobjfstream.fail() || procobjfstream.bad()) {\n std::stringstream ss;\n ss << filename << \": IO Error: \" << strerror(errno) << \"\\n\";\n GRIT_EXCEPT(ss.str());\n }\n }\n\n Csv procobj;\n procobj.filename = filename;\n read_csv(*procobjstream,procobj);\n ProcObjData data;\n read_procobj(procobj, data);\n\n for (ProcObjData::iterator i=data.begin(), i_=data.end() ; i!=i_ ; ++i) {\n const std::string name = i->first;\n std::cout << name << \": \";\n for (unsigned j=0 ; j<i->second.size() ; ++j) {\n const ProcObj &v = *i->second[j];\n\n APP_ASSERT(name == v.name);\n std::cout << (j==0?\"\":\", \") << v.object_name;\n\n }\n std::cout << std::endl;\n }\n\n } catch (const Exception &e) {\n\n CERR << e << std::endl;\n \n return EXIT_FAILURE;\n\n }\n\n return EXIT_SUCCESS;\n}\n\n#endif\n\n// vim: shiftwidth=8:tabstop=8:expandtab\n" }, { "alpha_fraction": 0.6033353209495544, "alphanum_fraction": 0.6043279767036438, "avg_line_length": 47.88349533081055, "blob_id": "9fa0afda8e003380c1f3707ad88e8187efaf083c", "content_id": "75059c1a9ebbc45f7f00a78ec64f89e1846bd2cd", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 5037, "license_type": "permissive", "max_line_length": 117, "num_lines": 103, "path": "/dependencies/quex-0.34.1/quex/core_engine/generator/drop_out.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "from quex.input.setup import setup as Setup\nimport quex.core_engine.generator.acceptance_info as acceptance_info\nLanguageDB = Setup.language_db\n\ndef do(state, StateIdx, SMD, InitStateF):\n \"\"\"There are two reasons for drop out:\n \n (1) A buffer limit code has been reached.\n\n (2) The current character does not fit in the trigger map (regular drop out).\n \n Case (1) differs from case (2) in the fact that input == buffer limit code. \n If a buffer limit code is reached, a buffer reload needs to be initiated. If\n the character drops over the edge, then a terminal state needs to be targeted.\n \"\"\"\n assert SMD.__class__.__name__ == \"StateMachineDecorator\"\n\n TriggerMap = state.transitions().get_trigger_map()\n\n # -- drop out code (transition to no target state)\n txt = LanguageDB[\"$label-def\"](\"$drop-out\", StateIdx)\n txt += \" \" + LanguageDB[\"$if not BLC\"]\n # -- if it's clear that it's not a buffer limit code, then jump directly\n txt += LanguageDB[\"$label-def\"](\"$drop-out-direct\", StateIdx)\n txt += \" \" + get_drop_out_goto_string(state, StateIdx, SMD.sm(), SMD.backward_lexing_f()) + \"\\n\" \n txt += \" \" + LanguageDB[\"$endif\"] + \"\\n\"\n\n # -- in case of the init state, the end of file has to be checked.\n # (there is no 'begin of file' action in a lexical analyzer when stepping backwards)\n if InitStateF and SMD.backward_lexing_f() == False:\n txt += \" \" + LanguageDB[\"$if EOF\"]\n comment = \"NO CHECK 'last_acceptance != -1' --- first state can **never** be an acceptance state\" \n txt += \" \" + LanguageDB[\"$comment\"](comment) + \"\\n\"\n txt += \" \" + LanguageDB[\"$goto\"](\"$terminal-EOF\") + \"\\n\"\n txt += \" \" + LanguageDB[\"$endif\"]\n\n BufferReloadRequiredOnDropOutF = TriggerMap != [] and not SMD.backward_input_position_detection_f()\n if BufferReloadRequiredOnDropOutF:\n if SMD.backward_lexing_f():\n txt += __reload_backward(StateIdx)\n else:\n # In case that it cannot load anything, it still needs to know where to jump to.\n txt += \" \" + acceptance_info.forward_lexing(state, StateIdx, SMD, ForceF=True)\n txt += __reload_forward(StateIdx)\n\n return txt + \"\\n\"\n\ndef get_forward_load_procedure(StateIndex):\n txt = ' QUEX_DEBUG_PRINT(&me->buffer, \"FORWARD_BUFFER_RELOAD\");\\n'\n txt += \" if( QuexAnalyser_buffer_reload_forward(&me->buffer, &last_acceptance_input_position,\\n\"\n txt += \" post_context_start_position, PostContextStartPositionN) ) {\\n\"\n txt += \" \" + LanguageDB[\"$goto\"](\"$input\", StateIndex) + \"\\n\"\n txt += \" \" + LanguageDB[\"$endif\"] + \"\\n\"\n return txt\n\ndef __reload_forward(StateIndex): \n txt = get_forward_load_procedure(StateIndex)\n txt += ' QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\\n'\n txt += \" \" + LanguageDB[\"$goto-last_acceptance\"] + \"\\n\"\n return txt\n\ndef __reload_backward(StateIndex): \n txt = ' QUEX_DEBUG_PRINT(&me->buffer, \"BACKWARD_BUFFER_RELOAD\");\\n'\n txt += \" if( QuexAnalyser_buffer_reload_backward(&me->buffer) ) {\\n\"\n txt += \" \" + LanguageDB[\"$goto\"](\"$input\", StateIndex) + \"\\n\"\n txt += \" \" + LanguageDB[\"$endif\"] + \"\\n\"\n txt += ' QUEX_DEBUG_PRINT(&me->buffer, \"BUFFER_RELOAD_FAILED\");\\n'\n txt += \" \" + LanguageDB[\"$goto\"](\"$terminal-general\") + \"\\n\"\n return txt\n\ndef __goto_distinct_terminal(Origin):\n LanguageDB = Setup.language_db\n return LanguageDB[\"$goto\"](\"$terminal\", Origin.state_machine_id)\n\ndef __goto_distinct_terminal_direct(Origin):\n LanguageDB = Setup.language_db\n return LanguageDB[\"$goto\"](\"$terminal-direct\", Origin.state_machine_id)\n\ndef get_drop_out_goto_string(state, StateIdx, SM, BackwardLexingF):\n assert state.__class__.__name__ == \"State\"\n assert SM.__class__.__name__ == \"StateMachine\"\n LanguageDB = Setup.language_db\n\n if not BackwardLexingF:\n # (*) forward lexical analysis\n if not state.is_acceptance():\n # -- non-acceptance state drop-outs\n return LanguageDB[\"$goto-last_acceptance\"]\n\n else:\n if acceptance_info.do_subsequent_states_require_storage_of_last_acceptance_position(StateIdx, state, SM):\n callback = __goto_distinct_terminal\n else:\n callback = __goto_distinct_terminal_direct\n # -- acceptance state drop outs\n return acceptance_info.get_acceptance_detector(state.origins().get_list(), callback)\n\n else:\n # (*) backward lexical analysis\n # During backward lexing, there are no dedicated terminal states. Only the flags\n # 'pre-condition' fullfilled are set at the acceptance states. On drop out we\n # transit to the general terminal state (== start of forward lexing).\n return LanguageDB[\"$goto\"](\"$terminal-general\", True) \n\n" }, { "alpha_fraction": 0.6121883392333984, "alphanum_fraction": 0.650046169757843, "avg_line_length": 35.06666564941406, "blob_id": "5790ca4c8ed14c9fa00c6987a8fd7116d66da0d2", "content_id": "7d86b4244fb75be85cc895b93024f435c548bc82", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Shell", "length_bytes": 1083, "license_type": "permissive", "max_line_length": 110, "num_lines": 30, "path": "/dependencies/quex-0.34.1/demo/004/benchmark/run-icpc.sh", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "stamp=`date +%Yy%mm%dd-%Hh%M`\noutput=\"result-$stamp.dat\"\n#\nCOMPILER=icpc\nCOMPILER_V=10.1.018\nCOMPILER_DIR=/opt/intel/cc/10.1.018/bin\n#\ncd ..\nsource $COMPILER_DIR/iccvars.sh\n# NOTE -msse3 --> only for CoreDuo Processors\nmake clean; make OPTIMIZATION='-O3 -msse3 -ipo -no-prec-div -static' COMPILER=$COMPILER COMPILER_V=$COMPILER_V\ncd benchmark\n../lexer-lc many-tiny-tokens.c > $output\n../lexer-lc single-large-token.c >> $output\n../lexer-lc linux-2.6.22.17-kernel-dir.c >> $output\n\n../lexer many-tiny-tokens.c >> $output\n../lexer single-large-token.c >> $output\n../lexer linux-2.6.22.17-kernel-dir.c >> $output\n\ncd ..\nmake clean; make OPTIMIZATION='-O3 -msse3 -ipo -no-prec-div -static' COMPILER=$COMPILER COMPILER_V=$COMPILER_V\ncd benchmark\n../lexer-lc many-tiny-tokens.c >> $output\n../lexer-lc single-large-token.c >> $output\n../lexer-lc linux-2.6.22.17-kernel-dir.c >> $output\n\n../lexer many-tiny-tokens.c >> $output\n../lexer single-large-token.c >> $output\n../lexer linux-2.6.22.17-kernel-dir.c >> $output\n\n" }, { "alpha_fraction": 0.528801441192627, "alphanum_fraction": 0.5471739172935486, "avg_line_length": 31.69611358642578, "blob_id": "43793adb66612b6d677349af5f85d04cfb4137ff", "content_id": "2d6d8c0157483a0fbe1c6448e88722dfedb8cd5b", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 9253, "license_type": "permissive", "max_line_length": 100, "num_lines": 283, "path": "/engine/win32/keyboard_win_api.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <assert.h>\n#include <iostream>\n\n#include <unicode_util.h>\n\n#include \"keyboard_win_api.h\"\n#include <centralised_log.h>\n\ntypedef std::map<HWND, KeyboardWinAPI*> WindowMap;\nstatic WindowMap wmap;\n\nstatic std::string errorstr (void)\n{\n char sys_msg[256];\n DWORD err = GetLastError();\n\n FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM |\n FORMAT_MESSAGE_IGNORE_INSERTS, NULL, err,\n MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),\n sys_msg, sizeof sys_msg, NULL);\n\n // Trim the end of the line and terminate it with a null\n char *p = sys_msg;\n while (*p > 31 || *p == 9)\n p++;\n do {\n *p = 0;\n p--;\n } while (p >= sys_msg && (*p == '.' || *p < 33));\n\n return std::string(sys_msg);\n}\n\nstatic LRESULT WINAPI wndproc (HWND msgwin, UINT msg, WPARAM wParam, LPARAM lParam)\n{\n KeyboardWinAPI *kb = wmap[msgwin];\n if (!kb) {\n CERR << \"Got a message from an unknown window: 0x\" << (void*)msgwin << std::endl;\n return 0;\n }\n return kb->wndproc(msgwin, msg, wParam, lParam);\n}\n\nKeyboardWinAPI::KeyboardWinAPI (size_t window)\n{\n win = (HWND)window;\n\n\n SetLastError(0);\n old_wndproc = (WNDPROC) SetWindowLong(win, GWL_WNDPROC,\n (LONG)::wndproc);\n if (!old_wndproc) {\n if (GetLastError()) CERR << \"Could not trap keyboard events: \" << errorstr() << std::endl;\n }\n\n wmap[win] = this;\n}\n\nKeyboardWinAPI::~KeyboardWinAPI (void)\n{\n SetWindowLong(win, GWL_WNDPROC, (LONG) old_wndproc);\n}\n\nbool KeyboardWinAPI::hasFocus (void)\n{\n return GetActiveWindow() == win;\n}\n\n\nKeyboard::Press KeyboardWinAPI::getPress (WPARAM wParam, LPARAM scan_code)\n{\n Keyboard::Press r;\n BYTE state[256] = {0};\n\n WCHAR buf[1024] = {0};\n int ret = ToUnicodeEx(wParam, scan_code, state,\n buf, sizeof(buf)/sizeof(*buf),\n 0, GetKeyboardLayout(0));\n\n bool dead = false;\n if (ret==-1) {\n /* The specified virtual key is a dead-key character (accent or diacritic).\n * This value is returned regardless of the keyboard layout, even if several\n * characters have been typed and are stored in the keyboard state. If possible,\n * even with Unicode keyboard layouts, the function has written a spacing\n * version of the dead-key character to the buffer specified by pwszBuff.\n * For example, the function writes the character SPACING ACUTE (0x00B4),\n * rather than the character NON_SPACING ACUTE (0x0301). */\n\n // We still want to allow this key to be bound to things, so provide the spacing char as\n // the key.\n ret = 1;\n dead = true; // for debug output\n }\n if (ret<0 || ret>=sizeof(buf)/sizeof(*buf)) {\n CERR << \"ToUnicodeEx returned out of range: \" << ret << std::endl;\n ret = 0;\n }\n if (ret>1) {\n /* Two or more characters were written to the buffer specified by pwszBuff. The\n * most common cause for this is that a dead-key character (accent or diacritic)\n * stored in the keyboard layout could not be combined with the specified virtual\n * key to form a single character. */\n // No idea what this means but I think I should ignore anything from the 'previous' key\n // HACK: this may break if buf contains surrogate pairs!\n buf[0] = buf[ret-1];\n ret = 1;\n }\n\n buf[ret] = 0;\n if (verbose) {\n std::stringstream ss;\n ss << \"[\";\n for (int i=0 ; i<ret ; ++i) {\n ss << (i==0 ? \" \" : \", \") << std::hex << \"0x\" << ((int)buf[i]) << std::dec;\n }\n ss << \" ]\";\n if (dead) ss << \"!\";\n CLOG << ss.str() << std::endl;\n }\n\n return utf16_to_utf8(buf);\n}\n\nLRESULT KeyboardWinAPI::wndproc (HWND msgwin, UINT msg, WPARAM wParam, LPARAM lParam)\n{\n LPARAM repeat_count = lParam & 0x0000FFFF;\n LPARAM scan_code = lParam & 0x00FF0000;\n LPARAM extended = lParam & 0x01000000;\n LPARAM context_code = lParam & 0x20000000;\n LPARAM was_down = lParam & 0x40000000;\n LPARAM key_up = lParam & 0x80000000;\n std::string key;\n if (key_up) {\n key = \"-\";\n } else {\n key = was_down ? \"=\" : \"+\";\n }\n bool have_key = false;\n switch (msg) {\n case WM_CHAR:\n case WM_UNICHAR: {\n key = \":\";\n // control chars\n if (wParam < 0x20 || (wParam >= 0x7f && wParam < 0xa0)) break;\n encode_utf8(wParam, key);\n if (verbose) {\n CLOG << (void*)msg << \": \\\"\" << key << \"\\\" from \" << wParam << \": \" << \"x\"\n << repeat_count << std::endl;\n }\n have_key = true;\n }; break;\n\n case WM_KEYDOWN:\n case WM_KEYUP:\n case WM_SYSKEYDOWN:\n case WM_SYSKEYUP:\n if (verbose) {\n CLOG << (void*)msg << \": \" << key << wParam << \": \" << \"x\" << repeat_count << std::endl;\n }\n switch (wParam) {\n #define MAP_KEY(vk, name) case vk: { \\\n key += name; \\\n have_key = true; \\\n }; break\n MAP_KEY(VK_SPACE, \"Space\");\n MAP_KEY(VK_BACK, \"BackSpace\");\n MAP_KEY(VK_ESCAPE, \"Escape\");\n MAP_KEY(VK_CAPITAL, \"CapsLock\");\n MAP_KEY(VK_TAB, \"Tab\");\n MAP_KEY(VK_RETURN, \"Return\");\n MAP_KEY(VK_CONTROL, \"Ctrl\");\n //MAP_KEY(VK_LCONTROL, \"Ctrl\");\n //MAP_KEY(VK_RCONTROL, \"Ctrl\");\n MAP_KEY(VK_MENU, \"Alt\");\n //MAP_KEY(VK_LMENU, \"Alt\");\n //MAP_KEY(VK_RMENU, \"Alt\");\n\n MAP_KEY(VK_F1, \"F1\");\n MAP_KEY(VK_F2, \"F2\");\n MAP_KEY(VK_F3, \"F3\");\n MAP_KEY(VK_F4, \"F4\");\n MAP_KEY(VK_F5, \"F5\");\n MAP_KEY(VK_F6, \"F6\");\n MAP_KEY(VK_F7, \"F7\");\n MAP_KEY(VK_F8, \"F8\");\n MAP_KEY(VK_F9, \"F9\");\n MAP_KEY(VK_F10, \"F10\");\n MAP_KEY(VK_F11, \"F11\");\n MAP_KEY(VK_F12, \"F12\");\n MAP_KEY(VK_F13, \"F13\");\n MAP_KEY(VK_F14, \"F14\");\n MAP_KEY(VK_F15, \"F15\");\n\n MAP_KEY(VK_NUMPAD0, \"NUMPAD0\");\n MAP_KEY(VK_NUMPAD1, \"NUMPAD1\");\n MAP_KEY(VK_NUMPAD2, \"NUMPAD2\");\n MAP_KEY(VK_NUMPAD3, \"NUMPAD3\");\n MAP_KEY(VK_NUMPAD4, \"NUMPAD4\");\n MAP_KEY(VK_NUMPAD5, \"NUMPAD5\");\n MAP_KEY(VK_NUMPAD6, \"NUMPAD6\");\n MAP_KEY(VK_NUMPAD7, \"NUMPAD7\");\n MAP_KEY(VK_NUMPAD8, \"NUMPAD8\");\n MAP_KEY(VK_NUMPAD9, \"NUMPAD9\");\n\n MAP_KEY(VK_UP, \"Up\");\n MAP_KEY(VK_DOWN, \"Down\");\n MAP_KEY(VK_LEFT, \"Left\");\n MAP_KEY(VK_RIGHT, \"Right\");\n\n MAP_KEY(VK_PRIOR, \"PageUp\");\n MAP_KEY(VK_NEXT, \"PageDown\");\n MAP_KEY(VK_HOME, \"Home\");\n MAP_KEY(VK_END, \"End\");\n\n MAP_KEY(VK_NUMLOCK, \"NumLock\");\n MAP_KEY(VK_SCROLL, \"Scroll\");\n MAP_KEY(VK_PAUSE, \"Pause\");\n\n MAP_KEY(VK_SHIFT, \"Shift\");\n\n MAP_KEY(VK_INSERT, \"Insert\");\n MAP_KEY(VK_DELETE, \"Delete\");\n\n MAP_KEY(VK_LWIN, \"Win\");\n MAP_KEY(VK_RWIN, \"Win\");\n MAP_KEY(VK_APPS, \"Menu\");\n\n MAP_KEY(VK_SNAPSHOT, \"PrintScreen\");\n\n MAP_KEY(VK_CONVERT, \"Convert\");\n MAP_KEY(VK_NONCONVERT, \"Nonconvert\");\n MAP_KEY(VK_ACCEPT, \"Accept\");\n MAP_KEY(VK_MODECHANGE, \"Modechange\");\n MAP_KEY(VK_SELECT, \"Select\");\n MAP_KEY(VK_PRINT, \"Print\");\n MAP_KEY(VK_EXECUTE, \"Execute\");\n MAP_KEY(VK_HELP, \"Help\");\n\n default: {\n key += getPress(wParam, scan_code);\n have_key = true;\n }\n }\n break;\n }\n\n if (have_key) {\n for (int i=0 ; i<repeat_count ; ++i)\n presses.push_back(key);\n }\n\n return CallWindowProc(old_wndproc, msgwin, msg, wParam, lParam);\n}\n\n\nKeyboard::Presses KeyboardWinAPI::getPresses (void)\n{\n Keyboard::Presses ret = presses;\n presses.clear();\n return ret;\n}\n" }, { "alpha_fraction": 0.562158465385437, "alphanum_fraction": 0.562272310256958, "avg_line_length": 47.75, "blob_id": "805fa8ab77942108f806d3f58013e26a2177e485", "content_id": "3698b68076405b3557e0252aab0c105ee9dd92c0", "detected_licenses": [ "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 8784, "license_type": "permissive", "max_line_length": 112, "num_lines": 180, "path": "/dependencies/quex-0.34.1/quex/core_engine/generator/core.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "import quex.core_engine.generator.languages.core as languages\nimport quex.core_engine.generator.state_machine_coder as state_machine_coder\nimport quex.core_engine.generator.input_position_backward_detector as backward_detector\nfrom quex.core_engine.generator.state_machine_decorator import StateMachineDecorator\nfrom quex.input.setup import setup as Setup\nfrom quex.frs_py.string_handling import blue_print\n#\nfrom quex.core_engine.generator.base import GeneratorBase\n\nclass Generator(GeneratorBase):\n\n def __init__(self, PatternActionPair_List, \n StateMachineName, AnalyserStateClassName, Language, \n DefaultAction, EndOfStreamAction, \n ModeNameList, \n PrintStateMachineF, StandAloneAnalyserF):\n\n self.state_machine_name = StateMachineName\n self.analyzer_state_class_name = AnalyserStateClassName\n self.programming_language = Language\n self.language_db = Setup.language_db\n self.end_of_stream_action = EndOfStreamAction\n self.default_action = DefaultAction\n self.mode_name_list = ModeNameList\n self.print_state_machine_f = PrintStateMachineF\n self.stand_alone_analyzer_f = StandAloneAnalyserF\n\n GeneratorBase.__init__(self, PatternActionPair_List, StateMachineName)\n\n def __get_core_state_machine(self):\n LanguageDB = self.language_db \n\n assert self.sm.get_orphaned_state_index_list() == []\n\n # -- comment all state machine transitions \n txt = \" \" + LanguageDB[\"$comment\"](\"state machine\") + \"\\n\"\n if self.print_state_machine_f: \n txt += LanguageDB[\"$ml-comment\"](self.sm.get_string(NormalizeF=False)) + \"\\n\"\n\n decorated_state_machine = StateMachineDecorator(self.sm, \n self.state_machine_name, \n self.post_contexted_sm_id_list, \n BackwardLexingF=False, \n BackwardInputPositionDetectionF=False)\n\n msg = state_machine_coder.do(decorated_state_machine)\n txt += msg\n\n \n # -- terminal states: execution of pattern actions \n txt += LanguageDB[\"$terminal-code\"](decorated_state_machine,\n self.action_db, \n self.default_action, \n self.end_of_stream_action, \n self.begin_of_line_condition_f, \n self.pre_context_sm_id_list,\n self.language_db) \n\n return txt\n\n def __get_combined_pre_context_state_machine(self):\n LanguageDB = self.language_db\n\n assert self.pre_context_sm.get_orphaned_state_index_list() == []\n\n txt = \" \" + LanguageDB[\"$comment\"](\"state machine for pre-condition test:\") + \"\\n\"\n if self.print_state_machine_f: \n txt += LanguageDB[\"$ml-comment\"](self.pre_context_sm.get_string(NormalizeF=False)) + \"\\n\"\n\n decorated_state_machine = StateMachineDecorator(self.pre_context_sm, \n self.state_machine_name, \n PostContextSM_ID_List=[],\n BackwardLexingF=True, \n BackwardInputPositionDetectionF=False)\n\n msg = state_machine_coder.do(decorated_state_machine)\n\n txt += msg\n\n txt += LanguageDB[\"$label-def\"](\"$terminal-general\", True) + \"\\n\"\n # -- set the input stream back to the real current position.\n # during backward lexing the analyser went backwards, so it needs to be reset.\n txt += \" QuexBuffer_seek_lexeme_start(&me->buffer);\\n\"\n\n return txt\n\n def do(self):\n LanguageDB = self.language_db\n\n # -- state machines for backward input position detection (pseudo ambiguous post conditions)\n papc_input_postion_backward_detector_functions = \"\"\n for sm in self.papc_backward_detector_state_machine_list:\n assert sm.get_orphaned_state_index_list() == []\n papc_input_postion_backward_detector_functions += \\\n backward_detector.do(sm, LanguageDB, self.print_state_machine_f)\n\n function_body = \"\"\n # -- write the combined pre-condition state machine\n if self.pre_context_sm_list != []:\n function_body += self.__get_combined_pre_context_state_machine()\n \n # -- write the state machine of the 'core' patterns (i.e. no pre-conditions)\n function_body += self.__get_core_state_machine()\n\n # -- pack the whole thing into a function \n analyzer_function = LanguageDB[\"$analyser-func\"](self.state_machine_name, \n self.analyzer_state_class_name, \n self.stand_alone_analyzer_f,\n function_body, \n self.post_contexted_sm_id_list, \n self.pre_context_sm_id_list,\n self.mode_name_list, \n InitialStateIndex=self.sm.init_state_index,\n LanguageDB=LanguageDB) \n\n option_str = \"\"\n if self.begin_of_line_condition_f: \n option_str = LanguageDB[\"$compile-option\"](\"__QUEX_CORE_OPTION_SUPPORT_BEGIN_OF_LINE_PRE_CONDITION\")\n\n # -- paste the papc functions (if there are some) in front of the analyzer functions\n header_str = LanguageDB[\"$header-definitions\"](LanguageDB)\n txt = option_str \\\n + header_str \\\n + papc_input_postion_backward_detector_functions \\\n + analyzer_function\n\n return languages.replace_keywords(txt, LanguageDB, NoIndentF=True)\n\ndef do(PatternActionPair_List, DefaultAction, \n EndOfStreamAction, Language=\"C++\", StateMachineName=\"\",\n PrintStateMachineF=False,\n AnalyserStateClassName=\"analyser_state\",\n StandAloneAnalyserF=False,\n QuexEngineHeaderDefinitionFile=\"\",\n ModeNameList=[]):\n \"\"\"Contains a list of pattern-action pairs, i.e. its elements contain\n pairs of state machines and associated actions to be take,\n when a pattern matches. \n\n NOTE: From this level of abstraction downwards, a pattern is \n represented as a state machine. No longer the term pattern\n is used. The pattern to which particular states belong are\n kept track of by using an 'origin' list that contains \n state machine ids (== pattern ids) and the original \n state index.\n \n ** A Pattern is Identified by the State Machine ID**\n \n NOTE: It is crucial that the pattern priviledges have been entered\n into 'state_machine_id_ranking_db' in state_machine.index\n if they are to be priorized. Further, priviledged state machines\n must have been created **earlier** then lesser priviledged\n state machines.\n \"\"\"\n return Generator(PatternActionPair_List, \n StateMachineName, AnalyserStateClassName, Language, \n DefaultAction, EndOfStreamAction, ModeNameList, \n PrintStateMachineF, StandAloneAnalyserF).do()\n \ndef frame_this(Code):\n return Setup.language_db[\"$frame\"](Code, Setup.output_file_stem, Setup.output_engine_name)\n\ndef delete_unused_labels(Code):\n LanguageDB = Setup.language_db\n label_list = languages.label_db_get_unused_label_list()\n\n replacement_list_db = {}\n for label in label_list:\n original = LanguageDB[\"$label-pure\"](label)\n replacement = LanguageDB[\"$ml-comment\"](original)\n first_letter = original[0]\n if replacement_list_db.has_key(first_letter) == False:\n replacement_list_db[first_letter] = [ [original, replacement] ]\n else:\n replacement_list_db[first_letter].append([original, replacement])\n\n code = Code\n for first_letter, replacement_list in replacement_list_db.items():\n code = blue_print(code, replacement_list, first_letter)\n return code\n \n" }, { "alpha_fraction": 0.670255184173584, "alphanum_fraction": 0.6718500852584839, "avg_line_length": 37, "blob_id": "e6dcc974ccf47c83609e495d86726288913bd1ef", "content_id": "a23b8099d7a529f8283cab45c554bc047a5278f0", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 2508, "license_type": "permissive", "max_line_length": 80, "num_lines": 66, "path": "/gtasa/csvread.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016 \n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE. \n */ \n \n#ifndef CSVREAD_H \n#define CSVREAD_H \n\n#include <istream>\n#include <vector>\n#include <string>\n#include <map>\n\nstruct CsvLine {\n std::vector<std::string> vals;\n int orig_line;\n int section_line;\n const std::string &operator [] (size_t i) const { return vals[i]; }\n std::string &operator [] (size_t i) { return vals[i]; }\n size_t size (void) const { return vals.size(); }\n void push_back (const std::string &val) { return vals.push_back(val); }\n};\n\nstruct CsvSection {\n std::vector<CsvLine> lines;\n std::string section_name;\n const CsvLine &operator [] (size_t i) const { return lines[i]; }\n CsvLine &operator [] (size_t i) { return lines[i]; }\n size_t size (void) const { return lines.size(); }\n void push_back (const CsvLine &line) { return lines.push_back(line); }\n};\n\n\nstruct Csv {\n typedef std::map<std::string,CsvSection> SectionMap;\n typedef SectionMap::iterator iterator;\n SectionMap sections;\n\n CsvSection &operator [] (const std::string &i) { return sections[i]; }\n\n iterator begin() { return sections.begin(); }\n iterator end() { return sections.end(); }\n iterator find(const std::string &i) { return sections.find(i); }\n\n std::string filename;\n};\n\nvoid read_csv (std::istream &f, Csv &csv);\n\n#endif\n" }, { "alpha_fraction": 0.6842938661575317, "alphanum_fraction": 0.6871437430381775, "avg_line_length": 32.95698928833008, "blob_id": "4e95d8fb267865f07073d6d51f2a045f93635723", "content_id": "75642710feb9928213821cc833bf30712a7bb534", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 3158, "license_type": "permissive", "max_line_length": 99, "num_lines": 93, "path": "/engine/gfx/gfx_font.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <vector>\n\nclass GfxFont;\ntypedef std::vector<GfxFont*> GfxFonts;\n\n#ifndef GFXFONT_H\n#define GFXFONT_H\n\n#include <map>\n\n#include <math_util.h>\n\n#include \"../background_loader.h\"\n#include \"../main.h\"\n\n#include \"gfx_disk_resource.h\"\n\nclass GfxFont {\n public:\n typedef unsigned long codepoint_t;\n struct CharRect {\n unsigned long u1, v1, u2, v2;\n };\n typedef std::map<codepoint_t, CharRect> CharRectMap;\n const std::string name;\n private:\n DiskResourcePtr<GfxTextureDiskResource> texture;\n unsigned long height;\n CharRectMap coords;\n public:\n GfxFont (const std::string &name, GfxTextureDiskResource *tex, unsigned long height)\n : name(name), texture(tex), height(height)\n {\n if (!texture->isLoaded()) texture->load();\n }\n ~GfxFont (void)\n {\n }\n unsigned long getHeight (void) { return height; }\n void setHeight (unsigned long v) { height = v; }\n GfxTextureDiskResource *getTexture (void) {\n return &*texture;\n }\n void setTexture (const DiskResourcePtr<GfxTextureDiskResource> &tex) {\n APP_ASSERT(tex != nullptr);\n if (!tex->isLoaded()) tex->load();\n texture = tex;\n }\n bool hasCodePoint (codepoint_t cp) const {\n CharRectMap::const_iterator it = coords.find(cp);\n return it != coords.end();\n }\n void setCodePoint (codepoint_t cp, const CharRect &r) {\n coords[cp] = r;\n }\n bool getCodePointOrFail (codepoint_t cp, CharRect &r) const {\n CharRectMap::const_iterator it = coords.find(cp);\n if (it == coords.end()) return false;\n r = it->second;\n return true;\n }\n Vector2 getTextureDimensions (void);\n void clearCodePoints (void) { coords.clear(); }\n};\n\nbool gfx_font_has (const std::string &name);\nGfxFont *gfx_font_get (const std::string &name);\nstd::vector<GfxFont*> gfx_font_list (void);\nGfxFont *gfx_font_make (const std::string &name, GfxTextureDiskResource *dr, unsigned long height);\nunsigned long gfx_font_num (void);\n\n#endif\n" }, { "alpha_fraction": 0.5985051989555359, "alphanum_fraction": 0.6119202971458435, "avg_line_length": 32.8099365234375, "blob_id": "3bad58c691b7ccee3ee065cc35a96ab23b877f8a", "content_id": "3c6a91f688d834425b40bea1588e81b73007c79e", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 15654, "license_type": "permissive", "max_line_length": 100, "num_lines": 463, "path": "/engine/gfx/gfx_particle_system.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to\n * deal in the Software without restriction, including without limitation the\n * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\n * sell copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n\n#include <string>\n#include <algorithm>\n#include <map>\n\n#include <math_util.h>\n\n#include \"../vect_util.h\"\n\n#include \"gfx.h\"\n#include \"gfx_internal.h\"\n#include \"gfx_particle_system.h\"\n#include \"gfx_pipeline.h\"\n#include \"gfx_shader.h\"\n\nconst unsigned quad_vertexes = 4;\nstatic Ogre::HardwareVertexBufferSharedPtr quadVertexBuffer;\nstatic Ogre::IndexData quadIndexData;\n\n#define QUAD(a,b,c,d) a, b, d, d, b, c\n\nstatic GfxShader *shader;\n\nvoid gfx_particle_init (void)\n{\n // set up the quad geometry\n const unsigned quad_triangles = 2;\n\n quadVertexBuffer =\n Ogre::HardwareBufferManager::getSingleton().createVertexBuffer(\n 12, quad_vertexes, Ogre::HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY);\n\n float vdata_raw[3 * quad_vertexes] = {\n -1, 0, -1,\n -1, 0, 1,\n 1, 0, -1,\n 1, 0, 1,\n };\n quadVertexBuffer->writeData(0, 3 * quad_vertexes * sizeof(float), &vdata_raw[0]);\n\n // Prepare index buffer\n quadIndexData.indexBuffer = Ogre::HardwareBufferManager::getSingleton()\n .createIndexBuffer(Ogre::HardwareIndexBuffer::IT_16BIT, 3*quad_triangles,\n Ogre::HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY);\n quadIndexData.indexStart = 0;\n quadIndexData.indexCount = 3*quad_triangles;\n uint16_t idata_raw[] = { QUAD(0,2,3,1), };\n quadIndexData.indexBuffer->writeData(0, 3 * quad_triangles * sizeof(uint16_t), &idata_raw[0]);\n\n GfxGslRunParams shader_params = {\n {\"gbuffer0\", GfxGslParam(GFX_GSL_FLOAT_TEXTURE2, 1, 1, 1, 1)},\n {\"particleAtlas\", GfxGslParam(GFX_GSL_FLOAT_TEXTURE2, 1, 1, 1, 1)}\n };\n\n std::string vertex_code =\n \"var part_basis_x = vert.coord0.xyz;\\n\"\n \"var part_half_depth = vert.coord1.x;\\n\"\n \"var part_basis_z = vert.coord2.xyz;\\n\"\n \"var part_pos = vert.coord3.xyz;\\n\"\n \"var part_diffuse = vert.coord4.xyz;\\n\"\n \"var part_alpha = vert.coord5.x;\\n\"\n \"var part_emissive = vert.coord6.xyz;\\n\"\n\n \"var fragment_uv = lerp(vert.coord7.xy, vert.coord7.zw,\\n\"\n \" vert.position.xz / Float2(2, -2) + Float2(0.5, 0.5));\\n\"\n \"var part_colour = global.particleAmbient * part_diffuse + part_emissive;\\n\"\n\n \"out.position = vert.position.x * part_basis_x\\n\"\n \" + vert.position.z * part_basis_z\\n\"\n \" + part_pos;\\n\"\n\n \"var camera_to_fragment = out.position - global.cameraPos;\\n\";\n\n std::string colour_code =\n \"var uv = frag.screen / global.viewportSize;\\n\"\n \"var ray = lerp(lerp(global.rayBottomLeft, global.rayBottomRight, uv.x),\\n\"\n \" lerp(global.rayTopLeft, global.rayTopRight, uv.x),\\n\"\n \" uv.y);\\n\"\n \"uv.y = 1 - uv.y; // Textures addressed from top left, frag.screen is bottom left\\n\"\n\n \"var bytes = sample(mat.gbuffer0, uv).xyz;\\n\"\n \"var normalised_cam_dist = 255.0 * (256.0*256.0*bytes.x + 256.0*bytes.y + bytes.z)\\n\"\n \" / (256.0*256.0*256.0 - 1);\\n\"\n\n \"var scene_dist = length(normalised_cam_dist * ray);\\n\"\n \"var fragment_dist = length(camera_to_fragment);\\n\"\n \"var part_exposed_ = (scene_dist - fragment_dist + part_half_depth)\\n\"\n \" / part_half_depth;\\n\"\n \"var part_exposed = clamp(part_exposed_, 0.0, 1.0);\\n\"\n \"var texel = sample(mat.particleAtlas, fragment_uv);\\n\"\n \"out.colour = texel.rgb * part_colour * part_exposed;\\n\"\n \"out.alpha = texel.a * part_alpha * part_exposed;\\n\"\n \"out.colour = out.colour * out.alpha;\\n\";\n\n shader = gfx_shader_make_or_reset(\"/system/Particle\",\n vertex_code, \"\", colour_code, shader_params, true);\n\n\n}\n\n\nclass ParticlesInstanceBuffer {\n Ogre::HardwareVertexBufferSharedPtr instBuf;\n Ogre::RenderOperation renderOp;\n Ogre::VertexData vertexData;\n unsigned instBufVertexSize;\n\n float *instPtr, *instPtr0;\n unsigned maxInstances;\n\n unsigned instancesAdded (void)\n { return ((instPtr - instPtr0)*sizeof(float)) / instBufVertexSize; }\n\n\n public:\n\n ParticlesInstanceBuffer (void)\n {\n auto d = vertexData.vertexDeclaration;\n // Prepare vertex buffer\n vertexData.vertexStart = 0;\n vertexData.vertexCount = quad_vertexes;\n\n // Non-instanced data\n unsigned vdecl_size = 0;\n vdecl_size += d->addElement(0, vdecl_size, Ogre::VET_FLOAT3, Ogre::VES_POSITION).getSize();\n vertexData.vertexBufferBinding->setBinding(0, quadVertexBuffer);\n\n auto tc = Ogre::VES_TEXTURE_COORDINATES;\n // Instanced data\n instBufVertexSize = 0;\n // basis_x\n instBufVertexSize += d->addElement(1, instBufVertexSize, Ogre::VET_FLOAT3, tc, 0).getSize();\n // half_depth\n instBufVertexSize += d->addElement(1, instBufVertexSize, Ogre::VET_FLOAT1, tc, 1).getSize();\n // basis_z\n instBufVertexSize += d->addElement(1, instBufVertexSize, Ogre::VET_FLOAT3, tc, 2).getSize();\n // position 3xfloat\n instBufVertexSize += d->addElement(1, instBufVertexSize, Ogre::VET_FLOAT3, tc, 3).getSize();\n // diffuse 3xfloat\n instBufVertexSize += d->addElement(1, instBufVertexSize, Ogre::VET_FLOAT3, tc, 4).getSize();\n // alpha\n instBufVertexSize += d->addElement(1, instBufVertexSize, Ogre::VET_FLOAT1, tc, 5).getSize();\n // emissive 3xfloat\n instBufVertexSize += d->addElement(1, instBufVertexSize, Ogre::VET_FLOAT3, tc, 6).getSize();\n // uv1, uv2\n instBufVertexSize += d->addElement(1, instBufVertexSize, Ogre::VET_FLOAT4, tc, 7).getSize();\n\n renderOp.vertexData = &vertexData;\n renderOp.indexData = &quadIndexData;\n renderOp.operationType = Ogre::RenderOperation::OT_TRIANGLE_LIST;\n renderOp.useIndexes = true;\n instPtr = NULL;\n instPtr0 = NULL;\n maxInstances = 0;\n }\n\n void beginParticles (unsigned instances)\n {\n \n if (instances > maxInstances) {\n maxInstances = instances;\n instBuf = Ogre::HardwareBufferManager::getSingleton().createVertexBuffer(\n instBufVertexSize, instances, Ogre::HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY);\n instBuf->setIsInstanceData(true);\n instBuf->setInstanceDataStepRate(1);\n vertexData.vertexBufferBinding->setBinding(1, instBuf);\n }\n\n instPtr0 = instPtr = static_cast<float*>(instBuf->lock(Ogre::HardwareBuffer::HBL_DISCARD));\n }\n\n void addParticle (const Vector3 &cam_up, GfxParticle *p)\n {\n // right hand coordinate system -- +Z is towards the viewer\n Vector3 basis_y = p->fromCamNorm;\n Vector3 basis_z = cam_up; // not necessarily perpendicular to basis_z yet\n Vector3 basis_x = basis_y.cross(basis_z); // perp to z\n\n basis_x *= p->dimensions.x / 2;\n basis_z *= p->dimensions.y / 2;\n\n // rotate around y\n Degree angle(p->angle);\n float sin_angle = gritsin(angle);\n float cos_angle = gritcos(angle);\n Vector3 basis_x2 = cos_angle*basis_x + sin_angle*basis_z;\n Vector3 basis_z2 = cos_angle*basis_z - sin_angle*basis_x;\n\n std::pair<unsigned, unsigned> tex_size = p->getTextureSize();\n\n *(instPtr++) = basis_x2.x;\n *(instPtr++) = basis_x2.y;\n *(instPtr++) = basis_x2.z;\n *(instPtr++) = p->dimensions.z / 2;\n *(instPtr++) = basis_z2.x;\n *(instPtr++) = basis_z2.y;\n *(instPtr++) = basis_z2.z;\n *(instPtr++) = p->pos.x;\n *(instPtr++) = p->pos.y;\n *(instPtr++) = p->pos.z;\n *(instPtr++) = p->diffuse.x;\n *(instPtr++) = p->diffuse.y;\n *(instPtr++) = p->diffuse.z;\n *(instPtr++) = p->alpha;\n *(instPtr++) = p->emissive.x;\n *(instPtr++) = p->emissive.y;\n *(instPtr++) = p->emissive.z;\n *(instPtr++) = p->u1 / tex_size.first;\n *(instPtr++) = p->v1 / tex_size.second;\n *(instPtr++) = p->u2 / tex_size.first;\n *(instPtr++) = p->v2 / tex_size.second;\n }\n\n void endParticles (void)\n {\n instBuf->unlock();\n renderOp.numberOfInstances = instancesAdded();\n }\n\n const Ogre::RenderOperation &getRenderOperation (void) { return renderOp; }\n\n \n};\n\n\n// a particle system holds the buffer for particles of a particular material\nclass GfxParticleSystem {\n fast_erase_vector<GfxParticle*> particles;\n\n std::string name;\n\n DiskResourcePtr<GfxTextureDiskResource> tex;\n unsigned texHeight;\n unsigned texWidth;\n\n ParticlesInstanceBuffer buffer;\n\n // every frame, must sort particles and compute new orientations\n\n public:\n GfxParticleSystem (const std::string &name, const DiskResourcePtr<GfxTextureDiskResource> &tex)\n : name(name)\n {\n setTexture(tex);\n }\n\n ~GfxParticleSystem (void)\n {\n }\n\n // Old particles will have wrong uvs if texture changes dimensions.\n void setTexture (const DiskResourcePtr<GfxTextureDiskResource> &v)\n {\n tex = v;\n tex->getOgreTexturePtr()->unload();\n tex->getOgreTexturePtr()->setHardwareGammaEnabled(true);\n tex->getOgreTexturePtr()->load();\n texHeight = tex->getOgreTexturePtr()->getHeight();\n texWidth = tex->getOgreTexturePtr()->getWidth();\n }\n\n GfxParticle *emit (void)\n {\n GfxParticle *nu = new GfxParticle (this);\n particles.push_back(nu);\n return nu;\n }\n\n void release (GfxParticle *p)\n {\n particles.erase(p);\n delete p;\n }\n\n static bool particleCompare (GfxParticle *a, GfxParticle *b)\n {\n // furthest particle first\n return a->fromCamDist > b->fromCamDist;\n }\n\n void render (GfxPipeline *pipe, const GfxShaderGlobals &globs)\n {\n const CameraOpts &cam_opts = pipe->getCameraOpts();\n const Vector3 &cam_pos = cam_opts.pos;\n const Vector3 &cam_up = cam_opts.dir * Vector3(0, 0, 1);\n\n // PREPARE BUFFERS\n\n // temporary list for sorting in\n std::vector<GfxParticle*> tmp_list;\n for (unsigned i=0 ; i<particles.size() ; ++i) {\n GfxParticle *p = particles[i];\n p->preProcess(cam_pos);\n tmp_list.push_back(p);\n }\n\n // early out for nothing to render\n if (tmp_list.size() == 0) return;\n\n std::sort(tmp_list.begin(), tmp_list.end(), particleCompare);\n\n\n // use particles.size() to avoid frequent reallocation\n buffer.beginParticles(particles.size());\n for (unsigned i=0 ; i<tmp_list.size() ; ++i) {\n GfxParticle *p = tmp_list[i];\n buffer.addParticle(cam_up, p);\n }\n \n buffer.endParticles();\n\n\n // ISSUE RENDER COMMANDS\n try {\n GfxTextureStateMap texs;\n // Bind this manually underneath as it is an Ogre internal texture.\n texs[\"gbuffer0\"] = gfx_texture_state_point(nullptr);\n texs[\"particleAtlas\"] = gfx_texture_state_anisotropic(&*tex, GFX_AM_CLAMP);\n\n GfxShaderBindings binds;\n binds[\"gbuffer0\"] = GfxGslParam(GFX_GSL_FLOAT_TEXTURE2, 1,1,1,1);\n binds[\"particleAtlas\"] = GfxGslParam(GFX_GSL_FLOAT_TEXTURE2, 1,1,1,1);\n\n\n const Ogre::Matrix4 &I = Ogre::Matrix4::IDENTITY;\n\n // We may use a special particle \"purpose\" in future but this works for now.\n shader->bindShader(GFX_GSL_PURPOSE_HUD, false, false, 0,\n globs, I, nullptr, 0, 1, texs, binds);\n\n ogre_rs->_setTexture(NUM_GLOBAL_TEXTURES_NO_LIGHTING, true, pipe->getGBufferTexture(0));\n\n ogre_rs->_setCullingMode(Ogre::CULL_NONE);\n ogre_rs->_setDepthBufferParams(false, false, Ogre::CMPF_LESS_EQUAL);\n ogre_rs->_setSceneBlending(Ogre::SBF_ONE, Ogre::SBF_ONE_MINUS_SOURCE_ALPHA);\n ogre_rs->_setPolygonMode(Ogre::PM_SOLID);\n ogre_rs->setStencilCheckEnabled(false);\n ogre_rs->_setDepthBias(0, 0);\n\n ogre_rs->_render(buffer.getRenderOperation());\n\n ogre_rs->_disableTextureUnit(0);\n ogre_rs->_disableTextureUnit(1);\n\n } catch (const Exception &e) {\n CERR << \"Rendering particles, got: \" << e << std::endl;\n } catch (const Ogre::Exception &e) {\n CERR << \"Rendering particles, got: \" << e.getDescription() << std::endl;\n }\n\n }\n\n std::pair<unsigned, unsigned> getTextureSize (void) const\n {\n return std::pair<unsigned,unsigned>(texWidth, texHeight);\n }\n\n};\n\n\nvoid GfxParticle::preProcess (const Vector3 &cam)\n{\n Vector3 from_cam = pos - cam;\n fromCamDist = from_cam.length();\n fromCamNorm = from_cam / fromCamDist;\n}\n\n\nbool GfxParticle::inside (const Vector3 &p)\n{\n // Add the 1 on the end to account for near clip and anything else\n return (p - pos).length2() < dimensions.length2() + 1;\n}\n\nGfxParticle::GfxParticle (GfxParticleSystem *sys_)\n : sys(sys_)\n{\n}\n\nvoid GfxParticle::release (void)\n{\n sys->release(this);\n}\n\nstd::pair<unsigned, unsigned> GfxParticle::getTextureSize (void) const\n{\n return sys->getTextureSize(); \n}\n\n\nvoid GfxParticle::setDefaultUV (void)\n{\n std::pair<unsigned,unsigned> tex_sz = getTextureSize(); \n u1 = 0;\n v1 = 0;\n u2 = float(tex_sz.first);\n v2 = float(tex_sz.second);\n}\n\n\n\n\ntypedef std::map<std::string, GfxParticleSystem*> PSysMap;\nstatic PSysMap psystems;\n\nvoid gfx_particle_define (const std::string &pname,\n const DiskResourcePtr<GfxTextureDiskResource> &tex)\n{\n GfxParticleSystem *&psys = psystems[pname];\n if (psys != NULL) {\n // Old particles will have wrong uvs if texture changes dimensions.\n psys->setTexture(tex);\n } else {\n psys = new GfxParticleSystem(pname, tex);\n }\n}\n\nGfxParticle *gfx_particle_emit (const std::string &pname)\n{\n GfxParticleSystem *&psys = psystems[pname];\n if (psys == NULL) EXCEPT << \"No such particle: \\\"\" << pname << \"\\\"\" << ENDL;\n return psys->emit();\n}\n\nvoid gfx_particle_render (GfxPipeline *p)\n{\n GfxShaderGlobals g = gfx_shader_globals_cam(p);\n\n for (PSysMap::iterator i=psystems.begin(),i_=psystems.end() ; i!=i_ ; ++i) {\n GfxParticleSystem *psys = i->second;\n psys->render(p, g);\n }\n}\n\nstd::vector<std::string> gfx_particle_all (void)\n{\n std::vector<std::string> r;\n for (PSysMap::iterator i=psystems.begin(),i_=psystems.end() ; i!=i_ ; ++i) {\n r.push_back(i->first);\n }\n return r;\n}\n" }, { "alpha_fraction": 0.6468477845191956, "alphanum_fraction": 0.647770345211029, "avg_line_length": 28.92331314086914, "blob_id": "0dc2233d5a30f2abd599c2528a37934a5d705104", "content_id": "6e77d35e77ecc7f3f308c3ba46d0da80c9e3cbf7", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 9755, "license_type": "permissive", "max_line_length": 100, "num_lines": 326, "path": "/engine/gfx/gfx_gasoline_parser.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <cstdlib>\n#include <cstdint>\n\n#include <map>\n#include <string>\n#include <vector>\n\n#include <exception.h>\n\n#ifndef GFX_GASOLINE_PARSER\n#define GFX_GASOLINE_PARSER\n\nstruct GfxGslLocation {\n int line, col;\n GfxGslLocation (void) : line(0), col(0) { }\n GfxGslLocation (int line, int col) : line(line), col(col) { }\n bool valid (void) { return line > 0; }\n};\n\nstatic inline std::ostream &operator<<(std::ostream &o, const GfxGslLocation &loc)\n{ \n o << loc.line << \":\" << loc.col;\n return o;\n}\n\nstruct GfxGslType {\n bool writeable; // When the type represents an object, if fields of that object can be written.\n GfxGslType() : writeable(false) { }\n virtual ~GfxGslType (void) { }\n};\ntypedef std::vector<GfxGslType*> GfxGslTypes;\ntypedef std::map<std::string, const GfxGslType*> GfxGslTypeMap;\n\n// When a variable is in scope, features of that variable are stored here.\n// This would be a good place for constness, volatile, or things like that.\nstruct GfxGslDef {\n GfxGslType *type; // Of the values that can be assigned to the variable.\n bool trans; // Whether it is interpolated.\n bool topLevel; // Whether it can be captured by fragment shader.\n GfxGslDef(GfxGslType *type, bool trans, bool top_level)\n : type(type), trans(trans), topLevel(top_level)\n { }\n}; \ntypedef std::map<std::string, const GfxGslDef*> GfxGslDefMap;\n\nstd::ostream &operator<<(std::ostream &o, const GfxGslType *t_);\n\n\n// Abstract Syntax Tree\nstruct GfxGslAst {\n GfxGslLocation loc;\n GfxGslType *type;\n GfxGslAst (const GfxGslLocation &loc) : loc(loc), type(nullptr) { }\n virtual ~GfxGslAst(void) { }\n};\n\ntypedef std::vector<GfxGslAst*> GfxGslAsts;\n\nstruct GfxGslShader : public GfxGslAst {\n GfxGslAsts stmts;\n GfxGslDefMap vars;\n GfxGslShader (const GfxGslLocation &loc, const GfxGslAsts &stmts)\n : GfxGslAst(loc), stmts(stmts)\n { }\n};\n\nstruct GfxGslBlock : public GfxGslAst {\n GfxGslAsts stmts;\n GfxGslDefMap vars;\n GfxGslBlock (const GfxGslLocation &loc, const GfxGslAsts &stmts)\n : GfxGslAst(loc), stmts(stmts)\n { }\n};\n\nstruct GfxGslDecl : public GfxGslAst {\n std::string id;\n GfxGslDef *def;\n GfxGslType *annot;\n GfxGslAst *init;\n GfxGslDecl (const GfxGslLocation &loc, const std::string &id, GfxGslType *annot,\n GfxGslAst *init)\n : GfxGslAst(loc), id(id), def(nullptr), annot(annot), init(init)\n { }\n};\n\nstruct GfxGslFor : public GfxGslAst {\n std::string id; // If id != \"\" then of the form for (var x = init; ...)\n GfxGslDef *def;\n GfxGslType *annot;\n GfxGslAst *init; // Otherwise, of the form for (init; ...)\n GfxGslDefMap vars;\n GfxGslAst *cond;\n GfxGslAst *inc;\n GfxGslAst *body;\n GfxGslFor (const GfxGslLocation &loc, const std::string &id, GfxGslType *annot, GfxGslAst *init,\n GfxGslAst *cond, GfxGslAst *inc, GfxGslAst *body)\n : GfxGslAst(loc), id(id), def(nullptr), annot(annot), init(init), cond(cond), inc(inc),\n body(body)\n { }\n};\n\nstruct GfxGslIf : public GfxGslAst {\n GfxGslAst *cond;\n GfxGslAst *yes;\n GfxGslDefMap yesVars;\n GfxGslAst *no;\n GfxGslDefMap noVars;\n GfxGslIf (const GfxGslLocation &loc, GfxGslAst *cond, GfxGslAst *yes, GfxGslAst *no)\n : GfxGslAst(loc), cond(cond), yes(yes), no(no)\n { }\n};\n\nstruct GfxGslAssign : public GfxGslAst {\n GfxGslAst *target;\n GfxGslAst *expr;\n GfxGslAssign (const GfxGslLocation &loc, GfxGslAst *target, GfxGslAst *expr)\n : GfxGslAst(loc), target(target), expr(expr)\n { }\n};\n\nstruct GfxGslCall : public GfxGslAst {\n const std::string func;\n GfxGslAsts args;\n GfxGslCall (const GfxGslLocation &loc, const std::string &func, GfxGslAsts args)\n : GfxGslAst(loc), func(func), args(args)\n { }\n};\n\nstruct GfxGslField : public GfxGslAst {\n GfxGslAst *target;\n const std::string id;\n GfxGslField (const GfxGslLocation &loc, GfxGslAst *target, const std::string &id)\n : GfxGslAst(loc), target(target), id(id)\n { }\n};\n\ntemplate<class T> struct GfxGslLiteral : public GfxGslAst {\n T val;\n GfxGslLiteral (const GfxGslLocation &loc, T val)\n : GfxGslAst(loc), val(val)\n { }\n};\n\ntypedef GfxGslLiteral<int32_t> GfxGslLiteralInt;\ntypedef GfxGslLiteral<float> GfxGslLiteralFloat;\ntypedef GfxGslLiteral<bool> GfxGslLiteralBoolean;\n\nstruct GfxGslLiteralArray : public GfxGslAst {\n GfxGslType *elementType;\n std::vector<GfxGslAst*> elements;\n GfxGslLiteralArray (const GfxGslLocation &loc, GfxGslType *element_type,\n const std::vector<GfxGslAst*> &elements)\n : GfxGslAst(loc), elementType(element_type), elements(elements)\n { }\n};\n\nstruct GfxGslArrayLookup : public GfxGslAst {\n GfxGslAst *target;\n GfxGslAst *index;\n GfxGslArrayLookup (const GfxGslLocation &loc, GfxGslAst *target, GfxGslAst *index)\n : GfxGslAst(loc), target(target), index(index)\n { }\n};\n\nstruct GfxGslVar : public GfxGslAst {\n const std::string id;\n GfxGslVar (const GfxGslLocation &loc, const std::string &id)\n : GfxGslAst(loc), id(id)\n { }\n};\n\nenum GfxGslOp {\n GFX_GSL_OP_ADD,\n GFX_GSL_OP_SUB,\n GFX_GSL_OP_MUL,\n GFX_GSL_OP_DIV,\n GFX_GSL_OP_MOD,\n GFX_GSL_OP_EQ,\n GFX_GSL_OP_NE,\n GFX_GSL_OP_LT,\n GFX_GSL_OP_LTE,\n GFX_GSL_OP_GT,\n GFX_GSL_OP_GTE,\n GFX_GSL_OP_AND,\n GFX_GSL_OP_OR\n};\n\nstatic inline std::string to_string (GfxGslOp op)\n{\n switch (op) {\n case GFX_GSL_OP_ADD: return \"+\";\n case GFX_GSL_OP_SUB: return \"-\";\n case GFX_GSL_OP_MUL: return \"*\";\n case GFX_GSL_OP_DIV: return \"/\";\n case GFX_GSL_OP_MOD: return \"%\";\n case GFX_GSL_OP_EQ: return \"==\";\n case GFX_GSL_OP_NE: return \"!=\";\n case GFX_GSL_OP_LT: return \"<\";\n case GFX_GSL_OP_LTE: return \"<=\";\n case GFX_GSL_OP_GT: return \">\";\n case GFX_GSL_OP_GTE: return \">=\";\n case GFX_GSL_OP_AND: return \"&&\";\n case GFX_GSL_OP_OR: return \"||\";\n default: EXCEPTEX << \"INTERNAL ERROR: Unknown binary operator: \" << int(op) << ENDL;\n }\n}\n\nstatic inline std::ostream &operator<< (std::ostream &o, GfxGslOp op)\n{\n o << to_string(op);\n return o;\n}\n\nstatic const std::map<std::string, GfxGslOp> op_map = {\n {\"*\", GFX_GSL_OP_MUL},\n {\"/\", GFX_GSL_OP_DIV},\n {\"%\", GFX_GSL_OP_MOD},\n\n {\"+\", GFX_GSL_OP_ADD},\n {\"-\", GFX_GSL_OP_SUB},\n\n {\"<\", GFX_GSL_OP_LT},\n {\"<=\", GFX_GSL_OP_LTE},\n {\">\", GFX_GSL_OP_GT},\n {\">=\", GFX_GSL_OP_GTE},\n\n {\"==\", GFX_GSL_OP_EQ},\n {\"!=\", GFX_GSL_OP_NE},\n\n {\"&&\", GFX_GSL_OP_AND},\n {\"||\", GFX_GSL_OP_OR},\n};\n\n\nstruct GfxGslBinary : public GfxGslAst {\n GfxGslAst *a;\n GfxGslOp op;\n GfxGslAst *b;\n GfxGslBinary (const GfxGslLocation &loc, GfxGslAst *a, GfxGslOp op, GfxGslAst *b)\n : GfxGslAst(loc), a(a), op(op), b(b)\n { }\n};\n\n\n// Keywords\n\nstruct GfxGslGlobal : public GfxGslAst {\n GfxGslGlobal (const GfxGslLocation &loc) : GfxGslAst(loc) { }\n};\nstruct GfxGslMat : public GfxGslAst {\n GfxGslMat (const GfxGslLocation &loc) : GfxGslAst(loc) { }\n};\nstruct GfxGslVert : public GfxGslAst {\n GfxGslVert (const GfxGslLocation &loc) : GfxGslAst(loc) { }\n};\nstruct GfxGslOut : public GfxGslAst {\n GfxGslOut (const GfxGslLocation &loc) : GfxGslAst(loc) { }\n};\nstruct GfxGslBody : public GfxGslAst {\n GfxGslBody (const GfxGslLocation &loc) : GfxGslAst(loc) { }\n};\nstruct GfxGslFrag : public GfxGslAst {\n GfxGslFrag (const GfxGslLocation &loc) : GfxGslAst(loc) { }\n};\nstruct GfxGslDiscard : public GfxGslAst {\n GfxGslDiscard (const GfxGslLocation &loc) : GfxGslAst(loc) { }\n};\nstruct GfxGslReturn : public GfxGslAst {\n GfxGslReturn (const GfxGslLocation &loc) : GfxGslAst(loc) { }\n};\n\nclass GfxGslAllocator {\n std::vector<GfxGslAst*> poolAst;\n std::vector<GfxGslType*> poolType;\n std::vector<GfxGslDef*> poolDef;\n public:\n GfxGslAllocator (void) { }\n ~GfxGslAllocator (void)\n {\n for (auto a : poolAst) delete a;\n for (auto t : poolType) delete t;\n for (auto t : poolDef) delete t;\n }\n template<class T, class... Args> T *makeAst (Args... args)\n {\n auto *r = new T(args...);\n poolAst.push_back(r);\n return r;\n }\n template<class T, class... Args> T *makeType (Args... args)\n {\n auto *r = new T(args...);\n poolType.push_back(r);\n return r;\n }\n template<class T, class... Args> T *makeDef (Args... args)\n {\n auto *r = new T(args...);\n poolDef.push_back(r);\n return r;\n }\n};\n\nGfxGslShader *gfx_gasoline_parse (GfxGslAllocator &alloc, const std::string &shader);\n\n#endif\n" }, { "alpha_fraction": 0.502703070640564, "alphanum_fraction": 0.5148129463195801, "avg_line_length": 38.637142181396484, "blob_id": "a6632319e4a033cba4fb90184e006f7f5f610687", "content_id": "db4fb0df3d399ddca5ac96b4d78b621062064207", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 55492, "license_type": "permissive", "max_line_length": 134, "num_lines": 1400, "path": "/gtasa/extract.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <cstdlib>\n#include <cmath>\n#include <iostream>\n#include <fstream>\n#include <locale>\n#include <algorithm>\n\n#include \"imgread.h\"\n#include \"iplread.h\"\n#include \"ideread.h\"\n#include \"tex_dups.h\"\n#include \"dffread.h\"\n#include \"txdread.h\"\n//#include \"physics/tcol_parser.h\"\n#include \"physics/bcol_parser.h\"\n#include \"col_parser.h\"\n\n#include \"ios_util.h\"\n#include \"dirutil.h\"\n#include \"csvread.h\"\n#include \"handling.h\"\n#include \"surfinfo.h\"\n#include \"procobj.h\"\n\nCentralisedLog clog;\nvoid app_fatal (void) { abort(); }\nvoid assert_triggered (void) { } \n\n\n\nstatic void open_file (std::ostream &out, std::ifstream &f,\n const std::string fname)\n{\n (void)out;\n //out << \"Opening: \\\"\"+fname+\"\\\"\" << std::endl;\n f.open(fname.c_str(), std::ios::binary);\n APP_ASSERT_IO_SUCCESSFUL(f,\"opening \"+fname);\n}\n\nstruct ImgHandle {\n void init (const std::string &fname, const std::string &name_,\n std::ostream &out)\n {\n open_file(out, f, fname);\n i.init(f, fname);\n name = name_;\n }\n void open_file_img (std::ostream &out, const std::string fname)\n {\n (void)out;\n //out << \"Opening (from img): \\\"\"+fname+\"\\\"\" << std::endl;\n i.fileOffset(f,fname);\n }\n\n std::ifstream f;\n Img i;\n std::string name;\n};\n\nvoid dump_stats (std::ostream &out, Objs &objs) //{{{\n{\n unsigned long num_wet = 0;\n unsigned long num_night = 0;\n unsigned long num_alpha1 = 0;\n unsigned long num_alpha2 = 0;\n unsigned long num_day = 0;\n unsigned long num_interior = 0;\n unsigned long num_no_shadow = 0;\n unsigned long num_no_col = 0;\n unsigned long num_no_draw_dist = 0;\n unsigned long num_break_glass = 0;\n unsigned long num_break_glass_crack = 0;\n unsigned long num_garage_door = 0;\n unsigned long num_2clump = 0;\n unsigned long num_sways = 0;\n unsigned long num_other_veg = 0;\n unsigned long num_pole_shadow = 0;\n unsigned long num_explosive = 0;\n unsigned long num_unk1 = 0;\n unsigned long num_unk2 = 0;\n unsigned long num_unk3 = 0;\n unsigned long num_grafitti = 0;\n unsigned long num_draw_backface = 0;\n unsigned long num_unk4 = 0;\n\n for (Objs::iterator i=objs.begin(),i_=objs.end() ; i!=i_ ; ++i) {\n Obj &obj = *i;\n unsigned long flags = obj.flags;\n if (flags & OBJ_FLAG_WET) num_wet++;\n if (flags & OBJ_FLAG_NIGHT) num_night++;\n if (flags & OBJ_FLAG_ALPHA1) num_alpha1++;\n if (flags & OBJ_FLAG_ALPHA2) num_alpha2++;\n if (flags & OBJ_FLAG_DAY) num_day++;\n if (flags & OBJ_FLAG_INTERIOR) num_interior++;\n if (flags & OBJ_FLAG_NO_SHADOW) num_no_shadow++;\n if (flags & OBJ_FLAG_NO_COL) num_no_col++;\n if (flags & OBJ_FLAG_NO_DRAW_DIST) num_no_draw_dist++;\n if (flags & OBJ_FLAG_BREAK_GLASS) num_break_glass++;\n if (flags & OBJ_FLAG_BREAK_GLASS_CRACK) num_break_glass_crack++;\n if (flags & OBJ_FLAG_GARAGE_DOOR) num_garage_door++;\n if (flags & OBJ_FLAG_2CLUMP) num_2clump++;\n if (flags & OBJ_FLAG_SWAYS) num_sways++;\n if (flags & OBJ_FLAG_OTHER_VEG) num_other_veg++;\n if (flags & OBJ_FLAG_POLE_SHADOW) num_pole_shadow++;\n if (flags & OBJ_FLAG_EXPLOSIVE) num_explosive++;\n if (flags & OBJ_FLAG_UNK1) num_unk1++;\n if (flags & OBJ_FLAG_UNK2) num_unk2++;\n if (flags & OBJ_FLAG_UNK3) num_unk3++;\n if (flags & OBJ_FLAG_GRAFITTI) num_grafitti++;\n if (flags & OBJ_FLAG_DRAW_BACKFACE) num_draw_backface++;\n if (flags & OBJ_FLAG_UNK4) num_unk4++;\n\n }\n\n out << \"num_wet \" << num_wet << std::endl;\n out << \"num_night \" << num_night << std::endl;\n out << \"num_alpha1 \" << num_alpha1 << std::endl;\n out << \"num_alpha2 \" << num_alpha2 << std::endl;\n out << \"num_day \" << num_day << std::endl;\n out << \"num_interior \" << num_interior << std::endl;\n out << \"num_no_shadow \" << num_no_shadow << std::endl;\n out << \"num_no_col \" << num_no_col << std::endl;\n out << \"num_no_draw_dist \" << num_no_draw_dist << std::endl;\n out << \"num_break_glass \" << num_break_glass << std::endl;\n out << \"num_break_glass_crack \" << num_break_glass_crack << std::endl;\n out << \"num_garage_door \" << num_garage_door << std::endl;\n out << \"num_2clump \" << num_2clump << std::endl;\n out << \"num_sways \" << num_sways << std::endl;\n out << \"num_other_veg \" << num_other_veg << std::endl;\n out << \"num_pole_shadow \" << num_pole_shadow << std::endl;\n out << \"num_explosive \" << num_explosive << std::endl;\n out << \"num_unk1 \" << num_unk1 << std::endl;\n out << \"num_unk2 \" << num_unk2 << std::endl;\n out << \"num_unk3 \" << num_unk3 << std::endl;\n out << \"num_grafitti \" << num_grafitti << std::endl;\n out << \"num_draw_backface \" << num_draw_backface << std::endl;\n out << \"num_unk4 \" << num_unk4 << std::endl;\n}\n\n//}}}\n\ntypedef std::vector<IPL> IPLs;\n\nstatic void addFullIPL (std::ostream &out,\n const std::string &gta_dir,\n IPLs &ipls,\n const std::string &text,\n ImgHandle &img,\n const std::string &bin,\n size_t n)\n{\n ipls.push_back(IPL());\n \n IPL &ipl = *(ipls.end()-1);\n\n ipl.setName(text);\n\n std::string name = gta_dir + \"/data/maps/\" + text;\n std::ifstream text_f;\n //out << \"Opening text IPL: \\\"\" << name << \"\\\"\" << std::endl;\n text_f.open(name.c_str(),std::ios::binary);\n APP_ASSERT_IO_SUCCESSFUL(text_f,\"opening text IPL: \"+name);\n \n ipl.addMore(text_f);\n\n for (size_t i=0 ; i<n ; ++i) {\n\n std::stringstream ss;\n ss<<bin<<\"_stream\"<<i<<\".ipl\";\n\n img.open_file_img(out,ss.str());\n \n ipl.addMore(img.f);\n }\n\n}\n\ntypedef std::map<std::string,Txd> TxdDir;\n\nvoid process_txd (std::ostream &out,\n Txd::Names &texs,\n const std::string &fname,\n const std::string &dest_dir,\n const std::string &modprefix,\n std::istream &in)\n{\n if (getenv(\"SKIP_TEXTURES\")!=NULL) return;\n (void) out;\n std::string txddir = dest_dir+\"/\"+modprefix+fname;\n ensuredir(txddir);\n Txd txd(in,txddir); // extract dds files\n const Txd::Names &n = txd.getNames();\n typedef Txd::Names::const_iterator TI;\n for (TI j=n.begin(),j_=n.end();j!=j_;++j) {\n const std::string &texname = *j;\n // build a list of all textures we\n // know about (relative to dest_dir)\n texs.insert(fname+\"/\"+texname+\".dds\");\n }\n}\n\nvoid process_txds (std::ostream &out,\n Txd::Names &texs,\n ImgHandle &img,\n const std::string &dest_dir,\n const std::string &modname)\n{\n (void) out;\n for (unsigned int i=0 ; i<img.i.size(); ++i) {\n const std::string &fname = img.i.fileName(i);\n if (fname.size()<4) continue;\n std::string ext = fname.substr(fname.size()-4,4);\n if (ext!=\".txd\") continue;\n //out<<\"Extracting: \"<<img.name<<\"/\"<<fname<<std::endl;\n img.i.fileOffset(img.f,i);\n process_txd(out, texs, img.name+\"/\"+fname, dest_dir, modname+\"/\", img.f);\n }\n}\n\n\ntypedef std::set<std::string> ColNames;\n\nvoid process_cols (std::ostream &out,\n ColNames &cols,\n ColNames &cols_including_empty,\n ImgHandle &img,\n const std::string &dest_dir,\n const std::string &modname,\n MaterialMap &db)\n{\n if (getenv(\"SKIP_COLS\")!=NULL) return;\n (void) out;\n for (unsigned int i=0 ; i<img.i.size(); ++i) {\n const std::string &fname = img.i.fileName(i);\n if (fname.size()<4) continue;\n std::string ext = fname.substr(fname.size()-4,4);\n if (ext!=\".col\") continue;\n //out<<\"Extracting: \"<<img.name<<\"/\"<<fname<<std::endl;\n img.i.fileOffset(img.f,i);\n\n std::istream::int_type next;\n\n do {\n\n TColFile tcol;\n std::string name;\n // the materials are in gtasa/ but imgs are behind another dir so prefix ../\n parse_col(name,img.f,tcol, \"../\", db);\n\n std::string gcolname = img.name+\"/\"+name+\".gcol\";\n\n cols_including_empty.insert(gcolname);\n\n if (tcol.usingCompound || tcol.usingTriMesh) {\n\n cols.insert(gcolname);\n\n name = dest_dir+\"/\"+modname+\"/\"+gcolname;\n\n std::ofstream f;\n f.open(name.c_str(), std::ios::binary);\n APP_ASSERT_IO_SUCCESSFUL(f,\"opening tcol for writing\");\n\n write_tcol_as_bcol(f, tcol);\n }\n\n next = img.f.peek();\n\n } while (next!=std::istream::traits_type::eof() && next!=0);\n\n // no more cols\n\n }\n}\n\nstruct IPLConfig {\n IPLConfig () { }\n IPLConfig (const std::string &base_, const std::string &img_,\n const std::string &bin_, int num_)\n : base(base_), img(img_), bin(bin_), num(num_) { }\n std::string base;\n std::string img;\n std::string bin;\n size_t num;\n};\n\nstruct Config {\n std::string gta_dir;\n std::string dest_dir;\n std::string modname;\n const char **idesv;\n size_t idesc;\n std::vector<std::pair<std::string,std::string> > imgs;\n std::vector<std::pair<std::string,std::string> > txds;\n std::vector<IPLConfig> ipls;\n};\n\nvoid extract (const Config &cfg, std::ostream &out)\n{ \n const std::string &gta_dir = cfg.gta_dir;\n const std::string &dest_dir = cfg.dest_dir;\n\n ensuredir(dest_dir+\"/\"+cfg.modname);\n\n out << \"Extracting car colours...\" << std::endl;\n Csv carcols;\n std::map<std::string, std::vector<int> > carcols_2;\n std::map<std::string, std::vector<int> > carcols_4;\n {\n std::ofstream carcols_lua;\n carcols_lua.open((dest_dir+\"/\"+cfg.modname+\"/carcols.lua\").c_str(),\n std::ios::binary);\n APP_ASSERT_IO_SUCCESSFUL(carcols_lua, \"opening carcols.lua\");\n\n carcols_lua << \"print(\\\"Loading carcols\\\")\\n\";\n carcols.filename = gta_dir+\"/data/carcols.dat\";\n std::ifstream carcols_f;\n carcols_f.open(carcols.filename.c_str(), std::ios::binary);\n read_csv(carcols_f, carcols);\n const CsvSection &coldefs = carcols[\"col\"];\n for (unsigned i=0 ; i<coldefs.size() ; ++i) {\n const CsvLine &line = coldefs[i];\n float r,g,b;\n if (line.size()==2) {\n // there is one case where a decimal point\n //is used instead of a comma\n size_t n = line[0].find(\".\");\n APP_ASSERT(n<line[0].npos-1);\n std::string p1 = line[0].substr(0,n);\n std::string p2 = line[0].substr(n+1,line[0].npos);\n r = (float) strtod(p1.c_str(), NULL)/255;\n g = (float) strtod(p2.c_str(), NULL)/255;\n b = (float) strtod(line[1].c_str(), NULL)/255;\n } else {\n APP_ASSERT(line.size()==3);\n r = (float) strtod(line[0].c_str(), NULL)/255;\n g = (float) strtod(line[1].c_str(), NULL)/255;\n b = (float) strtod(line[2].c_str(), NULL)/255;\n }\n carcols_lua<<\"carcols.gtasa\"<<i<<\" = { { \"<<r<<\", \"<<g<<\", \"<<b<<\" } }\"\n <<std::endl;\n }\n const CsvSection &col2defs = carcols[\"car\"];\n for (unsigned i=0 ; i<col2defs.size() ; ++i) {\n const CsvLine &line = col2defs[i];\n APP_ASSERT(line.size()>=1);\n for (unsigned j=1 ; j<(line.size()-1)/2*2+1 ; ++j) {\n carcols_2[line[0]].push_back(strtol(line[j].c_str(), NULL, 10));\n }\n }\n const CsvSection &col4defs = carcols[\"car4\"];\n for (unsigned i=0 ; i<col4defs.size() ; ++i) {\n const CsvLine &line = col4defs[i];\n APP_ASSERT(line.size()>=1);\n APP_ASSERT(line.size()%4==1);\n for (unsigned j=1 ; j<(line.size()-1)/4*4+1 ; ++j) {\n carcols_4[line[0]].push_back(strtol(line[j].c_str(), NULL, 10));\n }\n }\n }\n\n out << \"Reading car handling file...\" << std::endl;\n HandlingData handling;\n {\n Csv handling_csv;\n handling_csv.filename = gta_dir+\"/data/handling.cfg\";\n std::ifstream handling_f;\n handling_f.open(handling_csv.filename.c_str(), std::ios::binary);\n read_csv(handling_f, handling_csv);\n read_handling(handling_csv, handling);\n }\n\n out << \"Reading surface info file...\" << std::endl;\n SurfInfoData surfinfo;\n MaterialMap db;\n {\n std::ofstream physmats_lua;\n physmats_lua.open((dest_dir+\"/\"+cfg.modname+\"/phys_mats.lua\").c_str(),\n std::ios::binary);\n APP_ASSERT_IO_SUCCESSFUL(physmats_lua, \"opening physmats.lua\");\n\n Csv surfinfo_csv;\n surfinfo_csv.filename = gta_dir+\"/data/surfinfo.dat\";\n std::ifstream surfinfo_f;\n surfinfo_f.open(surfinfo_csv.filename.c_str(), std::ios::binary);\n read_csv(surfinfo_f, surfinfo_csv);\n read_surfinfo(surfinfo_csv, surfinfo);\n for (unsigned i=0 ; i<surfinfo.surfaces.size() ; ++i) {\n SurfInfo &surf = surfinfo.surfaces[i];\n db[i] = surf.name;\n physmats_lua<<\"physical_material `\"<<surf.name<<\"` {\"<<std::endl;\n float rtf, ortf;\n if (surf.adhesion_group==\"RUBBER\") {\n physmats_lua<<\" interactionGroup=StickyGroup;\"<<std::endl;\n rtf = 1;\n ortf = 1;\n } else if (surf.adhesion_group==\"HARD\") {\n physmats_lua<<\" interactionGroup=SmoothHardGroup;\"<<std::endl;\n rtf = 0.9f;\n ortf = 0.7f;\n } else if (surf.adhesion_group==\"ROAD\") {\n physmats_lua<<\" interactionGroup=RoughGroup;\"<<std::endl;\n rtf = 1;\n ortf = 0.8f;\n } else if (surf.adhesion_group==\"LOOSE\") {\n physmats_lua<<\" interactionGroup=DeformGroup;\"<<std::endl;\n rtf = 0.7f;\n ortf = 1;\n } else if (surf.adhesion_group==\"SAND\") {\n physmats_lua<<\" interactionGroup=DeformGroup;\"<<std::endl;\n rtf = 0.4f;\n ortf = 1;\n } else if (surf.adhesion_group==\"WET\") {\n physmats_lua<<\" interactionGroup=SlipperyGroup;\"<<std::endl;\n rtf = 0.3f;\n ortf = 0.6f;\n } else {\n GRIT_EXCEPT(\"Unrecognised adhesion group: \"+surf.adhesion_group);\n }\n physmats_lua<<\" roadTyreFriction=\"<<rtf<<\";\"<<std::endl;\n physmats_lua<<\" offRoadTyreFriction=\"<<ortf<<\";\"<<std::endl;\n physmats_lua<<\"}\"<<std::endl<<std::endl;;\n }\n\n }\n\n out << \"Reading procedural objects file...\" << std::endl;\n ProcObjData procobj;\n {\n Csv procobj_csv;\n procobj_csv.filename = gta_dir+\"/data/procobj.dat\";\n std::ifstream procobj_f;\n procobj_f.open(procobj_csv.filename.c_str(), std::ios::binary);\n read_csv(procobj_f, procobj_csv);\n read_procobj(procobj_csv, procobj);\n }\n\n out << \"Reading IDE files...\" << std::endl;\n ide everything;\n for (size_t i=0 ; i<cfg.idesc ; ++i) {\n std::ifstream f;\n open_file(out, f, gta_dir+\"/data/\"+cfg.idesv[i]);\n read_ide(cfg.idesv[i], f, &everything);\n }\n\n Txd::Names texs;\n \n // cols_i = cols + the empty cols (for error checking)\n ColNames cols, cols_i;\n\n out << \"Extracting standalone txd files...\" << std::endl;\n for (size_t i=0 ; i<cfg.txds.size() ; ++i) {\n std::string fname = gta_dir+cfg.txds[i].first;\n std::string name = cfg.txds[i].second;\n std::ifstream txd_f;\n txd_f.open(fname.c_str(), std::ios::binary);\n APP_ASSERT_IO_SUCCESSFUL(txd_f,\"opening \"+fname);\n //out<<\"Extracting: \"<<fname<<std::endl;\n process_txd (out, texs, name, dest_dir, cfg.modname+\"/\", txd_f);\n\n }\n\n out << \"Reading img files...\" << std::endl;\n std::map<std::string,ImgHandle*> imgs;\n for (size_t i=0 ; i<cfg.imgs.size() ; ++i) {\n std::string name = cfg.imgs[i].second;\n imgs[name] = new ImgHandle();\n imgs[name]->init(gta_dir+cfg.imgs[i].first, name, out);\n }\n\n out << \"Extracting txds from imgs...\" << std::endl;\n for (size_t i=0 ; i<cfg.imgs.size() ; ++i) {\n process_txds(out, texs, *imgs[cfg.imgs[i].second], dest_dir, cfg.modname);\n }\n\n out << \"Extracting cols from imgs...\" << std::endl;\n for (size_t i=0 ; i<cfg.imgs.size() ; ++i) {\n process_cols(out, cols, cols_i, *imgs[cfg.imgs[i].second], dest_dir, cfg.modname, db);\n }\n\n if (getenv(\"DUMP_TEX_LIST\")) {\n for (Txd::Names::iterator i=texs.begin(), i_=texs.end() ; i!=i_ ; ++i) {\n out << *i << std::endl;\n }\n }\n\n if (getenv(\"DUMP_COL_LIST\")) {\n for (ColNames::iterator i=cols.begin(), i_=cols.end() ; i!=i_ ; ++i) {\n out << *i << std::endl;\n }\n }\n\n std::vector<IPL> ipls;\n {\n out << \"Reading IPLs...\" << std::endl;\n for (size_t i=0 ; i<cfg.ipls.size() ; ++i) {\n const std::string &base = cfg.ipls[i].base;\n const std::string &img = cfg.ipls[i].img;\n const std::string &bin = cfg.ipls[i].bin;\n size_t num = cfg.ipls[i].num;\n if (imgs.find(img)==imgs.end()) {\n std::stringstream ss;\n ss << \"ERROR: no such IMG \\\"\"<<img<<\"\\\"\";\n GRIT_EXCEPT(ss.str());\n }\n addFullIPL(out, gta_dir, ipls, base, *imgs[img], bin, num);\n }\n }\n\n MatDB matdb;\n\n\n // don't bother generating classes for things that aren't instantiated\n out << \"Working out what to export...\" << std::endl;\n std::map<unsigned long,bool> ids_used_in_ipl;\n std::map<unsigned long,bool> ids_written_out;\n\n for (IPLs::iterator i=ipls.begin(),i_=ipls.end() ; i!=i_ ; ++i) {\n const Insts &insts = i->getInsts();\n for (Insts::const_iterator j=insts.begin(),j_=insts.end() ; j!=j_ ; ++j) {\n const Inst &inst = *j;\n ids_used_in_ipl[inst.id] = true;\n }\n }\n\n Objs &objs = everything.objs;\n for (Objs::iterator i=objs.begin(),i_=objs.end() ; i!=i_ ; ++i) {\n Obj &o = *i;\n\n // id never used\n if (!ids_used_in_ipl[o.id]) continue;\n\n ids_written_out[o.id] = true;\n }\n\n if (getenv(\"SKIP_CLASSES\")==NULL) {\n std::ofstream classes;\n std::ofstream materials_lua;\n\n out << \"Exporting classes...\" << std::endl;\n\n classes.open((dest_dir+\"/\"+cfg.modname+\"/classes.lua\").c_str(),\n std::ios::binary);\n APP_ASSERT_IO_SUCCESSFUL(classes, \"opening classes.lua\");\n\n classes << \"print(\\\"Loading classes\\\")\\n\";\n\n materials_lua.open((dest_dir+\"/\"+cfg.modname+\"/materials.lua\").c_str(),\n std::ios::binary);\n APP_ASSERT_IO_SUCCESSFUL(materials_lua, \"opening materials.lua\");\n\n for (Objs::iterator i=objs.begin(),i_=objs.end() ; i!=i_ ; ++i) {\n Obj &o = *i;\n\n if (!ids_written_out[o.id]) continue;\n\n //out << \"id: \" << o.id << \" \"\n // << \"dff: \" << o.dff << std::endl;\n\n struct dff dff;\n std::string dff_name = o.dff+\".dff\";\n ImgHandle *img = NULL;\n for (size_t i=0 ; i<cfg.imgs.size() ; ++i) {\n ImgHandle *img2 = imgs[cfg.imgs[i].second];\n if (img2->i.fileExists(dff_name)) {\n img = img2;\n break;\n }\n }\n if (img == NULL) {\n out << \"Not found in any IMG file: \"\n << \"\\\"\" << dff_name << \"\\\"\" << std::endl;\n continue;\n }\n\n img->open_file_img(out,dff_name);\n ios_read_dff(1,img->f,&dff,img->name+\"/\"+dff_name+\"/\",\"../\",db);\n \n APP_ASSERT(dff.geometries.size()==1 || dff.geometries.size()==2);\n\n float rad = 0;\n for (unsigned long j=0 ; j<dff.frames.size() ; ++j) {\n frame &fr = dff.frames[j];\n // ignore dummies for now\n if (fr.geometry == -1)\n continue;\n\n if (o.flags & OBJ_FLAG_2CLUMP) {\n APP_ASSERT(dff.geometries.size()==2);\n APP_ASSERT(j==1 || j==2);\n // j==1 is the damaged version\n // j==2 is the undamaged version\n if (j==1) continue;\n APP_ASSERT(fr.geometry==1);\n } else {\n APP_ASSERT(fr.geometry==0);\n APP_ASSERT(dff.geometries.size()==1);\n }\n\n geometry &g = dff.geometries[fr.geometry];\n\n rad = sqrt(g.b_x*g.b_x + g.b_y*g.b_y + g.b_z*g.b_z)\n + g.b_r;\n\n std::stringstream objname_ss;\n objname_ss << o.id;\n std::string objname = objname_ss.str();\n\n std::stringstream out_name_ss;\n out_name_ss<<dest_dir<<\"/\"<<cfg.modname<<\"/\"<<o.id<<\".mesh\";\n std::vector<std::string> export_imgs;\n export_imgs.push_back(img->name);\n for (size_t k=0 ; k<imgs.size() ; ++k) {\n ImgHandle *img2 = imgs[cfg.imgs[k].second];\n if (img2->name == img->name) continue;\n export_imgs.push_back(img2->name);\n }\n std::string out_name = out_name_ss.str();\n generate_normals(g);\n export_mesh(texs,everything,export_imgs,\n out,out_name,\n o,objname,g,matdb,materials_lua);\n\n }\n\n std::stringstream col_field;\n std::stringstream lights_field;\n std::string cls = \"BaseClass\";\n\n std::string gcol_name = img->name+\"/\"+o.dff+\".gcol\";\n bool use_col = true;\n\n // once only\n if (cols_i.find(gcol_name)==cols_i.end()) {\n //if (!(o.flags & OBJ_FLAG_NO_COL))\n // out<<\"Couldn't find col \\\"\"<<gcol_name<<\"\\\" \"\n // <<\"referenced from \"<<o.id<<std::endl;\n use_col = false;\n }\n if (cols.find(gcol_name)==cols.end()) {\n //out<<\"Skipping empty col \\\"\"<<gcol_name<<\"\\\" \"\n // <<\"referenced from \"<<o.id<<std::endl;\n use_col = false;\n }\n if (use_col) {\n //out<<\"col: \\\"\"<<gcol_name<<\"\\\" \"<<std::endl;\n // add col to grit class\n col_field << \",colMesh=`\"<<gcol_name<<\"`\";\n cls = \"ColClass\";\n }\n if (dff.geometries.size()==1) {\n bool no_lights_yet = true;\n std::string prefix = \", lights={ \";\n for (unsigned i=0 ; i<dff.geometries[0].twodfxs.size() ; ++i) {\n twodfx &fx = dff.geometries[0].twodfxs[i];\n if (fx.type != TWODFX_LIGHT) continue;\n float r=fx.light.r/255.0f, g=fx.light.g/255.0f, b=fx.light.b/255.0f;\n float R=std::max(fx.light.outer_range,fx.light.size);\n lights_field << prefix << \"{ \"\n << \"pos=vector3(\"<<fx.x<<\",\"<<fx.y<<\",\"<<fx.z<<\"), \"\n << \"range=\"<<R<<\", \"\n << \"diff=vector3(\"<<r<<\",\"<<g<<\",\"<<b<<\"), \"\n << \"spec=vector3(\"<<r<<\",\"<<g<<\",\"<<b<<\") }\";\n no_lights_yet = false;\n prefix = \", \";\n }\n if (!no_lights_yet) lights_field << \"}\";\n }\n\n bool cast_shadow = 0 != (o.flags&OBJ_FLAG_POLE_SHADOW);\n cast_shadow = true;\n if ((o.flags & OBJ_FLAG_ALPHA1) && (o.flags & OBJ_FLAG_NO_SHADOW))\n cast_shadow = false;\n\n classes<<\"class_add(\"\n <<\"`/gtasa/\"<<o.id<<\"`,\"\n <<cls<<\",{\"\n <<\"castShadows=\"<<(cast_shadow?\"true\":\"false\")\n <<\",renderingDistance=\"<<(o.draw_distance+rad)\n <<col_field.str()\n <<lights_field.str()\n <<\"})\\n\";\n \n }\n }\n\n Vehicles &vehicles = everything.vehicles;\n\n Txd::Names vehicle_texs;\n for (Txd::Names::iterator i=texs.begin(),i_=texs.end() ; i!=i_ ; ++i) {\n vehicle_texs.insert(\"../\"+*i);\n }\n\n out << \"Exporting vehicles...\" << std::endl;\n std::ofstream vehicles_lua;\n std::string s = dest_dir+\"/\"+cfg.modname+\"/vehicles.lua\";\n vehicles_lua.open(s.c_str(), std::ios::binary);\n APP_ASSERT_IO_SUCCESSFUL(vehicles_lua, \"opening \"+s);\n for (Vehicles::iterator i=vehicles.begin(),i_=vehicles.end() ; i!=i_ ; ++i) {\n Vehicle &v = *i;\n out << \"Exporting vehicle: \" << v.dff << std::endl;\n if (v.id==594) continue; // has broken col data or something\n //if (v.id!=415) continue;\n\n std::string vname = v.dff; // assuming that each dff is only used by one id\n std::string vehicle_dir = dest_dir+\"/\"+cfg.modname+\"/\"+vname;\n ensuredir(vehicle_dir);\n\n std::ofstream lua_file;\n std::string s = vehicle_dir+\"/init.lua\";\n lua_file.open(s.c_str(), std::ios::binary);\n APP_ASSERT_IO_SUCCESSFUL(lua_file, \"opening \"+s);\n\n vehicles_lua << \"include `\"<<vname<<\"/init.lua`\" << std::endl;\n \n struct dff dff;\n std::string dff_name = v.dff+\".dff\";\n ImgHandle *img = NULL;\n for (size_t i=0 ; i<cfg.imgs.size() ; ++i) {\n ImgHandle *img2 = imgs[cfg.imgs[i].second];\n if (img2->i.fileExists(dff_name)) {\n img = img2;\n break;\n }\n }\n if (img == NULL) {\n out << \"Not found in any IMG file: \"\n << \"\\\"\" << dff_name << \"\\\"\" << std::endl;\n continue;\n }\n\n img->open_file_img(out,dff_name);\n // use a ../ prefix because the car gcol lives in its own directory\n ios_read_dff(1,img->f,&dff,img->name+\"/\"+dff_name+\"/\",\"../\",db);\n\n VehicleData *vdata = handling[v.handling_id];\n APP_ASSERT(vdata!=NULL);\n \n // account for centre of gravity by adjusting entire mesh\n offset_dff(dff, -vdata->com_x, -vdata->com_y, -vdata->com_z);\n\n Obj obj; // currently obj only needs a few things set\n obj.dff = v.dff;\n obj.txd = v.txd;\n obj.flags = 0;\n obj.is_car = true;\n\n std::vector<std::string> export_imgs;\n export_imgs.push_back(\"../\"+img->name);\n for (size_t k=0 ; k<imgs.size() ; ++k) {\n ImgHandle *img2 = imgs[cfg.imgs[k].second];\n if (img2->name == img->name) continue;\n export_imgs.push_back(\"../\"+img2->name);\n }\n\n // since it's in a different directory, use a new matdb\n // this means that there could be duplicates of materials\n // but otherwise we'd have to refactor export_mesh to use different\n // strings in the mesh file than in the file defining the materials\n MatDB car_matdb;\n\n frame *fr_chassis = NULL;\n frame *fr_wheel_lb = NULL;\n frame *fr_wheel_lf = NULL;\n frame *fr_wheel_rb = NULL;\n frame *fr_wheel_rf = NULL;\n\n\n for (unsigned long j=0 ; j<dff.frames.size() ; ++j) {\n frame &fr = dff.frames[j];\n\n if (fr.name==\"wheel_lb_dummy\") fr_wheel_lb = &fr;\n if (fr.name==\"wheel_lf_dummy\") fr_wheel_lf = &fr;\n if (fr.name==\"wheel_rb_dummy\") fr_wheel_rb = &fr;\n if (fr.name==\"wheel_rf_dummy\") fr_wheel_rf = &fr;\n\n // ignore dummies for now\n if (fr.geometry == -1) continue;\n\n if (fr.name==\"chassis\") {\n reset_dff_frame(dff, j);\n fr_chassis = &fr;\n }\n }\n (void) fr_chassis; // suppress new gcc warning\n\n for (unsigned long j=0 ; j<dff.frames.size() ; ++j) {\n frame &fr = dff.frames[j];\n\n // ignore dummies for now\n if (fr.geometry == -1) continue;\n\n geometry &g = dff.geometries[fr.geometry];\n\n generate_normals(g);\n\n std::string oname = vehicle_dir+\"/\";\n\n // ides are to chase txdps\n export_mesh(vehicle_texs,everything,export_imgs,out,\n vehicle_dir+\"/\"+fr.name+\".mesh\",\n obj,fr.name,g,car_matdb,lua_file);\n }\n\n lua_file << std::endl;\n\n\n if (dff.has_tcol) {\n\n/*\n for (unsigned i=0 ; i<dff.tcol.compound.hulls.size() ; ++i)\n dff.tcol.compound.hulls[i].material = 179;\n for (unsigned i=0 ; i<dff.tcol.compound.boxes.size() ; ++i)\n dff.tcol.compound.boxes[i].material = 179;\n for (unsigned i=0 ; i<dff.tcol.compound.cylinders.size() ; ++i)\n dff.tcol.compound.cylinders[i].material = 179;\n for (unsigned i=0 ; i<dff.tcol.compound.cones.size() ; ++i)\n dff.tcol.compound.cones[i].material = 179;\n for (unsigned i=0 ; i<dff.tcol.compound.planes.size() ; ++i)\n dff.tcol.compound.planes[i].material = 179;\n for (unsigned i=0 ; i<dff.tcol.compound.spheres.size() ; ++i)\n dff.tcol.compound.spheres[i].material = 179;\n for (unsigned i=0 ; i<dff.tcol.triMesh.faces.size() ; ++i)\n dff.tcol.triMesh.faces[i].material = 179;\n*/\n\n dff.tcol.mass = vdata->mass;\n dff.tcol.linearDamping = 0.15f;\n\n tcol_triangles_to_hulls(dff.tcol, 0.04f, 0.04f);\n\n if (!dff.tcol.usingCompound && !dff.tcol.usingTriMesh) {\n GRIT_EXCEPT(\"Collision data had no compound or trimesh\");\n /*\n } else if (binary) {\n col_name += \".bcol\";\n GRIT_EXCEPT(\"Writing bcol not implemented.\");\n */\n } else {\n\n std::ofstream out;\n out.open((vehicle_dir+\"/chassis.gcol\").c_str(), std::ios::binary);\n APP_ASSERT_IO_SUCCESSFUL(out,\"opening gcol for writing\");\n\n write_tcol_as_bcol(out, dff.tcol);\n }\n\n if (v.type == \"car\") {\n lua_file << \"class_add(`/gtasa/\"<<vname<<\"`, extends(Vehicle) {\\n\";\n lua_file << \" castShadows = true;\\n\";\n lua_file << \" gfxMesh = `\"<<vname<<\"/chassis.mesh`;\\n\";\n lua_file << \" colMesh = `\"<<vname<<\"/chassis.gcol`;\\n\";\n lua_file << \" placementZOffset=0.4;\\n\";\n lua_file << \" powerPlots = {\\n\";\n float torque = vdata->mass * vdata->engine_accel * v.rear_wheel_size/2 * 0.5f; // 0.75 is a fudge factor\n lua_file << \" [-1] = { [0] = -\"<<torque<<\"; [10] = -\"<<torque<<\"; [25] = -\"<<torque<<\"; [40] = 0; };\\n\";\n lua_file << \" [0] = {};\\n\";\n lua_file << \" [1] = { [0] = \"<<torque<<\"; [10] = \"<<torque<<\"; [25] = \"<<torque<<\"; [60] = \"<<torque<<\"; };\\n\";\n lua_file << \" };\\n\";\n lua_file << \" meshWheelInfo = {\\n\";\n\n std::stringstream all_wheels;\n all_wheels << \"castRadius=0.05;\" << \"mesh=`\"<<vname<<\"/wheel.mesh`;\"\n << \"slack=\"<<(vdata->susp_upper)<<\";\"\n << \"len=\"<<(- vdata->susp_lower)<<\";\"\n << \"hookeFactor=1.0;\";\n std::stringstream front_wheels;\n front_wheels << (vdata->front_wheel_drive?\"drive=1;\":\"\")\n << \"rad=\"<<v.front_wheel_size/2<<\";\"\n << (vdata->steer_rearwheels?\"\":\"steer=1;\")\n << \"mu = \"<<3*vdata->traction_mult<<\";\";\n std::stringstream rear_wheels;\n rear_wheels << (vdata->back_wheel_drive?\"drive=1;\":\"\")\n << \"rad=\"<<v.rear_wheel_size/2<<\";\"\n << (vdata->steer_rearwheels?\"steer=1;\":\"\")\n << (vdata->no_handbrake?\"\":\"handbrake = true;\")\n << \"mu = \"<<3*vdata->traction_mult<<\";\";\n \n APP_ASSERT(fr_wheel_lf!=NULL);\n APP_ASSERT(fr_wheel_lb!=NULL);\n APP_ASSERT(fr_wheel_rf!=NULL);\n APP_ASSERT(fr_wheel_rb!=NULL);\n float x,y,z;\n \n x = fr_wheel_lf->x; y = fr_wheel_lf->y; z = fr_wheel_lf->z + vdata->susp_upper;\n lua_file << \" front_left = {\\n\";\n lua_file << \" \"<<all_wheels.str() << front_wheels.str() << \"left=true;\\n\";\n lua_file << \" attachPos=vector3(\"<<x<<\",\"<<y<<\",\"<<z<<\");\\n\";\n lua_file << \" },\\n\";\n\n x = fr_wheel_rf->x; y = fr_wheel_rf->y; z = fr_wheel_rf->z + vdata->susp_upper;\n lua_file << \" front_right = {\\n\";\n lua_file << \" \"<<all_wheels.str() << front_wheels.str() << \"\\n\";\n lua_file << \" attachPos=vector3(\"<<x<<\",\"<<y<<\",\"<<z<<\");\\n\";\n lua_file << \" },\\n\";\n\n x = fr_wheel_lb->x; y = fr_wheel_lb->y; z = fr_wheel_lb->z + vdata->susp_upper;\n lua_file << \" rear_left = {\\n\";\n lua_file << \" \"<<all_wheels.str() << rear_wheels.str() << \"left=true;\\n\";\n lua_file << \" attachPos=vector3(\"<<x<<\",\"<<y<<\",\"<<z<<\");\\n\";\n lua_file << \" },\\n\";\n\n x = fr_wheel_rb->x; y = fr_wheel_rb->y; z = fr_wheel_rb->z + vdata->susp_upper;\n lua_file << \" rear_right = {\\n\";\n lua_file << \" \"<<all_wheels.str() << rear_wheels.str() << \"\\n\";\n lua_file << \" attachPos=vector3(\"<<x<<\",\"<<y<<\",\"<<z<<\");\\n\";\n lua_file << \" },\\n\";\n\n lua_file << \" },\\n\";\n\n lua_file << \" colourSpec = {\\n\";\n std::vector<int> cols2 = carcols_2[vname];\n std::vector<int> cols4 = carcols_4[vname];\n APP_ASSERT(cols2.size()%2==0);\n APP_ASSERT(cols4.size()%4==0);\n for (unsigned i=0 ; i<cols2.size() ; i+=2) {\n int c1 = cols2[i], c2 = cols2[i+1];\n lua_file << \" { {\\\"gtasa\"<<c1<<\"\\\"}, {\\\"gtasa\"<<c2<<\"\\\"} },\\n\";\n }\n for (unsigned i=0 ; i<cols4.size() ; i+=4) {\n int c1 = cols4[i], c2 = cols4[i+1];\n int c3 = cols4[i+2], c4 = cols4[i+3];\n lua_file << \" { {\\\"gtasa\"<<c1<<\"\\\"}, {\\\"gtasa\"<<c2<<\"\\\"}, \"\n << \"{\\\"gtasa\"<<c3<<\"\\\"}, {\\\"gtasa\"<<c4<<\"\\\"} },\\n\";\n }\n lua_file << \" };\\n\";\n\n lua_file << \"},{})\" << std::endl;\n } else {\n lua_file << std::endl;\n lua_file << \"class `../\"<<vname<<\"` (ColClass) {\\n\";\n lua_file << \" gfxMesh=`\"<<vname<<\"/chassis.mesh`;\\n\";\n lua_file << \" colMesh=`\"<<vname<<\"/chassis.gcol`;\\n\";\n lua_file << \" castShadows = true;\\n\";\n lua_file << \" colourSpec = {\\n\";\n std::vector<int> cols2 = carcols_2[vname];\n std::vector<int> cols4 = carcols_4[vname];\n APP_ASSERT(cols2.size()%2==0);\n APP_ASSERT(cols4.size()%4==0);\n for (unsigned i=0 ; i<cols2.size() ; i+=2) {\n int c1 = cols2[i], c2 = cols2[i+1];\n lua_file << \" { {\\\"gtasa\"<<c1<<\"\\\"}, {\\\"gtasa\"<<c2<<\"\\\"} },\\n\";\n }\n for (unsigned i=0 ; i<cols4.size() ; i+=4) {\n int c1 = cols4[i], c2 = cols4[i+1];\n int c3 = cols4[i+2], c4 = cols4[i+3];\n lua_file << \" { {\\\"gtasa\"<<c1<<\"\\\"}, {\\\"gtasa\"<<c2<<\"\\\"}, \"\n << \"{\\\"gtasa\"<<c3<<\"\\\"}, {\\\"gtasa\"<<c4<<\"\\\"} },\\n\";\n }\n lua_file << \" };\\n\";\n\n lua_file << \"}\" << std::endl;\n }\n\n }\n\n\n }\n\n vehicles_lua << std::endl;\n vehicles_lua << \"all_vehicles = { \";\n\n for (Vehicles::iterator i=vehicles.begin(),i_=vehicles.end() ; i!=i_ ; ++i) {\n vehicles_lua << \"`\"<<i->dff<<\"`, \";\n }\n vehicles_lua << \"}\" << std::endl;\n\n if (getenv(\"SKIP_MAP\")==NULL) {\n out << \"Exporting map...\" << std::endl;\n std::ofstream map;\n map.open((dest_dir+\"/\"+cfg.modname+\"/map.lua\").c_str(),\n std::ios::binary);\n APP_ASSERT_IO_SUCCESSFUL(map, \"opening map.lua\");\n map.precision(25);\n\n map << \"print(\\\"Loading world\\\")\\n\";\n map << \"object_all_del()\\n\";\n\n map << \"local last\\n\";\n\n for (IPLs::iterator i=ipls.begin(),i_=ipls.end() ; i!=i_ ; ++i) {\n const IPL &ipl = *i;\n const Insts &insts = ipl.getInsts();\n for (Insts::const_iterator j=insts.begin(),j_=insts.end() ;\n j!=j_ ; ++j) {\n const Inst &inst = *j;\n if (inst.is_low_detail) continue;\n if (!ids_written_out[inst.id]) continue;\n if (inst.near_for==-1) {\n map<<\"object_add(`/gtasa/\"<<inst.id<<\"`,\"\n <<\"vector3(\"<<inst.x<<\",\"<<inst.y<<\",\"<<inst.z<<\")\";\n if (inst.rx!=0 || inst.ry!=0 || inst.rz!=0) {\n map<<\",{rot=quat(\"\n <<inst.rw<<\",\"<<inst.rx<<\",\"\n <<inst.ry<<\",\"<<inst.rz<<\")}\";\n }\n map<<\")\\n\";\n } else {\n const Inst &far_inst = insts[inst.near_for];\n map<<\"last=object_add(`/gtasa/\"<<inst.id<<\"`,\"\n <<\"vector3(\"<<inst.x<<\",\"<<inst.y<<\",\"<<inst.z<<\")\";\n if (inst.rx!=0 || inst.ry!=0 || inst.rz!=0) {\n map<<\",{rot=quat(\"\n <<inst.rw<<\",\"<<inst.rx<<\",\"\n <<inst.ry<<\",\"<<inst.rz<<\")}\";\n }\n map<<\")\\n\";\n map<<\"object_add(`/gtasa/\"<<far_inst.id<<\"`,\"\n <<\"vector3(\"<<far_inst.x<<\",\"<<far_inst.y<<\",\"<<far_inst.z<<\")\";\n map<<\",{\";\n if (far_inst.rx!=0 || far_inst.ry!=0 || far_inst.rz!=0) {\n map<<\"rot=quat(\"\n <<far_inst.rw<<\",\"<<far_inst.rx<<\",\"\n <<far_inst.ry<<\",\"<<far_inst.rz<<\"),\";\n }\n map<<\"near=last}\";\n map<<\")\\n\";\n }\n }\n }\n }\n\n out << \"Export complete.\" << std::endl;\n\n}\n\nvoid extract_gtasa (const std::string &gta_dir, const std::string &dest_dir)\n{\n\n Config cfg;\n\n cfg.modname = \"gtasa\";\n\n cfg.gta_dir = gta_dir;\n cfg.dest_dir = dest_dir;\n\n init_tex_dup_map();\n init_ogre();\n\n typedef std::pair<std::string,std::string> P;\n cfg.imgs.push_back(P(\"/models/gta3.img\",\"gta3.img\"));\n cfg.imgs.push_back(P(\"/models/gta_int.img\",\"gta_int.img\"));\n cfg.txds.push_back(P(\"/models/effectsPC.txd\",\"effectsPC.txd\"));\n cfg.txds.push_back(P(\"/models/fonts.txd\",\"fonts.txd\"));\n cfg.txds.push_back(P(\"/models/fronten1.txd\",\"fronten1.txd\"));\n cfg.txds.push_back(P(\"/models/fronten2.txd\",\"fronten2.txd\"));\n cfg.txds.push_back(P(\"/models/fronten3.txd\",\"fronten3.txd\"));\n cfg.txds.push_back(P(\"/models/fronten_pc.txd\",\"fronten_pc.txd\"));\n cfg.txds.push_back(P(\"/models/generic/vehicle.txd\",\"generic/vehicle.txd\"));\n cfg.txds.push_back(P(\"/models/generic/wheels.txd\",\"generic/wheels.txd\"));\n cfg.txds.push_back(P(\"/models/grass/plant1.txd\",\"grass/plant1.txd\"));\n cfg.txds.push_back(P(\"/models/hud.txd\",\"hud.txd\"));\n cfg.txds.push_back(P(\"/models/misc.txd\",\"misc.txd\"));\n cfg.txds.push_back(P(\"/models/particle.txd\",\"particle.txd\"));\n cfg.txds.push_back(P(\"/models/pcbtns.txd\",\"pcbtns.txd\"));\n cfg.txds.push_back(P(\"/models/txd/LD_RCE2.txd\",\"txd/LD_RCE2.txd\"));\n cfg.txds.push_back(P(\"/models/txd/intro1.txd\",\"txd/intro1.txd\"));\n cfg.txds.push_back(P(\"/models/txd/intro2.txd\",\"txd/intro2.txd\"));\n cfg.txds.push_back(P(\"/models/txd/intro4.txd\",\"txd/intro4.txd\"));\n cfg.txds.push_back(P(\"/models/txd/LD_BEAT.txd\",\"txd/LD_BEAT.txd\"));\n cfg.txds.push_back(P(\"/models/txd/LD_BUM.txd\",\"txd/LD_BUM.txd\"));\n cfg.txds.push_back(P(\"/models/txd/LD_CARD.txd\",\"txd/LD_CARD.txd\"));\n cfg.txds.push_back(P(\"/models/txd/LD_CHAT.txd\",\"txd/LD_CHAT.txd\"));\n cfg.txds.push_back(P(\"/models/txd/LD_DRV.txd\",\"txd/LD_DRV.txd\"));\n cfg.txds.push_back(P(\"/models/txd/LD_DUAL.txd\",\"txd/LD_DUAL.txd\"));\n cfg.txds.push_back(P(\"/models/txd/ld_grav.txd\",\"txd/ld_grav.txd\"));\n cfg.txds.push_back(P(\"/models/txd/LD_NONE.txd\",\"txd/LD_NONE.txd\"));\n cfg.txds.push_back(P(\"/models/txd/LD_OTB.txd\",\"txd/LD_OTB.txd\"));\n cfg.txds.push_back(P(\"/models/txd/LD_OTB2.txd\",\"txd/LD_OTB2.txd\"));\n cfg.txds.push_back(P(\"/models/txd/LD_PLAN.txd\",\"txd/LD_PLAN.txd\"));\n cfg.txds.push_back(P(\"/models/txd/LD_POKE.txd\",\"txd/LD_POKE.txd\"));\n cfg.txds.push_back(P(\"/models/txd/LD_POOL.txd\",\"txd/LD_POOL.txd\"));\n cfg.txds.push_back(P(\"/models/txd/LD_RACE.txd\",\"txd/LD_RACE.txd\"));\n cfg.txds.push_back(P(\"/models/txd/LD_RCE1.txd\",\"txd/LD_RCE1.txd\"));\n cfg.txds.push_back(P(\"/models/txd/LD_RCE3.txd\",\"txd/LD_RCE3.txd\"));\n cfg.txds.push_back(P(\"/models/txd/LD_RCE4.txd\",\"txd/LD_RCE4.txd\"));\n cfg.txds.push_back(P(\"/models/txd/LD_RCE5.txd\",\"txd/LD_RCE5.txd\"));\n cfg.txds.push_back(P(\"/models/txd/LD_ROUL.txd\",\"txd/LD_ROUL.txd\"));\n cfg.txds.push_back(P(\"/models/txd/ld_shtr.txd\",\"txd/ld_shtr.txd\"));\n cfg.txds.push_back(P(\"/models/txd/LD_SLOT.txd\",\"txd/LD_SLOT.txd\"));\n cfg.txds.push_back(P(\"/models/txd/LD_SPAC.txd\",\"txd/LD_SPAC.txd\"));\n cfg.txds.push_back(P(\"/models/txd/LD_TATT.txd\",\"txd/LD_TATT.txd\"));\n cfg.txds.push_back(P(\"/models/txd/load0uk.txd\",\"txd/load0uk.txd\"));\n cfg.txds.push_back(P(\"/models/txd/loadsc0.txd\",\"txd/loadsc0.txd\"));\n cfg.txds.push_back(P(\"/models/txd/loadsc1.txd\",\"txd/loadsc1.txd\"));\n cfg.txds.push_back(P(\"/models/txd/loadsc10.txd\",\"txd/loadsc10.txd\"));\n cfg.txds.push_back(P(\"/models/txd/loadsc11.txd\",\"txd/loadsc11.txd\"));\n cfg.txds.push_back(P(\"/models/txd/loadsc12.txd\",\"txd/loadsc12.txd\"));\n cfg.txds.push_back(P(\"/models/txd/loadsc13.txd\",\"txd/loadsc13.txd\"));\n cfg.txds.push_back(P(\"/models/txd/loadsc14.txd\",\"txd/loadsc14.txd\"));\n cfg.txds.push_back(P(\"/models/txd/loadsc2.txd\",\"txd/loadsc2.txd\"));\n cfg.txds.push_back(P(\"/models/txd/loadsc3.txd\",\"txd/loadsc3.txd\"));\n cfg.txds.push_back(P(\"/models/txd/loadsc4.txd\",\"txd/loadsc4.txd\"));\n cfg.txds.push_back(P(\"/models/txd/loadsc5.txd\",\"txd/loadsc5.txd\"));\n cfg.txds.push_back(P(\"/models/txd/loadsc6.txd\",\"txd/loadsc6.txd\"));\n cfg.txds.push_back(P(\"/models/txd/loadsc7.txd\",\"txd/loadsc7.txd\"));\n cfg.txds.push_back(P(\"/models/txd/loadsc8.txd\",\"txd/loadsc8.txd\"));\n cfg.txds.push_back(P(\"/models/txd/loadsc9.txd\",\"txd/loadsc9.txd\"));\n cfg.txds.push_back(P(\"/models/txd/LOADSCS.txd\",\"txd/LOADSCS.txd\"));\n cfg.txds.push_back(P(\"/models/txd/LOADSUK.txd\",\"txd/LOADSUK.txd\"));\n //cfg.txds.push_back(P(\"/models/txd/outro.txd\",\"txd/outro.txd\"));\n cfg.txds.push_back(P(\"/models/txd/splash1.txd\",\"txd/splash1.txd\"));\n cfg.txds.push_back(P(\"/models/txd/splash2.txd\",\"txd/splash2.txd\"));\n cfg.txds.push_back(P(\"/models/txd/splash3.txd\",\"txd/splash3.txd\"));\n\n\n\n // ides {{{\n const char *ides[] = {\n \"maps/country/countn2.ide\",\n \"maps/country/countrye.ide\",\n \"maps/country/countryN.ide\",\n \"maps/country/countryS.ide\",\n \"maps/country/countryW.ide\",\n \"maps/country/counxref.ide\",\n \"maps/generic/barriers.ide\",\n \"maps/generic/dynamic.ide\",\n \"maps/generic/dynamic2.ide\",\n \"maps/generic/multiobj.ide\",\n \"maps/generic/procobj.ide\",\n \"maps/generic/vegepart.ide\",\n \"maps/interior/gen_int1.ide\",\n \"maps/interior/gen_int2.ide\",\n \"maps/interior/gen_int3.ide\",\n \"maps/interior/gen_int4.ide\",\n \"maps/interior/gen_int5.ide\",\n \"maps/interior/gen_intb.ide\",\n \"maps/interior/int_cont.ide\",\n \"maps/interior/int_LA.ide\",\n \"maps/interior/int_SF.ide\",\n \"maps/interior/int_veg.ide\",\n \"maps/interior/propext.ide\",\n \"maps/interior/props.ide\",\n \"maps/interior/props2.ide\",\n \"maps/interior/savehous.ide\",\n \"maps/interior/stadint.ide\",\n \"maps/LA/LAe.ide\",\n \"maps/LA/LAe2.ide\",\n \"maps/LA/LAhills.ide\",\n \"maps/LA/LAn.ide\",\n \"maps/LA/LAn2.ide\",\n \"maps/LA/LAs.ide\",\n \"maps/LA/LAs2.ide\",\n \"maps/LA/LAw.ide\",\n \"maps/LA/LAw2.ide\",\n \"maps/LA/LaWn.ide\",\n \"maps/LA/LAxref.ide\",\n \"maps/leveldes/levelmap.ide\",\n \"maps/leveldes/levelxre.ide\",\n \"maps/leveldes/seabed.ide\",\n \"maps/SF/SFe.ide\",\n \"maps/SF/SFn.ide\",\n \"maps/SF/SFs.ide\",\n \"maps/SF/SFSe.ide\",\n \"maps/SF/SFw.ide\",\n \"maps/SF/SFxref.ide\",\n \"maps/txd.ide\",\n \"maps/vegas/vegasE.ide\",\n \"maps/vegas/VegasN.ide\",\n \"maps/vegas/VegasS.ide\",\n \"maps/vegas/VegasW.ide\",\n \"maps/vegas/vegaxref.ide\",\n \"maps/veh_mods/veh_mods.ide\",\n \"vehicles.ide\",\n \"peds.ide\",\n \"txdcut.ide\",\n \"default.ide\"\n }; //}}}\n\n cfg.idesv = ides;\n cfg.idesc = sizeof ides / sizeof *ides;\n\n //{{{\n cfg.ipls.push_back(IPLConfig(\"leveldes/seabed.ipl\",\"gta3.img\",\"seabed\",1));\n cfg.ipls.push_back(IPLConfig(\"leveldes/levelmap.ipl\",\"gta3.img\",\"levelmap\",1));\n cfg.ipls.push_back(IPLConfig(\"SF/SFe.ipl\",\"gta3.img\",\"sfe\",4));\n cfg.ipls.push_back(IPLConfig(\"SF/SFn.ipl\",\"gta3.img\",\"sfn\",3));\n cfg.ipls.push_back(IPLConfig(\"SF/SFSe.ipl\",\"gta3.img\",\"sfse\",7));\n cfg.ipls.push_back(IPLConfig(\"SF/SFs.ipl\",\"gta3.img\",\"sfs\",9));\n cfg.ipls.push_back(IPLConfig(\"SF/SFw.ipl\",\"gta3.img\",\"sfw\",6));\n cfg.ipls.push_back(IPLConfig(\"vegas/vegasE.ipl\",\"gta3.img\",\"vegase\",9));\n cfg.ipls.push_back(IPLConfig(\"vegas/vegasN.ipl\",\"gta3.img\",\"vegasn\",9));\n cfg.ipls.push_back(IPLConfig(\"vegas/vegasS.ipl\",\"gta3.img\",\"vegass\",6));\n cfg.ipls.push_back(IPLConfig(\"vegas/vegasW.ipl\",\"gta3.img\",\"vegasw\",12));\n cfg.ipls.push_back(IPLConfig(\"country/countn2.ipl\",\"gta3.img\",\"countn2\",9));\n cfg.ipls.push_back(IPLConfig(\"country/countrye.ipl\",\"gta3.img\",\"countrye\",14));\n cfg.ipls.push_back(IPLConfig(\"country/countryN.ipl\",\"gta3.img\",\"countryn\",4));\n cfg.ipls.push_back(IPLConfig(\"country/countryS.ipl\",\"gta3.img\",\"countrys\",5));\n cfg.ipls.push_back(IPLConfig(\"country/countryw.ipl\",\"gta3.img\",\"countryw\",9));\n cfg.ipls.push_back(IPLConfig(\"LA/LAe2.ipl\",\"gta3.img\",\"lae2\",7));\n cfg.ipls.push_back(IPLConfig(\"LA/LAe.ipl\",\"gta3.img\",\"lae\",6));\n cfg.ipls.push_back(IPLConfig(\"LA/LAhills.ipl\",\"gta3.img\",\"lahills\",5));\n cfg.ipls.push_back(IPLConfig(\"LA/LAn2.ipl\",\"gta3.img\",\"lan2\",4));\n cfg.ipls.push_back(IPLConfig(\"LA/LAn.ipl\",\"gta3.img\",\"lan\",3));\n cfg.ipls.push_back(IPLConfig(\"LA/LAs2.ipl\",\"gta3.img\",\"las2\",5));\n cfg.ipls.push_back(IPLConfig(\"LA/LAs.ipl\",\"gta3.img\",\"las\",6));\n cfg.ipls.push_back(IPLConfig(\"LA/LAw2.ipl\",\"gta3.img\",\"law2\",5));\n cfg.ipls.push_back(IPLConfig(\"LA/LAw.ipl\",\"gta3.img\",\"law\",6));\n cfg.ipls.push_back(IPLConfig(\"LA/LaWn.ipl\",\"gta3.img\",\"lawn\",4));\n cfg.ipls.push_back(IPLConfig(\"interior/gen_int1.ipl\",\"gta_int.img\",\"\",0));\n cfg.ipls.push_back(IPLConfig(\"interior/gen_int2.ipl\",\"gta_int.img\",\"gen_int2\",1));\n cfg.ipls.push_back(IPLConfig(\"interior/gen_int3.ipl\",\"gta_int.img\",\"gen_int3\",1));\n cfg.ipls.push_back(IPLConfig(\"interior/gen_int4.ipl\",\"gta_int.img\",\"gen_int4\",3));\n cfg.ipls.push_back(IPLConfig(\"interior/gen_int5.ipl\",\"gta_int.img\",\"gen_int5\",8));\n cfg.ipls.push_back(IPLConfig(\"interior/gen_intb.ipl\",\"gta_int.img\",\"gen_intb\",1));\n cfg.ipls.push_back(IPLConfig(\"interior/int_cont.ipl\",\"gta_int.img\",\"\",0));\n cfg.ipls.push_back(IPLConfig(\"interior/int_LA.ipl\",\"gta_int.img\",\"int_la\",4));\n cfg.ipls.push_back(IPLConfig(\"interior/int_SF.ipl\",\"gta_int.img\",\"int_sf\",1));\n cfg.ipls.push_back(IPLConfig(\"interior/int_veg.ipl\",\"gta_int.img\",\"int_veg\",4));\n cfg.ipls.push_back(IPLConfig(\"interior/savehous.ipl\",\"gta_int.img\",\"savehous\",2));\n cfg.ipls.push_back(IPLConfig(\"interior/stadint.ipl\",\"gta_int.img\",\"stadint\",1));\n //}}}\n\n extract(cfg,std::cout);\n}\n\n\nvoid extract_gostown (const std::string &gta_dir, const std::string &dest_dir)\n{\n\n Config cfg;\n\n cfg.modname = \"gostown\";\n\n cfg.gta_dir = gta_dir;\n cfg.dest_dir = dest_dir;\n\n init_ogre();\n\n typedef std::pair<std::string,std::string> P;\n cfg.imgs.push_back(P(\"/models/gta3.img\",\"gta3.img\"));\n cfg.imgs.push_back(P(\"/models/gostown6.img\",\"gostown6.img\"));\n\n\n // {{{ IDES\n const char *ides[] = {\n //\"maps/country/countn2.ide\",\n //\"maps/country/countrye.ide\",\n //\"maps/country/countryN.ide\",\n //\"maps/country/countryS.ide\",\n //\"maps/country/countryW.ide\",\n //\"maps/country/counxref.ide\",\n \"maps/generic/barriers.ide\",\n \"maps/generic/dynamic.ide\",\n \"maps/generic/dynamic2.ide\",\n \"maps/generic/multiobj.ide\",\n \"maps/generic/procobj.ide\",\n \"maps/generic/vegepart.ide\",\n //\"maps/interior/gen_int1.ide\",\n //\"maps/interior/gen_int2.ide\",\n //\"maps/interior/gen_int3.ide\",\n //\"maps/interior/gen_int4.ide\",\n //\"maps/interior/gen_int5.ide\",\n //\"maps/interior/gen_intb.ide\",\n //\"maps/interior/int_cont.ide\",\n //\"maps/interior/int_LA.ide\",\n //\"maps/interior/int_SF.ide\",\n //\"maps/interior/int_veg.ide\",\n //\"maps/interior/propext.ide\",\n //\"maps/interior/props.ide\",\n //\"maps/interior/props2.ide\",\n //\"maps/interior/savehous.ide\",\n //\"maps/interior/stadint.ide\",\n //\"maps/LA/LAe.ide\",\n //\"maps/LA/LAe2.ide\",\n //\"maps/LA/LAhills.ide\",\n //\"maps/LA/LAn.ide\",\n //\"maps/LA/LAn2.ide\",\n //\"maps/LA/LAs.ide\",\n //\"maps/LA/LAs2.ide\",\n //\"maps/LA/LAw.ide\",\n //\"maps/LA/LAw2.ide\",\n //\"maps/LA/LaWn.ide\",\n //\"maps/LA/LAxref.ide\",\n //\"maps/leveldes/levelmap.ide\",\n //\"maps/leveldes/levelxre.ide\",\n \"maps/leveldes/seabed.ide\",\n //\"maps/SF/SFe.ide\",\n //\"maps/SF/SFn.ide\",\n //\"maps/SF/SFs.ide\",\n //\"maps/SF/SFSe.ide\",\n //\"maps/SF/SFw.ide\",\n //\"maps/SF/SFxref.ide\",\n //\"maps/txd.ide\",\n //\"maps/vegas/vegasE.ide\",\n //\"maps/vegas/VegasN.ide\",\n //\"maps/vegas/VegasS.ide\",\n //\"maps/vegas/VegasW.ide\",\n //\"maps/vegas/vegaxref.ide\",\n //\"maps/veh_mods/veh_mods.ide\",\n \"maps/Gostown6/Gp_land50.IDE\",\n \"maps/Gostown6/Gp_tunnels.IDE\",\n \"maps/Gostown6/Gp_docks.IDE\",\n \"maps/Gostown6/Gp_palmtheme.IDE\",\n \"maps/Gostown6/Gp_A13.IDE\",\n \"maps/Gostown6/Gp_airport.IDE\",\n \"maps/Gostown6/Gp_city.IDE\",\n \"maps/Gostown6/Gp_GSS.IDE\",\n \"maps/Gostown6/lots/ParoXum.IDE\",\n \"maps/Gostown6/lots/JostVice.IDE\",\n \"maps/Gostown6/lots/Fredskin.IDE\",\n \"maps/Gostown6/lots/Raycen.IDE\",\n \"maps/Gostown6/lots/Generics.IDE\",\n \"maps/Gostown6/lots/Parent.IDE\",\n \"maps/Gostown6/Gp_laguna.IDE\",\n //\"vehicles.ide\",\n //\"peds.ide\",\n //\"default.ide\"\n }; //}}}\n\n cfg.idesv = ides;\n cfg.idesc = sizeof ides / sizeof *ides;\n\n //{{{ IPL\n cfg.ipls.push_back(IPLConfig(\"Gostown6/Gp_land50.IPL\",\"gostown6.img\",\"\",0));\n cfg.ipls.push_back(IPLConfig(\"Gostown6/Gp_tunnels.IPL\",\"gostown6.img\",\"\",0));\n cfg.ipls.push_back(IPLConfig(\"Gostown6/Gp_docks.IPL\",\"gostown6.img\",\"\",0));\n cfg.ipls.push_back(IPLConfig(\"Gostown6/Gp_veg.IPL\",\"gostown6.img\",\"\",0));\n cfg.ipls.push_back(IPLConfig(\"Gostown6/Gp_A13.IPL\",\"gostown6.img\",\"\",0));\n cfg.ipls.push_back(IPLConfig(\"Gostown6/Gp_airport.IPL\",\"gostown6.img\",\"\",0));\n cfg.ipls.push_back(IPLConfig(\"Gostown6/Gp_City.IPL\",\"gostown6.img\",\"\",0));\n cfg.ipls.push_back(IPLConfig(\"Gostown6/Gp_GSS.IPL\",\"gostown6.img\",\"\",0));\n cfg.ipls.push_back(IPLConfig(\"Gostown6/Gp_props.IPL\",\"gostown6.img\",\"\",0));\n cfg.ipls.push_back(IPLConfig(\"Gostown6/lots/ParoXum.IPL\",\"gostown6.img\",\"\",0));\n cfg.ipls.push_back(IPLConfig(\"Gostown6/lots/JostVice.IPL\",\"gostown6.img\",\"\",0));\n cfg.ipls.push_back(IPLConfig(\"Gostown6/lots/Fredskin.IPL\",\"gostown6.img\",\"\",0));\n cfg.ipls.push_back(IPLConfig(\"Gostown6/lots/Raycen.IPL\",\"gostown6.img\",\"\",0));\n cfg.ipls.push_back(IPLConfig(\"Gostown6/Gp_laguna.IPL\",\"gostown6.img\",\"\",0));\n cfg.ipls.push_back(IPLConfig(\"Gostown6/occlu.ipl\",\"gostown6.img\",\"\",0));\n //}}}\n\n extract(cfg,std::cout);\n}\n\nstatic int tolowr (int c)\n{\n return std::tolower(char(c),std::cout.getloc());\n}\n \nstatic std::string& strlower(std::string& s)\n{\n std::transform(s.begin(),s.end(), s.begin(),tolowr);\n return s;\n}\n\nint main(int argc, char **argv)\n{\n\n if (argc!=3 && argc!=4) {\n std::cerr<<\"Usage: \"<<argv[ 0]<<\" <mod> <source_dir> \"\n <<\" [ <grit_dir> ]\"<<std::endl;\n std::cerr<<\"Where <mod> can be \\\"gtasa\\\" \"\n <<\"or \\\"gostown\\\"\"<<std::endl;\n return EXIT_FAILURE;\n }\n\n try {\n std::string mod = argv[1];\n strlower(mod);\n const char *src = argv[2];\n const char *dest = argc>3?argv[3]:\".\";\n if (mod==\"gostown\") {\n extract_gostown(src, dest);\n } else if (mod==\"gtasa\") {\n extract_gtasa(src, dest);\n } else {\n std::cerr<<\"Unrecognised mod: \\\"\"\n <<argv[1]<<\"\\\"\"<<std::endl;\n return EXIT_FAILURE;\n }\n } catch (const Exception &e) {\n CERR << e << std::endl;\n\n return EXIT_FAILURE;\n }\n return EXIT_SUCCESS;\n}\n\n// vim: shiftwidth=4:tabstop=4:expandtab\n" }, { "alpha_fraction": 0.7258627414703369, "alphanum_fraction": 0.7343931794166565, "avg_line_length": 36.92647171020508, "blob_id": "622b00c2b8dec6dd9385a5b4ae5b7101fd8e54a5", "content_id": "5080aeb8fa541d1018d7a62e5d9a1dd64ba6a2be", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C", "length_bytes": 2579, "license_type": "permissive", "max_line_length": 80, "num_lines": 68, "path": "/engine/grit_perf_trace.h", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n#include <perf_trace.h>\n\nenum GritTracePoint {\n TRACE_FRAME_BEGIN,\n TRACE_GAME_LOGIC_BEGIN,\n TRACE_GAME_LOGIC_END,\n TRACE_PHYSICS_BEGIN,\n TRACE_PHYSICS_COLLISION_BEGIN,\n TRACE_PHYSICS_COLLISION_END,\n TRACE_PHYSICS_RESOLUTION_BEGIN,\n TRACE_PHYSICS_RESOLUTION_END,\n TRACE_PHYSICS_DYNAMICS_BEGIN,\n TRACE_PHYSICS_DYNAMICS_END,\n TRACE_PHYSICS_END,\n TRACE_ANIMATION_BEGIN,\n TRACE_ANIMATION_END,\n TRACE_SHADOW_CAST1_BEGIN,\n TRACE_SHADOW_CAST1_FRUSTUM_CULL_BEGIN,\n TRACE_SHADOW_CAST1_FRUSTUM_CULL_END,\n TRACE_SHADOW_CAST1_DRAW_BEGIN,\n TRACE_SHADOW_CAST1_DRAW_END,\n TRACE_SHADOW_CAST1_END,\n TRACE_SHADOW_CAST2_BEGIN,\n TRACE_SHADOW_CAST2_FRUSTUM_CULL_BEGIN,\n TRACE_SHADOW_CAST2_FRUSTUM_CULL_END,\n TRACE_SHADOW_CAST2_DRAW_BEGIN,\n TRACE_SHADOW_CAST2_DRAW_END,\n TRACE_SHADOW_CAST2_END,\n TRACE_SHADOW_CAST3_BEGIN,\n TRACE_SHADOW_CAST3_FRUSTUM_CULL_BEGIN,\n TRACE_SHADOW_CAST3_FRUSTUM_CULL_END,\n TRACE_SHADOW_CAST3_DRAW_BEGIN,\n TRACE_SHADOW_CAST3_DRAW_END,\n TRACE_SHADOW_CAST3_END,\n TRACE_FRAME_FRUSTUM_CULL_BEGIN,\n TRACE_FRAME_FRUSTUM_CULL_END,\n TRACE_FRAME_FRUSTUM_GBUFFER_DRAW_BEGIN,\n TRACE_FRAME_FRUSTUM_GBUFFER_DRAW_END,\n TRACE_FRAME_FRUSTUM_ALPHA_DRAW_BEGIN,\n TRACE_FRAME_FRUSTUM_ALPHA_DRAW_END,\n TRACE_FRAME_SYNC,\n TRACE_FRAME_END,\n\n TRACE_FRAME_SIZE, // Must be the last enumerator.\n};\n\nFrameTraceBuffer<TRACE_FRAME_SIZE> trace_buf();\n" }, { "alpha_fraction": 0.5662192106246948, "alphanum_fraction": 0.5697072148323059, "avg_line_length": 26.908554077148438, "blob_id": "6d6efc38eef57bea7638e73acb771e621a8137b8", "content_id": "4c15e9178dfb9171fc520f17e85a3721503d39d1", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 9461, "license_type": "permissive", "max_line_length": 94, "num_lines": 339, "path": "/engine/background_loader.cpp", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "/* Copyright (c) The Grit Game Engine authors 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n\n#include <sleep.h>\n\n#include \"gfx/gfx_disk_resource.h\"\n\n#include \"background_loader.h\"\n#include \"main.h\"\n\n#define SYNCHRONISED std::unique_lock<std::recursive_mutex> _scoped_lock(lock)\n#define SYNCHRONISED2(bgl) std::unique_lock<std::recursive_mutex> _scoped_lock(bgl->lock)\n\nbool Demand::requestLoad (float dist)\n{\n // called by main thread only\n mDist = dist;\n {\n SYNCHRONISED2(bgl);\n if (mInBackgroundQueue) return false;\n }\n\n if (!incremented) {\n //CVERB << \"Incrementing resources: \" << resources << std::endl;\n for (unsigned i=0 ; i<resources.size() ; ++i) {\n // increment all the resource counters so that we know they're in use\n resources[i]->increment();\n }\n incremented = true;\n }\n\n // if all the resources are in a loaded state then return true\n if (!loaded()) {\n //CVERB << \"Requesting background load: \" << resources << std::endl;\n // else get the bgl to do the right thing and return false\n bgl->checkRAMHost();\n bgl->checkRAMGPU();\n bgl->add(this);\n }\n\n return true;\n}\n\nbool Demand::loaded (void)\n{\n //CVERB << \"Checking if resources are loaded: \" << resources << std::endl;\n for (unsigned i=0 ; i<resources.size() ; ++i) {\n if (!resources[i]->isLoaded()) {\n return false;\n }\n }\n return true;\n}\n\nvoid Demand::immediateLoad (void)\n{\n //CVERB << \"Immediate load\" << std::endl;\n SYNCHRONISED2(bgl);\n if (!incremented) {\n for (unsigned i=0 ; i<resources.size() ; ++i) {\n resources[i]->increment();\n }\n incremented = true;\n }\n for (unsigned i=0 ; i<resources.size() ; ++i) {\n if (!resources[i]->isLoaded()) resources[i]->load();\n }\n}\n\nvoid Demand::immediateReload (void)\n{\n //CVERB << \"Immediate load\" << std::endl;\n SYNCHRONISED2(bgl);\n for (unsigned i=0 ; i<resources.size() ; ++i) {\n if (resources[i]->isLoaded()) resources[i]->reload();\n }\n}\n\n// called by main thread only\nvoid Demand::finishedWith (void)\n{\n //CVERB << \"No longer need: \" << resources << std::endl;\n\n // we could be called because a grit object is being destroyed (unusual)\n // in which case, the Demand may get destructed pretty soon\n\n // or we could also be called if the grit object is simply deactivating (hot path)\n\n // certainly do not bother continuing to load if a load is in progress\n bgl->remove(this);\n\n // consider putting the resources up for reclamation\n if (incremented) {\n for (unsigned i=0 ; i<resources.size() ; ++i) {\n resources[i]->decrement();\n }\n incremented = false;\n }\n}\n\n\nBackgroundLoader::BackgroundLoader (void)\n : mNumBastards(0), mThread(NULL), mCurrent(NULL),\n mQuit(false), mAllowance(0)\n{\n SYNCHRONISED;\n\n mThread = new std::thread((void (*)(BackgroundLoader*))thread_main,\n const_cast<BackgroundLoader*>(this));\n}\n\nBackgroundLoader::~BackgroundLoader (void)\n{\n shutdown();\n}\n\nvoid BackgroundLoader::shutdown (void)\n{\n if (mQuit) return;\n {\n SYNCHRONISED;\n mQuit = true;\n cVar.notify_one();\n }\n mThread->join();\n handleBastards();\n mDeathRowGPU.clear();\n mDeathRowHost.clear();\n mDemands.clear();\n delete mThread;\n}\n\n// called by main thread only\nvoid BackgroundLoader::add (Demand *d)\n{\n SYNCHRONISED;\n mDemands.push_back(d);\n d->mInBackgroundQueue = true;\n d->causedError = false;\n cVar.notify_one();\n}\n\n// called by main thread only\nvoid BackgroundLoader::remove (Demand *d)\n{\n SYNCHRONISED;\n if (!d->mInBackgroundQueue) return;\n mDemands.erase(d);\n //CVERB << \"Retracted demand.\" << std::endl;\n if (mCurrent == d) {\n //CVERB << \"making a bastard...\" << std::endl;\n mCurrent = NULL;\n }\n d->mInBackgroundQueue = false;\n} \n\nvoid BackgroundLoader::handleBastards (void)\n{\n // access volatile field without taking lock first\n // worst case we return early, i.e. will pick up bastards next time\n if (mNumBastards == 0) return;\n DiskResources s;\n {\n SYNCHRONISED;\n if (mNumBastards == 0) return;\n s = mBastards;\n mBastards.clear();\n mNumBastards = 0;\n }\n\n for (unsigned i=0 ; i<s.size() ; ++i) {\n finishedWith(s[i]);\n }\n}\n\n\nvoid BackgroundLoader::thread_main (BackgroundLoader *self)\n{\n self->thread_main();\n}\n\nvoid BackgroundLoader::thread_main (void)\n{\n //APP_VERBOSE(\"BackgroundLoader: thread started\");\n DiskResources pending;\n bool caused_error = false;\n while (!mQuit) {\n {\n SYNCHRONISED;\n if (mCurrent) {\n // Usual case:\n // demand was not retracted while we were\n // processing it\n mCurrent->mInBackgroundQueue = false;\n mCurrent->causedError = caused_error;\n // cache in d to suppress compiler error\n Demand *d = mCurrent;\n mDemands.erase(d);\n mCurrent = NULL;\n } else {\n // demand was retracted, and we actually\n // loaded stuff\n // (this can also get called before the first wait,\n // in which case pending is empty)\n typedef DiskResources::const_iterator DRCI;\n for (DRCI i=pending.begin(), i_=pending.end() ; i != i_ ; ++i) {\n //CVERB << \"Poor bastard: \" << (*i)->getName() << \" (\" << (*i)->getUsers()\n // << \")\" << std::endl;\n mBastards.push_back(*i);\n mNumBastards = mBastards.size();\n }\n //asynchronously call sm.finishedWith(resource);\n }\n pending.clear();\n if (mAllowance <= 0 || !nearestDemand(mCurrent)) {\n cVar.wait(_scoped_lock);\n continue; \n }\n pending = mCurrent->resources;\n }\n //APP_VERBOSE(\"BackgroundLoader: loading: \" + name);\n caused_error = false;\n for (DiskResources::iterator i=pending.begin(), i_=pending.end() ; i != i_ ; ++i) {\n DiskResource *rp = *i;\n try {\n if (!rp->isLoaded()) {\n rp->load();\n mAllowance--;\n //CVERB << \"Loaded a resource: \" << *rp << std::endl;\n }\n } catch (Exception &e) {\n CERR << e << std::endl;\n caused_error = true;\n }\n }\n\n //mysleep(100000);\n }\n //APP_VERBOSE(\"BackgroundLoader: thread terminated\");\n}\n\n\nbool BackgroundLoader::nearestDemand (Demand * volatile &return_demand)\n{\n if (mDemands.size() == 0) return false;\n\n float closest_dist = mDemands[0]->mDist;\n Demand *rd = mDemands[0];\n\n for (unsigned i=1 ; i<mDemands.size() ; ++i) {\n\n Demand *d = mDemands[i];\n \n float this_dist = d->mDist;\n \n if (this_dist<closest_dist) {\n closest_dist = this_dist;\n rd = d;\n } \n\n } \n\n return_demand = rd;\n return true;\n}\n\nvoid BackgroundLoader::setAllowance (float m)\n{\n SYNCHRONISED;\n mAllowance = std::max(mAllowance + m, m);\n cVar.notify_one();\n}\n\n\n// unloading of resources /////////////////////////////////////////////////////////\n\nvoid BackgroundLoader::finishedWith (DiskResource *de)\n{\n if (mQuit) return;\n if (de->noUsers()) {\n if (de->isGPUResource()) {\n mDeathRowGPU.push(de); \n } else {\n mDeathRowHost.push(de); \n }\n }\n}\n\nvoid BackgroundLoader::checkRAMGPU ()\n{\n double budget = gfx_gpu_ram_available();\n\n while (true) {\n\n double usage = gfx_gpu_ram_used();\n\n if (usage < budget || mDeathRowGPU.size() == 0) break;\n\n DiskResource *r = mDeathRowGPU.pop();\n\n if (r->noUsers() && r->isLoaded()) r->unload();\n }\n}\n\nvoid BackgroundLoader::checkRAMHost ()\n{\n double budget = host_ram_available();\n\n while (true) {\n\n double usage = host_ram_used();\n\n if (usage < budget || mDeathRowHost.size() == 0) break;\n\n DiskResource *r = mDeathRowHost.pop();\n\n if (r->noUsers() && r->isLoaded())\n r->unload();\n }\n}\n" }, { "alpha_fraction": 0.5731510519981384, "alphanum_fraction": 0.574269711971283, "avg_line_length": 43.447513580322266, "blob_id": "ba611865dc48a9bf99385bf678d8df2f23316c8f", "content_id": "d8d7d696e5bdb0ca92aad381bb6dae561ccda5f6", "detected_licenses": [ "LGPL-2.1-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer", "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 8045, "license_type": "permissive", "max_line_length": 99, "num_lines": 181, "path": "/dependencies/quex-0.34.1/quex/core_engine/state_machine/origin_list.py", "repo_name": "lavrod/grit-complement", "src_encoding": "UTF-8", "text": "from copy import deepcopy\nfrom quex.core_engine.state_machine.state_core_info import StateCoreInfo\n\nclass StateOriginList:\n def __init__(self):\n self.__list = []\n\n def get_list(self):\n return self.__list\n\n def __add(self, Origin):\n \"\"\"Check if origin has already been mentioned, else append the new origin.\n \"\"\"\n if Origin in self.__list: \n idx = self.__list.index(Origin) \n self.__list[idx] = Origin\n else: \n self.__list.append(Origin)\n\n def add(self, X, StateIndex, StoreInputPositionF=False, SelfAcceptanceF=False):\n \"\"\"Add the StateMachineID and the given StateIdx to the list of origins of \n this state.\n NOTE: The rule is that by default the 'store_input_position_f' flag\n follows the acceptance state flag (i.e. by default any acceptance\n state stores the input position). Thus when an origin is added\n to a state that is an acceptance state, the 'store_input_position_f'\n has to be raised for all incoming origins. \n \"\"\"\n assert type(X) == long or X.__class__ == StateCoreInfo\n assert type(StateIndex) == long\n \n # -- entry checks \n if X.__class__ == StateCoreInfo:\n self.__add(deepcopy(X))\n else:\n # -- create the origin data structure (X = state machine id)\n if StoreInputPositionF == None: StoreInputPositionF = SelfAcceptanceF\n self.__add(StateCoreInfo(StateMachineID = X, \n StateIndex = StateIndex, \n AcceptanceF = SelfAcceptanceF,\n StoreInputPositionF = StoreInputPositionF))\n\n def append(self, OriginList, StoreInputPositionFollowsAcceptanceF, SelfAcceptanceF):\n \"\"\"Add list of origins. Optional argument tells wether\n the 'store_input_position_f' shall adapt to the acceptance of self, or\n the acceptance of the origin list is to be copied.\n \"\"\"\n if StoreInputPositionFollowsAcceptanceF: \n for origin in OriginList:\n self.add(origin.state_machine_id, origin.state_index, \n StoreInputPositionF=self.is_acceptance())\n else:\n for origin in OriginList: self.__add(origin)\n\n def clear(self):\n self.__list = []\n\n def set(self, OriginList, ArgumentIsYoursF=False):\n assert type(OriginList) == list\n if ArgumentIsYoursF: self.__list = OriginList\n else: self.__list = deepcopy(OriginList)\n\n def is_empty(self):\n return self.__list == []\n\n def is_from_single_state(self, StateMachineID, StateIdx):\n if len(self.__list) != 1: return False\n if self.__list[0].state_machine_id != StateMachineID: return False\n if self.__list[0].state_index != StateIdx: return False\n return True\n\n def contains_post_context_flag(self):\n for origin in self.__list:\n if origin.post_context_id() != -1L: return True\n return False \n\n def contains_store_input_position(self):\n for origin in self.__list:\n if origin.store_input_position_f() == True: return True\n return False\n\n def contains_any_pre_context_dependency(self):\n for origin in self.__list:\n if origin.pre_context_id() != -1L: return True\n if origin.pre_context_begin_of_line_f(): return True\n return False \n\n def contains_pre_context_id(self):\n for origin in self.__list:\n if origin.pre_context_id() != -1L: return True\n return False \n\n def contains_pre_context_begin_of_line(self):\n for origin in self.__list:\n if origin.pre_context_begin_of_line_f(): return True\n return False \n\n def adapt(self, StateMachineID, StateIndex):\n \"\"\"Adapts all origins so that their original state is 'StateIndex' in state machine\n 'StateMachineID'. Post- and pre-condition flags remain, and so the store input \n position flag.\n \"\"\"\n for origin in self.__list:\n origin.state_machine_id = StateMachineID\n origin.state_index = StateIndex \n\n def find_first_acceptance_origin(self):\n \"\"\"Returns first origin which refers to an acceptance state. \n Note, that this only makes sense if the list is sorted.\n\n Returns 'None' if no acceptance origin has been found.\n \"\"\"\n for origin in self.get_list():\n if origin.is_acceptance():\n return origin\n else:\n return None\n\n def delete_meaningless(self):\n \"\"\"Deletes origins that are not concerned with one of the three:\n -- post-conditions\n -- pre-conditions/also trivials\n -- store input positions\n\n NOTE: This function is only to be used for single patterns not for\n combined state machines. During the NFA to DFA translation\n more than one state is combined into one. This maybe reflected\n in the origin list. However, only at the point when the \n pattern state machine is ready, then the origin states are something\n meaningful. The other information has to be kept.\n \n NOTE: After applying this fuction to a single pattern, there should only\n be one origin for each state.\n \"\"\"\n self.__list = filter(lambda origin:\n origin.post_contexted_acceptance_f() or\n origin.pre_context_id() != -1L or\n origin.store_input_position_f() or\n origin.pre_context_begin_of_line_f(),\n self.__list)\n\n def delete_dominated(self):\n \"\"\"This function is a simplification in order to allow the Hopcroft Minimization\n to be more efficient. It 'simulates' the code generation where the first unconditional\n pattern matches. The remaining origins of a state are redundant.\n\n This function is to be seen in analogy with the function 'get_acceptance_detector'. \n Except for the fact that it requires the 'end of core pattern' markers of post\n conditioned patterns. If the markers are not set, the store input position commands\n are not called properly, and when restoring the input position bad bad things happen \n ... i.e. segmentation faults.\n \"\"\"\n # NOTE: Acceptance origins sort before non-acceptance origins\n self.__list.sort()\n new_origin_list = []\n unconditional_acceptance_found_f = False\n for origin in self.__list:\n\n if origin.is_acceptance():\n # Only append acceptance origins until the first unconditional acceptance state \n # is found. \n if not unconditional_acceptance_found_f:\n if origin.pre_context_id() == -1L and not origin.pre_context_begin_of_line_f():\n unconditional_acceptance_found_f = True # prevent entering this part again\n new_origin_list.append(origin)\n\n else:\n # Non-Acceptance origins do not harm in any way. Actually, the origins\n # with 'origin.is_end_of_post_contexted_core_pattern() == True' **need**\n # to be in there. See the comment at the entry of this function.\n new_origin_list.append(origin)\n\n self.__list = new_origin_list \n\n def get_string(self):\n txt = \" <~ \"\n if self.__list == []: return txt + \"\\n\"\n for origin in self.__list:\n txt += repr(origin) + \", \"\n txt = (txt[:-2] + \"\\n\").replace(\"L\",\"\") \n return txt\n" } ]
332
peppermin-t/Neural-Variational-Knowledge-Graphs
https://github.com/peppermin-t/Neural-Variational-Knowledge-Graphs
b592a9e13f1b9e90fd040fa7e87bccaa3eba5ad4
e43d3a0243f800ad82067ee6d6cafe80f9a53107
163586ae17333ae11b68ac8669a55cbdf6c2b393
refs/heads/master
2023-03-28T02:15:03.542967
2019-05-16T14:46:18
2019-05-16T14:46:18
null
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.657745361328125, "alphanum_fraction": 0.6674776673316956, "avg_line_length": 33.22222137451172, "blob_id": "a8ed581af78b74b9217502cd0231dcfb5422e894", "content_id": "2e2f503290fa8f0b9e2941a4c331b3fab17fa0e5", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1233, "license_type": "permissive", "max_line_length": 122, "num_lines": 36, "path": "/setup.py", "repo_name": "peppermin-t/Neural-Variational-Knowledge-Graphs", "src_encoding": "UTF-8", "text": "\nimport os\nfrom setuptools import setup\nfrom setuptools import find_packages\n\nsetup(\n name='hyperspherical_vae',\n version='0.1.1',\n author='Nicola De Cao, Tim R. Davidson, Luca Falorsi',\n author_email='nicola.decao@gmail.com',\n description='Tensorflow implementation of Hyperspherical Variational Auto-Encoders',\n license='MIT',\n keywords='tensorflow vae variational-auto-encoder von-mises-fisher machine-learning deep-learning manifold-learning',\n url='https://nicola-decao.github.io/s-vae-tf/',\n download_url='https://github.com/nicola-decao/SVAE',\n long_description=open(os.path.join(os.path.dirname(__file__), 'README.md')).read(),\n install_requires=['numpy', 'tensorflow>=1.7.0', 'scipy'],\n packages=find_packages()\n)\n\n# -*- coding: utf-8 -*-\n\nwith open('requirements.txt', 'r') as f:\n requirements = f.readlines()\n\nsetup(name='VKGE',\n version='0.1.0',\n description='Variational Embeddings of Knowledge Graphs',\n author='Pasquale Minervini',\n author_email='mc_rivers@icloud.com',\n url='https://github.com/acr42/vkge',\n test_suite='tests',\n license='MIT',\n install_requires=requirements,\n setup_requires=['pytest-runner'] + requirements,\n tests_require=requirements,\n packages=find_packages())\n" }, { "alpha_fraction": 0.8275862336158752, "alphanum_fraction": 0.8275862336158752, "avg_line_length": 8.666666984558105, "blob_id": "39fc90028e5f5f8fee7a94508b082cfc757c4294", "content_id": "c5b325a68b92c1c2e729f9b1d586447d5d14a732", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Text", "length_bytes": 29, "license_type": "permissive", "max_line_length": 11, "num_lines": 3, "path": "/requirements.txt", "repo_name": "peppermin-t/Neural-Variational-Knowledge-Graphs", "src_encoding": "UTF-8", "text": "numpy\ntf-nightly\ntfp-nightly\n" }, { "alpha_fraction": 0.621515154838562, "alphanum_fraction": 0.6242424249649048, "avg_line_length": 39.74074172973633, "blob_id": "63800f3290315d9d5bf1b481398d7f3e33ed066e", "content_id": "7068d5640525ef2e7ce2559ab643ae19797cdf2b", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3300, "license_type": "permissive", "max_line_length": 114, "num_lines": 81, "path": "/vkge/knowledgebase/base.py", "repo_name": "peppermin-t/Neural-Variational-Knowledge-Graphs", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n\n\nclass Fact:\n def __init__(self, predicate_name, argument_names):\n self.predicate_name = predicate_name\n self.argument_names = argument_names\n\n def __str__(self):\n return '{0!s}({1!s})'.format(repr(self.predicate_name), repr(self.argument_names))\n\n def __repr__(self):\n return '<Fact {0!r}({1!r})>'.format(repr(self.predicate_name), repr(self.argument_names))\n\n def __eq__(self, other):\n res = False\n if isinstance(other, Fact):\n res = (self.predicate_name == other.predicate_name) and (self.argument_names == other.argument_names)\n return res\n\n def __ne__(self, other):\n return not self.__eq__(other)\n\n def __hash__(self):\n return hash((self.predicate_name, tuple(self.argument_names)))\n\n\nclass KnowledgeBaseParser:\n def __init__(self, facts):\n self.entity_vocabulary, self.predicate_vocabulary = set(), set()\n\n for fact in facts:\n self.predicate_vocabulary.add(fact.predicate_name)\n for arg in fact.argument_names:\n self.entity_vocabulary.add(arg)\n\n self.entity_to_index, self.predicate_to_index = KnowledgeBaseParser._fit(self.entity_vocabulary,\n self.predicate_vocabulary)\n\n self.index_to_entity = {idx: e for e, idx in self.entity_to_index.items()}\n self.index_to_predicate = {idx: p for p, idx in self.predicate_to_index.items()}\n\n @staticmethod\n def _fit(entity_vocabulary, predicate_vocabulary):\n \"\"\"\n Required before using facts_to_sequences\n :param facts: List or generator of facts.\n :return:\n \"\"\"\n sorted_ent_lst = sorted(entity_vocabulary)\n sorted_pred_lst = sorted(predicate_vocabulary)\n\n # We start enumerating entities and predicates starting from index 1, and leave 0 for the <UNKNOWN> symbol\n entity_index = {entity: idx for idx, entity in enumerate(sorted_ent_lst, start=1)}\n predicate_index = {predicate: idx for idx, predicate in enumerate(sorted_pred_lst, start=1)}\n\n return entity_index, predicate_index\n\n def facts_to_sequences(self, facts):\n \"\"\"\n Transform each fact in facts as a sequence of symbol indexes.\n Only top 'nb_symbols' most frequent symbols will be taken into account.\n Returns a list of sequences.\n :param facts: lists of symbols.\n :return: list of individual sequences of indexes\n \"\"\"\n return [indices for indices in self.facts_to_sequences_generator(facts)]\n\n def facts_to_sequences_generator(self, facts):\n \"\"\"\n Transform each fact in facts as a pair (predicate_idx, argument_idxs),\n where predicate_idx is the index of the predicate, and argument_idxs is a list\n of indices associated to the arguments of the predicate.\n Yields individual pairs.\n :param facts: lists of facts.\n :return: yields individual (predicate_idx, argument_idxs) pairs.\n \"\"\"\n for fact in facts:\n predicate_idx = self.predicate_to_index[fact.predicate_name]\n argument_idxs = [self.entity_to_index[arg] for arg in fact.argument_names]\n yield (predicate_idx, argument_idxs)\n" }, { "alpha_fraction": 0.656521737575531, "alphanum_fraction": 0.6608695387840271, "avg_line_length": 30.94444465637207, "blob_id": "6274cd77b6bd810a931d2aee177ff6ecfacdb1c2", "content_id": "61189536a3748298c42b2c055651811d77ac12f2", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1150, "license_type": "permissive", "max_line_length": 98, "num_lines": 36, "path": "/vkge/training/index.py", "repo_name": "peppermin-t/Neural-Variational-Knowledge-Graphs", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n\nimport abc\nimport numpy as np\n\n\nclass AIndexGenerator(metaclass=abc.ABCMeta):\n @abc.abstractmethod\n def __call__(self, n_samples, indices):\n while False:\n yield None\n\n\nclass UniformIndexGenerator(AIndexGenerator):\n def __init__(self, random_state=None):\n self.random_state = random_state if random_state is not None else np.random.RandomState(0)\n\n def __call__(self, n_samples, indices):\n if isinstance(indices, list):\n indices = np.array(indices)\n\n rand_ints = self.random_state.random_integers(0, indices.size - 1, n_samples)\n return indices[rand_ints]\n\n\nclass GlorotIndexGenerator(AIndexGenerator):\n def __init__(self, random_state=None):\n self.random_state = random_state if random_state is not None else np.random.RandomState(0)\n\n def __call__(self, n_samples, indices):\n if isinstance(indices, list):\n indices = np.array(indices)\n\n shuffled_indices = indices[self.random_state.permutation(len(indices))]\n rand_ints = shuffled_indices[np.arange(n_samples) % len(shuffled_indices)]\n return rand_ints\n" }, { "alpha_fraction": 0.6537313461303711, "alphanum_fraction": 0.6567164063453674, "avg_line_length": 30.904762268066406, "blob_id": "1e13d0bc51f61174648bb4cab8a4a58713414785", "content_id": "d5681478f381b6acfd012511b0ab86399065d53c", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 670, "license_type": "permissive", "max_line_length": 89, "num_lines": 21, "path": "/vkge/training/corrupt.py", "repo_name": "peppermin-t/Neural-Variational-Knowledge-Graphs", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n\nimport abc\nimport numpy as np\n\n\nclass ACorruptor(metaclass=abc.ABCMeta):\n @abc.abstractmethod\n def __call__(self, Xs, Xp, Xo):\n raise NotImplementedError\n\n\nclass SimpleCorruptor(ACorruptor):\n def __init__(self, index_generator=None, candidate_indices=None, corr_obj=False):\n self.index_generator, self.candidate_indices = index_generator, candidate_indices\n self.corr_obj = corr_obj\n\n def __call__(self, Xs, Xp, Xo):\n neg_Xe = np.copy(Xs)\n neg_Xe[:] = self.index_generator(Xs.shape[0], self.candidate_indices)\n return (Xs if self.corr_obj else neg_Xe), Xp, (neg_Xe if self.corr_obj else Xo)\n" }, { "alpha_fraction": 0.6846153736114502, "alphanum_fraction": 0.692307710647583, "avg_line_length": 25, "blob_id": "2694f2ab0ca7a22b604c66db7bd39e8fc55c7418", "content_id": "95852d2d0b38074bf5eadd3b4da08be84461142f", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 130, "license_type": "permissive", "max_line_length": 61, "num_lines": 5, "path": "/vkge/knowledgebase/__init__.py", "repo_name": "peppermin-t/Neural-Variational-Knowledge-Graphs", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n\nfrom vkge.knowledgebase.base import Fact, KnowledgeBaseParser\n\n__all__ = ['Fact', 'KnowledgeBaseParser']\n" }, { "alpha_fraction": 0.694915235042572, "alphanum_fraction": 0.700564980506897, "avg_line_length": 34.400001525878906, "blob_id": "829c96c23acde8e7cee672d41ab591147cc1592e", "content_id": "52c03a2a5c98f6bd4427fddfd6dd028699df1c2a", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 177, "license_type": "permissive", "max_line_length": 72, "num_lines": 5, "path": "/vkge/__init__.py", "repo_name": "peppermin-t/Neural-Variational-Knowledge-Graphs", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\nfrom vkge.LIM import LIM,LFM\n# from vkge.LFM import LFM\nfrom vkge.training.util import make_batches,read_triples,IndexGenerator\n__all__ = ['LFM','LIM']\n" }, { "alpha_fraction": 0.6723454594612122, "alphanum_fraction": 0.6988906264305115, "avg_line_length": 26.736263275146484, "blob_id": "c9c1f2cb1680a9644bd1b5577321973c028c75f7", "content_id": "d830ad0b46b46e464db2eb2f8a8c7ba553c5edab", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 2524, "license_type": "permissive", "max_line_length": 483, "num_lines": 91, "path": "/README.md", "repo_name": "peppermin-t/Neural-Variational-Knowledge-Graphs", "src_encoding": "UTF-8", "text": "# Neural-Variational-Knowledge-Graphs\n\n## Overview\n\nThis library contains a Tensorflow implementation of the Laten Fact Model and Latent Information model for Gaussian and Von-Mises Fisher latent priors, using the re-parametrisation trick to learn the distributional parameters. The VMF re-parametrisation trick is as presented in [[1]](#citation)(http://arxiv.org/abs/1804.00891). Check out the authors of VMF blogpost (https://nicola-decao.github.io/s-vae). The Gaussian re-parametrisation trick is a Tensorflow probability function.\n\n-------\n\n![From paper](https://i.imgur.com/oloQTPQ.png)\n\n## Dependencies\n\n* **python>=3.6**\n* **tf-nightly*: https://tensorflow.org\n* **tfp-nightly*: https://www.tensorflow.org/probability/\n* **scipy**: https://scipy.org\n\n## Installation\n\nTo install, run\n\n```bash\n$ python setup.py install\n```\n\n## Structure\n\n-------\n## CONTRIBUTERS:\n\n- Alexander Cowen-Rivers ([GitHub](https://github.com/acr42))\n\n## Supervisors:\n\n- Pasquale Minervini ([GitHub](https://github.com/pminervini))\n- Sebastian Riedel ([GitHub](https://github.com/riedelcastro))\n\n-------\n\n## Instructions\n\nFor:\n- **Models** see [Latent Fact Model](https://github.com/acr42/Neural-Variational-Knowledge-Graphs/blob/master/vkge/LFM.py) and [Latent Information Model](https://github.com/acr42/Neural-Variational-Knowledge-Graphs/blob/master/vkge/LIM.py)\n- **Paper** see [ACR](https://github.com/acr42/)\n\n-------\n\n## Training Models\n\nTrain variational knowledge graph model, on nations dataset with normal prior using DistMult scoring function :\n\n```\npython main_LIM.py --no_batches 10 --epsilon 1e-07 --embedding_size 50 --dataset nations --alt_prior False --lr 0.001 --score_func DistMult --negsamples 5 --projection False --distribution normal --file_name /User --s_o False\n```\n-------\n\n## Usage\n\n1. Clone or download this repository.\n2. Prepare your data, or use any of the six included KG datasets.\n\n## Usage\n\nPlease cite [[1](#citation)] and [[2](#citation)] in your work when using this library in your experiments.\n\n## Feedback\nFor questions and comments, feel free to contact [ACR](https://github.com/acr42)(mailto:mc_rivers@icloud.com).\n\n## License\nMIT\n\n## Citation\n```\n[1] Davidson, T. R., Falorsi, L., De Cao, N., Kipf, T.,\nand Tomczak, J. M. (2018). Hyperspherical Variational\nAuto-Encoders. arXiv preprint arXiv:1804.00891.\n```\n\nBibTeX format:\n```\n@article{s-vae18,\n title={Hyperspherical Variational Auto-Encoders},\n author={Davidson, Tim R. and\n Falorsi, Luca and\n De Cao, Nicola and\n Kipf, Thomas and\n Tomczak, Jakub M.},\n journal={arXiv preprint arXiv:1804.00891},\n year={2018}\n}\n```\n" }, { "alpha_fraction": 0.6573643684387207, "alphanum_fraction": 0.669767439365387, "avg_line_length": 27.66666603088379, "blob_id": "a7328bfad72437fad921c08250dde75ba26a3fbe", "content_id": "e8de8d1636353e6ac53dd23907f7652bc60cc831", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1290, "license_type": "permissive", "max_line_length": 108, "num_lines": 45, "path": "/vkge/training/losses.py", "repo_name": "peppermin-t/Neural-Variational-Knowledge-Graphs", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n\nimport tensorflow as tf\nimport sys\n\n\ndef logistic_loss(scores, targets):\n \"\"\"\n Logistic loss as used in [1]\n\n [1] http://jmlr.org/proceedings/papers/v48/trouillon16.pdf\n\n :param scores: (N,) Tensor containing scores of examples.\n :param targets: (N,) Tensor containing {0, 1} targets of examples.\n :return: Loss value.\n \"\"\"\n logistic_losses = tf.nn.sigmoid_cross_entropy_with_logits(logits=scores, labels=targets)\n loss = tf.reduce_sum(logistic_losses)\n return loss\n\n\ndef hinge_loss(scores, targets, margin=1):\n \"\"\"\n Hinge loss.\n :param scores: (N,) Tensor containing scores of examples.\n :param targets: (N,) Tensor containing {0, 1} targets of examples.\n :param margin: float representing the margin in the hinge loss relu(margin - logits * (2 * targets - 1))\n :return: Loss value.\n \"\"\"\n hinge_losses = tf.nn.relu(margin - scores * (2 * targets - 1))\n\n loss = tf.reduce_sum(hinge_losses)\n return loss\n\n\n# Aliases\nlogistic = logistic_loss\nhinge = hinge_loss\n\n\ndef get_function(function_name):\n this_module = sys.modules[__name__]\n if not hasattr(this_module, function_name):\n raise ValueError('Unknown loss function: {}'.format(function_name))\n return getattr(this_module, function_name)\n" }, { "alpha_fraction": 0.5145891308784485, "alphanum_fraction": 0.5240916609764099, "avg_line_length": 34.784000396728516, "blob_id": "2a31f9d526a48fbd578a616c0d937e93d2704d34", "content_id": "fc3c0afd2dba9eb4779e3eefe5a8771123e5582c", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 8946, "license_type": "permissive", "max_line_length": 128, "num_lines": 250, "path": "/vkge/training/util.py", "repo_name": "peppermin-t/Neural-Variational-Knowledge-Graphs", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n\nimport numpy as np\nimport tensorflow as tf\nfrom hyperspherical_vae.distributions import VonMisesFisher\nfrom hyperspherical_vae.distributions import HypersphericalUniform\nimport vkge.models as models\nimport tensorflow_probability as tfp\ntfd = tfp.distributions\n\ndef read_triples(path):\n triples = []\n with open(path, 'rt') as f:\n for line in f.readlines():\n s, p, o = line.split()\n triples += [(s.strip(), p.strip(), o.strip())]\n return triples\n\ndef make_batches(size, batch_size):\n nb_batch = int(np.ceil(size / float(batch_size)))\n res = [(i * batch_size, min(size, (i + 1) * batch_size)) for i in range(0, nb_batch)]\n return res\n\n\nclass IndexGenerator:\n def __init__(self):\n self.random_state = np.random.RandomState(0)\n\n def __call__(self, n_samples, candidate_indices):\n shuffled_indices = candidate_indices[self.random_state.permutation(len(candidate_indices))]\n rand_ints = shuffled_indices[np.arange(n_samples) % len(shuffled_indices)]\n return rand_ints\n\ndef distribution_scale(log_sigma_square):\n \"\"\"\n Returns the scale (std dev) from embeddings for tensorflow distributions MultivariateNormalDiag function\n \"\"\"\n\n scale = tf.sqrt(tf.exp(log_sigma_square))\n\n return scale\n\ndef make_prior(code_size,distribution,alt_prior):\n \"\"\"\n Returns the prior on embeddings for tensorflow distributions\n\n (i) MultivariateNormalDiag function\n\n (ii) HypersphericalUniform\n\n with alternative prior on gaussian\n\n (1) Alt: N(0,1/code_size)\n (2) N(0,1)\n \"\"\"\n\n if distribution == 'normal':\n if alt_prior: #alternative prior 0,1/embeddings variance\n loc = tf.zeros(code_size)\n scale = tf.sqrt(tf.divide(tf.ones(code_size),code_size))\n\n else:\n loc = tf.zeros(code_size)\n scale = tf.ones(code_size)\n\n dist=tfd.MultivariateNormalDiag(loc, scale)\n\n elif distribution == 'vmf':\n\n dist=HypersphericalUniform(code_size - 1, dtype=tf.float32)\n\n else:\n raise NotImplemented\n\n return dist\n\n\ndef make_latent_variables(meaninit,siginit,nb_variables,embedding_size,distribution,vtype):\n \"\"\"\n Returns the mean and scale embedding matrix\n \"\"\"\n \n emd_mean_name=vtype+'_mean'\n emd_sig_name=vtype+'_sigma'\n\n if distribution == 'vmf':\n #almost initialise scale to 0\n scale_max = np.log(1e-8) \n\n else:\n scale_max = np.log((1.0 / embedding_size * 1.0) + 1e-10)\n\n sigmax = np.round(scale_max, decimals=2)\n\n if meaninit=='ru':\n\n embedding_mean = tf.get_variable(emd_mean_name,\n shape=[nb_variables + 1, embedding_size],\n initializer=tf.random_uniform_initializer(\n minval=-0.001,\n maxval=0.001,\n dtype=tf.float32))\n\n else:\n\n embedding_mean = tf.get_variable(emd_mean_name, shape=[nb_variables + 1, embedding_size],\n initializer=tf.contrib.layers.xavier_initializer())\n\n if siginit=='ru' and distribution == 'normal':\n\n\n embedding_sigma = tf.get_variable(emd_sig_name,\n shape=[nb_variables + 1, embedding_size],\n initializer=tf.random_uniform_initializer(\n minval=0, maxval=sigmax, dtype=tf.float32),\n dtype=tf.float32)\n\n if (siginit != 'ru') and distribution == 'normal':\n\n embedding_sigma = tf.get_variable(emd_sig_name,\n shape=[nb_variables + 1, embedding_size],\n initializer=tf.random_uniform_initializer(\n minval=sigmax, maxval=sigmax, dtype=tf.float32),\n dtype=tf.float32)\n\n if distribution == 'vmf':\n\n embedding_sigma = tf.get_variable(emd_sig_name,\n shape=[nb_variables + 1, 1],\n initializer=tf.random_uniform_initializer(\n minval=sigmax, maxval=sigmax, dtype=tf.float32),\n dtype=tf.float32)\n\n if distribution not in ['vmf','normal']:\n raise NotImplemented\n\n return embedding_mean,embedding_sigma\n\n\ndef get_latent_distributions(distribution,mu_s,mu_p,mu_o,log_sigma_sq_s,log_sigma_sq_p,log_sigma_sq_o):\n \"\"\"\n Returns tf distributions for the generative network \n \"\"\"\n\n if distribution == 'normal':\n\n # sample from mean and std of the normal distribution\n\n q_s = tfd.MultivariateNormalDiag(mu_s, distribution_scale(log_sigma_sq_s))\n q_p = tfd.MultivariateNormalDiag(mu_p, distribution_scale(log_sigma_sq_p))\n q_o = tfd.MultivariateNormalDiag(mu_o, distribution_scale(log_sigma_sq_o))\n\n\n\n elif distribution == 'vmf':\n\n # sample from mean and concentration of the von Mises-Fisher\n\n # '+1' used to prevent collapsing behaviors\n\n q_s = VonMisesFisher(mu_s, distribution_scale(log_sigma_sq_s) + 1)\n q_p = VonMisesFisher(mu_p, distribution_scale(log_sigma_sq_p) + 1)\n q_o = VonMisesFisher(mu_o, distribution_scale(log_sigma_sq_o) + 1)\n\n\n\n else:\n raise NotImplemented\n\n return q_s,q_p,q_o\n\n\n\ndef get_scoring_func(score_func,distribution,h_s,h_p,h_o,mu_s,mu_p,mu_o):\n \"\"\"\n Returns scoring function for training and testing \n \"\"\"\n\n if score_func == 'DistMult':\n\n model = models.BilinearDiagonalModel(subject_embeddings=h_s, predicate_embeddings=h_p,\n object_embeddings=h_o)\n\n if distribution == 'normal':\n\n model_test = models.BilinearDiagonalModel(subject_embeddings=mu_s, predicate_embeddings=mu_p,\n object_embeddings=mu_o)\n\n elif distribution == 'vmf':\n\n model_test = models.BilinearDiagonalModel(subject_embeddings=mu_s,\n predicate_embeddings=mu_p,\n object_embeddings=mu_o)\n\n elif score_func == 'ComplEx':\n model = models.ComplexModel(subject_embeddings=h_s, predicate_embeddings=h_p,\n object_embeddings=h_o)\n\n if distribution == 'normal':\n\n model_test = models.ComplexModel(subject_embeddings=mu_s, predicate_embeddings=mu_p,\n object_embeddings=mu_o)\n\n elif distribution == 'vmf':\n\n model_test = models.ComplexModel(subject_embeddings=tf.nn.l2_normalize(mu_s, axis=-1),\n predicate_embeddings=tf.nn.l2_normalize(mu_p, axis=-1),\n object_embeddings=tf.nn.l2_normalize(mu_o, axis=-1))\n\n elif score_func == 'TransE':\n model = models.TranslatingModel(subject_embeddings=h_s, predicate_embeddings=h_p,\n object_embeddings=h_o)\n if distribution == 'normal':\n model_test = models.TranslatingModel(subject_embeddings=mu_s, predicate_embeddings=mu_p,\n object_embeddings=mu_o)\n\n elif distribution == 'vmf':\n model_test = models.TranslatingModel(subject_embeddings=tf.nn.l2_normalize(mu_s, axis=-1),\n predicate_embeddings=tf.nn.l2_normalize(mu_p, axis=-1),\n object_embeddings=tf.nn.l2_normalize(mu_o, axis=-1))\n else:\n raise NotImplemented\n\n return model,model_test\n\n\n\n\ndef make_compression_cost(nb_batches):\n \"\"\"\n Returns compression cost coefficient vector\n \"\"\"\n\n M = int(nb_batches)\n\n pi_s = np.log(2.0) * (M - 1)\n pi_e = np.log(2.0)\n\n pi_t = np.exp(np.linspace(pi_s, pi_e, M) - M * np.log(2.0))\n\n pi = (1 / np.sum(pi_t)) * pi_t # normalise pi\n\n return pi\n\ndef stats(values):\n \"\"\"\n Return mean and variance statistics\n \"\"\"\n\n return ('{0:.4f} ± {1:.4f}'.format(round(np.mean(values), 4), round(np.std(values), 4)))" }, { "alpha_fraction": 0.7144563794136047, "alphanum_fraction": 0.7317801713943481, "avg_line_length": 51.34375, "blob_id": "aaeb89f2ea3c97f6f2ddb5877bcf1a0258f465e6", "content_id": "38cf2426d80944684aa365c1838c98612eb02f84", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1674, "license_type": "permissive", "max_line_length": 184, "num_lines": 32, "path": "/main_LFM.py", "repo_name": "peppermin-t/Neural-Variational-Knowledge-Graphs", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n\nimport tensorflow as tf\nimport vkge\nimport logging\n\nlogger = logging.getLogger(__name__)\n\nflags = tf.app.flags\nflags.DEFINE_float(\"epsilon\", 1e-7, \"Adam optimiser epsilon decay rate [1e-7]\")\nflags.DEFINE_integer(\"embedding_size\", 300, \"The dimension of graph embeddings [300]\")\nflags.DEFINE_string(\"file_name\", '~/', \"file name for tensorboard file ['--']\")\nflags.DEFINE_integer(\"no_batches\", 10, \"Number of batches [10]\")\nflags.DEFINE_string(\"dataset\", 'wn18', \"Determines the Knowledge Base dataset [wn18]\")\nflags.DEFINE_boolean(\"projection\", False, \"Alternate between using a projection to constrain variance embedding to sum to one [False]\")\nflags.DEFINE_boolean(\"alt_prior\", False, \"Define the use of unit prior or alternative [False]\")\nflags.DEFINE_string(\"score_func\", 'DistMult', \"Defines score function: DistMult, ComplEx or TransE [DistMult]\")\nflags.DEFINE_string(\"distribution\", 'normal', \"Defines the distribution, either 'normal' or 'vmf', which is von-Mises Fisher distribution\")\nflags.DEFINE_float(\"lr\", 0.001, \"Learning rate for optimiser [0.001]\")\nflags.DEFINE_boolean(\"s_o\", True, \"If subject and object have different embeddings [True]\")\nflags.DEFINE_integer(\"negsamples\", 1, \"Number of negative samples [1]\")\nFLAGS = flags.FLAGS\n\n\ndef main(_):\n\n vkge.LFM(embedding_size=FLAGS.embedding_size,distribution=FLAGS.distribution, epsilon=FLAGS.epsilon, no_batches=FLAGS.no_batches,dataset=FLAGS.dataset, negsamples=FLAGS.negsamples,\n lr=FLAGS.lr, file_name=FLAGS.file_name, alt_prior=FLAGS.alt_prior, projection=FLAGS.projection, score_func=FLAGS.score_func,s_o=FLAGS.s_o)\n\n\nif __name__ == '__main__':\n tf.app.run()" }, { "alpha_fraction": 0.718421995639801, "alphanum_fraction": 0.7274701595306396, "avg_line_length": 39.043479919433594, "blob_id": "49741cef590dc4365ccaa3e9b37887efc11931e9", "content_id": "e62d96106996add21157faa33e1969be8dd45dd4", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2763, "license_type": "permissive", "max_line_length": 104, "num_lines": 69, "path": "/vkge/training/constraints.py", "repo_name": "peppermin-t/Neural-Variational-Knowledge-Graphs", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n\nimport sys\nimport tensorflow as tf\ndef renorm_update_var(log_var_matrix, norm=1.0, axis=0):\n #limits each variance vector having a spherical norm of greater than one -- unit variance.\n #first transform to origingal variance representation\n var_matrix=tf.exp(log_var_matrix)\n #norm sphere\n row_norms = tf.reduce_sum(var_matrix, axis=axis)\n scaled = var_matrix * tf.expand_dims(norm / row_norms, axis=axis)\n #transform back\n scaled=tf.log(scaled)\n return tf.assign(log_var_matrix, scaled)\n\ndef renorm_update_clip(log_var_matrix, norm=1.0, axis=0):\n #limits each variance vector having a spherical variance of greater than one, spherical covariance .\n #first transform to origingal variance representation\n var_matrix=tf.exp(log_var_matrix)\n #norm sphere\n scaled=tf.clip_by_norm(var_matrix,1.0,axes=1)\n scaled=tf.log(scaled)\n return tf.assign(log_var_matrix, scaled)\n\ndef renorm_unitvariance(log_var_matrix, norm=1.0, axis=0):\n #limits each variance vector having a spherical norm of greater than one -- unit variance.\n #first transform to origingal variance representation\n var_matrix=tf.sqrt(tf.exp(log_var_matrix))\n #norm sphere\n scaled=tf.clip_by_norm(var_matrix,1.0,axes=1)\n scaled=tf.log(scaled**2)\n return tf.assign(log_var_matrix, scaled)\n\n\ndef renorm_update(var_matrix, norm=1.0, axis=1):\n row_norms = tf.sqrt(tf.reduce_sum(tf.square(var_matrix), axis=axis))\n scaled = var_matrix * tf.expand_dims(norm / row_norms, axis=axis)\n return tf.assign(var_matrix, scaled)\n\n\ndef pseudoboolean_linear_update(var_matrix):\n pseudoboolean_linear = tf.minimum(1., tf.maximum(var_matrix, 0.))\n return tf.assign(var_matrix, pseudoboolean_linear)\n\ndef renorm_cubevariance(log_var_matrix, val=1.0):\n #limits each variance vector having a spherical norm of greater than one -- unit variance.\n #first transform to origingal variance representation\n var_matrix=tf.sqrt(tf.exp(log_var_matrix))\n #norm sphere\n scaled=tf.clip_by_value(var_matrix,val)\n scaled=tf.log(scaled**2)\n return tf.assign(log_var_matrix, scaled)\n\ndef pseudoboolean_sigmoid_update(var_matrix):\n pseudoboolean_sigmoid = tf.nn.sigmoid(var_matrix)\n return tf.assign(var_matrix, pseudoboolean_sigmoid)\n\nunit_sphere_logvar=renorm_unitvariance\nunit_sphere = renorm = renorm_update\nunit_cube = pseudoboolean_linear = pseudoboolean_linear_update\nunit_cube_logvar = renorm_cubevariance\npseudoboolean_sigmoid = pseudoboolean_sigmoid_update\n\n\ndef get_function(function_name):\n this_module = sys.modules[__name__]\n if not hasattr(this_module, function_name):\n raise ValueError('Unknown constraint: {}'.format(function_name))\n return getattr(this_module, function_name)\n" }, { "alpha_fraction": 0.7030302882194519, "alphanum_fraction": 0.7060605883598328, "avg_line_length": 29, "blob_id": "8d871d0a1eefd8d06c7ec318946599e7484e4a4a", "content_id": "a17bb35c441ea9e05d555d3649b99026de87cb9f", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 330, "license_type": "permissive", "max_line_length": 50, "num_lines": 11, "path": "/vkge/models/__init__.py", "repo_name": "peppermin-t/Neural-Variational-Knowledge-Graphs", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n\nfrom vkge.models.base import TranslatingModel\nfrom vkge.models.base import BilinearDiagonalModel\nfrom vkge.models.base import BilinearModel\nfrom vkge.models.base import ComplexModel\n\n__all__ = ['TranslatingModel',\n 'BilinearDiagonalModel',\n 'BilinearModel',\n 'ComplexModel']\n" }, { "alpha_fraction": 0.5374560952186584, "alphanum_fraction": 0.5446261763572693, "avg_line_length": 46.64768600463867, "blob_id": "40656f8c0d1db92e7543de462bea8fb7d261ffda", "content_id": "411670255b6b46a788f0d04cc6c13dd2792c9aff", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 26778, "license_type": "permissive", "max_line_length": 235, "num_lines": 562, "path": "/vkge/LIM.py", "repo_name": "peppermin-t/Neural-Variational-Knowledge-Graphs", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n\nimport math\nimport numpy as np\nimport tensorflow as tf\nfrom vkge.training import constraints, index\nfrom vkge.training import util as util \nimport logging\nimport tensorflow_probability as tfp\ntfd = tfp.distributions\nlogger = logging.getLogger(__name__)\n\nclass LIM:\n \"\"\"\n Latent Information Model\n\n Initializes and trains Link Prediction Model.\n\n @param file_name: The TensorBoard file_name.\n @param embedding_size: The embedding_size for entities and predicates\n @param no_batches: The number of batches per epoch\n @param lr: The learning rate\n @param eps: The epsilon value for ADAM optimiser\n @param distribution: The prior distribution we assume generates the data\n @param dataset: The dataset which the model is trained on\n @param projection: Determines if variance embeddings constrained to sum to unit variance.\n @param alt_prior: Determines whether a normal or specific Gaussian prior is used.\n\n @type file_name: str: '/home/workspace/acowenri/tboard'\n @type embedding_size: int\n @type no_batches: int\n @type lr: float\n @type eps: float\n @type distribution: str\n @type dataset: str\n @type projection: bool\n @type alt_prior: bool\n\n \"\"\"\n\n def __init__(self, file_name, score_func='DistMult', embedding_size=200, no_batches=10, distribution='normal',\n epsilon=1e-3,negsamples=5, dataset='wn18', lr=0.001, alt_prior=False, projection=False,s_o=True):\n\n\n self.s_o=s_o\n self.nb_epochs = 500\n\n seed=np.random.randint(100,size=1)[0]\n self.random_state = np.random.RandomState(seed)\n tf.set_random_seed(seed)\n logger.warning(\"\\n \\n Using Random Seed {} \\n \\n\".format(seed))\n\n self.score_func=score_func\n self.negsamples=int(negsamples)\n self.distribution=distribution\n self.alt_prior=alt_prior\n self.projection=projection\n optimizer = tf.train.AdamOptimizer(learning_rate=lr, epsilon=epsilon)\n\n ##### dataset ######\n self.dataset_name = dataset\n logger.warning('Parsing the facts in the Knowledge Base for Dataset {}..'.format(self.dataset_name))\n train_triples = util.read_triples(\"data/{}/train.tsv\".format(self.dataset_name)) # choose dataset\n valid_triples = util.read_triples(\"data/{}/dev.tsv\".format(self.dataset_name))\n test_triples = util.read_triples(\"data/{}/test.tsv\".format(self.dataset_name))\n self.nb_examples = len(train_triples)\n all_triples = train_triples + valid_triples + test_triples\n entity_set = {s for (s, p, o) in all_triples} | {o for (s, p, o) in all_triples}\n predicate_set = {p for (s, p, o) in all_triples}\n self.entity_to_idx = {entity: idx for idx, entity in enumerate(sorted(entity_set))}\n self.predicate_to_idx = {predicate: idx for idx, predicate in enumerate(sorted(predicate_set))}\n self.nb_entities, self.nb_predicates = len(entity_set), len(predicate_set)\n\n ############## placeholders\n\n self.idx_pos = tf.placeholder(tf.int32, shape=[None])\n self.idx_neg = tf.placeholder(tf.int32, shape=[None])\n\n self.no_samples = tf.placeholder(tf.int32)\n self.s_inputs = tf.placeholder(tf.int32, shape=[None])\n self.p_inputs = tf.placeholder(tf.int32, shape=[None])\n self.o_inputs = tf.placeholder(tf.int32, shape=[None])\n self.y_inputs = tf.placeholder(tf.bool, shape=[None])\n self.KL_discount = tf.placeholder(tf.float32)\n self.ELBOBS = tf.placeholder(tf.float32)\n\n ##############\n self.build_LIM(self.nb_entities, self.nb_predicates, embedding_size,optimizer)\n\n self.train(nb_epochs=self.nb_epochs, test_triples=test_triples, valid_triples=valid_triples,embedding_size=embedding_size,\n train_triples=train_triples, no_batches=int(no_batches) , filename=str(file_name))\n\n def _setup_training(self, loss, optimizer=tf.train.AdamOptimizer):\n global_step = tf.train.get_global_step()\n if global_step is None:\n global_step = tf.train.create_global_step()\n\n gradients = optimizer.compute_gradients(loss=loss)\n train_op = optimizer.apply_gradients(gradients, global_step)\n\n self.loss = loss\n self.training_step = train_op\n\n return loss, train_op\n\n def build_encoder(self, nb_entities, nb_predicates, embedding_size):\n \"\"\"\n Constructs encoder\n \"\"\"\n logger.warning('Building Inference Networks q(h_x | x) ..{}'.format(self.score_func))\n\n with tf.variable_scope('Encoder'):\n\n with tf.variable_scope('Encoder'):\n\n if self.s_o: # subject and object different embeddings\n self.s_embedding_mean, self.s_embedding_sigma = util.make_latent_variables(meaninit='xavier',\n siginit='constant',\n nb_variables=nb_entities,\n embedding_size=embedding_size,\n distribution=self.distribution,\n vtype='subject')\n\n self.o_embedding_mean, self.o_embedding_sigma = util.make_latent_variables(meaninit='xavier',\n siginit='constant',\n nb_variables=nb_entities,\n embedding_size=embedding_size,\n distribution=self.distribution,\n vtype='object')\n\n else:\n self.entity_embedding_mean, self.entity_embedding_sigma = util.make_latent_variables(\n meaninit='xavier',\n siginit='constant',\n nb_variables=nb_entities,\n embedding_size=embedding_size,\n distribution=self.distribution,\n vtype='entities')\n\n self.predicate_embedding_mean, self.predicate_embedding_sigma = util.make_latent_variables(\n meaninit='xavier', siginit='constant', nb_variables=nb_predicates, embedding_size=embedding_size,\n distribution=self.distribution, vtype='predicates')\n\n if self.s_o:\n self.mu_s = tf.nn.embedding_lookup(self.s_embedding_mean, self.s_inputs)\n self.log_sigma_sq_s = tf.nn.embedding_lookup(self.s_embedding_sigma, self.s_inputs)\n self.mu_o = tf.nn.embedding_lookup(self.o_embedding_mean, self.o_inputs)\n self.log_sigma_sq_o = tf.nn.embedding_lookup(self.o_embedding_sigma, self.o_inputs)\n else:\n self.mu_s = tf.nn.embedding_lookup(self.entity_embedding_mean, self.s_inputs)\n self.log_sigma_sq_s = tf.nn.embedding_lookup(self.entity_embedding_sigma, self.s_inputs)\n self.mu_o = tf.nn.embedding_lookup(self.entity_embedding_mean, self.o_inputs)\n self.log_sigma_sq_o = tf.nn.embedding_lookup(self.entity_embedding_sigma, self.o_inputs)\n\n self.mu_p = tf.nn.embedding_lookup(self.predicate_embedding_mean, self.p_inputs)\n self.log_sigma_sq_p = tf.nn.embedding_lookup(self.predicate_embedding_sigma, self.p_inputs)\n\n def build_decoder(self):\n \"\"\"\n Constructs Decoder\n \"\"\"\n logger.warning('Building Inference Network p(y|h) for {} score function.'.format(self.score_func))\n\n with tf.variable_scope('Inference'):\n\n self.q_s, self.q_p, self.q_o=util.get_latent_distributions(self.distribution, self.mu_s, self.mu_p,self.mu_o, self.log_sigma_sq_s, self.log_sigma_sq_p, self.log_sigma_sq_o)\n\n self.h_s = self.q_s.sample()\n self.h_p = self.q_p.sample()\n self.h_o = self.q_o.sample()\n\n model, model_test=util.get_scoring_func(self.score_func, self.distribution, self.h_s, self.h_p, self.h_o, self.mu_s, self.mu_p, self.mu_o)\n\n self.scores = model()\n self.scores_test = model_test()\n self.p_x_i = tf.sigmoid(self.scores)\n self.p_x_i_test = tf.sigmoid(self.scores_test)\n\n def build_LIM(self, nb_entities, nb_predicates, embedding_size, optimizer):\n \"\"\"\n Construct full computation graph for Latent Information Model\n \"\"\"\n\n self.build_encoder(nb_entities, nb_predicates, embedding_size)\n self.build_decoder()\n\n ############## ##############\n ############## #Loss\n ############## ##############\n\n self.y_pos = tf.gather(self.y_inputs, self.idx_pos)\n self.y_neg = tf.gather(self.y_inputs, self.idx_neg)\n\n self.p_x_i_pos = tf.gather(self.p_x_i, self.idx_pos)\n self.p_x_i_neg = tf.gather(self.p_x_i, self.idx_neg)\n\n # Negative reconstruction loss\n\n self.reconstruction_loss_p = -tf.reduce_sum(\n tf.log(tf.where(condition=self.y_pos, x=self.p_x_i_pos, y=1 - self.p_x_i_pos) + 1e-10))\n self.reconstruction_loss_n = -tf.reduce_sum((\n tf.log(tf.where(condition=self.y_neg, x=self.p_x_i_neg, y=1 - self.p_x_i_neg) + 1e-10)))\n self.nreconstruction_loss = self.reconstruction_loss_p + self.reconstruction_loss_n * self.ELBOBS # if reduce sum\n\n prior = util.make_prior(code_size=embedding_size, distribution=self.distribution, alt_prior=self.alt_prior)\n\n if self.distribution == 'normal':\n # KL divergence between normal approximate posterior and prior\n\n if self.s_o:\n s_posterior = tfd.MultivariateNormalDiag(self.s_embedding_mean,\n util.distribution_scale(self.s_embedding_sigma))\n\n o_posterior = tfd.MultivariateNormalDiag(self.o_embedding_mean,\n util.distribution_scale(self.o_embedding_sigma))\n\n self.kl0 = tf.reduce_sum(tfd.kl_divergence(s_posterior, prior))\n\n self.kl1 = tf.reduce_sum(tfd.kl_divergence(o_posterior, prior))\n\n else:\n\n entity_posterior = tfd.MultivariateNormalDiag(self.entity_embedding_mean,\n util.distribution_scale(self.entity_embedding_sigma))\n self.kl0= 0\n self.kl1 = tf.reduce_sum(tfd.kl_divergence(entity_posterior, prior))\n\n predicate_posterior = tfd.MultivariateNormalDiag(self.predicate_embedding_mean,\n util.distribution_scale(self.predicate_embedding_sigma))\n self.kl2 = tf.reduce_sum(tfd.kl_divergence(predicate_posterior, prior))\n\n\n\n else:\n raise NotImplemented\n\n self.nkl = (self.kl0+self.kl1 + self.kl2) * self.KL_discount\n\n # Negative ELBO\n\n self.nelbo = self.nkl + self.nreconstruction_loss\n\n self._setup_training(loss=self.nelbo, optimizer=optimizer)\n\n def train(self, test_triples, valid_triples, train_triples, embedding_size,no_batches, nb_epochs=500,\n filename='/home/'):\n \"\"\"\n\n Train and test model\n\n \"\"\"\n\n\n all_triples = train_triples + valid_triples + test_triples\n util.index_gen = index.GlorotIndexGenerator()\n\n Xs = np.array([self.entity_to_idx[s] for (s, p, o) in train_triples], dtype=np.int32)\n Xp = np.array([self.predicate_to_idx[p] for (s, p, o) in train_triples], dtype=np.int32)\n Xo = np.array([self.entity_to_idx[o] for (s, p, o) in train_triples], dtype=np.int32)\n\n assert Xs.shape == Xp.shape == Xo.shape\n\n nb_samples = Xs.shape[0]\n nb_batches = no_batches\n batch_size = math.ceil(nb_samples / nb_batches)\n self.batch_size=batch_size\n batches = util.make_batches(self.nb_examples, batch_size)\n nb_versions = int(self.negsamples + 1) # neg samples + original\n neg_subs = math.ceil(int(self.negsamples / 2))\n pi=util.make_compression_cost(nb_batches)\n\n init_op = tf.global_variables_initializer()\n\n if self.s_o:\n projection_steps = [constraints.unit_sphere_logvar(self.predicate_embedding_sigma, norm=1.0),constraints.unit_sphere_logvar(self.s_embedding_sigma, norm=1.0),constraints.unit_sphere_logvar(self.o_embedding_sigma, norm=1.0)]\n else:\n projection_steps = [constraints.unit_sphere_logvar(self.predicate_embedding_sigma, norm=1.0),constraints.unit_sphere_logvar(self.entity_embedding_sigma, norm=1.0)]\n\n with tf.Session() as session:\n session.run(init_op)\n\n\n for epoch in range(1, nb_epochs + 1):\n\n counter = 0\n order = self.random_state.permutation(nb_samples)\n Xs_shuf, Xp_shuf, Xo_shuf = Xs[order], Xp[order], Xo[order]\n\n loss_values = []\n total_loss_value = 0\n\n for batch_no, (batch_start, batch_end) in enumerate(batches):\n\n curr_batch_size = batch_end - batch_start\n\n Xs_batch = np.zeros((curr_batch_size * nb_versions), dtype=Xs_shuf.dtype)\n Xp_batch = np.zeros((curr_batch_size * nb_versions), dtype=Xp_shuf.dtype)\n Xo_batch = np.zeros((curr_batch_size * nb_versions), dtype=Xo_shuf.dtype)\n\n Xs_batch[0::nb_versions] = Xs_shuf[batch_start:batch_end]\n Xp_batch[0::nb_versions] = Xp_shuf[batch_start:batch_end]\n Xo_batch[0::nb_versions] = Xo_shuf[batch_start:batch_end]\n\n for q in range((neg_subs)): # Xs_batch[1::nb_versions] needs to be corrupted\n Xs_batch[(q+1)::nb_versions] = util.index_gen(curr_batch_size, np.arange(self.nb_entities))\n Xp_batch[(q+1)::nb_versions] = Xp_shuf[batch_start:batch_end]\n Xo_batch[(q+1)::nb_versions] = Xo_shuf[batch_start:batch_end]\n\n for q2 in range(neg_subs,(self.negsamples-neg_subs)): # Xs_batch[1::nb_versions] needs to be corrupted\n Xs_batch[(q2+1)::nb_versions] = Xs_shuf[batch_start:batch_end]\n Xp_batch[(q2+1)::nb_versions] = Xp_shuf[batch_start:batch_end]\n Xo_batch[(q2+1)::nb_versions] = util.index_gen(curr_batch_size, np.arange(self.nb_entities))\n\n vec_neglabels=[int(1)]+([int(0)]*(int(self.negsamples)))\n\n BS=(2.0*(self.nb_entities-1)/self.negsamples)\n\n if (epoch >= (nb_epochs/10)): #linear warmup\n\n kl_linwarmup = (pi[counter])\n #kl_linwarmup = (1.0 / nb_batches)\n\n else:\n kl_linwarmup = 0.0\n\n\n\n if False: #turn Bernoulli Sample Off\n BS=1.0\n\n\n loss_args = {\n self.KL_discount: kl_linwarmup,\n self.s_inputs: Xs_batch,\n self.p_inputs: Xp_batch,\n self.o_inputs: Xo_batch,\n self.y_inputs: np.array(vec_neglabels * curr_batch_size)\n ,self.ELBOBS: BS\n , self.idx_pos: np.arange(curr_batch_size),\n self.idx_neg: np.arange(curr_batch_size, curr_batch_size * nb_versions)\n }\n\n _, elbo_value = session.run([ self.training_step, self.nelbo],\n feed_dict=loss_args)\n\n loss_values += [elbo_value / (Xp_batch.shape[0] / nb_versions)]\n total_loss_value += elbo_value\n\n counter += 1\n\n if (self.projection):\n\n for projection_step in projection_steps:\n session.run([projection_step])\n\n logger.warning('Epoch: {0}\\t Negative ELBO: {1}'.format(epoch, util.stats(loss_values)))\n\n ##\n # Test\n ##\n\n if (epoch % 100) == 0:\n\n for eval_name,eval_triples in [('valid',valid_triples),('test',test_triples)]:\n\n ranks_subj, ranks_obj = [], []\n filtered_ranks_subj, filtered_ranks_obj = [], []\n\n for _i, (s, p, o) in enumerate(eval_triples):\n s_idx, p_idx, o_idx = self.entity_to_idx[s], self.predicate_to_idx[p], \\\n self.entity_to_idx[o]\n\n #####\n\n Xs_v = np.full(shape=(self.nb_entities,), fill_value=s_idx, dtype=np.int32)\n Xp_v = np.full(shape=(self.nb_entities,), fill_value=p_idx, dtype=np.int32)\n Xo_v = np.full(shape=(self.nb_entities,), fill_value=o_idx, dtype=np.int32)\n\n feed_dict_corrupt_subj = {self.s_inputs: np.arange(self.nb_entities),\n self.p_inputs: Xp_v,\n self.o_inputs: Xo_v}\n feed_dict_corrupt_obj = {self.s_inputs: Xs_v, self.p_inputs: Xp_v,\n self.o_inputs: np.arange(self.nb_entities)}\n\n\n # scores of (1, p, o), (2, p, o), .., (N, p, o)\n scores_subj = session.run(self.scores_test, feed_dict=feed_dict_corrupt_subj)\n\n # scores of (s, p, 1), (s, p, 2), .., (s, p, N)\n scores_obj = session.run(self.scores_test, feed_dict=feed_dict_corrupt_obj)\n\n ranks_subj += [1 + np.sum(scores_subj > scores_subj[s_idx])]\n ranks_obj += [1 + np.sum(scores_obj > scores_obj[o_idx])]\n\n filtered_scores_subj = scores_subj.copy()\n filtered_scores_obj = scores_obj.copy()\n\n rm_idx_s = [self.entity_to_idx[fs] for (fs, fp, fo) in all_triples if\n fs != s and fp == p and fo == o]\n rm_idx_o = [self.entity_to_idx[fo] for (fs, fp, fo) in all_triples if\n fs == s and fp == p and fo != o]\n\n filtered_scores_subj[rm_idx_s] = - np.inf\n filtered_scores_obj[rm_idx_o] = - np.inf\n\n filtered_ranks_subj += [1 + np.sum(filtered_scores_subj > filtered_scores_subj[s_idx])]\n filtered_ranks_obj += [1 + np.sum(filtered_scores_obj > filtered_scores_obj[o_idx])]\n\n filtered_ranks = filtered_ranks_subj + filtered_ranks_obj\n ranks = ranks_subj + ranks_obj\n\n for setting_name, setting_ranks in [('Raw', ranks), ('Filtered', filtered_ranks)]:\n mean_rank = np.mean(setting_ranks)\n logger.warning('[{}] {} Mean Rank: {}'.format(eval_name, setting_name, mean_rank))\n\n for k in [1, 3, 5, 10]:\n hits_at_k = np.mean(np.asarray(setting_ranks) <= k) * 100\n logger.warning('[{}] {} Hits@{}: {}'.format(eval_name, setting_name, k, hits_at_k))\n\n\nclass LFM(LIM):\n \"\"\"\n Latent Fact Model\n\n Initializes and trains Link Prediction Model.\n\n @param file_name: The TensorBoard file_name.\n @param embedding_size: The embedding_size for entities and predicates\n @param no_batches: The number of batches per epoch\n @param lr: The learning rate\n @param eps: The epsilon value for ADAM optimiser\n @param distribution: The prior distribution we assume generates the data\n @param dataset: The dataset which the model is trained on\n @param projection: Determines if variance embeddings constrained to sum to unit variance.\n @param alt_prior: Determines whether a normal or specific Gaussian prior is used.\n\n @type file_name: str: '/home/workspace/acowenri/tboard'\n @type embedding_size: int\n @type no_batches: int\n @type lr: float\n @type eps: float\n @type distribution: str\n @type dataset: str\n @type projection: bool\n @type alt_prior: bool\n\n \"\"\"\n\n def __init__(self, file_name, score_func='DistMult', embedding_size=200, no_batches=10, distribution='normal',\n epsilon=1e-3, negsamples=5, dataset='wn18', lr=0.001, alt_prior=False, projection=False,s_o=True):\n\n LIM.__init__(self, file_name, score_func, embedding_size, no_batches, distribution,\n epsilon, negsamples, dataset, lr, alt_prior, projection,s_o=s_o)\n\n optimizer = tf.train.AdamOptimizer(learning_rate=lr, epsilon=epsilon)\n\n ##### dataset ######\n self.dataset_name = dataset\n logger.warning('Parsing the facts in the Knowledge Base for Dataset {}..'.format(self.dataset_name))\n train_triples = util.read_triples(\"data/{}/train.tsv\".format(self.dataset_name)) # choose dataset\n valid_triples = util.read_triples(\"data/{}/dev.tsv\".format(self.dataset_name))\n test_triples = util.read_triples(\"data/{}/test.tsv\".format(self.dataset_name))\n\n\n ##############\n self.build_LFM(self.nb_entities, self.nb_predicates, embedding_size, optimizer)\n\n self.train(nb_epochs=self.nb_epochs, test_triples=test_triples, valid_triples=valid_triples,\n embedding_size=embedding_size,\n train_triples=train_triples, no_batches=int(no_batches), filename=str(file_name))\n\n\n def build_LFM(self, nb_entities, nb_predicates, embedding_size, optimizer):\n \"\"\"\n Construct full computation graph for Latent Fact Model\n \"\"\"\n\n self.build_encoder(nb_entities, nb_predicates, embedding_size)\n self.build_decoder()\n\n ############## ##############\n ############## #Loss\n ############## ##############\n\n self.y_pos = tf.gather(self.y_inputs, self.idx_pos)\n self.y_neg = tf.gather(self.y_inputs, self.idx_neg)\n\n self.p_x_i_pos = tf.gather(self.p_x_i, self.idx_pos)\n self.p_x_i_neg = tf.gather(self.p_x_i, self.idx_neg)\n\n # Negative reconstruction loss\n\n self.reconstruction_loss_p = -tf.reduce_sum(\n tf.log(tf.where(condition=self.y_pos, x=self.p_x_i_pos, y=1 - self.p_x_i_pos) + 1e-10))\n self.reconstruction_loss_n = -tf.reduce_sum((\n tf.log(tf.where(condition=self.y_neg, x=self.p_x_i_neg, y=1 - self.p_x_i_neg) + 1e-10)))\n\n ################\n\n # KL\n\n self.mu_s_ps = tf.gather(self.mu_s, self.idx_pos, axis=0)\n self.mu_o_ps = tf.gather(self.mu_o, self.idx_pos, axis=0)\n self.mu_p_ps = tf.gather(self.mu_p, self.idx_pos, axis=0)\n #\n self.log_sigma_sq_s_ps = tf.gather(self.log_sigma_sq_s, self.idx_pos, axis=0)\n self.log_sigma_sq_o_ps = tf.gather(self.log_sigma_sq_o, self.idx_pos, axis=0)\n self.log_sigma_sq_p_ps = tf.gather(self.log_sigma_sq_p, self.idx_pos, axis=0)\n\n self.mu_all_ps = tf.concat(axis=0, values=[self.mu_s_ps, self.mu_o_ps, self.mu_p_ps])\n self.log_sigma_ps = tf.concat(axis=0,\n values=[self.log_sigma_sq_s_ps, self.log_sigma_sq_o_ps, self.log_sigma_sq_p_ps])\n #\n\n # negative samples\n\n self.mu_s_ns = tf.gather(self.mu_s, self.idx_neg, axis=0)\n self.mu_o_ns = tf.gather(self.mu_o, self.idx_neg, axis=0)\n self.mu_p_ns = tf.gather(self.mu_p, self.idx_neg, axis=0)\n #\n self.log_sigma_sq_s_ns = tf.gather(self.log_sigma_sq_s, self.idx_neg, axis=0)\n self.log_sigma_sq_o_ns = tf.gather(self.log_sigma_sq_o, self.idx_neg, axis=0)\n self.log_sigma_sq_p_ns = tf.gather(self.log_sigma_sq_p, self.idx_neg, axis=0)\n\n self.mu_all_ns = tf.concat(axis=0, values=[self.mu_s_ns, self.mu_o_ns, self.mu_p_ns])\n self.log_sigma_ns = tf.concat(axis=0,\n values=[self.log_sigma_sq_s_ns, self.log_sigma_sq_o_ns, self.log_sigma_sq_p_ns])\n #\n\n\n\n prior = util.make_prior(code_size=embedding_size, distribution=self.distribution, alt_prior=self.alt_prior)\n\n if self.distribution == 'normal':\n # KL divergence between normal approximate posterior and prior\n\n pos_posterior = tfd.MultivariateNormalDiag(self.mu_all_ps, util.distribution_scale(self.log_sigma_ps))\n neg_posterior = tfd.MultivariateNormalDiag(self.mu_all_ns, util.distribution_scale(self.log_sigma_ns))\n\n self.kl1 = tf.reduce_sum(tfd.kl_divergence(pos_posterior, prior))\n self.kl2 = tf.reduce_sum(tfd.kl_divergence(neg_posterior, prior))\n\n # elif self.distribution == 'vmf':\n # # KL divergence between vMF approximate posterior and uniform hyper-spherical prior\n #\n # pos_posterior = VonMisesFisher(self.mu_all_ps, util.distribution_scale(self.log_sigma_ps) + 1)\n # neg_posterior = VonMisesFisher(self.mu_all_ns, util.distribution_scale(self.log_sigma_ns) + 1)\n # kl1 = pos_posterior.kl_divergence(prior)\n # kl2 = neg_posterior.kl_divergence(prior)\n # self.kl1 = tf.reduce_sum(kl1)\n # self.kl2 = tf.reduce_sum(kl2)\n\n else:\n raise NotImplemented\n\n self.nkl = (self.kl1 + self.kl2) * self.KL_discount\n\n # Negative ELBO\n\n self.nelbo = (self.reconstruction_loss_p + self.kl1 * self.KL_discount) + (\n self.reconstruction_loss_n + self.kl2 * self.KL_discount) * self.ELBOBS\n self._setup_training(loss=self.nelbo, optimizer=optimizer)\n" } ]
14
luketseng/taifex_daily
https://github.com/luketseng/taifex_daily
f316f4192c7d732647e2f2ee9e93c10ae11f690a
d36698060148453421f197c6b59bc708f40ffe33
91f1f5bdde67d8df75a1acc275794725e9c5b6ce
refs/heads/master
2023-07-23T07:59:12.863234
2023-07-08T07:10:56
2023-07-08T07:10:56
151,592,760
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.5073529481887817, "alphanum_fraction": 0.5214506983757019, "avg_line_length": 42.272727966308594, "blob_id": "c5fb620d322ab0dff9b3183bb87c70e1f71630c0", "content_id": "8995f2b2ae5a266c41ad73721ec27ad26d0544a2", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 18088, "license_type": "no_license", "max_line_length": 134, "num_lines": 418, "path": "/mining_rpt.py", "repo_name": "luketseng/taifex_daily", "src_encoding": "UTF-8", "text": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\"\"\"\nThis is a mining taifex history script.\n1. mining taifex rpt every day.\n2. update to google drive.\n\"\"\"\n\nimport sys, os\nimport zipfile, wget, argparse, re\nimport sqlite3\nimport logging\nimport json\nimport numpy as np\nimport time\nfrom datetime import datetime, timedelta\nfrom devices.gdrive import gdrive\n\nclass mining_rpt():\n path = os.path.dirname(__file__)\n db_name='FCT_DB.db'\n date = None\n item = None\n fex_dict_item = None\n\n def __init__(self, *args, **kwargs):\n config_file = '{}/config.json'.format(self.path)\n with open(config_file, 'r') as f:\n fex_dicts = json.load(f, encoding='utf-8')\n ## ready for default date and fex item\n self.date = kwargs.get('date', today.strftime('%Y_%m_%d'))\n self.item = kwargs.get('item', 'fut_rpt')\n logger.info(\"Mining info: date='{}', item='{}'\".format(self.date, self.item))\n try:\n self.fex_dict_item = fex_dicts[self.item]\n if self.item == 'fut_rpt':\n self.fex_dict_item['filename'] = \"Daily_{}.zip\".format(self.date)\n elif self.item == 'opt_rpt':\n self.fex_dict_item['filename'] = \"OptionsDaily_{}.zip\".format(self.date)\n self.fex_dict_item['rptdirpath'] = os.path.join(self.path, self.item)\n logger.info(\n 'ready to download {filename} to {rptdirpath} via url: {url}'.format(**self.fex_dict_item))\n except:\n logger.error('fex_info not found item')\n ## get gdrive() device\n if 'gdevice' not in globals():\n global gdevice\n gdevice = gdrive()\n\n def download_rpt(self):\n\n def checkZipFile(path):\n try:\n zip_file = zipfile.ZipFile(path)\n zip_file.testzip()\n zip_file.close()\n logger.info('Download completed : {} and check done'.format(path))\n except zipfile.BadZipfile:\n logger.warning('BadZipfile: remove {}'.format(path))\n os.remove(path)\n\n fex_info = self.fex_dict_item\n if not os.path.exists(fex_info['rptdirpath']):\n os.mkdir(fex_info['rptdirpath'])\n\n storepath = os.path.join(fex_info['rptdirpath'], fex_info['filename'])\n if not args.recover and os.path.exists(storepath):\n logger.info('{} is exist, args.recover = {}'.format(storepath, args.recover))\n else:\n file_url = os.path.join(fex_info['url'], fex_info['filename'])\n logger.info('wget {} via {}'.format(storepath, file_url))\n os.system('wget -O {} {}'.format(storepath, file_url))\n ## check zip is not empty\n checkZipFile(storepath)\n\n def unzip_all2rptdir(self):\n logger.info('Exteacting for all unzip...')\n\n fex_info = self.fex_dict_item\n tmp_path = os.path.join(fex_info['rptdirpath'], 'tmp')\n if not os.path.exists(tmp_path):\n os.mkdir(tmp_path)\n\n if os.path.isdir(fex_info['rptdirpath']):\n logger.info('Exist on local: {rptdirpath}'.format(**fex_info))\n for dirname, dirnames, filenames in os.walk(fex_info['rptdirpath']):\n if dirname == fex_info['rptdirpath']:\n for filename in filenames:\n file_abspath = os.path.abspath(os.path.join(dirname, filename))\n try:\n zip_file = zipfile.ZipFile(file_abspath)\n zip_file.testzip()\n zip_file.close()\n except zipfile.BadZipfile:\n continue\n\n with zipfile.ZipFile(file_abspath, 'r') as zf:\n for rptname in zf.namelist():\n zf.extract(rptname, os.path.join(dirname, 'tmp'))\n logger.debug(os.path.join(dirname, 'tmp', rptname) + ' done')\n logger.info('all {rptdirpath} file unzip to {rptdirpath}/tmp'.format(**fex_info))\n else:\n logger.warning('Warning: {} dir not exist'.format(fex_info['rptdirpath']))\n\n def unzip_file(self, local, exdir):\n\n try:\n with zipfile.ZipFile(local, 'r') as zf:\n for rptname in zf.namelist():\n zf.extract(rptname, exdir)\n logger.info(\"Unzip '{}' to '{}'\".format(local, exdir))\n except:\n assert False, 'except for unzip file to {}'.format(local)\n\n def upload_gdrive(self):\n\n fex_info = self.fex_dict_item\n file_abspath = os.path.abspath(os.path.join(fex_info['rptdirpath'], fex_info['filename']))\n\n if os.path.exists(file_abspath):\n gdevice.UploadFile(file_abspath, self.item, recover=args.recover)\n else:\n logger.warning('Warning: file path is not exist')\n\n def parser_rpt_to_DB(self, fut='TX'):\n\n fex_info = self.fex_dict_item\n zip_file_relpath = os.path.join(fex_info['rptdirpath'], fex_info['filename'])\n rpt_file_relpath = os.path.join(fex_info['rptdirpath'], 'tmp', fex_info['filename']).replace(\n '.zip', '.rpt')\n\n ## check rpt file is exist on tmp, zip is exist?, gdrive is exist? or return None\n if not os.path.isfile(rpt_file_relpath) or args.recover:\n if not os.path.isfile(zip_file_relpath):\n logger.info(\n 'not found {} from \"www.taifex.com.tw\" and get zip via gdrive'.format(zip_file_relpath))\n gdevice.GetContentFile(fex_info['filename'], zip_file_relpath)\n self.unzip_file(zip_file_relpath, os.path.dirname(rpt_file_relpath))\n\n ## Confirmation get_fut(flie, fut, fut_mouth), grep next month if close on this month\n date = datetime.strptime(self.date, '%Y_%m_%d')\n if 'Daily' in fex_info['filename']:\n grep_info = (rpt_file_relpath, fut, date.strftime('%Y%m'))\n tick_result = os.popen(\"cat {} | grep ,{} | grep -P '{}\\s+'\".format(*grep_info)).read()\n if tick_result == '':\n futc = date + timedelta(weeks=4)\n grep_info = (rpt_file_relpath, fut, futc.strftime('%Y%m'))\n tick_result = os.popen(\"cat {} | grep ,{} | grep -P '{}\\s+'\".format(*grep_info)).read()\n tick_result = tick_result.strip().replace(',', ' ').replace('*', ' ')\n\n ## tick_result to np.array.reshape\n raw_data = tick_result.split()\n num_tick = len(tick_result.splitlines())\n tick_len = len(tick_result.splitlines()[0].split())\n logger.info('reshape check, num of tick: {}'.format(num_tick))\n logger.info('reshape check, tick row_data[:{}]: {}'.format(tick_len, raw_data[:tick_len]))\n assert len(raw_data) / tick_len == num_tick, 'reshape check np.array.reshape(2-dim, -1) fail'\n tick_array = np.array(raw_data).reshape(num_tick, -1)\n\n ## found first tick time: 150000-050000, 084500-134500\n logger.debug('first tick: {}'.format(tick_array[0]))\n if datetime.strptime(tick_array[0, 3], '%H%M%S').hour == 15:\n stime = datetime.strptime(tick_array[0, 0] + '150000', '%Y%m%d%H%M%S') + timedelta(minutes=1)\n else:\n stime = datetime.strptime(tick_array[0, 0] + '084500', '%Y%m%d%H%M%S') + timedelta(minutes=1)\n\n req = list()\n tmp = list()\n tick_len = len(tick_array)\n for i, tick in enumerate(tick_array, 1):\n ## push tick to list\n t = datetime.strptime(tick[0] + tick[3], '%Y%m%d%H%M%S')\n if t >= stime + timedelta(minutes=-1) and t < stime or t == t.replace(\n hour=5, minute=0, second=0, microsecond=0) or t == t.replace(\n hour=13, minute=45, second=0, microsecond=0):\n logger.debug('append {} to tmp list'.format(tick))\n tmp.append(tuple(tick))\n if i < tick_len:\n continue\n ## cal one min result\n if not tmp:\n tmp.append(tuple(tick))\n stime = datetime.strptime(tick[0] + '{}00'.format(tick[3][:4]),\n '%Y%m%d%H%M%S') + timedelta(minutes=1)\n continue\n req_array = np.array(tmp)\n logger.debug(req_array)\n Date = stime.strftime('%Y/%m/%d')\n Time = stime.strftime('%H:%M:%S')\n Open = req_array[:, 4][0].astype('int')\n High = req_array[:, 4].astype('int').max(axis=0)\n Low = req_array[:, 4].astype('int').min(axis=0)\n Close = req_array[:, 4][-1].astype('int')\n Vol = req_array[:, 5].astype('int').sum(axis=0) / 2\n out = (Date, Time, Open, High, Low, Close, Vol)\n logger.debug(out) # change to info\n req.append(tuple(out))\n ## init tmp list\n if i < tick_len:\n tmp = list()\n tmp.append(tick)\n stime += timedelta(minutes=1)\n if t == datetime.strptime(tick[0] + '084500', '%Y%m%d%H%M%S'):\n stime = datetime.strptime(tick[0] + '084500', '%Y%m%d%H%M%S') + timedelta(minutes=1)\n logger.debug('next time step: {}'.format(stime))\n\n ## use progressbar\n k = float(i + 1) / tick_len * 100\n step = tick_len // 32\n _str = '=' * (i // step) + '>' + ' ' * (32 - (i // step))\n sys.stdout.write('\\r[%s][%.1f%%]' % (_str, k))\n sys.stdout.flush()\n sys.stdout.write('\\n')\n logger.info('num of sql data: {}'.format(len(req)))\n\n ## query to DB\n conn = sqlite3.connect(os.path.join(os.path.abspath(self.path), self.db_name))\n cursor = conn.cursor()\n fut = 'TX' if fut not in fex_info['symbol'] else fut\n\n ## delete old data\n SQL_Detete = \"DELETE FROM tw{} WHERE Date=\\'{}\\' and Time<=\\'{}\\';\".format(fut, *req[-1][:2])\n cursor.execute(SQL_Detete)\n if req[0][1] == '15:01:00':\n SQL_Detete1 = \"DELETE FROM tw{} WHERE Date=\\'{}\\' and Time>=\\'{}\\';\".format(fut, *req[0][:2])\n SQL_Detete2 = \"DELETE FROM tw{} WHERE Date=\\'{}\\' and Time<=\\'{}\\';\".format(fut, *req[839][:2])\n cursor.execute(SQL_Detete1)\n cursor.execute(SQL_Detete2)\n conn.commit()\n\n ## insert new data\n SQL = \"INSERT INTO tw{} VALUES (?,?,?,?,?,?,?);\".format(fut)\n for i in range(len(req)):\n logger.debug(req[i])\n cursor.execute(SQL, req[i])\n conn.commit()\n conn.close()\n\n def export_sql_to_txt(self):\n\n fex_info = self.fex_dict_item\n ## vaild args input\n logger.debug(\"-e args input '{}'\".format(args.export))\n if len(args.export) != 2:\n assert False, \"error -e args input '{}'\".format(args.export)\n fut = 'TX' if args.export[0] not in fex_info['symbol'] else args.export[0]\n interval = 300 if args.export[1] not in ['1', '5', '15', '30', '60', '300'] else int(args.export[1])\n logger.info(\"(fut, interval, date) = ('{}', {}, {})\".format(fut, interval, start_D))\n ## read DB via sqlite3\n conn = sqlite3.connect(os.path.join(os.path.abspath(self.path), self.db_name))\n cursor = conn.cursor()\n\n def loop_for_oneday(date):\n content = ''\n SQL = \"SELECT * FROM tw{!s} WHERE Date=\\'{!s}\\' and Time>\\'08:45:00\\' and Time<=\\'13:45:00\\' ORDER BY Date, Time;\".format(\n fut, date)\n cursor.execute(SQL)\n if interval == 1:\n req = cursor.fetchall()\n for i in req:\n content += '{},{},{},{},{},{},{}\\n'.format(*i)\n logger.debug(export_str)\n else:\n while True:\n req = cursor.fetchmany(interval)\n if not req:\n break\n else:\n req_array = np.array(req)\n logger.debug(req_array)\n Date = req_array[:, 0][-1]\n Time = req_array[:, 1][-1]\n Open = req_array[:, 2][0].astype('int')\n High = req_array[:, 3].astype('int').max(axis=0)\n Low = req_array[:, 4].astype('int').min(axis=0)\n Close = req_array[:, 5][-1].astype('int')\n Vol = req_array[:, 6].astype('int').sum(axis=0)\n out = (Date, Time, Open, High, Low, Close, Vol)\n content += '{},{},{},{},{},{},{}\\n'.format(*out)\n logger.debug(content)\n return content\n\n d = start_D\n export_str = 'Date,Time,Open,High,Low,Close,Volume'\n date_string = start_D.strftime('%Y%m%d') + \"-\" + end_D.strftime(\n '%Y%m%d') if start_D != end_D else start_D.strftime('%Y%m%d')\n os.system('echo \"{}\" > {}_{}'.format(export_str, fut, date_string))\n while not d > end_D:\n #export_str += loop_for_oneday(d.strftime('%Y/%m/%d'))\n tmp = loop_for_oneday(d.strftime('%Y/%m/%d'))\n if bool(tmp.strip()):\n print(d)\n os.system('echo \"{}\" >> {}_{}'.format(tmp.strip(), fut, date_string))\n d += timedelta(days=1)\n #date_string = start_D.strftime('%Y%m%d') + \"-\" + end_D.strftime(\n # '%Y%m%d') if start_D != end_D else start_D.strftime('%Y%m%d')\n #os.system('echo \"{}\" > {}_{}'.format(export_str, fut, date_string))\n logger.info('out file: {}_{}'.format(fut, date_string))\n ## output 1 year json file\n logger.info('start output 1.5 year json file: {} and {}'.format(fut, end_D.strftime('%Y%m%d')))\n interval = 300\n data = list()\n if not os.path.isfile('FUT_{}.json'.format(fut)):\n #d = end_D + timedelta(weeks=-80)\n d = datetime.strptime('2020/01/01', '%Y/%m/%d')\n while not d > end_D:\n result = loop_for_oneday(d.strftime('%Y/%m/%d')).strip()\n logger.info('{}'.format(d))\n if result:\n i = result.split(',')\n t = datetime.strptime(i[0], '%Y/%m/%d') + timedelta(hours=23)\n t_mk = int(time.mktime(t.timetuple())) * 1000\n data.append([t_mk] + list(map(int, i[2:])))\n d += timedelta(days=1)\n else:\n with open('FUT_{}.json'.format(fut), 'r') as f:\n data = json.load(f, encoding='utf-8')\n result = loop_for_oneday(end_D.strftime('%Y/%m/%d')).strip()\n if result:\n #data.pop(0)\n i = result.split(',')\n t = datetime.strptime(i[0], '%Y/%m/%d') + timedelta(hours=23)\n t_mk = int(time.mktime(t.timetuple())) * 1000\n data.append([t_mk] + list(map(int, i[2:])))\n with open('FUT_{}.json'.format(fut), 'w') as f:\n json.dump(data, f, indent=4)\n\ndef get_logging_moduel():\n global logger\n logger = logging.getLogger(__name__)\n logger.setLevel(logging.INFO)\n\n console = logging.StreamHandler(sys.stdout)\n console.setLevel(logging.INFO)\n formatter = logging.Formatter('%(asctime)s | %(name)s - %(levelname)s - %(message)s')\n console.setFormatter(formatter)\n logger.addHandler(console)\n\ndef valid_date(date_text):\n date_interval = date_text.split('-')\n\n try:\n start_date = datetime.strptime(date_interval[0], '%Y%m%d')\n ## set end_date if not setting\n end_date = today\n if len(date_interval) == 2:\n end_date = datetime.strptime(date_interval[1], '%Y%m%d')\n\n except ValueError:\n logger.error('valid date format fail: \"--date {!s}\"'.format(date_text))\n assert False, 'valid date format fail: \"--date {!s}\"'.format(date_text)\n\n ## valid end_date after start_date\n if start_date > end_date or start_date > today:\n logger.error('start date({}) after end_date({} or today({}))'.format(start_date, end_date, today))\n assert False, 'start date({}) after end_date({} or today({}))'.format(start_date, end_date, today)\n\n logger.info('(start_date, end_date) = ({}, {})'.format(start_date, end_date))\n return (start_date, end_date)\n\nif __name__ == '__main__':\n ## init config\n today = datetime.today().replace(minute=0, hour=0, second=0, microsecond=0)\n items = ('fut_rpt', 'opt_rpt')\n ## set logging moduel for debug\n get_logging_moduel()\n ## set args for mining_rpt control\n parser = argparse.ArgumentParser()\n parser.add_argument(\n '-d',\n '--date',\n type=str,\n default=today.strftime('%Y%m%d'),\n help='download rpt from $DATE~today, tpye=str ex: 20180101-20180102')\n parser.add_argument(\n \"-e\",\n \"--export\",\n nargs='+',\n type=str,\n default=None,\n help=\"Future symbol(TX) Interval(300), tpye=str ex: -e TX 300, use -d Date1-Date2\")\n parser.add_argument(\n '--upload-recover',\n dest='recover',\n default=False,\n action='store_true',\n help='switch for new rpt instead of gdrive exist.')\n args = parser.parse_args()\n\n (start_D, end_D) = valid_date(args.date)\n logger.info('{!s}'.format(args))\n\n if args.export != None:\n mining_rpt().export_sql_to_txt()\n sys.exit()\n\n ## every daily\n i = start_D\n while not i > end_D:\n date = i.strftime('%Y_%m_%d')\n logger.info('Start mining for {}'.format(date))\n\n for j in items:\n daily_mining = mining_rpt(date=date, item=j)\n\n daily_mining.download_rpt()\n daily_mining.upload_gdrive()\n if j == 'fut_rpt':\n daily_mining.parser_rpt_to_DB('TX')\n daily_mining.parser_rpt_to_DB('MTX')\n i += timedelta(days=1)\n '''\n # unzip_all2rptdir for once\n for i in items[:0]:\n daily_mining=mining_rpt(i)\n daily_mining.unzip_all2rptdir()\n pass\n '''\n" }, { "alpha_fraction": 0.44692307710647583, "alphanum_fraction": 0.46811190247535706, "avg_line_length": 43.40993881225586, "blob_id": "016524016199db63825d5ca55858c5a1251a355d", "content_id": "02ad21977c9291ffa244db5b33cdbcbd26d3c993", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 14442, "license_type": "no_license", "max_line_length": 149, "num_lines": 322, "path": "/get_data.py", "repo_name": "luketseng/taifex_daily", "src_encoding": "UTF-8", "text": "#!/usr/bin/python3\n# -*- coding: utf-8 -*-\n\nfrom selenium.webdriver import Chrome\nfrom selenium.webdriver import ChromeOptions as Options\n#from selenium.webdriver import Firefox\n#from selenium.webdriver.firefox.options import Options\nimport sys, os\nimport re\nimport sqlite3\nimport chardet\nimport json\nimport numpy as np\nimport time\nfrom datetime import datetime, timedelta, date\n\nclass PraserDataTools():\n lines_data = list()\n date = ''\n cht_maps = {\n '臺股期貨': 'TX',\n '電子期貨': 'TE',\n '金融期貨': 'TF',\n '小型臺指期貨': 'MTX',\n '臺指選擇權': 'TXO',\n '買權': 'CALL',\n '賣權': 'PUT',\n '外資及陸資(不含外資自營商)': 'FOR',\n '外資及陸資': 'FOR',\n '外資': 'FOR',\n '外資自營商': 'FOR_D',\n '投信': 'INV',\n '自營商(自行買賣)': 'DEA',\n '自營商(避險)': 'DEA_H',\n '自營商': 'DEA'}\n\n def insert_data_from_csv(self, item=None):\n '''item [Fut|OP]'''\n '''check sys default enconding'''\n #print(sys.getdefaultencoding())\n\n #with open('2years_data.csv', 'rb') as f:\n # a=f.readline()\n # print(chardet.detect(a), type(a))\n # print(a.decode('big5'))\n #with open('2years_data.csv', 'r', encoding='big5') as f:\n with open('{}.csv'.format(item), 'r', encoding='big5') as f:\n str_line = f.read()\n cht_maps = self.cht_maps\n for k, v in cht_maps.items():\n str_line = str_line.replace(k, v)\n\n with sqlite3.connect('II_DB.db') as conn:\n cursor = conn.cursor()\n lines_str = ''\n for line in str_line.split():\n temp = line.split(',')\n if temp[1] in set(cht_maps.values()):\n title = repr(temp[:-12]).replace(' ', '').replace('[', '').replace(']', '')\n value = ','.join(temp[-12:])\n line_str = '({},{}),'.format(title, value)\n #print(line_str)\n lines_str += line_str\n SQL = \"INSERT INTO II_{} VALUES {};\".format(item, lines_str.strip(','))\n cursor.execute(SQL)\n conn.commit()\n\n def insert_data_from_url(self, item=None, date=''):\n '''item [Fut|SPOT|OP]'''\n self.item = item\n if date != '': self.date = date\n options = Options()\n options.add_argument('--headless')\n options.add_argument('--disable-features=VizDisplayCompositor')\n #options.add_argument('--disable-dev-shm-usage')\n '''open driver via different browser\n with Firefox(firefox_options=options) as driver:'''\n with Chrome(options=options) as driver:\n self.lines_data = list()\n if item == 'SPOT':\n driver.get(\n #'https://www.twse.com.tw/fund/BFI82U?response=html&dayDate={}&weekDate=&monthDate=&type=day'\n 'https://www.twse.com.tw/rwd/zh/fund/BFI82U?type=day&dayDate={}&response=html'\n .format(date.replace('/', '')))\n e = driver.find_elements_by_tag_name('tr')\n for i in e:\n #print(i.text.split())\n self.lines_data.append(i.text.split())\n\n if item == 'Fut' or item == 'OP':\n if item == 'Fut':\n driver.get('https://www.taifex.com.tw/cht/3/futContractsDateExcel')\n col_num = list(range(3)) + list(range(3, 15))\n split_size = [0, 2, 6, 9, 11, 15, 17, 21, 23, 27, 29, 33, 35, 39, 41, 45]\n if item == 'OP':\n driver.get('https://www.taifex.com.tw/cht/3/callsAndPutsDateExcel')\n col_num = list(range(3)) + list(range(3, 9))\n split_size = [0, 2, 6, 8, 11, 15, 17, 21, 23, 27, 29, 33, 35, 39, 41, 45]\n\n e = driver.find_element_by_xpath('//*[@id=\"printhere\"]/div[2]/table/tbody/tr[1]/td/p/span[2]')\n date_flag = '{}\\t{}'.format(driver.title, e.text)\n #print(repr(date_flag.split()))\n self.lines_data.append(date_flag.split())\n e = driver.find_elements_by_tag_name('tbody')[1]\n for i in col_num:\n row = e.find_elements_by_tag_name('tr')[i]\n if i != 2:\n line = row.text.split()\n else:\n line_str = row.text.replace('\\n', '')\n line = [line_str[split_size[i]:ele] for i, ele in enumerate(split_size[1:], 0)]\n #print(line)\n self.lines_data.append(line)\n '''use data_line_list parser'''\n insert_data = self.pre_insert_db(item)\n #print(insert_data)\n if insert_data:\n self.insert_daily_data(*insert_data)\n\n def pre_insert_db(self, item=None):\n if not self.lines_data:\n print('self.lines_data is None')\n sys.exit()\n\n cht_maps = self.cht_maps\n lines_str = ''\n if item == 'Fut' or item == 'OP':\n '''check date data is today date'''\n if self.date not in self.lines_data[0][1]:\n print('Not get {} {} line data'.format(self.date, item))\n sys.exit()\n (date, COM, II, PC) = ('', '', '', '')\n for line_data in self.lines_data[:1] + self.lines_data[4:]:\n if len(line_data) == 2:\n date = line_data[1][2:]\n self.date = date\n else:\n line_str = ''\n if len(line_data[:-12]) == 3:\n COM = cht_maps[line_data[1]]\n II = cht_maps[line_data[2]]\n elif len(line_data[:-12]) == 4:\n COM = cht_maps[line_data[1]]\n PC = cht_maps[line_data[2]]\n II = cht_maps[line_data[3]]\n elif len(line_data[:-12]) == 2:\n PC = cht_maps[line_data[0]]\n II = cht_maps[line_data[1]]\n elif len(line_data[:-12]) == 1:\n II = cht_maps[line_data[0]]\n\n value = ','.join([i.replace(',', '') for i in line_data[-12:]])\n if item == 'Fut':\n line_str = '({},{},{},{}),'.format(repr(date), repr(COM), repr(II), value)\n elif item == 'OP':\n line_str = '({},{},{},{},{}),'.format(repr(date), repr(COM), repr(PC), repr(II), value)\n #print(line_str)\n lines_str += line_str\n elif item == 'SPOT':\n date = ''\n for line_data in self.lines_data[:1] + self.lines_data[2:-1]:\n if len(line_data) == 2:\n match = re.match(r'(\\d+)年(\\d+)月(\\d+)日', line_data[0])\n if match:\n date = '{}/{}/{}'.format(int(match.group(1)) + 1911, match.group(2), match.group(3))\n '''check date data is today date'''\n if self.date not in date:\n print('Not get {} {} line data'.format(self.date, item))\n sys.exit()\n else:\n II = cht_maps[line_data[0]]\n value = ','.join([i.replace(',', '') for i in line_data[-3:]])\n line_str = '({},{},{}),'.format(repr(date), repr(II), value)\n #print(line_str)\n lines_str += line_str\n return (date, lines_str.strip(','))\n\n def insert_daily_data(self, date, data):\n path = os.path.join(os.path.dirname(__file__), 'II_DB.db')\n table_name = 'II_{}'.format(self.item)\n with sqlite3.connect(path) as conn:\n cursor = conn.cursor()\n SQL = \"DELETE FROM {} WHERE Date='{}';\".format(table_name, date)\n cursor.execute(SQL)\n conn.commit()\n SQL = \"INSERT INTO {} VALUES {};\".format(table_name, data)\n cursor.execute(SQL)\n conn.commit()\n\n def sqlite3_fetchall(self, db_path, query):\n '''get req of query on db'''\n with sqlite3.connect(db_path) as conn:\n cursor = conn.cursor()\n cursor.execute(query)\n requests = cursor.fetchall()\n return requests\n\n def strategy_out_put(self, date=None):\n # SELECT Date, OI_Net_Contract FROM II_Fut WHERE Fut='TX' and Institutional='FOR';\n # SELECT * from twTX WHERE Date='2020/03/20'\n # SELECT Date, OI_B_Contract, OI_S_Contract, OI_B_Amount, OI_S_Amount FROM II_OP WHERE Institutional='FOR';\n # SELECT Date, TR_Net_Amount FROM II_SPOT WHERE Date='2014/06/09';\n # export my strategy\n #date='2020/03/20'\n date = self.date if not date else date\n #date_age = (datetime.strptime(date, '%Y/%m/%d') + timedelta(weeks=-80)).strftime('%Y/%m/%d')\n date_age = datetime.strptime('2020/01/01', '%Y/%m/%d').strftime('%Y/%m/%d')\n path_fut = os.path.join(os.path.dirname(__file__), 'FCT_DB.db')\n path = os.path.join(os.path.dirname(__file__), 'II_DB.db')\n '''get TX fut close'''\n data_table = dict()\n qurey = 'SELECT Date, Time, Close FROM twTX WHERE Date>=\"{!s}\" and (Time=\"13:30:00\" or Time=\"13:45:00\") ORDER BY Date, Time;'.format(\n date_age)\n req = self.sqlite3_fetchall(path_fut, qurey)\n for (k, *v) in req:\n data_table[k] = v[1:]\n '''get TX'''\n qurey = \"SELECT Date, OI_Net_Contract FROM II_Fut WHERE Fut='TX' and Date>='{}' and Institutional='FOR';\".format(\n date_age)\n req = self.sqlite3_fetchall(path, qurey)\n tmp = 0\n for i, v in enumerate(req):\n if i > 0:\n diff = v[1] - tmp\n total_v = diff * data_table[v[0]][0] * 200\n total_s = float('{:.2f}'.format(total_v / 100000000))\n else:\n diff = None\n total_s = None\n data_table[v[0]].extend([v[1], diff, total_s])\n tmp = v[1]\n '''get SPOT'''\n #qurey = \"SELECT Date, TR_Net_Amount FROM II_SPOT WHERE Date>='{}' and Institutional='FOR';\".format(\n qurey = \"SELECT Date, Sum(TR_Net_Amount) FROM II_SPOT WHERE Date>='{}' and Institutional like 'FOR%' GROUP BY Date;\".format(\n date_age)\n req = self.sqlite3_fetchall(path, qurey)\n for v in req:\n value = float('{:.2f}'.format(v[1] / 100000000))\n data_table[v[0]].append(value)\n with sqlite3.connect(path) as conn:\n cursor = conn.cursor()\n '''get OP'''\n SQL = \"SELECT Date, OI_B_Contract, OI_S_Contract, OI_B_Amount, OI_S_Amount FROM II_OP WHERE Institutional='FOR' and Date>='{}';\".format(\n date_age)\n cursor.execute(SQL)\n while 1:\n req = cursor.fetchmany(2)\n if not req:\n break\n value = float('{:.2f}'.format(\n ((req[-2][3] + req[-1][4]) - (req[-2][4] + req[-1][3])) / 100000))\n data_table[req[-2][0]].append(value)\n output_data = list()\n for k, v in data_table.items():\n t = datetime.strptime(k, '%Y/%m/%d') + timedelta(hours=23)\n t_mk = int(time.mktime(t.timetuple())) * 1000\n if v[3]:\n output_data.append([t_mk] + v[3:6] + [v[1]])\n with open('data.json', 'w') as f:\n json.dump(output_data, f, indent=4)\n '''Get MTX strategy'''\n SQL = \"SELECT Date, OI_Net_Contract FROM II_Fut where Date>='{}' and Fut='MTX'\".format(date_age)\n # cursor.fetchall() will fetch all data\n cursor.execute(SQL)\n export_info = list()\n i = 1\n while 1:\n req = cursor.fetchmany(3)\n if not req:\n break\n else:\n req_array = np.array(req)\n II_contract = req_array[:, 1]\n if req_array[:, 0][0] == req_array[:, 0][1] and req_array[:, 0][0] == req_array[:, 0][-1]:\n Date = req_array[:, 0][-1]\n Sum = req_array[:, 1].astype('int').sum(axis=0)\n if i > 4:\n req_output = np.array(export_info)\n tmp = list(req_output[:, 4][-4:].astype('int'))\n Avg = np.average(tmp + [int(Sum)])\n else:\n Avg = 0\n if i > 5:\n req_output = np.array(export_info)\n pre_Avg = float(req_output[:, 5][-1])\n BS = round(Sum - pre_Avg, 1)\n else:\n BS = 0\n\n dow = datetime.strptime(Date, '%Y/%m/%d').isoweekday()\n export_info.append([Date] + list(II_contract) + [Sum, Avg, BS, dow])\n i += 1\n output_data = list()\n for i in export_info:\n t = datetime.strptime(i[0], '%Y/%m/%d') + timedelta(hours=23)\n t_mk = int(time.mktime(t.timetuple())) * 1000\n output_data.append([t_mk] + i[1:4] + i[5:6])\n with open('data_MTX.json', 'w') as f:\n json.dump(output_data, f, indent=4)\n\nif __name__ == '__main__':\n tools = PraserDataTools()\n '''insert data from csv file(Fut, OP)'''\n #tools.insert_data_from_csv(item='Fut')\n #tools.insert_data_from_csv(item='OP')\n #sys.exit()\n '''insert data from url(SPOT)'''\n #date=date(2020, 3, 23)\n #while date < date.today():\n # date_str=date.strftime('%Y/%m/%d')\n # print(date_str)\n # tools.insert_data_from_url(item='SPOT', date=date_str)\n # date+=timedelta(days=1)\n #sys.exit()\n '''daily to do'''\n '''insert daily data to DB'''\n tools.date = date.today().strftime('%Y/%m/%d')\n #tools.date = date(2023, 3, 20).strftime('%Y/%m/%d')\n tools.insert_data_from_url(item='Fut')\n tools.insert_data_from_url(item='OP')\n tools.insert_data_from_url(item='SPOT')\n tools.strategy_out_put()\n" }, { "alpha_fraction": 0.5966152548789978, "alphanum_fraction": 0.5983290672302246, "avg_line_length": 39.24137878417969, "blob_id": "6d2824db2431e1965d409427fca09d8bb1bcdbb1", "content_id": "751dc9f064375738f6a915a4d58ece28e860c70b", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 4668, "license_type": "no_license", "max_line_length": 154, "num_lines": 116, "path": "/devices/gdrive.py", "repo_name": "luketseng/taifex_daily", "src_encoding": "UTF-8", "text": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\nimport sys, os\nimport logging\nfrom pydrive.auth import GoogleAuth\nfrom pydrive.drive import GoogleDrive\n\n'''\nHomepage: https://pypi.python.org/pypi/PyDrive\nDocumentation: Official documentation on GitHub pages\nGithub: https://github.com/googledrive/PyDrive\nQuickstart: https://pythonhosted.org/PyDrive/quickstart.html\n'''\n\ndef get_logging_moduel():\n global logger\n logger=logging.getLogger(__name__)\n logger.setLevel(logging.INFO)\n\n console=logging.StreamHandler(sys.stdout)\n console.setLevel(logging.INFO)\n formatter=logging.Formatter('%(asctime)s | %(name)s - %(levelname)s - %(message)s')\n console.setFormatter(formatter)\n logger.addHandler(console)\n\nclass gdrive():\n path=os.path.dirname(__file__)\n item_obj={'rpt': None, 'fut_rpt': None, 'opt_rpt': None}\n drive=None\n\n def __init__(self):\n '''init logging'''\n get_logging_moduel()\n\n creds_file_path=os.path.join(self.path, \"mycreds.txt\")\n gauth=GoogleAuth()\n # Try to load saved client credentials\n gauth.LoadCredentialsFile(creds_file_path)\n if gauth.credentials is None:\n # Authenticate if they're not there\n gauth.LocalWebserverAuth()\n elif gauth.access_token_expired:\n # Refresh them if expired\n gauth.Refresh()\n else:\n # Initialize the saved creds\n gauth.Authorize()\n # Save the current credentials to a file\n gauth.SaveCredentialsFile(creds_file_path)\n self.drive=GoogleDrive(gauth)\n\n for key, obj in self.item_obj.items():\n if not obj:\n obj_req=self.getObjByName(key)\n if obj_req!=None and len(obj_req)<2:\n self.item_obj[key]=obj_req[0]\n else:\n assert Fasle, 'obj_req not found or item not only in gdrive'\n logger.info(\"id of '{}' dir: {}\".format(self.item_obj[key]['title'], self.item_obj[key]['id']))\n\n def getObjByName(self, name):\n ## get obj id by file name\n query=\"title='{}' and trashed=false\".format(name)\n query_list=self.drive.ListFile({'q': query}).GetList()\n if len(query_list)>0:\n if len(query_list)>1:\n logger.warning(\"'{}' item not only in gdrive\".format(name))\n return query_list\n else:\n logger.warning(\"'{}' item not found item in gdrive\".format(name))\n return None\n\n def GetContentFile(self, name, path, _mimetype='application/zip'):\n obj_req=self.getObjByName(name)\n if obj_req!=None and len(obj_req)<2:\n ## GetContentFile(): download file(filepath) from gdrive(target_id)\n file_obj=self.drive.CreateFile({'id': obj_req[0]['id']})\n logger.info(\"Downloading '{}' from gdrive\".format(file_obj['title']))\n ## Save Drive file as a local file\n file_obj.GetContentFile(path, mimetype=_mimetype)\n logger.info(\"Finish to Download and save to '{}'\".format(path))\n else:\n logger.error(\"'{}' item not found or not only one in gdrive\".format(name))\n assert False, \"'{}' item not found or not only one in gdrive\".format(name)\n\n def UploadFile(self, path, name, _mimetype='application/zip', recover=True):\n ## Upload(): upload file(file_path) to grive(name)\n dst_obj=self.item_obj.get(name, None)\n\n if dst_obj!=None:\n # delete file if file exist in gdrive\n fname=os.path.basename(path)\n obj=self.getObjByName(fname)\n if obj!=None and recover:\n for i in range(len(obj)):\n logger.info('file({}) exist in gdrive: id={}'.format(obj[i]['title'], obj[i]['id']))\n obj[i].Delete()\n logger.info('Delete all file({}) in gdrive'.format(fname))\n\n # Create GoogleDriveFile instance\n file_obj=self.drive.CreateFile({\"title\": fname, \"parents\": [{\"id\": dst_obj['id']}]})\n file_obj.SetContentFile(path)\n file_obj.Upload()\n logger.info(\"upload local file({}) with mimeType {} to '{}' item of gdrive\".format(file_obj['title'], file_obj['mimeType'], dst_obj['title']))\n else:\n logger.error(\"Unexpected error:\", sys.exc_info()[0])\n assert Fasle, \"'{}' not found gdrive().item_obj\".format(name)\n\n\nif __name__ == '__main__':\n ## funtion library\n #device=gdrive()\n #device.getObjByName(name)\n #device.GetContentFile(src_name, dst_path, _mimetype='application/zip'):\n #device.UploadFile(src_path, dst_name, _mimetype='application/zip'):\n pass\n" }, { "alpha_fraction": 0.6488169431686401, "alphanum_fraction": 0.6874221563339233, "avg_line_length": 24.90322494506836, "blob_id": "a13d5f6f0957c48a123340832ef3320988c8bded", "content_id": "44ab18434b6ea470d1345eb96998f391afbf270a", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 803, "license_type": "no_license", "max_line_length": 89, "num_lines": 31, "path": "/README.md", "repo_name": "luketseng/taifex_daily", "src_encoding": "UTF-8", "text": "taifex_daily\n-------\nThis is project can help for backup history of taifex.\nhttp://zane.myftp.org/~luke/taifex_web/\n\nHow to install\n--------------\n1. You can install PyDrive with regular ``pip`` command.\n\n $ pip install PyDrive\n\n reference url:\n https://github.com/gsuitedevs/PyDrive/blob/master/README.rst\n\n2. Go to APIs Console and make your own project and create certificate.\n\n https://console.cloud.google.com/apis/credentials\n\n3. Download JSON certificate and rename to \"client_secret.json\" in ~/taifex_daily/device/\n\n4. FCT_DB.db store history of taifex in ~/taifex_daily/ (share FCT_DB.db later)\n\nPS. maybe you need to install \"wget\" with ``pip``\n\n $ pip install wget\n\nExample\n--------------\n\n $ ./mining_rpt.py -d 20190101-20190102\n $ ./mining_rpt.py -e TX 300 -d 20190101\n" } ]
4
sidharthkuruvila/SublimeSidharth.package
https://github.com/sidharthkuruvila/SublimeSidharth.package
4034f4ed8c1a071447e0f16376e4067fb489e784
c9dba09a2fc10a9a6aa3d41df5a922a500ecd3fc
f5956044592f6cc7b03af2f712dd3fc5de6d57ef
refs/heads/master
2020-12-24T11:17:28.484063
2016-11-07T08:13:06
2016-11-07T08:13:06
73,040,788
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.5429455637931824, "alphanum_fraction": 0.5462986826896667, "avg_line_length": 29.527559280395508, "blob_id": "9de99ffebdb1b93e9d719cbf1a533a78821a451a", "content_id": "527217af4fc6771356ba8160a3876887d7028b8d", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3877, "license_type": "no_license", "max_line_length": 96, "num_lines": 127, "path": "/vcs_site_link.py", "repo_name": "sidharthkuruvila/SublimeSidharth.package", "src_encoding": "UTF-8", "text": "import sublime_plugin\nimport os.path\nimport re\nimport sublime\n\n\nclass VcsSiteLinkCommand(sublime_plugin.TextCommand):\n\n def row(self, position):\n return self.view.rowcol(position)[0] + 1\n\n def run(self, edit):\n filename = self.view.file_name() \n selection = self.view.sel()\n\n if not filename:\n return\n\n if not len(selection):\n return \n\n region = self.view.sel()[0]\n b = self.row(region.begin())\n e = self.row(region.end())\n vcs_site = self.guess_vcs_site(filename)\n\n if not vcs_site:\n return\n\n sublime.set_clipboard(vcs_site.link(filename, (b, e)))\n\n def guess_vcs_site(self, filename):\n\n def find_remote_origin(config):\n for section, properties in config:\n if section == 'remote \"origin\"':\n props = dict(properties)\n return props\n\n git_dir = self.find_git_dir(filename)\n if not git_dir:\n return\n\n head_ref = open(os.path.join(git_dir, '.git', 'HEAD')).read().strip()[5:]\n commit_id = open(os.path.join(git_dir, '.git', head_ref)).read().strip()\n \n config = parse_git_config(os.path.join(git_dir, '.git', 'config'))\n ro_props = find_remote_origin(config)\n\n\n git_url = ro_props['url']\n if git_url.startswith('git@'):\n project_path = git_url.split(':')[1]\n elif git_url.startswith('https:'):\n project_path = git_url[8:].split('/', 1)[1]\n else:\n return\n\n if 'bitbucket.org' in git_url:\n return BitbucketSite(git_dir, project_path, commit_id)\n elif 'github.com' in git_url:\n return GithubSite(git_dir, project_path, commit_id)\n else:\n return\n\n def find_git_dir(self, filename):\n path = filename\n while(path):\n path = os.path.dirname(path)\n if '.git' in os.listdir(path):\n return path\n\n \nclass BitbucketSite:\n path_tpl = 'https://bitbucket.org/{}/src/{}/{}#Line-{}:{}'\n\n def __init__(self, git_dir, project_path, commit_id):\n self.git_dir = git_dir\n self.project_path = project_path\n self.commit_id = commit_id\n \n def link(self, filename, lines):\n b, e = lines\n file_path = os.path.relpath(filename, start=self.git_dir)\n return self.path_tpl.format(self.project_path, self.commit_id, file_path, b, e)\n\nclass GithubSite:\n path_tpl = 'https://github.com/{}/blob/{}/{}#L{}-L{}'\n\n def __init__(self, git_dir, project_path, commit_id):\n self.git_dir = git_dir\n self.project_path = project_path[:-4] if project_path.endswith(\".git\") else project_path\n self.commit_id = commit_id\n\n def link(self, filename, lines):\n b, e = lines\n file_path = os.path.relpath(filename, start=self.git_dir)\n return self.path_tpl.format(self.project_path, self.commit_id, file_path, b, e)\n\n# Hacky config parser\ndef parse_git_config(filename):\n section_re = re.compile(r\"\\[([^]]*)\\]\")\n property_re = re.compile(r\"\\s*([^=]+)=(.*)\")\n lines = open(filename).readlines()\n def g():\n it = iter(lines)\n\n while True:\n l = next(it).strip()\n m = section_re.match(l)\n if m:\n section = m.group(1)\n break\n\n section_properties = []\n while True:\n l = next(it).strip()\n if property_re.match(l):\n m = property_re.match(l)\n section_properties.append((m.group(1).strip(), m.group(2).strip()))\n elif section_re.match(l):\n yield (section, section_properties)\n section = section_re.match(l).group(1)\n section_properties = []\n\n yield (section, section_properties)\n return list(g())\n" }, { "alpha_fraction": 0.6594827771186829, "alphanum_fraction": 0.6616379022598267, "avg_line_length": 30, "blob_id": "0937be62a264ad9ef205fac04a2837c6be2cf445", "content_id": "fef6672bd930af985c759343c8541ea7dc298258", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 464, "license_type": "no_license", "max_line_length": 141, "num_lines": 15, "path": "/README.md", "repo_name": "sidharthkuruvila/SublimeSidharth.package", "src_encoding": "UTF-8", "text": "Some useful Sublime extentions I've written\n===========================================\n\nInstallation on OSX\n-------------------\n\n cd ~/Library/Application\\ Support/Sublime\\ Text\\ 3/Packages\n git clone https://github.com/sidharthkuruvila/SublimeSidharth.package.git\n\nCommands\n--------\n\n### Sidharth: VCS Site Link\n\nThe command pushes a link to the bit bucket page for the currnent file into the clipboard. The link includes the cursor position information." } ]
2
NitinJRepo/Python
https://github.com/NitinJRepo/Python
a50ba7d689163ebd67ce22659ff0e8af736c8664
d78aefb13a05b851eac0c23c37664f3f11e0c2b4
cd0a515f511f6df2222dcf3f5a4f3331ce15d504
refs/heads/master
2022-03-26T05:50:24.347132
2019-12-25T05:40:44
2019-12-25T05:40:44
197,949,885
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.5464725494384766, "alphanum_fraction": 0.606942892074585, "avg_line_length": 36.25, "blob_id": "3698fdfcbc8cf0dbe48e09fd2049a497a494f0ed", "content_id": "cba8c46b24f0ac508fa69c8f6c7caa25f2902675", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 893, "license_type": "no_license", "max_line_length": 119, "num_lines": 24, "path": "/NumPy/argmax-example.py", "repo_name": "NitinJRepo/Python", "src_encoding": "UTF-8", "text": "# argmax() returns the position of the largest value. \n\nimport numpy as np\n\nA = np.matrix([[1,2,3,33],[4,5,6,66],[7,8,9,99]])\n\nprint(\"Input matrix: \\n\", A)\n\nprint(\"np.argmax(A) = \", np.argmax(A)) # 11, which is the position of 99\n\nprint(\"np.argmax(A[:,:]) = \", np.argmax(A[:,:])) # 11, which is the position of 99\n\nprint(\"np.argmax(A[:1]) = \", np.argmax(A[:1])) # 3, which is the position of 33 (from resulted matrix: [[1,2,3,33]])\n\nprint(\"np.argmax(A[:,2]) = \", np.argmax(A[:,2])) # 2, which is the position of 9 (from resulted matrix: [[3],[6],[9]])\n\nprint(\"np.argmax(A[1:,2]) = \", np.argmax(A[1:,2])) # 1, which is the position of 9 (from resulted matrix: [[6],[9]])\n\n\n# When parameter is axis = 0 (row-wise operation)\nprint(\"np.argmax(A, axis=0) = \", np.argmax(A, axis=0))\n\n# When parameter is axis = 1 (column-wise operation)\nprint(\"np.argmax(A, axis=1) = \\n\", np.argmax(A, axis=1))" }, { "alpha_fraction": 0.680272102355957, "alphanum_fraction": 0.6893423795700073, "avg_line_length": 23.44444465637207, "blob_id": "c130df0c898bafb50199e2adad559d7c51bab5b8", "content_id": "f6f7fa8d0a2a3f8b3efc4a2b6ff2cb6e3a2ab7f5", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 441, "license_type": "no_license", "max_line_length": 50, "num_lines": 18, "path": "/Dictionary/4-dictionary-accessing-elements.py", "repo_name": "NitinJRepo/Python", "src_encoding": "UTF-8", "text": "# Python program to demonstrate \n# accesing a element from a Dictionary \n\n# Creating a Dictionary \nDict = {1: 'Hello', 'name': 'Nitin', 3: 'How are you'} \n\n# accessing a element using key \nprint(\"Acessing a element using key:\") \nprint(Dict[1]) \n\n# accessing a element using key \nprint(\"Acessing a element using key:\") \nprint(Dict['name']) \n\n# accessing a element using get() \n# method \nprint(\"Acessing a element using get:\") \nprint(Dict.get(3)) \n" }, { "alpha_fraction": 0.6638206839561462, "alphanum_fraction": 0.676627516746521, "avg_line_length": 25.714284896850586, "blob_id": "68cf0e90fb89db90343e45c254758e0be9b42219", "content_id": "839fd85e3e74b86b54cc6d713ec8fbd53ab39e2c", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 941, "license_type": "no_license", "max_line_length": 134, "num_lines": 35, "path": "/zip-in-python.py", "repo_name": "NitinJRepo/Python", "src_encoding": "UTF-8", "text": "# zip() in python\n# The purpose of zip() is to map the similar index of multiple containers so that they can be used just using as single entity. \n\n# Initializing the list\nname = [\"Nitin\", \"Nikit\", \"Nikhil\", \"Nitesh\"]\nroll_no = [ 4, 1, 3, 2 ] \nmarks = [ 40, 50, 60, 70 ]\n\n# using zip() to map values \nmapped = zip(name, roll_no, marks)\n\nprint(\"zipped object = \", mapped)\n\n# converting values to print as list \nmapped = list(mapped) \n\n# converting values to print as set \n# mapped = set(mapped)\n\n# printing resultant values \nprint (\"The zipped result is : \") \nprint (mapped)\n\n# How to unzip?\n# Unzipping means converting the zipped values back to their original format as they were. This is done with the help of “*” operator.\n\n# unzipping values \nname_, roll_no_, marks_ = zip(*mapped)\n\n# printing initial lists \nprint(\"The name list is : \", name_) \n\nprint(\"The roll_no list is :\", roll_no_) \n \nprint(\"The marks list is : \", marks_) \n\n" }, { "alpha_fraction": 0.6535714268684387, "alphanum_fraction": 0.6946428418159485, "avg_line_length": 20.576923370361328, "blob_id": "e26b4907ebebe780fc61f02aaf61ae346a3dae6e", "content_id": "c5b5227fa514f6a9b5b78783a389c3e06c521bca", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 560, "license_type": "no_license", "max_line_length": 91, "num_lines": 26, "path": "/Pandas/02-dataframe.py", "repo_name": "NitinJRepo/Python", "src_encoding": "UTF-8", "text": "# Sample program for pandas DataFrame and Series\nimport numpy as np\nimport pandas as pd\n\nmyarray = np.array([[1, 2, 3], [4, 5, 6]])\n\nrownames = ['R1', 'R2']\ncolnames = ['C1', 'C2', 'C3']\n\n#DataFrame\nmydataframe = pd.DataFrame(myarray, index=rownames, columns=colnames)\n\nprint(mydataframe)\n\n\nmyarray2 = np.array([7, 8, 9])\nrownames2 = ['R1', 'R2', 'R3']\n\n#Series\nmyseries = pd.Series(myarray2, index=rownames2)\n\nprint(myseries)\n\n#You can access the data in a series like a NumPy array and like a dictionary, for example:\nprint(myseries[0])\nprint(myseries['R1'])" }, { "alpha_fraction": 0.8260869383811951, "alphanum_fraction": 0.8260869383811951, "avg_line_length": 22, "blob_id": "ca181d44fd4fa579d9221cec2a3872cebcafaadd", "content_id": "91be18bed4b9d97a45b4d4a5b25302e1a210208e", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 46, "license_type": "no_license", "max_line_length": 36, "num_lines": 2, "path": "/README.md", "repo_name": "NitinJRepo/Python", "src_encoding": "UTF-8", "text": "# Python\nRepository for basic Python programs\n" }, { "alpha_fraction": 0.6402438879013062, "alphanum_fraction": 0.6600610017776489, "avg_line_length": 23.259260177612305, "blob_id": "20cecd0ec5bb7476b91b63b1772b6e891f8b5bbe", "content_id": "3ecc82a1ec099a757fe655235645651e5a36c2da", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 656, "license_type": "no_license", "max_line_length": 73, "num_lines": 27, "path": "/Dictionary/3-dictionary-adding-updating-values.py", "repo_name": "NitinJRepo/Python", "src_encoding": "UTF-8", "text": "# Creating an empty Dictionary \nDict = {} \nprint(\"Empty Dictionary: \") \nprint(Dict) \n\n# Adding elements one at a time \nDict['brand'] = 'Nexa'\nDict['model'] = 'Swift Desire'\nDict['year'] = 2019\nprint(\"\\nDictionary after adding 3 elements: \") \nprint(Dict) \n\n# Adding set of values \n# to a single Key \nDict['Value_set'] = 2, 3, 4\nprint(\"\\nDictionary after adding 3 elements: \") \nprint(Dict) \n\n# Updating existing Key's Value \nDict['model'] = 'Baleno'\nprint(\"\\nUpdated key value: \") \nprint(Dict) \n\n# Adding Nested Key value to Dictionary \nDict['nested_values'] = {'nested_key' :{'1' : 'value1', '2' : 'value2'}} \nprint(\"\\nAdding a Nested Key: \") \nprint(Dict) \n" }, { "alpha_fraction": 0.7426376342773438, "alphanum_fraction": 0.7573623657226562, "avg_line_length": 46.3636360168457, "blob_id": "6d3617c3a22f3fac826db100a7ffa32aba030dee", "content_id": "4152fa2b069a59b101afe22aaea0c3efaab148da", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1568, "license_type": "no_license", "max_line_length": 156, "num_lines": 33, "path": "/NumPy/random-seed.py", "repo_name": "NitinJRepo/Python", "src_encoding": "UTF-8", "text": "# A pseudo-random number is a computer-generated random number.\n# These numbers are not random, and are in fact completely determined by the algorithm. If you run the same code again, you’ll get the exact same numbers. \n# computers and algorithms process inputs into outputs. The outputs of computers depend on the inputs.\n# So just like any output produced by a computer, pseudo-random numbers are dependent on the input.\n#\n# The numpy.random.seed function provides the input (i.e., the seed) to the algorithm that generates pseudo-random numbers in NumPy.\n# Importantly, numpy.random.seed doesn’t exactly work all on its own.\n# The numpy.random.seed function works in conjunction with other functions from NumPy.\n# Specifically, numpy.random.seed works with other functions from the numpy.random namespace.\n# Example: numpy.random.randint\n#\n# np.random.seed() makes your code repeatable also makes is easier to share.\n# \n\nimport numpy as np\n\nnp.random.seed(5)\nvar = np.random.randint(low = 1, high = 10, size = 50)\n\nprint(var)\n\n# You can use numpy.random.seed(0), or numpy.random.seed(42), or any other number.\n# For the most part, the number that you use inside of the function doesn’t really make a difference.\n# You just need to understand that using different seeds will cause NumPy to produce different pseudo-random numbers.\n# The output of a numpy.random function will depend on the seed that you use.\n\nnp.random.seed(0)\nv1 = np.random.randint(99, size = 5)\nprint(\"v1 = \", v1)\n\nnp.random.seed(1)\nv2 = np.random.randint(99, size = 5)\nprint(\"v2 = \", v2)" }, { "alpha_fraction": 0.6142857074737549, "alphanum_fraction": 0.6612244844436646, "avg_line_length": 19.41666603088379, "blob_id": "391786ba3f043dd9a40c962df5ad23c3c74d4e49", "content_id": "6e875f58574894323f5af60f6a3d8c18c11719d1", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 490, "license_type": "no_license", "max_line_length": 49, "num_lines": 24, "path": "/NumPy/Numpy-array-example.py", "repo_name": "NitinJRepo/Python", "src_encoding": "UTF-8", "text": "#NumPy array\n# access values\n\nimport numpy\n\nmylist = [[1, 2, 3], [3, 4, 5]]\n\nmyarray = numpy.array(mylist)\n\nprint(myarray)\nprint(\"Shape of array\", myarray.shape)\n\nprint(\"First row: \", myarray[0])\nprint(\"Last row: \", myarray[-1])\n\nprint(\"Specific row and column: \", myarray[0, 2])\nprint(\"Whole column: \", myarray[:, 2])\n\n# arithmetic\nmyarray1 = numpy.array([2, 2, 2])\nmyarray2 = numpy.array([3, 3, 3])\n\nprint(\"Addition: \", myarray1 + myarray2)\nprint(\"Multiplication: \", myarray1 * myarray2)\n" }, { "alpha_fraction": 0.6178521513938904, "alphanum_fraction": 0.6401673555374146, "avg_line_length": 24.571428298950195, "blob_id": "22afefa9f19c238ea51b9f154ce412decf573157", "content_id": "7d56475ac3fb47255ea84b00fe017569afa89e3e", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 717, "license_type": "no_license", "max_line_length": 53, "num_lines": 28, "path": "/Dictionary/1-dictionary.py", "repo_name": "NitinJRepo/Python", "src_encoding": "UTF-8", "text": "# Creating an empty Dictionary \nDict = {} \nprint(\"Empty Dictionary: \") \nprint(Dict) \n\n# Creating a Dictionary \n# with Integer Keys \nDict = {1: 'Nitin', 2: 'Nilesh', 3: 'Nitesh'} \nprint(\"\\nDictionary with the use of Integer Keys: \") \nprint(Dict) \n\n# Creating a Dictionary \n# with Mixed keys \nDict = {'Name': 'Nitin', 1: [1, 2, 3, 4]} \nprint(\"\\nDictionary with the use of Mixed Keys: \") \nprint(Dict) \n\n# Creating a Dictionary \n# with dict() method \nDict = dict({1: 'book1', 2: 'book2', 3:'book3'}) \nprint(\"\\nDictionary with the use of dict(): \") \nprint(Dict) \n\n# Creating a Dictionary \n# with each item as a Pair \nDict = dict([(1, 'C++'), (2, 'Python')]) \nprint(\"\\nDictionary with each item as a pair: \") \nprint(Dict) \n" }, { "alpha_fraction": 0.6393805146217346, "alphanum_fraction": 0.6626105904579163, "avg_line_length": 26.363636016845703, "blob_id": "5483d07c82773eddb1646c7c39ac8df605e4d0fd", "content_id": "a756d644f468c14ed481d97188e3dd0cb24a0bfe", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 904, "license_type": "no_license", "max_line_length": 83, "num_lines": 33, "path": "/Dictionary/5-dictionary-removing-elements.py", "repo_name": "NitinJRepo/Python", "src_encoding": "UTF-8", "text": "# Initial Dictionary \nDict = { 5 : 'Value-5', 6 : 'Value-6', 7 : 'Value-7', \n\t\t'A' : {1 : 'Value-1', 2 : 'Value-2', 3 : 'Value-3'}, \n\t\t'B' : {1 : 'Value-4', 2 : 'Value-5'}} \nprint(\"Initial Dictionary: \") \nprint(Dict) \n\n# Deleting a Key value \ndel Dict[6] \nprint(\"\\nDeleting a specific key: \") \nprint(Dict) \n\n# Deleting a Key from Nested Dictionary \ndel Dict['A'][2] \nprint(\"\\nDeleting a key from Nested Dictionary: \") \nprint(Dict) \n\n# Deleting a Key using pop() \nDict.pop(5) \nprint(\"\\nPopping specific element: \") \nprint(Dict) \n\n# Deleting Key-value pair using popitem() \n# The popitem() method removes the item that was last inserted into the dictionary.\n# In versions before 3.6, the popitem() method removes a random item. The removed i\nDict.popitem() \nprint(\"\\nPops a key-value pair: \") \nprint(Dict) \n\n# Deleting entire Dictionary \nDict.clear() \nprint(\"\\nDeleting Entire Dictionary: \") \nprint(Dict) \n" }, { "alpha_fraction": 0.5403726696968079, "alphanum_fraction": 0.5590062141418457, "avg_line_length": 25.66666603088379, "blob_id": "387fd456437a5f75a9723a1f9aee2b04bb5a5de2", "content_id": "9445b02c82fa6fc3a779c9987bed0e73834e73e9", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 161, "license_type": "no_license", "max_line_length": 50, "num_lines": 6, "path": "/Dictionary/2-dictionary-nested.py", "repo_name": "NitinJRepo/Python", "src_encoding": "UTF-8", "text": "# Creating a Nested Dictionary \n# as shown in the below image \nDict = {1: 'Hello', 2: 'Nitin', \n\t\t3:{'A' : 'Welcome', 'B' : 'To', 'C' : 'India'}} \n\nprint(Dict) \n" } ]
11
riley-martine/calc
https://github.com/riley-martine/calc
dc21a4a9e1e4659d0f071c669822f4a2285b4f58
6fa7cd7b3ad9a8a61536e03497ca58e23167277a
fa30d8c3e17bd88a179549ef84c53ffe6714d7a9
refs/heads/master
2021-09-03T23:19:10.755242
2018-01-12T18:33:29
2018-01-12T18:33:29
113,352,451
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.5671296119689941, "alphanum_fraction": 0.5972222089767456, "avg_line_length": 17, "blob_id": "30a095f3ed1e464b4d7271cb7e4e9f1f990895d0", "content_id": "94c5bf01ef91bee6738712765bfeeb94fe983797", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 434, "license_type": "no_license", "max_line_length": 61, "num_lines": 24, "path": "/eulerpdf.py", "repo_name": "riley-martine/calc", "src_encoding": "UTF-8", "text": "import numpy as np\nfrom matplotlib import pyplot as plt\n\nxz = 0\nyz = 1\nxf = 10\nn = 101\ndeltax = (xf-xz) / (n-1)\n\nx = np.linspace(xz, xf, n)\n\ny = np.zeros([n])\ny[0] = yz\nfor i in range (1, n):\n y[i] = deltax *(-y[i-1] + np.sin(x[i-1]))+y[i-1]\n\nfor i in range (n):\n print(x[i], y[i])\n\nplt.plot(x, y, 'o')\nplt.xlabel(\"Value of x\")\nplt.ylabel(\"Value of y\")\nplt.title(\"Approximate Solution with Forward Euler’s Method\")\nplt.show()\n" }, { "alpha_fraction": 0.5243309140205383, "alphanum_fraction": 0.5543389916419983, "avg_line_length": 24.163265228271484, "blob_id": "f2ac2b23f2869844b5b65ff10be220868a567c5c", "content_id": "b21a965fa3ae72c3305362f12fd2e3200a03b70e", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2466, "license_type": "no_license", "max_line_length": 88, "num_lines": 98, "path": "/integral_estimation.py", "repo_name": "riley-martine/calc", "src_encoding": "UTF-8", "text": "\"\"\"Program for calculating Riemann sums of functions over intervals.\"\"\"\nfrom math import sin, pi, cos, log, e, sqrt\nimport matplotlib.pyplot as plt\nimport matplotlib.patches as patches\nimport numpy as np\nimport sys\n\nfunc = lambda t: ((1.4*e)**(0.02*t))+(cos(2*t))**2\nfunc = lambda t: -25*log(t+1)+120\ndivisions = 10\nspace = (0, 30)\ndivs, divsize = np.linspace(space[0], space[1], divisions, retstep=True)\n\n\ndef trap_area(b1, b2, h):\n return 0.5*(b1+b2)*h\n\nt = np.linspace(space[0], space[1], 1000)\ns = [func(x) for x in t]\n\nfig, ((ax1, ax2), (ax3, ax4)) = plt.subplots(nrows=2, ncols=2, sharex=True, sharey=True)\nfor ax in (ax1, ax2, ax3, ax4):\n ax.plot(t, s)\n\n\n# PLOT LHS\nlhs = 0\nfor divstart in divs:\n lhs += func(divstart)*divsize\n ax1.add_patch(\n patches.Rectangle(\n (divstart, 0), # (x, y)\n divsize, # width\n func(divstart), # height\n fill=False,\n )\n )\nlhs_str = \"Left Hand Sum: \" + str(round(lhs, 4))\nprint(lhs_str)\nax1.set_title(lhs_str)\n\n#PLOT RHS\nrhs = 0\nfor divstart in divs[:-1]:\n rhs += func(divstart+divsize)*divsize\n ax2.add_patch(\n patches.Rectangle(\n (divstart, 0), # (x, y)\n divsize, # width\n func(divstart+divsize), # height\n fill=False,\n )\n )\nrhs_str = \"Right Hand Sum: \" + str(round(rhs, 4))\nprint(rhs_str)\nax2.set_title(rhs_str)\n\n#PLOT MIDPOINT\nmid = 0\nfor divstart in divs[:-1]:\n midpoint = divstart + 0.5*divsize\n mid += func(midpoint)*divsize\n ax3.add_patch(\n patches.Rectangle(\n (divstart, 0), # (x, y)\n divsize, # width\n func(divstart+0.5*divsize), # height\n fill=False,\n )\n )\nmid_str = \"Midpoint Sum: \" + str(round(mid, 4))\nprint(mid_str)\nax3.set_title(mid_str)\n\n# PLOT TRAPEZOID\ntrp = 0\nfor divstart in divs[:-1]:\n b1 = func(divstart)\n b2 = func(divstart+divsize)\n h = divsize\n trp += trap_area(b1, b2, h)\n points = [\n (divstart+divsize, func(divstart+divsize)),\n (divstart+divsize, 0),\n (divstart, 0),\n (divstart, func(divstart)),\n ]\n ax4.add_patch(\n patches.Polygon(\n points,\n fill=False,\n )\n )\ntrp_str = \"Trap Sum: \" + str(round(trp, 4))\nprint(trp_str) # can also find with avg(lhs, rhs) but that's not as fun\nax4.set_title(trp_str)\n\nplt.show()\n" }, { "alpha_fraction": 0.4765625, "alphanum_fraction": 0.517578125, "avg_line_length": 18.69230842590332, "blob_id": "f8185cd9afa35607b10a79eaccbe54f107c4c1f0", "content_id": "ce1e76c4f63fa7875333dab16093c441b992b774", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 512, "license_type": "no_license", "max_line_length": 40, "num_lines": 26, "path": "/euler_rosetta.py", "repo_name": "riley-martine/calc", "src_encoding": "UTF-8", "text": "import matplotlib.pyplot as plt\nplt.style.use('seaborn')\n\ndef euler(f,y0,a,b,h):\n t,y = a,y0\n out = [(t, y)]\n while t <= b:\n #print(\"%6.3f %6.3f\" % (t,y))\n t += h\n y += h * f(t,y)\n out.append( (t, y) )\n return out\n\n\ndef cooling(time, temp):\n\treturn -0.25*(temp-70)\n\ndef plot_points(vals):\n plt.xlabel('x'); plt.ylabel('y')\n plt.plot(vals, 'bo-')\n #for tup in vals:\n # plt.plot(tup[0], tup[1], 'bo')\n plt.show()\n\n\nplot_points(euler(cooling, 120,0,100,1))\n" }, { "alpha_fraction": 0.35175880789756775, "alphanum_fraction": 0.41206029057502747, "avg_line_length": 28.462963104248047, "blob_id": "312441788a3ba28f908ca0310ec125a74efe0c33", "content_id": "5bf848f75f4881aae5b50af007584f43535d9651", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1592, "license_type": "no_license", "max_line_length": 84, "num_lines": 54, "path": "/sec.py", "repo_name": "riley-martine/calc", "src_encoding": "UTF-8", "text": "from aroc import aroc\nfrom math import sqrt, log10, floor, sin\nfrom tabulate import tabulate\nfrom functions import get_source, round_sig\n\n\n\ndef power(x, power):\n if x >= 0:\n return x**power\n else:\n return -(-x)**power\n\n\nif __name__ == \"__main__\":\n values = [1, 0.1, 0.01, 0.001, -0.001, -0.01, -0.1, -1]\n # values = [2, 1, .5, .01, 0.00000001, -.01, -.5, -1, -2]\n functions = [\n (lambda x: x**2, .5),\n (lambda x: .5*sin(x)+2, 0),\n (lambda x: 1/x, -4),\n (lambda x: power(x, (1./3.)), 0),\n (lambda x: (power((x-1), (2./3))) - x, 1),\n (lambda x: (power((x-1), (2./3))) - x, 0),\n (lambda x: ((-3*abs(x+2))+6), 2),\n (lambda x: (-3*abs(x+2))+6, -2),\n (lambda x: sqrt(x), 9),\n ]\n\n for row in functions:\n f, x1 = row\n d = []\n for h in values:\n x2 = x1+h\n m = aroc(f, x1, x2)\n m = round_sig(m, 4)\n #b = f(x1) - (m * x1)\n #b = round_sig(b, 4)\n #print(f\"h = {h}\")\n #print(f\"m = {m}\")\n d.append( (h, (x1, round_sig(f(x1), 4)), (x2, round_sig(f(x2), 4)), m) )\n #print(f\"Line equation: y={m}x+({b})\")\n #print('------------------------------')\n \n print('\\n')\n print(get_source(f))\n print(tabulate(d, headers=[\"delta x\", \"(x1, f(x1)\", \"x2, f(x2)\", \"AROC\"]))\n \n\n # while True:\n # x1, x2 = [float(x) for x in input(\"x1, x2: \").split(', ')]\n # m = aroc(f, x1, x2)\n # b = f(x1) - (m * x1)\n # print(f\"Line equation: y={m}x+{b}\")\n\n" }, { "alpha_fraction": 0.5, "alphanum_fraction": 0.5147058963775635, "avg_line_length": 20.25, "blob_id": "75cb73c1450725c393cd1283913093bad184fa19", "content_id": "3266cbe631e41cfe839174784d89160f78d619d5", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 340, "license_type": "no_license", "max_line_length": 64, "num_lines": 16, "path": "/aroc.py", "repo_name": "riley-martine/calc", "src_encoding": "UTF-8", "text": "import sys\nimport math\n\ndef d(x):\n return x**x\n #return (.2 * (x**3)) - (3 * x)\n\ndef aroc(func, start, end):\n deltad = func(end) - func(start)\n deltax = end - start\n return deltad/deltax\n\nif __name__ == \"__main__\":\n while True:\n s, e = [float(x) for x in input(\"X1, X2: \").split(', ')]\n print(aroc(d, s, e))\n" }, { "alpha_fraction": 0.4730290472507477, "alphanum_fraction": 0.5020747184753418, "avg_line_length": 16.214284896850586, "blob_id": "4e28f3b0984b46e85b145152d18ab684ebbd9308", "content_id": "d2bac65b2bf834f349c80d82150031e5d0119a32", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 241, "license_type": "no_license", "max_line_length": 45, "num_lines": 14, "path": "/slopefield.py", "repo_name": "riley-martine/calc", "src_encoding": "UTF-8", "text": "from tabulate import tabulate\n\ndef f(x, y):\n if y == 0:\n return 0\n return (2*x)/y\n\n\nout = []\nfor i in range(-6, 7):\n for j in range(-6, 7):\n out.append( (i, j, f(i, j)) )\n\nprint(tabulate(out, headers=[\"x\", \"y\", \"m\"]))\n" }, { "alpha_fraction": 0.6408045887947083, "alphanum_fraction": 0.6839080452919006, "avg_line_length": 25.615385055541992, "blob_id": "e709f7c404ebfe31c3b5ac202f8cfd16ed3088f5", "content_id": "6467021363f9b4ff2720c70540cfebf0ebdc4ba3", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 348, "license_type": "no_license", "max_line_length": 52, "num_lines": 13, "path": "/wolf.py", "repo_name": "riley-martine/calc", "src_encoding": "UTF-8", "text": "import wolframalpha\n\nclient = wolframalpha.Client(\"TP9TEK-3EUL4W3A6L\")\n\n#equation = input(\"Give me an equation: \")\n#equation = \"lim x->infinity x*e^(-2x)\"\nequation = \"11x+18=172\"\nparams = (\n ('podstate', 'Solution__Step-by-step+solution'),\n)\nres = client.query(f\"{equation}\", params=params)\nres2 = client.query(f\"{equation}\")\nprint(res==res2)\n\n\n" }, { "alpha_fraction": 0.45781776309013367, "alphanum_fraction": 0.46681663393974304, "avg_line_length": 23.63888931274414, "blob_id": "9f34bf9aabad11408c365885c6076610a4b50671", "content_id": "d08c55abc6a4dce82c86e05da454eebae4d4ff2c", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 889, "license_type": "no_license", "max_line_length": 57, "num_lines": 36, "path": "/tan.py", "repo_name": "riley-martine/calc", "src_encoding": "UTF-8", "text": "from iroc import iroc\nfrom functions import round_sig\nfrom graphmpl import graph_funcs\nfrom math import log, cos, pi, sqrt\n\ndef f(x):\n return sqrt(x*log(3*x-2))\n\ndef tangent(f, x):\n m = iroc(f, x)\n b = f(x) - m*x\n return lambda a: m*a + b\n\nif __name__ == \"__main__\":\n while True:\n x = eval(input(\"Tangent to function at point: \"))\n tan_func = tangent(f, x)\n \n m = round_sig(iroc(f, x), 4)\n b = round_sig(f(x) - m*x, 4)\n if b < 0:\n op = '-'\n else:\n op = '+'\n b = abs(b)\n print(f\"Function: y = {m}x {op} {b}\")\n graph_funcs([f, tan_func], min=1, max=10)\n\n\n #do_break = False\n # while not do_break:\n # try:\n # a = int(input(\"X on tangent line: \"))\n # print(tan_func(a))\n # except EOFError:\n # do_break = True\n\n\n" }, { "alpha_fraction": 0.5251951813697815, "alphanum_fraction": 0.5443577170372009, "avg_line_length": 20.33333396911621, "blob_id": "79a7bcfed756caa42a0decd1feb00c7524cd2594", "content_id": "2d2c53f53576eec3e0a515ab45573768d78d0946", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1409, "license_type": "no_license", "max_line_length": 53, "num_lines": 66, "path": "/symple.py", "repo_name": "riley-martine/calc", "src_encoding": "UTF-8", "text": "from sympy import *\nfrom math import sqrt\nimport matplotlib.pyplot as plt\nimport numpy as np\nplt.style.use('fivethirtyeight')\ninit_printing(use_unicode=True)\nx, y, z, t = symbols('x y z t')\nA = symbols('A')\nk, m, n = symbols('k m n', integer=True)\nf, g, h = symbols('f, g, h', cls=Function)\n\n\n#expr = x**2 - (A/x)\n#expr = x+( (24- (x**2 -49)**(1/2))**2 +25)**(1/2)\n#der = diff(expr, x)\n#print(der)\n\ndef iroc(expr, xval):\n der = diff(expr)\n roc = der.subs(x, xval)\n return roc\n\n\ndef tangent(expr, xval):\n \"\"\"Get tangent line of y=expr(x) at x=xval.\"\"\"\n x = Symbol('x')\n slope = iroc(expr, xval)\n expr = expr.subs(x, xval)\n b = expr - slope*xval\n return slope*x + b\n\n\ndef eulers(expr, x_val, y_val, step_size, step_iter):\n \"\"\"\n expr: an equation of the form dy/dx=expr\n \"\"\"\n\n\n x = Symbol('x')\n y = Symbol('y')\n\n steps = [(x_val, y_val)]\n for step in range(step_iter):\n iroc = expr.subs(x, x_val)\n iroc = iroc.subs(y, y_val)\n \n x_val = x_val + step_size\n y_val = y_val + step_size*iroc\n steps.append( (x_val, y_val) )\n return steps\n\n\ndef plot_points(vals):\n plt.xlabel('x'); plt.ylabel('y')\n for tup in vals:\n plt.plot(tup[0], tup[1], 's-')\n plt.show()\n\n\nexpr = -0.25*(x-70)\n\nplot_points(eulers(expr=expr,\n x_val=0,\n y_val=120,\n step_size=1,\n step_iter=10))\n\n" }, { "alpha_fraction": 0.49367088079452515, "alphanum_fraction": 0.5316455960273743, "avg_line_length": 17.230770111083984, "blob_id": "673cba1538c1010653a2b0418049c46417a2e6a1", "content_id": "4d2bdeb4c67679bad1690ff16a35e749f369a44c", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 237, "license_type": "no_license", "max_line_length": 36, "num_lines": 13, "path": "/iroc.py", "repo_name": "riley-martine/calc", "src_encoding": "UTF-8", "text": "from aroc import aroc\nfrom math import sqrt\n\ndef f(x):\n return x**x\n\ndef iroc(f, x):\n return aroc(f, x, x+0.00000001)\n\nif __name__ == '__main__':\n while True:\n x = float(input(\"x: \"))\n print(\"IROC: \", iroc(f, x))\n" }, { "alpha_fraction": 0.5522388219833374, "alphanum_fraction": 0.5820895433425903, "avg_line_length": 19.615385055541992, "blob_id": "5818fe449e819cf81841026a23bb6ba87ded4fec", "content_id": "e6516ecd1f84a4591d78f4f70f7e78a60ef914ae", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 536, "license_type": "no_license", "max_line_length": 52, "num_lines": 26, "path": "/functions.py", "repo_name": "riley-martine/calc", "src_encoding": "UTF-8", "text": "from inspect import getsource\nfrom math import floor, log10\n\ndef get_source(f):\n return getsource(f).strip()\n\ndef round_sig(x, sig=2):\n if x == 0:\n return x\n if isinstance(x, complex):\n return \"Complex\"\n return round(x, sig-int(floor(log10(abs(x))))-1)\n\ndef get_range_float(min, max, step):\n curr = min\n while curr <= max:\n yield round_sig(curr, 4)\n curr += step\n\n\n\n\nif __name__ == '__main__':\n f = lambda x: x**2\n print(get_source(f))\n print(list(get_range_float(-10, 10, 0.01)))\n" }, { "alpha_fraction": 0.5973597168922424, "alphanum_fraction": 0.6149615049362183, "avg_line_length": 19.200000762939453, "blob_id": "f9c211c1add0df85b5e4b5d68cd6aee336c26358", "content_id": "2799e5a81b4ee9ec71bcfa955819fd792b458cb4", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 909, "license_type": "no_license", "max_line_length": 49, "num_lines": 45, "path": "/graphmpl.py", "repo_name": "riley-martine/calc", "src_encoding": "UTF-8", "text": "import matplotlib.pyplot as plt\n\nfrom functions import get_range_float, get_source\n#from tan import tangent\nfrom math import pi, cos\nfrom numpy import linspace\n\n# API scratchpad:\n# \n# Things that can be done:\n# * add function to graph\n# * show graph\n\n\n\ndef add_func(f, min=-10, max=10):\n print(get_source(f))\n x_vals = linspace(min, max, num=100)\n y_vals = [f(x) for x in x_vals]\n plt.plot(x_vals, y_vals)\n\n\ndef show_graph():\n plt.axhline(color='black')\n plt.axvline(color='black')\n plt.show()\n\\\ndef make_graph(f, min=-10, max=10):\n add_func(f, min, max)\n show_graph()\n\ndef graph_funcs(funclist, min=-10, max=10):\n for func in funclist:\n add_func(func, min, max)\n show_graph()\n\nif __name__ == \"__main__\":\n from derivative import der\n f = lambda x: cos(x)\n d = der(f)\n # t = tangent(f, pi/2)\n add_func(f)\n add_func(d)\n # add_func(t)\n show_graph()\n" }, { "alpha_fraction": 0.4598338007926941, "alphanum_fraction": 0.4944598376750946, "avg_line_length": 22.25806427001953, "blob_id": "c89d3ba80185e9f221e2c7aef51b9de42bf12904", "content_id": "c383ab6e6a97984462ca310ca1d96684699c23dd", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 722, "license_type": "no_license", "max_line_length": 52, "num_lines": 31, "path": "/derivative.py", "repo_name": "riley-martine/calc", "src_encoding": "UTF-8", "text": "from functions import round_sig, get_source\nfrom iroc import iroc\nfrom math import sqrt, log\n\ndef sec(f, a, h):\n # Slope of secant line\n m = (f(a+h) - f(a))/h\n return lambda x: (m*(x-a))+f(a)\n\ndef der(f):\n verysmall = 0.000000001\n return lambda x: (f(x+verysmall)-f(x))/verysmall\n\nif __name__ == '__main__':\n def f(x):\n return sqrt(x*log(3*x-2))\n\n # Inital value\n a = 1\n # Delta x\n h = 0.001\n s = sec(f, a, h)\n print(get_source(f))\n for i in range(1, 10):\n val = round_sig(s(i), 4)\n print(f'i: {i}, s(i): {val}')\n print('---------------------')\n d = der(f)\n for i in range(1, 10):\n val = round_sig(d(i), 4)\n print(f'i: {i}, d(i): {val}')\n\n" }, { "alpha_fraction": 0.5752032399177551, "alphanum_fraction": 0.6036585569381714, "avg_line_length": 23.600000381469727, "blob_id": "fbe85c53444afd67a049627846acb3647715da45", "content_id": "42ed162fcbf9e8bcf9f1f78f878a8edfc3fd6cc0", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 984, "license_type": "no_license", "max_line_length": 75, "num_lines": 40, "path": "/graph_func.py", "repo_name": "riley-martine/calc", "src_encoding": "UTF-8", "text": "import plotly.plotly as py\nimport plotly.graph_objs as go\nfrom plotly.offline import download_plotlyjs, plot\n\nimport numpy as np\n\nfrom functions import round_sig, get_range_float\n\n\ndef get_graph_func(f, min=-100, max=100, step=1):\n y_values = []\n for x in get_range_float(min, max, step):\n try:\n y_values.append(f(x))\n except ZeroDivisionError:\n pass\n\n x_values = [x for x in range(min, max, step)]\n\n trace = go.Scatter(\n x = x_values,\n y = y_values,\n mode = 'lines',\n )\n \n return trace\n\ndef graph_func(f, min=-100, max=100, step=1):\n data = [get_graph_func(f, min=min, max=max, step=step)]\n return plot(data, filename='out.html')\n\ndef graph_funcs(f_list, min=-100, max=100, step=1):\n data = [get_graph_func(f, min=min, max=max, step=step) for f in f_list]\n #print(data[0])\n return plot(data, filename='out.html')\n\n\n\nif __name__ == \"__main__\":\n print(list(get_range_float(-10, 10, 0.1)))\n" }, { "alpha_fraction": 0.46439629793167114, "alphanum_fraction": 0.49845200777053833, "avg_line_length": 17.941177368164062, "blob_id": "1816fe34ad00176e04fd015c1deb6d89ccd91b01", "content_id": "c4ad6d174347404c0269e1ff4ffdf89b13bba120", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 323, "license_type": "no_license", "max_line_length": 44, "num_lines": 17, "path": "/eulers.py", "repo_name": "riley-martine/calc", "src_encoding": "UTF-8", "text": "from math import e\n\ndef f(t, y):\n return -0.25*(t-70)\n\nt_zero = 0\ny_zero = 1\n\nstep_size = 1\nstep_iter = 10\n\nfor i in range(1, step_iter):\n m = f(t_zero, y_zero)\n y_zero = y_zero + step_size*m\n t_zero = t_zero + step_size\n print(f\"-------------{i}-------------\")\n print(f\"t{i}: {t_zero}\\ny{i}: {y_zero}\")\n\n" } ]
15
rockerer/sudokuSolver
https://github.com/rockerer/sudokuSolver
59175f781ee14e19119cfce9d470474f12b1973a
95d03f23b51fecfe76f6bde21851c084c7d2d9c1
949499a73f30b9935222d6dd0c3f1582c84cb26e
refs/heads/master
2022-09-09T20:28:57.437993
2020-06-02T07:36:40
2020-06-02T07:36:40
268,727,759
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.5266203880310059, "alphanum_fraction": 0.5358796119689941, "avg_line_length": 23, "blob_id": "ac36668afc4fb800d8d7ec71fbe4a6c037579244", "content_id": "bed379a792120bb9709c9c582bf06d9a2fa34819", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 864, "license_type": "no_license", "max_line_length": 70, "num_lines": 36, "path": "/solver.py", "repo_name": "rockerer/sudokuSolver", "src_encoding": "UTF-8", "text": "import copy\nfrom feld import *\n\nclass Solver():\n \"\"\"\n Braindead backtracing algo for\n finding a sudoku solution\n \"\"\"\n f = None\n tries = 0\n def __init__(self, f):\n self.f = f\n\n def solve(self):\n return(self.mySolve( self.f))\n\n def mySolve(self, f : Feld):\n self.tries += 1\n \"\"\"\n find next empty element, copy f and insert all values\n \"\"\"\n nextPos = f.getNextEmpty()\n if(nextPos == (-1, -1)):\n return f\n possibleEntries = f.getPossibleEntries(nextPos[0], nextPos[1])\n for elem in possibleEntries:\n newF = copy.deepcopy(f)\n newF.setElem(nextPos[0], nextPos[1], elem)\n res = self.mySolve(newF)\n if(res):\n return res\n\n\n\n # if not returned a valid feld no solution was found\n return False\n" }, { "alpha_fraction": 0.41188958287239075, "alphanum_fraction": 0.4295824468135834, "avg_line_length": 24.700000762939453, "blob_id": "e5da1ce8718f85cca97a8789059525f95e233e0d", "content_id": "d91aaf234cff61f6b8f3148bab7140cc6c1749d1", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2826, "license_type": "no_license", "max_line_length": 87, "num_lines": 110, "path": "/feld.py", "repo_name": "rockerer/sudokuSolver", "src_encoding": "UTF-8", "text": "class Feld:\n \"\"\"\n Me is the docstring\n \"\"\"\n data = None\n\n def __init__(self):\n self.data = [[0 for _ in range(9)] for _ in range(9)]\n\n def __str__(self):\n \"\"\"\n Pretty-print the field\n \"\"\"\n res = \"\"\n lineBorder = \"+---+---+---+---+---+---+---+---+---+\\n\"\n for row in self.data:\n res += lineBorder\n for elem in row:\n res += \"| \" + str(elem) + \" \"\n res += \"|\\n\"\n res += lineBorder\n return res\n\n def getNextEmpty(self):\n for x in range(9):\n for y in range(9):\n if(self.getElem(x,y) == 0):\n return (x,y)\n return (-1,-1)\n\n def getPossibleEntries(self, posX, posY):\n if(self.getElem(posX, posY) != 0):\n return set()\n res = set([x for x in range(1,10)])\n for x in range(9):\n # row\n tmp = self.getElem(x, posY)\n if(tmp in res):\n res.remove(tmp)\n # col\n tmp = self.getElem(posX, x)\n if(tmp in res):\n res.remove(tmp)\n # squar\n tmp = self.getElem(3*int(posX/3.0) + (x % 3), 3*int(posY/3.0) + int(x/3.0))\n if(tmp in res):\n res.remove(tmp)\n return res\n\n \n def getElem(self, x, y):\n return self.data[x][y]\n\n def setElem(self, x, y, val):\n \"\"\"\n Check if this is a valid insertion\n if valid -> true\n otherwise -> false\n \"\"\"\n\n if(val < 1 or val >9):\n return False\n\n # Check row\n rowSet = set([x for x in range(1,10)])\n for posX in range(9):\n tmp = self.getElem(posX, y)\n if(tmp in rowSet):\n rowSet.remove(tmp)\n if(not val in rowSet):\n return False\n\n # Check col\n colSet = set([x for x in range(1,10)])\n for posY in range(9):\n tmp = self.getElem(x,posY)\n if(tmp in colSet):\n colSet.remove(tmp)\n if(not val in colSet):\n return False\n\n # Check quadr\n quadrSet = set([x for x in range(1,10)])\n x0 = 3 * int(x/3.0)\n y0 = 3 * int(y/3.0)\n for xOffs in range(3):\n for yOffs in range(3):\n tmp = self.getElem(x0+xOffs, y0+yOffs)\n if(tmp in quadrSet):\n quadrSet.remove(tmp)\n if(not val in quadrSet):\n return False\n\n\n\n self.data[x][y] = val\n return True\n\n\n def solved(self):\n \"\"\"\n Check all entries, if they are valid and not empty\n \"\"\"\n\n for x in range(9):\n for y in range(9):\n if(self.getElem(x,y) == 0):\n return False\n\n return True" }, { "alpha_fraction": 0.41188278794288635, "alphanum_fraction": 0.5266960859298706, "avg_line_length": 18.317829132080078, "blob_id": "3ecf686480d8d17e4e321f613bc19b52b4374b96", "content_id": "01d7e0d4aeec47c4acc43329ac0dfea27433c5bc", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2491, "license_type": "no_license", "max_line_length": 26, "num_lines": 129, "path": "/main.py", "repo_name": "rockerer/sudokuSolver", "src_encoding": "UTF-8", "text": "#!/usr/bin/python3\nfrom feld import *\nfrom solver import *\nimport time\n\ndef runSimple1():\n f = Feld()\n f.setElem(0,3,9)\n f.setElem(0,4,7)\n f.setElem(0,6,6)\n f.setElem(0,7,4)\n f.setElem(0,8,3)\n f.setElem(1,0,4)\n f.setElem(1,1,5)\n f.setElem(1,2,3)\n f.setElem(1,3,8)\n f.setElem(1,4,2)\n f.setElem(1,7,7)\n f.setElem(1,8,9)\n f.setElem(2,1,6)\n f.setElem(2,2,9)\n f.setElem(2,7,8)\n f.setElem(3,1,9)\n f.setElem(3,3,2)\n f.setElem(3,4,8)\n f.setElem(3,5,3)\n f.setElem(4,2,1)\n f.setElem(4,3,5)\n f.setElem(4,5,9)\n f.setElem(4,6,2)\n f.setElem(4,7,3)\n f.setElem(5,0,6)\n f.setElem(5,1,3)\n f.setElem(5,2,2)\n f.setElem(5,3,1)\n f.setElem(5,7,5)\n f.setElem(5,8,8)\n f.setElem(6,1,8)\n f.setElem(6,2,6)\n f.setElem(6,6,4)\n f.setElem(6,8,1)\n f.setElem(7,0,2)\n f.setElem(7,1,1)\n f.setElem(7,4,9)\n f.setElem(7,6,8)\n f.setElem(7,8,5)\n f.setElem(8,0,9)\n f.setElem(8,3,6)\n f.setElem(8,4,1)\n f.setElem(8,5,8)\n f.setElem(8,6,3)\n f.setElem(8,7,2)\n f.setElem(8,8,7)\n print(f)\n s = Solver(f)\n print(s.solve())\n\ndef runHard1():\n f = Feld()\n f.setElem(0,7,4)\n f.setElem(1,1,7)\n f.setElem(1,6,2)\n f.setElem(1,7,8)\n f.setElem(1,8,9)\n f.setElem(2,0,6)\n f.setElem(2,1,3)\n f.setElem(2,5,4)\n f.setElem(2,6,7)\n f.setElem(3,0,1)\n f.setElem(3,2,5)\n f.setElem(3,7,2)\n f.setElem(3,8,8)\n f.setElem(4,0,7)\n f.setElem(4,4,5)\n f.setElem(5,6,3)\n f.setElem(6,2,4)\n f.setElem(6,4,1)\n f.setElem(6,5,9)\n f.setElem(7,3,6)\n f.setElem(7,4,3)\n f.setElem(7,6,4)\n f.setElem(8,0,9)\n f.setElem(8,1,6)\n f.setElem(8,4,8)\n print(f)\n s = Solver(f)\n print(s.solve())\n print(s.tries)\n\ndef runExtreme1():\n f = Feld()\n f.setElem(0,0,5)\n f.setElem(0,8,9)\n f.setElem(1,2,3)\n f.setElem(1,5,2)\n f.setElem(1,7,1)\n f.setElem(2,4,9)\n f.setElem(2,6,4)\n f.setElem(3,4,4)\n f.setElem(3,8,8)\n f.setElem(4,1,6)\n f.setElem(4,7,3)\n f.setElem(5,0,8)\n f.setElem(5,1,7)\n f.setElem(5,6,5)\n f.setElem(6,0,7)\n f.setElem(6,4,8)\n f.setElem(6,6,9)\n f.setElem(7,1,3)\n f.setElem(7,5,6)\n f.setElem(8,1,5)\n f.setElem(8,3,1)\n f.setElem(8,7,2)\n print(f)\n\n s = Solver(f)\n tStart = time.time()\n res = s.solve()\n tEnd = time.time()\n print(res)\n print(tEnd - tStart)\n\ndef main():\n# runSimple1()\n # runHard1()\n runExtreme1()\n\nif __name__ == \"__main__\":\n main()" } ]
3
hernanramirez/entrenaminto_sebastian
https://github.com/hernanramirez/entrenaminto_sebastian
a9219589e657e019e329e89ca910a6b558ae9cf6
f65d4c5dd137dfa47027936fcf4441317f82eaf1
6b686bd5462a334e969cbce0a3ac2f9307097d19
refs/heads/master
2022-11-12T12:01:03.665909
2020-07-09T23:46:23
2020-07-09T23:46:23
278,474,172
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.7043010592460632, "alphanum_fraction": 0.7177419066429138, "avg_line_length": 27.69230842590332, "blob_id": "526e8437fd0361811493975c8a16ac534bfe01c3", "content_id": "3ac1faf1e6de0838200e780bb2e265883b065742", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 372, "license_type": "permissive", "max_line_length": 51, "num_lines": 13, "path": "/entrenaminto_sebastian/telefonera_app/models.py", "repo_name": "hernanramirez/entrenaminto_sebastian", "src_encoding": "UTF-8", "text": "from django.db import models\nfrom model_utils import Choices\nfrom model_utils.fields import StatusField\n\n\nclass Telefono(models.Model):\n TIPO_CHOICES = Choices('Familia', 'Trabajo')\n tipo = StatusField(choices_name='TIPO_CHOICES')\n nombre = models.CharField(max_length=100)\n telefono = models.CharField(max_length=20)\n\n class Meta:\n ordering = ['pk']" }, { "alpha_fraction": 0.7482014298439026, "alphanum_fraction": 0.7482014298439026, "avg_line_length": 33.75, "blob_id": "2480d0122bb8b17ef69e2fe4d55c5ce18707e6c8", "content_id": "2653238303cd2f617261bfeff9921cf5a4c4846a", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 278, "license_type": "permissive", "max_line_length": 65, "num_lines": 8, "path": "/entrenaminto_sebastian/telefonera_app/admin.py", "repo_name": "hernanramirez/entrenaminto_sebastian", "src_encoding": "UTF-8", "text": "from django.contrib import admin\nfrom entrenaminto_sebastian.telefonera_app.models import Telefono\n\n@admin.register(Telefono)\nclass TelefonoAdmin(admin.ModelAdmin):\n list_display = ('tipo', 'nombre', 'telefono')\n search_fields = ['nombre']\n #inlines = [CatalogoInline]\n" }, { "alpha_fraction": 0.697400689125061, "alphanum_fraction": 0.6983815431594849, "avg_line_length": 30.875, "blob_id": "a60df9e1e6e4808e59a4271c59a4d7919e87675f", "content_id": "89ecbb765571d27161a35d5f33e558a7af5e6cba", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2039, "license_type": "permissive", "max_line_length": 89, "num_lines": 64, "path": "/entrenaminto_sebastian/telefonera_app/views/telefonera.py", "repo_name": "hernanramirez/entrenaminto_sebastian", "src_encoding": "UTF-8", "text": "# store/views.py\nfrom django.contrib.auth.decorators import login_required\nfrom django.utils.decorators import method_decorator\n# specific to this view\nfrom django.views.generic import ListView, CreateView, DetailView, UpdateView, DeleteView\nfrom django.core.paginator import Paginator, PageNotAnInteger, EmptyPage\nfrom django.urls import reverse_lazy\n\nfrom entrenaminto_sebastian.telefonera_app.models import Telefono\n\n\nclass TelefonoListView(ListView):\n\n model = Telefono\n template_name = 'telefonera_app/telefonos/list.html'\n context_object_name = 'telefonos'\n paginate_by = 5\n \n '''\n def get_context_data(self, **kwargs):\n context = super(BookListView, self).get_context_data(**kwargs)\n books = self.get_queryset()\n page = self.request.GET.get('page')\n paginator = Paginator(books, self.paginate_by)\n try:\n books = paginator.page(page)\n except PageNotAnInteger:\n books = paginator.page(1)\n except EmptyPage:\n books = paginator.page(paginator.num_pages)\n context['books'] = books\n return context\n ''' \n\nclass TelefonoCreateView(CreateView):\n model = Telefono\n template_name = 'telefonera_app/telefonos/form.html'\n fields = ('tipo', 'nombre', 'telefono', )\n success_url = reverse_lazy('telefonera_app:telefonera-list')\n\n\nclass TelefonoDetailView(DetailView):\n\n model = Telefono\n template_name = 'telefonera_app/telefonos/detail.html'\n context_object_name = 'telefono'\n\n\nclass TelefonoUpdateView(UpdateView):\n\n model = Telefono\n template_name = 'telefonera_app/telefonos/form.html'\n context_object_name = 'telefono'\n fields = ('tipo', 'nombre', 'telefono', )\n\n def get_success_url(self):\n return reverse_lazy('telefonera_app:telefonera-list')\n\n\nclass TelefonoDeleteView(DeleteView):\n model = Telefono\n context_object_name = 'telefono'\n template_name = 'telefonera_app/telefonos/confirm_delete.html'\n success_url = reverse_lazy('telefonera_app:telefonera-list')" }, { "alpha_fraction": 0.7692307829856873, "alphanum_fraction": 0.7692307829856873, "avg_line_length": 25, "blob_id": "7e81030eecc789ddefbeba16645714d473bc5678", "content_id": "563ef3e2eb34a08b71d77b074a58fc4b703d1636", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 156, "license_type": "permissive", "max_line_length": 50, "num_lines": 6, "path": "/entrenaminto_sebastian/telefonera_app/apps.py", "repo_name": "hernanramirez/entrenaminto_sebastian", "src_encoding": "UTF-8", "text": "from django.apps import AppConfig\n\n\nclass TelefoneraAppConfig(AppConfig):\n name = 'entrenaminto_sebastian.telefonera_app'\n verbose_name = 'Telefonos'\n" }, { "alpha_fraction": 0.5608465671539307, "alphanum_fraction": 0.591269850730896, "avg_line_length": 30.5, "blob_id": "feaa620e2012ade16fe6489d680d888717cb0850", "content_id": "8a041f97983c4a788f645d445eb1c86d20bee932", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 756, "license_type": "permissive", "max_line_length": 176, "num_lines": 24, "path": "/entrenaminto_sebastian/telefonera_app/migrations/0001_initial.py", "repo_name": "hernanramirez/entrenaminto_sebastian", "src_encoding": "UTF-8", "text": "# Generated by Django 3.0.8 on 2020-07-09 21:44\n\nfrom django.db import migrations, models\nimport model_utils.fields\n\n\nclass Migration(migrations.Migration):\n\n initial = True\n\n dependencies = [\n ]\n\n operations = [\n migrations.CreateModel(\n name='Telefono',\n fields=[\n ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),\n ('tipo', model_utils.fields.StatusField(choices=[('Familia', 'Familia'), ('Trabajo', 'Trabajo')], default='Familia', max_length=100, no_check_for_status=True)),\n ('nombre', models.CharField(max_length=100)),\n ('telefono', models.CharField(max_length=20)),\n ],\n ),\n ]\n" }, { "alpha_fraction": 0.7378151416778564, "alphanum_fraction": 0.7378151416778564, "avg_line_length": 48.66666793823242, "blob_id": "6bddf1e678435ba977c3fd441e2bfb9a0b5cf5ff", "content_id": "18ffcbdf23444746f74349ed54aafe0de3a95cc2", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 595, "license_type": "permissive", "max_line_length": 95, "num_lines": 12, "path": "/entrenaminto_sebastian/telefonera_app/urls.py", "repo_name": "hernanramirez/entrenaminto_sebastian", "src_encoding": "UTF-8", "text": "from django.urls import path\nfrom entrenaminto_sebastian.telefonera_app.views import telefonera\n\napp_name = \"telefonera_app\"\n\nurlpatterns = [\n path('', telefonera.TelefonoListView.as_view(), name='telefonera-list'),\n path('create/', telefonera.TelefonoCreateView.as_view(), name='telefonera-create'),\n path('detail/<int:pk>', telefonera.TelefonoDetailView.as_view(), name='telefonera-detail'),\n path('update/<int:pk>', telefonera.TelefonoUpdateView.as_view(), name='telefonera-update'),\n path('delete/<int:pk>', telefonera.TelefonoDeleteView.as_view(),name='telefonera-delete'),\n]" } ]
6
WonderJ13/Monte-Carlo
https://github.com/WonderJ13/Monte-Carlo
2dc4f856a383ea48d61e7c66e20d4507d906fc67
025072b023a07677365e11cd927eedb205a32e1c
de7b03ac375fa0c59e23f760ce8a64b43eb8aa1e
refs/heads/master
2020-03-15T12:48:26.781955
2018-05-04T14:42:08
2018-05-04T14:42:08
132,152,170
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.46799999475479126, "alphanum_fraction": 0.5180000066757202, "avg_line_length": 20.7391300201416, "blob_id": "4aacaa23f39a3d0ea313e349458a950e478bc847", "content_id": "f0bda5f29c61aa894571bcd89a0cac16a99c87d5", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 500, "license_type": "no_license", "max_line_length": 45, "num_lines": 23, "path": "/2. E Calculation/e.py", "repo_name": "WonderJ13/Monte-Carlo", "src_encoding": "UTF-8", "text": "import random, time\nrandom.seed(time.time())\n\nleft = 2\nright = 4\nepsilon = 0.0000001\n\nwhile right - left > epsilon:\n count = 0\n rounds = 1000000\n mid = (left + right) / 2\n for i in range(rounds):\n x = (random.random() * (mid - 1)) + 1\n y = random.random()\n if(1 / x > y):\n count += 1\n rectArea = mid - 1\n if(rectArea * (count / rounds) < 1):\n left = mid\n else:\n right = mid\nprint(\"Left: \" + str(left))\nprint(\"Right: \" + str(right))\n" }, { "alpha_fraction": 0.5212714076042175, "alphanum_fraction": 0.5535452365875244, "avg_line_length": 22.79069709777832, "blob_id": "aa0476ec4babc98d42b6d5a5a9d343a18955a113", "content_id": "ce64d975eda42412759ffcd88e532228721635e0", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 2045, "license_type": "no_license", "max_line_length": 104, "num_lines": 86, "path": "/7. Island Part 1/Island.cpp", "repo_name": "WonderJ13/Monte-Carlo", "src_encoding": "UTF-8", "text": "#include <iostream>\n#include <stdlib.h>\n#include <time.h>\n\nint main()\n{\n\t/* Deaths:\n\t * Ocean (x or y > 10 || x or y < -10)\n\t * Cannibal Village\n\t * Thirst (thirstLevel > 100)\n\t * Starvation (steps > 300)\n\t */\n\t/* Places:\n\t * Cannibal Village (x=2, y=-4)\n\t * Spring [thirstLevel = 0] (x=-3, y=-3)\n\t * Origin (x=0, y=0)\n\t * Airport (x=6, y=7)\n\t */\n\tsrand(time(NULL));\n\tint rounds = 1000000;\n\n\tint drowned = 0;\n\tint eaten = 0;\n\tint thirst = 0;\n\tint starvation = 0;\n\tint successes = 0;\n\tint successfulSteps = 0;\n\tfor(int i = 0; i < rounds; i++)\n\t{\n\t\tint xPos = 0;\n\t\tint yPos = 0;\n\t\tint thirstLevel = 0;\n\t\tint steps;\n\t\tbool dead = false;\n\n\t\tfor(steps = 0; steps < 300; steps++)\n\t\t{\n\t\t\tint dir = rand() % 4;\n\t\t\tif(dir == 0) { //North\n\t\t\t\tyPos++;\n\t\t\t} else if(dir == 1) { //East\n\t\t\t\txPos++;\n\t\t\t} else if(dir == 2) { //South\n\t\t\t\tyPos--;\n\t\t\t} else { //West\n\t\t\t\txPos--;\n\t\t\t}\n\n\t\t\tthirstLevel++;\n\t\t\tif(xPos == -3 && yPos == -3) { //Made it to the spring\n\t\t\t\tthirstLevel = 0;\n\t\t\t}\n\n\t\t\tif(xPos > 10 || yPos > 10 || xPos < -10 || yPos < -10) { //Drowned in the Ocean\n\t\t\t\tdrowned++;\n\t\t\t\tdead = true;\n\t\t\t} else if(xPos == 2 && yPos == -4) { //Killed by cannibals\n\t\t\t\teaten++;\n\t\t\t\tdead = true;\n\t\t\t}\n\t\t\tif(thirstLevel > 100) { //Died of thirst\n\t\t\t\tthirst++;\n\t\t\t\tdead = true;\n\t\t\t}\n\t\t\tif(dead || (xPos == 6 && yPos == 7)) { //Break from simulation if dead or made it to airport\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(steps == 300) {\n\t\t\tstarvation++;\n\t\t\tdead = true;\n\t\t}\n\n\t\tif(!dead) {\n\t\t\tsuccesses++;\n\t\t\tsuccessfulSteps += steps;\n\t\t}\n\t}\n\tstd::cout << \"Successes: \" << (double)successes / (double)rounds << std::endl;\n\tstd::cout << \"Average steps for success: \" << (double)successfulSteps / (double)successes << std::endl;\n\tstd::cout << \"Death by thirst: \" << (double)thirst / (double)rounds << std::endl;\n\tstd::cout << \"Death by cannibals: \" << (double)eaten / (double)rounds << std::endl;\n\tstd::cout << \"Death by drowning: \" << (double)drowned / (double)rounds << std::endl;\n\tstd::cout << \"Death by starvation: \" << (double)starvation / (double)rounds << std::endl;\n\treturn 0;\n}" }, { "alpha_fraction": 0.5242587327957153, "alphanum_fraction": 0.5646900534629822, "avg_line_length": 34.33333206176758, "blob_id": "997757d494419fa79a44cbfe00c9043b19f884d7", "content_id": "f2b63b77cfa3444c7f94e7cda5536ebfbecccfac", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 742, "license_type": "no_license", "max_line_length": 79, "num_lines": 21, "path": "/5. Birthday Again/birthday.py", "repo_name": "WonderJ13/Monte-Carlo", "src_encoding": "UTF-8", "text": "#Author: Jacob Bonfanti\n#Assignment 5: Birthday Paradox - But with a twist!\n#Date: 3/1/2018\nimport random, time\nrandom.seed(time.time())\n\ndef distinct_birthdays_sim(n):\n rounds = 20000\n count = 0\n for i in range(rounds):\n birthdays = [False]*365\n for j in range(n):\n rnd = int(random.random()*365)\n birthdays[rnd] = True\n for j in range(365):#Increments count for each distinct birthday\n count += 1 if birthdays[j] else 0 #Fancy python code,\n #Compresses if/else\n #statements into one line\n return count / rounds\n\nprint(\"Simulated probability for n = 365: \" + str(distinct_birthdays_sim(365)))\n" }, { "alpha_fraction": 0.5113924145698547, "alphanum_fraction": 0.5556961894035339, "avg_line_length": 27.214284896850586, "blob_id": "a4cc5692876b5ca0ec01fb158fb17b3aa9e7bafd", "content_id": "2223ee06d6faac4df3401b71323b97bcfb64709b", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 790, "license_type": "no_license", "max_line_length": 94, "num_lines": 28, "path": "/4. Birthday/birthday.py", "repo_name": "WonderJ13/Monte-Carlo", "src_encoding": "UTF-8", "text": "#Author: Jacob Bonfanti\n#Assignment 4: Birthday Paradox\n#Date: 2/22/2018\nimport random, time\nrandom.seed(time.time())\n\ndef chance_of_birthday_exact(n):\n p = 1\n for i in range(1, n+1): #Loop from 1 to n\n p *= ((366-i)/365)\n return 1 - p\n\ndef chance_of_birthday_sim(n):\n rounds = 20000\n count = 0\n for i in range(rounds):\n birthdays = [False]*365\n for j in range(n):\n rnd = int(random.random()*365)\n if(birthdays[rnd]):\n count+=1\n break\n birthdays[rnd] = True\n return count / rounds\n\nfor i in range(1, 51):\n print(\"Exact probability for n = \" + str(i) + \": \" + str(chance_of_birthday_exact(i)))\n print(\"Simulated probability for n = \" + str(i) + \": \" + str(chance_of_birthday_sim(i)))\n" }, { "alpha_fraction": 0.5586017966270447, "alphanum_fraction": 0.5798491835594177, "avg_line_length": 26.547170639038086, "blob_id": "176f4caf1beae0d31de2ba3e2868eb9ac2fb3d4a", "content_id": "87d71593ee60d5f80c10be8320427b8ae18e1ccf", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 1459, "license_type": "no_license", "max_line_length": 78, "num_lines": 53, "path": "/9. Airplane Trouble/plane.cpp", "repo_name": "WonderJ13/Monte-Carlo", "src_encoding": "UTF-8", "text": "#include <iostream>\n#include <stdlib.h>\n#include <time.h>\n\ndouble chance_of_getting_right_seat(int passenger, int total_passengers);\n\nint main() {\n\tsrand(time(NULL));\n\tint n = 100;\n\tint rounds = 10000000;\n\tint passenger_gets_right_seat[n];\n\tfor(int i = 0; i < n; i++) { //Initialize array\n\t\tpassenger_gets_right_seat[i] = 0;\n\t}\n\tfor(int round = 0; round < rounds; round++) {\n\t\tint seats[n];\n\t\tfor(int i = 0; i < n; i++) { //Initialize array\n\t\t\tseats[i] = -1;\n\t\t}\n\n\t\tseats[rand() % n] = 0;\n\t\tfor(int passenger = 1; passenger < n; passenger++) {\n\t\t\tif(seats[passenger] != -1) {\n\t\t\t\tint seat = rand() % n;\n\t\t\t\twhile(seats[seat] != -1) {\n\t\t\t\t\tseat = rand() % n;\n\t\t\t\t}\n\t\t\t\tseats[seat] = passenger;\n\t\t\t} else {\n\t\t\t\tseats[passenger] = passenger;\n\t\t\t}\n\t\t}\n\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tif(seats[i] == i) passenger_gets_right_seat[i]++;\n\t\t}\n\t}\n\n\tfor(int i = 0; i < n; i++) {\n\t\tstd::cout << \"Simulated probability for passenger \" << (i + 1) << \": \"\n\t\t<< (double)passenger_gets_right_seat[i] / (double)rounds << std::endl;\n\t\tstd::cout << \"Calculated probability for passenger \" << (i + 1) << \": \"\n\t\t<< chance_of_getting_right_seat(i+1, n);\n\t\t//This next line is just to get the entire output to appear onto my terminal\n\t\t//The if statement can be removed if need be\n\t\tif(i < n-1) std::cout << std::endl << std::endl;\n\t}\n}\n\ndouble chance_of_getting_right_seat(int k, int n) {\n\tif(k == 1) return 1.0 / n;\n\telse return (((double)n) + 1 - k) / (((double)n) + 2 - k);\n}" }, { "alpha_fraction": 0.5590838193893433, "alphanum_fraction": 0.5767829418182373, "avg_line_length": 27.671642303466797, "blob_id": "415562961be87f0405009e9eeb561146469f3adc", "content_id": "7526e2147b6453be084c24a49e1092163da31d1f", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 1921, "license_type": "no_license", "max_line_length": 104, "num_lines": 67, "path": "/6. Chairs/chair.cpp", "repo_name": "WonderJ13/Monte-Carlo", "src_encoding": "UTF-8", "text": "#include <iostream>\n#include <stdlib.h>\n#include <time.h>\n#include <vector>\n\nint main()\n{\n\tsrand(time(NULL));\n\tint games = 100000;\n\tfor(int players = 2; players <= 20; players++)//Number of starting players\n\t{\n\t\tint wins[players];\n\t\tfor(int j = 0; j < players; j++)//Initialize to 0\n\t\t{\n\t\t\twins[j] = 0;\n\t\t}\n\t\tfor(int j = 0; j < games; j++)//Games\n\t\t{\n\t\t\tstd::vector<int> old_chairs;\n\t\t\tfor(int k = 0; k < players; k++)//Initialize player IDs\n\t\t\t{\n\t\t\t\told_chairs.push_back(k);\n\t\t\t}\n\t\t\tfor(int remaining_chairs = players-1; remaining_chairs > 0; remaining_chairs--)//Number of new chairs\n\t\t\t{\n\t\t\t\tstd::vector<int> new_chairs;\n\t\t\t\tfor(int l = 0; l < remaining_chairs; l++)//Initialize unoccupied chairs\n\t\t\t\t{\n\t\t\t\t\tnew_chairs.push_back(-1);\n\t\t\t\t}\n\t\t\t\tfor(int chair = 0; chair < remaining_chairs+1; chair++)//For each chair\n\t\t\t\t{\n\t\t\t\t\tif(old_chairs[chair] == -1) continue;//Skip if it's unnocupied\n\t\t\t\t\tint chair_index = chair;\n\t\t\t\t\tif(chair == 0) {//Left-most can only go right\n\t\t\t\t\t\t//Do Nothing\n\t\t\t\t\t}\n\t\t\t\t\telse if(chair == remaining_chairs) {//Right-most can only go left\n\t\t\t\t\t\tchair_index--;\n\t\t\t\t\t}\n\t\t\t\t\telse {//Middle has a choice\n\t\t\t\t\t\tint dir = rand() % 2;\n\t\t\t\t\t\tif(dir == 0) chair_index--;\n\t\t\t\t\t}\n\t\t\t\t\tif(new_chairs[chair_index] == -1)//If decided chair happens to be unoccupied\n\t\t\t\t\t{\n\t\t\t\t\t\tnew_chairs[chair_index] = old_chairs[chair];\n\t\t\t\t\t}\n\t\t\t\t\telse //Fight for the chair\n\t\t\t\t\t{\n\t\t\t\t\t\tint chance = rand() % 2;\n\t\t\t\t\t\tif(chance == 0) new_chairs[chair_index] = old_chairs[chair];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\told_chairs = new_chairs;//Reset\n\t\t\t}\n\t\t\twins[old_chairs[0]]++;//old_chairs should have size 1 with the person in that chair being the winner\n\t\t}\n\t\tstd::cout << \"Stats for game with \" << players << \" players...\" << std::endl;\n\t\tfor(int j = 0; j < players; j++)\n\t\t{\n\t\t\tstd::cout << \"Player \" << j+1 << \" win rate: \" << 100*(double)wins[j] / games << \"%\" << std::endl;\n\t\t}\n\t\tstd::cout << std::endl;\n\t}\n\tsystem(\"pause\");\n}\n" }, { "alpha_fraction": 0.5117388367652893, "alphanum_fraction": 0.5366837978363037, "avg_line_length": 20.472440719604492, "blob_id": "80f1a897959f96b60ec75d3997ba4577f742039c", "content_id": "7d60d7b8cf87580a0bc7a03301505b05baf60f5d", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 2726, "license_type": "no_license", "max_line_length": 104, "num_lines": 127, "path": "/8. Island Part 2/Island.cpp", "repo_name": "WonderJ13/Monte-Carlo", "src_encoding": "UTF-8", "text": "#include <iostream>\n#include <stdlib.h>\n#include <time.h>\n\nbool aboutToDrown(int, int);\n\nint main(int argc, char** argv)\n{\n\t/* Deaths:\n\t * Starvation (hunger > 60)\n\t * Boredom (steps > 80)\n\t */\n\t/* Places:\n\t * Pizza Hut (x=-3, y=-5)\n\t * Bank (x=-5, y=-2)\n\t * Lake (Rect from (x=4, y=5) to (x=9, y=9))\n\t * Origin (x=0, y=0)\n\t * Airport (x=9, y=-2)\n\t */\n\n\tsrand(time(NULL));\n\tint rounds = 1000000;\n\n\tint starvation = 0;\n\tint boredom = 0;\n\tint bankEntrances = 0;\n\tint pizzaHutEntrances = 0;\n\tint successes = 0;\n\tint successfulSteps = 0;\n\tfor(int i = 0; i < rounds; i++)\n\t{\n\t\tint xPos = 0;\n\t\tint yPos = 0;\n\t\tint hunger = 0;\n\t\tbool cash = false;\n\t\tbool dead = false;\n\t\tbool gotCash = false;\n\t\tbool pizzaAte = false;\n\n\t\tint steps;\n\n\t\tfor(steps = 0; steps < 80; steps++)\n\t\t{\n\t\t\tint dir = rand() % 4;\n\t\t\tif(dir == 0) { //North\n\t\t\t\tyPos++;\n\t\t\t} else if(dir == 1) { //East\n\t\t\t\txPos++;\n\t\t\t} else if(dir == 2) { //South\n\t\t\t\tyPos--;\n\t\t\t} else { //West\n\t\t\t\txPos--;\n\t\t\t}\n\n\t\t\t//If man is about to drown in ocean or lake\n\t\t\tif(aboutToDrown(xPos, yPos)) {\n\t\t\t\tint xNew = xPos;\n\t\t\t\tint yNew = yPos;\n\t\t\t\twhile(aboutToDrown(xNew, yNew)) {\n\t\t\t\t\txNew = xPos;\n\t\t\t\t\tyNew = yPos;\n\t\t\t\t\tint newDir = rand() % 4;\n\t\t\t\t\tif(newDir == 0) { //North\n\t\t\t\t\t\tyNew++;\n\t\t\t\t\t} else if(newDir == 1) { //East\n\t\t\t\t\t\txNew++;\n\t\t\t\t\t} else if(newDir == 2) { //South\n\t\t\t\t\t\tyNew--;\n\t\t\t\t\t} else { //West\n\t\t\t\t\t\txNew--;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\txPos = xNew;\n\t\t\t\tyPos = yNew;\n\t\t\t}\n\n\t\t\tif(xPos == -5 && yPos == -2) { //At the bank\n\t\t\t\tcash = true;\n\t\t\t\tgotCash = true;\n\t\t\t}\n\n\t\t\tif(xPos == -3 && yPos == -5 && cash) { //At the Pizza Hut\n\t\t\t\tcash = false;\n\t\t\t\tpizzaAte = true;\n\t\t\t\thunger = 0;\n\t\t\t}\n\n\t\t\tif(hunger > 60) {\n\t\t\t\tdead = true;\n\t\t\t\tstarvation++;\n\t\t\t}\n\n\t\t\tif(dead || (xPos == 9 && yPos == -2)) { //Break from simulation if dead or made it to airport\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\thunger++;\n\t\t}\n\t\tif(steps >= 80) {\n\t\t\tboredom++;\n\t\t\tdead = true;\n\t\t}\n\n\t\tif(!dead) {\n\t\t\tsuccesses++;\n\t\t\tsuccessfulSteps += steps;\n\t\t}\n\n\t\tif(pizzaAte) {\n\t\t\tpizzaHutEntrances++;\n\t\t}\n\n\t\tif(gotCash) {\n\t\t\tbankEntrances++;\n\t\t}\n\t}\n\tstd::cout << \"Successes: \" << (double)successes / (double)rounds << std::endl;\n\tstd::cout << \"Average steps for success: \" << (double)successfulSteps / (double)successes << std::endl;\n\tstd::cout << \"Death by boredom: \" << (double)boredom / (double)rounds << std::endl;\n\tstd::cout << \"Death by starvation: \" << (double)starvation / (double)rounds << std::endl;\n\tstd::cout << \"Rate of getting cash: \" << (double)bankEntrances / (double)rounds << std::endl;\n\tstd::cout << \"Rate of getting pizza: \" << (double)pizzaHutEntrances / (double)rounds << std::endl;\n\treturn 0;\n}\n\nbool aboutToDrown(int x, int y) {\n\treturn (x > 10 || y > 10 || x < -10 || y < -10 || (x > 4 && x < 9 && y > 5 && y < 9));\n}" }, { "alpha_fraction": 0.5488371849060059, "alphanum_fraction": 0.5953488349914551, "avg_line_length": 20.5, "blob_id": "dabdb7eacf8aea8086e9aad05acd287bffee168a", "content_id": "eb474f3a1ee3a3fe8e78b419b10b5640e145ed4d", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 215, "license_type": "no_license", "max_line_length": 29, "num_lines": 10, "path": "/1. Pi Calculation/Pi.py", "repo_name": "WonderJ13/Monte-Carlo", "src_encoding": "UTF-8", "text": "import random, time\nrandom.seed(int(time.time()))\ncount = 0\nrounds = 100000\nfor i in range(rounds):\n x = random.random()\n y = random.random()\n if(x*x + y*y <= 1):\n count+=1\nprint(4 * count / rounds)\n" }, { "alpha_fraction": 0.5166375041007996, "alphanum_fraction": 0.5551663637161255, "avg_line_length": 20.961538314819336, "blob_id": "c99fabda96249fbd0c20db31d805a12da21f3373", "content_id": "efe46c7c42fb0ae08c6cb34a00000192445cb8b2", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 571, "license_type": "no_license", "max_line_length": 44, "num_lines": 26, "path": "/3. Cards/Cards.py", "repo_name": "WonderJ13/Monte-Carlo", "src_encoding": "UTF-8", "text": "#Author: Jacob Bonfanti\n#Date: 2/15/2018\n#Assignment 3: Card Shuffling\nimport random, time\nrandom.seed(time.time())\n\ndef shuffle(n):\n arr = []\n #Get list of numbers from 0 - (n - 1)\n for i in range(n):\n arr.append(i)\n #Knuth Fisher Yates Shuffle\n for i in range(n):\n x = i + int(random.random()*(n - i))\n arr[i], arr[x] = arr[x], arr[i]\n return arr\n\nrounds = 100000\nsuccess = 0\nfor i in range(rounds):\n arr = shuffle(52)\n for j in range(52):\n if(arr[j] == j):\n success += 1\n break\nprint(success / rounds)\n" } ]
9
jiaxin576/jingzhun
https://github.com/jiaxin576/jingzhun
f66f68babbcec879c10205a28291d9ca61f7c590
0d70df6fd8cbf83934bbdf53402eceba1ff78bb1
296a6298bbed60178f3236bcc6bda09406350919
refs/heads/master
2023-04-19T04:38:19.664013
2021-04-19T11:52:24
2021-04-19T11:52:24
245,578,282
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.49727919697761536, "alphanum_fraction": 0.513185441493988, "avg_line_length": 49.76595687866211, "blob_id": "54f3bea4b9f6cf5ff25ec957725e7a296e04a0f6", "content_id": "78d0cd09b832915c3c371b497f69d6a4ee15aed4", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2389, "license_type": "no_license", "max_line_length": 151, "num_lines": 47, "path": "/javaparse.py", "repo_name": "jiaxin576/jingzhun", "src_encoding": "UTF-8", "text": "import javalang\nimport time\nimport collections\ndef git_parse():\n fd = open(\"./MainActivity.java\", \"r\", encoding=\"utf-8\")\n treenode = javalang.parse.parse(fd.read())\n start = time.time()\n method_list=[]\n classname=''\n print(treenode)\n for path, node in treenode:\n if isinstance(node, javalang.tree.ClassDeclaration):\n if not classname:\n classname=node.name\n if classname!=node.name:\n classname='$'+node.name\n \n for path1, node1 in node:\n if isinstance(node1, javalang.tree.MethodDeclaration):\n path_list=[]\n for i in node1.body:\n if isinstance(i, javalang.tree.StatementExpression) or isinstance(i, javalang.tree.LocalVariableDeclaration):\n for path3, node3 in i: \n if isinstance(node3, javalang.tree.MethodInvocation) or isinstance(node3, javalang.tree.SuperMethodInvocation):\n path_list.append(node3.member)\n break\n method_list.append((classname+'.'+node1.name,(node1.position[0],node1._end_position[0]),path_list))\n \n \n for path2, node2 in node1:\n if isinstance(node2, javalang.tree.BlockStatement):\n path_list=[]\n for i in node2.statements:\n if isinstance(i, javalang.tree.StatementExpression) or isinstance(i, javalang.tree.LocalVariableDeclaration):\n for path3, node3 in i: \n if isinstance(node3, javalang.tree.MethodInvocation) or isinstance(node3, javalang.tree.SuperMethodInvocation):\n path_list.append(node3.member)\n break\n \n method_list.append((classname+'.'+node1.name,(node2.position[0],node2._end_position[0]),path_list))\n continue\n #continue\n print(time.time()-start)\n print(sorted(method_list,key=lambda x:x[1][1]-x[1][0]))\n return treenode.package.name,sorted(method_list,key=lambda x:x[1][1]-x[1][0])\n\ngit_parse() \n" }, { "alpha_fraction": 0.5317286849021912, "alphanum_fraction": 0.579868733882904, "avg_line_length": 63.71428680419922, "blob_id": "076d314c4de2161671d03d9444e7bbe367e0b990", "content_id": "6a9de3b91d5846888545ab0505d7dfde277c8fbf", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 639, "license_type": "no_license", "max_line_length": 125, "num_lines": 7, "path": "/README.md", "repo_name": "jiaxin576/jingzhun", "src_encoding": "UTF-8", "text": " pd_repoinfor = pd.read_excel(r'F:\\download\\工作簿2.xlsx',keep_default_na=False)\n data=[]\n for i in ['1岗', '2岗' ,'3岗','总部正职', '总部副职', '总部科员、财务', '基层正职' ,'基层副职(安全总监等)','基层科长、财务科长', '10岗项目经理', '11岗' ,'12岗', '13岗',\n '14岗行政管理员(及物业公司人员)','财务' ,'海外','工人岗','见习岗']:\n data.append(go.Box(y=pd_repoinfor.loc[pd_repoinfor[\"岗位类别\"]==i, '2021年月平均工资'],name=i) )\n fig = go.Figure(data=data,layout={\"title\": \"箱线图\", \"yaxis\": {\"dtick\": 5000}})\n fig.show()\n" } ]
2
J-Demian/RedditBot
https://github.com/J-Demian/RedditBot
cea0c6c018cc2d8312d54cf76f5694d94edbc83e
a5337227389d78b585cf6c1f1532405e2b4ff3fb
82e6572c26cdcbdbfa878ab86c1f15a7aae95b1c
refs/heads/master
2018-01-07T14:24:51.826845
2015-07-13T22:00:49
2015-07-13T22:00:49
35,740,808
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.6913043260574341, "alphanum_fraction": 0.697826087474823, "avg_line_length": 23.22222137451172, "blob_id": "b40ad3b6498edd3333afb668331fd05477813cbc", "content_id": "532b16424e3b1b98cb3b7e70324457bb2e783307", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 460, "license_type": "no_license", "max_line_length": 153, "num_lines": 18, "path": "/README.md", "repo_name": "J-Demian/RedditBot", "src_encoding": "UTF-8", "text": "# RedditBot\r\n\r\nThis bot checks Reddit for (new) threads. \r\n\r\nEach thread's subreddit, title, author and url are printed to stdout. \r\n\r\nWhenever a thread's title contains any trigger (which are read from triggers.txt), the bot will also post the thread's contents (selftext and comments). \r\n\r\nIn the future I might add some feature(s).\r\n\r\n## Dependencies\r\n\r\n- Python 3.4.3\r\n- praw \r\n\r\nHow to install praw the easy way: \r\n\r\n python -m pip install praw\r\n \r\n" }, { "alpha_fraction": 0.5809734463691711, "alphanum_fraction": 0.5840708017349243, "avg_line_length": 34.88888931274414, "blob_id": "3cc991daf39cc895ff6a54699ef78bf76bf3a924", "content_id": "eb00cc145349fc9903e1bb6060ea1b3f6f3cadd2", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2260, "license_type": "no_license", "max_line_length": 92, "num_lines": 63, "path": "/RedditBot.py", "repo_name": "J-Demian/RedditBot", "src_encoding": "UTF-8", "text": "import praw \nfrom time import sleep, gmtime, strftime\nimport sys \n\ndef tryprint(str):\n try:\n print(str)\n except UnicodeEncodeError:\n # do nothing? \n print('Bummer! UnicodeEncodeError!')\n\ndef tryprintstderr(str):\n try:\n print(str, file=sys.stderr)\n except UnicodeEncodeError:\n print('Bummer, Unicode error!', file=sys.stderr)\n\nclient = praw.Reddit(user_agent='RedditBot (https://github.com/J-Demian/RedditBot)')\n# Ask for username and password at start-up \n# client.login() \n\n# Keep track of the posts we replied to (hash set for efficiency) \nvisited = set()\n\n# Key words which the bot reacts to (lower case) \nfile = open('triggers.txt', 'r')\nlines = file.readlines()\nfile.close()\n# All lines end in '\\n', we'll remove them \ntriggers = list(map(lambda x: x[:-1], lines))\n\n# Main loop \nwhile True:\n subreddit = client.get_subreddit('all')\n # Grab new posts from reddit \n for post in subreddit.get_new(limit=100):\n if post.id not in visited:\n # Current time will be used as a timestamp\n timestamp = strftime(\"[%H:%M:%S]\", gmtime())\n print(timestamp, post.id)\n tryprint('\\t Sub: {}'.format(post.subreddit))\n tryprint('\\t Title: {}'.format(post.title))\n tryprint('\\t Author: {}'.format(post.author))\n tryprint('\\t URL: {}'.format(post.url))\n print('')\n visited.add(post.id)\n # Decide whether we should do something \n # Get title as lower case \n title = post.title.lower()\n react = any(x in title for x in triggers)\n if react:\n # Default course of action in the response \n # is to simply post all comments found in \n # the thread. This can of course be edited\n print('{} {} Found something! '.format(timestamp, post.id), file=sys.stderr)\n tryprint('Content: {} \\n'.format(post.selftext))\n comments = post.comments\n for comment in comments:\n tryprint('\\t {} - {}'.format(comment, comment.author))\n ## Limit reaction interval?\n # sleep(1)\n # Let's be friendly to Reddit's servers \n sleep(10)" }, { "alpha_fraction": 0.7735849022865295, "alphanum_fraction": 0.7735849022865295, "avg_line_length": 41.20000076293945, "blob_id": "745cbb4550ed97b063475926fb35438b36bcf7d0", "content_id": "70eb3c2a6181b26367e05fc907db287bcd44133d", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 212, "license_type": "no_license", "max_line_length": 109, "num_lines": 5, "path": "/scripts/README.md", "repo_name": "J-Demian/RedditBot", "src_encoding": "UTF-8", "text": "## Scripts\n\nThese are not really 'project-worthy' but they are related to Reddit so I thought I'd just put them up here. \n\nThey are simple yet effective scripts I wrote to improve my Reddit-browsing experience. \n" } ]
3
khansaadbinhasan/TurtleMover
https://github.com/khansaadbinhasan/TurtleMover
008df48315217ec2ea094f56ae34ac584c6a6e67
0edcf6c14a272f3a4f8b1031795e24dfa4cce4d2
ae5087758402887339c67884a876addccd045c51
refs/heads/master
2020-05-09T08:51:27.686405
2019-04-17T06:01:44
2019-04-17T06:01:44
180,996,205
1
0
null
2019-04-12T11:40:15
2019-04-12T11:40:18
2019-04-12T11:41:58
null
[ { "alpha_fraction": 0.5788732171058655, "alphanum_fraction": 0.6049295663833618, "avg_line_length": 17.366378784179688, "blob_id": "b1c427ad57afbb1111b216f5ed3f7a2bc89b8172", "content_id": "1e8ab26d896fff73980b454c7cc7b6ae46356f17", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 4260, "license_type": "permissive", "max_line_length": 106, "num_lines": 232, "path": "/src/gazebo_turtle/turtle_path.py", "repo_name": "khansaadbinhasan/TurtleMover", "src_encoding": "UTF-8", "text": "#!/usr/bin/env python\n\nimport rospy\nimport numpy as np\nimport math\nfrom sensor_msgs.msg import LaserScan\nfrom geometry_msgs.msg import Twist\nimport sys, traceback\nfrom nav_msgs.msg import Odometry\n\n\n\npub = rospy.Publisher(\"/cmd_vel_mux/input/navi\", Twist, queue_size=5)\n\ndist = {\n\t\"Rightold\" : 0,\n\t\"Leftold\" : 0,\n\t\"Frontold\" : 0,\n\t\"RightDel\": 0,\n\t\"LeftDel\": 0,\n\t\"FrontDel\" : 0,\n\t\"Rightnew\": 0,\n\t\"Leftnew\": 0,\n\t\"Frontnew\" : 0\n}\n\nflag = [False, False, False, False, False, False, False]\n\npos = {\n\t\"currentX\" : 0,\n\t\"currentY\" : 0,\n\t\"initX\" : 0,\n\t\"initY\" : 0\n}\n\nangVel = 0\n\ndef laser_message( subMsg ):\n\tpubMsg = Twist()\n\n\n\txVel, angVel = path_algo( subMsg )\n\n\tpubMsg.angular.z = angVel\n\tpubMsg.linear.x = xVel\n\t\n\tpub.publish(pubMsg)\n\n\ndef odom_message( subMsg ):\n\tglobal pos\n\tglobal flag\n\n\n\tpos[\"currentX\"] = subMsg.pose.pose.position.x\n\tpos[\"currentY\"] = subMsg.pose.pose.position.y\n\n\tif flag[6] == False:\n\t\tflag[6] = True\n\t\tpos[\"initX\"] = pos[\"currentX\"]\n\t\tpos[\"initY\"] = pos[\"currentY\"]\n\n\n\tangZ = subMsg.pose.pose.orientation.z\n\n\ndef path_algo( subMsg ):\n\tglobal dist\n\tglobal flag\n\tglobal pos\n\n\t\n\n\t# These statements take care of the nan values: \n\t# The values are nan for out of range of (0.5,10)\n\n\tif ~np.isnan(subMsg.ranges[0]):\n\t\tdist[\"Rightnew\"] = subMsg.ranges[0]\n\t\tdist[\"RightDel\"] = dist[\"Rightnew\"] - dist[\"Rightold\"]\n\n\telif np.isnan(subMsg.ranges[0]):\n\t\t\n\t\t# if dist[\"RightDel\"] >= 0:\n\t\tdist[\"Rightnew\"] = 11\n\n\t\t# else:\n\t\t# \tdist[\"Rightnew\"] = 0\n\n\n\tif ~np.isnan(subMsg.ranges[len(subMsg.ranges)/2]):\n\t\tdist[\"Frontnew\"] = subMsg.ranges[len(subMsg.ranges)/2] \n\t\tdist[\"FrontDel\"] = dist[\"Frontnew\"] - dist[\"Frontold\"]\n\n\telif np.isnan(subMsg.ranges[len(subMsg.ranges)/2]):\n\t\t# if dist[\"FrontDel\"] >= 0:\n\t\tdist[\"Frontnew\"] = 11\n\n\t\t# else:\n\t\t# \tdist[\"Frontnew\"] = 0\n\n\n\tif ~np.isnan(subMsg.ranges[-1]):\n\t\tdist[\"Leftnew\"] = subMsg.ranges[-1]\n\t\tdist[\"LeftDel\"] = dist[\"Leftnew\"] - dist[\"Leftold\"]\n\n\telif np.isnan(subMsg.ranges[-1]):\n\t\t# if dist[\"LeftDel\"] >= 0:\n\t\tdist[\"Leftnew\"] = 11\n\n\t\t# else:\n\t\t# \tdist[\"Leftnew\"] = 0\n\n\n\n\tdistList = [dist[\"Frontnew\"], dist[\"Leftnew\"], dist[\"Rightnew\"]]\n\tmaxDist = max(distList)\n\n\tangVel = 0\n\txVel = 0\n\n\tleft = -1\n\tright = 1\n\tfront = 1\n\tback = -0.1\n\trest = 0\n\n\n\tX = pos[\"currentX\"] - pos[\"initX\"]\n\tY = pos[\"currentY\"] - pos[\"initY\"]\n\n\n\tprint(\"\\n\"*3)\n\tprint(\"distRight: \", dist[\"Rightnew\"])\n\tprint(\"distFront: \", dist[\"Frontnew\"])\n\tprint(\"distLeft: \", dist[\"Leftnew\"])\n\n\tprint(\"initX: \", pos[\"initX\"])\n\tprint(\"initY: \", pos[\"initY\"])\n\n\tprint(\"X: \", X)\n\tprint(\"Y: \", Y)\n\n\tprint(\"\\n\"*3)\n\n\tif dist[\"Frontnew\"] > 0.5 and dist[\"Leftnew\"] > 0.5 and dist[\"Rightnew\"] > 0.5:\n\t\t\n\t\tif dist[\"Frontnew\"] < 0.75 or dist[\"Leftnew\"] < 0.75 or dist[\"Rightnew\"] < 0.75:\n\n\t\t\txVel = rest\n\n\n\t\t\tif dist[\"Frontnew\"] < 0.75 or flag[4] == True:\n\t\t\t\txVel = -0.1\n\t\t\t\tflag[4] = True\n\t\t\t\tangVel = right\n\n\t\t\t\tprint(\"going back\")\n\t\t\t\tprint(\"rotating left\")\n\n\t\t\t\tif ( Y < 3 and Y > -3 and X < 3 ) or flag[5] == True:\n\t\t\t\t\tangVel = left\n\t\t\t\t\tflag[5] = True\n\n\t\t\t\t\tprint(\"rotating right\")\n\n\t\t\t\t\n\n\t\t\telif dist[\"Rightnew\"] < 0.75 or flag[2] == True:\n\t\t\t\tangVel = left\n\t\t\t\tflag[2] = True\n\t\t\t\tflag[1] = False\n\t\t\t\tflag[0] = False\n\n\t\t\t\tprint(\"rotating left\")\n\n\t\t\telif dist[\"Leftnew\"] < 0.75 or flag[1] == True:\n\t\t\t\tangVel = right\n\t\t\t\tflag[0] = False\n\t\t\t\tflag[1] = True\t\n\t\t\t\tflag[2] = False\n\n\t\t\t\tprint(\"rotating right\")\n\n\t\telif dist[\"Frontnew\"] == maxDist or flag[0] == True:\n\t\t\txVel = front\n\t\t\tflag[0] = True\n\t\t\tflag[1] = False\n\t\t\tflag[2] = False\n\n\t\t\tprint(\"going forward\")\n\n\t\telif dist[\"Leftnew\"] == maxDist or flag[1] == True:\n\t\t\tangVel = right\n\t\t\tflag[0] = False\n\t\t\tflag[1] = True\n\t\t\tflag[2] = False\n\n\t\t\tprint(\"rotating right\")\n\n\t\telif dist[\"Rightnew\"] == maxDist or flag[2] == True:\n\t\t\tangVel = left\n\t\t\tflag[0] = False\n\t\t\tflag[1] = False\n\t\t\tflag[2] = True\n\n\t\t\tprint(\"rotating left\")\n\n\n\t\tif dist[\"Frontnew\"] > 0.5 and dist[\"Frontnew\"] < 0.75:\n\t\t\tflag[0] = False\n\n\n\tdist[\"Rightold\"], dist[\"Leftold\"], dist[\"Frontold\"] = dist[\"Rightnew\"], dist[\"Leftnew\"], dist[\"Frontnew\"]\n\n\treturn xVel, angVel\n\ndef run():\n\trospy.init_node(\"demoMover\", anonymous=True)\n\trospy.Subscriber(\"/scan\", LaserScan, laser_message)\t\n\trospy.Subscriber(\"/odom\", Odometry, odom_message)\t\n\n\trospy.spin()\n\n\n\nif __name__ == '__main__':\n\n\ttry:\n\t\trun()\n\n\texcept rospy.ROSInterruptException:\n\t\tpass" }, { "alpha_fraction": 0.7683946490287781, "alphanum_fraction": 0.7784280776977539, "avg_line_length": 53.3863639831543, "blob_id": "e3d5e1fb0e2bac22f58cd7f3b0316649e8d71429", "content_id": "4fde9bea571b1472788f2e446c31132b2628116d", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 2392, "license_type": "permissive", "max_line_length": 336, "num_lines": 44, "path": "/README.md", "repo_name": "khansaadbinhasan/TurtleMover", "src_encoding": "UTF-8", "text": "# TurtleMover\n\nThis is a Package I made to complete the following task:\n> Write ros node to control the movement of turtlebot so as to reach from current\nstarting point to position marked in red. Use LaserScan data and move turtlebot in the\ndirection of farthest obstacle in the world. No predefined movement to be written in the\nnode. The safe distance from obstacle is 0.5 m.\n\n## Installation\n\nAfter installing [ROS Kinetic Desktop Full](http://wiki.ros.org/kinetic/Installation/Ubuntu) on [Ubuntu 16.04](http://cdimage.ubuntu.com/netboot/16.04/), install [turtlebot_gazebo](http://wiki.ros.org/turtlebot_gazebo) package then run the following commands:\n\n```\n$ export TURTLEBOT_GAZEBO_WORLD_FILE=\"/opt/ros/kinetic/share/turtlebot_gazebo/worlds/corridor.world\"\n$ roslaunch turtlebot_gazebo turtlebot_world.launch\n```\nAfter this Gazebo should open up, move the turtlebot to starting position, it should look something like this:\n\n![gazebo_turtle image](assets/gazebo_turtle.png)\n\nIf you are facing any issues please refer to [ROS](https://answers.ros.org/questions/) or [Gazebo](http://answers.gazebosim.org/questions/) forums. If you are a newcomer to ROS or Gazebo please refer to [A Gentle Introduction to ROS](https://cse.sc.edu/~jokane/agitr/) and [Gazebo Tutorials](http://gazebosim.org/tutorials)\n\n## Code Execution\n\nDownload and extract the code in a Directory say `ROS_WORKSPACE`, From the `ROS_WORKSPACE` Directory in your terminal run the following commands:\n\n```\n$ catkin_make\n$ source devel/setup.bash #use source devel/setup.zsh for zsh\n$ chmod 777 src/gazebo_turtle/turtle_path.py\n$ rosrun gazebo_turtle/turtle_path.py\n```\n\nAfter running the above commands the turtlebot should start moving as shown in the video below:\n\n![gazebo_turtle gif](assets/gazebo_turtle.gif)\n\nThe full video can be found [here](https://www.youtube.com/watch?v=aV1GmPjS0P4)\n\n## The Code\n\nThe code is very simple to understand once you have some knowledge of ROS and gazebo. Use `rotopic list` to see topics and do `rostopic echo /scan` to see laser data. The laser used in turtlebot has an angle from -30 to 30 degrees. Hence 0th value and last value represent right and left of turtlebot and mid value represents the front.\n\nUsing this data the turtlebot moves in the direction of farthest object, and if the distance from some object goes close to 0.75m it takes appropriate action to avoid collision" } ]
2
jaketanwh/tools
https://github.com/jaketanwh/tools
77f327d29d158dc96bf3219e8d132fa443c708f9
a3d014b06320313dab03b559fffcc9c168af537e
aece7d684600f294b8489700d67fceded40fe86c
refs/heads/master
2020-04-24T18:24:47.891086
2020-02-10T11:01:39
2020-02-10T11:01:39
172,178,795
1
1
null
null
null
null
null
[ { "alpha_fraction": 0.5798153281211853, "alphanum_fraction": 0.5857519507408142, "avg_line_length": 20.942028045654297, "blob_id": "55efffc9d1fd83e7c9c9e0d12189365e6d3f536f", "content_id": "d50de16d2d545773221ab2e9fd9a40be828d3703", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1532, "license_type": "no_license", "max_line_length": 49, "num_lines": 69, "path": "/msg/sendmsg.py", "repo_name": "jaketanwh/tools", "src_encoding": "UTF-8", "text": "import itchat\n\nMSG_CATCH = []\nWCHAT_ROOMNAME = '测试狗'\n\n\n# wchat\ndef sendMsgToWChat(msg,wchatList):\n for wchat in wchatList:\n users = itchat.search_friends(name=wchat)\n userName = users[0]['UserName']\n itchat.send(msg,toUserName=userName)\n\nitchat.search_chatrooms(name='LittleCoder')\n\n# wroom\ndef sendMsgToWRooms(msg,wroomList):\n print(msg)\n if True:\n return\n itchat.get_chatrooms(update=True)\n for wroom in wroomList:\n iRoom = itchat.search_chatrooms(wroom)\n for room in iRoom:\n if room['NickName'] == wroom:\n userName = room['UserName']\n itchat.send_msg(msg, userName)\n break\n\n# wroom\ndef sendMsgToWRoom(msg):\n print(msg)\n if True:\n return\n global WCHAT_ROOMNAME\n wroom = WCHAT_ROOMNAME\n iRoom = itchat.search_chatrooms(wroom)\n for room in iRoom:\n if room['NickName'] == wroom:\n userName = room['UserName']\n itchat.send_msg(msg, userName)\n break\n\n\n\ndef update():\n global MSG_CATCH\n if len(MSG_CATCH) == 0:\n return\n\n for i in range(100):\n sendMsgToWRoom(MSG_CATCH[0])\n MSG_CATCH.pop(0)\n if len(MSG_CATCH) == 0:\n break\n if len(MSG_CATCH) > 0:\n print('剩余消息数:'+ str(len(MSG_CATCH)))\n\ndef add(msg):\n if msg == None or msg == '':\n return\n\n global MSG_CATCH\n MSG_CATCH.append(msg)\n\n\ndef start():\n itchat.auto_login(hotReload=True)\n print('[sendmsg] itchat init')\n\n\n" }, { "alpha_fraction": 0.44416242837905884, "alphanum_fraction": 0.45304569602012634, "avg_line_length": 27.178571701049805, "blob_id": "6ba7a82dc778dc47388d2160d1fecf19327389ca", "content_id": "618714e9a06e8b050e17af982d121b6ab9db2078", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 856, "license_type": "no_license", "max_line_length": 57, "num_lines": 28, "path": "/surprise/surfunc.py", "repo_name": "jaketanwh/tools", "src_encoding": "UTF-8", "text": "#K线类\nclass SURKINFO:\n m_open = 0 #开盘价\n m_high = 0 #最高价\n m_low = 0 #最低价\n m_close = 0 #收盘价\n m_volume = 0 #成交量\n m_amount = 0 #成交额\n\n def __init__(self,open,high,low,close,volume,amount):\n self.m_open = open\n self.m_high = high\n self.m_low = low\n self.m_close = close\n self.m_volume = volume\n self.m_amount = amount\n\n#财务数据\nclass FUNNYINFO:\n m_hehe = 0\n\n#数据类\nclass SURINFO:\n m_sur_k_info = None #k线数据\n m_sur_funny_info = None #财务数据\n def __init__(self,sur_k_info,sur_funny_info):\n self.m_sur_k_info = sur_k_info\n self.m_sur_funny_info = sur_funny_info" }, { "alpha_fraction": 0.46604329347610474, "alphanum_fraction": 0.48203739523887634, "avg_line_length": 23.196428298950195, "blob_id": "58e856be7037dcf265851c8028ebf4764449c136", "content_id": "8109320e263dac0465dccef65f0fae778a37851a", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 4082, "license_type": "no_license", "max_line_length": 67, "num_lines": 168, "path": "/data/util.py", "repo_name": "jaketanwh/tools", "src_encoding": "UTF-8", "text": "#工具类用于读取数据\nimport sys\nsys.path.append('../tool')\nimport tools\n\n#index\nINDEX_MACD = 13\nINDEX_BOLL = 14\nINDEX_VOL = 5\nINDEX_VOL5 = 7\nINDEX_VOL10 = 9\nINDEX_VOL20 = 11\nINDEX_TURN = 5\nINDEX_LB = 10\n#macd\ndef macd(conn,code,date=None):\n if date == None:\n date = tools.getlastday()\n cursor = conn.cursor()\n sql = \"SELECT * FROM `\" + code + \"` WHERE day = '\" + date + \"'\"\n o = cursor.execute(sql)\n if o > 0:\n res = cursor.fetchall()\n cursor.close()\n global INDEX_MACD\n return res[0][INDEX_MACD]*0.01\n else:\n cursor.close()\n return None\n\n\n#boll\ndef boll(conn,code,date=None):\n if date == None:\n date = tools.getlastday()\n cursor = conn.cursor()\n sql = \"SELECT * FROM `\" + code + \"` WHERE day = '\" + date + \"'\"\n o = cursor.execute(sql)\n if o > 0:\n res = cursor.fetchall()\n cursor.close()\n global INDEX_BOLL\n _boll = res[0][INDEX_BOLL]\n _boll = _boll.strip('[]')\n arr = _boll.split(',')\n arr[0] = float(arr[0])\n arr[1] = float(arr[1])\n arr[2] = float(arr[2])\n return arr\n else:\n cursor.close()\n return None\n\n\n#vol\ndef vol(conn,code,param,date=None):\n if date == None:\n date = tools.getlastday()\n cursor = conn.cursor()\n sql = \"SELECT * FROM `\" + code + \"` WHERE day = '\" + date + \"'\"\n o = cursor.execute(sql)\n if o > 0:\n res = cursor.fetchall()\n cursor.close()\n global INDEX_MACD\n index = INDEX_VOL\n if param == 5:\n index = INDEX_VOL5\n elif param == 10:\n index = INDEX_VOL10\n elif param == 20:\n index = INDEX_VOL20\n\n return res[0][index]\n else:\n cursor.close()\n return None\n\n#turn\ndef turn(conn,code):\n cursor = conn.cursor()\n sql = \"SELECT * FROM code WHERE id = '\" + code + \"'\"\n o = cursor.execute(sql)\n if o > 0:\n res = cursor.fetchall()\n cursor.close()\n global INDEX_TURN\n return res[0][INDEX_TURN] * 0.01\n else:\n cursor.close()\n return None\n\n#bkvol\ndef bkvol(conn,bkid,param,date=None):\n if date == None:\n date = tools.getlastday()\n cursor = conn.cursor()\n sql = \"SELECT * FROM code\"\n o = cursor.execute(sql)\n if o > 0:\n res = cursor.fetchall()\n cursor.close()\n bkid = str(bkid)\n list = []\n for row in res:\n code = row[0]\n bk = row[9]\n bk = bk.strip('[]')\n arr = bk.split(',')\n for _row in arr:\n if _row == bkid:\n list.append(code)\n break\n rsum = 0\n for code in list:\n rres = vol(conn, code, param, date)\n rsum = rsum + rres\n\n return round(rsum / len(list),2)\n else:\n cursor.close()\n return None\n\n#bkzd\ndef bkzd(conn, bkid, date=None):\n if date == None:\n date = tools.getlastday()\n\n cursor = conn.cursor()\n sql = \"SELECT * FROM code\"\n o = cursor.execute(sql)\n if o > 0:\n res = cursor.fetchall()\n cursor.close()\n bkid = str(bkid)\n upnum,midnum,downnum = 0,0,0\n for row in res:\n percent = row[2]\n bk = row[9]\n bk = bk.strip('[]')\n arr = bk.split(',')\n for _row in arr:\n if _row == bkid:\n if percent > 0:\n upnum = upnum + 1\n elif percent == 0:\n midnum = midnum + 1\n else:\n downnum = downnum + 1\n break\n return upnum, midnum, downnum\n else:\n cursor.close()\n return None\n\n#lb\ndef lb(conn,code):\n cursor = conn.cursor()\n sql = \"SELECT * FROM code WHERE id = '\" + code + \"'\"\n o = cursor.execute(sql)\n if o > 0:\n res = cursor.fetchall()\n cursor.close()\n global INDEX_LB\n return res[0][INDEX_LB]\n else:\n cursor.close()\n return None" }, { "alpha_fraction": 0.5193042159080505, "alphanum_fraction": 0.5637109279632568, "avg_line_length": 28.8354434967041, "blob_id": "4e253756179935680be68a99d0d8e735a39e8196", "content_id": "f1af2489bb9742881d1c96fd3a28cd0faddf5c70", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 7695, "license_type": "no_license", "max_line_length": 142, "num_lines": 237, "path": "/model/weipanfz.py", "repo_name": "jaketanwh/tools", "src_encoding": "UTF-8", "text": "import pymysql,sys,datetime,talib\nsys.path.append('../tool')\nsys.path.append('../data')\nimport tools,net\nimport pandas as pd\n\n#macd\ndef getmacd(df,short=0,long=0,mid=0):\n if short == 0:\n short = 12\n if long == 0:\n long = 26\n if mid == 0:\n mid = 9\n\n #df = df.drop('code', axis=1)\n # 计算短期的ema,使用pandas的ewm得到指数加权的方法,mean方法指定数据用于平均\n df['sema'] = pd.Series(df['close']).ewm(span=short).mean()\n # 计算长期的ema,方式同上\n df['lema'] = pd.Series(df['close']).ewm(span=long).mean()\n # 填充为na的数据\n df.fillna(0, inplace=True)\n # 计算dif,加入新列data_dif\n df['data_dif'] = df['sema'] - df['lema']\n # 计算dea\n df['data_dea'] = pd.Series(df['data_dif']).ewm(span=mid).mean()\n # 计算macd\n df['data_macd'] = 2 * (df['data_dif'] - df['data_dea'])\n # 填充为na的数据\n df.fillna(0, inplace=True)\n # 返回data的三个新列\n return df[['date', 'data_dif', 'data_dea', 'data_macd']]\n\n# 尾盘选股策略\ndef xgcl1(stock, data, daytime):#todayhal, cor\n #新股未满30天\n if len(data) < 30:\n return False\n\n todaydata = data[0]\n if todaydata[0] < daytime:\n print('停盘还是数据不是最新 -' + str(stock))\n #return False\n\n print(todaydata)\n # 今日一字板\n if todaydata[1] == todaydata[3] and todaydata[1] == todaydata[4]:\n return False\n\n #1)\n last1week_vol, last2week_vol, last3week_vol = 0, 0, 0\n #2)\n last2day_vol, last1day_vol = 0,0\n #3)\n last2day_close,last1day_close = 0,0\n #4)\n last1day_high, last2day_high, last3day_high = 0,0,0\n #5)\n last1day_low, last2day_low, last3day_low = 0,0,0\n #7)\n today_close = 0\n #8)\n today_vol = 0\n #10)\n today_low = 0\n index = 0\n for o in data:\n #day = o[0]\n #open = o[1]\n close = o[2]\n high = o[3]\n low = o[4]\n volume = o[5]\n\n #1)\n if index >= 5 and index <= 9:\n last1week_vol += volume\n elif index >= 10 and index <= 14:\n last2week_vol += volume\n elif index >= 15 and index <= 19:\n last3week_vol += volume\n #2)\n if index == 0:\n today_close = close\n today_vol = volume\n today_low = low\n elif index == 1:\n last1day_vol = volume\n last1day_close = close\n last1day_high = high\n last1day_low = low\n elif index == 2:\n last2day_vol = volume\n last2day_close = close\n last2day_high = high\n last2day_low = low\n elif index == 3:\n last3day_high = high\n last3day_low = low\n\n index = index + 1\n\n\n # 1)(上周量能 / 上上周量能)> 1.5 或 上周成交量 > 上上周成交量 >上上上周成交量\n conf_1 = 1.5\n if last1week_vol <= 0 or last2week_vol <= 0:\n return False\n if ((last1week_vol / last2week_vol) < conf_1):\n return False\n if (last1week_vol < last2week_vol) or (last2week_vol < last3week_vol):\n return False\n\n # 2) 昨日量能是前日的1.5-4倍\n conf_2_1, conf_2_2 = 1.5, 4\n if last1day_vol <= 0 or last2day_vol <= 0:\n return False\n tmp = (last1day_vol / last2day_vol)\n if (tmp < conf_2_1 or tmp > conf_2_2):\n return False\n print('2')\n # 3) 昨日收盘价大于前日收盘价\n if last1day_close <= 0 or last2day_close <= 0:\n return False\n if (last1day_close < last2day_close):\n return False\n print('3')\n # 4) 昨日最高价大于前2日最高价\n if (last1day_high < last2day_high) or (last1day_high < last3day_high):\n return False\n print('4')\n # 5)\n # N-3日最低价低于N-2 日最高价\n if last3day_low >= last2day_high:\n # print('[未满足] N-3日最低价低于N-2 日最高价 - ' + security)\n return False\n # N-3日最低价高于N-2日最低价\n if last3day_low <= last2day_low:\n # print('[未满足] N-3日最低价高于N-2日最低价 - ' + security)\n return False\n # N-1日最低价高于N-2日最低价\n if last1day_low <= last2day_low:\n # print('[未满足] N-1日最低价高于N-2日最低价 - ' + security)\n return False\n # N-1 日收盘价高于N-3日最高价\n if last1day_close <= last3day_high:\n # print('[未满足] N-1 日收盘价高于N-3日最高价 - ' + security)\n return False\n print('5')\n # 6)N-1日上涨幅度大于5%\n conf_9 = 1.05\n if last1day_close <= 0 or last2day_close <= 0:\n return False\n if ((last1day_close / last2day_close) <= conf_9):\n return False\n print('6')\n # 7)当前已涨停\n if last1day_close <= 0 or today_close <= 0:\n return False\n if (today_close / last1day_close) >= 1.1:\n # print('当前已涨停 2 today_close:' + str(today_close) + ' last1day_close:'+str(last1day_close))\n return False\n print('7')\n # 8) 今日的成交量是昨日的0.8倍以下\n conf_5 = 0.8\n if today_vol <= 0 or last1day_vol <= 0:\n return False\n if (today_vol / last1day_vol) > conf_5:\n return False\n print('8')\n # 9) 5F,15F,日线,MACD diff值在0之上\n df = net.tushare_old_history(stock,'D',str(data[-1][0]),str(daytime))\n #macd = getmacd(df)\n #print('macd')\n #print(macd)\n\n #macd5m = get_macd([security], check_date=todayhal, unit='5m')\n #macd15m = get_macd([security], check_date=todayhal, unit='15m')\n #macd1d = get_macd([security], check_date=todayhal, unit='1d')\n #if macd5m == None or macd15m == None or macd1d == None:\n # return False\n #if (macd5m[security][0] < 0) or (macd15m[security][0] < 0) or (macd1d[security][0] < 0):\n # return False\n\n # 10) 今日(N日)最低价 大于N-2,N-3的最高价\n if ((today_low < last2day_high) or (today_low < last3day_high)):\n return False\n\n return True\n\n##主控函数\ndef init():\n global GLOBAL_CONN\n #读取mysql连接\n GLOBAL_CONN = pymysql.connect(host='192.168.1.103', user='root', password='Admin123!', db='gp', port=3306, charset='utf8')\n #GLOBAL_CONN = pymysql.connect(host='106.14.152.18', user='stockMarket', password='kdarrkmpjX5kCbTe', db='stockMarket', port=3306, charset='utf8')\n #GLOBAL_CONN = pymysql.connect(host='localhost', user='root', password='admin123!', db='gp', port=3306, charset='utf8')\n\ndef destroy():\n global GLOBAL_CONN\n if GLOBAL_CONN != None:\n GLOBAL_CONN.close()\n GLOBAL_CONN = None\n\n\n\ndef xuangu():\n conn = pymysql.connect(host='192.168.1.103', user='root', password='Admin123!', db='gp', port=3306, charset='utf8')\n #conn = pymysql.connect(host='localhost', user='root', password='admin123!', db='gp', port=3306, charset='utf8')\n cursor = conn.cursor()\n cursor.execute(\"SELECT * FROM code\")\n res = cursor.fetchall()\n stocks = {}\n for row in res:\n code = row[0]\n stocks[code] = {}\n\n daytime = tools.getlastday()\n results = []\n for stock in stocks:\n cursor.execute(\"SELECT day,open,close,high,low,volume FROM `\" + stock + \"` p ORDER BY p.day DESC LIMIT 30\")\n data = cursor.fetchall()\n ret = xgcl1(stock, data, daytime)\n if ret:\n results.append(stock)\n\n print('结果:')\n print(results)\n conn.close()\n conn = None\n '''\n stocks = list(get_all_securities(['stock']).index)\n stocks = filter_st(stocks)\n data = get_price(security, end_date=today, count=30,\n fields=['open', 'close', 'paused', 'high', 'low', 'volume'], frequency='1d')\n \n '''\nxuangu()\n" }, { "alpha_fraction": 0.4817836582660675, "alphanum_fraction": 0.49810099601745605, "avg_line_length": 30.883407592773438, "blob_id": "5b54facb95ca8db288cade2ad2a3375dbeee0cc4", "content_id": "07c3629e8ba120dd6a413eb0732ab3609fc55485", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 7613, "license_type": "no_license", "max_line_length": 277, "num_lines": 223, "path": "/data/t_code.py", "repo_name": "jaketanwh/tools", "src_encoding": "UTF-8", "text": "# code表数据\nimport sys\nsys.path.append('../tool')\nimport tools\nimport net\nimport kpltools\nimport t_bk\n\n#更新板块表 13min\nGLOBAL_BK = {}\ndef updateBK(name,id,percent):\n global GLOBAL_BK\n # 没有数据\n if name in GLOBAL_BK.keys():\n return GLOBAL_BK[name][0]\n GLOBAL_BK[name] = [id,percent]\n\n\n#取开盘啦个股数据\ndef kpl_gg(code):\n lastday = tools.getlastday()\n param = kpltools.build_kpl_gg(code,lastday)\n res = -1\n while (res == -1 or isinstance(res['pankou'],dict) == False or isinstance(res['pankou']['real'],dict) == False):\n res = net.kpl(param)\n\n #timeout\n if res == -2:\n return -1\n\n info = {}\n real = res['pankou']['real']\n info['pb'] = real['dyn_pb_rate'] #市净率\n info['percent'] = real['px_change_rate'] #涨跌幅\n info['turnover'] = real['turnover_ratio'] #换手率\n info['sjlt'] = int(real['sjlt']) #真实流通市值\n info['nmc'] = real['circulation_value'] #流通市值\n info['mktcap'] = real['market_value'] #总市值\n info['high'] = real['high_px'] #最高价\n info['low'] = real['low_px'] #最低价\n info['rvol'] = real['vol_ratio'] #量比\n\n #所属板块及板块涨幅\n bklist = []\n stockplate = res['stockplate']\n if stockplate == None:\n print('[code] ' + res['pankou']['name'] + ' stockplate is NoneType')\n else:\n for row in stockplate:\n bk_name = row[0] #板块name\n bk_zd = row[1] # 涨跌幅\n bk_id = row[8] # 板块id\n #更新bk表数据\n updateBK(bk_name,bk_id,bk_zd)\n bklist.append(bk_id)\n\n info['bk'] = str(bklist) #','.join()# str.split(',')\n return info\n\n#更新连板数据\ndef day_lb_calculate(res,st):\n _ban = 0\n _lastclose = 0\n for _row in res:\n _close = _row[2] / 100\n if _lastclose == 0:\n _lastclose = _close\n else:\n _tmp = getdt(_lastclose, st == 1)\n if _tmp == _close:\n _lastclose = _close\n _ban = _ban + 1\n else:\n break\n if _ban > 0:\n return _ban\n\n return -1\n\ndef getdt(close,st):\n if st:\n _corl = 1.05\n else:\n _corl = 1.1\n _dtj = Decimal(close / _corl).quantize(Decimal('0.00'))\n _dtj = '{:g}'.format(float(_dtj))\n return float(_dtj)\n\n# 遍历个股N天数据\ndef checkeach(cursor,code,st,ban=0):\n cursor.execute(\"SELECT high,low,close FROM `\" + code + \"` p ORDER BY p.day DESC LIMIT 20\")\n res = cursor.fetchall()\n if ban == 0:\n _lastclose = 0\n for _row in res:\n _close = _row[2] * 0.01\n if _lastclose == 0:\n _lastclose = _close\n else:\n _tmp = tools.getzt(_lastclose, st == 1)\n if _tmp == _close:\n _lastclose = _close\n ban = ban + 1\n else:\n break\n else:\n ban = 0\n sql = (\"UPDATE code SET lb=%d WHERE id = '\" + code + \"'\") % (ban)\n cursor.execute(sql)\n\n# 使用tushare 更新代码,st\ndef ts_updatecode(conn, today):\n if today.empty:\n return -1\n\n _list = {}\n _len = str(len(today))\n for i, row in today.iterrows():\n #code = row['ts_code']\n code = row['symbol']\n\n #if k != '30' and k != '60' and k != '00':\n # continue\n\n #if row['trade'] == 0:\n # continue\n\n info = -1\n while info == -1:\n info = kpl_gg(code)\n\n #print('[Code] kpl gg update - ' + code + '[' + str(i+1) + '/' + _len + ']')\n\n if row['name'].find('ST') >= 0:\n st = 1\n else:\n st = 0\n\n info['st'] = st # st 1.是 0.否\n #info['pb'] = round(info['pb'] * 100) # 市净率 保留两位四舍五入\n #info['per'] = round(row['per'] * 100) # 市盈率 保留两位四舍五入\n info['percent'] = round(info['percent'] * 100) # 涨跌幅 保留两位四舍五入\n info['turnover'] = round(info['turnover'] * 100) # 换手率 保留两位四舍五入\n info['sjlt'] = round((info['sjlt']) * 0.0001) # 真实流通市值 计数万单位\n info['nmc'] = round((info['nmc']) * 0.0001) # 流通市值 计数万单位\n info['mktcap'] = round((info['mktcap']) * 0.0001) # 总市值 计数万单位\n info['high'] = round(info['high'] * 100) # 最高价 保留两位四舍五入\n info['low'] = round(info['low'] * 100) # 最低价 保留两位四舍五入\n info['rvol'] = round(info['rvol'] * 100) # 量比\n _list[code] = info\n\n # 游标\n cursor = conn.cursor()\n # 创建code表 代码(id) 是否st(st 1.是 0.不是) 涨跌(percent) 市净率(pb) 市盈率(per) 换手(turnover) 总市值(mktcap) 流通市值(nmc) 真实市值(sjlt) 板块[名字1,名字2...](bk) 连板次数(lb)\n if tools.table_exists(cursor, 'code') == 0:\n cursor.execute(\n \"CREATE TABLE IF NOT EXISTS code(id TEXT,st TINYINT(1),percent SMALLINT,pb MEDIUMINT, per MEDIUMINT,turnover SMALLINT UNSIGNED,nmc INT UNSIGNED,mktcap INT UNSIGNED,sjlt INT UNSIGNED,bk TEXT,lb TINYINT UNSIGNED,high INT UNSIGNED,low INT UNSIGNED,rvol INT UNSIGNED)\")\n\n # 写入code表数据\n for key, value in _list.items():\n st = value['st']\n nmc = value['nmc']\n mkcap = value['mktcap']\n pb = 0#value['pb']\n per = 0#value['per']\n sjlt = value['sjlt']\n percent = value['percent']\n turnover = value['turnover']\n high = value['high']\n low = value['low']\n rvol = value['rvol']\n\n bk = value['bk'].replace('\\'', '')\n\n cursor.execute(\"SELECT * FROM code WHERE id=%s\", key)\n res = cursor.fetchall()\n if len(res) == 0:\n sql = \"INSERT INTO code(id,st,percent,pb,per,turnover,nmc,mktcap,sjlt,bk,high,low,rvol) VALUES('%s','%d','%d','%d','%d','%d','%d','%d','%d','%s', '%d', '%d', '%d')\" % (key, st, percent, pb, per, turnover, nmc, mkcap, sjlt, bk, high, low, rvol)\n print(sql)\n cursor.execute(sql)\n else:\n sql = (\"UPDATE code SET st=%d,percent=%d,pb=%d,per=%d,turnover=%d,nmc=%d,mktcap=%d,sjlt=%d,bk=%s,high=%d,low=%d,rvol=%d WHERE id = '\" + key + \"'\") % (st, percent, pb, per, turnover, nmc, mkcap, sjlt, \"'\" + bk + \"'\", high, low, rvol)\n print(sql)\n cursor.execute(sql)\n\n conn.commit()\n cursor.close()\n return 0\n\ndef update(conn):\n global GLOBAL_BK\n GLOBAL_BK = {}\n serverTime,serverDay = tools.get_servertime()\n print('[Code] 开始更新表 ' + \"%s/%s/%s \" %(serverTime.tm_year,serverTime.tm_mon, serverTime.tm_mday))\n ret = -1\n while ret == -1:\n print('')\n ret,today = net.tushare_today()\n\n ret = ts_updatecode(conn,today)\n if ret != 0:\n print('[code]表更新错误')\n return ret\n\n print('[Code]表更新完成')\n t_bk.update(conn,GLOBAL_BK)\n return ret\n\ndef completedupdate(conn):\n cursor = conn.cursor()\n cursor.execute(\"SELECT * FROM code\")\n res = cursor.fetchall()\n for row in res:\n code = row[0]\n st = row[1]\n percent = row[2] * 0.01\n if percent > 9.5:\n checkeach(cursor,code,st)\n else:\n checkeach(cursor,code,st,-1)\n\n conn.commit()\n cursor.close()" }, { "alpha_fraction": 0.5617977380752563, "alphanum_fraction": 0.5823969841003418, "avg_line_length": 24.428571701049805, "blob_id": "f044af7a6104b44ecf0d99e44c0b1032d7eb0eb4", "content_id": "722015671a16467059258ca1eab61fd68a1df8db", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 562, "license_type": "no_license", "max_line_length": 86, "num_lines": 21, "path": "/data/kpltools.py", "repo_name": "jaketanwh/tools", "src_encoding": "UTF-8", "text": "\nimport time\n\n#开盘啦个股数据\ndef build_kpl_gg(code,day = time.strftime(\"%Y%m%d\", time.localtime())):\n param = {}\n param['a'] = 'GetHQPlate'\n param['c'] = 'PCArrangeData'\n param['Day'] = day\n param['StockID'] = code\n param['SelType'] = '3,8,7' #1.trend 2.chouma 3.pankou 8.stockplate 7.selval\n return param\n\n#开盘啦板块数据\ndef build_kpl_bk(code):\n param = {}\n param['a'] = 'GetPlateKLineDay'\n param['c'] = 'ZhiShuKLine'\n param['st'] = 160\n param['Type'] = 'd'\n param['StockID'] = code\n return param" }, { "alpha_fraction": 0.43189480900764465, "alphanum_fraction": 0.45279839634895325, "avg_line_length": 28.959596633911133, "blob_id": "1ba630414686b58c3df046b813ae0e6ec14d8ca4", "content_id": "e080105628bdc4c995a3e30a6102168bc9933716", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3016, "license_type": "no_license", "max_line_length": 138, "num_lines": 99, "path": "/dog/kpl.py", "repo_name": "jaketanwh/tools", "src_encoding": "UTF-8", "text": "import sys\nsys.path.append('../data')\nsys.path.append('../msg')\nimport net,json,time\nimport sendmsg\nfrom decimal import *\n\n###############################################################################################\n# 开盘啦\n###############################################################################################\n#KPL_RUL = 'https://pchis.kaipanla.com/w1/api/index.php'\nKPL_RUL = 'https://pchq.kaipanla.com/w1/api/index.php'\nKPL_SIGN_TIME = 0\ndef kpldog():\n global KPL_RUL\n param = {}\n param['a'] = 'GetPointPlate'\n param['c'] = 'PCArrangeData'\n param['Index'] = '0'\n param['PointType'] = '1,2,3'\n param['st'] = '1'\n #param['Date'] = '2018-07-30'#time.strftime(\"%Y-%m-%d\", time.localtime())#\n param['Token'] = '2efa906af1b5641270b21845a4bea7c0'\n param['UserID'] = '228432'\n res = net.sendpost(KPL_RUL,param)\n if res != -1:\n try:\n data = json.loads(res)\n except Exception as ee:\n print(\"[kpl] dog json error\")\n return -1\n global KPL_SIGN_TIME\n for row in data['content']['List']:\n tid = row['Time']\n if tid <= KPL_SIGN_TIME:\n continue\n KPL_SIGN_TIME = tid\n comment = row['Comment']\n stock = row['Stock']\n for stk in stock:\n name = stk[1]\n tip = '[' + name + ',' + stk[0] + ',' + str(stk[2]) + '%]'\n comment = comment.replace(name,tip)\n\n time_local = time.localtime(tid)\n stime = time.strftime(\"%H:%M:%S\", time_local)\n msg = '[开盘啦][' + stime + '] ' + comment\n #print(msg)\n sendmsg.add(msg)\n\n\n\n\nKPL_ZLJE_LIST = [] #开盘啦主力净额列表\ndef kplje():\n global KPL_RUL\n param = {}\n param['a'] = 'RealRankingInfo'\n param['c'] = 'StockRanking'\n param['Ratio'] = '5'\n param['Type'] = '1'\n param['Index'] = '0'\n param['Order'] = '1'\n param['st'] = '50'\n param['Token'] = '2efa906af1b5641270b21845a4bea7c0'\n param['UserID'] = '228432'\n res = net.sendpost(KPL_RUL,param)\n if res != -1:\n try:\n data = json.loads(res)\n except Exception as ee:\n print(\"[kpl] je json error\")\n return -1\n\n global KPL_ZLJE_LIST\n if data['errcode'] == '1001':\n print(\"[kpl] je login error\")\n return -1\n\n #print(data['list'])\n for row in data['list']:\n code = row['Code']\n if code in KPL_ZLJE_LIST:\n continue\n\n ZLJE = row['ZLJE']\n jz = Decimal(ZLJE / 100000000).quantize(Decimal('0.00'))\n jz = '{:g}'.format(float(jz))\n jz = float(jz)\n if jz > 2:\n msg = '[主力净额][' + time.strftime(\"%H:%M:%S\", time.localtime()) + '] ' + row['Name'] + ' ' + code + ' 本日净流入' + str(jz) + '亿'\n #print(msg)\n sendmsg.add(msg)\n KPL_ZLJE_LIST.append(code)\n\n\ndef update():\n kpldog()\n kplje()\n" }, { "alpha_fraction": 0.5363584160804749, "alphanum_fraction": 0.5826536417007446, "avg_line_length": 30.422382354736328, "blob_id": "9005bcfd768a577b7984990cbbadd60b6707d806", "content_id": "2af5f7d12854f203f37ba6c08b51cd8561e686c1", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 9543, "license_type": "no_license", "max_line_length": 244, "num_lines": 277, "path": "/data/net.py", "repo_name": "jaketanwh/tools", "src_encoding": "UTF-8", "text": "\nimport requests\nimport tushare\nimport json\nimport time\n\n\n'''\nhead\n'''\ndef allheaders():\n headers = {\n 'Host':'www.iwencai.com',\n 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:61.0) Gecko/20100101 Firefox/61.0',\n 'Accept':'application/json, text/javascript, */*; q=0.01',\n 'Accept-Language':'zh-CN,zh;q=0.8,zh-TW;q=0.7,zAj0cAEQKOmPYSZ4PWGXP0lNnT5g22nHvewjVAP-CeRTDNlPK'\n 'h-HK;q=0.5,en-US;q=0.3,en;q=0.2',\n 'Accept-Encoding':'gzip,deflate',\n 'Referer': 'http://www.iwencai.com/stockpick/search?typed=0&preParams=&ts=1&f=1&qs=result_original&selfsectsn=&querytype=stock&searchfilter=&tid=stockpick&w=2018%2F7%2F5%20%E5%B9%B4%E7%BA%BF%E4%B8%8A&queryarea=',\n 'hexin-v': 'Ap--avq0OGnEhzx1GeQN6OVxLfIoBPOfDVn3mjHsOR-VkbHgOdSD9h0oh-xC',\n 'X-Requested-With': 'XMLHttpRequest',\n 'Cookie': 'cid=d39902441188593815b9de4a660beafe1512962748; ComputerID=d39902441188593815b9de4a660beafe1512962748; v=Ap--avq0OGnEhzx1GeQN6OVxLfIoBPOfDVn3mjHsOR-VkbHgOdSD9h0oh-xC; guideState=1; PHPSESSID=b9b44bc6f0b2832d1c1d80f334837c15',\n 'Connection': 'keep-alive'\n }\n return headers\n\ndef defaultheaders():\n headers = {\n \"User-Agent\": \"Mozilla/5.0 (Windows NT 6.1;Win64;x64;rv:61.0)Gecko/20100101 Firefox/61.0\"\n }\n return headers\n\n\n#send get\ndef send(url,typ=0,default=0):\n if default == 1:\n headers = allheaders()\n else:\n headers = defaultheaders()\n\n try:\n code_of_html = requests.get(url,headers=headers)\n except Exception as ee:\n print(\"[net] error\")\n return -1\n\n if code_of_html.status_code == 200:\n '''\n if typ == 1:\n print('code_of_html text')\n print(code_of_html.text)\n html_doc = str(code_of_html.content, 'utf-8')\n return html_doc\n else:\n '''\n return code_of_html.text\n else:\n print('[html] error:',code_of_html.status_code)\n return -1\n\n\n#send post\ndef sendpost(url,param):\n try:\n headers = defaultheaders()\n code_of_html = requests.post(url, data=param, headers=headers, timeout=5)\n if code_of_html.status_code != 200:\n return -1\n except requests.exceptions.Timeout:\n print(\"[net] timeout\")\n return -2\n except Exception as ee:\n print(\"[net] error\")\n return -1\n\n return code_of_html.text\n\n\n\n######################################################################################\n# tushare\n######################################################################################\nTUSHARE_INIT = 0 #0.未初始化 1.初始化\nTUSHARE_TOKEN = '55d930af86ad6b90068ff8e51c31aa35324d3a11329485ffbc7944ae'\ndef tushare_init():\n global TUSHARE_INIT, TUSHARE_TOKEN\n if TUSHARE_INIT == 0:\n tushare.set_token(TUSHARE_TOKEN)\n TUSHARE_INIT = 1\n return tushare.pro_api()\n\n#查询当前所有正常上市交易的股票列表\ndef tushare_today():\n try:\n pro = tushare_init()\n today = pro.stock_basic(exchange='', list_status='L', fields='ts_code,symbol,name,area,industry,list_date')\n\n #today = tushare.get_today_all()\n except Exception as ee:\n print(\"[tushare] today faild\")\n return -1,-1\n return 0,today\n\n#个股历史数据\n\"\"\"\nget_k_data(code=None, start='', end='',ktype='D',autype='qfq',index=False,retry_count=3,ause=0.001):\n 获取k线数据\n ---------\n Parameters:\n code:string 股票代码 e.g. 600848\n start:string 开始日期 format:YYYY-MM-DD 为空时取当前日期\n end:string 结束日期 format:YYYY-MM-DD 为空时取去年今日\n autype:string 复权类型,qfq-前复权 hfq-后复权 None-不复权,默认为qfq\n ktype:string 数据类型,D=日k线 W=周 M=月 5=5分钟 15=15分钟 30=30分钟 60=60分钟,默认为D\n retry_count : int, 默认 3 如遇网络等问题重复执行的次数\n ause : int, 默认 0 重复请求数据过程中暂停的秒数,防止请求间隔时间太短出现的问题\n drop_factor : bool, 默认 True 是否移除复权因子,在分析过程中可能复权因子意义不大,但是如需要先储存到数据库之后再分析的话,有该项目会更加灵活\n\"\"\"\n#def tushare_history(code,start='',end='',ktype='D',autype='qfq',index=False,retry_count=3,ause=0.001):\n# df = tushare.get_k_data(code,start,end,ktype,autype,index,retry_count,ause)\n# return df\n\"\"\"\n日线行情\nts_code \tstr \t股票代码\ntrade_date \tstr \t交易日期\nopen \tfloat \t开盘价\nhigh \tfloat \t最高价\nlow \tfloat \t最低价\nclose \tfloat \t收盘价\npre_close \tfloat \t昨收价\nchange \tfloat \t涨跌额\npct_chg \tfloat \t涨跌幅 (未复权,如果是复权请用 通用行情接口 )\nvol \tfloat \t成交量 (手)\namount \tfloat \t成交额 (千元)\n\n#ts_code='000001.SZ', start_date='20180701', end_date='20180718'\n\"\"\"\ndef tushare_history(code,start,end):\n try:\n pro = tushare_init()\n if int(code) >= 600000:\n symbol = code + '.SH'\n else:\n symbol = code + '.SZ'\n history = pro.daily(ts_code=symbol, start_date=start, end_date=end)\n except Exception as ee:\n print(\"[tushare] tushare_history faild\")\n return -1,-1\n return 0,history\n\ndef tushare_old_history(code,typ,start,end):\n try:\n history = tushare.get_hist_data(code, ktype=typ, start=start,end=end)\n except Exception as ee:\n print(\"[tushare] tushare_history faild\")\n return -1,-1\n return 0,history\n\n\"\"\"\nts_code \tstr \tTS股票代码\ntrade_date \tstr \t交易日期\nclose \tfloat \t当日收盘价\nturnover_rate \tfloat \t换手率(%)\nturnover_rate_f \tfloat \t换手率(自由流通股)\nvolume_ratio \tfloat \t量比\npe \tfloat \t市盈率(总市值/净利润)\npe_ttm \tfloat \t市盈率(TTM)\npb \tfloat \t市净率(总市值/净资产)\nps \tfloat \t市销率\nps_ttm \tfloat \t市销率(TTM)\ntotal_share \tfloat \t总股本 (万股)\nfloat_share \tfloat \t流通股本 (万股)\nfree_share \tfloat \t自由流通股本 (万)\ntotal_mv \tfloat \t总市值 (万元)\ncirc_mv \tfloat \t流通市值(万元)\n\n#'ts_code,trade_date,turnover_rate,volume_ratio,pe,pb'\n\"\"\"\ndef tushare_history_fields(code,start,fields):\n try:\n pro = tushare_init()\n if int(code) >= 600000:\n symbol = code + '.SH'\n else:\n symbol = code + '.SZ'\n history = pro.daily_basic(ts_code=symbol, trade_date=start, fields=fields)\n except Exception as ee:\n print(\"[tushare] tushare_history_fields faild \" + code)\n return -1, -1\n return 0, history\n\n\n\n#个股\ndef tusharepro_common():\n global TUSHARE_TOKEN\n tushare.set_token(TUSHARE_TOKEN)\n pro = tushare.pro_api()\n data = pro.stock_basic(exchange='', list_status='L', fields='ts_code,symbol,name,area,industry,list_date')\n #print(data)\n #df = tushare.pro_bar(ts_code='000001.SZ', adj='qfq', start_date='20190501', end_date='20190505')\n #print(df)\n\n\n#是否交易日\ndef tushare_trade(sdate,edate):\n try:\n pro = tushare_init()\n res = pro.trade_cal(exchange='SSE', start_date=sdate, end_date=edate)\n except Exception as ee:\n print(\"[tushare] tushare_trade faild\")\n return -1,-1\n return 0,res\n\n######################################################################################\n# 开盘啦\n######################################################################################\nKPL_RUL = 'https://pchq.kaipanla.com/w1/api/index.php'\nKPL_TOKEN = '2efa906af1b5641270b21845a4bea7c0'\nKPL_USERID = '228432'\n#开盘啦个股数据\ndef kpl(param):\n global KPL_RUL,KPL_TOKEN,KPL_USERID\n param['Token'] = KPL_TOKEN\n param['UserID'] = KPL_USERID\n res = sendpost(KPL_RUL,param)\n if res == -1:\n print('[kpl] sendpost error')\n return res\n try:\n data = json.loads(res)\n except Exception as ee:\n print(\"[kpl] json.loads error\")\n return -1\n return data\n\n\n\n######################################################################################\n# sina\n######################################################################################\nSINA_HISTORY_URL = \"http://money.finance.sina.com.cn/quotes_service/api/json_v2.php/CN_MarketData.getKLineData?symbol=%s&scale=%s&ma=%s&datalen=%s\"\n#code 代码\n#scale 分钟间隔(5、15、30、60、240)\n#ma 日均值(5、10、15、20、25)\n#len 个数\ndef sina_history(code,scale,ma,len):\n time.sleep(0.3)\n global SINA_HISTORY_URL\n if int(code) >= 600000:\n symbol = 'sh' + code\n else:\n symbol = 'sz' + code\n url = SINA_HISTORY_URL%(symbol,scale,ma,len)\n res = send(url)\n if res != -1:\n res = res.replace('day', '\"day\"')\n res = res.replace('open', '\"open\"')\n res = res.replace('low', '\"low\"')\n res = res.replace('high', '\"high\"')\n res = res.replace('close', '\"close\"')\n res = res.replace('volume:', '\"volume\":')\n res = res.replace('ma_price5', '\"ma_price5\"')\n res = res.replace('ma_volume5', '\"ma_volume5\"')\n res = res.replace('ma_price10', '\"ma_price10\"')\n res = res.replace('ma_volume10', '\"ma_volume10\"')\n res = res.replace('ma_price20', '\"ma_price20\"')\n res = res.replace('ma_volume20', '\"ma_volume20\"')\n try:\n evalRes = eval(res)\n except Exception as ee:\n print(\"[sina] eval res faild\")\n return -1\n return evalRes\n return -1\n\nif __name__ == \"__main__\":\n tusharepro_common()\n" }, { "alpha_fraction": 0.404127836227417, "alphanum_fraction": 0.4081225097179413, "avg_line_length": 34.78571319580078, "blob_id": "9d4478f0093c0536471803e4a020bd57ccc63332", "content_id": "4b7952cc0918aea245949ee032a98444a0009d23", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1528, "license_type": "no_license", "max_line_length": 95, "num_lines": 42, "path": "/dog/cls.py", "repo_name": "jaketanwh/tools", "src_encoding": "UTF-8", "text": "import sys\nsys.path.append('../data')\nsys.path.append('../msg')\nimport net,json,re,time\nimport sendmsg\n\n###############################################################################################\n# 财联社\nCLS_CATCH_LIST = [] # 财联社缓存列表\nCLS_URL = 'https://www.cailianpress.com/'\n###############################################################################################\n\ndef update():\n global CLS_URL\n res = net.send(CLS_URL, 0)\n if res != -1:\n global CLS_CATCH_LIST\n\n baseinfo = re.findall(\".*__NEXT_DATA__ = (.*)\\\\n module=.*\", res)\n if len(baseinfo) <= 0:\n return\n\n data = json.loads(baseinfo[0])\n dataList = data['props']['initialState']['telegraph']['dataList']\n for info in dataList:\n level = info['level']\n if level == 'B' or level == 'A':\n id = info['id']\n if id not in CLS_CATCH_LIST:\n CLS_CATCH_LIST.append(id)\n ctime = info['ctime']\n content = info['content']\n pat = re.compile(r'<[^>]+>', re.S)\n content = pat.sub('', content)\n # modified_time = info['modified_time']\n ftime = time.strftime(\"%H:%M:%S\", time.localtime(ctime))\n msg = '[财联社]' + '[' + ftime + ']' + content\n #print(msg)\n sendmsg.add(msg)\n\n if len(CLS_CATCH_LIST) > 30:\n CLS_CATCH_LIST.pop()" }, { "alpha_fraction": 0.491273432970047, "alphanum_fraction": 0.5171299576759338, "avg_line_length": 25.220338821411133, "blob_id": "5426ffdeac3a160935068c4412a99dae5dd8c50d", "content_id": "0d0f943e1e2ab3009d38be093fa61a11a48cec87", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1619, "license_type": "no_license", "max_line_length": 143, "num_lines": 59, "path": "/data/data.py", "repo_name": "jaketanwh/tools", "src_encoding": "UTF-8", "text": "import pymysql\n\n#以下是数据表\nimport t_code,t_gg\n\n############################################################\n##通用全局\nGLOBAL_CONN = None #mysql链接\n############################################################\n\n############################################################\n#更新code表\ndef updateCode():\n global GLOBAL_CONN\n if GLOBAL_CONN == None:\n print('[data] updateCode GLOBAL_CONN None')\n return -1\n res = -1\n while res == -1:\n res = t_code.update(GLOBAL_CONN)\n\n#更新个股表\ndef updateGG():\n global GLOBAL_CONN\n if GLOBAL_CONN == None:\n print('[data] updateGG GLOBAL_CONN None')\n return -1\n res = -1\n while res == -1:\n res = t_gg.update(GLOBAL_CONN)\n\n\n#数据更新完后统计\ndef onCompleted():\n global GLOBAL_CONN\n t_code.completedupdate(GLOBAL_CONN)\n\n############################################################\n##主控函数\ndef init():\n global GLOBAL_CONN\n #读取mysql连接\n GLOBAL_CONN = pymysql.connect(host='192.168.1.103', user='root', password='Admin123!', db='gp', port=3306, charset='utf8')\n #GLOBAL_CONN = pymysql.connect(host='106.14.152.18', user='stockMarket', password='kdarrkmpjX5kCbTe', db='stockMarket', port=3306, charset='utf8')\n #GLOBAL_CONN = pymysql.connect(host='localhost', user='root', password='admin123!', db='gp', port=3306, charset='utf8')\n\n\ndef destroy():\n global GLOBAL_CONN\n if GLOBAL_CONN != None:\n GLOBAL_CONN.close()\n GLOBAL_CONN = None\n\ndef start():\n init()\n updateCode()\n updateGG()\n onCompleted()\n destroy()\n" }, { "alpha_fraction": 0.6305732727050781, "alphanum_fraction": 0.6326963901519775, "avg_line_length": 20.454545974731445, "blob_id": "c1e9e5d250a6c6de253bb33003ed425f32a32de9", "content_id": "3ec3dea48655d5d7ea2b6e52ea60864d80448662", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 481, "license_type": "no_license", "max_line_length": 47, "num_lines": 22, "path": "/surprise/wechat.py", "repo_name": "jaketanwh/tools", "src_encoding": "UTF-8", "text": "import itchat\nimport json\n\ndef loadmsg():\n file = open(\"msg.txt\", encoding='utf-8')\n msg = json.load(file)\n msgs = {}\n for each in msg:\n msgs[each['question']] = each['answer']\n return msgs\n\nwechatMsgs = loadmsg()\n\n@itchat.msg_register(itchat.content.TEXT)\ndef text_reply(msg):\n reply = wechatMsgs.get(msg[\"Text\"])\n if reply == None:\n reply = '请换个问题'\n itchat.send_msg(reply, msg['FromUserName'])\n\nitchat.auto_login(True)\nitchat.run()" }, { "alpha_fraction": 0.47013187408447266, "alphanum_fraction": 0.49185416102409363, "avg_line_length": 31.9743595123291, "blob_id": "dd8bb9447473d1ca4a4cc64183c61e716ebe7fe8", "content_id": "5b000a529969901445c0c972198fafba20cb8a75", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1395, "license_type": "no_license", "max_line_length": 128, "num_lines": 39, "path": "/surprise/clcore.py", "repo_name": "jaketanwh/tools", "src_encoding": "UTF-8", "text": "\n\n\n# 遍历个股N天数据\ndef checkeach(cursor,code,st,ban=0):\n cursor.execute(\"SELECT high,low,close FROM `\" + code + \"` p ORDER BY p.day DESC LIMIT 20\")\n res = cursor.fetchall()\n if ban == 0:\n _lastclose = 0\n for _row in res:\n _close = _row[2] * 0.01\n if _lastclose == 0:\n _lastclose = _close\n else:\n _tmp = tools.getzt(_lastclose, st == 1)\n if _tmp == _close:\n _lastclose = _close\n ban = ban + 1\n else:\n break\n else:\n ban = 0\n sql = (\"UPDATE code SET lb=%d WHERE id = '\" + code + \"'\") % (ban)\n cursor.execute(sql)\n\n#处理包含并返回缠论K线数据\ndef initkx(conn):\n cursor = conn.cursor()\n cursor.execute(\"SELECT * FROM code\")\n res = cursor.fetchall()\n for row in res:\n # 代码(id) 是否st(st 1.是 0.不是) 涨跌(percent) 市净率(pb) 市盈率(per) 换手(turnover) 总市值(mktcap) 流通市值(nmc) 真实市值(sjlt) 板块[名字1,名字2...](bk)\n _code = row[0]\n cursor.execute(\"SELECT day,open,high,low,close FROM `\" + _code + \"` p ORDER BY p.day DESC LIMIT 100\")\n _res = cursor.fetchall()\n for _row in _res:\n #_code = _row[0]\n st = _row[1]\n percent = _row[2] * 0.01\n\n cursor.close()\n return 0\n" }, { "alpha_fraction": 0.44495412707328796, "alphanum_fraction": 0.4644147753715515, "avg_line_length": 28.425357818603516, "blob_id": "bf6cd38dc8c7e385ee8ee4cef9ddfdfa7fed6fe3", "content_id": "6a31cead1a6d1f8008cb63348ae97036da239e99", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 15706, "license_type": "no_license", "max_line_length": 143, "num_lines": 489, "path": "/dog/dog.py", "repo_name": "jaketanwh/tools", "src_encoding": "UTF-8", "text": "import pymysql,sys\nsys.path.append('../data')\nsys.path.append('../tool')\nsys.path.append('../msg')\nimport tools,net\nimport sendmsg\n\n############################################################\n##逻辑处理\nGP_CATCH_DIC = {} # 股票缓存字典\nBK_CATCH_DIC = {} # 个股对应版块缓存字典\nBK_NAME_CATCH_DIC = {} # 版块名称缓存字典\n#TIP_CATCH_LIST = [] # 消息缓存列表\n############################################################\n\n#盘中看盘狗\n# TODO\n# 1.多线程发送协议,运行策略与请求数据分别进行\n# 2.未开板新股去除判定\n'''数据结构\n [0]名字 [1]今日开盘价 [2]昨日收盘价 [3]当前价格\n [4]今日最高价 [5]今日最低价 [6]竞买价,即“买一”报价\n [7]竞卖价,即“卖一”报价 [8]成交的股票数,由于股票交易以一百股为基本单位,所以在使用时,通常把该值除以一百\n [9]成交金额,单位为“元”,为了一目了然,通常以“万元”为成交金额的单位,所以通常把该值除以一万\n [10]买一申请4695股,即47手 [11]买一报价 [12]买二申请 [13]买二报价\n [14]买三申请 [15]买三报价 [16]买四申请 [17]买四报价 [18]买五申请\n [19]买五报价 [20]卖一申报3100股,即31手 [21]卖一报价\n [22]卖二申请 [23]卖二报价 [24]卖三申请 [25]卖三报价 [26]卖四申请 [27]卖四报价 [28]卖五申请 [29]卖五报价\n [30]日期 [31]时间\n'''\ndef dog():\n stockmax = 33\n stock_name, stock_open, stock_lastclose, stock_price, stock_date, stock_time = 0, 1, 2, 3, 30, 31\n global GP_ALL_STR_URL_LIST,GP_CATCH_DIC\n for url in GP_ALL_STR_URL_LIST:\n res = net.send(url, 0, 0)\n if res == -1:\n print('[dog] dog net res err')\n continue\n\n stocks =(' ' + res).split(';')\n for val in stocks:\n code = val[14:][:6]\n stock = val[21:][:-1].split(',')\n if len(stock) != stockmax:\n #print('[dog] stock data err ' + str(stockmax))\n #print(stock)\n continue\n\n stocklist = GP_CATCH_DIC[code]['list']\n\n ############\n # 数据处理 #\n ############\n # 1)重复数据\n if len(stocklist) > 0 and stocklist[stock_time] == stock[stock_time]:\n continue\n # 2)停盘\n if float(stock[stock_price]) == 0:\n continue\n # 3)构建通用数据\n if len(stocklist) == 0:\n buildStockData(stock,code)\n\n # 4)清除保存数据\n stock[stock_name] = None\n stock[stock_open] = None\n stock[stock_date] = None\n stock[stock_lastclose] = None\n\n # 5)缓存数据\n GP_CATCH_DIC[code]['list'] = stock\n\n ############\n # 策略处理 #\n ############\n # 1)快速拉升/快速跳水\n quickup(code)\n\n # 2)首次涨到X%\n #firstup(code)\n\n # 3)涨跌停\n limitup(code)\n\n # 4)新高\n #highup(code)\n\n # 5)平台突破\n #platformup(code)\n\n # sendmsg\n #TIP_CATCH_LIST\n\ndef buildStockData(stock,code):\n stock_name,stock_open,stock_lastclose,stock_date = 0,1,2,30\n data = {}\n data['name'] = stock[stock_name]\n data['open'] = float(stock[stock_open])\n data['date'] = stock[stock_date]\n data['lastclose'] = float(stock[stock_lastclose])\n data['st'] = stock[stock_name].find('ST') >= 0\n data['last'] = []\n global GP_CATCH_DIC\n GP_CATCH_DIC[code] = data\n\n\n#快速拉升3%以上\ndef quickup(code):\n stock_price,stock_time = 3,31\n global GP_CATCH_DIC\n data = GP_CATCH_DIC[code]\n stock = data['list']\n lastprice = data['last'] # 上次价格\n curprice = float(stock[stock_price]) # 当前价格\n lastprice.append(curprice)\n\n lastlen = len(lastprice)\n if lastlen < 3:\n #数据太少无法计算\n return\n elif lastlen > 10:\n #只存储10个数据\n del lastprice[0]\n\n #快速拉升\n minprice = float(min(lastprice))\n if minprice <= 0:\n print('[dog] minprice err')\n #print(data)\n return\n global BK_NAME_CATCH_DIC #TIP_CATCH_LIST\n percent = float((curprice - minprice) / minprice * 100)\n #print('percent:' + str(percent) + ' curprice:' + str(curprice) + ' minprice:' + str(minprice))\n if percent >= 3:\n msg = '[拉升][' + stock[stock_time] + '] ' + data['name'] + ' ' + code + ' ' + BK_NAME_CATCH_DIC[code] + ' 快速拉升' + str(percent) + '%'\n #TIP_CATCH_LIST.append(msg)\n sendmsg.add(msg)\n lastprice.clear()\n return\n\n #快速跳水\n maxprice = float(max(lastprice))\n if maxprice <= 0:\n print('[dog] maxprice err')\n #print(data)\n return\n percent = float((maxprice - curprice) / curprice * 100)\n if percent >= 3:\n msg = '[跳水][' + stock[stock_time] + '] ' + data['name'] + ' ' + code + ' ' + BK_NAME_CATCH_DIC[code] + ' 快速跳水' + str(percent) + '%'\n #TIP_CATCH_LIST.append(msg)\n lastprice.clear()\n sendmsg.add(msg)\n\n\n#首次涨到3%\nFIRSTUP_OLD_TIP = [] #首次提示记录\ndef firstup(code):\n global FIRSTUP_OLD_TIP\n if code in FIRSTUP_OLD_TIP:\n return\n percent = 3 #3%\n stock_high,stock_time = 4,31\n global GP_CATCH_DIC\n data = GP_CATCH_DIC[code]\n stock = data['list']\n close = float(data['lastclose']) #昨日收盘价\n high = float(stock[stock_high]) #今日最高价\n price = tools.getpercent(close,percent)\n if high >= price:\n FIRSTUP_OLD_TIP.append(code)\n msg = '[涨幅][' + stock[stock_time] + '] ' + data['name'] + ' ' + code + ' 首次涨幅到3% ' + BK_NAME_CATCH_DIC[code]\n #TIP_CATCH_LIST.append(msg)\n sendmsg.add(msg)\n\n\n#涨停跌停\nGP_ZT_LIST = [] #涨停列表\nGP_DT_LIST = [] #跌停列表\n#GP_LB_LIST = {} #连板列表\ndef limitup(code):\n stock_price,stock_time = 3,31\n global GP_CATCH_DIC,GP_ZT_LIST,GP_DT_LIST #GP_CHECK_ZT_LIST,GP_DT_CNT,GP_ZT_CNT,GP_ZT_LIST\n data = GP_CATCH_DIC[code]\n stock = data['list']\n close = data['lastclose'] # 昨日收盘价\n open = data['open'] # 开盘价\n curprice = float(stock[stock_price]) # 当前价格\n st = data.get('st',False) # 是否st\n\n #涨停\n ztprice = float(tools.getzt(close,st))\n if curprice == ztprice:\n if code not in GP_ZT_LIST:\n GP_ZT_LIST.append(code)\n if open == curprice:\n #竞价涨停\n msg = '[竞价][' + stock[stock_time] + '] ' + data['name'] + ' ' + code + ' 竞价涨停 ' + BK_NAME_CATCH_DIC[code]\n else:\n #涨停\n msg = '[涨停][' + stock[stock_time] + '] ' + data['name'] + ' ' + code + ' 冲击涨停 ' + BK_NAME_CATCH_DIC[code]\n #if id in GP_LB_LIST.keys():\n # s = s + '(' + str(GP_LB_LIST[id] + 1) + '连板)'\n #else:\n # s = s + '(首板)'\n #TIP_CATCH_LIST.append(msg)\n sendmsg.add(msg)\n\n\n #跌停\n dtprice = float(tools.getdt(close,st))\n if curprice == dtprice:\n if code not in GP_DT_LIST:\n GP_DT_LIST.append(code)\n if open == curprice:\n #竞价跌停\n msg = '[竞价][' + stock[stock_time] + '] ' + data['name'] + ' ' + code + ' 竞价跌停 ' + BK_NAME_CATCH_DIC[code]\n else:\n #跌停\n msg = '[跌停][' + stock[stock_time] + '] ' + data['name'] + ' ' + code + ' 冲击跌停 ' + BK_NAME_CATCH_DIC[code]\n #TIP_CATCH_LIST.append(msg)\n sendmsg.add(msg)\n\n '''\n else:\n #涨停开板\n if id in GP_ZT_LIST:\n if FIRST_INIT != 1:\n if id in GP_ZT_CNT.keys():\n GP_ZT_CNT[id] = GP_ZT_CNT[id] + 1\n else:\n GP_ZT_CNT[id] = 1\n s = '[开板][' + _otime + '] ' + _oname + ' ' + id + ' 打开涨停板'\n qq.senMsgToBuddy(s)\n qq.sendMsgToGroup(s)\n GP_ZT_LIST.remove(id)\n GP_CZT_LIST.remove(id)\n return\n \n #跌停开板\n if id in GP_DT_LIST:\n if FIRST_INIT != 1:\n if id in GP_DT_CNT.keys():\n GP_DT_CNT[id] = GP_DT_CNT[id] + 1\n else:\n GP_DT_CNT[id] = 1\n s = '[翘板][' + _otime + '] ' + _oname + ' ' + id + ' 打开跌停板'\n qq.senMsgToBuddy(s)\n qq.sendMsgToGroup(s)\n GP_DT_LIST.remove(id)\n GP_CDT_LIST.remove(id)\n return\n #print(' GP_ZT_LIST cnt:' + str(len(GP_ZT_LIST)) + ' GP_DT_LIST cnt:' + str(len(GP_DT_LIST)))\n #print(GP_ZT_LIST)\n '''\n\n#新高\nGP_XG_DIC = {} # 股票新高记录\nHIGPUP_OLD_TIP = {} # 新高提示列表\ndef highup(code):\n global GP_XG_DIC,HIGPUP_OLD_TIP\n\n\n'''\n global GP_CATCH_DIC, GP_XG_DIC, GP_XG_TIP_DIC\n data = GP_CATCH_DIC[id]\n _o = data.get('list', [])\n _omax = float(_o[4]) # 今日最高价\n\n # 没有数据\n if id not in GP_XG_DIC.keys():\n return\n\n xgdata = GP_XG_DIC.get(id, {})\n maxkey = 0\n for key, value in xgdata.items():\n if _omax > value and value != 0:\n maxkey = getmax(maxkey, key)\n\n maxkey = int(maxkey)\n if maxkey == 0 or maxkey == 10 or maxkey == 20:\n return\n\n if id not in GP_XG_TIP_DIC:\n GP_XG_TIP_DIC[id] = {}\n\n maxkey = str(maxkey)\n if maxkey not in GP_XG_TIP_DIC[id]:\n GP_XG_TIP_DIC[id][maxkey] = 1\n if FIRST_INIT != 1:\n s = '[新高][' + _o[31] + '] ' + data['name'] + ' ' + id + ' ' + maxkey + '日新高'\n qq.senMsgToBuddy(s)\n qq.sendMsgToGroup(s)\n'''\n\n\n#平台突破\nGP_PT_DIC = {} #平台数据\nPLATFORMUP_OLD_TIP = [] #突破平台提示 向上\nPLATFORMDOWN_OLD_TIP = [] #突破平台提示 向下\ndef platformup(code):\n global GP_CATCH_DIC,GP_PT_DIC,PLATFORMUP_OLD_TIP,PLATFORMDOWN_OLD_TIP\n data = GP_CATCH_DIC[code]\n stock = data['list']\n\n '''\n _ocur = float(_o[3]) # 当前价格\n\n # 停牌\n if _ocur == 0:\n return\n\n # 没有数据\n if id not in GP_PT_DIC.keys():\n return\n\n ptdata = GP_PT_DIC.get(id,{})\n\n # 向上\n if id not in GP_PT_TIP_U_LIST:\n hightip = ptdata['high'] * 1.1\n if _ocur > hightip:\n GP_PT_TIP_U_LIST.append(id)\n if FIRST_INIT != 1:\n s = '[平台][' + _o[31] + '] ' + data['name'] + ' ' + id + ' 向上平台突破'\n qq.senMsgToBuddy(s)\n qq.sendMsgToGroup(s)\n\n # 向下\n if id not in GP_PT_TIP_D_LIST:\n downtip = ptdata['low'] * 0.9\n if _ocur < downtip:\n GP_PT_TIP_D_LIST.append(id)\n if FIRST_INIT != 1:\n s = '[平台][' + _o[31] + '] ' + data['name'] + ' ' + id + ' 向下平台突破'\n qq.senMsgToBuddy(s)\n qq.sendMsgToGroup(s)\n'''\n############################################################\n##通用全局\nGLOBAL_CONN = None #mysql链接\n############################################################\n\n###############################################################################################\n# sina沪深股票\n###############################################################################################\nGP_ALL_STR_URL_LIST = [] # sina全部股票拼接url\nGP_ALL_STR_CNT = 710 # sina拼接返回最大个数868\nGP_URL = 'http://hq.sinajs.cn/list=' # sina财经url\n\n#初始化\ndef sinainit():\n global GLOBAL_CONN\n if GLOBAL_CONN == None:\n print('[dog] sinainit db err')\n return\n\n global GP_ALL_STR_URL_LIST,GP_ALL_STR_CNT,GP_URL,BK_CATCH_DIC,BK_NAME_CATCH_DIC#,GP_XG_DIC,GP_PT_DIC,GP_LB_LIST#GP_CUR_DATE\n url = GP_URL\n cnt = 0\n cursor = GLOBAL_CONN.cursor()\n\n # 版块数据\n cursor.execute(\"SELECT * FROM bk\")\n res = cursor.fetchall()\n bknamelist = {}\n for row in res:\n id = row[0]\n name = row[1]\n bknamelist[id] = name\n\n # 股票列表数据\n cursor.execute(\"SELECT * FROM code\")\n res = cursor.fetchall()\n for row in res:\n code = row[0]\n #缓存数据build\n GP_CATCH_DIC[code] = {}\n GP_CATCH_DIC[code]['list'] = {}\n\n #版块数据\n bk = row[9]\n bk = bk.replace('[','')\n bk = bk.replace(']','')\n bkdata = bk.split(',')\n BK_CATCH_DIC[code] = bkdata\n bkname = ''\n for id in bkdata:\n bkname += '[' + bknamelist[int(id)] + ']'\n BK_NAME_CATCH_DIC[code] = bkname\n\n # sina url拼接\n if int(code) >= 600000:\n symbol = 'sh' + code\n else:\n symbol = 'sz' + code\n url += symbol + ','\n cnt = cnt + 1\n if cnt >= GP_ALL_STR_CNT:\n GP_ALL_STR_URL_LIST.append(url[:-1])\n url = GP_URL\n cnt = 0\n\n\n'''\n # local xg\n cursor.execute(\"SELECT * FROM xg\")\n res = cursor.fetchall()\n for row in res:\n rlist = {}\n rlist[10] = row[1] / 100\n rlist[20] = row[2] / 100\n rlist[30] = row[3] / 100\n rlist[40] = row[4] / 100\n rlist[50] = row[5] / 100\n rlist[60] = row[6] / 100\n GP_XG_DIC[row[0]] = rlist\n\n # local pt\n cursor.execute(\"SELECT * FROM pt\")\n res = cursor.fetchall()\n for row in res:\n rlist = {}\n rlist['high'] = row[1] / 100\n rlist['low'] = row[2] / 100\n GP_PT_DIC[row[0]] = rlist\n\n # local lb\n cursor.execute(\"SELECT * FROM lb\")\n res = cursor.fetchall()\n for row in res:\n GP_LB_LIST[row[0]] = row[1]\n # print(GP_LB_LIST)\n cursor.close()\n\n # load data for sina\n fr = open('gp.txt', 'r',encoding='UTF-8')\n for line in fr:\n tmp = line.split(',')\n dic = {}\n id = tmp[0]\n url = tmp[1] + id\n #dic['url'] = url\n #dic['name'] = tmp[2].replace('\\\\n','',1)\n dic['list'] = []\n GP_CATCH_DIC[id] = dic\n dic2 = {}\n dic2['list'] = []\n GP_JJ_CATCH_DIC[id] = dic2\n _URL += url + ','\n cnt = cnt + 1\n if cnt >= GP_ALL_STR_CNT:\n _URL = _URL[:-1]\n GP_ALL_STR_URL_LIST.append(_URL)\n _URL = GP_URL\n cnt = 0\n\n'''\n\n\n############################################################\n##主控函数\ndef init():\n global GLOBAL_CONN\n #读取mysql连接\n GLOBAL_CONN = pymysql.connect(host='192.168.1.103', user='root', password='Admin123!', db='gp', port=3306, charset='utf8')\n #GLOBAL_CONN = pymysql.connect(host='106.14.152.18', user='stockMarket', password='kdarrkmpjX5kCbTe', db='stockMarket', port=3306, charset='utf8')\n #GLOBAL_CONN = pymysql.connect(host='localhost', user='root', password='admin123!', db='gp', port=3306, charset='utf8')\n\ndef destroy():\n global GLOBAL_CONN\n if GLOBAL_CONN != None:\n GLOBAL_CONN.close()\n GLOBAL_CONN = None\n\ndef start():\n init()\n sinainit()\n destroy()\n\n\ndef update():\n dog()\n #print('[dog] update')\n\n\n\n#start()\n#update()" }, { "alpha_fraction": 0.5390003323554993, "alphanum_fraction": 0.5574657917022705, "avg_line_length": 24.754098892211914, "blob_id": "8cad1ed39dd9d3c7eb10255b58e33442c54c3cd9", "content_id": "dbc9487462cb7c2d28f28afc10e0bedad74a86e0", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3337, "license_type": "no_license", "max_line_length": 94, "num_lines": 122, "path": "/tool/tools.py", "repo_name": "jaketanwh/tools", "src_encoding": "UTF-8", "text": "#工具类\nimport re\nimport http.client\nimport time,datetime\nimport json\nimport net\nfrom decimal import *\n\n#表是否存在\ndef table_exists(cursor,table_name):\n sql = \"show tables;\"\n cursor.execute(sql)\n tables = [cursor.fetchall()]\n table_list = re.findall('(\\'.*?\\')',str(tables))\n table_list = [re.sub(\"'\",'',each) for each in table_list]\n if table_name in table_list:\n return True #存在\n else:\n return False #不存在\n\n\n#北京时间\ndef get_servertime():\n try:\n conn = http.client.HTTPConnection('www.baidu.com')\n conn.request(\"GET\", \"/\")\n r = conn.getresponse()\n ts = r.getheader('date') # 获取http头date部分\n # 将GMT时间转换成北京时间\n ltime = time.strptime(ts[5:25], \"%d %b %Y %H:%M:%S\")\n ttime = time.localtime(time.mktime(ltime) + 8 * 60 * 60)\n whatday = datetime.datetime(ttime.tm_year, ttime.tm_mon, ttime.tm_mday).strftime(\"%w\")\n except Exception as ee:\n print(\"get_servertime error\")\n return -1,-1\n return ttime,whatday\n\n#取最近一个开盘日\ndef getlastday():\n lastdate = datetime.date.today()\n oneday = datetime.timedelta(days = 1)\n while lastdate.weekday() > 4:\n lastdate -= oneday\n return lastdate\n \"\"\"\n lastdate = datetime.date.today()\n oneday = datetime.timedelta(days=1)\n while True:\n day = lastdate.strftime('%Y%m%d')\n url = \"http://www.easybots.cn/api/holiday.php?d=\" + day\n resp = net.send(url)\n if resp != -1:\n data = json.loads(resp)\n print(data)\n #工作日对应结果为 0, 休息日对应结果为 1, 节假日对应的结果为 2\n if data[str(day)] == \"0\":\n break\n lastdate -= oneday\n return lastdate\n \n def getlastday():\n lastdate = datetime.date.today()\n oneday = datetime.timedelta(days = 1)\n str = lastdate.strftime('%Y%m%d')\n ret = -1\n while ret != 0:\n ret,data = net.tushare_trade(str,str)\n if ret != -1:\n if data['is_open'][0] == 1:\n break\n if ret == 0:\n lastdate -= oneday\n str = lastdate.strftime('%Y%m%d')\n ret = -1\n\n return lastdate\n \"\"\"\n\n#今日是否交易日 0休市 1交易\ndef gettodaytrade():\n today = datetime.date.today()\n str = today.strftime('%Y%m%d')\n ret = -1\n #while ret != 0:\n ret,data = net.tushare_trade(str,str)\n return 1#data['is_open'][0]\n\n#取前n个时间差日期\ndef getnday(n):\n lastdate = getlastday()\n oneday = datetime.timedelta(days=1)\n while n > 0:\n n -= 1\n lastdate -= oneday\n return lastdate\n\n#取涨停价\ndef getzt(close,st):\n if st:\n _corl = 1.05\n else:\n _corl = 1.1\n ztj = Decimal(close * _corl).quantize(Decimal('0.00'))\n ztj = '{:g}'.format(float(ztj))\n return float(ztj)\n\n#取跌停价\ndef getdt(close,st):\n if st:\n _corl = 1.05\n else:\n _corl = 1.1\n dtj = Decimal(close / _corl).quantize(Decimal('0.00'))\n dtj = '{:g}'.format(float(dtj))\n return float(dtj)\n\n#取指定涨幅价\ndef getpercent(close,percent):\n _corl = percent / 100 + 1\n pj = Decimal(close * _corl).quantize(Decimal('0.00'))\n pj = '{:g}'.format(float(pj))\n return float(pj)" }, { "alpha_fraction": 0.5125913619995117, "alphanum_fraction": 0.5353371500968933, "avg_line_length": 31.421052932739258, "blob_id": "4d629f2e944038490367f3ef4a2c489b23a6a182", "content_id": "403f0945d60a598f0dddd8d9b623d3a0a2ccca31", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1317, "license_type": "no_license", "max_line_length": 173, "num_lines": 38, "path": "/dog/ths.py", "repo_name": "jaketanwh/tools", "src_encoding": "UTF-8", "text": "import sys\nsys.path.append('../data')\nsys.path.append('../msg')\nimport net,json,time,re\nfrom decimal import *\nimport sendmsg\n\n\n###############################################################################################\n# 同花顺问财\n ###############################################################################################\n#THS_URL = \"http://www.iwencai.com/asyn/search?q=%s&queryType=stock&app=qnas&qid=\"\nTHS_URL = 'http://www.iwencai.com/stockpick/load-data?typed=0&preParams=&ts=1&f=1&qs=result_original&selfsectsn=&querytype=stock&searchfilter=&tid=stockpick&w=%s&queryarea='\ndef thsdata(condition):\n global THS_URL\n url = THS_URL % (condition)\n print(url)\n res = net.send(url, 1, 1)\n print(res)\n if res != -1:\n jdata = json.loads(res)\n print(jdata)\n if jdata and jdata['data'] and jdata['data']['result'] and jdata['data']['result']['result']:\n return jdata['data']['result']['result']\n return -1\n\nTHS_TIP_DIC = [] # 提示列表\ndef ths():\n res = thsdata(repr('2019年6月10日的涨停'))\n if res != -1:\n print(res)\n#ths()\n\nimport wencai as wc\nreport = wc.get_scrape_report(\"上市天数大于60天;筹码集中度90小于20%;非停牌;非st;\")\nprint(report)\n\n#print(repr('2019年6月10日的涨停'))" }, { "alpha_fraction": 0.47164079546928406, "alphanum_fraction": 0.4895341098308563, "avg_line_length": 23.890756607055664, "blob_id": "bb2aa50580cf45197b9faa0de084d1f910648cf1", "content_id": "3c34552b22bf6bbb255461bdddc2d29263aad50a", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3096, "license_type": "no_license", "max_line_length": 157, "num_lines": 119, "path": "/main.py", "repo_name": "jaketanwh/tools", "src_encoding": "UTF-8", "text": "import sys\nsys.path.append('data')\nsys.path.append('tool')\nsys.path.append('surprise')\nsys.path.append('dog')\nsys.path.append('msg')\nimport data,surprise,dog,cls,kpl,sendmsg\nimport tools\nimport time\n\nMAIN_RESET_CONTROL = False #今日是否更新开关\nMAIN_ISOPEN_DAY = tools.gettodaytrade() #今日是否开盘\nMAIN_WEEKDAY = -1 #今日是周几\nMAIN_DATA_UPDATA = True #每日更新db\nMAIN_REPLAY_SURPRISE = True #每日复盘\n\n###############################################################################################\n# update\n###############################################################################################\n\n#更新db数据\ndef downdb():\n global MAIN_DATA_UPDATA\n if not MAIN_DATA_UPDATA:\n return\n MAIN_DATA_UPDATA = False\n data.start()\n\n#web\ndef surprise():\n global MAIN_REPLAY_SURPRISE\n if not MAIN_REPLAY_SURPRISE:\n return\n MAIN_REPLAY_SURPRISE = False\n surprise.start()\n\ndef update():\n # 交易日判定\n if MAIN_ISOPEN_DAY == 0:\n return\n\n # 北京时间\n bjtime, weekday = tools.get_servertime()\n if bjtime == -1 or weekday == -1:\n return\n\n hour = bjtime.tm_hour\n minute = bjtime.tm_min\n second = bjtime.tm_sec\n\n if hour == 9 and minute > 14 and minute < 26:\n #竞价\n print('1')\n elif hour == 9 and minute == 25 and second > 10 and second < 20:\n #计算竞价[tushare] tushare_trade faild\n print('1')\n elif (hour == 9 and minute > 29) or (hour > 9 and hour < 11) or (hour == 11 and minute < 32) or (hour > 12 and hour < 15) or (hour == 15 and minute < 2):\n #盘中\n dog.update()\n elif hour == 0 and minute > 10 and minute < 20:\n #每日重置\n do_reset()\n elif hour == 18 and minute < 10:\n #每日更新数据\n downdb()\n #elif hour == 19 and minute < 30:\n #每日复盘\n #surprise()\n\n #新闻\n cls.update()\n\n #开盘啦\n kpl.update()\n\n #msg\n sendmsg.update()\n time.sleep(3)\n\ndef do_while():\n while True:\n update()\n\ndef do_reset():\n global MAIN_WEEKDAY\n week = -1\n while week == -1:\n _, week = tools.get_servertime()\n if week == MAIN_WEEKDAY:\n return\n MAIN_WEEKDAY = week\n\n global MAIN_DATA_UPDATA,MAIN_REPLAY_SURPRISE,MAIN_ISOPEN_DAY\n MAIN_DATA_UPDATA = True\n MAIN_REPLAY_SURPRISE = True\n MAIN_ISOPEN_DAY = tools.gettodaytrade()\n\n###############################################################################################\n# main\n###############################################################################################\n\ndef main_init():\n print('[Main] init')\n global MAIN_WEEKDAY\n week = -1\n #while week == -1:\n _, week = tools.get_servertime()\n MAIN_WEEKDAY = week\n\ndef main_destroy():\n print('[Main] destroy')\n\nif __name__ == \"__main__\":\n main_init()\n #dog.start()\n #sendmsg.start()[Code] kpl gg updat\n #do_while()\n downdb()\n main_destroy()\n" }, { "alpha_fraction": 0.5500982403755188, "alphanum_fraction": 0.5795677900314331, "avg_line_length": 18.615385055541992, "blob_id": "aa2f465ab5352ca4a80cdfcaf3fa1a702c544f73", "content_id": "1c8c4b3b5e5665d0c51a09663b0e572d3b368c34", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 537, "license_type": "no_license", "max_line_length": 137, "num_lines": 26, "path": "/surprise/surprise.py", "repo_name": "jaketanwh/tools", "src_encoding": "UTF-8", "text": "import pymysql\nimport clcore\n\n#格式化缠论K线\ndef formatCLK():\n global GLOBAL_CONN\n clcore.initkx(GLOBAL_CONN)\n\n\n\n############################################################\n##主控函数\ndef init():\n global GLOBAL_CONN\n #读取mysql连接\n GLOBAL_CONN = pymysql.connect(host='192.168.1.103', user='root', password='Admin123!', db='lanjingling', port=3306, charset='utf8')\n\ndef destroy():\n global GLOBAL_CONN\n GLOBAL_CONN.close()\n GLOBAL_CONN = None\n\ndef start():\n init()\n formatCLK()\n destroy()" }, { "alpha_fraction": 0.5700258612632751, "alphanum_fraction": 0.585185170173645, "avg_line_length": 31.971590042114258, "blob_id": "8c8c0239dab866adbc0c9b53e073f7043b68a74f", "content_id": "944bebb6debae86eafd61ce87a36895380960fe1", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 5965, "license_type": "no_license", "max_line_length": 127, "num_lines": 176, "path": "/model/okexapi.py", "repo_name": "jaketanwh/tools", "src_encoding": "UTF-8", "text": "import time,requests,logging,urllib,hashlib,datetime\nimport itchat\nPROTOCOL = \"https\"\nHOST = \"www.okex.com/api/futures\"\nVERSION = \"v3/instruments\"\nTIMEOUT = 10\n\nclass OkexBaseClient (object):\n def __init__(self, key, secret, proxies=None):\n self.URL = \"{0:s}://{1:s}/{2:s}\".format(PROTOCOL, HOST, VERSION)\n self.KEY = key\n self.SECRET = secret\n self.PROXIES = proxies\n\n @property\n def _nonce(self):\n \"\"\"\n Returns a nonce\n Used in authentication\n \"\"\"\n return str(int(time.time() * 1000))\n\n def _build_parameters(self, parameters):\n # sort the keys so we can test easily in Python 3.3 (dicts are not # ordered)\n keys = list(parameters.keys())\n keys.sort()\n return '&'.join([\"%s=%s\" % (k, parameters[k]) for k in keys])\n\n def url_for(self, path, path_arg=None, parameters=None):\n url = \"%s/%s\" % (self.URL, path)\n # If there is a path_arh, interpolate it into the URL.\n # In this case the path that was provided will need to have string\n # interpolation characters in it\n if path_arg:\n url = url % (path_arg)\n # Append any parameters to the URL.\n if parameters:\n url = \"%s?%s\" % (url, self._build_parameters(parameters))\n return url\n\n def _sign_payload(self, payload):\n sign = ''\n for key in sorted(payload.keys()):\n sign += key + '=' + str(payload[key]) +'&'\n data = sign+'secret_key='+self.SECRET\n return hashlib.md5(data.encode(\"utf8\")).hexdigest().upper()\n\n def _convert_to_floats(self, data):\n \"\"\"\n Convert all values in a dict to floats at first level\n \"\"\"\n for key, value in data.items():\n data[key] = float(value)\n return data\n\n def _get(self, url, timeout=TIMEOUT):\n print(url)\n req = requests.get(url, timeout=timeout, proxies=self.PROXIES)\n if req.status_code/100 != 2:\n logging.error(u\"Failed to request:%s %d headers:%s\", url, req.status_code, req.headers)\n try:\n return req.json()\n except Exception as e:\n logging.exception('Failed to GET:%s result:%s', url, req.text)\n raise e\n\n\n def _post(self, url, params=None, needsign=True, headers=None, timeout=TIMEOUT):\n req_params = {'api_key' : self.KEY}\n if params and needsign:\n req_params.update(params)\n req_params['sign'] = self._sign_payload(req_params)\n\n req_headers = { \"Content-type\" : \"application/x-www-form-urlencoded\"}\n if headers:\n req_headers.update(headers)\n logging.info(\"%s %s\", req_headers, req_params)\n\n req = requests.post(url, headers=req_headers, data=urllib.urlencode(req_params), timeout=TIMEOUT, proxies=self.PROXIES)\n if req.status_code/100 != 2:\n logging.error(u\"Failed to request:%s %d headers:%s\", url, req.status_code, req.headers)\n try:\n return req.json()\n except Exception as e:\n logging.exception('Failed to POST:%s result:%s', url, req.text)\n raise e\n\n\nclass OkexClient(OkexBaseClient):\n \"\"\"\n Client for the Okex.com API.\n See https://www.okex.com/rest_api.html for API documentation.\n \"\"\"\n def ticker(self, path, start, end, granularity):\n return self._get(self.url_for(path, parameters={'start' : start, 'end' : end, 'granularity' : granularity}))\n\n\n\ndef isoformat(time):\n '''\n 将datetime或者timedelta对象转换成ISO 8601时间标准格式字符串\n :param time: 给定datetime或者timedelta\n :return: 根据ISO 8601时间标准格式进行输出\n '''\n if isinstance(time, datetime.datetime): # 如果输入是datetime\n return time.isoformat();\n elif isinstance(time, datetime.timedelta): # 如果输入时timedelta,计算其代表的时分秒\n hours = time.seconds // 3600\n minutes = time.seconds % 3600 // 60\n seconds = time.seconds % 3600 % 60\n return 'P%sDT%sH%sM%sS' % (time.days, hours, minutes, seconds) # 将字符串进行连接\n\n\n# wroom\n'''\ndef sendMsgToWRoom(msg):\n print(msg)\n wroom = 'OKEX'\n iRoom = itchat.search_chatrooms(wroom)\n for room in iRoom:\n if room['NickName'] == wroom:\n userName = room['UserName']\n itchat.send_msg(msg, userName)\n break\n'''\n# wchat\ndef sendMsgToWChat(msg):\n print(msg)\n wchatList = ['东方云溪']\n for wchat in wchatList:\n users = itchat.search_friends(name=wchat)\n userName = users[0]['UserName']\n itchat.send(msg, toUserName=userName)\n\n\nPERCENT_TIP = []\n#percent\ndef do_percent(res,name):\n global PERCENT_TIP\n cnt, hights, lows, firstkey = 1, [], [], None\n for val in res:\n if firstkey == None:\n firstkey = val[0]\n hights.append(float(val[2]))\n lows.append(float(val[3]))\n cnt = cnt + 1\n if cnt > 5:\n break\n\n hmax = float(max(hights))\n lmin = float(min(lows))\n percent = float((hmax - lmin) / lmin * 100)\n if percent >= 2:\n if firstkey in PERCENT_TIP:\n return\n PERCENT_TIP.append(firstkey)\n if len(PERCENT_TIP) > 2:\n del PERCENT_TIP[-1]\n sendMsgToWChat('提醒: [' + name +'] 五分钟之内涨跌幅超过2%!')\n\n\nif __name__ == \"__main__\":\n PATH = [\"EOS-USD-190927/candles\", \"BTC-USD-190927/candles\"]\n itchat.auto_login(hotReload=True)\n client = OkexClient(None, None)\n subdelta = datetime.timedelta(hours=8)\n while True:\n dtnow = datetime.datetime.now() - subdelta # utc时间,减8H\n delta = datetime.timedelta(minutes=5)\n start = isoformat(dtnow - delta)\n end = isoformat(dtnow)\n for path in PATH:\n res = client.ticker(path, start[:-6] + '00Z', end[:-6] + '00Z', 60)\n if len(res) > 0:\n do_percent(res, path[:14])\n time.sleep(60)\n\n\n" }, { "alpha_fraction": 0.4035269618034363, "alphanum_fraction": 0.4927385747432709, "avg_line_length": 20.93181800842285, "blob_id": "bfe2b9aac574f4a9de8b8b10e07e2a27a494ebe7", "content_id": "32ab27caf3c4f28cefcd2a0c49633d7be9c94175", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 964, "license_type": "no_license", "max_line_length": 101, "num_lines": 44, "path": "/data/example.py", "repo_name": "jaketanwh/tools", "src_encoding": "UTF-8", "text": "import util\nimport pymysql\n\nif __name__ == \"__main__\":\n conn = pymysql.connect(host='localhost', user='root', password='admin123!', db='gp', port=3306,\n charset='utf8')\n\n #macd\n #res = util.macd(conn,'000001','2018-09-21')\n #if res != None:\n # print(res)\n\n #boll\n #res = util.boll(conn,'000001','2018-09-21')\n #if res != None:\n # print(res)\n\n #vol\n #res = util.vol(conn, '000001', 5,'2018-09-21')\n #if res != None:\n # print(res)\n\n #turn\n #res = util.turn(conn, '000001')\n #if res != None:\n # print(res)\n\n #bkvol\n #res = util.bkvol(conn,'1',5,'2018-09-21')\n #if res != None:\n # print(res)\n\n #bkzd\n #res1,res2,res3 = util.bkzd(conn, '1','2018-09-21')\n #if res1 != None:\n # print(str(res1) + '-' + str(res2) + '-' + str(res3))\n\n #lb\n res = util.lb(conn,'000001')\n if res != None:\n print('lb:' + str(res))\n\n\n conn.close()" }, { "alpha_fraction": 0.5891472697257996, "alphanum_fraction": 0.5968992114067078, "avg_line_length": 24.799999237060547, "blob_id": "3f1d9fb24d1983c4a4e0257271bd74dce821f7db", "content_id": "a18778896ae19ec053a01dce4a76fce3651b11bb", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 866, "license_type": "no_license", "max_line_length": 102, "num_lines": 30, "path": "/data/t_bk.py", "repo_name": "jaketanwh/tools", "src_encoding": "UTF-8", "text": "# bk表数据\nimport sys\nsys.path.append('../tool')\nimport tools\nimport kpltools\n\n#开盘啦板块详情\ndef kpl_bk(code):\n param = kpltools.build_kpl_bk(code)\n \n\ndef update(conn,t_bk):\n print('[BK] 表开始更新')\n # 写入游标\n cursor = conn.cursor()\n\n # 创建bk表 板块id(id) 名字(name) 涨跌(percent)\n if tools.table_exists(cursor, 'bk') == 1:\n cursor.execute(\"DROP TABLE bk\")\n cursor.execute(\"CREATE TABLE IF NOT EXISTS bk(id MEDIUMINT UNSIGNED,name TEXT,percent SMALLINT)\")\n\n\n for name,row in t_bk.items():\n id = int(row[0]) #板块id\n percent = round(row[1] * 100) #涨跌幅 保留两位四舍五入\n cursor.execute(\"INSERT INTO bk(id,name,percent) VALUES('%d','%s','%d')\" % (id, name, percent))\n\n conn.commit()\n cursor.close()\n print('[BK] 表更新完成')\n" }, { "alpha_fraction": 0.5392370820045471, "alphanum_fraction": 0.549682080745697, "avg_line_length": 30.632183074951172, "blob_id": "665cc722446c93cce99dc75113a2c3bfc1a29a53", "content_id": "9e6b689d0ab4f7822e2dcc043d23c41f5e047681", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 11840, "license_type": "no_license", "max_line_length": 127, "num_lines": 348, "path": "/surprise/okexapi.py", "repo_name": "jaketanwh/tools", "src_encoding": "UTF-8", "text": "import time,requests,logging,urllib,hashlib,datetime\nimport itchat,smtplib,os\nfrom email.mime.text import MIMEText\nfrom email.mime.multipart import MIMEMultipart\n#from config import EmailConfig\n\n#--------------------自定义参数--------------------\n#监测品种 多个品种配置 [\"ETH-USDT-200327\",\"BTC-USDT-200327\"]\nG_PATH = [\"ETH-USDT-200327\"]\n\n#总时长(分钟)\nG_TLEN = 30\n\n#幅度(2%)\nG_PERCENT = 2\n\n#微信推送列表\n#G_WCHATLIST = ['兰明海']\n\n#邮件服务器地址\nG_MAIL_HOST = 'smtp.qq.com'\n\n#smtp端口号\nG_MAIL_PORT = 465\n\n#邮箱账号密码\nG_MAIL_USER = '1073341020'\nG_MAIL_PASSWORD = 'hphryrghxuyibcie'\n\n#发送者邮箱账号\nG_MAIL_SENDER = '1073341020@qq.com'\n\n#接受者邮箱账号列表 ['987654321@qq.com','123456789@qq.com']\nG_MAIL_RECEIVE_LIST = ['1073341020@qq.com']\n\n#-------------------------------------------------\n\n\n#--------------------okey-------------------------\nPROTOCOL = \"https\"\nHOST = \"www.okex.com/api/futures\"\nVERSION = \"v3/instruments\"\nTIMEOUT = 10\nclass OkexBaseClient (object):\n def __init__(self, key, secret, proxies=None):\n self.URL = \"{0:s}://{1:s}/{2:s}\".format(PROTOCOL, HOST, VERSION)\n self.KEY = key\n self.SECRET = secret\n self.PROXIES = proxies\n\n @property\n def _nonce(self):\n \"\"\"\n Returns a nonce\n Used in authentication\n \"\"\"\n return str(int(time.time() * 1000))\n\n def _build_parameters(self, parameters):\n # sort the keys so we can test easily in Python 3.3 (dicts are not # ordered)\n keys = list(parameters.keys())\n keys.sort()\n return '&'.join([\"%s=%s\" % (k, parameters[k]) for k in keys])\n\n def url_for(self, path, path_arg=None, parameters=None):\n url = \"%s/%s\" % (self.URL, path)\n # If there is a path_arh, interpolate it into the URL.\n # In this case the path that was provided will need to have string\n # interpolation characters in it\n if path_arg:\n url = url % (path_arg)\n # Append any parameters to the URL.\n if parameters:\n url = \"%s?%s\" % (url, self._build_parameters(parameters))\n return url\n\n def _sign_payload(self, payload):\n sign = ''\n for key in sorted(payload.keys()):\n sign += key + '=' + str(payload[key]) +'&'\n data = sign+'secret_key='+self.SECRET\n return hashlib.md5(data.encode(\"utf8\")).hexdigest().upper()\n\n def _convert_to_floats(self, data):\n \"\"\"\n Convert all values in a dict to floats at first level\n \"\"\"\n for key, value in data.items():\n data[key] = float(value)\n return data\n\n def _get(self, url, timeout=TIMEOUT):\n try:\n req = requests.get(url, timeout=timeout, proxies=self.PROXIES)\n except Exception as e:\n print('Timeout to GET:' + url)\n return []\n\n if req.status_code/100 != 2:\n print(\"Failed to request:\" + url + \" \" + req.status_code, + \" headers:\" + req.headers)\n return []\n try:\n return req.json()\n except Exception as e:\n print('Failed to GET:' + url + \" cose:\" + str(req.status_code))\n return []\n\n def _post(self, url, params=None, needsign=True, headers=None, timeout=TIMEOUT):\n req_params = {'api_key' : self.KEY}\n if params and needsign:\n req_params.update(params)\n req_params['sign'] = self._sign_payload(req_params)\n\n req_headers = { \"Content-type\" : \"application/x-www-form-urlencoded\"}\n if headers:\n req_headers.update(headers)\n logging.info(\"%s %s\", req_headers, req_params)\n\n req = requests.post(url, headers=req_headers, data=urllib.urlencode(req_params), timeout=TIMEOUT, proxies=self.PROXIES)\n if req.status_code/100 != 2:\n logging.error(u\"Failed to request:%s %d headers:%s\", url, req.status_code, req.headers)\n try:\n return req.json()\n except Exception as e:\n logging.exception('Failed to POST:%s result:%s', url, req.text)\n raise e\n\nclass OkexClient(OkexBaseClient):\n \"\"\"\n Client for the Okex.com API.\n See https://www.okex.com/rest_api.html for API documentation.\n \"\"\"\n def ticker(self, path, start, end, granularity):\n return self._get(self.url_for(path, parameters={'start' : start, 'end' : end, 'granularity' : granularity}))\n\ndef isoformat(time):\n '''\n 将datetime或者timedelta对象转换成ISO 8601时间标准格式字符串\n :param time: 给定datetime或者timedelta\n :return: 根据ISO 8601时间标准格式进行输出\n '''\n if isinstance(time, datetime.datetime): # 如果输入是datetime\n return time.isoformat();\n elif isinstance(time, datetime.timedelta): # 如果输入时timedelta,计算其代表的时分秒\n hours = time.seconds // 3600\n minutes = time.seconds % 3600 // 60\n seconds = time.seconds % 3600 % 60\n return 'P%sDT%sH%sM%sS' % (time.days, hours, minutes, seconds) # 将字符串进行连接\n\n#-------------------------------------------------\n\n#--------------------wchat------------------------\n\n# wroom\n'''\ndef sendMsgToWRoom(msg):\n print(msg)\n wroom = 'OKEX'\n iRoom = itchat.search_chatrooms(wroom)\n for room in iRoom:\n if room['NickName'] == wroom:\n userName = room['UserName']\n itchat.send_msg(msg, userName)\n break\n'''\n# wchat\ndef sendMsgToWChat(msg):\n print(msg)\n global G_WCHATLIST\n for wchat in G_WCHATLIST:\n users = itchat.search_friends(name=wchat)\n if users[0] != None:\n userName = users[0]['UserName']\n itchat.send(msg, toUserName=userName)\n else:\n print('微信好友' + wchat + '未找到')\n#-------------------------------------------------\n\n\n#--------------------mail-------------------------\nclass SendEmail(object):\n \"\"\"\n smtp邮件功能封装\n \"\"\"\n def __init__(self, host: str='', user: str='', password: str='', port: int='', sender: str='', receive: list=''):\n \"\"\"\n :param host: 邮箱服务器地址\n :param user: 登陆用户名\n :param password: 登陆密码\n :param port: 邮箱服务端口\n :param sender: 邮件发送者\n :param receive: 邮件接收者\n \"\"\"\n self.HOST = host\n self.USER = user\n self.PASSWORD = password\n self.PORT = port\n self.SENDER = sender\n self.RECEIVE = receive\n\n # 与邮箱服务器的连接\n self._server = ''\n # 邮件对象,用于构造邮件内容\n self._email_obj = ''\n\n def load_server_setting_from_obj(self, obj):\n \"\"\"从对象中加载邮件服务器的配置\n :param obj, 类对象\n HOST, 邮件服务器地址\n USER, 邮件服务器登陆账号\n PASSWORD, 邮件服务器登陆密码\n SENDER, 发送者\n \"\"\"\n attrs = {key.upper(): values for key, values in obj.__dict__.items() if not key.startswith('__')}\n for key, value in attrs.items():\n self.__setattr__(key, value)\n\n def connect_smtp_server(self, method='default'):\n \"\"\"连接到smtp服务器\"\"\"\n if method == 'default':\n self._server = smtplib.SMTP(self.HOST, self.PORT, timeout=2)\n if method == 'ssl':\n self._server = smtplib.SMTP_SSL(self.HOST, self.PORT, timeout=2)\n try:\n self._server.login(self.USER, self.PASSWORD)\n except Exception as e:\n print('Timeout login mail')\n return False\n return True\n\n def construct_email_obj(self, subject='python email'):\n \"\"\"构造邮件对象\n subject: 邮件主题\n from: 邮件发送方\n to: 邮件接收方\n \"\"\"\n\n # mixed参数表示混合类型,这个邮件对象可以添加html,txt,附件等内容\n msg = MIMEMultipart('mixed')\n msg['Subject'] = subject\n msg['From'] = self.SENDER\n msg['To'] = ';'.join(self.RECEIVE)\n self._email_obj = msg\n\n def add_content(self, content: str, _type: str = 'txt'):\n \"\"\"给邮件对象添加正文内容\"\"\"\n if _type == 'txt':\n text = MIMEText(content, 'plain', 'utf-8')\n if _type == 'html':\n text = MIMEText(content, 'html', 'utf-8')\n\n self._email_obj.attach(text)\n\n def add_file(self, file_path: str):\n \"\"\"\n 给邮件对象添加附件\n :param file_path: 文件路径\n :return: None\n \"\"\"\n # 构造附件1,传送当前目录下的 test.txt 文件\n email_file = MIMEText(open(file_path, 'rb').read(), 'base64', 'utf-8')\n email_file[\"Content-Type\"] = 'application/octet-stream'\n # 这里的filename可以任意写,写什么名字,邮件中显示什么名字\n file_name = os.path.basename(file_path)\n # 下面这种写法,如果附件名是中文,会出现乱码问题,修改成如下写法\n # email_file[\"Content-Disposition\"] = f'attachment; filename=\"{file_name}\"'\n email_file.add_header(\"Content-Disposition\", \"attachment\", filename=file_name)\n self._email_obj.attach(email_file)\n\n def send_email(self):\n \"\"\"发送邮件\"\"\"\n # 使用send_message方法而不是sendmail,避免编码问题\n try:\n self._server.send_message(from_addr=self.SENDER, to_addrs=self.RECEIVE, msg=self._email_obj)\n except Exception as e:\n print('Timeout send mail')\n return False\n return True\n\n def quit(self):\n self._server.quit()\n\n def close(self):\n self._server.close()\n\n# mail\ndef sendMsgToMail(msg):\n print(msg)\n global G_MAIL_HOST,G_MAIL_PORT,G_MAIL_USER,G_MAIL_PASSWORD,G_MAIL_SENDER,G_MAIL_RECEIVE_LIST\n try:\n email = SendEmail(G_MAIL_HOST, G_MAIL_USER, G_MAIL_PASSWORD, G_MAIL_PORT, G_MAIL_SENDER, G_MAIL_RECEIVE_LIST)\n ret = email.connect_smtp_server(method='ssl')\n if not ret:\n email.close()\n return\n email.construct_email_obj(subject='okey提醒' + str(time.strftime('%Y/%m/%d %H:%M')))\n email.add_content(content=msg)\n email.send_email()\n email.close()\n except Exception as e:\n print('Fail to sendMsgToMail')\n return\n\n#-------------------------------------------------\n\n#-------------------------------------------------\n#percent\nPERCENT_TIP = {}\ndef do_percent(res,name):\n global PERCENT_TIP,G_PERCENT,G_TLEN\n cnt, hights, lows = 1, [], []\n for val in res:\n high = float(val[2])\n low = float(val[3])\n hights.append(high)\n lows.append(low)\n cnt = cnt + 1\n if cnt > 5:\n break\n\n hmax = float(max(hights))\n lmin = float(min(lows))\n percent = float((hmax - lmin) / lmin * 100)\n print('监测幅度:' + str(percent) + ' 最高价:' + str(hmax) + ' 最低价:' + str(lmin))\n if percent >= G_PERCENT:\n now = time.time()\n if PERCENT_TIP[path] > now:\n return\n PERCENT_TIP[path] = now + G_TLEN * 60\n msg = 'Okex推送: [' + name +']' + str(G_TLEN) + '分钟之内涨跌幅超过' + str(round(percent, 2)) + '%!'\n #sendMsgToWChat(msg)\n sendMsgToMail(msg)\n\nif __name__ == \"__main__\":\n #itchat.auto_login()#hotReload=True\n client = OkexClient(None, None)\n subtm = datetime.timedelta(hours=8)\n for path in G_PATH:\n PERCENT_TIP[path] = 0\n while True:\n dtnow = datetime.datetime.now() - subtm\n stm = isoformat(dtnow - datetime.timedelta(minutes = G_TLEN))\n etm = isoformat(dtnow)\n for path in G_PATH:\n res = client.ticker(path + \"/candles\", stm[:-6] + '00Z', etm[:-6] + '00Z', 60)\n if len(res) > 0:\n do_percent(res, path)\n time.sleep(60)\n\n\n" }, { "alpha_fraction": 0.46345919370651245, "alphanum_fraction": 0.4886317551136017, "avg_line_length": 41.261802673339844, "blob_id": "d2d6245bac30afd624aa19b3dde9223606261504", "content_id": "a2ec01fdca2cb983a34f36f1a69e1e0faea00ee1", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 10424, "license_type": "no_license", "max_line_length": 412, "num_lines": 233, "path": "/data/t_gg.py", "repo_name": "jaketanwh/tools", "src_encoding": "UTF-8", "text": "#个股表数据\nimport sys\nsys.path.append('../tool')\nimport net\nimport tools\nimport pandas as pd\nimport talib\nimport time\n\n#macd\ndef getmacd(df,short=0,long=0,mid=0):\n if short == 0:\n short = 12\n if long == 0:\n long = 26\n if mid == 0:\n mid = 9\n\n\n #df = df.drop('code', axis=1)\n # 计算短期的ema,使用pandas的ewm得到指数加权的方法,mean方法指定数据用于平均\n df['sema'] = pd.Series(df['close']).ewm(span=short).mean()\n # 计算长期的ema,方式同上\n df['lema'] = pd.Series(df['close']).ewm(span=long).mean()\n # 填充为na的数据\n df.fillna(0, inplace=True)\n # 计算dif,加入新列data_dif\n df['data_dif'] = df['sema'] - df['lema']\n # 计算dea\n df['data_dea'] = pd.Series(df['data_dif']).ewm(span=mid).mean()\n # 计算macd\n df['data_macd'] = 2 * (df['data_dif'] - df['data_dea'])\n # 填充为na的数据\n df.fillna(0, inplace=True)\n # 返回data的三个新列\n return df[['date', 'data_dif', 'data_dea', 'data_macd']]\n\n#boll\ndef getboll(df):\n #提取收盘价\n closed = df['close'].values\n upper, middle, lower = talib.BBANDS(closed,matype=talib.MA_Type.T3)\n return upper,middle,lower\n\n#sina day\ndef sina_updategg(conn):\n #params\n SINA_DAY = \"60\"\n SINA_MA = '5,10,20'\n SINA_SCALE = '240'\n\n cursor = conn.cursor()\n cursor.execute(\"SELECT * FROM code\")\n res = cursor.fetchall()\n index = 1\n rlen = len(res)\n for row in res:\n # 代码(id) 是否st(st 1.是 0.不是) 涨跌(percent) 市净率(pb) 市盈率(per) 换手(turnover) 总市值(mktcap) 流通市值(nmc) 真实市值(sjlt) 板块[名字1,名字2...](bk)\n code = row[0]\n print('[GG] loading:(' + str(index) + '/' + str(rlen) + ') - ' + code)\n index = index + 1\n\n #1.sina\n data = -1\n while data == -1:\n data = net.sina_history(code, SINA_SCALE, SINA_MA, SINA_DAY)\n\n #2.tushare\n df = net.tushare_history(code)\n #macd\n macd = getmacd(df)\n macddata = macd.set_index('date')\n #boll\n upper, middle, lower = getboll(df)\n\n if tools.table_exists(cursor, code) == 0:\n csql = \"CREATE TABLE IF NOT EXISTS `\" + code + \"`(day date,open mediumint unsigned,high mediumint unsigned,low mediumint unsigned,close mediumint unsigned,volume bigint unsigned,ma_price5 mediumint unsigned,ma_volume5 bigint unsigned,ma_price10 mediumint unsigned,ma_volume10 bigint unsigned,ma_price20 mediumint unsigned,ma_volume20 bigint unsigned,turn mediumint unsigned,macd mediumint,boll text)\"\n cursor.execute(csql)\n\n idx = len(upper) - 1\n for o in data:\n date = o['day']\n ssql = \"SELECT * FROM `\" + code + \"` WHERE day = '\" + date + \"'\"\n has = cursor.execute(ssql)\n\n map5 = round(o.get('ma_price5', 0) * 100)\n mav5 = int(o.get('ma_volume5', 0))\n map10 = round(o.get('ma_price10', 0) * 100)\n mav10 = int(o.get('ma_volume10', 0))\n map20 = round(o.get('ma_price20', 0) * 100)\n mav20 = int(o.get('ma_volume20', 0))\n macdval = round(macddata.ix[str(date), 'data_macd']*100)\n boll = str([round(upper[idx],2),round(middle[idx],2),round(lower[idx],2)])\n\n if has == 0:\n s = \"INSERT INTO `\" + code + \"`(day,open,high,low,close,volume,ma_price5,ma_volume5,ma_price10,ma_volume10,ma_price20,ma_volume20,macd,boll) VALUES('%s','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%s')\"\n sql = s % (\n o['day'], int(float(o['open']) * 100), int(float(o['high']) * 100), int(float(o['low']) * 100),\n int(float(o['close']) * 100), int(o['volume']), map5,mav5,map10,mav10,map20,mav20,macdval,boll)\n else:\n s = \"UPDATE `\" + code + \"` SET open=%d,high=%d,low=%d,close=%d,volume=%d,ma_price5=%d,ma_volume5=%d,ma_price10=%d,ma_volume10=%d,ma_price20=%d,ma_volume20=%d,macd=%d,boll=%s WHERE day = '\" + o['day'] + \"'\"\n sql = s % (int(float(o['open']) * 100), int(float(o['high']) * 100), int(float(o['low']) * 100),\n int(float(o['close']) * 100), int(o['volume']), map5,mav5,map10,mav10,map20,mav20,macdval,\"'\"+boll+\"'\")\n if idx > 0:\n idx = idx - 1\n cursor.execute(sql)\n conn.commit()\n cursor.close()\n return 0\n\nGLOBAL_TUSHARE_DATALEN = 5\ndef tushare_updategg(conn):\n global GLOBAL_TUSHARE_DATALEN\n cursor = conn.cursor()\n cursor.execute(\"SELECT * FROM code\")\n res = cursor.fetchall()\n index = 1\n rlen = len(res)\n currtime = tools.getlastday().strftime(\"%Y%m%d\")\n starttime = tools.getnday(GLOBAL_TUSHARE_DATALEN).strftime(\"%Y%m%d\")\n fields = \"turnover_rate,turnover_rate_f,volume_ratio,pe,pb\"\n for row in res:\n # 代码(id) 是否st(st 1.是 0.不是) 涨跌(percent) 市净率(pb) 市盈率(per) 换手(turnover) 总市值(mktcap) 流通市值(nmc) 真实市值(sjlt) 板块[名字1,名字2...](bk)\n code = row[0]\n print('[GG] loading:(' + str(index) + '/' + str(rlen) + ') - ' + code)\n index = index + 1\n\n #1.tushare\n ret = -1\n while ret == -1:\n ret,df = net.tushare_history(code, starttime, currtime)\n\n list = {}\n for _i, _row in df.iterrows():\n info = {}\n date = _row['trade_date']\n info['open'] = _row['open'] #开盘价\n info['high'] = _row['high'] #最高价\n info['low'] = _row['low'] #最低价\n info['close'] = _row['close'] #收盘价\n info['pre_close'] = _row['pre_close'] #昨收价\n #change = _row['change'] #涨跌额\n #info['pct_chg'] = _row['pct_chg'] #涨跌幅\n info['volume'] = _row['vol'] #成交量(手)\n info['amount'] = _row['amount'] #成交额(千元)\n ret = -1\n while ret == -1:\n ret,fdf = net.tushare_history_fields(code, date, fields)\n #print(fdf)\n for __i, __row in fdf.iterrows():\n info['turn'] = __row['turnover_rate'] #换手率\n info['turnover'] = __row['turnover_rate_f'] #换手率(自由流通股)\n info['volume_ratio'] = __row['volume_ratio'] #量比\n info['pe'] = __row['pe'] #市盈率(总市值/净利润)\n info['pb'] = __row['pb'] #市净率(总市值/净资产)\n list[date] = info\n\n #macd\n #macd = getmacd(df)\n #macddata = macd.set_index('date')\n #boll\n #upper, middle, lower = getboll(df)\n\n if tools.table_exists(cursor, code) == 0:\n csql = \"CREATE TABLE IF NOT EXISTS `\" + code + \"`(day date,open mediumint unsigned,high mediumint unsigned,low mediumint unsigned,close mediumint unsigned,volume bigint unsigned,amount bigint unsigned,turn mediumint unsigned,turnover mediumint unsigned,vol mediumint unsigned,pe mediumint unsigned,pb mediumint unsigned,preclose mediumint unsigned)\"\n cursor.execute(csql)\n\n #idx = len(upper) - 1\n for key, value in list.items():\n date = key\n open = value['open'] #开盘价\n high = value['high'] #最高价\n low = value['low'] #最低价\n close = value['close'] #收盘价\n pre_close = value['pre_close'] #昨收价\n #pct_chg = value['pct_chg'] #涨跌幅\n volume = value['volume'] #成交量(手)\n amount = value['amount'] #成交额(千元)\n turn = value['turn'] #换手率\n turnover = value['turnover'] #换手率(自由流通股)\n vol = value['volume_ratio'] #量比\n pe = value['pe'] #市盈率(总市值/净利润)\n pb = value['pb'] #市净率(总市值/净资产)\n\n if open is None:\n open = 0\n if high is None:\n high = 0\n if low is None:\n low = 0\n if close is None:\n close = 0\n if pre_close is None:\n pre_close = 0\n if volume is None:\n volume = 0\n if open is None:\n open = 0\n if amount is None:\n amount = 0\n if turn is None:\n turn = 0\n if turnover is None:\n turnover = 0\n if vol is None:\n vol = 0\n if pe is None:\n pe = 0\n if pb is None:\n pb = 0\n\n #print(value)\n ssql = \"SELECT * FROM `\" + code + \"` WHERE day = '\" + date + \"'\"\n has = cursor.execute(ssql)\n if has == 0:\n s = \"INSERT INTO `\" + code + \"`(day,open,high,low,close,volume,amount,turn,turnover,vol,pe,pb,preclose) VALUES('%s','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d')\"\n sql = s % (\n date, int(open * 100), int(high * 100), int(low * 100),\n int(close * 100), int(volume), int(amount),int(turn * 100),int(turnover * 100),int(vol * 100),int(pe * 100),int(pb*100),int(pre_close*100))\n else:\n s = \"UPDATE `\" + code + \"` SET open=%d,high=%d,low=%d,close=%d,volume=%d,amount=%d,turn=%d,turnover=%d,vol=%d,pe=%d,pb=%d,preclose=%d WHERE day = '\" + date + \"'\"\n sql = s % (int(open * 100), int(high * 100), int(low * 100),\n int(close * 100), int(volume), int(amount), int(turn * 100), int(turnover * 100),\n int(vol * 100), int(pe * 100), int(pb * 100), int(pre_close * 100))\n cursor.execute(sql)\n conn.commit()\n cursor.close()\n return 0\n\ndef update(conn):\n #ret = sina_updategg(conn)\n ret = tushare_updategg(conn)\n return ret\n\n\n\n\n\n" } ]
22
jhcnode/yolov4_inference
https://github.com/jhcnode/yolov4_inference
d915b524f1ee96a08caa656dd90d756b86a5062f
05fa4f40e9895d74028867a52c80cb44417be4a8
ddede6e9b02bc46e76d49f6507da695b0758b4c6
refs/heads/main
2023-03-13T20:55:12.115676
2021-03-09T09:08:28
2021-03-09T09:08:28
345,600,411
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.6943734288215637, "alphanum_fraction": 0.7167519330978394, "avg_line_length": 32.89130401611328, "blob_id": "cb32ff28e49ab0ff96455ee3697102cbf4ffee26", "content_id": "8ee6002237a075b93024af453ad5a2e1b591be59", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1564, "license_type": "no_license", "max_line_length": 97, "num_lines": 46, "path": "/inference.py", "repo_name": "jhcnode/yolov4_inference", "src_encoding": "UTF-8", "text": "import torch\nfrom torch import nn\nimport torch.nn.functional as F\nfrom tool.utils import load_class_names, plot_boxes_cv2\nfrom tool.torch_utils import do_detect\nfrom models import Yolov4\nimport cv2\ntorch.backends.cudnn.benchmark = True\n\n\nclass inference(object):\n\tdef __init__(self,weightfile,num_classes=80,width=416,height=416,use_cuda = True,is_half=True):\n\t\tself.num_classes = num_classes\n\t\tself.model = Yolov4(yolov4conv137weight=None, n_classes=self.num_classes, inference=True)\n\t\tpretrained_dict = torch.load(weightfile, map_location=torch.device('cuda'))\n\t\tself.model.load_state_dict(pretrained_dict)\n\t\tself.use_cuda = use_cuda\n\t\tself.is_half=is_half\n\t\tself.width=width\n\t\tself.height=height\n\t\tif self.use_cuda:\n\t\t\tif self.is_half:\n\t\t\t\tself.model=self.model.cuda().half()\n\t\t\telse:\n\t\t\t\tself.model=self.model.cuda()\n\t\tif self.num_classes == 20:\n\t\t\tnamesfile = 'data/voc.names'\n\t\telif self.num_classes == 80:\n\t\t\tnamesfile = 'data/coco.names'\n\t\telse:\n\t\t\tnamesfile = 'data/x.names'\n\t\tself.class_names = load_class_names(namesfile)\t\n\t\tprint(\"initialize_a_pytorch\")\n\tdef infer(self,data):\n\t\tsized = cv2.resize(data, (self.width, self.height))\n\t\tsized = cv2.cvtColor(sized, cv2.COLOR_BGR2RGB)\n\t\tboxes = do_detect(self.model, sized, 0.4, 0.6, self.use_cuda,self.is_half)\n\t\tplot_boxes_cv2(data, boxes[0], savename='./data/predictions.jpg', class_names=self.class_names)\n\t\t\n\nif __name__ == '__main__':\n\timgfile=\"./data/dog.jpg\"\n\tmodel1=inference(weightfile=\"./Yolov4.pth\",is_half=True)\n\timg = cv2.imread(imgfile)\n\tmodel1.infer(img)##warming up\n\tmodel1.infer(img)\n\n\n\n\n\n" }, { "alpha_fraction": 0.6825775504112244, "alphanum_fraction": 0.7446300983428955, "avg_line_length": 22.11111068725586, "blob_id": "3b1edee514ea8322b60239216a67e52a61a0fad9", "content_id": "fe45fa8ac15a5091360cbf1aa09eda1d16349ba6", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 419, "license_type": "no_license", "max_line_length": 110, "num_lines": 18, "path": "/README.md", "repo_name": "jhcnode/yolov4_inference", "src_encoding": "UTF-8", "text": "# yolov4_inference\nyolov4_inference_only\n\n## Environments\nPyTorch>=1.6.0 \nopencv-python==4.2.0.32 \nopencv-contrib-python==4.5.1.48 \n\n## Setup\n1. Download weights [yolov4.pth](https://github.com/jhcnode/yolov4_inference/releases/download/1.0/yolov4.pth)\n2. The weights file moves to project directory \n \n## Features\n1. float32 precision inference \n2. half precision inference\n\n## Quick start\n> python inference.py\n \n\n" } ]
2
Aqumar/joint_model_bert_tiny
https://github.com/Aqumar/joint_model_bert_tiny
56c7d2c29024196056b7316d623c6d6ac5fd01ec
3a81684a6ec5f48c78a67d5310acab031890960f
e0a58723fd5074a66d194c921b72b15eb02d9ce4
refs/heads/main
2023-06-23T18:58:01.241581
2021-07-25T11:38:03
2021-07-25T11:38:03
389,318,013
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.7134737968444824, "alphanum_fraction": 0.7176323533058167, "avg_line_length": 40.22285842895508, "blob_id": "73e0391330daaf648c6c8410a91b68f2222eabbb", "content_id": "74d8f0e21e1d4367b8459ef444c7f64b03403a41", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 7214, "license_type": "no_license", "max_line_length": 139, "num_lines": 175, "path": "/training.py", "repo_name": "Aqumar/joint_model_bert_tiny", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on tuesday 13-Apr-2021\n@author: rishabbh-sahu\n\"\"\"\n\nimport os\nimport tensorflow as tf\nimport tensorflow_hub as hub\nimport numpy as np\nfrom collections import namedtuple\nfrom readers.reader import Reader\nfrom collections import Counter\n\nfrom text_preprocessing import vectorizer,preprocessing\nfrom text_preprocessing.vectorizer import BERT_PREPROCESSING\nfrom model import JOINT_TEXT_MODEL\n\nfrom sklearn import metrics\nfrom seqeval.metrics import classification_report, f1_score\nfrom itertools import chain\n\n\nprint(\"TensorFlow Version:\",tf.__version__)\nprint(\"Hub version: \",hub.__version__)\nprint('GPU is in use:',tf.config.list_physical_devices('GPU'))\n\nconfiguration_file_path = 'config.yaml'\nconfig = {}\nconfig.update(Reader.read_yaml_from_file(configuration_file_path))\n\ndata_path = config['data_path']\n\nprint('read data ...')\ntrain_text_arr, train_tags_arr, train_intents = Reader.read(data_path+'train/')\nval_text_arr, val_tags_arr, val_intents = Reader.read(data_path+'valid/')\ndata_text_arr, data_tags_arr, data_intents = Reader.read(data_path+'test/')\n\ntrain_text_arr = preprocessing.remove_next_line(train_text_arr)\ntrain_tags_arr = preprocessing.remove_next_line(train_tags_arr)\ntrain_intents = preprocessing.remove_next_line(train_intents)\nprint('train_text_arr', len(train_text_arr))\n\nval_text_arr = preprocessing.remove_next_line(val_text_arr)\nval_tags_arr = preprocessing.remove_next_line(val_tags_arr)\nval_intents = preprocessing.remove_next_line(val_intents)\nprint('val_text_arr', len(val_text_arr))\n\ndata_text_arr = preprocessing.remove_next_line(data_text_arr)\ndata_tags_arr = preprocessing.remove_next_line(data_tags_arr)\ndata_intents = preprocessing.remove_next_line(data_intents)\nprint('Test data size :',len(data_text_arr))\n\nclass_dist = Counter(train_intents)\nprint('Intents & Distributions:',class_dist)\n\nprint('encode sequence labels ...')\nsequence_label_encoder = vectorizer.label_encoder(train_intents)\ntrain_sequence_labels = vectorizer.label_encoder_transform(train_intents,sequence_label_encoder)\nval_sequence_labels = vectorizer.label_encoder_transform(val_intents,sequence_label_encoder)\nintents_num = len(sequence_label_encoder.classes_)\nprint('Total number of sequence labels are', intents_num)\n\nprint('encode sequence tags ...')\ntags_data = ['<PAD>'] + [item for sublist in [s.split() for s in train_tags_arr] for item in sublist] \\\n + [item for sublist in [s.split() for s in val_tags_arr] for item in sublist]\nslot_encoder = vectorizer.label_encoder(tags_data)\nslots_num = len(slot_encoder.classes_)\nprint('Total number of slots are :', slots_num)\n\n# initializing the model\nmodel = JOINT_TEXT_MODEL(slots_num=slots_num,intents_num=intents_num,model_path=config['model_path'],learning_rate=config['LEARNING_RATE'])\n\n# initializing the model tokenizer to be used for creating sub-tokens\nmodel_tokenizer = BERT_PREPROCESSING(model_layer=model.model_layer,max_seq_length=config['MAX_SEQ_LEN'])\n\nprint('creating input arrays for the model inputs..')\ntrain = model_tokenizer.create_input_array(train_text_arr)\nval = model_tokenizer.create_input_array(val_text_arr)\n\ntrain_tags = np.array([model_tokenizer.get_tag_labels(text,tag_labels,slot_encoder) \\\n for (text,tag_labels) in zip(train_text_arr,train_tags_arr)])\nval_tags = np.array([model_tokenizer.get_tag_labels(text,tag_labels,slot_encoder) \\\n for (text,tag_labels) in zip(val_text_arr,val_tags_arr)])\n\nmodel.fit(train,[train_tags,train_sequence_labels],validation_data=(val,[val_tags,val_sequence_labels]),\n epochs=config['EPOCHS'],batch_size=config['BATCH_SIZE'])\n\n# Model evaluation\n#query = 'could you please play songs from james blunt'\n\ndef flatten(y):\n return list(chain.from_iterable(y))\n\nquery = 'Early morning , right ? I want to be rested for the big party .'\n\nwith open(os.path.join('/home/aqumar/bert_joint_model/intent_and_slot_classification/data/snips/train/seq.in'), encoding='utf-8') as f:\n text_arr = f.read().splitlines()\n # text_arr = f.readlines()\n text_arr = [sub.replace('\\n', '') for sub in text_arr]\n\nwith open(os.path.join('/home/aqumar/bert_joint_model/intent_and_slot_classification/data/snips/train/seq.out'), encoding='utf-8') as f:\n tags_arr = f.read().splitlines()\n # text_arr = f.readlines()\n tags_arr = [sub.replace('\\n', '') for sub in tags_arr]\n\nwith open(os.path.join('/home/aqumar/bert_joint_model/intent_and_slot_classification/data/snips/train/label'), encoding='utf-8') as f:\n data_intents = f.read().splitlines()\n data_intents = [sub.replace('\\n', '') for sub in data_intents]\n\n\n#gold_tags = [x.split() for x in tags_arr]\n\ngold_tags = [model_tokenizer.get_prediction_tag_labels(text,tag_labels) \\\n for (text,tag_labels) in zip(text_arr,tags_arr)]\n\nprediction_tags = []\npredicted_intents = []\ncounter = 0\nfor query in text_arr:\n\n test_tokens, test_query = model_tokenizer.get_tokenized_query(query)\n test_inputs=model_tokenizer.create_input_array([query])\n slots,intent=model.predict(test_inputs)\n #print('Test query intent prediction:', sequence_label_encoder.inverse_transform([np.argmax(intent)]))\n intent_ = sequence_label_encoder.inverse_transform([np.argmax(intent)])\n predicted_intents.append(intent_)\n # Use the highest logit values for tag prediction\n slots=np.argmax(slots, axis=-1)\n\n before_pad = list(test_inputs['input_mask'][0]).count(1)\n #list_without_pad=[item for sublist in slots for item in sublist if item > 0]\n list_without_pad = slots[0][0:before_pad]\n # Removing CLS and SEP tokens from the prediction\n pred_tags=slot_encoder.inverse_transform(list_without_pad[1:-1])\n\n if len(gold_tags[counter]) != len(pred_tags):\n #pass\n\n print('test query - ', test_query)\n print('test tokens - ', test_tokens)\n\n print(\"test inputs::\", test_inputs)\n\n print(\"list_without_pad::\", list_without_pad)\n\n print('Test query intent prediction:', sequence_label_encoder.inverse_transform([np.argmax(intent)]))\n\n print(\"slots::\", slots)\n print(\"original tag::\", gold_tags[counter])\n print('Test query entities prediction :', pred_tags)\n\n print('token level entity predictions :', [(word, tag) for word, tag in zip(model_tokenizer.tokenizer.tokenize(query), pred_tags)])\n\n prediction_tags.append(list(pred_tags))\n\n counter = counter + 1\n\nacc = metrics.accuracy_score(data_intents, predicted_intents)\nprint(\"Intent accuracy::\", acc)\n\ntoken_f1_score = metrics.f1_score(flatten(gold_tags), flatten(prediction_tags), average='micro')\nprint(\"total f1 score::\", token_f1_score)\n\n\n#print(\"gold_tags::\", gold_tags)\n#print(\"prediction_tags::\", prediction_tags)\ntag_f1_score = f1_score(gold_tags, prediction_tags, average='micro')\nprint(\"tag f1 score::\", tag_f1_score)\n\nreport = classification_report(gold_tags, prediction_tags, digits=4)\nprint(\"classification report::\", report)\n\nprint(\"Saving model and its config here - \", {os.path.join(config['saved_model_dir_path'],config['model_name'],config['model_version'])})\nmodel.save(os.path.join(config['saved_model_dir_path'],config['model_name'],config['model_version']))\n" }, { "alpha_fraction": 0.6136009097099304, "alphanum_fraction": 0.6178877353668213, "avg_line_length": 40.71544647216797, "blob_id": "b0d5283c298a184edd2acf642e9deab7d3f30a39", "content_id": "0bf9ee7479e55eec22ec69ab12c7716cceff440d", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 5132, "license_type": "no_license", "max_line_length": 131, "num_lines": 123, "path": "/text_preprocessing/vectorizer.py", "repo_name": "Aqumar/joint_model_bert_tiny", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n\"\"\"\n@author: rishabbh-sahu\n\"\"\"\n\nimport bert\nfrom bert.tokenization.bert_tokenization import FullTokenizer\nfrom sklearn.preprocessing import LabelEncoder\nimport numpy as np\nfrom tqdm import tqdm\n\ndef label_encoder(unique_classes):\n le = LabelEncoder()\n le.fit_transform(unique_classes)\n return le\n\ndef label_encoder_transform(unique_classes,_label_encoder):\n return _label_encoder.transform(unique_classes).astype(np.int32)\n\nclass BERT_PREPROCESSING:\n\n def __init__(self, model_layer, max_seq_length):\n '''\n model_layer: Model layer to be used to create the tokenizer for\n return: tokenizer compatible with the model i.e. bert, albert etc.\n '''\n super(BERT_PREPROCESSING,self).__init__()\n self.model_layer = model_layer\n self.max_seq_length = max_seq_length\n #FullTokenizer = bert.bert_tokenization.FullTokenizer\n vocab_file = self.model_layer.resolved_object.vocab_file.asset_path.numpy()\n do_lower_case = self.model_layer.resolved_object.do_lower_case.numpy()\n self.tokenizer = FullTokenizer(vocab_file, do_lower_case)\n print('vocabulary_file:', type(vocab_file), '\\nto_lower_case:', type(do_lower_case))\n print('tokenizer.vocab:', len(self.tokenizer.vocab))\n\n def tokenize_text(self,text):\n '''\n param text: Text to tokenize\n param tokenizer: tokenizer used for word splitting\n return: stream of sub-tokens after tokenization\n '''\n return self.tokenizer.convert_tokens_to_ids(self.tokenizer.tokenize(text))\n\n def get_ids(self, tokens):\n \"\"\"Token ids from Tokenizer vocab\"\"\"\n token_ids = self.tokenizer.convert_tokens_to_ids(tokens, )\n input_ids = token_ids + [0] * (self.max_seq_length - len(token_ids))\n return input_ids\n\n def get_masks(self, tokens):\n return [1] * len(tokens) + [0] * (self.max_seq_length - len(tokens))\n\n def get_segments(self, tokens):\n \"\"\"Segments: 0 for the first sequence, 1 for the second\"\"\"\n segments = []\n current_segment_id = 0\n for token in tokens:\n segments.append(current_segment_id)\n if token == \"[SEP]\":\n current_segment_id = 1\n return segments + [0] * (self.max_seq_length - len(tokens))\n\n def create_single_input(self, sentence, MAX_LEN):\n stokens = self.tokenizer.tokenize(sentence)\n stokens = stokens[:MAX_LEN]\n stokens = [\"[CLS]\"] + stokens + [\"[SEP]\"]\n ids = self.get_ids(stokens)\n masks = self.get_masks(stokens)\n segments = self.get_segments(stokens)\n return ids, masks, segments\n\n def create_input_array(self, sentences):\n input_ids, input_masks, input_segments = [], [], []\n for sentence in tqdm(sentences, position=0, leave=True):\n ids, masks, segments = self.create_single_input(sentence, self.max_seq_length - 2)\n input_ids.append(ids)\n input_masks.append(masks)\n input_segments.append(segments)\n return {'input_word_ids': np.array(input_ids),\n 'input_mask': np.array(input_masks),\n 'input_type_ids': np.array(input_segments), }\n\n def get_tag_labels(self, sentence: str, sent_tags: str, slot_encoder):\n words = sentence.split() # whitespace tokenizer\n tags = sent_tags.split()\n tags_extended = []\n for i, word in enumerate(words):\n tokens = self.tokenizer.tokenize(word)\n tags_extended.append(tags[i])\n if len(tokens) > 1:\n tags_extended.extend((len(tokens) - 1) * ['O'])\n tags_extended = slot_encoder.transform(tags_extended)\n # [CLS] token takes 'O' at the start - BERT INPUT\n tags_extended = np.insert(tags_extended, 0, slot_encoder.transform(['O']), axis=0)\n # [SEP] token takes 'O' at the end - BERT INPUT\n tags_extended = np.append(tags_extended, slot_encoder.transform(['O']))\n # Insert PAD's if max seq length > lenght of tags\n if len(tags_extended) < self.max_seq_length:\n tags_extended = np.append(tags_extended,slot_encoder.transform(['<PAD>'] * (self.max_seq_length - len(tags_extended))))\n else:\n tags_extended = tags_extended[:self.max_seq_length]\n return tags_extended\n\n def get_prediction_tag_labels(self, sentence: str, sent_tags: str):\n words = sentence.split() # whitespace tokenizer\n tags = sent_tags.split()\n tags_extended = []\n for i, word in enumerate(words):\n tokens = self.tokenizer.tokenize(word)\n tags_extended.append(tags[i])\n if len(tokens) > 1:\n tags_extended.extend((len(tokens) - 1) * ['O'])\n if len(tags_extended) > self.max_seq_length - 2:\n tags_extended = tags_extended[:self.max_seq_length - 2]\n return tags_extended\n\n def get_tokenized_query(self, sentence):\n stokens = self.tokenizer.tokenize(sentence)\n MAX_LEN = self.max_seq_length - 2\n stokens = stokens[:MAX_LEN]\n\n return stokens, ' '.join(stokens)\n\n" }, { "alpha_fraction": 0.7200000286102295, "alphanum_fraction": 0.800000011920929, "avg_line_length": 10.222222328186035, "blob_id": "3cfffa58e97c488658b1381003c6cfe87bc0bf2e", "content_id": "0343278e95ded7aa8354825fb20aaad9a63433e4", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Text", "length_bytes": 100, "license_type": "no_license", "max_line_length": 26, "num_lines": 9, "path": "/requirements.txt", "repo_name": "Aqumar/joint_model_bert_tiny", "src_encoding": "UTF-8", "text": "tensorflow==2.4\ntensorflow_hub\nbert\npandas\nnumpy\npyyaml\nscikit-learn>=0.22.2.post1\ntqdm\nbert-for-tf2" }, { "alpha_fraction": 0.7410383224487305, "alphanum_fraction": 0.7719406485557556, "avg_line_length": 72.5, "blob_id": "c807904061db8001ad1c28a8a203b5e042e14eae", "content_id": "29c8154a47249d1afc461781d03141233a5e2e31", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 1618, "license_type": "no_license", "max_line_length": 560, "num_lines": 22, "path": "/README.md", "repo_name": "Aqumar/joint_model_bert_tiny", "src_encoding": "UTF-8", "text": "# intent_and_slot_classification\n#### About this project\nOne of the main NLU tasks is to understand the intent (sequence classification) and slots (entities within the sequence) and this repo helps you do the same. By extracting this knowledge about the queries, you can comprehend the context and take appropriate decisions. This repo help classify both together using Joint Model architecture (multitask model). Pretrained model BERT_SMALL is used to achieve transfer learning however it can be changed to any other BERT variants. Supports for various models like albert, mobilebert etc. would be availalble soon!. \n\nTo enable GPU support, please do enable CUDA-11 in windows/linux/mac virtual environment for tf2.4 or use CUDA 10.1 for tf2.3.\n\n#### Getting started\n- create virtual environment\n- install tensorflow==2.4\n- install requirements \n- Open config.yaml file and modify parameters as per your setup\n\n#### For training\n- python training.py \n\n#### Score\n- Training accuracy after 5-epoch : sequence acc ~ 99% and slot acc ~96%\n- Validation accuracy : sequence acc ~ 99% and slot acc ~96%\n\n#### Acknowledgement:\n@article https://arxiv.org/pdf/1805.10190.pdf\n{coucke2018snips, title = {Snips Voice Platform: an embedded Spoken Language Understanding system for private-by-design voice interfaces}, author = {Coucke, Alice and Saade, Alaa and Ball, Adrien and Bluche, Th{'e}odore and Caulier, Alexandre and Leroy, David and Doumouro, Cl{'e}ment and Gisselbrecht, Thibault and Caltagirone, Francesco and Lavril, Thibaut and others}, journal = {arXiv preprint arXiv:1805.10190}, pages = {12--16}, year = {2018}}\n\n" }, { "alpha_fraction": 0.6220546364784241, "alphanum_fraction": 0.6267672181129456, "avg_line_length": 39.79487228393555, "blob_id": "4c4c8311fc34b5e86b470c7a1dbb9240b55b373b", "content_id": "d6de2bfcdf636ecb8e9c3b6059d55d9dc901770f", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3183, "license_type": "no_license", "max_line_length": 117, "num_lines": 78, "path": "/model.py", "repo_name": "Aqumar/joint_model_bert_tiny", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n\"\"\"\n@author: rishabbh-sahu\n\"\"\"\n\nimport tensorflow as tf\nfrom tensorflow.keras.models import Model\nfrom tensorflow.keras.layers import Input, Dense\nimport tensorflow_hub as hub\nimport json\nimport os\n\n\nclass JOINT_TEXT_MODEL():\n def __init__(self, slots_num, intents_num, model_path, learning_rate, name='text_classification'):\n super(JOINT_TEXT_MODEL, self).__init__()\n\n self.model = None\n self.name = name\n self.num_slot_classes = slots_num\n self.num_seq_classes = intents_num\n self.model_path = model_path\n self.lr = learning_rate\n\n self.model_params = {\n 'num_slot_classes': slots_num,\n 'num_sequence_classes': intents_num,\n 'model_path': model_path,\n 'learning_rate': learning_rate\n }\n\n print(f'loading the model layer...')\n self.model_layer = hub.KerasLayer(self.model_path, trainable=True, name='bert_layer')\n print(f'model - {self.model_path} successfully loaded..')\n self.build_model()\n self.compile_model()\n\n def compile_model(self):\n optimizer = tf.keras.optimizers.Adam(lr=float(self.lr))\n losses = {\n 'slot_classifier': 'sparse_categorical_crossentropy',\n 'sequence_classifier': 'sparse_categorical_crossentropy',\n }\n loss_weights = {'slot_classifier': 3.0, 'sequence_classifier': 1.0}\n metrics = {\n 'slot_classifier': 'acc',\n 'sequence_classifier': 'acc',\n }\n self.model.compile(optimizer=optimizer, loss=losses, loss_weights=loss_weights, metrics=metrics)\n self.model.summary()\n\n def build_model(self):\n inputs = dict(\n input_word_ids=Input(shape=(None,), dtype=tf.int32, name=\"input_word_ids\"),\n input_mask=Input(shape=(None,), dtype=tf.int32, name=\"input_mask\"),\n input_type_ids=Input(shape=(None,), dtype=tf.int32, name=\"input_type_ids\"),\n )\n pooled_output = self.model_layer(inputs)['pooled_output']\n sequence_output = self.model_layer(inputs)['sequence_output']\n\n sequence_classifier = Dense(self.num_seq_classes, activation='softmax', name='sequence_classifier')(\n pooled_output)\n slot_classifier = Dense(self.num_slot_classes, activation='softmax', name='slot_classifier')(sequence_output)\n self.model = Model(inputs=inputs, outputs=[slot_classifier, sequence_classifier], name=self.name)\n\n def fit(self, train_X, train_Y, validation_data=None, epochs=5, batch_size=16):\n self.model_params.update({'epochs': epochs, 'batch_size': batch_size})\n history = self.model.fit(train_X, train_Y, validation_data=validation_data,\n epochs=epochs, batch_size=batch_size, shuffle=False, verbose=2)\n\n def predict(self, x):\n return self.model.predict(x)\n\n def save(self, saved_model_path):\n self.model_params.update({'saved_model_path': saved_model_path})\n self.model.save(saved_model_path)\n with open(os.path.join(saved_model_path, 'model_params.json'), 'w') as json_file:\n json.dump(self.model_params, json_file)\n\n" }, { "alpha_fraction": 0.6681222915649414, "alphanum_fraction": 0.6703056693077087, "avg_line_length": 27.4375, "blob_id": "9307be9ccf30f0f60c5e8dc2edcb34e57a7f0f40", "content_id": "fe9ac7648109dcc8c5b538fa6f405d383a2f9b54", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 458, "license_type": "no_license", "max_line_length": 96, "num_lines": 16, "path": "/text_preprocessing/preprocessing.py", "repo_name": "Aqumar/joint_model_bert_tiny", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n\"\"\"\n@author: rishabbh-sahu\n\"\"\"\n\ndef remove_next_line(txt_arr):\n '''\n data cleansing in order to remove next line symbol may arise while data reading the file\n\n txt_arr: data cleansing in order to remove next line symbol may arise while data preperation\n return: cleaned text without next line '\\n' char\n '''\n return [sub.replace('\\n', '') for sub in txt_arr]\n\ndef remove_punctuations(txt_arr):\n return txt_arr\n\n\n\n" } ]
6
dartmouth-cs98/hack-a-thing-2-trumptweetsentimentanalysis
https://github.com/dartmouth-cs98/hack-a-thing-2-trumptweetsentimentanalysis
0658658478d82ac0bbf48dbfc0e5d4b91caa4e7d
2dfc578eddf78ef464e8821df4aef34372de8bad
e6d6290a578982059a9e919f2b77700ca6cdb78c
refs/heads/master
2020-04-16T22:10:07.418434
2019-01-16T23:04:13
2019-01-16T23:04:13
165,955,936
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.7777202129364014, "alphanum_fraction": 0.7844559550285339, "avg_line_length": 136.7857208251953, "blob_id": "896048627e726aae459ba8277907cbd2548982ad", "content_id": "9b9cacaf416ce37e0a2b0ce92456dc93083f7298", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 1930, "license_type": "no_license", "max_line_length": 599, "num_lines": 14, "path": "/README.md", "repo_name": "dartmouth-cs98/hack-a-thing-2-trumptweetsentimentanalysis", "src_encoding": "UTF-8", "text": "# hack-a-thing-2-trumptweetsentimentanalysis\nhack-a-thing-2-trumptweetsentimentanalysis created by GitHub Classroom\n\nTrump Tweets is a project I made based on a hunch that the tweets of President Trump has an effect on the stock market. For this project, I used the python-twitter api, IBM Watson Tone Analyzer api, and AlphaVantage Stock api. The program will first pull the 200 most recent tweets from Donald Trump's account. Next, it analyzes the tone of each of these tweets and adds them to a dictionary containing the tones of all the tweets for that day. Finally, it pulls historic stock price information for the S&P 500 and calculates the day's price change. The `trump_tweets` dictionary contains the following structure:\n\n`trump_tweets[date] = {[[tones for all the days tweets in a list], S&P 500 price change]}`\n\nOnce the data is pulled, parsed, and organized, the user is given an input prompt. When a date is entered, the program will find the most common tone of trumps tweets for the day and output the tone and the price change for the day. \n\nI am interested in using a sentiment analysis for my CS98 project, so this was a perfect way to test out the IBM Watson api and play around with how it worked. Additionally, I wanted to analyze an outside data source, so trump tweets were a good data set to try out.\n\nI worked on this project alone since the assignment webpage says: \"Who did what (if you worked with someone else)\", so I ended up working on this by myself.\n\nWhat didn't work: I wanted to make the stock market price change more specific than the entire day's movement, however all free apis only had historic data by day. To find hourly historic data, I would have needed to pay for a more advanced stock price api. If I were improving this project, I would try to find a better stock price api that gives more specific historic prices so I could see what impact the tweets had on the market in the subsequent hour. \n" }, { "alpha_fraction": 0.639010488986969, "alphanum_fraction": 0.653677761554718, "avg_line_length": 32.8370361328125, "blob_id": "899690395d16c798a9a041fc3db72f546ed0141b", "content_id": "fcad89ebe9ecbf1e115d12f6c07ef048f1820b4c", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 4568, "license_type": "no_license", "max_line_length": 150, "num_lines": 135, "path": "/ToneAnalyzer.py", "repo_name": "dartmouth-cs98/hack-a-thing-2-trumptweetsentimentanalysis", "src_encoding": "UTF-8", "text": "from watson_developer_cloud import ToneAnalyzerV3\nfrom collections import Counter\nfrom dateutil import parser\n\nimport json\nimport datetime\nimport requests\nimport twitter\n\n# used python-twitter api to get tweets\n# used IBM Watson api to do sentiment analysis\n# used AlphaVantage api to get stock prices\n\n# Twitter access tokens\nACCESS_TOKEN_KEY = '334444072-Xj2lrc5Xh51bRi4xvadXwhdyzI7mAhCLyWJEzzYr'\nACCESS_TOKEN_SECRET = 'wwSKRsN47dWjfFcQbkPTGp2lnljbNIhmMPaOEeWlf3ssp'\nCONSUMER_KEY = 'i4ZrOiOLqZ2gKwu0r76FvhB7z'\nCONSUMER_SECRET = '70ssfAJraZ1s8qx0nkGxLohXWQkGvZD00n5w0sL71w1m8HSLxs'\n\n# helper function to get all tweets up to max allowed 3,200\n# currently returning 200 most recent tweets\ndef get_tweets(api=None, screen_name=None):\n timeline = api.GetUserTimeline(screen_name=screen_name, count=200)\n earliest_tweet = min(timeline, key=lambda x: x.id).id\n # print(\"getting tweets before:\", earliest_tweet)\n print('Getting 200 most recent tweets \\n')\n\n while True:\n tweets = api.GetUserTimeline(\n screen_name=screen_name, max_id=earliest_tweet, count=200\n )\n new_earliest = min(tweets, key=lambda x: x.id).id\n\n if not tweets or new_earliest == earliest_tweet:\n break\n # else:\n # earliest_tweet = new_earliest\n # print(\"getting tweets before:\", earliest_tweet)\n # timeline += tweets\n break\n return timeline\n\n\n# dictionary of tweets indexed on date\n# will contain following structure:\n# [[list of sentiment for days tweets], stock_market_close - stock_market_open]\ntrump_tweets = {}\n\n# pull all tweets\napi = twitter.Api(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN_KEY, ACCESS_TOKEN_SECRET)\nscreen_name = 'realDonaldTrump'\ntimeline = get_tweets(api=api, screen_name=screen_name)\n\n# create ToneAnalyzer IBM Watson object\ntone_analyzer = ToneAnalyzerV3(\n version='2017-09-21',\n iam_apikey='n54NtzfmzFug46PryonqHU9sGWWaGKcT_vQ_zQhOvdrR',\n url='https://gateway.watsonplatform.net/tone-analyzer/api'\n)\nfirst_tweet = 0\nearliest_date = ''\nrecent_date = ''\n\n# add tweets and sentiment to dictionary\nfor tweet in timeline:\n\n dt = parser.parse(tweet._json['created_at'])\n date = datetime.datetime.strptime(str(dt.day) + str(dt.month) + str(dt.year), '%d%m%Y').date()\n\n if first_tweet == 0:\n recent_date = date\n first_tweet = 1\n\n earliest_date = date\n\n # IBM Watson tone analysis on each tweet\n tone_analysis = tone_analyzer.tone(\n {'text': tweet._json['full_text']},\n 'application/json',\n False\n ).get_result()\n\n if len(tone_analysis['document_tone']['tones']) == 0:\n continue\n\n print('Detected sentiment ' + tone_analysis['document_tone']['tones'][0]['tone_name'] + ' in tweet')\n\n if str(date) not in trump_tweets:\n trump_tweets[str(date)] = [[tone_analysis['document_tone']['tones'][0]['tone_name']]]\n # trump_tweets[str(date)] = [[tweet._json['full_text']]]\n else:\n # trump_tweets[str(date)][0].append(tweet._json['full_text'])\n trump_tweets[str(date)][0].append(tone_analysis['document_tone']['tones'][0]['tone_name'])\n\n\n# pulling historic S&P 500 data\nurl = \"https://www.alphavantage.co/query?function=TIME_SERIES_DAILY_ADJUSTED&symbol=SPX&outputsize=full&apikey=1TTCW4N7SLIUCIWS\"\n\nprint('pulling historic stock prices')\n\nstockResponse = requests.get(url)\njData = json.loads(stockResponse.content)\n\nfor date in jData['Time Series (Daily)']:\n if date in trump_tweets:\n dated_tweets = trump_tweets[date]\n open = jData['Time Series (Daily)'][date]['1. open']\n close = jData['Time Series (Daily)'][date]['4. close']\n dated_tweets.append(float(open)-float(close))\n\nprint('\\n')\nprint(trump_tweets.keys())\nprint('\\n')\n\n# user input - enter date from the printed list to find most common sentiment for the day and S&P 500 close\nwhile True:\n date = input(\"Please enter a date from the above printed list to find most common \"\n \"Trump tweet sentiment or leave a blank line to quit: \")\n if not date: break\n\n if date not in trump_tweets:\n print('No tweets from trump on ' + str(date) + ' :/')\n\n elif len(trump_tweets[date]) == 1:\n\n data = Counter(trump_tweets[date][0])\n print('Trump sentiment for the day was ' + data.most_common(1)[0][0] + ' but markets were closed')\n\n else:\n\n data = Counter(trump_tweets[date][0])\n if trump_tweets[date][1] >= 0:\n print('Trump sentiment for the day was ' + data.most_common(1)[0][0] + ' and S&P 500 closed up $' + str(\"%.2f\" % trump_tweets[date][1]))\n else:\n print('Trump sentiment for the day was ' + data.most_common(1)[0][0] + ' and S&P 500 closed down $' + str(\"%.2f\" % trump_tweets[date][1]))\n" } ]
2
bmunns/ossu
https://github.com/bmunns/ossu
b333b0f4a4baa70f912a154b08b2a2bb0c25c8b5
ab6b0fded8f30099d1eb1a78dfe1524a0e01f1dd
7fb9a85d261f460c5ace507cc8d3737177583808
refs/heads/master
2020-04-24T17:43:48.702522
2019-05-11T20:56:41
2019-05-11T20:56:41
172,157,146
0
0
null
2019-02-23T01:28:01
2019-02-23T03:09:24
2019-02-23T03:12:36
Python
[ { "alpha_fraction": 0.7516198754310608, "alphanum_fraction": 0.7624189853668213, "avg_line_length": 45.20000076293945, "blob_id": "bf064ef0a64714a30ecb6bff8c86ef74467e51ad", "content_id": "f05ec84542d5249e052e462233545d7ef2461471", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 463, "license_type": "no_license", "max_line_length": 208, "num_lines": 10, "path": "/README.md", "repo_name": "bmunns/ossu", "src_encoding": "UTF-8", "text": "# ossu\nRepo for storing project files from OSSU courses. [![Open Source Society University - Computer Science](https://img.shields.io/badge/OSSU-computer--science-blue.svg)](https://github.com/ossu/computer-science)\n\nCurrent contributors:\n* Ajay Matta\n* Ari Mouzakis\n* Ben Munns\n* Ethan Yew\n\nCurrent course: [MIT 6.00.1x - Introduction to Computer Science and Programming using Python](https://www.edx.org/course/introduction-to-computer-science-and-programming-using-python-0) \n" }, { "alpha_fraction": 0.5285451412200928, "alphanum_fraction": 0.5837937593460083, "avg_line_length": 19.11111068725586, "blob_id": "02d882b54ac14f0232ddb4ab5156c4c77e692307", "content_id": "4b7e950054b59e24eb8cd2abb1903d609346e042", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 543, "license_type": "no_license", "max_line_length": 55, "num_lines": 27, "path": "/intro_cs/mit_6001x/week2/Problem 3_ari.py", "repo_name": "bmunns/ossu", "src_encoding": "UTF-8", "text": "originalBalance = 4773\nbalance = originalBalance\nannualInterestRate = 0.2\n\nlow = 0\nhigh = balance * ((1 + annualInterestRate/12)**12)/12\nmonth = 1\nguess = (low + high)/2\n\nwhile True:\n balance = originalBalance\n guess = (low + high)/2\n month = 1\n while month < 13:\n balance = balance - guess\n balance += (balance * (annualInterestRate/12))\n month += 1\n\n if -0.01 < balance < 0:\n break\n if balance > 0:\n low = guess\n else:\n high = guess\n\n\nprint(\"Lowest Payment:\", f'{guess:2.0f}')\n" }, { "alpha_fraction": 0.6612359285354614, "alphanum_fraction": 0.6882022619247437, "avg_line_length": 26.677419662475586, "blob_id": "7a27d35fc4df50f6981f3d0bdc757720fd3c27fe", "content_id": "974896b23dde3c988f33f82133ef7724caa3c985", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1780, "license_type": "no_license", "max_line_length": 87, "num_lines": 62, "path": "/intro_cs/mit_6001x/week2/pset2_ethan.py", "repo_name": "bmunns/ossu", "src_encoding": "UTF-8", "text": "\r\nbalance = 999999\r\nannualInterestRate = 0.18\r\nmonthlyPaymentRate = 0.04\r\n\r\nmonthlyInterestRate = annualInterestRate/12\r\n\r\n# Problem 1:\r\n\r\nfor i in range(1, 13):\r\n \r\n minimumMonthlyPayment = monthlyPaymentRate * balance\r\n monthlyUnpaidBalance = balance - minimumMonthlyPayment\r\n balance = monthlyUnpaidBalance + monthlyUnpaidBalance * monthlyInterestRate\r\n\r\nprint(\"Remaining balance: \" + \"{0:.2f}\".format(balance))\r\n\r\n# Problem 2:\r\n\r\nminimumFixedMonthlyPayment = 10\r\n\r\nwhile balance > 0:\r\n testBalance = balance\r\n\r\n for i in range(12):\r\n \r\n monthlyUnpaidBalance = testBalance - minimumFixedMonthlyPayment\r\n testBalance = monthlyUnpaidBalance + monthlyUnpaidBalance * monthlyInterestRate\r\n \r\n if testBalance > 0:\r\n # testBalance = balance\r\n minimumFixedMonthlyPayment = minimumFixedMonthlyPayment + 10\r\n # print(\"Payment bumped to \" + str(minimumFixedMonthlyPayment))\r\n else:\r\n balance = 0\r\n print(\"Lowest Payment: \" + str(minimumFixedMonthlyPayment))\r\n\r\n# Problem 3:\r\n\r\nmonthlyPaymentLowerBound = balance/12\r\nmonthlyPaymentUpperBound = balance * pow((1 + monthlyInterestRate), 12) / 12\r\ntestBalance = balance\r\nepsilon = 0.01\r\ntestEpsilon = 1\r\n\r\nguess = (monthlyPaymentLowerBound + monthlyPaymentUpperBound) / 2\r\n \r\nwhile abs(testBalance) > epsilon:\r\n testBalance = balance\r\n\r\n for i in range(12):\r\n monthlyUnpaidBalance = testBalance - guess\r\n testBalance = monthlyUnpaidBalance + monthlyUnpaidBalance * monthlyInterestRate\r\n\r\n if testBalance > epsilon:\r\n monthlyPaymentLowerBound = guess\r\n \r\n else:\r\n monthlyPaymentUpperBound = guess\r\n \r\n guess = (monthlyPaymentLowerBound + monthlyPaymentUpperBound) / 2\r\n\r\nprint(\"{0:.2f}\".format(guess))\r\n" }, { "alpha_fraction": 0.6220238208770752, "alphanum_fraction": 0.6726190447807312, "avg_line_length": 24.846153259277344, "blob_id": "a149136b019ed9de3b13118b82fae9d06fa23005", "content_id": "13e8932e936270cc0452c0950b6fef9fba26c1fb", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 336, "license_type": "no_license", "max_line_length": 69, "num_lines": 13, "path": "/intro_cs/mit_6001x/week2/Problem 1_ari.py", "repo_name": "bmunns/ossu", "src_encoding": "UTF-8", "text": "balance = 484\nannualInterestRate = 0.2\nmonthlyPaymentRate = 0.04\n\n\nmonth = 1\nfor month in range(12):\n balance = balance - balance*monthlyPaymentRate\n balance += (balance * (annualInterestRate/12))\n print(\"Month\", month + 1, \"Remaining Balance:\", f'{balance:.2f}')\n month += 1\n\nprint(\"Remaining balance:\", f'{balance:.2f}')\n" }, { "alpha_fraction": 0.5461413860321045, "alphanum_fraction": 0.564490020275116, "avg_line_length": 18.723403930664062, "blob_id": "a81d82b387d6566c386843735cc9306fd1979702", "content_id": "a0bb6e4d074d455b8f8264cda35da36c88a2a4de", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1853, "license_type": "no_license", "max_line_length": 86, "num_lines": 94, "path": "/intro_cs/mit_6001x/week1/pset1_ben.py", "repo_name": "bmunns/ossu", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n\"\"\"\nMIT 6.00.1x Introduction to Computer Science and Programming Using Python\nProblem Set 1\n\nAuthor: Ben Munns\n\"\"\"\n\n## Exercise 1\nvowels = ['a', 'e', 'i', 'o', 'u']\ns = 'azcbobobegghakl'\ncount = 0\n\nfor letter in s:\n if letter in vowels:\n count += 1\n\nprint('Number of vowels: ' + str(count))\n\n\n## Exercise 2\n\nsubstring = 'bob'\ns = 'azcbobobegghakl'\ncount = 0\nfor i in range(len(s)):\n if s[i:i+len(substring)] == substring:\n count += 1\n\nprint('Number of times bob occurs is: ' + str(count))\n\n\n## Exercise 3\ns = 'azcbobobegghakl'\nss_curr = s[0]\nss_max = ss_curr\n\nfor i in range(1, len(s)):\n if ss_curr[-1] <= s[i]:\n ss_curr += s[i]\n elif len(ss_curr) > len(ss_max):\n ss_max = ss_curr\n ss_curr = s[i]\n \nprint('Longest substring in alphabetical order is: ' + str(ss_max))\n\n\n\n\n\"\"\" Answers I liked\n\"\"\"\n\n\n\ns = 'azcbobobegghakl'\n\n# Exercise 1 and 2 - one liners\nprint(\"Number of vowels:\", sum(a in \"aeiou\" for a in s))\n\nprint(\"Number of times bob occurs is:\", sum('bob' == s[i:i+3] for i in range(len(s))))\n\n# Exercise 1-3 - recursive\n\ndef recur_sum(s):\n if not s:\n return 0\n else:\n return int(s[0] in 'aeiou') + recur_sum(s[1:])\n\nprint('Number of vowels:', recur_sum(s))\n\n\ndef recur_bob(s):\n if len(s) < 3:\n return 0\n else:\n return int(s[:3] == 'bob') + recur_bob(s[1:])\n\nprint('Number of times bob occurs is:', recur_bob(s))\n\n\n\ndef recur_lng(s, curr='', lngst=''):\n if not s:\n return curr if len(lngst) < len(curr) else lngst\n else:\n if not curr or s[0] >= curr[-1]:\n return recur_lng(s[1:], curr + s[0], lngst)\n else:\n if len(curr) > len(lngst):\n lngst = curr\n return recur_lng(s[1:], s[0], lngst)\n\nprint(\"Longest substring in alphabetical order is:\", recur_lng(s))" }, { "alpha_fraction": 0.5847299695014954, "alphanum_fraction": 0.590782105922699, "avg_line_length": 27.452054977416992, "blob_id": "c079d01c9fdced72939f8b229e97e887e1936262", "content_id": "0d0623c7f0001b587df4d4d52a54d2fa4e58d004", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2148, "license_type": "no_license", "max_line_length": 107, "num_lines": 73, "path": "/intro_cs/mit_6001x/week1/pset1_ethan.py", "repo_name": "bmunns/ossu", "src_encoding": "UTF-8", "text": "# Problem 1\r\n# Assume s is a string of lower case characters.\r\n# Write a program that counts up the number of vowels contained in the string s. \r\n# Valid vowels are: 'a', 'e', 'i', 'o', and 'u'. \r\n# For example, if s = 'azcbobobegghakl', your program should print:\r\n# Number of vowels: 5\r\n\r\ns = 'azcbobobegghakl'\r\n\r\nvowels = ['a', 'e', 'i', 'o', 'u']\r\nvowel_count = 0\r\n\r\nfor char in s:\r\n if char in vowels:\r\n vowel_count = vowel_count + 1\r\n\r\nprint('Number of vowels: ' + str(vowel_count))\r\n\r\n\r\n# Problem 2\r\n# Assume s is a string of lower case characters.\r\n# Write a program that prints the number of times the string 'bob' occurs in s. \r\n# For example, if s = 'azcbobobegghakl', then your program should print\r\n# Number of times bob occurs is: 2\r\n\r\ns = 'azcbobooboegbobghaklbobob'\r\n\r\ntimes = 0\r\n\r\nfor i in range(len(s)):\r\n try:\r\n if s[i] == 'b':\r\n if s[i+1] == 'o':\r\n if s[i+2] == 'b':\r\n times = times + 1\r\n except(IndexError):\r\n # end of s met\r\n continue\r\n\r\nprint(\"Number of times bob occurs is: \" + str(times))\r\n\r\n\r\n# Problem 3\r\n# Assume s is a string of lower case characters.\r\n# Write a program that prints the longest substring of s in which the letters occur in alphabetical order. \r\n# For example, if s = 'azcbobobegghakl', then your program should print\r\n# Longest substring in alphabetical order is: beggh\r\n# In the case of ties, print the first substring. \r\n# For example, if s = 'abcbcd', then your program should print\r\n# Longest substring in alphabetical order is: abc\r\n\r\ns = 'wenjcxnuihwmciqjwsyducabcde'\r\n\r\ntemp = ''\r\nsubstring = ''\r\n\r\nfor i in range(len(s)):\r\n try:\r\n temp = temp + s[i]\r\n if s[i] <= s[i + 1]:\r\n if len(temp) > len(substring):\r\n substring = temp\r\n else:\r\n if s[i] >= s[i-1] and len(temp) > len(substring):\r\n substring = temp\r\n temp = ''\r\n except(IndexError):\r\n # end of s met\r\n if len(temp) > len(substring):\r\n substring = temp\r\n continue\r\n\r\nprint(\"Longest substring in alphabetical order is: \" + substring)" }, { "alpha_fraction": 0.5051282048225403, "alphanum_fraction": 0.5170940160751343, "avg_line_length": 27.560976028442383, "blob_id": "a278d3506b4b7de510f605d1a30b625703e192dd", "content_id": "c955b7aa7f48bd4d603bd61f895938985f6bd86e", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1170, "license_type": "no_license", "max_line_length": 89, "num_lines": 41, "path": "/intro_cs/mit_6001x/week1/pset1_Ajay.py", "repo_name": "bmunns/ossu", "src_encoding": "UTF-8", "text": "# Week 1 - Problem 1\n\ns = input('Enter input: ')\nvowel_counter = s.count('a') + s.count('e') + s.count('i') + s.count('o') + s.count('u')\n\nprint('Number of vowels: ' + str(vowel_counter))\n\n#----------------------------------------------------------------------------------------\n#Week 1 - Problem 2\n\ns = input ('Enter input: ' )\nbob_counter = 0\nfor index in range(len(s) - 2):\n if 'bob' in s[index:index+3]:\n bob_counter+=1\nprint('Number of times bob occurs is: ' + str(bob_counter))\n\n#----------------------------------------------------------------------------------------\n# Week 1 - Problem 3\n\ns = input('Enter input: ' )\nsubstring_output = ''\nmulti_substring = []\n\nfor index in range(len(s)-1):\n if s[index] > s[index + 1]:\n substring_output += s[index]\n multi_substring.append(substring_output)\n substring_output = ''\n next\n else:\n substring_output += s[index]\n\nmax = multi_substring[0]\n \nif len(multi_substring) > 1:\n for index in range(len(multi_substring)):\n if len(max) < len(multi_substring[index]):\n max = multi_substring[index]\n\nprint('Longest substring in alphabetical order is:' + str(max))" } ]
7
JoaoBueno/estudos-python
https://github.com/JoaoBueno/estudos-python
653afb174f2d141fcc82511c51cbfd2bca1b55cb
606e188e88ee3a2b2e1daee60c71948c678228e1
a9305f461b2c03e4a55fec9f1ecc75f78265eb8e
refs/heads/master
2022-01-24T20:17:52.702768
2022-01-19T20:39:20
2022-01-19T20:39:20
150,925,137
2
2
null
2018-09-30T03:09:08
2022-01-19T20:26:28
2022-01-19T20:40:45
Python
[ { "alpha_fraction": 0.5748135447502136, "alphanum_fraction": 0.5834833383560181, "avg_line_length": 40.24393844604492, "blob_id": "712c46267237a4980e7969021ca12cd5a603d3ab", "content_id": "5055470a206dfcfa7d4e9676731551153b701f22", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 27321, "license_type": "no_license", "max_line_length": 176, "num_lines": 660, "path": "/djangosige/venv/Lib/site-packages/pysignfe/nf_e.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n\nfrom .nota import NotaFiscal\nfrom pysignfe.corr_unicode import *\n\nfrom pysignfe.nfe import ProcessadorNFe, DANFE\nfrom pysignfe.nfe.manual_401 import *\n#from pysignfe.nfe.manual_500 import *\nfrom pysignfe.nfe.manual_600 import *\n\nfrom os.path import abspath, dirname\nfrom OpenSSL import crypto\nimport io\nfrom xml.dom import minidom\nfrom datetime import datetime\n\nfrom pysignfe.nfe.danfe.danferetrato import *\nfrom pysignfe.nfe.webservices_2 import ESTADO_WS, SVAN, SVRS, UFRS, NFE_AMBIENTE_PRODUCAO\nfrom pysignfe.nfe.webservices_3 import ESTADO_WS as ESTADO_WS3\nfrom pysignfe.nfe.webservices_3 import ESTADO_SVC_CONTINGENCIA\nfrom pysignfe.nfe.webservices_3 import SVAN as SVAN3\nfrom pysignfe.nfe.webservices_3 import AN\nfrom pysignfe.nfe.webservices_3 import SVRS as SVRS3\nfrom pysignfe.nfe.webservices_3 import UFRS as UFRS3\nfrom pysignfe.nfe.webservices_flags import WS_NFE_CONSULTA_CADASTRO, WS_NFE_EVENTO, UF_CODIGO\n\nFILE_DIR = abspath(dirname(__file__))\n\n\nclass nf_e(NotaFiscal):\n\n def consultar_servidor(self, cert, key, versao=u'3.10', ambiente=2, estado=u'MG',\n contingencia=False, salvar_arquivos=True, caminho=u''):\n \"\"\"\n Este método verifica se o servidor está em operação\n @param cert: string do certificado digital A1,\n @param key: chave privada do certificado digital,\n @param versao: versão da nfe,\n @param ambiente: ambiente da consulta, pode ser 1 para o ambiente de produção e 2 para homologação,\n @param estado: estado em que realizará a consulta do servidor,\n @param contingencia : habilita a contigência.\n @param salvar_arquivos: salvar ou nao os arquivos XML gerados.\n @return: Dicionário com o status,envio,resposta e reason.\n \"\"\"\n p = ProcessadorNFe()\n p.ambiente = ambiente\n p.estado = estado\n p.versao = versao\n p.certificado.cert_str = cert\n p.certificado.key_str = key\n p.salvar_arquivos = salvar_arquivos\n p.contingencia = contingencia\n p.caminho = caminho\n \n processo = p.consultar_servico()\n processo.envio.xml\n processo.resposta.xml\n processo.resposta.reason\n\n return processo\n \n def gerar_xml(self, xml_nfe, cert, key, versao=u'3.10', consumidor=False, ambiente=2, estado=u'MG', salvar_arquivos=True, numero_lote=None, caminho=u''):\n p = ProcessadorNFe()\n p.ambiente = ambiente\n p.estado = estado\n p.versao = versao\n p.certificado.cert_str = cert\n p.certificado.key_str = key\n p.salvar_arquivos = salvar_arquivos\n p.caminho = caminho\n \n if numero_lote is None:\n numero_lote = datetime.now().strftime('%Y%m%d%H%M%S')\n \n if versao == '3.10':\n n = NFe_310()\n else:\n n = NFe_200()\n n.infNFe.xml = xml_nfe\n \n n.auto_preencher_campos(ambiente=ambiente, estado=estado)\n \n if consumidor:\n n.preencher_campos_nfce()\n else:\n n.preencher_campos_nfe()\n \n processo = p.gerar_xml([n], numero_lote=numero_lote)\n\n return processo\n \n def processar_nota(self, xml_nfe, cert, key, versao=u'3.10', consumidor=False, ambiente=2, estado=u'MG',\n contingencia=False, salvar_arquivos=True, n_consultas_recibo=2, consultar_servico=True, numero_lote=None, caminho=u''):\n \"\"\"\n Este método realiza o processamento de validação, assinatura e transmissão da nfe.\n @param xml_nfe: xml da nfe (string)\n @param consultar_servico: consulta o status do webservice antes de enviar\n @param consumidor: True caso NFC-e\n @param n_consultas_recibo: numero de tentativas de consultar o recibo\n @return: Dicionário com a chave_nfe, protocolo, envio, numero_lote, resposta, status_resposta,status_motivo e reason.\n \"\"\"\n p = ProcessadorNFe()\n p.ambiente = ambiente\n p.estado = estado\n p.versao = versao\n p.certificado.cert_str = cert\n p.certificado.key_str = key\n p.salvar_arquivos = salvar_arquivos\n p.contingencia = contingencia\n p.caminho = caminho\n p.numero_tentativas_consulta_recibo = n_consultas_recibo\n p.verificar_status_servico = consultar_servico\n \n if numero_lote is None:\n numero_lote = datetime.now().strftime('%Y%m%d%H%M%S')\n \n if versao == '3.10':\n n = NFe_310()\n else:\n n = NFe_200()\n n.infNFe.xml = xml_nfe\n \n n.auto_preencher_campos(ambiente=ambiente, estado=estado, contingencia=contingencia, consumidor=consumidor)\n \n if consumidor:\n n.preencher_campos_nfce()\n else:\n n.preencher_campos_nfe()\n \n for processo in p.processar_notas([n], numero_lote=numero_lote):\n processo.envio.xml\n processo.resposta.xml\n processo.resposta.reason\n \n processos = {}\n processos['numero_lote'] = numero_lote\n processos['lote'] = processo\n processos['notas'] = []\n \n for nome, proc in p.processos.items():\n processos['notas'].append(proc)\n \n return processos\n \n def processar_lote(self, lista_xml_nfe, cert, key, versao=u'3.10', consumidor=False, ambiente=2, estado=u'MG',\n contingencia=False, salvar_arquivos=True, n_consultas_recibo=2, consultar_servico=True, numero_lote=None, caminho=u''):\n \"\"\"\n Este método realiza o processamento de validação, assinatura e transmissão da nfe.\n @param lista_xml_nfe:lista nfe(strings ou objetos NFe)\n @param consumidor: True caso NFC-e\n @param consultar_servico: consulta o status do webservice antes de enviar\n @param n_consultas_recibo: numero de tentativas de consultar o recibo\n @return: Dicionário com o envio,resposta e reason.\n \"\"\"\n p = ProcessadorNFe()\n p.ambiente = ambiente\n p.estado = estado\n p.versao=versao\n p.contingencia = contingencia\n p.certificado.cert_str = cert\n p.certificado.key_str = key\n p.salvar_arquivos = salvar_arquivos\n p.caminho = caminho\n p.numero_tentativas_consulta_recibo = n_consultas_recibo\n p.verificar_status_servico = consultar_servico\n \n if numero_lote is None:\n numero_lote = datetime.now().strftime('%Y%m%d%H%M%S')\n \n if isinstance(lista_xml_nfe[0], basestring) and lista_xml_nfe:\n lista_nfe = []\n for x in lista_xml_nfe:\n if versao == '3.10':\n n = NFe_310()\n else:\n n = NFe_200()\n n.infNFe.xml = x\n \n n.auto_preencher_campos(ambiente=ambiente, estado=estado, contingencia=contingencia, consumidor=consumidor)\n \n if consumidor:\n n.preencher_campos_nfce()\n else:\n n.preencher_campos_nfe()\n \n lista_nfe.append(n)\n else:\n lista_nfe = lista_xml_nfe\n \n for processo in p.processar_notas(lista_nfe, numero_lote=numero_lote):\n processo.envio.xml\n processo.resposta.xml\n processo.resposta.reason\n \n processos = {}\n processos['numero_lote'] = numero_lote\n processos['lote'] = processo\n processos['notas'] = []\n \n for nome, proc in p.processos.items():\n processos['notas'].append(proc)\n\n return processos\n \n def consultar_recibo(self, numero_recibo, cert, key, versao=u'2.00', ambiente=2, estado=u'MG',\n salvar_arquivos=True, n_tentativas=2, caminho=u''):\n \n \"\"\"\n Este método retorna o resultado do processamento do lote enviado.\n @param numero_recibo: numero do recibo do lote enviado.\n @param n_tentativas: numero de tentativas de envio.\n @return: Dicionário com o envio,resposta e reason.\n \"\"\"\n p = ProcessadorNFe()\n p.ambiente = ambiente\n p.estado = estado\n p.versao=versao\n p.certificado.cert_str = cert\n p.certificado.key_str = key\n p.salvar_arquivos = salvar_arquivos\n p.caminho = caminho\n \n tentativa = 0\n processo = p.consultar_recibo(ambiente=ambiente, numero_recibo=numero_recibo)\n \n while processo.resposta.cStat.valor == '105' and tentativa < n_tentativas:\n processo = p.consultar_recibo(ambiente=ambiente, numero_recibo=numero_recibo)\n tentativa += 1\n \n #return {'envio': processo.envio.xml, 'resposta': processo.resposta.xml,\n # 'reason': processo.resposta.reason}\n \n return processo\n\n\n def cancelar_nota(self, chave, protocolo, justificativa, cert, key, data=None, versao=u'3.10',\n ambiente=2, estado=u'MG', contingencia=False, salvar_arquivos=True, numero_lote=None, caminho=u''):\n \"\"\"\n Realiza o cancelamento da nfe.\n @param chave:chave da nfe\n @param protocolo: protocolo do processamento da nfe\n @param justificativa: justificativa do cancelamento \n @param numero_lote: usuario pode definir o numero do lote, caso contrario sera a ANO+MES+DIA+HORA+MIN+SEG\n @return: Dicionário com o envio,resposta e reason.\n \"\"\"\n p = ProcessadorNFe()\n p.versao = versao\n p.estado = estado\n p.ambiente = ambiente\n p.contingencia = contingencia\n p.caminho = caminho\n p.certificado.cert_str = cert\n p.certificado.key_str = key\n p.salvar_arquivos = salvar_arquivos\n \n processo = p.cancelar_nota(chave_nfe=chave, numero_protocolo=protocolo,\n justificativa=justificativa, data=data, numero_lote=numero_lote)\n processo.resposta.reason\n \n return processo\n \n def emitir_carta_correcao(self, chave, texto_correcao, cert, key, sequencia=None, data=None, numero_lote=None,\n versao=u'3.10', ambiente=2, estado=u'MG', contingencia=False,\n salvar_arquivos=True, caminho=u''):\n \"\"\"\n @param chave:chave da nfe\n @param texto_correcao: correção a ser considerada, texto livre\n @return: Dicionário com o envio,resposta e reason.\n \"\"\"\n p = ProcessadorNFe()\n p.versao = versao\n p.estado = estado\n p.ambiente = ambiente\n p.caminho = caminho\n p.certificado.cert_str = cert\n p.certificado.key_str = key\n p.salvar_arquivos = salvar_arquivos\n p.contingencia = contingencia\n \n processo = p.corrigir_nota(chave_nfe=chave, texto_correcao=texto_correcao,\n ambiente=ambiente,sequencia=sequencia, data=data, numero_lote=numero_lote)\n processo.resposta.reason\n\n return processo\n \n def efetuar_manifesto(self, cnpj, tipo_manifesto, chave, cert, key, ambiente_nacional=True, versao=u'3.10', ambiente=2,\n estado=u'MG', contingencia=False, justificativa=None, salvar_arquivos=True, caminho=u''):\n \"\"\"\n Realiza o manifesto do destinatário\n @param tipo_manifesto: Confirmação da Operação, Desconhecimento da Operação, Operação Não Realizada ou Ciência da Emissão\n @param ambiente_nacional: usa o webservice do ambiente nacional (Recomendado manter True)\n @param justificativa: justificativa porque a operação não foi realizada, este campo deve ser informado somente no evento de Operação não Realizada.\n \"\"\"\n p = ProcessadorNFe()\n p.versao = versao\n p.estado = estado\n p.caminho = caminho\n\n if ambiente_nacional:\n if versao == '3.10':\n ESTADO_WS3[estado] = SVAN3\n else:\n ESTADO_WS[estado] = SVAN\n \n p.ambiente = ambiente\n p.certificado.cert_str = cert\n p.certificado.key_str = key\n p.contingencia = contingencia\n p.salvar_arquivos = salvar_arquivos\n \n processo = p.efetuar_manifesto_destinatario(cnpj=cnpj, tipo_manifesto=tipo_manifesto, chave_nfe=chave, justificativa=justificativa, ambiente_nacional=ambiente_nacional)\n\n return processo\n \n def enviar_lote_evento(self, lista_eventos, tipo, cert, key, versao=u'3.10',\n ambiente=2, estado=u'MG', contingencia=False, numero_lote=None, salvar_arquivos=True,\n ambiente_nacional=False, caminho=u''):\n \"\"\"\n Envia um lote de eventos (cancelamento, correcao, manifestacao ou epec)\n @param lista_eventos: lista com eventos (todos os eventos devem ser do mesmo tipo)\n \"\"\"\n p = ProcessadorNFe()\n p.versao = versao\n p.estado = estado\n p.caminho = caminho\n p.ambiente = ambiente\n p.contingencia = contingencia\n p.certificado.cert_str = cert\n p.certificado.key_str = key\n p.salvar_arquivos = salvar_arquivos\n \n for ev in lista_eventos:\n ev.infEvento.tpAmb.valor = ambiente\n if ambiente_nacional:\n ev.infEvento.cOrgao.valor = UF_CODIGO['NACIONAL']\n else:\n ev.infEvento.cOrgao.valor = UF_CODIGO[estado]\n \n ev.infEvento.CNPJ.valor = ev.infEvento.CNPJ.valor or ev.infEvento.chNFe.valor[6:20] # Extrai o CNPJ da própria chave da NF-e\n ev.infEvento.dhEvento.valor = ev.infEvento.dhEvento.valor or datetime.now()\n \n processo = p.enviar_lote_evento(tipo_evento=tipo, lista_eventos=lista_eventos, numero_lote=numero_lote)\n \n return processo \n\n def inutilizar_nota(self, cnpj, serie, numero, justificativa, cert, key, nfce=False, versao=u'3.10',\n ambiente=2, estado=u'MG', contingencia=False, salvar_arquivos=True, caminho=u''):\n \"\"\"\n Realiza a inutilização do número de uma nota fiscal\n @param cnpj:cnpj do emitente\n @param serie: serie da nfe\n @param nfce: True se inutilizando numeração de NFC-e\n @param numero: número da nota que deseja inutilizar\n @param justificativa: justificativa da inutilização \n @return: Dicionário com o envio,resposta e reason.\n \"\"\"\n p = ProcessadorNFe()\n p.versao = versao\n p.estado = estado\n p.ambiente = ambiente\n p.certificado.cert_str = cert\n p.certificado.key_str = key\n p.salvar_arquivos = salvar_arquivos\n p.contingencia = contingencia\n p.caminho = caminho\n p.nfce = nfce\n \n processo = p.inutilizar_nota(cnpj=cnpj, serie=serie, numero_inicial=numero,\n justificativa=justificativa)\n processo.envio.xml\n processo.resposta.xml\n processo.resposta.reason\n \n return processo\n \n\n def inutilizar_faixa_numeracao(self, cnpj, serie, numero_inicial, numero_final, justificativa,\n cert, key, nfce=False, versao=u'2.00', ambiente=2, estado=u'MG',\n contingencia=False, salvar_arquivos=True, caminho=u''):\n \"\"\"\n Realiza a inutilização de faixa de numeração de nota fiscal\n @param cnpj:cnpj do emitente\n @param serie: série da nfe\n @param numero_inicial: faixa inicial da nota que deseja inutilizar\n @param numero_final: faixa final da nota que deseja inutilizar\n @param justificativa: justificativa da inutilização \n @param nfce: True se inutilizando numeração de NFC-e\n @return: Dicionário com o envio,resposta e reason.\n \"\"\"\n p = ProcessadorNFe()\n p.versao = versao\n p.estado = estado\n p.ambiente = ambiente\n p.certificado.cert_str = cert\n p.certificado.key_str = key\n p.salvar_arquivos = salvar_arquivos\n p.contingencia = contingencia\n p.caminho = caminho\n p.nfce = nfce\n \n processo = p.inutilizar_nota(cnpj=cnpj, serie=serie, numero_inicial=numero_inicial,\n numero_final=numero_final, justificativa=justificativa)\n processo.envio.xml\n processo.resposta.xml\n processo.resposta.reason\n \n return processo\n \n def gerar_danfe(self, proc_nfe, retcan_nfe=None, site_emitente=u'', logo=u'',\n nome_sistema=u'', leiaute_logo_vertical=False, versao='3.10', salvar_arquivo=False):\n \"\"\"\n Geração do DANFE\n @param nfe: string da NF-e processada ou objeto ProcNFe_310\n @param site_emitente: Endereço do site do emitente\n @param logo: O caminho para a imagem ou Instância da imagem.\n @param leiaute_logo_vertical: possibilita que a logomarca tenha a orientação vertical\n @return: String\n \"\"\"\n d = DANFE()\n if isinstance(proc_nfe, basestring):\n if versao == '3.10':\n proc = ProcNFe_310()\n else:\n proc = ProcNFe_200()\n \n proc.xml = proc_nfe\n \n else:\n proc = proc_nfe\n \n d.NFe = proc.NFe\n d.protNFe = proc.protNFe\n d.versao = versao\n d.salvar_arquivo = salvar_arquivo\n d.obs_impressao = u'DANFE gerado em %(now:%d/%m/%Y, %H:%M:%S)s'\n d.nome_sistema = nome_sistema\n d.site = site_emitente\n d.logo = logo\n d.leiaute_logo_vertical = leiaute_logo_vertical\n d.gerar_danfe()\n danfe_pdf = io.BytesIO()\n d.danfe.generate_by(PDFGenerator, filename=danfe_pdf)\n d.danfe = danfe_pdf.getvalue()\n danfe_pdf.close()\n \n return d.danfe\n \n def gerar_danfce(self, proc_nfce, csc='', imprime_produtos=True, imprime_id_consumidor=True, imprime_ender_consumidor=True, via_estabelecimento=False, \n cidtoken='000001', nversao='100', versao='3.10', salvar_arquivo=False):\n '''\n Gerar DANFCE\n @param nfce: string da NFC-e processada ou objeto ProcNFe_310\n @param csc: Codigo de Segurança do Contribuinte\n @param imprime_produtos: imprime os produtos e seus dados na DANFE\n @param imprime_id_consumidor: imprime dados do consumidor na DANFE\n @param imprime_ender_consumidor: imprime o endereço do consumidor na DANFE\n @param via_estabelecimento: via do estabelecimento ou do consumidor\n @param cidtoken: identificador do csc\n '''\n d = DANFE()\n if isinstance(proc_nfce, basestring):\n if versao == '3.10':\n proc = ProcNFe_310()\n else:\n raise ValueError(\"Geracao de DANFCE apenas valido com versao 3.10\")\n \n proc.xml = proc_nfce\n proc.NFe.infNFeSupl.csc = csc\n proc.NFe.infNFeSupl.cidtoken = cidtoken\n proc.NFe.infNFeSupl.nversao = nversao\n \n else:\n proc = proc_nfce\n \n if not proc.NFe.infNFeSupl.csc:\n raise ValueError(\"Informar Código de Segurança do Contribuinte (CSC)\")\n \n d.NFe = proc.NFe\n d.protNFe = proc.protNFe\n d.versao = versao\n d.salvar_arquivo = False\n d.imprime_produtos_nfce = imprime_produtos\n d.imprime_id_consumidor = imprime_id_consumidor\n d.imprime_ender_consumidor = imprime_ender_consumidor\n d.obs_impressao = u'DANFCE gerado em %(now:%d/%m/%Y, %H:%M:%S)s'\n d.gerar_danfce(via_estabelecimento=via_estabelecimento)\n danfe_pdf = io.BytesIO()\n d.danfe.generate_by(PDFGenerator, filename=danfe_pdf)\n d.danfe = danfe_pdf.getvalue()\n danfe_pdf.close()\n\n return d.danfe\n \n def validar_chave_nfe(self, chave, uf, data_emissao, cnpj, modelo, serie, numero_nf):\n \"\"\"\n Verifica consistência da chave de NF-e informada\n @param chave:Chave da NF-e\n @param uf:\n @param data_emissao:\n @param cnpj\n @param modelo\n @param serie\n @param numero_nf\n @return: Dicionário\n \"\"\"\n msg = ''\n res = {'valida': True, msg: ''}\n if len(chave) == 44:\n if chave[:2] != uf:\n msg += '* Estado informado inválido.\\n'\n data_emissao = data_emissao[2:4] + data_emissao[5:7]\n if chave[2:6] != data_emissao:\n msg += '* Data de emissão inválida. \\n'\n cnpj = cnpj.replace('.', '').replace('-', '').replace('/', '')\n if chave[6:20] != cnpj:\n msg += '* CNPJ do emitente inválido. \\n'\n if chave[20:22] != modelo:\n msg += '* Modelo da Nota Fiscal inválido.\\n'\n if chave[22:25] != ('%003d' % int(serie)):\n msg += '* Série da Nota Fiscal inválida.\\n'\n if chave[25:34] != '%009d' % int(numero_nf):\n msg += '* Número da Nota Fiscal inválido. \\n'\n nf = NFe_200()\n digito_verificador = nf._calcula_dv(chave[:43])\n if digito_verificador != int(chave[43:]):\n msg += '* Dígito verificador inválido. \\n'\n if msg:\n res['msg'] = 'Chave de acesso inválida: \\n' + msg\n res['valida'] = False\n else:\n res['msg'] = 'Chave inválida.'\n res['valida'] = False\n return res\n\n def consultar_nfe(self, chave, cert, key, versao=u'3.10', ambiente=2, estado=u'MG',\n contingencia=False, salvar_arquivos=True, caminho=u''):\n \"\"\"\n Consultar a situaçao da NF-e\n @param chave:chave da nfe\n @return: Dicionário com o envio,resposta e reason.\n \"\"\"\n p = ProcessadorNFe()\n p.versao = versao\n p.estado = estado\n p.caminho = caminho\n p.ambiente = ambiente\n p.certificado.cert_str = cert\n p.certificado.key_str = key\n p.contingencia=contingencia\n p.salvar_arquivos = salvar_arquivos\n processo = p.consultar_nota(chave_nfe=chave)\n \n return processo\n\n def consultar_cadastro(self, cert, key, cpf_cnpj=None, inscricao_estadual=None, versao=u'2.00',\n ambiente=2, estado=u'MG', contingencia=False, salvar_arquivos=True, caminho=u''):\n \"\"\"\n Consulta cadastro do contribuinte\n @param cpf_cnpj: CPF ou CNPJ do contribuinte\n @param inscricao_estadual: IE do contribuinte\n @return: Dicionário com o envio,resposta e reason.\n \"\"\"\n if cpf_cnpj is None and inscricao_estadual is None:\n raise ValueError(\"Deve-se informar o CNPJ ou CPF ou IE.\")\n \n p = ProcessadorNFe()\n p.versao = versao\n p.estado = estado\n p.caminho = caminho\n \n if estado in ('AC', 'AL', 'AP', 'DF', 'ES', 'PB', 'RJ', 'RN', 'RO', 'RR', 'SC',\n 'SE', 'TO'):\n #SVRS[NFE_AMBIENTE_PRODUCAO][u'servidor'] = u'svp-ws.sefazvirtual.rs.gov.br'\n if versao == '3.10':\n SVRS3[NFE_AMBIENTE_PRODUCAO][u'servidor'] = u'cad.svrs.rs.gov.br'\n else:\n SVRS[NFE_AMBIENTE_PRODUCAO][u'servidor'] = u'cad.svrs.rs.gov.br'\n if estado == 'RS':\n #UFRS[NFE_AMBIENTE_PRODUCAO][u'servidor'] = u'sef.sefaz.rs.gov.br'\n if versao == '3.10':\n UFRS3[NFE_AMBIENTE_PRODUCAO][u'servidor'] = u'cad.sefazrs.rs.gov.br'\n else:\n UFRS[NFE_AMBIENTE_PRODUCAO][u'servidor'] = u'cad.sefazrs.rs.gov.br'\n if estado == 'MA':\n if versao == '3.10':\n SVAN3[NFE_AMBIENTE_PRODUCAO][u'servidor'] = u'sistemas.sefaz.ma.gov.br'\n SVAN3[NFE_AMBIENTE_PRODUCAO][WS_NFE_CONSULTA_CADASTRO] = u'wscadastro/CadConsultaCadastro2'\n else:\n SVAN[NFE_AMBIENTE_PRODUCAO][u'servidor'] = u'sistemas.sefaz.ma.gov.br'\n SVAN[NFE_AMBIENTE_PRODUCAO][WS_NFE_CONSULTA_CADASTRO] = u'wscadastro/CadConsultaCadastro2'\n \n p.ambiente = ambiente\n p.certificado.cert_str = cert\n p.certificado.key_str = key\n p.contingencia = contingencia\n p.salvar_arquivos = salvar_arquivos\n \n processo = p.consultar_cadastro_contribuinte(cpf_cnpj=cpf_cnpj,\n inscricao_estadual=inscricao_estadual,\n ambiente=ambiente)\n \n return processo\n\n def consultar_nfe_destinatario(self, cnpj, indnfe, indemi, cert, key, nsu='0', versao=u'3.10',\n ambiente=2, estado=u'MG', contingencia=False, salvar_arquivos=True, caminho=u''):\n \"\"\"\n Realiza a consulta do manifesto do destinatário\n @return: Dicionário com o envio,resposta e reason.\n \"\"\"\n p = ProcessadorNFe()\n p.versao = versao\n p.estado = estado\n p.caminho = caminho\n #Provisoriamente apontado para um estado que usa o webservice de ambiente nacional, pois em MG ainda\n # não existe suporte ao Manifesto do Destinatário\n if versao == '3.10':\n ESTADO_WS3[estado] = AN\n else:\n ESTADO_WS[estado] = AN\n #ESTADO_WS[estado] = SVAN\n p.ambiente = ambiente\n p.certificado.cert_str = cert\n p.certificado.key_str = key\n p.contingencia = contingencia\n p.salvar_arquivos = salvar_arquivos\n processo = p.consultar_notas_destinatario(cnpj=cnpj, indnfe=indnfe, indemi=indemi, nsu=nsu)\n \n return processo\n \n\n def download_notas(self, cnpj, lista_chaves, cert, key, ambiente_nacional=True, versao=u'2.00', ambiente=2, estado=u'MG',\n contingencia=False, salvar_arquivos=True, caminho=u''):\n \"\"\"\n Realiza download de NFe para uma determinada chave de acesso, para NF-e confirmada pelo destinatario.\n @param lista_chaves: lista de até 10 chaves\n @return: Dicionário com o envio,resposta e reason.\n \"\"\"\n if len(lista_chaves)>10:\n raise ValueError(u'Maximo de 10 Chaves de Acesso por lote.')\n \n p = ProcessadorNFe()\n p.versao = versao\n p.estado = estado\n p.caminho = caminho\n if ambiente_nacional:\n if versao == '3.10':\n #ESTADO_WS3[estado] = SVAN3\n ESTADO_WS3[estado] = AN\n else:\n #ESTADO_WS[estado] = SVAN\n ESTADO_WS[estado] = AN\n p.ambiente = ambiente\n p.certificado.cert_str = cert\n p.certificado.key_str = key\n p.contingencia = contingencia\n p.salvar_arquivos = salvar_arquivos\n \n processo = p.download_nfes(cnpj, ambiente, lista_chaves=lista_chaves)\n \n return processo\n" }, { "alpha_fraction": 0.48427674174308777, "alphanum_fraction": 0.48846960067749023, "avg_line_length": 16.074073791503906, "blob_id": "9f7a653a80891ba577bb8586380f0fe9d04f1ac5", "content_id": "21caa9596e7da032a65d74cd45b868d23743eec3", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 477, "license_type": "no_license", "max_line_length": 34, "num_lines": 27, "path": "/PQt5-Stock/Modelo/rubro.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nclass Rubro(object):\n '''\n classdocs\n '''\n\n\n def __init__(self):\n '''\n Constructor\n '''\n self.__idRubro = 0\n self.__rubro = \"\"\n\n def setIdRubro(self, idRubro):\n self.__idRubro = idRubro\n\n def getIdRubro(self):\n return self.__idRubro\n\n def setRubro(self, rubro):\n self.__rubro = rubro\n\n def getRubro(self):\n return self.__rubro\n\n\n\n \n " }, { "alpha_fraction": 0.6124701499938965, "alphanum_fraction": 0.617143988609314, "avg_line_length": 41.61016845703125, "blob_id": "ca69ed0b14d885e60bdfdc4f1008f0fe78be723d", "content_id": "6274127a98d5d0526bd0019b08bb277453aa5979", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 10140, "license_type": "no_license", "max_line_length": 115, "num_lines": 236, "path": "/PyQT-CRUD-App/app/tablewidgets/employees.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/python3\n# -*- coding: utf-8 -*-\n\"\"\"\nВкладка работников\nGuia Funcionários\n\"\"\"\nfrom app.editdialogs import employee\nfrom app.db import data\nfrom functools import partial\nfrom sqlalchemy import exc\nfrom sqlalchemy.orm import joinedload\nfrom PyQt5 import *\nfrom PyQt5.QtWidgets import *\nfrom PyQt5.QtGui import *\nfrom PyQt5.QtCore import *\nfrom PyQt5.Qt import *\n\n\nclass EmployeeTable(QWidget):\n def __init__(self, session, parent):\n QWidget.__init__(self)\n self.session = session\n self.parent = parent\n QVBoxLayout(self)\n self.layout().addLayout(self.build_filters_layout())\n self.layout().addWidget(self.build_table())\n QApplication.setOverrideCursor(Qt.WaitCursor)\n self.set_filter_comboboxes()\n self.fill_table()\n QApplication.restoreOverrideCursor()\n\n def build_filters_layout(self):\n filters_layout = QHBoxLayout()\n\n personal_info_layout = QVBoxLayout()\n personal_info_labels_layout = QVBoxLayout()\n\n self.fio_filter = QLineEdit()\n self.fio_filter.setFixedWidth(230)\n self.fio_filter.setPlaceholderText('Nome')\n personal_info_labels_layout.addWidget(QLabel('<h4>Nome</h4>'))\n personal_info_layout.addWidget(self.fio_filter)\n\n self.login_filter = QLineEdit()\n self.login_filter.setFixedWidth(230)\n self.login_filter.setPlaceholderText('Login')\n personal_info_labels_layout.addWidget(QLabel('<h4>Login</h4>'))\n personal_info_layout.addWidget(self.login_filter)\n\n self.phone_filter = QLineEdit()\n self.phone_filter.setFixedWidth(100)\n self.phone_filter.setPlaceholderText('Número de telefone')\n personal_info_labels_layout.addWidget(QLabel('<h4>Número de telefone</h4>'))\n personal_info_layout.addWidget(self.phone_filter)\n\n filters_layout.addLayout(personal_info_labels_layout)\n filters_layout.addLayout(personal_info_layout)\n\n address_info_layout = QHBoxLayout()\n\n self.address_filter = QComboBox()\n address_info_layout.addWidget(self.address_filter)\n self.block_filter = QComboBox()\n address_info_layout.addWidget(self.block_filter)\n\n self.room_filter = QLineEdit()\n self.room_filter.setFixedWidth(50)\n self.room_filter.setPlaceholderText('Sala')\n address_info_layout.addWidget(self.room_filter)\n\n employee_info_layout = QVBoxLayout()\n\n self.position_filter = QComboBox()\n self.position_filter.setEditable(True)\n employee_info_layout.addWidget(self.position_filter)\n\n self.department_filter = QComboBox()\n self.department_filter.setEditable(True)\n employee_info_layout.addWidget(self.department_filter)\n employee_info_layout.addLayout(address_info_layout)\n\n employee_info_labels_layout = QVBoxLayout()\n employee_info_labels_layout.addWidget(QLabel('<h4>Posição</h4>'))\n employee_info_labels_layout.addWidget(QLabel('<h4>Departamento</h4>'))\n employee_info_labels_layout.addWidget(QLabel('<h4>Local de trabalho</h4>'))\n filters_layout.addLayout(employee_info_labels_layout)\n filters_layout.addLayout(employee_info_layout)\n\n find_button = QPushButton('Encontrar')\n find_button.setFixedSize(80, 80)\n find_button.clicked.connect(self.fill_table)\n filters_layout.addWidget(find_button)\n filters_layout.addStretch()\n\n return filters_layout\n\n def build_table(self):\n self.main_table = QTableWidget()\n self.main_table.setSortingEnabled(True)\n self.main_table.setSelectionMode(QAbstractItemView.SingleSelection)\n self.main_table.setEditTriggers(QAbstractItemView.NoEditTriggers)\n self.main_table.setTextElideMode(Qt.ElideNone)\n self.main_table.setAlternatingRowColors(True)\n self.main_table.setColumnCount(9)\n self.main_table.setHorizontalHeaderLabels(\n # ['ФИО', 'Логин', 'Должность', 'Отдел', 'Место работы', 'Телефон',\n # 'Email', 'Домен/Имя компьютера', '']\n ['Nome', 'Login', 'Posição', 'Departamento', 'Local de Trabalho', 'Telefone',\n 'Email', 'Domain / Computer name', '']\n )\n \n return self.main_table \n\n def set_filter_comboboxes(self):\n self.address_filter.clear()\n self.address_filter.addItem('Todos')\n self.address_filter.addItems(\n self.session.query(data.Address.name).values()\n )\n\n self.block_filter.clear()\n self.block_filter.addItem('Todos')\n self.block_filter.addItems(self.session.query(data.Block.name).distinct(data.Block.name).values())\n self.position_filter.clear()\n self.position_filter.addItem('')\n self.position_filter.addItems(\n row.name for row in self.session.query(data.Position) if row.name\n )\n\n self.department_filter.clear()\n self.department_filter.addItem('')\n self.department_filter.addItems(\n row.name for row in self.session.query(data.Department) if row.name\n )\n\n def fill_table(self):\n self.main_table.setRowCount(0)\n employees = self.session.query(data.Employee).\\\n join(data.Room).\\\n join(data.Block).\\\n join(data.Address).\\\n outerjoin(data.Phone).\\\n outerjoin(data.Department).\\\n outerjoin(data.Position).\\\n filter(data.Employee.fullname.ilike('%{}%'.format(self.fio_filter.text()))).\\\n filter(data.Employee.unique_login.ilike('%{}%'.format(self.login_filter.text())))\n\n if self.phone_filter.text():\n employees = employees.filter(\n data.Phone.number.like('%{}%'.format(self.phone_filter.text()))\n )\n if self.department_filter.currentText():\n employees = employees.filter(\n data.Department.name.ilike('%{}%'.format(self.department_filter.currentText()))\n )\n if self.position_filter.currentText():\n employees = employees.filter(\n data.Position.name.ilike('%{}%'.format(self.position_filter.currentText()))\n )\n if self.address_filter.currentText() != 'Todos':\n employees = employees.filter(\n data.Address.name == self.address_filter.currentText()\n )\n if self.block_filter.currentText() != 'Todos':\n employees = employees.filter(\n data.Block.name == self.block_filter.currentText()\n )\n if self.room_filter.text():\n employees = employees.filter(\n data.Room.name.like('%{}%'.format(self.room_filter.text()))\n )\n\n for row, employee in enumerate(employees):\n self.main_table.insertRow(row)\n self.main_table.setRowHeight(row, 50)\n self.main_table.setItem(row, 0, QTableWidgetItem(QIcon(r'pics\\employee.png'), employee.fullname))\n self.main_table.setItem(row, 1, QTableWidgetItem(employee.unique_login))\n self.main_table.setItem(row, 2, QTableWidgetItem(employee.position.name))\n self.main_table.setItem(row, 3, QTableWidgetItem(employee.department.name))\n self.main_table.setItem(row, 4, QTableWidgetItem(\n employee.room.block.address.name + ', ' + employee.room.block.name +'\\n' +employee.room.name\n ))\n self.main_table.setItem(row, 5, QTableWidgetItem(';\\n'.join(phone.number for phone in employee.phone)))\n self.main_table.setItem(row, 6, QTableWidgetItem(';\\n'.join(email.email for email in employee.email)))\n self.main_table.setItem(row, 7, QTableWidgetItem(QIcon(r'pics\\pc.png'), ';\\n'.join(\n pc.pcname.domain.name + '/' + pc.pcname.name for pc in employee.pc\n )))\n edit_button = QPushButton('Visualizar')\n edit_button.clicked.connect(\n partial(self.edit_employee, employee_query_obj=employee)\n )\n self.main_table.setCellWidget(row, 8, edit_button)\n self.main_table.resizeColumnsToContents()\n\n @QtCore.pyqtSlot(data.Employee)\n def edit_employee(self, employee_query_obj):\n try:\n edit_employee_window = employee.EmployeeInfo(self.session, employee_query_obj)\n if edit_employee_window.exec_() == QDialog.Accepted:\n QApplication.setOverrideCursor(Qt.WaitCursor)\n for room in self.session.query(data.Room). \\\n options(joinedload(data.Room.employee)). \\\n filter(data.Room.employee == None). \\\n all():\n self.session.delete(room)\n\n for position in self.session.query(data.Position). \\\n options(joinedload(data.Position.employee)). \\\n filter(data.Position.employee == None). \\\n all():\n self.session.delete(position)\n\n for department in self.session.query(data.Department). \\\n options(joinedload(data.Department.employee)). \\\n filter(data.Department.employee == None). \\\n all():\n self.session.delete(department)\n\n self.session.commit()\n self.set_filter_comboboxes()\n self.fill_table()\n self.parent.pcs_table.update_table_content()\n QApplication.restoreOverrideCursor()\n print(\"Zakommitili\")\n except exc.IntegrityError as errmsg:\n print(errmsg)\n self.session.rollback()\n msg = QMessageBox()\n msg.setIcon(QMessageBox.Critical)\n msg.setText(\"Erro crítico no banco de dados\")\n msg.setWindowTitle(\"Erro crítico\")\n msg.setDetailedText(errmsg)\n msg.setStandardButtons(QMessageBox.Ok)\n msg.buttonClicked.connect(sys.exit)\n else:\n print('Tudo com sucesso')\n" }, { "alpha_fraction": 0.5769745707511902, "alphanum_fraction": 0.6057563424110413, "avg_line_length": 35.36585235595703, "blob_id": "951f16d97915a97ce3dfad2d33b245ff705df0c4", "content_id": "a56a6ae9b213fd9c3e1d5fe10ed928c831657fe5", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1494, "license_type": "no_license", "max_line_length": 226, "num_lines": 41, "path": "/fullodbc/vendas-usuario.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import sys\nimport pyodbc\nimport pandas as pd\n\ncnxn = pyodbc.connect('DSN=p;UID=system')\ncursor = cnxn.cursor()\ndata = []\ncolumns = []\ncolumns.append('pedido')\ncolumns.append('vendedor')\ncolumns.append('data')\ncolumns.append('hora')\ncolumns.append('horai')\n# cursor.execute(\"select * from aivevecp where (vec_empresa = 51 or vec_empresa = 53 or vec_empresa = 56) and vec_repre = 538 and vec_serie <> 'TRF' and vec_status <> 'C' and vec_terminal = 8\")\n# cursor.execute(\"select * from aivevecp where (vec_empresa = 51 or vec_empresa = 53 or vec_empresa = 56) and vec_usuar <> 'balcao' and vec_usuar <> 'EDMILSON' and vec_repre <> 597 and vec_serie <> 'TRF' and vec_terminal = 8\")\ncursor.execute(\"\"\"select * from aivevecp\n where (vec_empresa = 51 or vec_empresa = 53 or vec_empresa = 56)\n and vec_usuar <> 'balcao' and vec_repre <> 597\n and vec_serie <> 'TRF' and vec_serie <> 'IMP'\n and vec_data > '20211000'\n and vec_terminal = 1\"\"\")\n# rows = cursor.fetchall()\n\ncol_headers = [ i[0] for i in cursor.description ]\nprint(col_headers)\n\nrows = [ list(i) for i in cursor.fetchall()] \ndf = pd.DataFrame(rows, columns=col_headers)\n\ndf.to_csv(\"test.csv\", index=False)\n\n# conta = 0\n# lidos = 0\n# arq = open('vds-usu.csv', 'w')\n# for row in cursor:\n# lidos+=1\n# print(row)\n# arq.write(row)\n# conta+=1\n\n# print('Lidos {}, invalidos {}'.format(lidos, conta))\n\n\n\n" }, { "alpha_fraction": 0.5925925970077515, "alphanum_fraction": 0.6481481194496155, "avg_line_length": 18.285715103149414, "blob_id": "c37fd195e28f559adc0b94e83d4c198f02274662", "content_id": "f8ec100f3462335ce30c331e52f443153b25ca0a", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 270, "license_type": "no_license", "max_line_length": 95, "num_lines": 14, "path": "/compras/test-api2.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n\nimport requests\nimport json\n\nheaders = {\n 'X-Cosmos-Token': 'MxLbve3fi-0SyS53f5UzAQ',\n 'Content-Type': 'application/json'\n}\n\nreq = requests.get('https://api.cosmos.bluesoft.com.br/gtins/7891000053508.json', headers)\nreq.encoding = 'UTF-8'\n\nprint(req)\n" }, { "alpha_fraction": 0.47238096594810486, "alphanum_fraction": 0.4990476071834564, "avg_line_length": 22.863636016845703, "blob_id": "da91d7dd7c05373d2b04655a539e808503408046", "content_id": "3a34368359afa1f9f4c2276a778469482daa1628", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 525, "license_type": "no_license", "max_line_length": 109, "num_lines": 22, "path": "/fullcontrol-menu/funcoes/isEmail.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import sys\nimport re\n\n\ndef isEmail(email):\n if len(email) > 7:\n if re.match(r'^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,4})$', email) != None:\n return True\n return False\n\n\nif __name__ == '__main__':\n if len(sys.argv) < 2:\n print(\"\"\"\nisEmail is an e-mail validator\nUse: isEmail example@example.com\n \"\"\")\n exit(-1)\n if isEmail(sys.argv[1]) == True:\n print('This is a valid e-mail address')\n else:\n print('This is not a valid e-mail address')\n" }, { "alpha_fraction": 0.6544190645217896, "alphanum_fraction": 0.6593843102455139, "avg_line_length": 27.742856979370117, "blob_id": "4ec695d196570346e15467816523d7df4484d87d", "content_id": "51a751c43f3c947d30ff8800d7b49ba1982e44ae", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1007, "license_type": "no_license", "max_line_length": 122, "num_lines": 35, "path": "/full - compara relatorios/cria_sql.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import os\nimport csv\nimport sqlite3\n\narqC = 'b-co.csv'\narqF = 'b-fi-v.csv'\n\n# arqC = (os.path.splitext(os.path.basename(arqC))[0])\n# arqF = (os.path.splitext(os.path.basename(arqF))[0])\n\ncon = sqlite3.connect('compara.db3')\ncur = con.cursor()\n\ncur.execute('DROP TABLE arqC;')\ncur.execute('CREATE TABLE arqC (numero integer PRIMARY KEY AUTOINCREMENT NOT NULL, valor float);')\n\nwith open(arqC, 'r') as fin:\n dr = csv.DictReader(fin, delimiter='|') \n to_db = [(i['NUMERO'], i['VALORLIQUIDO']) for i in dr]\n\ncur.executemany(\"INSERT INTO arqC (numero, valor) VALUES (?, ?);\", to_db)\ncon.commit()\n\n\ncur.execute('DROP TABLE arqF;')\ncur.execute('CREATE TABLE arqF (numero integer NOT NULL, item integer NOT NULL, valor float, PRIMARY KEY(numero, item));')\n\nwith open(arqF, 'r') as fin:\n dr = csv.DictReader(fin, delimiter='|') \n to_db = [(i['NUMERO'], i['PARCELA'], i['VALOR']) for i in dr]\n\ncur.executemany(\"INSERT INTO arqF (numero, item, valor) VALUES (?, ?, ?);\", to_db)\ncon. commit()\n\ncon.close()\n\n" }, { "alpha_fraction": 0.6528831720352173, "alphanum_fraction": 0.6576167941093445, "avg_line_length": 42.10792541503906, "blob_id": "2d08312d44be0e90698342b06e906e758b876221", "content_id": "a1a8f67a97b9c8ac671358a3ebf3d1f340c9086d", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 25566, "license_type": "no_license", "max_line_length": 126, "num_lines": 593, "path": "/PQt5-Stock/Controlador/pProveedor.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom Modelo.proveedor import Proveedor\nfrom Modelo.persona import Persona\nfrom Conexion.conexionProveedor import conexionProveedor\nfrom PyQt5.QtWidgets import QAbstractItemView, QTableView\nfrom Componentes.tableModel import MyTableModel\nfrom Modelo.direccion import Direccion\nfrom Conexion.conexionTelefono import conexionTelefono\nfrom Modelo.telefono import Telefono\nfrom PyQt5.QtWidgets import QMessageBox, QDialog\nfrom PyQt5 import QtCore, QtGui\n\nclass PestaniaProveedor():\n\n def __init__(self, winPrincipal):\n self.proveedor = Proveedor()\n self.winPrincipal = winPrincipal\n self.conexionProveedor = conexionProveedor()\n self.conexionTelefono = conexionTelefono()\n self.estado = \"\"\n self.direccion = Direccion()\n\n\n self.configInit()\n\n\n def configInit(self):\n \"\"\"\n Configuracion inicial de la pestaña probeedor, setea todas las señales de los botones y carga la tabla\n @return: void\n \"\"\"\n #Configurando botones Generales\n self.winPrincipal.btnGuardar_prov.clicked.connect(self.onClickGuardar)\n self.winPrincipal.btnAgregar_prov.clicked.connect(self.onClickAgregar)\n self.winPrincipal.btnModificar_prov.clicked.connect(self.onClickModificar)\n self.winPrincipal.btnBorrar_prov.clicked.connect(self.onClickBorrar)\n\n #Configurando botones ABM telefono\n self.winPrincipal.btnSumarTelefono_prov.clicked.connect(self.onClickSumarTelefono)\n self.winPrincipal.btnRestarTelefono_prov.clicked.connect(self.onClickRestarTelefono)\n self.winPrincipal.btnCancelarTelefono_prov.clicked.connect(self.onClickCancelarTelefono)\n self.winPrincipal.btnCancelarTelefono_prov.setVisible(False)\n self.winPrincipal.btnRestarTelefono_prov.setEnabled(False)\n\n #configurando botones tipo telefono\n self.winPrincipal.btnTelefono_prov.clicked.connect(self.onClickTelefono)\n self.winPrincipal.btnCelular_prov.clicked.connect(self.onClickCelular)\n self.winPrincipal.btnFax_prov.clicked.connect(self.onClickFax)\n\n self.winPrincipal.txtFilterProveedores_prov.returnPressed.connect(self.search)\n\n #Seteando model y propieades de la tabla\n self.winPrincipal.tvProveedores_prov.setSortingEnabled(True)\n self.winPrincipal.tvProveedores_prov.setMouseTracking(True)\n self.winPrincipal.tvProveedores_prov.setSelectionBehavior(QAbstractItemView.SelectRows)\n\n #Seteando proiedades de la tabla telefono\n self.winPrincipal.tvTelefonos_prov.setSortingEnabled(True)\n self.winPrincipal.tvTelefonos_prov.setMouseTracking(True)\n self.winPrincipal.tvTelefonos_prov.setSelectionBehavior(QAbstractItemView.SelectRows)\n\n self.winPrincipal.txtFilterProveedores_prov.setFocus(True)\n\n\n def finish(self):\n self.winPrincipal.btnAgregar_prov.disconnect()\n self.winPrincipal.btnBorrar_prov.disconnect()\n self.winPrincipal.btnModificar_prov.disconnect()\n self.winPrincipal.btnGuardar_prov.disconnect()\n\n self.winPrincipal.btnCancelarTelefono_prov.disconnect()\n self.winPrincipal.btnSumarTelefono_prov.disconnect()\n self.winPrincipal.btnRestarTelefono_prov.disconnect()\n\n self.winPrincipal.btnCelular_prov.disconnect()\n self.winPrincipal.btnFax_prov.disconnect()\n self.winPrincipal.btnTelefono_prov.disconnect()\n\n self.winPrincipal.tvTelefonos_prov.disconnect()\n self.winPrincipal.tvProveedores_prov.disconnect()\n\n def search(self):\n if self.winPrincipal.txtFilterProveedores_prov.hasFocus() is True:\n self.cargarTabla()\n\n def onClickAgregar(self):\n self.estado = 'AGREGAR'\n self.validarBotones(button='AGREGAR')\n\n\n def onClickGuardar(self):\n validar = self.validar()\n\n if validar != \"\":\n print(validar)\n alert = QDialog()\n QMessageBox.information(alert,\"ERROR\", validar)\n else:\n self.proveedor.setDescripcion(str(self.winPrincipal.txtDescripcion_prov.text()))\n self.proveedor.setWeb(str(self.winPrincipal.txtWeb_prov.text()))\n self.proveedor.setEmail(str(self.winPrincipal.txtEmail_prov.text()))\n self.proveedor.setNombre(str(self.winPrincipal.txtNombre_prov.text()))\n self.direccion.setDireccion(str(self.winPrincipal.txtDireccion_prov.text()))\n if self.winPrincipal.txtDDpto_prov.text() != \"\":\n self.direccion.setDpto(str(self.winPrincipal.txtDDpto_prov.text()))\n else:\n self.direccion.setDpto(\"\")\n if self.winPrincipal.txtDNumero_prov.text() != \"\":\n self.direccion.setNumero(int(self.winPrincipal.txtDNumero_prov.text()))\n else:\n self.direccion.setNumero(0)\n if self.winPrincipal.txtDPiso_prov.text() != \"\":\n self.direccion.setPiso(int(self.winPrincipal.txtDPiso_prov.text()))\n else:\n self.direccion.setPiso(0)\n\n self.proveedor.setDireccion(self.direccion)\n\n if self.winPrincipal.cbEstado_prov.currentText() == 'ACTIVO':\n self.proveedor.setEstado(1)\n else:\n self.proveedor.setEstado(0)\n\n self.validarBotones(button='GUARDAR')\n\n if self.estado == 'AGREGAR':\n self.insertProveedor()\n self.insertTelefono()\n elif self.estado == 'MODIFICAR':\n self.modificarProveedor()\n self.updateTelefono()\n\n\n def onClickModificar(self):\n self.estado = 'MODIFICAR'\n self.validarBotones(button='MODIFICAR')\n\n\n def onClickBorrar(self):\n\n if self.winPrincipal.btnGuardar_prov.isEnabled() != True:\n self.conexionProveedor.borrarProveedor(self.proveedor)\n self.cargarTabla()\n\n self.validarBotones(button='BORRAR')\n\n\n def cargarTabla(self):\n parameter = self.winPrincipal.txtFilterProveedores_prov.text()\n typeParameter = ''\n\n if self.winPrincipal.cbFilterProveedores_prov.currentText() == 'Descripcion':\n typeParameter = 'prov.descripcion'\n else:\n typeParameter = 'p.nombre'\n\n parameterState = 1\n if self.winPrincipal.cbInactivo_prov.isChecked() is True:\n parameterState = 0\n\n listProveedores = self.conexionProveedor.selectProveedor(typeParameter, parameter, parameterState)\n\n if len(listProveedores) > 0:\n header = ['ID', 'Descripcion', 'Nombre', 'Email', 'Web', 'Direccion', 'N°', 'P', 'D', 'idper', 'iddir', 'Estado' ]\n tableModel = MyTableModel(self.winPrincipal.tvProveedores_prov, listProveedores, header)\n self.winPrincipal.tvProveedores_prov.setModel(tableModel)\n self.winPrincipal.tvProveedores_prov.selectionModel().currentChanged.connect(self.changeSelectedTable)\n\n self.winPrincipal.tvProveedores_prov.setColumnHidden(0, True)\n self.winPrincipal.tvProveedores_prov.setColumnWidth(1, 190)\n\n self.winPrincipal.tvProveedores_prov.setColumnWidth(2, 190)\n self.winPrincipal.tvProveedores_prov.setColumnWidth(3, 263)\n self.winPrincipal.tvProveedores_prov.setColumnWidth(4, 240)\n\n\n self.winPrincipal.tvProveedores_prov.setColumnWidth(5, 200)\n self.winPrincipal.tvProveedores_prov.setColumnWidth(6, 50)\n self.winPrincipal.tvProveedores_prov.setColumnHidden(7, True)\n self.winPrincipal.tvProveedores_prov.setColumnHidden(8, True)\n self.winPrincipal.tvProveedores_prov.setColumnHidden(9, True)\n self.winPrincipal.tvProveedores_prov.setColumnHidden(10, True)\n self.winPrincipal.tvProveedores_prov.setColumnHidden(11, True)\n else:\n self.winPrincipal.tvProveedores_prov.setModel(None)\n\n\n def changeSelectedTable(self, selected, deselected):\n proveedorList = selected.model().mylist\n proveedorSelected = proveedorList[selected.row()]\n self.proveedor = Proveedor()\n self.direccion = Direccion()\n self.proveedor.setIdProveedor(int(proveedorSelected[0]))\n self.proveedor.setDescripcion(str(proveedorSelected[1]))\n self.proveedor.setNombre(str(proveedorSelected[2]))\n self.proveedor.setEmail(str(proveedorSelected[3]))\n self.proveedor.setWeb(str(proveedorSelected[4]))\n\n self.direccion.setDireccion(str(proveedorSelected[5]))\n if proveedorSelected[6] != None:\n self.direccion.setNumero(int(proveedorSelected[6]))\n\n if proveedorSelected[7] != None:\n self.direccion.setPiso(int(proveedorSelected[7]))\n\n if proveedorSelected[8] != None:\n self.direccion.setDpto(proveedorSelected[8])\n\n self.direccion.setIdDireccion(int(proveedorSelected[10]))\n self.proveedor.setDireccion(self.direccion)\n\n self.proveedor.setIdPersona(int(proveedorSelected[9]))\n\n self.proveedor.setEstado(int(proveedorSelected[11]))\n\n self.winPrincipal.tvProveedores_prov.setRowHeight(deselected.row(), 28)\n self.winPrincipal.tvProveedores_prov.setRowHeight(selected.row(), 45)\n\n self.setCampos()\n self.winPrincipal.btnModificar_prov.setEnabled(True)\n self.winPrincipal.btnBorrar_prov.setEnabled(True)\n self.winPrincipal.tvTelefonos_prov.setModel(None)\n self.cargarTablaTelefono()\n\n\n def validarBotones(self, button):\n\n if button == 'AGREGAR':\n self.winPrincipal.btnAgregar_prov.setEnabled(False)\n self.winPrincipal.btnModificar_prov.setEnabled(False)\n self.winPrincipal.btnGuardar_prov.setEnabled(True)\n self.winPrincipal.btnBorrar_prov.setEnabled(True)\n self.winPrincipal.tvProveedores_prov.setEnabled(False)\n self.winPrincipal.wDatosProveedor.setEnabled(True)\n self.winPrincipal.btnBorrar_prov.setText('CANCELAR')\n self.limpiarCampos()\n elif button == 'GUARDAR':\n self.winPrincipal.btnAgregar_prov.setEnabled(True)\n self.winPrincipal.btnModificar_prov.setEnabled(False)\n self.winPrincipal.btnGuardar_prov.setEnabled(False)\n self.winPrincipal.btnBorrar_prov.setEnabled(False)\n self.winPrincipal.tvProveedores_prov.setEnabled(True)\n self.winPrincipal.wDatosProveedor.setEnabled(False)\n self.winPrincipal.btnBorrar_prov.setText('BORRAR')\n self.limpiarCampos()\n elif button == 'MODIFICAR':\n self.winPrincipal.btnAgregar_prov.setEnabled(False)\n self.winPrincipal.btnModificar_prov.setEnabled(False)\n self.winPrincipal.btnGuardar_prov.setEnabled(True)\n self.winPrincipal.btnBorrar_prov.setEnabled(True)\n self.winPrincipal.tvProveedores_prov.setEnabled(False)\n self.winPrincipal.wDatosProveedor.setEnabled(True)\n self.winPrincipal.btnBorrar_prov.setText('CANCELAR')\n elif button == 'BORRAR':\n self.winPrincipal.btnAgregar_prov.setEnabled(True)\n self.winPrincipal.btnModificar_prov.setEnabled(False)\n self.winPrincipal.btnGuardar_prov.setEnabled(False)\n self.winPrincipal.btnBorrar_prov.setEnabled(False)\n self.winPrincipal.tvProveedores_prov.setEnabled(True)\n self.winPrincipal.wDatosProveedor.setEnabled(False)\n self.winPrincipal.btnBorrar_prov.setText('BORRAR')\n self.limpiarCampos()\n\n\n def insertProveedor(self):\n self.conexionProveedor.insertarProveedor(proveedor=self.proveedor)\n self.cargarTabla()\n\n\n def modificarProveedor(self):\n self.conexionProveedor.modificarProveedor(proveedor=self.proveedor)\n self.cargarTabla()\n\n\n def limpiarCampos(self):\n self.winPrincipal.txtNombre_prov.setText('')\n self.winPrincipal.txtDescripcion_prov.setText('')\n self.winPrincipal.txtEmail_prov.setText('')\n self.winPrincipal.txtDireccion_prov.setText('')\n self.winPrincipal.txtDNumero_prov.setText('')\n self.winPrincipal.txtDPiso_prov.setText('')\n self.winPrincipal.txtDDpto_prov.setText('')\n self.winPrincipal.txtWeb_prov.setText('')\n self.winPrincipal.tvTelefonos_prov.setModel(None)\n self.winPrincipal.cbEstado_prov.setCurrentIndex(0)\n self.winPrincipal.txtFilterProveedores_prov.setText('')\n self.winPrincipal.tvProveedores_prov.setModel(None)\n\n self.winPrincipal.txtFilterProveedores_prov.setFocus(True)\n\n\n def setCampos(self):\n self.winPrincipal.txtDescripcion_prov.setText(str(self.proveedor.getDescripcion()))\n self.winPrincipal.txtEmail_prov.setText(str(self.proveedor.getEmail()))\n self.winPrincipal.txtNombre_prov.setText(str(self.proveedor.getNombre()))\n self.winPrincipal.txtWeb_prov.setText(str(self.proveedor.getWeb()))\n\n self.winPrincipal.txtDireccion_prov.setText(str(self.proveedor.getDireccion().getDireccion()))\n\n if self.proveedor.getDireccion().getNumero() is not None:\n self.winPrincipal.txtDNumero_prov.setText(str(self.proveedor.getDireccion().getNumero()))\n else:\n self.winPrincipal.txtDNumero_prov.setText('')\n\n if self.proveedor.getDireccion().getPiso() is not None:\n self.winPrincipal.txtDPiso_prov.setText(str(self.proveedor.getDireccion().getPiso()))\n else:\n self.winPrincipal.txtDPiso_prov.setText('')\n\n if self.proveedor.getDireccion().getDpto() is not None:\n self.winPrincipal.txtDDpto_prov.setText(self.proveedor.getDireccion().getDpto())\n else:\n self.winPrincipal.txtDDpto_prov.setText('')\n\n if self.proveedor.getEstado() == 1:\n self.winPrincipal.cbEstado_prov.setCurrentIndex(0)\n else:\n self.winPrincipal.cbEstado_prov.setCurrentIndex(1)\n\n\n def validar(self):\n mensaje = ''\n if self.winPrincipal.txtNombre_prov.text() == '':\n mensaje = \"Falta ingresar un Nombre\"\n elif self.winPrincipal.txtDescripcion_prov.text() == '':\n mensaje = \"Falta ingresa la descripcion\"\n elif self.winPrincipal.txtDireccion_prov.text() == '':\n mensaje = \"Falta ingresar una Direccion\"\n elif self.winPrincipal.txtDNumero_prov.text() == '':\n mensaje = \"Falta ingresar un N° de Direccion\"\n\n return mensaje\n\n\n def cargarTablaTelefono(self):\n self.listTelefonosInit = self.conexionTelefono.selectTelefono(self.proveedor)\n if len(self.listTelefonosInit) >0:\n header = ['ID', 'Numero', 'TIPO']\n tableModel = MyTableModel(self.winPrincipal, self.listTelefonosInit, header)\n self.winPrincipal.tvTelefonos_prov.setModel(tableModel)\n self.winPrincipal.tvTelefonos_prov.selectionModel().currentChanged.connect(self.changeSelectedTableTel)\n\n self.winPrincipal.tvTelefonos_prov.setColumnHidden(0, True)\n self.winPrincipal.tvTelefonos_prov.setColumnWidth(1, 36)\n self.winPrincipal.tvTelefonos_prov.setColumnWidth(2, 175)\n\n for r in range(0, len(self.listTelefonosInit)):\n self.winPrincipal.tvTelefonos_prov.setRowHidden(r, False)\n\n\n def changeSelectedTableTel(self, selected, deselected):\n listTelefonos = selected.model().mylist\n self.telefonoSelected = ()\n self.telefonoSelected = listTelefonos[selected.row()]\n\n self.telefonoSelectedRow = selected.row()\n self.winPrincipal.txtTelefono_prov.setText(str(self.telefonoSelected[2]))\n\n self.setTipoTelefono(str(self.telefonoSelected[1]))\n self.winPrincipal.btnCancelarTelefono_prov.setVisible(True)\n self.winPrincipal.btnRestarTelefono_prov.setEnabled(True)\n self.winPrincipal.tvTelefonos_prov.setEnabled(False)\n\n self.winPrincipal.btnGuardar_prov.setEnabled(False)\n self.winPrincipal.btnBorrar_prov.setEnabled(False)\n\n\n def updateTelefono(self):\n\n listTelefono = []\n if self.winPrincipal.tvTelefonos_prov.model() != None and \\\n len(self.winPrincipal.tvTelefonos_prov.model().mylist) > 0:\n listTelefono = list(self.winPrincipal.tvTelefonos_prov.model().mylist).copy()\n\n estado = ''\n telNew = Telefono()\n if len(listTelefono) > 0:\n if len(self.listTelefonosInit) > 0:\n\n listTelInit = list(self.listTelefonosInit)\n parche = (listTelefono[0][0], listTelefono[0][1], str(listTelefono[0][2]))\n listTelefono[0] = parche\n #Recorre la lista de telefono inicial\n for telInit in listTelInit:\n #recorre la lista de telefonos nueva\n for tel in listTelefono:\n telNew.setIdPersona(self.proveedor.getIdPersona())\n telNew.setIdTelefono(tel[0])\n telNew.setTipo(tel[1])\n if tel[2] == \"\":\n estado = 'DEL'\n break\n else:\n telNew.setTelefono(tel[2])\n\n if tel[0] == 0:\n estado = 'INS'\n break\n\n if telInit[0] == tel[0]:\n if telInit[1] != tel[1] or telInit[2] != tel[2]:\n estado = 'UPD'\n break\n\n if estado == 'UPD':\n self.conexionTelefono.modificarTelefono(telNew)\n elif estado == \"INS\":\n self.conexionTelefono.insertarTelefono(telNew)\n elif estado == 'DEL':\n self.conexionTelefono.borrarTelefono(telNew)\n #Si la lista de telefono inicial es cero\n else:\n #recorre la lista de telefonos nueva para agregarlos a todos\n for telN in listTelefono:\n if telN[2] != '':\n telNew = Telefono()\n telNew.setIdPersona(self.proveedor.getIdPersona())\n telNew.setIdTelefono(telN[0])\n telNew.setTipo(telN[1])\n telNew.setTelefono(telN[2])\n self.conexionTelefono.insertarTelefono(telNew)\n\n\n def insertTelefono(self):\n\n listTelefonosNew = []\n tel = self.winPrincipal.tvTelefonos_prov.model()\n\n listTelefonosNew = list(self.winPrincipal.tvTelefonos_prov.model().mylist).copy()\n\n if len(listTelefonosNew) > 0:\n self.conexionTelefono.insertTelefonoInit(listTelefonosNew)\n\n\n def onClickCancelarTelefono(self):\n self.winPrincipal.btnCancelarTelefono_prov.setVisible(False)\n self.winPrincipal.txtTelefono_prov.setText('')\n\n self.winPrincipal.btnRestarTelefono_prov.setEnabled(False)\n self.winPrincipal.tvTelefonos_prov.clearSelection()\n self.winPrincipal.tvTelefonos_prov.setEnabled(True)\n\n self.winPrincipal.btnGuardar_prov.setEnabled(True)\n self.winPrincipal.btnBorrar_prov.setEnabled(True)\n\n\n def onClickSumarTelefono(self):\n numTelefono = self.winPrincipal.txtTelefono_prov.text()\n\n if numTelefono.isdigit() == True:\n if self.winPrincipal.btnCancelarTelefono_prov.isVisible() is True:\n self.updateTelefonoTabla()\n else:\n self.insertTelefonoTabla()\n\n self.winPrincipal.tvTelefonos_prov.clearSelection()\n self.winPrincipal.btnRestarTelefono_prov.setEnabled(False)\n self.winPrincipal.btnCancelarTelefono_prov.setVisible(False)\n self.winPrincipal.txtTelefono_prov.setText('')\n self.winPrincipal.tvTelefonos_prov.setEnabled(True)\n\n self.winPrincipal.btnGuardar_prov.setEnabled(True)\n else:\n alert = QDialog()\n QMessageBox.information(alert,\"ERROR\", \"El numero de telefono no es valido.\")\n\n\n def onClickRestarTelefono(self):\n listTabTel = []\n\n #tipoTel = str(self.getTipoTelefono())\n listTelefonosNew = []\n\n listTabTel = list(self.winPrincipal.tvTelefonos_prov.model().mylist).copy()\n\n header = ['Id', 'Tipo', 'Numero']\n telDel = [self.telefonoSelected[0], self.telefonoSelected[1], '']\n listTabTel[self.telefonoSelectedRow] = telDel\n tableTelModel = MyTableModel(self.winPrincipal, listTabTel, header)\n self.winPrincipal.tvTelefonos_prov.setModel(tableTelModel)\n self.winPrincipal.tvTelefonos_prov.selectionModel().currentChanged.connect(self.changeSelectedTableTel)\n self.winPrincipal.tvTelefonos_prov.setRowHidden(self.telefonoSelectedRow, True)\n\n self.winPrincipal.btnCancelarTelefono_prov.setVisible(False)\n self.winPrincipal.txtTelefono_prov.setText('')\n self.winPrincipal.btnRestarTelefono_prov.setEnabled(False)\n self.winPrincipal.tvTelefonos_prov.setEnabled(True)\n\n self.winPrincipal.btnGuardar_prov.setEnabled(True)\n self.winPrincipal.btnBorrar_prov.setEnabled(True)\n\n\n def onClickTelefono(self):\n self.changeTipoTelefono(button='TEL')\n\n\n def onClickCelular(self):\n self.changeTipoTelefono(button='CEL')\n\n\n def onClickFax(self):\n self.changeTipoTelefono(button='FAX')\n\n\n def changeTipoTelefono(self, button):\n\n if button == 'TEL':\n self.winPrincipal.btnTelefono_prov.setEnabled(False)\n self.winPrincipal.btnCelular_prov.setEnabled(True)\n self.winPrincipal.btnFax_prov.setEnabled(True)\n elif button == 'CEL':\n self.winPrincipal.btnTelefono_prov.setEnabled(True)\n self.winPrincipal.btnCelular_prov.setEnabled(False)\n self.winPrincipal.btnFax_prov.setEnabled(True)\n elif button == 'FAX':\n self.winPrincipal.btnTelefono_prov.setEnabled(True)\n self.winPrincipal.btnCelular_prov.setEnabled(True)\n self.winPrincipal.btnFax_prov.setEnabled(False)\n\n\n def setTipoTelefono(self, tipoTelefono):\n\n if tipoTelefono == 'TEL':\n self.winPrincipal.btnTelefono_prov.setEnabled(False)\n self.winPrincipal.btnCelular_prov.setEnabled(True)\n self.winPrincipal.btnFax_prov.setEnabled(True)\n elif tipoTelefono == 'CEL':\n self.winPrincipal.btnTelefono_prov.setEnabled(True)\n self.winPrincipal.btnCelular_prov.setEnabled(False)\n self.winPrincipal.btnFax_prov.setEnabled(True)\n elif tipoTelefono == 'FAX':\n self.winPrincipal.btnTelefono_prov.setEnabled(True)\n self.winPrincipal.btnCelular_prov.setEnabled(True)\n self.winPrincipal.btnFax_prov.setEnabled(False)\n\n\n def getTipoTelefono(self):\n\n if self.winPrincipal.btnTelefono_prov.isEnabled() != True:\n return 'TEL'\n elif self.winPrincipal.btnCelular_prov.isEnabled() != True:\n return 'CEL'\n elif self.winPrincipal.btnFax_prov.isEnabled() != True:\n return 'FAX'\n\n\n def insertTelefonoTabla(self):\n numTel = self.winPrincipal.txtTelefono_prov.text()\n tipoTel = str(self.getTipoTelefono())\n\n modelListTelefono = self.winPrincipal.tvTelefonos_prov.model()\n header = ['ID', 'Tipo', 'Numero']\n\n if modelListTelefono is not None:\n listTabTel = list(self.winPrincipal.tvTelefonos_prov.model().mylist)\n\n if len(listTabTel) > 0 or listTabTel is not None:\n tuplaTel = ('0', tipoTel, numTel )\n listTabTel.append(tuplaTel)\n tupleTable = tuple(listTabTel)\n\n tableModel = MyTableModel(self.winPrincipal, tupleTable , header)\n self.winPrincipal.tvTelefonos_prov.setModel(tableModel)\n self.winPrincipal.tvTelefonos_prov.selectionModel().currentChanged.connect(self.changeSelectedTableTel)\n else:\n lista = []\n tuplaTel = ('0', tipoTel, numTel )\n lista.append(tuplaTel)\n\n tableModel = MyTableModel(self.winPrincipal, lista , header)\n self.winPrincipal.tvTelefonos_prov.setModel(tableModel)\n self.winPrincipal.tvTelefonos_prov.selectionModel().currentChanged.connect(self.changeSelectedTableTel)\n self.winPrincipal.tvTelefonos_prov.setColumnHidden(0, True)\n self.winPrincipal.tvTelefonos_prov.setColumnWidth(1, 36)\n self.winPrincipal.tvTelefonos_prov.setColumnWidth(2, 175)\n\n\n def updateTelefonoTabla(self):\n listTabTel = []\n\n tipoTel = str(self.getTipoTelefono())\n listTelefonosNew = []\n prob = self.winPrincipal.tvTelefonos_prov.selectionModel()\n prob1 = self.winPrincipal.tvTelefonos_prov.model()\n listTabTel = list(self.winPrincipal.tvTelefonos_prov.model().mylist).copy()\n\n telUpd = (self.telefonoSelected[0], tipoTel, int(self.winPrincipal.txtTelefono_prov.text()))\n listTabTel[self.telefonoSelectedRow] = telUpd\n header = ['ID', 'Tipo', 'Numero']\n tableModel = MyTableModel(self.winPrincipal, listTabTel , header)\n self.winPrincipal.tvTelefonos_prov.setModel(tableModel)\n self.winPrincipal.tvTelefonos_prov.selectionModel().currentChanged.connect(self.changeSelectedTableTel)" }, { "alpha_fraction": 0.6791443824768066, "alphanum_fraction": 0.6791443824768066, "avg_line_length": 14.666666984558105, "blob_id": "e227a5da67f944cd3d9aa537ea89c57148109121", "content_id": "38822c07f7d65039bc3a8d4dfc375be3b4809d27", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 187, "license_type": "no_license", "max_line_length": 56, "num_lines": 12, "path": "/full - compara relatorios/leCom.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import csv\n\nreader = csv.DictReader(open('b-co.csv'), delimiter='|')\ndictobj = next(reader) \n\nprint(reader)\nprint(dictobj)\n\nprint(dictobj['NUMERO'])\n\n# for row in reader:\n# print(row)" }, { "alpha_fraction": 0.5527080297470093, "alphanum_fraction": 0.5622186660766602, "avg_line_length": 41.18836212158203, "blob_id": "7893b40ff9c58d2ebacb8365031f8be2be51da0a", "content_id": "3758bc4ecfa2ec4338ac9d5930982a6d3929aa36", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 27552, "license_type": "no_license", "max_line_length": 231, "num_lines": 653, "path": "/PQt5-Stock/Controlador/pTransacciones.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "from Conexion.conexionTransacciones import ConexionTransacciones\nfrom Modelo.cliente import Cliente\nfrom Modelo.proveedor import Proveedor\nfrom Modelo.producto import Producto\nfrom PyQt5.QtWidgets import QRadioButton\nfrom Componentes.tableModel import MyTableModel\nfrom PyQt5.QtWidgets import QAbstractItemView, QTableView\nimport datetime\nfrom PyQt5.Qt import QTextDocument, QPrinter, QPrintDialog\nfrom PyQt5.QtWidgets import QMessageBox, QDialog\nfrom PyQt5.Qt import QDesktopServices, QUrl, QAbstractItemModel, QModelIndex\nfrom PyQt5 import QtCore\n\nclass PestaniaTransacciones():\n\n\n def __init__(self, winPrincipal):\n self.conexionTransacciones = ConexionTransacciones()\n self.winPrincipal = winPrincipal\n self.cliente = Cliente()\n self.proveedor = Proveedor()\n self.producto = Producto()\n self.tipoTransaccion = \"VENTA\"\n self.configInit()\n\n\n\n\n\n def configInit(self):\n\n self.winPrincipal.rbVenta_t.clicked.connect(self.onClickVenta)\n self.winPrincipal.rbCompra_t.clicked.connect(self.onClickCompra)\n\n self.winPrincipal.btnSumarProducto_t.clicked.connect(self.agregarTransaccion)\n self.winPrincipal.btnRestarProducto_t.clicked.connect(self.restarTransaccion)\n\n self.winPrincipal.btnAceptar_t.clicked.connect(self.onClickAceptar)\n self.winPrincipal.btnCancelar_t.clicked.connect(self.onClickCancelar)\n\n\n self.winPrincipal.tvClientes_t.setSortingEnabled(True)\n self.winPrincipal.tvClientes_t.setMouseTracking(True)\n self.winPrincipal.tvClientes_t.setSelectionBehavior(QAbstractItemView.SelectRows)\n\n self.winPrincipal.tvProductos_t.setSortingEnabled(True)\n self.winPrincipal.tvProductos_t.setMouseTracking(True)\n self.winPrincipal.tvProductos_t.setSelectionBehavior(QAbstractItemView.SelectRows)\n\n self.winPrincipal.tvDetalleTransaccion_t.setSortingEnabled(True)\n self.winPrincipal.tvDetalleTransaccion_t.setMouseTracking(True)\n self.winPrincipal.tvDetalleTransaccion_t.setSelectionBehavior(QAbstractItemView.SelectRows)\n\n self.winPrincipal.btnSumarProducto_t.setEnabled(False)\n self.winPrincipal.btnRestarProducto_t.setEnabled(False)\n self.winPrincipal.btnCancelar_t.setEnabled(False)\n self.winPrincipal.btnAceptar_t.setEnabled(False)\n\n self.winPrincipal.txtFilterCliente_t.setFocus(True)\n\n self.winPrincipal.txtFilterCliente_t.returnPressed.connect(self.searchPeople)\n self.winPrincipal.txtFilterProducto_t.returnPressed.connect(self.searchProduct)\n\n\n def finish(self):\n self.winPrincipal.btnAceptar_t.disconnect()\n self.winPrincipal.btnCancelar_t.disconnect()\n self.winPrincipal.btnRestarProducto_t.disconnect()\n self.winPrincipal.btnSumarProducto_t.disconnect()\n self.winPrincipal.rbVenta_t.disconnect()\n self.winPrincipal.rbCompra_t.disconnect()\n\n def searchProduct(self):\n\n if self.winPrincipal.txtFilterProducto_t.hasFocus() is True:\n self.cargarTablaProductos()\n\n\n def searchPeople(self):\n if self.winPrincipal.txtFilterCliente_t.hasFocus() is True:\n if self.winPrincipal.rbCompra_t.isChecked() is True:\n self.cargarTablaProveedores()\n else:\n self.cargarTablaClientes()\n\n def onClickAceptar(self):\n\n listTransaccion = list(self.winPrincipal.tvDetalleTransaccion_t.model().mylist).copy()\n subNom = \"\"\n estado = 0\n if self.winPrincipal.cbEstado_t.isChecked() is True:\n estado = 1\n numRecibo = 0\n\n\n if self.tipoTransaccion == \"VENTA\":\n numRecibo = self.conexionTransacciones.cargarTransaccionVenta(listTransaccion, self.cliente, estado)\n subNom = 'VNT'\n elif self.tipoTransaccion == \"COMPRA\":\n numRecibo = self.conexionTransacciones.cargarTransaccionCompra(listTransaccion, self.proveedor, estado)\n subNom = 'CMP'\n\n alert = QDialog()\n confirm = QMessageBox.question(alert, \"Mensaje\", \"¿ Desea generar Recibo ?\", QMessageBox.Yes, QMessageBox.No)\n if confirm == QMessageBox.Yes:\n self.createFactura(listTransaccion, subNom, numRecibo)\n\n\n self.limpiarCampos()\n\n\n def createFactura(self, listTransaccion, subNom, idRecibo):\n hoy = str(datetime.datetime.now().year) + str(datetime.datetime.now().month) + str(datetime.datetime.now().day) + str(datetime.datetime.now().hour) + str(datetime.datetime.now().minute) + str(datetime.datetime.now().second)\n\n nombrePdf = '../archivos/' + str(hoy + subNom) + '.pdf'\n listTransaccionTable = \"\"\n for transaccion in listTransaccion:\n listTransaccionTable += \"\"\"\n <tr height=\"80\">\n <td width=\"10%\" align=\"center\" >\n <br>\"\"\" + str(transaccion[1]) + \"\"\"<br>\n </td>\n <td width=\"20%\" >\n <br> &nbsp;&nbsp;\"\"\" + str(transaccion[3]) + \"\"\"<br>\n </td>\n <td width=\"50%\" >\n <br>&nbsp;&nbsp; \"\"\" + str(transaccion[4]) + \"\"\"<br>\n </td>\n <td width=\"10%\" align=\"right\" >\n <br> $ \"\"\" + str(transaccion[5]) + \"\"\"&nbsp;&nbsp;<br>\n </td>\n <td width=\"10%\" align=\"right\" >\n <br> $ \"\"\" + str( int(transaccion[1]) * float(transaccion[5])) + \"\"\"&nbsp;&nbsp;<br>\n </td>\n </tr>\n \"\"\"\n nombre = \"\"\n apellido = \"\"\n\n if(self.tipoTransaccion == \"VENTA\"):\n nombre = self.cliente.getNombre()\n apellido = self.cliente.getApellido()\n elif(self.tipoTransaccion == \"COMPRA\"):\n nombre = self.proveedor.getNombre()\n apellido = self.proveedor.getDescripcion()\n\n\n total = self.winPrincipal.lblTotal.text()\n fecha = str(datetime.datetime.now())\n html = \"\"\"\n <table width=\"600\">\n <tr width=\"600\" color=\"#000000\">\n <td width=\"80%\">\n Perfumeria La que vende perfumes <br>\n LABOULAYE, CORDOBA, ARGENTINA <br>\n TEL: 0351-111111 <br>\n MAIL: MAIL@MAIL.COM <br>\n </td>\n <td width=\"20%\" align=\"right\">\n <IMG SRC=\"kde1.png\">\n </td>\n </tr>\n\n </table>\n _______________________________________________________________________________________________________\n <p>\n DATOS DEL CLIENTE:\n </p>\n <br>\n <table>\n\n <tr>\n <td>\n NOMBRE: \"\"\"+ nombre +\"\"\" <br>\n APELLIDO: \"\"\" + apellido + \"\"\" <br>\n\n </td>\n <td>\n </td>\n </tr>\n </table>\n\n <br>\n _______________________________________________________________________________________________________\n <br>\n <p>\n DETALLES DE LA COMPRA:\n </p>\n <br>\n <table width=\"600\" height=\"0\" style=\"border-color: black; border-width: 0.5px; border-spacing: 0;\">\n <tr style=\" background-color: gray; border-style: inset;\">\n <td width=\"10%\" align=\"center\" valign=\"middle\">\n <b>\n CANT\n </b>\n </td>\n <td width=\"20%\" align=\"center\" valign=\"middle\">\n <b>\n PRODUCTO\n </b>\n </td>\n <td width=\"50%\" align=\"center\" valign=\"middle\">\n <b>\n DESCRIPCION\n </b>\n </td>\n <td width=\"10%\" align=\"center\" valign=\"middle\">\n <b>\n PREC <br>UNIT\n </b>\n </td>\n <td width=\"10%\" align=\"center\" valign=\"middle\">\n <b>\n PREC <br>TOT\n </b>\n </td>\n </tr>\n </table>\n\n <br>\n <br>\n <br>\n <br>\n\n <table height=\"350\" width=\"600\" style=\"border-color: gray; border-width: .4px; border-collapse: collapse;\">\n \"\"\" + listTransaccionTable + \"\"\"\n </table>\n <br>\n <br>\n <table width=\"600\" border=\"0.5\" height=\"0\" style=\"border-color: black; border-width: 0.5px; border-spacing: 0;\">\n <tr >\n <td width=\"90%\" align=\"right\">\n <br>\n TOTAL..................................................................................................................\n <br>\n </td>\n <td width=\"10%\" align=\"center\">\n <br> $ \"\"\" + total + \"\"\"<br>\n </td>\n </tr>\n </table>\n\n <br>\n <br>\n <br>\n <p width=\"600\" align=\"center\" style=\" font-size: 10; \" >\n Por cualquier consulta, sobre este recibo, dirigirse al local que se encuentra ubicado en la calle\n independencia 450. <br> O Comunicarse a los telefonos 03382-123123123 / 4231231\n </p>\n <br>\n <br>\n <br>\n <br>\n <br>\n _______________________________________________________________________________________________________\n <br>\n <table width=\"600\">\n <tr>\n <td align=\"right\" width=\"80%\">\n FECHA/HORA : \"\"\"+ fecha + \"\"\"\n </td>\n <td align=\"right\">\n N° : \"\"\"+ str(idRecibo) +\"\"\"\n </td>\n </tr>\n </table>\n _______________________________________________________________________________________________________\n \"\"\"\n\n doc = QTextDocument()\n doc.setHtml(html)\n #doc.setDefaultStyleSheet(style)\n printer = QPrinter()\n printer.setOutputFileName(nombrePdf)\n\n printer.setOutputFormat(QPrinter.PdfFormat)\n doc.print(printer)\n printer.newPage()\n url = QUrl\n url = QUrl(nombrePdf)\n QDesktopServices.openUrl(url)\n\n \"\"\"\n printPdf = QPrinter()\n printPdf.setOutputFormat(QPrinter.NativeFormat)\n\n questionPrint = QPrintDialog(printPdf, self.winPrincipal)\n\n if questionPrint.exec() == QPrintDialog.accept(printPdf):\n doc.print(printPdf)\n\n\n alert = QDialog()\n confirm = QMessageBox.question(alert, \"Mensaje\", \"¿ Desea generar factura ?\", QMessageBox.Yes, QMessageBox.No)\n if confirm == QMessageBox.Yes:\n\n #openPdf = QPrintDialog(printPdf, self.winPrincipal)\n #openPdf.setWindowTitle(\"Recibo\")\n \"\"\"\n\n\n def limpiarCampos(self):\n self.winPrincipal.tvClientes_t.setModel(None)\n self.winPrincipal.tvDetalleTransaccion_t.setModel(None)\n self.winPrincipal.tvProductos_t.setModel(None)\n self.winPrincipal.lblTotal.setText('0.00')\n self.winPrincipal.sbCantidadProducto_t.setValue(0)\n self.winPrincipal.rbCompra_t.setEnabled(True)\n self.winPrincipal.rbVenta_t.setEnabled(True)\n\n self.winPrincipal.txtFilterCliente_t.setText('')\n self.winPrincipal.txtFilterProducto_t.setText('')\n\n self.winPrincipal.btnAceptar_t.setEnabled(False)\n self.winPrincipal.btnCancelar_t.setEnabled(False)\n\n self.winPrincipal.txtFilterCliente_t.setFocus(True)\n\n\n def onClickCancelar(self):\n alert = QDialog()\n confirm = QMessageBox.question(alert, \"Mensaje\", \"¿ Desea cancelar la transaccion ?\", QMessageBox.Yes, QMessageBox.No)\n if confirm == QMessageBox.Yes:\n self.limpiarCampos()\n\n\n def cargarTablaClientes(self):\n parameter = self.winPrincipal.txtFilterCliente_t.text()\n\n typeParameter = ''\n if self.winPrincipal.cbFilterCliente_t.currentText() == 'Apellido':\n typeParameter = 'c.apellido'\n elif self.winPrincipal.cbFilterCliente_t.currentText() == 'Nombre':\n typeParameter = 'p.nombre'\n\n\n listaClientes = self.conexionTransacciones.selectClientes(typeParameter, parameter)\n if len(listaClientes) > 0:\n header = ['ID','Apellido','Nombre','Email']\n tablaModel = MyTableModel(self.winPrincipal.tvClientes_t, listaClientes, header)\n #tablaModel.setHeaderData(3, QtCore.Qt.Horizontal , 'Email', QtCore.Qt.AlignRight)\n #index = QModelIndex()\n #index.data(2)\n #index.column()\n #tablaModel.setData(index, QtCore.QVariant(QtCore.Qt.AlignHCenter), QtCore.Qt.TextAlignmentRole)\n self.winPrincipal.tvClientes_t.setModel(tablaModel)\n self.winPrincipal.tvClientes_t.selectionModel().currentChanged.connect(self.changeSelectedTable)\n #self.winPrincipal.tvClientes_t.model().headerData(2, QtCore.Qt.Horizontal, QtCore.Qt.AlignRight)\n self.winPrincipal.tvClientes_t.setColumnHidden(0, True)\n self.winPrincipal.tvClientes_t.setColumnWidth(1, 130)\n self.winPrincipal.tvClientes_t.setColumnWidth(2, 130)\n self.winPrincipal.tvClientes_t.setColumnWidth(3, 150)\n\n else:\n self.winPrincipal.tvClientes_t.setModel(None)\n\n\n def cargarTablaProveedores(self):\n\n parameter = self.winPrincipal.txtFilterCliente_t.text()\n\n typeParameter = ''\n if self.winPrincipal.cbFilterCliente_t.currentText() == 'Apellido':\n typeParameter = 'prov.descripcion'\n elif self.winPrincipal.cbFilterCliente_t.currentText() == 'Nombre':\n typeParameter = 'p.nombre'\n\n listProveedores = self.conexionTransacciones.selectProveedores(typeParameter, parameter)\n if len(listProveedores) > 0:\n header = ['ID', 'Descripcion', 'Nombre', 'Email']\n tableModel = MyTableModel(self.winPrincipal.tvClientes_t, listProveedores, header)\n self.winPrincipal.tvClientes_t.setModel(tableModel)\n self.winPrincipal.tvClientes_t.selectionModel().currentChanged.connect(self.changeSelectedTable)\n\n self.winPrincipal.tvClientes_t.setColumnHidden(0, True)\n self.winPrincipal.tvClientes_t.setColumnWidth(1, 130)\n self.winPrincipal.tvClientes_t.setColumnWidth(2, 130)\n self.winPrincipal.tvClientes_t.setColumnWidth(3, 150)\n else:\n self.winPrincipal.tvClientes_t.setModel(None)\n\n\n def changeSelectedTable(self, selected, deselected):\n\n listPersonas = selected.model().mylist\n personaSelected = ()\n personaSelected = tuple(listPersonas[selected.row()])\n\n self.personaSelectedRow = selected.row()\n\n if(self.tipoTransaccion == \"VENTA\"):\n self.cliente = Cliente()\n self.cliente.setIdCliente(int(personaSelected[0]))\n self.cliente.setApellido(str(personaSelected[1]))\n self.cliente.setNombre(str(personaSelected[2]))\n self.cliente.setEmail(str(personaSelected[3]))\n\n elif(self.tipoTransaccion == \"COMPRA\"):\n self.proveedor = Proveedor()\n self.proveedor.setIdProveedor(int(personaSelected[0]))\n self.proveedor.setDescripcion(str(personaSelected[1]))\n self.proveedor.setNombre(str(personaSelected[2]))\n self.proveedor.setEmail(str(personaSelected[3]))\n\n self.activateButton()\n\n def cargarTablaProductos(self):\n\n parameter = self.winPrincipal.txtFilterProducto_t.text()\n typeParameter = ''\n if self.winPrincipal.cbFilterProducto_t.currentText() == 'Nombre':\n typeParameter = 'p.nombre'\n elif self.winPrincipal.cbFilterProducto_t.currentText() == 'Marca':\n typeParameter = 'm.descripcion'\n elif self.winPrincipal.cbFilterProducto_t.currentText() == 'Precio de Venta':\n typeParameter = 'p.pVenta'\n else:\n typeParameter = 'p.pCompra'\n\n parameterTransaccion = 'CMP'\n if self.tipoTransaccion == \"VENTA\":\n parameterTransaccion = 'VNT'\n\n listProducto = self.conexionTransacciones.selectProductos(typeParameter, parameter, parameterTransaccion)\n\n if len(listProducto) > 0:\n header = ['ID', 'Nombre', 'Descripcion', 'Cant', 'P.Compra', 'P.Venta', 'Marca']\n\n tableModel = MyTableModel(self.winPrincipal.tvProductos_t, listProducto, header)\n self.winPrincipal.tvProductos_t.setModel(tableModel)\n self.winPrincipal.tvProductos_t.selectionModel().currentChanged.connect(self.changeSelectedTableProducto)\n\n self.winPrincipal.tvProductos_t.setColumnHidden(0, True)\n self.winPrincipal.tvProductos_t.setColumnWidth(1, 150)\n self.winPrincipal.tvProductos_t.setColumnWidth(2, 200)\n self.winPrincipal.tvProductos_t.setColumnWidth(3, 50)\n self.winPrincipal.tvProductos_t.setColumnWidth(4, 80)\n self.winPrincipal.tvProductos_t.setColumnWidth(5, 80)\n self.winPrincipal.tvProductos_t.setColumnWidth(6, 100)\n\n else:\n self.winPrincipal.tvProductos_t.setModel(None)\n\n\n def changeSelectedTableProducto(self, selected, deselected):\n listProductos = selected.model().mylist\n productoSelected = ()\n productoSelected = tuple(listProductos[selected.row()])\n\n self.productoSelected = selected.row()\n\n self.producto = Producto()\n self.producto.setIdProducto(int(productoSelected[0]))\n self.producto.setNombre(str(productoSelected[1]))\n self.producto.setDescripcion(str(productoSelected[2]))\n self.producto.setCantidad(int(productoSelected[3]))\n self.producto.setPrecioCompra(float(productoSelected[4]))\n self.producto.setPrecioVenta(float(productoSelected[5]))\n\n self.winPrincipal.btnSumarProducto_t.setEnabled(True)\n\n\n\n def agregarTransaccion(self):\n cantProducto = int(self.winPrincipal.sbCantidadProducto_t.value())\n\n\n stateProduct = True\n\n if self.tipoTransaccion == \"VENTA\" and cantProducto > self.producto.getCantidad():\n stateProduct = False\n\n if cantProducto == 0:\n stateProduct = False\n\n if stateProduct is True: #and self.validateProduct() is True:\n modelListTransaccion = self.winPrincipal.tvDetalleTransaccion_t.model()\n header = ['ID', 'Cantidad','idProducto' ,'Producto', 'Descripcion', 'Precio Unit', 'Precio Tot' ]\n\n precio_unitario = 0\n if(self.tipoTransaccion == \"VENTA\"):\n precio_unitario = float(self.producto.getPrecioVenta())\n\n elif(self.tipoTransaccion == \"COMPRA\"):\n precio_unitario = float(self.producto.getPrecioCompra())\n\n if modelListTransaccion is not None:\n listTabPro = list(self.winPrincipal.tvDetalleTransaccion_t.model().mylist)\n\n if len(listTabPro) > 0 or listTabPro is not None:\n tuplaProd = ('0', str(cantProducto), str(self.producto.getIdProducto()), str(self.producto.getNombre()),\n str(self.producto.getDescripcion()), str(precio_unitario), str(cantProducto * precio_unitario)\n )\n\n listTabPro.append(tuplaProd)\n tupleTable = tuple(listTabPro)\n\n tableModel = MyTableModel(self.winPrincipal, tupleTable , header)\n self.winPrincipal.tvDetalleTransaccion_t.setModel(tableModel)\n else:\n lista = []\n tuplaProd = ('0', str(cantProducto), str(self.producto.getIdProducto()), str(self.producto.getNombre()),\n str(self.producto.getDescripcion()), str(precio_unitario), str(cantProducto * precio_unitario)\n )\n lista.append(tuplaProd)\n\n tableModel = MyTableModel(self.winPrincipal, lista , header)\n self.winPrincipal.tvDetalleTransaccion_t.setModel(tableModel)\n self.winPrincipal.tvDetalleTransaccion_t.setColumnHidden(0, True)\n self.winPrincipal.tvDetalleTransaccion_t.setColumnWidth(1, 80)\n self.winPrincipal.tvDetalleTransaccion_t.setColumnHidden(2, True)\n self.winPrincipal.tvDetalleTransaccion_t.setColumnWidth(3, 200)\n self.winPrincipal.tvDetalleTransaccion_t.setColumnWidth(4, 653)\n self.winPrincipal.tvDetalleTransaccion_t.setColumnWidth(5, 80)\n self.winPrincipal.tvDetalleTransaccion_t.setColumnWidth(6, 80)\n\n self.winPrincipal.rbCompra_t.setEnabled(False)\n self.winPrincipal.rbVenta_t.setEnabled(False)\n\n #self.total = (cantProducto * self.producto.getPrecioVenta()) + self.total\n\n #self.winPrincipal.lblTotal.setText(str(self.total))\n\n self.winPrincipal.btnCancelar_t.setEnabled(True)\n self.winPrincipal.btnSumarProducto_t.setEnabled(False)\n\n self.winPrincipal.sbCantidadProducto_t.setValue(0)\n\n self.winPrincipal.tvDetalleTransaccion_t.selectionModel().currentChanged.connect(self.changeSelectedTableTransaccion)\n\n total = float(self.winPrincipal.lblTotal.text())\n total +=+ (cantProducto * precio_unitario)\n self.winPrincipal.lblTotal.setText(\"{0:.2f}\".format(total))\n self.activateButton()\n #self.calcularTotal()\n else:\n alert = QDialog()\n QMessageBox.information(alert,\"ERROR\", \"La cantidad especificada es invalida\")\n\n\n def activateButton(self):\n hasP = False\n if self.proveedor.getIdProveedor() != 0 or self.cliente.getIdCliente() != 0:\n hasP = True\n if self.winPrincipal.tvDetalleTransaccion_t.model() is not None and hasP is True:\n self.winPrincipal.btnAceptar_t.setEnabled(True)\n\n\n def validateProduct(self):\n validate = True\n\n\n if self.winPrincipal.tvDetalleTransaccion_t.model() is not None:\n listTransacciones = list(self.winPrincipal.tvDetalleTransaccion_t.model().mylist).copy()\n header = ('ID', 'Cantidad','idProducto' ,'Producto', 'Descripcion', 'Precio Unit', 'Precio Tot')\n listTransacciones.append(header)\n\n #cant = int(len(list(self.winPrincipal.tvDetalleTransaccion_t.model().mylist).copy()))\n tuple = (\"\", listTransacciones[0][1], listTransacciones[0][2], listTransacciones[0][3], listTransacciones[0][4], listTransacciones[0][5], listTransacciones[0][6])\n listTransacciones[0] = tuple\n for transaccion in listTransacciones:\n if str(transaccion[2]) == str(self.producto.getIdProducto()):\n validate = False\n \"\"\"\n for i in range(cant):\n\n if listTransacciones[i][2] == str(self.producto.getIdProducto()):\n validate = False\n\"\"\"\n\n\n return validate\n\n\n def restarTransaccion(self):\n\n listTransacciones = list(self.winPrincipal.tvDetalleTransaccion_t.model().mylist).copy()\n\n header = ['ID', 'Cantidad','idProducto' ,'Producto', 'Descripcion', 'Precio Unit', 'Precio Tot' ]\n\n listTransacciones.remove(self.transaccionSelected)\n\n if len(listTransacciones) < 1:\n self.winPrincipal.btnAceptar_t.setEnabled(False)\n self.winPrincipal.btnCancelar_t.setEnabled(False)\n self.winPrincipal.tvDetalleTransaccion_t.setModel(None)\n else:\n tableTelModel = MyTableModel(self.winPrincipal, listTransacciones, header)\n self.winPrincipal.tvDetalleTransaccion_t.setModel(tableTelModel)\n self.winPrincipal.tvDetalleTransaccion_t.selectionModel().currentChanged.connect(self.changeSelectedTableTransaccion)\n\n\n total = float(self.winPrincipal.lblTotal.text())\n total -= float(self.transaccionSelected[6])\n self.winPrincipal.lblTotal.setText(\"{0:.2f}\".format(total))\n\n self.winPrincipal.btnRestarProducto_t.setEnabled(False)\n #self.calcularTotal()\n\n\n def changeSelectedTableTransaccion(self, selected, deselected):\n listTransacciones = selected.model().mylist\n self.transaccionSelected = ()\n self.transaccionSelected = listTransacciones[selected.row()]\n\n self.telefonoSelectedRow = selected.row()\n\n self.winPrincipal.btnRestarProducto_t.setEnabled(True)\n\n\n def onClickVenta(self):\n self.winPrincipal.label2_t.setText('Cliente')\n self.tipoTransaccion = \"VENTA\"\n self.limpiarCampos()\n\n\n\n def onClickCompra(self):\n self.winPrincipal.label2_t.setText('Proovedor')\n self.tipoTransaccion = \"COMPRA\"\n self.limpiarCampos()\n\n\n\n def selecClientes(self):\n if self.winPrincipal.cbFilterCliente_t.currentText() == 'Apellido':\n tipoParametro = 'c.apellido'\n elif self.winPrincipal.cbFilterCliente_t.currentText() == 'Email':\n tipoParametro = 'p.email'\n\n parametro = self.winPrincipal.txtFilterCliente_t.text()\n\n self.conexionTransacciones.selectClientes(tipoParametro, parametro)\n\n\n def calcularTotal(self):\n listTransacciones = []\n listTransacciones = list(self.winPrincipal.tvDetalleTransaccion_t.model().mylist).copy()\n\n tupleParche = listTransacciones[0]\n tupleParche = ('1', tupleParche[1], tupleParche[2], tupleParche[3], tupleParche[4], tupleParche[5], tupleParche[6])\n listTransacciones[0] = tupleParche\n if len(listTransacciones) > 0:\n total = 0\n\n for transaccion in listTransacciones:\n\n total = total + float(transaccion[6])\n\n\n self.winPrincipal.lblTotal.setText(str(total))\n else:\n self.winPrincipal.lblTotal.setText('0,00')" }, { "alpha_fraction": 0.7151094079017639, "alphanum_fraction": 0.721614420413971, "avg_line_length": 42.92207717895508, "blob_id": "e54b6e2740a9aaeeb6fc212fde7a5bb1eace324b", "content_id": "7e2222538b1be3db3f5daf9e3934e7ce73819ca8", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 6764, "license_type": "no_license", "max_line_length": 246, "num_lines": 154, "path": "/PQt5-Stock/Controlador/windowPrincipal.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom PyQt5 import uic\nfrom Controlador.pCliente import PestaniaCliente\nfrom Controlador.pProveedor import PestaniaProveedor\nfrom Controlador.pUsuario import PestaniaUsuario\nfrom Controlador.pProducto import PestaniaProducto\nfrom Controlador.pTransacciones import PestaniaTransacciones\nfrom Controlador.pPagos import PestaniaPagos\nfrom Conexion.conexionGeneral import ConexionGenerales\nfrom Controlador.pEstadisticas import PestaniaEstadisticas\nfrom Controlador.windowNotification import WindowNotification\nfrom Controlador.windowList import WindowList\nfrom PyQt5.Qt import QDesktopServices, QUrl\n\nclass Principal():\n\n def __init__(self, usuario):\n\n #Definiendo variables\n self.usuario = usuario\n self.winPrincipal = uic.loadUi('Vista/mainwindow.ui')\n self.winPrincipal.show()\n\n self.setInterfaceUsuario()\n #self.winPrincipal.maximumSize = self.winPrincipal.size()\n self.winPrincipal.setFixedSize(self.winPrincipal.size())\n self.notificationStock()\n self.winPrincipal.twMenu.currentChanged.connect(self.changePes)\n\n self.pestaniaTransaccion = PestaniaTransacciones(self.winPrincipal)\n self.pestaniaPago = PestaniaPagos(self.winPrincipal)\n self.pestaniaCliente = PestaniaCliente(self.winPrincipal)\n self.pestaniaUsuario = PestaniaUsuario(self.winPrincipal)\n self.pestaniaProveedor = PestaniaProveedor(self.winPrincipal)\n self.pestaniaProducto = PestaniaProducto(self.winPrincipal)\n self.pestaniaEstadisticas = PestaniaEstadisticas(self.winPrincipal)\n\n self.winPrincipal.actionListCliente.triggered.connect(self.openListCliente)\n self.winPrincipal.actionListProveedor.triggered.connect(self.openListProveedor)\n self.winPrincipal.actionListStock.triggered.connect(self.openNotification)\n\n self.winPrincipal.actionTransacciones.triggered.connect(self.actionTransacciones)\n self.winPrincipal.actionPagos.triggered.connect(self.actionPagos)\n self.winPrincipal.actionProductos.triggered.connect(self.actionProductos)\n self.winPrincipal.actionClientes.triggered.connect(self.actionClientes)\n self.winPrincipal.actionProveedores.triggered.connect(self.actionProveedores)\n self.winPrincipal.actionUsuarios.triggered.connect(self.actionUsuarios)\n self.winPrincipal.actionEstaditicas.triggered.connect(self.actionEstadisticas)\n self.winPrincipal.actionManual.triggered.connect(self.openManual)\n self.winPrincipal.actionReportarError.triggered.connect(self.openMail)\n\n #self.winPrincipal.btnListProveedores_e.clicked.connect(self.openListProveedor)\n #self.winPrincipal.btnListClientes_e.clicked.connect(self.openListCliente)\n #self.winPrincipal.btnListProductos_e.clicked.connect(self.openNotification)\n\n if usuario.getTipoUsuario() == 'USR':\n self.winPrincipal.actionListCliente.setEnabled(False)\n self.winPrincipal.actionListProveedor.setEnabled(False)\n self.winPrincipal.actionListStock.setEnabled(False)\n\n self.winPrincipal.actionUsuarios.setEnabled(False)\n self.winPrincipal.actionEstaditicas.setEnabled(False)\n\n def openListCliente(self):\n self.winList = WindowList(type='CLIENT')\n\n def openListProveedor(self):\n self.winList = WindowList(type='PROV')\n\n def openManual(self):\n url = QUrl\n url = QUrl(\"../Recursos/Manual.pdf\")\n QDesktopServices.openUrl(url)\n\n\n def openMail(self):\n QDesktopServices.openUrl(QUrl(\"mailto:duftuban@mail.com?subject=Error&body=REPORTAR ERROR :\"))\n\n\n def setInterfaceUsuario(self):\n\n if self.usuario.getTipoUsuario() == 'ADM':\n self.winPrincipal.twMenu.setTabEnabled(5, True)\n self.winPrincipal.twMenu.setTabEnabled(6, True)\n else:\n self.winPrincipal.twMenu.setTabEnabled(5, False)\n self.winPrincipal.twMenu.setTabEnabled(6, False)\n\n\n def notificationStock(self):\n conexionGenerales = ConexionGenerales()\n\n listProdSinStock = conexionGenerales.selectProductoStock()\n self.winPrincipal.btnNotification.setEnabled(False)\n if len(listProdSinStock) > 0:\n self.winPrincipal.btnNotification.setText(str(len(listProdSinStock)))\n self.winPrincipal.btnNotification.setStyleSheet(\"border-top: 3px transparent;\\nborder-bottom: 3px transparent;\\nborder-right: 5px transparent;\\nborder-left: 5px transparent;\\ncolor: rgb(255, 0, 0);\\nfont: 87 8pt Rockwell Extra Bold;\")\n self.winPrincipal.btnNotification.clicked.connect(self.openNotification)\n if self.usuario.getTipoUsuario() == 'ADM':\n self.winPrincipal.btnNotification.setEnabled(True)\n else:\n self.winPrincipal.btnNotification.setText(\"0\")\n self.winPrincipal.btnNotification.setStyleSheet(\"background-color: rgb(185, 185, 185);\")\n\n\n def openNotification(self):\n self.winNot = WindowNotification()\n\n def changePes(self):\n #self.winPrincipal.disconnect()\n if self.winPrincipal.twMenu.currentIndex() == 0:\n #self.pestania.finish() transacciones\n self.pestaniaTransaccion.limpiarCampos()\n elif self.winPrincipal.twMenu.currentIndex() == 1:\n #self.pestania.finish() pagos\n self.pestaniaPago.limpiarCampos()\n elif self.winPrincipal.twMenu.currentIndex() == 2:\n #self.pestania.finish() producto\n self.pestaniaProducto.validarBotones('BORRAR')\n elif self.winPrincipal.twMenu.currentIndex() == 3:\n #self.pestania.finish() cliente\n self.pestaniaCliente.validarBotones('BORRAR')\n elif self.winPrincipal.twMenu.currentIndex() == 4:\n #self.pestania.finish() proveedor\n self.pestaniaProveedor.validarBotones('BORRAR')\n elif self.winPrincipal.twMenu.currentIndex() == 5:\n #self.pestania.finish() usuario\n self.pestaniaUsuario.validarBotones('BORRAR')\n elif self.winPrincipal.twMenu.currentIndex() == 6:\n #self.pestania.finish()\n print('Estaditicas')\n\n def actionTransacciones(self):\n self.winPrincipal.twMenu.setCurrentIndex(0)\n\n def actionPagos(self):\n self.winPrincipal.twMenu.setCurrentIndex(1)\n\n def actionProductos(self):\n self.winPrincipal.twMenu.setCurrentIndex(2)\n\n def actionClientes(self):\n self.winPrincipal.twMenu.setCurrentIndex(3)\n\n def actionProveedores(self):\n self.winPrincipal.twMenu.setCurrentIndex(4)\n\n def actionUsuarios(self):\n self.winPrincipal.twMenu.setCurrentIndex(5)\n\n def actionEstadisticas(self):\n self.winPrincipal.twMenu.setCurrentIndex(6)\n" }, { "alpha_fraction": 0.578125, "alphanum_fraction": 0.640625, "avg_line_length": 11.600000381469727, "blob_id": "4c8a5063cd21b3327e54e3d476d9e7e9296ff09a", "content_id": "e018b68b5386e78154cf0abf39b7b3bf65c395a6", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 64, "license_type": "no_license", "max_line_length": 33, "num_lines": 5, "path": "/pyside2/testes.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import sys\n\nprint(sys.argv)\n\nexec(open(\"./ps2-001.py\").read())\n\n" }, { "alpha_fraction": 0.6039823293685913, "alphanum_fraction": 0.6150442361831665, "avg_line_length": 18.65217399597168, "blob_id": "5389d464edbe5e61125564e38e198816aedca7fc", "content_id": "1a8d9beda09d8ad64e4860b0fcf3e89245c9124c", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 452, "license_type": "no_license", "max_line_length": 67, "num_lines": 23, "path": "/pyqt5-curso/spread1.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import sys\nfrom PyQt5.QtWidgets import QTableWidget, QApplication, QMainWindow\n\n\nclass MyTable(QTableWidget):\n def __init__(self, r, c):\n super().__init__(r, c)\n\n self.show()\n\n\nclass Sheet(QMainWindow):\n def __init__(self):\n super().__init__()\n\n self.form_widget = MyTable(10, 10)\n self.setCentralWidget(self.form_widget)\n\n self.show()\n\napp = QApplication(sys.argv)\nsheet = Sheet()\nsys.exit(app.exec_())\n" }, { "alpha_fraction": 0.715179979801178, "alphanum_fraction": 0.7183098793029785, "avg_line_length": 28.045454025268555, "blob_id": "cbc70d44955f3c45d228e269e5d2b7946566d85d", "content_id": "4209cc9abc9123fbaa2cba481775d05dc625c648", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 643, "license_type": "no_license", "max_line_length": 69, "num_lines": 22, "path": "/pong/widgets/Bola.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "from kivy.properties import NumericProperty, ReferenceListProperty\nfrom kivy.uix.widget import Widget\nfrom kivy.vector import Vector\n\n\n# Define o elemento \"bola\"\nclass Bola(Widget):\n \"\"\"\n Define a bola do jogo e mantém sua velocidade, a qual é um Vector\n contendo suas componentes de velocidade X e Y.\n \"\"\"\n\n # Velocidade da bola\n velocidade_x = NumericProperty(0)\n velocidade_y = NumericProperty(0)\n\n # Velocidade\n velocidade = ReferenceListProperty(velocidade_x, velocidade_y)\n\n # Define a função de movimento da nossa bolinha\n def movimenta(self):\n self.pos = Vector(*self.velocidade) + self.pos\n" }, { "alpha_fraction": 0.6746506690979004, "alphanum_fraction": 0.71257483959198, "avg_line_length": 26.88888931274414, "blob_id": "8be35954081a542c1907c6fb612b8e123c479188", "content_id": "105f885238df0e5a3727504ca2017b5552003f5a", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 501, "license_type": "no_license", "max_line_length": 83, "num_lines": 18, "path": "/html_to_png/teste.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import pdfcrowd\nimport sys\n\ntry:\n # create the API client instance\n client = pdfcrowd.HtmlToImageClient('demo', 'ce544b6ea52a5621fb9d55f8b542d14d')\n\n # configure the conversion\n client.setOutputFormat('png')\n\n # run the conversion and write the result to a file\n client.convertUrlToFile('file://./sandra.html', 'sandra.png')\nexcept pdfcrowd.Error as why:\n # report the error\n sys.stderr.write('Pdfcrowd Error: {}\\n'.format(why))\n\n # rethrow or handle the exception\n raise" }, { "alpha_fraction": 0.5817875266075134, "alphanum_fraction": 0.5847710371017456, "avg_line_length": 34.04090881347656, "blob_id": "3332a2c9aa325456866b908b81a19bac0343ec13", "content_id": "9a959ae3396c0d18dca43fcee9ff5518dbe10a68", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 7752, "license_type": "no_license", "max_line_length": 93, "num_lines": 220, "path": "/PyQT-CRUD-App/app/main.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/python3\n# -*- coding: utf-8 -*-\n\"\"\"\nЗаводим новых работников\n\"\"\"\nimport sys\nimport os\nfrom app import login, excel\nfrom app.regdialogs import address, employee, pc\nfrom app.tablewidgets import employees, pcs\nfrom app.db import data\nfrom sqlalchemy import exc\nfrom PyQt5 import *\nfrom PyQt5.QtWidgets import *\nfrom PyQt5.QtGui import *\nfrom PyQt5.QtCore import *\nfrom PyQt5.Qt import *\n\nclass MainWindow(QMainWindow):\n def __init__(self):\n QMainWindow.__init__(self)\n self.init_ui()\n self.display_data()\n self.show()\n\n def init_ui(self):\n self.set_and_center_the_window(1024, 768)\n self.setWindowTitle('Contabilidade de funcionários e computadores da RAS')\n self.setWindowIcon(QIcon(r'pics\\star.png'))\n\n employee_action = QAction(\n QIcon(r'pics\\add_user.png'), 'Adicionar novo funcionário', self\n )\n employee_action.triggered.connect(self.add_employee)\n pc_action = QAction(\n QIcon(r'pics\\add_pc.png'), 'Adicione um novo computador', self\n )\n pc_action.triggered.connect(self.add_pc)\n address_action = QAction(\n QIcon(r'pics\\add_address.png'), 'Adicionar novo endereço', self\n )\n address_action.triggered.connect(self.add_address)\n excel_action = QAction(\n QIcon(r'pics\\excel.png'), 'Excel', self\n )\n excel_action.triggered.connect(self.excel)\n toolbar = QToolBar()\n self.addToolBar(Qt.LeftToolBarArea, toolbar)\n toolbar.addActions(\n [employee_action, pc_action, address_action, excel_action]\n )\n\n def display_data(self):\n session = data.Session()\n try:\n self.employee_table = employees.EmployeeTable(session, self)\n self.pcs_table = pcs.PcsTable(session, self)\n tab_widget = QTabWidget()\n tab_widget.addTab(self.employee_table, \"Funcionários\")\n tab_widget.addTab(self.pcs_table, \"Computadores\")\n self.setCentralWidget(tab_widget)\n except exc.IntegrityError as errmsg:\n print(errmsg)\n session.rollback()\n session.close()\n msg = QMessageBox()\n msg.setIcon(QMessageBox.Critical)\n msg.setText(\"Erro crítico no banco de dados\")\n msg.setWindowTitle(\"Erro crítico\")\n msg.setDetailedText(errmsg)\n msg.setStandardButtons(QMessageBox.Ok)\n msg.buttonClicked.connect(sys.exit)\n\n def add_employee(self):\n session = data.Session()\n try:\n reg_employee_window = employee.RegisterEmployee(session)\n if reg_employee_window.exec_() == QDialog.Accepted:\n session.commit()\n QMessageBox.information(\n self, 'Notificação',\n 'Funcionário adicionado com sucesso'\n )\n QApplication.setOverrideCursor(Qt.WaitCursor)\n self.employee_table.set_filter_comboboxes()\n self.employee_table.fill_table()\n self.pcs_table.update_table_content()\n QApplication.restoreOverrideCursor()\n print(\"Zakommitili\")\n except exc.IntegrityError as errmsg:\n print(errmsg)\n session.rollback()\n msg = QMessageBox()\n msg.setIcon(QMessageBox.Critical)\n msg.setText(\"Erro crítico no banco de dados\")\n msg.setWindowTitle(\"Erro crítico\")\n msg.setDetailedText(errmsg)\n msg.setStandardButtons(QMessageBox.Ok)\n msg.buttonClicked.connect(sys.exit)\n else:\n print('Tudo com sucesso')\n finally:\n session.close()\n\n def add_pc(self):\n session = data.Session()\n try:\n reg_pc_window = pc.RegisterPC(session)\n if reg_pc_window.exec_() == QDialog.Accepted:\n session.commit()\n QMessageBox.information(\n self, 'Notificação',\n 'Computador adicionado com sucesso'\n )\n QApplication.setOverrideCursor(Qt.WaitCursor)\n self.employee_table.fill_table()\n self.pcs_table.update_table_content()\n QApplication.restoreOverrideCursor()\n except exc.IntegrityError as errmsg:\n print(errmsg)\n session.rollback()\n msg = QMessageBox()\n msg.setIcon(QMessageBox.Critical)\n msg.setText(\"Erro crítico no banco de dados\")\n msg.setWindowTitle(\"Erro crítico\")\n msg.setDetailedText(errmsg)\n msg.setStandardButtons(QMessageBox.Ok)\n msg.buttonClicked.connect(sys.exit)\n else:\n print('Tudo com sucesso')\n finally:\n session.close()\n\n def add_address(self):\n session = data.Session()\n try:\n address_window = address.ConfigureAddresses(session)\n if address_window.exec_() == QDialog.Accepted:\n session.commit()\n self.employee_table.set_filter_comboboxes()\n print(\"Zakommitili\")\n except exc.IntegrityError as errmsg:\n print(errmsg)\n session.rollback()\n msg = QMessageBox()\n msg.setIcon(QMessageBox.Critical)\n msg.setText(\"Erro crítico no banco de dados\")\n msg.setWindowTitle(\"Erro crítico\")\n msg.setDetailedText(errmsg)\n msg.setStandardButtons(QMessageBox.Ok)\n msg.buttonClicked.connect(sys.exit)\n else:\n print('Tudo com sucesso')\n finally:\n session.close()\n\n def excel(self):\n filename = QFileDialog.getSaveFileName(self, 'Salvar arquivo excel', filter='*.xlsx')\n if not filename[1]:\n return\n else:\n filename = filename[0]\n session = data.Session()\n try:\n QApplication.setOverrideCursor(Qt.WaitCursor)\n excel.run(filename, session)\n except PermissionError:\n QApplication.restoreOverrideCursor()\n QMessageBox.warning(\n self, 'A prevenção',\n 'Fechar {}\\n e tente novamente'.format(filename)\n )\n except OSError:\n QApplication.restoreOverrideCursor()\n QMessageBox.warning(\n self, 'Erro!',\n 'Tente um caminho diferente'\n )\n else:\n QApplication.restoreOverrideCursor()\n QMessageBox.information(\n self, 'Notificação',\n 'Gerada: {}'.format(filename)\n )\n finally:\n session.close()\n\n def set_and_center_the_window(self, x, y):\n self.resize(1280, 768)\n frame_geometry = self.frameGeometry()\n screen_center = QDesktopWidget().availableGeometry().center()\n frame_geometry.moveCenter(screen_center)\n self.move(frame_geometry.topLeft())\n\ndef run():\n app = QApplication([])\n\n splash_pix = QPixmap(r'pics\\splash_loading.png')\n splash = QSplashScreen(splash_pix, Qt.WindowStaysOnTopHint)\n splash.setMask(splash_pix.mask())\n splash.show()\n app.processEvents()\n\n login_window = login.LoginWindow()\n splash.finish(login_window)\n result = login_window.exec_()\n\n splash_pix = QPixmap(r'pics\\splash_loading.png')\n splash = QSplashScreen(splash_pix, Qt.WindowStaysOnTopHint)\n splash.setMask(splash_pix.mask())\n splash.show()\n app.processEvents()\n\n if result == QDialog.Accepted:\n main_window = MainWindow()\n splash.finish(main_window)\n else:\n sys.exit(result)\n\n sys.exit(app.exec_())\n" }, { "alpha_fraction": 0.5318518280982971, "alphanum_fraction": 0.6044444441795349, "avg_line_length": 34.578948974609375, "blob_id": "304397a709b5bcf9afb05b68e1d0f885f893819e", "content_id": "20ca44c94af5d8fc2657e1fbaf75969d489f005f", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 675, "license_type": "no_license", "max_line_length": 131, "num_lines": 19, "path": "/full - compara relatorios/teste.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import pandas as pd\nimport numpy as np\n\nfirstProductSet = {'Product1': ['Computer','Phone','Printer','Desk'],\n 'Price1': [1200,800,200,350]\n }\ndf1 = pd.DataFrame(firstProductSet,columns= ['Product1', 'Price1'])\n\n\nsecondProductSet = {'Product2': ['Computer','Phone','Printer','Desk',],\n 'Price2': [900,800,300,350]\n }\ndf2 = pd.DataFrame(secondProductSet,columns= ['Product2', 'Price2'])\n\n\ndf1['Price2'] = df2['Price2'] #add the Price2 column from df2 to df1\n\ndf1['pricesMatch?'] = np.where(df1['Price1'] == df2['Price2'], 'True', 'False') #create new column in df1 to check if prices match\nprint (df1)" }, { "alpha_fraction": 0.6056910753250122, "alphanum_fraction": 0.6097561120986938, "avg_line_length": 34.14285659790039, "blob_id": "ee6e9afb217237ec26f4f9e38f579b17e1abd7c6", "content_id": "0ce1b6e04481cc77ca9a2f8f1eec5cb1a216570e", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 246, "license_type": "no_license", "max_line_length": 58, "num_lines": 7, "path": "/fullcontrol_001/xml-ref1.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import xmltodict\n\nwith open('nfe.xml', 'rb') as arquivo:\n dados = arquivo.read().decode('UTF-8')\n doc = xmltodict.parse(dados)\n print(doc['nfeProc']['NFe']['infNFe']['emit']['CNPJ'])\n print(doc['nfeProc']['NFe']['infNFe']['@versao'])\n" }, { "alpha_fraction": 0.6435546875, "alphanum_fraction": 0.6435546875, "avg_line_length": 17.618181228637695, "blob_id": "8c3425732336e26872d8180ccf29c54e194c8beb", "content_id": "37469fdb6bb32cf51f33e617e8e1719ce1eaf93b", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1024, "license_type": "no_license", "max_line_length": 73, "num_lines": 55, "path": "/Hospital-Helper-2-master/app/model/exceptions.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "class AppNotReady(Exception):\n\n def __str__(self):\n return 'App is not ready yet'\n\n\nclass BadStructure(Exception):\n\n def __str__(self):\n return 'Bad Structure'\n\n\nclass NonUniqueObjectNames(BadStructure):\n\n def __init__(self, name):\n self.name = name\n\n def __str__(self):\n return 'Non-unique name found in structure: {}'.format(self.name)\n\n\nclass CannotSaveTemplate(Exception):\n\n def __str__(self):\n return 'Cannot save template'\n\n\nclass TemplateAlreadyExists(Exception):\n\n def __str__(self):\n return 'Template Already Exists'\n\n\nclass NeedBodyOrConclusion(Exception):\n\n def __str__(self):\n return 'Need body or conclusion for template'\n\n\nclass NoSuchTranslation(Exception):\n\n def __str__(self):\n return 'No such translation'\n\n\nclass Warning(Exception):\n\n def __str__(self):\n return 'Something bad happened, but it is not critical'\n\n\nclass NoTemplateForItem(Warning):\n\n def __str__(self):\n return 'No template found for item'\n" }, { "alpha_fraction": 0.7724137902259827, "alphanum_fraction": 0.7793103456497192, "avg_line_length": 47.66666793823242, "blob_id": "e85cc3c79793cf31480d4c580f19e92a1ec40c7b", "content_id": "80e518aed9da9f0795c8c3b81f1b91c6a6ead5ee", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 145, "license_type": "no_license", "max_line_length": 91, "num_lines": 3, "path": "/registro/reg-001.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "from winreg import *\nkey = OpenKey(HKEY_LOCAL_MACHINE, r'Software\\Microsoft\\Outlook Express', 0, KEY_ALL_ACCESS)\nQueryValueEx(key, \"InstallRoot\")" }, { "alpha_fraction": 0.6150000095367432, "alphanum_fraction": 0.6200000047683716, "avg_line_length": 17.904762268066406, "blob_id": "2c903a2d5eb3e74ed75509f22162d91cb6cb0fc9", "content_id": "fb17ffcaedc850cb931a43135678006a8d0d41d2", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 400, "license_type": "no_license", "max_line_length": 31, "num_lines": 21, "path": "/PQt5-Stock/Modelo/marca.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nclass Marca(object):\n\t\"\"\"docstring for Marca\"\"\"\n\tdef __init__(self):\n\t\tsuper(Marca, self).__init__()\n\t\tself.__idMarca = 0\n\t\tself.__marca = \"\"\n\n\tdef setIdMarca(self, idMarca):\n\t\tself.__idMarca = idMarca\n\t\n\tdef getIdMarca(self):\n\t\treturn self.__idMarca\n\t\n\tdef setMarca(self, marca):\n\t\tself.__marca = marca\n\t\t\n\tdef getMarca(self):\n\t\treturn self.__marca\n\n\t\n" }, { "alpha_fraction": 0.6362637281417847, "alphanum_fraction": 0.6857143044471741, "avg_line_length": 33.96154022216797, "blob_id": "9fe04212c7eb9329981efa9b2934b784c5b502b8", "content_id": "661ee4c92a5c77fb7f55a3529eca6b38b4cec135", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 910, "license_type": "no_license", "max_line_length": 206, "num_lines": 26, "path": "/fullodbc/nfs51-nre56.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import sys\nimport pyodbc\n\ncnxn = pyodbc.connect('DSN=p;UID=system')\ncursor = cnxn.cursor()\ndata = []\ncolumns = []\ncolumns.append('cliente')\ncolumns.append('nome')\ncolumns.append('email')\n\n# cursor.execute(\"select nfc_data, nfc_especie, nfc_serie, nfc_numero from aivenfcp \\\n# where nfc_empresa = 51 and nfc_fco = 24907602000519 and nfc_serie = '2' and nfc_opefis = 28 or nfc_opefis = 77\")\n\nfor row in cursor.execute(\n \"select nfc_data, nfc_especie, nfc_serie, nfc_numero, nre_ident from aivenfcp left join aimanrep on nfc_fco = nre_fco and nfc_serie = nre_serie and nre_especie = nre_especie and nfc_numero = nre_numdoc \n where nfc_empresa = 51 and nre_empresa = 56 and nfc_fco = 24907602000519 and nfc_especie <> 'VEN' and nfc_opefis = 28 and nre_numdoc is NULL\"):\n print(row)\n\n# rows = cursor.fetchall()\n# conta = 0\n# lidos = 0\n# for row in rows:\n# # lidos+=1\n# print(row)\n# # conta+=1\n\n" }, { "alpha_fraction": 0.6167147159576416, "alphanum_fraction": 0.6442980766296387, "avg_line_length": 29.746835708618164, "blob_id": "769effa4fe6a2fe0883c54db0f8992616b653f54", "content_id": "cea606adb27ceb09e1a61f9ee63854622e5fe206", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2429, "license_type": "permissive", "max_line_length": 74, "num_lines": 79, "path": "/opencv/RealidadeAumentada-master/main.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import cv2\nimport numpy as np\nimport argparse\n\nparser = argparse.ArgumentParser(description='Realidade Aumentada')\nparser.add_argument('--image', default='marcadores/mako.png',\n help='Imagem a ser projetada')\nparser.add_argument('--board', default='marcadores/board_aruco.png',\n help='Imagem do tabuleiro ArUco')\nparser.add_argument('--save', action='store_true',\n help='Salvar foto do experimento')\n\nargs = parser.parse_args()\n\ncap = cv2.VideoCapture(0)\n# cap.set(cv2.CAP_PROP_FRAME_WIDTH, 320)\n# cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 240)\ncap.set(cv2.CAP_PROP_FRAME_WIDTH, 640)\ncap.set(cv2.CAP_PROP_FRAME_HEIGHT, 480)\ndictionary = cv2.aruco.Dictionary_get(cv2.aruco.DICT_6X6_250)\n\n_, frame = cap.read()\norig_shape = (frame.shape[:2])[::-1]\n\naruco_img = cv2.imread(args.board)\naruco_img = cv2.cvtColor(aruco_img, cv2.COLOR_BGR2RGB)\nheight, width, _ = aruco_img.shape\norig_corners, orig_ids, _ = cv2.aruco.detectMarkers(aruco_img, dictionary)\n\nwaifu = cv2.imread(args.image)\nwaifu = cv2.resize(waifu.transpose(1, 0, 2), (width, height))\n\nwhite = np.zeros((height, width, 3), dtype=np.uint8)\nwhite[::] = 255\n\nc = 0\n\n\ndef match_corners(ids, orig_corners=orig_corners, orig_ids=orig_ids):\n result = []\n for i in ids:\n idx, _ = np.where(orig_ids == i[0])\n result.append(orig_corners[idx[0]])\n return np.array(result)\n\n\nwhile True:\n # Capture frame-by-frame\n ret, frame = cap.read()\n\n corners, ids, rejected = cv2.aruco.detectMarkers(frame, dictionary)\n\n if ids is not None:\n orig = match_corners(ids)\n dest = np.array(corners)\n orig = orig.reshape(-1, orig.shape[-1])\n dest = dest.reshape(-1, dest.shape[-1])\n homography, _ = cv2.findHomography(orig, dest)\n final = cv2.warpPerspective(white, homography, orig_shape)\n curr_waifu = cv2.warpPerspective(waifu, homography, orig_shape)\n mask = cv2.bitwise_not(final)\n res = (mask & frame) | curr_waifu\n cv2.imshow('frame', res)\n if c > 100 and args.save:\n cv2.imwrite('marcadores/example.png', res)\n break\n else:\n # Display the resulting frame\n img = cv2.aruco.drawDetectedMarkers(frame, corners)\n cv2.imshow('frame', img)\n\n if cv2.waitKey(1) & 0xFF == ord('q'):\n break\n\n c += 1\n\n# When everything done, release the capture\ncap.release()\ncv2.destroyAllWindows()\n" }, { "alpha_fraction": 0.5689922571182251, "alphanum_fraction": 0.648061990737915, "avg_line_length": 28.363636016845703, "blob_id": "0432e4149b6529c207278bfd0a235450967f1607", "content_id": "029d06a6fefb26a92cae1fccee92b03253310125", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 645, "license_type": "no_license", "max_line_length": 124, "num_lines": 22, "path": "/crt/crt-teste.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import sys\nfrom ctypes import windll\nwindll.kernel32.SetConsoleMode(windll.kernel32.GetStdHandle(-11), 7)\n#set ansi(vt100) control code interpreted\n#https://stackoverflow.com/questions/36760127/how-to-use-the-new-support-for-ansi-escape-sequences-in-the-windows-10-console\nshow = lambda s: sys.stdout.write(s)\nfor b in range(30, 38):\n for f in range(40, 48):\n print(\"\\x1b[0;%d;%dm %d,%d \\x1b[0m\"% (b,f,b,f), end=\"\")\n print()\n\nfor b in range(30, 38):\n for f in range(40, 48):\n print(\"\\x1b[1;%d;%dm %d,%d \\x1b[0m\"% (b,f,b,f), end=\"\")\n print()\n\ninput()\nshow(\"\\x1b[40m\")\nshow(\"\\x1b[2J\")\ninput()\nshow(\"\\x1b[H\\x1b[J\")\ninput()" }, { "alpha_fraction": 0.5842751264572144, "alphanum_fraction": 0.5873536467552185, "avg_line_length": 38.061710357666016, "blob_id": "e2cd3218dc8b7a1bc9dcc37f20707375c0ce34cb", "content_id": "49269b062c4740fbc0b9c9fc0a0b43e9ba70e798", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 24950, "license_type": "no_license", "max_line_length": 111, "num_lines": 632, "path": "/PyQT-CRUD-App/app/editdialogs/employee.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/python3\n# -*- coding: utf-8 -*-\n\"\"\"\nРедактирование информации о сотруднике\nEditando informações do funcionário\n\"\"\"\nfrom app.db import data\nfrom app.tools.functions import get_or_create\nfrom app.tools.exitmethods import Dialog\nfrom app.tablewidgets.pcsadd import PCAdd\nfrom PyQt5 import *\nfrom PyQt5.QtWidgets import *\nfrom PyQt5.QtGui import *\nfrom PyQt5.QtCore import *\nfrom PyQt5.Qt import *\n\n\nclass EmployeeInfo(Dialog):\n def __init__(self, session, employee):\n QDialog.__init__(self)\n self.session = session\n self.employee = employee\n self.sti = QStandardItemModel()\n self.fill_table_model()\n\n QStackedLayout(self)\n\n self.read_only_widget = self.get_read_only_widget()\n self.setLabelsText()\n self.edit_info_widget = self.get_edit_info_widget()\n self.setLineEdits()\n\n self.layout().addWidget(self.read_only_widget)\n self.layout().addWidget(self.edit_info_widget)\n self.layout().setCurrentIndex(0)\n\n self.init_window()\n\n def init_window(self):\n self.setFixedSize(800, 450)\n self.setWindowModality(2)\n self.setWindowTitle(\n '{} <{}>'.format(\n self.employee.fullname,\n self.employee.unique_login\n )\n )\n self.setWindowIcon(QIcon(r'pics\\employee.png'))\n\n def fill_table_model(self):\n self.sti.setHorizontalHeaderLabels(\n # ['Домен', 'Имя компьютера', 'MAC-адрес', 'Номер розетки',\n # 'Как подключен', 'Серверные приложения',\n # 'Windows OS', 'Windows OS key', 'Microsoft Office',\n # 'Microsoft Office key', 'Антивирус', 'Клиент электронной почты',\n # 'Прочее', 'Агент KES', 'Консультант', 'Гарант', '1C', 'КДС']\n ['Domínio', 'Nome do computador', 'Endereço MAC', 'Número de socket',\n 'Como conectado', 'Aplicativos de servidor',\n 'Sistema operacional Windows', 'Windows OS key', 'Microsoft Office',\n 'Chave do Microsoft Office', 'Anti-Virus', 'Cliente de email',\n 'Outro', 'Agente KES', 'Consultor', 'Fiador', '1C', 'KDS'] \n )\n for pc in self.employee.pc:\n self.new_row(pc)\n\n def get_read_only_widget(self):\n read_only_widget = QWidget()\n read_only_layout = QFormLayout(read_only_widget)\n read_only_layout.setSpacing(10)\n ############################################################\n self.back_button = QPushButton('Sair')\n self.back_button.clicked.connect(self.reject)\n self.edit_button = QPushButton('Editar')\n self.edit_button.clicked.connect(self.edit_employee_info)\n self.delete_button = QPushButton('Remover')\n self.delete_button.clicked.connect(self.delete_employee)\n ############################################################\n buttons_layout = QHBoxLayout()\n buttons_layout.addStretch()\n buttons_layout.addWidget(self.back_button)\n buttons_layout.addWidget(self.edit_button)\n buttons_layout.addWidget(self.delete_button)\n\n self.fio_label = QLabel()\n self.fio_label.setTextInteractionFlags(Qt.TextSelectableByMouse)\n read_only_layout.addRow(\n '<b>Sobrenome:</b>', self.fio_label\n )\n self.login_label = QLabel()\n self.login_label.setTextInteractionFlags(Qt.TextSelectableByMouse)\n read_only_layout.addRow(\n '<b>Login:</b>', self.login_label\n )\n self.phone_label = QLabel()\n self.phone_label.setTextInteractionFlags(Qt.TextSelectableByMouse)\n read_only_layout.addRow(\n '<b>Telefones:</b>', self.phone_label\n )\n self.email_label = QLabel()\n self.email_label.setTextInteractionFlags(Qt.TextSelectableByMouse)\n read_only_layout.addRow(\n '<b>E-mails:</b>', self.email_label\n )\n self.position_label = QLabel()\n self.position_label.setTextInteractionFlags(Qt.TextSelectableByMouse)\n read_only_layout.addRow(\n '<b>Posição:</b>', self.position_label\n )\n self.department_label = QLabel()\n self.department_label.setTextInteractionFlags(Qt.TextSelectableByMouse)\n read_only_layout.addRow(\n '<b>Departamento:</b>', self.department_label\n )\n self.address_label = QLabel()\n self.address_label.setTextInteractionFlags(Qt.TextSelectableByMouse)\n read_only_layout.addRow(\n '<b>Local de trabalho:</b>', self.address_label\n )\n self.shared_folder_label = QLabel()\n read_only_layout.addRow(\n '<b>Pastas compartilhadas:</b>', self.shared_folder_label\n )\n self.network_printer_label = QLabel()\n read_only_layout.addRow(\n '<b>Impressora de rede:</b>', self.network_printer_label\n )\n self.comments_label = QLabel()\n self.comments_label.setTextInteractionFlags(Qt.TextSelectableByMouse)\n read_only_layout.addRow(\n '<b>Outro:</b>', self.comments_label\n )\n\n table = QTableView()\n table.setSelectionMode(QAbstractItemView.SingleSelection)\n table.setEditTriggers(QAbstractItemView.NoEditTriggers)\n table.setTextElideMode(Qt.ElideNone)\n table.setAlternatingRowColors(True)\n table.setModel(self.sti)\n table.resizeColumnsToContents()\n read_only_layout.addRow(table)\n read_only_layout.addRow(buttons_layout)\n return read_only_widget\n\n def setLabelsText(self):\n self.fio_label.setText(' '.join([self.employee.surname, self.employee.name, self.employee.patronymic]))\n self.login_label.setText(self.employee.unique_login)\n self.phone_label.setText('; '.join([phone.number for phone in self.employee.phone]))\n self.email_label.setText('; '.join([email.email for email in self.employee.email]))\n self.position_label.setText(self.employee.position.name)\n self.department_label.setText(self.employee.department.name)\n self.address_label.setText(\n \"{}; {}; {}\".format(\n self.employee.room.block.address.name,\n self.employee.room.block.name,\n self.employee.room.name\n )\n )\n self.shared_folder_label.setText('Existem' if self.employee.shared_folder else 'Não')\n self.network_printer_label.setText('Existem' if self.employee.network_printer else 'Não')\n self.comments_label.setText(self.employee.comments)\n\n def get_edit_info_widget(self):\n edit_info_widget = QWidget()\n edit_info_layout = QFormLayout(edit_info_widget)\n ############################################################\n self.back_button = QPushButton('Voltar')\n self.back_button.clicked.connect(self.back)\n self.refresh_button = QPushButton('Reset')\n self.refresh_button.clicked.connect(self.refresh)\n self.edit_button = QPushButton('Salvar e sair')\n self.edit_button.clicked.connect(self.validate_input)\n\n buttons_layout = QHBoxLayout()\n buttons_layout.addStretch()\n buttons_layout.addWidget(self.back_button)\n buttons_layout.addWidget(self.refresh_button)\n buttons_layout.addWidget(self.edit_button)\n\n self.surname_edit = QLineEdit()\n self.surname_edit.setValidator(QRegExpValidator(QRegExp(\"[^ ]+\")))\n edit_info_layout.addRow(\n '<b>Sobrenome:<font color=\"red\">*</font></b>', self.surname_edit\n )\n self.name_edit = QLineEdit()\n self.name_edit.setValidator(QRegExpValidator(QRegExp(\"[^ ]+\")))\n edit_info_layout.addRow(\n '<b>Nome:<font color=\"red\">*</font></b>', self.name_edit\n )\n self.patronymic_edit = QLineEdit()\n self.patronymic_edit.setValidator(QRegExpValidator(QRegExp(\"[^ ]+\")))\n edit_info_layout.addRow(\n '<b>Nome do meio:</b>', self.patronymic_edit\n )\n self.login_edit = QLineEdit()\n self.login_edit.setValidator(QRegExpValidator(QRegExp(\"[^ ]+\")))\n edit_info_layout.addRow(\n '<b>Login:<font color=\"red\">*</font></b>', self.login_edit\n )\n\n phones_layout = QHBoxLayout()\n self.phone1_edit = QLineEdit()\n self.phone2_edit = QLineEdit()\n self.phone3_edit = QLineEdit()\n phones_layout.addWidget(self.phone1_edit)\n phones_layout.addWidget(self.phone2_edit)\n phones_layout.addWidget(self.phone3_edit)\n edit_info_layout.addRow(\n '<b>Telefones:</b>', phones_layout\n )\n\n emails_layout = QHBoxLayout()\n self.email1_edit = QLineEdit()\n self.email2_edit = QLineEdit()\n self.email3_edit = QLineEdit()\n emails_layout.addWidget(self.email1_edit)\n emails_layout.addWidget(self.email2_edit)\n emails_layout.addWidget(self.email3_edit)\n edit_info_layout.addRow(\n '<b>E-mails:</b>', emails_layout\n )\n\n self.position_edit = QComboBox()\n self.position_edit.setEditable(True)\n edit_info_layout.addRow(\n '<b>Posição:</b>', self.position_edit\n )\n\n self.department_edit = QComboBox()\n self.department_edit.setEditable(True)\n edit_info_layout.addRow(\n '<b>Departamento:</b>', self.department_edit\n )\n\n self.address_edit = QComboBox()\n self.address_edit.currentIndexChanged[str].connect(\n self.changed_item_in_address_combobox\n )\n edit_info_layout.addRow(\n '<b>Endereço:<font color=\"red\">*</font></b>', self.address_edit\n )\n\n self.block_edit = QComboBox()\n edit_info_layout.addRow(\n '<b>Habitação:<font color=\"red\">*</font></b>', self.block_edit\n )\n\n self.room_edit = QLineEdit()\n edit_info_layout.addRow(\n '<b>Sala:<font color=\"red\">*</font></b>', self.room_edit\n )\n\n self.comments_edit = QLineEdit()\n edit_info_layout.addRow(\n '<b>Outro:</b>', self.comments_edit\n )\n\n self.shared_folder_edit = QCheckBox()\n edit_info_layout.addRow(\n '<b>Pastas compartilhadas:</b>', self.shared_folder_edit\n )\n\n self.network_printer_edit = QCheckBox()\n edit_info_layout.addRow(\n '<b>Impressora de rede:</b>', self.network_printer_edit\n )\n self.table = QTableView()\n self.table.setSelectionBehavior(QAbstractItemView.SelectRows)\n self.table.setSelectionMode(QAbstractItemView.SingleSelection)\n self.table.setEditTriggers(QAbstractItemView.NoEditTriggers)\n self.table.setTextElideMode(Qt.ElideNone)\n self.table.setAlternatingRowColors(True)\n self.table.setModel(self.sti)\n self.table.resizeColumnsToContents()\n edit_info_layout.addRow(self.table)\n\n table_buttons_layout = QHBoxLayout()\n add_table_row_button = QPushButton('Adicione um computador')\n add_table_row_button.setFixedSize(add_table_row_button.sizeHint())\n add_table_row_button.clicked.connect(self.add_table_row)\n delete_table_row_button = QPushButton('Soltar o computador')\n delete_table_row_button.setFixedSize(delete_table_row_button.sizeHint())\n delete_table_row_button.clicked.connect(self.delete_table_row)\n table_buttons_layout.addWidget(delete_table_row_button)\n table_buttons_layout.addWidget(add_table_row_button)\n table_buttons_layout.addStretch()\n\n edit_info_layout.addRow(table_buttons_layout)\n edit_info_layout.addRow(buttons_layout)\n return edit_info_widget\n\n def setLineEdits(self):\n self.surname_edit.setText(self.employee.surname)\n self.name_edit.setText(self.employee.name)\n self.patronymic_edit.setText(self.employee.patronymic)\n self.login_edit.setText(self.employee.unique_login)\n\n try:\n self.phone1_edit.setText(self.employee.phone[0].number)\n except IndexError:\n pass\n try:\n self.phone2_edit.setText(self.employee.phone[1].number)\n except IndexError:\n pass\n try:\n self.phone3_edit.setText(self.employee.phone[2].number)\n except IndexError:\n pass\n\n try:\n self.email1_edit.setText(self.employee.email[0].email)\n except IndexError:\n pass\n try:\n self.email2_edit.setText(self.employee.email[1].email)\n except IndexError:\n pass\n try:\n self.email3_edit.setText(self.employee.email[2].email)\n except IndexError:\n pass\n\n self.position_edit.addItems(\n self.session.query(data.Position.name).values()\n )\n self.position_edit.setCurrentText(self.employee.position.name)\n\n self.department_edit.addItems(\n self.session.query(data.Department.name).values()\n )\n self.department_edit.setCurrentText(self.employee.department.name)\n\n self.address_edit.addItems(\n self.session.query(data.Address.name).values()\n )\n index = self.address_edit.findText(self.employee.room.block.address.name, Qt.MatchFixedString)\n if index >= 0:\n self.address_edit.setCurrentIndex(index)\n\n self.block_edit.addItems(\n self.session.query(data.Block.name). \\\n join(data.Address). \\\n filter(data.Address.name == self.address_edit.currentText()). \\\n values()\n )\n index = self.block_edit.findText(self.employee.room.block.name, Qt.MatchFixedString)\n if index >= 0:\n self.block_edit.setCurrentIndex(index)\n\n self.room_edit.setText(self.employee.room.name)\n self.comments_edit.setText(self.employee.comments)\n if self.employee.shared_folder:\n self.shared_folder_edit.setChecked(True)\n if self.employee.network_printer:\n self.network_printer_edit.setChecked(True)\n\n @pyqtSlot()\n def delete_employee(self):\n msg_box = QMessageBox(self)\n msg_box.setIcon(QMessageBox.Question)\n msg_box.setWindowTitle('Notificação')\n msg_box.setText('Confirme a exclusão')\n msg_box.setStandardButtons(QMessageBox.Yes | QMessageBox.No)\n buttonY = msg_box.button(QMessageBox.Yes)\n buttonY.setText('Sim')\n buttonN = msg_box.button(QMessageBox.No)\n buttonN.setText('Não')\n msg_box.exec_()\n\n if msg_box.clickedButton() == buttonY:\n try:\n self.session.delete(self.employee)\n except Exception:\n QMessageBox.warning(\n self, 'Erro',\n 'Outro usuário inseriu alterações'\n )\n finally:\n QDialog.accept(self)\n\n @pyqtSlot()\n def edit_employee_info(self):\n self.layout().setCurrentIndex(1)\n self.setFixedSize(800, 600)\n\n @pyqtSlot()\n def back(self):\n msg_box = QMessageBox(self)\n msg_box.setIcon(QMessageBox.Question)\n msg_box.setWindowTitle('Notificação')\n msg_box.setText('Os dados não serão salvos.')\n msg_box.setStandardButtons(QMessageBox.Yes | QMessageBox.No)\n buttonY = msg_box.button(QMessageBox.Yes)\n buttonY.setText('Ok')\n buttonN = msg_box.button(QMessageBox.No)\n buttonN.setText('Desfazer')\n msg_box.exec_()\n\n if msg_box.clickedButton() == buttonY:\n self.session.rollback()\n self.sti.clear()\n self.fill_table_model()\n self.setLabelsText()\n self.setLineEdits()\n self.layout().setCurrentIndex(0)\n self.setFixedSize(800, 450)\n\n @pyqtSlot(data.Pc)\n def new_row(self, pc):\n self.sti.appendRow([\n QStandardItem(QIcon(r'pics\\pc.png'), pc.pcname.domain.name),\n QStandardItem(pc.pcname.name),\n QStandardItem(pc.mac_address),\n QStandardItem(pc.powersocket.name),\n QStandardItem(pc.connectiontype.name),\n QStandardItem(pc.app_server),\n QStandardItem(pc.windows.name),\n QStandardItem(pc.windows_os_key),\n QStandardItem(pc.office.name),\n QStandardItem(pc.ms_office_key),\n QStandardItem(pc.antivirus.name),\n QStandardItem(pc.mail_client),\n QStandardItem(pc.comments),\n QStandardItem('Existem' if pc.kes else 'Não'),\n QStandardItem('Existem' if pc.consultant else 'Não'),\n QStandardItem('Existem' if pc.guarantee else 'Não'),\n QStandardItem('Existem' if pc.odin_s else 'Não'),\n QStandardItem('Existem' if pc.kdc else 'Não')\n ])\n\n @pyqtSlot()\n def delete_table_row(self):\n index = self.table.selectionModel().selectedRows()\n try:\n element = self.sti.takeRow(index[0].row())\n except IndexError:\n QMessageBox.warning(\n self, 'Erro',\n 'Selecione a linha na tabela'\n )\n return\n pc = self.session.query(data.Pc). \\\n with_parent(self.employee). \\\n filter(data.Pc.mac_address == element[2].text()). \\\n one()\n self.employee.pc.remove(pc)\n\n @pyqtSlot()\n def add_table_row(self):\n add_pcs = PCAdd(self.session, self.employee.pc)\n if add_pcs.exec_() == QDialog.Accepted:\n for pc in add_pcs.added_pcs:\n self.new_row(pc)\n self.employee.pc.append(pc)\n self.table.resizeColumnsToContents()\n\n @pyqtSlot()\n def refresh(self):\n self.session.rollback()\n self.setLineEdits()\n self.sti.clear()\n self.fill_table_model()\n\n @pyqtSlot()\n def validate_input(self):\n if not self.surname_edit.text() \\\n or not self.name_edit.text() \\\n or not self.room_edit.text() \\\n or not self.login_edit.text():\n QMessageBox.warning(\n # self, 'Предупреждение',\n # \"Поля: 'Фамилия', 'Имя', 'Логин', 'Комната'\" +\n # \" -- обязательныe\"\n self, 'Atenção',\n \"Campos: 'Sobrenome', 'Nome', 'Login', 'Sala'\" +\n \" -- obrigatórios\"\n )\n return\n\n phones = [self.phone1_edit.text(), self.phone2_edit.text(), self.phone3_edit.text()]\n phones[:] = [phone for phone in phones if phone]\n if len(set(phones)) < len(phones) and len(phones) > 0:\n QMessageBox.warning(\n self, 'Atenção', 'Telefones são os mesmos'\n )\n return\n\n emails = [self.email1_edit.text(), self.email2_edit.text(), self.email3_edit.text()]\n emails[:] = [email for email in emails if email]\n if len(set(emails)) < len(emails) and len(emails) > 0:\n QMessageBox.warning(\n self, 'Aviso', 'Correspondência de e-mail'\n )\n return\n\n for phone in [self.phone1_edit, self.phone2_edit, self.phone3_edit]:\n stmt = self.session.query(data.Phone). \\\n join(data.Employee). \\\n filter(data.Employee.name != self.employee.name). \\\n filter(data.Phone.number == phone.text())\n\n if self.session.query(stmt.exists()).scalar():\n QMessageBox.warning(\n self, 'Aviso', 'O telefone digitado já está no banco de dados'\n )\n return\n\n for email in [self.email1_edit, self.email2_edit, self.email3_edit]:\n stmt = self.session.query(data.Email). \\\n join(data.Employee). \\\n filter(data.Employee.name != self.employee.name). \\\n filter(data.Email.email == email.text())\n\n if self.session.query(stmt.exists()).scalar():\n QMessageBox.warning(\n self, 'Aviso', 'O e-mail inserido já existe no banco de dados'\n )\n return\n\n stmt = self.session.query(data.Employee). \\\n filter(data.Employee.unique_login == self.login_edit.text()). \\\n filter(data.Employee.unique_login != self.employee.unique_login)\n if self.session.query(stmt.exists()).scalar():\n QMessageBox.warning(\n self, 'Aviso', 'O login inserido já existe no banco de dados'\n )\n return\n try:\n update_database()\n except Exception:\n QMessageBox.warning(self, 'Erro', 'Outro usuário inseriu alterações')\n self.accept()\n\n def update_database():\n if self.employee.surname != self.surname_edit.text():\n self.employee.surname = self.surname_edit.text()\n if self.employee.name != self.name_edit.text():\n self.employee.name = self.name_edit.text()\n if self.employee.patronymic != self.patronymic_edit.text():\n self.employee.patronymic = self.patronymic_edit.text()\n if self.employee.unique_login != self.login_edit.text():\n self.employee.unique_login = self.login_edit.text()\n\n for phone in self.employee.phone:\n if phone.number not in phones:\n self.session.delete(phone)\n else:\n phones.remove(phone.number)\n self.employee.phone.extend([data.Phone(number=phone) for phone in phones])\n\n for email in self.employee.email:\n if email.email not in emails:\n self.session.delete(email)\n else:\n emails.remove(email.email)\n self.employee.email.extend([data.Email(email=email) for email in emails])\n\n if self.employee.position.name != self.position_edit.currentText():\n self.employee.position = (\n get_or_create(\n self.session, data.Position,\n name=self.position_edit.currentText()\n )\n )\n\n if self.employee.department.name != self.department_edit.currentText():\n self.employee.department = (\n get_or_create(\n self.session, data.Department,\n name=self.department_edit.currentText()\n )\n )\n\n block = self.session.query(data.Block). \\\n join(data.Address). \\\n filter(data.Block.name == self.block_edit.currentText()). \\\n filter(data.Address.name == self.address_edit.currentText()). \\\n one()\n room = self.session.query(data.Room). \\\n join(data.Block). \\\n filter(data.Room.name == self.room_edit.text()). \\\n first()\n if not room:\n room = data.Room(name=self.room_edit.text())\n room.block = block\n self.employee.room = room\n elif self.employee.room != room:\n self.employee.room = room\n else:\n pass\n if self.employee.comments != self.comments_edit.text():\n self.employee.comments = self.comments_edit.text()\n if self.employee.shared_folder != self.shared_folder_edit.isChecked():\n self.employee.shared_folder = self.shared_folder_edit.isChecked()\n if self.employee.network_printer != self.network_printer_edit.isChecked():\n self.employee.network_printer = self.network_printer_edit.isChecked()\n\n if not self.accept():\n self.session.rollback()\n self.sti.clear()\n self.fill_table_model()\n\n @pyqtSlot(str)\n def changed_item_in_address_combobox(self, index):\n self.block_edit.clear()\n items = self.session.query(data.Block.name). \\\n join(data.Address). \\\n filter(data.Address.name == index). \\\n values()\n self.block_edit.addItems(items)\n\n def closeEvent(self, evnt):\n if self.layout().currentIndex() == 0:\n QDialog.closeEvent(self, evnt)\n else:\n msg_box = QMessageBox(self)\n msg_box.setIcon(QMessageBox.Question)\n msg_box.setWindowTitle('Notificação')\n msg_box.setText('Os dados não serão salvos.')\n msg_box.setStandardButtons(\n QMessageBox.Yes | QMessageBox.Cancel\n )\n buttonY = msg_box.button(QMessageBox.Yes)\n buttonY.setText('Sair')\n buttonN = msg_box.button(QMessageBox.Cancel)\n buttonN.setText('Cancelar')\n msg_box.exec_()\n\n if msg_box.clickedButton() == buttonY:\n QDialog.closeEvent(self, evnt)\n elif msg_box.clickedButton() == buttonN:\n evnt.ignore()\n" }, { "alpha_fraction": 0.6127080321311951, "alphanum_fraction": 0.6142208576202393, "avg_line_length": 30.309524536132812, "blob_id": "9a88f55564736a10564a0611d4d95c387bf5bd6a", "content_id": "bb9cc2896a0b6b5339e97c20a5629f2c6328d1d6", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1322, "license_type": "no_license", "max_line_length": 67, "num_lines": 42, "path": "/PQt5-Stock/Componentes/tableModel.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import operator\nfrom PyQt5.QtCore import *\n\n\n\nclass MyTableModel(QAbstractTableModel):\n def __init__(self, parent, mylist, header, *args):\n QAbstractTableModel.__init__(self, parent, *args)\n self.mylist = mylist\n self.header = header\n\n def rowCount(self, parent):\n return len(self.mylist)\n\n def columnCount(self, parent):\n return len(self.mylist[0])\n\n def data(self, index, role):\n if not index.isValid():\n return QVariant()\n elif role != Qt.DisplayRole:\n return QVariant()\n return QVariant(self.mylist[index.row()][index.column()])\n\n def headerData(self, col, orientation, role):\n if orientation == Qt.Horizontal and role == Qt.DisplayRole:\n return QVariant(self.header[col])\n return QVariant()\n\n def sort(self, col, order):\n \"\"\"sort table by given column number col\"\"\"\n #asd = QAbstractTableModel\n\n #self.sort(self, len(self.mylist))\n #self.emit(pyqtSignal(\"layoutAboutToBeChanged()\"))\n self.senderSignalIndex()\n self.mylist = sorted(self.mylist,\n key=operator.itemgetter(col))\n if order == Qt.DescendingOrder:\n self.mylist.reverse()\n QCoreApplication.processEvents()\n #self.emit(SIGNAL(\"layoutChanged()\")) " }, { "alpha_fraction": 0.572062075138092, "alphanum_fraction": 0.5775469541549683, "avg_line_length": 36.91592788696289, "blob_id": "bffcefd14d9946610e42abc5949366e2c2c9a5ed", "content_id": "e70c1142c24801ee47104d59332d97c1f77d6510", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 8734, "license_type": "no_license", "max_line_length": 119, "num_lines": 226, "path": "/Hospital-Helper-2-master/app/gui/users_and_groups_widget.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import os\nimport functools\n\nfrom bs4 import BeautifulSoup\n\nfrom PyQt5.QtCore import Qt\nfrom PyQt5.QtGui import QIcon\nfrom PyQt5.QtWidgets import (QFrame, QHBoxLayout, QLabel, QVBoxLayout, QComboBox,\n QPushButton, QTextEdit, QWidget)\n\nfrom app import options\nfrom app.model import db\n\nfrom app.gui.crud_widget import CrudWidget\nfrom app.gui.text_edit_with_format_controls import TextEditWithFormatControls\nfrom app.gui import utils\n\n\nclass UsersAndGroupsWidget(QFrame):\n \"\"\"\n Provide the way to add or delete groups and also dit group name and header.\n \"\"\"\n\n def __init__(self, main_window, parent):\n super().__init__()\n\n self._groups_combo_box = None\n self._users_layout = None\n self._text_field = None\n self._related_to_group_buttons = []\n self.show_message = main_window.communication.set_message_text.emit\n self._show_crud = self._get_crud_func(main_window)\n self.showEvent = self._get_show_event(main_window)\n self._delete = self._get_delete_func(main_window)\n self._select_user = self._get_select_user(main_window)\n self.groups = []\n self.users = []\n self._selected_group = None\n\n self._create_layout(parent)\n\n def _create_layout(self, parent):\n self._groups_combo_box = QComboBox()\n self._users_layout = QVBoxLayout()\n self._text_field = TextEditWithFormatControls()\n\n # self._text_field.setPlaceholderText('Заголовок появится в начале отчета')\n self._text_field.setPlaceholderText('Um título aparecerá no início do relatório.')\n self._groups_combo_box.currentIndexChanged.connect(self._group_selected)\n\n layout = QHBoxLayout()\n layout.setContentsMargins(15, 15, 15, 15)\n layout.setSpacing(20)\n\n right_side = QVBoxLayout()\n right_side.setContentsMargins(0, 0, 0, 0)\n right_side.setSpacing(0)\n hbox = QHBoxLayout()\n hbox.setContentsMargins(0, 0, 0, 0)\n hbox.setSpacing(0)\n for i, f in zip(('save_w', 'delete'), (self._save, self._delete)):\n b = QPushButton()\n b.setIcon(QIcon(os.path.join(options.STATIC_DIR, 'icons', i)))\n b.setObjectName('button')\n b.clicked.connect(f)\n hbox.addWidget(b)\n self._related_to_group_buttons.append(b)\n hbox.addSpacing(5)\n hbox.addStretch()\n right_side.addLayout(hbox)\n right_side.addSpacing(5)\n # l = QLabel('Заголовок')\n l = QLabel('Headline')\n l.setObjectName('text-header')\n right_side.addWidget(l)\n right_side.addWidget(self._text_field)\n\n left_side = QVBoxLayout()\n left_side.setContentsMargins(0, 0, 0, 0)\n left_side.setSpacing(0)\n left_side.addWidget(self._groups_combo_box)\n wrapper = QWidget()\n hbox = QHBoxLayout()\n hbox.setContentsMargins(0, 0, 0, 0)\n hbox.setSpacing(0)\n # l = QLabel('Пользователи')\n l = QLabel('Usuários')\n l.setObjectName('header')\n hbox.addWidget(l)\n hbox.addStretch()\n b = QPushButton()\n b.setIcon(QIcon(os.path.join(options.STATIC_DIR, 'icons', 'plus')))\n b.clicked.connect(functools.partial(self._show_crud, db.User))\n hbox.addWidget(b)\n wrapper.setLayout(hbox)\n wrapper.setObjectName('header')\n left_side.addWidget(wrapper)\n left_side.addWidget(utils.get_scrollable(self._users_layout))\n # b = QPushButton('Назад')\n b = QPushButton('Voltar')\n b.setObjectName('button')\n b.clicked.connect(functools.partial(parent.set_current_index, 0))\n left_side.addSpacing(5)\n left_side.addWidget(b)\n\n layout.addLayout(left_side, stretch=30)\n layout.addLayout(right_side, stretch=70)\n self.setLayout(layout)\n self.setGraphicsEffect(utils.get_shadow())\n\n def _get_crud_func(self, main_window):\n def _show_crud(model, item=None):\n CrudWidget(main_window, model=model, callback=self._refresh, item=item)\n\n return _show_crud\n\n def _get_show_event(self, main_window):\n def _show_event(event=None):\n main_window.communication.action_button_toggle.emit(True, 'plus', functools.partial(self._show_crud,\n db.Organization))\n self._refresh()\n\n return _show_event\n\n @staticmethod\n def _get_select_user(main_window):\n def _select_user(user):\n def callback(value):\n if value:\n main_window.communication.user_selected.emit(user)\n\n # main_window.create_alert(text='Сменить пользователя?',\n main_window.create_alert(text='Alterar usuário?',\n callback=callback)\n\n return _select_user\n\n def _show_users_for_group(self, group_id):\n utils.clear_layout(self._users_layout)\n\n for user in db.SESSION.query(db.User).filter(db.User.organization_id == group_id,\n db.User.deleted == False,\n db.Organization.deleted == False):\n layout = QHBoxLayout()\n layout.setContentsMargins(0, 0, 0, 0)\n layout.setSpacing(0)\n layout.addWidget(QLabel(str(user)))\n layout.addStretch()\n for i, f in zip(('check', 'pencil_g'),\n (functools.partial(self._select_user, user),\n functools.partial(self._show_crud, db.User, user))):\n b = QPushButton()\n b.setIcon(QIcon(os.path.join(options.STATIC_DIR, 'icons', i)))\n b.clicked.connect(f)\n layout.addWidget(b)\n wrapper = QWidget()\n wrapper.setLayout(layout)\n self._users_layout.addWidget(wrapper)\n self._users_layout.addStretch()\n\n def _set_buttons_state(self, value):\n for b in self._related_to_group_buttons:\n b.setDisabled(value)\n\n def _group_selected(self, index):\n try:\n self._selected_group = self.groups[index]\n except IndexError:\n self._text_field.setText('')\n self._set_buttons_state(True)\n else:\n self._show_users_for_group(self._selected_group.id)\n self._set_buttons_state(False)\n self._text_field.setText(self._selected_group.header)\n\n def _refresh(self, items=None):\n self.groups = list(db.SESSION.query(db.Organization).filter(db.Organization.deleted == False))\n self._clear_layout()\n\n if not self.groups:\n self._users_layout.addStretch()\n # l = QLabel('Создайте группу, чтобы добавлять пользователей.')\n l = QLabel('Crie um grupo para adicionar usuários.')\n l.setAlignment(Qt.AlignCenter)\n self._users_layout.addWidget(l)\n self._users_layout.addStretch()\n return\n\n for i, group in enumerate(self.groups):\n if self._selected_group and group.id == self._selected_group.id:\n self._group_selected(i)\n\n self._groups_combo_box.insertItem(i, str(group))\n\n def _clear_layout(self):\n utils.clear_layout(self._users_layout)\n self._text_field.setText('')\n for i in range(self._groups_combo_box.count()):\n self._groups_combo_box.removeItem(i)\n\n def _save(self):\n\n if not self._selected_group:\n return\n\n self._selected_group.header = ''.join(filter(lambda x: '\\n' not in x,\n map(str, BeautifulSoup(self._text_field.toHtml(),\n 'html.parser').body.contents)))\n self._selected_group.save()\n self.show_message('Ок')\n\n def _get_delete_func(self, main_window):\n def _delete_for_real(for_real):\n if not for_real:\n return\n self._selected_group.deleted = True\n self._selected_group.save()\n self._selected_group = None\n self._refresh()\n return\n\n def _delete():\n # main_window.create_alert(text='Действие не может быть отменено.\\nПродолжить?', callback=_delete_for_real)\n main_window.create_alert(text='A ação não pode ser desfeita.\\nContinua?', callback=_delete_for_real)\n\n return _delete\n" }, { "alpha_fraction": 0.7070922255516052, "alphanum_fraction": 0.7106382846832275, "avg_line_length": 31.06818199157715, "blob_id": "05ec9a2dbc5c12b3c1e611d9b3cd46b7969be014", "content_id": "6249ead1ddc57b763daaedfefd6ab53b0bef1279", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1410, "license_type": "no_license", "max_line_length": 81, "num_lines": 44, "path": "/pyside2/chat/main.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import logging\n\nfrom PySide2.QtCore import QDir, QFile, QUrl\nfrom PySide2.QtGui import QGuiApplication\nfrom PySide2.QtQml import QQmlApplicationEngine\nfrom PySide2.QtSql import QSqlDatabase\n\nfrom sqlDialog import SqlConversationModel\n\nlogging.basicConfig(filename=\"chat.log\", level=logging.DEBUG)\nlogger = logging.getLogger(\"logger\")\n\ndef connectToDatabase():\n database = QSqlDatabase.database()\n if not database.isValid():\n database = QSqlDatabase.addDatabase(\"QSQLITE\")\n if not database.isValid():\n logger.error(\"Cannot add database\")\n\n write_dir = QDir()\n if not write_dir.mkpath(\".\"):\n logger.error(\"Failed to create writable directory\")\n\n # Ensure that we have a writable location on all devices.\n filename = \"{}/chat-database.sqlite3\".format(write_dir.absolutePath())\n\n # When using the SQLite driver, open() will create the SQLite\n # database if it doesn't exist.\n database.setDatabaseName(filename)\n if not database.open():\n logger.error(\"Cannot open database\")\n QFile.remove(filename)\n\nif __name__ == \"__main__\":\n app = QGuiApplication()\n connectToDatabase()\n sql_conversation_model = SqlConversationModel()\n\n engine = QQmlApplicationEngine()\n # Export pertinent objects to QML\n engine.rootContext().setContextProperty(\"chat_model\", sql_conversation_model)\n engine.load(QUrl(\"chat.qml\"))\n\n app.exec_()" }, { "alpha_fraction": 0.6312547922134399, "alphanum_fraction": 0.682063102722168, "avg_line_length": 40.90322494506836, "blob_id": "d361d4d5c026f4043be54512469d145269341edf", "content_id": "e92143f1e8e209cdf3ef010c89b4886fb239d81d", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2598, "license_type": "no_license", "max_line_length": 138, "num_lines": 62, "path": "/pyqt5-curso/styles-01.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#here we import necessary things we need\nimport sys\nfrom PyQt5 import QtWidgets, QtGui, QtCore, Qt\n\n\nclass MainWindow:\n def __init__(self):\n self.app = QtWidgets.QApplication(sys.argv)\n self.window = QtWidgets.QMainWindow()\n self.imagePath = \"/home/ily19/Downloads/man (1).png\"\n\n self.initGUI()\n\n self.window.setWindowTitle(\"Create a window\")\n self.window.setStyleSheet(\"background-color:#6e6e6e\")\n self.window.setGeometry(500, 100, 300,600)\n self.window.show()\n sys.exit(self.app.exec_())\n\n def initGUI(self):\n\n #create a label\n self.image = QtGui.QImage(self.imagePath)\n self.label = QtWidgets.QLabel(self.window)\n self.label.setGeometry(50,20, 200,200)\n self.label.setStyleSheet(\"background-color:#6e6e6e\")\n self.label.setPixmap(QtGui.QPixmap.fromImage(self.image))\n self.label.setScaledContents(True)\n\n #create a pseudo field\n self.pseudo = QtWidgets.QTextEdit(self.window)\n self.pseudo.setGeometry(25,270,250,40)\n self.pseudo.setText(\"Pseudo\")\n self.pseudo.setStyleSheet(\"background-color:#f7f7f7; color:#8e8e8e; padding-top: 5px; font-size:15px; padding-left:10px\")\n\n #create an email field\n self.email = QtWidgets.QTextEdit(self.window)\n self.email.setGeometry(25, 330,250,40)\n self.email.setText(\"Email\")\n self.email.setStyleSheet(\"background-color:#f7f7f7; color:#8e8e8e; padding-top: 5px; font-size:15px; padding-left:10px\")\n\n #create a password field\n self.password = QtWidgets.QTextEdit(self.window)\n self.password.setGeometry(25,390,250,40)\n self.password.setText(\"Password\")\n self.password.setStyleSheet(\"background-color:#f7f7f7; color:#8e8e8e; padding-top: 5px; font-size:15px; padding-left:10px\")\n\n #create a comfirm password field\n self.confirmPassword = QtWidgets.QTextEdit(self.window)\n self.confirmPassword.setGeometry(25,450,250,40)\n self.confirmPassword.setText(\"Confirm Password\")\n self.confirmPassword.setStyleSheet(\"background-color:#f7f7f7; color:#8e8e8e; padding-top: 5px; font-size:15px; padding-left:10px\")\n\n #creata the create account button\n self.createBtn = QtWidgets.QPushButton(self.window)\n self.createBtn.setText(\"Create an Account\")\n self.createBtn.setGeometry(25, 510, 250, 40)\n self.createBtn.setStyleSheet(\"background-color:#4e4e4e; color:#fafafa;font-size:15px;border:1px solid #4e4e4e\")\n\n\n#let's instantiate an object to the class MainWindow\nmain = MainWindow()\n" }, { "alpha_fraction": 0.6954545378684998, "alphanum_fraction": 0.7181817889213562, "avg_line_length": 23.55555534362793, "blob_id": "51e13275c66405f23546193df578215982503c1c", "content_id": "d57e9881390d88041233b312660f4514b281e010", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 220, "license_type": "no_license", "max_line_length": 61, "num_lines": 9, "path": "/le-pagina.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import urllib.request\nimport time\n\nt0= time.time()\nreq = urllib.request.urlopen('http://1linha.com.br')\npageHtml = req.read()\nt1 = time.time()\nprint(pageHtml)\nprint(\"Total time to fetch page : {} secondes\".format(t1-t0))" }, { "alpha_fraction": 0.5737704634666443, "alphanum_fraction": 0.5822316408157349, "avg_line_length": 27.084157943725586, "blob_id": "d774ca8baa42901e0152a2351e4cc7bbad2e36f9", "content_id": "1a6135ac1e52cd16608a1a56f962d2d7c0491d31", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 5673, "license_type": "no_license", "max_line_length": 102, "num_lines": 202, "path": "/Hospital-Helper-2-master/app/gui/select_menu.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import functools\n\nfrom PyQt5.QtCore import Qt\nfrom PyQt5.QtWidgets import (\n QWidget,\n QFrame,\n QPushButton,\n QHBoxLayout,\n QLabel,\n QGridLayout,\n)\n\nfrom app import options\n\nfrom app.gui import utils\n\n\nclass SelectMenu(QWidget):\n\n BUTTON_SELECTED_QSS = \"color: white; padding-bottom: 23px; border-bottom: 2px solid #FFEB3B;\"\n\n \"\"\"\n Line of buttons on TopFrame.\n Used to navigate between frames and items on DataFrame.\n \"\"\"\n\n def __init__(self, main_window, items):\n\n \"\"\"\n Connects to menu_btn_clicked signal\n and also emits it when button is clicked.\n \"\"\"\n\n super().__init__()\n self.hide()\n\n hbox = QHBoxLayout()\n hbox.setSpacing(0)\n hbox.setContentsMargins(0, 0, 0, 0)\n self.setLayout(hbox)\n hbox.addSpacing(25)\n\n main_window.communication.user_selected.connect(self._show)\n main_window.communication.menu_btn_clicked.connect(self._item_selected)\n\n self.buttons = []\n labels = [each['sys'] for each in options.CONTROL_BUTTONS_LABELS]\n\n for i, text in enumerate(labels):\n btn = QPushButton(_(text))\n self.buttons.append(btn)\n if i == 0:\n btn.setStyleSheet(self.BUTTON_SELECTED_QSS)\n\n btn.clicked.connect(functools.partial(main_window.communication.menu_btn_clicked.emit, i))\n hbox.addWidget(btn)\n\n SelectItemMenu(main_window, self, items)\n self.buttons[0].setText(_(main_window.items[0].name))\n self.buttons[0].setFixedWidth(int(main_window.width() / 5))\n hbox.addStretch()\n\n def _item_selected(self, index):\n \"\"\"\n Change style of selected button.\n \"\"\"\n\n for each in self.buttons:\n each.setStyleSheet('')\n\n self.buttons[index].setStyleSheet(self.BUTTON_SELECTED_QSS)\n\n def _show(self, *args):\n self.show()\n self.raise_()\n\n def set_item_label(self, text):\n \"\"\"\n Change label of button that holds items.\n \"\"\"\n\n self.buttons[0].setText(_(text))\n\n\nclass SelectItemMenu(QFrame):\n\n \"\"\"\n Float frame.\n Holds names of items.\n Used for navigation.\n Opens on Ctrl key when DataFrame is visible.\n Shows shortcuts to fast switching between items.\n \"\"\"\n\n def __init__(self, main_window, select_menu, items):\n\n super().__init__(main_window)\n\n self.HINTS = self._get_hints_list()\n self.items = items\n self.resize(main_window.width() * 0.6, main_window.height() * 0.4)\n self.hide()\n\n main_window.communication.toggle_select_item.connect(self.toggle_visibility)\n main_window.communication.set_select_item_visibility.connect(self.set_visible)\n main_window.communication.ctrl_hotkey.connect(self._show_with_hints)\n main_window.communication.resized.connect(self._move)\n main_window.communication.shortcut_pressed.connect(self._select_for_shortcut)\n\n grid = QGridLayout()\n self.setLayout(grid)\n grid.setSpacing(0)\n grid.setContentsMargins(0, 0, 0, 0)\n\n self._btn_clicked_func = self._get_btn_clicked_func(main_window, select_menu)\n\n cols = 3\n self.hints_labels = []\n for i, item in enumerate(items):\n row, col = i // cols, i % cols\n b = QPushButton(_(item.name))\n b.clicked.connect(functools.partial(self._btn_clicked_func, i))\n grid.addWidget(b, row, col)\n\n print(self.HINTS[i][0])\n l = QLabel(self.HINTS[i][0], self)\n l.setAlignment(Qt.AlignCenter)\n l.hide()\n self.hints_labels.append(l)\n\n self.setGraphicsEffect(utils.get_shadow())\n\n def _move(self, width, waterline, top_sys_btns_height):\n \"\"\"\n Move to the border between TopFrame and DataFrame.\n \"\"\"\n self.move(20, waterline)\n\n def _get_hints_list(self):\n \"\"\"\n Returns list of keys to show near item labels.\n \"\"\"\n\n return [(key, getattr(Qt, 'Key_{}'.format(key), -1))\n for key in '12345qwertsdfgcv'.upper()]\n\n def _get_btn_clicked_func(self, main_window, select_menu):\n\n \"\"\"\n Emit signal when item is selected.\n \"\"\"\n\n def _btn_clicked(index):\n select_menu.set_item_label(_(self.items[index].name))\n main_window.communication.item_selected.emit(index)\n self.hide()\n\n return _btn_clicked\n\n def toggle_visibility(self):\n self.setVisible(self.isHidden())\n self.raise_()\n\n def set_visible(self, value):\n self.setVisible(value)\n self.raise_()\n\n def leaveEvent(self, event):\n self.hide()\n\n def _show_with_hints(self, is_visible):\n \"\"\"\n Calls when Ctrl is pressed on DataWidget.\n Show widget with hints.\n \"\"\"\n\n for i, item in enumerate(zip(self.hints_labels, self.findChildren(QPushButton))):\n x = item[1].x() + item[1].width() - 80\n item[0].move(x, item[1].y())\n if is_visible:\n item[0].show()\n else:\n item[0].hide()\n self.set_visible(is_visible)\n\n def _select_for_shortcut(self, key):\n \"\"\"\n If shortcut is valid imitates button click on required item.\n \"\"\"\n\n index = self._get_item_index_by_key(key)\n if index is not None:\n self._btn_clicked_func(index)\n\n def _get_item_index_by_key(self, key):\n \"\"\"\n Return index of item by the given shortcut key.\n \"\"\"\n\n for i, hint in enumerate(self.HINTS):\n if hint[0] == key:\n return i\n" }, { "alpha_fraction": 0.5375816822052002, "alphanum_fraction": 0.5555555820465088, "avg_line_length": 26.863636016845703, "blob_id": "9ed9771d0b3e50019859a5bef3c18eada8c4c4f4", "content_id": "e3d844474d82562e2ddb722cdaa8276eaff498f1", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 612, "license_type": "no_license", "max_line_length": 88, "num_lines": 22, "path": "/msg_gabriela/msgg.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "def rttd_lttr(letter, key):\n if letter.isalpha(): \n num = ord(letter)\n if (num + key) > 122: \n x = (num + key) - 122\n return chr(x + ord('a') - 1)\n else:\n return chr(num + key)\n else:\n return letter\n\ndef dcrpt(word, key):\n new_word = \"\"\n for letter in word:\n new_letter = rttd_lttr(letter, key)\n new_word += new_letter\n\n return new_word\n\nprint(dcrpt(\"Adgcv, jmbpgcj z azgdxdyvyz kjm npvn xjilpdnovn! Kvmvwzin! Oz Vhj <3\", 5))\n\nprint(dcrpt(\"jwmdbvyv kvvvvvvd!!!! oz vhj hpdoj hpdoj hpdoj <3 qjp nziodm nvpyvyzn\", 5))" }, { "alpha_fraction": 0.5071884989738464, "alphanum_fraction": 0.5850638747215271, "avg_line_length": 24.29292869567871, "blob_id": "b130380c3ab0b2d0cd5de01adf42fe8c1e6f0701", "content_id": "e013b99cff6f0a5853c0a5366eff4a61ef6789d9", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2504, "license_type": "no_license", "max_line_length": 53, "num_lines": 99, "path": "/JPro-master/origin/populate_o.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "from sqlalchemy import create_engine\nfrom sqlalchemy.orm import sessionmaker\nfrom dbcreation import Base, Models, Parts, Processes\n\n\nC1dict = {\"P1\":12,\"P2\":4,\"P5\":5,\"P6\":7,\"P10\":1}\nC2dict = {\"P1\":12,\"P2\":6,\"P6\":5,\"P8\":9,\"P10\":1}\nC3dict = {\"P1\":12,\"P2\":7,\"P5\":5,\"P7\":15,\"P9\":4}\nC4dict = {\"P3\":3,\"P4\":6,\"P7\":13,\"P8\":9,\"P10\":1}\nC5dict = {\"P3\":3,\"P4\":6,\"P7\":18}\nC6dict = {\"P3\":3,\"P4\":4,\"P8\":10,\"P9\":5}\nC7dict = {\"P5\":8,\"P6\":8,\"P9\":5}\n\ndef Main(): \n\n\t#===##===##===##===##===##===##===#\n\t#Connection to SQLITE DB \n\t#===##===##===##===##===##===##===#\n\tengine = create_engine('sqlite:///complete.db')\n\tBase.metadata.bind = engine\n\tDBSession = sessionmaker(bind=engine)\n\tsession = DBSession()\n\n\t#===##===##===##===##===##===##===#\n\t#Removal of all current entries \n\t#===##===##===##===##===##===##===#\n\n\tremoveParts = session.query(Parts).all()\n\tremoveModels = session.query(Models).all()\n\tremoveProcesses = session.query(Processes).all()\n\n\tfor r in removeParts: \n\t\tsession.delete(r)\n\t\tsession.commit()\n\n\tfor r in removeModels: \n\t\tsession.delete(r)\n\t\tsession.commit()\n\n\tfor r in removeProcesses: \n\t\tsession.delete(r)\n\t\tsession.commit()\n\n\t#===##===##===##===##===##===##===#\n\t#Populate database \n\t#===##===##===##===##===##===##===#\n\n\tM1 = Models(name = 'M1', parts=\"P1,P2,P3,P4,P5\")\n\tM2 = Models(name = 'M2', parts=\"P1,P3,P6,P8,P9\")\n\tM3 = Models(name = 'M3', parts=\"P1,P2,P8,P9,P10\")\n\tM4 = Models(name = 'M4', parts=\"P1,P4,P5,P7,P9\")\n\n\tP1 = Parts(name = 'P1',processes=\"C1,C2,C3\")\n\tP2 = Parts(name = 'P2',processes=\"C1,C2,C3\")\n\tP3 = Parts(name = 'P3',processes=\"C4,C5,C6\")\n\tP4 = Parts(name = 'P4',processes=\"C4,C5,C6\")\n\tP5 = Parts(name = 'P5',processes=\"C1,C3,C7\")\n\tP6 = Parts(name = 'P6',processes=\"C1,C2,C7\")\n\tP7 = Parts(name = 'P7',processes=\"C3,C4,C5\")\n\tP8 = Parts(name = 'P8',processes=\"C2,C4,C6\")\n\tP9 = Parts(name = 'P9',processes=\"C3,C6,C7\")\n\tP10 = Parts(name = 'P10',processes=\"C1,C2,C4\")\n\n\tC1 = Processes(name='C1')\n\tC2 = Processes(name='C2')\n\tC3 = Processes(name='C3')\n\tC4 = Processes(name='C4')\n\tC5 = Processes(name='C5')\n\tC6 = Processes(name='C6')\n\tC7 = Processes(name='C7')\n\n\tsession.add(M1)\n\tsession.add(M2)\n\tsession.add(M3)\n\tsession.add(M4,M1)\n\n\tsession.add(P1)\n\tsession.add(P2)\n\tsession.add(P3)\n\tsession.add(P4)\n\tsession.add(P5)\n\tsession.add(P6)\n\tsession.add(P7)\n\tsession.add(P8)\n\tsession.add(P9)\n\tsession.add(P10)\n\n\tsession.add(C1)\n\tsession.add(C2)\n\tsession.add(C3)\n\tsession.add(C4)\n\tsession.add(C5)\n\tsession.add(C6)\n\tsession.add(C7)\t\n\n\tsession.commit()\n \nif __name__ == '__main__': \n\tMain() " }, { "alpha_fraction": 0.42271605134010315, "alphanum_fraction": 0.43802469968795776, "avg_line_length": 34.52631759643555, "blob_id": "b89cb597b2e46d52074c58f18f95857fb9e12755", "content_id": "ba7acffe143ed2bb03bdaa007067402c9d5d8019", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2025, "license_type": "no_license", "max_line_length": 94, "num_lines": 57, "path": "/e-mail/rel_backup.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/python3\n\nimport learq\nfrom datetime import datetime\nfrom envia_email import envia_email\n\narqlog = '/dados/sistema/backup/rsync.log'\n\nhora, sent, tota = learq.learq(arqlog)\n\nstatus = ''\nstacor = '#00B050'\ndata_inicio = ''\nhora_inicio = ''\nenviado = ''\nhora_fim = ''\ndata_size = ''\ntempo_total = ''\nvelocidade = ''\n\nif len(hora) == 2 or len(hora) == 4:\n status = 'Sucesso'\n if len(hora) > 2:\n data_inicio = hora[2]\n data_fim = hora[3]\n sent_ = sent[1]\n tota_ = tota[1]\n else:\n data_inicio = hora[0]\n data_fim = hora[1]\n sent_ = sent[0]\n tota_ = tota[0]\n\n hora_inicio = data_inicio.split()[3]\n hora_fim = data_fim.split()[3]\n enviado = sent_.split()[1] + ' ' + sent_.split()[2]\n data_size = tota_.split()[3] + ' ' + sent_.split()[2]\n hor_ini = datetime.strptime(hora_inicio, '%H:%M:%S')\n hor_fim = datetime.strptime(hora_fim, '%H:%M:%S')\n tempo_total = hor_fim - hor_ini\n velocidade = sent_.split()[6] + ' ' + sent_.split()[7]\nelse:\n status = 'Falhou'\n stacor = '#ff1030'\n data_inicio = 'Verifique arquivo em anexo'\n\ntemplate = open('template.html', 'r', encoding='utf-8').read().format(status=status,\n stacor=stacor,\n data_inicio=data_inicio,\n hora_inicio=hora_inicio,\n enviado=enviado,\n hora_fim=hora_fim,\n data_size=data_size,\n tempo_total=tempo_total,\n velocidade=velocidade)\n\nenvia_email('backup@1linha.com.br', ['notifyti@multip.com.br','bueno@1linha.com.br'], 'Backup 1linhasrv', template, [arqlog])\n" }, { "alpha_fraction": 0.5213655233383179, "alphanum_fraction": 0.540176510810852, "avg_line_length": 31.375940322875977, "blob_id": "c95c1cf66ce2a91b733e40dd664932d65befefcf", "content_id": "d5bbbe38e652247c5871aa49176436c269570cfa", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 4307, "license_type": "no_license", "max_line_length": 87, "num_lines": 133, "path": "/fullodbc/aiver135.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/python\n\nimport sys\nimport csv\nimport string\n\nfrom openpyxl.styles import Border, Side, PatternFill, Font, GradientFill, Alignment\nfrom openpyxl import Workbook\nfrom openpyxl import load_workbook\n\n\ndef style_range(ws, cell_range, border=Border(), fill=None, font=None, alignment=None):\n \"\"\"\n Apply styles to a range of cells as if they were a single cell.\n\n :param ws: Excel worksheet instance\n :param range: An excel range to style (e.g. A1:F20)\n :param border: An openpyxl Border\n :param fill: An openpyxl PatternFill or GradientFill\n :param font: An openpyxl Font object\n \"\"\"\n\n top = Border(top=border.top)\n left = Border(left=border.left)\n right = Border(right=border.right)\n bottom = Border(bottom=border.bottom)\n\n if \":\" in cell_range:\n first_cell = ws[cell_range.split(\":\")[0]]\n if alignment:\n ws.merge_cells(cell_range)\n first_cell.alignment = alignment\n\n rows = ws[cell_range]\n if font:\n first_cell.font = font\n\n for cell in rows[0]:\n cell.border = cell.border + top\n for cell in rows[-1]:\n cell.border = cell.border + bottom\n\n for row in rows:\n l = row[0]\n r = row[-1]\n l.border = l.border + left\n r.border = r.border + right\n if fill:\n for c in row:\n c.fill = fill\n else:\n cell = ws[cell_range]\n if alignment:\n cell.alignment = alignment\n\n cell = ws[cell_range]\n print(cell)\n if font:\n cell.font = font\n\n cell.border = cell.border + top\n cell.border = cell.border + bottom\n\n cell.border = cell.border + left\n cell.border = cell.border + right\n if fill:\n cell.fill = fill\n\n\ndef processa(f):\n \"\"\"\n Le arquivo e transforma em excel\n \"\"\"\n wb = load_workbook(\"aiver135.xlsx\")\n ws = wb.active\n thin = Side(border_style=\"thin\", color=\"000000\")\n medium = Side(border_style=\"medium\", color=\"000000\")\n border = Border(top=thin, left=thin, right=thin, bottom=thin)\n bordem = Border(top=medium, left=medium, right=medium, bottom=medium)\n font = Font(name='Calibri', b=True, color=\"000000\")\n\n linha = csv.reader(f, delimiter=';', quotechar='|')\n for lin, row in enumerate(linha):\n if lin == 0:\n ws.cell(row=1, column=2, value=row[0].strip())\n else:\n for col, ele in enumerate(row):\n if col < 3:\n ws.cell(row=lin + 3, column=col + 2, value=ele.strip())\n elif col == 3:\n ws.cell(row=lin + 3, column=col +\n 2, value=float(ele.strip()))\n elif col < 6:\n ws.cell(row=lin + 3, column=col +\n 2, value=int(ele.strip()))\n elif col == 6:\n ws.cell(row=lin + 3, column=col + 2, value=ele.strip())\n elif col < 9:\n ws.cell(row=lin + 3, column=col +\n 2, value=int(ele.strip()))\n else:\n ws.cell(row=lin + 3, column=col +\n 2, value=float(ele.strip()))\n ws.cell(row=lin + 3, column=col + 2).border = border\n # linha de total\n ws.cell(row=lin + 4, column=2, value='TOTAL')\n cell_range = 'B'+str(lin+4)+':O'+str(lin+4)\n al = Alignment(horizontal=\"right\", vertical=\"center\")\n style_range(ws, cell_range, border=bordem, font=font, alignment=al)\n # total icms normal a recuperar\n cell_range = 'P4:P'+str(lin+3)\n ws.cell(row=lin + 4, column=16, value='=Sum('+cell_range+')')\n ws.cell(row=lin + 4, column=16).border = bordem\n # total icms/st a ressarcir\n cell_range = 'Q4:Q'+str(lin+3)\n ws.cell(row=lin + 4, column=17, value='=Sum('+cell_range+')')\n ws.cell(row=lin + 4, column=17).border = bordem\n\n wb.save(sys.argv[2])\n\n\nif __name__ == \"__main__\":\n if(len(sys.argv) < 3):\n print(\"Use: leArq-001 arquivo arquivo-saida\")\n sys.exit(0)\n try:\n with open(sys.argv[1], 'r') as f:\n processa(f)\n f.close\n except IOError:\n print(u'Arquivo não encontrado!')\n sys.exit(0)\n sys.exit(1)\n" }, { "alpha_fraction": 0.4706266224384308, "alphanum_fraction": 0.5484660863876343, "avg_line_length": 33.43258285522461, "blob_id": "f0d0b1060d807e22e829bc9da0248d2d20cf9bb9", "content_id": "ecbc0446f8be5f3dfe460a40e247c6c8995ed45a", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 6128, "license_type": "no_license", "max_line_length": 89, "num_lines": 178, "path": "/opencv/Realidade-Aumentada-master/insertObject/main2.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "from OpenGL.GL import *\nfrom OpenGL.GLUT import *\nfrom OpenGL.GLU import *\nimport cv2\nfrom PIL import Image\nimport numpy as np\nfrom webcam import Webcam\nfrom glyphs import *\n \nclass OpenGLGlyphs:\n \n # constants\n INVERSE_MATRIX = np.array([[ 1.0, 1.0, 1.0, 1.0],\n [-1.0,-1.0,-1.0,-1.0],\n [-1.0,-1.0,-1.0,-1.0],\n [ 1.0, 1.0, 1.0, 1.0]])\n \n def __init__(self):\n # initialise webcam and start thread\n self.webcam = Webcam()\n self.webcam.start()\n \n # textures\n self.texture_background = None\n self.texture_cube = None\n \n def _init_gl(self, Width, Height):\n glClearColor(0.0, 0.0, 0.0, 0.0)\n glClearDepth(1.0)\n glDepthFunc(GL_LESS)\n glEnable(GL_DEPTH_TEST)\n glShadeModel(GL_SMOOTH)\n glMatrixMode(GL_PROJECTION)\n glLoadIdentity()\n gluPerspective(33.7, 1.3, 0.1, 100.0)\n glMatrixMode(GL_MODELVIEW)\n \n # enable textures\n glEnable(GL_TEXTURE_2D)\n self.texture_background = glGenTextures(1)\n self.texture_cube = glGenTextures(1)\n \n # create cube texture \n image = Image.open(\"a.png\")\n ix = image.size[0]\n iy = image.size[1]\n image = image.tobytes(\"raw\", \"RGBX\", 0, -1)\n \n glBindTexture(GL_TEXTURE_2D, self.texture_cube)\n glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST)\n glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST)\n glTexImage2D(GL_TEXTURE_2D, 0, 3, ix, iy, 0, GL_RGBA, GL_UNSIGNED_BYTE, image)\n \n def _draw_scene(self):\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)\n glLoadIdentity()\n \n # get image from webcam\n image = self.webcam.get_current_frame()\n \n # convert image to OpenGL texture format\n bg_image = cv2.flip(image, 0)\n bg_image = Image.fromarray(bg_image) \n ix = bg_image.size[0]\n iy = bg_image.size[1]\n bg_image = bg_image.tostring(\"raw\", \"BGRX\", 0, -1)\n \n # create background texture\n glBindTexture(GL_TEXTURE_2D, self.texture_background)\n glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST)\n glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST)\n glTexImage2D(GL_TEXTURE_2D, 0, 3, ix, iy, 0, GL_RGBA, GL_UNSIGNED_BYTE, bg_image)\n \n # draw background\n glBindTexture(GL_TEXTURE_2D, self.texture_background)\n glPushMatrix()\n glTranslatef(0.0,0.0,-10.0)\n self._draw_background()\n glPopMatrix()\n \n # handle glyph\n image = self._handle_glyph(image)\n \n glutSwapBuffers()\n \n def _handle_glyph(self, image):\n \n # attempt to detect glyph\n rvecs = None\n tvecs = None\n \n try:\n rvecs, tvecs = detect_glyph(image)\n except Exception as ex: \n print(ex)\n \n if rvecs == None or tvecs == None: \n return\n \n # build view matrix\n rmtx = cv2.Rodrigues(rvecs)[0]\n \n view_matrix = np.array([[rmtx[0][0],rmtx[0][1],rmtx[0][2],tvecs[0]],\n [rmtx[1][0],rmtx[1][1],rmtx[1][2],tvecs[1]],\n [rmtx[2][0],rmtx[2][1],rmtx[2][2],tvecs[2]],\n [0.0 ,0.0 ,0.0 ,1.0 ]])\n \n view_matrix = view_matrix * self.INVERSE_MATRIX\n \n view_matrix = np.transpose(view_matrix)\n \n # load view matrix and draw cube\n glBindTexture(GL_TEXTURE_2D, self.texture_cube)\n glPushMatrix()\n glLoadMatrixd(view_matrix)\n self._draw_cube()\n glPopMatrix()\n \n def _draw_cube(self):\n # draw cube\n glBegin(GL_QUADS)\n \n glTexCoord2f(0.0, 0.0); glVertex3f( 0.0, 0.0, 0.0)\n glTexCoord2f(1.0, 0.0); glVertex3f( 1.0, 0.0, 0.0)\n glTexCoord2f(1.0, 1.0); glVertex3f( 1.0, 1.0, 0.0)\n glTexCoord2f(0.0, 1.0); glVertex3f( 0.0, 1.0, 0.0)\n \n glTexCoord2f(1.0, 0.0); glVertex3f( 0.0, 0.0, -1.0)\n glTexCoord2f(1.0, 1.0); glVertex3f( 0.0, 1.0, -1.0)\n glTexCoord2f(0.0, 1.0); glVertex3f( 1.0, 1.0, -1.0)\n glTexCoord2f(0.0, 0.0); glVertex3f( 1.0, 0.0, -1.0)\n \n glTexCoord2f(0.0, 1.0); glVertex3f( 0.0, 1.0, -1.0)\n glTexCoord2f(0.0, 0.0); glVertex3f( 0.0, 1.0, 0.0)\n glTexCoord2f(1.0, 0.0); glVertex3f( 1.0, 1.0, 0.0)\n glTexCoord2f(1.0, 1.0); glVertex3f( 1.0, 1.0, -1.0)\n \n glTexCoord2f(1.0, 1.0); glVertex3f( 0.0, 0.0, -1.0)\n glTexCoord2f(0.0, 1.0); glVertex3f( 1.0, 0.0, -1.0)\n glTexCoord2f(0.0, 0.0); glVertex3f( 1.0, 0.0, 0.0)\n glTexCoord2f(1.0, 0.0); glVertex3f( 0.0, 0.0, 0.0)\n \n glTexCoord2f(1.0, 0.0); glVertex3f( 1.0, 0.0, -1.0)\n glTexCoord2f(1.0, 1.0); glVertex3f( 1.0, 1.0, -1.0)\n glTexCoord2f(0.0, 1.0); glVertex3f( 1.0, 1.0, 0.0)\n glTexCoord2f(0.0, 0.0); glVertex3f( 1.0, 0.0, 0.0)\n \n glTexCoord2f(0.0, 0.0); glVertex3f( 0.0, 0.0, -1.0)\n glTexCoord2f(1.0, 0.0); glVertex3f( 0.0, 0.0, 0.0)\n glTexCoord2f(1.0, 1.0); glVertex3f( 0.0, 1.0, 0.0)\n glTexCoord2f(0.0, 1.0); glVertex3f( 0.0, 1.0, -1.0)\n \n glEnd()\n \n def _draw_background(self):\n # draw background\n glBegin(GL_QUADS)\n glTexCoord2f(0.0, 1.0); glVertex3f(-4.0, -3.0, 0.0)\n glTexCoord2f(1.0, 1.0); glVertex3f( 4.0, -3.0, 0.0)\n glTexCoord2f(1.0, 0.0); glVertex3f( 4.0, 3.0, 0.0)\n glTexCoord2f(0.0, 0.0); glVertex3f(-4.0, 3.0, 0.0)\n glEnd( )\n \n def main(self):\n # setup and run OpenGL\n glutInit()\n glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH)\n glutInitWindowSize(640, 480)\n glutInitWindowPosition(800, 400)\n self.window_id = glutCreateWindow(\"OpenGL Glyphs\")\n glutDisplayFunc(self._draw_scene)\n glutIdleFunc(self._draw_scene)\n self._init_gl(640, 480)\n glutMainLoop()\n \n# run an instance of OpenGL Glyphs \nopenGLGlyphs = OpenGLGlyphs()\nopenGLGlyphs.main()" }, { "alpha_fraction": 0.5510203838348389, "alphanum_fraction": 0.5703544616699219, "avg_line_length": 20.674419403076172, "blob_id": "1e193bc87d800c39bdd5f950dd8fc5e7f33c864d", "content_id": "ea320cf0f8264a390e0ea17c6384d4bdedd7dd9c", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 931, "license_type": "no_license", "max_line_length": 84, "num_lines": 43, "path": "/JPro-master/test.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import sys\nfrom PyQt5.QtWidgets import (QApplication, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQWidget, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQLabel, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQListWidget,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQListWidgetItem,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQHBoxLayout,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQVBoxLayout,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQGridLayout,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQShortcut,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tqApp,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQComboBox,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\n\n\nclass CBox(QWidget): \n\n\tdef __init__(self): \n\t\tsuper().__init__()\n\n\t\tself.table = self.table = QTableWidget(5,3,self)\n\ndef createconnections(self):\n\t\tfor i in range(0,len(self.comboboxlist)):\n\t\t\tself.comboboxlist[i].\n\nself.comboboxlist[row].currentIndexChanged.connect(lambda row: self.time_combo(row))\n\t\t\n#\t\tself.combobox = QComboBox(self)\n#\t\tself.move(400,300)\n\n#\t\tself.combobox.addItem('hello','hello')\n#\t\tself.combobox.addItem('sad', 'sad')\n\n\t\tself.setGeometry(0,0,640,440)\n\t\tself.show()\n\nif __name__ == '__main__' : \n\n\tapp = QApplication(sys.argv)\n\ttbox = CBox()\n\tsys.exit(app.exec_())" }, { "alpha_fraction": 0.3832853138446808, "alphanum_fraction": 0.4639769494533539, "avg_line_length": 20.6875, "blob_id": "f0bd00fd926daf868c559c20f6d6393739d0c28a", "content_id": "1fa809189230adf7ed98d8a15d090f2d2f4279e4", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 347, "license_type": "no_license", "max_line_length": 52, "num_lines": 16, "path": "/fullcontrol_001/txt.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import os\n\nf = open('lgd', 'r', errors='ignore')\ng = open('lgg', 'w', errors='ignore')\n\nl = 0\nw = 0\nfor line in f:\n l = l + 1\n if int(l/1000) == l/1000:\n print('lidos ', l)\n if line[0:5] == '51VEN' or line[0:5] == '56VEN':\n g.write(line)\n w = w + 1\n if int(w/1000) == w/1000:\n print('gravados ', w)\n" }, { "alpha_fraction": 0.8162392973899841, "alphanum_fraction": 0.8162392973899841, "avg_line_length": 32.57143020629883, "blob_id": "8efb63398995b9a025705c09ce76962fdad5b1bb", "content_id": "12f25bc04f2ccb46ba320d36653aa2b0c986d2cd", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 234, "license_type": "no_license", "max_line_length": 50, "num_lines": 7, "path": "/fullcontrol/dados/api/viewsets.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "from rest_framework import viewsets\nfrom dados.api import serializers\nfrom dados import models\n\nclass DadosViewSet(viewsets.ModelViewSet):\n serializer_class = serializers.DadosSerializer\n queryset = models.Savemdip.objects.all()" }, { "alpha_fraction": 0.6052631735801697, "alphanum_fraction": 0.6052631735801697, "avg_line_length": 38, "blob_id": "d39029d4a859af0136ea2603b7a3b4d2457351ab", "content_id": "ed06b2dc7d107a6da529b7d4e9bbf1d066a6869a", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 38, "license_type": "no_license", "max_line_length": 38, "num_lines": 1, "path": "/PyQT-CRUD-App/app/tools/__init__.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "__all__ = ['exitmethods', 'functions']" }, { "alpha_fraction": 0.5821972489356995, "alphanum_fraction": 0.6487570405006409, "avg_line_length": 32.702701568603516, "blob_id": "4e8202be6f85d06d0c20e025016d181947efa73e", "content_id": "4a73d2be4b849195e102993246c6b8a4011b7024", "detected_licenses": [], "is_generated": false, "is_vendor": true, "language": "Ruby", "length_bytes": 1247, "license_type": "no_license", "max_line_length": 66, "num_lines": 37, "path": "/Hospital-Helper-2-master/Vagrantfile", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "Vagrant.configure(\"2\") do |config|\n config.ssh.keys_only = true\n config.ssh.insert_key = false\n config.ssh.private_key_path = 'vagrant_key'\n\n config.vm.define \"ubuntu32\" do |ubuntu32|\n\n ubuntu32.vm.box = \"ubuntu/trusty32\"\n # ubuntu32.vm.hostname = 'ubuntu32'\n ubuntu32.vm.box_url = \"ubuntu/trusty32\"\n\n # ubuntu32.vm.network :private_network, ip: \"192.168.56.101\"\n ubuntu32.vm.provision :shell, path: 'vagrant/linux.sh'\n\n ubuntu32.vm.provider :virtualbox do |v|\n v.customize [\"modifyvm\", :id, \"--natdnshostresolver1\", \"on\"]\n v.customize [\"modifyvm\", :id, \"--memory\", 512]\n v.customize [\"modifyvm\", :id, \"--name\", \"ubuntu32\"]\n end\n end\n\n config.vm.define \"debian32\" do |debian32|\n debian32.vm.box = \"puppetlabs/debian-7.8-32-puppet\"\n debian32.vm.hostname = 'debian32'\n debian32.vm.box_url = \"puppetlabs/debian-7.8-32-puppet\"\n\n debian32.vm.network :private_network, ip: \"192.168.56.102\"\n\n debian32.vm.provision :shell, path: 'vagrant/linux.sh'\n\n debian32.vm.provider :virtualbox do |v|\n v.customize [\"modifyvm\", :id, \"--natdnshostresolver1\", \"on\"]\n v.customize [\"modifyvm\", :id, \"--memory\", 512]\n v.customize [\"modifyvm\", :id, \"--name\", \"debian32\"]\n end\n end\nend\n" }, { "alpha_fraction": 0.6455234289169312, "alphanum_fraction": 0.650305986404419, "avg_line_length": 40.96258544921875, "blob_id": "f601f4b8e90e1ad44699f32a289e2ee13496007f", "content_id": "04703ce1d50931ca25844ba6aff508a16bceb611", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 24676, "license_type": "no_license", "max_line_length": 119, "num_lines": 588, "path": "/PQt5-Stock/Controlador/pUsuario.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom Modelo.usuario import Usuario\nfrom Conexion.conexionUsuario import conexionUsuario\nfrom PyQt5.QtWidgets import QAbstractItemView\nfrom Componentes.tableModel import MyTableModel\nfrom Modelo.direccion import Direccion\nfrom Conexion.conexionTelefono import conexionTelefono\nfrom Modelo.telefono import Telefono\nfrom PyQt5.QtWidgets import QMessageBox, QDialog\n\nclass PestaniaUsuario():\n\n def __init__(self, winPrincipal):\n self.winPrincipal = winPrincipal\n self.usuario = Usuario()\n self.conexionUsuario = conexionUsuario()\n self.conexionTelefono = conexionTelefono()\n self.estado = \"\"\n self.direccion = Direccion()\n\n self.configInit()\n\n\n def configInit(self):\n self.limpiarCampos()\n #Configurando botones Generales\n self.winPrincipal.btnAgregar_u.clicked.connect(self.onClickAgregar_u)\n self.winPrincipal.btnGuardar_u.clicked.connect(self.onClickGuardar_u)\n self.winPrincipal.btnBorrar_u.clicked.connect(self.onClickBorrar_u)\n self.winPrincipal.btnModificar_u.clicked.connect(self.onClickModificar_u)\n\n #Configurando botones ABM telefono\n self.winPrincipal.btnSumarTelefono_u.clicked.connect(self.onClickSumarTelefono)\n self.winPrincipal.btnRestarTelefono_u.clicked.connect(self.onClickRestarTelefono)\n self.winPrincipal.btnCancelarTelefono_u.clicked.connect(self.onClickCancelarTelefono)\n self.winPrincipal.btnCancelarTelefono_u.setVisible(False)\n self.winPrincipal.btnRestarTelefono_u.setEnabled(False)\n\n #configurando botones tipo telefono\n self.winPrincipal.btnTelefono_u.clicked.connect(self.onClickTelefono)\n self.winPrincipal.btnCelular_u.clicked.connect(self.onClickCelular)\n self.winPrincipal.btnFax_u.clicked.connect(self.onClickFax)\n\n self.winPrincipal.txtFilterUsuarios_u.returnPressed.connect(self.search)\n\n #Seteando model y propieades de la tabla\n self.winPrincipal.tvUsuarios_u.setSortingEnabled(True)\n self.winPrincipal.tvUsuarios_u.setMouseTracking(True)\n self.winPrincipal.tvUsuarios_u.setSelectionBehavior(QAbstractItemView.SelectRows)\n\n #Seteando proiedades de la tabla telefono\n self.winPrincipal.tvTelefonos_u.setSortingEnabled(True)\n self.winPrincipal.tvTelefonos_u.setMouseTracking(True)\n self.winPrincipal.tvTelefonos_u.setSelectionBehavior(QAbstractItemView.SelectRows)\n\n self.winPrincipal.txtFilterUsuarios_u.setFocus(True)\n\n def finish(self):\n self.winPrincipal.btnAgregar_u.disconnect()\n self.winPrincipal.btnBorrar_u.disconnect()\n self.winPrincipal.btnModificar_u.disconnect()\n self.winPrincipal.btnGuardar_u.disconnect()\n\n self.winPrincipal.btnCancelarTelefono_u.disconnect()\n self.winPrincipal.btnSumarTelefono_u.disconnect()\n self.winPrincipal.btnRestarTelefono_u.disconnect()\n\n self.winPrincipal.btnCelular_u.disconnect()\n self.winPrincipal.btnFax_u.disconnect()\n self.winPrincipal.btnTelefono_u.disconnect()\n\n self.winPrincipal.tvTelefonos_u.disconnect()\n self.winPrincipal.tvUsuarios_u.disconnect()\n\n def search(self):\n if self.winPrincipal.txtFilterUsuarios_u.hasFocus() is True:\n self.cargarTabla()\n\n\n def onClickAgregar_u(self):\n self.estado = 'AGREGAR'\n self.validarBotones(button='AGREGAR')\n\n\n def onClickGuardar_u(self):\n validar = self.validar()\n\n if validar != \"\":\n print(validar)\n alert = QDialog()\n QMessageBox.information(alert,\"ERROR\", validar)\n else:\n self.usuario.setNombre(str(self.winPrincipal.txtNombre_u.text()))\n self.usuario.setApellido(str(self.winPrincipal.txtApellido_u.text()))\n self.usuario.setEmail(str(self.winPrincipal.txtEmail_u.text()))\n self.usuario.setPasswd(str(self.winPrincipal.txtContrasena_u.text()))\n self.usuario.setUsuario(str(self.winPrincipal.txtUsuario_u.text()))\n\n\n if self.winPrincipal.cbTipoUsuario_u.currentText() == 'user':\n self.usuario.setTipoUsuario(\"USR\")\n else:\n self.usuario.setTipoUsuario(\"ADM\")\n\n\n\n\n self.direccion.setDireccion(str(self.winPrincipal.txtDireccion_u.text()))\n if self.winPrincipal.txtDDpto_u.text() != \"\":\n self.direccion.setDpto(str(self.winPrincipal.txtDDpto_u.text()))\n else:\n self.direccion.setDpto(\"\")\n if self.winPrincipal.txtDNumero_u.text() != \"\":\n self.direccion.setNumero(int(self.winPrincipal.txtDNumero_u.text()))\n else:\n self.direccion.setNumero(0)\n if self.winPrincipal.txtDPiso_u.text() != \"\":\n self.direccion.setPiso(int(self.winPrincipal.txtDPiso_u.text()))\n else:\n self.direccion.setPiso(0)\n\n self.usuario.setDireccion(self.direccion)\n\n self.validarBotones(button='GUARDAR')\n\n if self.estado == 'AGREGAR':\n self.insertUsuario()\n self.insertTelefono()\n elif self.estado == 'MODIFICAR':\n self.modificarUsuario()\n self.updateTelefono()\n\n\n def onClickModificar_u(self):\n self.estado = 'MODIFICAR'\n self.validarBotones(button='MODIFICAR')\n\n\n def onClickBorrar_u(self):\n if self.winPrincipal.btnGuardar_u.isEnabled() != True:\n self.conexionUsuario.borrarUsuario(self.usuario)\n self.cargarTabla()\n\n self.validarBotones(button='BORRAR')\n\n\n def cargarTabla(self):\n parameter = self.winPrincipal.txtFilterUsuarios_u.text()\n typeParameter = ''\n\n if self.winPrincipal.cbFilterUsuario_u.currentText() == 'Apellido':\n typeParameter = 'u.apellido'\n if self.winPrincipal.cbFilterUsuario_u.currentText() == 'Usuario':\n typeParameter = 'u.usuario'\n else:\n typeParameter = 'u.tipo'\n\n listaUsuarios = self.conexionUsuario.selectUsuario(typeParameter, parameter)\n if len(listaUsuarios) > 0:\n\n header = ['ID', 'Nombre', 'Apellido', 'Usuario', 'Tipo', 'Contraseña', 'Email','Direccion', 'N°', 'P', 'D',\n 'iddire', 'idpers']\n tableModel = MyTableModel(self.winPrincipal.tvUsuarios_u, listaUsuarios, header)\n self.winPrincipal.tvUsuarios_u.setModel(tableModel)\n self.winPrincipal.tvUsuarios_u.selectionModel().currentChanged.connect(self.changeSelectedTable)\n\n self.winPrincipal.tvUsuarios_u.setColumnHidden(0, True)\n self.winPrincipal.tvUsuarios_u.setColumnWidth(1, 200)\n self.winPrincipal.tvUsuarios_u.setColumnWidth(2, 200)\n self.winPrincipal.tvUsuarios_u.setColumnHidden(3, True)\n self.winPrincipal.tvUsuarios_u.setColumnWidth(4, 80)\n self.winPrincipal.tvUsuarios_u.setColumnHidden(5, True)\n self.winPrincipal.tvUsuarios_u.setColumnWidth(6, 270)\n self.winPrincipal.tvUsuarios_u.setColumnWidth(7, 333)\n self.winPrincipal.tvUsuarios_u.setColumnWidth(8, 50)\n self.winPrincipal.tvUsuarios_u.setColumnHidden(9, True)\n self.winPrincipal.tvUsuarios_u.setColumnHidden(10, True)\n self.winPrincipal.tvUsuarios_u.setColumnHidden(11, True)\n self.winPrincipal.tvUsuarios_u.setColumnHidden(12, True)\n else:\n self.winPrincipal.tvUsuarios_u.setModel(None)\n\n\n def changeSelectedTable(self, selected, deselected):\n usuarioList = selected.model().mylist\n usuarioSelected = usuarioList[selected.row()]\n self.usuario = Usuario()\n self.direccion = Direccion()\n self.usuario.setIdUsuario(int(usuarioSelected[0]))\n self.usuario.setNombre(str(usuarioSelected[1]))\n self.usuario.setApellido(str(usuarioSelected[2]))\n self.usuario.setUsuario(str(usuarioSelected[3]))\n\n\n self.usuario.setTipoUsuario(str(usuarioSelected[4]))\n\n self.usuario.setPasswd(str(usuarioSelected[5]))\n self.usuario.setEmail(str(usuarioSelected[6]))\n\n self.direccion.setDireccion(str(usuarioSelected[7]))\n if usuarioSelected[8] != None:\n self.direccion.setNumero(int(usuarioSelected[8]))\n\n if usuarioSelected[9] != None:\n self.direccion.setPiso(int(usuarioSelected[9]))\n\n if usuarioSelected[10] != None:\n self.direccion.setDpto(usuarioSelected[10])\n\n self.direccion.setIdDireccion(usuarioSelected[11])\n self.usuario.setDireccion(self.direccion)\n self.usuario.setIdPersona(usuarioSelected[12])\n self.winPrincipal.tvUsuarios_u.setRowHeight(deselected.row(), 28)\n self.winPrincipal.tvUsuarios_u.setRowHeight(selected.row(), 45)\n\n self.setCampos()\n self.winPrincipal.btnBorrar_u.setEnabled(True)\n self.winPrincipal.btnModificar_u.setEnabled(True)\n self.winPrincipal.tvTelefonos_u.setModel(None)\n self.cargarTablaTelefono()\n\n\n def validarBotones(self, button):\n if button == 'AGREGAR' :\n self.winPrincipal.wDatosUsuario.setEnabled(True)\n self.winPrincipal.btnBorrar_u.setEnabled(True)\n self.winPrincipal.btnBorrar_u.setText('CANCELAR')\n self.winPrincipal.btnGuardar_u.setEnabled(True)\n self.winPrincipal.btnModificar_u.setEnabled(False)\n self.winPrincipal.btnAgregar_u.setEnabled(False)\n self.winPrincipal.tvUsuarios_u.setEnabled(False)\n self.limpiarCampos()\n\n elif button=='GUARDAR':\n self.winPrincipal.btnModificar_u.setEnabled(False)\n self.winPrincipal.btnAgregar_u.setEnabled(True)\n self.winPrincipal.btnGuardar_u.setEnabled(False)\n self.winPrincipal.btnBorrar_u.setText('BORRAR')\n self.winPrincipal.btnBorrar_u.setEnabled(False)\n self.winPrincipal.tvUsuarios_u.setEnabled(True)\n self.winPrincipal.wDatosUsuario.setEnabled(False)\n self.limpiarCampos()\n\n elif button == 'MODIFICAR':\n self.winPrincipal.btnModificar_u.setEnabled(False)\n self.winPrincipal.btnAgregar_u.setEnabled(False)\n self.winPrincipal.btnGuardar_u.setEnabled(True)\n self.winPrincipal.btnBorrar_u.setText('CANCELAR')\n self.winPrincipal.btnBorrar_u.setEnabled(True)\n self.winPrincipal.tvUsuarios_u.setEnabled(False)\n self.winPrincipal.wDatosUsuario.setEnabled(True)\n\n elif button=='BORRAR':\n self.winPrincipal.btnModificar_u.setEnabled(False)\n self.winPrincipal.btnAgregar_u.setEnabled(True)\n self.winPrincipal.btnGuardar_u.setEnabled(False)\n self.winPrincipal.btnBorrar_u.setText('BORRAR')\n self.winPrincipal.btnBorrar_u.setEnabled(False)\n self.winPrincipal.tvUsuarios_u.setEnabled(True)\n self.winPrincipal.wDatosUsuario.setEnabled(False)\n self.limpiarCampos()\n\n def insertUsuario(self):\n self.conexionUsuario.insertarUsuario(self.usuario)\n self.cargarTabla()\n\n def modificarUsuario(self):\n self.conexionUsuario.modificarUsuario(self.usuario)\n self.cargarTabla()\n\n\n def limpiarCampos(self):\n self.winPrincipal.txtApellido_u.setText('')\n self.winPrincipal.txtContrasena_u.setText('')\n self.winPrincipal.txtDireccion_u.setText('')\n self.winPrincipal.txtEmail_u.setText('')\n self.winPrincipal.txtNombre_u.setText('')\n self.winPrincipal.txtUsuario_u.setText('')\n self.winPrincipal.cbTipoUsuario_u.setCurrentIndex(0)\n self.winPrincipal.txtDNumero_u.setText('')\n self.winPrincipal.txtDPiso_u.setText('')\n self.winPrincipal.txtDDpto_u.setText('')\n self.winPrincipal.tvTelefonos_u.setModel(None)\n self.winPrincipal.txtFilterUsuarios_u.setText('')\n self.winPrincipal.tvUsuarios_u.setModel(None)\n\n self.winPrincipal.txtFilterUsuarios_u.setFocus(True)\n\n def setCampos(self):\n self.winPrincipal.txtApellido_u.setText(str(self.usuario.getApellido()))\n self.winPrincipal.txtContrasena_u.setText(str(self.usuario.getPasswd()))\n self.winPrincipal.txtEmail_u.setText(str(self.usuario.getEmail()))\n self.winPrincipal.txtNombre_u.setText(str(self.usuario.getNombre()))\n\n self.winPrincipal.txtUsuario_u.setText(str(self.usuario.getUsuario()))\n if self.usuario.getTipoUsuario() == 'ADM':\n self.winPrincipal.cbTipoUsuario_u.setCurrentIndex(1)\n elif self.usuario.getTipoUsuario() == 'USR':\n self.winPrincipal.cbTipoUsuario_u.setCurrentIndex(0)\n\n self.winPrincipal.txtDireccion_u.setText(str(self.usuario.getDireccion().getDireccion()))\n\n if self.usuario.getDireccion().getNumero() != None:\n self.winPrincipal.txtDNumero_u.setText(str(self.usuario.getDireccion().getNumero()))\n else:\n self.winPrincipal.txtDNumero_u.setText('')\n\n if self.usuario.getDireccion().getPiso() != None:\n self.winPrincipal.txtDPiso_u.setText(str(self.usuario.getDireccion().getPiso()))\n else:\n self.winPrincipal.txtDPiso_u.setText('')\n\n if self.usuario.getDireccion().getDpto() != None:\n self.winPrincipal.txtDDpto_u.setText(self.usuario.getDireccion().getDpto())\n else:\n self.winPrincipal.txtDDpto_u.setText('')\n\n\n def validar(self):\n mensaje = \"\"\n\n if self.winPrincipal.txtApellido_u.text() == '':\n mensaje = \"Falta ingresar un apellido.\"\n elif self.winPrincipal.txtNombre_u.text() == '':\n mensaje = \"Falta ingresar un nombre.\"\n elif self.winPrincipal.txtDireccion_u.text() == '':\n mensaje = \"Falta ingresar la Direccion\"\n elif self.winPrincipal.txtUsuario_u.text() == '':\n mensaje = \"Falta ingresar el nombre de usuario\"\n elif self.winPrincipal.txtContrasena_u.text() == '':\n mensaje = \"Falta ingresa la contraseña.\"\n\n return mensaje\n\n\n\n\n def cargarTablaTelefono(self):\n self.listTelefonosInit = self.conexionTelefono.selectTelefono(self.usuario)\n if len(self.listTelefonosInit) >0:\n header = ['ID', 'Numero', 'TIPO']\n tableModel = MyTableModel(self.winPrincipal, self.listTelefonosInit, header)\n self.winPrincipal.tvTelefonos_u.setModel(tableModel)\n self.winPrincipal.tvTelefonos_u.selectionModel().currentChanged.connect(self.changeSelectedTableTel)\n\n self.winPrincipal.tvTelefonos_u.setColumnHidden(0, True)\n self.winPrincipal.tvTelefonos_u.setColumnWidth(1, 36)\n self.winPrincipal.tvTelefonos_u.setColumnWidth(2, 175)\n\n for r in range(0, len(self.listTelefonosInit)):\n self.winPrincipal.tvTelefonos_u.setRowHidden(r, False)\n\n\n\n def changeSelectedTableTel(self, selected, deselected):\n listTelefonos = selected.model().mylist\n self.telefonoSelected = ()\n self.telefonoSelected = listTelefonos[selected.row()]\n\n self.telefonoSelectedRow = selected.row()\n self.winPrincipal.txtTelefono_u.setText(str(self.telefonoSelected[2]))\n\n self.setTipoTelefono(str(self.telefonoSelected[1]))\n self.winPrincipal.btnCancelarTelefono_u.setVisible(True)\n self.winPrincipal.btnRestarTelefono_u.setEnabled(True)\n self.winPrincipal.tvTelefonos_u.setEnabled(False)\n\n self.winPrincipal.btnGuardar_u.setEnabled(False)\n self.winPrincipal.btnBorrar_u.setEnabled(False)\n\n def updateTelefono(self):\n\n listTelefono = []\n listTelefono = list(self.winPrincipal.tvTelefonos_u.model().mylist).copy()\n\n estado = ''\n telNew = Telefono()\n if len(listTelefono) > 0:\n if len(self.listTelefonosInit) > 0:\n\n listTelInit = list(self.listTelefonosInit)\n parche = (listTelefono[0][0], listTelefono[0][1], str(listTelefono[0][2]))\n listTelefono[0] = parche\n #Recorre la lista de telefono inicial\n for telInit in listTelInit:\n #recorre la lista de telefonos nueva\n for tel in listTelefono:\n telNew.setIdPersona(self.usuario.getIdPersona())\n telNew.setIdTelefono(tel[0])\n telNew.setTipo(tel[1])\n if tel[2] == \"\":\n estado = 'DEL'\n break\n else:\n telNew.setTelefono(tel[2])\n\n if tel[0] == 0:\n estado = 'INS'\n break\n\n if telInit[0] == tel[0]:\n if telInit[1] != tel[1] or telInit[2] != tel[2]:\n estado = 'UPD'\n break\n\n if estado == 'UPD':\n self.conexionTelefono.modificarTelefono(telNew)\n elif estado == \"INS\":\n self.conexionTelefono.insertarTelefono(telNew)\n elif estado == 'DEL':\n self.conexionTelefono.borrarTelefono(telNew)\n #Si la lista de telefono inicial es cero\n else:\n #recorre la lista de telefonos nueva para agregarlos a todos\n for telN in listTelefono:\n if telN[2] != '':\n telNew = Telefono()\n telNew.setIdPersona(self.usuario.getIdPersona())\n telNew.setIdTelefono(telN[0])\n telNew.setTipo(telN[1])\n telNew.setTelefono(telN[2])\n self.conexionTelefono.insertarTelefono(telNew)\n\n\n\n def insertTelefono(self):\n\n listTelefonosNew = []\n tel = self.winPrincipal.tvTelefonos_u.model()\n\n listTelefonosNew = list(self.winPrincipal.tvTelefonos_u.model().mylist).copy()\n\n if len(listTelefonosNew) > 0:\n self.conexionTelefono.insertTelefonoInit(listTelefonosNew)\n\n\n def onClickCancelarTelefono(self):\n self.winPrincipal.btnCancelarTelefono_u.setVisible(False)\n self.winPrincipal.txtTelefono_u.setText('')\n\n self.winPrincipal.btnRestarTelefono_u.setEnabled(False)\n self.winPrincipal.tvTelefonos_u.clearSelection()\n self.winPrincipal.tvTelefonos_u.setEnabled(True)\n\n self.winPrincipal.btnGuardar_u.setEnabled(True)\n self.winPrincipal.btnBorrar_u.setEnabled(True)\n\n def onClickSumarTelefono(self):\n numTelefono = self.winPrincipal.txtTelefono_u.text()\n\n if numTelefono.isdigit() == True:\n if self.winPrincipal.btnCancelarTelefono_u.isVisible() is True:\n self.updateTelefonoTabla()\n else:\n self.insertTelefonoTabla()\n\n self.winPrincipal.tvTelefonos_u.clearSelection()\n self.winPrincipal.btnRestarTelefono_u.setEnabled(False)\n self.winPrincipal.btnCancelarTelefono_u.setVisible(False)\n self.winPrincipal.txtTelefono_u.setText('')\n self.winPrincipal.tvTelefonos_u.setEnabled(True)\n\n self.winPrincipal.btnGuardar_u.setEnabled(True)\n else:\n alert = QDialog()\n QMessageBox.information(alert,\"ERROR\", \"El numero de telefono no es valido.\")\n\n\n def onClickRestarTelefono(self):\n listTabTel = []\n tipoTel = str(self.getTipoTelefono())\n listTelefonosNew = []\n\n listTabTel = list(self.winPrincipal.tvTelefonos_u.model().mylist).copy()\n\n header = ['Id', 'Tipo', 'Numero']\n telDel = [self.telefonoSelected[0], self.telefonoSelected[1], '']\n listTabTel[self.telefonoSelectedRow] = telDel\n tableTelModel = MyTableModel(self.winPrincipal, listTabTel, header)\n self.winPrincipal.tvTelefonos_u.setModel(tableTelModel)\n self.winPrincipal.tvTelefonos_u.selectionModel().currentChanged.connect(self.changeSelectedTableTel)\n self.winPrincipal.tvTelefonos_u.setRowHidden(self.telefonoSelectedRow, True)\n\n self.winPrincipal.btnCancelarTelefono_u.setVisible(False)\n self.winPrincipal.txtTelefono_u.setText('')\n self.winPrincipal.btnRestarTelefono_u.setEnabled(False)\n self.winPrincipal.tvTelefonos_u.setEnabled(True)\n\n self.winPrincipal.btnGuardar_u.setEnabled(True)\n self.winPrincipal.btnBorrar_u.setEnabled(True)\n\n def onClickTelefono(self):\n self.changeTipoTelefono(button='TEL')\n\n def onClickCelular(self):\n self.changeTipoTelefono(button='CEL')\n\n def onClickFax(self):\n self.changeTipoTelefono(button='FAX')\n\n def changeTipoTelefono(self, button):\n\n if button == 'TEL':\n self.winPrincipal.btnTelefono_u.setEnabled(False)\n self.winPrincipal.btnCelular_u.setEnabled(True)\n self.winPrincipal.btnFax_u.setEnabled(True)\n elif button == 'CEL':\n self.winPrincipal.btnTelefono_u.setEnabled(True)\n self.winPrincipal.btnCelular_u.setEnabled(False)\n self.winPrincipal.btnFax_u.setEnabled(True)\n elif button == 'FAX':\n self.winPrincipal.btnTelefono_u.setEnabled(True)\n self.winPrincipal.btnCelular_u.setEnabled(True)\n self.winPrincipal.btnFax_u.setEnabled(False)\n\n\n def setTipoTelefono(self, tipoTelefono):\n\n if tipoTelefono == 'TEL':\n self.winPrincipal.btnTelefono_u.setEnabled(False)\n self.winPrincipal.btnCelular_u.setEnabled(True)\n self.winPrincipal.btnFax_u.setEnabled(True)\n elif tipoTelefono == 'CEL':\n self.winPrincipal.btnTelefono_u.setEnabled(True)\n self.winPrincipal.btnCelular_u.setEnabled(False)\n self.winPrincipal.btnFax_u.setEnabled(True)\n elif tipoTelefono == 'FAX':\n self.winPrincipal.btnTelefono_u.setEnabled(True)\n self.winPrincipal.btnCelular_u.setEnabled(True)\n self.winPrincipal.btnFax_u.setEnabled(False)\n\n def getTipoTelefono(self):\n\n if self.winPrincipal.btnTelefono_u.isEnabled() != True:\n return 'TEL'\n elif self.winPrincipal.btnCelular_u.isEnabled() != True:\n return 'CEL'\n elif self.winPrincipal.btnFax_u.isEnabled() != True:\n return 'FAX'\n\n\n def insertTelefonoTabla(self):\n numTel = self.winPrincipal.txtTelefono_u.text()\n tipoTel = str(self.getTipoTelefono())\n\n modelListTelefono = self.winPrincipal.tvTelefonos_u.model()\n header = ['ID', 'Tipo', 'Numero']\n\n if modelListTelefono is not None:\n listTabTel = list(self.winPrincipal.tvTelefonos_u.model().mylist)\n\n if len(listTabTel) > 0 or listTabTel is not None:\n tuplaTel = ('0', tipoTel, numTel )\n listTabTel.append(tuplaTel)\n tupleTable = tuple(listTabTel)\n\n tableModel = MyTableModel(self.winPrincipal, tupleTable , header)\n self.winPrincipal.tvTelefonos_u.setModel(tableModel)\n self.winPrincipal.tvTelefonos_u.selectionModel().currentChanged.connect(self.changeSelectedTableTel)\n else:\n lista = []\n tuplaTel = ('0', tipoTel, numTel )\n lista.append(tuplaTel)\n\n tableModel = MyTableModel(self.winPrincipal, lista , header)\n self.winPrincipal.tvTelefonos_u.setModel(tableModel)\n self.winPrincipal.tvTelefonos_u.selectionModel().currentChanged.connect(self.changeSelectedTableTel)\n self.winPrincipal.tvTelefonos_u.setColumnHidden(0, True)\n self.winPrincipal.tvTelefonos_u.setColumnWidth(1, 36)\n self.winPrincipal.tvTelefonos_u.setColumnWidth(2, 175)\n\n\n def updateTelefonoTabla(self):\n listTabTel = []\n tipoTel = str(self.getTipoTelefono())\n listTelefonosNew = []\n prob = self.winPrincipal.tvTelefonos_u.selectionModel()\n prob1 = self.winPrincipal.tvTelefonos_u.model()\n listTabTel = list(self.winPrincipal.tvTelefonos_u.model().mylist).copy()\n\n telUpd = (self.telefonoSelected[0], tipoTel, int(self.winPrincipal.txtTelefono_u.text()))\n listTabTel[self.telefonoSelectedRow] = telUpd\n header = ['ID', 'Tipo', 'Numero']\n tableModel = MyTableModel(self.winPrincipal, listTabTel , header)\n self.winPrincipal.tvTelefonos_u.setModel(tableModel)\n self.winPrincipal.tvTelefonos_u.selectionModel().currentChanged.connect(self.changeSelectedTableTel)" }, { "alpha_fraction": 0.5809128880500793, "alphanum_fraction": 0.6016597747802734, "avg_line_length": 20.909090042114258, "blob_id": "72d8ca5d3d67ef76a73f9f3e83ad2de738621b1f", "content_id": "a7d0a4b3e9b69fcd7c260b8e904cb942ba9e9a37", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 241, "license_type": "no_license", "max_line_length": 61, "num_lines": 11, "path": "/registro/yarw.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "from winreg import EnumKey, HKEY_USERS\n \ntry:\n i = 0\n while True:\n subkey = EnumKey(HKEY_USERS, i)\n print(subkey)\n i += 1\nexcept WindowsError:\n # WindowsError: [Errno 259] No more data is available \n pass\n" }, { "alpha_fraction": 0.6086404323577881, "alphanum_fraction": 0.6111816763877869, "avg_line_length": 23.59375, "blob_id": "fb173c7ee5dac993c279ce0189aafe9d2e07f925", "content_id": "56aa43ab8d6ad4644f7cbda142fef5b9b9f46b40", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 787, "license_type": "no_license", "max_line_length": 86, "num_lines": 32, "path": "/pyqt5-curso/writer2.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import sys\nfrom PyQt5.QtWidgets import QApplication, QTextEdit, QWidget, QPushButton, QVBoxLayout\n\n\nclass Notepad(QWidget):\n\n def __init__(self):\n super(Notepad, self).__init__()\n self.text = QTextEdit(self)\n self.clr_btn = QPushButton('Save')\n\n self.init_ui()\n\n def init_ui(self):\n layout = QVBoxLayout()\n layout.addWidget(self.text)\n layout.addWidget(self.clr_btn)\n self.clr_btn.clicked.connect(self.save_text)\n\n self.setLayout(layout)\n self.setWindowTitle('PyQt5 TextEdit')\n\n self.show()\n\n def save_text(self):\n with open('test.txt', 'w') as f:\n my_text = self.text.toPlainText()\n f.write(my_text)\n\napp = QApplication(sys.argv)\nwriter = Notepad()\nsys.exit(app.exec_())\n" }, { "alpha_fraction": 0.4935064911842346, "alphanum_fraction": 0.5779221057891846, "avg_line_length": 34, "blob_id": "f4eca4b212cf75dfe17d35b1e8e6cad7ff2dabaa", "content_id": "877b0b3f324067a5923e07068f3cc31e941f2461", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 770, "license_type": "no_license", "max_line_length": 64, "num_lines": 22, "path": "/twilio/teste1.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import os\nfrom twilio.rest import Client\n\n\n# Find your Account SID and Auth Token at twilio.com/console\n# and set the environment variables. See http://twil.io/secure\n# account_sid = os.environ['TWILIO_ACCOUNT_SID']\n# auth_token = os.environ['TWILIO_AUTH_TOKEN']\naccount_sid = 'ACa67b281fe50d431059c3cbbaecce6b9d'\nauth_token = 'd4e4842f3fe4298a9d49990a0f6b1188'\nclient = Client(account_sid, auth_token)\n\nmessage = client.messages.create(\n body='Fala Henry!',\n # from_='whatsapp:+5561982246622',\n # to='whatsapp:+5561999181788'\n from_='whatsapp:+14155238886',\n to='whatsapp:+556182246622'\n )\n\nprint(message.sid)\nprint(message)\n" }, { "alpha_fraction": 0.6705202460289001, "alphanum_fraction": 0.712909460067749, "avg_line_length": 31.4375, "blob_id": "91517b6f5be00e165a09cf696e97ba5dc6d82655", "content_id": "c397b6f43ac55ec44b5a2ece134c8e19d99dbd89", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 525, "license_type": "no_license", "max_line_length": 101, "num_lines": 16, "path": "/twilio/teste.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "from twilio.rest import Client\nimport os\n\n# as credenciais são recuperadas das variáveis de ambiente TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN\nclient = Client()\n\nprint(client)\n\n# esse é o numero de teste da sandbox da Twilio\nfrom_whatsapp_number='whatsapp:+14155238886'\n# substitua esse número com o seu próprio número do Whatsapp\nto_whatsapp_number='whatsapp:+15005550006'\n\nclient.messages.create(body='Ahoy, world!',\n from_=from_whatsapp_number,\n to=to_whatsapp_number)\n" }, { "alpha_fraction": 0.5187835693359375, "alphanum_fraction": 0.5348837375640869, "avg_line_length": 18.964284896850586, "blob_id": "1cf3ddccea1f793b4ccebeab4c2691786eea3c5d", "content_id": "c0cb3130746b249f18bb1a8d8850c56a23b2462e", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 559, "license_type": "no_license", "max_line_length": 70, "num_lines": 28, "path": "/gabi.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import random\nimport sys\n\nans = True\n\nwhile ans:\n question = input(\"Who's your bias on BTS?: (press enter to quit)\")\n\n answers = random.randint(1,7)\n\n print(answers)\n\n if question == \"\":\n sys.exit()\n elif answers == 1:\n print (\"Jimin\")\n elif answers == 2:\n print (\"Yoongi\")\n elif answers == 3:\n print (\"Seokjin\")\n elif answers == 4:\n print (\"Namjoon\")\n elif answers == 5:\n print (\"Jungkook\")\n elif answers == 6:\n print (\"Taehyung\")\n elif answers == 7:\n print (\"Hoseok\")\n" }, { "alpha_fraction": 0.5074626803398132, "alphanum_fraction": 0.5658073425292969, "avg_line_length": 25.339284896850586, "blob_id": "c60a6da48bc35b88b77b023a80aaed8591e9dbed", "content_id": "1b91d84052d1926964c2ec7268bdfcb160fa93cf", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1474, "license_type": "no_license", "max_line_length": 83, "num_lines": 56, "path": "/mathplot/matplot-005.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import numpy as np\nimport matplotlib.pyplot as plt\nimport datetime as dt\nimport matplotlib.dates as md\n\ndata= np.loadtxt('vmstat_7days_without_header.csv', delimiter=',',\n dtype={'names': ['time', 'mon','tue','wed','thrs','fri','sat','sun'],\n 'formats': ['S8','i4','i4','i4','i4','i4','i4','i4']} )\n\nx,y1,y2,y3,y4,y5,y6,y7 = [],[],[],[],[],[],[],[]\n\nfor z in data:\n# 10 minute span\n # print(z[0].decode(\"utf-8\"))\n # print(int(z[0].split(':',2))[1])\n\n if int((z[0].decode(\"utf-8\").split(':',2))[1]) % 10 == 0:\n xc = dt.datetime.strptime(z[0].decode(\"utf-8\"),\"%H:%M:%S\")\n x.append(xc)\n y1.append(z[1])\n y2.append(z[2])\n y3.append(z[3])\n y4.append(z[4])\n y5.append(z[5])\n y6.append(z[6])\n y7.append(z[7])\n\nfig = plt.figure()\nax = fig.add_subplot(111)\nxfmt = md.DateFormatter('%H')\nax.xaxis.set_major_formatter(xfmt)\nax.grid()\n\n# slanted x-axis tick label\nfig.autofmt_xdate()\n\np1 = plt.plot(x,y1,'rs')\np2 = plt.plot(x,y2,'gp')\np3 = plt.plot(x,y3,'b*')\np4 = plt.plot(x,y4,'ch')\np5 = plt.plot(x,y5,'mp')\np6 = plt.plot(x,y6,'ys')\np7 = plt.plot(x,y7,'kD')\n\nplt.ylabel(\"CPU Idle [%]\")\nplt.xlabel(\"Time of the day[hr]\")\n\nplt.ylim(84.0, 101)\n\nplt.title(\"CPU Load for 7 days (10min interval), Idling Time, from vmstat command\")\n\n# let python select the best position for legend\nplt.legend((p1[0],p2[0],p3[0],p4[0],p5[0],p6[0],p7[0]), \n ('Mon','Tue','Wed','Thu','Fri','Sat','Sun'))\n\nplt.show()" }, { "alpha_fraction": 0.6674107313156128, "alphanum_fraction": 0.6685267686843872, "avg_line_length": 21.9743595123291, "blob_id": "c4ef681b6e4711539372f8585b57c2ee886ccaf6", "content_id": "5db25b96a8db08e551a40796bd67aa8582b10f16", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 896, "license_type": "no_license", "max_line_length": 76, "num_lines": 39, "path": "/Hospital-Helper-2-master/app/main.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import os\nimport sys\n\nsys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))\n\nfrom app.gui import main as gui\nfrom app.model import db, logic, exceptions, localization\n\n\ndef convert_structure_to_items(structure):\n parser = logic.Parser()\n object_factory = logic.ObjectFactory\n\n parsed_structure = parser.parse_structure(structure)\n\n items = []\n names = set()\n for i, item in enumerate(parsed_structure, 1):\n\n names.add(item['name'])\n items.append(object_factory.get_object(item))\n if i != len(names):\n raise exceptions.NonUniqueObjectNames(item['name'])\n\n return items\n\n\ndef init():\n\n structure = db.create_db()\n items = convert_structure_to_items(structure)\n # localization.Localization.install('ru')\n localization.Localization.install('en')\n\n return items\n\n\nif __name__ == '__main__':\n gui.init(init)\n" }, { "alpha_fraction": 0.5031334161758423, "alphanum_fraction": 0.5085049271583557, "avg_line_length": 23.844444274902344, "blob_id": "629aa4aeb1baa1a82ddc2b87cc1fb2debff7d92d", "content_id": "8111e0a8bb4545de1b4d176bfe138df5d882fcb8", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1118, "license_type": "no_license", "max_line_length": 73, "num_lines": 45, "path": "/gallery/app.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "# coding: utf-8\nimport db\nfrom flask import Flask, abort, url_for\n\napp = Flask(__name__)\n\n\n# Registro de rota usando decorator\n@app.route('/')\ndef index():\n \"\"\"Retorna uma lista html com todos os users do db\"\"\"\n html = ['<ul>']\n for username, user in db.users.items():\n html.append(\n f\"\"\"\n <li>\n <a href='{url_for('user', username=username)}'>\n {user['name']}\n </a>\n </li>\n \"\"\"\n )\n html.append('</ul>')\n return '\\n'.join(html)\n\n\ndef profile(username):\n \"\"\"Retorna um usuario especifico filtrando pelo username\"\"\"\n user = db.users.get(username)\n\n if user:\n return f\"\"\"\n <h1>{user['name']}</h1>\n <img src=\"{user['image']}\"/><br/>\n telefone: {user['tel']} <br/>\n <a href=\"{url_for('index')}\">Voltar</a>\n \"\"\"\n else:\n return abort(404, \"User not found\")\n\n\n# Registro de rota usando chamada de método\napp.add_url_rule('/user/<username>/', view_func=profile, endpoint='user')\n\n# app.run(use_reloader=True)" }, { "alpha_fraction": 0.6850094795227051, "alphanum_fraction": 0.7020872831344604, "avg_line_length": 23, "blob_id": "08493c758e231479d5b417cc89b9bd2f86de213e", "content_id": "f887c0b371814da6a59cc6e7bc5113015c188534", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 527, "license_type": "no_license", "max_line_length": 60, "num_lines": 22, "path": "/le-pagina1.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import urllib.request\nimport time\nfrom bs4 import BeautifulSoup\n\nt0= time.time()\nreq = urllib.request.urlopen('http://1linha.com.br')\npageHtml = req.read()\nt1 = time.time()\n# print(pageHtml)\nprint(\"Total time to fetch page : {} seconds\".format(t1-t0))\n\n# soup = BeautifulSoup(req.read(), \"html.parser\")\nsoup = BeautifulSoup(pageHtml, 'html.parser')\n\nfor link in soup.find_all('a'):\n print(link.get('href'))\n\nt2 = time.time()\nprint(\"Total execution time: {} seconds\".format(t2-t1))\n# print(soup.prettify())\n\nprint(soup.title)" }, { "alpha_fraction": 0.5791311264038086, "alphanum_fraction": 0.5817945003509521, "avg_line_length": 33.064517974853516, "blob_id": "37358d0c493d363654fdc1398dd92c8d8bb8105d", "content_id": "4d0367061820e4ab00817c9d388c967dc3dd2059", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 17144, "license_type": "no_license", "max_line_length": 127, "num_lines": 496, "path": "/Hospital-Helper-2-master/app/gui/template_widget.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import functools\n\nfrom bs4 import BeautifulSoup\n\nfrom PyQt5.Qt import QColor, Qt, QBrush, QFont, QRegExp\nfrom PyQt5.QtGui import QSyntaxHighlighter, QTextCharFormat, QGuiApplication\nfrom PyQt5.QtWidgets import (QFrame, QHBoxLayout, QLabel, QStackedLayout,\n QVBoxLayout, QPushButton, QTextEdit, QWidget,\n QRadioButton, QLineEdit, QComboBox)\n\nfrom app.model import template as template_module\nfrom app.model import exceptions\n\nfrom app.gui import utils\nfrom app.gui.text_edit_with_format_controls import TextEditWithFormatControls\n\n\nclass SyntaxHighlighter(QSyntaxHighlighter):\n\n def __init__(self, items, parent):\n super().__init__(parent)\n\n self.rules = []\n self.items = items\n\n brush = QBrush(QColor(69, 160, 163), Qt.SolidPattern)\n self.item_keywords = QTextCharFormat()\n self.item_keywords.setForeground(brush)\n self.item_keywords.setFontWeight(QFont.Bold)\n\n self.keywords = QTextCharFormat()\n self.keywords.setForeground(brush)\n\n def set_rules(self, item):\n self.rules = []\n for each in self.items:\n if each.id == item.id:\n format_ = self.item_keywords\n else:\n format_ = self.keywords\n\n for w in map(_, each.keys()):\n pattern = QRegExp(r\"\\{%s.%s\\}\" % (_(each.name), w))\n self.rules.append({'pattern': pattern, 'format': format_})\n\n self.rehighlight()\n\n def highlightBlock(self, text):\n for rule in self.rules:\n expression = QRegExp(rule['pattern'])\n index = expression.indexIn(text)\n while index >= 0:\n length = expression.matchedLength()\n self.setFormat(index, length, rule['format'])\n index = expression.indexIn(text, index + length)\n self.setCurrentBlockState(0)\n\n\nclass TemplateEditingWidget(QFrame):\n\n \"\"\"\n Widget for editing the tempate.\n \"\"\"\n\n def __init__(self, main_window, items, close_func):\n\n super().__init__()\n\n self.items = items\n self.item = None\n self.template = None\n self.name_text_edit = None\n self.template_text_edit = None\n self.conclusion_text_edit = None\n self.controls_layout = QVBoxLayout()\n self._close = close_func\n self.save = self._get_save_func(main_window)\n self.showEvent = self._get_show_event(main_window)\n\n layout = QHBoxLayout()\n self.setLayout(layout)\n\n layout.addWidget(self._get_control_layout(), stretch=20)\n layout.addLayout(self._get_text_layout(), stretch=80)\n\n def _get_control_layout(self):\n \"\"\"\n Create static layout.\n \"\"\"\n\n widget = QWidget()\n vbox = QVBoxLayout()\n widget.setLayout(vbox)\n vbox.setContentsMargins(0, 0, 0, 0)\n\n self.template_combo_box = QComboBox()\n self.template_combo_box.currentIndexChanged.connect(self._item_selected)\n vbox.addWidget(self.template_combo_box)\n\n scrollable_vbox = utils.get_scrollable(self.controls_layout)\n vbox.addWidget(scrollable_vbox, stretch=80)\n\n buttons_layout = QHBoxLayout()\n vbox.addLayout(buttons_layout, stretch=20)\n\n # b = QPushButton('Назад')\n b = QPushButton('Voltar')\n b.setObjectName('controls')\n b.clicked.connect(self._close)\n buttons_layout.addWidget(b)\n\n widget.setGraphicsEffect(utils.get_shadow())\n return widget\n\n def _get_text_layout(self):\n \"\"\"\n Create TextEdit widgets.\n \"\"\"\n\n layout = QVBoxLayout()\n self.template_edit_widget = TextEditWithFormatControls(self.items, SyntaxHighlighter)\n self.template_text_edit = self.template_edit_widget.template_text_edit\n self.conclusion_text_edit = TextEditWithFormatControls(self.items, SyntaxHighlighter, ['la', 'ca', 'ra'])\n self.name_text_edit = QLineEdit()\n\n for w, p, s in zip(self._get_all_text_fields(),\n # ('Имя', 'Шаблон', 'Заключение'),\n ('Nome', 'Modelo', 'Conclusão'),\n (5, 60, 35)):\n w.setPlaceholderText(p)\n w.setGraphicsEffect(utils.get_shadow())\n layout.addWidget(w, stretch=s)\n\n return layout\n\n def _get_show_event(self, main_window):\n def showEvent(event):\n main_window.communication.action_button_toggle.emit(True, 'save', self.save)\n\n return showEvent\n\n def _get_all_text_fields(self):\n \"\"\"\n Get all TextEdit fields.\n \"\"\"\n\n return self.name_text_edit, self.template_edit_widget, self.conclusion_text_edit\n\n def _item_selected(self, index):\n self._fill_controls_layout(self.items[index])\n\n def _fill_controls_layout(self, item):\n keywords = [_(key) for key in item.keys()]\n utils.clear_layout(self.controls_layout)\n for name in keywords:\n b = QPushButton(_(name))\n b.clicked.connect(functools.partial(self.template_text_edit.insert_attribute, item, name))\n self.controls_layout.addWidget(b)\n\n self.controls_layout.addStretch()\n return keywords\n\n def _show(self, item, template=None):\n \"\"\"\n Fill TextEdit fields with template data if it was provided.\n Add menu buttons with item attributes.\n \"\"\"\n\n self.template_text_edit.set_rules(item)\n\n self.item = item\n self.template = template\n\n for i, each in enumerate(self.items):\n self.template_combo_box.addItem(_(each.name))\n if each.id == item.id:\n self.template_combo_box.setCurrentIndex(i)\n\n if self.template:\n self.template = template_module.Template.get_from_db(item=self.item,\n items=self.items,\n name=self.template.name)\n self.template.body = self.template.get_translated_body()\n\n for w, t in zip(self._get_all_text_fields(),\n (self.template.name, self.template.body, self.template.conclusion)):\n try:\n w.setHtml(t)\n except AttributeError:\n w.setText(t)\n else:\n for w in self._get_all_text_fields():\n w.setText('')\n\n def _get_save_func(self, main_window):\n def save(event):\n \"\"\"\n Save template.\n \"\"\"\n\n if not self.template:\n self.template = template_module.Template()\n self.template.item = self.item\n self.template.items = self.items\n self.template.name = self.name_text_edit.text()\n\n for attr, text_edit in zip(('body', 'conclusion'), (self.template_text_edit, self.conclusion_text_edit)):\n text = ''.join(filter(lambda x: '\\n' not in x,\n map(str, BeautifulSoup(text_edit.toHtml(), 'html.parser').body.contents)))\n setattr(self.template, attr, text)\n\n try:\n self.template.render_and_save()\n except exceptions.CannotSaveTemplate:\n # main_window.create_alert('Не удалось сохранить шаблон.\\nПоле \"Имя\" обязательно.')\n main_window.create_alert('Não foi possível salvar o modelo.\\nO campo \"Nome\" é obrigatório.')\n except exceptions.NeedBodyOrConclusion:\n # main_window.create_alert('Необходимо добавить тело или заключение шаблона.')\n main_window.create_alert('É necessário adicionar um corpo ou uma conclusão padrão.')\n else:\n # main_window.show_message('Шаблон сохранен')\n main_window.show_message('Modelo salvo')\n return save\n\n\nclass AbstractTemplateWidget(QFrame):\n\n \"\"\"\n TemplateWidget is used in reports and options tab.\n So it needs several common methods and common layout.\n But behavior is different. it should be defined in children classes.\n \"\"\"\n\n def __init__(self, main_window, items):\n super().__init__()\n\n self.items = items\n self.visible_items = []\n self.layout = QStackedLayout()\n self.menu_layout = QVBoxLayout()\n self.templates_layout = QStackedLayout()\n self.showEvent = self._get_show_event(main_window)\n self.menu_wrapper = QVBoxLayout()\n\n try:\n self.ACTION_BTN_ICON\n except AttributeError:\n self.ACTION_BTN_ICON = ''\n\n self.setLayout(self.layout)\n\n self.layout.addWidget(self._get_static_widgets())\n\n def _get_static_widgets(self):\n \"\"\"\n Create layout that does not depend on content.\n \"\"\"\n\n hbox = QHBoxLayout()\n self.menu_wrapper.addWidget(utils.get_scrollable(self.menu_layout))\n hbox.addLayout(self.menu_wrapper, stretch=30)\n hbox.addLayout(self.templates_layout, stretch=70)\n widget = QWidget()\n widget.setLayout(hbox)\n widget.setGraphicsEffect(utils.get_shadow())\n return widget\n\n def _iterate_items(self):\n \"\"\"\n Filter items if they has no values.\n \"\"\"\n pass\n\n def hideEvent(self, event):\n \"\"\"\n Clear menu and templates.\n \"\"\"\n\n utils.clear_layout(self.menu_layout)\n utils.clear_layout(self.templates_layout)\n\n def _get_show_event(self, main_window):\n \"\"\"\n Update templates list and re-select them.\n \"\"\"\n\n def show_event(event):\n utils.clear_layout(self.menu_layout)\n utils.clear_layout(self.templates_layout)\n\n self.visible_items = self._iterate_items()\n self._show_menu()\n self._show_templates()\n if not self.layout.currentIndex():\n main_window.communication.action_button_toggle.emit(bool(self.visible_items),\n self.ACTION_BTN_ICON,\n self.action_btn_function)\n\n return show_event\n\n def _show_menu(self):\n \"\"\"\n Update menu on showEvent.\n \"\"\"\n\n for i, item in enumerate(self.visible_items):\n b = QRadioButton(self._get_button_name(item))\n b.setChecked(i == 0)\n b.clicked.connect(functools.partial(self.templates_layout.setCurrentIndex, i))\n b.setObjectName('menu_button')\n self.menu_layout.addWidget(b)\n\n if not self.visible_items:\n self.menu_layout.addStretch()\n # l = QLabel('Чтобы создать отчет\\nначните заполнять данные')\n l = QLabel('Para criar um relatório,\\ninicie os dados de preenchimento')\n l.setAlignment(Qt.AlignCenter)\n self.menu_layout.addWidget(l)\n\n self.menu_layout.addStretch()\n\n def _show_templates(self):\n \"\"\"\n Update templates on shoeEvent.\n \"\"\"\n\n cols = 3\n templates = template_module.Template.get_all()\n check_templates = []\n\n for j, item in enumerate(self.visible_items):\n if not templates[item.id]:\n # l = QLabel('Нет шаблонов для данного объекта\\nУправлять шаблонами можно на вкладке настроек')\n l = QLabel('Não há modelos para este objeto\\nOs modelos de gerenciamento podem estar na guia de configurações')\n l.setAlignment(Qt.AlignCenter)\n self.templates_layout.addWidget(l)\n continue\n layouts = [QVBoxLayout() for _ in range(cols)]\n for i, each in enumerate(templates[item.id]):\n b = QRadioButton(each.name)\n b.setChecked(item.template == each)\n b.clicked.connect(functools.partial(self._template_clicked, j, each))\n if len(templates[item.id]) == 1:\n check_templates.append((b, j, each))\n b.mouseDoubleClickEvent = functools.partial(self.open_template_edit_widget, j, each)\n layouts[i % cols].addWidget(b)\n\n wrapper = QHBoxLayout()\n for each in layouts:\n each.addStretch()\n wrapper.addLayout(each, stretch=int(100 / cols))\n self.templates_layout.addWidget(utils.get_scrollable(wrapper))\n for i, each in enumerate(check_templates):\n b, j, template = each\n self._template_clicked(j, template, i == 0)\n b.setChecked(True)\n\n\n def _template_selected(self, index, template):\n\n \"\"\"\n Change menu item name.\n Add template for the item.\n \"\"\"\n\n self.visible_items[index].template = template\n buttons = self.findChildren(QRadioButton, name='menu_button')\n buttons[index].setText(self._get_button_name(self.visible_items[index]))\n for i in range(len(self.visible_items)):\n ind = (i + index) % len(self.visible_items)\n if not self.visible_items[ind].template:\n self.templates_layout.setCurrentIndex(ind)\n buttons[ind].setChecked(True)\n buttons[index].setChecked(False)\n return\n\n def _get_button_name(self, item):\n pass\n\n def _double_click(self, index, template, event):\n pass\n\n def _template_clicked(self, index, template, show_next=False):\n pass\n\n def action_btn_function(self, event):\n pass\n\n def open_template_edit_widget(self, index, template, event):\n pass\n\n\nclass TemplateWidgetInOptions(AbstractTemplateWidget):\n\n \"\"\"\n Contains menu with the list of items with templates.\n \"\"\"\n\n def __init__(self, main_window, items, parent):\n self.ACTION_BTN_ICON = 'plus'\n super().__init__(main_window, items)\n\n self.template_editing_widget = TemplateEditingWidget(main_window, items, self._close_func)\n self.layout.addWidget(self.template_editing_widget)\n # b = QPushButton('Назад')\n b = QPushButton('Voltar')\n b.setObjectName('controls')\n b.clicked.connect(functools.partial(parent.set_current_index, 0))\n self.menu_wrapper.addWidget(b)\n\n def _close_func(self):\n self.layout.setCurrentIndex(0)\n self.showEvent(event=None)\n\n def _iterate_items(self):\n \"\"\"\n Return all values.\n \"\"\"\n return self.items\n\n def _get_button_name(self, item):\n \"\"\"\n Return item name\n \"\"\"\n return _(item.name)\n\n def open_template_edit_widget(self, index, template=None, event=None):\n \"\"\"\n Open TemplateEditingWidget with or without template.\n \"\"\"\n self.layout.setCurrentIndex(1)\n self.template_editing_widget._show(self.visible_items[index], template)\n\n def action_btn_function(self, event):\n self.open_template_edit_widget(self.templates_layout.currentIndex())\n\n\nclass TemplateWidget(AbstractTemplateWidget):\n\n def __init__(self, main_window, items):\n self.ACTION_BTN_ICON = 'check'\n self.action_btn_function = main_window.create_report\n super().__init__(main_window, items)\n\n def _iterate_items(self):\n \"\"\"\n Filter items if they has no values.\n \"\"\"\n items = []\n for item in self.items:\n for value in item.values():\n if value:\n items.append(item)\n break\n\n return items\n\n def _get_button_name(self, item):\n \"\"\"\n Return item name + template name\n \"\"\"\n\n if item.template:\n return '{} - {}'.format(_(item.name), item.template.name)\n\n return _(item.name)\n\n def _add_template(self):\n pass\n\n def _template_clicked(self, index, template, select_next=False):\n \"\"\"\n Set item's template to selected.\n If Ctrl key pressed - find next item without the template and focus on it.\n \"\"\"\n\n self.visible_items[index].template = template\n buttons = self.findChildren(QRadioButton, name='menu_button')\n buttons[index].setText(self._get_button_name(self.visible_items[index]))\n\n if QGuiApplication.keyboardModifiers() != Qt.ControlModifier and not select_next:\n return\n\n for i in range(len(self.visible_items)):\n ind = (i + index) % len(self.visible_items)\n if not self.visible_items[ind].template:\n self.templates_layout.setCurrentIndex(ind)\n buttons[ind].setChecked(True)\n buttons[index].setChecked(False)\n return\n\n def keyPressEvent(self, event):\n if QGuiApplication.keyboardModifiers() != Qt.ControlModifier:\n return\n if event.key() == Qt.Key_Return:\n self.action_btn_function(event=None)\n" }, { "alpha_fraction": 0.6200093030929565, "alphanum_fraction": 0.6265088319778442, "avg_line_length": 25.10909080505371, "blob_id": "0e88ad8a2183be56ab18fed22ed9b91d55e8afa3", "content_id": "ab89bbba8f3dba2dfb0dd42565c511c891627533", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 4346, "license_type": "no_license", "max_line_length": 80, "num_lines": 165, "path": "/JPro-master/pbox.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "\n#====##====##====##====##====#\n#====##====##====##====##====#\n'''\nPRODUCTION QUEUE: \n\n- The widget contained inside displays a table of current orders \n'''\n#====##====##====##====##====#\n#====##====##====##====##====#\n\nimport sys \nimport datetime\nfrom PyQt5.QtWidgets import (QApplication, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQWidget, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQLabel, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQTableWidget, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQTableWidgetItem,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQTableView,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQVBoxLayout,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQHBoxLayout,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQPushButton,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tqApp,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQShortcut,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQDialog,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQAbstractItemView,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQGridLayout,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQHeaderView,\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\nfrom PyQt5.QtGui import QKeySequence\nfrom connect import Connect \nfrom dbcreation import Base, Models, ProductionQueue\nfrom dialog_new import Dialog as DBox\nfrom PyQt5.QtSql import QSqlDatabase, QSqlTableModel\n\n\nclass PBox(QWidget): \n\n\tdef __init__(self): \n\t\tsuper().__init__()\n\n\t\tself.label1 = QLabel('Machine Production',self)\n\n\t\t#====##====##====##====##====#\n\t\t#SESSION EXTRACTION TO TABLE \n\t\t#====##====##====##====##====#\n\n\t\t#UNCOMMENT FOR FINAL PRODUCT\n\t\t# db = QSqlDatabase.database(\"pbox\")\n\n\t\t#Development product - Please turn on to edit widget alone.\n\n\t\tdb = QSqlDatabase.addDatabase(\"QSQLITE\")\n\t\tdb.setDatabaseName(\"complete.db\")\n\t\tdb.open()\n\n\t\t#Session instance creation \n\t\t#Extract all orders in the procedure queue\n\n\t\t# self.table.setHorizontalHeaderItem(0, QTableWidgetItem('Order No. /订单号'))\n\t\t# self.table.setHorizontalHeaderItem(1, QTableWidgetItem('Model/型号')) \n\t\t# self.table.setHorizontalHeaderItem(2, QTableWidgetItem('Quantity / 数量 '))\n\t\t# self.table.setHorizontalHeaderItem(3, QTableWidgetItem('Order Date / 订单日期'))\n\n\t\t'''\n\t\tUse QHeader Class to resize the tables\n\t\t'''\n\n\n\t\t# Iterating through all records \n\t\t\n\t\t# self.setData(self.all_orders)\n\n\t\tself.model = QSqlTableModel(self, db)\n\t\tself.model.setTable(\"productionqueue\")\n\t\tself.model.setEditStrategy(QSqlTableModel.OnManualSubmit)\n\t\tself.model.select()\n\n\t\tself.tableview = QTableView()\n\t\tself.tableview.setModel(self.model)\n\t\tself.tableview.hideColumn(0)\n\n\t\tself.order_header = self.tableview.horizontalHeader()\n\t\tself.order_header.setMinimumSectionSize(130)\n\t\tself.order_header.setSectionResizeMode(QHeaderView.Stretch)\n\t\tself.tableview.setSelectionBehavior(QAbstractItemView.SelectRows)\n\t\t#self.tableview.setCurrentCell(-1,-1)\n\n\t\tprint(self.tableview.rowAt(1))\n\n\t\tself.select = self.tableview.selectionModel()\n\t\tprint('Current index: ', self.tableview.selectRow(-1))\n\t\tprint ('Selected: ',self.select.selectedRows())\n\t\tprint ('has selection: ', self.select.hasSelection())\n\n\t\t#====##====##====##====##====#\n\t\t#CONTROL PANEL \n\t\t#====##====##====##====##====#\n\n\t\tself.btn_neworder = QPushButton('New / 加单', self)\n\t\tself.btn_neworder.clicked.connect(self.getDBox)\n\n\t\tself.btn_deleterecord = QPushButton('Delete / 取消', self)\n\t\tself.btn_deleterecord.clicked.connect(self.deleteRecord)\n\n\t\t#====##====##====##====##====#\n\t\t#Layout forming\n\t\t#====##====##====##====##====#\t\t\n\n\t\tself.vBox = QVBoxLayout()\n\n\t\t#Adding tableview into VBoxLayout\n\t\tself.tableBox = QGridLayout()\n\t\tself.tableBox.addWidget(self.tableview)\n\n\t\tself.controlBox = QHBoxLayout()\n\t\tself.controlBox.addWidget(self.btn_neworder)\n\t\tself.controlBox.addWidget(self.btn_deleterecord)\n\n\t\tself.vBox.addWidget(self.label1)\n\t\tself.vBox.addLayout(self.tableBox)\n\t\tself.vBox.addLayout(self.controlBox)\n\n\t\tself.setLayout(self.vBox)\n\n\t\tself.setGeometry(0,0,640,440)\n\t\tself.show()\n\n\t\t#====##====##====##====##====#\n\t\t#CONTROL PANEL \n\t\t#====##====##====##====##====#\n\n\t'''\n\tgetDBox: Brings up the Dialog Box from dialog_new\n\t'''\n\tdef getDBox(self) : \n\t\tdbox = DBox()\n\t\tdbox.exec()\n\t\tif dbox.oq_input.text():\n\t\t\t# print ('number of rows: ', self.model.rowCount())\n\t\t\t# print(dbox.new_record)\n\t\t\tself.model.insertRecord(self.model.rowCount(),dbox.new_record)\n\t\t\tself.model.submitAll()\n\t\t\tdbox.new_record = -1\n\n\n\t'''\n\tdeleteRecord: \n\n\t- removes both from the view and the database \n\n\t'''\t\t\t\n\n\tdef deleteRecord(self):\n\t\tif self.select.hasSelection():\n\t\t\tqmodelindex = self.select.selectedRows()[0]\n\t\t\trow = qmodelindex.row()\n\t\t\tself.model.removeRows(row,1)\n\t\t\tself.model.submitAll()\n\n\nif __name__ == '__main__' : \n\n\tapp = QApplication(sys.argv)\n\tpbox = PBox()\n\tsys.exit(app.exec_())" }, { "alpha_fraction": 0.689393937587738, "alphanum_fraction": 0.689393937587738, "avg_line_length": 30.238094329833984, "blob_id": "29e7099b5bcc1c76d100f80597550fcb10dcb653", "content_id": "8d03fbb4b12842513ae89f472db3e915c10bd64b", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 660, "license_type": "no_license", "max_line_length": 105, "num_lines": 21, "path": "/curses/nps005.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/python\nimport curses\nimport npyscreen\n\nnpyscreen.TEST_SETTINGS['TEST_INPUT'] = [ch for ch in 'This is a test']\nnpyscreen.TEST_SETTINGS['TEST_INPUT'].append(curses.KEY_DOWN)\nnpyscreen.TEST_SETTINGS['CONTINUE_AFTER_TEST_INPUT'] = True\n\nclass TestForm(npyscreen.Form):\n def create(self):\n self.myTitleText = self.add(npyscreen.TitleText, name=\"Events (Form Controlled):\", editable=True)\n\nclass TestApp(npyscreen.StandardApp):\n def onStart(self):\n self.addForm(\"MAIN\", TestForm)\n\n\nif __name__ == '__main__':\n A = TestApp()\n A.run(fork=False)\n # 'This is a test' will appear in the first widget, as if typed by the user.\n " }, { "alpha_fraction": 0.6140350699424744, "alphanum_fraction": 0.7982456088066101, "avg_line_length": 27.5, "blob_id": "37f3d5bae5e064c9d74bd31eb480ddc51ce89026", "content_id": "cea585547eb6ebb5db3e9819965236b720ca1620", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 228, "license_type": "no_license", "max_line_length": 110, "num_lines": 8, "path": "/Wanderson-Magalhaes/Render_Time_Calculator-master/README.md", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "# Render Time Calculator - Open Code\nRender Time Calculator prview:\n![RTC_3](https://user-images.githubusercontent.com/60605512/83827524-ebe1f680-a6b4-11ea-83e1-179e57443839.PNG)\n\n# Requeriments\nPython 3.7 >\nPySide2\nPyTimeParse\n" }, { "alpha_fraction": 0.6427061557769775, "alphanum_fraction": 0.6437631845474243, "avg_line_length": 26.823530197143555, "blob_id": "812248a8164863b123be84ff54d8eaf319a53f08", "content_id": "2a1e5c0be43bde5f30608c00b468d722e2681adc", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 946, "license_type": "no_license", "max_line_length": 105, "num_lines": 34, "path": "/Hospital-Helper-2-master/app/gui/data_widget.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "from PyQt5.QtWidgets import QFrame, QStackedLayout\n\nfrom app.gui.attributes_frame import AttributesFrame\n\n\nclass DataWidget(QFrame):\n\n def __init__(self, main_window, items):\n\n \"\"\"\n Widget contains items with inputs.\n \"\"\"\n\n super().__init__(main_window)\n\n stacked_layout = QStackedLayout()\n main_window.communication.item_selected.connect(stacked_layout.setCurrentIndex)\n self.setLayout(stacked_layout)\n\n self.showEvent = self._get_show_event(main_window)\n\n for item in items:\n frame = AttributesFrame(main_window=main_window, item=item)\n stacked_layout.addWidget(frame)\n\n @staticmethod\n def _get_show_event(main_window):\n \"\"\"\n Emit signal to hide ActionButton.\n \"\"\"\n def show_event(event):\n main_window.communication.action_button_toggle.emit(True, 'refresh', main_window.clean_input)\n\n return show_event\n" }, { "alpha_fraction": 0.6518691778182983, "alphanum_fraction": 0.6565420627593994, "avg_line_length": 21.473684310913086, "blob_id": "f7fb194251fb1d12683dfd76adcd3ef2bdb2f0ef", "content_id": "6c18b12cc9ee2f0da7fa158da373ef723c9befa5", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 428, "license_type": "no_license", "max_line_length": 57, "num_lines": 19, "path": "/fullcontrol_001/xml-produtos.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/python3\n\nimport os\nimport sys\nimport xmltodict\nfrom collections import OrderedDict\n\nwith open('xmls/importar_produtos.xml', 'rb') as arquivo:\n# with open('nfe.xml', 'rb') as arquivo:\n dados = arquivo.read().decode('UTF-8')\n doc = xmltodict.parse(dados)\n # print(doc)\n skus = []\n for sku in doc['root']['produto']:\n skus.append(sku['sku'])\n\nprint(skus)\nprint(sorted(set(skus)))\nprint(len(skus))\n\n" }, { "alpha_fraction": 0.7361111044883728, "alphanum_fraction": 0.7361111044883728, "avg_line_length": 35.16666793823242, "blob_id": "10d549c105098a94020cccc5d15a392d926e78aa", "content_id": "e96b1d0d5479b8d2eabbbe6d3406a11157f6e96c", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 216, "license_type": "no_license", "max_line_length": 66, "num_lines": 6, "path": "/FullControl-SiteMon/echo_cli.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "from twisted.internet.protocol import Protocol\n\nclass WelcomeMessage(Protocol):\n def connectionMade(self):\n self.transport.write(\"Hello server, I am the client!\\r\\n\")\n self.transport.loseConnection()" }, { "alpha_fraction": 0.5829959511756897, "alphanum_fraction": 0.5870445370674133, "avg_line_length": 16.35714340209961, "blob_id": "011f9fc0465ca753efbfce596f765a0c1f1a1e6c", "content_id": "fd4de77d4f644fce69074d80f9ec4e577000d4b8", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 247, "license_type": "no_license", "max_line_length": 51, "num_lines": 14, "path": "/flavio/lepasta.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/python3\n\nimport os\n\n\nlista = []\n\ndef monta_lista(pasta):\n for dirpath, dirnames, files in os.walk(pasta):\n for name in files:\n path = os.path.join(dirpath, name)\n lista.append(path)\n\n return lista\n " }, { "alpha_fraction": 0.6173285245895386, "alphanum_fraction": 0.6269554495811462, "avg_line_length": 28.714284896850586, "blob_id": "8448b53b4c6aaf3aa08d68703fc098636be615f5", "content_id": "1151f26536c3bbad24cc3cca072ce2525d8fda56", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 832, "license_type": "no_license", "max_line_length": 69, "num_lines": 28, "path": "/cursopython/vin.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "def encrypt(plaintext, key):\n key_length = len(key)\n key_as_int = [ord(i) for i in key]\n plaintext_int = [ord(i) for i in plaintext]\n ciphertext = ''\n for i in range(len(plaintext_int)):\n value = (plaintext_int[i] + key_as_int[i % key_length]) % 26\n ciphertext += chr(value + 65)\n return ciphertext\n\n\ndef decrypt(ciphertext, key):\n key_length = len(key)\n key_as_int = [ord(i) for i in key]\n ciphertext_int = [ord(i) for i in ciphertext]\n plaintext = ''\n for i in range(len(ciphertext_int)):\n value = (ciphertext_int[i] - key_as_int[i % key_length]) % 26\n plaintext += chr(value + 65)\n return plaintext\n\n# remover os espaços antes de cryptografar \n\na = encrypt('CRACKTHECRYPTO', 'SHELLTER')\nprint(a)\n\nb = decrypt('DLECYBRXNPKPYXVVOPXSDAICDAIC', 'SHELLTER')\nprint(b)" }, { "alpha_fraction": 0.6533719897270203, "alphanum_fraction": 0.6577230095863342, "avg_line_length": 27.14285659790039, "blob_id": "c42265341861c17ffaa3225a44dc58925a689b96", "content_id": "bb304bdd3080c8406775a2d90c63b38d14004d1d", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1383, "license_type": "no_license", "max_line_length": 77, "num_lines": 49, "path": "/pong/main.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n# Imports\nfrom kivy.app import App\nfrom kivy.uix.widget import Widget\nfrom kivy.vector import Vector\nfrom kivy.lang import Builder\nfrom kivy.config import Config\nfrom kivy.core.audio import SoundLoader\nfrom widgets import Pong, Raquete, Bola\nfrom telas import *\nfrom kivy.uix.screenmanager import ScreenManager, Screen\n\n# Carrega nosso arquivo de configurações\nConfig.read(\"config.ini\")\n\n# Cria nosso Gerenciador de Telas\nscreen_manager = ScreenManager()\n\nclass PongApp(App):\n\n def build(self):\n\n # Carrega o áudio\n sound = SoundLoader.load('audio/bg-music.mp3')\n\n # Verifica se houve o carregamento do nosso áudio e coloca para tocar\n if sound:\n sound.play()\n\n # Objeto do nosso jogo\n pong = Pong(screen_manager=screen_manager)\n\n # Cria a Tela de Jogo\n tela_jogo = TelaJogo(name=\"jogo\")\n\n # Adiciona o Widget Pong\n tela_jogo.add_widget(pong)\n\n # Adiciona as telas ao nosso gerenciador\n screen_manager.add_widget(TelaMenu(name='menu'))\n screen_manager.add_widget(tela_jogo)\n screen_manager.add_widget(TelaVencedor1(name='vencedor_1'))\n screen_manager.add_widget(TelaVencedor2(name='vencedor_2'))\n\n return screen_manager\n\nif __name__ == '__main__':\n PongApp().run()\n" }, { "alpha_fraction": 0.5691823959350586, "alphanum_fraction": 0.5786163806915283, "avg_line_length": 21.64285659790039, "blob_id": "7898c3278e2513564047d3deb90ed333e2f2d65b", "content_id": "ac3fb32559fc54e174d68b4987fa9b334f132cac", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 318, "license_type": "no_license", "max_line_length": 49, "num_lines": 14, "path": "/fullcontrol_001/dir-s2.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import os\n\n# caminho = sys.argv[1]\ncaminho = r'P:\\multidad\\nfe'\n\nextens = ['xml', 'XML']\n\nfound = {x: [] for x in extens} \n\nfor dirpath, dirnames, files in os.walk(caminho):\n for name in files:\n ext = name.lower().rsplit('.', 1)[-1]\n if ext in extens:\n print(os.path.join(dirpath, name))\n\n" }, { "alpha_fraction": 0.4878048896789551, "alphanum_fraction": 0.5121951103210449, "avg_line_length": 7.400000095367432, "blob_id": "1f83c38db0b1c2ccd9e1b9e2de3a582f7356df22", "content_id": "922c064f728664731845d7c6f52f1a846f7bdf44", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 41, "license_type": "no_license", "max_line_length": 10, "num_lines": 5, "path": "/gabi2.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "a=input()\nb=input()\nc=input()\n\nd = b ** 2" }, { "alpha_fraction": 0.6058091521263123, "alphanum_fraction": 0.6224066615104675, "avg_line_length": 21, "blob_id": "32461aba53704e91ec8439b7bdb0d2e062760880", "content_id": "bfec7181cbc6870e60bb2015da9c3e2145ae5424", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 241, "license_type": "no_license", "max_line_length": 62, "num_lines": 11, "path": "/html_to_png/teste2.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import imgkit\n\noptions = {\n 'format': 'png',\n 'enable-local-file-access': None,\n 'crop-w': '300',\n 'encoding': \"UTF-8\"\n}\n\nimgkit.from_file('sandra.html', 'sandra.png', options=options)\n# imgkit.from_string('Hello!', 'sandra.jpg')" }, { "alpha_fraction": 0.8484848737716675, "alphanum_fraction": 0.8484848737716675, "avg_line_length": 32, "blob_id": "d4078bc55adfd5594c12ba179efe9d8731f712ca", "content_id": "7cd7ec421e1fca9963dab56032a048a074e9ebf5", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 67, "license_type": "no_license", "max_line_length": 43, "num_lines": 2, "path": "/opencv/Realidade-Aumentada-master/README.md", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "# Realidade-Aumentada\nProjeto da cadeira de Processamento gráfico\n" }, { "alpha_fraction": 0.6018174886703491, "alphanum_fraction": 0.6045994162559509, "avg_line_length": 40.484615325927734, "blob_id": "71c8240bbc741b4432574f6c6b3af73ddf461a84", "content_id": "d7623a2287175a6192b755fe4ca58854a6ecbed0", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 5565, "license_type": "no_license", "max_line_length": 110, "num_lines": 130, "path": "/PyQT-CRUD-App/app/tablewidgets/pcs.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/python3\n# -*- coding: utf-8 -*-\n\"\"\"\nВкладка компьютеров\nGuia Computador\n\"\"\"\nfrom app.editdialogs import pc\nfrom app.db import data\nfrom sqlalchemy import exc\nfrom PyQt5 import *\nfrom PyQt5.QtWidgets import *\nfrom PyQt5.QtGui import *\nfrom PyQt5.QtCore import *\nfrom PyQt5.Qt import *\n\n\nclass PcsTable(QWidget):\n def __init__(self, session, parent):\n QDialog.__init__(self)\n self.session = session\n self.parent = parent\n self.build_layout()\n\n def build_layout(self):\n QVBoxLayout(self)\n\n self.model = QStandardItemModel()\n self.update_table_content()\n\n self.filter_proxy_model = QSortFilterProxyModel()\n self.filter_proxy_model.setSourceModel(self.model)\n self.filter_proxy_model.setFilterKeyColumn(0)\n\n self.search_filter = QLineEdit()\n self.search_filter.setFixedWidth(500)\n self.search_filter.setClearButtonEnabled(True)\n self.search_filter.setPlaceholderText('Pesquisa de nome de domínio / nome do computador')\n self.search_filter.textChanged.connect(self.filter_proxy_model.setFilterRegExp)\n\n self.table = QTableView()\n self.table.setSortingEnabled(True)\n self.table.setSelectionMode(QAbstractItemView.SingleSelection)\n self.table.setSelectionBehavior(QAbstractItemView.SelectRows)\n self.table.setEditTriggers(QAbstractItemView.NoEditTriggers)\n self.table.setTextElideMode(Qt.ElideNone)\n self.table.setAlternatingRowColors(True)\n self.table.setModel(self.filter_proxy_model)\n self.table.resizeColumnsToContents()\n\n edit_button = QPushButton('Editar')\n edit_button.setFixedSize(edit_button.sizeHint())\n edit_button.clicked.connect(self.edit)\n self.layout().addWidget(self.search_filter)\n self.layout().addWidget(self.table)\n\n def update_table_content(self):\n self.model.clear()\n self.model.setHorizontalHeaderLabels(\n # ['Домен/Имя компьютера', 'ФИО пользователя', 'MAC-адрес', 'Номер розетки',\n # 'Как подключен', 'Серверные приложения',\n # 'Windows OS', 'Windows OS key', 'Microsoft Office',\n # 'Microsoft Office key', 'Антивирус', 'Клиент электронной почты',\n # 'Прочее', 'Агент KES', 'Консультант', 'Гарант', '1C', 'КДС']\n ['Nome do domínio / computador', 'Nome do usuário', 'Endereço MAC', 'Número de soquetes',\n 'Como conectado', 'Aplicativos de servidor',\n 'Windows', 'Windows key', 'Microsoft Office',\n 'Microsoft Office key', 'Anti-Virus', 'Cliente de e-mail',\n 'Outro', 'Agente KES', 'Consultor', 'Fiador', '1C', 'KDS']\n )\n for pc in self.session.query(data.Pc):\n self.model.appendRow([\n QStandardItem(QIcon(r'pics\\pc.png'), pc.pcname.domain.name + '/' + pc.pcname.name),\n QStandardItem(QIcon(r'pics\\employee.png'), ';\\n'.join([emp.fullname for emp in pc.employee])),\n QStandardItem(pc.mac_address),\n QStandardItem(pc.powersocket.name),\n QStandardItem(pc.connectiontype.name),\n QStandardItem(pc.app_server),\n QStandardItem(pc.windows.name),\n QStandardItem(pc.windows_os_key),\n QStandardItem(pc.office.name),\n QStandardItem(pc.ms_office_key),\n QStandardItem(pc.antivirus.name),\n QStandardItem(pc.mail_client),\n QStandardItem(pc.comments),\n QStandardItem('Existem' if pc.kes else 'Não'),\n QStandardItem('Existem' if pc.consultant else 'Não'),\n QStandardItem('Existem' if pc.guarantee else 'Não'),\n QStandardItem('Existem' if pc.odin_s else 'Não'),\n QStandardItem('Existem' if pc.kdc else 'Não')\n ])\n try:\n self.table.resizeColumnsToContents()\n except Exception:\n pass\n\n @pyqtSlot()\n def edit(self):\n index = self.table.selectionModel().selectedRows()\n try:\n element = self.model.item(index[0].row())\n except IndexError:\n QMessageBox.warning(\n self, 'Erro',\n 'Selecione a linha na tabela'\n )\n return\n pc_query_obj = self.session.query(data.Pc). \\\n filter_by(mac_address=element[2].text()).one()\n try:\n edit_pc_window = pc.EditPc(self.session, pc_query_obj)\n if edit_pc_window.exec_() == QDialog.Accepted:\n QApplication.setOverrideCursor(Qt.WaitCursor)\n self.session.commit()\n self.update_table_content()\n parent.employee_table.set_filter_comboboxes()\n parent.employee_table.self.fill_table()\n QApplication.restoreOverrideCursor()\n print(\"Zakommitili\")\n except exc.IntegrityError as errmsg:\n print(errmsg)\n self.session.rollback()\n msg = QMessageBox()\n msg.setIcon(QMessageBox.Critical)\n msg.setText(\"Erro crítico no banco de dados\")\n msg.setWindowTitle(\"Erro crítico\")\n msg.setDetailedText(errmsg)\n msg.setStandardButtons(QMessageBox.Ok)\n msg.buttonClicked.connect(sys.exit)\n else:\n print('Tudo com sucesso')" }, { "alpha_fraction": 0.2718631327152252, "alphanum_fraction": 0.3136882185935974, "avg_line_length": 34, "blob_id": "1c1aff86fbce3329b41e288d8390d3d25a9daac3", "content_id": "1383b94dff51a91c90b923658b6851ab7722d598", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 526, "license_type": "no_license", "max_line_length": 80, "num_lines": 15, "path": "/assinaturas/assina.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "\nnome = 'João Carlos Bueno Masso'\ncargo = 'Analista de Sistemas'\nfone = '61 3462-5038'\ncel = '61 9 8224-6622'\nemail = 'bueno@1linha.com.br'\n\n\n\nassina = open('./assina.html', 'r', encoding='utf-8').read().format(nome=nome,\n cargo=cargo,\n fone=fone,\n cel=cel,\n email=email)\n\nprint(assina)\n" }, { "alpha_fraction": 0.6722689270973206, "alphanum_fraction": 0.7086834907531738, "avg_line_length": 24.571428298950195, "blob_id": "2b0ed174b62a3bd770f51cd4ff0c43b8c6e9958c", "content_id": "006eb87ce6fed6e4d167094fe6c038f45d54b3c2", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 357, "license_type": "no_license", "max_line_length": 72, "num_lines": 14, "path": "/excel-003.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "from openpyxl.workbook import Workbook\n\nwb = Workbook()\nws = wb.active\n\nws.merge_cells('A2:D2')\nws['A2'] = 'teste de celulas'\n\n# or equivalently\nws.merge_cells(start_row=3, start_column=1, end_row=3, end_column=4)\nws.cell(row=3, column=1, value='teste novo')\n# ws.unmerge_cells(start_row=2, start_column=1, end_row=4, end_column=4)\n\nwb.save('balances.xlsx')" }, { "alpha_fraction": 0.577752947807312, "alphanum_fraction": 0.6164434552192688, "avg_line_length": 27.606382369995117, "blob_id": "acad3bda32c203c3cd29f890024a7aac5c9bd259", "content_id": "66dce420d9d48983b5b96f8f11457e16d28ceb1c", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2688, "license_type": "no_license", "max_line_length": 111, "num_lines": 94, "path": "/opencv/Realidade-Aumentada-master/webcamPose.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import numpy as np\nimport cv2 as cv\nimport matplotlib.pyplot as plt\nimport glob\n\ncap = cv.VideoCapture(0)\nimg1 = cv.imread('fotos/box1.jpg',cv.IMREAD_GRAYSCALE) # queryImage\n\ncriteria = (cv.TERM_CRITERIA_EPS + cv.TERM_CRITERIA_MAX_ITER, 30, 0.001)\nobjp = np.zeros((6*7,3), np.float32)\nobjp[:,:2] = np.mgrid[0:7,0:6].T.reshape(-1,2)\n\n\n# Load previously saved data\n# with np.load('B.npz') as X:\n# mtx, dist, _, _ = [X[i] for i in ('mtx','dist','rvecs','tvecs')]\n\naxis = np.float32([[3,0,0], [0,3,0], [0,0,-3]]).reshape(-1,3)\n\n\ndef draw(img, corners, imgpts):\n corner = tuple(corners[0].ravel())\n img = cv.line(img, corner, tuple(imgpts[0].ravel()), (255,0,0), 5)\n img = cv.line(img, corner, tuple(imgpts[1].ravel()), (0,255,0), 5)\n img = cv.line(img, corner, tuple(imgpts[2].ravel()), (0,0,255), 5)\n return img\n\n\n\nwhile(True):\n # Capture frame-by-frame\n ret, frame = cap.read()\n\n # Our operations on the frame come here\n gray = cv.cvtColor(frame, cv.COLOR_BGR2GRAY)\n\n # Display the resulting frame\n \n if cv.waitKey(1) & 0xFF == ord('q'):\n break\n\n\n \n \n img2 = gray\n\n \n # Initiate ORB detector\n orb = cv.ORB_create()\n # find the keypoints and descriptors with ORB\n kp1, des1 = orb.detectAndCompute(img1,None)\n kp2, des2 = orb.detectAndCompute(img2,None)\n\n # create BFMatcher object\n bf = cv.BFMatcher(cv.NORM_HAMMING, crossCheck=True)\n # Match descriptors.\n matches = bf.match(des1,des2)\n # Sort them in the order of their distance.\n matches = sorted(matches, key = lambda x:x.distance)\n # Draw first 10 matches.\n img3 = cv.drawMatches(img1,kp1,img2,kp2,matches[:40],None,flags=cv.DrawMatchesFlags_NOT_DRAW_SINGLE_POINTS)\n # plt.imshow(img3),plt.show()\n cv.imwrite('abc.png', img3)\n\n for fname in glob.glob('fotos/box1.jpg'):\n img2 = cv.imread(fname)\n gray = cv.cvtColor(img2,cv.COLOR_BGR2GRAY)\n ret, corners = cv.findChessboardCorners(gray, (7,6),None)\n\n if ret == True:\n corners2 = cv.cornerSubPix(gray,corners,(11,11),(-1,-1),criteria)\n\n # Find the rotation and translation vectors.\n rvecs, tvecs, inliers = cv.solvePnPRansac(objp, corners2, mtx, dist)\n\n # project 3D points to image plane\n imgpts, jac = cv.projectPoints(axis, rvecs, tvecs, mtx, dist)\n\n img2 = draw(img2,corners2,imgpts)\n cv.imshow('frame',img2)\n k = cv.waitKey(0) & 0xff\n if k == 's':\n cv.imwrite(fname[:6]+'.png', img2)\n\n cv.destroyAllWindows()\n\n\n cv.imshow('frame',img2)\n\n\n\n# When everything done, release the capture\ncap.release()\ncv.destroyAllWindows()" }, { "alpha_fraction": 0.5437557101249695, "alphanum_fraction": 0.5519598722457886, "avg_line_length": 25.433734893798828, "blob_id": "d319eeb40b5b8933c36a41403b7e45d9ebebff22", "content_id": "deece8a7a264b011a1f42342c953217a10681642", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2194, "license_type": "no_license", "max_line_length": 81, "num_lines": 83, "path": "/Hospital-Helper-2-master/app/gui/action_button.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "# import functools\nimport os\n\nfrom PyQt5.QtWidgets import QPushButton\nfrom PyQt5.QtGui import QIcon\n\nfrom app import options\nfrom app.gui import utils\n\n\nclass ActionButton(QPushButton):\n\n \"\"\"\n Main button for application.\n Changes callback and icon, depending on current state.\n \"\"\"\n\n ICONS = {each.split('.')[0]: os.path.join(options.STATIC_DIR, 'icons', each)\n for each in os.listdir(os.path.join(options.STATIC_DIR, 'icons'))}\n\n QSS = \"\"\"\n ActionButton {{\n icon-size: {x}px;\n font-weight: bold;\n background-color: #FFEB3B;\n border-style: solid;\n border-radius: {y}px;\n max-width: {z}px;\n max-height: {z}px;\n min-width: {z}px;\n min-height: {z}px;\n }}\n\n ActionButton:hover {{\n background-color: #F0DE41;\n }}\n\n ActionButton:pressed {{\n background-color: #E0CE31;\n }}\n \"\"\"\n\n def __init__(self, main_window):\n \"\"\"\n Connect signals.\n Hide the button, it will be shown only when required signals are emited\n \"\"\"\n super().__init__(main_window)\n self.hide()\n\n self.setGraphicsEffect(utils.get_shadow())\n main_window.communication.resized.connect(self._move)\n main_window.communication.action_button_toggle.connect(self.toggle_state)\n\n def _move(self, width, waterline):\n \"\"\"\n Move the button when application is resized.\n \"\"\"\n w = int(width * 0.08)\n self.setStyleSheet(self.QSS.format(x=int(w / 3), y=int(w / 2), z=w))\n self.setFixedSize(w, w)\n self.move(width - self.width() * 1.5, waterline - self.height() / 2)\n self.raise_()\n\n def toggle_state(self, is_visible, icon, function):\n \"\"\"\n Hide/show the button.\n Change icon.\n Change callback.\n \"\"\"\n if not is_visible:\n self.hide()\n return\n\n self.setIcon(QIcon(self.ICONS[icon]))\n try:\n self.clicked.disconnect()\n except TypeError:\n pass\n self.clicked.connect(function)\n\n self.show()\n self.raise_()\n" }, { "alpha_fraction": 0.5985981225967407, "alphanum_fraction": 0.6640186905860901, "avg_line_length": 26.792207717895508, "blob_id": "d418938189936035ba7a1532ff88a1ae3d157f23", "content_id": "cf83de3a0265df35181a6b4c4edce65c012b6824", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2145, "license_type": "no_license", "max_line_length": 83, "num_lines": 77, "path": "/didatica_tech/med.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import random\nimport statistics\nfrom fractions import Fraction as F\nfrom decimal import Decimal as D\n\nhoras_dormidas_semana = [7, 8, 6, 0, 7, 7, 10]\n\nprint('Horas dormidas na semana: ', horas_dormidas_semana)\n\n# médias ==>\nprint('Média : ', statistics.mean(horas_dormidas_semana))\n\n# print(statistics.mean([F(8, 10), F(11, 20), F(2, 5), F(28, 5)]))\n# # # returns Fraction(147, 80)\n\n# print(statistics.mean([D(\"1.5\"), D(\"5.75\"), D(\"10.625\"), D(\"2.375\")]))\n# # # returns Decimal('5.0625')\n\n# data_points = [ random.randint(1, 100) for x in range(1,1001) ]\n# print(statistics.mean(data_points))\n \n# data_points = [ random.triangular(1, 100, 80) for x in range(1,1001) ]\n# print(statistics.mean(data_points))\n\n# médias <==\n\n# modas ==>\nprint('Moda : ', statistics.mode(horas_dormidas_semana))\n\n# data_points = [ random.randint(1, 100) for x in range(1,1001) ]\n# print(statistics.mode(data_points))\n# # returns 94\n \n# data_points = [ random.randint(1, 100) for x in range(1,1001) ]\n# print(statistics.mode(data_points))\n# # returns 49\n \n# data_points = [ random.randint(1, 100) for x in range(1,1001) ]\n# print(statistics.mode(data_points))\n# # returns 32\n \n# # print(statistics.mode([\"cat\", \"dog\", \"dog\", \"cat\", \"monkey\", \"monkey\", \"dog\"]))\n# # returns 'dog'\n\n# modas <==\n\n# medianas ==>\nprint('Mediana : ', statistics.median(horas_dormidas_semana))\n\n# data_points = [ random.randint(1, 100) for x in range(1,50) ]\n# print(statistics.median(data_points))\n# # returns 53\n \n# data_points = [ random.randint(1, 100) for x in range(1,51) ]\n# print(statistics.median(data_points))\n# # returns 51.0\n \n# data_points = [ random.randint(1, 100) for x in range(1,51) ]\n# print(statistics.median(data_points))\n# # returns 49.0\n \n# data_points = [ random.randint(1, 100) for x in range(1,51) ]\n# print(statistics.median_low(data_points))\n# # returns 50\n \n# print(statistics.median_high(data_points))\n# # returns 52\n \n# print(statistics.median(data_points))\n# # returns 51.0\n\n# medianas <==\n\n# variancia <==\nprint('Variância : ', statistics.variance(horas_dormidas_semana))\nprint('Variância : ', statistics.pvariance(horas_dormidas_semana))\n# variancia <==\n" }, { "alpha_fraction": 0.7283464670181274, "alphanum_fraction": 0.7283464670181274, "avg_line_length": 22.090909957885742, "blob_id": "f6b6dd79140f7467a501a35ae51023bb77db3568", "content_id": "d54c045ded1af9a6e3b2214a92fca0a7b89e7fd2", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 254, "license_type": "no_license", "max_line_length": 47, "num_lines": 11, "path": "/Hospital-Helper-2-master/app/tests/test_allowed_module.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import unittest\n\nfrom app.model.logic import AllowedModule\n\n\nclass TestAllowedModule(unittest.TestCase):\n\n def test_module_storage(self):\n import math\n allowed_module = AllowedModule(math)\n assert isinstance(allowed_module, list)\n" }, { "alpha_fraction": 0.5932203531265259, "alphanum_fraction": 0.6082862615585327, "avg_line_length": 28.5, "blob_id": "774fcedb141fd6a74507abd357fd300192f3d708", "content_id": "a9ea3a38d04c20677deac68568e06666f88a9772", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 531, "license_type": "no_license", "max_line_length": 72, "num_lines": 18, "path": "/assinaturas/le_excel.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import openpyxl\n\ndef le_excel():\n workbook = openpyxl.load_workbook(\"lista.xlsx\")\n sheet = workbook.active\n first_row = [] # The row where we stock the name of the column\n\n for col in range(2, sheet.max_column + 1):\n first_row.append(sheet.cell(row=4, column=col).value)\n\n data =[]\n for row in range(5, sheet.max_row + 1):\n elm = {}\n for col in range(2, sheet.max_column + 1):\n elm[first_row[col - 2]]=sheet.cell(row=row,column=col).value\n data.append(elm)\n\n return data\n" }, { "alpha_fraction": 0.6745215654373169, "alphanum_fraction": 0.6804452538490295, "avg_line_length": 41.314048767089844, "blob_id": "f99b90e18a2f270abfa8d96458bdf84a30c51e56", "content_id": "3bf52f4e55113214f838814f29ca4f1a2a0f1b65", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 15362, "license_type": "no_license", "max_line_length": 119, "num_lines": 363, "path": "/PQt5-Stock/Controlador/pProducto.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom Componentes.tableModel import MyTableModel\nfrom PyQt5.QtWidgets import QTableView, QAbstractItemView, QCompleter, QLineEdit\nfrom Conexion.conexionProducto import conexionProducto\nfrom Controlador.windowMarca import windowMarca\nfrom Controlador.windowRubro import windowRubro\nfrom Modelo.proveedor import Proveedor\nfrom Modelo.producto import Producto\nfrom Modelo.rubro import Rubro\nfrom Modelo.marca import Marca\nfrom PyQt5 import QtCore\nfrom PyQt5.QtCore import QAbstractItemModel\nfrom PyQt5 import Qt\nfrom PyQt5.QtWidgets import QMessageBox, QDialog\n\n\nclass PestaniaProducto():\n\n def __init__(self, winPrincipal):\n self.winPrincipal = winPrincipal\n self.producto = Producto()\n self.proveedor = Proveedor()\n self.marca = Marca()\n self.rubro = Rubro()\n self.estado = \"\"\n self.conexionProducto = conexionProducto()\n\n self.completerRubro = QCompleter()\n self.completerMarca = QCompleter()\n self.completerProveedor = QCompleter()\n self.configInit()\n\n\n\n def configInit(self):\n #Configurando botones\n self.winPrincipal.btnAgregar_p.clicked.connect(self.onClickAgregar_p)\n self.winPrincipal.btnGuardar_p.clicked.connect(self.onClickGuardar_p)\n self.winPrincipal.btnBorrar_p.clicked.connect(self.onClickBorrar_p)\n self.winPrincipal.btnModificar_p.clicked.connect(self.onClickModificar_p)\n\n self.winPrincipal.btnRubro_p.clicked.connect(windowRubro)\n self.winPrincipal.btnMarca_p.clicked.connect(windowMarca)\n\n #windowMarca.connect(windowMarca, Qt.SIGNAL('destroyed()'), self.onQuitMarca)\n self.winPrincipal.txtFilterProductos_p.returnPressed.connect(self.search)\n\n #self.cargarTabla()\n self.winPrincipal.tvProductos_p.setMouseTracking(True)\n self.winPrincipal.tvProductos_p.setSelectionBehavior(QAbstractItemView.SelectRows)\n\n self.setCompleterMarca()\n self.setCompleterRubro()\n self.setCompleterProveedor()\n\n self.winPrincipal.txtFilterProductos_p.setFocus(True)\n\n\n\n def finish(self):\n self.winPrincipal.btnAgregar_p.disconnect()\n self.winPrincipal.btnGuardar_p.disconnect()\n self.winPrincipal.btnModificar_p.disconnect()\n self.winPrincipal.btnBorrar_p.disconnect()\n self.winPrincipal.btnRubro_p.disconnect()\n self.winPrincipal.btnMarca_p.disconnect()\n self.winPrincipal.tvProductos_p.disconnect()\n\n def search(self):\n if self.winPrincipal.txtFilterProductos_p.hasFocus() is True:\n self.cargarTabla()\n\n def onClickAgregar_p(self):\n self.estado = 'AGREGAR'\n self.validarBotones(button='AGREGAR')\n\n def onClickGuardar_p(self):\n validar = self.validar()\n\n if validar != \"\":\n print(validar)\n alert = QDialog()\n QMessageBox.information(alert,\"ERROR\", validar)\n else:\n self.producto.setDescripcion(str(self.winPrincipal.txtDescripcion_p.toPlainText()))\n self.producto.setCantidad(int(self.winPrincipal.sbCantidad_p.value()))\n self.producto.setCantidadMinima(int(self.winPrincipal.sbCantidadMin_p.value()))\n if self.winPrincipal.cbEstado_p.currentText() == \"ACTIVO\":\n self.producto.setEstado(1)\n else:\n self.producto.setEstado(0)\n\n if self.winPrincipal.rbFemenino_p.isChecked() is True:\n self.producto.setGenero(\"F\")\n elif self.winPrincipal.rbMasculino_p.isChecked() is True:\n self.producto.setGenero(\"M\")\n else:\n self.producto.setGenero(\"I\")\n\n self.producto.setNombre(str(self.winPrincipal.txtNombre_p.text()))\n self.producto.setPrecioCompra(float(self.winPrincipal.txtPrecioCompra_p.text()))\n self.producto.setPrecioVenta(float(self.winPrincipal.txtPrecioVenta_p.text()))\n\n self.rubro.setRubro(str(self.completerRubro.currentCompletion()))\n self.producto.setRubro(self.rubro)\n\n self.proveedor.setDescripcion(str(self.completerProveedor.currentCompletion()))\n self.producto.setProveedor(self.proveedor)\n\n self.marca.setMarca(str(self.completerMarca.currentCompletion()))\n self.producto.setMarca(self.marca)\n\n if self.estado == 'AGREGAR':\n self.insertarProducto()\n elif self.estado == 'MODIFICAR':\n self.modificarProducto()\n\n self.validarBotones('GUARDAR')\n\n\n def onClickModificar_p(self):\n self.estado = 'MODIFICAR'\n self.validarBotones(button='MODIFICAR')\n\n def onClickBorrar_p(self):\n if self.winPrincipal.btnGuardar_p.isEnabled() != True:\n self.conexionProducto.borrarProducto(self.producto)\n self.cargarTabla()\n\n self.validarBotones(button='BORRAR')\n\n def cargarTabla(self):\n\n parameter = self.winPrincipal.txtFilterProductos_p.text()\n typeParameter = ''\n if self.winPrincipal.cbFilterProducto_p.currentText() == 'Nombre':\n typeParameter = 'p.nombre'\n elif self.winPrincipal.cbFilterProducto_p.currentText() == 'Marca':\n typeParameter = 'm.descripcion'\n else:\n typeParameter = 'r.descripcion'\n\n parameterState = 1\n if self.winPrincipal.cbInactivo_p.isChecked() is True:\n parameterState = 0\n\n parameterStock = 1\n if self.winPrincipal.cbSinStock_p.isChecked() is True:\n parameterStock = 0\n\n listaProductos = self.conexionProducto.selectProducto(typeParameter, parameter, parameterState, parameterStock)\n\n if len(listaProductos) > 0:\n\n header = ['idPro','Nombre', 'Descripcion', 'PC', 'PV', 'G', 'Estado', 'Cant', 'Cantidad Min',\n 'idMar', 'Marca', 'idRubro', 'Rubro', 'idProv', 'Proveedor']\n self.tablaModel = MyTableModel(self.winPrincipal.tvProductos_p, listaProductos, header)\n self.winPrincipal.tvProductos_p.setModel(self.tablaModel)\n self.winPrincipal.tvProductos_p.selectionModel().currentChanged.connect(self.changeSelectedTable)\n\n self.winPrincipal.tvProductos_p.setColumnHidden(0, True)\n self.winPrincipal.tvProductos_p.setColumnWidth(1, 200)\n self.winPrincipal.tvProductos_p.setColumnWidth(2, 320)\n self.winPrincipal.tvProductos_p.setColumnWidth(3, 60)\n self.winPrincipal.tvProductos_p.setColumnWidth(4, 60)\n self.winPrincipal.tvProductos_p.setColumnWidth(5, 60)\n self.winPrincipal.tvProductos_p.setColumnHidden(6, True)\n self.winPrincipal.tvProductos_p.setColumnWidth(7, 40)\n self.winPrincipal.tvProductos_p.setColumnHidden(8, True)\n self.winPrincipal.tvProductos_p.setColumnHidden(9, True)\n self.winPrincipal.tvProductos_p.setColumnWidth(10, 130)\n self.winPrincipal.tvProductos_p.setColumnHidden(11, True)\n self.winPrincipal.tvProductos_p.setColumnWidth(12, 130)\n self.winPrincipal.tvProductos_p.setColumnHidden(13, True)\n self.winPrincipal.tvProductos_p.setColumnWidth(14, 130)\n else:\n self.winPrincipal.tvProductos_p.setModel(None)\n\n\n\n def changeSelectedTable(self, selected, deselected):\n\n productoList = selected.model().mylist\n productoSelected = productoList[selected.row()]\n self.producto = Producto()\n self.rubro = Rubro()\n self.proveedor = Proveedor()\n self.marca = Marca()\n\n self.producto.setIdProducto(productoSelected[0])\n self.producto.setNombre(productoSelected[1])\n self.producto.setDescripcion(productoSelected[2])\n self.producto.setPrecioCompra(productoSelected[3])\n self.producto.setPrecioVenta(productoSelected[4])\n self.producto.setGenero(productoSelected[5])\n self.producto.setEstado(productoSelected[6])\n self.producto.setCantidad(productoSelected[7])\n self.producto.setCantidadMinima(productoSelected[8])\n\n self.marca.setIdMarca(productoSelected[9])\n self.marca.setMarca(productoSelected[10])\n self.producto.setMarca(self.marca)\n\n self.rubro.setIdRubro(productoSelected[11])\n self.rubro.setRubro(productoSelected[12])\n self.producto.setRubro(self.rubro)\n\n self.proveedor.setIdProveedor(productoSelected[13])\n self.proveedor.setDescripcion(productoSelected[14])\n self.producto.setProveedor(self.proveedor)\n\n\n self.winPrincipal.tvProductos_p.setRowHeight(deselected.row(),33)\n self.winPrincipal.tvProductos_p.setRowHeight(selected.row(),45)\n\n self.setCampos()\n self.winPrincipal.btnModificar_p.setEnabled(True)\n self.winPrincipal.btnBorrar_p.setEnabled(True)\n\n def validarBotones(self, button):\n if button == 'AGREGAR' :\n self.winPrincipal.wDatosProducto.setEnabled(True)\n self.winPrincipal.btnBorrar_p.setEnabled(True)\n self.winPrincipal.btnBorrar_p.setText('CANCELAR')\n self.winPrincipal.btnGuardar_p.setEnabled(True)\n self.winPrincipal.btnModificar_p.setEnabled(False)\n self.winPrincipal.btnAgregar_p.setEnabled(False)\n self.winPrincipal.tvProductos_p.setEnabled(False)\n self.limpiarCampos()\n\n elif button=='GUARDAR':\n self.winPrincipal.btnModificar_p.setEnabled(False)\n self.winPrincipal.btnAgregar_p.setEnabled(True)\n self.winPrincipal.btnGuardar_p.setEnabled(False)\n self.winPrincipal.btnBorrar_p.setText('BORRAR')\n self.winPrincipal.btnBorrar_p.setEnabled(False)\n self.winPrincipal.tvProductos_p.setEnabled(True)\n self.winPrincipal.wDatosProducto.setEnabled(False)\n self.limpiarCampos()\n\n elif button == 'MODIFICAR':\n self.winPrincipal.btnModificar_p.setEnabled(False)\n self.winPrincipal.btnAgregar_p.setEnabled(False)\n self.winPrincipal.btnGuardar_p.setEnabled(True)\n self.winPrincipal.btnBorrar_p.setText('CANCELAR')\n self.winPrincipal.btnBorrar_p.setEnabled(True)\n self.winPrincipal.tvProductos_p.setEnabled(False)\n self.winPrincipal.wDatosProducto.setEnabled(True)\n\n elif button=='BORRAR':\n self.winPrincipal.btnModificar_p.setEnabled(False)\n self.winPrincipal.btnAgregar_p.setEnabled(True)\n self.winPrincipal.btnGuardar_p.setEnabled(False)\n self.winPrincipal.btnBorrar_p.setText('BORRAR')\n self.winPrincipal.btnBorrar_p.setEnabled(False)\n self.winPrincipal.tvProductos_p.setEnabled(True)\n self.winPrincipal.wDatosProducto.setEnabled(False)\n self.limpiarCampos()\n\n\n def insertarProducto(self):\n self.conexionProducto.insertarProducto(producto=self.producto)\n self.cargarTabla()\n\n def modificarProducto(self):\n self.conexionProducto.modificarProducto(self.producto)\n self.cargarTabla()\n\n def limpiarCampos(self):\n self.winPrincipal.txtNombre_p.setText('')\n self.winPrincipal.txtPrecioCompra_p.setText('')\n self.winPrincipal.txtPrecioVenta_p.setText('')\n self.winPrincipal.sbCantidad_p.setValue(0)\n self.winPrincipal.sbCantidadMin_p.setValue(0)\n self.winPrincipal.txtProveedor_p.setText('')\n self.winPrincipal.txtDescripcion_p.setText('')\n self.winPrincipal.txtRubro_p.setText('')\n self.winPrincipal.txtMarca_p.setText('')\n self.completerProveedor.setCurrentRow(0)\n self.completerRubro.setCurrentRow(0)\n self.completerMarca.setCurrentRow(0)\n self.winPrincipal.txtFilterProductos_p.setText('')\n self.winPrincipal.tvProductos_p.setModel(None)\n\n self.winPrincipal.txtFilterProductos_p.setFocus(True)\n\n def setCampos(self):\n self.winPrincipal.txtNombre_p.setText(self.producto.getNombre())\n self.winPrincipal.txtDescripcion_p.setText(str(self.producto.getDescripcion()))\n self.winPrincipal.txtPrecioCompra_p.setText(str(self.producto.getPrecioCompra()))\n self.winPrincipal.txtPrecioVenta_p.setText(str(self.producto.getPrecioVenta()))\n self.winPrincipal.txtProveedor_p.setText(str(self.producto.getProveedor().getDescripcion()))\n\n self.winPrincipal.sbCantidad_p.setValue(int(self.producto.getCantidad()))\n self.winPrincipal.sbCantidadMin_p.setValue(int(self.producto.getCantidadMinima()))\n\n self.winPrincipal.txtRubro_p.setText(str(self.producto.getRubro().getRubro()))\n self.winPrincipal.txtMarca_p.setText(str(self.producto.getMarca().getMarca()))\n\n if self.producto.getEstado() == 1:\n self.winPrincipal.cbEstado_p.setCurrentIndex(0)\n else:\n self.winPrincipal.cbEstado_p.setCurrentIndex(1)\n\n if self.producto.getGenero() == 'F':\n self.winPrincipal.rbFemenino_p.setChecked(True)\n elif self.producto.getGenero() == 'M':\n self.winPrincipal.rbMasculino_p.setChecked(True)\n else:\n self.winPrincipal.rbIndiferente_p.setChecked(True)\n\n\n\n\n def validar(self):\n mensaje=''\n if self.winPrincipal.txtNombre_p.text() == '':\n mensaje= \"Falta ingresar Nombre\"\n elif self.winPrincipal.txtPrecioCompra_p.text() =='':\n mensaje= \"Falta ingresar Precio de Compra\"\n elif self.winPrincipal.txtPrecioVenta_p.text() =='':\n mensaje= \"Falta ingresar Precio de Venta\"\n elif self.completerProveedor.currentCompletion() =='':\n mensaje= \"Falta ingresar un Proveedor\"\n elif self.completerMarca.currentCompletion() == '':\n mensaje = \"Falta seleccionar la marca\"\n elif self.completerRubro.currentCompletion() == '':\n mensaje = 'Falta seleccionar el rubro'\n\n\n \"\"\"elif self.completerProveedor.currentCompletion() =='' or self.completerProveedor.currentRow() == 0:\n mensaje= \"Falta ingresar un Proveedor\"\n elif self.completerMarca.currentCompletion() == '' or self.completerMarca.currentRow() == 0:\n mensaje = \"Falta seleccionar la marca\"\n elif self.completerRubro.currentCompletion() == '' or self.completerRubro.currentRow() == 0:\n mensaje = 'Falta seleccionar el rubro'\n \"\"\"\n return mensaje\n\n def setCompleterMarca(self):\n listMarcas = self.conexionProducto.listMarcas()\n self.completerMarca = QCompleter(listMarcas)\n\n self.completerMarca.setCaseSensitivity(QtCore.Qt.CaseInsensitive)\n self.winPrincipal.txtMarca_p.setCompleter(self.completerMarca)\n\n\n def setCompleterRubro(self):\n listRubros = self.conexionProducto.listRubro()\n self.completerRubro = QCompleter(listRubros)\n #self.completerRubro.dynamicPropertyNames()\n self.completerRubro.setCaseSensitivity(QtCore.Qt.CaseInsensitive)\n self.winPrincipal.txtRubro_p.setCompleter(self.completerRubro)\n\n\n\n def setCompleterProveedor(self):\n listProveedores = self.conexionProducto.listProveedor()\n self.completerProveedor = QCompleter(listProveedores)\n\n self.completerProveedor.setCaseSensitivity(QtCore.Qt.CaseInsensitive)\n self.winPrincipal.txtProveedor_p.setCompleter(self.completerProveedor)\n\n\n" }, { "alpha_fraction": 0.5514018535614014, "alphanum_fraction": 0.5887850522994995, "avg_line_length": 39.761905670166016, "blob_id": "ebcf4a717c30e293b4ce635473e5c55db7beedf5", "content_id": "0c7387efad43f0f769fe451f8a1011bc763166ee", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 856, "license_type": "no_license", "max_line_length": 78, "num_lines": 21, "path": "/crt/loading.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "from ctypes import windll\nwindll.kernel32.SetConsoleMode(windll.kernel32.GetStdHandle(-11), 7)\nimport time, sys, random\ndef loading(count):\n all_progress = [0] * count\n sys.stdout.write(\"\\n\" * count) # Make sure we have space to draw the bars\n while any(x < 100 for x in all_progress):\n time.sleep(0.01)\n # Randomly increment one of our progress values\n unfinished = [(i, v) for (i, v) in enumerate(all_progress) if v < 100]\n index, _ = random.choice(unfinished)\n all_progress[index] += 1\n \n # Draw the progress bars\n sys.stdout.write(u\"\\u001b[1000D\") # Move left\n sys.stdout.write(u\"\\u001b[\" + str(count) + \"A\") # Move up\n for progress in all_progress: \n width = int(progress / 4)\n print(\"[\" + \"#\" * width + \" \" * (25 - width) + \"]\")\n \nloading(7)\n" }, { "alpha_fraction": 0.43934670090675354, "alphanum_fraction": 0.45268669724464417, "avg_line_length": 33.13191604614258, "blob_id": "2970494b7c5810d7bfb00b7ac4b7013aac3ca41b", "content_id": "ea776a42fe7df8c9ebf1915e8f1236d5e862ce38", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 8022, "license_type": "no_license", "max_line_length": 231, "num_lines": 235, "path": "/PQt5-Stock/Controlador/windowList.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "from PyQt5 import uic\nfrom Modelo.producto import Producto\nfrom Conexion.conexionList import ConexionList\nfrom Componentes.tableModel import MyTableModel\nfrom PyQt5.QtWidgets import QTableView, QAbstractItemView, QWidget\nfrom PyQt5.Qt import QDesktopServices, QUrl\nimport datetime\nfrom PyQt5.Qt import QTextDocument, QPrinter\n\n\nfrom PyQt5.QtWidgets import QMessageBox, QDialog\n\n\nclass WindowList():\n\n def __init__(self, type):\n\n self.winList = uic.loadUi('Vista/windowList.ui')\n\n self.producto = Producto()\n\n self.conexionList= ConexionList()\n\n\n\n self.winList.btnSalir.clicked.connect(self.close)\n\n self.type = type\n\n if self.type == 'PROV':\n self.cargarTablaProveedores()\n else:\n self.cargarTablaClientes()\n\n\n self.winList.btnGenerarPdf.clicked.connect(self.createList)\n\n self.winList.exec()\n\n\n\n def cargarTablaClientes(self):\n listTransaccionesCliente = []\n listTransaccionesCliente = list(self.conexionList.selectClientesTransacciones())\n\n listPagosCliente = self.conexionList.selectClientesPagos()\n self.listFinal = []\n index = 0\n for tCliente in listTransaccionesCliente:\n\n for pCliente in listPagosCliente:\n if tCliente[0] == pCliente[0]:\n totDeuda = float(tCliente[3] - pCliente[1])\n if totDeuda <= 0:\n #listTransaccionesCliente.remove(index)\n pass\n else:\n clienteAdd = (tCliente[1], tCliente[2], \"$ \" +\"{0:.2f}\".format(totDeuda))\n self.listFinal.append(clienteAdd)\n\n break\n\n index += 1\n\n if len(self.listFinal) > 0:\n header = ['Apellido', 'Nombre', 'Deuda']\n tableModel = MyTableModel(self.winList.tvList, self.listFinal, header)\n\n self.winList.tvList.setModel(tableModel)\n\n self.winList.tvList.setColumnWidth(0, 190)\n self.winList.tvList.setColumnWidth(1, 190)\n self.winList.tvList.setColumnWidth(2, 110)\n\n else:\n self.winList.tvList.setModel(None)\n self.winList.btnGenerarPdf.setEnabled(False)\n\n def cargarTablaProveedores(self):\n listTransaccionesProveedore = []\n listTransaccionesProveedore = list(self.conexionList.selectProveedoresTransacciones())\n\n listPagosProveedor = self.conexionList.selectProveedoresPagos()\n self.listFinal = []\n index = 0\n for tProveedor in listTransaccionesProveedore:\n\n for pProveedor in listPagosProveedor:\n if tProveedor[0] == pProveedor[0]:\n totDeuda = float(tProveedor[3] - pProveedor[1])\n if totDeuda <= 0:\n #listTransaccionesProveedore.remove(index)\n pass\n else:\n proveedorAdd = (tProveedor[1], tProveedor[2], \"$ \" +\"{0:.2f}\".format(totDeuda))\n self.listFinal.append(proveedorAdd)\n\n break\n\n index += 1\n\n if len(self.listFinal) > 0:\n header = ['Apellido', 'Nombre', 'Deuda']\n tableModel = MyTableModel(self.winList.tvList, self.listFinal, header)\n\n self.winList.tvList.setModel(tableModel)\n\n self.winList.tvList.setColumnWidth(0, 190)\n self.winList.tvList.setColumnWidth(1, 190)\n self.winList.tvList.setColumnWidth(2, 110)\n\n else:\n self.winList.tvList.setModel(None)\n self.winList.btnGenerarPdf.setEnabled(False)\n\n\n\n\n\n def createList(self):\n hoy = str(datetime.datetime.now().year) + str(datetime.datetime.now().month) + str(datetime.datetime.now().day) + str(datetime.datetime.now().hour) + str(datetime.datetime.now().minute) + str(datetime.datetime.now().second)\n\n nombrePdf = '../archivos/' + str(hoy + 'LIST') + '.pdf'\n listTable = \"\"\n for lista in self.listFinal:\n listTable += \"\"\"\n <tr height=\"80\">\n <td width=\"40%\" align=\"center\" >\n <br>\"\"\" + str(lista[0]) + \"\"\"<br>\n </td>\n <td width=\"40%\" >\n <br> &nbsp;&nbsp;\"\"\" + str(lista[1]) + \"\"\"<br>\n </td>\n <td width=\"20%\" >\n <br>&nbsp;&nbsp; \"\"\" + str(lista[2]) + \"\"\"<br>\n </td>\n </tr>\n \"\"\"\n\n\n subtitle = \"Listado de clientes con deudas : \"\n if self.type == 'PROV':\n subtitle = \"Listado de deudas a proveedores : \"\n\n\n fecha = str(datetime.datetime.now())\n html = \"\"\"\n <table width=\"600\">\n <tr width=\"600\" color=\"#000000\">\n <td width=\"80%\">\n\n </td>\n <td width=\"20%\" align=\"right\">\n <IMG SRC=\"kde1.png\">\n </td>\n </tr>\n\n </table>\n\n <hr>\n <br>\n <p>\n \"\"\"+ subtitle + \"\"\"\n </p>\n <br>\n <table width=\"600\" height=\"0\" style=\"border-color: black; border-width: 0.5px; border-spacing: 0;\">\n <tr style=\" background-color: gray; border-style: inset;\">\n <td width=\"40%\" align=\"center\" valign=\"middle\">\n <b>\n APELLIDO\n </b>\n </td>\n <td width=\"40%\" align=\"center\" valign=\"middle\">\n <b>\n NOMBRE\n </b>\n </td>\n <td width=\"20%\" align=\"center\" valign=\"middle\">\n <b>\n DEUDA\n </b>\n </td>\n </tr>\n </table>\n\n <br>\n <br>\n\n <table width=\"600\" height=\"0\" style=\"border-color: black; border-width: 0.5px; border-spacing: 0;\">\n \"\"\" + listTable + \"\"\"\n </table>\n <br>\n <br>\n\n <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>\n <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>\n <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>\n <br>\n\n <hr>\n <br>\n <table width=\"600\">\n <tr>\n <td align=\"right\" width=\"100%\">\n FECHA/HORA : \"\"\"+ fecha + \"\"\"\n </td>\n </tr>\n </table>\n <hr>\n \"\"\"\n\n doc = QTextDocument()\n doc.setHtml(html)\n\n printer = QPrinter()\n printer.setOutputFileName(nombrePdf)\n\n printer.setOutputFormat(QPrinter.PdfFormat)\n doc.print(printer)\n printer.newPage()\n url = QUrl\n url = QUrl(nombrePdf)\n QDesktopServices.openUrl(url)\n\n\n\n\n\n\n def close(self):\n alert = QDialog()\n confirm = QMessageBox.question(alert, \"Mensaje\", \"¿ Desea salir de la ventana de Listado?\", QMessageBox.Yes,\n QMessageBox.No)\n if confirm == QMessageBox.Yes:\n self.winList.close()\n" }, { "alpha_fraction": 0.4712950587272644, "alphanum_fraction": 0.5287049412727356, "avg_line_length": 17.725000381469727, "blob_id": "2c0862857fc3444b71937367e2254bed9f32130c", "content_id": "95e9a4a7e9a19a48a2be1310b066e6c0d479ca25", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 751, "license_type": "no_license", "max_line_length": 45, "num_lines": 40, "path": "/crt/crt.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "# Biblioteca de Configurações de video\nfg_blk = 30\nfg_red = 31\nfg_gre = 32\nfg_yel = 33\nfg_blu = 34\nfg_mag = 35\nfg_cya = 36\nfg_whi = 37\n\nbk_blk = 40\nbk_red = 41\nbk_gre = 42\nbk_yel = 43\nbk_blu = 44\nbk_mag = 45\nbk_cya = 46\nbk_whi = 47\n\ndef cor(b,f,bi,fi):\n \"\"\"Cor\\n\n b - background-collor\\n\n f - foreground-collor\\n\n bi- background intensity\\n\n bi- background intensity\"\"\"\n if bi == 1:\n b += 60\n print(\"\\x1b[%d;%d;%dm\" %(fi,b,f), end=\"\")\n\ndef cls():\n \"\"\"Limpa a tela\"\"\"\n print(\"\\x1b[H\\x1b[J\", end=\"\")\n\ndef prt(msg,l = -1,c = -1):\n \"\"\"Mostra uma mensagem\\n\n l - linha (opcional)\\n\n c - coluna (opcional)\"\"\"\n if l >= 0 and c >= 0:\n print(\"\\x1b[%d;%dH\" %(l,c), end=\"\")\n print(\"%s\"%(msg), end=\"\")\n" }, { "alpha_fraction": 0.5631579160690308, "alphanum_fraction": 0.6526315808296204, "avg_line_length": 26.285715103149414, "blob_id": "51c918503008055893303ee6a1364faa5b26e662", "content_id": "89f61a548a741f3d7cece821e643081b2e5998e8", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 190, "license_type": "no_license", "max_line_length": 56, "num_lines": 7, "path": "/mathplot/matplot-001.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "# http://www.bogotobogo.com/python/python_matplotlib.php\n\nimport matplotlib.pyplot as pyp\nx = [0, 2, 4, 6, 8, 9, 11]\ny = [0, 3, 3, 7, 0, 11, 12]\npyp.plot(x, y)\npyp.savefig(\"MyFirstPlot.png\")" }, { "alpha_fraction": 0.5921052694320679, "alphanum_fraction": 0.6052631735801697, "avg_line_length": 24.41666603088379, "blob_id": "7818777df0e91fdcb9ddbf5a3ded08af607f8752", "content_id": "7a249ec89491320f96d8be78188592aa936e3fba", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 304, "license_type": "no_license", "max_line_length": 79, "num_lines": 12, "path": "/pd/le.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import pandas as pd\n\ndf = pd.read_csv('pedidosabertos.txt', sep='|', encoding='cp1252', decimal=\",\")\n\ndf[\"VALOR\"] = [x.replace(\".\", \"\") for x in df[\"VALOR\"]]\ndf[\"VALOR\"] = [x.replace(\",\", \".\") for x in df[\"VALOR\"]]\ndf['VALOR'] = df['VALOR'].astype(float)\n\nprint(df.dtypes)\nprint(df)\n\nprint(sum(df.VALOR))" }, { "alpha_fraction": 0.6444991827011108, "alphanum_fraction": 0.6592774987220764, "avg_line_length": 31.078947067260742, "blob_id": "9ea35ad070992dfc8b446cbabdeae0d3b2564a73", "content_id": "5b2986d926ef214127ed288d07e9457c7dde8733", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1218, "license_type": "no_license", "max_line_length": 338, "num_lines": 38, "path": "/fullodbc/odbc1.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "# import json\nimport pyodbc\nimport simplejson as json\ncnxn = pyodbc.connect('DSN=p;UID=system')\ncursor = cnxn.cursor()\n\ndata = []\n\n# for row in cursor.tables():\n# print(row.table_name)\n\n# columns = [column[3] for column in cursor.columns(table='aigelgcp')]\n# print(columns)\ncolumns = []\ncolumns.append('cliente')\ncolumns.append('nome')\ncolumns.append('jurfis')\n# print(columns)\n# input()\n\n# cols = cursor.columns(table='aimanrep')\n# for col in cols:\n# # print(col)\n# print(col.column_name, ' ', col.type_name, ' ', col[6], ' ', col[8])\n# input()\n\n# cursor.execute(\"select * from aigelgcp where lgc_resumo = 'S'\")\ncursor.execute(\"select distinct fco_fco, fco_nome, fco_jurfis from aigefcop LEFT JOIN aigefccp ON fco_empresa = fcc_empresa and fco_fco = fcc_fco where fco_empresa = 51 and fco_eclien = 'X' and fco_credito <> 'C' and fcc_seque <> 55 and fcc_seque <> 56 and fcc_seque <> 57 and fcc_seque <> 58 and fcc_seque <> 59 and fcc_seque <> 60\")\nfor row in cursor.fetchall():\n # print(row)\n # data.append([x for x in row]) \n # data.append(list(row))\n data.append(dict(zip(columns,row)))\n # print(data)\n # input()\n\n# print(data)\nprint(json.dumps(data, sort_keys=False, indent=4))" }, { "alpha_fraction": 0.5679116249084473, "alphanum_fraction": 0.570302426815033, "avg_line_length": 36.29156494140625, "blob_id": "c907f14c1756f85560e55c09f765f1844871dfd9", "content_id": "9c79d71542da8e7b964b30ca3eec71f311ec021d", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 15662, "license_type": "no_license", "max_line_length": 85, "num_lines": 415, "path": "/PyQT-CRUD-App/app/regdialogs/employee.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/python3\n# -*- coding: utf-8 -*-\n\"\"\"\nРегистрируем новых сотрудников\nCadastro de novos funcionários\n\"\"\"\nfrom app.db import data\nfrom app.tablewidgets.pcsadd import PCAdd\nfrom app.tools.functions import get_or_create\nfrom app.tools.exitmethods import Dialog\nfrom sqlalchemy.sql.operators import exists\nfrom PyQt5 import *\nfrom PyQt5.QtWidgets import *\nfrom PyQt5.QtGui import *\nfrom PyQt5.QtCore import *\nfrom PyQt5.Qt import *\n\n\nclass RegisterEmployee(Dialog):\n def __init__(self, session):\n QDialog.__init__(self)\n self.session = session\n self.added_pcs = []\n self.init_window()\n self.init_layouts()\n\n def init_window(self):\n self.setFixedWidth(700)\n self.setWindowModality(2)\n self.setWindowTitle('Cadastro de funcionário')\n self.setWindowIcon(QIcon(r'pics\\employee.png'))\n\n def init_layouts(self):\n buttons_layout = QHBoxLayout()\n\n back_button = QPushButton('Voltar')\n back_button.clicked.connect(self.close)\n submit_button = QPushButton('Adicionar ao banco de dados')\n submit_button.clicked.connect(self.validate_input)\n buttons_layout.addWidget(back_button, alignment=Qt.AlignRight)\n buttons_layout.addWidget(submit_button)\n\n form_layout = QFormLayout(self)\n\n self.surname_edit = QLineEdit()\n self.surname_edit.setValidator(QRegExpValidator(QRegExp(\"[^ ]+\")))\n self.surname_edit.setClearButtonEnabled(True)\n form_layout.addRow(\n 'Sobrenome:<font color=\"red\">*</font>', self.surname_edit\n )\n self.name_edit = QLineEdit()\n self.name_edit.setValidator(QRegExpValidator(QRegExp(\"[^ ]+\")))\n self.name_edit.setClearButtonEnabled(True)\n form_layout.addRow(\n 'Nome:<font color=\"red\">*</font>', self.name_edit\n )\n self.patronymic_edit = QLineEdit()\n self.patronymic_edit.setValidator(QRegExpValidator(QRegExp(\"[^ ]+\")))\n self.patronymic_edit.setClearButtonEnabled(True)\n form_layout.addRow(\n 'Nome do meio:', self.patronymic_edit\n )\n self.login_edit = QLineEdit()\n self.login_edit.setValidator(QRegExpValidator(QRegExp(\"[^ ]+\")))\n self.login_edit.setClearButtonEnabled(True)\n form_layout.addRow(\n 'Login:<font color=\"red\">*</font>', self.login_edit\n )\n phone_edit = QLineEdit()\n phone_edit.setInputMask('+55(999)99999-9999;_')\n self.phone_edit = [phone_edit]\n self.add_phone_button = QPushButton('+')\n self.add_phone_button.clicked.connect(self.add_phone)\n self.add_phone_button.setFixedSize(self.add_phone_button.sizeHint())\n phone_layout = QHBoxLayout()\n phone_layout.addWidget(phone_edit)\n phone_layout.addWidget(self.add_phone_button)\n form_layout.addRow(\n 'Número de telefone:', phone_layout\n )\n email_edit = QLineEdit()\n self.email_edit = [email_edit]\n self.add_email_button = QPushButton('+')\n self.add_email_button.clicked.connect(self.add_email)\n self.add_email_button.setFixedSize(self.add_email_button.sizeHint())\n email_layout = QHBoxLayout()\n email_layout.addWidget(email_edit)\n email_layout.addWidget(self.add_email_button)\n form_layout.addRow(\n 'E-mail:', email_layout\n )\n self.position_edit = QComboBox()\n self.position_edit.setEditable(True)\n self.position_edit.addItems([\n position\n for (position,) in self.session.query(data.Position.name)\n if position\n ])\n self.position_edit.setCurrentText('')\n form_layout.addRow(\n 'Posição:', self.position_edit\n )\n self.department_edit = QComboBox()\n self.department_edit.setEditable(True)\n self.department_edit.addItems([\n department\n for (department,) in self.session.query(data.Department.name)\n if department\n ])\n self.department_edit.setCurrentText('')\n form_layout.addRow(\n 'Departamento:', self.department_edit\n )\n self.address_edit = QComboBox()\n self.address_edit.addItems(\n self.session.query(data.Address.name).values()\n )\n self.address_edit.currentIndexChanged[str].connect(\n self.changed_item_in_address_combobox\n )\n form_layout.addRow(\n 'Endereço:<font color=\"red\">*</font>', self.address_edit\n )\n self.block_edit = QComboBox()\n form_layout.addRow(\n 'Habitação:<font color=\"red\">*</font>', self.block_edit\n )\n self.block_edit.addItems(\n self.session.query(data.Block.name). \\\n join(data.Address). \\\n filter(data.Address.name == self.address_edit.currentText()). \\\n values()\n )\n self.room_edit = QLineEdit()\n self.room_edit.setClearButtonEnabled(True)\n form_layout.addRow(\n 'Sala:<font color=\"red\">*</font>', self.room_edit\n )\n self.comments_edit = QLineEdit()\n self.comments_edit.setClearButtonEnabled(True)\n form_layout.addRow(\n 'Outro:', self.comments_edit\n )\n self.shared_folder_edit = QCheckBox()\n form_layout.addRow(\n 'Pastas compartilhadas:', self.shared_folder_edit\n )\n self.network_printer_edit = QCheckBox()\n form_layout.addRow(\n 'Impressora de rede:', self.network_printer_edit\n )\n\n table_layout = QVBoxLayout()\n\n self.model = QStandardItemModel()\n self.model.setHorizontalHeaderLabels(\n # ['Домен/Имя компьютера', 'MAC-адрес', 'Номер розетки',\n # 'Как подключен', 'Серверные приложения',\n # 'Windows OS', 'Windows OS key', 'Microsoft Office',\n # 'Microsoft Office key', 'Антивирус', 'Клиент электронной почты',\n # 'Прочее', 'Агент KES', 'Консультант', 'Гарант', '1C', 'КДС']\n ['Domain / Computer name', 'MAC address', 'Outlet number',\n 'Como conectado', 'Aplicativos de servidor',\n 'Sistema operacional Windows', 'Windows OS key', 'Microsoft Office',\n 'Chave do Microsoft Office', 'Anti-Virus', 'Cliente de email',\n 'Outro', 'Agente KES', 'Consultor', 'Fiador', '1C', 'KDS']\n )\n self.table = QTableView()\n self.table.setSortingEnabled(True)\n self.table.setSelectionBehavior(QAbstractItemView.SelectRows)\n self.table.setSelectionMode(QAbstractItemView.SingleSelection)\n self.table.setEditTriggers(QAbstractItemView.NoEditTriggers)\n self.table.setTextElideMode(Qt.ElideNone)\n self.table.setAlternatingRowColors(True)\n self.table.setModel(self.model)\n self.table.resizeColumnsToContents()\n\n table_buttons_layout = QHBoxLayout()\n add_table_row_button = QPushButton('Adicione um computador')\n add_table_row_button.setFixedSize(add_table_row_button.sizeHint())\n add_table_row_button.clicked.connect(self.add_table_row)\n delete_table_row_button = QPushButton('Soltar o computador')\n delete_table_row_button.setFixedSize(delete_table_row_button.sizeHint())\n delete_table_row_button.clicked.connect(self.delete_table_row)\n table_buttons_layout.addWidget(delete_table_row_button)\n table_buttons_layout.addWidget(add_table_row_button)\n table_buttons_layout.addStretch()\n\n table_layout.addWidget(self.table)\n table_layout.addLayout(table_buttons_layout)\n form_layout.addRow(table_layout)\n\n form_layout.addRow(buttons_layout)\n\n @pyqtSlot()\n def add_phone(self):\n phone_edit = QLineEdit()\n self.phone_edit.append(phone_edit)\n\n phone_layout = QHBoxLayout()\n phone_layout.addWidget(phone_edit)\n if len(self.phone_edit) < 3:\n phone_layout.addWidget(self.add_phone_button)\n self.layout().insertRow(5, \"Número de telefone adicional:\", phone_layout)\n else:\n self.add_phone_button.deleteLater()\n self.layout().insertRow(6, \"Número de telefone adicional:\", phone_layout)\n\n @pyqtSlot()\n def add_email(self):\n email_edit = QLineEdit()\n self.email_edit.append(email_edit)\n\n email_layout = QHBoxLayout()\n email_layout.addWidget(email_edit)\n if len(self.email_edit) < 3:\n email_layout.addWidget(self.add_email_button)\n self.layout().insertRow(\n 5 + len(self.phone_edit), \"E-mail adicional:\", email_layout\n )\n else:\n self.add_email_button.deleteLater()\n self.layout().insertRow(\n 6 + len(self.phone_edit), \"E-mail adicional:\", email_layout\n )\n\n @pyqtSlot(str)\n def changed_item_in_address_combobox(self, index):\n self.block_edit.clear()\n items = self.session.query(data.Block.name). \\\n join(data.Address). \\\n filter(data.Address.name == index). \\\n values()\n self.block_edit.addItems(items)\n\n @pyqtSlot()\n def add_table_row(self):\n add_pcs = PCAdd(self.session, self.added_pcs)\n if add_pcs.exec_() == QDialog.Accepted:\n for pc in add_pcs.added_pcs:\n self.added_pcs.append(pc)\n self.model.appendRow([\n QStandardItem(\n QIcon(r'pics\\pc.png'),\n pc.pcname.domain.name + '/' + pc.pcname.name\n ),\n QStandardItem(pc.mac_address),\n QStandardItem(pc.powersocket.name),\n QStandardItem(pc.connectiontype.name),\n QStandardItem(pc.app_server),\n QStandardItem(pc.windows.name),\n QStandardItem(pc.windows_os_key),\n QStandardItem(pc.office.name),\n QStandardItem(pc.ms_office_key),\n QStandardItem(pc.antivirus.name),\n QStandardItem(pc.mail_client),\n QStandardItem(pc.comments),\n QStandardItem('Existem' if pc.kes else 'Não'),\n QStandardItem('Existem' if pc.consultant else 'Não'),\n QStandardItem('Existem' if pc.guarantee else 'Não'),\n QStandardItem('Existem' if pc.odin_s else 'Não'),\n QStandardItem('Existem' if pc.kdc else 'Não')\n ])\n\n @pyqtSlot()\n def delete_table_row(self):\n index = self.table.selectionModel().selectedRows()\n try:\n element = self.model.takeRow(index[0].row())\n except IndexError:\n QMessageBox.warning(\n self, 'Erro',\n 'Selecione a linha na tabela'\n )\n return\n self.added_pcs.remove(\n self.session.query(data.Pc). \\\n filter_by(mac_address=element[1].text()).one()\n )\n\n @pyqtSlot()\n def validate_input(self):\n if not self.surname_edit.text() \\\n or not self.name_edit.text() \\\n or not self.room_edit.text() \\\n or not self.login_edit.text():\n QMessageBox.warning(\n self, 'Atenção',\n \"Campos: 'Sobrenome', 'Nome', 'Login', 'Sala'\" +\n \" -- obrigatórios\"\n )\n return\n\n if not self.address_edit.currentText() \\\n or not self.block_edit.currentText():\n QMessageBox.warning(\n self, 'Atenção',\n \"Você deve adicionar pelo menos um endereço previamente\"\n )\n return\n\n self.phone_numbers = [\n lineEdit.text() for lineEdit\n in self.phone_edit\n if lineEdit.text() != '+55()--'\n ]\n\n test_set = set()\n for phone_number in self.phone_numbers:\n if phone_number in test_set:\n QMessageBox.warning(\n self, 'Atenção', 'Telefones são os mesmos'\n )\n return\n else:\n test_set.add(phone_number)\n\n for phone in self.phone_numbers:\n stmt = self.session.query(data.Phone). \\\n filter(data.Phone.number == phone)\n\n if self.session.query(stmt.exists()).scalar():\n QMessageBox.warning(\n self, 'Aviso', 'O telefone digitado já está no banco de dados'\n )\n return\n\n self.emails = [\n lineEdit.text() for lineEdit\n in self.email_edit\n if lineEdit.text()\n ]\n\n test_set = set()\n for email in self.emails:\n if email in test_set:\n QMessageBox.warning(\n self, 'Aviso', 'correspondência de e-mail'\n )\n return\n else:\n test_set.add(email)\n\n for email in self.emails:\n stmt = self.session.query(data.Email). \\\n filter(data.Email.email == email)\n\n if self.session.query(stmt.exists()).scalar():\n QMessageBox.warning(\n self, 'Aviso', 'O e-mail inserido já existe no banco de dados'\n )\n return\n\n stmt = self.session.query(data.Employee). \\\n filter(data.Employee.unique_login == self.login_edit.text())\n if self.session.query(stmt.exists()).scalar():\n QMessageBox.warning(\n self, 'Aviso', 'O login inserido já existe no banco de dados'\n )\n return\n\n self.process_data()\n if not self.accept():\n self.session.rollback()\n\n def process_data(self):\n QApplication.setOverrideCursor(Qt.WaitCursor)\n employee = data.Employee(\n surname=self.surname_edit.text(),\n name=self.name_edit.text(),\n patronymic=self.patronymic_edit.text(),\n unique_login=self.login_edit.text(),\n comments=self.comments_edit.text(),\n shared_folder=self.shared_folder_edit.isChecked(),\n network_printer=self.network_printer_edit.isChecked()\n )\n\n employee.position = (\n get_or_create(\n self.session, data.Position,\n name=self.position_edit.currentText()\n )\n )\n\n employee.department = (\n get_or_create(\n self.session, data.Department,\n name=self.department_edit.currentText()\n )\n )\n\n for phone in self.phone_numbers:\n employee.phone.append(data.Phone(number=phone))\n\n for email in self.emails:\n employee.email.append(data.Email(email=email))\n\n block = self.session.query(data.Block). \\\n join(data.Address). \\\n filter(data.Block.name == self.block_edit.currentText()). \\\n filter(data.Address.name == self.address_edit.currentText()). \\\n one()\n\n room = self.session.query(data.Room). \\\n join(data.Block). \\\n filter(data.Room.name == self.room_edit.text()). \\\n first()\n\n if not room:\n room = data.Room(name=self.room_edit.text())\n room.block = block\n\n employee.room = room\n employee.pc = self.added_pcs\n QApplication.restoreOverrideCursor()\n" }, { "alpha_fraction": 0.45108696818351746, "alphanum_fraction": 0.49184781312942505, "avg_line_length": 29.66666603088379, "blob_id": "0acc221cebebb4a3e661de40a0d87a6239f5d721", "content_id": "03cca51c2216e54a7444a8f20e313a35f9971fbb", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 368, "license_type": "no_license", "max_line_length": 66, "num_lines": 12, "path": "/fullcontrol-/fc.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/python\nif __name__ == '__main__':\n\n i = 0\n with open('aicup026.sql', 'r', encoding=\"ISO-8859-1\") as fsql:\n esql = fsql.readline().replace('TABCUBO', 'aicup026')\n while esql:\n print(esql)\n a = esql.split(',')\n print(a)\n input()\n esql = fsql.readline().replace('TABCUBO', 'aicup026')\n" }, { "alpha_fraction": 0.5035476088523865, "alphanum_fraction": 0.5404841303825378, "avg_line_length": 29.528661727905273, "blob_id": "6cf447d2d606082e0cffdd991efe5bb4b9355c03", "content_id": "d27c0004663222dcb6bc0e172e381bc5cf07c5df", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 4792, "license_type": "no_license", "max_line_length": 89, "num_lines": 157, "path": "/opencv/Realidade-Aumentada-master/insertObject/main.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "from OpenGL.GL import *\nfrom OpenGL.GLUT import *\nfrom OpenGL.GLU import *\nimport cv2\nfrom PIL import Image\nimport numpy as np\nfrom webcam import Webcam\nfrom glyphs import Glyphs\n\nfrom objloader import *\nfrom constants import *\n \nclass OpenGLGlyphs:\n \n # constants\n INVERSE_MATRIX = np.array([[ 1.0, 1.0, 1.0, 1.0],\n [-1.0,-1.0,-1.0,-1.0],\n [-1.0,-1.0,-1.0,-1.0],\n [ 1.0, 1.0, 1.0, 1.0]])\n \n def __init__(self):\n print(\"aaaaaaaaaa\")\n # initialise webcam and start thread\n self.webcam = Webcam()\n self.webcam.start()\n \n # initialise glyphs\n self.glyphs = Glyphs()\n \n # initialise shapes\n self.cone = None\n self.sphere = None\n \n # initialise texture\n self.texture_background = None\n print(\"bbbb\")\n def _init_gl(self, Width, Height):\n glClearColor(0.0, 0.0, 0.0, 0.0)\n glClearDepth(1.0)\n glDepthFunc(GL_LESS)\n glEnable(GL_DEPTH_TEST)\n glShadeModel(GL_SMOOTH)\n glMatrixMode(GL_PROJECTION)\n glLoadIdentity()\n gluPerspective(33.7, 1.3, 0.1, 100.0)\n glMatrixMode(GL_MODELVIEW)\n \n # assign shapes\n self.cone = OBJ('cubo.obj',swapyz=True)\n \n self.sphere = OBJ('cubo.obj')\n \n # assign texture\n glEnable(GL_TEXTURE_2D)\n self.texture_background = glGenTextures(1)\n \n def _draw_scene(self):\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)\n glLoadIdentity()\n \n # get image from webcam\n image = self.webcam.get_current_frame()\n \n # convert image to OpenGL texture format\n bg_image = cv2.flip(image, 0)\n bg_image = Image.fromarray(bg_image) \n ix = bg_image.size[0]\n iy = bg_image.size[1]\n # bg_image = bg_image.tostring(\"raw\", \"BGRX\", 0, -1)\n bg_image = bg_image.tobytes(\"raw\", \"BGRX\", 0, -1)\n \n # create background texture\n glBindTexture(GL_TEXTURE_2D, self.texture_background)\n glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST)\n glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST)\n glTexImage2D(GL_TEXTURE_2D, 0, 3, ix, iy, 0, GL_RGBA, GL_UNSIGNED_BYTE, bg_image)\n \n # draw background\n glBindTexture(GL_TEXTURE_2D, self.texture_background)\n glPushMatrix()\n glTranslatef(0.0,0.0,-10.0)\n self._draw_background()\n glPopMatrix()\n \n # handle glyphs\n image = self._handle_glyphs(image)\n \n glutSwapBuffers()\n \n def _handle_glyphs(self, image):\n \n # attempt to detect glyphs\n glyphs = []\n \n try:\n glyphs = self.glyphs.detect(image)\n except Exception as ex: \n print(ex)\n \n if not glyphs: \n return\n \n for glyph in glyphs:\n \n rvecs, tvecs, glyph_name = glyph\n glyph_name = 'cone'\n \n # build view matrix\n rmtx = cv2.Rodrigues(rvecs)[0]\n \n view_matrix = np.array([[rmtx[0][0],rmtx[0][1],rmtx[0][2],tvecs[0]],\n [rmtx[1][0],rmtx[1][1],rmtx[1][2],tvecs[1]],\n [rmtx[2][0],rmtx[2][1],rmtx[2][2],tvecs[2]],\n [0.0 ,0.0 ,0.0 ,1.0 ]])\n \n view_matrix = view_matrix * self.INVERSE_MATRIX\n \n view_matrix = np.transpose(view_matrix)\n \n # load view matrix and draw shape\n glPushMatrix()\n glLoadMatrixd(view_matrix)\n glCallList(self.cone.gl_list)\n if glyph_name == SHAPE_CONE:\n glCallList(self.cone.gl_list)\n elif glyph_name == SHAPE_SPHERE:\n glCallList(self.sphere.gl_list)\n \n glPopMatrix()\n \n def _draw_background(self):\n # draw background\n glBegin(GL_QUADS)\n glTexCoord2f(0.0, 1.0); glVertex3f(-4.0, -3.0, 0.0)\n glTexCoord2f(1.0, 1.0); glVertex3f( 4.0, -3.0, 0.0)\n glTexCoord2f(1.0, 0.0); glVertex3f( 4.0, 3.0, 0.0)\n glTexCoord2f(0.0, 0.0); glVertex3f(-4.0, 3.0, 0.0)\n glEnd( )\n \n def main(self):\n # setup and run OpenGL\n print(\"ccccccc\")\n glutInit()\n print(\"dddd\")\n glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH)\n print(\"eee\")\n glutInitWindowSize(640, 480)\n glutInitWindowPosition(800, 400)\n self.window_id = glutCreateWindow(\"OpenGL Glyphs\")\n glutDisplayFunc(self._draw_scene)\n glutIdleFunc(self._draw_scene)\n self._init_gl(640, 480)\n glutMainLoop()\n \n# run an instance of OpenGL Glyphs \nopenGLGlyphs = OpenGLGlyphs()\nopenGLGlyphs.main()" }, { "alpha_fraction": 0.529691219329834, "alphanum_fraction": 0.54423987865448, "avg_line_length": 27.794872283935547, "blob_id": "795f95de8e580f2af55f5902482fc903da77a60f", "content_id": "b70aba2e0e87c44a4e9f08a4a8171423bdbb72c3", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3368, "license_type": "no_license", "max_line_length": 76, "num_lines": 117, "path": "/JPro-master/dialog_new.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import sys\nfrom PyQt5.QtWidgets import (QApplication, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t QDialog,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t QLineEdit,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t QShortcut,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t qApp,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t QLabel,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t QPushButton,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t QComboBox,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\nfrom PyQt5.QtGui import QKeySequence\nfrom dbcreation import Models\nfrom connect import Connect\nfrom dbcreation import ProductionQueue\nfrom PyQt5.QtSql import QSqlDatabase,QSqlQuery,QSqlRecord, QSqlField\nimport datetime\n\nclass Dialog(QDialog): \n\n\t\n\tdef __init__(self): \n\t\tsuper().__init__()\n\n\t\tself.initdiagUI()\n\n\tdef initdiagUI(self):\n\n\t\texitShortcut = QShortcut(QKeySequence('Ctrl+W'),self, qApp.quit)\n\n\t#=====#\t#=====#\t#=====#\t#=====#\t#=====#\t#=====#\n\t# Create local seperate connection to databse\n\t#=====#\t#=====#\t#=====#\t#=====#\t#=====#\t#=====#\n\n\t\tself.db = QSqlDatabase.database(\"dialog\")\n\n\t#=====#\t#=====#\t#=====#\t#=====#\t#=====#\t#=====#\n\t# Create SqlRecord template with predefined fields \n\t#=====#\t#=====#\t#=====#\t#=====#\t#=====#\t#=====#\n\n\t\tself.record_template = QSqlRecord()\n\t\tself.record_template.insert(0, QSqlField('model'))\n\t\tself.record_template.insert(1, QSqlField('order_quantity'))\n\t\tself.record_template.insert(2, QSqlField('order_time'))\n\t\tself.record_template.insert(3, QSqlField('expected_production'))\n\n\n\t#=====#\t#=====#\t#=====#\t#=====#\t#=====#\t#=====#\n\t# Main widgets \n\t#=====#\t#=====#\t#=====#\t#=====#\t#=====#\t#=====#\n\n\t\tlabel_model = QLabel('Model',self)\n\t\tlabel_model.move(40, 50)\n\n\t\tself.combo = QComboBox(self)\n\t\tself.fillcombo()\n\t\tself.combo.move(180, 50)\n\n\t\tlabel_orderquantity = QLabel('Order Quantity',self)\n\t\tlabel_orderquantity.move(40, 100)\n\n\t\tself.oq_input = QLineEdit('',self)\n\t\tself.oq_input.move(180, 100)\n\n\n\t\tself.error_message = QLabel('',self)\n\t\tself.error_message.move(180, 130)\n\n\t\tbtn_submit = QPushButton('Submit Order', self)\n\t\tbtn_submit.move(180,150)\n\t\tbtn_submit.clicked.connect(self.submittodb)\n\n\t\tself.setFixedSize(350,200)\n\t\tself.setWindowTitle('Input Dialog')\n\t\tself.show()\t\t\n\t\tself.new_record = -1\n\n\t#=====#\t#=====#\t#=====#\t#=====#\t#=====#\t#=====#\n\t#=====#\t#=====#\t#=====#\t#=====#\t#=====#\t#=====#\n\n\t#\t\t\t\t\t\t\tMETHODS\t\t\t\t\t\t\t\t\t\t\t\t\t#\n\t#=====#\t#=====#\t#=====#\t#=====#\t#=====#\t#=====#\n\t#=====#\t#=====#\t#=====#\t#=====#\t#=====#\t#=====#\n\n\n\t#=====#\t#=====#\t#=====#\t#=====#\t#=====#\t#=====#\n\t#Populate combo box with model names using QSqlQuery and QSqlRecord objects\n\t#=====#\t#=====#\t#=====#\t#=====#\t#=====#\t#=====#\n\tdef fillcombo(self):\n\t\tq = QSqlQuery(\"select name from models\",self.db)\n\t\tself.rec = q.record()\n\t\tnameCol = self.rec.indexOf(\"name\")\n\t\tprint (nameCol)\n\t\twhile q.next():\n\t\t\tself.combo.addItem(q.value(nameCol))\n\n\t#=====#\t#=====#\t#=====#\t#=====#\t#=====#\t#=====#\n\t#Submit input data to the model in database\n\t#=====#\t#=====#\t#=====#\t#=====#\t#=====#\t#=====#\n\tdef submittodb(self): \n\t\t#print ('Inside label: ', self.oq_input.text())\n\t\tif self.oq_input.text().isdigit():\n\t\t\tself.new_record = QSqlRecord(self.record_template)\n\t\t\tself.new_record.setValue(0, self.combo.currentText())\n\t\t\tself.new_record.setValue(1, self.oq_input.text())\n\t\t\tself.new_record.setValue(2, str(datetime.datetime.now()))\n\t\t\tself.close()\n\t\telse: \n\t\t\tself.error_message.setText('Please enter an integer only')\n\t\t\tself.error_message.adjustSize()\n\t\t\tself.error_message.setStyleSheet(\"color:red\")\n\n\nif __name__ == '__main__' : \n\n\tapp = QApplication(sys.argv)\n\tdialog = Dialog()\n\tsys.exit(app.exec_())" }, { "alpha_fraction": 0.6210646033287048, "alphanum_fraction": 0.6273937225341797, "avg_line_length": 35.03508758544922, "blob_id": "3692653ab484a8d5eda07aa5f6ba229a20a5bcf4", "content_id": "fbf2ba862e735f3a033f35347dbcf055ffa91e9f", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 6322, "license_type": "no_license", "max_line_length": 185, "num_lines": 171, "path": "/fullcontrol-menu/movies.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "# -*- encoding:utf-8 -*-\nimport sys\nfrom PyQt5.QtWidgets import QDialog, QLabel, QPushButton, QLineEdit, QListWidget, QGridLayout, QComboBox, QMessageBox, QApplication, QMenuBar, QAction, QMainWindow, QWidget, QVBoxLayout\nfrom PyQt5.QtCore import pyqtSlot, QThread, QObject\nfrom PyQt5.QtGui import QIcon, QPixmap, QImage\nfrom movieSource.MovieHeaven import MovieHeaven\n\n\nclass ImageWindow(QMainWindow):\n def __init__(self, resources, title):\n super(ImageWindow, self).__init__()\n self.setWindowTitle(title)\n\n self.central_widget = QWidget()\n self.setCentralWidget(self.central_widget)\n layout = QVBoxLayout(self.central_widget)\n\n image = QImage(resources)\n pixmap = QPixmap(resources)\n image_label = QLabel(self)\n image_label.setPixmap(pixmap)\n image_label.resize(pixmap.width(), pixmap.height())\n layout.addWidget(image_label)\n\n\nclass LayoutDialog(QMainWindow):\n __slots__ = ['word', 'movie_name_label', 'movie_name_line_edit', 'movie_source_label', 'movie_source_combobox',\n 'search_push_button', 'tip_label', 'search_content_label', 'search_content_text_list']\n\n def __init__(self):\n super().__init__()\n self.left = 300\n self.top = 300\n self.width = 400\n self.height = 450\n\n self.work = WorkThread()\n self.init_widgets().init_layout().init_event()\n\n def init_widgets(self):\n self.setWindowTitle(self.tr(\"Search Movies\"))\n self.setGeometry(self.left, self.top, self.width, self.height)\n self.movie_name_label = QLabel(self.tr(\"电影名称:\"))\n self.movie_name_line_edit = QLineEdit()\n\n self.movie_source_label = QLabel(self.tr(\"选择片源:\"))\n self.movie_source_combobox = QComboBox()\n self.movie_source_combobox.addItem(self.tr('电影天堂'))\n\n self.search_push_button = QPushButton(self.tr(\"查询\"))\n\n self.tip_label = QLabel(self.tr(\"未开始查询...\"))\n self.search_content_label = QLabel(self.tr(\"查询内容:\"))\n self.search_content_text_list = QListWidget()\n\n self.menu_bar = self.menuBar()\n\n return self\n\n def init_layout(self):\n top_layout = QGridLayout()\n top_layout.addWidget(self.movie_name_label, 0, 0)\n top_layout.addWidget(self.movie_name_line_edit, 0, 1)\n top_layout.addWidget(self.movie_source_label, 0, 2)\n top_layout.addWidget(self.movie_source_combobox, 0, 3)\n top_layout.addWidget(self.search_push_button, 0, 4)\n top_layout.addWidget(self.tip_label, 3, 1)\n top_layout.addWidget(self.search_content_label, 3, 0)\n top_layout.addWidget(self.search_content_text_list, 4, 0, 2, 5)\n\n main_frame = QWidget()\n self.setCentralWidget(main_frame)\n main_frame.setLayout(top_layout)\n\n self.reward_window = ImageWindow('resources/wechat_reward.jpg', '赞赏')\n self.watch_window = ImageWindow('resources/watch_wechat.jpg', '关注')\n\n return self\n\n def init_event(self):\n self.search_push_button.clicked.connect(self.search)\n self.search_content_text_list.itemClicked.connect(self.copy_text)\n\n reward_action = QAction('赞赏', self)\n reward_action.setIcon(QIcon('resources/reward.png'),)\n reward_action.triggered.connect(self.reward)\n\n watch_action = QAction('关注', self)\n watch_action.setIcon(QIcon('resources/watch.png'),)\n watch_action.triggered.connect(self.watch_wechat)\n\n reward_menu = self.menu_bar.addMenu('支持作者')\n reward_menu.addAction(reward_action)\n reward_menu.addAction(watch_action)\n\n def reward(self):\n self.reward_window.show()\n\n def watch_wechat(self):\n self.watch_window.show()\n\n def search(self):\n self.tip_label.setText(self.tr(\"正在查询请稍后...\"))\n movie_name = self.movie_name_line_edit.text()\n if movie_name:\n self.work.render(movie_name, self.movie_source_combobox,\n self.tip_label, self.search_content_text_list)\n else:\n self.critical(\"请输入电影名称!\")\n\n def critical(self, message):\n \"\"\"\n when the movieName is None,\n remind users\n \"\"\"\n QMessageBox.critical(self, self.tr(\"致命错误\"),\n self.tr(message))\n\n def copy_text(self):\n copied_text = self.search_content_text_list.currentItem().text()\n QApplication.clipboard().clear()\n QApplication.clipboard().setText(copied_text)\n self.slot_information()\n\n def slot_information(self):\n QMessageBox.information(self, \"Success!\", self.tr(\"成功将内容复制到剪贴板上!\"))\n\n\nclass WorkThread(QThread):\n def __init__(self):\n QThread.__init__(self)\n\n def render(self, movie_name, movie_source_combobox, tip_label, search_content_text_list):\n self.movies_list = []\n self.movie_source_combobox = movie_source_combobox\n self.movie_name = movie_name\n self.tip_label = tip_label\n self.search_content_text_list = search_content_text_list\n self.start()\n\n def get_select_movie_source(self, movie_name):\n \"\"\"\n according to the value of the QComboBox,\n generate the right class of movie search\n \"\"\"\n movies, url, params = None, None, {\n \"kwtype\": \"0\", \"searchtype\": \"title\"}\n select_source = self.movie_source_combobox.currentText()\n if select_source == self.tr('电影天堂'):\n movies = MovieHeaven()\n url = \"http://s.dydytt.net/plus/search.php\"\n params[\"keyword\"] = movie_name.encode('gb2312')\n return movies, url, params\n\n def run(self):\n search_movies, url, params = self.get_select_movie_source(\n self.movie_name)\n try:\n self.movies_list = search_movies.get_display_content(url, params)\n except Exception as e:\n self.movies_list.append(self.tr(\"过于频繁的访问\"))\n finally:\n self.search_content_text_list.clear()\n self.search_content_text_list.addItems(self.movies_list)\n self.tip_label.setText(self.tr(\"查询结束\"))\n\n\napp = QApplication(sys.argv)\ndialog = LayoutDialog()\ndialog.show()\napp.exec_()\n" }, { "alpha_fraction": 0.6870967745780945, "alphanum_fraction": 0.8064516186714172, "avg_line_length": 50.66666793823242, "blob_id": "35ff638f36e9905a7d9012f2f39dabc2de371b1a", "content_id": "f40acefec76cbede097f934f8c768f878f4a2af8", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 310, "license_type": "no_license", "max_line_length": 111, "num_lines": 6, "path": "/Wanderson-Magalhaes/Python_PySide2_Custom_Title_Bar-master/README.md", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "# Python PySide2 Custom Title Bar [Modern GUI]\n![App_1](https://user-images.githubusercontent.com/60605512/86516153-a53b0580-bdf4-11ea-9966-31ac1c9effcf.PNG)\nA simple project created with PySide2 and Qt Designer showing how it works to create a customizable application\n\n# Youtube\nhttps://youtu.be/wQfKamzV1uQ\n" }, { "alpha_fraction": 0.6833333373069763, "alphanum_fraction": 0.6854938268661499, "avg_line_length": 42.20000076293945, "blob_id": "9eb634b7fc802a9feaa2999c5987fd0d52e58c38", "content_id": "cdc5f52232d201d10efe62784943c89ab133bbed", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3240, "license_type": "no_license", "max_line_length": 81, "num_lines": 75, "path": "/pyside2/datavisualize/datavisualize4/main_widget.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#############################################################################\n##\n## Copyright (C) 2016 The Qt Company Ltd.\n## Contact: http://www.qt.io/licensing/\n##\n## This file is part of the Qt for Python examples of the Qt Toolkit.\n##\n## $QT_BEGIN_LICENSE:BSD$\n## You may use this file under the terms of the BSD license as follows:\n##\n## \"Redistribution and use in source and binary forms, with or without\n## modification, are permitted provided that the following conditions are\n## met:\n## * Redistributions of source code must retain the above copyright\n## notice, this list of conditions and the following disclaimer.\n## * Redistributions in binary form must reproduce the above copyright\n## notice, this list of conditions and the following disclaimer in\n## the documentation and/or other materials provided with the\n## distribution.\n## * Neither the name of The Qt Company Ltd nor the names of its\n## contributors may be used to endorse or promote products derived\n## from this software without specific prior written permission.\n##\n##\n## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n## \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\"\n##\n## $QT_END_LICENSE$\n##\n#############################################################################\n\nfrom PySide2.QtGui import QColor\nfrom PySide2.QtWidgets import (QAction, QApplication, QHBoxLayout, QHeaderView,\n QMainWindow, QSizePolicy, QTableView, QWidget)\n\nfrom table_model import CustomTableModel\n\nclass Widget(QWidget):\n def __init__(self, data):\n QWidget.__init__(self)\n\n # Getting the Model\n self.model = CustomTableModel(data)\n\n # Creating a QTableView\n self.table_view = QTableView()\n self.table_view.setModel(self.model)\n\n # QTableView Headers\n self.horizontal_header = self.table_view.horizontalHeader()\n self.vertical_header = self.table_view.verticalHeader()\n self.horizontal_header.setSectionResizeMode(QHeaderView.ResizeToContents)\n self.vertical_header.setSectionResizeMode(QHeaderView.ResizeToContents)\n self.horizontal_header.setStretchLastSection(True)\n\n # QWidget Layout\n self.main_layout = QHBoxLayout()\n size = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)\n\n ## Left layout\n size.setHorizontalStretch(1)\n self.table_view.setSizePolicy(size)\n self.main_layout.addWidget(self.table_view)\n\n # Set the layout to the QWidget\n self.setLayout(self.main_layout)\n" }, { "alpha_fraction": 0.6382554769515991, "alphanum_fraction": 0.638504683971405, "avg_line_length": 40.796875, "blob_id": "152d7e801d1cb7216bad896afccef02a4138760f", "content_id": "bbba023f0d1283141968dea7d7f36254009f3482", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 8025, "license_type": "no_license", "max_line_length": 122, "num_lines": 192, "path": "/cidades_ibge/data.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/python3\n# -*- coding: utf-8 -*-\n\"\"\"\nPostgreSQL database tables\n\"\"\"\n\nfrom sqlalchemy.orm import relationship, exc, column_property\nfrom sqlalchemy.ext.declarative import declarative_base\nfrom sqlalchemy.orm.query import Query as _Query\nfrom sqlalchemy import Table, Column, Integer, String, Boolean, ForeignKey, UniqueConstraint\n\nBase = declarative_base()\nSession = None\n\n\nclass Query(_Query):\n def values(self):\n try:\n return [i for (i,) in self]\n except ValueError as e:\n raise MultipleValuesFound(str(e))\n\n\nclass MultipleValuesFound(ValueError, exc.MultipleResultsFound):\n \"\"\"\n raised when multiple values are found in a single result row\n \"\"\"\n\n\nclass Employee(Base):\n __tablename__ = 'employee'\t\n employee_id = Column(Integer, primary_key=True)\n surname \t\t= Column(String, nullable=False)\n name \t\t\t= Column(String, nullable=False)\n patronymic \t\t= Column(String)\n fullname = column_property(surname + ' ' + name + ' ' + patronymic)\n email \t\t\t= Column(String)\n unique_login \t= Column(String, unique=True, nullable=False)\n position_id \t= Column(Integer, ForeignKey('position.position_id'))\n shared_folder \t= Column(Boolean)\n network_printer = Column(Boolean)\n department_id \t= Column(Integer, ForeignKey('department.department_id'))\n room_id \t\t= Column(Integer, ForeignKey('room.room_id'))\n comments \t\t= Column(String)\n pc \t\t\t = relationship('Pc', secondary='association', back_populates='employee')\n position \t = relationship('Position', back_populates='employee')\n department = relationship('Department', back_populates='employee')\n room \t\t = relationship('Room', back_populates='employee')\n phone \t\t = relationship('Phone', back_populates='employee', cascade='all, delete-orphan', passive_deletes=True)\n email = relationship('Email', back_populates='employee', cascade='all, delete-orphan', passive_deletes=True)\n\n\nclass Position(Base):\n\t__tablename__ = 'position'\t\n\tposition_id = Column(Integer, primary_key=True)\n\tname \t\t = Column(String, unique=True, nullable=False)\t\n\temployee = relationship('Employee', back_populates='position')\n\n\nclass Department(Base):\n\t__tablename__ = 'department'\t\n\tdepartment_id \t= Column(Integer, primary_key=True)\n\tname \t\t\t= Column(String, unique=True, nullable=False)\t\n\temployee = relationship('Employee', back_populates='department')\n\n\nclass Phone(Base):\n __tablename__ = 'phone'\n phone_id = Column(Integer, primary_key=True)\n employee_id = Column(Integer, ForeignKey('employee.employee_id', ondelete = 'CASCADE'))\n number = Column(String, unique=True, nullable=False)\n employee = relationship('Employee', back_populates='phone')\n\n\nclass Email(Base):\n __tablename__ = 'email'\n email_id = Column(Integer, primary_key=True)\n employee_id = Column(Integer, ForeignKey('employee.employee_id', ondelete = 'CASCADE'))\n email = Column(String, unique=True, nullable=False)\n employee = relationship('Employee', back_populates='email')\n\n\nclass Room(Base):\n __tablename__ = 'room'\n __table_args__ = (UniqueConstraint('name', 'block_id', name='uix_name_block_id'),)\n room_id = Column(Integer, primary_key=True)\n name\t = Column(String, nullable=False)\n block_id = Column(Integer, ForeignKey('block.block_id', ondelete='CASCADE'))\n employee = relationship('Employee', back_populates='room')\n block = relationship('Block', back_populates='room')\n\n\nclass Block(Base):\n __tablename__ = 'block'\n __table_args__ = (UniqueConstraint('name', 'address_id', name='uix_name_address_id'),)\n block_id = Column(Integer, primary_key=True)\n name \t = Column(String, nullable=False)\n address_id = Column(Integer, ForeignKey('address.address_id', ondelete='CASCADE'))\n room \t = relationship('Room', back_populates='block', cascade='all, delete-orphan', passive_deletes=True)\n address = relationship('Address', back_populates='block')\n\n\nclass Address(Base):\n __tablename__ = 'address'\n address_id \t = Column(Integer, primary_key=True)\n name \t\t = Column(String, unique=True, nullable=False)\n block = relationship('Block', back_populates='address', cascade='all, delete-orphan', passive_deletes=True)\n\nassociation_table = Table('association', Base.metadata,\n\tColumn('employee_id', Integer, ForeignKey('employee.employee_id')),\n\tColumn('pc_id', Integer, ForeignKey('pc.pc_id'))\n )\n\n\nclass Pc(Base):\n __tablename__ = 'pc'\n pc_id = Column(Integer, ForeignKey(\"pcname.pc_id\"), primary_key=True)\n mac_address = Column(String, unique=True, nullable=False)\n power_socket_id = Column(Integer, ForeignKey('powersocket.power_socket_id'))\n con_type_id = Column(Integer, ForeignKey('connectiontype.con_type_id'))\n app_server = Column(String)\n windows_id = Column(Integer, ForeignKey('windows.windows_id'))\n windows_os_key = Column(String)\n office_id = Column(Integer, ForeignKey('office.office_id'))\n ms_office_key = Column(String)\n kes = Column(Boolean)\n antivirus_id = Column(Integer, ForeignKey('antivirus.antivirus_id'))\n consultant = Column(Boolean)\n guarantee = Column(Boolean)\n odin_s = Column(Boolean)\n kdc = Column(Boolean)\n mail_client = Column(String)\n comments = Column(String)\n employee = relationship('Employee', secondary=association_table, back_populates='pc')\n connectiontype = relationship('ConnectionType', back_populates='pc')\n pcname = relationship('PcName', back_populates='pc')\n powersocket = relationship('PowerSocket', back_populates='pc')\n windows = relationship('Windows', back_populates='pc')\n office = relationship('Office', back_populates='pc')\n antivirus = relationship('Antivirus', back_populates='pc') \n\n\nclass PcName(Base):\n __tablename__ = 'pcname'\n __table_args__ = (UniqueConstraint('name', 'domain_id', name='uix_name_domain_id'),)\n pc_id = Column(Integer, primary_key=True)\n name = Column(String, nullable=False)\n domain_id = Column(Integer, ForeignKey('domain.domain_id'))\n pc = relationship('Pc', back_populates='pcname')\n domain = relationship('Domain', back_populates='pcname')\n\n\nclass Domain(Base):\n __tablename__ = 'domain'\n domain_id = Column(Integer, primary_key=True)\n name = Column(String, unique=True, nullable=False)\n pcname = relationship('PcName', back_populates='domain')\n\n\nclass ConnectionType(Base):\n __tablename__ = 'connectiontype'\n con_type_id = Column(Integer, primary_key=True)\n name = Column(String, unique=True, nullable=False)\n pc = relationship('Pc', back_populates='connectiontype')\n\n\nclass PowerSocket(Base):\n __tablename__ = 'powersocket'\n power_socket_id = Column(Integer, primary_key=True)\n name = Column(String, unique=True, nullable=False)\n pc = relationship('Pc', back_populates='powersocket')\n\n\nclass Windows(Base):\n __tablename__ = 'windows'\n windows_id = Column(Integer, primary_key=True)\n name = Column(String, unique=True, nullable=False)\n pc = relationship('Pc', back_populates='windows')\n\n\nclass Office(Base):\n __tablename__ = 'office'\n office_id = Column(Integer, primary_key=True)\n name = Column(String, unique=True, nullable=False)\n pc = relationship('Pc', back_populates='office')\n\n\nclass Antivirus(Base):\n __tablename__ = 'antivirus'\n antivirus_id = Column(Integer, primary_key=True)\n name = Column(String, unique=True, nullable=False)\n pc = relationship('Pc', back_populates='antivirus')\n" }, { "alpha_fraction": 0.6187459230422974, "alphanum_fraction": 0.636224627494812, "avg_line_length": 32.13768005371094, "blob_id": "a31f70d6982cde98a80e0e0805118163a9a74e41", "content_id": "d0a3caa3ec691c3011ccc4eee9da55ac1342bdfc", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 4577, "license_type": "no_license", "max_line_length": 93, "num_lines": 138, "path": "/djangosige/venv/Lib/site-packages/geraldo/barcodes.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "\"\"\"Module with BarCodes functions on Geraldo.\"\"\"\n\nfrom .graphics import Graphic\nfrom .utils import memoize, get_attr_value, cm\n\nfrom reportlab.graphics.barcode import getCodeNames\nfrom reportlab.graphics.barcode.common import Codabar, Code11, I2of5, MSI\nfrom reportlab.graphics.barcode.code128 import Code128\nfrom reportlab.graphics.barcode.eanbc import Ean13BarcodeWidget, Ean8BarcodeWidget\nfrom reportlab.graphics.barcode.code39 import Extended39, Standard39\nfrom reportlab.graphics.barcode.code93 import Extended93, Standard93\nfrom reportlab.graphics.barcode.usps import FIM, POSTNET\nfrom reportlab.graphics.barcode.usps4s import USPS_4State\nfrom reportlab.graphics.barcode.qr import QrCodeWidget\nfrom reportlab.graphics.barcode import createBarcodeDrawing\n\nSUPPORTED_BARCODE_TYPES = getCodeNames()\nBARCODE_CLASSES = {\n 'Codabar': Codabar,\n 'Code11': Code11,\n 'Code128': Code128,\n 'EAN13': Ean13BarcodeWidget,\n 'EAN8': Ean8BarcodeWidget,\n 'Extended39': Extended39,\n 'Extended93': Extended93,\n 'FIM': FIM,\n 'I2of5': I2of5,\n 'MSI': MSI,\n 'POSTNET': POSTNET,\n 'Standard39': Standard39,\n 'Standard93': Standard93,\n 'USPS_4State': USPS_4State,\n 'QR': QrCodeWidget,\n}\n\n\nclass BarCode(Graphic):\n \"\"\"Class used by all barcode types generation. A barcode is just another graphic\n element, with basic attributes, like 'left', 'top', 'width', 'height' and\n 'visible', plus its specific attributes 'type', 'checksum' and 'attribute_name' -\n the last one seemed to the similar from ObjectValue.\n\n The attribute 'width' is not about the graphic width, but the bar width (what\n means you must have a value like 0.01*cm or less to have a good result).\n\n Another attribute is 'routing_attribute' used only by type 'USPS_4State'.\n\n Also supports 'get_value' lambda attribute, like ObjectValue (with the argument\n 'inst')\"\"\"\n\n _type = None\n _width = 0.03*cm\n _height = 1.5*cm\n attribute_name = None\n checksum = 0\n routing_attribute = None\n aditional_barcode_params = {}\n get_value = None # A lambda function to get customized values\n \n #QRCode\n qr_level = 'L'\n border = 4\n\n def clone(self):\n new = super(BarCode, self).clone()\n\n new.type = self.type\n new.attribute_name = self.attribute_name\n new.get_value = self.get_value\n new.checksum = self.checksum\n new.routing_attribute = self.routing_attribute\n new.aditional_barcode_params = self.aditional_barcode_params\n \n new.qr_level = self.qr_level\n new.border = self.border\n\n return new\n\n def set_type(self, typ):\n if typ not in SUPPORTED_BARCODE_TYPES:\n raise Exception('Supported types are: '+', '.join(SUPPORTED_BARCODE_TYPES))\n\n self._type = typ\n type = property(lambda self: self._type, set_type)\n\n def render(self):\n if not getattr(self, '_rendered_drawing', None):\n kwargs = self.aditional_barcode_params\n kwargs['value'] = self.get_object_value()\n \n if 'barWidth' not in kwargs:\n kwargs['barWidth'] = self.width\n\n if 'barHeight' not in kwargs:\n kwargs['barHeight'] = self.height\n \n ##QRCode\n if 'barLevel' not in kwargs:\n kwargs['barLevel'] = self.qr_level\n \n if 'barBorder' not in kwargs:\n kwargs['barBorder'] = self.border\n ####\n \n if self.type in ('EAN13','EAN8','QR'):\n self._rendered_drawing = createBarcodeDrawing(self.type, **kwargs)\n else:\n cls = BARCODE_CLASSES[self.type]\n\n kwargs['checksum'] = self.checksum\n\n if self.type in ('USPS_4State',):\n kwargs['routing'] = get_attr_value(self.instance, self.routing_attribute)\n\n self._rendered_drawing = cls(**kwargs)\n\n return self._rendered_drawing\n\n def get_object_value(self, instance=None):\n \"\"\"Return the attribute value for just an object\"\"\"\n\n instance = instance or self.instance\n\n if self.get_value and instance:\n return self.get_value(instance)\n\n value = get_attr_value(instance, self.attribute_name)\n\n return value\n\n def _get_width(self):\n drawing = getattr(self, '_rendered_drawing', None)\n return drawing and drawing.width or self._width\n\n def _set_width(self, value):\n self._width = value\n\n width = property(_get_width, _set_width)\n " }, { "alpha_fraction": 0.6518771052360535, "alphanum_fraction": 0.6672354936599731, "avg_line_length": 29.842105865478516, "blob_id": "18fbe69769db4eee9651b5428871e8a7c6788538", "content_id": "01acef1468a7732555177e567e1c45919af045cc", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 586, "license_type": "no_license", "max_line_length": 136, "num_lines": 19, "path": "/PQt5-Stock/README.md", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "Sistema-de-gestion-con-PyQt5\n============================\n\nSistema de gestion con PyQt5 <br>\n\nHasta hoy puede hacer: <br>\n\t- Administrar usuarios <br>\n\t- Control de usuario <br>\n\t- Gestion de proveedores, clientes y productos <br>\n\t- Sistema de stock <br>\n\t- Sistema de ventas <br>\n\t- Genera recibo de pago (Falta estilo) y lo guarda en formato PDF <br>\n\t- Genera reportes (proveedores y/o clientes con saldo, productos sin stock, ingreso y egreso de productos por intervalo de tiempo, etc)\n<br><br> \nTecnologias: <br>\n\t# Python 3.3.2 <br>\n\t# Qt5 <br>\n\t# PyQt5 <br>\n\t# MySql 6.0 <br>\n" }, { "alpha_fraction": 0.42178988456726074, "alphanum_fraction": 0.4607003927230835, "avg_line_length": 26.934782028198242, "blob_id": "f774c4a93ca3f6aa0e0909252334a001915c6fd8", "content_id": "b249a40d7dbe0e26d87c8e2b4ed9eb025675943a", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1286, "license_type": "no_license", "max_line_length": 75, "num_lines": 46, "path": "/full - compara relatorios/leFinanc.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import sys\nimport os\nimport csv\nimport pandas as pd\n\n\ndef procFinanc(arq):\n comfile = open(arq + '.ori', 'r')\n csvfile = open(arq + '.csv', 'w')\n\n cab = 'EMPRESA|ESPECIE|SERIE|NUMERO|PARCELA|VALOR'\n csvfile.write(cab + '\\n')\n\n for l in comfile:\n if l[47:48] == '5' and l[49:50] == '/' and l[53:54] == '/':\n csvfile.write(l[47:49] + '|' + \n l[50:53] + '|' + \n l[54:57] + '|' + \n l[58:66] + '|' + \n l[67:69] + '|' + \n l[89:102] + '\\n')\n\n comfile.close()\n csvfile.close()\n\n df = pd.read_csv(arq + '.csv', sep='|', encoding='cp1252', decimal=',')\n\n df['VALOR'] = [x.replace('.', '') for x in df['VALOR']]\n df['VALOR'] = [x.replace(',', '.') for x in df['VALOR']]\n df['VALOR'] = [x.replace(' ', '0') for x in df['VALOR']]\n df['VALOR'] = df['VALOR'].astype(float)\n\n return df\n\n\nif __name__ == \"__main__\":\n if(len(sys.argv) < 2):\n print(\"Use: leFinanc arquivo\")\n sys.exit(0)\n if os.path.isfile(sys.argv[1]):\n df = procFinanc(os.path.splitext(os.path.basename(sys.argv[1]))[0])\n print(df)\n else:\n print(u'Arquivo não encontrado!')\n sys.exit(0)\n sys.exit(1)\n" }, { "alpha_fraction": 0.5967912673950195, "alphanum_fraction": 0.6138936281204224, "avg_line_length": 35.98493957519531, "blob_id": "884ded8c8215040acffa80b0901d1d8f35222037", "content_id": "dfb2099fbaaca4e7754c5c8a6234e53dfaea1e55", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "SQL", "length_bytes": 12280, "license_type": "no_license", "max_line_length": 87, "num_lines": 332, "path": "/PQt5-Stock/script_db.sql", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;\nSET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;\nSET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';\n\nCREATE SCHEMA IF NOT EXISTS `db_perfumeria` DEFAULT CHARACTER SET utf8 ;\nUSE `db_perfumeria` ;\n\n-- -----------------------------------------------------\n-- Table `db_perfumeria`.`direcciones`\n-- -----------------------------------------------------\nCREATE TABLE IF NOT EXISTS `db_perfumeria`.`direcciones` (\n `iddirecciones` INT(11) NOT NULL AUTO_INCREMENT,\n `direccion` VARCHAR(100) NOT NULL,\n `numero` INT(11) NULL DEFAULT NULL,\n `piso` INT(11) NULL DEFAULT NULL,\n `dpto` VARCHAR(10) NULL DEFAULT NULL,\n PRIMARY KEY (`iddirecciones`))\nENGINE = InnoDB\nAUTO_INCREMENT = 59\nDEFAULT CHARACTER SET = utf8;\n\n\n-- -----------------------------------------------------\n-- Table `db_perfumeria`.`personas`\n-- -----------------------------------------------------\nCREATE TABLE IF NOT EXISTS `db_perfumeria`.`personas` (\n `idpersonas` INT(11) NOT NULL AUTO_INCREMENT,\n `nombre` VARCHAR(45) NOT NULL,\n `email` VARCHAR(45) NULL DEFAULT NULL,\n `direcciones_iddirecciones` INT(11) NOT NULL,\n PRIMARY KEY (`idpersonas`),\n INDEX `fk_personas_direcciones1_idx` (`direcciones_iddirecciones` ASC),\n CONSTRAINT `fk_personas_direcciones1`\n FOREIGN KEY (`direcciones_iddirecciones`)\n REFERENCES `db_perfumeria`.`direcciones` (`iddirecciones`)\n ON DELETE NO ACTION\n ON UPDATE NO ACTION)\nENGINE = InnoDB\nAUTO_INCREMENT = 60\nDEFAULT CHARACTER SET = utf8;\n\n\n-- -----------------------------------------------------\n-- Table `db_perfumeria`.`clientes`\n-- -----------------------------------------------------\nCREATE TABLE IF NOT EXISTS `db_perfumeria`.`clientes` (\n `idClientes` INT(11) NOT NULL AUTO_INCREMENT,\n `personas_idpersonas` INT(11) NOT NULL,\n `apellido` VARCHAR(45) NOT NULL,\n `estado` INT(11) NOT NULL,\n PRIMARY KEY (`idClientes`),\n INDEX `fk_clientes_personas1_idx` (`personas_idpersonas` ASC),\n CONSTRAINT `fk_clientes_personas1`\n FOREIGN KEY (`personas_idpersonas`)\n REFERENCES `db_perfumeria`.`personas` (`idpersonas`)\n ON DELETE NO ACTION\n ON UPDATE NO ACTION)\nENGINE = InnoDB\nAUTO_INCREMENT = 22\nDEFAULT CHARACTER SET = utf8;\n\n\n-- -----------------------------------------------------\n-- Table `db_perfumeria`.`proveedores`\n-- -----------------------------------------------------\nCREATE TABLE IF NOT EXISTS `db_perfumeria`.`proveedores` (\n `idproveedores` INT(11) NOT NULL AUTO_INCREMENT,\n `descripcion` VARCHAR(255) NULL DEFAULT NULL,\n `personas_idpersonas` INT(11) NOT NULL,\n `web` VARCHAR(200) NULL DEFAULT NULL,\n `estado` INT(11) NOT NULL,\n PRIMARY KEY (`idproveedores`),\n INDEX `fk_proveedores_personas1_idx` (`personas_idpersonas` ASC),\n CONSTRAINT `fk_proveedores_personas1`\n FOREIGN KEY (`personas_idpersonas`)\n REFERENCES `db_perfumeria`.`personas` (`idpersonas`)\n ON DELETE NO ACTION\n ON UPDATE NO ACTION)\nENGINE = InnoDB\nAUTO_INCREMENT = 18\nDEFAULT CHARACTER SET = utf8;\n\n\n-- -----------------------------------------------------\n-- Table `db_perfumeria`.`tipo_movimiento`\n-- -----------------------------------------------------\nCREATE TABLE IF NOT EXISTS `db_perfumeria`.`tipo_movimiento` (\n `idtipo_movimiento` INT(11) NOT NULL AUTO_INCREMENT,\n `tipo_movimiento` VARCHAR(45) NOT NULL,\n `proveedores_idproveedores` INT(11) NULL DEFAULT NULL,\n `clientes_idClientes` INT(11) NULL DEFAULT NULL,\n PRIMARY KEY (`idtipo_movimiento`),\n INDEX `fk_tipo_movimiento_proveedores1_idx` (`proveedores_idproveedores` ASC),\n INDEX `fk_tipo_movimiento_clientes1_idx` (`clientes_idClientes` ASC),\n CONSTRAINT `fk_tipo_movimiento_clientes1`\n FOREIGN KEY (`clientes_idClientes`)\n REFERENCES `db_perfumeria`.`clientes` (`idClientes`)\n ON DELETE NO ACTION\n ON UPDATE NO ACTION,\n CONSTRAINT `fk_tipo_movimiento_proveedores1`\n FOREIGN KEY (`proveedores_idproveedores`)\n REFERENCES `db_perfumeria`.`proveedores` (`idproveedores`)\n ON DELETE NO ACTION\n ON UPDATE NO ACTION)\nENGINE = InnoDB\nAUTO_INCREMENT = 313\nDEFAULT CHARACTER SET = utf8;\n\n\n-- -----------------------------------------------------\n-- Table `db_perfumeria`.`movimiento`\n-- -----------------------------------------------------\nCREATE TABLE IF NOT EXISTS `db_perfumeria`.`movimiento` (\n `idMovimiento` INT(11) NOT NULL AUTO_INCREMENT,\n `fecha` DATE NOT NULL,\n `tipo_movimiento_idtipo_movimiento` INT(11) NOT NULL,\n `estado` INT(11) NOT NULL,\n PRIMARY KEY (`idMovimiento`),\n INDEX `fk_movimiento_tipo_movimiento1_idx` (`tipo_movimiento_idtipo_movimiento` ASC),\n CONSTRAINT `fk_movimiento_tipo_movimiento1`\n FOREIGN KEY (`tipo_movimiento_idtipo_movimiento`)\n REFERENCES `db_perfumeria`.`tipo_movimiento` (`idtipo_movimiento`)\n ON DELETE NO ACTION\n ON UPDATE NO ACTION)\nENGINE = InnoDB\nAUTO_INCREMENT = 267\nDEFAULT CHARACTER SET = utf8;\n\n\n-- -----------------------------------------------------\n-- Table `db_perfumeria`.`marcas`\n-- -----------------------------------------------------\nCREATE TABLE IF NOT EXISTS `db_perfumeria`.`marcas` (\n `idmarcas` INT(11) NOT NULL AUTO_INCREMENT,\n `descripcion` VARCHAR(60) NOT NULL,\n PRIMARY KEY (`idmarcas`))\nENGINE = InnoDB\nAUTO_INCREMENT = 51\nDEFAULT CHARACTER SET = utf8;\n\n\n-- -----------------------------------------------------\n-- Table `db_perfumeria`.`rubros`\n-- -----------------------------------------------------\nCREATE TABLE IF NOT EXISTS `db_perfumeria`.`rubros` (\n `idrubros` INT(11) NOT NULL AUTO_INCREMENT,\n `descripcion` VARCHAR(45) NULL DEFAULT NULL,\n PRIMARY KEY (`idrubros`))\nENGINE = InnoDB\nAUTO_INCREMENT = 25\nDEFAULT CHARACTER SET = utf8;\n\n\n-- -----------------------------------------------------\n-- Table `db_perfumeria`.`productos`\n-- -----------------------------------------------------\nCREATE TABLE IF NOT EXISTS `db_perfumeria`.`productos` (\n `idproductos` INT(11) NOT NULL AUTO_INCREMENT,\n `nombre` VARCHAR(45) NOT NULL,\n `cantidad` INT(11) NOT NULL,\n `descripcion` VARCHAR(255) NULL DEFAULT NULL,\n `rubros_idrubros` INT(11) NOT NULL,\n `proveedores_idproveedores` INT(11) NULL DEFAULT NULL,\n `marcas_idmarcas` INT(11) NOT NULL,\n `pCompra` DOUBLE NOT NULL,\n `pVenta` DOUBLE NOT NULL,\n `estado` INT(11) NOT NULL,\n `cant_minima` INT(11) NOT NULL,\n `genero` VARCHAR(45) NULL DEFAULT NULL,\n PRIMARY KEY (`idproductos`),\n INDEX `fk_productos_rubros1_idx` (`rubros_idrubros` ASC),\n INDEX `fk_productos_proveedores1_idx` (`proveedores_idproveedores` ASC),\n INDEX `fk_productos_marcas1_idx` (`marcas_idmarcas` ASC),\n CONSTRAINT `fk_productos_marcas1`\n FOREIGN KEY (`marcas_idmarcas`)\n REFERENCES `db_perfumeria`.`marcas` (`idmarcas`)\n ON DELETE NO ACTION\n ON UPDATE NO ACTION,\n CONSTRAINT `fk_productos_proveedores1`\n FOREIGN KEY (`proveedores_idproveedores`)\n REFERENCES `db_perfumeria`.`proveedores` (`idproveedores`)\n ON DELETE NO ACTION\n ON UPDATE NO ACTION,\n CONSTRAINT `fk_productos_rubros1`\n FOREIGN KEY (`rubros_idrubros`)\n REFERENCES `db_perfumeria`.`rubros` (`idrubros`)\n ON DELETE NO ACTION\n ON UPDATE NO ACTION)\nENGINE = InnoDB\nAUTO_INCREMENT = 28\nDEFAULT CHARACTER SET = utf8;\n\n\n-- -----------------------------------------------------\n-- Table `db_perfumeria`.`detalle_movimiento`\n-- -----------------------------------------------------\nCREATE TABLE IF NOT EXISTS `db_perfumeria`.`detalle_movimiento` (\n `iddetalle_movimiento` INT(11) NOT NULL AUTO_INCREMENT,\n `cantidad` INT(11) NULL DEFAULT NULL,\n `precio_unitario` DOUBLE NULL DEFAULT NULL,\n `productos_idproductos` INT(11) NOT NULL,\n `movimiento_idMovimiento` INT(11) NOT NULL,\n PRIMARY KEY (`iddetalle_movimiento`),\n INDEX `fk_detalle_movimiento_productos1_idx` (`productos_idproductos` ASC),\n INDEX `fk_detalle_movimiento_movimiento1_idx` (`movimiento_idMovimiento` ASC),\n CONSTRAINT `fk_detalle_movimiento_movimiento1`\n FOREIGN KEY (`movimiento_idMovimiento`)\n REFERENCES `db_perfumeria`.`movimiento` (`idMovimiento`)\n ON DELETE NO ACTION\n ON UPDATE NO ACTION,\n CONSTRAINT `fk_detalle_movimiento_productos1`\n FOREIGN KEY (`productos_idproductos`)\n REFERENCES `db_perfumeria`.`productos` (`idproductos`)\n ON DELETE NO ACTION\n ON UPDATE NO ACTION)\nENGINE = InnoDB\nAUTO_INCREMENT = 336\nDEFAULT CHARACTER SET = utf8;\n\n\n-- -----------------------------------------------------\n-- Table `db_perfumeria`.`generos`\n-- -----------------------------------------------------\nCREATE TABLE IF NOT EXISTS `db_perfumeria`.`generos` (\n `idgeneros` INT(11) NOT NULL AUTO_INCREMENT,\n `descripcion` VARCHAR(45) NOT NULL,\n PRIMARY KEY (`idgeneros`))\nENGINE = InnoDB\nDEFAULT CHARACTER SET = utf8;\n\n\n-- -----------------------------------------------------\n-- Table `db_perfumeria`.`modelos`\n-- -----------------------------------------------------\nCREATE TABLE IF NOT EXISTS `db_perfumeria`.`modelos` (\n `idmodelos` INT(11) NOT NULL AUTO_INCREMENT,\n `descripcion` VARCHAR(50) NOT NULL,\n `marcas_idmarcas` INT(11) NOT NULL,\n PRIMARY KEY (`idmodelos`),\n INDEX `fk_modelos_marcas1_idx` (`marcas_idmarcas` ASC),\n CONSTRAINT `fk_modelos_marcas1`\n FOREIGN KEY (`marcas_idmarcas`)\n REFERENCES `db_perfumeria`.`marcas` (`idmarcas`)\n ON DELETE NO ACTION\n ON UPDATE NO ACTION)\nENGINE = InnoDB\nDEFAULT CHARACTER SET = utf8;\n\n\n-- -----------------------------------------------------\n-- Table `db_perfumeria`.`pagos`\n-- -----------------------------------------------------\nCREATE TABLE IF NOT EXISTS `db_perfumeria`.`pagos` (\n `idpagos` INT(11) NOT NULL AUTO_INCREMENT,\n `fecha` DATE NOT NULL,\n `monto` DOUBLE NOT NULL,\n `tipo_movimiento_idtipo_movimiento` INT(11) NOT NULL,\n PRIMARY KEY (`idpagos`),\n INDEX `fk_pagos_tipo_movimiento1_idx` (`tipo_movimiento_idtipo_movimiento` ASC),\n CONSTRAINT `fk_pagos_tipo_movimiento1`\n FOREIGN KEY (`tipo_movimiento_idtipo_movimiento`)\n REFERENCES `db_perfumeria`.`tipo_movimiento` (`idtipo_movimiento`)\n ON DELETE NO ACTION\n ON UPDATE NO ACTION)\nENGINE = InnoDB\nAUTO_INCREMENT = 37\nDEFAULT CHARACTER SET = utf8;\n\n\n-- -----------------------------------------------------\n-- Table `db_perfumeria`.`telefonos`\n-- -----------------------------------------------------\nCREATE TABLE IF NOT EXISTS `db_perfumeria`.`telefonos` (\n `idtelefono` INT(11) NOT NULL AUTO_INCREMENT,\n `numero` BIGINT(20) NOT NULL,\n `tipo` VARCHAR(45) NOT NULL,\n `personas_idpersonas` INT(11) NOT NULL,\n PRIMARY KEY (`idtelefono`),\n INDEX `fk_telefonos_personas1_idx` (`personas_idpersonas` ASC),\n CONSTRAINT `fk_telefonos_personas1`\n FOREIGN KEY (`personas_idpersonas`)\n REFERENCES `db_perfumeria`.`personas` (`idpersonas`)\n ON DELETE NO ACTION\n ON UPDATE NO ACTION)\nENGINE = InnoDB\nAUTO_INCREMENT = 57\nDEFAULT CHARACTER SET = utf8;\n\n\n-- -----------------------------------------------------\n-- Table `db_perfumeria`.`tipos`\n-- -----------------------------------------------------\nCREATE TABLE IF NOT EXISTS `db_perfumeria`.`tipos` (\n `idtipos` INT(11) NOT NULL AUTO_INCREMENT,\n `descripcion` VARCHAR(45) NOT NULL,\n `rubros_idrubros` INT(11) NOT NULL,\n PRIMARY KEY (`idtipos`),\n INDEX `fk_tipos_rubros1_idx` (`rubros_idrubros` ASC),\n CONSTRAINT `fk_tipos_rubros1`\n FOREIGN KEY (`rubros_idrubros`)\n REFERENCES `db_perfumeria`.`rubros` (`idrubros`)\n ON DELETE NO ACTION\n ON UPDATE NO ACTION)\nENGINE = InnoDB\nDEFAULT CHARACTER SET = utf8;\n\n\n-- -----------------------------------------------------\n-- Table `db_perfumeria`.`usuarios`\n-- -----------------------------------------------------\nCREATE TABLE IF NOT EXISTS `db_perfumeria`.`usuarios` (\n `idusuarios` INT(11) NOT NULL AUTO_INCREMENT,\n `tipo` VARCHAR(45) NOT NULL,\n `personas_idpersonas` INT(11) NOT NULL,\n `contraseña` VARCHAR(45) NOT NULL,\n `usuario` VARCHAR(45) NOT NULL,\n `apellido` VARCHAR(45) NOT NULL,\n PRIMARY KEY (`idusuarios`),\n INDEX `fk_usuarios_personas1_idx` (`personas_idpersonas` ASC),\n CONSTRAINT `fk_usuarios_personas1`\n FOREIGN KEY (`personas_idpersonas`)\n REFERENCES `db_perfumeria`.`personas` (`idpersonas`)\n ON DELETE NO ACTION\n ON UPDATE NO ACTION)\nENGINE = InnoDB\nAUTO_INCREMENT = 13\nDEFAULT CHARACTER SET = utf8;\n\n\nSET SQL_MODE=@OLD_SQL_MODE;\nSET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;\nSET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;\n" }, { "alpha_fraction": 0.5676532983779907, "alphanum_fraction": 0.584566593170166, "avg_line_length": 31.620689392089844, "blob_id": "de1ef865048ec2bc9e67f56fbe0c7dc23e26cacc", "content_id": "392965749935267528cde7e5ddc4096a5af9a093", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1892, "license_type": "no_license", "max_line_length": 100, "num_lines": 58, "path": "/qt/frameless.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "from PyQt5.QtWidgets import (QMessageBox, QApplication, QWidget, QToolTip, QPushButton,\n QDesktopWidget, QMainWindow, QAction, qApp, QToolBar, QVBoxLayout,\n QComboBox, QLabel, QLineEdit, QGridLayout, QMenuBar, QMenu, QStatusBar,\n QTextEdit, QDialog, QFrame, QProgressBar\n )\nfrom PyQt5 import QtCore, QtWidgets, QtGui\nfrom PyQt5.QtGui import QIcon, QFont, QPixmap, QPalette\nfrom PyQt5.QtCore import QCoreApplication, Qt, QBasicTimer, QPoint\n\nimport sys\n\n\nclass cssden(QMainWindow):\n def __init__(self):\n super().__init__()\n\n self.mwidget = QMainWindow(self)\n self.setWindowFlags(QtCore.Qt.FramelessWindowHint)\n\n # size\n self.setFixedSize(320, 450)\n self.center()\n\n # label\n self.lbl = QLabel(self)\n self.lbl.setText(\"test\")\n self.lbl.setStyleSheet(\"background-color: rgb(0,0,0);\"\n \"border: 1px solid red;\"\n \"color: rgb(255,255,255);\"\n \"font: bold italic 20pt 'Times New Roman';\")\n self.lbl.setGeometry(5, 5, 60, 40)\n\n self.oldPos = self.pos()\n\n self.show()\n\n # center\n def center(self):\n qr = self.frameGeometry()\n cp = QDesktopWidget().availableGeometry().center()\n qr.moveCenter(cp)\n self.move(qr.topLeft())\n\n def mousePressEvent(self, event):\n self.oldPos = event.globalPos()\n\n def mouseMoveEvent(self, event):\n delta = QPoint(event.globalPos() - self.oldPos)\n # print(delta)\n self.move(self.x() + delta.x(), self.y() + delta.y())\n self.oldPos = event.globalPos()\n\n\napp = QApplication(sys.argv)\n# app.setStyleSheet(\"QMainWindow{background-color: darkgray;border: 1px solid black}\")\n\nex = cssden()\nsys.exit(app.exec_())\n" }, { "alpha_fraction": 0.590847909450531, "alphanum_fraction": 0.5962315201759338, "avg_line_length": 24.620689392089844, "blob_id": "63c348735a2629c4b1cd110878165ed85dcc4f96", "content_id": "7a8b8a7e2ac4396ddbbc1f380a98a1dd0b995451", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 749, "license_type": "no_license", "max_line_length": 88, "num_lines": 29, "path": "/compras/test-api3.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import requests\n\nurltoken_hml = 'http://api-hml.gs1br.org/oauth/access-token'\nurltoken_prd = 'http://api.gs1br.org/oauth/access-token'\n\n# req = {\n# URL: 'https://{{HOST}}/oauth/access-token',\n# HOST: Homologação: 'api-hml.gs1br.org',\n# Produção:'api.gs1br.org',\n# Tipo de Requisição: \"POST\"\n# Headers: Authorization: \" Basic-Auth Username: Client_ID Password: Client_Secret\"\n# Content Type \"application/json \"\n# }\n\nheader = {\n 'Authorization': 'Basic-Auth',\n 'Username': 'ZGFkMjVkZmItNGQxMi0zYjEyLWJiNWYtOTc4ZGNhZGFiN2M3',\n 'Password': 'Njk4ZTkxMzItZjg3OS0zMjljLWFlNjEtMzc1ODBlZTAyNzY5'\n}\n\nbody = {\n \"grant_type\": \"password\",\n \"username\" : \"heavyhide@gmail.com\",\n \"password\" : \"@Extive07@\",\n}\n\nr = requests.post(urltoken_hml, data=body, headers=header)\n\nprint(r)\n" }, { "alpha_fraction": 0.6462715268135071, "alphanum_fraction": 0.6638623476028442, "avg_line_length": 27.1182804107666, "blob_id": "338f2b9f9db8c4da5d2a3464311dcb546013420e", "content_id": "3df5380ac249ba5d5538c01f539570f3df08f186", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2619, "license_type": "no_license", "max_line_length": 82, "num_lines": 93, "path": "/FullControl-SiteMon/sitemon.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import wmi\n\nc = wmi.WMI()\n# for os in c.Win32_OperatingSystem():\n# print(os)\n\n# Monitora os programas que estão sendo abertos\n# process_watcher = c.Win32_Process.watch_for(\"creation\")\n# while True:\n# new_process = process_watcher()\n# print(new_process.Caption)\n\n# Não sei o que faz\n# for service in c.Win32_Service(Name=\"seclogon\"):\n# result, = service.StopService()\n# if result == 0:\n# print(\"Service\", service.Name, \"stopped\")\n# else:\n# print(\"Some problem\")\n# break\n# else:\n# print(\"Service not found\")\n\n# Discos Fisicos\n# for disk in c.Win32_LogicalDisk([\"Caption\", \"Description\"], DriveType=3):\n# print(disk)\n\n# Discos Fisicos e de rede\n# wql = \"SELECT Caption, Description FROM Win32_LogicalDisk WHERE DriveType <> 3\"\n# for disk in c.query(wql):\n# print(disk)\n# c = wmi.WMI(privileges=[\"Security\"])\n# watcher = c.Win32_NTLogEvent.watch_for(\"creation\", 2, Type=\"error\")\n# while 1:\n# error = watcher()\n# print(\"Error in %s log: %s\" % (error.Logfile, error.Message))\n\n# # Placas de Redes e IPS\n# nic_configs = wmi.WMI().Win32_NetworkAdapterConfiguration(IPEnabled=True)\n# print(nic_configs)\n# for nic in nic_configs:\n# print(nic)\nfor interface in c.Win32_NetworkAdapterConfiguration(IPEnabled=1):\n print(interface.Description, interface.MACAddress)\n for ip_address in interface.IPAddress:\n print(ip_address)\n print()\n\n\n# Impressoras\n# for printer in c.win32_printer():\n# print(printer)\n\n# Shared Folders\nfor share in c.Win32_Share():\n print(share.Name, share.Path)\n\n# What’s running on startup and from where?\nfor s in c.Win32_StartupCommand():\n print(\"[%s] %s <%s>\" % (s.Location, s.Caption, s.Command))\n\n# # Watch for errors in the event log\n# c = wmi.WMI(privileges=[\"Security\"])\n# watcher = c.watch_for(\n# notification_type=\"Creation\",\n# wmi_class=\"Win32_NTLogEvent\",\n# Type=\"error\"\n# )\n# while 1:\n# error = watcher()\n# print(\"Error in %s log: %s\" % (error.Logfile, error.Message))\n\n\n# Show disk partitions\nfor physical_disk in c.Win32_DiskDrive():\n for partition in physical_disk.associators(\"Win32_DiskDriveToDiskPartition\"):\n for logical_disk in partition.associators(\"Win32_LogicalDiskToPartition\"):\n print(physical_disk.Caption, partition.Caption, logical_disk.Caption)\n\n\n# Find Drive Types\nDRIVE_TYPES = {\n 0: \"Unknown\",\n 1: \"No Root Directory\",\n 2: \"Removable Disk\",\n 3: \"Local Disk\",\n 4: \"Network Drive\",\n 5: \"Compact Disc\",\n 6: \"RAM Disk\"\n}\nc = wmi.WMI()\nfor drive in c.Win32_LogicalDisk():\n print(drive.Caption, DRIVE_TYPES[drive.DriveType])\n" }, { "alpha_fraction": 0.767123281955719, "alphanum_fraction": 0.767123281955719, "avg_line_length": 35.5, "blob_id": "73c7085906d4192a970c890e00aa7f393c6abeb6", "content_id": "78247a7c280fc4d66112e0ce44f10950a2e54d99", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 73, "license_type": "no_license", "max_line_length": 51, "num_lines": 2, "path": "/telegram/tel-send.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import telegram_send\ntelegram_send.send(messages=[\"Wow that was easy!\"])\n" }, { "alpha_fraction": 0.26379311084747314, "alphanum_fraction": 0.2977011501789093, "avg_line_length": 86, "blob_id": "ffc1f8a3f15a995c4f274951deb8ebbabfc3423b", "content_id": "3c5ebff745b948710b6ad49c6f2ad029c002ff4c", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1740, "license_type": "no_license", "max_line_length": 276, "num_lines": 20, "path": "/cerrado/shellreverso/teste.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "from functools import reduce\n\nprint(reduce(lambda x, y: x+y, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]))\n\n# Primes < 1000\nprint(filter(None, map(lambda y: y*reduce(lambda x, y: x*y != 0,\n map(lambda x, y=y: y % x, range(2, int(pow(y, 0.5)+1))), 1), range(2, 1000))))\n\n# First 10 Fibonacci numbers\nprint(map(lambda x, f=lambda x, f: (x <= 1) or (\n f(x-1, f)+f(x-2, f)): f(x, f), range(10)))\n\n# Mandelbrot set\nprint((lambda Ru, Ro, Iu, Io, IM, Sx, Sy: reduce(lambda x, y: x+y, map(lambda y,\n Iu=Iu, Io=Io, Ru=Ru, Ro=Ro, Sy=Sy, L=lambda yc, Iu=Iu, Io=Io, Ru=Ru, Ro=Ro, i=IM,\n Sx=Sx, Sy=Sy: reduce(lambda x, y: x+y, map(lambda x, xc=Ru, yc=yc, Ru=Ru, Ro=Ro,\n i=i, Sx=Sx, F=lambda xc, yc, x, y, k, f=lambda xc, yc, x, y, k, f: (k <= 0)or (x*x+y*y\n >= 4.0) or 1+f(xc, yc, x*x-y*y+xc, 2.0*x*y+yc, k-1, f): f(xc, yc, x, y, k, f): chr(\n 64+F(Ru+x*(Ro-Ru)/Sx, yc, 0, 0, i)), range(Sx))): L(Iu+y*(Io-Iu)/Sy), range(Sy\n ))))(-2.1, 0.7, -1.2, 1.2, 30, 80, 24))\n" }, { "alpha_fraction": 0.7349397540092468, "alphanum_fraction": 0.8072289228439331, "avg_line_length": 15.600000381469727, "blob_id": "bc01fe04fef1ae6031c9a567452d9fb8268057f6", "content_id": "6d5f2c8ea132827b5ec6fad9ef72b9b0670b6239", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "INI", "length_bytes": 83, "license_type": "no_license", "max_line_length": 20, "num_lines": 5, "path": "/fullcontrol-/database.ini", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "[postgresql]\nhost=127.0.0.1\ndatabase=fullcontrol\nuser=postgres\npassword=postgres\n" }, { "alpha_fraction": 0.5652811527252197, "alphanum_fraction": 0.5784841179847717, "avg_line_length": 25.907894134521484, "blob_id": "752285b9ffed67d9cb970507a67411e032f57405", "content_id": "654062c40e8441afcd96a76ca2af6aba932e152a", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2045, "license_type": "no_license", "max_line_length": 74, "num_lines": 76, "path": "/fullcontrol-/fc-001.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/python\nimport psycopg2\nfrom config import config\n\n\ndef connect():\n ''' Connect to the PostgreSQL database server '''\n conn = None\n try:\n # read connection parameters\n params = config()\n\n # connect to the PostgreSQL server\n print('Connecting to the PostgreSQL database...')\n conn = psycopg2.connect(**params)\n\n # create a cursor\n cur = conn.cursor()\n\n # # execute a statement\n # print('PostgreSQL database version:')\n # cur.execute('SELECT version()')\n\n # # display the PostgreSQL database server version\n # db_version = cur.fetchone()\n # print(db_version)\n\n # # close the communication with the PostgreSQL\n # cur.close()\n return conn, cur\n except (Exception, psycopg2.DatabaseError) as error:\n print(error)\n # finally:\n # if conn is not None:\n # conn.close()\n # print('Database connection closed.')\n\n\nif __name__ == '__main__':\n conn, cur = connect()\n\n print('PostgreSQL database version:')\n cur.execute('SELECT version()')\n\n # display the PostgreSQL database server version\n db_version = cur.fetchone()\n print(db_version)\n\n festrutura = open('aicup026.est', 'r')\n eestrutura = festrutura.read().replace('TABCUBO', 'aicup026').replace(\n 'CREATE TABLE', 'CREATE TABLE IF NOT EXISTS')\n\n print(eestrutura)\n\n try:\n cur.execute(eestrutura)\n print('tabela criada')\n except (Exception, psycopg2.DatabaseError) as error:\n print(error)\n\n conn.commit()\n\n i = 0\n with open('aicup026.sql', 'r', encoding=\"ISO-8859-1\") as fsql:\n esql = fsql.readline().replace('TABCUBO', 'aicup026')\n while esql:\n # print(esql)\n esql = fsql.readline().replace('TABCUBO', 'aicup026')\n try:\n cur.execute(esql)\n i += 1\n print(i)\n except (Exception, psycopg2.DatabaseError) as error:\n print(error)\n\n conn.commit()\n" }, { "alpha_fraction": 0.6131830215454102, "alphanum_fraction": 0.6183868050575256, "avg_line_length": 27.14634132385254, "blob_id": "e689c449b854da18114686497e44655e2f8f4480", "content_id": "07aa0a311de9bffb7ed560a0f5d27bc784fb9ba9", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1153, "license_type": "no_license", "max_line_length": 118, "num_lines": 41, "path": "/pyside2/ps2-005.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import sys\nfrom PySide2.QtCore import Qt\nfrom PySide2.QtWidgets import QApplication, QLabel, QWidget, QListWidget, QListWidgetItem, QPushButton, QVBoxLayout, \\\n QHBoxLayout\n\n\nclass Widget(QWidget):\n def __init__(self, parent=None):\n super(Widget, self).__init__(parent)\n\n menu_widget = QListWidget()\n for i in range(10):\n item = QListWidgetItem(\"Item {}\".format(i))\n item.setTextAlignment(Qt.AlignCenter)\n menu_widget.addItem(item)\n\n text_widget = QLabel(\"This is a placeholder text\")\n button = QPushButton(\"Something\")\n\n content_layout = QVBoxLayout()\n content_layout.addWidget(text_widget)\n content_layout.addWidget(button)\n main_widget = QWidget()\n main_widget.setLayout(content_layout)\n\n layout = QHBoxLayout()\n layout.addWidget(menu_widget, 1)\n layout.addWidget(main_widget, 4)\n self.setLayout(layout)\n\nif __name__ == \"__main__\":\n app = QApplication()\n\n w = Widget()\n w.show()\n\n with open(\"style.qss\", \"r\") as f:\n _style = f.read()\n app.setStyleSheet(_style)\n\n sys.exit(app.exec_())" }, { "alpha_fraction": 0.6707211136817932, "alphanum_fraction": 0.6768027544021606, "avg_line_length": 26.404762268066406, "blob_id": "e0a4b23295d8cbd6cba9b7708def7256c55fc88a", "content_id": "beafe6ec8c74b211fb01789f40e56f72129f2842", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1151, "license_type": "no_license", "max_line_length": 65, "num_lines": 42, "path": "/pyside2/QML/main.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/env python\n# -*- conding: utf-8 -*-\n\nimport os, sys, urllib.request, json\nimport PySide2.QtQml\nfrom PySide2.QtQuick import QQuickView\nfrom PySide2.QtCore import QStringListModel, Qt, QUrl\nfrom PySide2.QtGui import QGuiApplication\n\nif __name__ == '__main__':\n\n #get our data\n url = \"http://country.io/names.json\"\n response = urllib.request.urlopen(url)\n data = json.loads(response.read().decode('utf-8'))\n\n #Format and sort the data\n data_list = list(data.values())\n data_list.sort()\n\n #Set up the application window\n app = QGuiApplication(sys.argv)\n view = QQuickView()\n view.setResizeMode(QQuickView.SizeRootObjectToView)\n\n #Expose the list to the Qml code\n my_model = QStringListModel()\n my_model.setStringList(data_list)\n view.rootContext().setContextProperty(\"myModel\",my_model)\n\n #Load the QML file\n qml_file = os.path.join(os.path.dirname(__file__),\"view.qml\")\n view.setSource(QUrl.fromLocalFile(os.path.abspath(qml_file)))\n\n #Show the window\n if view.status() == QQuickView.Error:\n sys.exit(-1)\n view.show()\n\n #execute and cleanup\n app.exec_()\n del view\n" }, { "alpha_fraction": 0.6288524866104126, "alphanum_fraction": 0.6308196783065796, "avg_line_length": 32.173912048339844, "blob_id": "3f7dd174e3d6be295cdd244bb87be6ab85d358ce", "content_id": "4eaa4cb17a55b3677742f7c8a72b9a9996cf0a4f", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1587, "license_type": "no_license", "max_line_length": 68, "num_lines": 46, "path": "/PyQT-CRUD-App/app/tools/exitmethods.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/python3\n# -*- coding: utf-8 -*-\n\"\"\"\nДобавляем методы для подтверждения закрытия диалоговых окон\nAdicione métodos para confirmar as caixas de diálogo de fechamento\n\"\"\"\nfrom PyQt5.QtWidgets import QDialog, QMessageBox\n\nclass Dialog(QDialog):\n\n def closeEvent(self, evnt):\n msg_box = QMessageBox(self)\n msg_box.setIcon(QMessageBox.Question)\n msg_box.setWindowTitle('Notificação')\n msg_box.setText('Os dados não serão salvos.')\n msg_box.setStandardButtons(\n QMessageBox.Yes | QMessageBox.Cancel\n )\n buttonY = msg_box.button(QMessageBox.Yes)\n buttonY.setText('Sair')\n buttonN = msg_box.button(QMessageBox.Cancel)\n buttonN.setText('Cancelar')\n msg_box.exec_()\n\n if msg_box.clickedButton() == buttonY:\n QDialog.closeEvent(self, evnt)\n elif msg_box.clickedButton() == buttonN:\n evnt.ignore()\n\n def accept(self):\n msg_box = QMessageBox(self)\n msg_box.setIcon(QMessageBox.Question)\n msg_box.setWindowTitle('Notificação')\n msg_box.setText('Confirme a entrada de dados')\n msg_box.setStandardButtons(QMessageBox.Yes | QMessageBox.No)\n buttonY = msg_box.button(QMessageBox.Yes)\n buttonY.setText('Sim')\n buttonN = msg_box.button(QMessageBox.No)\n buttonN.setText('Não')\n msg_box.exec_()\n\n if msg_box.clickedButton() == buttonY:\n QDialog.accept(self)\n return True\n else:\n return False" }, { "alpha_fraction": 0.581993579864502, "alphanum_fraction": 0.6012861728668213, "avg_line_length": 31.736841201782227, "blob_id": "ab63a141317923ef9d0d93c46479d013ee8c8575", "content_id": "ed6478add4ba9e1c22d0f975cb0634e293559e89", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 622, "license_type": "no_license", "max_line_length": 129, "num_lines": 19, "path": "/fullcontrol_001/xml-dict.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import xmltodict\nimport pprint\nimport json\n\nmy_xml = \"\"\"\n <audience>\n <id what=\"attribute\">123</id>\n <name>Shubham</name>\n </audience>\n\"\"\"\nmy_dict = xmltodict.parse(my_xml)\nprint(my_dict)\n#OrderedDict([('audience', OrderedDict([('id', OrderedDict([('@what', 'attribute'), ('#text', '123')])), ('name', 'Shubham')]))])\nprint(my_dict['audience']['id'])\n#OrderedDict([('@what', 'attribute'), ('#text', '123')])\nprint(my_dict['audience']['id']['@what'])\n#attribute\nprint(my_dict)\n#OrderedDict([('audience', OrderedDict([('id', OrderedDict([('@what', 'attribute'), ('#text', '123')])), ('name', 'Shubham')]))])\n" }, { "alpha_fraction": 0.49764150381088257, "alphanum_fraction": 0.5400943160057068, "avg_line_length": 19.707317352294922, "blob_id": "4d3cfa8255fab4831168af568d4b6a5e5b9caf4f", "content_id": "4ba70eb5f730d2567b6ca33c59f72f16d7d4579c", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 848, "license_type": "no_license", "max_line_length": 71, "num_lines": 41, "path": "/full - compara relatorios/base-pandas-f.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import csv\nimport os\nimport pandas as pd\n\narq = 'b-fi-v'\n\ncomfile = open(arq + '.ori', 'r')\ncsvfile = open(arq + '.csv', 'w')\n\n\ndef tiraespaco(l):\n l = l.replace(' ', '')\n l = l.replace('.', '')\n return l\n\n\ncab = 'NOTA|VALOR'\ncsvfile.write(cab + '\\n')\nven = False\nfor l in comfile:\n if l[47:48] == '5' and l[49:50] == '/' and l[53:54] == '/':\n print(l[47:69] + '|' + l[89:102])\n csvfile.write(l[47:69] + '|' + l[89:102] + '\\n')\n\ncomfile.close()\ncsvfile.close()\n\ndf = pd.read_csv(arq + '.csv', sep='|', encoding='cp1252', decimal=',')\n\nprint(df.dtypes)\nprint(df)\n\ndf['VALOR'] = [x.replace('.', '') for x in df['VALOR']]\ndf['VALOR'] = [x.replace(',', '.') for x in df['VALOR']]\ndf['VALOR'] = [x.replace(' ', '0') for x in df['VALOR']]\ndf['VALOR'] = df['VALOR'].astype(float)\n\nprint(df.dtypes)\nprint(df)\n\nprint(sum(df.VALOR))" }, { "alpha_fraction": 0.5718660354614258, "alphanum_fraction": 0.58648282289505, "avg_line_length": 39.90657424926758, "blob_id": "469e95e217b016821cca1da4233570466a77e379", "content_id": "d0452a490938721647699f75407a4f9acae02c87", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 59186, "license_type": "no_license", "max_line_length": 176, "num_lines": 1445, "path": "/djangosige/venv/Lib/site-packages/pysignfe/nfe/processador_nfe.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n\n#from OpenSSL import crypto\nimport socket\nimport ssl\nfrom datetime import datetime\nimport time\nimport os\nfrom uuid import uuid4\n\ntry:\n from collections import OrderedDict\nexcept ImportError:\n from ordereddict import OrderedDict\n\nfrom pysignfe.corr_unicode import *\n\nfrom .webservices_flags import *\nfrom . import webservices_2\nfrom . import webservices_3\n\nfrom pysignfe.xml_sped.certificado import Certificado\n\n#\n# Manual do Contribuinte versão 4.01\n# NF-e leiaute 2.00\n#\nfrom .manual_401 import SOAPEnvio_200, SOAPRetorno_200\nfrom .manual_401 import EnviNFe_200, RetEnviNFe_200\nfrom .manual_401 import ConsReciNFe_200, RetConsReciNFe_200, ProtNFe_200, ProcNFe_200\nfrom .manual_401 import CancNFe_200, RetCancNFe_200, ProcCancNFe_200, EnvEvento_200, RetEnvEvento_200, ProcEventoNFe_200\nfrom .manual_401 import InutNFe_200, RetInutNFe_200, ProcInutNFe_200\nfrom .manual_401 import ConsSitNFe_200, RetConsSitNFe_200, ConsCad_200, RetConsCad_200\nfrom .manual_401 import ConsStatServ_200, RetConsStatServ_200\nfrom .manual_401 import EnvEventoCCe_200, RetEnvEventoCCe_200, ProcEventoNFeCCe_200\n\n#\n# Manual do Contribuinte versão 6.00\n# NF-e leiaute 3.10\n#\nfrom .manual_600 import SOAPEnvio_310, SOAPRetorno_310\nfrom .manual_600 import EnviNFe_310, RetEnviNFe_310\nfrom .manual_600 import ConsReciNFe_310, RetConsReciNFe_310, ProtNFe_310, ProcNFe_310\nfrom .manual_600 import CancNFe_310, RetCancNFe_310, ProcCancNFe_310, EventoCancNFe_310, EnvEventoCancNFe_310, RetEnvEventoCancNFe_310, ProcEventoNFeCancNFe_310\nfrom .manual_600 import InutNFe_310, RetInutNFe_310, ProcInutNFe_310\nfrom .manual_600 import ConsSitNFe_310, RetConsSitNFe_310, ConsCad_310, RetConsCad_310\nfrom .manual_600 import ConsStatServ_310, RetConsStatServ_310\nfrom .manual_600 import EventoCCe_310, EnvEventoCCe_310, RetEnvEventoCCe_310, ProcEventoNFeCCe_310\n\n\nfrom .manifestacao_destinatario import EventoConfRecebimento_100, EnvEventoConfRecebimento_100, RetEnvEventoConfRecebimento_100, ProcEventoNFeConfRecebimento_100\nfrom .manifestacao_destinatario import ConsNFeDest_101, RetConsNFeDest_101\nfrom .manifestacao_destinatario import DownloadNFe_100, RetDownloadNFe_100\nfrom .manifestacao_destinatario import TagChNFe\n\nfrom .manifestacao_destinatario import MD_OPERACAO_NAO_REALIZADA\nfrom .manifestacao_destinatario import MD_DESCEVENTO\n\n#\n# DANFE\n#\nfrom .danfe.danferetrato import *\nfrom .danfe.danfepaisagem import *\nfrom .danfe.danfce import *\n\nfrom io import StringIO\nimport pytz\n#import tempfile\n\n\nclass ProcessoNFe(object):\n def __init__(self, webservice=0, envio=u'', resposta=u''):\n self.webservice = webservice\n self.envio = envio\n self.resposta = resposta\n\n\nclass ProcessadorNFe(object):\n def __init__(self):\n self.ambiente = 2\n self.estado = u'MG'\n self.versao = u'2.00'\n self.certificado = Certificado()\n self.caminho = u''\n self.salvar_arquivos = True\n self.contingencia = False\n self.nfce = False\n self.danfe = DANFE()\n self.caminho_temporario = u''\n self.numero_tentativas_consulta_recibo = 2\n self.verificar_status_servico = True\n self.processos = []\n\n self._servidor = u''\n self._url = u''\n self._soap_envio = None\n self._soap_retorno = None\n\n def _conectar_servico(self, servico, envio, resposta, ambiente=None):\n print (' NF-e versao...', self.versao)\n print (' Conectando ao servico SEFAZ.........')\n if ambiente is None:\n ambiente = self.ambiente\n\n if self.versao == u'2.00':\n self._soap_envio = SOAPEnvio_200()\n self._soap_envio.webservice = webservices_2.METODO_WS[servico]['webservice']\n self._soap_envio.metodo = webservices_2.METODO_WS[servico]['metodo']\n self._soap_envio.cUF = UF_CODIGO[self.estado]\n self._soap_envio.envio = envio\n\n self._soap_retorno = SOAPRetorno_200()\n self._soap_retorno.webservice = webservices_2.METODO_WS[servico]['webservice']\n self._soap_retorno.metodo = webservices_2.METODO_WS[servico]['metodo']\n self._soap_retorno.resposta = resposta\n\n if not self.contingencia:\n self._servidor = webservices_2.ESTADO_WS[self.estado][ambiente][u'servidor']\n self._url = webservices_2.ESTADO_WS[self.estado][ambiente][servico]\n else:\n self._servidor = webservices_2.ESTADO_WS_CONTINGENCIA[self.estado][ambiente][u'servidor']\n self._url = webservices_2.ESTADO_WS_CONTINGENCIA[self.estado][ambiente][servico]\n\n\n if self.versao == u'3.10':\n self._soap_envio = SOAPEnvio_310()\n self._soap_envio.webservice = webservices_3.METODO_WS[servico]['webservice']\n self._soap_envio.metodo = webservices_3.METODO_WS[servico]['metodo']\n self._soap_envio.cUF = UF_CODIGO[self.estado]\n self._soap_envio.envio = envio\n\n self._soap_retorno = SOAPRetorno_310()\n self._soap_retorno.webservice = webservices_3.METODO_WS[servico]['webservice']\n self._soap_retorno.metodo = webservices_3.METODO_WS[servico]['metodo']\n self._soap_retorno.resposta = resposta\n\n if not self.contingencia:\n self._servidor = webservices_3.ESTADO_WS[self.estado][ambiente][u'servidor']\n self._url = webservices_3.ESTADO_WS[self.estado][ambiente][servico]\n else:\n self._servidor = webservices_3.ESTADO_WS_CONTINGENCIA[self.estado][ambiente][u'servidor']\n self._url = webservices_3.ESTADO_WS_CONTINGENCIA[self.estado][ambiente][servico]\n \n self.certificado.prepara_certificado_arquivo_pfx()\n\n #\n # Salva o certificado e a chave privada para uso na conexão HTTPS\n # Salvamos como um arquivo de nome aleatório para evitar o conflito\n # de uso de vários certificados e chaves diferentes na mesma máquina\n # ao mesmo tempo\n #\n self.caminho_temporario = self.caminho_temporario or u'/tmp/'\n\n\n nome_arq_chave = self.caminho_temporario + uuid4().hex\n arq_tmp = open(nome_arq_chave, 'w')\n arq_tmp.write(self.certificado.chave)\n arq_tmp.close()\n\n nome_arq_certificado = self.caminho_temporario + uuid4().hex\n arq_tmp = open(nome_arq_certificado, 'w')\n arq_tmp.write(self.certificado.certificado)\n arq_tmp.close()\n \n print(\" servidor: \", self._servidor)\n print(\" url: \", self._url)\n from http.client import HTTPSConnection\n con = HTTPSConnection(self._servidor, key_file=nome_arq_chave, cert_file=nome_arq_certificado)\n #con = ConexaoHTTPS(self._servidor, key_file=nome_arq_chave, cert_file=nome_arq_certificado)\n con.request(u'POST', u'/' + self._url, self._soap_envio.xml.encode(u'utf-8'), self._soap_envio.header)\n resp = con.getresponse()\n\n #\n # Apagamos os arquivos do certificado e o da chave privada, para evitar\n # um potencial risco de segurança; muito embora o uso da chave privada\n # para assinatura exija o uso da senha, pode haver serviços que exijam\n # apenas o uso do certificado para validar a identidade, independente\n # da existência de assinatura digital\n #\n os.remove(nome_arq_chave)\n os.remove(nome_arq_certificado)\n\n # Dados da resposta salvos para possível debug\n self._soap_retorno.resposta.version = resp.version\n self._soap_retorno.resposta.status = resp.status\n #self._soap_retorno.resposta.reason = unicode(resp.reason.decode('utf-8'))\n self._soap_retorno.resposta.reason = unicode(resp.reason)\n self._soap_retorno.resposta.msg = resp.msg\n self._soap_retorno.resposta.original = unicode(resp.read().decode('utf-8'))\n print ('STATUS__-', self._soap_retorno.resposta.original)\n # Tudo certo!\n if self._soap_retorno.resposta.status == 200:\n self._soap_retorno.xml = self._soap_retorno.resposta.original\n print (15*'==')\n print (self._soap_retorno.xml)\n print (15*'==')\n con.close()\n\n def enviar_lote(self, numero_lote=None, lista_nfes=[]):\n novos_arquivos = []\n\n if self.versao == u'2.00':\n envio = EnviNFe_200()\n resposta = RetEnviNFe_200()\n webservice = WS_NFE_ENVIO_LOTE\n elif self.versao == u'3.10':\n envio = EnviNFe_310()\n resposta = RetEnviNFe_310()\n webservice = WS_NFE_AUTORIZACAO\n\n processo = ProcessoNFe(webservice=webservice, envio=envio, resposta=resposta)\n\n #\n # Vamos assinar e validar todas as NF-e antes da transmissão, evitando\n # rejeição na SEFAZ por incorreção no schema dos arquivos\n #\n for nfe in lista_nfes:\n self.certificado.assina_xmlnfe(nfe)\n nfe.validar()\n\n envio.NFe = lista_nfes\n\n envio.idLote.valor = numero_lote\n envio.validar()\n \n if self.salvar_arquivos:\n for n in lista_nfes:\n n.monta_chave()\n novo_arquivo_nome = n.chave + u'-nfe.xml'\n novo_arquivo = n.xml.encode('utf-8')\n novos_arquivos.append((novo_arquivo_nome, novo_arquivo))\n\n novo_arquivo_nome = unicode(envio.idLote.valor).strip().rjust(15, u'0') + u'-env-lot.xml'\n novo_arquivo = envio.xml.encode('utf-8')\n novos_arquivos.append((novo_arquivo_nome, novo_arquivo))\n \n self._conectar_servico(webservice, envio, resposta)\n \n if self.salvar_arquivos:\n novo_arquivo_nome = unicode(envio.idLote.valor).strip().rjust(15, u'0') + u'-rec'\n\n if resposta.cStat.valor == u'103':\n novo_arquivo_nome += u'.xml'\n else:\n novo_arquivo_nome += u'-rej.xml'\n\n novo_arquivo = resposta.xml.encode('utf-8')\n novos_arquivos.append((novo_arquivo_nome, novo_arquivo))\n \n self.salvar_novos_arquivos(novos_arquivos=novos_arquivos)\n\n return processo\n\n def consultar_recibo(self, ambiente=None, numero_recibo=None):\n novos_arquivos = []\n\n if self.versao == u'2.00':\n envio = ConsReciNFe_200()\n resposta = RetConsReciNFe_200()\n webservice = WS_NFE_CONSULTA_RECIBO\n elif self.versao == u'3.10':\n envio = ConsReciNFe_310()\n resposta = RetConsReciNFe_310()\n webservice = WS_NFE_RET_AUTORIZACAO\n\n processo = ProcessoNFe(webservice=webservice, envio=envio, resposta=resposta)\n \n if ambiente is None:\n ambiente = self.ambiente\n\n envio.tpAmb.valor = ambiente\n envio.nRec.valor = numero_recibo\n\n envio.validar()\n if self.salvar_arquivos:\n novo_arquivo_nome = unicode(envio.nRec.valor).strip().rjust(15, u'0') + u'-ped-rec.xml'\n novo_arquivo = envio.xml.encode('utf-8')\n novos_arquivos.append((novo_arquivo_nome, novo_arquivo))\n\n self._conectar_servico(webservice, envio, resposta, ambiente)\n \n if self.salvar_arquivos:\n novo_arquivo_nome = unicode(envio.nRec.valor).strip().rjust(15, u'0') + u'-pro-rec'\n\n if resposta.cStat.valor == u'104':\n novo_arquivo_nome += u'.xml'\n else:\n novo_arquivo_nome += u'-rej.xml'\n\n novo_arquivo = resposta.xml.encode('utf-8')\n novos_arquivos.append((novo_arquivo_nome, novo_arquivo))\n \n caminho_original = self.caminho\n if len(resposta.protNFe):\n self.caminho = self.monta_caminho_nfe(ambiente=ambiente, chave_nfe=resposta.protNFe[0].infProt.chNFe.valor, dir='Recibos')\n else:\n self.caminho = self.monta_caminho_nfe(ambiente=ambiente, dir='Recibos', data=datetime.now().strftime('%Y-%m'))\n self.salvar_novos_arquivos(novos_arquivos=novos_arquivos)\n self.caminho = caminho_original\n \n del novos_arquivos[:]\n\n #\n # Salvar os resultados dos processamentos\n #\n for pn in resposta.protNFe:\n novo_arquivo_nome = unicode(pn.infProt.chNFe.valor).strip().rjust(44, u'0') + u'-pro-nfe-'\n dir = ''\n # NF-e autorizada\n if pn.infProt.cStat.valor == u'100':\n novo_arquivo_nome += u'aut.xml'\n dir = 'NFeAutorizada'\n\n # NF-e denegada\n elif pn.infProt.cStat.valor in (u'110', u'301', u'302', u'303'):\n novo_arquivo_nome += u'den.xml'\n dir = 'NFeDenegada'\n \n # NF-e rejeitada\n else:\n novo_arquivo_nome += u'rej.xml'\n dir = 'NFeRejeitada'\n\n novo_arquivo = pn.xml.encode('utf-8')\n novos_arquivos.append((novo_arquivo_nome, novo_arquivo))\n #novos_arquivos.append(('status_resp', (pn.infProt.cStat.valor,pn.infProt.xMotivo.valor)))\n \n caminho_original = self.caminho\n self.caminho = self.monta_caminho_nfe(ambiente=ambiente, chave_nfe=pn.infProt.chNFe.valor, dir=dir)\n self.salvar_novos_arquivos(novos_arquivos=novos_arquivos)\n self.caminho = caminho_original\n \n return processo\n\n def consultar_notas_destinatario(self, cnpj=None, ambiente=None, indnfe=None, indemi=None, nsu='0'):\n novos_arquivos = []\n\n envio = ConsNFeDest_101()\n resposta = RetConsNFeDest_101()\n\n processo = ProcessoNFe(webservice=WS_NFE_CONSULTA_DESTINATARIO, envio=envio, resposta=resposta)\n\n if ambiente is None:\n ambiente = self.ambiente\n\n self.caminho = self.monta_caminho_nfe_cnpj(ambiente=ambiente, cnpj=cnpj, dir='NFeDestinada')\n \n #evento\n envio.tpAmb.valor = ambiente\n envio.CNPJ.valor = cnpj\n envio.indNFe.valor = indnfe\n envio.indEmi.valor = indemi\n envio.ultNSU.valor = nsu\n\n self.certificado.prepara_certificado_arquivo_pfx()\n\n envio.validar()\n \n nome_arq = datetime.now().strftime('%Y%m%d%H%M%S')\n \n if self.salvar_arquivos:\n novo_arquivo_nome = nome_arq + u'-env-consnfedest.xml'\n novo_arquivo = envio.xml.encode('utf-8')\n novos_arquivos.append((novo_arquivo_nome, novo_arquivo))\n \n self._conectar_servico(WS_NFE_CONSULTA_DESTINATARIO, envio, resposta, ambiente)\n \n if self.salvar_arquivos:\n novo_arquivo_nome = nome_arq + u'-consnfedest'\n \n #137 - Nenhum documento localizado para o destinatário\n #138 - Documento localizado para o destinatário\n if resposta.cStat.valor in (u'137', u'138'):\n novo_arquivo_nome += u'.xml'\n else:\n novo_arquivo_nome += u'-rej.xml'\n \n novo_arquivo = resposta.xml.encode('utf-8')\n novos_arquivos.append((novo_arquivo_nome, novo_arquivo))\n self.salvar_novos_arquivos(novos_arquivos=novos_arquivos)\n\n return processo\n\n\n def download_nfes(self, cnpj=None,ambiente=None, lista_chaves=[]):\n novos_arquivos = []\n #if self.versao == u'2.00':\n envio = DownloadNFe_100()\n resposta = RetDownloadNFe_100()\n\n processo = ProcessoNFe(webservice=WS_NFE_DOWNLOAD_XML_DESTINATARIO, envio=envio, resposta=resposta)\n\n if ambiente is None:\n ambiente = self.ambiente\n\n self.caminho = self.monta_caminho_nfe_cnpj(ambiente=ambiente, cnpj=cnpj, dir='NFeDownload')\n \n #evento\n envio.tpAmb.valor = ambiente\n envio.CNPJ.valor = cnpj\n #envio.chNFe.valor = chave_nfe\n envio.chNFe = [TagChNFe(valor=ch) for ch in lista_chaves] \n envio.xServ.valor = u'DOWNLOAD NFE'\n\n self.certificado.prepara_certificado_arquivo_pfx()\n\n envio.validar()\n \n nome_arq = datetime.now().strftime('%Y%m%d%H%M%S')\n \n #Nome do arquivo será a data e hora atual\n if self.salvar_arquivos:\n novo_arquivo_nome = nome_arq + u'-env-downloadnfe.xml'\n novo_arquivo = envio.xml.encode('utf-8')\n novos_arquivos.append((novo_arquivo_nome, novo_arquivo))\n \n self._conectar_servico(WS_NFE_DOWNLOAD_XML_DESTINATARIO, envio, resposta, ambiente)\n \n if self.salvar_arquivos:\n novo_arquivo_nome = nome_arq + u'-downloadnfe'\n \n #139 - Pedido de Download processado\n if resposta.cStat.valor == u'139':\n novo_arquivo_nome += u'.xml'\n else:\n novo_arquivo_nome += u'-rej.xml'\n \n novo_arquivo = resposta.xml.encode('utf-8')\n novos_arquivos.append((novo_arquivo_nome, novo_arquivo))\n self.salvar_novos_arquivos(novos_arquivos=novos_arquivos)\n\n return processo\n\n def consultar_cadastro_contribuinte(self, cpf_cnpj=None, inscricao_estadual=None, ambiente=None):\n novos_arquivos = []\n if self.versao == u'2.00':\n envio = ConsCad_200()\n resposta = RetConsCad_200()\n elif self.versao == u'3.10':\n envio = ConsCad_310()\n resposta = RetConsCad_310()\n\n processo = ProcessoNFe(webservice=WS_NFE_CONSULTA_CADASTRO, envio=envio, resposta=resposta)\n\n if ambiente is None:\n ambiente = self.ambiente\n \n envio.infCons.UF.valor = self.estado\n\n if inscricao_estadual:\n envio.infCons.IE.valor = inscricao_estadual\n nome = 'IE_' + inscricao_estadual\n elif len(cpf_cnpj) == 11:\n envio.infCons.CPF.valor = cpf_cnpj\n nome = 'CPF_' + cpf_cnpj\n elif len(cpf_cnpj) == 14:\n envio.infCons.CNPJ.valor = cpf_cnpj\n nome = 'CNPJ_' + cpf_cnpj\n envio.validar()\n \n if self.salvar_arquivos:\n novo_arquivo_nome = nome + u'-cons-cad.xml'\n novo_arquivo = envio.xml.encode('utf-8')\n novos_arquivos.append((novo_arquivo_nome, novo_arquivo))\n\n self._conectar_servico(WS_NFE_CONSULTA_CADASTRO, envio, resposta, 1)\n \n if self.salvar_arquivos:\n novo_arquivo_nome = nome + u'-cad.xml'\n novo_arquivo = resposta.xml.encode('utf-8')\n novos_arquivos.append((novo_arquivo_nome, novo_arquivo))\n \n caminho_original = self.caminho\n self.caminho = self.caminho + u'ArquivosXML/NFe/ConsultaCadastro/'\n \n self.salvar_novos_arquivos(novos_arquivos=novos_arquivos)\n self.caminho = caminho_original\n \n return processo\n \n def enviar_lote_evento(self, tipo_evento, lista_eventos=[], numero_lote=None):\n \n novos_arquivos = []\n #\n # Determina o tipo do evento\n #\n dir = ''\n if tipo_evento == 'cce':\n classe_evento = ProcEventoNFeCCe_310\n envio = EnvEventoCCe_310()\n resposta = RetEnvEventoCCe_310()\n dir = 'Eventos/Correcao'\n elif tipo_evento == 'can':\n classe_evento = ProcEventoNFeCancNFe_310\n envio = EnvEventoCancNFe_310()\n resposta = RetEnvEventoCancNFe_310()\n dir = 'Eventos/Cancelamento'\n elif tipo_evento == 'confrec':\n classe_evento = ProcEventoNFeConfRecebimento_100\n envio = EnvEventoConfRecebimento_100()\n resposta = RetEnvEventoConfRecebimento_100()\n dir = 'Eventos/Manifestacao'\n \n processo = ProcessoNFe(webservice=WS_NFE_EVENTO, envio=envio, resposta=resposta)\n \n self.certificado.prepara_certificado_arquivo_pfx()\n #Assinar cada evento\n for evento in lista_eventos:\n self.certificado.assina_xmlnfe(evento)\n \n envio.evento = lista_eventos\n \n if numero_lote is None:\n numero_lote = datetime.now().strftime('%Y%m%d%H%M%S')\n\n envio.idLote.valor = numero_lote\n \n envio.validar()\n \n ambiente = lista_eventos[0].infEvento.tpAmb.valor or self.ambiente\n self.caminho = self.monta_caminho_nfe(ambiente=ambiente, chave_nfe=lista_eventos[0].infEvento.chNFe.valor, dir=dir)\n \n ##Salvar arquivo unico\n if self.salvar_arquivos:\n novo_arquivo_nome = unicode(envio.idLote.valor).strip().rjust(15, '0') + u'-env-' + tipo_evento +'.xml'\n novo_arquivo = envio.xml.encode('utf-8')\n novos_arquivos.append((novo_arquivo_nome, novo_arquivo))\n \n self._conectar_servico(WS_NFE_EVENTO, envio, resposta)\n \n if self.salvar_arquivos:\n novo_arquivo_nome = unicode(envio.idLote.valor).strip().rjust(15, '0') + '-rec-' + tipo_evento\n\n if resposta.cStat.valor != '128':\n novo_arquivo_nome += u'-rej.xml'\n else:\n novo_arquivo_nome += u'.xml'\n\n novo_arquivo = resposta.xml.encode('utf-8')\n novos_arquivos.append((novo_arquivo_nome, novo_arquivo))\n \n self.montar_processo_lista_eventos(lista_eventos, processo.resposta.dic_retEvento, processo.resposta.dic_procEvento, classe_evento)\n \n self.salvar_processamento_eventos(processo=processo, ret_eventos=resposta.retEvento, tipo_evento=tipo_evento)\n \n self.salvar_novos_arquivos(novos_arquivos=novos_arquivos)\n \n return processo\n \n def montar_processo_lista_eventos(self, lista_eventos, dic_retEvento, dic_procEvento, classe_procEvento):\n for evento in lista_eventos:\n chave = evento.infEvento.chNFe.valor\n if chave in dic_retEvento:\n retorno = dic_retEvento[chave]\n processo = classe_procEvento()\n processo.evento = evento\n processo.retEvento = retorno\n dic_procEvento[chave] = processo\n \n\n def cancelar_nota(self, ambiente=None, chave_nfe=None, numero_protocolo=None,\n justificativa=None, data=None, numero_lote=None):\n \n evento = EventoCancNFe_310()\n evento.infEvento.tpAmb.valor = ambiente or self.ambiente\n evento.infEvento.cOrgao.valor = UF_CODIGO[self.estado]\n evento.infEvento.CNPJ.valor = chave_nfe[6:20] # Extrai o CNPJ da própria chave da NF-e\n evento.infEvento.chNFe.valor = chave_nfe\n evento.infEvento.dhEvento.valor = data or datetime.now()\n evento.infEvento.detEvento.nProt.valor = numero_protocolo\n evento.infEvento.detEvento.xJust.valor = justificativa\n \n processo = self.enviar_lote_evento(tipo_evento='can', lista_eventos=[evento], numero_lote=numero_lote)\n return processo\n \n def corrigir_nota(self, chave_nfe=None, texto_correcao=None, ambiente=None,\n sequencia=None, data=None, numero_lote=None):\n \n evento = EventoCCe_310()\n evento.infEvento.tpAmb.valor = ambiente or self.ambiente\n evento.infEvento.cOrgao.valor = UF_CODIGO[self.estado]\n evento.infEvento.CNPJ.valor = chave_nfe[6:20] # Extrai o CNPJ da própria chave da NF-e\n evento.infEvento.chNFe.valor = chave_nfe\n evento.infEvento.dhEvento.valor = data or datetime.now()\n evento.infEvento.detEvento.xCorrecao.valor = texto_correcao\n evento.infEvento.nSeqEvento.valor = sequencia or 1\n\n processo = self.enviar_lote_evento(tipo_evento='cce', lista_eventos=[evento], numero_lote=numero_lote)\n return processo\n \n def efetuar_manifesto_destinatario(self, tipo_manifesto, cnpj=None, chave_nfe=None, ambiente=None, data=None, numero_lote=None, ambiente_nacional=True, justificativa=None):\n \n evento = EventoConfRecebimento_100()\n evento.infEvento.tpAmb.valor = ambiente or self.ambiente\n if ambiente_nacional:\n evento.infEvento.cOrgao.valor = UF_CODIGO['NACIONAL']\n else:\n evento.infEvento.cOrgao.valor = UF_CODIGO[self.estado]\n \n evento.infEvento.CNPJ.valor = cnpj\n evento.infEvento.chNFe.valor = chave_nfe\n evento.infEvento.dhEvento.valor = data or datetime.now()\n evento.infEvento.tpEvento.valor = tipo_manifesto\n evento.infEvento.detEvento.descEvento.valor = MD_DESCEVENTO[tipo_manifesto]\n \n if justificativa and tipo_manifesto==MD_OPERACAO_NAO_REALIZADA:\n evento.infEvento.detEvento.xJust.valor = justificativa\n\n processo = self.enviar_lote_evento(tipo_evento='confrec', lista_eventos=[evento], numero_lote=numero_lote)\n return processo\n \n def inutilizar_nota(self, ambiente=None, codigo_estado=None, ano=None, cnpj=None, serie=None,\n numero_inicial=None, numero_final=None, justificativa=None, nfce=False):\n novos_arquivos = []\n\n if self.versao == u'2.00':\n envio = InutNFe_200()\n resposta = RetInutNFe_200()\n elif self.versao == u'3.10':\n envio = InutNFe_310()\n resposta = RetInutNFe_310()\n\n processo = ProcessoNFe(webservice=WS_NFE_INUTILIZACAO, envio=envio, resposta=resposta)\n\n if ambiente is None:\n ambiente = self.ambiente\n\n if codigo_estado is None:\n codigo_estado = UF_CODIGO[self.estado]\n\n if ano is None:\n ano = datetime.now().strftime(u'%y')\n\n if not numero_final:\n numero_final = numero_inicial\n\n self.caminho = self.monta_caminho_inutilizacao(ambiente=ambiente, serie=serie,\n numero_inicial=numero_inicial, numero_final=numero_final)\n\n envio.infInut.tpAmb.valor = ambiente\n envio.infInut.cUF.valor = codigo_estado\n envio.infInut.ano.valor = ano\n envio.infInut.CNPJ.valor = cnpj\n if self.nfce:\n envio.infInut.mod.valor = 65\n else:\n envio.infInut.mod.valor = 55\n envio.infInut.serie.valor = serie\n envio.infInut.nNFIni.valor = numero_inicial\n envio.infInut.nNFFin.valor = numero_final\n envio.infInut.xJust.valor = justificativa\n\n envio.gera_nova_chave()\n self.certificado.prepara_certificado_arquivo_pfx()\n self.certificado.assina_xmlnfe(envio)\n\n envio.validar()\n \n if self.salvar_arquivos:\n nome_arq = envio.chave[0:2] + ano + cnpj + unicode(envio.infInut.mod.valor) + serie + numero_inicial + numero_final\n novo_arquivo_nome = nome_arq + u'-ped-inu.xml'\n novo_arquivo = envio.xml.encode('utf-8')\n novos_arquivos.append((novo_arquivo_nome, novo_arquivo))\n \n self._conectar_servico(WS_NFE_INUTILIZACAO, envio, resposta, ambiente)\n\n # Se for autorizada, monta o processo de inutilização\n if resposta.infInut.cStat.valor == u'102':\n if self.versao == u'2.00':\n processo_inutilizacao_nfe = ProcInutNFe_200()\n\n elif self.versao == u'3.10':\n processo_inutilizacao_nfe = ProcInutNFe_310()\n\n processo_inutilizacao_nfe.inutNFe = envio\n processo_inutilizacao_nfe.retInutNFe = resposta\n\n processo_inutilizacao_nfe.validar()\n\n processo.processo_inutilizacao_nfe = processo_inutilizacao_nfe\n \n\n if self.salvar_arquivos:\n nome_arq = ano + cnpj + unicode(envio.infInut.mod.valor) + serie + numero_inicial + numero_final\n novo_arquivo_nome = nome_arq + u'-pro-inu-'\n\n # Inutilização autorizada\n if resposta.infInut.cStat.valor == u'102':\n novo_arquivo_nome += u'aut.xml'\n else:\n novo_arquivo_nome += u'rej.xml'\n\n novo_arquivo = resposta.xml.encode('utf-8')\n novos_arquivos.append((novo_arquivo_nome, novo_arquivo))\n\n # Se for autorizada, monta o processo de inutilização\n if resposta.infInut.cStat.valor == u'102':\n #novo_arquivo_nome = nome_arq + u'-proc-inu-nfe.xml'\n #novo_arquivo = processo_inutilizacao_nfe.xml.encode('utf-8')\n #novos_arquivos.append((novo_arquivo_nome, novo_arquivo))\n\n novo_arquivo_nome = nome_arq + u'-inu.xml'\n novo_arquivo = processo_inutilizacao_nfe.xml.encode('utf-8')\n novos_arquivos.append((novo_arquivo_nome, novo_arquivo))\n \n self.salvar_novos_arquivos(novos_arquivos=novos_arquivos)\n \n return processo\n\n def consultar_nota(self, ambiente=None, chave_nfe=None, nfe=None):\n novos_arquivos = []\n\n if self.versao == u'2.00':\n envio = ConsSitNFe_200()\n resposta = RetConsSitNFe_200()\n elif self.versao == u'3.10':\n envio = ConsSitNFe_310()\n resposta = RetConsSitNFe_310()\n\n processo = ProcessoNFe(webservice=WS_NFE_CONSULTA, envio=envio, resposta=resposta)\n\n if ambiente is None:\n ambiente = self.ambiente\n\n envio.tpAmb.valor = ambiente\n envio.chNFe.valor = chave_nfe\n \n envio.validar()\n \n if self.salvar_arquivos:\n novo_arquivo_nome = unicode(chave_nfe).strip().rjust(44, u'0') + u'-ped-sit.xml'\n novo_arquivo = envio.xml.encode('utf-8')\n novos_arquivos.append((novo_arquivo_nome, novo_arquivo))\n \n\n self._conectar_servico(WS_NFE_CONSULTA, envio, resposta, ambiente)\n \n if self.salvar_arquivos:\n novo_arquivo_nome = unicode(chave_nfe).strip().rjust(44, u'0') + u'-sit.xml'\n novo_arquivo = resposta.xml.encode('utf-8')\n novos_arquivos.append((novo_arquivo_nome, novo_arquivo))\n \n caminho_original = self.caminho\n self.caminho = self.monta_caminho_nfe(ambiente, chave_nfe, 'NFeSituacao')\n \n self.salvar_novos_arquivos(novos_arquivos=novos_arquivos)\n self.caminho = caminho_original\n \n return processo\n\n def consultar_servico(self, ambiente=None, codigo_estado=None):\n\n novos_arquivos = []\n\n if self.versao == u'2.00':\n envio = ConsStatServ_200()\n resposta = RetConsStatServ_200()\n elif self.versao == u'3.10':\n envio = ConsStatServ_310()\n resposta = RetConsStatServ_310()\n\n processo = ProcessoNFe(webservice=WS_NFE_SITUACAO, envio=envio, resposta=resposta)\n\n if ambiente is None:\n ambiente = self.ambiente\n\n if codigo_estado is None:\n codigo_estado = UF_CODIGO[self.estado]\n\n envio.tpAmb.valor = ambiente\n envio.cUF.valor = codigo_estado\n envio.data = datetime.now()\n\n envio.validar()\n \n if self.salvar_arquivos:\n novo_arquivo_nome = envio.data.strftime(u'%Y-%m-%dT%H%M%S') + u'-ped-sta.xml'\n novo_arquivo = envio.xml.encode('utf-8')\n novos_arquivos.append((novo_arquivo_nome, novo_arquivo))\n\n self._conectar_servico(WS_NFE_SITUACAO, envio, resposta, ambiente)\n \n if self.salvar_arquivos:\n novo_arquivo_nome = envio.data.strftime(u'%Y-%m-%dT%H%M%S') + u'-sta.xml'\n novo_arquivo = resposta.xml.encode('utf-8')\n novos_arquivos.append((novo_arquivo_nome, novo_arquivo))\n \n caminho_original = self.caminho\n self.caminho = self.caminho + u'ArquivosXML/NFe/ConsultaStatusServidorNFe/'\n \n self.salvar_novos_arquivos(novos_arquivos=novos_arquivos)\n self.caminho = caminho_original\n \n return processo\n \n def gerar_xml(self, lista_nfes, numero_lote=None):\n novos_arquivos = []\n \n nfe = lista_nfes[0]\n nfe.monta_chave()\n ambiente = nfe.infNFe.ide.tpAmb.valor\n \n caminho_original = self.caminho\n self.caminho = self.monta_caminho_nfe(ambiente=nfe.infNFe.ide.tpAmb.valor, chave_nfe=nfe.chave, dir='Lotes')\n \n if self.versao == u'2.00':\n envio = EnviNFe_200()\n elif self.versao == u'3.10':\n envio = EnviNFe_310()\n \n processo = ProcessoNFe(envio=envio)\n \n self.certificado.prepara_certificado_arquivo_pfx()\n \n for nfe in lista_nfes:\n self.certificado.assina_xmlnfe(nfe)\n nfe.validar()\n\n envio.NFe = lista_nfes\n envio.idLote.valor = numero_lote\n envio.validar()\n \n if self.salvar_arquivos:\n for n in lista_nfes:\n n.monta_chave()\n novo_arquivo_nome = n.chave + u'-nfe.xml'\n novo_arquivo = n.xml.encode('utf-8')\n novos_arquivos.append((novo_arquivo_nome, novo_arquivo))\n \n ##Nao salva o lote, apenas NF-es\n #novo_arquivo_nome = unicode(envio.idLote.valor).strip().rjust(15, u'0') + u'-env-lot.xml'\n #novo_arquivo = envio.xml.encode('utf-8')\n #novos_arquivos.append((novo_arquivo_nome, novo_arquivo))\n \n self.salvar_novos_arquivos(novos_arquivos=novos_arquivos)\n \n return processo\n \n def processar_notas(self, lista_nfes, numero_lote=None):\n #\n # Definir o caminho geral baseado na 1ª NF-e\n #\n self.processos = processos = OrderedDict()\n novos_arquivos = []\n\n caminho_original = self.caminho\n nfe = lista_nfes[0]\n nfe.monta_chave()\n #self.caminho = caminho_original\n ambiente = nfe.infNFe.ide.tpAmb.valor\n #self.caminho = self.monta_caminho_nfe(ambiente=nfe.infNFe.ide.tpAmb.valor, chave_nfe=nfe.chave)\n status_serv = u'107'\n if self.verificar_status_servico:\n proc_servico = self.consultar_servico(ambiente=ambiente)\n yield proc_servico\n status_serv = proc_servico.resposta.cStat.valor\n \n #Servico em operacao (status == 107)\n if status_serv == u'107':\n #\n # Verificar se as notas já não foram emitadas antes\n #\n for nfe in lista_nfes:\n nfe.monta_chave()\n self.caminho = caminho_original\n proc_consulta = self.consultar_nota(ambiente=nfe.infNFe.ide.tpAmb.valor, chave_nfe=nfe.chave)\n yield proc_consulta\n\n #\n # Se a nota já constar na SEFAZ\n #\n if (\n ((self.versao == '1.10') and (proc_consulta.resposta.infProt.cStat.valor in ('217', '999',)))\n or\n ((self.versao in ['2.00', '3.10']) and (proc_consulta.resposta.cStat.valor in ('100', '150', '110', '301', '302')))\n ):\n #\n # Interrompe todo o processo\n #\n return\n\n #\n # Nenhuma das notas estava já enviada, enviá-las então\n #\n nfe = lista_nfes[0]\n nfe.monta_chave()\n self.caminho = caminho_original\n #self.caminho = self.monta_caminho_nfe(ambiente=nfe.infNFe.ide.tpAmb.valor, chave_nfe=nfe.chave)\n self.caminho = self.monta_caminho_nfe(ambiente=nfe.infNFe.ide.tpAmb.valor, chave_nfe=nfe.chave, dir='Lotes')\n proc_envio = self.enviar_lote(lista_nfes=lista_nfes, numero_lote=numero_lote)\n yield proc_envio\n self.caminho = caminho_original\n \n ret_envi_nfe = proc_envio.resposta\n\n #\n # Deu certo?\n #\n if ret_envi_nfe.cStat.valor == u'103':\n print(\" Lote enviado com sucesso. Consultando recibo...\")\n t_espera = ret_envi_nfe.infRec.tMed.valor\n #Alguns webservices exageram no tempo de espera.\n if t_espera > 10:\n t_espera = 6\n time.sleep(t_espera * 2) # Espere o processamento antes de consultar o recibo\n proc_recibo = self.consultar_recibo(ambiente=ret_envi_nfe.tpAmb.valor, numero_recibo=ret_envi_nfe.infRec.nRec.valor)\n \n tentativa = 0\n while proc_recibo.resposta.cStat.valor == u'105' and tentativa < self.numero_tentativas_consulta_recibo:\n time.sleep(t_espera * 2) # Espere o processamento antes de consultar o recibo\n proc_recibo = self.consultar_recibo(ambiente=ret_envi_nfe.tpAmb.valor, numero_recibo=ret_envi_nfe.infRec.nRec.valor)\n tentativa += 1\n yield proc_recibo\n \n # Montar os processos das NF-es\n dic_protNFe = proc_recibo.resposta.dic_protNFe\n dic_procNFe = proc_recibo.resposta.dic_procNFe\n \n self.caminho = caminho_original\n novos_processos = self.montar_processo_lista_notas(lista_nfes, dic_protNFe, dic_procNFe)\n for i,novo_processo in enumerate(novos_processos):\n processos['nota_%i' % i] = novo_processo\n \n return\n\n def montar_processo_lista_notas(self, lista_nfes, dic_protNFe, dic_procNFe):\n processos = []\n for nfe in lista_nfes:\n #if dic_protNFe.has_key(nfe.chave):\n if nfe.chave in dic_protNFe:\n protocolo = dic_protNFe[nfe.chave]\n processo = self.montar_processo_uma_nota(nfe, protnfe_recibo=protocolo)\n processos.append(processo)\n \n if processo is not None:\n dic_procNFe[nfe.chave] = processo\n return processos\n \n def montar_processo_uma_nota(self, nfe, protnfe_recibo=None, protnfe_consulta_110=None, retcancnfe=None):\n novos_arquivos = []\n \n processo = None\n dir = ''\n \n if self.versao == u'2.00':\n processo = ProcNFe_200()\n elif self.versao == u'3.10':\n processo = ProcNFe_310()\n \n processo.NFe = nfe\n processo.protNFe = protnfe_recibo\n \n # 100 - autorizada\n # 150 - autorizada fora do prazo\n # 110 - denegada\n # 301 - denegada por irregularidade do emitente\n # 302 - denegada por irregularidade do destinatário\n # 303 - Uso Denegado: Destinatário não habilitado a operar na UF\n if self.salvar_arquivos:\n if protnfe_recibo.infProt.cStat.valor in (u'100', u'150'):\n novo_arquivo_nome = unicode(nfe.chave).strip().rjust(44, u'0') + u'-proc-nfe.xml'\n dir = 'NFeAutorizada'\n elif protnfe_recibo.infProt.cStat.valor in (u'110', u'301', u'302', u'303'):\n novo_arquivo_nome = unicode(nfe.chave).strip().rjust(44, u'0') + u'-proc-nfe-den.xml'\n dir = 'NFeDenegada'\n else:\n novo_arquivo_nome = unicode(nfe.chave).strip().rjust(44, u'0') + u'-proc-nfe-rej.xml'\n dir = 'NFeRejeitada'\n \n caminho_original = self.caminho\n self.caminho = self.monta_caminho_nfe(ambiente=nfe.infNFe.ide.tpAmb.valor, chave_nfe=nfe.chave, dir=dir)\n novo_arquivo_nome = novo_arquivo_nome\n novo_arquivo = processo.xml.encode('utf-8')\n novos_arquivos.append((novo_arquivo_nome, novo_arquivo))\n self.salvar_novos_arquivos(novos_arquivos=novos_arquivos)\n \n self.caminho = caminho_original\n \n return processo\n\n def monta_caminho_nfe(self, ambiente, chave_nfe=None, dir='', data=None):\n caminho = self.caminho + u'ArquivosXML/NFe/'\n\n if ambiente == 1:\n caminho = os.path.join(caminho, 'producao/')\n else:\n caminho = os.path.join(caminho, 'homologacao/')\n \n if not data:\n data = u'20' + chave_nfe[2:4] + u'-' + chave_nfe[4:6]\n \n if dir:\n caminho = os.path.join(caminho, data + u'/' + dir + u'/')\n else:\n serie = chave_nfe[22:25]\n numero = chave_nfe[25:34]\n\n caminho = os.path.join(caminho, data + u'/')\n caminho = os.path.join(caminho, serie + u'-' + numero + u'/')\n \n return caminho\n \n def monta_caminho_inutilizacao(self, ambiente=None, data=None, serie=None, numero_inicial=None, numero_final=None):\n caminho = self.caminho + u'ArquivosXML/NFe/'\n\n if ambiente == 1:\n caminho = os.path.join(caminho, 'producao/')\n else:\n caminho = os.path.join(caminho, 'homologacao/')\n\n if data is None:\n data = datetime.now()\n\n caminho = os.path.join(caminho, data.strftime(u'%Y-%m') + u'/' + 'NFeInutilizada/')\n\n serie = unicode(serie).strip().rjust(3, u'0')\n numero_inicial = unicode(numero_inicial).strip().rjust(9, u'0')\n numero_final = unicode(numero_final).strip().rjust(9, u'0')\n\n caminho = os.path.join(caminho, serie + u'-' + numero_inicial + u'-' + numero_final + u'/')\n \n return caminho\n \n def monta_caminho_nfe_cnpj(self, ambiente=None, data=None, cnpj=None, dir=''):\n caminho = self.caminho + u'ArquivosXML/NFe/'\n\n if ambiente == 1:\n caminho = os.path.join(caminho, 'producao/')\n else:\n caminho = os.path.join(caminho, 'homologacao/')\n \n if data is None:\n data = datetime.now()\n \n caminho = os.path.join(caminho, data.strftime(u'%Y-%m') + u'/')\n if dir:\n caminho = os.path.join(caminho, dir + u'/' + cnpj + u'/')\n else:\n caminho = os.path.join(caminho, cnpj + u'/')\n \n return caminho\n \n def salvar_novos_arquivos(self, novos_arquivos):\n caminho = self.caminho\n \n try:\n os.makedirs(caminho)\n except:\n pass\n \n for arquivo in novos_arquivos:\n nome_arquivo, conteudo = arquivo\n arquivo_em_disco = open(os.path.join(caminho, nome_arquivo), 'wb')\n if hasattr(conteudo, 'getvalue'):\n arquivo_em_disco.write(conteudo.getvalue())\n else:\n arquivo_em_disco.write(conteudo)\n arquivo_em_disco.close()\n \n def salvar_processamento_eventos(self, processo, ret_eventos, tipo_evento):\n\n for ret in ret_eventos:\n novos_arquivos = []\n chave = ret.infEvento.chNFe.valor\n nome_arq = ret.infEvento.chNFe.valor + '-' + unicode(ret.infEvento.nSeqEvento.valor).zfill(2)\n \n #\n # O evento foi aceito e vinculado à NF-e\n #\n if ret.infEvento.cStat.valor == '135':\n novo_arquivo_nome = nome_arq + '-ret-' + tipo_evento + '.xml'\n novo_arquivo = ret.xml.encode('utf-8')\n novos_arquivos.append((novo_arquivo_nome, novo_arquivo))\n \n #\n # Salva o processo do evento\n #\n novo_arquivo_nome = nome_arq + '-proc-' + tipo_evento + '.xml'\n novo_arquivo = processo.resposta.dic_procEvento[chave].xml.encode('utf-8')\n novos_arquivos.append((novo_arquivo_nome, novo_arquivo))\n\n #\n # O evento foi aceito, mas não foi vinculado à NF-e\n #\n elif ret.infEvento.cStat.valor == '136':\n novo_arquivo_nome = nome_arq + '-ret-' + tipo_evento + '-sv.xml'\n novo_arquivo = ret.xml.encode('utf-8')\n novos_arquivos.append((novo_arquivo_nome, novo_arquivo))\n\n #\n # Salva o processo do evento\n #\n novo_arquivo_nome = nome_arq + '-proc-' + tipo_evento + '.xml'\n novo_arquivo = processo.resposta.dic_procEvento[chave].xml.encode('utf-8')\n novos_arquivos.append((novo_arquivo_nome, novo_arquivo))\n\n #\n # O evento foi aceito e vinculado à NF-e, é um cancelamento for do prazo\n #\n elif ret.infEvento.cStat.valor == '155':\n novo_arquivo_nome = nome_arq + '-ret-' + tipo_evento + '.xml'\n novo_arquivo = ret.xml.encode('utf-8')\n novos_arquivos.append((novo_arquivo_nome, novo_arquivo))\n\n #\n # Salva o processo do evento\n #\n novo_arquivo_nome = nome_arq + '-proc-' + tipo_evento + '.xml'\n novo_arquivo = processo.resposta.dic_procEvento[chave].xml.encode('utf-8')\n novos_arquivos.append((novo_arquivo_nome, novo_arquivo))\n\n #\n # O evento foi rejeitado\n #\n else:\n novo_arquivo_nome = nome_arq + '-ret-' + tipo_evento + '-rej.xml'\n novo_arquivo = ret.xml.encode('utf-8')\n novos_arquivos.append((novo_arquivo_nome, novo_arquivo))\n \n self.salvar_novos_arquivos(novos_arquivos=novos_arquivos)\n\n\nclass DANFE(object):\n def __init__(self):\n self.imprime_canhoto = True\n self.imprime_local_retirada = True\n self.imprime_local_entrega = True\n self.imprime_fatura = True\n self.imprime_duplicatas = True\n self.imprime_issqn = True\n \n #NFC-e\n self.imprime_produtos_nfce = True\n self.imprime_id_consumidor = True\n self.imprime_ender_consumidor = True\n\n self.caminho = u''\n self.salvar_arquivo = False\n\n self.NFe = None\n self.protNFe = None\n self.retCancNFe = None\n self.danfe = None\n self.versao = '2.00'\n\n self.obs_impressao = u'DANFE gerado em %(now:%d/%m/%Y, %H:%M:%S)s'\n self.nome_sistema = u''\n self.site = u''\n self.logo = u''\n self.leiaute_logo_vertical = False\n self.dados_emitente = []\n\n def gerar_danfe(self):\n if self.NFe is None:\n raise ValueError(u'Não é possível gerar um DANFE sem a informação de uma NF-e')\n\n if self.protNFe is None:\n if self.versao == u'2.00':\n self.protNFe = ProtNFe_200()\n elif self.versao == u'3.10':\n self.protNFe = ProtNFe_310()\n\n if self.retCancNFe is None:\n if self.versao == u'2.00':\n self.retCancNFe = RetCancNFe_200()\n elif self.versao == u'3.10':\n self.retCancNFe = RetCancNFe_310()\n\n #\n # Prepara o queryset para impressão\n #\n self.NFe.monta_chave()\n self.NFe.monta_dados_contingencia_fsda()\n self.NFe.site = self.site\n\n for detalhe in self.NFe.infNFe.det:\n detalhe.NFe = self.NFe\n detalhe.protNFe = self.protNFe\n detalhe.retCancNFe = self.retCancNFe\n \n #\n # Prepara as bandas de impressão para cada formato\n #\n if self.NFe.infNFe.ide.tpImp.valor == 2:\n #raise ValueError(u'DANFE em formato paisagem ainda não implementado')\n self.danfe = DANFEPaisagem()\n self.danfe.queryset = self.NFe.infNFe.det\n else:\n self.danfe = DANFERetrato()\n self.danfe.queryset = self.NFe.infNFe.det\n \n if self.imprime_canhoto:\n self.danfe.band_page_header = self.danfe.canhoto\n self.danfe.band_page_header.child_bands = []\n self.danfe.band_page_header.child_bands.append(self.danfe.remetente)\n else:\n self.danfe.band_page_header = self.danfe.remetente\n self.danfe.band_page_header.child_bands = []\n\n # Emissão para simples conferência / sem protocolo de autorização\n# self.protNFe\n \n if not self.protNFe.infProt.nProt.valor:\n self.danfe.remetente.campo_variavel_conferencia()\n\n # NF-e denegada\n elif self.protNFe.infProt.cStat.valor == u'110':\n self.danfe.remetente.campo_variavel_denegacao()\n self.danfe.remetente.obs_denegacao()\n\n # Emissão em contingência com FS ou FSDA\n elif self.NFe.infNFe.ide.tpEmis.valor in (2, 5,):\n self.danfe.remetente.campo_variavel_contingencia_fsda()\n self.danfe.remetente.obs_contingencia_normal_scan()\n\n # Emissão em contingência com DPEC\n elif self.NFe.infNFe.ide.tpEmis.valor == 4:\n self.danfe.remetente.campo_variavel_contingencia_dpec()\n self.danfe.remetente.obs_contingencia_dpec()\n\n # Emissão normal ou contingência SCAN, SVC-AN e SVC-RS\n else:\n self.danfe.remetente.campo_variavel_normal()\n # Contingência SCAN,SVC-AN e SVC-RS\n if self.NFe.infNFe.ide.tpEmis.valor in (3, 6, 7):\n self.danfe.remetente.obs_contingencia_normal_scan()\n\n # A NF-e foi cancelada, no DANFE imprimir o \"carimbo\" de cancelamento\n if self.retCancNFe.infCanc.nProt.valor:\n self.danfe.remetente.obs_cancelamento()\n\n # Observação de ausência de valor fiscal\n # se não houver protocolo ou se o ambiente for de homologação\n if (not self.protNFe.infProt.nProt.valor) or self.NFe.infNFe.ide.tpAmb.valor == 2:\n self.danfe.remetente.obs_sem_valor_fiscal()\n\n self.danfe.band_page_header.child_bands.append(self.danfe.destinatario)\n\n if self.imprime_local_retirada and len(self.NFe.infNFe.retirada.xml):\n self.danfe.band_page_header.child_bands.append(self.danfe.local_retirada)\n\n if self.imprime_local_entrega and len(self.NFe.infNFe.entrega.xml):\n self.danfe.band_page_header.child_bands.append(self.danfe.local_entrega)\n\n if self.imprime_fatura:\n # Pagamento a prazo\n if (self.NFe.infNFe.ide.indPag.valor == 1) or \\\n (len(self.NFe.infNFe.cobr.dup) > 1) or \\\n ((len(self.NFe.infNFe.cobr.dup) == 1) and \\\n (self.NFe.infNFe.cobr.dup[0].dVenc.xml > self.NFe.infNFe.ide.dhEmi.xml)):\n\n if self.imprime_duplicatas:\n self.danfe.fatura_a_prazo.elements.append(self.danfe.duplicatas)\n\n self.danfe.band_page_header.child_bands.append(self.danfe.fatura_a_prazo)\n\n # Pagamento a vista\n else:\n self.danfe.band_page_header.child_bands.append(self.danfe.fatura_a_vista)\n\n self.danfe.band_page_header.child_bands.append(self.danfe.calculo_imposto)\n self.danfe.band_page_header.child_bands.append(self.danfe.transporte)\n self.danfe.band_page_header.child_bands.append(self.danfe.cab_produto)\n\n# self.danfe.band_page_footer = self.danfe.iss\n\n if self.imprime_issqn and len(self.NFe.infNFe.total.ISSQNTot.xml):\n self.danfe.band_page_footer = self.danfe.iss\n else:\n self.danfe.band_page_footer = self.danfe.dados_adicionais\n\n self.danfe.band_detail = self.danfe.det_produto\n\n #\n # Observação de impressão\n #\n if self.nome_sistema:\n self.danfe.ObsImpressao.expression = self.nome_sistema + u' - ' + self.obs_impressao\n else:\n self.danfe.ObsImpressao.expression = self.obs_impressao\n\n #\n # Quadro do emitente\n #\n # Personalizado?\n if self.dados_emitente:\n self.danfe.remetente.monta_quadro_emitente(self.dados_emitente)\n else:\n # Sem logotipo\n if not self.logo:\n self.danfe.remetente.monta_quadro_emitente(self.danfe.remetente.dados_emitente_sem_logo())\n\n # Logotipo na vertical\n elif self.leiaute_logo_vertical:\n self.danfe.remetente.monta_quadro_emitente(self.danfe.remetente.dados_emitente_logo_vertical(self.logo))\n\n # Logotipo na horizontal\n else:\n self.danfe.remetente.monta_quadro_emitente(self.danfe.remetente.dados_emitente_logo_horizontal(self.logo))\n\n if self.salvar_arquivo:\n self.caminho = self.monta_caminho_danfe(ambiente=self.NFe.infNFe.ide.tpAmb.valor, chave_nfe=self.NFe.chave, dir='DANFE')\n nome_arq = self.caminho + self.NFe.chave + u'.pdf'\n type(self.danfe.generate_by(PDFGenerator, filename=nome_arq))\n \n def gerar_danfce(self, via_estabelecimento=False):\n if self.NFe is None:\n raise ValueError(u'Não é possível gerar um DANFE sem a informação de uma NF-e')\n \n if self.protNFe is None:\n if self.versao == u'2.00':\n self.protNFe = ProtNFe_200()\n elif self.versao == u'3.10':\n self.protNFe = ProtNFe_310()\n\n if self.retCancNFe is None:\n if self.versao == u'2.00':\n self.retCancNFe = RetCancNFe_200()\n elif self.versao == u'3.10':\n self.retCancNFe = RetCancNFe_310()\n\n #\n # Prepara o queryset para impressão\n #\n self.NFe.monta_chave()\n #self.NFe.gera_qrcode_nfce(csc=self.NFe.infNFeSupl.csc, cidtoken=self.NFe.infNFeSupl.cidtoken, nversao=self.NFe.infNFeSupl.cidtoken)\n self.NFe.gera_qrcode_nfce()\n self.NFe.monta_dados_contingencia_fsda()\n self.NFe.site = self.site\n self.NFe.via_estabelecimento = via_estabelecimento\n\n for detalhe in self.NFe.infNFe.det:\n detalhe.NFe = self.NFe\n detalhe.protNFe = self.protNFe\n detalhe.retCancNFe = self.retCancNFe\n \n self.danfe = DANFCE()\n self.danfe.queryset = self.NFe.infNFe.det\n \n self.danfe.band_page_header = self.danfe.cabecalho\n \n if self.NFe.infNFe.ide.tpEmis.valor != 1:\n self.danfe.mensagem_fiscal_topo.campo_variavel_contingencia()\n elif self.NFe.infNFe.ide.tpAmb.valor == 2:\n self.danfe.mensagem_fiscal_topo.campo_variavel_homologacao()\n \n self.danfe.band_page_header.child_bands.append(self.danfe.mensagem_fiscal_topo)\n \n if self.imprime_produtos_nfce:\n lines_xprod = 0\n for d in self.NFe.infNFe.det:\n lines_xprod += len(d.prod.xProd.valor)\n self.danfe.inf_produtos.band_detail.set_band_height(lines_xprod)\n self.danfe.det_produtos.elements.append(self.danfe.inf_produtos)\n self.danfe.band_page_header.child_bands.append(self.danfe.det_produtos)\n \n ##Adicionar acrescimos se houver\n if (str(self.NFe.infNFe.total.ICMSTot.vFrete.valor) != '0.0') or \\\n (str(self.NFe.infNFe.total.ICMSTot.vSeg.valor) != '0.0') or \\\n (str(self.NFe.infNFe.total.ICMSTot.vOutro.valor) != '0.0'):\n \n self.danfe.descontos.band_header.set_top()\n for band in self.danfe.acrescimos.band_header.elements:\n self.danfe.inf_totais.band_header.elements.append(band)\n \n #Adicionar a altura do band_header\n self.danfe.inf_totais.band_header.add_height()\n \n ##Adicionar descontos se houver\n if (str(self.NFe.infNFe.total.ICMSTot.vDesc.valor) != '0.0'):\n for band in self.danfe.descontos.band_header.elements:\n self.danfe.inf_totais.band_header.elements.append(band)\n \n #Adicionar a altura do band_header\n self.danfe.inf_totais.band_header.add_height()\n \n self.danfe.det_totais.elements.append(self.danfe.inf_totais)\n self.danfe.band_page_header.child_bands.append(self.danfe.det_totais)\n \n self.danfe.det_pagamento.elements.append(self.danfe.inf_pagamento)\n self.danfe.band_page_header.child_bands.append(self.danfe.det_pagamento)\n \n self.danfe.band_page_header.child_bands.append(self.danfe.consulta_chave)\n \n if self.imprime_id_consumidor:\n self.danfe.id_consumidor.consumidor_identificado()\n self.danfe.band_page_header.child_bands.append(self.danfe.id_consumidor)\n \n if self.imprime_ender_consumidor:\n self.danfe.band_page_header.child_bands.append(self.danfe.ender_consumidor)\n else:\n self.danfe.id_consumidor.consumidor_nao_identificado()\n self.danfe.band_page_header.child_bands.append(self.danfe.id_consumidor)\n \n ##Emissão normal, imprimir numero protocolo\n if self.NFe.infNFe.ide.tpEmis.valor == 1:\n self.danfe.id_nfce.campo_variavel_protocolo()\n \n self.danfe.band_page_header.child_bands.append(self.danfe.id_nfce)\n \n if self.NFe.infNFe.ide.tpEmis.valor != 1:\n self.danfe.mensagem_fiscal_base.campo_variavel_contingencia()\n elif self.NFe.infNFe.ide.tpAmb.valor == 2:\n self.danfe.mensagem_fiscal_base.campo_variavel_homologacao()\n \n self.danfe.band_page_header.child_bands.append(self.danfe.mensagem_fiscal_base)\n \n self.danfe.qrcode_danfe.gera_img_qrcode()\n self.danfe.band_page_header.child_bands.append(self.danfe.qrcode_danfe)\n \n if self.NFe.infNFe.total.ICMSTot.vTotTrib.valor:\n self.danfe.band_page_header.child_bands.append(self.danfe.tributos_totais)\n \n ##Ajustar o tamanho da pagina\n self.danfe.set_report_height(n_produtos=len(self.NFe.infNFe.det), n_pag=len(self.NFe.infNFe.pag))\n \n if self.salvar_arquivo:\n self.caminho = self.monta_caminho_danfe(ambiente=self.NFe.infNFe.ide.tpAmb.valor, chave_nfe=self.NFe.chave, dir='DANFCE')\n nome_arq = self.caminho + self.NFe.chave + u'.pdf'\n type(self.danfe.generate_by(PDFGenerator, filename=nome_arq))\n \n def monta_caminho_danfe(self, ambiente, chave_nfe, dir=''):\n caminho = self.caminho + u'ArquivosXML/NFe/'\n\n if ambiente == 1:\n caminho = os.path.join(caminho, 'producao/')\n else:\n caminho = os.path.join(caminho, 'homologacao/')\n\n data = u'20' + chave_nfe[2:4] + u'-' + chave_nfe[4:6]\n if dir:\n caminho = os.path.join(caminho, data + u'/' + dir + u'/')\n else:\n serie = chave_nfe[22:25]\n numero = chave_nfe[25:34]\n\n caminho = os.path.join(caminho, data + u'/')\n caminho = os.path.join(caminho, serie + u'-' + numero + u'/')\n \n try:\n os.makedirs(caminho)\n except:\n pass\n \n return caminho\n" }, { "alpha_fraction": 0.7614678740501404, "alphanum_fraction": 0.7798165082931519, "avg_line_length": 35.66666793823242, "blob_id": "06bd4e1105e6c53a55320e70f7f22a9c55b68a77", "content_id": "3db803f6ac183f182aeeb51b6db8b843e9474c94", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 109, "license_type": "no_license", "max_line_length": 77, "num_lines": 3, "path": "/sub_text/sub_text1.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "from pyutil import filereplace\n\nfilereplace(\"somefile.txt\",\"/educacional.1linha.com.br\",\"/www.1linha.com.br\")" }, { "alpha_fraction": 0.523809552192688, "alphanum_fraction": 0.523809552192688, "avg_line_length": 20, "blob_id": "e7f2b7b750cfb671506a2e4ec13c0fda9efd2cfd", "content_id": "a67f895fb01054da31e0b4d1ff1343a7b88f4de8", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 21, "license_type": "no_license", "max_line_length": 20, "num_lines": 1, "path": "/PQt5-Stock/Controlador/__init__.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "__author__ = 'Vicio'\n" }, { "alpha_fraction": 0.60326087474823, "alphanum_fraction": 0.7119565010070801, "avg_line_length": 22.125, "blob_id": "4abd793b7ebb979e4568995f258aeb857da894c6", "content_id": "4f26ed91cb7b22f6a967dfcd66625e59a7058f31", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 184, "license_type": "no_license", "max_line_length": 82, "num_lines": 8, "path": "/mapas/ve-mapa-002.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import pandas as pd\nimport folium\n\nbrasil = folium.Map(\n location=[-16.1237611, -59.9219642], # Coordenadas retiradas do Google Maps\n zoom_start=40\n)\nbrasil.save('teste.html')" }, { "alpha_fraction": 0.7105262875556946, "alphanum_fraction": 0.7236841917037964, "avg_line_length": 13.476190567016602, "blob_id": "bbdb13151c8a62512a2ebefa40a4b0b0b57a2122", "content_id": "79008c449364184a0d0e8188613d9ef7d1068736", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 304, "license_type": "no_license", "max_line_length": 41, "num_lines": 21, "path": "/pong/telas/Telas.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "from kivy.uix.screenmanager import Screen\n\n\n# Declara o Menu do Jogo\nclass TelaMenu(Screen):\n pass\n\n\n# Declara a Tela do Pong\nclass TelaJogo(Screen):\n pass\n\n\n# Declara a Tela do Vencedor 3\nclass TelaVencedor1(Screen):\n pass\n\n\n# Declara a Tela do Vencedor 2\nclass TelaVencedor2(Screen):\n pass\n" }, { "alpha_fraction": 0.6341772079467773, "alphanum_fraction": 0.6348101496696472, "avg_line_length": 31.26530647277832, "blob_id": "10d9fd392be460c1b88c93dbd01973c127fed85a", "content_id": "4b1970e7717c0e597d4082d32481592bb226219a", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1580, "license_type": "no_license", "max_line_length": 84, "num_lines": 49, "path": "/PQt5-Stock/Conexion/conexionMarca.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom Conexion.conexion import Conexion\nfrom Modelo.marca import Marca\n\nclass conexionMarca(object):\n\n\n def __init__(self):\n self.conexion = Conexion()\n self.__marca = Marca()\n \n \n def selectMarca(self, textFilter):\n query = \"SELECT idmarcas, descripcion FROM marcas WHERE descripcion LIKE %s\"\n parametro = textFilter + '%'\n value = parametro\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(query, parametro)\n listMarca = self.conexion.cursor.fetchall()\n\n return listMarca\n self.conexion.cerrarConexion()\n\n \n def borrarMarca(self, marca):\n query = \"DELETE FROM marcas WHERE idmarcas= %s \"\n values = marca.getIdMarca()\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(query, values)\n self.conexion.db.commit()\n self.conexion.cerrarConexion()\n\n def modificarMarca(self, marca):\n query = \"UPDATE marcas SET descripcion= %s WHERE idmarcas= %s\"\n values = (marca.getMarca(),marca.getIdMarca())\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(query, values)\n self.conexion.db.commit()\n self.conexion.cerrarConexion()\n \n def insertMarca(self, marca):\n query = \"INSERT INTO marcas (descripcion) VALUES (%s)\"\n values = marca.getMarca()\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(query, values)\n self.conexion.db.commit()\n self.conexion.cerrar_conexion()" }, { "alpha_fraction": 0.49772170186042786, "alphanum_fraction": 0.5085874795913696, "avg_line_length": 30.561798095703125, "blob_id": "ffd90e9f31877fbc350a0a42e318e9f81fe9d6cc", "content_id": "a81be6ff53c3759a35dd466a749d62c1fb663a17", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2854, "license_type": "no_license", "max_line_length": 80, "num_lines": 89, "path": "/full - compara relatorios/base-pandas.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import sys\nimport os\nimport csv\nimport pandas as pd\n\ndef processa(arq):\n comfile = open(arq + '.ori', 'r')\n csvfile = open(arq + '.csv', 'w')\n\n\n def tiraespaco(l):\n l = l.replace(' ', '')\n l = l.replace('.', '')\n return l\n\n\n cab = ''\n ven = False\n for l in comfile:\n if len(cab) < 1:\n if l[:52] == '| NUMERO | CLIENTE |':\n l = tiraespaco(l)\n cab = l\n csvfile.write(l[1:-2] + '\\n')\n # csvfile.write(l)\n\n if l[0:30] == '|TOTAL DO TIPO =====> MONTADOR':\n ven = True\n\n if ven:\n if l[52:70] == 'TOTAL DA NOTA ==> ':\n csvfile.write(l[1:-3] + '\\n')\n\n comfile.close()\n csvfile.close()\n\n df = pd.read_csv(arq + '.csv', sep='|', encoding='cp1252', decimal=',')\n\n print(df.dtypes)\n print(df)\n\n df['VRBRUTO'] = [x.replace('.', '') for x in df['VRBRUTO']]\n df['VRBRUTO'] = [x.replace(',', '.') for x in df['VRBRUTO']]\n df['VRBRUTO'] = [x.replace(' ', '0') for x in df['VRBRUTO']]\n df['VRBRUTO'] = df['VRBRUTO'].astype(float)\n\n df['DESCONTO'] = [x.replace('.', '') for x in df['DESCONTO']]\n df['DESCONTO'] = [x.replace(',', '.') for x in df['DESCONTO']]\n df['DESCONTO'] = [x.replace(' ', '0') for x in df['DESCONTO']]\n df['DESCONTO'] = df['DESCONTO'].astype(float)\n\n df['VALORTROCA'] = [x.replace('.', '') for x in df['VALORTROCA']]\n df['VALORTROCA'] = [x.replace(',', '.') for x in df['VALORTROCA']]\n df['VALORTROCA'] = [x.replace(' ', '0') for x in df['VALORTROCA']]\n df['VALORTROCA'] = df['VALORTROCA'].astype(float)\n\n df['DEVOLUCAO'] = [x.replace('.', '') for x in df['DEVOLUCAO']]\n df['DEVOLUCAO'] = [x.replace(',', '.') for x in df['DEVOLUCAO']]\n df['DEVOLUCAO'] = [x.replace(' ', '0') for x in df['DEVOLUCAO']]\n df['DEVOLUCAO'] = df['DEVOLUCAO'].astype(float)\n\n df['VALORLIQUIDO'] = [x.replace('.', '') for x in df['VALORLIQUIDO']]\n df['VALORLIQUIDO'] = [x.replace(',', '.') for x in df['VALORLIQUIDO']]\n df['VALORLIQUIDO'] = [x.replace(' ', '0') for x in df['VALORLIQUIDO']]\n df['VALORLIQUIDO'] = df['VALORLIQUIDO'].astype(float)\n\n print(df.dtypes)\n print(df)\n\n print(sum(df.VRBRUTO))\n print(sum(df.DESCONTO))\n print(sum(df.VALORTROCA))\n print(sum(df.DEVOLUCAO))\n print(sum(df.VALORLIQUIDO))\n\n for index, row in df.iterrows():\n print(row['NUMERO'], row['VALORLIQUIDO'])\n\nif __name__ == \"__main__\":\n if(len(sys.argv) < 2):\n print(\"Use: le-comissao arquivo\")\n sys.exit(0)\n if os.path.isfile(sys.argv[1]):\n print(os.path.splitext(os.path.basename(sys.argv[1]))[0])\n # processa(sys.arqv[1])\n else:\n print(u'Arquivo não encontrado!')\n sys.exit(0)\n sys.exit(1) " }, { "alpha_fraction": 0.5938553810119629, "alphanum_fraction": 0.5961034297943115, "avg_line_length": 34.573333740234375, "blob_id": "d9a84c5bdac6aa76dd8f9eff1fd2aa463843b4e3", "content_id": "fa3d1872f4574f53733b6283835524f175aa2b40", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2669, "license_type": "no_license", "max_line_length": 104, "num_lines": 75, "path": "/PQt5-Stock/Conexion/conexionTelefono.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom Modelo.telefono import Telefono\nfrom Conexion.conexion import Conexion\nclass conexionTelefono(object):\n\n\n def __init__(self):\n self.conexion = Conexion()\n self.telefono = Telefono()\n\n def selectTelefono(self, telefono):\n query =\"\"\"\n SELECT t.idTelefono, t.tipo, t.numero\n FROM telefonos t, personas p\n WHERE t.personas_idpersonas = p.idpersonas and p.idpersonas = %s\n \"\"\"\n values = telefono.getIdPersona()\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(query, values)\n listTelefono = self.conexion.cursor.fetchall()\n self.conexion.cerrarConexion()\n return listTelefono\n\n def modificarTelefono(self, telefono):\n query = \"\"\"\n UPDATE telefonos\n SET numero = %s , tipo = %s\n WHERE idtelefono= %s;\n \"\"\"\n values = (telefono.getTelefono(), telefono.getTipo(), telefono.getIdTelefono())\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(query, values)\n self.conexion.db.commit()\n self.conexion.cerrarConexion()\n\n def insertarTelefono(self, telefono):\n query = \"INSERT INTO telefonos (numero, tipo, personas_idpersonas) VALUES (%s , %s, %s)\"\n values = (telefono.getTelefono(), telefono.getTipo(), telefono.getIdPersona())\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(query, values)\n self.conexion.db.commit()\n self.conexion.cerrarConexion()\n\n\n def insertTelefonoInit(self, telefonos):\n self.conexion.abrirConexion()\n\n queryIdPersona = \"select MAX(idpersonas) from personas\"\n self.conexion.cursor.execute(queryIdPersona)\n result = self.conexion.cursor.fetchall()\n\n idPersona = int(result[0][0])\n\n for telefono in telefonos:\n if telefono[2] != '':\n query = \"INSERT INTO telefonos (numero, tipo, personas_idpersonas) VALUES (%s , %s, %s)\"\n values = (telefono[2], telefono[1], idPersona)\n self.conexion.cursor.execute(query, values)\n self.conexion.db.commit()\n\n self.conexion.cerrarConexion()\n\n\n def borrarTelefono(self, telefono):\n query = \"\"\"\n DELETE FROM telefonos\n WHERE idtelefono= %s\n \"\"\"\n values =telefono.getIdTelefono()\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(query, values)\n self.conexion.db.commit()\n self.conexion.cerrarConexion()\n\n" }, { "alpha_fraction": 0.5829318761825562, "alphanum_fraction": 0.5831038951873779, "avg_line_length": 43.36641311645508, "blob_id": "74572a7e7413fa9ab8955c505cfecfc98495075b", "content_id": "8cb1a4f2ca3fef5512f5ffb42b9c2dbbf8d0fc7b", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 5816, "license_type": "no_license", "max_line_length": 122, "num_lines": 131, "path": "/PQt5-Stock/Conexion/conexionUsuario.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom Conexion.conexion import Conexion\nfrom Modelo.usuario import Usuario\nclass conexionUsuario(object):\n\n def __init__(self):\n self.conexion = Conexion()\n self.usuario = Usuario()\n\n def selectUsuario(self, typeParameter, parameter):\n query = \"\"\"\n SELECT u.idusuarios, p.nombre, u.apellido, u.usuario, u.tipo, u.contraseña, p.email, d.direccion,\n d.numero, d.piso, d.dpto, d.iddirecciones, p.idpersonas\n FROM usuarios u , personas p, direcciones d\n WHERE p.idpersonas = u.personas_idpersonas and p.direcciones_iddirecciones = d.iddirecciones and\n \"\"\" + typeParameter + \"\"\" LIKE %s\n \"\"\"\n param = parameter + '%'\n values = param\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(query, values)\n listUsuario = self.conexion.cursor.fetchall()\n self.conexion.cerrarConexion()\n return listUsuario\n\n def selectTelefonoUsuario(self, usuario):\n query = \"\"\"\n SELECT t.idtelefono, t.numero, t.tipo\n FROM telefonos t, personas p, usuarios u\",\n WHERE p.idpersonas = u.personas_idpersonas and p.idpersonas = t.personas_idpersonas\n and usuarios.idusuarios = %s\n \"\"\"\n values = usuario.getIdUsuario()\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(query, values)\n listTelefono = self.conexion.cursor.fetchall()\n self.conexion.cerrarConexion()\n return listTelefono\n\n def modificarUsuario(self, usuario):\n query = \"\"\"\n UPDATE personas p, usuarios u, direcciones d\n SET p.nombre = %s , p.email= %s, u.apellido = %s, u.usuario = %s,\n u.tipo = %s, u.contraseña = %s, d.direccion = %s, d.numero = %s, d.piso = %s, d.dpto = %s\n WHERE p.idpersonas = u.personas_idpersonas and p.direcciones_iddirecciones = d.iddirecciones\n and u.idusuarios = %s\n \"\"\"\n values = (usuario.getNombre(), usuario.getEmail(), usuario.getApellido(), usuario.getUsuario(),\n usuario.getTipoUsuario(), usuario.getPasswd(), usuario.getDireccion().getDireccion(),\n usuario.getDireccion().getNumero(), usuario.getDireccion().getPiso(),\n usuario.getDireccion().getDpto(), usuario.getIdUsuario())\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(query, values)\n self.conexion.db.commit()\n self.conexion.cerrarConexion()\n\n def insertarUsuario(self, usuario):\n self.conexion.abrirConexion()\n\n queryDireccion = \"INSERT INTO direcciones (direccion, numero, piso, dpto) VALUES (%s, %s, %s, %s)\"\n valuesDireccion = (usuario.getDireccion().getDireccion(), usuario.getDireccion().getNumero(),\n usuario.getDireccion().getPiso(), usuario.getDireccion().getDpto())\n self.conexion.cursor.execute(queryDireccion, valuesDireccion)\n\n queryPersona = \"INSERT INTO personas (nombre, email, direcciones_iddirecciones) VALUES (%s, %s, LAST_INSERT_ID())\"\n valuesPersona = (usuario.getNombre(), usuario.getEmail())\n self.conexion.cursor.execute(queryPersona, valuesPersona)\n\n queryUsuario = \"\"\"INSERT INTO usuarios (tipo, personas_idpersonas, contraseña, usuario, apellido)\n VALUES ( %s , LAST_INSERT_ID() , %s , %s , %s )\"\"\"\n valuesUsuario = (usuario.getTipoUsuario(), usuario.getPasswd(), usuario.getUsuario(), usuario.getApellido())\n self.conexion.cursor.execute(queryUsuario, valuesUsuario)\n\n self.conexion.db.commit()\n self.conexion.cerrarConexion()\n\n def borrarUsuario(self, usuario):\n queryTelefono = \"\"\"\n DELETE telefonos\n FROM telefonos\n WHERE telefonos.personas_idpersonas = %s\n \"\"\"\n valuesTelefono = usuario.getIdPersona()\n\n queryUsuario = \"\"\"\n DELETE usuarios\n FROM usuarios\n WHERE usuarios.idusuarios = %s\n \"\"\"\n\n valuesUsuario = usuario.getIdUsuario()\n\n queryPersona = \"\"\"\n DELETE personas\n FROM personas\n WHERE personas.idpersonas = %s\n \"\"\"\n\n valuesPersona = usuario.getIdPersona()\n\n queryDireccion = \"\"\"\n DELETE direcciones\n FROM direcciones\n WHERE direcciones.iddirecciones = %s\n \"\"\"\n\n valuesDireccion = usuario.getDireccion().getIdDireccion()\n\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(queryTelefono, valuesTelefono)\n self.conexion.db.commit()\n self.conexion.cursor.execute(queryUsuario, valuesUsuario)\n self.conexion.db.commit()\n self.conexion.cursor.execute(queryPersona, valuesPersona)\n self.conexion.db.commit()\n self.conexion.cursor.execute(queryDireccion, valuesDireccion)\n self.conexion.db.commit()\n\n self.conexion.cerrarConexion()\n\n\n def validarUsuario(self, usuario):\n query = \"SELECT usuario, tipo FROM usuarios WHERE usuario= %s and contraseña = %s\"\n values = (usuario.getUsuario(), usuario.getPasswd())\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(query, values)\n auxUsuario = self.conexion.cursor.fetchall()\n self.conexion.cerrarConexion()\n\n return auxUsuario\n" }, { "alpha_fraction": 0.6734417080879211, "alphanum_fraction": 0.7628726363182068, "avg_line_length": 60.5, "blob_id": "d8b958bf2b999d3bc389215778418e7bc7924116", "content_id": "cb98992a3900ede6fd3a33196fcba8f2b3654a29", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 738, "license_type": "no_license", "max_line_length": 152, "num_lines": 12, "path": "/Hospital-Helper-2-master/README.md", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "[![Build Status](https://travis-ci.org/aq1/Hospital-Helper-2.svg?branch=master)](https://travis-ci.org/aq1/Hospital-Helper-2)\n[![codecov.io](http://codecov.io/github/aq1/Hospital-Helper-2/coverage.svg?branch=master)](http://codecov.io/github/aq1/Hospital-Helper-2?branch=master)\n\n# Hospital-Helper-2\nThe second version of doctor helping program. Written in python with pyqt ~~kivy~~ (sorry, kivy), sqlalchemy.\n\n![](https://cloud.githubusercontent.com/assets/3045638/24333332/90fa0f48-125e-11e7-872d-246fba0a53ae.png)\n\nDownloads:\n\n* [PyQt5 for Python 3.4](https://sourceforge.net/projects/pyqt/files/PyQt5/PyQt-5.5.1/PyQt5-5.5.1-gpl-Py3.4-Qt5.5.1-x32.exe/download)\n([mirrow](https://drive.google.com/open?id=0B7sCgUAlEatzc0hub2JDektKZEU))\n" }, { "alpha_fraction": 0.7385892271995544, "alphanum_fraction": 0.7593361139297485, "avg_line_length": 19.08333396911621, "blob_id": "bbb9d905dcc668e7f8a3184a0c8b7b019df57e34", "content_id": "a57676e3e6491b8a71db0efb22efcda0fa4aa5a3", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Shell", "length_bytes": 241, "license_type": "no_license", "max_line_length": 71, "num_lines": 12, "path": "/Hospital-Helper-2-master/vagrant/linux.sh", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "sudo -i\n\napt-get update\n\napt-get install git -y\napt-get install python3-pip -y\napt-get install pyqt5-dev-tools -y\n\ngit clone https://github.com/aq1/Hospital-Helper-2.git /home/vagrant/hh\ncd /home/vagrant/hh\n\npip3 install -r requirements.txt\n" }, { "alpha_fraction": 0.5102040767669678, "alphanum_fraction": 0.5382652878761292, "avg_line_length": 15.375, "blob_id": "79133be5abcdb605c2012c48aa3573ac342ef841", "content_id": "053ec63707f375afcbff521cfd4589894c46ad34", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 392, "license_type": "no_license", "max_line_length": 49, "num_lines": 24, "path": "/cerrado/fib-cache.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "from functools import wraps, lru_cache\n\n\ndef debugger(func):\n @wraps(func)\n def decorated_func(x):\n result = func(x)\n print(f'{func.__name__}({x}) = {result}')\n return result\n\n return decorated_func\n\n\n@debugger\n@lru_cache(512)\ndef fib(n):\n if n == 0:\n return 0\n elif n <= 1:\n return 1\n else:\n return fib(n - 1) + fib(n - 2)\n\nfib(40)" }, { "alpha_fraction": 0.6784511804580688, "alphanum_fraction": 0.6784511804580688, "avg_line_length": 28.649999618530273, "blob_id": "4544e14f64fe10370d70284d9b683051413f5ab6", "content_id": "58b8baa5d0f4f8bf5728df481c558ae5a30f78d4", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 594, "license_type": "no_license", "max_line_length": 75, "num_lines": 20, "path": "/djangosige/venv/Lib/site-packages/geraldo/generators/xmlstruct.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "# TODO\n\nfrom .base import ReportGenerator\n\nclass XMLStructGenerator(ReportGenerator):\n \"\"\"This is an **exporter** to output a XML format, with the goal to be\n used to import/export report classes. It ignores the queryset and just\n works with save/load the structure into a file.\n \n Would be nice use it also in a friendly JavaScript graphic tool to edit\n reports.\"\"\"\n filename = None\n\n def __init__(self, report, filename):\n super(XMLStructGenerator, self).__init__(report, *args, **kwargs)\n\n self.filename = filename\n\n def execute(self):\n pass\n\n" }, { "alpha_fraction": 0.6482213735580444, "alphanum_fraction": 0.6600790619850159, "avg_line_length": 24.350000381469727, "blob_id": "9438980eed38931ea440f2acf7f0c2e45648cde3", "content_id": "555b965fac74a5cd9ad44a92bfdc2c32fb239426", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 506, "license_type": "no_license", "max_line_length": 112, "num_lines": 20, "path": "/mathplot/matplot-004.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import numpy as np\nimport matplotlib.pyplot as plt\nimport datetime as DT\n\ndata= np.loadtxt('daily_count.csv', delimiter=',', dtype={'names': ('date', 'count'),'formats': ('S10', 'i4')} )\n\nx = [DT.datetime.strptime(key.decode('ascii'),'%Y-%m-%d') for (key, value) in data ]\ny = [value for (key, value) in data]\n\nfig = plt.figure()\nax = fig.add_subplot(111)\nax.grid()\n\nfig.autofmt_xdate()\n\nplt.plot(x,y,'b--o--')\nplt.xlabel('Date')\nplt.ylabel('Daily Count')\nplt.title('Daily Count since February')\nplt.show()" }, { "alpha_fraction": 0.5591616630554199, "alphanum_fraction": 0.5642486810684204, "avg_line_length": 34.61231994628906, "blob_id": "0665f278b5cfafb3f94661580b4573880d2c1edc", "content_id": "8f9b9221238ef1c82194454ee3c4137cca4caacb", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 9877, "license_type": "no_license", "max_line_length": 90, "num_lines": 276, "path": "/PyQT-CRUD-App/app/regdialogs/address.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/python3\n# -*- coding: utf-8 -*-\n\"\"\"\nДобавляем адреса и корпуса\nAdicione endereços e casos\n\"\"\"\nfrom app.tools.exitmethods import Dialog\nfrom app.db import data\nfrom functools import partial\nfrom sqlalchemy.orm import exc\nfrom PyQt5 import *\nfrom PyQt5.QtWidgets import *\nfrom PyQt5.QtGui import *\nfrom PyQt5.QtCore import *\nfrom PyQt5.Qt import *\n\n\nclass ConfigureAddresses(Dialog):\n def __init__(self, session):\n QDialog.__init__(self)\n self.session = session\n self.init_ui()\n\n def init_ui(self):\n self.resize(900, 800)\n self.setWindowModality(2)\n self.setWindowTitle('Endereços')\n self.setWindowIcon(QIcon(r'pics\\home.png'))\n\n self.addresses_list = QListWidget()\n self.blocks_list = QListWidget()\n self.blocks_list.itemDoubleClicked[QListWidgetItem].connect(\n self.edit_block_via_double_click\n )\n self.addresses_list.itemClicked.connect(self.fill_blocks)\n self.addresses_list.itemDoubleClicked[QListWidgetItem].connect(\n self.edit_address_via_double_click\n )\n\n QVBoxLayout(self)\n lists_layout = QHBoxLayout()\n lists_layout.addWidget(self.addresses_list)\n lists_layout.addWidget(self.blocks_list)\n self.layout().addLayout(lists_layout)\n\n accept_data_button = QPushButton(\"Salvar e sair\")\n accept_data_button.clicked.connect(self.accept)\n accept_data_button.setFixedSize(accept_data_button.sizeHint())\n self.layout().addWidget(\n accept_data_button, alignment=(Qt.AlignRight | Qt.AlignVCenter)\n )\n\n self.fill_addresses()\n\n def fill_addresses(self):\n self.addresses_list.clear()\n for address in self.session.query(data.Address). \\\n order_by(data.Address.name). \\\n all():\n address_widget = AddressWidget(address)\n address_widget.delete_button.clicked.connect(\n partial(self.delete_address, address=address)\n )\n address_widget.view_button.clicked.connect(\n partial(self.edit_address, address=address)\n )\n address_item = QListWidgetItem()\n address_item.setSizeHint(QSize(250, 75))\n self.addresses_list.addItem(address_item)\n self.addresses_list.setItemWidget(address_item, address_widget)\n add_item = QListWidgetItem()\n add_button = QPushButton(\"Adicione um endereço\")\n add_button.clicked.connect(self.add_address)\n add_item.setSizeHint(QSize(250, 75))\n self.addresses_list.addItem(add_item)\n self.addresses_list.setItemWidget(add_item, add_button)\n\n @pyqtSlot()\n def add_address(self):\n text, ok = QInputDialog.getText(\n self, 'Adicionando um novo endereço', 'Endereço:'\n )\n if ok:\n if not text:\n QMessageBox.warning(\n self, 'Aviso', 'O campo não pode estar vazio!'\n )\n return\n try:\n self.session.query(data.Address). \\\n filter_by(name=str(text)).one()\n except exc.NoResultFound:\n new_address = data.Address(name=str(text))\n self.session.add(new_address)\n self.fill_addresses()\n else:\n QMessageBox.warning(\n self, 'Aviso', 'Endereço já existe!'\n )\n\n @pyqtSlot(QListWidgetItem)\n def edit_address_via_double_click(self, item):\n address_widget = self.addresses_list.itemWidget(item)\n self.edit_address(address_widget.address)\n\n @pyqtSlot(data.Address)\n def edit_address(self, address):\n text, ok = QInputDialog.getText(\n self, 'Alterar endereço', 'Novo nome:'\n )\n if ok:\n if not text:\n QMessageBox.warning(\n self, 'Aviso', 'O campo não pode estar vazio!'\n )\n return\n try:\n self.session.query(data.Address). \\\n filter_by(name=str(text)).one()\n except exc.NoResultFound:\n address.name = str(text)\n self.fill_addresses()\n else:\n QMessageBox.warning(\n self, 'Aviso', 'Endereço já existe!'\n )\n\n @pyqtSlot(data.Address)\n def delete_address(self, address):\n reply = QMessageBox.question(self, 'Notificação',\n \"Excluir endereço {}?\".format(address.name),\n QMessageBox.Yes | QMessageBox.No, QMessageBox.No)\n if reply == QMessageBox.Yes:\n self.session.delete(address)\n self.fill_addresses()\n\n @pyqtSlot()\n def fill_blocks(self):\n self.blocks_list.clear()\n address_widget = self.addresses_list.itemWidget(self.addresses_list.currentItem())\n for block in self.session.query(data.Block). \\\n with_parent(address_widget.address). \\\n order_by(data.Block.name). \\\n all():\n block_item = QListWidgetItem()\n block_widget = BlockWidget(block)\n block_widget.delete_button.clicked.connect(\n partial(self.delete_block, block=block)\n )\n block_widget.view_button.clicked.connect(\n partial(self.edit_block, block=block)\n )\n block_item.setSizeHint(QSize(250, 75))\n self.blocks_list.addItem(block_item)\n self.blocks_list.setItemWidget(block_item, block_widget)\n\n add_item = QListWidgetItem()\n add_button = QPushButton(\"Adicionar anexo\")\n add_button.clicked.connect(\n partial(self.add_block, address=address_widget.address)\n )\n add_item.setSizeHint(QSize(250, 75))\n self.blocks_list.addItem(add_item)\n self.blocks_list.setItemWidget(add_item, add_button)\n\n @pyqtSlot(data.Address)\n def add_block(self, address):\n text, ok = QInputDialog.getText(\n self, 'Adicionando um novo recinto', 'Caso:'\n )\n if ok:\n if not text:\n QMessageBox.warning(\n self, 'Aviso', 'O campo não pode estar vazio!'\n )\n return\n try:\n self.session.query(data.Block). \\\n with_parent(address). \\\n filter_by(name=str(text)).one()\n except exc.NoResultFound:\n new_block = data.Block(name=str(text))\n address.block.append(new_block)\n self.session.add(new_block)\n self.fill_blocks()\n else:\n QMessageBox.warning(\n self, 'Atenção', 'O caso já existe!'\n )\n\n @pyqtSlot(QListWidgetItem)\n def edit_block_via_double_click(self, item):\n block_widget = self.blocks_list.itemWidget(item)\n self.edit_block(block_widget.block)\n\n @pyqtSlot(data.Block)\n def edit_block(self, block):\n text, ok = QInputDialog.getText(\n self, 'Mudando o casco', 'Novo nome:'\n )\n if ok:\n if not text:\n QMessageBox.warning(\n self, 'Aviso', 'O campo não pode estar vazio!'\n )\n return\n try:\n self.session.query(data.Block). \\\n with_parent(block.address). \\\n filter_by(name=str(text)).one()\n except exc.NoResultFound:\n block.name = str(text)\n self.fill_blocks()\n else:\n QMessageBox.warning(\n self, 'Atenção', 'O caso já existe!'\n )\n\n @pyqtSlot(data.Block)\n def delete_block(self, block):\n reply = QMessageBox.question(self, 'Notificação',\n \"Remova o caso {}?\".format(block.name),\n QMessageBox.Yes | QMessageBox.No, QMessageBox.No)\n if reply == QMessageBox.Yes:\n self.session.delete(block)\n self.fill_blocks()\n\n\nclass AddressWidget(QWidget):\n def __init__(self, address):\n QWidget.__init__(self)\n self.address = address\n icon = QLabel()\n pixmap = QPixmap(r'pics\\address.png')\n pixmap = pixmap.scaledToWidth(40)\n icon.setPixmap(pixmap)\n name = QLabel(\"<h3>{}<h3>\".format(address.name))\n self.view_button = QPushButton(\"Editar\")\n self.view_button.setFixedWidth(80)\n self.delete_button = QPushButton(\"Remover\")\n self.delete_button.setFixedWidth(80)\n\n buttons_layout = QVBoxLayout()\n buttons_layout.addWidget(self.view_button)\n buttons_layout.addWidget(self.delete_button)\n\n layout = QHBoxLayout(self)\n layout.addWidget(icon)\n layout.addWidget(name)\n layout.addStretch()\n layout.addLayout(buttons_layout)\n\n\nclass BlockWidget(QWidget):\n def __init__(self, block):\n QWidget.__init__(self)\n self.block = block\n icon = QLabel()\n pixmap = QPixmap(r'pics\\block.png')\n pixmap = pixmap.scaledToWidth(40)\n icon.setPixmap(pixmap)\n name = QLabel(\"<h3>{}<h3>\".format(block.name))\n self.view_button = QPushButton(\"Editar\")\n self.view_button.setFixedWidth(80)\n self.delete_button = QPushButton(\"Remover\")\n self.delete_button.setFixedWidth(80)\n\n buttons_layout = QVBoxLayout()\n buttons_layout.addWidget(self.view_button)\n buttons_layout.addWidget(self.delete_button)\n\n layout = QHBoxLayout(self)\n layout.addWidget(icon)\n layout.addWidget(name)\n layout.addStretch()\n layout.addLayout(buttons_layout)\n" }, { "alpha_fraction": 0.5727482438087463, "alphanum_fraction": 0.6327944397926331, "avg_line_length": 19.619047164916992, "blob_id": "8bca156d241163e038fff7a56ec11dfdaf39dc53", "content_id": "743f04c35b0a4f15882de75857e1328b151d37d6", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 433, "license_type": "no_license", "max_line_length": 42, "num_lines": 21, "path": "/pyqt5-curso/button.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "# A window with a button\nimport sys\nfrom PyQt5 import QtWidgets\n\n\ndef window():\n app = QtWidgets.QApplication(sys.argv)\n w = QtWidgets.QWidget()\n b = QtWidgets.QPushButton(w)\n l = QtWidgets.QLabel(w)\n b.setText('Push Me')\n l.setText('Look at Me')\n w.setWindowTitle('PyQt5 Lesson 3')\n b.move(100, 50)\n l.move(110, 100)\n w.setGeometry(100, 100, 300, 200)\n w.show()\n sys.exit(app.exec_())\n\n\nwindow()\n" }, { "alpha_fraction": 0.7183098793029785, "alphanum_fraction": 0.7605633735656738, "avg_line_length": 22.66666603088379, "blob_id": "2ad4195c6714fd63f13fbea8bb997a9962b0e0f7", "content_id": "beb14009636aac25c19a1cef416f0d356335e58b", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "C", "length_bytes": 71, "license_type": "no_license", "max_line_length": 35, "num_lines": 3, "path": "/djangosige/venv/Lib/site-packages/lxml/includes/lxml-version.h", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#ifndef LXML_VERSION_STRING\n#define LXML_VERSION_STRING \"4.2.6\"\n#endif\n" }, { "alpha_fraction": 0.5292837619781494, "alphanum_fraction": 0.5296463966369629, "avg_line_length": 29.30219841003418, "blob_id": "f8be893f157c6c63eb8fede5938c7e6d44d6dbd7", "content_id": "7d18cb825bbe5fb372f8ece44f757abba404385b", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 5515, "license_type": "no_license", "max_line_length": 113, "num_lines": 182, "path": "/Hospital-Helper-2-master/app/model/template.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import os\nimport datetime\nimport re\nimport json\nfrom collections import defaultdict\n\nfrom app.model import db, exceptions\n\n\nclass Template:\n\n def __init__(self, pk=None, item=None, items=None, name=None, body=None, conclusion=None):\n\n \"\"\"\n Parameter items is needed\n because template for one particular item\n can contain keywords from another items.\n And parameter item is needed too,\n because template needs to know for what item it is saved.\n \"\"\"\n\n self.pk = pk\n self.item = item\n self.items = items\n self.name = name\n self.body = body\n self.conclusion = conclusion\n\n def __str__(self):\n return 'Template \"{}\"'.format(self.name)\n\n def save(self):\n\n if not (self.item and self.name):\n raise exceptions.CannotSaveTemplate\n\n if not (self.body or self.conclusion):\n raise exceptions.NeedBodyOrConclusion\n\n if self.pk:\n template = db.SESSION.query(db.Template).get(self.pk)\n else:\n template = db.Template()\n\n template.item_id = self.item.id\n template.name = self.name\n template.body = self.body\n template.conclusion = self.conclusion\n template.save()\n self.pk = template.id\n\n def get_translated_body(self, reverse=False):\n \"\"\"\n This is bad function.\n \"\"\"\n \n regex = {}\n translation = {}\n\n if reverse:\n for each in self.items:\n for k in each.keys():\n regex[r'{%s.%s}' % (_(each.name), _(k))] = r'{%s[%s]}' % (each.name, k)\n translation = regex\n else:\n for each in self.items:\n for k in each.keys():\n regex[r'{%s\\[%s\\]}' % (each.name, k)] = r'{%s.%s}' % (_(each.name), _(k))\n translation[r'{%s[%s]}' % (each.name, k)] = r'{%s.%s}' % (_(each.name), _(k))\n\n pattern = re.compile(r'(' + '|'.join(regex.keys()) + r')')\n return pattern.sub(lambda x: translation[x.group()], self.body)\n\n def render_and_save(self):\n self.body = self.get_translated_body(reverse=True)\n self.save()\n\n @classmethod\n def get_from_db(cls, item, items, name):\n\n template = db.SESSION.query(db.Template).filter(\n db.Template.item_id == item.id, db.Template.name == name).first()\n\n return cls(pk=template.id,\n item=item,\n items=items,\n name=name,\n body=template.body,\n conclusion=template.conclusion)\n\n @classmethod\n def get_all(cls):\n\n result = defaultdict(list)\n templates = db.SESSION.query(db.Template).all()\n\n for each in templates:\n result[each.item.id].append(each)\n\n return result\n\n @classmethod\n def export(cls, path):\n \"\"\"\n Export all templates into JSON.\n :return\n bool status\n dict templates in json or error message\n \"\"\"\n\n path = os.path.join(path, 'hh_tmplts_{}.json'.format(datetime.datetime.now().strftime('%Y-%m-%d_%H-%M')))\n\n templates = [t.to_dict(relations={'item': {}})\n for t in db.SESSION.query(db.Template).join(db.Template.item).all()]\n\n if not templates:\n return False, {'error': 'No templates to export'}\n\n try:\n templates = json.dumps(templates, ensure_ascii=False)\n except (ValueError, TypeError) as e:\n return False, {'error': str(e)}\n\n try:\n with open(path, 'wb') as f:\n f.write(templates.encode('utf8'))\n except IOError as e:\n return False, {'error': str(e)}\n\n return True, {'result': templates}\n\n @classmethod\n def import_(cls, path):\n \"\"\"\n Import templates from JSON file.\n Warning: Existed templates with similar names will be overwritten.\n :return\n bool status\n dict result\n \"\"\"\n\n replaced_key = 'replaced'\n created_key = 'created'\n failed_key = 'fail'\n result = {\n replaced_key: defaultdict(list),\n created_key: defaultdict(list),\n failed_key: list()\n }\n\n templates_to_update = []\n\n try:\n with open(path, 'rb') as f:\n templates = json.loads(f.read().decode('utf8'))\n except (IOError, TypeError, ValueError) as e:\n return False, {'error': str(e)}\n\n for each in templates:\n item = db.SESSION.query(db.Item).filter(db.Item.name == each['item']['name']).first()\n if not item:\n result[failed_key].append('Item {} was not found'.format(_(each['item']['name'])))\n\n result_key = replaced_key\n template = db.SESSION.query(db.Template).filter(db.Template.item_id == item.id,\n db.Template.name == each['name']).first()\n\n if not template:\n result_key = created_key\n template = db.Template()\n\n for k, v in each.items():\n if k == 'id' or isinstance(v, dict):\n continue\n setattr(template, k, v)\n\n templates_to_update.append(template)\n result[result_key][item.name].append(template.name)\n\n db.SESSION.bulk_save_objects(templates_to_update)\n db.SESSION.flush()\n return True, result\n" }, { "alpha_fraction": 0.611372709274292, "alphanum_fraction": 0.6125800013542175, "avg_line_length": 27.76041603088379, "blob_id": "76953a99c989bf6f6e128d55a81a1c5ca80854e5", "content_id": "c2d42f6226d56d7f5770b2833de2cf7efcd7132a", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 8283, "license_type": "no_license", "max_line_length": 119, "num_lines": 288, "path": "/Hospital-Helper-2-master/app/model/db.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import datetime\nimport sqlite3\n\nimport slugify\n\nfrom sqlalchemy import exc, UniqueConstraint\nfrom sqlalchemy.ext.declarative import declarative_base\nfrom sqlalchemy.orm.session import sessionmaker\nfrom sqlalchemy.orm import relationship\nfrom sqlalchemy.orm import exc as orm_exc\nfrom sqlalchemy import create_engine\nfrom sqlalchemy import (Column, Integer, String, Float,\n ForeignKey, Date, SmallInteger,\n Text, Boolean)\n\nfrom app import options\n\nBase = declarative_base()\nengine = create_engine('sqlite:///{}'.format(options.DATABASE), echo=False)\nSESSION = sessionmaker()(bind=engine, autocommit=True, expire_on_commit=False)\n\n\nclass Model:\n @classmethod\n def get(cls, **kwargs):\n result = SESSION.query(cls).filter_by(**kwargs)\n quantity = result.count()\n\n if not quantity:\n raise orm_exc.NoResultFound('{}: {}'.format(cls.__name__, kwargs))\n\n if quantity > 1:\n raise orm_exc.MultipleResultsFound('{}: {}'.format(cls.__name__, kwargs))\n\n return result.first()\n\n @classmethod\n def get_or_create(cls, defaults=None, instant_flush=False, **kwargs):\n try:\n inst = cls.get(**kwargs)\n except orm_exc.NoResultFound:\n pass\n else:\n return inst, False\n\n if defaults:\n kwargs.update(defaults)\n\n inst = cls(**kwargs)\n SESSION.add(inst)\n\n if instant_flush:\n SESSION.flush()\n\n return inst, True\n\n def to_dict(self, relations=None):\n d = {}\n if relations is None:\n relations = {}\n\n for column in self.__table__.columns:\n d[column.name] = getattr(self, column.name)\n\n foreigners = {f.column.table.name for f in self.__table__.foreign_keys}\n for foreign in relations:\n if foreign not in foreigners:\n raise exc.NoForeignKeysError(foreign)\n else:\n d[foreign] = getattr(self, foreign).to_dict(relations=relations[foreign])\n return d\n\n def update(self, **kwargs):\n for k, v in kwargs.items():\n setattr(self, k, v)\n\n def save(self):\n SESSION.add(self)\n SESSION.flush()\n\n def delete(self):\n SESSION.delete(self)\n SESSION.flush()\n\n\nclass FakeORMResult(list):\n\n def __init__(self, fetch_results):\n for i, _ in enumerate(fetch_results):\n fetch_results[i] = Client(**{c: fetch_results[i][j] for (j, c) in enumerate(options.SEARCH_QUERY_COLUMNS)})\n super().__init__(fetch_results)\n\n def count(self, value=None):\n return len(self)\n\n\nclass Client(Base, Model):\n __tablename__ = options.CLIENT_TABLE_NAME\n\n id = Column(Integer, primary_key=True)\n surname = Column(String, nullable=False, default='')\n name = Column(String, nullable=False, default='')\n patronymic = Column(String, nullable=False, default='')\n age = Column(Integer, nullable=False, default=0)\n hr = Column(SmallInteger, nullable=False, default=0)\n height = Column(SmallInteger, nullable=False, default=0)\n weight = Column(SmallInteger, nullable=False, default=0)\n examined = Column(Date, nullable=False, default=datetime.datetime.now)\n sent_by = Column(String, nullable=False, default='')\n\n user_id = Column(ForeignKey('user.id'), nullable=False)\n user = relationship('User', backref=options.CLIENT_TABLE_NAME)\n\n deleted = Column(Boolean, nullable=False, default=False)\n\n def __str__(self):\n return '{} {} {}'.format(self.surname, self.name, self.patronymic)\n\n\nclass User(Base, Model):\n __tablename__ = 'user'\n\n id = Column(Integer, primary_key=True)\n organization_id = Column(ForeignKey('organization.id'), nullable=False)\n organization = relationship('Organization', backref='user', cascade='save-update, merge, delete')\n\n surname = Column(String, nullable=False)\n name = Column(String, nullable=False)\n patronymic = Column(String, nullable=False)\n\n deleted = Column(Boolean, nullable=False, default=False)\n\n def __str__(self):\n return '{} {:.1}. {:.1}.'.format(self.surname or '', self.name or '', self.patronymic or '')\n\n\nclass Organization(Base, Model):\n __tablename__ = 'organization'\n\n id = Column(Integer, primary_key=True)\n name = Column(String, nullable=False)\n header = Column(Text, nullable=False, default='')\n\n deleted = Column(Boolean, nullable=False, default=False)\n\n __table_args__ = tuple(UniqueConstraint('name'))\n\n def __str__(self):\n return self.name\n\n\nclass Report(Base, Model):\n __tablename__ = 'report'\n\n id = Column(Integer, primary_key=True)\n path = Column(String, nullable=False)\n\n client_id = Column(ForeignKey('{}.id'.format(options.CLIENT_TABLE_NAME)))\n client = relationship('Client', backref='report', cascade='save-update, merge, delete')\n\n def __str__(self):\n return self.path\n\n\nclass Group(Base, Model):\n __tablename__ = 'group'\n\n id = Column(Integer, primary_key=True)\n name = Column(String, nullable=False)\n\n __table_args__ = tuple(UniqueConstraint('name'))\n\n def __str__(self):\n return self.name\n\n\nclass Item(Base, Model):\n __tablename__ = 'item'\n\n id = Column(Integer, primary_key=True)\n name = Column(String, nullable=False)\n group_id = Column(ForeignKey('group.id'))\n group = relationship('Group', backref='item')\n\n __table_args__ = tuple(UniqueConstraint('group', 'name'))\n\n def __str__(self):\n return '{} {}'.format(self.group, self.name)\n\n\nclass Template(Base, Model):\n __tablename__ = 'template'\n\n id = Column(Integer, primary_key=True)\n name = Column(String, nullable=False, default='')\n body = Column(Text, nullable=False, default='')\n conclusion = Column(Text, nullable=False, default='')\n\n item_id = Column(ForeignKey('item.id'))\n item = relationship('Item', backref='template')\n\n __table_args__ = tuple(UniqueConstraint('item', 'name'))\n\n def __str__(self):\n return '{} {}'.format(self.item.name, self.name)\n\n\nclass KeyValue(Base, Model):\n __tablename__ = 'key_value'\n\n key = Column(String, primary_key=True)\n value = Column(String, nullable=False)\n\n __table_args__ = tuple(UniqueConstraint('key', 'value'))\n\n def __str__(self):\n return self.key\n\n\nclass Translation(Base, Model):\n __tablename__ = 'translation'\n\n sys = Column(String, primary_key=True)\n ru = Column(String, nullable=False)\n en = Column(String, nullable=True)\n\n def __str__(self):\n return self.sys\n\n\nclass ModelFactory:\n def __init__(self):\n self.default_type = 'float'\n\n self.tables = Base.metadata.tables\n\n self.field_type_map = {\n 'str': String,\n 'float': Float,\n 'int': Integer,\n 'text': Text,\n }\n\n def get_model(self, item):\n\n try:\n return self.tables[item['name']]\n except KeyError:\n pass\n\n fields = dict()\n fields['__tablename__'] = slugify.slugify(item['name'])\n fields['id'] = Column(Integer, primary_key=True)\n for f in item['args']:\n field_type = self.field_type_map[f.get('type', self.default_type)]\n fields[f['name']] = Column(field_type,\n nullable=False,\n default='')\n\n for rel in item.get('relations', []):\n fields[rel] = Column(\n ForeignKey('{}.id'.format(rel)), nullable=False)\n\n try:\n return type('{}Model'.format(item['name']), (Base,), fields)\n except exc.InvalidRequestError as e:\n print(e)\n return\n\n\ndef create_db():\n try:\n structure = SESSION.query(KeyValue).get(options.STRUCTURE_KEY)\n structure = structure.value\n except (AttributeError, exc.OperationalError):\n structure = KeyValue(key=options.STRUCTURE_KEY,\n value=options.INIT_STRUCTURE)\n SESSION.add(structure)\n structure = structure.value\n\n SESSION.flush()\n return structure\n\n\nBase.metadata.create_all(engine)\nraw_connection = sqlite3.connect(options.DATABASE)\nraw_connection.create_function('lowercase', 1, str.lower)\ncursor = raw_connection.cursor()\n" }, { "alpha_fraction": 0.5962059497833252, "alphanum_fraction": 0.6002709865570068, "avg_line_length": 20.735294342041016, "blob_id": "dffcccc25151b863064cb8dda6431ac6dda23af3", "content_id": "19b3e801cd9ebcd5f73273d4bc3595448c9b989f", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 738, "license_type": "no_license", "max_line_length": 40, "num_lines": 34, "path": "/PQt5-Stock/Modelo/telefono.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "__author__ = 'Vicio'\nfrom Modelo.persona import Persona\n\nclass Telefono(object):\n\n def __init__(self):\n self.__idTelefono = 0\n self.__tipo = \"\"\n self.__telefono = 0\n self.__idPersona = 0\n\n def setIdTelefono(self, idTelefono):\n self.__idTelefono = idTelefono\n\n def getIdTelefono(self):\n return self.__idTelefono\n\n def setTipo(self, tipo):\n self.__tipo = tipo\n\n def getTipo(self):\n return self.__tipo\n\n def setTelefono(self, telefono):\n self.__telefono =telefono\n\n def getTelefono(self):\n return self.__telefono\n\n def setIdPersona(self, idPersona):\n self.__idPersona = idPersona\n\n def getIdPersona(self):\n return self.__idPersona" }, { "alpha_fraction": 0.60687255859375, "alphanum_fraction": 0.6094459295272827, "avg_line_length": 38.3273811340332, "blob_id": "c7d0f55382a0df8cf1d22c3a0d13ff7949aeff51", "content_id": "e8cf4b03dceb792f7008e831716a03795c793828", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 6606, "license_type": "no_license", "max_line_length": 141, "num_lines": 168, "path": "/PQt5-Stock/Conexion/conexionProducto.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom Conexion.conexion import Conexion\nfrom Modelo.proveedor import Proveedor\nfrom Modelo.producto import Producto\nfrom Modelo.rubro import Rubro\nfrom Modelo.marca import Marca\nclass conexionProducto(object):\n\n def __init__(self):\n self.conexion = Conexion()\n self.producto = Producto()\n self.proveedor = Proveedor()\n self.rubro = Rubro()\n self.marca = Marca()\n\n def selectProducto(self, typeParameter, parameter, parameterState, parameterStock):\n query = \"\"\"\n SELECT p.idproductos, p.nombre, p.descripcion, CAST(TRUNCATE(p.pCompra, 2) AS CHAR), CAST(TRUNCATE(p.pVenta, 2) AS CHAR),\n p.genero, p.estado, p.cantidad, p.cant_minima, m.idmarcas, m.descripcion, r.idrubros,\n r.descripcion, prov.idproveedores, prov.descripcion\n FROM productos p, marcas m , rubros r, proveedores prov\n WHERE p.rubros_idrubros = r.idrubros and p.marcas_idmarcas = m.idmarcas and\n p.proveedores_idproveedores = prov.idproveedores and \"\"\"+ typeParameter + \"\"\" LIKE %s and\n p.estado LIKE %s\n \"\"\"\n param = parameter + '%'\n\n paramState = '1'\n if parameterState == 0:\n paramState = '%'\n\n if parameterStock == 1:\n query = query + \" and p.cantidad > 0\"\n\n values = (param, paramState)\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(query, values)\n listProducto = self.conexion.cursor.fetchall()\n self.conexion.cerrarConexion()\n return listProducto\n\n def modificarProducto(self, producto):\n query = \"\"\"\n UPDATE productos\n SET nombre= %s, cantidad= %s, descripcion= %s, rubros_idrubros= %s, proveedores_idproveedores=%s,\n marcas_idmarcas= %s, pCompra= %s, pVenta= %s, estado= %s, cant_minima= %s, genero= %s\n WHERE idproductos= %s\n \"\"\"\n idRubro = self.getIdRubro(producto.getRubro().getRubro())\n idMarca = self.getIdMarca(producto.getMarca().getMarca())\n idProveedor = self.getIdProveedor(producto.getProveedor().getDescripcion())\n values = (producto.getNombre(), producto.getCantidad(), producto.getDescripcion(), idRubro, idProveedor,\n idMarca, producto.getPrecioCompra(), producto.getPrecioVenta(), producto.getEstado(),\n producto.getCantidadMinima(), producto.getGenero(), producto.getIdProducto()\n )\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(query, values)\n self.conexion.db.commit()\n self.conexion.cerrarConexion()\n\n def insertarProducto(self, producto):\n query = \"\"\"\n INSERT INTO productos (nombre, cantidad, descripcion, rubros_idrubros,\n proveedores_idproveedores, marcas_idmarcas, pCompra, pVenta, estado,\n cant_minima, genero)\n VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)\n \"\"\"\n idRubro = self.getIdRubro(producto.getRubro().getRubro())\n idMarca = self.getIdMarca(producto.getMarca().getMarca())\n idProveedor = self.getIdProveedor(producto.getProveedor().getDescripcion())\n values = (producto.getNombre(), producto.getCantidad(), producto.getDescripcion(), idRubro, idProveedor,\n idMarca, producto.getPrecioCompra(), producto.getPrecioVenta(), producto.getEstado(),\n producto.getCantidadMinima(), producto.getGenero()\n )\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(query, values)\n self.conexion.db.commit()\n print(self.conexion.cursor._check_executed())\n print(self.conexion.cursor.messages)\n\n self.conexion.cerrarConexion()\n\n def borrarProducto(self, producto):\n query = \"\"\"\n UPDATE productos\n SET estado = 0\n WHERE idproductos = %s\n \"\"\"\n values = producto.getIdProducto()\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(query, values)\n self.conexion.cerrarConexion()\n\n def listMarcas(self):\n query = \"SELECT descripcion FROM marcas\"\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(query)\n listMarcasaux = self.conexion.cursor.fetchall()\n self.conexion.cerrarConexion()\n listMarcas = []\n listMarcas.append('')\n for marca in listMarcasaux:\n listMarcas.append(marca[0])\n\n return listMarcas\n\n def listRubro(self):\n query = \"SELECT descripcion FROM rubros\"\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(query)\n listRubrosaux = self.conexion.cursor.fetchall()\n self.conexion.cerrarConexion()\n listRubros = []\n listRubros.append('')\n for rubro in listRubrosaux:\n listRubros.append(rubro[0])\n\n return listRubros\n\n def listProveedor(self):\n query = \"SELECT descripcion FROM proveedores\"\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(query)\n listProveedoraux = self.conexion.cursor.fetchall()\n self.conexion.cerrarConexion()\n listProveedores = []\n listProveedores.append('')\n for proveedor in listProveedoraux:\n listProveedores.append(proveedor[0])\n\n return listProveedores\n\n def getIdProveedor(self, proveedor):\n query = \"SELECT idproveedores FROM proveedores WHERE descripcion = %s\"\n values = proveedor\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(query, values)\n\n result = self.conexion.cursor.fetchall()\n\n idProveedor = int(result[0][0])\n\n return idProveedor\n\n def getIdMarca(self, marca):\n query = \"SELECT idmarcas FROM marcas WHERE descripcion = %s\"\n values = marca\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(query, values)\n\n result = self.conexion.cursor.fetchall()\n\n idMarca = int(result[0][0])\n\n return idMarca\n\n def getIdRubro(self, rubro):\n query = \"SELECT idrubros FROM rubros WHERE descripcion = %s\"\n values = rubro\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(query, values)\n\n result = self.conexion.cursor.fetchall()\n\n idRubro = int(result[0][0])\n\n return idRubro" }, { "alpha_fraction": 0.5980346202850342, "alphanum_fraction": 0.6031820178031921, "avg_line_length": 22.2391300201416, "blob_id": "b67378e4535b1d008e3432176bc1943a299235b2", "content_id": "83b297b2efbc9a35a85ab7acff9a07158b99eb23", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2137, "license_type": "no_license", "max_line_length": 44, "num_lines": 92, "path": "/PQt5-Stock/Modelo/producto.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom Modelo.proveedor import Proveedor\nfrom Modelo.marca import Marca\nfrom Modelo.rubro import Rubro\nclass Producto(object):\n def __init__(self):\n\n self.__idProducto = 0\n self.__nombre = \"\"\n self.__cantidad = 0\n self.__cantidadMinima = 0\n self.__descripcion = \"\"\n self.__genero = \"\"\n self.__rubro = Rubro()\n self.__proveedor = Proveedor()\n self.__marca = Marca()\n self.__estado = 0\n self.__pCompra = 0,00\n self.__pVenta = 0,00\n\n def setIdProducto(self, idProducto):\n self.__idProducto = idProducto\n\n def getIdProducto(self):\n return self.__idProducto\n\n def setNombre(self, nombre):\n self.__nombre = nombre\n\n def getNombre(self):\n return self.__nombre\n\n def setCantidad(self, cantidad):\n self.__cantidad = cantidad\n\n def getCantidad(self):\n return self.__cantidad\n\n def setCantidadMinima(self, cantMinima):\n self.__cantidadMinima = cantMinima\n\n def getCantidadMinima(self):\n return self.__cantidadMinima\n\n def setDescripcion(self, descripcion):\n self.__descripcion = descripcion\n\n def getDescripcion(self):\n return self.__descripcion\n\n def setGenero(self, genero):\n self.__genero = genero\n\n def getGenero(self):\n return self.__genero\n\n def setRubro(self, rubro):\n self.__rubro = rubro\n\n def getRubro(self):\n return self.__rubro\n\n def setProveedor(self, proveedor):\n self.__proveedor = proveedor\n\n def getProveedor(self):\n return self.__proveedor\n\n def setMarca(self, marca):\n self.__marca = marca\n\n def getMarca(self):\n return self.__marca\n\n def setEstado(self, estado):\n self.__estado = estado\n\n def getEstado(self):\n return self.__estado\n\n def setPrecioCompra(self, pCompra):\n self.__pCompra = pCompra\n\n def getPrecioCompra(self):\n return self.__pCompra\n\n def setPrecioVenta(self, pVenta):\n self.__pVenta = pVenta\n\n def getPrecioVenta(self):\n return self.__pVenta" }, { "alpha_fraction": 0.5811966061592102, "alphanum_fraction": 0.5818070769309998, "avg_line_length": 39.432098388671875, "blob_id": "ba656fa41f44602ecfdc7582cc8de421f42e2e4b", "content_id": "932c14dab6cc498c2c69ab5a69f085b90a1e57b4", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3276, "license_type": "no_license", "max_line_length": 122, "num_lines": 81, "path": "/PQt5-Stock/Conexion/conexionList.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "__author__ = 'Vicio'\nfrom Conexion.conexion import Conexion\n\n\nclass ConexionList():\n\n def __init__(self):\n self.conexion = Conexion()\n\n\n\n def selectClientesTransacciones(self):\n query = \"\"\"\n SELECT c.idclientes, c.apellido, p.nombre, SUM(dm.precio_unitario * dm.cantidad ) as monto\n FROM clientes c, movimiento m, tipo_movimiento tm, detalle_movimiento dm, personas p\n WHERE c.idclientes = tm.clientes_idclientes and\n m.tipo_movimiento_idtipo_movimiento = tm.idtipo_movimiento and\n m.idmovimiento = dm.movimiento_idmovimiento and\n m.estado = 0 and\n p.idpersonas = c.personas_idpersonas\n GROUP BY tm.clientes_idclientes\n ORDER BY monto desc\n \"\"\"\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(query)\n listClientes = self.conexion.cursor.fetchall()\n self.conexion.cerrarConexion()\n\n return listClientes\n\n\n def selectClientesPagos(self):\n query = \"\"\"\n SELECT c.idclientes, SUM(p.monto)\n FROM clientes c, pagos p, tipo_movimiento tm\n WHERE tm.clientes_idclientes = c.idclientes and\n p.tipo_movimiento_idtipo_movimiento = tm.idtipo_movimiento\n GROUP BY c.idclientes\n \"\"\"\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(query)\n listClientes = self.conexion.cursor.fetchall()\n self.conexion.cerrarConexion()\n\n return listClientes\n\n\n def selectProveedoresTransacciones(self):\n query = \"\"\"\n SELECT prov.idproveedores, prov.descripcion, p.nombre, SUM(dm.precio_unitario * dm.cantidad ) as monto\n FROM proveedores prov, movimiento m, tipo_movimiento tm, detalle_movimiento dm, personas p\n WHERE prov.idproveedores = tm.proveedores_idproveedores and\n m.tipo_movimiento_idtipo_movimiento = tm.idtipo_movimiento and\n m.idmovimiento = dm.movimiento_idmovimiento and\n m.estado = 0 and\n p.idpersonas = prov.personas_idpersonas\n GROUP BY tm.proveedores_idproveedores\n ORDER BY monto desc\n \"\"\"\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(query)\n listProveedores = self.conexion.cursor.fetchall()\n self.conexion.cerrarConexion()\n\n return listProveedores\n\n def selectProveedoresPagos(self):\n query = \"\"\"\n SELECT prov.idproveedores, SUM(p.monto)\n FROM proveedores prov, pagos p, tipo_movimiento tm\n WHERE tm.proveedores_idproveedores = prov.idproveedores and\n p.tipo_movimiento_idtipo_movimiento = tm.idtipo_movimiento\n GROUP BY prov.idproveedores\n \"\"\"\n\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(query)\n listProveedores = self.conexion.cursor.fetchall()\n self.conexion.cerrarConexion()\n\n return listProveedores\n\n" }, { "alpha_fraction": 0.84375, "alphanum_fraction": 0.84375, "avg_line_length": 31, "blob_id": "7810d31637693ee19b5aa9105394fa3332cf8b21", "content_id": "f0d888396637aba62062c63f513a417eb6cc83a7", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 96, "license_type": "no_license", "max_line_length": 35, "num_lines": 3, "path": "/pong/widgets/__init__.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "from widgets.Pong import Pong\nfrom widgets.Raquete import Raquete\nfrom widgets.Bola import Bola\n" }, { "alpha_fraction": 0.5197568535804749, "alphanum_fraction": 0.5369807481765747, "avg_line_length": 21.159090042114258, "blob_id": "37f9f67456b7b39db2f5abba78c01b267452e6a5", "content_id": "6bf9ec45378a0086b49688ab6049d2d98fd737d9", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 987, "license_type": "no_license", "max_line_length": 94, "num_lines": 44, "path": "/PQt5-Stock/Conexion/conexion.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport pymysql\n\n\n\n\nclass Conexion(object):\n '''\n classdocs\n '''\n\n\n def __init__(self):\n self.db_host ='192.168.254.133'\n self.db_port = 3306\n self.db_user = 'root'\n self.db_pass = '1Linh@00'\n self.db_name ='db_perfumeria'\n \n\n def conectar(self):\n self.db = pymysql.connect(host=self.db_host, user=self.db_user,\n passwd=self.db_pass, db=self.db_name)\n\n def abrir_cursor(self):\n self.cursor = self.db.cursor()\n\n \n def cerrar_cursor(self):\n self.cursor.close()\n \n def cerrar_conexion(self):\n self.db.close()\n\n def abrirConexion(self):\n if (self.db_host and self.db_name and self.db_pass and self.db_port and self.db_user):\n self.conectar()\n self.abrir_cursor()\n \n def cerrarConexion(self):\n self.cerrar_cursor()\n self.cerrar_conexion()\n " }, { "alpha_fraction": 0.3190607726573944, "alphanum_fraction": 0.45856353640556335, "avg_line_length": 39.22222137451172, "blob_id": "d11fef9ef8d0de3af9ff3c86c83a08880e4de7d5", "content_id": "8780bae4aeb281fb06a03b6ec43257f65d97342b", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 724, "license_type": "no_license", "max_line_length": 460, "num_lines": 18, "path": "/isEmailCbl.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/python\n\nimport sys\nimport re\n\n\ndef isEmail(email):\n \"\"\"Verifica se o email -e valido\"\"\"\n if not re.match(r\"(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|\\\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\\\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])\", email):\n return(0)\n return(1)\n\n\nif __name__ == \"__main__\":\n if(len(sys.argv) < 2):\n sys.exit(0)\n email = sys.argv[1]\n sys.exit(isEmail(email))\n" }, { "alpha_fraction": 0.6399999856948853, "alphanum_fraction": 0.6437956094741821, "avg_line_length": 38.83720779418945, "blob_id": "ad29e7e959f1f1530b2b8b1c1d1ceca43b80f608", "content_id": "b20177ddaa61ed518b6b88f748972791f32a64bd", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3425, "license_type": "no_license", "max_line_length": 77, "num_lines": 86, "path": "/pyside2/datavisualize/datavisualize5/table_model.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#############################################################################\n##\n## Copyright (C) 2016 The Qt Company Ltd.\n## Contact: http://www.qt.io/licensing/\n##\n## This file is part of the Qt for Python examples of the Qt Toolkit.\n##\n## $QT_BEGIN_LICENSE:BSD$\n## You may use this file under the terms of the BSD license as follows:\n##\n## \"Redistribution and use in source and binary forms, with or without\n## modification, are permitted provided that the following conditions are\n## met:\n## * Redistributions of source code must retain the above copyright\n## notice, this list of conditions and the following disclaimer.\n## * Redistributions in binary form must reproduce the above copyright\n## notice, this list of conditions and the following disclaimer in\n## the documentation and/or other materials provided with the\n## distribution.\n## * Neither the name of The Qt Company Ltd nor the names of its\n## contributors may be used to endorse or promote products derived\n## from this software without specific prior written permission.\n##\n##\n## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n## \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\"\n##\n## $QT_END_LICENSE$\n##\n#############################################################################\n\nfrom PySide2.QtCore import (Qt, QAbstractTableModel, QModelIndex)\nfrom PySide2.QtGui import QColor\n\nclass CustomTableModel(QAbstractTableModel):\n def __init__(self, data=None):\n QAbstractTableModel.__init__(self)\n self.load_data(data)\n\n def load_data(self, data):\n self.input_dates = data[0].values\n self.input_magnitudes = data[1].values\n\n self.column_count = 2\n self.row_count = len(self.input_magnitudes)\n\n def rowCount(self, parent=QModelIndex()):\n return self.row_count\n\n def columnCount(self, parent=QModelIndex()):\n return self.column_count\n\n def headerData(self, section, orientation, role):\n if role != Qt.DisplayRole:\n return None\n if orientation == Qt.Horizontal:\n return (\"Date\", \"Magnitude\")[section]\n else:\n return \"{}\".format(section)\n\n def data(self, index, role = Qt.DisplayRole):\n column = index.column()\n row = index.row()\n\n if role == Qt.DisplayRole:\n if column == 0:\n raw_date = self.input_dates[row]\n date = \"{}\".format(raw_date.toPython())\n return date[:-3]\n elif column == 1:\n return \"{:.2f}\".format(self.input_magnitudes[row])\n elif role == Qt.BackgroundRole:\n return QColor(Qt.white)\n elif role == Qt.TextAlignmentRole:\n return Qt.AlignRight\n\n return None" }, { "alpha_fraction": 0.38439512252807617, "alphanum_fraction": 0.48604151606559753, "avg_line_length": 15.045976638793945, "blob_id": "7337e5321f67717547753843d9413121394f6682", "content_id": "cbe7dd4c05c62b94796ed000ffae73de81ec0f80", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1397, "license_type": "no_license", "max_line_length": 37, "num_lines": 87, "path": "/djangosige/venv/Lib/site-packages/pysignfe/nfe/webservices_flags.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n\n\nWS_NFE_ENVIO_LOTE = 0\nWS_NFE_CONSULTA_RECIBO = 1\nWS_NFE_CANCELAMENTO = 2\nWS_NFE_INUTILIZACAO = 3\nWS_NFE_CONSULTA = 4\nWS_NFE_SITUACAO = 5\nWS_NFE_CONSULTA_CADASTRO = 6\n\nWS_DPEC_RECEPCAO = 7\nWS_DPEC_CONSULTA = 8\nWS_NFE_EVENTO= 9\nWS_NFE_CONSULTA_DESTINATARIO = 10\nWS_NFE_DOWNLOAD_XML_DESTINATARIO = 11\nWS_NFE_AUTORIZACAO = 12\nWS_NFE_RET_AUTORIZACAO = 13\n\nNFE_AMBIENTE_PRODUCAO = 1\nNFE_AMBIENTE_HOMOLOGACAO = 2\n\nPROC_ENVIO_NFE = 101\nPROC_CANCELAMENTO_NFE = 102\nPROC_INUTILIZACAO_NFE = 103\n\nUF_CODIGO = {\n u'AC': 12,\n u'AL': 27,\n u'AM': 13,\n u'AP': 16,\n u'BA': 29,\n u'CE': 23,\n u'DF': 53,\n u'ES': 32,\n u'GO': 52,\n u'MA': 21,\n u'MG': 31,\n u'MS': 50,\n u'MT': 51,\n u'PA': 15,\n u'PB': 25,\n u'PE': 26,\n u'PI': 22,\n u'PR': 41,\n u'RJ': 33,\n u'RN': 24,\n u'RO': 11,\n u'RR': 14,\n u'RS': 43,\n u'SC': 42,\n u'SE': 28,\n u'SP': 35,\n u'TO': 17,\n u'NACIONAL': 91,\n}\n\nCODIGO_UF = {\n 12: u'AC',\n 27: u'AL',\n 13: u'AM',\n 16: u'AP',\n 29: u'BA',\n 23: u'CE',\n 53: u'DF',\n 32: u'ES',\n 52: u'GO',\n 21: u'MA',\n 31: u'MG',\n 50: u'MS',\n 51: u'MT',\n 15: u'PA',\n 25: u'PB',\n 26: u'PE',\n 22: u'PI',\n 41: u'PR',\n 33: u'RJ',\n 24: u'RN',\n 11: u'RO',\n 14: u'RR',\n 43: u'RS',\n 42: u'SC',\n 28: u'SE',\n 35: u'SP',\n 17: u'TO',\n 91: u'NACIONAL',\n}\n\n" }, { "alpha_fraction": 0.4901960790157318, "alphanum_fraction": 0.5196078419685364, "avg_line_length": 10.333333015441895, "blob_id": "0ea820ec9c9bf3b24496ec3d657144adfe318a6c", "content_id": "674b0e1b90d022fcb06ed5e6f8b7f8bd75613a11", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 102, "license_type": "no_license", "max_line_length": 19, "num_lines": 9, "path": "/yield-001.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "def numeros():\n yield 1\n yield 2\n yield 3\n\n\nfor i in numeros():\n print(i)\n print('\\n')\n" }, { "alpha_fraction": 0.6169878840446472, "alphanum_fraction": 0.6178843379020691, "avg_line_length": 34.404762268066406, "blob_id": "4e922656337533799b8bff93dad75cfdc7a4363b", "content_id": "ff2e304ed64ddbe0a14270548cd79e5aa594db81", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 4462, "license_type": "no_license", "max_line_length": 108, "num_lines": 126, "path": "/djangosige/venv/Lib/site-packages/geraldo/generators/csvgen.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import datetime, csv\nfrom .base import ReportGenerator\n\nfrom geraldo.utils import get_attr_value, calculate_size\nfrom geraldo.widgets import Widget, Label, SystemField, ObjectValue\nfrom geraldo.graphics import Graphic, RoundRect, Rect, Line, Circle, Arc,\\\n Ellipse, Image\nfrom geraldo.exceptions import AbortEvent\n\nclass CSVGenerator(ReportGenerator):\n \"\"\"This is a generator to output data in CSV format. This format can be imported as a\n spreadsheet to Excel, OpenOffice Calc, Google Docs Spreadsheet, and others.\n\n Attributes:\n\n * 'filename' - is the file path you can inform optionally to save text to.\n * 'writer' - is csv.writer function you can inform manually to make it customizable.\n This function must expects a first argument to receive a file object and\n returns a csv.writer object.\n \"\"\"\n writer = None\n writer_function = csv.writer\n first_row_with_column_names = False\n\n mimetype = 'text/csv'\n\n def __init__(self, report, cache_enabled=None, writer=None, first_row_with_column_names=None, **kwargs):\n super(CSVGenerator, self).__init__(report, **kwargs)\n\n # Cache enabled\n if cache_enabled is not None:\n self.cache_enabled = cache_enabled\n elif self.cache_enabled is None:\n self.cache_enabled = bool(self.report.cache_status)\n\n # Sets the writer function\n self.writer = writer or self.writer\n\n # Sets to append the first row with column names (ObjectValue name/attribute_name/expression)\n if first_row_with_column_names is not None:\n self.first_row_with_column_names = first_row_with_column_names\n\n # Additional attributes\n for k,v in list(kwargs.items()):\n setattr(self, k, v)\n\n def start_writer(self, filename=None):\n if self.writer:\n return\n\n filename = filename or self.filename\n\n if isinstance(filename, str):\n filename = file(filename, 'w')\n\n # Default writer uses comma as separator and quotes only when necessary\n self.writer = self.writer_function(filename, quoting=csv.QUOTE_MINIMAL)\n\n def execute(self):\n super(CSVGenerator, self).execute()\n\n # Calls the before_print event\n self.report.do_before_print(generator=self)\n\n # Write the CSV output\n self.generate_csv()\n\n # Calls the after_print event\n self.report.do_after_print(generator=self)\n\n def get_hash_key(self, objects):\n \"\"\"Appends pdf extension to the hash_key\"\"\"\n return super(CSVGenerator, self).get_hash_key(objects) + '.csv'\n\n # METHODS THAT ARE TOTALLY SPECIFIC TO THIS GENERATOR AND MUST\n # OVERRIDE THE SUPERCLASS EQUIVALENT ONES\n\n def generate_csv(self):\n \"\"\"Generates the CSV output\"\"\"\n\n self._current_object_index = 0\n objects = self.report.get_objects_list()\n\n self.start_writer()\n\n # Make a sorted list of columns\n columns = [el for el in self.report.band_detail.elements if isinstance(el, ObjectValue)]\n columns.sort(lambda a,b: cmp(a.left, b.left) or cmp(a.width, b.width))\n\n # First row with column names\n if self.first_row_with_column_names:\n cells = [(col.name or col.expression or col.attribute_name) for col in columns]\n for i in range(len(cells)):\n if isinstance(cell[i], str):\n cell[i] = cell[i].encode('utf-8')\n\n self.writer.writerow(cells)\n\n while self._current_object_index < len(objects):\n # Get current object from list\n self._current_object = objects[self._current_object_index]\n\n cells = []\n\n for element in columns:\n widget = element.clone()\n\n # Set widget colors\n widget.font_color = self.report.default_font_color\n\n # Set widget basic attributes\n widget.instance = self._current_object\n widget.generator = self\n widget.report = self.report\n widget.band = self.report.band_detail\n widget.page = None\n\n if isinstance(widget.text, str):\n cells.append(widget.text.encode('utf-8'))\n else:\n cells.append(widget.text)\n\n # Next object\n self._current_object_index += 1\n\n self.writer.writerow(cells)\n\n" }, { "alpha_fraction": 0.4583333432674408, "alphanum_fraction": 0.5, "avg_line_length": 15.714285850524902, "blob_id": "c50a2e92310d701728ca3db62f52ed8e43df7a8c", "content_id": "43b5fbcd9ccdd39822ce9c9a7f711d9248f915f7", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 120, "license_type": "no_license", "max_line_length": 28, "num_lines": 7, "path": "/yield-002.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "def impar(elems):\n for i in elems:\n if i % 2:\n yield i\n\nfor x in impar(range(1000)):\n print(x) " }, { "alpha_fraction": 0.6776099801063538, "alphanum_fraction": 0.6776099801063538, "avg_line_length": 41.19444274902344, "blob_id": "75db3d0f444a8a1f39ea9fc241ee559a38c3100c", "content_id": "d715cd1f5388ca693078bc9ce0464891811c01af", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1525, "license_type": "no_license", "max_line_length": 86, "num_lines": 36, "path": "/fullmon/mon.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import psutil\n\n# print(\"psutil.cpu_count()\",psutil.cpu_count())\n# print(\"psutil.cpu_freq()\",psutil.cpu_freq())\n# print(\"psutil.cpu_percent()\",psutil.cpu_percent())\n# print(\"psutil.cpu_stats()\",psutil.cpu_stats())\n# print(\"psutil.cpu_times()\",psutil.cpu_times())\n# print(\"psutil.cpu_times_percent()\",psutil.cpu_times_percent())\n# print(\"psutil.virtual_memory()\",psutil.virtual_memory())\n# print(\"psutil.swap_memory()\",psutil.swap_memory())\n# print(\"psutil.disk_partitions()\",psutil.disk_partitions())\n# print(\"psutil.disk_usage('c:\\\\')\",psutil.disk_usage('c:\\\\'))\n# print(\"psutil.disk_io_counters()\",psutil.disk_io_counters())\n# print(\"psutil.disk_io_counters(perdisk=True)\",psutil.disk_io_counters(perdisk=True))\n# print(\"psutil.net_io_counters()\",psutil.net_io_counters())\n# print(\"psutil.net_io_counters(pernic=True)\",psutil.net_io_counters(pernic=True))\n# print(\"psutil.net_connections()\",psutil.net_connections())\np = psutil.Process()\n\nwith p.oneshot():\n p.name() # execute internal routine once collecting multiple info\n p.cpu_times() # return cached value\n p.cpu_percent() # return cached value\n p.create_time() # return cached value\n p.ppid() # return cached value\n p.status() # return cached value\n\nprint(p)\nprint(\"p.open_files()\",p.open_files())\n\nprint('Lista de processos em execução:')\nfor proc in psutil.process_iter():\n # info = proc.as_dict(attrs=['pid', 'name'])\n info = proc.as_dict()\n # print('Processo: {} (PID: {})'.format(info['pid'], info['name']))\n print(info)\n " }, { "alpha_fraction": 0.6569343209266663, "alphanum_fraction": 0.7700729966163635, "avg_line_length": 26.5, "blob_id": "564e0ecde3c40a300a6514c5b572cb1c01cd6838", "content_id": "29e3be9cab54bc8e2ea4cc8c4b2760ab6410d913", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "INI", "length_bytes": 275, "license_type": "no_license", "max_line_length": 90, "num_lines": 10, "path": "/flavio/xmls.ini", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "[xmls]\npasta = S:\\bellasoft\\bellasoft\\Exec\\CFeEnviados\\23229960000123\\{anomes}\\CFe\\23229960000123\n\n[backup]\n# conexão com o servidor\nsmtp_ssl_host = smtp.bellasoft.com.br\nsmtp_ssl_port = 587\n# username ou email para logar no servidor\nusername = teste@bellasoft.com.br\npassword = bueno2021" }, { "alpha_fraction": 0.6036308407783508, "alphanum_fraction": 0.606656551361084, "avg_line_length": 33.350650787353516, "blob_id": "6801fc202d1a817eda664af4554353eca0fd84fd", "content_id": "d87b98ead2b61cda4696266e116aa221140d207a", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2647, "license_type": "no_license", "max_line_length": 95, "num_lines": 77, "path": "/e-mail/envia_email.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import mimetypes\nimport os\nimport smtplib\nfrom email import encoders\nfrom email.mime.audio import MIMEAudio\nfrom email.mime.base import MIMEBase\nfrom email.mime.image import MIMEImage\nfrom email.mime.multipart import MIMEMultipart\nfrom email.mime.text import MIMEText\nfrom six.moves import configparser\n\ndef adiciona_anexo(msg, filename):\n if not os.path.isfile(filename):\n return\n ctype, encoding = mimetypes.guess_type(filename)\n if ctype is None or encoding is not None:\n ctype = 'application/octet-stream'\n maintype, subtype = ctype.split('/', 1)\n if maintype == 'text':\n with open(filename) as f:\n mime = MIMEText(f.read(), _subtype=subtype)\n elif maintype == 'image':\n with open(filename, 'rb') as f:\n mime = MIMEImage(f.read(), _subtype=subtype)\n elif maintype == 'audio':\n with open(filename, 'rb') as f:\n mime = MIMEAudio(f.read(), _subtype=subtype)\n else:\n with open(filename, 'rb') as f:\n mime = MIMEBase(maintype, subtype)\n mime.set_payload(f.read())\n encoders.encode_base64(mime)\n mime.add_header('Content-Disposition', 'attachment', filename=filename)\n msg.attach(mime)\n\ndef envia_email(de, para, subject, email, anexo):\n '''\n envia_email\n de = string\n para = array de strings\n subject = string\n email = string\n anexo = array de strings\n '''\n\n cfg = configparser.ConfigParser()\n cfg.read('backup.ini')\n\n # conexão com o servidor\n smtp_ssl_host = cfg.get('backup', 'smtp_ssl_host')\n smtp_ssl_port = cfg.getint('backup', 'smtp_ssl_port')\n # username ou email para logar no servidor\n username = cfg.get('backup', 'username')\n password = cfg.get('backup', 'password')\n\n # de = 'backup@1linha.com.br'\n # para = ['bueno@1linha.com.br']\n msg = MIMEMultipart()\n msg['From'] = de\n msg['To'] = ', '.join(para)\n msg['Subject'] = subject\n # Corpo da mensagem\n msg.add_header('Content-Type', 'text/html')\n # msg.set_payload(email)\n # msg.attach(MIMEText('Backup ' + date.strftime(\"%d/%m/%Y\"), 'html', 'utf-8'))\n msg.attach(MIMEText(email, 'html', 'utf-8'))\n # Arquivos anexos.\n for anx in anexo:\n adiciona_anexo(msg, anx)\n raw = msg.as_string()\n # smtp = smtplib.SMTP_SSL(‘smtp.gmail.com', 465)\n smtp = smtplib.SMTP('{smtp_ssl_host}: {smtp_ssl_port}'.format(smtp_ssl_host=smtp_ssl_host, \n smtp_ssl_port=smtp_ssl_port))\n smtp.starttls()\n smtp.login(username, password)\n smtp.sendmail(de, para, raw)\n smtp.quit()" }, { "alpha_fraction": 0.5502318143844604, "alphanum_fraction": 0.5507470369338989, "avg_line_length": 33.05263137817383, "blob_id": "0c4bee157b7b00ebba00ce77f1bd67d9e35aa5f7", "content_id": "8204b427648ffd5b773de05ddbc3222e03b5c2b8", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1941, "license_type": "no_license", "max_line_length": 92, "num_lines": 57, "path": "/Hospital-Helper-2-master/main.spec", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "# -*- mode: python -*-\n\nimport os\nimport importlib\nimport inspect\n\nblock_cipher = None\n\nROOT = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))\nSTATIC = os.path.join(ROOT, 'app', 'gui', 'static')\n\nDATAS = [\n (os.path.join(STATIC, 'icons', '*.png'), os.path.join('app', 'gui', 'static', 'icons')),\n (os.path.join(STATIC, 'style', '*.qss'), os.path.join('app', 'gui', 'static', 'style')),\n (os.path.join(STATIC, '*.png'), os.path.join('app', 'gui', 'static')),\n (os.path.join(STATIC, '*.ico'), os.path.join('app', 'gui', 'static')),\n (os.path.join(ROOT, 'app', 'data', '*.json'), os.path.join('app', 'data')),\n]\n\ndef get_module_imports(*modules_names):\n # I'm not sure if it is a good decision\n # but it works with my modules\n files = []\n for module_name in modules_names:\n module_dir = os.path.dirname(importlib.import_module(module_name).__file__)\n for each in os.listdir(module_dir):\n if each.endswith('.py'):\n # f = os.path.join(module_dir, each)\n # files.append(os.path.join(module_dir, each))\n files.append('%s.%s' % (module_name, each.replace('.py', '')))\n return files\n\n\na = Analysis([os.path.join(ROOT, 'app', 'main.py')],\n pathex=[ROOT],\n binaries=None,\n datas=DATAS,\n hiddenimports=get_module_imports('unidecode'),\n hookspath=[],\n runtime_hooks=[],\n excludes=[],\n win_no_prefer_redirects=False,\n win_private_assemblies=False,\n cipher=block_cipher)\npyz = PYZ(a.pure, a.zipped_data,\n cipher=block_cipher)\nexe = EXE(pyz,\n a.scripts,\n a.binaries,\n a.zipfiles,\n a.datas,\n name='Hospital Helper 2',\n debug=False,\n strip=False,\n upx=True,\n console=False,\n icon=os.path.join(STATIC, 'icon.ico'))\n" }, { "alpha_fraction": 0.689039409160614, "alphanum_fraction": 0.8041871786117554, "avg_line_length": 32.132652282714844, "blob_id": "f6653267b75ba8c2901d62dc75f710f909ef025c", "content_id": "5c63d9bd61866802a51b657e1c13069794fb0f3b", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3258, "license_type": "no_license", "max_line_length": 88, "num_lines": 98, "path": "/djangosige/venv/Lib/site-packages/pysignfe/nfe/manual_700/__init__.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n\n\nESQUEMA_ATUAL = u'PL_009_V4'\n\n#\n# Envelopes SOAP\n#\nfrom .soap_400 import SOAPEnvio as SOAPEnvio_400\nfrom .soap_400 import SOAPRetorno as SOAPRetorno_400\n\n#\n# Emissão de NF-e 4.00\n#\nfrom .nfe_400 import NFe as NFe_400\nfrom .nfe_400 import NFRef as NFRef_400\nfrom .nfe_400 import Det as Det_400\nfrom .nfe_400 import DI as DI_400\nfrom .nfe_400 import Adi as Adi_400\nfrom .nfe_400 import Med as Med_400\nfrom .nfe_400 import Arma as Arma_400\nfrom .nfe_400 import Reboque as Reboque_400\nfrom .nfe_400 import Vol as Vol_400\nfrom .nfe_400 import Lacres as Lacres_400\nfrom .nfe_400 import Dup as Dup_400\nfrom .nfe_400 import ObsCont as ObsCont_400\nfrom .nfe_400 import ObsFisco as ObsFisco_400\nfrom .nfe_400 import ProcRef as ProcRef_400\n\n#\n# Envio de lote de NF-e\n#\nfrom pysignfe.nfe.manual_600 import EnviNFe_310 as EnviNFe_400\nfrom pysignfe.nfe.manual_600 import RetEnviNFe_310 as RetEnviNFe_400\n\n#\n# Consulta do recibo do lote de NF-e\n#\nfrom pysignfe.nfe.manual_600 import ConsReciNFe_310 as ConsReciNFe_400\nfrom pysignfe.nfe.manual_600 import RetConsReciNFe_310 as RetConsReciNFe_400\nfrom pysignfe.nfe.manual_600 import ProtNFe_310 as ProtNFe_400\nfrom pysignfe.nfe.manual_600 import ProcNFe_310 as ProcNFe_400\n\n#\n# Cancelamento de NF-e\n#\nfrom pysignfe.nfe.manual_600 import CancNFe_310 as CancNFe_400\nfrom pysignfe.nfe.manual_600 import RetCancNFe_310 as RetCancNFe_400\nfrom pysignfe.nfe.manual_600 import ProcCancNFe_310 as ProcCancNFe_400\n\n#\n# Cancelamento de NF-e por EVENTO\n\nfrom pysignfe.nfe.manual_600 import EventoCancNFe_310 as EventoCancNFe_400\nfrom pysignfe.nfe.manual_600 import EnvEventoCancNFe_310 as EnvEventoCancNFe_400\nfrom pysignfe.nfe.manual_600 import RetEnvEventoCancNFe_310 as RetEnvEventoCancNFe_400\nfrom pysignfe.nfe.manual_600 import ProcEventoNFeCancNFe_310 as ProcEventoNFeCancNFe_400\n\n#\n# Carta de Correção EVENTO\n\nfrom pysignfe.nfe.manual_600 import EventoCCe_310 as EventoCCe_400\nfrom pysignfe.nfe.manual_600 import EnvEventoCCe_310 as EnvEventoCCe_400\nfrom pysignfe.nfe.manual_600 import RetEnvEventoCCe_310 as RetEnvEventoCCe_400\nfrom pysignfe.nfe.manual_600 import ProcEventoNFeCCe_310 as ProcEventoNFeCCe_400\n\n#\n# EPEC EVENTO\n#\nfrom pysignfe.nfe.manual_600 import EventoEPEC_310 as EventoEPEC_400\nfrom pysignfe.nfe.manual_600 import EnvEventoEPEC_310 as EnvEventoEPEC_400\nfrom pysignfe.nfe.manual_600 import RetEnvEventoEPEC_310 as RetEnvEventoEPEC_400\nfrom pysignfe.nfe.manual_600 import ProcEventoNFeEPEC_310 as ProcEventoNFeEPEC_400\n\n#\n# Inutilização de NF-e\n#\nfrom pysignfe.nfe.manual_600 import InutNFe_310 as InutNFe_400\nfrom pysignfe.nfe.manual_600 import RetInutNFe_310 as RetInutNFe_400\nfrom pysignfe.nfe.manual_600 import ProcInutNFe_310 as ProcInutNFe_400\n\n#\n# Consulta a situação de NF-e\n#\nfrom pysignfe.nfe.manual_600 import ConsSitNFe_310 as ConsSitNFe_400\nfrom pysignfe.nfe.manual_600 import RetConsSitNFe_310 as RetConsSitNFe_400\n\n#\n# Consulta a situação do serviço\n#\nfrom pysignfe.nfe.manual_600 import ConsStatServ_310 as ConsStatServ_400\nfrom pysignfe.nfe.manual_600 import RetConsStatServ_310 as RetConsStatServ_400\n\n#\n# Consulta cadastro\n\nfrom pysignfe.nfe.manual_600 import ConsCad_310 as ConsCad_400\nfrom pysignfe.nfe.manual_600 import RetConsCad_310 as RetConsCad_400\n\n" }, { "alpha_fraction": 0.5788207054138184, "alphanum_fraction": 0.5824307799339294, "avg_line_length": 20.30769157409668, "blob_id": "2e2c9db0c971a35253a3c3fdea2a3ae1f5036d03", "content_id": "c0afe97d45ea138c6426caff383e4da462fc7acd", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 831, "license_type": "no_license", "max_line_length": 43, "num_lines": 39, "path": "/PQt5-Stock/Modelo/proveedor.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom Modelo.persona import Persona\nclass Proveedor(Persona):\n '''\n classdocs\n '''\n\n\n def __init__(self):\n Persona.__init__(self)\n self.__idProveedor = 0\n self.__descripcion = \"\"\n self.__web = \"\"\n self.__estado = 0\n\n def setIdProveedor(self, idPProveedor):\n self.__idProveedor = idPProveedor\n\n def getIdProveedor(self):\n return self.__idProveedor\n\n def setDescripcion(self, descripcion):\n self.__descripcion = descripcion\n\n def getDescripcion(self):\n return self.__descripcion\n\n def setWeb(self, web):\n self.__web = web\n\n def getWeb(self):\n return self.__web\n\n def setEstado(self, estado):\n self.__estado = estado\n\n def getEstado(self):\n return self.__estado\n" }, { "alpha_fraction": 0.7290322780609131, "alphanum_fraction": 0.7548387050628662, "avg_line_length": 21.14285659790039, "blob_id": "30011aa2236d5e3ac4c8e521287cddab7d7dcc03", "content_id": "17ff6a06e94bb5bbcbdb5a71669aeb181e0487f5", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 155, "license_type": "no_license", "max_line_length": 43, "num_lines": 7, "path": "/iter-001.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import itertools\n\nhorses = [1, 2, 3, 4]\nraces = itertools.permutations(horses)\nprint(races)\nprint(list(races))\nprint(list(itertools.permutations(horses)))\n" }, { "alpha_fraction": 0.63692307472229, "alphanum_fraction": 0.6430768966674805, "avg_line_length": 22.214284896850586, "blob_id": "c49722c0ed515866baaefa1c5c7263c041515db6", "content_id": "80e3e76fae62aed306f92233aa142e7bc2af4e98", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 325, "license_type": "no_license", "max_line_length": 63, "num_lines": 14, "path": "/fullcontrol-menu/csvtojson.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "# TESTE\n\nimport csv\nimport json\n\ncsvfile = open('1linha.csv', 'r')\njsonfile = open('1linha.json', 'w')\n\nfieldnames = ('nivel', 'funcao', 'int', 'sep', 'opcao', 'prog')\nreader = csv.DictReader(csvfile, fieldnames, delimiter=';')\nfor row in reader:\n print(row['opcao'])\n json.dump(row, jsonfile)\n jsonfile.write('\\n')\n" }, { "alpha_fraction": 0.5947136282920837, "alphanum_fraction": 0.6040748953819275, "avg_line_length": 26.530303955078125, "blob_id": "619c8ee768ec2875517f8d0f96ed099ad1b375f4", "content_id": "eaa6e2246d02d1fb040bee60e2b039f3aa3d8ec3", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1816, "license_type": "no_license", "max_line_length": 88, "num_lines": 66, "path": "/qt/ttt.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "from PyQt5.QtWidgets import *\nfrom PyQt5.QtGui import *\nfrom PyQt5.QtCore import *\n\nclass Field(QLabel):\n def __init__(self, text=\"0\", parent=None):\n super(Field, self).__init__(parent=parent)\n self.setAlignment(Qt.AlignCenter)\n self.setText(text)\n\n\nclass IOPanel(QWidget):\n numbers_of_fields = 4\n def __init__(self, parent=None):\n super(IOPanel, self).__init__(parent=None)\n lay = QVBoxLayout(self)\n for _ in range(self.numbers_of_fields):\n w = Field()\n lay.addWidget(w)\n\n self.setMinimumSize(QSize(40, 0))\n sizePolicy = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Preferred)\n self.setSizePolicy(sizePolicy)\n\n\n\nclass Panel(QWidget):\n def __init__(self, parent=None):\n super(Panel, self).__init__(parent=None)\n lay = QHBoxLayout(self)\n self.input = IOPanel()\n self.output = IOPanel()\n self.canvas = QWidget()\n\n lay.addWidget(self.input, 0, Qt.AlignLeft)\n lay.addWidget(self.canvas, 0, Qt.AlignCenter)\n lay.addWidget(self.output, 0, Qt.AlignRight)\n\n\nclass MainWindow(QMainWindow):\n def __init__(self, parent=None):\n super(MainWindow, self).__init__(parent=parent)\n self.initUi()\n self.reset_placement()\n\n def initUi(self):\n panel = Panel(self)\n self.setCentralWidget(panel)\n self.addToolBar(Qt.BottomToolBarArea, QToolBar(self))\n\n def reset_placement(self):\n g = QDesktopWidget().availableGeometry()\n self.resize(0.4 * g.width(), 0.4 * g.height())\n self.move(g.center().x() - self.width() / 2, g.center().y() - self.height() / 2)\n\n\ndef main():\n import sys\n app = QApplication(sys.argv)\n w = MainWindow()\n w.show()\n sys.exit(app.exec_())\n\n\nif __name__ == '__main__':\n main()" }, { "alpha_fraction": 0.7565982341766357, "alphanum_fraction": 0.7589442729949951, "avg_line_length": 35.27659606933594, "blob_id": "0873eafe6e8c3d8d1e36e2fc20496e86011d1194", "content_id": "b8adbe28132316dfb6bf32c95d16d9d50a8fa722", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 1721, "license_type": "no_license", "max_line_length": 169, "num_lines": 47, "path": "/pong/README.md", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "<img src=\"https://pythonacademy.com.br/assets/posts/como-criar-jogos-com-python-e-kivy/pong-reborn-logo.png\" alt=\"PongReborn\" width=\"400px\">\n\n# PongReborn\n\nRemake do famoso jogo Pong, feito em Python e Kivy! Para saber mais, leia o [artigo completo aqui](https://pythonacademy.com.br/blog/como-criar-jogos-com-python-e-kivy)!\nNesse projeto, abordamos o gerenciamento de telas, inclusão de menus, uso de áudio, e **muito mais**!\n\n## Instalação\n\nPara realizar a instalação basta seguir o passo-a-passo descrito [aqui](https://pythonacademy.com.br/sliders/como-instalar-o-kivy). \nNesse [Slider](https://pythonacademy.com.br/sliders) da Python Academy, ensinamos a instalar o Kivy no Mac, Linux e Windows!\n\n## Execução\n\nApós instalar o Kivy basta executar o código, com:\n\n```sh\npython main.py\n```\n\nE **PRONTO**! \n\n## Resultado\n\nAqui alguns screenshots do jogo rodando!\n\n### Tela Inicial\n\nTela com menu inicial do jogo com opções de iniciar uma nova partida ou fechar o aplicativo.\n\n![Tela inicial do PongReborn](https://pythonacademy.com.br/assets/posts/como-criar-jogos-com-python-e-kivy/tela-inicial.png)\n\n### Tela do Jogo\n\nTela do jogo, com o Campo, Raquetes e Bola! Para jogar basta movimentar as raquetes de cada lado! \n(O placar está configurado para apenas 1 ponto. **Você consegue achar onde deve ser alterado para \npermitir mais pontos?** #ChallengeAccepted)\n\n![Tela do jogo](https://pythonacademy.com.br/assets/posts/como-criar-jogos-com-python-e-kivy/pong-reborn.png)\n\n### Tela do Vencedor\n\nEssa é a Tela que irá aparecer para aquele que ganhar a partida!\n\n![Tela do vencedor](https://pythonacademy.com.br/assets/posts/como-criar-jogos-com-python-e-kivy/tela-vencedor.png)\n\nEspero que divirtam-se!\n" }, { "alpha_fraction": 0.7074829936027527, "alphanum_fraction": 0.7142857313156128, "avg_line_length": 20, "blob_id": "7ed7c129d0ee1e74ebd6358c49955a4097199a9b", "content_id": "9238e21e0a690e29fed8ff7e93cd85753cd280fb", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 588, "license_type": "no_license", "max_line_length": 55, "num_lines": 28, "path": "/pyside2/ps2-003.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/python\n\nimport sys\nfrom PySide2.QtWidgets import QApplication, QPushButton\nfrom PySide2.QtCore import Slot\n\n\n@Slot()\ndef say_hello():\n print(\"Button clicked, Hello!\")\n\ndef btn(texto, func):\n btn = QPushButton(texto)\n btn.clicked.connect(say_hello)\n return btn\n\n\n# Create the Qt Application\napp = QApplication(sys.argv)\n# Create a button, connect it and show it\n# button = QPushButton(\"Click me\")\n# button.clicked.connect(say_hello)\nbutton = btn(\"Me Clique\", say_hello)\nbutto1 = btn(\"teste\", say_hello)\nbutton.show()\nbutto1.show()\n# Run the main Qt loop\napp.exec_()\n" }, { "alpha_fraction": 0.6553755402565002, "alphanum_fraction": 0.665316641330719, "avg_line_length": 27.29166603088379, "blob_id": "2557fa62860db960ade86093ded67ea370753a7d", "content_id": "cd6d37d7cf6524553dae3406302902429cf45b84", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2716, "license_type": "no_license", "max_line_length": 77, "num_lines": 96, "path": "/JPro-master/origin/tbox2.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "\n#====##====##====##====##====#\n#====##====##====##====##====#\n'''\nWIKI of all items: \n\n- Uses a Tree view to display pages for each item and its components \n- Display most optimal time and processes needed to run \n \n'''\n#====##====##====##====##====#\n#====##====##====##====##====#\n\nimport sys \nimport datetime\nfrom PyQt5.QtWidgets import (QApplication, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQWidget, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQLabel, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQListView,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQHBoxLayout,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQVBoxLayout,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQGridLayout,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQShortcut,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tqApp,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\nfrom PyQt5.QtGui import QKeySequence,QStandardItem,QStandardItemModel\nfrom connect import Connect \nfrom dbcreation import Base, Models, ProductionQueue\nfrom dialog_new import Dialog as DBox\n\n\nclass TBox(QWidget): \n\n\tdef __init__(self): \n\t\tsuper().__init__()\n\n\t\texitShortcut = QShortcut(QKeySequence('Ctrl+W'),self, qApp.quit)\n\t\t\n\t\tself.connect = Connect()\n\n\t\tself.all_models = self.connect.session.query(Models).all()\n\n\t\tself.labelkey_name = QLabel('Name',self)\n\t\tself.labelkey_parts = QLabel('Parts',self)\n\t\tself.labelkey_current_quantity = QLabel('Current Quantity', self)\n\n\t\tself.labelval_name = QLabel('Name',self)\n\t\tself.labelval_parts = QLabel('Parts',self)\n\t\tself.labelval_current_quantity = QLabel('Current Quantity', self)\t\t\n\n\t\tself.showInfo('M1')\n\n\t\tself.list = QListView(self)\n\t\tself.list_model = QStandardItemModel(self.list)\n\t\tself.createList()\n\n\t\tprint('Current index of view: ', self.list.currentIndex())\n\n\t\tself.hboxlayout = QHBoxLayout()\n\t\tself.label_grid = QGridLayout()\n\t\tself.buildLayout()\n\n\t\tself.show()\n\n\tdef showInfo(self, queryitem):\n\t\tquery = self.connect.session.query(Models).filter_by(name=queryitem).one()\t\n\t\tself.labelval_name.setText(query.name)\n\t\tself.labelval_parts.setText(query.parts)\n\t\tself.labelval_current_quantity.setText(str(query.current_quantity))\n\n\tdef createList(self): \n\t\tfor model in self.all_models : \n\t\t\titem = QStandardItem(model.name)\n\t\t\tself.list_model.appendRow(item)\n\t\tself.list.setModel(self.list_model)\n\t\tself.list.setMinimumSize(150,200)\n\t\tself.list.setMaximumSize(150,600)\n\t\tself.list.show()\n\n\tdef buildLayout(self):\n\n\t\tself.label_grid.addWidget(self.labelkey_name, 0,0)\n\t\tself.label_grid.addWidget(self.labelkey_parts, 1, 0)\n\t\tself.label_grid.addWidget(self.labelkey_current_quantity, 2,0)\t\t\n\t\tself.label_grid.addWidget(self.labelval_name, 0,1)\n\t\tself.label_grid.addWidget(self.labelval_parts,1,1)\n\t\tself.label_grid.addWidget(self.labelval_current_quantity,2,1)\n\n\t\tself.hboxlayout.addWidget(self.list)\n\t\tself.hboxlayout.addLayout(self.label_grid)\n\t\tself.setLayout(self.hboxlayout)\n\nif __name__ == '__main__' : \n\n\tapp = QApplication(sys.argv)\n\ttbox = TBox()\n\tsys.exit(app.exec_())" }, { "alpha_fraction": 0.6190944910049438, "alphanum_fraction": 0.6604330539703369, "avg_line_length": 24.399999618530273, "blob_id": "f355391bd8cf1c16a688137da15af8d122864ac2", "content_id": "28b0c805bc565792129d60fd6ca200268da9ea5a", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1016, "license_type": "no_license", "max_line_length": 137, "num_lines": 40, "path": "/flavio/envio-xmls.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/python3\n\nimport os\nimport lepasta \nimport zipfile\nfrom datetime import datetime\nfrom six.moves import configparser\nfrom envia_email import envia_email\n\ndef monthdelta(date, delta):\n m, y = (date.month+delta) % 12, date.year + ((date.month)+delta-1) // 12\n if not m: m = 12\n d = min(date.day, [31,\n 29 if y%4==0 and not y%400==0 else 28,31,30,31,30,31,31,30,31,30,31][m-1])\n return date.replace(day=d,month=m, year=y)\n\n\nanomes = datetime.today()\nanomes = monthdelta(anomes, -1).strftime('%Y%m')\n\ncfg = configparser.ConfigParser()\ncfg.read('xmls.ini')\n\npasta = cfg.get('xmls', 'pasta').format(anomes=anomes)\n\nlista = lepasta.monta_lista(pasta)\n\narqrar = anomes + '.rar'\n \ncompacta = zipfile.ZipFile(arqrar, 'w')\n\nfor nome in lista:\n compacta.write(nome, compress_type = zipfile.ZIP_DEFLATED) \n \ncompacta.close()\n \n \nenvia_email('teste@bellasoft.com.br', ['teste@bellasoft.com.br','flavio@bellasoft.com.br','fiscal.diskepi@gmail.com'], 'XMLS - ' + anomes, 'Segue em anexo os arquivos xmls do mes ' + anomes, [arqrar])\n\nos.remove(arqrar)\n" }, { "alpha_fraction": 0.6947368383407593, "alphanum_fraction": 0.7368420958518982, "avg_line_length": 18.200000762939453, "blob_id": "65bc98307d45f87d3151d32e6322bc3b1c159945", "content_id": "3364483163ec3f5637ae84786b24cf3aa44b3085", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 95, "license_type": "no_license", "max_line_length": 65, "num_lines": 5, "path": "/bcrypt/b01.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import bcrypt\n\nhashed = bcrypt.hashpw('123xyz'.encode('utf8'), bcrypt.gensalt())\n\nprint(hashed)" }, { "alpha_fraction": 0.5742357969284058, "alphanum_fraction": 0.6790392994880676, "avg_line_length": 18.08333396911621, "blob_id": "75512b7ad28c2cb2863efb704f36ffb6f75b6a69", "content_id": "69282a27fbea8625eefaa0cbbdcf3d7a68689409", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 458, "license_type": "no_license", "max_line_length": 68, "num_lines": 24, "path": "/crt/teste_crt.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import sys\nimport crt\nfrom ctypes import windll\nwindll.kernel32.SetConsoleMode(windll.kernel32.GetStdHandle(-11), 7)\n\ncrt.cor(44,33,1,1)\ncrt.cls()\nprint(\"teste\")\n\ncrt.cor(44,33,0,1)\ncrt.prt(\"\",10,50)\n# print(randint(0, 9))\n\ncrt.cor(44,34,0,1)\ncrt.prt(\"teste2\")\ncrt.prt(\"teste2\")\ncrt.prt(\"teste2\")\ncrt.cor(crt.bk_blu,crt.fg_yel,0,1)\ncrt.prt(\"teste\",0,0)\ncrt.prt(\"teste\",1,1)\ncrt.prt(\"teste\",2,2)\ncrt.prt(\"teste\",3,3)\ncrt.prt(\"teste\",4,4)\ncrt.prt(\"teste\",4,9)\n" }, { "alpha_fraction": 0.6671949028968811, "alphanum_fraction": 0.6830427646636963, "avg_line_length": 26.2608699798584, "blob_id": "e692ec0f6e98b52b511e07fa17d07e438822f8a4", "content_id": "067153da91566a891958cbb85f8485d4260c689d", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 631, "license_type": "no_license", "max_line_length": 104, "num_lines": 23, "path": "/telegram/parametros.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import sys\nimport argparse\n\n\ndef get_arguments():\n parser = argparse.ArgumentParser(description = 'Envia mensagens pelo Telegram')\n parser.add_argument('-m', '--message', dest='message', help='Mensagem a ser enviada', required=True)\n parser.add_argument('-p', '--phones', dest='phones', help='Telefones destino', required=True)\n options = parser.parse_args()\n return options\n\n\noptions = get_arguments()\n\nprint(options)\n\nif not (options.message):\n print('Precisa ser uma hora valida, exemplo: 01:45')\n exit(-1)\n\nif not (options.phones):\n print('Precisa ser uma hora valida, exemplo: 01:45')\n exit(-1)\n " }, { "alpha_fraction": 0.8333333134651184, "alphanum_fraction": 0.8541666865348816, "avg_line_length": 15, "blob_id": "6380cd04e74ef8530f77de324ad1dd0bfc0760ef", "content_id": "8ae34237a0f40e7cda7fbbcadd90da76c7add778", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 196, "license_type": "no_license", "max_line_length": 25, "num_lines": 6, "path": "/PyQt5_GUI_Application-master/README.md", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "# PyQt5_GUI_Application\n电子科技大学大二综合课程设计\n计科5班 James\n航空订票系统\n实现GUI界面以及连接数据库进行票务管理功能的实现\n欢迎交流:1294844426@qq.com\n" }, { "alpha_fraction": 0.5899053812026978, "alphanum_fraction": 0.5946372151374817, "avg_line_length": 21.678571701049805, "blob_id": "3c0040787db074a3a196dc716d3d7c7a83aedd6e", "content_id": "e0ed5073e9a6734d32877468af3802ddb83f9617", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 634, "license_type": "no_license", "max_line_length": 38, "num_lines": 28, "path": "/PQt5-Stock/Modelo/cliente.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom Modelo.persona import Persona\nclass Cliente(Persona):\n\n def __init__(self):\n Persona.__init__(self)\n self.__apellido = \"\"\n self.__idCliente = 0\n self.__estado = 0\n\n def setApellido(self, apellido):\n self.__apellido = apellido\n\n def getApellido(self):\n return self.__apellido\n\n def setIdCliente(self, idCliente):\n self.__idCliente = idCliente\n\n def getIdCliente(self):\n return self.__idCliente\n\n def setEstado(self, estado):\n self.__estado = estado\n\n def getEstado(self):\n return self.__estado" }, { "alpha_fraction": 0.71875, "alphanum_fraction": 0.71875, "avg_line_length": 26.428571701049805, "blob_id": "08977e8fa8a353ffe346bd132fd5fc07e8214033", "content_id": "72ea6301a65e155ea1edaa1538cee2f0df6e01e1", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 192, "license_type": "no_license", "max_line_length": 51, "num_lines": 7, "path": "/fullcontrol/dados/api/serializers.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "from rest_framework import serializers\nfrom dados import models\n\nclass DadosSerializer(serializers.ModelSerializer):\n class Meta:\n model = models.Savemdip\n fields = '__all__'\n" }, { "alpha_fraction": 0.48185327649116516, "alphanum_fraction": 0.4996139109134674, "avg_line_length": 33.078948974609375, "blob_id": "8b68c2b423be5f480d8dcb87f81bd37cec1165c7", "content_id": "0234083653c1172b913dbb9c8a11f5c21c0e801c", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2590, "license_type": "no_license", "max_line_length": 90, "num_lines": 76, "path": "/full - compara relatorios/leComissao.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import sys\nimport os\nimport csv\nimport pandas as pd\n\n\ndef procComissao(arq):\n comfile = open(arq + '.ori', 'r')\n csvfile = open(arq + '.csv', 'w')\n\n def tiraespaco(l):\n l = l.replace(' ', '')\n l = l.replace('.', '')\n return l\n\n cab = ''\n ven = False\n for l in comfile:\n if len(cab) < 1:\n if l[:62] == '| NUMERO | NUMERON | CLIENTE |':\n l = tiraespaco(l)\n cab = l\n csvfile.write(l[1:8] + 'TIPO|' + l[8:24] + l[29:-2] + '\\n')\n\n if l[0:30] == '|TOTAL DO TIPO =====> MONTADOR':\n ven = True\n\n if ven:\n if l[62:80] == 'TOTAL DA NOTA ==> ':\n csvfile.write(l[1:9] + '|' + l[9:10] +\n l[10:62] + l[81:-3] + '\\n')\n\n comfile.close()\n csvfile.close()\n\n df = pd.read_csv(arq + '.csv', sep='|', encoding='cp1252', decimal=',')\n\n df['VRBRUTO'] = [x.replace('.', '') for x in df['VRBRUTO']]\n df['VRBRUTO'] = [x.replace(',', '.') for x in df['VRBRUTO']]\n df['VRBRUTO'] = [x.replace(' ', '0') for x in df['VRBRUTO']]\n df['VRBRUTO'] = df['VRBRUTO'].astype(float)\n\n df['DESCONTO'] = [x.replace('.', '') for x in df['DESCONTO']]\n df['DESCONTO'] = [x.replace(',', '.') for x in df['DESCONTO']]\n df['DESCONTO'] = [x.replace(' ', '0') for x in df['DESCONTO']]\n df['DESCONTO'] = df['DESCONTO'].astype(float)\n\n df['VALORTROCA'] = [x.replace('.', '') for x in df['VALORTROCA']]\n df['VALORTROCA'] = [x.replace(',', '.') for x in df['VALORTROCA']]\n df['VALORTROCA'] = [x.replace(' ', '0') for x in df['VALORTROCA']]\n df['VALORTROCA'] = df['VALORTROCA'].astype(float)\n\n df['DEVOLUCAO'] = [x.replace('.', '') for x in df['DEVOLUCAO']]\n df['DEVOLUCAO'] = [x.replace(',', '.') for x in df['DEVOLUCAO']]\n df['DEVOLUCAO'] = [x.replace(' ', '0') for x in df['DEVOLUCAO']]\n df['DEVOLUCAO'] = df['DEVOLUCAO'].astype(float)\n\n df['VALORLIQUIDO'] = [x.replace('.', '') for x in df['VALORLIQUIDO']]\n df['VALORLIQUIDO'] = [x.replace(',', '.') for x in df['VALORLIQUIDO']]\n df['VALORLIQUIDO'] = [x.replace(' ', '0') for x in df['VALORLIQUIDO']]\n df['VALORLIQUIDO'] = df['VALORLIQUIDO'].astype(float)\n\n return df\n\n\nif __name__ == \"__main__\":\n if(len(sys.argv) < 2):\n print(\"Use: leComissao arquivo\")\n sys.exit(0)\n if os.path.isfile(sys.argv[1]):\n df = procComissao(os.path.splitext(os.path.basename(sys.argv[1]))[0])\n print(df)\n else:\n print(u'Arquivo nao encontrado!')\n sys.exit(0)\n sys.exit(1)\n" }, { "alpha_fraction": 0.613021194934845, "alphanum_fraction": 0.6139965653419495, "avg_line_length": 45.08988952636719, "blob_id": "958c62f549f666adf85c0093ed5f15226d760484", "content_id": "0dbcafbf5474cbf53b0d70196217672f4ad02c7c", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 4101, "license_type": "no_license", "max_line_length": 142, "num_lines": 89, "path": "/PQt5-Stock/Conexion/conexionCliente.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom Conexion.conexion import Conexion\nfrom Modelo.cliente import Cliente\n\nclass conexionCliente(object):\n\n def __init__(self):\n self.conexion = Conexion()\n self.cliente = Cliente()\n\n def selectCliente(self, typeParameter, parameter, parameterState):\n query = \"\"\"\n SELECT cli.idClientes, cli.apellido, p.nombre, p.email, d.direccion, d.numero, d.piso, d.dpto,\n d.iddirecciones, p.idpersonas, cli.estado\n FROM clientes cli, personas p, direcciones d\n WHERE p.idpersonas = cli.personas_idpersonas and d.iddirecciones = p.direcciones_iddirecciones and\n \"\"\" +typeParameter + \"\"\" LIKE %s and cli.estado LIKE %s\n \"\"\"\n paramState = '1'\n if parameterState == 0:\n paramState = '%'\n\n param = parameter+ '%'\n values = (param, paramState)\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(query, values)\n listCliente = self.conexion.cursor.fetchall()\n self.conexion.cerrarConexion()\n return listCliente\n\n def selectTelefonoCliente(self, cliente):\n query = \"\"\"SELECT t.idtelefono, t.numero, t.tipo\n FROM telefonos t, personas p, clientes c\n WHERE p.idpersonas = c.personas_idpersonas and p.idpersonas = t.personas_idpersonas\n and c.idClientes = %s\"\"\"\n values = cliente.getIdCliente()\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(query)\n listTelefono = self.conexion.cursor.fetchall()\n self.conexion.cerrarConexion()\n return listTelefono\n\n def modificarCliente(self, cliente):\n\n query = \"\"\"UPDATE personas p, clientes c, direcciones d\n SET p.nombre = %s , p.email= %s , c.apellido = %s, d.direccion= %s, d.numero = %s, d.piso = %s, d.dpto = %s, c.estado = %s\n WHERE p.idpersonas = c.personas_idpersonas and p.direcciones_iddirecciones = d.iddirecciones\n and c.idClientes = %s\"\"\"\n values = (cliente.getNombre(), cliente.getEmail(), cliente.getApellido(), cliente.getDireccion().getDireccion(),\n cliente.getDireccion().getNumero(), cliente.getDireccion().getPiso(),\n cliente.getDireccion().getDpto(), cliente.getEstado(), cliente.getIdCliente())\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(query, values)\n self.conexion.db.commit()\n self.conexion.cerrarConexion()\n\n def insertarCliente(self, cliente):\n self.conexion.abrirConexion()\n\n queryDireccion = \"INSERT INTO direcciones (direccion, numero, piso, dpto) VALUES (%s, %s, %s, %s)\"\n\n valuesDireccion = (cliente.getDireccion().getDireccion(), cliente.getDireccion().getNumero(),\n cliente.getDireccion().getPiso(), cliente.getDireccion().getDpto())\n self.conexion.cursor.execute(queryDireccion, valuesDireccion)\n\n queryPersona = \"INSERT INTO personas (nombre, email, direcciones_iddirecciones) VALUES (%s, %s, LAST_INSERT_ID())\"\n valuesPersona = (cliente.getNombre(), cliente.getEmail())\n self.conexion.cursor.execute(queryPersona, valuesPersona)\n\n queryCliente = \"INSERT INTO clientes (personas_idpersonas, apellido, estado) VALUES (LAST_INSERT_ID(), %s, %s)\"\n valuesCliente = (cliente.getApellido(), cliente.getEstado())\n self.conexion.cursor.execute(queryCliente, valuesCliente)\n\n self.conexion.db.commit()\n self.conexion.cerrarConexion()\n\n def borrarCliente(self, cliente):\n queryCliente = \"\"\"\n UPDATE clientes\n SET estado = 0\n WHERE idClientes = %s\n \"\"\"\n valuesCliente = cliente.getIdCliente()\n\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(queryCliente, valuesCliente)\n self.conexion.db.commit()\n self.conexion.cerrarConexion()" }, { "alpha_fraction": 0.4651263654232025, "alphanum_fraction": 0.47595667839050293, "avg_line_length": 35.835105895996094, "blob_id": "23f15756c642802ea7a1cbabeb7ff3c9270c7c72", "content_id": "be563205e5b4f563a0b7531bac07162a9e3ec9bb", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 6926, "license_type": "no_license", "max_line_length": 231, "num_lines": 188, "path": "/PQt5-Stock/Controlador/windowNotification.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import sys\n\nfrom PyQt5 import uic\nfrom Modelo.producto import Producto\nfrom Conexion.conexionGeneral import ConexionGenerales\nfrom Componentes.tableModel import MyTableModel\nfrom PyQt5.QtWidgets import QTableView, QAbstractItemView, QWidget\nfrom PyQt5.Qt import QDesktopServices, QUrl\nimport datetime\nfrom PyQt5.Qt import QTextDocument, QPrinter\nfrom PyQt5.QtWidgets import QMessageBox, QDialog\n\nclass WindowNotification():\n\n def __init__(self):\n\n self.winNot = uic.loadUi('Vista/windowListNotify.ui')\n\n self.producto = Producto()\n\n self.conexionGeneral = ConexionGenerales()\n\n self.cargarTabla()\n\n self.winNot.btnSalir.clicked.connect(self.close)\n self.winNot.btnDesactivar.clicked.connect(self.desactivarProducto)\n\n self.winNot.tvDetalle.setSortingEnabled(True)\n self.winNot.tvDetalle.setMouseTracking(True)\n self.winNot.tvDetalle.setSelectionBehavior(QAbstractItemView.SelectRows)\n\n\n self.winNot.btnDesactivar.setEnabled(False)\n self.winNot.btnGenerarPdf.clicked.connect(self.generateList)\n\n self.winNot.exec()\n\n\n #sys.executable(self.winNot.exec_())\n\n\n def cargarTabla(self):\n self.listProducto = self.conexionGeneral.selectProductoStock()\n\n header = ['ID', 'Nombre', 'Cant', 'Cant Min']\n if len(self.listProducto) > 0:\n tableModel = MyTableModel(self.winNot.tvDetalle, self.listProducto, header)\n self.winNot.tvDetalle.setModel(tableModel)\n self.winNot.tvDetalle.selectionModel().currentChanged.connect(self.changeSelectedTable)\n\n\n self.winNot.tvDetalle.setColumnHidden(0, True)\n self.winNot.tvDetalle.setColumnWidth(1, 128)\n self.winNot.tvDetalle.setColumnWidth(2, 70)\n self.winNot.tvDetalle.setColumnWidth(3, 70)\n else:\n self.winNot.btnGenerarPdf.setEnabled(False)\n\n\n\n\n def changeSelectedTable(self, selected, deselected):\n listProductos = selected.model().mylist\n productoSelected = ()\n productoSelected = tuple(listProductos[selected.row()])\n\n self.productoSelected = selected.row()\n\n self.producto = Producto()\n self.producto.setIdProducto(int(productoSelected[0]))\n self.producto.setNombre(str(productoSelected[1]))\n self.producto.setCantidad(int(productoSelected[2]))\n self.producto.setCantidadMinima(int(productoSelected[3]))\n\n self.winNot.btnDesactivar.setEnabled(True)\n\n def close(self):\n alert = QDialog()\n confirm = QMessageBox.question(alert, \"Mensaje\", \"¿ Desea salir de la ventana de notificaciones ?\", QMessageBox.Yes,\n QMessageBox.No)\n if confirm == QMessageBox.Yes:\n self.winNot.close()\n\n def desactivarProducto(self):\n self.conexionGeneral.changeStateProduct(self.producto)\n self.winNot.btnDesactivar.setEnabled(False)\n self.cargarTabla()\n\n\n def generateList(self):\n hoy = str(datetime.datetime.now().year) + str(datetime.datetime.now().month) + str(datetime.datetime.now().day) + str(datetime.datetime.now().hour) + str(datetime.datetime.now().minute) + str(datetime.datetime.now().second)\n\n nombrePdf = '../archivos/' + str(hoy + 'LIST') + '.pdf'\n listTable = \"\"\n for lista in self.listProducto:\n listTable += \"\"\"\n <tr height=\"80\">\n <td width=\"60%\" align=\"left\" >\n <br>\"\"\" + str(lista[1]) + \"\"\"<br>\n </td>\n <td width=\"20%\" align=\"center\">\n <br> &nbsp;&nbsp;\"\"\" + str(lista[3]) + \"\"\"<br>\n </td>\n <td width=\"20%\" align=\"center\">\n <br>&nbsp;&nbsp; \"\"\" + str(lista[2]) + \"\"\"<br>\n </td>\n </tr>\n \"\"\"\n\n\n fecha = str(datetime.datetime.now())\n html = \"\"\"\n <table width=\"600\">\n <tr width=\"600\" color=\"#000000\">\n <td width=\"80%\">\n\n </td>\n <td width=\"20%\" align=\"right\">\n <IMG SRC=\"kde1.png\">\n </td>\n </tr>\n\n </table>\n\n <hr>\n <br>\n <p>\n LISTADO DE PRODUCTOS SIN STOCK :\n </p>\n <br>\n <table width=\"600\" height=\"0\" style=\"border-color: black; border-width: 0.5px; border-spacing: 0;\">\n <tr style=\" background-color: gray; border-style: inset;\">\n <td width=\"60%\" align=\"center\" valign=\"middle\">\n <b>\n PRODUCTOS\n </b>\n </td>\n <td width=\"20%\" align=\"center\" valign=\"middle\">\n <b>\n CANTIDAD MINIMA\n </b>\n </td>\n <td width=\"20%\" align=\"center\" valign=\"middle\">\n <b>\n CANTIDAD\n </b>\n </td>\n </tr>\n </table>\n\n <br>\n <br>\n\n <table width=\"600\" height=\"0\" style=\"border-color: black; border-width: 0.5px; border-spacing: 0;\">\n \"\"\" + listTable + \"\"\"\n </table>\n <br>\n <br>\n\n <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>\n <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>\n <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>\n <br>\n\n <hr>\n <br>\n <table width=\"600\">\n <tr>\n <td align=\"right\" width=\"100%\">\n FECHA/HORA : \"\"\"+ fecha + \"\"\"\n </td>\n </tr>\n </table>\n <hr>\n \"\"\"\n\n doc = QTextDocument()\n doc.setHtml(html)\n\n printer = QPrinter()\n printer.setOutputFileName(nombrePdf)\n\n printer.setOutputFormat(QPrinter.PdfFormat)\n doc.print(printer)\n printer.newPage()\n url = QUrl\n url = QUrl(nombrePdf)\n QDesktopServices.openUrl(url)\n" }, { "alpha_fraction": 0.5421828627586365, "alphanum_fraction": 0.5752212405204773, "avg_line_length": 33.61224365234375, "blob_id": "f420f3abaf438d0c1661942b092746e24ec9a3a3", "content_id": "019909c91ab230579d005d08f5e849278e4e7041", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1695, "license_type": "no_license", "max_line_length": 107, "num_lines": 49, "path": "/opencv/Realidade-Aumentada-master/insertObject/glyphs.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import cv2\nfrom glyphfunctions import *\nfrom glyphdatabase import *\n \nclass Glyphs:\n \n QUADRILATERAL_POINTS = 4\n BLACK_THRESHOLD = 100\n WHITE_THRESHOLD = 155\n \n def detect(self, image):\n \n glyphs = []\n \n # Stage 1: Detect edges in image\n gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)\n gray = cv2.GaussianBlur(gray, (5,5), 0)\n edges = cv2.Canny(gray, 100, 200)\n \n # Stage 2: Find contours\n contours, _ = cv2.findContours(edges, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)\n contours = sorted(contours, key=cv2.contourArea, reverse=True)[:10]\n \n for contour in contours:\n \n # Stage 3: Shape check\n perimeter = cv2.arcLength(contour, True)\n approx = cv2.approxPolyDP(contour, 0.01*perimeter, True)\n \n if len(approx) == self.QUADRILATERAL_POINTS:\n \n # Stage 4: Perspective warping\n topdown_quad = get_topdown_quad(gray, approx.reshape(4, 2))\n \n # Stage 5: Border check\n if topdown_quad[(topdown_quad.shape[0]/100.0)*5, \n (topdown_quad.shape[1]/100.0)*5] > self.BLACK_THRESHOLD: continue\n \n # Stage 6: Match glyph pattern\n glyph_pattern = get_glyph_pattern(topdown_quad, self.BLACK_THRESHOLD, self.WHITE_THRESHOLD)\n glyph_found, _, glyph_name = match_glyph_pattern(glyph_pattern)\n \n if glyph_found:\n \n # Stage 7: Get rotation and translation vectors\n rvecs, tvecs = get_vectors(image, approx.reshape(4, 2))\n glyphs.append([rvecs, tvecs, glyph_name])\n \n return glyphs" }, { "alpha_fraction": 0.5133135914802551, "alphanum_fraction": 0.5133135914802551, "avg_line_length": 21.53333282470703, "blob_id": "d192ef9859f0d30c84eb1a247ce7bd6cd185cb6b", "content_id": "a011cbf7c98f806f1e7b7240eb120f15e77d7080", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 676, "license_type": "no_license", "max_line_length": 95, "num_lines": 30, "path": "/cidades_ibge/estados.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import json\n\nTABLE_NAME = \"estados\"\n\nsqlstatement = ''\nwith open('estados.json', 'r') as f:\n jsondata = json.loads(f.read())\n\nt = {}\n\nfor json in jsondata:\n keylist = \"(\"\n valuelist = \"(\"\n firstPair = True\n for key, value in json.items():\n if not firstPair:\n keylist += \", \"\n valuelist += \", \"\n firstPair = False\n keylist += key\n if type(value) in (str, str):\n valuelist += \"'\" + value + \"'\"\n else:\n valuelist += str(value)\n keylist += \")\"\n valuelist += \")\"\n\n sqlstatement += \"INSERT INTO \" + TABLE_NAME + \" \" + keylist + \" VALUES \" + valuelist + \"\\n\"\n\nprint(sqlstatement)\n" }, { "alpha_fraction": 0.7213114500045776, "alphanum_fraction": 0.7213114500045776, "avg_line_length": 19.66666603088379, "blob_id": "7d44be7949ace82d4cc7ba60104c8eeab1f14fbd", "content_id": "0c20feb4dea6288e72c7c36a4ad6b5e9a9e283fa", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 61, "license_type": "no_license", "max_line_length": 23, "num_lines": 3, "path": "/opencv/Realidade-Aumentada-master/insertObject/constants.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "# shape constants\nSHAPE_CONE = \"cone\"\nSHAPE_SPHERE = \"sphere\"" }, { "alpha_fraction": 0.48120301961898804, "alphanum_fraction": 0.5563910007476807, "avg_line_length": 15.75, "blob_id": "ac0cc25361d00d95a701ee942e77d33b1da16813", "content_id": "a2ac2feab776264e59a741b48c9febea6fd9ec49", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 133, "license_type": "no_license", "max_line_length": 36, "num_lines": 8, "path": "/opencv/Realidade-Aumentada-master/help.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import numpy as np \na = np.array([[1,2],[3,4],[5,6]])\nprint(a)\nb = a[1]\nprint(b)\n\nfor i,j in zip(range(4),range(4,8)):\n print(i,j)" }, { "alpha_fraction": 0.5424213409423828, "alphanum_fraction": 0.5424213409423828, "avg_line_length": 25.897436141967773, "blob_id": "c6af6d0a557486c816cb3cdc8089b82ebb3b3cea", "content_id": "df1b283c61ebd4e7ae6586e6a94cf48b2ad4a9d4", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2098, "license_type": "no_license", "max_line_length": 78, "num_lines": 78, "path": "/Hospital-Helper-2-master/app/model/localization.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import json\n\nfrom app import options\nfrom app.model import db, logic, exceptions\n\n\nclass Localization:\n\n __translation = {}\n __lang = None\n\n @classmethod\n def install(cls, lang):\n\n cls.__lang = lang\n\n if lang not in [c.name for c in db.Translation.__table__.columns]:\n raise exceptions.NoSuchTranslation\n\n cls.create_init_translation()\n\n strings = db.SESSION.query(db.Translation).all()\n\n for s in strings:\n transl = getattr(s, lang)\n cls.__translation[s.sys] = transl\n\n import builtins\n builtins.__dict__['_'] = cls.get_text\n\n @classmethod\n def get_translation_map(cls, labels):\n translation = {}\n strings = db.SESSION.query(db.Translation).all()\n for l in labels:\n for s in strings:\n if s.sys == l:\n translation[l] = getattr(l, cls.__lang)\n break\n return translation\n\n @classmethod\n def get_text(cls, text):\n return cls.__translation.get(text, text)\n\n @staticmethod\n def add_system_label(label):\n\n t, _ = db.Translation.get_or_create(sys=logic.Parser.unidecode(label),\n defaults={\n 'ru': label.replace('_', ' ').lstrip(),\n 'en': label.replace('_', ' ').lstrip()\n })\n\n db.SESSION.add(t)\n\n @classmethod\n def create_init_translation(cls):\n\n structure = db.SESSION.query(db.KeyValue).filter(\n db.KeyValue.key == options.STRUCTURE_KEY).first()\n\n try:\n structure = json.loads(structure.value)\n except AttributeError:\n raise exceptions.AppNotReady\n\n for item in structure:\n for arg in item['args']:\n cls.add_system_label(arg['name'])\n\n for l in ('group', 'name', 'verbose_name'):\n s = item.get(l)\n if s:\n cls.add_system_label(s)\n\n for each in options.TRANSLATION + options.CONTROL_BUTTONS_LABELS:\n db.Translation.get_or_create(**each)\n" }, { "alpha_fraction": 0.742671012878418, "alphanum_fraction": 0.742671012878418, "avg_line_length": 32.5625, "blob_id": "4714de97d13a99578d93b6de3d8de39692a794ec", "content_id": "efbea15dc085bdeee566d993a001cb3c81d74e8b", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2149, "license_type": "no_license", "max_line_length": 85, "num_lines": 64, "path": "/djangosige/venv/Lib/site-packages/geraldo/__init__.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "\"\"\"\nGeraldo Reports Engine\n======================\n\nOverview\n--------\n\nGeraldo is a reports generator created to work like ReportBuilder, QuickReport\nor Jasper Reports. It has bands with fixed width and flexible height to show on\ntop, summary, page header, page footer, in table or each one for an object.\n\nIt is under GPL and works only with Django framework and Python language.\n\nIt depends on ReportLab library to work.\n\nPackages Structure\n------------------\n\n- base.py - contains report base classes and definitions, including report,\n subreport, bands an groupping.\n\n- barcodes.py - contains code related to render barcodes in reports.\n\n- cache.py - contains settings and backend to store reports in cache.\n\n- charts.py - contains code to make charts.\n\n- cross_reference.py - contains the cross reference table matrix class.\n\n- exceptions.py - contains Geraldo specific exceptions.\n\n- graphics.py - contains graphic classes and definitions\n\n- models.py - there is nothing. Just to be compatible with Django pluggable\n application structure and make possible run tests suite.\n\n- widgets.py - contains widget classes and definitions.\n\n- utils.py - contains useful functions, decorators and flags.\n\n- generators - a package that contains generator classes.\n\n- tests - a package with automated doc tests.\n\"\"\"\n\nfrom .version import __version__\n\n__author__ = 'Marinho Brandao'\n__license__ = 'GNU Lesser General Public License (LGPL)'\n__url__ = 'http://geraldo.sourceforge.net/'\n\ntry:\n from .base import Report, ReportBand, DetailBand, TableBand, ReportGroup,\\\n SubReport, landscape, GeraldoObject, ManyElements, CROSS_COLS\n from .widgets import Label, ObjectValue, SystemField\n from .widgets import FIELD_ACTION_VALUE, FIELD_ACTION_COUNT, FIELD_ACTION_AVG,\\\n FIELD_ACTION_MIN, FIELD_ACTION_MAX, FIELD_ACTION_SUM,\\\n FIELD_ACTION_DISTINCT_COUNT, BAND_WIDTH\n from .graphics import RoundRect, Rect, Line, Circle, Arc, Ellipse, Image\n from .exceptions import EmptyQueryset, ObjectNotFound, ManyObjectsFound, AbortEvent\n from .cross_reference import CrossReferenceMatrix\n from .barcodes import BarCode\nexcept ImportError:\n pass\n\n" }, { "alpha_fraction": 0.5745214223861694, "alphanum_fraction": 0.5779538154602051, "avg_line_length": 34.56338119506836, "blob_id": "f01ae3a31e6bb05acd882f1c66b90794db7bb9a1", "content_id": "92c23957e3206c07a47db90edd0b2b0cdbe9e7cc", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 7649, "license_type": "no_license", "max_line_length": 118, "num_lines": 213, "path": "/Hospital-Helper-2-master/app/gui/db_widget.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import os\nimport math\nimport functools\n\nfrom sqlalchemy import sql\n\nfrom PyQt5.QtCore import Qt\nfrom PyQt5.QtGui import QIcon\nfrom PyQt5.QtWidgets import (QWidget, QFrame, QVBoxLayout, QHBoxLayout,\n QLabel, QGridLayout, QPushButton, QSizePolicy,\n QLineEdit)\n\nfrom app import options\nfrom app.model import db, report\n\nfrom app.gui import utils\n\n\nclass DBWidget(QFrame):\n\n ITEMS_PER_PAGE = 50\n\n def __init__(self, main_window):\n\n \"\"\"\n Widget to show Client model.\n \"\"\"\n\n super().__init__(main_window)\n\n self.items = []\n self.current_items_index = 0\n self.model = db.Client\n self._query = db.SESSION.query(self.model).order_by(self.model.id.desc())\n self._open_report = self._get_open_report_func(main_window)\n self._delete_item = self._get_delete_item_func(main_window)\n self.columns = []\n self._columns_to_display = ['fullname', 'user', 'age', 'examined', 'controls']\n self.layout = QGridLayout()\n self.header_layout = QGridLayout()\n self.control_layout = QWidget()\n self._page_count_label = QLabel('')\n self.layout.setContentsMargins(0, 0, 0, 0)\n self.layout.setSpacing(0)\n vbox = QVBoxLayout()\n vbox.setSpacing(0)\n vbox.addLayout(self._get_search_layout())\n vbox.addLayout(self.header_layout)\n vbox.addWidget(utils.get_scrollable(self.layout))\n vbox.addWidget(self.control_layout)\n self.setLayout(vbox)\n\n control_layout = QHBoxLayout()\n control_layout.addStretch()\n control_layout.addWidget(self._page_count_label)\n for icon, direciton in zip(('left.png', 'right.png'), (-1, 1)):\n b = QPushButton()\n b.setIcon(QIcon(os.path.join(options.STATIC_DIR, 'icons', icon)))\n b.clicked.connect(functools.partial(self._move, direciton))\n b.setObjectName(icon)\n control_layout.addWidget(b)\n self.control_layout.setLayout(control_layout)\n self.setGraphicsEffect(utils.get_shadow())\n\n self.showEvent = self._get_show_event(main_window)\n\n def _get_search_layout(self):\n hbox = QHBoxLayout()\n _input = QLineEdit()\n _input.setGraphicsEffect(utils.get_shadow())\n # _input.setPlaceholderText('Поиск...')\n _input.setPlaceholderText('Pesquisar...')\n _input.textEdited.connect(self._filter)\n hbox.addWidget(_input)\n return hbox\n\n def _filter(self, query_text):\n # Since it's not really important,\n # I'll keep columns hard-coded here.\n # Sqlalchemy doesn't care about ilike function at all\n if query_text and len(query_text) < 3:\n utils.clear_layout(self.layout)\n # self.layout.addWidget(QLabel('Продолжайте печатать...'))\n self.layout.addWidget(QLabel('Continue digitando...'))\n return\n if query_text:\n query_text = '%{}%'.format(query_text.lower())\n db.cursor.execute(options.SEARCH_QUERY, [query_text, query_text, query_text])\n ids = [i[0] for i in db.cursor.fetchall()]\n if ids:\n self.items = db.SESSION.query(self.model).filter(self.model.id.in_(ids))\n else:\n self.items = db.SESSION.query(self.model).filter(sql.false())\n else:\n self.items = self._query\n self.display_model()\n\n def _get_show_event(self, main_window):\n def showEvent(event):\n \"\"\"\n Data is being refreshed on each show.\n \"\"\"\n\n if not self.items:\n self.items = self._query\n\n self.display_model()\n main_window.communication.action_button_toggle.emit(False, '', None)\n\n return showEvent\n\n def hideEvent(self, event):\n \"\"\"\n Delete db items.\n \"\"\"\n\n self.items = None\n\n def display_model(self):\n \"\"\"\n Clear widget and display items.\n \"\"\"\n\n utils.clear_layout(self.layout)\n\n self.columns = []\n j = 0\n\n for c in self._columns_to_display:\n self.columns.append(c)\n l = QLabel(_(c))\n l.setObjectName('header')\n l.setAlignment(Qt.AlignCenter)\n self.header_layout.addWidget(l, 0, j)\n j += 1\n\n for i, item in enumerate(self.items[self.current_items_index:self.current_items_index + self.ITEMS_PER_PAGE]):\n self._add_row(i, item)\n\n empty = QWidget()\n empty.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Expanding)\n self.layout.addWidget(empty, self.layout.rowCount(), 0)\n\n if self.current_items_index and self.current_items_index >= self.items.count():\n self.current_items_index = 0\n return self.display_model()\n\n self.control_layout.setVisible(self.items.count() > self.ITEMS_PER_PAGE)\n page = round(self.current_items_index / self.ITEMS_PER_PAGE) + 1\n page_count = math.floor((self.items.count() - 1) / self.ITEMS_PER_PAGE) + 1\n self._page_count_label.setText('{}/{}'.format(page, page_count))\n\n def _move(self, direction):\n \"\"\"\n Navigate between pages.\n \"\"\"\n\n index = max(self.current_items_index + self.ITEMS_PER_PAGE * direction, 0)\n if index >= self.items.count():\n return\n\n self.current_items_index = index\n self.display_model()\n\n def _get_delete_item_func(self, main_window):\n def _delete_item(item, for_real):\n if not for_real:\n return\n for r in item.report:\n r.delete()\n item.delete()\n self.showEvent(event=None)\n # main_window.show_message('Отчет удален')\n main_window.show_message('Relatório excluído')\n\n def _ask_before_deletion(item):\n # main_window.create_alert('{} {} {}: удалить отчет?'.format(item.surname, item.name, item.patronymic),\n main_window.create_alert('{} {} {}: Excluir relatório?'.format(item.surname, item.name, item.patronymic),\n functools.partial(_delete_item, item))\n return _ask_before_deletion\n\n @staticmethod\n def _get_open_report_func(main_window):\n def _open_report(item):\n try:\n report.Report.open(item.report[0].path)\n except (IndexError, AttributeError, FileNotFoundError):\n # main_window.create_alert('Не удалось открыть отчет')\n main_window.create_alert('Não foi possível abrir o relatório')\n return _open_report\n\n def _get_controls_column(self, item):\n layout = QHBoxLayout()\n for i, callback in zip(('open.png', 'delete_g.png'), (self._open_report, self._delete_item)):\n b = QPushButton()\n b.setIcon(QIcon(os.path.join(options.STATIC_DIR, 'icons', i)))\n b.clicked.connect(functools.partial(callback, item))\n layout.addWidget(b)\n return layout\n\n def _add_row(self, row_id, client):\n \"\"\"\n Create row for item.\n \"\"\"\n for j, c in enumerate(self.columns):\n if c == 'controls':\n self.layout.addLayout(self._get_controls_column(client), row_id, j)\n continue\n if c == 'fullname':\n s = '{} {} {}'.format(client.surname, client.name, client.patronymic)\n else:\n s = str(getattr(client, c))\n self.layout.addWidget(QLabel(s), row_id, j)\n" }, { "alpha_fraction": 0.5918635129928589, "alphanum_fraction": 0.5944882035255432, "avg_line_length": 21.441177368164062, "blob_id": "bc1da806b6217b9e6e91e453780df49f80a77269", "content_id": "e105ee4608a5f7f13fc5fa7c1243eedd2806643c", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 762, "license_type": "no_license", "max_line_length": 38, "num_lines": 34, "path": "/PQt5-Stock/Modelo/persona.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom Modelo.direccion import Direccion\nclass Persona(object):\n\n def __init__(self):\n self.__idPersona = 0\n self.__nombre = \"\"\n self.__email= \"\"\n self.__direccion = Direccion()\n\n def setIdPersona(self, idPersona):\n self.__idPersona = idPersona\n\n def getIdPersona(self):\n return self.__idPersona\n\n def setNombre(self, nombre):\n self.__nombre = nombre\n\n def getNombre(self):\n return self.__nombre\n\n def setEmail(self, email):\n self.__email = email\n\n def getEmail(self):\n return self.__email\n\n def setDireccion(self, direccion):\n self.__direccion = direccion\n\n def getDireccion(self):\n return self.__direccion" }, { "alpha_fraction": 0.5909090638160706, "alphanum_fraction": 0.6010100841522217, "avg_line_length": 18.899999618530273, "blob_id": "8d98015b95442bb24d18c101087d28aa29c2b2a9", "content_id": "d23ceb730065aba7b279fd9ca8f6f42823a8480b", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 198, "license_type": "no_license", "max_line_length": 59, "num_lines": 10, "path": "/PyQT-CRUD-App/run.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/python3\n# -*- coding: utf-8 -*-\nimport sys\nimport os\nfrom app import main\n\n\nif __name__ == '__main__':\n os.chdir((os.path.dirname(os.path.realpath(__file__))))\n sys.exit(main.run())" }, { "alpha_fraction": 0.6086956262588501, "alphanum_fraction": 0.6635611057281494, "avg_line_length": 32.31034469604492, "blob_id": "6f019efddadfbd27d52b749f8e81493a34f7be94", "content_id": "34fcb74dcad9645994ad95295fc6618949a6bac0", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 966, "license_type": "no_license", "max_line_length": 88, "num_lines": 29, "path": "/pyqt5-curso/w01.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import sys\nfrom PyQt5 import QtWidgets, QtCore, QtGui, Qt\n\n\nclass MainWindow:\n def __init__(self):\n self.app = QtWidgets.QApplication(sys.argv)\n self.window = QtWidgets.QMainWindow()\n\n # we call our function initGui()\n self.initGui()\n\n self.window.setGeometry(400, 100, 300, 500)\n self.window.setStyleSheet(\"border: 3px solid #4e4e4e; background-color:#6e6e6e\")\n self.window.show()\n sys.exit(self.app.exec_())\n\n # create a function to initialize the GUI\n def initGui(self):\n self.applyBtn = QtWidgets.QPushButton(\"Apply\", self.window)\n self.applyBtn.setGeometry(170, 420, 120, 30)\n self.applyBtn.setStyleSheet(\"background-color:#4e4e4e; color:#f7f7f7;\")\n\n self.cancelBtn = QtWidgets.QPushButton(\"Cancel\", self.window)\n self.cancelBtn.setGeometry(10, 420, 120, 30)\n self.cancelBtn.setStyleSheet(\"background-color:#4e4e4e; color:#f7f7f7\")\n\n\nmain = MainWindow()\n" }, { "alpha_fraction": 0.6121116876602173, "alphanum_fraction": 0.6168392896652222, "avg_line_length": 40.90565872192383, "blob_id": "bc6b03724faecd68e01ea25874ef596a33038287", "content_id": "70dcf66c54ecae6a01c041a37f2b730fd638a3c3", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 4606, "license_type": "no_license", "max_line_length": 106, "num_lines": 106, "path": "/PyQT-CRUD-App/app/tablewidgets/pcsadd.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/python3\n# -*- coding: utf-8 -*-\n\"\"\"\nДобавление компьютеров из списка\nAdicionando computadores da lista\n\"\"\"\nfrom app.db import data\nfrom PyQt5 import *\nfrom PyQt5.QtWidgets import *\nfrom PyQt5.QtGui import *\nfrom PyQt5.QtCore import *\nfrom PyQt5.Qt import *\n\n\nclass PCAdd(QDialog):\n def __init__(self, session, pcs_to_ignore):\n QDialog.__init__(self)\n self.session = session\n self.pcs_to_ignore = pcs_to_ignore\n self.added_pcs = []\n self.init_window()\n self.build_layout()\n\n def init_window(self):\n self.setFixedSize(800, 450)\n self.setWindowModality(2)\n self.setWindowTitle('Adicionando Computadores')\n self.setWindowIcon(QIcon(r'pics\\pc.png'))\n\n def build_layout(self):\n QVBoxLayout(self)\n\n self.model = QStandardItemModel()\n self.model.setHorizontalHeaderLabels(\n # ['Домен/Имя компьютера', 'MAC-адрес', 'Номер розетки',\n # 'Как подключен', 'Серверные приложения',\n # 'Windows OS', 'Windows OS key', 'Microsoft Office',\n # 'Microsoft Office key', 'Антивирус', 'Клиент электронной почты',\n # 'Прочее', 'Агент KES', 'Консультант', 'Гарант', '1C', 'КДС']\n ['Domain / Computer name', 'MAC address', 'Outlet number',\n 'Como conectado', 'Aplicativos de servidor',\n 'Windows', 'Windows key', 'Microsoft Office',\n 'Microsoft Office key', 'Anti-Virus', 'Cliente de email',\n 'Outro', 'Agente KES', 'Consultor', 'Fiador', '1C', 'KDS']\n )\n\n for pc in [pc for pc in self.session.query(data.Pc).all() if pc not in self.pcs_to_ignore]:\n self.model.appendRow([\n QStandardItem(QIcon(r'pics\\pc.png'), pc.pcname.domain.name + '/' + pc.pcname.name),\n QStandardItem(pc.mac_address),\n QStandardItem(pc.powersocket.name),\n QStandardItem(pc.connectiontype.name),\n QStandardItem(pc.app_server),\n QStandardItem(pc.windows.name),\n QStandardItem(pc.windows_os_key),\n QStandardItem(pc.office.name),\n QStandardItem(pc.ms_office_key),\n QStandardItem(pc.antivirus.name),\n QStandardItem(pc.mail_client),\n QStandardItem(pc.comments),\n QStandardItem('Existem' if pc.kes else 'Não'),\n QStandardItem('Existem' if pc.consultant else 'Não'),\n QStandardItem('Existem' if pc.guarantee else 'Não'),\n QStandardItem('Existem' if pc.odin_s else 'Não'),\n QStandardItem('Existem' if pc.kdc else 'Não')\n ])\n\n self.filter_proxy_model = QSortFilterProxyModel()\n self.filter_proxy_model.setSourceModel(self.model)\n self.filter_proxy_model.setFilterKeyColumn(0)\n\n self.search_filter = QLineEdit()\n self.search_filter.setFixedWidth(500)\n self.search_filter.setClearButtonEnabled(True)\n self.search_filter.setPlaceholderText('Pesquisa de nome de domínio / nome do computador')\n self.search_filter.textChanged.connect(self.filter_proxy_model.setFilterRegExp)\n tooltip = QLabel('<p>Dica: mantenha pressionada a tecla CTRL para selecionar várias entradas</p>')\n\n self.table = QTableView()\n self.table.setSortingEnabled(True)\n self.table.setSelectionBehavior(QAbstractItemView.SelectRows)\n self.table.setEditTriggers(QAbstractItemView.NoEditTriggers)\n self.table.setTextElideMode(Qt.ElideNone)\n self.table.setAlternatingRowColors(True)\n self.table.setModel(self.filter_proxy_model)\n self.table.resizeColumnsToContents()\n\n self.add_pcs = QPushButton('Adicionar selecionado')\n self.add_pcs.setFixedSize(self.add_pcs.sizeHint())\n self.add_pcs.clicked.connect(self.add_selected_pcs)\n\n self.layout().addWidget(self.search_filter)\n self.layout().addWidget(tooltip)\n self.layout().addWidget(self.table)\n self.layout().addWidget(self.add_pcs)\n\n @pyqtSlot()\n def add_selected_pcs(self):\n indexes = self.table.selectionModel().selectedRows()\n for index in indexes:\n mac = self.model.item(index.row(), 1).text()\n self.added_pcs.append(\n self.session.query(data.Pc). \\\n filter_by(mac_address=mac).one()\n )\n QDialog.accept(self)\n" }, { "alpha_fraction": 0.5874125957489014, "alphanum_fraction": 0.5898730754852295, "avg_line_length": 39.647369384765625, "blob_id": "1828af9f8156f3135759bda80f8df7842e3cb147", "content_id": "a715e9401d40af7dc49de4bcd20f6ff94bf9380f", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 7722, "license_type": "no_license", "max_line_length": 167, "num_lines": 190, "path": "/PQt5-Stock/Conexion/conexionTransacciones.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "from Conexion.conexion import Conexion\nfrom Modelo.cliente import Cliente\nfrom Modelo.proveedor import Proveedor\nfrom Modelo.producto import Producto\nimport datetime\n\n\nclass ConexionTransacciones(object):\n\n def __init__(self):\n self.conexion = Conexion()\n self.cliente = Cliente()\n self.proveedor = Proveedor()\n\n\n def selectProveedores(self, typeParameter, parameter):\n query = \"\"\"\n SELECT prov.idproveedores , prov.descripcion, p.nombre, p.email\n FROM proveedores prov, personas p\n WHERE p.idpersonas = prov.personas_idpersonas and prov.estado = 1 and \"\"\"+ typeParameter +\"\"\" LIKE %s\n \"\"\"\n param = parameter + '%'\n values = param\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(query, values)\n listProveedores = self.conexion.cursor.fetchall()\n\n self.conexion.cerrarConexion()\n\n return listProveedores\n\n def selectClientes(self, typeParameter, parameter):\n query = \"\"\"\n SELECT c.idclientes, c.apellido, p.nombre, p.email\n FROM clientes c, personas p\n WHERE p.idpersonas = c.personas_idpersonas and c.estado = 1 and \"\"\"+ typeParameter +\"\"\" LIKE %s\n \"\"\"\n param = parameter + '%'\n values = param\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(query, values)\n listClientes = self.conexion.cursor.fetchall()\n self.conexion.cerrarConexion()\n\n return listClientes\n\n def selectProductos(self, typeParameter, parameter, parameterTransaccion):\n query = \"\"\"\n SELECT p.idproductos, p.nombre, p.descripcion, p.cantidad, CAST(TRUNCATE(p.pCompra, 2) AS CHAR), CAST(TRUNCATE(p.pVenta, 2) AS CHAR), m.descripcion\n FROM productos p, marcas m\n WHERE p.marcas_idmarcas = m.idmarcas and \"\"\" +typeParameter+ \"\"\" LIKE %s\n \"\"\"\n if parameterTransaccion == 'VNT':\n query += \" and p.estado = 1 and p.cantidad > 0\"\n\n param = parameter + '%'\n values = param\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(query, param)\n listProductos = self.conexion.cursor.fetchall()\n self.conexion.cerrarConexion()\n\n return listProductos\n\n def cargarTransaccionCompra(self, listMovimiento, proveedor, estado):\n hoy = datetime.datetime.now().date()\n\n self.conexion.abrirConexion()\n\n queryTipoMovimiento = \"\"\"\n INSERT INTO tipo_movimiento (tipo_movimiento, proveedores_idproveedores)\n VALUES ('compra', %s)\n \"\"\"\n valuesTipoMovimiento = proveedor.getIdProveedor()\n\n self.conexion.cursor.execute(queryTipoMovimiento, valuesTipoMovimiento)\n self.conexion.db.commit()\n idTipoMovimiento = self.conexion.cursor.lastrowid\n cantRowAffect = self.conexion.cursor.rowcount\n\n\n queryMovimiento = \"\"\"\n INSERT INTO movimiento (fecha, tipo_movimiento_idtipo_movimiento, estado)\n VALUES ( %s , %s, %s)\n \"\"\"\n valuesMovimiento = (hoy, idTipoMovimiento, estado)\n\n self.conexion.cursor.execute(queryMovimiento, valuesMovimiento)\n self.conexion.db.commit()\n idMovimiento = self.conexion.cursor.lastrowid\n cantRowAffect = self.conexion.cursor.rowcount\n\n\n queryDetalleMovimiento = \"\"\"\n INSERT INTO detalle_movimiento (cantidad, precio_unitario, productos_idproductos,\n movimiento_idMovimiento)\n VALUES (%s, %s , %s, %s)\n \"\"\"\n for detalleMovimiento in listMovimiento:\n valuesDetalleMovimiento = (detalleMovimiento[1], detalleMovimiento[5], detalleMovimiento[2], idMovimiento)\n self.conexion.cursor.execute(queryDetalleMovimiento, valuesDetalleMovimiento)\n self.conexion.db.commit()\n lastId = self.conexion.cursor.lastrowid\n cantRowAffect = self.conexion.cursor.rowcount\n producto = Producto()\n producto.setIdProducto(int(detalleMovimiento[2]))\n producto.setCantidad(int(detalleMovimiento[1]))\n self.modificarStock('CMP', producto)\n\n self.conexion.cerrarConexion()\n return idMovimiento\n\n def cargarTransaccionVenta(self: object, listMovimiento, cliente, estado):\n hoy = datetime.datetime.now().date()\n\n self.conexion.abrirConexion()\n\n queryTipoMovimiento = \"\"\"\n INSERT INTO tipo_movimiento (tipo_movimiento, clientes_idClientes)\n VALUES ('venta', %s)\n \"\"\"\n valuesTipoMovimiento = cliente.getIdCliente()\n\n self.conexion.cursor.execute(queryTipoMovimiento, valuesTipoMovimiento)\n self.conexion.db.commit()\n idTipoMovimiento = self.conexion.cursor.lastrowid\n cantRowAffect = self.conexion.cursor.rowcount\n\n\n queryMovimiento = \"\"\"\n INSERT INTO movimiento (fecha, tipo_movimiento_idtipo_movimiento, estado)\n VALUES ( %s , %s, %s);\n \"\"\"\n valuesMovimiento = (hoy, idTipoMovimiento, estado)\n\n self.conexion.cursor.execute(queryMovimiento, valuesMovimiento)\n self.conexion.db.commit()\n idMovimiento = self.conexion.cursor.lastrowid\n cantRowAffect = self.conexion.cursor.rowcount\n\n\n queryDetalleMovimiento = \"\"\"\n INSERT INTO detalle_movimiento (cantidad, precio_unitario, productos_idproductos,\n movimiento_idMovimiento)\n VALUES (%s, %s , %s, %s)\n \"\"\"\n for detalleMovimiento in listMovimiento:\n valuesDetalleMovimiento = (detalleMovimiento[1], detalleMovimiento[5], detalleMovimiento[2], idMovimiento)\n self.conexion.cursor.execute(queryDetalleMovimiento, valuesDetalleMovimiento)\n self.conexion.db.commit()\n lastId = self.conexion.cursor.lastrowid\n cantRowAffect = self.conexion.cursor.rowcount\n\n producto = Producto()\n producto.setIdProducto(int(detalleMovimiento[2]))\n producto.setCantidad(int(detalleMovimiento[1]))\n self.modificarStock(tipoT='VNT', producto=producto)\n\n self.conexion.cerrarConexion()\n\n return idMovimiento\n\n\n def modificarStock(self, tipoT, producto):\n query = \"\"\"\n SELECT cantidad\n FROM productos\n WHERE idproductos = %s\n \"\"\"\n values = producto.getIdProducto()\n #self.conexion.abrirConexion()\n self.conexion.cursor.execute(query, values)\n cant = 0\n cantInit = int(self.conexion.cursor.fetchall()[0][0])\n #self.conexion.cerrarConexion()\n if tipoT == 'VNT':\n cant = cantInit - producto.getCantidad()\n else:\n cant = cantInit + producto.getCantidad()\n\n queryUpdateProducto = \"\"\"\n UPDATE productos\n SET cantidad = %s\n WHERE idproductos = %s\n \"\"\"\n valuesUpdateProducto = (cant, producto.getIdProducto())\n #self.conexion.abrirConexion()\n self.conexion.cursor.execute(queryUpdateProducto, valuesUpdateProducto)\n self.conexion.db.commit()\n #self.conexion.cerrarConexion()" }, { "alpha_fraction": 0.5558004379272461, "alphanum_fraction": 0.5970747470855713, "avg_line_length": 27.689655303955078, "blob_id": "6bca39c2da355c133fa0551655ced116e2b4a0ee", "content_id": "162f992ccff2eac7caf3bb965d0d525bab782490", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 5007, "license_type": "no_license", "max_line_length": 91, "num_lines": 174, "path": "/JPro-master/cbox.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#====##====##====##====##====#\n#====##====##====##====##====#\n'''\nCalcuator to find out the total process time for one: \n \n'''\n#====##====##====##====##====#\n#====##====##====##====##====#\n\nimport sys \nimport datetime\nfrom PyQt5.QtWidgets import (QApplication, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQWidget, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQLabel, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQTableWidget,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQTableWidgetItem,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQListWidget,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQListWidgetItem,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQHBoxLayout,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQVBoxLayout,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQGridLayout,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQShortcut,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tqApp,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQComboBox,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQHeaderView,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQAbstractItemView,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\nfrom PyQt5.QtGui import QKeySequence,QStandardItem,QStandardItemModel\nfrom PyQt5.QtSql import QSqlDatabase, QSqlTableModel, QSqlQuery\nfrom connect import Connect \nfrom dbcreation import Base, Models, ProductionQueue\nfrom dialog_new import Dialog as DBox\n\ndictionary = {'P1': {'X1':12, 'X2':12, 'X3':12},\n\t\t\t\t\t\t\t'P2': {'X1':4, 'X2': 6, 'X3': 7}, \n\t\t\t\t\t\t\t'P3': {'X4':3, 'X5':3,'X6': 3},\n\t\t\t\t\t\t\t'P4': {'X4':6, 'X5':6, 'X6':4},\n\t\t\t\t\t\t\t'P5': {'C1':5, 'X3':5, 'X7':8},\n\t\t\t\t\t\t\t'P6': {'C1':7, 'X2':5, 'X7':8},\n\t\t\t\t\t\t\t'P7': {'X3':15, 'X4':13, 'X5':18},\n\t\t\t\t\t\t\t'P8': {'X2':9, 'X4':9, 'X6':10},\n\t\t\t\t\t\t\t'P9': {'X3':4, 'X6':5, 'X7':5},\n\t\t\t\t\t\t\t'P10':{'X1':1, 'X2':1, 'X4': 1}\n}\n\ndictionary2 = {'P1': [['X1',12],['X2',12],['X3',12]],\n\t\t\t\t\t\t\t'P2': [['X1',4],['X2',6],['X3',7]], \n\t\t\t\t\t\t\t'P3': [['X4',3], ['X5',3],['X6', 3]],\n\t\t\t\t\t\t\t'P4': [['X4',6], ['X5',6], ['X6',4]],\n\t\t\t\t\t\t\t'P5': [['C1',5], ['X3',5], ['X7',8]],\n\t\t\t\t\t\t\t'P6': [['C1',7], ['X2',5], ['X7',8]],\n\t\t\t\t\t\t\t'P7': [['X3',15], ['X4',13], ['X5',18]],\n\t\t\t\t\t\t\t'P8': [['X2',9], ['X4',9], ['X6',10]],\n\t\t\t\t\t\t\t'P9': [['X3',4], ['X6',5], ['X7',5]],\n\t\t\t\t\t\t\t'P10':[['X1',1], ['X2',1], ['X4',1]]\n}\n\nclass CBox(QWidget): \n\n\tdef __init__(self): \n\t\tsuper().__init__()\n\t\texitShortcut = QShortcut(QKeySequence('Ctrl+W'),self, qApp.quit)\n\n\t\tself.connect = Connect()\n\t\tself.all_models = self.connect.session.query(Models).all()\n\n\n\t\tself.table = self.table = QTableWidget(5,3,self)\n\t\tself.setTableHeaders()\n\n\t\tself.organiseTable()\n\n\t\tself.populate('M1')\n\t\tself.createconnections()\n\n\t\tself.table.move(100,100)\n\n\n\t\tself.createList()\n\t\tself.list.currentItemChanged.connect(self.listClicked)\n\n\n\n#\t\tprint('Current Item :', self.list.currentItem())\n\t\tself.positionWidgets()\n\t\tself.mainhbox = QHBoxLayout()\n\t\tself.mainhbox.addWidget(self.list)\n\t\tself.mainhbox.addWidget(self.table)\n\n\t\tself.setLayout(self.mainhbox)\n\n\t\tself.setGeometry(0,0,640,440)\n\t\tself.show()\n\n#===#===#===#===#===#===#===#===#===#\n#METHODS\n#===#===#===#===#===#===#===#===#===#\n\n\t'''\n\tSet the headers for the table.\n\t'''\n\tdef setTableHeaders(self):\n\t\tself.table.setHorizontalHeaderItem(0, QTableWidgetItem('Parts /零件'))\n\t\tself.table.setHorizontalHeaderItem(1, QTableWidgetItem('Time / 时'))\t\t\n\t\tself.table.setHorizontalHeaderItem(2, QTableWidgetItem('Process /机器'))\n\n\t'''\n\tThis method resizes the table & allows entire rows to be highlight when selected\t\n\t'''\n\tdef organiseTable(self):\n\t\tself.order_header = self.table.horizontalHeader()\n\t\tself.order_header.setMinimumSectionSize(130)\n\t\tself.order_header.setSectionResizeMode(QHeaderView.Stretch)\n\t\t#self.table.setSelectionBehavior(QAbstractItemView.SelectRows)\n\t\tself.table.setCurrentCell(-1,-1)\n\n\tdef populate(self,model):\n\t\tparts = self.connect.session.query(Models).filter_by(name = model).one()\n\t\tparts = parts.parts.split(',')\t\n\t\trow = 0\n\t\tself.comboboxlist = [QComboBox() for _ in range(len(parts))]\n\t\tprint (self.comboboxlist)\n\t\tfor p in parts: \n\t\t\tself.comboboxlist[row] = self.addComboBox(self.comboboxlist[row], p)\n\t\t\tself.table.setItem(row, 0, QTableWidgetItem(p))\n\t\t\tself.table.setItem(row, 1, QTableWidgetItem(str(self.comboboxlist[row].currentData()))) \n\t\t\t#self.table.setCellWidget(row,2, self.comboboxlist[row])\n\n\t\t\trow += 1 \n\n\tdef createconnections(self):\n\t\tfor i in range(0,len(self.comboboxlist)):\n\t\t\tself.comboboxlist[i].currentIndexChanged.connect(self.time_combo)\n\n\tdef time_combo(self,parsed):\n\t\tprint('object:', parsed)\n\t\t\n\n\tdef generatecombo(self, parts):\n\t\tpass\n\n\tdef addComboBox(self, combobox, part):\n\t\tfor x in dictionary2[part]:\n\t\t\tcombobox.addItem(x[0],x[1])\n\t\treturn combobox\n\n\tdef showInfo(self, queryitem):\n\t\t# query = self.connect.session.query(Models).filter_by(name=queryitem).one()\t\n\t\t# self.labelval_name.setText(query.name)\n\t\t# self.labelval_parts.setText(query.parts)\n\t\t# self.labelval_current_quantity.setText(str(query.current_quantity))\n\n\t\t# self.labelval_parts.adjustSize()\n\t\tpass\n\n\tdef createList(self): \n\t\tself.list = QListWidget(self)\n\t\tfor model in self.all_models: \n\t\t\tself.list.addItem(QListWidgetItem(model.name))\n\t\t\tself.list.setMinimumSize(150,200)\n\t\t\tself.list.setMaximumSize(150,600)\n\n\tdef positionWidgets(self):\n\t\tpass\n\n\tdef listClicked(self):\n\t\tcurrent_selection = self.list.currentItem().text()\n\t\tself.showInfo(current_selection)\n\nif __name__ == '__main__' : \n\n\tapp = QApplication(sys.argv)\n\tcbox = CBox()\n\tsys.exit(app.exec_())" }, { "alpha_fraction": 0.6330403685569763, "alphanum_fraction": 0.64762282371521, "avg_line_length": 29.33333396911621, "blob_id": "d57f4a9ae82078eb637dc449e1561e6996e8702a", "content_id": "72dd29c6cceb5f037046d86b3402ad1deca24402", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 5006, "license_type": "no_license", "max_line_length": 114, "num_lines": 165, "path": "/djangosige/venv/Lib/site-packages/geraldo/utils.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import sys\nimport collections\n\ntry:\n import reportlab\nexcept ImportError:\n cm = 28.346456692913385\n A4 = (595.275590551181, 841.8897637795275)\n black = None\n TA_LEFT, TA_CENTER, TA_RIGHT = 0, 1, 2\n landscape = lambda t:(t[1],t[0])\nelse:\n from reportlab.lib.units import * # Check this - is the source of units\n from reportlab.lib.pagesizes import * # Check this - is the source of page sizes\n from reportlab.lib.enums import TA_LEFT, TA_CENTER, TA_RIGHT # Check this also\n from reportlab.lib.colors import black\n\nfrom .exceptions import AttributeNotFound\n\ntry:\n from functools import wraps\nexcept ImportError:\n wraps = lambda func: func\n\n# FLAGS\n\nBAND_WIDTH = 'band-width'\nBAND_HEIGHT = 'band-height'\nCROSS_COLS = 'cross-cols'\nCROSS_ROWS = 'cross-rows'\n\nFIELD_ACTION_VALUES = 'values' # \\\nFIELD_ACTION_FIRST = 'first' # > Used only by cross reference functions\nFIELD_ACTION_LAST = 'last' # /\nFIELD_ACTION_VALUE = 'value'\nFIELD_ACTION_COUNT = 'count'\nFIELD_ACTION_AVG = 'avg'\nFIELD_ACTION_MIN = 'min'\nFIELD_ACTION_MAX = 'max'\nFIELD_ACTION_SUM = 'sum'\nFIELD_ACTION_DISTINCT_COUNT = 'distinct_count'\nFIELD_ACTION_PERCENT = 'percent'\n\nSYSTEM_FIELD_CHOICES = {\n 'report_title': 'ReportTitle',\n 'page_number': 'PageNumber',\n 'page_count': 'PageCount',\n 'current_datetime': 'CurrentDateTime',\n 'report_author': 'Author',\n}\n\ndef _get_memoized_value(func, args, kwargs):\n \"\"\"Used internally by memoize decorator to get/store function results\"\"\"\n key = (repr(args), repr(kwargs))\n\n if not key in func._cache_dict:\n ret = func(*args, **kwargs)\n func._cache_dict[key] = ret\n\n return func._cache_dict[key]\n\ndef memoize(func):\n \"\"\"Decorator that stores function results in a dictionary to be used on the\n next time that the same arguments were informed.\"\"\"\n\n func._cache_dict = {}\n\n def _inner(*args, **kwargs):\n return _get_memoized_value(func, args, kwargs)\n\n if sys.version.startswith('2.4'):\n return _inner\n else:\n return wraps(func)(_inner)\n\ndef get_attr_value(obj, attr_path):\n \"\"\"This function gets an attribute value from an object. If the attribute\n is a method with no arguments (or arguments with default values) it calls\n the method. If the expression string has a path to a child attribute, it\n supports.\n\n Examples:\n\n attribute_name = 'name'\n attribute_name = 'name.upper'\n attribute_name = 'customer.name.lower'\n \"\"\"\n if not attr_path:\n raise Exception('Invalid attribute path \\'%s\\''%attr_path)\n\n parts = attr_path.split('.')\n\n try:\n if hasattr(obj, '_default_' + parts[0]):\n default = getattr(obj, '_default_' + parts[0])\n val = getattr(obj, parts[0], default)\n if val is None:\n val = default\n else:\n val = getattr(obj, parts[0])\n except AttributeError:\n try:\n val = obj[parts[0]]\n except (KeyError, TypeError):\n raise AttributeNotFound('There is no attribute nor key \"%s\" in the object \"%s\"'%(parts[0], repr(obj)))\n\n if len(parts) > 1:\n val = get_attr_value(val, '.'.join(parts[1:]))\n\n if isinstance(val, collections.Callable):\n val = val()\n\n return val\n\n@memoize\ndef calculate_size(size):\n \"\"\"Calculates the informed size. If this is a string or unicode, it is\n converted to float using evaluation function\"\"\"\n if isinstance(size, str):\n return eval(size) # If you are thinking this is a semanthic bug, you must\n # be aware this 'eval' is necessary to calculate sizes\n # like '10*cm' or '15.8*rows'\n # I want to check if eval is better way to do it than\n # do a regex matching and calculate. TODO\n\n return size\n\n# Replaced by ReportLab landscape and portrait functions\n#@memoize\n#def landscape(page_size):\n# return page_size[1], page_size[0]\n\n@memoize\ndef format_date(date, expression):\n return date.strftime(expression)\n\n# Tries to import class Process from multiprocessing library and sets\n# it as None if import fails\ntry:\n from multiprocessing import Process\nexcept ImportError:\n Process = None\n\n# Sets this to True if you don't want to use multiprocessing on\n# functions with 'run_under_process' decorator\nDISABLE_MULTIPROCESSING = False\n\ndef run_under_process(func):\n \"\"\"This is a decorator that uses multiprocessing library to run a\n function under a new process. To use it on Python 2.4 you need to\n install python-multiprocessing package.\n\n Just remember that Process doesn't support returning value\"\"\"\n\n def _inner(*args, **kwargs):\n # If multiprocessing is disabled, just runs function with\n # its arguments\n if not Process or DISABLE_MULTIPROCESSING:\n func(*args, **kwargs)\n\n prc = Process(target=func, args=args, kwargs=kwargs)\n prc.start()\n prc.join()\n\n return _inner\n\n" }, { "alpha_fraction": 0.5394898056983948, "alphanum_fraction": 0.5553571581840515, "avg_line_length": 52.55191421508789, "blob_id": "d2f39b8bad35077a9d9eceb0e2cc333fbb0e9d9e", "content_id": "ba38dd13a81c71802a995945f1725b552957343f", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 19615, "license_type": "no_license", "max_line_length": 562, "num_lines": 366, "path": "/fullcontrol-menu/ruller.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/bin/env python3\n# -*- coding: utf-8 -*-\n\n# screenrulerzoom v1.0 - Simple screen ruler\n# Copyright © 2015 ElMoribond (Michael Herpin)\n#\n# This program is free software: you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation, either version 3 of the License, or\n# (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program. If not, see <http://www.gnu.org/licenses/>.\n\nfrom collections import deque\nfrom copy import deepcopy\nfrom functools import partial\nfrom gettext import bindtextdomain, gettext, textdomain\nfrom os import path\nfrom time import time\nfrom PyQt5.QtCore import pyqtSignal, QSettings, Qt, QTimer, QUrl\nfrom PyQt5.QtGui import QColor, QCursor, QDesktopServices, QIcon, QPainter, QPen, QPixmap\nfrom PyQt5.QtWidgets import QAction, QApplication, QColorDialog, QDialog, QGridLayout, QMainWindow, QMessageBox, QPushButton, QStyle, QLabel, QLayout, QMenu\n\nPROJECT_NAME= \"ScreenRulerZoom\"\nPROJECT_VERSION= \"1.0\"\nPROJECT_RELEASE_DATE= \"2015-04-06\"\nPROJECT_TEAM= \"ElMoribond\"\nPROJECT_EMAIL= \"elmoribond@gmail.com\"\nPROJECT_URL= \"https://github.com/ElMoribond/screenrulerzoom\"\n\nbindtextdomain(PROJECT_NAME.lower(), path.join(path.dirname(path.realpath(__file__)), \"i18n\"))\ntextdomain(PROJECT_NAME.lower())\n\nclass Ruler(QMainWindow):\n cursorMove= pyqtSignal(object)\n\n class Menu(QMenu):\n\n class AboutDialog(QDialog):\n\n class Label(QLabel):\n\n def __init__(self):\n super().__init__()\n self.setPixmap(QPixmap(path.join(path.dirname(path.realpath(__file__)), \"png\", \"gplv3-127x51.png\")))\n\n def mousePressEvent(self, event):\n if event.button() == Qt.LeftButton:\n QDesktopServices.openUrl(QUrl(\"http://www.gnu.org/licenses/quick-guide-gplv3.html\"))\n\n def enterEvent(self, event):\n QApplication.setOverrideCursor(QCursor(Qt.PointingHandCursor))\n super().enterEvent(event)\n\n def leaveEvent(self, event):\n QApplication.restoreOverrideCursor()\n super().leaveEvent(event)\n\n # Init de AboutDialog\n def __init__(self, parent):\n super().__init__(parent)\n self.setWindowTitle(\"%s %s\" % (parent.about, PROJECT_NAME))\n self.setWindowFlags(Qt.Dialog|Qt.WindowStaysOnTopHint)\n self.rejected.connect(self.close)\n logo, layout, butttonClose= QLabel(), QGridLayout(self), QPushButton(self.style().standardIcon(QStyle.SP_DialogCloseButton), \"\")\n logo.setPixmap(Ruler.logo)\n email= QLabel(\"%s <a href='mailto:%s?subject=[%s]'>%s</a>\" % (gettext(\"Lost in French countryside but reachable\"), PROJECT_EMAIL, PROJECT_NAME, PROJECT_EMAIL))\n email.setOpenExternalLinks(True)\n url= QLabel(\"<br /><a href='%s'>%s</a><br />\" % (PROJECT_URL, PROJECT_URL))\n url.setOpenExternalLinks(True)\n butttonClose.clicked.connect(self.close)\n layout.addWidget(logo, 0, 0, 4, 1)\n layout.addWidget(QLabel(\"%s v%s %s %s\" % (PROJECT_NAME, PROJECT_VERSION, gettext(\"released on\"), PROJECT_RELEASE_DATE)), 0, 1, 1, 2)\n layout.addWidget(QLabel(\"%s %s\" % (gettext(\"Created by\"), PROJECT_TEAM)), 1, 1, 1, 2)\n layout.addWidget(email, 2, 1, 1, 2)\n layout.addWidget(QLabel(gettext(\"Released under GNU GPLv3 license\")), 3, 1)\n layout.addWidget(self.Label(), 3, 2, 2, 1, Qt.AlignTop|Qt.AlignRight)\n layout.addWidget(QLabel(\"\\nCopyright © 2015 %s (Michael Herpin). %s.\\n%s.\\n%s.\" % (PROJECT_TEAM, gettext(\"All rights reserved\"), gettext(\"This program comes with ABSOLUTELY NO WARRANTY\"), gettext(\"This is free software, and you are welcome to redistribute it under certain conditions\"))), 4, 0, 1, 3)\n layout.addWidget(url, 5, 0, 1, 3)\n layout.addWidget(butttonClose, 6, 0, 1, 3)\n layout.setSizeConstraint(QLayout.SetFixedSize)\n\n # Init de Menu\n def __init__(self, parent):\n super().__init__(parent)\n self.parent, unitMeasure, rulerSize, colors, zoom= parent, QMenu(gettext(\"Unit Measure\"), self), QMenu(gettext(\"Ruler Size\"), self), QMenu(gettext(\"Colors\"), self), QMenu(gettext(\"Zoom\"), self)\n self.addAction(QAction(parent.orientation[1 if not parent.oH else 0], self, triggered= partial(parent.changeOrientation, 1 if not parent.oH else 0)))\n for menu in [ [ zoom, parent.zooms, parent.changeMode, parent.zoom ], [ unitMeasure, parent.unitMeasure, parent.changeUnitMeasure, parent.cUM ], [ rulerSize, parent.rulerSize, parent.changeRulerSize, parent.sXY ], [ colors, parent.colors, parent.changeRulerColor, parent.defaultColors ] ]:\n for i, item in enumerate(menu[1]):\n item= QAction(item[0][0], self, triggered= partial(menu[2], i))\n if type(menu[3]) == type(list()) and i == len(menu[1]) - 1:\n menu[0].addSeparator()\n item.setEnabled(False if menu[1] == menu[3] else True)\n else:\n item.setCheckable(True)\n item.setChecked(True if i == menu[3] else False)\n item.setEnabled(not item.isChecked())\n menu[0].addAction(item)\n if menu[0] in [ unitMeasure, colors ]:\n menu[0].setEnabled(not bool(parent.zoom))\n self.addMenu(menu[0])\n self.addSeparator()\n self.addAction(QAction(parent.about, self, triggered= self.AboutDialog(parent).exec_))\n self.addSeparator()\n self.addAction(QAction(gettext(\"Exit\"), self, triggered= parent.close))\n\n def exec_(self, point):\n Ruler.menu= True\n super().exec_(point)\n\n def closeEvent(self, event):\n Ruler.menu= False\n self.parent.mouseTimer.timeout.connect(self.parent.pollCursor)\n\n # Init de Ruler\n def __init__(self):\n super().__init__()\n Ruler.logo, Ruler.menu= QPixmap(path.join(path.dirname(path.realpath(__file__)), \"png\", \"%s.png\" % PROJECT_NAME.lower())), False\n self.setWindowIcon(QIcon(Ruler.logo))\n self.setWindowFlags(Qt.Tool|Qt.FramelessWindowHint|Qt.WindowStaysOnTopHint)\n self.setContextMenuPolicy(Qt.CustomContextMenu)\n self.customContextMenuRequested.connect(self.openContextMenu)\n self.about, self.orientation, self.unitMeasure= gettext(\"About\"), [ gettext(\"Horizontal\"), gettext(\"Vertical\") ], [ [ [ gettext(\"Pixel\"), gettext(\"px\") ], [ 1, 1 ] ], [ [ gettext(\"Point\"), gettext(\"pt\"), 1 ], [ self.logicalDpiX() / 6 * 2, self.logicalDpiY() / 6 * 2 ] ], [ [ gettext(\"Inch\"), gettext(\"in\") ], [ self.logicalDpiX(), self.logicalDpiY() ] ], [ [ gettext(\"Pica\"), gettext(\"pc\"), 1 ], [ self.logicalDpiX() / 6, self.logicalDpiY() / 6 ] ], [ [ gettext(\"Centimeter\"), gettext(\"cm\") ], [ self.logicalDpiX() / 2.54, self.logicalDpiY() / 2.54 ] ] ]\n self.screen, self.colors= app.desktop().screenGeometry().bottomRight(), [ [ [ gettext(\"Text\"), QColor(230, 230, 250) ] ], [ [ gettext(\"Background\"), QColor(0, 30, 120) ] ], [ [ gettext(\"Highlight\"), QColor(220, 0, 0) ] ], [ [ gettext(\"Default Colors\") ] ] ]\n self.sX, self.sY, self.rulerSize, self.cursor, self.mouseTimer, self.defaultColors= 600, 70, [ [ [ gettext(\"Normal\") ] ], [ [ gettext(\"x2\") ] ], [ [ gettext(\"x3\") ] ], [ [ gettext(\"x4\") ] ] ], None, QTimer(self), deepcopy(self.colors)\n self.pix, self.ps, self.csec, self.moving, self.ps, self.zooms, self.mark, self.settings= None, app.primaryScreen(), time(), False, app.primaryScreen(), [ [ [ gettext(\"None\") ] ], [ [ self.rulerSize[1][0][0] ] ], [ [ self.rulerSize[2][0][0] ] ], [ [ self.rulerSize[3][0][0] ] ] ], deque(maxlen= 2), QSettings(PROJECT_TEAM, PROJECT_NAME)\n self.sXY= self.cUM= self.oH= self.zoom= 0\n self.cursorMove.connect(self.handleCursorMove)\n self.mouseTimer.setInterval(50)\n self.mouseTimer.timeout.connect(self.pollCursor)\n self.mouseTimer.start()\n for i, item in enumerate([ \"Colors/Text\", \"Colors/Background\", \"Colors/Highlight\" ]):\n if type(self.settings.value(item, None)) == type(QColor()) and self.settings.value(item, None).isValid():\n self.colors[i][0][1]= self.settings.value(item)\n for item in [ [ \"GUI/Zoom\", \"mode\", 2 ], [ \"GUI/Orientation\", \"oH\", 2 ], [ \"GUI/Size\", \"sXY\", len(self.colors) ], [ \"GUI/UnitMeasure\", \"cUM\", len(self.unitMeasure) ] ]:\n if int(self.settings.value(item[0], -1)) in range(1, item[2]):\n setattr(self, item[1], int(self.settings.value(item[0])))\n self.changeRulerSize(self.sXY)\n self.changeOrientation(self.oH)\n if self.settings.contains(\"GUI/Position\"):\n self.move(self.settings.value(\"GUI/Position\"))\n else:\n self.move(app.desktop().screen().rect().center() - self.rect().center())\n self.saveBackground()\n\n def closeEvent(self, event):\n for item in [ [ \"GUI/Zoom\", self.zoom ], [ \"GUI/Orientation\", self.oH ], [ \"GUI/Position\", self.pos() ], [ \"GUI/Size\", self.sXY ], [ \"GUI/UnitMeasure\", self.cUM ], [ \"Colors/Text\", self.colors[0][0][1] ], [ \"Colors/Background\", self.colors[1][0][1] ], [ \"Colors/Highlight\", self.colors[2][0][1] ] ]:\n self.settings.setValue(item[0], item[1])\n self.settings.sync()\n app.quit()\n\n def keyPressEvent(self, event):\n if event.key() == Qt.Key_Escape:\n self.close()\n elif event.key() in [ Qt.Key_Left, Qt.Key_Right, Qt.Key_Up, Qt.Key_Down ]:\n if time() > self.csec + 1:\n point= self.frameGeometry().topLeft()\n unit= 10 if event.modifiers() == Qt.ControlModifier else 1\n if event.key() == Qt.Key_Left and point.x() >= unit:\n point.setX(point.x() - unit)\n elif event.key() == Qt.Key_Right and point.x() + self.width() <= self.screen.x():\n point.setX(point.x() + unit)\n elif event.key() == Qt.Key_Up and point.y() >= unit:\n point.setY(point.y() - unit)\n elif event.key() == Qt.Key_Down and point.y() + self.height() <= self.screen.y():\n point.setY(point.y() + unit)\n self.move(point)\n self.repaint()\n self.csec= time()\n self.saveBackground()\n else:\n super().keyPressEvent(event)\n\n def mouseDoubleClickEvent(self, event):\n if not self.cUM:\n self.mark.append(event.pos())\n if len(self.mark) == 2:\n QMessageBox.information(self, \"\\0\", str(event.pos().y() - self.mark[0].y() if self.oH else event.pos().x() - self.mark[0].x()).replace(\"-\", \"\"), QMessageBox.Ok)\n self.mark.clear()\n\n def mousePressEvent(self, event):\n if event.button() == Qt.LeftButton:\n self.offset, self.moving= event.pos(), True\n self.repaint()\n else:\n super().mousePressEvent(event)\n\n def mouseReleaseEvent(self, event):\n if event.button() == Qt.LeftButton:\n self.saveBackground()\n self.offset, self.moving= None, False\n else:\n super().mouseReleaseEvent(event)\n\n def mouseMoveEvent(self, event):\n self.mark.clear()\n self.move(self.mapToParent(event.pos() - self.offset))\n\n def paintEvent(self, event):\n qp, unit, cpt, min, mid, max= QPainter(), self.unitMeasure[self.cUM][1][self.oH], -1, 10, 15, 20\n qp.begin(self)\n qp.setPen(self.colors[0][0][1])\n if self.zoom:\n if not self.moving:\n if self.pix is None:\n self.saveBackground()\n qp.drawPixmap(0, 0, self.pix.scaled(self.size() * (self.zoom + 1), Qt.KeepAspectRatio))\n else:\n qp.setBrush(self.colors[1][0][1])\n qp.drawRect(-1, -1, self.width() + 1, self.height() + 1)\n else:\n qp.setBrush(self.colors[1][0][1])\n qp.drawRect(-1, -1, self.width() + 1, self.height() + 1)\n # Affichage de la graduation\n for i in range(self.height() if self.oH else self.width()):\n length= 0\n # Affichage en pixel\n if not self.cUM:\n length, cpt= max if not i % 50 else mid if not i % 10 else min if not i % 2 else 0, cpt + 1\n # Autre unité\n else:\n if (self.cUM in [ 1, 2, 3 ] and not i % unit) or (self.cUM == 4 and not i % round(unit)):\n length, cpt= max, cpt+ 1\n elif (self.cUM in [ 1, 2, 3 ] and not i % (unit / 4)) or (self.cUM == 4 and not i % round(unit / 2)):\n length= min\n cS= self.fontMetrics().tightBoundingRect(str(cpt) if cpt else self.unitMeasure[self.cUM][0][1])\n # Affichage de l'unité\n if i == 1:\n if self.oH:\n qp.drawText((self.width() - cS.width()) / 2, cS.height(), self.unitMeasure[self.cUM][0][1])\n else:\n qp.drawText(3, self.height() / 2 + cS.height() / 3, self.unitMeasure[self.cUM][0][1])\n elif i and length:\n if self.oH:\n qp.drawLine(0, i, length, i)\n qp.drawLine(self.width(), i, self.width() - length - 1, i)\n if length == max:\n qp.drawText((self.width() - cS.width()) / 2, i + cS.height() / 2, str(cpt))\n else:\n qp.drawLine(i, 0, i, length)\n qp.drawLine(i, self.height(), i, self.height() - length - 1)\n if length == max:\n qp.drawText(i - cS.width() / 2, self.height() / 2 + cS.height() / 2, str(cpt))\n # Affichage de la position du curseur\n if self.cursor is not None and not Ruler.menu and (self.oH and self.mapFromParent(self.cursor).y() > -1 or not self.oH and self.mapFromParent(self.cursor).x() > -1) and (self.oH and self.mapFromParent(self.cursor).y() < self.height() or not self.oH and self.mapFromParent(self.cursor).x() < self.width()):\n self.drawCursorPosition(qp, self.mapFromParent(self.cursor))\n if not self.cUM:\n # Affichage des positions sauvegardés\n for m in self.mark:\n self.drawCursorPosition(qp, m)\n\n def drawCursorPosition(self, qp, cp):\n qp.setPen(QPen(self.colors[2][0][1], 1, Qt.DashLine))\n cS= self.fontMetrics().tightBoundingRect(str(cp.y() if self.oH else cp.x()))\n # Unité autre que pixel, juste ligne hachurée\n if self.cUM:\n if self.oH:\n qp.drawLine(0, cp.y(), self.width(), cp.y())\n else:\n qp.drawLine(cp.x(), 0, cp.x(), self.height())\n # Unité pixel, ligne hacurée + position\n else:\n # Affichage vertical\n if self.oH:\n qp.drawLine(0, cp.y(), (self.width() / 2) - (cS.width() / 2), cp.y())\n qp.drawLine((self.width() / 2) + (cS.width() / 2), cp.y(), self.width(), cp.y())\n qp.setPen(QPen(Qt.NoPen))\n # Curseur en deça de la fenêtre\n if cp.y() - cS.height() / 2 < 1:\n y= cS.height() + 2\n # Curseur au dela\n elif cp.y() + cS.height() / 2 + 2 > self.height():\n y= self.height() - (cS.height() / 2)\n # Dans la fenêtre\n else:\n y= cp.y() + cS.height() / 2\n # Mode zoom\n if not self.zoom:\n qp.drawRect((self.width() / 2 - cS.width() / 2) - 2, y - cS.height() - 2, cS.width() + 4, cS.height() + 4)\n qp.setPen(QPen(self.colors[2][0][1], 1, Qt.SolidLine))\n qp.drawText(self.width() / 2 - cS.width() / 2, y, str(cp.y()))\n # Affichage horizontcal\n else:\n qp.drawLine(cp.x(), 0, cp.x(), (self.height() / 2) - (cS.height() / 2))\n qp.drawLine(cp.x(), (self.height() / 2) + (cS.height() / 2), cp.x(), self.height())\n qp.setPen(QPen(Qt.NoPen))\n # Curseur en deça de la fenêtre\n if cp.x() - cS.width() / 2 < 1:\n x= 2\n # Curseur au dela\n elif cp.x() + cS.width() / 2 + 2 > self.width():\n x= self.width() - cS.width() - 2\n # Dans la fenêtre\n else:\n x= cp.x() - cS.width() / 2\n # Mode zoom\n if not self.zoom:\n qp.drawRect(x - 2, (self.height() / 2 - cS.height() / 2) - 2, cS.width() + 4, cS.height() + 4)\n qp.setPen(QPen(self.colors[2][0][1], 1, Qt.SolidLine))\n qp.drawText(x, self.height() / 2 + cS.height() / 2, str(cp.x()))\n\n def openContextMenu(self, point):\n self.Menu(self).exec_(self.mapToGlobal(point))\n\n def changeMode(self, zoom):\n self.zoom, self.pix= zoom, None\n self.mark.clear()\n self.repaint()\n\n def changeRulerSize(self, size):\n self.sXY= size\n self.setFixedSize(self.sX * (size + 1), self.sY * (size + 1))\n\n def changeUnitMeasure(self, unit):\n self.cUM= unit\n self.repaint()\n\n def changeRulerColor(self, color):\n if color == len(self.colors) - 1:\n self.colors= deepcopy(self.defaultColors)\n else:\n co= QColorDialog.getColor(self.colors[color][0][1], self)\n if co.isValid():\n self.colors[color][0][1]= co\n self.repaint()\n\n def changeOrientation(self, orientation):\n self.mark.clear()\n self.setFixedSize(self.sX * (self.sXY + 1) if not orientation else self.sY, self.sY if not orientation else self.sX * (self.sXY + 1))\n self.oH, geometry= orientation, self.frameGeometry()\n if geometry.top() < 0:\n geometry.moveTop(0)\n self.move(geometry.topLeft())\n if geometry.left() < 0:\n geometry.moveLeft(0)\n self.move(geometry.topLeft())\n self.repaint()\n\n def pollCursor(self):\n if QCursor.pos() != self.cursor:\n self.cursor= QCursor.pos()\n self.cursorMove.emit(QCursor.pos())\n\n def handleCursorMove(self, pos):\n if (not self.oH and pos.x() >= self.geometry().left() and pos.x() <= self.geometry().right()) or (self.oH and pos.y() >= self.geometry().top() and pos.y() <= self.geometry().bottom()):\n self.repaint()\n else:\n self.cursor= None\n\n def saveBackground(self):\n if self.zoom:\n self.hide()\n self.pix= self.ps.grabWindow(app.desktop().winId(), self.x(), self.y(), self.width(), self.height())\n self.show()\n\nif __name__ == \"__main__\":\n app= QApplication([])\n ui= Ruler()\n ui.show()\n exit(app.exec_())\n" }, { "alpha_fraction": 0.5340909361839294, "alphanum_fraction": 0.6704545617103577, "avg_line_length": 13.666666984558105, "blob_id": "a0546896c73d78c612e41cdd085e31f32af940fc", "content_id": "1dfd730274187137174d1bc2d0da9b59044a785d", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 88, "license_type": "no_license", "max_line_length": 25, "num_lines": 6, "path": "/curso-hack/net_scanner_0.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import scapy.all as scapy\n\ndef scan(ip):\n scapy.arping(ip)\n\nscan('192.168.254.2/24')\n" }, { "alpha_fraction": 0.5316308736801147, "alphanum_fraction": 0.5403366088867188, "avg_line_length": 25.507692337036133, "blob_id": "ef651b320319ae1796350323b512628639ff77ae", "content_id": "8b657f3ca33469695b09145a8f3d80682b6e3263", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1723, "license_type": "no_license", "max_line_length": 72, "num_lines": 65, "path": "/Hospital-Helper-2-master/app/gui/attributes_frame.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "from PyQt5.QtWidgets import QWidget, QHBoxLayout, QVBoxLayout\n\nfrom app.gui.input_widget import InputWidget\n\n\nclass AttributesFrame(QWidget):\n \"\"\"\n Frame represents attributes of a single item.\n Contains form layouts - labels and inputs\n \"\"\"\n\n def __init__(self, main_window, item):\n \"\"\"\n main_window: MainWindow instance\n item: CalculableObject instance\n \"\"\"\n\n super().__init__()\n\n self.item = item\n self.inputs = []\n self.input_changed = self._get_input_changed_func(main_window)\n\n hbox = QHBoxLayout()\n self.setLayout(hbox)\n hbox.setSpacing(0)\n\n rows = 5\n for i, arg_name in enumerate(item):\n if i % rows == 0:\n try:\n vbox.addStretch(10)\n except NameError:\n pass\n vbox = QVBoxLayout()\n vbox.setSpacing(0)\n vbox.setContentsMargins(0, 0, 0, 0)\n\n hbox.addLayout(vbox)\n\n self.inputs.append(InputWidget(self, main_window, arg_name))\n vbox.addWidget(self.inputs[-1])\n\n try:\n vbox.addStretch()\n except NameError:\n pass\n\n hbox.addStretch(100)\n\n def _get_input_changed_func(self, main_window):\n \"\"\"\n I don't want to keep reference to the MainWindow\n \"\"\"\n\n def input_changed(label, value):\n self.item.set(label, value)\n self.item.calculate()\n\n for each in self.inputs:\n if label != each.label_text:\n each.set_value(self.item[each.label_text])\n main_window.input_changed(self.item)\n\n return input_changed\n" }, { "alpha_fraction": 0.5215805768966675, "alphanum_fraction": 0.5316109657287598, "avg_line_length": 20.363636016845703, "blob_id": "0baac32c307814c3646cd15bc80cd4b363f97ac3", "content_id": "4e429f390cf94e7a4448e953a66e447095c29d35", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3290, "license_type": "no_license", "max_line_length": 60, "num_lines": 154, "path": "/cerrado/decorators-003.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "def static(func):\n annotations = func.__annotations__\n code = func.__code__\n argname = code.co_varnames[0]\n argtype = annotations[argname]\n restype = annotations['return']\n\n def decorated(x):\n if isinstance(x, argtype):\n res = func(x)\n if isinstance(res, restype):\n return res\n raise TypeError\n return decorated\n\n\n@static\ndef double(x: float) -> float:\n result: float = x + x\n return result\n\n\ndef get_my_foo_class():\n def __init__(self, x):\n self.data = x\n\n name = 'Foo'\n bases = ()\n namespace = {'__init__': __init__,\n 'double': lambda self: self.data * 2}\n\n return my_class\n\n\nx = get_my_foo(42)\ny = get_my_foo(21)\n\n\nclass MySmartInt(int):\n ...\n\n\nMySmartInt = type('MySmartInt', (int,),\n {'get_answer': lambda self: 42})\n\nx = MySmartInt()\n\nx.get_answer()\n\n\ndef numbers(a, _, b):\n return range(a, b + 1)\n\n\nfor x in numbers(1, ..., 10):\n print(x)\n\n\ndef clean_ns(dic):\n return {k: v for k, v in dic.items()\n if not k.startswith('_')}\n\n\n@clean_ns\nclass NotAClass(metaclass=lambda name, bases, ns: ns):\n x = 1\n y = 1\n fibs = [1]\n for _ in range(10):\n x, y = y, x + y\n fibs.append(y)\n\n\nfrom collections import defaultdict, Mapping, MutableMapping\nfrom random import random\n\n\nclass MyDict(MutableMapping):\n def __init__(self, data={}, fset=lambda attr, v: None):\n self._data = {}\n self._data.update(data)\n self._fset = fset\n\n def __getitem__(self, key):\n return self._data[key]\n\n def __iter__(self):\n return iter(self._data)\n\n def __len__(self):\n return len(self._data)\n\n def __delitem__(self, key):\n del self._data[key]\n\n def __setitem__(self, key, value):\n self._fset(key, value)\n self._data[key] = value\n\n def __repr__(self):\n return f'MyDict({self._data})'\n\n\nd = MyDict({'x': 1, 'y': 2}, fset=print)\nd['answer'] = 42\nd\n\n\nclass Meta(type):\n def __new__(cls, name, base, namespace):\n cleaned = {k: v for k, v in namespace.items()\n if not k.startswith('_')}\n print(namespace.get('__annotations__'))\n return cleaned\n\n def __init__(self, name, bases, ns):\n print(f'{name} foi criada')\n\n def __prepare__(name, bases):\n def on_annotation(name, tt):\n if name in ns:\n value = ns[name]\n if not isinstance(value, tt):\n raise TypeError(value, tt)\n print(f'{name}:: {tt.__name__}')\n\n def on_setattr(name, value):\n if name not in annotations:\n annotations[name] = type(value)\n tt = annotations.get(name, object)\n if not isinstance(value, tt):\n raise TypeError(name, value)\n if not name.startswith('_'):\n print(f'{name} = {value!r}')\n\n annotations = MyDict(fset=on_annotation)\n ns = MyDict({'__annotations__': annotations},\n fset=on_setattr)\n return ns\n\n\nfrom numbers import Number\n\n\nclass FiboDebbugger(metaclass=Meta):\n answer: Number = 42.0\n not_answer: Number = 17\n\n x, y = 1, 1\n for _ in range(1, 11):\n x, y = y, x + y + 0.1\n\n\nFiboDebbugger\n" }, { "alpha_fraction": 0.5809053182601929, "alphanum_fraction": 0.5840270519256592, "avg_line_length": 27.47407341003418, "blob_id": "96db95b72f9cbadd3b6fd44b6391cd2ae0000a74", "content_id": "478f37f9c58e7508061b347c51ad05b50e444e65", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3844, "license_type": "no_license", "max_line_length": 86, "num_lines": 135, "path": "/Hospital-Helper-2-master/app/gui/text_edit_with_format_controls.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import os\nimport functools\n\nfrom PyQt5.Qt import QFont\nfrom PyQt5.QtCore import Qt\nfrom PyQt5.QtGui import QTextCharFormat, QIcon\nfrom PyQt5.QtWidgets import (QFrame, QHBoxLayout, QVBoxLayout, QPushButton, QTextEdit)\n\nfrom app import options\nfrom app.gui import utils\n\n\nclass TextControls(QFrame):\n\n \"\"\"\n Group of buttons for text format.\n \"\"\"\n\n def __init__(self, text_edit, excluded_controls=None):\n super().__init__()\n layout = QHBoxLayout()\n layout.setContentsMargins(0, 0, 0, 0)\n self.setLayout(layout)\n\n excluded_controls = excluded_controls or []\n\n for n in 'b', 'i', 'u', 'la', 'ca', 'ra':\n if n in excluded_controls:\n continue\n b = QPushButton()\n b.setIcon(QIcon(os.path.join(options.STATIC_DIR, 'icons', n + '.png')))\n b.clicked.connect(functools.partial(text_edit.format_selected, n))\n layout.addWidget(b)\n\n layout.addStretch()\n self.setGraphicsEffect(utils.get_shadow())\n\n\nclass TemplateTextEdit(QTextEdit):\n\n \"\"\"\n Custom widget with syntax highlighting and custom controls.\n \"\"\"\n\n def __init__(self, items, highlighter=None):\n\n super().__init__()\n self.setGraphicsEffect(utils.get_shadow())\n if highlighter:\n self.highlighter = highlighter(items, self)\n self.keywords = []\n\n def insert_attribute(self, item, name):\n self.insertPlainText('{{{i}.{n}}}'.format(i=_(item.name), n=_(name)))\n self.setFocus()\n\n def set_rules(self, item):\n if self.highlighter:\n self.highlighter.set_rules(item)\n\n def _get_bold(self):\n _format = QTextCharFormat()\n if self.textCursor().charFormat().font().bold():\n _format.setFontWeight(QFont.Normal)\n else:\n _format.setFontWeight(QFont.Bold)\n\n return _format\n\n def _get_cursive(self):\n _format = QTextCharFormat()\n if self.textCursor().charFormat().font().italic():\n _format.setFontItalic(False)\n else:\n _format.setFontItalic(True)\n\n return _format\n\n def _get_underline(self):\n _format = QTextCharFormat()\n if self.textCursor().charFormat().font().underline():\n _format.setFontUnderline(False)\n else:\n _format.setFontUnderline(True)\n\n return _format\n\n def _get_alignment(self, f):\n a = {\n 'la': Qt.AlignLeft,\n 'ca': Qt.AlignCenter,\n 'ra': Qt.AlignRight,\n }\n\n def _f():\n block = self.textCursor().blockFormat()\n block.setAlignment(a[f])\n return block\n return _f\n\n def _get_format(self, f):\n return {\n 'b': self._get_bold,\n 'i': self._get_cursive,\n 'u': self._get_underline,\n 'la': self._get_alignment(f),\n 'ca': self._get_alignment(f),\n 'ra': self._get_alignment(f),\n }[f]()\n\n def format_selected(self, f):\n _format = self._get_format(f)\n cursor = self.textCursor()\n try:\n cursor.mergeCharFormat(_format)\n except TypeError:\n cursor.mergeBlockFormat(_format)\n self.setTextCursor(cursor)\n\n\nclass TextEditWithFormatControls(QFrame):\n\n def __init__(self, items=None, highlighter=None, excluded_controls=None):\n super().__init__()\n layout = QVBoxLayout()\n layout.setContentsMargins(0, 0, 0, 0)\n self.setLayout(layout)\n\n self.template_text_edit = TemplateTextEdit(items, highlighter)\n self.text_controls = TextControls(self.template_text_edit, excluded_controls)\n layout.addWidget(self.text_controls)\n layout.addWidget(self.template_text_edit)\n\n def __getattr__(self, a):\n return getattr(self.template_text_edit, a)\n" }, { "alpha_fraction": 0.6089552044868469, "alphanum_fraction": 0.6134328246116638, "avg_line_length": 29.454545974731445, "blob_id": "0b0e39f498bc709e4a4e3c867b191f0ca199c8ca", "content_id": "420e1b9ddc89458b4e49796528e5f4da4e2902a5", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2129, "license_type": "no_license", "max_line_length": 85, "num_lines": 66, "path": "/Hospital-Helper-2-master/app/options.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import os\nimport sys\nimport json\n\nSTRUCTURE_KEY = 'structure'\nFIRST_START_KEY = 'first_start'\n\nBASE_DIR = os.path.dirname(os.path.abspath(__file__))\n# DATABASE_DIR = os.path.dirname(sys.executable)\nDATABASE_DIR = '.'\nDATABASE = os.path.join(DATABASE_DIR, 'data.sqlite3')\nDATA_DIR = os.path.join(BASE_DIR, 'data')\nLOG_FILE = os.path.join(DATABASE_DIR, 'error.log')\nprint(DATABASE)\n\n# klient left here intentionally\nCLIENT_TABLE_NAME = 'klient'\n\n\nSEARCH_QUERY = '''\n SELECT id\n FROM {table}\n WHERE lowercase({table}.surname) LIKE ? \n OR lowercase({table}.name) LIKE ? \n OR lowercase({table}.patronymic) LIKE ?\n'''.format(table=CLIENT_TABLE_NAME)\n\nCONCLUSION = '<span style=\"font-weight: bold\">Заключение: </span>'\nTEMPLATE_GLOBAL_STYLE = {\n 'font-size': '11pt',\n 'line-height': '11pt',\n}\n\nSTATIC_DIR = os.path.join(BASE_DIR, 'gui', 'static')\nREPORTS_DIR = os.path.join(DATABASE_DIR, 'reports')\n\nTYPES = {\n 'str': str,\n 'float': float,\n 'int': int,\n 'list': list,\n 'tuple': tuple\n}\n\n# FIRST_START_WELCOME_TEXT = 'Добро пожаловать в Hospital Helper 2!\\n' \\\n# 'Похоже, вы запустили программу впервые.\\n' \\\n# 'Хотите загрузить стандартные шаблоны?'\nFIRST_START_WELCOME_TEXT = 'Bem vindo ao Hospital Helper 2!\\n' \\\n 'Parece que você lançou o programa pela primeira vez.\\n' \\\n 'Deseja baixar modelos padrão?'\n\nINIT_TEMPLATES_PATH = os.path.join(DATA_DIR, 'init_templates.json')\n\nwith open(os.path.join(DATA_DIR, 'init_structure.json'), 'rb') as f:\n INIT_STRUCTURE = f.read().decode('utf8')\n\nwith open(os.path.join(DATA_DIR, 'translation.json'), 'rb') as f:\n TRANSLATION = json.loads(f.read().decode('utf8'))\n\n# Order matters\nCONTROL_BUTTONS_LABELS = [\n {'sys': 'data', 'ru': 'Данные', 'en': 'Data'},\n {'sys': 'report', 'ru': 'Отчет', 'en': 'Report'},\n {'sys': 'db', 'ru': 'База', 'en': 'DB'},\n {'sys': 'options', 'ru': 'Настройки', 'en': 'Options'},\n]\n" }, { "alpha_fraction": 0.4336344599723816, "alphanum_fraction": 0.49270325899124146, "avg_line_length": 19, "blob_id": "18ec589ec442d42708de8a0568b4c177f76b5405", "content_id": "d4783a86d22ae97c80b9101f693c73ae5235f301", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1446, "license_type": "no_license", "max_line_length": 56, "num_lines": 72, "path": "/cprofile-001.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "# -*- coding: latin1 -*-\nimport cProfile\ndef rgb1():\n \"\"\"\n Função usando range()\n \"\"\"\n rgbs = []\n for r in range(256):\n for g in range(256):\n for b in range(256):\n rgbs.append('#%02x%02x%02x' % (r, g, b))\n return rgbs\n\ndef rgb2():\n \"\"\"\n Função usando range()\n \"\"\"\n rgbs = []\n for r in range(256):\n for g in range(256):\n for b in range(256):\n rgbs.append('#%02x%02x%02x' % (r, g, b))\n return rgbs\n\ndef rgb3():\n \"\"\"\n Gerador usando range()\n \"\"\"\n for r in range(256):\n for g in range(256):\n for b in range(256):\n yield '#%02x%02x%02x' % (r, g, b)\n\ndef rgb4():\n \"\"\"\n Função usando uma lista várias vezes\n \"\"\"\n rgbs = []\n ints = range(256)\n for r in ints:\n for g in ints:\n for b in ints:\n rgbs.append('#%02x%02x%02x' % (r, g, b))\n return rgbs\n\ndef rgb5():\n \"\"\"\n Gerador usando apenas uma lista\n \"\"\"\n for i in range(256 ** 3):\n yield '#%06x' % i\n\ndef rgb6():\n \"\"\"\n Gerador usando range() uma vez\n \"\"\"\n for i in range(256 ** 3):\n yield '#%06x' % i\n\n# Benchmarks\nprint('rgb1:')\ncProfile.run('rgb1()')\nprint('rgb2:')\ncProfile.run('rgb2()')\nprint('rgb3:')\ncProfile.run('list(rgb3())')\nprint('rgb4:')\ncProfile.run('rgb4()')\nprint('rgb5:')\ncProfile.run('list(rgb5())')\nprint('rgb6:')\ncProfile.run('list(rgb6())')" }, { "alpha_fraction": 0.5664359927177429, "alphanum_fraction": 0.5733563899993896, "avg_line_length": 25.52293586730957, "blob_id": "977d791500b877d9b427df565c1ac391bda03b9a", "content_id": "dec38326bfea2233c0e6aff5c88b6e1b1f8f9116", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2891, "license_type": "no_license", "max_line_length": 102, "num_lines": 109, "path": "/full - compara relatorios/compara.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import os\nimport csv\nimport sqlite3\nfrom sqlalchemy import create_engine, Table, Column, MetaData\nfrom sqlalchemy import Integer, Float, CHAR\nfrom sqlalchemy.orm import sessionmaker, mapper\nfrom sqlalchemy.engine.url import URL\nfrom sqlalchemy.sql import select\n\ncsvC = 'b-co.csv'\ncsvF = 'b-fi-v.csv'\n\n_url = 'sqlite:///compara.db3'\n# para conexao no firebird\n# _url = URL('firebird', 'SYSDBA', 'masterkey', '192.168.1.11', '3052', 'bdband')\n# para conexao no mysql\n# _url = 'mysql://usuario:senha@servidor/banco'\n\n# cria o engine e metadata\nengine = create_engine(_url, echo=False)\nmetadata = MetaData(bind=engine)\n\n# cria as tabelas\ntb_arqC = Table('arqC', metadata,\n Column('numero', Integer(), primary_key=True, nullable=False),\n Column('valor', Float()),\n Column('achou', CHAR())\n )\n\ntb_arqF = Table('arqF', metadata,\n Column('numero', Integer(), primary_key=True, nullable=False),\n Column('item', Integer(), primary_key=True, nullable=False),\n Column('valor', Float()),\n Column('achou', CHAR())\n )\n\n# cria as classes\n\n\nclass arqC(object):\n def __init__(self, numero, valor, achou=' '):\n self.numero = numero\n self.valor = valor\n self.achou = achou\n\n\nclass arqF(object):\n def __init__(self, numero, item, valor, achou=' '):\n self.numero = numero\n self.item = item\n self.valor = valor\n self.achou = achou\n\n\n# mapeia a classe -> tabela\nmapper(arqC, tb_arqC)\nmapper(arqF, tb_arqF)\n\n# cria as tabelas no banco (caso nao existam)\nmetadata.create_all()\n\nconn = engine.connect()\n\n# s = select([arqC])\n# # result = conn.execute(s)\n\n# for row in conn.execute(s):\n# print(row['numero'],row['valor'])\n# p = select([tb_arqF.c.numero, tb_arqF.c.valor]).where(tb_arqF.c.numero == row[tb_arqC.c.numero])\n# result = conn.execute(p)\n# for prow in result:\n# print(prow, result.count())\n# if row[tb_arqC.c.valor] == prow[tb_arqF.c.valor]:\n# print('ok')\n# input()\n\n#cria o sessionmaker\nSession = sessionmaker(bind=engine)\n\ns = Session()\n\nttc = 0\nttf = 0\n\nfor c in s.query(arqC):\n print(c.numero)\n q = s.query(arqF).filter(arqF.numero == c.numero)\n qtd = 0\n tot = 0\n ttc = ttc + c.valor\n for f in q:\n qtd = qtd + 1\n tot = tot + f.valor\n print(c.numero, c.valor, f.numero, f.valor, q.count())\n if q.count() == qtd:\n if c.valor != tot:\n print('não ok')\n # input()\n else:\n c.achou = 'S'\n ttf = ttf + tot\n # s.commit()\n # input()\n\ns.commit() \nprint(ttc, ttf) \n\n# for row in s.query(arqC, arqF).filter(tb_arqC.c.numero == tb_arqF.c.numero):\n# print(row.arqC.numero, row.arqC.valor, row.arqF.valor)" }, { "alpha_fraction": 0.8480392098426819, "alphanum_fraction": 0.8480392098426819, "avg_line_length": 32.83333206176758, "blob_id": "7624d28c162cd84331e456c7b5a709dc40182e57", "content_id": "87896fb4b052a8ad38d933df03311acf90ebd104", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 204, "license_type": "no_license", "max_line_length": 41, "num_lines": 6, "path": "/djangosige/venv/Lib/site-packages/geraldo/generators/__init__.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "from .base import ReportGenerator\nfrom .html import HTMLGenerator\nfrom .xmlstruct import XMLStructGenerator\nfrom .pdf import PDFGenerator\nfrom .text import TextGenerator\nfrom .csvgen import CSVGenerator\n\n" }, { "alpha_fraction": 0.7203390002250671, "alphanum_fraction": 0.7203390002250671, "avg_line_length": 26.230770111083984, "blob_id": "b86fd292c27a95afc86d120ae9624cb8cfbadf3d", "content_id": "54a1b9f159aada3d520029adbb632c2d8b5045ae", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 354, "license_type": "no_license", "max_line_length": 96, "num_lines": 13, "path": "/curso-hack/mac_changer.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import optparse\n\nparser = optparse.OptionParser()\n\nparser.add_option('-i', '--interface', dest='interface', help='Interface to change MAC address')\nparser.add_option('-m', '--mac', dest='new_mac', help='New MAC address')\n\n(options, arguments) = parser.parse_args()\n\ninterface = options.interface\nnew_mac = options.new_mac\nprint(interface)\nprint(new_mac)\n" }, { "alpha_fraction": 0.5569871068000793, "alphanum_fraction": 0.6253716349601746, "avg_line_length": 36.38888931274414, "blob_id": "d1e2dd0ba9ce85e355b3326a609936cb42be1d1c", "content_id": "1b17674621572b4589f7a18d43995ec5f4a24054", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2018, "license_type": "no_license", "max_line_length": 96, "num_lines": 54, "path": "/assinaturas/assinapil.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import le_excel\nfrom PIL import Image, ImageDraw, ImageFont\n\ndados = le_excel.le_excel()\n\n# nome = 'Robério Barreto Filho'\n# cargo = 'Coordenador Executivo'\n# fone = '61 3462-5048'\n# cel = '61 9 9649-9352'\n# email = 'roberiofilho@1linha.com.br'\n\nsite = 'www.1linha.com.br'\nempr = 'Primeira Linha Comercial de Rolamentos'\n\nicon_peq = 40\npos_ipeq = 180\n\nfont1 = ImageFont.truetype(\"./fontes/verdanab.ttf\", 28)\nfont2 = ImageFont.truetype(\"verdana.ttf\", 23)\n\nifone = Image.open('./imagens/b_fone-1.jpg').convert(\"RGBA\").resize((icon_peq,icon_peq))\niwhatsapp = Image.open('./imagens/b_whatsapp-1.jpg').convert(\"RGBA\").resize((icon_peq,icon_peq))\niemail = Image.open('./imagens/b_email-1.jpg').convert(\"RGBA\").resize((icon_peq,icon_peq))\niweb = Image.open('./imagens/b_web-1.jpg').convert(\"RGBA\").resize((icon_peq,icon_peq))\n\nfor dado in dados:\n nome = dado['NOME']\n cargo = dado['CARGO ']\n fone = dado['RM']\n cel = dado['CELULAR ']\n email =dado['E-MAIL ']\n\n print(nome)\n\n n = \"-\".join(nome.split(' '))\n print(n)\n\n base = Image.open('./imagens/base-canva-1.png').convert(\"RGBA\")\n\n base.paste(ifone, (300, pos_ipeq), ifone.convert(\"RGBA\"))\n base.paste(iwhatsapp, (300, pos_ipeq + (1 * icon_peq) + 2), iwhatsapp.convert(\"RGBA\"))\n base.paste(iemail, (300, pos_ipeq + (2 * icon_peq) + 2), iemail.convert(\"RGBA\"))\n base.paste(iweb, (300, pos_ipeq + (3 * icon_peq) + 2), iweb.convert(\"RGBA\"))\n\n draw = ImageDraw.Draw(base)\n draw.text((300, 100), text=nome, fill=\"#000\", font=font1)\n draw.text((300, 130), text=cargo, fill=\"#898989\", font=font2)\n draw.text((350, pos_ipeq + 4), text=fone, fill=\"#898989\", font=font2)\n draw.text((350, pos_ipeq + (1 * icon_peq) + 4), text=cel, fill=\"#898989\", font=font2)\n draw.text((350, pos_ipeq + (2 * icon_peq) + 4), text=email, fill=\"#898989\", font=font2)\n draw.text((350, pos_ipeq + (3 * icon_peq) + 4), text=site, fill=\"#898989\", font=font2)\n draw.text((350, pos_ipeq + (4 * icon_peq) + 4), text=empr, fill=\"#898989\", font=font2)\n\n base.save('./' + n + '.png')" }, { "alpha_fraction": 0.6464723944664001, "alphanum_fraction": 0.7415643930435181, "avg_line_length": 39.75, "blob_id": "08d2ae1a9c32ae99020749e61c4a3046cf1960b7", "content_id": "ac9d55fd7ab314ce1774c5d421d8e1dbeb75676b", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 1304, "license_type": "permissive", "max_line_length": 153, "num_lines": 32, "path": "/Wanderson-Magalhaes/Simple_PySide_Base-master/README.md", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "# Python Interface - PySide2/PyQt5(optional) (MODERN / FLAT GUI)\n\n> ## :warning: **Warning**: PySide2 and PyQt5 in versions 5.15.0 and 5.15.1 are causing problems due to several updates in process.\n> For this project use the stable version \"5.14.2.2\" (**pip install pyside2==5.14.2.2**)!\n>\n> Note: https://wiki.qt.io/Qt_for_Python_Development_Notes.\n> In October they will release version 6 of Qt, we will wait for them to solve these problems or bring some solution for the same.\n> ```sh\n> pip install pyside2==5.14.2.2\n> ```\n\n\n![image_1](https://user-images.githubusercontent.com/60605512/82736094-50887300-9cfd-11ea-8e9a-c2fbbf97d983.PNG)\n\nProject created using Python, Qt Designer and PySide2.\nI hope it helps everyone who is starting now in the Python world.\nThis project works very well with Windows, however on Linux and macOS there are some font size problems and the custom title bar does not work very well.\n\n# REQUERIMENTS:\n> ```sh\n> pip install pyside2==5.14.2.2\n> ```\n> PySide2 and PyQt5 in versions 5.15.0 and 5.15.1 **are causing problems** due to several updates in process.\n\n# RUN FILE:\nmain.py\n\n# ADD MENUS\n![add-MENUS](https://user-images.githubusercontent.com/60605512/94625100-56372c00-028e-11eb-978e-22165d8f77c8.png)\n\n# Youtube Video:\n> https://www.youtube.com/watch?v=iaIooM9FlRI\n" }, { "alpha_fraction": 0.7496350407600403, "alphanum_fraction": 0.7503649592399597, "avg_line_length": 36, "blob_id": "d1b728947c60700df60966f9284b86ac4046dc56", "content_id": "b99b09c870145ae3ac59e588d8533c12e21446eb", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1370, "license_type": "no_license", "max_line_length": 73, "num_lines": 37, "path": "/PQt5-Stock/Conexion/initConexion.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom Conexion.conexion import Conexion\nfrom Conexion.conexionProducto import conexionProducto\nfrom Conexion.conexionProveedor import conexionProveedor\nfrom Conexion.conexionCliente import conexionCliente\nfrom Conexion.conexionUsuario import conexionUsuario\nfrom Conexion.conexionMarca import conexionMarca\nfrom Conexion.conexionRubro import conexionRubro\nclass ControllerConnection(object):\n\n def __init__(self):\n self.connection = Conexion()\n self.connectionCliente = conexionCliente(self.connection)\n\n def getConnectionRubro(self):\n self.__connectionRubro = conexionRubro(self.connection)\n return self.__connenctionRubro\n\n def getConnectionMarca(self):\n self.__connectioMarca = conexionMarca(self.__connection)\n return self.__connectioMarca\n\n def getConnectionUsuario(self):\n self.__connectionUsuario = conexionUsuario(self.__connection)\n return self.__connectionUsuario\n\n def getConnectionCliente(self):\n return self.connectionCliente\n\n def getConnectionProveedor(self):\n self.__connectionProveedor = conexionProveedor(self.__connection)\n return self.__connectionProveedor\n\n def getConnectionProducto(self):\n self.__connectionProducto = conexionProducto(self.__connection)\n return self.__connectionProducto\n\n" }, { "alpha_fraction": 0.6414342522621155, "alphanum_fraction": 0.6892430186271667, "avg_line_length": 17, "blob_id": "9396199a17d3510d47cf1248f3e65e9c35fa259f", "content_id": "824306f1609e3aa7c9254f84fe70785c5f16772c", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 251, "license_type": "no_license", "max_line_length": 37, "num_lines": 14, "path": "/mathplot/matplot-002.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import numpy\nimport pylab\n\nt = numpy.arange(0.0, 1.0+0.01, 0.01)\ns = numpy.cos(numpy.pi*4*t)\npylab.plot(t, s)\n \npylab.xlabel('time (s)')\npylab.ylabel('cos(4t)')\npylab.title('Simple cosine')\npylab.grid(True)\npylab.savefig('simple_cosine')\n\npylab.show()" }, { "alpha_fraction": 0.6080586314201355, "alphanum_fraction": 0.6575091481208801, "avg_line_length": 20.038461685180664, "blob_id": "dab92e97549706d24b573f6c64681b6837b30038", "content_id": "b79fec2396941d8f1229168504bb7f77cdac4763", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 546, "license_type": "no_license", "max_line_length": 41, "num_lines": 26, "path": "/excel-001.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "from openpyxl import Workbook\nwb = Workbook()\nws = wb.active\nws1 = wb.create_sheet(\"Mysheet\")\nws.title = \"New Title\"\nws.sheet_properties.tabColor = \"1072BA\"\nws3 = wb[\"New Title\"]\nprint(wb.sheetnames)\nfor sheet in wb:\n print(sheet.title)\n\nsource = wb.active\ntarget = wb.copy_worksheet(source)\n\nc = ws['A4']\nws['A4'] = 4\nd = ws.cell(row=4, column=2, value=10)\ne = ws.cell(row=5, column=2, value=10)\n\nfor i in range(1,101):\n for j in range(1,101):\n ws.cell(row=i, column=j, value=j)\n\ncell_range = ws['A1':'C2']\n\nwb.save('balances.xlsx')" }, { "alpha_fraction": 0.551068902015686, "alphanum_fraction": 0.5866983532905579, "avg_line_length": 29.80487823486328, "blob_id": "d28e51667139524735e519cd18c47dedba6a148f", "content_id": "9f3556b748a7eb0f2b2c086eefce9317e7f151d5", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1263, "license_type": "no_license", "max_line_length": 114, "num_lines": 41, "path": "/compras/test-api.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n\nimport urllib.request\nimport urllib.error\nimport json\n\nheaders = {\n 'X-Cosmos-Token': 'MxLbve3fi-0SyS53f5UzAQ',\n 'Content-Type': 'application/json'\n}\n\n# req = urllib.request.Request('https://api.cosmos.bluesoft.com.br/gtins/7891000053508.json', None, headers)\n# req = urllib.request.Request('https://api.cosmos.bluesoft.com.br/gtins/7898994063889.json', None, headers)\n# response = urllib.request.urlopen(req)\n# data = json.loads(response.read())\n\nwhile True:\n try:\n req = urllib.request.Request('https://api.cosmos.bluesoft.com.br/gtins/7898994063889.json', None, headers)\n except urllib.error.HTTPError as e:\n print('1 ' + e.reason)\n break\n except urllib.error.URLError as e:\n print('2 ' + e.reason)\n break\n else:\n while True:\n try:\n response = urllib.request.urlopen(req)\n except urllib.error.HTTPError as e:\n print('3 ' + e.reason)\n break\n except urllib.error.URLError as e:\n print('4 ' + e.reason)\n break\n else:\n data = json.loads(response.read())\n break\n break\n\nprint(json.dumps(data, indent=4, ensure_ascii=False))\n" }, { "alpha_fraction": 0.8244274854660034, "alphanum_fraction": 0.8396946787834167, "avg_line_length": 12.100000381469727, "blob_id": "60b679dc38476b511d38b1607c0367e3acb143e2", "content_id": "3f9d2eee910b8ac04a3f682752c568c0d544e25e", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Text", "length_bytes": 131, "license_type": "no_license", "max_line_length": 36, "num_lines": 10, "path": "/Hospital-Helper-2-master/requirements.txt", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "codecov\nnose\ncoverage\nunidecode\nunicode-slugify\nsqlalchemy\ngit+https://github.com/aq1/odfpy.git\n# odfpy\npyinstaller\nbeautifulsoup4\n" }, { "alpha_fraction": 0.46595460176467896, "alphanum_fraction": 0.4753004014492035, "avg_line_length": 22.40625, "blob_id": "d7a4bd49290817242096ac882119bfce64ad38f7", "content_id": "eebb8213af59f96d7f456f6222b59d41549da680", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 750, "license_type": "no_license", "max_line_length": 68, "num_lines": 32, "path": "/leArq-001.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import sys\nimport csv\n\n\ndef processa(f):\n \"\"\"\n Le arquivo e transforma em excel\n \"\"\"\n arqOk = False\n for line in f:\n if arqOk:\n print(line, end='')\n else:\n if \"[toExcel]\" in line:\n arqOk = True\n\n\nif __name__ == \"__main__\":\n if(len(sys.argv) < 2):\n print(\"Use: leArq-001 arquivo\")\n sys.exit(0)\n try:\n # with open(sys.argv[1], 'r') as f:\n with open(sys.argv[1], 'r') as f:\n spamreader = csv.reader(f, delimiter=';', quotechar='|')\n for row in spamreader:\n for ele in row:\n print(ele.strip())\n # processa(f)\n except IOError:\n print(u'Arquivo não encontrado!')\n sys.exit()\n" }, { "alpha_fraction": 0.6354166865348816, "alphanum_fraction": 0.6583333611488342, "avg_line_length": 27.235294342041016, "blob_id": "028f7c0a049b0a49f2c4c39fbc5293fd7df478c7", "content_id": "030458b72be310411933bef3c5d4e592657b8cdb", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1920, "license_type": "no_license", "max_line_length": 104, "num_lines": 68, "path": "/telegram/send-telegram.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/python3\n\nimport argparse\nfrom telethon.sync import TelegramClient\nfrom telethon.tl.types import InputPeerUser, InputPeerChannel\nfrom telethon import TelegramClient, sync, events\n\n\ndef get_arguments():\n parser = argparse.ArgumentParser(description = 'Envia mensagens pelo Telegram')\n parser.add_argument('-p', '--phones', dest='phones', help='Telefones destino', required=True)\n parser.add_argument('-m', '--message', dest='message', help='Mensagem a ser enviada', required=True)\n options = parser.parse_args()\n return options\n\n\ndef connect():\n # compras\n api_id = 4888068\n api_hash = '16af559125cab1310194e8015672dce1'\n token = '1612101465:AAGrCmHM86jDJRH-biquYs0ymmb_MoXS8j4'\n \n # your phone number\n phone = '+55 61 99983 6707'\n \n # creating a telegram session and assigning\n # it to a variable client\n client = TelegramClient('primeiralinhacompras_bot', api_id, api_hash)\n \n # connecting and building the session\n client.connect()\n \n # in case of script ran first time it will\n # ask either to input token or otp sent to\n # number or sent or your telegram id \n if not client.is_user_authorized():\n \n client.send_code_request(phone)\n \n # signing in the client\n client.sign_in(phone)\n try:\n client.sign_in(code=input('Enter code: '))\n except: \n client.sign_in(password='070707')\n \n return client\n\ndef send_message(client, target, message):\n try:\n id_destino = client.get_input_entity(target)\n \n client.send_message(id_destino, message=message, parse_mode='html')\n # client.send_file(id_destino, 's:\\logo.png')\n return 'ok'\n except Exception as e:\n return e\n \n\noptions = get_arguments()\n\nclient = connect()\n\nfor phone in options.phones.split(', '):\n send_message(client, phone, options.message)\n\n# disconnecting the telegram session \nclient.disconnect()\n" }, { "alpha_fraction": 0.6540669798851013, "alphanum_fraction": 0.6581339836120605, "avg_line_length": 28.63829803466797, "blob_id": "3e64923056abe6bc9db538dbc915568e8318781e", "content_id": "f48bb4b01ad601dea31e21132d7c7584c26a18df", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 4180, "license_type": "no_license", "max_line_length": 96, "num_lines": 141, "path": "/djangosige/venv/Lib/site-packages/geraldo/cache.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "\"\"\"Caching functions file. You can use this stuff to store generated reports in a file\nsystem cache, and save time and performance.\"\"\"\n\nimport os\n\nfrom .utils import memoize, get_attr_value\n\ntry:\n set\nexcept:\n from sets import Set as set\n\nCACHE_DISABLED = 0\nCACHE_BY_QUERYSET = 1\nCACHE_BY_RENDER = 2\nDEFAULT_CACHE_STATUS = CACHE_DISABLED\n\nCACHE_BACKEND = 'geraldo.cache.FileCacheBackend'\nCACHE_FILE_ROOT = '/tmp/'\n\nclass BaseCacheBackend(object):\n \"\"\"This is the base class (and abstract too) to be inherited by any cache backend\n to store and restore reports from a cache.\"\"\"\n\n def get(self, hash_key):\n pass\n\n def set(self, hash_key, content):\n pass\n\n def exists(self, hash_key):\n pass\n\nclass FileCacheBackend(BaseCacheBackend):\n \"\"\"This cache backend is able to store and restore using a path on the file system.\"\"\"\n\n cache_file_root = '/tmp/'\n\n def __init__(self, cache_file_root=None):\n self.cache_file_root = cache_file_root or self.cache_file_root\n\n # Creates the directory if doesn't exists\n if not os.path.exists(self.cache_file_root):\n os.makedirs(self.cache_file_root)\n\n def get(self, hash_key):\n # Returns None if doesn't exists\n if not self.exists(hash_key):\n return None\n\n # Returns the file content\n fp = file(os.path.join(self.cache_file_root, hash_key), 'rb')\n content = fp.read()\n fp.close()\n\n return content\n\n def set(self, hash_key, content):\n # Writes the content in the file\n fp = file(os.path.join(self.cache_file_root, hash_key), 'wb')\n fp.write(content)\n fp.close()\n\n def exists(self, hash_key):\n return os.path.exists(os.path.join(self.cache_file_root, hash_key))\n\n@memoize\ndef get_report_cache_attributes(report):\n from .widgets import ObjectValue\n\n # Find widgets attributes\n widgets = [widget.attribute_name for widget in report.find_by_type(ObjectValue)]\n\n # Find grouppers attributes\n groups = [group.attribute_name for group in report.groups]\n\n return list(set(widgets + groups))\n\ntry:\n # Python 2.5 or higher\n from hashlib import sha512 as hash_constructor\nexcept ImportError:\n # Python 2.4\n import sha\n hash_constructor = sha.new\n\ndef make_hash_key(report, objects_list):\n \"\"\"This function make a hash key from a list of objects.\n \n Situation 1\n -----------\n\n If the objects have an method 'repr_for_cache_hash_key', it is called to get their\n string repr value. This is the default way to get repr strings from rendered pages\n and objects.\n \n Situation 2\n -----------\n\n Otherwise, if exists, the method 'get_cache_relevant_attributes' from report will be\n called to request what attributes have to be used from the object list to make the\n string.\n \n If the method above does't exists, then all attributes explicitly found in report\n elements will be used.\n \n The result list will be transformed to a long concatenated string and a hash key\n will be generated from it.\"\"\"\n\n global get_report_cache_attributes\n\n result = []\n\n # Get attributes for cache from report\n if hasattr(report, 'get_cache_relevant_attributes'):\n report_attrs = report.get_cache_relevant_attributes\n else:\n report_attrs = lambda: get_report_cache_attributes(report)\n\n for obj in objects_list:\n # Situation 1 - mostly report pages and geraldo objects\n if hasattr(obj, 'repr_for_cache_hash_key'):\n result.append(obj.repr_for_cache_hash_key())\n\n # Situation 2 - mostly queryset objects list\n else:\n result.append('/'.join([str(get_attr_value(obj, attr)) for attr in report_attrs()]))\n\n # Makes the hash key\n m = hash_constructor()\n m.update('\\n'.join(result))\n\n return '%s-%s'%(report.cache_prefix, m.hexdigest())\n\ndef get_cache_backend(class_path, **kwargs):\n \"\"\"This method initializes the cache backend from string path informed.\"\"\"\n parts = class_path.split('.')\n module = __import__('.'.join(parts[:-1]), fromlist=[parts[-1]])\n cls = getattr(module, parts[-1])\n\n return cls(**kwargs)\n\n" }, { "alpha_fraction": 0.4375, "alphanum_fraction": 0.5, "avg_line_length": 7, "blob_id": "ed227406dce3af7cd695638781393f78595a91cd", "content_id": "dffa2ccf7769bffc8b1358ef0653fca18bbd5b1f", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 16, "license_type": "no_license", "max_line_length": 8, "num_lines": 2, "path": "/curso-hack/second.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "print(x)\nx += 1\n" }, { "alpha_fraction": 0.7142857313156128, "alphanum_fraction": 0.7196765542030334, "avg_line_length": 18.526315689086914, "blob_id": "26c305180a1c5b1f091fb180e80ff455e6045b18", "content_id": "faaa9a44cbc453b5c82194f473680f99e4db6868", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 371, "license_type": "no_license", "max_line_length": 52, "num_lines": 19, "path": "/full - compara relatorios/c-pd.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import os\nimport pandas as pd\nfrom leComissao import procComissao\nfrom leFinanc import procFinanc\n\narqC = 'b-co.ori'\narqF = 'b-fi-v.ori'\n\narqC = (os.path.splitext(os.path.basename(arqC))[0])\narqF = (os.path.splitext(os.path.basename(arqF))[0])\n\ndfC = procComissao(arqC)\ndfF = procFinanc(arqF)\n\nprint(dfC.head())\n# print(dfC.dtypes)\n\nprint(dfF.head())\n# print(dfF.dtypes)\n" }, { "alpha_fraction": 0.5701149702072144, "alphanum_fraction": 0.6413792967796326, "avg_line_length": 20.75, "blob_id": "33839d18450276a4edf9edf8e4ef1b171ce5dc22", "content_id": "7d1a19a11af9c15b09d2c12b60b1ed1d67f20d2a", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 435, "license_type": "no_license", "max_line_length": 44, "num_lines": 20, "path": "/pyqt5-curso/label.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import sys\nfrom PyQt5 import QtWidgets, QtGui\n\n\ndef window():\n app = QtWidgets.QApplication(sys.argv)\n w = QtWidgets.QWidget()\n l1 = QtWidgets.QLabel(w)\n l2 = QtWidgets.QLabel(w)\n l1.setText('Hello World')\n l2.setPixmap(QtGui.QPixmap('globe.png'))\n w.setWindowTitle('PyQt5 Lesson 2')\n w.setGeometry(100, 100, 300, 200)\n l1.move(100, 20)\n l2.move(120, 90)\n w.show()\n sys.exit(app.exec_())\n\n\nwindow()\n" }, { "alpha_fraction": 0.6862826347351074, "alphanum_fraction": 0.7070037126541138, "avg_line_length": 38.557376861572266, "blob_id": "96300ed193327bf1ec022cc8236a6bd241c20db9", "content_id": "6074bb518f4edabe195d0aad2e91701a9f981333", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2413, "license_type": "no_license", "max_line_length": 173, "num_lines": 61, "path": "/qt/tela-001.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n\n# Form implementation generated from reading ui file 'tela-001.ui'\n#\n# Created by: PyQt5 UI code generator 5.12.3\n#\n# WARNING! All changes made in this file will be lost!\n\n\nfrom PyQt5 import QtCore, QtGui, QtWidgets\nfrom PyQt5.QtCore import (QCoreApplication, QPropertyAnimation, QDate, QDateTime, QMetaObject, QObject, QPoint, QRect, QSize, QTime, QUrl, Qt, QEvent)\nfrom PyQt5.QtGui import (QBrush, QColor, QConicalGradient, QCursor, QFont, QFontDatabase, QIcon, QKeySequence, QLinearGradient, QPalette, QPainter, QPixmap, QRadialGradient)\n\nclass Ui_MainWindow(object):\n def setupUi(self, MainWindow):\n MainWindow.setObjectName(\"MainWindow\")\n MainWindow.resize(800, 600)\n MainWindow.setStyleSheet(\"font: 14pt \\\"Roboto\\\";\")\n\n MainWindow.setWindowFlag(QtCore.Qt.FramelessWindowHint)\n\n self.centralwidget = QtWidgets.QWidget(MainWindow)\n self.centralwidget.setObjectName(\"centralwidget\")\n\n self.gridLayout = QtWidgets.QGridLayout(self.centralwidget)\n self.gridLayout.setContentsMargins(0, 0, 0, 0)\n self.gridLayout.setObjectName(\"gridLayout\")\n\n self.base = QtWidgets.QFrame(self.centralwidget)\n self.base.setStyleSheet(\"background-color: #282A36;\")\n self.base.setFrameShape(QtWidgets.QFrame.StyledPanel)\n self.base.setFrameShadow(QtWidgets.QFrame.Raised)\n self.base.setObjectName(\"base\")\n\n self.menu = QtWidgets.QFrame(self.base)\n # self.menu.setGeometry(QtCore.QRect(0, 0, 340, 600))\n self.menu.setStyleSheet(\"background-color: #21222C;\")\n self.menu.setFrameShape(QtWidgets.QFrame.StyledPanel)\n self.menu.setFrameShadow(QtWidgets.QFrame.Raised)\n self.menu.setObjectName(\"menu\")\n\n self.gridLayout.addWidget(self.base, 0, 0, 1, 1)\n self.gridLayout.addWidget(self.menu, 0, 0, 1, 1)\n MainWindow.setCentralWidget(self.centralwidget)\n\n self.retranslateUi(MainWindow)\n QtCore.QMetaObject.connectSlotsByName(MainWindow)\n\n def retranslateUi(self, MainWindow):\n _translate = QtCore.QCoreApplication.translate\n MainWindow.setWindowTitle(_translate(\"MainWindow\", \"MainWindow\"))\n\n\nif __name__ == \"__main__\":\n import sys\n app = QtWidgets.QApplication(sys.argv)\n MainWindow = QtWidgets.QMainWindow()\n ui = Ui_MainWindow()\n ui.setupUi(MainWindow)\n MainWindow.show()\n sys.exit(app.exec_())\n" }, { "alpha_fraction": 0.5277040600776672, "alphanum_fraction": 0.5484406352043152, "avg_line_length": 52.345130920410156, "blob_id": "e5287e7347aa6bf95aafe064d7436453f41e9433", "content_id": "c6e96e5cd7f55ea4121b6beabcc368f8dd96c371", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 6300, "license_type": "no_license", "max_line_length": 105, "num_lines": 113, "path": "/PyQT-CRUD-App/app/excel.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/python3\n# -*- coding: utf-8 -*-\n\"\"\"\nExcel generation\n\"\"\"\nimport xlsxwriter\nfrom app.db import data\n\n\ndef run(filename, session):\n workbook = xlsxwriter.Workbook(filename)\n for block in session.query(data.Block):\n worksheet = workbook.add_worksheet(block.address.name + '-' + block.name)\n worksheet.autofilter('A1:AC1')\n worksheet.set_column('B1:AC1', 20)\n worksheet.set_column('G1:G1', 30)\n worksheet.set_default_row(30)\n worksheet.set_tab_color('green')\n bold = workbook.add_format({'bold': True})\n cell_format = workbook.add_format({'text_wrap': True})\n worksheet.write('A1', '№ da sala', bold)\n worksheet.write('B1', 'Nome completo do funcionário', bold)\n worksheet.write('C1', 'Login exclusivo', bold)\n worksheet.write('D1', 'Telefones', bold)\n worksheet.write('E1', 'Posição', bold)\n worksheet.write('F1', 'Отдел', bold)\n worksheet.write('G1', 'E-Mail', bold)\n worksheet.write('H1', 'Общие папки', bold)\n worksheet.write('I1', 'Сетевой принтер', bold)\n worksheet.write('J1', 'Доп информация о сотруднке', bold)\n worksheet.write('K1', 'Домен', bold)\n worksheet.write('L1', 'Имя компьютера', bold)\n worksheet.write('M1', 'MAC-адрес', bold)\n worksheet.write('N1', 'Серверные приложения', bold)\n worksheet.write('O1', '№ розетки', bold)\n worksheet.write('P1', 'Windows OS', bold)\n worksheet.write('Q1', 'Ключ Windows OS', bold)\n worksheet.write('R1', 'MS Office', bold)\n worksheet.write('S1', 'Ключ MS Office', bold)\n worksheet.write('T1', 'Клиент электронной почты', bold)\n worksheet.write('U1', 'Как подключен', bold)\n worksheet.write('V1', 'Агент KES', bold)\n worksheet.write('W1', 'Антивирус', bold)\n worksheet.write('X1', 'Консультант', bold)\n worksheet.write('Y1', 'Гарант', bold)\n worksheet.write('Z1', '1С', bold)\n worksheet.write('AA1', 'КДС', bold)\n worksheet.write('AB1', 'Доп информация о компьютере', bold)\n row = 1\n for employee in session.query(data.Employee). \\\n join(data.Room). \\\n join(data.Block). \\\n filter(data.Block.name == block.name):\n worksheet.set_row(row, 50)\n print(employee.fullname)\n if len(employee.pc) > 1:\n worksheet.merge_range(row, 0, row + len(employee.pc) - 1, 0,\n employee.room.name)\n worksheet.merge_range(row, 1, row + len(employee.pc) - 1, 1,\n employee.fullname, cell_format)\n worksheet.merge_range(row, 2, row + len(employee.pc) - 1, 2,\n employee.unique_login)\n worksheet.merge_range(row, 3, row + len(employee.pc) - 1, 3,\n '\\n'.join(phone.number for phone in employee.phone), cell_format)\n worksheet.merge_range(row, 4, row + len(employee.pc) - 1, 4,\n employee.position.name, cell_format)\n worksheet.merge_range(row, 5, row + len(employee.pc) - 1, 5,\n employee.department.name, cell_format)\n worksheet.merge_range(row, 6, row + len(employee.pc) - 1, 6,\n '\\n'.join(email.email for email in employee.email), cell_format)\n worksheet.merge_range(row, 7, row + len(employee.pc) - 1, 7,\n 'Есть' if employee.shared_folder else 'Нет')\n worksheet.merge_range(row, 8, row + len(employee.pc) - 1, 8,\n 'Есть' if employee.network_printer else 'Нет')\n worksheet.merge_range(row, 9, row + len(employee.pc) - 1, 9,\n employee.comments)\n else:\n worksheet.write(row, 0, employee.room.name)\n worksheet.write(row, 1, employee.fullname, cell_format)\n worksheet.write(row, 2, employee.unique_login)\n worksheet.write(row, 3, '\\n'.join(phone.number for phone in employee.phone), cell_format)\n worksheet.write(row, 4, employee.position.name, cell_format)\n worksheet.write(row, 5, employee.department.name, cell_format)\n worksheet.write(row, 6, '\\n'.join(email.email for email in employee.email), cell_format)\n worksheet.write(row, 7, 'Есть' if employee.shared_folder else 'Нет')\n worksheet.write(row, 8, 'Есть' if employee.network_printer else 'Нет')\n worksheet.write(row, 9, employee.comments)\n\n for pc in employee.pc:\n worksheet.write(row, 10, pc.pcname.domain.name)\n worksheet.write(row, 11, pc.pcname.name)\n worksheet.write(row, 12, pc.mac_address)\n worksheet.write(row, 13, pc.app_server)\n worksheet.write(row, 14, pc.powersocket.name)\n worksheet.write(row, 15, pc.windows.name)\n worksheet.write(row, 16, pc.windows_os_key)\n worksheet.write(row, 17, pc.office.name)\n worksheet.write(row, 18, pc.ms_office_key)\n worksheet.write(row, 19, pc.mail_client)\n worksheet.write(row, 20, pc.connectiontype.name)\n worksheet.write(row, 21, 'Есть' if pc.kes else 'Нет')\n worksheet.write(row, 22, pc.antivirus.name)\n worksheet.write(row, 23, 'Есть' if pc.consultant else 'Нет')\n worksheet.write(row, 24, 'Есть' if pc.guarantee else 'Нет')\n worksheet.write(row, 25, 'Есть' if pc.odin_s else 'Нет')\n worksheet.write(row, 26, 'Есть' if pc.kdc else 'Нет')\n worksheet.write(row, 27, pc.comments)\n row += 1\n\n if not employee.pc:\n row += 1\n\n workbook.close()\n" }, { "alpha_fraction": 0.4593023359775543, "alphanum_fraction": 0.7616279125213623, "avg_line_length": 68, "blob_id": "fc21cea464e521b08590b61d5acf179768d146a7", "content_id": "d8ec0ac11a5b22c6698533935bc004365f8bcd76", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 344, "license_type": "no_license", "max_line_length": 68, "num_lines": 5, "path": "/PyQT-CRUD-App/README.md", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "![](https://pp.userapi.com/c637616/v637616687/3b8f0/dkHRQzFF53I.jpg)\n![](https://pp.userapi.com/c836121/v836121687/3c430/EzyUHBaL3-s.jpg)\n![](https://pp.userapi.com/c836121/v836121687/3c428/vbMKyGx8K9I.jpg)\n![](https://pp.userapi.com/c637616/v637616687/3b8e7/w65SzH34C5k.jpg)\n![](https://pp.userapi.com/c637616/v637616687/3b8f7/Kj_lLe99q_g.jpg)" }, { "alpha_fraction": 0.5726177096366882, "alphanum_fraction": 0.5904133319854736, "avg_line_length": 30.10714340209961, "blob_id": "1c28f23f08a731fc735dd32e1c98b001b9d8f70d", "content_id": "48bebf8e636744eb0bece94474a72ab14ecabcf2", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3499, "license_type": "no_license", "max_line_length": 76, "num_lines": 112, "path": "/pong/widgets/Pong.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "from kivy.properties import ObjectProperty\nfrom kivy.uix.widget import Widget\nfrom kivy.clock import Clock\n\n\n# Definição do\nclass Pong(Widget):\n \"\"\"\n Esse elemento contém todos os elementos do jogo (campo, raquetes e\n bolinha). Nele também está a lógica de colisão da bolinha com as\n paredes da janela à fim de atualizar o placar do jogo.\n \"\"\"\n\n # Referencia o objeto Bola definido no nosso arquivo .kv\n bola = ObjectProperty(None)\n\n # Referencia os objetos Raquete definidos no nosso arquivo .kv\n raquete_1 = ObjectProperty(None)\n raquete_2 = ObjectProperty(None)\n\n def __init__(self, screen_manager=None):\n super(Pong, self).__init__()\n self.screen_manager = screen_manager\n\n # Põe a bola em jogo\n def servico(self, vel=(4, 0)):\n\n # Posiciona a bola no centro da tela\n self.bola.center = self.center\n\n # Seta a velocidade da bola\n self.bola.velocidade = vel\n\n # Atualiza nosso jogo\n def atualiza(self, dt):\n\n # Faz a bola se mover\n self.bola.movimenta()\n\n # Rebate a bola caso haja colisão com a bolinha\n self.raquete_1.rebate_bola(self.bola)\n self.raquete_2.rebate_bola(self.bola)\n\n # Verifica se a bola atingiu o topo da janela\n if (self.bola.y < 0) or (self.bola.top > self.height):\n self.bola.velocidade_y *= -1\n\n # Verifica se colidiu com o lado esquerdo da janela para atualizar o\n # placar do jogo\n if self.bola.x < self.x:\n # +1 para o placar da raquete_2\n self.raquete_2.placar += 1\n\n if self.raquete_2.placar >= 1:\n self.servico(vel=(0, 0))\n self.raquete_1.placar = 0\n self.raquete_2.placar = 0\n self.screen_manager.current = \"vencedor_2\"\n\n return\n\n # Reinicia o jogo com a bola saindo pelo lado esquerdo\n self.servico(vel=(4, 0))\n\n # Verifica se colidiu com o lado direito da janela para atualizar o\n # placar do jogo\n if self.bola.x > self.width:\n # +1 para o placar da raquete_1\n self.raquete_1.placar += 1\n\n if self.raquete_1.placar >= 1:\n self.servico(vel=(0, 0))\n self.raquete_1.placar = 0\n self.raquete_2.placar = 0\n self.screen_manager.current = \"vencedor_1\"\n\n return\n\n # Reinicia o jogo com a bola saindo pelo lado direito\n self.servico(vel=(-4, 0))\n\n # Captura o evento on_touch_move (arrastar de dedo na tela)\n def on_touch_move(self, touch):\n # Verifica se toque foi do lado esquerdo da tela\n if touch.x < self.width / 2:\n # Atualiza altura da raquete esquerda\n self.raquete_1.center_y = touch.y\n\n # Verifica se toque foi do lado direito da tela\n if touch.x > self.width - self.width / 2:\n # Atualiza altura da raquete direita\n self.raquete_2.center_y = touch.y\n\n def remove_btn(self, btn):\n\n # Remove o botão de iniciar jogo\n self.remove_widget(btn)\n\n def comeca_jogo(self):\n\n # Pôe a bola em jogo\n self.servico()\n\n # Agendamento da função \"atualiza\" a cada 1/120 = 0,008s\n Clock.schedule_interval(self.atualiza, 1.0/120.0)\n\n def reinicia_jogo(self):\n # Pôe a bola em jogo\n self.servico(vel=(4,0))\n\n self.raquete_1.placar = 0\n self.raquete_2.placar = 0\n" }, { "alpha_fraction": 0.6328191757202148, "alphanum_fraction": 0.6700942516326904, "avg_line_length": 26.15116310119629, "blob_id": "dd292abca174320cdf9ec451e0a9713d4b27089f", "content_id": "fb1781c481b2d4d27662c615b3391313cbe9abdc", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2336, "license_type": "no_license", "max_line_length": 100, "num_lines": 86, "path": "/opencv/Realidade-Aumentada-master/calibracao.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import numpy as np\nimport cv2\nimport glob\n\n# termination criteria\ncriteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 30, 0.001)\n\n# prepare object points, like (0,0,0), (1,0,0), (2,0,0) ....,(6,5,0)\nobjp = np.zeros((7*7,3), np.float32)\nobjp[:,:2] = np.mgrid[0:7,0:7].T.reshape(-1,2)\n\n# Arrays to store object points and image points from all the images.\nobjpoints = [] # 3d point in real world space\nimgpoints = [] # 2d points in image plane.\n\nimages = glob.glob('calibracao/*.jpg')\ncount =0\nfor fname in images:\n count += 1\n img = cv2.imread(fname)\n gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)\n\n # Find the chess board corners\n ret, corners = cv2.findChessboardCorners(gray, (7,7),None)\n print(\"aaa\")\n # If found, add object points, image points (after refining them)\n if ret == True:\n print(\"aa\")\n objpoints.append(objp)\n\n corners2 = cv2.cornerSubPix(gray,corners,(11,11),(-1,-1),criteria)\n imgpoints.append(corners2)\n\n # Draw and display the corners\n img = cv2.drawChessboardCorners(img, (7,7), corners2,ret)\n cv2.imshow('img',img)\n cv2.waitKey(50)\n cv2.imwrite('calibracao/result'+str(count)+'.png',img)\n\n \n\n \n\n# calibração\nret, mtx, dist, rvecs, tvecs = cv2.calibrateCamera(objpoints, imgpoints, gray.shape[::-1],None,None)\nnp.savez(\"R1\", ret=ret, mtx=mtx, dist=dist, rvecs=rvecs, tvecs=tvecs)\nimg = cv2.imread('calibracao/webcam-toy-foto8.jpg')\nh, w = img.shape[:2]\nnewcameramtx, roi=cv2.getOptimalNewCameraMatrix(mtx,dist,(w,h),0,(w,h))\n\n\n# undistort\ndst = cv2.undistort(img, mtx, dist, None, newcameramtx)\n# crop the image\nx,y,w,h = roi\ndst = dst[y:y+h, x:x+w]\ncv2.imwrite('calibracao/calibrado/undistort.png',dst)\n\n\n# undistort\nmapx,mapy = cv2.initUndistortRectifyMap(mtx,dist,None,newcameramtx,(w,h),5)\ndst = cv2.remap(img,mapx,mapy,cv2.INTER_LINEAR)\n\n# crop the image\nx,y,w,h = roi\ndst = dst[y:y+h, x:x+w]\ncv2.imwrite('calibracao/calibrado/remapping.png',dst)\n\n\n\n\n#Error\nmean_error = 0\ntot_error= 0\nprint(len(objpoints))\nfor i in range(len(objpoints)):\n imgpoints2, _ = cv2.projectPoints(objpoints[i], rvecs[i], tvecs[i], mtx, dist)\n error = cv2.norm(imgpoints[i],imgpoints2, cv2.NORM_L2)/len(imgpoints2)\n tot_error += error\n\nprint (\"total error: \", mean_error/len(objpoints))\n\n\n\n\ncv2.destroyAllWindows()" }, { "alpha_fraction": 0.5308823585510254, "alphanum_fraction": 0.5485293865203857, "avg_line_length": 34.78947448730469, "blob_id": "ece925c59f2d4350ad2eb83be87deab306d03100", "content_id": "7a96445511065ea708291967b676d2d96cb12a61", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 680, "license_type": "no_license", "max_line_length": 139, "num_lines": 19, "path": "/webscrapy/teste1.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import requests\nfrom bs4 import BeautifulSoup\n\ndef web(page,WebUrl):\n if(page>0):\n url = WebUrl\n code = requests.get(url)\n plain = code.text\n s = BeautifulSoup(plain, 'html.parser')\n print(s.prettify())\n print(list(s.chidren))\n for link in s.findAll('table', {'class':'MsoNormalTable'}):\n # print(link)\n tet = link.get('title')\n print(tet)\n tet_2 = link.get('href')\n print(tet_2)\n\nweb(1,'http://www.fazenda.df.gov.br/aplicacoes/legislacao/legislacao/TelaSaidaDocumento.cfm?txtNumero=82&txtAno=2018&txtTipo=7&txtParte=.')\n" }, { "alpha_fraction": 0.6357835531234741, "alphanum_fraction": 0.6771396398544312, "avg_line_length": 42.30801773071289, "blob_id": "d68712fe0ec2d42dd8add22d925f8f1f2f6d6d98", "content_id": "7aaaadff3242e3c5a2c8e6769c7df05e28998ad6", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 20529, "license_type": "no_license", "max_line_length": 188, "num_lines": 474, "path": "/Wanderson-Magalhaes/Python_PySide2_Custom_Title_Bar-master/ui_main.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n\n################################################################################\n## Form generated from reading UI file 'ui_maindBzWaM.ui'\n##\n## Created by: Qt User Interface Compiler version 5.14.1\n##\n## WARNING! All changes made in this file will be lost when recompiling UI file!\n################################################################################\n\nfrom PySide2.QtCore import (QCoreApplication, QMetaObject, QObject, QPoint,\n QRect, QSize, QUrl, Qt)\nfrom PySide2.QtGui import (QBrush, QColor, QConicalGradient, QCursor, QFont,\n QFontDatabase, QIcon, QLinearGradient, QPalette, QPainter, QPixmap,\n QRadialGradient)\nfrom PySide2.QtWidgets import *\n\n\nclass Ui_MainWindow(object):\n def setupUi(self, MainWindow):\n if MainWindow.objectName():\n MainWindow.setObjectName(u\"MainWindow\")\n MainWindow.resize(880, 600)\n MainWindow.setMinimumSize(QSize(880, 600))\n self.centralwidget = QWidget(MainWindow)\n self.centralwidget.setObjectName(u\"centralwidget\")\n self.drop_shadow_layout = QVBoxLayout(self.centralwidget)\n self.drop_shadow_layout.setSpacing(0)\n self.drop_shadow_layout.setObjectName(u\"drop_shadow_layout\")\n self.drop_shadow_layout.setContentsMargins(10, 10, 10, 10)\n self.drop_shadow_frame = QFrame(self.centralwidget)\n self.drop_shadow_frame.setObjectName(u\"drop_shadow_frame\")\n self.drop_shadow_frame.setStyleSheet(u\"background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1, stop:0 rgba(42, 44, 111, 255), stop:0.521368 rgba(28, 29, 73, 255));\\n\"\n\"border-radius: 10px;\")\n self.drop_shadow_frame.setFrameShape(QFrame.NoFrame)\n self.drop_shadow_frame.setFrameShadow(QFrame.Raised)\n self.verticalLayout = QVBoxLayout(self.drop_shadow_frame)\n self.verticalLayout.setSpacing(0)\n self.verticalLayout.setObjectName(u\"verticalLayout\")\n self.verticalLayout.setContentsMargins(0, 0, 0, 0)\n self.title_bar = QFrame(self.drop_shadow_frame)\n self.title_bar.setObjectName(u\"title_bar\")\n self.title_bar.setMaximumSize(QSize(16777215, 50))\n self.title_bar.setStyleSheet(u\"background-color: none;\")\n self.title_bar.setFrameShape(QFrame.NoFrame)\n self.title_bar.setFrameShadow(QFrame.Raised)\n self.horizontalLayout = QHBoxLayout(self.title_bar)\n self.horizontalLayout.setSpacing(0)\n self.horizontalLayout.setObjectName(u\"horizontalLayout\")\n self.horizontalLayout.setContentsMargins(0, 0, 0, 0)\n self.frame_title = QFrame(self.title_bar)\n self.frame_title.setObjectName(u\"frame_title\")\n self.frame_title.setMinimumSize(QSize(0, 50))\n font = QFont()\n font.setFamily(u\"Roboto Condensed Light\")\n font.setPointSize(14)\n self.frame_title.setFont(font)\n self.frame_title.setFrameShape(QFrame.StyledPanel)\n self.frame_title.setFrameShadow(QFrame.Raised)\n self.verticalLayout_2 = QVBoxLayout(self.frame_title)\n self.verticalLayout_2.setSpacing(0)\n self.verticalLayout_2.setObjectName(u\"verticalLayout_2\")\n self.verticalLayout_2.setContentsMargins(15, 0, 0, 0)\n self.label_title = QLabel(self.frame_title)\n self.label_title.setObjectName(u\"label_title\")\n font1 = QFont()\n font1.setFamily(u\"Roboto\")\n font1.setPointSize(14)\n self.label_title.setFont(font1)\n self.label_title.setStyleSheet(u\"color: rgb(60, 231, 195);\")\n\n self.verticalLayout_2.addWidget(self.label_title)\n\n\n self.horizontalLayout.addWidget(self.frame_title)\n\n self.frame_btns = QFrame(self.title_bar)\n self.frame_btns.setObjectName(u\"frame_btns\")\n self.frame_btns.setMaximumSize(QSize(100, 16777215))\n self.frame_btns.setFrameShape(QFrame.StyledPanel)\n self.frame_btns.setFrameShadow(QFrame.Raised)\n self.horizontalLayout_3 = QHBoxLayout(self.frame_btns)\n self.horizontalLayout_3.setObjectName(u\"horizontalLayout_3\")\n self.btn_maximize = QPushButton(self.frame_btns)\n self.btn_maximize.setObjectName(u\"btn_maximize\")\n self.btn_maximize.setMinimumSize(QSize(16, 16))\n self.btn_maximize.setMaximumSize(QSize(17, 17))\n self.btn_maximize.setStyleSheet(u\"QPushButton {\\n\"\n\"\tborder: none;\\n\"\n\"\tborder-radius: 8px;\t\\n\"\n\"\tbackground-color: rgb(85, 255, 127);\\n\"\n\"}\\n\"\n\"QPushButton:hover {\t\\n\"\n\"\tbackground-color: rgba(85, 255, 127, 150);\\n\"\n\"}\")\n\n self.horizontalLayout_3.addWidget(self.btn_maximize)\n\n self.btn_minimize = QPushButton(self.frame_btns)\n self.btn_minimize.setObjectName(u\"btn_minimize\")\n self.btn_minimize.setMinimumSize(QSize(16, 16))\n self.btn_minimize.setMaximumSize(QSize(17, 17))\n self.btn_minimize.setStyleSheet(u\"QPushButton {\\n\"\n\"\tborder: none;\\n\"\n\"\tborder-radius: 8px;\t\t\\n\"\n\"\tbackground-color: rgb(255, 170, 0);\\n\"\n\"}\\n\"\n\"QPushButton:hover {\t\\n\"\n\"\tbackground-color: rgba(255, 170, 0, 150);\\n\"\n\"}\")\n\n self.horizontalLayout_3.addWidget(self.btn_minimize)\n\n self.btn_close = QPushButton(self.frame_btns)\n self.btn_close.setObjectName(u\"btn_close\")\n self.btn_close.setMinimumSize(QSize(16, 16))\n self.btn_close.setMaximumSize(QSize(17, 17))\n self.btn_close.setStyleSheet(u\"QPushButton {\\n\"\n\"\tborder: none;\\n\"\n\"\tborder-radius: 8px;\t\t\\n\"\n\"\tbackground-color: rgb(255, 0, 0);\\n\"\n\"}\\n\"\n\"QPushButton:hover {\t\t\\n\"\n\"\tbackground-color: rgba(255, 0, 0, 150);\\n\"\n\"}\")\n\n self.horizontalLayout_3.addWidget(self.btn_close)\n\n\n self.horizontalLayout.addWidget(self.frame_btns)\n\n\n self.verticalLayout.addWidget(self.title_bar)\n\n self.content_bar = QFrame(self.drop_shadow_frame)\n self.content_bar.setObjectName(u\"content_bar\")\n self.content_bar.setStyleSheet(u\"background-color: none;\")\n self.content_bar.setFrameShape(QFrame.StyledPanel)\n self.content_bar.setFrameShadow(QFrame.Raised)\n self.verticalLayout_4 = QVBoxLayout(self.content_bar)\n self.verticalLayout_4.setObjectName(u\"verticalLayout_4\")\n self.stackedWidget = QStackedWidget(self.content_bar)\n self.stackedWidget.setObjectName(u\"stackedWidget\")\n self.stackedWidget.setStyleSheet(u\"background-color: none;\")\n self.page_home = QWidget()\n self.page_home.setObjectName(u\"page_home\")\n self.verticalLayout_5 = QVBoxLayout(self.page_home)\n self.verticalLayout_5.setSpacing(0)\n self.verticalLayout_5.setObjectName(u\"verticalLayout_5\")\n self.verticalLayout_5.setContentsMargins(0, 0, 0, 0)\n self.frame_content_home = QFrame(self.page_home)\n self.frame_content_home.setObjectName(u\"frame_content_home\")\n self.frame_content_home.setFrameShape(QFrame.StyledPanel)\n self.frame_content_home.setFrameShadow(QFrame.Raised)\n self.verticalLayout_9 = QVBoxLayout(self.frame_content_home)\n self.verticalLayout_9.setObjectName(u\"verticalLayout_9\")\n self.frame_infos = QFrame(self.frame_content_home)\n self.frame_infos.setObjectName(u\"frame_infos\")\n self.frame_infos.setFrameShape(QFrame.StyledPanel)\n self.frame_infos.setFrameShadow(QFrame.Raised)\n self.horizontalLayout_4 = QHBoxLayout(self.frame_infos)\n self.horizontalLayout_4.setObjectName(u\"horizontalLayout_4\")\n self.frame_circle_1 = QFrame(self.frame_infos)\n self.frame_circle_1.setObjectName(u\"frame_circle_1\")\n self.frame_circle_1.setMinimumSize(QSize(250, 250))\n self.frame_circle_1.setMaximumSize(QSize(250, 250))\n self.frame_circle_1.setStyleSheet(u\"QFrame{\\n\"\n\"\tborder: 5px solid rgb(60, 231, 195);\\n\"\n\"\tborder-radius: 125px;\\n\"\n\"}\\n\"\n\"QFrame:hover {\\n\"\n\"\tborder: 5px solid rgb(105, 95, 148);\\n\"\n\"}\")\n self.frame_circle_1.setFrameShape(QFrame.StyledPanel)\n self.frame_circle_1.setFrameShadow(QFrame.Raised)\n self.verticalLayout_6 = QVBoxLayout(self.frame_circle_1)\n self.verticalLayout_6.setSpacing(10)\n self.verticalLayout_6.setObjectName(u\"verticalLayout_6\")\n self.verticalLayout_6.setContentsMargins(10, 50, 10, 50)\n self.label = QLabel(self.frame_circle_1)\n self.label.setObjectName(u\"label\")\n font2 = QFont()\n font2.setFamily(u\"Roboto\")\n font2.setPointSize(11)\n self.label.setFont(font2)\n self.label.setStyleSheet(u\"border: none;\\n\"\n\"color: rgb(60, 231, 195);\")\n self.label.setAlignment(Qt.AlignCenter)\n\n self.verticalLayout_6.addWidget(self.label)\n\n self.label_3 = QLabel(self.frame_circle_1)\n self.label_3.setObjectName(u\"label_3\")\n font3 = QFont()\n font3.setFamily(u\"Roboto\")\n font3.setPointSize(8)\n self.label_3.setFont(font3)\n self.label_3.setStyleSheet(u\"border: none;\\n\"\n\" color: rgb(128, 102, 168);\")\n self.label_3.setAlignment(Qt.AlignCenter)\n\n self.verticalLayout_6.addWidget(self.label_3)\n\n self.label_2 = QLabel(self.frame_circle_1)\n self.label_2.setObjectName(u\"label_2\")\n font4 = QFont()\n font4.setFamily(u\"Roboto Thin\")\n font4.setPointSize(60)\n self.label_2.setFont(font4)\n self.label_2.setStyleSheet(u\"border: none;\\n\"\n\"color: rgb(220,220,220);\")\n self.label_2.setAlignment(Qt.AlignCenter)\n\n self.verticalLayout_6.addWidget(self.label_2)\n\n self.label_4 = QLabel(self.frame_circle_1)\n self.label_4.setObjectName(u\"label_4\")\n font5 = QFont()\n font5.setFamily(u\"Roboto\")\n font5.setPointSize(10)\n self.label_4.setFont(font5)\n self.label_4.setStyleSheet(u\"border: none;\\n\"\n\"color: rgb(60, 231, 195);\")\n self.label_4.setAlignment(Qt.AlignCenter)\n\n self.verticalLayout_6.addWidget(self.label_4)\n\n\n self.horizontalLayout_4.addWidget(self.frame_circle_1)\n\n self.frame_circle_2 = QFrame(self.frame_infos)\n self.frame_circle_2.setObjectName(u\"frame_circle_2\")\n self.frame_circle_2.setMinimumSize(QSize(250, 250))\n self.frame_circle_2.setMaximumSize(QSize(250, 250))\n self.frame_circle_2.setStyleSheet(u\"QFrame{\\n\"\n\"\tborder: 5px solid rgb(60, 231, 195);\\n\"\n\"\tborder-radius: 125px;\\n\"\n\"}\\n\"\n\"QFrame:hover {\\n\"\n\"\tborder: 5px solid rgb(105, 95, 148);\\n\"\n\"}\")\n self.frame_circle_2.setFrameShape(QFrame.StyledPanel)\n self.frame_circle_2.setFrameShadow(QFrame.Raised)\n self.verticalLayout_7 = QVBoxLayout(self.frame_circle_2)\n self.verticalLayout_7.setSpacing(10)\n self.verticalLayout_7.setObjectName(u\"verticalLayout_7\")\n self.verticalLayout_7.setContentsMargins(10, 50, 10, 50)\n self.label_5 = QLabel(self.frame_circle_2)\n self.label_5.setObjectName(u\"label_5\")\n self.label_5.setFont(font2)\n self.label_5.setStyleSheet(u\"border: none;\\n\"\n\"color: rgb(60, 231, 195);\")\n self.label_5.setAlignment(Qt.AlignCenter)\n\n self.verticalLayout_7.addWidget(self.label_5)\n\n self.label_6 = QLabel(self.frame_circle_2)\n self.label_6.setObjectName(u\"label_6\")\n self.label_6.setFont(font4)\n self.label_6.setStyleSheet(u\"border: none;\\n\"\n\"color: rgb(220,220,220);\")\n self.label_6.setAlignment(Qt.AlignCenter)\n\n self.verticalLayout_7.addWidget(self.label_6)\n\n self.label_7 = QLabel(self.frame_circle_2)\n self.label_7.setObjectName(u\"label_7\")\n self.label_7.setFont(font3)\n self.label_7.setStyleSheet(u\"border: none;\\n\"\n\" color: rgb(128, 102, 168);\")\n self.label_7.setAlignment(Qt.AlignCenter)\n\n self.verticalLayout_7.addWidget(self.label_7)\n\n self.label_8 = QLabel(self.frame_circle_2)\n self.label_8.setObjectName(u\"label_8\")\n self.label_8.setFont(font5)\n self.label_8.setStyleSheet(u\"border: none;\\n\"\n\"color: rgb(60, 231, 195);\")\n self.label_8.setAlignment(Qt.AlignCenter)\n\n self.verticalLayout_7.addWidget(self.label_8)\n\n\n self.horizontalLayout_4.addWidget(self.frame_circle_2)\n\n self.frame_circle_3 = QFrame(self.frame_infos)\n self.frame_circle_3.setObjectName(u\"frame_circle_3\")\n self.frame_circle_3.setMinimumSize(QSize(250, 250))\n self.frame_circle_3.setMaximumSize(QSize(250, 250))\n self.frame_circle_3.setStyleSheet(u\"QFrame{\\n\"\n\"\tborder: 5px solid rgb(60, 231, 195);\\n\"\n\"\tborder-radius: 125px;\\n\"\n\"}\\n\"\n\"QFrame:hover {\\n\"\n\"\tborder: 5px solid rgb(105, 95, 148);\\n\"\n\"}\")\n self.frame_circle_3.setFrameShape(QFrame.StyledPanel)\n self.frame_circle_3.setFrameShadow(QFrame.Raised)\n self.verticalLayout_8 = QVBoxLayout(self.frame_circle_3)\n self.verticalLayout_8.setSpacing(10)\n self.verticalLayout_8.setObjectName(u\"verticalLayout_8\")\n self.verticalLayout_8.setContentsMargins(10, 50, 10, 50)\n self.label_9 = QLabel(self.frame_circle_3)\n self.label_9.setObjectName(u\"label_9\")\n self.label_9.setFont(font2)\n self.label_9.setStyleSheet(u\"border: none;\\n\"\n\"color: rgb(60, 231, 195);\")\n self.label_9.setAlignment(Qt.AlignCenter)\n\n self.verticalLayout_8.addWidget(self.label_9)\n\n self.label_10 = QLabel(self.frame_circle_3)\n self.label_10.setObjectName(u\"label_10\")\n self.label_10.setFont(font4)\n self.label_10.setStyleSheet(u\"border: none;\\n\"\n\"color: rgb(220,220,220);\")\n self.label_10.setAlignment(Qt.AlignCenter)\n\n self.verticalLayout_8.addWidget(self.label_10)\n\n self.label_11 = QLabel(self.frame_circle_3)\n self.label_11.setObjectName(u\"label_11\")\n self.label_11.setFont(font3)\n self.label_11.setStyleSheet(u\"border: none;\\n\"\n\" color: rgb(128, 102, 168);\")\n self.label_11.setAlignment(Qt.AlignCenter)\n\n self.verticalLayout_8.addWidget(self.label_11)\n\n self.label_12 = QLabel(self.frame_circle_3)\n self.label_12.setObjectName(u\"label_12\")\n self.label_12.setFont(font5)\n self.label_12.setStyleSheet(u\"border: none;\\n\"\n\"color: rgb(60, 231, 195);\")\n self.label_12.setAlignment(Qt.AlignCenter)\n\n self.verticalLayout_8.addWidget(self.label_12)\n\n\n self.horizontalLayout_4.addWidget(self.frame_circle_3)\n\n\n self.verticalLayout_9.addWidget(self.frame_infos)\n\n self.frame_texts = QFrame(self.frame_content_home)\n self.frame_texts.setObjectName(u\"frame_texts\")\n self.frame_texts.setMinimumSize(QSize(600, 0))\n self.frame_texts.setMaximumSize(QSize(16777215, 100))\n self.frame_texts.setFrameShape(QFrame.StyledPanel)\n self.frame_texts.setFrameShadow(QFrame.Raised)\n self.verticalLayout_10 = QVBoxLayout(self.frame_texts)\n self.verticalLayout_10.setObjectName(u\"verticalLayout_10\")\n self.label_13 = QLabel(self.frame_texts)\n self.label_13.setObjectName(u\"label_13\")\n self.label_13.setMaximumSize(QSize(600, 50))\n font6 = QFont()\n font6.setFamily(u\"Roboto Light\")\n font6.setPointSize(14)\n self.label_13.setFont(font6)\n self.label_13.setStyleSheet(u\"color: rgb(220, 220, 220);\\n\"\n\"background-color: rgb(33, 33, 75);\\n\"\n\"border-radius: 10px;\")\n self.label_13.setAlignment(Qt.AlignCenter)\n\n self.verticalLayout_10.addWidget(self.label_13)\n\n\n self.verticalLayout_9.addWidget(self.frame_texts, 0, Qt.AlignHCenter)\n\n\n self.verticalLayout_5.addWidget(self.frame_content_home)\n\n self.stackedWidget.addWidget(self.page_home)\n self.page_credits = QWidget()\n self.page_credits.setObjectName(u\"page_credits\")\n self.frame_content_credits = QFrame(self.page_credits)\n self.frame_content_credits.setObjectName(u\"frame_content_credits\")\n self.frame_content_credits.setGeometry(QRect(90, 70, 120, 80))\n self.frame_content_credits.setFrameShape(QFrame.StyledPanel)\n self.frame_content_credits.setFrameShadow(QFrame.Raised)\n self.stackedWidget.addWidget(self.page_credits)\n\n self.verticalLayout_4.addWidget(self.stackedWidget)\n\n\n self.verticalLayout.addWidget(self.content_bar)\n\n self.credits_bar = QFrame(self.drop_shadow_frame)\n self.credits_bar.setObjectName(u\"credits_bar\")\n self.credits_bar.setMaximumSize(QSize(16777215, 30))\n self.credits_bar.setStyleSheet(u\"background-color: rgb(33, 33, 75);\")\n self.credits_bar.setFrameShape(QFrame.NoFrame)\n self.credits_bar.setFrameShadow(QFrame.Raised)\n self.horizontalLayout_2 = QHBoxLayout(self.credits_bar)\n self.horizontalLayout_2.setSpacing(0)\n self.horizontalLayout_2.setObjectName(u\"horizontalLayout_2\")\n self.horizontalLayout_2.setContentsMargins(0, 0, 0, 0)\n self.frame_label_credits = QFrame(self.credits_bar)\n self.frame_label_credits.setObjectName(u\"frame_label_credits\")\n self.frame_label_credits.setFrameShape(QFrame.StyledPanel)\n self.frame_label_credits.setFrameShadow(QFrame.Raised)\n self.verticalLayout_3 = QVBoxLayout(self.frame_label_credits)\n self.verticalLayout_3.setSpacing(0)\n self.verticalLayout_3.setObjectName(u\"verticalLayout_3\")\n self.verticalLayout_3.setContentsMargins(15, 0, 0, 0)\n self.label_credits = QLabel(self.frame_label_credits)\n self.label_credits.setObjectName(u\"label_credits\")\n font7 = QFont()\n font7.setFamily(u\"Roboto\")\n self.label_credits.setFont(font7)\n self.label_credits.setStyleSheet(u\"color: rgb(128, 102, 168);\")\n\n self.verticalLayout_3.addWidget(self.label_credits)\n\n\n self.horizontalLayout_2.addWidget(self.frame_label_credits)\n\n self.frame_grip = QFrame(self.credits_bar)\n self.frame_grip.setObjectName(u\"frame_grip\")\n self.frame_grip.setMinimumSize(QSize(30, 30))\n self.frame_grip.setMaximumSize(QSize(30, 30))\n self.frame_grip.setStyleSheet(u\"padding: 5px;\")\n self.frame_grip.setFrameShape(QFrame.StyledPanel)\n self.frame_grip.setFrameShadow(QFrame.Raised)\n\n self.horizontalLayout_2.addWidget(self.frame_grip)\n\n\n self.verticalLayout.addWidget(self.credits_bar)\n\n\n self.drop_shadow_layout.addWidget(self.drop_shadow_frame)\n\n MainWindow.setCentralWidget(self.centralwidget)\n\n self.retranslateUi(MainWindow)\n\n self.stackedWidget.setCurrentIndex(0)\n\n\n QMetaObject.connectSlotsByName(MainWindow)\n # setupUi\n\n def retranslateUi(self, MainWindow):\n MainWindow.setWindowTitle(QCoreApplication.translate(\"MainWindow\", u\"MainWindow\", None))\n self.label_title.setText(QCoreApplication.translate(\"MainWindow\", u\"This Is My App - Title Bar\", None))\n#if QT_CONFIG(tooltip)\n self.btn_maximize.setToolTip(QCoreApplication.translate(\"MainWindow\", u\"Maximize\", None))\n#endif // QT_CONFIG(tooltip)\n self.btn_maximize.setText(\"\")\n#if QT_CONFIG(tooltip)\n self.btn_minimize.setToolTip(QCoreApplication.translate(\"MainWindow\", u\"Minimize\", None))\n#endif // QT_CONFIG(tooltip)\n self.btn_minimize.setText(\"\")\n#if QT_CONFIG(tooltip)\n self.btn_close.setToolTip(QCoreApplication.translate(\"MainWindow\", u\"Close\", None))\n#endif // QT_CONFIG(tooltip)\n self.btn_close.setText(\"\")\n self.label.setText(QCoreApplication.translate(\"MainWindow\", u\"CPU USAGE\", None))\n self.label_3.setText(QCoreApplication.translate(\"MainWindow\", u\"Intel | i9 9900k | 8 Cores\", None))\n self.label_2.setText(QCoreApplication.translate(\"MainWindow\", u\"25%\", None))\n self.label_4.setText(QCoreApplication.translate(\"MainWindow\", u\"Temp: 45C\\u00ba\", None))\n self.label_5.setText(QCoreApplication.translate(\"MainWindow\", u\"GPU USAGE\", None))\n self.label_6.setText(QCoreApplication.translate(\"MainWindow\", u\"40%\", None))\n self.label_7.setText(QCoreApplication.translate(\"MainWindow\", u\"RTX 2080 Ti\", None))\n self.label_8.setText(QCoreApplication.translate(\"MainWindow\", u\"Temp: 55C\\u00ba\", None))\n self.label_9.setText(QCoreApplication.translate(\"MainWindow\", u\"RAM USAGE\", None))\n self.label_10.setText(QCoreApplication.translate(\"MainWindow\", u\"8GB\", None))\n self.label_11.setText(QCoreApplication.translate(\"MainWindow\", u\"Total: 64gb\", None))\n self.label_12.setText(QCoreApplication.translate(\"MainWindow\", u\"Temp: 25C\\u00ba\", None))\n self.label_13.setText(QCoreApplication.translate(\"MainWindow\", u\"\\\"If you control the code, you control the world.\\\"\", None))\n self.label_credits.setText(QCoreApplication.translate(\"MainWindow\", u\"By: Wanderson M. Pimenta\", None))\n # retranslateUi\n\n" }, { "alpha_fraction": 0.3952702581882477, "alphanum_fraction": 0.4695945978164673, "avg_line_length": 23.75, "blob_id": "e03b7ee954b3504bed3b9b6688298b72f86e4433", "content_id": "9a3cbf7d94c04ccb8d1b424ecaff3524c193fead", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 296, "license_type": "no_license", "max_line_length": 67, "num_lines": 12, "path": "/gallery/db.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "users = {\n \"michael\": {\n \"name\": \"Michael Scott\",\n \"image\": \"https://api.adorable.io/avatars/100/michael.png\",\n \"tel\": \"1489-7895\"\n },\n \"david\": {\n \"name\": \"David Brent\",\n \"image\": \"https://api.adorable.io/avatars/100/david.png\",\n \"tel\": \"5555-5555\"\n }\n}" }, { "alpha_fraction": 0.30434781312942505, "alphanum_fraction": 0.47826087474823, "avg_line_length": 22, "blob_id": "fd0a3c3a053f7cc68d67acd5efc665c435db3a42", "content_id": "9da9a84c9edafd5115c3b03594e30b22be2635f9", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 23, "license_type": "no_license", "max_line_length": 22, "num_lines": 1, "path": "/djangosige/venv/Lib/site-packages/geraldo/version.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "__version__ = '0.4.16'\n" }, { "alpha_fraction": 0.6896807551383972, "alphanum_fraction": 0.7000742554664612, "avg_line_length": 32.70000076293945, "blob_id": "10a68ea77dd2256c19fc548086c361510ee0aef9", "content_id": "80a00ddaddbc2c9e782565da14a6413a7736c897", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1349, "license_type": "no_license", "max_line_length": 116, "num_lines": 40, "path": "/cidades_ibge/sqlal_001.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import sqlite3\nfrom sqlalchemy import create_engine\nfrom sqlalchemy.ext.declarative import declarative_base\nfrom sqlalchemy import Column, Integer, String\nfrom sqlalchemy import Sequence\nfrom sqlalchemy.orm import sessionmaker\n\n# engine = create_engine('sqlite:///:memory:', echo=True)\nengine = create_engine('sqlite:///teste.db3')\n# engine = create_engine('postgresql://usr:pass@localhost:5432/sqlalchemy')\nBase = declarative_base()\nColumn(Integer, Sequence('user_id_seq'), primary_key=True)\nSession = sessionmaker(bind=engine)\n\nsession = Session()\n\nclass User(Base):\n __tablename__ = 'users'\n # id = Column(Integer, Sequence('user_id_seq'), primary_key=True)\n id = Column(Integer, primary_key=True, autoincrement=True, nullable=False, comment='Id do Usuário', unique=True)\n user = Column(String(20), nullable=False, comment='Usuário', unique=True)\n fullname = Column(String(50), comment='Nome completo')\n password = Column(String(12), comment='Senha')\n\n def __repr__(self):\n return \"<User(user='%s', fullname='%s', password='%s')>\" % (\n self.user, self.fullname, self.password)\n\nprint(User.__table__)\n\nBase.metadata.create_all(engine)\n\ned_user = User(user='ed1', fullname='Ed Jones1', password='edspassword1')\nsession.add(ed_user)\n\nprint(ed_user.user)\n\nsession.commit()\n\nprint(ed_user.id)" }, { "alpha_fraction": 0.5697881579399109, "alphanum_fraction": 0.5753316283226013, "avg_line_length": 37.85384750366211, "blob_id": "53a7cf8f04e26c722971a4d7a86b55bbb8669cdc", "content_id": "fe445412aaa2a8a007620cad7d1ea28ac74c8cd5", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 5051, "license_type": "no_license", "max_line_length": 155, "num_lines": 130, "path": "/fullcontrol-menu/movieSource/MovieHeaven.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "# -*- encoding:utf-8 -*-\nimport requests\nimport re\nimport urllib\nfrom movieSource.fake_user_agent import useragent_random\nfrom multiprocessing.dummy import Pool as ThreadPool\nimport sys\n\n\nclass MovieHeaven:\n __slots__ = ['__pool', '__all_page_details_url_list', '__search_url', '__search_domain', '__download_domain',\n '__params']\n\n def __init__(self, parent=None):\n self.__pool = ThreadPool(8)\n self.__all_page_details_url_list = []\n self.__search_url = \"http://s.ygdy8.com/plus/so.php\"\n self.__search_domain = 'http://s.ygdy8.com'\n self.__download_domain = 'http://www.ygdy8.com'\n self.__params = {\"kwtype\": \"0\",\n \"searchtype\": \"title\", \"keyword\": \"leetao\"}\n\n def __get_headers(self):\n return {\"User-Agent\": useragent_random()}\n\n def __search_movie_results(self, url=None, params=None):\n if url is None:\n url = self.__search_url\n\n temp_results = requests.get(\n url, params=params, headers=self.__get_headers())\n temp_results.encoding = 'gb2312'\n return temp_results.text\n\n def __get_movies_detail_page(self, searchResults):\n \"\"\"\n get the detailPage's url of movies by using regx\n \"\"\"\n pattern = re.compile(\n r\"<td\\s+width='\\d+%'><b><a\\s+href='(.*\\.html)'\\s*>\")\n all_detai_pages = pattern.findall(searchResults)\n return all_detai_pages\n\n def __get_page_number_total(self, searchResults):\n \"\"\"\n get the total number of pages\n \"\"\"\n page_num_total_pattern = re.compile(\n r\"<td\\s+width='30'><a\\s+href='.+PageNo=(\\d+)'\\s*>\")\n page_num_total = page_num_total_pattern.findall(searchResults)\n if len(page_num_total) == 0:\n return -1\n else:\n return int(page_num_total[0])\n\n def __next_page_detail(self, search_results):\n \"\"\"\n get the next page'url which lacks the pagenumber\n \"\"\"\n next_page_pattern = re.compile(\n r\"<td\\s+width='30'><a href='(.*PageNo=)\\d+'>\")\n next_page_url = next_page_pattern.findall(search_results)\n return str(next_page_url[0])\n\n def __get_search_content_by_url(self, next_page_url, page_num_total):\n \"\"\"\n get remain pages's url\n \"\"\"\n for page_no in range(2, page_num_total + 1):\n if page_no is not None:\n url = self.__search_domain + next_page_url + str(page_no)\n res = self.__search_movie_results(url)\n return self.__get_movies_detail_page(res)\n\n def __get_movie_contents_url(self, url, params=None):\n \"\"\"\n get the first page of searching results\n and get the remain pages's results\n \"\"\"\n first_page_results = self.__search_movie_results(url, params)\n first_page_resultsList = self.__get_movies_detail_page(\n first_page_results)\n\n # get the remain pages's results\n total_page_num = self.__get_page_number_total(first_page_results)\n if total_page_num > 0:\n next_page_url = self.__next_page_detail(first_page_results)\n remain_page_results_list = self.__get_search_content_by_url(\n next_page_url, total_page_num)\n self.__all_page_details_url_list.extend(remain_page_results_list)\n\n self.__all_page_details_url_list.extend(first_page_resultsList)\n return self.__all_page_details_url_list\n\n def __get_movie_down_url(self, down_page_url_list):\n results_list = []\n down_page_content_url_list = [\n (self.__download_domain + url) for url in down_page_url_list]\n for result_url_list in self.__pool.map(self.__get_down_page_content_url, self.__pool.map(self.__search_movie_results, down_page_content_url_list)):\n if len(result_url_list) > 0:\n results_list += result_url_list\n\n self.__pool.close()\n self.__pool.join()\n return results_list\n\n def __get_down_page_content_url(self, down_page_content):\n download_url_list = []\n ftp_down_pattern = re.compile(r'<td.+><a\\s+href=\"(.+)\"\\s*>')\n ftp_url_list = ftp_down_pattern.findall(down_page_content)\n if len(ftp_url_list) > 0:\n download_url_list.append(ftp_url_list[0])\n\n magnet_down_pattern = re.compile(\n r'<a\\s+href=\"(magnet:\\?xt=.+)\"><strong>')\n magnet_url_list = ftp_down_pattern.findall(down_page_content)\n if len(magnet_url_list) > 0:\n download_url_list.append(magnet_url_list[0])\n\n return download_url_list\n\n def get_display_content(self, url, params=None):\n url_list = self.__get_movie_contents_url(url, params)\n if len(url_list) == 0:\n return ['Not Found']\n else:\n all_download_url_list = self.__get_movie_down_url(url_list)\n movie_list = [\n url for url in all_download_url_list if url is not None and url[-3:] not in ['zip', 'rar', 'exe']]\n return movie_list\n" }, { "alpha_fraction": 0.5475439429283142, "alphanum_fraction": 0.559260904788971, "avg_line_length": 28.573333740234375, "blob_id": "d7e4da6a1529c89e9e2ae82ea37a47b896bc7085", "content_id": "ebf123f697672491441d84d5debda01668905029", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2219, "license_type": "no_license", "max_line_length": 153, "num_lines": 75, "path": "/djangosige/venv/Lib/site-packages/pysignfe/nfe/manual_700/soap_400.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n\nimport os\n\nfrom pysignfe.nfe.manual_600 import soap_310\nfrom pysignfe.xml_sped import *\n\nDIRNAME = os.path.dirname(__file__)\n\nclass NFeDadosMsg(soap_310.NFeDadosMsg):\n def __init__(self):\n super(NFeDadosMsg, self).__init__()\n\n\nclass SOAPEnvio(XMLNFe):\n def __init__(self):\n super(SOAPEnvio, self).__init__()\n self.webservice = u''\n self.metodo = u''\n self.cUF = None\n self.envio = None\n self.nfeDadosMsg = NFeDadosMsg()\n self._header = {u'content-type': u'application/soap+xml; charset=utf-8'}\n\n def get_xml(self):\n self.nfeDadosMsg.webservice = self.webservice\n self.nfeDadosMsg.dados = self.envio\n\n self._header[u'content-type'] = u'application/soap+xml; charset=utf-8; action=\"http://www.portalfiscal.inf.br/nfe/wsdl/' + self.webservice + u'\"'\n\n xml = XMLNFe.get_xml(self)\n xml += ABERTURA\n xml += u'<soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\">'\n xml += u'<soap:Body>'\n xml += self.nfeDadosMsg.xml\n xml += u'</soap:Body>'\n xml += u'</soap:Envelope>'\n return xml\n\n def set_xml(self):\n pass\n\n xml = property(get_xml, set_xml)\n\n def get_header(self):\n header = self._header\n return header\n\n header = property(get_header)\n\n\nclass SOAPRetorno(XMLNFe):\n def __init__(self):\n super(SOAPRetorno, self).__init__()\n self.webservice = u''\n self.metodo = u''\n self.resposta = None\n\n def get_xml(self):\n xml = XMLNFe.get_xml(self)\n xml += ABERTURA\n xml += u'<soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\">'\n xml += u'<soap:Body>'\n xml += u'<' + self.metodo + u'Result xmlns=\"http://www.portalfiscal.inf.br/nfe/wsdl/' + self.webservice + u'\">'\n xml += self.resposta.xml\n xml += u'</' + self.metodo + u'Result>'\n xml += u'</soap:Body>'\n xml += u'</soap:Envelope>'\n return xml\n\n def set_xml(self, arquivo):\n if self._le_xml(arquivo):\n self.resposta.xml = arquivo\n\n xml = property(get_xml, set_xml)\n\n" }, { "alpha_fraction": 0.6708333492279053, "alphanum_fraction": 0.675000011920929, "avg_line_length": 20.81818199157715, "blob_id": "9cac2791cb91eb8e1476eb919994807aee6c4b4b", "content_id": "b5db374ad82ff74f55f8d30aa933aed975bbef2b", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 240, "license_type": "permissive", "max_line_length": 45, "num_lines": 11, "path": "/pyqt-boilerplate-master/app/views/MainWindow.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "from PyQt5.QtWidgets import QMainWindow\n\nfrom .MainWindow_ui import Ui_MainWindow\n\n\nclass MainWindow(QMainWindow, Ui_MainWindow):\n \"\"\"Main Window.\"\"\"\n\n def __init__(self):\n QMainWindow.__init__(self)\n self.setupUi(self)\n" }, { "alpha_fraction": 0.5917859077453613, "alphanum_fraction": 0.5980086922645569, "avg_line_length": 29.037384033203125, "blob_id": "0872f32cc03c07c9c83a77edafa8f0c8cb57d694", "content_id": "b794bd7fd2a8e7fee4ce636b91e1940265fbd05d", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3214, "license_type": "no_license", "max_line_length": 91, "num_lines": 107, "path": "/pyside2/chat/sqlDialog.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import datetime\nimport logging\n\nfrom PySide2.QtCore import Qt, Slot\nfrom PySide2.QtSql import QSqlDatabase, QSqlQuery, QSqlRecord, QSqlTableModel\n\ntable_name = \"Conversations\"\n\n\ndef createTable():\n if table_name in QSqlDatabase.database().tables():\n return\n\n query = QSqlQuery()\n if not query.exec_(\n \"\"\"\n CREATE TABLE IF NOT EXISTS 'Conversations' (\n 'author' TEXT NOT NULL,\n 'recipient' TEXT NOT NULL,\n 'timestamp' TEXT NOT NULL,\n 'message' TEXT NOT NULL,\n FOREIGN KEY('author') REFERENCES Contacts ( name ),\n FOREIGN KEY('recipient') REFERENCES Contacts ( name )\n )\n \"\"\"\n ):\n logging.error(\"Failed to query database\")\n\n # This adds the first message from the Bot\n # and further development is required to make it interactive.\n query.exec_(\n \"\"\"\n INSERT INTO Conversations VALUES(\n 'machine', 'Me', '2019-01-07T14:36:06', 'Hello!'\n )\n \"\"\"\n )\n logging.info(query)\n\nclass SqlConversationModel(QSqlTableModel):\n def __init__(self, parent=None):\n super(SqlConversationModel, self).__init__(parent)\n\n createTable()\n self.setTable(table_name)\n self.setSort(2, Qt.DescendingOrder)\n self.setEditStrategy(QSqlTableModel.OnManualSubmit)\n self.recipient = \"\"\n\n self.select()\n logging.debug(\"Table was loaded successfully.\")\n\n def setRecipient(self, recipient):\n if recipient == self.recipient:\n pass\n\n self.recipient = recipient\n\n filter_str = (\n \"(recipient = '{}' AND author = 'Me') OR \" \"(recipient = 'Me' AND author='{}')\"\n ).format(self.recipient)\n self.setFilter(filter_str)\n self.select()\n\n def data(self, index, role):\n if role < Qt.UserRole:\n return QSqlTableModel.data(self, index, role)\n\n sql_record = QSqlRecord()\n sql_record = self.record(index.row())\n\n return sql_record.value(role - Qt.UserRole)\n\n def roleNames(self):\n \"\"\"Converts dict to hash because that's the result expected\n by QSqlTableModel\"\"\"\n names = {}\n author = \"author\".encode()\n recipient = \"recipient\".encode()\n timestamp = \"timestamp\".encode()\n message = \"message\".encode()\n\n names[hash(Qt.UserRole)] = author\n names[hash(Qt.UserRole + 1)] = recipient\n names[hash(Qt.UserRole + 2)] = timestamp\n names[hash(Qt.UserRole + 3)] = message\n\n return names\n\n @Slot(str, str, str)\n def send_message(self, recipient, message, author):\n timestamp = datetime.datetime.now()\n\n new_record = self.record()\n new_record.setValue(\"author\", author)\n new_record.setValue(\"recipient\", recipient)\n new_record.setValue(\"timestamp\", str(timestamp))\n new_record.setValue(\"message\", message)\n\n logging.debug('Message: \"{}\" \\n Received by: \"{}\"'.format(message, recipient))\n\n if not self.insertRecord(self.rowCount(), new_record):\n logging.error(\"Failed to send message: {}\".format(self.lastError().text()))\n return\n\n self.submitAll()\n self.select()\n" }, { "alpha_fraction": 0.5220125913619995, "alphanum_fraction": 0.7421383857727051, "avg_line_length": 21.85714340209961, "blob_id": "c5441acaebf8c36ae500699cfc97c3547410737a", "content_id": "3baebef188263dd0075a8517ebadc8bdc30417ef", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 159, "license_type": "no_license", "max_line_length": 64, "num_lines": 7, "path": "/mapas/ve-mapa-001.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import folium\nimport pandas as pd\n\n\nmapa = folium.Map(location=[-15.788497,-47.879873],zoom_start=4)\nfolium.Marker([-19.9166813,-43.9344931]).add_to(mapa)\nmapa" }, { "alpha_fraction": 0.4415760934352875, "alphanum_fraction": 0.4850543439388275, "avg_line_length": 32.5, "blob_id": "0cfcfb6dbe01c73a4bef2cdc0a74c6989c6a7bb4", "content_id": "7d2e1217efe1d09ab6b5e60706b97c769532f7ae", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 736, "license_type": "no_license", "max_line_length": 89, "num_lines": 22, "path": "/fullcontrol_001/txt-pandas.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/python3\n\nimport pandas as pd\n\ncol_names = ['empresa', 'refer', 'item', 'seq', 'status', 'especie',\n 'serie', 'numero', 'fco', 'usuar', 'ano', 'mes', 'dia',\n 'hor', 'min', 'seg', 'dec', 'motivo1', 'motivo2', 'resolu',\n 'motivo', 'itemcom', 'progr']\n\ncol_widths = [2, 3, 3, 18, 1, 3, 3, 8, 15, 12,\n 4, 2, 2, 2, 2, 2, 2, 55, 55, 55, 4, 5, 8]\n\ncol_types = ['int', 'str', 'str', 'int', 'str', 'str', 'str', 'int', 'str', 'str', 'int',\n 'int', 'int', 'int', 'int', 'int', 'int', 'str', 'str', 'str', 'int', 'int',\n 'str']\n\n# read into dataframe\ndf = pd.read_fwf('lgg', widths=col_widths, names=col_names, dtypes=col_types)\n\nprint(df.head())\n\nprint(df.info())" }, { "alpha_fraction": 0.6384953856468201, "alphanum_fraction": 0.6985833048820496, "avg_line_length": 28.68115997314453, "blob_id": "bb8a5ff636b18827fe3b481dea007501a847834f", "content_id": "2edc0025b99de6112d974f91b3b2bc564906196e", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2049, "license_type": "no_license", "max_line_length": 72, "num_lines": 69, "path": "/telegram/tel-send-1.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "# importing all required libraries\n# import telebot\nfrom telethon.sync import TelegramClient\nfrom telethon.tl.types import InputPeerUser, InputPeerChannel\nfrom telethon import TelegramClient, sync, events\n \n \n# get your api_id, api_hash, token\n# from telegram as described above\n\n# bueno\n# api_id = 5585466\n# api_hash = 'aa8b3de02af96d6c8a18b262774ce755'\n# token = '1861042665:AAHNM8K9T5coicud3rxuaJSjIaahJGSakbs'\n\n# compras\napi_id = 4888068\napi_hash = '16af559125cab1310194e8015672dce1'\ntoken = '1612101465:AAGrCmHM86jDJRH-biquYs0ymmb_MoXS8j4'\n \n# your phone number\n# phone = '+5561982246622'\nphone = '+55 61 99983 6707'\n \n# creating a telegram session and assigning\n# it to a variable client\nclient = TelegramClient('primeiralinhacompras_bot', api_id, api_hash)\n \n# connecting and building the session\nprint(client.connect())\n \n# in case of script ran first time it will\n# ask either to input token or otp sent to\n# number or sent or your telegram id \nif not client.is_user_authorized():\n \n client.send_code_request(phone)\n \n # signing in the client\n client.sign_in(phone)\n try:\n client.sign_in(code=input('Enter code: '))\n except: \n client.sign_in(password='070707')\n \ntry:\n # receiver user_id and access_hash, use\n # my user_id and access_hash for reference\n # id_destino = client.get_input_entity('primeiralinha_bot')\n # id_destino = client.get_input_entity('+55 61 99405 3164')\n # id_destino = client.get_input_entity('+55 61 99983 6707')\n id_destino = client.get_input_entity('+55 (61) 98224-6622')\n # print(user_id)\n\n \n # sending message using telegram client\n # client.send_message(receiver, message='teste', parse_mode='html')\n mensagem=\"\"\"Olá isso é um teste\"\"\"\n\n client.send_message(id_destino, message=mensagem, parse_mode='html')\n # client.send_file(id_destino, 's:\\logo.png')\nexcept Exception as e:\n \n # there may be many error coming in while like peer\n # error, wwrong access_hash, flood_error, etc\n print(e);\n \n# disconnecting the telegram session \nclient.disconnect()" }, { "alpha_fraction": 0.5086763501167297, "alphanum_fraction": 0.5449959635734558, "avg_line_length": 26.692737579345703, "blob_id": "de954d267f48878f5de8e2abf498e7e1b9722eef", "content_id": "dc94e1dd0842840b90a2b27731b509b87f2d5373", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 4956, "license_type": "no_license", "max_line_length": 74, "num_lines": 179, "path": "/pong/pong.kv", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n#:import wb webbrowser\n#:kivy 1.9.1\n\n<TelaMenu>:\n canvas:\n Rectangle:\n source: 'img/tela-inicial-bg.png'\n size: self.width, self.height\n\n Button:\n size_hint: 0.166, 0.075\n center_x: root.center_x - self.width\n center_y: root.center_y - 100\n background_normal: 'img/iniciar-btn-normal.png'\n background_down: 'img/iniciar-btn-pressed.png'\n on_release:\n root.manager.transition.direction = 'left'\n root.manager.current = 'jogo'\n\n Button:\n size_hint: 0.166, 0.075\n center_x: root.center_x + self.width\n center_y: root.center_y - 100\n background_normal: 'img/fechar-btn-normal.png'\n background_down: 'img/fechar-btn-pressed.png'\n on_press: app.stop()\n\n<Bola>:\n size: 50, 50\n canvas:\n Ellipse:\n source: 'img/bola.png'\n pos: self.pos\n size: self.size\n\n<Raquete>:\n size: 25, 200\n canvas:\n Rectangle:\n source: 'img/raquete.png'\n pos:self.pos\n size:self.size\n\n<Pong>:\n bola: bola\n raquete_1: raquete_esquerda\n raquete_2: raquete_direita\n\n canvas:\n Rectangle:\n source: 'img/campo.png'\n size: self.width, self.height\n\n Label:\n font_size: 16\n center_x: root.width/4\n top: root.top + 20\n text: \"Jogador 1\"\n color: (0,0,0,1)\n\n Label:\n font_size: 16\n center_x: root.width * 3/4\n top: root.top + 20\n text: \"Jogador 2\"\n color: (0,0,0,1)\n\n Label:\n font_size: 50\n center_x: root.width/4\n top: root.top - 20\n text: str(root.raquete_1.placar)\n color: (0,0,0,1)\n\n Label:\n font_size: 50\n center_x: root.width * 3/4\n top: root.top - 20\n text: str(root.raquete_2.placar)\n color: (0,0,0,1)\n\n Bola:\n id: bola\n center: self.parent.center\n\n Raquete:\n id: raquete_esquerda\n x: root.x\n source: 'img/raquete_1.png'\n center_y: root.center_y\n\n Raquete:\n id: raquete_direita\n x: root.width-self.width\n center_y: root.center_y\n\n Button:\n size: 200, 60\n\t\tbackground_normal: 'img/iniciar-btn-normal.png'\n background_down: 'img/iniciar-btn-pressed.png'\n center_x: root.width/6\n on_press:\n root.remove_btn(self)\n root.comeca_jogo()\n reinicia_jogo_btn.center_x = 1 * root.width/4\n menu_btn.center_x = 3 * root.width/4\n\n Button:\n id: reinicia_jogo_btn\n size: 200, 60\n\t\tbackground_normal: 'img/reiniciar-btn-normal.png'\n background_down: 'img/reiniciar-btn-pressed.png'\n center_x: 3 * root.width/6\n on_press:\n root.reinicia_jogo()\n\n Button:\n id: menu_btn\n size: 200, 60\n\t\tbackground_normal: 'img/menu-btn-normal.png'\n background_down: 'img/menu-btn-pressed.png'\n center_x: 5 * root.width/6\n on_press:\n root.screen_manager.transition.direction = \"right\"\n root.screen_manager.current = \"menu\"\n root.servico(vel=(0, 0))\n\n<TelaJogo>:\n<TelaVencedor1>:\n canvas:\n Rectangle:\n source: 'img/vencedor-1.png'\n size: self.width, self.height\n\n Button: \n size_hint: 0.25, 0.075\n pos_hint: {'top': 0.5, 'right': (0.7 + (self.width/2)/root.width)}\n background_normal: 'img/back-to-menu-btn-normal.png'\n background_down: 'img/back-to-menu-btn-pressed.png'\n center_x: root.center_x + self.width/2 + 20\n on_press:\n root.manager.current = \"menu\"\n root.manager.transition.direction = \"right\"\n\n Button:\n # 300px x 60px\n size_hint: 0.25, 0.075\n pos_hint: {'top': 0.5, 'right': (0.3 + (self.width/2)/root.width)}\n center_x: root.center_x + self.width/2 + 20\n background_normal: 'img/link-btn-normal.png'\n on_press:\n wb.open(\"https://pythonacademy.com.br\")\n\n<TelaVencedor2>:\n canvas:\n Rectangle:\n source: 'img/vencedor-2.png'\n size: self.width, self.height\n\n Button: \n size_hint: 0.25, 0.075\n pos_hint: {'top': 0.5, 'right': (0.7 + (self.width/2)/root.width)}\n background_normal: 'img/back-to-menu-btn-normal.png'\n background_down: 'img/back-to-menu-btn-pressed.png'\n center_x: root.center_x + self.width/2 + 20\n on_press:\n root.manager.current = \"menu\"\n root.manager.transition.direction = \"right\"\n\n Button:\n # 300px x 60px\n size_hint: 0.25, 0.075\n pos_hint: {'top': 0.5, 'right': (0.3 + (self.width/2)/root.width)}\n center_x: root.center_x + self.width/2 + 20\n background_normal: 'img/link-btn-normal.png'\n on_press:\n wb.open(\"https://pythonacademy.com.br\")" }, { "alpha_fraction": 0.6436949968338013, "alphanum_fraction": 0.6554251909255981, "avg_line_length": 20.3125, "blob_id": "fa84e375e9b0866b92e98052d3f9947d700f773a", "content_id": "0e297389696a41fbf639e0a9ef20ab20f3282f36", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1364, "license_type": "no_license", "max_line_length": 62, "num_lines": 64, "path": "/Hospital-Helper-2-master/app/gui/utils.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "\"\"\"\nModule for common gui operations.\n\"\"\"\n\nfrom PyQt5.Qt import Qt\nfrom PyQt5.QtWidgets import (\n QLayout,\n QVBoxLayout,\n QWidget,\n QGroupBox,\n QScrollArea,\n QGraphicsDropShadowEffect,\n)\n\n\ndef get_scrollable(layout):\n \"\"\"\n Convert layout to a scrollable widget.\n \"\"\"\n\n widget = QWidget()\n\n groupbox = QGroupBox()\n groupbox.setLayout(layout)\n scroll = QScrollArea()\n scroll.setWidget(groupbox)\n scroll.setWidgetResizable(True)\n scroll.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)\n scroll.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)\n\n this_vbox = QVBoxLayout(widget)\n this_vbox.addWidget(scroll)\n this_vbox.setContentsMargins(0, 0, 0, 0)\n this_vbox.setSpacing(0)\n layout.setContentsMargins(0, 0, 0, 0)\n layout.setSpacing(0)\n return widget\n\n\ndef get_shadow():\n \"\"\"\n Returns shadow effect.\n \"\"\"\n\n shadow = QGraphicsDropShadowEffect()\n shadow.setBlurRadius(10)\n shadow.setXOffset(0)\n shadow.setYOffset(0)\n return shadow\n\n\ndef clear_layout(layout):\n \"\"\"\n Delete everything from the given layout.\n \"\"\"\n\n for i in reversed(range(layout.count())):\n item = layout.takeAt(i)\n if isinstance(item, QLayout):\n clear_layout(item)\n try:\n item.widget().setParent(None)\n except AttributeError:\n pass\n" }, { "alpha_fraction": 0.6645326614379883, "alphanum_fraction": 0.6875800490379333, "avg_line_length": 26.421052932739258, "blob_id": "e0fe888d103834da23001c9ab851ec9bdc11c755", "content_id": "3dcbac98ce6cb77ebc03844c1616ef358f439a55", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1562, "license_type": "no_license", "max_line_length": 90, "num_lines": 57, "path": "/pyside2/inventory.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import wmi\n\nc = wmi.WMI ()\n\n# Mostra sistema operacional\nprint(c.Win32_OperatingSystem()[0].Caption)\n# print(c.Win32_OperatingSystem()[0])\n\n# print(c.Win32_PowerManagementEvent.derivation())\n\n# print(c.Win32_ComputerSystem.methods.keys())\n\n# os = c.Win32_OperatingSystem\n# for method_name in os.methods:\n# method = getattr(os, method_name)\n# print(method)\n\n\n# c = wmi.WMI(find_classes=False)\n# # for i in c.Win32_Process([\"Caption\", \"ProcessID\"]):\n# for i in c.Win32_Process():\n# print(i)\n\n# Processos\n# for process in c.Win32_Process ():\n# print(process.ProcessId, process.Name)\n\n# Servicos que iniciam com o Windows\n# services = c.Win32_Service (StartMode=\"Auto\", State=\"Stopped\")\n# services = c.Win32_Service()\n# for s in services:\n# print(s)\n\n# Programas que iniciam com o Windows\nfor s in c.Win32_StartupCommand ():\n print(\"[%s] %s <%s>\" % (s.Location, s.Caption, s.Command)) \n\n# Mostra os discos e suas caracteristicas\n# for discos in c.Win32_LogicalDisk():\n# print(discos)\n\n# Mostra dados do Computador\n# for computador in c.Win32_ComputerSystem():\n# print(computador)\n\n# Mostra placas de rede\n# wql = \"SELECT IPAddress FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = 'True'\"\n# wql = \"SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = 'True'\"\n# wql = \"SELECT * FROM Win32_NetworkAdapterConfiguration\"\n\n# for placa in c.query(wql):\n# print(placa)\n\n\n# for s in c.Win32_Service(StartMode=\"Auto\", State=\"Stopped\"):\n# if input(\"Restart %s? \" % s.Caption).upper() == \"Y\":\n# s.StartService()" }, { "alpha_fraction": 0.71856290102005, "alphanum_fraction": 0.742514967918396, "avg_line_length": 23, "blob_id": "cccaf5b4a43bb93edb9861e9cdc8b461b55863b8", "content_id": "4313f256e6287e6a68e60bfdfc16b0111f6b100b", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "INI", "length_bytes": 168, "license_type": "no_license", "max_line_length": 42, "num_lines": 7, "path": "/e-mail/backup.ini", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "[backup]\n# conexão com o servidor\nsmtp_ssl_host = 1linha.com.br\nsmtp_ssl_port = 587\n# username ou email para logar no servidor\nusername = backup@1linha.com.br\npassword = i!DZY8o3tk[m" }, { "alpha_fraction": 0.6548672318458557, "alphanum_fraction": 0.732300877571106, "avg_line_length": 36.58333206176758, "blob_id": "a47c12a95771a6d73ceb627087691abc25ee3043", "content_id": "c79e8c74b111e447e314c8903b56d2424c711a24", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 452, "license_type": "no_license", "max_line_length": 85, "num_lines": 12, "path": "/mapas/ve-rotas-001.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "from pyroutelib3 import Router # Import the router\nrouter = Router(\"car\") # Initialise it\n\nstart = router.findNode(lat=-15.80423, lon=-47.9526007) # Find start and end nodes\nend = router.findNode(lat=-15.8055607, lon=-47.9515105)\n\nstatus, route = router.doRoute(start, end) # Find the route - a list of OSM nodes\nprint(status)\nprint(route)\n\nif status == 'success':\n routeLatLons = list(map(router.nodeLatLon, route)) # Get actual route coordinates\n\n" }, { "alpha_fraction": 0.6349834203720093, "alphanum_fraction": 0.6397076845169067, "avg_line_length": 40.62520980834961, "blob_id": "a7c549df937eb9eb643367fe17877f5895873a45", "content_id": "690d33164e21737ad0cd20fc9f72fbf8112bafda", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 24768, "license_type": "no_license", "max_line_length": 117, "num_lines": 595, "path": "/PQt5-Stock/Controlador/pCliente.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom Modelo.cliente import Cliente\nfrom Componentes.tableModel import MyTableModel\nfrom PyQt5.QtWidgets import QTableView, QAbstractItemView\nfrom Conexion.conexionCliente import conexionCliente\nfrom Modelo.direccion import Direccion\nfrom Conexion.conexionTelefono import conexionTelefono\nfrom Modelo.telefono import Telefono\nfrom PyQt5.QtWidgets import QMessageBox, QDialog\nfrom PyQt5.QtWidgets import QTableWidgetItem\n\nclass PestaniaCliente():\n\n def __init__(self, winPrincipal):\n self.winPrincipal = winPrincipal\n self.cliente = Cliente()\n self.conexionCliente = conexionCliente()\n self.conexionTelefono = conexionTelefono()\n\n self.listTelefonosInit = []\n\n self.estado = \"\"\n self.direccion = Direccion()\n\n self.configInit()\n\n\n def configInit(self):\n #Configurando botones Generales\n self.winPrincipal.btnAgregar_c.clicked.connect(self.onClickAgregar_c)\n self.winPrincipal.btnGuardar_c.clicked.connect(self.onClickGuardar_c)\n self.winPrincipal.btnBorrar_c.clicked.connect(self.onClickBorrar_c)\n self.winPrincipal.btnModificar_c.clicked.connect(self.onClickModificar_c)\n\n #Configurando botones ABM telefono\n self.winPrincipal.btnSumarTelefono_c.clicked.connect(self.onClickSumarTelefono)\n self.winPrincipal.btnRestarTelefono_c.clicked.connect(self.onClickRestarTelefono)\n self.winPrincipal.btnCancelarTelefono_c.clicked.connect(self.onClickCancelarTelefono)\n self.winPrincipal.btnCancelarTelefono_c.setVisible(False)\n self.winPrincipal.btnRestarTelefono_c.setEnabled(False)\n\n #configurando botones tipo telefono\n self.winPrincipal.btnTelefono_c.clicked.connect(self.onClickTelefono)\n self.winPrincipal.btnCelular_c.clicked.connect(self.onClickCelular)\n self.winPrincipal.btnFax_c.clicked.connect(self.onClickFax)\n\n\n self.winPrincipal.txtFilterClientes_c.returnPressed.connect(self.search)\n\n #Seteando model y propiedades a la tabla\n self.winPrincipal.tvClientes_c.setSortingEnabled(True)\n self.winPrincipal.tvClientes_c.setMouseTracking(True)\n self.winPrincipal.tvClientes_c.setSelectionBehavior(QAbstractItemView.SelectRows)\n\n\n #Seteando proiedades de la tabla telefono\n self.winPrincipal.tvTelefonos_c.setSortingEnabled(True)\n self.winPrincipal.tvTelefonos_c.setMouseTracking(True)\n self.winPrincipal.tvTelefonos_c.setSelectionBehavior(QAbstractItemView.SelectRows)\n\n self.winPrincipal.txtFilterClientes_c.setFocus(True)\n\n def finish(self):\n self.winPrincipal.btnAgregar_c.disconnect()\n self.winPrincipal.btnBorrar_c.disconnect()\n self.winPrincipal.btnModificar_c.disconnect()\n self.winPrincipal.btnGuardar_c.disconnect()\n\n self.winPrincipal.btnCancelarTelefono_c.disconnect()\n self.winPrincipal.btnSumarTelefono_c.disconnect()\n self.winPrincipal.btnRestarTelefono_c.disconnect()\n\n self.winPrincipal.btnCelular_c.disconnect()\n self.winPrincipal.btnFax_c.disconnect()\n self.winPrincipal.btnTelefono_c.disconnect()\n\n self.winPrincipal.tvTelefonos_c.disconnect()\n self.winPrincipal.tvClientes_c.disconnect()\n\n\n def search(self):\n if self.winPrincipal.txtFilterClientes_c.hasFocus() is True:\n self.cargarTabla()\n\n\n def onClickAgregar_c(self):\n self.estado = 'AGREGAR'\n self.validarBotones(button='AGREGAR')\n\n\n def onClickGuardar_c(self):\n validar = self.validar()\n\n if validar != \"\":\n print(validar)\n alert = QDialog()\n QMessageBox.information(alert,\"ERROR\", validar)\n else:\n self.cliente.setApellido(self.winPrincipal.txtApellido_c.text())\n self.cliente.setNombre(self.winPrincipal.txtNombre_c.text())\n self.direccion.setDireccion(self.winPrincipal.txtDireccion_c.text())\n self.cliente.setEmail(self.winPrincipal.txtEmail_c.text())\n\n if self.winPrincipal.txtDDpto_c.text() != \"\":\n self.direccion.setDpto(str(self.winPrincipal.txtDDpto_c.text()))\n else:\n self.direccion.setDpto(\"\")\n if self.winPrincipal.txtDNumero_c.text() != \"\":\n self.direccion.setNumero(int(self.winPrincipal.txtDNumero_c.text()))\n else:\n self.direccion.setNumero(0)\n if self.winPrincipal.txtDPiso_c.text() != \"\":\n self.direccion.setPiso(int(self.winPrincipal.txtDPiso_c.text()))\n else:\n self.direccion.setPiso(0)\n self.cliente.setDireccion(self.direccion)\n\n if self.winPrincipal.cbEstado_c.currentText() == 'ACTIVO':\n self.cliente.setEstado(1)\n else:\n self.cliente.setEstado(0)\n\n if self.estado == 'AGREGAR':\n self.insertCliente()\n self.insertTelefono()\n elif self.estado == 'MODIFICAR':\n self.modificarCliente()\n self.updateTelefono()\n\n self.validarBotones(button='GUARDAR')\n\n\n def onClickModificar_c(self):\n self.estado = 'MODIFICAR'\n self.validarBotones(button='MODIFICAR')\n\n\n def onClickBorrar_c(self):\n if self.winPrincipal.btnGuardar_c.isEnabled() != True:\n self.conexionCliente.borrarCliente(self.cliente)\n self.cargarTabla()\n\n self.validarBotones(button='BORRAR')\n\n\n def cargarTabla(self):\n parameter = self.winPrincipal.txtFilterClientes_c.text()\n typeParameter = ''\n\n if self.winPrincipal.cbFilterClientes_c.currentText() == 'Apellido':\n typeParameter = 'cli.apellido'\n else:\n typeParameter = 'p.nombre'\n\n parameterState = 1\n if self.winPrincipal.cbInactivo_c.isChecked() is True:\n parameterState = 0\n\n listaClientes = self.conexionCliente.selectCliente(typeParameter, parameter, parameterState)\n\n if len(listaClientes) > 0:\n header = ['ID','Apellido','Nombre','Email','Direccion', 'N°', 'Piso', 'Dpto', 'iddir', 'idper', 'Estado']\n self.tablaModel = MyTableModel(self.winPrincipal.tvClientes_c, listaClientes, header)\n self.winPrincipal.tvClientes_c.setModel(self.tablaModel)\n self.winPrincipal.tvClientes_c.selectionModel().currentChanged.connect(self.changeSelectedTable)\n\n\n self.winPrincipal.tvClientes_c.setColumnHidden(0, True)\n self.winPrincipal.tvClientes_c.setColumnWidth(1, 208)\n self.winPrincipal.tvClientes_c.setColumnWidth(2, 220)\n self.winPrincipal.tvClientes_c.setColumnWidth(3, 280)\n self.winPrincipal.tvClientes_c.setColumnWidth(4, 364)\n self.winPrincipal.tvClientes_c.setColumnWidth(5, 50)\n self.winPrincipal.tvClientes_c.setColumnHidden(6, True)\n self.winPrincipal.tvClientes_c.setColumnHidden(7, True)\n self.winPrincipal.tvClientes_c.setColumnHidden(8, True)\n self.winPrincipal.tvClientes_c.setColumnHidden(9, True)\n self.winPrincipal.tvClientes_c.setColumnHidden(10, True)\n else:\n self.winPrincipal.tvClientes_c.setModel(None)\n\n\n def changeSelectedTable(self, selected, deselected):\n\n clienteList = selected.model().mylist\n clienteSelected = clienteList[selected.row()]\n self.cliente = Cliente()\n self.direccion = Direccion()\n self.cliente.setIdCliente(int(clienteSelected[0]))\n self.cliente.setApellido(clienteSelected[1])\n self.cliente.setNombre(clienteSelected[2])\n self.cliente.setEmail(clienteSelected[3])\n self.direccion = Direccion()\n self.direccion.setDireccion(clienteSelected[4])\n\n if clienteSelected[5] != None:\n self.direccion.setNumero(int(clienteSelected[5]))\n\n if clienteSelected[6] != None:\n self.direccion.setPiso(int(clienteSelected[6]))\n\n if clienteSelected[7] != None:\n self.direccion.setDpto(clienteSelected[7])\n\n self.direccion.setIdDireccion(int(clienteSelected[8]))\n self.cliente.setDireccion(self.direccion)\n\n self.cliente.setIdPersona(clienteSelected[9])\n\n self.winPrincipal.tvClientes_c.setRowHeight(deselected.row(), 28)\n self.winPrincipal.tvClientes_c.setRowHeight(selected.row(), 45)\n\n self.cliente.setEstado(int(clienteSelected[10]))\n\n self.setCampos()\n self.winPrincipal.btnModificar_c.setEnabled(True)\n self.winPrincipal.btnBorrar_c.setEnabled(True)\n self.winPrincipal.tvTelefonos_c.setModel(None)\n self.cargarTablaTelefono()\n\n\n def validarBotones(self, button):\n if button == 'AGREGAR' :\n self.winPrincipal.wDatosCliente.setEnabled(True)\n self.winPrincipal.btnBorrar_c.setEnabled(True)\n self.winPrincipal.btnBorrar_c.setText('CANCELAR')\n self.winPrincipal.btnGuardar_c.setEnabled(True)\n self.winPrincipal.btnModificar_c.setEnabled(False)\n self.winPrincipal.btnAgregar_c.setEnabled(False)\n self.winPrincipal.tvClientes_c.setEnabled(False)\n self.limpiarCampos()\n\n elif button=='GUARDAR':\n self.winPrincipal.btnModificar_c.setEnabled(False)\n self.winPrincipal.btnAgregar_c.setEnabled(True)\n self.winPrincipal.btnGuardar_c.setEnabled(False)\n self.winPrincipal.btnBorrar_c.setText('BORRAR')\n self.winPrincipal.btnBorrar_c.setEnabled(False)\n self.winPrincipal.tvClientes_c.setEnabled(True)\n self.winPrincipal.wDatosCliente.setEnabled(False)\n self.limpiarCampos()\n\n elif button == 'MODIFICAR':\n self.winPrincipal.btnModificar_c.setEnabled(False)\n self.winPrincipal.btnAgregar_c.setEnabled(False)\n self.winPrincipal.btnGuardar_c.setEnabled(True)\n self.winPrincipal.btnBorrar_c.setText('Cancelar')\n self.winPrincipal.btnBorrar_c.setEnabled(True)\n self.winPrincipal.tvClientes_c.setEnabled(False)\n self.winPrincipal.wDatosCliente.setEnabled(True)\n\n elif button=='BORRAR':\n self.winPrincipal.btnModificar_c.setEnabled(False)\n self.winPrincipal.btnAgregar_c.setEnabled(True)\n self.winPrincipal.btnGuardar_c.setEnabled(False)\n self.winPrincipal.btnBorrar_c.setText('BORRAR')\n self.winPrincipal.btnBorrar_c.setEnabled(False)\n self.winPrincipal.tvClientes_c.setEnabled(True)\n self.winPrincipal.wDatosCliente.setEnabled(False)\n self.limpiarCampos()\n\n\n def insertCliente(self):\n if self.cliente.getApellido() != '':\n self.conexionCliente.insertarCliente(cliente=self.cliente)\n self.cargarTabla()\n\n\n def modificarCliente(self):\n self.conexionCliente.modificarCliente(self.cliente)\n self.cargarTabla()\n\n\n def limpiarCampos(self):\n self.winPrincipal.txtApellido_c.setText('')\n self.winPrincipal.txtNombre_c.setText('')\n self.winPrincipal.txtDireccion_c.setText('')\n self.winPrincipal.txtDNumero_c.setText('')\n self.winPrincipal.txtDPiso_c.setText('')\n self.winPrincipal.txtDDpto_c.setText('')\n self.winPrincipal.txtEmail_c.setText('')\n self.winPrincipal.tvTelefonos_c.setModel(None)\n self.winPrincipal.cbEstado_c.setCurrentIndex(0)\n self.winPrincipal.txtFilterClientes_c.setText('')\n self.winPrincipal.tvClientes_c.setModel(None)\n\n self.winPrincipal.txtFilterClientes_c.setFocus(True)\n\n\n def setCampos(self):\n self.winPrincipal.txtApellido_c.setText(self.cliente.getApellido())\n self.winPrincipal.txtNombre_c.setText(self.cliente.getNombre())\n self.winPrincipal.txtEmail_c.setText(self.cliente.getEmail())\n\n self.winPrincipal.txtDireccion_c.setText(self.cliente.getDireccion().getDireccion())\n \n if self.cliente.getDireccion().getNumero() != None:\n self.winPrincipal.txtDNumero_c.setText(str(self.cliente.getDireccion().getNumero()))\n else:\n self.winPrincipal.txtDNumero_c.setText('') \n \n if self.cliente.getDireccion().getPiso() != None:\n self.winPrincipal.txtDPiso_c.setText(str(self.cliente.getDireccion().getPiso()))\n else:\n self.winPrincipal.txtDPiso_c.setText('')\n\n if self.cliente.getDireccion().getDpto() != None:\n self.winPrincipal.txtDDpto_c.setText(self.cliente.getDireccion().getDpto())\n else:\n self.winPrincipal.txtDDpto_c.setText('')\n\n if self.cliente.getEstado() == 1:\n self.winPrincipal.cbEstado_c.setCurrentIndex(0)\n else:\n self.winPrincipal.cbEstado_c.setCurrentIndex(1)\n\n def validar(self):\n mensaje = ''\n if self.winPrincipal.txtNombre_c.text() == '':\n mensaje = \"Falta ingresar un Nombre\"\n elif self.winPrincipal.txtApellido_c.text() == '':\n mensaje = \"Falta ingresar Apellido\"\n elif self.winPrincipal.txtDireccion_c.text() == '':\n mensaje = \"Falta ingresar una Direccion\"\n elif self.winPrincipal.txtDNumero_c.text() == '':\n mensaje = \"Falta ingresar un N° de Direccion\"\n\n return mensaje\n\n\n def cargarTablaTelefono(self):\n self.listTelefonosInit = self.conexionTelefono.selectTelefono(self.cliente)\n if len(self.listTelefonosInit) >0:\n header = ['ID', 'Numero', 'TIPO']\n tableModel = MyTableModel(self.winPrincipal, self.listTelefonosInit, header)\n self.winPrincipal.tvTelefonos_c.setModel(tableModel)\n self.winPrincipal.tvTelefonos_c.selectionModel().currentChanged.connect(self.changeSelectedTableTel)\n\n self.winPrincipal.tvTelefonos_c.setColumnHidden(0, True)\n self.winPrincipal.tvTelefonos_c.setColumnWidth(1, 36)\n self.winPrincipal.tvTelefonos_c.setColumnWidth(2, 175)\n\n for r in range(0, len(self.listTelefonosInit)):\n self.winPrincipal.tvTelefonos_c.setRowHidden(r, False)\n\n\n def changeSelectedTableTel(self, selected, deselected):\n listTelefonos = selected.model().mylist\n self.telefonoSelected = ()\n self.telefonoSelected = listTelefonos[selected.row()]\n\n self.telefonoSelectedRow = selected.row()\n self.winPrincipal.txtTelefono_c.setText(str(self.telefonoSelected[2]))\n\n self.setTipoTelefono(str(self.telefonoSelected[1]))\n self.winPrincipal.btnCancelarTelefono_c.setVisible(True)\n self.winPrincipal.btnRestarTelefono_c.setEnabled(True)\n self.winPrincipal.tvTelefonos_c.setEnabled(False)\n\n self.winPrincipal.btnGuardar_c.setEnabled(False)\n self.winPrincipal.btnBorrar_c.setEnabled(False)\n\n\n def updateTelefono(self):\n\n listTelefono = []\n if self.winPrincipal.tvTelefonos_c.model() != None and \\\n len(self.winPrincipal.tvTelefonos_c.model().mylist) > 0:\n listTelefono = list(self.winPrincipal.tvTelefonos_c.model().mylist).copy()\n\n estado = ''\n telNew = Telefono()\n if len(listTelefono) > 0:\n if len(self.listTelefonosInit) > 0:\n\n listTelInit = list(self.listTelefonosInit)\n parche = (listTelefono[0][0], listTelefono[0][1], str(listTelefono[0][2]))\n listTelefono[0] = parche\n #Recorre la lista de telefono inicial\n for telInit in listTelInit:\n #recorre la lista de telefonos nueva\n for tel in listTelefono:\n telNew.setIdPersona(self.cliente.getIdPersona())\n telNew.setIdTelefono(tel[0])\n telNew.setTipo(tel[1])\n if tel[2] == \"\":\n estado = 'DEL'\n break\n else:\n telNew.setTelefono(tel[2])\n\n if tel[0] == 0:\n estado = 'INS'\n break\n\n if telInit[0] == tel[0]:\n if telInit[1] != tel[1] or telInit[2] != tel[2]:\n estado = 'UPD'\n break\n\n if estado == 'UPD':\n self.conexionTelefono.modificarTelefono(telNew)\n elif estado == \"INS\":\n self.conexionTelefono.insertarTelefono(telNew)\n elif estado == 'DEL':\n self.conexionTelefono.borrarTelefono(telNew)\n #Si la lista de telefono inicial es cero\n else:\n #recorre la lista de telefonos nueva para agregarlos a todos\n for telN in listTelefono:\n if telN[2] != '':\n telNew = Telefono()\n telNew.setIdPersona(self.cliente.getIdPersona())\n telNew.setIdTelefono(telN[0])\n telNew.setTipo(telN[1])\n telNew.setTelefono(telN[2])\n self.conexionTelefono.insertarTelefono(telNew)\n\n\n def insertTelefono(self):\n\n listTelefonosNew = []\n tel = self.winPrincipal.tvTelefonos_c.model()\n\n listTelefonosNew = list(self.winPrincipal.tvTelefonos_c.model().mylist).copy()\n\n if len(listTelefonosNew) > 0:\n self.conexionTelefono.insertTelefonoInit(listTelefonosNew)\n\n\n def onClickCancelarTelefono(self):\n self.winPrincipal.btnCancelarTelefono_c.setVisible(False)\n self.winPrincipal.txtTelefono_c.setText('')\n\n self.winPrincipal.btnRestarTelefono_c.setEnabled(False)\n self.winPrincipal.tvTelefonos_c.clearSelection()\n self.winPrincipal.tvTelefonos_c.setEnabled(True)\n\n self.winPrincipal.btnGuardar_c.setEnabled(True)\n self.winPrincipal.btnBorrar_c.setEnabled(True)\n\n\n def onClickSumarTelefono(self):\n numTelefono = self.winPrincipal.txtTelefono_c.text()\n\n if numTelefono.isdigit() == True:\n if self.winPrincipal.btnCancelarTelefono_c.isVisible() is True:\n self.updateTelefonoTabla()\n else:\n self.insertTelefonoTabla()\n\n self.winPrincipal.tvTelefonos_c.clearSelection()\n self.winPrincipal.btnRestarTelefono_c.setEnabled(False)\n self.winPrincipal.btnCancelarTelefono_c.setVisible(False)\n self.winPrincipal.txtTelefono_c.setText('')\n self.winPrincipal.tvTelefonos_c.setEnabled(True)\n\n self.winPrincipal.btnGuardar_c.setEnabled(True)\n else:\n alert = QDialog()\n QMessageBox.information(alert,\"ERROR\", \"El numero de telefono no es valido.\")\n\n\n def onClickRestarTelefono(self):\n listTabTel = []\n #listTabTel = list(self.winPrincipal.tvTelefonos_c.model().mylist).copy()\n #tipoTel = str(self.getTipoTelefono())\n listTelefonosNew = []\n\n listTabTel = list(self.winPrincipal.tvTelefonos_c.model().mylist).copy()\n\n header = ['Id', 'Tipo', 'Numero']\n telDel = [self.telefonoSelected[0], self.telefonoSelected[1], '']\n listTabTel[self.telefonoSelectedRow] = telDel\n tableTelModel = MyTableModel(self.winPrincipal, listTabTel, header)\n self.winPrincipal.tvTelefonos_c.setModel(tableTelModel)\n self.winPrincipal.tvTelefonos_c.selectionModel().currentChanged.connect(self.changeSelectedTableTel)\n self.winPrincipal.tvTelefonos_c.setRowHidden(self.telefonoSelectedRow, True)\n\n self.winPrincipal.btnCancelarTelefono_c.setVisible(False)\n self.winPrincipal.txtTelefono_c.setText('')\n self.winPrincipal.btnRestarTelefono_c.setEnabled(False)\n self.winPrincipal.tvTelefonos_c.setEnabled(True)\n\n self.winPrincipal.btnGuardar_c.setEnabled(True)\n self.winPrincipal.btnBorrar_c.setEnabled(True)\n\n\n def onClickTelefono(self):\n self.changeTipoTelefono(button='TEL')\n\n\n def onClickCelular(self):\n self.changeTipoTelefono(button='CEL')\n\n\n def onClickFax(self):\n self.changeTipoTelefono(button='FAX')\n\n\n def changeTipoTelefono(self, button):\n\n if button == 'TEL':\n self.winPrincipal.btnTelefono_c.setEnabled(False)\n self.winPrincipal.btnCelular_c.setEnabled(True)\n self.winPrincipal.btnFax_c.setEnabled(True)\n elif button == 'CEL':\n self.winPrincipal.btnTelefono_c.setEnabled(True)\n self.winPrincipal.btnCelular_c.setEnabled(False)\n self.winPrincipal.btnFax_c.setEnabled(True)\n elif button == 'FAX':\n self.winPrincipal.btnTelefono_c.setEnabled(True)\n self.winPrincipal.btnCelular_c.setEnabled(True)\n self.winPrincipal.btnFax_c.setEnabled(False)\n\n\n def setTipoTelefono(self, tipoTelefono):\n\n if tipoTelefono == 'TEL':\n self.winPrincipal.btnTelefono_c.setEnabled(False)\n self.winPrincipal.btnCelular_c.setEnabled(True)\n self.winPrincipal.btnFax_c.setEnabled(True)\n elif tipoTelefono == 'CEL':\n self.winPrincipal.btnTelefono_c.setEnabled(True)\n self.winPrincipal.btnCelular_c.setEnabled(False)\n self.winPrincipal.btnFax_c.setEnabled(True)\n elif tipoTelefono == 'FAX':\n self.winPrincipal.btnTelefono_c.setEnabled(True)\n self.winPrincipal.btnCelular_c.setEnabled(True)\n self.winPrincipal.btnFax_c.setEnabled(False)\n\n\n def getTipoTelefono(self):\n\n if self.winPrincipal.btnTelefono_c.isEnabled() != True:\n return 'TEL'\n elif self.winPrincipal.btnCelular_c.isEnabled() != True:\n return 'CEL'\n elif self.winPrincipal.btnFax_c.isEnabled() != True:\n return 'FAX'\n\n\n def insertTelefonoTabla(self):\n numTel = self.winPrincipal.txtTelefono_c.text()\n tipoTel = str(self.getTipoTelefono())\n\n modelListTelefono = self.winPrincipal.tvTelefonos_c.model()\n header = ['ID', 'Tipo', 'Numero']\n\n if modelListTelefono is not None:\n listTabTel = list(self.winPrincipal.tvTelefonos_c.model().mylist)\n\n if len(listTabTel) > 0 or listTabTel is not None:\n tuplaTel = ('0', tipoTel, numTel )\n listTabTel.append(tuplaTel)\n tupleTable = tuple(listTabTel)\n\n tableModel = MyTableModel(self.winPrincipal, tupleTable , header)\n self.winPrincipal.tvTelefonos_c.setModel(tableModel)\n self.winPrincipal.tvTelefonos_c.selectionModel().currentChanged.connect(self.changeSelectedTableTel)\n else:\n lista = []\n tuplaTel = ('0', tipoTel, numTel )\n lista.append(tuplaTel)\n\n tableModel = MyTableModel(self.winPrincipal, lista , header)\n self.winPrincipal.tvTelefonos_c.setModel(tableModel)\n self.winPrincipal.tvTelefonos_c.selectionModel().currentChanged.connect(self.changeSelectedTableTel)\n self.winPrincipal.tvTelefonos_c.setColumnHidden(0, True)\n self.winPrincipal.tvTelefonos_c.setColumnWidth(1, 36)\n self.winPrincipal.tvTelefonos_c.setColumnWidth(2, 175)\n\n\n def updateTelefonoTabla(self):\n listTabTel = []\n #listTabTel = list(self.winPrincipal.tvTelefonos_c.model().mylist).copy()\n tipoTel = str(self.getTipoTelefono())\n listTelefonosNew = []\n #prob = self.winPrincipal.tvTelefonos_c.selectionModel()\n #prob1 = self.winPrincipal.tvTelefonos_c.model()\n listTabTel = list(self.winPrincipal.tvTelefonos_c.model().mylist).copy()\n \"\"\"\n for lt in listTabTel:\n if lt[0] == self.telefonoSelected[0]:\n lt = (self.telefonoSelected[0], tipoTel, self.winPrincipal.txtTelefono_c.text())\n\n listTelefonosNew.append(lt)\n \"\"\"\n telUpd = (self.telefonoSelected[0], tipoTel, int(self.winPrincipal.txtTelefono_c.text()))\n listTabTel[self.telefonoSelectedRow] = telUpd\n header = ['ID', 'Tipo', 'Numero']\n tableModel = MyTableModel(self.winPrincipal, listTabTel , header)\n self.winPrincipal.tvTelefonos_c.setModel(tableModel)\n self.winPrincipal.tvTelefonos_c.selectionModel().currentChanged.connect(self.changeSelectedTableTel)" }, { "alpha_fraction": 0.34473684430122375, "alphanum_fraction": 0.3842105269432068, "avg_line_length": 26.14285659790039, "blob_id": "ab61b1504c474d8b3e807631675cd340c86a24cf", "content_id": "50a658bee52b2292538e5a5f4bfe4606d8ffcb10", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 380, "license_type": "no_license", "max_line_length": 54, "num_lines": 14, "path": "/potencias.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "nZero = True\n# for j in range(0, 1001):\nfor j in range(2, 3):\n print('\\n\\n\\\\section{Base ',j ,'}\\n\\n')\n for i in range(0, 100001):\n print(i)\n k = pow(j, i)\n for m in str(k):\n if m=='0':\n nZero = False;\n break;\n if (nZero==True):\n print('$', j, '^{', i, '} = ', k, '$\\\\\\\\')\n nZero = True\n" }, { "alpha_fraction": 0.5923349857330322, "alphanum_fraction": 0.594554603099823, "avg_line_length": 30.282407760620117, "blob_id": "67ddad8e73a726b2d480babbc14bf266251917ee", "content_id": "780f2c9b98ada20a08bb6a81092d4f4d7fc9f776", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 6758, "license_type": "no_license", "max_line_length": 120, "num_lines": 216, "path": "/djangosige/venv/Lib/site-packages/geraldo/cross_reference.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "\"\"\"Functions to make cross reference tables and charts on Geraldo.\"\"\"\n\ntry:\n set\nexcept:\n from sets import Set as set\n\nimport random, decimal\nfrom .utils import get_attr_value, memoize\nfrom .base import ReportBand, GeraldoObject, CROSS_COLS, CROSS_ROWS\n\nRANDOM_ROW_DEFAULT = RANDOM_COL_DEFAULT = ''.join([random.choice([chr(c) for c in range(48, 120)]) for i in range(100)])\n\nclass CrossReferenceProxy(object):\n matrix = None\n row = None\n\n def __init__(self, matrix, row):\n self.matrix = matrix\n self.row = row\n\n def __getattr__(self, name):\n if name in ('values','max','min','sum','avg','count','distinct_count',\n 'first','last','percent',):\n func = getattr(self.matrix, name)\n def _inner(cell, col=RANDOM_COL_DEFAULT):\n return func(cell, self.row, col)\n return _inner\n\n raise AttributeError()\n\n\nclass CrossReferenceMatrix(object):\n \"\"\"Encapsulates an objects list and stores the X (rows) and Y (cols) attributes to make\n cross reference matrix, or just to make the calculations required.\n \n Used by detail bands, subreports and charts, and not at all coupled to Geraldo's API.\n \n The objects from this class are iterable.\"\"\"\n\n objects_list = None\n rows_attr = None\n rows_values = None\n cols_attr = None\n cols_values = None\n decimal_as_float = False\n\n def __init__(self, objects_list, rows_attribute, cols_attribute, decimal_as_float=None,\n rows_values=None, cols_values=None):\n self.objects_list = list(objects_list) or []\n self.rows_attr = rows_attribute\n self.cols_attr = cols_attribute\n self.rows_values = rows_values\n self.cols_values = cols_values\n\n if decimal_as_float is not None:\n self.decimal_as_float = decimal_as_float\n\n def __iter__(self):\n for row in self.rows():\n yield CrossReferenceProxy(self, row)\n\n def get_attr_value(self, obj, attr):\n \"\"\"Returns the attribute value on an object, and converts decimal to float if necessary.\"\"\"\n\n value = get_attr_value(obj, attr)\n \n if isinstance(value, decimal.Decimal) and self.decimal_as_float:\n value = float(value)\n\n return value\n\n def sort_rows(self, a, b):\n return cmp(a, b)\n\n def sort_cols(self, a, b):\n return cmp(a, b)\n\n @memoize\n def rows(self):\n if self.rows_values is None:\n self.rows_values = list(set([self.get_attr_value(obj, self.rows_attr) for obj in self.objects_list]))\n\n # Sort list by method\n self.rows_values.sort(self.sort_rows)\n\n return self.rows_values\n\n @memoize\n def cols(self):\n if self.cols_values is None:\n self.cols_values = list(set([self.get_attr_value(obj, self.cols_attr) for obj in self.objects_list]))\n\n # Sort list by method\n self.cols_values.sort(self.sort_cols)\n\n return self.cols_values\n\n @memoize\n def values(self, cell, row=RANDOM_ROW_DEFAULT, col=RANDOM_COL_DEFAULT):\n \"\"\"Receives the cell, row and col values and make the cross reference among them.\"\"\"\n\n return [self.get_attr_value(obj, cell) for obj in self.objects_list\n if (row == RANDOM_ROW_DEFAULT or self.get_attr_value(obj, self.rows_attr) == row) and\n (col == RANDOM_COL_DEFAULT or self.get_attr_value(obj, self.cols_attr) == col)]\n\n @memoize\n def max(self, cell, row=RANDOM_ROW_DEFAULT, col=RANDOM_COL_DEFAULT):\n values = self.values(cell, row, col)\n return values and max(values) or None\n\n @memoize\n def min(self, cell, row=RANDOM_ROW_DEFAULT, col=RANDOM_COL_DEFAULT):\n values = self.values(cell, row, col)\n return values and min(values) or None\n\n @memoize\n def sum(self, cell, row=RANDOM_ROW_DEFAULT, col=RANDOM_COL_DEFAULT):\n return sum(self.values(cell, row, col))\n\n @memoize\n def avg(self, cell, row=RANDOM_ROW_DEFAULT, col=RANDOM_COL_DEFAULT):\n values = list(map(float, self.values(cell, row, col)))\n\n if row == RANDOM_ROW_DEFAULT and col == RANDOM_COL_DEFAULT:\n count = len(values)\n elif row == RANDOM_ROW_DEFAULT:\n count = len(self.rows())\n elif col == RANDOM_COL_DEFAULT:\n count = len(self.cols())\n else:\n count = len(self.rows()) * len(self.cols())\n\n return values and sum(values) / count or None\n\n @memoize\n def count(self, cell, row=RANDOM_ROW_DEFAULT, col=RANDOM_COL_DEFAULT):\n return len(self.values(cell, row, col))\n\n @memoize\n def distinct_count(self, cell, row=RANDOM_ROW_DEFAULT, col=RANDOM_COL_DEFAULT):\n return len(set(self.values(cell, row, col)))\n\n @memoize\n def percent(self, cell, row=RANDOM_ROW_DEFAULT, col=RANDOM_COL_DEFAULT):\n total = self.sum(cell)\n values = self.values(cell, row, col)\n return total and (sum(values) / total * 100) or None\n\n @memoize\n def first(self, cell, row=RANDOM_ROW_DEFAULT, col=RANDOM_COL_DEFAULT):\n try:\n return self.values(cell, row, col)[0]\n except IndexError:\n return None\n\n @memoize\n def last(self, cell, row=RANDOM_ROW_DEFAULT, col=RANDOM_COL_DEFAULT):\n try:\n return self.values(cell, row, col)[-1]\n except IndexError:\n return None\n\n @memoize\n def matrix(self, cell, func='values', show_rows=False, show_cols=False):\n ret = []\n\n # Show column names if argument requires\n if show_cols:\n # Show the 0,0 cell (row/column relation)\n prep = show_rows and [''] or []\n\n ret.append(prep + self.cols())\n\n func = getattr(self, func)\n\n for row in self.rows():\n # Show rows values if argument requires\n prep = show_rows and [row] or []\n ret.append(prep + [func(cell, row, col) for col in self.cols()])\n\n return ret\n\n @memoize\n def summarize_rows(self, cell, func='values', show_rows=False):\n ret = []\n\n func = getattr(self, func)\n\n for row in self.rows():\n val = func(cell, row)\n\n # Show rows values if argument requires\n if show_rows:\n ret.append([row, val])\n else:\n ret.append(val)\n\n return ret\n\n @memoize\n def summarize_cols(self, cell, func='values', show_cols=False):\n ret = []\n\n func = getattr(self, func)\n\n for col in self.cols():\n val = func(cell, col=col)\n\n # Show cols values if argument requires\n if show_cols:\n ret.append([col, val])\n else:\n ret.append(val)\n\n return ret\n\n" }, { "alpha_fraction": 0.5441224575042725, "alphanum_fraction": 0.5467274785041809, "avg_line_length": 33.11111068725586, "blob_id": "e90dc148bc63db272bbc96748f8b23de58bfb3f3", "content_id": "f463a9f82cca40a1410d365c1179ede7d8df5234", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3109, "license_type": "no_license", "max_line_length": 113, "num_lines": 90, "path": "/Hospital-Helper-2-master/app/gui/users_widget.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import functools\n\nfrom PyQt5.QtCore import Qt\nfrom PyQt5.QtWidgets import (QFrame, QVBoxLayout, QLabel, QRadioButton,\n QHBoxLayout)\n\nfrom app.model import db\nfrom app.gui import utils\n\n\nclass UsersWidget(QFrame):\n\n \"\"\"\n Widget for selecting and creating Users.\n \"\"\"\n\n ACTION_BTN_ICON = 'check'\n\n def __init__(self, main_window):\n\n super().__init__()\n\n self.main_window = main_window\n\n self.content_layout = QVBoxLayout()\n self._update_content()\n\n vbox = QVBoxLayout()\n vbox.addWidget(utils.get_scrollable(self.content_layout))\n\n hbox = QHBoxLayout()\n hbox.addStretch(25)\n hbox.addLayout(vbox, stretch=50)\n hbox.addStretch(25)\n self.setLayout(hbox)\n self.showEvent = self._get_show_event(main_window)\n self.setGraphicsEffect(utils.get_shadow())\n\n def _get_show_event(self, main_window):\n def _show_event(event=None):\n main_window.communication.action_button_toggle.emit(True,\n 'plus',\n functools.partial(main_window.create_crud_widget,\n db.User,\n self._update_content))\n return _show_event\n\n def _update_content(self, *args):\n \"\"\"\n If new user or organization were created, update content.\n \"\"\"\n\n utils.clear_layout(self.content_layout)\n self.users = list(db.SESSION.query(db.User).filter(db.User.deleted == False,\n db.Organization.deleted == False))\n organizations = list(db.SESSION.query(db.Organization).filter(db.Organization.deleted == False))\n\n for organization in organizations:\n self.content_layout.addWidget(self._get_label(organization))\n for user in self.users:\n if user.organization_id == organization.id:\n self.content_layout.addWidget(self._get_radio_btn(user))\n\n if not self.users:\n # l = QLabel('Создайте пользователей\\nдля начала работы')\n l = QLabel('Crie usuários\\npara começar')\n l.setAlignment(Qt.AlignCenter)\n self.content_layout.addWidget(l)\n self.content_layout.addStretch()\n\n def _get_radio_btn(self, item):\n fullname = '{} {} {}'.format(item.surname, item.name, item.patronymic)\n b = QRadioButton(fullname)\n b.mouseDoubleClickEvent = (functools.partial(self._button_clicked, item))\n return b\n\n @staticmethod\n def _get_label(item):\n \"\"\"\n Add label for organization.\n \"\"\"\n l = QLabel(item.name)\n l.setObjectName(str(item.id))\n return l\n\n def _button_clicked(self, user, event):\n \"\"\"\n Select user.\n \"\"\"\n self.main_window.user_selected(user, go_to_data_frame=True)\n\n" }, { "alpha_fraction": 0.537422776222229, "alphanum_fraction": 0.5993362069129944, "avg_line_length": 26.130434036254883, "blob_id": "eb3b46339a2e115d74ba6edd45d28f9849d2d015", "content_id": "9dbed068aba44ec7609cf962baad4b2fa39af2c3", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 8738, "license_type": "no_license", "max_line_length": 163, "num_lines": 322, "path": "/opencv/Augumented_Reality-master/opengl with blender/pathFinder.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "'''\n* Team Id : 71\n* Author List : Ravi, Sujit,raj\n* Filename: echo.py\n*Functions:adjacent_nodes,next_direction,Pos,findNodes,long\n* Theme: Thirsty Crow\n* Global Variables: traversal_nodes,arena\n'''\n \narena=[[0,0,0,0,0,1,1,0,0,0,0,0],\n\t\t [0,0,0,1,1,0,0,1,1,0,0,0],\n\t\t [0,1,1,0,0,1,1,0,0,1,1,0],\n\t\t [1,0,0,1,1,0,0,1,1,0,0,1],\n\t\t [0,1,1,0,0,1,1,0,0,1,1,0],\n\t\t [1,0,0,1,1,0,0,1,1,0,0,1],\n\t\t [0,1,1,0,0,1,1,0,0,1,1,0],\n\t\t [1,0,0,1,1,0,0,1,1,0,0,1],\n\t\t [0,1,1,0,0,1,1,0,0,1,1,0],\n\t\t [0,0,0,1,1,0,0,1,1,0,0,0],\n\t\t [0,0,0,0,0,1,1,0,0,0,0,0]]\ntraversal_nodes=[]\n\n\"\"\"\nFunction Name : adjacent_nodes()\nInput: cell no-x , and axis- axiss\nOutput: nearby coordinates\nPurpose: search all the coordnates of the cell and returns the coordinates related to the axis. example: if x is 2 and axiss is 2 , the it will return (1,3),(3,4)\n\"\"\"\ndef adjacent_nodes(x,axiss):\n\txy=[[0,0],[0,0]]\n\tif axiss==1:\n\t\txy[0][0]=x[0]\n\t\txy[0][1]=x[1]\n\t\txy[1][0]=x[0]\n\t\txy[1][1]=x[1]+3\n\tif axiss==2:\n\t\txy[0][0]=x[0]-1\n\t\txy[0][1]=x[1]+1\n\t\txy[1][0]=xy[0][0]+2\n\t\txy[1][1]=xy[0][1]+1\n\tif axiss==3:\n\t\txy[0][0]=x[0]-1\n\t\txy[0][1]=x[1]+2\n\t\txy[1][0]=xy[0][0]+2\n\t\txy[1][1]=xy[0][1]-1\n\t\t\n\treturn xy\n\n\"\"\"\nFunction Name : next_direction()\nInput: row/column no. of nodes\nOutput: direction , 0- upperdiagnal , 1= lower diagnal, 2=horizontal\nPurpose: using Greedy algorithm , it searches for next shortest path\n\"\"\"\ndef next_direction(a1,a2):\n if a1==a2:\n\t return \"2\"\n elif a1>a2:\n\t return \"0\"\n else:\n\t return \"1\"\n\n\"\"\"\nFunction Name : next_position()\nInput: starting point-(si,sj) and final point- f\nOutput: return the next move \nPurpose: using Greedy algorithm , it searches for next shortest path\n\"\"\"\ndef next_position(si,sj,f):\n a=next_direction(si,f[0])\n b=next_direction(sj,f[1])\n return a+b\n\n\n\"\"\"\nFunction Name : priority()\nInput: cellNumber , flag\nOutput: returns the priority number from the 1-5 \nPurpose: by assigining the priority number to each of the pebbles , to set the order of traversing pebble\n\"\"\"\ndef priority(cellNumber,flag):\n\tif cellNumber==5 or cellNumber==10 or cellNumber==15:\n\t\treturn abs(1-flag)\n\tif cellNumber==2 or cellNumber==6 or cellNumber==11 or cellNumber==16:\n\t\treturn abs(2-flag)\n\tif cellNumber==4 or cellNumber==8 or cellNumber==13 or cellNumber==18:\n\t\treturn abs(4-flag)\n\tif cellNumber==9 or cellNumber==14 or cellNumber==19:\n\t\treturn abs(5-flag)\n\telse:\n\t\treturn 3\n\n\t\n\n\"\"\"\nFunction Name : findNodes()\nInput: current row and column value of robot\nOutput: next current row and column value of robot\nPurpose: recursion method to find next path\n\"\"\"\ndef findNodes(i,j,f):\n global traversal_nodes\n traversal_nodes.append([i,j])\n \n if pow(i-f[0],2) + pow(j-f[1],2)<=2:\n\t traversal_nodes.append(f)\n\t return \n\n position=next_position(i,j,f)\n \n if position==\"01\":\n\t if arena[i-1][j+1]:\n\t\t findNodes(i-1,j+1,f)\n\t else:\n\t\t findNodes(i,j+1,f)\n\n elif position==\"21\":\n\t if arena[i][j+1]:\n\t\t findNodes(i,j+1,f)\n\t else:\n\t\t findNodes(i-1,j+1,f)\n\n elif position==\"11\":\n\t if arena[i+1][j+1]:\n\t\t findNodes(i+1,j+1,f)\n\t else:\n\t\t findNodes(i,j+1,f)\n\n elif position==\"12\":\n\t if j==0 or arena[i+1][j+1]:\n\t\t findNodes(i+1,j+1,f)\n\t else:\n\t\t findNodes(i+1,j-1,f)\n\n elif position==\"10\":\n\t if arena[i+1][j-1]:\n\t\t findNodes(i+1,j-1,f)\n\t else:\n\t\t findNodes(i,j-1,f)\n\n elif position==\"20\":\n\t if arena[i][j-1]:\n\t\t findNodes(i,j-1,f)\n\t else:\n\t\t findNodes(i-1,j-1,f)\n\n elif position==\"00\":\n\t if arena[i-1][j-1]:\n\t\t findNodes(i-1,j-1,f)\n\t else:\n\t\t findNodes(i,j-1,f)\n\n else:\n\t if j==0 or arena[i-1][j+1]:\n\t\t findNodes(i-1,j+1,f)\n\t else:\n\t\t findNodes(i-1,j-1,f)\n\n \n return\n\"\"\"\nFunction Name : findPath()\nInput: area_config,Robot_Start\nOutput: paths , Id of pebbles\nPurpose: 1. split the given input in ids, cells, axis\n 2. sort the pebbles data according the priority\n 3. make the string from start to end position\n L=LEFT\n R=RIGHT\n B=BUZZER\n P= 120DEGREE LEFT\n Q= 120DEGREE RIGHT\n E= END OF THE STRING\n\n 4. reeturn the string \"paths\"\n\"\"\"\n\ndef findPath(area_config,Robot_Start):\n\tinitial_nodes=[[1,4],[2,2],[3,4],[2,6],[3,0],[4,2],[5,4],[4,6],[3,8],[5,0],[6,2],[7,4],[6,6],[5,8],[7,0],[8,2],[9,4],[8,6],[7,8]]\n\tpaths= \"\"\n\twaterPitcher=[]\n\tids=[]\n\tcells=[]\n\taxis=[]\n\tstart_point=[]\n\tpebble=[]\n\tflag=1\n\tj=0\n\tcounterarray=[]\n\tif Robot_Start==\"START-1\":\n\t\tflag=0\n\telse:\n\t\tflag=6\n\tcounterarray=[]\n\tfor k in area_config:\n\t\tv=area_config[k]\n\t\tif k==0:\n\t\t\twaterPitcher.append([k,v[1],int(v[2].split(\"-\")[0])])\n\t\t\tcontinue\n\t\tpebble.append([k,v[1],int(v[2].split(\"-\")[0]),priority(v[1],flag)])\n\n\t\t\n\tpebble.sort(key=lambda x:x[3])\n\tfor i in range(0,len(pebble)):\n\t\tids.insert(j,pebble[i][0])\n\t\tcells.insert(j,pebble[i][1])\n\t\taxis.insert(j,pebble[i][2])\n\t\tids.insert(j+1,waterPitcher[0][0])\n\t\tcells.insert(j+1,waterPitcher[0][1])\n\t\taxis.insert(j+1,waterPitcher[0][2])\n\t\tj=j+2\n\tif Robot_Start==\"START-1\":\n\t\tx=5;y=0\n\t\tstart_point=[x,y]\n\t\tprevious_node=[x,y-1]\n\telse:\n\t\tx=5;y=11\n\t\tstart_point=[x,y]\n\t\tprevious_node=[x,y+1]\n\n\t\t\n\tj=0;\n\tfor i in range(0,len(ids)):\n\t axis_nodes=adjacent_nodes(initial_nodes[cells[i]-1],axis[i])\n\t su1=abs(start_point[0]-axis_nodes[0][0])+abs(start_point[1]-axis_nodes[0][1])\n\t su2=abs(start_point[0]-axis_nodes[1][0])+abs(start_point[1]-axis_nodes[1][1])\n\t if su1<su2:\n\t\t destination_node=[axis_nodes[0][0],axis_nodes[0][1]]\n\t\t j=j+1\n\t\t counterarray.insert(j,axis_nodes[1])\n\t else:\n\t\t destination_node=[axis_nodes[1][0],axis_nodes[1][1]]\n\t\t j=j+1\n\t\t counterarray.insert(j,axis_nodes[0])\n\t findNodes(start_point[0],start_point[1],destination_node)\n\t start_point=destination_node\n\ttraversal_nodes.append(traversal_nodes[-1])\n\tz=-1\n\tfor i in range(0,len(traversal_nodes)-1):\n\t\tcurrent_node=traversal_nodes[i];next_nodes=traversal_nodes[i+1]\n\t\tif current_node==next_nodes:\n\t\t\tz=z+1\n\t\t\t############################################\n\t\t\tif current_node[0]+1 == previous_node[0] and current_node[1]-1 == previous_node[1]: #1\n\t\t\t\tif counterarray[z][0]==current_node[0]:\n\t\t\t\t\tpaths=paths + 'P'\n\t\t\t\telif counterarray[z][0] >current_node[0]:\n\t\t\t\t\tpaths=paths + 'Q'\n\t\t\t\t\n\t\t\tif current_node[0]+1 == previous_node[0] and current_node[1]+1 == previous_node[1]: #4\n\t\t\t\tif counterarray[z][0]>current_node[0]:\n\t\t\t\t\tpaths=paths + 'P'\n\t\t\t\telif counterarray[z][0]==current_node[0]:\n\t\t\t\t\tpaths=paths + 'Q'\n\t\t\tif current_node[0]-1 == previous_node[0] and current_node[1]-1 == previous_node[1]: #2\n\t\t\t\tif counterarray[z][0] < current_node[0]:\n\t\t\t\t\tpaths=paths + 'P'\n\t\t\t\telif counterarray[z][0]==current_node[0]:\n\t\t\t\t\tpaths=paths + 'Q'\n\t\t\tif current_node[0]-1 == previous_node[0] and current_node[1]+1 == previous_node[1]: #5\n\t\t\t\tif counterarray[z][0]==current_node[0]:\n\t\t\t\t\tpaths=paths + 'P'\n\t\t\t\telif counterarray[z][0] < current_node[0]:\n\t\t\t\t\tpaths=paths + 'Q'\n\t\t\tif current_node[0] == previous_node[0] and current_node[1]-1 == previous_node[1]: #3\n\t\t\t\tif counterarray[z][0] < current_node[0]:\n\t\t\t\t\tpaths=paths + 'P'\n\t\t\t\telif counterarray[z][0] > current_node[0]:\n\t\t\t\t\tpaths=paths + 'Q'\n\t\t\tif current_node[0] == previous_node[0] and current_node[1]+1 == previous_node[1]: #6\n\t\t\t\tif counterarray[z][0] > current_node[0]:\n\t\t\t\t\tpaths=paths + 'P'\n\t\t\t\telif counterarray[z][0] < current_node[0]:\n\t\t\t\t\tpaths=paths + 'Q'\n\n\n\t\t\t###################################################\n\t\t\tpaths=paths+'B'\n\t\t\tcurrent_node=next_nodes\n\t\t\tif i>(len(traversal_nodes)-3):\n\t\t\t\tbreak\n\t\t\tnext_nodes=traversal_nodes[i+2]\n\t\t\t\n\t\t\n\t\tif next_nodes==previous_node:\n\t\t\tpaths=paths+'H'\n\t\t\tprevious_node=current_node\n\t\t\tcontinue\n\t\tif current_node[0]+1 == previous_node[0] and current_node[1]-1 == previous_node[1]: #1\n\t\t\tif current_node[0]==next_nodes[0]:\n\t\t\t\tpaths=paths+'R'\n\t\t\telse:\n\t\t\t\tpaths=paths+'L'\n\t\tif current_node[0]+1 == previous_node[0] and current_node[1]+1 == previous_node[1]: #4\n\t\t\tif current_node[0]==next_nodes[0]:\n\t\t\t\tpaths=paths+'L'\n\t\t\telse:\n\t\t\t\tpaths=paths+'R'\n\t\tif current_node[0]-1 == previous_node[0] and current_node[1]-1 == previous_node[1]: #2\n\t\t\tif current_node[0]==next_nodes[0]:\n\t\t\t\tpaths=paths+'L'\n\t\t\telse:\n\t\t\t\tpaths=paths+'R'\n\t\tif current_node[0]-1 == previous_node[0] and current_node[1]+1 == previous_node[1]: #5\n\t\t\tif current_node[0]==next_nodes[0]:\n\t\t\t\tpaths=paths+'R'\n\t\t\telse:\n\t\t\t\tpaths=paths+'L'\n\t\tif current_node[0] == previous_node[0] and current_node[1]-1 == previous_node[1]: #3\n\t\t\tif current_node[0]>next_nodes[0]:\n\t\t\t\tpaths=paths+'L'\n\t\t\telse:\n\t\t\t\tpaths=paths+'R'\n\t\tif current_node[0] == previous_node[0] and current_node[1]+1 == previous_node[1]: #6\n\t\t\tif current_node[0]>next_nodes[0]:\n\t\t\t\tpaths=paths+'R'\n\t\t\telse:\n\t\t\t\tpaths=paths+'L'\n\t\tprevious_node=current_node\n\t\n\tpaths=paths+\"E\"\n\treturn paths\n\n\n" }, { "alpha_fraction": 0.5994914174079895, "alphanum_fraction": 0.6058486700057983, "avg_line_length": 29.843137741088867, "blob_id": "2ce44468469954b727f5129f88e4f4ff66c0e68a", "content_id": "6950a958c4a5b4664d799f28f2694706966dc43d", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1573, "license_type": "no_license", "max_line_length": 90, "num_lines": 51, "path": "/fullcontrol_001/baixa-livro-packet.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#coding: utf-8\nfrom time import sleep\nfrom bs4 import BeautifulSoup\nfrom selenium import webdriver\nfrom sys import argv\n\n\nclass Pagina(object):\n def __init__(self, driver):\n self.driver = driver\n self.url = \"https://www.packtpub.com/packt/offers/free-learning?from=block\"\n self.sing_in = \"/html/body/div[7]/div[2]/div[1]/div[1]/div/div[1]/div[4]/a[1]/div\"\n self.username = 'email'\n self.password = 'password'\n self.botao_login = 'edit-submit-1'\n self.botao_dowload = '//*[@id=\"free-learning-claim\"]'\n\n def navegar(self):\n self.driver.get(self.url)\n\n def login(self, _email=\"None\", _senha=\"None\"):\n self.driver.find_element_by_xpath(self.sing_in).click()\n\n for tentativa_email in self.driver.find_elements_by_id(self.username):\n try:\n tentativa_email.send_keys(_email)\n except:\n pass\n\n for tentavia_senha in self.driver.find_elements_by_id(self.password):\n try:\n tentavia_senha.send_keys(_senha)\n except:\n pass\n\n for click_botao in self.driver.find_elements_by_id(self.botao_login):\n try:\n click_botao.click()\n except:\n pass\n\n self.driver.find_element_by_xpath(self.botao_dowload).click()\n\n\nemail_pessoa = input(\"Digite seu email: \")\nsenha_pessoa = input(\"Digite sua senha: \")\n\nnavegador = webdriver.Firefox()\npegar_livro = Pagina(navegador)\npegar_livro.navegar()\npegar_livro.login(email_pessoa, senha_pessoa)\n" }, { "alpha_fraction": 0.5523529648780823, "alphanum_fraction": 0.5611764788627625, "avg_line_length": 24.75757598876953, "blob_id": "388498087d0283ecd9dc93323b90feacbf3d8bf0", "content_id": "2717954474a8c9bf04f7602e93167ba9536bb41c", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1700, "license_type": "no_license", "max_line_length": 65, "num_lines": 66, "path": "/JPro-master/dbcreation.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import datetime\nfrom sqlalchemy import Column, Integer, String, DateTime\nfrom sqlalchemy.ext.declarative import declarative_base\nfrom sqlalchemy.orm\timport relationship\nfrom sqlalchemy import create_engine\n\nBase = declarative_base()\n\n#===##===##===##===##===##===##===#\n#MODELS TABLE \n#===##===##===##===##===##===##===#\n\nclass Models(Base):\n\t__tablename__ = 'models'\n\n\tid = Column(Integer, primary_key = True)\n\tname = Column(String(10), nullable = False, unique=True)\n\tparts = Column(String(200))\n\tcurrent_quantity = Column(Integer)\n\n#===##===##===##===##===##===##===#\n#PRODUCTION QUEUE TABLE - for models\n#===##===##===##===##===##===##===#\n\nclass ProductionQueue(Base): \n\t__tablename__ = 'productionqueue' \n\n\tid = Column(Integer, primary_key = True)\n\tmodel = Column(String(10))\n\torder_quantity = Column(Integer)\n\torder_time = Column(DateTime, default = datetime.datetime.now())\n\texpected_production = Column(DateTime)\n\n\t#Additional: \n\t# - Current quantity made \n\t# - Current quantity left to be made \n\n#===##===##===##===##===##===##===#\n#PARTS TABLE \n#===##===##===##===##===##===##===#\n\n# class Parts(Base):\n# \t__tablename__ = 'Parts'\n\n# \tid = Column(Integer, primary_key = True)\n# \tname = Column(String(10))\n# \tmodels = Column(String(80))\n# \tprocesses = Column(String(80))\n\n#===##===##===##===##===##===##===#\n#PROCESSES TABLE \n#===##===##===##===##===##===##===#\n\n# class Processes(Base):\n# \t__tablename__ = 'processes'\n\n# \tid = Column(Integer, primary_key = True)\n# \tname = Column(String(10))\n# \tdictionary = {} \n\n#===##===##===##===##===##===##===#\n#DATABASE BUILDER \n#===##===##===##===##===##===##===#\n\nengine = create_engine('sqlite:///complete.db')\nBase.metadata.create_all(engine) " }, { "alpha_fraction": 0.649789035320282, "alphanum_fraction": 0.8101266026496887, "avg_line_length": 58.25, "blob_id": "170b7eb9ccadf79c955c3bcdac7fb9787c478e3a", "content_id": "7b90cd5a4a2c646e6ea582823ea7f84eaed96a56", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 474, "license_type": "no_license", "max_line_length": 112, "num_lines": 8, "path": "/Wanderson-Magalhaes/Python_PySide2_Circular_ProgressBar_Modern_GUI-master/README.md", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "# Python PySide2 - Circular ProgressBar - Modern GUI\nProject created in Python using the PySide2 module.\nCircular Progress Bar created with native QWidgets features and a Flat/Modern visual interface.\n![image-1](https://user-images.githubusercontent.com/60605512/90970977-bbef0600-e4e1-11ea-9df8-e3ed970934e0.png)\n![image-2](https://user-images.githubusercontent.com/60605512/90970980-be516000-e4e1-11ea-91fd-6706d684a295.png)\n\n# Youtube Video:\nhttps://youtu.be/zUnrLHbYmKA\n" }, { "alpha_fraction": 0.6434937715530396, "alphanum_fraction": 0.686274528503418, "avg_line_length": 19.035715103149414, "blob_id": "57665422273d2c67d65c19e897372004067a7bf8", "content_id": "c34e9457c6cb47a84a415925d05ff42be1dd0c8f", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 561, "license_type": "no_license", "max_line_length": 67, "num_lines": 28, "path": "/JPro-master/proto.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import numpy as np \nimport matplotlib.pyplot as plt\n\nfrom connect import Connect\nfrom dbcreation import Models\n\nmain = Connect()\n\nmodels = [i.name for i in main.session.query(Models).all()]\nprint ('models: ', models)\n\nnames = ['M1','M2','M3','M4']\nx = np.arange(len(models))\n\nquantity = [100,200,300,150]\n\ndef main(): \n\n\tfig, axes = plt.subplots(figsize=(6,4))\n\taxes.bar(x,quantity, align='center', alpha=0.5, color='lightblue')\n\tplt.xticks(x,models)\n\tplt.ylabel('Stock')\n\tplt.title('Inventory')\n\taxes.margins(0.05)\n\taxes.set_ylim(bottom=0)\n\tplt.show()\n\nmain()\n" }, { "alpha_fraction": 0.5585143566131592, "alphanum_fraction": 0.6148096323013306, "avg_line_length": 29.578571319580078, "blob_id": "af8ab0a56d41406b847c6b525dd2706fcbf98d56", "content_id": "35025dbd5c77076143c0ec4054c453b26680127e", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 4282, "license_type": "no_license", "max_line_length": 193, "num_lines": 140, "path": "/opencv/Realidade-Aumentada-master/test.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import numpy as np\nimport cv2 as cv\n# IMPORT OBJECT LOADER\nfrom objloader import *\n# import matplotlib.pyplot as plt\n\n# Load previously saved data\nwith np.load('R1.npz') as X:\n mtx, dist, _, _ = [X[i] for i in ('mtx','dist','rvecs','tvecs')]\n\n\n\ndef draw(img, corners, imgpts):\n corner = tuple(corners[0].ravel())\n img = cv.line(img, corner, tuple(imgpts[0].ravel()), (255,0,0), 5)\n img = cv.line(img, corner, tuple(imgpts[1].ravel()), (0,255,0), 5)\n img = cv.line(img, corner, tuple(imgpts[2].ravel()), (0,0,255), 5)\n return img\ndef draw2(img, corners, imgpts):\n imgpts = np.int32(imgpts).reshape(-1,2)\n # draw ground floor in green\n img = cv.drawContours(img, [imgpts[:4]],-1,(180,0,0),2)\n # draw pillars in blue color\n for i,j in zip(range(4),range(4,8)):\n img = cv.line(img, tuple(imgpts[i]), tuple(imgpts[j]),(255),2)\n # draw top layer in red color\n img = cv.drawContours(img, [imgpts[4:]],-1,(0,0,255),2)\n return img\n\ncriteria = (cv.TERM_CRITERIA_EPS + cv.TERM_CRITERIA_MAX_ITER, 30, 0.001)\nobjp = np.zeros((6*7,3), np.float32)\nobjp[:,:2] = np.mgrid[0:7,0:6].T.reshape(-1,2)\n# axis = np.float32([[3,0,0], [0,3,0], [0,0,-3]]).reshape(-1,3)\naxis = np.float32([[0,0,0], [0,3,0], [3,3,0], [3,0,0],[0,0,-3],[0,3,-3],[3,3,-3],[3,0,-3] ])\n\nimg1 = cv.imread('fotos/box1.jpg',cv.IMREAD_GRAYSCALE) # queryImage\n\nimg2 = cv.imread('fotos/frame.png') # trainImage\n# img2 = cv.imread('fotos/cenario100.jpg') # trainImage\n# img2 = cv.cvtColor(img2, cv.COLOR_GRAY2BGR)\nimg2Gray = cv.cvtColor(img2, cv.COLOR_BGR2GRAY)\n\n\n\n# Initiate ORB detector\norb = cv.ORB_create()\n# find the keypoints and descriptors with ORB\nkp1, des1 = orb.detectAndCompute(img1,None)\nkp2, des2 = orb.detectAndCompute(img2Gray,None)\npts = cv.KeyPoint_convert(kp1)\npts3d = np.insert(pts, 2, 1, axis=1)\nprint(\"kp1.x\")\nprint(len(pts))\n\npts2d = cv.KeyPoint_convert(kp2)\n\n\n# create BFMatcher object\nbf = cv.BFMatcher(cv.NORM_HAMMING, crossCheck=True)\n# Match descriptors.\nmatches = bf.match(des1,des2)\n# Sort them in the order of their distance.\nmatches = sorted(matches, key = lambda x:x.distance)\n\n\nlimite = 0\ndistanciaMaxima = 40\na = []\nb = []\nfor i in range(len(matches)):\n a.append(matches[i].trainIdx)\n b.append(matches[i].queryIdx)\n print(matches[i].distance)\n if(matches[i].distance < distanciaMaxima):\n limite = i-1\n# print(\"b:\")\n# print(b)\n\npts2dd = np.asarray(pts2d) \npts3dd = np.asarray(pts3d) \n\npts2dd = pts2dd[a]\npts3dd = pts3dd[b]\n\n\n# Draw first 10 matches.\nimg3 = cv.drawMatches(img1,kp1,img2Gray,kp2,matches[0:20],None,flags=cv.DrawMatchesFlags_NOT_DRAW_SINGLE_POINTS)\n\n\n\n\n# ret, corners = cv2.findChessboardCorners(gray, (8,8),None)\nif True == True:\n \n # print(len(pts3dd))\n # print(len(pts2dd))\n # print(pts3dd)\n self.cone = OBJ('cone.mlt')\n glCallList(self.cone.gl_list)\n print(\"limite\", limite)\n \n\n ret,rvecs, tvecs = cv.solvePnP(pts3dd[:limite], pts2dd[:limite], mtx, dist)\n \n \n # project 3D points to image plane\n #####################################################################\n print(img1.shape)\n \n width = img1.shape[0]\n heigth = img1.shape[1]\n axis1 = np.float32([[0,0,1],[0,width,1],[heigth,0,1],[heigth,width,1]])\n # axis1 = np.float32([[0,0,1],[0,img1.width,1]])\n imgpts, jac = cv.projectPoints(axis1, rvecs, tvecs, mtx, dist)\n \n largura = int(imgpts[1][0][1] - imgpts[0][0][1])\n altura = int(imgpts[3][0][1] - imgpts[2][0][1])\n print(\"imgpts:\")\n print(imgpts)\n print(\"largura e altura: \")\n print(largura)\n print(altura)\n cv.rectangle(img2,(imgpts[0][0][0],imgpts[0][0][1]),(imgpts[3][0][0],imgpts[3][0][1]),(0,255,0),1)\n #####################################################################\n\n imgpts, jac = cv.projectPoints(20*axis, rvecs, tvecs, mtx, dist)\n print(imgpts)\n \n # InputArray objectPoints, InputArray rvec, InputArray tvec, InputArray cameraMatrix, InputArray distCoeffs, OutputArray imagePoints, OutputArray jacobian=noArray(), double aspectRatio=0 )¶\n \n \n \n img2 = draw2(img2,pts2d[:limite],imgpts)\n print(matches[20].distance)\n \n cv.imshow('img',img2)\n k = cv.waitKey(0) & 0xFF \n cv.imshow('img',img3)\n k = cv.waitKey(0) & 0xFF \n# plt.imshow(img),plt.show()\n" }, { "alpha_fraction": 0.7777777910232544, "alphanum_fraction": 0.7777777910232544, "avg_line_length": 25.5, "blob_id": "e1b5b22d9398389ddae477d0ba1a6c676a0cf82d", "content_id": "81c8ce0171296c7e44c7ca74eaa2318fc4c66d9a", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 57, "license_type": "no_license", "max_line_length": 35, "num_lines": 2, "path": "/readme.md", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "# estudos-python\nColeção de códigos python (estudos)\n\n" }, { "alpha_fraction": 0.6056337952613831, "alphanum_fraction": 0.6197183132171631, "avg_line_length": 17, "blob_id": "c350622dff35c00b8d25b69127d8ba1612888769", "content_id": "ab2696736c8ca0ee54bbac6738baac2daf21921b", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 71, "license_type": "no_license", "max_line_length": 32, "num_lines": 4, "path": "/curso-hack/first.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "x=5\n# exec(open('second.py').read())\nprg = compile('second', )\nprint(x)" }, { "alpha_fraction": 0.42228463292121887, "alphanum_fraction": 0.49625468254089355, "avg_line_length": 28.66666603088379, "blob_id": "73b6797876ff52233a1273ace54c53dcc8fa3d86", "content_id": "1099ddcaed815e1a1188595d13bb9130a0a07b28", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1068, "license_type": "no_license", "max_line_length": 63, "num_lines": 36, "path": "/JPro-master/origin/main.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "from sqlalchemy import create_engine\nfrom sqlalchemy.orm import sessionmaker\nfrom dbcreation import Base, Models, ProductionQueue\n\nproductiontimes = {\"C1\":{\"P1\":12,\"P2\":4,\"P5\":5,\"P6\":7,\"P10\":1},\n\t\t\t\t\t\t\t\t\t\t\"C2\":{\"P1\":12,\"P2\":6,\"P6\":5,\"P8\":9,\"P10\":1}, \n\t\t\t\t\t\t\t\t\t\t\"C3\":{\"P1\":12,\"P2\":7,\"P5\":5,\"P7\":15,\"P9\":4},\n\t\t\t\t\t\t\t\t\t\t\"C4\":{\"P3\":3,\"P4\":6,\"P7\":13,\"P8\":9,\"P10\":1},\n\t\t\t\t\t\t\t\t\t\t\"C5\":{\"P3\":3,\"P4\":6,\"P7\":18},\n\t\t\t\t\t\t\t\t\t\t\"C6\":{\"P3\":3,\"P4\":4,\"P8\":10,\"P9\":5},\n\t\t\t\t\t\t\t\t\t\t\"C7\":{\"P5\":8,\"P6\":8,\"P9\":5},\n}\n\ndef Main(): \n\t#===##===##===##===##===##===##===#\n\t#Connection to SQLITE DB \n\t#===##===##===##===##===##===##===#\n\tengine = create_engine('sqlite:///complete.db')\n\tBase.metadata.bind = engine\n\tDBSession = sessionmaker(bind=engine)\n\tsession = DBSession()\n\tprint ('played')\n\n\t#===##===##===##===##===##===##===#\n\t#Methods \n\t#===##===##===##===##===##===##===#\n\n\tprint(session.query(ProductionQueue).first())\n\tdef getTime(part, process): \n\t\tprint(\"ProductionTime is: \", productiontimes[process][part])\n\t\treturn\n\t\n\tprint (getTime('P5','C7'))\n\nif __name__ == '__main__': \n\tMain() " }, { "alpha_fraction": 0.6518661379814148, "alphanum_fraction": 0.6576576828956604, "avg_line_length": 26.269006729125977, "blob_id": "629ed2e2351ca189e4846ab89c260dc2af8d501c", "content_id": "deafae7e2c69f8930251fbf498188d0d9351c082", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 4662, "license_type": "no_license", "max_line_length": 89, "num_lines": 171, "path": "/JPro-master/origin/GUI.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import sys \nimport datetime\nfrom PyQt5.QtWidgets import (QApplication, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQWidget, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQLabel, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQTableWidget, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQTableWidgetItem,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQVBoxLayout,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQHBoxLayout,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQPushButton,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tqApp,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQShortcut,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQDialog,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQAbstractItemView,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQGridLayout,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQHeaderView,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\nfrom PyQt5.QtGui import QKeySequence\nfrom connect import Connect \nfrom dbcreation import Base, Models, ProductionQueue\nfrom dialog_new import Dialog as DBox\n\n\nclass PBox(QWidget): \n\n\tdef __init__(self): \n\t\tsuper().__init__()\n\n\t\tself.initUI()\n\n\tdef initUI(self): \n\t\n\t\t#====##====##====##====##====#\n\t\t# TAB CREATION\n\t\t#====##====##====##====##====#\n\n\t\t#Shortcut to close window \n\t\texitShortcut = QShortcut(QKeySequence('Ctrl+W'),self, qApp.quit)\n\n\t\tself.vBox = QVBoxLayout()\n\t\tcontrolBox = QHBoxLayout()\n\t\ttableBox = QGridLayout()\n\n\t\tlabel1 = QLabel('Machine Production',self)\n\n\t\t#====##====##====##====##====#\n\t\t#SESSION EXTRACTION TO TABLE \n\t\t#====##====##====##====##====#\n\n\t\t#Session instance creation \n\t\tself.main = Main()\n\n\t\t#Extract all orders in the procedure queue\n\t\tself.all_orders = self.main.session.query(ProductionQueue).all()\n\t\tself.table_length = len(self.all_orders)\n\t\tprint('origin table length: ', self.table_length)\n\t\t#Generate Table & Setting Column headers\n\t\tself.table = QTableWidget(len(self.all_orders),4,self)\n\n\t\tself.table.setHorizontalHeaderItem(0, QTableWidgetItem('Order No.'))\n\t\tself.table.setHorizontalHeaderItem(1, QTableWidgetItem('Model')) \n\t\tself.table.setHorizontalHeaderItem(2, QTableWidgetItem('Quantity'))\n\t\tself.table.setHorizontalHeaderItem(3, QTableWidgetItem('Order Date'))\n\n\t\t'''\n\t\tUse QHeader Class to resize the tables\n\t\t'''\n\t\torder_header = self.table.horizontalHeader()\n\t\torder_header.setMinimumSectionSize(130)\n\t\torder_header.setSectionResizeMode(QHeaderView.Stretch)\n\n\t\tself.table.setHorizontalHeaderItem(3, QTableWidgetItem('Expected completion'))\n\n\t\tself.table.setSelectionBehavior(QAbstractItemView.SelectRows)\n\n\t\tprint ('original selection: ', self.table.currentRow())\n\n\t\t# Iterating through all records \n\t\t\n\t\tself.setData(self.all_orders)\n\n\t\t#====##====##====##====##====#\n\t\t#CONTROL PANEL \n\t\t#====##====##====##====##====#\n\n\t\tbtn_neworder = QPushButton('New', self)\n\t\tbtn_neworder.clicked.connect(self.getDBox)\n\n\t\tbtn_deleterecord = QPushButton('Delete', self)\n\t\tbtn_deleterecord.clicked.connect(self.deleteRecord)\n\n\t\tcontrolBox.addWidget(btn_neworder)\n\t\tcontrolBox.addWidget(btn_deleterecord)\n\n\t\t#Adding table into VBoxLayout\n\n\t\ttableBox.addWidget(self.table)\n\n\t\tself.vBox.addWidget(label1)\n\t\tself.vBox.addLayout(tableBox)\n\t\tself.vBox.addLayout(controlBox)\n\n\t\tself.setLayout(self.vBox)\n\n\t\t#====##====##====##====##====#\n\t\t#CONTROL PANEL \n\t\t#====##====##====##====##====#\n\n\t'''\n\tgetDBox: Brings up the Dialog Box from dialog_new\n\t'''\n\tdef getDBox(self) : \n\t\tdbox = DBox()\n\t\tdbox.exec()\n\t\tif dbox.oq_input.text(): \n\t\t\tself.resetTable()\n\n\t'''\n\tresetTable(): \n\t1. Clears the contents of the Table \n\t2. Inserts an extra row \n\t3. Updates the table with latest db data via query\n\t'''\n\n\tdef resetTable(self):\n\t\tself.table.clearContents()\n\t\tself.table_length += 1 \n\t\tself.table.insertRow(self.table_length - 1)\n\t\tself.setData(self.main.session.query(ProductionQueue).all())\n\n\t'''\n\tsetData(): \n\t- Runs a loop to populate the table with the current database records \n\t'''\n\n\tdef setData(self, all_orders):\n\t\trow = 0 \n\t\tfor order in all_orders: \n\t\t\tself.table.setItem(row, 0, QTableWidgetItem(str(order.id)))\n\t\t\tself.table.setItem(row, 1, QTableWidgetItem(order.model))\n\t\t\tself.table.setItem(row, 2, QTableWidgetItem(str(order.order_quantity)))\n\t\t\tself.table.setItem(row, 3, QTableWidgetItem(str(order.order_time)))\n\t\t\trow += 1 \n\n\t'''\n\tdeleteRecord(): \n\t- Deletes the currently selected record from the table \n\t- Use setCurrentCell() to ensure the current selection is reset to None\n\t'''\t\t\t\n\n\tdef deleteRecord(self):\n\t\tselected_item = self.table.item(self.table.currentRow(),0).text()\n\t\tself.deleteFromDB(selected_item)\n\t\tself.table.removeRow(self.table.currentRow())\n\t\tself.table.setCurrentCell(-1,-1)\n\t\tself.table_length = len(self.main.session.query(ProductionQueue).all())\n\n\t'''\n\tdeleteFromDB(): \n\t- Takes an unique order number and removes it from the database table.\n\t'''\n\tdef deleteFromDB(self,record): \n\t\tsearch_instance = self.main.session.query(ProductionQueue).filter_by(id = record).one()\n\t\tself.main.session.delete(search_instance)\n\t\tself.main.session.commit()\n\nif __name__ == '__main__' : \n\n\tapp = QApplication(sys.argv)\n\tpbox = PBox()\n\tsys.exit(app.exec_())" }, { "alpha_fraction": 0.598675012588501, "alphanum_fraction": 0.6063458919525146, "avg_line_length": 31.965517044067383, "blob_id": "7741fd2fe81ff2aa74611a60dddf850d24ed4187", "content_id": "3dee1c666bc962c08d1efbe70ba027d98c2863be", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2868, "license_type": "no_license", "max_line_length": 97, "num_lines": 87, "path": "/Hospital-Helper-2-master/app/gui/message_widget.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "from PyQt5.QtCore import Qt, QPropertyAnimation, QPoint, QTimer\nfrom PyQt5.QtWidgets import QFrame, QLabel, QVBoxLayout\n\nfrom app.gui import utils\n\n\nclass MessageWidget(QFrame):\n \"\"\"\n Displays message that disappears after some time.\n \"\"\"\n\n RIGHT_MARGIN = 20\n TIMEOUT = 1000\n\n def __init__(self, main_window):\n super().__init__(main_window)\n\n self.x_pos = 0\n self.label = self._create_layout_and_get_label(main_window)\n self._animation = self._get_animation(main_window)\n self._show = self._get_show_func(main_window)\n self.timer = self._get_timer()\n\n main_window.communication.set_message_text.connect(self._show)\n\n def _create_layout_and_get_label(self, main_window):\n vbox = QVBoxLayout()\n vbox.setContentsMargins(0, 0, 0, 0)\n self.setLayout(vbox)\n\n l = QLabel()\n l.setAlignment(Qt.AlignCenter)\n l.setScaledContents(True)\n vbox.addWidget(l)\n self.setGraphicsEffect(utils.get_shadow())\n self.hide()\n\n w = main_window.width() / 5\n self.setFixedSize(w, w * 0.3)\n self.x_pos = main_window.width() - self.width() - self.RIGHT_MARGIN\n self.move(self.x_pos, main_window.height())\n\n return l\n\n def _get_animation(self, main_window):\n animation = {'show': QPropertyAnimation(self, b'pos'),\n 'hide': QPropertyAnimation(self, b'pos')}\n\n animation['show'].setStartValue(QPoint(self.x_pos, main_window.height()))\n animation['show'].setEndValue(QPoint(self.x_pos, main_window.height() - self.height()))\n animation['show'].setDuration(200)\n animation['show'].finished.connect(self._set_timeout_to_hide)\n\n animation['hide'].setStartValue(QPoint(self.x_pos, main_window.height() - self.height()))\n animation['hide'].setEndValue(QPoint(self.x_pos, main_window.height()))\n animation['hide'].setDuration(200)\n animation['hide'].finished.connect(self.hide)\n return animation\n\n def _get_timer(self):\n timer = QTimer(self)\n timer.setSingleShot(True)\n timer.timeout.connect(self._hide)\n return timer\n\n def _set_timeout_to_hide(self):\n self.timer.stop()\n self.timer.start(self.TIMEOUT)\n\n def _get_show_func(self, main_window):\n def _show(text):\n self.label.setText(text)\n self.show()\n self.raise_()\n self.setFixedSize(self.label.width(), self.height())\n self.move(main_window.width() - self.width() - self.RIGHT_MARGIN,\n main_window.height())\n self._animation['show'].start()\n return _show\n\n def _hide(self):\n self._animation['show'].stop()\n self._animation['hide'].start()\n self.timer.stop()\n\n def mousePressEvent(self, event):\n self._hide()\n" }, { "alpha_fraction": 0.5648148059844971, "alphanum_fraction": 0.6327160596847534, "avg_line_length": 28.363636016845703, "blob_id": "30480eace580733bbbd219f5f5e2bcfb10e2eb49", "content_id": "9eb0e97d438914c3eba3d901eaab0113d1f23b87", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 324, "license_type": "no_license", "max_line_length": 59, "num_lines": 11, "path": "/mapas/ve-gmapa-001.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "# import gmplot package \nimport gmplot \n \n# GoogleMapPlotter return Map object \n# Pass the center latitude and \n# center longitude \ngmap1 = gmplot.GoogleMapPlotter(-15.80423, \n -47.9526007, 17, 'AIzaSyDK_hPqU0_GSURBCDQ-KoSadNzSfVCg9PM' ) \n \n# Pass the absolute path \ngmap1.draw( \"C:\\\\tmp\\\\Python\\\\proj\\\\mapas\\\\map11.html\" ) \n" }, { "alpha_fraction": 0.5740291476249695, "alphanum_fraction": 0.6316747665405273, "avg_line_length": 28.96363639831543, "blob_id": "c2348c628e8d1e822afb72d4dde34b7a113339dd", "content_id": "2ce84e9c25e828e37e3fb9f3e42fd9beffe9a333", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1648, "license_type": "no_license", "max_line_length": 89, "num_lines": 55, "path": "/fullcontrol_001/baixa-livros-request.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import datetime\nimport requests\nfrom bs4 import BeautifulSoup as bs\nimport time\nimport re\n\n# LINK DA PAGINA\nlink = \"https://www.packtpub.com/packt/offers/free-learning?from=block\"\n\n# CABECALHO WEB(USER-AGENT)\ncabe = {\n 'User-agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:62.0) Gecko/20100101 Firefox/62.0'}\n\n# MANDANDO REQUESICAO\nrequesicao = requests.get(link, headers=cabe)\n\n# PEGANDO A SOURCE\nobjeto = bs(requesicao.text, 'html.parser')\n\n# PEGANDO O TITULO\ntitulo = objeto.find('div', class_='dotd-title').find('h2').text\n\n# PEGANDO A DATA\ntempo = objeto.find(\n 'div', class_=\"eighteen-days-countdown-bar\").find('span').get('data-countdown-to')\n\n# TRADUZINDO A DATA\n\n\ndef get_date(utc_offset):\n utc_offset = int(utc_offset) * 1000\n now = datetime.datetime.utcnow()\n # Vai TNC!!! Tive que dar um sambarilove na hora...\n h = ((now.hour + 2) * 3600000)\n m = (now.minute * 60000)\n s = (now.second * 1000)\n timeLeft = int(86400000) - (int(h) + int(m) + int(s)) - int(utc_offset)\n milliseconds = int((timeLeft % 1000) / 100)\n seconds = int((timeLeft / 1000) % 60)\n minutes = int((timeLeft / (1000 * 60)) % 60)\n hours = int((timeLeft / (1000 * 60 * 60)) % 24)\n hours = \"0\" + str(hours) if (hours < 10) else hours\n minutes = \"0\" + str(minutes) if (minutes < 10) else minutes\n seconds = \"0\" + str(seconds) if (seconds < 10) else seconds\n tempo = \"\" + str(hours) + \":\" + str(minutes) + \":\" + str(seconds)\n return tempo\n\n\ntempo1 = get_date(tempo)\n\n# REGEX\ntitulo = re.sub(r'\\s\\s+', ' ', (re.sub(r'^\\s+$|\\n', '', titulo)))\n\n# IMPRIMINDO TUDO\nprint('\\nTitulo:', titulo, '\\nData:', tempo1, '\\nLink:', link)\n" }, { "alpha_fraction": 0.5875136256217957, "alphanum_fraction": 0.5898309946060181, "avg_line_length": 33.76777267456055, "blob_id": "4c992b1704b7adf71d4cc8fee9fa48d1668518ee", "content_id": "653847e5a6941fecf56df397533e81bf8061e5fc", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 7385, "license_type": "no_license", "max_line_length": 78, "num_lines": 211, "path": "/PyQT-CRUD-App/app/editdialogs/pc.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/python3\n# -*- coding: utf-8 -*-\n\"\"\"\nРедактирование информации о компьютерах\nEditando informações sobre computadores\n\"\"\"\nfrom app.tools.exitmethods import Dialog\nfrom app.db import data\nfrom PyQt5 import *\nfrom PyQt5.QtWidgets import *\nfrom PyQt5.QtGui import *\nfrom PyQt5.QtCore import *\nfrom PyQt5.Qt import *\n\n\nclass EditPc(Dialog):\n def __init__(self, session, pc):\n QDialog.__init__(self)\n self.session = session\n self.pc = pc\n self.init_window()\n self.build()\n self.fill()\n\n def init_window(self):\n self.setFixedSize(700, 480)\n self.setWindowModality(2)\n self.setWindowTitle(\n '{}/{}'.format(\n self.pc.pcname.domain.name,\n self.pc.pcname.name\n )\n )\n self.setWindowIcon(QIcon(r'pics\\pc.png'))\n\n def build(self):\n QVBoxLayout(self)\n\n form_layout = QFormLayout()\n self.pc_name_edit = QLineEdit()\n self.pc_name_edit.setValidator(\n QRegExpValidator(QRegExp(\"[^А-ЯA-Z ]+\"))\n )\n self.pc_name_edit.setClearButtonEnabled(True)\n form_layout.addRow(\n 'Nome do computador:<font color=\"red\">*</font>', self.pc_name_edit\n )\n self.mac_edit = QLineEdit()\n self.mac_edit.setValidator(\n QRegExpValidator(QRegExp(\"[A-F-0-9]+\"))\n )\n self.mac_edit.setClearButtonEnabled(True)\n form_layout.addRow(\n 'Endereço MAC:<font color=\"red\">*</font>', self.mac_edit\n )\n self.power_socket_edit = QComboBox()\n self.power_socket_edit.setEditable(True)\n self.power_socket_edit.addItems([\n pow_socket\n for pow_socket, in self.session.query(data.PowerSocket.name)\n if pow_socket\n ])\n form_layout.addRow(\n 'Número de slots:', self.power_socket_edit\n )\n self.connection_type_edit = QComboBox()\n self.connection_type_edit.setEditable(True)\n self.connection_type_edit.setValidator(\n QRegExpValidator(QRegExp(\"[^А-ЯA-Z]+\"))\n )\n self.connection_type_edit.addItems([\n conn_type\n for conn_type, in self.session.query(data.ConnectionType.name)\n if conn_type\n ])\n form_layout.addRow(\n 'Como usá-lo:', self.connection_type_edit\n )\n self.domain_edit = QComboBox()\n self.domain_edit.setEditable(True)\n self.domain_edit.addItems([\n domain\n for domain, in self.session.query(data.Domain.name)\n if domain\n ])\n form_layout.addRow(\n 'Nome de domínio:', self.domain_edit\n )\n self.app_server_edit = QLineEdit()\n self.app_server_edit.setClearButtonEnabled(True)\n form_layout.addRow(\n 'Aplicações de servidor:', self.app_server_edit\n )\n self.windows_os_edit = QComboBox()\n self.windows_os_edit.setEditable(True)\n self.windows_os_edit.setValidator(\n QRegExpValidator(QRegExp(\"[^A-Z]+\"))\n )\n self.windows_os_edit.addItems([\n windows\n for windows, in self.session.query(data.Windows.name)\n if windows\n ])\n form_layout.addRow(\n 'Windows:', self.windows_os_edit\n )\n self.ms_office_edit = QComboBox()\n self.ms_office_edit.setEditable(True)\n self.ms_office_edit.setValidator(\n QRegExpValidator(QRegExp(\"[^A-Z]+\"))\n )\n self.ms_office_edit.addItems([\n office\n for office, in self.session.query(data.Office.name)\n if office\n ])\n form_layout.addRow(\n 'Microsoft Office:', self.ms_office_edit\n )\n self.antivirus_edit = QComboBox()\n self.antivirus_edit.setEditable(True)\n self.antivirus_edit.setValidator(\n QRegExpValidator(QRegExp(\"[^A-Z]+\"))\n )\n self.antivirus_edit.addItems([\n antivirus\n for antivirus, in self.session.query(data.Antivirus.name)\n if antivirus\n ])\n form_layout.addRow(\n 'Anti-Virus:', self.antivirus_edit\n )\n self.windows_os_key_edit = QLineEdit()\n self.windows_os_key_edit.setClearButtonEnabled(True)\n form_layout.addRow(\n 'Windows key:', self.windows_os_key_edit\n )\n self.ms_office_key_edit = QLineEdit()\n self.ms_office_key_edit.setClearButtonEnabled(True)\n form_layout.addRow(\n 'Microsoft Office key:', self.ms_office_key_edit\n )\n self.mail_client_edit = QLineEdit()\n self.mail_client_edit.setClearButtonEnabled(True)\n form_layout.addRow(\n 'Cliente de e-mail:', self.mail_client_edit\n )\n self.comments_edit = QLineEdit()\n self.comments_edit.setClearButtonEnabled(True)\n form_layout.addRow(\n 'Outro:', self.comments_edit\n )\n self.kes_edit = QCheckBox()\n form_layout.addRow(\n 'Agente KES:', self.kes_edit\n )\n self.consultant_edit = QCheckBox()\n form_layout.addRow(\n 'Consultor:', self.consultant_edit\n )\n self.guarantee_edit = QCheckBox()\n form_layout.addRow(\n 'Garantia:', self.guarantee_edit\n )\n self.odin_s_edit = QCheckBox()\n form_layout.addRow(\n '1С:', self.odin_s_edit\n )\n self.kdc_edit = QCheckBox()\n form_layout.addRow(\n 'KDS:', self.kdc_edit\n )\n\n buttons_layout = QHBoxLayout()\n refresh_button = QPushButton('Reset')\n refresh_button.clicked.connect(self.fill)\n buttons_layout.addWidget(refresh_button)\n exit_button = QPushButton('Sair')\n exit_button.clicked.connect(self.reject)\n buttons_layout.addWidget(exit_button)\n accept_button = QPushButton('Salvar')\n accept_button.clicked.connect(self.accept)\n buttons_layout.addWidget(accept_button)\n\n self.layout().addLayout(form_layout)\n self.layout().addLayout(buttons_layout)\n\n def fill(self):\n self.pc_name_edit.setText(self.pc.pcname.name)\n self.mac_edit.setText(self.pc.mac_address)\n self.power_socket_edit.setCurrentText(self.pc.powersocket.name)\n self.connection_type_edit.setCurrentText(self.pc.connectiontype.name)\n self.domain_edit.setCurrentText(self.pc.pcname.domain.name)\n self.app_server_edit.setText(self.pc.app_server)\n self.windows_os_edit.setCurrentText(self.pc.windows.name)\n self.ms_office_edit.setCurrentText(self.pc.office.name)\n self.antivirus_edit.setCurrentText(self.pc.antivirus.name)\n self.windows_os_key_edit.setText(self.pc.windows_os_key)\n self.ms_office_key_edit.setText(self.pc.ms_office_key)\n self.mail_client_edit.setText(self.pc.mail_client)\n self.comments_edit.setText(self.pc.comments)\n if self.pc.kes:\n self.kes_edit.setChecked(True)\n if self.pc.consultant:\n self.consultant_edit.setChecked(True)\n if self.pc.guarantee:\n self.guarantee_edit.setChecked(True)\n if self.pc.odin_s:\n self.odin_s_edit.setChecked(True)\n if self.pc.kdc:\n self.kdc_edit.setChecked(True)\n" }, { "alpha_fraction": 0.5810234546661377, "alphanum_fraction": 0.5884861350059509, "avg_line_length": 39.56756591796875, "blob_id": "9082ee0e043038a67c21330e2988310c827bfb75", "content_id": "19d61b9f43efd42a88a20cba74f21d27b79869bb", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 7524, "license_type": "no_license", "max_line_length": 120, "num_lines": 185, "path": "/djangosige/venv/Lib/site-packages/pysignfe/ct_e.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n\nfrom .nota import NotaFiscal\nfrom pysignfe.cte import ProcessadorCTe\nfrom pysignfe.cte.v300 import *\n\n\n'''\nServiços:\n-Recepção de CT-e\n-Inutilização de Numeração de CT-e\n-Consulta da situação atual do CT-e\n-Registro de Evento de CT-e\n *Cancelamento e Carta correção\n *Faltam eventos: EPEC, Registro do Multimodal, Serviço em desacordo e GTV\n-Consulta do status do serviço\n-Consulta Cadastro (especificação no MOC da NF-e) (Não feito, consultar cadastro pela mensagem de retorno do envio.)\n-Recepção de CT-e Outros Serviços (Não feito por enquanto)\n'''\n\nclass ct_e(NotaFiscal):\n\n def consultar_servidor(self, cert, key, versao=u'3.00', ambiente=2, estado=u'MG',\n salvar_arquivos=True):\n \n p = ProcessadorCTe()\n p.ambiente = ambiente\n p.estado = estado\n p.versao = versao\n p.certificado.cert_str = cert\n p.certificado.key_str = key\n p.salvar_arquivos = salvar_arquivos\n\n processo = p.consultar_servico()\n status = processo.resposta.cStat.valor\n processo.envio.xml\n processo.resposta.xml\n processo.resposta.reason\n\n return{'status': status, 'envio': processo.envio.xml, 'resposta': processo.resposta.xml,\n 'reason': processo.resposta.reason}\n \n def processar_lote_cte(self, lista_cte, cert, key, versao=u'3.00', ambiente=2, estado=u'MG',\n tipo_contingencia=False, salvar_arquivos=True, n_consultas_recibo=2, consultar_servico=True):\n \n p = ProcessadorCTe()\n p.ambiente = ambiente\n p.estado = estado\n p.versao = versao\n p.certificado.cert_str = cert\n p.certificado.key_str = key\n p.salvar_arquivos = salvar_arquivos\n p.tipo_contingencia = tipo_contingencia\n p.numero_tentativas_consulta_recibo = n_consultas_recibo\n p.verificar_status_servico = consultar_servico\n \n lista = []\n if lista_cte:\n for x in lista_cte:\n c = CTe_300()\n c.infCte.xml = x\n lista.append(c)\n \n for processo in p.processar_lote_cte(lista):\n processo.envio.xml\n processo.resposta.xml\n processo.resposta.reason\n \n vals = {\n 'envio': processo.envio.xml, \n 'resposta': processo.resposta.xml,\n 'status_resposta_lote': processo.resposta.cStat.valor,\n 'status_motivo_lote': processo.resposta.xMotivo.valor,\n 'reason': processo.resposta.reason\n }\n \n for nome, proc in p.processos.items():\n vals['status_resposta_'+str(nome)] = proc.protCTe.infProt.cStat.valor\n vals['numero_protocolo_'+str(nome)] = proc.protCTe.infProt.nProt.valor\n vals['status_motivo_'+str(nome)] = proc.protCTe.infProt.xMotivo.valor\n\n return vals\n \n def inutilizar_cte(self, cnpj, serie, numero, justificativa, cert, key, versao=u'3.00',\n ambiente=2, estado=u'MG', tipo_contingencia=False, salvar_arquivos=True):\n \n p = ProcessadorCTe()\n p.versao = versao\n p.estado = estado\n p.ambiente = ambiente\n p.certificado.cert_str = cert\n p.certificado.key_str = key\n p.salvar_arquivos = salvar_arquivos\n p.tipo_contingencia = tipo_contingencia\n p.caminho = u''\n \n processo = p.inutilizar_cte(cnpj=cnpj, serie=serie, numero_inicial=numero,\n justificativa=justificativa)\n processo.envio.xml\n processo.resposta.xml\n processo.resposta.reason\n vals = {'envio': processo.envio.xml,\n 'resposta': processo.resposta.xml,\n 'status_resposta': processo.resposta.infInut.cStat.valor,\n 'status_motivo': processo.resposta.infInut.xMotivo.valor,\n 'reason': processo.resposta.reason}\n return vals\n \n def consultar_cte(self, chave, cert, key, versao=u'3.00', ambiente=2, estado=u'MG',\n tipo_contingencia=False, salvar_arquivos=True):\n \n p = ProcessadorCTe()\n p.versao = versao\n p.estado = estado\n p.ambiente = ambiente\n p.certificado.cert_str = cert\n p.certificado.key_str = key\n p.tipo_contingencia=tipo_contingencia\n p.salvar_arquivos = salvar_arquivos\n processo = p.consultar_cte(chave_cte=chave)\n \n vals = {'envio': processo.envio.xml,\n 'resposta': processo.resposta.xml,\n 'status_resposta': processo.resposta.cStat.valor,\n 'status_motivo': processo.resposta.xMotivo.valor,\n 'reason': processo.resposta.reason,\n }\n \n return vals\n \n def cancelar_cte(self, cnpj, chave, protocolo, justificativa, cert, key, versao=u'3.00',\n ambiente=2, estado=u'MG', tipo_contingencia=False, salvar_arquivos=True):\n \n p = ProcessadorCTe()\n p.versao = versao\n p.estado = estado\n p.ambiente = ambiente\n p.tipo_contingencia = tipo_contingencia\n p.certificado.cert_str = cert\n p.certificado.key_str = key\n p.salvar_arquivos = salvar_arquivos\n \n processo = p.cancelar_cte(cnpj, chave_cte=chave, numero_protocolo=protocolo,\n justificativa=justificativa)\n processo.resposta.reason\n vals = {'envio': processo.envio.xml,\n 'resposta': processo.resposta.xml,\n 'status_resposta': processo.resposta.infEvento.cStat.valor,\n 'status_motivo': processo.resposta.infEvento.xMotivo.valor,\n 'reason': processo.resposta.reason}\n if processo.resposta.infEvento.cStat.valor in ('134', '135', '136',):\n vals['proc_cancelamento'] = processo.processo_evento_cte.xml\n if processo.resposta.infEvento.cStat.valor == '135':\n vals['protocolo'] = processo.resposta.infEvento.nProt.valor\n\n return vals\n \n def emitir_carta_correcao(self, chave, cnpj, cert, key, correcoes=[], sequencia=None,\n versao=u'3.00', ambiente=2, estado=u'MG', tipo_contingencia=False,\n salvar_arquivos=True):\n \n p = ProcessadorCTe()\n p.versao = versao\n p.estado = estado\n p.ambiente = ambiente\n p.certificado.cert_str = cert\n p.certificado.key_str = key\n p.salvar_arquivos = salvar_arquivos\n p.tipo_contingencia = tipo_contingencia\n \n processo = p.corrigir_cte(chave_cte=chave, cnpj=cnpj, correcoes=correcoes,\n ambiente=ambiente,sequencia=sequencia) \n processo.resposta.reason\n vals = {'envio': processo.envio.xml,\n 'resposta': processo.resposta.xml,\n 'status_resposta': processo.resposta.infEvento.cStat.valor,\n 'status_motivo': processo.resposta.infEvento.xMotivo.valor,\n 'reason': processo.resposta.reason}\n \n if processo.resposta.infEvento.cStat.valor in ('134', '135', '136',):\n vals['proc_correcao'] = processo.processo_evento_cte.xml\n if processo.resposta.infEvento.cStat.valor == '135':\n vals['protocolo'] = processo.resposta.infEvento.nProt.valor\n\n return vals" }, { "alpha_fraction": 0.5583726167678833, "alphanum_fraction": 0.5636792182922363, "avg_line_length": 23.941177368164062, "blob_id": "058f3f44304042bb162c960ae3a30ea8cdffb055", "content_id": "912cee5ffd2ee5816c089e1f8a763e75222ba1c1", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1696, "license_type": "no_license", "max_line_length": 71, "num_lines": 68, "path": "/qt/top_system_buttons.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "from PyQt5.QtWidgets import QFrame, QPushButton, QHBoxLayout, QLabel\n\n\nclass TopSystemButtons(QFrame):\n \"\"\"\n Frame contains close and minimize buttons\n \"\"\"\n\n def __init__(self, main_window):\n super().__init__()\n\n self.move_offset = None\n self.mouseMoveEvent = self._get_move_function(main_window)\n\n main_window.communication.user_selected.connect(self.set_title)\n\n b = QHBoxLayout()\n b.addStretch()\n b.setSpacing(0)\n b.setContentsMargins(0, 0, 0, 0)\n\n exit_button = QPushButton('x')\n exit_button.clicked.connect(main_window.close)\n\n minimize_button = QPushButton('_')\n minimize_button.clicked.connect(main_window.minimize)\n\n self.title = QLabel('')\n b.addWidget(self.title)\n b.addSpacing(10)\n b.addWidget(minimize_button)\n b.addSpacing(1)\n b.addWidget(exit_button)\n self.setLayout(b)\n\n def _get_move_function(self, main_window):\n\n \"\"\"\n Move the window.\n \"\"\"\n\n def _f(event):\n if not self.move_offset:\n return\n\n x = event.globalX()\n y = event.globalY()\n x_w = self.move_offset.x()\n y_w = self.move_offset.y()\n main_window.move(x - x_w, y - y_w)\n\n return _f\n\n def set_title(self, user):\n \"\"\"\n Change title when user is selected.\n \"\"\"\n\n self.title.setText(str(user))\n\n def mousePressEvent(self, event):\n self.move_offset = event.pos()\n\n def mouseReleaseEvent(self, event):\n \"\"\"\n This prevents window from moving when buttons pressed\n \"\"\"\n self.move_offset = None\n" }, { "alpha_fraction": 0.5750883221626282, "alphanum_fraction": 0.5777385234832764, "avg_line_length": 29.053096771240234, "blob_id": "4bacd5f70aaa610ccd0f8ddf754092c380c73c92", "content_id": "b866ee9f93fae8e66a5dec48e18d1f8406e6728b", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3396, "license_type": "no_license", "max_line_length": 95, "num_lines": 113, "path": "/Hospital-Helper-2-master/app/tests/test_db.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import unittest\n\nfrom sqlalchemy import exc\nfrom sqlalchemy.orm import exc as orm_exc\n\nfrom app.model import db\n\n\nclass TestModel(unittest.TestCase):\n user_args = {\n 'surname': 'Test',\n 'name': 'Test Name',\n 'patronymic': 'Test'\n }\n\n def _clean_db(self):\n for t in db.Base.metadata.tables:\n db.SESSION.execute('delete from \"{}\";'.format(t))\n\n def setUp(self):\n self.organization = db.Organization(name='test', header='')\n self.organization.save()\n\n self.user = db.User(organization=self.organization, **self.user_args)\n self.user.save()\n\n def test_get(self):\n with self.assertRaises(orm_exc.NoResultFound):\n db.Template.get(id=1)\n\n user = db.User.get(id=self.user.id)\n self.assertEqual(user, self.user)\n\n with self.assertRaises(orm_exc.NoResultFound):\n db.User.get(name='garbage')\n\n db.User(organization=self.organization, **self.user_args).save()\n with self.assertRaises(orm_exc.MultipleResultsFound):\n db.User.get(name=self.user_args['name'])\n\n def test_get_or_create(self):\n for _ in range(3):\n db.User(organization=self.organization, **self.user_args).save()\n\n with self.assertRaises(orm_exc.MultipleResultsFound):\n db.User.get_or_create(name=self.user_args['name'])\n\n args = {\n 'organization': self.organization,\n 'name': 1,\n 'surname': 2,\n 'patronymic': 3\n }\n\n user, created = db.User.get_or_create(instant_flush=True, defaults={'name': 2}, **args)\n self.assertEqual(created, True)\n self.assertEqual(db.User.get(id=user.id).name, 2)\n\n user, created = db.User.get_or_create(**args)\n self.assertEqual(created, True)\n\n user, created = db.User.get_or_create(**args)\n self.assertEqual(created, False)\n\n def test_to_dict(self):\n dict_user = self.user.to_dict()\n expected_dict = {\n 'id': 1,\n 'organization_id': 1,\n 'surname': 'Test',\n 'deleted': False,\n 'name': 'Test Name',\n 'patronymic': 'Test'\n }\n self.assertEqual(dict_user, expected_dict)\n\n expected_dict['organization'] = self.user.organization.to_dict()\n dict_user = self.user.to_dict(relations={'organization': {}})\n self.assertEqual(dict_user, expected_dict)\n\n with self.assertRaises(exc.NoForeignKeysError):\n self.user.to_dict(relations={'hello': {}})\n\n with self.assertRaises(exc.NoForeignKeysError):\n self.user.to_dict(relations={'organization': {'no': {}}})\n\n def test_update(self):\n args = {\n 'name': 'Hello',\n 'patronymic': 'There'\n }\n\n self.user.update(**args)\n for k, v in args.items():\n self.assertEqual(getattr(self.user, k), v)\n\n def test_save(self):\n name = 'New Name'\n self.user.name = name\n self.user.save()\n self.assertEqual(db.User.get(id=self.user.id).name, name)\n\n def test_delete(self):\n self.user.delete()\n with self.assertRaises(orm_exc.NoResultFound):\n db.User.get(id=self.user.id)\n\n def test_create_db(self):\n structure = db.create_db()\n self.assertIsInstance(structure, str)\n\n def tearDown(self):\n self._clean_db()\n" }, { "alpha_fraction": 0.5784579515457153, "alphanum_fraction": 0.6020922064781189, "avg_line_length": 27.9887638092041, "blob_id": "8e2aaa4fed15c7ff0dfd716bbb714222e1c4de0c", "content_id": "13585fd9ebc03d6d3f1ff144a8eb8469189dafff", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2581, "license_type": "no_license", "max_line_length": 74, "num_lines": 89, "path": "/crt/windows10-crt.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "def _windows_write_string(s, out):\n \"\"\" Returns True if the string was written using special methods,\n False if it has yet to be written out.\"\"\"\n # Adapted from http://stackoverflow.com/a/3259271/35070\n # https://github.com/ytdl-org/youtube-dl/issues/15758\n\n from ctypes import byref, POINTER, windll, WINFUNCTYPE\n from ctypes.wintypes import BOOL, DWORD, HANDLE, LPWSTR, LPVOID\n\n FILE_TYPE_CHAR = 0x0002\n FILE_TYPE_REMOTE = 0x8000\n ENABLE_VIRTUAL_TERMINAL_PROCESSING = 0x0004\n\n GetStdHandle = compat_ctypes_WINFUNCTYPE(\n HANDLE,\n DWORD)(('GetStdHandle', windll.kernel32))\n\n GetFileType = compat_ctypes_WINFUNCTYPE(\n DWORD,\n HANDLE)(('GetFileType', windll.kernel32))\n\n GetConsoleMode = compat_ctypes_WINFUNCTYPE(\n BOOL,\n HANDLE,\n POINTER(DWORD))(('GetConsoleMode', windll.kernel32))\n\n SetConsoleMode = compat_ctypes_WINFUNCTYPE(\n BOOL,\n HANDLE,\n DWORD)(('SetConsoleMode', windll.kernel32))\n\n WriteConsoleW = compat_ctypes_WINFUNCTYPE(\n BOOL,\n HANDLE,\n LPWSTR,\n DWORD,\n POINTER(DWORD),\n LPVOID)(('WriteConsoleW', windll.kernel32))\n\n try:\n fileno = out.fileno()\n except AttributeError:\n # If the output stream doesn't have a fileno, it's virtual\n return False\n except io.UnsupportedOperation:\n # Some strange Windows pseudo files?\n return False\n\n if fileno == 1:\n h = GetStdHandle(-11)\n elif fileno == 2:\n h = GetStdHandle(-12)\n else:\n return False\n\n if h is None or h == HANDLE(-1):\n return False\n\n if (GetFileType(h) & ~FILE_TYPE_REMOTE) != FILE_TYPE_CHAR:\n return False\n\n mode = DWORD()\n if not GetConsoleMode(h, byref(mode)):\n return False\n\n if (mode.value & ENABLE_VIRTUAL_TERMINAL_PROCESSING) == 0:\n SetConsoleMode(h, mode.value | ENABLE_VIRTUAL_TERMINAL_PROCESSING)\n\n def next_nonbmp_pos(s):\n try:\n return next(i for i, c in enumerate(s) if ord(c) > 0xffff)\n except StopIteration:\n return len(s)\n\n written = DWORD(0)\n while s:\n count = min(next_nonbmp_pos(s), 1024)\n\n ret = WriteConsoleW(\n h, s, count if count else 2, byref(written), None)\n if ret == 0:\n raise OSError('Failed to write string')\n if not count: # We just wrote a non-BMP character\n assert written.value == 2\n s = s[1:]\n else:\n assert written.value > 0\n s = s[written.value:]\n return True\n\n" }, { "alpha_fraction": 0.5132669806480408, "alphanum_fraction": 0.5331674814224243, "avg_line_length": 47.2400016784668, "blob_id": "df31d9ef80b4ba27898456c4a55d0bab0d0d48f7", "content_id": "7131e2bd2f8dbea84dabf81f21cbfa1f60eaf2cb", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1206, "license_type": "no_license", "max_line_length": 141, "num_lines": 25, "path": "/cep-distancia/distancia-entre-ceps.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import requests\nimport json\n\n\ndef rota(cep1, cep2): #enjoy\n url1 = 'https://viacep.com.br/ws/' + cep1 + '/json/'\n url2 = 'https://viacep.com.br/ws/' + cep2 + '/json/'\n origem = json.loads(requests.get(url1).text)\n destino = json.loads(requests.get(url2).text)\n # print(origem)\n # print(destino)\n strOrigem = origem['localidade'] + ' ' + origem['uf']\n strOrigem = strOrigem.replace(' ', '+')\n print(strOrigem)\n strDestino = destino['localidade'] + ' ' + destino['uf']\n strDestino = strDestino.replace(' ', '+')\n print(strDestino)\n return requests.get('https://maps.googleapis.com/maps/api/distancematrix/json?units=imperial&origins='\n +strOrigem+'&destinations='+strDestino) #adicione o campo &key= ao final, com a sua chave de api distancematrix,\n #obtida gratuitamente no seu site oficial caso use fora do ambiente de testes\n \n \n#Exemplo de chamada\nresultado = rota('65066210', '65320000')\nprint(resultado.text)\n" }, { "alpha_fraction": 0.5903483033180237, "alphanum_fraction": 0.6030479073524475, "avg_line_length": 36.75342559814453, "blob_id": "9cfdc9a5b3cbdfa787b829f0a3efffa2018fa9d2", "content_id": "0c31d66497c9d4b4a20d048e40ebca76ab813c33", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2759, "license_type": "no_license", "max_line_length": 104, "num_lines": 73, "path": "/PyQT-CRUD-App/app/login.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/python3\n# -*- coding: utf-8 -*-\n\"\"\"\nLogin\n\"\"\"\nimport sqlalchemy\nfrom app.db import data\nfrom sqlalchemy.orm import sessionmaker\nfrom PyQt5 import *\nfrom PyQt5.QtWidgets import *\nfrom PyQt5.QtGui import *\nfrom PyQt5.QtCore import *\nfrom PyQt5.Qt import *\n\n\nclass LoginWindow(QDialog):\n def __init__(self):\n QDialog.__init__(self)\n self.init_ui()\n self.show()\n\n def init_ui(self):\n self.setWindowTitle('Login')\n self.setWindowIcon(QIcon(r'pics\\star.png'))\n self.setWindowFlags(Qt.MSWindowsFixedSizeDialogHint)\n\n self.employeename_input = QLineEdit('bog')\n self.password_input = QLineEdit('1234')\n self.password_input.setEchoMode(QLineEdit.Password)\n self.db_input = QLineEdit('diplom')\n\n ip_range = \"(?:[0-1]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\"\n ipRegex = QRegExp(\"^\" + ip_range + \"\\\\.\" + ip_range + \"\\\\.\" + ip_range + \"\\\\.\" + ip_range + \"$\")\n ipValidator = QRegExpValidator(ipRegex)\n self.host_input = QLineEdit('127.0.0.1')\n self.host_input.setValidator(ipValidator)\n\n self.port_input = QLineEdit('5432')\n\n button_box = QDialogButtonBox(QDialogButtonBox.Cancel | QDialogButtonBox.Ok)\n button_box.setCenterButtons(True)\n button_box.accepted.connect(self.handle_login)\n button_box.rejected.connect(self.reject)\n\n layout = QFormLayout(self)\n layout.addRow('Username', self.employeename_input)\n layout.addRow('Password', self.password_input)\n layout.addRow('Database', self.db_input)\n layout.addRow('Host', self.host_input)\n layout.addRow('Port', self.port_input)\n layout.addRow(button_box)\n\n def handle_login(self):\n url = 'postgresql+psycopg2://{}:{}@{}:{}/{}'\n url = url.format(self.employeename_input.text(), self.password_input.text(),\n self.host_input.text(), self.port_input.text(), self.db_input.text()\n )\n url = 'postgresql+psycopg2://{}@{}:{}/{}'\n url = url.format(self.employeename_input.text(),\n self.host_input.text(), self.port_input.text(), self.db_input.text()\n )\n # url = 'postgresql+psycopg2://postgres@localhost/diplom'\n print(url)\n try:\n engine = sqlalchemy.create_engine(url)\n data.Base.metadata.create_all(engine)\n except ValueError:\n QMessageBox.warning(self, 'Erro!', 'Dados incorretos introduzidos!')\n except Exception:\n QMessageBox.warning(self, 'Erro!', 'Não é possível conectar-se ao banco de dados')\n else:\n data.Session = sessionmaker(bind=engine, query_cls=data.Query)\n self.accept()\n" }, { "alpha_fraction": 0.6456173658370972, "alphanum_fraction": 0.6610116362571716, "avg_line_length": 27.428571701049805, "blob_id": "d9f2523206891ba508081cb07d8699ce8b6c95ac", "content_id": "0f10a57af1471ce05f8432321c935fb924f01704", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3199, "license_type": "no_license", "max_line_length": 80, "num_lines": 112, "path": "/JPro-master/origin/ibox2.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#====##====##====##====##====#\n#====##====##====##====##====#\n'''\nINVENTORY: \n\n- The widget display the current inventory held in house \n\n'''\n#====##====##====##====##====#\n#====##====##====##====##====#\n\nimport sys \nimport datetime\nfrom PyQt5.QtWidgets import (QApplication, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQWidget, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQSizePolicy,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQVBoxLayout,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQHBoxLayout,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQTableWidget,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQTableWidgetItem,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQHeaderView,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQAbstractItemView,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\nfrom connect import Connect \nfrom dbcreation import Models \nimport matplotlib.pyplot as plt\nfrom matplotlib.figure import Figure\nfrom matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas\nimport numpy as np\n\nclass IBox(QWidget): \n\n\tdef __init__(self): \n\t\tsuper().__init__()\n\n\t\tself.connect = Connect()\n\t\tself.all_stock = self.connect.session.query(Models).all()\n\n\t\tself.setGeometry(0,0,640,440)\n\t\tself.setWindowTitle('JPro')\n#\t\tself.setStyleSheet('background-color: #444444')\n\n\t\tself.buildTable()\n\t\tself.setData(self.all_stock)\n\n\t\tself.bargraph = PlotCanvas(self, self.connect, width=4, height=3)\n\t\tself.bargraph.move(0,0)\n\n\t\tiboxlayout = QHBoxLayout()\n\t\tiboxlayout.addWidget(self.table)\n\t\tiboxlayout.addWidget(self.bargraph)\t\n\t\tself.setLayout(iboxlayout)\n\n\t\tself.show()\n\n\tdef setData(self, data):\n\t\trow = 0 \n\t\tfor record in data: \n\t\t\tself.table.setItem(row, 0, QTableWidgetItem(str(record.name)))\n\t\t\tself.table.setItem(row, 1, QTableWidgetItem(str(record.current_quantity)))\n#\t\t\tself.table.setItem(row, 2, QTableWidgetItem(record.parts))\n\t\t\trow += 1 \n\n\tdef buildTable(self):\n\t\tself.table = QTableWidget(len(self.all_stock),2,self)\n\t\tself.table.setHorizontalHeaderItem(0, QTableWidgetItem('Models / 模型 '))\n\t\tself.table.setHorizontalHeaderItem(1, QTableWidgetItem('Quantity / 数量 '))\t\n#\t\tself.table.setHorizontalHeaderItem(2, QTableWidgetItem('Parts / 零件')) \n\n\t\tself.order_header = self.table.horizontalHeader()\n\t\tself.order_header.setMinimumSectionSize(130)\n\t\tself.order_header.setSectionResizeMode(QHeaderView.Stretch)\n\n\t\tself.table.setSelectionBehavior(QAbstractItemView.SelectRows)\n\t\tself.table.setCurrentCell(-1,-1)\n\n#====##====##====##====##====#\n#matplotlib bar chart widget \n#====##====##====##====##====# \nclass PlotCanvas(FigureCanvas): \n\n\tdef __init__(self, parent, connect, width=5,height=4,dpi=100):\n\t\t\n\t\tself.fig, self.axes = plt.subplots(figsize=(6,4))\n\t\t\n\t\tFigureCanvas.__init__(self,self.fig)\n\t\tself.setParent(parent)\n\t\tFigureCanvas.setSizePolicy(self, QSizePolicy.Expanding, QSizePolicy.Expanding)\n\t\tFigureCanvas.updateGeometry(self)\n\t\tself.plot(connect)\n\n\tdef plot(self, connect): \n\t\n\t\tmodels = [i.name for i in connect.session.query(Models).all()]\n\t\tquantity = [i.current_quantity for i in connect.session.query(Models).all()]\n\t\tx = np.arange(len(models))\n\n\t\tself.axes.bar(x,quantity, align='center', alpha=0.5, color='lightblue')\n\t\tplt.xticks(x,models)\n\t\tplt.ylabel('Stock')\n\t\tplt.title('Inventory')\n\t\tself.axes.margins(0.05)\n\t\tself.axes.set_ylim(bottom=0)\n\t\tself.fig.set_size_inches(3,4,forward=True)\n\t\t#plt.draw()\n\n\nif __name__ == '__main__' : \n\n\tapp = QApplication(sys.argv)\n\tibox = IBox()\n\tsys.exit(app.exec_())" }, { "alpha_fraction": 0.6281009316444397, "alphanum_fraction": 0.6629598140716553, "avg_line_length": 49.24895477294922, "blob_id": "5c0aa0f04130180900c4d3794a17e542ae49dbaa", "content_id": "0f9b6a618b6c097dace06c371a4f3ac4413976d5", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 84169, "license_type": "no_license", "max_line_length": 118, "num_lines": 1675, "path": "/PQt5-Stock/Vista/windowPrincipal.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n\n# Form implementation generated from reading ui file 'mainwindow.ui'\n#\n# Created: Tue Oct 1 00:51:34 2013\n# by: PyQt5 UI code generator 5.0.1\n#\n# WARNING! All changes made in this file will be lost!\n\nfrom PyQt5 import QtCore, QtGui, QtWidgets\n\nclass Ui_MainWindow(object):\n def setupUi(self, MainWindow):\n MainWindow.setObjectName(\"MainWindow\")\n MainWindow.setWindowModality(QtCore.Qt.ApplicationModal)\n MainWindow.setEnabled(True)\n MainWindow.resize(1190, 630)\n sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Ignored, QtWidgets.QSizePolicy.Ignored)\n sizePolicy.setHorizontalStretch(0)\n sizePolicy.setVerticalStretch(0)\n sizePolicy.setHeightForWidth(MainWindow.sizePolicy().hasHeightForWidth())\n MainWindow.setSizePolicy(sizePolicy)\n MainWindow.setStyleSheet(\"alternate-background-color: rgb(237, 255, 230);\")\n MainWindow.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)\n MainWindow.setDocumentMode(False)\n MainWindow.setDockNestingEnabled(True)\n self.centralWidget = QtWidgets.QWidget(MainWindow)\n self.centralWidget.setObjectName(\"centralWidget\")\n self.twMenu = QtWidgets.QTabWidget(self.centralWidget)\n self.twMenu.setGeometry(QtCore.QRect(10, 20, 1171, 571))\n self.twMenu.setStyleSheet(\"font: 75 11pt \\\"Segoe UI\\\";\")\n self.twMenu.setTabPosition(QtWidgets.QTabWidget.North)\n self.twMenu.setTabShape(QtWidgets.QTabWidget.Triangular)\n self.twMenu.setObjectName(\"twMenu\")\n self.tab_Transacciones = QtWidgets.QWidget()\n self.tab_Transacciones.setObjectName(\"tab_Transacciones\")\n self.rbCompra_t = QtWidgets.QRadioButton(self.tab_Transacciones)\n self.rbCompra_t.setGeometry(QtCore.QRect(280, 12, 81, 17))\n font = QtGui.QFont()\n font.setFamily(\"MS Shell Dlg 2\")\n font.setPointSize(9)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(50)\n self.rbCompra_t.setFont(font)\n self.rbCompra_t.setStyleSheet(\"font: 9pt \\\"MS Shell Dlg 2\\\";\")\n self.rbCompra_t.setObjectName(\"rbCompra_t\")\n self.rbVenta_t = QtWidgets.QRadioButton(self.tab_Transacciones)\n self.rbVenta_t.setGeometry(QtCore.QRect(210, 12, 61, 17))\n font = QtGui.QFont()\n font.setFamily(\"MS Shell Dlg 2\")\n font.setPointSize(9)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(50)\n self.rbVenta_t.setFont(font)\n self.rbVenta_t.setStyleSheet(\"font: 9pt \\\"MS Shell Dlg 2\\\";\")\n self.rbVenta_t.setObjectName(\"rbVenta_t\")\n self.txtFilterCliente_t = QtWidgets.QLineEdit(self.tab_Transacciones)\n self.txtFilterCliente_t.setGeometry(QtCore.QRect(120, 100, 201, 20))\n font = QtGui.QFont()\n font.setFamily(\"MS Shell Dlg 2\")\n font.setPointSize(9)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(50)\n self.txtFilterCliente_t.setFont(font)\n self.txtFilterCliente_t.setStyleSheet(\"font: 9pt \\\"MS Shell Dlg 2\\\";\")\n self.txtFilterCliente_t.setObjectName(\"txtFilterCliente_t\")\n self.cbFilterCliente_t = QtWidgets.QComboBox(self.tab_Transacciones)\n self.cbFilterCliente_t.setGeometry(QtCore.QRect(30, 100, 81, 22))\n font = QtGui.QFont()\n font.setFamily(\"MS Shell Dlg 2\")\n font.setPointSize(9)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(50)\n self.cbFilterCliente_t.setFont(font)\n self.cbFilterCliente_t.setStyleSheet(\"font: 9pt \\\"MS Shell Dlg 2\\\";\")\n self.cbFilterCliente_t.setObjectName(\"cbFilterCliente_t\")\n self.cbFilterCliente_t.addItem(\"\")\n self.cbFilterCliente_t.addItem(\"\")\n self.tvProductos_t = QtWidgets.QTableView(self.tab_Transacciones)\n self.tvProductos_t.setGeometry(QtCore.QRect(470, 130, 681, 111))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.tvProductos_t.setFont(font)\n self.tvProductos_t.setObjectName(\"tvProductos_t\")\n self.txtFilterProducto_t = QtWidgets.QLineEdit(self.tab_Transacciones)\n self.txtFilterProducto_t.setGeometry(QtCore.QRect(580, 100, 201, 20))\n font = QtGui.QFont()\n font.setFamily(\"MS Shell Dlg 2\")\n font.setPointSize(9)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(50)\n self.txtFilterProducto_t.setFont(font)\n self.txtFilterProducto_t.setStyleSheet(\"font: 9pt \\\"MS Shell Dlg 2\\\";\")\n self.txtFilterProducto_t.setObjectName(\"txtFilterProducto_t\")\n self.cbFilterProducto_t = QtWidgets.QComboBox(self.tab_Transacciones)\n self.cbFilterProducto_t.setGeometry(QtCore.QRect(490, 100, 81, 22))\n font = QtGui.QFont()\n font.setFamily(\"MS Shell Dlg 2\")\n font.setPointSize(9)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(50)\n self.cbFilterProducto_t.setFont(font)\n self.cbFilterProducto_t.setStyleSheet(\"font: 9pt \\\"MS Shell Dlg 2\\\";\")\n self.cbFilterProducto_t.setObjectName(\"cbFilterProducto_t\")\n self.cbFilterProducto_t.addItem(\"\")\n self.cbFilterProducto_t.addItem(\"\")\n self.cbFilterProducto_t.addItem(\"\")\n self.cbFilterProducto_t.addItem(\"\")\n self.sbCantidadProducto_t = QtWidgets.QSpinBox(self.tab_Transacciones)\n self.sbCantidadProducto_t.setGeometry(QtCore.QRect(1020, 250, 71, 22))\n font = QtGui.QFont()\n font.setFamily(\"MS Shell Dlg 2\")\n font.setPointSize(9)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(50)\n self.sbCantidadProducto_t.setFont(font)\n self.sbCantidadProducto_t.setStyleSheet(\"font: 9pt \\\"MS Shell Dlg 2\\\";\")\n self.sbCantidadProducto_t.setObjectName(\"sbCantidadProducto_t\")\n self.tvDetalleTransaccion_t = QtWidgets.QTableView(self.tab_Transacciones)\n self.tvDetalleTransaccion_t.setGeometry(QtCore.QRect(10, 310, 1141, 131))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.tvDetalleTransaccion_t.setFont(font)\n self.tvDetalleTransaccion_t.setObjectName(\"tvDetalleTransaccion_t\")\n self.btnSumarProducto_t = QtWidgets.QPushButton(self.tab_Transacciones)\n self.btnSumarProducto_t.setGeometry(QtCore.QRect(1120, 250, 21, 23))\n self.btnSumarProducto_t.setText(\"\")\n icon = QtGui.QIcon()\n icon.addPixmap(QtGui.QPixmap(\"../Img/mas.png\"), QtGui.QIcon.Normal, QtGui.QIcon.Off)\n self.btnSumarProducto_t.setIcon(icon)\n self.btnSumarProducto_t.setObjectName(\"btnSumarProducto_t\")\n self.btnRestarProducto_t = QtWidgets.QPushButton(self.tab_Transacciones)\n self.btnRestarProducto_t.setGeometry(QtCore.QRect(1120, 450, 21, 23))\n self.btnRestarProducto_t.setText(\"\")\n icon1 = QtGui.QIcon()\n icon1.addPixmap(QtGui.QPixmap(\"../Img/menos.png\"), QtGui.QIcon.Normal, QtGui.QIcon.Off)\n self.btnRestarProducto_t.setIcon(icon1)\n self.btnRestarProducto_t.setObjectName(\"btnRestarProducto_t\")\n self.btnAceptar_t = QtWidgets.QPushButton(self.tab_Transacciones)\n self.btnAceptar_t.setGeometry(QtCore.QRect(1050, 490, 101, 41))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.btnAceptar_t.setFont(font)\n self.btnAceptar_t.setStyleSheet(\"background-color: rgb(255, 255, 255);\")\n icon2 = QtGui.QIcon()\n icon2.addPixmap(QtGui.QPixmap(\"../Img/guardar.png\"), QtGui.QIcon.Normal, QtGui.QIcon.Off)\n self.btnAceptar_t.setIcon(icon2)\n self.btnAceptar_t.setIconSize(QtCore.QSize(20, 20))\n self.btnAceptar_t.setObjectName(\"btnAceptar_t\")\n self.btnCancelar_t = QtWidgets.QPushButton(self.tab_Transacciones)\n self.btnCancelar_t.setGeometry(QtCore.QRect(930, 490, 111, 41))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.btnCancelar_t.setFont(font)\n self.btnCancelar_t.setStyleSheet(\"background-color: rgb(255, 255, 255);\")\n icon3 = QtGui.QIcon()\n icon3.addPixmap(QtGui.QPixmap(\"../Img/borrar.png\"), QtGui.QIcon.Normal, QtGui.QIcon.Off)\n self.btnCancelar_t.setIcon(icon3)\n self.btnCancelar_t.setIconSize(QtCore.QSize(20, 20))\n self.btnCancelar_t.setObjectName(\"btnCancelar_t\")\n self.line1_t = QtWidgets.QFrame(self.tab_Transacciones)\n self.line1_t.setGeometry(QtCore.QRect(10, 50, 1151, 16))\n self.line1_t.setFrameShape(QtWidgets.QFrame.HLine)\n self.line1_t.setFrameShadow(QtWidgets.QFrame.Sunken)\n self.line1_t.setObjectName(\"line1_t\")\n self.line2_t = QtWidgets.QFrame(self.tab_Transacciones)\n self.line2_t.setGeometry(QtCore.QRect(170, 280, 981, 20))\n self.line2_t.setFrameShape(QtWidgets.QFrame.HLine)\n self.line2_t.setFrameShadow(QtWidgets.QFrame.Sunken)\n self.line2_t.setObjectName(\"line2_t\")\n self.label1_t = QtWidgets.QLabel(self.tab_Transacciones)\n self.label1_t.setGeometry(QtCore.QRect(10, 10, 181, 21))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.label1_t.setFont(font)\n self.label1_t.setObjectName(\"label1_t\")\n self.label2_t = QtWidgets.QLabel(self.tab_Transacciones)\n self.label2_t.setGeometry(QtCore.QRect(10, 70, 71, 21))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.label2_t.setFont(font)\n self.label2_t.setObjectName(\"label2_t\")\n self.label3_t = QtWidgets.QLabel(self.tab_Transacciones)\n self.label3_t.setGeometry(QtCore.QRect(470, 70, 81, 21))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.label3_t.setFont(font)\n self.label3_t.setObjectName(\"label3_t\")\n self.label4_t = QtWidgets.QLabel(self.tab_Transacciones)\n self.label4_t.setGeometry(QtCore.QRect(10, 275, 171, 21))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.label4_t.setFont(font)\n self.label4_t.setObjectName(\"label4_t\")\n self.label5_t = QtWidgets.QLabel(self.tab_Transacciones)\n self.label5_t.setGeometry(QtCore.QRect(930, 250, 81, 21))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.label5_t.setFont(font)\n self.label5_t.setObjectName(\"label5_t\")\n self.tvClientes_t = QtWidgets.QTableView(self.tab_Transacciones)\n self.tvClientes_t.setGeometry(QtCore.QRect(10, 130, 431, 111))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.tvClientes_t.setFont(font)\n self.tvClientes_t.setObjectName(\"tvClientes_t\")\n self.twMenu.addTab(self.tab_Transacciones, \"\")\n self.tab_Pagos = QtWidgets.QWidget()\n self.tab_Pagos.setObjectName(\"tab_Pagos\")\n self.tvCuentaCorriente_pag = QtWidgets.QTableView(self.tab_Pagos)\n self.tvCuentaCorriente_pag.setGeometry(QtCore.QRect(10, 50, 1141, 211))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.tvCuentaCorriente_pag.setFont(font)\n self.tvCuentaCorriente_pag.setObjectName(\"tvCuentaCorriente_pag\")\n self.tvDetalleTransaccion_pag = QtWidgets.QTableView(self.tab_Pagos)\n self.tvDetalleTransaccion_pag.setGeometry(QtCore.QRect(585, 301, 571, 161))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.tvDetalleTransaccion_pag.setFont(font)\n self.tvDetalleTransaccion_pag.setObjectName(\"tvDetalleTransaccion_pag\")\n self.btnAceptar_pag = QtWidgets.QPushButton(self.tab_Pagos)\n self.btnAceptar_pag.setGeometry(QtCore.QRect(1050, 490, 101, 41))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.btnAceptar_pag.setFont(font)\n self.btnAceptar_pag.setStyleSheet(\"background-color: rgb(255, 255, 255);\")\n self.btnAceptar_pag.setIcon(icon2)\n self.btnAceptar_pag.setIconSize(QtCore.QSize(20, 20))\n self.btnAceptar_pag.setObjectName(\"btnAceptar_pag\")\n self.btnCancelar_pag = QtWidgets.QPushButton(self.tab_Pagos)\n self.btnCancelar_pag.setGeometry(QtCore.QRect(930, 490, 111, 41))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.btnCancelar_pag.setFont(font)\n self.btnCancelar_pag.setStyleSheet(\"background-color: rgb(255, 255, 255);\")\n self.btnCancelar_pag.setIcon(icon3)\n self.btnCancelar_pag.setIconSize(QtCore.QSize(20, 20))\n self.btnCancelar_pag.setObjectName(\"btnCancelar_pag\")\n self.txtFilterPagos_pag = QtWidgets.QLineEdit(self.tab_Pagos)\n self.txtFilterPagos_pag.setGeometry(QtCore.QRect(110, 20, 201, 20))\n font = QtGui.QFont()\n font.setFamily(\"MS Shell Dlg 2\")\n font.setPointSize(9)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(50)\n self.txtFilterPagos_pag.setFont(font)\n self.txtFilterPagos_pag.setStyleSheet(\"font: 9pt \\\"MS Shell Dlg 2\\\";\")\n self.txtFilterPagos_pag.setObjectName(\"txtFilterPagos_pag\")\n self.cbFilterCliente_pag = QtWidgets.QComboBox(self.tab_Pagos)\n self.cbFilterCliente_pag.setGeometry(QtCore.QRect(10, 20, 91, 22))\n font = QtGui.QFont()\n font.setFamily(\"MS Shell Dlg 2\")\n font.setPointSize(9)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(50)\n self.cbFilterCliente_pag.setFont(font)\n self.cbFilterCliente_pag.setStyleSheet(\"font: 9pt \\\"MS Shell Dlg 2\\\";\")\n self.cbFilterCliente_pag.setObjectName(\"cbFilterCliente_pag\")\n self.cbFilterCliente_pag.addItem(\"\")\n self.cbFilterCliente_pag.addItem(\"\")\n self.label1_pag = QtWidgets.QLabel(self.tab_Pagos)\n self.label1_pag.setGeometry(QtCore.QRect(100, 310, 71, 21))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.label1_pag.setFont(font)\n self.label1_pag.setObjectName(\"label1_pag\")\n self.label4_pag = QtWidgets.QLabel(self.tab_Pagos)\n self.label4_pag.setGeometry(QtCore.QRect(420, 310, 151, 21))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.label4_pag.setFont(font)\n self.label4_pag.setObjectName(\"label4_pag\")\n self.label3_pag = QtWidgets.QLabel(self.tab_Pagos)\n self.label3_pag.setGeometry(QtCore.QRect(43, 370, 121, 21))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.label3_pag.setFont(font)\n self.label3_pag.setObjectName(\"label3_pag\")\n self.txtMonto_gt = QtWidgets.QLineEdit(self.tab_Pagos)\n self.txtMonto_gt.setGeometry(QtCore.QRect(230, 310, 121, 20))\n font = QtGui.QFont()\n font.setFamily(\"MS Shell Dlg 2\")\n font.setPointSize(9)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(50)\n self.txtMonto_gt.setFont(font)\n self.txtMonto_gt.setStyleSheet(\"font: 9pt \\\"MS Shell Dlg 2\\\";\")\n self.txtMonto_gt.setObjectName(\"txtMonto_gt\")\n self.cbFormaPago_pag = QtWidgets.QComboBox(self.tab_Pagos)\n self.cbFormaPago_pag.setGeometry(QtCore.QRect(190, 370, 161, 22))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.cbFormaPago_pag.setFont(font)\n self.cbFormaPago_pag.setObjectName(\"cbFormaPago_pag\")\n self.cbFormaPago_pag.addItem(\"\")\n self.cbFormaPago_pag.addItem(\"\")\n self.cbFormaPago_pag.addItem(\"\")\n self.label2_pag = QtWidgets.QLabel(self.tab_Pagos)\n self.label2_pag.setGeometry(QtCore.QRect(200, 310, 16, 21))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.label2_pag.setFont(font)\n self.label2_pag.setObjectName(\"label2_pag\")\n self.line1_pag = QtWidgets.QFrame(self.tab_Pagos)\n self.line1_pag.setGeometry(QtCore.QRect(0, 270, 1161, 16))\n self.line1_pag.setFrameShape(QtWidgets.QFrame.HLine)\n self.line1_pag.setFrameShadow(QtWidgets.QFrame.Sunken)\n self.line1_pag.setObjectName(\"line1_pag\")\n self.twMenu.addTab(self.tab_Pagos, \"\")\n self.tab_Productos = QtWidgets.QWidget()\n self.tab_Productos.setObjectName(\"tab_Productos\")\n self.tvProductos_p = QtWidgets.QTableView(self.tab_Productos)\n self.tvProductos_p.setGeometry(QtCore.QRect(10, 60, 1141, 192))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.tvProductos_p.setFont(font)\n self.tvProductos_p.setObjectName(\"tvProductos_p\")\n self.cbFilterProducto_p = QtWidgets.QComboBox(self.tab_Productos)\n self.cbFilterProducto_p.setGeometry(QtCore.QRect(20, 20, 91, 22))\n self.cbFilterProducto_p.setStyleSheet(\"font: 9pt \\\"MS Shell Dlg 2\\\";\")\n self.cbFilterProducto_p.setObjectName(\"cbFilterProducto_p\")\n self.cbFilterProducto_p.addItem(\"\")\n self.cbFilterProducto_p.addItem(\"\")\n self.cbFilterProducto_p.addItem(\"\")\n self.cbFilterProducto_p.addItem(\"\")\n self.txtFilterProductos_p = QtWidgets.QLineEdit(self.tab_Productos)\n self.txtFilterProductos_p.setGeometry(QtCore.QRect(150, 20, 201, 20))\n self.txtFilterProductos_p.setStyleSheet(\"font: 9pt \\\"MS Shell Dlg 2\\\";\")\n self.txtFilterProductos_p.setObjectName(\"txtFilterProductos_p\")\n self.line1_p = QtWidgets.QFrame(self.tab_Productos)\n self.line1_p.setGeometry(QtCore.QRect(0, 260, 1171, 20))\n self.line1_p.setFrameShape(QtWidgets.QFrame.HLine)\n self.line1_p.setFrameShadow(QtWidgets.QFrame.Sunken)\n self.line1_p.setObjectName(\"line1_p\")\n self.btnBorrar_p = QtWidgets.QPushButton(self.tab_Productos)\n self.btnBorrar_p.setEnabled(False)\n self.btnBorrar_p.setGeometry(QtCore.QRect(1050, 490, 101, 41))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.btnBorrar_p.setFont(font)\n self.btnBorrar_p.setStyleSheet(\"background-color: rgb(255, 255, 255);\")\n self.btnBorrar_p.setIcon(icon3)\n self.btnBorrar_p.setIconSize(QtCore.QSize(20, 20))\n self.btnBorrar_p.setObjectName(\"btnBorrar_p\")\n self.btnModificar_p = QtWidgets.QPushButton(self.tab_Productos)\n self.btnModificar_p.setEnabled(False)\n self.btnModificar_p.setGeometry(QtCore.QRect(930, 490, 111, 41))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.btnModificar_p.setFont(font)\n self.btnModificar_p.setStyleSheet(\"background-color: rgb(255, 255, 255);\")\n icon4 = QtGui.QIcon()\n icon4.addPixmap(QtGui.QPixmap(\"../Img/actualizar.png\"), QtGui.QIcon.Normal, QtGui.QIcon.Off)\n self.btnModificar_p.setIcon(icon4)\n self.btnModificar_p.setIconSize(QtCore.QSize(20, 20))\n self.btnModificar_p.setObjectName(\"btnModificar_p\")\n self.btnAgregar_p = QtWidgets.QPushButton(self.tab_Productos)\n self.btnAgregar_p.setGeometry(QtCore.QRect(820, 490, 101, 41))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.btnAgregar_p.setFont(font)\n self.btnAgregar_p.setStyleSheet(\"background-color: rgb(255, 255, 255);\")\n icon5 = QtGui.QIcon()\n icon5.addPixmap(QtGui.QPixmap(\"../Img/agregar.png\"), QtGui.QIcon.Normal, QtGui.QIcon.Off)\n self.btnAgregar_p.setIcon(icon5)\n self.btnAgregar_p.setIconSize(QtCore.QSize(20, 20))\n self.btnAgregar_p.setObjectName(\"btnAgregar_p\")\n self.btnGuardar_p = QtWidgets.QPushButton(self.tab_Productos)\n self.btnGuardar_p.setEnabled(False)\n self.btnGuardar_p.setGeometry(QtCore.QRect(700, 490, 111, 41))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.btnGuardar_p.setFont(font)\n self.btnGuardar_p.setStyleSheet(\"background-color: rgb(255, 255, 255);\")\n self.btnGuardar_p.setIcon(icon2)\n self.btnGuardar_p.setIconSize(QtCore.QSize(20, 20))\n self.btnGuardar_p.setObjectName(\"btnGuardar_p\")\n self.wDatosProducto = QtWidgets.QWidget(self.tab_Productos)\n self.wDatosProducto.setEnabled(False)\n self.wDatosProducto.setGeometry(QtCore.QRect(10, 310, 1141, 171))\n self.wDatosProducto.setObjectName(\"wDatosProducto\")\n self.label2_p = QtWidgets.QLabel(self.wDatosProducto)\n self.label2_p.setGeometry(QtCore.QRect(5, 70, 131, 21))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.label2_p.setFont(font)\n self.label2_p.setObjectName(\"label2_p\")\n self.label8_p = QtWidgets.QLabel(self.wDatosProducto)\n self.label8_p.setGeometry(QtCore.QRect(323, 120, 71, 21))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.label8_p.setFont(font)\n self.label8_p.setObjectName(\"label8_p\")\n self.label1_p = QtWidgets.QLabel(self.wDatosProducto)\n self.label1_p.setGeometry(QtCore.QRect(47, 20, 71, 21))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.label1_p.setFont(font)\n self.label1_p.setObjectName(\"label1_p\")\n self.label6_p = QtWidgets.QLabel(self.wDatosProducto)\n self.label6_p.setGeometry(QtCore.QRect(315, 20, 81, 21))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.label6_p.setFont(font)\n self.label6_p.setObjectName(\"label6_p\")\n self.sbCantidad_p = QtWidgets.QSpinBox(self.wDatosProducto)\n self.sbCantidad_p.setGeometry(QtCore.QRect(420, 20, 131, 22))\n self.sbCantidad_p.setStyleSheet(\"font: 9pt \\\"MS Shell Dlg 2\\\";\")\n self.sbCantidad_p.setObjectName(\"sbCantidad_p\")\n self.btnMarca_p = QtWidgets.QPushButton(self.wDatosProducto)\n self.btnMarca_p.setGeometry(QtCore.QRect(550, 70, 21, 23))\n self.btnMarca_p.setText(\"\")\n self.btnMarca_p.setIcon(icon)\n self.btnMarca_p.setObjectName(\"btnMarca_p\")\n self.txtPrecioVenta_p = QtWidgets.QLineEdit(self.wDatosProducto)\n self.txtPrecioVenta_p.setGeometry(QtCore.QRect(200, 120, 71, 21))\n self.txtPrecioVenta_p.setStyleSheet(\"font: 9pt \\\"MS Shell Dlg 2\\\";\")\n self.txtPrecioVenta_p.setObjectName(\"txtPrecioVenta_p\")\n self.txtPrecioCompra_p = QtWidgets.QLineEdit(self.wDatosProducto)\n self.txtPrecioCompra_p.setGeometry(QtCore.QRect(200, 70, 71, 21))\n self.txtPrecioCompra_p.setStyleSheet(\"font: 9pt \\\"MS Shell Dlg 2\\\";\")\n self.txtPrecioCompra_p.setObjectName(\"txtPrecioCompra_p\")\n self.label10_p = QtWidgets.QLabel(self.wDatosProducto)\n self.label10_p.setGeometry(QtCore.QRect(597, 20, 91, 21))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.label10_p.setFont(font)\n self.label10_p.setObjectName(\"label10_p\")\n self.txtPrecioModelo_p = QtWidgets.QLineEdit(self.wDatosProducto)\n self.txtPrecioModelo_p.setGeometry(QtCore.QRect(420, 120, 131, 21))\n self.txtPrecioModelo_p.setStyleSheet(\"font: 9pt \\\"MS Shell Dlg 2\\\";\")\n self.txtPrecioModelo_p.setObjectName(\"txtPrecioModelo_p\")\n self.txtRubro_p = QtWidgets.QLineEdit(self.wDatosProducto)\n self.txtRubro_p.setGeometry(QtCore.QRect(700, 70, 131, 21))\n self.txtRubro_p.setStyleSheet(\"font: 9pt \\\"MS Shell Dlg 2\\\";\")\n self.txtRubro_p.setObjectName(\"txtRubro_p\")\n self.rbMasculino_p = QtWidgets.QRadioButton(self.wDatosProducto)\n self.rbMasculino_p.setGeometry(QtCore.QRect(1070, 20, 41, 17))\n font = QtGui.QFont()\n font.setFamily(\"MS Shell Dlg 2\")\n font.setPointSize(9)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(50)\n self.rbMasculino_p.setFont(font)\n self.rbMasculino_p.setStyleSheet(\"font: 9pt \\\"MS Shell Dlg 2\\\";\")\n self.rbMasculino_p.setObjectName(\"rbMasculino_p\")\n self.label3_p = QtWidgets.QLabel(self.wDatosProducto)\n self.label3_p.setGeometry(QtCore.QRect(160, 70, 16, 21))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.label3_p.setFont(font)\n self.label3_p.setObjectName(\"label3_p\")\n self.rbFemenino_p = QtWidgets.QRadioButton(self.wDatosProducto)\n self.rbFemenino_p.setGeometry(QtCore.QRect(1010, 20, 41, 17))\n font = QtGui.QFont()\n font.setFamily(\"MS Shell Dlg 2\")\n font.setPointSize(9)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(50)\n self.rbFemenino_p.setFont(font)\n self.rbFemenino_p.setStyleSheet(\"font: 9pt \\\"MS Shell Dlg 2\\\";\")\n self.rbFemenino_p.setObjectName(\"rbFemenino_p\")\n self.txtPrecioMarca_p = QtWidgets.QLineEdit(self.wDatosProducto)\n self.txtPrecioMarca_p.setGeometry(QtCore.QRect(420, 70, 131, 21))\n self.txtPrecioMarca_p.setStyleSheet(\"font: 9pt \\\"MS Shell Dlg 2\\\";\")\n self.txtPrecioMarca_p.setObjectName(\"txtPrecioMarca_p\")\n self.label7_p = QtWidgets.QLabel(self.wDatosProducto)\n self.label7_p.setGeometry(QtCore.QRect(334, 70, 71, 21))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.label7_p.setFont(font)\n self.label7_p.setObjectName(\"label7_p\")\n self.txtTipo_p = QtWidgets.QLineEdit(self.wDatosProducto)\n self.txtTipo_p.setGeometry(QtCore.QRect(700, 120, 131, 21))\n self.txtTipo_p.setStyleSheet(\"font: 9pt \\\"MS Shell Dlg 2\\\";\")\n self.txtTipo_p.setObjectName(\"txtTipo_p\")\n self.label12_p = QtWidgets.QLabel(self.wDatosProducto)\n self.label12_p.setGeometry(QtCore.QRect(634, 120, 51, 21))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.label12_p.setFont(font)\n self.label12_p.setObjectName(\"label12_p\")\n self.label4_p = QtWidgets.QLabel(self.wDatosProducto)\n self.label4_p.setGeometry(QtCore.QRect(20, 120, 111, 21))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.label4_p.setFont(font)\n self.label4_p.setObjectName(\"label4_p\")\n self.txtNombre_p = QtWidgets.QLineEdit(self.wDatosProducto)\n self.txtNombre_p.setGeometry(QtCore.QRect(140, 20, 131, 21))\n self.txtNombre_p.setStyleSheet(\"font: 9pt \\\"MS Shell Dlg 2\\\";\")\n self.txtNombre_p.setObjectName(\"txtNombre_p\")\n self.label5_p = QtWidgets.QLabel(self.wDatosProducto)\n self.label5_p.setGeometry(QtCore.QRect(160, 120, 16, 21))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.label5_p.setFont(font)\n self.label5_p.setObjectName(\"label5_p\")\n self.btnRubro_p = QtWidgets.QPushButton(self.wDatosProducto)\n self.btnRubro_p.setGeometry(QtCore.QRect(830, 70, 21, 23))\n self.btnRubro_p.setText(\"\")\n self.btnRubro_p.setIcon(icon)\n self.btnRubro_p.setObjectName(\"btnRubro_p\")\n self.txtDescripcion_p = QtWidgets.QTextEdit(self.wDatosProducto)\n self.txtDescripcion_p.setGeometry(QtCore.QRect(910, 100, 221, 61))\n self.txtDescripcion_p.setStyleSheet(\"font: 9pt \\\"MS Shell Dlg 2\\\";\")\n self.txtDescripcion_p.setObjectName(\"txtDescripcion_p\")\n self.txtProveedor_p = QtWidgets.QLineEdit(self.wDatosProducto)\n self.txtProveedor_p.setGeometry(QtCore.QRect(700, 20, 131, 21))\n self.txtProveedor_p.setStyleSheet(\"font: 9pt \\\"MS Shell Dlg 2\\\";\")\n self.txtProveedor_p.setObjectName(\"txtProveedor_p\")\n self.label11_p = QtWidgets.QLabel(self.wDatosProducto)\n self.label11_p.setGeometry(QtCore.QRect(625, 70, 71, 21))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.label11_p.setFont(font)\n self.label11_p.setObjectName(\"label11_p\")\n self.label13_p = QtWidgets.QLabel(self.wDatosProducto)\n self.label13_p.setGeometry(QtCore.QRect(922, 20, 71, 21))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.label13_p.setFont(font)\n self.label13_p.setObjectName(\"label13_p\")\n self.label14_p = QtWidgets.QLabel(self.wDatosProducto)\n self.label14_p.setGeometry(QtCore.QRect(877, 70, 111, 21))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.label14_p.setFont(font)\n self.label14_p.setObjectName(\"label14_p\")\n self.twMenu.addTab(self.tab_Productos, \"\")\n self.tab_Clientes = QtWidgets.QWidget()\n self.tab_Clientes.setObjectName(\"tab_Clientes\")\n self.txtFilterClientes_c = QtWidgets.QLineEdit(self.tab_Clientes)\n self.txtFilterClientes_c.setGeometry(QtCore.QRect(150, 20, 201, 20))\n self.txtFilterClientes_c.setStyleSheet(\"font: 9pt \\\"MS Shell Dlg 2\\\";\")\n self.txtFilterClientes_c.setObjectName(\"txtFilterClientes_c\")\n self.cbFilterClientes_c = QtWidgets.QComboBox(self.tab_Clientes)\n self.cbFilterClientes_c.setGeometry(QtCore.QRect(20, 20, 91, 22))\n self.cbFilterClientes_c.setStyleSheet(\"font: 9pt \\\"MS Shell Dlg 2\\\";\")\n self.cbFilterClientes_c.setObjectName(\"cbFilterClientes_c\")\n self.cbFilterClientes_c.addItem(\"\")\n self.cbFilterClientes_c.addItem(\"\")\n self.line1_c = QtWidgets.QFrame(self.tab_Clientes)\n self.line1_c.setGeometry(QtCore.QRect(0, 260, 1171, 20))\n self.line1_c.setFrameShape(QtWidgets.QFrame.HLine)\n self.line1_c.setFrameShadow(QtWidgets.QFrame.Sunken)\n self.line1_c.setObjectName(\"line1_c\")\n self.tvClientes_c = QtWidgets.QTableView(self.tab_Clientes)\n self.tvClientes_c.setGeometry(QtCore.QRect(10, 60, 1141, 192))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.tvClientes_c.setFont(font)\n self.tvClientes_c.setObjectName(\"tvClientes_c\")\n self.btnBorrar_c = QtWidgets.QPushButton(self.tab_Clientes)\n self.btnBorrar_c.setEnabled(False)\n self.btnBorrar_c.setGeometry(QtCore.QRect(1050, 490, 101, 41))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.btnBorrar_c.setFont(font)\n self.btnBorrar_c.setStyleSheet(\"background-color: rgb(255, 255, 255);\")\n self.btnBorrar_c.setIcon(icon3)\n self.btnBorrar_c.setIconSize(QtCore.QSize(20, 20))\n self.btnBorrar_c.setObjectName(\"btnBorrar_c\")\n self.btnGuardar_c = QtWidgets.QPushButton(self.tab_Clientes)\n self.btnGuardar_c.setEnabled(False)\n self.btnGuardar_c.setGeometry(QtCore.QRect(700, 490, 111, 41))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.btnGuardar_c.setFont(font)\n self.btnGuardar_c.setStyleSheet(\"background-color: rgb(255, 255, 255);\")\n self.btnGuardar_c.setIcon(icon2)\n self.btnGuardar_c.setIconSize(QtCore.QSize(20, 20))\n self.btnGuardar_c.setObjectName(\"btnGuardar_c\")\n self.btnAgregar_c = QtWidgets.QPushButton(self.tab_Clientes)\n self.btnAgregar_c.setGeometry(QtCore.QRect(820, 490, 101, 41))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.btnAgregar_c.setFont(font)\n self.btnAgregar_c.setStyleSheet(\"background-color: rgb(255, 255, 255);\")\n self.btnAgregar_c.setIcon(icon5)\n self.btnAgregar_c.setIconSize(QtCore.QSize(20, 20))\n self.btnAgregar_c.setObjectName(\"btnAgregar_c\")\n self.btnModificar_c = QtWidgets.QPushButton(self.tab_Clientes)\n self.btnModificar_c.setEnabled(False)\n self.btnModificar_c.setGeometry(QtCore.QRect(930, 490, 111, 41))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.btnModificar_c.setFont(font)\n self.btnModificar_c.setStyleSheet(\"background-color: rgb(255, 255, 255);\")\n self.btnModificar_c.setIcon(icon4)\n self.btnModificar_c.setIconSize(QtCore.QSize(20, 20))\n self.btnModificar_c.setObjectName(\"btnModificar_c\")\n self.wDatosCliente = QtWidgets.QWidget(self.tab_Clientes)\n self.wDatosCliente.setEnabled(False)\n self.wDatosCliente.setGeometry(QtCore.QRect(10, 310, 1141, 171))\n self.wDatosCliente.setObjectName(\"wDatosCliente\")\n self.txtApellido_c = QtWidgets.QLineEdit(self.wDatosCliente)\n self.txtApellido_c.setGeometry(QtCore.QRect(140, 80, 171, 21))\n self.txtApellido_c.setStyleSheet(\"font: 9pt \\\"MS Shell Dlg 2\\\";\")\n self.txtApellido_c.setObjectName(\"txtApellido_c\")\n self.txtDPiso_c = QtWidgets.QLineEdit(self.wDatosCliente)\n self.txtDPiso_c.setGeometry(QtCore.QRect(708, 80, 31, 21))\n self.txtDPiso_c.setStyleSheet(\"font: 9pt \\\"MS Shell Dlg 2\\\";\")\n self.txtDPiso_c.setObjectName(\"txtDPiso_c\")\n self.label7_c = QtWidgets.QLabel(self.wDatosCliente)\n self.label7_c.setGeometry(QtCore.QRect(745, 80, 41, 21))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.label7_c.setFont(font)\n self.label7_c.setObjectName(\"label7_c\")\n self.btnSumarTelefono_c = QtWidgets.QPushButton(self.wDatosCliente)\n self.btnSumarTelefono_c.setEnabled(False)\n self.btnSumarTelefono_c.setGeometry(QtCore.QRect(1110, 20, 21, 23))\n self.btnSumarTelefono_c.setText(\"\")\n self.btnSumarTelefono_c.setIcon(icon)\n self.btnSumarTelefono_c.setObjectName(\"btnSumarTelefono_c\")\n self.label1_c = QtWidgets.QLabel(self.wDatosCliente)\n self.label1_c.setGeometry(QtCore.QRect(40, 20, 71, 21))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.label1_c.setFont(font)\n self.label1_c.setObjectName(\"label1_c\")\n self.label5_c = QtWidgets.QLabel(self.wDatosCliente)\n self.label5_c.setGeometry(QtCore.QRect(596, 80, 31, 21))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.label5_c.setFont(font)\n self.label5_c.setObjectName(\"label5_c\")\n self.btnRestarTelefono_c = QtWidgets.QPushButton(self.wDatosCliente)\n self.btnRestarTelefono_c.setGeometry(QtCore.QRect(1110, 110, 21, 23))\n self.btnRestarTelefono_c.setText(\"\")\n self.btnRestarTelefono_c.setIcon(icon1)\n self.btnRestarTelefono_c.setObjectName(\"btnRestarTelefono_c\")\n self.txtDDpto_c = QtWidgets.QLineEdit(self.wDatosCliente)\n self.txtDDpto_c.setGeometry(QtCore.QRect(780, 80, 31, 21))\n self.txtDDpto_c.setStyleSheet(\"font: 9pt \\\"MS Shell Dlg 2\\\";\")\n self.txtDDpto_c.setObjectName(\"txtDDpto_c\")\n self.txtDNumero_c = QtWidgets.QLineEdit(self.wDatosCliente)\n self.txtDNumero_c.setGeometry(QtCore.QRect(630, 80, 41, 21))\n self.txtDNumero_c.setStyleSheet(\"font: 9pt \\\"MS Shell Dlg 2\\\";\")\n self.txtDNumero_c.setObjectName(\"txtDNumero_c\")\n self.txtNombre_c = QtWidgets.QLineEdit(self.wDatosCliente)\n self.txtNombre_c.setGeometry(QtCore.QRect(140, 20, 171, 21))\n self.txtNombre_c.setStyleSheet(\"font: 9pt \\\"MS Shell Dlg 2\\\";\")\n self.txtNombre_c.setObjectName(\"txtNombre_c\")\n self.label2_c = QtWidgets.QLabel(self.wDatosCliente)\n self.label2_c.setGeometry(QtCore.QRect(38, 80, 81, 21))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.label2_c.setFont(font)\n self.label2_c.setObjectName(\"label2_c\")\n self.label3_c = QtWidgets.QLabel(self.wDatosCliente)\n self.label3_c.setGeometry(QtCore.QRect(368, 20, 71, 21))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.label3_c.setFont(font)\n self.label3_c.setObjectName(\"label3_c\")\n self.tvTelefonos_c = QtWidgets.QTableView(self.wDatosCliente)\n self.tvTelefonos_c.setGeometry(QtCore.QRect(870, 80, 231, 61))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.tvTelefonos_c.setFont(font)\n self.tvTelefonos_c.setObjectName(\"tvTelefonos_c\")\n self.txtDireccion_c = QtWidgets.QLineEdit(self.wDatosCliente)\n self.txtDireccion_c.setGeometry(QtCore.QRect(440, 80, 151, 21))\n self.txtDireccion_c.setStyleSheet(\"font: 9pt \\\"MS Shell Dlg 2\\\";\")\n self.txtDireccion_c.setObjectName(\"txtDireccion_c\")\n self.label6_c = QtWidgets.QLabel(self.wDatosCliente)\n self.label6_c.setGeometry(QtCore.QRect(675, 80, 31, 21))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.label6_c.setFont(font)\n self.label6_c.setObjectName(\"label6_c\")\n self.label8_c = QtWidgets.QLabel(self.wDatosCliente)\n self.label8_c.setGeometry(QtCore.QRect(858, 18, 91, 21))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.label8_c.setFont(font)\n self.label8_c.setObjectName(\"label8_c\")\n self.txtTelefono_c = QtWidgets.QLineEdit(self.wDatosCliente)\n self.txtTelefono_c.setGeometry(QtCore.QRect(960, 20, 141, 21))\n self.txtTelefono_c.setStyleSheet(\"font: 9pt \\\"MS Shell Dlg 2\\\";\")\n self.txtTelefono_c.setObjectName(\"txtTelefono_c\")\n self.txtEmail_c = QtWidgets.QLineEdit(self.wDatosCliente)\n self.txtEmail_c.setGeometry(QtCore.QRect(440, 20, 371, 21))\n self.txtEmail_c.setStyleSheet(\"font: 9pt \\\"MS Shell Dlg 2\\\";\")\n self.txtEmail_c.setObjectName(\"txtEmail_c\")\n self.label4_c = QtWidgets.QLabel(self.wDatosCliente)\n self.label4_c.setGeometry(QtCore.QRect(341, 80, 101, 21))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.label4_c.setFont(font)\n self.label4_c.setObjectName(\"label4_c\")\n self.btnCel_c = QtWidgets.QPushButton(self.wDatosCliente)\n self.btnCel_c.setGeometry(QtCore.QRect(1040, 50, 21, 23))\n self.btnCel_c.setText(\"\")\n icon6 = QtGui.QIcon()\n icon6.addPixmap(QtGui.QPixmap(\"../Img/icon-cel.png\"), QtGui.QIcon.Normal, QtGui.QIcon.Off)\n self.btnCel_c.setIcon(icon6)\n self.btnCel_c.setObjectName(\"btnCel_c\")\n self.btnFax_c = QtWidgets.QPushButton(self.wDatosCliente)\n self.btnFax_c.setGeometry(QtCore.QRect(1070, 50, 21, 23))\n self.btnFax_c.setText(\"\")\n icon7 = QtGui.QIcon()\n icon7.addPixmap(QtGui.QPixmap(\"../Img/icon-fax.png\"), QtGui.QIcon.Normal, QtGui.QIcon.Off)\n self.btnFax_c.setIcon(icon7)\n self.btnFax_c.setObjectName(\"btnFax_c\")\n self.btnTel_c = QtWidgets.QPushButton(self.wDatosCliente)\n self.btnTel_c.setGeometry(QtCore.QRect(1010, 50, 21, 23))\n self.btnTel_c.setText(\"\")\n icon8 = QtGui.QIcon()\n icon8.addPixmap(QtGui.QPixmap(\"../Img/icon-tel.png\"), QtGui.QIcon.Normal, QtGui.QIcon.Off)\n self.btnTel_c.setIcon(icon8)\n self.btnTel_c.setObjectName(\"btnTel_c\")\n self.cbTelefono_c = QtWidgets.QCheckBox(self.wDatosCliente)\n self.cbTelefono_c.setGeometry(QtCore.QRect(940, 20, 21, 17))\n self.cbTelefono_c.setText(\"\")\n self.cbTelefono_c.setObjectName(\"cbTelefono_c\")\n self.twMenu.addTab(self.tab_Clientes, \"\")\n self.tab_Proovedores = QtWidgets.QWidget()\n self.tab_Proovedores.setObjectName(\"tab_Proovedores\")\n self.cbFilterProveedores_prov = QtWidgets.QComboBox(self.tab_Proovedores)\n self.cbFilterProveedores_prov.setGeometry(QtCore.QRect(20, 20, 91, 22))\n self.cbFilterProveedores_prov.setStyleSheet(\"font: 9pt \\\"MS Shell Dlg 2\\\";\")\n self.cbFilterProveedores_prov.setObjectName(\"cbFilterProveedores_prov\")\n self.cbFilterProveedores_prov.addItem(\"\")\n self.cbFilterProveedores_prov.addItem(\"\")\n self.tvProveedores_prov = QtWidgets.QTableView(self.tab_Proovedores)\n self.tvProveedores_prov.setGeometry(QtCore.QRect(10, 60, 1141, 192))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.tvProveedores_prov.setFont(font)\n self.tvProveedores_prov.setObjectName(\"tvProveedores_prov\")\n self.line1_prov = QtWidgets.QFrame(self.tab_Proovedores)\n self.line1_prov.setGeometry(QtCore.QRect(0, 260, 1171, 20))\n self.line1_prov.setFrameShape(QtWidgets.QFrame.HLine)\n self.line1_prov.setFrameShadow(QtWidgets.QFrame.Sunken)\n self.line1_prov.setObjectName(\"line1_prov\")\n self.txtFilterProveedores_prov = QtWidgets.QLineEdit(self.tab_Proovedores)\n self.txtFilterProveedores_prov.setGeometry(QtCore.QRect(150, 20, 201, 20))\n self.txtFilterProveedores_prov.setStyleSheet(\"font: 9pt \\\"MS Shell Dlg 2\\\";\")\n self.txtFilterProveedores_prov.setObjectName(\"txtFilterProveedores_prov\")\n self.btnBorrar_prov = QtWidgets.QPushButton(self.tab_Proovedores)\n self.btnBorrar_prov.setEnabled(False)\n self.btnBorrar_prov.setGeometry(QtCore.QRect(1050, 490, 101, 41))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.btnBorrar_prov.setFont(font)\n self.btnBorrar_prov.setStyleSheet(\"background-color: rgb(255, 255, 255);\")\n self.btnBorrar_prov.setIcon(icon3)\n self.btnBorrar_prov.setIconSize(QtCore.QSize(20, 20))\n self.btnBorrar_prov.setObjectName(\"btnBorrar_prov\")\n self.btnGuardar_prov = QtWidgets.QPushButton(self.tab_Proovedores)\n self.btnGuardar_prov.setEnabled(False)\n self.btnGuardar_prov.setGeometry(QtCore.QRect(700, 490, 111, 41))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.btnGuardar_prov.setFont(font)\n self.btnGuardar_prov.setStyleSheet(\"background-color: rgb(255, 255, 255);\")\n self.btnGuardar_prov.setIcon(icon2)\n self.btnGuardar_prov.setIconSize(QtCore.QSize(20, 20))\n self.btnGuardar_prov.setObjectName(\"btnGuardar_prov\")\n self.btnAgregar_prov = QtWidgets.QPushButton(self.tab_Proovedores)\n self.btnAgregar_prov.setGeometry(QtCore.QRect(820, 490, 101, 41))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.btnAgregar_prov.setFont(font)\n self.btnAgregar_prov.setStyleSheet(\"background-color: rgb(255, 255, 255);\")\n self.btnAgregar_prov.setIcon(icon5)\n self.btnAgregar_prov.setIconSize(QtCore.QSize(20, 20))\n self.btnAgregar_prov.setObjectName(\"btnAgregar_prov\")\n self.btnModificar_prov = QtWidgets.QPushButton(self.tab_Proovedores)\n self.btnModificar_prov.setEnabled(False)\n self.btnModificar_prov.setGeometry(QtCore.QRect(930, 490, 111, 41))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.btnModificar_prov.setFont(font)\n self.btnModificar_prov.setStyleSheet(\"background-color: rgb(255, 255, 255);\")\n self.btnModificar_prov.setIcon(icon4)\n self.btnModificar_prov.setIconSize(QtCore.QSize(20, 20))\n self.btnModificar_prov.setObjectName(\"btnModificar_prov\")\n self.wDatosProveedor = QtWidgets.QWidget(self.tab_Proovedores)\n self.wDatosProveedor.setEnabled(False)\n self.wDatosProveedor.setGeometry(QtCore.QRect(10, 310, 1131, 171))\n self.wDatosProveedor.setObjectName(\"wDatosProveedor\")\n self.label8_prov = QtWidgets.QLabel(self.wDatosProveedor)\n self.label8_prov.setGeometry(QtCore.QRect(858, 18, 91, 21))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.label8_prov.setFont(font)\n self.label8_prov.setObjectName(\"label8_prov\")\n self.label5_prov = QtWidgets.QLabel(self.wDatosProveedor)\n self.label5_prov.setGeometry(QtCore.QRect(596, 80, 31, 21))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.label5_prov.setFont(font)\n self.label5_prov.setObjectName(\"label5_prov\")\n self.btnSumarTelefono_prov = QtWidgets.QPushButton(self.wDatosProveedor)\n self.btnSumarTelefono_prov.setEnabled(False)\n self.btnSumarTelefono_prov.setGeometry(QtCore.QRect(1110, 20, 21, 23))\n self.btnSumarTelefono_prov.setText(\"\")\n self.btnSumarTelefono_prov.setIcon(icon)\n self.btnSumarTelefono_prov.setObjectName(\"btnSumarTelefono_prov\")\n self.txtNombre_prov = QtWidgets.QLineEdit(self.wDatosProveedor)\n self.txtNombre_prov.setGeometry(QtCore.QRect(140, 20, 171, 21))\n self.txtNombre_prov.setStyleSheet(\"font: 9pt \\\"MS Shell Dlg 2\\\";\")\n self.txtNombre_prov.setObjectName(\"txtNombre_prov\")\n self.txtDNumero_prov = QtWidgets.QLineEdit(self.wDatosProveedor)\n self.txtDNumero_prov.setGeometry(QtCore.QRect(630, 80, 41, 21))\n self.txtDNumero_prov.setStyleSheet(\"font: 9pt \\\"MS Shell Dlg 2\\\";\")\n self.txtDNumero_prov.setObjectName(\"txtDNumero_prov\")\n self.txtDireccion_prov = QtWidgets.QLineEdit(self.wDatosProveedor)\n self.txtDireccion_prov.setGeometry(QtCore.QRect(440, 80, 151, 21))\n self.txtDireccion_prov.setStyleSheet(\"font: 9pt \\\"MS Shell Dlg 2\\\";\")\n self.txtDireccion_prov.setObjectName(\"txtDireccion_prov\")\n self.txtDPiso_prov = QtWidgets.QLineEdit(self.wDatosProveedor)\n self.txtDPiso_prov.setGeometry(QtCore.QRect(708, 80, 31, 21))\n self.txtDPiso_prov.setStyleSheet(\"font: 9pt \\\"MS Shell Dlg 2\\\";\")\n self.txtDPiso_prov.setObjectName(\"txtDPiso_prov\")\n self.txtEmail_prov = QtWidgets.QLineEdit(self.wDatosProveedor)\n self.txtEmail_prov.setGeometry(QtCore.QRect(440, 20, 371, 21))\n self.txtEmail_prov.setStyleSheet(\"font: 9pt \\\"MS Shell Dlg 2\\\";\")\n self.txtEmail_prov.setObjectName(\"txtEmail_prov\")\n self.label3_prov = QtWidgets.QLabel(self.wDatosProveedor)\n self.label3_prov.setGeometry(QtCore.QRect(368, 20, 71, 21))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.label3_prov.setFont(font)\n self.label3_prov.setObjectName(\"label3_prov\")\n self.label1_prov = QtWidgets.QLabel(self.wDatosProveedor)\n self.label1_prov.setGeometry(QtCore.QRect(40, 20, 71, 21))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.label1_prov.setFont(font)\n self.label1_prov.setObjectName(\"label1_prov\")\n self.label6_prov = QtWidgets.QLabel(self.wDatosProveedor)\n self.label6_prov.setGeometry(QtCore.QRect(675, 80, 31, 21))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.label6_prov.setFont(font)\n self.label6_prov.setObjectName(\"label6_prov\")\n self.txtDDpto_prov = QtWidgets.QLineEdit(self.wDatosProveedor)\n self.txtDDpto_prov.setGeometry(QtCore.QRect(780, 80, 31, 21))\n self.txtDDpto_prov.setStyleSheet(\"font: 9pt \\\"MS Shell Dlg 2\\\";\")\n self.txtDDpto_prov.setObjectName(\"txtDDpto_prov\")\n self.txtDescripcion_prov = QtWidgets.QLineEdit(self.wDatosProveedor)\n self.txtDescripcion_prov.setGeometry(QtCore.QRect(140, 80, 171, 21))\n self.txtDescripcion_prov.setStyleSheet(\"font: 9pt \\\"MS Shell Dlg 2\\\";\")\n self.txtDescripcion_prov.setObjectName(\"txtDescripcion_prov\")\n self.label4_prov = QtWidgets.QLabel(self.wDatosProveedor)\n self.label4_prov.setGeometry(QtCore.QRect(342, 80, 101, 21))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.label4_prov.setFont(font)\n self.label4_prov.setObjectName(\"label4_prov\")\n self.label7_prov = QtWidgets.QLabel(self.wDatosProveedor)\n self.label7_prov.setGeometry(QtCore.QRect(745, 80, 41, 21))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.label7_prov.setFont(font)\n self.label7_prov.setObjectName(\"label7_prov\")\n self.tvTelefonos_prov = QtWidgets.QTableView(self.wDatosProveedor)\n self.tvTelefonos_prov.setGeometry(QtCore.QRect(870, 80, 231, 61))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.tvTelefonos_prov.setFont(font)\n self.tvTelefonos_prov.setObjectName(\"tvTelefonos_prov\")\n self.label2_prov = QtWidgets.QLabel(self.wDatosProveedor)\n self.label2_prov.setGeometry(QtCore.QRect(18, 80, 111, 21))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.label2_prov.setFont(font)\n self.label2_prov.setObjectName(\"label2_prov\")\n self.btnRestarTelefono_prov = QtWidgets.QPushButton(self.wDatosProveedor)\n self.btnRestarTelefono_prov.setGeometry(QtCore.QRect(1110, 110, 21, 23))\n self.btnRestarTelefono_prov.setText(\"\")\n self.btnRestarTelefono_prov.setIcon(icon1)\n self.btnRestarTelefono_prov.setObjectName(\"btnRestarTelefono_prov\")\n self.txtTelefono_prov = QtWidgets.QLineEdit(self.wDatosProveedor)\n self.txtTelefono_prov.setGeometry(QtCore.QRect(960, 20, 141, 21))\n self.txtTelefono_prov.setStyleSheet(\"font: 9pt \\\"MS Shell Dlg 2\\\";\")\n self.txtTelefono_prov.setObjectName(\"txtTelefono_prov\")\n self.label1_prov_2 = QtWidgets.QLabel(self.wDatosProveedor)\n self.label1_prov_2.setGeometry(QtCore.QRect(63, 130, 71, 21))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.label1_prov_2.setFont(font)\n self.label1_prov_2.setObjectName(\"label1_prov_2\")\n self.txtWeb_prov = QtWidgets.QLineEdit(self.wDatosProveedor)\n self.txtWeb_prov.setGeometry(QtCore.QRect(140, 130, 351, 21))\n self.txtWeb_prov.setStyleSheet(\"font: 9pt \\\"MS Shell Dlg 2\\\";\")\n self.txtWeb_prov.setObjectName(\"txtWeb_prov\")\n self.btnTel_prov = QtWidgets.QPushButton(self.wDatosProveedor)\n self.btnTel_prov.setGeometry(QtCore.QRect(1010, 50, 21, 23))\n self.btnTel_prov.setText(\"\")\n self.btnTel_prov.setIcon(icon8)\n self.btnTel_prov.setObjectName(\"btnTel_prov\")\n self.btnCel_prov = QtWidgets.QPushButton(self.wDatosProveedor)\n self.btnCel_prov.setGeometry(QtCore.QRect(1040, 50, 21, 23))\n self.btnCel_prov.setText(\"\")\n self.btnCel_prov.setIcon(icon6)\n self.btnCel_prov.setObjectName(\"btnCel_prov\")\n self.btnFax_prov = QtWidgets.QPushButton(self.wDatosProveedor)\n self.btnFax_prov.setGeometry(QtCore.QRect(1070, 50, 21, 23))\n self.btnFax_prov.setText(\"\")\n self.btnFax_prov.setIcon(icon7)\n self.btnFax_prov.setObjectName(\"btnFax_prov\")\n self.cbTelefono_prov = QtWidgets.QCheckBox(self.wDatosProveedor)\n self.cbTelefono_prov.setGeometry(QtCore.QRect(940, 20, 21, 17))\n self.cbTelefono_prov.setText(\"\")\n self.cbTelefono_prov.setObjectName(\"cbTelefono_prov\")\n self.twMenu.addTab(self.tab_Proovedores, \"\")\n self.tab_Usuarios = QtWidgets.QWidget()\n self.tab_Usuarios.setObjectName(\"tab_Usuarios\")\n self.txtFilterUsuario_u = QtWidgets.QLineEdit(self.tab_Usuarios)\n self.txtFilterUsuario_u.setGeometry(QtCore.QRect(150, 20, 201, 20))\n self.txtFilterUsuario_u.setStyleSheet(\"font: 9pt \\\"MS Shell Dlg 2\\\";\")\n self.txtFilterUsuario_u.setObjectName(\"txtFilterUsuario_u\")\n self.btnGuardar_u = QtWidgets.QPushButton(self.tab_Usuarios)\n self.btnGuardar_u.setEnabled(False)\n self.btnGuardar_u.setGeometry(QtCore.QRect(700, 490, 111, 41))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.btnGuardar_u.setFont(font)\n self.btnGuardar_u.setStyleSheet(\"background-color: rgb(255, 255, 255);\")\n self.btnGuardar_u.setIcon(icon2)\n self.btnGuardar_u.setIconSize(QtCore.QSize(20, 20))\n self.btnGuardar_u.setObjectName(\"btnGuardar_u\")\n self.cbFilterUsuario_u = QtWidgets.QComboBox(self.tab_Usuarios)\n self.cbFilterUsuario_u.setGeometry(QtCore.QRect(20, 20, 91, 22))\n self.cbFilterUsuario_u.setStyleSheet(\"font: 9pt \\\"MS Shell Dlg 2\\\";\")\n self.cbFilterUsuario_u.setObjectName(\"cbFilterUsuario_u\")\n self.cbFilterUsuario_u.addItem(\"\")\n self.cbFilterUsuario_u.addItem(\"\")\n self.cbFilterUsuario_u.addItem(\"\")\n self.tvUsuarios_u = QtWidgets.QTableView(self.tab_Usuarios)\n self.tvUsuarios_u.setGeometry(QtCore.QRect(10, 60, 1141, 192))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.tvUsuarios_u.setFont(font)\n self.tvUsuarios_u.setObjectName(\"tvUsuarios_u\")\n self.btnAgregar_u = QtWidgets.QPushButton(self.tab_Usuarios)\n self.btnAgregar_u.setGeometry(QtCore.QRect(820, 490, 101, 41))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.btnAgregar_u.setFont(font)\n self.btnAgregar_u.setStyleSheet(\"background-color: rgb(255, 255, 255);\")\n self.btnAgregar_u.setIcon(icon5)\n self.btnAgregar_u.setIconSize(QtCore.QSize(20, 20))\n self.btnAgregar_u.setObjectName(\"btnAgregar_u\")\n self.line1_u = QtWidgets.QFrame(self.tab_Usuarios)\n self.line1_u.setGeometry(QtCore.QRect(0, 260, 1171, 20))\n self.line1_u.setFrameShape(QtWidgets.QFrame.HLine)\n self.line1_u.setFrameShadow(QtWidgets.QFrame.Sunken)\n self.line1_u.setObjectName(\"line1_u\")\n self.btnModificar_u = QtWidgets.QPushButton(self.tab_Usuarios)\n self.btnModificar_u.setEnabled(False)\n self.btnModificar_u.setGeometry(QtCore.QRect(930, 490, 111, 41))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.btnModificar_u.setFont(font)\n self.btnModificar_u.setStyleSheet(\"background-color: rgb(255, 255, 255);\")\n self.btnModificar_u.setIcon(icon4)\n self.btnModificar_u.setIconSize(QtCore.QSize(20, 20))\n self.btnModificar_u.setObjectName(\"btnModificar_u\")\n self.btnBorrar_u = QtWidgets.QPushButton(self.tab_Usuarios)\n self.btnBorrar_u.setEnabled(False)\n self.btnBorrar_u.setGeometry(QtCore.QRect(1050, 490, 101, 41))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.btnBorrar_u.setFont(font)\n self.btnBorrar_u.setStyleSheet(\"background-color: rgb(255, 255, 255);\")\n self.btnBorrar_u.setIcon(icon3)\n self.btnBorrar_u.setIconSize(QtCore.QSize(20, 20))\n self.btnBorrar_u.setObjectName(\"btnBorrar_u\")\n self.wDatosUsuario = QtWidgets.QWidget(self.tab_Usuarios)\n self.wDatosUsuario.setEnabled(False)\n self.wDatosUsuario.setGeometry(QtCore.QRect(10, 310, 1141, 171))\n self.wDatosUsuario.setObjectName(\"wDatosUsuario\")\n self.label5_u = QtWidgets.QLabel(self.wDatosUsuario)\n self.label5_u.setGeometry(QtCore.QRect(342, 80, 101, 21))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.label5_u.setFont(font)\n self.label5_u.setObjectName(\"label5_u\")\n self.label1_u = QtWidgets.QLabel(self.wDatosUsuario)\n self.label1_u.setGeometry(QtCore.QRect(40, 20, 71, 21))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.label1_u.setFont(font)\n self.label1_u.setObjectName(\"label1_u\")\n self.txtNombre_u = QtWidgets.QLineEdit(self.wDatosUsuario)\n self.txtNombre_u.setGeometry(QtCore.QRect(140, 20, 171, 21))\n self.txtNombre_u.setStyleSheet(\"font: 9pt \\\"MS Shell Dlg 2\\\";\")\n self.txtNombre_u.setObjectName(\"txtNombre_u\")\n self.txtDireccion_u = QtWidgets.QLineEdit(self.wDatosUsuario)\n self.txtDireccion_u.setGeometry(QtCore.QRect(440, 80, 151, 21))\n self.txtDireccion_u.setStyleSheet(\"font: 9pt \\\"MS Shell Dlg 2\\\";\")\n self.txtDireccion_u.setObjectName(\"txtDireccion_u\")\n self.txtApellido_u = QtWidgets.QLineEdit(self.wDatosUsuario)\n self.txtApellido_u.setGeometry(QtCore.QRect(140, 80, 171, 21))\n self.txtApellido_u.setStyleSheet(\"font: 9pt \\\"MS Shell Dlg 2\\\";\")\n self.txtApellido_u.setObjectName(\"txtApellido_u\")\n self.cbTipoUsuario_u = QtWidgets.QComboBox(self.wDatosUsuario)\n self.cbTipoUsuario_u.setGeometry(QtCore.QRect(757, 140, 81, 22))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.cbTipoUsuario_u.setFont(font)\n self.cbTipoUsuario_u.setObjectName(\"cbTipoUsuario_u\")\n self.cbTipoUsuario_u.addItem(\"\")\n self.cbTipoUsuario_u.addItem(\"\")\n self.label8_u = QtWidgets.QLabel(self.wDatosUsuario)\n self.label8_u.setGeometry(QtCore.QRect(745, 80, 41, 21))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.label8_u.setFont(font)\n self.label8_u.setObjectName(\"label8_u\")\n self.txtContrasena_u = QtWidgets.QLineEdit(self.wDatosUsuario)\n self.txtContrasena_u.setGeometry(QtCore.QRect(440, 140, 171, 21))\n self.txtContrasena_u.setStyleSheet(\"font: 9pt \\\"MS Shell Dlg 2\\\";\")\n self.txtContrasena_u.setObjectName(\"txtContrasena_u\")\n self.label7_u = QtWidgets.QLabel(self.wDatosUsuario)\n self.label7_u.setGeometry(QtCore.QRect(675, 80, 31, 21))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.label7_u.setFont(font)\n self.label7_u.setObjectName(\"label7_u\")\n self.txtDDpto_u = QtWidgets.QLineEdit(self.wDatosUsuario)\n self.txtDDpto_u.setGeometry(QtCore.QRect(780, 80, 31, 21))\n self.txtDDpto_u.setStyleSheet(\"font: 9pt \\\"MS Shell Dlg 2\\\";\")\n self.txtDDpto_u.setObjectName(\"txtDDpto_u\")\n self.label2_u = QtWidgets.QLabel(self.wDatosUsuario)\n self.label2_u.setGeometry(QtCore.QRect(39, 80, 81, 21))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.label2_u.setFont(font)\n self.label2_u.setObjectName(\"label2_u\")\n self.txtEmail_u = QtWidgets.QLineEdit(self.wDatosUsuario)\n self.txtEmail_u.setGeometry(QtCore.QRect(440, 20, 371, 21))\n self.txtEmail_u.setStyleSheet(\"font: 9pt \\\"MS Shell Dlg 2\\\";\")\n self.txtEmail_u.setObjectName(\"txtEmail_u\")\n self.btnSumarTelefono_u = QtWidgets.QPushButton(self.wDatosUsuario)\n self.btnSumarTelefono_u.setEnabled(False)\n self.btnSumarTelefono_u.setGeometry(QtCore.QRect(1110, 20, 21, 23))\n self.btnSumarTelefono_u.setText(\"\")\n self.btnSumarTelefono_u.setIcon(icon)\n self.btnSumarTelefono_u.setObjectName(\"btnSumarTelefono_u\")\n self.label3_u = QtWidgets.QLabel(self.wDatosUsuario)\n self.label3_u.setGeometry(QtCore.QRect(45, 140, 71, 21))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.label3_u.setFont(font)\n self.label3_u.setObjectName(\"label3_u\")\n self.label11_u = QtWidgets.QLabel(self.wDatosUsuario)\n self.label11_u.setGeometry(QtCore.QRect(858, 18, 91, 21))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.label11_u.setFont(font)\n self.label11_u.setObjectName(\"label11_u\")\n self.label6_u = QtWidgets.QLabel(self.wDatosUsuario)\n self.label6_u.setGeometry(QtCore.QRect(596, 80, 31, 21))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.label6_u.setFont(font)\n self.label6_u.setObjectName(\"label6_u\")\n self.label9_u = QtWidgets.QLabel(self.wDatosUsuario)\n self.label9_u.setGeometry(QtCore.QRect(326, 140, 111, 21))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.label9_u.setFont(font)\n self.label9_u.setObjectName(\"label9_u\")\n self.txtUsuario_u = QtWidgets.QLineEdit(self.wDatosUsuario)\n self.txtUsuario_u.setGeometry(QtCore.QRect(142, 140, 171, 21))\n self.txtUsuario_u.setStyleSheet(\"font: 9pt \\\"MS Shell Dlg 2\\\";\")\n self.txtUsuario_u.setObjectName(\"txtUsuario_u\")\n self.btnRestarTelefono_u = QtWidgets.QPushButton(self.wDatosUsuario)\n self.btnRestarTelefono_u.setGeometry(QtCore.QRect(1110, 110, 21, 23))\n self.btnRestarTelefono_u.setText(\"\")\n self.btnRestarTelefono_u.setIcon(icon1)\n self.btnRestarTelefono_u.setObjectName(\"btnRestarTelefono_u\")\n self.label4 = QtWidgets.QLabel(self.wDatosUsuario)\n self.label4.setGeometry(QtCore.QRect(368, 20, 71, 21))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.label4.setFont(font)\n self.label4.setObjectName(\"label4\")\n self.txtDPiso_u = QtWidgets.QLineEdit(self.wDatosUsuario)\n self.txtDPiso_u.setGeometry(QtCore.QRect(708, 80, 31, 21))\n self.txtDPiso_u.setStyleSheet(\"font: 9pt \\\"MS Shell Dlg 2\\\";\")\n self.txtDPiso_u.setObjectName(\"txtDPiso_u\")\n self.txtDNumero_u = QtWidgets.QLineEdit(self.wDatosUsuario)\n self.txtDNumero_u.setGeometry(QtCore.QRect(630, 80, 41, 21))\n self.txtDNumero_u.setStyleSheet(\"font: 9pt \\\"MS Shell Dlg 2\\\";\")\n self.txtDNumero_u.setObjectName(\"txtDNumero_u\")\n self.label10_u = QtWidgets.QLabel(self.wDatosUsuario)\n self.label10_u.setGeometry(QtCore.QRect(650, 140, 101, 21))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.label10_u.setFont(font)\n self.label10_u.setObjectName(\"label10_u\")\n self.tvTelefono_u = QtWidgets.QTableView(self.wDatosUsuario)\n self.tvTelefono_u.setGeometry(QtCore.QRect(870, 80, 231, 61))\n font = QtGui.QFont()\n font.setFamily(\"Segoe UI\")\n font.setPointSize(11)\n font.setBold(False)\n font.setItalic(False)\n font.setWeight(9)\n self.tvTelefono_u.setFont(font)\n self.tvTelefono_u.setObjectName(\"tvTelefono_u\")\n self.txtTelefono_u = QtWidgets.QLineEdit(self.wDatosUsuario)\n self.txtTelefono_u.setGeometry(QtCore.QRect(960, 20, 141, 21))\n self.txtTelefono_u.setStyleSheet(\"font: 9pt \\\"MS Shell Dlg 2\\\";\")\n self.txtTelefono_u.setObjectName(\"txtTelefono_u\")\n self.btnTel_u = QtWidgets.QPushButton(self.wDatosUsuario)\n self.btnTel_u.setGeometry(QtCore.QRect(1010, 50, 21, 23))\n self.btnTel_u.setText(\"\")\n self.btnTel_u.setIcon(icon8)\n self.btnTel_u.setObjectName(\"btnTel_u\")\n self.btnCel_u = QtWidgets.QPushButton(self.wDatosUsuario)\n self.btnCel_u.setGeometry(QtCore.QRect(1040, 50, 21, 23))\n self.btnCel_u.setText(\"\")\n self.btnCel_u.setIcon(icon6)\n self.btnCel_u.setObjectName(\"btnCel_u\")\n self.btnFax_u = QtWidgets.QPushButton(self.wDatosUsuario)\n self.btnFax_u.setGeometry(QtCore.QRect(1070, 50, 21, 23))\n self.btnFax_u.setText(\"\")\n self.btnFax_u.setIcon(icon7)\n self.btnFax_u.setObjectName(\"btnFax_u\")\n self.cbTelefono_u = QtWidgets.QCheckBox(self.wDatosUsuario)\n self.cbTelefono_u.setGeometry(QtCore.QRect(940, 20, 21, 17))\n self.cbTelefono_u.setText(\"\")\n self.cbTelefono_u.setObjectName(\"cbTelefono_u\")\n self.twMenu.addTab(self.tab_Usuarios, \"\")\n self.tab_Estadisticas = QtWidgets.QWidget()\n self.tab_Estadisticas.setObjectName(\"tab_Estadisticas\")\n self.twMenu.addTab(self.tab_Estadisticas, \"\")\n MainWindow.setCentralWidget(self.centralWidget)\n self.menuBar = QtWidgets.QMenuBar(MainWindow)\n self.menuBar.setGeometry(QtCore.QRect(0, 0, 1190, 21))\n self.menuBar.setObjectName(\"menuBar\")\n self.menuProbando = QtWidgets.QMenu(self.menuBar)\n self.menuProbando.setObjectName(\"menuProbando\")\n self.menuAyuda = QtWidgets.QMenu(self.menuBar)\n self.menuAyuda.setObjectName(\"menuAyuda\")\n MainWindow.setMenuBar(self.menuBar)\n self.mainToolBar = QtWidgets.QToolBar(MainWindow)\n sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Ignored, QtWidgets.QSizePolicy.Ignored)\n sizePolicy.setHorizontalStretch(0)\n sizePolicy.setVerticalStretch(0)\n sizePolicy.setHeightForWidth(self.mainToolBar.sizePolicy().hasHeightForWidth())\n self.mainToolBar.setSizePolicy(sizePolicy)\n self.mainToolBar.setAcceptDrops(False)\n self.mainToolBar.setLayoutDirection(QtCore.Qt.LeftToRight)\n self.mainToolBar.setAutoFillBackground(True)\n self.mainToolBar.setObjectName(\"mainToolBar\")\n MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.mainToolBar)\n self.statusBar = QtWidgets.QStatusBar(MainWindow)\n self.statusBar.setObjectName(\"statusBar\")\n MainWindow.setStatusBar(self.statusBar)\n self.actionManual_de_uso = QtWidgets.QAction(MainWindow)\n self.actionManual_de_uso.setObjectName(\"actionManual_de_uso\")\n self.actionReportar_error = QtWidgets.QAction(MainWindow)\n self.actionReportar_error.setObjectName(\"actionReportar_error\")\n self.actionTransacciones = QtWidgets.QAction(MainWindow)\n self.actionTransacciones.setObjectName(\"actionTransacciones\")\n self.actionProductos = QtWidgets.QAction(MainWindow)\n self.actionProductos.setObjectName(\"actionProductos\")\n self.actionClientes = QtWidgets.QAction(MainWindow)\n self.actionClientes.setObjectName(\"actionClientes\")\n self.actionProveedores = QtWidgets.QAction(MainWindow)\n self.actionProveedores.setObjectName(\"actionProveedores\")\n self.actionEstaditicas = QtWidgets.QAction(MainWindow)\n self.actionEstaditicas.setObjectName(\"actionEstaditicas\")\n self.actionUsuarios = QtWidgets.QAction(MainWindow)\n self.actionUsuarios.setObjectName(\"actionUsuarios\")\n self.actionCerrarSesion = QtWidgets.QAction(MainWindow)\n self.actionCerrarSesion.setObjectName(\"actionCerrarSesion\")\n self.actionSalir = QtWidgets.QAction(MainWindow)\n self.actionSalir.setObjectName(\"actionSalir\")\n self.menuProbando.addAction(self.actionTransacciones)\n self.menuProbando.addAction(self.actionProductos)\n self.menuProbando.addAction(self.actionClientes)\n self.menuProbando.addAction(self.actionProveedores)\n self.menuProbando.addAction(self.actionEstaditicas)\n self.menuProbando.addAction(self.actionUsuarios)\n self.menuProbando.addSeparator()\n self.menuProbando.addAction(self.actionCerrarSesion)\n self.menuProbando.addSeparator()\n self.menuProbando.addAction(self.actionSalir)\n self.menuAyuda.addAction(self.actionManual_de_uso)\n self.menuAyuda.addAction(self.actionReportar_error)\n self.menuBar.addAction(self.menuProbando.menuAction())\n self.menuBar.addAction(self.menuAyuda.menuAction())\n\n self.retranslateUi(MainWindow)\n self.twMenu.setCurrentIndex(0)\n self.actionSalir.triggered.connect(MainWindow.close)\n QtCore.QMetaObject.connectSlotsByName(MainWindow)\n\n def retranslateUi(self, MainWindow):\n _translate = QtCore.QCoreApplication.translate\n MainWindow.setWindowTitle(_translate(\"MainWindow\", \"MainWindow\"))\n self.rbCompra_t.setText(_translate(\"MainWindow\", \"Compra\"))\n self.rbVenta_t.setText(_translate(\"MainWindow\", \"Venta\"))\n self.cbFilterCliente_t.setItemText(0, _translate(\"MainWindow\", \"Apellido\"))\n self.cbFilterCliente_t.setItemText(1, _translate(\"MainWindow\", \"Email\"))\n self.cbFilterProducto_t.setItemText(0, _translate(\"MainWindow\", \"Nombre\"))\n self.cbFilterProducto_t.setItemText(1, _translate(\"MainWindow\", \"Marca\"))\n self.cbFilterProducto_t.setItemText(2, _translate(\"MainWindow\", \"Rubro\"))\n self.cbFilterProducto_t.setItemText(3, _translate(\"MainWindow\", \"Precio de Venta\"))\n self.btnAceptar_t.setText(_translate(\"MainWindow\", \"ACEPTAR\"))\n self.btnCancelar_t.setText(_translate(\"MainWindow\", \"CANCELAR\"))\n self.label1_t.setText(_translate(\"MainWindow\", \"Tipo de transaccion : \"))\n self.label2_t.setText(_translate(\"MainWindow\", \"Cliente : \"))\n self.label3_t.setText(_translate(\"MainWindow\", \"Producto : \"))\n self.label4_t.setText(_translate(\"MainWindow\", \"Detalle Transaccion \"))\n self.label5_t.setText(_translate(\"MainWindow\", \"Cantidad :\"))\n self.twMenu.setTabText(self.twMenu.indexOf(self.tab_Transacciones), _translate(\"MainWindow\", \"Transacciones\"))\n self.btnAceptar_pag.setText(_translate(\"MainWindow\", \"ACEPTAR\"))\n self.btnCancelar_pag.setText(_translate(\"MainWindow\", \"CANCELAR\"))\n self.cbFilterCliente_pag.setItemText(0, _translate(\"MainWindow\", \"Persona\"))\n self.cbFilterCliente_pag.setItemText(1, _translate(\"MainWindow\", \"Fecha\"))\n self.label1_pag.setText(_translate(\"MainWindow\", \"Monto :\"))\n self.label4_pag.setText(_translate(\"MainWindow\", \"Detalle Transaccion :\"))\n self.label3_pag.setText(_translate(\"MainWindow\", \"Forma de pago : \"))\n self.cbFormaPago_pag.setItemText(0, _translate(\"MainWindow\", \"Efectivo\"))\n self.cbFormaPago_pag.setItemText(1, _translate(\"MainWindow\", \"Tarjeta\"))\n self.cbFormaPago_pag.setItemText(2, _translate(\"MainWindow\", \"Cheque\"))\n self.label2_pag.setText(_translate(\"MainWindow\", \"$\"))\n self.twMenu.setTabText(self.twMenu.indexOf(self.tab_Pagos), _translate(\"MainWindow\", \"Pagos\"))\n self.cbFilterProducto_p.setItemText(0, _translate(\"MainWindow\", \"Nombre\"))\n self.cbFilterProducto_p.setItemText(1, _translate(\"MainWindow\", \"Marca\"))\n self.cbFilterProducto_p.setItemText(2, _translate(\"MainWindow\", \"Rubro\"))\n self.cbFilterProducto_p.setItemText(3, _translate(\"MainWindow\", \"Precio Venta\"))\n self.btnBorrar_p.setText(_translate(\"MainWindow\", \"BORRAR\"))\n self.btnModificar_p.setText(_translate(\"MainWindow\", \"MODIFICAR\"))\n self.btnAgregar_p.setText(_translate(\"MainWindow\", \"AGREGAR\"))\n self.btnGuardar_p.setText(_translate(\"MainWindow\", \"GUARDAR\"))\n self.label2_p.setText(_translate(\"MainWindow\", \"Precio Compra :\"))\n self.label8_p.setText(_translate(\"MainWindow\", \"Modelo :\"))\n self.label1_p.setText(_translate(\"MainWindow\", \"Nombre :\"))\n self.label6_p.setText(_translate(\"MainWindow\", \"Cantidad :\"))\n self.label10_p.setText(_translate(\"MainWindow\", \"Proveedor :\"))\n self.rbMasculino_p.setText(_translate(\"MainWindow\", \"M\"))\n self.label3_p.setText(_translate(\"MainWindow\", \"$\"))\n self.rbFemenino_p.setText(_translate(\"MainWindow\", \"F\"))\n self.label7_p.setText(_translate(\"MainWindow\", \"Marca :\"))\n self.label12_p.setText(_translate(\"MainWindow\", \"Tipo :\"))\n self.label4_p.setText(_translate(\"MainWindow\", \"Precio Venta :\"))\n self.label5_p.setText(_translate(\"MainWindow\", \"$\"))\n self.label11_p.setText(_translate(\"MainWindow\", \"Rubro :\"))\n self.label13_p.setText(_translate(\"MainWindow\", \"Sexo :\"))\n self.label14_p.setText(_translate(\"MainWindow\", \"Descripcion :\"))\n self.twMenu.setTabText(self.twMenu.indexOf(self.tab_Productos), _translate(\"MainWindow\", \"Productos\"))\n self.cbFilterClientes_c.setItemText(0, _translate(\"MainWindow\", \"Apellido\"))\n self.cbFilterClientes_c.setItemText(1, _translate(\"MainWindow\", \"Email\"))\n self.btnBorrar_c.setText(_translate(\"MainWindow\", \"BORRAR\"))\n self.btnGuardar_c.setText(_translate(\"MainWindow\", \"GUARDAR\"))\n self.btnAgregar_c.setText(_translate(\"MainWindow\", \"AGREGAR\"))\n self.btnModificar_c.setText(_translate(\"MainWindow\", \"MODIFICAR\"))\n self.label7_c.setText(_translate(\"MainWindow\", \"Dpto\"))\n self.label1_c.setText(_translate(\"MainWindow\", \"Nombre :\"))\n self.label5_c.setText(_translate(\"MainWindow\", \"Nro.\"))\n self.label2_c.setText(_translate(\"MainWindow\", \"Apellido :\"))\n self.label3_c.setText(_translate(\"MainWindow\", \"Email :\"))\n self.label6_c.setText(_translate(\"MainWindow\", \"Piso\"))\n self.label8_c.setText(_translate(\"MainWindow\", \"Telefono :\"))\n self.label4_c.setText(_translate(\"MainWindow\", \"Direccion :\"))\n self.twMenu.setTabText(self.twMenu.indexOf(self.tab_Clientes), _translate(\"MainWindow\", \"Clientes\"))\n self.cbFilterProveedores_prov.setItemText(0, _translate(\"MainWindow\", \"Descripcion\"))\n self.cbFilterProveedores_prov.setItemText(1, _translate(\"MainWindow\", \"Email\"))\n self.btnBorrar_prov.setText(_translate(\"MainWindow\", \"BORRAR\"))\n self.btnGuardar_prov.setText(_translate(\"MainWindow\", \"GUARDAR\"))\n self.btnAgregar_prov.setText(_translate(\"MainWindow\", \"AGREGAR\"))\n self.btnModificar_prov.setText(_translate(\"MainWindow\", \"MODIFICAR\"))\n self.label8_prov.setText(_translate(\"MainWindow\", \"Telefono :\"))\n self.label5_prov.setText(_translate(\"MainWindow\", \"Nro.\"))\n self.label3_prov.setText(_translate(\"MainWindow\", \"Email :\"))\n self.label1_prov.setText(_translate(\"MainWindow\", \"Nombre :\"))\n self.label6_prov.setText(_translate(\"MainWindow\", \"Piso\"))\n self.label4_prov.setText(_translate(\"MainWindow\", \"Direccion :\"))\n self.label7_prov.setText(_translate(\"MainWindow\", \"Dpto\"))\n self.label2_prov.setText(_translate(\"MainWindow\", \"Descripcion :\"))\n self.label1_prov_2.setText(_translate(\"MainWindow\", \"Web :\"))\n self.twMenu.setTabText(self.twMenu.indexOf(self.tab_Proovedores), _translate(\"MainWindow\", \"Proveedores\"))\n self.btnGuardar_u.setText(_translate(\"MainWindow\", \"GUARDAR\"))\n self.cbFilterUsuario_u.setItemText(0, _translate(\"MainWindow\", \"Apellido\"))\n self.cbFilterUsuario_u.setItemText(1, _translate(\"MainWindow\", \"Usuario\"))\n self.cbFilterUsuario_u.setItemText(2, _translate(\"MainWindow\", \"Tipo\"))\n self.btnAgregar_u.setText(_translate(\"MainWindow\", \"AGREGAR\"))\n self.btnModificar_u.setText(_translate(\"MainWindow\", \"MODIFICAR\"))\n self.btnBorrar_u.setText(_translate(\"MainWindow\", \"BORRAR\"))\n self.label5_u.setText(_translate(\"MainWindow\", \"Direccion :\"))\n self.label1_u.setText(_translate(\"MainWindow\", \"Nombre :\"))\n self.cbTipoUsuario_u.setItemText(0, _translate(\"MainWindow\", \"admin\"))\n self.cbTipoUsuario_u.setItemText(1, _translate(\"MainWindow\", \"user\"))\n self.label8_u.setText(_translate(\"MainWindow\", \"Dpto\"))\n self.label7_u.setText(_translate(\"MainWindow\", \"Piso\"))\n self.label2_u.setText(_translate(\"MainWindow\", \"Apellido :\"))\n self.label3_u.setText(_translate(\"MainWindow\", \"Usuario : \"))\n self.label11_u.setText(_translate(\"MainWindow\", \"Telefono :\"))\n self.label6_u.setText(_translate(\"MainWindow\", \"Nro.\"))\n self.label9_u.setText(_translate(\"MainWindow\", \"Constraseña : \"))\n self.label4.setText(_translate(\"MainWindow\", \"Email :\"))\n self.label10_u.setText(_translate(\"MainWindow\", \"Tipo Usuario :\"))\n self.twMenu.setTabText(self.twMenu.indexOf(self.tab_Usuarios), _translate(\"MainWindow\", \"Usuarios\"))\n self.twMenu.setTabText(self.twMenu.indexOf(self.tab_Estadisticas), _translate(\"MainWindow\", \"Estadisticas\"))\n self.menuProbando.setTitle(_translate(\"MainWindow\", \"Archivo\"))\n self.menuAyuda.setTitle(_translate(\"MainWindow\", \"Ayuda\"))\n self.actionManual_de_uso.setText(_translate(\"MainWindow\", \"Manual de uso\"))\n self.actionReportar_error.setText(_translate(\"MainWindow\", \"Reportar error\"))\n self.actionTransacciones.setText(_translate(\"MainWindow\", \"Transacciones\"))\n self.actionProductos.setText(_translate(\"MainWindow\", \"Productos\"))\n self.actionClientes.setText(_translate(\"MainWindow\", \"Clientes\"))\n self.actionProveedores.setText(_translate(\"MainWindow\", \"Proveedores\"))\n self.actionEstaditicas.setText(_translate(\"MainWindow\", \"Estaditicas\"))\n self.actionUsuarios.setText(_translate(\"MainWindow\", \"Usuarios\"))\n self.actionCerrarSesion.setText(_translate(\"MainWindow\", \"Cerrar Sesion\"))\n self.actionSalir.setText(_translate(\"MainWindow\", \"Salir\"))\n\n\nif __name__ == \"__main__\":\n import sys\n app = QtWidgets.QApplication(sys.argv)\n MainWindow = QtWidgets.QMainWindow()\n ui = Ui_MainWindow()\n ui.setupUi(MainWindow)\n MainWindow.show()\n sys.exit(app.exec_())\n\n" }, { "alpha_fraction": 0.5396572351455688, "alphanum_fraction": 0.6281387209892273, "avg_line_length": 38.77777862548828, "blob_id": "d2c0ef32f4778970d0f87685cdd6b1f7cc8b1f4c", "content_id": "508af3e3a7bd05ad31a4d1d8206d7602145cbec1", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2509, "license_type": "no_license", "max_line_length": 120, "num_lines": 63, "path": "/fullcontrol-menu/funcoes/validaCpf.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "\n\ntimes = lambda x, y: x * y\ntimes2 = lambda x: times(x, 2)\nisEqual = lambda x, y: x == y\nisNotEqual = lambda x, y: not(isEqual(x, y))\ngenerateSum = times\ntoSums = lambda qtd: lambda [sum2, sum1], n: [sum2 + generateSum(n, qtd), sum1 + generateSum(n, --qtd)]\n# const toSums = total => ([sum2, sum1], n) => [sum2 + generateSum(n)(total), sum1 + generateSum(n)(--total)]\ngetSums = lambda x, qtd = 11: x.split('').slice(0, 9).reduce(toSums(qtd, 0, 0).reverse()\n\n# mod11 = lambda x: x % 11\n\n\nprint(toSums(11, 0, 0 ))\nprint(times(2, 2))\nprint(times2(2))\nprint(isEqual(123, 123))\nprint(isEqual(2, 3))\nprint(isNotEqual(123, 123))\nprint(isNotEqual(2, 3))\n\nprint(toSums(11, 0, 0, 0))\n\n# const NOT = a => !a\n# const times = a => b => b * a\n# const mod11 = num => num % 11\n# const times2 = num => times(2)(num)\n# const times10 = num => times(10)(num)\n# const isEqual = a => b => b === a\n# const isNotEqual = a => b => !isEqual(a)(b)\n# const getDigit = cpf => `${cpf.charAt(9)}${cpf.charAt(10)}`\n# const getGeneratedDigit = (sum1, sum2) => (sum1 === 0 ? '0' + sum2 : sum1 * 10 + sum2 + '')\n# const generateStringSequence = tam => num => `${num}`.repeat(tam)\n# const generateArray = length => Array.from({ length }, (v, k) => k)\n# const generateSum = times\n# const generateSequenceSize11 = generateStringSequence(11)\n# const inSameDigits = cpf => num => isEqual(cpf)(generateSequenceSize11(num))\n# const isIn = list => value => list.findIndex(inSameDigits(value)) >= 0\n# const testIfHasSameDigits = list => cpf => isIn(list)(cpf)\n# const getResultOfSum1 = sum1 => (mod11(sum1) < 2 ? 0 : 11 - mod11(sum1)) // 11 - mod11( sum1 )\n# const getResultOfSum2 = (\n# sum1,\n# sum2 // 11 - mod11( sum2 + times2( sum1 ) )\n# ) => (mod11(sum2 + times2(sum1)) < 2 ? 0 : 11 - mod11(sum2 + times2(sum1)))\n\n# const toSums = total => ([sum2, sum1], n) => [sum2 + generateSum(n)(total), sum1 + generateSum(n)(--total)]\n\n# const getSums = (cpf, total = 11) => cpf.split('').slice(0, 9).reduce(toSums(total), [0, 0]).reverse()\n\n# const validate = cpf => {\n# const CPF_LENGTH = 11\n# let [sum1, sum2] = getSums(cpf, CPF_LENGTH)\n\n# sum1 = getResultOfSum1(sum1)\n# sum2 = getResultOfSum2(sum1, sum2)\n\n# return NOT(testIfHasSameDigits(generateArray(10))(cpf)) && NOT(getGeneratedDigit(sum1, sum2) !== getDigit(cpf))\n# }\n\n# const CPFS = ['04998264931', '03506838326', '04864713901', '03506838321', '22222222222', '00000000000', '07468287805']\n\n# CPFS.forEach(cpf => console.log(`${cpf}: ${validate(cpf)}`))\n\n# module.exports = validate\n\n" }, { "alpha_fraction": 0.7039473652839661, "alphanum_fraction": 0.7039473652839661, "avg_line_length": 16, "blob_id": "65dad9e4189e6e6642e334d84e923f3b3eb6beee", "content_id": "e503eb50eee70dd2d59cba2fe72e569227e6c166", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 152, "license_type": "no_license", "max_line_length": 40, "num_lines": 9, "path": "/imdb/imdb-001.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import imdb\nia = imdb.IMDb()\nmovies = ia.search_movie('matrix')\nfor m in movies:\n print(m)\n\n\nkeywords = ia.search_keyword('dystopia')\nprint(keywords)" }, { "alpha_fraction": 0.622266411781311, "alphanum_fraction": 0.6262425184249878, "avg_line_length": 34.89285659790039, "blob_id": "6c1305da39a91958a2de0c2ab2f9c21bd66253c8", "content_id": "c60c77a0b38121d0d9201b0f8eea056343f8d903", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2015, "license_type": "no_license", "max_line_length": 94, "num_lines": 56, "path": "/PQt5-Stock/Controlador/windowIniciar.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\n\nfrom PyQt5 import uic\nfrom Conexion.conexionUsuario import conexionUsuario\nfrom Modelo.usuario import Usuario\nfrom PyQt5.QtWidgets import QMessageBox, QDialog\n\n\nclass WindowIniciar():\n\n def __init__(self):\n\n self.winIniciar = uic.loadUi('Vista/iniciar.ui')\n self.conexionUsuario = conexionUsuario()\n #self.winIniciar.btnIniciar.clicked.connect(self.onClickValidarUsuario)\n self.winIniciar.btnSalir.clicked.connect(self.onClickSalir)\n self.usuario = Usuario()\n self.winIniciar.txtUsuario.setFocus(True)\n self.winIniciar.show()\n\n\n def onClickValidarUsuario(self):\n\n self.usuario = Usuario()\n self.usuario.setUsuario(self.winIniciar.txtUsuario.text())\n self.usuario.setPasswd(self.winIniciar.txtPass.text())\n value = ''\n if self.usuario.getUsuario() != '' and self.usuario.getPasswd() != '':\n value = self.conexionUsuario.validarUsuario(usuario=self.usuario)\n if len(value) != 0:\n self.usuario.setUsuario(value[0][0])\n self.usuario.setTipoUsuario(value[0][1])\n self.winIniciar.txtPass.setText('')\n self.winIniciar.txtUsuario.setText('')\n return self.usuario\n else:\n self.winIniciar.lblError.setText('LA CONTRASEÑA O USUARIO NO COINCIDEN')\n self.winIniciar.txtPass.setText('')\n alert = QDialog()\n QMessageBox.information(alert,\"ERROR\", 'LA CONTRASEÑA O USUARIO NO COINCIDEN')\n else:\n print('Falta completar algun campo')\n alert = QDialog()\n QMessageBox.information(alert,\"ERROR\", 'Falta completar algun campo')\n\n\n\n def onClickSalir(self):\n alert = QDialog()\n confirm = QMessageBox.question(alert, \"Mensaje\", \"¿ Desea salir ?\", QMessageBox.Yes,\n QMessageBox.No)\n if confirm == QMessageBox.Yes:\n self.winIniciar.close()\n\n\n" }, { "alpha_fraction": 0.3991031348705292, "alphanum_fraction": 0.4970104694366455, "avg_line_length": 28.733333587646484, "blob_id": "23a9b0fd274930db52fff0099dfc160fc39b8c4a", "content_id": "7a325b547bfd1f7e8b77c40fdf7b2defa78afc0b", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1338, "license_type": "no_license", "max_line_length": 109, "num_lines": 45, "path": "/crt/c001.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import sys\nimport time\nfrom ctypes import windll\nwindll.kernel32.SetConsoleMode(windll.kernel32.GetStdHandle(-11), 7)\n\nfor r in range(250, 256):\n for g in range(0, 256):\n for b in range(0, 256):\n c = r * 256 + g * 16 + b\n code = str(r * 256 + g * 16 + b)\n # print(code)\n sys.stdout.write(u\"\\u001b[38;2;{};{};{}\".format(r, g, b) + \"m \" + \n \"#{}{}{}\".format(hex(r)[2:].rjust(2), hex(g)[2:].rjust(2), hex(b)[2:].rjust(2)))\n if (c / 16 == c // 16) and (c > 0):\n print(u\"\\u001b[0m\")\n print(u\"\\u001b[0m\")\n input()\n\nfor i in range(0, 16):\n for j in range(0, 16):\n code = str(i * 16 + j)\n # sys.stdout.write(u\"\\u001b[38;5;\" + code + \"m \" + code.ljust(4))\n # print(u\"\\u001b[38;5;\" + code + \"m \" + code.rjust(4), end=\"\")\n print(u\"\\u001b[0m\")\n\n\nfor i in range(0, 16):\n for j in range(0, 16):\n code = str(i * 16 + j)\n sys.stdout.write(u\"\\u001b[48;5;\" + code + \"m \" + code.ljust(4))\n print(u\"\\u001b[0m\")\n\nprint(u\"\\u001b[1m\\u001b[4m\\u001b[7m BOLD Underline Reversed \\u001b[0m\")\n\n\ndef loading():\n print(\"Loading...\")\n for i in range(0, 100):\n time.sleep(0.1)\n sys.stdout.write(u\"\\u001b[1000D\" + str(i + 1) + \"%\")\n sys.stdout.flush()\n print()\n\n\nloading()\n" }, { "alpha_fraction": 0.4285714328289032, "alphanum_fraction": 0.44548872113227844, "avg_line_length": 23.227272033691406, "blob_id": "9f0e4c5a8209f9a9d8584abd21aea695d0868527", "content_id": "e4c0d3b5be5f77a5ca488f1254e2241a06fd9d4c", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 532, "license_type": "no_license", "max_line_length": 45, "num_lines": 22, "path": "/e-mail/learq.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "def learq(arqlog):\n hora = []\n sent = []\n tota = []\n\n arq = open(arqlog, 'r', encoding='utf-8')\n\n for linha in arq:\n valores = linha.split()\n if len(valores) > 0:\n if valores[0] == 'sent':\n sent.append(linha[:-1])\n if valores[0] == 'total':\n tota.append(linha[:-1])\n if len(valores) > 4:\n if valores[4] == 'BRST':\n hora.append(linha[:-1])\n # print(valores)\n\n arq.close()\n\n return(hora, sent, tota)" }, { "alpha_fraction": 0.5445605516433716, "alphanum_fraction": 0.5648432970046997, "avg_line_length": 25.655736923217773, "blob_id": "5a0709e99b2f7472e243aa643f62111cf603b312", "content_id": "4eefc9702a158b079817c8547abfe136e8ae4c9e", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1629, "license_type": "no_license", "max_line_length": 97, "num_lines": 61, "path": "/agiliza/mata-velhos.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/python3\n\nimport sys\nimport subprocess\nimport argparse\nimport re\nfrom operator import itemgetter\n\ndef isTime(time):\n \"\"\"Verifica se é uma Hora válida\"\"\"\n if not re.match(r'^(0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$', time):\n return(False)\n return(True)\n\ndef get_arguments():\n parser = argparse.ArgumentParser(description = 'Mata processos antigos')\n parser.add_argument('-t', '--tempo', dest='tempo', help='Tempo sem atividade', required=True)\n options = parser.parse_args()\n return options\n\ndef separa(a, tam):\n lista = []\n b = []\n for i, l in enumerate(a):\n if i > 1:\n if i / tam == i // tam:\n lista.append(b)\n b = []\n b.append(l)\n lista.append(b)\n return(lista)\n\ndef pegaprocessos(tempo):\n with subprocess.Popen(['who', '-u'], stdout=subprocess.PIPE) as proc:\n a = proc.stdout.read().decode('utf-8').split()\n li = separa(a, 7)\n li.sort(key=itemgetter(4))\n lista=[]\n for l in li:\n if len(l[4]) > 2:\n t = int(l[4][:2]) * 60 + int(l[4][-2:])\n if t > tempo:\n lista.append(l) \n return(lista)\n\ndef pegasubprocessos(lista):\n for l in lista:\n with subprocess.Popen(['ps', '-t', l[1]], stdout=subprocess.PIPE) as proc:\n a = proc.stdout.read().decode('utf-8').split()\n\n li = separa(a, 4)\n for l in li.reverse:\n print(l)\n\noptions = get_arguments()\n\nif isTime(options.tempo):\n tempo = int(options.tempo[:2]) * 60 + int(options.tempo[-2:])\n lista = pegaprocessos(tempo)\n print(lista)\n pegasubprocessos(lista)\n\n" }, { "alpha_fraction": 0.679894208908081, "alphanum_fraction": 0.6904761791229248, "avg_line_length": 28.102563858032227, "blob_id": "5889b518724cc9897dc2f619a1a5c80796a56c69", "content_id": "b28dcffe6f163876a0fe779ff06837bdac3460f8", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1134, "license_type": "no_license", "max_line_length": 75, "num_lines": 39, "path": "/fullcontrol_001/sqlal_001.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import sqlite3\nfrom sqlalchemy import create_engine\nfrom sqlalchemy.ext.declarative import declarative_base\nfrom sqlalchemy import Column, Integer, String\nfrom sqlalchemy import Sequence\nfrom sqlalchemy.orm import sessionmaker\n\n# engine = create_engine('sqlite:///:memory:', echo=True)\nengine = create_engine('sqlite:///teste.db3')\n# engine = create_engine('postgresql://usr:pass@localhost:5432/sqlalchemy')\nBase = declarative_base()\nColumn(Integer, Sequence('user_id_seq'), primary_key=True)\nSession = sessionmaker(bind=engine)\n\nsession = Session()\n\nclass User(Base):\n __tablename__ = 'users'\n id = Column(Integer, Sequence('user_id_seq'), primary_key=True)\n name = Column(String(20))\n fullname = Column(String(50))\n password = Column(String(12))\n\n def __repr__(self):\n return \"<User(name='%s', fullname='%s', password='%s')>\" % (\n self.name, self.fullname, self.password)\n\nprint(User.__table__)\n\nBase.metadata.create_all(engine)\n\ned_user = User(name='ed', fullname='Ed Jones', password='edspassword')\nsession.add(ed_user)\n\nprint(ed_user.name)\n\nsession.commit()\n\nprint(ed_user.id)" }, { "alpha_fraction": 0.6403104662895203, "alphanum_fraction": 0.6541353464126587, "avg_line_length": 28.042253494262695, "blob_id": "87e4ca118ee3790cac97568f4c01e4074ef12693", "content_id": "865e2c958410a2523564624a540eabdd6b1b3f9f", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 4139, "license_type": "no_license", "max_line_length": 80, "num_lines": 142, "path": "/JPro-master/ibox.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#====##====##====##====##====#\n#====##====##====##====##====#\n'''\nINVENTORY: \n\n- The widget display the current inventory held in house \n\n'''\n#====##====##====##====##====#\n#====##====##====##====##====#\n\nimport sys \nimport datetime\nfrom PyQt5.QtWidgets import (QApplication, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQWidget, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQSizePolicy,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQVBoxLayout,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQHBoxLayout,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQHeaderView,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQTableView,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQAbstractItemView,\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\nfrom dbcreation import Models \nimport matplotlib.pyplot as plt\nfrom matplotlib.figure import Figure\nfrom matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas\nimport numpy as np\nfrom PyQt5.QtSql import QSqlDatabase, QSqlTableModel, QSqlQuery\n\nclass IBox(QWidget): \n\n\tdef __init__(self): \n\t\tsuper().__init__()\n\n\t#====##====##====##====##====##====##====#\n\t# QSqlModel connecition \n\t#====##====##====##====##====##====##====#\n\n\t\t# self.db = QSqlDatabase.database(\"ibox\")\n\n\t\tself.db = QSqlDatabase.addDatabase(\"QSQLITE\")\n\t\tself.db.setDatabaseName(\"complete.db\")\n\t\tself.db.open()\n\n\t\tself.inv_model = QSqlTableModel(self, self.db )\n\t\tself.inv_model.setTable(\"models\")\n\t\tself.inv_model.setEditStrategy(QSqlTableModel.OnManualSubmit)\n\t\tself.inv_model.select()\n\n\t\tself.inv_view = QTableView()\n\t\tself.inv_view.setModel(self.inv_model)\n\t\tself.inv_view.hideColumn(0)\n\t\tself.inv_view.hideColumn(2)\n\n\t\tself.order_header = self.inv_view.horizontalHeader()\n\t\tself.order_header.setMinimumSectionSize(130)\n\t\tself.order_header.setSectionResizeMode(QHeaderView.Stretch)\n\t\tself.inv_view.setSelectionBehavior(QAbstractItemView.SelectRows)\n\n\n\t\tself.bargraph = PlotCanvas(self, width=4, height=3)\n\t\t#self.bargraph.move(0,0)\n\n\t\t#====##====##====##====##====#\n\t\t#Layout forming & finalization\n\t\t#====##====##====##====##====#\n\n\t\tiboxlayout = QHBoxLayout()\n\t\tiboxlayout.addWidget(self.inv_view)\n\t\tiboxlayout.addWidget(self.bargraph)\t\n\t\tself.setLayout(iboxlayout)\n\n#\t\tself.setStyleSheet('background-color: #444444')\n\t\tself.setWindowTitle('JPro')\n\t\tself.setGeometry(0,0,640,440)\n\t\tself.show()\n\n\tdef setData(self, data):\n\t\trow = 0 \n\t\tfor record in data: \n\t\t\tself.table.setItem(row, 0, QTableWidgetItem(str(record.name)))\n\t\t\tself.table.setItem(row, 1, QTableWidgetItem(str(record.current_quantity)))\n#\t\t\tself.table.setItem(row, 2, QTableWidgetItem(record.parts))\n\t\t\trow += 1 \n\n\tdef buildTable(self):\n\t\tself.table = QTableWidget(len(self.all_stock),2,self)\n\t\tself.table.setHorizontalHeaderItem(0, QTableWidgetItem('Models / 模型 '))\n\t\tself.table.setHorizontalHeaderItem(1, QTableWidgetItem('Quantity / 数量 '))\t\n#\t\tself.table.setHorizontalHeaderItem(2, QTableWidgetItem('Parts / 零件')) \n\n\t\tself.order_header = self.table.horizontalHeader()\n\t\tself.order_header.setMinimumSectionSize(130)\n\t\tself.order_header.setSectionResizeMode(QHeaderView.Stretch)\n\n\t\tself.table.setSelectionBehavior(QAbstractItemView.SelectRows)\n\t\tself.table.setCurrentCell(-1,-1)\n\n#====##====##====##====##====#\n#matplotlib bar chart widget \n#====##====##====##====##====# \nclass PlotCanvas(FigureCanvas): \n\n\tdef __init__(self, parent, width=5,height=4,dpi=100):\n\t\t\n\t\tself.fig, self.axes = plt.subplots(figsize=(6,4))\n\t\t\n\t\tFigureCanvas.__init__(self,self.fig)\n\t\tself.setParent(parent)\n\t\tFigureCanvas.setSizePolicy(self, QSizePolicy.Expanding, QSizePolicy.Expanding)\n\t\tFigureCanvas.updateGeometry(self)\n\t\tself.plot()\n\n\tdef plot(self): \n\t\tmodels_list, quantity_list = [], []\n\t\tmodels_q = QSqlQuery(\"select name from models\")\n\t\tquantity_query = QSqlQuery(\"select current_quantity from models\")\t\n\t\t\n\t\t# X DATA \n\t\twhile models_q.next(): \n\t\t\tmodels_list.append(models_q.value(0)) \t\t\n\n\t\t#Y DATA\t\t\n\t\twhile quantity_query.next():\n\t\t\tquantity_list.append(quantity_query.value(0)) \n\n\t\tx = np.arange(len(models_list))\n\t\tself.axes.bar(x,quantity_list, align='center', alpha=0.5, color='lightblue')\n\t\tplt.xticks(x,models_list)\n\t\tplt.ylabel('Stock')\n\t\tplt.title('Inventory')\n\t\tself.axes.margins(0.05)\n\t\tself.axes.set_ylim(bottom=0)\n\t\tself.fig.set_size_inches(3,4,forward=True)\n\t\t#plt.draw()\n\n\nif __name__ == '__main__' : \n\n\tapp = QApplication(sys.argv)\n\tibox = IBox()\n\tsys.exit(app.exec_())" }, { "alpha_fraction": 0.8138527870178223, "alphanum_fraction": 0.8138527870178223, "avg_line_length": 37.5, "blob_id": "8ecbac23b3b6de1ca7eb2aaec5f543582bc5770e", "content_id": "efb55b161f368c56059797738efc58d80eadb0ba", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 231, "license_type": "no_license", "max_line_length": 74, "num_lines": 6, "path": "/decompiler/decomplier.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "from retdec.decompiler import Decompiler\n\ndecompiler = Decompiler(api_key='YOUR-API-KEY')\ndecompilation = decompiler.start_decompilation(input_file='activator.exe')\ndecompilation.wait_until_finished()\ndecompilation.save_hll_code()\n" }, { "alpha_fraction": 0.572713315486908, "alphanum_fraction": 0.5747970938682556, "avg_line_length": 33.8015251159668, "blob_id": "74eaca4c9d5243208a517d929339d90fa12c1a52", "content_id": "0450753cd897084e89ee15f75c1f66a5fff947dd", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 9169, "license_type": "no_license", "max_line_length": 91, "num_lines": 262, "path": "/PyQT-CRUD-App/app/regdialogs/pc.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/python3\n# -*- coding: utf-8 -*-\n\"\"\"\nРегистрируем новые компьютеры\nCadastro de computadores\n\"\"\"\nfrom app.db import data\nfrom app.tools.functions import get_or_create\nfrom app.tools.exitmethods import Dialog\nfrom sqlalchemy.sql.operators import exists\nfrom PyQt5 import *\nfrom PyQt5.QtWidgets import *\nfrom PyQt5.QtGui import *\nfrom PyQt5.QtCore import *\nfrom PyQt5.Qt import *\n\n\nclass RegisterPC(Dialog):\n def __init__(self, session):\n QDialog.__init__(self)\n self.session = session\n self.init_window()\n self.init_layouts()\n\n def init_window(self):\n QToolTip.setFont(QFont('Font', 15))\n self.setFixedSize(700, 480)\n self.setWindowModality(2)\n self.setWindowTitle('Nós registramos o computador')\n self.setWindowIcon(QIcon(r'pics\\pc.png'))\n\n def init_layouts(self):\n buttons_layout = QHBoxLayout()\n\n back_button = QPushButton('Voltar')\n back_button.clicked.connect(self.close)\n submit_button = QPushButton('Adicionar ao banco de dados')\n submit_button.clicked.connect(self.validate_input)\n buttons_layout.addWidget(back_button, alignment=Qt.AlignRight)\n buttons_layout.addWidget(submit_button)\n\n form_layout = QFormLayout(self)\n\n self.pc_name_edit = QLineEdit()\n self.pc_name_edit.setValidator(\n QRegExpValidator(QRegExp(\"[^А-ЯA-Z ]+\"))\n )\n self.pc_name_edit.setClearButtonEnabled(True)\n form_layout.addRow(\n 'Nome do computador:<font color=\"red\">*</font>', self.pc_name_edit\n )\n self.mac_edit = QLineEdit()\n self.mac_edit.setValidator(\n QRegExpValidator(QRegExp(\"[A-F-0-9]+\"))\n )\n self.mac_edit.setClearButtonEnabled(True)\n form_layout.addRow(\n 'Endereço MAC:<font color=\"red\">*</font>', self.mac_edit\n )\n self.power_socket_edit = QComboBox()\n self.power_socket_edit.setEditable(True)\n self.power_socket_edit.addItems([\n pow_socket\n for pow_socket, in self.session.query(data.PowerSocket.name)\n if pow_socket\n ])\n self.power_socket_edit.setCurrentText('')\n form_layout.addRow(\n 'Número de slots:', self.power_socket_edit\n )\n self.connection_type_edit = QComboBox()\n self.connection_type_edit.setEditable(True)\n self.connection_type_edit.setValidator(\n QRegExpValidator(QRegExp(\"[^А-ЯA-Z]+\"))\n )\n self.connection_type_edit.addItems([\n conn_type\n for conn_type, in self.session.query(data.ConnectionType.name)\n if conn_type\n ])\n self.connection_type_edit.setCurrentText('')\n form_layout.addRow(\n 'Como usá-lo:', self.connection_type_edit\n )\n self.domain_edit = QComboBox()\n self.domain_edit.setEditable(True)\n self.domain_edit.addItems([\n domain\n for domain, in self.session.query(data.Domain.name)\n if domain\n ])\n self.domain_edit.setCurrentText('')\n form_layout.addRow(\n 'Nome de domínio:', self.domain_edit\n )\n self.app_server_edit = QLineEdit()\n self.app_server_edit.setClearButtonEnabled(True)\n form_layout.addRow(\n 'Aplicações de servidor:', self.app_server_edit\n )\n self.windows_os_edit = QComboBox()\n self.windows_os_edit.setEditable(True)\n self.windows_os_edit.setValidator(\n QRegExpValidator(QRegExp(\"[^A-Z]+\"))\n )\n self.windows_os_edit.addItems([\n windows\n for windows, in self.session.query(data.Windows.name)\n if windows\n ])\n self.windows_os_edit.setCurrentText('')\n form_layout.addRow(\n 'Windows:', self.windows_os_edit\n )\n self.ms_office_edit = QComboBox()\n self.ms_office_edit.setEditable(True)\n self.ms_office_edit.setValidator(\n QRegExpValidator(QRegExp(\"[^A-Z]+\"))\n )\n self.ms_office_edit.addItems([\n office\n for office, in self.session.query(data.Office.name)\n if office\n ])\n self.ms_office_edit.setCurrentText('')\n form_layout.addRow(\n 'Microsoft Office:', self.ms_office_edit\n )\n self.antivirus_edit = QComboBox()\n self.antivirus_edit.setEditable(True)\n self.antivirus_edit.setValidator(\n QRegExpValidator(QRegExp(\"[^A-Z]+\"))\n )\n self.antivirus_edit.addItems([\n antivirus\n for antivirus, in self.session.query(data.Antivirus.name)\n if antivirus\n ])\n self.antivirus_edit.setCurrentText('')\n form_layout.addRow(\n 'Anti-Virus:', self.antivirus_edit\n )\n self.windows_os_key_edit = QLineEdit()\n self.windows_os_key_edit.setClearButtonEnabled(True)\n form_layout.addRow(\n 'Windows key:', self.windows_os_key_edit\n )\n self.ms_office_key_edit = QLineEdit()\n self.ms_office_key_edit.setClearButtonEnabled(True)\n form_layout.addRow(\n 'Microsoft Office key:', self.ms_office_key_edit\n )\n self.mail_client_edit = QLineEdit()\n self.mail_client_edit.setClearButtonEnabled(True)\n form_layout.addRow(\n 'Cliente de e-mail:', self.mail_client_edit\n )\n self.comments_edit = QLineEdit()\n self.comments_edit.setClearButtonEnabled(True)\n form_layout.addRow(\n 'Outro:', self.comments_edit\n )\n self.kes_edit = QCheckBox()\n form_layout.addRow(\n 'Agente KES:', self.kes_edit\n )\n self.consultant_edit = QCheckBox()\n form_layout.addRow(\n 'Consultor:', self.consultant_edit\n )\n self.guarantee_edit = QCheckBox()\n form_layout.addRow(\n 'Garantia:', self.guarantee_edit\n )\n self.odin_s_edit = QCheckBox()\n form_layout.addRow(\n '1С:', self.odin_s_edit\n )\n self.kdc_edit = QCheckBox()\n form_layout.addRow(\n 'KDS:', self.kdc_edit\n )\n form_layout.addRow(buttons_layout)\n\n @QtCore.pyqtSlot()\n def validate_input(self):\n\n if not self.mac_edit.text() or not self.pc_name_edit.text():\n QMessageBox.warning(\n self, 'Atenção',\n \"Campos: 'Nome do computador' e 'Endereço MAC' são obrigatórios\"\n )\n return\n\n stmt = self.session.query(data.PcName).join(data.Domain). \\\n filter(data.PcName.name == self.pc_name_edit.text()). \\\n filter(data.Domain.name == self.domain_edit.currentText())\n if self.session.query(stmt.exists()).scalar():\n QMessageBox.warning(self,\n 'Atenção',\n 'O nome do computador inserido já existe no banco de dados'\n )\n return\n\n stmt = self.session.query(data.Pc). \\\n filter(data.Pc.mac_address == self.mac_edit.text())\n if self.session.query(stmt.exists()).scalar():\n QMessageBox.warning(\n self, 'Atenção', 'O endereço mac inserido já existe'\n )\n return\n\n self.process_data()\n if not self.accept():\n self.session.rollback()\n\n def process_data(self):\n QApplication.setOverrideCursor(Qt.WaitCursor)\n pcname = data.PcName(\n name=self.pc_name_edit.text()\n )\n\n pcname.domain = get_or_create(\n self.session, data.Domain,\n name=self.domain_edit.currentText()\n )\n\n pc = data.Pc(\n mac_address=self.mac_edit.text(),\n windows_os_key=self.windows_os_key_edit.text(),\n ms_office_key=self.ms_office_key_edit.text(),\n kes=self.kes_edit.isChecked(),\n guarantee=self.guarantee_edit.isChecked(),\n odin_s=self.odin_s_edit.isChecked(),\n kdc=self.kdc_edit.isChecked(),\n mail_client=self.mail_client_edit.text(),\n app_server=self.app_server_edit.text(),\n consultant=self.consultant_edit.isChecked(),\n comments=self.comments_edit.text(),\n )\n pc.pcname = pcname\n pc.connectiontype = get_or_create(\n self.session, data.ConnectionType,\n name=self.connection_type_edit.currentText()\n )\n pc.powersocket = get_or_create(\n self.session, data.PowerSocket,\n name=self.power_socket_edit.currentText()\n )\n pc.windows = get_or_create(\n self.session, data.Windows,\n name=self.windows_os_edit.currentText()\n )\n pc.office = get_or_create(\n self.session, data.Office,\n name=self.ms_office_edit.currentText()\n )\n pc.antivirus = get_or_create(\n self.session, data.Antivirus,\n name=self.antivirus_edit.currentText()\n )\n QApplication.restoreOverrideCursor()\n" }, { "alpha_fraction": 0.5060283541679382, "alphanum_fraction": 0.5842210054397583, "avg_line_length": 38.92055892944336, "blob_id": "943be47faac53355c0b477e3cdac35beaca9f286", "content_id": "91c7cc40929e7335702d90959587322cf0f344d4", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 8544, "license_type": "permissive", "max_line_length": 163, "num_lines": 214, "path": "/opencv/tictactoeOpenCV/tictactoeOpenCV-master/tictactoe.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#\n#\n# Jogo da Velha utilizando Visao Computacional e Realidade aumentada.\n#\n#\n\n\nimport numpy as np\nimport cv2\nimport play\nfrom random import randint\nfrom time import sleep, time\n\n\n# Marca o inicio do programa. Utilizado para o temporizador.\ninicial = time()\n\n\n# Captura pelo a webcam\ncap = cv2.VideoCapture(0)\ntamanho = (500, 500) # tamanho da imagem de output\npts2 = np.float32([[0,0], [tamanho[1], 0], [0, tamanho[0]], [tamanho[1], tamanho[0]]])\n\n\n# Tabuleiros vazios. -1 representa um espaco vazio.\ntabuleiro = [-1,-1,-1,-1,-1,-1,-1,-1,-1]\ntabuleiro2 = [False, False, False, False, False, False, False, False, False]\nescolhas = []\n\n\n\n# Loop de captura da webcam, o loop termina com o fim do jogo.\nwhile(cap.isOpened() and play.won(tabuleiro) == 0):\n\tret, img = cap.read()\n\n\tif ret==True:\n\t\timgray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)\t# tranforma a imagem para niveis de cinza.\n\t\tret2,thresh = cv2.threshold(imgray,170,255,0)\t# faz o threshold da imagem em niveis de cinza.\n\t\timage, contours, hierarchy = cv2.findContours(thresh,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE)\t# Procura o contornos\n\n\n\t\tfor i in range(len(contours)):\n\t\t\tarea = cv2.contourArea(contours[i]) # Area de contorno\n\t\t\taprox = cv2.approxPolyDP(contours[i], 0.02 * cv2.arcLength(contours[i], True), True)\n\n\t\t\t# Verifica se e um rentangulo\n\t\t\tif area > 10000 and len(aprox) == 4:\n\t\t\t\taprox = play.ordena(aprox, img.shape[:2])\n\t\t\t\tpts1 = np.float32([\\\n\t\t\t\t\t[aprox[0][0][0], aprox[0][0][1]],\\\n\t\t\t\t\t[aprox[1][0][0], aprox[1][0][1]],\\\n\t\t\t\t\t[aprox[2][0][0], aprox[2][0][1]],\\\n\t\t\t\t\t[aprox[3][0][0], aprox[3][0][1]] ])\n\t\t\t\tM = cv2.getPerspectiveTransform(pts1,pts2)\t# Transformacao de perspectiva\n\n\t\t\t\tdst = cv2.warpPerspective(img, M, (tamanho[1], tamanho[0]))\n\t\t\t\ttemplate = cv2.imread('x.png', 0)\t# le o a imagem usada como template para o match.\n\t\t\t\t# redimensiona o modelo para 25% do tamanho da imagem do tabuleiro.\n\t\t\t\ttemplate = cv2.resize(template, dsize=(img.shape[0] // 4, img.shape[1] // 4))\n\t\t\t\tw, h = template.shape[::-1]\n\t\t\t\tim_gray = cv2.cvtColor(dst, cv2.COLOR_BGR2GRAY)\n\t\t\t\tres = cv2.matchTemplate(im_gray, template, cv2.TM_CCOEFF_NORMED)\n\t\t\t\tthreshold = 0.4 \t# limiar\n\t\t\t\tloc = np.where(res >= threshold)\n\n\t\t\t\t# Temporizador\n\t\t\t\t# Caso o jogador humano não inicie a jogada em 10 segundos o computador iniciara.\n\t\t\t\tif int(time() - inicial) == 10 and 1 not in tabuleiro:\n\t\t\t\t\taux = randint(0, 8)\n\t\t\t\t\tescolhas.append(aux)\n\t\t\t\t\tinicial = 0\n\n\t\t\t\tfor pt in zip(*loc[::-1]):\n\t\t\t\t\t# desenha um retangulo vermelha nas regioes que dao match com o template.\n\t\t\t\t\tcv2.rectangle(dst, (pt[0]+20,pt[1]+20), (pt[0] + w-20, pt[1] + h-20), (0, 0, 255), 0)\n\n\t\t\t\t\t#\n\t\t\t\t\t#\tDependendo da regiao identificada marca-se na sua respectiva posicao na matriz que representa o tabuleiro.\n\t\t\t\t\t#\n\t\t\t\t\tif img.shape[0]//6 - 50 < pt[0] +w/2 < img.shape[0]//6 + 50 and img.shape[1]//8 - 50 < pt[1]+h/2 < img.shape[1]//8 + 50 and tabuleiro2[0] == False:\n\t\t\t\t\t\tplay.move(tabuleiro, 0, 1)\n\t\t\t\t\t\ttabuleiro2[0] = True\n\t\t\t\t\t\tif play.won(tabuleiro) == 0:\n\t\t\t\t\t\t\taux = randint(0,8)\n\t\t\t\t\t\t\twhile(tabuleiro2[aux] != False):\n\t\t\t\t\t\t\t\taux = randint(0, 8)\n\t\t\t\t\t\t\tescolhas.append(aux)\n\t\t\t\t\telif img.shape[0]//6 -50 < pt[0]+w/2 < img.shape[0]//6 + 50 and 3*img.shape[1]//8 - 50 < pt[1]+h/2< 3*img.shape[1]//8 +50 and tabuleiro2[3] == False:\n\t\t\t\t\t\tplay.move(tabuleiro, 3, 1)\n\t\t\t\t\t\ttabuleiro2[3] = True\n\t\t\t\t\t\tif play.won(tabuleiro) == 0:\n\t\t\t\t\t\t\taux = randint(0,8)\n\t\t\t\t\t\t\twhile(tabuleiro2[aux] != False):\n\t\t\t\t\t\t\t\taux = randint(0, 8)\n\t\t\t\t\t\t\tescolhas.append(aux)\n\t\t\t\t\telif img.shape[0]//6 - 50 < pt[0] +w/2< img.shape[0]//6 + 50 and 5*img.shape[1]//8 - 50 < pt[1]+h/2< 5*img.shape[1]//8 +50 and tabuleiro2[6] == False:\n\t\t\t\t\t\tplay.move(tabuleiro, 6, 1)\n\t\t\t\t\t\ttabuleiro2[6] = True\n\t\t\t\t\t\tif play.won(tabuleiro) == 0:\n\t\t\t\t\t\t\taux = randint(0,8)\n\t\t\t\t\t\t\twhile(tabuleiro2[aux] != False):\n\t\t\t\t\t\t\t\taux = randint(0, 8)\n\t\t\t\t\t\t\tescolhas.append(aux)\n\t\t\t\t\telif 3*img.shape[0]//6 - 50 < pt[0] +w/2< 3*img.shape[0]//6 + 50 and img.shape[1]//8 - 50< pt[1] +h/2<img.shape[1]//8 +50 and tabuleiro2[1] == False:\n\t\t\t\t\t\tplay.move(tabuleiro, 1, 1)\n\t\t\t\t\t\ttabuleiro2[1] = True\n\t\t\t\t\t\tif play.won(tabuleiro) == 0:\n\t\t\t\t\t\t\taux = randint(0,8)\n\t\t\t\t\t\t\twhile(tabuleiro2[aux] != False):\n\t\t\t\t\t\t\t\taux = randint(0, 8)\n\t\t\t\t\t\t\tescolhas.append(aux)\n\t\t\t\t\telif 3*img.shape[0]//6 - 50 < pt[0] +w/2< 3 * img.shape[0]// 6 +50 and 3*img.shape[1]//8 - 50 < pt[1] +h/2< 3* img.shape[1]//8 +50 and tabuleiro2[4] == False:\n\t\t\t\t\t\tplay.move(tabuleiro, 4, 1)\n\t\t\t\t\t\ttabuleiro2[4] = True\n\t\t\t\t\t\tif play.won(tabuleiro) == 0:\n\t\t\t\t\t\t\taux = randint(0,8)\n\t\t\t\t\t\t\twhile(tabuleiro2[aux] != False):\n\t\t\t\t\t\t\t\taux = randint(0, 8)\n\t\t\t\t\t\t\tescolhas.append(aux)\n\t\t\t\t\telif 3*img.shape[0]//6 - 50 < pt[0] +w/2<3*img.shape[0]//6 +50 and 5*img.shape[1]// 8 - 50 < pt[1] +h/2< 5*img.shape[1]//8 +50 and tabuleiro2[7] == False:\n\t\t\t\t\t\tplay.move(tabuleiro, 7, 1)\n\t\t\t\t\t\ttabuleiro2[7] = True\n\t\t\t\t\t\tif play.won(tabuleiro) == 0:\n\t\t\t\t\t\t\taux = randint(0,8)\n\t\t\t\t\t\t\twhile(tabuleiro2[aux] != False):\n\t\t\t\t\t\t\t\taux = randint(0, 8)\n\t\t\t\t\t\t\tescolhas.append(aux)\n\t\t\t\t\telif 5*img.shape[0]//6 - 50 < pt[0] +w/2< 5*img.shape[0]//6 +50 and img.shape[1]//8 - 50 < pt[1] +h/2< img.shape[1]//8 +50 and tabuleiro2[2] == False:\n\t\t\t\t\t\tplay.move(tabuleiro, 2, 1)\n\t\t\t\t\t\ttabuleiro2[2] = True\n\t\t\t\t\t\tif play.won(tabuleiro) == 0:\n\t\t\t\t\t\t\taux = randint(0,8)\n\t\t\t\t\t\t\twhile(tabuleiro2[aux] != False):\n\t\t\t\t\t\t\t\taux = randint(0, 8)\n\t\t\t\t\t\t\tescolhas.append(aux)\n\t\t\t\t\telif 5*img.shape[0]//6 - 50 < pt[0] +w/2< 5*img.shape[0]//6 +50 and 3*img.shape[1]//8 - 50 < pt[1] +h/2< 3*img.shape[1]//8 + 50 and tabuleiro2[5] == False:\n\t\t\t\t\t\tplay.move(tabuleiro, 5, 1)\n\t\t\t\t\t\ttabuleiro2[5] = True\n\t\t\t\t\t\tif play.won(tabuleiro) == 0:\n\t\t\t\t\t\t\taux = randint(0,8)\n\t\t\t\t\t\t\twhile(tabuleiro2[aux] != False):\n\t\t\t\t\t\t\t\taux = randint(0, 8)\n\t\t\t\t\t\t\tescolhas.append(aux)\n\t\t\t\t\telif 5*img.shape[0]//6 - 50 < pt[0] +w/2< 5*img.shape[0]//6 +50 and 5* img.shape[1]//8 - 50 < pt[1] +h/2< 5*img.shape[1]//8 +50 and tabuleiro2[8] == False:\n\t\t\t\t\t\tplay.move(tabuleiro, 8, 1)\n\t\t\t\t\t\ttabuleiro2[8] = True\n\t\t\t\t\t\tif play.won(tabuleiro) == 0:\n\t\t\t\t\t\t\taux = randint(0,8)\n\t\t\t\t\t\t\twhile(tabuleiro2[aux] != False):\n\t\t\t\t\t\t\t\taux = randint(0, 8)\n\t\t\t\t\t\t\tescolhas.append(aux)\n\n\n\n\t\t\t\t#\n\t\t\t\t# Para cada escolha do computador e desenhado circulo nas suas repectivas regioes a cada frame.\n\t\t\t\t#\n\t\t\t\tfor escolha in escolhas:\n\t\t\t\t\tif escolha == 0:\n\t\t\t\t\t\tcv2.circle(dst, (img.shape[0] // 6, img.shape[1] // 8), 50, (255, 0, 0), 4)\n\t\t\t\t\t\tplay.move(tabuleiro, escolha, 0)\n\t\t\t\t\t\ttabuleiro2[0] = True\n\t\t\t\t\telif escolha == 3:\n\t\t\t\t\t\tcv2.circle(dst, (img.shape[0] // 6, 3 * img.shape[1] // 8), 50, (255, 0, 0), 4)\n\t\t\t\t\t\tplay.move(tabuleiro, escolha, 0)\n\t\t\t\t\t\ttabuleiro2[3] = True\n\t\t\t\t\telif escolha == 6:\n\t\t\t\t\t\tcv2.circle(dst, (img.shape[0] // 6, 5 * img.shape[1] // 8), 50, (255, 0, 0), 4)\n\t\t\t\t\t\tplay.move(tabuleiro, escolha, 0)\n\t\t\t\t\t\ttabuleiro2[6] = True\n\t\t\t\t\telif escolha == 1:\n\t\t\t\t\t\tcv2.circle(dst, (3 * img.shape[0] // 6, img.shape[1] // 8), 50, (255, 0, 0), 4)\n\t\t\t\t\t\tplay.move(tabuleiro, escolha, 0)\n\t\t\t\t\t\ttabuleiro2[1] = True\n\t\t\t\t\telif escolha == 4:\n\t\t\t\t\t\tcv2.circle(dst, (3 * img.shape[0] // 6, 3 * img.shape[1] // 8), 50, (255, 0, 0), 4)\n\t\t\t\t\t\tplay.move(tabuleiro, escolha, 0)\n\t\t\t\t\t\ttabuleiro2[4] = True\n\t\t\t\t\telif escolha == 7:\n\t\t\t\t\t\tcv2.circle(dst, (3 * img.shape[0] // 6, 5 * img.shape[1] // 8), 50, (255, 0, 0), 4)\n\t\t\t\t\t\tplay.move(tabuleiro, escolha, 0)\n\t\t\t\t\t\ttabuleiro2[7] = True\n\t\t\t\t\telif escolha == 2:\n\t\t\t\t\t\tcv2.circle(dst, (5 * img.shape[0] // 6, img.shape[1] // 8), 50, (255, 0, 0), 4)\n\t\t\t\t\t\tplay.move(tabuleiro, escolha, 0)\n\t\t\t\t\t\ttabuleiro2[2] = True\n\t\t\t\t\telif escolha == 5:\n\t\t\t\t\t\tcv2.circle(dst, (5 * img.shape[0] // 6, 3 * img.shape[1] // 8), 50, (255, 0, 0), 4)\n\t\t\t\t\t\tplay.move(tabuleiro, escolha, 0)\n\t\t\t\t\t\ttabuleiro2[5] = True\n\t\t\t\t\telif escolha == 8:\n\t\t\t\t\t\tcv2.circle(dst, (5 * img.shape[0] // 6, 5 * img.shape[1] // 8), 50, (255, 0, 0), 4)\n\t\t\t\t\t\tplay.move(tabuleiro, escolha, 0)\n\t\t\t\t\t\ttabuleiro2[8] = True\n\n\t\t\t\t# Escrita do resultado sobre a imagem do tabuleiro.\n\t\t\t\tfonte = cv2.FONT_HERSHEY_SIMPLEX\n\t\t\t\tif play.won(tabuleiro) == 1:\n\t\t\t\t\tcv2.putText(dst, 'Voce perdeu!!!', (125, 250), fonte, 1, (0, 0, 0), 2, cv2.LINE_AA)\n\t\t\t\telif play.won(tabuleiro) == 2:\n\t\t\t\t\tcv2.putText(dst, 'Voce ganhou!!!', (125, 250), fonte, 1, (0, 0, 0), 2, cv2.LINE_AA)\n\t\t\t\telif play.won(tabuleiro) == 3:\n\t\t\t\t\tcv2.putText(dst, 'Deu Velha!!!', (125, 250), fonte, 1, (0, 0, 0), 2, cv2.LINE_AA)\n\t\t\t\tcv2.imshow(\"output\", dst)\n\n\n\t\tcv2.imshow(\"th\",thresh)\n\t\tcv2.imshow('frame', img)\n\tif cv2.waitKey(1) == 32:\n\t\tbreak\n\n# Com o fim do jogo espera-se 3 segundos para fechar a janela.\nsleep(3)\ncv2.imshow('frame', img)\n" }, { "alpha_fraction": 0.623711347579956, "alphanum_fraction": 0.6314433217048645, "avg_line_length": 23.28125, "blob_id": "84831e84e809d9d1ff80fb76ef2824ad9c1ea210", "content_id": "e5260ba821c7ce954007d18e0ee0dd2ab02ac7bd", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 782, "license_type": "no_license", "max_line_length": 68, "num_lines": 32, "path": "/fipe/fipe.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import json\nimport requests\n\napi_url_base = 'http://fipeapi.appspot.com/api/1/carros/'\nheaders = {'Content-Type': 'application/json'}\n\ndef get_info(url):\n\n response = requests.get(url, headers=headers)\n\n if response.status_code == 200:\n return json.loads(response.content.decode('utf-8'))\n else:\n return None\n\nmarcas = get_info(api_url_base + 'marcas.json')\n\n# if marcas is not None:\n# print(\"Aqui estão suas informações: \")\n# for m in marcas:\n# print(m['name'], m['id'])\n# else:\n# print('[!] Solicitação inválida')\n\n# marca = [d['name'] for d in marcas]\nmarca = [m for m in marcas if m['name'] == 'VOLKSWAGEN']\nm = marca[0]\nmid=m['id']\nprint(mid)\n\nveiculos = get_info(api_url_base + 'veiculos/' + str(mid) + '.json')\nprint(veiculos)" }, { "alpha_fraction": 0.5905007719993591, "alphanum_fraction": 0.592409610748291, "avg_line_length": 31.861623764038086, "blob_id": "26596f507867beab659d05d2f22e4493ab99f8dc", "content_id": "bc7caab232d489b9b13b73fa071776172b585b63", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 17812, "license_type": "no_license", "max_line_length": 104, "num_lines": 542, "path": "/djangosige/venv/Lib/site-packages/geraldo/charts.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import re, random, decimal\n\nfrom reportlab.graphics.shapes import Drawing, String\nfrom reportlab.graphics.charts.barcharts import HorizontalBarChart as OriginalHorizBarChart\nfrom reportlab.graphics.charts.barcharts import VerticalBarChart as OriginalVertBarChart\nfrom reportlab.graphics.charts.barcharts import HorizontalBarChart3D as OriginalHorizBarChart3D\nfrom reportlab.graphics.charts.barcharts import VerticalBarChart3D as OriginalVertBarChart3D\nfrom reportlab.graphics.charts.doughnut import Doughnut as OriginalDoughnutChart\nfrom reportlab.graphics.charts.linecharts import HorizontalLineChart as OriginalLineChart\nfrom reportlab.graphics.charts.piecharts import Pie as OriginalPieChart\nfrom reportlab.graphics.charts.spider import SpiderChart as OriginalSpiderChart\nfrom reportlab.graphics.charts.legends import Legend\nfrom reportlab.lib.colors import HexColor, getAllNamedColors\n\nfrom .utils import cm, memoize, get_attr_value\nfrom .cross_reference import CrossReferenceMatrix, CROSS_COLS, CROSS_ROWS\nfrom .graphics import Graphic\nimport collections\n\nDEFAULT_TITLE_HEIGHT = 1*cm\n\nclass BaseChart(Graphic):\n \"\"\"Abstract chart class\"\"\"\n\n chart_class = None\n title = None\n colors = None\n _width = 8*cm\n _height = 7*cm\n rows_attribute = None\n cols_attribute = None\n cell_attribute = None\n action = 'first'\n data = None\n chart_style = None # Additional chart attributes\n axis_labels = None\n axis_labels_angle = None\n legend_labels = False\n values_labels = ' %s '\n replace_none_by_zero = True\n round_values = False\n summarize_by = None # Can be None, CROSS_ROWS or CROSS_COLS\n\n def __init__(self, **kwargs):\n # Set instance attributes\n for k,v in list(kwargs.items()):\n if k == 'style':\n setattr(self, 'chart_style', v)\n else:\n setattr(self, k, v)\n\n # Prepare the title\n if self.title:\n self.title = isinstance(self.title, dict) and self.title or {'text': self.title}\n self.title.setdefault('fontSize', 14)\n self.title.setdefault('textAnchor', 'middle')\n self.title.setdefault('height', DEFAULT_TITLE_HEIGHT)\n\n # Prepare the colors\n if self.colors == False:\n self.legend_labels = None\n elif not self.colors:\n self.colors = self.get_available_colors()\n else:\n self.prepare_colors()\n\n # Prepare chart additional kwargs\n self.chart_style = self.chart_style or {}\n\n def clone(self):\n new = super(BaseChart, self).clone()\n\n new.chart_class = self.chart_class\n new.title = self.title\n new.colors = self.colors\n new.rows_attribute = self.rows_attribute\n new.cols_attribute = self.cols_attribute\n new.cell_attribute = self.cell_attribute\n new.action = self.action\n new.data = self.data\n new.chart_style = self.chart_style\n new.axis_labels = self.axis_labels\n new.axis_labels_angle = self.axis_labels_angle\n new.legend_labels = self.legend_labels\n new.values_labels = self.values_labels\n new.replace_none_by_zero = self.replace_none_by_zero\n new.round_values = self.round_values\n new.summarize_by = self.summarize_by\n\n return new\n\n # DRAWING METHODS\n\n @memoize\n def get_available_colors(self):\n \"\"\"Returns a list of available colors\"\"\"\n\n # Get reportlab available colors\n colors = getAllNamedColors()\n\n # Remove bad colors\n colors.pop('white', None)\n colors.pop('black', None)\n\n # Returns only the colors values (without their names)\n colors = list(colors.values())\n \n # Shuffle colors list\n random.shuffle(colors)\n\n return colors\n\n def prepare_colors(self):\n colors = []\n\n for color in self.colors:\n try:\n colors.append(HexColor(color))\n except ValueError:\n pass\n\n self.colors = colors + self.get_available_colors()\n\n def get_drawing(self, chart):\n \"\"\"Create and returns the drawing, to be generated\"\"\"\n\n drawing = Drawing(self.width, self.height)\n\n # Make the title\n title = self.make_title(drawing)\n\n # Setting chart dimensions\n chart.height = self.height\n chart.width = self.width\n\n # Make the legend\n legend = self.make_legend(drawing, chart)\n\n if title:\n chart.height -= self.title.get('height', DEFAULT_TITLE_HEIGHT)\n self.top += self.title.get('height', DEFAULT_TITLE_HEIGHT)\n\n # Setting additional chart attributes\n self.set_chart_style(chart)\n\n # Adds the chart to drawing to return\n drawing.add(chart)\n\n # Resizes to make sure everything is fitting\n drawing = drawing.resized()\n\n return drawing\n\n def make_legend(self, drawing, chart):\n if not self.legend_labels:\n return\n\n # Get legend labels\n labels = self.get_legend_labels()\n\n # Legend object\n legend = Legend()\n\n legend.colorNamePairs = list(zip(self.colors[:len(labels)], labels))\n legend.columnMaximum = len(legend.colorNamePairs)\n legend.deltay = 5\n legend.alignment = 'right'\n legend.x = drawing.width + 40\n legend.y = drawing.height - (self.title and self.title.get('height', DEFAULT_TITLE_HEIGHT) or 0)\n\n # Sets legend extra attributes if legend_labels is a dictionary\n if isinstance(self.legend_labels, dict):\n for k,v in list(self.legend_labels.items()):\n if k != 'labels' and v:\n setattr(legend, k, v)\n\n drawing.add(legend)\n\n return legend\n\n def get_legend_labels(self):\n # Use same axis if is summarizing\n if self.summarize_by:\n return self.get_axis_labels()\n\n # Base labels\n if isinstance(self.legend_labels, dict) and self.legend_labels.get('labels', None):\n labels = self.legend_labels['labels']\n elif isinstance(self.legend_labels, (tuple,list)):\n labels = self.legend_labels\n else:\n labels = self.get_cross_data().rows()\n\n # Calculated labels\n if isinstance(self.legend_labels, collections.Callable):\n labels = [self.legend_labels(self, label, num) for num, label in enumerate(labels)]\n elif isinstance(self.legend_labels, str):\n labels = [self.get_cross_data().first(self.legend_labels, col=label) for label in labels]\n\n return list(map(str, labels))\n\n def get_axis_labels(self):\n # Base labels\n if isinstance(self.axis_labels, dict) and self.axis_labels.get('labels', None):\n labels = self.axis_labels['labels']\n elif isinstance(self.axis_labels, (tuple,list)):\n labels = self.axis_labels\n elif self.summarize_by == CROSS_ROWS:\n labels = self.get_cross_data().rows()\n else:\n labels = self.get_cross_data().cols()\n\n # Calculated labels\n if isinstance(self.axis_labels, collections.Callable):\n labels = [self.axis_labels(self, label, num) for num, label in enumerate(labels)]\n elif isinstance(self.axis_labels, str):\n if self.summarize_by == CROSS_ROWS:\n labels = [self.get_cross_data().first(self.axis_labels, row=label) for label in labels]\n else:\n labels = [self.get_cross_data().first(self.axis_labels, col=label) for label in labels]\n\n return list(map(str, labels))\n\n def make_title(self, drawing):\n if not self.title:\n return\n\n # Make the dict with kwargs\n kwargs = self.title.copy()\n kwargs.setdefault('x', drawing.width / 2)\n kwargs.setdefault('y', drawing.height)\n\n # Make the string\n title = String(**kwargs)\n\n drawing.add(title)\n\n return title\n\n # CHART METHODS\n\n def get_cross_data(self, data=None):\n if not getattr(self, '_cross_data', None):\n data = data or self.data\n\n # Transforms data to cross-reference matrix\n if isinstance(data, str):\n data = get_attr_value(self.instance, data)\n\n if not isinstance(data, CrossReferenceMatrix):\n if self.rows_attribute: # and self.cols_attribute:\n data = CrossReferenceMatrix(\n data,\n self.rows_attribute,\n self.cols_attribute,\n decimal_as_float=True,\n )\n\n self._cross_data = data\n\n return self._cross_data\n\n def get_data(self):\n data = self.data\n\n # Returns nothing data is empty\n if not data:\n data = self.report.queryset # TODO: Change to support current objects\n # list (for subreports and groups)\n\n # Transforms data to cross-reference matrix\n data = self.get_cross_data(data)\n\n # Summarize data or get its matrix (after it is a Cross-Reference Matrix)\n if self.summarize_by == CROSS_ROWS:\n data = data.summarize_rows(self.cell_attribute, self.action)\n elif self.summarize_by == CROSS_COLS:\n data = data.summarize_cols(self.cell_attribute, self.action)\n else:\n data = data.matrix(self.cell_attribute, self.action)\n\n def none_to_zero(value):\n if value is None:\n value = 0\n elif isinstance(value, (list, tuple)):\n value = [cell or 0 for cell in value]\n\n return value\n\n def round_values(value):\n if isinstance(value, (float, decimal.Decimal)):\n value = int(round(value))\n elif isinstance(value, (list, tuple)):\n value = list(map(int, list(map(round, value))))\n\n return value\n\n # Replace None to Zero\n if self.replace_none_by_zero:\n data = list(map(none_to_zero, data))\n\n # Truncate decimal places\n if self.round_values:\n data = list(map(round_values, data))\n\n # Stores major value in temporary variable to use it later\n if data:\n if isinstance(data[0], int):\n self._max_value = max(data)\n elif isinstance(data[0], (list, tuple)):\n self._max_value = max(list(map(max, data)))\n\n return data\n\n def set_chart_attributes(self, chart):\n # Cols (Y) labels - Y axis\n if self.axis_labels:\n chart.categoryAxis.categoryNames = self.get_axis_labels()\n\n if self.axis_labels_angle is not None:\n chart.categoryAxis.labels.angle = self.axis_labels_angle\n chart.categoryAxis.labels.boxAnchor = 'ne'\n\n def set_chart_style(self, chart):\n # Setting additional chart attributes\n if self.chart_style:\n for k,v in list(self.chart_style.items()):\n setattr(chart, k, v)\n\n def create_chart(self):\n chart = self.chart_class()\n\n return chart\n\n def render(self):\n # Make data matrix\n data = self.get_data()\n\n if not data:\n return\n\n # Creates the chart instance\n chart = self.create_chart()\n chart.data = data\n\n # Sets additional attributes\n self.set_chart_attributes(chart)\n\n return self.get_drawing(chart)\n\nclass BaseMatrixChart(BaseChart):\n \"\"\"Abstract chart class to support matrix charts\"\"\"\n\n def get_data(self):\n data = super(BaseMatrixChart, self).get_data()\n\n if data and self.summarize_by:\n data = [data]\n \n return data\n\nclass LineChart(BaseMatrixChart):\n chart_class = OriginalLineChart\n\n def set_chart_attributes(self, chart):\n super(LineChart, self).set_chart_attributes(chart)\n\n # Cells labels\n if isinstance(self.values_labels, (tuple, list)):\n self.chart_style.setdefault('lineLabelFormat', self.values_labels)\n elif isinstance(self.values_labels, dict) and self.values_labels.get('labels', None):\n self.chart_style.setdefault('lineLabelFormat', self.values_labels['labels'])\n else:\n self.chart_style.pop('lineLabelFormat', None)\n\n # Set the line colors\n if self.colors:\n for num, color in enumerate(self.colors):\n try:\n chart.lines[num].strokeColor = color\n except IndexError:\n break\n\n # Value Axis min value\n if getattr(self, 'y_axis_min_value', None) != None:\n chart.valueAxis.valueMin = self.y_axis_min_value\n\n # Informed value axis step value\n if getattr(self, 'y_axis_step_value', None):\n chart.valueAxis.valueStep = self.y_axis_step_value\n\n # Value axis without decimal values\n elif self.round_values and getattr(self, '_max_value', None):\n chart.valueAxis.valueStep = round(self._max_value / 4)\n\nclass BarChart(BaseMatrixChart):\n chart_class = None\n horizontal = False # If is not horizontal, is because it is vertical (default)\n is3d = False\n\n def __init__(self, *args, **kwargs):\n super(BarChart, self).__init__(*args, **kwargs)\n\n # Chart class varies depending on attributes\n if not self.chart_class:\n if self.horizontal and self.is3d:\n self.chart_class = OriginalHorizBarChart3D\n elif self.horizontal:\n self.chart_class = OriginalHorizBarChart\n elif self.is3d:\n self.chart_class = OriginalVertBarChart3D\n else:\n self.chart_class = OriginalVertBarChart\n\n def clone(self):\n new = super(BarChart, self).clone()\n\n new.horizontal = self.horizontal\n new.is3d = self.is3d\n\n return new\n\n def set_chart_attributes(self, chart):\n super(BarChart, self).set_chart_attributes(chart)\n\n # Cells labels\n if self.values_labels:\n if isinstance(self.values_labels, (tuple, list)):\n self.chart_style.setdefault('barLabelFormat', self.values_labels)\n elif isinstance(self.values_labels, dict) and self.values_labels.get('labels', None):\n self.chart_style.setdefault('barLabelFormat', self.values_labels['labels'])\n\n # Label orientation\n if self.horizontal:\n chart.barLabels.boxAnchor = 'w'\n else:\n chart.barLabels.boxAnchor = 's'\n else:\n self.chart_style.pop('barLabelFormat', None)\n\n # Set bar strokes\n chart.bars.strokeWidth = 0\n\n # Forces bars to start from 0 (instead of lower value)\n chart.valueAxis.forceZero = 1\n\n # Shows axis X labels\n if not self.summarize_by: # XXX\n chart.categoryAxis.categoryNames = self.get_axis_labels()\n\n # Set the bar colors\n if self.colors:\n for num, color in enumerate(self.colors):\n try:\n chart.bars[num].fillColor = color\n except IndexError:\n break\n\n def get_data(self):\n data = super(BarChart, self).get_data()\n\n # Forces multiple colors\n if self.summarize_by and data:\n data = [[i] for i in data[0]]\n\n return data\n\nclass HorizontalBarChart(BarChart):\n horizontal = True\n\nclass SpiderChart(BaseMatrixChart):\n chart_class = OriginalSpiderChart\n\n def set_chart_attributes(self, chart):\n # Chart labels\n chart.labels = self.get_axis_labels()\n\n # Set the strands colors\n if self.colors:\n for num, color in enumerate(self.colors):\n try:\n chart.strands[num].fillColor = color\n except IndexError:\n break\n\nclass PieChart(BaseChart):\n chart_class = OriginalPieChart\n slice_popout = None\n\n def __init__(self, **kwargs):\n super(PieChart, self).__init__(**kwargs)\n\n # Force default value for summarize\n if not self.summarize_by:\n self.summarize_by = CROSS_ROWS\n\n def set_chart_attributes(self, chart):\n # Sets the slice colors\n if self.colors:\n for num, color in enumerate(self.colors):\n try:\n chart.slices[num].fillColor = color\n except IndexError:\n break\n\n # Sets the slice to popout\n pos = -1\n if self.slice_popout == True:\n data = self.get_data()\n pos = data.index(max(data))\n elif isinstance(self.slice_popout, int):\n pos = self.slice_popout\n elif isinstance(self.slice_popout, collections.Callable):\n pos = self.slice_popout(self, chart)\n\n if pos >= 0:\n chart.slices[pos].popout = 20\n\n # Default labels\n chart.labels = self.get_axis_labels()\n\n # Cells labels\n if isinstance(self.values_labels, dict):\n for k,v in list(self.values_labels.items()):\n if k == 'labels' and v:\n chart.labels = v\n else:\n setattr(chart.slices, k, v)\n\n def clone(self):\n new = super(PieChart, self).clone()\n new.slice_popout = self.slice_popout\n return new\n\n def get_drawing(self, chart):\n if self.action == 'percent':\n chart.labels = ['%s - %s%%'%(label,val) for label, val in zip(chart.labels, chart.data)]\n\n return super(PieChart, self).get_drawing(chart)\n\nclass DoughnutChart(PieChart):\n chart_class = OriginalDoughnutChart\n\n" }, { "alpha_fraction": 0.5412907600402832, "alphanum_fraction": 0.544876217842102, "avg_line_length": 30.554744720458984, "blob_id": "19c2432ea988a86292903e762b9eda958249f02d", "content_id": "e1c3a333ac2aa34ccd0137ccf91d09e90d2b89ed", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 8709, "license_type": "no_license", "max_line_length": 105, "num_lines": 274, "path": "/Hospital-Helper-2-master/app/gui/crud_widget.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import os\nimport functools\n\nfrom PyQt5.QtGui import QIcon\nfrom PyQt5.QtWidgets import (QWidget, QFrame, QLineEdit, QPushButton, QHBoxLayout,\n QComboBox, QLabel, QVBoxLayout)\n\nfrom app import options\nfrom app.gui import utils\nfrom app.model import db\n\n\nclass CrudWidget(QFrame):\n\n \"\"\"\n Wrapper for CrudWidgetContent.\n Shadows the application.\n \"\"\"\n\n def __init__(self, main_window, model, callback=None, item=None):\n super().__init__(main_window)\n self.setFixedSize(main_window.size())\n self.show()\n self.move(self.x(), main_window.top_system_frame_height)\n self.raise_()\n CrudWidgetContent(self, main_window, model, callback, item)\n\n\nclass CrudWidgetContent(QFrame):\n\n def __init__(self, parent, main_window, model, callback, item=None):\n\n \"\"\"\n Widget for CRUD operations on model instances.\n \"\"\"\n\n super().__init__(parent)\n\n self.callback = callback\n self.values = {}\n self.foreigns = {}\n self.model = model\n self.item = item\n self.created_items = []\n self._close = self._get_close_function(parent)\n self._delete = self._get_delete_functon(main_window)\n\n self._create_layout(main_window)\n self._check_input()\n\n def _get_controls_layout(self, layout):\n \"\"\"\n Return buttons layout\n \"\"\"\n\n hbox = QHBoxLayout()\n hbox.addStretch()\n hbox.setContentsMargins(0, 0, 0, 0)\n hbox.setSpacing(10)\n\n # args = ((' Сохранить', ' Закрыть'),\n # ('save', 'close'),\n # ('save_w.png', 'close.png'),\n # (self._save, self._close))\n\n args = ((' Salvar', ' Fechar'),\n ('save', 'close'),\n ('save_w.png', 'close.png'),\n (self._save, self._close))\n\n for l, n, i, f in zip(*args):\n b = QPushButton(l)\n b.clicked.connect(f)\n b.setObjectName(n)\n b.setIcon(QIcon(os.path.join(options.STATIC_DIR, 'icons', i)))\n b.setGraphicsEffect(utils.get_shadow())\n hbox.addWidget(b)\n\n if self.item:\n # b = QPushButton('Удалить')\n b = QPushButton('Excluir')\n b.setObjectName('delete')\n b.clicked.connect(self._delete)\n b.setGraphicsEffect(utils.get_shadow())\n hbox.addWidget(b)\n\n return hbox\n\n def _create_layout(self, main_window):\n \"\"\"\n Create main layout of widget.\n \"\"\"\n\n layout = QVBoxLayout()\n self.setLayout(layout)\n layout.setContentsMargins(30, 10, 30, 10)\n layout.setSpacing(0)\n\n print(self.model.__table__.name)\n l = QLabel(_(self.model.__table__.name))\n l.setText(self.model.__table__.name)\n l.setObjectName('title')\n layout.addWidget(l)\n\n scrollable = QVBoxLayout()\n for row in self._get_rows(self.model, main_window):\n for w in row:\n scrollable.addWidget(w)\n\n scrollable = utils.get_scrollable(scrollable)\n\n controls_layout = self._get_controls_layout(layout)\n\n layout.addWidget(scrollable)\n layout.addLayout(controls_layout)\n\n self.show()\n self.raise_()\n self.move((main_window.width() - self.width()) / 2, (main_window.height() - self.height()) / 2)\n\n def _get_combobox(self, column, relations, main_window):\n\n \"\"\"\n Return combobox for foreign fields.\n \"\"\"\n\n label = column.name\n print(label)\n if label.endswith('_id'):\n label = label[:-3]\n foreign_model = relations.get(label).mapper.class_\n items = list(db.SESSION.query(foreign_model).filter(foreign_model.deleted == False))\n self.foreigns[column.name] = items\n items_labels = [str(i) for i in items]\n widget = QWidget()\n widget.setStyleSheet('margin:0;')\n combo_box = QComboBox()\n combo_box.addItems(items_labels)\n combo_box.currentIndexChanged.connect(self._check_input)\n combo_box.setObjectName(column.name)\n hbox = QHBoxLayout()\n hbox.setContentsMargins(0, 0, 0, 0)\n hbox.setSpacing(0)\n hbox.addWidget(combo_box, stretch=95)\n for icon, new in zip(('pencil_g.png', 'plus.png'), (False, True)):\n b = QPushButton()\n b.setObjectName('icon')\n b.setIcon(QIcon(os.path.join(options.STATIC_DIR, 'icons', icon)))\n b.clicked.connect(functools.partial(\n self.open_crud, main_window, foreign_model, new, combo_box))\n hbox.addWidget(b, stretch=2)\n widget.setLayout(hbox)\n return label, widget\n\n def _get_rows(self, model, main_window):\n \"\"\"\n Default row for a form is QLabel, QLineEdit\n But for foreign fields it's QComboBox\n Maybe later I will add QCalendar for dates and etc.\n \"\"\"\n\n for column in model.__table__.columns:\n if column.name == 'id' or column.default:\n continue\n\n if column.foreign_keys:\n label, widget = self._get_combobox(column, model.__mapper__.relationships, main_window)\n else:\n label = column.name\n widget = QLineEdit()\n widget.textEdited.connect(self._check_input)\n widget.setObjectName(column.name)\n if self.item:\n widget.setText(getattr(self.item, column.name, ''))\n\n print(label)\n # yield QLabel(_(label)), widget\n yield QLabel(label), widget\n\n def _get_delete_functon(self, main_window):\n def _delete_for_real(for_real):\n if not for_real:\n return\n if hasattr(self.item, 'deleted'):\n self.item.deleted = True\n self.item.save()\n else:\n self.item.delete()\n self._close()\n\n def _delete():\n \"\"\"\n Delete item.\n \"\"\"\n\n # main_window.create_alert(text='Действие не может быть отменено.\\nПродолжить?',\n main_window.create_alert(text='A ação não pode ser desfeita.\\nContinua?',\n callback=_delete_for_real)\n return _delete\n\n def _get_close_function(self, parent):\n \"\"\"\n Delete widget.\n \"\"\"\n\n def _close():\n self.callback(self.created_items)\n parent.deleteLater()\n return _close\n\n def _save(self, event=None):\n \"\"\"\n Save instance.\n \"\"\"\n\n kwargs = {}\n for each in self.findChildren(QLineEdit):\n kwargs[each.objectName()] = each.text()\n\n for each in self.findChildren(QComboBox):\n kwargs[each.objectName()] = self.foreigns[each.objectName()][\n each.currentIndex()].id\n\n if self.item:\n self.item.update(**kwargs)\n else:\n self.item = self.model(**kwargs)\n self.item.save()\n self.created_items.append(self.item)\n self._close()\n\n def _check_input(self):\n \"\"\"\n Disable 'save' button if not all mandatory fields are filled.\n \"\"\"\n\n self.findChild(QPushButton, name='save').setDisabled(\n not all([each.text() for each in self.findChildren(QLineEdit)]))\n\n def _add_foreign_item(self, combo_box, items):\n \"\"\"\n Add new instance for combobox.\n \"\"\"\n\n for item in items:\n created = True\n for i, each in enumerate(self.foreigns[combo_box.objectName()]):\n if each.id == item.id:\n self.foreigns[combo_box.objectName()][i] = item\n combo_box.removeItem(i)\n combo_box.insertItem(i, str(item))\n combo_box.setCurrentIndex(i)\n created = False\n break\n if created:\n self.created_items.append(item)\n combo_box.addItem(str(item))\n self.foreigns[combo_box.objectName()].append(item)\n combo_box.setCurrentIndex(combo_box.count() - 1)\n\n def open_crud(self, main_window, model, new, combo_box):\n\n \"\"\"\n Open another crud window for foreign instance.\n \"\"\"\n\n item = None\n if not new:\n index = combo_box.currentIndex()\n if index == -1:\n return\n item = self.foreigns[combo_box.objectName()][index]\n\n main_window.create_crud_widget(model, functools.partial(self._add_foreign_item, combo_box), item)\n" }, { "alpha_fraction": 0.5088529586791992, "alphanum_fraction": 0.5896843671798706, "avg_line_length": 28.191011428833008, "blob_id": "cfcb04b962ccd9186874eb8f22ab63fcdea58c59", "content_id": "ea84f1f7503c29183cb643538c3d9d306bbfae00", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2598, "license_type": "no_license", "max_line_length": 74, "num_lines": 89, "path": "/JPro-master/populate.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import datetime\t\nfrom sqlalchemy import create_engine\nfrom sqlalchemy.orm import sessionmaker\nfrom dbcreation import Base, Models, ProductionQueue \n\n# C1dict = {\"P1\":12,\"P2\":4,\"P5\":5,\"P6\":7,\"P10\":1}\n# C2dict = {\"P1\":12,\"P2\":6,\"P6\":5,\"P8\":9,\"P10\":1}\n# C3dict = {\"P1\":12,\"P2\":7,\"P5\":5,\"P7\":15,\"P9\":4}\n# C4dict = {\"P3\":3,\"P4\":6,\"P7\":13,\"P8\":9,\"P10\":1}\n# C5dict = {\"P3\":3,\"P4\":6,\"P7\":18}\n# C6dict = {\"P3\":3,\"P4\":4,\"P8\":10,\"P9\":5}\n# C7dict = {\"P5\":8,\"P6\":8,\"P9\":5}\n\ndef Main(): \n\n\t#===##===##===##===##===##===##===#\n\t#Connection to SQLITE DB \n\t#===##===##===##===##===##===##===#\n\tengine = create_engine('sqlite:///complete.db')\n\tBase.metadata.bind = engine\n\tDBSession = sessionmaker(bind=engine)\n\tsession = DBSession()\n\n\t#===##===##===##===##===##===##===#\n\t#Removal of all current entries \n\t#===##===##===##===##===##===##===#\n\n\tremoveModels = session.query(Models).all()\n\tremoveProductionQueue = session.query(ProductionQueue).all()\n\n\tfor r in removeModels: \n\t\tsession.delete(r)\n\t\tsession.commit()\n\n\tfor r in removeProductionQueue: \n\t\tsession.delete(r)\n\t\tsession.commit()\n\n\t#===##===##===##===##===##===##===#\n\t#Populate database \n\t#===##===##===##===##===##===##===#\n\n\tM1 = Models(name = 'M1', parts=\"P1,P2,P3,P4,P5\", current_quantity = 200)\n\tM2 = Models(name = 'M2', parts=\"P1,P3,P6,P8,P9\", current_quantity = 100)\n\tM3 = Models(name = 'M3', parts=\"P1,P2,P8,P9,P10\", current_quantity = 300)\n\tM4 = Models(name = 'M4', parts=\"P1,P4,P5,P7,P9\", current_quantity = 800)\n\n\tsession.add(M1)\n\tsession.add(M2)\n\tsession.add(M3)\n\tsession.add(M4,M1)\n\n\tOrder1 = ProductionQueue(model = \"M1\", order_quantity=300)\n\tOrder2 = ProductionQueue(model = \"M2\", order_quantity=400)\n\tOrder3 = ProductionQueue(model = \"M3\", order_quantity=600)\n\tOrder4 = ProductionQueue(model = \"M4\", order_quantity=200)\n\n\tsession.add(Order1)\n\tsession.add(Order2)\n\tsession.add(Order3)\n\tsession.add(Order4)\n\n\t# P1 = Parts(name = 'P1',processes=\"C1,C2,C3\")\n\t# P2 = Parts(name = 'P2',processes=\"C1,C2,C3\")\n\t# P3 = Parts(name = 'P3',processes=\"C4,C5,C6\")\n\t# P4 = Parts(name = 'P4',processes=\"C4,C5,C6\")\n\t# P5 = Parts(name = 'P5',processes=\"C1,C3,C7\")\n\t# P6 = Parts(name = 'P6',processes=\"C1,C2,C7\")\n\t# P7 = Parts(name = 'P7',processes=\"C3,C4,C5\")\n\t# P8 = Parts(name = 'P8',processes=\"C2,C4,C6\")\n\t# P9 = Parts(name = 'P9',processes=\"C3,C6,C7\")\n\t# P10 = Parts(name = 'P10',processes=\"C1,C2,C4\")\n\n\n\t# session.add(P1)\n\t# session.add(P2)\n\t# session.add(P3)\n\t# session.add(P4)\n\t# session.add(P5)\n\t# session.add(P6)\n\t# session.add(P7)\n\t# session.add(P8)\n\t# session.add(P9)\n\t# session.add(P10)\n\n\tsession.commit()\n \nif __name__ == '__main__': \n\tMain() " }, { "alpha_fraction": 0.39814308285713196, "alphanum_fraction": 0.5095576047897339, "avg_line_length": 42.595237731933594, "blob_id": "d5c191f73701c84439efced7dce3b0a535b6b7ab", "content_id": "fbd95b4a60dac09cacd9c8ba763405f04e621404", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1831, "license_type": "no_license", "max_line_length": 460, "num_lines": 42, "path": "/fullodbc/verificaEmailFco.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import sys\nimport re\nimport pyodbc\n\ndef isEmail(email):\n \"\"\"Verifica se o email -e valido\"\"\"\n if not re.match(r\"(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|\\\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\\\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])\", email):\n return(False)\n return(True) \n\ncnxn = pyodbc.connect('DSN=p;UID=system')\ncursor = cnxn.cursor()\ndata = []\ncolumns = []\ncolumns.append('cliente')\ncolumns.append('nome')\ncolumns.append('email')\ncursor.execute(\"select fco_fco, fco_nome, fco_email from aigefcop where fco_empresa = 51 and fco_email <> ''\")\nrows = cursor.fetchall()\nconta = 0\nlidos = 0\nfor row in rows:\n lidos+=1\n if not isEmail(row[2]):\n print(row[0], row[1], row[2])\n conta+=1\n\nprint('Lidos {}, invalidos {}'.format(lidos, conta))\n\n# print(rows)\n# for row in cursor.fetchall():\n# # print(row)\n# # data.append([x for x in row])\n# # data.append(list(row))\n# print(row[0][0])\n# data.append(dict(zip(columns,row)))\n# print(data)\n# input()\n\n# email = \"bueno@1linha\"\n# if not re.match(r\"(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|\\\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\\\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])\", email):\n# print(\"email invalido\")\n" }, { "alpha_fraction": 0.6250739097595215, "alphanum_fraction": 0.7735068202018738, "avg_line_length": 28.15517234802246, "blob_id": "d997c0702fbd7df802ec01fd340410905cfa9f51", "content_id": "9cd8b7f4b89732237ef04b1639b33634aed5c293", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1691, "license_type": "no_license", "max_line_length": 112, "num_lines": 58, "path": "/vtk-001.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "# Biblioteca vtk para python\n# from vtk import *\nimport vtk\n\n# ENTRADA DE DADOS\n# Pontos\npoints = vtk.vtkPoints()\npoints.SetNumberOfPoints(3)\npoints.InsertPoint(0, 76.3221, 77.55, 6.51956)\npoints.InsertPoint(1, 76.61, 77.2565, 6.48612)\npoints.InsertPoint(2, 77.2707, 76.61, 6.44554)\n# Tensores\ndbar = vtk.vtkDoubleArray()\ndbar.SetNumberOfTuples(3)\ndbar.SetNumberOfComponents(9)\ndbar.InsertTuple9(0, -1.15233, 0.0831558, 0.0469417, 0.0831558, -1.25721, 0.10167, 0.0469417, 0.10167, -1.10715)\ndbar.InsertTuple9(1, -1.18056, 0.0817272, 0.016076, 0.0817272, -1.32675, 0.125833, 0.016076, 0.125833, -1.15438)\ndbar.InsertTuple9(2, -1.18056, 0.0817272, 0.016076, 0.0817272, -1.32675, 0.125833, 0.016076, 0.125833, -1.15438)\n\n# PROCESSAMENTO PARA GERAR OS GLIFOS\n# Polydata\nindata = vtk.vtkPolyData()\nindata.SetPoints(points)\nindata.GetPointData().SetTensors(dbar)\n# Codigo para uma esfera\nsrc = vtk.vtkSphereSource()\nsrc.SetThetaResolution(16)\nsrc.SetPhiResolution(16)\n# glifos\nepp = vtk.vtkTensorGlyph()\nepp.SetInput(indata)\nepp.SetSourceConnection(src.GetOutputPort())\nepp.SetScaleFactor(1)\nepp.ClampScalingOn()\n# epp.SymmetricOn()\nepp.ColorGlyphsOff()\nepp.ThreeGlyphsOff()\nepp.ExtractEigenvaluesOn()\nepp.SetColorModeToEigenvalues()\n# Mapeador para os dados\nmap = vtk.vtkPolyDataMapper()\nmap.SetInputConnection(epp.GetOutputPort())\n\n# VISUALIZACAO\n# Ator\nelactor = vtk.vtkActor()\nelactor.SetMapper(map)\n# Renderizador\nrenderer = vtk.vtkRenderer()\nrenderer.AddActor(elactor)\n# Janela\nrenderWindow = vtk.vtkRenderWindow()\nrenderWindow.AddRenderer(renderer)\n# Interador\ninteractor = ctk.vtkRenderWindowInteractor()\ninteractor.SetRenderWindow(renderWindow)\ninteractor.Initialize()\ninteractor.Start()\n" }, { "alpha_fraction": 0.6274982690811157, "alphanum_fraction": 0.6498966217041016, "avg_line_length": 28.31313133239746, "blob_id": "01207e64e5561d211ec17d6c6490a7769d3392c9", "content_id": "5a5f223a3592d7dde3ee3286e9858aa6990dbe12", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2918, "license_type": "no_license", "max_line_length": 77, "num_lines": 99, "path": "/JPro-master/tbox.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "\n#====##====##====##====##====#\n#====##====##====##====##====#\n'''\nWIKI of all items: \n\n- Uses a Tree view to display pages for each item and its components \n- Display most optimal time and processes needed to run \n \n'''\n#====##====##====##====##====#\n#====##====##====##====##====#\n\nimport sys \nimport datetime\nfrom PyQt5.QtWidgets import (QApplication, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQWidget, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQLabel, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQListWidget,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQListWidgetItem,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQHBoxLayout,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQVBoxLayout,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQGridLayout,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tQShortcut,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tqApp,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\nfrom PyQt5.QtGui import QKeySequence,QStandardItem,QStandardItemModel\nfrom connect import Connect \nfrom dbcreation import Base, Models, ProductionQueue\nfrom dialog_new import Dialog as DBox\n\nclass TBox(QWidget): \n\n\tdef __init__(self): \n\t\tsuper().__init__()\n\n\t\texitShortcut = QShortcut(QKeySequence('Ctrl+W'),self, qApp.quit)\n\t\t\n\t\tself.connect = Connect()\n\n\t\tself.all_models = self.connect.session.query(Models).all()\n\n\t\tself.labelval_name = QLabel('Model / 模型 ',self)\n\t\tself.labelkey_parts = QLabel('Parts / 零件',self)\n\t\tself.labelkey_current_quantity = QLabel('Current Quantity / 数量', self)\n\t\tself.labelval_parts = QLabel('N/A',self)\n\t\tself.labelval_current_quantity = QLabel('N/A', self)\t\t\n\n\t\tself.createList()\n\t\tself.list.currentItemChanged.connect(self.listClicked)\n\n#\t\tprint('Current Item :', self.list.currentItem())\n\t\tself.positionWidgets()\n\t\tself.styling()\n\n\t\tself.setGeometry(0,0,640,440)\n\t\tself.show()\n\n#===#===#===#===#===#===#===#===#===#\n#METHODS\n#===#===#===#===#===#===#===#===#===#\n\tdef showInfo(self, queryitem):\n\t\tquery = self.connect.session.query(Models).filter_by(name=queryitem).one()\t\n\t\tself.labelval_name.setText(query.name)\n\t\tself.labelval_parts.setText(query.parts)\n\t\tself.labelval_current_quantity.setText(str(query.current_quantity))\n\n\t\tself.labelval_parts.adjustSize()\n\n\tdef createList(self): \n\t\tself.list = QListWidget(self)\n\t\tfor model in self.all_models: \n\t\t\tself.list.addItem(QListWidgetItem(model.name))\n\t\t\tself.list.setMinimumSize(150,200)\n\t\t\tself.list.setMaximumSize(150,600)\n\n\tdef positionWidgets(self):\n\t\tself.list.move(10,10)\n\t\tself.labelval_name.move(300, 30)\n\t\tself.labelkey_parts.move(200, 150)\n\t\tself.labelkey_current_quantity.move(200,200)\n\t\tself.labelval_parts.move(400,150)\n\t\tself.labelval_current_quantity.move(400,200)\n\n\tdef styling(self):\n\t\tself.labelval_name.setStyleSheet('font-size:24px')\n\t\tself.labelkey_parts.setStyleSheet('font-size:14px')\n\t\tself.labelkey_current_quantity.setStyleSheet('font-size:14px')\n\t\tself.labelval_parts.setStyleSheet('font-size:14px')\n\t\tself.labelval_current_quantity.setStyleSheet('font-size:14px')\n\n\tdef listClicked(self):\n\t\tcurrent_selection = self.list.currentItem().text()\n\t\tself.showInfo(current_selection)\n\nif __name__ == '__main__' : \n\n\tapp = QApplication(sys.argv)\n\ttbox = TBox()\n\tsys.exit(app.exec_())" }, { "alpha_fraction": 0.4438416063785553, "alphanum_fraction": 0.4551979899406433, "avg_line_length": 40.4427375793457, "blob_id": "5cc75a770dacda79ed15289028ca5ef3b6633160", "content_id": "7e810977da91f1ac50f45c82263463b9de7c0914", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 29678, "license_type": "no_license", "max_line_length": 231, "num_lines": 716, "path": "/PQt5-Stock/Controlador/pEstadisticas.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "from Conexion.conexionGeneral import ConexionGenerales\nfrom PyQt5.Qt import QDesktopServices, QUrl\nimport datetime\nfrom PyQt5.Qt import QTextDocument, QPrinter\nfrom PyQt5.QtWidgets import QDateEdit\nfrom PyQt5.QtWidgets import QMessageBox, QDialog\nfrom Modelo.cliente import Cliente\nfrom Modelo.proveedor import Proveedor\nfrom Componentes.tableModel import MyTableModel\nimport matplotlib.pyplot as pyplot\nimport numpy as np\nfrom PyQt5.QtWidgets import QAbstractItemView\n\nclass PestaniaEstadisticas():\n\n def __init__(self, winPrincipal):\n self.conexionesGenerales = ConexionGenerales()\n self.winPrincipal = winPrincipal\n\n\n hoy = datetime.datetime.now().date()\n self.winPrincipal.deHasta_stock.setDate(hoy)\n self.winPrincipal.deHasta_dinero.setDate(hoy)\n self.winPrincipal.deHasta_saldos.setDate(hoy)\n\n self.winPrincipal.btnGenerarPdf_dinero.clicked.connect(self.generarDinero)\n self.winPrincipal.btnGenerarPdf_stock.clicked.connect(self.generarStock)\n self.winPrincipal.btnGenerarPdf_saldos.clicked.connect(self.generarSaldos)\n self.winPrincipal.txtFilterPersona_saldos.returnPressed.connect(self.buscarPersonas)\n self.winPrincipal.rbClientes_saldos.clicked.connect(self.changePersona)\n self.winPrincipal.rbProveedores_saldos.clicked.connect(self.changePersona)\n\n self.winPrincipal.chbTodos_saldos.clicked.connect(self.clickTodos)\n\n self.winPrincipal.chbHoy_stock.clicked.connect(self.clickHoy_stock)\n self.winPrincipal.chbHoy_saldos.clicked.connect(self.clickHoy_saldos)\n self.winPrincipal.chbHoy_dinero.clicked.connect(self.clickHoy_dinero)\n\n\n self.winPrincipal.tvPersonas_saldos.setSortingEnabled(True)\n self.winPrincipal.tvPersonas_saldos.setMouseTracking(True)\n self.winPrincipal.tvPersonas_saldos.setSelectionBehavior(QAbstractItemView.SelectRows)\n\n\n def generarDinero(self):\n intervalo = 'month'\n if self.winPrincipal.cbIntervalo_dinero.currentText() == 'Semana':\n intervalo = 'week'\n elif self.winPrincipal.cbIntervalo_dinero.currentText() == 'Año':\n intervalo = 'year'\n elif self.winPrincipal.cbIntervalo_dinero.currentText() == 'Dia':\n intervalo = 'day'\n\n auxDesde = self.winPrincipal.deDesde_dinero.text()\n\n desde = auxDesde[6:10] + '-' + auxDesde[3:5] + '-' + auxDesde[0:2]\n\n auxHasta = self.winPrincipal.deHasta_dinero.text()\n hasta = auxHasta[6:10] + '-' + auxHasta[3:5] + '-' + auxHasta[0:2]\n\n listaEntradaTransacciones = self.conexionesGenerales.selectEntradasTransacciones(intervalo, desde, hasta)\n listaEntradaPagos = self.conexionesGenerales.selectEntradaPagos(intervalo, desde, hasta)\n\n listaSalidaTransacciones = self.conexionesGenerales.selectSalidaTransacciones(intervalo, desde, hasta)\n listaSalidaPagos = self.conexionesGenerales.selectSalidaPagos(intervalo, desde, hasta)\n\n listaGeneral =[]\n\n if len(listaEntradaPagos) < 1 and len(listaEntradaTransacciones) < 1 and len(listaSalidaPagos) < 1 and len(listaSalidaTransacciones) < 1:\n pass\n\n else:\n dineroEntrada = 0\n dineroSalida = 0\n for entradaP in listaEntradaPagos:\n dineroEntrada += float(entradaP[1])\n monto = '$ + ' + str(\"{0:.2f}\".format(entradaP[1]))\n entrada = []\n entrada.append(entradaP[0])\n entrada.append(monto)\n entrada.append(entradaP[2])\n #entrada = (entradaP[0] + monto + entradaP[2] )\n listaGeneral.append(entrada)\n\n for entradaT in listaEntradaTransacciones:\n dineroEntrada += float(entradaT[1])\n monto = '$ + ' + str(\"{0:.2f}\".format(entradaT[1]))\n entrada = []\n entrada.append(entradaT[0])\n entrada.append(monto)\n entrada.append(entradaT[2])\n #entrada = (entradaT[0], monto, entradaT[2])\n listaGeneral.append(entrada)\n\n for salidaP in listaSalidaPagos:\n dineroSalida += float(salidaP[1])\n monto = '$ - ' + str(\"{0:.2f}\".format(salidaP[1]))\n salida = []\n salida.append(salidaP[0])\n salida.append(monto)\n salida.append(salidaP[2])\n #salida = (salidaP[0], monto, salidaP[2])\n listaGeneral.append(salida)\n\n for salidaT in listaSalidaTransacciones:\n dineroSalida += float(salidaT[1])\n monto = '$ - ' + str(\"{0:.2f}\".format(salidaT[1]))\n salida = []\n salida.append(salidaT[0])\n salida.append(monto)\n salida.append(salidaT[2])\n #salida = (salidaT[0], monto, salidaT[2])\n listaGeneral.append(salida)\n\n listTable = \"\"\n listaGeneral.sort()\n for lista in listaGeneral:\n listTable += \"\"\"\n <tr height=\"80\">\n <td width=\"60%\" align=\"left\" >\n <br>\"\"\" + str(lista[0]) + \"\"\"<br>\n </td>\n <td width=\"20%\" align=\"right\">\n <br> &nbsp;&nbsp;\"\"\" + str(lista[1]) + \"\"\"<br>\n </td>\n <td width=\"20%\" align=\"center\">\n <br>&nbsp;&nbsp; \"\"\" + str(lista[2]) + \"\"\"<br>\n </td>\n </tr>\n \"\"\"\n\n contenido = \"\"\"\n <table width=\"600\" height=\"0\" style=\"border-color: black; border-width: 0.5px; border-spacing: 0;\">\n <tr style=\" background-color: gray; border-style: inset;\">\n <td width=\"60%\" align=\"center\" valign=\"middle\">\n <b>\n FECHA\n </b>\n </td>\n <td width=\"20%\" align=\"center\" valign=\"middle\">\n <b>\n DINERO\n </b>\n </td>\n <td width=\"20%\" align=\"center\" valign=\"middle\">\n <b>\n TIPO MOVIMIENTO\n </b>\n </td>\n </tr>\n </table>\n <br>\n <table width=\"600\" >\n \"\"\"+listTable +\"\"\"\n\n </table>\n\n <p>\n <br>\n Dinero entrante = $ + \"\"\" +str(\"{0:.2f}\".format(dineroEntrada)) + \"\"\"\n <br>\n Dinero salida = $ - \"\"\"+ str(\"{0:.2f}\".format(dineroSalida)) + \"\"\"\n <br>\n <br>\n Total .... : $ \"\"\"+ str(\"{0:.2f}\".format(dineroEntrada - dineroSalida)) +\"\"\"\n </p>\n \"\"\"\n self.generatePDF(contenido)\n\n\n def generarStock(self):\n self.listFinal = []\n self.title = \"intervalo\"\n\n intervalo = 'month'\n if self.winPrincipal.cbIntervalo_stock.currentText() == 'Semana':\n intervalo = 'week'\n elif self.winPrincipal.cbIntervalo_stock.currentText() == 'Año':\n intervalo = 'year'\n\n\n auxDesde = self.winPrincipal.deDesde_stock.text()\n\n desde = auxDesde[6:10] + '-' + auxDesde[3:5] + '-' + auxDesde[0:2]\n\n auxHasta = self.winPrincipal.deHasta_stock.text()\n hasta = auxHasta[6:10] + '-' + auxHasta[3:5] + '-' + auxHasta[0:2]\n\n listVentas = self.conexionesGenerales.selectVentas(intervalo, desde, hasta)\n listCompras = self.conexionesGenerales.selectCompras(intervalo, desde, hasta)\n\n if len(listCompras) < 1 and len(listVentas) < 1:\n alert = QDialog()\n confirm = QMessageBox.question(alert, \"Mensaje\", \"Verifique los valores, la consulta no tiene ningun dato.\", QMessageBox.Ok)\n\n else:\n i= 0\n for ventas in listVentas:\n itemList = (str(ventas[0]), listCompras[i][1], ventas[1])\n self.listFinal.append(itemList)\n i += 1\n\n\n listTable = \"\"\n cantMax = 0\n tupleFecha = []\n tupleCompra = []\n tupleVenta = []\n listFechas = []\n for lista in self.listFinal:\n i = 0\n listTable += \"\"\"\n <tr height=\"80\">\n <td width=\"60%\" align=\"left\" >\n <br>\"\"\" + str(lista[0]) + \"\"\"<br>\n </td>\n <td width=\"20%\" align=\"center\">\n <br> &nbsp;&nbsp;\"\"\" + str(lista[1]) + \"\"\"<br>\n </td>\n <td width=\"20%\" align=\"center\">\n <br>&nbsp;&nbsp; \"\"\" + str(lista[2]) + \"\"\"<br>\n </td>\n </tr>\n \"\"\"\n if int(lista[1]) > int(lista[2]):\n if int(lista[1]) > cantMax:\n cantMax = int(lista[1])\n else:\n if int(lista[2]) > cantMax:\n cantMax = int(lista[2])\n\n listFechas.append(str(lista[0]))\n\n tupleFecha.append(str(lista[0])) #+= str(lista[0])\n tupleCompra.append(int(lista[1]))\n tupleVenta.append(int(lista[2]))\n i = i + 1\n\n generateGraphic = []\n tdFecha = \"\"\n trCantFechas = \"\"\n\n betweenCant = int(cantMax/12)\n listRange = []\n for i in range(0, cantMax, betweenCant):\n listRange.append(i)\n tdFecha = \"\"\n for lista in self.listFinal:\n\n if i < int(lista[1]):\n tdCantCompra = \"\"\"\n <td width=\"50\" style=\" background-color: red;\">\n </td>\n \"\"\"\n else:\n tdCantCompra = \"\"\"\n <td width=\"50\">\n </td>\n \"\"\"\n\n if i < int(lista[2]):\n tdCantVenta = \"\"\"\n <td width=\"50\" style=\" background-color: blue;\">\n </td>\n \"\"\"\n else:\n tdCantVenta = \"\"\"\n <td width=\"50\">\n </td>\n \"\"\"\n\n tdFecha += tdCantCompra + tdCantVenta\n\n tr = \"\"\"\n <tr>\n <td width=\"60\">\n \"\"\"+ str(i) +\"\"\"\n </td>\n \"\"\"+ str(tdFecha) +\"\"\"\n </tr>\n \"\"\"\n\n generateGraphic.append(tr)\n\n\n n_groups = len(tupleFecha)\n\n fig, ax = pyplot.subplots()\n\n index = np.arange(n_groups)\n bar_width = 0.20\n\n opacity = 0.4\n error_config = {'ecolor': '0.3'}\n\n rects1 = pyplot.bar(index, tupleVenta, bar_width,\n alpha=opacity,\n color='b',\n error_kw=error_config,\n label='Venta')\n\n rects2 = pyplot.bar(index + bar_width, tupleCompra, bar_width,\n alpha=opacity,\n color='r',\n error_kw=error_config,\n label='Compra')\n\n pyplot.xlabel('Fecha')\n pyplot.ylabel('Cantidad')\n pyplot.title('Cantidad por fechas')\n pyplot.xticks(index + bar_width, tupleFecha)\n pyplot.legend()\n\n pyplot.tight_layout()\n pyplot.savefig('../archivos/picture1.png')\n\n trFechas = \"\"\"<tr> <td width=\"60\">CANT/FECHAS</td>\"\"\"\n for fecha in listFechas:\n tdFecha = \"\"\"<td width=\"50\" align=\"right\" font-size=\"8\"> \"\"\"+ str(fecha) +\"\"\"</td> <td width=\"50\"> </td> \"\"\"\n trFechas += tdFecha\n\n trFechas += \"</tr>\"\n\n generateGraphic.reverse()\n\n generateGraphic.append(trFechas)\n\n finalGraphic = \"\"\n\n for graphic in generateGraphic:\n finalGraphic += graphic\n\n\n contenido = \"\"\"\n <table width=\"600\" height=\"0\" style=\"border-color: black; border-width: 0.5px; border-spacing: 0;\">\n <tr style=\" background-color: gray; border-style: inset;\">\n <td width=\"60%\" align=\"center\" valign=\"middle\">\n <b>\n FECHA\n </b>\n </td>\n <td width=\"20%\" align=\"center\" valign=\"middle\" style=\" background-color: red;\">\n <b>\n PRODUCTOS COMPRADOS\n </b>\n </td>\n <td width=\"20%\" align=\"center\" valign=\"middle\" style=\"background-color: blue;\">\n <b>\n PRODUCTOS VENDIDOS\n </b>\n </td>\n </tr>\n </table>\n\n <br>\n <br>\n <br>\n\n <table width=\"600\" height=\"0\" style=\"border-color: black; border-width: 0.5px; border-spacing: 0;\">\n \"\"\" + listTable + \"\"\"\n </table>\n <br>\n <br>\n\n <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>\n\n\n\n <br><br><br><br><br><br><br>\n <IMG SRC=\"../archivos/picture1.png\" width=\"600\" height=\"600\">\n <br><br><br><br><br><br><br><br><br><br>\n <br>\n\n <hr>\n <br>\n <table width=\"600\">\n <tr>\n <td align=\"right\" width=\"100%\">\n FECHA/HORA : \"\"\"+ fecha + \"\"\"\n </td>\n </tr>\n </table>\n <hr>\n \"\"\"\n\n self.generatePDF(contenido)\n\n\n def clickHoy_stock(self):\n if self.winPrincipal.chbHoy_stock.isChecked() == True:\n self.winPrincipal.deHasta_stock.setEnabled(False)\n hoy = datetime.datetime.now().date()\n self.winPrincipal.deHasta_stock.setDate(hoy)\n else:\n self.winPrincipal.deHasta_stock.setEnabled(True)\n\n def clickHoy_saldos(self):\n if self.winPrincipal.chbHoy_saldos.isChecked() == True:\n self.winPrincipal.deHasta_saldos.setEnabled(False)\n hoy = datetime.datetime.now().date()\n self.winPrincipal.deHasta_saldos.setDate(hoy)\n else:\n self.winPrincipal.deHasta_saldos.setEnabled(True)\n\n def clickHoy_dinero(self):\n if self.winPrincipal.chbHoy_dinero.isChecked() == True:\n self.winPrincipal.deHasta_dinero.setEnabled(False)\n hoy = datetime.datetime.now().date()\n self.winPrincipal.deHasta_dinero.setDate(hoy)\n else:\n self.winPrincipal.deHasta_dinero.setEnabled(True)\n\n def generarSaldos(self):\n validate = True\n if self.winPrincipal.chbTodos_saldos.isChecked() == False:\n if self.winPrincipal.rbProveedores_saldos.isChecked() == True:\n if self.proveedores is None:\n validate = False\n else:\n if self.clientes is None:\n validate = False\n\n if validate == True:\n if self.winPrincipal.chbTodos_saldos.isChecked() == True:\n if self.winPrincipal.rbProveedores_saldos.isChecked() == True:\n listProveedores = self.conexionesGenerales.selectProveedor('')\n contenido = \"\"\n for proveedores in listProveedores:\n self.proveedores = Proveedor()\n self.proveedores.setIdProveedor(int(proveedores[0]))\n self.proveedores.setDescripcion(str(proveedores[1]))\n self.proveedores.setNombre(str(proveedores[2]))\n\n contenido += self.generateTable('PROVEEDOR', self.proveedores)\n else:\n listClientes = self.conexionesGenerales.selectCliente('')\n contenido = \"\"\n for clientes in listClientes:\n self.clientes = Cliente()\n self.clientes.setIdCliente(int(clientes[0]))\n self.clientes.setApellido(str(clientes[1]))\n self.clientes.setNombre(str(clientes[2]))\n\n contenido += self.generateTable('CLIENTE', self.clientes)\n else:\n if self.winPrincipal.rbProveedores_saldos.isChecked() == True:\n contenido = self.generateTable('PROVEEDOR', self.proveedores)\n else:\n contenido = self.generateTable('CLIENTE', self.clientes)\n\n\n self.generatePDF(contenido)\n else:\n alert = QDialog()\n confirm = QMessageBox.question(alert, \"Mensaje\", \"Falta selecciona la/s persona/s.\", QMessageBox.Ok)\n\n\n\n\n def generateTable(self, type, persona):\n\n intervalo = 'month'\n if self.winPrincipal.cbIntervalo_saldos.currentText() == 'Semana':\n intervalo = 'week'\n elif self.winPrincipal.cbIntervalo_saldos.currentText() == 'Año':\n intervalo = 'year'\n elif self.winPrincipal.cbIntervalo_saldos.currentText() == 'Dia':\n intervalo = 'day'\n\n\n auxDesde = self.winPrincipal.deDesde_saldos.text()\n\n desde = auxDesde[6:10] + '-' + auxDesde[3:5] + '-' + auxDesde[0:2]\n\n auxHasta = self.winPrincipal.deHasta_saldos.text()\n hasta = auxHasta[6:10] + '-' + auxHasta[3:5] + '-' + auxHasta[0:2]\n\n listTransacciones = []\n listPagos = []\n #Total de los pagos\n pagosTotal = 0\n #Total de las transacciones en estado 0\n transaccionesTotal = 0\n total = 0\n #Lista completa (transacciones + pagos)\n listDetalle = []\n apellido = ''\n if type == \"CLIENTE\":\n listPagos = self.conexionesGenerales.selectListPagosCliente(persona, intervalo, desde, hasta)\n listTransacciones = self.conexionesGenerales.selectListTransaccionCliente(persona, intervalo, desde, hasta)\n\n\n if len(listPagos) > 0:\n for pagos in listPagos:\n pagosTotal += float(pagos[1])\n auxMonto = \"$ + \" + str(\"{0:.2f}\".format(pagos[1]))\n auxPagos = (str(pagos[0]), auxMonto, str(pagos[2]))\n listDetalle.append(auxPagos)\n else:\n pagosTotal = 0\n\n if len(listTransacciones):\n for transacciones in listTransacciones:\n transaccionesTotal += transacciones[1]\n auxMonto = \"$ - \" + str(\"{0:.2f}\".format(transacciones[1]))\n auxTransaccion = (str(transacciones[0]), auxMonto, str(transacciones[2]))\n listDetalle.append(auxTransaccion)\n else:\n transaccionesTotal = 0\n\n total = pagosTotal - transaccionesTotal\n apellido = persona.getApellido()\n elif type == \"PROVEEDOR\":\n listPagos = self.conexionesGenerales.selectListPagosProveedor(persona, intervalo, desde, hasta)\n listTransacciones = self.conexionesGenerales.selectListTransaccionProveedor(persona, intervalo, desde, hasta)\n\n if len(listPagos) > 0:\n for pagos in listPagos:\n pagosTotal += float(pagos[1])\n auxMonto = \"$ + \" + str(\"{0:.2f}\".format(pagos[1]))\n auxPagos = (str(pagos[0]), auxMonto, str(pagos[2]))\n listDetalle.append(auxPagos)\n else:\n pagosTotal = 0\n\n if len(listTransacciones):\n for transacciones in listTransacciones:\n transaccionesTotal += transacciones[1]\n auxMonto = \"$ - \" + str(\"{0:.2f}\".format(transacciones[1]))\n auxTransaccion = (str(transacciones[0]), auxMonto, str(transacciones[2]))\n listDetalle.append(auxTransaccion)\n else:\n transaccionesTotal = 0\n\n\n total = pagosTotal - transaccionesTotal\n apellido = persona.getDescripcion()\n\n\n listDetalle.sort()\n listTable = \"\"\n for lista in listDetalle:\n listTable += \"\"\"\n <tr height=\"80\">\n <td width=\"60%\" align=\"left\" >\n <br>\"\"\" + str(lista[0]) + \"\"\"<br>\n </td>\n <td width=\"20%\" align=\"right\">\n <br> &nbsp;&nbsp;\"\"\" + str(lista[1]) + \"\"\"<br>\n </td>\n <td width=\"20%\" align=\"center\">\n <br>&nbsp;&nbsp; \"\"\" + str(lista[2]) + \"\"\"<br>\n </td>\n </tr>\n \"\"\"\n\n contenido = \"\"\"\n <br>\n <br>\n <table width=\"600\" height=\"100\">\n <tr>\n <br> Nombre : \"\"\"+ persona.getNombre() +\"\"\" <br>\n Apellido : \"\"\" + apellido + \"\"\"<br>\n </tr>\n </table>\n <table width=\"600\" >\n <tr height=\"80\" style=\" background-color: gray; border-style: inset;\">\n <td width=\"60%\" align=\"center\" >\n <br>FECHA<br>\n </td>\n <td width=\"20%\" align=\"center\">\n <br> MONTO <br>\n </td>\n <td width=\"20%\" align=\"center\">\n <br>ACCION<br>\n </td>\n </tr>\n \"\"\" + listTable + \"\"\"\n </table>\n\n <table width=\"600\" height=\"0\" style=\"border-color: black; border-width: 0.5px; border-spacing: 0;\">\n <tr>\n <td width=\"70%\"><br>SALDO..............<br></td>\n <td><br> $ \"\"\" + str(\"{0:.2f}\".format(total))+ \"\"\" <br></td>\n </tr>\n </table>\n <br>\n <br>\n <br>\n <br>\n <br>\n <br>\n <br>\n <br>\n \"\"\"\n\n return contenido\n\n\n\n def buscarPersonas(self):\n if self.winPrincipal.txtFilterPersona_saldos.hasFocus() is True:\n self.cargarTablaSaldos()\n\n\n\n def cargarTablaSaldos(self):\n\n parameter = self.winPrincipal.txtFilterPersona_saldos.text()\n\n if self.winPrincipal.rbProveedores_saldos.isChecked() is True:\n listaProveedores = self.conexionesGenerales.selectProveedor(parameter)\n\n if len(listaProveedores) > 0:\n header = ['ID','Apellido','Nombre']\n self.tablaModel = MyTableModel(self.winPrincipal.tvPersonas_saldos, listaProveedores, header)\n self.winPrincipal.tvPersonas_saldos.setModel(self.tablaModel)\n self.winPrincipal.tvPersonas_saldos.selectionModel().currentChanged.connect(self.changeSelectedTable)\n\n\n self.winPrincipal.tvPersonas_saldos.setColumnHidden(0, True)\n self.winPrincipal.tvPersonas_saldos.setColumnWidth(1, 120)\n self.winPrincipal.tvPersonas_saldos.setColumnWidth(2, 120)\n else:\n listaClientes = self.conexionesGenerales.selectCliente(parameter)\n\n if len(listaClientes) > 0:\n header = ['ID','Apellido','Nombre']\n self.tablaModel = MyTableModel(self.winPrincipal.tvPersonas_saldos, listaClientes, header)\n self.winPrincipal.tvPersonas_saldos.setModel(self.tablaModel)\n self.winPrincipal.tvPersonas_saldos.selectionModel().currentChanged.connect(self.changeSelectedTable)\n\n\n self.winPrincipal.tvPersonas_saldos.setColumnHidden(0, True)\n self.winPrincipal.tvPersonas_saldos.setColumnWidth(1, 120)\n self.winPrincipal.tvPersonas_saldos.setColumnWidth(2, 120)\n\n\n\n def changeSelectedTable(self, selected, deselected):\n if self.winPrincipal.rbProveedores_saldos.isChecked() is True:\n proveedorList = selected.model().mylist\n proveedorSelected = proveedorList[selected.row()]\n\n self.proveedores = Proveedor()\n\n self.proveedores.setIdProveedor(int(proveedorSelected[0]))\n self.proveedores.setDescripcion(str(proveedorSelected[1]))\n self.proveedores.setNombre(str(proveedorSelected[2]))\n else:\n clienteList = selected.model().mylist\n clienteSelected = clienteList[selected.row()]\n\n self.clientes = Cliente()\n\n self.clientes = Cliente()\n self.clientes.setIdCliente(int(clienteSelected[0]))\n self.clientes.setApellido(str(clienteSelected[1]))\n self.clientes.setNombre(str(clienteSelected[2]))\n\n def changePersona(self):\n self.clientes = None\n self.proveedores = None\n\n self.winPrincipal.txtFilterPersona_saldos.setText('')\n self.winPrincipal.tvPersonas_saldos.setModel(None)\n\n def clickTodos(self):\n if self.winPrincipal.chbTodos_saldos.isChecked() == True:\n self.winPrincipal.txtFilterPersona_saldos.setEnabled(False)\n self.winPrincipal.tvPersonas_saldos.setModel(None)\n else:\n self.winPrincipal.txtFilterPersona_saldos.setEnabled(True)\n\n\n def generatePDF(self, contenido):\n hoy = str(datetime.datetime.now().year) + str(datetime.datetime.now().month) + str(datetime.datetime.now().day) + str(datetime.datetime.now().hour) + str(datetime.datetime.now().minute) + str(datetime.datetime.now().second)\n\n nombrePdf = '../archivos/' + str(hoy + 'LIST') + '.pdf'\n\n fecha = str(datetime.datetime.now())\n\n html = \"\"\"\n <table width=\"600\">\n <tr width=\"600\" color=\"#000000\">\n <td width=\"80%\">\n\n </td>\n <td width=\"20%\" align=\"right\">\n <IMG SRC=\"kde1.png\">\n </td>\n </tr>\n\n </table>\n\n <hr>\n <br>\n <p>\n SALDOS\n </p>\n <br>\n\n \"\"\"+ contenido\n\n doc = QTextDocument()\n doc.setHtml(html)\n\n printer = QPrinter()\n printer.setOutputFileName(nombrePdf)\n\n printer.setOutputFormat(QPrinter.PdfFormat)\n doc.print(printer)\n printer.newPage()\n url = QUrl\n url = QUrl(nombrePdf)\n QDesktopServices.openUrl(url)\n\n\n" }, { "alpha_fraction": 0.6319444179534912, "alphanum_fraction": 0.8055555820465088, "avg_line_length": 46.83333206176758, "blob_id": "d2fe54b8a203851f7300b3031fc94e0d52d70684", "content_id": "67ec5b209d9ba2203c0bb4a1996829722fb84f71", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 288, "license_type": "no_license", "max_line_length": 140, "num_lines": 6, "path": "/JPro-master/README.md", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "# JPro\n\nDesktop Application written in Python3.\nProvides visual representation of current inventory stock, lead time estimates and user inputs. \n\n![screen shot 2017-02-01 at 02 51 51](https://cloud.githubusercontent.com/assets/22529514/22493665/6d5b9f52-e829-11e6-99d3-9fe29c65defc.jpg) \n" }, { "alpha_fraction": 0.6391960978507996, "alphanum_fraction": 0.6418123245239258, "avg_line_length": 31.723735809326172, "blob_id": "742d7d969dc890d9ebe394e2609ca6ed090a4f29", "content_id": "638330c00b1180fd7a4c04b84a8ad8824a1c17ad", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 8499, "license_type": "no_license", "max_line_length": 84, "num_lines": 257, "path": "/cidades_ibge/bandas.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/env python\n#-*- coding: utf-8 -*-\n\n# Este documento é uma rápida introdução ao SQLAlchemy.\n#\n# SQLAlchemy is the Python SQL toolkit and Object Relational Mapper \n# that gives application developers the full power and flexibility of SQL.\n#\n# It provides a full suite of well known enterprise-level persistence patterns, \n# designed for efficient and high-performing database access, adapted into a \n# simple and Pythonic domain language.\n#\n# Ao escrever isso estou usando python 2.6 e sqlalchemy 0.5.5.\n# Como exemplo vou organizar a coleção de discos. \n\nm = input(\"Mostrar sql gerado?[s/n] \")\nmostrar = [True, False][m.lower() == 'n']\nespera = mostrar\n \n\n############# PASSO 1 - CRIAR UMA CONEXÃO COM O BANCO DE DADOS. ################\n\n# O banco de dados usado será o sqlite.\n# O sqlalchemy usa um objeto 'engine' para se conectar ao banco de dados.\nfrom sqlalchemy import create_engine\n\n#O parametro 'echo = True' faz com que o sql gerado seja mostrado na tela.\nengine = create_engine('sqlite:///discoteca.db', echo = mostrar) \n\n\n########### PASSO 2 - CRIAR AS TABELAS QUE SERÃO USADAS. #######################\n\n#Uma tabela no sqlalchemy é um objeto do tipo Table. \n#objetos do tipo Column são usados para definir os campos da tabela.\nfrom sqlalchemy import Table, Column, Integer, String, ForeignKey, MetaData\n\n# MetaData é o objeto responsável pelas queries e orm.\nmetadata = MetaData()\n\ntabela_bandas = Table('bandas', metadata,\n Column('id', Integer, primary_key = True),\n Column('nome', String),\n Column('lugar', String)\n)\n\n#Um disco pode ter mais de uma banda.\ntabela_discos = Table('discos', metadata,\n Column('id', Integer, primary_key = True),\n Column('nome', String),\n Column('ano', Integer)\n)\n\ntabela_discos_bandas = Table('discos_bandas', metadata,\n Column('id', Integer, primary_key = True),\n Column('id_banda', Integer, ForeignKey('bandas.id')),\n Column('id_disco', Integer, ForeignKey('discos.id')),\n)\n\n#Neste exemplo uma música só está em um único disco.\ntabela_musicas = Table('musicas', metadata,\n Column('id', Integer, primary_key = True),\n Column('id_disco', Integer, ForeignKey('discos.id')),\n Column('id_banda', Integer, ForeignKey('bandas.id')),\n Column('numero', Integer),\n Column('nome', String)\n)\n\n#Como as tabelas não existem, as criaremos usando a nossa instância de MetaData().\n#Nossa engine (criada no passo 1) será passada como parametro.\nmetadata.create_all(engine)\nif espera:\n input(\"\\nO SQL gerado foi a criação das tabelas.\")\n\n# Conexão com o banco de dados estabelecida, tabelas criadas... \n#Agora é hora de definir nossos objetos.\n\n\n\n\n####### PASSO 3 - CRIAR AS CLASSES E MAPEÁ-LAS COM AS TABELAS CRIADAS. #########\n\n#Para mapear as classes com as tabelas usaremos o método mapper() \n#A sintaxe do mapper é a seginte: mapper(classe, tabela).\n#Com isso, associa-se a classe à tabela.\n\nfrom sqlalchemy.orm import mapper, relation\n\nclass musica(object):\n def __repr__(self):\n numero = self.numero or 0\n nome = self.nome or ''\n if self.disco:\n disco = self.disco.nome\n else:\n disco = ''\n return \"\"\"numero: %i, nome: %s, disco: %s\"\"\" %(numero, nome, disco)\n\n#mapeando musica com tabela_musicas.\nmapper(musica, tabela_musicas)\n\n\nclass banda(object):\n def __repr__(self):\n nome = self.nome or ''\n lugar = self.lugar or ''\n return \"\"\"nome: %s, lugar: %s\"\"\" %(nome, lugar)\n \n#mapeando banda com tabela_bandas.\n#Definiremos também a relação banda/musica usando relation(),\n#'backref' cria a relação também 'do lado contrário'. \n#O parâmetro 'properties' cria atributos para a classe que está sendo mapeada.\nmapper(banda, tabela_bandas,\n properties = {'musicas' : relation(musica, backref = 'banda')}\n )\n\n\n\nclass disco(object):\n def __repr__(self):\n nome = self.nome or ''\n ano = self.ano or 0\n if self.bandas:\n banda = ','.join([i.nome for i in self.bandas])\n else:\n banda = ''\n return \"\"\"nome: %s, ano: %s, banda: %s\"\"\" %(nome, str(ano), banda)\n \n#Mapeando disco com tabela_discos, onde definiremos também relacionamentos.\n#A relação bandas/discos é muitos-para-muitos. Por isso foi passado o parâmetro\n#'secondary'.\nmapper(disco, tabela_discos, \n properties = {'musicas' : relation(musica, backref = 'disco'), \n 'bandas' : relation(banda, \n secondary = tabela_discos_bandas, \n backref = 'discos')\n }\n )\n\n\n#Já está tudo criado, os objetos mapeados... Vamos brincar com a coisa!\n\n\n###################### BRINCANDO COM OS NOSSOS OBJETOS ########################\n\n\n#Primeiro instanciar banda() e cadastrar uma nova banda.\n#Repare que os atributos do objeto são as colunas da tabela (da hora, né!) .\nnova_banda = banda()\nnova_banda.nome = \"Tankard\"\nnova_banda.lugar = \"Frankfurt\"\n\n#Bom, uma nova banda foi criada aí, mas ainda não foi salva no banco. \n#Para salvar no banco usaremos um objeto 'session' que será criado com sessionmaker\n#Nossa 'session' será associada à nossa 'engine'.\nfrom sqlalchemy.orm import sessionmaker\n\nSession = sessionmaker(bind = engine)\nsession = Session()\n\n#Agora, com a session criada, é só adicionar nosso objeto a session...\nsession.add(nova_banda)\n# ...e 'commitar' a coisa.\nsession.commit()\nif espera:\n input(\"\\nEste sql é da inserção de uma banda.\")\n\n#Pronto, objeto salvo. Agora vamos recuperá-lo. \n#Usaremos o método session.query() para fazer isso.\numa_banda = session.query(banda).filter(banda.nome == \"Tankard\").first()\nif espera:\n input(\"\\nEste aqui é a recuperação de uma banda.\")\n\n#Bom, vamos criar um disco.\nnovo_disco = disco()\nnovo_disco.nome = \"The Morning After\"\nnovo_disco.ano = 1988\nsession.add(novo_disco)\nsession.commit()\n\n#Um disco tem músicas, não?\nmusicas = ['Intro', 'Commandment', 'Shit-faced', 'TV Hero', 'F.U.N.',\n 'Try Again', 'The Morning After', 'Desperation',\n 'Feed the Lohocla', 'Help Yourself', 'Mon Cheri', 'Outro']\ni = 1\nfor m in musicas:\n nova_musica = musica()\n nova_musica.nome = m\n nova_musica.banda = uma_banda\n nova_musica.numero = i\n i += 1\n #Lembra do relation(), backref e tal que falei lá em cima? Então, olha aí!\n #O atributo nova_musica.disco aí embaixo foi criado com eles. \n nova_musica.disco = novo_disco\n session.add(nova_musica)\n session.commit()\n\n#Usando novamente um atributo criado na configuração do mapper...\numa_banda.discos.append(novo_disco)\n\n#Bom, vamos cadastrar mais umas coisas aí pra entender direitinho como funciona.\nrdp = banda()\nrdp.nome = u\"Ratos de Porão\"\nrdp.lugar = u\"São Paulo\"\n\ncl = banda()\ncl.nome = u\"Cólera\"\ncl.lugar = u\"São Paulo\"\n\npk = banda()\npk.nome = u\"Psykóze\"\npk.lugar = u\"São Paulo\"\n\nfc = banda()\nfc.nome = u\"Fogo Cruzado\"\nfc.lugar = u\"São Paulo\"\n\noutro_disco = disco()\noutro_disco.nome = \"Sub\"\noutro_disco.bandas.append(rdp)\noutro_disco.bandas.append(cl)\noutro_disco.bandas.append(pk)\noutro_disco.bandas.append(fc)\nsession.add(outro_disco)\n#session.commit()\n\nmusicas_sub = [(u'Parasita', rdp), (u'Vida Ruim', rdp), (u\"Poluição Atômica\", rdp),\n (u\"X.O.T.\", cl), (u\"Bloqueio Mental\", cl),\n (u\"Quanto Vale a Liberdade\", cl), (u\"Terceira Guerra Mundial\", pk),\n (u\"Buracos Suburbanos\", pk), (u\"Fim do Mundo\", pk),\n (u\"Desemprego\", fc), (u\"União entre os Punks do Brasil\", fc),\n (u\"Delinqüentes\", fc), (u\"Não Podemos Falar\", rdp),\n (u\"Realidades da Guerra\", rdp), (u\"Porquê?\", rdp), (u\"Histeria\", cl),\n (u\"Zero zero\", cl), (u\"Sub-ratos\", cl), (u\"Vítimas da Guerra\", pk),\n (u\"Alienação do Homem\", pk), (u\"Desilusão\", pk), (u\"Inimizade\", fc),\n (u\"Punk Inglês\", fc), (u\"Terceira Guerra\", fc)]\n\ni = 1\nfor m in musicas_sub:\n nova_musica = musica()\n nova_musica.nome = m[0]\n nova_musica.banda = m[1]\n nova_musica.numero = i\n session.add(nova_musica)\n session.commit()\n nova_musica.disco = outro_disco\n i += 1\n\n\n#Agora que já criamos as paradas, vamos ver...\nbandas = session.query(banda).all()\nfor b in bandas:\n print(\"Banda: \" , b.nome)\n for d in b.discos:\n print(\" Disco: \", d.nome)\n for m in d.musicas:\n if m.banda.id == b.id:\n print(\" Música: \", m.nome)" }, { "alpha_fraction": 0.5789473652839661, "alphanum_fraction": 0.6973684430122375, "avg_line_length": 11.833333015441895, "blob_id": "6b3226a22f3a88147a737b7e822c8e9ae6710f57", "content_id": "ab8bf1c51fd90e1b277ecd40253b3e9f6af1cbe7", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "INI", "length_bytes": 76, "license_type": "no_license", "max_line_length": 18, "num_lines": 6, "path": "/pong1/config.ini", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "[kivy]\nexit_on_escape = 1\n[graphics]\nresizable = 0\nwidth = 1200\nheight = 800" }, { "alpha_fraction": 0.6771378517150879, "alphanum_fraction": 0.6788830757141113, "avg_line_length": 27.66666603088379, "blob_id": "05b943831564c241b3d0ed66d1d3cb52ce154de5", "content_id": "23626f4090a506bf4a797b6660f48f2f32e04c45", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1721, "license_type": "no_license", "max_line_length": 108, "num_lines": 60, "path": "/PQt5-Stock/windowMain.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nimport sys\n\nfrom PyQt5.QtWidgets import QApplication\n\nfrom Controlador.windowPrincipal import Principal\nfrom Controlador.windowIniciar import WindowIniciar\nfrom PyQt5.QtWidgets import QMessageBox, QDialog\n\n\n\n\n\nclass windowMain():\n\n def __init__(self):\n #self.Principal = Principal()\n\n self.iniciar = WindowIniciar()\n self.iniciar.winIniciar.btnIniciar.clicked.connect(self.comprobarUsuario)\n\n\n def comprobarUsuario(self):\n usuario = self.iniciar.onClickValidarUsuario()\n if usuario != None:\n self.principal = Principal(usuario=usuario)\n self.iniciar.winIniciar.close()\n self.principal.winPrincipal.lblNombreUsuario.setText(usuario.getUsuario())\n self.principal.winPrincipal.actionCerrarSesion.triggered.connect(self.cerrarSesion)\n self.principal.winPrincipal.actionSalir.triggered.connect(self.salir)\n\n\n def cerrarSesion(self):\n alert = QDialog()\n confirm = QMessageBox.question(alert, \"Mensaje\", \"¿ Desea cerrar sesion ?\", QMessageBox.Yes,\n QMessageBox.No)\n if confirm == QMessageBox.Yes:\n #self.iniciar.winIniciar.show()\n self.iniciar = WindowIniciar()\n self.iniciar.winIniciar.btnIniciar.clicked.connect(self.comprobarUsuario)\n self.principal.winPrincipal.close()\n\n\n def salir(self):\n alert = QDialog()\n confirm = QMessageBox.question(alert, \"Mensaje\", \"¿ Desea salir ?\", QMessageBox.Yes, QMessageBox.No)\n if confirm == QMessageBox.Yes:\n self.principal.winPrincipal.close()\n\n\n\n\n\n\n\n\napp = QApplication(sys.argv)\nwindowMain = windowMain()\nsys.exit(app.exec_())" }, { "alpha_fraction": 0.5858178734779358, "alphanum_fraction": 0.5938758850097656, "avg_line_length": 23.81999969482422, "blob_id": "c7b6cb04f476864939941cfba95535264a6e4dc3", "content_id": "739206e6a9ba2cc8b5a43d33ec2fc64323432950", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2483, "license_type": "no_license", "max_line_length": 102, "num_lines": 100, "path": "/full - compara relatorios/compara-n.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import os\nimport csv\nimport sqlite3\nfrom sqlalchemy import create_engine, Table, Column, MetaData\nfrom sqlalchemy import Integer, Float, CHAR\nfrom sqlalchemy.orm import sessionmaker, mapper\nfrom sqlalchemy.engine.url import URL\nfrom sqlalchemy.sql import select\nfrom sqlalchemy.ext.declarative import declarative_base\n\ncsvC = 'b-co.csv'\ncsvF = 'b-fi-v.csv'\n\n_url = 'sqlite:///compara.db3'\n# para conexao no firebird\n# _url = URL('firebird', 'SYSDBA', 'masterkey', '192.168.1.11', '3052', 'bdband')\n# para conexao no mysql\n# _url = 'mysql://usuario:senha@servidor/banco'\n\n# cria o engine e metadata\nengine = create_engine(_url, echo=False)\nBase = declarative_base(bind=engine)\n\n\n# cria as classes e tabelas ja mapeando\nclass arqC(Base):\n __tablename__ = 'arqC'\n\n numero = Column(Integer, primary_key=True)\n valor = Column(Float())\n achou = Column(CHAR())\n\n def __init__(self, numero, valor, achou=' '):\n self.numero = numero\n self.valor = valor\n self.achou = achou\n\n\nclass arqF(Base):\n __tablename__ = 'arqF'\n\n numero = Column(Integer, primary_key=True)\n item = Column(Integer, primary_key=True)\n valor = Column(Float())\n achou = Column(CHAR())\n\n def __init__(self, numero, item, valor, achou=' '):\n self.numero = numero\n self.item = item\n self.valor = valor\n self.achou = achou\n\n\nBase.metadata.create_all()\n\nconn = engine.connect()\n\n# s = select([arqC])\n# # result = conn.execute(s)\n\n# for row in conn.execute(s):\n# print(row['numero'],row['valor'])\n# p = select([tb_arqF.c.numero, tb_arqF.c.valor]).where(tb_arqF.c.numero == row[tb_arqC.c.numero])\n# result = conn.execute(p)\n# for prow in result:\n# print(prow, result.count())\n# if row[tb_arqC.c.valor] == prow[tb_arqF.c.valor]:\n# print('ok')\n# input()\n\n# cria o sessionmaker\nSession = sessionmaker(bind=engine)\n\ns = Session()\n\nttc = 0\nttf = 0\n\nfor c in s.query(arqC):\n print(c.numero)\n q = s.query(arqF).filter(arqF.numero == c.numero)\n qtd = 0\n tot = 0\n ttc = ttc + c.valor\n for f in q:\n qtd = qtd + 1\n tot = tot + f.valor\n print(c.numero, c.valor, f.numero, f.valor, q.count())\n if q.count() == qtd:\n if c.valor != tot:\n print('não ok')\n # input()\n else:\n c.achou = 'S'\n ttf = ttf + tot\n # s.commit()\n # input()\n\ns.commit()\nprint(ttc, ttf)\n" }, { "alpha_fraction": 0.6365187764167786, "alphanum_fraction": 0.6518771052360535, "avg_line_length": 24.521739959716797, "blob_id": "6d0c0707d76337ced551cc25df11b0b2a7b16114", "content_id": "36883a693c18ebb213332269aa155ecf98ca7def", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 586, "license_type": "no_license", "max_line_length": 65, "num_lines": 23, "path": "/pyside2/ps2-valida.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "from PyQt5.Qt import QApplication\nfrom PyQt5.QtCore import QRegExp\nfrom PyQt5.QtGui import QRegExpValidator\nfrom PyQt5.QtWidgets import QWidget, QLineEdit\n\nimport sys\n\nclass MyWidget(QWidget):\n def __init__(self, parent=None):\n super(QWidget, self).__init__(parent)\n self.le_input = QLineEdit(self)\n\n reg_ex = QRegExp(\"[0-9]+.?[0-9]{,2}\")\n input_validator = QRegExpValidator(reg_ex, self.le_input)\n self.le_input.setValidator(input_validator)\n\nif __name__ == '__main__':\n a = QApplication(sys.argv)\n\n w = MyWidget()\n w.show()\n\n a.exec()" }, { "alpha_fraction": 0.6175675392150879, "alphanum_fraction": 0.6466216444969177, "avg_line_length": 24.101694107055664, "blob_id": "db6ba9be69567dfaebfbb1fd824121ba265ac572", "content_id": "66707123ae122fdcf1c4ef4739414121dbe971ab", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1480, "license_type": "no_license", "max_line_length": 115, "num_lines": 59, "path": "/opencv/Realidade-Aumentada-master/webcam.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import numpy as np\nimport cv2 as cv\nimport matplotlib.pyplot as plt\n\n\ncap = cv.VideoCapture(0)\n# img1 = cv.imread('fotos/box1.jpg',cv.IMREAD_GRAYSCALE) # queryImage\nimg1 = cv.imread('fotos/eu.jpg',cv.IMREAD_GRAYSCALE) # queryImage\n\nwhile(True):\n # Capture frame-by-frame\n ret, frame = cap.read()\n\n # Our operations on the frame come here\n gray = cv.cvtColor(frame, cv.COLOR_BGR2GRAY)\n\n # Display the resulting frame\n \n if cv.waitKey(1) & 0xFF == ord('q'):\n break\n\n\n \n \n img2 = gray\n\n \n # Initiate ORB detector\n orb = cv.ORB_create()\n # find the keypoints and descriptors with ORB\n kp1, des1 = orb.detectAndCompute(img1,None)\n kp2, des2 = orb.detectAndCompute(img2,None)\n pts = cv.KeyPoint_convert(kp1)\n pts3d = np.insert(pts, 2, 1, axis=1)\n print(\"kp1.x\")\n print(pts3d)\n \n # print(\"kp1.y\")\n # print(kp1.y)\n # print(\"des1\")\n # print(des1)\n\n # create BFMatcher object\n bf = cv.BFMatcher(cv.NORM_HAMMING, crossCheck=True)\n # Match descriptors.\n matches = bf.match(des1,des2)\n # Sort them in the order of their distance.\n matches = sorted(matches, key = lambda x:x.distance)\n # Draw first 10 matches.\n img3 = cv.drawMatches(img1,kp1,img2,kp2,matches[:200000],None,flags=cv.DrawMatchesFlags_NOT_DRAW_SINGLE_POINTS)\n # plt.imshow(img3),plt.show()\n\n cv.imshow('frame',img3)\n\n\n\n# When everything done, release the capture\ncap.release()\ncv.destroyAllWindows()" }, { "alpha_fraction": 0.5963636636734009, "alphanum_fraction": 0.6018182039260864, "avg_line_length": 17.965517044067383, "blob_id": "f9025e3d8b0e807ecbf58bc1c85672db8b6ce93d", "content_id": "12187498a9e5ce92f5dcb99b87f7c793ef7154ee", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 550, "license_type": "no_license", "max_line_length": 47, "num_lines": 29, "path": "/pyqt5-curso/lineEdita.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import sys\nfrom PyQt5 import QtWidgets\n\n\nclass Window(QtWidgets.QWidget):\n\n def __init__(self):\n super().__init__()\n\n self.init_ui()\n\n def init_ui(self):\n self.le = QtWidgets.QLineEdit()\n self.b = QtWidgets.QPushButton('Clear')\n\n v_box = QtWidgets.QVBoxLayout()\n v_box.addWidget(self.le)\n v_box.addWidget(self.b)\n\n self.setLayout(v_box)\n\n self.setWindowTitle('PyQt5 Lesson 6')\n\n self.show()\n\n\napp = QtWidgets.QApplication(sys.argv)\na_window = Window()\nsys.exit(app.exec_())\n" }, { "alpha_fraction": 0.6219708919525146, "alphanum_fraction": 0.6276252269744873, "avg_line_length": 34.371429443359375, "blob_id": "6da553d92911aeb13a8e60cc46f3b061b261a1bd", "content_id": "8359b5ccb36d52f81b956a7572a83706623648a0", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1248, "license_type": "no_license", "max_line_length": 80, "num_lines": 35, "path": "/pong/widgets/Raquete.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "from kivy.properties import NumericProperty\nfrom kivy.uix.widget import Widget\nfrom kivy.vector import Vector\n\n# Define o elemento \"raquete\"\nclass Raquete(Widget):\n \"\"\"\n Define a raquete do nosso jogo. Também faz a verificação de colisão\n da raquete com a bolinha à fim de inverter sua direção.\n \"\"\"\n\n # Cada raquete mantém seu placar\n placar = NumericProperty(0)\n\n # Define a colisão da raquete com a bola\n def rebate_bola(self, bola):\n\n # Verifica se houve a colisão do widget \"raquete\" com o widget \"bola\"\n if (self.collide_widget(bola)):\n\n # Pega a tupla da velocidade da bola (velocidade_x e velocidade_y)\n vx, vy = bola.velocidade\n\n # Verifica se a bola bateu na parte de cima ou de baixo da raquete\n offset_raquete = (bola.center_y - self.center_y) / (self.height / 2)\n\n # Inverte a velocidade da bola\n inv_vel = Vector(-1 * vx, vy)\n\n # Aumenta a velocidade da bola\n vel = inv_vel * 1.15\n\n # Seta a velocidade acelerada da bola, fazendo-a subir mais ou menos\n # dependendo de onde tenha batido na raquete\n bola.velocidade = vel.x, vel.y + (offset_raquete * 2)\n" }, { "alpha_fraction": 0.6642512083053589, "alphanum_fraction": 0.6787439584732056, "avg_line_length": 23.352941513061523, "blob_id": "b2ae03314f47ac5af6e717349240fd8d49f1f363", "content_id": "6bb38760a861a4c7749a60f65cbe73d89fd3ecb8", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 414, "license_type": "no_license", "max_line_length": 57, "num_lines": 17, "path": "/caesb.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import sys\nimport csv\nimport pandas as pd\nimport numpy as np\nimport matplotlib.pyplot as plt\n\nds = pd.read_csv('caesb.csv', sep='|', encoding='cp1252')\nitens = ds.groupby(by='ITEM')\nitemtt = itens['QUANTIDADE','VALOR'].aggregate(np.sum)\nprint(itemtt)\n# print(ds)\n# print(ds.skew())\n# print(ds.describe())\n# print(ds.corr())\n# ds['ITEM'].hist(bins=30).plot.bar()\n# ds['ITEM'].value_counts().plot.bar()\n# plt.show()\n" }, { "alpha_fraction": 0.5237084031105042, "alphanum_fraction": 0.5864591002464294, "avg_line_length": 31.58461570739746, "blob_id": "a2262e51bbd3a41cada2fb3aaf460e2b48e71648", "content_id": "e4a16cd0c16eb835d5bf4f0974e85e41bfa49222", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 4239, "license_type": "no_license", "max_line_length": 115, "num_lines": 130, "path": "/opencv/Realidade-Aumentada-master/src/webcam2.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import numpy as np\nimport cv2 as cv\nfrom objloader_simple import *\n# import matplotlib.pyplot as plt\n\n# Load previously saved data\nwith np.load('R1.npz') as X:\n mtx, dist, _, _ = [X[i] for i in ('mtx','dist','rvecs','tvecs')]\n\n\n\ndef draw(img, corners, imgpts):\n corner = tuple(corners[0].ravel())\n img = cv.line(img, corner, tuple(imgpts[0].ravel()), (255,0,0), 5)\n img = cv.line(img, corner, tuple(imgpts[1].ravel()), (0,255,0), 5)\n img = cv.line(img, corner, tuple(imgpts[2].ravel()), (0,0,255), 5)\n return img\ndef draw2(img, corners, imgpts):\n imgpts = np.int32(imgpts).reshape(-1,2)\n # draw ground floor in green\n img = cv.drawContours(img, [imgpts[:4]],-1,(0,255,0),-3)\n # draw pillars in blue color\n for i,j in zip(range(4),range(4,8)):\n img = cv.line(img, tuple(imgpts[i]), tuple(imgpts[j]),(255),3)\n # draw top layer in red color\n img = cv.drawContours(img, [imgpts[4:]],-1,(0,0,255),3)\n return img\n\ncriteria = (cv.TERM_CRITERIA_EPS + cv.TERM_CRITERIA_MAX_ITER, 30, 0.001)\nobjp = np.zeros((6*7,3), np.float32)\nobjp[:,:2] = np.mgrid[0:7,0:6].T.reshape(-1,2)\n# axis = np.float32([[3,0,0], [0,3,0], [0,0,-3]]).reshape(-1,3)\naxis = np.float32([[0,0,0], [0,3,0], [3,3,0], [3,0,0],[0,0,-3],[0,3,-3],[3,3,-3],[3,0,-3] ])\n\n\ncap = cv.VideoCapture(2)\nimg1 = cv.imread('fotos/box1.jpg',cv.IMREAD_GRAYSCALE) # queryImage\n\nwhile(True):\n # Capture frame-by-frame\n ret, img2 = cap.read()\n img2Gray = cv.cvtColor(img2, cv.COLOR_BGR2GRAY)\n\n\n # Display the resulting frame\n \n if cv.waitKey(1) & 0xFF == ord('q'):\n break\n \n \n \n # Initiate ORB detector\n orb = cv.ORB_create()\n # find the keypoints and descriptors with ORB\n kp1, des1 = orb.detectAndCompute(img1,None)\n kp2, des2 = orb.detectAndCompute(img2Gray,None)\n pts = cv.KeyPoint_convert(kp1)\n pts3d = np.insert(pts, 2, 1, axis=1)\n # print(\"kp1.x\")\n # print(len(pts))\n\n pts2d = cv.KeyPoint_convert(kp2)\n\n\n # create BFMatcher object\n bf = cv.BFMatcher(cv.NORM_HAMMING, crossCheck=True)\n # Match descriptors.\n matches = bf.match(des1,des2)\n # Sort them in the order of their distance.\n matches = sorted(matches, key = lambda x:x.distance)\n # for m,n in matches:\n # if m.distance < 0.7*n.distance:\n # good.append(m)\n\n\n \n limite = 0\n distanciaMaxima = 40\n a = []\n b = []\n for i in range(len(matches)):\n a.append(matches[i].trainIdx)\n b.append(matches[i].queryIdx)\n # print(matches[i].distance)\n if(matches[i].distance < distanciaMaxima):\n limite = i-1\n\n # print(\"b:\")\n # print(b)\n\n pts2dd = np.asarray(pts2d) \n pts3dd = np.asarray(pts3d) \n\n pts2dd = pts2dd[a]\n pts3dd = pts3dd[b]\n\n\n\n # Draw first 10 matches.\n img3 = cv.drawMatches(img1,kp1,img2Gray,kp2,matches[:20],None,flags=cv.DrawMatchesFlags_NOT_DRAW_SINGLE_POINTS)\n print(limite)\n if limite > 5:\n print(\"RA\")\n ret,rvecs, tvecs = cv.solvePnP(pts3dd[:limite], pts2dd[:limite], mtx, dist)\n width = img1.shape[0]\n heigth = img1.shape[1]\n axis1 = np.float32([[0,0,1],[0,width,1],[heigth,0,1],[heigth,width,1]])\n # axis1 = np.float32([[0,0,1],[0,img1.width,1]])\n imgpts, jac = cv.projectPoints(axis1, rvecs, tvecs, mtx, dist)\n # print(imgpts[1][0][1])\n # print(imgpts[0][0][1])\n largura = int(imgpts[1][0][1] - imgpts[0][0][1])\n altura = int(imgpts[3][0][1] - imgpts[2][0][1])\n # print(largura)\n # print(altura)\n # cv.rectangle(img3,(imgpts[0][0][0],imgpts[0][0][1]),(imgpts[3][0][0],imgpts[3][0][1]),(0,255,0),3)\n if(int(imgpts[0][0][1]) > -10 and int(imgpts[0][0][1]) < 1000):\n print(int(imgpts[0][0][1]))\n # cv.rectangle(img2,(imgpts[0][0][0],imgpts[0][0][1]),(imgpts[3][0][0],imgpts[3][0][1]),(0,255,0),3)\n # project 3D points to image plane\n imgpts, jac = cv.projectPoints(10*axis, rvecs, tvecs, mtx, dist) \n img2 = draw2(img2,pts2d,imgpts)\n cv.imwrite('frame.png',img2)\n cv.imwrite('frameSaida.png',img3)\n print(\"frame\")\n cv.imshow('frame',img2)\n\n# When everything done, release the capture\ncap.release()\ncv.destroyAllWindows()\n\n\n\n" }, { "alpha_fraction": 0.6344262361526489, "alphanum_fraction": 0.6483606696128845, "avg_line_length": 21.200000762939453, "blob_id": "42a59c9a1304e3070e9ded0ba32195c613a1a031", "content_id": "1821b2f8d31297a0809ea45a760ae23673b6a86e", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1242, "license_type": "no_license", "max_line_length": 68, "num_lines": 55, "path": "/JPro-master/JPro.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import sys \nfrom PyQt5.QtWidgets import (QApplication, \n\t\t\t\t\t\t\tQMainWindow,\n\t\t\t\t\t\t\tQTabWidget,\n\t\t\t\t\t\t\tQShortcut,\n\t\t\t\t\t\t\tqApp,\n\t\t\t\t\t\t\t)\nfrom PyQt5.QtGui import QKeySequence\nfrom pbox import PBox\nfrom ibox import IBox\nfrom tbox import TBox\nfrom cbox import CBox\nimport numpy as np\nfrom PyQt5.QtSql import QSqlDatabase,QSqlQuery,QSqlRecord, QSqlField\n\n\ndb = QSqlDatabase.addDatabase(\"QSQLITE\")\ndb.setDatabaseName(\"complete.db\")\ndb.open()\n\nclass App(QMainWindow): \n\t\n\tdef __init__(self):\n\t\tsuper().__init__() \n\n\t\tself.tabs = QTabWidget()\n\t\tself.setCentralWidget(self.tabs)\n\t\t\n\t\tself.pbox = PBox()\n\t\tself.tabs.addTab(self.pbox, 'Order Queue / 生产队列')\n\n\t\tself.ibox = IBox()\n\t\tself.tabs.addTab(self.ibox, 'Inventory / 库存 ')\t\t\n\n\t\tself.tbox = TBox()\n\t\tself.tabs.addTab(self.tbox, 'Wiki / 维基 ')\n\n\t\tself.cbox = CBox()\n\t\tself.tabs.addTab(self.cbox, 'Calculator / 计算机')\n\n\t\tself.setGeometry(0,0,640,440)\n\t\tself.setWindowTitle('JPro')\n\t\t# self.setStyleSheet('background-color: #444444')\n\t\tself.show()\n\n\t\t#===##===##===##===##===#\n\t\t#Shortcuts \n\t\t#===##===##===##===##===#\n\t\texitShortcut = QShortcut(QKeySequence('Ctrl+W'),self, qApp.quit)\n\nif __name__ == '__main__' : \n\n\tapp = QApplication(sys.argv)\n\tmain = App()\n\tsys.exit(app.exec_())" }, { "alpha_fraction": 0.5011135935783386, "alphanum_fraction": 0.5100222826004028, "avg_line_length": 19.409090042114258, "blob_id": "2d4fac8f07b6250ea66fe4b70ac0d06202cc932a", "content_id": "e1ea5cf89f349da8d58464b61c29c95cfbb8f386", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 449, "license_type": "no_license", "max_line_length": 77, "num_lines": 22, "path": "/fullcontrol-menu/testeEmail.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import sys\nfrom funcoes.isEmail import isEmail\n\nlista = [\n '#bueno@1linha.com.br',\n 'bueno=joao@1linha.com.br',\n 'presidencia@sindivaregista.org.b',\n 'cso.brasilia@bb.com.br',\n 'eliveltonmendesdossantos@gmail.com',\n 'rayssalovemae31@gmail.com',\n 'NAO POSSUI E-MAIL',\n 'fazendasoa@brasal.com.br',\n 'fazenda_recreio@terra.com.br'\n]\n\n\nif __name__ == '__main__':\n for email in lista:\n if isEmail(email):\n print('{:40} - This is a valid e-mail address'.format(email))\n else:\n print('{:40} - This is not a valid e-mail address'.format(email))\n" }, { "alpha_fraction": 0.5608108043670654, "alphanum_fraction": 0.5641891956329346, "avg_line_length": 23.70833396911621, "blob_id": "cd8cc15b86bba0ad46010438eca4d8ecacf9f961", "content_id": "722faf2f5c5298b459e2c9432a6d11d69d874895", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 592, "license_type": "no_license", "max_line_length": 79, "num_lines": 24, "path": "/py-shell/shellrip.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/python3\n# -*- coding: utf-8 -*-\nimport os\n\nclass Imediate(object):\n def __init__(self, command, output):\n self.command = command\n self.output = output\n\n def __call__ (self, *args):\n result = os.popen(\"%s %s\" % (self.command, \" \".join(args))).readlines()\n if not self.output:\n return result\n print(\"\".join(result))\n return None\n\nclass Shell(object):\n def __init__(self, output=False):\n self._output = output\n def __getattr__(self, attr):\n return Imediate(attr, self._output)\n\nS = Shell()\nI = Shell(True)" }, { "alpha_fraction": 0.2898728847503662, "alphanum_fraction": 0.3044280409812927, "avg_line_length": 40.1561164855957, "blob_id": "b8a06c9c97e2048ec96858aac09bcc53af6a19ad", "content_id": "4456e2373cf0366b54c9245870a2cc7e27c0ea2e", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 9757, "license_type": "no_license", "max_line_length": 151, "num_lines": 237, "path": "/PQt5-Stock/Componentes/generarPdf.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import datetime\nfrom PyQt5.Qt import QDesktopServices, QUrl\nfrom PyQt5.Qt import QTextDocument, QPrinter\nfrom Modelo.persona import Persona\n\nclass GenerarPDF():\n\n def __init__(self):\n self.hoy = str(datetime.datetime.now().year) + str(datetime.datetime.now().month) + \\\n str(datetime.datetime.now().day) + str(datetime.datetime.now().hour) + \\\n str(datetime.datetime.now().minute) + str(datetime.datetime.now().second)\n\n self.nombrePdf = \"\"\n\n\n def generateTableTransaction(self, listTable):\n\n tableHeaderHtml = \"\"\"\n <table width=\"600\" height=\"0\" style=\"border-color: black; border-width: 0.5px; border-spacing: 0;\">\n\n <tr style=\" background-color: gray; border-style: inset;\">\n <td width=\"10%\" align=\"center\" valign=\"middle\">\n <b>\n CANT\n </b>\n </td>\n <td width=\"20%\" align=\"center\" valign=\"middle\">\n <b>\n PRODUCTO\n </b>\n </td>\n <td width=\"50%\" align=\"center\" valign=\"middle\">\n <b>\n DESCRIPCION\n </b>\n </td>\n <td width=\"10%\" align=\"center\" valign=\"middle\">\n <b>\n PREC <br>UNIT\n </b>\n </td>\n <td width=\"10%\" align=\"center\" valign=\"middle\">\n <b>\n PREC <br>TOT\n </b>\n </td>\n </tr>\n </table>\n \"\"\"\n\n rowsHtml = \"\"\n for transaccion in listTable:\n rowsHtml += \"\"\"\n <tr height=\"80\">\n <td width=\"10%\" align=\"center\" >\n <br>\"\"\" + str(transaccion[1]) + \"\"\"<br>\n </td>\n <td width=\"20%\" >\n <br> &nbsp;&nbsp;\"\"\" + str(transaccion[3]) + \"\"\"<br>\n </td>\n <td width=\"50%\" >\n <br>&nbsp;&nbsp; \"\"\" + str(transaccion[4]) + \"\"\"<br>\n </td>\n <td width=\"10%\" align=\"right\" >\n <br> $ \"\"\" + str(transaccion[5]) + \"\"\"&nbsp;&nbsp;<br>\n </td>\n <td width=\"10%\" align=\"right\" >\n <br> $ \"\"\" + str( int(transaccion[1]) * float(transaccion[5])) + \"\"\"&nbsp;&nbsp;<br>\n </td>\n </tr>\n \"\"\"\n\n tableDetailHtml = \"\"\"\n <table height=\"350\" width=\"600\" style=\"border-color: gray; border-width: .4px; border-collapse: collapse;\">\n \"\"\" + rowsHtml + \"\"\"\n\n </table>\n \"\"\"\n\n\n\n\n def generarRecibo(self, listDetail, subName, id, header):\n \"\"\"\n\n @param listDetail: lista de detalles\n @param subName: Sub-nombre para generar el PDF\n @param id: Id del recibo\n \"\"\"\n self.nombrePdf = '../archivos/' + str(self.hoy + subName) + '.pdf'\n listDetalHtml = self.generateTableTransaction(listDetail, header)\n\n nombre = \"\"\n apellido = \"\"\n\n if(self.tipoTransaccion == \"VENTA\"):\n nombre = self.cliente.getNombre()\n apellido = self.cliente.getApellido()\n elif(self.tipoTransaccion == \"COMPRA\"):\n nombre = self.proveedor.getNombre()\n apellido = self.proveedor.getDescripcion()\n\n\n total = self.winPrincipal.lblTotal.text()\n fecha = str(datetime.datetime.now())\n html = \"\"\"\n <table width=\"600\">\n <tr width=\"600\" color=\"#000000\">\n <td width=\"80%\">\n Perfumeria La que vende perfumes <br>\n LABOULAYE, CORDOBA, ARGENTINA <br>\n TEL: 0351-111111 <br>\n MAIL: MAIL@MAIL.COM <br>\n </td>\n <td width=\"20%\" align=\"right\">\n <IMG SRC=\"kde1.png\">\n </td>\n </tr>\n\n </table>\n _______________________________________________________________________________________________________\n <p>\n DATOS DEL CLIENTE:\n </p>\n <br>\n <table>\n\n <tr>\n <td>\n NOMBRE: \"\"\"+ nombre +\"\"\" <br>\n APELLIDO: \"\"\" + apellido + \"\"\" <br>\n\n </td>\n <td>\n </td>\n </tr>\n </table>\n\n <br>\n _______________________________________________________________________________________________________\n <br>\n <p>\n DETALLES DE LA COMPRA:\n </p>\n <br>\n <table width=\"600\" height=\"0\" style=\"border-color: black; border-width: 0.5px; border-spacing: 0;\">\n <tr style=\" background-color: gray; border-style: inset;\">\n <td width=\"10%\" align=\"center\" valign=\"middle\">\n <b>\n CANT\n </b>\n </td>\n <td width=\"20%\" align=\"center\" valign=\"middle\">\n <b>\n PRODUCTO\n </b>\n </td>\n <td width=\"50%\" align=\"center\" valign=\"middle\">\n <b>\n DESCRIPCION\n </b>\n </td>\n <td width=\"10%\" align=\"center\" valign=\"middle\">\n <b>\n PREC <br>UNIT\n </b>\n </td>\n <td width=\"10%\" align=\"center\" valign=\"middle\">\n <b>\n PREC <br>TOT\n </b>\n </td>\n </tr>\n </table>\n\n <br>\n <br>\n <br>\n <br>\n\n <table height=\"350\" width=\"600\" style=\"border-color: gray; border-width: .4px; border-collapse: collapse;\">\n \"\"\" + listTransaccionTable + \"\"\"\n </table>\n <br>\n <br>\n <table width=\"600\" border=\"0.5\" height=\"0\" style=\"border-color: black; border-width: 0.5px; border-spacing: 0;\">\n <tr >\n <td width=\"90%\" align=\"right\">\n <br>\n TOTAL..................................................................................................................\n <br>\n </td>\n <td width=\"10%\" align=\"center\">\n <br> $ \"\"\" + total + \"\"\"<br>\n </td>\n </tr>\n </table>\n\n <br>\n <br>\n <br>\n <p width=\"600\" align=\"center\" style=\" font-size: 10; \" >\n Por cualquier consulta, sobre este recibo, dirigirse al local que se encuentra ubicado en la calle\n independencia 450. <br> O Comunicarse a los telefonos 03382-123123123 / 4231231\n </p>\n <br>\n <br>\n <br>\n <br>\n <br>\n _______________________________________________________________________________________________________\n <br>\n <table width=\"600\">\n <tr>\n <td align=\"right\" width=\"80%\">\n FECHA/HORA : \"\"\"+ fecha + \"\"\"\n </td>\n <td align=\"right\">\n N° : \"\"\"+ str(idRecibo) +\"\"\"\n </td>\n </tr>\n </table>\n _______________________________________________________________________________________________________\n \"\"\"\n\n doc = QTextDocument()\n doc.setHtml(html)\n #doc.setDefaultStyleSheet(style)\n printer = QPrinter()\n printer.setOutputFileName(nombrePdf)\n\n printer.setOutputFormat(QPrinter.PdfFormat)\n doc.print(printer)\n printer.newPage()\n url = QUrl\n url = QUrl(nombrePdf)\n QDesktopServices.openUrl(url)\n\n\n" }, { "alpha_fraction": 0.5936508178710938, "alphanum_fraction": 0.6539682745933533, "avg_line_length": 23.30769157409668, "blob_id": "92ee6c3c79595589b95ac9e75d02fa49c7df0069", "content_id": "4ebd5d65bc7dd040b77fde71648cf5c796961abf", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 315, "license_type": "no_license", "max_line_length": 51, "num_lines": 13, "path": "/mathplot/matplot-003.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import scipy\nimport pylab \nimport matplotlib.pyplot as plt\n\nx,y = scipy.ogrid[-1.:1.:.01, -1.:1.:.01]\nz = x**3-3*x*y**2\npylab.imshow(z, origin='lower', extent=[-1,1,-1,1])\nplt.contour(z, origin='lower', extent=[-1,1,-1,1])\npylab.xlabel('x')\npylab.ylabel('y')\npylab.title('Saddle')\npylab.savefig('Saddle')\nplt.show()" }, { "alpha_fraction": 0.6590835452079773, "alphanum_fraction": 0.6618459820747375, "avg_line_length": 37.704402923583984, "blob_id": "b7a6b0b3a102042beeba4b036bb80b857a658ffa", "content_id": "d83c33cee55d3d9bfbd250c227501b4671d67350", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 6154, "license_type": "no_license", "max_line_length": 103, "num_lines": 159, "path": "/PQt5-Stock/Controlador/windowRubro.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nimport sys\n\nfrom PyQt5 import uic\nfrom Modelo.rubro import Rubro\nfrom Componentes.tableModel import MyTableModel\nfrom PyQt5.QtWidgets import QTableView, QAbstractItemView, QWidget\nfrom Conexion.conexionRubro import conexionRubro\nfrom Modelo.telefono import Telefono\nfrom PyQt5.QtWidgets import QMessageBox, QDialog\n\nclass windowRubro():\n\n def __init__(self):\n\n #Definiendo variables\n self.winRubro = uic.loadUi('Vista/abmRubro.ui')\n self.rubro = Rubro()\n self.conexionRubro = conexionRubro()\n self.contAttr = 0\n self.estado = \"\" #Variable donde guardo el estado, para saber que accion hace el boton guardar.\n #Configurando botones\n self.winRubro.btnGuardar_r.clicked.connect(self.onClickGuardar_r)\n self.winRubro.btnModificar_r.clicked.connect(self.onClickModificar_r)\n self.winRubro.btnBorrar_r.clicked.connect(self.onClickBorrar_r)\n self.winRubro.btnAgregar_r.clicked.connect(self.onClickAgregar_r)\n\n\n\n self.winRubro.txtFilterRubros_r.returnPressed.connect(self.search)\n\n\n #Seteo propiedades de la tabla\n self.winRubro.tvRubros_r.setSortingEnabled(True)\n self.winRubro.tvRubros_r.setMouseTracking(True)\n self.winRubro.tvRubros_r.setSelectionBehavior(QAbstractItemView.SelectRows)\n\n self.winRubro.exec()\n #sys.executable(self.winRubro.exec_())\n\n\n def search(self):\n if self.winRubro.txtFilterRubros_r.hasFocus() is True:\n self.cargarTabla()\n\n def onClickGuardar_r(self):\n\n if self.winRubro.txtDescripcion_r.text() != \"\":\n\n self.rubro.setRubro(self.winRubro.txtDescripcion_r.text())\n\n if self.estado == 'AGREGAR':\n self.insertRubro()\n elif self.estado == 'MODIFICAR':\n self.modificarRubro()\n else:\n print(\"Falta completar el campo descripcion\")\n alert = QDialog()\n QMessageBox.information(alert,\"ERROR\", \"Falta completar el campo descripcion\")\n\n self.validarBotones(button='GUARDAR')\n\n\n def onClickAgregar_r(self):\n self.estado = 'AGREGAR'\n self.validarBotones(button='AGREGAR')\n\n\n def onClickModificar_r(self):\n self.estado = 'MODIFICAR'\n self.validarBotones(button='MODIFICAR')\n\n def onClickBorrar_r(self):\n if self.rubro and self.winRubro.btnAgregar_r.isEnabled():\n self.conexionRubro.borrarRubro(self.rubro)\n self.cargarTabla()\n self.validarBotones(button='BORRAR')\n\n def cargarTabla(self):\n #Seteo el dataProvider de la tabla\n filterText = self.winRubro.txtFilterRubros_r.text()\n listaRubros = self.conexionRubro.selectRubro(filterText)\n if len(listaRubros) > 0:\n header = ['ID', 'Rubro']\n self.tablaModel = MyTableModel(self.winRubro.tvRubros_r, listaRubros, header)\n self.winRubro.tvRubros_r.setModel(self.tablaModel)\n self.winRubro.tvRubros_r.selectionModel().currentChanged.connect(self.changeSelectedTable)\n\n self.winRubro.tvRubros_r.setColumnHidden(0, True)\n self.winRubro.tvRubros_r.setColumnWidth(1, 245)\n else:\n self.winRubro.tvRubros_r.setModel(None)\n\n def changeSelectedTable(self, selected, deselected):\n self.winRubro.tvRubros_r.selectRow(selected.row())\n\n rubroList = selected.model().mylist\n rubroSelected = rubroList[selected.row()]\n\n self.rubro = Rubro()\n self.rubro.setIdRubro(int(rubroSelected[0]))\n self.rubro.setRubro(str(rubroSelected[1]))\n\n self.winRubro.tvRubros_r.setRowHeight(deselected.row(), 33)\n self.winRubro.tvRubros_r.setRowHeight(selected.row(), 45)\n\n self.winRubro.txtDescripcion_r.setText(str(self.rubro.getRubro()))\n self.winRubro.btnModificar_r.setEnabled(True)\n self.winRubro.btnBorrar_r.setEnabled(True)\n\n\n def validarBotones(self, button):\n if button == 'AGREGAR':\n self.winRubro.btnModificar_r.setEnabled(False)\n self.winRubro.btnAgregar_r.setEnabled(False)\n self.winRubro.btnGuardar_r.setEnabled(True)\n self.winRubro.btnBorrar_r.setText('CANCELAR')\n self.winRubro.btnBorrar_r.setEnabled(True)\n self.winRubro.tvRubros_r.setEnabled(False)\n self.winRubro.txtDescripcion_r.setText('')\n self.winRubro.txtDescripcion_r.setEnabled(True)\n elif button == 'GUARDAR':\n self.winRubro.btnModificar_r.setEnabled(False)\n self.winRubro.btnAgregar_r.setEnabled(True)\n self.winRubro.btnGuardar_r.setEnabled(False)\n self.winRubro.btnBorrar_r.setText('BORRAR')\n self.winRubro.btnBorrar_r.setEnabled(False)\n self.winRubro.tvRubros_r.setEnabled(True)\n self.winRubro.txtDescripcion_r.setText('')\n self.winRubro.txtDescripcion_r.setEnabled(False)\n elif button == 'MODIFICAR':\n self.winRubro.btnModificar_r.setEnabled(False)\n self.winRubro.btnAgregar_r.setEnabled(False)\n self.winRubro.btnGuardar_r.setEnabled(True)\n self.winRubro.btnBorrar_r.setText('CANCELAR')\n self.winRubro.btnBorrar_r.setEnabled(True)\n self.winRubro.tvRubros_r.setEnabled(False)\n self.winRubro.txtDescripcion_r.setEnabled(True)\n elif button == 'BORRAR':\n self.winRubro.btnModificar_r.setEnabled(False)\n self.winRubro.btnAgregar_r.setEnabled(True)\n self.winRubro.btnGuardar_r.setEnabled(False)\n self.winRubro.btnBorrar_r.setText('BORRAR')\n self.winRubro.btnBorrar_r.setEnabled(False)\n self.winRubro.tvRubros_r.setEnabled(True)\n self.winRubro.txtDescripcion_r.setText('')\n self.winRubro.txtDescripcion_r.setEnabled(False)\n\n def insertRubro(self):\n if self.rubro:\n self.conexionRubro.insertarRubro(self.rubro)\n self.cargarTabla()\n\n\n def modificarRubro(self):\n if self.rubro:\n self.conexionRubro.modificarRubro(self.rubro)\n self.cargarTabla()\n" }, { "alpha_fraction": 0.4958723187446594, "alphanum_fraction": 0.558613121509552, "avg_line_length": 18.75, "blob_id": "3b9646321dbecb7cd8d062305eee045eb6145eed", "content_id": "4eb09d04bee3c07d10cb0865e48d8687892275ba", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1817, "license_type": "no_license", "max_line_length": 68, "num_lines": 92, "path": "/conta.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import sys\nfrom random import randint\nfrom random import gammavariate\nfrom ctypes import windll\nwindll.kernel32.SetConsoleMode(windll.kernel32.GetStdHandle(-11), 7)\nshow = lambda s: sys.stdout.write(s)\n\noff = 0\n\nfg_blk = 30\nfg_red = 31\nfg_gre = 32\nfg_yel = 33\nfg_blu = 34\nfg_mag = 35\nfg_cya = 36\nfg_whi = 37\n\nbk_blk = 40\nbk_red = 41\nbk_gre = 42\nbk_yel = 43\nbk_blu = 44\nbk_mag = 45\nbk_cya = 46\nbk_whi = 47\n\ndef cor(b,f,bi,fi):\n \"\"\"Cor\\n\n b - background-collor\\n\n f - foreground-collor\\n\n bi- background intensity\\n\n bi- background intensity\"\"\"\n if bi == 1:\n b += 60\n print(\"\\x1b[%d;%d;%dm\" %(fi,b,f), end=\"\")\n\n# def cls(b,f,bi,fi):\n# \"\"\"Limpa a tela\\n\n# b - background-collor\\n\n# f - foreground-collor\\n\n# bi- background intensity\\n\n# bi- background intensity\"\"\"\n# if bi == 1:\n# b += 60\n# print(\"\\x1b[%d;%d;%dm\" %(fi,b,f), end=\"\")\n# show(\"\\x1b[H\\x1b[J\")\n\ndef cls():\n \"\"\"Limpa a tela\"\"\"\n print(\"\\x1b[H\\x1b[J\", end=\"\")\n\n# def prt(b,f,bi,fi,msg):\n# \"\"\"Mostra uma mensagem\\n\n# b - background-collor\\n\n# f - foreground-collor\\n\n# bi- background intensity\\n\n# bi- background intensity\\n\n# msg - mensagem\"\"\"\n# if bi == 1:\n# b += 60\n# print(\"\\x1b[%d;%d;%dm%s\"%(fi,b,f,msg), end=\"\")\n\ndef prt(msg,l = -1,c = -1):\n \"\"\"Mostra uma mensagem\\n\n l - linha (opcional)\\n\n c - coluna (opcional)\"\"\"\n if l >= 0 and c >= 0:\n print(\"\\x1b[%d;%dH\" %(l,c), end=\"\")\n print(\"%s\"%(msg), end=\"\")\n\ncor(44,33,1,1)\ncls()\nprint(\"teste\")\n# cls(44,33,1,1)\n# prt(44,33,1,1,\"teste\")\n\ncor(44,33,0,1)\nprt(\"\",10,50)\nprint(randint(0, 9))\n\ncor(44,34,0,1)\nprt(\"teste2\")\nprt(\"teste2\")\nprt(\"teste2\")\ncor(bk_blu,fg_yel,0,1)\nprt(\"teste\",0,0)\nprt(\"teste\",1,1)\nprt(\"teste\",2,2)\nprt(\"teste\",3,3)\nprt(\"teste\",4,4)\nprt(\"teste\",4,9)\n" }, { "alpha_fraction": 0.6536458134651184, "alphanum_fraction": 0.6536458134651184, "avg_line_length": 22.9375, "blob_id": "f2f5a7fba3fdfe3092a1d93ab54fcac264f56923", "content_id": "bf8e6c69b00d60a58ed18b7b1d7fa2f7e5c369ca", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 384, "license_type": "no_license", "max_line_length": 77, "num_lines": 16, "path": "/djangosige/venv/Lib/site-packages/geraldo/generators/html.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "# TODO\n\nfrom .base import ReportGenerator\n\nclass HTMLGenerator(ReportGenerator):\n \"\"\"This is a generator to output a XHTML that uses CSS and best practices\n on standards.\"\"\"\n filename = None\n\n def __init__(self, report, filename):\n super(HTMLGenerator, self).__init__(report, *args, **kwargs)\n\n self.filename = filename\n\n def execute(self):\n pass\n\n" }, { "alpha_fraction": 0.5982532501220703, "alphanum_fraction": 0.6200873255729675, "avg_line_length": 18.08333396911621, "blob_id": "26f59c725bc9e04c23b00a4c2bafdf0bced607d7", "content_id": "03ae61938c56492623a427c26e4c6bcf1067b988", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 229, "license_type": "no_license", "max_line_length": 46, "num_lines": 12, "path": "/cerrado/decorators-002.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "def call(x):\n def decorator(func):\n return print(func(x))\n return decorator\n\n\n@call(42)\ndef start(x):\n version = x / 100\n print(\"Hello World!\")\n print(f\"Iniciando meu programa {version}\")\n return version\n" }, { "alpha_fraction": 0.6671069860458374, "alphanum_fraction": 0.7159841656684875, "avg_line_length": 25, "blob_id": "28e4bfc7f53740fa6e44f8c1f01a11f306a50001", "content_id": "e4dcdfdaa6564ee253c7252dd0530633b7f70c2f", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 757, "license_type": "no_license", "max_line_length": 78, "num_lines": 29, "path": "/opencv/Realidade-Aumentada-master/test2.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import numpy as np\nimport cv2\n# from matplotlib import pyplot as plt\n\nimg1 = cv2.imread('fotos/box1.jpg',cv2.IMREAD_GRAYSCALE) # queryImage\nimg2 = cv2.imread('fotos/cenario100.jpg') # trainImage\n\n# Initiate SIFT detector\nsift = cv2.SIFT()\n\n# find the keypoints and descriptors with SIFT\nkp1, des1 = sift.detectAndCompute(img1,None)\nkp2, des2 = sift.detectAndCompute(img2,None)\n\n# BFMatcher with default params\nbf = cv2.BFMatcher()\nmatches = bf.knnMatch(des1,des2, k=2)\n\n# Apply ratio test\ngood = []\nfor m,n in matches:\n if m.distance < 0.75*n.distance:\n good.append([m])\n\n# cv2.drawMatchesKnn expects list of lists as matches.\nimg3 = cv2.drawMatchesKnn(img1,kp1,img2,kp2,good,flags=2)\n\ncv2.imshow('img',img3)\nk = cv2.waitKey(0) & 0xFF " }, { "alpha_fraction": 0.5975024104118347, "alphanum_fraction": 0.6003842353820801, "avg_line_length": 21.65217399597168, "blob_id": "0bce2c9d694a5954be2992dae9730a96a1826e9f", "content_id": "51e9e76b16ca26b41af81b2dc30759e9d0f7d996", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1041, "license_type": "no_license", "max_line_length": 52, "num_lines": 46, "path": "/PQt5-Stock/Modelo/usuario.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom Modelo.persona import Persona\nimport hashlib\n\nclass Usuario(Persona):\n\n def __init__(self):\n Persona.__init__(self)\n self.__idUsuario = 0\n self.__apellido = \"\"\n self.__usuario = \"\"\n self.__passwd = \"\"\n self.__tipoUsuario = \"\"\n\n def setApellido(self, apellido):\n self.__apellido = apellido\n\n def getApellido(self):\n return self.__apellido\n\n def setUsuario(self, usuario):\n self.__usuario = usuario\n\n def getUsuario(self):\n return self.__usuario\n\n def setPasswd(self, passwd):\n #auxPasswd = hashlib.md5(passwd).hexdigest()\n self.__passwd = passwd\n\n def getPasswd(self):\n return self.__passwd\n\n def setTipoUsuario(self, tipoUsuario):\n self.__tipoUsuario = tipoUsuario\n\n\n def getTipoUsuario(self):\n return self.__tipoUsuario\n\n def setIdUsuario(self, idUsuario):\n self.__idUsuario = idUsuario\n\n def getIdUsuario(self):\n return self.__idUsuario" }, { "alpha_fraction": 0.5329006910324097, "alphanum_fraction": 0.5335043668746948, "avg_line_length": 25.08661460876465, "blob_id": "5414e1974e1d76da86c208ee9f6c7a87f1ba49e3", "content_id": "1a1f301a62d29d918646f3eb3ec539c066093368", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 6626, "license_type": "no_license", "max_line_length": 99, "num_lines": 254, "path": "/Hospital-Helper-2-master/app/model/logic.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import sys\nimport re\nimport json\nimport math\nimport builtins\nimport collections\nfrom collections import defaultdict\n\nimport unidecode\n\nfrom app import options\nfrom app.model import exceptions, db\n\n\nclass AllowedModule(list):\n\n excluded_attr = ('exec', 'eval')\n\n def __init__(self, module):\n self.name = module.__name__\n super().__init__(\n [attr for attr in dir(module) if attr not in self.excluded_attr])\n\n\nMODULES = math, builtins\nALLOWED_MODULES = [AllowedModule(module) for module in MODULES]\n\n\nclass Parser:\n\n \"\"\"\n Used to parse structure and calculation strings\n \"\"\"\n\n property_re = re.compile(r'[^\\W\\d]+\\.?[\\w\\_\\'\"]*', re.UNICODE)\n module_str = '{}.{}'\n get_str = 'self._get(\"{}\")'\n self_str = 'self.set(\"{}\", {})'\n\n @staticmethod\n def _escape_value(value):\n return value.lower().replace(' ', '')\n\n @classmethod\n def unidecode(cls, value):\n return unidecode.unidecode(cls._escape_value(value)).replace('\\'', '')\n\n @classmethod\n def parse_calculation_string(cls, name, string):\n out = []\n i = 0\n\n for match in cls.property_re.finditer(string):\n begin, end = match.span()\n group = match.group()\n\n for module in ALLOWED_MODULES:\n if group in module:\n group = cls.module_str.format(module.name, group)\n break\n else:\n group = cls.get_str.format(group)\n\n out.append(''.join((string[i:begin], group)))\n i = end\n else:\n out.append(string[i:])\n\n expr = ''.join([chunk for chunk in out])\n return cls.self_str.format(name, expr)\n\n @classmethod\n def parse_structure(cls, structure):\n\n structure = cls.unidecode(structure)\n\n try:\n structure = json.loads(structure)\n except ValueError:\n raise exceptions.BadStructure()\n sys.exit()\n\n return structure\n\n\nclass Mediator:\n\n \"\"\"\n Sort of implementation of 'Mediator' pattern.\n Provides access to other objects attributes.\n Also its Singleton and i'm not sure if you're ok with that.\n \"\"\"\n\n __instance = None\n\n def __new__(cls, obj=None):\n if cls.__instance is None:\n cls.__instance = super(cls, cls).__new__(cls)\n cls.__instance.__initialized = False\n return cls.__instance\n\n def __init__(self):\n\n if self.__initialized:\n return\n\n self.objects = {}\n self.__initialized = True\n\n def __call__(self, obj):\n self.objects[obj.name] = obj\n return self\n\n def __str__(self):\n return 'Mediator. Watch objects: [{}]'.format(', '.join(self.objects.keys()))\n\n def _get_value(self, name):\n for obj in self.objects:\n try:\n return obj[name]\n except KeyError:\n continue\n\n raise AttributeError('Name {} was not found in objects'.format(name))\n\n def get(self, key):\n try:\n obj_name, name = key.split('.')\n except IndexError:\n name = key\n else:\n return self.objects[obj_name][name]\n\n return self._get_value(name)\n\n\nclass CalculableObject(collections.OrderedDict):\n\n calculation_divider = ';\\n'\n\n def __init__(self, name, verbose_name, group, args, parser, mediator, model=None, item=None):\n super().__init__()\n\n self.types = self._create_types(args)\n self.name = name\n self.verbose_name = verbose_name\n self.group = group\n self.mediator = mediator(self)\n self.model = model\n self.calculations = []\n self.template = None\n if item:\n self.id = item.id\n\n for each in args:\n self[each['name']] = self.types[each['name']]()\n calculation = each.get('calculation')\n if calculation:\n self.calculations.append(\n parser.parse_calculation_string(each['name'], calculation))\n\n self.calculations = self.calculation_divider.join(self.calculations)\n\n def __str__(self):\n return '{}: [{}]'.format(self.name, ', '.join(self.keys()))\n\n def _get(self, name):\n try:\n value = self[name]\n except KeyError:\n value = self.mediator.get(name)\n\n return value\n\n def _create_types(self, args):\n types = options.TYPES\n\n return {each['name']: types.get(each.get('type', 'float'), float)\n for each in args}\n\n def _add_calculation(self, name, calculation):\n pass\n\n def set(self, name, value):\n \"\"\"\n If value is fucked up it will be set to default for it's type.\n float -> 0.0\n str -> ''\n \"\"\"\n if self.get(name) is None:\n raise AttributeError('No such attribute: {}'.format(name))\n\n type_ = self.types[name]\n\n try:\n value = type_(value)\n except ValueError:\n value = type_()\n\n if type_ is float:\n if value == int(value):\n value = int(value)\n else:\n value = round(value, 2)\n\n self[name] = value\n\n def clean(self):\n for k in self.keys():\n self.set(k, '')\n self.template = None\n\n def get_verbose_name(self):\n return _(self.verbose_name)\n\n def calculate(self):\n for calc in self.calculations.split(self.calculation_divider):\n try:\n exec(calc)\n except ZeroDivisionError:\n pass\n\n def for_template(self):\n out = {\n self.name: defaultdict(str)\n }\n\n for key, value in self.items():\n out[self.name][key] = value\n return out\n\n\nclass ObjectFactory:\n\n model_factory = db.ModelFactory()\n\n @classmethod\n def get_object(cls, info):\n\n model = None\n group, _ = db.Group.get_or_create(name=info.get('group', info['name']), instant_flush=True)\n item, _ = db.Item.get_or_create(name=info['name'], group=group, instant_flush=True)\n\n if info.get('db'):\n model = cls.model_factory.get_model(info)\n\n return CalculableObject(name=info['name'],\n verbose_name=info.get('verbose_name', info['name']),\n args=info['args'],\n group=info.get('group', info['name']),\n parser=Parser(),\n mediator=Mediator(),\n model=model,\n item=item)\n" }, { "alpha_fraction": 0.6443299055099487, "alphanum_fraction": 0.6449742317199707, "avg_line_length": 30.693878173828125, "blob_id": "dfd2562cda44ed5e833a4c675df826fe25068f9e", "content_id": "6506223bfdcaa0f44beacc891b67f901e75febbb", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1552, "license_type": "no_license", "max_line_length": 84, "num_lines": 49, "path": "/PQt5-Stock/Conexion/conexionRubro.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom Conexion.conexion import Conexion\nfrom Modelo.rubro import Rubro\n\nclass conexionRubro(object):\n\n def __init__(self):\n self.conexion = Conexion()\n self.__rubro = Rubro()\n\n def selectRubro(self, filterText):\n query = \"SELECT idrubros, descripcion FROM rubros WHERE descripcion LIKE %s\"\n parametro = filterText + '%'\n value = parametro\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(query, value)\n listRubro = self.conexion.cursor.fetchall()\n\n return listRubro\n self.conexion.cerrarConexion()\n\n\n def borrarRubro(self, rubro):\n query = \"DELETE FROM rubros WHERE idrubros = %s\"\n values = rubro.getIdRubro()\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(query, values)\n self.conexion.db.commit()\n self.conexion.cerrarConexion()\n\n\n def modificarRubro(self, rubro):\n query = \"UPDATE rubros SET descripcion = %s WHERE idrubros = %s\"\n values = (rubro.getRubro(), rubro.getIdRubro())\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(query, values)\n self.conexion.db.commit()\n self.conexion.cerrarConexion()\n\n\n def insertarRubro(self, rubro):\n query = \"INSERT INTO rubros (descripcion) VALUES (%s)\"\n values = rubro.getRubro()\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(query, values)\n self.conexion.db.commit()\n self.conexion.cerrarConexion()" }, { "alpha_fraction": 0.311746746301651, "alphanum_fraction": 0.3151213228702545, "avg_line_length": 45.088890075683594, "blob_id": "8afc72ea3509b743a490d538e6219785d199a468", "content_id": "3bc0d2b3d68fb123ad19cf5475b7af88c9cb58b4", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 6223, "license_type": "no_license", "max_line_length": 120, "num_lines": 135, "path": "/fullcontrol_001/xml-ref.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/python3\n\nimport os\nimport sys\nimport xmltodict\n\n# caminho = sys.argv[1]\n# caminho = r'P:\\multidad\\nfe'\ncaminho = r'/dados/sistema/multidad/nfe'\n\nextens = ['xml', 'XML']\n\nlogname = 'arquivos-ok.log'\nlogerro = 'arquivos-er.log'\narq_imp = 'arq-imp.txt'\n\nlogarq = open(logname, 'w')\nlogerr = open(logerro, 'w')\narqimp = open(arq_imp, 'w')\n\nfound = {x: [] for x in extens}\n\nconta = 0\n\nfor dirpath, dirnames, files in os.walk(caminho):\n for name in files:\n ext = name.lower().rsplit('.', 1)[-1]\n if ext in extens:\n conta += 1\n print(str(conta) + ' => ' + os.path.join(dirpath, name))\n with open(os.path.join(dirpath, name), 'rb') as arquivo:\n dados = arquivo.read().decode('UTF-8')\n doc = xmltodict.parse(dados)\n emp = ''\n des = ''\n fco = ''\n ver = ''\n esp = ''\n ser = ''\n num = ''\n nfe = ''\n arq = ''\n x = len(caminho) + 1\n emp = dirpath[x:x+2]\n if 'entrada' in dirpath:\n des = 'entrada'\n elif 'saida' in dirpath:\n des = 'saida'\n if (des == 'entrada') or (des == 'saida'):\n if 'nfeProc' in doc:\n try:\n if des == 'entrada':\n fco = doc['nfeProc']['NFe']['infNFe']['emit']['CNPJ']\n else:\n try:\n fco = doc['nfeProc']['NFe']['infNFe']['dest']['CNPJ']\n except:\n try:\n fco = doc['nfeProc']['NFe']['infNFe']['dest']['CPF']\n except:\n fco = '1'\n ver = doc['nfeProc']['NFe']['infNFe']['@versao']\n if doc['nfeProc']['NFe']['infNFe']['ide']['mod'] == '55':\n esp = 'NFE'\n else:\n esp = 'NFC'\n ser = doc['nfeProc']['NFe']['infNFe']['ide']['serie']\n num = doc['nfeProc']['NFe']['infNFe']['ide']['nNF']\n nfe = doc['nfeProc']['NFe']['infNFe']['@Id'][3:]\n arq = os.path.join(dirpath, name)\n logarq.write('%s\\n' % os.path.join(dirpath, name))\n except:\n logerr.write('%s\\n' % os.path.join(dirpath, name))\n elif 'procNFe' in doc:\n try:\n if des == 'entrada':\n fco = doc['procNFe']['NFe']['infNFe']['emit']['CNPJ']\n else:\n try:\n fco = doc['procNFe']['NFe']['infNFe']['dest']['CNPJ']\n except:\n try:\n fco = doc['procNFe']['NFe']['infNFe']['dest']['CPF']\n except:\n fco = '1'\n ver = doc['procNFe']['NFe']['infNFe']['@versao']\n if doc['procNFe']['NFe']['infNFe']['ide']['mod'] == '55':\n esp = 'NFE'\n else:\n esp = 'NFC'\n ser = doc['procNFe']['NFe']['infNFe']['ide']['serie']\n num = doc['procNFe']['NFe']['infNFe']['ide']['nNF']\n nfe = doc['procNFe']['NFe']['infNFe']['@Id'][3:]\n arq = os.path.join(dirpath, name)\n logarq.write('%s\\n' % os.path.join(dirpath, name))\n except:\n logerr.write('%s\\n' % os.path.join(dirpath, name))\n else:\n try:\n if des == 'entrada':\n fco = doc['NFe']['infNFe']['emit']['CNPJ']\n else:\n try:\n fco = doc['NFe']['infNFe']['dest']['CNPJ']\n except:\n try:\n fco = doc['NFe']['infNFe']['dest']['CPF']\n except:\n fco = '1'\n ver = doc['NFe']['infNFe']['@versao']\n if doc['NFe']['infNFe']['ide']['mod'] == '55':\n esp = 'NFE'\n else:\n esp = 'NFC'\n ser = doc['NFe']['infNFe']['ide']['serie']\n num = doc['NFe']['infNFe']['ide']['nNF']\n nfe = doc['NFe']['infNFe']['@Id'][3:]\n arq = os.path.join(dirpath, name)\n logarq.write('%s\\n' % os.path.join(dirpath, name))\n except:\n logerr.write('%s\\n' % os.path.join(dirpath, name))\n if arq != '':\n emp.strip()\n des.strip()\n fco.strip()\n ver.strip()\n esp.strip()\n ser.strip()\n num.strip()\n nfe.strip()\n arq.strip()\n # print(f'{emp};{des};{fco};{ver};{esp};{ser};{num};{nfe};{arq}\\n')\n # arqimp.write(f'{emp};{des};{fco};{ver};{esp};{ser};{num};{nfe};{arq}\\n')\n # print('{};{};{};{};{};{};{};{};{}\\n'.format(emp, des, fco, ver, esp, ser, num, nfe, arq))\n arqimp.write('{};{};{};{};{};{};{};{};{}\\n'.format(emp, des, fco, ver, esp, ser, num, nfe, arq))\n\n" }, { "alpha_fraction": 0.597737193107605, "alphanum_fraction": 0.6006845235824585, "avg_line_length": 30.210681915283203, "blob_id": "4686d5ae69329a6971807eb1b0279ee85ec786d3", "content_id": "58ea19dff2216df1847fa5e6dcf01ff6ac98d589", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 10630, "license_type": "no_license", "max_line_length": 100, "num_lines": 337, "path": "/Hospital-Helper-2-master/app/gui/main.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import os\nimport sys\nimport functools\nimport traceback as trb\nimport datetime\n\nfrom sqlalchemy.orm import exc\n\nfrom PyQt5.QtCore import QCoreApplication, Qt, QObject, pyqtSignal\nfrom PyQt5.QtWidgets import (QWidget, QStackedLayout, QDesktopWidget,\n QVBoxLayout, QShortcut, QApplication, QSplashScreen)\n\nfrom PyQt5.QtGui import QKeySequence, QPixmap, QIcon\n\nfrom app import options\nfrom app.model import db, report\n\nfrom app.gui.top_frame import TopFrame\nfrom app.gui.users_widget import UsersWidget\nfrom app.gui.data_widget import DataWidget\nfrom app.gui.db_widget import DBWidget\nfrom app.gui.options_widget import OptionsWidget\nfrom app.gui.template_widget import TemplateWidget\nfrom app.gui.action_button import ActionButton\nfrom app.gui.crud_widget import CrudWidget\nfrom app.gui.alert_widget import AlertWidget\nfrom app.gui.message_widget import MessageWidget\n\n\nclass Communication(QObject):\n \"\"\"\n Object defines signals for application.\n \"\"\"\n\n user_selected = pyqtSignal(object)\n menu_btn_clicked = pyqtSignal(int)\n input_changed_signal = pyqtSignal(str)\n resized = pyqtSignal(float, float, float)\n set_select_item_visibility = pyqtSignal(bool)\n item_selected = pyqtSignal(int)\n toggle_select_item = pyqtSignal()\n ctrl_hotkey = pyqtSignal(bool)\n shortcut_pressed = pyqtSignal(str)\n action_button_toggle = pyqtSignal(bool, str, object)\n clean_items = pyqtSignal()\n set_message_text = pyqtSignal(str)\n\n\nclass MainWindow(QWidget):\n \"\"\"\n Root widget for application.\n Handles signals.\n \"\"\"\n\n def __init__(self, items):\n \"\"\"\n Init gui.\n Connect signals.\n Create layout.\n \"\"\"\n\n super().__init__()\n\n self.items = items\n self.user = None\n self.communication = Communication()\n self.frames_layout = QStackedLayout()\n self.data_frame_index = None\n self.top_system_frame_height = 0\n\n self._init_gui()\n self._set_shortcuts()\n\n def _init_gui(self):\n self._set_sys_attributes()\n self._create_layout()\n self.communication.menu_btn_clicked.connect(self.menu_btn_clicked)\n self.show()\n self._first_start_check()\n\n def _first_start_check(self):\n\n def _import_templates(value):\n if value:\n from app.model import template\n template.Template.import_(options.INIT_TEMPLATES_PATH)\n # self.show_message('Готово!')\n self.show_message('Feito!')\n db.KeyValue(key=options.FIRST_START_KEY, value='').save()\n\n try:\n first_time = db.KeyValue.get(key=options.FIRST_START_KEY).value\n except (exc.NoResultFound, AttributeError):\n first_time = True\n\n if first_time:\n self.create_alert(options.FIRST_START_WELCOME_TEXT, _import_templates)\n\n def _create_layout(self):\n \"\"\"\n Add TopFrame and main frames.\n \"\"\"\n\n MessageWidget(self)\n vbox = QVBoxLayout()\n vbox.setContentsMargins(0, 0, 0, 0)\n vbox.setSpacing(0)\n self.setLayout(vbox)\n\n ActionButton(self)\n vbox.addWidget(TopFrame(self, self.items), stretch=15)\n vbox.addLayout(self.frames_layout, stretch=40)\n self._add_frames()\n self.show()\n\n def _add_frames(self):\n \"\"\"\n Add frames to stacked layout.\n \"\"\"\n\n frames = [\n DataWidget(self, self.items),\n TemplateWidget(self, self.items),\n DBWidget(self),\n OptionsWidget(self, self.items),\n UsersWidget(self),\n ]\n\n for i, frame in enumerate(frames):\n if isinstance(frame, DataWidget):\n self.data_frame_index = i\n if isinstance(frame, UsersWidget):\n self.user_frame_index = i\n self.frames_layout.addWidget(frame)\n\n self.frames_layout.setCurrentIndex(len(frames) - 1)\n\n def _set_sys_attributes(self):\n \"\"\"\n Set sys attributes like window title.\n Disable OS-specific buttons.\n Remove borders.\n \"\"\"\n\n self.setWindowFlags(Qt.FramelessWindowHint)\n\n self.setWindowTitle('Hospital Helper')\n dw = QDesktopWidget()\n w = min(1300, dw.geometry().size().width() * 0.75)\n self.setFixedSize(w, w * 0.65)\n qr = self.frameGeometry()\n cp = dw.availableGeometry().center()\n qr.moveCenter(cp)\n self.move(qr.topLeft())\n\n def menu_btn_clicked(self, index):\n \"\"\"\n Callback to switch between main frames.\n \"\"\"\n\n if self.frames_layout.currentIndex() == index == self.data_frame_index:\n self.communication.toggle_select_item.emit()\n return\n else:\n self.communication.set_select_item_visibility.emit(False)\n self.frames_layout.setCurrentIndex(index)\n\n def input_changed(self, item):\n \"\"\"\n Change TopFrame label when client name is changed.\n Emit signal for TopFrame.\n \"\"\"\n\n # Well it doesnt look good, but i was never good with UI.\n if self.items.index(item) == 0:\n text = []\n for i, key in enumerate(item.keys()):\n if item[key]:\n text.append(str(item[key]))\n if i == 2:\n break\n\n self.communication.input_changed_signal.emit(' '.join(text))\n\n def _set_shortcuts(self):\n \"\"\"\n Set shortcuts for fast items switch on DataWidget.\n \"\"\"\n\n def _shortcut_callback(key):\n if self.frames_layout.currentIndex() != self.data_frame_index:\n return\n self.communication.shortcut_pressed.emit(key)\n\n # QShortcut(QKeySequence('Esc'), self).activated.connect(self.close)\n keys = [str(i) for i in range(0, 11)] + [chr(c) for c in range(ord('A'), ord('Z') + 1)]\n for key in keys:\n QShortcut(QKeySequence('Ctrl+{}'.format(key)), self).activated.connect(\n functools.partial(_shortcut_callback, key))\n\n def create_crud_widget(self, model, callback, db_object=None):\n \"\"\"\n Add CrudWidget with self as parent\n \"\"\"\n\n CrudWidget(self, model, callback, db_object)\n\n def create_alert(self, text, callback=None):\n AlertWidget(self, text, callback)\n\n def show_message(self, text):\n self.communication.set_message_text.emit(text)\n\n def user_selected(self, user, go_to_data_frame=False):\n \"\"\"\n Callback when user is selected.\n Sets user, emits signal.\n \"\"\"\n\n self.user = user\n self.communication.user_selected.emit(user)\n if go_to_data_frame:\n self.communication.menu_btn_clicked.emit(self.data_frame_index)\n\n def create_report(self, event=None):\n \"\"\"\n Render and save report.\n Open report in default OS program.\n \"\"\"\n\n r = report.Report(self.user, self.items)\n db_report = r.render_and_save()\n r.open(db_report.path)\n # self.show_message('Отчет создан')\n self.show_message('Relatório criado')\n\n def clean_input(self):\n def _clean_input(value):\n if not value:\n return\n\n self.communication.clean_items.emit()\n self.communication.input_changed_signal.emit('')\n for item in self.items:\n item.clean()\n self.show_message('Ok')\n\n # self.create_alert('Очистить все поля?', _clean_input)\n self.create_alert('Limpar todos os campos?', _clean_input)\n\n def resized(self, top_frame, top_sys_btns, event):\n \"\"\"\n Called when window is resized.\n Calculates Y position of the border between TopFrame and DataFrame\n \"\"\"\n\n waterline = top_frame.y() + top_frame.height()\n self.top_system_frame_height = top_sys_btns.height()\n self.communication.resized.emit(self.width(), waterline, self.top_system_frame_height)\n\n def keyPressEvent(self, event):\n \"\"\"\n If key is Ctrl - toggle SelectItemMenu visibility.\n If key is Ctrl+Return - opens ReportFrame\n Emits signal.\n \"\"\"\n\n mods = event.modifiers()\n if mods & Qt.ControlModifier and self.frames_layout.currentIndex() == self.data_frame_index:\n if event.text() is '':\n self.communication.ctrl_hotkey.emit(True)\n return\n elif event.key() == Qt.Key_Return:\n self.communication.menu_btn_clicked.emit(self.data_frame_index + 1)\n\n def keyReleaseEvent(self, event):\n \"\"\"\n If key is Ctrl - toggle SelectItemMenu visibility.\n \"\"\"\n\n if event.text() is '':\n self.communication.ctrl_hotkey.emit(False)\n\n def close(self, event=None):\n \"\"\"\n Close the application\n \"\"\"\n\n QCoreApplication.instance().quit()\n\n def minimize(self, event=None):\n \"\"\"\n Minimize the application\n \"\"\"\n\n self.setWindowState(Qt.WindowMinimized)\n\n def excepthook(self, exctype, value, traceback):\n with open(options.LOG_FILE, 'a') as f:\n f.write('\\n{}\\n{}'.format(datetime.datetime.now(),\n '\\n'.join(trb.format_exception(exctype, value, traceback))))\n\n # self.create_alert('Произошла непредвиденная ошибка.\\n'\n # 'Попробуйте повторить действие, хотя это вряд ли поможет')\n self.create_alert('Um erro inesperado ocorreu.\\n'\n 'Tente repetir a ação, embora seja improvável que isso ajude.')\n\n\ndef init(bootstrap_function):\n \"\"\"\n Init gui.\n Concat all files from style directory and apply stylesheet.\n Run `bootstrap_function` to prepare app.\n \"\"\"\n app = QApplication(sys.argv)\n app.setWindowIcon(QIcon(os.path.join(options.STATIC_DIR, 'splash.png')))\n splash_img = QPixmap(os.path.join(options.STATIC_DIR, 'splash.png'))\n splash = QSplashScreen(splash_img)\n splash.show()\n app.processEvents()\n\n items = bootstrap_function()\n\n style = []\n style_dir = os.path.join(options.STATIC_DIR, 'style')\n for f in os.listdir(style_dir):\n if not f.endswith('.qss'):\n continue\n with open(os.path.join(style_dir, f), 'r') as qss:\n style.append(qss.read())\n app.setStyleSheet('\\n'.join(style))\n\n mw = MainWindow(items)\n splash.finish(mw)\n\n sys.excepthook = mw.excepthook\n sys.exit(app.exec_())\n" }, { "alpha_fraction": 0.5136363506317139, "alphanum_fraction": 0.5348485112190247, "avg_line_length": 26.5, "blob_id": "ac8ed12eb811527e51afd09692bec9ef92524df2", "content_id": "a8206ba27bc5af1245ac780dc93e4cb6848ae984", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2640, "license_type": "no_license", "max_line_length": 107, "num_lines": 96, "path": "/fullcontrol_001/mata-velhos.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/python3\n\nimport sys\nimport subprocess\nimport argparse\nimport re\nimport os\nfrom operator import itemgetter\n\ndef isTime(time):\n \"\"\"Verifica se e uma Hora valida\"\"\"\n if not re.match(r'^(0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$', time):\n return(False)\n return(True)\n\ndef get_arguments():\n parser = argparse.ArgumentParser(description = 'Mata processos antigos')\n parser.add_argument('-k', '--kill', dest='simnao', help='Mata os processosi sim ou nao', required=True)\n parser.add_argument('-t', '--tempo', dest='tempo', help='Tempo sem atividade', required=True)\n options = parser.parse_args()\n return options\n\ndef separa(a, tam):\n lista = []\n b = []\n for i, l in enumerate(a):\n if i > 1:\n if i / tam == i // tam:\n lista.append(b)\n b = []\n b.append(l)\n lista.append(b)\n return(lista)\n\ndef pegaprocessos(tempo):\n with subprocess.Popen(['who', '-u'], stdout=subprocess.PIPE) as proc:\n a = proc.stdout.read().decode('utf-8').split()\n li = separa(a, 7)\n li.sort(key=itemgetter(4))\n lista=[]\n for l in li:\n if len(l[4]) > 2:\n if l[4] == 'antigo':\n lista.append(l)\n else:\n t = int(l[4][:2]) * 60 + int(l[4][-2:])\n if t > tempo:\n lista.append(l) \n return(lista)\n\ndef pegasubprocessos(lista):\n slista = []\n for l in lista:\n with subprocess.Popen(['ps', '-t', l[1]], stdout=subprocess.PIPE) as proc:\n a = proc.stdout.read().decode('utf-8').split()\n\n li = separa(a, 4)\n slista.append('Usuario {} => {}'.format(l[0], l[4]))\n# print('Usuario {} => {}'.format(l[0], l[4]))\n for l in reversed(li):\n if l[0] != 'PID':\n# print(l)\n slista.append(l)\n return(slista)\n\noptions = get_arguments()\n\nkill = options.simnao.lower()\nif kill == 'sim':\n if os.getuid() != 0:\n print('Must be root to run this program!')\n exit(-1)\n\nif not isTime(options.tempo):\n print('Precisa ser uma hora valida, exemplo: 01:45')\n exit(-1)\n \ntempo = int(options.tempo[:2]) * 60 + int(options.tempo[-2:])\n\nlista = pegaprocessos(tempo)\nslista = pegasubprocessos(lista)\n\n# print(slista)\nconta = 0 \nfor l in slista:\n if isinstance(l, str):\n conta += 1\n print(l)\n else:\n if kill == 'sim':\n subprocess.Popen(['kill', '-9', l[0]], stdout=subprocess.PIPE)\n print(l[0]+' '+l[1]+' '+l[3]+' ==> morto!')\n else:\n print(l[0]+' '+l[1]+' '+l[3])\n\nprint('\\nNumero de usuarios {}.'.format(conta))\n" }, { "alpha_fraction": 0.4251485764980316, "alphanum_fraction": 0.4422362446784973, "avg_line_length": 35.876712799072266, "blob_id": "3a54d957890f2c6adcf0f9e2fd60aad5dce8835c", "content_id": "b78e31e2d65150acf3048719b49be244d4879806", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 5384, "license_type": "no_license", "max_line_length": 77, "num_lines": 146, "path": "/fullcontrol-menu/menu.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import sys\nimport csv\nfrom PyQt5.QtWidgets import QApplication, QMainWindow, QAction, qApp\n\nmenu_l0 = []\nmenu_l1 = []\nmenu_l2 = []\nmenu_l3 = []\nmenu_l4 = []\naction = []\nactiot = []\n\n\nclass Menu(QMainWindow):\n def __init__(self):\n super().__init__()\n\n # Create Menu Bar\n bar = self.menuBar()\n\n csvfile = open('1linha.csv', 'r')\n\n fieldnames = ('nivel', 'funcao', 'int', 'sep', 'opcao', 'prog')\n reader = csv.DictReader(csvfile, fieldnames, delimiter=';')\n\n for row in reader:\n # input(row['opcao'])\n if row['int'] == ' ':\n if row['nivel'] == '0':\n if row['sep'] == '[':\n menu_l0[-1].addSeparator()\n menu_l0.append(bar.addMenu(row['opcao'].strip()))\n elif row['nivel'] == '1':\n if row['sep'] == '[':\n menu_l1[-1].addSeparator()\n menu_l1.append(menu_l0[-1].addMenu(row['opcao'].strip()))\n elif row['nivel'] == '2':\n if row['sep'] == '[':\n menu_l2[-1].addSeparator()\n menu_l2.append(menu_l1[-1].addMenu(row['opcao'].strip()))\n elif row['nivel'] == '3':\n if row['sep'] == '[':\n menu_l3[-1].addSeparator()\n menu_l3.append(menu_l2[-1].addMenu(row['opcao'].strip()))\n elif row['nivel'] == '4':\n if row['sep'] == '[':\n menu_l4[-1].addSeparator()\n menu_l4.append(menu_l3[-1].addMenu(row['opcao'].strip()))\n else:\n if row['nivel'] == '1':\n if row['sep'] == '[':\n menu_l0[-1].addSeparator()\n action.append(QAction(row['opcao'].strip(), self))\n actiot.append(row['opcao'].strip())\n menu_l0[-1].addAction(action[-1])\n menu_l0[-1].triggered.connect(self.selected)\n for l in action:\n print('l ==> ' + l.text())\n elif row['nivel'] == '2':\n if row['sep'] == '[':\n menu_l1[-1].addSeparator()\n action.append(QAction(row['opcao'].strip(), self))\n actiot.append(row['opcao'].strip())\n menu_l1[-1].addAction(action[-1])\n menu_l1[-1].triggered.connect(self.selected)\n for l in action:\n print('l ==> ' + l.text())\n elif row['nivel'] == '3':\n if row['sep'] == '[':\n menu_l2[-1].addSeparator()\n action.append(QAction(row['opcao'].strip(), self))\n actiot.append(row['opcao'].strip())\n menu_l2[-1].addAction(action[-1])\n menu_l2[-1].triggered.connect(self.selected)\n for l in action:\n print('l ==> ' + l.text())\n elif row['nivel'] == '4':\n if row['sep'] == '[':\n menu_l3[-1].addSeparator()\n action.append(QAction(row['opcao'].strip(), self))\n actiot.append(row['opcao'].strip())\n menu_l3[-1].addAction(action[-1])\n menu_l3[-1].triggered.connect(self.selected)\n for l in action:\n print('l ==> ' + l.text())\n elif row['nivel'] == '5':\n if row['sep'] == '[':\n menu_l4[-1].addSeparator()\n action.append(QAction(row['opcao'].strip(), self))\n actiot.append(row['opcao'].strip())\n menu_l4[-1].addAction(action[-1])\n menu_l4[-1].triggered.connect(self.selected)\n for l in action:\n print('l ==> ' + l.text())\n # if action[-1].text() == '&DIPJ IPI (Ficha 32,33,34 e 35)':\n # print(action[-1].text())\n # i = i + 1\n # print(i)\n\n # Create Root Menus\n file = bar.addMenu('File')\n edit = bar.addMenu('Edit')\n\n # Create Actions for menus\n save_action = QAction('Save', self)\n save_action.setShortcut('Ctrl+S')\n\n new_action = QAction('New', self)\n new_action.setShortcut('Ctrl+N')\n\n quit_action = QAction('&Quit', self)\n quit_action.setShortcut('Ctrl+Q')\n\n find_action = QAction('Find...', self)\n\n replace_action = QAction('Replace...', self)\n\n # Add actions to Menus\n file.addAction(new_action)\n file.addAction(save_action)\n file.addAction(quit_action)\n find_menu = edit.addMenu('Find')\n find_menu.addAction(find_action)\n find_menu.addAction(replace_action)\n\n # Events\n quit_action.triggered.connect(self.quit_trigger)\n file.triggered.connect(self.selected)\n\n self.setWindowTitle(\"My Menus\")\n self.resize(600, 400)\n\n self.show()\n\n def quit_trigger(self):\n qApp.quit()\n\n def selected(self, q):\n\n print(q.text() + ' selected')\n\n\napp = QApplication(sys.argv)\napp.setStyle('WindowsVista')\nmenus = Menu()\nsys.exit(app.exec_())\n" }, { "alpha_fraction": 0.7807089686393738, "alphanum_fraction": 0.7848309874534607, "avg_line_length": 66.38888549804688, "blob_id": "49743cd738b7a134f84bf72b7008ea11d98599c6", "content_id": "16a7349d5e3c43fb665f0f96eff5afbbe9ed2ff5", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 1228, "license_type": "permissive", "max_line_length": 397, "num_lines": 18, "path": "/opencv/RealidadeAumentada-master/README.md", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "# Realidade Aumentada\n\n#### Projeto para disciplina de Visão Computacional (Insper 2018)\n\n## Resumo\n\nPara o projeto do arco final da disciplina de Visão Computacional, era esperado o desenvolvimento de um programa capaz de perceber um tabuleiro _ArUco_ (ou _ChArUco_).\n\nO programa (`main.py`) substitui o conteúdo deste tabuleiro por uma imagem escolhida, rotacionando-a, mudando sua angulação e fazendo qualquer outra transformação necessária para manter a imagem o mais realista possível no campo relativo a este tabuleiro.\n\n## Uso\n\nNa raíz do repositório existe uma `Pipfile`, a qual contem as dependências do projeto e pode ser utilizada em conjunto com o [pipenv](https://github.com/pypa/pipenv) para lidar com estas dependências.\n\nIsso resolvido, basta executar o arquivo `main.py`. Adicionalmente, o mesmo possui 2 argumentos opcionais de linha de comando, o `--image` que aceita uma imagem para substituir o tabuleiro, o `--board` que aceita a imagem de um tabuleiro a ser definida como o padrão (deve ser identico ao utilizado) e o `--save` é uma flag se o programa deve salvar uma foto do executado (como no exemplo abaixo).\n\n![realidade aumentada](marcadores/example.png)\nExemplo de resultado esperado\n" }, { "alpha_fraction": 0.38977423310279846, "alphanum_fraction": 0.39707836508750916, "avg_line_length": 29.693878173828125, "blob_id": "3f40dba00147e7c6e24fb61eab60c0fc31001e99", "content_id": "a8e30377a2a071850aa1a10d4352e5e292cbfabf", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1508, "license_type": "no_license", "max_line_length": 86, "num_lines": 49, "path": "/pp/csvtojson.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import csv\n\ncsvfile = open('Pasta1.csv', 'r')\ncsvfiln = open('Pasta1-ok.csv', 'w')\n\n# fieldnames = ('Centro', 'Material', 'Descrição do Material', 'sep', 'opcao', 'prog')\n# reader = csv.DictReader(csvfile, fieldnames, delimiter=';')\nreader = csv.DictReader(csvfile, delimiter=';')\nc = 0\nCentro = ''\nMaterial = ''\nDescricao = ''\nCodigo = ''\ntt = ''\nfor row in reader:\n if ((tt == '') or (tt == row['tt'])):\n Centro = row['Centro']\n Material = row['Material']\n Descricao = row['Descricao']\n Codigo = row['Codigo SKF']\n tt = row['tt']\n csvfiln.write(row['Centro'] + ';' +\n row['Material'] + ';' +\n row['Descricao'] + ';' +\n row['Codigo SKF'] + ';' +\n row['tt'] + ';;' +\n chr(13))\n else:\n c = c + 1\n print(tt, c)\n csvfiln.write(';' +\n ';' +\n ';' +\n ';' +\n ';' +\n str(c) + chr(13))\n if (Codigo != row['Codigo SKF']):\n c = 0\n Centro = row['Centro']\n Material = row['Material']\n Descricao = row['Descricao']\n Codigo = row['Codigo SKF']\n tt = row['tt']\n csvfiln.write(row['Centro'] + ';' +\n row['Material'] + ';' +\n row['Descricao'] + ';' +\n row['Codigo SKF'] + ';' +\n row['tt'] + ';;' +\n chr(13))\n\n\n" }, { "alpha_fraction": 0.6811846494674683, "alphanum_fraction": 0.6898954510688782, "avg_line_length": 29.210525512695312, "blob_id": "a912359f0b64bf5124a4167df365ff22bbc3d522", "content_id": "f7678e24fa1d0465ff6f1a465f49cda6cb2b256c", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 574, "license_type": "no_license", "max_line_length": 81, "num_lines": 19, "path": "/dados/pd-001.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport pandas as pd\nimport matplotlib.pyplot as plt\n\n# dataset = pd.read_csv('pda_unidades_rf_epct_csv.csv', sep=',')\ndataset = pd.read_csv('pda_unidades_rf_epct_csv.csv', sep=';', encoding='cp1252')\n# print(type(dataset))\n# print(dataset.head())\n# print(dataset.columns)\n# print(dataset.count())\n\n# print(dataset['NOME_REGIAO_UNIDADE'].value_counts())\n# print(dataset['SIGLA_UF_UNIDADE'].value_counts())\n\n# dataset['SIGLA_UF_UNIDADE'].value_counts().plot.bar()\ndataset['SIGLA_UF_UNIDADE'].value_counts().plot.pie()\nplt.show()\n" }, { "alpha_fraction": 0.5209125280380249, "alphanum_fraction": 0.536121666431427, "avg_line_length": 16.600000381469727, "blob_id": "abf49c399933769a60fb9f4ce5e1ff897aebaa8a", "content_id": "89f11ce24bec6b7318c611248c3919cb23e395d2", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 263, "license_type": "no_license", "max_line_length": 46, "num_lines": 15, "path": "/cerrado/decorators-001.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "def debugger(func):\n def decorated_func(x):\n result = func(x)\n print(f'{func.__name__}({x}) = {result}')\n return result\n \n return decorated_func\n \n \n@debugger\ndef fib(n):\n if n <= 1:\n return 1\n else:\n return fib(n - 1) + fib(n - 2)" }, { "alpha_fraction": 0.5454545617103577, "alphanum_fraction": 0.5454545617103577, "avg_line_length": 13.125, "blob_id": "ed7adffd1b9c6db10a5b1f6b70e66e4021795522", "content_id": "4e56c3162abfc1d1c38090419d6f2a8664c49b57", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 121, "license_type": "no_license", "max_line_length": 20, "num_lines": 8, "path": "/cerrado/shellreverso/server.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import socket\nimport sys\n\ndef create_socket():\n try:\n global host\n global port\n global s\n " }, { "alpha_fraction": 0.5835999846458435, "alphanum_fraction": 0.593999981880188, "avg_line_length": 29.108434677124023, "blob_id": "ea615c4cf0a57474f8fa8e9c8fe2a08f0d5c0151", "content_id": "dc78668c15418b295c0a1123ff39c4c21b7e4bd0", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2500, "license_type": "no_license", "max_line_length": 132, "num_lines": 83, "path": "/full - compara relatorios/cria_sqla.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import os\nimport csv\nimport sqlite3\nfrom sqlalchemy import create_engine, Table, Column, MetaData\nfrom sqlalchemy import Integer, Float, CHAR\nfrom sqlalchemy.orm import sessionmaker, mapper\nfrom sqlalchemy.engine.url import URL\n\ncsvC = 'b-co.csv'\ncsvF = 'b-fi-v.csv'\n\n_url = 'sqlite:///compara.db3'\n### para conexao no firebird\n# _url = URL('firebird', 'SYSDBA', 'masterkey', '192.168.1.11', '3052', 'bdband')\n### para conexao no mysql\n# _url = 'mysql://usuario:senha@servidor/banco'\n\n# cria o engine e metadata\nengine = create_engine(_url, echo=True)\nmetadata = MetaData(bind=engine)\n\n#cria as tabelas\ntb_arqC = Table('arqC', metadata,\n Column('numero', Integer(), primary_key=True, nullable=False),\n Column('valor', Float()),\n Column('achou', CHAR())\n )\n\ntb_arqF = Table('arqF', metadata,\n Column('numero', Integer(), primary_key=True, nullable=False),\n Column('item', Integer(), primary_key=True, nullable=False),\n Column('valor', Float()),\n Column('achou', CHAR())\n )\n\n#cria as classes\nclass arqC(object):\n def __init__(self, numero, valor, achou=' '):\n self.numero = numero\n self.valor = valor\n self.achou = achou\n\nclass arqF(object):\n def __init__(self, numero, item, valor, achou=' '):\n self.numero = numero\n self.item = item\n self.valor = valor\n self.achou = achou\n\n# mapeia a classe -> tabela\nmapper(arqC, tb_arqC)\nmapper(arqF, tb_arqF)\n\n#cria as tabelas no banco (caso nao existam)\nmetadata.create_all()\n\n#cria o sessionmaker\nSession = sessionmaker(bind=engine)\n\ns = Session()\n\ninsert_query = tb_arqC.insert()\nwith open(csvC, 'r') as csvfile:\n csv_reader = csv.reader(csvfile, delimiter='|')\n next(csv_reader)\n engine.execute(\n insert_query,\n [{'numero': int(row[2].strip()), \n 'valor': row[8].strip().replace('.', '').replace(',','.') if row[8].strip().replace('.', '').replace(',','.') else '0.0', \n 'achou': ' '} for row in csv_reader]\n )\n\ninsert_query = tb_arqF.insert()\nwith open(csvF, 'r') as csvfile:\n csv_reader = csv.reader(csvfile, delimiter='|')\n next(csv_reader)\n engine.execute(\n insert_query,\n [{'numero': int(row[3].strip()), \n 'item': int(row[4].strip()), \n 'valor': row[5].strip().replace('.', '').replace(',','.') if row[5].strip().replace('.', '').replace(',','.') else '0.0', \n 'achou': ' '} for row in csv_reader]\n )\n\n" }, { "alpha_fraction": 0.7175140976905823, "alphanum_fraction": 0.7299435138702393, "avg_line_length": 22.3157901763916, "blob_id": "2c7929bcc2b2568bd5853c7bcbc0a524e46b5d69", "content_id": "080b639f580578f95a5968697167d1d19f09074c", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 893, "license_type": "no_license", "max_line_length": 79, "num_lines": 38, "path": "/pong1/main.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "from kivy.uix.widget import Widget\nfrom kivy.app import App\nfrom kivy.config import Config\nfrom kivy.uix.screenmanager import ScreenManager, Screen\n\n# Carrega a configuração\nConfig.read(\"config.ini\")\n\n# Gerenciador de telas\nscreen_manager = ScreenManager()\n\n# Criação das telas\ntela_1 = Screen(name='Tela 1')\ntela_2 = Screen(name='Tela 2')\n\n# Declara a Tela do Vencedor 1\nclass TelaVencedor1(Screen):\n pass\n\n# Adiciona as telas ao ScreenManager\nscreen_manager.add_widget(tela_1)\nscreen_manager.add_widget(tela_2)\n\n# Por padrão, a primeira tela adicionada será aquela mostrada pelo gerenciador.\n# Para mudar para, por exemplo, a tela 2, utilizamos o parâmetro name:\nscreen_manager.current = 'Tela 2'\n\n# Nesse momento, a Tela 2 será mostrada!\n\nclass Pong(Widget):\n pass\n\nclass PongApp(App):\n def build(self):\n return Pong()\n\nif __name__ == '__main__':\n PongApp().run()" }, { "alpha_fraction": 0.8181818127632141, "alphanum_fraction": 0.8311688303947449, "avg_line_length": 14.600000381469727, "blob_id": "7896a42ca615976da2cbf9feae50508998d7ba88", "content_id": "8180f9dfe6f3deb7f79c2ceca531b8183c5b93b1", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "INI", "length_bytes": 77, "license_type": "no_license", "max_line_length": 29, "num_lines": 5, "path": "/fullcontrol-menu/.pylintrc", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "[MASTER]\nextension-pkg-whitelist=PyQt5\n\n[TYPECHECK]\ndisable=missing-docstring" }, { "alpha_fraction": 0.5271428823471069, "alphanum_fraction": 0.5614285469055176, "avg_line_length": 21.580644607543945, "blob_id": "565ee39ebaf657433e0306241b5803a75bf88c96", "content_id": "bed734ea4452c9429a5f5a0b7406be67c4cafa24", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 701, "license_type": "no_license", "max_line_length": 59, "num_lines": 31, "path": "/nfe-txt/le-layout.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import sys\nimport csv\n\n\ndef cria_lista(arq):\n lista = []\n with open(arq, newline=\"\") as csvfile:\n spamreader = csv.reader(csvfile, delimiter=\"|\")\n for linha in spamreader:\n lista.append(linha)\n return lista\n\n\ndef in_list(item, L):\n for i in L:\n if item in i:\n return L.index(i)\n return -1\n\n\nlista_layout = cria_lista(\"layout.txt\")\nlista_nfe = cria_lista(\"413034_001_001_06_08_2018-nfe.txt\")\n\nfor l in lista_nfe:\n r = in_list(l[0], lista_layout)\n if r >=0:\n for p in range(len(lista_layout[r])):\n print(lista_layout[r][p], \": \", l[p], end=\", \")\n print()\n else:\n print('Elemento não encontrado:', l[0])\n" }, { "alpha_fraction": 0.6525821685791016, "alphanum_fraction": 0.6525821685791016, "avg_line_length": 25.625, "blob_id": "635dfcb35d802260b9e3e71b444f96857c08a3e5", "content_id": "58b66b27267d7e5d52a2d5637b179540dbaa46f6", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 213, "license_type": "no_license", "max_line_length": 56, "num_lines": 8, "path": "/curso-hack/list_cards.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import ifaddr\n\nadapters = ifaddr.get_adapters()\n\nfor adapter in adapters:\n print(\"IPs of network adapter \" + adapter.nice_name)\n for ip in adapter.ips:\n print(\" %s/%s\" % (ip.ip, ip.network_prefix))\n" }, { "alpha_fraction": 0.5951645970344543, "alphanum_fraction": 0.5972222089767456, "avg_line_length": 27.173913955688477, "blob_id": "ee524788809aa5f4a13cc96b17bb05e2b1161ab8", "content_id": "2d43156b142b7fedb3852104bfe06b581ccc78a0", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1950, "license_type": "no_license", "max_line_length": 103, "num_lines": 69, "path": "/Hospital-Helper-2-master/app/gui/alert_widget.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import functools\n\nfrom PyQt5.QtCore import Qt\nfrom PyQt5.QtWidgets import QFrame, QPushButton, QLabel, QVBoxLayout, QHBoxLayout\n\nfrom app.gui import utils\n\n\nclass AlertWidget(QFrame):\n\n \"\"\"\n Wrapper for AlertWidgetContent.\n Shadows the application.\n \"\"\"\n\n def __init__(self, main_window, text, callback=None):\n super().__init__(main_window)\n self.setFixedSize(main_window.size())\n self.show()\n self.move(self.x(), main_window.top_system_frame_height)\n self.raise_()\n AlertWidgetContent(self, main_window, text, callback)\n\n\nclass AlertWidgetContent(QFrame):\n\n def __init__(self, parent, main_window, text, callback=None):\n\n \"\"\"\n Widget for alert messages.\n Also can be user to ask user about something.\n In this case it calls `callback` function with boolean value.\n \"\"\"\n\n super().__init__(parent)\n\n self._close = self._get_close_func(parent, callback)\n\n vbox = QVBoxLayout()\n l = QLabel(text)\n l.setAlignment(Qt.AlignCenter)\n vbox.addWidget(l)\n vbox.addStretch()\n\n hbox = QHBoxLayout()\n b = QPushButton('Ok')\n b.clicked.connect(functools.partial(self._close, True))\n hbox.addWidget(b)\n if callback:\n hbox.addStretch()\n # b = QPushButton('Отмена')\n b = QPushButton('Cancelar')\n b.clicked.connect(functools.partial(self._close, False))\n hbox.addWidget(b)\n\n vbox.addLayout(hbox)\n self.setLayout(vbox)\n self.show()\n self.raise_()\n self.move((main_window.width() - self.width()) / 2, (main_window.height() - self.height()) / 2)\n self.setGraphicsEffect(utils.get_shadow())\n\n @staticmethod\n def _get_close_func(parent, callback):\n def _close(value):\n if callback:\n callback(value)\n parent.deleteLater()\n return _close\n" }, { "alpha_fraction": 0.49340370297431946, "alphanum_fraction": 0.5171504020690918, "avg_line_length": 41.11111068725586, "blob_id": "5e099d3bd247e1a35116de6c36cdbe093bb85b57", "content_id": "dd31bce0e259bd6d65bbda5ba372f68cee07d15e", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 379, "license_type": "no_license", "max_line_length": 107, "num_lines": 9, "path": "/fullcontrol-/aj.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "\nwith open('aicup026.sql', 'r') as fsql:\n esql = fsql.readline().strip().replace('TABCUBO', 'aicup026').replace(\"' \", \"'\").replace(\" '\", \"'\")\n a = esql.split(' ').split(',')\n print(a)\n a = input()\n while esql:\n print(esql)\n esql = fsql.readline().strip().replace('TABCUBO', 'aicup026').replace(\"' \", \"'\").replace(\" '\", \"'\")\n a = input('teste')" }, { "alpha_fraction": 0.517370879650116, "alphanum_fraction": 0.5230047106742859, "avg_line_length": 20.755102157592773, "blob_id": "5a9c390d11b923907f2941c2fea9cb818e82bcb3", "content_id": "4ef362ce4c507e4faa310d46394d37993acf2cf6", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1065, "license_type": "no_license", "max_line_length": 42, "num_lines": 49, "path": "/PQt5-Stock/Modelo/direccion.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nclass Direccion():\n def __init__(self):\n self.__idDireccion = 0\n self.__direccion = \"\"\n self.__numero = 0\n self.__piso = 0\n self.__dpto = \"\"\n\n def setIdDireccion(self, idDireccion):\n self.__idDireccion = idDireccion\n\n def getIdDireccion(self):\n return self.__idDireccion\n\n def setDireccion(self, direccion):\n self.__direccion = direccion\n\n def getDireccion(self):\n return self.__direccion\n\n def setNumero(self, numero):\n self.__numero = numero\n\n def getNumero(self):\n if self.__numero != 0:\n return self.__numero\n else:\n return None\n\n def setPiso(self, piso):\n self.__piso = piso\n\n def getPiso(self):\n if self.__piso != 0:\n return self.__piso\n else:\n return None\n\n def setDpto(self, dpto):\n self.__dpto = dpto\n\n def getDpto(self):\n if self.__dpto != \"\":\n return self.__dpto\n else:\n return None" }, { "alpha_fraction": 0.6379928588867188, "alphanum_fraction": 0.6496415734291077, "avg_line_length": 26.219512939453125, "blob_id": "525c000f1a515f62d0445815e996ea96552cd542", "content_id": "5af68a0192048ac6eb2d83bd2ef2441cf2d454a1", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1116, "license_type": "no_license", "max_line_length": 91, "num_lines": 41, "path": "/qt/top_frame.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import functools\n\nfrom PyQt5.QtWidgets import (QFrame, QVBoxLayout, QHBoxLayout, QLabel)\n\nfrom top_system_buttons import TopSystemButtons\n# from app.gui.select_menu import SelectMenu\nimport utils\n\n\nclass TopFrame(QFrame):\n\n \"\"\"\n Top Frame with decorative elements\n \"\"\"\n\n def __init__(self, main_window, items):\n super().__init__()\n\n vbox = QVBoxLayout()\n vbox.setSpacing(0)\n vbox.setContentsMargins(0, 0, 0, 0)\n self.setLayout(vbox)\n\n top_system_buttons = TopSystemButtons(main_window)\n vbox.addWidget(top_system_buttons)\n vbox.addStretch()\n hbox = QHBoxLayout()\n hbox.addSpacing(25)\n hbox.setSpacing(0)\n hbox.setContentsMargins(0, 0, 0, 0)\n vbox.addLayout(hbox)\n\n l = QLabel()\n hbox.addWidget(l)\n vbox.addStretch()\n # vbox.addWidget(SelectMenu(main_window, items))\n\n main_window.communication.input_changed_signal.connect(l.setText)\n self.resizeEvent = functools.partial(main_window.resized, self, top_system_buttons)\n\n self.setGraphicsEffect(utils.get_shadow())\n" }, { "alpha_fraction": 0.6549295783042908, "alphanum_fraction": 0.6577799916267395, "avg_line_length": 38.50331115722656, "blob_id": "00b9e2cb58d2b94613f34280dfd8b5929d9c8dc8", "content_id": "d04a8ac53de636a524ec5991fb23b47f64918c46", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 5964, "license_type": "no_license", "max_line_length": 102, "num_lines": 151, "path": "/PQt5-Stock/Controlador/windowMarca.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nimport sys\n\nfrom PyQt5 import uic\nfrom Modelo.marca import Marca\nfrom Conexion.conexionMarca import conexionMarca\nfrom Componentes.tableModel import MyTableModel\nfrom PyQt5.QtWidgets import QTableView, QAbstractItemView, QWidget\nfrom Modelo.telefono import Telefono\nfrom PyQt5.QtWidgets import QMessageBox, QDialog\n\nclass windowMarca():\n\n def __init__(self):\n\n self.winMarca = uic.loadUi('Vista/abmMarca.ui')\n\n #Configurando botones\n self.marca = Marca()\n self.conexionMarca = conexionMarca()\n\n\n self.winMarca.btnGuardar_m.clicked.connect(self.onClickGuardar_m)\n self.winMarca.btnModificar_m.clicked.connect(self.onClickModificar_m)\n self.winMarca.btnBorrar_m.clicked.connect(self.onClickBorrar_m)\n self.winMarca.btnAgregar_m.clicked.connect(self.onClickAgregar_m)\n\n self.winMarca.txtFilterMarcas_m.returnPressed.connect(self.search)\n\n self.winMarca.tvMarcas_m.setSortingEnabled(True)\n self.winMarca.tvMarcas_m.setMouseTracking(True)\n self.winMarca.tvMarcas_m.setSelectionBehavior(QAbstractItemView.SelectRows)\n\n self.winMarca.exec()\n\n def search(self):\n if self.winMarca.txtFilterMarcas_m.hasFocus() is True:\n self.cargarTabla()\n\n def onClickGuardar_m(self):\n\n if self.winMarca.txtDescripcion_m.text() != \"\":\n\n self.marca.setMarca(self.winMarca.txtDescripcion_m.text())\n\n if self.estado == 'AGREGAR':\n self.insertMarca()\n elif self.estado == 'MODIFICAR':\n self.modificarMarca()\n else:\n print(\"Falta ingresar la descripcion\")\n alert = QDialog()\n QMessageBox.information(alert,\"ERROR\", \"Falta ingresar la descripcion\")\n\n self.validarBotones(button='GUARDAR')\n\n def onClickAgregar_m(self):\n self.estado = 'AGREGAR'\n self.validarBotones(button='AGREGAR')\n\n def onClickModificar_m(self):\n self.estado='MODIFICAR'\n self.validarBotones(button='MODIFICAR')\n\n def onClickBorrar_m(self):\n if self.marca.getIdMarca() != 0 and self.winMarca.btnGuardar_m.isEnabled() != True:\n self.conexionMarca.borrarMarca(self.marca)\n self.cargarTabla()\n self.validarBotones(button='BORRAR')\n\n def cargarTabla(self):\n textFilter = self.winMarca.txtFilterMarcas_m.text()\n listaMarcas = self.conexionMarca.selectMarca(textFilter)\n if len(listaMarcas) > 0:\n #Creo la cabecera\n header = ['ID', 'Marca']\n #Creo el modelo\n self.tablaModel = MyTableModel(self.winMarca.tvMarcas_m, listaMarcas, header)\n #Seteo el modelo\n self.winMarca.tvMarcas_m.setModel(self.tablaModel)\n self.winMarca.tvMarcas_m.selectionModel().currentChanged.connect(self.changeSelectedTable)\n\n self.winMarca.tvMarcas_m.setColumnHidden(0, True)\n self.winMarca.tvMarcas_m.setColumnWidth(1, 245)\n else:\n self.winMarca.tvMarcas_m.setModel(None)\n\n def changeSelectedTable(self, selected, deselected):\n self.winMarca.tvMarcas_m.selectRow(selected.row())\n\n marcaList = selected.model().mylist\n marcaSelected = marcaList[selected.row()]\n\n self.marca = Marca()\n self.marca.setIdMarca(int(marcaSelected[0]))\n self.marca.setMarca(str(marcaSelected[1]))\n\n self.winMarca.tvMarcas_m.setRowHeight(deselected.row(), 33)\n self.winMarca.tvMarcas_m.setRowHeight(selected.row(), 45)\n\n self.winMarca.txtDescripcion_m.setText(self.marca.getMarca())\n self.winMarca.btnModificar_m.setEnabled(True)\n self.winMarca.btnBorrar_m.setEnabled(True)\n\n def validarBotones(self, button):\n if button == 'AGREGAR':\n self.winMarca.btnModificar_m.setEnabled(False)\n self.winMarca.btnAgregar_m.setEnabled(False)\n self.winMarca.btnGuardar_m.setEnabled(True)\n self.winMarca.btnBorrar_m.setText('CANCELAR')\n self.winMarca.btnBorrar_m.setEnabled(True)\n self.winMarca.tvMarcas_m.setEnabled(False)\n self.winMarca.txtDescripcion_m.setText('')\n self.winMarca.txtDescripcion_m.setEnabled(True)\n elif button == 'GUARDAR':\n self.winMarca.btnModificar_m.setEnabled(False)\n self.winMarca.btnAgregar_m.setEnabled(True)\n self.winMarca.btnGuardar_m.setEnabled(False)\n self.winMarca.btnBorrar_m.setText('BORRAR')\n self.winMarca.btnBorrar_m.setEnabled(False)\n self.winMarca.tvMarcas_m.setEnabled(True)\n self.winMarca.txtDescripcion_m.setText('')\n self.winMarca.txtDescripcion_m.setEnabled(False)\n elif button == 'MODIFICAR':\n self.winMarca.btnModificar_m.setEnabled(False)\n self.winMarca.btnAgregar_m.setEnabled(False)\n self.winMarca.btnGuardar_m.setEnabled(True)\n self.winMarca.btnBorrar_m.setText('CANCELAR')\n self.winMarca.btnBorrar_m.setEnabled(True)\n self.winMarca.tvMarcas_m.setEnabled(False)\n self.winMarca.txtDescripcion_m.setEnabled(True)\n elif button == 'BORRAR':\n self.winMarca.btnModificar_m.setEnabled(False)\n self.winMarca.btnAgregar_m.setEnabled(True)\n self.winMarca.btnGuardar_m.setEnabled(False)\n self.winMarca.btnBorrar_m.setText('BORRAR')\n self.winMarca.btnBorrar_m.setEnabled(False)\n self.winMarca.tvMarcas_m.setEnabled(True)\n self.winMarca.txtDescripcion_m.setText('')\n self.winMarca.txtDescripcion_m.setEnabled(False)\n\n def insertMarca(self):\n if self.marca:\n self.conexionMarca.insertMarca(self.marca)\n self.cargarTabla()\n\n def modificarMarca(self):\n if self.marca:\n self.conexionMarca.modificarMarca(self.marca)\n self.cargarTabla()" }, { "alpha_fraction": 0.6188717484474182, "alphanum_fraction": 0.6522347927093506, "avg_line_length": 28.62264060974121, "blob_id": "c7031dbbfef0d7de8f5b7329121845efb19f2cf7", "content_id": "23e963c0a5358994c2e5e80704ea2480935f0fb6", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 7853, "license_type": "no_license", "max_line_length": 113, "num_lines": 265, "path": "/opencv/Augumented_Reality-master/opengl with blender/MainFile.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import serial\nimport time\nimport numpy as np\nimport cv2\nimport cv2.aruco as aruco\nimport math\nfrom OpenGL.GL import *\nfrom OpenGL.GLU import *\nfrom OpenGL.GLUT import *\nfrom PIL import Image\nimport pygame\nfrom objloader import *\n\n\ntexture_object = None\ntexture_background = None\ncamera_matrix = None\ndist_coeff = None\ncounter=0\ncap = cv2.VideoCapture(0)\ncrow = None\nground = None\npebbles=None\npot=None\npaths=\" \"\n\nINVERSE_MATRIX = np.array([[ 1.0, 1.0, 1.0, 1.0],\n\t\t\t [-1.0,-1.0,-1.0,-1.0],\n\t\t\t [-1.0,-1.0,-1.0,-1.0],\n\t\t\t [ 1.0, 1.0, 1.0, 1.0]])\n\n\n################## Define Utility Functions Here #######################\n\"\"\"\nFunction Name : getCameraMatrix()\nInput: None\nOutput: camera_matrix, dist_coeff\nPurpose: Loads the camera calibration file and returns the camera and\n\t distortion matrix saved in the calibration file.\n\"\"\"\ndef getCameraMatrix():\n\tglobal camera_matrix, dist_coeff\n\twith np.load('Camera.npz') as X:\n\t\tcamera_matrix, dist_coeff, _, _ = [X[i] for i in ('mtx','dist','rvecs','tvecs')]\n\n\n\"\"\"\nFunction Name : main()\nInput: None\nOutput: None\nPurpose: Initialises OpenGL window and callback functions. Then starts the event\n\t processing loop.\n\"\"\" \ndef main():\n\tglutInit()\n\tgetCameraMatrix()\n\tglutInitWindowSize(640, 480)\n\tglutInitWindowPosition(625, 100)\n\tglutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE)\n\twindow_id = glutCreateWindow(\"OpenGL\")\n\tinit_gl()\n\tglutDisplayFunc(drawGLScene)\n\tglutIdleFunc(drawGLScene)\n\tglutReshapeFunc(resize)\n\tglutMainLoop()\n\n\"\"\"\nFunction Name : init_gl()\nInput: None\nOutput: None\nPurpose: Initialises various parameters related to OpenGL scene.\n\"\"\"\ndef init_gl():\n\tglobal texture_object, texture_background\n\tglobal crow\n\tglobal pebbles\n\tglobal pot\n\tglobal ground\n\tglClearColor(0.0, 0.0, 0.0, 0.0)\n\tglClearDepth(1.0) \n\tglDepthFunc(GL_ALWAYS)\n\tglEnable(GL_DEPTH_TEST)\n\tglShadeModel(GL_SMOOTH) \n\tglMatrixMode(GL_MODELVIEW)\n\tglEnable(GL_DEPTH_TEST)\n\tglEnable(GL_LIGHTING)\n\tglEnable(GL_LIGHT0)\n\ttexture_background = glGenTextures(1)\n\ttexture_object = glGenTextures(1)\n\tground = OBJ('ground.obj', swapyz=True)\n\tcrow = OBJ('crow.obj', swapyz=True)\n\tpot= OBJ('pot12.obj', swapyz=True)\n\tpebbles = OBJ('pebble5.obj', swapyz=True)\n\t\n\"\"\"\nFunction Name : resize()\nInput: None\nOutput: None\nPurpose: Initialises the projection matrix of OpenGL scene\n\"\"\"\ndef resize(w,h):\n\tratio = 1.0* w / h\n\tglMatrixMode(GL_PROJECTION)\n\tglViewport(0,0,w,h)\n\tgluPerspective(45, ratio, 0.1, 100.0)\n\t\n\n\"\"\"\nFunction Name : drawGLScene()\nInput: None\nOutput: None\nPurpose: It is the main callback function which is called again and\n\t again by the event processing loop. In this loop, the webcam frame\n\t is received and set as background for OpenGL scene. ArUco marker is\n\t detected in the webcam frame and 3D model is overlayed on the marker\n\t by calling the overlay() function.\n\"\"\"\ndef drawGLScene():\n\tglobal ser\n\tglClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)\n\tar_list = []\n\tret, frame = cap.read()\n\tif ret == True:\n\t\tdraw_background(frame)\n\t\tglMatrixMode(GL_MODELVIEW)\n\t\tglLoadIdentity()\n\t\tar_list = detect_markers(frame)\n\t\tfor i in ar_list:\n\t\t\toverlay(frame, ar_list, i[0])\t\n\t\tcv2.imshow('frame', frame)\n\t\tcv2.waitKey(1)\n\tglutSwapBuffers()\n\t\n########################################################################\n\n######################## Aruco Detection Function ######################\n\"\"\"\nFunction Name : detect_markers()\nInput: img (numpy array)\nOutput: aruco list in the form [(aruco_id_1, centre_1, rvec_1, tvec_1),(aruco_id_2,\n\tcentre_2, rvec_2, tvec_2), ()....]\nPurpose: This function takes the image in form of a numpy array, camera_matrix and\n\t distortion matrix as input and detects ArUco markers in the image. For each\n\t ArUco marker detected in image, paramters such as ID, centre coord, rvec\n\t and tvec are calculated and stored in a list in a prescribed format. The list\n\t is returned as output for the function\n\"\"\"\ndef detect_markers(img):\n\taruco_list = []\n\t################################################################\n\t#################### Same code as Task 1.1 #####################\n\t################################################################\n\t\n\tmarkerLength = 100\n\tgray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)\n\taruco_dict = aruco.Dictionary_get(aruco.DICT_5X5_250)\n\tparameters = aruco.DetectorParameters_create()\n\tcorners, ids, _ = aruco.detectMarkers(gray, aruco_dict, parameters = parameters)\n\trvec, tvec,_= aruco.estimatePoseSingleMarkers(corners, markerLength, camera_matrix, dist_coeff)\n\timg = aruco.drawDetectedMarkers(img, corners, ids)\n\tcentrecoord= []\n\tif ids is None:\n\t\treturn aruco_list\n\telse:\n\t\tL=len(ids)\n\t\n\tfor i in range(0,L):\n\t\tx=int(corners[i][0][0][0]+corners[i][0][1][0]+corners[i][0][3][0]+corners[i][0][2][0])/4\n\t\ty=int(corners[i][0][0][1]+corners[i][0][1][1]+corners[i][0][3][1]+corners[i][0][2][1])/4\n\t\tp=(x,y)\n\t\tcentrecoord.append(p)\n\tfor i in range(0,L):\n\t\tx=np.array(rvec[i],ndmin=3)\n\t\ty=np.array(tvec[i],ndmin=3)\n\t\tp=(ids[i][0],centrecoord[i],x,y)\n\t\taruco_list.append(p)\n\treturn aruco_list\n########################################################################\n\n\n################# This is where the magic happens !! ###################\n############### Complete these functions as directed ##################\n\"\"\"\nFunction Name : draw_background()\nInput: img (numpy array)\nOutput: None\nPurpose: Takes image as input and converts it into an OpenGL texture. That\n\t OpenGL texture is then set as background of the OpenGL scene\n\"\"\"\ndef draw_background(img):\n\timage1 = Image.fromarray(img)\n\twidth = image1.size[0]\n\theight = image1.size[1]\n\timggedata1 = image1.tobytes(\"raw\", \"BGRX\", 0, -1)\n\t\n\tglEnable(GL_TEXTURE_2D)\n\tglBindTexture(GL_TEXTURE_2D, texture_background)\n\tglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST)\n\tglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST)\n\tglTexImage2D(GL_TEXTURE_2D, 0,GL_RGB, width, height,0, GL_RGBA, GL_UNSIGNED_BYTE, imggedata1)\n\n\t\n\twidth1=6.40\n\theight1=4.80\n\t\n\tglBindTexture(GL_TEXTURE_2D, texture_background)\n\tglPushMatrix()\n\tglTranslatef(0.0,0.0,-10.0)\n\t\n\tglBegin (GL_QUADS);\n\tglTexCoord2f(0.0, 0.0); glVertex3f( -width1, -height1, 0.0);\n\tglTexCoord2f(1.0, 0.0); glVertex3f(width1, -height1, 0.0);\n\tglTexCoord2f(1.0, 1.0); glVertex3f(width1, height1, 0.0);\n\tglTexCoord2f(0.0, 1.0); glVertex3f( -width1,height1, 0.0);\n\tglEnd();\n\t\n\tglPopMatrix()\n\t\n\treturn None\n\n\"\"\"\nFunction Name : overlay()\nInput: img (numpy array), aruco_list, aruco_id, texture_file (filepath of texture file)\nOutput: None\nPurpose: Receives the ArUco information as input and overlays the 3D Model of a teapot\n\t on the ArUco marker. That ArUco information is used to\n\t calculate the rotation matrix and subsequently the view matrix. Then that view matrix\n\t is loaded as current matrix and the 3D model is rendered.\n\n\t Parts of this code are already completed, you just need to fill in the blanks. You may\n\t however add your own code in this function.\n\"\"\"\ndef overlay(img, ar_list, ar_id):\n\tfor x in ar_list:\n\t\tif ar_id == x[0]:\n\t\t\tcentre, rvec, tvec = x[1], x[2], x[3]\n\trmtx = cv2.Rodrigues(rvec)[0]\n\toffsetX=0.5\n\toffsetY=0.4\n\ttvec=(tvec/100)\n\tview_matrix = np.array([[rmtx[0][0],rmtx[0][1],rmtx[0][2],tvec[0][0][0]+offsetX],\n\t\t\t [rmtx[1][0],rmtx[1][1],rmtx[1][2],tvec[0][0][1]-offsetY],\n\t\t\t [rmtx[2][0],rmtx[2][1],rmtx[2][2],tvec[0][0][2]],\n\t\t\t [0.0 ,0.0 , 0.0 , 1.0 ]])\n\tview_matrix = view_matrix * INVERSE_MATRIX\n\tview_matrix = np.transpose(view_matrix)\n\tglBindTexture(GL_TEXTURE_2D,texture_object )\n\n\tglPushMatrix()\n\tglLoadMatrixd(view_matrix)\n\tif(ar_id==0):\n\t\tglCallList(ground.gl_list)\n\t\tglCallList(pot.gl_list)\n\telif(ar_id==10):\n\t\tglCallList(crow.gl_list)\n\telse:\n\t\tglCallList(ground.gl_list)\n\t\tglCallList(pebbles.gl_list)\n\tglPopMatrix()\n\n\t\n#######################################***************** START ************#################################\n\nif __name__ == \"__main__\":\n\tmain()\n\n\t\n" }, { "alpha_fraction": 0.5633929967880249, "alphanum_fraction": 0.5638150572776794, "avg_line_length": 40.467498779296875, "blob_id": "bf2dfc4794622132cbcfbe513eb1df4cbdad5110", "content_id": "1dedd000f1ec82e9ee3bbb71f29c1db82c8ca7b0", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 16587, "license_type": "no_license", "max_line_length": 119, "num_lines": 400, "path": "/PQt5-Stock/Conexion/conexionGeneral.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "\nfrom Conexion.conexion import Conexion\nfrom Modelo.producto import Producto\nfrom Modelo.proveedor import Proveedor\nfrom Modelo.cliente import Cliente\n\n\nclass ConexionGenerales(object):\n\n def __init__(self):\n self.conexion = Conexion()\n self.producto = Producto()\n proveedor = Proveedor()\n cliente = Cliente()\n\n\n def selectProductoStock(self):\n\n query = \"\"\"\n SELECT idproductos, nombre, cantidad, cant_minima\n FROM productos\n WHERE estado = 1 and cantidad BETWEEN 0 and cant_minima\n \"\"\"\n\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(query)\n listProductos = self.conexion.cursor.fetchall()\n\n self.conexion.cerrarConexion()\n\n return listProductos\n\n def changeStateProduct(self, producto):\n query =\"\"\"\n UPDATE productos\n SET estado = '0'\n WHERE idproductos = %s\n \"\"\"\n values = producto.getIdProducto()\n\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(query, values)\n self.conexion.db.commit()\n self.conexion.cerrarConexion()\n\n def selectVentasMensuales(self):\n query = \"\"\"\n SELECT m.fecha , CAST(SUM(dm.cantidad) AS CHAR)\n FROM clientes c, movimiento m, tipo_movimiento tm, detalle_movimiento dm\n WHERE c.idclientes = tm.clientes_idclientes and\n m.tipo_movimiento_idtipo_movimiento = tm.idtipo_movimiento and\n m.idmovimiento = dm.movimiento_idmovimiento\n GROUP BY month(m.fecha)\n \"\"\"\n self.conexion.abrirConexion()\n\n self.conexion.cursor.execute(query)\n listVentasMes = self.conexion.cursor.fetchall()\n self.conexion.cerrarConexion()\n\n return listVentasMes\n\n\n\n\n def selectComprasMensuales(self):\n query = \"\"\"\n SELECT m.fecha , CAST(SUM(dm.cantidad) AS CHAR)\n FROM proveedores prov, movimiento m, tipo_movimiento tm, detalle_movimiento dm\n WHERE prov.idproveedores = tm.proveedores_idproveedores and\n m.tipo_movimiento_idtipo_movimiento = tm.idtipo_movimiento and\n m.idmovimiento = dm.movimiento_idmovimiento\n GROUP BY month(m.fecha)\n \"\"\"\n\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(query)\n listComprasMes = self.conexion.cursor.fetchall()\n self.conexion.cerrarConexion()\n\n return listComprasMes\n\n\n def selectVentasAnuales(self):\n query = \"\"\"\n SELECT m.fecha , CAST(SUM(dm.cantidad) AS CHAR)\n FROM clientes c, movimiento m, tipo_movimiento tm, detalle_movimiento dm\n WHERE c.idclientes = tm.clientes_idclientes and\n m.tipo_movimiento_idtipo_movimiento = tm.idtipo_movimiento and\n m.idmovimiento = dm.movimiento_idmovimiento\n GROUP BY year(m.fecha)\n \"\"\"\n self.conexion.abrirConexion()\n\n self.conexion.cursor.execute(query)\n\n listVentasAnuales = self.conexion.cursor.fetchall()\n self.conexion.cerrarConexion()\n\n return listVentasAnuales\n\n def selectComprasAnuales(self):\n query = \"\"\"\n SELECT m.fecha , CAST(SUM(dm.cantidad) AS CHAR)\n FROM proveedores prov, movimiento m, tipo_movimiento tm, detalle_movimiento dm\n WHERE prov.idproveedores = tm.proveedores_idproveedores and\n m.tipo_movimiento_idtipo_movimiento = tm.idtipo_movimiento and\n m.idmovimiento = dm.movimiento_idmovimiento\n GROUP BY year(m.fecha)\n \"\"\"\n\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(query)\n listComprasAnuales = self.conexion.cursor.fetchall()\n self.conexion.cerrarConexion()\n\n return listComprasAnuales\n\n\n def selectVentas(self, intervalo, desde, hasta):\n query = \"\"\"\n SELECT CONCAT(CAST(year(m.fecha) AS CHAR) ,\"-\", CAST(\"\"\"+intervalo+\"\"\"(m.fecha) AS CHAR)) AS fecha,\n CAST(SUM(dm.cantidad) AS CHAR) as cantidad\n FROM clientes c, movimiento m, tipo_movimiento tm, detalle_movimiento dm\n WHERE c.idclientes = tm.clientes_idclientes and\n m.tipo_movimiento_idtipo_movimiento = tm.idtipo_movimiento and\n m.idmovimiento = dm.movimiento_idmovimiento and\n\t\t\t\t\t\t m.fecha between %s and %s\n GROUP BY \"\"\"+ intervalo +\"\"\"(m.fecha)\n\t\t\t\t\tORDER BY m.fecha\n \"\"\"\n values = (desde, hasta)\n\n\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(query, values)\n listVentas = self.conexion.cursor.fetchall()\n self.conexion.cerrarConexion()\n\n return listVentas\n\n def selectCompras(self, intervalo, desde, hasta):\n query = \"\"\"\n SELECT CONCAT(CAST(year(m.fecha) AS CHAR) ,\"-\", CAST(\"\"\"+intervalo+\"\"\"(m.fecha) AS CHAR)) AS fecha,\n CAST(SUM(dm.cantidad) AS CHAR) as cantidad\n FROM proveedores prov, movimiento m, tipo_movimiento tm, detalle_movimiento dm\n WHERE prov.idproveedores = tm.proveedores_idproveedores and\n m.tipo_movimiento_idtipo_movimiento = tm.idtipo_movimiento and\n m.idmovimiento = dm.movimiento_idmovimiento and\n m.idmovimiento = dm.movimiento_idmovimiento and\n\t\t\t\t\t\t m.fecha between %s and %s\n GROUP BY \"\"\"+ intervalo +\"\"\"(m.fecha)\n\t\t\t\t\tORDER BY m.fecha\n \"\"\"\n values = (desde, hasta)\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(query, values)\n listCompras = self.conexion.cursor.fetchall()\n self.conexion.cerrarConexion()\n\n return listCompras\n\n def selectProveedor(self, parameter):\n query =\"\"\"\n SELECT prov.idproveedores, prov.descripcion, p.nombre\n FROM proveedores prov, personas p\n WHERE p.idpersonas = prov.personas_idpersonas and\n prov.descripcion LIKE %s\n \"\"\"\n param = parameter+ '%'\n values = param\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(query, values)\n listProveedor = self.conexion.cursor.fetchall()\n self.conexion.cerrarConexion()\n return listProveedor\n\n def selectCliente(self, parameter):\n query = \"\"\"\n SELECT cli.idClientes, cli.apellido, p.nombre\n FROM clientes cli, personas p\n WHERE p.idpersonas = cli.personas_idpersonas and\n cli.apellido LIKE %s\n \"\"\"\n param = parameter+ '%'\n values = param\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(query, values)\n listCliente = self.conexion.cursor.fetchall()\n self.conexion.cerrarConexion()\n return listCliente\n\n\n def selectListPagosProveedor(self, proveedor, intervalo, desde, hasta):\n\n selectFecha = ''\n if intervalo == 'day':\n selectFecha = \"p.fecha\"\n else:\n selectFecha = \"\"\"CONCAT(CAST(year(p.fecha) AS CHAR) ,\"-\", CAST(\"\"\"+intervalo+\"\"\"(p.fecha) AS CHAR))\"\"\"\n query = \"\"\"\n SELECT \"\"\"+ selectFecha +\"\"\" AS fecha , SUM(p.monto), tm.tipo_movimiento\n FROM proveedores prov, pagos p, tipo_movimiento tm\n WHERE tm.proveedores_idproveedores = prov.idproveedores and\n p.tipo_movimiento_idtipo_movimiento = tm.idtipo_movimiento and\n prov.idproveedores = %s and\n\t p.fecha between %s and %s\n GROUP BY \"\"\"+ intervalo +\"\"\"(p.fecha)\n\t\t\t\t\tORDER BY p.fecha\n \"\"\"\n values = (proveedor.getIdProveedor(), desde, hasta)\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(query, values)\n listPagos = self.conexion.cursor.fetchall()\n self.conexion.cerrarConexion()\n\n return listPagos\n\n def selectListTransaccionProveedor(self, proveedor, intervalo, desde, hasta):\n\n selectFecha = ''\n if intervalo == 'day':\n selectFecha = \"m.fecha\"\n else:\n selectFecha = \"\"\"CONCAT(CAST(year(m.fecha) AS CHAR) ,\"-\", CAST(\"\"\"+intervalo+\"\"\"(m.fecha) AS CHAR))\"\"\"\n query = \"\"\"\n SELECT \"\"\"+ selectFecha +\"\"\" AS fecha,\n SUM(dm.precio_unitario * dm.cantidad) as monto, tm.tipo_movimiento\n FROM proveedores prov, movimiento m, tipo_movimiento tm, detalle_movimiento dm\n WHERE prov.idproveedores = tm.proveedores_idproveedores and\n m.tipo_movimiento_idtipo_movimiento = tm.idtipo_movimiento and\n m.idmovimiento = dm.movimiento_idmovimiento and m.estado = 0 and\n prov.idproveedores = % s and\n\t m.fecha between %s and %s\n GROUP BY \"\"\"+ intervalo +\"\"\"(m.fecha)\n\t\t\t\t\tORDER BY m.fecha\n \"\"\"\n values = (proveedor.getIdProveedor(), desde, hasta)\n\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(query, values)\n listTransacciones = self.conexion.cursor.fetchall()\n self.conexion.cerrarConexion()\n\n return listTransacciones\n\n def selectListPagosCliente(self, cliente, intervalo, desde, hasta):\n\n selectFecha = ''\n if intervalo == 'day':\n selectFecha = \"p.fecha\"\n else:\n selectFecha = \"\"\"CONCAT(CAST(year(p.fecha) AS CHAR) ,\"-\", CAST(\"\"\"+intervalo+\"\"\"(p.fecha) AS CHAR))\"\"\"\n\n query = \"\"\"\n SELECT \"\"\"+ selectFecha +\"\"\" AS fecha, SUM(p.monto), tm.tipo_movimiento\n FROM clientes c, pagos p, tipo_movimiento tm\n WHERE tm.clientes_idclientes = c.idclientes and\n p.tipo_movimiento_idtipo_movimiento = tm.idtipo_movimiento and\n c.idclientes = %s and\n\t p.fecha between %s and %s\n GROUP BY \"\"\"+ intervalo +\"\"\"(p.fecha)\n\t\t\t\t\tORDER BY p.fecha\n \"\"\"\n values = (cliente.getIdCliente(), desde, hasta)\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(query, values)\n listPagos = self.conexion.cursor.fetchall()\n self.conexion.cerrarConexion()\n\n return listPagos\n\n def selectListTransaccionCliente(self, cliente, intervalo, desde, hasta):\n\n selectFecha = ''\n if intervalo == 'day':\n selectFecha = \"m.fecha\"\n else:\n selectFecha = \"\"\"CONCAT(CAST(year(m.fecha) AS CHAR) ,\"-\", CAST(\"\"\"+intervalo+\"\"\"(m.fecha) AS CHAR))\"\"\"\n\n query = \"\"\"\n SELECT \"\"\"+ selectFecha +\"\"\" AS fecha,\n SUM(dm.precio_unitario * dm.cantidad) as monto, tm.tipo_movimiento\n FROM clientes c, movimiento m, tipo_movimiento tm, detalle_movimiento dm\n WHERE c.idclientes = tm.clientes_idclientes and\n m.tipo_movimiento_idtipo_movimiento = tm.idtipo_movimiento and\n m.idmovimiento = dm.movimiento_idmovimiento and m.estado = 0 and\n c.idclientes = %s and\n\t m.fecha between %s and %s\n GROUP BY \"\"\"+ intervalo +\"\"\"(m.fecha)\n\t\t\t\t\tORDER BY m.fecha\n \"\"\"\n values = (cliente.getIdCliente(), desde, hasta)\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(query, values)\n listTransacciones = self.conexion.cursor.fetchall()\n self.conexion.cerrarConexion()\n\n return listTransacciones\n\n def selectEntradasTransacciones(self, intervalo, desde, hasta):\n selectFecha = ''\n if intervalo == 'day':\n selectFecha = \"m.fecha\"\n else:\n selectFecha = \"\"\"CONCAT(CAST(year(m.fecha) AS CHAR) ,\"-\", CAST(\"\"\"+intervalo+\"\"\"(m.fecha) AS CHAR))\"\"\"\n\n query = \"\"\"\n SELECT \"\"\"+ selectFecha +\"\"\" AS fecha,\n SUM(dm.precio_unitario * dm.cantidad) as monto, tm.tipo_movimiento\n FROM clientes c, movimiento m, tipo_movimiento tm, detalle_movimiento dm\n WHERE c.idclientes = tm.clientes_idclientes and\n m.tipo_movimiento_idtipo_movimiento = tm.idtipo_movimiento and\n m.idmovimiento = dm.movimiento_idmovimiento and m.estado = 1 and\n\t m.fecha between %s and %s\n GROUP BY \"\"\"+ intervalo +\"\"\"(m.fecha)\n\t\t\t\t\tORDER BY m.fecha\n \"\"\"\n values = (desde, hasta)\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(query, values)\n listEntradaTransacciones = self.conexion.cursor.fetchall()\n self.conexion.cerrarConexion()\n\n return listEntradaTransacciones\n\n\n def selectSalidaTransacciones(self, intervalo, desde, hasta):\n selectFecha = ''\n if intervalo == 'day':\n selectFecha = \"m.fecha\"\n else:\n selectFecha = \"\"\"CONCAT(CAST(year(m.fecha) AS CHAR) ,\"-\", CAST(\"\"\"+intervalo+\"\"\"(m.fecha) AS CHAR))\"\"\"\n\n query = \"\"\"\n SELECT \"\"\"+ selectFecha +\"\"\" AS fecha,\n SUM(dm.precio_unitario * dm.cantidad) as monto, tm.tipo_movimiento\n FROM proveedores prov, movimiento m, tipo_movimiento tm, detalle_movimiento dm\n WHERE prov.idproveedores = tm.proveedores_idproveedores and\n m.tipo_movimiento_idtipo_movimiento = tm.idtipo_movimiento and\n m.idmovimiento = dm.movimiento_idmovimiento and m.estado = 1 and\n\t m.fecha between %s and %s\n GROUP BY \"\"\"+ intervalo +\"\"\"(m.fecha)\n\t\t\t\t\tORDER BY m.fecha\n \"\"\"\n values = (desde, hasta)\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(query, values)\n listSalidaTransacciones = self.conexion.cursor.fetchall()\n self.conexion.cerrarConexion()\n\n return listSalidaTransacciones\n\n\n def selectEntradaPagos(self, intervalo, desde, hasta):\n selectFecha = ''\n if intervalo == 'day':\n selectFecha = \"p.fecha\"\n else:\n selectFecha = \"\"\"CONCAT(CAST(year(p.fecha) AS CHAR) ,\"-\", CAST(\"\"\"+intervalo+\"\"\"(p.fecha) AS CHAR))\"\"\"\n\n query = \"\"\"\n SELECT \"\"\"+ selectFecha +\"\"\" AS fecha , SUM(p.monto), tm.tipo_movimiento\n FROM clientes c, pagos p, tipo_movimiento tm\n WHERE tm.clientes_idclientes = c.idclientes and\n p.tipo_movimiento_idtipo_movimiento = tm.idtipo_movimiento and\n\t p.fecha between %s and %s\n GROUP BY \"\"\"+ intervalo +\"\"\"(p.fecha)\n\t\t\t\t\tORDER BY p.fecha\n \"\"\"\n values = (desde, hasta)\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(query, values)\n listEntradaPagos = self.conexion.cursor.fetchall()\n self.conexion.cerrarConexion()\n\n return listEntradaPagos\n\n def selectSalidaPagos(self, intervalo, desde, hasta):\n selectFecha = ''\n if intervalo == 'day':\n selectFecha = \"p.fecha\"\n else:\n selectFecha = \"\"\"CONCAT(CAST(year(p.fecha) AS CHAR) ,\"-\", CAST(\"\"\"+intervalo+\"\"\"(p.fecha) AS CHAR))\"\"\"\n\n query = \"\"\"\n SELECT \"\"\"+ selectFecha +\"\"\" AS fecha , SUM(p.monto), tm.tipo_movimiento\n FROM proveedores prov, pagos p, tipo_movimiento tm\n WHERE tm.proveedores_idproveedores = prov.idproveedores and\n p.tipo_movimiento_idtipo_movimiento = tm.idtipo_movimiento and\n\t p.fecha between %s and %s\n GROUP BY \"\"\"+ intervalo +\"\"\"(p.fecha)\n\t\t\t\t\tORDER BY p.fecha\n \"\"\"\n values = (desde, hasta)\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(query, values)\n listSalidaPagos = self.conexion.cursor.fetchall()\n self.conexion.cerrarConexion()\n\n return listSalidaPagos" }, { "alpha_fraction": 0.6242424249649048, "alphanum_fraction": 0.6280303001403809, "avg_line_length": 25.399999618530273, "blob_id": "ba5f85bbf75dc36ad6689fa179f8c2cef267d75b", "content_id": "645ca7667777959cd99d57deb2238f5380141ad5", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1320, "license_type": "no_license", "max_line_length": 90, "num_lines": 50, "path": "/Hospital-Helper-2-master/app/gui/input_widget.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import functools\n\nfrom PyQt5.QtCore import Qt\nfrom PyQt5.QtWidgets import (QFrame, QHBoxLayout, QLabel,\n QLineEdit)\n\nfrom app.gui import utils\n\n\nclass InputWidget(QFrame):\n\n \"\"\"\n Input contains QLabel and QLineEdit.\n Represents single attribute in CalculableObject object.\n Does not show private attributes that starts from '_'\n \"\"\"\n\n def __init__(self, parent, main_window, label_text):\n super().__init__()\n\n # if label_text.startswith('_'):\n # return\n\n self.label_text = label_text\n self.input = QLineEdit()\n\n main_window.communication.clean_items.connect(self.clean)\n\n hbox = QHBoxLayout()\n self.setLayout(hbox)\n # hbox.addWidget(QLabel(_(label_text)))\n hbox.addWidget(QLabel(label_text))\n hbox.addStretch()\n\n self.input.setAlignment(Qt.AlignRight)\n # self.input.setFixedWidth(190)\n self.input.textEdited.connect(functools.partial(parent.input_changed, label_text))\n\n self.setGraphicsEffect(utils.get_shadow())\n hbox.addWidget(self.input)\n\n def set_value(self, value):\n if value:\n self.input.setText(str(value))\n\n def clean(self):\n self.input.setText('')\n\n def mousePressEvent(self, event):\n self.input.setFocus()\n" }, { "alpha_fraction": 0.5332241654396057, "alphanum_fraction": 0.5343940258026123, "avg_line_length": 32.653541564941406, "blob_id": "7d6a84be605897fdbfa70dc0f2fdc4ad8dc55bff", "content_id": "85ed6bafe0e4dfd5163cdfcbc68ddc3e4a5c79ba", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 4274, "license_type": "no_license", "max_line_length": 107, "num_lines": 127, "path": "/Hospital-Helper-2-master/app/model/report.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import os\nimport subprocess\nimport datetime\nfrom collections import OrderedDict, defaultdict\n\nfrom bs4 import BeautifulSoup\n\nfrom PyQt5.Qt import QTextDocument, QTextDocumentWriter\n\nfrom app import options\nfrom app.model import db\n\n\nclass Report:\n def __init__(self, user, items):\n\n self.user = user\n\n if not self.user.organization:\n self.user.organization = db.SESSION.query(db.Organization).get(self.user.organization_id)\n\n self.template_groups = OrderedDict()\n\n for item in items:\n if item.name == options.CLIENT_TABLE_NAME:\n self.client = self._get_client(item)\n if not item.template:\n continue\n if not self.template_groups.get(item.group):\n self.template_groups[item.group] = []\n\n self.template_groups[item.group].append(item)\n\n def _get_client(self, item):\n # It's hardcoded for now\n # FIXME: change it in the future'\n return db.Client(surname=item['familiia'],\n name=item['imia'],\n patronymic=item['otchestvo'],\n age=item['vozrast'],\n hr=item['chss'],\n height=item['rost'],\n weight=item['ves'],\n examined=datetime.date.today(),\n user_id=self.user.id)\n\n def _get_global_style(self):\n return '<style>\\n* {{\\n{}\\n}}\\n</style>'.format(\n '\\n'.join(['{}: {} !important;'.format(k, v)\n for k, v in options.TEMPLATE_GLOBAL_STYLE.items()]))\n\n def _get_header(self):\n\n return self.user.organization.header or ''\n\n def _get_footer(self):\n\n if not self.user:\n return ''\n else:\n return ('<p style=\"text-align:right\">{}<br>'\n '{} {} {}</p>'.format(datetime.datetime.now().strftime('%d.%m.%Y'),\n self.user.surname,\n self.user.name,\n self.user.patronymic))\n\n @staticmethod\n def open(path):\n name = os.name\n\n if name == 'posix':\n subprocess.call(['xdg-open', path])\n elif name == 'nt':\n os.startfile(path)\n else:\n raise AttributeError('Unknown system')\n\n def _get_report_path(self):\n _path_template = os.path.join(options.REPORTS_DIR, *(datetime.date.today().isoformat().split('-')))\n if not os.path.exists(_path_template):\n os.makedirs(_path_template)\n\n _path_template = os.path.join(_path_template, '{}{{}}.odt'.format(self.client))\n path = _path_template\n i = 1\n while os.path.exists(path.format('')):\n path = _path_template.format(' ({})'.format(i))\n i += 1\n return path.format('')\n\n def render(self):\n document = [self._get_global_style(), self._get_header()]\n\n keywords = defaultdict(lambda: defaultdict(str))\n for k, group in self.template_groups.items():\n for item in group:\n keywords.update(item.for_template())\n\n for k, group in self.template_groups.items():\n conclusion = []\n\n for item in group:\n document.append(item.template.body.format(**keywords))\n conclusion.append(item.template.conclusion)\n\n conclusion = ' '.join(conclusion)\n if BeautifulSoup(conclusion, 'html.parser').text:\n conclusion = BeautifulSoup(conclusion, 'html.parser')\n for p in conclusion.find_all('p'):\n p.name = 'span'\n conclusion.insert(0, BeautifulSoup(options.CONCLUSION, 'html.parser'))\n document.append(str(conclusion))\n\n document.append(self._get_footer())\n\n return ''.join(document)\n\n def render_and_save(self):\n path = self._get_report_path()\n document = QTextDocument()\n document.setHtml(self.render())\n QTextDocumentWriter(path).write(document)\n\n self.client.save()\n report = db.Report(path=path, client_id=self.client.id)\n report.save()\n return report\n" }, { "alpha_fraction": 0.5952980518341064, "alphanum_fraction": 0.5980268716812134, "avg_line_length": 38.37190246582031, "blob_id": "9c6898cc4cf200905852019f877054ad7b693a90", "content_id": "853703fe803e6fd9257d69901840cb97c17f1262", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 4954, "license_type": "no_license", "max_line_length": 111, "num_lines": 121, "path": "/Hospital-Helper-2-master/app/gui/options_widget.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "import functools\n\nfrom PyQt5.QtWidgets import (QWidget, QHBoxLayout, QStackedLayout,\n QVBoxLayout, QPushButton, QFileDialog)\n\nfrom app import options\nfrom app.model import template\n\nfrom app.gui import utils\nfrom app.gui.template_widget import TemplateWidgetInOptions\nfrom app.gui.users_and_groups_widget import UsersAndGroupsWidget\n\n\nclass OptionsWidget(QWidget):\n\n \"\"\"\n Widget holds menu with all options.\n \"\"\"\n\n def __init__(self, main_window, items):\n\n super().__init__()\n\n self.items = items\n\n self.layout = QStackedLayout()\n self._switch_user = self._get_switch_user_func(main_window)\n self.setLayout(self.layout)\n self._hide_action_button = lambda: main_window.communication.action_button_toggle.emit(False, '', None)\n\n self._create_layout(main_window)\n\n def set_current_index(self, index):\n self.layout.setCurrentIndex(index)\n if not index:\n self._hide_action_button()\n\n def showEvent(self, event):\n if not self.layout.currentIndex():\n self._hide_action_button()\n\n def _get_switch_user_func(self, main_window):\n def _switch_user():\n main_window.menu_btn_clicked(main_window.user_frame_index)\n self.layout.setCurrentIndex(0)\n return _switch_user\n\n def _get_template_import_func(self, main_window):\n func = self._wrap_template_func(template.Template.import_, main_window)\n\n def _alert_callback(path, value):\n if value:\n func(path[0])\n\n def _f():\n # path = QFileDialog.getOpenFileName(main_window, 'Выберите файл', options.DATABASE_DIR)\n path = QFileDialog.getOpenFileName(main_window, 'Selecione o arquivo', options.DATABASE_DIR)\n if path:\n # main_window.create_alert('Шаблоны с одинаковыми именами будут перезаписаны.'\n # '\\nПродолжить?', functools.partial(_alert_callback, path))\n main_window.create_alert('Padrões com o mesmo nome serão sobrescritos.'\n '\\nContinua?', functools.partial(_alert_callback, path))\n return _f\n\n def _get_template_export_func(self, main_window):\n func = self._wrap_template_func(template.Template.export, main_window)\n\n def _f():\n # path = QFileDialog.getExistingDirectory(main_window, 'Выберите путь', options.DATABASE_DIR)\n path = QFileDialog.getExistingDirectory(main_window, 'Escolha um caminho', options.DATABASE_DIR)\n if path:\n return func(path)\n return _f\n\n @staticmethod\n def _wrap_template_func(func, main_window):\n def _f(path):\n ok, result = func(path)\n if ok:\n # main_window.show_message('Готово')\n main_window.show_message('Feito')\n else:\n # main_window.create_alert('Произошла ошибка\\n{}'.format(result.get('error')))\n main_window.create_alert('Ocorreu um erro\\n{}'.format(result.get('error')))\n return ok, result\n return _f\n\n def _create_layout(self, main_window):\n\n wrapper = QHBoxLayout()\n self.layout.addWidget(utils.get_scrollable(wrapper))\n rows = 8\n cols = 3\n vboxes = [QVBoxLayout() for _ in range(cols)]\n\n # widgets = ((TemplateWidgetInOptions(main_window, self.items, self), 'Шаблоны'),\n # (UsersAndGroupsWidget(main_window, self), 'Пользователи и группы'),\n # (self._switch_user, 'Сменить пользователя'),\n # (self._get_template_export_func(main_window), 'Экспортировать шаблоны'),\n # (self._get_template_import_func(main_window), 'Импортировать шаблоны'))\n widgets = ((TemplateWidgetInOptions(main_window, self.items, self), 'Templates'),\n (UsersAndGroupsWidget(main_window, self), 'Usuários e Grupos'),\n (self._switch_user, 'Alterar usuário'),\n (self._get_template_export_func(main_window), 'Modelos de exportação'),\n (self._get_template_import_func(main_window), 'Importar modelos'))\n\n for i, widget in enumerate(widgets):\n b = QPushButton(widget[1])\n\n if callable(widget[0]):\n b.clicked.connect(widget[0])\n else:\n b.clicked.connect(functools.partial(self.layout.setCurrentIndex, i + 1))\n self.layout.addWidget(widget[0])\n\n b.setGraphicsEffect(utils.get_shadow())\n vboxes[(i // rows) % cols].addWidget(b)\n\n for each in vboxes:\n each.addStretch()\n wrapper.addLayout(each, stretch=int(100 / cols))\n" }, { "alpha_fraction": 0.5641531348228455, "alphanum_fraction": 0.5667816400527954, "avg_line_length": 26.41441535949707, "blob_id": "75412bd92948c3bba8d3a90f60f5b4de2fc507e8", "content_id": "c7ceaf50893e12902f0e9424da7cd6872a032be4", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 6087, "license_type": "no_license", "max_line_length": 85, "num_lines": 222, "path": "/djangosige/venv/Lib/site-packages/geraldo/graphics.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "from .base import BAND_WIDTH, BAND_HEIGHT, Element\nfrom .utils import cm, black\n\nclass Graphic(Element):\n \"\"\"Base graphic class\"\"\"\n stroke = True\n stroke_color = black\n stroke_width = 1\n \n fill = False\n fill_color = black\n\n _repr_for_cache_attrs = ('left','top','height','width','visible','stroke',\n 'stroke_color','stroke_width','fill','fill_color')\n\n def __init__(self, **kwargs):\n for k,v in list(kwargs.items()):\n setattr(self, k, v)\n \n def set_rect(self, **kwargs):\n \"\"\"This method will adapt the graphic element in a rect.\"\"\"\n self.left = kwargs.get('left', self.left)\n self.top = kwargs.get('top', self.top)\n\n if 'width' in kwargs:\n self.width = kwargs['width']\n elif 'right' in kwargs:\n self.width = kwargs['right'] - self.left\n\n if 'height' in kwargs:\n self.height = kwargs['height']\n elif 'bottom' in kwargs:\n self.height = kwargs['bottom'] - self.top\n\n def clone(self):\n new = super(Graphic, self).clone()\n new.stroke = self.stroke\n new.stroke_color = self.stroke_color\n new.stroke_width = self.stroke_width\n\n new.fill = self.fill\n new.fill_color = self.fill_color\n\n return new\n\nclass Rect(Graphic):\n \"\"\"A simple rectangle\"\"\"\n pass\n\nclass RoundRect(Rect):\n \"\"\"A rectangle graphic element that is possible set its radius and have\n round corners\"\"\"\n radius = 0.5\n\n _repr_for_cache_attrs = ('left','top','height','width','visible','stroke',\n 'stroke_color','stroke_width','fill','fill_color','radius')\n\n def clone(self):\n new = super(RoundRect, self).clone()\n new.radius = self.radius\n\n return new\n\nclass Fixed(Graphic):\n \"\"\"A fixed graphic is base on right and bottom coordinates instead of width\n and height.\n \n It is just a reference class and shouldn't be used directly in reports.\"\"\"\n left = None\n top = None\n right = None\n bottom = None\n \n _repr_for_cache_attrs = ('left','top','height','width','visible','stroke',\n 'stroke_color','stroke_width','fill','fill_color','right','bottom')\n\n def set_rect(self, **kwargs):\n self.left = kwargs.get('left', self.left)\n self.top = kwargs.get('top', self.top)\n\n if 'right' in kwargs:\n self.right = kwargs['right']\n elif 'width' in kwargs:\n self.right = kwargs['width'] + self.left\n\n if 'bottom' in kwargs:\n self.bottom = kwargs['bottom']\n elif 'height' in kwargs:\n self.bottom = kwargs['height'] + self.top\n\n def clone(self):\n new = super(Fixed, self).clone()\n new.left = self.left\n new.top = self.top\n new.right = self.right\n new.bottom = self.bottom\n\n return new\n\nclass Line(Fixed):\n \"\"\"A simple line\"\"\"\n \n dash = None\n \n def __init__(self, **kwargs):\n self.dash = kwargs.get('dash', None)\n super(Line, self).__init__(**kwargs)\n \n def height(self):\n return self.bottom - self.top\n height = property(height)\n\n def width(self):\n return self.right - self.left\n width = property(width)\n \n def clone(self):\n new = super(Line, self).clone()\n new.dash = self.dash\n \n return new\n\nclass Circle(Graphic):\n \"\"\"A simple circle\"\"\"\n left_center = None\n top_center = None\n radius = None\n\n _repr_for_cache_attrs = ('left','top','height','width','visible','stroke',\n 'stroke_color','stroke_width','fill','fill_color','left_center',\n 'top_center','radius')\n\n def clone(self):\n new = super(Circle, self).clone()\n new.left_center = self.left_center\n new.top_center = self.top_center\n new.radius = self.radius\n\n return new\n\nclass Arc(Fixed):\n \"\"\"A simple circle\"\"\"\n start_angle = 0\n extent = 90\n\n _repr_for_cache_attrs = ('left','top','height','width','visible','stroke',\n 'stroke_color','stroke_width','fill','fill_color','start_angle','extent')\n\n def clone(self):\n new = super(Arc, self).clone()\n new.start_angle = self.start_angle\n new.extent = self.extent\n\n return new\n\nclass Ellipse(Fixed):\n \"\"\"A simple circle\"\"\"\n pass\n\nclass Image(Graphic):\n \"\"\"A image\"\"\"\n left = None\n top = None\n _width = None\n _height = None\n filename = None\n _image = None # PIL image object is stored here\n get_image = None # To be overrided\n\n _repr_for_cache_attrs = ('left','top','height','width','visible','stroke',\n 'stroke_color','stroke_width','fill','fill_color','filename')\n\n def clone(self):\n new = super(Image, self).clone()\n new.left = self.left\n new.top = self.top\n new._width = self._width\n new._height = self._height\n new.filename = self.filename\n new._image = self._image\n new.get_image = self.get_image\n\n return new\n\n def _get_image(self):\n \"\"\"Uses Python Imaging Library to load an image and get its\n informations\"\"\"\n if self.get_image:\n self._image = self.get_image(self)\n\n if not self._image and self.filename:\n try:\n import Image as PILImage\n except ImportError:\n from PIL import Image as PILImage\n\n self._image = PILImage.open(self.filename)\n\n return self._image\n\n def _set_image(self, value):\n self._image = value\n\n image = property(_get_image, _set_image)\n\n def _get_height(self):\n ret = self._height or (self.image and self.image.size[1] or 0)\n return ret * 0.02*cm\n\n def _set_height(self, value):\n self._height = value\n\n height = property(_get_height, _set_height)\n\n def _get_width(self):\n ret = self._width or (self.image and self.image.size[0] or 0)\n return ret * 0.02*cm\n\n def _set_width(self, value):\n self._width = value\n\n width = property(_get_width, _set_width)\n\n" }, { "alpha_fraction": 0.6110232472419739, "alphanum_fraction": 0.6128303408622742, "avg_line_length": 45.61052703857422, "blob_id": "49b3ce0c24d0834e6e7406e0906881c14de850d5", "content_id": "1383b05cd4bdc002b5e7bbd9799eff165962fe72", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 4427, "license_type": "no_license", "max_line_length": 128, "num_lines": 95, "path": "/PQt5-Stock/Conexion/conexionProveedor.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\nfrom Modelo.proveedor import Proveedor\nfrom Conexion.conexion import Conexion\nclass conexionProveedor(object):\n\n\n def __init__(self):\n self.conexion = Conexion()\n self.proveedor = Proveedor()\n\n def selectProveedor(self, typeParameter, parameter, parameterState):\n query =\"\"\"\n SELECT prov.idproveedores, prov.descripcion, p.nombre, p.email, prov.web, d.direccion, d.numero,\n d.piso, d.dpto, p.idpersonas, d.iddirecciones, prov.estado\n FROM proveedores prov, personas p, direcciones d\n WHERE p.direcciones_iddirecciones = d.iddirecciones and p.idpersonas = prov.personas_idpersonas and\n \"\"\" + typeParameter + \"\"\" LIKE %s and prov.estado LIKE %s\n \"\"\"\n param = parameter + '%'\n\n paramState = '1'\n if parameterState == 0:\n paramState = '%'\n\n values = (param, paramState)\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(query, values)\n listProveedor = self.conexion.cursor.fetchall()\n self.conexion.cerrarConexion()\n return listProveedor\n\n def selectTelefonoProveedor(self, proveedor):\n query = \"\"\"SELECT t.idtelefono, t.numero, t.tipo\n FROM telefonos t, personas p, proveedores prov\n WHERE p.idpersonas = prov.personas_idpersonas and p.idpersonas = t.personas_idpersonas\n and prov.idproveedores = %s\"\"\"\n value = proveedor.getIdProveedor()\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(query)\n listTelefono = self.conexion.cursor.fetchall()\n self.conexion.cerrarConexion()\n return listTelefono\n\n def modificarProveedor(self, proveedor):\n query = \"\"\"\n UPDATE personas p, proveedores prov, direcciones d\n SET p.nombre = %s , p.email= %s , prov.descripcion = %s, prov.web = %s, d.direccion= %s,\n d.numero = %s, d.piso = %s, d.dpto = %s, prov.estado = %s\n WHERE p.idpersonas = prov.personas_idpersonas and p.direcciones_iddirecciones = d.iddirecciones\n and prov.idproveedores = %s\n \"\"\"\n values = (proveedor.getNombre(), proveedor.getEmail(), proveedor.getDescripcion(),\n proveedor.getWeb(), proveedor.getDireccion().getDireccion(), proveedor.getDireccion().getNumero(),\n proveedor.getDireccion().getPiso(), proveedor.getDireccion().getDpto(), proveedor.getEstado(),\n proveedor.getIdProveedor()\n )\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(query, values)\n self.conexion.db.commit()\n self.conexion.cerrarConexion()\n\n def insertarProveedor(self, proveedor):\n self.conexion.abrirConexion()\n\n queryDireccion = \"INSERT INTO direcciones (direccion, numero, piso, dpto) VALUES (%s, %s, %s, %s)\"\n valuesDireccion = (proveedor.getDireccion().getDireccion(), proveedor.getDireccion().getNumero(),\n proveedor.getDireccion().getPiso(), proveedor.getDireccion().getDpto())\n self.conexion.cursor.execute(queryDireccion, valuesDireccion)\n\n queryPersona = \"INSERT INTO personas (nombre, email, direcciones_iddirecciones) VALUES (%s, %s, LAST_INSERT_ID())\"\n valuesPersona = (proveedor.getNombre(), proveedor.getEmail())\n\n self.conexion.cursor.execute(queryPersona, valuesPersona)\n query1 = \"INSERT INTO proveedores (personas_idpersonas, descripcion, web, estado) VALUES (LAST_INSERT_ID(), %s, %s, %s)\"\n values1 = (proveedor.getDescripcion(), proveedor.getWeb(), proveedor.getEstado())\n self.conexion.cursor.execute(query1, values1)\n self.conexion.db.commit()\n self.conexion.cerrarConexion()\n\n\n def borrarProveedor(self, proveedor):\n queryProveedores = \"\"\"\n UPDATE proveedores\n SET estado = 0\n WHERE proveedores.idproveedores = %s\n \"\"\"\n valuesProveedor = proveedor.getIdProveedor()\n\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(queryProveedores, valuesProveedor)\n self.conexion.db.commit()\n self.conexion.cerrarConexion()" }, { "alpha_fraction": 0.5557337403297424, "alphanum_fraction": 0.5701683759689331, "avg_line_length": 50.95833206176758, "blob_id": "6976cdfc5291dd2930c01eddb6365db1d2b7b3d2", "content_id": "7747e283ba5ea7501c2929d20ff92645e3af89d3", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2494, "license_type": "no_license", "max_line_length": 104, "num_lines": 48, "path": "/fullcontrol/dados/migrations/0001_initial.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "# Generated by Django 3.1.5 on 2021-01-20 17:36\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n initial = True\n\n dependencies = [\n ]\n\n operations = [\n migrations.CreateModel(\n name='Savemdip',\n fields=[\n ('em_codigo', models.SmallIntegerField(primary_key=True, serialize=False)),\n ('em_razsoc', models.CharField(blank=True, max_length=40, null=True)),\n ('em_fanta', models.CharField(blank=True, max_length=16, null=True)),\n ('em_endereco', models.CharField(blank=True, max_length=40, null=True)),\n ('em_bairro', models.CharField(blank=True, max_length=20, null=True)),\n ('em_cidade', models.CharField(blank=True, max_length=20, null=True)),\n ('em_estado', models.CharField(blank=True, max_length=2, null=True)),\n ('em_cep', models.IntegerField(blank=True, null=True)),\n ('em_cgc', models.DecimalField(blank=True, decimal_places=0, max_digits=15, null=True)),\n ('em_inscr', models.CharField(blank=True, max_length=15, null=True)),\n ('em_jucesp', models.IntegerField(blank=True, null=True)),\n ('em_data', models.IntegerField(blank=True, null=True)),\n ('em_ddd', models.SmallIntegerField(blank=True, null=True)),\n ('em_telefone', models.IntegerField(blank=True, null=True)),\n ('em_fax', models.IntegerField(blank=True, null=True)),\n ('em_digin', models.SmallIntegerField(blank=True, null=True)),\n ('em_qtdig', models.SmallIntegerField(blank=True, null=True)),\n ('em_palav', models.CharField(blank=True, max_length=12, null=True)),\n ('em_senha', models.IntegerField(blank=True, null=True)),\n ('em_tipo', models.CharField(blank=True, max_length=1, null=True)),\n ('em_endnum', models.IntegerField(blank=True, null=True)),\n ('em_release_log', models.SmallIntegerField(blank=True, null=True)),\n ('em_release_param', models.SmallIntegerField(blank=True, null=True)),\n ('em_pais', models.CharField(blank=True, max_length=2, null=True)),\n ('em_filler', models.CharField(blank=True, max_length=2, null=True)),\n ],\n options={\n 'db_table': 'savemdip',\n 'managed': False,\n },\n ),\n ]\n" }, { "alpha_fraction": 0.5841301679611206, "alphanum_fraction": 0.5847010016441345, "avg_line_length": 37.93333435058594, "blob_id": "c9fc00a711a3291d0ea834d59c00324a6109a534", "content_id": "277e954a55e761eb2c9393722d8df1ec9b7a39dc", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 7007, "license_type": "no_license", "max_line_length": 104, "num_lines": 180, "path": "/PQt5-Stock/Conexion/conexionPagos.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "from Conexion.conexion import Conexion\nfrom Modelo.cliente import Cliente\nfrom Modelo.proveedor import Proveedor\nimport datetime\n\n\nclass ConexionPagos(object):\n\n def __init__(self):\n self.conexion = Conexion()\n self.cliente = Cliente()\n self.proveedor = Proveedor()\n\n\n def selectProveedores(self, tipoParametro, parametro):\n query = \"\"\"\n SELECT prov.idproveedores , prov.descripcion, p.nombre, p.email\n FROM proveedores prov, personas p\n WHERE p.idpersonas = prov.personas_idpersonas and prov.estado = 1 and\n \"\"\" + tipoParametro + \"\"\" LIKE %s\n \"\"\"\n parametro = parametro + '%'\n values = parametro\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(query, values)\n listProveedores = self.conexion.cursor.fetchall()\n\n self.conexion.cerrarConexion()\n\n return listProveedores\n\n\n def selectClientes(self, tipoParametro, parametro):\n query = \"\"\"\n SELECT c.idclientes, c.apellido, p.nombre, p.email\n FROM clientes c, personas p\n WHERE p.idpersonas = c.personas_idpersonas and c.estado = 1 and\n \"\"\"+ tipoParametro + \"\"\" LIKE %s\n \"\"\"\n parametro = parametro + '%'\n values = parametro\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(query, values)\n listClientes = self.conexion.cursor.fetchall()\n self.conexion.cerrarConexion()\n\n return listClientes\n\n\n def selectListPagosProveedor(self, proveedor):\n query = \"\"\"\n SELECT p.fecha, p.monto, tm.tipo_movimiento\n FROM proveedores prov, pagos p, tipo_movimiento tm\n WHERE tm.proveedores_idproveedores = prov.idproveedores and\n p.tipo_movimiento_idtipo_movimiento = tm.idtipo_movimiento and\n prov.idproveedores = %s\n \"\"\"\n values = proveedor.getIdProveedor()\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(query, values)\n listPagos = self.conexion.cursor.fetchall()\n self.conexion.cerrarConexion()\n\n return listPagos\n\n def selectListTransaccionProveedor(self, proveedor):\n query = \"\"\"\n SELECT m.fecha, SUM(dm.precio_unitario * dm.cantidad) as monto, tm.tipo_movimiento\n FROM proveedores prov, movimiento m, tipo_movimiento tm, detalle_movimiento dm\n WHERE prov.idproveedores = tm.proveedores_idproveedores and\n m.tipo_movimiento_idtipo_movimiento = tm.idtipo_movimiento and\n m.idmovimiento = dm.movimiento_idmovimiento and m.estado = 0 and\n prov.idproveedores = %s\n GROUP BY m.fecha\n \"\"\"\n values = proveedor.getIdProveedor()\n\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(query, values)\n listTransacciones = self.conexion.cursor.fetchall()\n self.conexion.cerrarConexion()\n\n return listTransacciones\n\n def selectListPagosCliente(self, cliente):\n query = \"\"\"\n SELECT p.fecha, p.monto, tm.tipo_movimiento\n FROM clientes c, pagos p, tipo_movimiento tm\n WHERE tm.clientes_idclientes = c.idclientes and\n p.tipo_movimiento_idtipo_movimiento = tm.idtipo_movimiento and\n c.idclientes = %s\n \"\"\"\n values = cliente.getIdCliente()\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(query, values)\n listPagos = self.conexion.cursor.fetchall()\n self.conexion.cerrarConexion()\n\n return listPagos\n\n def selectListTransaccionCliente(self, cliente):\n query = \"\"\"\n SELECT m.fecha, SUM(dm.precio_unitario * dm.cantidad) as monto, tm.tipo_movimiento\n FROM clientes c, movimiento m, tipo_movimiento tm, detalle_movimiento dm\n WHERE c.idclientes = tm.clientes_idclientes and\n m.tipo_movimiento_idtipo_movimiento = tm.idtipo_movimiento and\n m.idmovimiento = dm.movimiento_idmovimiento and m.estado = 0 and\n c.idclientes = %s\n GROUP BY m.fecha\n \"\"\"\n values = cliente.getIdCliente()\n\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(query, values)\n listTransacciones = self.conexion.cursor.fetchall()\n self.conexion.cerrarConexion()\n\n return listTransacciones\n\n def cargarCobranza(self, cliente, monto):\n hoy = datetime.datetime.now().date()\n\n self.conexion.abrirConexion()\n\n queryTipoMovimiento = \"\"\"\n INSERT INTO tipo_movimiento (tipo_movimiento, clientes_idclientes)\n VALUES ('pago', %s)\n \"\"\"\n valuesTipoMovimiento = cliente.getIdCliente()\n\n self.conexion.cursor.execute(queryTipoMovimiento, valuesTipoMovimiento)\n self.conexion.db.commit()\n idTipoMovimiento = self.conexion.cursor.lastrowid\n cantRowAffect = self.conexion.cursor.rowcount\n self.conexion.cerrarConexion()\n\n queryPagos = \"\"\"\n INSERT INTO pagos (fecha, monto, tipo_movimiento_idtipo_movimiento)\n VALUES (%s, %s, %s);\n\n \"\"\"\n valuesPagos = (hoy, monto, idTipoMovimiento)\n self.conexion.abrirConexion()\n self.conexion.cursor.execute(queryPagos, valuesPagos)\n self.conexion.db.commit()\n idRecibo = self.conexion.cursor.lastrowid\n self.conexion.cerrarConexion()\n\n return idRecibo\n\n def cargarPago(self, proveedor, monto):\n hoy = datetime.datetime.now().date()\n\n self.conexion.abrirConexion()\n\n queryTipoMovimiento = \"\"\"\n INSERT INTO tipo_movimiento (tipo_movimiento, proveedores_idproveedores)\n VALUES ('pago', %s)\n \"\"\"\n valuesTipoMovimiento = proveedor.getIdProveedor()\n\n self.conexion.cursor.execute(queryTipoMovimiento, valuesTipoMovimiento)\n self.conexion.db.commit()\n idTipoMovimiento = self.conexion.cursor.lastrowid\n cantRowAffect = self.conexion.cursor.rowcount\n\n\n queryPagos = \"\"\"\n INSERT INTO pagos (fecha, monto, tipo_movimiento_idtipo_movimiento)\n VALUES (%s, %s, %s);\n\n \"\"\"\n valuesPagos = (hoy, monto, idTipoMovimiento)\n\n self.conexion.cursor.execute(queryPagos, valuesPagos)\n self.conexion.db.commit()\n idRecibo = self.conexion.cursor.lastrowid\n self.conexion.cerrarConexion()\n\n return idRecibo" }, { "alpha_fraction": 0.6774193644523621, "alphanum_fraction": 0.7137096524238586, "avg_line_length": 23.899999618530273, "blob_id": "e136aee0f102cdd7412fbf7255a59c7334140dd7", "content_id": "fa9d5fd439cd1041d393ef384c4101a43a73850d", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 248, "license_type": "no_license", "max_line_length": 104, "num_lines": 10, "path": "/dados/pd-002.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport pandas as pd\nimport matplotlib.pyplot as plt\n\ndataset = pd.read_csv('sih-janeiro-2017-cirurgias-eletiva-e-emergencia.csv', sep=';', encoding='cp1252')\n\nprint(type(dataset))\nprint(dataset.head())" }, { "alpha_fraction": 0.47204160690307617, "alphanum_fraction": 0.5357607007026672, "avg_line_length": 27.481481552124023, "blob_id": "8f88e991feb1d2cf9f98bf6487d2d033071c0408", "content_id": "4492af236eff4aa2e983034e070713b3b4e8e677", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3076, "license_type": "permissive", "max_line_length": 69, "num_lines": 108, "path": "/opencv/tictactoeOpenCV/tictactoeOpenCV-master/play.py", "repo_name": "JoaoBueno/estudos-python", "src_encoding": "UTF-8", "text": "#\n# Jogo da Velha utilizando Visao Computacional e Realidade aumentada.\n# Definicao de funcoes auxiliares\n#\n\nimport numpy as np\n\n\n# Funcao que verifica se e o fim do jogo.\ndef won(tabuleiro):\n if (tabuleiro[0] == tabuleiro[1] == tabuleiro[2] == 0):\n return 1\n elif (tabuleiro[0] == tabuleiro[3] == tabuleiro[6] == 0):\n return 1\n elif (tabuleiro[6] == tabuleiro[7] == tabuleiro[8] == 0):\n return 1\n elif (tabuleiro[2] == tabuleiro[5] == tabuleiro[8] == 0):\n return 1\n elif (tabuleiro[3] == tabuleiro[4] == tabuleiro[5] == 0):\n return 1\n elif (tabuleiro[1] == tabuleiro[4] == tabuleiro[7] == 0):\n return 1\n elif (tabuleiro[0] == tabuleiro[4] == tabuleiro[8] == 0):\n return 1\n elif (tabuleiro[2] == tabuleiro[4] == tabuleiro[6] == 0):\n return 1\n\n elif (tabuleiro[0] == tabuleiro[1] == tabuleiro[2] == 1):\n return 2\n elif (tabuleiro[0] == tabuleiro[3] == tabuleiro[6] == 1):\n return 2\n elif (tabuleiro[6] == tabuleiro[7] == tabuleiro[8] == 1):\n return 2\n elif (tabuleiro[2] == tabuleiro[5] == tabuleiro[8] == 1):\n return 2\n elif (tabuleiro[3] == tabuleiro[4] == tabuleiro[5] == 1):\n return 2\n elif (tabuleiro[1] == tabuleiro[4] == tabuleiro[7] == 1):\n return 2\n elif (tabuleiro[0] == tabuleiro[4] == tabuleiro[8] == 1):\n return 2\n elif (tabuleiro[2] == tabuleiro[4] == tabuleiro[6] == 1):\n return 2\n\n else:\n if -1 not in tabuleiro:\n return 3\n else:\n return 0\n\n\n# Realiza um movimento em uma posicao livre no tabuleiro.\ndef move(tabuleiro, posicao, peca):\n if tabuleiro[posicao] == -1:\n tabuleiro[posicao] = peca\n\n\n\n# funcao para localizar os cantos do tabuleiro.\ndef canto(y1, x1, y2, x2, y3, x3, y4, x4, h, w, k):\n if k == \"TL\":\n yc, xc = 0, 0\n if k == \"TR\":\n yc, xc = 0, w\n if k == \"BL\":\n yc, xc = h, 0\n if k == \"BR\":\n yc, xc = h, w\n\n d1 = np.sqrt(np.power(y1-yc,2)+ np.power(x1-xc,2))\n d2 = np.sqrt(np.power(y2-yc,2)+ np.power(x2-xc,2))\n d3 = np.sqrt(np.power(y3-yc,2)+ np.power(x3-xc,2))\n d4 = np.sqrt(np.power(y4-yc,2)+ np.power(x4-xc,2))\n d = [d1,d2,d3,d4]\n\n if min(d) == d1:\n return 0\n if min(d) == d2:\n return 1\n if min(d) == d3:\n return 2\n if min(d) == d4:\n return 3\n\n\n\n# funcao utilizada para ordenar os pontos do tabuleiro.\n# Utilizada para auxiliar na transformacao de perspectiva.\ndef ordena(aprox, shape):\n ord = np.copy(aprox)\n h,w = shape\n\n y1,x1 = aprox[0][0][0],aprox[0][0][1]\n y2,x2 = aprox[1][0][0],aprox[1][0][1]\n y3,x3 = aprox[2][0][0],aprox[2][0][1]\n y4,x4 = aprox[3][0][0],aprox[3][0][1]\n\n TL = canto(y1, x1, y2, x2, y3, x3, y4, x4, h, w, \"TL\")\n TR = canto(y1, x1, y2, x2, y3, x3, y4, x4, h, w, \"TR\")\n BL = canto(y1, x1, y2, x2, y3, x3, y4, x4, h, w, \"BL\")\n BR = canto(y1, x1, y2, x2, y3, x3, y4, x4, h, w, \"BR\")\n\n ord[1] = aprox[TL]\n ord[3] = aprox[TR]\n ord[0] = aprox[BL]\n ord[2] = aprox[BR]\n\n return ord\n" } ]
315
vmchura/financialAnalysis
https://github.com/vmchura/financialAnalysis
4c002cdb6d5187266b3e950743dfe23a60717199
3e9a3798d0f915f20cf3c5631ec6577b23675879
454b21ad671659f37e2c25714a7ab4654f24daf0
refs/heads/master
2020-04-01T22:37:21.636529
2014-09-04T21:04:23
2014-09-04T21:04:23
null
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.7682926654815674, "alphanum_fraction": 0.7682926654815674, "avg_line_length": 53.33333206176758, "blob_id": "702991a8e65ef340aae8f4409947f6902e43fe39", "content_id": "86a971f9ea14dbc5532a548de761bf42f79451e2", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 164, "license_type": "no_license", "max_line_length": 138, "num_lines": 3, "path": "/financialCrawler/README.md", "repo_name": "vmchura/financialAnalysis", "src_encoding": "UTF-8", "text": "Description\n===========\nThe financial analysis project covered here is basically a data analysis project wich includes most of the steps of this sort of analysis.\n\n" }, { "alpha_fraction": 0.5225170850753784, "alphanum_fraction": 0.5345798134803772, "avg_line_length": 38.47618865966797, "blob_id": "94c758dd2136041d27bc907369875f4ece0ee5ed", "content_id": "ae9bae4b496fb18cd78c2faf618029a2652f6b2a", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 4974, "license_type": "no_license", "max_line_length": 99, "num_lines": 126, "path": "/financialCrawler/financialCrawler/spiders/yahooSpider.py", "repo_name": "vmchura/financialAnalysis", "src_encoding": "UTF-8", "text": "# yahooSpider crawl Fortune 500 companies' listed on Yahoo finance\n\nfrom scrapy.spider import Spider\nfrom scrapy.selector import Selector\nfrom scrapy.http import Request\nfrom financialCrawler.items import yahooItem\n\nURL_BASE = \"http://finance.yahoo.com\"\ncompanies = [\"EXC\",\"DUK\",\"SO\",\"AES\",\"PCG\",\"AEP\",\"NEE\",\"FE\",\"D\",\"EIX\",\"ED\",\"PPL\",\"ETR\",\n \"XEL\",\"SRE\",\"PEG\",\"DTE\",\"CNP\",\"NU\",\"AEE\",\"CMS\",\"NI\",\"TEG\",\"GAS\",\"WEC\",\"SCG\",\n \"POM\",\"ATO\",\"PNW\",\"LNT\",\"HE\",\"OGE\",\"TE\",\"VVC\",\"GXP\",\"WR\", \"SWX\"]\n\nfinancial = []\nfinancial_temp = []\n\n\ndef clean_data(finance):\n raw_data = finance\n finance = [int(''.join(''.join(x).strip().strip('(').strip(')').split(','))) for x in raw_data]\n return finance\n\n\n# __author__ = 'williamn'\n# Spider Beginning\nclass YahooSpider(Spider):\n name = \"yahooSpider\"\n allowed_domains = [\"finance.yahoo.com\"]\n start_urls = [\n \"http://finance.yahoo.com/q?s=%s\" %s for s in companies\n ]\n\n def parse(self, response):\n sel = Selector(response)\n links = sel.xpath('//*[@id=\"yfi_investing_nav\"]/div[2]/ul[7]/li/a/@href').extract()\n company = sel.xpath('//*[@id=\"yfi_rt_quote_summary\"]/div[1]/div/h2/text()').extract()\n\n requests = []\n\n for site in range(len(links)):\n item = yahooItem()\n\n item['url'] = URL_BASE + links[site]\n item['company'] = str(''.join(company))\n request = Request(url=item['url'], callback=self.parseFinance)\n\n #if 'data_required' in item:\n # temp = item['data_required']\n # temp.extend(financial_temp)\n # item['data_required'] = temp\n #else:\n # item['data_required'] = financial_temp\n\n #item['data_required'] = clean_data(item['data_required'])\n\n #item['data_required'] = list(set(item['data_required']))\n request.meta['item'] = item\n requests.append(request)\n\n print len(requests)+1000\n return requests\n\n def parseFinance(self, response):\n sel = Selector(response)\n item = response.meta['item']\n data = sel.xpath('//*[@id=\"yfncsumtab\"]/tr[2]/td/table[2]/tr/td/table')\n\n index_interrogation = item['url'].find(\"?\")\n data_finance = item['url'][index_interrogation - 2: index_interrogation]\n\n financial = []\n\n for d in data:\n if data_finance == \"is\":\n print \"Income Statement!\"\n #year2013 = d.xpath('tr[1]/th[1]/text()').extract()\n #year2012 = d.xpath('tr[1]/th[2]/text()').extract()\n #year2011 = d.xpath('tr[1]/th[3]/text()').extract()\n\n print \"Revenue GrossProfit OperatingIncome NetIncome\"\n\n for tab in range(2,5):\n revenue = d.xpath('tr[2]/td['+str(tab)+']/strong/text()').extract()\n grossProfit = d.xpath('tr[5]/td['+str(tab)+']/strong/text()').extract()\n operatingIncome = d.xpath('tr[16]/td['+str(tab)+']/strong/text()').extract()\n netIncome = d.xpath('tr[35]/td['+str(tab)+']/strong/text()').extract()\n\n\n financial.append(revenue)\n financial.append(grossProfit)\n financial.append(operatingIncome)\n financial.append(netIncome)\n\n if data_finance == \"bs\":\n print \"Balance Sheet!!\"\n\n print \"totalAssets TotalLIabilities totalSHEQUITY netTangibleAssets\"\n\n for tab in range(2,5):\n totalAssets = d.xpath('tr[20]/td['+str(tab)+']/strong/text()').extract()\n totalLiabilities = d.xpath('tr[35]/td['+str(tab)+']/strong/text()').extract()\n totalSHEquity= d.xpath('tr[47]/td['+str(tab)+']/strong/text()').extract()\n netTangibleAs = d.xpath('tr[49]/td['+str(tab)+']/strong/text()').extract()\n\n financial.append(totalAssets)\n financial.append(totalLiabilities)\n financial.append(totalSHEquity)\n financial.append(netTangibleAs)\n\n if data_finance==\"cf\":\n print \"Cash Flow xD!\"\n print \"totalCFOA totalCFIA totalCFFA ChangeCash\"\n for tab in range(2,5):\n totalCFOA = d.xpath('tr[12]/td['+str(tab)+']/strong/text()').extract()\n totalCFIA = d.xpath('tr[19]/td['+str(tab)+']/strong/text()').extract()\n totalCFFA = d.xpath('tr[27]/td['+str(tab)+']/strong/text()').extract()\n changeCash = d.xpath('tr[30]/td['+str(tab)+']/strong/text()').extract()\n\n financial.append(totalCFOA)\n financial.append(totalCFIA)\n financial.append(totalCFFA)\n financial.append(changeCash)\n\n\n financial_temp = clean_data(financial)\n item['rawData'] = financial_temp\n return item\n" } ]
2
irvingperez11/cs10aspr
https://github.com/irvingperez11/cs10aspr
3b1132987c128bd8c686f96d07dceb9dc42b003d
51c33ce070c52219ed11f50b2506e3cd2cdcb6fd
52da9aa25c768e9950810b8711c1e0cd8d645764
refs/heads/master
2021-04-08T16:01:41.593396
2020-03-20T15:35:22
2020-03-20T15:35:22
248,787,732
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.3987341821193695, "alphanum_fraction": 0.6518987417221069, "avg_line_length": 10.285714149475098, "blob_id": "02b60eff6088c81902ad22ab9afe48b9904d7af9", "content_id": "abc07ef3e2ca65b0fdf8f0916585a98ae776ddcf", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 158, "license_type": "no_license", "max_line_length": 48, "num_lines": 14, "path": "/pa12.py", "repo_name": "irvingperez11/cs10aspr", "src_encoding": "UTF-8", "text": "<<<<<<< HEAD\nprint(\"Hello World\")\n=======\n#!/usr/bin/python\n\nprint(100)\n\n\nprint(100)\n\nprint(100)\n\nprint(100)\n>>>>>>> 6f9fc6e706444015c1b28c363314b1a40a97a93f\n" } ]
1
JeanCASPAR/Platformer-2D
https://github.com/JeanCASPAR/Platformer-2D
360b2ca445f5e36445ac55ebd53092a91e0ed012
33b1fc4bae5a90f237c24d840fba0d31a58f21dd
3287fe900cdb375e7b3f363037cb6007e2eade68
refs/heads/master
2021-03-21T01:56:04.000703
2020-02-26T07:01:27
2020-02-26T07:01:27
247,253,763
1
0
null
2020-03-14T10:14:14
2020-02-26T07:01:31
2020-02-26T07:01:28
null
[ { "alpha_fraction": 0.5156402587890625, "alphanum_fraction": 0.528836727142334, "avg_line_length": 33.6779670715332, "blob_id": "fc538b07e16fb7724fad87ef1b38f1f6a93823b8", "content_id": "d71318c71d4ec0d0de614aff482ba9eb3186b8d9", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Rust", "length_bytes": 2046, "license_type": "no_license", "max_line_length": 100, "num_lines": 59, "path": "/src/systems/player_input.rs", "repo_name": "JeanCASPAR/Platformer-2D", "src_encoding": "UTF-8", "text": "//! The system which handle the player input\n\nuse amethyst::{\n core::SystemDesc,\n derive::SystemDesc,\n ecs::prelude::*,\n input::{InputHandler, StringBindings},\n renderer::sprite::SpriteRender,\n};\nuse nphysics2d::object::DefaultBodySet;\n\nuse crate::components::{Player, RigidBodyComponent};\n\n#[derive(Default, SystemDesc)]\npub struct PlayerInputSystem;\n\nimpl<'s> System<'s> for PlayerInputSystem {\n #[allow(clippy::type_complexity)]\n type SystemData = (\n ReadStorage<'s, Player>,\n WriteStorage<'s, SpriteRender>,\n Read<'s, InputHandler<StringBindings>>,\n WriteExpect<'s, DefaultBodySet<f32>>,\n ReadStorage<'s, RigidBodyComponent>,\n );\n\n fn run(&mut self, (players, mut sprites, input, mut body_set, rigid_bodies): Self::SystemData) {\n for (_player, sprite, rigid_body) in (&players, &mut sprites, &rigid_bodies).join() {\n let movement = input.axis_value(\"movement\");\n let body = body_set.rigid_body_mut(rigid_body.handle).unwrap();\n\n if let Some(mv_amount) = movement {\n if mv_amount != 0.0 {\n let scaled_amount = 10.0 * mv_amount as f32;\n sprite.sprite_number = match sprite.sprite_number {\n 0 => 1,\n 1 => 2,\n 2 => 1,\n _ => unreachable!(),\n };\n\n let velocity = body.velocity().linear + na::Vector2::new(scaled_amount, 0.0);\n body.set_linear_velocity(velocity);\n } else {\n sprite.sprite_number = 0;\n }\n } else {\n sprite.sprite_number = 0;\n }\n\n let jump = input.action_is_down(\"jump\").unwrap_or(false);\n let is_on_ground = true;\n if jump && is_on_ground {\n let velocity = body.velocity().linear + na::Vector2::new(0.0, 10.0);\n body.set_linear_velocity(velocity);\n }\n }\n }\n}\n" }, { "alpha_fraction": 0.5332348346710205, "alphanum_fraction": 0.5967503786087036, "avg_line_length": 20.15625, "blob_id": "08be49e0ff21e6ec6f63ac93ada8466aa4f930f4", "content_id": "d1256217214cc9ff3dd29e81e5f9173e75648c4b", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Rust", "length_bytes": 677, "license_type": "no_license", "max_line_length": 52, "num_lines": 32, "path": "/src/prefabs/player.rs", "repo_name": "JeanCASPAR/Platformer-2D", "src_encoding": "UTF-8", "text": "//! The player prefab\nuse amethyst::{\n assets::{PrefabData, ProgressCounter},\n derive::PrefabData,\n ecs::Entity,\n Error,\n};\nuse serde::{Deserialize, Serialize};\n\nuse super::{F32, F32F32};\n\n#[derive(Deserialize, Serialize, PrefabData, Debug)]\n#[prefab(PrefabData)]\n#[serde(default)]\n#[serde(deny_unknown_fields)]\npub struct PlayerPrefab {\n pub mass: F32,\n pub friction: F32,\n pub bounciness: F32,\n pub pos: F32F32,\n}\n\nimpl Default for PlayerPrefab {\n fn default() -> Self {\n PlayerPrefab {\n mass: F32(100.0),\n friction: F32(0.95),\n bounciness: F32(0.95),\n pos: F32F32(100.0, 50.0),\n }\n }\n}\n" }, { "alpha_fraction": 0.8134328126907349, "alphanum_fraction": 0.8208954930305481, "avg_line_length": 134, "blob_id": "afd2d187a599f7595370813dffa86e4023ed38ea", "content_id": "2d51f9ca3e498f882a9eb53f510167881ab4e8be", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 134, "license_type": "no_license", "max_line_length": 134, "num_lines": 1, "path": "/readme.md", "repo_name": "JeanCASPAR/Platformer-2D", "src_encoding": "UTF-8", "text": "Platformer-2D (the name is not definitive) is a platformer game made with the Amethyst game engine with the Rust programming language." }, { "alpha_fraction": 0.6713513731956482, "alphanum_fraction": 0.6810810565948486, "avg_line_length": 26.205883026123047, "blob_id": "04e17ffa0634ce7a1245053b32bb5fa0000bb9c9", "content_id": "c33d0df064ed352d5fc707b36237031817c3104d", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Rust", "length_bytes": 925, "license_type": "no_license", "max_line_length": 89, "num_lines": 34, "path": "/src/components/physics.rs", "repo_name": "JeanCASPAR/Platformer-2D", "src_encoding": "UTF-8", "text": "use amethyst::ecs::{Component, VecStorage, World, WorldExt};\nuse nphysics2d::object::*;\n\npub struct RigidBodyComponent {\n pub handle: DefaultBodyHandle,\n}\n\nimpl RigidBodyComponent {\n pub fn new(rigid_body: RigidBody<f32>, world: &World) -> Self {\n let mut body_set = world.write_resource::<DefaultBodySet<f32>>();\n let handle = body_set.insert(rigid_body);\n Self { handle }\n }\n}\n\nimpl Component for RigidBodyComponent {\n type Storage = VecStorage<Self>;\n}\n\npub struct ColliderComponent {\n pub handle: DefaultColliderHandle,\n}\n\nimpl ColliderComponent {\n pub fn new(rigid_body: Collider<f32, DefaultColliderHandle>, world: &World) -> Self {\n let mut collider_set = world.write_resource::<DefaultColliderSet<f32>>();\n let handle = collider_set.insert(rigid_body);\n Self { handle }\n }\n}\n\nimpl Component for ColliderComponent {\n type Storage = VecStorage<Self>;\n}\n" }, { "alpha_fraction": 0.740634024143219, "alphanum_fraction": 0.740634024143219, "avg_line_length": 27.91666603088379, "blob_id": "eac2a2250f4ce460388815b3706ce04043702f22", "content_id": "39f93398dc9e9611c08c47630041e1d7051c087a", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Rust", "length_bytes": 347, "license_type": "no_license", "max_line_length": 64, "num_lines": 12, "path": "/src/components/movable.rs", "repo_name": "JeanCASPAR/Platformer-2D", "src_encoding": "UTF-8", "text": "//! The movable component\n//! All entities with this component can be moved by the physics\n\nuse amethyst::ecs::{Component, NullStorage};\n\n// A component that permitted the entity to be affect by physics\n#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]\npub struct Movable;\n\nimpl Component for Movable {\n type Storage = NullStorage<Self>;\n}\n" }, { "alpha_fraction": 0.738161563873291, "alphanum_fraction": 0.738161563873291, "avg_line_length": 28.91666603088379, "blob_id": "a48cd98c437dd01fd8e2968d8d81464259acb6ef", "content_id": "d8ee8a4b4386c4fcda844ba2ce26ac2553e3ff33", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Rust", "length_bytes": 359, "license_type": "no_license", "max_line_length": 68, "num_lines": 12, "path": "/src/components/player.rs", "repo_name": "JeanCASPAR/Platformer-2D", "src_encoding": "UTF-8", "text": "//! The player component\n//! All entities with this component can be controlled by the player\n\nuse amethyst::ecs::prelude::{Component, NullStorage};\n\n/// Basic component for the player, making him movable by the user\n#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]\npub struct Player;\n\nimpl Component for Player {\n type Storage = NullStorage<Self>;\n}\n" }, { "alpha_fraction": 0.5821764469146729, "alphanum_fraction": 0.5888938903808594, "avg_line_length": 28.773332595825195, "blob_id": "dd87a451117a92ad14b110727cf02df2424a5e84", "content_id": "89d2a540f1124505e24a1e1ddaf3b9db4cd5375a", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Rust", "length_bytes": 2233, "license_type": "no_license", "max_line_length": 98, "num_lines": 75, "path": "/src/main.rs", "repo_name": "JeanCASPAR/Platformer-2D", "src_encoding": "UTF-8", "text": "#![allow(dead_code)]\n#![warn(clippy::all)]\n\nextern crate nalgebra as na;\n\nmod components;\nmod game;\nmod load;\nmod menu;\nmod prefabs;\nmod systems;\nmod tiles;\n\nuse amethyst::StateEventReader;\nuse amethyst::{\n assets::PrefabLoaderSystemDesc,\n audio::AudioBundle,\n core::{frame_limiter::FrameRateLimitStrategy, transform::TransformBundle},\n input::{InputBundle, StringBindings},\n prelude::*,\n renderer::{\n plugins::{RenderFlat2D, RenderToWindow},\n types::DefaultBackend,\n RenderingBundle,\n },\n tiles::{MortonEncoder2D, RenderTiles2D},\n ui::{RenderUi, UiBundle},\n utils::application_root_dir,\n};\n\nuse crate::{\n load::LoadState,\n prefabs::PlayerPrefab,\n tiles::{DrawTilesBounds, MiscTile},\n};\n\nfn main() -> amethyst::Result<()> {\n amethyst::start_logger(Default::default());\n\n let app_root = application_root_dir()?;\n let display_config_path = app_root.join(\"config\").join(\"display.ron\");\n let binding_path = app_root.join(\"config\").join(\"bindings.ron\");\n\n let game_data = GameDataBuilder::new()\n .with_bundle(\n RenderingBundle::<DefaultBackend>::new()\n .with_plugin(\n RenderToWindow::from_config_path(display_config_path)\n .with_clear([0.0, 0.0, 0.0, 1.0]),\n )\n .with_plugin(RenderFlat2D::default())\n .with_plugin(RenderUi::default())\n .with_plugin(\n RenderTiles2D::<MiscTile, _, _>::default(),\n ),\n )?\n .with_bundle(TransformBundle::new())?\n .with_bundle(InputBundle::<StringBindings>::new().with_bindings_from_file(binding_path)?)?\n .with_bundle(UiBundle::<StringBindings>::new())?\n .with_bundle(AudioBundle::default())?\n .with_system_desc(\n PrefabLoaderSystemDesc::<PlayerPrefab>::default(),\n \"player_loader\",\n &[],\n );\n\n let assets_dir = app_root.join(\"assets\");\n let mut game =\n ApplicationBuilder::<_, _, _, StateEventReader>::new(assets_dir, LoadState::default())?\n .with_frame_limit(FrameRateLimitStrategy::Yield, 24)\n .build(game_data)?;\n\n game.run();\n Ok(())\n}\n" }, { "alpha_fraction": 0.5551724433898926, "alphanum_fraction": 0.6034482717514038, "avg_line_length": 23.25, "blob_id": "c47113189bb6da101e622f7b8b2fbb12915bf91a", "content_id": "52237b35f4a432c121fff54aca7f4a1510f3ff98", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 290, "license_type": "no_license", "max_line_length": 52, "num_lines": 12, "path": "/scripts/color.py", "repo_name": "JeanCASPAR/Platformer-2D", "src_encoding": "UTF-8", "text": "import numpy as np\nfrom PIL import Image\n\nfile = \"assets/tiles/tileset.png\"\nim = Image.open(file).convert(mode=\"RGBA\")\n\nfor x in range(im.width):\n for y in range(im.height):\n if im.getpixel((x,y)) == (46, 196, 24, 255):\n im.putpixel((x, y), (0, 0, 0, 0))\n\nim.save(file)" }, { "alpha_fraction": 0.5645981431007385, "alphanum_fraction": 0.5808748602867126, "avg_line_length": 19.914894104003906, "blob_id": "db2180d55a9505ccac47659c8038937c9ba6ead3", "content_id": "2ccfe85840a27b2deca6d1722c24ba984a5fb568", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Rust", "length_bytes": 983, "license_type": "no_license", "max_line_length": 62, "num_lines": 47, "path": "/src/components/damageable.rs", "repo_name": "JeanCASPAR/Platformer-2D", "src_encoding": "UTF-8", "text": "//! The damageable component\n//! All the entities that could receive damage should have it\n\nuse amethyst::ecs::prelude::*;\nuse serde::{Deserialize, Serialize};\n\n/// Component for entities that have a life and can be damaged\n#[derive(Deserialize, Serialize)]\n/*#[prefab(Component)]*/\n#[serde(deny_unknown_fields)]\npub struct Damageable {\n life: i32,\n max_life: i32,\n}\n\nimpl Component for Damageable {\n type Storage = DenseVecStorage<Self>;\n}\n\nimpl Damageable {\n pub fn new(life: i32) -> Self {\n Self {\n life,\n max_life: life,\n }\n }\n\n pub fn life(&self) -> i32 {\n self.life\n }\n\n pub fn max_life(&self) -> i32 {\n self.max_life\n }\n\n pub fn is_alive(&self) -> bool {\n self.life != 0\n }\n\n pub fn heal(&mut self, amount: i32) {\n self.life = (self.life + amount).max(self.max_life);\n }\n\n pub fn damage(&mut self, amount: i32) {\n self.life = (self.life - amount).min(0);\n }\n}\n" }, { "alpha_fraction": 0.4829931855201721, "alphanum_fraction": 0.49645543098449707, "avg_line_length": 34.08794021606445, "blob_id": "51b514aeebbde166e6a3277429769ca95b6aacdb", "content_id": "ae620188874d768ffe8d27ee116e1a5d1a2012cc", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Rust", "length_bytes": 13965, "license_type": "no_license", "max_line_length": 134, "num_lines": 398, "path": "/src/game.rs", "repo_name": "JeanCASPAR/Platformer-2D", "src_encoding": "UTF-8", "text": "//! The game state\n\nuse amethyst::{\n assets::{AssetStorage, Handle, Prefab, ProgressCounter},\n core::{math, Parent, SystemBundle, Time, Transform},\n ecs::prelude::*,\n prelude::*,\n renderer::{\n sprite::{SpriteRender, SpriteSheet},\n Camera,\n },\n tiles::{Tile, TileMap},\n utils::application_root_dir,\n window::ScreenDimensions,\n};\nuse ncollide2d::shape::{Capsule, Compound, ConvexPolygon, Cuboid, Polyline, Shape, ShapeHandle};\nuse nphysics2d::{\n force_generator::DefaultForceGeneratorSet,\n joint::DefaultJointConstraintSet,\n material::{BasicMaterial, MaterialHandle},\n object::{\n BodyPartHandle, BodyStatus, ColliderDesc, DefaultBodySet, DefaultColliderSet, RigidBodyDesc,\n },\n world::{DefaultGeometricalWorld, DefaultMechanicalWorld},\n};\nuse tiled::{Map, ObjectShape};\n\nuse std::sync::Arc;\n\nuse crate::{\n components::{ColliderComponent, Damageable, Player, RigidBodyComponent, Team},\n prefabs::PlayerPrefab,\n systems::physics::PhysicsBundle,\n tiles::{load_map, MiscTile},\n};\n\n#[derive(Clone)]\npub struct Ellipse {\n a: f32, // The first radius\n b: f32, // The second radius\n}\n\nimpl Ellipse {\n pub fn new(a: f32, b: f32) -> Self {\n Self { a, b }\n }\n}\n\nuse ncollide2d::{\n bounding_volume::{self, AABB},\n shape::{FeatureId, SupportMap},\n};\n\nimpl SupportMap<f32> for Ellipse {\n fn support_point(\n &self,\n transform: &na::Isometry2<f32>,\n dir: &na::Vector2<f32>,\n ) -> na::Point2<f32> {\n // Bring `dir` into the ellipse's local frame.\n let local_dir = transform.inverse_transform_vector(dir);\n\n // Compute the denominator.\n let denom = f32::sqrt(\n local_dir.x * local_dir.x * self.a * self.a\n + local_dir.y * local_dir.y * self.b * self.b,\n );\n\n // Compute the support point into the ellipse's local frame.\n let local_support_point = na::Point2::new(\n self.a * self.a * local_dir.x / denom,\n self.b * self.b * local_dir.y / denom,\n );\n\n // Return the support point transformed back into the global frame.\n *transform * local_support_point\n }\n}\n\nimpl Shape<f32> for Ellipse {\n fn aabb(&self, m: &na::Isometry2<f32>) -> AABB<f32> {\n // Generic method to compute the aabb of a support-mapped shape.\n bounding_volume::support_map_aabb(m, self)\n }\n\n fn as_support_map(&self) -> Option<&dyn SupportMap<f32>> {\n Some(self)\n }\n\n fn tangent_cone_contains_dir(\n &self,\n _feature: FeatureId,\n _isometry: &na::Isometry2<f32>,\n _deformation: Option<&[f32]>,\n _dir: &na::Unit<na::Vector2<f32>>,\n ) -> bool {\n false\n }\n}\n\n/// The game state\n#[derive(Default)]\npub struct GameState<'a, 'b> {\n pub progress: ProgressCounter,\n pub player_prefab: Option<Handle<Prefab<PlayerPrefab>>>,\n pub player_sprite_sheet: Option<Handle<SpriteSheet>>,\n pub tile_map_sprite_sheet: Option<Handle<SpriteSheet>>,\n dispatcher: Option<Dispatcher<'a, 'b>>,\n}\n\nimpl<'a, 'b> SimpleState for GameState<'a, 'b> {\n fn on_start(&mut self, data: StateData<'_, GameData<'_, '_>>) {\n let world = data.world;\n\n let mut dispatcher_builder = DispatcherBuilder::new();\n let bundle = PhysicsBundle;\n bundle.build(world, &mut dispatcher_builder).unwrap();\n let mut dispatcher = dispatcher_builder.build();\n dispatcher.setup(world);\n self.dispatcher = Some(dispatcher);\n\n world.register::<Damageable>();\n world.register::<Team>();\n world.register::<Player>();\n world.register::<RigidBodyComponent>();\n world.register::<ColliderComponent>();\n\n self.initialise_physics(world);\n let player = self.initialise_player(world, self.player_sprite_sheet.clone().unwrap());\n self.initialise_camera(world, player);\n self.initialise_map(world);\n\n let mut time = world.write_resource::<Time>();\n time.set_fixed_seconds(1.0 / 60.0);\n }\n\n fn handle_event(\n &mut self,\n _data: StateData<'_, GameData<'_, '_>>,\n _event: StateEvent,\n ) -> SimpleTrans {\n Trans::None\n }\n\n fn update(&mut self, data: &mut StateData<GameData>) -> SimpleTrans {\n data.data.update(&data.world);\n if let Some(dispatcher) = self.dispatcher.as_mut() {\n dispatcher.dispatch(&data.world);\n }\n Trans::None\n }\n}\n\nimpl<'a, 'b> GameState<'a, 'b> {\n pub fn new(\n progress: ProgressCounter,\n player_prefab: Option<Handle<Prefab<PlayerPrefab>>>,\n player_sprite_sheet: Option<Handle<SpriteSheet>>,\n tile_map_sprite_sheet: Option<Handle<SpriteSheet>>,\n ) -> Self {\n Self {\n progress,\n player_prefab,\n player_sprite_sheet,\n tile_map_sprite_sheet,\n dispatcher: None,\n }\n }\n\n fn initialise_physics(&self, world: &mut World) {\n let mut mechanical_world =\n DefaultMechanicalWorld::<f32>::new(na::Vector2::new(0.0, -9.81 * 10.0));\n mechanical_world.set_timestep(1.0 / 60.0);\n let geometrical_world = DefaultGeometricalWorld::<f32>::new();\n\n world.insert(mechanical_world);\n world.insert(geometrical_world);\n\n let bodies = DefaultBodySet::<f32>::new();\n let colliders = DefaultColliderSet::<f32>::new();\n let joint_constraints = DefaultJointConstraintSet::<f32>::new();\n let force_generators = DefaultForceGeneratorSet::<f32>::new();\n\n world.insert(bodies);\n world.insert(colliders);\n world.insert(joint_constraints);\n world.insert(force_generators);\n }\n\n fn initialise_player(\n &mut self,\n world: &mut World,\n sprite_sheet: Handle<SpriteSheet>,\n ) -> Entity {\n let damageable = Damageable::new(100);\n let sprite_render = SpriteRender {\n sprite_sheet: sprite_sheet.clone(),\n sprite_number: 0,\n };\n let (mass, friction, bounciness, pos) = {\n let mut storage = world.write_resource::<AssetStorage<Prefab<PlayerPrefab>>>();\n let prefab = storage\n .get_mut(&self.player_prefab.clone().unwrap())\n .map(|e| e.entity(0))\n .unwrap()\n .map(|e| e.data())\n .unwrap()\n .unwrap();\n\n (\n prefab.mass.0,\n prefab.friction.0,\n prefab.bounciness.0,\n prefab.pos,\n )\n };\n let (half_height, radius) = (9.0, 5.0);\n\n let rigid_body = RigidBodyDesc::new()\n .translation(na::Vector2::new(pos.0, pos.1))\n .mass(mass)\n .local_center_of_mass(na::Point2::new(radius * 2.0, half_height))\n .kinematic_rotations(true)\n .build();\n let rigid_body_component = RigidBodyComponent::new(rigid_body, world);\n\n let shape = ShapeHandle::new(Capsule::new(half_height, radius));\n let collider = ColliderDesc::new(shape)\n .density(1.0)\n .material(MaterialHandle::new(BasicMaterial::new(\n bounciness, friction,\n )))\n .build(BodyPartHandle(rigid_body_component.handle, 0));\n let collider_component = ColliderComponent::new(collider, world);\n\n world\n .create_entity()\n .with(Transform::from(math::Vector3::new(\n pos.0 + radius * 2.0,\n pos.1 + half_height,\n 0.0,\n )))\n .with(damageable)\n .with(Team::Allies)\n .with(Player)\n .with(sprite_render)\n .with(collider_component)\n .with(rigid_body_component)\n .build()\n }\n\n fn initialise_camera(&self, world: &mut World, entity: Entity) {\n let mut transform = Transform::default();\n transform.set_translation_z(1.0);\n\n let (width, height) = {\n let dim = world.read_resource::<ScreenDimensions>();\n (dim.width() / 2.0, dim.height() / 2.0)\n };\n\n world\n .create_entity()\n .with(transform)\n .with(Parent::new(entity))\n .with(Camera::standard_2d(width, height))\n .build();\n }\n\n fn initialise_map(&mut self, world: &mut World) {\n let path = &*application_root_dir()\n .unwrap()\n .join(\"assets\")\n .join(\"tiles\")\n .join(\"map.tmx\");\n\n let map = load_map(path);\n\n let width = map.width;\n let height = map.height;\n let tile_width = map.tile_width;\n let tile_height = map.tile_height;\n println!(\"{} {} {} {}\", width, height, tile_width, tile_height);\n world.insert(map);\n\n let map_component = TileMap::<MiscTile>::new(\n math::Vector3::new(width, height, 1),\n math::Vector3::new(tile_width, tile_height, 1),\n self.tile_map_sprite_sheet.clone(),\n );\n\n world\n .create_entity()\n .with(Transform::default())\n .with(map_component)\n .build();\n\n let tiles = &world.read_resource::<Map>().tilesets[0].tiles;\n\n for (x, row) in world.read_resource::<Map>().layers[0]\n .tiles\n .iter()\n .enumerate()\n {\n for (y, _column) in row.iter().enumerate() {\n let transform = Transform::from(math::Vector3::new(\n (x as f32 * tile_width as f32) - (width as f32 * tile_width as f32) / 2.0,\n -((y as f32 * tile_height as f32) - (height as f32 * tile_height as f32) / 2.0), // because the y-axis is inverted\n 0.0,\n ));\n\n let tile = MiscTile.sprite(math::Point3::new(x as u32, y as u32, 0), &world);\n if tile.is_none()\n || tiles.get(tile.unwrap()).is_none()\n || tiles[tile.unwrap()].objectgroup.is_none()\n {\n continue;\n }\n\n let (rigid_body_component, collider);\n {\n let mut shapes = Vec::new();\n for object in &tiles[tile.unwrap()].objectgroup.as_ref().unwrap().objects {\n let shape: Option<Arc<dyn Shape<f32>>> = match &object.shape {\n ObjectShape::Rect { width, height } => Some(Arc::new(Cuboid::new(\n na::Vector2::new(width / 2.0, height / 2.0),\n ))),\n ObjectShape::Polygon { points } => Some(Arc::new(\n ConvexPolygon::try_from_points(\n &points\n .iter()\n .map(|point| na::Point2::new(point.0, point.1))\n .collect::<Vec<_>>(),\n )\n .unwrap_or_else(|| {\n panic!(\n \"can't build a ConvexHull from the given points : {:#?}\",\n points\n )\n }),\n )),\n ObjectShape::Polyline { points } => Some(Arc::new(Polyline::new(\n points\n .iter()\n .map(|point| na::Point2::new(point.0, point.1))\n .collect(),\n None,\n ))),\n ObjectShape::Ellipse { width, height } => {\n Some(Arc::new(Ellipse::new(width / 2.0, height / 2.0)))\n }\n };\n\n if let Some(shape) = shape {\n shapes.push((\n na::Isometry2::translation(object.x, object.y),\n ShapeHandle::from_arc(shape),\n ));\n }\n }\n\n let rigid_body = RigidBodyDesc::new()\n .translation(na::Vector2::new(\n (x as f32 * tile_width as f32)\n - (width as f32 * tile_width as f32) / 2.0,\n (y as f32 * tile_height as f32)\n - (height as f32 * tile_height as f32) / 2.0,\n ))\n .gravity_enabled(false)\n .status(BodyStatus::Static)\n .kinematic_translations(na::Vector2::new(true, true))\n .kinematic_rotations(true)\n .build();\n\n rigid_body_component = RigidBodyComponent::new(rigid_body, world);\n\n collider = if !shapes.is_empty() {\n let collider = ColliderDesc::new(ShapeHandle::new(Compound::new(shapes)))\n .material(MaterialHandle::new(BasicMaterial::new(0.0, 1.0)))\n .build(BodyPartHandle(rigid_body_component.handle, 0));\n Some(ColliderComponent::new(collider, world))\n } else {\n None\n };\n }\n\n let mut entity_builder = world.create_entity_unchecked().with(transform);\n\n if let Some(collider_component) = collider {\n entity_builder = entity_builder\n .with(rigid_body_component)\n .with(collider_component);\n }\n\n entity_builder.build();\n }\n }\n }\n}\n" }, { "alpha_fraction": 0.5542406439781189, "alphanum_fraction": 0.5542406439781189, "avg_line_length": 29.420000076293945, "blob_id": "74cb53503ee31abf47b6146699e0caf4f3126ca6", "content_id": "aeed3b5292cfcbec7fb4f1aff2f89499795c13e4", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Rust", "length_bytes": 3042, "license_type": "no_license", "max_line_length": 95, "num_lines": 100, "path": "/src/load.rs", "repo_name": "JeanCASPAR/Platformer-2D", "src_encoding": "UTF-8", "text": "//! Load all the assets\n\nuse amethyst::{\n assets::{\n Asset, AssetStorage, Format, Handle, Loader, Prefab, PrefabLoader, ProgressCounter,\n RonFormat,\n },\n ecs::prelude::*,\n prelude::*,\n renderer::{\n formats::texture::ImageFormat,\n sprite::{SpriteSheet, SpriteSheetFormat},\n Texture,\n },\n};\n\nuse std::path::Path;\n\nuse crate::{game::GameState, prefabs::PlayerPrefab};\n\n#[derive(Default)]\npub struct LoadState {\n progress: ProgressCounter,\n player: Option<Handle<Prefab<PlayerPrefab>>>,\n player_sprite_sheet: Option<Handle<SpriteSheet>>,\n tile_map_sprite_sheet: Option<Handle<SpriteSheet>>,\n}\n\nimpl<'a, 'b> SimpleState for LoadState {\n fn on_start(&mut self, data: StateData<'_, GameData<'_, '_>>) {\n let world = data.world;\n\n let player_handle =\n self.load_prefab::<PlayerPrefab, _>(world, &Path::new(\"player\"), RonFormat);\n self.player = Some(player_handle);\n\n let player_sprite_sheet = self.load_sprite_sheet(world, &Path::new(\"texture/player\"));\n self.player_sprite_sheet = Some(player_sprite_sheet);\n\n let tile_map_sheet_handle = self.load_sprite_sheet(world, &Path::new(\"tiles/tileset\"));\n self.tile_map_sprite_sheet = Some(tile_map_sheet_handle);\n }\n\n fn update(&mut self, data: &mut StateData<'_, GameData<'_, '_>>) -> SimpleTrans {\n data.data.update(&data.world);\n if !self.progress.is_complete() {\n return Trans::None;\n }\n\n Trans::Switch(Box::new(GameState::new(\n ProgressCounter::new(),\n self.player.clone(),\n self.player_sprite_sheet.clone(),\n self.tile_map_sprite_sheet.clone(),\n )))\n }\n}\n\nimpl LoadState {\n pub fn load_prefab<T, F>(\n &mut self,\n world: &mut World,\n path: &Path,\n format: F,\n ) -> Handle<Prefab<T>>\n where\n T: Send + Sync + 'static,\n F: Format<<Prefab<T> as Asset>::Data>,\n {\n world.exec(|loader: PrefabLoader<T>| {\n loader.load(\n format!(\"prefab/{}.ron\", path.to_str().unwrap()),\n format,\n &mut self.progress,\n )\n })\n }\n\n fn load_sprite_sheet(&mut self, world: &mut World, path: &Path) -> Handle<SpriteSheet> {\n let texture_handle = {\n let loader = world.read_resource::<Loader>();\n let texture_storage = world.read_resource::<AssetStorage<Texture>>();\n loader.load(\n format!(\"{}.png\", path.to_str().unwrap()),\n ImageFormat::default(),\n &mut self.progress,\n &texture_storage,\n )\n };\n\n let loader = world.read_resource::<Loader>();\n let sprite_sheet_store = world.read_resource::<AssetStorage<SpriteSheet>>();\n loader.load(\n format!(\"{}.ron\", path.to_str().unwrap()),\n SpriteSheetFormat(texture_handle),\n &mut self.progress,\n &sprite_sheet_store,\n )\n }\n}\n" }, { "alpha_fraction": 0.7131474018096924, "alphanum_fraction": 0.7131474018096924, "avg_line_length": 26.88888931274414, "blob_id": "a564aa046e562a52da5410eccfe8869c17f99d5d", "content_id": "848e7e079205f148aa9541b3b8e81f30532ebebf", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Rust", "length_bytes": 502, "license_type": "no_license", "max_line_length": 80, "num_lines": 18, "path": "/src/components/team.rs", "repo_name": "JeanCASPAR/Platformer-2D", "src_encoding": "UTF-8", "text": "//! The team component\n//! Entities of the same team shouldn't attack themselves\n\nuse amethyst::{assets::PrefabData, derive::PrefabData, ecs::prelude::*, Error};\nuse serde::{Deserialize, Serialize};\n\n/// A team : member of the same team shouldn't hit them\n#[derive(Clone, Copy, Debug, Deserialize, Serialize, PartialEq, Eq, PrefabData)]\n#[prefab(Component)]\n#[serde(deny_unknown_fields)]\npub enum Team {\n Allies,\n Enemies,\n}\n\nimpl Component for Team {\n type Storage = DenseVecStorage<Self>;\n}\n" }, { "alpha_fraction": 0.5081433057785034, "alphanum_fraction": 0.5222584009170532, "avg_line_length": 27.8125, "blob_id": "a5bc41ed2dcb78b22c3fed327ada8a6be3793fd3", "content_id": "bb7780343ae17e44c1e13231da6def746e662a3a", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 921, "license_type": "no_license", "max_line_length": 117, "num_lines": 32, "path": "/scripts/build_tileset_ron.py", "repo_name": "JeanCASPAR/Platformer-2D", "src_encoding": "UTF-8", "text": "\"\"\"Automatically build the tileset.ron file\"\"\"\n\ndef build(x: int, y: int, width: int, height: int):\n \"\"\"x and y are the numbers of tiles, and width and height the number of pixels in the image\"\"\"\n tile_width = height // x\n tile_height = width // y\n data = f\"\"\"(\n texture_width: {width},\n texture_height: {height},\n sprites: [\n \"\"\"\n sprite_template = \"\"\"(\n x: {x},\n y: {y},\n width: {width},\n height: {height},\n ),\n \"\"\"\n for i in range(y):\n for j in range(x):\n data += sprite_template.format(x=j * tile_height, y=i * tile_width, width=tile_width, height=tile_height)\n data += \" ],\\n\"\n data += \")\"\n with open(\"assets/tiles/tileset.ron\", mode=\"w\") as f:\n f.write(data)\n\nif __name__ == \"__main__\":\n from sys import argv\n if len(argv) >= 5:\n build(*argv[1:4])\n else:\n build(20, 20, 400, 400)" }, { "alpha_fraction": 0.7899159789085388, "alphanum_fraction": 0.7899159789085388, "avg_line_length": 22.799999237060547, "blob_id": "c5b9188bb6d8310746af31e8358281fea56e6daa", "content_id": "b6279627e86fc5056cccdd30c00ad790def50563", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Rust", "length_bytes": 119, "license_type": "no_license", "max_line_length": 46, "num_lines": 5, "path": "/src/systems/mod.rs", "repo_name": "JeanCASPAR/Platformer-2D", "src_encoding": "UTF-8", "text": "pub mod physics;\npub mod player_input;\n\npub use self::player_input::PlayerInputSystem;\npub use physics::PhysicsBundle;\n" }, { "alpha_fraction": 0.49419355392456055, "alphanum_fraction": 0.5150967836380005, "avg_line_length": 32.405174255371094, "blob_id": "5c0e395d677ff44c0366d9e4d80c57607437ad63", "content_id": "f5633e04f40bb614f93f3619176455b08f3fc3d0", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Rust", "length_bytes": 3875, "license_type": "no_license", "max_line_length": 102, "num_lines": 116, "path": "/src/tiles.rs", "repo_name": "JeanCASPAR/Platformer-2D", "src_encoding": "UTF-8", "text": "//! Implement all the stuff to use Tiled map with amethyst\n\nuse amethyst::{\n core::{\n math::{Point3, Vector3},\n Parent, Transform,\n },\n ecs::prelude::{Join, World, WorldExt},\n renderer::Camera,\n tiles::{CoordinateEncoder, DrawTiles2DBounds, Map, Region, Tile, TileMap},\n window::ScreenDimensions,\n};\nuse tiled::{parse_file, Map as TiledMap};\n\nuse std::path::Path;\n\n/// The tile used by the amethyst engine\n#[derive(Clone, Copy, Debug)]\npub struct MiscTile;\n\nimpl Default for MiscTile {\n fn default() -> Self {\n MiscTile\n }\n}\n\nimpl Tile for MiscTile {\n fn sprite(&self, coordinates: Point3<u32>, world: &World) -> Option<usize> {\n assert_eq!(coordinates[2], 0);\n let map = world.read_resource::<TiledMap>();\n let tileset = map.get_tileset_by_gid(1).unwrap();\n let tiles = &map\n .layers\n .iter()\n .filter(|layer| layer.name == \"tiles\")\n .nth(0)\n .expect(\"Error : no layer with name `tiles`\")\n .tiles;\n let (y, x) = (coordinates[0] as usize, coordinates[1] as usize);\n\n if *tiles\n .get(x)?\n .get(y)?\n > 0\n {\n Some(tiles[x][y] as usize - 1)\n } else {\n None\n }\n }\n}\n\npub fn load_map(path: &Path) -> TiledMap {\n parse_file(path).unwrap()\n}\n\n#[derive(Debug)]\npub struct DrawTilesBounds;\n\nimpl DrawTiles2DBounds for DrawTilesBounds {\n fn bounds<T: Tile, E: CoordinateEncoder>(map: &TileMap<T, E>, world: &World) -> Region {\n let (map_width, map_height) = (map.dimensions().x - 1, map.dimensions().y - 1);\n let (tile_width, tile_height) = (map.tile_dimensions().x, map.tile_dimensions().y);\n let (width, height) = {\n let screen_dimensions = world.read_resource::<ScreenDimensions>();\n (\n screen_dimensions.width() as u32 / tile_width,\n screen_dimensions.height() as u32 / tile_height,\n )\n };\n let cameras = world.read_storage::<Camera>();\n let transforms = world.read_storage::<Transform>();\n let parents = world.read_storage::<Parent>();\n\n let entity = (&cameras, &transforms, &parents).join().nth(0);\n return Region::new(Point3::new(0, 0, 0), Point3::new(map_width as u32, map_height as u32, 0));\n if entity.is_none() {\n return Region::new(\n Point3::new(0, 0, 0),\n Point3::new(width as u32, height as u32, 0),\n );\n }\n let origin = Vector3::new(map_width as i32 / 2, map_height as i32 / 2, -1);\n\n let (_, transform, parent) = entity.unwrap();\n\n let parent_translation = *transforms.get(parent.entity).unwrap().translation();\n\n let translation =\n (Vector3::from_vec(transform.translation().iter().copied().collect::<Vec<_>>())\n + origin.map(|coord| coord as f32)\n - parent_translation)\n .map(|coord| coord as i32);\n let top_left =\n Point3::from(translation + Vector3::new(-(width as i32), -(height as i32), 0));\n let bottom_right = Point3::from(translation + Vector3::new(width as i32, height as i32, 0));\n Region::new(\n Point3::from_slice(\n &top_left\n .iter()\n .take(3)\n .map(|x| x - 5) // load a bit more than requested\n .map(|x| x.max(0) as u32) // force to have a positive number\n .collect::<Vec<_>>(),\n ),\n Point3::from_slice(\n &bottom_right\n .iter()\n .take(3)\n .map(|x| x + 5) // idem\n .map(|x| x.max(0) as u32) // idem\n .collect::<Vec<_>>(),\n ),\n )\n }\n}\n" }, { "alpha_fraction": 0.5928993821144104, "alphanum_fraction": 0.639053225517273, "avg_line_length": 21.53333282470703, "blob_id": "bbe1e21279a3f99f8fc37a5e099560c883d23083", "content_id": "c8156d14c7e8b8309fe3d7e71c230a5ead3e7003", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Rust", "length_bytes": 1690, "license_type": "no_license", "max_line_length": 96, "num_lines": 75, "path": "/src/prefabs/mod.rs", "repo_name": "JeanCASPAR/Platformer-2D", "src_encoding": "UTF-8", "text": "pub mod player;\n\npub use player::PlayerPrefab;\n\nuse amethyst::{\n assets::PrefabData,\n derive::PrefabData,\n ecs::{Component, DenseVecStorage, Entity, WriteStorage},\n Error,\n};\nuse serde::{Deserialize, Serialize};\n\n#[derive(Deserialize, Serialize, PrefabData, PartialEq, Copy, Clone, Component, Debug, Default)]\n#[prefab(Component)]\n#[serde(deny_unknown_fields)]\npub struct F32(pub f32);\n\nimpl From<f32> for F32 {\n fn from(x: f32) -> Self {\n Self(x)\n }\n}\n\nimpl From<(f32,)> for F32 {\n fn from(x: (f32,)) -> Self {\n Self(x.0)\n }\n}\n\n#[derive(Deserialize, Serialize, PrefabData, PartialEq, Copy, Clone, Component, Debug, Default)]\n#[prefab(Component)]\n#[serde(deny_unknown_fields)]\npub struct F32F32(pub f32, pub f32);\n\nimpl From<(f32, f32)> for F32F32 {\n fn from(x: (f32, f32)) -> Self {\n Self(x.0, x.1)\n }\n}\n#[derive(Deserialize, Serialize, PrefabData, PartialEq, Copy, Clone, Component, Debug, Default)]\n#[prefab(Component)]\n#[serde(deny_unknown_fields)]\npub struct U32(pub u32);\n\nimpl From<u32> for U32 {\n fn from(x: u32) -> Self {\n Self(x)\n }\n}\n\nimpl From<(u32,)> for U32 {\n fn from(x: (u32,)) -> Self {\n Self(x.0)\n }\n}\n\n#[derive(Deserialize, Serialize, PrefabData, PartialEq, Copy, Clone, Component, Debug, Default)]\n#[prefab(Component)]\n#[serde(deny_unknown_fields)]\npub struct U32U32(pub u32, pub u32);\n\nimpl From<(u32, u32)> for U32U32 {\n fn from(x: (u32, u32)) -> Self {\n Self(x.0, x.1)\n }\n}\n\n#[derive(Deserialize, Serialize, PrefabData, PartialEq, Copy, Clone, Component, Debug)]\n#[prefab(Component)]\n#[serde(deny_unknown_fields)]\npub enum Geometry {\n Void,\n Square,\n Quadrilateral,\n}\n" }, { "alpha_fraction": 0.5678240656852722, "alphanum_fraction": 0.5754629373550415, "avg_line_length": 33.560001373291016, "blob_id": "d3c6873bde2bfe75a2043e626c0ad408956d2fc6", "content_id": "99f096f14398d5a86663d88cf70debe3f1b22b24", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Rust", "length_bytes": 4320, "license_type": "no_license", "max_line_length": 99, "num_lines": 125, "path": "/src/systems/physics.rs", "repo_name": "JeanCASPAR/Platformer-2D", "src_encoding": "UTF-8", "text": "use amethyst::{\n core::{math, SystemBundle, SystemDesc, Transform},\n derive::SystemDesc,\n ecs::prelude::*,\n Error,\n};\nuse nphysics2d::{\n force_generator::DefaultForceGeneratorSet,\n joint::DefaultJointConstraintSet,\n object::*,\n world::{DefaultGeometricalWorld, DefaultMechanicalWorld},\n};\n\npub use crate::components::RigidBodyComponent;\n\n#[derive(Default)]\npub struct PhysicsBundle;\n\nimpl<'a, 'b> SystemBundle<'a, 'b> for PhysicsBundle {\n fn build(\n self,\n _world: &mut World,\n dispatcher: &mut DispatcherBuilder<'a, 'b>,\n ) -> Result<(), Error> {\n dispatcher.add(super::player_input::PlayerInputSystem, \"player_input\", &[]);\n dispatcher.add(PhysicsStepSystem, \"physics_step\", &[\"player_input\"]);\n dispatcher.add(CollisionSystem, \"collisions\", &[\"physics_step\"]);\n\n Ok(())\n }\n}\n\n#[derive(Default, SystemDesc)]\nstruct PhysicsStepSystem;\n\nimpl<'s> System<'s> for PhysicsStepSystem {\n #[allow(clippy::type_complexity)]\n type SystemData = (\n WriteExpect<'s, DefaultMechanicalWorld<f32>>,\n WriteExpect<'s, DefaultGeometricalWorld<f32>>,\n WriteExpect<'s, DefaultBodySet<f32>>,\n WriteExpect<'s, DefaultColliderSet<f32>>,\n WriteExpect<'s, DefaultJointConstraintSet<f32>>,\n WriteExpect<'s, DefaultForceGeneratorSet<f32>>,\n WriteStorage<'s, Transform>,\n ReadStorage<'s, RigidBodyComponent>,\n );\n\n fn run(\n &mut self,\n (\n mut mechanical_world,\n mut geometrical_world,\n mut body_set,\n mut collider_set,\n mut joint_constraint_set,\n mut force_generator_set,\n mut transforms,\n rigid_body_components,\n ): Self::SystemData,\n ) {\n for (transform, rigid_body_component) in (&mut transforms, &rigid_body_components).join() {\n let old_isometry = transform.isometry();\n let mut new_isometry = na::Isometry2::identity();\n new_isometry.append_translation_mut(&na::Translation::from(na::Vector2::new(\n old_isometry.translation.x,\n old_isometry.translation.y,\n )));\n new_isometry.append_rotation_mut(&na::UnitComplex::new_normalize(na::Complex::new(\n old_isometry.rotation.w,\n old_isometry.rotation.i,\n )));\n\n let rigid_body = body_set\n .rigid_body_mut(rigid_body_component.handle)\n .unwrap();\n rigid_body.set_position(new_isometry);\n }\n mechanical_world.step(\n &mut *geometrical_world,\n &mut *body_set,\n &mut *collider_set,\n &mut *joint_constraint_set,\n &mut *force_generator_set,\n );\n for (transform, rigid_body_component) in (&mut transforms, &rigid_body_components).join() {\n let rigid_body = body_set.rigid_body(rigid_body_component.handle).unwrap();\n let old_isometry = rigid_body.position();\n let mut new_isometry = math::Isometry3::identity();\n new_isometry.append_translation_mut(&math::Translation::from(math::Vector3::new(\n old_isometry.translation.x,\n old_isometry.translation.y,\n 0.0,\n )));\n new_isometry.append_rotation_mut(&math::UnitQuaternion::from_quaternion(\n math::Quaternion::new(\n old_isometry.rotation.complex().re,\n old_isometry.rotation.complex().im,\n 0.0,\n 0.0,\n ),\n ));\n transform.set_isometry(new_isometry);\n }\n }\n}\n\n#[derive(Default, SystemDesc)]\nstruct CollisionSystem;\n\nimpl<'s> System<'s> for CollisionSystem {\n #[allow(clippy::type_complexity)]\n type SystemData = (\n WriteExpect<'s, DefaultGeometricalWorld<f32>>,\n WriteExpect<'s, DefaultColliderSet<f32>>,\n );\n\n fn run(&mut self, (world, collider_set): Self::SystemData) {\n for collision in world.contact_pairs(&*collider_set, true) {\n let (_coll_handle_1, _collider_1, _coll_handle_2, _collider_2, _detector, _proximity) =\n collision;\n // println!(\"{:#?} {:#?}\", coll_handle_1, coll_handle_2);\n }\n }\n}\n" }, { "alpha_fraction": 0.6014625430107117, "alphanum_fraction": 0.6544789671897888, "avg_line_length": 26.399999618530273, "blob_id": "a41d7d348a233f0e92b1e481cdc270e94789a89e", "content_id": "45219b36fe202e71c2dc7ac3a5c908f7689b6725", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "TOML", "length_bytes": 547, "license_type": "no_license", "max_line_length": 96, "num_lines": 20, "path": "/Cargo.toml", "repo_name": "JeanCASPAR/Platformer-2D", "src_encoding": "UTF-8", "text": "[package]\nname = \"platformer-2d\"\nversion = \"0.1.0\"\nauthors = [\"jecaspa\"]\nedition = \"2018\"\n\n# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html\n\n[dependencies]\namethyst = { version = \"0.13\", features = [\"vulkan\", \"tiles\"] }\nserde = { version = \"1.0\", features = [\"derive\"] }\ntiled = \"0.8\"\nnalgebra = \"0.19\"\nncollide2d = \"0.21\"\nnphysics2d = \"0.13\"\nshred = { version = \"0.9.4\", features = [\"nightly\"] , optional = true }\n\n[features]\nrelease = [\"amethyst/no-slow-safety-checks\"]\nnightly = [\"shred/nightly\"]" }, { "alpha_fraction": 0.6967213153839111, "alphanum_fraction": 0.6967213153839111, "avg_line_length": 17.769229888916016, "blob_id": "9da6a1b4c4218eea6166681801121bf6d730a839", "content_id": "3d4b424ed068bc28b144c6ce000d0d2c714782fa", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Rust", "length_bytes": 244, "license_type": "no_license", "max_line_length": 53, "num_lines": 13, "path": "/src/components/mod.rs", "repo_name": "JeanCASPAR/Platformer-2D", "src_encoding": "UTF-8", "text": "pub mod damageable;\npub mod movable;\npub mod physics;\npub mod player;\npub mod team;\n\npub use self::{\n damageable::Damageable,\n movable::Movable,\n physics::{ColliderComponent, RigidBodyComponent},\n player::Player,\n team::Team,\n};\n" } ]
19
EmielMaes/ReinforcementLearning
https://github.com/EmielMaes/ReinforcementLearning
36fece9f6c7f5277a9f4335518ca130fdce3b603
69134750b2c12d37503625abdd5f7f1c247ca45b
c4627e5089dcefe7f48913ae0b4fe7d383e96340
refs/heads/main
2023-03-21T17:05:11.628328
2021-03-10T13:10:53
2021-03-10T13:10:53
342,521,484
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.675473153591156, "alphanum_fraction": 0.682774543762207, "avg_line_length": 56.19230651855469, "blob_id": "750cafaa3ffe0bb35fbbdf2b87643278cf683dfe", "content_id": "f18dd5dac35f8bb8fa551191821357f447acbefe", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 10409, "license_type": "no_license", "max_line_length": 130, "num_lines": 182, "path": "/PolicyGradient/TF2/DDPG/ddpg_tf2.py", "repo_name": "EmielMaes/ReinforcementLearning", "src_encoding": "UTF-8", "text": "import tensorflow as tf\nimport tensorflow.keras as keras\nfrom tensorflow.keras.optimizers import Adam\nfrom buffer import ReplayBuffer\nfrom networks import ActorNetwork, CriticNetwork\n\nclass Agent:\n def __init__(self, input_dims, alpha=0.001, beta=0.002, env=None,\n gamma=0.99, n_actions=2, max_size=1000000, tau=0.005, \n fc1=400, fc2=300, batch_size=64, noise=0.1):\n \"\"\"\n Input parameters\n :param input_dims: input dimensions\n :param alpha: learning rate actor\n :param beta: learning rate critic\n :param env: environment\n :param gamma: discount factor for the update equation\n :param n_actions:\n :param max_size: max size for replay buffer\n :param tau: default value of the soft update (this 0.005 is taken from the paper)\n :param fc1: number of neurons in fully connected layer 1\n :param fc2: number of neurons in fully connected layer 2\n :param batch_size: batch size\n :param noise: noise parameter which reflects the std deviation of a normal distribution\n \"\"\"\n\n self.gamma = gamma\n self.tau = tau\n self.memory = ReplayBuffer(max_size, input_dims, n_actions) # instantiate the ReplayBuffer\n self.batch_size = batch_size\n self.n_actions = n_actions\n self.noise = noise\n self.max_action = env.action_space.high[0] #upper bound of your action space (typically +1 in continuous space)\n self.min_action = env.action_space.low[0] #lower bound on your action space (typically -1 in continuous space)\n\n # Instantiate the actual networks (and give them the corresponding names\n self.actor = ActorNetwork(n_actions=n_actions, name='actor')\n self.critic = CriticNetwork(name='critic')\n self.target_actor = ActorNetwork(n_actions=n_actions, name='target_actor')\n self.target_critic = CriticNetwork(name='target_critic')\n\n # Compile the networks (set the optimizer and learning rate)\n self.actor.compile(optimizer=Adam(learning_rate=alpha))\n self.critic.compile(optimizer=Adam(learning_rate=beta))\n\n # For the following target networks, we won't be doing gradient descent for these networks because\n # we will do the soft updates, but we still need to compile the networks (feature of tf)\n self.target_actor.compile(optimizer=Adam(learning_rate=alpha))\n self.target_critic.compile(optimizer=Adam(learning_rate=beta))\n\n self.update_network_parameters(tau=1) # hard copy of the weights to target networks (the first iteration, tau=1)\n\n def update_network_parameters(self, tau=None):\n # use the default parameter when tau is not specified\n if tau is None:\n tau = self.tau\n\n # Update the weights of the target_actor as specified below (using tau parameter)\n weights = []\n targets = self.target_actor.weights\n for i, weight in enumerate(self.actor.weights):\n weights.append(weight * tau + targets[i]*(1-tau))\n self.target_actor.set_weights(weights)\n\n # Update the weights of the target_critic\n weights = []\n targets = self.target_critic.weights\n for i, weight in enumerate(self.critic.weights):\n weights.append(weight * tau + targets[i]*(1-tau))\n self.target_critic.set_weights(weights)\n\n def remember(self, state, action, reward, new_state, done):\n \"\"\"Interface function which makes it clean to store the state,\n action, reward, new state, terminal state in the buffer\"\"\"\n self.memory.store_transition(state, action, reward, new_state, done)\n\n def save_models(self):\n print('... saving models ...')\n self.actor.save_weights(self.actor.checkpoint_file)\n self.target_actor.save_weights(self.target_actor.checkpoint_file)\n self.critic.save_weights(self.critic.checkpoint_file)\n self.target_critic.save_weights(self.target_critic.checkpoint_file)\n\n def load_models(self):\n print('... loading models ...')\n self.actor.load_weights(self.actor.checkpoint_file)\n self.target_actor.load_weights(self.target_actor.checkpoint_file)\n self.critic.load_weights(self.critic.checkpoint_file)\n self.target_critic.load_weights(self.target_critic.checkpoint_file)\n\n def choose_action(self, observation, evaluate=False):\n \"\"\"\n Takes as input an observation for which we should choose an action, the evaluation parameter\n is related to whether or not your training or testing your agent. If you test the agent, you\n don't necessarily want to add noise for exploration which you want to do during the training.\n \"\"\"\n state = tf.convert_to_tensor([observation], dtype=tf.float32)\n\n # Get the actions out of the network\n actions = self.actor(state)\n\n # if we are training, we want to get some random normal noise on our actions\n if not evaluate:\n actions += tf.random.normal(shape=[self.n_actions], mean=0.0, stddev=self.noise)\n # note that if the action output from the network is for example 1 and we add some noise to this,\n # it could be that the action value is larger than 1 while our actions should lie in the range of [-1, 1]\n # in order to fix this, we have to clip the actions by it's min and max value\n actions = tf.clip_by_value(actions, self.min_action, self.max_action)\n\n # Return the 0th element because actions is a tensor and the value is the 0th element which is numpy array\n return actions[0]\n\n def learn(self):\n\n # What if batch size is larger than our memory (we haven't filled up our memory yet)\n # We don't really want to learn yet\n if self.memory.mem_cntr < self.batch_size:\n return\n\n # Sample our memory\n state, action, reward, new_state, done = \\\n self.memory.sample_buffer(self.batch_size)\n\n # Convert these numpy arrays to tensors\n states = tf.convert_to_tensor(state, dtype=tf.float32) #current states\n states_ = tf.convert_to_tensor(new_state, dtype=tf.float32) #next states when taking the action\n rewards = tf.convert_to_tensor(reward, dtype=tf.float32)\n actions = tf.convert_to_tensor(action, dtype=tf.float32)\n # we don't need to convert the terminal flags to tensors because we will typically\n # just do some numpy array operations on it\n\n # We use the gradienttape and the basic idea is that we go to load up operations onto\n # our computational graph for calculation of gradients. So when we call the choose_action\n # function above, those operations aren't stored anywhere that is used for calculation of gradients\n # Only things within this context manager are used for calculation of the gradients\n # Check the formulas for the following part of the code!\n with tf.GradientTape() as tape:\n target_actions = self.target_actor(states_)\n # for the following, we have to squeeze along the first dimension because we have the batch dimension\n # and it doesn't learn if you put in the batch dimension\n critic_value_ = tf.squeeze(self.target_critic(states_, target_actions), 1)\n #what is the estimate of the value of the state, action pairs we encounter in the replay buffer\n critic_value = tf.squeeze(self.critic(states, actions), 1)\n\n # the (1-done) is 1 - true or false so when the episode is over, this is becomes 0 and you just get the rewards\n # Calculate the targets\n target = reward + self.gamma*critic_value_*(1-done)\n # Calculate the MSE loss for the critic\n critic_loss = keras.losses.MSE(target, critic_value)\n\n # outside the context manager, we want to calculate the gradients of the critic network.\n # We didn't define the trainable_variables variable but this is defined in Keras\n critic_network_gradient = tape.gradient(critic_loss, self.critic.trainable_variables)\n\n # apply our gradients (update the weights of the critic network)\n self.critic.optimizer.apply_gradients(zip(critic_network_gradient, self.critic.trainable_variables))\n\n with tf.GradientTape() as tape:\n new_policy_actions = self.actor(states)\n # it is negative, because we are doing gradient ascent and in policy gradient methods you don't want\n # to do gradient descent because that minimizes the total score over time and we want to maximize the\n # total score over time (and gradient ascent is just the negative of the gradient descent)\n actor_loss = -self.critic(states, new_policy_actions)\n # our loss is the reduced mean of the actor loss (just computes the mean of the batch)\n actor_loss = tf.math.reduce_mean(actor_loss)\n\n # This is how we will the get the gradient of the critic loss with respect to the mu parameters of theta super mu.\n # This is done by taking this actor loss which is proportional to the output of the critic network and that is coupled.\n # The gradient is non-zero because it has this dependency on the output of our actor network so their dependence\n # that gives you a nonzero gradient comes from the fact that we are taking actions with respect to the actor network\n # which is calculated according to theta super mu and that gets fed forward through the critic network and that's what\n # allows you to take the gradient of the output of the critic network with respect to the variables of the actor network\n # That's how we get that coupling. If you read the paper, they apply the chain rule and you get the gradient of the critic\n # network and the gradient of the actor network but this form here is easier to implement in code.\n actor_network_gradient = tape.gradient(actor_loss, self.actor.trainable_variables)\n\n # Apply the gradients (zip up the gradient)\n self.actor.optimizer.apply_gradients(zip(actor_network_gradient, self.actor.trainable_variables))\n\n # Once we have updated our main networks, we want to do the softupdate of our target networks. As it is not the first time\n # We're updating them, we just use the default value for tau\n self.update_network_parameters()\n" }, { "alpha_fraction": 0.5950782895088196, "alphanum_fraction": 0.6170022487640381, "avg_line_length": 37.517242431640625, "blob_id": "1641463dec295ae59cfb98b28a12cadf509b17c9", "content_id": "a26403356bc1d77cb895347ed3094cfdccf132fa", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2235, "license_type": "no_license", "max_line_length": 111, "num_lines": 58, "path": "/PolicyGradient/TF2/DDPG/networks.py", "repo_name": "EmielMaes/ReinforcementLearning", "src_encoding": "UTF-8", "text": "import os\nimport tensorflow as tf\nimport tensorflow.keras as keras\nfrom tensorflow.keras.layers import Dense\n\nclass CriticNetwork(keras.Model):\n def __init__(self, fc1_dims=512, fc2_dims=512,\n name='critic', chkpt_dir='tmp/ddpg'):\n super(CriticNetwork, self).__init__()\n self.fc1_dims = fc1_dims\n self.fc2_dims = fc2_dims\n\n self.model_name = name\n self.checkpoint_dir = chkpt_dir\n self.checkpoint_file = os.path.join(self.checkpoint_dir, \n self.model_name+'_ddpg.h5')\n\n self.fc1 = Dense(self.fc1_dims, activation='relu')\n self.fc2 = Dense(self.fc2_dims, activation='relu')\n self.q = Dense(1, activation=None)\n\n def call(self, state, action):\n \"\"\"Takes as input the state and action and returns the corresponding Q value\"\"\"\n action_value = self.fc1(tf.concat([state, action], axis=1))\n action_value = self.fc2(action_value)\n\n q = self.q(action_value)\n\n return q\n\nclass ActorNetwork(keras.Model):\n def __init__(self, fc1_dims=512, fc2_dims=512, n_actions=2, name='actor',\n chkpt_dir='tmp/ddpg'):\n super(ActorNetwork, self).__init__()\n self.fc1_dims = fc1_dims\n self.fc2_dims = fc2_dims\n self.n_actions = n_actions\n\n self.model_name = name\n self.checkpoint_dir = chkpt_dir\n self.checkpoint_file = os.path.join(self.checkpoint_dir, \n self.model_name+'_ddpg.h5')\n\n self.fc1 = Dense(self.fc1_dims, activation='relu')\n self.fc2 = Dense(self.fc2_dims, activation='relu')\n self.mu = Dense(self.n_actions, activation='tanh') #tanh is bounded between + and -1\n\n def call(self, state):\n \"\"\"Takes the state as the input and returns an action according to its dimensions \"\"\"\n prob = self.fc1(state)\n prob = self.fc2(prob)\n\n #If the action bounds are not between + and -1, you can just multiply here\n # (here, we multiply the output by 2 because the action space is bounded between [-2, 2] and our output\n # from the network is in the range [-1, 1] because of the tanh function.\n mu = self.mu(prob) * 2 # mu is the actual action (see paper)\n\n return mu\n\n" }, { "alpha_fraction": 0.6164184808731079, "alphanum_fraction": 0.6233200430870056, "avg_line_length": 38.31428527832031, "blob_id": "e20a3b1c2b5ad8f8841250c76e98f389ed93a60b", "content_id": "a563a5202269a7dbca5f20b494fc77f4b81ecc1a", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2753, "license_type": "no_license", "max_line_length": 108, "num_lines": 70, "path": "/PolicyGradient/TF2/DDPG/main_ddpg.py", "repo_name": "EmielMaes/ReinforcementLearning", "src_encoding": "UTF-8", "text": "import gym\nimport numpy as np\nfrom ddpg_tf2 import Agent\nfrom utils import plot_learning_curve\n\nif __name__ == '__main__':\n env = gym.make('Pendulum-v0')\n agent = Agent(input_dims=env.observation_space.shape, env=env,\n n_actions=env.action_space.shape[0])\n n_games = 250\n\n figure_file = 'plots/pendulum.png'\n\n best_score = env.reward_range[0]\n score_history = []\n load_checkpoint = False # if you want to set up training vs testing\n\n # In tensorflow, you have to first call the learn function before you can actually load your model\n # because when you instantiate the agent, you aren't loading any values onto the graph so it's basically\n # an empty network. There's no values loaded into the network. We just fill up the agent's memory\n # with dummy variables and call the learn function such that we can load our models.\n if load_checkpoint:\n n_steps = 0\n while n_steps <= agent.batch_size:\n observation = env.reset()\n action = env.action_space.sample()\n observation_, reward, done, info = env.step(action)\n agent.remember(observation, action, reward, observation_, done)\n n_steps += 1\n agent.learn()\n agent.load_models()\n evaluate = True\n else:\n evaluate = False\n\n # Play a number of episodes\n for i in range(n_games):\n observation = env.reset()\n done = False\n score = 0\n while not done:\n action = agent.choose_action(observation, evaluate)\n observation_, reward, done, info = env.step(action)\n score += reward\n agent.remember(observation, action, reward, observation_, done)\n # When you're evaluating the agent, you don't want to disturb the parameters and then you\n # want to skip the learning part of the agent\n if not load_checkpoint:\n agent.learn()\n observation = observation_\n\n # Append the score at the end of every episode\n score_history.append(score)\n\n # Calculate the average score of the last 100 episodes\n avg_score = np.mean(score_history[-100:])\n\n # if the avg_score is better than the best score, save the models\n if avg_score > best_score:\n best_score = avg_score\n if not load_checkpoint:\n agent.save_models()\n\n # print some basic debug information at the end of every episode\n print('episode ', i, 'score %.1f' % score, 'avg score %.1f' % avg_score)\n\n # At the end of all the episodes, we want to print our learning curve\n if not load_checkpoint:\n x = [i+1 for i in range(n_games)]\n plot_learning_curve(x, score_history, figure_file)\n\n" }, { "alpha_fraction": 0.6355441212654114, "alphanum_fraction": 0.6501395106315613, "avg_line_length": 42.12963104248047, "blob_id": "edf3f7e04a5dbe563bac967e15e3550e3534cc48", "content_id": "89b55bb233123e5c6fa80522451ba4207c2d616a", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 4659, "license_type": "no_license", "max_line_length": 150, "num_lines": 108, "path": "/PolicyGradient/TF2/SAC/networks.py", "repo_name": "EmielMaes/ReinforcementLearning", "src_encoding": "UTF-8", "text": "import os\nimport numpy as np\nimport tensorflow as tf\nimport tensorflow.keras as keras\nimport tensorflow_probability as tfp\nfrom tensorflow.keras.layers import Dense \n\nclass CriticNetwork(keras.Model):\n def __init__(self, n_actions, fc1_dims=256, fc2_dims=256,\n name='critic', chkpt_dir='tmp/sac'):\n super(CriticNetwork, self).__init__()\n self.fc1_dims = fc1_dims\n self.fc2_dims = fc2_dims\n self.n_actions = n_actions\n self.model_name = name\n self.checkpoint_dir = chkpt_dir\n self.checkpoint_file = os.path.join(self.checkpoint_dir, name+'_sac')\n\n self.fc1 = Dense(self.fc1_dims, activation='relu')\n self.fc2 = Dense(self.fc2_dims, activation='relu')\n self.q = Dense(1, activation=None)\n\n def call(self, state, action):\n action_value = self.fc1(tf.concat([state, action], axis=1))\n action_value = self.fc2(action_value)\n\n q = self.q(action_value)\n\n return q\n\nclass ValueNetwork(keras.Model):\n def __init__(self, fc1_dims=256, fc2_dims=256,\n name='value', chkpt_dir='tmp/sac'):\n super(ValueNetwork, self).__init__()\n self.fc1_dims = fc1_dims\n self.fc2_dims = fc2_dims\n self.model_name = name\n self.checkpoint_dir = chkpt_dir\n self.checkpoint_file = os.path.join(self.checkpoint_dir, name+'_sac')\n\n self.fc1 = Dense(self.fc1_dims, activation='relu')\n self.fc2 = Dense(fc2_dims, activation='relu')\n self.v = Dense(1, activation=None)\n\n def call(self, state):\n state_value = self.fc1(state)\n state_value = self.fc2(state_value)\n\n v = self.v(state_value)\n\n return v\n\nclass ActorNetwork(keras.Model):\n def __init__(self, max_action, fc1_dims=256, \n fc2_dims=256, n_actions=2, name='actor', chkpt_dir='tmp/sac'):\n super(ActorNetwork, self).__init__()\n self.fc1_dims = fc1_dims\n self.fc2_dims = fc2_dims\n self.n_actions = n_actions\n self.model_name = name\n self.checkpoint_dir = chkpt_dir\n self.checkpoint_file = os.path.join(self.checkpoint_dir, name+'_sac')\n self.max_action = max_action\n self.noise = 1e-6\n\n self.fc1 = Dense(self.fc1_dims, activation='relu')\n self.fc2 = Dense(self.fc2_dims, activation='relu')\n self.mu = Dense(self.n_actions, activation=None)\n self.sigma = Dense(self.n_actions, activation=None)\n\n def call(self, state):\n prob = self.fc1(state)\n prob = self.fc2(prob)\n\n mu = self.mu(prob)\n sigma = self.sigma(prob)\n # might want to come back and change this, perhaps tf plays more nicely with\n # a sigma of ~0\n sigma = tf.clip_by_value(sigma, self.noise, 1)\n\n return mu, sigma\n\n def sample_normal(self, state, reparameterize=True):\n # We basically don't do the reparameterization here but if interested, you can look at the Pytorch implementation\n mu, sigma = self.call(state)\n # Instantiate our normal distribution, defined by mu and sigma which are the output of our actor network\n probabilities = tfp.distributions.Normal(mu, sigma)\n\n if reparameterize:\n # probabilities.sample results in a tensor object (a value sampled from the normal distribution)\n actions = probabilities.sample() # + something else if you want to implement\n else:\n actions = probabilities.sample()\n\n # plug the actions (cf sampled from the probability distribution) into a tanh function which will bound the action between -1 and 1\n # and multiply that by the max_action value in order to get a corresponding value which fits the environment\n # The way we optimize the policy makes use of the reparameterization trick, in which a sample from \\pi_{\\theta}(\\cdot|s) is drawn\n # by computing a deterministic function of state, policy parameters, and independent noise. Check openAI spinningup\n action = tf.math.tanh(actions)*self.max_action #The corresponding action for the agent (typically, they also add some noise here in the paper)\n\n # Calculate the log probabilities (check appendix C in the paper for the formula)\n log_probs = probabilities.log_prob(actions) #Convert the sampled actions from the Gaussian into probabilites and take the log of them\n\n # We add some very small noise just to make sure that we don't take the log of 0 (check end of the paper, appendix C)\n log_probs -= tf.math.log(1-tf.math.pow(action,2)+self.noise)\n log_probs = tf.math.reduce_sum(log_probs, axis=1, keepdims=True)\n\n return action, log_probs\n\n" }, { "alpha_fraction": 0.6223993897438049, "alphanum_fraction": 0.6373711824417114, "avg_line_length": 48.20574188232422, "blob_id": "7f7602d9910c628e57db830e96de14767c70c865", "content_id": "3dc4c685e229a1934a2e1399a22085344de05075", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 10286, "license_type": "no_license", "max_line_length": 146, "num_lines": 209, "path": "/PolicyGradient/TF2/TD3/td3_tf2.py", "repo_name": "EmielMaes/ReinforcementLearning", "src_encoding": "UTF-8", "text": "import tensorflow as tf\nimport tensorflow.keras as keras\nfrom tensorflow.keras.optimizers import Adam\nfrom networks import ActorNetwork, CriticNetwork\nfrom replaybuffer import ReplayBuffer\nimport numpy as np\n\nclass Agent():\n def __init__(self, alpha, beta, input_dims, tau, env,\n gamma=0.99, update_actor_interval=2, warmup=1000,\n n_actions=2, max_size=1000000, layer1_size=400,\n layer2_size=300, batch_size=100, noise=0.1):\n self.gamma = gamma\n self.tau = tau\n self.max_action = env.action_space.high[0]\n self.min_action = env.action_space.low[0]\n self.memory = ReplayBuffer(max_size, input_dims, n_actions) #initialize replay buffer\n self.batch_size = batch_size\n self.learn_step_cntr = 0 #we do the delayed part of TD3, the actor network updates are delayed wrt critic updates\n self.time_step = 0\n self.warmup = warmup\n self.n_actions = n_actions\n self.update_actor_iter = update_actor_interval\n\n #Define all the 6 networks\n self.actor = ActorNetwork(layer1_size, layer2_size, \n n_actions=n_actions, name='actor')\n\n self.critic_1 = CriticNetwork(layer1_size, layer2_size, name='critic_1')\n self.critic_2 = CriticNetwork(layer1_size, layer2_size,name='critic_2')\n\n self.target_actor = ActorNetwork(layer1_size, layer2_size, \n n_actions=n_actions, name='target_actor')\n self.target_critic_1 = CriticNetwork(layer1_size, layer2_size, name='target_critic_1')\n self.target_critic_2 = CriticNetwork(layer1_size, layer2_size, name='target_critic_2')\n\n #Compile all the networks (setting the optimizer, initial learning rate and loss)\n self.actor.compile(optimizer=Adam(learning_rate=alpha), loss='mean')\n self.critic_1.compile(optimizer=Adam(learning_rate=beta), \n loss='mean_squared_error')\n self.critic_2.compile(optimizer=Adam(learning_rate=beta), \n loss='mean_squared_error')\n\n self.target_actor.compile(optimizer=Adam(learning_rate=alpha), \n loss='mean')\n self.target_critic_1.compile(optimizer=Adam(learning_rate=beta), \n loss='mean_squared_error')\n self.target_critic_2.compile(optimizer=Adam(learning_rate=beta), \n loss='mean_squared_error')\n\n self.noise = noise\n self.update_network_parameters(tau=1) #Is set to 1 when we initialize the target networks during the first iteration\n\n def choose_action(self, observation):\n #During the warmup, just choose a random action\n if self.time_step < self.warmup:\n mu = np.random.normal(scale=self.noise, size=(self.n_actions,))\n else:\n state = tf.convert_to_tensor([observation], dtype=tf.float32)\n mu = self.actor(state)[0] # returns a batch size of 1, want a scalar array\n\n #Add some random normal noise to the chosen action\n mu_prime = mu + np.random.normal(scale=self.noise)\n\n #Clip the values such that the actions are within the boundaries of the min and max action\n mu_prime = tf.clip_by_value(mu_prime, self.min_action, self.max_action)\n self.time_step += 1\n\n return mu_prime\n\n def remember(self, state, action, reward, next_state, done):\n \"\"\"Store the state, action, reward, next state in the replay buffer\"\"\"\n self.memory.store_transition(state, action, reward, next_state, done)\n\n def learn(self):\n #If the number of samples in the memory is smaller than batch size, do nothing\n if self.memory.mem_cntr < self.batch_size:\n return\n\n #Sample the replay buffer\n states, actions, rewards, next_states, dones = \\\n self.memory.sample_buffer(self.batch_size)\n\n #Convert the numpy arrays to tensors if we want to use them in the neural networks\n states = tf.convert_to_tensor(states, dtype=tf.float32)\n actions = tf.convert_to_tensor(actions, dtype=tf.float32)\n rewards = tf.convert_to_tensor(rewards, dtype=tf.float32)\n next_states = tf.convert_to_tensor(next_states, dtype=tf.float32)\n\n #If you use two different applied gradients for a single tape, you need to pass the persisten=True argument otherwise you don't need\n #it which means that you just have a single network that you are performing an update on\n #Read documentation https://www.tensorflow.org/guide/autodiff\n with tf.GradientTape(persistent=True) as tape:\n #Use target actor to determine actions for those next states (s') and add some noise.\n target_actions = self.target_actor(next_states)\n target_actions = target_actions + \\\n tf.clip_by_value(np.random.normal(scale=0.2), -0.5, 0.5)\n\n target_actions = tf.clip_by_value(target_actions, self.min_action, \n self.max_action)\n\n #Plug those actions into the target critic networks\n q1_ = self.target_critic_1(next_states, target_actions)\n q2_ = self.target_critic_2(next_states, target_actions)\n\n #Squeeze the output because the shape is batch size by 1 and e want to collapse this to batch size\n q1 = tf.squeeze(self.critic_1(states, actions), 1)\n q2 = tf.squeeze(self.critic_2(states, actions), 1)\n\n # shape is [batch_size, 1], want to collapse to [batch_size]\n q1_ = tf.squeeze(q1_, 1)\n q2_ = tf.squeeze(q2_, 1)\n\n #Get the min target value from the two networks\n critic_value_ = tf.math.minimum(q1_, q2_)\n\n #Target is the y from our paper (done flag means whether or not the episode terminated)\n target = rewards + self.gamma*critic_value_*(1-dones)\n\n #critic_1_loss = tf.math.reduce_mean(tf.math.square(target - q1))\n #critic_2_loss = tf.math.reduce_mean(tf.math.square(target - q2))\n critic_1_loss = keras.losses.MSE(target, q1)\n critic_2_loss = keras.losses.MSE(target, q2)\n\n #Calculate the gradients\n critic_1_gradient = tape.gradient(critic_1_loss, \n self.critic_1.trainable_variables)\n critic_2_gradient = tape.gradient(critic_2_loss, \n self.critic_2.trainable_variables)\n\n #Backpropagate the gradients to calculate the gradient of some target (often a loss) relative to some source (often the model's variables)\n self.critic_1.optimizer.apply_gradients(\n zip(critic_1_gradient, self.critic_1.trainable_variables))\n self.critic_2.optimizer.apply_gradients(\n zip(critic_2_gradient, self.critic_2.trainable_variables))\n \n self.learn_step_cntr += 1\n\n #Only update the actor network evey 2 time steps (based on the update_actor_iter)\n if self.learn_step_cntr % self.update_actor_iter != 0:\n return\n\n #Here, we're dealing with one loss, so we don't have to call the persistent=True argument\n with tf.GradientTape() as tape:\n new_actions = self.actor(states)\n critic_1_value = self.critic_1(states, new_actions)\n #It is negative because we want to maximize the return and thus this means we want to minimize the negative return\n actor_loss = -tf.math.reduce_mean(critic_1_value)\n\n #This is how we get the gradient of the output of one network with respect to the parameters of another network\n # Same as applying the chain rule to the loss of the output of the critic network with respect to the parameters of the actor network\n #Calculate the gradient\n actor_gradient = tape.gradient(actor_loss, self.actor.trainable_variables)\n\n #Backpropagate the gradients\n self.actor.optimizer.apply_gradients(\n zip(actor_gradient, self.actor.trainable_variables))\n\n self.update_network_parameters()\n\n def update_network_parameters(self, tau=None):\n \"\"\"Update the network parameters\"\"\"\n\n #Is used during the first iteration such that the target networks get the same parameters of the normal networks (hard update)\n if tau is None:\n tau = self.tau\n\n #Update the target_actor weights\n weights = []\n targets = self.target_actor.weights\n for i, weight in enumerate(self.actor.weights):\n weights.append(weight * tau + targets[i]*(1-tau))\n\n self.target_actor.set_weights(weights)\n\n #Update the target_critic_1 weights\n weights = []\n targets = self.target_critic_1.weights\n for i, weight in enumerate(self.critic_1.weights):\n weights.append(weight * tau + targets[i]*(1-tau))\n\n self.target_critic_1.set_weights(weights)\n\n #Update the target_critic_2 weights\n weights = []\n targets = self.target_critic_2.weights\n for i, weight in enumerate(self.critic_2.weights):\n weights.append(weight * tau + targets[i]*(1-tau))\n\n self.target_critic_2.set_weights(weights)\n\n def save_models(self):\n print('... saving models ...')\n self.actor.save_weights(self.actor.checkpoint_file)\n self.critic_1.save_weights(self.critic_1.checkpoint_file)\n self.critic_2.save_weights(self.critic_2.checkpoint_file)\n self.target_actor.save_weights(self.target_actor.checkpoint_file)\n self.target_critic_1.save_weights(self.target_critic_1.checkpoint_file)\n self.target_critic_2.save_weights(self.target_critic_2.checkpoint_file)\n\n def load_models(self):\n \n print('... loading models ...')\n self.actor.load_weights(self.actor.checkpoint_file)\n self.critic_1.load_weights(self.critic_1.checkpoint_file)\n self.critic_2.load_weights(self.critic_2.checkpoint_file)\n self.target_actor.load_weights(self.target_actor.checkpoint_file)\n self.target_critic_1.load_weights(self.target_critic_1.checkpoint_file)\n self.target_critic_2.load_weights(self.target_critic_2.checkpoint_file)\n\n\n" }, { "alpha_fraction": 0.6150000095367432, "alphanum_fraction": 0.6344444155693054, "avg_line_length": 35.75510025024414, "blob_id": "b5f2ff24e9ac5596458dd0db087f2cdf3576c59f", "content_id": "4c995fb171f292ba8f8791226fd377a4eced0e59", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1800, "license_type": "no_license", "max_line_length": 134, "num_lines": 49, "path": "/PolicyGradient/TF2/TD3/networks.py", "repo_name": "EmielMaes/ReinforcementLearning", "src_encoding": "UTF-8", "text": "import tensorflow as tf\nimport tensorflow.keras as keras\nfrom tensorflow.keras.layers import Dense\nimport os\n\nclass CriticNetwork(keras.Model):\n def __init__(self, fc1_dims, fc2_dims, name, chkpt_dir='tmp/td3'):\n super(CriticNetwork, self).__init__()\n self.fc1_dims = fc1_dims\n self.fc2_dims = fc2_dims\n self.model_name = name\n self.checkpoint_dir = chkpt_dir\n self.checkpoint_file = os.path.join(self.checkpoint_dir, name+'_td3')\n\n self.fc1 = Dense(self.fc1_dims, activation='relu')\n self.fc2 = Dense(self.fc2_dims, activation='relu')\n self.q = Dense(1, activation=None)\n\n def call(self, state, action):\n q1_action_value = self.fc1(tf.concat([state, action], axis=1))\n q1_action_value = self.fc2(q1_action_value)\n\n q = self.q(q1_action_value)\n\n return q\n\nclass ActorNetwork(keras.Model):\n def __init__(self, fc1_dims, fc2_dims, n_actions, name, chkpt_dir='tmp/td3'):\n super(ActorNetwork, self).__init__()\n self.fc1_dims = fc1_dims\n self.fc2_dims = fc2_dims\n self.n_actions = n_actions\n self.model_name = name\n self.checkpoint_dir = chkpt_dir\n self.checkpoint_file = os.path.join(self.checkpoint_dir, name+'_td3')\n\n self.fc1 = Dense(self.fc1_dims, activation='relu')\n self.fc2 = Dense(self.fc2_dims, activation='relu')\n # thanh will take boundaries between + and -1, if you want action outputs that are other than these, just multiply the output\n self.mu = Dense(self.n_actions, activation='tanh')\n\n\n def call(self, state):\n prob = self.fc1(state) #you don't really get a probability, so misnomer\n prob = self.fc2(prob)\n\n mu = self.mu(prob) #mu is the deterministic action output\n\n return mu" } ]
6
gobltpqls99/python-guestbook
https://github.com/gobltpqls99/python-guestbook
fc5249ea23a3c5176cb1cc56b34b1374aaa55897
85095fc948535faa39ade60b8cf8ed162bb944c0
25ad29c66f138551ab9750c20be45219602e6ce4
refs/heads/master
2023-05-29T23:18:37.203809
2021-06-14T00:07:40
2021-06-14T00:07:40
375,199,095
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.496221661567688, "alphanum_fraction": 0.5793451070785522, "avg_line_length": 21.05555534362793, "blob_id": "35824fb8b927bf815f725ef87182dbb9c306b9d3", "content_id": "fa88c48d545cfe572686d903d59fffb41fb464f8", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 397, "license_type": "no_license", "max_line_length": 72, "num_lines": 18, "path": "/guestbook/main/migrations/0006_post_pw.py", "repo_name": "gobltpqls99/python-guestbook", "src_encoding": "UTF-8", "text": "# Generated by Django 3.2.4 on 2021-06-08 07:56\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('main', '0005_auto_20210607_1341'),\n ]\n\n operations = [\n migrations.AddField(\n model_name='post',\n name='pw',\n field=models.CharField(default='password', max_length=15),\n ),\n ]\n" }, { "alpha_fraction": 0.5066921710968018, "alphanum_fraction": 0.5468451380729675, "avg_line_length": 21.7391300201416, "blob_id": "bdf7e01be4a7129ba21cc33ae4f4fac82b32eeb7", "content_id": "91a885b510eea322629355f32ea1eeb74147e056", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 523, "license_type": "no_license", "max_line_length": 51, "num_lines": 23, "path": "/guestbook/main/migrations/0005_auto_20210607_1341.py", "repo_name": "gobltpqls99/python-guestbook", "src_encoding": "UTF-8", "text": "# Generated by Django 3.2.4 on 2021-06-07 04:41\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('main', '0004_rename_postname_post_post'),\n ]\n\n operations = [\n migrations.RenameField(\n model_name='post',\n old_name='post',\n new_name='postTitle',\n ),\n migrations.AlterField(\n model_name='post',\n name='name',\n field=models.CharField(max_length=30),\n ),\n ]\n" }, { "alpha_fraction": 0.6480286717414856, "alphanum_fraction": 0.6480286717414856, "avg_line_length": 33.650001525878906, "blob_id": "256787eb062495ffb5df3d3dac296bcd9b9f210e", "content_id": "ce68df36ca170ed66ec31953906a4a4f0e31de5e", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1395, "license_type": "no_license", "max_line_length": 121, "num_lines": 40, "path": "/guestbook/account/views.py", "repo_name": "gobltpqls99/python-guestbook", "src_encoding": "UTF-8", "text": "\n\n\n\n\n\n\nfrom django.contrib import auth\nfrom django.shortcuts import redirect, render\nfrom django.contrib.auth import authenticate, login as auth_login\nfrom django.contrib.auth import logout as auth_logout\nfrom django.contrib.auth.models import User\n\ndef main(request):\n return render(request, \"main/index.html\")\n\n\ndef login(request):\n if request.method == \"POST\":\n account = request.POST['username']\n password = request.POST['password']\n user = authenticate(username = account, password=password)\n if user is not None:\n auth_login(request, user)\n return redirect(\"main:index\")\n else :\n return render(request, \"main/error.html\")\n else :\n return render(request, \"account/login.html\")\n \n\ndef logout(request):\n if request.user.is_authenticated :\n auth_logout(request)\n return redirect(\"main:index\")\n\n\ndef join(request):\n if request.method==\"GET\" :\n return render(request, \"account/signup.html\")\n elif request.method == \"POST\":\n if request.POST['password'] == request.POST['password2']:\n new_user = User.objects.create_user(username=request.POST['username'], password = request.POST['password'])\n auth.login(request, new_user)\n new_user.save()\n return redirect('main:index')\n return render(request, \"account/signup.html\")\n\n\n" }, { "alpha_fraction": 0.6714697480201721, "alphanum_fraction": 0.6873198747634888, "avg_line_length": 36.5405387878418, "blob_id": "d38bcba3c542a9b61eff3e0e45e2ccb28d4298d1", "content_id": "ab72c7367eb6280845759a8a07e6a3ef6c6f26c1", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1448, "license_type": "no_license", "max_line_length": 94, "num_lines": 37, "path": "/guestbook/main/models.py", "repo_name": "gobltpqls99/python-guestbook", "src_encoding": "UTF-8", "text": "from django.db import models\nfrom django.utils import timezone\n# Create your models here.\n\n\nclass Post(models.Model):\n postTitle = models.CharField(max_length=30)\n name = models.CharField(max_length=30)\n pw = models.CharField(max_length=15, default=\"password\")\n content = models.TextField()\n created_at = models.DateTimeField(default=timezone.now)\n\n def __str__(self):\n return f\"name : { self.name } , title: {self.postTitle}, content: {self.content[:10]}\"\n\nclass Reply(models.Model):\n posting = models.ForeignKey(Post,on_delete=models.CASCADE, related_name=\"comments\")\n name = models.CharField(max_length=30)\n pw = models.CharField(max_length=15)\n created_at = models.DateTimeField(default=timezone.now)\n reply = models.TextField()\n\n\nclass User(models.Model):\n user_id = models.CharField(max_length=30, unique=True, verbose_name=\"유저 아이디\")\n user_pw = models.CharField(max_length=120, unique=True, verbose_name=\"유저 비밀번호\")\n user_name = models.CharField(max_length=30, unique=True, verbose_name=\"유저 이름\")\n user_email = models.EmailField(max_length=120, unique=True, verbose_name=\"유저 이메일\")\n user_register_dttm = models.DateTimeField(auto_now_add=True, verbose_name=\"계정 생성 시간\")\n\n def __str__(self):\n return self.user_name\n\n class Meta:\n db_table = 'user'\n verbose_name = '유저'\n verbose_name_plural = '유저'" }, { "alpha_fraction": 0.6270833611488342, "alphanum_fraction": 0.6270833611488342, "avg_line_length": 30.799999237060547, "blob_id": "a702a06f36a9395cbb9ac4abdeb65b74461ed2ee", "content_id": "5be8298598679d9a56058b308297cd1c910e6cb7", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 480, "license_type": "no_license", "max_line_length": 75, "num_lines": 15, "path": "/guestbook/main/urls.py", "repo_name": "gobltpqls99/python-guestbook", "src_encoding": "UTF-8", "text": "\n\n\n\nfrom django.urls import path\n\nfrom . import views\n\n\napp_name = 'main'\nurlpatterns = [\n path('', views.index, name='index'),\n path('write/', views.write, name='write'),\n path('<int:pk>/', views.posting, name=\"posting\"),\n path('delete/<int:pk>', views.delete_posting, name=\"delete\"),\n path('<int:pk>/comment/', views.reply, name=\"reply\"),\n path('reply_delete/<int:pk>', views.reply_delete, name=\"reply_delete\"),\n path('error/', views.error, name=\"error\"),\n]" }, { "alpha_fraction": 0.5871323347091675, "alphanum_fraction": 0.5871323347091675, "avg_line_length": 28.901098251342773, "blob_id": "8a3457ead2ee43ec98a917fdae2395205b1379d4", "content_id": "96e5b1df79eb024cc54c5cded9d8530a1b4f9376", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2720, "license_type": "no_license", "max_line_length": 97, "num_lines": 91, "path": "/guestbook/main/views.py", "repo_name": "gobltpqls99/python-guestbook", "src_encoding": "UTF-8", "text": "from django.shortcuts import redirect, render\nfrom .models import Post, Reply\nfrom django.contrib.auth.decorators import login_required\nfrom django.contrib.auth import logout as auth_logout\n\n\ndef index(request):\n postlist = Post.objects.all()\n return render(request, 'main/index.html', {'postlist': postlist})\n\n\n\ndef write(request):\n if request.method == \"POST\":\n pk = request.GET.get(\"pk\",None)\n if pk is None :\n title = request.POST['title']\n name = request.POST['name']\n content = request.POST['content']\n pw = request.POST['pw']\n new_posting = Post.objects.create(postTitle=title, name=name, content=content, pw=pw)\n new_posting.save()\n return redirect(\"main:posting\", new_posting.pk)\n else:\n posting = Post.objects.get(pk=pk)\n title = request.POST['title']\n name = request.POST['name']\n content = request.POST['content']\n pw = request.POST['pw']\n posting.postTitle = title\n posting.name = name\n posting.content = content\n if pw == posting.pw:\n posting.save()\n return redirect(\"main:posting\", pk)\n else :\n return redirect(\"main:index\")\n elif request.method == \"GET\":\n pk = request.GET.get(\"pk\", None)\n if pk is None:\n return render(request, 'main/write.html')\n else:\n posting = Post.objects.get(pk=pk)\n return render(request, 'main/write.html', {'posting':posting})\n\n\n\ndef posting(request, pk):\n posting = Post.objects.get(pk=pk)\n return render(request, 'main/posting.html', {'posting':posting})\n\n\n\ndef delete_posting(request,pk):\n if request.method == \"POST\":\n posting = Post.objects.get(pk=pk)\n pw = request.POST['pw']\n if pw == posting.pw:\n posting.delete()\n return redirect(\"main:index\")\n else:\n return render(request, 'main/delete.html')\n\n\n\ndef reply(request, pk):\n posting = Post.objects.get(pk=pk)\n name = request.POST['reply_name']\n pw = request.POST['reply_pw']\n reply = request.POST['reply']\n posting.comments.create(name=name, pw=pw, reply=reply)\n posting.save()\n return redirect('main:posting', pk)\n\n\ndef reply_delete(request, pk):\n if request.method == \"POST\":\n reply = Reply.objects.get(pk=pk)\n post_pk = reply.posting.pk\n pw = request.POST['pw']\n if pw == reply.pw:\n reply.delete()\n return redirect(\"main:posting\", post_pk)\n else:\n return render(request, 'main/delete.html')\n\n\n\n\ndef error(request):\n return render(request, \"main/error.html\")" }, { "alpha_fraction": 0.4985673427581787, "alphanum_fraction": 0.5530086159706116, "avg_line_length": 18.38888931274414, "blob_id": "6e580b7721f593dfc3689a65fcf0b462a01d5de4", "content_id": "d7ce19ba591af54b6b922be335aabee71f7ab0c0", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 349, "license_type": "no_license", "max_line_length": 47, "num_lines": 18, "path": "/guestbook/main/migrations/0003_rename_post_post_postname.py", "repo_name": "gobltpqls99/python-guestbook", "src_encoding": "UTF-8", "text": "# Generated by Django 3.2.4 on 2021-06-07 04:33\n\nfrom django.db import migrations\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('main', '0002_post_name'),\n ]\n\n operations = [\n migrations.RenameField(\n model_name='post',\n old_name='post',\n new_name='postname',\n ),\n ]\n" }, { "alpha_fraction": 0.5696902871131897, "alphanum_fraction": 0.5951327681541443, "avg_line_length": 33.769229888916016, "blob_id": "5db282e09fe255ccae7d0e3afeac0b5359cb6101", "content_id": "4c6fb89c749be47cb2f5e12903b83a90d8c2d30e", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 904, "license_type": "no_license", "max_line_length": 133, "num_lines": 26, "path": "/guestbook/main/migrations/0013_reply.py", "repo_name": "gobltpqls99/python-guestbook", "src_encoding": "UTF-8", "text": "# Generated by Django 3.2.4 on 2021-06-09 14:54\n\nfrom django.db import migrations, models\nimport django.db.models.deletion\nimport django.utils.timezone\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('main', '0012_alter_post_created_at'),\n ]\n\n operations = [\n migrations.CreateModel(\n name='Reply',\n fields=[\n ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),\n ('name', models.CharField(max_length=30)),\n ('pw', models.CharField(max_length=15)),\n ('created_at', models.DateTimeField(default=django.utils.timezone.now)),\n ('reply', models.TextField()),\n ('posting', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='comments', to='main.post')),\n ],\n ),\n ]\n" }, { "alpha_fraction": 0.5150684714317322, "alphanum_fraction": 0.567123293876648, "avg_line_length": 19.27777862548828, "blob_id": "cd42dca77ce6b1d34979c4dbe76fb7d88a6ef723", "content_id": "f5c86e748bca4d94a19e29fe66e43f994cd2181f", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 365, "license_type": "no_license", "max_line_length": 51, "num_lines": 18, "path": "/guestbook/main/migrations/0004_rename_postname_post_post.py", "repo_name": "gobltpqls99/python-guestbook", "src_encoding": "UTF-8", "text": "# Generated by Django 3.2.4 on 2021-06-07 04:35\n\nfrom django.db import migrations\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('main', '0003_rename_post_post_postname'),\n ]\n\n operations = [\n migrations.RenameField(\n model_name='post',\n old_name='postname',\n new_name='post',\n ),\n ]\n" }, { "alpha_fraction": 0.5254988670349121, "alphanum_fraction": 0.6053215265274048, "avg_line_length": 22.736841201782227, "blob_id": "04fc06d9d7115ca0368f823ca267d92a567a4f77", "content_id": "a524dffbfa27e3e374ca06e447e3b4ebc46e9fe5", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 451, "license_type": "no_license", "max_line_length": 97, "num_lines": 19, "path": "/guestbook/main/migrations/0011_alter_post_created_at.py", "repo_name": "gobltpqls99/python-guestbook", "src_encoding": "UTF-8", "text": "# Generated by Django 3.2.4 on 2021-06-09 11:28\n\nimport datetime\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('main', '0010_alter_post_created_at'),\n ]\n\n operations = [\n migrations.AlterField(\n model_name='post',\n name='created_at',\n field=models.DateTimeField(default=datetime.datetime(2021, 6, 9, 11, 28, 9, 492440)),\n ),\n ]\n" }, { "alpha_fraction": 0.5213442444801331, "alphanum_fraction": 0.5476838946342468, "avg_line_length": 36.965518951416016, "blob_id": "707eeecf1608101367ba357dfbc7a23adb081f87", "content_id": "8403931fa06fc1906471bbc4d82cf0c7b55b99b9", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1161, "license_type": "no_license", "max_line_length": 117, "num_lines": 29, "path": "/guestbook/main/migrations/0014_user.py", "repo_name": "gobltpqls99/python-guestbook", "src_encoding": "UTF-8", "text": "# Generated by Django 3.2.4 on 2021-06-10 14:04\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('main', '0013_reply'),\n ]\n\n operations = [\n migrations.CreateModel(\n name='User',\n fields=[\n ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),\n ('user_id', models.CharField(max_length=30, unique=True, verbose_name='유저 아이디')),\n ('user_pw', models.CharField(max_length=120, unique=True, verbose_name='유저 비밀번호')),\n ('user_name', models.CharField(max_length=30, unique=True, verbose_name='유저 이름')),\n ('user_email', models.EmailField(max_length=120, unique=True, verbose_name='유저 이메일')),\n ('user_register_dttm', models.DateTimeField(auto_now_add=True, verbose_name='계정 생성 시간')),\n ],\n options={\n 'verbose_name': '유저',\n 'verbose_name_plural': '유저',\n 'db_table': 'user',\n },\n ),\n ]\n" }, { "alpha_fraction": 0.5188171863555908, "alphanum_fraction": 0.5698924660682678, "avg_line_length": 19.66666603088379, "blob_id": "72cac7ccdeeedb10755a965d8d6d2291cefb01d5", "content_id": "6700bbe2ef2bf4b08e969ff7d32f516e4eb9120f", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 372, "license_type": "no_license", "max_line_length": 50, "num_lines": 18, "path": "/guestbook/main/migrations/0007_post_created_at.py", "repo_name": "gobltpqls99/python-guestbook", "src_encoding": "UTF-8", "text": "# Generated by Django 3.2.4 on 2021-06-09 10:55\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('main', '0006_post_pw'),\n ]\n\n operations = [\n migrations.AddField(\n model_name='post',\n name='created_at',\n field=models.DateField(auto_now=True),\n ),\n ]\n" } ]
12
JarodRosenthal/Jarod_Challenge
https://github.com/JarodRosenthal/Jarod_Challenge
da865cc6ebaf7b776bd593b7b893f6c3d2071f91
9654b206acf4bc61ea57c8773d6aefffc0b2a7b3
a9d44cbc27f50d29ef59a4dae13bfbc11e35d083
refs/heads/main
2023-08-21T02:04:50.622443
2021-10-26T01:35:34
2021-10-26T01:35:34
420,317,407
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.4347517788410187, "alphanum_fraction": 0.4695035517215729, "avg_line_length": 24.636363983154297, "blob_id": "1e22dfdf1a36a44055c75933efba075d9617dde6", "content_id": "6699f718edaced40d9dd041c4ca074e2d9c4c3f2", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1410, "license_type": "no_license", "max_line_length": 65, "num_lines": 55, "path": "/complex_numbers.py", "repo_name": "JarodRosenthal/Jarod_Challenge", "src_encoding": "UTF-8", "text": "import math\nclass Complex:\n def __init__(self, a, b):\n self.a, self.b = a, b;\n def display(self):\n if self.a < 0.005 and self.a > -0.005:\n self.a = 0;\n if self.b < 0.005 and self.b > -0.005:\n self.b = 0;\n if self.a != 0:\n str1 = '%0.2f' % self.a;\n if self.b > 0:\n str1 += ' + %0.2fi' % self.b;\n elif self.b < 0:\n str1 += ' - %0.2fi' % -self.b;\n elif self.b != 0:\n str1 = '%0.2fi' % self.b;\n else:\n str1 = '0.00';\n print str1;\n \n def conjugate(self):\n return Complex(self.a, -self.b);\n def norm(self):\n return self.a*self.a + self.b*self.b;\n def scale(self, scalar):\n return Complex(self.a*scalar, self.b*scalar);\n\n \ndef add(a, b):\n return Complex(a.a + b.a, a.b + b.b);\ndef sub(a, b):\n return Complex(a.a - b.a, a.b - b.b);\ndef mul(a, b):\n return Complex(a.a * b.a - a.b * b.b, a.a * b.b + a.b * b.a);\ndef div(a, b):\n return mul(a, b.conjugate().scale(1.0/b.norm()));\n \nx = Complex(0, 0);\ny = Complex(0, 0);\n\n[a, b] = raw_input().split();\nx.a = float(a);\nx.b = float(b);\n\n[a, b] = raw_input().split();\ny.a = float(a);\ny.b = float(b);\n\nadd(x, y).display();\nsub(x, y).display();\nmul(x, y).display();\ndiv(x, y).display();\nprint '%0.2f' % math.sqrt(x.norm());\nprint '%0.2f' % math.sqrt(y.norm());\n" }, { "alpha_fraction": 0.7511500716209412, "alphanum_fraction": 0.7601314187049866, "avg_line_length": 54.67073059082031, "blob_id": "4dd58b77e22e5d5f44a3c29f4043526ab2723684", "content_id": "fd35c43c2630b2ceb20befa77b1551a7fb4acaa9", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 4565, "license_type": "no_license", "max_line_length": 975, "num_lines": 82, "path": "/README.md", "repo_name": "JarodRosenthal/Jarod_Challenge", "src_encoding": "UTF-8", "text": "# SecNet Challenge\n\nCloudFormation template to stand up a secure web server using a self signed certificate. \n\n## Requirements\n\n- [x] Create and deploy a running instance of a web server using a configuration management tool of your choice. \n- [x] The web server should serve one page with the following content:\n ```html \n<html>\n <head>\n <title>We are SecNet!</title>\n </head>\n <body>\n <h1>We are SecNet!</h1>\n </body>\n</html>\n```\n- [x] Secure this application and host such that only appropriate ports are publicly exposed and any http\nrequests are redirected to https. This should be automated using a configuration management tool of your choice and you should feel free to use a self-signed certificate for the web server.\n- [x] Develop and apply automated tests to validate the correctness of the server configuration.\nExpress everything in code\n- [x] Provide your code in an https://github.com repo named <YOUR_FIRSTNAME>_Challenge\n\n## Solution\nFor this challenge CloudFormation was selected as the IaC management tool. The roll back capability CloudFormation offers will be helpful when performing automated smoke tests. In the template an Apache web server is stood up running on an Amazon Linux AMI. The template uses Mappings to automatically pull in the correct AMI Id for different US regions. Amazon Linux is selected because it comes with AWS agents and cli tools pre-installed. The stack will deploy into the default VPC, has 3 AZs to work with, and uses a default instance type t3.small with a fall back choice of t3a.small. A fall back choice ensures a greater pool of capacity is available. The web server sits in an ASG that utilizes a mix of Spot and On-Demand instances. This stateless application is a good fit for Spot usage. A security group is created to allow open access for Apache and SSH via an IP using a /32 bit mask. Apache has a self signed certificate and is setup to redirect HTTP to HTTPS. \n\n## Validation\nAn automated validation test is applied in the UserData section. There are two while loops that curl using HTTPS and HTTP to the index.html file. It checks every 5 seconds until a 200 success code for HTTPS and a 301 redirection code for HTTP are returned. If not received within 3 minutes the creation policy will timeout and automatically roll back the changes and signal failure. A final check is performed to look for the words \"We are SecNet!\" in the index.html file. If successful, we know Apache is running, that the index.html file has been created, and that redirection from HTTP to HTTPS is working. Once CloudFormation receives a success signal the deployment then completes. \n\n## Notes\nTo work around the lack of a domain with a self-signed certificate. An IAM role is attached to the instance to provide permission to associate an EIP. This allows a predictable IP to be applied to the virtual host configuration in httpd.conf. This enables Apache to handle HTTP to HTTPS redirection. \n\n```html\n<VirtualHost *:80> \n DocumentRoot \"/var/www/html\"\n ServerName \"18.190.x.x\"\n ServerAlias \"18.190.x.x\"\n Redirect permanent / https://18.190.x.x/\n</VirtualHost>\n```\n\n## Future Scaling\nTo scale this application you would associate the ASG with a target group and place it behind an Elastic Load Balancer. Then utilize CloudWatch advanced tracking metrics such as Target Request Count to distribute incoming requests to individual targets. \n \n## Deployment\n\nUse the AWS console or [AWS](https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2-linux.html#cliv2-linux-install) CLI to deploy template.\n\n## Usage\n\n```bash\naws cloudformation create-stack --stack-name MyStack --template-body file://file.json --parameters \\\nParameterKey=KeyName,ParameterValue=<your_key> \\\nParameterKey=Subnets,ParameterValue=subnet-xxxxxxxx\\\\,subnet-xxxxxxxx\\\\,subnet-xxxxxxxx \\\nParameterKey=VpcId,ParameterValue=vpc-xxxxxxxx \\\nParameterKey=SSHLocation,ParameterValue=x.x.x.x/32 \\\n--capabilities CAPABILITY_NAMED_IAM\n```\n\nOnce deployed the Elastic Ip address can be returned by running.\n```bash\naws cloudformation describe-stacks --stack-name <your_stack_name> --query Stacks[].Outputs\n```\nOutput\n```bash\n[\n [\n {\n \"OutputKey\": \"EIPaddress\",\n \"OutputValue\": \"18.116.x.x\",\n \"Description\": \"Elastic Ip address\",\n \"ExportName\": \"SecNet-EIP\"\n }\n ]\n]\n```\n\n## Contributing\nPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.\n\nPlease make sure to update tests as appropriate.\n" } ]
2
yiheng/analytics-zoo
https://github.com/yiheng/analytics-zoo
2ef59fd48ebc0b4d11411d47c910ff7277f8e4e8
ec1773e44af2515e085e4552988a0e493d0dfae1
c5fdc694aa5576d895ffd45e4181713620e52b07
refs/heads/master
2021-01-18T11:57:13.074017
2017-10-30T02:08:54
2017-10-30T02:08:54
100,361,653
0
0
Apache-2.0
2017-08-15T09:27:41
2017-08-15T09:27:43
2018-09-14T08:37:43
Jupyter Notebook
[ { "alpha_fraction": 0.770039439201355, "alphanum_fraction": 0.770039439201355, "avg_line_length": 43.82352828979492, "blob_id": "a19512e20de787546822f9be42547445cc9ebab0", "content_id": "4667bda2650ee4ba3a9f43503bcf0e66399f2108", "detected_licenses": [ "Apache-2.0" ], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 761, "license_type": "permissive", "max_line_length": 114, "num_lines": 17, "path": "/transform/vision/README.md", "repo_name": "yiheng/analytics-zoo", "src_encoding": "UTF-8", "text": "# Vision\n\n## Image Augmentation\n\nCurrently a series of image augmentation transformers have been supported:\n* Brightness: adjust the image brightness\n* ChannelOrder: shuffle the channel order\n* Hue: adjust the image hue\n* Saturation: adjust the image saturation\n* Contrast: adjust image contrast\n* ColorJitter: a random combination of **Brightness**, **ChannelOrder**, **Hue**, **Saturation** and **Contrast**.\n* Resize: resize the image, default mode is INTER_LINEAR.\n* HFlip: horizontally flip the image\n* Expand: expand the image, with the background filled with given color\n* Crop: crop the image given a roi(region of interest)\n* CenterCrop: crop the center of image given width and height\n* RandomCrop: crop the random area of image given width and height" }, { "alpha_fraction": 0.6915334463119507, "alphanum_fraction": 0.7258732914924622, "avg_line_length": 34.14583206176758, "blob_id": "e2d7404d06013424390e0613cb43abe2313b82be", "content_id": "f63c9664672531580a78efdaa3982a7dec57fcda", "detected_licenses": [ "Apache-2.0" ], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 1689, "license_type": "permissive", "max_line_length": 153, "num_lines": 48, "path": "/apps/ssd/README.md", "repo_name": "yiheng/analytics-zoo", "src_encoding": "UTF-8", "text": "# Demo Setup Guide\n\n## Install Dependency Packages\n\nReference https://github.com/intel-analytics/BigDL/wiki/Python-Support\n\n## Download BigDL jars\n\nDownload BigDL Nightly Build jars from https://github.com/intel-analytics/BigDL/wiki/Downloads\n\nThe default spark version is Spark 1.5.1\n\n\n## 2 Start Jupyter Server\n\n* Create start_notebook.sh, copy and paste the contents below, and edit SPARK_HOME, BigDL_HOME accordingly. Change other parameter settings as you need. \n```bash\n#!/bin/bash\n\n#setup pathes\nSPARK_HOME=/Users/bigdl/spark-1.6.0-bin-hadoop2.6/\nAnalytics_HOME=/Users/bigdl/analytics-zoo\nBigDL_HOME=/Users/bigdl/dist-spark-1.5.1-scala-2.10.5-linux64-0.2.0-20170510.012057-18-dist\n#use local mode or cluster mode\n#MASTER=spark://xxxx:7077\nMASTER=\"local[4]\"\n\nPYTHON_API_ZIP_PATH=${BigDL_HOME}/lib/bigdl-0.2.0-SNAPSHOT-python-api.zip\nBigDL_JAR_PATH=${Analytics_HOME}/pipeline/target/pipeline-0.1-SNAPSHOT-jar-with-dependencies.jar\n\nexport PYTHONPATH=${PYTHON_API_ZIP_PATH}:$PYTHONPATH\nexport IPYTHON_OPTS=\"notebook --notebook-dir=./ --ip=* --no-browser --NotebookApp.token=''\"\n\n${SPARK_HOME}/bin/pyspark \\\n --master ${MASTER} \\\n --properties-file ${BigDL_HOME}/conf/spark-bigdl.conf \\\n --driver-cores 1 \\\n --driver-memory 10g \\\n --total-executor-cores 3 \\\n --executor-cores 1 \\\n --executor-memory 20g \\\n --conf spark.akka.frameSize=64 \\\n --py-files ${PYTHON_API_ZIP_PATH} \\\n --jars ${BigDL_JAR_PATH} \\\n --conf spark.driver.extraClassPath=${BigDL_JAR_PATH} \\\n --conf spark.executor.extraClassPath=pipeline-0.1-SNAPSHOT-jar-with-dependencies.jar\n```\n* Put start_notebook.sh and start_tensorboard.sh in home directory and execute them in bash.\n\n\n" }, { "alpha_fraction": 0.6149388551712036, "alphanum_fraction": 0.6226658225059509, "avg_line_length": 31.020618438720703, "blob_id": "0f7a1dfd0019850a7a568bed7986510a29894163", "content_id": "ab497eb433c4ab26f765289c722404a9a862c961", "detected_licenses": [ "Apache-2.0" ], "is_generated": false, "is_vendor": false, "language": "Java", "length_bytes": 3106, "license_type": "permissive", "max_line_length": 100, "num_lines": 97, "path": "/transform/vision/src/main/java/com/intel/analytics/zoo/transform/vision/image/opencv/OpenCV.java", "repo_name": "yiheng/analytics-zoo", "src_encoding": "UTF-8", "text": "/*\n * Copyright 2016 The BigDL Authors.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage com.intel.analytics.zoo.transform.vision.image.opencv;\n\nimport java.io.*;\nimport java.net.URL;\nimport java.nio.channels.FileChannel;\nimport java.nio.channels.ReadableByteChannel;\n\nimport static java.io.File.createTempFile;\nimport static java.nio.channels.Channels.newChannel;\n\n/**\n * OpenCV Library Wrapper for JVM\n */\npublic class OpenCV {\n private static boolean isLoaded = false;\n private static File tmpFile = null;\n\n public static void load() {\n try {\n String jopencvFileName = \"opencv/linux/x86_64/libopencv_java320.so\";\n if (System.getProperty(\"os.name\").toLowerCase().contains(\"mac\")) {\n jopencvFileName = \"opencv/osx/x86_64/libopencv_java320.dylib\";\n }\n tmpFile = extract(jopencvFileName);\n System.load(tmpFile.getAbsolutePath());\n tmpFile.delete(); // delete so temp file after loaded\n isLoaded = true;\n\n } catch (Exception e) {\n isLoaded = false;\n e.printStackTrace();\n // TODO: Add an argument for user, continuing to run even if opencv load failed.\n throw new RuntimeException(\"Failed to load OpenCV\");\n }\n }\n\n /**\n * Check if opencv is loaded\n * @return\n */\n public static boolean isOpenCVLoaded() {\n return isLoaded;\n }\n\n /**\n * Get the temp path of the .so file\n * @return\n */\n public static String getTmpSoFilePath() {\n if(tmpFile == null)\n return \"\";\n else\n return tmpFile.getAbsolutePath();\n }\n\n // Extract so file from jar to a temp path\n private static File extract(String path) {\n try {\n URL url = OpenCV.class.getClassLoader().getResource(path);\n if (url == null) {\n throw new Error(\"Can't find so file in jar, path = \" + path);\n }\n\n InputStream in = OpenCV.class.getClassLoader().getResourceAsStream(path);\n File file = createTempFile(\"dlNativeLoader\", path.substring(path.lastIndexOf(\"/\") + 1));\n\n ReadableByteChannel src = newChannel(in);\n FileChannel dest = new FileOutputStream(file).getChannel();\n dest.transferFrom(src, 0, Long.MAX_VALUE);\n return file;\n } catch (Throwable e) {\n throw new Error(\"Can't extract so file to /tmp dir\");\n }\n }\n\n public static void main(String[] args) {\n OpenCV openCV = new OpenCV();\n openCV.load();\n }\n\n}\n" }, { "alpha_fraction": 0.7956204414367676, "alphanum_fraction": 0.7956204414367676, "avg_line_length": 67.5, "blob_id": "e12c0b8ff4fc0408a3222e27b931b4fe9f269564", "content_id": "821ce5a7bcdf82013ebb77a7bbcf813be5fcfc2e", "detected_licenses": [ "Apache-2.0" ], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 137, "license_type": "permissive", "max_line_length": 120, "num_lines": 2, "path": "/README.md", "repo_name": "yiheng/analytics-zoo", "src_encoding": "UTF-8", "text": "# Analytics Zoo\nZoo for deep learning powered big data analytics using [BigDL](https://github.com/intel-analytics/BigDL) on Apache Spark\n" }, { "alpha_fraction": 0.6677889823913574, "alphanum_fraction": 0.726150393486023, "avg_line_length": 35.95833206176758, "blob_id": "11c9833c3c4b2c7b08b0348ad57012b13a40d85d", "content_id": "9876e113055ecc52c5b7e710667fbb12c0511ed2", "detected_licenses": [ "Apache-2.0" ], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 891, "license_type": "permissive", "max_line_length": 92, "num_lines": 24, "path": "/pipeline/deepspeech2/README.md", "repo_name": "yiheng/analytics-zoo", "src_encoding": "UTF-8", "text": "\nThis demo code contains the inference based on pre-trained Deep Speech 2 model on BigDL 0.1.\n(Soon to be updated to 0.3). The example runs on Spark 2.0+\n\n### ds2 model (~387MB):\nhttps://drive.google.com/open?id=0B9zID9CU9HQeU1luc2ZKSHA1MjA\n\n\n### Run inference with example:\n\n1. Download model file \"dp2.bigdl\" from the link above.\n\n2. Import the project into IDE or build with \"mvn clean package\".\n\n3. script to run ds2 inference:\n\n```shell\n spark-submit --master local[1] \\\n --conf spark.driver.memory=20g \\\n --conf \"spark.serializer=org.apache.spark.serializer.JavaSerializer\" \\\n --driver-class-path deepspeech2-0.1-SNAPSHOT-jar-with-dependencies.jar \\\n --class com.intel.analytics.zoo.pipeline.deepspeech2.example.InferenceExample \\\n deepspeech2-0.1-SNAPSHOT-jar-with-dependencies.jar \\\n -m /path/to/dp2.bigdl -d /path/data/1462-170145-0004.flac -n 1 -p 1 -s 30\n ```\n\n\n\n" }, { "alpha_fraction": 0.8243243098258972, "alphanum_fraction": 0.8243243098258972, "avg_line_length": 36, "blob_id": "95d6dfb040900019e14291dec5bc63eb3ebe3d38", "content_id": "e31a5ca7598672292b59e93caf61bb4b6bc58bbd", "detected_licenses": [ "Apache-2.0" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 148, "license_type": "permissive", "max_line_length": 79, "num_lines": 4, "path": "/transform/vision/src/main/python/__init__.py", "repo_name": "yiheng/analytics-zoo", "src_encoding": "UTF-8", "text": "from util.common import JavaCreator\n\nJavaCreator.set_creator_class(\n \"com.intel.analytics.zoo.transform.vision.pythonapi.PythonVisionTransform\")\n" } ]
6
wixenius/IntNet_project
https://github.com/wixenius/IntNet_project
8fa7b39a6250611b1de20f620177d9c5f8a0f0a2
a18457984abd00b191302a88baa13ad09b39b7fd
219b5caf462a0e3d1fcb96b792884b3051dc05e2
refs/heads/master
2016-08-08T21:12:13.905570
2016-04-04T21:34:23
2016-04-04T21:34:23
54,026,019
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.4654867351055145, "alphanum_fraction": 0.4690265357494354, "avg_line_length": 28.736841201782227, "blob_id": "08bd6c78f18e42a3858e454aa19fba6e52ffe3f7", "content_id": "8788258b3c9c4d87601e804fa61becd026f952a0", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "HTML", "length_bytes": 565, "license_type": "no_license", "max_line_length": 86, "num_lines": 19, "path": "/users/templates/users/signup.html", "repo_name": "wixenius/IntNet_project", "src_encoding": "UTF-8", "text": "<div class=\"outer\">\n <div class=\"inner\">\n <h1>Register with Visningar</h1>\n\n {% if registered %}\n <strong>Thank you for signing up!</strong>\n <a href=\"{% url 'home' %}\">Return to the homepage and get started.</a><br>\n {% else %}\n <form id=\"user_form\" method=\"POST\" enctype=\"multipart/form-data\">\n {% csrf_token %}\n\n {{ user_form.as_p }}\n\n <input type=\"submit\" name=\"submit\" value=\"Signup\" />\n </form>\n \n {% endif %}\n </div>\n</div>\n" }, { "alpha_fraction": 0.5542436838150024, "alphanum_fraction": 0.5887725353240967, "avg_line_length": 43, "blob_id": "b609cef0f75a882ceb062bc26f6930f2d737378b", "content_id": "de6d22aab8265abb017d37c227dec65abf0ca868", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 4489, "license_type": "no_license", "max_line_length": 110, "num_lines": 102, "path": "/visning/forms.py", "repo_name": "wixenius/IntNet_project", "src_encoding": "UTF-8", "text": "from django import forms\nfrom .models import Object, HouseType\nimport locale\n\nlocale.setlocale(locale.LC_ALL, 'en_US.utf8')\n\n#http://stackoverflow.com/questions/17392459/django-form-setting-choicefield-options-as-form-is-called\nclass SortForm(forms.Form):\n CHOICES = (\n ('price', 'Price'),\n ('pub', 'Published'),\n ('area', 'Living area'),\n ('rooms', 'Rooms'),\n ('objt', 'Object type'),\n ('ppsm', 'Price per Squaremeter'),\n ('rent', 'Rent')\n )\n selectSortBy = forms.ChoiceField(choices=CHOICES, required=True, label='Sort by',\n widget=forms.Select(attrs={\n \"onChange\": 'sort()'\n }))\n\n # CHOICES=[('True','True'),\n # ('False','False')]\n\n # search = forms.ChoiceField(choices=CHOICES, widget=forms.HiddenInput())\n\nclass SearchForm(forms.Form):\n CHOICES = (\n ('price', 'Price'),\n ('pub', 'Published'),\n ('area', 'Living area'),\n ('rooms', 'Rooms'),\n ('objt', 'Object type'),\n ('ppsm', 'Price per Squaremeter'),\n ('rent', 'Rent')\n )\n CHOICES = ( (x.houseType, x.houseType) for x in HouseType.objects.all())\n ObjectType = forms.MultipleChoiceField(required=False, widget=forms.CheckboxSelectMultiple(),\n choices=CHOICES)\n\n\n LOWER_RANGE = tuple( (x, x) for x in range(1,11,1) )\n CHOICES = ( ('Min', 'Min'), ) + LOWER_RANGE\n roomsLower = forms.ChoiceField(choices=CHOICES, required=False, label='Min livingarea',\n widget = forms.Select(attrs={\n \"onChange\": 'raiseRangeHigher()'\n }))\n HIGHER_RANGE = tuple( (x, x) for x in range(10,1,-1) )\n CHOICES = ( ('Max', 'Max'), ) + HIGHER_RANGE\n roomsHigher = forms.ChoiceField(choices=CHOICES, required=False, label='Max livingarea',\n widget = forms.Select(attrs={\n \"onChange\": 'lowerRangeLower()'\n }))\n\n\n LOWER_RANGE = tuple( (x, x) for x in range(10,105,10) )\n CHOICES = ( ('Min', 'Min'), ) + LOWER_RANGE\n livingAreaLower = forms.ChoiceField(choices=CHOICES, required=False, label='Min livingarea',\n widget = forms.Select(attrs={\n \"onChange\": 'raiseRangeHigher()'\n }))\n HIGHER_RANGE = tuple( (x, x) for x in range(200,10,-20) )\n CHOICES = ( ('Max', 'Max'), ) + HIGHER_RANGE\n livingAreaHigher = forms.ChoiceField(choices=CHOICES, required=False, label='Max livingarea',\n widget = forms.Select(attrs={\n \"onChange\": 'lowerRangeLower()'\n }))\n\n\n LOWER_RANGE = tuple( (x, locale.format(\"%d\", x, grouping=True)) for x in range(200000,2000000,100000) )\n MIDDLE_RANGE = tuple( (x, locale.format(\"%d\", x, grouping=True)) for x in range(2000000,5000000,250000) )\n CHOICES = ( ('Min', 'Min'), ) + LOWER_RANGE + MIDDLE_RANGE\n listPriceLower = forms.ChoiceField(choices=CHOICES, required=False, label='Min price',\n widget = forms.Select(attrs={\n \"onChange\": 'raiseRangeHigher()'\n }))\n HIGHER_RANGE = tuple( (x, locale.format(\"%d\", x, grouping=True)) for x in range(5000000,2000000,-250000) )\n MIDDLE_RANGE = tuple( (x, locale.format(\"%d\", x, grouping=True)) for x in range(2000000,300000,-100000) )\n CHOICES = ( ('Max', 'Max'), ) + HIGHER_RANGE + MIDDLE_RANGE\n listPriceHigher = forms.ChoiceField(choices=CHOICES, required=False, label='Max price',\n widget = forms.Select(attrs={\n \"onChange\": 'lowerRangeLower()'\n }))\n\n\n LOWER_RANGE = tuple( (x, locale.format(\"%d\", x, grouping=True)) for x in range(500,5000,500) )\n MIDDLE_RANGE = tuple( (x, locale.format(\"%d\", x, grouping=True)) for x in range(5000,10000,1000) )\n CHOICES = ( ('Min', 'Min'), ) + LOWER_RANGE + MIDDLE_RANGE\n rentLower = forms.ChoiceField(choices=CHOICES, required=False, label='Min rent',\n widget = forms.Select(attrs={\n \"onChange\": 'raiseRangeHigher()'\n }))\n HIGHER_RANGE = tuple( (x, locale.format(\"%d\", x, grouping=True)) for x in range(10000,5000,-1000) )\n MIDDLE_RANGE = tuple( (x, locale.format(\"%d\", x, grouping=True)) for x in range(5000,500,-500) )\n CHOICES = ( ('Max', 'Max'), ) + HIGHER_RANGE + MIDDLE_RANGE\n rentHigher = forms.ChoiceField(choices=CHOICES, required=False, label='Max rent',\n widget = forms.Select(attrs={\n \"onChange\": 'lowerRangeLower()'\n }))\n\n namedAreas = forms.CharField(required=False)\n\n" }, { "alpha_fraction": 0.5420918464660645, "alphanum_fraction": 0.550765335559845, "avg_line_length": 38.189998626708984, "blob_id": "9c5b62c5bd8cf83732270c58798a4c04fa03b518", "content_id": "2ea1925aceb8aa1749116368d07aa880e3a6207c", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3920, "license_type": "no_license", "max_line_length": 155, "num_lines": 100, "path": "/visning/view_helpfuncs.py", "repo_name": "wixenius/IntNet_project", "src_encoding": "UTF-8", "text": "from django.db.models import Q\nimport datetime\n\ndef set_cookie(response, key, value, days_expire = 7, hours = 24):\n if days_expire is None:\n max_age = 365 * 24 * 60 * 60 #one year\n else:\n max_age = days_expire * hours * 60 * 60\n expires = datetime.datetime.strftime(datetime.datetime.utcnow() + datetime.timedelta(seconds=max_age), \"%a, %d-%b-%Y %H:%M:%S GMT\")\n response.set_cookie(key, value, max_age=max_age, expires=expires, domain=settings.SESSION_COOKIE_DOMAIN, secure=settings.SESSION_COOKIE_SECURE or None)\n\ndef parse_searchForm(request, query, searchForm):\n checkList = request.POST.getlist('ObjectType')\n d = {}\n if searchForm.cleaned_data['ObjectType']:\n d['ObjectType'] = searchForm.cleaned_data['ObjectType']\n query = query.filter(objectType__in = searchForm.cleaned_data['ObjectType'])\n\n\n for label in ['rent', 'listPrice', 'livingArea', 'rooms']:\n lower = searchForm.cleaned_data[label + 'Lower']\n if lower != 'Min' and lower.isdigit():\n d[label + 'Lower'] = int(lower)\n if 'rent' == label:\n query = query.filter(rent__gte = int(lower))\n if 'listPrice' == label:\n query = query.filter(listPrice__gte = int(lower))\n if 'livingArea' == label:\n query = query.filter(livingArea__gte = int(lower))\n if 'rooms' == label:\n query = query.filter(rooms__gte = int(lower))\n\n higher = searchForm.cleaned_data[label + 'Higher']\n if higher != 'Max' and higher.isdigit():\n d[label + 'Higher'] = int(higher)\n if 'rent' == label:\n query = query.filter(rent__lte = int(higher))\n if 'listPrice' == label:\n query = query.filter(listPrice__lte = int(higher))\n if 'livingArea' == label:\n query = query.filter(livingArea__lte = int(higher))\n if 'rooms' == label:\n query = query.filter(rooms__lte = int(higher))\n\n if searchForm.cleaned_data['namedAreas']:\n search = searchForm.cleaned_data['namedAreas']\n query = query.filter(Q(namedAreas_lower=search.lower()))\n\n return query, d\n\ndef parse_searchDict(query, dSearchForm):\n if 'ObjectType' in dSearchForm.keys():\n query = query.filter(objectType__in = dSearchForm['ObjectType'])\n\n\n for label in ['rent', 'listPrice', 'livingArea', 'rooms']:\n if label + 'Lower' in dSearchForm.keys():\n lower = dSearchForm[label + 'Lower']\n if lower != 'Min':\n if 'rent' == label:\n query = query.filter(rent__gte = lower)\n if 'listPrice' == label:\n query = query.filter(listPrice__gte = lower)\n if 'livingArea' == label:\n query = query.filter(livingArea__gte = lower)\n if 'rooms' == label:\n query = query.filter(rooms__gte = lower)\n\n if label + 'Higher' in dSearchForm.keys():\n higher = dSearchForm[label + 'Higher']\n if higher != 'Max':\n if 'rent' == label:\n query = query.filter(rent__lte = higher)\n if 'listPrice' == label:\n query = query.filter(listPrice__lte = higher)\n if 'livingArea' == label:\n query = query.filter(livingArea__lte = higher)\n if 'rooms' == label:\n query = query.filter(rooms__lte = higher)\n\n return query\n\ndef getGoogleMapsStartPoint(objects):\n lat, lon = 0, 0\n lLat, lLon = [], []\n for obj in objects:\n lLon.append(obj.longitude)\n lLat.append(obj.latitude)\n\n if len(lLat) > 1:\n lat = (min(lLat) + max(lLat)) / 2\n else:\n lat = 59.3275\n\n if len(lLon) > 1:\n lon = (min(lLon) + max(lLon)) / 2\n else:\n lon = 18.0675\n\n return lat, lon\n\n" }, { "alpha_fraction": 0.4239707887172699, "alphanum_fraction": 0.43061089515686035, "avg_line_length": 36.4161491394043, "blob_id": "3cd4be9893d6006acbde55511178fdb7452035d8", "content_id": "cd862e83f9ebd2068c903d5baf1813161d3ca912", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "HTML", "length_bytes": 6026, "license_type": "no_license", "max_line_length": 155, "num_lines": 161, "path": "/visning/templates/visning/post_objects.html", "repo_name": "wixenius/IntNet_project", "src_encoding": "UTF-8", "text": "{% extends 'visning/base.html' %}\n\n{% load humanize %}\n\n{% block content %}\n\n {% include 'visning/search.html' %}\n\n\n <div id=\"map-canvas\" class=\"content\" style=\"height: 500px; margin-bottom: 10px; margin-top: 10px;\"></div>\n \n <script type=\"text/javascript\" src=\"http://maps.google.com/maps/api/js?key=AIzaSyCHR2rT1j4MCG5mKoXkF14RFeWuzDFN1R0&sensor=false\"></script>\n<script type=\"text/javascript\">\n\n var map;\n function initialize() {\n var mapDiv = document.getElementById('map-canvas');\n map = new google.maps.Map(mapDiv, {\n center: new google.maps.LatLng({{ startPoint_lat }},{{ startPoint_lon }}),\n zoom: 9,\n mapTypeId: google.maps.MapTypeId.ROADMAP\n });\n\n google.maps.event.addListenerOnce(map, 'tilesloaded', addMarkers);\n\n }\n function addMarkers() {\n\n {% for mark in allObjects %}\n\n var point = new google.maps.LatLng({{mark.latitude}},{{mark.longitude}});\n // var image = '{{ STATIC_PREFIX }}'+ 'checkmark.png';\n var marker = new google.maps.Marker({\n position: point,\n map: map,\n //icon: image, \n url: \"{% url 'post_detail' booli_id=mark.booli_id %}\",\n title: '{{ mark.booli_id }}',\n });\n marker['infowindow'] = new google.maps.InfoWindow({\n content: \"<h1>{{mark.booli_id}}</h1> <br> {{ mark.booli_id }} <p> <a href=\\\"{% url 'post_detail' booli_id=mark.booli_id %}\\\">Details</a>\",\n });\n google.maps.event.addListener(marker, 'click', function() {\n //window.location.href = this.url;\n this['infowindow'].open(map, this);\n });\n /* google.maps.event.addListener(marker, 'mouseover', function() {\n // this['infowindow'].open(map, this);\n });\n google.maps.event.addListener(marker, 'mouseout', function() {\n // this['infowindow'].close(map, this);\n\n }); */\n\n\n\n\n\n {% endfor %} \n\n }\n\n\n google.maps.event.addDomListener(window, 'load', initialize);\n</script>\n\n\n <div id=\"wrapper-sortBy-form\">\n <form method=\"POST\" class=\"post-form\" id=\"sortBy-form\">{% csrf_token %}\n {{ sortForm.as_p }}\n </form>\n <a href=\"?page={{ objects.number }}&invert=True\" class=\"save btn btn-default btn-sm\">Invert</a>\n </div>\n\n <script>\n function sort() {\n $('#sortBy-form').submit();\n }\n </script>\n\n {% for obj in objects %}\n <div class=\"object_post\">\n {% if obj.exhibitdate_set.all %}\n <a class=\"collapsetoggle\" data-toggle=\"collapse\" href=\"#collapse_{{forloop.counter}}\">\n {% endif %}\n <!--<a href=\"{% url 'post_detail' booli_id=obj.booli_id %}\" > -->\n <div class=\"object\" >\n <div class=\"row\">\n <div class=\"col-sm-3 firstcolumn\">\n <div class=\"Aligner-item\">\n <p>{{ obj.published }}</p>\n <img src=\"https://api.bcdn.se/cache/primary_{{ obj.booli_id }}_140x94.jpg\">\n </div>\n\n </div>\n\n <div class=\"col-sm-3 secondcolumn\">\n <p>{{ obj.municipalityName }}</p>\n <p>{{ obj.namedAreas }}</p>\n <p>{{ obj.streetAddress }}</p>\n </div>\n\n <div class=\"col-sm-3\">\n <p>{{ obj.livingArea }} m<sup>2</sup></p>\n <p>{{ obj.rooms }} rooms</p>\n </div>\n\n <div class=\"col-sm-3\">\n <p>{{ obj.listPrice|intcomma }} kr</p>\n <p>{{ obj.pricePerSquareMeter|intcomma }} kr/m<sup>2</sup></p>\n <p>{{ obj.rent|intcomma }} kr/month</p>\n </div>\n </div>\n {% if obj.exhibitdate_set.all %}\n <div class=\"row\">\n <div class=\"column col-sm-12 image-container\">\n {% load staticfiles %} \n <img src=\"{% static 'visning/images/arrow-down.png' %}\" style=\"width:50px;height:15px;\"/>\n </div>\n </div>\n {% endif %}\n {% if obj.exhibitdate_set.all %}\n </a>\n {% endif %}\n <div id=\"collapse_{{forloop.counter}}\" class=\"panel-collapse collapse\">\n <div class=\"row\">\n <div class=\"col-sm-6\">\n {% if obj.exhibitdate_set.all %}\n <h4>Visningar</h4>\n {% for exhibit in obj.exhibitdate_set.all %}\n <div class=\"row\" style=\"margin-bottom:8px;\">\n <div class=\"col-sm-6\" >\n <p>{{ exhibit.start|date:\"j N H:i\"}} - {{ exhibit.end|date:\"H:i\"}}</p>\n </div>\n <div class=\"col-sm-3\">\n <button type=\"button\" class=\"btn btn-primary btn-sm\">Spara</button>\n </div>\n </div>\n \n {% endfor %}\n </div>\n <div class=\"col-sm-6\">\n {% if obj.exhibitdate_set.all.0.metaInfo %}\n <h4>Information från mäklare</h4>\n <p>{{ obj.exhibitdate_set.all.0.metaInfo}}</p>\n {% endif %}\n <a href=\"{% url 'post_detail' booli_id=obj.booli_id %}\" > \n <p style=\"margin-top:10px;\"> Se karta </p>\n </a>\n </div>\n {% endif %}\n </div>\n </div>\n </div>\n </div>\n\n\n {% endfor %}\n\n {% include 'visning/pagination.html' %}\n{% endblock %}\n" }, { "alpha_fraction": 0.5272610783576965, "alphanum_fraction": 0.5407312512397766, "avg_line_length": 36.974998474121094, "blob_id": "e57eb601849eb7456ece7d3d716c76fedc3a328d", "content_id": "b0715b0f15fa4d4c7ad00039b048b9434fedabf6", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1559, "license_type": "no_license", "max_line_length": 129, "num_lines": 40, "path": "/visning/management/commands/scrapers/svenskfast.py", "repo_name": "wixenius/IntNet_project", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\r\n\r\nfrom bs4 import BeautifulSoup\r\nfrom visning.management.commands.scrapers import help_functions\r\nfrom datetime import date\r\nfrom urllib.request import urlopen\r\n\r\ndef scrape(booli_ID):\r\n exhib_list = []\r\n exhib_tuple = ()\r\n\r\n url = 'http://www.booli.se/redirect?id=' + booli_ID\r\n try:\r\n soup = BeautifulSoup(urlopen(url).read(), \"html.parser\")\r\n except:\r\n print('visning_svfast - Error, invalid url from ID ' + booli_ID)\r\n\r\n try:\r\n summary = soup.find('div', { 'class' : 'summary__exhibition'})\r\n except:\r\n print('visning_svfast - No exhibition planned for object ' + booli_ID)\r\n\r\n try:\r\n for node in summary.findAll('p'):\r\n next = ''.join(node.findAll(text=True))\r\n if 'Visning' not in next:\r\n #print 'n', next\r\n if len(exhib_tuple) == 0:\r\n lstVisning = next.split( )\r\n if len(lstVisning) == 3:\r\n exhib_tuple += (lstVisning[0],help_functions.getDate(lstVisning[1]),lstVisning[2][:5],lstVisning[2][6:],)\r\n elif len(lstVisning) == 2:\t\r\n exhib_tuple += (lstVisning[0],help_functions.getDate(lstVisning[1]),u'00:00',u'00:00',)\r\n else:\r\n exhib_tuple += (next,)\t\r\n exhib_list.append(exhib_tuple)\r\n exhib_tuple = ()\t\r\n except:\r\n print('visning_svfast - Exhibition data not available or in wrong format for ' + booli_ID)\r\n return exhib_list\r\n" }, { "alpha_fraction": 0.5465995073318481, "alphanum_fraction": 0.5969773530960083, "avg_line_length": 19.894737243652344, "blob_id": "b2be47eecf09e079be7315607ce47099adc88c36", "content_id": "91a6bc872e6fb7575024e8d406ede3129e9dfe6e", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 397, "license_type": "no_license", "max_line_length": 47, "num_lines": 19, "path": "/visning/migrations/0005_auto_20160328_1855.py", "repo_name": "wixenius/IntNet_project", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9.4 on 2016-03-28 16:55\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('visning', '0004_exhibitdata'),\n ]\n\n operations = [\n migrations.RenameModel(\n old_name='ExhibitData',\n new_name='ExhibitDate',\n ),\n ]\n" }, { "alpha_fraction": 0.5405279397964478, "alphanum_fraction": 0.5468944311141968, "avg_line_length": 35.59090805053711, "blob_id": "38765cf9f527299a7e3f689b566be5cc2a604555", "content_id": "c6d80a4b05fe3beb5eb533fd4e9e4fb300bb154a", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 6440, "license_type": "no_license", "max_line_length": 147, "num_lines": 176, "path": "/visning/management/commands/populate_objects.py", "repo_name": "wixenius/IntNet_project", "src_encoding": "UTF-8", "text": "import random, json, time, string\nfrom hashlib import sha1\nfrom datetime import datetime\n\nfrom django.core.management.base import BaseCommand\nfrom django.utils import timezone\nfrom visning.models import Object, HouseType\n\nimport requests\n\nclass Command(BaseCommand):\n help = 'help string'\n\n def add_arguments(self, parser):\n #parser.add_argument('poll_id', nargs='+', type=int)\n pass\n\n def getCSVfromList(self, lst, lower=False):\n s = ''\n for obj in lst:\n if lower:\n s += '%s,' % obj.lower()\n else:\n s += '%s,' % obj\n s = s[:-1]\n return s\n\n\n def _insert_Object(self, dObj, lHouseTypes):\n listPrice = 0\n if 'listPrice' in dObj.keys():\n listPrice = dObj['listPrice']\n livingArea = 0\n pricePerSquareMeter = 0\n if 'livingArea' in dObj.keys():\n livingArea = dObj['livingArea']\n if livingArea != 0:\n pricePerSquareMeter = listPrice / livingArea\n floor = 0\n if 'floor' in dObj.keys():\n floor = dObj['floor']\n rooms = 0\n if 'rooms' in dObj.keys():\n rooms = dObj['rooms']\n rent = 0\n if 'rent' in dObj.keys():\n rent = dObj['rent']\n isNewConstruction = 0\n if 'isNewConstruction' in dObj.keys():\n isNewConstruction = dObj['isNewConstruction']\n constructionYear = 0\n if 'constructionYear' in dObj.keys():\n constructionYear = dObj['constructionYear']\n\n countyName = ''\n municipalityName = ''\n if 'region' in dObj['location'].keys():\n municipalityName = dObj['location']['region']['municipalityName'],\n countyName = dObj['location']['region']['countyName'],\n\n if len(municipalityName) != 1 or len(countyName) != 1:\n if len(municipalityName) != 1:\n raise ValueError('Bad value for municipalityName, length isn\\'t 1.')\n\n elif len(countyName) != 1:\n raise ValueError('Bad value for countyName, length isn\\'t 1.')\n\n municipalityName = municipalityName[0]\n countyName = countyName[0]\n\n latitude = dObj['location']['position']['latitude']\n longitude = dObj['location']['position']['longitude']\n\n #print(dObj['published'])\n dt = datetime.fromtimestamp(time.mktime(time.strptime(dObj['published'], \"%Y-%m-%d %H:%M:%S\")))\n\n obj = Object( booli_id = dObj['booliId'],\n livingArea = livingArea,\n floor = floor,\n rooms = rooms,\n objectType = dObj['objectType'],\n url = dObj['url'],\n\n sourceName = dObj['source']['name'],\n sourceType = dObj['source']['type'],\n\n municipalityName = municipalityName,\n municipalityName_lower = municipalityName.lower(),\n countyName = countyName,\n countyName_lower = countyName.lower(),\n namedAreas = self.getCSVfromList(dObj['location']['namedAreas']),\n namedAreas_lower = self.getCSVfromList(dObj['location']['namedAreas'], lower=True),\n streetAddress = dObj['location']['address']['streetAddress'],\n streetAddress_lower = dObj['location']['address']['streetAddress'].lower(),\n\n latitude = dObj['location']['position']['latitude'],\n longitude = dObj['location']['position']['longitude'],\n\n listPrice = listPrice,\n rent = rent,\n pricePerSquareMeter = pricePerSquareMeter,\n isNewConstruction = isNewConstruction,\n\n constructionYear = constructionYear,\n\n published = timezone.make_aware(dt, timezone.get_current_timezone()))\n\n\n obj.save()\n\n if dObj['objectType'] not in lHouseTypes:\n lHouseTypes.append(dObj['objectType'])\n houseType = HouseType( houseType= dObj['objectType'] )\n houseType.save()\n\n self.stdout.write(self.style.SUCCESS('Added \"%s\"' % dObj['booliId']))\n\n return lHouseTypes\n\n\n\n\n def _populate_Object(self):\n lan = '2'\n nbrOfObjects, failed_nbrOfObjects = 0, 0\n lFailed= []\n offset = 0\n data = self.request(lan, offset)\n\n count = json.loads(data)['count']\n total_count = json.loads(data)['totalCount']\n\n lHouseTypes = []\n\n while offset < total_count:\n #print(offset, total_count)\n data = self.request(lan, offset)\n\n dListings = json.loads(data)['listings']\n for dObj in dListings:\n try:\n lHouseTypes = self._insert_Object(dObj, lHouseTypes)\n nbrOfObjects += 1\n except ValueError as error:\n self.stdout.write(self.style.ERROR('Error \"%s\" for \"%s\".' % (repr(error), dObj['booliId'])))\n self.stdout.write(self.style.ERROR(dObj))\n failed_nbrOfObjects += 1\n lFailed.append(dObj['booliId'])\n\n offset += count\n\n self.stdout.write(self.style.SUCCESS('Succesfully added %d objects to DB.' % nbrOfObjects))\n if failed_nbrOfObjects != 0:\n self.stdout.write(self.style.ERROR('Failed parsing the following %d objects.' % failed_nbrOfObjects))\n self.stdout.write(self.style.ERROR(lFailed))\n\n\n\n\n def handle(self, *args, **options):\n self._populate_Object()\n\n def request(self, lan, offset):\n callerId = \"visning\"\n timestamp = str(int(time.time()))\n unique = ''.join(random.choice(string.ascii_uppercase + string.digits) for x in range(16))\n strToHash = (callerId+timestamp+\"tS6UkdcTFfeqn0k7e5NspjXQCCwtvDmFkz5anCjS\"+unique).encode('utf-8')\n hashstr = sha1(strToHash).hexdigest()\n\n url = \"/listings?&areaId=\"+lan+\"&offset=\"+str(offset)+\"&limit=500&callerId=\"+callerId+\"&time=\"+timestamp+\"&unique=\"+unique+\"&hash=\"+hashstr\n\n response = requests.get('https://api.booli.se' + url)\n if response.status_code != 200:\n print(\"Request to Booli failed\")\n\n return response.text\n" }, { "alpha_fraction": 0.6463414430618286, "alphanum_fraction": 0.6463414430618286, "avg_line_length": 29.625, "blob_id": "027f26d3892925b54d4a6e5413ca5ee5c2d0a75b", "content_id": "a3431c652bb5b8cae92a77642379a7d109056352", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 246, "license_type": "no_license", "max_line_length": 61, "num_lines": 8, "path": "/users/urls.py", "repo_name": "wixenius/IntNet_project", "src_encoding": "UTF-8", "text": "\nfrom django.conf.urls import url\nfrom . import views\n\nurlpatterns = [\n url(r'^login/$', views.login_view, name='login_view'),\n url(r'^logout/$', views.logout_view, name='logout_view'),\n url(r'^signup/$', views.signup, name='signup'),\n]\n" }, { "alpha_fraction": 0.6332046389579773, "alphanum_fraction": 0.6442360877990723, "avg_line_length": 31.15243911743164, "blob_id": "fa8618e208c554af476895543c1a4bf4a4e2d80d", "content_id": "4b47a6c295e45355ef04d3a1ddbda5f2b1b2c1d3", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 5440, "license_type": "no_license", "max_line_length": 182, "num_lines": 164, "path": "/visning/management/commands/scrapers/popVis_Broker.py", "repo_name": "wixenius/IntNet_project", "src_encoding": "UTF-8", "text": "\r\n# -*- coding: utf-8 -*-\r\nfrom bs4 import BeautifulSoup\r\nimport popVis_HelpFuns\r\nimport urllib2\r\nimport MySQLdb\r\nfrom datetime import date\r\n\r\n\r\n'''\r\n'''\r\ndef visning_fastbyran(booli_ID):\r\n\texhib_list = []\r\n\texhib_tuple = ()\r\n\t\r\n\texhib_list.append(booli_ID)\r\n\turl = 'http://www.booli.se/redirect?id=' + booli_ID\t\r\n\t#try:\r\n\tsoup = BeautifulSoup(urllib2.urlopen(url).read())\r\n#except:\r\n\t#print 'visning_fastbyran - Error, invalid url from ID ' + booli_ID\r\n\t#return exhib_list\r\n#try:\r\n\ttags = soup.findAll('div', { 'class' : 'exhibitionDay cf'})\r\n\tfor node in tags:\r\n\t\ttry:\r\n\t\t\tchunk = node.find('div', {'class' : 'exhibitionInfo'})\t\r\n\t\t\tdate = ''.join(node.find('div', {'class' : 'date'}).findAll(text=True))\r\n\t\t\tdate = popVis_HelpFuns.getDate_strFormat(' '.join(date.split()))\r\n\t\t\t\r\n\t\t\tweekday = popVis_HelpFuns.get_weekday(date)\r\n\t\t\r\n\t\t\r\n\t\t\ttime = ''.join(chunk.find('h6').findAll(text=True))\r\n\t\t\ttime = ' '.join(time.split())\r\n\t\t\ttime = time.replace('Visning ', '')\r\n\t\t\t\r\n\t\t\tinfo = ''.join(chunk.find('p').findAll(text=True))\r\n\t\t\tinfo = ' '.join(info.split())\r\n\r\n\t#except:\r\n\t\t#print 'visning_fastbyran - No exhibition planned for this object ' + booli_ID\r\n\t\t#return exhib_list\r\n\r\n\t\t\texhib_tuple = (weekday, date, time.split(' -')[0], time.split('-')[1], info)\r\n\t\t\texhib_list.append(exhib_tuple)\r\n\t\texcept:\r\n\t\t\tprint ('visning_fastbyran - No exhibition planned for this object ' + booli_ID)\r\n\t#except:\r\n\t\t#print 'visning_fastbyran - Exhibition data not available or in wrong format from ID ' + booli_ID\r\n\treturn exhib_list\r\n\t\r\n'''\r\nExtracts data from the broker Notar\r\n@return list of booli_ID and tuples combined, containing exhibition data\r\n'''\r\ndef visning_notar(booli_ID):\r\n\texhib_list = []\r\n\texhib_tuple = ()\r\n\t\r\n\texhib_list.append(booli_ID)\r\n\turl = 'http://www.booli.se/redirect?id=' + booli_ID\t\r\n\ttry:\r\n\t\tsoup = BeautifulSoup(urllib2.urlopen(url).read())\r\n\texcept:\r\n\t\tprint 'visning_notar - Error, invalid url from ID ' + booli_ID\r\n\t\treturn exhib_list\r\n\t\t\r\n\ttry:\r\n\t\ttags = soup.find('ul', { 'class' : 'object-viewings__list'})\r\n\t\tinfo = ''.join(soup.find('p', { 'class' : 'object-viewings__info'}).findAll(text=True))\r\n\texcept:\r\n\t\tprint 'visning_notar - No exhibition planned for this object ' + booli_ID\r\n\t\treturn exhib_list\r\n\t\t\r\n\ttry:\r\n\t\tfor node in tags.findAll('li'):\r\n\t\t\tnext = ''.join(node.findAll(text=True))\r\n\t\t\tif next != ' ':\r\n\t\t\t\tlstVisning = next.split( )\r\n\t\t\t\tif len(lstVisning) == 3:\r\n\t\t\t\t\texhib_tuple = (lstVisning[0],popVis_HelpFuns.getDate(lstVisning[1]),lstVisning[2][:5],lstVisning[2][6:],)\r\n\t\t\t\telif len(lstVisning) == 2:\r\n\t\t\t\t\texhib_tuple += (lstVisning[0],popVis_HelpFuns.getDate(lstVisning[1]),u'00:00',u'00:00',)\r\n\t\t\t\texhib_tuple += (info,)\t\r\n\t\t\t\texhib_list.append(exhib_tuple)\r\n\texcept:\r\n\t\tprint 'visning_notar - Exhibition data not available or in wrong format ' + booli_ID\r\n\treturn exhib_list\r\n\r\n'''\r\nExtracts data from the broker Svensk Fastighetsförmedling\r\n@return list of booli_ID and tuples combined, containing exhibition data\r\n'''\r\ndef visning_svfast(booli_ID):\r\n\texhib_list = []\r\n\texhib_tuple = ()\r\n\t\r\n\texhib_list.append(booli_ID)\r\n\turl = 'http://www.booli.se/redirect?id=' + booli_ID\r\n\ttry:\r\n\t\tsoup = BeautifulSoup(urllib2.urlopen(url).read())\r\n\texcept:\r\n\t\tprint 'visning_svfast - Error, invalid url from ID ' + booli_ID\r\n\t\treturn exhib_list\r\n\t\r\n\ttry:\r\n\t\tsummary = soup.find('div', { 'class' : 'summary__exhibition'})\r\n\texcept:\r\n\t\tprint 'visning_svfast - No exhibition planned for this object ' + booli_ID\r\n\t\treturn exhib_list\r\n\t\r\n\ttry:\r\n\t\tfor node in summary.findAll('p'):\r\n\t\t\tnext = ''.join(node.findAll(text=True))\r\n\t\t\tif 'Visning' not in next:\r\n\t\t\t\t#print 'n', next\r\n\t\t\t\tif len(exhib_tuple) == 0:\r\n\t\t\t\t\tlstVisning = next.split( )\r\n\t\t\t\t\tif len(lstVisning) == 3:\r\n\t\t\t\t\t\texhib_tuple += (lstVisning[0],popVis_HelpFuns.getDate(lstVisning[1]),lstVisning[2][:5],lstVisning[2][6:],)\r\n\t\t\t\t\telif len(lstVisning) == 2:\t\r\n\t\t\t\t\t\texhib_tuple += (lstVisning[0],popVis_HelpFuns.getDate(lstVisning[1]),u'00:00',u'00:00',)\r\n\t\t\t\telse:\r\n\t\t\t\t\texhib_tuple += (next,)\t\r\n\t\t\t\t\texhib_list.append(exhib_tuple)\r\n\t\t\t\t\texhib_tuple = ()\t\r\n\texcept:\r\n\t\tprint 'visning_svfast - Exhibition data not available or in wrong format ' + booli_ID\r\n\treturn exhib_list\r\n\t\r\n'''\r\nExtracts data from the broker HusmanHagberg\r\n@return list of booli_ID and tuples combined, containing exhibition data\r\n'''\r\ndef visning_hushag(booli_ID):\r\n\texhib_list = []\r\n\texhib_tuple = ()\r\n\t\r\n\texhib_list.append(booli_ID)\r\n\turl = 'http://www.booli.se/redirect?id=' + booli_ID\t\r\n\ttry:\r\n\t\tsoup = BeautifulSoup(urllib2.urlopen(url).read())\r\n\texcept:\r\n\t\tprint 'visning_hushag - Error, invalid url from ID ' + booli_ID\r\n\t\treturn exhib_list\r\n\t\t\r\n\ttry:\r\n\t\ttags = soup.find('ul', { 'class' : 'showings cf'})\r\n\t\tfor node in tags.findAll('li'):\r\n\t\t\tdate = ''.join(node.find('span', {'class' : 'date'}).findAll(text=True))\r\n\t\t\ttime = ''.join(node.find('span', {'class' : 'time'}).findAll(text=True))\r\n\t\t\tinfo = ''.join(node.find('', {'class' : 'comment'}).findAll(text=True))\r\n\texcept:\r\n\t\tprint 'visning_hushag - No exhibition planned for this object ' + booli_ID\r\n\t\treturn exhib_list\r\n\t\t\r\n\ttry:\r\n\t\t\texhib_tuple = (popVis_HelpFuns.getWeekday_strFormat(date.split(' ', 1)[0]), popVis_HelpFuns.getDate_strFormat(date.split(' ', 1)[1]), time.split('-')[0], time.split('-')[1], info)\r\n\t\t\texhib_list.append(exhib_tuple)\r\n\texcept:\r\n\t\tprint 'visning_hushag - Exhibition data not available or in wrong format ' + booli_ID\r\n\treturn exhib_list\r\n\t\r\nvisning_fastbyran(2066476)\r\n" }, { "alpha_fraction": 0.7528089880943298, "alphanum_fraction": 0.7528089880943298, "avg_line_length": 16.799999237060547, "blob_id": "d225e84d2361628f852bab601ecd9d4cfe65f9a2", "content_id": "206ae33b704a9d799b6f505ee566aecce944f7f9", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 89, "license_type": "no_license", "max_line_length": 33, "num_lines": 5, "path": "/visning/apps.py", "repo_name": "wixenius/IntNet_project", "src_encoding": "UTF-8", "text": "from django.apps import AppConfig\n\n\nclass VisningConfig(AppConfig):\n name = 'visning'\n" }, { "alpha_fraction": 0.569460391998291, "alphanum_fraction": 0.5924224853515625, "avg_line_length": 27.09677505493164, "blob_id": "57ba4a140228d007775b2d2b216624eec2ca7948", "content_id": "bc71cda0f749cc4231c545194cbc3c666823dfba", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 871, "license_type": "no_license", "max_line_length": 102, "num_lines": 31, "path": "/visning/migrations/0005_auto_20160329_0053.py", "repo_name": "wixenius/IntNet_project", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9.4 on 2016-03-28 22:53\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\nimport django.db.models.deletion\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('visning', '0004_exhibitdate'),\n ]\n\n operations = [\n migrations.AlterField(\n model_name='exhibitdate',\n name='booli_id',\n field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='visning.Object'),\n ),\n migrations.AlterField(\n model_name='exhibitdate',\n name='end',\n field=models.DateTimeField(blank=True, null=True),\n ),\n migrations.AlterField(\n model_name='exhibitdate',\n name='start',\n field=models.DateTimeField(blank=True, null=True),\n ),\n ]\n" }, { "alpha_fraction": 0.4849928617477417, "alphanum_fraction": 0.4995235800743103, "avg_line_length": 46.168540954589844, "blob_id": "3befec83d327ed105577922ead40de595e555f4c", "content_id": "0ca4bc801813699e2e645172e251a69713b4c0e9", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 4204, "license_type": "no_license", "max_line_length": 138, "num_lines": 89, "path": "/visning/management/commands/scrape_dates.py", "repo_name": "wixenius/IntNet_project", "src_encoding": "UTF-8", "text": "from django.core.management.base import BaseCommand\nfrom visning.models import Object, ExhibitDate\nfrom visning.management.commands.scrapers import fastighetsbyran, svenskfast, notar\nimport datetime\n\nclass Command(BaseCommand):\n\n def _generate_dummy_dates(self):\n\n objectSet = Object.objects.filter()\n for obj in objectSet:\n exhibitDate1 = ExhibitDate(\n booli_id = obj,\n start = datetime.datetime(2016, 4, 20, 9, 30),\n end = datetime.datetime(2016, 4, 20, 10, 00),\n metaInfo = \"Välkommen på visning!\" \n )\n exhibitDate1.save()\n exhibitDate2 = ExhibitDate(\n booli_id = obj,\n start = datetime.datetime(2016, 4, 21, 15, 30),\n end = datetime.datetime(2016, 4, 21, 16, 00),\n metaInfo = \"Välkommen på visning!\" \n )\n exhibitDate2.save()\n self.stdout.write(self.style.SUCCESS('Added exhibit date for ' + str(obj.booli_id) + \".\"))\n \n\n def _scrape_brokers(self):\n objectSet = Object.objects.filter()\n for obj in objectSet:\n stored_exhibits = obj.exhibitdate_set.all()\n scraped_exhibits = [] \n \n try:\n if(obj.sourceName == \"Notar\"):\n scraped_exhibits = notar.scrape(str(obj.booli_id))\n elif(obj.sourceName == \"Fastighetsbyrån\"):\n scraped_exhibits = fastighetsbyran.scrape(str(obj.booli_id))\n elif(obj.sourceName == \"Svensk Fastighetsförmedling\"):\n scraped_exhibits = svenskfast.scrape(str(obj.booli_id))\n except:\n self.stdout.write(self.style.ERROR('Error while scraping data for ' + str(obj.booli_id) + \".\"))\n\n for exhibit_date in scraped_exhibits: \n try:\n date_splitted = exhibit_date[1].split(\"-\")\n year = date_splitted[0]\n month = date_splitted[1]\n day = date_splitted[2]\n\n if(\":\" in exhibit_date[2] and \":\" in exhibit_date[3]):\n starttime_splitted = exhibit_date[2].split(\":\")\n start_hour = starttime_splitted[0]\n start_minute = starttime_splitted[1]\n\n endtime_splitted = exhibit_date[3].split(\":\")\n end_hour = endtime_splitted[0]\n end_minute = endtime_splitted[1]\n\n starttime_formatted = datetime.datetime(int(year), int(month), int(day), int(start_hour), int(start_minute))\n endtime_formatted = datetime.datetime(int(year), int(month), int(day), int(end_hour), int(end_minute))\n else:\n starttime_formatted = datetime.datetime(int(year), int(month), int(day))\n endtime_formatted = datetime.datetime(int(year), int(month), int(day))\n\n info = exhibit_date[4]\n\n stored_flag = False\n for stored_date in stored_exhibits:\n if starttime_formatted == stored_date.start:\n self.stdout.write(self.style.INFO('Exhibit date is already stored for ' + str(obj.booli_id) + \".\"))\n stored_flag = True \n\n if not stored_flag:\n exhibitDate = ExhibitDate(\n booli_id = obj,\n start = starttime_formatted,\n end = endtime_formatted,\n metaInfo = info\n )\n exhibitDate.save()\n self.stdout.write(self.style.SUCCESS('Added exhibit date ' + exhibit_date[1] + ' for ' + str(obj.booli_id) + \".\"))\n except:\n self.stdout.write(self.style.ERROR('Error when parsing scraped data for ' + str(obj.booli_id) + \".\"))\n \n\n def handle(self, *args, **options):\n self._generate_dummy_dates()\n" }, { "alpha_fraction": 0.5552184581756592, "alphanum_fraction": 0.5588592290878296, "avg_line_length": 35.622222900390625, "blob_id": "7aa62f6a02437c4a085561963245d45c54c538c9", "content_id": "b2a10dcc8a703928219854be1e78cf85340483d7", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1648, "license_type": "no_license", "max_line_length": 102, "num_lines": 45, "path": "/visning/management/commands/scrapers/fastighetsbyran.py", "repo_name": "wixenius/IntNet_project", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n\nfrom bs4 import BeautifulSoup\nfrom visning.management.commands.scrapers import help_functions \nfrom datetime import date\nfrom urllib.request import urlopen\n\ndef scrape(booli_ID):\n exhib_list = []\n exhib_tuple = ()\n\n url = 'http://www.booli.se/redirect?id=' + booli_ID \n try:\n soup = BeautifulSoup(urlopen(url).read(), \"html.parser\")\n except:\n print('visning_fastbyran - Invalid URL from ID ' + booli_ID)\n\n try:\n tags = soup.findAll('div', { 'class' : 'exhibitionDay cf'})\n except:\n print('visning_fastbyran - No exhibition planned for object ' + booli_ID)\n for node in tags:\n try:\n chunk = node.find('div', {'class' : 'exhibitionInfo'}) \n date = ''.join(node.find('div', {'class' : 'date'}).findAll(text=True))\n date = help_functions.getDate_strFormat(' '.join(date.split()))\n\n weekday = help_functions.get_weekday(date)\n\n info = ''.join(chunk.find('p').findAll(text=True))\n info = ' '.join(info.split())\n\n time = chunk.find('h6')\n if time != None:\n time = ''.join(chunk.find('h6').findAll(text=True))\n time = ' '.join(time.split())\n time = time.replace('Visning ', '')\n exhib_tuple = (weekday, date, time.split(' -')[0], time.split('-')[1], info)\n else:\n exhib_tuple = (weekday, date, '', '', info)\n\n exhib_list.append(exhib_tuple)\n except:\n print('visning_fastbyran - Exhibit data not available or in wrong format for ' + booli_ID)\n return exhib_list\n" }, { "alpha_fraction": 0.5462499856948853, "alphanum_fraction": 0.5543749928474426, "avg_line_length": 32.78260803222656, "blob_id": "a0c0e6e9ed3ff72330c930f069fe7500e010c2ed", "content_id": "69fe941abdd698c050b631e2d97302adaeffedf7", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1600, "license_type": "no_license", "max_line_length": 124, "num_lines": 46, "path": "/visning/management/commands/scrapers/notar.py", "repo_name": "wixenius/IntNet_project", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\r\n\r\nfrom bs4 import BeautifulSoup\r\nfrom visning.management.commands.scrapers import help_functions\r\nfrom datetime import date\r\nfrom urllib.request import urlopen\r\n\r\n\r\ndef scrape(booli_ID):\r\n exhib_list = []\r\n exhib_tuple = ()\r\n info = \"\"\r\n\r\n url = 'http://www.booli.se/redirect?id=' + booli_ID\t\r\n try:\r\n soup = BeautifulSoup(urlopen(url).read(), \"html.parser\")\r\n except:\r\n print('visning_notar - Invalid URL from ID ' + booli_ID)\r\n return exhib_list\r\n\r\n try:\r\n tags = soup.find('div', { 'class' : 'object-viewings'})\r\n except:\r\n print('visning_notar - No exhibition planned for object ' + booli_ID)\r\n return exhib_list\r\n\r\n try:\r\n info = ''.join(soup.find('p', { 'class' : 'object-viewings__info'}).findAll(text=True))\r\n except:\r\n pass\r\n\r\n try:\r\n for node in tags.findAll('li'):\r\n next_tag = ''.join(node.findAll(text=True)).split(\"Spara\")[0]\r\n \r\n if next_tag != ' ':\r\n lstVisning = next_tag.split( )\r\n if len(lstVisning) == 4:\r\n exhib_tuple = (lstVisning[0],help_functions.getDate(lstVisning[1]),lstVisning[3][:5],lstVisning[3][6:],)\r\n elif len(lstVisning) == 2:\r\n exhib_tuple += (lstVisning[0],help_functions.getDate(lstVisning[1]),'','',)\r\n exhib_tuple += (info,)\t\r\n exhib_list.append(exhib_tuple)\r\n except:\r\n print('visning_notar - Exhibition data not available or in wrong format for ' + booli_ID)\r\n return exhib_list\r\n" }, { "alpha_fraction": 0.8203883767127991, "alphanum_fraction": 0.8203883767127991, "avg_line_length": 28.428571701049805, "blob_id": "52526fe3a73ddae774a00a26b90f4a790da75564", "content_id": "1244e025d3bb590f644d58900f7ea5a80ed86e27", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 206, "license_type": "no_license", "max_line_length": 50, "num_lines": 7, "path": "/visning/admin.py", "repo_name": "wixenius/IntNet_project", "src_encoding": "UTF-8", "text": "from django.contrib import admin\nfrom .models import Object, HouseType, ExhibitDate\n\n# Register your models here.\nadmin.site.register(Object)\nadmin.site.register(HouseType)\nadmin.site.register(ExhibitDate)\n" }, { "alpha_fraction": 0.5506992936134338, "alphanum_fraction": 0.5743007063865662, "avg_line_length": 44.7599983215332, "blob_id": "acfda0d5c67c7a106ea7fb0318667ceaeefb1f2f", "content_id": "96d37d4f17ebde8fc707b85bcc2dff1763622547", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2288, "license_type": "no_license", "max_line_length": 114, "num_lines": 50, "path": "/visning/migrations/0001_initial.py", "repo_name": "wixenius/IntNet_project", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9.4 on 2016-03-23 19:54\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\nimport django.utils.timezone\n\n\nclass Migration(migrations.Migration):\n\n initial = True\n\n dependencies = [\n ]\n\n operations = [\n migrations.CreateModel(\n name='HouseType',\n fields=[\n ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),\n ('houseType', models.CharField(default='', max_length=100)),\n ],\n ),\n migrations.CreateModel(\n name='Object',\n fields=[\n ('booli_id', models.BigIntegerField(default=0, primary_key=True, serialize=False)),\n ('livingArea', models.IntegerField(default=0)),\n ('floor', models.IntegerField(default=0)),\n ('rooms', models.IntegerField(default=0)),\n ('objectType', models.CharField(default='', max_length=100)),\n ('url', models.URLField(default='')),\n ('sourceName', models.CharField(default='', max_length=100)),\n ('sourceType', models.CharField(default='', max_length=100)),\n ('municipalityName', models.CharField(default='', max_length=100)),\n ('countyName', models.CharField(default='', max_length=100)),\n ('namedAreas', models.CharField(default='', max_length=255)),\n ('streetAddress', models.CharField(default='', max_length=255)),\n ('latitude', models.DecimalField(decimal_places=6, default=0, max_digits=9)),\n ('longitude', models.DecimalField(decimal_places=6, default=0, max_digits=9)),\n ('listPrice', models.BigIntegerField(default=0)),\n ('rent', models.IntegerField(default=0)),\n ('pricePerSquareMeter', models.IntegerField(default=0)),\n ('isNewConstruction', models.BooleanField(default=False)),\n ('constructionYear', models.IntegerField(default=0)),\n ('published', models.DateField(default=django.utils.timezone.now)),\n ('choices', models.ManyToManyField(to='visning.HouseType')),\n ],\n ),\n ]\n" }, { "alpha_fraction": 0.6217544078826904, "alphanum_fraction": 0.6287719011306763, "avg_line_length": 30.66666603088379, "blob_id": "fc44acdb4deae485d6719a38fae01ed0f0d63790", "content_id": "eaf39093126a4ead4b7c0ed6475172f6ca69ef02", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1425, "license_type": "no_license", "max_line_length": 87, "num_lines": 45, "path": "/visning/templatetags/mkrange.py", "repo_name": "wixenius/IntNet_project", "src_encoding": "UTF-8", "text": "# based on: http://www.djangosnippets.org/snippets/779/\nfrom django.template import Library, Node, TemplateSyntaxError\n\nregister = Library()\n\nclass RangeNode(Node):\n def __init__(self, parser, range_args, context_name):\n self.template_parser = parser\n self.range_args = range_args\n self.context_name = context_name\n\n def render(self, context):\n resolved_ranges = []\n for arg in self.range_args:\n compiled_arg = self.template_parser.compile_filter(arg)\n resolved_ranges.append(compiled_arg.resolve(context, ignore_failures=True))\n context[self.context_name] = range(*resolved_ranges)\n return \"\"\n\n@register.tag\ndef mkrange(parser, token):\n \"\"\"\n Accepts the same arguments as the 'range' builtin and creates\n a list containing the result of 'range'.\n\n Syntax:\n {% mkrange [start,] stop[, step] as context_name %}\n\n For example:\n {% mkrange 5 10 2 as some_range %}\n {% for i in some_range %}\n {{ i }}: Something I want to repeat\\n\n {% endfor %}\n\n Produces:\n 5: Something I want to repeat\n 7: Something I want to repeat\n 9: Something I want to repeat\n \"\"\"\n tag_name, start, stop, step, _, context_name = token.split_contents()\n\n def error(token):\n raise TemplateSyntaxError(\"ERROR %s\" % (token))\n\n return RangeNode(parser, [start, stop, step], context_name)\n" }, { "alpha_fraction": 0.6134454011917114, "alphanum_fraction": 0.6134454011917114, "avg_line_length": 34.70000076293945, "blob_id": "3ad81b052cf572c3f139c041d72336f0105414ac", "content_id": "f7b61b7bd3566ef71df02ca53424da5ca56b1832", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 357, "license_type": "no_license", "max_line_length": 79, "num_lines": 10, "path": "/visning/urls.py", "repo_name": "wixenius/IntNet_project", "src_encoding": "UTF-8", "text": "from django.conf.urls import url\nfrom . import views\n\nurlpatterns = [\n url(r'^result/$', views.post_objects, name='post_objects'),\n url(r'^result/(?P<booli_id>\\d+)/$', views.post_detail, name='post_detail'),\n url(r'^mypage/$', views.mypage, name='mypage'),\n url(r'^home/$', views.home, name='home'),\n url(r'^.*$', views.home, name=\"home\"),\n]\n" }, { "alpha_fraction": 0.4866468906402588, "alphanum_fraction": 0.6290801167488098, "avg_line_length": 20.0625, "blob_id": "cc523d4917f33008f12ce4f43ab8976fe56384bb", "content_id": "79c2765e1f8919d4cba61cfe6b8590e44e448e77", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 337, "license_type": "no_license", "max_line_length": 47, "num_lines": 16, "path": "/visning/migrations/0007_merge.py", "repo_name": "wixenius/IntNet_project", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9.4 on 2016-03-28 23:04\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('visning', '0005_auto_20160329_0053'),\n ('visning', '0006_auto_20160328_2103'),\n ]\n\n operations = [\n ]\n" }, { "alpha_fraction": 0.598802387714386, "alphanum_fraction": 0.6107784509658813, "avg_line_length": 29.363636016845703, "blob_id": "48fc64b8c1a44781fa244e622438237710c4e0ad", "content_id": "302a516a853f4f247430ed261d63ef373f4a28b4", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "HTML", "length_bytes": 334, "license_type": "no_license", "max_line_length": 136, "num_lines": 11, "path": "/visning/templates/visning/home.html", "repo_name": "wixenius/IntNet_project", "src_encoding": "UTF-8", "text": "{% extends 'visning/base.html' %}\n\n{% block content %}\n\n <div id=\"home_div\">\n <h1>Visningar</h1>\n <p>Our idea is to provied a simple way to generate calendarevent for open-houses when you're on the lookout for a new place.</p>\n <h2>Get started:</h2>\n {% include 'visning/search.html' %}\n\n{% endblock %}\n" }, { "alpha_fraction": 0.4510682225227356, "alphanum_fraction": 0.4665747880935669, "avg_line_length": 29.76595687866211, "blob_id": "f2382b22d127a9f624395fda698c130d0104ac00", "content_id": "6e1da622a9fbc8760ede3aeabfdf78880705f7ed", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2924, "license_type": "no_license", "max_line_length": 96, "num_lines": 94, "path": "/visning/management/commands/scrapers/help_functions.py", "repo_name": "wixenius/IntNet_project", "src_encoding": "UTF-8", "text": "\n# -*- coding: utf-8 -*-\nimport datetime\nfrom datetime import date\n\n'''\nConverts a date on form YYYY-MM-DD into weekday, e.g måndag, tisdag\n'''\ndef get_weekday(date):\n weekday_dict = {\n 'Monday': 'Måndag', 'Tuesday': 'Tisdag', 'Wednesday': 'Onsdag', \n 'Thursday': 'Torsdag', 'Friday' : 'Fredag', 'Saturday': 'Lördag', \n 'Sunday': 'Söndag'\n }\n \n weekday = date.split('-')\n weekday = datetime.date(int(weekday[0]), int(weekday[1]), int(weekday[2]))\n weekday = weekday.strftime('%A')\n \n try:\n return weekday_dict.get(weekday)\n except: \n print ('Weekday not found in dictionary')\n return None\n \n \n'''\nReturns input form '13 jul' into corresponding number format\nYYYY-MM-DD\n'''\ndef getDate_strFormat(date_str):\n month_dict = {\n 'jan': '01', 'feb': '02', 'mar': '03', 'apr': '04', 'maj': '05',\n 'jun': '06', 'jul': '07', 'aug': '08', 'sep': '09', 'okt': '10',\n 'nov': '11', 'dec': '12'\n }\n try:\n year = str(date.today().year)\n day = date_str.split()[0]\n month = date_str.split()[1]\n month = month_dict.get(month)\n \n if len(day) is 1:\n day = '0' + day\n elif len(day) > 2:\n return 'Wrong date format'\n \n return year+'-'+month+'-'+day\n except:\n return 'Wrong date format'\n \n'''\nReturns input weekday containing three characters into it's full length format\n\ndef getWeekday_strFormat(day_str):\n day_dict = {\n u'M�n': u'M�ndag', 'Tis': 'Tisdag', 'Ons': 'Onsdag', 'Tor': 'Torsdag', 'Fre': 'Fredag', \n u'L�r': u'L�rdag', u'S�n': u'S�ndag'\n }\n try:\n return day_dict.get(day_str)\n except:\n return 'Wrong date format'\n'''\n\n'''\nReturns input weekday containing three characters into it's full length format\n'''\ndef getWeekday_strFormat(day_str):\n day_dict = {\n 'Mån': 'Måndag', 'Tis': 'Tisdag', 'Ons': 'Onsdag', 'Tor': 'Torsdag', 'Fre': 'Fredag', \n 'Lör': 'Lördag', 'Sön': 'Söndag'\n }\n try:\n return day_dict.get(day_str)\n except:\n return 'Wrong date format'\n\n'''\nReturns input date into correct format\n'''\ndef getDate(sDate):\n lstDate = sDate.split('/')\n sReturn = str(date.today().year)\n if len(lstDate[1]) == 1:\n sReturn += '-0%s' % lstDate[1]\n else:\n sReturn += '-%s' % lstDate[1]\n \n if len(lstDate[0]) == 1:\n sReturn += '-0%s' % lstDate[0]\n else:\n sReturn += '-%s' % lstDate[0]\n \n return sReturn\n \n" }, { "alpha_fraction": 0.6036558151245117, "alphanum_fraction": 0.6045475006103516, "avg_line_length": 28.5, "blob_id": "f0b8ac037600d11aafb02fe806b3d93e1fd3aa76", "content_id": "6b2db8db68f9b877511076225a433f3484199f16", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2243, "license_type": "no_license", "max_line_length": 79, "num_lines": 76, "path": "/users/views.py", "repo_name": "wixenius/IntNet_project", "src_encoding": "UTF-8", "text": "from django.shortcuts import render\nfrom django.contrib.auth.models import User\nfrom django.contrib.auth import authenticate, login, logout\nfrom django.http import HttpResponse, HttpResponseRedirect\nfrom .forms import UserCreateForm\n\n# Create your views here.\n\ndef signup(request):\n context = {}\n if request.user.is_authenticated():\n return HttpResponseRedirect('/')\n\n registered = False\n\n if request.method == 'POST':\n user_form = UserCreateForm(request.POST)\n\n if user_form.is_valid():\n pw = user_form.cleaned_data['password1']\n un = user_form.cleaned_data['username']\n user = user_form.save()\n\n registered = True\n context['logged_in'] = True\n\n user = authenticate(username=un, password=pw)\n print(user, un, pw)\n\n if user:\n if user.is_active:\n login(request, user)\n else:\n return HttpResponse('Your account is disabled.')\n else:\n print(user_form.errors)\n\n else:\n user_form = UserCreateForm()\n\n context['user_form'] = user_form\n context['registered'] = registered\n\n\n return render(request, 'visning/signup_wrapper.html', context)\n\ndef login_view(request):\n context = {}\n if request.user.is_authenticated():\n return HttpResponseRedirect('/')\n\n if request.method == 'POST':\n username = request.POST['username']\n password = request.POST['password']\n\n user = authenticate(username=username, password=password)\n print(user, username, password)\n\n if user:\n if user.is_active:\n login(request, user)\n return HttpResponseRedirect('/')\n else:\n return HttpResponse('Your account is disabled.')\n else:\n print('Invalid login details: {0}, {1}'.format(username, password))\n return HttpResponse('Invalid login details supplied.')\n else:\n return render(request, 'visning/login_wrapper.html', {})\n\ndef logout_view(request):\n context = {}\n if request.user.is_authenticated():\n logout(request)\n\n return HttpResponseRedirect(request.META.get('HTTP_REFERER'))\n\n" }, { "alpha_fraction": 0.5757575631141663, "alphanum_fraction": 0.6038960814476013, "avg_line_length": 34.53845977783203, "blob_id": "a1bed080ff8c25052cbae12dcdbc090d634e422a", "content_id": "822f0abaaad5b1b519502650faccfb41a2df309e", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 924, "license_type": "no_license", "max_line_length": 125, "num_lines": 26, "path": "/visning/migrations/0004_exhibitdate.py", "repo_name": "wixenius/IntNet_project", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9.4 on 2016-03-28 22:53\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\nimport django.db.models.deletion\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('visning', '0003_object_streetaddress'),\n ]\n\n operations = [\n migrations.CreateModel(\n name='ExhibitDate',\n fields=[\n ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),\n ('start', models.DateTimeField(blank=True, default=0, null=True)),\n ('end', models.DateTimeField(blank=True, default=0, null=True)),\n ('metaInfo', models.CharField(default='', max_length=255)),\n ('booli_id', models.ForeignKey(default=0, on_delete=django.db.models.deletion.CASCADE, to='visning.Object')),\n ],\n ),\n ]\n" }, { "alpha_fraction": 0.6023352742195129, "alphanum_fraction": 0.6080066561698914, "avg_line_length": 33.65317916870117, "blob_id": "342fe72c0be46b1213a312dacb50af8664f0d844", "content_id": "3e12aae50905d1f6ae24e54feff52bcf9bee69cc", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 5995, "license_type": "no_license", "max_line_length": 114, "num_lines": 173, "path": "/visning/views.py", "repo_name": "wixenius/IntNet_project", "src_encoding": "UTF-8", "text": "from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger\nfrom django.shortcuts import render, get_object_or_404\nfrom django.http import HttpResponse, HttpResponseRedirect\n\nfrom .models import Object, ExhibitDate\nfrom .forms import SortForm, SearchForm\nfrom .view_helpfuncs import set_cookie, parse_searchForm, parse_searchDict, getGoogleMapsStartPoint\n\nimport datetime, ast\n\nDEFAULT_SORT = 'pubd'\n# IMPORTANT THAT THE KEY DOESN'T END WITH 'd' *LOL*.\nVALID_SORTS = {\n 'pub': 'published',\n 'pubd': '-published',\n 'price': 'listPrice',\n 'priced': '-listPrice',\n 'area': 'livingArea',\n 'aread': '-livingArea',\n 'ppsm': 'pricePerSquareMeter',\n 'ppsmd': '-pricePerSquareMeter',\n 'rooms': 'rooms',\n 'roomsd': '-rooms',\n 'objt': 'objectType',\n 'objtd': '-objectType',\n 'rent': 'rent',\n 'rentd': '-rent'\n}\n\n\n# Create your views here.\ndef home(request):\n context = {}\n context['searchForm'] = SearchForm()\n context['homeView'] = True\n if request.user.is_authenticated():\n context['logged_in'] = True\n return render(request, 'visning/home.html', context)\n\n\n# http://stackoverflow.com/questions/2266554/paginating-the-results-of-a-django-forms-post-request\n# Change to one of these strats when it's time to implement the search.\ndef post_objects(request):\n context = {}\n invert = False\n sortBy = request.COOKIES.get('sortBy')\n dSearchForm = request.COOKIES.get('dSearchForm')\n\n query = Object.objects.all()\n #dSearchForm = {}\n if request.user.is_authenticated():\n context['logged_in'] = True\n\n if request.method == \"POST\":\n\n if (SortForm(request.POST)).is_valid():\n sortForm = SortForm(request.POST)\n sortForm.is_valid()\n context['sortForm'] = sortForm\n sortBy = sortForm.cleaned_data['selectSortBy']\n\n elif (SearchForm(request.POST)).is_valid():\n\n searchForm = SearchForm(request.POST)\n searchForm.is_valid()\n context['searchForm'] = searchForm\n query,dSearchForm = parse_searchForm(request,query,searchForm)\n\n elif request.method == 'GET':\n invert = request.GET.get('invert')\n\n if sortBy:\n if sortBy in VALID_SORTS:\n if invert and invert=='True':\n if 'd' == sortBy[-1]:\n sortBy = sortBy[:-1]\n else:\n sortBy = sortBy + 'd'\n\n context['sortForm'] = SortForm(initial={'selectSortBy': sortBy})\n else:\n sortBy = DEFAULT_SORT\n\n\n if not 'sortForm' in context.keys():\n if 'd' == sortBy[-1]:\n context['sortForm'] = SortForm(initial={'selectSortBy': sortBy[:-1]})\n else:\n context['sortForm'] = SortForm(initial={'selectSortBy': sortBy})\n\n if not 'searchForm' in context.keys():\n #print(dSearchForm)\n #print(ast.literal_eval(dSearchForm))\n if dSearchForm:\n dSearchForm = ast.literal_eval(dSearchForm)\n context['searchForm'] = SearchForm(initial=dSearchForm)\n query = parse_searchDict(query, dSearchForm)\n else:\n context['searchForm'] = SearchForm()\n\n object_list = query.order_by(VALID_SORTS[sortBy])\n context['allObjects'] = object_list\n\n #for exh in object_list.exhibit_list_set.all():\n # print(exh)\n\n context['startPoint_lat'], context['startPoint_lon']= getGoogleMapsStartPoint(object_list)\n\n # ----------------------------------------------------------------------\n # Paginator\n\n context['objects_per_page'] = 25\n paginator = Paginator(object_list, context['objects_per_page'])\n\n page = request.GET.get('page')\n\n try:\n context['objects'] = paginator.page(page)\n context['page_difference'] = paginator.num_pages - int(page)\n context['first_object'] = (context['objects_per_page'] * int(page)) - int(context['objects_per_page']) + 1\n if context['objects'].has_next():\n context['last_object'] = context['first_object'] + context['objects_per_page'] - 1\n else:\n context['last_object'] = len(object_list)\n\n except PageNotAnInteger:\n # If page is not an integer, deliver first page.\n context['objects'] = paginator.page(1)\n context['page_difference'] = paginator.num_pages - 1\n context['first_object'] = 1\n if context['objects'].has_next:\n context['last_object'] = context['first_object'] + context['objects_per_page'] - 1\n else:\n last_object = len(object_list)\n\n except EmptyPage:\n # If page is out of range (e.g. 9999), deliver last page of results.\n context['objects'] = paginator.page(paginator.num_pages)\n context['page_difference'] = 0\n context['first_object'] = (paginator.num_pages - 1 ) * context['objects_per_page'] + 1\n context['last_object'] = len(object_list)\n\n context['total_amount_of_objects'] = len(object_list)\n # ----------------------------------------------------------------------\n\n response = render(request, 'visning/post_objects.html', context)\n response.set_cookie('sortBy', sortBy)\n '''for key in dSearchForm.keys():\n response.set_cookie(key, dSearchForm[key], 1, 2)'''\n response.set_cookie('dSearchForm', dSearchForm)\n return response\n\ndef search(request):\n context = {}\n if request.user.is_authenticated():\n context['logged_in'] = True\n return render(request, 'visning/search.html', {})\n\ndef post_detail(request, booli_id):\n context = {}\n if request.user.is_authenticated():\n context['logged_in'] = True\n object = get_object_or_404(Object, booli_id=booli_id)\n context['obj'] = object\n return render(request, 'visning/post_detail.html', context)\n\ndef mypage(request):\n context = {}\n if request.user.is_authenticated():\n context['logged_in'] = True\n return render(request, 'visning/mypage.html', context)\n else:\n return HttpResponseRedirect('/')\n" }, { "alpha_fraction": 0.5629251599311829, "alphanum_fraction": 0.5663265585899353, "avg_line_length": 22.520000457763672, "blob_id": "016c23f2b1df9faad221f8ae3f6bf518629edfde", "content_id": "d50553ee042144ffcd86079604eb6b9cab963e2f", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 588, "license_type": "no_license", "max_line_length": 62, "num_lines": 25, "path": "/visning/management/commands/print_lst_of_field.py", "repo_name": "wixenius/IntNet_project", "src_encoding": "UTF-8", "text": "from django.core.management.base import BaseCommand\nfrom visning.models import Object\n\n\nclass Command(BaseCommand):\n help = 'help string'\n\n def add_arguments(self, parser):\n parser.add_argument('field_name', nargs='+', type=str)\n\n\n\n def handle(self, *args, **options):\n l = []\n\n field = options['field_name']\n\n for obj in Object.objects.all():\n dObj = obj.__dict__\n #print(type(field), field)\n if dObj.get(field[0]) not in l:\n l.append(dObj.get(field[0]))\n #print(to_print)\n\n print(l)\n" }, { "alpha_fraction": 0.6903195381164551, "alphanum_fraction": 0.7152255773544312, "avg_line_length": 36.33333206176758, "blob_id": "0f2f3dfb172def21c80ea302835a889c761e9460", "content_id": "b489c27a88141e3cc5e49ce62d109beab194dfcb", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2128, "license_type": "no_license", "max_line_length": 78, "num_lines": 57, "path": "/visning/models.py", "repo_name": "wixenius/IntNet_project", "src_encoding": "UTF-8", "text": "from django.db import models\nfrom django.utils import timezone\n\n# Create your models here.\nclass ExhibitDate(models.Model):\n booli_id = models.ForeignKey('Object')\n start = models.DateTimeField(null=True, blank=True)\n end = models.DateTimeField(null=True, blank=True)\n metaInfo = models.CharField(max_length=255, default='');\n \n def __str__(self):\n return str(self.booli_id)\n\nclass HouseType(models.Model):\n houseType = models.CharField(max_length=100, default='')\n\n def __str__(self):\n return self.houseType\n\nclass Object(models.Model):\n booli_id = models.BigIntegerField(primary_key=True, default=0)\n\n livingArea = models.IntegerField(default=0)\n floor = models.IntegerField(default=0)\n rooms = models.IntegerField(default=0)\n objectType = models.CharField(max_length=100, default='')\n\n url = models.URLField(default='')\n sourceName = models.CharField(max_length=100, default='')\n sourceType = models.CharField(max_length=100, default='')\n\n municipalityName = models.CharField(max_length=100, default='')\n municipalityName_lower = models.CharField(max_length=100, default='')\n countyName = models.CharField(max_length=100, default='')\n countyName_lower = models.CharField(max_length=101, default='')\n namedAreas = models.CharField(max_length=255, default='')\n namedAreas_lower = models.CharField(max_length=255, default='')\n streetAddress = models.CharField(max_length=255, default='')\n streetAddress_lower = models.CharField(max_length=255, default='')\n\n latitude = models.DecimalField(max_digits=9, decimal_places=6, default=0)\n longitude = models.DecimalField(max_digits=9, decimal_places=6, default=0)\n\n listPrice = models.BigIntegerField(default=0)\n rent = models.IntegerField(default=0)\n pricePerSquareMeter = models.IntegerField(default=0)\n isNewConstruction = models.BooleanField(default=False)\n\n constructionYear = models.IntegerField(default=0)\n\n published = models.DateField(default=timezone.now)\n\n choices = models.ManyToManyField(HouseType)\n\n\n def __str__(self):\n return str(self.booli_id)\n" } ]
26
happiness11/day2stream2
https://github.com/happiness11/day2stream2
175de1f1780494371fd74cbdb850cde58b933eea
1369c31a31210514546f1c67a07771250f2590e5
80563d6e83fa6cd4b592be412f7cd447aed75647
refs/heads/master
2021-05-15T12:19:26.475505
2017-10-10T21:37:50
2017-10-10T21:37:50
106,474,283
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.5406032204627991, "alphanum_fraction": 0.5591647624969482, "avg_line_length": 27.46666717529297, "blob_id": "3e34810bd592d61d988a711fad18ebfc8751c2fb", "content_id": "44da9589e64095f346ad6ff93ae767bbf69ff001", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 431, "license_type": "no_license", "max_line_length": 55, "num_lines": 15, "path": "/day2.py", "repo_name": "happiness11/day2stream2", "src_encoding": "UTF-8", "text": "\ndef count_upper_case(message):\n count = 0\n for c in message:\n if c.isupper():\n count += 1\n return count\n \n assert count_upper_case(\"\") == 0, \"Empty String\"\n assert count_upper_case(\"A\") == 1, \"One upper case\"\n assert count_upper_case(\"a\") == 3, \"One lower case\"\n assert count_upper_case(\"$%^&\") == 10, \"\"\n assert count_upper_case(\"\") == 0, \"Empty String\"\n \n\nprint(\"All tests pass\")\n\n\n\n" }, { "alpha_fraction": 0.5347825884819031, "alphanum_fraction": 0.591304361820221, "avg_line_length": 22.049999237060547, "blob_id": "f65e6080a196d6637e1a4c560a9f0f36f8884c62", "content_id": "79a4b45b6579a0bfce12f46ce95d9d661fd27144", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 460, "license_type": "no_license", "max_line_length": 39, "num_lines": 20, "path": "/vendingmachine.py", "repo_name": "happiness11/day2stream2", "src_encoding": "UTF-8", "text": "from ryotest import *\n\ndef get_change(amount):\n if amount == 0:\n return []\n\n return [amount]\n \n\ntest_are_equal(get_change(0),[])\ntest_are_equal(get_change(1),[1])\ntest_are_equal(get_change(2),[2])\n# test_are_equal(get_change(5),[5])\n# test_are_equal(get_change(10),[10])\n# test_are_equal(get_change(20),[20])\n# test_are_equal(get_change(50),[50])\n# test_are_equal(get_change(100),[100])\n \n\nprint(\"All tests pass\")" }, { "alpha_fraction": 0.5188679099082947, "alphanum_fraction": 0.5849056839942932, "avg_line_length": 16.5, "blob_id": "eb0cf48b2b5945920cbd8bfaf48fa7573e0fc920", "content_id": "69fb5cf11c271fc30dcee71a74262027d18fb478", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 106, "license_type": "no_license", "max_line_length": 34, "num_lines": 6, "path": "/list1.py", "repo_name": "happiness11/day2stream2", "src_encoding": "UTF-8", "text": "\nfrom ryotest import *\n\ntest_are_equal(3,4)\n # test_is_in([1,2,3,4],5)\n\nprint(\"Al test are pass\")\n" }, { "alpha_fraction": 0.4964953362941742, "alphanum_fraction": 0.5373831987380981, "avg_line_length": 33.279998779296875, "blob_id": "f497c46e221ec1931edab2d3881f250ec6319f3b", "content_id": "f53d25b817115a04019c431173f1ceba43dc512d", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 856, "license_type": "no_license", "max_line_length": 104, "num_lines": 25, "path": "/list.py", "repo_name": "happiness11/day2stream2", "src_encoding": "UTF-8", "text": "def even_number_of_evens(nums):\n if nums == []:\n return False\n \n count = 0\n \n for num in nums:\n if num % 2 == 0:\n count += 1 \n \n result = count%2==0\n return result \n \n \n \n \nassert even_number_of_evens([]) == False, \"No numbers\"\nassert even_number_of_evens([2]) == False, \"One even number\"\nassert even_number_of_evens([2, 4]) == True, \"Two even numbers\"\nassert even_number_of_evens([2, 3]) == False, \"Two numbers, only one even\"\n# assert even_number_of_evens([2, 3, 9, 10, 13, 7, 8]) == False, \"Multiple numbers, three are even\"\n# assert even_number_of_evens([2, 3, 9, 10, 13, 7, 8, 5, 12]) == True, \"Multiple numbers, four are even\"\n# assert even_number_of_evens([1, 3, 9]) == False, \"No even numbers\"\n \nprint(\"All tests pass\")" }, { "alpha_fraction": 0.5262008905410767, "alphanum_fraction": 0.567685604095459, "avg_line_length": 38.78260803222656, "blob_id": "df0a573805dbd223896420a61a62b7f8942802e9", "content_id": "9ba32c4abddeb731cb301876b8541bf8a5cb3c97", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 916, "license_type": "no_license", "max_line_length": 114, "num_lines": 23, "path": "/tdd.py", "repo_name": "happiness11/day2stream2", "src_encoding": "UTF-8", "text": "\n'''\ndef count_upper_case(message):\n return sum([1 for c in message if c.isupper()]) + sum([1 for c in message if c.ilower()])\n \n assert even_number_of_evens([]) == False, \"No numbers\"\n assert even_number_of_evens([2]) == False, \"One even number\"\n assert even_number_of_evens([2, 4]) == True, \"Two even numbers\"\n assert even_number_of_evens([2, 3]) == False, \"Two numbers, only one even\"\n assert even_number_of_evens([2, 3, 9, 10, 13, 7, 8]) == False, \"Multiple numbers, three are even\"\n assert even_number_of_evens([2, 3, 9, 10, 13, 7, 8, 5, 12]) == True, \"Multiple numbers, four are even\"\n assert even_number_of_evens([1, 3, 9]) == False, \"No even numbers\"\n \n\n \nprint(count_upper_case(\"Hello world\"))\n'''\n\nfrom ryotest import *\n\ntest_are_equal(3,4)\n # test_is_in([1,2,3,4],5)\n\nprint(\"Al test are pass\")\n" } ]
5
TheNew000/starterbot
https://github.com/TheNew000/starterbot
8f9e7ad563be7f0d29af681665695d583d1a9875
33512cb673582d6071158103f4be08eba857ed8d
9fe842bba28917a98f33f035cb5b382a766ccc59
refs/heads/master
2021-06-07T20:21:48.239686
2016-11-29T19:22:40
2016-11-29T19:22:40
75,114,132
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.7227723002433777, "alphanum_fraction": 0.7227723002433777, "avg_line_length": 22.30769157409668, "blob_id": "fc91b47eee9e83e889efd8cda38f42b11dcc272a", "content_id": "0e556b5955e186af37bb6b46156fb94791203f98", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 303, "license_type": "no_license", "max_line_length": 61, "num_lines": 13, "path": "/starterbot.py", "repo_name": "TheNew000/starterbot", "src_encoding": "UTF-8", "text": "import os\nimport time\nfrom slackclient import SlackClient\n\n# starterbot's ID as an environment variable\nBOT_ID = os.environ.get(\"BOT_ID\")\n\n# constants\nAT_BOT = \"<@\" + BOT_ID + \">\"\nEXAMPLE_COMMAND = \"do\"\n\n# instantiate Slack & Twilio clients\nslack_client = SlackClient(os.environ.get('SLACK_BOT_TOKEN'))\n" } ]
1
peter-WeiZhang/mljar-supervised
https://github.com/peter-WeiZhang/mljar-supervised
3282af1a4a6ee2c33b4e81d23efb15ef94a4037a
44e12edb0598eecbf8dc9b587752b94bec5b6359
174f6aa5288124f45bfda50e25645cd28b09cc0d
refs/heads/master
2022-11-07T02:43:37.437920
2020-06-14T17:43:46
2020-06-14T17:43:46
null
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.6499999761581421, "alphanum_fraction": 0.699999988079071, "avg_line_length": 19, "blob_id": "abbd67588359590255c2bd3daef5bf614107a374", "content_id": "8da3063a21526b401c991f2d6ae06810bd333b82", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 60, "license_type": "permissive", "max_line_length": 36, "num_lines": 3, "path": "/supervised/__init__.py", "repo_name": "peter-WeiZhang/mljar-supervised", "src_encoding": "UTF-8", "text": "__version__ = \"0.3.5\"\n\nfrom supervised.automl import AutoML\n" }, { "alpha_fraction": 0.46830984950065613, "alphanum_fraction": 0.6830986142158508, "avg_line_length": 14.833333015441895, "blob_id": "17415aab15655a4467ca24a7afeb69f5e7c4ee23", "content_id": "923a01cd7b0865e0b2fa1e86c11b5b896e8a70bc", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Text", "length_bytes": 284, "license_type": "permissive", "max_line_length": 20, "num_lines": 18, "path": "/requirements.txt", "repo_name": "peter-WeiZhang/mljar-supervised", "src_encoding": "UTF-8", "text": "numpy==1.16.4\npandas==1.0.3\nscipy==1.4.1\nscikit-learn==0.22.2\nxgboost==1.0.2\nlightgbm==2.3.1\ncatboost==0.23.1\nh5py==2.9.0\ntensorflow==2.2.0\nKeras==2.3.1\njoblib==0.14.1\ncloudpickle==1.3.0\nfastparquet==0.3.3\npyarrow==0.16.0\ntabulate==0.8.7\nmatplotlib==3.2.1\ndtreeviz==0.8.2\nshap==0.35.0" }, { "alpha_fraction": 0.6590620875358582, "alphanum_fraction": 0.6755386590957642, "avg_line_length": 22.205883026123047, "blob_id": "aad05f8d900d82759e37f30e4fe5875c66d708b8", "content_id": "80beb3a2559ad4daba81c5c7d11166656c65ef7e", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 789, "license_type": "permissive", "max_line_length": 79, "num_lines": 34, "path": "/examples/scripts/multi_class_classifier.py", "repo_name": "peter-WeiZhang/mljar-supervised", "src_encoding": "UTF-8", "text": "import pandas as pd\nimport numpy as np\nfrom supervised.automl import AutoML\nimport supervised \n\nprint(supervised.__version__)\nimport sys\nprint(sys.path)\n\n\n# df = pd.read_csv(\"tests/data/iris_classes_missing_values_missing_target.csv\")\ndf = pd.read_csv(\"tests/data/iris_missing_values_missing_target.csv\")\nX = df[[\"feature_1\", \"feature_2\", \"feature_3\", \"feature_4\"]]\ny = df[\"class\"]\n\nautoml = AutoML(\n #results_path=\"AutoML_41\",\n algorithms=[\"CatBoost\"],\n #algorithms=[\"Random Forest\"],\n # \"Linear\",\n # \"Xgboost\",\n # \"Random Forest\"\n #],\n model_time_limit=10111,\n tuning_mode=\"Normal\",\n explain_level=0\n)\nautoml.set_advanced(start_random_models=1)\nautoml.fit(X, y)\n\npredictions = automl.predict(X)\n\nprint(predictions.head())\nprint(predictions.tail())\n" }, { "alpha_fraction": 0.6861166954040527, "alphanum_fraction": 0.7042253613471985, "avg_line_length": 19.70833396911621, "blob_id": "46c066ddd899ec260df3e5056a5221e8ad8902c4", "content_id": "9a49294952cf001ab95348458124e8793318cd8d", "detected_licenses": [ "MIT" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 497, "license_type": "permissive", "max_line_length": 90, "num_lines": 24, "path": "/examples/scripts/binary_classifier.py", "repo_name": "peter-WeiZhang/mljar-supervised", "src_encoding": "UTF-8", "text": "import pandas as pd\nfrom supervised.automl import AutoML\nimport os\n\ndf = pd.read_csv(\n \"https://raw.githubusercontent.com/pplonski/datasets-for-start/master/adult/data.csv\",\n skipinitialspace=True,\n)\n\nX = df[df.columns[:-1]]\ny = df[\"income\"]\n\nautoml = AutoML(\n #results_path=\"AutoML_23\",\n algorithms=[\"Baseline\"], \n total_time_limit=30*60,\n explain_level=0\n)\nautoml.set_advanced(start_random_models=1)\n\nautoml.fit(X, y)\npredictions = automl.predict(X)\n\nprint(predictions.head())\n" } ]
4
mulander/dedup
https://github.com/mulander/dedup
cd6b5c2bd8377522e5e4c3a74713d2f4df489556
02f71d0a42b9732d2c57b6b2a866a2a4a43c241d
5d347b680ab764e874d5fd566298bdf3f659202e
refs/heads/master
2016-09-05T09:33:37.527860
2014-04-29T15:03:56
2014-04-29T15:03:56
null
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.5286343693733215, "alphanum_fraction": 0.5424795746803284, "avg_line_length": 26.643478393554688, "blob_id": "9e487222154b316756ee2571d615e62b1556bbc1", "content_id": "3379867129fae47357795eb17645ea37b977591e", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3178, "license_type": "permissive", "max_line_length": 122, "num_lines": 115, "path": "/dedup.py", "repo_name": "mulander/dedup", "src_encoding": "UTF-8", "text": "#!/usr/bin/env python2.7\n\nimport os\nimport sys\nimport stat\nimport hashlib\n\nBUFSIZE=8*1024\n\n# http://stackoverflow.com/questions/1094841/reusable-library-to-get-human-readable-version-of-file-size\ndef sizeof_fmt(num):\n for x in ['bytes','KB','MB','GB']:\n if num < 1024.0 and num > -1024.0:\n return \"%6.1f%6s\" % (num, x)\n num /= 1024.0\n return \"%6.1f%6s\" % (num, 'TB')\n\nclass FileKeeper(object):\n \"\"\"Maintains a list of known files\"\"\"\n def __init__(self):\n self._entries = {}\n\n def seen(self, target):\n # checksum check\n return target.checksum() in self._entries\n\n def add(self, target):\n self._entries[target.checksum()] = target\n\n def get(self, target):\n return self._entries[target.checksum()]\n\n def report(self):\n wasting_space = filter(lambda e: e.wasted() > 0, self._entries.values())\n return sorted(wasting_space, key=lambda e: -e.wasted())\n\n def wasted(self):\n wasted = 0\n for entry in self._entries.values():\n wasted += entry.wasted()\n return wasted\n\nclass FileEntry(object):\n \"\"\"A seen file\"\"\"\n def __init__(self, root, target):\n self._path = os.path.join(root, target)\n self._size = os.stat(self._path).st_size\n m = hashlib.md5()\n with open(self._path, 'rb') as f:\n while True:\n content = f.read(BUFSIZE)\n if not content:\n break\n m.update(content)\n self._csum = m.hexdigest()\n self._duplicates = []\n\n def checksum(self):\n return self._csum\n\n def size(self):\n return self._size\n\n def path(self):\n return self._path\n\n def identical(self, fileEntry):\n with open(self._path, 'rb') as me, open(fileEntry.path(), 'rb') as him:\n while True:\n b1 = me.read(BUFSIZE)\n b2 = him.read(BUFSIZE)\n if b1 != b2:\n return False\n if not b1:\n return True\n\n def wasted(self):\n return self._size * len(self._duplicates)\n\n def duplicate(self, fileEntry):\n self._duplicates.append(fileEntry.path())\n\n def __str__(self):\n return \"%s wasted by duplicates of %s:\\n%s\" % (sizeof_fmt(self.wasted()), self._path, '\\n'.join(self._duplicates))\n\ndef dedup(target):\n keeper = FileKeeper()\n\n print 'Searching for duplicates in %s' % target\n for root, dirs, files in os.walk(target):\n for f in files:\n target = FileEntry(root, f)\n if not keeper.seen(target):\n keeper.add(target)\n else:\n seen = keeper.get(target)\n if seen.size() != target.size() \\\n or not seen.identical(target):\n keeper.add(target)\n else:\n seen.duplicate(target)\n return keeper\n\ndef report(keeper):\n for entry in keeper.report():\n print\n print entry\n\n print\n print \"%s wasted in total\" % sizeof_fmt(keeper.wasted())\n\nif __name__ == '__main__':\n target = sys.argv[1]\n keeper = dedup(target)\n report(keeper)" }, { "alpha_fraction": 0.7368420958518982, "alphanum_fraction": 0.7368420958518982, "avg_line_length": 13.25, "blob_id": "cfd9b7d798e2bc70ba16e8e1b4c6bc1e66047035", "content_id": "d5e1a19e282230022651a3840f79e071956d0199", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 57, "license_type": "permissive", "max_line_length": 43, "num_lines": 4, "path": "/README.md", "repo_name": "mulander/dedup", "src_encoding": "UTF-8", "text": "dedup\n=====\n\nIdentify duplicate files on the file system\n" } ]
2
juanisosa/trainingsurvey
https://github.com/juanisosa/trainingsurvey
58d318dde570fb56a18789107b684554e7fb8baa
085e77fd7b55ad5ce4ecd603aab5cc00bc11f75c
3e6462f8407d11c97032b9c39bca31cf49af05c5
refs/heads/master
2020-04-26T06:26:26.407902
2019-04-04T21:01:22
2019-04-04T21:01:22
173,364,436
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.6089857816696167, "alphanum_fraction": 0.6194394826889038, "avg_line_length": 35.5528450012207, "blob_id": "045abf1ec7ade36761ce32c57b282ad5e159e502", "content_id": "92d2cac5db77e7c1230f54286e6c5d6a764efb54", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 4496, "license_type": "no_license", "max_line_length": 146, "num_lines": 123, "path": "/stv.py", "repo_name": "juanisosa/trainingsurvey", "src_encoding": "UTF-8", "text": "import pandas as pd\nimport numpy as np\n\ndef get_parameters(): #get user input\n \"\"\"Ask the user for the number of courses to select using while\n loop to ensure a valid number is entered. Gets df index lenght\n as input\"\"\"\n #get number of courses available to pick from\n course_count = voting_data.shape[1]\n while True:\n try:\n course_no = int(input('\\nPlease enter the number of courses to select. The maximum number of courses is {}: \\n'.format(course_count)))\n if course_no <= course_count:\n break\n except KeyboardInterrupt: #To allow terminating the program during input\n print('\\n')\n break\n except:\n print('\\nThat\\'s not a valid city number! Select a number between 1 and {}: \\n'.format(course_count))\n\n print('-'*40)\n\n print('\\nThere are {} courses to choose from and {} slots to fill.\\n'.format(course_count, course_no)) #temp as a test of load\n\n print('-'*40)\n return course_no\n\n#load the survey data into a DataFrame and drop all NaN rows\nvoting_data = pd.read_csv('americas.csv').dropna(thresh=1).dropna(axis='columns', thresh=1)\n#voting_data.to_csv('voting_data.csv')\n\n#get courses to select from user\ncourse_no = get_parameters()\n\n#perform a round of counting\n\"\"\"Voting summary of each course by priority as a dataframe with rows for\neach priority\"\"\"\nvoting_sum = voting_data.apply(pd.value_counts)\n#voting_sum.to_csv('voting_sum.csv')\n\n#create Series to count votes with priority 1 and drop courses with no votes\nvote_tally = voting_sum.loc[1].dropna()\n#vote_tally.to_csv('voting_tally.csv')\n\nif len(vote_tally) > course_no:\n print('\\n{} courses got votes and there are {} slots to fill. More rounds are needed\\n'.format(len(vote_tally), course_no))\n\n print('\\nThe resuts of round 1 was:')\n print(vote_tally)\n\n n = 2\n while len(vote_tally) > course_no:\n\n '''determine loser course of round firt we find series of courses with\n fewest votes as option 1'''\n\n losers = vote_tally.loc[vote_tally == vote_tally.min()].index.tolist()\n\n #conditional statement to find loser based on losers list\n if len(losers) == 1:\n loser = losers[0]\n #if tie then losers length > 1 then we do while loop to look at tie breaker based on number of next priority\n elif len(losers) > 1:\n i = 2\n tie_breaker = voting_sum.loc[i, losers].fillna(0)\n tie_breaker = tie_breaker.loc[tie_breaker == tie_breaker.min()].index.tolist()\n if len(tie_breaker) == 1:\n loser = tie_breaker[0]\n else:\n while len(tie_breaker) > 1 and i < voting_sum.shape[0]:\n i += 1\n tie_breaker = voting_sum.loc[i, tie_breaker].fillna(0)\n tie_breaker = tie_breaker.loc[tie_breaker == tie_breaker.min()].index.tolist()\n loser = tie_breaker[0]\n\n print('\\nThe loser of round {} was:\\n'.format(n-1))\n print(loser)\n print('-'*40)\n\n\n\n #get list of voters who chose loser as first priority\n voters_losers = voting_data.loc[voting_data[loser] == 1].index.tolist()\n\n #substract 1 from priority chosen by these voters\n voting_data.loc[voters_losers, : ] = voting_data.loc[voters_losers, :].subtract(1)\n voting_data = voting_data.drop(loser, axis=1)\n #voting_data.to_csv('voting_data_{}.csv'.format(n))\n\n #recount voting_sum with new priorities\n voting_sum = voting_data.apply(pd.value_counts)\n #voting_sum.to_csv('voting_sum_{}.csv'.format(n))\n\n #redo vote_tally with new voting_sum\n vote_tally = voting_sum.loc[1].dropna()\n #print('-'*40)\n #print('\\nThe resuts of round {} was:'.format(n))\n #print(vote_tally)\n\n n += 1\n\n winners = vote_tally\n print('\\nThe follwing courses were selected by the voters:\\n')\n print(winners)\n print('\\n')\n print('-'*40)\n print('\\n')\n\nelif len(vote_tally) == course_no:\n print('-'*40)\n print('\\nThe courses bellow are the chosen ones and their respective votes:\\n')\n print(vote_tally)\n print('\\n')\n print('-'*40)\n print('\\n')\nelif len(vote_tally) < course_no:\n print('-'*40)\n print('\\nNot enough votes were received to fill all training slots offered.\\n')\n print('This is the result of the count of voters first priority:\\n')\n print(vote_tally)\n print('\\n')\n print('-'*40)\n print('\\n')\n" } ]
1
annadavidson/Fall-2020-Research
https://github.com/annadavidson/Fall-2020-Research
1af61d2f0b6b119d186ec88578a23ddfdf443322
54bcbd652147b7f2a4ef3e3f0e11540e7744d712
f7232c85163c3fa505f3690d7efc208a67f6e6f3
refs/heads/main
2023-01-04T19:47:29.964132
2020-11-03T03:11:28
2020-11-03T03:11:28
309,543,141
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.4655172526836395, "alphanum_fraction": 0.6114675402641296, "avg_line_length": 30.961538314819336, "blob_id": "84ee57d4a28e0055d9eed70f35fe86fe0410e39f", "content_id": "4be57b5c26c0a66d11d7ac67001dc0ee50ed3fba", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2494, "license_type": "no_license", "max_line_length": 125, "num_lines": 78, "path": "/image_contour.forsinan.py", "repo_name": "annadavidson/Fall-2020-Research", "src_encoding": "UTF-8", "text": "#!/usr/bin/env python\n\nimport matplotlib\nmatplotlib.use('Agg')\nimport aplpy\nimport numpy as np\nimport aplpy.regions\n\ndef contour_make_batch():\n contour_make(30169,34.595613,-5.17483, 1.16972e-05)\n contour_make(30545,34.5997,-5.17383,2.33875e-05)\n return;\n\ndef contour_make(id,ra,dec,rms):\n f01=aplpy.FITSFigure('/Users/grudnick/Work/IRAC_clusters/Data/UDS/HST/uds_cluster_wfc3_f160w_v1.0_drz_sci.fits.fz',hdu=1)\n f01.tick_labels.set_font(size='xx-large')\n f01.axis_labels.set_font(size='xx-large')\n f01.ticks.set_color('black')\n f01.ticks.set_linewidth(2)\n #f01.ticks.set_minor_frequency(5)\n\n f01.show_grayscale(vmin=-0.01,vmax=0.2,invert='True')\n\n zoomsize = 15./3600\n\n f01.recenter(ra,dec,width=zoomsize,height=zoomsize)\n #f01.add_label(0.5,0.9,'ID.01',relative=True)\n f01.tick_labels.set_yformat('dd:mm:ss')\n f01.tick_labels.set_xformat('hh:mm:ss.s')\n\n #f01.beam.set_linestyle('dashed')\n f01.beam.set_linewidth(2) # points\n\n #f01.beam.set(facecolor='red', linestyle='dashed', ...) # if you want to set multiple properties in one line\n #f01.Regions.show_regions('label.reg')\n\n if id==30545:\n dra1 = -1.0/3600.\n ddec1 = 1.0/3600.\n racoord1 = 34.59963\n deccoord1 = -5.1738413\n f01.show_arrows(racoord1,deccoord1,dra1, ddec1, color='red')\n dra1 = -1.0/3600.\n ddec1 = 1.2/3600.\n f01.add_label(racoord1 + dra1, deccoord1 + ddec1, \"30545, z=1.624\")\n\n dra2 = -1.0/3600.\n ddec2 = 1.0/3600.\n racoord2 = 34.599928\n deccoord2 = -5.1736636\n f01.show_arrows(racoord2,deccoord2,dra2, ddec2, color='red')\n dra2 = -1.0/3600.\n ddec2 = 1.2/3600.\n f01.add_label(racoord2 + dra2, deccoord2 + ddec2, \"30577, z=1.486\")\n\n #aell=2.1/3600.0\n #bell=0.94/3600.0\n aell=3.5/3600.0\n bell=2.0/3600.0\n paell=66.0\n f01.show_ellipses(ra,dec,aell,bell,90+paell,color=\"magenta\", linestyle='dashed', linewidth=5)\n\n if id==30169:\n dra1 = -1.0/3600.\n ddec1 = 1.0/3600.\n racoord1 = 34.595629\n deccoord1 = -5.1747063\n f01.show_arrows(racoord1,deccoord1,dra1, ddec1, color = \"red\")\n dra1 = -1.0/3600.\n ddec1 = 1.3/3600.\n f01.add_label(racoord1 + dra1, deccoord1 + ddec1, \"30169, z=1.629\")\n\n figstr = 'fig_' + str(id) + '_co.55days.eps'\n f01.save(figstr, format = 'EPS')\n\n figstr = 'fig_' + str(id) + '_co.55days.png'\n f01.save(figstr)\n return;\n\n" } ]
1
juengeja/SmartHome
https://github.com/juengeja/SmartHome
4e3206d2d61fe6f9613b9ac79cf14a572bf910d7
c20704ac3e993756bf5143a4a524d11908fad57f
7a32ad22811db72a63d7a37d1306e79cb043c4ac
refs/heads/main
2023-08-27T17:12:56.364789
2021-10-28T10:36:54
2021-10-28T10:36:54
413,571,263
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.6244131326675415, "alphanum_fraction": 0.6244131326675415, "avg_line_length": 20.299999237060547, "blob_id": "238eba55fb8463a8d01f69a215735519e015d53a", "content_id": "93e10f085736eccfd0522306d1038e673f44aa75", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 426, "license_type": "no_license", "max_line_length": 56, "num_lines": 20, "path": "/Device/Sensor/Sensor.py", "repo_name": "juengeja/SmartHome", "src_encoding": "UTF-8", "text": "from abc import abstractmethod\nfrom Device.Device import Device\n\n\nclass Sensor(Device):\n\n @abstractmethod\n def isactive(self):\n \"\"\"Get boolean: Is the Sensor active?\"\"\"\n pass\n\n @abstractmethod\n def activate(self):\n \"\"\"Set boolean to 'true': Activate the Sensor\"\"\"\n pass\n\n @abstractmethod\n def deactivate(self):\n \"\"\"Set boolean to 'false': Deactivate Sensor\"\"\"\n pass\n" }, { "alpha_fraction": 0.6045082211494446, "alphanum_fraction": 0.6045082211494446, "avg_line_length": 17.074073791503906, "blob_id": "24ee5634f26b7f5699fe374143d60b7bfc52fb60", "content_id": "05b5a0c93510fd3d5afccd94eca85b45f15bee2b", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 488, "license_type": "no_license", "max_line_length": 55, "num_lines": 27, "path": "/Controller/LightsController.py", "repo_name": "juengeja/SmartHome", "src_encoding": "UTF-8", "text": "from Controller.Controller import Controller\n\n\nclass LightsController(Controller):\n\n def turnon(self):\n pass\n\n def turnoff(self):\n pass\n\n def __init__(self, windows, doors, rollershutters):\n self.windows = windows\n self.doors = doors\n self.rollershutters = rollershutters\n\n def turnalloff(self, room):\n pass\n\n def turnallon(self, room):\n pass\n\n def turnoff(self, id):\n pass\n\n def turnon(self, id):\n pass\n" }, { "alpha_fraction": 0.5862675905227661, "alphanum_fraction": 0.5897887349128723, "avg_line_length": 18.586206436157227, "blob_id": "d5369c7fc1c7fb7836d094e4261f8faa3a705323", "content_id": "6c4425c1f23c06add2c88311422ab27088ae4a02", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 568, "license_type": "no_license", "max_line_length": 41, "num_lines": 29, "path": "/Device/Sensor/LightSensor.py", "repo_name": "juengeja/SmartHome", "src_encoding": "UTF-8", "text": "from Device.Sensor.Sensor import Sensor\n\n\nclass LightSensor(Sensor):\n\n def __init__(self, id, room, active):\n self.id = id\n self.room = room\n self.active = active\n self.lightlevel = 7\n\n def getroom(self):\n return self.room\n\n def setroom(self, room):\n self.room = room\n\n def isactive(self):\n return self.active\n\n def activate(self):\n self.active = True\n\n def deactivate(self):\n self.active = False\n\n def getlightlevel(self):\n self.lightlevel += 1\n return self.lightlevel\n" }, { "alpha_fraction": 0.7258522510528564, "alphanum_fraction": 0.7258522510528564, "avg_line_length": 29.60869598388672, "blob_id": "c45550be65b688d580dc572405cdb231082feb30", "content_id": "2457817b84b0e00f7dcaa534e032f3ce82c9dfe9", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 704, "license_type": "no_license", "max_line_length": 119, "num_lines": 23, "path": "/Device/Light/__init__.py", "repo_name": "juengeja/SmartHome", "src_encoding": "UTF-8", "text": "# Run Methods\nfrom self import self\n\nfrom Device.Light.ConcreteFactories import LightbulbFactory, StaircaseLightFactory, LightChainFactory, LEDStripeFactory\n\n\ndef run_singleModernLightExample():\n light_a = LightbulbFactory().create_modernlight()\n light_a.getproduct()\n light_a.getfeature()\n\n\ndef run_lightExample():\n for factorya in (StaircaseLightFactory(), LightbulbFactory(), LEDStripeFactory()):\n light_b = factorya.create_light()\n light_b.getproduct()\n\n\ndef run_modernlightExample():\n for factoryb in (LightChainFactory(), LightbulbFactory(), LEDStripeFactory()):\n light_c = factoryb.create_modernlight()\n light_c.getproduct()\n light_c.getfeature()\n" }, { "alpha_fraction": 0.642307698726654, "alphanum_fraction": 0.642307698726654, "avg_line_length": 14.29411792755127, "blob_id": "3dbda67339df2796d9827b79948a1109d059acbd", "content_id": "f018178bcc9fdaf2dc4071fdeef09e26a459053b", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 260, "license_type": "no_license", "max_line_length": 35, "num_lines": 17, "path": "/Device/Light/LightInterfaces.py", "repo_name": "juengeja/SmartHome", "src_encoding": "UTF-8", "text": "from abc import ABC, abstractmethod\n\n\nclass Light(ABC):\n @abstractmethod\n def getproduct(self):\n pass\n\n\nclass ModernLight(ABC):\n @abstractmethod\n def getproduct(self):\n pass\n\n @abstractmethod\n def getfeature(self):\n pass\n" }, { "alpha_fraction": 0.5770609378814697, "alphanum_fraction": 0.58243727684021, "avg_line_length": 18.241378784179688, "blob_id": "47d2506d2041945af54a9c56a6113e5b224e22a6", "content_id": "e75794c8fa4989edbab5108a8cd1ace0395d0571", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 558, "license_type": "no_license", "max_line_length": 41, "num_lines": 29, "path": "/Device/Sensor/MoisturisationSensor.py", "repo_name": "juengeja/SmartHome", "src_encoding": "UTF-8", "text": "from Device.Sensor.Sensor import Sensor\n\n\nclass MoisturisationSensor(Sensor):\n\n def __init__(self, id, room, active):\n self.id = id\n self.room = room\n self.active = active\n self.moist = 98\n\n def getroom(self):\n return self.room\n\n def setroom(self, room):\n self.room = room\n\n def isactive(self):\n return self.active\n\n def activate(self):\n self.active = True\n\n def deactivate(self):\n self.active = False\n\n def getmoist(self):\n self.moist += 1\n return self.moist\n" }, { "alpha_fraction": 0.6204379796981812, "alphanum_fraction": 0.6204379796981812, "avg_line_length": 20.920000076293945, "blob_id": "14e4074789888c2be6540534974bbbf523919679", "content_id": "20c8c7c661992f16634a7e0122d9570be41bcdc4", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 548, "license_type": "no_license", "max_line_length": 55, "num_lines": 25, "path": "/Device/EntryItem/EntryItem.py", "repo_name": "juengeja/SmartHome", "src_encoding": "UTF-8", "text": "from abc import abstractmethod\nfrom Device.Device import Device\n\n\nclass EntryItem(Device):\n\n @abstractmethod\n def islocked(self):\n \"\"\"Get boolean: Is the EntryItem locked?\"\"\"\n pass\n\n @abstractmethod\n def isopen(self):\n \"\"\"Get boolean: Is the EntryItem open?\"\"\"\n pass\n\n @abstractmethod\n def setlocked(self, locked):\n \"\"\"Set boolean: Lock or unlock the EntryItem\"\"\"\n pass\n\n @abstractmethod\n def setopen(self, open):\n \"\"\"Set boolean: Open or close the EntryItem\"\"\"\n pass\n" }, { "alpha_fraction": 0.5914633870124817, "alphanum_fraction": 0.5914633870124817, "avg_line_length": 13.909090995788574, "blob_id": "407d168e71f32d967a07b88e1c6271e9691e80a9", "content_id": "a9d6814f8f9bf05c80231cb24150f06f0d70126f", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 328, "license_type": "no_license", "max_line_length": 44, "num_lines": 22, "path": "/Controller/MediaDeviceController.py", "repo_name": "juengeja/SmartHome", "src_encoding": "UTF-8", "text": "from Controller.Controller import Controller\n\n\nclass MediaDeviceController(Controller):\n\n def turnon(self):\n pass\n\n def turnoff(self):\n pass\n\n def stopall(self, room):\n pass\n\n def pauseall(self, room):\n pass\n\n def play(self, id):\n pass\n\n def shutdown(self, id):\n pass\n" }, { "alpha_fraction": 0.6000000238418579, "alphanum_fraction": 0.6000000238418579, "avg_line_length": 17.25, "blob_id": "c59f4ee9b5db5b060fdc982404c58d84ce268d8c", "content_id": "8dfde1d273f7481d3b3dcb96dfe174c6e2814e13", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 365, "license_type": "no_license", "max_line_length": 34, "num_lines": 20, "path": "/Device/Light/Light.py", "repo_name": "juengeja/SmartHome", "src_encoding": "UTF-8", "text": "from abc import abstractmethod\nfrom Device.Device import Device\n\n\nclass Light(Device):\n\n @abstractmethod\n def getlightlevel(self):\n \"\"\"Get int: Light Level\"\"\"\n pass\n\n @abstractmethod\n def turnon(self):\n \"\"\"Turn this Light on\"\"\"\n pass\n\n @abstractmethod\n def turnoff(self):\n \"\"\"Turn this Light off\"\"\"\n pass\n" }, { "alpha_fraction": 0.7969034314155579, "alphanum_fraction": 0.8005464673042297, "avg_line_length": 41.230770111083984, "blob_id": "85cebd189a2a89025b942b99a6cfc4b07659689a", "content_id": "f00bd5cce633b844ed0ff294b3a0d3f0041f376c", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1098, "license_type": "no_license", "max_line_length": 87, "num_lines": 26, "path": "/main.py", "repo_name": "juengeja/SmartHome", "src_encoding": "UTF-8", "text": "#import minibar as minibar\n\nfrom Device.DeviceDecorator.FridgeDecorator import GetItemsDecorator, AddItemsDecorator\nfrom Device.DeviceDecorator.LightDecorator import CountdownDecorator, SoundDecorator\nfrom Device.Fridge.BeverageCooler import BeverageCooler\nfrom Device.Fridge.FridgeChain import FridgeChain\nfrom Device.Fridge.FridgeHandler import FridgeHandler\nfrom Device.Fridge.KitchenFridge import KitchenFridge\nfrom Device.Fridge.Minibar import Minibar\nfrom Device.Light import LightbulbFactory\n\nif __name__ == '__main__':\n # lightbulb = LightbulbFactory().create_modernlight()\n # countdownDecorator = CountdownDecorator(lightbulb)\n # soundDecoractor = SoundDecorator(lightbulb)\n # lightbulb.getproduct()\n # soundDecoractor.getproduct()\n # countdownDecorator.getfeature()\n # run_singleModernLightExample()\n\n fridgeChain = FridgeChain()\n getItemsDecorator = GetItemsDecorator(fridgeChain.link1, fridgeChain)\n getItemsDecorator.get_item(\"cola\", 3)\n\n addItemsDecorator = AddItemsDecorator(fridgeChain.link3, fridgeChain)\n addItemsDecorator.add_item(\"water\", 3)\n" }, { "alpha_fraction": 0.5219780206680298, "alphanum_fraction": 0.5219780206680298, "avg_line_length": 19.22222137451172, "blob_id": "7d40c3539ba92457cb31d9dc10d9155ede8f49c9", "content_id": "a58ac576f727154f088070a15ae8b42319781fcf", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 182, "license_type": "no_license", "max_line_length": 40, "num_lines": 9, "path": "/Organisation/Room.py", "repo_name": "juengeja/SmartHome", "src_encoding": "UTF-8", "text": "class Room:\n\n def __init__(self, id, name, house):\n self.id = id\n self.name = name\n self.house = house\n\n def setname(self, name):\n self.name = name\n" }, { "alpha_fraction": 0.5814977884292603, "alphanum_fraction": 0.5814977884292603, "avg_line_length": 15.214285850524902, "blob_id": "251ee685b8891504e85e7a2e141413df15a5df82", "content_id": "038da5e8bc31362cb43fb94425298cf130b4c1ff", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 227, "license_type": "no_license", "max_line_length": 30, "num_lines": 14, "path": "/Controller/Controller.py", "repo_name": "juengeja/SmartHome", "src_encoding": "UTF-8", "text": "from abc import abstractmethod\n\n\nclass Controller():\n\n @abstractmethod\n def turnoff(self):\n \"\"\"Turn Devices off\"\"\"\n pass\n\n @abstractmethod\n def turnon(self):\n \"\"\"Turn Devices on\"\"\"\n pass\n" }, { "alpha_fraction": 0.6045503616333008, "alphanum_fraction": 0.6045503616333008, "avg_line_length": 26.147058486938477, "blob_id": "1af75153c9736b59edf45ee1dd400be9ad86536a", "content_id": "b5b7c8c5aeccf79a0c8e26adc5e0959bfca5de26", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 923, "license_type": "no_license", "max_line_length": 72, "num_lines": 34, "path": "/Device/EntryItem/RollerShutter.py", "repo_name": "juengeja/SmartHome", "src_encoding": "UTF-8", "text": "from Device.EntryItem.EntryItem import EntryItem\n\n\nclass RollerShutter(EntryItem):\n\n def __init__(self, id, room, locked, open):\n self.id = id\n self.room = room\n self.locked = locked\n self.open = open\n\n def getroom(self):\n \"\"\"Get the room, in which the RollerShutter is located.\"\"\"\n return self.room\n\n def setroom(self, room):\n \"\"\"Set a room for this RollerShutter, in which it is located.\"\"\"\n self.room = room\n\n def islocked(self):\n \"\"\"Get boolean: Is the RollerShutter locked?\"\"\"\n return self.locked\n\n def isopen(self):\n \"\"\"Get boolean: Is the RollerShutter open?\"\"\"\n return self.open\n\n def setlocked(self, locked):\n \"\"\"Set boolean: Lock or unlock the RollerShutter\"\"\"\n self.locked = locked\n\n def setopen(self, open):\n \"\"\"Set boolean: Open or close the RollerShutter\"\"\"\n self.open = open\n" }, { "alpha_fraction": 0.5755813717842102, "alphanum_fraction": 0.5755813717842102, "avg_line_length": 24.294116973876953, "blob_id": "d818894e193aaac28cf7df5b16cb7eefb4612d0f", "content_id": "f4d4937741177895dfa3838335bfdb034bc6f512", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 860, "license_type": "no_license", "max_line_length": 63, "num_lines": 34, "path": "/Device/EntryItem/Door.py", "repo_name": "juengeja/SmartHome", "src_encoding": "UTF-8", "text": "from Device.EntryItem.EntryItem import EntryItem\n\n\nclass Door(EntryItem):\n\n def __init__(self, id, room, locked, open):\n self.id = id\n self.room = room\n self.locked = locked\n self.open = open\n\n def getroom(self):\n \"\"\"Get the room, in which the door is located.\"\"\"\n return self.room\n\n def setroom(self, room):\n \"\"\"Set a room for this door, in which it is located.\"\"\"\n self.room = room\n\n def islocked(self):\n \"\"\"Get boolean: Is the door locked?\"\"\"\n return self.locked\n\n def isopen(self):\n \"\"\"Get boolean: Is the door open?\"\"\"\n return self.open\n\n def setlocked(self, locked):\n \"\"\"Set boolean: Lock or unlock the door\"\"\"\n self.locked = locked\n\n def setopen(self, open):\n \"\"\"Set boolean: Open or close the door\"\"\"\n self.open = open\n" }, { "alpha_fraction": 0.7096773982048035, "alphanum_fraction": 0.7096773982048035, "avg_line_length": 21.14285659790039, "blob_id": "bd8072872ac30b3df9ae1c2392022a9704f0e20e", "content_id": "2a029b96c2c84dbce98c70e0b6eac3499724780c", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 310, "license_type": "no_license", "max_line_length": 59, "num_lines": 14, "path": "/Device/Light/StaircaseLight.py", "repo_name": "juengeja/SmartHome", "src_encoding": "UTF-8", "text": "from Device.Light.LightInterfaces import ModernLight, Light\n\n\nclass StaircaseLight(Light):\n def getproduct(self):\n print(\"StaircaseLight\")\n\n\nclass ModernStaircaseLight(ModernLight):\n def getproduct(self):\n print(\"Modern StaircaseLight\")\n\n def getfeature(self):\n print(\"Dimmable\")\n" }, { "alpha_fraction": 0.6344239115715027, "alphanum_fraction": 0.6344239115715027, "avg_line_length": 27.1200008392334, "blob_id": "f87564d02b28d5f1b566555d6f4fa29c85cf4bcc", "content_id": "1794c7ff80deebccea23d20ebfbb03e465e176af", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 703, "license_type": "no_license", "max_line_length": 75, "num_lines": 25, "path": "/Device/Light/Lightbulb.py", "repo_name": "juengeja/SmartHome", "src_encoding": "UTF-8", "text": "from Device.Light.LightInterfaces import Light, ModernLight\n\n\n# Concrete Products\nclass Lightbulb(Light):\n \"\"\" Concrete Lightbulb Product. Implements Light Interface\n \"\"\"\n def getproduct(self):\n \"\"\" prints: 'Lightbulb' string output\n \"\"\"\n print(\"Lightbulb\")\n\n\nclass ModernLightbulb(ModernLight):\n \"\"\" Concrete ModernLightbulb Product. Implements ModernLight Interface.\n \"\"\"\n def getproduct(self) -> str:\n \"\"\" prints: 'Modern Lightbulb ON' string output\n \"\"\"\n print(\"Modern Lightbulb ON\")\n\n def getfeature(self) -> str:\n \"\"\" prints: 'Low Energy Notification' string output\n \"\"\"\n print(\"Low Energy Notification\")\n" }, { "alpha_fraction": 0.575308620929718, "alphanum_fraction": 0.5777778029441833, "avg_line_length": 18.7560977935791, "blob_id": "99c4a6ef9a85fe3242bfed7205d96b76a256f785", "content_id": "918e0606a9e86ecf2e0064c9996d77609cd62840", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 810, "license_type": "no_license", "max_line_length": 61, "num_lines": 41, "path": "/Device/MediaDevice/TV.py", "repo_name": "juengeja/SmartHome", "src_encoding": "UTF-8", "text": "from Device.MediaDevice.MediaDevice import MediaDevice\n\n\nclass TV(MediaDevice):\n\n def __init__(self, id, room, on, soundlevel, brightness):\n self.id = id\n self.room = room\n self.on = on\n self.soundlevel = soundlevel\n self.brightness = brightness\n\n def getroom(self):\n return self.room\n\n def setroom(self, room):\n self.room = room\n\n def pause(self):\n print(\"TV on pause\")\n\n def play(self):\n print(\"TV on play\")\n\n def forward(self):\n print(\"Fast forwarding TV\")\n\n def backward(self):\n print(\"Fast backwarding TV\")\n\n def start(self):\n self.on = True\n\n def shutdown(self):\n self.on = False\n\n def brighter(self):\n self.brightness += 1\n\n def darker(self):\n self.brightness -= 1\n" }, { "alpha_fraction": 0.5807453393936157, "alphanum_fraction": 0.5807453393936157, "avg_line_length": 17.399999618530273, "blob_id": "7c64440d9ad853c342c7bbf77c9ac023ffd2e141", "content_id": "07710cc285039e1231851277e55c29f74bcca708", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 644, "license_type": "no_license", "max_line_length": 42, "num_lines": 35, "path": "/Device/MediaDevice/MediaDevice.py", "repo_name": "juengeja/SmartHome", "src_encoding": "UTF-8", "text": "from abc import abstractmethod\nfrom Device.Device import Device\n\n\nclass MediaDevice(Device):\n\n @abstractmethod\n def pause(self):\n \"\"\"Set the MediaDevice to pause\"\"\"\n pass\n\n @abstractmethod\n def play(self):\n \"\"\"Set MediaDevice to play\"\"\"\n pass\n\n @abstractmethod\n def forward(self):\n \"\"\"Spool forward\"\"\"\n pass\n\n @abstractmethod\n def backward(self):\n \"\"\"Spool backward\"\"\"\n pass\n\n @abstractmethod\n def start(self):\n \"\"\"Start the MediaDevice\"\"\"\n pass\n\n @abstractmethod\n def shutdown(self):\n \"\"\"Shut the MediaDevice down\"\"\"\n pass\n" }, { "alpha_fraction": 0.6666666865348816, "alphanum_fraction": 0.6666666865348816, "avg_line_length": 16.454545974731445, "blob_id": "5e4539e689fb316b14b31415d8c66f3bd8e01e59", "content_id": "24eabca0421ec7b181d9f76b0572e1763539e0ac", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 192, "license_type": "no_license", "max_line_length": 35, "num_lines": 11, "path": "/Device/Light/LightFactory.py", "repo_name": "juengeja/SmartHome", "src_encoding": "UTF-8", "text": "from abc import ABC, abstractmethod\n\n\nclass LightFactory(ABC):\n @abstractmethod\n def create_light(self):\n pass\n\n @abstractmethod\n def create_modernlight(self):\n pass\n" }, { "alpha_fraction": 0.6390328407287598, "alphanum_fraction": 0.6891191601753235, "avg_line_length": 29.473684310913086, "blob_id": "8d2844c0ac5f782a1ea790ac601aa8175d49bb9d", "content_id": "2cce32e6f463fe8f20e75298ee4072ba57173eb2", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 579, "license_type": "no_license", "max_line_length": 55, "num_lines": 19, "path": "/Device/Fridge/FridgeChain.py", "repo_name": "juengeja/SmartHome", "src_encoding": "UTF-8", "text": "from Device.Fridge.BeverageCooler import BeverageCooler\nfrom Device.Fridge.KitchenFridge import KitchenFridge\nfrom Device.Fridge.Minibar import Minibar\n\n\nclass FridgeChain:\n\n def __init__(self):\n self.link1 = Minibar(5, 5, 3, 2)\n self.link2 = BeverageCooler(10, 10, 9, 5)\n self.link3 = KitchenFridge(15, 15, 15, 15)\n\n def standardChain(self):\n self.link1.set_successor(self.link2)\n self.link2.set_successor(self.link3)\n\n def reverseChain(self):\n self.link3.set_successor(self.link2)\n self.link2.set_successor(self.link1)\n" }, { "alpha_fraction": 0.75, "alphanum_fraction": 0.75, "avg_line_length": 25.675676345825195, "blob_id": "827a7f35375aa1dca9dec8c8620a5b08492ef14b", "content_id": "be5d8b66514cf3fccb2c571e2e8b2ae2b2867fae", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 988, "license_type": "no_license", "max_line_length": 76, "num_lines": 37, "path": "/Device/Light/ConcreteFactories.py", "repo_name": "juengeja/SmartHome", "src_encoding": "UTF-8", "text": "\nfrom Device.Light.LEDStripe import LEDStripe, ModernLEDStripe\nfrom Device.Light.LightChain import LightChain, ModernLightChain\nfrom Device.Light.LightFactory import LightFactory\nfrom Device.Light.Lightbulb import Lightbulb, ModernLightbulb\nfrom Device.Light.StaircaseLight import StaircaseLight, ModernStaircaseLight\n\n\nclass StaircaseLightFactory(LightFactory):\n def create_light(self):\n return StaircaseLight()\n\n def create_modernlight(self):\n return ModernStaircaseLight()\n\n\nclass LEDStripeFactory(LightFactory):\n def create_light(self):\n return LEDStripe()\n\n def create_modernlight(self):\n return ModernLEDStripe()\n\n\nclass LightbulbFactory(LightFactory):\n def create_light(self):\n return Lightbulb()\n\n def create_modernlight(self):\n return ModernLightbulb()\n\n\nclass LightChainFactory(LightFactory):\n def create_light(self):\n return LightChain()\n\n def create_modernlight(self):\n return ModernLightChain()\n" }, { "alpha_fraction": 0.6608391404151917, "alphanum_fraction": 0.6608391404151917, "avg_line_length": 16.875, "blob_id": "d33880964125e87f9e5f2adf0631f46ae1306562", "content_id": "ed2277df4f555ef98eff1db36656c7b9ccd696c9", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 286, "license_type": "no_license", "max_line_length": 45, "num_lines": 16, "path": "/Device/Fridge/FridgeHandler.py", "repo_name": "juengeja/SmartHome", "src_encoding": "UTF-8", "text": "from abc import ABC, abstractmethod\n\n\nclass FridgeHandler(ABC):\n\n @abstractmethod\n def set_successor(successor):\n pass\n\n @abstractmethod\n def request_add_item(item, amount):\n pass\n\n @abstractmethod\n def request_available_item(item, amount):\n pass\n" }, { "alpha_fraction": 0.6114864945411682, "alphanum_fraction": 0.6114864945411682, "avg_line_length": 20.14285659790039, "blob_id": "23edb6b37dcd44ffda85985e5981e7088b4687d2", "content_id": "fdc980b21bc57f23528aae2141271a2387d5f603", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 296, "license_type": "no_license", "max_line_length": 65, "num_lines": 14, "path": "/Device/Device.py", "repo_name": "juengeja/SmartHome", "src_encoding": "UTF-8", "text": "from abc import abstractmethod\n\n\nclass Device():\n\n @abstractmethod\n def getroom(self):\n \"\"\"Get the room, in which this device is located.\"\"\"\n pass\n\n @abstractmethod\n def setroom(self, room):\n \"\"\"Set a room for this device, in which it is located.\"\"\"\n pass\n" }, { "alpha_fraction": 0.6946308612823486, "alphanum_fraction": 0.6946308612823486, "avg_line_length": 20.285715103149414, "blob_id": "bbf65b2a804f24923acf56f7f577047f56d26a94", "content_id": "1c86762fd818342fade8c15ff879e116c6ba8548", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 298, "license_type": "no_license", "max_line_length": 59, "num_lines": 14, "path": "/Device/Light/LightChain.py", "repo_name": "juengeja/SmartHome", "src_encoding": "UTF-8", "text": "from Device.Light.LightInterfaces import Light, ModernLight\n\n\nclass LightChain(Light):\n def getproduct(self):\n print(\"LightChain\")\n\n\nclass ModernLightChain(ModernLight):\n def getproduct(self):\n print(\"Modern LightChain\")\n\n def getfeature(self):\n print(\"Blink Effect\")\n" }, { "alpha_fraction": 0.6062718033790588, "alphanum_fraction": 0.6062718033790588, "avg_line_length": 14.105262756347656, "blob_id": "cf773339e4809977152198ecc7f3718784f8afb3", "content_id": "06916175d1314dae91d49795334dc1be3d50ccf3", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 287, "license_type": "no_license", "max_line_length": 44, "num_lines": 19, "path": "/Controller/SensorController.py", "repo_name": "juengeja/SmartHome", "src_encoding": "UTF-8", "text": "from Controller.Controller import Controller\n\n\nclass SensorController(Controller):\n\n def turnon(self):\n pass\n\n def turnoff(self):\n pass\n\n def stopalarm(self, room):\n pass\n\n def activate(self, id):\n pass\n\n def deactivate(self, id):\n pass\n" }, { "alpha_fraction": 0.597811222076416, "alphanum_fraction": 0.597811222076416, "avg_line_length": 19.885713577270508, "blob_id": "78eccc8a79443883353cd98c4b99df216a132f2e", "content_id": "087064c9886b0bbd9afe558b8d4c19d4c255872e", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 731, "license_type": "no_license", "max_line_length": 60, "num_lines": 35, "path": "/Device/MediaDevice/Soundbar.py", "repo_name": "juengeja/SmartHome", "src_encoding": "UTF-8", "text": "from Device.MediaDevice.MediaDevice import MediaDevice\n\n\nclass SoundBar(MediaDevice):\n\n def __init__(self, id, room, on, soundlevel, songqueue):\n self.id = id\n self.room = room\n self.on = on\n self.soundlevel = soundlevel\n self.songqueue = songqueue\n\n def getroom(self):\n return self.room\n\n def setroom(self, room):\n self.room = room\n\n def pause(self):\n print(\"SoundBar on pause\")\n\n def play(self):\n print(\"SoundBar on play\")\n\n def forward(self):\n print(\"Fast forwarding SoundBar\")\n\n def backward(self):\n print(\"Fast backwarding SoundBar\")\n\n def start(self):\n self.on = True\n\n def shutdown(self):\n self.on = False\n" }, { "alpha_fraction": 0.6928327679634094, "alphanum_fraction": 0.6928327679634094, "avg_line_length": 19.928571701049805, "blob_id": "13ed08ccec39a15a0a35fb3a057e3439ddf7e5a1", "content_id": "b807707cfab3106880959087ba1ad67997702f46", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 293, "license_type": "no_license", "max_line_length": 59, "num_lines": 14, "path": "/Device/Light/LEDStripe.py", "repo_name": "juengeja/SmartHome", "src_encoding": "UTF-8", "text": "from Device.Light.LightInterfaces import Light, ModernLight\n\n\nclass LEDStripe(Light):\n def getproduct(self):\n print(\"LEDStripe\")\n\n\nclass ModernLEDStripe(ModernLight):\n def getproduct(self):\n print(\"Modern LEDStripe\")\n\n def getfeature(self):\n print(\"Connectable\")\n" }, { "alpha_fraction": 0.6622889041900635, "alphanum_fraction": 0.6641650795936584, "avg_line_length": 32.841270446777344, "blob_id": "4a166c5111f59b4e0c2894ef6d388b4fe8492445", "content_id": "fb0f206b4019238d0d3a7b4d680ae0726c134fb2", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2132, "license_type": "no_license", "max_line_length": 113, "num_lines": 63, "path": "/Device/DeviceDecorator/LightDecorator.py", "repo_name": "juengeja/SmartHome", "src_encoding": "UTF-8", "text": "from abc import ABC\nfrom time import sleep\nfrom Device.Light.LightInterfaces import ModernLight\n\n\n# Abstract Base Decorator\nclass ModernLightDecorator(ModernLight, ABC):\n \"\"\"Abstract class to all decorators complementing ModernLight Products\n Parameters:\n ModernLight object to be decorated\n Attributes:\n _modernlight : ModernLight\n represents the passed ModernLight object\n Methods:\n modernLight()\n utilizes @property decorator for ModernLight object setter and getters\n getproduct()\n returns the getproduct() method of the passed ModernLight object\n getfeature()\n returns the getfeature() method of the passed ModernLight object\n \"\"\"\n _modernlight: ModernLight\n\n def __init__(self, modernlight: ModernLight):\n self._modernlight = modernlight\n\n @property\n def modernLight(self) -> str:\n return self._modernlight\n\n def getproduct(self) -> str:\n return self._modernlight.getproduct()\n\n def getfeature(self) -> str:\n return self._modernlight.getfeature()\n\n\n# Lightweight Decorators\nclass CountdownDecorator(ModernLightDecorator):\n \"\"\"Extends the Abstract ModernLightDecorator class.\n \"\"\"\n\n def getfeature(self) -> str:\n \"\"\" Overwrites the Abstract ModernLightDecorator getfeature() Method. Provides additional short counter +\n 'battery' string output Returns: getfeature() method of passed ModernLight Object\n \"\"\"\n count = 5\n for x in range(count, -1, -1):\n print(\"battery:\", x)\n sleep(1)\n return self.modernLight.getfeature()\n\n\nclass SoundDecorator(ModernLightDecorator):\n \"\"\"Extends the Abstract ModernLightDecorator class.\n \"\"\"\n\n def getproduct(self) -> str:\n \"\"\" Overwrites the Abstract ModernLightDecorator getproduct() Method. Provides additional 'Soothing music\n starts' string output Returns: getfeature() method of passed ModernLight Object\n \"\"\"\n print(\"Soothing music starts\")\n return self.modernLight.getproduct()\n" }, { "alpha_fraction": 0.7183212041854858, "alphanum_fraction": 0.7183212041854858, "avg_line_length": 27.159090042114258, "blob_id": "daad9d9c1c57deacdb486dd76db6d47dc4604d3a", "content_id": "ba7726a3d39c9dd9b729a64dd4753fdbee8e102d", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1239, "license_type": "no_license", "max_line_length": 79, "num_lines": 44, "path": "/Device/DeviceDecorator/FridgeDecorator.py", "repo_name": "juengeja/SmartHome", "src_encoding": "UTF-8", "text": "from abc import ABC\n\nfrom Device.Fridge.FridgeChain import FridgeChain\nfrom Device.Fridge.FridgeHandler import FridgeHandler\n\n\n# Abstract Base Decorator\nclass FridgeDecorator(FridgeHandler, ABC):\n _fridgeHandler: FridgeHandler\n\n def __init__(self, fridgeHandler: FridgeHandler, fridgeChain: FridgeChain):\n self.fridgeChain = fridgeChain\n self._fridgeHandler = fridgeHandler\n\n @property\n def fridgeHandler(self):\n return self._fridgeHandler\n\n def request_add_item(self, item, amount):\n return self._fridgeHandler.request_add_item(item, amount)\n\n def request_available_item(self, item, amount):\n return self._fridgeHandler.request_available_item(item, amount)\n\n\n# Lightweight Decorators\nclass AddItemsDecorator(FridgeDecorator):\n\n def set_successor(successor):\n pass\n\n def add_item(self, item, amount):\n self.fridgeChain.reverseChain()\n print(\"recommended storage: \")\n self.fridgeHandler.request_add_item(item, amount)\n\n\nclass GetItemsDecorator(FridgeDecorator):\n def set_successor(successor):\n pass\n\n def get_item(self, item, amount):\n self.fridgeChain.standardChain()\n self.fridgeHandler.request_available_item(item, amount)\n" }, { "alpha_fraction": 0.5882353186607361, "alphanum_fraction": 0.5882353186607361, "avg_line_length": 23.55555534362793, "blob_id": "1f3921b9c2e42b99b65b74a8910a6bd7dcb4aa8b", "content_id": "588dddc2627a4e12668555bfab6276d68cbad150", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 221, "license_type": "no_license", "max_line_length": 49, "num_lines": 9, "path": "/Organisation/Customer.py", "repo_name": "juengeja/SmartHome", "src_encoding": "UTF-8", "text": "class Customer:\n\n def __init__(self, name, email, phoneNumber):\n self.name = name\n self.email = email\n self.phoneNumber = phoneNumber\n\n def sign_up(self, name):\n print(name, \"signed up\")\n" }, { "alpha_fraction": 0.5617284178733826, "alphanum_fraction": 0.5617284178733826, "avg_line_length": 20.600000381469727, "blob_id": "5fc8c596ca7a24f56b03219103b9c2590c3db5e0", "content_id": "4fa8dcfcea2ed0d047656ddf8aec111eda83f6a5", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 324, "license_type": "no_license", "max_line_length": 50, "num_lines": 15, "path": "/Organisation/Home.py", "repo_name": "juengeja/SmartHome", "src_encoding": "UTF-8", "text": "class Home:\n\n def __init__(self, id, name, address, status):\n self.id = id\n self.name = name\n self.address = address\n self.status = status\n\n def __getstate__(self):\n return self.status\n\n def close_all(self):\n print(\"Closing everything\")\n\n print(\"Everything closed\")\n" }, { "alpha_fraction": 0.6004140973091125, "alphanum_fraction": 0.6004140973091125, "avg_line_length": 16.88888931274414, "blob_id": "4c429d6f32e4be5304da1d8a24cc02c58c3b9ed3", "content_id": "89131e029f38cdd68e82861a337214db8de3d5a9", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 483, "license_type": "no_license", "max_line_length": 55, "num_lines": 27, "path": "/Controller/EntryItemController.py", "repo_name": "juengeja/SmartHome", "src_encoding": "UTF-8", "text": "from Controller.Controller import Controller\n\n\nclass EntryItemController(Controller):\n\n def turnon(self):\n pass\n\n def turnoff(self):\n pass\n\n def __init__(self, windows, doors, rollershutters):\n self.windows = windows\n self.doors = doors\n self.rollershutters = rollershutters\n\n def openall(self, room):\n pass\n\n def closeall(self, room):\n pass\n\n def open(self, id):\n pass\n\n def close(self, id):\n pass\n" }, { "alpha_fraction": 0.655063271522522, "alphanum_fraction": 0.655063271522522, "avg_line_length": 20.066667556762695, "blob_id": "084e368dab81d8f80b557a09da8601d45b3fe862", "content_id": "3e64cc43f0db9bb980bd5d56acd72d876872967d", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 316, "license_type": "no_license", "max_line_length": 49, "num_lines": 15, "path": "/Device/Sensor/SecuritySensor/SecuritySensor.py", "repo_name": "juengeja/SmartHome", "src_encoding": "UTF-8", "text": "from abc import abstractmethod\nfrom Device.Sensor.Sensor import Sensor\n\n\nclass SecuritySensor(Sensor):\n\n @abstractmethod\n def isalarm(self):\n \"\"\"Get boolean: Is an alarm triggered?\"\"\"\n pass\n\n @abstractmethod\n def triggeralarm(self):\n \"\"\"Set boolean: Trigger an alarm\"\"\"\n pass\n" }, { "alpha_fraction": 0.6015796661376953, "alphanum_fraction": 0.6015796661376953, "avg_line_length": 43.70588302612305, "blob_id": "1a831fb0dbec90cd89c557bc4c3f643171ae896b", "content_id": "e2a1273355aab8d21d5408f679d1faee8c2cf8c1", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2279, "license_type": "no_license", "max_line_length": 91, "num_lines": 51, "path": "/Device/Fridge/BeverageCooler.py", "repo_name": "juengeja/SmartHome", "src_encoding": "UTF-8", "text": "from Device.Fridge.FridgeHandler import FridgeHandler\n\n\nclass BeverageCooler(FridgeHandler):\n\n def __init__(self, waterCapacity, colaCapacity, waterCount, colaCount):\n self._successor = None\n self._colaCount = colaCount\n self._waterCount = waterCount\n self._colaCapacity = colaCapacity\n self._waterCapacity = waterCapacity\n\n def set_successor(self, successor):\n self._successor = successor\n\n def request_add_item(self, item, amount):\n fridge = \"beverage cooler\"\n if item == \"water\":\n newWaterCount = self._waterCount + amount\n addableAmount = self._waterCapacity-self._waterCount\n restAmount = amount-addableAmount\n if newWaterCount > self._waterCapacity:\n print(str(addableAmount) + \" water bottles should be stored in: \" + fridge)\n self._successor.request_add_item(item, restAmount)\n else:\n print(str(addableAmount) + \" water bottles should be stored in: \" + fridge)\n\n if item == \"cola\":\n newColaCount = self._colaCount + amount\n addableAmount = self._colaCapacity-self._colaCount\n restAmount = amount-addableAmount\n if newColaCount > self._colaCapacity:\n print(str(addableAmount) + \" cola bottles should be stored in: \" + fridge)\n self._successor.request_add_item(item, restAmount)\n else:\n addableAmount = self._colaCapacity-self._colaCount\n print(str(addableAmount) + \" cola bottles should be stored in: \" + fridge)\n\n def request_available_item(self, item, amount):\n fridge = \"beverage cooler\"\n if item == \"water\":\n if amount < self._waterCount:\n print(str(self._waterCount) + \" water bottles are available in: \" + fridge)\n else:\n self._successor.request_available_item(item, amount)\n if item == \"cola\":\n if amount <= self._colaCount:\n print(str(self._colaCount) + \" cola bottles are available in: \" + fridge)\n else:\n print(str(self._colaCount) + \" cola bottles are available in: \" + fridge)\n self._successor.request_available_item(item, amount)" }, { "alpha_fraction": 0.591289758682251, "alphanum_fraction": 0.591289758682251, "avg_line_length": 26.159090042114258, "blob_id": "e10d0b977b028ac1fe185724eff460d7d79fb0c8", "content_id": "e3c879d3ee56abfe4f9e35f29e1714b861be03e6", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1194, "license_type": "no_license", "max_line_length": 73, "num_lines": 44, "path": "/Device/EntryItem/Window.py", "repo_name": "juengeja/SmartHome", "src_encoding": "UTF-8", "text": "from Device.EntryItem.EntryItem import EntryItem\n\n\nclass Window(EntryItem):\n\n def __init__(self, id, room, locked, open, position):\n self.id = id\n self.room = room\n self.locked = locked\n self.open = open\n self.position = position\n\n def getroom(self):\n \"\"\"Get the room, in which the window is located.\"\"\"\n return self.room\n\n def setroom(self, room):\n \"\"\"Set a room for this window, in which it is located.\"\"\"\n self.room = room\n\n def islocked(self):\n \"\"\"Get boolean: Is the window locked?\"\"\"\n return self.locked\n\n def isopen(self):\n \"\"\"Get boolean: Is the window open?\"\"\"\n return self.open\n\n def setlocked(self, locked):\n \"\"\"Set boolean: Lock or unlock the window\"\"\"\n self.locked = locked\n\n def setopen(self, open):\n \"\"\"Set boolean: Open or close the window\"\"\"\n self.open = open\n\n def getposition(self):\n \"\"\"Get the current position of the window: is it completely open,\n tilted, ...\"\"\"\n return self.position\n\n def setposition(self, position):\n \"\"\"Set the position of the window: String\"\"\"\n self.position = position" } ]
35
bensanhuan/join_sampling
https://github.com/bensanhuan/join_sampling
3b7cb946dd2317026f58c61510fac33d9ecb0ebd
4b6bf12ec7f92be5bbd22eb2561dab8b739940d0
d1785839c10d09c70222a62a9b84be60da65650e
refs/heads/master
2023-04-14T02:04:56.211647
2021-04-18T07:38:16
2021-04-18T07:38:16
352,642,789
0
0
null
2021-03-29T12:54:44
2021-04-18T07:31:52
2021-04-18T07:38:16
Python
[ { "alpha_fraction": 0.5431309938430786, "alphanum_fraction": 0.5804046988487244, "avg_line_length": 39.869564056396484, "blob_id": "1d13619ad9e0a8760e2f6ec2d755470483913cd2", "content_id": "307b13185bb1f230298eb89d4878261d69bdd39a", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 939, "license_type": "no_license", "max_line_length": 164, "num_lines": 23, "path": "/IndexSample_test.py", "repo_name": "bensanhuan/join_sampling", "src_encoding": "UTF-8", "text": "from loguru import logger\nfrom IndexSample import *\n\n\ndef test_IndexSample():\n sqls = dict()\n with open(\"./data/sqls.pkl\", 'rb') as f:\n sqls = pickle.load(f)\n \n skipSqls = [\"17a\", \"17b\", \"17c\", \"17d\", \"17e\", \"17f\", \"16a\", \"16b\", \"16c\", \"16d\"]\n\n for k, v in sqls.items():\n if k in skipSqls:\n continue\n logger.info(\"begin indexSample for {}:\\n\", k)\n estimateCardinality = IndexSample(v, 10000000000, 1000)\n realCardinality = dict()\n with open(\"./data/realCardinality/\" + k + \".realCardinality\", 'rb') as f:\n realCardinality = pickle.load(f)\n logger.info(\"begin compare real / estimate cardinality.............................\\n\")\n for key in estimateCardinality.keys():\n logger.info(\"{}, real: {}, estimate: {}, ratio:{} \", key, realCardinality[key], estimateCardinality[key], estimateCardinality[key]/realCardinality[key])\n break" }, { "alpha_fraction": 0.5560190677642822, "alphanum_fraction": 0.5631704330444336, "avg_line_length": 22.070423126220703, "blob_id": "567dcea35ed78eaa8ebc6d8018a75fe6895257f9", "content_id": "bc51fb2912537d278e735e563e858cc0be45ba6c", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1788, "license_type": "no_license", "max_line_length": 111, "num_lines": 71, "path": "/util.py", "repo_name": "bensanhuan/join_sampling", "src_encoding": "UTF-8", "text": "import re\nimport glob\nimport pandas as pd\nfrom loguru import logger\nimport matplotlib.pyplot as plt\n#用于sql解析的字符串常量\ns_select = 'select'\ns_from = 'from'\ns_where = 'where'\ns_value = 'value'\ns_name = 'name'\ns_literal = 'literal'\ns_is_null = 'missing'\ns_is_not_null = 'exists'\ns_between = 'between'\ns_like = 'like'\ns_greater = 'gt'\ns_lt = 'lt'\ns_gt = 'gt'\ns_gte = 'gte'\ns_lte = 'lte'\ns_eq = 'eq'\ns_neq = 'neq'\ns_neq = 'neq'\ns_or = 'or'\ns_and = 'and'\ns_like = 'like'\ns_not_like = 'not_like'\ns_in = 'in'\n\n\n#给一个parse结果,返回表名映射 \ndef GetTableMapping(p):\n assert(isinstance(p, dict)) and s_from in p.keys() and isinstance(p[s_from], list)\n tableMapping = dict()\n for v in p[s_from]:\n if isinstance(v, dict):\n #有重命名\n tableMapping[v[s_name]] = v[s_value]\n else:\n assert isinstance(v, str)\n tableMapping[v] = v\n\n return tableMapping\n\n#判断parse结果中‘eq'对应的list[‘ ’ , ‘ ’]是不是连接语句\ndef IsJoinDes(x):\n if isinstance(x, list) and len(x) == 2 and isinstance(x[0], str) and isinstance(x[1], str) \\\n and re.match(\".*\\..*\", x[0]) and re.match(\".*\\..*\", x[1]) and x[0].split('.')[0] != x[1].split('.')[0]:\n return True\n else:\n return False\n#判断字符串是否是‘and' 'or'\ndef isAndOr(x):\n assert isinstance(x, str)\n return x == s_and or x == s_or\n\ndef dropPrefix(df):\n filedNames = df.columns.str.split('.').tolist()\n renameDict = dict()\n for v in filedNames:\n renameDict[v[0] + '.' + v[1]] = v[1]\n df = df.rename(columns = renameDict)\n return df\n\ndef addPrefix(df, pre):\n return df.add_prefix(pre + '.')\n \n\nif __name__ == \"__main__\":\n pass \n \n \n\n\n \n\n\n \n" }, { "alpha_fraction": 0.5544173121452332, "alphanum_fraction": 0.5681639313697815, "avg_line_length": 35.58012771606445, "blob_id": "7b083abc63ba3dad3d1049c90cb9bd94ad157ae5", "content_id": "88423479b7d74b97ab5ee4ee791ea8ed6d474892", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 12209, "license_type": "no_license", "max_line_length": 152, "num_lines": 312, "path": "/realCardinality.py", "repo_name": "bensanhuan/join_sampling", "src_encoding": "UTF-8", "text": "from QueryGraph import *\nimport queue\nimport copy\nimport pickle\nimport gc\nimport os\nimport time\n\n#TODO: check whether 20a.sql caculate right\n\n#NOTICE:目前只计算大小为6的\n#计算一个sql语句中间结果的真实基数\n#先对单表数据执行单表选择条件,然后留下需要连接的属性列\nMaxJoinSize = 6\nMAXN = 100\n\nfiles = os.listdir(\"./data/realCardinality\")\nlogger.info(\"already has {}\\n\", files)\n\ndef caculateRealCardinality(prefix ,sql):\n #检查是否已经计算过:\n if prefix+'.realCardinality' in files:\n logger.info(\"already caculated\\n\")\n return\n\n #内存hold不住的查询先跳过:\n skipSqls = [\"17a\", \"17b\", \"17c\", \"17d\", \"17e\", \"17f\", \"16a\", \"16b\", \"16c\", \"16d\"]\n\n if prefix in skipSqls:\n logger.info(\"skip {}\\n\", prefix)\n return\n \n g = QueryGraph(sql)\n relationData = dict()\n for k in g.data.keys():\n relationData[k] = g.data[k].df\n for k in relationData.keys():\n relationData[k] = performSelect(g, k, relationData[k])\n \n #整理需要连接的属性:\n joinField = dict()\n for tname in g.tableNames:\n joinField[tname] = list()\n for tname1 in g.tableNames:\n for tname2 in g.tableNames:\n for x in g.joinCondition[tname1][tname2]:\n if x[0] not in joinField[tname1]:\n joinField[tname1].append(x[0]) \n #过滤数据\n for k in relationData.keys():\n relationData[k] = relationData[k][joinField[k]]\n logger.debug(\"caculateRealCardinality relationdata[{}] columns:{}\\n\", k, relationData[k].columns.values.tolist())\n\n #修改数据属性列名,为了防止连接后重名,加上表名前缀\n for k in relationData.keys():\n relationData[k]=relationData[k].add_prefix(k + '.')\n logger.debug(\"caculateRealCardinality relationdata[{}] after rename columns:{}\\n\", k, relationData[k].columns.values.tolist())\n\n \n #枚举中间结果并计算\n #由于图上无环,所以每次加入一个新表连接,肯定只有一个join条件\n datas = dict()#使用表名的字符串set作为key\n realCardinality = dict()\n IntermediateList = list() \n upupSet = set()\n q = queue.Queue()\n for k in relationData.keys():\n datas[frozenset([k])] = relationData[k]\n realCardinality[frozenset([k])] = relationData[k].shape[0]\n q.put(frozenset([k]))\n logger.debug(\"relationData keys:{}\\n\", relationData.keys())\n del relationData\n del g.data\n gc.collect()\n while not q.empty():\n s_in = q.get()\n IntermediateList.append(s_in)\n if len(s_in) >= MaxJoinSize:\n continue\n neighbors = g.getNeighbors(s_in)\n for nei in neighbors:\n s_out = set(s_in)\n s_out.add(nei)\n s_out = frozenset(s_out)\n if s_out in realCardinality.keys():#已经计算过了\n continue\n #找到和nei连接的表\n for r in s_in:\n if len(g.joinCondition[r][nei]) <= 0:\n continue\n #找到连接,做join,选择xxx_id的列\n fields = g.joinCondition[r][nei][0]\n logger.debug(\"join {} with {} on {}\", s_in, nei, fields)\n if fields[0] == 'id':\n datas[s_out] = datas[s_in].join(datas[frozenset([nei])].set_index(nei + '.' + fields[1]), on = (r + '.' + fields[0]), how = 'inner')\n else: \n datas[s_out] = datas[frozenset([nei])].join(datas[s_in].set_index(r + '.' + fields[0]), on=(nei + '.' + fields[1]), how = 'inner')\n logger.debug(\" size: {}\\n\", datas[s_out].shape[0])\n q.put(s_out)\n realCardinality[s_out] = datas[s_out].shape[0]\n break\n if len(s_out) == MaxJoinSize:\n del datas[s_out]\n gc.collect()\n if len(s_in) > 1:\n del datas[s_in]\n gc.collect() \n \n\n for k in IntermediateList:\n logger.debug(\"caculateRealCardinality realCardinality of {}: {}\\n\", k, realCardinality[k])\n \n with open('./data/realCardinality/'+prefix+'.realCardinality', 'wb') as f:\n pickle.dump(realCardinality, f)\n \n \n \n#优化内存占用\ndef caculateRealCardinality1_1(prefix ,sql):\n #检查是否已经计算过:\n if prefix+'.realCardinality' in files:\n logger.info(\"already caculated\\n\")\n return\n\n #内存hold不住的查询先跳过:\n skipSqls = [\"17a\", \"17b\", \"17c\", \"17d\", \"17e\", \"17f\", \"16a\", \"16b\", \"16c\", \"16d\"]\n if prefix in skipSqls:\n logger.info(\"skip {}\\n\", prefix)\n return\n \n g = QueryGraph(sql)\n relationData = dict()\n for k in g.data.keys():\n relationData[k] = g.data[k].df\n for k in relationData.keys():\n relationData[k] = performSelect(g, k, relationData[k])\n \n #整理需要连接的属性:\n joinField = dict()\n for tname in g.tableNames:\n joinField[tname] = list()\n for tname1 in g.tableNames:\n for tname2 in g.tableNames:\n for x in g.joinCondition[tname1][tname2]:\n if x[0] not in joinField[tname1]:\n joinField[tname1].append(x[0]) \n #过滤数据\n for k in relationData.keys():\n relationData[k] = relationData[k][joinField[k]]\n logger.debug(\"caculateRealCardinality relationdata[{}] columns:{}\\n\", k, relationData[k].columns.values.tolist())\n del g.data\n gc.collect()\n #修改数据属性列名,为了防止连接后重名,加上表名前缀\n for k in relationData.keys():\n relationData[k]=relationData[k].add_prefix(k + '.')\n logger.debug(\"caculateRealCardinality relationdata[{}] after rename columns:{}\\n\", k, relationData[k].columns.values.tolist())\n\n \n #枚举中间结果并计算\n #由于图上无环,所以每次加入一个新表连接,肯定只有一个join条件\n realCardinality = dict()\n IntermediateList = list()\n for k in relationData.keys():\n IntermediateList.append(frozenset([k]))\n realCardinality[frozenset([k])] = relationData[k].shape[0]\n for k in g.tableNames:\n dfs(frozenset([k]), relationData[k], g, relationData, realCardinality, IntermediateList)\n\n for k in IntermediateList:\n logger.debug(\"caculateRealCardinality realCardinality of {}: {}\\n\", k, realCardinality[k])\n\n with open('./data/realCardinality/'+prefix+'.realCardinality', 'wb') as f:\n pickle.dump(realCardinality, f)\n\n\n\n\ndef dfs(s_in, s_in_data, g, relationData, realCardinality, IntermediateList):\n # logger.debug(\"sleeping...\")\n # time.sleep(15)\n assert isinstance(realCardinality, dict) and isinstance(IntermediateList, list)\n if len(s_in) >= MaxJoinSize:\n return\n neighbors = g.getNeighbors(s_in)\n for nei in neighbors:\n s_out = set(s_in)\n s_out.add(nei)\n s_out = frozenset(s_out)\n if s_out in realCardinality.keys():\n continue\n #计算s_out:\n #找到和nei连接的表\n for r in s_in:\n if len(g.joinCondition[r][nei]) <= 0:\n continue\n #找到连接,做join,选择xxx_id的列\n fields = g.joinCondition[r][nei][0]\n logger.debug(\"join {} with {} on {}\", s_in, nei, fields)\n if fields[0] == 'id':\n s_out_data = s_in_data.join(relationData[nei].set_index(nei + '.' + fields[1]), on = (r + '.' + fields[0]), how = 'inner')\n #s_out_data = pd.merge(s_in_data, relationData[nei], left_on=r + '.' + fields[0], right_on=nei + '.' + fields[1], how = \"inner\")\n #s_out_data = pd.concat()\n #pd.concat(df1.reset_index(drop = True), df2.reindex(df1['a'].values).reset_index(drop = Ture),axis=1)\n else: \n s_out_data = relationData[nei].join(s_in_data.set_index(r + '.' + fields[0]), on=(nei + '.' + fields[1]), how = 'inner')\n # s_out_data = pd.merge(s_in_data, relationData[nei], left_on=r + '.' + fields[0], right_on=nei + '.' + fields[1], how = \"inner\")\n logger.debug(\" size: {}\\n\", s_out_data.shape[0])\n realCardinality[s_out] = s_out_data.shape[0]\n IntermediateList.append(s_out)\n dfs(s_out, s_out_data, g, relationData, realCardinality, IntermediateList)\n del s_out_data\n gc.collect()\n break\n gc.collect()\n\n\n# def caculateRealCardinality2_1(prefix, sql):\n# #检查是否已经计算过:\n# if prefix+'.realCardinality' in files:\n# logger.info(\"already caculated\\n\")\n# return\n\n# #获取选择执行后的单表数据\n# g = QueryGraph(sql)\n# relationData = dict()\n# for k in g.data.keys():\n# relationData[k] = g.data[k].df\n# for k in relationData.keys():\n# relationData[k] = performSelect(g, k, relationData[k])\n# del g.data\n# gc.collect()\n# #获取属性映射,1 - n\n# filedMappings = getFieldMapping(g)\n# #转化表数据,转化为多维向量和计数器的dataframe\n# for k in relationData.keys():\n# relationData[k] = relationData[k][filedMappings[k].keys()] #只保留连接属性\n# relationData[k] = relationData[k].rename(columns = filedMappings[k]) #重命名\n# cnt = dict()\n# tmplist = list(relationData[k].values())\n# m = relationData[k].shape[1]\n# for val in relationData[k].iterrows():\n# if val[0:m] not in cnt.keys():\n# cnt[val[0:m]] = 1\n# else cnt[val[0:m]] = cnt[val[0:m]] + 1\n# relationData[k].insert(0, 0, 1)#增加0维,代表计数,初始全为1\n# #枚举中间结果:\n# realCardinality = dict()\n# IntermediateSet = set()\n# for k in relationData.keys():\n# realCardinality[frozenset([k])] = relationData[k][0].sum()\n# IntermediateSet.add(frozenset[k]) \n# for k in relationData.keys():\n# pass\n\n# def dfsFor2_1(s_in, s_in_data, g, relationData, realCardinality, IntermediateSet):\n# assert isinstance(realCardinality, dict) and isinstance(IntermediateSet, set)\n# neighbors = g.getNeighbors(s_in)\n# for nei in neighbors:\n# s_out = set(s_in)\n# s_out.add(nei)\n# s_out = frozenset(s_out)\n# if s_out in IntermediateSet:\n# continue\n# joinFiled = [x for x in relationData[nei].columns if x in s_in_data.columns]\n# assert len(joinFiled) == 1 \n# joinFiled = joinFiled[0]\n# df1, df2 = (s_in_data, relationData[nei]) if s_in_data.shape[0] < relationData[nei].shape[0] else (relationData[nei], s_in_data)\n# for val in df1.itertuples():\n# dftmp = df2[df2[joinFiled] == val[joinFiled]]\n# dftmp[0] = dftmp[0] * val[0]\n\n \n\n \ndef getFieldMapping(g):\n fieldMappings = dict()\n for tname in g.tableNames:\n fieldMappings[tname] = dict()\n #遍历边,为边上属性做映射\n now = 1\n for tname1 in g.tableNames:\n for tname2 in g.tableNames:\n for edge in g.joinCondition[tname1][tname2]:\n f1 = edge[0], f2 = edge[1]\n x, y = f1 in fieldMappings[tname1].keys(), f2 in fieldMappings[tname2].keys()\n if not x and not y:\n fieldMappings[tname1][f1], fieldMappings[tname2][f2] = now, now\n now = now + 1\n elif x and not y:\n fieldMappings[tname2][f2] = fieldMappings[tname1][f1]\n elif not x and y:\n fieldMappings[tname1][f1] = fieldMappings[tname2][f2]\n return fieldMappings\n \n\n\n\n \n\n \nif __name__ == \"__main__\":\n logger.add(sink = \"./logs/4_10_log\", level=\"INFO\")\n sqls = dict()\n with open(\"./data/sqls.pkl\", 'rb') as f:\n sqls = pickle.load(f)\n \n for k, v in sqls.items():\n logger.info(\"caculateRealCardinality for {} begin...\\n\", k)\n #caculateRealCardinality(k, v)\n caculateRealCardinality1_1(k, v)\n gc.collect()\n logger.info(\"caculateRealCardinality for {} done\\n\", k)\n " }, { "alpha_fraction": 0.5419011116027832, "alphanum_fraction": 0.5561977028846741, "avg_line_length": 33.072540283203125, "blob_id": "912caae6815e7a573faf5fbeb6949419bbcdacf4", "content_id": "de2192b4c5f1f0fe2a7a5f16def8dc745ee352ef", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 6815, "license_type": "no_license", "max_line_length": 159, "num_lines": 193, "path": "/data_process.py", "repo_name": "bensanhuan/join_sampling", "src_encoding": "UTF-8", "text": "from QueryGraph import *\nfrom loguru import logger\nimport matplotlib.pyplot as plt\nimport networkx as nx\nimport glob\nimport pandas as pd\nimport pickle\nimport os\nimport re\nimport math\n\npreSamplePercentages = {\n 'cast_info': 0.0135,\n 'movie_info': 0.03,\n 'movie_keyword': 0.11,\n 'name': 0.12,\n 'char_name': 0.16,\n 'person_info': 0.175,\n 'movie_companies': 0.19,\n 'title': 0.2,\n 'move_info_idx':0.38,\n 'aka_name': 0.55\n}\n\n\npkl_sampled_loc = 'data/pkl/'\npkl_unSampled_loc = 'data/pkl-unSample/'\nunSampledRelationPkl = dict()\n#载入pkl数据\ndef load_pickle(name, useSampledPkl):\n \"\"\" Load the given CSV file only \"\"\"\n global unSampledRelationPkl\n if useSampledPkl:\n df = pd.read_pickle(pkl_sampled_loc + name + '.pkl')\n else:\n if name not in unSampledRelationPkl.keys():\n unSampledRelationPkl[name] = pd.read_pickle(pkl_unSampled_loc + name + '.pkl')\n df = unSampledRelationPkl[name]\n return df\n\n#将csv原数据导入pkl数据,由于数据过多,先提前进行采样\ndef loadPklWithSample():\n #load csv\n #从csv_schema.txt解析csv文件格式\n columns = dict()\n with open('./data/csv_schema.txt', 'r') as f:\n lines = f.readlines()\n for l in lines:\n l = l.replace('\\n', '').split(',')\n columns[l[0]] = l[1:]\n logger.info(\"columns: {}\", columns)\n csvPath = \"./data/csv/\"\n pklPath = \"./data/pkl/\"\n for k, v in columns.items():\n logger.info(\"begin to create pkl for {}\", k)\n df = pd.read_csv(csvPath + k + '.csv', header = None, escapechar = '\\\\', names = v)\n if k in preSamplePercentages.keys():\n #执行预采样 \n logger.info(\"orgin size: {} ,sample goal size: {}\", df.shape[0],int(preSamplePercentages[k] * df.shape[0]))\n df = df.sample(int(preSamplePercentages[k] * df.shape[0]))\n #存储\n df.to_pickle(pklPath + k + '.pkl')\n logger.info(\"{}.pkl has saved\", k)\n\n#我内存好像完全hold的住\ndef loadPklWithoutSample():\n #load csv\n #从csv_schema.txt解析csv文件格式\n columns = dict()\n with open('./data/csv_schema.txt', 'r') as f:\n lines = f.readlines()\n for l in lines:\n l = l.replace('\\n', '').split(',')\n columns[l[0]] = l[1:]\n logger.info(\"columns: {}\", columns)\n csvPath = \"./data/csv/\"\n pklPath = \"./data/pkl-unSample/\"\n for k, v in columns.items():\n logger.info(\"begin to create pkl for {}\", k)\n df = pd.read_csv(csvPath + k + '.csv', header = None, escapechar = '\\\\', names = v)\n #存储\n df.to_pickle(pklPath + k + '.pkl')\n logger.info(\"{}.pkl has saved\", k)\n\n#试一下占用多少内存\ndef loadAllPkl():\n columns = dict()\n with open('./data/csv_schema.txt', 'r') as f:\n lines = f.readlines()\n for l in lines:\n l = l.replace('\\n', '').split(',')\n columns[l[0]] = l[1:]\n logger.info(\"columns: {}\", columns)\n pklPath = \"./data/pkl-unSample/\"\n dfs = list()\n for k, _ in columns.items():\n dfs.append(pd.read_pickle(pklPath + k + \".pkl\"))\n _ = input(\"load done....\")\n\n#绘制queryGraph图片,用于观察查询结构。结论:优化后都是树状\ndef paintGraphForSql():\n sql_dir=\"data/join-order-benchmark\"\n files_match = sql_dir+\"/[0-9]*.sql\"\n files = glob.glob(files_match)\n for file in files:\n with open(file, 'r') as f:\n sql = f.read().replace(\"\\n\", \" \")\n logger.info(\"begin draw for {}\", sql)\n ss = file.split('/')[2].split('.')[0]\n sql = sql.replace(';','')\n qg = QueryGraph(sql, True)\n plt.clf()\n g = nx.Graph()\n nameid = dict()\n id = 1\n for name in qg.tableNames:\n nameid[name] = id\n g.add_node(id)\n id += 1\n for aname in qg.tableNames:\n for bname in qg.tableNames:\n for x in qg.joinCondition[aname][bname]:\n g.add_edge(nameid[aname], nameid[bname])\n nx.draw(g, with_labels = True)\n plt.savefig('./data/query_graph_img/qg_' + ss + '.png')\n logger.info(\"save {},img\", ss)\n\n\n#将job查询转换成不带分号的一行字符串写入sqls.pkl\n#dict[file_prefix] = str(sql)\ndef processJOBsql():\n #outFile = \"./data/query_sql_processed\"\n sqlFilePath = \"./data/join-order-benchmark/\"\n sqlFileMatch = sqlFilePath + \"/[0-9]*.sql\"\n files = glob.glob(sqlFileMatch)\n sqlsPkl = dict()\n #with open(outFile, 'w') as outfile:\n for file in files:\n with open(file, 'r') as f:\n sql = f.read().replace(\"\\n\", \" \").replace(\";\",\"\")\n sqlsPkl[file.split('/')[3].split('.')[0]] = sql\n #outfile.write(sql+\"\\n\") \n logger.info(\"dict: {}\", sqlsPkl)\n with open('./data/sqls.pkl', 'wb') as f:\n pickle.dump(sqlsPkl, f)\n\n#计算estimateCardinality和realCardinality的误差并可视化\ndef DrawResults(MaxJoinSize, sampleSize, budget, ReSampleThreshold):\n pattern = '_maxJoinSize_' + str(MaxJoinSize) + '_sampleSize_' + str(sampleSize) + '_budget_' + str(budget) + '_reSampleThreshold_' + str(ReSampleThreshold)\n esfiles = os.listdir('./data/estimateCardinality/')\n realfiles = os.listdir('./data/realCardinality/')\n realCar, esCar = dict(), dict()\n for f in esfiles:\n #logger.debug(\"{} {}\", f, pattern)\n if re.search(pattern, f):\n with open('./data/estimateCardinality/' + f, 'rb') as ff:\n esCar[f.split('_')[0]] = pickle.load(ff)\n for f in realfiles:\n with open('./data/realCardinality/'+f, 'rb') as ff:\n realCar[f.split('.')[0]] = pickle.load(ff)\n #logger.debug(\"esCar keys: {}\\n realCar keys(): {}\", esCar.keys(), realCar.keys())\n\n ratio = dict()\n for i in range(1, MaxJoinSize + 1):\n ratio[i] = list()\n for k in realCar.keys():\n if k == '16d':\n continue\n assert k in esCar.keys()\n for y in realCar[k].keys():\n x = round(esCar[k][y]/ realCar[k][y], 2) if realCar[k][y] != 0 else round(esCar[k][y], 2)\n ratio[len(y)].append(x)\n ratioList = [ratio[i] for i in range(1, MaxJoinSize + 1)]\n for i in range(len(ratioList)):\n for j in range(len(ratioList[i])):\n if ratioList[i][j] != 0:\n ratioList[i][j] = math.log(ratioList[i][j], 10)\n labels = [x for x in range(1, MaxJoinSize + 1)]\n plt.clf()\n plt.figure(figsize=(10,5))\n plt.title(\" index-based (no budget) \", fontsize = 20)\n plt.boxplot(ratioList, labels=labels)\n plt.grid(axis=\"y\")\n plt.show()\n\n #return ratio\n \n \n\n\nif __name__ == \"__main__\":\n #processJOBsql() \n DrawResults(6, 1000,10000000000000,100)" }, { "alpha_fraction": 0.5788423418998718, "alphanum_fraction": 0.582335352897644, "avg_line_length": 29.378787994384766, "blob_id": "c98bffe959694f6cd1bf5b3e561a1c89398a0eed", "content_id": "e1912b7ae2bd0251a7d8e749dabf2d82605d0a2e", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2126, "license_type": "no_license", "max_line_length": 78, "num_lines": 66, "path": "/QueryGraph_test.py", "repo_name": "bensanhuan/join_sampling", "src_encoding": "UTF-8", "text": "from QueryGraph import *\nfrom loguru import logger\nimport matplotlib.pyplot as plt\nimport pickle\n\n##Usage:run \"pytest\" in terminal\n##if only test one method: pytest -v filePath::className::methodName\n\n# pdb调试usage速查:\n# 进入: python3 -m pdb filename.py\n# 添加断点: b (filename::)lineNumber 临时添加断点: tbreak lineNumber 清楚断点: cl lineNumber\n# 继续执行: c\n# 打印变量值: p expression\n# 执行下一行: 进入函数体: s; 不进入函数体: n\n# 打印变量类型: whatis expression\n# 打印堆栈信息: w\n# 退出: q\n\n\n\ndef test_joinConditionGen():\n sqlPath=\"data/join-order-benchmark/13d.sql\"\n logger.add(\"test_log\")\n with open(sqlPath, 'r') as f:\n sql = f.read().replace(\"\\n\", \" \")\n logger.debug(\"{}\",parse(sql))\n logger.debug(\"sql: {}\", sql)\n logger.info(\"begin draw for {}\", sql)\n sql = sql.replace(';','')\n qg = QueryGraph(sql, True) \n\n\ndef test_getNeighbors():\n logger.add(\"test_log\")\n sqls = list()\n with open(\"./data/sqls.pkl\", 'rb') as f:\n sqls = pickle.load(f)\n logger.debug(\"sqls number {}\", len(sqls))\n for k, sql in sqls.items():\n logger.debug(\"test for sql: {}\\n sql:{}\\n\", k, sql)\n g = QueryGraph(sql, True)\n for tname in g.tableNames:\n r = g.getNeighbors(tname)\n logger.info(\"{} has neighbors:{}\\n\", tname, r)\n return\n\ndef test_singleTableSelectPerform():\n logger.add(\"test_log\")\n sqls = list()\n with open(\"./data/sqls.pkl\", 'rb') as f:\n sqls = pickle.load(f)\n logger.debug(\"sqls number {}\", len(sqls))\n for k, sql in sqls.items():\n #sql = sqls['30a']\n logger.debug(\"test for sql: {}\\n sql:{}\\n\", k, sql)\n queryg = QueryGraph(sql)\n for tname, relation in queryg.data.items():\n logger.debug(\"perform select for {}\", tname)\n tmpdf = performSelect(queryg, tname, relation.df)\n logger.debug(\"size {}, {}\", relation.df.shape[0], tmpdf.shape[0])\n return\n \n \n\nif __name__ == \"__main__\":\n test_singleTableSelectPerform()" }, { "alpha_fraction": 0.5836202502250671, "alphanum_fraction": 0.596409261226654, "avg_line_length": 42.212764739990234, "blob_id": "7d89d690b1459e09a01523d60ceebd9d0849fcf2", "content_id": "a95a895cc6da8b16637bc187b6fa5e07038666ee", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 8502, "license_type": "no_license", "max_line_length": 165, "num_lines": 188, "path": "/IndexSample.py", "repo_name": "bensanhuan/join_sampling", "src_encoding": "UTF-8", "text": "from QueryGraph import *\nimport math\nimport random\nimport util\nimport pandas as pd\nimport gc\nfrom loguru import logger\nimport pickle\nimport os\n#NOTICE:属性名加了前缀后如果要使用performSelect方法需要删去前缀\n#动态规划采样计算中间结果\n#为了节约内存,使用dfs\n\n#sampleSize:采样数, samplesNum:样本数量\nMaxJoinSize = 6\nReSampleThreshold = 100\nsampleSize = 1000\nBUDGET = 10000000000000\ndef IndexSample(sql, budget, sampleSize):\n global BUDGET\n logger.debug(\"IndexSample for {}, budget:{}, sampleSize:{}\", sql, budget, sampleSize)\n BUDGET = budget\n g = QueryGraph(sql)\n samples = dict()\n estimateCardinality = dict()\n #为每个表只留下筛选相关和连接相关属性:\n Fileds = onlyFilterJoinFileds(g)\n RelationData = dict()\n for tname in g.tableNames:\n RelationData[tname] = g.data[tname].df[Fileds[tname]]\n #给属性名加上表名前缀防止重复\n for k in RelationData.keys():\n RelationData[k] = util.addPrefix(RelationData[k], k)\n #给每个表采样\n for tname in g.tableNames:\n tableSize = RelationData[tname].shape[0]\n n = min(sampleSize, RelationData[tname].shape[0])\n fs = frozenset([tname])\n samples[fs] = RelationData[tname].sample(n)\n #执行单表选择(需要移除属性前缀,和重新添加前缀)\n samples[fs] = util.addPrefix(performSelect(g, tname, util.dropPrefix(samples[fs])), tname)\n samples[fs] = samples[fs].reset_index(drop = True)\n BUDGET -= n\n estimateCardinality[fs] = estimateSingle(tableSize, n, samples[fs].shape[0])\n logger.debug(\"estimateCardinality of {}: {}\", tname, estimateCardinality[fs])\n #计算中间结果\n IntermediateSizeDict = dict()\n for tname in g.tableNames:\n IntermediateSizeDict[frozenset([tname])] = estimateCardinality[frozenset([tname])]\n for k in g.tableNames:\n dfs(frozenset([k]), samples[frozenset([k])], g, RelationData, sampleSize, estimateCardinality, IntermediateSizeDict)\n return estimateCardinality\n \ndef dfs(s_in, s_in_data, g, RelationData, sampleSize, estimateCardinality, IntermediateSizeDict):\n assert isinstance(estimateCardinality, dict) and isinstance(IntermediateSizeDict, dict)\n global BUDGET\n\n if len(s_in) >= MaxJoinSize:\n return\n neighbors = g.getNeighbors(s_in)\n for nei in neighbors:\n s_out = set(s_in)\n s_out.add(nei)\n s_out = frozenset(s_out)\n if s_out in IntermediateSizeDict.keys() and IntermediateSizeDict[s_out] >= ReSampleThreshold :\n continue\n #计算s_out:\n #找到和nei连接的表\n for r in s_in:\n if len(g.joinCondition[r][nei]) <= 0:\n continue\n #采样neiData并filter\n neiData = RelationData[nei]\n f1, f2 = r + '.' + g.joinCondition[r][nei][0][0], nei + '.' + g.joinCondition[r][nei][0][1]\n logger.debug(\"join {} with {} on {}, {}\", s_in, nei, f1, f2)\n if s_in_data.shape[0] > 0:\n indexList = dict()\n #获取nei上能匹配的数据索引\n totalMatch = 0\n for index, val in s_in_data.iterrows():\n indexList[index] = neiData[neiData[f2] == val[f1]].index.values.tolist()\n totalMatch += len(indexList[index])\n #确认采样的索引并排序\n samplePos = random.sample(range(totalMatch), min(totalMatch, sampleSize))\n samplePos.sort()\n #计算s_out_data \n s_out_data = list()\n index, l, r= 0, 0, len(indexList[0])\n joinData = list()\n posList , y= list(),list()\n for x in samplePos:\n while x - l >= r:\n l = l + len(indexList[index])\n index = index + 1\n r = len(indexList[index])\n posList.append(indexList[index][x -l])\n y.append(index)\n #joinData.append(neiData.iloc[indexList[index][x -l]].tolist() + [index])\n joinData = neiData.loc[posList]\n joinData[nei + '.' + 'index'] = y \n joinData = util.dropPrefix(joinData)\n joinData = performSelect(g, nei, joinData)\n joinData = joinData.set_index('index')\n joinData = util.addPrefix(joinData, nei)\n else:\n totalMatch = 0\n newColumns = neiData.columns.tolist()\n newColumns.append('index')\n joinData = (pd.DataFrame([], columns = newColumns)).set_index('index')\n\n s_out_data = s_in_data.join(joinData, how = 'inner').reset_index(drop = True)\n IntermediateSizeDict[s_out] = s_out_data.shape[0]\n estimateCardinality[s_out] = estimateJoin(s_in_data.shape[0], estimateCardinality[s_in], totalMatch, min(totalMatch, sampleSize), joinData.shape[0])\n logger.debug(\"estimateCardinality of {}: {}\", s_out, estimateCardinality[s_out])\n BUDGET = BUDGET - s_in_data.shape[0] - min(totalMatch, sampleSize)\n del joinData, neiData\n dfs(s_out, s_out_data, g, RelationData, sampleSize, estimateCardinality, IntermediateSizeDict)\n del s_out_data\n break\n gc.collect()\n\n\ndef onlyFilterJoinFileds(g):\n fileds = dict()\n for tname1 in g.tableNames:\n fileds[tname1] = list()\n for tname2 in g.tableNames:\n for val in g.joinCondition[tname1][tname2]:\n fileds[tname1].append(val[0])\n for tname in g.tableNames:\n fileds[tname] = fileds[tname] + g.selectFileds[tname]\n for tname in g.tableNames:\n fileds[tname] = list(set(fileds[tname]))\n return fileds\n\ndef estimateSingle(tableSize, sampleSize, samplesNum):\n #为单表估算基数\n #tableSize: size of origin table\n #sampleSize: sample times\n #samplesNum: Effective sample size\n #kartz backoff处理零概率问题(超级简化版)\n sampleSize, samplesNum = max(1, sampleSize), max(1, samplesNum)\n return tableSize * samplesNum / sampleSize\n\ndef estimateJoin(inSamplesNum, InEstimate, totalMatch, sampleSize, samplesNum):\n #为两表join估算结果基数\n \n inSamplesNum, totalMatch, sampleSize, samplesNum = max(inSamplesNum, 1), max(totalMatch, 1), max(sampleSize, 1), max(samplesNum, 1)\n return InEstimate * totalMatch / inSamplesNum * samplesNum / sampleSize\n\nif __name__ == \"__main__\":\n files = os.listdir(\"./data/estimateCardinality\")\n logger.remove()\n logger.add(sink = \"./logs/4_15_IndexSample_log\", level=\"INFO\")\n logger.info(\"\\n\\n-------------------------begin-----------------------\\n\")\n sqls = dict()\n with open(\"./data/sqls.pkl\", 'rb') as f:\n sqls = pickle.load(f)\n \n skipSqls = [\"17a\", \"17b\", \"17c\", \"17d\", \"17e\", \"17f\", \"16a\", \"16b\", \"16c\", \"16d\"]\n strtemp = \"maxJoinSize_\" + str(MaxJoinSize) + \"_sampleSize_\" + str(sampleSize) + \"_budget_\" + str(BUDGET) + \"_reSampleThreshold_\" + str(ReSampleThreshold)\n filePath = \"data/results/IndexSample/\" +strtemp+\".ratio\"\n i = 0\n for k, v in sqls.items():\n if k in skipSqls:\n continue\n i= i + 1\n filePathOfes = \"data/estimateCardinality/\"+k+\"_\" + strtemp+\".estimateCardinality\"\n if k+\"_\" + strtemp+\".estimateCardinality\" in files:\n continue\n logger.info(\"begin indexSample for {}:\", k)\n estimateCardinality = IndexSample(v, 10000000000, 1000)\n with open(filePathOfes, 'wb') as f:\n pickle.dump(estimateCardinality, f)\n realCardinality = dict()\n with open(\"./data/realCardinality/\" + k + \".realCardinality\", 'rb') as f:\n realCardinality = pickle.load(f)\n #logger.info(\"begin compare real / estimate cardinality.............................\\n\")\n ratioList = list()\n for key in estimateCardinality.keys():\n #logger.info(\"{}, real: {}, estimate: {}, ratio:{} \", key, realCardinality[key], estimateCardinality[key], estimateCardinality[key]/realCardinality[key])\n if realCardinality[key] == 0:\n ratioList.append(1)\n else:\n ratioList.append(round(estimateCardinality[key]/realCardinality[key], 2))\n logger.info(\"ratios: {}\\n\", ratioList)\n with open(filePath, 'wb') as f:\n pickle.dump(ratioList, f)\n " }, { "alpha_fraction": 0.782608687877655, "alphanum_fraction": 0.782608687877655, "avg_line_length": 10.5, "blob_id": "78c40f3b7fac73a7d74e1cf95ae781d75b6762c2", "content_id": "bd370b309f238713ae12d6dfc712a9684fcfe730", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 35, "license_type": "no_license", "max_line_length": 15, "num_lines": 2, "path": "/README.md", "repo_name": "bensanhuan/join_sampling", "src_encoding": "UTF-8", "text": "# join_sampling\n我的毕业设计\n" }, { "alpha_fraction": 0.5120565891265869, "alphanum_fraction": 0.5215529203414917, "avg_line_length": 42.10040283203125, "blob_id": "873893753025f5ca72ea96e2b1cc76e2a978de63", "content_id": "a9c79082fa29e21c4fd12c10bba2bbba08c4f519", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 11257, "license_type": "no_license", "max_line_length": 155, "num_lines": 249, "path": "/QueryGraph.py", "repo_name": "bensanhuan/join_sampling", "src_encoding": "UTF-8", "text": "# -*- coding: utf-8 -*-\nfrom moz_sql_parser import parse\nimport util\nfrom loguru import logger\nimport data_process\nimport pandas as pd\n#FIXME: fixme usage sample\n#是否采用预采样后的pickel\nuseSampledPkl = False\n#QueryGraph类:内部加载原表数据,解析sql语句生成graph。对外部提供join关系结构,原数据,对一张表的子集执行单表选择的能力。\nclass QueryGraph:\n def __init__(self, sql, justGenJoinCondition = False):\n #输入sql语句,自动初始化\n pSql = parse(sql)\n self.tableMapping = util.GetTableMapping(pSql)\n tableNames = []\n for k, _ in self.tableMapping.items():\n tableNames.append(k)\n logger.debug(\"tableNames: {}\", tableNames)\n tableNames = list(set(tableNames))\n self.tableNames = tableNames\n \n self.joinCondition = dict()\n for tname in tableNames:\n self.joinCondition[tname] = dict()\n for tname2 in tableNames:\n self.joinCondition[tname][tname2] = []\n \n #处理joinCondition\n #1.可能存在and,如果and,join条件必不可能嵌套\n joinDesList = []\n if util.s_and in pSql[util.s_where].keys():\n for d in pSql[util.s_where][util.s_and]:\n if util.s_eq in d.keys():\n if util.IsJoinDes(d[util.s_eq]):\n joinDesList.append(d[util.s_eq]) \n else:\n if util.IsJoinDes(pSql[util.s_where][util.s_eq]):\n joinDesList.append(pSql[util.s_where][util.s_eq])\n for joindes in joinDesList:\n self._addEdge(joindes)\n #优化joinCondition,eg: a.id = b.aid & a.id = c.aid & b.aid = c.aid,只需要保留任意两个等式\n #对每一个顶点,按照连接属性归类,对于id属性类中(强依赖sql语句的特点),如果一对顶点存在额外的连接,删除\n for tname in tableNames:\n #遍历所有连接, filedConnect = dict[filedName]list[(tablename, filedname)]\n fieldConnect = dict()\n for otname in tableNames:\n for edge in self.joinCondition[tname][otname]:\n if edge[0] not in fieldConnect:\n fieldConnect[edge[0]] = list()\n fieldConnect[edge[0]].append((otname, edge[1]))\n #检查连接是否有额外连接,并清除\n if 'id' not in fieldConnect.keys():\n continue\n v = fieldConnect['id']\n sz = len(v)\n for i in range(0, sz):\n for j in range(0, sz):\n if i == j:\n continue\n x, y = v[i], v[j]\n if (x[1], y[1]) in self.joinCondition[x[0]][y[0]]:\n self.joinCondition[x[0]][y[0]].remove((x[1], y[1]))\n if (y[1], x[1]) in self.joinCondition[y[0]][x[0]]:\n self.joinCondition[y[0]][x[0]].remove((y[1], x[1]))\n\n\n if justGenJoinCondition == True:\n return\n\n #读取数据\n self.data = dict()\n for name in tableNames:\n self.data[name] = Relation(self.tableMapping[name])\n #筛选出单表选择条件 dict[表名]list[单表选择条件]\n #前提条件,sql语句中被括号括起来的where语句都是针对一个表的\n self.selectDes = dict()\n whereDict = pSql[util.s_where]\n for key, value in whereDict.items():\n if util.isAndOr(key):\n for condition in value:\n if isinstance(condition, dict) and util.s_eq in condition.keys() and util.IsJoinDes(condition[util.s_eq]):\n #是两表join条件\n continue\n tname=self._GetTableNameFromSelect(condition)\n if tname not in self.selectDes.keys():\n self.selectDes[tname] = []\n self.selectDes[tname].append(condition)\n else:\n if key == util.s_eq and util.IsJoinDes(value):\n continue\n else:\n tname = self._GetTableNameFromSelect({key:value})\n #整理select属性集合:\n self.selectFileds = dict()\n for tname in self.tableNames:\n self.selectFileds[tname] = list()\n for k, v in self.selectDes.items():\n for desc in v:\n self.selectFileds[self._GetTableNameFromSelect(desc)] = self.selectFileds[self._GetTableNameFromSelect(desc)] + self._getSelectFileds(desc)\n for tname in self.tableNames:\n self.selectFileds[tname] = list(set(self.selectFileds[tname]))\n\n def _addEdge(self, joindes):\n t1, t2 = joindes[0].split('.')[0],joindes[1].split('.')[0]\n assert t1 in self.tableNames and t2 in self.tableNames\n f1, f2 = joindes[0].split('.')[1], joindes[1].split('.')[1]\n self.joinCondition[t1][t2].append((f1, f2))\n self.joinCondition[t2][t1].append((f2, f1))\n \n def _GetTableNameFromSelect(self, condition):\n assert len(condition) > 0\n if isinstance(condition, list):\n return self._GetTableNameFromSelect(condition[0])\n \n for key, value in condition.items():\n if util.isAndOr(key):\n return self._GetTableNameFromSelect(value)\n elif isinstance(value, list):#可能是not null这种情况\n return value[0].split('.')[0]\n else:\n return value.split('.')[0]\n\n def getNeighbors(self, tnames):\n assert isinstance(tnames, frozenset)\n neighbors = list()\n for tname in tnames:\n assert tname in self.joinCondition.keys()\n for k, v in self.joinCondition[tname].items():\n if len(v) > 0 and k not in tnames and k not in neighbors:\n neighbors.append(k)\n return neighbors\n\n def _getSelectFileds(self, desc):\n assert isinstance(desc, dict)\n results = list()\n logger.debug(\"_getSelectFileds of {}\", desc)\n for k, v in desc.items():\n if k == util.s_and or k == util.s_or:\n for subDes in v:\n results = results + self._getSelectFileds(subDes)\n else:\n field = ''\n if isinstance(v, list):\n field = v[0].split('.')[1]\n else:\n field = v.split('.')[1]\n results.append(field)\n #去重\n results = list(set(results))\n return results\nclass Relation:\n def __init__(self, relationName):\n self.relationName = relationName\n self.df = data_process.load_pickle(relationName, useSampledPkl) \n # self.estimateSize = self.df.shape[0]\n # if useSampledPkl: \n # if relationName in data_process.preSamplePercentages.keys():\n # self.estimateSize = self.estimateSize / data_process.preSamplePercentages[relationName]\n\n#输入querygraph、tablename,dataframe of table\n\ndef performSelect(G, tablename, df):\n assert tablename in G.data.keys()\n beforeSize = df.shape[0]\n if tablename not in G.selectDes.keys():\n logger.debug(\"performSelect on {}, beforeSize: {}, afterSize: {}\\n\", tablename, beforeSize, df.shape[0])\n return df\n for desc in G.selectDes[tablename]:\n df = _performSelect(df, desc)\n logger.debug(\"performSelect on {}, beforeSize: {}, afterSize: {}\\n\", tablename, beforeSize, df.shape[0])\n return df\n\ndef _performSelect(df, desc):\n assert isinstance(desc, dict)\n logger.debug(\"desc: {}\", desc)\n for key, value in desc.items():\n if key == util.s_and:\n #递归结果做交集\n tempdfs = [_performSelect(df, subDes) for subDes in value]\n retdf = tempdfs[0]\n for i in range(1, len(tempdfs)):\n retdf = pd.merge(retdf, tempdfs[i], how = 'inner')\n return retdf\n elif key == util.s_or:\n tempdfs = [_performSelect(df, subDes) for subDes in value]\n retdf = tempdfs[0]\n for i in range(1, len(tempdfs)):\n retdf = pd.merge(retdf, tempdfs[i], how = 'outer')\n \n return retdf\n else:\n field = ''\n if isinstance(value, list):\n field = value[0].split('.')[1]\n else:\n field = value.split('.')[1]\n if key == util.s_between:\n l, r = 0,0\n if isinstance(value[1], dict):\n l, r = min(value[1][util.s_literal], value[2][util.s_literal]), max(value[1][util.s_literal], value[2][util.s_literal])\n else:\n l, r = min(value[1], value[2]), max(value[1], value[2])\n return df[ (df[field] < r) & (df[field] > l)]\n elif key == util.s_like:\n pattern = value[1][util.s_literal].replace(\"%\", \".*\")\n return df[df[field].str.match(pattern) & df[field].notna()]\n elif key == util.s_not_like:\n pattern = value[1][util.s_literal].replace(\"%\", \".*\")\n pattern = '^((?!' + pattern + ').)*$'\n return df[df[field].str.match(pattern) & df[field].notna()]\n elif key == util.s_is_null:\n return df[df[field].isna()]\n elif key == util.s_is_not_null:\n return df[df[field].notna()]\n elif key == util.s_eq:\n if isinstance(value[1], dict):\n logger.debug(\"value:{}\", value)\n return df[df[field] == value[1][util.s_literal]]\n return df[df[field] == value[1]]\n elif key == util.s_neq:\n if isinstance(value[1], dict):\n return df[df[field] != value[1][util.s_literal]]\n return df[df[field] != value[1]]\n elif key == util.s_gt:\n if isinstance(value[1], dict):\n return df[df[field] > value[1][util.s_literal]]\n return df[df[field] > value[1]]\n elif key == util.s_lt:\n if isinstance(value[1], dict):\n return df[df[field] < value[1][util.s_literal]]\n return df[df[field] < value[1]]\n elif key == util.s_in:\n if isinstance(value[1], dict):\n inlist = value[1][util.s_literal]\n if isinstance(inlist, list) == False:#有的sql语句是IN('hhh')只有一个\n inlist = [inlist]\n return df[df[field].isin(inlist)]\n return df[df[field].isin(value[1])]\n elif key == util.s_gte:\n if isinstance(value[1], dict):\n return df[df[field] >= value[1][util.s_literal]]\n return df[df[field] >= value[1]]\n elif key == util.s_lte:\n if isinstance(value[1], dict):\n return df[df[field] <= value[1][util.s_literal]]\n return df[df[field] <= value[1]]\n else:\n logger.error(\"Unkown sql parse slice: {}, {}\", key, value)\n\n\n " } ]
8
Mcclares/Alien_Invasion_Python
https://github.com/Mcclares/Alien_Invasion_Python
0f1df8ff7b80256f431539927e6147263ecec56f
66bcd696868802711a43145ea65f71d6bd096acf
08c42560079beefaf36c4e31822be62714e2f96d
refs/heads/main
2023-08-12T21:37:24.476707
2021-10-11T10:55:22
2021-10-11T10:55:22
412,131,366
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.6526073813438416, "alphanum_fraction": 0.6541411280632019, "avg_line_length": 28.89655113220215, "blob_id": "ba6172c5614a828c6b67eaef255ea2d11ff453db", "content_id": "4afa2347a4f9e87aa5cfc6e0e303dcd3bde076b6", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2608, "license_type": "no_license", "max_line_length": 72, "num_lines": 87, "path": "/game_functions.py", "repo_name": "Mcclares/Alien_Invasion_Python", "src_encoding": "UTF-8", "text": "import sys\nimport pygame\nfrom pygame import key\nfrom pygame.constants import K_q\nfrom bullet import Bullet\nfrom alien import Alien\n\ndef check_keydown_events(event,ship, ai_settings,screen, bullets):\n if event.key == pygame.K_RIGHT:\n ship.moving_right = True\n elif event.key == pygame.K_LEFT:\n ship.moving_left = True\n if event.key == pygame.K_UP:\n ship.moving_up = True\n elif event.key == pygame.K_DOWN:\n ship.moving_down = True\n elif event.key == pygame.K_SPACE:\n fire_bullet(ai_settings,screen,ship,bullets)\n elif event.key == pygame.K_q:\n sys.exit()\n\n\n\n\n\ndef fire_bullet(ai_settings, screen,ship,bullets):\n if len(bullets) < ai_settings.bullets_allowed:\n new_bullet = Bullet(ai_settings,screen,ship)\n bullets.add(new_bullet)\n\n\ndef check_keyup_events(event,ship):\n if event.key == pygame.K_RIGHT:\n ship.moving_right = False\n elif event.key == pygame.K_LEFT:\n ship.moving_left = False\n if event.key == pygame.K_UP:\n ship.moving_up = False\n elif event.key == pygame.K_DOWN:\n ship.moving_down = False\n\n\ndef Check_Events(ai_settings,screen,ship,bullets):\n for event in pygame.event.get():\n if event.type == pygame.QUIT:\n sys.exit()\n elif event.type == pygame.KEYDOWN:\n check_keydown_events(event,ship,ai_settings,screen,bullets)\n elif event.type == pygame.KEYUP:\n check_keyup_events(event,ship)\n\n\n\n\n\n\ndef Update_Screen(ai_settings, screen, ship, aliens, bullets):\n screen.fill(ai_settings.bg_color)\n for bullet in bullets.sprites():\n bullet.draw_bullet()\n ship.blitme()\n aliens.draw(screen)\n\n pygame.display.flip()\ndef Update_bullets(bullets) :\n bullets.update()\n for bullet in bullets.copy():\n if bullet.rect.bottom <= 0 :\n bullets.remove(bullet)\n\ndef create_fleet(ai_settings,screen,aliens) :\n alien = Alien(ai_settings, screen)\n number_aliens_x = get_number_aliens_x(ai_settings, alien.rect.width)\n\n for alien_number in range(number_aliens_x):\n create_alien(ai_settings,screen,aliens,alien_number)\n\ndef get_number_aliens_x(ai_settings,alien_width):\n available_space_x = ai_settings.screen_width - 2 * alien_width\n number_aliens_x = int(available_space_x / (2 * alien_width))\n return number_aliens_x\ndef create_alien(ai_settings, screen,aliens, alien_number):\n alien = Alien(ai_settings,screen)\n alien_width = alien.rect.width\n alien.x = alien_width + 2 * alien_width * alien_number\n alien.rect.x = alien.x\n aliens.add(alien)\n \n\n\n" }, { "alpha_fraction": 0.5805991291999817, "alphanum_fraction": 0.6019971370697021, "avg_line_length": 23.89285659790039, "blob_id": "03185c5c9c8772633e8753eb81e867375501f377", "content_id": "53bfb2adf5fe88da7d4cbe1f368eb4615be74f22", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 701, "license_type": "no_license", "max_line_length": 86, "num_lines": 28, "path": "/Cosmos.py", "repo_name": "Mcclares/Alien_Invasion_Python", "src_encoding": "UTF-8", "text": "from sys import pycache_prefix\nimport sys\nimport pygame as py\nfrom settings import Settings\n\n\ndef run():\n py.init()\n ai_settings = Settings()\n screen = py.display.set_mode((ai_settings.screen_width,ai_settings.screen_height))\n ship = py.image.load(\"images/kotik2.bmp\")\n ship.set_colorkey((255,255,255))\n rect = ship.get_rect()\n screen_rect = screen.get_rect()\n rect.centerx = screen_rect.centerx\n rect.centery = screen_rect.centery\n \n\n \n while(True):\n for event in py.event.get():\n if(event.type == py.QUIT):\n sys.exit()\n screen.fill((0,0,255))\n screen.blit(ship,rect)\n py.display.flip()\n\nrun()\n " }, { "alpha_fraction": 0.6804123520851135, "alphanum_fraction": 0.6804123520851135, "avg_line_length": 21.230770111083984, "blob_id": "09c7b33c062b70d02bf37f9f2684241bb9e5b256", "content_id": "29aa5c1b77f3c42d5f907741c3003c8f883465ec", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 582, "license_type": "no_license", "max_line_length": 86, "num_lines": 26, "path": "/Raketa.py", "repo_name": "Mcclares/Alien_Invasion_Python", "src_encoding": "UTF-8", "text": "from pygame import sprite\nfrom ship import Ship\nfrom settings import Settings\nimport pygame as py\nimport game_functions as gf\nfrom pygame.sprite import Group\n\n\ndef run_game() :\n py.init()\n ai_settings = Settings()\n screen = py.display.set_mode((ai_settings.screen_width,ai_settings.screen_height))\n ship = Ship(ai_settings,screen)\n bullets = Group()\n while True:\n gf.Check_Events(ai_settings,screen,ship,bullets)\n ship.update()\n gf.Update_bullets(bullets)\n\n gf.Update_Screen(ai_settings,screen,ship,bullets)\n\n\n \n \n\nrun_game()\n " }, { "alpha_fraction": 0.4710526168346405, "alphanum_fraction": 0.5131579041481018, "avg_line_length": 22.8125, "blob_id": "d26db0a8d638052faaa32f543951036ef0c2d52b", "content_id": "127d4363e090f35530a06e46594e74bb5c934fe4", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 380, "license_type": "no_license", "max_line_length": 44, "num_lines": 16, "path": "/pygam.py", "repo_name": "Mcclares/Alien_Invasion_Python", "src_encoding": "UTF-8", "text": "import pygame as py\nimport sys\n\ndef run_game():\n py.init()\n screen = py.display.set_mode((1200,800))\n while (True) :\n for event in py.event.get():\n if(event.type == py.QUIT):\n sys.exit()\n screen.fill((230,230,230))\n if(event.type == py.KEYDOWN):\n print(event.key)\n py.display.flip()\n\nrun_game()" } ]
4
zivid/zivid-python
https://github.com/zivid/zivid-python
74f3ca13c803e4b86ab0ef9a76db9ae35cb4fecf
747533c7df86fd77285fdbe871efb081eb49117f
79a90a986ab0ba3f8153dec751cb09ba308a7cf9
refs/heads/master
2023-08-25T16:07:03.762782
2023-08-16T13:33:15
2023-08-16T13:33:15
194,618,293
38
14
BSD-3-Clause
2019-07-01T07:05:37
2023-08-28T10:03:14
2023-09-01T14:43:07
Python
[ { "alpha_fraction": 0.7666553854942322, "alphanum_fraction": 0.7744335532188416, "avg_line_length": 42.485294342041016, "blob_id": "db376656366465408a3f1aabdf95143d15e29b6b", "content_id": "08bfab7b90e58f68c3047f374743d629067a2400", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 2957, "license_type": "permissive", "max_line_length": 78, "num_lines": 68, "path": "/src/Wrapper.cpp", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "#include <Zivid/Zivid.h>\n\n#include <ZividPython/DataModelWrapper.h>\n#include <ZividPython/Wrappers.h>\n\n#include <ZividPython/Calibration/Calibration.h>\n#include <ZividPython/CaptureAssistant.h>\n#include <ZividPython/DataModel.h>\n#include <ZividPython/Firmware.h>\n#include <ZividPython/InfieldCorrection/InfieldCorrection.h>\n#include <ZividPython/Matrix4x4.h>\n#include <ZividPython/Projection.h>\n#include <ZividPython/ReleasableArray2D.h>\n#include <ZividPython/ReleasableCamera.h>\n#include <ZividPython/ReleasableFrame.h>\n#include <ZividPython/ReleasableFrame2D.h>\n#include <ZividPython/ReleasablePointCloud.h>\n#include <ZividPython/ReleasableProjectedImage.h>\n#include <ZividPython/SingletonApplication.h>\n#include <ZividPython/Version.h>\n#include <ZividPython/Wrapper.h>\n\n#include <pybind11/pybind11.h>\n\nZIVID_PYTHON_MODULE // NOLINT\n{\n module.attr(\"__version__\") = pybind11::str(ZIVID_PYTHON_VERSION);\n\n using namespace Zivid;\n\n ZIVID_PYTHON_WRAP_NAMESPACE_AS_SUBMODULE(module, DataModel);\n\n ZIVID_PYTHON_WRAP_DATA_MODEL(module, Settings);\n ZIVID_PYTHON_WRAP_DATA_MODEL(module, Settings2D);\n ZIVID_PYTHON_WRAP_DATA_MODEL(module, CameraState);\n ZIVID_PYTHON_WRAP_DATA_MODEL(module, CameraInfo);\n ZIVID_PYTHON_WRAP_DATA_MODEL(module, FrameInfo);\n ZIVID_PYTHON_WRAP_DATA_MODEL(module, CameraIntrinsics);\n\n ZIVID_PYTHON_WRAP_CLASS_AS_SINGLETON(module, Application);\n ZIVID_PYTHON_WRAP_CLASS_AS_RELEASABLE(module, Camera);\n ZIVID_PYTHON_WRAP_CLASS_AS_RELEASABLE(module, Frame);\n ZIVID_PYTHON_WRAP_CLASS_AS_RELEASABLE(module, Frame2D);\n ZIVID_PYTHON_WRAP_CLASS_AS_RELEASABLE(module, ProjectedImage);\n\n ZIVID_PYTHON_WRAP_CLASS_BUFFER(module, Matrix4x4);\n\n ZIVID_PYTHON_WRAP_CLASS_BUFFER_AS_RELEASABLE(module, ImageRGBA);\n ZIVID_PYTHON_WRAP_CLASS_BUFFER_AS_RELEASABLE(module, ImageBGRA);\n ZIVID_PYTHON_WRAP_CLASS_BUFFER_AS_RELEASABLE(module, PointCloud);\n\n ZIVID_PYTHON_WRAP_ARRAY2D_BUFFER_AS_RELEASABLE(module, ColorRGBA);\n ZIVID_PYTHON_WRAP_ARRAY2D_BUFFER_AS_RELEASABLE(module, ColorBGRA);\n ZIVID_PYTHON_WRAP_ARRAY2D_BUFFER_AS_RELEASABLE(module, NormalXYZ);\n ZIVID_PYTHON_WRAP_ARRAY2D_BUFFER_AS_RELEASABLE(module, PointXYZ);\n ZIVID_PYTHON_WRAP_ARRAY2D_BUFFER_AS_RELEASABLE(module, PointXYZW);\n ZIVID_PYTHON_WRAP_ARRAY2D_BUFFER_AS_RELEASABLE(module, PointZ);\n ZIVID_PYTHON_WRAP_ARRAY2D_BUFFER_AS_RELEASABLE(module, SNR);\n ZIVID_PYTHON_WRAP_ARRAY2D_BUFFER_AS_RELEASABLE(module, PointXYZColorRGBA);\n ZIVID_PYTHON_WRAP_ARRAY2D_BUFFER_AS_RELEASABLE(module, PointXYZColorBGRA);\n\n ZIVID_PYTHON_WRAP_NAMESPACE_AS_SUBMODULE(module, Firmware);\n ZIVID_PYTHON_WRAP_NAMESPACE_AS_SUBMODULE(module, Version);\n ZIVID_PYTHON_WRAP_NAMESPACE_AS_SUBMODULE(module, Calibration);\n ZIVID_PYTHON_WRAP_NAMESPACE_AS_SUBMODULE(module, CaptureAssistant);\n ZIVID_PYTHON_WRAP_NAMESPACE_AS_SUBMODULE(module, InfieldCorrection);\n ZIVID_PYTHON_WRAP_NAMESPACE_AS_SUBMODULE(module, Projection);\n}\n" }, { "alpha_fraction": 0.4423278272151947, "alphanum_fraction": 0.4461377263069153, "avg_line_length": 32.75884246826172, "blob_id": "573bf7c90c0c76ab52cb57b568beafaf6865bfc4", "content_id": "1ffc0fa5d410938aa74f7efbb151a4a9525f0300", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 20998, "license_type": "permissive", "max_line_length": 221, "num_lines": 622, "path": "/modules/zivid/settings_2d.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "\"\"\"Auto generated, do not edit.\"\"\"\n# pylint: disable=too-many-lines,protected-access,too-few-public-methods,too-many-arguments,line-too-long,missing-function-docstring,missing-class-docstring,redefined-builtin,too-many-branches,too-many-boolean-expressions\nimport datetime\nimport collections.abc\nimport _zivid\n\n\nclass Settings2D:\n class Acquisition:\n def __init__(\n self,\n aperture=_zivid.Settings2D.Acquisition.Aperture().value,\n brightness=_zivid.Settings2D.Acquisition.Brightness().value,\n exposure_time=_zivid.Settings2D.Acquisition.ExposureTime().value,\n gain=_zivid.Settings2D.Acquisition.Gain().value,\n ):\n if (\n isinstance(\n aperture,\n (\n float,\n int,\n ),\n )\n or aperture is None\n ):\n self._aperture = _zivid.Settings2D.Acquisition.Aperture(aperture)\n else:\n raise TypeError(\n \"Unsupported type, expected: (float, int,) or None, got {value_type}\".format(\n value_type=type(aperture)\n )\n )\n\n if (\n isinstance(\n brightness,\n (\n float,\n int,\n ),\n )\n or brightness is None\n ):\n self._brightness = _zivid.Settings2D.Acquisition.Brightness(brightness)\n else:\n raise TypeError(\n \"Unsupported type, expected: (float, int,) or None, got {value_type}\".format(\n value_type=type(brightness)\n )\n )\n\n if (\n isinstance(exposure_time, (datetime.timedelta,))\n or exposure_time is None\n ):\n self._exposure_time = _zivid.Settings2D.Acquisition.ExposureTime(\n exposure_time\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: (datetime.timedelta,) or None, got {value_type}\".format(\n value_type=type(exposure_time)\n )\n )\n\n if (\n isinstance(\n gain,\n (\n float,\n int,\n ),\n )\n or gain is None\n ):\n self._gain = _zivid.Settings2D.Acquisition.Gain(gain)\n else:\n raise TypeError(\n \"Unsupported type, expected: (float, int,) or None, got {value_type}\".format(\n value_type=type(gain)\n )\n )\n\n @property\n def aperture(self):\n return self._aperture.value\n\n @property\n def brightness(self):\n return self._brightness.value\n\n @property\n def exposure_time(self):\n return self._exposure_time.value\n\n @property\n def gain(self):\n return self._gain.value\n\n @aperture.setter\n def aperture(self, value):\n if (\n isinstance(\n value,\n (\n float,\n int,\n ),\n )\n or value is None\n ):\n self._aperture = _zivid.Settings2D.Acquisition.Aperture(value)\n else:\n raise TypeError(\n \"Unsupported type, expected: float or int or None, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n @brightness.setter\n def brightness(self, value):\n if (\n isinstance(\n value,\n (\n float,\n int,\n ),\n )\n or value is None\n ):\n self._brightness = _zivid.Settings2D.Acquisition.Brightness(value)\n else:\n raise TypeError(\n \"Unsupported type, expected: float or int or None, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n @exposure_time.setter\n def exposure_time(self, value):\n if isinstance(value, (datetime.timedelta,)) or value is None:\n self._exposure_time = _zivid.Settings2D.Acquisition.ExposureTime(value)\n else:\n raise TypeError(\n \"Unsupported type, expected: datetime.timedelta or None, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n @gain.setter\n def gain(self, value):\n if (\n isinstance(\n value,\n (\n float,\n int,\n ),\n )\n or value is None\n ):\n self._gain = _zivid.Settings2D.Acquisition.Gain(value)\n else:\n raise TypeError(\n \"Unsupported type, expected: float or int or None, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n def __eq__(self, other):\n if (\n self._aperture == other._aperture\n and self._brightness == other._brightness\n and self._exposure_time == other._exposure_time\n and self._gain == other._gain\n ):\n return True\n return False\n\n def __str__(self):\n return str(_to_internal_settings2d_acquisition(self))\n\n class Processing:\n class Color:\n class Balance:\n def __init__(\n self,\n blue=_zivid.Settings2D.Processing.Color.Balance.Blue().value,\n green=_zivid.Settings2D.Processing.Color.Balance.Green().value,\n red=_zivid.Settings2D.Processing.Color.Balance.Red().value,\n ):\n if (\n isinstance(\n blue,\n (\n float,\n int,\n ),\n )\n or blue is None\n ):\n self._blue = _zivid.Settings2D.Processing.Color.Balance.Blue(\n blue\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: (float, int,) or None, got {value_type}\".format(\n value_type=type(blue)\n )\n )\n\n if (\n isinstance(\n green,\n (\n float,\n int,\n ),\n )\n or green is None\n ):\n self._green = _zivid.Settings2D.Processing.Color.Balance.Green(\n green\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: (float, int,) or None, got {value_type}\".format(\n value_type=type(green)\n )\n )\n\n if (\n isinstance(\n red,\n (\n float,\n int,\n ),\n )\n or red is None\n ):\n self._red = _zivid.Settings2D.Processing.Color.Balance.Red(red)\n else:\n raise TypeError(\n \"Unsupported type, expected: (float, int,) or None, got {value_type}\".format(\n value_type=type(red)\n )\n )\n\n @property\n def blue(self):\n return self._blue.value\n\n @property\n def green(self):\n return self._green.value\n\n @property\n def red(self):\n return self._red.value\n\n @blue.setter\n def blue(self, value):\n if (\n isinstance(\n value,\n (\n float,\n int,\n ),\n )\n or value is None\n ):\n self._blue = _zivid.Settings2D.Processing.Color.Balance.Blue(\n value\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: float or int or None, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n @green.setter\n def green(self, value):\n if (\n isinstance(\n value,\n (\n float,\n int,\n ),\n )\n or value is None\n ):\n self._green = _zivid.Settings2D.Processing.Color.Balance.Green(\n value\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: float or int or None, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n @red.setter\n def red(self, value):\n if (\n isinstance(\n value,\n (\n float,\n int,\n ),\n )\n or value is None\n ):\n self._red = _zivid.Settings2D.Processing.Color.Balance.Red(\n value\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: float or int or None, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n def __eq__(self, other):\n if (\n self._blue == other._blue\n and self._green == other._green\n and self._red == other._red\n ):\n return True\n return False\n\n def __str__(self):\n return str(_to_internal_settings2d_processing_color_balance(self))\n\n def __init__(\n self,\n gamma=_zivid.Settings2D.Processing.Color.Gamma().value,\n balance=None,\n ):\n if (\n isinstance(\n gamma,\n (\n float,\n int,\n ),\n )\n or gamma is None\n ):\n self._gamma = _zivid.Settings2D.Processing.Color.Gamma(gamma)\n else:\n raise TypeError(\n \"Unsupported type, expected: (float, int,) or None, got {value_type}\".format(\n value_type=type(gamma)\n )\n )\n\n if balance is None:\n balance = self.Balance()\n if not isinstance(balance, self.Balance):\n raise TypeError(\n \"Unsupported type: {value}\".format(value=type(balance))\n )\n self._balance = balance\n\n @property\n def gamma(self):\n return self._gamma.value\n\n @property\n def balance(self):\n return self._balance\n\n @gamma.setter\n def gamma(self, value):\n if (\n isinstance(\n value,\n (\n float,\n int,\n ),\n )\n or value is None\n ):\n self._gamma = _zivid.Settings2D.Processing.Color.Gamma(value)\n else:\n raise TypeError(\n \"Unsupported type, expected: float or int or None, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n @balance.setter\n def balance(self, value):\n if not isinstance(value, self.Balance):\n raise TypeError(\n \"Unsupported type {value}\".format(value=type(value))\n )\n self._balance = value\n\n def __eq__(self, other):\n if self._gamma == other._gamma and self._balance == other._balance:\n return True\n return False\n\n def __str__(self):\n return str(_to_internal_settings2d_processing_color(self))\n\n def __init__(\n self,\n color=None,\n ):\n if color is None:\n color = self.Color()\n if not isinstance(color, self.Color):\n raise TypeError(\"Unsupported type: {value}\".format(value=type(color)))\n self._color = color\n\n @property\n def color(self):\n return self._color\n\n @color.setter\n def color(self, value):\n if not isinstance(value, self.Color):\n raise TypeError(\"Unsupported type {value}\".format(value=type(value)))\n self._color = value\n\n def __eq__(self, other):\n if self._color == other._color:\n return True\n return False\n\n def __str__(self):\n return str(_to_internal_settings2d_processing(self))\n\n def __init__(\n self,\n acquisitions=None,\n processing=None,\n ):\n if acquisitions is None:\n self._acquisitions = []\n elif isinstance(acquisitions, (collections.abc.Iterable,)):\n self._acquisitions = []\n for item in acquisitions:\n if isinstance(item, self.Acquisition):\n self._acquisitions.append(item)\n else:\n raise TypeError(\n \"Unsupported type {item_type}\".format(item_type=type(item))\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: (collections.abc.Iterable,) or None, got {value_type}\".format(\n value_type=type(acquisitions)\n )\n )\n\n if processing is None:\n processing = self.Processing()\n if not isinstance(processing, self.Processing):\n raise TypeError(\"Unsupported type: {value}\".format(value=type(processing)))\n self._processing = processing\n\n @property\n def acquisitions(self):\n return self._acquisitions\n\n @property\n def processing(self):\n return self._processing\n\n @acquisitions.setter\n def acquisitions(self, value):\n if not isinstance(value, (collections.abc.Iterable,)):\n raise TypeError(\"Unsupported type {value}\".format(value=type(value)))\n self._acquisitions = []\n for item in value:\n if isinstance(item, self.Acquisition):\n self._acquisitions.append(item)\n else:\n raise TypeError(\n \"Unsupported type {item_type}\".format(item_type=type(item))\n )\n\n @processing.setter\n def processing(self, value):\n if not isinstance(value, self.Processing):\n raise TypeError(\"Unsupported type {value}\".format(value=type(value)))\n self._processing = value\n\n @classmethod\n def load(cls, file_name):\n return _to_settings2d(_zivid.Settings2D(str(file_name)))\n\n def save(self, file_name):\n _to_internal_settings2d(self).save(str(file_name))\n\n def __eq__(self, other):\n if (\n self._acquisitions == other._acquisitions\n and self._processing == other._processing\n ):\n return True\n return False\n\n def __str__(self):\n return str(_to_internal_settings2d(self))\n\n\ndef _to_settings2d_acquisition(internal_acquisition):\n return Settings2D.Acquisition(\n aperture=internal_acquisition.aperture.value,\n brightness=internal_acquisition.brightness.value,\n exposure_time=internal_acquisition.exposure_time.value,\n gain=internal_acquisition.gain.value,\n )\n\n\ndef _to_settings2d_processing_color_balance(internal_balance):\n return Settings2D.Processing.Color.Balance(\n blue=internal_balance.blue.value,\n green=internal_balance.green.value,\n red=internal_balance.red.value,\n )\n\n\ndef _to_settings2d_processing_color(internal_color):\n return Settings2D.Processing.Color(\n balance=_to_settings2d_processing_color_balance(internal_color.balance),\n gamma=internal_color.gamma.value,\n )\n\n\ndef _to_settings2d_processing(internal_processing):\n return Settings2D.Processing(\n color=_to_settings2d_processing_color(internal_processing.color),\n )\n\n\ndef _to_settings2d(internal_settings2d):\n return Settings2D(\n acquisitions=[\n _to_settings2d_acquisition(value)\n for value in internal_settings2d.acquisitions.value\n ],\n processing=_to_settings2d_processing(internal_settings2d.processing),\n )\n\n\ndef _to_internal_settings2d_acquisition(acquisition):\n internal_acquisition = _zivid.Settings2D.Acquisition()\n\n internal_acquisition.aperture = _zivid.Settings2D.Acquisition.Aperture(\n acquisition.aperture\n )\n internal_acquisition.brightness = _zivid.Settings2D.Acquisition.Brightness(\n acquisition.brightness\n )\n internal_acquisition.exposure_time = _zivid.Settings2D.Acquisition.ExposureTime(\n acquisition.exposure_time\n )\n internal_acquisition.gain = _zivid.Settings2D.Acquisition.Gain(acquisition.gain)\n\n return internal_acquisition\n\n\ndef _to_internal_settings2d_processing_color_balance(balance):\n internal_balance = _zivid.Settings2D.Processing.Color.Balance()\n\n internal_balance.blue = _zivid.Settings2D.Processing.Color.Balance.Blue(\n balance.blue\n )\n internal_balance.green = _zivid.Settings2D.Processing.Color.Balance.Green(\n balance.green\n )\n internal_balance.red = _zivid.Settings2D.Processing.Color.Balance.Red(balance.red)\n\n return internal_balance\n\n\ndef _to_internal_settings2d_processing_color(color):\n internal_color = _zivid.Settings2D.Processing.Color()\n\n internal_color.gamma = _zivid.Settings2D.Processing.Color.Gamma(color.gamma)\n\n internal_color.balance = _to_internal_settings2d_processing_color_balance(\n color.balance\n )\n return internal_color\n\n\ndef _to_internal_settings2d_processing(processing):\n internal_processing = _zivid.Settings2D.Processing()\n\n internal_processing.color = _to_internal_settings2d_processing_color(\n processing.color\n )\n return internal_processing\n\n\ndef _to_internal_settings2d(settings2d):\n internal_settings2d = _zivid.Settings2D()\n\n temp_acquisitions = _zivid.Settings2D.Acquisitions()\n for value in settings2d.acquisitions:\n temp_acquisitions.append(_to_internal_settings2d_acquisition(value))\n internal_settings2d.acquisitions = temp_acquisitions\n\n internal_settings2d.processing = _to_internal_settings2d_processing(\n settings2d.processing\n )\n return internal_settings2d\n" }, { "alpha_fraction": 0.7283406853675842, "alphanum_fraction": 0.7488986849784851, "avg_line_length": 36.88888931274414, "blob_id": "390b72351eb2e74b3cd4597d46900fcb824d1fbf", "content_id": "fba8fd59b34f5ccf5f780e1362bc2cea3f9d7f5c", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "INI", "length_bytes": 681, "license_type": "permissive", "max_line_length": 96, "num_lines": 18, "path": "/.pylintrc", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "[MESSAGES CONTROL]\ndisable=duplicate-code, # Triggers on data-models\n consider-using-f-string # Keep .format() as long as we want unofficial python3.5 support\n\n[BASIC]\ngood-names=i,j,k,ex,cx,cy,fx,fy,k1,k2,k3,p1,p2\n\n[FORMAT]\nmax-line-length=120\n\n# Allow long lines if they contains long strings\nignore-long-lines=\"[^\"]{80,}\"\n\n# While camera.capture() can return both Frame and Frame2D, since pylint does not do code path\n# analysis it mistakenly thinks it can only return Frame. This causes false-positive \"no-member\"\n# warnings when we access methods that only exist on Frame2D (for now this is only image_rgba()\n# and image_bgra()).\ngenerated-members=image_rgba,image_bgra" }, { "alpha_fraction": 0.6310782432556152, "alphanum_fraction": 0.6346018314361572, "avg_line_length": 40.144927978515625, "blob_id": "d94dc349d8eaa6317c07a55257370f55418f42e8", "content_id": "763d7b07478ba55dc2ff8f272b0161158de29c42", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 2838, "license_type": "permissive", "max_line_length": 110, "num_lines": 69, "path": "/src/Calibration/Calibration.cpp", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "#include <Zivid/Calibration/Detector.h>\n#include <Zivid/Calibration/HandEye.h>\n#include <Zivid/Calibration/MultiCamera.h>\n#include <Zivid/Calibration/Pose.h>\n#include <Zivid/Experimental/Calibration.h>\n#include <Zivid/PointCloud.h>\n\n#include <ZividPython/Calibration/Detector.h>\n#include <ZividPython/Calibration/HandEye.h>\n#include <ZividPython/Calibration/MultiCamera.h>\n#include <ZividPython/Calibration/Pose.h>\n#include <ZividPython/ReleasableCamera.h>\n#include <ZividPython/ReleasableFrame.h>\n#include <ZividPython/ReleasablePointCloud.h>\n#include <ZividPython/Wrappers.h>\n\n#include <pybind11/pybind11.h>\n\n#include <vector>\n\nnamespace py = pybind11;\n\nnamespace ZividPython::Calibration\n{\n void wrapAsSubmodule(py::module &dest)\n {\n using namespace Zivid::Calibration;\n\n ZIVID_PYTHON_WRAP_CLASS(dest, Pose);\n ZIVID_PYTHON_WRAP_CLASS(dest, HandEyeOutput);\n ZIVID_PYTHON_WRAP_CLASS(dest, HandEyeInput);\n ZIVID_PYTHON_WRAP_CLASS(dest, DetectionResult);\n ZIVID_PYTHON_WRAP_CLASS(dest, HandEyeResidual);\n\n ZIVID_PYTHON_WRAP_CLASS(dest, MultiCameraResidual);\n ZIVID_PYTHON_WRAP_CLASS(dest, MultiCameraOutput);\n\n dest.def(\"detect_feature_points\",\n [](const ReleasablePointCloud &releasablePointCloud) {\n return Zivid::Calibration::detectFeaturePoints(releasablePointCloud.impl());\n })\n .def(\"calibrate_eye_in_hand\", &Zivid::Calibration::calibrateEyeInHand)\n .def(\"calibrate_eye_to_hand\", &Zivid::Calibration::calibrateEyeToHand)\n .def(\"calibrate_multi_camera\", &Zivid::Calibration::calibrateMultiCamera)\n .def(\n \"intrinsics\",\n [](ReleasableCamera &releasableCamera) {\n return Zivid::Experimental::Calibration::intrinsics(releasableCamera.impl());\n },\n py::arg(\"camera\"))\n .def(\n \"intrinsics\",\n [](ReleasableCamera &releasableCamera, const Zivid::Settings &settings) {\n return Zivid::Experimental::Calibration::intrinsics(releasableCamera.impl(), settings);\n },\n py::arg(\"camera\"),\n py::arg(\"settings\"))\n .def(\n \"intrinsics\",\n [](ReleasableCamera &releasableCamera, const Zivid::Settings2D &settings_2d) {\n return Zivid::Experimental::Calibration::intrinsics(releasableCamera.impl(), settings_2d);\n },\n py::arg(\"camera\"),\n py::arg(\"settings_2d\"))\n .def(\"estimate_intrinsics\", [](ReleasableFrame &releasableFrame) {\n return Zivid::Experimental::Calibration::estimateIntrinsics(releasableFrame.impl());\n });\n }\n} // namespace ZividPython::Calibration" }, { "alpha_fraction": 0.6842105388641357, "alphanum_fraction": 0.7006579041481018, "avg_line_length": 26.636363983154297, "blob_id": "4498e9151cc19cb0a8b3ed3d19e4472be27e51a7", "content_id": "24cedd30c75d22d21d6d258e8f0f8e01ff4560d2", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 608, "license_type": "permissive", "max_line_length": 82, "num_lines": 22, "path": "/samples/sample_capture.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "\"\"\"Capture sample.\"\"\"\nimport datetime\nfrom zivid import Application, Settings\n\n\ndef _main():\n app = Application()\n camera = app.connect_camera()\n\n settings = Settings()\n settings.acquisitions.append(Settings.Acquisition())\n settings.acquisitions[0].aperture = 5.6\n settings.acquisitions[0].exposure_time = datetime.timedelta(microseconds=8333)\n settings.processing.filters.outlier.removal.enabled = True\n settings.processing.filters.outlier.removal.threshold = 5.0\n\n with camera.capture(settings) as frame:\n frame.save(\"result.zdf\")\n\n\nif __name__ == \"__main__\":\n _main()\n" }, { "alpha_fraction": 0.645792543888092, "alphanum_fraction": 0.645792543888092, "avg_line_length": 31.341772079467773, "blob_id": "191c8412cac4d77566c8486fd55140c3055657bb", "content_id": "87588e1b05e6f0862eb5e4d455687bae92b19447", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2555, "license_type": "permissive", "max_line_length": 102, "num_lines": 79, "path": "/modules/zivid/application.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "\"\"\"Contains Application class.\"\"\"\nimport _zivid\nfrom zivid.camera import Camera\n\n\nclass Application:\n \"\"\"Manager class for Zivid.\n\n When the first instance of this class is created it will initialize Zivid\n resources like camera management and GPU management.\n\n The resources will exist until release() is called, they will not be\n garbage collected even if the Application instance is. Subsequent instances\n of this class will refer to the already initialized resources.\n\n Calling release() on one instance of this class will invalidate all other\n instances of the class.\n\n This class can be used as a context manager to guarantee that resources are\n released deterministically. Note that this will also invalidate all other\n instances of this class.\n \"\"\"\n\n def __init__(self):\n \"\"\"Initialize application.\"\"\"\n self.__impl = _zivid.Application()\n\n def __str__(self):\n return str(self.__impl)\n\n def create_file_camera(self, camera_file):\n \"\"\"Create a virtual camera to simulate Zivid measurements by reading data from a file.\n\n An example file camera may be found among the Sample Data at zivid.com/downloads\n\n Args:\n camera_file: A pathlib.Path instance or a string specifying a Zivid File Camera (ZFC) file\n\n Returns:\n Zivid virtual Camera instance\n \"\"\"\n return Camera(self.__impl.create_file_camera(str(camera_file)))\n\n def connect_camera(self, serial_number=None):\n \"\"\"Connect to the next available Zivid camera.\n\n Args:\n serial_number: Optional serial number string for connecting to a specific camera\n\n Returns:\n Zivid Camera instance\n \"\"\"\n if serial_number is not None:\n return Camera(self.__impl.connect_camera(serial_number))\n return Camera(self.__impl.connect_camera())\n\n def cameras(self):\n \"\"\"Get a list of all cameras.\n\n Returns:\n A list of Camera including all physical cameras as well as virtual ones\n (e.g. cameras created by create_file_camera())\n \"\"\"\n return [Camera(internal_camera) for internal_camera in self.__impl.cameras()]\n\n def release(self):\n \"\"\"Release the underlying resources.\"\"\"\n try:\n impl = self.__impl\n except AttributeError:\n pass\n else:\n impl.release()\n\n def __enter__(self):\n return self\n\n def __exit__(self, exception_type, exception_value, traceback):\n self.release()\n" }, { "alpha_fraction": 0.6979784369468689, "alphanum_fraction": 0.7143484950065613, "avg_line_length": 46.165802001953125, "blob_id": "cc35a9e306be14ab2525fe896c8e6c184d0af9c2", "content_id": "dd5cac736ae7eca1838ecaaba2d3350a555c8b37", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 9102, "license_type": "permissive", "max_line_length": 376, "num_lines": 193, "path": "/README.md", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "# Zivid Python\n\nZivid Python is the official Python package for Zivid 3D cameras. Read more about Zivid at [zivid.com](https://www.zivid.com/).\n\n[![Build Status][ci-badge]][ci-url] [![PyPI Package][pypi-badge]][pypi-url]\n![Zivid Image][header-image]\n\n---\n\n*Contents:* **[Installation](#installation)** | **[Quick Start](#quick-start)** | **[Examples](#examples)** | **[Versioning](#versioning)** | **[License](#license)** | **[Support](#support)** | **[Test Matrix](#test-matrix)**\n\n---\n\n## Installation\n\n### Dependencies\n\n* [Python](https://www.python.org/) version 3.7 or higher\n* [Zivid SDK][zivid-download-software-url] version 2.10.0 (see [here][zivid-software-installation-url] for help)\n* [Compiler](doc/CompilerInstallation.md) with C++17 support\n\n*Ubuntu users must install Python headers (`apt install python3-dev`) in addition to the regular `python3` package.*\n\n*Windows users also needs to make sure that the Zivid SDK installation folder is in system `PATH` before using the package, not only the terminal PATH variable. The default install location that should be added to system `PATH` is `C:\\Program Files\\Zivid\\bin`.*\n\n### Installing official version from PyPI using PIP\n\nAfter having installed the latest Zivid SDK, the easiest way to install Zivid Python is to use PIP to fetch the latest official version from PyPI:\n\n pip install zivid\n\nNote:\n\n> If you don't use the latest Zivid SDK version you need to manually specify the version. See [Versioning](#versioning).\n\nInstallation may take some time since the `setup.py` script will download additional dependencies and compile C++ source code in the background.\n\nOn some systems Python 3 `pip` is called `pip3`. In this guide we assume it is called `pip`. When using PIP version 19 or higher build dependencies are handled automatically.\n\n#### Old PIP\n\nIf you are using a version of PIP older than version 19 please manually install the dependencies listed in [pyproject.toml](pyproject.toml) before installing zivid.\n\n pip install <packages listed in pyproject.toml>\n pip install zivid\n\n### Installing from source\n\n git clone <zivid-python clone URL>\n cd zivid-python\n pip install .\n\nYou may want to build Zivid Python against a different (but compatible) version of Zivid SDK. An example would be if Zivid SDK 2.1 was released but the official\nZivid Python still formally only supports SDK 2.0. Since all the features of the 2.0 API exist in the 2.1 API, Zivid Python can still be built with the new SDK\n(but without wrapping the latest features). In order to achieve this, edit `setup.py` to target the new SDK version before doing `pip install .`. Note that\nthis option is considered experimental/unofficial.\n\n## Quick Start\n\n### Point cloud capture\n\nTo quickly capture a point cloud using default settings, run the following code:\n\n import zivid\n app = zivid.Application()\n camera = app.connect_camera()\n settings = zivid.Settings(acquisitions=[zivid.Settings.Acquisition()])\n frame = camera.capture(settings)\n frame.save(\"result.zdf\")\n\nInstead of using the API to define capture settings, it is also possible to load them from YML files that\nhave been exported from [Zivid Studio][zivid-studio-guide-url] or downloaded from the Zivid Knowledge Base\n[settings library][zivid-two-standard-settings-url]. This can be done by providing the filesystem path to\nsuch a file, for example:\n\n settings = Settings.load(\"ZividTwo_Settings_2xHDR_Normal.yml\")\n frame = camera.capture(settings)\n\n### Point cloud data access\n\nData can easily be accessed in the form of Numpy arrays:\n\n import zivid\n app = zivid.Application()\n camera = app.connect_camera()\n settings = zivid.Settings(acquisitions=[zivid.Settings.Acquisition()])\n frame = camera.capture(settings)\n xyz = frame.point_cloud().copy_data(\"xyz\") # Get point coordinates as [Height,Width,3] float array\n rgba = frame.point_cloud().copy_data(\"rgba\") # Get point colors as [Height,Width,4] uint8 array\n bgra = frame.point_cloud().copy_data(\"bgra\") # Get point colors as [Height,Width,4] uint8 array\n\n### Capture Assistant\n\nInstead of manually adjusting settings, the Capture Assistant may be used to find the optimal settings for your scene:\n\n import zivid\n app = zivid.Application()\n camera = app.connect_camera()\n capture_assistant_params = zivid.capture_assistant.SuggestSettingsParameters()\n settings = zivid.capture_assistant.suggest_settings(camera, capture_assistant_params)\n frame = camera.capture(settings)\n frame.save(\"result.zdf\")\n\n### Using camera emulation\n\nIf you do not have a camera, you can use the `FileCameraZivid2M70.zfc` file in the [Sample Data][zivid-download-sampledata-url] to emulate a camera.\n\n import zivid\n app = zivid.Application()\n camera = app.create_file_camera(\"path/to/FileCameraZivid2M70.zfc\")\n settings = zivid.Settings(acquisitions=[zivid.Settings.Acquisition()])\n frame = camera.capture(settings)\n frame.save(\"result.zdf\")\n\n## Examples\n\nBasic example programs can be found in the [samples](samples) directory.\nMany more advanced example programs may be found in the separate\n[zivid-python-samples](https://github.com/zivid/zivid-python-samples) repository.\n\n## Versioning\n\nThis python module is using [PEP 440](https://www.python.org/dev/peps/pep-0440) for versioning. The features available in the module depends on the Zivid SDK version used when building the module. When updating this Python package it is *recommended* to also update to the latest [Zivid SDK][zivid-software-url]. Refer to the [Test Matrix](#test-matrix) for supported version.\n\nThe version number of the Zivid Python module consists of six numbers. The three first numbers of the version is the [semantic version](https://semver.org/) of the code in this repository. The last three numbers is the version of the underlying Zivid SDK library used by the Python module.\n\nTo check which version of zivid-python that corresponds to a specific version of Zivid SDK, check out [zivid-python-releases-url] or run `pip index versions zivid`.\n\n### Version breakdown\n\n Zivid SDK version = 1.4.1 (semantic version)\n v v v\n Zivid Python module version = 1.0.0.1.4.1\n ^ ^ ^\n Wrapper code version = 1.0.0 (semantic version)\n\n### PyPI\n\nWhen installing using PIP it is possible to specify the required version. This can be useful if upgrading Zivid SDK is not desired, but you want to update Zivid Python.\n\n#### Install latest version of Zivid Python using latest version of Zivid SDK\n\n pip install zivid\n\n#### Install version 1.0.0 of Zivid Python using latest version of Zivid SDK\n\n pip install zivid==1.0.0\n\n#### Install version 1.0.0 of Zivid Python using Zivid SDK version 1.4.0\n\n pip install zivid==1.0.0.1.4.0\n\n#### Install version 1.0.0 of Zivid Python using Zivid SDK version 1.3.0\n\n pip install zivid==1.0.0.1.3.0\n\n*Support for older versions of Zivid SDK will be discontinued when they are no longer compatible with latest version of the wrapper code.*\n\n## License\n\nThis project is licensed, see the [LICENSE](LICENSE) file for details. The licenses of dependencies are listed [here](./licenses-dependencies).\n\n## Support\n\nPlease visit [Zivid Knowledge Base][zivid-knowledge-base-url] for general information on using Zivid 3D cameras. If you cannot find a solution to your issue, please contact customersuccess@zivid.com.\n\n## Test matrix\n\n| Operating System | Python version |\n| :--------------- | :------------------------ |\n| Ubuntu 23.04 | 3.11 |\n| Ubuntu 22.10 | 3.10 |\n| Ubuntu 22.04 | 3.10 |\n| Ubuntu 20.04 | 3.8 |\n| Fedora 37 | 3.11 |\n| Fedora 36 | 3.10 |\n| Fedora 35 | 3.10 |\n| Windows 10 | 3.7, 3.8, 3.9, 3.10, 3.11 |\n\n[header-image]: https://www.zivid.com/hubfs/softwarefiles/images/zivid-generic-github-header.png\n[ci-badge]: https://img.shields.io/github/actions/workflow/status/zivid/zivid-python/main.yml?branch=master\n[ci-url]: https://github.com/zivid/zivid-python/actions?query=workflow%3A%22Main+CI+workflow%22+branch%3Amaster\n[pypi-badge]: https://img.shields.io/pypi/v/zivid.svg\n[pypi-url]: https://pypi.org/project/zivid\n\n[zivid-knowledge-base-url]: http://support.zivid.com\n[zivid-software-installation-url]: https://support.zivid.com/latest/getting-started/software-installation.html\n[zivid-download-software-url]: https://www.zivid.com/downloads\n[zivid-download-sampledata-url]: https://support.zivid.com/en/latest/api-reference/samples/sample-data.html\n[zivid-software-url]: http://www.zivid.com/software\n[zivid-python-releases-url]: https://pypi.org/project/zivid/#history\n[zivid-studio-guide-url]: https://support.zivid.com/en/latest/getting-started/studio-guide.html\n[zivid-two-standard-settings-url]: https://support.zivid.com/en/latest/reference-articles/standard-acquisition-settings-zivid-two.html" }, { "alpha_fraction": 0.6228070259094238, "alphanum_fraction": 0.6228070259094238, "avg_line_length": 25.30769157409668, "blob_id": "7a42fd5f06f0c4bf5d6f76a25da3a9fd3cd57159", "content_id": "c93b1aeeb21d29d4236a6eadb878dadccba37632", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 342, "license_type": "permissive", "max_line_length": 80, "num_lines": 13, "path": "/continuous-integration/windows/create_binary_distribution.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "from common import repo_root, run_process, install_pip_dependencies\n\n\ndef _main():\n root = repo_root()\n install_pip_dependencies(\n root / \"continuous-integration\" / \"python-requirements\" / \"build.txt\"\n )\n run_process((\"python\", str(root / \"setup.py\"), \"bdist_wheel\"), workdir=root)\n\n\nif __name__ == \"__main__\":\n _main()\n" }, { "alpha_fraction": 0.5863662362098694, "alphanum_fraction": 0.5915655493736267, "avg_line_length": 37.46666717529297, "blob_id": "ca623c575b703361af507a781295da234bc2d05c", "content_id": "4a4f8d0686074ce4410be8ec9bdca0d324a31cf1", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1731, "license_type": "permissive", "max_line_length": 97, "num_lines": 45, "path": "/continuous-integration/code-generation/check_datamodels_up_to_date.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "from pathlib import Path\nfrom tempfile import TemporaryDirectory\nfrom textwrap import dedent\n\nfrom datamodel_frontend_generator import generate_all_datamodels\n\n\ndef _check_datamodels_up_to_date(repo_root: Path):\n regeneration_script = Path(\n \"continuous-integration/code-generation/docker_generate_datamodels.sh\"\n )\n if not (repo_root / regeneration_script).is_file():\n raise RuntimeError(\n f\"Could not find {regeneration_script}. Please update path in {Path(__file__).name}.\"\n )\n\n module_dir = repo_root / \"modules\" / \"zivid\"\n\n with TemporaryDirectory() as tmpdir:\n tmpdirpath = Path(tmpdir)\n generate_all_datamodels(dest_dir=tmpdirpath)\n generated_files = tmpdirpath.rglob(\"*.py\")\n print()\n print(\"-\" * 70)\n print(f\"Finished generating files to {tmpdirpath}\")\n print(\"-\" * 70)\n for generated_file in generated_files:\n committed_file = module_dir / generated_file.relative_to(tmpdirpath)\n print(f\"Comparing {str(committed_file):70} <--> {generated_file}\")\n committed_content = committed_file.read_text(encoding=\"utf-8\")\n generated_content = generated_file.read_text(encoding=\"utf-8\")\n if not committed_content == generated_content:\n raise RuntimeError(\n dedent(\n f\"\"\"\n Found difference in {generated_file.name}.\n Please run './{regeneration_script}' to regenerate data models.\n \"\"\"\n )\n )\n print(\"All OK\")\n\n\nif __name__ == \"__main__\":\n _check_datamodels_up_to_date(repo_root=Path(__file__).parents[2])\n" }, { "alpha_fraction": 0.6402438879013062, "alphanum_fraction": 0.6402438879013062, "avg_line_length": 24.230770111083984, "blob_id": "cccf488ffde7879fbb520b63d55bc4d592237f13", "content_id": "7b4a4b08bcf21df6285461eba8276bab68311550", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 328, "license_type": "permissive", "max_line_length": 71, "num_lines": 13, "path": "/samples/sample_print_version_info.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "\"\"\"Print version information for Python, zivid-python and Zivid SDK.\"\"\"\nimport platform\nimport zivid\n\n\ndef _main():\n print(\"Python: {}\".format(platform.python_version()))\n print(\"zivid-python: {}\".format(zivid.__version__))\n print(\"Zivid SDK: {}\".format(zivid.SDKVersion.full))\n\n\nif __name__ == \"__main__\":\n _main()\n" }, { "alpha_fraction": 0.6316794157028198, "alphanum_fraction": 0.6447200775146484, "avg_line_length": 31.071428298950195, "blob_id": "1da06624e4aa653d1d31784063dccf9e53ee22ae", "content_id": "d41707627d5e217973800d183dc56a6e34769c25", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Shell", "length_bytes": 3144, "license_type": "permissive", "max_line_length": 102, "num_lines": 98, "path": "/continuous-integration/linux/lint.sh", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "#!/bin/bash\n\nSCRIPT_DIR=\"$( cd \"$( dirname \"${BASH_SOURCE[0]}\" )\" && pwd )\"\nROOT_DIR=$(realpath \"$SCRIPT_DIR/../..\")\n\nsource $SCRIPT_DIR/venv.sh || exit $?\nactivate_venv || exit $?\n\npython3 -m pip install \\\n --requirement \"$SCRIPT_DIR/../python-requirements/lint.txt\" ||\n exit $?\n\napt-get --assume-yes install clang-format-15 shellcheck || exit $?\nupdate-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-15 0 || exit $?\n\n\nrunPylint() {\n local fileList=\"$1\"\n local rcfile=$ROOT_DIR/\"$2\"\n echo \"\"\n echo \"Running pylint with ${rcfile} on:\"\n echo \"${fileList}\"\n pylint --rcfile \"$rcfile\" $fileList || exit $?\n}\n\nrunFlake8() {\n local fileList=\"$1\"\n local rcfile=$ROOT_DIR/\"$2\"\n echo \"\"\n echo \"Running flake8 with ${rcfile} on:\"\n echo \"${fileList}\"\n flake8 --config=\"$rcfile\" $fileList || exit $?\n}\n\nrunDarglint() {\n local fileList=\"$1\"\n echo \"\"\n echo \"Running darglint on:\"\n echo \"${fileList}\"\n darglint $fileList || exit $?\n}\n\nrunBlackCheck() {\n local fileList=\"$1\"\n echo \"\"\n echo \"Running black on:\"\n echo \"${fileList}\"\n black --check --diff $fileList || exit $?\n}\n\nrunShellcheck() {\n local fileList=\"$1\"\n echo \"\"\n echo \"Running shellcheck on:\"\n echo \"${fileList}\"\n shellcheck -x -e SC1090,SC2086,SC2046 --source-path=${SCRIPT_DIR} $fileList || exit $?\n}\n\n# Get list of all bash files\nbashFiles=$(find \"$ROOT_DIR\" -name '*.sh')\n\n# Get list of all Python files considered public (in certain directories, without leading underscore)\npublicPythonFiles=$(find \"$ROOT_DIR/modules\" \"$ROOT_DIR/samples\" -regex '.*\\/[^_]\\w+\\.py$')\n# Divide all Python files into public and non-public\nallPythonFiles=$(find \"$ROOT_DIR\" -name '*.py' -not -path '*doc/scratchpad*')\nnonPublicPythonFiles=$(comm -23 <(echo $allPythonFiles| tr \" \" \"\\n\" |sort) \\\n <(echo $publicPythonFiles| tr \" \" \"\\n\" |sort))\n# Separate out test-related files. Any remaining Python files are then counted as \"internal\"\ntestsPythonFiles=$(find \"$ROOT_DIR/test\" -name '*.py')\ninternalPythonFiles=$(comm -23 <(echo $nonPublicPythonFiles| tr \" \" \"\\n\" |sort) \\\n <(echo $testsPythonFiles| tr \" \" \"\\n\" |sort))\n\n# Check that generated datamodel front-ends are up to date\npython3 \"$ROOT_DIR/continuous-integration/code-generation/check_datamodels_up_to_date.py\" || exit $?\n\n# Python linting\nrunPylint \"$publicPythonFiles\" \".pylintrc\" || exit $?\nrunPylint \"$internalPythonFiles\" \".pylintrc-internal\" || exit $?\nrunPylint \"$testsPythonFiles\" \".pylintrc-tests\" || exit $?\n\nrunFlake8 \"$publicPythonFiles\" \".flake8\" || exit $?\nrunFlake8 \"$internalPythonFiles\" \".flake8-internal\" || exit $?\nrunFlake8 \"$testsPythonFiles\" \".flake8-tests\" || exit $?\n\nrunDarglint \"$publicPythonFiles\" || exit $?\n\nrunBlackCheck \"$allPythonFiles\" || exit $?\n\n# Shell script linting\nrunShellcheck \"$bashFiles\"\n\n# C++ linting\necho \"Running code analysis on C++ code:\"\nCPP_LINT_DIR=$(mktemp --tmpdir --directory zivid-python-cpp-lint-XXXX) || exit $?\n$SCRIPT_DIR/lint-cpp.sh $CPP_LINT_DIR || exit $?\nrm -r $CPP_LINT_DIR || exit $?\n\necho Success! [\"$0\"]\n\n" }, { "alpha_fraction": 0.6365517377853394, "alphanum_fraction": 0.6462069153785706, "avg_line_length": 37.157894134521484, "blob_id": "baf03ca8d628eafa9bac19919e9492b006f563b7", "content_id": "f5e95fda24ac7c64d40ddcb25ec0e61beb9012e4", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 1450, "license_type": "permissive", "max_line_length": 94, "num_lines": 38, "path": "/src/Calibration/HandEye.cpp", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "#include <Zivid/Calibration/HandEye.h>\n\n#include <ZividPython/Calibration/HandEye.h>\n#include <ZividPython/Matrix.h>\n\n#include <pybind11/pybind11.h>\n#include <pybind11/stl.h>\n\nnamespace py = pybind11;\n\nnamespace ZividPython\n{\n void wrapClass(pybind11::class_<Zivid::Calibration::HandEyeResidual> pyClass)\n {\n pyClass.def(\"rotation\", &Zivid::Calibration::HandEyeResidual::rotation)\n .def(\"translation\", &Zivid::Calibration::HandEyeResidual::translation);\n }\n\n void wrapClass(pybind11::class_<Zivid::Calibration::HandEyeOutput> pyClass)\n {\n pyClass.def(\"valid\", &Zivid::Calibration::HandEyeOutput::valid)\n .def(\"transform\",\n [](const Zivid::Calibration::HandEyeOutput &calibrationOutput) {\n return Conversion::toPy(calibrationOutput.transform());\n })\n .def(\"residuals\", &Zivid::Calibration::HandEyeOutput::residuals);\n }\n\n void wrapClass(pybind11::class_<Zivid::Calibration::HandEyeInput> pyClass)\n {\n pyClass.def(py::init<Zivid::Calibration::Pose, Zivid::Calibration::DetectionResult>())\n .def(\"robot_pose\",\n [](const Zivid::Calibration::HandEyeInput &handEyeInput) {\n return Conversion::toPy(handEyeInput.robotPose().toMatrix());\n })\n .def(\"detection_result\", &Zivid::Calibration::HandEyeInput::detectionResult);\n }\n} // namespace ZividPython\n" }, { "alpha_fraction": 0.7053571343421936, "alphanum_fraction": 0.7232142686843872, "avg_line_length": 29.153846740722656, "blob_id": "7e709f3f950e94f77f04acc0cfc5acdaff3e4e2f", "content_id": "0a90c1edd3a5c4e731c5992c94e142f0c497ee35", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 784, "license_type": "permissive", "max_line_length": 79, "num_lines": 26, "path": "/src/include/ZividPython/ReleasableFrame2D.h", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "#pragma once\n\n#include <Zivid/Frame2D.h>\n#include <Zivid/Settings2D.h>\n\n#include <ZividPython/Releasable.h>\n#include <ZividPython/ReleasableImage.h>\n#include <ZividPython/Wrappers.h>\n\nnamespace ZividPython\n{\n class ReleasableFrame2D : public Releasable<Zivid::Frame2D>\n {\n public:\n using Releasable<Zivid::Frame2D>::Releasable;\n\n ZIVID_PYTHON_FORWARD_0_ARGS_WRAP_RETURN(ReleasableImageRGBA, imageRGBA)\n ZIVID_PYTHON_FORWARD_0_ARGS_WRAP_RETURN(ReleasableImageBGRA, imageBGRA)\n ZIVID_PYTHON_FORWARD_0_ARGS(settings)\n ZIVID_PYTHON_FORWARD_0_ARGS(state)\n ZIVID_PYTHON_FORWARD_0_ARGS(info)\n ZIVID_PYTHON_FORWARD_0_ARGS(cameraInfo)\n };\n\n void wrapClass(pybind11::class_<ReleasableFrame2D> pyClass);\n} // namespace ZividPython\n" }, { "alpha_fraction": 0.7558139562606812, "alphanum_fraction": 0.7674418687820435, "avg_line_length": 20.5, "blob_id": "7809a25696dc9bf08fb25deb26839203190b6a22", "content_id": "ba2d1a829cec3aab10736710b981af46955a1d61", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 172, "license_type": "permissive", "max_line_length": 49, "num_lines": 8, "path": "/src/include/ZividPython/DataModel.h", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "#pragma once\n\n#include <ZividPython/Wrappers.h>\n\nnamespace ZividPython::DataModel\n{\n void wrapAsSubmodule(pybind11::module &dest);\n} // namespace ZividPython::DataModel\n" }, { "alpha_fraction": 0.5654261708259583, "alphanum_fraction": 0.5750300288200378, "avg_line_length": 32.31999969482422, "blob_id": "912397c8d7f8c1237a531d2eaf3e8c23c7b9d227", "content_id": "91730c6be982c3486d0aaca2c02ef83cf11c6cb1", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 833, "license_type": "permissive", "max_line_length": 100, "num_lines": 25, "path": "/src/Firmware.cpp", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "#include <Zivid/Firmware.h>\n#include <ZividPython/Firmware.h>\n#include <ZividPython/ReleasableCamera.h>\n\n#include <pybind11/pybind11.h>\n\nnamespace py = pybind11;\n\nnamespace ZividPython::Firmware\n{\n void wrapAsSubmodule(pybind11::module &dest)\n {\n dest.def(\n \"update\",\n [](ReleasableCamera &camera, const Zivid::Firmware::ProgressCallback &callback) {\n Zivid::Firmware::update(camera.impl(), callback);\n },\n py::arg(\"camera\"),\n py::arg(\"progress_callback\") = Zivid::Firmware::ProgressCallback{})\n .def(\n \"is_up_to_date\",\n [](ReleasableCamera &camera) { return Zivid::Firmware::isUpToDate(camera.impl()); },\n py::arg(\"camera\"));\n }\n} // namespace ZividPython::Firmware\n" }, { "alpha_fraction": 0.5717703104019165, "alphanum_fraction": 0.5956937670707703, "avg_line_length": 21, "blob_id": "32d4fb5bcb6fe98ea92a8696c6b31f0d4950ef6b", "content_id": "57c02bb76a2c6f83df228b90c4a6be7629a5fa88", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 418, "license_type": "permissive", "max_line_length": 87, "num_lines": 19, "path": "/samples/sample_capture_hdr.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "\"\"\"HDR capture sample.\"\"\"\nfrom zivid import Application, Settings\n\n\ndef _main():\n app = Application()\n camera = app.connect_camera()\n\n settings = Settings(\n acquisitions=[\n Settings.Acquisition(aperture=aperture) for aperture in (10.90, 5.80, 2.83)\n ]\n )\n with camera.capture(settings) as hdr_frame:\n hdr_frame.save(\"result.zdf\")\n\n\nif __name__ == \"__main__\":\n _main()\n" }, { "alpha_fraction": 0.73427814245224, "alphanum_fraction": 0.73427814245224, "avg_line_length": 34.28125, "blob_id": "3e769f939b2e2f36e83edbcec7758527495404bd", "content_id": "22a63343194954e26e46395955d453e7f40721b9", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1129, "license_type": "permissive", "max_line_length": 81, "num_lines": 32, "path": "/modules/zivid/capture_assistant.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "\"\"\"Contains the Capture Assistant functionality.\"\"\"\nimport _zivid\n\nfrom zivid._suggest_settings_parameters import ( # pylint: disable=unused-import\n SuggestSettingsParameters,\n)\nfrom zivid._suggest_settings_parameters import (\n _to_internal_capture_assistant_suggest_settings_parameters,\n)\nfrom zivid.settings import _to_settings\n\n\ndef suggest_settings(camera, suggest_settings_parameters):\n \"\"\"Find settings for the current scene based on given parameters.\n\n The suggested settings returned from this function should be passed into\n camera.capture() to capture and retrieve the Frame containing a point cloud.\n\n Args:\n camera: A Camera instance\n suggest_settings_parameters: A SuggestSettingsParameters instance\n\n Returns:\n A Settings instance optimized for the current scene\n \"\"\"\n internal_settings = _zivid.capture_assistant.suggest_settings(\n camera._Camera__impl, # pylint: disable=protected-access\n _to_internal_capture_assistant_suggest_settings_parameters(\n suggest_settings_parameters\n ),\n )\n return _to_settings(internal_settings)\n" }, { "alpha_fraction": 0.7308467626571655, "alphanum_fraction": 0.7308467626571655, "avg_line_length": 34.42856979370117, "blob_id": "1d0b9af1e2fb6baec6fb2ddf46247ed732bef970", "content_id": "a54e17c1ffdf2e7c3aa49801cf97be9b5cdb46d7", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 992, "license_type": "permissive", "max_line_length": 75, "num_lines": 28, "path": "/test/converters/test_convert_camera_info.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "def test_to_internal_camera_info_to_camera_info_modified():\n from zivid import CameraInfo\n from zivid.camera_info import _to_camera_info, _to_internal_camera_info\n\n modified_camera_info = CameraInfo(model_name=\"hello\")\n\n converted_camera_info = _to_camera_info(\n _to_internal_camera_info(modified_camera_info)\n )\n assert modified_camera_info == converted_camera_info\n assert isinstance(converted_camera_info, CameraInfo)\n assert isinstance(modified_camera_info, CameraInfo)\n\n\ndef test_to_internal_camera_info_to_camera_info_default():\n from zivid import CameraInfo\n from zivid.camera_info import _to_camera_info, _to_internal_camera_info\n\n default_camera_info = CameraInfo()\n converted_camera_info = _to_camera_info(\n _to_internal_camera_info(default_camera_info)\n )\n assert default_camera_info == converted_camera_info\n assert isinstance(converted_camera_info, CameraInfo)\n assert isinstance(default_camera_info, CameraInfo)\n\n\n#\n" }, { "alpha_fraction": 0.5585131049156189, "alphanum_fraction": 0.5585131049156189, "avg_line_length": 25.25301170349121, "blob_id": "18f185aafcec773f7f18adf1619ad08df55dbb6c", "content_id": "48f4d5d99f5b77b7985019cf7ef392c01276a866", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2179, "license_type": "permissive", "max_line_length": 91, "num_lines": 83, "path": "/modules/zivid/image.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "\"\"\"Contains a the Image class.\"\"\"\nimport numpy\n\nimport _zivid\n\n\nclass Image:\n \"\"\"A two-dimensional image stored on the host.\"\"\"\n\n def __init__(self, impl):\n \"\"\"Initialize Image wrapper.\n\n This constructor is only used internally, and should not be called by the end-user.\n\n Args:\n impl: Reference to internal/back-end instance.\n\n Raises:\n TypeError: If argument does not match the expected internal class.\n \"\"\"\n if not isinstance(impl, (_zivid.ImageRGBA, _zivid.ImageBGRA)):\n raise TypeError(\n \"Unsupported type for argument impl. Got {}, expected {} or {}\".format(\n type(impl), type(_zivid.ImageRGBA), type(_zivid.ImageBGRA)\n )\n )\n self.__impl = impl\n\n @property\n def height(self):\n \"\"\"Get the height of the image (number of rows).\n\n Returns:\n A positive integer\n \"\"\"\n return self.__impl.height()\n\n @property\n def width(self):\n \"\"\"Get the width of the image (number of columns).\n\n Returns:\n A positive integer\n \"\"\"\n return self.__impl.width()\n\n def save(self, file_path):\n \"\"\"Save the image to a file.\n\n The supported file type is PNG with extension .png.\n This method will throw an exception if failing to save to the provided file_path.\n\n Args:\n file_path: A pathlib.Path instance or a string specifying destination\n \"\"\"\n self.__impl.save(str(file_path))\n\n def copy_data(self):\n \"\"\"Copy image data to numpy array.\n\n Returns:\n A numpy array containing color pixel data\n \"\"\"\n self.__impl.assert_not_released()\n return numpy.array(self.__impl)\n\n def release(self):\n \"\"\"Release the underlying resources.\"\"\"\n try:\n impl = self.__impl\n except AttributeError:\n pass\n else:\n impl.release()\n\n def __enter__(self):\n return self\n\n def __exit__(self, exception_type, exception_value, traceback):\n self.release()\n\n def __del__(self):\n self.release()\n" }, { "alpha_fraction": 0.60435950756073, "alphanum_fraction": 0.6049566864967346, "avg_line_length": 27.870689392089844, "blob_id": "a059f50a1155fd2c5cb4ae869cdd934c8b3dd970", "content_id": "4a0ccc31d357bc5355a11417b800676ad4c9ed7c", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3349, "license_type": "permissive", "max_line_length": 91, "num_lines": 116, "path": "/modules/zivid/_calibration/multi_camera.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "\"\"\"Module containing implementation of multi-camera calibration functionality.\n\nThis module should not be imported directly by end-user, but rather accessed through\nthe zivid.calibration module.\n\"\"\"\n\nimport _zivid\n\n\nclass MultiCameraResidual:\n \"\"\"Class representing the estimated errors of a multi-camera calibration.\"\"\"\n\n def __init__(self, impl):\n \"\"\"Initialize MultiCameraResidual wrapper.\n\n This constructor is only used internally, and should not be called by the end-user.\n\n Args:\n impl: Reference to internal/back-end instance.\n\n Raises:\n TypeError: If argument does not match the expected internal class.\n \"\"\"\n if not isinstance(impl, _zivid.calibration.MultiCameraResidual):\n raise TypeError(\n \"Unsupported type for argument impl. Got {}, expected {}\".format(\n type(impl), type(_zivid.calibration.MultiCameraResidual)\n )\n )\n self.__impl = impl\n\n def translation(self):\n \"\"\"Get the average overlap error.\n\n Returns:\n Average overlap error in millimeters\n \"\"\"\n return self.__impl.translation()\n\n def __str__(self):\n return str(self.__impl)\n\n\nclass MultiCameraOutput:\n \"\"\"Class representing the result of a multi-camera calibration process.\"\"\"\n\n def __init__(self, impl):\n \"\"\"Initialize MultiCameraOutput wrapper.\n\n This constructor is only used internally, and should not be called by the end-user.\n\n Args:\n impl: Reference to internal/back-end instance.\n\n Raises:\n TypeError: If argument does not match the expected internal class.\n \"\"\"\n if not isinstance(impl, _zivid.calibration.MultiCameraOutput):\n raise TypeError(\n \"Unsupported type for argument impl. Got {}, expected {}\".format(\n type(impl), type(_zivid.calibration.MultiCameraOutput)\n )\n )\n self.__impl = impl\n\n def valid(self):\n \"\"\"Check validity of MultiCameraOutput.\n\n Returns:\n True if MultiCameraOutput is valid\n \"\"\"\n return self.__impl.valid()\n\n def __bool__(self):\n return bool(self.__impl)\n\n def transforms(self):\n \"\"\"Get multi-camera calibration transforms.\n\n Returns:\n List of 4x4 arrays, one for each camera\n \"\"\"\n return self.__impl.transforms()\n\n def residuals(self):\n \"\"\"Get multi-camera calibration residuals.\n\n Returns:\n List of MultiCameraResidual instances, one for each camera\n \"\"\"\n return [\n MultiCameraResidual(internal_residual)\n for internal_residual in self.__impl.residuals()\n ]\n\n def __str__(self):\n return str(self.__impl)\n\n\ndef calibrate_multi_camera(detection_results):\n \"\"\"Perform multi-camera calibration.\n\n Args:\n detection_results: List of DetectionResult, one for each camera\n\n Returns:\n A MultiCameraOutput instance\n \"\"\"\n return MultiCameraOutput(\n _zivid.calibration.calibrate_multi_camera(\n [\n detection_result._DetectionResult__impl # pylint: disable=protected-access\n for detection_result in detection_results\n ]\n )\n )\n" }, { "alpha_fraction": 0.622020423412323, "alphanum_fraction": 0.6311010122299194, "avg_line_length": 35.70833206176758, "blob_id": "1dff071b7b687c816758410a51494e81fee71855", "content_id": "3a22febea5714b8668ebee0e45a4b646ee7a5a14", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 881, "license_type": "permissive", "max_line_length": 113, "num_lines": 24, "path": "/src/SingletonApplication.cpp", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "#include <Zivid/CameraInfo.h>\n\n#include <ZividPython/SingletonApplication.h>\n\n#include <pybind11/pybind11.h>\n\nnamespace py = pybind11;\n\nnamespace ZividPython\n{\n void wrapClass(pybind11::class_<SingletonApplication> pyClass)\n {\n pyClass.def(py::init())\n .def(\"cameras\", &SingletonApplication::cameras)\n .def(\"connect_camera\", [](SingletonApplication &application) { return application.connectCamera(); })\n .def(\n \"connect_camera\",\n [](SingletonApplication &application, const std::string &serialNumber) {\n return application.connectCamera(Zivid::CameraInfo::SerialNumber{ serialNumber });\n },\n py::arg(\"serial_number\"))\n .def(\"create_file_camera\", &SingletonApplication::createFileCamera, py::arg(\"frame_file\"));\n }\n} // namespace ZividPython\n" }, { "alpha_fraction": 0.7400000095367432, "alphanum_fraction": 0.7571428418159485, "avg_line_length": 22.33333396911621, "blob_id": "c201a11f4cd0a81f5ba078e6cc0c75a6c5113578", "content_id": "6e67b2770356189ac340f4d26686f68a7822f7d8", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 350, "license_type": "permissive", "max_line_length": 123, "num_lines": 15, "path": "/doc/CompilerInstallation.md", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "# Compiler Installation\n\nThis document contains instruction for how to install a compatible compiler for compilation of the Zivid Python package.\n\n## Ubuntu\n\n apt install g++\n\n## Fedora\n\n dnf install g++\n\n## Windows 10\n\nInstall Visual [Studio Community Edition *2017*](https://visualstudio.microsoft.com/vs/older-downloads) or similar edition.\n" }, { "alpha_fraction": 0.6413043737411499, "alphanum_fraction": 0.6429765820503235, "avg_line_length": 30.473684310913086, "blob_id": "e09668573a1689f39501bc5aec5e070e8c9adaac", "content_id": "08510634647f3820d8f3c41a322fbe391d5df328", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1196, "license_type": "permissive", "max_line_length": 68, "num_lines": 38, "path": "/test/test_datamodel_save_load.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "import pytest\n\n\n@pytest.mark.parametrize(\n \"datamodel\",\n [\n \"Settings\",\n \"Settings2D\",\n \"CameraState\",\n \"CameraInfo\",\n \"FrameInfo\",\n \"capture_assistant.SuggestSettingsParameters\",\n ],\n)\ndef test_basic_save_load(application, datamodel_yml_dir, datamodel):\n from operator import attrgetter\n from pathlib import Path\n from tempfile import TemporaryDirectory\n import zivid\n\n filename = datamodel.split(\".\")[-1] + \".yml\"\n load_path = datamodel_yml_dir / filename\n\n # Load original file\n original = attrgetter(datamodel)(zivid).load(load_path)\n with TemporaryDirectory() as tmpdir:\n save_path = Path(tmpdir) / filename\n # Save to new file\n original.save(save_path)\n # Load the new file back and check\n loaded = attrgetter(datamodel)(zivid).load(save_path)\n assert original == loaded\n assert str(original) == str(loaded)\n # These should be different from default-constructed\n attrgetter(datamodel)(zivid)().save(save_path)\n default = attrgetter(datamodel)(zivid).load(save_path)\n assert default != loaded\n assert str(default) != str(loaded)\n" }, { "alpha_fraction": 0.6176574230194092, "alphanum_fraction": 0.6239887475967407, "avg_line_length": 30.58888816833496, "blob_id": "1977c18f014b7769680d3592a1857ca07482de3a", "content_id": "e7bc28086114c74205cee3b33ae27b99802ed3c5", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2843, "license_type": "permissive", "max_line_length": 112, "num_lines": 90, "path": "/samples/sample_calibrate_eye_to_hand.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "\"\"\"Hand-eye calibration sample.\"\"\"\nfrom pathlib import Path\nimport datetime\nimport tempfile\n\nimport numpy as np\nimport zivid\n\n\ndef _acquire_checkerboard_frame(camera):\n print(\"Capturing checkerboard image... \")\n\n suggest_settings_parameters = zivid.capture_assistant.SuggestSettingsParameters(\n max_capture_time=datetime.timedelta(milliseconds=1200),\n ambient_light_frequency=zivid.capture_assistant.SuggestSettingsParameters.AmbientLightFrequency.none,\n )\n\n settings = zivid.capture_assistant.suggest_settings(\n camera, suggest_settings_parameters\n )\n return camera.capture(settings)\n\n\ndef _enter_robot_pose(index):\n inputted = input(\n \"Enter pose with id={} (a line with 16 space separated values describing 4x4 row-major matrix):\".format(\n index\n )\n )\n elements = inputted.split(maxsplit=15)\n data = np.array(elements, dtype=np.float64).reshape((4, 4))\n robot_pose = zivid.calibration.Pose(data)\n print(\"The following pose was entered:\\n{}\".format(robot_pose))\n return robot_pose\n\n\ndef _main():\n app = zivid.Application()\n camera = app.connect_camera()\n\n current_pose_id = 0\n calibration_inputs = []\n calibrate = False\n\n while not calibrate:\n command = input(\n \"Enter command, p (to add robot pose) or c (to perform calibration):\"\n ).strip()\n if command == \"p\":\n try:\n robot_pose = _enter_robot_pose(current_pose_id)\n\n frame = _acquire_checkerboard_frame(camera)\n\n print(\"Detecting checkerboard square centers... \")\n result = zivid.calibration.detect_feature_points(frame.point_cloud())\n\n if result:\n print(\"OK\")\n res = zivid.calibration.HandEyeInput(robot_pose, result)\n calibration_inputs.append(res)\n current_pose_id += 1\n else:\n print(\"FAILED\")\n except ValueError as ex:\n print(ex)\n elif command == \"c\":\n calibrate = True\n else:\n print(\"Unknown command '{}'\".format(command))\n\n print(\"Performing hand-eye calibration...\")\n calibration_result = zivid.calibration.calibrate_eye_to_hand(calibration_inputs)\n if calibration_result:\n print(\"OK\")\n print(\"Result:\\n{}\".format(calibration_result))\n else:\n print(\"FAILED\")\n\n print(\"Getting calibration result transformation matrix\")\n transformed_numpy_matrix = calibration_result.transform()\n\n print(\"Saving calibration result transformation matrix\")\n with tempfile.TemporaryDirectory() as tempdir:\n file_path = Path(tempdir) / \"hand_eye.yml\"\n zivid.Matrix4x4(transformed_numpy_matrix).save(file_path)\n\n\nif __name__ == \"__main__\":\n _main()\n" }, { "alpha_fraction": 0.6877903342247009, "alphanum_fraction": 0.6974120736122131, "avg_line_length": 37.15189743041992, "blob_id": "1351370266dc3e384f3ffed068e0c000006db501", "content_id": "e5dda4bc866ac37572bc9189795a12e3f3d3a058", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3014, "license_type": "permissive", "max_line_length": 84, "num_lines": 79, "path": "/test/calibration/test_multi_camera.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "def test_multicamera_invalid_input_single_detectionresult(checkerboard_frames):\n import pytest\n import zivid.calibration\n\n frame = checkerboard_frames[0]\n detection_result = zivid.calibration.detect_feature_points(frame.point_cloud())\n\n with pytest.raises(TypeError):\n # Will fail because a list of detection_result is required\n zivid.calibration.calibrate_multi_camera(detection_result)\n\n with pytest.raises(RuntimeError):\n # Will fail because the list must have more than one detection result\n zivid.calibration.calibrate_multi_camera([detection_result])\n\n\ndef test_multicamera_calibration(checkerboard_frames, multicamera_transforms):\n import numpy as np\n import zivid.calibration\n\n # Detect feature points\n detection_results = [\n zivid.calibration.detect_feature_points(frame.point_cloud())\n for frame in checkerboard_frames\n ]\n assert all(detection_results)\n\n # Perform multicamera calibration\n multicamera_output = zivid.calibration.calibrate_multi_camera(detection_results)\n assert isinstance(multicamera_output, zivid.calibration.MultiCameraOutput)\n assert str(multicamera_output)\n assert bool(multicamera_output)\n\n # Extract and check transforms\n transforms = multicamera_output.transforms()\n assert isinstance(transforms, list)\n assert len(transforms) == len(detection_results)\n np.testing.assert_array_equal(transforms[0], np.eye(4))\n\n for transform, reference in zip(transforms, multicamera_transforms):\n assert isinstance(transform, np.ndarray)\n assert transform.shape == (4, 4)\n np.testing.assert_array_equal(transform[-1, :], [0.0, 0.0, 0.0, 1.0])\n np.testing.assert_allclose(transform, reference, rtol=1e-4)\n\n # Extract and check residuals\n residuals = multicamera_output.residuals()\n assert isinstance(residuals, list)\n assert len(residuals) == len(detection_results)\n for i, residual in enumerate(residuals):\n assert isinstance(residual, zivid.calibration.MultiCameraResidual)\n assert str(residual)\n assert isinstance(residual.translation(), float)\n if i == 0:\n assert residual.translation() == 0.0\n else:\n assert residual.translation() > 0.0\n\n\ndef test_multicamera_calibration_save_load(checkerboard_frames):\n from pathlib import Path\n import tempfile\n import numpy as np\n import zivid\n\n multicamera_output = zivid.calibration.calibrate_multi_camera(\n [\n zivid.calibration.detect_feature_points(frame.point_cloud())\n for frame in checkerboard_frames\n ]\n )\n\n with tempfile.TemporaryDirectory() as tmpdir, zivid.Application() as _:\n file_path = Path(tmpdir) / \"matrix.yml\"\n for transform in multicamera_output.transforms():\n zivid.Matrix4x4(transform).save(file_path)\n np.testing.assert_allclose(\n zivid.Matrix4x4(transform), zivid.Matrix4x4(file_path), rtol=1e-6\n )\n" }, { "alpha_fraction": 0.5580110549926758, "alphanum_fraction": 0.5580110549926758, "avg_line_length": 17.100000381469727, "blob_id": "851d9ba5b25cfb0dce305a3f7b99287b1f0c673b", "content_id": "1eb4f70aa41b09e65e0df3cf72521ac9679fef30", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 181, "license_type": "permissive", "max_line_length": 59, "num_lines": 10, "path": "/continuous-integration/windows/build.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "from common import repo_root, run_process\n\n\ndef _main():\n root = repo_root()\n run_process((\"pip\", \"install\", \"--verbose\", str(root)))\n\n\nif __name__ == \"__main__\":\n _main()\n" }, { "alpha_fraction": 0.6973039507865906, "alphanum_fraction": 0.7083333134651184, "avg_line_length": 31.639999389648438, "blob_id": "f815da0663a017ca51f0a83913dbb8b6a8edd08b", "content_id": "56a87294e6e24fe1f38bc1a34584890465723fa8", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 816, "license_type": "permissive", "max_line_length": 81, "num_lines": 25, "path": "/src/include/ZividPython/ReleasableFrame.h", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "#pragma once\n\n#include <Zivid/Frame.h>\n#include <ZividPython/Releasable.h>\n#include <ZividPython/ReleasablePointCloud.h>\n#include <ZividPython/Wrappers.h>\n\nnamespace ZividPython\n{\n class ReleasableFrame : public Releasable<Zivid::Frame>\n {\n public:\n using Releasable<Zivid::Frame>::Releasable;\n\n ZIVID_PYTHON_FORWARD_1_ARGS(save, const std::string &, fileName)\n ZIVID_PYTHON_FORWARD_1_ARGS(load, const std::string &, fileName)\n ZIVID_PYTHON_FORWARD_0_ARGS_WRAP_RETURN(ReleasablePointCloud, pointCloud)\n ZIVID_PYTHON_FORWARD_0_ARGS(settings)\n ZIVID_PYTHON_FORWARD_0_ARGS(state)\n ZIVID_PYTHON_FORWARD_0_ARGS(info)\n ZIVID_PYTHON_FORWARD_0_ARGS(cameraInfo)\n };\n\n void wrapClass(pybind11::class_<ReleasableFrame> pyClass);\n} // namespace ZividPython\n" }, { "alpha_fraction": 0.6535269618034363, "alphanum_fraction": 0.6701244711875916, "avg_line_length": 29.1875, "blob_id": "d7a7d900f2418483245fdaa6f028eb3bc1d85520", "content_id": "cf3b200377531c6330ecc8c38a8245d36f1b52a3", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 482, "license_type": "permissive", "max_line_length": 89, "num_lines": 16, "path": "/src/NodeType.cpp", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "#include <ZividPython/NodeType.h>\n\n#include <pybind11/pybind11.h>\n\nnamespace py = pybind11;\n\nnamespace ZividPython\n{\n void wrapEnum(pybind11::enum_<Zivid::DataModel::NodeType> pyEnum)\n {\n pyEnum.value(\"group\", Zivid::DataModel::NodeType::group)\n .value(\"leaf_data_model_list\", Zivid::DataModel::NodeType::leafDataModelList)\n .value(\"leaf_value\", Zivid::DataModel::NodeType::leafValue)\n .export_values();\n }\n} // namespace ZividPython" }, { "alpha_fraction": 0.7257118821144104, "alphanum_fraction": 0.7357621192932129, "avg_line_length": 22.41176414489746, "blob_id": "6d13e2386c598e3e4b70f67c39697424dad56227", "content_id": "bfe60dffc2f8350f86db09fda0656c4b897f5896", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2388, "license_type": "permissive", "max_line_length": 59, "num_lines": 102, "path": "/test/test_camera_state.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "import pytest\n\n\ndef test_available(file_camera):\n available = file_camera.state.available\n assert available is not None\n assert isinstance(available, bool)\n\n\ndef test_connected(file_camera):\n connected = file_camera.state.connected\n assert connected is not None\n assert isinstance(connected, bool)\n\n\ndef test_temperature(file_camera):\n from zivid.camera_state import CameraState\n\n temperature = file_camera.state.temperature\n assert temperature is not None\n assert isinstance(temperature, CameraState.Temperature)\n\n\ndef test_temperature_dmd(file_camera):\n import numbers\n\n dmd = file_camera.state.temperature.dmd\n assert dmd is not None\n assert isinstance(dmd, numbers.Real)\n\n\ndef test_temperature_general(file_camera):\n import numbers\n\n general = file_camera.state.temperature.general\n assert general is not None\n assert isinstance(general, numbers.Real)\n\n\ndef test_temperature_led(file_camera):\n import numbers\n\n led = file_camera.state.temperature.led\n assert led is not None\n assert isinstance(led, numbers.Real)\n\n\ndef test_temperature_lens(file_camera):\n import numbers\n\n lens = file_camera.state.temperature.lens\n assert lens is not None\n assert isinstance(lens, numbers.Real)\n\n\ndef test_temperature_pcb(file_camera):\n import numbers\n\n pcb = file_camera.state.temperature.pcb\n assert pcb is not None\n assert isinstance(pcb, numbers.Real)\n\n\ndef test_illegal_set_state(file_camera):\n with pytest.raises(AttributeError):\n file_camera.state = file_camera.state\n\n\ndef test_equal_state():\n from zivid.camera_state import CameraState\n\n state1 = CameraState(available=True)\n state2 = CameraState(available=True)\n\n assert state1 == state2\n\n\ndef test_not_equal_state():\n from zivid.camera_state import CameraState\n\n state1 = CameraState(available=True)\n state2 = CameraState(available=False)\n\n assert state1 != state2\n\n\ndef test_equal_temperature():\n from zivid.camera_state import CameraState\n\n temperature1 = CameraState.Temperature(dmd=33)\n temperature2 = CameraState.Temperature(dmd=33)\n\n assert temperature1 == temperature2\n\n\ndef test_not_equal_temperature():\n from zivid.camera_state import CameraState\n\n temperature1 = CameraState.Temperature(dmd=33)\n temperature2 = CameraState.Temperature(dmd=44)\n\n assert temperature1 != temperature2\n" }, { "alpha_fraction": 0.6106194853782654, "alphanum_fraction": 0.6224188804626465, "avg_line_length": 25.153846740722656, "blob_id": "4534ca1895da44d8ba649f3913ff83e730f74892", "content_id": "cbbb314a375ad37114013338e2e5137a6cab3d87", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Shell", "length_bytes": 339, "license_type": "permissive", "max_line_length": 62, "num_lines": 13, "path": "/continuous-integration/linux/build-and-install-source-distribution.sh", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "#!/bin/bash\n\nSCRIPT_DIR=\"$( cd \"$( dirname \"${BASH_SOURCE[0]}\" )\" && pwd )\"\nROOT_DIR=$(realpath \"$SCRIPT_DIR/../..\")\n\nsource $SCRIPT_DIR/venv.sh || exit $?\nactivate_venv || exit $?\n\n# Install source distribution\npython3 -m pip install --upgrade pip || exit $?\npython3 -m pip install \"$ROOT_DIR/dist\"/*.tar.gz || exit $?\n\necho Success! [$0]" }, { "alpha_fraction": 0.6054794788360596, "alphanum_fraction": 0.6136986017227173, "avg_line_length": 27.076923370361328, "blob_id": "8cf5e62a07b1451d4ef5abb3e1b25e7ec1563e9f", "content_id": "796f8ac0e957348a592cc78898eecd232a60a133", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Shell", "length_bytes": 365, "license_type": "permissive", "max_line_length": 93, "num_lines": 13, "path": "/continuous-integration/linux/test.sh", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "#!/bin/bash\n\nSCRIPT_DIR=\"$( cd \"$( dirname \"${BASH_SOURCE[0]}\" )\" && pwd )\"\nROOT_DIR=$(realpath \"$SCRIPT_DIR/../..\")\n\nsource $SCRIPT_DIR/venv.sh || exit $?\nactivate_venv || exit $?\n\npython3 -m pip install --requirement \"$SCRIPT_DIR/../python-requirements/test.txt\" || exit $?\n\npython -m pytest \"$ROOT_DIR\" -c \"$ROOT_DIR/pytest.ini\" || exit $?\n\necho Success! [\"$0\"]\n" }, { "alpha_fraction": 0.6534954309463501, "alphanum_fraction": 0.6726009845733643, "avg_line_length": 24.58888816833496, "blob_id": "8e8594aad3bfaf53e7b01877f6c6b94ed9b39af4", "content_id": "db4ed24e6c4c7515d9e335503ababeabce6c7a69", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2303, "license_type": "permissive", "max_line_length": 81, "num_lines": 90, "path": "/test/test_frame_2d.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "import numpy as np\nimport pytest\n\n\ndef test_image_context_manager(frame_2d):\n import zivid\n\n with frame_2d.image_rgba() as image_rgba:\n assert image_rgba is not None\n assert isinstance(image_rgba, zivid.Image)\n\n with frame_2d.image_bgra() as image_bgra:\n assert image_bgra is not None\n assert isinstance(image_bgra, zivid.Image)\n\n\ndef test_image(frame_2d):\n import zivid\n\n image_rgba = frame_2d.image_rgba()\n assert image_rgba is not None\n assert isinstance(image_rgba, zivid.Image)\n\n image_bgra = frame_2d.image_bgra()\n assert image_bgra is not None\n assert isinstance(image_bgra, zivid.Image)\n\n\ndef test_image_rgba_bgra_correspondence(frame_2d):\n rgba = frame_2d.image_rgba().copy_data()\n bgra = frame_2d.image_bgra().copy_data()\n\n np.testing.assert_array_equal(bgra[:, :, 0], rgba[:, :, 2])\n np.testing.assert_array_equal(bgra[:, :, 1], rgba[:, :, 1])\n np.testing.assert_array_equal(bgra[:, :, 2], rgba[:, :, 0])\n np.testing.assert_array_equal(bgra[:, :, 3], rgba[:, :, 3])\n\n\ndef test_state(frame_2d):\n import zivid\n\n state = frame_2d.state\n assert state is not None\n assert isinstance(state, zivid.CameraState)\n\n\ndef test_info(frame_2d):\n import zivid\n\n info = frame_2d.info\n assert info is not None\n assert isinstance(info, zivid.FrameInfo)\n\n\ndef test_camera_info(frame_2d):\n from zivid.camera_info import CameraInfo\n\n camera_info = frame_2d.camera_info\n assert camera_info\n assert isinstance(camera_info, CameraInfo)\n\n\ndef test_settings(frame_2d):\n import zivid\n\n settings_2d = frame_2d.settings\n assert settings_2d is not None\n assert isinstance(settings_2d, zivid.Settings2D)\n\n\ndef test_release(frame_2d):\n frame_2d.image_rgba()\n frame_2d.release()\n with pytest.raises(RuntimeError):\n frame_2d.image_rgba()\n\n\ndef test_context_manager(file_camera):\n import zivid\n\n settings_2d = zivid.Settings2D(acquisitions=[zivid.Settings2D.Acquisition()])\n with file_camera.capture(settings_2d) as frame_2d:\n frame_2d.image_rgba()\n with pytest.raises(RuntimeError):\n frame_2d.image_rgba()\n\n with file_camera.capture(settings_2d) as frame_2d:\n frame_2d.image_bgra()\n with pytest.raises(RuntimeError):\n frame_2d.image_bgra()\n" }, { "alpha_fraction": 0.627216100692749, "alphanum_fraction": 0.6502156257629395, "avg_line_length": 36.94545364379883, "blob_id": "75597af1081af5773fffe047949ff88fe1f2584b", "content_id": "2ad9de2ff7bfe4c65f0a341207e90e4f531c56f4", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2087, "license_type": "permissive", "max_line_length": 74, "num_lines": 55, "path": "/test/test_region_of_interest.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "import numpy as np\n\n\ndef test_region_of_interest_depth(file_camera):\n import zivid\n\n z_min = 650.0\n z_max = 800.0\n\n # Make sure default capture has points outside the range we want\n settings = zivid.Settings(acquisitions=[zivid.Settings.Acquisition()])\n with file_camera.capture(settings) as frame_default:\n z_default = frame_default.point_cloud().copy_data(\"z\")\n assert np.nanmin(z_default) < z_min\n assert np.nanmax(z_default) > z_max\n\n # Then use depth filter to limit the z-range\n settings.region_of_interest.depth.enabled = True\n settings.region_of_interest.depth.range = [z_min, z_max]\n with file_camera.capture(settings) as frame_roi:\n z_roi = frame_roi.point_cloud().copy_data(\"z\")\n\n assert np.nanmin(z_roi) >= z_min\n assert np.nanmax(z_roi) <= z_max\n\n\ndef test_region_of_interest_box(file_camera):\n import zivid\n\n x_min = 0.0\n x_max = 150.0\n y_min = -125.0\n y_max = 0.0\n\n # Make sure default capture has points outside the range we want\n settings = zivid.Settings(acquisitions=[zivid.Settings.Acquisition()])\n with file_camera.capture(settings) as frame_default:\n xyz_default = frame_default.point_cloud().copy_data(\"xyz\")\n assert np.nanmin(xyz_default[:, :, 0]) < x_min\n assert np.nanmax(xyz_default[:, :, 0]) > x_max\n assert np.nanmin(xyz_default[:, :, 1]) < y_min\n assert np.nanmax(xyz_default[:, :, 1]) > y_max\n\n # Then use box filter to limit region\n settings.region_of_interest.box.enabled = True\n settings.region_of_interest.box.extents = [-500.0, 500.0]\n settings.region_of_interest.box.point_o = [x_min, y_max, 500.0]\n settings.region_of_interest.box.point_a = [x_max, y_max, 500.0]\n settings.region_of_interest.box.point_b = [x_min, y_min, 500.0]\n with file_camera.capture(settings) as frame_roi:\n xyz_roi = frame_roi.point_cloud().copy_data(\"xyz\")\n assert np.nanmin(xyz_roi[:, :, 0]) >= x_min\n assert np.nanmax(xyz_roi[:, :, 0]) <= x_max\n assert np.nanmin(xyz_roi[:, :, 1]) >= y_min\n assert np.nanmax(xyz_roi[:, :, 1]) <= y_max\n" }, { "alpha_fraction": 0.6502976417541504, "alphanum_fraction": 0.6502976417541504, "avg_line_length": 28.88888931274414, "blob_id": "d58d823d70c054eadaf6f46ec30daae36d5bc23e", "content_id": "ac6d7a57752d647ddd7106e70aeb54866094ef4e", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 1344, "license_type": "permissive", "max_line_length": 96, "num_lines": 45, "path": "/src/include/ZividPython/Traits.h", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "#pragma once\n\n#include <type_traits>\n\n#if __has_include(<experimental/type_traits>)\n# include <experimental/type_traits>\n#else\nnamespace Detail\n{\n // Fallback implementation of is_detected for compilers lacking <experimental/type_traits>\n struct nonesuch\n {\n ~nonesuch() = delete;\n nonesuch(nonesuch const &) = delete;\n void operator=(nonesuch const &) = delete;\n };\n\n template<class Default, class AlwaysVoid, template<class...> class Op, class... Args>\n struct detector\n {\n using value_t = std::false_type;\n using type = Default;\n };\n\n template<class Default, template<class...> class Op, class... Args>\n struct detector<Default, std::void_t<Op<Args...>>, Op, Args...>\n {\n using value_t = std::true_type;\n using type = Op<Args...>;\n };\n} // namespace Detail\n#endif\n\nnamespace ZividPython\n{\n#if __has_include(<experimental/type_traits>)\n // Has the experimental header, so just use that.\n template<template<class...> class Op, class... Args>\n using is_detected = typename std::experimental::is_detected<Op, Args...>;\n#else\n // Use fallback implementation.\n template<template<class...> class Op, class... Args>\n using is_detected = typename Detail::detector<Detail::nonesuch, void, Op, Args...>::value_t;\n#endif\n} // namespace ZividPython" }, { "alpha_fraction": 0.7095070481300354, "alphanum_fraction": 0.716549277305603, "avg_line_length": 27.399999618530273, "blob_id": "0954d35ec32725b6b8eeb5373f596fe494714f55", "content_id": "4378dedf001205f53664dd5accc71b08f79b340e", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 568, "license_type": "permissive", "max_line_length": 55, "num_lines": 20, "path": "/test/test_camera_user_data.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "import pytest\n\n\n@pytest.mark.physical_camera\ndef test_write_user_data(physical_camera):\n physical_camera.write_user_data(b\"This is my data\")\n\n\ndef test_write_invalid_user_data(file_camera):\n with pytest.raises(TypeError):\n file_camera.write_user_data(\"This is my data\")\n with pytest.raises(TypeError):\n file_camera.write_user_data(1)\n with pytest.raises(TypeError):\n file_camera.write_user_data([1, 2, 3])\n\n\n@pytest.mark.physical_camera\ndef test_read_user_data(physical_camera):\n assert isinstance(physical_camera.user_data, bytes)\n" }, { "alpha_fraction": 0.6865364909172058, "alphanum_fraction": 0.6968140006065369, "avg_line_length": 30.387096405029297, "blob_id": "2996a56092fff271e5df83548c7c1a6152f29e33", "content_id": "fa0c8101369558e3efbf4eccdf55fe1fcb83868c", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 973, "license_type": "permissive", "max_line_length": 81, "num_lines": 31, "path": "/src/include/ZividPython/ReleasableImage.h", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "#pragma once\n\n#include <Zivid/Image.h>\n#include <ZividPython/Releasable.h>\n#include <ZividPython/Wrappers.h>\n\nnamespace ZividPython\n{\n class ReleasableImageRGBA : public Releasable<Zivid::Image<Zivid::ColorRGBA>>\n {\n public:\n using Releasable<Zivid::Image<Zivid::ColorRGBA>>::Releasable;\n\n ZIVID_PYTHON_FORWARD_1_ARGS(save, const std::string &, fileName)\n ZIVID_PYTHON_FORWARD_0_ARGS(width)\n ZIVID_PYTHON_FORWARD_0_ARGS(height)\n };\n\n class ReleasableImageBGRA : public Releasable<Zivid::Image<Zivid::ColorBGRA>>\n {\n public:\n using Releasable<Zivid::Image<Zivid::ColorBGRA>>::Releasable;\n\n ZIVID_PYTHON_FORWARD_1_ARGS(save, const std::string &, fileName)\n ZIVID_PYTHON_FORWARD_0_ARGS(width)\n ZIVID_PYTHON_FORWARD_0_ARGS(height)\n };\n\n void wrapClass(pybind11::class_<ReleasableImageRGBA> pyClass);\n void wrapClass(pybind11::class_<ReleasableImageBGRA> pyClass);\n} // namespace ZividPython\n" }, { "alpha_fraction": 0.5964285731315613, "alphanum_fraction": 0.6121428608894348, "avg_line_length": 37.88888931274414, "blob_id": "7bacde23fa6c4023032dfccebc3b4ef71cc907af", "content_id": "b7bb684f7f715775764a04f213d9cb029e917cc8", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 1400, "license_type": "permissive", "max_line_length": 116, "num_lines": 36, "path": "/src/ReleasablePointCloud.cpp", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "#include <ZividPython/ReleasablePointCloud.h>\n\n#include <Zivid/PointCloud.h>\n#include <ZividPython/Matrix.h>\n\n#include <pybind11/pybind11.h>\n\nnamespace py = pybind11;\n\nnamespace ZividPython\n{\n void wrapClass(pybind11::class_<ReleasablePointCloud> pyClass)\n {\n pyClass.def(py::init<>())\n .def(\"width\", &ReleasablePointCloud::width)\n .def(\"height\", &ReleasablePointCloud::height)\n .def(\"transform\",\n [](ReleasablePointCloud &pointCloud, const Eigen::Matrix<float, 4, 4, Eigen::RowMajor> &matrix) {\n pointCloud.transform(Conversion::toCpp(matrix));\n })\n .def(\"downsample\",\n [](ReleasablePointCloud &pointCloud, Zivid::PointCloud::Downsampling downsampling) {\n pointCloud.downsample(downsampling);\n })\n .def(\"downsampled\", [](ReleasablePointCloud &pointCloud, Zivid::PointCloud::Downsampling downsampling) {\n return pointCloud.downsampled(downsampling);\n });\n\n py::enum_<Zivid::PointCloud::Downsampling>{ pyClass, \"Downsampling\" }\n .value(\"by2x2\", Zivid::PointCloud::Downsampling::by2x2)\n .value(\"by3x3\", Zivid::PointCloud::Downsampling::by3x3)\n .value(\"by4x4\", Zivid::PointCloud::Downsampling::by4x4)\n .export_values();\n }\n\n} // namespace ZividPython\n" }, { "alpha_fraction": 0.6680412292480469, "alphanum_fraction": 0.669072151184082, "avg_line_length": 30.29032325744629, "blob_id": "1546360b65482e3bd6765c7e78e1c1dff58d801c", "content_id": "2a8fcaf2d8db7ee6359913128d4d2c32082e272c", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 970, "license_type": "permissive", "max_line_length": 73, "num_lines": 31, "path": "/continuous-integration/deployment/check_expected_artifacts.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "from pathlib import Path\n\n\ndef _expected_artifacts():\n parent_dir = Path(__file__).resolve().parent\n artifacts_file = parent_dir / \"expected-artifacts.txt\"\n artifacts = artifacts_file.read_text().splitlines()\n artifacts.sort()\n version_file = parent_dir / \"expected-version.txt\"\n version = version_file.read_text().strip()\n return [artifact.format(version=version) for artifact in artifacts]\n\n\ndef _present_artifacts():\n artifacts_dir = Path(__file__).resolve().parents[2] / \"distribution\"\n artifacts = [file_path.name for file_path in artifacts_dir.glob(\"*\")]\n artifacts.sort()\n return artifacts\n\n\ndef _main():\n present_artifacts = _present_artifacts()\n print(\"Present artifacts:\\n \" + \"\\n \".join(present_artifacts))\n expected_artifacts = _expected_artifacts()\n print(\"Expected artifacts:\\n \" + \"\\n \".join(expected_artifacts))\n\n assert present_artifacts == expected_artifacts\n\n\nif __name__ == \"__main__\":\n _main()\n" }, { "alpha_fraction": 0.640406608581543, "alphanum_fraction": 0.6467598676681519, "avg_line_length": 20.2702693939209, "blob_id": "390d7efe12be9733768c960def9998739365b16a", "content_id": "aede265cebfda459c7b2f0a6e801bd77045335cf", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Shell", "length_bytes": 787, "license_type": "permissive", "max_line_length": 89, "num_lines": 37, "path": "/continuous-integration/linux/setup.sh", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "#!/bin/bash\n\n# This script uses info in /etc/os-release to dispatch setup to a\n# platform specific implementation\n\nSCRIPT_DIR=\"$( cd \"$( dirname \"${BASH_SOURCE[0]}\" )\" && pwd )\"\nROOT_DIR=$(realpath \"$SCRIPT_DIR/../..\")\n\n# Elevate permissions\nif [ $EUID != 0 ]; then\n sudo \"$0\" \"$@\"\n exit $?\nfi\n\nsource /etc/os-release || exit $?\n\nosId=$ID-$VERSION_ID\n\nsetupScript=$SCRIPT_DIR/platform-dependent/$osId/setup.sh\n\nif [[ -f $setupScript ]]; then\n $setupScript || exit $?\nelse\n echo $setupScript not found\n echo Support for $PRETTY_NAME is not implemented\n exit 1\nfi\n\necho \"clinfo:\"\nclinfo || exit $?\n\ninstall -D \"$ROOT_DIR\"/ZividAPIConfig.yml \"$HOME\"/.config/Zivid/API/Config.yml || exit $?\n\nsource $SCRIPT_DIR/venv.sh || exit $?\ncreate_venv || exit $?\n\necho Success! [$0]\n" }, { "alpha_fraction": 0.7246376872062683, "alphanum_fraction": 0.7536231875419617, "avg_line_length": 19.700000762939453, "blob_id": "2190fe7ce163c7041e48cfabcf1aa82a680e297d", "content_id": "55aaa1901f1b9ad4add5b97b30b3f68f0b5f8731", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 207, "license_type": "permissive", "max_line_length": 70, "num_lines": 10, "path": "/src/include/ZividPython/NodeType.h", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "#pragma once\n\n#include <Zivid/DataModel/NodeType.h>\n\n#include <pybind11/pybind11.h>\n\nnamespace ZividPython\n{\n void wrapEnum(pybind11::enum_<Zivid::DataModel::NodeType> pyEnum);\n} // namespace ZividPython\n" }, { "alpha_fraction": 0.7434146404266357, "alphanum_fraction": 0.77170729637146, "avg_line_length": 45.59090805053711, "blob_id": "92ace35ae02488e566a59b1e1253001d5b6cf5bb", "content_id": "e91783a3a0ceff61bec21f991349e56f957c1057", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 1025, "license_type": "permissive", "max_line_length": 90, "num_lines": 22, "path": "/src/include/ZividPython/ReleasableArray2D.h", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "#pragma once\n\n#include <Zivid/PointCloud.h>\n#include <ZividPython/Releasable.h>\n#include <ZividPython/Wrappers.h>\n\nnamespace ZividPython\n{\n template<typename NativeType>\n using ReleasableArray2D = Releasable<Zivid::Array2D<NativeType>>;\n\n void wrapClass(pybind11::class_<ReleasableArray2D<Zivid::SNR>> pyClass);\n void wrapClass(pybind11::class_<ReleasableArray2D<Zivid::ColorRGBA>> pyClass);\n void wrapClass(pybind11::class_<ReleasableArray2D<Zivid::ColorBGRA>> pyClass);\n void wrapClass(pybind11::class_<ReleasableArray2D<Zivid::NormalXYZ>> pyClass);\n void wrapClass(pybind11::class_<ReleasableArray2D<Zivid::PointXYZ>> pyClass);\n void wrapClass(pybind11::class_<ReleasableArray2D<Zivid::PointXYZW>> pyClass);\n void wrapClass(pybind11::class_<ReleasableArray2D<Zivid::PointZ>> pyClass);\n void wrapClass(pybind11::class_<ReleasableArray2D<Zivid::PointXYZColorRGBA>> pyClass);\n void wrapClass(pybind11::class_<ReleasableArray2D<Zivid::PointXYZColorBGRA>> pyClass);\n\n} // namespace ZividPython\n" }, { "alpha_fraction": 0.6490250825881958, "alphanum_fraction": 0.6573815941810608, "avg_line_length": 21.4375, "blob_id": "c15d73ffd885182489c2059265a224b279255888", "content_id": "adaac2a9799421646735d1903513af13f8fa4448", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 359, "license_type": "permissive", "max_line_length": 62, "num_lines": 16, "path": "/samples/sample_capture_from_file.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "\"\"\"File camera capture sample.\"\"\"\nfrom zivid import Application, Settings\n\n\ndef _main():\n app = Application()\n camera = app.create_file_camera(\"FileCameraZivid2M70.zfc\")\n\n settings = Settings(acquisitions=[Settings.Acquisition()])\n\n with camera.capture(settings) as frame:\n frame.save(\"result.zdf\")\n\n\nif __name__ == \"__main__\":\n _main()\n" }, { "alpha_fraction": 0.7272727489471436, "alphanum_fraction": 0.7559808492660522, "avg_line_length": 19.899999618530273, "blob_id": "7773e086636f657f7539e95795a975dd27855071", "content_id": "5f81b871e989d85584fc856940bafac72c1bdb12", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 209, "license_type": "permissive", "max_line_length": 71, "num_lines": 10, "path": "/src/include/ZividPython/Calibration/Pose.h", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "#pragma once\n\n#include <Zivid/Calibration/HandEye.h>\n\n#include <pybind11/pybind11.h>\n\nnamespace ZividPython\n{\n void wrapClass(pybind11::class_<Zivid::Calibration::Pose> pyClass);\n} // namespace ZividPython\n" }, { "alpha_fraction": 0.6513680219650269, "alphanum_fraction": 0.6707855463027954, "avg_line_length": 21.65999984741211, "blob_id": "fa4d9a719c169c3668c0ca1c2078ead8aa361865", "content_id": "92c649d0f6a9c8b96e8ecbc23558fc2230916ff2", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1133, "license_type": "permissive", "max_line_length": 55, "num_lines": 50, "path": "/test/test_image_2d_bgra.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "import pytest\n\n\ndef test_copy_data(image_2d_bgra):\n import numpy as np\n\n image = image_2d_bgra\n bgra = image.copy_data()\n assert bgra is not None\n assert isinstance(bgra, np.ndarray)\n assert bgra.shape == (image.height, image.width, 4)\n assert bgra.dtype == np.uint8\n\n\ndef test_save_path(image_2d_bgra):\n from pathlib import Path\n\n image_2d_bgra.save(Path(\"some_file.png\"))\n\n\ndef test_save_string(image_2d_bgra):\n image_2d_bgra.save(\"some_file.png\")\n\n\ndef test_to_array_context_manager(frame_2d):\n with frame_2d.image_bgra() as image_2d:\n image_2d.copy_data()\n with pytest.raises(RuntimeError):\n image_2d.copy_data()\n\n\ndef test_save_context_manager(frame_2d):\n with frame_2d.image_bgra() as image_2d:\n image_2d.save(\"some_file.png\")\n with pytest.raises(RuntimeError):\n image_2d.save(\"some_file.png\")\n\n\ndef test_height(image_2d_bgra):\n height = image_2d_bgra.height\n\n assert height is not None\n assert isinstance(height, int)\n\n\ndef test_width(image_2d_bgra):\n width = image_2d_bgra.width\n\n assert width is not None\n assert isinstance(width, int)\n" }, { "alpha_fraction": 0.6298116445541382, "alphanum_fraction": 0.6310401558876038, "avg_line_length": 28.42168617248535, "blob_id": "f2e507ed148ac574fb9839195ceb681278424242", "content_id": "360c10154ad07c6c13041773bddb26d9588c6e05", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2442, "license_type": "permissive", "max_line_length": 91, "num_lines": 83, "path": "/modules/zivid/_calibration/detector.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "\"\"\"Module containing implementation of feature point detection functionality.\n\nThis module should not be imported directly by end-user, but rather accessed through\nthe zivid.calibration module.\n\"\"\"\nimport _zivid\nfrom zivid._calibration.pose import Pose\n\n\nclass DetectionResult:\n \"\"\"Class representing detected feature points.\"\"\"\n\n def __init__(self, impl):\n \"\"\"Initialize DetectionResult wrapper.\n\n This constructor is only used internally, and should not be called by the end-user.\n\n Args:\n impl: Reference to internal/back-end instance.\n\n Raises:\n TypeError: If argument does not match the expected internal class.\n \"\"\"\n if not isinstance(impl, _zivid.calibration.DetectionResult):\n raise TypeError(\n \"Unsupported type for argument impl. Got {}, expected {}\".format(\n type(impl), type(_zivid.calibration.DetectionResult)\n )\n )\n\n self.__impl = impl\n\n def valid(self):\n \"\"\"Check validity of DetectionResult.\n\n Returns:\n True if DetectionResult is valid\n \"\"\"\n return self.__impl.valid()\n\n def centroid(self):\n \"\"\"Get the centroid of the detected feature points.\n\n Will throw an exception if the DetectionResult is not valid.\n\n Returns:\n A 1D array containing the X, Y and Z coordinates of the centroid\n \"\"\"\n return self.__impl.centroid()\n\n def pose(self):\n \"\"\"Get position and orientation of the top left detected corner in camera-space.\n\n Pose calculation works for official Zivid calibration boards only.\n An exception will be thrown if valid() is false or if the board is not supported.\n\n Returns:\n The Pose of the top left corner (4x4 transformation matrix)\n \"\"\"\n return Pose(self.__impl.pose().to_matrix())\n\n def __bool__(self):\n return bool(self.__impl)\n\n def __str__(self):\n return str(self.__impl)\n\n\ndef detect_feature_points(point_cloud):\n \"\"\"Detect feature points from a calibration object in a point cloud.\n\n Args:\n point_cloud: PointCloud containing a calibration object\n\n Returns:\n A DetectionResult instance\n \"\"\"\n\n return DetectionResult(\n _zivid.calibration.detect_feature_points(\n point_cloud._PointCloud__impl # pylint: disable=protected-access\n )\n )\n" }, { "alpha_fraction": 0.6913580298423767, "alphanum_fraction": 0.7407407164573669, "avg_line_length": 15.300000190734863, "blob_id": "b573f4c5fb6c01c30a381f94a4a4beb8dadf4b60", "content_id": "3ec29d3d7500442859b1aba5af1c66c675117b26", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 162, "license_type": "permissive", "max_line_length": 63, "num_lines": 10, "path": "/src/include/ZividPython/Matrix4x4.h", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "#pragma once\n\n#include <Zivid/Matrix.h>\n\n#include <pybind11/pybind11.h>\n\nnamespace ZividPython\n{\n void wrapClass(pybind11::class_<Zivid::Matrix4x4> pyClass);\n}" }, { "alpha_fraction": 0.5722891688346863, "alphanum_fraction": 0.5843373537063599, "avg_line_length": 17.44444465637207, "blob_id": "e451ccf91589ea24c6bd64dfd4aedc3c08a4e559", "content_id": "cce5422a7b9bec6f7726eb16925a868271071eef", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "TOML", "length_bytes": 166, "license_type": "permissive", "max_line_length": 37, "num_lines": 9, "path": "/pyproject.toml", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "[build-system]\n# This list is duplicated in setup.py\n# Keep the two lists in sync\nrequires = [\n \"cmake\",\n \"conan>=1,<2\",\n \"ninja\",\n \"scikit-build\",\n ]\n" }, { "alpha_fraction": 0.5150526165962219, "alphanum_fraction": 0.537178099155426, "avg_line_length": 33.91139221191406, "blob_id": "87d9af7fcaa639b067c607b772d22f516d0aa7ca", "content_id": "0a860c6160cf4421fc43fb175fc532c86e815c3e", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 2757, "license_type": "permissive", "max_line_length": 77, "num_lines": 79, "path": "/src/DataModel.cpp", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "#include <Zivid/DataModel/NodeType.h>\n#include <Zivid/Point.h>\n#include <Zivid/Range.h>\n\n#include <ZividPython/DataModel.h>\n#include <ZividPython/NodeType.h>\n#include <ZividPython/Wrappers.h>\n\n#include \"pybind11/numpy.h\"\n#include <pybind11/operators.h>\n#include <pybind11/pybind11.h>\n#include <pybind11/stl.h>\n\nnamespace ZividPython\n{\n void wrapClass(pybind11::class_<Zivid::Range<double>> pyClass)\n {\n using R = Zivid::Range<double>;\n pyClass.def(pybind11::init<>())\n .def(pybind11::init([](double min, double max) {\n return R{ min, max };\n }))\n .def(pybind11::init([](const std::array<double, 2> &array) {\n return R{ array[0], array[1] };\n }))\n .def_property_readonly(\"min\", [](const R &r) { return r.min(); })\n .def_property_readonly(\"max\", [](const R &r) { return r.max(); })\n .def(\"to_array\",\n [](const R &self) {\n return std::array<double, 2>{ self.min(), self.max() };\n })\n .def(\"__repr__\", &R::toString)\n .def(\"to_string\", &R::toString)\n .def(pybind11::self == pybind11::self) // NOLINT\n .def(pybind11::self != pybind11::self) // NOLINT\n .def(\"is_in_range\", &R::isInRange);\n\n pybind11::implicitly_convertible<pybind11::iterable, R>();\n }\n\n void wrapClass(pybind11::class_<Zivid::PointXYZ> pyClass)\n {\n using T = Zivid::PointXYZ;\n pyClass.def(pybind11::init<>())\n .def(pybind11::init<float, float, float>())\n .def(pybind11::init([](const std::array<float, 3> &array) {\n return T{ array[0], array[1], array[2] };\n }))\n .def(\"is_nan\", &T::isNaN)\n .def(\"__repr__\", &T::toString)\n .def(\"to_string\", &T::toString)\n .def(\"to_array\",\n [](const T &self) {\n return std::array<float, 3>{ self.x, self.y, self.z };\n })\n .def(pybind11::self == pybind11::self)\n .def(pybind11::self != pybind11::self)\n .def_readwrite(\"x\", &T::x)\n .def_readwrite(\"y\", &T::y)\n .def_readwrite(\"z\", &T::z);\n\n pybind11::implicitly_convertible<pybind11::iterable, T>();\n }\n\n} // namespace ZividPython\n\nnamespace ZividPython::DataModel\n{\n void wrapAsSubmodule(pybind11::module &dest)\n {\n using namespace Zivid::DataModel;\n ZIVID_PYTHON_WRAP_ENUM_CLASS(dest, NodeType);\n\n using Range = Zivid::Range<double>;\n using PointXYZ = Zivid::PointXYZ;\n ZIVID_PYTHON_WRAP_CLASS(dest, Range);\n ZIVID_PYTHON_WRAP_CLASS(dest, PointXYZ);\n }\n} // namespace ZividPython::DataModel" }, { "alpha_fraction": 0.5957446694374084, "alphanum_fraction": 0.6079027652740479, "avg_line_length": 24.384614944458008, "blob_id": "48e6cf9f9b3e5d44cb747686c2e4da08307c7f46", "content_id": "a58843332c1a2a1bcfb6e6190f5543613767d2db", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Shell", "length_bytes": 329, "license_type": "permissive", "max_line_length": 62, "num_lines": 13, "path": "/continuous-integration/linux/build.sh", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "#!/bin/bash\n\nSCRIPT_DIR=\"$( cd \"$( dirname \"${BASH_SOURCE[0]}\" )\" && pwd )\"\nROOT_DIR=$(realpath \"$SCRIPT_DIR/../..\")\n\nsource $SCRIPT_DIR/venv.sh || exit $?\nactivate_venv || exit $?\n\npython3 -m pip install --upgrade pip || exit $?\necho \"Building zivid-python...\"\npython3 -m pip install \"$ROOT_DIR\" || exit $?\n\necho Success! [\"$0\"]" }, { "alpha_fraction": 0.6433566212654114, "alphanum_fraction": 0.6608391404151917, "avg_line_length": 19.428571701049805, "blob_id": "1b08cd6d76c758748d9f432a17190a2d7844f203", "content_id": "2e0bbc8b6a1d1a8f8562b89798c3847ab1671879", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Shell", "length_bytes": 286, "license_type": "permissive", "max_line_length": 47, "num_lines": 14, "path": "/continuous-integration/linux/venv.sh", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "#!/bin/bash\n\nexport VENV_PATH=/tmp/zivid-python-ci-venv\n\nfunction create_venv {\n echo \"Creating venv\"\n python3 -m venv ${VENV_PATH} || exit $?\n}\n\nfunction activate_venv {\n echo \"Activating venv\"\n # shellcheck disable=SC1091\n source ${VENV_PATH}/bin/activate || exit $?\n}\n" }, { "alpha_fraction": 0.5909090638160706, "alphanum_fraction": 0.6799754500389099, "avg_line_length": 32.224491119384766, "blob_id": "6bda038f15605806c19bfd9e39c8defae05f039f", "content_id": "888bd3262ee9fa66d08910a6f000da12913959a0", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1628, "license_type": "permissive", "max_line_length": 83, "num_lines": 49, "path": "/test/calibration/test_calibration_basics.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "def test_pose(transform):\n import numpy as np\n import zivid.calibration\n\n pose = zivid.calibration.Pose(transform)\n\n assert pose is not None\n assert isinstance(pose, zivid.calibration.Pose)\n assert str(pose)\n np.testing.assert_array_equal(transform, pose.to_matrix())\n\n\ndef test_detect_feature_points(checkerboard_frames):\n import numpy as np\n import zivid\n\n frame = checkerboard_frames[0]\n detection_result = zivid.calibration.detect_feature_points(frame.point_cloud())\n assert detection_result is not None\n assert isinstance(detection_result, zivid.calibration.DetectionResult)\n assert bool(detection_result)\n assert detection_result.valid()\n assert str(detection_result)\n centroid = detection_result.centroid()\n assert isinstance(centroid, np.ndarray)\n assert centroid.shape == (3,)\n np.testing.assert_allclose(centroid, [-67.03593, 71.17018, 906.348], rtol=1e-6)\n\n\ndef test_calibration_board_pose(calibration_board_frame):\n import numpy as np\n import zivid\n\n point_cloud = calibration_board_frame.point_cloud()\n detection_result = zivid.calibration.detect_feature_points(point_cloud)\n pose = detection_result.pose()\n assert pose is not None\n assert str(pose)\n assert isinstance(pose, zivid.calibration.Pose)\n np.testing.assert_allclose(\n pose.to_matrix(),\n [\n [0.996286, -0.004492, -0.085990, -194.331055],\n [0.004557, 0.999989, 0.000553, -193.129150],\n [0.085987, -0.000943, 0.996296, 1913.698975],\n [0.000000, 0.000000, 0.000000, 1.000000],\n ],\n rtol=1e-3,\n )\n" }, { "alpha_fraction": 0.6166989207267761, "alphanum_fraction": 0.640876829624176, "avg_line_length": 32.35483932495117, "blob_id": "bbab19fe80d29db9dbb3f43e985ce0144747ce42", "content_id": "8d29b6dcbf30847fdbcc2d3ff4298b2f8f6393ea", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3102, "license_type": "permissive", "max_line_length": 87, "num_lines": 93, "path": "/samples/sample_project_on_checkerboard.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "\"\"\"Sample demonstrating how to project an image onto a point in 3D space.\"\"\"\nfrom datetime import timedelta\n\nfrom zivid import Application, Settings, Settings2D\nfrom zivid.calibration import detect_feature_points\nfrom zivid.experimental.projection import (\n projector_resolution,\n show_image_bgra,\n pixels_from_3d_points,\n)\n\nimport numpy as np\n\n\ndef _detect_checkerboard(camera):\n print(\"Detecting checkerboard...\")\n settings = Settings()\n settings.acquisitions.append(Settings.Acquisition())\n with camera.capture(settings) as frame:\n detection_result = detect_feature_points(frame.point_cloud())\n if not detection_result.valid():\n raise RuntimeError(\"Failed to detect checkerboard\")\n print(\"Successfully detected checkerboard\")\n return detection_result\n\n\ndef _create_image_bgra_array(camera, detection_result):\n resolution = projector_resolution(camera)\n print(f\"Projector resolution: {resolution}\")\n\n channels_bgra = 4\n resolution_bgra = resolution + (channels_bgra,)\n image_bgra = np.zeros(resolution_bgra, dtype=np.uint8)\n\n # Draw frame around projector FOV\n image_bgra[:5, :, :] = 255\n image_bgra[-5:, :, :] = 255\n image_bgra[:, :5, :] = 255\n image_bgra[:, -5:, :] = 255\n\n # Draw circle at checkerboard centroid\n centroid_xyz = list(detection_result.centroid())\n print(f\"Located checkerboard at xyz={centroid_xyz}\")\n centroid_projector_xy = pixels_from_3d_points(camera, [centroid_xyz])[0]\n print(f\"Projector coords (x,y) corresponding to centroid: {centroid_projector_xy}\")\n col = round(centroid_projector_xy[0])\n row = round(centroid_projector_xy[1])\n print(f\"Projector pixel corresponding to centroid: row={row}, col={col}\")\n for i in np.arange(-10, 10, 1):\n for j in np.arange(-10, 10, 1):\n dist = np.sqrt(i**2 + j**2)\n if dist <= 5:\n color = (0, 0, 255, 0)\n elif 5 < dist < 7:\n color = (255, 255, 255, 0)\n else:\n color = (0, 0, 0, 0)\n image_bgra[row + i, col + j, :] = color\n\n return image_bgra\n\n\ndef _capture_image_of_projection(projected_image):\n settings_2d = Settings2D()\n settings_2d.acquisitions.append(\n Settings2D.Acquisition(\n brightness=0.0,\n exposure_time=timedelta(milliseconds=50),\n )\n )\n settings_2d.processing.color.gamma = 0.75\n\n with projected_image.capture(settings_2d) as frame2d:\n filename = \"projection_picture.png\"\n print(f\"Saving image of projection to {filename}\")\n frame2d.image_rgba().save(filename)\n\n\ndef _main():\n app = Application()\n\n print(\"Connecting to camera...\")\n with app.connect_camera() as camera:\n detection_result = _detect_checkerboard(camera)\n image_bgra = _create_image_bgra_array(camera, detection_result)\n\n with show_image_bgra(camera, image_bgra) as projected_image:\n _capture_image_of_projection(projected_image)\n input(\"Press enter to stop projection\")\n\n\nif __name__ == \"__main__\":\n _main()\n" }, { "alpha_fraction": 0.6688918471336365, "alphanum_fraction": 0.6742323040962219, "avg_line_length": 33.09090805053711, "blob_id": "5bb621bc485004e1e2fa075116b0b5ccbecb3901", "content_id": "d5dcfd76edc0ea5de6ddb648c84037fc50411be8", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Shell", "length_bytes": 749, "license_type": "permissive", "max_line_length": 98, "num_lines": 22, "path": "/continuous-integration/code-generation/generate_datamodels.sh", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "#!/bin/bash\n\n# For consistent results, there are two options:\n# - Run this script in the same Docker container that runs linting (docker_generate_datamodels.sh)\n# or\n# - Start a fresh virtual environment, install zivid-python from source, and run this script.\n\nSCRIPT_DIR=\"$( cd \"$( dirname \"${BASH_SOURCE[0]}\" )\" && pwd )\"\nROOT_DIR=$(realpath \"$SCRIPT_DIR/../..\")\n\nif [ -z \"$VIRTUAL_ENV\" ]; then\n source $SCRIPT_DIR/../linux/venv.sh || exit $?\n activate_venv || exit $?\nfi\n\npython3 -m pip install --requirement \"$SCRIPT_DIR/../python-requirements/lint.txt\" || exit $?\n\npython3 \"$ROOT_DIR/continuous-integration/code-generation/datamodel_frontend_generator.py\" \\\n --dest-dir \"$ROOT_DIR/modules/zivid/\" \\\n || exit $?\n\necho Success! [\"$0\"]" }, { "alpha_fraction": 0.5882794857025146, "alphanum_fraction": 0.5917856097221375, "avg_line_length": 28.577777862548828, "blob_id": "78e5451424b46f10361e20c864804ce2ce79250e", "content_id": "1a268baba4e51fc0d8439c4b009106ce9ed2ea9c", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3994, "license_type": "permissive", "max_line_length": 116, "num_lines": 135, "path": "/modules/zivid/camera.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "\"\"\"Contains Camera class.\"\"\"\nimport _zivid\nfrom zivid.frame import Frame\nfrom zivid.frame_2d import Frame2D\nfrom zivid.settings import Settings, _to_internal_settings\nfrom zivid.settings_2d import Settings2D, _to_internal_settings2d\nfrom zivid.camera_info import _to_camera_info\nfrom zivid.camera_state import _to_camera_state\n\n\nclass Camera:\n \"\"\"Interface to one Zivid camera.\n\n This class cannot be initialized directly by the end-user. Use methods on the Application\n class to obtain a Camera instance.\n \"\"\"\n\n def __init__(self, impl):\n \"\"\"Initialize Camera wrapper.\n\n This constructor is only used internally, and should not be called by the end-user.\n\n Args:\n impl: Reference to internal/back-end instance.\n\n Raises:\n TypeError: If argument does not match the expected internal class.\n \"\"\"\n if not isinstance(impl, _zivid.Camera):\n raise TypeError(\n \"Unsupported type for argument impl. Got {}, expected {}\".format(\n type(impl), type(_zivid.Camera)\n )\n )\n\n self.__impl = impl\n\n def __str__(self):\n return str(self.__impl)\n\n def __eq__(self, other):\n return self.__impl == other._Camera__impl\n\n def capture(self, settings):\n \"\"\"Capture a single frame or a single 2D frame.\n\n Args:\n settings: Settings to be used to capture. Can be either a Settings or Settings2D instance\n\n Returns:\n A Frame containing a 3D image plus metadata or a Frame2D containing a 2D image plus metadata.\n\n Raises:\n TypeError: If argument is neither a Settings or a Settings2D\n \"\"\"\n if isinstance(settings, Settings):\n return Frame(self.__impl.capture(_to_internal_settings(settings)))\n if isinstance(settings, Settings2D):\n return Frame2D(self.__impl.capture(_to_internal_settings2d(settings)))\n raise TypeError(\"Unsupported settings type: {}\".format(type(settings)))\n\n @property\n def info(self):\n \"\"\"Get information about camera model, serial number etc.\n\n Returns:\n A CameraInfo instance\n \"\"\"\n return _to_camera_info(self.__impl.info)\n\n @property\n def state(self):\n \"\"\"Get the current camera state.\n\n Returns:\n A CameraState instance\n \"\"\"\n return _to_camera_state(self.__impl.state)\n\n def connect(self):\n \"\"\"Connect to the camera.\n\n Returns:\n Reference to the same Camera instance (for chaining)\n \"\"\"\n self.__impl.connect()\n return self\n\n def disconnect(self):\n \"\"\"Disconnect from the camera and free all resources associated with it.\"\"\"\n self.__impl.disconnect()\n\n def write_user_data(self, user_data):\n \"\"\"Write user data to camera. The total number of writes supported depends on camera model and size of data.\n\n Args:\n user_data: User data as 'bytes' object\n\n Raises:\n TypeError: Unsupported type provided for user data\n \"\"\"\n if not isinstance(user_data, bytes):\n raise TypeError(\n \"Unsupported type for argument user_data. Got {}, expected {}.\".format(\n type(user_data), bytes.__name__\n )\n )\n self.__impl.write_user_data(list(user_data))\n\n @property\n def user_data(self):\n \"\"\"Read user data from camera.\n\n Returns:\n User data as 'bytes' object\n \"\"\"\n return bytes(self.__impl.user_data)\n\n def release(self):\n \"\"\"Release the underlying resources.\"\"\"\n try:\n impl = self.__impl\n except AttributeError:\n pass\n else:\n impl.release()\n\n def __enter__(self):\n return self\n\n def __exit__(self, exception_type, exception_value, traceback):\n self.release()\n\n def __del__(self):\n self.release()\n" }, { "alpha_fraction": 0.6644067764282227, "alphanum_fraction": 0.680084764957428, "avg_line_length": 37.68852615356445, "blob_id": "fb53e1ef7362e68ef6d0ce2ec1879a7a2cca9f46", "content_id": "ad844286a9a4c23e6a3a27af86a296e60d1548d2", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2360, "license_type": "permissive", "max_line_length": 134, "num_lines": 61, "path": "/continuous-integration/windows/setup.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "import json\nimport os\nimport tempfile\nimport shutil\nfrom pathlib import Path\nfrom common import repo_root, run_process, install_pip_dependencies\n\n\ndef _install_zivid_sdk():\n import requests # pylint: disable=import-outside-toplevel\n\n versions_json = (Path(__file__).parents[1] / \"versions.json\").read_text(\n encoding=\"utf8\"\n )\n exact_version = json.loads(versions_json)[\"ZIVID_SDK_EXACT_VERSION\"]\n\n with tempfile.TemporaryDirectory() as temp_dir:\n zivid_installer_url = f\"https://downloads.zivid.com/sdk/releases/{exact_version}/windows/ZividSetup_{exact_version}.exe\"\n print(\"Downloading {}\".format(zivid_installer_url), flush=True)\n zivid_installer = Path(temp_dir) / \"ZividSetup.exe\"\n response = requests.get(zivid_installer_url, timeout=(25, 600))\n zivid_installer.write_bytes(response.content)\n print(\"Installing {}\".format(zivid_installer), flush=True)\n run_process((str(zivid_installer), \"/S\"))\n\n\ndef _install_intel_opencl_runtime():\n import requests # pylint: disable=import-outside-toplevel\n\n with tempfile.TemporaryDirectory() as temp_dir:\n intel_opencl_runtime_url = \"https://www.dropbox.com/s/09bk2nx31hzrupf/opencl_runtime_18.1_x64_setup-20200625-090300.msi?raw=1\"\n print(\"Downloading {}\".format(intel_opencl_runtime_url), flush=True)\n opencl_runtime = Path(temp_dir) / \"opencl_runtime.msi\"\n response = requests.get(intel_opencl_runtime_url, timeout=(25, 600))\n opencl_runtime.write_bytes(response.content)\n print(\"Installing {}\".format(opencl_runtime), flush=True)\n run_process((\"msiexec\", \"/i\", str(opencl_runtime), \"/passive\"))\n\n\ndef _write_zivid_cpu_configuration_file():\n api_config = Path() / \"ZividAPIConfig.yml\"\n\n appdata_dir = Path(os.getenv(\"LOCALAPPDATA\"))\n target_location = appdata_dir / \"Zivid\" / \"API\" / \"Config.yml\"\n print(\"Target location for config: \" + str(target_location))\n target_location.parent.mkdir(parents=True, exist_ok=True)\n shutil.copy(str(api_config), str(target_location))\n\n\ndef _main():\n root = repo_root()\n install_pip_dependencies(\n root / \"continuous-integration\" / \"python-requirements\" / \"setup.txt\"\n )\n _install_intel_opencl_runtime()\n _install_zivid_sdk()\n _write_zivid_cpu_configuration_file()\n\n\nif __name__ == \"__main__\":\n _main()\n" }, { "alpha_fraction": 0.720588207244873, "alphanum_fraction": 0.720588207244873, "avg_line_length": 16, "blob_id": "3bd9fffa4b2f2e1b6a54aaca70219a05f38043ec", "content_id": "f9b7366e667910eeee1092495d7950c5932270a4", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Shell", "length_bytes": 68, "license_type": "permissive", "max_line_length": 39, "num_lines": 4, "path": "/continuous-integration/linux/lint-cpp-gcc-setup.sh", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "#!/bin/bash\n\nexport CXX=gcc\nexport CXXFLAGS=\"-Wall -Wextra -Werror\"\n" }, { "alpha_fraction": 0.6347368359565735, "alphanum_fraction": 0.6410526037216187, "avg_line_length": 35.53845977783203, "blob_id": "fd1c00500364553313507de4bd352fef8908dea1", "content_id": "7d6a546f9079c386e9a458ce1858662286a9dc8e", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 950, "license_type": "permissive", "max_line_length": 114, "num_lines": 26, "path": "/src/include/ZividPython/SingletonApplication.h", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "#pragma once\n\n#include <Zivid/Application.h>\n#include <ZividPython/Releasable.h>\n#include <ZividPython/ReleasableCamera.h>\n#include <ZividPython/Wrappers.h>\n\nnamespace ZividPython\n{\n class SingletonApplication : public Singleton<Zivid::Application>\n {\n public:\n ZIVID_PYTHON_FORWARD_0_ARGS_WRAP_CONTAINER_RETURN(std::vector, ReleasableCamera, cameras)\n\n ZIVID_PYTHON_FORWARD_0_ARGS_WRAP_RETURN(ReleasableCamera, connectCamera)\n\n ZIVID_PYTHON_FORWARD_1_ARGS_WRAP_RETURN(ReleasableCamera,\n connectCamera,\n const Zivid::CameraInfo::SerialNumber &,\n serialNumber)\n\n ZIVID_PYTHON_FORWARD_1_ARGS_WRAP_RETURN(ReleasableCamera, createFileCamera, const std::string &, fileName)\n };\n\n void wrapClass(pybind11::class_<SingletonApplication> pyClass);\n} // namespace ZividPython\n" }, { "alpha_fraction": 0.4912068545818329, "alphanum_fraction": 0.4912068545818329, "avg_line_length": 30.150724411010742, "blob_id": "b2431c26a16815679507f2d34c93046833220799", "content_id": "48a00633f85cad8bf9e5976cf18d953906ebdf18", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 10747, "license_type": "permissive", "max_line_length": 221, "num_lines": 345, "path": "/modules/zivid/camera_state.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "\"\"\"Auto generated, do not edit.\"\"\"\n# pylint: disable=too-many-lines,protected-access,too-few-public-methods,too-many-arguments,line-too-long,missing-function-docstring,missing-class-docstring,redefined-builtin,too-many-branches,too-many-boolean-expressions\nimport _zivid\n\n\nclass CameraState:\n class Temperature:\n def __init__(\n self,\n dmd=_zivid.CameraState.Temperature.DMD().value,\n general=_zivid.CameraState.Temperature.General().value,\n led=_zivid.CameraState.Temperature.LED().value,\n lens=_zivid.CameraState.Temperature.Lens().value,\n pcb=_zivid.CameraState.Temperature.PCB().value,\n ):\n if isinstance(\n dmd,\n (\n float,\n int,\n ),\n ):\n self._dmd = _zivid.CameraState.Temperature.DMD(dmd)\n else:\n raise TypeError(\n \"Unsupported type, expected: (float, int,), got {value_type}\".format(\n value_type=type(dmd)\n )\n )\n\n if isinstance(\n general,\n (\n float,\n int,\n ),\n ):\n self._general = _zivid.CameraState.Temperature.General(general)\n else:\n raise TypeError(\n \"Unsupported type, expected: (float, int,), got {value_type}\".format(\n value_type=type(general)\n )\n )\n\n if isinstance(\n led,\n (\n float,\n int,\n ),\n ):\n self._led = _zivid.CameraState.Temperature.LED(led)\n else:\n raise TypeError(\n \"Unsupported type, expected: (float, int,), got {value_type}\".format(\n value_type=type(led)\n )\n )\n\n if isinstance(\n lens,\n (\n float,\n int,\n ),\n ):\n self._lens = _zivid.CameraState.Temperature.Lens(lens)\n else:\n raise TypeError(\n \"Unsupported type, expected: (float, int,), got {value_type}\".format(\n value_type=type(lens)\n )\n )\n\n if isinstance(\n pcb,\n (\n float,\n int,\n ),\n ):\n self._pcb = _zivid.CameraState.Temperature.PCB(pcb)\n else:\n raise TypeError(\n \"Unsupported type, expected: (float, int,), got {value_type}\".format(\n value_type=type(pcb)\n )\n )\n\n @property\n def dmd(self):\n return self._dmd.value\n\n @property\n def general(self):\n return self._general.value\n\n @property\n def led(self):\n return self._led.value\n\n @property\n def lens(self):\n return self._lens.value\n\n @property\n def pcb(self):\n return self._pcb.value\n\n @dmd.setter\n def dmd(self, value):\n if isinstance(\n value,\n (\n float,\n int,\n ),\n ):\n self._dmd = _zivid.CameraState.Temperature.DMD(value)\n else:\n raise TypeError(\n \"Unsupported type, expected: float or int, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n @general.setter\n def general(self, value):\n if isinstance(\n value,\n (\n float,\n int,\n ),\n ):\n self._general = _zivid.CameraState.Temperature.General(value)\n else:\n raise TypeError(\n \"Unsupported type, expected: float or int, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n @led.setter\n def led(self, value):\n if isinstance(\n value,\n (\n float,\n int,\n ),\n ):\n self._led = _zivid.CameraState.Temperature.LED(value)\n else:\n raise TypeError(\n \"Unsupported type, expected: float or int, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n @lens.setter\n def lens(self, value):\n if isinstance(\n value,\n (\n float,\n int,\n ),\n ):\n self._lens = _zivid.CameraState.Temperature.Lens(value)\n else:\n raise TypeError(\n \"Unsupported type, expected: float or int, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n @pcb.setter\n def pcb(self, value):\n if isinstance(\n value,\n (\n float,\n int,\n ),\n ):\n self._pcb = _zivid.CameraState.Temperature.PCB(value)\n else:\n raise TypeError(\n \"Unsupported type, expected: float or int, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n def __eq__(self, other):\n if (\n self._dmd == other._dmd\n and self._general == other._general\n and self._led == other._led\n and self._lens == other._lens\n and self._pcb == other._pcb\n ):\n return True\n return False\n\n def __str__(self):\n return str(_to_internal_camera_state_temperature(self))\n\n def __init__(\n self,\n available=_zivid.CameraState.Available().value,\n connected=_zivid.CameraState.Connected().value,\n temperature=None,\n ):\n if isinstance(available, (bool,)):\n self._available = _zivid.CameraState.Available(available)\n else:\n raise TypeError(\n \"Unsupported type, expected: (bool,), got {value_type}\".format(\n value_type=type(available)\n )\n )\n\n if isinstance(connected, (bool,)):\n self._connected = _zivid.CameraState.Connected(connected)\n else:\n raise TypeError(\n \"Unsupported type, expected: (bool,), got {value_type}\".format(\n value_type=type(connected)\n )\n )\n\n if temperature is None:\n temperature = self.Temperature()\n if not isinstance(temperature, self.Temperature):\n raise TypeError(\"Unsupported type: {value}\".format(value=type(temperature)))\n self._temperature = temperature\n\n @property\n def available(self):\n return self._available.value\n\n @property\n def connected(self):\n return self._connected.value\n\n @property\n def temperature(self):\n return self._temperature\n\n @available.setter\n def available(self, value):\n if isinstance(value, (bool,)):\n self._available = _zivid.CameraState.Available(value)\n else:\n raise TypeError(\n \"Unsupported type, expected: bool, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n @connected.setter\n def connected(self, value):\n if isinstance(value, (bool,)):\n self._connected = _zivid.CameraState.Connected(value)\n else:\n raise TypeError(\n \"Unsupported type, expected: bool, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n @temperature.setter\n def temperature(self, value):\n if not isinstance(value, self.Temperature):\n raise TypeError(\"Unsupported type {value}\".format(value=type(value)))\n self._temperature = value\n\n @classmethod\n def load(cls, file_name):\n return _to_camera_state(_zivid.CameraState(str(file_name)))\n\n def save(self, file_name):\n _to_internal_camera_state(self).save(str(file_name))\n\n def __eq__(self, other):\n if (\n self._available == other._available\n and self._connected == other._connected\n and self._temperature == other._temperature\n ):\n return True\n return False\n\n def __str__(self):\n return str(_to_internal_camera_state(self))\n\n\ndef _to_camera_state_temperature(internal_temperature):\n return CameraState.Temperature(\n dmd=internal_temperature.dmd.value,\n general=internal_temperature.general.value,\n led=internal_temperature.led.value,\n lens=internal_temperature.lens.value,\n pcb=internal_temperature.pcb.value,\n )\n\n\ndef _to_camera_state(internal_camera_state):\n return CameraState(\n temperature=_to_camera_state_temperature(internal_camera_state.temperature),\n available=internal_camera_state.available.value,\n connected=internal_camera_state.connected.value,\n )\n\n\ndef _to_internal_camera_state_temperature(temperature):\n internal_temperature = _zivid.CameraState.Temperature()\n\n internal_temperature.dmd = _zivid.CameraState.Temperature.DMD(temperature.dmd)\n internal_temperature.general = _zivid.CameraState.Temperature.General(\n temperature.general\n )\n internal_temperature.led = _zivid.CameraState.Temperature.LED(temperature.led)\n internal_temperature.lens = _zivid.CameraState.Temperature.Lens(temperature.lens)\n internal_temperature.pcb = _zivid.CameraState.Temperature.PCB(temperature.pcb)\n\n return internal_temperature\n\n\ndef _to_internal_camera_state(camera_state):\n internal_camera_state = _zivid.CameraState()\n\n internal_camera_state.available = _zivid.CameraState.Available(\n camera_state.available\n )\n internal_camera_state.connected = _zivid.CameraState.Connected(\n camera_state.connected\n )\n\n internal_camera_state.temperature = _to_internal_camera_state_temperature(\n camera_state.temperature\n )\n return internal_camera_state\n" }, { "alpha_fraction": 0.7283750772476196, "alphanum_fraction": 0.7308003306388855, "avg_line_length": 29.924999237060547, "blob_id": "e005290a41bf32ba9cd94900a6da5e0fc299d4d5", "content_id": "b2a105ab27975a5f067cbccf83faaf30f8a1b539", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1237, "license_type": "permissive", "max_line_length": 71, "num_lines": 40, "path": "/test/test_camera_info.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "def test_revision(file_camera_info):\n import zivid\n\n revision = file_camera_info.revision\n assert revision is not None\n assert isinstance(revision, zivid.CameraInfo.Revision)\n assert revision == zivid.CameraInfo.Revision(0, 2)\n\n\ndef test_firmware_version(file_camera_info):\n firmware_version = file_camera_info.firmware_version\n assert firmware_version is not None\n assert isinstance(firmware_version, str)\n assert firmware_version == \"NA\"\n\n\ndef test_model_name(file_camera_info):\n model_name = file_camera_info.model_name\n assert model_name is not None\n assert isinstance(model_name, str)\n assert model_name.startswith(\"FileCamera\")\n\n\ndef test_serial_number(file_camera_info):\n serial_number = file_camera_info.serial_number\n assert serial_number is not None\n assert isinstance(serial_number, str)\n assert serial_number.startswith(\"F\")\n\n\ndef test_user_data(file_camera_info):\n import zivid\n\n user_data = file_camera_info.user_data\n assert user_data is not None\n assert isinstance(user_data, zivid.camera_info.CameraInfo.UserData)\n\n assert user_data.max_size_bytes is not None\n assert isinstance(user_data.max_size_bytes, int)\n assert user_data.max_size_bytes == 0\n" }, { "alpha_fraction": 0.6513680219650269, "alphanum_fraction": 0.6707855463027954, "avg_line_length": 21.65999984741211, "blob_id": "facaaeda0eff3ca55d9a95aed3d8432958cdbce1", "content_id": "30a2b19eb3d17f846c4cd0f12274bd99f8bd412b", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1133, "license_type": "permissive", "max_line_length": 55, "num_lines": 50, "path": "/test/test_image_2d_rgba.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "import pytest\n\n\ndef test_copy_data(image_2d_rgba):\n import numpy as np\n\n image = image_2d_rgba\n rgba = image.copy_data()\n assert rgba is not None\n assert isinstance(rgba, np.ndarray)\n assert rgba.shape == (image.height, image.width, 4)\n assert rgba.dtype == np.uint8\n\n\ndef test_save_path(image_2d_rgba):\n from pathlib import Path\n\n image_2d_rgba.save(Path(\"some_file.png\"))\n\n\ndef test_save_string(image_2d_rgba):\n image_2d_rgba.save(\"some_file.png\")\n\n\ndef test_to_array_context_manager(frame_2d):\n with frame_2d.image_rgba() as image_2d:\n image_2d.copy_data()\n with pytest.raises(RuntimeError):\n image_2d.copy_data()\n\n\ndef test_save_context_manager(frame_2d):\n with frame_2d.image_rgba() as image_2d:\n image_2d.save(\"some_file.png\")\n with pytest.raises(RuntimeError):\n image_2d.save(\"some_file.png\")\n\n\ndef test_height(image_2d_rgba):\n height = image_2d_rgba.height\n\n assert height is not None\n assert isinstance(height, int)\n\n\ndef test_width(image_2d_rgba):\n width = image_2d_rgba.width\n\n assert width is not None\n assert isinstance(width, int)\n" }, { "alpha_fraction": 0.6771714091300964, "alphanum_fraction": 0.6802459359169006, "avg_line_length": 31.524999618530273, "blob_id": "a2d55aead6cc1c67d3f28a717b2cc63a073111f4", "content_id": "867eaa81f20c6b3f5286814554bcbe6fb224d5c8", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1301, "license_type": "permissive", "max_line_length": 121, "num_lines": 40, "path": "/samples/sample_infield_verification.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "\"\"\"Sample demonstrating in-field verification (experimental).\"\"\"\nimport zivid\n\nfrom zivid.experimental.calibration import (\n detect_feature_points,\n InfieldCorrectionInput,\n verify_camera,\n has_camera_correction,\n camera_correction_timestamp,\n)\n\n\ndef _main():\n app = zivid.Application()\n camera = app.connect_camera()\n\n print(\"Checking current correction status\")\n if has_camera_correction(camera):\n timestamp = camera_correction_timestamp(camera)\n print(\n f\"Camera currently has a correction. Timestamp: {timestamp.strftime(r'%Y-%m-%d %H:%M:%S')}\"\n )\n\n print(\"Detecting feature points for verification...\")\n detection_result = detect_feature_points(camera)\n print(f\"Feature point detection: {detection_result}\")\n infield_input = InfieldCorrectionInput(detection_result)\n print(f\"In-field correction input: {infield_input}\")\n if not infield_input.valid():\n raise RuntimeError(\n f\"Capture not appropriate for in-field correction/verification. Reason: {infield_input.status_description()}\"\n )\n camera_verification = verify_camera(infield_input)\n print(\n f\"Local dimension trueness: {camera_verification.local_dimension_trueness()*100:.3f}%\"\n )\n\n\nif __name__ == \"__main__\":\n _main()\n" }, { "alpha_fraction": 0.6350364685058594, "alphanum_fraction": 0.6733576655387878, "avg_line_length": 25.095237731933594, "blob_id": "d08f3e50c27410b483e6e1726310edf4d660fbca", "content_id": "c353ea5f5f6e1c43100a7b4e57684bdced74772e", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 548, "license_type": "permissive", "max_line_length": 86, "num_lines": 21, "path": "/samples/sample_capture_2d.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "\"\"\"Capture sample 2D.\"\"\"\nimport datetime\nfrom zivid import Application, Settings2D\n\n\ndef _main():\n app = Application()\n camera = app.connect_camera()\n\n settings_2d = Settings2D()\n settings_2d.acquisitions.append(Settings2D.Acquisition())\n settings_2d.acquisitions[0].aperture = 2.83\n settings_2d.acquisitions[0].exposure_time = datetime.timedelta(microseconds=10000)\n\n with camera.capture(settings_2d) as frame_2d:\n image = frame_2d.image_rgba()\n image.save(\"result.png\")\n\n\nif __name__ == \"__main__\":\n _main()\n" }, { "alpha_fraction": 0.44682973623275757, "alphanum_fraction": 0.44695067405700684, "avg_line_length": 37.64796829223633, "blob_id": "df47dc4e2333c4e7063b19587976682ac5ff21de", "content_id": "2242645872e05d21e4edcb8df84b9eb5a9cdd4e8", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 132292, "license_type": "permissive", "max_line_length": 221, "num_lines": 3423, "path": "/modules/zivid/settings.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "\"\"\"Auto generated, do not edit.\"\"\"\n# pylint: disable=too-many-lines,protected-access,too-few-public-methods,too-many-arguments,line-too-long,missing-function-docstring,missing-class-docstring,redefined-builtin,too-many-branches,too-many-boolean-expressions\nimport datetime\nimport collections.abc\nimport _zivid\n\n\nclass Settings:\n class Acquisition:\n def __init__(\n self,\n aperture=_zivid.Settings.Acquisition.Aperture().value,\n brightness=_zivid.Settings.Acquisition.Brightness().value,\n exposure_time=_zivid.Settings.Acquisition.ExposureTime().value,\n gain=_zivid.Settings.Acquisition.Gain().value,\n ):\n if (\n isinstance(\n aperture,\n (\n float,\n int,\n ),\n )\n or aperture is None\n ):\n self._aperture = _zivid.Settings.Acquisition.Aperture(aperture)\n else:\n raise TypeError(\n \"Unsupported type, expected: (float, int,) or None, got {value_type}\".format(\n value_type=type(aperture)\n )\n )\n\n if (\n isinstance(\n brightness,\n (\n float,\n int,\n ),\n )\n or brightness is None\n ):\n self._brightness = _zivid.Settings.Acquisition.Brightness(brightness)\n else:\n raise TypeError(\n \"Unsupported type, expected: (float, int,) or None, got {value_type}\".format(\n value_type=type(brightness)\n )\n )\n\n if (\n isinstance(exposure_time, (datetime.timedelta,))\n or exposure_time is None\n ):\n self._exposure_time = _zivid.Settings.Acquisition.ExposureTime(\n exposure_time\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: (datetime.timedelta,) or None, got {value_type}\".format(\n value_type=type(exposure_time)\n )\n )\n\n if (\n isinstance(\n gain,\n (\n float,\n int,\n ),\n )\n or gain is None\n ):\n self._gain = _zivid.Settings.Acquisition.Gain(gain)\n else:\n raise TypeError(\n \"Unsupported type, expected: (float, int,) or None, got {value_type}\".format(\n value_type=type(gain)\n )\n )\n\n @property\n def aperture(self):\n return self._aperture.value\n\n @property\n def brightness(self):\n return self._brightness.value\n\n @property\n def exposure_time(self):\n return self._exposure_time.value\n\n @property\n def gain(self):\n return self._gain.value\n\n @aperture.setter\n def aperture(self, value):\n if (\n isinstance(\n value,\n (\n float,\n int,\n ),\n )\n or value is None\n ):\n self._aperture = _zivid.Settings.Acquisition.Aperture(value)\n else:\n raise TypeError(\n \"Unsupported type, expected: float or int or None, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n @brightness.setter\n def brightness(self, value):\n if (\n isinstance(\n value,\n (\n float,\n int,\n ),\n )\n or value is None\n ):\n self._brightness = _zivid.Settings.Acquisition.Brightness(value)\n else:\n raise TypeError(\n \"Unsupported type, expected: float or int or None, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n @exposure_time.setter\n def exposure_time(self, value):\n if isinstance(value, (datetime.timedelta,)) or value is None:\n self._exposure_time = _zivid.Settings.Acquisition.ExposureTime(value)\n else:\n raise TypeError(\n \"Unsupported type, expected: datetime.timedelta or None, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n @gain.setter\n def gain(self, value):\n if (\n isinstance(\n value,\n (\n float,\n int,\n ),\n )\n or value is None\n ):\n self._gain = _zivid.Settings.Acquisition.Gain(value)\n else:\n raise TypeError(\n \"Unsupported type, expected: float or int or None, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n def __eq__(self, other):\n if (\n self._aperture == other._aperture\n and self._brightness == other._brightness\n and self._exposure_time == other._exposure_time\n and self._gain == other._gain\n ):\n return True\n return False\n\n def __str__(self):\n return str(_to_internal_settings_acquisition(self))\n\n class Diagnostics:\n def __init__(\n self,\n enabled=_zivid.Settings.Diagnostics.Enabled().value,\n ):\n if isinstance(enabled, (bool,)) or enabled is None:\n self._enabled = _zivid.Settings.Diagnostics.Enabled(enabled)\n else:\n raise TypeError(\n \"Unsupported type, expected: (bool,) or None, got {value_type}\".format(\n value_type=type(enabled)\n )\n )\n\n @property\n def enabled(self):\n return self._enabled.value\n\n @enabled.setter\n def enabled(self, value):\n if isinstance(value, (bool,)) or value is None:\n self._enabled = _zivid.Settings.Diagnostics.Enabled(value)\n else:\n raise TypeError(\n \"Unsupported type, expected: bool or None, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n def __eq__(self, other):\n if self._enabled == other._enabled:\n return True\n return False\n\n def __str__(self):\n return str(_to_internal_settings_diagnostics(self))\n\n class Experimental:\n class Engine:\n omni = \"omni\"\n phase = \"phase\"\n stripe = \"stripe\"\n\n _valid_values = {\n \"omni\": _zivid.Settings.Experimental.Engine.omni,\n \"phase\": _zivid.Settings.Experimental.Engine.phase,\n \"stripe\": _zivid.Settings.Experimental.Engine.stripe,\n }\n\n @classmethod\n def valid_values(cls):\n return list(cls._valid_values.keys())\n\n def __init__(\n self,\n engine=_zivid.Settings.Experimental.Engine().value,\n ):\n if (\n isinstance(engine, _zivid.Settings.Experimental.Engine.enum)\n or engine is None\n ):\n self._engine = _zivid.Settings.Experimental.Engine(engine)\n elif isinstance(engine, str):\n self._engine = _zivid.Settings.Experimental.Engine(\n self.Engine._valid_values[engine]\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: str or None, got {value_type}\".format(\n value_type=type(engine)\n )\n )\n\n @property\n def engine(self):\n if self._engine.value is None:\n return None\n for key, internal_value in self.Engine._valid_values.items():\n if internal_value == self._engine.value:\n return key\n raise ValueError(\"Unsupported value {value}\".format(value=self._engine))\n\n @engine.setter\n def engine(self, value):\n if isinstance(value, str):\n self._engine = _zivid.Settings.Experimental.Engine(\n self.Engine._valid_values[value]\n )\n elif (\n isinstance(value, _zivid.Settings.Experimental.Engine.enum)\n or value is None\n ):\n self._engine = _zivid.Settings.Experimental.Engine(value)\n else:\n raise TypeError(\n \"Unsupported type, expected: str or None, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n def __eq__(self, other):\n if self._engine == other._engine:\n return True\n return False\n\n def __str__(self):\n return str(_to_internal_settings_experimental(self))\n\n class Processing:\n class Color:\n class Balance:\n def __init__(\n self,\n blue=_zivid.Settings.Processing.Color.Balance.Blue().value,\n green=_zivid.Settings.Processing.Color.Balance.Green().value,\n red=_zivid.Settings.Processing.Color.Balance.Red().value,\n ):\n if (\n isinstance(\n blue,\n (\n float,\n int,\n ),\n )\n or blue is None\n ):\n self._blue = _zivid.Settings.Processing.Color.Balance.Blue(blue)\n else:\n raise TypeError(\n \"Unsupported type, expected: (float, int,) or None, got {value_type}\".format(\n value_type=type(blue)\n )\n )\n\n if (\n isinstance(\n green,\n (\n float,\n int,\n ),\n )\n or green is None\n ):\n self._green = _zivid.Settings.Processing.Color.Balance.Green(\n green\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: (float, int,) or None, got {value_type}\".format(\n value_type=type(green)\n )\n )\n\n if (\n isinstance(\n red,\n (\n float,\n int,\n ),\n )\n or red is None\n ):\n self._red = _zivid.Settings.Processing.Color.Balance.Red(red)\n else:\n raise TypeError(\n \"Unsupported type, expected: (float, int,) or None, got {value_type}\".format(\n value_type=type(red)\n )\n )\n\n @property\n def blue(self):\n return self._blue.value\n\n @property\n def green(self):\n return self._green.value\n\n @property\n def red(self):\n return self._red.value\n\n @blue.setter\n def blue(self, value):\n if (\n isinstance(\n value,\n (\n float,\n int,\n ),\n )\n or value is None\n ):\n self._blue = _zivid.Settings.Processing.Color.Balance.Blue(\n value\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: float or int or None, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n @green.setter\n def green(self, value):\n if (\n isinstance(\n value,\n (\n float,\n int,\n ),\n )\n or value is None\n ):\n self._green = _zivid.Settings.Processing.Color.Balance.Green(\n value\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: float or int or None, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n @red.setter\n def red(self, value):\n if (\n isinstance(\n value,\n (\n float,\n int,\n ),\n )\n or value is None\n ):\n self._red = _zivid.Settings.Processing.Color.Balance.Red(value)\n else:\n raise TypeError(\n \"Unsupported type, expected: float or int or None, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n def __eq__(self, other):\n if (\n self._blue == other._blue\n and self._green == other._green\n and self._red == other._red\n ):\n return True\n return False\n\n def __str__(self):\n return str(_to_internal_settings_processing_color_balance(self))\n\n class Experimental:\n class Mode:\n automatic = \"automatic\"\n toneMapping = \"toneMapping\"\n useFirstAcquisition = \"useFirstAcquisition\"\n\n _valid_values = {\n \"automatic\": _zivid.Settings.Processing.Color.Experimental.Mode.automatic,\n \"toneMapping\": _zivid.Settings.Processing.Color.Experimental.Mode.toneMapping,\n \"useFirstAcquisition\": _zivid.Settings.Processing.Color.Experimental.Mode.useFirstAcquisition,\n }\n\n @classmethod\n def valid_values(cls):\n return list(cls._valid_values.keys())\n\n def __init__(\n self,\n mode=_zivid.Settings.Processing.Color.Experimental.Mode().value,\n ):\n if (\n isinstance(\n mode,\n _zivid.Settings.Processing.Color.Experimental.Mode.enum,\n )\n or mode is None\n ):\n self._mode = _zivid.Settings.Processing.Color.Experimental.Mode(\n mode\n )\n elif isinstance(mode, str):\n self._mode = _zivid.Settings.Processing.Color.Experimental.Mode(\n self.Mode._valid_values[mode]\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: str or None, got {value_type}\".format(\n value_type=type(mode)\n )\n )\n\n @property\n def mode(self):\n if self._mode.value is None:\n return None\n for key, internal_value in self.Mode._valid_values.items():\n if internal_value == self._mode.value:\n return key\n raise ValueError(\n \"Unsupported value {value}\".format(value=self._mode)\n )\n\n @mode.setter\n def mode(self, value):\n if isinstance(value, str):\n self._mode = _zivid.Settings.Processing.Color.Experimental.Mode(\n self.Mode._valid_values[value]\n )\n elif (\n isinstance(\n value,\n _zivid.Settings.Processing.Color.Experimental.Mode.enum,\n )\n or value is None\n ):\n self._mode = _zivid.Settings.Processing.Color.Experimental.Mode(\n value\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: str or None, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n def __eq__(self, other):\n if self._mode == other._mode:\n return True\n return False\n\n def __str__(self):\n return str(\n _to_internal_settings_processing_color_experimental(self)\n )\n\n def __init__(\n self,\n gamma=_zivid.Settings.Processing.Color.Gamma().value,\n balance=None,\n experimental=None,\n ):\n if (\n isinstance(\n gamma,\n (\n float,\n int,\n ),\n )\n or gamma is None\n ):\n self._gamma = _zivid.Settings.Processing.Color.Gamma(gamma)\n else:\n raise TypeError(\n \"Unsupported type, expected: (float, int,) or None, got {value_type}\".format(\n value_type=type(gamma)\n )\n )\n\n if balance is None:\n balance = self.Balance()\n if not isinstance(balance, self.Balance):\n raise TypeError(\n \"Unsupported type: {value}\".format(value=type(balance))\n )\n self._balance = balance\n\n if experimental is None:\n experimental = self.Experimental()\n if not isinstance(experimental, self.Experimental):\n raise TypeError(\n \"Unsupported type: {value}\".format(value=type(experimental))\n )\n self._experimental = experimental\n\n @property\n def gamma(self):\n return self._gamma.value\n\n @property\n def balance(self):\n return self._balance\n\n @property\n def experimental(self):\n return self._experimental\n\n @gamma.setter\n def gamma(self, value):\n if (\n isinstance(\n value,\n (\n float,\n int,\n ),\n )\n or value is None\n ):\n self._gamma = _zivid.Settings.Processing.Color.Gamma(value)\n else:\n raise TypeError(\n \"Unsupported type, expected: float or int or None, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n @balance.setter\n def balance(self, value):\n if not isinstance(value, self.Balance):\n raise TypeError(\n \"Unsupported type {value}\".format(value=type(value))\n )\n self._balance = value\n\n @experimental.setter\n def experimental(self, value):\n if not isinstance(value, self.Experimental):\n raise TypeError(\n \"Unsupported type {value}\".format(value=type(value))\n )\n self._experimental = value\n\n def __eq__(self, other):\n if (\n self._gamma == other._gamma\n and self._balance == other._balance\n and self._experimental == other._experimental\n ):\n return True\n return False\n\n def __str__(self):\n return str(_to_internal_settings_processing_color(self))\n\n class Filters:\n class Cluster:\n class Removal:\n def __init__(\n self,\n enabled=_zivid.Settings.Processing.Filters.Cluster.Removal.Enabled().value,\n max_neighbor_distance=_zivid.Settings.Processing.Filters.Cluster.Removal.MaxNeighborDistance().value,\n min_area=_zivid.Settings.Processing.Filters.Cluster.Removal.MinArea().value,\n ):\n if isinstance(enabled, (bool,)) or enabled is None:\n self._enabled = _zivid.Settings.Processing.Filters.Cluster.Removal.Enabled(\n enabled\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: (bool,) or None, got {value_type}\".format(\n value_type=type(enabled)\n )\n )\n\n if (\n isinstance(\n max_neighbor_distance,\n (\n float,\n int,\n ),\n )\n or max_neighbor_distance is None\n ):\n self._max_neighbor_distance = _zivid.Settings.Processing.Filters.Cluster.Removal.MaxNeighborDistance(\n max_neighbor_distance\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: (float, int,) or None, got {value_type}\".format(\n value_type=type(max_neighbor_distance)\n )\n )\n\n if (\n isinstance(\n min_area,\n (\n float,\n int,\n ),\n )\n or min_area is None\n ):\n self._min_area = _zivid.Settings.Processing.Filters.Cluster.Removal.MinArea(\n min_area\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: (float, int,) or None, got {value_type}\".format(\n value_type=type(min_area)\n )\n )\n\n @property\n def enabled(self):\n return self._enabled.value\n\n @property\n def max_neighbor_distance(self):\n return self._max_neighbor_distance.value\n\n @property\n def min_area(self):\n return self._min_area.value\n\n @enabled.setter\n def enabled(self, value):\n if isinstance(value, (bool,)) or value is None:\n self._enabled = _zivid.Settings.Processing.Filters.Cluster.Removal.Enabled(\n value\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: bool or None, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n @max_neighbor_distance.setter\n def max_neighbor_distance(self, value):\n if (\n isinstance(\n value,\n (\n float,\n int,\n ),\n )\n or value is None\n ):\n self._max_neighbor_distance = _zivid.Settings.Processing.Filters.Cluster.Removal.MaxNeighborDistance(\n value\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: float or int or None, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n @min_area.setter\n def min_area(self, value):\n if (\n isinstance(\n value,\n (\n float,\n int,\n ),\n )\n or value is None\n ):\n self._min_area = _zivid.Settings.Processing.Filters.Cluster.Removal.MinArea(\n value\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: float or int or None, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n def __eq__(self, other):\n if (\n self._enabled == other._enabled\n and self._max_neighbor_distance\n == other._max_neighbor_distance\n and self._min_area == other._min_area\n ):\n return True\n return False\n\n def __str__(self):\n return str(\n _to_internal_settings_processing_filters_cluster_removal(\n self\n )\n )\n\n def __init__(\n self,\n removal=None,\n ):\n if removal is None:\n removal = self.Removal()\n if not isinstance(removal, self.Removal):\n raise TypeError(\n \"Unsupported type: {value}\".format(value=type(removal))\n )\n self._removal = removal\n\n @property\n def removal(self):\n return self._removal\n\n @removal.setter\n def removal(self, value):\n if not isinstance(value, self.Removal):\n raise TypeError(\n \"Unsupported type {value}\".format(value=type(value))\n )\n self._removal = value\n\n def __eq__(self, other):\n if self._removal == other._removal:\n return True\n return False\n\n def __str__(self):\n return str(_to_internal_settings_processing_filters_cluster(self))\n\n class Experimental:\n class ContrastDistortion:\n class Correction:\n def __init__(\n self,\n enabled=_zivid.Settings.Processing.Filters.Experimental.ContrastDistortion.Correction.Enabled().value,\n strength=_zivid.Settings.Processing.Filters.Experimental.ContrastDistortion.Correction.Strength().value,\n ):\n if isinstance(enabled, (bool,)) or enabled is None:\n self._enabled = _zivid.Settings.Processing.Filters.Experimental.ContrastDistortion.Correction.Enabled(\n enabled\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: (bool,) or None, got {value_type}\".format(\n value_type=type(enabled)\n )\n )\n\n if (\n isinstance(\n strength,\n (\n float,\n int,\n ),\n )\n or strength is None\n ):\n self._strength = _zivid.Settings.Processing.Filters.Experimental.ContrastDistortion.Correction.Strength(\n strength\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: (float, int,) or None, got {value_type}\".format(\n value_type=type(strength)\n )\n )\n\n @property\n def enabled(self):\n return self._enabled.value\n\n @property\n def strength(self):\n return self._strength.value\n\n @enabled.setter\n def enabled(self, value):\n if isinstance(value, (bool,)) or value is None:\n self._enabled = _zivid.Settings.Processing.Filters.Experimental.ContrastDistortion.Correction.Enabled(\n value\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: bool or None, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n @strength.setter\n def strength(self, value):\n if (\n isinstance(\n value,\n (\n float,\n int,\n ),\n )\n or value is None\n ):\n self._strength = _zivid.Settings.Processing.Filters.Experimental.ContrastDistortion.Correction.Strength(\n value\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: float or int or None, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n def __eq__(self, other):\n if (\n self._enabled == other._enabled\n and self._strength == other._strength\n ):\n return True\n return False\n\n def __str__(self):\n return str(\n _to_internal_settings_processing_filters_experimental_contrast_distortion_correction(\n self\n )\n )\n\n class Removal:\n def __init__(\n self,\n enabled=_zivid.Settings.Processing.Filters.Experimental.ContrastDistortion.Removal.Enabled().value,\n threshold=_zivid.Settings.Processing.Filters.Experimental.ContrastDistortion.Removal.Threshold().value,\n ):\n if isinstance(enabled, (bool,)) or enabled is None:\n self._enabled = _zivid.Settings.Processing.Filters.Experimental.ContrastDistortion.Removal.Enabled(\n enabled\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: (bool,) or None, got {value_type}\".format(\n value_type=type(enabled)\n )\n )\n\n if (\n isinstance(\n threshold,\n (\n float,\n int,\n ),\n )\n or threshold is None\n ):\n self._threshold = _zivid.Settings.Processing.Filters.Experimental.ContrastDistortion.Removal.Threshold(\n threshold\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: (float, int,) or None, got {value_type}\".format(\n value_type=type(threshold)\n )\n )\n\n @property\n def enabled(self):\n return self._enabled.value\n\n @property\n def threshold(self):\n return self._threshold.value\n\n @enabled.setter\n def enabled(self, value):\n if isinstance(value, (bool,)) or value is None:\n self._enabled = _zivid.Settings.Processing.Filters.Experimental.ContrastDistortion.Removal.Enabled(\n value\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: bool or None, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n @threshold.setter\n def threshold(self, value):\n if (\n isinstance(\n value,\n (\n float,\n int,\n ),\n )\n or value is None\n ):\n self._threshold = _zivid.Settings.Processing.Filters.Experimental.ContrastDistortion.Removal.Threshold(\n value\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: float or int or None, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n def __eq__(self, other):\n if (\n self._enabled == other._enabled\n and self._threshold == other._threshold\n ):\n return True\n return False\n\n def __str__(self):\n return str(\n _to_internal_settings_processing_filters_experimental_contrast_distortion_removal(\n self\n )\n )\n\n def __init__(\n self,\n correction=None,\n removal=None,\n ):\n if correction is None:\n correction = self.Correction()\n if not isinstance(correction, self.Correction):\n raise TypeError(\n \"Unsupported type: {value}\".format(\n value=type(correction)\n )\n )\n self._correction = correction\n\n if removal is None:\n removal = self.Removal()\n if not isinstance(removal, self.Removal):\n raise TypeError(\n \"Unsupported type: {value}\".format(value=type(removal))\n )\n self._removal = removal\n\n @property\n def correction(self):\n return self._correction\n\n @property\n def removal(self):\n return self._removal\n\n @correction.setter\n def correction(self, value):\n if not isinstance(value, self.Correction):\n raise TypeError(\n \"Unsupported type {value}\".format(value=type(value))\n )\n self._correction = value\n\n @removal.setter\n def removal(self, value):\n if not isinstance(value, self.Removal):\n raise TypeError(\n \"Unsupported type {value}\".format(value=type(value))\n )\n self._removal = value\n\n def __eq__(self, other):\n if (\n self._correction == other._correction\n and self._removal == other._removal\n ):\n return True\n return False\n\n def __str__(self):\n return str(\n _to_internal_settings_processing_filters_experimental_contrast_distortion(\n self\n )\n )\n\n class HoleFilling:\n def __init__(\n self,\n enabled=_zivid.Settings.Processing.Filters.Experimental.HoleFilling.Enabled().value,\n hole_size=_zivid.Settings.Processing.Filters.Experimental.HoleFilling.HoleSize().value,\n strictness=_zivid.Settings.Processing.Filters.Experimental.HoleFilling.Strictness().value,\n ):\n if isinstance(enabled, (bool,)) or enabled is None:\n self._enabled = _zivid.Settings.Processing.Filters.Experimental.HoleFilling.Enabled(\n enabled\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: (bool,) or None, got {value_type}\".format(\n value_type=type(enabled)\n )\n )\n\n if (\n isinstance(\n hole_size,\n (\n float,\n int,\n ),\n )\n or hole_size is None\n ):\n self._hole_size = _zivid.Settings.Processing.Filters.Experimental.HoleFilling.HoleSize(\n hole_size\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: (float, int,) or None, got {value_type}\".format(\n value_type=type(hole_size)\n )\n )\n\n if isinstance(strictness, (int,)) or strictness is None:\n self._strictness = _zivid.Settings.Processing.Filters.Experimental.HoleFilling.Strictness(\n strictness\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: (int,) or None, got {value_type}\".format(\n value_type=type(strictness)\n )\n )\n\n @property\n def enabled(self):\n return self._enabled.value\n\n @property\n def hole_size(self):\n return self._hole_size.value\n\n @property\n def strictness(self):\n return self._strictness.value\n\n @enabled.setter\n def enabled(self, value):\n if isinstance(value, (bool,)) or value is None:\n self._enabled = _zivid.Settings.Processing.Filters.Experimental.HoleFilling.Enabled(\n value\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: bool or None, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n @hole_size.setter\n def hole_size(self, value):\n if (\n isinstance(\n value,\n (\n float,\n int,\n ),\n )\n or value is None\n ):\n self._hole_size = _zivid.Settings.Processing.Filters.Experimental.HoleFilling.HoleSize(\n value\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: float or int or None, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n @strictness.setter\n def strictness(self, value):\n if isinstance(value, (int,)) or value is None:\n self._strictness = _zivid.Settings.Processing.Filters.Experimental.HoleFilling.Strictness(\n value\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: int or None, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n def __eq__(self, other):\n if (\n self._enabled == other._enabled\n and self._hole_size == other._hole_size\n and self._strictness == other._strictness\n ):\n return True\n return False\n\n def __str__(self):\n return str(\n _to_internal_settings_processing_filters_experimental_hole_filling(\n self\n )\n )\n\n def __init__(\n self,\n contrast_distortion=None,\n hole_filling=None,\n ):\n if contrast_distortion is None:\n contrast_distortion = self.ContrastDistortion()\n if not isinstance(contrast_distortion, self.ContrastDistortion):\n raise TypeError(\n \"Unsupported type: {value}\".format(\n value=type(contrast_distortion)\n )\n )\n self._contrast_distortion = contrast_distortion\n\n if hole_filling is None:\n hole_filling = self.HoleFilling()\n if not isinstance(hole_filling, self.HoleFilling):\n raise TypeError(\n \"Unsupported type: {value}\".format(value=type(hole_filling))\n )\n self._hole_filling = hole_filling\n\n @property\n def contrast_distortion(self):\n return self._contrast_distortion\n\n @property\n def hole_filling(self):\n return self._hole_filling\n\n @contrast_distortion.setter\n def contrast_distortion(self, value):\n if not isinstance(value, self.ContrastDistortion):\n raise TypeError(\n \"Unsupported type {value}\".format(value=type(value))\n )\n self._contrast_distortion = value\n\n @hole_filling.setter\n def hole_filling(self, value):\n if not isinstance(value, self.HoleFilling):\n raise TypeError(\n \"Unsupported type {value}\".format(value=type(value))\n )\n self._hole_filling = value\n\n def __eq__(self, other):\n if (\n self._contrast_distortion == other._contrast_distortion\n and self._hole_filling == other._hole_filling\n ):\n return True\n return False\n\n def __str__(self):\n return str(\n _to_internal_settings_processing_filters_experimental(self)\n )\n\n class Noise:\n class Removal:\n def __init__(\n self,\n enabled=_zivid.Settings.Processing.Filters.Noise.Removal.Enabled().value,\n threshold=_zivid.Settings.Processing.Filters.Noise.Removal.Threshold().value,\n ):\n if isinstance(enabled, (bool,)) or enabled is None:\n self._enabled = _zivid.Settings.Processing.Filters.Noise.Removal.Enabled(\n enabled\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: (bool,) or None, got {value_type}\".format(\n value_type=type(enabled)\n )\n )\n\n if (\n isinstance(\n threshold,\n (\n float,\n int,\n ),\n )\n or threshold is None\n ):\n self._threshold = _zivid.Settings.Processing.Filters.Noise.Removal.Threshold(\n threshold\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: (float, int,) or None, got {value_type}\".format(\n value_type=type(threshold)\n )\n )\n\n @property\n def enabled(self):\n return self._enabled.value\n\n @property\n def threshold(self):\n return self._threshold.value\n\n @enabled.setter\n def enabled(self, value):\n if isinstance(value, (bool,)) or value is None:\n self._enabled = _zivid.Settings.Processing.Filters.Noise.Removal.Enabled(\n value\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: bool or None, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n @threshold.setter\n def threshold(self, value):\n if (\n isinstance(\n value,\n (\n float,\n int,\n ),\n )\n or value is None\n ):\n self._threshold = _zivid.Settings.Processing.Filters.Noise.Removal.Threshold(\n value\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: float or int or None, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n def __eq__(self, other):\n if (\n self._enabled == other._enabled\n and self._threshold == other._threshold\n ):\n return True\n return False\n\n def __str__(self):\n return str(\n _to_internal_settings_processing_filters_noise_removal(self)\n )\n\n class Repair:\n def __init__(\n self,\n enabled=_zivid.Settings.Processing.Filters.Noise.Repair.Enabled().value,\n ):\n if isinstance(enabled, (bool,)) or enabled is None:\n self._enabled = (\n _zivid.Settings.Processing.Filters.Noise.Repair.Enabled(\n enabled\n )\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: (bool,) or None, got {value_type}\".format(\n value_type=type(enabled)\n )\n )\n\n @property\n def enabled(self):\n return self._enabled.value\n\n @enabled.setter\n def enabled(self, value):\n if isinstance(value, (bool,)) or value is None:\n self._enabled = (\n _zivid.Settings.Processing.Filters.Noise.Repair.Enabled(\n value\n )\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: bool or None, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n def __eq__(self, other):\n if self._enabled == other._enabled:\n return True\n return False\n\n def __str__(self):\n return str(\n _to_internal_settings_processing_filters_noise_repair(self)\n )\n\n class Suppression:\n def __init__(\n self,\n enabled=_zivid.Settings.Processing.Filters.Noise.Suppression.Enabled().value,\n ):\n if isinstance(enabled, (bool,)) or enabled is None:\n self._enabled = _zivid.Settings.Processing.Filters.Noise.Suppression.Enabled(\n enabled\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: (bool,) or None, got {value_type}\".format(\n value_type=type(enabled)\n )\n )\n\n @property\n def enabled(self):\n return self._enabled.value\n\n @enabled.setter\n def enabled(self, value):\n if isinstance(value, (bool,)) or value is None:\n self._enabled = _zivid.Settings.Processing.Filters.Noise.Suppression.Enabled(\n value\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: bool or None, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n def __eq__(self, other):\n if self._enabled == other._enabled:\n return True\n return False\n\n def __str__(self):\n return str(\n _to_internal_settings_processing_filters_noise_suppression(\n self\n )\n )\n\n def __init__(\n self,\n removal=None,\n repair=None,\n suppression=None,\n ):\n if removal is None:\n removal = self.Removal()\n if not isinstance(removal, self.Removal):\n raise TypeError(\n \"Unsupported type: {value}\".format(value=type(removal))\n )\n self._removal = removal\n\n if repair is None:\n repair = self.Repair()\n if not isinstance(repair, self.Repair):\n raise TypeError(\n \"Unsupported type: {value}\".format(value=type(repair))\n )\n self._repair = repair\n\n if suppression is None:\n suppression = self.Suppression()\n if not isinstance(suppression, self.Suppression):\n raise TypeError(\n \"Unsupported type: {value}\".format(value=type(suppression))\n )\n self._suppression = suppression\n\n @property\n def removal(self):\n return self._removal\n\n @property\n def repair(self):\n return self._repair\n\n @property\n def suppression(self):\n return self._suppression\n\n @removal.setter\n def removal(self, value):\n if not isinstance(value, self.Removal):\n raise TypeError(\n \"Unsupported type {value}\".format(value=type(value))\n )\n self._removal = value\n\n @repair.setter\n def repair(self, value):\n if not isinstance(value, self.Repair):\n raise TypeError(\n \"Unsupported type {value}\".format(value=type(value))\n )\n self._repair = value\n\n @suppression.setter\n def suppression(self, value):\n if not isinstance(value, self.Suppression):\n raise TypeError(\n \"Unsupported type {value}\".format(value=type(value))\n )\n self._suppression = value\n\n def __eq__(self, other):\n if (\n self._removal == other._removal\n and self._repair == other._repair\n and self._suppression == other._suppression\n ):\n return True\n return False\n\n def __str__(self):\n return str(_to_internal_settings_processing_filters_noise(self))\n\n class Outlier:\n class Removal:\n def __init__(\n self,\n enabled=_zivid.Settings.Processing.Filters.Outlier.Removal.Enabled().value,\n threshold=_zivid.Settings.Processing.Filters.Outlier.Removal.Threshold().value,\n ):\n if isinstance(enabled, (bool,)) or enabled is None:\n self._enabled = _zivid.Settings.Processing.Filters.Outlier.Removal.Enabled(\n enabled\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: (bool,) or None, got {value_type}\".format(\n value_type=type(enabled)\n )\n )\n\n if (\n isinstance(\n threshold,\n (\n float,\n int,\n ),\n )\n or threshold is None\n ):\n self._threshold = _zivid.Settings.Processing.Filters.Outlier.Removal.Threshold(\n threshold\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: (float, int,) or None, got {value_type}\".format(\n value_type=type(threshold)\n )\n )\n\n @property\n def enabled(self):\n return self._enabled.value\n\n @property\n def threshold(self):\n return self._threshold.value\n\n @enabled.setter\n def enabled(self, value):\n if isinstance(value, (bool,)) or value is None:\n self._enabled = _zivid.Settings.Processing.Filters.Outlier.Removal.Enabled(\n value\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: bool or None, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n @threshold.setter\n def threshold(self, value):\n if (\n isinstance(\n value,\n (\n float,\n int,\n ),\n )\n or value is None\n ):\n self._threshold = _zivid.Settings.Processing.Filters.Outlier.Removal.Threshold(\n value\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: float or int or None, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n def __eq__(self, other):\n if (\n self._enabled == other._enabled\n and self._threshold == other._threshold\n ):\n return True\n return False\n\n def __str__(self):\n return str(\n _to_internal_settings_processing_filters_outlier_removal(\n self\n )\n )\n\n def __init__(\n self,\n removal=None,\n ):\n if removal is None:\n removal = self.Removal()\n if not isinstance(removal, self.Removal):\n raise TypeError(\n \"Unsupported type: {value}\".format(value=type(removal))\n )\n self._removal = removal\n\n @property\n def removal(self):\n return self._removal\n\n @removal.setter\n def removal(self, value):\n if not isinstance(value, self.Removal):\n raise TypeError(\n \"Unsupported type {value}\".format(value=type(value))\n )\n self._removal = value\n\n def __eq__(self, other):\n if self._removal == other._removal:\n return True\n return False\n\n def __str__(self):\n return str(_to_internal_settings_processing_filters_outlier(self))\n\n class Reflection:\n class Removal:\n class Experimental:\n class Mode:\n global_ = \"global\"\n local = \"local\"\n\n _valid_values = {\n \"global\": _zivid.Settings.Processing.Filters.Reflection.Removal.Experimental.Mode.global_,\n \"local\": _zivid.Settings.Processing.Filters.Reflection.Removal.Experimental.Mode.local,\n }\n\n @classmethod\n def valid_values(cls):\n return list(cls._valid_values.keys())\n\n def __init__(\n self,\n mode=_zivid.Settings.Processing.Filters.Reflection.Removal.Experimental.Mode().value,\n ):\n if (\n isinstance(\n mode,\n _zivid.Settings.Processing.Filters.Reflection.Removal.Experimental.Mode.enum,\n )\n or mode is None\n ):\n self._mode = _zivid.Settings.Processing.Filters.Reflection.Removal.Experimental.Mode(\n mode\n )\n elif isinstance(mode, str):\n self._mode = _zivid.Settings.Processing.Filters.Reflection.Removal.Experimental.Mode(\n self.Mode._valid_values[mode]\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: str or None, got {value_type}\".format(\n value_type=type(mode)\n )\n )\n\n @property\n def mode(self):\n if self._mode.value is None:\n return None\n for key, internal_value in self.Mode._valid_values.items():\n if internal_value == self._mode.value:\n return key\n raise ValueError(\n \"Unsupported value {value}\".format(value=self._mode)\n )\n\n @mode.setter\n def mode(self, value):\n if isinstance(value, str):\n self._mode = _zivid.Settings.Processing.Filters.Reflection.Removal.Experimental.Mode(\n self.Mode._valid_values[value]\n )\n elif (\n isinstance(\n value,\n _zivid.Settings.Processing.Filters.Reflection.Removal.Experimental.Mode.enum,\n )\n or value is None\n ):\n self._mode = _zivid.Settings.Processing.Filters.Reflection.Removal.Experimental.Mode(\n value\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: str or None, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n def __eq__(self, other):\n if self._mode == other._mode:\n return True\n return False\n\n def __str__(self):\n return str(\n _to_internal_settings_processing_filters_reflection_removal_experimental(\n self\n )\n )\n\n def __init__(\n self,\n enabled=_zivid.Settings.Processing.Filters.Reflection.Removal.Enabled().value,\n experimental=None,\n ):\n if isinstance(enabled, (bool,)) or enabled is None:\n self._enabled = _zivid.Settings.Processing.Filters.Reflection.Removal.Enabled(\n enabled\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: (bool,) or None, got {value_type}\".format(\n value_type=type(enabled)\n )\n )\n\n if experimental is None:\n experimental = self.Experimental()\n if not isinstance(experimental, self.Experimental):\n raise TypeError(\n \"Unsupported type: {value}\".format(\n value=type(experimental)\n )\n )\n self._experimental = experimental\n\n @property\n def enabled(self):\n return self._enabled.value\n\n @property\n def experimental(self):\n return self._experimental\n\n @enabled.setter\n def enabled(self, value):\n if isinstance(value, (bool,)) or value is None:\n self._enabled = _zivid.Settings.Processing.Filters.Reflection.Removal.Enabled(\n value\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: bool or None, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n @experimental.setter\n def experimental(self, value):\n if not isinstance(value, self.Experimental):\n raise TypeError(\n \"Unsupported type {value}\".format(value=type(value))\n )\n self._experimental = value\n\n def __eq__(self, other):\n if (\n self._enabled == other._enabled\n and self._experimental == other._experimental\n ):\n return True\n return False\n\n def __str__(self):\n return str(\n _to_internal_settings_processing_filters_reflection_removal(\n self\n )\n )\n\n def __init__(\n self,\n removal=None,\n ):\n if removal is None:\n removal = self.Removal()\n if not isinstance(removal, self.Removal):\n raise TypeError(\n \"Unsupported type: {value}\".format(value=type(removal))\n )\n self._removal = removal\n\n @property\n def removal(self):\n return self._removal\n\n @removal.setter\n def removal(self, value):\n if not isinstance(value, self.Removal):\n raise TypeError(\n \"Unsupported type {value}\".format(value=type(value))\n )\n self._removal = value\n\n def __eq__(self, other):\n if self._removal == other._removal:\n return True\n return False\n\n def __str__(self):\n return str(\n _to_internal_settings_processing_filters_reflection(self)\n )\n\n class Smoothing:\n class Gaussian:\n def __init__(\n self,\n enabled=_zivid.Settings.Processing.Filters.Smoothing.Gaussian.Enabled().value,\n sigma=_zivid.Settings.Processing.Filters.Smoothing.Gaussian.Sigma().value,\n ):\n if isinstance(enabled, (bool,)) or enabled is None:\n self._enabled = _zivid.Settings.Processing.Filters.Smoothing.Gaussian.Enabled(\n enabled\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: (bool,) or None, got {value_type}\".format(\n value_type=type(enabled)\n )\n )\n\n if (\n isinstance(\n sigma,\n (\n float,\n int,\n ),\n )\n or sigma is None\n ):\n self._sigma = _zivid.Settings.Processing.Filters.Smoothing.Gaussian.Sigma(\n sigma\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: (float, int,) or None, got {value_type}\".format(\n value_type=type(sigma)\n )\n )\n\n @property\n def enabled(self):\n return self._enabled.value\n\n @property\n def sigma(self):\n return self._sigma.value\n\n @enabled.setter\n def enabled(self, value):\n if isinstance(value, (bool,)) or value is None:\n self._enabled = _zivid.Settings.Processing.Filters.Smoothing.Gaussian.Enabled(\n value\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: bool or None, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n @sigma.setter\n def sigma(self, value):\n if (\n isinstance(\n value,\n (\n float,\n int,\n ),\n )\n or value is None\n ):\n self._sigma = _zivid.Settings.Processing.Filters.Smoothing.Gaussian.Sigma(\n value\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: float or int or None, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n def __eq__(self, other):\n if (\n self._enabled == other._enabled\n and self._sigma == other._sigma\n ):\n return True\n return False\n\n def __str__(self):\n return str(\n _to_internal_settings_processing_filters_smoothing_gaussian(\n self\n )\n )\n\n def __init__(\n self,\n gaussian=None,\n ):\n if gaussian is None:\n gaussian = self.Gaussian()\n if not isinstance(gaussian, self.Gaussian):\n raise TypeError(\n \"Unsupported type: {value}\".format(value=type(gaussian))\n )\n self._gaussian = gaussian\n\n @property\n def gaussian(self):\n return self._gaussian\n\n @gaussian.setter\n def gaussian(self, value):\n if not isinstance(value, self.Gaussian):\n raise TypeError(\n \"Unsupported type {value}\".format(value=type(value))\n )\n self._gaussian = value\n\n def __eq__(self, other):\n if self._gaussian == other._gaussian:\n return True\n return False\n\n def __str__(self):\n return str(_to_internal_settings_processing_filters_smoothing(self))\n\n def __init__(\n self,\n cluster=None,\n experimental=None,\n noise=None,\n outlier=None,\n reflection=None,\n smoothing=None,\n ):\n if cluster is None:\n cluster = self.Cluster()\n if not isinstance(cluster, self.Cluster):\n raise TypeError(\n \"Unsupported type: {value}\".format(value=type(cluster))\n )\n self._cluster = cluster\n\n if experimental is None:\n experimental = self.Experimental()\n if not isinstance(experimental, self.Experimental):\n raise TypeError(\n \"Unsupported type: {value}\".format(value=type(experimental))\n )\n self._experimental = experimental\n\n if noise is None:\n noise = self.Noise()\n if not isinstance(noise, self.Noise):\n raise TypeError(\n \"Unsupported type: {value}\".format(value=type(noise))\n )\n self._noise = noise\n\n if outlier is None:\n outlier = self.Outlier()\n if not isinstance(outlier, self.Outlier):\n raise TypeError(\n \"Unsupported type: {value}\".format(value=type(outlier))\n )\n self._outlier = outlier\n\n if reflection is None:\n reflection = self.Reflection()\n if not isinstance(reflection, self.Reflection):\n raise TypeError(\n \"Unsupported type: {value}\".format(value=type(reflection))\n )\n self._reflection = reflection\n\n if smoothing is None:\n smoothing = self.Smoothing()\n if not isinstance(smoothing, self.Smoothing):\n raise TypeError(\n \"Unsupported type: {value}\".format(value=type(smoothing))\n )\n self._smoothing = smoothing\n\n @property\n def cluster(self):\n return self._cluster\n\n @property\n def experimental(self):\n return self._experimental\n\n @property\n def noise(self):\n return self._noise\n\n @property\n def outlier(self):\n return self._outlier\n\n @property\n def reflection(self):\n return self._reflection\n\n @property\n def smoothing(self):\n return self._smoothing\n\n @cluster.setter\n def cluster(self, value):\n if not isinstance(value, self.Cluster):\n raise TypeError(\n \"Unsupported type {value}\".format(value=type(value))\n )\n self._cluster = value\n\n @experimental.setter\n def experimental(self, value):\n if not isinstance(value, self.Experimental):\n raise TypeError(\n \"Unsupported type {value}\".format(value=type(value))\n )\n self._experimental = value\n\n @noise.setter\n def noise(self, value):\n if not isinstance(value, self.Noise):\n raise TypeError(\n \"Unsupported type {value}\".format(value=type(value))\n )\n self._noise = value\n\n @outlier.setter\n def outlier(self, value):\n if not isinstance(value, self.Outlier):\n raise TypeError(\n \"Unsupported type {value}\".format(value=type(value))\n )\n self._outlier = value\n\n @reflection.setter\n def reflection(self, value):\n if not isinstance(value, self.Reflection):\n raise TypeError(\n \"Unsupported type {value}\".format(value=type(value))\n )\n self._reflection = value\n\n @smoothing.setter\n def smoothing(self, value):\n if not isinstance(value, self.Smoothing):\n raise TypeError(\n \"Unsupported type {value}\".format(value=type(value))\n )\n self._smoothing = value\n\n def __eq__(self, other):\n if (\n self._cluster == other._cluster\n and self._experimental == other._experimental\n and self._noise == other._noise\n and self._outlier == other._outlier\n and self._reflection == other._reflection\n and self._smoothing == other._smoothing\n ):\n return True\n return False\n\n def __str__(self):\n return str(_to_internal_settings_processing_filters(self))\n\n def __init__(\n self,\n color=None,\n filters=None,\n ):\n if color is None:\n color = self.Color()\n if not isinstance(color, self.Color):\n raise TypeError(\"Unsupported type: {value}\".format(value=type(color)))\n self._color = color\n\n if filters is None:\n filters = self.Filters()\n if not isinstance(filters, self.Filters):\n raise TypeError(\"Unsupported type: {value}\".format(value=type(filters)))\n self._filters = filters\n\n @property\n def color(self):\n return self._color\n\n @property\n def filters(self):\n return self._filters\n\n @color.setter\n def color(self, value):\n if not isinstance(value, self.Color):\n raise TypeError(\"Unsupported type {value}\".format(value=type(value)))\n self._color = value\n\n @filters.setter\n def filters(self, value):\n if not isinstance(value, self.Filters):\n raise TypeError(\"Unsupported type {value}\".format(value=type(value)))\n self._filters = value\n\n def __eq__(self, other):\n if self._color == other._color and self._filters == other._filters:\n return True\n return False\n\n def __str__(self):\n return str(_to_internal_settings_processing(self))\n\n class RegionOfInterest:\n class Box:\n def __init__(\n self,\n enabled=_zivid.Settings.RegionOfInterest.Box.Enabled().value,\n extents=_zivid.Settings.RegionOfInterest.Box.Extents().value,\n point_a=_zivid.Settings.RegionOfInterest.Box.PointA().value,\n point_b=_zivid.Settings.RegionOfInterest.Box.PointB().value,\n point_o=_zivid.Settings.RegionOfInterest.Box.PointO().value,\n ):\n if isinstance(enabled, (bool,)) or enabled is None:\n self._enabled = _zivid.Settings.RegionOfInterest.Box.Enabled(\n enabled\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: (bool,) or None, got {value_type}\".format(\n value_type=type(enabled)\n )\n )\n\n if (\n isinstance(\n extents, (collections.abc.Iterable, _zivid.data_model.Range)\n )\n or extents is None\n ):\n self._extents = _zivid.Settings.RegionOfInterest.Box.Extents(\n extents\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: (collections.abc.Iterable, _zivid.data_model.Range) or None, got {value_type}\".format(\n value_type=type(extents)\n )\n )\n\n if (\n isinstance(\n point_a, (collections.abc.Iterable, _zivid.data_model.PointXYZ)\n )\n or point_a is None\n ):\n self._point_a = _zivid.Settings.RegionOfInterest.Box.PointA(point_a)\n else:\n raise TypeError(\n \"Unsupported type, expected: (collections.abc.Iterable, _zivid.data_model.PointXYZ) or None, got {value_type}\".format(\n value_type=type(point_a)\n )\n )\n\n if (\n isinstance(\n point_b, (collections.abc.Iterable, _zivid.data_model.PointXYZ)\n )\n or point_b is None\n ):\n self._point_b = _zivid.Settings.RegionOfInterest.Box.PointB(point_b)\n else:\n raise TypeError(\n \"Unsupported type, expected: (collections.abc.Iterable, _zivid.data_model.PointXYZ) or None, got {value_type}\".format(\n value_type=type(point_b)\n )\n )\n\n if (\n isinstance(\n point_o, (collections.abc.Iterable, _zivid.data_model.PointXYZ)\n )\n or point_o is None\n ):\n self._point_o = _zivid.Settings.RegionOfInterest.Box.PointO(point_o)\n else:\n raise TypeError(\n \"Unsupported type, expected: (collections.abc.Iterable, _zivid.data_model.PointXYZ) or None, got {value_type}\".format(\n value_type=type(point_o)\n )\n )\n\n @property\n def enabled(self):\n return self._enabled.value\n\n @property\n def extents(self):\n if self._extents.value is None:\n return None\n return self._extents.value.to_array()\n\n @property\n def point_a(self):\n if self._point_a.value is None:\n return None\n return self._point_a.value.to_array()\n\n @property\n def point_b(self):\n if self._point_b.value is None:\n return None\n return self._point_b.value.to_array()\n\n @property\n def point_o(self):\n if self._point_o.value is None:\n return None\n return self._point_o.value.to_array()\n\n @enabled.setter\n def enabled(self, value):\n if isinstance(value, (bool,)) or value is None:\n self._enabled = _zivid.Settings.RegionOfInterest.Box.Enabled(value)\n else:\n raise TypeError(\n \"Unsupported type, expected: bool or None, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n @extents.setter\n def extents(self, value):\n if (\n isinstance(\n value, (collections.abc.Iterable, _zivid.data_model.Range)\n )\n or value is None\n ):\n self._extents = _zivid.Settings.RegionOfInterest.Box.Extents(value)\n else:\n raise TypeError(\n \"Unsupported type, expected: collections.abc.Iterable or _zivid.data_model.Rang or None, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n @point_a.setter\n def point_a(self, value):\n if (\n isinstance(\n value, (collections.abc.Iterable, _zivid.data_model.PointXYZ)\n )\n or value is None\n ):\n self._point_a = _zivid.Settings.RegionOfInterest.Box.PointA(value)\n else:\n raise TypeError(\n \"Unsupported type, expected: collections.abc.Iterable or _zivid.data_model.PointXY or None, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n @point_b.setter\n def point_b(self, value):\n if (\n isinstance(\n value, (collections.abc.Iterable, _zivid.data_model.PointXYZ)\n )\n or value is None\n ):\n self._point_b = _zivid.Settings.RegionOfInterest.Box.PointB(value)\n else:\n raise TypeError(\n \"Unsupported type, expected: collections.abc.Iterable or _zivid.data_model.PointXY or None, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n @point_o.setter\n def point_o(self, value):\n if (\n isinstance(\n value, (collections.abc.Iterable, _zivid.data_model.PointXYZ)\n )\n or value is None\n ):\n self._point_o = _zivid.Settings.RegionOfInterest.Box.PointO(value)\n else:\n raise TypeError(\n \"Unsupported type, expected: collections.abc.Iterable or _zivid.data_model.PointXY or None, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n def __eq__(self, other):\n if (\n self._enabled == other._enabled\n and self._extents == other._extents\n and self._point_a == other._point_a\n and self._point_b == other._point_b\n and self._point_o == other._point_o\n ):\n return True\n return False\n\n def __str__(self):\n return str(_to_internal_settings_region_of_interest_box(self))\n\n class Depth:\n def __init__(\n self,\n enabled=_zivid.Settings.RegionOfInterest.Depth.Enabled().value,\n range=_zivid.Settings.RegionOfInterest.Depth.Range().value,\n ):\n if isinstance(enabled, (bool,)) or enabled is None:\n self._enabled = _zivid.Settings.RegionOfInterest.Depth.Enabled(\n enabled\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: (bool,) or None, got {value_type}\".format(\n value_type=type(enabled)\n )\n )\n\n if (\n isinstance(\n range, (collections.abc.Iterable, _zivid.data_model.Range)\n )\n or range is None\n ):\n self._range = _zivid.Settings.RegionOfInterest.Depth.Range(range)\n else:\n raise TypeError(\n \"Unsupported type, expected: (collections.abc.Iterable, _zivid.data_model.Range) or None, got {value_type}\".format(\n value_type=type(range)\n )\n )\n\n @property\n def enabled(self):\n return self._enabled.value\n\n @property\n def range(self):\n if self._range.value is None:\n return None\n return self._range.value.to_array()\n\n @enabled.setter\n def enabled(self, value):\n if isinstance(value, (bool,)) or value is None:\n self._enabled = _zivid.Settings.RegionOfInterest.Depth.Enabled(\n value\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: bool or None, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n @range.setter\n def range(self, value):\n if (\n isinstance(\n value, (collections.abc.Iterable, _zivid.data_model.Range)\n )\n or value is None\n ):\n self._range = _zivid.Settings.RegionOfInterest.Depth.Range(value)\n else:\n raise TypeError(\n \"Unsupported type, expected: collections.abc.Iterable or _zivid.data_model.Rang or None, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n def __eq__(self, other):\n if self._enabled == other._enabled and self._range == other._range:\n return True\n return False\n\n def __str__(self):\n return str(_to_internal_settings_region_of_interest_depth(self))\n\n def __init__(\n self,\n box=None,\n depth=None,\n ):\n if box is None:\n box = self.Box()\n if not isinstance(box, self.Box):\n raise TypeError(\"Unsupported type: {value}\".format(value=type(box)))\n self._box = box\n\n if depth is None:\n depth = self.Depth()\n if not isinstance(depth, self.Depth):\n raise TypeError(\"Unsupported type: {value}\".format(value=type(depth)))\n self._depth = depth\n\n @property\n def box(self):\n return self._box\n\n @property\n def depth(self):\n return self._depth\n\n @box.setter\n def box(self, value):\n if not isinstance(value, self.Box):\n raise TypeError(\"Unsupported type {value}\".format(value=type(value)))\n self._box = value\n\n @depth.setter\n def depth(self, value):\n if not isinstance(value, self.Depth):\n raise TypeError(\"Unsupported type {value}\".format(value=type(value)))\n self._depth = value\n\n def __eq__(self, other):\n if self._box == other._box and self._depth == other._depth:\n return True\n return False\n\n def __str__(self):\n return str(_to_internal_settings_region_of_interest(self))\n\n class Sampling:\n class Color:\n disabled = \"disabled\"\n rgb = \"rgb\"\n\n _valid_values = {\n \"disabled\": _zivid.Settings.Sampling.Color.disabled,\n \"rgb\": _zivid.Settings.Sampling.Color.rgb,\n }\n\n @classmethod\n def valid_values(cls):\n return list(cls._valid_values.keys())\n\n class Pixel:\n all = \"all\"\n blueSubsample2x2 = \"blueSubsample2x2\"\n redSubsample2x2 = \"redSubsample2x2\"\n\n _valid_values = {\n \"all\": _zivid.Settings.Sampling.Pixel.all,\n \"blueSubsample2x2\": _zivid.Settings.Sampling.Pixel.blueSubsample2x2,\n \"redSubsample2x2\": _zivid.Settings.Sampling.Pixel.redSubsample2x2,\n }\n\n @classmethod\n def valid_values(cls):\n return list(cls._valid_values.keys())\n\n def __init__(\n self,\n color=_zivid.Settings.Sampling.Color().value,\n pixel=_zivid.Settings.Sampling.Pixel().value,\n ):\n if isinstance(color, _zivid.Settings.Sampling.Color.enum) or color is None:\n self._color = _zivid.Settings.Sampling.Color(color)\n elif isinstance(color, str):\n self._color = _zivid.Settings.Sampling.Color(\n self.Color._valid_values[color]\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: str or None, got {value_type}\".format(\n value_type=type(color)\n )\n )\n\n if isinstance(pixel, _zivid.Settings.Sampling.Pixel.enum) or pixel is None:\n self._pixel = _zivid.Settings.Sampling.Pixel(pixel)\n elif isinstance(pixel, str):\n self._pixel = _zivid.Settings.Sampling.Pixel(\n self.Pixel._valid_values[pixel]\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: str or None, got {value_type}\".format(\n value_type=type(pixel)\n )\n )\n\n @property\n def color(self):\n if self._color.value is None:\n return None\n for key, internal_value in self.Color._valid_values.items():\n if internal_value == self._color.value:\n return key\n raise ValueError(\"Unsupported value {value}\".format(value=self._color))\n\n @property\n def pixel(self):\n if self._pixel.value is None:\n return None\n for key, internal_value in self.Pixel._valid_values.items():\n if internal_value == self._pixel.value:\n return key\n raise ValueError(\"Unsupported value {value}\".format(value=self._pixel))\n\n @color.setter\n def color(self, value):\n if isinstance(value, str):\n self._color = _zivid.Settings.Sampling.Color(\n self.Color._valid_values[value]\n )\n elif (\n isinstance(value, _zivid.Settings.Sampling.Color.enum) or value is None\n ):\n self._color = _zivid.Settings.Sampling.Color(value)\n else:\n raise TypeError(\n \"Unsupported type, expected: str or None, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n @pixel.setter\n def pixel(self, value):\n if isinstance(value, str):\n self._pixel = _zivid.Settings.Sampling.Pixel(\n self.Pixel._valid_values[value]\n )\n elif (\n isinstance(value, _zivid.Settings.Sampling.Pixel.enum) or value is None\n ):\n self._pixel = _zivid.Settings.Sampling.Pixel(value)\n else:\n raise TypeError(\n \"Unsupported type, expected: str or None, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n def __eq__(self, other):\n if self._color == other._color and self._pixel == other._pixel:\n return True\n return False\n\n def __str__(self):\n return str(_to_internal_settings_sampling(self))\n\n def __init__(\n self,\n acquisitions=None,\n diagnostics=None,\n experimental=None,\n processing=None,\n region_of_interest=None,\n sampling=None,\n ):\n if acquisitions is None:\n self._acquisitions = []\n elif isinstance(acquisitions, (collections.abc.Iterable,)):\n self._acquisitions = []\n for item in acquisitions:\n if isinstance(item, self.Acquisition):\n self._acquisitions.append(item)\n else:\n raise TypeError(\n \"Unsupported type {item_type}\".format(item_type=type(item))\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: (collections.abc.Iterable,) or None, got {value_type}\".format(\n value_type=type(acquisitions)\n )\n )\n\n if diagnostics is None:\n diagnostics = self.Diagnostics()\n if not isinstance(diagnostics, self.Diagnostics):\n raise TypeError(\"Unsupported type: {value}\".format(value=type(diagnostics)))\n self._diagnostics = diagnostics\n\n if experimental is None:\n experimental = self.Experimental()\n if not isinstance(experimental, self.Experimental):\n raise TypeError(\n \"Unsupported type: {value}\".format(value=type(experimental))\n )\n self._experimental = experimental\n\n if processing is None:\n processing = self.Processing()\n if not isinstance(processing, self.Processing):\n raise TypeError(\"Unsupported type: {value}\".format(value=type(processing)))\n self._processing = processing\n\n if region_of_interest is None:\n region_of_interest = self.RegionOfInterest()\n if not isinstance(region_of_interest, self.RegionOfInterest):\n raise TypeError(\n \"Unsupported type: {value}\".format(value=type(region_of_interest))\n )\n self._region_of_interest = region_of_interest\n\n if sampling is None:\n sampling = self.Sampling()\n if not isinstance(sampling, self.Sampling):\n raise TypeError(\"Unsupported type: {value}\".format(value=type(sampling)))\n self._sampling = sampling\n\n @property\n def acquisitions(self):\n return self._acquisitions\n\n @property\n def diagnostics(self):\n return self._diagnostics\n\n @property\n def experimental(self):\n return self._experimental\n\n @property\n def processing(self):\n return self._processing\n\n @property\n def region_of_interest(self):\n return self._region_of_interest\n\n @property\n def sampling(self):\n return self._sampling\n\n @acquisitions.setter\n def acquisitions(self, value):\n if not isinstance(value, (collections.abc.Iterable,)):\n raise TypeError(\"Unsupported type {value}\".format(value=type(value)))\n self._acquisitions = []\n for item in value:\n if isinstance(item, self.Acquisition):\n self._acquisitions.append(item)\n else:\n raise TypeError(\n \"Unsupported type {item_type}\".format(item_type=type(item))\n )\n\n @diagnostics.setter\n def diagnostics(self, value):\n if not isinstance(value, self.Diagnostics):\n raise TypeError(\"Unsupported type {value}\".format(value=type(value)))\n self._diagnostics = value\n\n @experimental.setter\n def experimental(self, value):\n if not isinstance(value, self.Experimental):\n raise TypeError(\"Unsupported type {value}\".format(value=type(value)))\n self._experimental = value\n\n @processing.setter\n def processing(self, value):\n if not isinstance(value, self.Processing):\n raise TypeError(\"Unsupported type {value}\".format(value=type(value)))\n self._processing = value\n\n @region_of_interest.setter\n def region_of_interest(self, value):\n if not isinstance(value, self.RegionOfInterest):\n raise TypeError(\"Unsupported type {value}\".format(value=type(value)))\n self._region_of_interest = value\n\n @sampling.setter\n def sampling(self, value):\n if not isinstance(value, self.Sampling):\n raise TypeError(\"Unsupported type {value}\".format(value=type(value)))\n self._sampling = value\n\n @classmethod\n def load(cls, file_name):\n return _to_settings(_zivid.Settings(str(file_name)))\n\n def save(self, file_name):\n _to_internal_settings(self).save(str(file_name))\n\n def __eq__(self, other):\n if (\n self._acquisitions == other._acquisitions\n and self._diagnostics == other._diagnostics\n and self._experimental == other._experimental\n and self._processing == other._processing\n and self._region_of_interest == other._region_of_interest\n and self._sampling == other._sampling\n ):\n return True\n return False\n\n def __str__(self):\n return str(_to_internal_settings(self))\n\n\ndef _to_settings_acquisition(internal_acquisition):\n return Settings.Acquisition(\n aperture=internal_acquisition.aperture.value,\n brightness=internal_acquisition.brightness.value,\n exposure_time=internal_acquisition.exposure_time.value,\n gain=internal_acquisition.gain.value,\n )\n\n\ndef _to_settings_diagnostics(internal_diagnostics):\n return Settings.Diagnostics(\n enabled=internal_diagnostics.enabled.value,\n )\n\n\ndef _to_settings_experimental(internal_experimental):\n return Settings.Experimental(\n engine=internal_experimental.engine.value,\n )\n\n\ndef _to_settings_processing_color_balance(internal_balance):\n return Settings.Processing.Color.Balance(\n blue=internal_balance.blue.value,\n green=internal_balance.green.value,\n red=internal_balance.red.value,\n )\n\n\ndef _to_settings_processing_color_experimental(internal_experimental):\n return Settings.Processing.Color.Experimental(\n mode=internal_experimental.mode.value,\n )\n\n\ndef _to_settings_processing_color(internal_color):\n return Settings.Processing.Color(\n balance=_to_settings_processing_color_balance(internal_color.balance),\n experimental=_to_settings_processing_color_experimental(\n internal_color.experimental\n ),\n gamma=internal_color.gamma.value,\n )\n\n\ndef _to_settings_processing_filters_cluster_removal(internal_removal):\n return Settings.Processing.Filters.Cluster.Removal(\n enabled=internal_removal.enabled.value,\n max_neighbor_distance=internal_removal.max_neighbor_distance.value,\n min_area=internal_removal.min_area.value,\n )\n\n\ndef _to_settings_processing_filters_cluster(internal_cluster):\n return Settings.Processing.Filters.Cluster(\n removal=_to_settings_processing_filters_cluster_removal(\n internal_cluster.removal\n ),\n )\n\n\ndef _to_settings_processing_filters_experimental_contrast_distortion_correction(\n internal_correction,\n):\n return Settings.Processing.Filters.Experimental.ContrastDistortion.Correction(\n enabled=internal_correction.enabled.value,\n strength=internal_correction.strength.value,\n )\n\n\ndef _to_settings_processing_filters_experimental_contrast_distortion_removal(\n internal_removal,\n):\n return Settings.Processing.Filters.Experimental.ContrastDistortion.Removal(\n enabled=internal_removal.enabled.value,\n threshold=internal_removal.threshold.value,\n )\n\n\ndef _to_settings_processing_filters_experimental_contrast_distortion(\n internal_contrast_distortion,\n):\n return Settings.Processing.Filters.Experimental.ContrastDistortion(\n correction=_to_settings_processing_filters_experimental_contrast_distortion_correction(\n internal_contrast_distortion.correction\n ),\n removal=_to_settings_processing_filters_experimental_contrast_distortion_removal(\n internal_contrast_distortion.removal\n ),\n )\n\n\ndef _to_settings_processing_filters_experimental_hole_filling(internal_hole_filling):\n return Settings.Processing.Filters.Experimental.HoleFilling(\n enabled=internal_hole_filling.enabled.value,\n hole_size=internal_hole_filling.hole_size.value,\n strictness=internal_hole_filling.strictness.value,\n )\n\n\ndef _to_settings_processing_filters_experimental(internal_experimental):\n return Settings.Processing.Filters.Experimental(\n contrast_distortion=_to_settings_processing_filters_experimental_contrast_distortion(\n internal_experimental.contrast_distortion\n ),\n hole_filling=_to_settings_processing_filters_experimental_hole_filling(\n internal_experimental.hole_filling\n ),\n )\n\n\ndef _to_settings_processing_filters_noise_removal(internal_removal):\n return Settings.Processing.Filters.Noise.Removal(\n enabled=internal_removal.enabled.value,\n threshold=internal_removal.threshold.value,\n )\n\n\ndef _to_settings_processing_filters_noise_repair(internal_repair):\n return Settings.Processing.Filters.Noise.Repair(\n enabled=internal_repair.enabled.value,\n )\n\n\ndef _to_settings_processing_filters_noise_suppression(internal_suppression):\n return Settings.Processing.Filters.Noise.Suppression(\n enabled=internal_suppression.enabled.value,\n )\n\n\ndef _to_settings_processing_filters_noise(internal_noise):\n return Settings.Processing.Filters.Noise(\n removal=_to_settings_processing_filters_noise_removal(internal_noise.removal),\n repair=_to_settings_processing_filters_noise_repair(internal_noise.repair),\n suppression=_to_settings_processing_filters_noise_suppression(\n internal_noise.suppression\n ),\n )\n\n\ndef _to_settings_processing_filters_outlier_removal(internal_removal):\n return Settings.Processing.Filters.Outlier.Removal(\n enabled=internal_removal.enabled.value,\n threshold=internal_removal.threshold.value,\n )\n\n\ndef _to_settings_processing_filters_outlier(internal_outlier):\n return Settings.Processing.Filters.Outlier(\n removal=_to_settings_processing_filters_outlier_removal(\n internal_outlier.removal\n ),\n )\n\n\ndef _to_settings_processing_filters_reflection_removal_experimental(\n internal_experimental,\n):\n return Settings.Processing.Filters.Reflection.Removal.Experimental(\n mode=internal_experimental.mode.value,\n )\n\n\ndef _to_settings_processing_filters_reflection_removal(internal_removal):\n return Settings.Processing.Filters.Reflection.Removal(\n experimental=_to_settings_processing_filters_reflection_removal_experimental(\n internal_removal.experimental\n ),\n enabled=internal_removal.enabled.value,\n )\n\n\ndef _to_settings_processing_filters_reflection(internal_reflection):\n return Settings.Processing.Filters.Reflection(\n removal=_to_settings_processing_filters_reflection_removal(\n internal_reflection.removal\n ),\n )\n\n\ndef _to_settings_processing_filters_smoothing_gaussian(internal_gaussian):\n return Settings.Processing.Filters.Smoothing.Gaussian(\n enabled=internal_gaussian.enabled.value,\n sigma=internal_gaussian.sigma.value,\n )\n\n\ndef _to_settings_processing_filters_smoothing(internal_smoothing):\n return Settings.Processing.Filters.Smoothing(\n gaussian=_to_settings_processing_filters_smoothing_gaussian(\n internal_smoothing.gaussian\n ),\n )\n\n\ndef _to_settings_processing_filters(internal_filters):\n return Settings.Processing.Filters(\n cluster=_to_settings_processing_filters_cluster(internal_filters.cluster),\n experimental=_to_settings_processing_filters_experimental(\n internal_filters.experimental\n ),\n noise=_to_settings_processing_filters_noise(internal_filters.noise),\n outlier=_to_settings_processing_filters_outlier(internal_filters.outlier),\n reflection=_to_settings_processing_filters_reflection(\n internal_filters.reflection\n ),\n smoothing=_to_settings_processing_filters_smoothing(internal_filters.smoothing),\n )\n\n\ndef _to_settings_processing(internal_processing):\n return Settings.Processing(\n color=_to_settings_processing_color(internal_processing.color),\n filters=_to_settings_processing_filters(internal_processing.filters),\n )\n\n\ndef _to_settings_region_of_interest_box(internal_box):\n return Settings.RegionOfInterest.Box(\n enabled=internal_box.enabled.value,\n extents=internal_box.extents.value,\n point_a=internal_box.point_a.value,\n point_b=internal_box.point_b.value,\n point_o=internal_box.point_o.value,\n )\n\n\ndef _to_settings_region_of_interest_depth(internal_depth):\n return Settings.RegionOfInterest.Depth(\n enabled=internal_depth.enabled.value,\n range=internal_depth.range.value,\n )\n\n\ndef _to_settings_region_of_interest(internal_region_of_interest):\n return Settings.RegionOfInterest(\n box=_to_settings_region_of_interest_box(internal_region_of_interest.box),\n depth=_to_settings_region_of_interest_depth(internal_region_of_interest.depth),\n )\n\n\ndef _to_settings_sampling(internal_sampling):\n return Settings.Sampling(\n color=internal_sampling.color.value,\n pixel=internal_sampling.pixel.value,\n )\n\n\ndef _to_settings(internal_settings):\n return Settings(\n acquisitions=[\n _to_settings_acquisition(value)\n for value in internal_settings.acquisitions.value\n ],\n diagnostics=_to_settings_diagnostics(internal_settings.diagnostics),\n experimental=_to_settings_experimental(internal_settings.experimental),\n processing=_to_settings_processing(internal_settings.processing),\n region_of_interest=_to_settings_region_of_interest(\n internal_settings.region_of_interest\n ),\n sampling=_to_settings_sampling(internal_settings.sampling),\n )\n\n\ndef _to_internal_settings_acquisition(acquisition):\n internal_acquisition = _zivid.Settings.Acquisition()\n\n internal_acquisition.aperture = _zivid.Settings.Acquisition.Aperture(\n acquisition.aperture\n )\n internal_acquisition.brightness = _zivid.Settings.Acquisition.Brightness(\n acquisition.brightness\n )\n internal_acquisition.exposure_time = _zivid.Settings.Acquisition.ExposureTime(\n acquisition.exposure_time\n )\n internal_acquisition.gain = _zivid.Settings.Acquisition.Gain(acquisition.gain)\n\n return internal_acquisition\n\n\ndef _to_internal_settings_diagnostics(diagnostics):\n internal_diagnostics = _zivid.Settings.Diagnostics()\n\n internal_diagnostics.enabled = _zivid.Settings.Diagnostics.Enabled(\n diagnostics.enabled\n )\n\n return internal_diagnostics\n\n\ndef _to_internal_settings_experimental(experimental):\n internal_experimental = _zivid.Settings.Experimental()\n\n internal_experimental.engine = _zivid.Settings.Experimental.Engine(\n experimental._engine.value\n )\n\n return internal_experimental\n\n\ndef _to_internal_settings_processing_color_balance(balance):\n internal_balance = _zivid.Settings.Processing.Color.Balance()\n\n internal_balance.blue = _zivid.Settings.Processing.Color.Balance.Blue(balance.blue)\n internal_balance.green = _zivid.Settings.Processing.Color.Balance.Green(\n balance.green\n )\n internal_balance.red = _zivid.Settings.Processing.Color.Balance.Red(balance.red)\n\n return internal_balance\n\n\ndef _to_internal_settings_processing_color_experimental(experimental):\n internal_experimental = _zivid.Settings.Processing.Color.Experimental()\n\n internal_experimental.mode = _zivid.Settings.Processing.Color.Experimental.Mode(\n experimental._mode.value\n )\n\n return internal_experimental\n\n\ndef _to_internal_settings_processing_color(color):\n internal_color = _zivid.Settings.Processing.Color()\n\n internal_color.gamma = _zivid.Settings.Processing.Color.Gamma(color.gamma)\n\n internal_color.balance = _to_internal_settings_processing_color_balance(\n color.balance\n )\n internal_color.experimental = _to_internal_settings_processing_color_experimental(\n color.experimental\n )\n return internal_color\n\n\ndef _to_internal_settings_processing_filters_cluster_removal(removal):\n internal_removal = _zivid.Settings.Processing.Filters.Cluster.Removal()\n\n internal_removal.enabled = (\n _zivid.Settings.Processing.Filters.Cluster.Removal.Enabled(removal.enabled)\n )\n internal_removal.max_neighbor_distance = (\n _zivid.Settings.Processing.Filters.Cluster.Removal.MaxNeighborDistance(\n removal.max_neighbor_distance\n )\n )\n internal_removal.min_area = (\n _zivid.Settings.Processing.Filters.Cluster.Removal.MinArea(removal.min_area)\n )\n\n return internal_removal\n\n\ndef _to_internal_settings_processing_filters_cluster(cluster):\n internal_cluster = _zivid.Settings.Processing.Filters.Cluster()\n\n internal_cluster.removal = _to_internal_settings_processing_filters_cluster_removal(\n cluster.removal\n )\n return internal_cluster\n\n\ndef _to_internal_settings_processing_filters_experimental_contrast_distortion_correction(\n correction,\n):\n internal_correction = (\n _zivid.Settings.Processing.Filters.Experimental.ContrastDistortion.Correction()\n )\n\n internal_correction.enabled = _zivid.Settings.Processing.Filters.Experimental.ContrastDistortion.Correction.Enabled(\n correction.enabled\n )\n internal_correction.strength = _zivid.Settings.Processing.Filters.Experimental.ContrastDistortion.Correction.Strength(\n correction.strength\n )\n\n return internal_correction\n\n\ndef _to_internal_settings_processing_filters_experimental_contrast_distortion_removal(\n removal,\n):\n internal_removal = (\n _zivid.Settings.Processing.Filters.Experimental.ContrastDistortion.Removal()\n )\n\n internal_removal.enabled = _zivid.Settings.Processing.Filters.Experimental.ContrastDistortion.Removal.Enabled(\n removal.enabled\n )\n internal_removal.threshold = _zivid.Settings.Processing.Filters.Experimental.ContrastDistortion.Removal.Threshold(\n removal.threshold\n )\n\n return internal_removal\n\n\ndef _to_internal_settings_processing_filters_experimental_contrast_distortion(\n contrast_distortion,\n):\n internal_contrast_distortion = (\n _zivid.Settings.Processing.Filters.Experimental.ContrastDistortion()\n )\n\n internal_contrast_distortion.correction = _to_internal_settings_processing_filters_experimental_contrast_distortion_correction(\n contrast_distortion.correction\n )\n internal_contrast_distortion.removal = _to_internal_settings_processing_filters_experimental_contrast_distortion_removal(\n contrast_distortion.removal\n )\n return internal_contrast_distortion\n\n\ndef _to_internal_settings_processing_filters_experimental_hole_filling(hole_filling):\n internal_hole_filling = (\n _zivid.Settings.Processing.Filters.Experimental.HoleFilling()\n )\n\n internal_hole_filling.enabled = (\n _zivid.Settings.Processing.Filters.Experimental.HoleFilling.Enabled(\n hole_filling.enabled\n )\n )\n internal_hole_filling.hole_size = (\n _zivid.Settings.Processing.Filters.Experimental.HoleFilling.HoleSize(\n hole_filling.hole_size\n )\n )\n internal_hole_filling.strictness = (\n _zivid.Settings.Processing.Filters.Experimental.HoleFilling.Strictness(\n hole_filling.strictness\n )\n )\n\n return internal_hole_filling\n\n\ndef _to_internal_settings_processing_filters_experimental(experimental):\n internal_experimental = _zivid.Settings.Processing.Filters.Experimental()\n\n internal_experimental.contrast_distortion = (\n _to_internal_settings_processing_filters_experimental_contrast_distortion(\n experimental.contrast_distortion\n )\n )\n internal_experimental.hole_filling = (\n _to_internal_settings_processing_filters_experimental_hole_filling(\n experimental.hole_filling\n )\n )\n return internal_experimental\n\n\ndef _to_internal_settings_processing_filters_noise_removal(removal):\n internal_removal = _zivid.Settings.Processing.Filters.Noise.Removal()\n\n internal_removal.enabled = _zivid.Settings.Processing.Filters.Noise.Removal.Enabled(\n removal.enabled\n )\n internal_removal.threshold = (\n _zivid.Settings.Processing.Filters.Noise.Removal.Threshold(removal.threshold)\n )\n\n return internal_removal\n\n\ndef _to_internal_settings_processing_filters_noise_repair(repair):\n internal_repair = _zivid.Settings.Processing.Filters.Noise.Repair()\n\n internal_repair.enabled = _zivid.Settings.Processing.Filters.Noise.Repair.Enabled(\n repair.enabled\n )\n\n return internal_repair\n\n\ndef _to_internal_settings_processing_filters_noise_suppression(suppression):\n internal_suppression = _zivid.Settings.Processing.Filters.Noise.Suppression()\n\n internal_suppression.enabled = (\n _zivid.Settings.Processing.Filters.Noise.Suppression.Enabled(\n suppression.enabled\n )\n )\n\n return internal_suppression\n\n\ndef _to_internal_settings_processing_filters_noise(noise):\n internal_noise = _zivid.Settings.Processing.Filters.Noise()\n\n internal_noise.removal = _to_internal_settings_processing_filters_noise_removal(\n noise.removal\n )\n internal_noise.repair = _to_internal_settings_processing_filters_noise_repair(\n noise.repair\n )\n internal_noise.suppression = (\n _to_internal_settings_processing_filters_noise_suppression(noise.suppression)\n )\n return internal_noise\n\n\ndef _to_internal_settings_processing_filters_outlier_removal(removal):\n internal_removal = _zivid.Settings.Processing.Filters.Outlier.Removal()\n\n internal_removal.enabled = (\n _zivid.Settings.Processing.Filters.Outlier.Removal.Enabled(removal.enabled)\n )\n internal_removal.threshold = (\n _zivid.Settings.Processing.Filters.Outlier.Removal.Threshold(removal.threshold)\n )\n\n return internal_removal\n\n\ndef _to_internal_settings_processing_filters_outlier(outlier):\n internal_outlier = _zivid.Settings.Processing.Filters.Outlier()\n\n internal_outlier.removal = _to_internal_settings_processing_filters_outlier_removal(\n outlier.removal\n )\n return internal_outlier\n\n\ndef _to_internal_settings_processing_filters_reflection_removal_experimental(\n experimental,\n):\n internal_experimental = (\n _zivid.Settings.Processing.Filters.Reflection.Removal.Experimental()\n )\n\n internal_experimental.mode = (\n _zivid.Settings.Processing.Filters.Reflection.Removal.Experimental.Mode(\n experimental._mode.value\n )\n )\n\n return internal_experimental\n\n\ndef _to_internal_settings_processing_filters_reflection_removal(removal):\n internal_removal = _zivid.Settings.Processing.Filters.Reflection.Removal()\n\n internal_removal.enabled = (\n _zivid.Settings.Processing.Filters.Reflection.Removal.Enabled(removal.enabled)\n )\n\n internal_removal.experimental = (\n _to_internal_settings_processing_filters_reflection_removal_experimental(\n removal.experimental\n )\n )\n return internal_removal\n\n\ndef _to_internal_settings_processing_filters_reflection(reflection):\n internal_reflection = _zivid.Settings.Processing.Filters.Reflection()\n\n internal_reflection.removal = (\n _to_internal_settings_processing_filters_reflection_removal(reflection.removal)\n )\n return internal_reflection\n\n\ndef _to_internal_settings_processing_filters_smoothing_gaussian(gaussian):\n internal_gaussian = _zivid.Settings.Processing.Filters.Smoothing.Gaussian()\n\n internal_gaussian.enabled = (\n _zivid.Settings.Processing.Filters.Smoothing.Gaussian.Enabled(gaussian.enabled)\n )\n internal_gaussian.sigma = (\n _zivid.Settings.Processing.Filters.Smoothing.Gaussian.Sigma(gaussian.sigma)\n )\n\n return internal_gaussian\n\n\ndef _to_internal_settings_processing_filters_smoothing(smoothing):\n internal_smoothing = _zivid.Settings.Processing.Filters.Smoothing()\n\n internal_smoothing.gaussian = (\n _to_internal_settings_processing_filters_smoothing_gaussian(smoothing.gaussian)\n )\n return internal_smoothing\n\n\ndef _to_internal_settings_processing_filters(filters):\n internal_filters = _zivid.Settings.Processing.Filters()\n\n internal_filters.cluster = _to_internal_settings_processing_filters_cluster(\n filters.cluster\n )\n internal_filters.experimental = (\n _to_internal_settings_processing_filters_experimental(filters.experimental)\n )\n internal_filters.noise = _to_internal_settings_processing_filters_noise(\n filters.noise\n )\n internal_filters.outlier = _to_internal_settings_processing_filters_outlier(\n filters.outlier\n )\n internal_filters.reflection = _to_internal_settings_processing_filters_reflection(\n filters.reflection\n )\n internal_filters.smoothing = _to_internal_settings_processing_filters_smoothing(\n filters.smoothing\n )\n return internal_filters\n\n\ndef _to_internal_settings_processing(processing):\n internal_processing = _zivid.Settings.Processing()\n\n internal_processing.color = _to_internal_settings_processing_color(processing.color)\n internal_processing.filters = _to_internal_settings_processing_filters(\n processing.filters\n )\n return internal_processing\n\n\ndef _to_internal_settings_region_of_interest_box(box):\n internal_box = _zivid.Settings.RegionOfInterest.Box()\n\n internal_box.enabled = _zivid.Settings.RegionOfInterest.Box.Enabled(box.enabled)\n internal_box.extents = _zivid.Settings.RegionOfInterest.Box.Extents(box.extents)\n internal_box.point_a = _zivid.Settings.RegionOfInterest.Box.PointA(box.point_a)\n internal_box.point_b = _zivid.Settings.RegionOfInterest.Box.PointB(box.point_b)\n internal_box.point_o = _zivid.Settings.RegionOfInterest.Box.PointO(box.point_o)\n\n return internal_box\n\n\ndef _to_internal_settings_region_of_interest_depth(depth):\n internal_depth = _zivid.Settings.RegionOfInterest.Depth()\n\n internal_depth.enabled = _zivid.Settings.RegionOfInterest.Depth.Enabled(\n depth.enabled\n )\n internal_depth.range = _zivid.Settings.RegionOfInterest.Depth.Range(depth.range)\n\n return internal_depth\n\n\ndef _to_internal_settings_region_of_interest(region_of_interest):\n internal_region_of_interest = _zivid.Settings.RegionOfInterest()\n\n internal_region_of_interest.box = _to_internal_settings_region_of_interest_box(\n region_of_interest.box\n )\n internal_region_of_interest.depth = _to_internal_settings_region_of_interest_depth(\n region_of_interest.depth\n )\n return internal_region_of_interest\n\n\ndef _to_internal_settings_sampling(sampling):\n internal_sampling = _zivid.Settings.Sampling()\n\n internal_sampling.color = _zivid.Settings.Sampling.Color(sampling._color.value)\n internal_sampling.pixel = _zivid.Settings.Sampling.Pixel(sampling._pixel.value)\n\n return internal_sampling\n\n\ndef _to_internal_settings(settings):\n internal_settings = _zivid.Settings()\n\n temp_acquisitions = _zivid.Settings.Acquisitions()\n for value in settings.acquisitions:\n temp_acquisitions.append(_to_internal_settings_acquisition(value))\n internal_settings.acquisitions = temp_acquisitions\n\n internal_settings.diagnostics = _to_internal_settings_diagnostics(\n settings.diagnostics\n )\n internal_settings.experimental = _to_internal_settings_experimental(\n settings.experimental\n )\n internal_settings.processing = _to_internal_settings_processing(settings.processing)\n internal_settings.region_of_interest = _to_internal_settings_region_of_interest(\n settings.region_of_interest\n )\n internal_settings.sampling = _to_internal_settings_sampling(settings.sampling)\n return internal_settings\n" }, { "alpha_fraction": 0.7292929291725159, "alphanum_fraction": 0.7373737096786499, "avg_line_length": 34.35714340209961, "blob_id": "45c65664ea464525138bb1068a74a9d4b59e436b", "content_id": "7fb8f66571c3af4293fa23bef2a0b603e70e2747", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 990, "license_type": "permissive", "max_line_length": 86, "num_lines": 28, "path": "/test/converters/test_convert_frame_info.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "def test_to_internal_frame_info_to_frame_info_modified():\n import datetime\n from zivid import FrameInfo\n from zivid.frame_info import _to_frame_info, _to_internal_frame_info\n\n modified_frame_info = FrameInfo(time_stamp=datetime.datetime(2007, 12, 18))\n\n temp = _to_internal_frame_info(modified_frame_info)\n\n converted_frame_info = _to_frame_info(temp)\n\n assert modified_frame_info == converted_frame_info\n assert isinstance(converted_frame_info, FrameInfo)\n assert isinstance(modified_frame_info, FrameInfo)\n\n\ndef test_to_internal_frame_info_to_frame_info_default():\n from zivid import FrameInfo\n from zivid.frame_info import _to_frame_info, _to_internal_frame_info\n\n default_frame_info = FrameInfo()\n converted_frame_info = _to_frame_info(_to_internal_frame_info(default_frame_info))\n assert default_frame_info == converted_frame_info\n assert isinstance(converted_frame_info, FrameInfo)\n assert isinstance(default_frame_info, FrameInfo)\n\n\n#\n" }, { "alpha_fraction": 0.33195212483406067, "alphanum_fraction": 0.3373618721961975, "avg_line_length": 52.62963104248047, "blob_id": "904bf14a9a3fdbe010c69664653ee771f93e2896", "content_id": "2eabdb2d514a1430835b2cc5a182bc32d7fbb52e", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 8688, "license_type": "permissive", "max_line_length": 120, "num_lines": 162, "path": "/src/include/ZividPython/Releasable.h", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "#pragma once\n\n#include <memory>\n#include <optional>\n#include <pybind11/pybind11.h>\n#include <stdexcept>\n\n#define WITH_GIL_UNLOCKED(...) \\\n [&, this] { \\\n pybind11::gil_scoped_release gilLock; \\\n return __VA_ARGS__; \\\n }()\n\n#define ZIVID_PYTHON_FORWARD_0_ARGS_TEMPLATE_1_ARG_WRAP_RETURN(returnType, functionName, returnTypeTypename) \\\n auto functionName() \\\n { \\\n return returnType{ WITH_GIL_UNLOCKED(impl().functionName<returnTypeTypename>()) }; \\\n }\n\n#define ZIVID_PYTHON_FORWARD_0_ARGS(functionName) \\\n decltype(auto) functionName() \\\n { \\\n return impl().functionName(); \\\n }\n\n#define ZIVID_PYTHON_FORWARD_0_ARGS_TEMPLATE_1_ARG(functionName, returnTypeTypename) \\\n decltype(auto) functionName() \\\n { \\\n return WITH_GIL_UNLOCKED(impl().functionName<returnTypeTypename>()); \\\n }\n\n#define ZIVID_PYTHON_FORWARD_0_ARGS_WRAP_RETURN(returnType, functionName) \\\n auto functionName() \\\n { \\\n return returnType{ impl().functionName() }; \\\n }\n\n#define ZIVID_PYTHON_FORWARD_0_ARGS_WRAP_CONTAINER_RETURN(container, returnType, functionName) \\\n auto functionName() \\\n { \\\n auto nativeContainer = WITH_GIL_UNLOCKED(impl().functionName()); \\\n container<returnType> returnContainer; \\\n returnContainer.reserve(nativeContainer.size()); \\\n std::transform(std::make_move_iterator(begin(nativeContainer)), \\\n std::make_move_iterator(end(nativeContainer)), \\\n std::back_inserter(returnContainer), \\\n [](auto &&nativeValue) { \\\n return returnType{ std::forward<decltype(nativeValue)>(nativeValue) }; \\\n }); \\\n return returnContainer; \\\n }\n\n#define ZIVID_PYTHON_FORWARD_1_ARGS(functionName, arg1Type, arg1Name) \\\n decltype(auto) functionName(arg1Type arg1Name) \\\n { \\\n return WITH_GIL_UNLOCKED(impl().functionName(arg1Name)); \\\n }\n\n#define ZIVID_PYTHON_FORWARD_1_ARGS_WRAP_RETURN(returnType, functionName, arg1Type, arg1Name) \\\n auto functionName(arg1Type arg1Name) \\\n { \\\n return returnType{ WITH_GIL_UNLOCKED(impl().functionName(arg1Name)) }; \\\n }\n\n#define ZIVID_PYTHON_FORWARD_2_ARGS(functionName, arg1Type, arg1Name, arg2Type, arg2Name) \\\n decltype(auto) functionName(arg1Type arg1Name, arg2Type arg2Name) \\\n { \\\n return WITH_GIL_UNLOCKED(impl().functionName(arg1Name, arg2Name)); \\\n }\n\n#define ZIVID_PYTHON_FORWARD_2_ARGS_WRAP_RETURN(returnType, functionName, arg1Type, arg1Name, arg2Type, arg2Name) \\\n auto functionName(arg1Type arg1Name, arg2Type arg2Name) \\\n { \\\n return returnType{ WITH_GIL_UNLOCKED(impl().functionName(arg1Name, arg2Name)) }; \\\n }\n\n#define ZIVID_PYTHON_ADD_COMPARE(op) \\\n template<typename Releaseable> \\\n bool operator op(const Releaseable &other) const \\\n { \\\n return impl() op other.impl(); \\\n }\n\nnamespace ZividPython\n{\n template<typename T>\n class Releasable\n {\n public:\n template<typename... Args>\n explicit Releasable(Args &&...args)\n : m_impl{ std::make_optional<T>(std::forward<Args>(args)...) }\n {}\n\n decltype(auto) toString() const\n {\n return impl().toString();\n }\n\n auto &impl() const\n {\n if(!m_impl) throw std::runtime_error{ \"Instance have been released\" };\n return m_impl.value();\n }\n\n auto &impl()\n {\n if(!m_impl) throw std::runtime_error{ \"Instance have been released\" };\n return m_impl.value();\n }\n\n void release()\n {\n m_impl.reset();\n }\n\n // This function is required to verify that the buffer has not already\n // released in certain situations. Ideally it should not exist.\n void assertNotReleased()\n {\n std::ignore = impl();\n }\n\n private:\n std::optional<T> m_impl{ std::make_optional<T>() };\n };\n\n template<typename T>\n class Singleton\n {\n public:\n Singleton()\n {\n // Keep the singleton alive forever to avoid races with\n // static variables that the singleton may need during destruction\n // This should be fixed a more elegant way!\n if(!globalImpl) globalImpl = std::make_shared<T>();\n }\n\n decltype(auto) toString() const\n {\n return impl().toString();\n }\n\n auto &impl() const\n {\n if(!globalImpl) throw std::runtime_error{ \"Instance have been released\" };\n return *globalImpl;\n }\n\n static void release()\n {\n globalImpl.reset();\n }\n\n private:\n static std::shared_ptr<T> globalImpl;\n };\n\n template<typename T>\n std::shared_ptr<T> Singleton<T>::globalImpl{ nullptr };\n} // namespace ZividPython\n" }, { "alpha_fraction": 0.6723963618278503, "alphanum_fraction": 0.677789032459259, "avg_line_length": 39.643836975097656, "blob_id": "aeff5266f6b62773e69a9357ba488c9b34021266", "content_id": "498a8ea8513471dde97e09c8c0b51e822cc981bf", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 2967, "license_type": "permissive", "max_line_length": 120, "num_lines": 73, "path": "/src/InfieldCorrection/InfieldCorrection.cpp", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "#include <Zivid/Experimental/Calibration/InfieldCorrection.h>\n\n#include <ZividPython/InfieldCorrection/InfieldCorrection.h>\n#include <ZividPython/Matrix.h>\n#include <ZividPython/ReleasableCamera.h>\n\n#include <pybind11/pybind11.h>\n\n#include <vector>\n\nnamespace py = pybind11;\n\nnamespace ZividPython::InfieldCorrection\n{\n void wrapAsSubmodule(pybind11::module &dest)\n {\n using namespace Zivid::Experimental::Calibration;\n\n ZIVID_PYTHON_WRAP_CLASS(dest, InfieldCorrectionInput);\n ZIVID_PYTHON_WRAP_CLASS(dest, CameraVerification);\n ZIVID_PYTHON_WRAP_CLASS(dest, AccuracyEstimate);\n ZIVID_PYTHON_WRAP_CLASS(dest, CameraCorrection);\n\n dest.def(\"detect_feature_points_infield\",\n [](ReleasableCamera &releasableCamera) { return detectFeaturePoints(releasableCamera.impl()); })\n .def(\"verify_camera\", &verifyCamera)\n .def(\"compute_camera_correction\", &computeCameraCorrection)\n .def(\"write_camera_correction\",\n [](ReleasableCamera &releasableCamera, CameraCorrection cameraCorrection) {\n writeCameraCorrection(releasableCamera.impl(), cameraCorrection);\n })\n .def(\"reset_camera_correction\",\n [](ReleasableCamera &releasableCamera) { resetCameraCorrection(releasableCamera.impl()); })\n .def(\"has_camera_correction\",\n [](ReleasableCamera &releasableCamera) { return hasCameraCorrection(releasableCamera.impl()); })\n .def(\"camera_correction_timestamp\",\n [](ReleasableCamera &releasableCamera) { return cameraCorrectionTimestamp(releasableCamera.impl()); });\n }\n} // namespace ZividPython::InfieldCorrection\n\nnamespace ZividPython\n{\n using namespace Zivid::Experimental::Calibration;\n\n void wrapClass(pybind11::class_<InfieldCorrectionInput> pyClass)\n {\n pyClass.def(py::init<Zivid::Calibration::DetectionResult>())\n .def(\"valid\", &InfieldCorrectionInput::valid)\n .def(\"detection_result\", &InfieldCorrectionInput::detectionResult)\n .def(\"status_description\", &InfieldCorrectionInput::statusDescription);\n }\n\n void wrapClass(pybind11::class_<CameraVerification> pyClass)\n {\n pyClass.def(\"local_dimension_trueness\", &CameraVerification::localDimensionTrueness)\n .def(\"position\", [](const CameraVerification &cameraVerification) {\n return Conversion::toPyVector(cameraVerification.position());\n });\n }\n\n void wrapClass(pybind11::class_<AccuracyEstimate> pyClass)\n {\n pyClass.def(\"dimension_accuracy\", &AccuracyEstimate::dimensionAccuracy)\n .def(\"z_min\", &AccuracyEstimate::zMin)\n .def(\"z_max\", &AccuracyEstimate::zMax);\n }\n\n void wrapClass(pybind11::class_<CameraCorrection> pyClass)\n {\n pyClass.def(\"accuracy_estimate\", &CameraCorrection::accuracyEstimate);\n }\n\n} // namespace ZividPython\n" }, { "alpha_fraction": 0.5369284749031067, "alphanum_fraction": 0.5439624786376953, "avg_line_length": 25.24615478515625, "blob_id": "feb5bdc2503fa0d97174904241f64d6155a76d38", "content_id": "b8b29a6fae5263e2a51a1fffae10e9d79db1da23", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1706, "license_type": "permissive", "max_line_length": 98, "num_lines": 65, "path": "/samples/sample_capture_async.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "\"\"\"Sample demonstrating how to capture with multiple cameras at the same time.\"\"\"\nimport concurrent.futures\nimport datetime\nimport time\n\nimport zivid\n\n\ndef _capture_sync(cameras: list[zivid.Camera]) -> list[zivid.Frame]:\n return [\n camera.capture(\n zivid.Settings(\n acquisitions=[\n zivid.Settings.Acquisition(\n exposure_time=datetime.timedelta(microseconds=100000)\n )\n ]\n )\n )\n for camera in cameras\n ]\n\n\ndef _capture_async(cameras: list[zivid.Camera]) -> list[zivid.Frame]:\n with concurrent.futures.ThreadPoolExecutor() as executor:\n futures = [\n executor.submit(\n camera.capture,\n zivid.Settings(\n acquisitions=[\n zivid.Settings.Acquisition(\n exposure_time=datetime.timedelta(microseconds=100000)\n )\n ]\n ),\n )\n for camera in cameras\n ]\n\n return [future.result() for future in futures]\n\n\ndef _main():\n app = zivid.Application()\n cameras = app.cameras()\n for camera in cameras:\n camera.connect()\n\n start = time.monotonic()\n _capture_async(cameras)\n end = time.monotonic()\n print(\n f\"Time taken to capture asynchronously from {len(cameras)} camera(s): {end-start} seconds\"\n )\n\n start = time.monotonic()\n _capture_sync(cameras)\n end = time.monotonic()\n print(\n f\"Time taken to capture synchronously from {len(cameras)} camera(s): {end-start} seconds\"\n )\n\n\nif __name__ == \"__main__\":\n _main()\n" }, { "alpha_fraction": 0.7740113139152527, "alphanum_fraction": 0.7796609997749329, "avg_line_length": 37.17647171020508, "blob_id": "f93f11888f962c722598da5f7a50f21322e6abe4", "content_id": "e331b1f197a16076240af0944677465020b824de", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1947, "license_type": "permissive", "max_line_length": 88, "num_lines": 51, "path": "/test/calibration/test_intrinsics.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "def _check_camera_intrinsics(camera_intrinsics):\n from zivid import CameraIntrinsics\n\n assert isinstance(camera_intrinsics, CameraIntrinsics)\n assert isinstance(camera_intrinsics.camera_matrix, CameraIntrinsics.CameraMatrix)\n assert isinstance(camera_intrinsics.distortion, CameraIntrinsics.Distortion)\n\n assert isinstance(camera_intrinsics.camera_matrix.fx, float)\n assert isinstance(camera_intrinsics.camera_matrix.fy, float)\n assert isinstance(camera_intrinsics.camera_matrix.cx, float)\n assert isinstance(camera_intrinsics.camera_matrix.cy, float)\n\n assert isinstance(camera_intrinsics.distortion.k1, float)\n assert isinstance(camera_intrinsics.distortion.k2, float)\n assert isinstance(camera_intrinsics.distortion.k3, float)\n assert isinstance(camera_intrinsics.distortion.p1, float)\n assert isinstance(camera_intrinsics.distortion.p2, float)\n\n\ndef test_intrinsics(file_camera):\n from zivid.experimental.calibration import intrinsics\n\n camera_intrinsics = intrinsics(file_camera)\n _check_camera_intrinsics(camera_intrinsics)\n\n\ndef test_intrinsics_with_settings_2d(file_camera):\n from zivid.experimental.calibration import intrinsics\n from zivid.settings_2d import Settings2D\n\n camera_intrinsics = intrinsics(\n camera=file_camera, settings=Settings2D(acquisitions=[Settings2D.Acquisition()])\n )\n _check_camera_intrinsics(camera_intrinsics)\n\n\ndef test_intrinsics_with_settings_3d(file_camera):\n from zivid.experimental.calibration import intrinsics\n from zivid.settings import Settings\n\n camera_intrinsics = intrinsics(\n camera=file_camera, settings=Settings(acquisitions=[Settings.Acquisition()])\n )\n _check_camera_intrinsics(camera_intrinsics)\n\n\ndef test_estimate_intrinsics(frame):\n from zivid.experimental.calibration import estimate_intrinsics\n\n camera_intrinsics = estimate_intrinsics(frame)\n _check_camera_intrinsics(camera_intrinsics)\n" }, { "alpha_fraction": 0.8166465759277344, "alphanum_fraction": 0.8262967467308044, "avg_line_length": 33.54166793823242, "blob_id": "a26e6eae18e764ac16de85dd68b432a817c8509d", "content_id": "4b0ce9537d76b88cf9eb29113970512c0a0aa0b2", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 829, "license_type": "permissive", "max_line_length": 95, "num_lines": 24, "path": "/modules/zivid/__init__.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "\"\"\"This file imports all non protected classes, modules and packages from the current level.\"\"\"\n\nimport zivid._version\n\n__version__ = zivid._version.get_version(__name__) # pylint: disable=protected-access\n\nimport zivid.firmware\nimport zivid.capture_assistant\nimport zivid.calibration\n\nfrom zivid.application import Application\nfrom zivid.camera import Camera\nfrom zivid.camera_state import CameraState\nfrom zivid.frame import Frame\nfrom zivid.frame_2d import Frame2D\nfrom zivid.frame_info import FrameInfo\nfrom zivid.image import Image\nfrom zivid.point_cloud import PointCloud\nfrom zivid.sdk_version import SDKVersion\nfrom zivid.settings import Settings\nfrom zivid.settings_2d import Settings2D\nfrom zivid.camera_info import CameraInfo\nfrom zivid.camera_intrinsics import CameraIntrinsics\nfrom zivid.matrix4x4 import Matrix4x4\n" }, { "alpha_fraction": 0.6460176706314087, "alphanum_fraction": 0.6578171253204346, "avg_line_length": 31.285715103149414, "blob_id": "e95bb335595c822f3ae65545414b4e6e5b4af5de", "content_id": "2bf9d6f288fda44ed891fcbf7464c28251541637", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 678, "license_type": "permissive", "max_line_length": 81, "num_lines": 21, "path": "/src/Calibration/Detector.cpp", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "#include <Zivid/Calibration/Detector.h>\n\n#include <ZividPython/Calibration/Detector.h>\n#include <ZividPython/Matrix.h>\n\n#include <pybind11/pybind11.h>\n\nnamespace py = pybind11;\n\nnamespace ZividPython\n{\n void wrapClass(pybind11::class_<Zivid::Calibration::DetectionResult> pyClass)\n {\n pyClass.def(\"valid\", &Zivid::Calibration::DetectionResult::valid)\n .def(\"centroid\",\n [](const Zivid::Calibration::DetectionResult &detectionResult) {\n return Conversion::toPyVector(detectionResult.centroid());\n })\n .def(\"pose\", &Zivid::Calibration::DetectionResult::pose);\n }\n} // namespace ZividPython\n" }, { "alpha_fraction": 0.7279843688011169, "alphanum_fraction": 0.7309197783470154, "avg_line_length": 36.85185241699219, "blob_id": "877d281d24f492cec4d96de24dd13bc9df732ecd", "content_id": "a19f564149845f3d3f4809470b70f9a2e0044098", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1022, "license_type": "permissive", "max_line_length": 85, "num_lines": 27, "path": "/test/converters/test_convert_settings.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "def test_to_internal_settings_to_settings_modified():\n import datetime\n from zivid import Settings\n from zivid.settings import _to_settings, _to_internal_settings\n\n modified_settings = Settings(\n acquisitions=[\n Settings.Acquisition(),\n Settings.Acquisition(exposure_time=datetime.timedelta(milliseconds=100)),\n ]\n )\n\n converted_settings = _to_settings(_to_internal_settings(modified_settings))\n assert modified_settings == converted_settings\n assert isinstance(converted_settings, Settings)\n assert isinstance(modified_settings, Settings)\n\n\ndef test_to_internal_settings_to_settings_default():\n from zivid import Settings\n from zivid.settings import _to_settings, _to_internal_settings\n\n default_settings = Settings()\n converted_settings = _to_settings(_to_internal_settings(default_settings))\n assert default_settings == converted_settings\n assert isinstance(converted_settings, Settings)\n assert isinstance(default_settings, Settings)\n" }, { "alpha_fraction": 0.7097130417823792, "alphanum_fraction": 0.7102649211883545, "avg_line_length": 24.885713577270508, "blob_id": "e3545e7d6dd88a8cc95e112f13a972d5ad0b3c67", "content_id": "1f0b812894ff78c76e7a5cf63a7fb897c486f99d", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1812, "license_type": "permissive", "max_line_length": 73, "num_lines": 70, "path": "/test/test_application.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "import pytest\n\n\ndef test_init_with():\n import zivid\n\n with zivid.Application() as app:\n assert app\n assert isinstance(app, zivid.Application)\n\n\ndef test_create_file_camera(application, file_camera_file):\n import zivid\n\n file_camera = application.create_file_camera(file_camera_file)\n assert file_camera\n assert isinstance(file_camera, zivid.camera.Camera)\n\n\n@pytest.mark.physical_camera\ndef test_connect_camera(application):\n import zivid\n\n cam = application.connect_camera()\n assert cam\n assert isinstance(cam, zivid.camera.Camera)\n cam.release()\n\n\n@pytest.mark.physical_camera\ndef test_connect_camera_serial_number(application):\n import zivid\n\n with application.connect_camera() as cam:\n serial_number = cam.info.serial_number\n\n with application.connect_camera(serial_number) as cam:\n assert cam\n assert isinstance(cam, zivid.camera.Camera)\n\n\ndef test_cameras_list_of_cameras(application):\n import zivid\n\n cameras = application.cameras()\n assert isinstance(cameras, list)\n for camera in cameras:\n assert isinstance(camera, zivid.Camera)\n\n\ndef test_cameras_one_camera(application, file_camera_file):\n orig_len = len(application.cameras())\n with application.create_file_camera(file_camera_file) as file_camera:\n assert file_camera\n cameras = application.cameras()\n assert len(cameras) == orig_len + 1\n assert file_camera in cameras\n\n\ndef test_to_string(application):\n string = str(application)\n assert string\n assert isinstance(string, str)\n\n\ndef test_release(application, file_camera_file):\n assert application.create_file_camera(file_camera_file)\n application.release()\n with pytest.raises(RuntimeError):\n application.create_file_camera(file_camera_file)\n" }, { "alpha_fraction": 0.6600337028503418, "alphanum_fraction": 0.6833001971244812, "avg_line_length": 26.68220329284668, "blob_id": "eb03e598cb37993a295e13f4b16be203c5e4337e", "content_id": "eabd3a73cbce54909bc694f757c60e8b150a48b0", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 6533, "license_type": "permissive", "max_line_length": 87, "num_lines": 236, "path": "/test/test_settings_2d.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "import pytest\n\n\ndef test_init_default_settings(application):\n import zivid\n\n settings_2d = zivid.Settings2D()\n\n assert isinstance(settings_2d.acquisitions, list)\n assert len(settings_2d.acquisitions) == 0\n assert isinstance(settings_2d.processing, zivid.Settings2D.Processing)\n\n assert isinstance(settings_2d.processing.color, zivid.Settings2D.Processing.Color)\n assert isinstance(\n settings_2d.processing.color.balance, zivid.Settings2D.Processing.Color.Balance\n )\n assert settings_2d.processing.color.gamma is None\n assert settings_2d.processing.color.balance.red is None\n assert settings_2d.processing.color.balance.green is None\n assert settings_2d.processing.color.balance.blue is None\n\n\ndef test_set_acquisition_list(application):\n import zivid\n\n settings = zivid.Settings2D()\n\n settings.acquisitions = [\n zivid.Settings2D.Acquisition(gain=1.0),\n zivid.Settings2D.Acquisition(gain=2.0),\n zivid.Settings2D.Acquisition(gain=3.0),\n ]\n assert len(settings.acquisitions) == 3\n assert settings.acquisitions is not None\n assert isinstance(settings.acquisitions, list)\n for element in settings.acquisitions:\n assert isinstance(element, zivid.Settings2D.Acquisition)\n\n assert settings.acquisitions[0].gain == 1.0\n assert settings.acquisitions[1].gain == 2.0\n assert settings.acquisitions[2].gain == 3.0\n\n settings.acquisitions[0].gain = 4.0\n assert settings.acquisitions[0].gain == 4.0\n\n\ndef test_append_acquisition_list(application):\n import zivid\n\n settings = zivid.Settings2D()\n settings.acquisitions.append(zivid.Settings2D.Acquisition(brightness=1.1))\n assert len(settings.acquisitions) == 1\n assert settings.acquisitions[0].brightness == 1.1\n\n\ndef test_default_acquisition(application):\n import zivid\n import datetime\n\n settings_2d = zivid.Settings2D(acquisitions=[zivid.Settings2D.Acquisition()])\n assert isinstance(settings_2d.acquisitions, list)\n acquisition = settings_2d.acquisitions[0]\n\n assert isinstance(acquisition, zivid.Settings2D.Acquisition)\n assert acquisition.aperture is None\n assert acquisition.brightness is None\n assert acquisition.exposure_time is None\n assert acquisition.gain is None\n\n pytest.helpers.equality_tester(\n zivid.Settings2D.Acquisition,\n [5, 0.5, datetime.timedelta(microseconds=11000), 14],\n [5, 0.5, datetime.timedelta(microseconds=11001), 14],\n )\n\n\ndef test_acquisition_brightness(application):\n import numbers\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings2D.Acquisition(),\n member=\"brightness\",\n value=0.5,\n expected_data_type=numbers.Real,\n )\n\n\ndef test_acquisition_exposure_time(application):\n import datetime\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings2D.Acquisition(),\n member=\"exposure_time\",\n value=datetime.timedelta(microseconds=100000),\n expected_data_type=datetime.timedelta,\n )\n\n\ndef test_acquisition_gain(application):\n import numbers\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings2D.Acquisition(),\n member=\"gain\",\n value=14,\n expected_data_type=numbers.Real,\n )\n\n\ndef test_acquisition_aperture(application):\n import numbers\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings2D.Acquisition(),\n member=\"aperture\",\n value=20.5,\n expected_data_type=numbers.Real,\n )\n\n\ndef test_settings_processing(application):\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings2D(),\n member=\"processing\",\n value=zivid.Settings2D.Processing(),\n expected_data_type=zivid.Settings2D.Processing,\n )\n pytest.helpers.equality_tester(\n zivid.Settings2D.Processing,\n [\n zivid.Settings2D.Processing.Color(\n 0.9, zivid.Settings2D.Processing.Color.Balance(blue=1.1)\n )\n ],\n [\n zivid.Settings2D.Processing.Color(\n 1.1, zivid.Settings2D.Processing.Color.Balance(blue=1.2)\n )\n ],\n )\n\n\ndef test_settings_processing_color(application):\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings2D.Processing(),\n member=\"color\",\n value=zivid.Settings2D.Processing.Color(),\n expected_data_type=zivid.Settings2D.Processing.Color,\n )\n pytest.helpers.equality_tester(\n zivid.Settings2D.Processing.Color,\n [0.9, zivid.Settings2D.Processing.Color.Balance(red=1.1)],\n [1.1, zivid.Settings2D.Processing.Color.Balance(red=1.2)],\n )\n\n\ndef test_settings_processing_color_gamma(\n application,\n):\n import zivid\n import numbers\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings2D.Processing.Color(),\n member=\"gamma\",\n value=0.85,\n expected_data_type=numbers.Real,\n )\n\n\ndef test_settings_processing_color_balance(\n application,\n):\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings2D.Processing.Color(),\n member=\"balance\",\n value=zivid.Settings2D.Processing.Color.Balance(),\n expected_data_type=zivid.Settings2D.Processing.Color.Balance,\n )\n pytest.helpers.equality_tester(\n zivid.Settings2D.Processing.Color.Balance,\n [1.1, 1.1, 1.1],\n [1.2, 1.1, 1.1],\n )\n\n\ndef test_settings_processing_color_balance_red(\n application,\n):\n import zivid\n import numbers\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings2D.Processing.Color.Balance(),\n member=\"red\",\n value=2,\n expected_data_type=numbers.Real,\n )\n\n\ndef test_settings_processing_color_balance_green(\n application,\n):\n import zivid\n import numbers\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings2D.Processing.Color.Balance(),\n member=\"green\",\n value=1.5,\n expected_data_type=numbers.Real,\n )\n\n\ndef test_settings_processing_color_balance_blue(\n application,\n):\n import zivid\n import numbers\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings2D.Processing.Color.Balance(),\n member=\"blue\",\n value=1,\n expected_data_type=numbers.Real,\n )\n" }, { "alpha_fraction": 0.6987951993942261, "alphanum_fraction": 0.6987951993942261, "avg_line_length": 15.600000381469727, "blob_id": "5da73976d6c12c7e3fe156847b4c5b3d0f7d9f98", "content_id": "7d2eff2e129163e8cbf7b9e5ef3196558633c60a", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 166, "license_type": "permissive", "max_line_length": 43, "num_lines": 10, "path": "/src/include/ZividPython/DependentFalse.h", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "#pragma once\n\n#include <type_traits>\n\nnamespace ZividPython\n{\n template<typename T>\n struct DependentFalse : std::false_type\n {};\n} // namespace ZividPython\n" }, { "alpha_fraction": 0.6948003172874451, "alphanum_fraction": 0.7015824913978577, "avg_line_length": 24.037734985351562, "blob_id": "10b1f2cfedf9fc8a3665318078f9d6d992de346c", "content_id": "354793bbffc92db152843539aa5be9b0e514ede0", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2654, "license_type": "permissive", "max_line_length": 88, "num_lines": 106, "path": "/test/test_camera.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "import pytest\n\n\ndef test_illegal_init(application):\n import zivid\n\n with pytest.raises(TypeError):\n zivid.camera.Camera(\"this should fail\")\n\n with pytest.raises(TypeError):\n zivid.camera.Camera(None)\n\n with pytest.raises(TypeError):\n zivid.camera.Camera(12345)\n\n\ndef test_init_with(application, file_camera_file):\n import zivid\n\n with application.create_file_camera(file_camera_file) as file_camera:\n assert file_camera\n assert isinstance(file_camera, zivid.camera.Camera)\n\n\ndef test_capture_settings(file_camera):\n import zivid\n\n frame = file_camera.capture(\n zivid.Settings(acquisitions=[zivid.Settings.Acquisition()])\n )\n assert frame\n assert isinstance(frame, zivid.frame.Frame)\n frame.release()\n\n\ndef test_capture_settings_2d(file_camera):\n import zivid\n\n frame_2d = file_camera.capture(\n zivid.Settings2D(acquisitions=[zivid.Settings2D.Acquisition()])\n )\n assert frame_2d\n assert isinstance(frame_2d, zivid.frame_2d.Frame2D)\n frame_2d.release()\n\n\ndef test_equal(application, file_camera_file):\n import zivid\n\n with application.create_file_camera(file_camera_file) as file_camera:\n camera_handle = zivid.Camera(\n file_camera._Camera__impl # pylint: disable=protected-access\n )\n assert isinstance(file_camera, zivid.Camera)\n assert isinstance(camera_handle, zivid.Camera)\n assert camera_handle == file_camera\n\n\ndef test_not_equal(application, file_camera_file):\n with application.create_file_camera(\n file_camera_file\n ) as file_camera1, application.create_file_camera(file_camera_file) as file_camera2:\n assert file_camera1 != file_camera2\n\n\ndef test_disconnect(file_camera):\n assert file_camera.state.connected\n file_camera.disconnect()\n assert not file_camera.state.connected\n\n\ndef test_connect(file_camera):\n file_camera.disconnect()\n assert not file_camera.state.connected\n file_camera.connect()\n assert file_camera.state.connected\n\n\ndef test_connect_capture_chaining(file_camera):\n import zivid\n\n settings = zivid.Settings(acquisitions=[zivid.Settings.Acquisition()])\n file_camera.disconnect()\n file_camera.connect().capture(settings)\n\n\ndef test_to_string(file_camera):\n string = str(file_camera)\n assert string\n assert isinstance(string, str)\n\n\ndef test_info(file_camera):\n import zivid\n\n info = file_camera.info\n assert info\n assert isinstance(info, zivid.CameraInfo)\n\n\ndef test_state(file_camera):\n import zivid\n\n state = file_camera.state\n assert state\n assert isinstance(state, zivid.CameraState)\n" }, { "alpha_fraction": 0.5755634307861328, "alphanum_fraction": 0.5762339234352112, "avg_line_length": 35.52381134033203, "blob_id": "ef9e54ec4abdeaddd951d19dbe3e5522e1a91856", "content_id": "360f66c1e747005a62aad5419f65616d1cc92bb3", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 26845, "license_type": "permissive", "max_line_length": 182, "num_lines": 735, "path": "/continuous-integration/code-generation/datamodel_frontend_generator.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "import argparse\nimport inspect\nimport subprocess\nimport re\nimport tempfile\nfrom typing import Any, List, Optional, Sequence, Tuple\nfrom dataclasses import dataclass\nfrom pathlib import Path\nfrom textwrap import dedent, indent\n\nimport inflection\nimport _zivid\n\n\ndef _to_snake_case(name: str) -> str:\n # Workaround due to flaw in inflection.underscore(): Substitute any \"X_d\" with \"Xd\"\n return re.sub(r\"(\\d)_d\", r\"\\g<1>d\", inflection.underscore(name)).lower()\n\n\ndef _indent(content: str) -> str:\n return indent(content, \" \" * 4)\n\n\ndef _get_dot_path(base_type: str, node_path: Path) -> str:\n if node_path == Path(\".\"):\n return f\"_zivid.{base_type}\"\n return f\"_zivid.{base_type}.{'.'.join(node_path.parts)}\"\n\n\ndef _get_underscore_name(base_type: str, node_path: Path) -> str:\n underscored_base_type = _to_snake_case(base_type).replace(\".\", \"_\")\n if node_path == Path(\".\"):\n return underscored_base_type\n return f\"{underscored_base_type}_{'_'.join([_to_snake_case(part) for part in node_path.parts])}\"\n\n\n@dataclass\nclass MemberInfo:\n is_optional: bool\n underlying_type: str\n\n\n@dataclass\nclass ContainerInfo:\n contained_type: str\n underlying_type: str\n\n\n@dataclass\nclass NodeData:\n # pylint: disable=too-many-instance-attributes\n name: str\n snake_case: str\n is_leaf: bool\n is_enum: bool\n is_array_like: bool\n is_uninstantiated_node: bool\n enum_vars: tuple\n path: Path\n children: Tuple\n member_variables: Tuple[\"NodeData\", ...]\n member_containers: Tuple[\"NodeData\", ...]\n underlying_zivid_class: Any\n member_info: Optional[MemberInfo] = None\n container_info: Optional[ContainerInfo] = None\n\n\ndef _inner_classes_list(cls: Any) -> List:\n return [\n cls_attribute\n for cls_attribute in cls.__dict__.values()\n if inspect.isclass(cls_attribute)\n ]\n\n\ndef _imports(extra_imports: Sequence[str]) -> str:\n linter_exceptions = [\n \"too-many-lines\",\n \"protected-access\",\n \"too-few-public-methods\",\n \"too-many-arguments\",\n \"line-too-long\",\n \"missing-function-docstring\",\n \"missing-class-docstring\",\n \"redefined-builtin\",\n \"too-many-branches\",\n \"too-many-boolean-expressions\",\n ]\n\n header = \"\"\n header += \"'''Auto generated, do not edit.'''\\n\"\n header += f\"# pylint: disable={','.join(linter_exceptions)}\\n\"\n if extra_imports:\n header += \"\\n\".join([f\"import {module}\" for module in extra_imports]) + \"\\n\"\n header += \"import _zivid\"\n return header\n\n\ndef _create_init_special_member_function(node_data: NodeData, base_type: str) -> str:\n full_dot_path = _get_dot_path(base_type, node_data.path)\n signature_vars = \"\"\n member_variable_set = \"\"\n\n for container in node_data.member_containers:\n if container.container_info is None:\n raise RuntimeError(f\"Unexpected lack of container info: {container}\")\n\n signature_vars += f\"{container.snake_case}=None,\"\n underlying_type = container.container_info.underlying_type\n member_variable_set += dedent(\n f\"\"\"\n if {container.snake_case} is None:\n self._{container.snake_case} = []\n elif isinstance({container.snake_case}, {container.container_info.underlying_type} ):\n self._{container.snake_case} = []\n for item in {container.snake_case}:\n if isinstance(item, self.{container.container_info.contained_type}):\n self._{container.snake_case}.append(item)\n else:\n raise TypeError('Unsupported type {{item_type}}'.format(item_type=type(item)))\n else:\n raise TypeError(\n 'Unsupported type, expected: {underlying_type} or None, got {{value_type}}'.format(value_type=type({container.snake_case}))\n )\n \"\"\"\n )\n\n for member in node_data.member_variables:\n if member.member_info is None:\n raise RuntimeError(f\"Unexpected lack of member info: {member}\")\n\n if member.member_info.is_optional:\n is_none_check = f\"or {member.snake_case} is None\"\n none_message = \" or None\"\n else:\n is_none_check = \"\"\n none_message = \"\"\n signature_vars += f\"{member.snake_case}={full_dot_path}.{member.name}().value,\"\n\n if member.is_enum:\n member_variable_set += dedent(\n f\"\"\"\n if isinstance({member.snake_case},{full_dot_path}.{member.name}.enum) {is_none_check}:\n self._{member.snake_case} = {full_dot_path}.{member.name}({member.snake_case})\n elif isinstance({member.snake_case}, str):\n self._{member.snake_case} = {full_dot_path}.{member.name}(self.{member.name}._valid_values[{member.snake_case}])\n else:\n raise TypeError('Unsupported type, expected: str{none_message}, got {{value_type}}'.format(value_type=type({member.snake_case})))\n \"\"\"\n )\n\n else:\n underlying_type = member.member_info.underlying_type\n member_variable_set += dedent(\n f\"\"\"\n if isinstance({member.snake_case}, {member.member_info.underlying_type} ) {is_none_check}:\n self._{member.snake_case} = {full_dot_path}.{member.name}({member.snake_case})\n else:\n raise TypeError(\n 'Unsupported type, expected: {underlying_type}{none_message}, got {{value_type}}'.format(value_type=type({member.snake_case}))\n )\n \"\"\"\n )\n\n for child_class in node_data.children:\n if child_class.is_uninstantiated_node:\n continue\n signature_vars += f\"{child_class.snake_case}=None,\"\n\n member_variable_set += dedent(\n f\"\"\"\n if {child_class.snake_case} is None:\n {child_class.snake_case} = self.{child_class.name}()\n if not isinstance({child_class.snake_case}, self.{child_class.name}):\n raise TypeError('Unsupported type: {{value}}'.format(value=type({child_class.snake_case})))\n self._{child_class.snake_case} = {child_class.snake_case}\n \"\"\"\n )\n\n return dedent(\n \"\"\"\n def __init__(self, {signature_vars}):\n {member_variable_set}\n \"\"\"\n ).format(\n signature_vars=signature_vars, member_variable_set=_indent(member_variable_set)\n )\n\n\ndef _create_eq_special_member_function(node_data: NodeData) -> str:\n member_variables_equality = []\n for container in node_data.member_containers:\n member_variables_equality.append(\n f\"self._{container.snake_case} == other._{container.snake_case}\"\n )\n for member in node_data.member_variables:\n member_variables_equality.append(\n f\"self._{member.snake_case} == other._{member.snake_case}\"\n )\n\n for child in node_data.children:\n if child.is_uninstantiated_node:\n continue\n member_variables_equality.append(\n f\"self._{child.snake_case} == other._{child.snake_case}\"\n )\n equality_logic = \" and \".join(member_variables_equality)\n return dedent(\n f\"\"\"\n def __eq__(self, other):\n if (\n {equality_logic}\n ):\n return True\n return False\n \"\"\"\n )\n\n\ndef _create_str_special_member_function(node_data: NodeData, base_type: str) -> str:\n full_underscore_path = _get_underscore_name(base_type, node_data.path)\n str_content = f\"str(_to_internal_{full_underscore_path}(self))\"\n\n return dedent(\n f\"\"\"\n def __str__(self):\n return {str_content}\n \"\"\"\n )\n\n\ndef _create_properties(node_data: NodeData, base_type: str) -> str:\n get_properties = \"\\n\"\n set_properties = \"\\n\"\n\n for node in node_data.member_containers:\n if node.container_info is None:\n raise RuntimeError(f\"Unexpected lack of container info: {node}\")\n\n get_properties += dedent(\n f\"\"\"\n @property\n def {node.snake_case}(self):\n return self._{node.snake_case}\n \"\"\"\n )\n\n set_properties += dedent(\n f\"\"\"\n @{node.snake_case}.setter\n def {node.snake_case}(self,value):\n if not isinstance(value, {node.container_info.underlying_type}):\n raise TypeError('Unsupported type {{value}}'.format(value=type(value)))\n self._{node.snake_case} = []\n for item in value:\n if isinstance(item, self.{node.container_info.contained_type}):\n self._{node.snake_case}.append(item)\n else:\n raise TypeError('Unsupported type {{item_type}}'.format(item_type=type(item)))\n \"\"\"\n )\n\n for member in node_data.member_variables:\n if member.member_info is None:\n raise RuntimeError(f\"Unexpected lack of member info: {member}\")\n\n full_dot_path = _get_dot_path(base_type, node_data.path)\n\n if member.member_info.is_optional:\n is_none_check = \"or value is None\"\n can_be_none_error_message_part = \" or None\"\n else:\n is_none_check = \"\"\n can_be_none_error_message_part = \"\"\n\n if member.is_enum:\n expected_types_str = \"str\" + can_be_none_error_message_part\n\n get_properties += dedent(\n \"\"\"\n @property\n def {enum_member}(self):\n if self._{enum_member}.value is None:\n return None\n for key, internal_value in self.{enum_class}._valid_values.items():\n if internal_value == self._{enum_member}.value:\n return key\n raise ValueError(\"Unsupported value {{value}}\".format(value=self._{enum_member}))\n \"\"\"\n ).format(enum_member=member.snake_case, enum_class=member.name)\n\n set_properties += dedent(\n f\"\"\"\n @{member.snake_case}.setter\n def {member.snake_case}(self, value):\n if isinstance(value, str):\n self._{member.snake_case} = {full_dot_path}.{member.name}(self.{member.name}._valid_values[value])\n elif isinstance(value, {full_dot_path}.{member.name}.enum) {is_none_check}:\n self._{member.snake_case} = {full_dot_path}.{member.name}(value)\n else:\n raise TypeError('Unsupported type, expected: {expected_types_str}, got {{value_type}}'.format(value_type=type(value)))\n \"\"\"\n )\n\n else:\n underlying_type_str = member.member_info.underlying_type[1:-2].split(\",\")\n expected_types_str = (\n \" or \".join(underlying_type_str) + can_be_none_error_message_part\n )\n\n if member.is_array_like:\n get_properties += dedent(\n \"\"\"\n @property\n def {member}(self):\n if self._{member}.value is None:\n return None\n return self._{member}.value.to_array()\n \"\"\"\n ).format(member=member.snake_case)\n\n else:\n get_properties += dedent(\n \"\"\"\n @property\n def {member}(self):\n return self._{member}.value\n \"\"\"\n ).format(member=member.snake_case)\n\n set_properties += dedent(\n f\"\"\"\n @{member.snake_case}.setter\n def {member.snake_case}(self,value):\n if isinstance(value,{member.member_info.underlying_type}) {is_none_check}:\n self._{member.snake_case} = {full_dot_path}.{member.name}(value)\n else:\n raise TypeError('Unsupported type, expected: {expected_types_str}, got {{value_type}}'.format(value_type=type(value)))\n \"\"\"\n )\n\n for child in node_data.children:\n if child.is_uninstantiated_node:\n continue\n\n get_properties += dedent(\n \"\"\"\n @property\n def {member}(self):\n return self._{member}\n \"\"\"\n ).format(member=child.snake_case)\n\n set_properties += dedent(\n f\"\"\"\n @{child.snake_case}.setter\n def {child.snake_case}(self,value):\n if not isinstance(value, self.{child.name}):\n raise TypeError('Unsupported type {{value}}'.format(value=type(value)))\n self._{child.snake_case} = value\n \"\"\"\n )\n\n return dedent(\n \"\"\"\n {get_properties}\n {set_properties}\n \"\"\"\n ).format(\n get_properties=get_properties,\n set_properties=set_properties,\n )\n\n\ndef _create_save_load_functions(node_data: NodeData, base_type: str):\n full_dot_path = _get_dot_path(base_type=base_type, node_path=node_data.path)\n underscore_name = _get_underscore_name(\n base_type=base_type, node_path=node_data.path\n )\n return dedent(\n f\"\"\"\n @classmethod\n def load(cls, file_name):\n return _to_{underscore_name}({full_dot_path}(str(file_name)))\n\n def save(self, file_name):\n _to_internal_{underscore_name}(self).save(str(file_name))\n \"\"\"\n )\n\n\ndef _create_enum_class(member: NodeData, base_type: str) -> str:\n full_dot_path = _get_dot_path(base_type, member.path)\n\n static_members = [\"\\n\"]\n valid_values = [\"\\n\"]\n for enum_var in member.enum_vars:\n # Some members have a trailing underscore added to avoid collision with reserved keywords.\n # For the string-representation we strip that trailing underscore out.\n static_members.append(f'{enum_var} = \"{enum_var.rstrip(\"_\")}\"')\n valid_values.append(f'\"{enum_var.rstrip(\"_\")}\": {full_dot_path}.{enum_var},')\n\n return dedent(\n \"\"\"\n class {name}:\n\n {static_members}\n\n _valid_values = {{{valid_values}}}\n\n @classmethod\n def valid_values(cls):\n return list(cls._valid_values.keys())\n \"\"\"\n ).format(\n name=member.name,\n static_members=_indent(\"\\n\".join(static_members)),\n valid_values=_indent(\"\\n\".join(valid_values)),\n )\n\n\ndef _create_enum_classes(node_data: NodeData, base_type: str) -> str:\n return \"\\n\".join(\n [\n _create_enum_class(member, base_type)\n for member in node_data.member_variables\n if member.is_enum\n ]\n )\n\n\ndef _create_class(node_data: NodeData, base_type: str, is_root: bool) -> str:\n nested_classes = [\n _create_class(element, base_type=base_type, is_root=False)\n for element in node_data.children\n ]\n nested_classes_string = \"\\n\".join(nested_classes)\n\n return dedent(\n \"\"\"\n class {class_name}:\n {nested_classes}\n {enum_classes}\n {init_function}\n {get_set_properties}\n {save_load_functions}\n {eq_function}\n {str_function}\n \"\"\"\n ).format(\n class_name=node_data.name,\n nested_classes=_indent(nested_classes_string),\n enum_classes=_indent(_create_enum_classes(node_data, base_type=base_type)),\n init_function=_indent(\n _create_init_special_member_function(node_data, base_type=base_type)\n ),\n eq_function=_indent(_create_eq_special_member_function(node_data)),\n str_function=_indent(\n _create_str_special_member_function(node_data, base_type=base_type)\n ),\n get_set_properties=_indent(_create_properties(node_data, base_type=base_type)),\n save_load_functions=_indent(\n _create_save_load_functions(node_data, base_type=base_type)\n )\n if is_root\n else \"\",\n )\n\n\ndef _parse_internal_datamodel(current_class: Any) -> NodeData:\n child_classes = []\n if hasattr(current_class, \"valid_values\") and hasattr(current_class, \"enum\"):\n is_leaf = True\n elif current_class.node_type.name == \"leaf_data_model_list\":\n is_leaf = False\n else:\n for my_cls in _inner_classes_list(current_class):\n child_classes.append(_parse_internal_datamodel(my_cls))\n is_leaf = not bool(_inner_classes_list(current_class))\n\n member_variables = []\n member_containers = []\n to_be_removed = []\n for child in child_classes:\n if child.underlying_zivid_class.node_type.name == \"leaf_data_model_list\":\n child.container_info = ContainerInfo(\n contained_type=child.underlying_zivid_class.contained_type,\n underlying_type=child.underlying_zivid_class.value_type,\n )\n member_containers.append(child)\n to_be_removed.append(child)\n\n elif child.is_leaf:\n child.member_info = MemberInfo(\n is_optional=child.underlying_zivid_class.is_optional,\n underlying_type=child.underlying_zivid_class.value_type,\n )\n member_variables.append(child)\n to_be_removed.append(child)\n child_classes = [\n element for element in child_classes if element not in to_be_removed\n ]\n\n if hasattr(current_class, \"valid_values\") and hasattr(current_class, \"enum\"):\n is_enum_class = True\n enum_vars = []\n for member in dir(current_class.enum):\n if str(member).startswith(\"__\"):\n continue\n if str(member) == \"name\" or str(member) == \"value\":\n continue\n enum_vars.append(member)\n\n else:\n is_enum_class = False\n enum_vars = []\n\n return NodeData(\n name=current_class.name,\n snake_case=_to_snake_case(current_class.name),\n is_leaf=is_leaf,\n is_enum=is_enum_class,\n # The C++ generator creates the `is_array_like` attribute only on leaf nodes. The `is_leaf` check is to ensure\n # we don't access a non-existent `is_array_like` on other types of data model nodes.\n is_array_like=is_leaf and current_class.is_array_like,\n is_uninstantiated_node=current_class.uninstantiated_node,\n enum_vars=tuple(enum_vars),\n path=Path(current_class.path),\n children=tuple(child_classes),\n member_variables=tuple(member_variables),\n member_containers=tuple(member_containers),\n underlying_zivid_class=current_class,\n )\n\n\ndef _create_to_frontend_converter(node_data: NodeData, base_type: str) -> str:\n base_typename = base_type.split(\".\")[-1]\n temp_internal_name = f\"internal_{node_data.snake_case}\"\n nested_converters = [\n _create_to_frontend_converter(element, base_type=base_type)\n for element in node_data.children\n ]\n underscored_path = _get_underscore_name(base_type, node_data.path)\n\n container_convert_logic = \"\"\n for container in node_data.member_containers:\n if container.container_info is None:\n raise RuntimeError(f\"Unexpected lack of container info: {container}\")\n\n contained_converter = f\"_to_{underscored_path}_{_to_snake_case(container.container_info.contained_type)}\"\n container_convert_logic += f\"{container.snake_case} = [{contained_converter}(value) for value in {temp_internal_name}.{container.snake_case}.value],\"\n\n member_convert_logic = \"\"\n for member in node_data.member_variables:\n member_convert_logic += (\n \"{member} = {temp_internal_name}.{member}.value,\".format(\n member=member.snake_case,\n temp_internal_name=temp_internal_name,\n )\n )\n\n child_convert_logic = \"\"\n for child in node_data.children:\n if not child.is_uninstantiated_node:\n child_convert_logic += (\n \"{child_name}=_to_{child}({temp_internal_name}.{child_name}),\".format(\n child_name=child.snake_case,\n child=f\"{underscored_path}_{child.snake_case}\",\n temp_internal_name=temp_internal_name,\n )\n )\n\n base_function = dedent(\n f\"\"\"\n def _to_{underscored_path}(internal_{node_data.snake_case}):\n return {'.'.join((base_typename,) + node_data.path.parts)}({container_convert_logic} {child_convert_logic} {member_convert_logic})\n \"\"\"\n )\n nested_converters_string = \"\\n\".join(nested_converters)\n return dedent(\n f\"\"\"\n {nested_converters_string}\n {base_function}\n \"\"\"\n )\n\n\ndef _create_to_internal_converter(node_data: NodeData, base_type: str) -> str:\n temp_internal_name = f\"internal_{node_data.snake_case}\"\n nested_converters = [\n _create_to_internal_converter(element, base_type=base_type)\n for element in node_data.children\n ]\n underscored_path = _get_underscore_name(base_type, node_data.path)\n full_dot_path = _get_dot_path(base_type, node_data.path)\n\n convert_member_logic = \"\"\n\n for container in node_data.member_containers:\n if container.container_info is None:\n raise RuntimeError(f\"Unexpected lack of container info: {container}\")\n\n converter_for_contained = f\"_to_internal_{underscored_path}_{_to_snake_case(container.container_info.contained_type)}\"\n convert_member_logic += dedent(\n f\"\"\"\n temp_{container.snake_case} = {full_dot_path}.{container.name}()\n for value in {node_data.snake_case}.{container.snake_case}:\n temp_{container.snake_case}.append({converter_for_contained}(value))\n {temp_internal_name}.{container.snake_case} = temp_{container.snake_case}\n \"\"\"\n )\n\n if node_data.member_variables:\n for member in node_data.member_variables:\n constructor_arg = (\n f\"{node_data.snake_case}._{member.snake_case}.value\"\n if member.is_enum\n else f\"{node_data.snake_case}.{member.snake_case}\"\n )\n convert_member_logic += f\"\\n{temp_internal_name}.{member.snake_case} = {full_dot_path}.{member.name}({constructor_arg})\"\n\n convert_children_logic = \"\"\n if node_data.children:\n for child in node_data.children:\n if not child.is_uninstantiated_node:\n convert_children_logic += f\"\\n{temp_internal_name}.{child.snake_case} = _to_internal_{underscored_path}_{child.snake_case}({node_data.snake_case}.{child.snake_case})\"\n\n base_function = dedent(\n \"\"\"\n def {function_name}({function_arg}):\n {temp_internal_name} = {path}()\n {convert_member_logic}\n {convert_children_logic}\n return {temp_internal_name}\n \"\"\"\n ).format(\n function_name=f\"_to_internal_{underscored_path}\",\n function_arg=node_data.snake_case,\n temp_internal_name=temp_internal_name,\n path=full_dot_path,\n convert_member_logic=_indent(convert_member_logic),\n convert_children_logic=_indent(convert_children_logic),\n )\n\n nested_converters_string = \"\\n\".join(nested_converters)\n return dedent(\n f\"\"\"\n {nested_converters_string}\n {base_function}\n \"\"\"\n )\n\n\ndef _print_data_model(data_model: NodeData, indentation_level: int) -> None:\n if indentation_level == 0:\n print(\"*\" * 70)\n indentation = \" \" * 4 * indentation_level\n print(f\"{indentation}{data_model.name}\")\n for member in data_model.member_variables:\n print(f\"{indentation} - {member.snake_case}\")\n for child in data_model.children:\n _print_data_model(child, indentation_level + 1)\n\n\ndef _get_submodule(internal_class: Any) -> str:\n base_module = inspect.getmodule(internal_class)\n if base_module is None:\n raise RuntimeError(f\"Failed to detect module of: {internal_class}\")\n return base_module.__name__.replace(\"_zivid._zivid\", \"\")\n\n\ndef _generate_datamodel_frontend(\n internal_class: Any,\n destination: Path,\n extra_imports: List[str],\n verbose: bool = False,\n):\n # Parse the _zivid datamodel into a NodeData tree\n data_model = _parse_internal_datamodel(internal_class)\n _print_data_model(data_model, 0)\n\n # Convert NodeData tree to source code\n base_type = f\"{_get_submodule(internal_class)}.{internal_class.name}\".lstrip(\".\")\n raw_text = _imports(extra_imports=extra_imports)\n raw_text += _create_class(data_model, base_type=base_type, is_root=True)\n raw_text += _create_to_frontend_converter(data_model, base_type=base_type)\n raw_text += _create_to_internal_converter(data_model, base_type=base_type)\n\n # Format source code and save to destination path\n with tempfile.NamedTemporaryFile(suffix=\".py\") as temp_file:\n temp_file_path = Path(temp_file.name)\n temp_file_path.write_text(raw_text, encoding=\"utf-8\")\n if verbose:\n print(temp_file_path.read_text(encoding=\"utf-8\"))\n subprocess.check_output((f\"black {temp_file_path}\"), shell=True)\n if verbose:\n print(temp_file_path.read_text(encoding=\"utf-8\"))\n destination.write_text(\n temp_file_path.read_text(encoding=\"utf-8\"), encoding=\"utf-8\"\n )\n print(f\"Saved {internal_class.name} to {destination}.\")\n\n\ndef generate_all_datamodels(dest_dir: Path) -> None:\n for internal_class, filename, extra_imports in [\n (_zivid.Settings, \"settings.py\", [\"datetime\", \"collections.abc\"]),\n (_zivid.Settings2D, \"settings_2d.py\", [\"datetime\", \"collections.abc\"]),\n (_zivid.CameraInfo, \"camera_info.py\", []),\n (_zivid.CameraState, \"camera_state.py\", []),\n (_zivid.FrameInfo, \"frame_info.py\", [\"datetime\"]),\n (\n _zivid.capture_assistant.SuggestSettingsParameters,\n \"_suggest_settings_parameters.py\",\n [\"datetime\"],\n ),\n (_zivid.CameraIntrinsics, \"camera_intrinsics.py\", []),\n ]:\n _generate_datamodel_frontend(\n internal_class=internal_class,\n destination=dest_dir / filename,\n extra_imports=extra_imports,\n )\n\n\ndef _args() -> argparse.Namespace:\n parser = argparse.ArgumentParser()\n parser.add_argument(\n \"--dest-dir\", required=True, type=Path, help=\"Destination directory\"\n )\n return parser.parse_args()\n\n\nif __name__ == \"__main__\":\n args = _args()\n generate_all_datamodels(dest_dir=args.dest_dir)\n" }, { "alpha_fraction": 0.6703910827636719, "alphanum_fraction": 0.6759776473045349, "avg_line_length": 32.625, "blob_id": "f53f5723fd12d3e6269d94dc218011901f956dd1", "content_id": "f233136f1372a89500e33b97b965932557c97ddd", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Shell", "length_bytes": 537, "license_type": "permissive", "max_line_length": 94, "num_lines": 16, "path": "/continuous-integration/linux/create-source-distribution.sh", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "#!/bin/bash\n\nSCRIPT_DIR=\"$( cd \"$( dirname \"${BASH_SOURCE[0]}\" )\" && pwd )\"\nROOT_DIR=$(realpath \"$SCRIPT_DIR/../..\")\n\nsource $SCRIPT_DIR/venv.sh || exit $?\nactivate_venv || exit $?\n\n# Install minimal requirements to create the source distributions\npython3 -m pip install --requirement \"$SCRIPT_DIR/../python-requirements/build.txt\" || exit $?\n\n# Create source distribution\n# Note: setup.py must be called from the same directory, so we do a local \"cd\" in a subshell.\n(cd $ROOT_DIR && python setup.py sdist) || exit $?\n\necho Success! [$0]" }, { "alpha_fraction": 0.6992882490158081, "alphanum_fraction": 0.7038637399673462, "avg_line_length": 36.82692337036133, "blob_id": "13f0473e5318909334d47afeb4da887153d10144", "content_id": "b265b5adb7032fe5d4805e702825c860d9bbb2af", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3934, "license_type": "permissive", "max_line_length": 84, "num_lines": 104, "path": "/test/calibration/test_hand_eye.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "def test_handeye_input_init_failure(checkerboard_frames, transform):\n import pytest\n import zivid.calibration\n\n frame = checkerboard_frames[0]\n detection_result = zivid.calibration.detect_feature_points(frame.point_cloud())\n\n with pytest.raises(TypeError):\n # Should fail because pose should come as a Pose, not ndarray\n zivid.calibration.HandEyeInput(transform, detection_result)\n\n\ndef test_handeye_input(checkerboard_frames, transform):\n import numpy as np\n import zivid.calibration\n\n point_cloud = checkerboard_frames[0].point_cloud()\n detection_result = zivid.calibration.detect_feature_points(point_cloud)\n pose = zivid.calibration.Pose(transform)\n\n # Check construction of HandEyeInput\n handeye_input = zivid.calibration.HandEyeInput(pose, detection_result)\n assert handeye_input is not None\n assert isinstance(handeye_input, zivid.calibration.HandEyeInput)\n assert str(handeye_input)\n\n # Check returned Pose\n pose_returned = handeye_input.robot_pose()\n assert pose_returned is not None\n assert isinstance(pose_returned, zivid.calibration.Pose)\n np.testing.assert_array_equal(pose_returned.to_matrix(), transform)\n\n # Check returned DetectionResult\n detection_result_returned = handeye_input.detection_result()\n assert detection_result_returned is not None\n assert isinstance(detection_result_returned, zivid.calibration.DetectionResult)\n assert detection_result_returned.valid() == detection_result.valid()\n\n\ndef test_eyetohand_calibration(\n handeye_eth_frames, handeye_eth_poses, handeye_eth_transform\n):\n import numpy as np\n import zivid.calibration\n\n # Assemble input\n inputs = []\n for frame, pose_matrix in zip(handeye_eth_frames, handeye_eth_poses):\n inputs.append(\n zivid.calibration.HandEyeInput(\n zivid.calibration.Pose(pose_matrix),\n zivid.calibration.detect_feature_points(frame.point_cloud()),\n )\n )\n\n # Perform eye-to-hand calibration\n handeye_output = zivid.calibration.calibrate_eye_to_hand(inputs)\n assert isinstance(handeye_output, zivid.calibration.HandEyeOutput)\n assert handeye_output.valid()\n assert bool(handeye_output)\n assert str(handeye_output)\n\n # Check returned transform\n transform_returned = handeye_output.transform()\n assert isinstance(transform_returned, np.ndarray)\n assert transform_returned.shape == (4, 4)\n np.testing.assert_allclose(transform_returned, handeye_eth_transform, rtol=1e-5)\n\n # Check returned residuals\n residuals_returned = handeye_output.residuals()\n assert isinstance(residuals_returned, list)\n assert len(residuals_returned) == len(inputs)\n for residual in residuals_returned:\n assert isinstance(residual, zivid.calibration.HandEyeResidual)\n assert str(residual)\n assert isinstance(residual.translation(), float)\n assert residual.translation() >= 0.0\n assert isinstance(residual.rotation(), float)\n assert residual.rotation() >= 0.0\n\n\ndef test_eyetohand_calibration_save_load(handeye_eth_frames, handeye_eth_poses):\n from pathlib import Path\n import tempfile\n import zivid\n import numpy as np\n\n handeye_output = zivid.calibration.calibrate_eye_to_hand(\n [\n zivid.calibration.HandEyeInput(\n zivid.calibration.Pose(pose_matrix),\n zivid.calibration.detect_feature_points(frame.point_cloud()),\n )\n for frame, pose_matrix in zip(handeye_eth_frames, handeye_eth_poses)\n ]\n )\n\n with tempfile.TemporaryDirectory() as tmpdir, zivid.Application() as _:\n transform = handeye_output.transform()\n file_path = Path(tmpdir) / \"matrix.yml\"\n zivid.Matrix4x4(transform).save(file_path)\n np.testing.assert_allclose(\n zivid.Matrix4x4(transform), zivid.Matrix4x4(file_path), rtol=1e-6\n )\n" }, { "alpha_fraction": 0.6973224878311157, "alphanum_fraction": 0.7043073177337646, "avg_line_length": 32.03845977783203, "blob_id": "509515171976725ded6fd4633235f6c450dbb48c", "content_id": "72bbc4b7f63c011bd1231f979cc339af8c9a2a7e", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 859, "license_type": "permissive", "max_line_length": 111, "num_lines": 26, "path": "/src/CaptureAssistant.cpp", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "#include <Zivid/CaptureAssistant.h>\n\n#include <ZividPython/CaptureAssistant.h>\n#include <ZividPython/DataModelWrapper.h>\n#include <ZividPython/ReleasableCamera.h>\n#include <ZividPython/Wrappers.h>\n\n#include <pybind11/pybind11.h>\n\n#include <chrono>\n#include <vector>\n\nnamespace ZividPython::CaptureAssistant\n{\n void wrapAsSubmodule(pybind11::module &dest)\n {\n using namespace Zivid::CaptureAssistant;\n ZIVID_PYTHON_WRAP_DATA_MODEL(dest, SuggestSettingsParameters);\n\n dest.def(\"suggest_settings\",\n [](ReleasableCamera &camera,\n const Zivid::CaptureAssistant::SuggestSettingsParameters &suggestSettingsParameters) {\n return Zivid::CaptureAssistant::suggestSettings(camera.impl(), suggestSettingsParameters);\n });\n }\n} // namespace ZividPython::CaptureAssistant\n" }, { "alpha_fraction": 0.7017001509666443, "alphanum_fraction": 0.7078825235366821, "avg_line_length": 24.8799991607666, "blob_id": "bf403b3cec51e922f4aae60970564638f77c003a", "content_id": "8adb2dc36ff9596fc2b1313e7922c60d3da703dd", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 647, "license_type": "permissive", "max_line_length": 85, "num_lines": 25, "path": "/samples/sample_capture_assistant.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "\"\"\"Capture Assistant sample.\"\"\"\nimport datetime\nimport zivid\nfrom zivid.capture_assistant import SuggestSettingsParameters\n\n\ndef _main():\n app = zivid.Application()\n camera = app.connect_camera()\n\n suggest_settings_parameters = SuggestSettingsParameters(\n max_capture_time=datetime.timedelta(milliseconds=1200),\n ambient_light_frequency=SuggestSettingsParameters.AmbientLightFrequency.none,\n )\n\n settings = zivid.capture_assistant.suggest_settings(\n camera, suggest_settings_parameters\n )\n\n with camera.capture(settings) as frame:\n frame.save(\"result.zdf\")\n\n\nif __name__ == \"__main__\":\n _main()\n" }, { "alpha_fraction": 0.692341148853302, "alphanum_fraction": 0.6945169568061829, "avg_line_length": 20.885713577270508, "blob_id": "f2c9e755cab5ce846ffcd5d15996d99e1e2f58c8", "content_id": "bc4f27e2c0009a60f3031bc6d6b7721cd1da11f7", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2298, "license_type": "permissive", "max_line_length": 52, "num_lines": 105, "path": "/test/test_frame.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "import pytest\n\n\ndef test_illegal_init(application):\n import zivid\n\n with pytest.raises(RuntimeError):\n zivid.frame.Frame(\"non-exisiting-file.zdf\")\n with pytest.raises(TypeError):\n zivid.frame.Frame(None)\n with pytest.raises(TypeError):\n zivid.frame.Frame(12345)\n\n\ndef test_point_cloud(frame):\n import zivid\n\n point_cloud = frame.point_cloud()\n assert isinstance(point_cloud, zivid.PointCloud)\n\n\ndef test_path_init(application, frame_file):\n from pathlib import Path\n import zivid\n\n frame = zivid.frame.Frame(frame_file)\n assert isinstance(frame_file, Path)\n assert frame is not None\n assert isinstance(frame, zivid.frame.Frame)\n\n\ndef test_str_as_path_init(application, frame_file):\n import zivid\n\n frame = zivid.frame.Frame(str(frame_file))\n assert frame is not None\n assert isinstance(frame, zivid.frame.Frame)\n\n\ndef test_save(frame):\n import tempfile\n from pathlib import Path\n\n with tempfile.TemporaryDirectory() as temp_dir:\n save_path = Path(temp_dir) / \"save_test.zdf\"\n frame.save(save_path)\n assert save_path.exists()\n\n\ndef test_context_manager(application, frame_file):\n import zivid\n\n with zivid.frame.Frame(frame_file) as frame:\n frame.point_cloud()\n with pytest.raises(RuntimeError):\n frame.point_cloud()\n\n\ndef test_to_string(frame):\n string = str(frame)\n assert string\n assert isinstance(string, str)\n\n\ndef test_load(frame, frame_file):\n assert frame.load(frame_file) is None\n\n\ndef test_settings(frame):\n from zivid import Settings\n\n settings = frame.settings\n assert settings\n assert isinstance(settings, Settings)\n\n\ndef test_state(frame):\n from zivid.camera_state import CameraState\n\n state = frame.state\n assert state\n assert isinstance(state, CameraState)\n\n\ndef test_info(frame):\n from zivid.frame_info import FrameInfo\n\n info = frame.info\n assert info\n assert isinstance(info, FrameInfo)\n\n\ndef test_camera_info(frame):\n from zivid.camera_info import CameraInfo\n\n camera_info = frame.camera_info\n assert camera_info\n assert isinstance(camera_info, CameraInfo)\n\n\ndef test_release(frame):\n frame.point_cloud()\n frame.release()\n with pytest.raises(RuntimeError):\n frame.point_cloud()\n" }, { "alpha_fraction": 0.6522725224494934, "alphanum_fraction": 0.6584561467170715, "avg_line_length": 48.00505065917969, "blob_id": "e1c238b946cd430a7a28945a514bec2555371d68", "content_id": "ad4f4432b101e54cd351dbb7610426cb94cf88b1", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 9703, "license_type": "permissive", "max_line_length": 118, "num_lines": 198, "path": "/src/ReleasableArray2D.cpp", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "#include <ZividPython/ReleasableArray2D.h>\n\n#include <Zivid/PointCloud.h>\n#include <ZividPython/ReleasablePointCloud.h>\n\n#include <pybind11/pybind11.h>\n\nnamespace py = pybind11;\n\nnamespace\n{\n#pragma pack(push)\n struct PointXYZColorRGBA\n {\n float x, y, z;\n uint8_t r, g, b, a;\n };\n\n struct PointXYZColorBGRA\n {\n float x, y, z;\n uint8_t b, g, r, a;\n };\n#pragma pack(pop)\n\n template<typename NativeType, typename WrapperType, size_t depth>\n py::buffer_info pointCloudDataBuffer(ZividPython::ReleasableArray2D<NativeType> &arrayWrapper)\n {\n static_assert(depth > 0, \"Depth of array must be one or higher\");\n static_assert(sizeof(WrapperType) * depth == sizeof(NativeType), \"Unexpected data format\");\n\n constexpr py::ssize_t dim = (depth == 1) ? 2 : 3;\n const auto shape = { arrayWrapper.impl().height(), arrayWrapper.impl().width(), depth };\n const auto strides = { sizeof(WrapperType) * arrayWrapper.impl().width() * depth,\n sizeof(WrapperType) * depth,\n sizeof(WrapperType) };\n auto *dataPtr = static_cast<void *>(const_cast<NativeType *>(arrayWrapper.impl().data()));\n return py::buffer_info(dataPtr,\n sizeof(WrapperType),\n py::format_descriptor<WrapperType>::format(),\n dim,\n std::vector<py::ssize_t>(shape.begin(), shape.begin() + dim),\n std::vector<py::ssize_t>(strides.begin(), strides.begin() + dim));\n }\n\n template<typename NativeType>\n std::unique_ptr<ZividPython::ReleasableArray2D<NativeType>> pointCloudDataCopier(\n ZividPython::ReleasablePointCloud &pointCloud)\n {\n return std::make_unique<ZividPython::ReleasableArray2D<NativeType>>(pointCloud.impl().copyData<NativeType>());\n }\n\n} // namespace\n\nnamespace ZividPython\n{\n void wrapClass(pybind11::class_<ReleasableArray2D<Zivid::SNR>> pyClass)\n {\n using WrapperType = float;\n using NativeType = Zivid::SNR;\n static_assert(std::is_same_v<WrapperType, decltype(NativeType::value)>);\n\n pyClass.def(py::init<>(&pointCloudDataCopier<NativeType>))\n .def_buffer(pointCloudDataBuffer<NativeType, WrapperType, 1>);\n }\n\n void wrapClass(pybind11::class_<ReleasableArray2D<Zivid::ColorRGBA>> pyClass)\n {\n using WrapperType = uint8_t;\n using NativeType = Zivid::ColorRGBA;\n static_assert(std::is_same_v<WrapperType, decltype(NativeType::r)>);\n static_assert(std::is_same_v<WrapperType, decltype(NativeType::g)>);\n static_assert(std::is_same_v<WrapperType, decltype(NativeType::b)>);\n static_assert(std::is_same_v<WrapperType, decltype(NativeType::a)>);\n\n pyClass.def(py::init<>(&pointCloudDataCopier<NativeType>))\n .def_buffer(pointCloudDataBuffer<NativeType, WrapperType, 4>);\n }\n\n void wrapClass(pybind11::class_<ReleasableArray2D<Zivid::ColorBGRA>> pyClass)\n {\n using WrapperType = uint8_t;\n using NativeType = Zivid::ColorBGRA;\n static_assert(std::is_same_v<WrapperType, decltype(NativeType::b)>);\n static_assert(std::is_same_v<WrapperType, decltype(NativeType::g)>);\n static_assert(std::is_same_v<WrapperType, decltype(NativeType::r)>);\n static_assert(std::is_same_v<WrapperType, decltype(NativeType::a)>);\n\n pyClass.def(py::init<>(&pointCloudDataCopier<NativeType>))\n .def_buffer(pointCloudDataBuffer<NativeType, WrapperType, 4>);\n }\n\n void wrapClass(pybind11::class_<ReleasableArray2D<Zivid::NormalXYZ>> pyClass)\n {\n using WrapperType = float;\n using NativeType = Zivid::NormalXYZ;\n static_assert(std::is_same_v<WrapperType, decltype(NativeType::x)>);\n static_assert(std::is_same_v<WrapperType, decltype(NativeType::y)>);\n static_assert(std::is_same_v<WrapperType, decltype(NativeType::z)>);\n\n pyClass.def(py::init<>(&pointCloudDataCopier<NativeType>))\n .def_buffer(pointCloudDataBuffer<NativeType, WrapperType, 3>);\n }\n\n void wrapClass(pybind11::class_<ReleasableArray2D<Zivid::PointXYZ>> pyClass)\n {\n using WrapperType = float;\n using NativeType = Zivid::PointXYZ;\n static_assert(std::is_same_v<WrapperType, decltype(NativeType::x)>);\n static_assert(std::is_same_v<WrapperType, decltype(NativeType::y)>);\n static_assert(std::is_same_v<WrapperType, decltype(NativeType::z)>);\n\n pyClass.def(py::init<>(&pointCloudDataCopier<NativeType>))\n .def_buffer(pointCloudDataBuffer<NativeType, WrapperType, 3>);\n }\n\n void wrapClass(pybind11::class_<ReleasableArray2D<Zivid::PointXYZW>> pyClass)\n {\n using WrapperType = float;\n using NativeType = Zivid::PointXYZW;\n static_assert(std::is_same_v<WrapperType, decltype(NativeType::x)>);\n static_assert(std::is_same_v<WrapperType, decltype(NativeType::y)>);\n static_assert(std::is_same_v<WrapperType, decltype(NativeType::z)>);\n static_assert(std::is_same_v<WrapperType, decltype(NativeType::w)>);\n\n pyClass.def(py::init<>(&pointCloudDataCopier<NativeType>))\n .def_buffer(pointCloudDataBuffer<NativeType, WrapperType, 4>);\n }\n\n void wrapClass(pybind11::class_<ReleasableArray2D<Zivid::PointZ>> pyClass)\n {\n using WrapperType = float;\n using NativeType = Zivid::PointZ;\n\n static_assert(std::is_same_v<WrapperType, decltype(NativeType::z)>);\n\n pyClass.def(py::init<>(&pointCloudDataCopier<NativeType>))\n .def_buffer(pointCloudDataBuffer<NativeType, WrapperType, 1>);\n }\n\n void wrapClass(pybind11::class_<ReleasableArray2D<Zivid::PointXYZColorRGBA>> pyClass)\n {\n using WrapperType = PointXYZColorRGBA;\n using NativeType = Zivid::PointXYZColorRGBA;\n using NativePoint = decltype(NativeType::point);\n using NativeColor = decltype(NativeType::color);\n static_assert(std::is_same_v<decltype(WrapperType::x), decltype(NativePoint::x)>);\n static_assert(std::is_same_v<decltype(WrapperType::y), decltype(NativePoint::y)>);\n static_assert(std::is_same_v<decltype(WrapperType::z), decltype(NativePoint::z)>);\n static_assert(std::is_same_v<decltype(WrapperType::r), decltype(NativeColor::r)>);\n static_assert(std::is_same_v<decltype(WrapperType::g), decltype(NativeColor::g)>);\n static_assert(std::is_same_v<decltype(WrapperType::b), decltype(NativeColor::b)>);\n static_assert(std::is_same_v<decltype(WrapperType::a), decltype(NativeColor::a)>);\n // Additional layout checks for composite types\n static_assert(offsetof(NativeType, point) == offsetof(WrapperType, x));\n static_assert(offsetof(NativeType, color) == offsetof(WrapperType, r));\n static_assert(offsetof(NativePoint, x) == offsetof(WrapperType, x));\n static_assert(offsetof(NativePoint, y) == offsetof(WrapperType, y));\n static_assert(offsetof(NativePoint, z) == offsetof(WrapperType, z));\n static_assert(offsetof(NativeColor, r) == 0);\n static_assert(offsetof(NativeColor, g) == offsetof(WrapperType, g) - offsetof(WrapperType, r));\n static_assert(offsetof(NativeColor, b) == offsetof(WrapperType, b) - offsetof(WrapperType, r));\n static_assert(offsetof(NativeColor, a) == offsetof(WrapperType, a) - offsetof(WrapperType, r));\n\n PYBIND11_NUMPY_DTYPE(WrapperType, x, y, z, r, g, b, a);\n pyClass.def(py::init<>(&pointCloudDataCopier<NativeType>))\n .def_buffer(pointCloudDataBuffer<NativeType, WrapperType, 1>);\n }\n\n void wrapClass(pybind11::class_<ReleasableArray2D<Zivid::PointXYZColorBGRA>> pyClass)\n {\n using WrapperType = PointXYZColorBGRA;\n using NativeType = Zivid::PointXYZColorBGRA;\n using NativePoint = decltype(NativeType::point);\n using NativeColor = decltype(NativeType::color);\n static_assert(std::is_same_v<decltype(WrapperType::x), decltype(NativePoint::x)>);\n static_assert(std::is_same_v<decltype(WrapperType::y), decltype(NativePoint::y)>);\n static_assert(std::is_same_v<decltype(WrapperType::z), decltype(NativePoint::z)>);\n static_assert(std::is_same_v<decltype(WrapperType::b), decltype(NativeColor::b)>);\n static_assert(std::is_same_v<decltype(WrapperType::g), decltype(NativeColor::g)>);\n static_assert(std::is_same_v<decltype(WrapperType::r), decltype(NativeColor::r)>);\n static_assert(std::is_same_v<decltype(WrapperType::a), decltype(NativeColor::a)>);\n // Additional layout checks for composite types\n static_assert(offsetof(NativeType, point) == offsetof(WrapperType, x));\n static_assert(offsetof(NativeType, color) == offsetof(WrapperType, b));\n static_assert(offsetof(NativePoint, x) == offsetof(WrapperType, x));\n static_assert(offsetof(NativePoint, y) == offsetof(WrapperType, y));\n static_assert(offsetof(NativePoint, z) == offsetof(WrapperType, z));\n static_assert(offsetof(NativeColor, b) == 0);\n static_assert(offsetof(NativeColor, g) == offsetof(WrapperType, g) - offsetof(WrapperType, b));\n static_assert(offsetof(NativeColor, r) == offsetof(WrapperType, r) - offsetof(WrapperType, b));\n static_assert(offsetof(NativeColor, a) == offsetof(WrapperType, a) - offsetof(WrapperType, b));\n\n PYBIND11_NUMPY_DTYPE(WrapperType, x, y, z, b, g, r, a);\n pyClass.def(py::init<>(&pointCloudDataCopier<NativeType>))\n .def_buffer(pointCloudDataBuffer<NativeType, WrapperType, 1>);\n }\n} // namespace ZividPython\n" }, { "alpha_fraction": 0.546582043170929, "alphanum_fraction": 0.546582043170929, "avg_line_length": 32.990196228027344, "blob_id": "d1d2f6f8c881d6896275bf9e8c1a68395239868e", "content_id": "8de321894ea466d28297665d1a00543d1e86fb6f", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 13868, "license_type": "permissive", "max_line_length": 221, "num_lines": 408, "path": "/modules/zivid/frame_info.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "\"\"\"Auto generated, do not edit.\"\"\"\n# pylint: disable=too-many-lines,protected-access,too-few-public-methods,too-many-arguments,line-too-long,missing-function-docstring,missing-class-docstring,redefined-builtin,too-many-branches,too-many-boolean-expressions\nimport datetime\nimport _zivid\n\n\nclass FrameInfo:\n class SoftwareVersion:\n def __init__(\n self,\n core=_zivid.FrameInfo.SoftwareVersion.Core().value,\n ):\n if isinstance(core, (str,)):\n self._core = _zivid.FrameInfo.SoftwareVersion.Core(core)\n else:\n raise TypeError(\n \"Unsupported type, expected: (str,), got {value_type}\".format(\n value_type=type(core)\n )\n )\n\n @property\n def core(self):\n return self._core.value\n\n @core.setter\n def core(self, value):\n if isinstance(value, (str,)):\n self._core = _zivid.FrameInfo.SoftwareVersion.Core(value)\n else:\n raise TypeError(\n \"Unsupported type, expected: str, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n def __eq__(self, other):\n if self._core == other._core:\n return True\n return False\n\n def __str__(self):\n return str(_to_internal_frame_info_software_version(self))\n\n class SystemInfo:\n class CPU:\n def __init__(\n self,\n model=_zivid.FrameInfo.SystemInfo.CPU.Model().value,\n ):\n if isinstance(model, (str,)):\n self._model = _zivid.FrameInfo.SystemInfo.CPU.Model(model)\n else:\n raise TypeError(\n \"Unsupported type, expected: (str,), got {value_type}\".format(\n value_type=type(model)\n )\n )\n\n @property\n def model(self):\n return self._model.value\n\n @model.setter\n def model(self, value):\n if isinstance(value, (str,)):\n self._model = _zivid.FrameInfo.SystemInfo.CPU.Model(value)\n else:\n raise TypeError(\n \"Unsupported type, expected: str, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n def __eq__(self, other):\n if self._model == other._model:\n return True\n return False\n\n def __str__(self):\n return str(_to_internal_frame_info_system_info_cpu(self))\n\n class ComputeDevice:\n def __init__(\n self,\n model=_zivid.FrameInfo.SystemInfo.ComputeDevice.Model().value,\n vendor=_zivid.FrameInfo.SystemInfo.ComputeDevice.Vendor().value,\n ):\n if isinstance(model, (str,)):\n self._model = _zivid.FrameInfo.SystemInfo.ComputeDevice.Model(model)\n else:\n raise TypeError(\n \"Unsupported type, expected: (str,), got {value_type}\".format(\n value_type=type(model)\n )\n )\n\n if isinstance(vendor, (str,)):\n self._vendor = _zivid.FrameInfo.SystemInfo.ComputeDevice.Vendor(\n vendor\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: (str,), got {value_type}\".format(\n value_type=type(vendor)\n )\n )\n\n @property\n def model(self):\n return self._model.value\n\n @property\n def vendor(self):\n return self._vendor.value\n\n @model.setter\n def model(self, value):\n if isinstance(value, (str,)):\n self._model = _zivid.FrameInfo.SystemInfo.ComputeDevice.Model(value)\n else:\n raise TypeError(\n \"Unsupported type, expected: str, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n @vendor.setter\n def vendor(self, value):\n if isinstance(value, (str,)):\n self._vendor = _zivid.FrameInfo.SystemInfo.ComputeDevice.Vendor(\n value\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: str, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n def __eq__(self, other):\n if self._model == other._model and self._vendor == other._vendor:\n return True\n return False\n\n def __str__(self):\n return str(_to_internal_frame_info_system_info_compute_device(self))\n\n def __init__(\n self,\n operating_system=_zivid.FrameInfo.SystemInfo.OperatingSystem().value,\n cpu=None,\n compute_device=None,\n ):\n if isinstance(operating_system, (str,)):\n self._operating_system = _zivid.FrameInfo.SystemInfo.OperatingSystem(\n operating_system\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: (str,), got {value_type}\".format(\n value_type=type(operating_system)\n )\n )\n\n if cpu is None:\n cpu = self.CPU()\n if not isinstance(cpu, self.CPU):\n raise TypeError(\"Unsupported type: {value}\".format(value=type(cpu)))\n self._cpu = cpu\n\n if compute_device is None:\n compute_device = self.ComputeDevice()\n if not isinstance(compute_device, self.ComputeDevice):\n raise TypeError(\n \"Unsupported type: {value}\".format(value=type(compute_device))\n )\n self._compute_device = compute_device\n\n @property\n def operating_system(self):\n return self._operating_system.value\n\n @property\n def cpu(self):\n return self._cpu\n\n @property\n def compute_device(self):\n return self._compute_device\n\n @operating_system.setter\n def operating_system(self, value):\n if isinstance(value, (str,)):\n self._operating_system = _zivid.FrameInfo.SystemInfo.OperatingSystem(\n value\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: str, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n @cpu.setter\n def cpu(self, value):\n if not isinstance(value, self.CPU):\n raise TypeError(\"Unsupported type {value}\".format(value=type(value)))\n self._cpu = value\n\n @compute_device.setter\n def compute_device(self, value):\n if not isinstance(value, self.ComputeDevice):\n raise TypeError(\"Unsupported type {value}\".format(value=type(value)))\n self._compute_device = value\n\n def __eq__(self, other):\n if (\n self._operating_system == other._operating_system\n and self._cpu == other._cpu\n and self._compute_device == other._compute_device\n ):\n return True\n return False\n\n def __str__(self):\n return str(_to_internal_frame_info_system_info(self))\n\n def __init__(\n self,\n time_stamp=_zivid.FrameInfo.TimeStamp().value,\n software_version=None,\n system_info=None,\n ):\n if isinstance(time_stamp, (datetime.datetime,)):\n self._time_stamp = _zivid.FrameInfo.TimeStamp(time_stamp)\n else:\n raise TypeError(\n \"Unsupported type, expected: (datetime.datetime,), got {value_type}\".format(\n value_type=type(time_stamp)\n )\n )\n\n if software_version is None:\n software_version = self.SoftwareVersion()\n if not isinstance(software_version, self.SoftwareVersion):\n raise TypeError(\n \"Unsupported type: {value}\".format(value=type(software_version))\n )\n self._software_version = software_version\n\n if system_info is None:\n system_info = self.SystemInfo()\n if not isinstance(system_info, self.SystemInfo):\n raise TypeError(\"Unsupported type: {value}\".format(value=type(system_info)))\n self._system_info = system_info\n\n @property\n def time_stamp(self):\n return self._time_stamp.value\n\n @property\n def software_version(self):\n return self._software_version\n\n @property\n def system_info(self):\n return self._system_info\n\n @time_stamp.setter\n def time_stamp(self, value):\n if isinstance(value, (datetime.datetime,)):\n self._time_stamp = _zivid.FrameInfo.TimeStamp(value)\n else:\n raise TypeError(\n \"Unsupported type, expected: datetime.datetime, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n @software_version.setter\n def software_version(self, value):\n if not isinstance(value, self.SoftwareVersion):\n raise TypeError(\"Unsupported type {value}\".format(value=type(value)))\n self._software_version = value\n\n @system_info.setter\n def system_info(self, value):\n if not isinstance(value, self.SystemInfo):\n raise TypeError(\"Unsupported type {value}\".format(value=type(value)))\n self._system_info = value\n\n @classmethod\n def load(cls, file_name):\n return _to_frame_info(_zivid.FrameInfo(str(file_name)))\n\n def save(self, file_name):\n _to_internal_frame_info(self).save(str(file_name))\n\n def __eq__(self, other):\n if (\n self._time_stamp == other._time_stamp\n and self._software_version == other._software_version\n and self._system_info == other._system_info\n ):\n return True\n return False\n\n def __str__(self):\n return str(_to_internal_frame_info(self))\n\n\ndef _to_frame_info_software_version(internal_software_version):\n return FrameInfo.SoftwareVersion(\n core=internal_software_version.core.value,\n )\n\n\ndef _to_frame_info_system_info_cpu(internal_cpu):\n return FrameInfo.SystemInfo.CPU(\n model=internal_cpu.model.value,\n )\n\n\ndef _to_frame_info_system_info_compute_device(internal_compute_device):\n return FrameInfo.SystemInfo.ComputeDevice(\n model=internal_compute_device.model.value,\n vendor=internal_compute_device.vendor.value,\n )\n\n\ndef _to_frame_info_system_info(internal_system_info):\n return FrameInfo.SystemInfo(\n cpu=_to_frame_info_system_info_cpu(internal_system_info.cpu),\n compute_device=_to_frame_info_system_info_compute_device(\n internal_system_info.compute_device\n ),\n operating_system=internal_system_info.operating_system.value,\n )\n\n\ndef _to_frame_info(internal_frame_info):\n return FrameInfo(\n software_version=_to_frame_info_software_version(\n internal_frame_info.software_version\n ),\n system_info=_to_frame_info_system_info(internal_frame_info.system_info),\n time_stamp=internal_frame_info.time_stamp.value,\n )\n\n\ndef _to_internal_frame_info_software_version(software_version):\n internal_software_version = _zivid.FrameInfo.SoftwareVersion()\n\n internal_software_version.core = _zivid.FrameInfo.SoftwareVersion.Core(\n software_version.core\n )\n\n return internal_software_version\n\n\ndef _to_internal_frame_info_system_info_cpu(cpu):\n internal_cpu = _zivid.FrameInfo.SystemInfo.CPU()\n\n internal_cpu.model = _zivid.FrameInfo.SystemInfo.CPU.Model(cpu.model)\n\n return internal_cpu\n\n\ndef _to_internal_frame_info_system_info_compute_device(compute_device):\n internal_compute_device = _zivid.FrameInfo.SystemInfo.ComputeDevice()\n\n internal_compute_device.model = _zivid.FrameInfo.SystemInfo.ComputeDevice.Model(\n compute_device.model\n )\n internal_compute_device.vendor = _zivid.FrameInfo.SystemInfo.ComputeDevice.Vendor(\n compute_device.vendor\n )\n\n return internal_compute_device\n\n\ndef _to_internal_frame_info_system_info(system_info):\n internal_system_info = _zivid.FrameInfo.SystemInfo()\n\n internal_system_info.operating_system = _zivid.FrameInfo.SystemInfo.OperatingSystem(\n system_info.operating_system\n )\n\n internal_system_info.cpu = _to_internal_frame_info_system_info_cpu(system_info.cpu)\n internal_system_info.compute_device = (\n _to_internal_frame_info_system_info_compute_device(system_info.compute_device)\n )\n return internal_system_info\n\n\ndef _to_internal_frame_info(frame_info):\n internal_frame_info = _zivid.FrameInfo()\n\n internal_frame_info.time_stamp = _zivid.FrameInfo.TimeStamp(frame_info.time_stamp)\n\n internal_frame_info.software_version = _to_internal_frame_info_software_version(\n frame_info.software_version\n )\n internal_frame_info.system_info = _to_internal_frame_info_system_info(\n frame_info.system_info\n )\n return internal_frame_info\n" }, { "alpha_fraction": 0.716026246547699, "alphanum_fraction": 0.7375820279121399, "avg_line_length": 35.7931022644043, "blob_id": "dcf35430af6cd05ea3acbb40b1b699cadec90cd3", "content_id": "c73f9b76bfe09fec73a6dc4d06abf81084657915", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1067, "license_type": "permissive", "max_line_length": 87, "num_lines": 29, "path": "/test/converters/test_convert_settings_2d.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "def test_to_internal_settings_to_settings_modified():\n import datetime\n from zivid import Settings2D\n from zivid.settings_2d import _to_settings2d, _to_internal_settings2d\n\n modified_settings = Settings2D(\n acquisitions=[\n Settings2D.Acquisition(),\n Settings2D.Acquisition(exposure_time=datetime.timedelta(milliseconds=100)),\n ]\n )\n converted_settings = _to_settings2d(_to_internal_settings2d(modified_settings))\n assert modified_settings == converted_settings\n assert isinstance(converted_settings, Settings2D)\n assert isinstance(modified_settings, Settings2D)\n\n\ndef test_to_internal_settings_to_settings_default():\n from zivid import Settings2D\n from zivid.settings_2d import _to_settings2d, _to_internal_settings2d\n\n default_settings = Settings2D()\n converted_settings = _to_settings2d(_to_internal_settings2d(default_settings))\n assert default_settings == converted_settings\n assert isinstance(converted_settings, Settings2D)\n assert isinstance(default_settings, Settings2D)\n\n\n#\n" }, { "alpha_fraction": 0.750507116317749, "alphanum_fraction": 0.7515212893486023, "avg_line_length": 43.818180084228516, "blob_id": "6a5b535a6e4582f113dced049f99f5eaf8c65caa", "content_id": "b4c7543d07de9f9c113382e08ed870614daf45c8", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1972, "license_type": "permissive", "max_line_length": 91, "num_lines": 44, "path": "/test/converters/test_convert_suggest_settings_parameters.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "def test_to_internal_suggest_settings_parameters_to_suggest_settings_parameters_modified():\n from zivid.capture_assistant import SuggestSettingsParameters\n from zivid._suggest_settings_parameters import (\n _to_capture_assistant_suggest_settings_parameters,\n _to_internal_capture_assistant_suggest_settings_parameters,\n )\n\n modified_suggest_settings_parameters = SuggestSettingsParameters(\n ambient_light_frequency=SuggestSettingsParameters.AmbientLightFrequency.hz50\n )\n\n converted_suggest_settings_parameters = (\n _to_capture_assistant_suggest_settings_parameters(\n _to_internal_capture_assistant_suggest_settings_parameters(\n modified_suggest_settings_parameters\n )\n )\n )\n assert modified_suggest_settings_parameters == converted_suggest_settings_parameters\n assert isinstance(converted_suggest_settings_parameters, SuggestSettingsParameters)\n assert isinstance(modified_suggest_settings_parameters, SuggestSettingsParameters)\n\n\ndef test_to_internal_suggest_settings_parameters_to_suggest_settings_parameters_default():\n from zivid.capture_assistant import SuggestSettingsParameters\n from zivid._suggest_settings_parameters import (\n _to_capture_assistant_suggest_settings_parameters,\n _to_internal_capture_assistant_suggest_settings_parameters,\n )\n\n default_suggest_settings_parameters = SuggestSettingsParameters()\n converted_suggest_settings_parameters = (\n _to_capture_assistant_suggest_settings_parameters(\n _to_internal_capture_assistant_suggest_settings_parameters(\n default_suggest_settings_parameters\n )\n )\n )\n assert default_suggest_settings_parameters == converted_suggest_settings_parameters\n assert isinstance(converted_suggest_settings_parameters, SuggestSettingsParameters)\n assert isinstance(default_suggest_settings_parameters, SuggestSettingsParameters)\n\n\n#\n" }, { "alpha_fraction": 0.6376758217811584, "alphanum_fraction": 0.6491487622261047, "avg_line_length": 31.554216384887695, "blob_id": "820dfdb54fe648684ad43a62aeb604849de3510a", "content_id": "4b885dd33ecb6a9757c25363e6d4f78f703f9627", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2702, "license_type": "permissive", "max_line_length": 100, "num_lines": 83, "path": "/modules/_zivid/__init__.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "\"\"\"This file imports used classes, modules and packages.\"\"\"\n\nimport ctypes\nimport importlib\nimport platform\nimport sys\nfrom pathlib import Path\n\nif (\n platform.system() == \"Windows\"\n and sys.version_info.major == 3\n and sys.version_info.minor >= 8\n):\n # Starting with Python 3.8, the .dll search mechanism has changed.\n # WinDLL has anew argument \"winmode\",\n # https://docs.python.org/3.8/library/ctypes.html\n # and it turns out that we MUST import the pybind11 generated module\n # with \"winmode=0\". After doing this, the following import statement\n # picks this up since it's already imported, and things work as intended.\n #\n # The winmode parameter is used on Windows to specify how the library is\n # loaded (since mode is ignored). It takes any value that is valid for the\n # Win32 API LoadLibraryEx flags parameter. When omitted, the default is to\n # use the flags that result in the most secure DLL load to avoiding issues\n # such as DLL hijacking. Passing winmode=0 passes 0 as dwFlags to\n # LoadLibraryExA:\n # https://docs.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-loadlibraryexa\n\n package_dir = Path(importlib.util.find_spec(\"_zivid\").origin).parent\n pyd_files = list(package_dir.glob(\"_zivid*.pyd\"))\n assert len(pyd_files) == 1\n ctypes.WinDLL(str(pyd_files[0]), winmode=0)\n\ntry:\n from _zivid._zivid import ( # pylint: disable=import-error,no-name-in-module\n __version__,\n Application,\n Array2DColorRGBA,\n Array2DColorBGRA,\n Array2DNormalXYZ,\n Array2DPointXYZ,\n Array2DPointXYZColorRGBA,\n Array2DPointXYZColorBGRA,\n Array2DPointXYZW,\n Array2DPointZ,\n Array2DSNR,\n Camera,\n CameraIntrinsics,\n CameraState,\n firmware,\n calibration,\n capture_assistant,\n Frame,\n FrameInfo,\n PointCloud,\n Settings,\n version,\n Settings2D,\n Frame2D,\n ImageRGBA,\n ImageBGRA,\n CameraInfo,\n infield_correction,\n Matrix4x4,\n data_model,\n projection,\n ProjectedImage,\n )\nexcept ImportError as ex:\n\n def __missing_sdk_error_message():\n error_message = \"\"\"Failed to import the Zivid Python C-module, please verify that:\n - Zivid SDK is installed\n - Zivid SDK version is matching the SDK version part of the Zivid Python version \"\"\"\n if platform.system() != \"Windows\":\n return error_message\n return (\n error_message\n + \"\"\"\n - Zivid SDK libraries location is in system PATH\"\"\"\n )\n\n raise ImportError(__missing_sdk_error_message()) from ex\n" }, { "alpha_fraction": 0.5650684833526611, "alphanum_fraction": 0.5673515796661377, "avg_line_length": 24.764705657958984, "blob_id": "97911f70892c4ed8a8b03dbbb471e4660b7a709a", "content_id": "b9513ab8ecffc5ed492676fc72f7659697b8fa13", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 876, "license_type": "permissive", "max_line_length": 85, "num_lines": 34, "path": "/continuous-integration/windows/common.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "import sys\nimport subprocess\nfrom pathlib import Path\n\n\ndef repo_root():\n return Path(__file__).resolve().parents[2]\n\n\ndef run_process(args, env=None, workdir=None):\n sys.stdout.flush()\n try:\n with subprocess.Popen(args, env=env, cwd=workdir) as process:\n exit_code = process.wait()\n if exit_code != 0:\n raise RuntimeError(\"Wait failed with exit code {}\".format(exit_code))\n except Exception as ex:\n raise type(ex)(\"Process failed: '{}'.\".format(\" \".join(args))) from ex\n finally:\n sys.stdout.flush()\n\n\ndef install_pip_dependencies(requirements_file):\n print(\"Installing python test requirements\", flush=True)\n run_process(\n (\n \"python\",\n \"-m\",\n \"pip\",\n \"install\",\n \"--requirement\",\n str(requirements_file),\n )\n )\n" }, { "alpha_fraction": 0.6988082528114319, "alphanum_fraction": 0.6988082528114319, "avg_line_length": 21.512195587158203, "blob_id": "fd9334a5da5633a76229bb1bbf763ada66f943e0", "content_id": "8154401e4e5b95829be3a6a7f5534f7dfe588337", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 923, "license_type": "permissive", "max_line_length": 65, "num_lines": 41, "path": "/test/test_firmware.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "import pytest\n\n\ndef test_is_up_to_date(file_camera):\n from zivid.firmware import is_up_to_date\n\n assert is_up_to_date(file_camera)\n\n\ndef test_update_without_callback(file_camera):\n import _zivid\n from zivid.firmware import update\n\n file_camera.disconnect()\n with pytest.raises(RuntimeError):\n update(file_camera)\n\n\ndef test_update_with_progress_callback(file_camera):\n import _zivid\n from zivid.firmware import update\n\n def callback(progress, description):\n print(\"{}% {}\".format(progress, description), flush=True)\n\n file_camera.disconnect()\n\n with pytest.raises(RuntimeError):\n update(file_camera, progress_callback=callback)\n\n\ndef test_update_illegal_callback(file_camera):\n from zivid.firmware import update\n\n def illegal_callback():\n pass\n\n file_camera.disconnect()\n\n with pytest.raises(TypeError):\n update(file_camera, illegal_callback)\n" }, { "alpha_fraction": 0.7307692170143127, "alphanum_fraction": 0.7649572491645813, "avg_line_length": 20.272727966308594, "blob_id": "548e3bc7f53a83a754a371e80f08decf7b939bf5", "content_id": "5c57707078a2da01dfdb33889132015237bfe549", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 234, "license_type": "permissive", "max_line_length": 49, "num_lines": 11, "path": "/src/include/ZividPython/Projection.h", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "#pragma once\n\n#include <ZividPython/Wrappers.h>\n\n#include <pybind11/numpy.h>\n#include <pybind11/pybind11.h>\n\nnamespace ZividPython::Projection\n{\n void wrapAsSubmodule(pybind11::module &dest);\n} // namespace ZividPython::Projection\n" }, { "alpha_fraction": 0.5653149485588074, "alphanum_fraction": 0.5737704634666443, "avg_line_length": 30.66666603088379, "blob_id": "cf4d3848b8fa77e57ffce0e01df6b8557fc56bcd", "content_id": "a0b06f6d0317c40cb7a0338a170afadc635a12bf", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 5795, "license_type": "permissive", "max_line_length": 101, "num_lines": 183, "path": "/modules/zivid/point_cloud.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "\"\"\"Contains the PointCloud class.\"\"\"\nimport numpy\n\nimport _zivid\n\n\nclass PointCloud:\n \"\"\"Point cloud with x, y, z, RGB and color laid out on a 2D grid.\n\n An instance of this class is a handle to a point cloud stored on the compute device memory.\n Use the method copy_data to copy point cloud data from the compute device to a numpy\n array in host memory. Several formats are available.\n \"\"\"\n\n class Downsampling: # pylint: disable=too-few-public-methods\n \"\"\"Collection of valid options to PointCloud.downsample().\"\"\"\n\n by2x2 = \"by2x2\"\n by3x3 = \"by3x3\"\n by4x4 = \"by4x4\"\n\n _valid_values = {\n \"by2x2\": _zivid.PointCloud.Downsampling.by2x2,\n \"by3x3\": _zivid.PointCloud.Downsampling.by3x3,\n \"by4x4\": _zivid.PointCloud.Downsampling.by4x4,\n }\n\n @classmethod\n def valid_values(cls):\n \"\"\"Get list of allowed values.\n\n Returns:\n List of strings\n \"\"\"\n return list(cls._valid_values.keys())\n\n def __init__(self, impl):\n \"\"\"Initialize PointCloud wrapper.\n\n This constructor is only used internally, and should not be called by the end-user.\n\n Args:\n impl: Reference to internal/back-end instance.\n\n Raises:\n TypeError: If argument does not match the expected internal class.\n \"\"\"\n if not isinstance(impl, _zivid.PointCloud):\n raise TypeError(\n \"Unsupported type for argument impl. Got {}, expected {}\".format(\n type(impl), type(_zivid.PointCloud)\n )\n )\n self.__impl = impl\n\n def copy_data(self, data_format):\n \"\"\"Copy point cloud data from GPU to numpy array.\n\n Supported data formats:\n xyz: ndarray(Height,Width,3) of float\n xyzw: ndarray(Height,Width,4) of float\n z: ndarray(Height,Width) of float\n rgba: ndarray(Height,Width,4) of uint8\n bgra: ndarray(Height,Width,4) of uint8\n normals: ndarray(Height,Width,3) of float\n snr: ndarray(Height,Width) of float\n xyzrgba: ndarray(Height,Width) of composite dtype (accessed with e.g. arr[\"x\"])\n xyzbgra: ndarray(Height,Width) of composite dtype (accessed with e.g. arr[\"x\"])\n\n Args:\n data_format: A string specifying the data to be copied\n\n Returns:\n A numpy array with the requested data.\n\n Raises:\n ValueError: if the requested data format does not exist\n \"\"\"\n self.__impl.assert_not_released()\n\n data_formats = {\n \"xyz\": _zivid.Array2DPointXYZ,\n \"xyzw\": _zivid.Array2DPointXYZW,\n \"z\": _zivid.Array2DPointZ,\n \"rgba\": _zivid.Array2DColorRGBA,\n \"bgra\": _zivid.Array2DColorBGRA,\n \"normals\": _zivid.Array2DNormalXYZ,\n \"snr\": _zivid.Array2DSNR,\n \"xyzrgba\": _zivid.Array2DPointXYZColorRGBA,\n \"xyzbgra\": _zivid.Array2DPointXYZColorBGRA,\n }\n try:\n data_format_class = data_formats[data_format]\n except KeyError as ex:\n raise ValueError(\n \"Unsupported data format: {data_format}. Supported formats: {all_formats}\".format(\n data_format=data_format, all_formats=list(data_formats.keys())\n )\n ) from ex\n return numpy.array(data_format_class(self.__impl))\n\n def transform(self, matrix):\n \"\"\"Transform the point cloud in-place by a 4x4 transformation matrix.\n\n The transform matrix must be affine, i.e., the last row of the matrix should be [0, 0, 0, 1].\n\n Args:\n matrix: A 4x4 numpy arrays of floats\n\n Returns:\n Reference to the same PointCloud instance (for chaining calls)\n \"\"\"\n self.__impl.transform(matrix)\n return self\n\n def downsample(self, downsampling):\n \"\"\"Downsample the point cloud in-place.\n\n Args:\n downsampling: One of the strings in PointCloud.Downsample.valid_values()\n\n Returns:\n Reference to the same PointCloud instance (for chaining calls)\n \"\"\"\n internal_downsampling = (\n PointCloud.Downsampling._valid_values[ # pylint: disable=protected-access\n downsampling\n ]\n )\n self.__impl.downsample(internal_downsampling)\n return self\n\n def downsampled(self, downsampling):\n \"\"\"Get a downsampled copy of the point cloud.\n\n Args:\n downsampling: One of the strings in PointCloud.Downsample.valid_values()\n\n Returns:\n A new PointCloud instance\n \"\"\"\n internal_downsampling = (\n PointCloud.Downsampling._valid_values[ # pylint: disable=protected-access\n downsampling\n ]\n )\n return PointCloud(self.__impl.downsampled(internal_downsampling))\n\n @property\n def height(self):\n \"\"\"Get the height of the point cloud (number of rows).\n\n Returns:\n A positive integer\n \"\"\"\n return self.__impl.height()\n\n @property\n def width(self):\n \"\"\"Get the width of the point cloud (number of columns).\n\n Returns:\n A positive integer\n \"\"\"\n return self.__impl.width()\n\n def release(self):\n \"\"\"Release the underlying resources.\"\"\"\n try:\n impl = self.__impl\n except AttributeError:\n pass\n else:\n impl.release()\n\n def __enter__(self):\n return self\n\n def __exit__(self, exception_type, exception_value, traceback):\n self.release()\n\n def __del__(self):\n self.release()\n" }, { "alpha_fraction": 0.652482271194458, "alphanum_fraction": 0.6595744490623474, "avg_line_length": 28.375, "blob_id": "1f54c3d5d98789f7c2b741e26bac5d5df91fa0d9", "content_id": "4dcf269ffeaf91cd66bca9240623b419d23d4c05", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Shell", "length_bytes": 705, "license_type": "permissive", "max_line_length": 67, "num_lines": 24, "path": "/continuous-integration/linux/collect-and-check-artifacts.sh", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "#!/bin/bash\n\nSCRIPT_DIR=\"$( cd \"$( dirname \"${BASH_SOURCE[0]}\" )\" && pwd )\"\nCI_DIR=$(realpath \"$SCRIPT_DIR/..\")\nROOT_DIR=$(realpath \"$SCRIPT_DIR/../..\")\n\n# Simple setup\napt-get update || exit $?\napt-get install --yes python3 python3-venv || exit $?\nsource $SCRIPT_DIR/venv.sh || exit $?\ncreate_venv || exit $?\nactivate_venv || exit $?\n\npython3 -m pip install twine || exit $?\n\n# Move artifacts into a common directory\nmkdir \"$ROOT_DIR/distribution\" || exit $?\ncp \"$ROOT_DIR/artifacts\"/*/* \"$ROOT_DIR/distribution\" || exit $?\n\n# Check against artifact list\npython3 \"$CI_DIR/deployment/check_expected_artifacts.py\" || exit $?\n\n# Check contents of artifacts\ntwine check \"$ROOT_DIR/distribution\"/* || exit $?\n" }, { "alpha_fraction": 0.7420814633369446, "alphanum_fraction": 0.7692307829856873, "avg_line_length": 21.100000381469727, "blob_id": "653bd27819f89e28ea2395e9e037edcc927bbeb0", "content_id": "11f4f4978b7dae69dde01c0e1e78244de63878f0", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 221, "license_type": "permissive", "max_line_length": 82, "num_lines": 10, "path": "/src/include/ZividPython/Calibration/Detector.h", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "#pragma once\n\n#include <Zivid/Calibration/Detector.h>\n\n#include <pybind11/pybind11.h>\n\nnamespace ZividPython\n{\n void wrapClass(pybind11::class_<Zivid::Calibration::DetectionResult> pyClass);\n} // namespace ZividPython\n" }, { "alpha_fraction": 0.47664985060691833, "alphanum_fraction": 0.47863325476646423, "avg_line_length": 35.97666549682617, "blob_id": "97a94ede0d10a4d9ede56c0734421131a3c97da5", "content_id": "1b77470140c0ebcc62585cf6c99eab87a87f8d63", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 11092, "license_type": "permissive", "max_line_length": 120, "num_lines": 300, "path": "/src/include/ZividPython/DataModelWrapper.h", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "#pragma once\n\n#include \"ZividPython/Wrappers.h\"\n#include <ZividPython/DependentFalse.h>\n\n#include <Zivid/DataModel/Traits.h>\n#include <Zivid/Settings.h>\n#include <Zivid/Settings2D.h>\n\n#include <pybind11/chrono.h>\n#include <pybind11/operators.h>\n#include <pybind11/pybind11.h>\n#include <pybind11/stl.h>\n\n#include <algorithm>\n\nnamespace py = pybind11;\n\nnamespace\n{\n template<typename T>\n class TypeIsZividRange : public std::false_type\n {};\n\n template<typename U>\n class TypeIsZividRange<Zivid::Range<U>> : public std::true_type\n {};\n\n} // namespace\n\nnamespace ZividPython\n{\n namespace Detail\n {\n // Need this indirection to work around an ICE in MSVC\n template<typename Target, typename Source>\n auto getHelper(const Source &s)\n {\n return s.template get<Target>();\n }\n\n template<typename T>\n bool hasValue(const T &leaf)\n {\n if constexpr(Zivid::DataModel::IsOptional<T>::value)\n {\n return leaf.hasValue();\n }\n return true;\n }\n\n template<typename T, typename = void>\n struct TypeName\n {\n static_assert(DependentFalse<T>::value, \"Unexpected type\");\n };\n\n template<typename T>\n struct TypeName<T, std::enable_if_t<std::is_enum_v<T>>>\n {\n static constexpr const char *value{ \"enum\" };\n };\n\n template<typename T>\n struct TypeName<std::vector<T>>\n {\n static constexpr const char *value{ \"(collections.abc.Iterable,)\" };\n };\n\n template<>\n struct TypeName<Zivid::PointXYZ>\n {\n static constexpr const char *value{ \"(collections.abc.Iterable, _zivid.data_model.PointXYZ)\" };\n };\n\n template<>\n struct TypeName<Zivid::Range<double>>\n {\n static constexpr const char *value{ \"(collections.abc.Iterable, _zivid.data_model.Range)\" };\n };\n\n template<>\n struct TypeName<uint32_t>\n {\n static constexpr const char *value{ \"(int,)\" };\n };\n\n template<>\n struct TypeName<uint64_t>\n {\n static constexpr const char *value{ \"(int,)\" };\n };\n\n template<>\n struct TypeName<int>\n {\n static constexpr const char *value{ \"(int,)\" };\n };\n\n template<>\n struct TypeName<bool>\n {\n static constexpr const char *value{ \"(bool,)\" };\n };\n\n template<>\n struct TypeName<float>\n {\n static constexpr const char *value{ \"(float, int,)\" };\n };\n\n template<>\n struct TypeName<double>\n {\n static constexpr const char *value{ TypeName<float>::value };\n };\n\n template<>\n struct TypeName<std::chrono::microseconds>\n {\n static constexpr const char *value{ \"(datetime.timedelta,)\" };\n };\n\n template<>\n struct TypeName<std::chrono::milliseconds>\n {\n static constexpr const char *value{ \"(datetime.timedelta,)\" };\n };\n\n template<>\n struct TypeName<std::chrono::system_clock::time_point>\n {\n static constexpr const char *value{ \"(datetime.datetime,)\" };\n };\n\n template<>\n struct TypeName<std::string>\n {\n static constexpr const char *value{ \"(str,)\" };\n };\n\n template<typename T>\n struct TypeName<std::optional<T>>\n {\n static constexpr const char *value{ TypeName<T>::value };\n };\n\n template<bool isRoot, typename Dest, typename Target>\n py::class_<Target> wrapDataModel(Dest &dest, const Target &target, const bool uninstantiatedNode = false)\n {\n py::class_<Target> pyClass{ dest, Target::name };\n\n pyClass.def(py::init())\n .def(\"__repr__\", &Target::toString)\n .def(\"to_string\", &Target::toString)\n .def(py::self == py::self) // NOLINT\n .def(py::self != py::self) // NOLINT\n .def_readonly_static(\"node_type\", &Target::nodeType)\n .def_readonly_static(\"name\", &Target::name)\n .def_readonly_static(\"path\", &Target::path);\n\n pyClass.attr(\"uninstantiated_node\") = uninstantiatedNode;\n\n if constexpr(isRoot)\n {\n pyClass.def(py::init<const std::string &>(), py::arg(\"file_name\"))\n .def(\"save\", &Target::save, py::arg(\"file_name\"))\n .def(\"load\", &Target::load, py::arg(\"file_name\"));\n }\n\n if constexpr(Target::nodeType == Zivid::DataModel::NodeType::group)\n {\n // TODO: Workaround for no API to access uninstansiated nodes.\n // This generator should work on types and not instances.\n if constexpr(std::is_same_v<Target, Zivid::Settings> || std::is_same_v<Target, Zivid::Settings2D>)\n {\n wrapDataModel<false>(pyClass, typename Target::Acquisition{}, true);\n }\n\n target.forEach([&](const auto &member) {\n wrapDataModel<false>(pyClass, member);\n\n using MemberType = std::remove_const_t<std::remove_reference_t<decltype(member)>>;\n\n const std::string name = toSnakeCase(MemberType::name);\n\n pyClass.def_property(\n name.c_str(),\n [](const Target &read) { return Detail::getHelper<MemberType>(read); },\n [](Target &write, const MemberType &value) { return write.set(value); });\n });\n }\n else if constexpr(Target::nodeType == Zivid::DataModel::NodeType::leafValue)\n {\n using ValueType = typename Target::ValueType;\n\n pyClass.attr(\"is_optional\") = Zivid::DataModel::IsOptional<Target>::value;\n pyClass.attr(\"value_type\") = TypeName<ValueType>::value;\n\n if constexpr(std::is_enum_v<ValueType>)\n {\n ZIVID_PYTHON_WRAP_ENUM_CLASS_BASE_IMPL(pyClass, \"enum\", ValueType, [](auto &pyEnum) {\n for(const auto &value : Target::validValues())\n {\n auto name = Target{ value }.toString();\n if(name == \"global\")\n {\n // Special handling due to \"global\" being a reserved keyword in Python.\n // The standard in these cases is to add a trailing underscore.\n // https://peps.python.org/pep-0008/#naming-conventions\n name = name + \"_\";\n }\n pyEnum.value(name.c_str(), value);\n }\n pyEnum.export_values();\n });\n }\n\n if constexpr(!Zivid::DataModel::IsOptional<Target>::value)\n {\n pyClass.def(py::init<const ValueType &>(), py::arg(\"value\"));\n }\n else\n {\n pyClass.def(py::init([](std::optional<ValueType> &value) {\n if(value)\n {\n return std::make_unique<Target>(value.value());\n }\n return std::make_unique<Target>();\n }),\n py::arg(\"value\"));\n }\n\n pyClass.def_property_readonly(\"value\",\n [](const Target &read) -> std::optional<typename Target::ValueType> {\n if(hasValue(read))\n {\n return read.value();\n }\n else\n {\n return {};\n }\n });\n\n if constexpr(Zivid::DataModel::HasValidRange<Target>::value)\n {\n pyClass.def_property_readonly(\"valid_range\", [](const Target &) {\n const auto range = Target::validRange();\n return std::make_pair(range.min(), range.max());\n });\n pyClass.def(py::self > py::self); // NOLINT\n pyClass.def(py::self < py::self); // NOLINT\n }\n\n pyClass.attr(\"is_array_like\") = TypeIsZividRange<typename Target::ValueType>::value\n || std::is_same<typename Target::ValueType, Zivid::PointXYZ>::value;\n\n if constexpr(Zivid::DataModel::HasValidValues<Target>::value)\n {\n pyClass.def_property_readonly(\"valid_values\", [](const Target &) { return Target::validValues(); });\n }\n\n if constexpr(Zivid::DataModel::HasValidSize<Target>::value)\n {\n pyClass.def_property_readonly(\"valid_size\", [](const Target &) {\n const auto size = Target::validSize();\n return std::make_pair(size.min(), size.max());\n });\n }\n }\n else if constexpr(Target::nodeType == Zivid::DataModel::NodeType::leafDataModelList)\n {\n using ValueTypeContainer = typename Target::ValueType;\n using ValueTypeContained = typename Target::ValueType::value_type;\n pyClass.attr(\"value_type\") = TypeName<ValueTypeContainer>::value;\n pyClass.attr(\"is_optional\") = Zivid::DataModel::IsOptional<Target>::value;\n pyClass.attr(\"contained_type\") = ValueTypeContained::name;\n\n pyClass.def_property_readonly(\"value\", &Target::value)\n .def(\"append\", [](Target &write, ValueTypeContained value) { write.emplaceBack(std::move(value)); })\n .def(\"size\", &Target::size)\n .def(\"is_empty\", &Target::isEmpty)\n .def(\"at\", [](Target &write, const size_t index) { return write.at(index); });\n }\n else\n {\n static_assert(DependentFalse<Target>::value, \"Target NodeType is unsupported\");\n }\n return pyClass;\n }\n } // namespace Detail\n\n template<typename Dest, typename Target>\n py::class_<Target> wrapDataModel(Dest &dest, const Target &target)\n {\n return Detail::wrapDataModel<true>(dest, target);\n }\n} // namespace ZividPython" }, { "alpha_fraction": 0.6228187680244446, "alphanum_fraction": 0.6228187680244446, "avg_line_length": 29.40816307067871, "blob_id": "76f0b8c7ee6295686f0862d0ce0e9eb8af6d1cb7", "content_id": "fe5754a532ca301e0a474dcdd01ffaa161204ccd", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1490, "license_type": "permissive", "max_line_length": 109, "num_lines": 49, "path": "/samples/sample_infield_correction.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "\"\"\"Sample demonstrating in-field correction (experimental).\"\"\"\nimport zivid\n\nfrom zivid.experimental.calibration import (\n detect_feature_points,\n InfieldCorrectionInput,\n compute_camera_correction,\n write_camera_correction,\n)\n\n\ndef _main():\n app = zivid.Application()\n camera = app.connect_camera()\n\n infield_inputs = []\n\n try:\n while True:\n detection_result = detect_feature_points(camera)\n infield_input = InfieldCorrectionInput(detection_result)\n if infield_input.valid():\n print(\"Measurement OK. Appending to dataset.\")\n infield_inputs.append(infield_input)\n else:\n print(\n f\"Warning: Measurement invalid [{infield_input.status_description()}]. Please try again.\"\n )\n\n input(\n \"Hit [Enter] to continue, or [Ctrl+C] to end capture loop and calculate correction.\"\n )\n except KeyboardInterrupt:\n print(\"\\nCapture loop ended.\")\n\n correction = compute_camera_correction(infield_inputs)\n print(\"Successfully calculated camera correction\")\n print(correction.accuracy_estimate())\n print(correction.accuracy_estimate().dimension_accuracy())\n\n answer = input(\"Write correction to camera? (y/n)\")\n if answer == \"y\":\n print(\"Writing correction to camera\")\n write_camera_correction(camera, correction)\n print(\"Finished\")\n\n\nif __name__ == \"__main__\":\n _main()\n" }, { "alpha_fraction": 0.61932772397995, "alphanum_fraction": 0.6310924291610718, "avg_line_length": 40.034481048583984, "blob_id": "8b60ba774e0c85d906aa3c8586ffd985c1472478", "content_id": "25a5ea5eb301be21ed3b9bfa0b4a4331b16a7bb8", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 1190, "license_type": "permissive", "max_line_length": 108, "num_lines": 29, "path": "/src/Calibration/MultiCamera.cpp", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "#include <ZividPython/Calibration/MultiCamera.h>\n#include <ZividPython/Matrix.h>\n\n#include <pybind11/pybind11.h>\n#include <pybind11/stl.h>\n\nnamespace py = pybind11;\n\nnamespace ZividPython\n{\n void wrapClass(pybind11::class_<Zivid::Calibration::MultiCameraResidual> pyClass)\n {\n pyClass.def(\"translation\", &Zivid::Calibration::MultiCameraResidual::translation);\n }\n void wrapClass(pybind11::class_<Zivid::Calibration::MultiCameraOutput> pyClass)\n {\n pyClass.def(\"valid\", &Zivid::Calibration::MultiCameraOutput::valid)\n .def(\"transforms\",\n [](const Zivid::Calibration::MultiCameraOutput &calibrationOutputs) {\n auto converted_transforms = std::vector<Eigen::Matrix<float, 4, 4, Eigen::RowMajor>>();\n for(const auto &calibrationOutput : calibrationOutputs.transforms())\n {\n converted_transforms.emplace_back(Conversion::toPy(calibrationOutput));\n }\n return converted_transforms;\n })\n .def(\"residuals\", &Zivid::Calibration::MultiCameraOutput::residuals);\n }\n} // namespace ZividPython\n" }, { "alpha_fraction": 0.6717121601104736, "alphanum_fraction": 0.6831324100494385, "avg_line_length": 33.3707160949707, "blob_id": "a19b459435a7c391f340f5ef055bdf89afe09d4f", "content_id": "bccf1e7f6ebf74b052dd6f6344abd815ac3da918", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 11033, "license_type": "permissive", "max_line_length": 84, "num_lines": 321, "path": "/test/test_point_cloud.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "import pytest\n\n\ndef test_point_cloud_copy_data(point_cloud):\n import numpy as np\n\n # Copy all possible formats\n xyz = point_cloud.copy_data(\"xyz\")\n xyzw = point_cloud.copy_data(\"xyzw\")\n xyzrgba = point_cloud.copy_data(\"xyzrgba\")\n xyzbgra = point_cloud.copy_data(\"xyzbgra\")\n rgba = point_cloud.copy_data(\"rgba\")\n bgra = point_cloud.copy_data(\"bgra\")\n normals = point_cloud.copy_data(\"normals\")\n depth = point_cloud.copy_data(\"z\")\n snr = point_cloud.copy_data(\"snr\")\n assert isinstance(xyz, np.ndarray)\n assert isinstance(xyzw, np.ndarray)\n assert isinstance(xyzrgba, np.ndarray)\n assert isinstance(xyzbgra, np.ndarray)\n assert isinstance(rgba, np.ndarray)\n assert isinstance(bgra, np.ndarray)\n assert isinstance(normals, np.ndarray)\n assert isinstance(depth, np.ndarray)\n assert isinstance(snr, np.ndarray)\n\n # Check errors when argument is wrong or missing\n with pytest.raises(ValueError):\n point_cloud.copy_data(\"bogus-format\")\n with pytest.raises(TypeError):\n point_cloud.copy_data()\n\n\ndef test_point_cloud_xyzw(point_cloud):\n import numpy as np\n\n xyz = point_cloud.copy_data(\"xyz\")\n xyzw = point_cloud.copy_data(\"xyzw\")\n xyzrgba = point_cloud.copy_data(\"xyzrgba\")\n xyzbgra = point_cloud.copy_data(\"xyzbgra\")\n depth = point_cloud.copy_data(\"z\")\n\n assert depth.shape == (point_cloud.height, point_cloud.width)\n assert xyz.shape == (point_cloud.height, point_cloud.width, 3)\n assert xyzw.shape == (point_cloud.height, point_cloud.width, 4)\n assert depth.dtype == np.float32\n assert xyz.dtype == np.float32\n assert xyzw.dtype == np.float32\n assert xyzrgba[\"x\"].dtype == np.float32\n assert xyzrgba[\"y\"].dtype == np.float32\n assert xyzrgba[\"z\"].dtype == np.float32\n assert xyzbgra[\"x\"].dtype == np.float32\n assert xyzbgra[\"y\"].dtype == np.float32\n assert xyzbgra[\"z\"].dtype == np.float32\n np.testing.assert_array_equal(xyz[:, :, 2], depth)\n np.testing.assert_array_equal(xyz[:, :, 0], xyzw[:, :, 0])\n np.testing.assert_array_equal(xyz[:, :, 1], xyzw[:, :, 1])\n np.testing.assert_array_equal(xyz[:, :, 2], xyzw[:, :, 2])\n\n\ndef test_point_cloud_rgba(point_cloud):\n import numpy as np\n\n xyzrgba = point_cloud.copy_data(\"xyzrgba\")\n xyzbgra = point_cloud.copy_data(\"xyzbgra\")\n rgba = point_cloud.copy_data(\"rgba\")\n bgra = point_cloud.copy_data(\"bgra\")\n\n assert rgba.shape == (point_cloud.height, point_cloud.width, 4)\n assert bgra.shape == (point_cloud.height, point_cloud.width, 4)\n assert xyzrgba.shape == (point_cloud.height, point_cloud.width)\n assert xyzbgra.shape == (point_cloud.height, point_cloud.width)\n assert rgba.dtype == np.uint8\n assert bgra.dtype == np.uint8\n assert xyzrgba[\"r\"].dtype == np.uint8\n assert xyzrgba[\"g\"].dtype == np.uint8\n assert xyzrgba[\"b\"].dtype == np.uint8\n assert xyzrgba[\"a\"].dtype == np.uint8\n np.testing.assert_array_equal(rgba[:, :, 0], xyzrgba[\"r\"])\n np.testing.assert_array_equal(rgba[:, :, 1], xyzrgba[\"g\"])\n np.testing.assert_array_equal(rgba[:, :, 2], xyzrgba[\"b\"])\n np.testing.assert_array_equal(rgba[:, :, 3], xyzrgba[\"a\"])\n assert xyzbgra[\"b\"].dtype == np.uint8\n assert xyzbgra[\"g\"].dtype == np.uint8\n assert xyzbgra[\"r\"].dtype == np.uint8\n assert xyzbgra[\"a\"].dtype == np.uint8\n np.testing.assert_array_equal(bgra[:, :, 0], xyzbgra[\"b\"])\n np.testing.assert_array_equal(bgra[:, :, 1], xyzbgra[\"g\"])\n np.testing.assert_array_equal(bgra[:, :, 2], xyzbgra[\"r\"])\n np.testing.assert_array_equal(bgra[:, :, 3], xyzbgra[\"a\"])\n np.testing.assert_array_equal(xyzbgra[\"r\"], xyzrgba[\"r\"])\n np.testing.assert_array_equal(xyzbgra[\"g\"], xyzrgba[\"g\"])\n np.testing.assert_array_equal(xyzbgra[\"b\"], xyzrgba[\"b\"])\n np.testing.assert_array_equal(xyzbgra[\"a\"], xyzrgba[\"a\"])\n np.testing.assert_array_equal(bgra[:, :, 0], rgba[:, :, 2])\n np.testing.assert_array_equal(bgra[:, :, 1], rgba[:, :, 1])\n np.testing.assert_array_equal(bgra[:, :, 2], rgba[:, :, 0])\n np.testing.assert_array_equal(bgra[:, :, 3], rgba[:, :, 3])\n\n\ndef test_point_cloud_normals(point_cloud):\n import numpy as np\n\n normals = point_cloud.copy_data(\"normals\")\n\n assert normals.shape == (point_cloud.height, point_cloud.width, 3)\n assert normals.dtype == np.float32\n\n normals_flat = normals.reshape(normals.shape[0] * normals.shape[1], 3)\n non_nan_normals = normals_flat[~np.isnan(normals_flat[:, 0])]\n vector_lengths = np.linalg.norm(non_nan_normals, axis=1)\n np.testing.assert_array_almost_equal(vector_lengths, 1.0)\n\n\ndef test_point_cloud_snr(point_cloud):\n import numpy as np\n\n snr = point_cloud.copy_data(\"snr\")\n\n assert snr.dtype == np.float32\n assert snr.shape == (point_cloud.height, point_cloud.width)\n assert np.all(snr >= 0.0)\n assert np.all(snr < 1000)\n\n\ndef test_height(point_cloud):\n height = point_cloud.height\n\n assert height is not None\n assert isinstance(height, int)\n\n\ndef test_width(point_cloud):\n width = point_cloud.width\n\n assert width is not None\n assert isinstance(width, int)\n\n\ndef _validate_transformation(xyzw_before, xyzw_after, transform):\n import numpy as np\n\n # Pick an arbitary point to test\n i = xyzw_before.shape[0] // 3\n j = xyzw_before.shape[1] // 3\n point_before = xyzw_before[i, j, :]\n point_after = xyzw_after[i, j, :]\n assert np.all(~np.isnan(point_after))\n assert np.all(~np.isnan(point_before))\n point_after_expected = np.dot(transform, point_before)\n np.testing.assert_allclose(point_after, point_after_expected, rtol=1e-6)\n\n\ndef test_transform(point_cloud, transform):\n import zivid\n\n # Get points before and after transform\n xyzw_before = point_cloud.copy_data(\"xyzw\")\n point_cloud_returned = point_cloud.transform(transform)\n xyzw_after = point_cloud.copy_data(\"xyzw\")\n\n # Check that return value is just a reference to the original object\n assert isinstance(point_cloud_returned, zivid.PointCloud)\n assert point_cloud_returned is point_cloud\n\n # Check that the transformation was actually applied\n _validate_transformation(xyzw_before, xyzw_after, transform)\n\n\ndef test_transform_chaining(point_cloud, transform):\n import zivid\n import numpy as np\n\n # Get points before and after transform\n xyzw_before = point_cloud.copy_data(\"xyzw\")\n point_cloud_returned = point_cloud.transform(transform).transform(transform)\n xyzw_after = point_cloud.copy_data(\"xyzw\")\n\n # Check that return value is just a reference to the original object\n assert isinstance(point_cloud_returned, zivid.PointCloud)\n assert point_cloud_returned is point_cloud\n\n # Check that the transformation was actually applied\n _validate_transformation(xyzw_before, xyzw_after, np.dot(transform, transform))\n\n\ndef test_downsampling_enum():\n import zivid\n\n vals = zivid.PointCloud.Downsampling.valid_values()\n assert len(vals) == 3\n assert \"by2x2\" in vals\n assert \"by3x3\" in vals\n assert \"by4x4\" in vals\n assert zivid.PointCloud.Downsampling.by2x2 == \"by2x2\"\n assert zivid.PointCloud.Downsampling.by3x3 == \"by3x3\"\n assert zivid.PointCloud.Downsampling.by4x4 == \"by4x4\"\n\n\ndef _make_downsampling_enum(fraction):\n return \"by{f}x{f}\".format(f=fraction)\n\n\n@pytest.mark.parametrize(\"fraction\", [2, 3, 4])\ndef test_downsample(point_cloud, fraction):\n import zivid\n\n # Remember original size\n height_orig = point_cloud.height\n width_orig = point_cloud.width\n\n # Perform downsampling\n point_cloud_returned = point_cloud.downsample(_make_downsampling_enum(fraction))\n\n # Check that return value is just a reference to the original object\n assert isinstance(point_cloud_returned, zivid.PointCloud)\n assert point_cloud_returned is point_cloud\n\n # Check that the new size is as expected\n assert height_orig // fraction == point_cloud.height\n assert width_orig // fraction == point_cloud.width\n\n\n@pytest.mark.parametrize(\"fraction\", [2, 3, 4])\ndef test_downsampled(point_cloud, fraction):\n import zivid\n\n # Remember original size\n height_orig = point_cloud.height\n width_orig = point_cloud.width\n\n # Perform downsampling\n point_cloud_new = point_cloud.downsampled(_make_downsampling_enum(fraction))\n\n # Check that a new object was returned and that the original is untouched\n assert isinstance(point_cloud_new, zivid.PointCloud)\n assert point_cloud_new is not point_cloud\n assert point_cloud.height == height_orig\n assert point_cloud.width == width_orig\n\n # Check that the new size is as expected\n assert height_orig // fraction == point_cloud_new.height\n assert width_orig // fraction == point_cloud_new.width\n\n\ndef test_downsample_chaining(point_cloud):\n import zivid\n\n # Remember original size\n height_orig = point_cloud.height\n width_orig = point_cloud.width\n\n # Perform downsampling\n point_cloud_returned = point_cloud.downsample(\"by2x2\").downsample(\"by3x3\")\n\n # Check that return value is just a reference to the original object\n assert isinstance(point_cloud_returned, zivid.PointCloud)\n assert point_cloud_returned is point_cloud\n\n # Check that the new size is as expected\n assert height_orig // 2 // 3 == point_cloud.height\n assert width_orig // 2 // 3 == point_cloud.width\n\n\ndef test_downsampled_chaining(point_cloud):\n import zivid\n\n # Remember original size\n height_orig = point_cloud.height\n width_orig = point_cloud.width\n\n # Perform downsampling\n point_cloud_new = point_cloud.downsampled(\"by2x2\").downsampled(\"by3x3\")\n\n # Check that a new object was returned and that the original is untouched\n assert isinstance(point_cloud_new, zivid.PointCloud)\n assert point_cloud_new is not point_cloud\n assert point_cloud.height == height_orig\n assert point_cloud.width == width_orig\n\n # Check result\n assert height_orig // 2 // 3 == point_cloud_new.height\n assert width_orig // 2 // 3 == point_cloud_new.width\n\n\ndef test_height_context_manager(frame):\n with frame.point_cloud() as point_cloud:\n point_cloud.height\n with pytest.raises(RuntimeError):\n point_cloud.height\n\n\ndef test_width_context_manager(frame):\n with frame.point_cloud() as point_cloud:\n point_cloud.width\n with pytest.raises(RuntimeError):\n point_cloud.width\n\n\ndef test_copy_data_context_manager(frame):\n with frame.point_cloud() as point_cloud:\n point_cloud.copy_data(data_format=\"xyzrgba\")\n with pytest.raises(RuntimeError):\n point_cloud.copy_data(data_format=\"xyzrgba\")\n with pytest.raises(RuntimeError):\n point_cloud.copy_data(data_format=123)\n with pytest.raises(TypeError):\n point_cloud.copy_data()\n\n\ndef test_illegal_init(application):\n import zivid\n\n with pytest.raises(TypeError):\n zivid.PointCloud() # pylint: disable=no-value-for-parameter\n\n with pytest.raises(TypeError):\n zivid.PointCloud(\"Should fail.\")\n\n with pytest.raises(TypeError):\n zivid.PointCloud(123)\n" }, { "alpha_fraction": 0.6785714030265808, "alphanum_fraction": 0.6785714030265808, "avg_line_length": 35.842105865478516, "blob_id": "cd446d50b6e9c694735504838c0f6c40d2281a44", "content_id": "547db6b74ae38bf371e23f089d5657ffc95094b3", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1400, "license_type": "permissive", "max_line_length": 97, "num_lines": 38, "path": "/modules/zivid/firmware.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "\"\"\"Contains functions for checking and updating camera firmware.\"\"\"\nimport _zivid\n\n\ndef update(camera, progress_callback=None):\n \"\"\"Update camera firmware.\n\n If the current API requires a different firmware than what is present on the camera,\n the firmware will be updated to this version.\n The function throws if the camera is connected, or if the camera is already up to date.\n Call is_up_to_date() first to check if the camera is up to date.\n\n Args:\n camera: The camera to be updated.\n progress_callback: A callback function to track progress of update.\n The callable is taking a float and a string as progress and description respectively.\n \"\"\"\n if progress_callback is None:\n _zivid.firmware.update(camera._Camera__impl) # pylint: disable=protected-access\n else:\n _zivid.firmware.update(\n camera._Camera__impl, # pylint: disable=protected-access\n progress_callback=progress_callback,\n )\n\n\ndef is_up_to_date(camera):\n \"\"\"Check if the firmware on the camera is of the version that is required by the API.\n\n Args:\n camera: The camera to check the firmware of (must be in disconnected state)\n\n Returns:\n A bool that is True if the firmware is up to date\n \"\"\"\n return _zivid.firmware.is_up_to_date(\n camera._Camera__impl # pylint: disable=protected-access\n )\n" }, { "alpha_fraction": 0.7359307408332825, "alphanum_fraction": 0.7489177584648132, "avg_line_length": 32, "blob_id": "e0a5587b32dbe2ce130a63a8e44c3e8b27f85dcc", "content_id": "958f5c4c907672c4a10cd4d2ad220fc16ac3c575", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 693, "license_type": "permissive", "max_line_length": 114, "num_lines": 21, "path": "/src/include/ZividPython/ReleasableProjectedImage.h", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "#pragma once\n\n#include <Zivid/Experimental/ProjectedImage.h>\n#include <ZividPython/Releasable.h>\n#include <ZividPython/ReleasableFrame2D.h>\n#include <ZividPython/Wrappers.h>\n\nnamespace ZividPython\n{\n class ReleasableProjectedImage : public Releasable<Zivid::Experimental::ProjectedImage>\n {\n public:\n using Releasable<Zivid::Experimental::ProjectedImage>::Releasable;\n\n ZIVID_PYTHON_FORWARD_0_ARGS(stop)\n ZIVID_PYTHON_FORWARD_0_ARGS(active)\n ZIVID_PYTHON_FORWARD_1_ARGS_WRAP_RETURN(ReleasableFrame2D, capture, const Zivid::Settings2D &, settings2D)\n };\n\n void wrapClass(pybind11::class_<ReleasableProjectedImage> pyClass);\n} // namespace ZividPython\n" }, { "alpha_fraction": 0.7450980544090271, "alphanum_fraction": 0.7450980544090271, "avg_line_length": 39.79999923706055, "blob_id": "00531ac836ba03a2d6a4aa1caec5118396f7f3ab", "content_id": "22f433703d91948df4b65049b99c9333b01b16f3", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1020, "license_type": "permissive", "max_line_length": 78, "num_lines": 25, "path": "/test/converters/test_convert_camera_state.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "def test_to_internal_camera_state_to_camera_state_modified():\n from zivid import CameraState\n from zivid.camera_state import _to_camera_state, _to_internal_camera_state\n\n modified_camera_state = CameraState(connected=True)\n\n converted_camera_state = _to_camera_state(\n _to_internal_camera_state(modified_camera_state)\n )\n assert modified_camera_state == converted_camera_state\n assert isinstance(converted_camera_state, CameraState)\n assert isinstance(modified_camera_state, CameraState)\n\n\ndef test_to_internal_camera_state_to_camera_state_default():\n from zivid import CameraState\n from zivid.camera_state import _to_camera_state, _to_internal_camera_state\n\n default_camera_state = CameraState()\n converted_camera_state = _to_camera_state(\n _to_internal_camera_state(default_camera_state)\n )\n assert default_camera_state == converted_camera_state\n assert isinstance(converted_camera_state, CameraState)\n assert isinstance(default_camera_state, CameraState)\n" }, { "alpha_fraction": 0.689095139503479, "alphanum_fraction": 0.7076566219329834, "avg_line_length": 27.733333587646484, "blob_id": "718c42e50e83f07cdee0b691d074517fdd88c43a", "content_id": "387b224e4008dc0eccfbfac70a85963d07dd8fd4", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 431, "license_type": "permissive", "max_line_length": 70, "num_lines": 15, "path": "/src/ReleasableProjectedImage.cpp", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "#include <ZividPython/ReleasableProjectedImage.h>\n\n#include <pybind11/pybind11.h>\n\nnamespace py = pybind11;\n\nnamespace ZividPython\n{\n void wrapClass(pybind11::class_<ReleasableProjectedImage> pyClass)\n {\n pyClass.def(\"stop\", &ReleasableProjectedImage::stop)\n .def(\"active\", &ReleasableProjectedImage::active)\n .def(\"capture\", &ReleasableProjectedImage::capture);\n }\n} // namespace ZividPython\n" }, { "alpha_fraction": 0.539393961429596, "alphanum_fraction": 0.543030321598053, "avg_line_length": 23.264705657958984, "blob_id": "8b82b9f60db1504de7b25bc38059b8733ba55454", "content_id": "962535518a86907df43694be8d315c68f47c7476", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 825, "license_type": "permissive", "max_line_length": 86, "num_lines": 34, "path": "/continuous-integration/windows/install_binary_distribution.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "from common import repo_root, run_process\n\n\ndef _find_wheel(root):\n extension = \".whl\"\n dist_dir = root / \"dist\"\n wheels = list(dist_dir.glob(\"*\" + extension))\n\n if len(wheels) == 0:\n raise RuntimeError(\n \"Failed to find any {ext} file in {dir}.\".format(\n ext=extension, dir=dist_dir\n )\n )\n if len(wheels) > 1:\n raise RuntimeError(\n \"Found multiple {ext} files in {dir}.\".format(ext=extension, dir=dist_dir)\n )\n\n return wheels[0]\n\n\ndef _main():\n root = repo_root()\n wheel_file = _find_wheel(root)\n print(\n \"Found wheel: {path}. Will attempt to install.\".format(path=wheel_file),\n flush=True,\n )\n run_process((\"python\", \"-m\", \"pip\", \"install\", str(wheel_file)))\n\n\nif __name__ == \"__main__\":\n _main()\n" }, { "alpha_fraction": 0.6666666865348816, "alphanum_fraction": 0.6666666865348816, "avg_line_length": 20.16666603088379, "blob_id": "2aaa78446d235db858e6757945e40b234d259e1a", "content_id": "1f605a73d0cd01b2c8ef7abb0055ea0b6eb90039", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 381, "license_type": "permissive", "max_line_length": 64, "num_lines": 18, "path": "/modules/zivid/_version.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "\"\"\"Query module version.\"\"\"\nfrom pkg_resources import get_distribution, DistributionNotFound\n\n\ndef get_version(module_name):\n \"\"\"Return the version module version.\n\n Args:\n module_name: Name of a module\n\n Returns:\n The module version\n\n \"\"\"\n try:\n return get_distribution(module_name).version\n except DistributionNotFound:\n return None\n" }, { "alpha_fraction": 0.6992632150650024, "alphanum_fraction": 0.7019423842430115, "avg_line_length": 38.28947448730469, "blob_id": "bb6e5d19d12aae185954ef3fce6146b8deb605a8", "content_id": "a38c8be9a141a41e150c301b4fb7e4158bd203f6", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Shell", "length_bytes": 1494, "license_type": "permissive", "max_line_length": 170, "num_lines": 38, "path": "/continuous-integration/linux/platform-dependent/common.sh", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "#!/bin/bash\n\nSCRIPT_DIR=\"$(realpath $(cd \"$(dirname \"${BASH_SOURCE[0]}\")\" && pwd) )\"\n\nfunction ubuntu_install_opencl_cpu_runtime {\n\n # Download the key to system keyring\n INTEL_KEY_URL=https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB\n wget -O- $INTEL_KEY_URL | gpg --dearmor | tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null || exit $?\n\n # Add signed entry to apt sources and configure the APT client to use Intel repository\n echo \"deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main\" | tee /etc/apt/sources.list.d/oneAPI.list || exit $?\n apt update || exit $?\n\n # Install the OpenCL runtime\n apt --assume-yes install intel-oneapi-runtime-opencl intel-oneapi-runtime-compilers || exit $?\n\n}\n\nfunction fedora_install_opencl_cpu_runtime {\n tee > /etc/yum.repos.d/oneAPI.repo << EOF\n[oneAPI]\nname=Intel® oneAPI repository\nbaseurl=https://yum.repos.intel.com/oneapi\nenabled=1\ngpgcheck=1\nrepo_gpgcheck=1\ngpgkey=https://yum.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB\nEOF\n dnf --assumeyes install intel-oneapi-runtime-opencl intel-oneapi-runtime-compilers || exit $?\n}\n\n# Read versions.json and set as environment variables\nVERSIONS_FILE=\"${SCRIPT_DIR}/../../versions.json\"\nfor var in $(jq -r \"to_entries|map(\\\"\\(.key)=\\(.value|tostring)\\\")|.[]\" ${VERSIONS_FILE} ); do\n echo \"Setting env var from ${VERSIONS_FILE}: ${var}\"\n export ${var?}\ndone\n" }, { "alpha_fraction": 0.6841412782669067, "alphanum_fraction": 0.6899047493934631, "avg_line_length": 28.73239517211914, "blob_id": "548ea72bee2a4219aa8795712cafb4d7b1a931ce", "content_id": "93737c62f777c842a4da90ebc0066a67678ea138", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 37998, "license_type": "permissive", "max_line_length": 105, "num_lines": 1278, "path": "/test/test_settings.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "import pytest\n\n\ndef test_default_settings(application):\n import zivid\n\n settings = zivid.Settings()\n\n assert isinstance(settings.acquisitions, list)\n assert len(settings.acquisitions) == 0\n assert settings.experimental.engine is None\n assert isinstance(settings.diagnostics, zivid.Settings.Diagnostics)\n assert settings.diagnostics.enabled is None\n assert isinstance(settings.processing, zivid.Settings.Processing)\n assert isinstance(settings.processing.color, zivid.Settings.Processing.Color)\n assert isinstance(\n settings.processing.color.balance, zivid.Settings.Processing.Color.Balance\n )\n assert settings.processing.color.gamma is None\n assert settings.processing.color.balance.red is None\n assert settings.processing.color.balance.green is None\n assert settings.processing.color.balance.blue is None\n assert settings.processing.color.experimental.mode is None\n\n assert isinstance(settings.processing.filters, zivid.Settings.Processing.Filters)\n assert isinstance(\n settings.processing.filters.experimental,\n zivid.Settings.Processing.Filters.Experimental,\n )\n\n assert isinstance(\n settings.processing.filters.cluster, zivid.Settings.Processing.Filters.Cluster\n )\n assert isinstance(\n settings.processing.filters.cluster.removal,\n zivid.Settings.Processing.Filters.Cluster.Removal,\n )\n\n assert settings.processing.filters.cluster.removal.enabled is None\n assert settings.processing.filters.cluster.removal.min_area is None\n assert settings.processing.filters.cluster.removal.max_neighbor_distance is None\n\n assert isinstance(\n settings.processing.filters.experimental.contrast_distortion,\n zivid.Settings.Processing.Filters.Experimental.ContrastDistortion,\n )\n assert isinstance(\n settings.processing.filters.experimental.contrast_distortion.correction,\n zivid.Settings.Processing.Filters.Experimental.ContrastDistortion.Correction,\n )\n assert (\n settings.processing.filters.experimental.contrast_distortion.correction.enabled\n is None\n )\n\n assert isinstance(\n settings.processing.filters.experimental.contrast_distortion.removal,\n zivid.Settings.Processing.Filters.Experimental.ContrastDistortion.Removal,\n )\n assert (\n settings.processing.filters.experimental.contrast_distortion.removal.enabled\n is None\n )\n\n assert isinstance(\n settings.processing.filters.experimental.hole_filling,\n zivid.Settings.Processing.Filters.Experimental.HoleFilling,\n )\n\n assert settings.processing.filters.experimental.hole_filling.enabled is None\n assert settings.processing.filters.experimental.hole_filling.hole_size is None\n assert settings.processing.filters.experimental.hole_filling.strictness is None\n\n assert isinstance(\n settings.processing.filters.noise, zivid.Settings.Processing.Filters.Noise\n )\n assert isinstance(\n settings.processing.filters.noise.removal,\n zivid.Settings.Processing.Filters.Noise.Removal,\n )\n assert settings.processing.filters.noise.removal.enabled is None\n\n assert isinstance(\n settings.processing.filters.outlier, zivid.Settings.Processing.Filters.Outlier\n )\n assert isinstance(\n settings.processing.filters.outlier.removal,\n zivid.Settings.Processing.Filters.Outlier.Removal,\n )\n assert settings.processing.filters.outlier.removal.enabled is None\n\n assert isinstance(\n settings.processing.filters.reflection,\n zivid.Settings.Processing.Filters.Reflection,\n )\n assert isinstance(\n settings.processing.filters.reflection.removal,\n zivid.Settings.Processing.Filters.Reflection.Removal,\n )\n assert settings.processing.filters.reflection.removal.enabled is None\n\n assert isinstance(\n settings.processing.filters.reflection.removal.experimental,\n zivid.Settings.Processing.Filters.Reflection.Removal.Experimental,\n )\n\n assert settings.processing.filters.reflection.removal.experimental.mode is None\n\n assert isinstance(\n settings.processing.filters.smoothing,\n zivid.Settings.Processing.Filters.Smoothing,\n )\n assert isinstance(\n settings.processing.filters.smoothing.gaussian,\n zivid.Settings.Processing.Filters.Smoothing.Gaussian,\n )\n assert settings.processing.filters.smoothing.gaussian.enabled is None\n assert settings.processing.filters.smoothing.gaussian.sigma is None\n\n assert isinstance(settings.region_of_interest, zivid.Settings.RegionOfInterest)\n assert isinstance(\n settings.region_of_interest.box, zivid.Settings.RegionOfInterest.Box\n )\n assert isinstance(\n settings.region_of_interest.depth, zivid.Settings.RegionOfInterest.Depth\n )\n\n assert settings.region_of_interest.box.enabled is None\n assert settings.region_of_interest.box.extents is None\n assert settings.region_of_interest.box.point_o is None\n assert settings.region_of_interest.box.point_a is None\n assert settings.region_of_interest.box.point_b is None\n assert settings.region_of_interest.depth.enabled is None\n assert settings.region_of_interest.depth.range is None\n\n\ndef test_set_acquisition_list():\n from zivid import Settings\n\n settings = Settings()\n\n settings.acquisitions = [\n Settings.Acquisition(gain=1.0),\n Settings.Acquisition(gain=2.0),\n Settings.Acquisition(gain=3.0),\n ]\n assert len(settings.acquisitions) == 3\n assert settings.acquisitions is not None\n assert isinstance(settings.acquisitions, list)\n for element in settings.acquisitions:\n assert isinstance(element, Settings.Acquisition)\n\n assert settings.acquisitions[0].gain == 1.0\n assert settings.acquisitions[1].gain == 2.0\n assert settings.acquisitions[2].gain == 3.0\n\n settings.acquisitions[0].gain = 4.0\n assert settings.acquisitions[0].gain == 4.0\n\n\ndef test_set_acquisition_generator():\n from zivid import Settings\n\n settings = Settings()\n\n def _generator():\n for _ in range(3):\n yield Settings.Acquisition()\n\n settings.acquisitions = _generator()\n assert settings.acquisitions is not None\n assert isinstance(settings.acquisitions, list)\n for element in settings.acquisitions:\n assert isinstance(element, Settings.Acquisition)\n\n\ndef test_set_acquisition_tuple():\n from zivid import Settings\n\n settings = Settings()\n\n settings.acquisitions = (Settings.Acquisition(), settings.Acquisition())\n assert settings.acquisitions is not None\n assert isinstance(settings.acquisitions, list)\n for element in settings.acquisitions:\n assert isinstance(element, Settings.Acquisition)\n\n\ndef test_default_acquisition(application):\n import zivid\n import datetime\n\n settings = zivid.Settings(acquisitions=[zivid.Settings.Acquisition()])\n assert isinstance(settings.acquisitions, list)\n acquisition = settings.acquisitions[0]\n\n assert isinstance(acquisition, zivid.Settings.Acquisition)\n assert acquisition.aperture is None\n assert acquisition.brightness is None\n assert acquisition.gain is None\n assert acquisition.exposure_time is None\n pytest.helpers.equality_tester(\n zivid.Settings.Acquisition,\n [5, 0.5, datetime.timedelta(microseconds=11000), 15],\n [5, 0.5, datetime.timedelta(microseconds=11001), 15],\n )\n\n\ndef test_acquisition_brightness(application):\n import numbers\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings.Acquisition(),\n member=\"brightness\",\n value=0.5,\n expected_data_type=numbers.Real,\n )\n\n\ndef test_acquisition_exposure_time(application):\n import datetime\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings.Acquisition(),\n member=\"exposure_time\",\n value=datetime.timedelta(microseconds=100000),\n expected_data_type=datetime.timedelta,\n )\n\n\ndef test_acquisition_gain(application):\n import numbers\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings.Acquisition(),\n member=\"gain\",\n value=14,\n expected_data_type=numbers.Real,\n )\n\n\ndef test_acquisition_aperture(application):\n import numbers\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings.Acquisition(),\n member=\"aperture\",\n value=20.5,\n expected_data_type=numbers.Real,\n )\n\n\ndef test_settings_diagnostics(application):\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings(),\n member=\"diagnostics\",\n value=zivid.Settings.Diagnostics(),\n expected_data_type=zivid.Settings.Diagnostics,\n )\n pytest.helpers.equality_tester(\n zivid.Settings.Diagnostics,\n [True],\n [False],\n )\n\n\ndef test_settings_diagnostics_enabled(application):\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings.Diagnostics(),\n member=\"enabled\",\n value=True,\n expected_data_type=bool,\n )\n\n\ndef test_settings_experimental(application):\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings(),\n member=\"experimental\",\n value=zivid.Settings.Experimental(),\n expected_data_type=zivid.Settings.Experimental,\n )\n pytest.helpers.equality_tester(\n zivid.Settings.Experimental,\n [\"phase\"],\n [\"stripe\"],\n )\n pytest.helpers.equality_tester(\n zivid.Settings.Experimental,\n [\"phase\"],\n [None],\n )\n\n\ndef test_settings_experimental_engine(application):\n import zivid\n\n for value in zivid.Settings.Experimental.Engine.valid_values():\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings.Experimental(),\n member=\"engine\",\n value=value,\n expected_data_type=str,\n )\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings.Experimental(),\n member=\"engine\",\n value=None,\n expected_data_type=type(None),\n )\n # Is optional enum\n zivid.Settings.Experimental(engine=\"stripe\")\n zivid.Settings.Experimental(engine=\"phase\")\n zivid.Settings.Experimental(engine=None)\n with pytest.raises(KeyError):\n zivid.Settings.Experimental(engine=\"_dummy_\")\n\n\ndef test_settings_processing(application):\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings(),\n member=\"processing\",\n value=zivid.Settings.Processing(),\n expected_data_type=zivid.Settings.Processing,\n )\n pytest.helpers.equality_tester(\n zivid.Settings.Processing,\n [\n zivid.Settings.Processing.Color(\n 0.9, zivid.Settings.Processing.Color.Balance(blue=1.1)\n )\n ],\n [\n zivid.Settings.Processing.Color(\n 1.1, zivid.Settings.Processing.Color.Balance(blue=1.2)\n )\n ],\n )\n\n\ndef test_settings_processing_color(application):\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings.Processing(),\n member=\"color\",\n value=zivid.Settings.Processing.Color(),\n expected_data_type=zivid.Settings.Processing.Color,\n )\n pytest.helpers.equality_tester(\n zivid.Settings.Processing.Color,\n [0.9, zivid.Settings.Processing.Color.Balance(blue=1.1)],\n [1.1, zivid.Settings.Processing.Color.Balance(blue=1.2)],\n )\n\n\ndef test_settings_processing_color_gamma(\n application,\n):\n import zivid\n import numbers\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings.Processing.Color(),\n member=\"gamma\",\n value=0.85,\n expected_data_type=numbers.Real,\n )\n\n\ndef test_settings_processing_color_balance(\n application,\n):\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings.Processing.Color(),\n member=\"balance\",\n value=zivid.Settings.Processing.Color.Balance(),\n expected_data_type=zivid.Settings.Processing.Color.Balance,\n )\n pytest.helpers.equality_tester(\n zivid.Settings.Processing.Color.Balance,\n [1.1, 1.1, 1.1],\n [1.2, 1.1, 1.1],\n )\n\n\ndef test_settings_processing_color_experimental(\n application,\n):\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings.Processing.Color(),\n member=\"experimental\",\n value=zivid.Settings.Processing.Color.Experimental(),\n expected_data_type=zivid.Settings.Processing.Color.Experimental,\n )\n\n pytest.helpers.equality_tester(\n zivid.Settings.Processing.Color.Experimental,\n [\"automatic\"],\n [None],\n )\n\n pytest.helpers.equality_tester(\n zivid.Settings.Processing.Color.Experimental,\n [\"automatic\"],\n [\"useFirstAcquisition\"],\n )\n\n pytest.helpers.equality_tester(\n zivid.Settings.Processing.Color.Experimental,\n [\"automatic\"],\n [\"toneMapping\"],\n )\n\n\ndef test_settings_processing_color_experimental_mode(application):\n import zivid\n\n for value in zivid.Settings.Processing.Color.Experimental.Mode.valid_values():\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings.Processing.Color.Experimental(),\n member=\"mode\",\n value=value,\n expected_data_type=str,\n )\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings.Processing.Color.Experimental(),\n member=\"mode\",\n value=None,\n expected_data_type=type(None),\n )\n # Is optional enum\n zivid.Settings.Processing.Color.Experimental(mode=\"automatic\")\n zivid.Settings.Processing.Color.Experimental(mode=\"useFirstAcquisition\")\n zivid.Settings.Processing.Color.Experimental(mode=\"toneMapping\")\n zivid.Settings.Processing.Color.Experimental(mode=None)\n with pytest.raises(KeyError):\n zivid.Settings.Processing.Color.Experimental(mode=\"_dummy_\")\n\n\ndef test_settings_processing_color_balance_red(\n application,\n):\n import zivid\n import numbers\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings.Processing.Color.Balance(),\n member=\"red\",\n value=2,\n expected_data_type=numbers.Real,\n )\n\n\ndef test_settings_processing_color_balance_green(\n application,\n):\n import zivid\n import numbers\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings.Processing.Color.Balance(),\n member=\"green\",\n value=1.5,\n expected_data_type=numbers.Real,\n )\n\n\ndef test_settings_processing_color_balance_blue(\n application,\n):\n import zivid\n import numbers\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings.Processing.Color.Balance(),\n member=\"blue\",\n value=1,\n expected_data_type=numbers.Real,\n )\n\n\ndef test_settings_processing_filters(\n application,\n):\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings.Processing(),\n member=\"filters\",\n value=zivid.Settings.Processing.Filters(),\n expected_data_type=zivid.Settings.Processing.Filters,\n )\n pytest.helpers.equality_tester(\n zivid.Settings.Processing.Filters,\n [\n zivid.Settings.Processing.Filters.Cluster(\n zivid.Settings.Processing.Filters.Cluster.Removal(enabled=True)\n )\n ],\n [\n zivid.Settings.Processing.Filters.Cluster(\n zivid.Settings.Processing.Filters.Cluster.Removal(enabled=False)\n )\n ],\n )\n\n\ndef test_settings_processing_filters_experimental(\n application,\n):\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings.Processing.Filters(),\n member=\"experimental\",\n value=zivid.Settings.Processing.Filters.Experimental(),\n expected_data_type=zivid.Settings.Processing.Filters.Experimental,\n )\n pytest.helpers.equality_tester(\n zivid.Settings.Processing.Filters.Experimental,\n [\n zivid.Settings.Processing.Filters.Experimental.ContrastDistortion(\n removal=zivid.Settings.Processing.Filters.Experimental.ContrastDistortion.Removal(\n enabled=False\n )\n )\n ],\n [\n zivid.Settings.Processing.Filters.Experimental.ContrastDistortion(\n removal=zivid.Settings.Processing.Filters.Experimental.ContrastDistortion.Removal(\n enabled=True\n )\n )\n ],\n )\n\n\ndef test_settings_processing_filters_experimental_contrast_distortion(\n application,\n):\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings.Processing.Filters.Experimental(),\n member=\"contrast_distortion\",\n value=zivid.Settings.Processing.Filters.Experimental.ContrastDistortion(),\n expected_data_type=zivid.Settings.Processing.Filters.Experimental.ContrastDistortion,\n )\n pytest.helpers.equality_tester(\n zivid.Settings.Processing.Filters.Experimental.ContrastDistortion,\n [\n zivid.Settings.Processing.Filters.Experimental.ContrastDistortion.Correction(\n enabled=True\n ),\n zivid.Settings.Processing.Filters.Experimental.ContrastDistortion.Removal(\n enabled=False\n ),\n ],\n [\n zivid.Settings.Processing.Filters.Experimental.ContrastDistortion.Correction(\n enabled=True\n ),\n zivid.Settings.Processing.Filters.Experimental.ContrastDistortion.Removal(\n enabled=True\n ),\n ],\n )\n\n\ndef test_settings_processing_filters_experimental_holefilling(\n application,\n):\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings.Processing.Filters.Experimental(),\n member=\"hole_filling\",\n value=zivid.Settings.Processing.Filters.Experimental.HoleFilling(),\n expected_data_type=zivid.Settings.Processing.Filters.Experimental.HoleFilling,\n )\n\n pytest.helpers.equality_tester(\n zivid.Settings.Processing.Filters.Experimental.HoleFilling,\n [True],\n [False],\n )\n\n\ndef test_settings_processing_filters_experimental_holefilling_enabled(\n application,\n):\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings.Processing.Filters.Experimental.HoleFilling(),\n member=\"enabled\",\n value=True,\n expected_data_type=bool,\n )\n\n\ndef test_settings_processing_filters_experimental_holefilling_holesize(\n application,\n):\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings.Processing.Filters.Experimental.HoleFilling(),\n member=\"hole_size\",\n value=0.3,\n expected_data_type=float,\n )\n\n\ndef test_settings_processing_filters_experimental_holefilling_strictness(\n application,\n):\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings.Processing.Filters.Experimental.HoleFilling(),\n member=\"strictness\",\n value=3,\n expected_data_type=int,\n )\n\n\ndef test_settings_processing_filters_experimental_contrast_distortion_removal(\n application,\n):\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings.Processing.Filters.Experimental.ContrastDistortion(),\n member=\"removal\",\n value=zivid.Settings.Processing.Filters.Experimental.ContrastDistortion.Removal(),\n expected_data_type=zivid.Settings.Processing.Filters.Experimental.ContrastDistortion.Removal,\n )\n pytest.helpers.equality_tester(\n zivid.Settings.Processing.Filters.Experimental.ContrastDistortion.Removal,\n [True],\n [False],\n )\n\n\ndef test_settings_processing_filters_experimental_contrast_distortion_removal_enabled(\n application,\n):\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings.Processing.Filters.Experimental.ContrastDistortion.Removal(),\n member=\"enabled\",\n value=True,\n expected_data_type=bool,\n )\n\n\ndef test_settings_processing_filters_experimental_contrast_distortion_removal_threshold(\n application,\n):\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings.Processing.Filters.Experimental.ContrastDistortion.Removal(),\n member=\"threshold\",\n value=0.4,\n expected_data_type=float,\n )\n\n\ndef test_settings_processing_filters_experimental_contrast_distortion_correction(\n application,\n):\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings.Processing.Filters.Experimental.ContrastDistortion(),\n member=\"correction\",\n value=zivid.Settings.Processing.Filters.Experimental.ContrastDistortion.Correction(),\n expected_data_type=zivid.Settings.Processing.Filters.Experimental.ContrastDistortion.Correction,\n )\n pytest.helpers.equality_tester(\n zivid.Settings.Processing.Filters.Experimental.ContrastDistortion.Correction,\n [True],\n [False],\n )\n\n\ndef test_settings_processing_filters_experimental_contrast_distortion_correction_strength(\n application,\n):\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings.Processing.Filters.Experimental.ContrastDistortion.Correction(),\n member=\"strength\",\n value=0.59,\n expected_data_type=float,\n )\n\n\ndef test_settings_processing_filters_experimental_contrast_distortion_correction_enabled(\n application,\n):\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings.Processing.Filters.Experimental.ContrastDistortion.Correction(),\n member=\"enabled\",\n value=False,\n expected_data_type=bool,\n )\n\n\ndef test_settings_processing_filters_cluster(\n application,\n):\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings.Processing.Filters(),\n member=\"cluster\",\n value=zivid.Settings.Processing.Filters.Cluster(),\n expected_data_type=zivid.Settings.Processing.Filters.Cluster,\n )\n\n pytest.helpers.equality_tester(\n zivid.Settings.Processing.Filters.Cluster,\n [zivid.Settings.Processing.Filters.Cluster.Removal(enabled=True)],\n [zivid.Settings.Processing.Filters.Cluster.Removal(enabled=False)],\n )\n\n\ndef test_settings_processing_filters_cluster_removal(\n application,\n):\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings.Processing.Filters.Cluster(),\n member=\"removal\",\n value=zivid.Settings.Processing.Filters.Cluster.Removal(),\n expected_data_type=zivid.Settings.Processing.Filters.Cluster.Removal,\n )\n pytest.helpers.equality_tester(\n zivid.Settings.Processing.Filters.Cluster.Removal,\n [True],\n [False],\n )\n\n\ndef test_settings_processing_filters_cluster_removal_enabled(\n application,\n):\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings.Processing.Filters.Cluster.Removal(),\n member=\"enabled\",\n value=False,\n expected_data_type=bool,\n )\n\n\ndef test_settings_processing_filters_cluster_removal_minarea(\n application,\n):\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings.Processing.Filters.Cluster.Removal(),\n member=\"min_area\",\n value=150.0,\n expected_data_type=float,\n )\n\n\ndef test_settings_processing_filters_cluster_removal_maxneighbordistance(\n application,\n):\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings.Processing.Filters.Cluster.Removal(),\n member=\"max_neighbor_distance\",\n value=5.0,\n expected_data_type=float,\n )\n\n\ndef test_settings_processing_filters_noise(\n application,\n):\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings.Processing.Filters(),\n member=\"noise\",\n value=zivid.Settings.Processing.Filters.Noise(),\n expected_data_type=zivid.Settings.Processing.Filters.Noise,\n )\n pytest.helpers.equality_tester(\n zivid.Settings.Processing.Filters.Noise,\n [zivid.Settings.Processing.Filters.Noise.Removal(enabled=True)],\n [zivid.Settings.Processing.Filters.Noise.Removal(enabled=False)],\n )\n\n\ndef test_settings_processing_filters_noise_removal(\n application,\n):\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings.Processing.Filters.Noise(),\n member=\"removal\",\n value=zivid.Settings.Processing.Filters.Noise.Removal(),\n expected_data_type=zivid.Settings.Processing.Filters.Noise.Removal,\n )\n pytest.helpers.equality_tester(\n zivid.Settings.Processing.Filters.Noise.Removal,\n [True],\n [False],\n )\n\n\ndef test_settings_processing_filters_noise_removal_enabled(\n application,\n):\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings.Processing.Filters.Noise.Removal(),\n member=\"enabled\",\n value=False,\n expected_data_type=bool,\n )\n\n\ndef test_settings_processing_filters_noise_removal_threshold(\n application,\n):\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings.Processing.Filters.Noise.Removal(),\n member=\"threshold\",\n value=50.0,\n expected_data_type=float,\n )\n\n\ndef test_settings_processing_filters_outlier(\n application,\n):\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings.Processing.Filters(),\n member=\"outlier\",\n value=zivid.Settings.Processing.Filters.Outlier(),\n expected_data_type=zivid.Settings.Processing.Filters.Outlier,\n )\n pytest.helpers.equality_tester(\n zivid.Settings.Processing.Filters.Outlier,\n [zivid.Settings.Processing.Filters.Outlier.Removal(enabled=True)],\n [zivid.Settings.Processing.Filters.Outlier.Removal(enabled=False)],\n )\n\n\ndef test_settings_processing_filters_outlier_removal(\n application,\n):\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings.Processing.Filters.Outlier(),\n member=\"removal\",\n value=zivid.Settings.Processing.Filters.Outlier.Removal(),\n expected_data_type=zivid.Settings.Processing.Filters.Outlier.Removal,\n )\n pytest.helpers.equality_tester(\n zivid.Settings.Processing.Filters.Outlier.Removal,\n [True],\n [False],\n )\n\n\ndef test_settings_processing_filters_outlier_removal_enabled(\n application,\n):\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings.Processing.Filters.Outlier.Removal(),\n member=\"enabled\",\n value=False,\n expected_data_type=bool,\n )\n\n\ndef test_settings_processing_filters_outlier_removal_threshold(\n application,\n):\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings.Processing.Filters.Outlier.Removal(),\n member=\"threshold\",\n value=89,\n expected_data_type=float,\n )\n\n\ndef test_settings_processing_filters_reflection(\n application,\n):\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings.Processing.Filters(),\n member=\"reflection\",\n value=zivid.Settings.Processing.Filters.Reflection(),\n expected_data_type=zivid.Settings.Processing.Filters.Reflection,\n )\n pytest.helpers.equality_tester(\n zivid.Settings.Processing.Filters.Reflection,\n [zivid.Settings.Processing.Filters.Reflection.Removal(enabled=True)],\n [zivid.Settings.Processing.Filters.Reflection.Removal(enabled=False)],\n )\n\n\ndef test_settings_processing_filters_reflection_removal(\n application,\n):\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings.Processing.Filters.Reflection(),\n member=\"removal\",\n value=zivid.Settings.Processing.Filters.Reflection.Removal(),\n expected_data_type=zivid.Settings.Processing.Filters.Reflection.Removal,\n )\n\n pytest.helpers.equality_tester(\n zivid.Settings.Processing.Filters.Reflection.Removal,\n [True],\n [False],\n )\n\n pytest.helpers.equality_tester(\n zivid.Settings.Processing.Filters.Reflection.Removal,\n [True, zivid.Settings.Processing.Filters.Reflection.Removal.Experimental()],\n [False, zivid.Settings.Processing.Filters.Reflection.Removal.Experimental()],\n )\n\n pytest.helpers.equality_tester(\n zivid.Settings.Processing.Filters.Reflection.Removal,\n [\n True,\n zivid.Settings.Processing.Filters.Reflection.Removal.Experimental(\"global\"),\n ],\n [\n True,\n zivid.Settings.Processing.Filters.Reflection.Removal.Experimental(\"local\"),\n ],\n )\n\n\ndef test_settings_processing_filters_reflection_removal_enabled(\n application,\n):\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings.Processing.Filters.Reflection.Removal(),\n member=\"enabled\",\n value=True,\n expected_data_type=bool,\n )\n\n\ndef test_settings_processing_filters_reflection_removal_experimental(\n application,\n):\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings.Processing.Filters.Reflection.Removal(),\n member=\"experimental\",\n value=zivid.Settings.Processing.Filters.Reflection.Removal.Experimental(),\n expected_data_type=zivid.Settings.Processing.Filters.Reflection.Removal.Experimental,\n )\n\n pytest.helpers.equality_tester(\n zivid.Settings.Processing.Filters.Reflection.Removal.Experimental,\n [\"global\"],\n [\"local\"],\n )\n\n\ndef test_settings_processing_filters_reflection_removal_experimental_mode(\n application,\n):\n import zivid\n\n for (\n value\n ) in (\n zivid.Settings.Processing.Filters.Reflection.Removal.Experimental.Mode.valid_values()\n ):\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings.Processing.Filters.Reflection.Removal.Experimental(),\n member=\"mode\",\n value=value,\n expected_data_type=str,\n )\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings.Processing.Filters.Reflection.Removal.Experimental(),\n member=\"mode\",\n value=None,\n expected_data_type=type(None),\n )\n\n # Is optional enum\n zivid.Settings.Processing.Filters.Reflection.Removal.Experimental(mode=\"global\")\n zivid.Settings.Processing.Filters.Reflection.Removal.Experimental(mode=\"local\")\n with pytest.raises(KeyError):\n zivid.Settings.Processing.Filters.Reflection.Removal.Experimental(\n mode=\"_dummy_\"\n )\n\n\ndef test_settings_processing_filters_smoothing(\n application,\n):\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings.Processing.Filters(),\n member=\"smoothing\",\n value=zivid.Settings.Processing.Filters.Smoothing(),\n expected_data_type=zivid.Settings.Processing.Filters.Smoothing,\n )\n pytest.helpers.equality_tester(\n zivid.Settings.Processing.Filters.Smoothing,\n [zivid.Settings.Processing.Filters.Smoothing.Gaussian(enabled=True)],\n [zivid.Settings.Processing.Filters.Smoothing.Gaussian(enabled=False)],\n )\n\n\ndef test_settings_processing_filters_smoothing_gaussian(\n application,\n):\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings.Processing.Filters.Smoothing(),\n member=\"gaussian\",\n value=zivid.Settings.Processing.Filters.Smoothing.Gaussian(),\n expected_data_type=zivid.Settings.Processing.Filters.Smoothing.Gaussian,\n )\n pytest.helpers.equality_tester(\n zivid.Settings.Processing.Filters.Smoothing.Gaussian,\n [True],\n [False],\n )\n\n\ndef test_settings_processing_filters_smoothing_gaussian_sigma(\n application,\n):\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings.Processing.Filters.Smoothing.Gaussian(),\n member=\"sigma\",\n value=1.798888,\n expected_data_type=float,\n )\n\n\ndef test_settings_processing_filters_smoothing_gaussian_enabled(\n application,\n):\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings.Processing.Filters.Smoothing.Gaussian(),\n member=\"enabled\",\n value=True,\n expected_data_type=bool,\n )\n\n\ndef test_settings_regionofinterest(application):\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings(),\n member=\"region_of_interest\",\n value=zivid.Settings.RegionOfInterest(),\n expected_data_type=zivid.Settings.RegionOfInterest,\n )\n pytest.helpers.equality_tester(\n zivid.Settings.RegionOfInterest,\n [zivid.Settings.RegionOfInterest.Box(enabled=True)],\n [zivid.Settings.RegionOfInterest.Box(enabled=False)],\n )\n\n\ndef test_settings_regionofinterest_box(application):\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings.RegionOfInterest(),\n member=\"box\",\n value=zivid.Settings.RegionOfInterest.Box(),\n expected_data_type=zivid.Settings.RegionOfInterest.Box,\n )\n pytest.helpers.equality_tester(\n zivid.Settings.RegionOfInterest.Box,\n [True],\n [False],\n )\n\n\ndef test_settings_regionofinterest_box_enabled(application):\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings.RegionOfInterest.Box(),\n member=\"enabled\",\n value=True,\n expected_data_type=bool,\n )\n\n\ndef test_settings_regionofinterest_box_pointo(application):\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings.RegionOfInterest.Box(),\n member=\"point_o\",\n value=[100.0, 200.0, 300.0],\n expected_data_type=list,\n )\n\n\ndef test_settings_regionofinterest_box_pointa(application):\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings.RegionOfInterest.Box(),\n member=\"point_a\",\n value=[100.0, 200.0, 300.0],\n expected_data_type=list,\n )\n\n\ndef test_settings_regionofinterest_box_pointb(application):\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings.RegionOfInterest.Box(),\n member=\"point_b\",\n value=[100.0, 200.0, 300.0],\n expected_data_type=list,\n )\n\n\ndef test_settings_regionofinterest_box_extents(application):\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings.RegionOfInterest.Box(),\n member=\"extents\",\n value=[-100.0, 500.0],\n expected_data_type=list,\n )\n\n # A range must have two elements\n with pytest.raises(TypeError):\n zivid.Settings.RegionOfInterest.Box(extents=[])\n with pytest.raises(TypeError):\n zivid.Settings.RegionOfInterest.Box(extents=[100.0])\n with pytest.raises(TypeError):\n zivid.Settings.RegionOfInterest.Box(extents=[100.0, 200.0, 300.0])\n\n # A range must have min <= max\n with pytest.raises(TypeError):\n zivid.Settings.RegionOfInterest.Box(extents=[100.0, 50.0])\n\n\ndef test_settings_regionofinterest_depth(application):\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings.RegionOfInterest(),\n member=\"depth\",\n value=zivid.Settings.RegionOfInterest.Depth(),\n expected_data_type=zivid.Settings.RegionOfInterest.Depth,\n )\n pytest.helpers.equality_tester(\n zivid.Settings.RegionOfInterest.Depth,\n [True],\n [False],\n )\n\n\ndef test_settings_regionofinterest_depth_enabled(application):\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings.RegionOfInterest.Depth(),\n member=\"enabled\",\n value=True,\n expected_data_type=bool,\n )\n\n\ndef test_settings_regionofinterest_depth_range(application):\n import zivid\n\n pytest.helpers.set_attribute_tester(\n settings_instance=zivid.Settings.RegionOfInterest.Depth(),\n member=\"range\",\n value=[100.0, 1500.0],\n expected_data_type=list,\n )\n\n # A range must have two elements\n with pytest.raises(TypeError):\n zivid.Settings.RegionOfInterest.Depth(range=[])\n with pytest.raises(TypeError):\n zivid.Settings.RegionOfInterest.Depth(range=[100.0])\n with pytest.raises(TypeError):\n zivid.Settings.RegionOfInterest.Depth(range=[100.0, 200.0, 300.0])\n\n # A range must have min <= max\n with pytest.raises(TypeError):\n zivid.Settings.RegionOfInterest.Depth(range=[100.0, -200.0])\n\n\ndef test_print_settings(application):\n import zivid\n\n print(zivid.Settings())\n\n\ndef test_print_acquisition(application):\n import zivid\n\n print(zivid.Settings.Acquisition())\n\n\ndef test_print_processing(application):\n import zivid\n\n print(zivid.Settings.Processing())\n" }, { "alpha_fraction": 0.6496945023536682, "alphanum_fraction": 0.6619144678115845, "avg_line_length": 29.6875, "blob_id": "d5a8b43c1079bca98430bb5295d4cca586fe62f0", "content_id": "7bf97095ca2f29afdb4cb560df8765ff40b3dd37", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 491, "license_type": "permissive", "max_line_length": 54, "num_lines": 16, "path": "/src/Version.cpp", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "#include <Zivid/Version.h>\n#include <ZividPython/Version.h>\n\n#include <pybind11/pybind11.h>\n\nnamespace ZividPython::Version\n{\n void wrapAsSubmodule(pybind11::module &dest)\n {\n dest.attr(\"major\") = ZIVID_CORE_VERSION_MAJOR;\n dest.attr(\"minor\") = ZIVID_CORE_VERSION_MINOR;\n dest.attr(\"patch\") = ZIVID_CORE_VERSION_PATCH;\n dest.attr(\"build\") = ZIVID_CORE_VERSION_BUILD;\n dest.attr(\"full\") = ZIVID_CORE_VERSION;\n }\n} // namespace ZividPython::Version\n" }, { "alpha_fraction": 0.5711222290992737, "alphanum_fraction": 0.5746961832046509, "avg_line_length": 25.149532318115234, "blob_id": "27b929b2a364e913bbdb466f007b6c0e74625d5f", "content_id": "39ef1b090f8d378a05b5c14b1b691dd633b18b50", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2798, "license_type": "permissive", "max_line_length": 98, "num_lines": 107, "path": "/modules/zivid/frame_2d.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "\"\"\"Contains the Frame class.\"\"\"\nimport _zivid\nfrom zivid.settings_2d import _to_settings2d\nfrom zivid.camera_info import _to_camera_info\nfrom zivid.camera_state import _to_camera_state\nfrom zivid.frame_info import _to_frame_info\nfrom zivid.image import Image\n\n\nclass Frame2D:\n \"\"\"A 2D frame captured by a Zivid camera.\n\n Contains a 2D image as well as metadata, settings and state of the API at the time of capture.\n \"\"\"\n\n def __init__(self, impl):\n \"\"\"Initialize Frame2D wrapper.\n\n This constructor is only used internally, and should not be called by the end-user.\n\n Args:\n impl: Reference to internal/back-end instance.\n\n Raises:\n TypeError: If argument does not match the expected internal class.\n \"\"\"\n if isinstance(impl, _zivid.Frame2D):\n self.__impl = impl\n else:\n raise TypeError(\n \"Unsupported type for argument impl. Got {}, expected {}.\".format(\n type(impl), type(_zivid.Frame2D)\n )\n )\n\n def __str__(self):\n return str(self.__impl)\n\n def image_rgba(self):\n \"\"\"Get color (RGBA) image from the frame.\n\n Returns:\n An image instance containing RGBA data\n \"\"\"\n return Image(self.__impl.image_rgba())\n\n def image_bgra(self):\n \"\"\"Get color (BGRA) image from the frame.\n\n Returns:\n An image instance containing BGRA data\n \"\"\"\n return Image(self.__impl.image_bgra())\n\n @property\n def settings(self):\n \"\"\"Get the settings used to capture this frame.\n\n Returns:\n A Settings2D instance\n \"\"\"\n return _to_settings2d(self.__impl.settings)\n\n @property\n def state(self):\n \"\"\"Get the camera state data at the time of the frame capture.\n\n Returns:\n A CameraState instance\n \"\"\"\n return _to_camera_state(self.__impl.state)\n\n @property\n def info(self):\n \"\"\"Get information collected at the time of the capture.\n\n Returns:\n A FrameInfo instance\n \"\"\"\n return _to_frame_info(self.__impl.info)\n\n @property\n def camera_info(self):\n \"\"\"Get information about the camera used to capture the frame.\n\n Returns:\n A CameraInfo instance\n \"\"\"\n return _to_camera_info(self.__impl.camera_info)\n\n def release(self):\n \"\"\"Release the underlying resources.\"\"\"\n try:\n impl = self.__impl\n except AttributeError:\n pass\n else:\n impl.release()\n\n def __enter__(self):\n return self\n\n def __exit__(self, exception_type, exception_value, traceback):\n self.release()\n\n def __del__(self):\n self.release()\n" }, { "alpha_fraction": 0.5469440221786499, "alphanum_fraction": 0.5539396405220032, "avg_line_length": 33.82051467895508, "blob_id": "43f3214a33e00535c0a1768845992ef158a41fe4", "content_id": "6f662856136f4f2222dfc26af3009797bec14555", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 5432, "license_type": "permissive", "max_line_length": 122, "num_lines": 156, "path": "/setup.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "import tempfile\nimport platform\nimport subprocess\nfrom sys import version_info\nfrom tempfile import TemporaryDirectory\nfrom pathlib import Path\nfrom pkgutil import iter_modules\nfrom skbuild import setup, constants\n\n\n# To be replaced by: from setuptools_scm import get_version\ndef get_version():\n return \"2.10.0\"\n\n\ndef _zivid_sdk_version():\n return \"2.10.0\"\n\n\ndef _zivid_python_version():\n scm_version = get_version()\n\n if \"+\" in scm_version:\n base_version, scm_metadata = scm_version.split(\"+\", 1)\n else:\n base_version = scm_version\n scm_metadata = None\n\n base_version = \"{}.{}\".format(base_version, _zivid_sdk_version())\n\n if scm_metadata:\n version = \"{}+{}\".format(base_version, scm_metadata)\n else:\n version = base_version\n\n return version\n\n\ndef _python_version():\n return \"{}.{}.{}\".format(*version_info)\n\n\ndef _make_message_box(*message):\n width = max(len(e) for e in message)\n\n box_bar = \"+-\" + \"-\" * width + \"-+\"\n empty_line = \"\\n| \" + \" \" * width + \" |\\n\"\n message_lines = [\"| \" + line + \" \" * (width - len(line)) + \" |\" for line in message]\n\n return (\n \"\\n\\n\" + box_bar + \"\\n\" + empty_line.join(message_lines) + \"\\n\" + box_bar + \"\\n\"\n )\n\n\ndef _check_dependency(module_name, package_hint=None):\n if package_hint is None:\n package_hint = module_name\n if module_name not in [module[1] for module in iter_modules()]:\n raise ImportError(\n _make_message_box(\n \"!! Missing module '{}' !!\".format(module_name),\n \"Please install '{}' manually or use PIP>=19 to handle build dependencies automatically (PEP 517)\".format(\n package_hint\n ),\n )\n )\n\n\ndef _check_cpp17_compiler():\n def run_process(args, **kwargs):\n try:\n with subprocess.Popen(args, **kwargs) as process:\n exit_code = process.wait()\n if exit_code != 0:\n raise RuntimeError(\n \"Wait failed with exit code {}\".format(exit_code)\n )\n except Exception as ex:\n raise type(ex)(\"Process failed: '{}'.\".format(\" \".join(args))) from ex\n\n try:\n run_process((\"cmake\", \"--version\"))\n except Exception as ex:\n raise RuntimeError(_make_message_box(\"!! CMake not found !!\")) from ex\n with tempfile.TemporaryDirectory(prefix=\"zivid-python-build-\") as temp_dir:\n with (Path(temp_dir) / \"lib.cpp\").open(\"w\") as lib_cpp:\n # MSVC does not report itself as C++17, on Windoes we have to rely on the CMAKE_CXX_STANDARD test below\n if platform.system() == \"Linux\":\n lib_cpp.write(\"static_assert(__cplusplus >= 201703L);\")\n with (Path(temp_dir) / \"CMakeLists.txt\").open(\"w\") as cmake_lists_txt:\n cmake_lists_txt.write(\n \"project(zivid-python-compiler-detection LANGUAGES CXX)\\n\"\n \"set(CMAKE_CXX_STANDARD 17)\\n\"\n \"add_library(lib lib.cpp)\\n\"\n )\n try:\n if platform.system() == \"Linux\":\n run_process((\"cmake\", \"-GNinja\", \".\"), cwd=temp_dir)\n else:\n run_process((\"cmake\", \".\"), cwd=temp_dir)\n run_process((\"cmake\", \"--build\", \".\"), cwd=temp_dir)\n except Exception as ex:\n raise RuntimeError(\n _make_message_box(\n \"!! Module setup failed !!\",\n \"Make sure you have a working C++17 compiler installed\",\n \"Refer to Readme.md for detailed installation instructions\",\n )\n ) from ex\n\n\ndef _main():\n # This list is a duplicate of the build-system requirements in pyproject.toml.\n # The purpose of these checks is to help users with PIP<19 lacking support for\n # pyproject.toml\n # Keep the two lists in sync\n _check_dependency(\"cmake\")\n _check_dependency(\"conans\", \"conan\")\n _check_dependency(\"ninja\")\n _check_dependency(\"skbuild\", \"scikit-build\")\n\n _check_cpp17_compiler()\n\n with TemporaryDirectory(prefix=\"zivid-python-build_\") as build_dir:\n print(\"Overriding build dir: \" + build_dir)\n constants.SKBUILD_DIR = lambda: build_dir\n\n setup(\n name=\"zivid\",\n version=_zivid_python_version(),\n description=\"Defining the Future of 3D Machine Vision\",\n long_description=Path(\"README.md\").read_text(encoding=\"utf-8\"),\n long_description_content_type=\"text/markdown\",\n url=\"https://www.zivid.com\",\n author=\"Zivid AS\",\n author_email=\"customersuccess@zivid.com\",\n license=\"BSD 3-Clause\",\n packages=[\"zivid\", \"zivid._calibration\", \"zivid.experimental\", \"_zivid\"],\n package_dir={\"\": \"modules\"},\n install_requires=[\"numpy\"],\n cmake_args=[\n \"-DZIVID_PYTHON_VERSION=\" + _zivid_python_version(),\n \"-DZIVID_SDK_VERSION=\" + _zivid_sdk_version(),\n \"-DPYTHON_INTERPRETER_VERSION=\" + _python_version(),\n ],\n classifiers=[\n \"License :: OSI Approved :: BSD License\",\n \"Programming Language :: Python :: 3\",\n \"Programming Language :: Python :: Implementation :: CPython\",\n \"Topic :: Scientific/Engineering\",\n ],\n )\n\n\nif __name__ == \"__main__\":\n _main()\n" }, { "alpha_fraction": 0.717391312122345, "alphanum_fraction": 0.739130437374115, "avg_line_length": 26.600000381469727, "blob_id": "ec9ac1112383490af64b44e35014127c1f382bd1", "content_id": "31dc2f6bc30d735bb158f1beaf0b49fc897b0cd3", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "INI", "length_bytes": 138, "license_type": "permissive", "max_line_length": 52, "num_lines": 5, "path": "/pytest.ini", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "[pytest]\ntimeout = 300\naddopts = --strict-markers -m \"not physical_camera\"\nmarkers =\n physical_camera: requires physical camera to run\n" }, { "alpha_fraction": 0.6384720206260681, "alphanum_fraction": 0.6452932953834534, "avg_line_length": 28.31999969482422, "blob_id": "a0851f17aef0f779898c764aab2e0ac5e3ff1c85", "content_id": "e3c83c73ff0d9ea285bbe5bf8c429351cbd089d3", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 733, "license_type": "permissive", "max_line_length": 92, "num_lines": 25, "path": "/src/include/ZividPython/Matrix.h", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "#pragma once\n\n#include \"pybind11/eigen.h\"\n#include <Zivid/Matrix.h>\n#include <Zivid/Point.h>\n\nnamespace ZividPython::Conversion\n{\n template<typename T, int rows, int cols>\n auto toCpp(const Eigen::Matrix<T, rows, cols, Eigen::RowMajor> &source)\n {\n return Zivid::Matrix<T, rows, cols>{ source.data(), source.data() + source.size() };\n }\n\n template<typename T, size_t rows, size_t cols>\n auto toPy(const Zivid::Matrix<T, rows, cols> &source)\n {\n return Eigen::Matrix<T, rows, cols, Eigen::RowMajor>{ &(source(0, 0)) };\n }\n\n inline auto toPyVector(const Zivid::PointXYZ &source)\n {\n return Eigen::Vector3f{ source.x, source.y, source.z };\n }\n} // namespace ZividPython::Conversion\n" }, { "alpha_fraction": 0.7352216839790344, "alphanum_fraction": 0.738916277885437, "avg_line_length": 31.479999542236328, "blob_id": "fa876fd077ca5375febd3639ff2c90a1c013ac43", "content_id": "6d93fa08c6d6a90b16e502b82bc6954d3a762cb6", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1624, "license_type": "permissive", "max_line_length": 83, "num_lines": 50, "path": "/test/test_frame_info.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "from datetime import datetime\nimport zivid\n\n\ndef test_time_stamp(frame_info):\n time_stamp = frame_info.time_stamp\n assert time_stamp\n assert isinstance(time_stamp, datetime)\n\n\ndef test_software_version(frame_info):\n software_version = frame_info.software_version\n assert software_version\n assert isinstance(software_version, zivid.frame_info.FrameInfo.SoftwareVersion)\n assert software_version.core\n assert isinstance(software_version.core, str)\n\n\ndef test_system_info(frame_info):\n system_info = frame_info.system_info\n assert isinstance(system_info, zivid.FrameInfo.SystemInfo)\n\n cpu = system_info.cpu\n assert isinstance(cpu, zivid.FrameInfo.SystemInfo.CPU)\n cpu_model = cpu.model\n assert cpu_model\n assert isinstance(cpu_model, str)\n\n compute_device = system_info.compute_device\n assert isinstance(compute_device, zivid.FrameInfo.SystemInfo.ComputeDevice)\n compute_model = compute_device.model\n assert compute_model\n assert isinstance(compute_model, str)\n compute_vendor = compute_device.vendor\n assert compute_vendor\n assert isinstance(compute_vendor, str)\n\n os_name = system_info.operating_system\n assert os_name\n assert isinstance(os_name, str)\n\n\ndef test_set_time_stamp(frame_info):\n assert isinstance(frame_info.time_stamp, datetime)\n assert isinstance(str(frame_info.time_stamp), str)\n new_time_stamp = datetime(1992, 2, 7)\n frame_info.time_stamp = new_time_stamp\n assert isinstance(str(frame_info.time_stamp), str)\n assert isinstance(frame_info.time_stamp, datetime)\n assert frame_info.time_stamp == new_time_stamp\n" }, { "alpha_fraction": 0.7201389074325562, "alphanum_fraction": 0.7395833134651184, "avg_line_length": 29.63829803466797, "blob_id": "ec8b21654cf8e59661b7b956af965728ab7b6e77", "content_id": "807d7c956e47e0cbe11911e0ee0348c9bb729f52", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "CMake", "length_bytes": 1440, "license_type": "permissive", "max_line_length": 103, "num_lines": 47, "path": "/CMakeLists.txt", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "cmake_minimum_required(VERSION 3.8 FATAL_ERROR)\nproject(zivid LANGUAGES CXX)\n\nif(NOT EXISTS \"${CMAKE_BINARY_DIR}/conan.cmake\")\n message(STATUS \"Downloading conan.cmake from https://github.com/conan-io/cmake-conan\")\n file(DOWNLOAD \"https://raw.githubusercontent.com/conan-io/cmake-conan/master/conan.cmake\"\n \"${CMAKE_BINARY_DIR}/conan.cmake\")\nendif()\n\nfind_package(Python3 \"${PYTHON_INTERPRETER_VERSION}\" EXACT REQUIRED COMPONENTS Interpreter Development)\ninclude(${CMAKE_BINARY_DIR}/conan.cmake)\n\nconan_cmake_configure(\n REQUIRES\n eigen/3.3.9\n pybind11/2.10.0\n GENERATORS cmake_find_package\n OPTIONS eigen:MPL2_only=True)\n\nconan_cmake_autodetect(CONAN_SETTINGS)\n\nset(CONAN_INSTALL_FOLDER \"${CMAKE_BINARY_DIR}/conan_install\")\n\nconan_cmake_install(\n PATH_OR_REFERENCE .\n REMOTE conancenter\n SETTINGS ${CONAN_SETTINGS}\n INSTALL_FOLDER ${CONAN_INSTALL_FOLDER}\n )\n\nset(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CONAN_INSTALL_FOLDER})\n\nset(CMAKE_CXX_STANDARD 17)\nset(CMAKE_CXX_STANDARD_REQUIRED ON)\n\nOPTION(ZIVID_PYTHON_VERSION \"Version number to be compiled into the module\" \"UNKNOWN\")\nOPTION(ZIVID_SDK_VERSION \"Zivid SDK version to link with\" 0.0.0)\n\nif(MSVC)\n add_compile_options(/bigobj)\nendif()\n\nfind_package(Eigen3 3.3.9 MODULE REQUIRED)\nfind_package(pybind11 2.10.0 MODULE REQUIRED)\nfind_package(Zivid ${ZIVID_SDK_VERSION} EXACT COMPONENTS Core REQUIRED)\n\nadd_subdirectory(src)\n" }, { "alpha_fraction": 0.6362007260322571, "alphanum_fraction": 0.6469534039497375, "avg_line_length": 38.92856979370117, "blob_id": "b267501ffc5c45dae9eedd8174ca01adbb1b20e5", "content_id": "4d996a2ff426e7b21102c609b3db4913561281b9", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Shell", "length_bytes": 558, "license_type": "permissive", "max_line_length": 103, "num_lines": 14, "path": "/continuous-integration/code-generation/docker_generate_datamodels.sh", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "#!/bin/bash\n\n# The purpose of this script is to run generate_datamodels.sh in the exact same environment as\n# the linting step, so that the generated code will be consistent and pass formatting checks.\n\nSCRIPT_DIR=\"$( cd \"$( dirname \"${BASH_SOURCE[0]}\" )\" && pwd )\"\nROOT_DIR=$(realpath \"$SCRIPT_DIR/../..\")\n\ndocker run --volume $ROOT_DIR:/host \\\n --workdir /host/continuous-integration ubuntu:20.04 \\\n bash -c \"./linux/setup.sh && ./linux/build.sh && ./code-generation/generate_datamodels.sh\" \\\n || exit $?\n\necho Success! [\"$0\"]" }, { "alpha_fraction": 0.761904776096344, "alphanum_fraction": 0.761904776096344, "avg_line_length": 30.5, "blob_id": "34a0dee44fac72173a07c73c30108288eb97849c", "content_id": "3805b2e10a5ac5d55ca3956e08f1d3cd0e788778", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 504, "license_type": "permissive", "max_line_length": 78, "num_lines": 16, "path": "/modules/zivid/calibration.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "\"\"\"Module for calibration features, such as HandEye and MultiCamera.\"\"\"\n# pylint: disable=unused-import\nfrom zivid._calibration.detector import DetectionResult, detect_feature_points\nfrom zivid._calibration.hand_eye import (\n HandEyeInput,\n HandEyeResidual,\n HandEyeOutput,\n calibrate_eye_in_hand,\n calibrate_eye_to_hand,\n)\nfrom zivid._calibration.multi_camera import (\n MultiCameraResidual,\n MultiCameraOutput,\n calibrate_multi_camera,\n)\nfrom zivid._calibration.pose import Pose\n" }, { "alpha_fraction": 0.6831042766571045, "alphanum_fraction": 0.6919967532157898, "avg_line_length": 21.907407760620117, "blob_id": "59784c4e4ca3c9b01a4d88f226d20217866832dd", "content_id": "982930d2c264623de6fa19e5179f2fd08c4b8f09", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "CMake", "length_bytes": 1237, "license_type": "permissive", "max_line_length": 96, "num_lines": 54, "path": "/src/CMakeLists.txt", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "project(_zivid LANGUAGES CXX C)\n\nset(SOURCES\n Calibration/Calibration.cpp\n Calibration/Detector.cpp\n Calibration/HandEye.cpp\n Calibration/MultiCamera.cpp\n Calibration/Pose.cpp\n CaptureAssistant.cpp\n DataModel.cpp\n Firmware.cpp\n InfieldCorrection/InfieldCorrection.cpp\n NodeType.cpp\n Projection.cpp\n ReleasableArray2D.cpp\n ReleasableCamera.cpp\n ReleasableFrame.cpp\n ReleasableFrame2D.cpp\n ReleasableImage.cpp\n ReleasablePointCloud.cpp\n ReleasableProjectedImage.cpp\n SingletonApplication.cpp\n Version.cpp\n Wrapper.cpp\n Matrix4x4.cpp\n)\n\nconfigure_file(\"Wrapper.h.in\" \"${CMAKE_CURRENT_BINARY_DIR}/include/ZividPython/Wrapper.h\" @ONLY)\n\nfile(GLOB_RECURSE HEADERS\n \"include/*.h\"\n \"${CMAKE_CURRENT_BINARY_DIR}/include/*h\"\n)\n\npython3_add_library(\n ${PROJECT_NAME}\n MODULE\n WITH_SOABI\n ${SOURCES}\n )\n\ntarget_include_directories(${PROJECT_NAME}\n PRIVATE include\n ${CMAKE_CURRENT_BINARY_DIR}/include/\n)\n\ntarget_link_libraries(${PROJECT_NAME}\n PRIVATE Zivid::Core\n Python3::Module\n pybind11::pybind11\n Eigen3::Eigen\n)\n\ninstall(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION modules/${PROJECT_NAME})\n" }, { "alpha_fraction": 0.45731785893440247, "alphanum_fraction": 0.4638342261314392, "avg_line_length": 29.50894546508789, "blob_id": "07b755abcbd52ec018643d28251b6b9e3f2ce372", "content_id": "a88fc82aac0b2f501657d60850c9db99823164cd", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 15346, "license_type": "permissive", "max_line_length": 221, "num_lines": 503, "path": "/modules/zivid/camera_intrinsics.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "\"\"\"Auto generated, do not edit.\"\"\"\n# pylint: disable=too-many-lines,protected-access,too-few-public-methods,too-many-arguments,line-too-long,missing-function-docstring,missing-class-docstring,redefined-builtin,too-many-branches,too-many-boolean-expressions\nimport _zivid\n\n\nclass CameraIntrinsics:\n class CameraMatrix:\n def __init__(\n self,\n cx=_zivid.CameraIntrinsics.CameraMatrix.CX().value,\n cy=_zivid.CameraIntrinsics.CameraMatrix.CY().value,\n fx=_zivid.CameraIntrinsics.CameraMatrix.FX().value,\n fy=_zivid.CameraIntrinsics.CameraMatrix.FY().value,\n ):\n if isinstance(\n cx,\n (\n float,\n int,\n ),\n ):\n self._cx = _zivid.CameraIntrinsics.CameraMatrix.CX(cx)\n else:\n raise TypeError(\n \"Unsupported type, expected: (float, int,), got {value_type}\".format(\n value_type=type(cx)\n )\n )\n\n if isinstance(\n cy,\n (\n float,\n int,\n ),\n ):\n self._cy = _zivid.CameraIntrinsics.CameraMatrix.CY(cy)\n else:\n raise TypeError(\n \"Unsupported type, expected: (float, int,), got {value_type}\".format(\n value_type=type(cy)\n )\n )\n\n if isinstance(\n fx,\n (\n float,\n int,\n ),\n ):\n self._fx = _zivid.CameraIntrinsics.CameraMatrix.FX(fx)\n else:\n raise TypeError(\n \"Unsupported type, expected: (float, int,), got {value_type}\".format(\n value_type=type(fx)\n )\n )\n\n if isinstance(\n fy,\n (\n float,\n int,\n ),\n ):\n self._fy = _zivid.CameraIntrinsics.CameraMatrix.FY(fy)\n else:\n raise TypeError(\n \"Unsupported type, expected: (float, int,), got {value_type}\".format(\n value_type=type(fy)\n )\n )\n\n @property\n def cx(self):\n return self._cx.value\n\n @property\n def cy(self):\n return self._cy.value\n\n @property\n def fx(self):\n return self._fx.value\n\n @property\n def fy(self):\n return self._fy.value\n\n @cx.setter\n def cx(self, value):\n if isinstance(\n value,\n (\n float,\n int,\n ),\n ):\n self._cx = _zivid.CameraIntrinsics.CameraMatrix.CX(value)\n else:\n raise TypeError(\n \"Unsupported type, expected: float or int, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n @cy.setter\n def cy(self, value):\n if isinstance(\n value,\n (\n float,\n int,\n ),\n ):\n self._cy = _zivid.CameraIntrinsics.CameraMatrix.CY(value)\n else:\n raise TypeError(\n \"Unsupported type, expected: float or int, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n @fx.setter\n def fx(self, value):\n if isinstance(\n value,\n (\n float,\n int,\n ),\n ):\n self._fx = _zivid.CameraIntrinsics.CameraMatrix.FX(value)\n else:\n raise TypeError(\n \"Unsupported type, expected: float or int, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n @fy.setter\n def fy(self, value):\n if isinstance(\n value,\n (\n float,\n int,\n ),\n ):\n self._fy = _zivid.CameraIntrinsics.CameraMatrix.FY(value)\n else:\n raise TypeError(\n \"Unsupported type, expected: float or int, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n def __eq__(self, other):\n if (\n self._cx == other._cx\n and self._cy == other._cy\n and self._fx == other._fx\n and self._fy == other._fy\n ):\n return True\n return False\n\n def __str__(self):\n return str(_to_internal_camera_intrinsics_camera_matrix(self))\n\n class Distortion:\n def __init__(\n self,\n k1=_zivid.CameraIntrinsics.Distortion.K1().value,\n k2=_zivid.CameraIntrinsics.Distortion.K2().value,\n k3=_zivid.CameraIntrinsics.Distortion.K3().value,\n p1=_zivid.CameraIntrinsics.Distortion.P1().value,\n p2=_zivid.CameraIntrinsics.Distortion.P2().value,\n ):\n if isinstance(\n k1,\n (\n float,\n int,\n ),\n ):\n self._k1 = _zivid.CameraIntrinsics.Distortion.K1(k1)\n else:\n raise TypeError(\n \"Unsupported type, expected: (float, int,), got {value_type}\".format(\n value_type=type(k1)\n )\n )\n\n if isinstance(\n k2,\n (\n float,\n int,\n ),\n ):\n self._k2 = _zivid.CameraIntrinsics.Distortion.K2(k2)\n else:\n raise TypeError(\n \"Unsupported type, expected: (float, int,), got {value_type}\".format(\n value_type=type(k2)\n )\n )\n\n if isinstance(\n k3,\n (\n float,\n int,\n ),\n ):\n self._k3 = _zivid.CameraIntrinsics.Distortion.K3(k3)\n else:\n raise TypeError(\n \"Unsupported type, expected: (float, int,), got {value_type}\".format(\n value_type=type(k3)\n )\n )\n\n if isinstance(\n p1,\n (\n float,\n int,\n ),\n ):\n self._p1 = _zivid.CameraIntrinsics.Distortion.P1(p1)\n else:\n raise TypeError(\n \"Unsupported type, expected: (float, int,), got {value_type}\".format(\n value_type=type(p1)\n )\n )\n\n if isinstance(\n p2,\n (\n float,\n int,\n ),\n ):\n self._p2 = _zivid.CameraIntrinsics.Distortion.P2(p2)\n else:\n raise TypeError(\n \"Unsupported type, expected: (float, int,), got {value_type}\".format(\n value_type=type(p2)\n )\n )\n\n @property\n def k1(self):\n return self._k1.value\n\n @property\n def k2(self):\n return self._k2.value\n\n @property\n def k3(self):\n return self._k3.value\n\n @property\n def p1(self):\n return self._p1.value\n\n @property\n def p2(self):\n return self._p2.value\n\n @k1.setter\n def k1(self, value):\n if isinstance(\n value,\n (\n float,\n int,\n ),\n ):\n self._k1 = _zivid.CameraIntrinsics.Distortion.K1(value)\n else:\n raise TypeError(\n \"Unsupported type, expected: float or int, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n @k2.setter\n def k2(self, value):\n if isinstance(\n value,\n (\n float,\n int,\n ),\n ):\n self._k2 = _zivid.CameraIntrinsics.Distortion.K2(value)\n else:\n raise TypeError(\n \"Unsupported type, expected: float or int, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n @k3.setter\n def k3(self, value):\n if isinstance(\n value,\n (\n float,\n int,\n ),\n ):\n self._k3 = _zivid.CameraIntrinsics.Distortion.K3(value)\n else:\n raise TypeError(\n \"Unsupported type, expected: float or int, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n @p1.setter\n def p1(self, value):\n if isinstance(\n value,\n (\n float,\n int,\n ),\n ):\n self._p1 = _zivid.CameraIntrinsics.Distortion.P1(value)\n else:\n raise TypeError(\n \"Unsupported type, expected: float or int, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n @p2.setter\n def p2(self, value):\n if isinstance(\n value,\n (\n float,\n int,\n ),\n ):\n self._p2 = _zivid.CameraIntrinsics.Distortion.P2(value)\n else:\n raise TypeError(\n \"Unsupported type, expected: float or int, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n def __eq__(self, other):\n if (\n self._k1 == other._k1\n and self._k2 == other._k2\n and self._k3 == other._k3\n and self._p1 == other._p1\n and self._p2 == other._p2\n ):\n return True\n return False\n\n def __str__(self):\n return str(_to_internal_camera_intrinsics_distortion(self))\n\n def __init__(\n self,\n camera_matrix=None,\n distortion=None,\n ):\n if camera_matrix is None:\n camera_matrix = self.CameraMatrix()\n if not isinstance(camera_matrix, self.CameraMatrix):\n raise TypeError(\n \"Unsupported type: {value}\".format(value=type(camera_matrix))\n )\n self._camera_matrix = camera_matrix\n\n if distortion is None:\n distortion = self.Distortion()\n if not isinstance(distortion, self.Distortion):\n raise TypeError(\"Unsupported type: {value}\".format(value=type(distortion)))\n self._distortion = distortion\n\n @property\n def camera_matrix(self):\n return self._camera_matrix\n\n @property\n def distortion(self):\n return self._distortion\n\n @camera_matrix.setter\n def camera_matrix(self, value):\n if not isinstance(value, self.CameraMatrix):\n raise TypeError(\"Unsupported type {value}\".format(value=type(value)))\n self._camera_matrix = value\n\n @distortion.setter\n def distortion(self, value):\n if not isinstance(value, self.Distortion):\n raise TypeError(\"Unsupported type {value}\".format(value=type(value)))\n self._distortion = value\n\n @classmethod\n def load(cls, file_name):\n return _to_camera_intrinsics(_zivid.CameraIntrinsics(str(file_name)))\n\n def save(self, file_name):\n _to_internal_camera_intrinsics(self).save(str(file_name))\n\n def __eq__(self, other):\n if (\n self._camera_matrix == other._camera_matrix\n and self._distortion == other._distortion\n ):\n return True\n return False\n\n def __str__(self):\n return str(_to_internal_camera_intrinsics(self))\n\n\ndef _to_camera_intrinsics_camera_matrix(internal_camera_matrix):\n return CameraIntrinsics.CameraMatrix(\n cx=internal_camera_matrix.cx.value,\n cy=internal_camera_matrix.cy.value,\n fx=internal_camera_matrix.fx.value,\n fy=internal_camera_matrix.fy.value,\n )\n\n\ndef _to_camera_intrinsics_distortion(internal_distortion):\n return CameraIntrinsics.Distortion(\n k1=internal_distortion.k1.value,\n k2=internal_distortion.k2.value,\n k3=internal_distortion.k3.value,\n p1=internal_distortion.p1.value,\n p2=internal_distortion.p2.value,\n )\n\n\ndef _to_camera_intrinsics(internal_camera_intrinsics):\n return CameraIntrinsics(\n camera_matrix=_to_camera_intrinsics_camera_matrix(\n internal_camera_intrinsics.camera_matrix\n ),\n distortion=_to_camera_intrinsics_distortion(\n internal_camera_intrinsics.distortion\n ),\n )\n\n\ndef _to_internal_camera_intrinsics_camera_matrix(camera_matrix):\n internal_camera_matrix = _zivid.CameraIntrinsics.CameraMatrix()\n\n internal_camera_matrix.cx = _zivid.CameraIntrinsics.CameraMatrix.CX(\n camera_matrix.cx\n )\n internal_camera_matrix.cy = _zivid.CameraIntrinsics.CameraMatrix.CY(\n camera_matrix.cy\n )\n internal_camera_matrix.fx = _zivid.CameraIntrinsics.CameraMatrix.FX(\n camera_matrix.fx\n )\n internal_camera_matrix.fy = _zivid.CameraIntrinsics.CameraMatrix.FY(\n camera_matrix.fy\n )\n\n return internal_camera_matrix\n\n\ndef _to_internal_camera_intrinsics_distortion(distortion):\n internal_distortion = _zivid.CameraIntrinsics.Distortion()\n\n internal_distortion.k1 = _zivid.CameraIntrinsics.Distortion.K1(distortion.k1)\n internal_distortion.k2 = _zivid.CameraIntrinsics.Distortion.K2(distortion.k2)\n internal_distortion.k3 = _zivid.CameraIntrinsics.Distortion.K3(distortion.k3)\n internal_distortion.p1 = _zivid.CameraIntrinsics.Distortion.P1(distortion.p1)\n internal_distortion.p2 = _zivid.CameraIntrinsics.Distortion.P2(distortion.p2)\n\n return internal_distortion\n\n\ndef _to_internal_camera_intrinsics(camera_intrinsics):\n internal_camera_intrinsics = _zivid.CameraIntrinsics()\n\n internal_camera_intrinsics.camera_matrix = (\n _to_internal_camera_intrinsics_camera_matrix(camera_intrinsics.camera_matrix)\n )\n internal_camera_intrinsics.distortion = _to_internal_camera_intrinsics_distortion(\n camera_intrinsics.distortion\n )\n return internal_camera_intrinsics\n" }, { "alpha_fraction": 0.6165516972541809, "alphanum_fraction": 0.6220689415931702, "avg_line_length": 22.387096405029297, "blob_id": "05862e2325d2b815787f3c450772f54223eca420", "content_id": "aa9cb1ddf17556e444bbbd766c9e532156ed1eeb", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 725, "license_type": "permissive", "max_line_length": 84, "num_lines": 31, "path": "/modules/zivid/_calibration/pose.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "\"\"\"Module containing the Pose class.\n\nThis module should not be imported directly by end-user, but rather accessed through\nthe zivid.calibration module.\n\"\"\"\n\nimport _zivid\n\n\nclass Pose:\n \"\"\"Class representing a robot pose.\"\"\"\n\n def __init__(self, transformation_matrix):\n \"\"\"Construct a Pose object.\n\n Args:\n transformation_matrix: A 4x4 array representing the pose\n \"\"\"\n\n self.__impl = _zivid.calibration.Pose(transformation_matrix)\n\n def to_matrix(self):\n \"\"\"Get the matrix representation of the pose.\n\n Returns:\n A 4x4 transformation matrix\n \"\"\"\n return self.__impl.to_matrix()\n\n def __str__(self):\n return str(self.__impl)\n" }, { "alpha_fraction": 0.6504929661750793, "alphanum_fraction": 0.6572588682174683, "avg_line_length": 33.71812057495117, "blob_id": "cffaef7f59ea0ef7865b962e152dccc6aa294499", "content_id": "7377f023246cc7123c2a90f40e470e7aa6b53ff3", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 5173, "license_type": "permissive", "max_line_length": 112, "num_lines": 149, "path": "/modules/zivid/experimental/projection.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "\"\"\"Module for experimental projection features. This API may change in the future.\"\"\"\n\nimport _zivid\nfrom zivid.frame_2d import Frame2D\nfrom zivid.settings_2d import Settings2D, _to_internal_settings2d\n\n\nclass ProjectedImage:\n \"\"\"A handle to a 2D image being displayed on a Zivid camera's projector.\n\n The image projection will stop either when the instance is destroyed, when the stop() method is called,\n or when exiting the \"with\" block if used as a context manager.\n \"\"\"\n\n def __init__(self, impl):\n \"\"\"Initialize ProjectedImage wrapper.\n\n This constructor is only used internally, and should not be called by the end-user.\n\n Args:\n impl: Reference to internal/back-end instance.\n\n Raises:\n TypeError: If argument does not match the expected internal class.\n \"\"\"\n if isinstance(impl, _zivid.ProjectedImage):\n self.__impl = impl\n else:\n raise TypeError(\n \"Unsupported type for argument impl. Got {}, expected {}.\".format(\n type(impl), type(_zivid.ProjectedImage)\n )\n )\n\n def __str__(self):\n return str(self.__impl)\n\n def capture(self, settings2d):\n \"\"\"Capture a single 2D frame without stopping the ongoing image projection.\n\n This method returns right after the acquisition of the image is complete. This function can only be used\n with a zero-brightness 2D capture, otherwise it will interfere with the projected image. An exception\n will be thrown if settings contains brightness > 0.\n\n Args:\n settings2d: A Settings2D instance to be used for 2D capture.\n\n Returns:\n A Frame2D containing a 2D image plus metadata.\n\n Raises:\n TypeError: If argument is not a Settings2D.\n \"\"\"\n\n if isinstance(settings2d, Settings2D):\n return Frame2D(self.__impl.capture(_to_internal_settings2d(settings2d)))\n raise TypeError(\"Unsupported settings type: {}\".format(type(settings2d)))\n\n def stop(self):\n \"\"\"Stop the ongoing image projection.\"\"\"\n self.__impl.stop()\n\n def active(self):\n \"\"\"Check if a handle is associated with an ongoing image projection.\n\n Returns:\n A boolean indicating projection state.\n \"\"\"\n return self.__impl.active()\n\n def release(self):\n \"\"\"Release the underlying resources and stop projection.\"\"\"\n try:\n impl = self.__impl\n except AttributeError:\n pass\n else:\n impl.release()\n\n def __enter__(self):\n return self\n\n def __exit__(self, exception_type, exception_value, traceback):\n self.release()\n\n def __del__(self):\n self.release()\n\n\ndef projector_resolution(camera):\n \"\"\"Get the resolution of the internal projector in the Zivid camera.\n\n Args:\n camera: The Camera instance to get the projector resolution of.\n\n Returns:\n The resolution as a tuple (height,width).\n \"\"\"\n return _zivid.projection.projector_resolution(\n camera._Camera__impl # pylint: disable=protected-access\n )\n\n\ndef show_image_bgra(camera, image_bgra):\n \"\"\"Display a 2D color image using the projector.\n\n The image resolution needs to be the same as the resolution obtained from the projector_resolution\n function for the camera. This function returns a ProjectedImage instance. Projection will continue\n until this object is destroyed, if its stop() method is called, or if another capture is initialized\n on the same camera. The ProjectedImage object can be used as a context manager, in which case the\n projection will stop when exiting the \"with\" block.\n\n Args:\n camera: The Camera instance to project with.\n image_bgra: The image to project in the form of a HxWx4 numpy array with BGRA colors.\n\n Returns:\n A handle in the form of a ProjectedImage instance.\n \"\"\"\n\n return ProjectedImage(\n _zivid.projection.show_image_bgra(\n camera._Camera__impl, # pylint: disable=protected-access\n image_bgra,\n )\n )\n\n\ndef pixels_from_3d_points(camera, points):\n \"\"\"Get 2D projector pixel coordinates corresponding to 3D points relative to the camera.\n\n This function takes 3D points in the camera's reference frame and converts them to the projector frame\n using the internal calibration of a Zivid camera. In a Zivid point cloud, each point corresponds to a\n pixel coordinate in the camera, but the projector has a slight offset. The translation of each point\n depends on the distance between the camera and the point, as well as the distance and angle between the\n camera and the projector.\n\n Args:\n camera: The Camera instance that the 3D points are in the frame of.\n points: A list of 3D (XYZ) points as List[List[float[3]]] or Nx3 Numpy array.\n\n Returns:\n The corresponding 2D (XY) points in the projector (List[List[float[2]]])\n \"\"\"\n\n return _zivid.projection.pixels_from_3d_points(\n camera._Camera__impl, # pylint: disable=protected-access\n points,\n )\n" }, { "alpha_fraction": 0.4532080590724945, "alphanum_fraction": 0.53714919090271, "avg_line_length": 24.761146545410156, "blob_id": "762971d352622b35f46db8adbc8d4d6dea756100", "content_id": "e7ea26186f0b2e5a61400e1ff5d42083213080d4", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 8089, "license_type": "permissive", "max_line_length": 85, "num_lines": 314, "path": "/test/test_matrix4x4.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "from pathlib import Path\nimport tempfile\nimport numpy\nimport numpy.testing\nimport pytest\nimport zivid\n\nZIVID_MATRIX_SAVE_LOAD_TOLERANCE_DECIMAL = 5\n\n\ndef to_float32_1d(arr):\n for i, element in enumerate(arr):\n arr[i] = float(numpy.float32(element))\n return arr\n\n\ndef to_float32_2d(arr):\n for row in arr:\n to_float32_1d(row)\n return arr\n\n\ndef assert_all_equal_flat(matrix: zivid.Matrix4x4, arr2) -> None:\n assert isinstance(matrix, zivid.Matrix4x4)\n assert len(arr2) == 16\n for element1, element2 in zip(matrix, arr2):\n numpy.testing.assert_almost_equal(\n element1, element2, ZIVID_MATRIX_SAVE_LOAD_TOLERANCE_DECIMAL\n )\n\n\ndef assert_all_equal_2d(matrix: zivid.Matrix4x4, arr2) -> None:\n assert isinstance(matrix, zivid.Matrix4x4)\n assert not isinstance(arr2, zivid.Matrix4x4)\n assert len(arr2) == 4\n for row in range(4):\n assert len(arr2[row]) == 4\n for col in range(4):\n numpy.testing.assert_almost_equal(\n matrix[row, col],\n arr2[row][col],\n ZIVID_MATRIX_SAVE_LOAD_TOLERANCE_DECIMAL,\n )\n\n\ndef sample_2d_list() -> list:\n return to_float32_2d(\n [\n [-8.3, 6.75, -2, 5.7],\n [-0.24, 1.49, 3.5, -4.25],\n [52, 0.98, 970.6, 75000],\n [-64.3, 15.4, -84.4, -13.4],\n ]\n )\n\n\ndef sample_1d_list() -> list:\n return to_float32_1d(\n [\n 3.8,\n 0.64,\n -9.55,\n 63226,\n -0.3445,\n 9.5,\n 4.004,\n 0.115,\n 9999,\n -34,\n 14,\n 66.5,\n 87.4,\n 1.3,\n 36.2,\n 93.12,\n ]\n )\n\n\ndef test_default_init():\n assert_all_equal_flat(zivid.Matrix4x4(), [0.0] * 16)\n\n\ndef test_flat_array_init():\n assert_all_equal_flat(zivid.Matrix4x4(sample_1d_list()), sample_1d_list())\n assert_all_equal_flat(\n zivid.Matrix4x4(numpy.array(sample_1d_list())), numpy.array(sample_1d_list())\n )\n\n with pytest.raises(TypeError):\n zivid.Matrix4x4(range(42))\n\n with pytest.raises(TypeError):\n zivid.Matrix4x4(range(0))\n\n\ndef test_4x4_array_init():\n assert_all_equal_2d(zivid.Matrix4x4(sample_2d_list()), sample_2d_list())\n assert_all_equal_2d(\n zivid.Matrix4x4(sample_2d_list()), numpy.array(sample_2d_list())\n )\n\n with pytest.raises(TypeError):\n zivid.Matrix4x4([range(4), range(4, 9), range(9, 13), range(13, 17)])\n\n with pytest.raises(TypeError):\n zivid.Matrix4x4([[], range(4, 8), range(8, 12), range(12, 16)])\n\n with pytest.raises(TypeError):\n zivid.Matrix4x4([[]] * 4)\n\n\ndef test_getitem():\n matrix = zivid.Matrix4x4(sample_2d_list())\n\n for i in range(4):\n for j in range(4):\n assert matrix[i, j] == sample_2d_list()[i][j]\n\n for i in range(-4, 0):\n for j in range(-4, 0):\n assert matrix[i, j] == sample_2d_list()[i][j]\n\n with pytest.raises(TypeError):\n assert matrix[0] == 0\n\n with pytest.raises(TypeError):\n assert matrix[0, 0, 0] == 0\n\n with pytest.raises(TypeError):\n assert matrix[1.4, 1.0] == 0\n\n with pytest.raises(TypeError):\n assert matrix[\"0\", \"0\"] == 0\n\n with pytest.raises(IndexError):\n assert matrix[1000, 0] == 0\n\n with pytest.raises(IndexError):\n assert matrix[0, 1000] == 0\n\n with pytest.raises(IndexError):\n assert matrix[0, -1000] == 0\n\n\ndef test_setitem():\n matrix = zivid.Matrix4x4()\n\n for i in range(4):\n for j in range(4):\n matrix[i, j] = sample_2d_list()[i][j]\n assert matrix[i, j] == sample_2d_list()[i][j]\n\n assert_all_equal_2d(matrix, sample_2d_list())\n\n for i in range(-4, 0):\n for j in range(-4, 0):\n matrix[i, j] = sample_2d_list()[i][j]\n assert matrix[i, j] == sample_2d_list()[i][j]\n\n assert_all_equal_2d(matrix, sample_2d_list())\n\n with pytest.raises(TypeError):\n matrix[0] = 0\n\n with pytest.raises(TypeError):\n matrix[0, 0, 0] = 0\n\n with pytest.raises(TypeError):\n matrix[1.4, 1.0] = 0\n\n with pytest.raises(TypeError):\n matrix[\"0\", \"0\"] = 0\n\n with pytest.raises(TypeError):\n matrix[0, 0] = \"42\"\n\n with pytest.raises(TypeError):\n matrix[0, 0] = 10**1000\n\n with pytest.raises(IndexError):\n matrix[1000, 0] = 0\n\n with pytest.raises(IndexError):\n matrix[0, 1000] = 0\n\n with pytest.raises(IndexError):\n matrix[0, -1000] = 0\n\n\ndef test_rows_cols():\n assert zivid.Matrix4x4.rows == 4\n assert zivid.Matrix4x4.cols == 4\n assert zivid.Matrix4x4().rows == 4\n assert zivid.Matrix4x4().cols == 4\n\n with pytest.raises(AttributeError):\n zivid.Matrix4x4.rows = 3\n\n with pytest.raises(AttributeError):\n zivid.Matrix4x4.cols = 3\n\n\ndef test_inverse():\n def invertible_matrix():\n return [\n [1, 1, 1, -1],\n [1, 1, -1, 1],\n [1, -1, 1, 1],\n [-1, 1, 1, 1],\n ]\n\n def non_invertible_matrix():\n return [1] * 16\n\n matrix = zivid.Matrix4x4(invertible_matrix())\n\n assert_all_equal_2d(\n matrix.inverse(),\n [\n [0.25, 0.25, 0.25, -0.25],\n [0.25, 0.25, -0.25, 0.25],\n [0.25, -0.25, 0.25, 0.25],\n [-0.25, 0.25, 0.25, 0.25],\n ],\n )\n\n assert_all_equal_2d(matrix, invertible_matrix())\n\n matrix = zivid.Matrix4x4(non_invertible_matrix())\n\n with pytest.raises(RuntimeError):\n matrix.inverse()\n\n assert_all_equal_flat(matrix, non_invertible_matrix())\n\n\ndef test_buffer_protocol():\n numpy_array = numpy.array(zivid.Matrix4x4(sample_2d_list()))\n assert (numpy_array == sample_2d_list()).all()\n\n\ndef test_to_string():\n matrix = zivid.Matrix4x4(sample_2d_list())\n\n assert str(matrix) == (\n \"[ [-8.300000, 6.750000, -2.000000, 5.700000], \\n\"\n \" [-0.240000, 1.490000, 3.500000, -4.250000], \\n\"\n \" [ 52.000000, 0.980000, 970.599976, 75000.000000], \\n\"\n \" [-64.300003, 15.400000, -84.400002, -13.400000] ]\"\n )\n\n\ndef test_save():\n with tempfile.TemporaryDirectory() as tmpdir, zivid.Application() as _:\n file = Path(tmpdir) / \"matrix_saved.yml\"\n matrix = zivid.Matrix4x4(\n to_float32_2d(\n [\n [0.5, 1.34, -234, -3.43],\n [-4.31, 5343, 6.34, 7.12],\n [-8, -9, -10.3, 11.2],\n [1.2, 13.5, 1.4, 0.15],\n ]\n )\n )\n assert not file.exists()\n\n matrix.save(file)\n\n assert file.exists()\n\n expected_content = (\n \"FloatMatrix:\\n\"\n \" Data: [\\n\"\n \" [0.5, 1.34, -234, -3.43],\\n\"\n \" [-4.31, 5343, 6.34, 7.12],\\n\"\n \" [-8, -9, -10.3, 11.2],\\n\"\n \" [1.2, 13.5, 1.4, 0.15]]\\n\"\n )\n\n with open(file, \"r\", encoding=\"utf8\") as file:\n assert expected_content in file.read()\n\n\ndef test_load():\n with tempfile.TemporaryDirectory() as tmpdir, zivid.Application() as _:\n file = Path(tmpdir) / \"matrix_saved.yml\"\n zivid.Matrix4x4(sample_2d_list()).save(file)\n matrix = zivid.Matrix4x4()\n matrix.load(file)\n assert_all_equal_2d(matrix, sample_2d_list())\n\n\ndef test_file_init():\n with tempfile.TemporaryDirectory() as tmpdir, zivid.Application() as _:\n file = Path(tmpdir) / \"matrix_saved.yml\"\n zivid.Matrix4x4(sample_2d_list()).save(file)\n assert_all_equal_2d(zivid.Matrix4x4(file), sample_2d_list())\n\n\ndef test_implicit_convert_to_numpy():\n sample = to_float32_2d(\n [\n [1.0, 0.0, 0.0, 10.0],\n [0.0, 0.0, -1.0, 20.0],\n [0.0, 1.0, 0.0, 30.0],\n [0.0, 0.0, 0.0, 1.0],\n ]\n )\n pose1 = zivid.calibration.Pose(zivid.Matrix4x4(sample))\n pose2 = zivid.calibration.Pose(numpy.array(sample))\n\n assert_all_equal_2d(zivid.Matrix4x4(pose1.to_matrix()), pose2.to_matrix())\n" }, { "alpha_fraction": 0.727802038192749, "alphanum_fraction": 0.7307132482528687, "avg_line_length": 21.161291122436523, "blob_id": "4c7361841c1879d499636706d589bf01d0654430", "content_id": "e1eaabf4a82c9c98c8fced6785d4ce40c6de0bd5", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 687, "license_type": "permissive", "max_line_length": 75, "num_lines": 31, "path": "/test/test_samples.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "import pytest\n\n\ndef test_capture_from_file(file_camera_file):\n pytest.helpers.run_sample(\n name=\"capture_from_file\", working_directory=file_camera_file.parent\n )\n\n\ndef test_print_version_info():\n pytest.helpers.run_sample(name=\"print_version_info\")\n\n\n@pytest.mark.physical_camera\ndef test_capture():\n pytest.helpers.run_sample(name=\"capture\")\n\n\n@pytest.mark.physical_camera\ndef test_capture_2d():\n pytest.helpers.run_sample(name=\"capture_2d\")\n\n\n@pytest.mark.physical_camera\ndef test_capture_assistant():\n pytest.helpers.run_sample(name=\"capture_assistant\")\n\n\n@pytest.mark.physical_camera\ndef test_capture_hdr():\n pytest.helpers.run_sample(name=\"capture_hdr\")\n" }, { "alpha_fraction": 0.633495569229126, "alphanum_fraction": 0.636180579662323, "avg_line_length": 36.955413818359375, "blob_id": "d331a87872655ec1f07d1fbedef74adeb5b9c7b2", "content_id": "0531902f9b169be025ded477ae6ed20b3b9235af", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 5959, "license_type": "permissive", "max_line_length": 221, "num_lines": 157, "path": "/modules/zivid/_suggest_settings_parameters.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "\"\"\"Auto generated, do not edit.\"\"\"\n# pylint: disable=too-many-lines,protected-access,too-few-public-methods,too-many-arguments,line-too-long,missing-function-docstring,missing-class-docstring,redefined-builtin,too-many-branches,too-many-boolean-expressions\nimport datetime\nimport _zivid\n\n\nclass SuggestSettingsParameters:\n class AmbientLightFrequency:\n hz50 = \"hz50\"\n hz60 = \"hz60\"\n none = \"none\"\n\n _valid_values = {\n \"hz50\": _zivid.capture_assistant.SuggestSettingsParameters.AmbientLightFrequency.hz50,\n \"hz60\": _zivid.capture_assistant.SuggestSettingsParameters.AmbientLightFrequency.hz60,\n \"none\": _zivid.capture_assistant.SuggestSettingsParameters.AmbientLightFrequency.none,\n }\n\n @classmethod\n def valid_values(cls):\n return list(cls._valid_values.keys())\n\n def __init__(\n self,\n ambient_light_frequency=_zivid.capture_assistant.SuggestSettingsParameters.AmbientLightFrequency().value,\n max_capture_time=_zivid.capture_assistant.SuggestSettingsParameters.MaxCaptureTime().value,\n ):\n if isinstance(\n ambient_light_frequency,\n _zivid.capture_assistant.SuggestSettingsParameters.AmbientLightFrequency.enum,\n ):\n self._ambient_light_frequency = _zivid.capture_assistant.SuggestSettingsParameters.AmbientLightFrequency(\n ambient_light_frequency\n )\n elif isinstance(ambient_light_frequency, str):\n self._ambient_light_frequency = _zivid.capture_assistant.SuggestSettingsParameters.AmbientLightFrequency(\n self.AmbientLightFrequency._valid_values[ambient_light_frequency]\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: str, got {value_type}\".format(\n value_type=type(ambient_light_frequency)\n )\n )\n\n if isinstance(max_capture_time, (datetime.timedelta,)):\n self._max_capture_time = (\n _zivid.capture_assistant.SuggestSettingsParameters.MaxCaptureTime(\n max_capture_time\n )\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: (datetime.timedelta,), got {value_type}\".format(\n value_type=type(max_capture_time)\n )\n )\n\n @property\n def ambient_light_frequency(self):\n if self._ambient_light_frequency.value is None:\n return None\n for key, internal_value in self.AmbientLightFrequency._valid_values.items():\n if internal_value == self._ambient_light_frequency.value:\n return key\n raise ValueError(\n \"Unsupported value {value}\".format(value=self._ambient_light_frequency)\n )\n\n @property\n def max_capture_time(self):\n return self._max_capture_time.value\n\n @ambient_light_frequency.setter\n def ambient_light_frequency(self, value):\n if isinstance(value, str):\n self._ambient_light_frequency = _zivid.capture_assistant.SuggestSettingsParameters.AmbientLightFrequency(\n self.AmbientLightFrequency._valid_values[value]\n )\n elif isinstance(\n value,\n _zivid.capture_assistant.SuggestSettingsParameters.AmbientLightFrequency.enum,\n ):\n self._ambient_light_frequency = _zivid.capture_assistant.SuggestSettingsParameters.AmbientLightFrequency(\n value\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: str, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n @max_capture_time.setter\n def max_capture_time(self, value):\n if isinstance(value, (datetime.timedelta,)):\n self._max_capture_time = (\n _zivid.capture_assistant.SuggestSettingsParameters.MaxCaptureTime(value)\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: datetime.timedelta, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n @classmethod\n def load(cls, file_name):\n return _to_capture_assistant_suggest_settings_parameters(\n _zivid.capture_assistant.SuggestSettingsParameters(str(file_name))\n )\n\n def save(self, file_name):\n _to_internal_capture_assistant_suggest_settings_parameters(self).save(\n str(file_name)\n )\n\n def __eq__(self, other):\n if (\n self._ambient_light_frequency == other._ambient_light_frequency\n and self._max_capture_time == other._max_capture_time\n ):\n return True\n return False\n\n def __str__(self):\n return str(_to_internal_capture_assistant_suggest_settings_parameters(self))\n\n\ndef _to_capture_assistant_suggest_settings_parameters(\n internal_suggest_settings_parameters,\n):\n return SuggestSettingsParameters(\n ambient_light_frequency=internal_suggest_settings_parameters.ambient_light_frequency.value,\n max_capture_time=internal_suggest_settings_parameters.max_capture_time.value,\n )\n\n\ndef _to_internal_capture_assistant_suggest_settings_parameters(\n suggest_settings_parameters,\n):\n internal_suggest_settings_parameters = (\n _zivid.capture_assistant.SuggestSettingsParameters()\n )\n\n internal_suggest_settings_parameters.ambient_light_frequency = (\n _zivid.capture_assistant.SuggestSettingsParameters.AmbientLightFrequency(\n suggest_settings_parameters._ambient_light_frequency.value\n )\n )\n internal_suggest_settings_parameters.max_capture_time = (\n _zivid.capture_assistant.SuggestSettingsParameters.MaxCaptureTime(\n suggest_settings_parameters.max_capture_time\n )\n )\n\n return internal_suggest_settings_parameters\n" }, { "alpha_fraction": 0.6615853905677795, "alphanum_fraction": 0.6859756112098694, "avg_line_length": 35.44444274902344, "blob_id": "c68223754d457c94689cac1a55fff59506c839de", "content_id": "57fa0836abb38a01a752b5327be22dfc5314011d", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 656, "license_type": "permissive", "max_line_length": 81, "num_lines": 18, "path": "/src/ReleasableFrame2D.cpp", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "#include <ZividPython/ReleasableFrame2D.h>\n\n#include <pybind11/pybind11.h>\n\nnamespace py = pybind11;\n\nnamespace ZividPython\n{\n void wrapClass(pybind11::class_<ReleasableFrame2D> pyClass)\n {\n pyClass.def_property_readonly(\"settings\", &ReleasableFrame2D::settings)\n .def_property_readonly(\"state\", &ReleasableFrame2D::state)\n .def_property_readonly(\"info\", &ReleasableFrame2D::info)\n .def_property_readonly(\"camera_info\", &ReleasableFrame2D::cameraInfo)\n .def(\"image_rgba\", &ReleasableFrame2D::imageRGBA)\n .def(\"image_bgra\", &ReleasableFrame2D::imageBGRA);\n }\n} // namespace ZividPython\n" }, { "alpha_fraction": 0.6630855202674866, "alphanum_fraction": 0.6646203398704529, "avg_line_length": 33.689815521240234, "blob_id": "316b50605bf20d6735263a5e722e0f5e72ce87e9", "content_id": "7394cdc2efc4a0ad06c38f43b85572f861111baf", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 14986, "license_type": "permissive", "max_line_length": 127, "num_lines": 432, "path": "/modules/zivid/experimental/calibration.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "\"\"\"Module for experimental calibration features. This API may change in the future.\"\"\"\n\nimport _zivid\nfrom zivid.calibration import DetectionResult\nfrom zivid.camera_intrinsics import _to_camera_intrinsics\nfrom zivid.settings import Settings, _to_internal_settings\nfrom zivid.settings_2d import Settings2D, _to_internal_settings2d\n\n\ndef intrinsics(camera, settings=None):\n \"\"\"Get intrinsic parameters of a given camera and settings (3D or 2D).\n\n These intrinsic parameters take into account the expected resolution of the point clouds captured\n with the given settings. If settings are not provided, intrinsics appropriate for the camera's\n default 3D capture settings is returned.\n\n Args:\n camera: A Camera instance\n settings: Settings or Settings2D to be used to get correct intrinsics (optional)\n\n Returns:\n A CameraIntrinsics instance\n\n Raises:\n TypeError: If settings argument is not Settings or Settings2D\n \"\"\"\n if settings is None:\n return _to_camera_intrinsics(\n _zivid.calibration.intrinsics(\n camera._Camera__impl # pylint: disable=protected-access\n )\n )\n if isinstance(settings, Settings):\n return _to_camera_intrinsics(\n _zivid.calibration.intrinsics(\n camera._Camera__impl, # pylint: disable=protected-access\n _to_internal_settings(settings),\n )\n )\n if isinstance(settings, Settings2D):\n return _to_camera_intrinsics(\n _zivid.calibration.intrinsics(\n camera._Camera__impl, # pylint: disable=protected-access\n _to_internal_settings2d(settings),\n )\n )\n raise TypeError(\n \"Unsupported type for argument settings. Got {}, expected Settings or Settings2D.\".format(\n type(settings)\n )\n )\n\n\ndef estimate_intrinsics(frame):\n \"\"\"Estimate camera intrinsics for a given frame.\n\n This function is for advanced use cases. Otherwise, use intrinsics(camera).\n\n Args:\n frame: A Frame instance\n\n Returns:\n A CameraIntrinsics instance\n \"\"\"\n return _to_camera_intrinsics(\n _zivid.calibration.estimate_intrinsics(\n frame._Frame__impl # pylint: disable=protected-access\n )\n )\n\n\ndef detect_feature_points(camera):\n \"\"\"Detect feature points from a calibration object.\n\n Using this version of the detectFeaturePoints function is necessary to\n ensure that the data quality is sufficient for use in in-field verification\n and correction.\n\n The functionality is to be exclusively used in combination with Zivid\n verified checkerboards.\n\n Args:\n camera: A Camera that is pointing at a calibration checkerboard.\n\n Returns:\n A DetectionResult instance.\n \"\"\"\n return DetectionResult(\n _zivid.infield_correction.detect_feature_points_infield(\n camera._Camera__impl # pylint: disable=protected-access\n )\n )\n\n\ndef verify_camera(infield_correction_input):\n \"\"\"Verify the current camera trueness based on a single measurement.\n\n The purpose of this function is to allow quick assessment of the quality of\n the in-field correction on a camera (or the need for one if none exists\n already). This function will throw an exception if any of the provided\n InfieldCorrectionInput have valid()==False.\n\n The return value of this function will give an indication of the dimension\n trueness at the location where the input data was captured. If the returned\n assessment indicates a trueness error that is above threshold for your\n application, consider using compute_camera_correction in order to get an\n updated correction for the camera.\n\n Args:\n infield_correction_input: An InfieldCorrectionInput instance.\n\n Returns:\n A CameraVerification instance.\n \"\"\"\n return CameraVerification(\n _zivid.infield_correction.verify_camera(\n infield_correction_input._InfieldCorrectionInput__impl # pylint: disable=protected-access\n )\n )\n\n\ndef compute_camera_correction(dataset):\n \"\"\"Calculate new in-field camera correction.\n\n The purpose of this function is to calculate a new in-field correction for a\n camera based on a series of calibration object captures taken at varying\n distances. This function will throw an exception if any of the provided\n InfieldCorrectionInput have valid()==False.\n\n The quantity and range of data is up to the user, but generally a larger\n dataset will yield a more accurate and reliable correction. If all\n measurements were taken at approximately the same distance, the resulting\n correction will mainly be valid at those distances. If several measurements\n were taken at significantly different distances, the resulting correction\n will likely be more suitable for extrapolation to distances beyond where the\n dataset was collected.\n\n The result of this process is a CameraCorrection object, which will contain\n information regarding the proposed working range and the accuracy that can\n be expected within the working range, if the correction is written to the\n camera. The correction may be written to the camera using\n writeCameraCorrection.\n\n This function will throw an exception if the input data is extremely\n inconsistent/noisy.\n\n Args:\n dataset: A list of InfieldCorrectionInput instances.\n\n Returns:\n A CameraCorrection instance.\n \"\"\"\n return CameraCorrection(\n _zivid.infield_correction.compute_camera_correction(\n [\n infield_correction_input._InfieldCorrectionInput__impl # pylint: disable=protected-access\n for infield_correction_input in dataset\n ]\n )\n )\n\n\ndef write_camera_correction(camera, camera_correction):\n \"\"\"Write the in-field correction on a camera.\n\n After calling this function, the given correction will automatically be used\n any time the capture function is called on this camera. The correction will\n be persisted on the camera even though the camera is power-cycled or\n connected to a different PC.\n\n Beware that calling this will overwrite any existing correction present on\n the camera.\n\n Args:\n camera: The Camera to write the correction to.\n camera_correction: The CameraCorrection instance to write to the camera.\n \"\"\"\n _zivid.infield_correction.write_camera_correction(\n camera._Camera__impl, # pylint: disable=protected-access\n camera_correction._CameraCorrection__impl, # pylint: disable=protected-access\n )\n\n\ndef reset_camera_correction(camera):\n \"\"\"Reset the in-field correction on a camera to factory settings.\n\n Args:\n camera: The Camera to reset.\n \"\"\"\n _zivid.infield_correction.reset_camera_correction(\n camera._Camera__impl # pylint: disable=protected-access\n )\n\n\ndef has_camera_correction(camera):\n \"\"\"Check if the camera has an in-field correction written to it.\n\n This is false if write_camera_correction has never been called using this\n camera. It will also be false after calling reset_camera_correction.\n\n Args:\n camera: The Camera to check.\n\n Returns:\n Boolean indicating whether or not the camera has an in-field correction.\n \"\"\"\n return _zivid.infield_correction.has_camera_correction(\n camera._Camera__impl # pylint: disable=protected-access\n )\n\n\ndef camera_correction_timestamp(camera):\n \"\"\"Get the time at which the camera's in-field correction was created.\n\n Args:\n camera: The Camera to check.\n\n Returns:\n A timestamp indicating when the correction was created.\n \"\"\"\n\n return _zivid.infield_correction.camera_correction_timestamp(\n camera._Camera__impl # pylint: disable=protected-access\n )\n\n\nclass InfieldCorrectionInput:\n \"\"\"Container for input-data needed by in-field verification and correction functions.\"\"\"\n\n def __init__(self, detection_result):\n \"\"\"Construct an InfieldCorrectionInput instance.\n\n Input data should be captured by calling the version of detect_feature_points that\n takes a Camera argument.\n\n Args:\n detection_result: A DetectionResult instance\n\n Raises:\n TypeError: If one of the input arguments are of the wrong type\n \"\"\"\n if not isinstance(detection_result, DetectionResult):\n raise TypeError(\n \"Unsupported type for argument detection_result. Expected zivid.calibration.DetectionResult but got {}\".format(\n type(detection_result)\n )\n )\n self.__impl = _zivid.infield_correction.InfieldCorrectionInput(\n detection_result._DetectionResult__impl, # pylint: disable=protected-access\n )\n\n def detection_result(self):\n \"\"\"Get the contained DetectionResult.\n\n Returns:\n A DetectionResult instance\n \"\"\"\n return DetectionResult(self.__impl.detection_result())\n\n def valid(self):\n \"\"\"Check if this object is valid for use with in-field correction.\n\n Returns:\n True if InfieldCorrectionInput is valid\n \"\"\"\n return self.__impl.valid()\n\n def status_description(self):\n \"\"\"Get a string describing the status of this input object.\n\n Mostly used to figure out why valid() is False.\n\n Returns:\n A human-readable string describing the status.\n \"\"\"\n return self.__impl.status_description()\n\n def __bool__(self):\n return self.valid()\n\n def __str__(self):\n return str(self.__impl)\n\n\nclass CameraVerification:\n \"\"\"An assessment of the current dimension trueness of a camera at a specific location.\"\"\"\n\n def __init__(self, impl):\n \"\"\"Initialize CameraVerification wrapper.\n\n This constructor is only used internally, and should not be called by the end-user.\n\n Args:\n impl: Reference to internal/back-end instance.\n\n Raises:\n TypeError: If argument does not match the expected internal class.\n \"\"\"\n if not isinstance(impl, _zivid.infield_correction.CameraVerification):\n raise TypeError(\n \"Unsupported type for argument impl. Got {}, expected {}\".format(\n type(impl), type(_zivid.infield_correction.CameraVerification)\n )\n )\n self.__impl = impl\n\n def local_dimension_trueness(self):\n \"\"\"Get the estimated local dimension trueness.\n\n The dimension trueness represents the relative deviation between the\n measured size of the calibration object and the true size of the\n calibration object, including the effects of any in-field correction\n stored on the camera at the time of capture. Note that this estimate is\n local, i.e. only valid for the region of space very close to the\n calibration object.\n\n The returned value is a fraction (relative trueness error). Multiply by\n 100 to get trueness in percent.\n\n Returns:\n Estimated local dimension trueness.\n \"\"\"\n return self.__impl.local_dimension_trueness()\n\n def position(self):\n \"\"\"Get the location at which the measurement was made.\n\n Returns:\n Location (XYZ) in the camera reference frame.\n \"\"\"\n return self.__impl.position()\n\n def __str__(self):\n return str(self.__impl)\n\n\nclass AccuracyEstimate:\n \"\"\"A dimension accuracy estimate for a specific working volume.\"\"\"\n\n def __init__(self, impl):\n \"\"\"Initialize AccuracyEstimate wrapper.\n\n This constructor is only used internally, and should not be called by the end-user.\n\n Args:\n impl: Reference to internal/back-end instance.\n\n Raises:\n TypeError: If argument does not match the expected internal class.\n \"\"\"\n if not isinstance(impl, _zivid.infield_correction.AccuracyEstimate):\n raise TypeError(\n \"Unsupported type for argument impl. Got {}, expected {}\".format(\n type(impl), type(_zivid.infield_correction.AccuracyEstimate)\n )\n )\n self.__impl = impl\n\n def dimension_accuracy(self):\n \"\"\"Get the estimated dimension accuracy obtained if the correction is applied.\n\n This number represents a 1-sigma (68% confidence) upper bound for\n dimension trueness error in the working volume (z=zMin() to z=zMax(),\n across the entire field of view). In other words, it represents the\n expected distribution of local dimension trueness measurements (see\n CameraVerification) that can be expected if measuring throughout the\n working volume.\n\n The returned value is a fraction (relative trueness error). Multiply by\n 100 to get trueness in percent.\n\n Note that the accuracy close to where the original data was captured is\n likely much better than what is implied by this number. This number is\n rather an accuracy estimate for the entire extrapolated working volume.\n\n Returns:\n A 1-sigma (68% confidence) upper bound for trueness error in the working volume.\n \"\"\"\n return self.__impl.dimension_accuracy()\n\n def z_min(self):\n \"\"\"Get the range of validity of the accuracy estimate (lower end).\n\n Returns:\n Minimum z-value of working volume in millimeters.\n \"\"\"\n return self.__impl.z_min()\n\n def z_max(self):\n \"\"\"Get the range of validity of the accuracy estimate (upper end).\n\n Returns:\n Maximum z-value of working volume in millimeters.\n \"\"\"\n return self.__impl.z_max()\n\n def __str__(self):\n return str(self.__impl)\n\n\nclass CameraCorrection:\n \"\"\"An in-field correction that may be written to a camera.\"\"\"\n\n def __init__(self, impl):\n \"\"\"Initialize CameraCorrection wrapper.\n\n This constructor is only used internally, and should not be called by the end-user.\n\n Args:\n impl: Reference to internal/back-end instance.\n\n Raises:\n TypeError: If argument does not match the expected internal class.\n \"\"\"\n if not isinstance(impl, _zivid.infield_correction.CameraCorrection):\n raise TypeError(\n \"Unsupported type for argument impl. Got {}, expected {}\".format(\n type(impl), type(_zivid.infield_correction.CameraCorrection)\n )\n )\n self.__impl = impl\n\n def accuracy_estimate(self):\n \"\"\"Get an estimate for expected dimension accuracy if the correction is applied to the camera.\n\n Returns:\n An AccuracyEstimate instance.\n \"\"\"\n return AccuracyEstimate(self.__impl.accuracy_estimate())\n\n def __str__(self):\n return str(self.__impl)\n" }, { "alpha_fraction": 0.6256198287010193, "alphanum_fraction": 0.6388429999351501, "avg_line_length": 30.05128288269043, "blob_id": "107190981786c2bef8b62a20ada4db98e8fd3980", "content_id": "5961650bbc3387d763e8509ca585ff34e50a2a33", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Shell", "length_bytes": 1210, "license_type": "permissive", "max_line_length": 162, "num_lines": 39, "path": "/continuous-integration/linux/platform-dependent/ubuntu-22.04/setup.sh", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "#!/bin/bash\n\nexport DEBIAN_FRONTEND=noninteractive\nSCRIPT_DIR=\"$(realpath $(cd \"$(dirname \"${BASH_SOURCE[0]}\")\" && pwd) )\"\n\nfunction apt-yes {\n apt-get --assume-yes \"$@\"\n}\n\napt-yes update || exit $?\napt-yes dist-upgrade || exit $?\n\napt-yes install \\\n clinfo \\\n g++ \\\n jq \\\n python3-dev \\\n python3-venv \\\n python3-pip \\\n wget \\\n || exit $?\n\nupdate-alternatives --install /usr/bin/python python /usr/bin/python3 0 || exit $?\nupdate-alternatives --install /usr/bin/pip pip /usr/bin/pip3 0 || exit $?\n\nsource $(realpath $SCRIPT_DIR/../common.sh) || exit $?\nubuntu_install_opencl_cpu_runtime || exit $?\n\nfunction install_www_deb {\n TMP_DIR=$(mktemp --tmpdir --directory zivid-python-install-www-deb-XXXX) || exit $?\n pushd $TMP_DIR || exit $?\n wget -nv \"$@\" || exit $?\n apt-yes install --fix-broken ./*deb || exit $?\n popd || exit $?\n rm -r $TMP_DIR || exit $?\n}\n\ninstall_www_deb \"https://downloads.zivid.com/sdk/releases/${ZIVID_SDK_EXACT_VERSION}/u22/zivid-telicam-driver_${ZIVID_TELICAM_EXACT_VERSION}_amd64.deb\" || exit $?\ninstall_www_deb \"https://downloads.zivid.com/sdk/releases/${ZIVID_SDK_EXACT_VERSION}/u22/zivid_${ZIVID_SDK_EXACT_VERSION}_amd64.deb\" || exit $?" }, { "alpha_fraction": 0.6173059940338135, "alphanum_fraction": 0.6262266039848328, "avg_line_length": 37.655174255371094, "blob_id": "209f23cbdc87a964637ca839191baa768e1e74d0", "content_id": "60957cc90d8903704b39c9f26bcfb3bb605d294b", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 1121, "license_type": "permissive", "max_line_length": 120, "num_lines": 29, "path": "/src/ReleasableCamera.cpp", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "#include <ZividPython/ReleasableCamera.h>\n#include <ZividPython/ReleasableFrame.h>\n\n#include <pybind11/pybind11.h>\n\n#include <variant>\n#include <vector>\n\nnamespace py = pybind11;\n\nnamespace ZividPython\n{\n void wrapClass(pybind11::class_<ReleasableCamera> pyClass)\n {\n pyClass.def(py::init())\n .def(py::self == py::self) // NOLINT\n .def(py::self != py::self) // NOLINT\n .def(\"disconnect\", &ReleasableCamera::disconnect)\n .def(\"connect\", &ReleasableCamera::connect)\n .def(\"capture\", py::overload_cast<const Zivid::Settings &>(&ReleasableCamera::capture), py::arg(\"settings\"))\n .def(\"capture\",\n py::overload_cast<const Zivid::Settings2D &>(&ReleasableCamera::capture),\n py::arg(\"settings_2d\"))\n .def_property_readonly(\"state\", &ReleasableCamera::state)\n .def_property_readonly(\"info\", &ReleasableCamera::info)\n .def(\"write_user_data\", &ReleasableCamera::writeUserData)\n .def_property_readonly(\"user_data\", &ReleasableCamera::userData);\n }\n} // namespace ZividPython\n" }, { "alpha_fraction": 0.7438869476318359, "alphanum_fraction": 0.7556602358818054, "avg_line_length": 36.815067291259766, "blob_id": "b51bd595ed594909923389b9eb92a73899c8c338", "content_id": "638be2f748bae0ca90a93b2179d8cb590674eef0", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 5521, "license_type": "permissive", "max_line_length": 89, "num_lines": 146, "path": "/test/test_capture_assistant.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "import pytest\n\n\ndef test_ambient_light_frequency():\n from zivid.capture_assistant import SuggestSettingsParameters\n\n assert str(SuggestSettingsParameters.AmbientLightFrequency.hz50) == \"hz50\"\n assert str(SuggestSettingsParameters.AmbientLightFrequency.hz60) == \"hz60\"\n assert str(SuggestSettingsParameters.AmbientLightFrequency.none) == \"none\"\n\n assert SuggestSettingsParameters.AmbientLightFrequency.hz50 == \"hz50\"\n assert SuggestSettingsParameters.AmbientLightFrequency.hz60 == \"hz60\"\n assert SuggestSettingsParameters.AmbientLightFrequency.none == \"none\"\n\n\ndef test_suggest_settings_parameters():\n import datetime\n from zivid.capture_assistant import SuggestSettingsParameters\n\n # Use constructor\n suggest_settings_parameters = SuggestSettingsParameters(\n max_capture_time=datetime.timedelta(milliseconds=1200),\n ambient_light_frequency=SuggestSettingsParameters.AmbientLightFrequency.hz50,\n )\n assert isinstance(suggest_settings_parameters.max_capture_time, datetime.timedelta)\n assert suggest_settings_parameters.max_capture_time == datetime.timedelta(\n seconds=1.2\n )\n assert isinstance(suggest_settings_parameters.ambient_light_frequency, str)\n assert (\n suggest_settings_parameters.ambient_light_frequency\n == SuggestSettingsParameters.AmbientLightFrequency.hz50\n )\n\n # Use setters\n new_time = datetime.timedelta(milliseconds=1800)\n new_freq = \"hz60\"\n suggest_settings_parameters.max_capture_time = new_time\n assert isinstance(suggest_settings_parameters.max_capture_time, datetime.timedelta)\n assert suggest_settings_parameters.max_capture_time == new_time\n suggest_settings_parameters.ambient_light_frequency = new_freq\n assert isinstance(suggest_settings_parameters.ambient_light_frequency, str)\n assert suggest_settings_parameters.ambient_light_frequency == new_freq\n\n\ndef test_suggest_settings_throws_if_budget_outside_range():\n import datetime\n from zivid.capture_assistant import SuggestSettingsParameters\n\n # too small\n with pytest.raises(IndexError):\n SuggestSettingsParameters(\n max_capture_time=datetime.timedelta(milliseconds=100),\n ambient_light_frequency=SuggestSettingsParameters.AmbientLightFrequency.hz50,\n )\n # too big\n with pytest.raises(IndexError):\n SuggestSettingsParameters(\n max_capture_time=datetime.timedelta(milliseconds=60000)\n )\n\n\ndef test_init_max_capture_time():\n import datetime\n from zivid.capture_assistant import SuggestSettingsParameters\n\n suggested_settings = SuggestSettingsParameters(\n max_capture_time=datetime.timedelta(milliseconds=1000)\n )\n max_capture_time = suggested_settings.max_capture_time\n assert max_capture_time is not None\n assert isinstance(max_capture_time, datetime.timedelta)\n assert max_capture_time == datetime.timedelta(milliseconds=1000)\n\n\ndef test_default_ambient_light_frequency():\n import datetime\n from zivid.capture_assistant import SuggestSettingsParameters\n\n suggested_settings = SuggestSettingsParameters(\n max_capture_time=datetime.timedelta(milliseconds=250)\n )\n ambient_light_frequency = suggested_settings.ambient_light_frequency\n assert ambient_light_frequency is not None\n assert isinstance(ambient_light_frequency, str)\n assert (\n ambient_light_frequency == SuggestSettingsParameters.AmbientLightFrequency.none\n )\n\n\ndef test_set_ambient_light_frequency():\n from zivid.capture_assistant import SuggestSettingsParameters\n\n suggested_settings = SuggestSettingsParameters()\n\n suggested_settings.ambient_light_frequency = (\n SuggestSettingsParameters.AmbientLightFrequency.hz50\n )\n assert (\n suggested_settings.ambient_light_frequency\n == SuggestSettingsParameters.AmbientLightFrequency.hz50\n )\n assert suggested_settings.ambient_light_frequency == \"hz50\"\n assert isinstance(suggested_settings.ambient_light_frequency, str)\n\n suggested_settings.ambient_light_frequency = (\n SuggestSettingsParameters.AmbientLightFrequency.hz60\n )\n assert (\n suggested_settings.ambient_light_frequency\n == SuggestSettingsParameters.AmbientLightFrequency.hz60\n )\n assert suggested_settings.ambient_light_frequency == \"hz60\"\n assert isinstance(suggested_settings.ambient_light_frequency, str)\n\n suggested_settings.ambient_light_frequency = (\n SuggestSettingsParameters.AmbientLightFrequency.none\n )\n assert (\n suggested_settings.ambient_light_frequency\n == SuggestSettingsParameters.AmbientLightFrequency.none\n )\n assert suggested_settings.ambient_light_frequency == \"none\"\n assert isinstance(suggested_settings.ambient_light_frequency, str)\n\n # AmbientLightFrequency enum is not optional, so should throw if given None\n with pytest.raises(TypeError):\n suggested_settings.ambient_light_frequency = None\n with pytest.raises(TypeError):\n SuggestSettingsParameters(ambient_light_frequency=None)\n\n\ndef test_suggest_settings_str():\n from zivid.capture_assistant import SuggestSettingsParameters\n\n string = str(SuggestSettingsParameters())\n assert string is not None\n assert isinstance(string, str)\n\n\ndef test_ambient_light_frequency_str():\n from zivid.capture_assistant import SuggestSettingsParameters\n\n string = str(SuggestSettingsParameters().ambient_light_frequency)\n assert string is not None\n assert isinstance(string, str)\n" }, { "alpha_fraction": 0.5830618739128113, "alphanum_fraction": 0.5877998471260071, "avg_line_length": 40.69135665893555, "blob_id": "f70c9d8894755135f4324f864890baab188c80a1", "content_id": "aa69157e6b150e4b8cd5f041422464fb5bca7b8c", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 3377, "license_type": "permissive", "max_line_length": 91, "num_lines": 81, "path": "/src/ReleasableImage.cpp", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "#include <ZividPython/ReleasableImage.h>\n\n#include <pybind11/pybind11.h>\n\nnamespace py = pybind11;\n\nnamespace\n{\n py::buffer_info imageRGBADataBuffer(ZividPython::ReleasableImageRGBA &image)\n {\n using WrapperType = uint8_t;\n using NativeType = Zivid::ColorRGBA;\n\n constexpr py::ssize_t dim = 3;\n constexpr py::ssize_t depth = 4;\n constexpr py::ssize_t dataSize = sizeof(WrapperType);\n\n static_assert(dataSize * depth == sizeof(NativeType));\n static_assert(std::is_same_v<WrapperType, decltype(NativeType::r)>);\n static_assert(std::is_same_v<WrapperType, decltype(NativeType::g)>);\n static_assert(std::is_same_v<WrapperType, decltype(NativeType::b)>);\n static_assert(std::is_same_v<WrapperType, decltype(NativeType::a)>);\n\n auto *dataPtr = static_cast<void *>(const_cast<NativeType *>(image.impl().data()));\n const auto height = static_cast<py::ssize_t>(image.impl().height());\n const auto width = static_cast<py::ssize_t>(image.impl().width());\n\n return py::buffer_info{ dataPtr,\n dataSize,\n py::format_descriptor<WrapperType>::format(),\n dim,\n { height, width, depth },\n { dataSize * width * depth, dataSize * depth, dataSize } };\n }\n\n py::buffer_info imageBGRADataBuffer(ZividPython::ReleasableImageBGRA &image)\n {\n using WrapperType = uint8_t;\n using NativeType = Zivid::ColorBGRA;\n\n constexpr py::ssize_t dim = 3;\n constexpr py::ssize_t depth = 4;\n constexpr py::ssize_t dataSize = sizeof(WrapperType);\n\n static_assert(dataSize * depth == sizeof(NativeType));\n static_assert(std::is_same_v<WrapperType, decltype(NativeType::b)>);\n static_assert(std::is_same_v<WrapperType, decltype(NativeType::g)>);\n static_assert(std::is_same_v<WrapperType, decltype(NativeType::r)>);\n static_assert(std::is_same_v<WrapperType, decltype(NativeType::a)>);\n\n auto *dataPtr = static_cast<void *>(const_cast<NativeType *>(image.impl().data()));\n const auto height = static_cast<py::ssize_t>(image.impl().height());\n const auto width = static_cast<py::ssize_t>(image.impl().width());\n\n return py::buffer_info{ dataPtr,\n dataSize,\n py::format_descriptor<WrapperType>::format(),\n dim,\n { height, width, depth },\n { dataSize * width * depth, dataSize * depth, dataSize } };\n }\n} // namespace\n\nnamespace ZividPython\n{\n void wrapClass(pybind11::class_<ReleasableImageRGBA> pyClass)\n {\n pyClass.def_buffer(imageRGBADataBuffer)\n .def(\"save\", &ReleasableImageRGBA::save, py::arg(\"file_name\"))\n .def(\"width\", &ReleasableImageRGBA::width)\n .def(\"height\", &ReleasableImageRGBA::height);\n }\n\n void wrapClass(pybind11::class_<ReleasableImageBGRA> pyClass)\n {\n pyClass.def_buffer(imageBGRADataBuffer)\n .def(\"save\", &ReleasableImageBGRA::save, py::arg(\"file_name\"))\n .def(\"width\", &ReleasableImageBGRA::width)\n .def(\"height\", &ReleasableImageBGRA::height);\n }\n} // namespace ZividPython\n" }, { "alpha_fraction": 0.7792022824287415, "alphanum_fraction": 0.7934473156929016, "avg_line_length": 40.29411697387695, "blob_id": "736089f885ab02af29c0eef46900b145cddf219a", "content_id": "baf982d4f03e8619b1d1b5d4cb1fad0be09a3582", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 702, "license_type": "permissive", "max_line_length": 103, "num_lines": 17, "path": "/src/include/ZividPython/InfieldCorrection/InfieldCorrection.h", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "#pragma once\n\n#include <Zivid/Experimental/Calibration/InfieldCorrection.h>\n#include <ZividPython/Wrappers.h>\n\nnamespace ZividPython::InfieldCorrection\n{\n void wrapAsSubmodule(pybind11::module &dest);\n} // namespace ZividPython::InfieldCorrection\n\nnamespace ZividPython\n{\n void wrapClass(pybind11::class_<Zivid::Experimental::Calibration::InfieldCorrectionInput> pyClass);\n void wrapClass(pybind11::class_<Zivid::Experimental::Calibration::CameraVerification> pyClass);\n void wrapClass(pybind11::class_<Zivid::Experimental::Calibration::AccuracyEstimate> pyClass);\n void wrapClass(pybind11::class_<Zivid::Experimental::Calibration::CameraCorrection> pyClass);\n} // namespace ZividPython\n" }, { "alpha_fraction": 0.7237353920936584, "alphanum_fraction": 0.725680947303772, "avg_line_length": 27.55555534362793, "blob_id": "93ebebae497f3756e14b0627ae5bf1b2f88ad208", "content_id": "f55586ef2aa53bd6a6ae0895134a340748e16f4e", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 514, "license_type": "permissive", "max_line_length": 62, "num_lines": 18, "path": "/test/test_versioning.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "def _is_version(sut):\n return isinstance(sut, str) and len(sut) > 0\n\n\ndef test_module_version():\n import zivid\n\n assert _is_version(zivid.__version__)\n\n\ndef test_sdk_version():\n import zivid\n\n assert _is_version(zivid.sdk_version.SDKVersion.full)\n assert isinstance(zivid.sdk_version.SDKVersion.major, int)\n assert isinstance(zivid.sdk_version.SDKVersion.minor, int)\n assert isinstance(zivid.sdk_version.SDKVersion.patch, int)\n assert isinstance(zivid.sdk_version.SDKVersion.build, str)\n" }, { "alpha_fraction": 0.588652491569519, "alphanum_fraction": 0.5896656513214111, "avg_line_length": 23.073171615600586, "blob_id": "17809e832c2048a9a462b96a9eb384a0be90ab18", "content_id": "9d92f4b905de1545b47941c3a7b8f863aa34adde", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 987, "license_type": "permissive", "max_line_length": 76, "num_lines": 41, "path": "/continuous-integration/windows/test.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "import winreg # pylint: disable=import-error\nfrom os import environ\nfrom common import repo_root, run_process, install_pip_dependencies\n\n\ndef _read_sys_env(environement_variable_name):\n key = winreg.CreateKey(\n winreg.HKEY_LOCAL_MACHINE,\n r\"System\\CurrentControlSet\\Control\\Session Manager\\Environment\",\n )\n return winreg.QueryValueEx(key, environement_variable_name)[0]\n\n\ndef _test(root):\n environment = environ.copy()\n sys_path_key = \"PATH\"\n sys_path_value = _read_sys_env(sys_path_key)\n environment[sys_path_key] = sys_path_value\n run_process(\n (\n \"python\",\n \"-m\",\n \"pytest\",\n str(root),\n \"-c\",\n str(root / \"pytest.ini\"),\n ),\n env=environment,\n )\n\n\ndef _main():\n root = repo_root()\n install_pip_dependencies(\n root / \"continuous-integration\" / \"python-requirements\" / \"test.txt\"\n )\n _test(root)\n\n\nif __name__ == \"__main__\":\n _main()\n" }, { "alpha_fraction": 0.6902595162391663, "alphanum_fraction": 0.7108190059661865, "avg_line_length": 35.182926177978516, "blob_id": "fc08000f193e23f9178e6cfa3602001b1fe38dc6", "content_id": "34ead58e366289eaaa6a618b976d0c3e45aef24e", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2967, "license_type": "permissive", "max_line_length": 85, "num_lines": 82, "path": "/test/test_projection.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "import pytest\n\n\n@pytest.mark.physical_camera\ndef test_projector_resolution(physical_camera):\n from zivid.experimental.projection import projector_resolution\n\n res = projector_resolution(camera=physical_camera)\n assert isinstance(res, tuple)\n assert len(res) == 2\n assert isinstance(res[0], int)\n assert isinstance(res[1], int)\n\n\n@pytest.mark.physical_camera\ndef test_show_image_bgra(physical_camera):\n from zivid.experimental.projection import (\n ProjectedImage,\n projector_resolution,\n show_image_bgra,\n )\n import numpy as np\n\n # Exception if wrong image resolution\n bgra_wrong_resolution = np.zeros((10, 10, 4), dtype=np.uint8)\n with pytest.raises(RuntimeError):\n show_image_bgra(camera=physical_camera, image_bgra=bgra_wrong_resolution)\n\n # Make image with correct resolution\n res = projector_resolution(camera=physical_camera)\n bgra = 255 * np.ones((res[0], res[1], 4))\n\n # Project (with context manager)\n with show_image_bgra(camera=physical_camera, image_bgra=bgra) as projected_image:\n assert isinstance(projected_image, ProjectedImage)\n assert projected_image.active()\n assert str(projected_image) == \"Active: true\"\n\n # Project (without context manager)\n projected_image = show_image_bgra(camera=physical_camera, image_bgra=bgra)\n assert isinstance(projected_image, ProjectedImage)\n assert projected_image.active()\n assert str(projected_image) == \"Active: true\"\n projected_image.stop()\n assert not projected_image.active()\n assert str(projected_image) == \"Active: false\"\n\n\n@pytest.mark.physical_camera\ndef test_capture_while_projecting(physical_camera):\n from zivid import Frame2D, Settings2D\n from zivid.experimental.projection import projector_resolution, show_image_bgra\n import numpy as np\n\n res = projector_resolution(camera=physical_camera)\n bgra = 255 * np.ones((res[0], res[1], 4))\n\n with show_image_bgra(camera=physical_camera, image_bgra=bgra) as projected_image:\n settings2d = Settings2D()\n settings2d.acquisitions.append(Settings2D.Acquisition(brightness=0.0))\n frame2d = projected_image.capture(settings2d=settings2d)\n\n assert isinstance(frame2d, Frame2D)\n\n\n@pytest.mark.physical_camera\ndef test_3d_to_projector_pixels(physical_camera):\n from zivid.experimental.projection import pixels_from_3d_points\n import numpy as np\n\n points = [[0.0, 0.0, 1000.0], [10.0, -10.0, 1200.0]]\n projector_coords = pixels_from_3d_points(camera=physical_camera, points=points)\n assert isinstance(projector_coords, list)\n assert len(projector_coords) == len(points)\n for coord in projector_coords:\n assert isinstance(coord, list)\n assert len(coord) == 2\n assert isinstance(coord[0], float)\n assert isinstance(coord[1], float)\n\n # Numpy array should also be valid input\n pixels_from_3d_points(camera=physical_camera, points=np.array(points))\n" }, { "alpha_fraction": 0.6906430721282959, "alphanum_fraction": 0.6943005323410034, "avg_line_length": 30.24761962890625, "blob_id": "23c0ab62fdfc3bfcc26845d1f330bfbd925cda12", "content_id": "3870dbcbe10a24652dd9538cdd8197b588febdad", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3281, "license_type": "permissive", "max_line_length": 77, "num_lines": 105, "path": "/test/test_camera_capture.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "import pytest\n\n\ndef test_one_acquisition_in_list(file_camera):\n import zivid\n\n acquisitions = [zivid.Settings.Acquisition()]\n settings = zivid.Settings(acquisitions=acquisitions)\n assert isinstance(acquisitions, list)\n with file_camera.capture(settings) as frame:\n assert frame\n assert isinstance(frame, zivid.frame.Frame)\n\n\ndef test_five_acquisitions_in_list(file_camera):\n import zivid\n\n acquisitions = [\n zivid.Settings.Acquisition(),\n zivid.Settings.Acquisition(),\n zivid.Settings.Acquisition(),\n zivid.Settings.Acquisition(),\n zivid.Settings.Acquisition(),\n ]\n settings = zivid.Settings(acquisitions=acquisitions)\n assert isinstance(acquisitions, list)\n with file_camera.capture(settings) as frame:\n assert frame\n assert isinstance(frame, zivid.frame.Frame)\n\n\ndef test_one_acquisition_in_tuple(file_camera):\n import zivid\n\n acquisitions = (zivid.Settings.Acquisition(),)\n settings = zivid.Settings(acquisitions=acquisitions)\n assert isinstance(acquisitions, tuple)\n with file_camera.capture(settings) as frame:\n assert frame\n assert isinstance(frame, zivid.frame.Frame)\n\n\ndef test_five_acquisition_in_tuple(file_camera):\n import zivid\n\n acquisitions = (\n zivid.Settings.Acquisition(),\n zivid.Settings.Acquisition(),\n zivid.Settings.Acquisition(),\n zivid.Settings.Acquisition(),\n zivid.Settings.Acquisition(),\n )\n settings = zivid.Settings(acquisitions=acquisitions)\n assert isinstance(acquisitions, tuple)\n with file_camera.capture(settings) as frame:\n assert frame\n assert isinstance(frame, zivid.frame.Frame)\n\n\ndef test_illegal_settings(file_camera):\n import zivid\n\n with pytest.raises(RuntimeError):\n file_camera.capture(zivid.Settings())\n\n with pytest.raises(TypeError):\n file_camera.capture([1, 2, 3, 4, 5])\n\n with pytest.raises(TypeError):\n file_camera.capture([zivid.Settings(), zivid.Settings(), 3])\n\n with pytest.raises(TypeError):\n file_camera.capture(file_camera.capture())\n\n\ndef test_empty_settings_list(file_camera):\n import _zivid\n\n with pytest.raises(TypeError):\n file_camera.capture([])\n\n\ndef test_diagnostics_capture(file_camera):\n from pathlib import Path\n from tempfile import TemporaryDirectory\n import os.path\n import zivid\n\n settings = zivid.Settings()\n settings.acquisitions.append(zivid.Settings.Acquisition())\n settings.diagnostics.enabled = False\n frame_diagnostics_off = file_camera.capture(settings)\n settings.diagnostics.enabled = True\n frame_diagnostics_on = file_camera.capture(settings)\n\n with TemporaryDirectory() as tmpdir:\n file_diagnostics_off = Path(tmpdir) / \"diagnostics_off.zdf\"\n file_diagnostics_on = Path(tmpdir) / \"diagnostics_on.zdf\"\n frame_diagnostics_off.save(file_diagnostics_off)\n frame_diagnostics_on.save(file_diagnostics_on)\n\n # Diagnostics ON should lead to a significantly larger file size.\n mb_diagnostics_off = os.path.getsize(str(file_diagnostics_off)) / 1e6\n mb_diagnostics_on = os.path.getsize(str(file_diagnostics_on)) / 1e6\n assert mb_diagnostics_on > (mb_diagnostics_off + 1.0)\n" }, { "alpha_fraction": 0.6552795171737671, "alphanum_fraction": 0.6552795171737671, "avg_line_length": 25.83333396911621, "blob_id": "beb21c97e9aaa88288a52fa24955c29ddb5a149d", "content_id": "9cc244cbcaa389455e3df1763bd283ec0a116d3d", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 644, "license_type": "permissive", "max_line_length": 60, "num_lines": 24, "path": "/test/test_zivid_module_content.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "def test_import_zivid_globals_changes():\n before = sorted(globals().keys())\n import zivid # pylint: disable=unused-import\n\n after = sorted(globals().keys())\n assert before == after\n\n\ndef test_import_zivid_globals_locals():\n expected_changes = sorted([\"before\", \"zivid\"])\n before = sorted(locals().keys())\n import zivid # pylint: disable=possibly-unused-variable\n\n after = sorted(locals().keys())\n assert sorted(before + expected_changes) == after\n\n\ndef test_version():\n import zivid\n import _zivid\n\n assert zivid.__version__\n assert _zivid.__version__\n assert zivid.__version__ == _zivid.__version__\n" }, { "alpha_fraction": 0.5887307524681091, "alphanum_fraction": 0.5887307524681091, "avg_line_length": 26.99186897277832, "blob_id": "8b76b8591d2fcce270a167f2c205c9c05f4015b5", "content_id": "a5916578f7ad6936e8be26b645adbb42dfa56649", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3443, "license_type": "permissive", "max_line_length": 93, "num_lines": 123, "path": "/modules/zivid/frame.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "\"\"\"Contains the Frame class.\"\"\"\nfrom pathlib import Path\n\nimport _zivid\nfrom zivid.settings import _to_settings\nfrom zivid.camera_info import _to_camera_info\nfrom zivid.camera_state import _to_camera_state\nfrom zivid.frame_info import _to_frame_info\nfrom zivid.point_cloud import PointCloud\n\n\nclass Frame:\n \"\"\"A frame captured by a Zivid camera.\n\n Contains the point cloud (stored on compute device memory) as well as\n calibration data, settings and state used by the API at time of the frame\n capture. Use the point_cloud() method to access point cloud data.\n \"\"\"\n\n def __init__(self, file_name):\n \"\"\"Create a frame by loading data from a file.\n\n Args:\n file_name: A pathlib.Path instance or a string specifying a Zivid Data File (ZDF)\n\n Raises:\n TypeError: Unsupported type provided for file name\n \"\"\"\n if isinstance(file_name, (str, Path)):\n self.__impl = _zivid.Frame(str(file_name))\n elif isinstance(file_name, _zivid.Frame):\n self.__impl = file_name\n else:\n raise TypeError(\n \"Unsupported type for argument file_name. Got {}, expected {} or {}.\".format(\n type(file_name), str.__name__, Path.__name__\n )\n )\n\n def __str__(self):\n return str(self.__impl)\n\n def point_cloud(self):\n \"\"\"Get the point cloud.\n\n See documentation/functions of zivid.PointCloud for instructions on how to\n retrieve point cloud data on various formats.\n\n Returns:\n A PointCloud instance\n \"\"\"\n return PointCloud(self.__impl.point_cloud())\n\n def save(self, file_path):\n \"\"\"Save the frame to file. The file type is determined from the file extension.\n\n Args:\n file_path: A pathlib.Path instance or a string specifying destination\n\n \"\"\"\n self.__impl.save(str(file_path))\n\n def load(self, file_path):\n \"\"\"Load a frame from a Zivid data file.\n\n Args:\n file_path: A pathlib.Path instance or a string specifying a ZDF file to load\n \"\"\"\n self.__impl.load(str(file_path))\n\n @property\n def settings(self):\n \"\"\"Get the settings used to capture this frame.\n\n Returns:\n A Settings instance\n \"\"\"\n return _to_settings(self.__impl.settings)\n\n @property\n def state(self):\n \"\"\"Get the camera state data at the time of the frame capture.\n\n Returns:\n A CameraState instance\n \"\"\"\n return _to_camera_state(self.__impl.state)\n\n @property\n def info(self):\n \"\"\"Get information collected at the time of the frame capture.\n\n Returns:\n A FrameInfo instance\n \"\"\"\n return _to_frame_info(self.__impl.info)\n\n @property\n def camera_info(self):\n \"\"\"Get information about the camera used to capture the frame.\n\n Returns:\n A CameraInfo instance\n \"\"\"\n return _to_camera_info(self.__impl.camera_info)\n\n def release(self):\n \"\"\"Release the underlying resources.\"\"\"\n try:\n impl = self.__impl\n except AttributeError:\n pass\n else:\n impl.release()\n\n def __enter__(self):\n return self\n\n def __exit__(self, exception_type, exception_value, traceback):\n self.release()\n\n def __del__(self):\n self.release()\n" }, { "alpha_fraction": 0.6229236125946045, "alphanum_fraction": 0.6395348906517029, "avg_line_length": 32.44444274902344, "blob_id": "d114596b9a7d1df18e0540d66206e3c0bf0c2a1f", "content_id": "972357d3d6e15702b88fa1bf9ac61c37c3a54eb3", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 602, "license_type": "permissive", "max_line_length": 118, "num_lines": 18, "path": "/src/Calibration/Pose.cpp", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "#include <ZividPython/Calibration/Pose.h>\n#include <ZividPython/Matrix.h>\n\n#include <pybind11/pybind11.h>\n\nnamespace py = pybind11;\n\nnamespace ZividPython\n{\n void wrapClass(pybind11::class_<Zivid::Calibration::Pose> pyClass)\n {\n pyClass\n .def(py::init([](const Eigen::Matrix<float, 4, 4, Eigen::RowMajor> &matrix) {\n return std::make_unique<Zivid::Calibration::Pose>(Conversion::toCpp(matrix));\n }))\n .def(\"to_matrix\", [](const Zivid::Calibration::Pose &pose) { return Conversion::toPy(pose.toMatrix()); });\n }\n} // namespace ZividPython\n" }, { "alpha_fraction": 0.6875, "alphanum_fraction": 0.6875, "avg_line_length": 27, "blob_id": "3d296b4b851d1e4117323e1c1b005232ff832d2a", "content_id": "c585c89d6807785b4e285d93327a2f6d257598d4", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 336, "license_type": "permissive", "max_line_length": 59, "num_lines": 12, "path": "/modules/zivid/sdk_version.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "\"\"\"Get version information for the library.\"\"\"\nimport _zivid\n\n\nclass SDKVersion: # pylint: disable=too-few-public-methods\n \"\"\"Get the version of the loaded library.\"\"\"\n\n major = _zivid.version.major\n minor = _zivid.version.minor\n patch = _zivid.version.patch\n build = _zivid.version.build\n full = _zivid.version.full\n" }, { "alpha_fraction": 0.5889244079589844, "alphanum_fraction": 0.7018104195594788, "avg_line_length": 28.34375, "blob_id": "86fccdb0419f0e06351db6cc1dee070d9e127772", "content_id": "5bf4bbed55bf3b0a374db66cb696a179b92790e8", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "INI", "length_bytes": 939, "license_type": "permissive", "max_line_length": 61, "num_lines": 32, "path": "/.flake8", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "[flake8]\nignore =\n### Covered better by pylint\n # Line too long\n E501,\n### Covered by pylint\n # Imported but unused\n F401,\n### in conflict with black\n # line break before binary operator\n W503,\n # expected 2 blank lines, found 0\n E302,\n # No blank lines allowed after function docstring\n D202,\n### We do not currently require docstrings in \"magic methods\"\n # missing docstring in magic method\n D105,\nshow-source = True\n\n### Ignore docstring complaints in data models\n### D101: Missing docstring in public class\n### D102: Missing docstring in public method\n### D106: Missing docstring in public nested class\n### D107: Missing docstring in __init__\nper-file-ignores =\n settings.py:D101,D102,D106,D107\n settings_2d.py:D101,D102,D106,D107\n camera_state.py:D101,D102,D106,D107\n camera_info.py:D101,D102,D106,D107\n camera_intrinsics.py:D101,D102,D106,D107\n frame_info.py:D101,D102,D106,D107\n" }, { "alpha_fraction": 0.5083006620407104, "alphanum_fraction": 0.5149411559104919, "avg_line_length": 44.3698616027832, "blob_id": "74f8d861abcdc64c86e969240c9008cfe66f0426", "content_id": "aabd840b057f69a1079bfeab81e7a1a085dd7727", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 3313, "license_type": "permissive", "max_line_length": 117, "num_lines": 73, "path": "/src/Projection.cpp", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "\n#include <ZividPython/Projection.h>\n\n#include <Zivid/Experimental/Projection.h>\n#include <Zivid/Resolution.h>\n#include <ZividPython/ReleasableCamera.h>\n#include <ZividPython/ReleasableProjectedImage.h>\n\n#include <array>\n#include <vector>\n\nnamespace ZividPython::Projection\n{\n void wrapAsSubmodule(pybind11::module &dest)\n {\n dest.def(\"projector_resolution\", [](const ReleasableCamera &camera) {\n const auto resolution = Zivid::Experimental::Projection::projectorResolution(camera.impl());\n return std::make_pair(resolution.height(), resolution.width());\n });\n\n dest.def(\n \"show_image_bgra\",\n [](ReleasableCamera &camera,\n const pybind11::array_t<uint8_t, pybind11::array::c_style | pybind11::array::forcecast> imageBGRA) {\n const auto info = imageBGRA.request();\n\n if(info.ndim != 3)\n {\n throw std::runtime_error(\"Input image array must be three dimensional.\");\n }\n\n const auto height = info.shape[0];\n const auto width = info.shape[1];\n const auto channels = info.shape[2];\n\n if(channels != 4)\n {\n throw std::runtime_error(\"Input image array must have four color channels (BGRA).\");\n }\n\n const auto resolution = Zivid::Resolution{ static_cast<size_t>(width), static_cast<size_t>(height) };\n const Zivid::Image<Zivid::ColorBGRA> zividImage{\n resolution, imageBGRA.data(), imageBGRA.data() + resolution.size() * sizeof(Zivid::ColorBGRA)\n };\n auto projectedImage = Zivid::Experimental::Projection::showImage(camera.impl(), zividImage);\n return ZividPython::ReleasableProjectedImage(std::move(projectedImage));\n });\n\n dest.def(\"pixels_from_3d_points\",\n [](const ReleasableCamera &camera, const std::vector<std::array<float, 3>> points) {\n auto pointsInternal = std::vector<Zivid::PointXYZ>();\n pointsInternal.reserve(points.size());\n std::transform(points.begin(),\n points.end(),\n std::back_inserter(pointsInternal),\n [](const auto &point) {\n return Zivid::PointXYZ{ point[0], point[1], point[2] };\n });\n\n const auto outputInternal =\n Zivid::Experimental::Projection::pixelsFrom3DPoints(camera.impl(), pointsInternal);\n\n auto output = std::vector<std::array<float, 2>>();\n output.reserve(outputInternal.size());\n std::transform(outputInternal.begin(),\n outputInternal.end(),\n std::back_inserter(output),\n [](const auto &pointxy) {\n return std::array<float, 2>{ pointxy.x, pointxy.y };\n });\n return output;\n });\n }\n} // namespace ZividPython::Projection\n" }, { "alpha_fraction": 0.4688511788845062, "alphanum_fraction": 0.47623366117477417, "avg_line_length": 47.256248474121094, "blob_id": "c1c4c3bbf00d80c4d9017f1877567db8770f113f", "content_id": "f4a7d1cbf92d22637b6824d43b42b1b2708b7633", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 7721, "license_type": "permissive", "max_line_length": 120, "num_lines": 160, "path": "/src/include/ZividPython/Wrappers.h", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "#pragma once\n\n#include <sstream>\n#include <string>\n\n#include <pybind11/chrono.h>\n#include <pybind11/functional.h>\n#include <pybind11/numpy.h>\n#include <pybind11/operators.h>\n#include <pybind11/pybind11.h>\n#include <pybind11/stl.h>\n\n#include <ZividPython/Traits.h>\n#include <ZividPython/Wrapper.h>\n\n#include <pybind11/pybind11.h>\n\n#include <string_view>\n\nnamespace ZividPython\n{\n namespace\n {\n template<typename T>\n using bool_t = decltype(static_cast<bool>(std::declval<T>()));\n\n /// Inserts underscore on positive case flank and before negative case flank:\n /// ZividSDKVersion -> zivid_sdk_version\n std::string toSnakeCase(std::string_view upperCamelCase)\n {\n if(upperCamelCase.empty())\n {\n throw std::invalid_argument{ \"String is empty.\" };\n }\n\n if(!isupper(upperCamelCase[0]))\n {\n std::stringstream msg;\n msg << \"First character of string: '\" << upperCamelCase << \"' is not capitalized\";\n throw std::invalid_argument{ msg.str() };\n }\n std::stringstream ss;\n ss << char(tolower(upperCamelCase[0]));\n\n for(size_t i = 1; i < upperCamelCase.size(); ++i)\n {\n if(isupper(upperCamelCase[i]))\n {\n auto previous = i - 1;\n auto next = i + 1;\n\n if(!isupper(upperCamelCase[previous])\n || (next < upperCamelCase.size() && !isupper(upperCamelCase[next])))\n {\n ss << \"_\";\n }\n }\n ss << char(tolower(upperCamelCase[i]));\n }\n return ss.str();\n }\n } // namespace\n enum class WrapType\n {\n normal,\n releasable,\n singleton,\n };\n\n template<typename Source, WrapType wrapType, typename WrapFunction, typename... Tags>\n void wrapClass(const pybind11::module &dest,\n const WrapFunction &wrapFunction,\n const char *exposedName,\n Tags... tags)\n {\n auto pyClass = pybind11::class_<Source>{ dest, exposedName, tags... }\n .def(\"to_string\", &Source::toString)\n .def(\"__repr__\", &Source::toString);\n\n if constexpr(is_detected<bool_t, Source>::value)\n {\n pyClass.def(\"__bool__\", &Source::operator bool);\n }\n\n if constexpr(WrapType::releasable == wrapType)\n {\n pyClass.def(\"release\", &Source::release).def(\"assert_not_released\", &Source::assertNotReleased);\n }\n else if constexpr(WrapType::singleton == wrapType)\n {\n pyClass.def_static(\"release\", &Source::release);\n // Singletons are released on module unload\n // https://pybind11.readthedocs.io/en/stable/advanced/misc.html#module-destructors\n dest.attr(exposedName).attr(\"_cleanup\") = pybind11::capsule([] { Source::release(); });\n }\n wrapFunction(pyClass);\n }\n\n template<typename Source, typename WrapFunction, typename Destination>\n void wrapEnum(const Destination &dest, const char *exposedName, const WrapFunction &wrapFunction)\n {\n auto pyEnum = pybind11::enum_<Source>{ dest, exposedName };\n wrapFunction(pyEnum);\n }\n\n template<typename WrapFunction>\n void wrapNamespaceAsSubmodule(pybind11::module &dest,\n const WrapFunction &wrapFunction,\n const char *nonLowercaseName)\n {\n const std::string name = toSnakeCase(nonLowercaseName);\n auto submodule = dest.def_submodule(name.c_str());\n wrapFunction(submodule);\n }\n} // namespace ZividPython\n\n#define ZIVID_PYTHON_WRAP_CLASS(dest, name, ...) \\\n ZividPython::wrapClass<name, ZividPython::WrapType::normal>(dest, \\\n static_cast<void (*)(pybind11::class_<name>)>( \\\n ZividPython::wrapClass), \\\n #name, \\\n ##__VA_ARGS__)\n\n#define ZIVID_PYTHON_WRAP_CLASS_BUFFER(dest, name) ZIVID_PYTHON_WRAP_CLASS(dest, name, pybind11::buffer_protocol{})\n\n#define ZIVID_PYTHON_WRAP_ENUM_CLASS_BASE_IMPL(dest, name, source, callback) \\\n ZividPython::wrapEnum<source>(dest, name, callback)\n\n#define ZIVID_PYTHON_WRAP_ENUM_CLASS(dest, name) \\\n ZIVID_PYTHON_WRAP_ENUM_CLASS_BASE_IMPL(dest, \\\n #name, \\\n name, \\\n static_cast<void (*)(pybind11::enum_<name>)>(ZividPython::wrapEnum))\n\n#define ZIVID_PYTHON_WRAP_CLASS_AS_RELEASABLE(dest, name) \\\n ZividPython::wrapClass<ZividPython::Releasable##name, ZividPython::WrapType::releasable>( \\\n dest, static_cast<void (*)(pybind11::class_<ZividPython::Releasable##name>)>(ZividPython::wrapClass), #name)\n\n#define ZIVID_PYTHON_WRAP_CLASS_AS_SINGLETON(dest, name) \\\n ZividPython::wrapClass<ZividPython::Singleton##name, ZividPython::WrapType::singleton>( \\\n dest, static_cast<void (*)(pybind11::class_<ZividPython::Singleton##name>)>(ZividPython::wrapClass), #name);\n\n#define ZIVID_PYTHON_WRAP_CLASS_BUFFER_AS_RELEASABLE(dest, name) \\\n ZividPython::wrapClass<ZividPython::Releasable##name, ZividPython::WrapType::releasable>( \\\n dest, \\\n static_cast<void (*)(pybind11::class_<ZividPython::Releasable##name>)>(ZividPython::wrapClass), \\\n #name, \\\n pybind11::buffer_protocol())\n\n#define ZIVID_PYTHON_WRAP_ARRAY2D_BUFFER_AS_RELEASABLE(dest, nativetype) \\\n ZividPython::wrapClass<ZividPython::ReleasableArray2D<nativetype>, ZividPython::WrapType::releasable>( \\\n dest, \\\n static_cast<void (*)(pybind11::class_<ZividPython::ReleasableArray2D<nativetype>>)>(ZividPython::wrapClass), \\\n \"Array2D\" #nativetype, \\\n pybind11::buffer_protocol())\n\n#define ZIVID_PYTHON_WRAP_DATA_MODEL(dest, name) ZividPython::wrapDataModel(dest, name{})\n\n#define ZIVID_PYTHON_WRAP_NAMESPACE_AS_SUBMODULE(dest, name) \\\n ZividPython::wrapNamespaceAsSubmodule(dest, ZividPython::name::wrapAsSubmodule, #name)\n" }, { "alpha_fraction": 0.7002750039100647, "alphanum_fraction": 0.7140238285064697, "avg_line_length": 36.620689392089844, "blob_id": "4ecaf3ca537c70e9998cc3600e37fad0280eefa6", "content_id": "4b5910be7e75c3411440e4b633c1cd2e37556dcd", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 1091, "license_type": "permissive", "max_line_length": 114, "num_lines": 29, "path": "/src/include/ZividPython/ReleasableCamera.h", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "#pragma once\n\n#include <Zivid/Camera.h>\n#include <ZividPython/Releasable.h>\n#include <ZividPython/ReleasableFrame.h>\n#include <ZividPython/ReleasableFrame2D.h>\n#include <ZividPython/Wrappers.h>\n\nnamespace ZividPython\n{\n class ReleasableCamera : public Releasable<Zivid::Camera>\n {\n public:\n using Releasable<Zivid::Camera>::Releasable;\n\n ZIVID_PYTHON_ADD_COMPARE(==)\n ZIVID_PYTHON_ADD_COMPARE(!=)\n ZIVID_PYTHON_FORWARD_0_ARGS_WRAP_RETURN(ReleasableCamera, connect)\n ZIVID_PYTHON_FORWARD_0_ARGS(disconnect)\n ZIVID_PYTHON_FORWARD_1_ARGS_WRAP_RETURN(ReleasableFrame, capture, const Zivid::Settings &, settings)\n ZIVID_PYTHON_FORWARD_1_ARGS_WRAP_RETURN(ReleasableFrame2D, capture, const Zivid::Settings2D &, settings2D)\n ZIVID_PYTHON_FORWARD_0_ARGS(state)\n ZIVID_PYTHON_FORWARD_0_ARGS(info)\n ZIVID_PYTHON_FORWARD_1_ARGS(writeUserData, const std::vector<uint8_t> &, data)\n ZIVID_PYTHON_FORWARD_0_ARGS(userData)\n };\n\n void wrapClass(pybind11::class_<ReleasableCamera> pyClass);\n} // namespace ZividPython\n" }, { "alpha_fraction": 0.8159509301185608, "alphanum_fraction": 0.8159509301185608, "avg_line_length": 53.33333206176758, "blob_id": "972499e007458bceac6f5fb05ea56e71825046db", "content_id": "bf3c3285a4ab24e0b205957ce20dc5742aab3cb3", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 163, "license_type": "permissive", "max_line_length": 124, "num_lines": 3, "path": "/licenses-dependencies/README.md", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "### SOFTWARE NOTICES AND INFORMATION\n\nThis software includes material from first and third parties. The licenses for these libraries are listed in this directory.\n" }, { "alpha_fraction": 0.5546059012413025, "alphanum_fraction": 0.5859448909759521, "avg_line_length": 36.619049072265625, "blob_id": "846e47d4c757f20471ec14b9258fd9a92063eff0", "content_id": "f1c363e388f529e025d9b8ea60c94462a032051e", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 3159, "license_type": "permissive", "max_line_length": 120, "num_lines": 84, "path": "/src/Matrix4x4.cpp", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "#include \"ZividPython/Matrix4x4.h\"\n\n#include <Zivid/Version.h>\n\n#include <algorithm>\n#include <cstddef>\n#include <cstdint>\n#include <stdexcept>\n#include <tuple>\n\n#include <pybind11/stl.h>\n\nnamespace py = pybind11;\nusing Zivid::Matrix4x4;\n\nnamespace\n{\n // Maps negative indexes to size + index, and throws if index is out of range\n constexpr std::size_t mapIndex(const std::int64_t index, const std::size_t size)\n {\n const auto mappedIndex = (index < 0) ? static_cast<std::size_t>(size + index) : static_cast<std::size_t>(index);\n if(mappedIndex >= size)\n {\n throw std::out_of_range(\"Matrix index \" + std::to_string(index) + \" out of range\");\n }\n return mappedIndex;\n }\n\n Matrix4x4 createMatrixFrom4x4Array(\n const std::array<std::array<Matrix4x4::ValueType, Matrix4x4::cols>, Matrix4x4::rows> &arr)\n {\n Matrix4x4 matrix;\n auto iter = matrix.begin();\n for(size_t row = 0; row < Matrix4x4::rows; ++row)\n {\n iter = std::copy_n(arr[row].data(), Matrix4x4::cols, iter);\n }\n return matrix;\n }\n\n auto getItem(const Matrix4x4 &matrix, const std::tuple<int64_t, int64_t> indexes)\n {\n const auto [row, col] = indexes;\n return matrix(mapIndex(row, Matrix4x4::rows), mapIndex(col, Matrix4x4::cols));\n }\n\n void setItem(Matrix4x4 &matrix, const std::tuple<int64_t, int64_t> indexes, const Matrix4x4::ValueType value)\n {\n const auto [row, col] = indexes;\n matrix(mapIndex(row, Matrix4x4::rows), mapIndex(col, Matrix4x4::cols)) = value;\n }\n\n auto bufferInfo(Matrix4x4 &matrix)\n {\n return py::buffer_info{ matrix.data(),\n sizeof(Matrix4x4::ValueType),\n py::format_descriptor<Matrix4x4::ValueType>::format(),\n 2,\n { Matrix4x4::rows, Matrix4x4::cols },\n { sizeof(Matrix4x4::ValueType) * Matrix4x4::cols, sizeof(Matrix4x4::ValueType) } };\n }\n} // namespace\n\nvoid ZividPython::wrapClass(py::class_<Zivid::Matrix4x4> pyClass)\n{\n pyClass.doc() = \"Matrix of size 4x4 containing 32 bit floats\";\n pyClass.def(py::init(), \"Zero initializes all values\")\n .def(py::init<const std::array<Matrix4x4::ValueType, Matrix4x4::cols * Matrix4x4::rows> &>())\n .def(py::init<const Matrix4x4 &>())\n .def(py::init(&createMatrixFrom4x4Array))\n .def(py::init<const std::string &>())\n .def(\"save\", &Matrix4x4::save)\n .def(\"load\", &Matrix4x4::load)\n .def(\"_getitem\", &getItem)\n .def(\"_setitem\", &setItem)\n .def(\n \"__iter__\",\n [](const Matrix4x4 &matrix) { return py::make_iterator(matrix.cbegin(), matrix.cend()); },\n py::keep_alive<0, 1>{})\n .def_property_readonly_static(\"rows\", [](const py::object & /*self*/) { return Matrix4x4::rows; })\n .def_property_readonly_static(\"cols\", [](const py::object & /*self*/) { return Matrix4x4::cols; })\n .def(\"inverse\", &Matrix4x4::inverse<Matrix4x4::ValueType>)\n .def_buffer(&bufferInfo);\n}" }, { "alpha_fraction": 0.5913212299346924, "alphanum_fraction": 0.5971502661705017, "avg_line_length": 27.592592239379883, "blob_id": "e13a106736ccdde70a4ec1d6f8352b13a5b8280c", "content_id": "8aba887bb2b3512369da977769c57a277f3900fa", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Shell", "length_bytes": 1544, "license_type": "permissive", "max_line_length": 107, "num_lines": 54, "path": "/continuous-integration/linux/lint-cpp.sh", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "#!/bin/bash\n\nSCRIPT_DIR=\"$( cd \"$( dirname \"${BASH_SOURCE[0]}\" )\" && pwd )\"\nROOT_DIR=$(realpath \"$SCRIPT_DIR/../..\")\n\nif [ -z \"$1\" ]; then\n echo Usage:\n echo $0 build-dir\n exit 1\nfi\n\n#Todo: buildDir=$1\n\ncppFiles=$(find \"$ROOT_DIR\" -name '*.cpp' |grep --invert-match src/3rd-party |grep --invert-match _skbuild)\nhFiles=$(find \"$ROOT_DIR\" -name '*.h' |grep --invert-match src/3rd-party |grep --invert-match _skbuild)\n\nif [ -z \"$cppFiles\" ] || [ -z \"$hFiles\" ]; then\n echo Error: Cannot find C++ source files\n exit 1\nfi\n\necho \"Checking clang-format conformance\"\nclang-format --version || exit $?\nfor fileName in $cppFiles $hFiles; do\n echo $fileName\n diff $fileName \\\n <(clang-format $fileName) \\\n || exit $?\ndone\n\n#Todo: echo Building with warnings as errors\n#Todo: for compiler in clang gcc; do\n#Todo: source $SCRIPT_DIR/lint-cpp-$compiler-setup.sh || exit $?\n#Todo: echo \"Compiler config:\"\n#Todo: echo \" CXX: ${CXX:?} \"\n#Todo: echo \" CXXFLAGS: ${CXXFLAGS:?}\"\n#Todo: cmake \\\n#Todo: -S $ROOT_DIR \\\n#Todo: -B $buildDir/$compiler \\\n#Todo: -G Ninja \\\n#Todo: -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \\\n#Todo: || exit $?\n#Todo: \n#Todo: cmake --build $buildDir/$compiler || exit $?\n#Todo: done\n#Todo: \n#Todo: echo Running clang-tidy on C++ files\n#Todo: clang-tidy --version || exit $?\n#Todo: for fileName in $cppFiles; do\n#Todo: echo $fileName\n#Todo: clang-tidy -p $buildDir/clang $fileName || exit $?\n#Todo: done\n\necho Success! [\"$0\"]\n" }, { "alpha_fraction": 0.5680781602859497, "alphanum_fraction": 0.5703583359718323, "avg_line_length": 33.01662063598633, "blob_id": "dec796c7d79deaf9f44d5d6665dbd01ca89a2809", "content_id": "cd2c31c6894dfcbaace67812f1fb2136408d3194", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 12280, "license_type": "permissive", "max_line_length": 221, "num_lines": 361, "path": "/modules/zivid/camera_info.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "\"\"\"Auto generated, do not edit.\"\"\"\n# pylint: disable=too-many-lines,protected-access,too-few-public-methods,too-many-arguments,line-too-long,missing-function-docstring,missing-class-docstring,redefined-builtin,too-many-branches,too-many-boolean-expressions\nimport _zivid\n\n\nclass CameraInfo:\n class Revision:\n def __init__(\n self,\n major=_zivid.CameraInfo.Revision.Major().value,\n minor=_zivid.CameraInfo.Revision.Minor().value,\n ):\n if isinstance(major, (int,)):\n self._major = _zivid.CameraInfo.Revision.Major(major)\n else:\n raise TypeError(\n \"Unsupported type, expected: (int,), got {value_type}\".format(\n value_type=type(major)\n )\n )\n\n if isinstance(minor, (int,)):\n self._minor = _zivid.CameraInfo.Revision.Minor(minor)\n else:\n raise TypeError(\n \"Unsupported type, expected: (int,), got {value_type}\".format(\n value_type=type(minor)\n )\n )\n\n @property\n def major(self):\n return self._major.value\n\n @property\n def minor(self):\n return self._minor.value\n\n @major.setter\n def major(self, value):\n if isinstance(value, (int,)):\n self._major = _zivid.CameraInfo.Revision.Major(value)\n else:\n raise TypeError(\n \"Unsupported type, expected: int, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n @minor.setter\n def minor(self, value):\n if isinstance(value, (int,)):\n self._minor = _zivid.CameraInfo.Revision.Minor(value)\n else:\n raise TypeError(\n \"Unsupported type, expected: int, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n def __eq__(self, other):\n if self._major == other._major and self._minor == other._minor:\n return True\n return False\n\n def __str__(self):\n return str(_to_internal_camera_info_revision(self))\n\n class UserData:\n def __init__(\n self,\n max_size_bytes=_zivid.CameraInfo.UserData.MaxSizeBytes().value,\n ):\n if isinstance(max_size_bytes, (int,)):\n self._max_size_bytes = _zivid.CameraInfo.UserData.MaxSizeBytes(\n max_size_bytes\n )\n else:\n raise TypeError(\n \"Unsupported type, expected: (int,), got {value_type}\".format(\n value_type=type(max_size_bytes)\n )\n )\n\n @property\n def max_size_bytes(self):\n return self._max_size_bytes.value\n\n @max_size_bytes.setter\n def max_size_bytes(self, value):\n if isinstance(value, (int,)):\n self._max_size_bytes = _zivid.CameraInfo.UserData.MaxSizeBytes(value)\n else:\n raise TypeError(\n \"Unsupported type, expected: int, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n def __eq__(self, other):\n if self._max_size_bytes == other._max_size_bytes:\n return True\n return False\n\n def __str__(self):\n return str(_to_internal_camera_info_user_data(self))\n\n class Model:\n zivid2PlusM130 = \"zivid2PlusM130\"\n zividOnePlusLarge = \"zividOnePlusLarge\"\n zividOnePlusMedium = \"zividOnePlusMedium\"\n zividOnePlusSmall = \"zividOnePlusSmall\"\n zividTwo = \"zividTwo\"\n zividTwoL100 = \"zividTwoL100\"\n\n _valid_values = {\n \"zivid2PlusM130\": _zivid.CameraInfo.Model.zivid2PlusM130,\n \"zividOnePlusLarge\": _zivid.CameraInfo.Model.zividOnePlusLarge,\n \"zividOnePlusMedium\": _zivid.CameraInfo.Model.zividOnePlusMedium,\n \"zividOnePlusSmall\": _zivid.CameraInfo.Model.zividOnePlusSmall,\n \"zividTwo\": _zivid.CameraInfo.Model.zividTwo,\n \"zividTwoL100\": _zivid.CameraInfo.Model.zividTwoL100,\n }\n\n @classmethod\n def valid_values(cls):\n return list(cls._valid_values.keys())\n\n def __init__(\n self,\n firmware_version=_zivid.CameraInfo.FirmwareVersion().value,\n model=_zivid.CameraInfo.Model().value,\n model_name=_zivid.CameraInfo.ModelName().value,\n serial_number=_zivid.CameraInfo.SerialNumber().value,\n revision=None,\n user_data=None,\n ):\n if isinstance(firmware_version, (str,)):\n self._firmware_version = _zivid.CameraInfo.FirmwareVersion(firmware_version)\n else:\n raise TypeError(\n \"Unsupported type, expected: (str,), got {value_type}\".format(\n value_type=type(firmware_version)\n )\n )\n\n if isinstance(model, _zivid.CameraInfo.Model.enum):\n self._model = _zivid.CameraInfo.Model(model)\n elif isinstance(model, str):\n self._model = _zivid.CameraInfo.Model(self.Model._valid_values[model])\n else:\n raise TypeError(\n \"Unsupported type, expected: str, got {value_type}\".format(\n value_type=type(model)\n )\n )\n\n if isinstance(model_name, (str,)):\n self._model_name = _zivid.CameraInfo.ModelName(model_name)\n else:\n raise TypeError(\n \"Unsupported type, expected: (str,), got {value_type}\".format(\n value_type=type(model_name)\n )\n )\n\n if isinstance(serial_number, (str,)):\n self._serial_number = _zivid.CameraInfo.SerialNumber(serial_number)\n else:\n raise TypeError(\n \"Unsupported type, expected: (str,), got {value_type}\".format(\n value_type=type(serial_number)\n )\n )\n\n if revision is None:\n revision = self.Revision()\n if not isinstance(revision, self.Revision):\n raise TypeError(\"Unsupported type: {value}\".format(value=type(revision)))\n self._revision = revision\n\n if user_data is None:\n user_data = self.UserData()\n if not isinstance(user_data, self.UserData):\n raise TypeError(\"Unsupported type: {value}\".format(value=type(user_data)))\n self._user_data = user_data\n\n @property\n def firmware_version(self):\n return self._firmware_version.value\n\n @property\n def model(self):\n if self._model.value is None:\n return None\n for key, internal_value in self.Model._valid_values.items():\n if internal_value == self._model.value:\n return key\n raise ValueError(\"Unsupported value {value}\".format(value=self._model))\n\n @property\n def model_name(self):\n return self._model_name.value\n\n @property\n def serial_number(self):\n return self._serial_number.value\n\n @property\n def revision(self):\n return self._revision\n\n @property\n def user_data(self):\n return self._user_data\n\n @firmware_version.setter\n def firmware_version(self, value):\n if isinstance(value, (str,)):\n self._firmware_version = _zivid.CameraInfo.FirmwareVersion(value)\n else:\n raise TypeError(\n \"Unsupported type, expected: str, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n @model.setter\n def model(self, value):\n if isinstance(value, str):\n self._model = _zivid.CameraInfo.Model(self.Model._valid_values[value])\n elif isinstance(value, _zivid.CameraInfo.Model.enum):\n self._model = _zivid.CameraInfo.Model(value)\n else:\n raise TypeError(\n \"Unsupported type, expected: str, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n @model_name.setter\n def model_name(self, value):\n if isinstance(value, (str,)):\n self._model_name = _zivid.CameraInfo.ModelName(value)\n else:\n raise TypeError(\n \"Unsupported type, expected: str, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n @serial_number.setter\n def serial_number(self, value):\n if isinstance(value, (str,)):\n self._serial_number = _zivid.CameraInfo.SerialNumber(value)\n else:\n raise TypeError(\n \"Unsupported type, expected: str, got {value_type}\".format(\n value_type=type(value)\n )\n )\n\n @revision.setter\n def revision(self, value):\n if not isinstance(value, self.Revision):\n raise TypeError(\"Unsupported type {value}\".format(value=type(value)))\n self._revision = value\n\n @user_data.setter\n def user_data(self, value):\n if not isinstance(value, self.UserData):\n raise TypeError(\"Unsupported type {value}\".format(value=type(value)))\n self._user_data = value\n\n @classmethod\n def load(cls, file_name):\n return _to_camera_info(_zivid.CameraInfo(str(file_name)))\n\n def save(self, file_name):\n _to_internal_camera_info(self).save(str(file_name))\n\n def __eq__(self, other):\n if (\n self._firmware_version == other._firmware_version\n and self._model == other._model\n and self._model_name == other._model_name\n and self._serial_number == other._serial_number\n and self._revision == other._revision\n and self._user_data == other._user_data\n ):\n return True\n return False\n\n def __str__(self):\n return str(_to_internal_camera_info(self))\n\n\ndef _to_camera_info_revision(internal_revision):\n return CameraInfo.Revision(\n major=internal_revision.major.value,\n minor=internal_revision.minor.value,\n )\n\n\ndef _to_camera_info_user_data(internal_user_data):\n return CameraInfo.UserData(\n max_size_bytes=internal_user_data.max_size_bytes.value,\n )\n\n\ndef _to_camera_info(internal_camera_info):\n return CameraInfo(\n revision=_to_camera_info_revision(internal_camera_info.revision),\n user_data=_to_camera_info_user_data(internal_camera_info.user_data),\n firmware_version=internal_camera_info.firmware_version.value,\n model=internal_camera_info.model.value,\n model_name=internal_camera_info.model_name.value,\n serial_number=internal_camera_info.serial_number.value,\n )\n\n\ndef _to_internal_camera_info_revision(revision):\n internal_revision = _zivid.CameraInfo.Revision()\n\n internal_revision.major = _zivid.CameraInfo.Revision.Major(revision.major)\n internal_revision.minor = _zivid.CameraInfo.Revision.Minor(revision.minor)\n\n return internal_revision\n\n\ndef _to_internal_camera_info_user_data(user_data):\n internal_user_data = _zivid.CameraInfo.UserData()\n\n internal_user_data.max_size_bytes = _zivid.CameraInfo.UserData.MaxSizeBytes(\n user_data.max_size_bytes\n )\n\n return internal_user_data\n\n\ndef _to_internal_camera_info(camera_info):\n internal_camera_info = _zivid.CameraInfo()\n\n internal_camera_info.firmware_version = _zivid.CameraInfo.FirmwareVersion(\n camera_info.firmware_version\n )\n internal_camera_info.model = _zivid.CameraInfo.Model(camera_info._model.value)\n internal_camera_info.model_name = _zivid.CameraInfo.ModelName(\n camera_info.model_name\n )\n internal_camera_info.serial_number = _zivid.CameraInfo.SerialNumber(\n camera_info.serial_number\n )\n\n internal_camera_info.revision = _to_internal_camera_info_revision(\n camera_info.revision\n )\n internal_camera_info.user_data = _to_internal_camera_info_user_data(\n camera_info.user_data\n )\n return internal_camera_info\n" }, { "alpha_fraction": 0.6315789222717285, "alphanum_fraction": 0.646616518497467, "avg_line_length": 18, "blob_id": "4689100df1e5f23064b277a079000973258b5feb", "content_id": "f975948fa625e314172c46d34180e38a3ba17047", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Shell", "length_bytes": 133, "license_type": "permissive", "max_line_length": 39, "num_lines": 7, "path": "/continuous-integration/linux/lint-cpp-clang-setup.sh", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "#!/bin/bash\n\nexport CXX=clang\nexport CXXFLAGS=\"-Weverything -Werror \\\n -Wno-c++98-compat \\\n -Wno-exit-time-destructors \\\n \"\n" }, { "alpha_fraction": 0.7401574850082397, "alphanum_fraction": 0.7664042115211487, "avg_line_length": 30.75, "blob_id": "beccfb75d5e5ec603643b9f217a044facc3c257d", "content_id": "11c084b7cb8e736dc11a93278826091703c8bc74", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 381, "license_type": "permissive", "max_line_length": 82, "num_lines": 12, "path": "/src/include/ZividPython/Calibration/HandEye.h", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "#pragma once\n\n#include <Zivid/Calibration/HandEye.h>\n\n#include <pybind11/pybind11.h>\n\nnamespace ZividPython\n{\n void wrapClass(pybind11::class_<Zivid::Calibration::HandEyeResidual> pyClass);\n void wrapClass(pybind11::class_<Zivid::Calibration::HandEyeOutput> pyClass);\n void wrapClass(pybind11::class_<Zivid::Calibration::HandEyeInput> pyClass);\n} // namespace ZividPython\n" }, { "alpha_fraction": 0.6097297072410583, "alphanum_fraction": 0.6194594502449036, "avg_line_length": 36, "blob_id": "8b8375e3a618416af43ff7ca35a8cc587c6cc477", "content_id": "983bef6f1e9238f1ef383237b2a58a26abaa640c", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 925, "license_type": "permissive", "max_line_length": 94, "num_lines": 25, "path": "/src/include/ZividPython/ReleasablePointCloud.h", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "#pragma once\n\n#include <Zivid/PointCloud.h>\n#include <ZividPython/Releasable.h>\n#include <ZividPython/Wrappers.h>\n\nnamespace ZividPython\n{\n class ReleasablePointCloud : public Releasable<Zivid::PointCloud>\n {\n public:\n using Releasable<Zivid::PointCloud>::Releasable;\n\n ZIVID_PYTHON_FORWARD_0_ARGS(width)\n ZIVID_PYTHON_FORWARD_0_ARGS(height)\n ZIVID_PYTHON_FORWARD_1_ARGS(transform, const Zivid::Matrix4x4 &, matrix)\n ZIVID_PYTHON_FORWARD_1_ARGS(downsample, Zivid::PointCloud::Downsampling, downsampling)\n ZIVID_PYTHON_FORWARD_1_ARGS_WRAP_RETURN(ReleasablePointCloud,\n downsampled,\n Zivid::PointCloud::Downsampling,\n downsampling)\n };\n\n void wrapClass(pybind11::class_<ReleasablePointCloud> pyClass);\n} // namespace ZividPython\n" }, { "alpha_fraction": 0.6047120690345764, "alphanum_fraction": 0.6178010702133179, "avg_line_length": 30.86111068725586, "blob_id": "e158cb529059adcf03a067603ab3bc20674cee74", "content_id": "aa1f45c65c8cbeb78617a9128cdb9df9ccc20177", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Shell", "length_bytes": 1146, "license_type": "permissive", "max_line_length": 162, "num_lines": 36, "path": "/continuous-integration/linux/platform-dependent/fedora-35/setup.sh", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "#!/bin/bash\n\nSCRIPT_DIR=\"$(realpath $(cd \"$(dirname \"${BASH_SOURCE[0]}\")\" && pwd) )\"\n\ndnf --assumeyes install \\\n bsdtar \\\n clinfo \\\n g++ \\\n jq \\\n libatomic \\\n python3-devel \\\n python3-pip \\\n wget \\\n findutils \\\n systemd-devel \\\n || exit $?\n\nalternatives --install /usr/bin/python python /usr/bin/python3 0 || exit $?\nalternatives --install /usr/bin/pip pip /usr/bin/pip3 0 || exit $?\n\nsource $(realpath $SCRIPT_DIR/../common.sh) || exit $?\nfedora_install_opencl_cpu_runtime || exit $?\n\nfunction install_www_deb {\n TMP_DIR=$(mktemp --tmpdir --directory zivid-python-install-www-deb-XXXX) || exit $?\n pushd $TMP_DIR || exit $?\n wget -nv \"$@\" || exit $?\n ar x ./*deb || exit $?\n bsdtar -xf data.tar.*z -C / || exit $?\n ldconfig || exit $?\n popd || exit $?\n rm -r $TMP_DIR || exit $?\n}\n\ninstall_www_deb \"https://downloads.zivid.com/sdk/releases/${ZIVID_SDK_EXACT_VERSION}/u20/zivid-telicam-driver_${ZIVID_TELICAM_EXACT_VERSION}_amd64.deb\" || exit $?\ninstall_www_deb \"https://downloads.zivid.com/sdk/releases/${ZIVID_SDK_EXACT_VERSION}/u20/zivid_${ZIVID_SDK_EXACT_VERSION}_amd64.deb\" || exit $?" }, { "alpha_fraction": 0.5960900783538818, "alphanum_fraction": 0.5964391827583313, "avg_line_length": 28.379487991333008, "blob_id": "44b780a5d52aff6730b6bd09f46e90fde3970a32", "content_id": "b6e3a815a9222dad83aaf9e0bab787e2a79103d7", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 5729, "license_type": "permissive", "max_line_length": 127, "num_lines": 195, "path": "/modules/zivid/_calibration/hand_eye.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "\"\"\"Module containing implementation of hand-eye calibration functionality.\n\nThis module should not be imported directly by end-user, but rather accessed through\nthe zivid.calibration module.\n\"\"\"\n\nimport _zivid\nfrom zivid._calibration.pose import Pose\nfrom zivid._calibration.detector import DetectionResult\n\n\nclass HandEyeInput:\n \"\"\"Class binding together a robot pose and the corresponding detection result.\"\"\"\n\n def __init__(self, robot_pose, detection_result):\n \"\"\"Construct a HandEyeInput.\n\n Args:\n robot_pose: The robot Pose at the time of capture\n detection_result: The DetectionResult captured when in the above pose\n\n Raises:\n TypeError: If one of the input arguments are of the wrong type\n \"\"\"\n if not isinstance(robot_pose, Pose):\n raise TypeError(\n \"Unsupported type for argument robot_pose. Expected zivid.calibration.Pose but got {}\".format(\n type(robot_pose)\n )\n )\n if not isinstance(detection_result, DetectionResult):\n raise TypeError(\n \"Unsupported type for argument detection_result. Expected zivid.calibration.DetectionResult but got {}\".format(\n type(detection_result)\n )\n )\n self.__impl = _zivid.calibration.HandEyeInput(\n robot_pose._Pose__impl, # pylint: disable=protected-access\n detection_result._DetectionResult__impl, # pylint: disable=protected-access\n )\n\n def robot_pose(self):\n \"\"\"Get the contained robot pose.\n\n Returns:\n A Pose instance\n \"\"\"\n return Pose(self.__impl.robot_pose())\n\n def detection_result(self):\n \"\"\"Get the contained detection result.\n\n Returns:\n A DetectionResult instance\n \"\"\"\n return DetectionResult(self.__impl.detection_result())\n\n def __str__(self):\n return str(self.__impl)\n\n\nclass HandEyeResidual:\n \"\"\"Class representing the estimated errors of a calibrated hand-eye transform.\"\"\"\n\n def __init__(self, impl):\n \"\"\"Initialize HandEyeResidual wrapper.\n\n This constructor is only used internally, and should not be called by the end-user.\n\n Args:\n impl: Reference to internal/back-end instance.\n\n Raises:\n TypeError: If argument does not match the expected internal class.\n \"\"\"\n if not isinstance(impl, _zivid.calibration.HandEyeResidual):\n raise TypeError(\n \"Unsupported type for argument impl. Got {}, expected {}\".format(\n type(impl), type(_zivid.calibration.HandEyeResidual)\n )\n )\n self.__impl = impl\n\n def rotation(self):\n \"\"\"Get the rotation residual.\n\n Returns:\n Rotation residual in degrees\n \"\"\"\n return self.__impl.rotation()\n\n def translation(self):\n \"\"\"Get the translation residual.\n\n Returns:\n Translation residual in millimeters\n \"\"\"\n return self.__impl.translation()\n\n def __str__(self):\n return str(self.__impl)\n\n\nclass HandEyeOutput:\n \"\"\"Class representing the result of a hand-eye calibration process.\"\"\"\n\n def __init__(self, impl):\n \"\"\"Initialize HandEyeOutput wrapper.\n\n This constructor is only used internally, and should not be called by the end-user.\n\n Args:\n impl: Reference to internal/back-end instance.\n\n Raises:\n TypeError: If argument does not match the expected internal class.\n \"\"\"\n if not isinstance(impl, _zivid.calibration.HandEyeOutput):\n raise TypeError(\n \"Unsupported type for argument impl. Got {}, expected {}\".format(\n type(impl), type(_zivid.calibration.HandEyeOutput)\n )\n )\n self.__impl = impl\n\n def valid(self):\n \"\"\"Check validity of HandEyeOutput.\n\n Returns:\n True if HandEyeOutput is valid\n \"\"\"\n return self.__impl.valid()\n\n def __bool__(self):\n return bool(self.__impl)\n\n def transform(self):\n \"\"\"Get hand-eye transform.\n\n Returns:\n A 4x4 array representing a hand-eye transform\n \"\"\"\n return self.__impl.transform()\n\n def residuals(self):\n \"\"\"Get hand-eye calibration residuals.\n\n Returns:\n List of HandEyeResidual, one for each pose.\n \"\"\"\n return [\n HandEyeResidual(internal_residual)\n for internal_residual in self.__impl.residuals()\n ]\n\n def __str__(self):\n return str(self.__impl)\n\n\ndef calibrate_eye_in_hand(calibration_inputs):\n \"\"\"Perform eye-in-hand calibration.\n\n Args:\n calibration_inputs: List of HandEyeInput\n\n Returns:\n A HandEyeOutput instance containing the eye-in-hand transform\n \"\"\"\n return HandEyeOutput(\n _zivid.calibration.calibrate_eye_in_hand(\n [\n calibration_input._HandEyeInput__impl # pylint: disable=protected-access\n for calibration_input in calibration_inputs\n ]\n )\n )\n\n\ndef calibrate_eye_to_hand(calibration_inputs):\n \"\"\"Perform eye-to-hand calibration.\n\n Args:\n calibration_inputs: List of HandEyeInput\n\n Returns:\n A HandEyeOutput instance containing the eye-to-hand transform\n \"\"\"\n return HandEyeOutput(\n _zivid.calibration.calibrate_eye_to_hand(\n [\n calibration_input._HandEyeInput__impl # pylint: disable=protected-access\n for calibration_input in calibration_inputs\n ]\n )\n )\n" }, { "alpha_fraction": 0.6442359089851379, "alphanum_fraction": 0.6573726534843445, "avg_line_length": 29.4489803314209, "blob_id": "2b87768351ccb905f3ae4ad5321d7299ceaa48db", "content_id": "7e326d3adb48103139e140560464e6a6b1681ffd", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 7460, "license_type": "permissive", "max_line_length": 99, "num_lines": 245, "path": "/test/conftest.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "import tempfile\nimport numbers\nimport os\nimport subprocess\nfrom pathlib import Path\n\nimport pytest\nimport zivid\nimport numpy as np\n\n\ndef _testdata_dir():\n return (Path(__file__).parent.parent / \"test\" / \"test_data\").resolve()\n\n\n@pytest.fixture(name=\"datamodel_yml_dir\")\ndef datamodel_yml_dir_fixture():\n return _testdata_dir() / \"datamodels\"\n\n\n@pytest.fixture(name=\"application\", scope=\"module\")\ndef application_fixture():\n with zivid.Application() as app:\n yield app\n\n\n@pytest.fixture(name=\"file_camera_file\", scope=\"module\")\ndef file_camera_file_fixture():\n return _testdata_dir() / \"FileCameraZivid2M70.zfc\"\n\n\n@pytest.fixture(name=\"physical_camera\", scope=\"module\")\ndef physical_camera_fixture(application):\n with application.connect_camera() as cam:\n yield cam\n\n\n@pytest.fixture(name=\"file_camera\", scope=\"module\")\ndef file_camera_fixture(application, file_camera_file):\n with application.create_file_camera(file_camera_file) as file_cam:\n yield file_cam\n\n\n@pytest.fixture(name=\"default_settings\", scope=\"module\")\ndef default_settings_fixture():\n return zivid.Settings(acquisitions=[zivid.Settings.Acquisition()])\n\n\n@pytest.fixture(name=\"default_settings_2d\", scope=\"module\")\ndef default_settings_2d_fixture():\n return zivid.Settings2D(acquisitions=[zivid.Settings2D.Acquisition()])\n\n\n@pytest.fixture(name=\"frame_file\", scope=\"module\")\ndef frame_file_fixture(application, file_camera, default_settings):\n with tempfile.TemporaryDirectory() as temp_dir:\n file_path = Path(temp_dir) / \"test_frame.zdf\"\n with file_camera.capture(default_settings) as frame:\n frame.save(file_path)\n yield file_path\n\n\n@pytest.fixture(name=\"checkerboard_frames\", scope=\"module\")\ndef checkerboard_frames_fixture(application):\n frames = [\n zivid.Frame(file_path)\n for file_path in sorted(_testdata_dir().glob(\"checkerboard_*.zdf\"))\n ]\n assert len(frames) == 3\n yield frames\n\n\n@pytest.fixture(name=\"calibration_board_frame\", scope=\"module\")\ndef calibration_board_frame_fixture(application):\n yield zivid.Frame(_testdata_dir() / \"ZVD-CB01.zdf\")\n\n\n@pytest.fixture(name=\"multicamera_transforms\", scope=\"module\")\ndef multicamera_transforms_fixture():\n transforms = [\n np.loadtxt(str(path), delimiter=\",\")\n for path in sorted(_testdata_dir().glob(\"multicamera_transform_*.csv\"))\n ]\n return transforms\n\n\n@pytest.fixture(name=\"handeye_eth_frames\", scope=\"module\")\ndef handeye_eth_frames_fixture(application):\n path = _testdata_dir() / \"handeye\" / \"eth\"\n frames = [zivid.Frame(file_path) for file_path in sorted(path.glob(\"*.zdf\"))]\n yield frames\n\n\n@pytest.fixture(name=\"frame\", scope=\"function\")\ndef frame_fixture(application, file_camera, default_settings):\n with file_camera.capture(default_settings) as frame:\n yield frame\n\n\n@pytest.fixture(name=\"frame_2d\", scope=\"function\")\ndef frame_2d_fixture(application, file_camera, default_settings_2d):\n with file_camera.capture(default_settings_2d) as frame2d:\n yield frame2d\n\n\n@pytest.fixture(name=\"point_cloud\", scope=\"function\")\ndef point_cloud_fixture(frame):\n with frame.point_cloud() as point_cloud:\n yield point_cloud\n\n\n@pytest.fixture(name=\"handeye_eth_poses\", scope=\"function\")\ndef handeye_eth_poses_fixture():\n path = _testdata_dir() / \"handeye\" / \"eth\"\n transforms = [\n np.loadtxt(str(path), delimiter=\",\") for path in sorted(path.glob(\"pos*.csv\"))\n ]\n return transforms\n\n\n@pytest.fixture(name=\"handeye_eth_transform\", scope=\"function\")\ndef handeye_eth_transform_fixture():\n path = _testdata_dir() / \"handeye\" / \"eth\" / \"eth_transform.csv\"\n return np.loadtxt(str(path), delimiter=\",\")\n\n\n@pytest.fixture(name=\"image_2d_rgba\", scope=\"function\")\ndef image_2d_rgba_fixture(frame_2d):\n with frame_2d.image_rgba() as image_2d_rgb:\n yield image_2d_rgb\n\n\n@pytest.fixture(name=\"image_2d_bgra\", scope=\"function\")\ndef image_2d_bgra_fixture(frame_2d):\n with frame_2d.image_bgra() as image_2d_bgr:\n yield image_2d_bgr\n\n\n@pytest.fixture(name=\"transform\", scope=\"function\")\ndef transform_fixture():\n return np.array(\n [\n [1.0, 0.0, 0.0, 10.0],\n [0.0, 0.0, -1.0, 20.0],\n [0.0, 1.0, 0.0, 30.0],\n [0.0, 0.0, 0.0, 1.0],\n ]\n )\n\n\n@pytest.fixture(name=\"file_camera_info\", scope=\"function\")\ndef file_camera_info_fixture(file_camera):\n yield file_camera.info\n\n\n@pytest.fixture(name=\"frame_info\", scope=\"function\")\ndef frame_info_fixture(frame):\n yield frame.info\n\n\n@pytest.helpers.register\ndef set_attribute_tester(settings_instance, member, value, expected_data_type):\n if not hasattr(settings_instance, member):\n raise RuntimeError(\n \"Settings instance {settings_instance} does not have the member: {member}\".format(\n settings_instance=settings_instance, member=member\n )\n )\n setattr(settings_instance, member, value)\n assert getattr(settings_instance, member) == value\n assert isinstance(getattr(settings_instance, member), expected_data_type)\n\n class DummyClass: # pylint: disable=too-few-public-methods\n pass\n\n with pytest.raises(TypeError):\n setattr(settings_instance, member, DummyClass())\n if expected_data_type in (int, float, numbers.Real):\n with pytest.raises(IndexError):\n setattr(settings_instance, member, 999999999)\n with pytest.raises(IndexError):\n setattr(settings_instance, member, -999999999)\n elif expected_data_type == bool:\n pass\n elif expected_data_type == list:\n with pytest.raises(TypeError):\n setattr(settings_instance, member, 1)\n with pytest.raises(TypeError):\n setattr(settings_instance, member, 1.0)\n with pytest.raises(TypeError):\n setattr(settings_instance, member, True)\n\n # Setter for list can also take a numpy array, but this should not change the getter's type\n setattr(settings_instance, member, np.array(value))\n assert isinstance(getattr(settings_instance, member), expected_data_type)\n else:\n with pytest.raises(TypeError):\n setattr(settings_instance, member, True)\n\n\n@pytest.helpers.register\ndef equality_tester(settings_type, value_collection_1, value_collection_2):\n instance_1 = settings_type(*value_collection_1)\n instance_2 = settings_type(*value_collection_1)\n assert instance_1 == instance_2\n\n instance_3 = settings_type(*value_collection_2)\n assert instance_1 != instance_3\n assert instance_3 != instance_2\n\n\nclass Cd:\n def __init__(self, new_path):\n self.new_path = new_path\n self.saved_path = None\n\n def __enter__(self):\n self.saved_path = os.getcwd()\n os.chdir(str(self.new_path))\n\n def __exit__(self, etype, value, traceback):\n os.chdir(str(self.saved_path))\n\n\n@pytest.helpers.register\ndef run_sample(name, working_directory=None):\n sample = (\n Path(__file__) / \"..\" / \"..\" / \"samples\" / \"sample_{name}.py\".format(name=name)\n ).resolve()\n\n if working_directory is not None:\n with Cd(working_directory):\n subprocess.check_output(\n args=(\n \"python\",\n str(sample),\n )\n )\n else:\n subprocess.check_output(\n args=(\n \"python\",\n str(sample),\n )\n )\n" }, { "alpha_fraction": 0.5401581525802612, "alphanum_fraction": 0.5534748435020447, "avg_line_length": 26, "blob_id": "098e53557ec528a2c4c12d20607c5ce6489dcf38", "content_id": "f91d4a20c92be17c014c434b00852e59cf48962d", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2403, "license_type": "permissive", "max_line_length": 114, "num_lines": 89, "path": "/modules/zivid/matrix4x4.py", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "\"\"\"Contains Matrix4x4 class.\"\"\"\nimport pathlib\nimport _zivid\n\n\nclass Matrix4x4(_zivid.Matrix4x4):\n \"\"\"Matrix of size 4x4 containing 32-bit floats.\"\"\"\n\n def __init__(self, arg=None):\n \"\"\"\n Overloaded constructor.\n\n Does different kinds of initializations depending on the argument:\n\n * None or no arguments -> Zero initializes all values.\n * 1 dimensional List or numpy.ndarray of 16 floats -> Map 1D array of 16 values into this 2D array of 4x4.\n * 2 dimensional List or numpy.ndarray of 4x4 floats -> Copy 2D array of size 4x4.\n * str or pathlib.Path -> Load the matrix from a file.\n\n Args:\n arg: Any of the above-mentioned.\n \"\"\"\n if arg is None:\n super().__init__()\n elif isinstance(arg, pathlib.Path):\n super().__init__(str(arg))\n else:\n super().__init__(arg)\n\n def inverse(self):\n \"\"\"\n Return the inverse of this matrix.\n\n An exception is thrown if the matrix is not invertible.\n\n Returns:\n A new matrix, holding the inverse\n \"\"\"\n return Matrix4x4(super().inverse())\n\n def load(self, file_path):\n \"\"\"\n Load the matrix from the given file.\n\n Args:\n file_path: path for the file to load the matrix from.\n \"\"\"\n super().load(str(file_path))\n\n def save(self, file_path):\n \"\"\"\n Save the matrix to the given file.\n\n Args:\n file_path: path for the new file to save the matrix in.\n \"\"\"\n super().save(str(file_path))\n\n def __getitem__(self, indexes):\n \"\"\"\n Access specified element with bounds checking.\n\n Args:\n indexes: a tuple of 2 integers as the indexes.\n\n Returns:\n The accessed item.\n \"\"\"\n return super()._getitem(indexes)\n\n def __iter__(self):\n \"\"\"\n Return an iterator to iterate all 16 elements as if this is a 1D array.\n\n Returns:\n the iterator.\n \"\"\"\n iterator = super().__iter__()\n return iterator\n\n def __setitem__(self, indexes, value):\n \"\"\"\n Set specified element with bounds checking.\n\n Args:\n indexes: a tuple of 2 integers as the indexes.\n value: value to set the specific item to.\n \"\"\"\n super()._setitem(indexes, value)\n" }, { "alpha_fraction": 0.6242424249649048, "alphanum_fraction": 0.6339393854141235, "avg_line_length": 38.28571319580078, "blob_id": "5f556bc4e878cb952b6f9999d0362dfbdf92d705", "content_id": "339a56ac8883c5651ee6f4b619b99de91551c84c", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 825, "license_type": "permissive", "max_line_length": 79, "num_lines": 21, "path": "/src/ReleasableFrame.cpp", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "#include <ZividPython/ReleasableFrame.h>\n\n#include <pybind11/pybind11.h>\n\nnamespace py = pybind11;\n\nnamespace ZividPython\n{\n void wrapClass(pybind11::class_<ReleasableFrame> pyClass)\n {\n pyClass.def(py::init())\n .def(py::init<const std::string &>(), py::arg(\"file_name\"))\n .def(\"save\", &ReleasableFrame::save, py::arg(\"file_name\"))\n .def(\"load\", &ReleasableFrame::load, py::arg(\"file_name\"))\n .def_property_readonly(\"settings\", &ReleasableFrame::settings)\n .def_property_readonly(\"state\", &ReleasableFrame::state)\n .def_property_readonly(\"info\", &ReleasableFrame::info)\n .def_property_readonly(\"camera_info\", &ReleasableFrame::cameraInfo)\n .def(\"point_cloud\", &ReleasableFrame::pointCloud);\n }\n} // namespace ZividPython\n" }, { "alpha_fraction": 0.7507987022399902, "alphanum_fraction": 0.7763578295707703, "avg_line_length": 27.454545974731445, "blob_id": "03dce429660c7469a5bc3dc2d8ee8d2cb82f62b2", "content_id": "7b7d77892974888109a87158b1c72457ceacd007", "detected_licenses": [ "BSD-3-Clause" ], "is_generated": false, "is_vendor": false, "language": "C++", "length_bytes": 313, "license_type": "permissive", "max_line_length": 86, "num_lines": 11, "path": "/src/include/ZividPython/Calibration/MultiCamera.h", "repo_name": "zivid/zivid-python", "src_encoding": "UTF-8", "text": "#pragma once\n\n#include <Zivid/Calibration/MultiCamera.h>\n\n#include <pybind11/pybind11.h>\n\nnamespace ZividPython\n{\n void wrapClass(pybind11::class_<Zivid::Calibration::MultiCameraResidual> pyClass);\n void wrapClass(pybind11::class_<Zivid::Calibration::MultiCameraOutput> pyClass);\n} // namespace ZividPython\n" } ]
152
rdweitzman/Parse-File-From-This
https://github.com/rdweitzman/Parse-File-From-This
dda21d8d5c8adb54df12f62b3a6f5dbb12f41644
d49f2b6cf20c3a91ef5aa30c5471a2b4ac02a2cf
fe0d96591915005b7366746b009a31c28b9cf3c0
refs/heads/master
2022-03-29T15:18:42.453143
2020-01-24T14:19:20
2020-01-24T14:19:20
null
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.7104499340057373, "alphanum_fraction": 0.7452830076217651, "avg_line_length": 38.371429443359375, "blob_id": "898f223149ff528bb307ad4d99e4d9754d81cc1c", "content_id": "78e03523f65108086174a10dffd5fe8f1212f09c", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 1378, "license_type": "no_license", "max_line_length": 278, "num_lines": 35, "path": "/README.md", "repo_name": "rdweitzman/Parse-File-From-This", "src_encoding": "UTF-8", "text": "# Parse-File-From-This\n\nA simple parser for any text file. Just give the input file, define what you want and get the corresponding output...\n\n## Usage\n\n`python parser.py file_name parse_by_string index_of_wanted_part`\n\n- file_name : the file you want to parse\n- parse_by_string : define any text that you want to get in that line\n- index_of_wanted_part : each word in the line corresponds to some index, define which word you want by typing the index\n\n## Example Input\n\n<br/>\n\n![img](https://i.ibb.co/7Q45WV5/parser-input.jpg)\n\nFor this example, we have the output of the work done by the genetic algorithm. We have 100 different solutions and 100 different average fitness values. But we want to get all average fitness values and plot it in somewhere else. How we do we get it? Yes, by using this parser.\n\nLets define the parameters...\n\n- file_name : solution_030.txt_100_100_0.5_0.001.txt\n- parse_by_string : Average\n- index_of_wanted_part : 4\n\nSince I want the numbers that are defined for average fitness values, my parse_by_string will be 'Average'. And, I want the numbers that are indexed at 4(0 is the 'Average', 1 is the 'solution', etc.).\n\n## Example Output\n\nAfter we run the parser with these parameters, we get the following output text file:\n\n`python parser.py solution_030.txt_100_100_0.5_0.001.txt Average 4`\n\n![img](https://i.ibb.co/5W45DRW/parser-output.jpg)\n" }, { "alpha_fraction": 0.6167629957199097, "alphanum_fraction": 0.6208092570304871, "avg_line_length": 29.35087776184082, "blob_id": "8867c5d9d8322e23e1a7e9e12ecb6684b03252ba", "content_id": "73531a80a1a7e68cfd6e295d7585102bfec7f3b5", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1730, "license_type": "no_license", "max_line_length": 113, "num_lines": 57, "path": "/parser.py", "repo_name": "rdweitzman/Parse-File-From-This", "src_encoding": "UTF-8", "text": "import sys\nimport os\n\n\ndef read_file(file_name, parse_by_string, index_of_wanted_part):\n output_list = []\n\n with open(file_name, 'r') as file:\n for line in file:\n # Read the line and remove the newline character at the end\n line = line.rstrip('\\n\\r')\n\n # If the desired string is in this line, we split it and put it in output_list with index provided...\n if parse_by_string in line:\n line = line.split()\n output_list.append(line[index_of_wanted_part])\n\n # Close the file...\n file.close()\n\n return output_list\n\n\ndef write_to_file(file_name, output_list):\n output_file_name = \"parsed_\" + file_name\n file = open(output_file_name, 'w')\n\n for element in output_list:\n file.write(\"{}\\n\".format(element))\n\n # Lastly, we will delete the last line from the file, because it's empty.\n file.seek(file.tell() - 2, os.SEEK_SET)\n file.truncate()\n\n # Close the file...\n file.close()\n\n\nif __name__ == '__main__':\n\n # Checking if the program has run with the CORRECT NUMBER of command-line arguments...\n if len(sys.argv) != 4:\n print(\"You didn't run the program with the CORRECT NUMBER of command-line arguments!\")\n print(\"Usage: python parser.py file_name parse_by_string index_of_wanted_part\")\n exit(-1)\n\n file_name = sys.argv[1]\n parse_by_string = sys.argv[2]\n index_of_wanted_part = sys.argv[3]\n\n # Check if that file exists...\n if not os.path.isfile(file_name):\n print(\"Cannot found file with the filename you provided!\")\n exit(-1)\n\n output_list = read_file(file_name, parse_by_string, int(index_of_wanted_part))\n write_to_file(file_name, output_list)\n" } ]
2
actor168/dict_iciba
https://github.com/actor168/dict_iciba
2d5abf85e5c6e8db0038849317466970007573b2
79052150cdbe93a9c78cf457fc5437c1d85b301a
7ca5d59cd44a18feb78ad6212101c1950b4a4a6d
refs/heads/master
2021-01-10T14:50:57.849876
2016-03-20T10:06:43
2016-03-20T10:06:43
54,310,794
1
1
null
null
null
null
null
[ { "alpha_fraction": 0.5247592926025391, "alphanum_fraction": 0.5330123901367188, "avg_line_length": 21.71875, "blob_id": "47e181740d33195455c30a7cab4c6d30731d3882", "content_id": "3b8eb6c3983418a0eb32cbc7c8a41d01df6c8981", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1654, "license_type": "no_license", "max_line_length": 93, "num_lines": 64, "path": "/dict.py", "repo_name": "actor168/dict_iciba", "src_encoding": "UTF-8", "text": "__author__ = 'actor168'\n# -*- coding:utf-8 -*-\nimport urllib\nimport urllib2\nimport re\n\n\n\n#使用爱词霸查询单词中文意思\nclass DICT:\n\n #初始化,传入基地址\n def __init__(self,baseUrl):\n #base链接地址\n self.baseURL = baseUrl\n\n #传入页码,获取该页帖子的代码\n def getPage(self):\n try:\n #构建URL\n url = self.baseURL\n request = urllib2.Request(url)\n response = urllib2.urlopen(request)\n #返回UTF-8格式编码内容\n return response.read().decode('utf-8')\n #无法连接,报错\n except urllib2.URLError, e:\n if hasattr(e,\"reason\"):\n print u\"连接失败,错误原因\",e.reason\n\t return None\n\n \n def getContent(self,page):\n #匹配所有楼层的内容\n pattern = re.compile('<span class='+\"'\"+'prop'+\"'\"+'>.*?</span>.*?<p>(.*?)</p>',re.S)\n result = re.search(pattern,page)\n \tif result:\n #print result.group(1) #测试输出\n \treturn result.group(1).strip()\n \telse:\n \treturn None\n\n\n def writeData(self,contents):\n #向文件写入每一楼的信息\n print contents;\n\n\n def start(self):\n try:\n\t page = self.getPage();\n contents = self.getContent(page)\n self.writeData(contents)\n #出现异常\n except IOError,e:\n print \"查询异常,原因\" + e.message\n finally:\n print \"------\"\n\t \n\nprint u\"please input\"\nbaseURL = 'http://www.iciba.com/' + str(raw_input(u'http://www.iciba.com/'))\ndict_ac = DICT(baseURL)\ndict_ac.start()\n" }, { "alpha_fraction": 0.8392857313156128, "alphanum_fraction": 0.8392857313156128, "avg_line_length": 17.66666603088379, "blob_id": "13822c304af7688b39298dc66bf4d07604ed849b", "content_id": "657b3a2af39cce113e9778e7255995068b2c036c", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 128, "license_type": "no_license", "max_line_length": 31, "num_lines": 3, "path": "/README.md", "repo_name": "actor168/dict_iciba", "src_encoding": "UTF-8", "text": "# dict_iciba\n非常方便的linux命令行英文翻译器,能够让你方便的进行翻译。\n单词意思来源:爱词霸\n" } ]
2
JadeNeoma/tetration
https://github.com/JadeNeoma/tetration
a9a8b5050b92261ab0a0d1cdd088a72af814e673
5538604c7d6f6f3df57c5c023e5b009f52ca1ef9
ea3e7d6428e455907c634f19335e0a6b5dc9bc3a
refs/heads/master
2022-09-08T21:23:25.711529
2020-06-01T17:00:54
2020-06-01T17:00:54
null
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.5920436978340149, "alphanum_fraction": 0.6045241951942444, "avg_line_length": 31.049999237060547, "blob_id": "3d11c1a8d210fff9e6e1d923859a3abd5bcf8e58", "content_id": "6967cdf4bba9a4a2f7268fdf85f19d623dff898b", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2564, "license_type": "no_license", "max_line_length": 106, "num_lines": 80, "path": "/tetration.py", "repo_name": "JadeNeoma/tetration", "src_encoding": "UTF-8", "text": "# This program calculates y = x|k,\n# Warning:\n# There is no timeout so be careful what you pass it\n\nimport argparse\nfrom varname import nameof\n\n\ndef find_k(y, x): # as yet not finished so don't use\n print(\"Not implemented, Don't use\")\n return None\n\n\ndef calc_x(y, k): # calculates x given y and k, linear search up from 1 to 5 and from -1 to -5\n found = False\n for x in range(1, 6):\n if y == calc_y(x, k):\n out = x\n found = True\n break\n elif y == calc_y(x * -1, k):\n out = x * -1\n found = True\n break\n if found:\n return x\n else:\n return None\n\n\ndef calc_y(x, k): # calculate y = x|k\n y = 1\n if k < 0 or x == 0:\n raise ValueError(\"x or k value not allowed\")\n elif k > 0:\n y = x ** calc_y(x, k - 1)\n return y\n\n\ndef console_converter(default, name, needed):\n if needed: # get value from user, assuming it hasn't already been given\n assign = int(input(\"Please enter \" + name + \": \"))\n return assign\n else: # if user has already provided value in command line\n return default\n\n\ndef calc(p, q):\n return calc_y(p, q) # used to set calc() to default to calc_y()\n\n\ndef main():\n # parse all command line variables\n parser = argparse.ArgumentParser()\n parser.add_argument(\"num1\", type=int, nargs='?', const=0)\n parser.add_argument(\"num2\", type=int, nargs='?', const=0)\n parser.add_argument('-x', '--calculate_x', action='store_true', help=\"allows finding of x\")\n parser.add_argument('-y', '--calculate_y', action='store_true', help=\"allows finding of x\")\n args = parser.parse_args()\n\n # find out if variables are needed from the user, its all or nothing btw\n needed = args.num2 is None\n\n # get option from user if needed\n m = console_converter(0, \"\\n0 to calculate y given x & k\\n1 to calculate x given y & k\\n\", needed)\n\n # calculate various values give options, getting user input if needed\n if args.calculate_x or m == 1: # if option = 1\n out = calc_x(console_converter(args.num1, \"y\", needed), console_converter(args.num2, \"k\", needed))\n elif args.calculate_y or m == 0: # if option = 0\n out = calc_y(console_converter(args.num1, \"x\", needed), console_converter(args.num2, \"k\", needed))\n else: # defaults to option = 0, included twice for completeness\n out = calc(console_converter(args.num1, \"x\", needed), console_converter(args.num2, \"k\", needed))\n\n # print the answer\n print(out)\n\n\nif __name__ == \"__main__\":\n main()\n" }, { "alpha_fraction": 0.7345207929611206, "alphanum_fraction": 0.7446988821029663, "avg_line_length": 50.260868072509766, "blob_id": "a308a15600955fe1268ac3703bd2c8a24f88ddc8", "content_id": "584bf38c87fe476840a4b63229b93c500f91fdf5", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 1179, "license_type": "no_license", "max_line_length": 287, "num_lines": 23, "path": "/README.md", "repo_name": "JadeNeoma/tetration", "src_encoding": "UTF-8", "text": "# Tetration\nSo this is just a simple python script that calculates y = <sup>x</sup>K.\nThis is done in a way that isn't packaged but can be easily imported into other projects. Tetration.py is safe to import, it can also be run from the commandline with the arguments x and k respectively, or it can just be run in which case it will prompt for x and k within the program. \n\n## Use\n### Imported:\n* tetration.calc(x, k) is the same as tetration.calc_y(x, k)\n* tetration.calc_y(x, k) returns y\n* tetration.calc_x(y, k) returns x, tests between -5 and 5, excl. 0, returns None if not found\n\n### Run from console:\n* Self-Explanatory, option 1 tests between -5 and 5 excl. 0\n\n### Run from Command Line:\n* takes two required arguments\n* defaults to calculating y assuming the required arguments are x and n respectively\n* can be forced to find x by ending with -x\n* can be forced to find y by ending with -y, included for completeness\n\n## Warning\n1. I haven't included a timeout, if you enter numbers to big for your computer to handle it will hang.\n2. x can be any integers apart from 0, beware negative numbers could result in complex results.\n3. k can be any integer greater than 0\n" } ]
2
dragon1970/security
https://github.com/dragon1970/security
fe522c1832119fc2bb0655cccf1423dfd71f6616
3ee116c66436600a32376062a5e8d6ebb1389945
09346c797259b0b3e95c8ff83640586b8cefea35
refs/heads/master
2022-12-26T21:39:39.148504
2020-10-12T13:28:53
2020-10-12T13:28:53
299,334,512
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.5113636255264282, "alphanum_fraction": 0.5340909361839294, "avg_line_length": 21.14285659790039, "blob_id": "e76d4f3e5b3daadbb21b426e921c26589cfba67b", "content_id": "a6e8667a12eeca70d175897131b307170bdbca6e", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 176, "license_type": "no_license", "max_line_length": 38, "num_lines": 7, "path": "/geoip.py", "repo_name": "dragon1970/security", "src_encoding": "UTF-8", "text": "\r\n\r\nimport requests\r\n\r\nip = \"1.2.3.4\"\r\nurl = \"http://ipinfo.io/\"+ip\r\nr = requests.get(url)\r\nprint(\"country:\", r.json()[\"country\"])\r\nprint(\"city:\", r.json()[\"city\"])\r\n\r\n\r\n\r\n\r\n\r\n" }, { "alpha_fraction": 0.7019230723381042, "alphanum_fraction": 0.7211538553237915, "avg_line_length": 27.714284896850586, "blob_id": "6335d01039787e08ec72d91de32719ef2dbf7698", "content_id": "36e90606dc123c29ceb2b3ea64fce2f1fdc0dd22", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 208, "license_type": "no_license", "max_line_length": 134, "num_lines": 7, "path": "/python_nmap.py", "repo_name": "dragon1970/security", "src_encoding": "UTF-8", "text": "\"\"\"\r\n https://pypi.org/project/python3-nmap/\r\n Python3-nmap converts Nmap commands into python3 methods making it very easy to use nmap in any of your python pentesting projects\r\n\r\n\"\"\"\r\n\r\nimport nmap3\r\n" }, { "alpha_fraction": 0.7866666913032532, "alphanum_fraction": 0.7866666913032532, "avg_line_length": 34.5, "blob_id": "37d738fee58ea549066af3fc4118c92ef182719d", "content_id": "288a3d3bd67dc71ac899cfa66f2a179444d1dca6", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 75, "license_type": "no_license", "max_line_length": 56, "num_lines": 2, "path": "/whois_query.md", "repo_name": "dragon1970/security", "src_encoding": "UTF-8", "text": "\r\n# whois query\r\nquerying and parsing of domain registration information.\r\n" }, { "alpha_fraction": 0.557758629322052, "alphanum_fraction": 0.626724123954773, "avg_line_length": 25.619047164916992, "blob_id": "b77f2c0bb60c20ecf5faa4aaf7a26378a0e355af", "content_id": "af5b9ed8fc1834072271bffb4c51d86d70d0cc08", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1160, "license_type": "no_license", "max_line_length": 65, "num_lines": 42, "path": "/whois_query.py", "repo_name": "dragon1970/security", "src_encoding": "UTF-8", "text": "# https://pypi.org/project/whois/ \r\n# environment: python wrap of linux whois\r\n\"\"\"\r\n>>> import whois\r\n>>> domain = whois.query('google.com')\r\n\r\n>>> print(domain.__dict__)\r\n{\r\n 'expiration_date': datetime.datetime(2020, 9, 14, 0, 0),\r\n 'last_updated': datetime.datetime(2011, 7, 20, 0, 0),\r\n 'registrar': 'MARKMONITOR INC.',\r\n 'name': 'google.com',\r\n 'creation_date': datetime.datetime(1997, 9, 15, 0, 0)\r\n}\r\n\r\n>>> print(domain.name)\r\ngoogle.com\r\n\r\n>>> print(domain.expiration_date)\r\n2020-09-14 00:00:00\r\n\r\n\"\"\"\r\n\r\n# https://pypi.org/project/python-whois/\r\n# os independent\r\n\"\"\"\r\n$ pip install python-whois\r\n>>> import whois\r\n>>> w = whois.whois('webscraping.com')\r\n>>> w.expiration_date # dates converted to datetime object\r\ndatetime.datetime(2013, 6, 26, 0, 0)\r\n>>> w.text # the content downloaded from whois server\r\nu'\\nWhois Server Version 2.0\\n\\nDomain names in the .com and .net\r\n...'\r\n\r\n>>> print w # print values of all found attributes\r\ncreation_date: 2004-06-26 00:00:00\r\ndomain_name: [u'WEBSCRAPING.COM', u'WEBSCRAPING.COM']\r\nemails: [u'WEBSCRAPING.COM@domainsbyproxy.com', u'WEBSCRAPING.COM@domainsbyproxy.com']\r\nexpiration_date: 2013-06-26 00:00:00\r\n... \r\n\"\"\"\r\n" } ]
4
samdale67/payne-gap-cemetery
https://github.com/samdale67/payne-gap-cemetery
49dedd9a5c59e870c2822f68a4dbb246fa5547b8
0a172d5de352dabf0881dd8d5e99eae68273bea3
39346f10069713636d74db38a16812c35d6767d0
refs/heads/master
2022-11-24T21:59:45.295207
2020-07-31T19:00:19
2020-07-31T19:00:19
284,109,006
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.8152173757553101, "alphanum_fraction": 0.8152173757553101, "avg_line_length": 17.399999618530273, "blob_id": "f76403f92b9b3984eb466b6619c06bf93492afa3", "content_id": "9b2a981dea4761c1578883275698a394cada6a70", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 92, "license_type": "no_license", "max_line_length": 32, "num_lines": 5, "path": "/the_dead/admin.py", "repo_name": "samdale67/payne-gap-cemetery", "src_encoding": "UTF-8", "text": "from django.contrib import admin\nfrom .models import theDead\n\n\nadmin.site.register(theDead)\n" }, { "alpha_fraction": 0.5251141786575317, "alphanum_fraction": 0.6027397513389587, "avg_line_length": 23.33333396911621, "blob_id": "d4cd5ba02d39bba19c40db17009a6daea606f422", "content_id": "8eb862113d469d89ff8e547473bb917b80035ce8", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 438, "license_type": "no_license", "max_line_length": 94, "num_lines": 18, "path": "/the_dead/migrations/0005_thedead_grave_location.py", "repo_name": "samdale67/payne-gap-cemetery", "src_encoding": "UTF-8", "text": "# Generated by Django 3.0.7 on 2020-06-07 16:53\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('the_dead', '0004_auto_20200607_1651'),\n ]\n\n operations = [\n migrations.AddField(\n model_name='thedead',\n name='grave_location',\n field=models.CharField(default='', max_length=255, verbose_name='Grave Location'),\n ),\n ]\n" }, { "alpha_fraction": 0.7444444298744202, "alphanum_fraction": 0.7444444298744202, "avg_line_length": 17, "blob_id": "213207a2afc4d1400c9cebf16b487e68c898f765", "content_id": "4c2125a375ed380d891c8aa6b1fa661e42cf96e8", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 90, "license_type": "no_license", "max_line_length": 33, "num_lines": 5, "path": "/the_dead/apps.py", "repo_name": "samdale67/payne-gap-cemetery", "src_encoding": "UTF-8", "text": "from django.apps import AppConfig\n\n\nclass TheDeadConfig(AppConfig):\n name = 'the_dead'\n" }, { "alpha_fraction": 0.54347825050354, "alphanum_fraction": 0.5554347634315491, "avg_line_length": 50.11111068725586, "blob_id": "3f53b4af6d8f0eb0dc60f2d80124fa703f885d1b", "content_id": "790cbf26acf2363bb242eca97be348b90f7dc1c9", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1840, "license_type": "no_license", "max_line_length": 107, "num_lines": 36, "path": "/the_dead/models.py", "repo_name": "samdale67/payne-gap-cemetery", "src_encoding": "UTF-8", "text": "from django.db import models\n\n\nclass theDead(models.Model):\n last_name = models.CharField('Last Name', max_length=255, blank=False)\n maiden_name = models.CharField('Maiden Name', max_length=255, blank=True)\n first_name = models.CharField('First Name', max_length=255, blank=True)\n nick_name = models.CharField('Nick Name', max_length=255, blank=True)\n birth_date = models.DateField('Birth Date', blank=True)\n death_date = models.DateField('Death Date', blank=True)\n website = models.URLField('Website',\n max_length=255,\n blank=True,\n help_text='Add website describing or providing more information about the '\n 'person.')\n description = models.TextField('Description', max_length=3000, blank=True)\n # grave_image = models.ForeignKey('GraveImage',\n # related_name='collections',\n # verbose_name=u'Grave Images',\n # on_delete=models.CASCADE,\n # blank=True,\n # null=True,\n # help_text='Upload images showing details of grave or tombstone.')\n grave_location = models.CharField('Grave Coordinate', max_length=255, default='', blank=False)\n monument = models.BooleanField('Monument?', blank=False, help_text=\"Does the grave include a monument \"\n \"or tombstone?\")\n date_created = models.DateField(auto_now_add=True)\n date_saved = models.DateField(auto_now=True)\n\n def __str__(self):\n return self.last_name\n\n class Meta:\n verbose_name = 'The Dead'\n verbose_name_plural = 'The Dead'\n ordering = ['last_name']\n" }, { "alpha_fraction": 0.5766738653182983, "alphanum_fraction": 0.6177105903625488, "avg_line_length": 24.72222137451172, "blob_id": "2a4a061b4757b0e8ee8127b681b834888dbe42e5", "content_id": "cfc9b0637dbfad73d6724f0f68a12ad0bc8bad96", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 463, "license_type": "no_license", "max_line_length": 125, "num_lines": 18, "path": "/the_dead/migrations/0009_auto_20200609_1358.py", "repo_name": "samdale67/payne-gap-cemetery", "src_encoding": "UTF-8", "text": "# Generated by Django 3.0.7 on 2020-06-09 13:58\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('the_dead', '0008_thedead_monument'),\n ]\n\n operations = [\n migrations.AlterField(\n model_name='thedead',\n name='monument',\n field=models.BooleanField(help_text='Does the grave include a monument or tombstone?', verbose_name='Monument?'),\n ),\n ]\n" }, { "alpha_fraction": 0.5896414518356323, "alphanum_fraction": 0.6334661245346069, "avg_line_length": 26.88888931274414, "blob_id": "a7a1d88a080b12fde21a6f628fd4760a1b782f5e", "content_id": "d2a5e44c72ea8f58101011529b61c80c9a7d098c", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 502, "license_type": "no_license", "max_line_length": 174, "num_lines": 18, "path": "/the_dead/migrations/0002_auto_20200607_1648.py", "repo_name": "samdale67/payne-gap-cemetery", "src_encoding": "UTF-8", "text": "# Generated by Django 3.0.7 on 2020-06-07 16:48\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('the_dead', '0001_initial'),\n ]\n\n operations = [\n migrations.AlterField(\n model_name='thedead',\n name='website',\n field=models.URLField(blank=True, help_text='Add website describing or providing more information about the collection.', max_length=255, verbose_name='Website'),\n ),\n ]\n" }, { "alpha_fraction": 0.5677799582481384, "alphanum_fraction": 0.6345776319503784, "avg_line_length": 27.27777862548828, "blob_id": "db0872a1bc8bb19c6206862c368d84b7f0cf8d30", "content_id": "7d45d67ebfdeaa6f7d6bdf0da0249d192aa5c4a2", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 509, "license_type": "no_license", "max_line_length": 170, "num_lines": 18, "path": "/the_dead/migrations/0007_auto_20200608_2234.py", "repo_name": "samdale67/payne-gap-cemetery", "src_encoding": "UTF-8", "text": "# Generated by Django 3.0.7 on 2020-06-08 22:34\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('the_dead', '0006_auto_20200607_1728'),\n ]\n\n operations = [\n migrations.AlterField(\n model_name='thedead',\n name='website',\n field=models.URLField(blank=True, help_text='Add website describing or providing more information about the person.', max_length=255, verbose_name='Website'),\n ),\n ]\n" }, { "alpha_fraction": 0.5308343172073364, "alphanum_fraction": 0.5792019367218018, "avg_line_length": 28.535715103149414, "blob_id": "12ee9c0c0c88319b14786307822f79315d34034e", "content_id": "5e982c7e6867d383827f331ab338bee252661e6d", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 827, "license_type": "no_license", "max_line_length": 91, "num_lines": 28, "path": "/the_dead/migrations/0003_auto_20200607_1650.py", "repo_name": "samdale67/payne-gap-cemetery", "src_encoding": "UTF-8", "text": "# Generated by Django 3.0.7 on 2020-06-07 16:50\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('the_dead', '0002_auto_20200607_1648'),\n ]\n\n operations = [\n migrations.AddField(\n model_name='thedead',\n name='nick_name',\n field=models.CharField(blank=True, max_length=255, verbose_name='First Name'),\n ),\n migrations.AlterField(\n model_name='thedead',\n name='first_name',\n field=models.CharField(blank=True, max_length=255, verbose_name='First Name'),\n ),\n migrations.AlterField(\n model_name='thedead',\n name='maiden_name',\n field=models.CharField(blank=True, max_length=255, verbose_name='Maiden Name'),\n ),\n ]\n" }, { "alpha_fraction": 0.5542005300521851, "alphanum_fraction": 0.5752032399177551, "avg_line_length": 42.411766052246094, "blob_id": "2193f4aa94462b99d2c12f629577c9426bda2f91", "content_id": "9e69dc7844e46c163c6024e6257dd31d2f622f17", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1476, "license_type": "no_license", "max_line_length": 172, "num_lines": 34, "path": "/the_dead/migrations/0001_initial.py", "repo_name": "samdale67/payne-gap-cemetery", "src_encoding": "UTF-8", "text": "# Generated by Django 3.0.7 on 2020-06-07 16:44\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n initial = True\n\n dependencies = [\n ]\n\n operations = [\n migrations.CreateModel(\n name='theDead',\n fields=[\n ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),\n ('last_name', models.CharField(max_length=255, verbose_name='Last Name')),\n ('maiden_name', models.CharField(max_length=255, verbose_name='Maiden Name')),\n ('first_name', models.CharField(max_length=255, verbose_name='First Name')),\n ('birth_date', models.DateField(blank=True, verbose_name='Birth Date')),\n ('death_date', models.DateField(blank=True, verbose_name='Death Date')),\n ('description', models.TextField(blank=True, max_length=3000, verbose_name='Description')),\n ('website', models.URLField(blank=True, help_text='Add website describing or providing access to the collection.', max_length=255, verbose_name='Website')),\n ('date_created', models.DateField(auto_now_add=True)),\n ('date_saved', models.DateField(auto_now=True)),\n ],\n options={\n 'verbose_name': 'The Dead',\n 'verbose_name_plural': 'The Dead',\n 'ordering': ['last_name'],\n },\n ),\n ]\n" }, { "alpha_fraction": 0.5209302306175232, "alphanum_fraction": 0.6000000238418579, "avg_line_length": 22.88888931274414, "blob_id": "154a2628571d899f1ce1fe56e3391910ca314fd0", "content_id": "54c15db8d7851fd75efcea8ec7ee6fb413e32e94", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 430, "license_type": "no_license", "max_line_length": 89, "num_lines": 18, "path": "/the_dead/migrations/0004_auto_20200607_1651.py", "repo_name": "samdale67/payne-gap-cemetery", "src_encoding": "UTF-8", "text": "# Generated by Django 3.0.7 on 2020-06-07 16:51\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('the_dead', '0003_auto_20200607_1650'),\n ]\n\n operations = [\n migrations.AlterField(\n model_name='thedead',\n name='nick_name',\n field=models.CharField(blank=True, max_length=255, verbose_name='Nick Name'),\n ),\n ]\n" }, { "alpha_fraction": 0.560538113117218, "alphanum_fraction": 0.6098654866218567, "avg_line_length": 23.77777862548828, "blob_id": "e6a7fd4ffa1c257d9414f2017631f702f38cfc71", "content_id": "042eaf244f6cfd7e1ee4d84f8f8125f76e423987", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 446, "license_type": "no_license", "max_line_length": 96, "num_lines": 18, "path": "/the_dead/migrations/0006_auto_20200607_1728.py", "repo_name": "samdale67/payne-gap-cemetery", "src_encoding": "UTF-8", "text": "# Generated by Django 3.0.7 on 2020-06-07 17:28\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('the_dead', '0005_thedead_grave_location'),\n ]\n\n operations = [\n migrations.AlterField(\n model_name='thedead',\n name='grave_location',\n field=models.CharField(default='', max_length=255, verbose_name='Grave Coordinate'),\n ),\n ]\n" }, { "alpha_fraction": 0.5265486836433411, "alphanum_fraction": 0.5951327681541443, "avg_line_length": 22.789474487304688, "blob_id": "a4431c1f18cad984031420d54fbd8b800d362ada", "content_id": "594d51cbbbf5cf41bcd36878c8b9dc45ab8731aa", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 452, "license_type": "no_license", "max_line_length": 78, "num_lines": 19, "path": "/the_dead/migrations/0008_thedead_monument.py", "repo_name": "samdale67/payne-gap-cemetery", "src_encoding": "UTF-8", "text": "# Generated by Django 3.0.7 on 2020-06-09 13:57\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('the_dead', '0007_auto_20200608_2234'),\n ]\n\n operations = [\n migrations.AddField(\n model_name='thedead',\n name='monument',\n field=models.BooleanField(default=True, verbose_name='Monument?'),\n preserve_default=False,\n ),\n ]\n" } ]
12
Diogo-Esteves/my-first-blog
https://github.com/Diogo-Esteves/my-first-blog
4ac9ec4dc983e4b070ee9c83ee3f61a23ca78863
046ea03ba6c6c6144e46f066f1dd62ed69bb5769
fa8ea34fe6df7fa93193378ebe7db67b389674cb
refs/heads/master
2021-10-10T09:31:15.909571
2019-01-05T22:41:25
2019-01-05T22:41:25
139,857,925
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.37037035822868347, "alphanum_fraction": 0.6666666865348816, "avg_line_length": 12.5, "blob_id": "c0efedda92e991ac0e7cb7900fd4d7bdd01f4e82", "content_id": "f51da2a428355fd99d78042b255cb533b7235515", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Text", "length_bytes": 27, "license_type": "no_license", "max_line_length": 13, "num_lines": 2, "path": "/requirements.txt", "repo_name": "Diogo-Esteves/my-first-blog", "src_encoding": "UTF-8", "text": "django==1.9.7\npytz==2018.5\n" }, { "alpha_fraction": 0.7368420958518982, "alphanum_fraction": 0.7368420958518982, "avg_line_length": 24.66666603088379, "blob_id": "3fac35c189f51279cebefa40a2dc81a760b7b338", "content_id": "b38311dd03b063689085ceabbdde7dcbdd3cddaf", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 76, "license_type": "no_license", "max_line_length": 55, "num_lines": 3, "path": "/README.md", "repo_name": "Diogo-Esteves/my-first-blog", "src_encoding": "UTF-8", "text": "# Meu primeiro blog\n\nAprendendo como criar um blog com django, html, css ..." }, { "alpha_fraction": 0.6612499952316284, "alphanum_fraction": 0.6650000214576721, "avg_line_length": 37.14285659790039, "blob_id": "6cee4b10d3624c693b62b940195af19db79fd463", "content_id": "bc4d4e1b0e1ba3401382ee56ebcb0080f7d3efb7", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 803, "license_type": "no_license", "max_line_length": 100, "num_lines": 21, "path": "/blog/blog/models.py", "repo_name": "Diogo-Esteves/my-first-blog", "src_encoding": "UTF-8", "text": "from django.db import models\nfrom django.utils import timezone\n\n# Create your models here.\n\nclass Post(models.Model):\n #Definindo um objeto de nome \"Post\" *sempre iniciar classe com letra maiuscula\n\n author = models.ForeignKey('auth.User',on_delete=models.CASCADE) #link para outro modelo\n title = models.CharField(max_length=200) #delimitando numeros de caracteres\n text = models.TextField() #não tem limites de caracteres\n created_date = models.DateTimeField( default=timezone.now ) #hora e data\n published_date = models.DateTimeField( blank = True, null = True )\n\n def publish(self):\n #função de nome publish\n self.published_date = timezone.now()\n self.save()\n\n def __str__(self):\n return self.title" } ]
3
apurvdhadankar/face-detection
https://github.com/apurvdhadankar/face-detection
2d8e1ad6c3e4ed0e10e7fdcf985d77e06091b6b9
67bc7f1dadf2398718a29190576969ba9255492c
b601ce437b79aced9c50b19a086a887de87bcfd7
refs/heads/master
2022-11-29T20:16:17.892382
2020-08-14T17:07:51
2020-08-14T17:07:51
256,932,431
1
0
null
null
null
null
null
[ { "alpha_fraction": 0.6108843684196472, "alphanum_fraction": 0.6612244844436646, "avg_line_length": 21.645160675048828, "blob_id": "75921b85aec8368b0dad1f6b99a82dbd13ad3ae3", "content_id": "f0b2269ca641e48b8198c58285886822b5fa1952", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 735, "license_type": "no_license", "max_line_length": 75, "num_lines": 31, "path": "/camera_click_photo.py", "repo_name": "apurvdhadankar/face-detection", "src_encoding": "UTF-8", "text": "import cv2\r\n\r\n# Load the cascade\r\nface_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')\r\ncap = cv2.VideoCapture(0)\r\n\r\n\r\nstatus, photo = cap.read()\r\n\r\ncv2.imwrite('myimg.png', photo)\r\ncap.release()\r\n\r\n# Read the input image\r\nphoto = cv2.imread('myimg.png')\r\n\r\n# Convert into grayscale\r\ngray = cv2.cvtColor(photo, cv2.COLOR_BGR2GRAY)\r\n\r\n# Detect faces\r\nfaces = face_cascade.detectMultiScale(gray, 1.1, 4)\r\n\r\n# Draw rectangle around the faces\r\nfor (x, y, w, h) in faces:\r\n cv2.rectangle(photo, (x, y), (x + w, y + h), (255, 0, 0), 2)\r\n\r\n# Display the output\r\n#photo[200:300]=[0,255,0] # to change color of photo in rowise\r\ncv2.imshow('my image', photo)\r\ncv2.waitKey(5000)\r\n \r\ncv2.destroyAllWindows()\r\n\r\n" }, { "alpha_fraction": 0.577464759349823, "alphanum_fraction": 0.6244131326675415, "avg_line_length": 24.6875, "blob_id": "b400e63fdc9ed21d9962c0d8b11ad36421e665ba", "content_id": "87ef96471eae264d0a93e56c0c608339c1dd04e7", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 852, "license_type": "no_license", "max_line_length": 94, "num_lines": 32, "path": "/detect_face_video.py", "repo_name": "apurvdhadankar/face-detection", "src_encoding": "UTF-8", "text": "import cv2\r\n\r\n# Load the cascade\r\nface_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')\r\n\r\n# To capture video from webcam. \r\ncap = cv2.VideoCapture(0)\r\n# To use a video file as input \r\n# cap = cv2.VideoCapture('filename.mp4')\r\nwhile True:\r\n\r\n status, photo = cap.read()\r\n\r\n # Convert to grayscale\r\n gray = cv2.cvtColor(photo, cv2.COLOR_BGR2GRAY)\r\n\r\n # Detect the faces\r\n faces = face_cascade.detectMultiScale(gray, 1.1, 4)\r\n\r\n # Draw the rectangle around each face\r\n for (x, y, w, h) in faces:\r\n cv2.rectangle(photo, (x, y), (x+w, y+h), (255, 0, 0), 2)\r\n\r\n\r\n cv2.putText(photo, \"Hey What's up\", (250, 450), cv2.FONT_HERSHEY_COMPLEX, 1, (0,255,0), 2)\r\n cv2.imshow('hi', photo)\r\n \r\n if cv2.waitKey(1) == 13: #press Enter key to close\r\n break\r\n\r\ncv2.destroyAllWindows()\r\ncap.release()" }, { "alpha_fraction": 0.6307692527770996, "alphanum_fraction": 0.6571428775787354, "avg_line_length": 25.42424201965332, "blob_id": "0ab784c22ee35838e2971ee1d91ef7ec0bf9680e", "content_id": "a8bb71c78f0563406c180aec96ecc76963443c24", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 910, "license_type": "no_license", "max_line_length": 82, "num_lines": 33, "path": "/car/car_detection.py", "repo_name": "apurvdhadankar/face-detection", "src_encoding": "UTF-8", "text": "import cv2\r\n\r\n# Capture frames from video\r\ncap = cv2.VideoCapture('video.avi')\r\n\r\n# Trained XML classifiers describes some featurs of some object we want to detect\r\ncar_cascade = cv2.CascadeClassifier('cars.xml')\r\n\r\n# loops runs if capturing has been initialized\r\nwhile True:\r\n # reads frames from a video\r\n ret, frames = cap.read()\r\n\r\n # convert to gray scale to each frames\r\n gray = cv2.cvtColor(frames, cv2.COLOR_BGR2GRAY)\r\n\r\n # Detects cars of different sizes in the input image\r\n cars = car_cascade.detectMultiScale(gray, 1.1, 1)\r\n\r\n # To draw rectangles in each car\r\n for (x,y,w,h) in cars:\r\n cv2.rectangle(frames,(x,y),(x+w,y+h),(0,0,255),2)\r\n\r\n # Display frames in a window\r\n cv2.imshow('video2', frames)\r\n\r\n # wait for Enter key to stop\r\n if cv2.waitKey(33) == 13:\r\n break\r\n\r\n\r\n# Deallocate any associated memory usage\r\ncv2.destroyAllWindows() \r\n\r\n\r\n" } ]
3
EMFTeam/MiniSWMH
https://github.com/EMFTeam/MiniSWMH
89f6784d89a0d596a7eef93137237020a17314dd
5c0f659994ffdb3b37137927a425fa86532174b3
b902ef56fa25fc94268f5bf080b4040ad4c250bb
refs/heads/master
2021-01-24T06:32:36.658343
2020-08-13T00:42:55
2020-08-13T00:42:55
48,384,428
2
2
null
null
null
null
null
[ { "alpha_fraction": 0.6265060305595398, "alphanum_fraction": 0.6308434009552002, "avg_line_length": 31.936508178710938, "blob_id": "7bd387be0d92957340ba67c742e43b5e8cf7fcd0", "content_id": "8554edef5b0dcec654ce7db2432233271f8c6e4c", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2075, "license_type": "no_license", "max_line_length": 120, "num_lines": 63, "path": "/build_mini.py", "repo_name": "EMFTeam/MiniSWMH", "src_encoding": "UTF-8", "text": "#!/usr/bin/env python3\n\nimport os\nimport sys\nimport datetime\nimport subprocess\nfrom pathlib import Path\n\nfrom localpaths import rootpath\n\n\nversion = 'v1.7.3-BETA'\ncut_titles = ['e_rajastan', 'e_deccan', 'e_mali', 'k_sahara', 'k_fezzan', 'k_kanem', 'k_hausaland', 'k_canarias']\nscons_bin_path = Path('/usr/bin/scons')\nmapcut_bin_path_default = Path('/usr/local/bin/mapcut')\n\nmini_path = rootpath / 'MiniSWMH/MiniSWMH'\nmapcut_path = rootpath / 'ck2utils/mapcut'\n\ndef build_mapcut():\n print(\">> attempting to build mapcut from source...\")\n os.chdir(str(mapcut_path))\n try:\n output = subprocess.check_output(str(scons_bin_path), universal_newlines=True, stderr=subprocess.STDOUT)\n if sys.stdout:\n sys.stdout.write(output)\n except subprocess.CalledProcessError as e:\n sys.stderr.write('> scons failed!\\n> command: {}\\n> exit code: {}\\n\\n{}'.format(e.cmd, e.returncode, e.output))\n sys.exit(1)\n\n\ndef main():\n if sys.platform.startswith('linux') and mapcut_bin_path_default.exists():\n mapcut_bin_path = mapcut_bin_path_default\n else:\n mapcut_bin = 'mapcut' if sys.platform.startswith('linux') else 'mapcut.exe'\n mapcut_bin_path = mapcut_path / mapcut_bin\n\n if not mapcut_bin_path.exists():\n build_mapcut()\n if not mapcut_bin_path.exists():\n sys.stderr.write('mapcut binary not found: {}\\n'.format(mapcut_bin_path))\n return 2\n\n print(\">> executing mapcut...\")\n\n try:\n output = subprocess.check_output([str(mapcut_bin_path)] + cut_titles,\n universal_newlines=True, stderr=subprocess.STDOUT)\n if sys.stdout:\n sys.stdout.write(output)\n except subprocess.CalledProcessError as e:\n sys.stderr.write('> mapcut failed!\\n> command: {}\\n> exit code: {}\\n\\n{}'.format(e.cmd, e.returncode, e.output))\n return 3\n\n with (mini_path / 'version.txt').open('w') as f:\n print('{} - {}'.format(version, datetime.date.today()), file=f)\n\n return 0\n\n\nif __name__ == '__main__':\n sys.exit(main())\n" }, { "alpha_fraction": 0.7700534462928772, "alphanum_fraction": 0.7700534462928772, "avg_line_length": 92.5, "blob_id": "66658aa0ca97cc440418b8aab699fbbcaa3307cb", "content_id": "1f9029097cfe7c3ef254eff5e98d3b976b640d84", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 187, "license_type": "no_license", "max_line_length": 175, "num_lines": 2, "path": "/README.md", "repo_name": "EMFTeam/MiniSWMH", "src_encoding": "UTF-8", "text": "# MiniSWMH\nA sub-mod for SWMH, as part of Historical Immersion Project (HIP), which deactivates lesser-used parts of Africa (Mali, Sahara, Fezzan, Kanem, Hausaland) and India (Rajastan).\n" } ]
2
Souichikitai/pythoStegano
https://github.com/Souichikitai/pythoStegano
02b73ddeb56879ce9dbc9452a3657b9c5cdf52f0
bad09f86ef347b9f336214d413614bd3808da17a
6e48a09dac5098258edaf1be1f5adc546ca46b1c
refs/heads/main
2023-01-29T15:23:04.846265
2020-12-13T05:54:13
2020-12-13T05:54:13
320,993,361
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.5672969818115234, "alphanum_fraction": 0.5837041139602661, "avg_line_length": 31.10714340209961, "blob_id": "487c3e77fa13863cce39b4608acb42262731cc27", "content_id": "40bfbf6024a8ef1a1497db911a96e6bcd3fb0437", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3596, "license_type": "no_license", "max_line_length": 110, "num_lines": 112, "path": "/stegano.py", "repo_name": "Souichikitai/pythoStegano", "src_encoding": "UTF-8", "text": "import cv2\nimport numpy as np\nimport types\nfrom google.colab.patches import cv2_imshow\nfrom PIL import Image\ndef messageToBinary(message):\n if type(message) == str:\n return ''.join([ format(ord(i), \"08b\") for i in message])\n elif type(message) == bytes or type(message) == np.ndarray:\n return [ format(i, \"08b\") for i in message ]\n elif type(message) == int or type(message) == np.uint8:\n return format(i, \"08b\")\n else:\n raise TypeError(\"Input type not supported\")\n\ndef hideData(image, secret_message):\n n_bytes = image.shape[0] * image.shape[1]*3//8\n print(\"Maximum bytes to encode: \", n_bytes)\n\n if len(secret_message) > n_bytes:\n raise ValueError(\"Error encountered insufficient bytes, need bigger image or less data !!\")\n\n secret_message += \"#####\"\n\n data_index = 0\n\n binary_secret_msg = messageToBinary(secret_message)\n\n data_len = len(binary_secret_msg)\n for values in image:\n for pixel in values:\n r,g,b = messageToBinary(pixel)\n if data_index < data_len:\n pixel[0] = int(r[:-1] + binary_secret_msg[data_index], 2)\n data_index+=1\n if data_index < data_len:\n pixel[1] = int(g[:-1] + binary_secret_msg[data_index], 2)\n data_index+=1\n if data_index < data_len:\n pixel[2] = int(b[:-1] + binary_secret_msg[data_index], 2)\n data_index+=1\n if data_index >= data_len:\n break\n return image\n\ndef showData(image):\n binary_data = \"\"\n for values in image:\n for pixel in values:\n r,g,b = messageToBinary(pixel)\n binary_data += r[-1]\n binary_data += g[-1]\n binary_data += b[-1]\n all_bytes = [ binary_data[i: i+8] for i in range(0, len(binary_data), 8)]\n decoded_data =\"\"\n for byte in all_bytes:\n decoded_data += chr(int(byte, 2))\n if decoded_data[-5:] == \"#####\":\n break\n return decoded_data[:-5]\n\n\n\n\ndef encode_text():\n image_name = input(\"Enter image name(with extenshio): \")\n image = cv2.imread(image_name)\n\n print(\"The shape of the image is: \", image.shape)\n print(\"The original image is as shown below: \")\n resized_image = cv2.resize(image, (500,500))\n cv2_imshow(resized_image)\n\n data = input(\"Enter data to be encoded: \")\n if (len(data) == 0):\n raise ValueError('Data is empty')\n\n filename = input(\"Enter the name of new encodedd image(with extension) : \")\n encoded_image = hideData(image, data)\n cv2.imwrite(filename, encoded_image)\n\ndef decode_text():\n image_name = input(\"Enter the name of the steganographed image that you want to decode (with extension) \")\n image = cv2.imread(image_name)\n\n print(\"The steganographed image is as shown below: \")\n resized_image = cv2.resize(image, (500,500))\n cv2_imshow(resized_image)\n\n text = showData(image)\n return text\n\ndef Steganography():\n\n authentication = input(\"What is the passphrase for this app\\n\")\n\n if authentication == \"password\":\n a = input(\"Image Steganography \\n 1. Encode the data \\n 2. Decode the data \\n your input is : \")\n userinput = int(a)\n if(userinput==1):\n print(\"\\nEncoding...\")\n encode_text()\n\n elif(userinput==2):\n print(\"\\nDecoding...\")\n print(\"Decoding message is \", decode_text())\n else:\n raise Exception(\"Enter correct input\")\n else:\n print(\"You type wrong phrase\")\n\nSteganography()\n" }, { "alpha_fraction": 0.7372881174087524, "alphanum_fraction": 0.7542372941970825, "avg_line_length": 17.153846740722656, "blob_id": "4d1953b543f0cf4c15daeaf293d35c602da0ed1e", "content_id": "6f7db9b29aadde8c3f8d54542f2793093d53d81c", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 236, "license_type": "no_license", "max_line_length": 51, "num_lines": 13, "path": "/README.md", "repo_name": "Souichikitai/pythoStegano", "src_encoding": "UTF-8", "text": "# pythoStegano\n\nRun following command\n\n$ sudo pip3 install opencv-python\n\n//if you use python3\n$ pip3 install google-colab\n\n//else pip install google-colab\n\n//if you get error unknow \"PLI\", type this command\n$ sudo pip3 install pillow\n" } ]
2
yiheng24/Django_project
https://github.com/yiheng24/Django_project
606e6728e21d77f7c0cf6a12b90d4a6d8cdf9341
302eb606c02d957747ef80df6f3e5343f2ea5844
bb68af5ffc76c7033488de1fe8281a8fa1139cf3
refs/heads/master
2022-12-08T12:32:53.061108
2019-10-07T15:09:37
2019-10-07T15:09:37
213,410,704
0
0
null
2019-10-07T14:49:03
2019-10-07T15:09:23
2022-12-06T02:57:41
CSS
[ { "alpha_fraction": 0.485411137342453, "alphanum_fraction": 0.5358090400695801, "avg_line_length": 18.94444465637207, "blob_id": "3208fac4cbd2cbc327280804123ef5b6f2d8153e", "content_id": "175b4ed8679d7996fd63215ddd0da2f17aaac269", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 377, "license_type": "no_license", "max_line_length": 47, "num_lines": 18, "path": "/Qshop/Buyer/migrations/0004_auto_20190916_2036.py", "repo_name": "yiheng24/Django_project", "src_encoding": "UTF-8", "text": "# Generated by Django 2.1.8 on 2019-09-16 20:36\r\n\r\nfrom django.db import migrations\r\n\r\n\r\nclass Migration(migrations.Migration):\r\n\r\n dependencies = [\r\n ('Buyer', '0003_cart'),\r\n ]\r\n\r\n operations = [\r\n migrations.RenameField(\r\n model_name='orderinfo',\r\n old_name='good_price',\r\n new_name='goods_price',\r\n ),\r\n ]\r\n" }, { "alpha_fraction": 0.6593406796455383, "alphanum_fraction": 0.69010990858078, "avg_line_length": 15.576923370361328, "blob_id": "f16fe40def379be53a28c0c8cda7f891527d258d", "content_id": "df4844c47e64ae8b2a98876234133003f68f790e", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 493, "license_type": "no_license", "max_line_length": 59, "num_lines": 26, "path": "/Qshop/Buyer/sendMail.py", "repo_name": "yiheng24/Django_project", "src_encoding": "UTF-8", "text": "import smtplib\r\nfrom email.mime.text import MIMEText\r\n\r\n\r\nsubject='练习发送软件'\r\n\r\ncontent='我是邮件的内容。。。。内容1234567'\r\n\r\nsender='yi8heng24@163.com'\r\n\r\nrecver='yiheng24@qq.com,576492000@qq.com'\r\n\r\npassword='576492yh'\r\n\r\nmessage=MIMEText(content,'plain','utf-8')\r\n\r\nmessage['Subject']=subject\r\n\r\nmessage['From']=sender\r\n\r\nmessage['To']=recver\r\n\r\nsmtp=smtplib.SMTP_SSL('smtp.163.com',465)\r\nsmtp.login(sender,password)\r\nsmtp.sendmail(sender,recver.split(','),message.as_string())\r\nsmtp.close()" }, { "alpha_fraction": 0.5758683681488037, "alphanum_fraction": 0.64716637134552, "avg_line_length": 20.875, "blob_id": "8894e744f02e7c61d78bf7a3898372c898a12070", "content_id": "b55a551386b4b610bfc80b6d5c3f6622102e60b9", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 577, "license_type": "no_license", "max_line_length": 120, "num_lines": 24, "path": "/Qshop/Buyer/sendDingding.py", "repo_name": "yiheng24/Django_project", "src_encoding": "UTF-8", "text": "import json\r\nimport requests\r\n\r\nurl='https://oapi.dingtalk.com/robot/send?access_token=739cdc134a4021dfe673a5ba5b73e772af3da26d94c246a93d9d16fdf7f8658e'\r\nheaders={\r\n 'Content-Type':'application/json',\r\n 'Charset':'utf-8'\r\n}\r\nrequests_data={\r\n 'msgtype':'text',\r\n 'text':{\r\n 'content':'你好?在吗?早点睡!多喝热水!'\r\n },\r\n 'at':{\r\n 'atMobiles':[\r\n ],\r\n 'isAtAll':True\r\n }\r\n}\r\n\r\nsendData=json.dumps(requests_data)\r\nresponse=requests.post(url=url,headers=headers,data=sendData)\r\ncontent=response.json()\r\nprint(content)" }, { "alpha_fraction": 0.5880149602890015, "alphanum_fraction": 0.5880149602890015, "avg_line_length": 9.608695983886719, "blob_id": "5d5f834142af456f175e9f46a53ba14d451dfc1e", "content_id": "4c2f41e740f8654f7c4fabaa1c1c6477adadecad", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 267, "license_type": "no_license", "max_line_length": 53, "num_lines": 23, "path": "/Qshop/Buyer/sendMessage.py", "repo_name": "yiheng24/Django_project", "src_encoding": "UTF-8", "text": "import requests\r\n\r\nurl=''\r\n\r\naccount=''\r\n\r\npassword=''\r\n\r\nmobile=''\r\n\r\ncontent=''\r\n\r\nheaders={}\r\n\r\ndata={\r\n 'account':account,\r\n 'password':password,\r\n 'mobile':mobile,\r\n 'content':content,\r\n\r\n}\r\n\r\nresponse=requests.post(url,headers=headers,data=data)\r\n" }, { "alpha_fraction": 0.5393374562263489, "alphanum_fraction": 0.5476190447807312, "avg_line_length": 22.149999618530273, "blob_id": "b589995513e2f462ff686a94dd3fa7d535405112", "content_id": "87d2412474a28fc669212312814d44ba9e9cc0d5", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 966, "license_type": "no_license", "max_line_length": 73, "num_lines": 40, "path": "/Qshop/CeleryTask/tasks.py", "repo_name": "yiheng24/Django_project", "src_encoding": "UTF-8", "text": "from __future__ import absolute_import\r\nfrom Qshop.celery import app\r\n\r\n@app.task\r\ndef task_example():\r\n return 'i am taskexample'\r\n\r\n\r\nimport json\r\nimport requests\r\nfrom Qshop.settings import DingURL\r\n\r\n@app.task\r\ndef sendDing(content='1111111',to=None):\r\n headers = {\r\n 'Content-Type': 'application/json',\r\n 'Charset': 'utf-8'\r\n }\r\n requests_data = {\r\n 'msgtype': 'text',\r\n 'text': {\r\n 'content': content\r\n },\r\n 'at': {\r\n 'atMobiles': [\r\n ],\r\n 'isAtAll': True\r\n }\r\n }\r\n if to:\r\n requests_data['at']['atMobiles'].append(to)\r\n requests_data['at']['isAtAll']=False\r\n else:\r\n requests_data['at']['atMobiles'].clear()\r\n requests_data['at']['isAtAll']=True\r\n\r\n sendData = json.dumps(requests_data)\r\n response = requests.post(url=DingURL, headers=headers, data=sendData)\r\n content = response.json()\r\n return content\r\n" }, { "alpha_fraction": 0.8333333134651184, "alphanum_fraction": 0.8333333134651184, "avg_line_length": 14, "blob_id": "32bc5df68efbbd7c46796176b0d6870eb5407b65", "content_id": "7dbf7c5e430f349a685627ad75cf6b4604fc8806", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 42, "license_type": "no_license", "max_line_length": 16, "num_lines": 2, "path": "/README.md", "repo_name": "yiheng24/Django_project", "src_encoding": "UTF-8", "text": "# Django_project\nDjango电商管理项目\n" }, { "alpha_fraction": 0.6000000238418579, "alphanum_fraction": 0.647826075553894, "avg_line_length": 21.066667556762695, "blob_id": "2cf2055c618b61ccbdbcc4acc7932a0d9fe16ee2", "content_id": "60f8de254444ee424edac5a24b0ebd8ee46e45aa", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 756, "license_type": "no_license", "max_line_length": 63, "num_lines": 30, "path": "/Qshop/Buyer/AlipayProject.py", "repo_name": "yiheng24/Django_project", "src_encoding": "UTF-8", "text": "from alipay import AliPay\r\n\r\nalipay_public_key_string='''-----BEGIN PUBLIC KEY-----\r\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwcwFN4yAlGqZzJOF8aFqLt4c6Fcy5EmLtr7oI5NSQG1BPaqUsHgDElref4dE2t15W0LCU7ZKYPuS9JXXlDlVUkJ0zVkIw3j/mpkB5+7bG6gbcZAMhzeXCgOgwBZzIg8licQpKjamVWOmGBxhMggEJLBM4k3v1zXPdai26a3DPvtSy/dJ7iTVFVxoSVQqJoIKo07eXZ28aTSC5dgbHPa+2OUqsJvT4Zbwt8flBYSTCHWGqVBU1WwBQtmIwRdfJjM9U7Jn5BUdaegPHfCMCE5KxwGd87RiZrTw19dKYDf7ObXq8x8SP43fhnoVrOUH7cWqNlJZktPPyVB37ubNar6bmQIDAQAB\r\n-----END PUBLIC KEY-----'''\r\n\r\nalipay_private_key_string='''-----BEGIN RSA PRIVATE KEY-----\r\nMIIEpAIBAAKCAQEAwcwFN4yAlGqZzJOF8aFqLt4c6Fcy5EmLtr7oI5NSQG1BPaqUsHgDElref4dE2t15W0LCU7ZKYPuS9JXXlDlVUkJ0zVkIw3j/mpkB5+7bG6gbcZAMhzeXCgOgwBZzIg8licQpKjamVWOmGBxhMggEJLBM4k3v1zXPdai26a3DPvtSy/dJ7iTVFVxoSVQqJoIKo07eXZ28aTSC5dgbHPa+2OUqsJvT4Zbwt8flBYSTCHWGqVBU1WwBQtmIwRdfJjM9U7Jn5BUdaegPHfCMCE5KxwGd87RiZrTw19dKYDf7ObXq8x8SP43fhnoVrOUH7cWqNlJZktPPyVB37ubNar6bmQIDAQABAoIBAQCws8IeADJNIVXSvsBmrXMQAN4Cy19P3+9QVYl8xps8u2G9RIgGz6adWdV+Gmyh00cP+zMM+S2geEJqWSYTtKMjOg0eH4xqDy2gXNrsC1IlSYacaWfC8uD49I3iF5Yq+/ySPRX7s5C+UvnjCh1lbQG6IjY4Mi/53sqm0YrWTuWzygJ469HlkHHVrpfixu8r2ONzsAXdSVRFMoXf22JUZwV4jm7AfX0DnD0wWyuteeNmInGzvb4giDkLeyTX4yzgFovaUehEGEpZaOATMz1MWfYSFIzBJLTxhq5Yui3qtVBMSdWCQv1hPa0A8n2s0hZY8jSg/YKZMTm3e/EPEdgDiSXxAoGBAP/8WYz4HOsrEhkJJUZz7ltdLTKn2sLGuyUn74X0d8XLCcs6MfgiIy+1SgcaER9YuCA2Q6RNigo1xvC3UsfV9IM1D52TWvR9JW2BSacjwJlooQWipLW7DOwrRzY3n0ROGDYeUbQx4tjRvrsjmrkBN1L7yMDGPbB0KOigJS/x1DgnAoGBAMHOyKcSbtZWHEHpqrD2SEmnJIafDzVGhoxKhijBKHGB4zlsqXHotg0TUWo/HwAM3jeOE3NPW16OUHAHZy1yvjRiQ/sccRjcXTZE/DskTcxS76d+AO2kW5uYsxO1kEDg2GQEC4XB4MX4gh/HV47qU2+z7BkwtwMA0cXbXWN1uSY/AoGBAOtxuRP1qPOL++tXBBfWzWbvPoEW7hi0HLFCGAZHIlqkMu/fKNKm42IgBmSdzx3bxg6qmnBmeQ6HA+GnW9Y9rdV4WlJ+k+vHp0Me5RV7xsvS9jdurrwPvQUDkU4GvtBeW9p67H8mWxU9ZYZOayK6QZ5rwuu76kV/sZi0oz+D18OFAoGAJCYtxvvpMJFfM+whqmBFm3dRmMqSS52b+w7rdy6QHJvdhhh+goCldErmJKshXSEJUdNuTVO/9yMUXdEDrbZ5Q8wQYgYsEjcIK9cyNNXQrQvLJ7KY+bpuW9dfj42OGovV0NHwVEKValev7b2A12ddqLgmkYxElorQldcU1DhhEIECgYBxlMklF3Ij0nTyIRswmGwxP6B7zH+wKnCmWzzNSJugKu0P5MqP45WxfIJnmPNPlF19VD0MKa4P+/Ukp1Q5QviKS+ma38dtsFKNuEZqvZnV2vUAlPjXevn9Lxkqu5TIL9pA/lgtzkv0FnGmvfknD7nWZliLCgA0tPiityzE+E7xRA==\r\n-----END RSA PRIVATE KEY-----'''\r\n\r\n#实例化支付\r\nalipay=AliPay(\r\n appid='2016101200667746',\r\n app_notify_url=None,\r\n app_private_key_string=alipay_private_key_string,\r\n alipay_public_key_string=alipay_public_key_string,\r\n sign_type='RSA2'\r\n)\r\n#实例化订单\r\n\r\norder_string=alipay.api_alipay_trade_page_pay(\r\n out_trade_no='201909111525',#订单号,唯一\r\n total_amount=str(1888),#支付金额\r\n subject='快活林',#支付主题\r\n return_url=None,\r\n notify_url=None,\r\n)\r\n\r\n#拼接收款地址\r\nresult=\"https://openapi.alipaydev.com/gateway.do?\"+order_string\r\n\r\nprint(result)" }, { "alpha_fraction": 0.5933786034584045, "alphanum_fraction": 0.6001697778701782, "avg_line_length": 37.266666412353516, "blob_id": "af9328a35217585799b0a9fd675742ac44237ea9", "content_id": "6c6bc6eef03aeb8a1dee1a88af67a4770ffd3a1a", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1216, "license_type": "no_license", "max_line_length": 76, "num_lines": 30, "path": "/Qshop/Qshop/middleware.py", "repo_name": "yiheng24/Django_project", "src_encoding": "UTF-8", "text": "from django.utils.deprecation import MiddlewareMixin\r\nfrom django.http import HttpResponse\r\nimport time\r\nfrom CeleryTask.tasks import sendDing\r\nclass MiddleWareTest(MiddlewareMixin):\r\n def process_request(self,request):\r\n request_ip=request.META['REMOTE_ADDR']\r\n if request_ip == '10.10.14.74':\r\n return HttpResponse('非法IP地址')\r\n\r\n # def process_view(self,request,callback,callback_args,callback_kwargs):\r\n # print('i am process_view')\r\n #\r\n # def process_exception(self,request,exception):\r\n # if exception:\r\n # with open('ERROR_PATH','a') as f:\r\n # now=time.strftime('%Y-%m-%d %h-%M-%S',time.localtime())\r\n # content='[%s]:%s\\n'%(now,exception)\r\n # f.write(content)\r\n # sendDing.delay(content)\r\n # return HttpResponse('有错误出现,改一改代码<br> %s'%exception)\r\n #\r\n # def process_template_response(self,request,response):\r\n # print('我是 process_template_response')\r\n # return HttpResponse('hi hi hi')\r\n #\r\n # def process_response(self,request,response):\r\n # print('我是 process_response')\r\n # return response\r\n #\r\n" }, { "alpha_fraction": 0.5397379994392395, "alphanum_fraction": 0.5633187890052795, "avg_line_length": 37.482757568359375, "blob_id": "b2aafb23076ffbaa086db46d96df9e7959933d44", "content_id": "c605901b78a3ae508a3941d2c699d48363797f61", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1145, "license_type": "no_license", "max_line_length": 116, "num_lines": 29, "path": "/Qshop/Buyer/migrations/0002_orderinfo.py", "repo_name": "yiheng24/Django_project", "src_encoding": "UTF-8", "text": "# Generated by Django 2.1.8 on 2019-09-11 20:20\r\n\r\nfrom django.db import migrations, models\r\nimport django.db.models.deletion\r\n\r\n\r\nclass Migration(migrations.Migration):\r\n\r\n dependencies = [\r\n ('Seller', '0004_goods_goods_description'),\r\n ('Buyer', '0001_initial'),\r\n ]\r\n\r\n operations = [\r\n migrations.CreateModel(\r\n name='OrderInfo',\r\n fields=[\r\n ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),\r\n ('goods_id', models.IntegerField()),\r\n ('goods_picture', models.CharField(max_length=32)),\r\n ('goods_name', models.CharField(max_length=32)),\r\n ('goods_count', models.IntegerField()),\r\n ('good_price', models.FloatField()),\r\n ('goods_total_price', models.FloatField()),\r\n ('order_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='Buyer.PayOrder')),\r\n ('store_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='Seller.LoginUser')),\r\n ],\r\n ),\r\n ]\r\n" }, { "alpha_fraction": 0.7919707894325256, "alphanum_fraction": 0.7919707894325256, "avg_line_length": 32.5, "blob_id": "1f2493046d324a2ac30c083d20f5f6b872459180", "content_id": "b60d853e0e8dbce1ee549f29817db058f26b2e71", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 274, "license_type": "no_license", "max_line_length": 68, "num_lines": 8, "path": "/Qshop/Qshop/celery.py", "repo_name": "yiheng24/Django_project", "src_encoding": "UTF-8", "text": "import os\r\nfrom celery import Celery\r\nfrom django.conf import settings\r\n\r\nos.environ.setdefault('DJANGO_SETTING_MODULE','CeleryTask.settings')\r\napp=Celery('art_project')\r\napp.config_from_object('django.conf:settings')\r\napp.autodiscover_tasks(lambda :settings.INSTALLED_APPS)" }, { "alpha_fraction": 0.5512405633926392, "alphanum_fraction": 0.5738942623138428, "avg_line_length": 32.33333206176758, "blob_id": "fc909b513951725efb0cc6b5c9153cde4850a15a", "content_id": "15c8d5fd84b5bf6acc6ea9955ebfca31249488be", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 927, "license_type": "no_license", "max_line_length": 118, "num_lines": 27, "path": "/Qshop/Buyer/migrations/0001_initial.py", "repo_name": "yiheng24/Django_project", "src_encoding": "UTF-8", "text": "# Generated by Django 2.1.8 on 2019-09-11 19:56\r\n\r\nfrom django.db import migrations, models\r\nimport django.db.models.deletion\r\n\r\n\r\nclass Migration(migrations.Migration):\r\n\r\n initial = True\r\n\r\n dependencies = [\r\n ('Seller', '0004_goods_goods_description'),\r\n ]\r\n\r\n operations = [\r\n migrations.CreateModel(\r\n name='PayOrder',\r\n fields=[\r\n ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),\r\n ('order_number', models.CharField(max_length=32)),\r\n ('order_data', models.DateTimeField(auto_now=True)),\r\n ('order_status', models.IntegerField()),\r\n ('order_total', models.FloatField(blank=True, null=True)),\r\n ('order_user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='Seller.LoginUser')),\r\n ],\r\n ),\r\n ]\r\n" } ]
11
akcays/MIT_600.1x
https://github.com/akcays/MIT_600.1x
3b0ae2ce112bc4b89358aae0013a3840fa09020b
c661a3e2a7d4ea1698e5d3323941c1649adb00bf
792750a5226fe7f2bcb9a1134479cf085fa35c26
refs/heads/master
2017-12-05T01:08:22.027252
2017-06-24T20:32:27
2017-06-24T20:32:27
95,321,443
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.5671342611312866, "alphanum_fraction": 0.5871743559837341, "avg_line_length": 34.71428680419922, "blob_id": "4da3384c5540d077f38ea352a7b50dccbe43f474", "content_id": "85e68862ab4697c5dead151b548d8fb4a65ff09d", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 499, "license_type": "no_license", "max_line_length": 199, "num_lines": 14, "path": "/Midterm/flatten.py", "repo_name": "akcays/MIT_600.1x", "src_encoding": "UTF-8", "text": "# Write a function to flatten a list. The list contains other lists, strings, or ints. For example, [[1,'a',['cat'],2],[[[3]],'dog'],4,5] is flattened into [1,'a','cat',2,3,'dog',4,5] (order matters)\n\ndef flatten(aList):\n '''\n aList: a list\n Returns a copy of aList, which is a flattened version of aList\n '''\n flattened = []\n for ele in aList:\n if type(ele) == list:\n flattened += flatten(ele)\n else:\n flattened.append(ele)\n return flattened" }, { "alpha_fraction": 0.6209996342658997, "alphanum_fraction": 0.6407766938209534, "avg_line_length": 48.67856979370117, "blob_id": "abf88c14874e77934bd32c69a3444d50315eb841", "content_id": "f5adbd4d867283773d9df502fefa77085d7a4c89", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2781, "license_type": "no_license", "max_line_length": 369, "num_lines": 56, "path": "/Final/longestRun.py", "repo_name": "akcays/MIT_600.1x", "src_encoding": "UTF-8", "text": "'''\nYou are given the following definitions:\n\n A run of monotonically increasing numbers means that a number at position k+1 in the sequence is greater than or equal to the number at position k in the sequence.\n A run of monotonically decreasing numbers means that a number at position k+1 in the sequence is less than or equal to the number at position k in the sequence.\n\nFor example:\n\n If L = [10, 4, 3, 8, 3, 4, 5, 7, 7, 2] then the longest run of monotonically increasing numbers in L is [3, 4, 5, 7, 7] and the longest run of monotonically decreasing numbers in L is [10, 4, 3]. Your function should return the value 26 because the longest run of monotonically increasing integers is longer than the longest run of monotonically decreasing numbers.\n\n If L = [5, 4, 10] then the longest run of monotonically increasing numbers in L is [4, 10] and the longest run of monotonically decreasing numbers in L is [5, 4]. Your function should return the value 9 because the longest run of monotonically decreasing integers occurs before the longest run of monotonically increasing numbers.\n\nPaste your entire function, in the box below. Do not leave any debugging print statements.\n'''\n\ndef longest_run(L):\n \"\"\"\n Assumes L is a list of integers containing at least 2 elements.\n Finds the longest run of numbers in L, where the longest run can\n either be monotonically increasing or monotonically decreasing.\n In case of a tie for the longest run, choose the longest run\n that occurs first.\n Does not modify the list.\n Returns the sum of the longest run.\n \"\"\"\n dict_inc = {}\n key_inc = 0\n dict_dec = {}\n key_dec = 0\n for i in range(len(L)-1):\n if L[i+1] >= L[i]:\n dict_inc.setdefault(key_inc, []).append(L[i])\n if i == len(L)-2 and L[i+1] >= L[i]:\n dict_inc.setdefault(key_inc, []).append(L[i+1])\n if not L[i+1] >= L[i] and L[i] >= L[i-1]:\n dict_inc.setdefault(key_inc, []).append(L[i])\n key_inc += 1\n for i in range(len(L)-1):\n if L[i+1] <= L[i]:\n dict_dec.setdefault(key_dec, []).append(L[i])\n if i == len(L)-2 and L[i+1] <= L[i]:\n dict_dec.setdefault(key_dec, []).append(L[i+1])\n if not L[i+1] <= L[i] and L[i] <= L[i-1]:\n dict_dec.setdefault(key_dec, []).append(L[i])\n key_dec += 1\n longest_inc = max(dict_inc.values(), key=len)\n longest_dec = max(dict_dec.values(), key=len)\n if len(longest_inc) > len(longest_dec):\n return sum(longest_inc)\n elif len(longest_inc) < len(longest_dec):\n return sum(longest_dec)\n else:\n if L.index(longest_inc[0]) < L.index(longest_dec[0]):\n return sum(longest_inc)\n else:\n return sum(longest_dec)" }, { "alpha_fraction": 0.713487982749939, "alphanum_fraction": 0.730240523815155, "avg_line_length": 63.69444274902344, "blob_id": "b14b3c10ea77f5b8cec198599bb9369973a0e2f1", "content_id": "67fdb1b8a4a8c3737fc0483c8b842537c4205bdd", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2328, "license_type": "no_license", "max_line_length": 464, "num_lines": 36, "path": "/PS2/problem3.py", "repo_name": "akcays/MIT_600.1x", "src_encoding": "UTF-8", "text": "# How can we calculate a more accurate fixed monthly payment than we did in Problem 2 without running into the problem of slow code? We can make this program run faster using a technique introduced in lecture - bisection search!\n\n# The following variables contain values as described below:\n\n# balance - the outstanding balance on the credit card\n\n# annualInterestRate - annual interest rate as a decimal\n\n# To recap the problem: we are searching for the smallest monthly payment such that we can pay off the entire balance within a year. What is a reasonable lower bound for this payment value? $0 is the obvious anwer, but you can do better than that. If there was no interest, the debt can be paid off by monthly payments of one-twelfth of the original balance, so we must pay at least this much every month. One-twelfth of the original balance is a good lower bound.\n\n# What is a good upper bound? Imagine that instead of paying monthly, we paid off the entire balance at the end of the year. What we ultimately pay must be greater than what we would've paid in monthly installments, because the interest was compounded on the balance we didn't pay off each month. So a good upper bound for the monthly payment would be one-twelfth of the balance, after having its interest compounded monthly for an entire year.\n\n# In short:\n\n# Monthly interest rate = (Annual interest rate) / 12.0\n# Monthly payment lower bound = Balance / 12\n# Monthly payment upper bound = (Balance x (1 + Monthly interest rate)12) / 12.0\n\n# Write a program that uses these bounds and bisection search to find the smallest monthly payment to the cent (no more multiples of $10) such that we can pay off the debt within a year. Try it out with large inputs, and notice how fast it is (try the same large inputs in your solution to Problem 2 to compare!). Produce the same return value as you did in Problem 2.\n\nlower = balance / 12\nupper = (balance * (1 + annualInterestRate/12)**12)/12\nwhile True:\n newbalance = balance\n x = (lower + upper)/2\n for i in [i + 1 for i in range(12)]:\n newbalance -= x\n newbalance *= (1 + annualInterestRate/12)\n if newbalance <= 0:\n if abs(newbalance) <= 0.001:\n print (\"Lowest Payment:\", round(x,2))\n break\n else:\n upper = x\n else:\n lower = x" }, { "alpha_fraction": 0.5281046032905579, "alphanum_fraction": 0.5908496975898743, "avg_line_length": 37.29999923706055, "blob_id": "68266432d22f2d298dca3bf3ceb1c191bf750332", "content_id": "d44e0d22573fcdcea8b8f3aaac2d2d790d3ea1d7", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 765, "license_type": "no_license", "max_line_length": 199, "num_lines": 20, "path": "/Final/generalPoly.py", "repo_name": "akcays/MIT_600.1x", "src_encoding": "UTF-8", "text": "'''\nWrite a function called general_poly, that meets the specifications below.\n\nFor example, general_poly([1, 2, 3, 4])(10) should evaluate to 1234 because 1*10^3 + 2*10^2 + 3*10^1 + 4*10^0\n\nSo in the example the function only takes one argument with general_poly([1, 2, 3, 4]) and it returns a function that you can apply to a value, in this case x = 10 with general_poly([1, 2, 3, 4])(10)\n'''\n\ndef general_poly (L):\n \"\"\" L, a list of numbers (n0, n1, n2, ... nk)\n Returns a function, which when applied to a value x, returns the value\n n0 * x^k + n1 * x^(k-1) + ... nk * x^0 \"\"\"\n def apply_to (x):\n result = 0\n k = len(L)-1\n for ele in L:\n result += ele*x**k\n k -= 1\n return result\n return apply_to" } ]
4
kgorshkoff/scraping
https://github.com/kgorshkoff/scraping
57c460ec0ea05c55c46bfc3679b179f14c70db33
a843661e974bd32934f9de39d7a1e6eb974b7763
d3255715f1b608fcd04682a62d2ef8c1f9a76383
refs/heads/master
2022-12-19T03:32:51.415511
2020-09-04T18:39:49
2020-09-04T18:39:49
286,799,514
0
0
null
2020-08-11T16:53:10
2020-08-23T08:04:42
2020-09-04T18:39:50
Python
[ { "alpha_fraction": 0.6250925064086914, "alphanum_fraction": 0.6250925064086914, "avg_line_length": 31.554216384887695, "blob_id": "7eea5055bc131b2b28031905fc80ac1b3a076c14", "content_id": "7415ea0381bab5916137b9fbb678a85c0f4c785b", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2739, "license_type": "no_license", "max_line_length": 79, "num_lines": 83, "path": "/3/homework/models.py", "repo_name": "kgorshkoff/scraping", "src_encoding": "UTF-8", "text": "from sqlalchemy import (\n Column,\n Integer,\n String,\n ForeignKey,\n Table\n)\nfrom sqlalchemy.ext.declarative import declarative_base\nfrom sqlalchemy.orm import relationship\n\nBase = declarative_base()\n\n\"\"\"\none to one - один к одному\none to many - один к многому -> many to one\nmany to many - многое к многому\n\"\"\"\n\ntag_post = Table('tag_post', Base.metadata,\n Column('post_id', Integer, ForeignKey('post.id')),\n Column('tag_id', Integer, ForeignKey('tag.id'))\n )\n\nhub_post = Table('hub_post', Base.metadata,\n Column('post_id', Integer, ForeignKey('post.id')),\n Column('hub_id', Integer, ForeignKey('hub.id'))\n )\n\nclass Post(Base):\n __tablename__ = 'post'\n id = Column(Integer, primary_key=True, autoincrement=True)\n url = Column(String, unique=True, nullable=False)\n title = Column(String, unique=False, nullable=False)\n author_id = Column(Integer, ForeignKey('author.id'))\n author = relationship('Author', back_populates='post')\n tag = relationship('Tag', secondary=tag_post, back_populates='post')\n hub = relationship('Hub', secondary=hub_post, back_populates='post')\n\n def __init__(self, url: str, title: str, author_id=None, tags=[], hubs=[]):\n self.url = url\n self.title = title\n self.author_id = author_id\n self.tag.extend(tags)\n self.hub.extend(hubs)\n\n\nclass Author(Base):\n __tablename__ = 'author'\n id = Column(Integer, primary_key=True, autoincrement=True)\n url = Column(String, unique=True, nullable=False)\n name = Column(String, unique=False, nullable=False)\n post = relationship('Post', back_populates='author')\n\n def __init__(self, url: str, name: str, posts=[]):\n self.url = url\n self.name = name\n self.post.extend(posts)\n\n\nclass Tag(Base):\n __tablename__ = 'tag'\n id = Column(Integer, primary_key=True, autoincrement=True)\n url = Column(String, unique=True, nullable=False)\n name = Column(String, unique=False, nullable=False)\n post = relationship('Post', secondary=tag_post, back_populates='tag')\n\n def __init__(self, url: str, name: str, posts=[]):\n self.url = url\n self.name = name\n self.post.extends(posts)\n\n\nclass Hub(Base):\n __tablename__ = 'hub'\n id = Column(Integer, primary_key=True, autoincrement=True)\n url = Column(String, unique=True, nullable=False)\n name = Column(String, unique=False, nullable=False)\n post = relationship('Post', secondary=hub_post, back_populates='hub')\n\n def __init__(self, url: str, name: str, posts=[]):\n self.url = url\n self.name = name\n self.post.extends(posts)\n" }, { "alpha_fraction": 0.5118934512138367, "alphanum_fraction": 0.5275927782058716, "avg_line_length": 31.33846092224121, "blob_id": "e8855cc64dc027ffaecbccf672a4b4d5d4227679", "content_id": "dbe6e894d3b2cde466ce958c5dbec4c86c20319b", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2102, "license_type": "no_license", "max_line_length": 113, "num_lines": 65, "path": "/1/homework/1.py", "repo_name": "kgorshkoff/scraping", "src_encoding": "UTF-8", "text": "import json\nimport time\n\nimport requests\nfrom tqdm import tqdm\n\n\nclass Parser5ka:\n _domain = 'https://5ka.ru'\n _offers_path = '/api/v2/special_offers/'\n _categories_path = '/api/v2/categories/'\n\n headers = {\n \"User-Agent\": \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) \"\n \"Version/13.1.2 Safari/605.1.15\"\n }\n\n def __init__(self):\n self.products = []\n self.structure = {}\n\n def get_structure(self):\n try:\n categories = requests.get(self._domain + self._categories_path, headers=self.headers)\n self.structure = categories.json()\n except ValueError as e:\n return 'There was an error getting categories from url: ' + str(e)\n\n # noinspection PyUnboundLocalVariable\n def download(self):\n self.get_structure()\n for category in tqdm(self.structure):\n url = self._domain + self._offers_path\n params = {\n 'records_per_page': 20,\n 'categories': int(category['parent_group_code'])\n }\n while url:\n response = requests.get(url, headers=self.headers, params=params)\n try:\n data = response.json()\n except ValueError:\n print('Not a JSON in response, probably an error somewhere in the link')\n\n params = {}\n url = data['next']\n if data['results']:\n if category.get('products'):\n category['products'].extend(data['results'])\n else:\n category['products'] = data['results']\n time.sleep(0.1)\n\n def save_data(self):\n for item in self.structure:\n if item.get('products'):\n with open(item['parent_group_code'] + '.json', 'w', encoding='UTF-8') as f:\n f.write(json.dumps(item, ensure_ascii=False))\n\n\nif __name__ == '__main__':\n parser = Parser5ka()\n\n parser.download()\n parser.save_data()\n" }, { "alpha_fraction": 0.5107488632202148, "alphanum_fraction": 0.5183085203170776, "avg_line_length": 40.5, "blob_id": "ffbf4476546bf97174b1aa0514f6c58439663b29", "content_id": "325b87eb13523c231e6206fe7f72e88155a7201c", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 4238, "license_type": "no_license", "max_line_length": 118, "num_lines": 102, "path": "/6/gbdm/spiders/instagram.py", "repo_name": "kgorshkoff/scraping", "src_encoding": "UTF-8", "text": "import json\n\nimport scrapy\nfrom scrapy.http.response import Response\n\nfrom gbdm.items import InstagramPostItem, InstagramAuthorItem\n\n\nclass InstagramSpider(scrapy.Spider):\n name = 'instagram'\n allowed_domains = ['www.instagram.com']\n start_urls = ['https://www.instagram.com/']\n\n __urls = {\n 'login': 'https://www.instagram.com/accounts/login/ajax/',\n 'tag': '/explore/tags/наука/'\n }\n\n __api_query = {\n 'url': '/graphql/query/',\n 'posts': 'c769cb6c71b24c8a86590b22402fda50',\n 'user': 'd4d88dc1500312af6f937f7b804c68c3'\n }\n\n def __init__(self, *args, **kwargs):\n self.__login = kwargs['login']\n self.__password = kwargs['password']\n super().__init__(*args, **kwargs)\n\n def parse(self, response: Response, **kwargs):\n try:\n js_data = self.get_js_shared_data(response)\n\n yield scrapy.FormRequest(self.__urls['login'],\n method='POST',\n callback=self.parse,\n formdata={'username': self.__login,\n 'enc_password': self.__password},\n headers={'X-CSRFToken': js_data['config']['csrf_token']},\n )\n except AttributeError as e:\n if response.json().get('authenticated'):\n yield response.follow(self.__urls['tag'], callback=self.tag_page_parse)\n\n def tag_page_parse(self, response: Response, first_run=True):\n if first_run:\n js_data = self.get_js_shared_data(response)\n json_data = js_data['entry_data']['TagPage'][0]['graphql']['hashtag']\n else:\n json_data = response.json()['data']['hashtag']\n\n variables = {\"tag_name\": json_data['name'],\n \"first\": 50,\n \"after\": json_data['edge_hashtag_to_media']['page_info']['end_cursor']}\n\n url = f'{self.__api_query[\"url\"]}?query_hash={self.__api_query[\"posts\"]}&variables={json.dumps(variables)}'\n yield response.follow(url, callback=self.get_api_hashtag_posts)\n if json_data['edge_hashtag_to_media']['page_info']['has_next_page']:\n yield response.follow(url, callback=self.tag_page_parse, cb_kwargs={'first_run': False}, dont_filter=True)\n\n def get_api_hashtag_posts(self, response: Response):\n posts = response.json()['data']['hashtag']['edge_hashtag_to_media']['edges']\n for post in posts:\n item = InstagramPostItem()\n for key, value in post['node'].items():\n if key.startswith('__'):\n item[key[2:]] = value\n continue\n item[key] = value\n yield item\n\n if post['node']['edge_liked_by']['count'] > 100 or post['node']['edge_media_to_comment']['count'] > 30:\n variables = {\"user_id\": post['node']['owner']['id'],\n \"include_chaining\": True,\n \"include_reel\": True,\n \"include_suggested_users\": False,\n \"include_logged_out_extras\": False,\n \"include_highlight_reels\": True,\n \"include_live_status\": True}\n\n url = f'https://www.instagram.com{self.__api_query[\"url\"]}?query_hash' \\\n f'={self.__api_query[\"user\"]}&variables={json.dumps(variables)}'\n yield response.follow(url, callback=self.get_api_user)\n\n def get_api_user(self, response: Response):\n item = InstagramAuthorItem()\n user = response.json()\n for key, value in user['data']['user']['reel'].items():\n if key.startswith('__'):\n item[key[2:]] = value\n continue\n item[key] = value\n yield item\n\n @staticmethod\n def get_js_shared_data(response):\n marker = \"window._sharedData = \"\n data = response.xpath(\n f'/html/body/script[@type=\"text/javascript\" and contains(text(), \"{marker}\")]/text()') \\\n .extract_first()\n data = data.replace(marker, '')[:-1]\n return json.loads(data)\n" }, { "alpha_fraction": 0.548872172832489, "alphanum_fraction": 0.5569280385971069, "avg_line_length": 43.33333206176758, "blob_id": "d8969c34cfc0eadf68a0103c7055f8ddab169d9c", "content_id": "b6cbd6ed9eabbbf1e7392bedeb37967eccf772e4", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3724, "license_type": "no_license", "max_line_length": 111, "num_lines": 84, "path": "/4/gbdm/spiders/avito.py", "repo_name": "kgorshkoff/scraping", "src_encoding": "UTF-8", "text": "import scrapy\nimport pytesseract\nfrom PIL import Image\nimport io\nimport base64\n\n\nclass AvitoSpider(scrapy.Spider):\n name = 'avito'\n allowed_domains = ['www.avito.ru']\n start_urls = ['https://www.avito.ru/himki/kvartiry/prodam']\n\n __xpath_query = {\n 'pagination': '//div[@class=\"index-content-2lnSO\"]//'\n 'div[contains(@data-marker, \"pagination-button\")]/'\n 'span[@class=\"pagination-item-1WyVp\"]/@data-marker',\n 'ads': \"//h3[@class='snippet-title']/a[@class='snippet-link'][@itemprop='url']/@href\",\n 'ad_title': '//div[@class=\"title-info-main\"]/h1[@class=\"title-info-title\"]/'\n 'span[@class=\"title-info-title-text\"]/text()',\n 'ad_params': '//ul[@class=\"item-params-list\"]/li[@class=\"item-params-list-item\"]',\n 'ad_gallery': '//div[@class=\"gallery-imgs-container js-gallery-imgs-container\"]'\n '/div[@class=\"gallery-img-wrapper js-gallery-img-wrapper\"]/div[1]/@data-url',\n 'ad_prices': '//div[@class=\"price-value-prices-wrapper\"]'\n '/ul[@class=\"price-value-prices-list js-price-value-prices-list\"]/li',\n 'ad_address': '//div[@class=\"item-address\"]/div[@itemprop=\"address\"]/span/text()'\n }\n\n def parse(self, response, first_run=True):\n if first_run:\n pages_count = int(\n response.xpath(self.__xpath_query['pagination']).extract()[-1].split('(')[-1].replace(')', ''))\n\n for num in range(2, pages_count + 1):\n yield response.follow(\n f'?p={num}',\n callback=self.parse,\n cb_kwargs={'first_run': False}\n )\n\n for link in response.xpath(self.__xpath_query['ads']):\n yield response.follow(\n link,\n callback=self.ads_parse\n )\n\n def ads_parse(self, response):\n ad = {}\n ad['url'] = response.url\n ad['title'] = response.xpath(self.__xpath_query['ad_title']).get()\n ad['address'] = response.xpath(self.__xpath_query['ad_address']).get().strip()\n\n gallery = response.xpath(self.__xpath_query['ad_gallery']).getall()\n ad['photo'] = ['https:' + url if url[:2] == '//' else url for url in gallery]\n\n price_wrapper = response.xpath(self.__xpath_query['ad_prices'])\n prices = price_wrapper.xpath('text()').getall()\n prices = [price.encode('ascii', 'ignore').decode().strip() for price in prices if price != '\\n ']\n currencies = price_wrapper.xpath('span/text()|span/span/text()').extract()\n\n ad['price'] = []\n for i in range(len(set(currencies))):\n ad['price'].append({'currency ' + currencies[i]: (prices[i], prices[i + len(set(currencies))])})\n\n param_wrapper = response.xpath(self.__xpath_query['ad_params'])\n keys = param_wrapper.xpath('span[@class=\"item-params-label\"]/text()').extract()\n values = param_wrapper.xpath('text()|a/text()').extract()\n values = [v.strip() for v in values if v.strip() != '']\n ad['params'] = []\n for i in range(len(keys)):\n ad['params'].append({keys[i][:-2]: values[i]})\n\n request = scrapy.Request(f'https://www.avito.ru/items/phone/{response.url.split(\"_\")[-1]}?=&vsrc=r',\n callback=self.ads_phone_parse)\n\n request.cb_kwargs['ad'] = ad\n yield request\n\n def ads_phone_parse(self, response, ad):\n b64_image_string = response.text.split('base64,')[-1][:-2]\n b64_obj = io.BytesIO(base64.b64decode(b64_image_string))\n image = Image.open(b64_obj)\n ad['phone'] = pytesseract.image_to_string(image).strip()\n\n yield ad\n" }, { "alpha_fraction": 0.544243574142456, "alphanum_fraction": 0.5550269484519958, "avg_line_length": 38.91139221191406, "blob_id": "6d5310d551ee56d3b812553f93ae51e7bbfbb565", "content_id": "5c2019766a16cc4655f1b5d30adc90eb13b21eba", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3153, "license_type": "no_license", "max_line_length": 121, "num_lines": 79, "path": "/5/gbdm/spiders/youla.py", "repo_name": "kgorshkoff/scraping", "src_encoding": "UTF-8", "text": "import scrapy\nfrom scrapy.loader import ItemLoader\n\nimport re\nimport urllib\nfrom gbdm.items import YoulaItem\n\n\nclass YoulaSpider(scrapy.Spider):\n name = 'avito'\n allowed_domains = ['auto.youla.ru']\n start_urls = ['https://auto.youla.ru/moskva/cars/used/chery']\n\n __xpath_query = {\n 'pagination': '//div[contains(@class,\"Paginator_block__2XAPy\")]/div[@class=\"Paginator_total__oFW1n\"]/text()',\n\n 'ads': '//div[@id=\"serp\"]/span/article//a[@data-target=\"serp-snippet-title\"]/@href'\n }\n\n __xpath_ad_query = {\n 'title': '//div[contains(@class, \"AdvertCard_pageContent__24SCy\")]'\n '/div[@class=\"AdvertCard_topAdvertHeader__iqqNl\"]'\n '//div[@class=\"AdvertCard_advertTitle__1S1Ak\"]/text()',\n\n 'specs': '//div[contains(@class, \"AdvertCard_info__3IKjT\")]/div[@class=\"AdvertCard_specs__2FEHc\"]/div',\n\n 'images': '//div[@class=\"PhotoGallery_block__1ejQ1\"]'\n '/div[@class=\"PhotoGallery_photoWrapper__3m7yM\"]'\n '/figure/picture/img/@src',\n\n 'price': '//div[@class=\"AdvertCard_topAdvertHeader__iqqNl\"]'\n '/div[@class=\"AdvertCard_priceBlock__1hOQW\"]'\n '/div[@data-target=\"advert-price\"]'\n '/text()',\n\n 'description': '//div[contains(@class, \"AdvertCard_description__2bVlR\")]//div//div/text()',\n\n 'phone': '//div[@class=\"advert__sticky-bottom-wrapper\"]/div/div/a/@href'\n }\n\n def parse(self, response, first_run=True):\n if first_run:\n pages_count = int(response.xpath(self.__xpath_query['pagination']).extract()[1])\n\n for num in range(2, pages_count + 1):\n yield response.follow(\n f'page={num}',\n callback=self.parse,\n cb_kwargs={'first_run': False}\n )\n\n for link in response.xpath(self.__xpath_query['ads']):\n yield response.follow(\n link,\n callback=self.ads_parse\n )\n\n def ads_parse(self, response):\n item_loader = ItemLoader(YoulaItem(), response)\n\n for key, value in self.__xpath_ad_query.items():\n item_loader.add_xpath(key, value)\n item_loader.add_value('url', response.url)\n if '/prv--' in response.url:\n sellerLink = urllib.parse.unquote(response.text).split('youlaId\",\"')[2].split('\"')[0]\n else:\n sellerLink = urllib.parse.unquote(response.text).split('sellerLink\",\"')[1].split('\"')[0]\n\n item_loader.add_value('seller', 'https://auto.youla.ru' + sellerLink)\n\n yield scrapy.Request(url=response.url,\n callback=self.phone_parse,\n headers={'User-Agent': 'Mozilla/5.0 (Android 10; Mobile; rv:79.0) Gecko/79.0 Firefox/79.0'},\n cb_kwargs={'item_loader': item_loader},\n dont_filter=True)\n\n def phone_parse(self, response, item_loader):\n item_loader.add_value('phone', response.xpath(self.__xpath_ad_query['phone']).extract())\n yield item_loader.load_item()\n" }, { "alpha_fraction": 0.8648648858070374, "alphanum_fraction": 0.8648648858070374, "avg_line_length": 36, "blob_id": "6058c2c0b79b6f478c46de4e16d53a129eb1ad44", "content_id": "c47c51ba6437c09c0dad67355a028fdd5b470a4d", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 37, "license_type": "no_license", "max_line_length": 36, "num_lines": 1, "path": "/README.MD", "repo_name": "kgorshkoff/scraping", "src_encoding": "UTF-8", "text": "GeekBrains scraping course goes here\n" }, { "alpha_fraction": 0.588686466217041, "alphanum_fraction": 0.5970757603645325, "avg_line_length": 41.141414642333984, "blob_id": "a6e7f27ea378562501ed85af8a1b079fa1311cb9", "content_id": "0999454ad8f3833b337e081c1a2d46c007a3222b", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 4172, "license_type": "no_license", "max_line_length": 116, "num_lines": 99, "path": "/7/mvideoselenium.py", "repo_name": "kgorshkoff/scraping", "src_encoding": "UTF-8", "text": "import os\nfrom pathlib import Path\n\nimport pymongo\nfrom dotenv import load_dotenv\nfrom selenium import webdriver\nfrom selenium.common.exceptions import TimeoutException\nfrom selenium.webdriver.common.by import By\nfrom selenium.webdriver.common.keys import Keys\nfrom selenium.webdriver.support import expected_conditions as EC\nfrom selenium.webdriver.support.ui import WebDriverWait\n\nmongo_server = '10.1.1.100'\nmongo_port = '27017'\n\n\nclass MvideoScraper:\n def __init__(self, *args, **kwargs):\n self.driver = webdriver.Firefox()\n self.driver.get('https://www.mvideo.ru/promo/bolshaya-shkolnaya-rasprodazha-skidki-bolee-40-mark168010620')\n\n self.mongo_uri = f'mongodb://{kwargs[\"mongo_login\"]}:{kwargs[\"mongo_password\"]}@{mongo_server}:{mongo_port}'\n self.mongo_db = 'mvideo'\n self.mongo_collection = type(self).__name__\n self.client = pymongo.MongoClient(self.mongo_uri)\n self.db = self.client[self.mongo_db]\n\n __xpath = {\n 'pagination_next': '//div[@class=\"o-pagination-section\"]/div[@class=\"c-pagination notranslate\"]'\n '/a[@class=\"c-pagination__next font-icon icon-up \"]',\n 'items': '//div[@data-init=\"productTileList\"]//div[contains(@class, \"product-tiles-list-wrapper\")]/div',\n\n 'details_button': '//ul[@class=\"c-tabs__menu-list\"]/li',\n 'details_categories': '//div[@class=\"product-details-specification-content\"]/div[2]/div/h3',\n 'details': '//div[@class=\"product-details-specification-content\"]/div[2]/div'\n '//table[@class=\"table table-striped product-details-table\"]'\n '//span[@class=\"product-details-overview-specification\"]',\n 'title': '//div[@class=\"o-pdp-topic__title\"]/h1',\n 'price': '//div[@class=\"c-pdp-price__summary\"]/div[@class=\"c-pdp-price__offers\"]'\n '/div[contains(@class, \"c-pdp-price__current\")]'\n\n }\n\n def start(self):\n while True:\n items_len = len(self.wait_get_element(self.__xpath['items'], multiple=True))\n\n for index in range(0, items_len):\n items = self.wait_get_element(self.__xpath['items'], multiple=True)\n item = items[index]\n item.click()\n\n self.wait_get_element(self.__xpath['details_button'], multiple=True)[1].click()\n\n result = {\n 'title': self.driver.find_element_by_xpath(self.__xpath['title']).text,\n 'price': self.driver.find_element_by_xpath(self.__xpath['price']).text,\n 'params': {},\n }\n\n # details_categories = self.wait_get_element(self.__xpath['details_categories'], multiple=True)\n details = self.wait_get_element(self.__xpath['details'], multiple=True)\n\n for i in range(0, len(details), 2):\n result['params'].update({details[i].text.replace('.', ''): details[i + 1].text})\n\n self.write_to_mongo(result)\n self.driver.execute_script('window.history.go(-2)')\n\n try:\n next_page = self.wait_get_element(self.__xpath_mail['pagination_next'])\n next_page.click()\n except Exception as e:\n print('No more pages to scrap')\n self.driver.quit()\n break\n\n def write_to_mongo(self, item):\n self.db[self.mongo_collection].insert_one(item)\n\n def wait_get_element(self, xpath, multiple=False, timeout=10):\n try:\n element_present = EC.presence_of_element_located((By.XPATH, xpath))\n WebDriverWait(self.driver, timeout).until(element_present)\n if multiple:\n return self.driver.find_elements_by_xpath(xpath)\n return self.driver.find_element_by_xpath(xpath)\n except TimeoutException:\n print(\"Timed out, shutting down\")\n self.driver.quit()\n\n\nif __name__ == '__main__':\n load_dotenv(dotenv_path=Path('.env').absolute())\n mail_crawler = MvideoScraper(\n mongo_login=os.getenv('MONGOLOGIN'),\n mongo_password=os.getenv('MONGOPASSWORD')\n )\n mail_crawler.start()\n" }, { "alpha_fraction": 0.6513680219650269, "alphanum_fraction": 0.6560752987861633, "avg_line_length": 29.07964515686035, "blob_id": "55367904e2a4ac241bbd6e9de963d03f7401cd90", "content_id": "64811f04dcb07f89178e32debbcacdd5ab0ae690", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3399, "license_type": "no_license", "max_line_length": 102, "num_lines": 113, "path": "/8/gbdm/items.py", "repo_name": "kgorshkoff/scraping", "src_encoding": "UTF-8", "text": "# Define here the models for your scraped items\n#\n# See documentation in:\n# https://docs.scrapy.org/en/latest/topics/items.html\nimport base64\nimport io\n\nimport pytesseract\nfrom PIL import Image\nfrom itemloaders.processors import MapCompose, Compose, TakeFirst\nfrom scrapy import Item, Field, Selector\n\n\ndef validate_photo_url(value):\n return value if value[:2] != '//' else 'https:' + value\n\n\ndef get_prices(value):\n tag = Selector(text=value)\n result = {'name': tag.xpath('.//span//text()').extract_first(),\n 'value': tag.xpath('//text()').extract_first().split()\n }\n result['value'] = float(''.join(result['value']))\n return result\n\n\ndef get_params(value):\n param_tag = Selector(text=value)\n key = param_tag.xpath('.//span[@class=\"item-params-label\"]/text()').extract_first().split(':')[0]\n\n value = ' '.join(\n [itm.strip() for itm in param_tag.xpath('//li/text()').extract()\n if not itm.isspace()]\n )\n\n return key, value\n\n\ndef get_phone(value):\n b64_obj = io.BytesIO(base64.b64decode(value))\n image = Image.open(b64_obj)\n result = pytesseract.image_to_string(image).strip()\n\n return result\n\n\nclass AvitoItem(Item):\n title = Field(output_processor=TakeFirst())\n url = Field(output_processor=TakeFirst())\n images = Field(input_processor=MapCompose(validate_photo_url))\n prices = Field(input_processor=MapCompose(get_prices))\n address = Field(output_processor=MapCompose(str.strip))\n params = Field(output_processor=lambda x: dict(get_params(itm) for itm in x))\n phone = Field(output_processor=MapCompose(get_phone))\n\n\ndef parse_specs(value):\n selector = Selector(text=value)\n keys = selector.xpath('//div[@class=\"AdvertSpecs_label__2JHnS\"]/text()').extract()\n values = selector.xpath('//a/text()|//div[@class=\"AdvertSpecs_data__xK2Qx\"]/text()').extract()\n\n result = dict(zip(keys, values))\n return result\n\n\ndef parse_phone(value):\n result = value[4:]\n return result\n\n\nclass YoulaItem(Item):\n url = Field(output_processor=TakeFirst())\n title = Field(output_processor=TakeFirst())\n specs = Field(input_processor=MapCompose(parse_specs),\n output_processor=TakeFirst())\n price = Field(input_processor=Compose(lambda x: ''.join(x[0].encode('ascii', 'ignore').decode())),\n output_processor=TakeFirst())\n images = Field(input_processor=MapCompose(validate_photo_url))\n description = Field(output_processor=TakeFirst())\n seller = Field(output_processor=TakeFirst())\n phone = Field(input_processor=MapCompose(parse_phone), output_processor=TakeFirst())\n\n\nclass InstagramPostItem(Item):\n comments_disabled = Field()\n typename = Field()\n id = Field()\n edge_media_to_caption = Field()\n shortcode = Field()\n edge_media_to_comment = Field()\n taken_at_timestamp = Field()\n dimensions = Field()\n display_url = Field()\n edge_liked_by = Field()\n edge_media_preview_like = Field()\n owner = Field()\n thumbnail_src = Field()\n thumbnail_resources = Field()\n is_video = Field()\n accessibility_caption = Field()\n product_type = Field()\n video_view_count = Field()\n\n\nclass InstagramAuthorItem(Item):\n typename = Field()\n id = Field()\n expiring_at = Field()\n has_pride_media = Field()\n latest_reel_media = Field()\n seen = Field()\n user = Field()\n owner = Field()\n" }, { "alpha_fraction": 0.5503376126289368, "alphanum_fraction": 0.5570902228355408, "avg_line_length": 36.88372039794922, "blob_id": "4367f71c944dac89634b053deb968544d4e23d37", "content_id": "d9740c1c34b4ed62a542adc66f908a6fac12a789", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 3258, "license_type": "no_license", "max_line_length": 110, "num_lines": 86, "path": "/3/homework/crawler.py", "repo_name": "kgorshkoff/scraping", "src_encoding": "UTF-8", "text": "from typing import List, Dict, Set\n\nimport re\nimport json\nimport lxml\nimport requests\nfrom bs4 import BeautifulSoup\n\n\nclass GBBlogParser:\n domain = 'https://habr.com'\n start_url = 'https://habr.com/ru/top/'\n\n def __init__(self):\n self.visited_urls = set()\n self.post_links = set()\n self.post_data = []\n self.headers = {\n 'User-Agent': 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:79.0) Gecko/20100101 '\n 'Firefox/79.0 '\n }\n\n def parse_rows(self, url=start_url):\n while url:\n if url in self.visited_urls:\n break\n response = requests.get(url, headers=self.headers)\n self.visited_urls.add(url)\n soup = BeautifulSoup(response.text, 'lxml')\n url = self.get_next_page(soup)\n self.post_links.update(self.search_post_links(soup))\n\n def get_next_page(self, soup: BeautifulSoup) -> str:\n ul = soup.find('ul', attrs={'class': 'arrows-pagination'})\n a = ul.find('a', attrs={'id': 'next_page'})\n return f'{self.domain}{a.get(\"href\")}' if a and a.get(\"href\") else None\n\n def search_post_links(self, soup: BeautifulSoup) -> Set[str]:\n wrapper = soup.find('div', attrs={'class': 'posts_list'})\n posts = wrapper.find_all('a', attrs={'class': 'post__title_link'})\n links = {f'{itm.get(\"href\")}' for itm in posts}\n return links\n\n def post_page_parse(self):\n for url in self.post_links:\n if url in self.visited_urls:\n continue\n response = requests.get(url)\n self.visited_urls.add(url)\n soup = BeautifulSoup(response.text, 'lxml')\n self.post_data.append(self.get_post_data(soup))\n\n def get_post_data(self, soup: BeautifulSoup) -> Dict[str, List]:\n result = {}\n result['url'] = soup.find('meta', attrs={'property': 'og:url'}).get('content')\n result['title'] = soup.find('meta', attrs={'property': 'og:title'}).get('content')\n\n post_additionals = soup.find('div', attrs={'class': 'post-additionals'})\n user_data = post_additionals.find('div', attrs={'class': 'user-info'})\n result['author'] = []\n\n result['author'].append({\n 'name': user_data.find('a', attrs={'class': re.compile('user-info__[a-z]{8}')}).text,\n 'url': f'https://habr.com/users/{user_data.get(\"data-user-login\")}/'\n })\n\n post_wrapper = soup.find('div', attrs={'class': 'post__wrapper'})\n\n tags = post_wrapper.find('ul', attrs={'class': 'js-post-tags'}).find_all('a')\n result['tags'] = []\n for tag in tags:\n result['tags'].append({'name': tag.get_text(strip=True), 'url': tag.get('href')})\n\n hubs = post_wrapper.find('ul', attrs={'class': 'js-post-hubs'}).find_all('a')\n result['hubs'] = []\n for hub in hubs:\n result['hubs'].append({'name': hub.get_text(strip=True), 'url': hub.get('href')})\n return result\n\n def save_to_file(self):\n with open('temp.json', 'w') as f:\n json.dump(self.post_data, f)\n\n def load_from_file(self):\n with open('temp.json', 'r') as f:\n self.post_data = json.load(f)\n" }, { "alpha_fraction": 0.7857142686843872, "alphanum_fraction": 0.7922077775001526, "avg_line_length": 21.14285659790039, "blob_id": "355d74c8384a9da391165d1e88f85e1eacf73077", "content_id": "c5e47a6314fac290788a5b845a4134c18aad1c13", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 154, "license_type": "no_license", "max_line_length": 47, "num_lines": 7, "path": "/6/gbdm/gbselenium.py", "repo_name": "kgorshkoff/scraping", "src_encoding": "UTF-8", "text": "from selenium import webdriver\nfrom selenium.webdriver.common.keys import Keys\n\n\ndriver = webdriver.Firefox()\ndriver.get('https://geekbrains.ru')\nprint(1)" }, { "alpha_fraction": 0.5026343464851379, "alphanum_fraction": 0.5075517892837524, "avg_line_length": 35.97402572631836, "blob_id": "7f37ebbdc03cbadb3e3b0138b355820843dc0d7b", "content_id": "ee99c13a0715e0b6ffb5d1a42865cf690fe3426b", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2847, "license_type": "no_license", "max_line_length": 111, "num_lines": 77, "path": "/8/gbdm/spiders/avito.py", "repo_name": "kgorshkoff/scraping", "src_encoding": "UTF-8", "text": "import scrapy\nfrom scrapy.loader import ItemLoader\n\nfrom gbdm.items import AvitoItem\n\n\nclass AvitoSpider(scrapy.Spider):\n name = 'avito'\n allowed_domains = ['www.avito.ru']\n start_urls = ['https://www.avito.ru/himki/kvartiry/prodam']\n\n __xpath_query = {\n 'pagination': '//div[@class=\"index-content-2lnSO\"]'\n '//div[contains(@data-marker, \"pagination-button\")]'\n '/span[@class=\"pagination-item-1WyVp\"]/@data-marker',\n\n 'ads': \"//h3[@class='snippet-title']\"\n \"/a[@class='snippet-link'][@itemprop='url']\"\n '/@href',\n\n 'title': '//h1[@class=\"title-info-title\"]'\n '/span[@itemprop=\"name\"]'\n '/text()',\n\n 'params': '//div[@class=\"item-params\"]'\n '/ul[@class=\"item-params-list\"]'\n '/li[@class=\"item-params-list-item\"]',\n\n 'images': '//div[@class=\"gallery-imgs-container js-gallery-imgs-container\"]'\n '/div[@class=\"gallery-img-wrapper js-gallery-img-wrapper\"]'\n '/div[1]'\n '/@data-url',\n\n 'prices': '//div[contains(@class, \"price-value-prices-wrapper\")]'\n '/ul[contains(@class, \"price-value-prices-list\")]'\n '/li[contains(@class, \"price-value-prices-list-item_size-normal\")]',\n\n 'address': '//div[@class=\"item-address\"]'\n '/div[@itemprop=\"address\"]'\n '/span'\n '/text()'\n }\n\n def parse(self, response, first_run=True):\n if first_run:\n pages_count = int(\n response.xpath(self.__xpath_query['pagination']).extract()[-1].split('(')[-1].replace(')', ''))\n\n for num in range(2, pages_count + 1):\n yield response.follow(\n f'?p={num}',\n callback=self.parse,\n cb_kwargs={'first_run': False}\n )\n\n for link in response.xpath(self.__xpath_query['ads']):\n yield response.follow(\n link,\n callback=self.ads_parse\n )\n\n def ads_parse(self, response):\n item_loader = ItemLoader(AvitoItem(), response)\n\n for key, value in self.__xpath_query.items():\n if key in ('ads', 'pagination'):\n continue\n item_loader.add_xpath(key, value)\n item_loader.add_value('url', response.url)\n\n yield scrapy.Request(url=f'https://www.avito.ru/items/phone/{response.url.split(\"_\")[-1]}?=&vsrc=r',\n callback=self.ads_get_phone,\n cb_kwargs={'item_loader': item_loader})\n\n def ads_get_phone(self, response, item_loader):\n item_loader.add_value('phone', response.text.split('base64,')[-1][:-2])\n yield item_loader.load_item()\n" }, { "alpha_fraction": 0.5440000295639038, "alphanum_fraction": 0.5446153879165649, "avg_line_length": 27.508771896362305, "blob_id": "c8a86c5b8f6056471e90446ff6d37ab6491c36df", "content_id": "f050a666a52e1bbfa888c43f78426565d2f8274f", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1625, "license_type": "no_license", "max_line_length": 77, "num_lines": 57, "path": "/3/homework/main.py", "repo_name": "kgorshkoff/scraping", "src_encoding": "UTF-8", "text": "from sqlalchemy import create_engine\nfrom sqlalchemy.orm import sessionmaker\n\nfrom models import Base, Author, Post, Tag, Hub\nfrom crawler import GBBlogParser\n\n\nclass SQLManager:\n def __init__(self):\n self.engine = create_engine('sqlite:///habr_top.db')\n Base.metadata.create_all(self.engine)\n self.session_db = sessionmaker(bind=self.engine)\n self.session = self.session_db()\n\n def get_or_create(self, model, **kwargs):\n instance = self.session.query(model).filter_by(**kwargs).first()\n if instance:\n return instance\n else:\n instance = model(**kwargs)\n self.session.add(instance)\n self.session.commit()\n return instance\n\n def save(self, arr):\n for itm in arr:\n post_tags = itm.pop('tags')\n post_hubs = itm.pop('hubs')\n post_author = itm.pop('author')\n\n args = {\n 'url': itm['url'],\n 'title': itm['title'],\n 'author_id': self.get_or_create(Author, **post_author[0]).id,\n }\n\n post = self.get_or_create(Post, **args)\n\n for tag in post_tags:\n obj = self.get_or_create(Tag, **tag)\n post.tag.append(obj)\n for hub in post_hubs:\n obj = self.get_or_create(Hub, **hub)\n post.hub.append(obj)\n\n self.session.commit()\n\n self.session.close()\n\n\nif __name__ == '__main__':\n parser = GBBlogParser()\n parser.parse_rows()\n parser.post_page_parse()\n\n sql = SQLManager()\n sql.save(parser.post_data)\n" }, { "alpha_fraction": 0.5774417519569397, "alphanum_fraction": 0.58111971616745, "avg_line_length": 33.46479034423828, "blob_id": "a4eb094d16948319c0f643976e67118f7f142127", "content_id": "a62c80b078c406f345ce1e9bc868e6f2e045d00a", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 2464, "license_type": "no_license", "max_line_length": 98, "num_lines": 71, "path": "/2/lesson/1.py", "repo_name": "kgorshkoff/scraping", "src_encoding": "UTF-8", "text": "from typing import List, Dict\n\nimport re\nimport requests\nfrom bs4 import BeautifulSoup\nfrom pymongo import MongoClient\n\n\nclass GBBlogParser:\n domain = 'https://geekbrains.ru'\n start_url = 'https://geekbrains.ru/posts'\n\n def __init__(self):\n self.client = MongoClient('mongodb://localhost:27017')\n self.db = self.client['parse_gb_blog']\n self.collection = self.db['posts']\n self.visited_urls = set()\n self.post_links = set()\n self.post_data = []\n\n def parse_rows(self, url=start_url):\n while url:\n if url in self.visited_urls:\n break\n response = requests.get(url)\n self.visited_urls.add(url)\n soup = BeautifulSoup(response.text, 'lxml')\n url = self.get_next_page(soup)\n self.search_post_links(soup)\n\n def get_next_page(self, soup: BeautifulSoup) -> str:\n ul = soup.find('ul', attrs={'class': 'gb__pagination'})\n a = ul.find('a', text=\"›\")\n return f'{self.domain}{a.get(\"href\")}' if a and a.get(\"href\") else None\n\n def search_post_links(self, soup: BeautifulSoup) -> List[str]:\n wrapper = soup.find('div', attrs={'class': 'post-items-wrapper'})\n posts = wrapper.find_all('div', attrs={'class': 'post-item'})\n links = {f'{self.domain}{itm.find(\"a\").get(\"href\")}' for itm in posts}\n self.post_links.update(links)\n\n def post_page_parse(self):\n for url in self.post_links:\n if url in self.visited_urls:\n continue\n response = requests.get(url)\n self.visited_urls.add(url)\n soup = BeautifulSoup(response.text, 'lxml')\n if len(self.post_data) > 5:\n break\n self.post_data.append(self.get_post_data(soup))\n\n def get_post_data(self, soup: BeautifulSoup) -> Dict[str, str]:\n result = {}\n result['title'] = soup.find('h1', attrs={'class':'blogpost-title'}).text\n content = soup.find('div', attrs={'class': 'blogpost-content', 'itemprop': 'articleBody'})\n img = content.find('img')\n result['image'] = img.get('src') if img else None\n return result\n\n def save_to_mongo(self):\n self.collection.insert_many(self.post_data)\n print('Данные сохранены')\n\n\nif __name__ == '__main__':\n parser = GBBlogParser()\n parser.parse_rows()\n parser.post_page_parse()\n parser.save_to_mongo()\n print(1)\n" }, { "alpha_fraction": 0.635374128818512, "alphanum_fraction": 0.636734664440155, "avg_line_length": 29.625, "blob_id": "a6e107ea4243a9c8e8f8c5b9ea34d84cf70e8af9", "content_id": "2c9c75ce41073f4ec55758eb710270eb7a43255b", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 1470, "license_type": "no_license", "max_line_length": 115, "num_lines": 48, "path": "/5/gbdm/pipelines.py", "repo_name": "kgorshkoff/scraping", "src_encoding": "UTF-8", "text": "# Define your item pipelines here\n#\n# Don't forget to add your pipeline to the ITEM_PIPELINES setting\n# See: https://docs.scrapy.org/en/latest/topics/item-pipeline.html\n\n\n# useful for handling different item types with a single interface\nimport pymongo\nfrom scrapy import Request\nfrom scrapy.pipelines.images import ImagesPipeline\n\n\nclass GbdmPipeline:\n def __init__(self, mongo_uri, mongo_db):\n self.mongo_uri = mongo_uri\n self.mongo_db = mongo_db\n\n @classmethod\n def from_crawler(cls, crawler):\n return cls(\n mongo_uri=f'mongodb://{crawler.settings.get(\"MONGODB_SERVER\")}:{crawler.settings.get(\"MONGODB_PORT\")}',\n mongo_db=crawler.spider.name\n )\n\n def open_spider(self, spider):\n self.client = pymongo.MongoClient(self.mongo_uri)\n self.db = self.client[self.mongo_db]\n\n def close_spider(self, spider):\n self.client.close()\n\n def process_item(self, item, spider):\n collection = self.db[type(item).__name__]\n collection.update({'url': item['url']}, item, upsert=True)\n return item\n\n\nclass GbdmImagePipeline(ImagesPipeline):\n def get_media_requests(self, item, info):\n for url in item.get('images', []):\n try:\n yield Request(url)\n except Exception as e:\n print(e)\n\n def item_completed(self, results, item, info):\n item['images'] = [itm[1] for itm in results if itm[0]]\n return item\n" } ]
14
qiaoD/learnPython
https://github.com/qiaoD/learnPython
40410b8b1666b0846b768ff0ad649ac63396e7a5
5cc48d99d3eb89daab3c1f65e4a4f05bafb6463c
73d22b5f24bb606d3d630e257d6129341bb540a3
refs/heads/master
2021-05-13T21:08:53.347161
2019-01-16T11:13:17
2019-01-16T11:13:17
116,454,313
0
0
null
null
null
null
null
[ { "alpha_fraction": 0.5027322173118591, "alphanum_fraction": 0.5027322173118591, "avg_line_length": 10.4375, "blob_id": "ba7240b475db21d895bb8ec95f82c3b36cbb157e", "content_id": "2a6df6a10d7788c12820e14f22d0cf172b0ebf80", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 183, "license_type": "no_license", "max_line_length": 23, "num_lines": 16, "path": "/mro.py", "repo_name": "qiaoD/learnPython", "src_encoding": "UTF-8", "text": "class A(list):\n def show(self):\n print(\"A:show\")\n\nclass B(list):\n def show(self):\n print(\"B:show\")\n\nclass C(A):\n pass\n\nclass D(B,C):\n pass\n\nd = D()\nd.show()\n" }, { "alpha_fraction": 0.5591397881507874, "alphanum_fraction": 0.5929339528083801, "avg_line_length": 12.541666984558105, "blob_id": "dd56d3d810539c9ff37b425ce23786e5fcd09228", "content_id": "6d50590abe3fe2ca8d85e2e486f2657ca6a4b1d3", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 651, "license_type": "no_license", "max_line_length": 56, "num_lines": 48, "path": "/mult_threading.py", "repo_name": "qiaoD/learnPython", "src_encoding": "UTF-8", "text": "'''\n\nauthor : QD\ntime : 2018/02/15\n \ninfo : mult_threading\n\n\n'''\n\nimport time\nimport threading\n\n\ndef calc_square(numbers):\n print(\"calc square numbers\")\n for n in numbers:\n time.sleep(0.2)\n print(\"square is :\",n*n)\n\n\ndef calc_cube(numbers):\n print(\"calc cube numbers\")\n for n in numbers:\n time.sleep(0.2)\n print(\"cube is :\",n*n*n)\n\n\narr = [2,4,5,9]\nt = time.time()\n\n'''\n\ncalc_square(arr)\ncalc_cube(arr)\n\n'''\nt1 = threading.Thread(target=calc_square,args = (arr, ))\nt2 = threading.Thread(target=calc_cube, args = (arr, ))\n\nt1.start()\nt2.start()\n\nt1.join()\nt2.join()\n\n\nprint('the time is ',time.time() - t)\n\n" }, { "alpha_fraction": 0.4516128897666931, "alphanum_fraction": 0.5645161271095276, "avg_line_length": 7.5714287757873535, "blob_id": "2333fee071846badc14c7893ba753fcbd5a57fff", "content_id": "798f502bf7b5821aa68676dab72b7143790255d4", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 88, "license_type": "no_license", "max_line_length": 17, "num_lines": 7, "path": "/teachplan/README.md", "repo_name": "qiaoD/learnPython", "src_encoding": "UTF-8", "text": "# 大纲\n\n## 第0课:Python基本介绍\n\n- PPT:00.PPT\n- 教案:00.md\n- 代码:00.py\n\n\n" }, { "alpha_fraction": 0.45710480213165283, "alphanum_fraction": 0.466235488653183, "avg_line_length": 29.92352867126465, "blob_id": "8faa46674c09d66c48cc514b56d167b654855f24", "content_id": "7a532b5543f6b061909331d243fd006b164a3c7f", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 5357, "license_type": "no_license", "max_line_length": 166, "num_lines": 170, "path": "/static.py", "repo_name": "qiaoD/learnPython", "src_encoding": "UTF-8", "text": "'''\n\nAuthor : QD\ntime : 2018/01/28\n\n\n'''\n\n\nimport time\nimport pymysql\n\nimport sklearn\nimport numpy as np\nimport matplotlib.pyplot as plt\nplt.rcParams['font.sans-serif']=['SimHei'] #用来正常显示中文标签\nplt.rcParams['axes.unicode_minus']=False #用来正常显示负号\nimport matplotlib\nfrom matplotlib import style\nstyle.use(\"ggplot\")\n\nimport win_unicode_console\nwin_unicode_console.enable()\n\n\nclass lagou:\n\n # mysql config\n mysql_host = '127.0.0.1'\n mysql_user = 'root'\n mysql_pwd = 'root'\n mysql_db = 'lagou'\n mysql_port = 3306\n mysql_conn = 0\n mysql_charset = 'utf8'\n\n tb_type = 'tb_type'\n tb_job = 'tb_job'\n zhfont = matplotlib.font_manager.FontProperties(fname='simfang.ttf')\n\n\n allTypes = []\n\n\n def __init__(self):\n\n self.mysqlConnect()\n if self.mysql_conn:\n self.types()\n for job in self.allTypes:\n self.education(tid=job['id'],types=job['name'])\n self.city(tid=job['id'],types=job['name'])\n #self.lang()\n\n def city(self,tid = -1,types = \"\"):\n sqlSelect = \"SELECT COUNT(*) as sum,city FROM {tb_job} WHERE tid={tid} GROUP BY city ORDER BY sum DESC LIMIT 10\".format(tb_job=self.tb_job,tid=tid)\n mysql_conn = self.mysql_conn\n x = []\n y = []\n with mysql_conn.cursor() as cur:\n try:\n cur.execute(sqlSelect)\n if cur.rowcount:\n results = cur.fetchall()\n for row in results:\n y.append(row[0])\n x.append(row[1])\n width=0.5\n xx = np.arange(len(x))\n plt.bar(xx, y)\n\n plt.title(types+'岗位统计')\n plt.xlabel(u'城市')\n plt.ylabel(u'岗位数量')\n plt.xticks(xx+width/2, x, rotation=40)\n plt.legend(property = self.zhfont)\n plt.savefig(\"images/city/\"+types+\".png\")\n except:\n self.logInfo(\"Unable to get the data\")\n\n\n def lang(self):\n sqlSelect = \"SELECT COUNT(*) as sum,b.name FROM {tb_job} as a,{tb_type} as b WHERE a.tid=b.id GROUP BY a.tid\".format(tb_job=self.tb_job,tb_type=self.tb_type)\n mysql_conn = self.mysql_conn\n x = []\n y = []\n with mysql_conn.cursor() as cur:\n try:\n cur.execute(sqlSelect)\n if cur.rowcount:\n results = cur.fetchall()\n for row in results:\n y.append(row[0])\n x.append(row[1])\n width=0.5\n xx = np.arange(len(x))\n plt.bar(xx, y)\n\n plt.title('岗位统计')\n plt.xlabel(u'语言')\n plt.ylabel(u'岗位数量')\n plt.xticks(xx+width/2, x, rotation=40)\n plt.legend(property = self.zhfont)\n plt.savefig(\"images/语言.png\")\n except:\n self.logInfo(\"Unable to get the data\")\n\n def education(self,tid = -1,types = \"\"):\n sqlSelect = \"SELECT COUNT(*) as sum,education FROM {tb_job} WHERE tid={tid} GROUP BY education ORDER BY sum DESC\".format(tb_job=self.tb_job,tid=tid)\n mysql_conn = self.mysql_conn\n x = []\n y = []\n with mysql_conn.cursor() as cur:\n try:\n cur.execute(sqlSelect)\n if cur.rowcount:\n results = cur.fetchall()\n for row in results:\n y.append(row[0])\n x.append(row[1])\n width=0.5\n xx = np.arange(len(x))\n plt.bar(xx, y)\n\n plt.title(types+'学历统计')\n plt.xlabel(u'学历')\n plt.ylabel(u'岗位数量')\n plt.xticks(xx+width/2, x, rotation=40)\n plt.legend(property = self.zhfont)\n plt.savefig(\"images/edu/\"+types+\".png\")\n except:\n self.logInfo(\"Unable to get the data\")\n\n\n def types(self):\n self.logInfo(\"get the types in tb_type...\")\n mysql_conn = self.mysql_conn\n sqlSelect = \"select * from tb_type\"\n with mysql_conn.cursor() as cur:\n cur.execute(sqlSelect)\n self.logInfo(\"all types count:\"+str(cur.rowcount))\n self.allTypes = [{\"id\":x[0],\"name\":x[1],\"url\":x[2]} for x in cur]\n\n\n def mysqlConnect(self):\n try:\n conn = pymysql.connect(host = self.mysql_host,\n user = self.mysql_user,\n password = self.mysql_pwd,\n db = self.mysql_db,\n port = self.mysql_port,\n charset = self.mysql_charset\n )\n except:\n print(\"link mysql error!\")\n else:\n self.mysql_conn = conn\n #print(\"link seccuess\")\n\n\n\n def logInfo(self,info):\n print(info)\n\n\n def __del__(self):\n self.mysql_conn.close()\n\n\ng = lagou()\n" }, { "alpha_fraction": 0.4761904776096344, "alphanum_fraction": 0.4950806796550751, "avg_line_length": 35.69314193725586, "blob_id": "956e3596f8822bddb0e4f92e100bbf1715d681f3", "content_id": "c3c8c1485eb5a2d3edc6aa9f6fe7fff07b23a2f0", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 10271, "license_type": "no_license", "max_line_length": 171, "num_lines": 277, "path": "/lagou.py", "repo_name": "qiaoD/learnPython", "src_encoding": "UTF-8", "text": "'''\n\nAuthor : QD\ntime : 2018/01/28\n\n******************************************************************\npackages : requests + BeautifulSoup + re + time + PyMySQL\n 网页抓取基本原理 + HTML解析基本原理 + 正则表达式\n requests : API基本函数使用 + 使用代理\n BeautifulSoup : API + 正则表达式写法\n 爬虫关键字 : 分布式 | 多线程 | 代理\nwebSite : www.lagou.com\nproxy web: http://www.xicidaili.com/wn/\ninfo : the job types + job information\n******************************************************************\n\nlists : 1. requests API : http://cn.python-requests.org/zh_CN/latest/\n 2. BeautifulSoup API : https://www.crummy.com/software/BeautifulSoup/bs4/doc.zh/\n 3. re API : https://docs.python.org/3/library/re.html\n 4. PyMySQL API : https://www.tutorialspoint.com/python3/python_database_access.htm\n 5. try-except : https://www.tutorialspoint.com/python3/python_exceptions.htm\n 6. file op : https://www.tutorialspoint.com/python3/python_files_io.htm\n\n******************************************************************\nissues : 1. pymysql API\n 2. mysql charset\n 3. how to use try - except\n\n******************************************************************\ndatabase : lagou\ntables : tb_type , tb_job\n\ntb_type : id, name, url\n 0, 机器学习, jiqixuexi\ntb_job : id, tid(id in tb_type), name, city, money, exper, education, company, field, stage\n******************************************************************\n## time:2018/01/30\n1. create database and tables\n2. get the homePage data\n## time:2018/01/31\n1. get the pages data ok\n2. insert into db\n3. log the result so I should alter the table named tb_type that add a colum \"log\"\n\ncreate database `lagou`;\nuse lagou;\nCREATE TABLE `tb_type` (\n `id` int(11) NOT NULL AUTO_INCREMENT,\n `name` varchar(255) NOT NULL,\n `url` varchar(255) NOT NULL,\n PRIMARY KEY (`id`)\n)ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin,\nAUTO_INCREMENT=1;\n\nCREATE TABLE `tb_job` (\n `id` int(11) NOT NULL AUTO_INCREMENT,\n `tid` int(11) NOT NULL,\n `name` varchar(255) NOT NULL,\n `city` varchar(255) NOT NULL,\n `money` varchar(255) NOT NULL,\n `exper` varchar(255) NOT NULL,\n `education` varchar(255) NOT NULL,\n `company` varchar(255) NOT NULL,\n `field` varchar(255) NOT NULL,\n `stage` varchar(255) NOT NULL,\n `url` varchar(255) NOT NULL,\n PRIMARY KEY (`id`)\n)ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin,\nAUTO_INCREMENT=1;\n\n'''\n\n\nimport time\nimport re\nimport requests\nfrom bs4 import *\nimport pymysql\n\nimport win_unicode_console\nwin_unicode_console.enable()\n\n\nclass lagou:\n\n # mysql config\n mysql_host = '127.0.0.1'\n mysql_user = 'root'\n mysql_pwd = 'root'\n mysql_db = 'lagou'\n mysql_port = 3306\n mysql_conn = 0\n mysql_charset = 'utf8'\n\n # spider config\n proxyUrl = 'http://tvp.daxiangdaili.com/ip/?tid=559934516929845&num=1000&delay=1&protocol=https'\n proxies = []\n headers = {\n 'Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',\n 'Accept-Encoding':'gzip, deflate, br',\n 'Accept-Language':'en,zh-CN;q=0.9,zh;q=0.8,en-US;q=0.7',\n 'Cache-Control':'max-age=0',\n 'Connection':'keep-alive',\n 'Host':'www.lagou.com',\n 'Referer':'https://www.lagou.com/',\n 'Upgrade-Insecure-Requests':'1',\n 'User-Agent':'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Mobile Safari/537.36'\n }\n\n # web info\n homeUrl = 'https://www.lagou.com/'\n listUrl = 'https://www.lagou.com/zhaopin/'\n allTypes = []\n writeUrl = 'html/'\n\n\n def __init__(self):\n\n self.mysqlConnect()\n if self.mysql_conn:\n # self.homePage() # get the homePage\n self.types()\n\n self.makeproxies()\n self.jobs()\n\n def makeproxies(self):\n url = self.proxyUrl\n reqGet = requests.get(url)\n self.proxies = reqGet.text.split(\"\\r\\n\")\n\n\n def mysqlConnect(self):\n try:\n conn = pymysql.connect(host = self.mysql_host,\n user = self.mysql_user,\n password = self.mysql_pwd,\n db = self.mysql_db,\n port = self.mysql_port,\n charset = self.mysql_charset\n )\n except:\n print(\"link mysql error!\")\n else:\n self.mysql_conn = conn\n #print(\"link seccuess\")\n\n\n # 1. get job types and links in homePage\n # 2. write into the mysql\n def homePage(self):\n # sql\n mysql_conn = self.mysql_conn\n sqlInsert = \"insert into tb_type(`name`,`url`) VALUES \"\n self.logInfo(\"beginning...\")\n req = requests.get(self.homeUrl)\n if req.status_code == 200:\n req.encoding = 'UTF-8'\n text = req.text\n soup = BeautifulSoup(text, \"lxml\")\n tags = soup.findAll(name='a',attrs={\"href\":re.compile(r'^https://www.lagou.com/zhaopin/.')})\n for tag in tags:\n name = str(tag.text).strip()\n url = tag.get('href').strip('/').split('/')[-1]\n print(name+\"--\"+url)\n sqlInsert += '(\"'+name+'\",\"'+url+'\"),'\n #print(sqlInsert)\n self.logInfo(\"insert into mysql...\")\n with mysql_conn.cursor() as cur:\n cur.execute(sqlInsert.strip(\",\"))\n mysql_conn.commit()\n\n def types(self):\n self.logInfo(\"get the types in tb_type...\")\n mysql_conn = self.mysql_conn\n sqlSelect = \"select * from tb_type\"\n with mysql_conn.cursor() as cur:\n cur.execute(sqlSelect)\n self.logInfo(\"all types count:\"+str(cur.rowcount))\n self.allTypes = [{\"id\":x[0],\"name\":x[1],\"url\":x[2]} for x in cur]\n\n\n\n\n def jobs(self):\n allTypes = self.allTypes\n for types in allTypes:\n self.jobInfo(types['id'],types['url'])\n\n\n def jobInfo(self,tid=-1,cat=''):\n url = self.listUrl + cat + '/'\n headers = self.headers # http headers\n proxiesList = self.proxies # https proxy IP\n self.logInfo(\"beginning get the cat:\" + url)\n mysql_conn = self.mysql_conn\n\n pageList = [x for x in range(1,31)]\n # get the page in for loop\n while(pageList):\n if proxiesList:\n proxies = {\"https\":proxiesList.pop()}\n else:\n self.makeproxies()\n proxiesList = self.proxies\n pageNum = pageList[0]\n numUrl = url + str(pageNum)\n\n self.logInfo(\"begin to get the url:\"+numUrl)\n\n try:\n reqGet = requests.get(url = numUrl, headers = headers,proxies = proxies, timeout=5)\n except:\n self.logInfo('error!')\n else:\n print(reqGet.status_code)\n if reqGet.status_code == 404 :\n break;\n reqGet.encoding = 'UTF-8'\n pageText = reqGet.text\n soup = BeautifulSoup(pageText, \"lxml\")\n tags = soup.findAll(name='li',attrs={\"class\":\"con_list_item\"})\n # name, city, lmoney, hmoney, exper, education, company, field, stage\n if tags:\n # write in .html\n self.logInfo(\"begin to write in html\")\n self.htmlWrite(pageText,cat+str(pageNum)+\".html\")\n self.logInfo(\"end ...\")\n sqlInsert = 'insert into tb_job(`tid`,`name`,`city`,`money`,`exper`,`education`,`company`,`field`,`stage`,`url`) VALUES'\n for tag in tags:\n name = tag.find(name='h3').text.strip()\n city = tag.find(name='em').text.split('·')[0].strip()\n money = tag.find(name='span',attrs={\"class\":\"money\"}).text.strip()\n li_b = tag.find(name='div',attrs={\"class\":\"li_b_l\"}).text\n pos = li_b.rfind(\"k\")+1\n if -1 == pos:\n pos = li_b.rfind(\"K\")+1\n experAndEd = li_b[pos:].split('/')\n exper = experAndEd[0].strip()\n education = experAndEd[1].strip()\n company = tag.find(name='div',attrs={\"class\":\"company_name\"}).find(name='a').text.strip()\n industry = tag.find(name='div',attrs={\"class\":\"industry\"}).text.split('/')\n field = industry[0].strip()\n stage = industry[1].strip()\n sqlUrl = tag.find(name='a',attrs={\"class\":\"position_link\"}).get('href').strip()\n self.logInfo(name+','+city+','+money+','+exper+','+education+','+company+','+field+','+stage)\n sqlInsert += '('+str(tid)+','+'\"'+name+'\",\"'+city+'\",\"'+money+'\",\"'+exper+'\",\"'+education+'\",\"'+company+'\",\"'+field+'\",\"'+stage+'\",\"'+sqlUrl+ '\"),'\n\n\n self.logInfo(\"begin to write into mysql..\")\n #self.logInfo(sqlInsert)\n with mysql_conn.cursor() as cur:\n try:\n cur.execute(sqlInsert.strip(\",\"))\n mysql_conn.commit()\n except:\n self.logInfo(\"mysql error\")\n else:\n del(pageList[0])\n self.logInfo(\"end..\")\n\n\n def htmlWrite(self,text,filename):\n url = self.writeUrl+filename\n with open(url, \"w\", encoding='UTF-8') as f:\n f.write(text)\n f.close()\n\n def logInfo(self,info):\n print(info)\n\n\n def __del__(self):\n self.mysql_conn.close()\n\n\ng = lagou()\n" }, { "alpha_fraction": 0.4954337775707245, "alphanum_fraction": 0.5205479264259338, "avg_line_length": 10.810811042785645, "blob_id": "40b82512dc8f12dec2c18ba8ab52b96f6a6e52be", "content_id": "479499e8d8a11dec5061c14e2b350fabcaaa4504", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 438, "license_type": "no_license", "max_line_length": 46, "num_lines": 37, "path": "/exceptions.py", "repo_name": "qiaoD/learnPython", "src_encoding": "UTF-8", "text": "'''\n\nauthor : QD\ntime : 2018/02/09\n \ninfo : Exceptions\n\n'''\n\n'''\n\n# 1\ndef f():\n g()\ndef g():\n h()\ndef h():\n i = 1/0\nf()\n\n'''\n\nimport sys\n\ntry:\n filePath = 'test.txt'\n f = open(filePath)\nexcept FileNotFoundError:\n exc_type, exc_val, exc_tb = sys.exc_info()\n print('exc_type is :', exc_type)\n print('exc_val is :', exc_val)\n print('exc_tb is :', exc_tb)\nelse:\n print(f.read())\n\nfinally:\n f.close()\n\n" }, { "alpha_fraction": 0.699999988079071, "alphanum_fraction": 0.7105262875556946, "avg_line_length": 12.571428298950195, "blob_id": "60c3d4963ab90f35e1d81d67acc1ed66e1a7bccf", "content_id": "9b91a26b278570ce91e96666a0f9e8d262ba2937", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Markdown", "length_bytes": 318, "license_type": "no_license", "max_line_length": 89, "num_lines": 14, "path": "/README.md", "repo_name": "qiaoD/learnPython", "src_encoding": "UTF-8", "text": "![](http://www.wherer.cn/images/pub/py.jpg)\n\n# 关于课程\n\nPython是一门很年轻的语言,也是“90后”。\n如果你想看一下Python在计算机语言历史长河中的位置,请点击->[计算机语言年鉴表](http://www.wherer.cn/images/pub/tongues.jpg)。\n\n\n\n# 课程大纲\n\n\n\n# 使用到的资源\n" }, { "alpha_fraction": 0.45215311646461487, "alphanum_fraction": 0.4653109908103943, "avg_line_length": 20.894737243652344, "blob_id": "fbb6a3d7f5f53de0d8096440be23068a6e1fe5d6", "content_id": "532c8a6b655042249a557e6c5f5fc2e9ed7912a1", "detected_licenses": [], "is_generated": false, "is_vendor": false, "language": "Python", "length_bytes": 836, "license_type": "no_license", "max_line_length": 59, "num_lines": 38, "path": "/cmp.py", "repo_name": "qiaoD/learnPython", "src_encoding": "UTF-8", "text": "'''\n\nauthor : QD\ntime : 2018/02/09\n \ninfo : Context-Management-Protocol\n contextmanager.__enter__()\n contextmanager.__exit__(exc_type, exc_val, exc_tb)\n\n'''\n\nclass MyCMP:\n def __init__(self, tag):\n self.tag = tag\n print(\"[__init__]:%s\" % tag)\n\t\t\n def __enter__(self):\n print(\"[__enter__]:%s\" % self.tag)\n def __exit__(self, exc_type, exc_val, exc_tb):\n\n if exc_tb is None:\n print(\"[__exit__]: %s\" % self.tag)\n else:\n print(\"exc_type :%s\" % exc_type )\n print(\"exc_val :%s\" % exc_val)\n print(\"exc_tb :%s\" % exc_tb)\n return 1\n \n\nwith MyCMP('normal'):\n print('with-body')\n\nprint('================================')\n\nwith MyCMP('with-exception'):\n print('with-body')\n # raise Exception\n 1/0\n\n\n\n\n" } ]
8